From: Andrea Amorese Date: Mon, 3 Jan 2022 09:49:25 +0000 (+0100) Subject: Built motion from commit 66694403.|2.5.44 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22%7B%7Blicense.mail?a=commitdiff_plain;h=64d62d897d0b52625123d7e37dfcb4165e8a48c6;p=motion2.git Built motion from commit 66694403.|2.5.44 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 4ea561b..efa166b 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-03T08:33:42.228Z", + "time": "2022-01-03T09:28:30.098Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 7b2be20..decd898 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-03T08:33:42.228Z", + "time": "2022-01-03T09:28:30.098Z", "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 648f1ba..bd9e470 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 _0xbec2=['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]','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','integration','motionbar','urlForward','browser','bot','script'];(function(_0x435f8a,_0x5d77fc){var _0x2f1040=function(_0x3b6ff9){while(--_0x3b6ff9){_0x435f8a['push'](_0x435f8a['shift']());}};_0x2f1040(++_0x5d77fc);}(_0xbec2,0x1ab));var _0x2bec=function(_0x47c217,_0x5c8ff7){_0x47c217=_0x47c217-0x0;var _0x23023c=_0xbec2[_0x47c217];return _0x23023c;};'use strict';var Sequelize=require(_0x2bec('0x0'));module[_0x2bec('0x1')]={'name':{'type':Sequelize[_0x2bec('0x2')],'get':function(_0x33e189){return this[_0x2bec('0x3')](_0x2bec('0x4'));}},'action':{'type':Sequelize[_0x2bec('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x2bec('0x6'),_0x2bec('0x7'),_0x2bec('0x8'),'jscripty',_0x2bec('0x9'),_0x2bec('0xa'),_0x2bec('0xb'),_0x2bec('0xc')]],'msg':_0x2bec('0xd')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x2bec('0xe')},'data2':{'type':Sequelize[_0x2bec('0x5')](0x1000),'comment':_0x2bec('0xf')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x2bec('0x5')](0x1000),'comments':_0x2bec('0x10')},'data5':{'type':Sequelize[_0x2bec('0x5')](0x1000),'comments':_0x2bec('0x11')},'data6':{'type':Sequelize[_0x2bec('0x5')],'comments':_0x2bec('0x12')},'data7':{'type':Sequelize[_0x2bec('0x13')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xb933=['urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','motionbar','jscripty'];(function(_0xaa699c,_0x532b21){var _0x1a3be4=function(_0x12692a){while(--_0x12692a){_0xaa699c['push'](_0xaa699c['shift']());}};_0x1a3be4(++_0x532b21);}(_0xb933,0x1ef));var _0x3b93=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xb933[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x3b93('0x0'));module[_0x3b93('0x1')]={'name':{'type':Sequelize[_0x3b93('0x2')],'get':function(_0x195d85){return this[_0x3b93('0x3')](_0x3b93('0x4'));}},'action':{'type':Sequelize[_0x3b93('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x3b93('0x6'),'integration',_0x3b93('0x7'),_0x3b93('0x8'),_0x3b93('0x9'),_0x3b93('0xa'),_0x3b93('0xb'),_0x3b93('0xc')]],'msg':_0x3b93('0xd')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x3b93('0x5')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x3b93('0x5')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x3b93('0x5')](0x1000),'comment':_0x3b93('0xe')},'data4':{'type':Sequelize[_0x3b93('0x5')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x3b93('0x5')](0x1000),'comments':_0x3b93('0xf')},'data6':{'type':Sequelize[_0x3b93('0x5')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x3b93('0x10')],'comments':_0x3b93('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 23db3b6..33d1480 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 _0xfebf=['offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x542628,_0x4970ac){var _0x2a07c1=function(_0xc638c4){while(--_0xc638c4){_0x542628['push'](_0x542628['shift']());}};_0x2a07c1(++_0x4970ac);}(_0xfebf,0x1b4));var _0xffeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebf[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xffeb('0x0'));var rimraf=require(_0xffeb('0x1'));var zipdir=require(_0xffeb('0x2'));var jsonpatch=require(_0xffeb('0x3'));var rp=require(_0xffeb('0x4'));var moment=require(_0xffeb('0x5'));var BPromise=require(_0xffeb('0x6'));var Mustache=require(_0xffeb('0x7'));var util=require(_0xffeb('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xffeb('0x9'));var ejs=require(_0xffeb('0xa'));var fs=require('fs');var fs_extra=require(_0xffeb('0xb'));var _=require('lodash');var squel=require(_0xffeb('0xc'));var crypto=require(_0xffeb('0xd'));var jsforce=require(_0xffeb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xffeb('0x9'));var querystring=require(_0xffeb('0xf'));var Papa=require('papaparse');var Redis=require(_0xffeb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xffeb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffeb('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xffeb('0x13'));var licenseUtil=require(_0xffeb('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c0526,_0x981750){_0x981750=_0x981750||0xcc;return function(_0xaf2dd5){if(_0xaf2dd5){return _0x3c0526[_0xffeb('0x15')](_0x981750);}return _0x3c0526[_0xffeb('0x16')](_0x981750)[_0xffeb('0x17')]();};}function respondWithResult(_0x1e0e20,_0x15b598){_0x15b598=_0x15b598||0xc8;return function(_0x2ba130){if(_0x2ba130){return _0x1e0e20[_0xffeb('0x16')](_0x15b598)['json'](_0x2ba130);}};}function respondWithFilteredResult(_0x4cdc8f,_0x158346){return function(_0x87df5b){if(_0x87df5b){var _0x4cc3c1=typeof _0x158346[_0xffeb('0x18')]===_0xffeb('0x19')&&typeof _0x158346['limit']===_0xffeb('0x19');var _0x16f4d1=_0x87df5b[_0xffeb('0x1a')];var _0x5a13da=_0x4cc3c1?0x0:_0x158346[_0xffeb('0x18')];var _0xb96759=_0x4cc3c1?_0x87df5b[_0xffeb('0x1a')]:_0x158346[_0xffeb('0x18')]+_0x158346[_0xffeb('0x1b')];var _0x10f984;if(_0xb96759>=_0x16f4d1){_0xb96759=_0x16f4d1;_0x10f984=0xc8;}else{_0x10f984=0xce;}_0x4cdc8f[_0xffeb('0x16')](_0x10f984);return _0x4cdc8f[_0xffeb('0x1c')](_0xffeb('0x1d'),_0x5a13da+'-'+_0xb96759+'/'+_0x16f4d1)[_0xffeb('0x1e')](_0x87df5b);}return null;};}function patchUpdates(_0x431658){return function(_0x48d3d0){try{jsonpatch[_0xffeb('0x1f')](_0x48d3d0,_0x431658,!![]);}catch(_0x157184){return BPromise[_0xffeb('0x20')](_0x157184);}return _0x48d3d0[_0xffeb('0x21')]();};}function saveUpdates(_0x56a7d7,_0xafea6a){return function(_0x1bb826){if(_0x1bb826){return _0x1bb826[_0xffeb('0x22')](_0x56a7d7)[_0xffeb('0x23')](function(_0x201f6e){return _0x201f6e;});}return null;};}function removeEntity(_0x2d20ff,_0x2069bf){return function(_0x120895){if(_0x120895){return _0x120895[_0xffeb('0x24')]()[_0xffeb('0x23')](function(){_0x2d20ff[_0xffeb('0x16')](0xcc)[_0xffeb('0x17')]();});}};}function handleEntityNotFound(_0x50c337,_0x5710ba){return function(_0x52a413){if(!_0x52a413){_0x50c337['sendStatus'](0x194);}return _0x52a413;};}function handleError(_0x5d14ad,_0x14fcb9){_0x14fcb9=_0x14fcb9||0x1f4;return function(_0x3b414f){logger[_0xffeb('0x25')](_0x3b414f[_0xffeb('0x26')]);if(_0x3b414f[_0xffeb('0x27')]){delete _0x3b414f[_0xffeb('0x27')];}_0x5d14ad['status'](_0x14fcb9)[_0xffeb('0x28')](_0x3b414f);};}exports[_0xffeb('0x22')]=function(_0x332bd7,_0x50fa87){if(_0x332bd7[_0xffeb('0x29')]['id']){delete _0x332bd7[_0xffeb('0x29')]['id'];}return db[_0xffeb('0x2a')][_0xffeb('0x2b')]({'where':{'id':_0x332bd7[_0xffeb('0x2c')]['id']}})[_0xffeb('0x23')](handleEntityNotFound(_0x50fa87,null))[_0xffeb('0x23')](saveUpdates(_0x332bd7[_0xffeb('0x29')],null))[_0xffeb('0x23')](respondWithResult(_0x50fa87,null))[_0xffeb('0x2d')](handleError(_0x50fa87,null));};exports[_0xffeb('0x24')]=function(_0xbe3f2a,_0x349cb2){return db[_0xffeb('0x2a')][_0xffeb('0x2b')]({'where':{'id':_0xbe3f2a['params']['id']}})[_0xffeb('0x23')](handleEntityNotFound(_0x349cb2,null))['then'](removeEntity(_0x349cb2,null))[_0xffeb('0x2d')](handleError(_0x349cb2,null));}; \ No newline at end of file +var _0x2bd8=['stack','name','body','Action','params','find','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','update','then','destroy','sendStatus'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0x2bd8,0x10e));var _0x82bd=function(_0x180612,_0x5b03cc){_0x180612=_0x180612-0x0;var _0xac1b9e=_0x2bd8[_0x180612];return _0xac1b9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x82bd('0x1'));var BPromise=require(_0x82bd('0x2'));var Mustache=require('mustache');var util=require(_0x82bd('0x3'));var path=require(_0x82bd('0x4'));var sox=require(_0x82bd('0x5'));var csv=require(_0x82bd('0x6'));var ejs=require(_0x82bd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x82bd('0x8'));var crypto=require(_0x82bd('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x82bd('0xa'));var toCsv=require('to-csv');var querystring=require(_0x82bd('0xb'));var Papa=require(_0x82bd('0xc'));var Redis=require(_0x82bd('0xd'));var authService=require(_0x82bd('0xe'));var qs=require(_0x82bd('0xf'));var as=require(_0x82bd('0x10'));var hardwareService=require(_0x82bd('0x11'));var logger=require(_0x82bd('0x12'))(_0x82bd('0x13'));var utils=require(_0x82bd('0x14'));var config=require(_0x82bd('0x15'));var licenseUtil=require(_0x82bd('0x16'));var db=require(_0x82bd('0x17'))['db'];function respondWithStatusCode(_0x263c8e,_0x522cee){_0x522cee=_0x522cee||0xcc;return function(_0x2e026a){if(_0x2e026a){return _0x263c8e['sendStatus'](_0x522cee);}return _0x263c8e[_0x82bd('0x18')](_0x522cee)[_0x82bd('0x19')]();};}function respondWithResult(_0x3fd54b,_0x362e30){_0x362e30=_0x362e30||0xc8;return function(_0x7798ad){if(_0x7798ad){return _0x3fd54b[_0x82bd('0x18')](_0x362e30)['json'](_0x7798ad);}};}function respondWithFilteredResult(_0x5d3295,_0x4ea744){return function(_0x1a7dcc){if(_0x1a7dcc){var _0x58e04a=typeof _0x4ea744[_0x82bd('0x1a')]===_0x82bd('0x1b')&&typeof _0x4ea744['limit']===_0x82bd('0x1b');var _0x19b11f=_0x1a7dcc[_0x82bd('0x1c')];var _0x4e1316=_0x58e04a?0x0:_0x4ea744[_0x82bd('0x1a')];var _0x356a60=_0x58e04a?_0x1a7dcc['count']:_0x4ea744[_0x82bd('0x1a')]+_0x4ea744[_0x82bd('0x1d')];var _0x824ec7;if(_0x356a60>=_0x19b11f){_0x356a60=_0x19b11f;_0x824ec7=0xc8;}else{_0x824ec7=0xce;}_0x5d3295[_0x82bd('0x18')](_0x824ec7);return _0x5d3295['set'](_0x82bd('0x1e'),_0x4e1316+'-'+_0x356a60+'/'+_0x19b11f)[_0x82bd('0x1f')](_0x1a7dcc);}return null;};}function patchUpdates(_0x5013ce){return function(_0x3bafdb){try{jsonpatch[_0x82bd('0x20')](_0x3bafdb,_0x5013ce,!![]);}catch(_0x165609){return BPromise[_0x82bd('0x21')](_0x165609);}return _0x3bafdb['save']();};}function saveUpdates(_0x233cd4,_0x3cece2){return function(_0x41f4d6){if(_0x41f4d6){return _0x41f4d6[_0x82bd('0x22')](_0x233cd4)[_0x82bd('0x23')](function(_0x34c127){return _0x34c127;});}return null;};}function removeEntity(_0x1e5b3b,_0x3a4f52){return function(_0x306270){if(_0x306270){return _0x306270[_0x82bd('0x24')]()[_0x82bd('0x23')](function(){_0x1e5b3b[_0x82bd('0x18')](0xcc)[_0x82bd('0x19')]();});}};}function handleEntityNotFound(_0x51f4b7,_0x3375a4){return function(_0x5d8b6f){if(!_0x5d8b6f){_0x51f4b7[_0x82bd('0x25')](0x194);}return _0x5d8b6f;};}function handleError(_0x141a4c,_0x42e88c){_0x42e88c=_0x42e88c||0x1f4;return function(_0x720799){logger['error'](_0x720799[_0x82bd('0x26')]);if(_0x720799[_0x82bd('0x27')]){delete _0x720799[_0x82bd('0x27')];}_0x141a4c[_0x82bd('0x18')](_0x42e88c)['send'](_0x720799);};}exports[_0x82bd('0x22')]=function(_0x444ba3,_0x33d9ef){if(_0x444ba3[_0x82bd('0x28')]['id']){delete _0x444ba3[_0x82bd('0x28')]['id'];}return db[_0x82bd('0x29')]['find']({'where':{'id':_0x444ba3[_0x82bd('0x2a')]['id']}})[_0x82bd('0x23')](handleEntityNotFound(_0x33d9ef,null))[_0x82bd('0x23')](saveUpdates(_0x444ba3[_0x82bd('0x28')],null))[_0x82bd('0x23')](respondWithResult(_0x33d9ef,null))['catch'](handleError(_0x33d9ef,null));};exports[_0x82bd('0x24')]=function(_0x39b3ea,_0x3663e7){return db[_0x82bd('0x29')][_0x82bd('0x2b')]({'where':{'id':_0x39b3ea[_0x82bd('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3663e7,null))[_0x82bd('0x23')](removeEntity(_0x3663e7,null))['catch'](handleError(_0x3663e7,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index c4b5918..613bc1c 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 _0x98e5=['../../config/logger','api','moment','bluebird','path','rimraf','exports','define','Action','lodash','util'];(function(_0xd73fe8,_0x3fa157){var _0xe696b1=function(_0x604ac8){while(--_0x604ac8){_0xd73fe8['push'](_0xd73fe8['shift']());}};_0xe696b1(++_0x3fa157);}(_0x98e5,0x1c1));var _0x598e=function(_0x345690,_0x460b5d){_0x345690=_0x345690-0x0;var _0x24e907=_0x98e5[_0x345690];return _0x24e907;};'use strict';var _=require(_0x598e('0x0'));var util=require(_0x598e('0x1'));var logger=require(_0x598e('0x2'))(_0x598e('0x3'));var moment=require(_0x598e('0x4'));var BPromise=require(_0x598e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x598e('0x6'));var rimraf=require(_0x598e('0x7'));var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0x598e('0x8')]=function(_0x2b174e,_0x196fed){return _0x2b174e[_0x598e('0x9')](_0x598e('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff96=['path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0xff96,0x1f2));var _0x6ff9=function(_0x246890,_0x46b964){_0x246890=_0x246890-0x0;var _0x2b2a5a=_0xff96[_0x246890];return _0x2b2a5a;};'use strict';var _=require(_0x6ff9('0x0'));var util=require(_0x6ff9('0x1'));var logger=require(_0x6ff9('0x2'))(_0x6ff9('0x3'));var moment=require(_0x6ff9('0x4'));var BPromise=require('bluebird');var rp=require(_0x6ff9('0x5'));var fs=require('fs');var path=require(_0x6ff9('0x6'));var rimraf=require(_0x6ff9('0x7'));var config=require(_0x6ff9('0x8'));var attributes=require(_0x6ff9('0x9'));module[_0x6ff9('0xa')]=function(_0x55b4e0,_0x160a8b){return _0x55b4e0[_0x6ff9('0xb')](_0x6ff9('0xc'),attributes,{'tableName':_0x6ff9('0xd'),'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 437fd87..2f7a26e 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(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x53ec,0x192));var _0xc53e=function(_0x591df1,_0xd2030b){_0x591df1=_0x591df1-0x0;var _0x28f068=_0x53ec[_0x591df1];return _0x28f068;};'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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x48a7e6,_0x5589df){var _0x40618c=function(_0x295d47){while(--_0x295d47){_0x48a7e6['push'](_0x48a7e6['shift']());}};_0x40618c(++_0x5589df);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3db8a8,_0x3dccf5){_0x3db8a8=_0x3db8a8-0x0;var _0x29ae1c=_0x8ef6[_0x3db8a8];return _0x29ae1c;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Action,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Action,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 6b993eb..62260ee 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 _0x7655=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','put','isAuthenticated','update','/:id','destroy'];(function(_0x4075a4,_0x159d24){var _0x485ed0=function(_0x290de6){while(--_0x290de6){_0x4075a4['push'](_0x4075a4['shift']());}};_0x485ed0(++_0x159d24);}(_0x7655,0x1ad));var _0x5765=function(_0x3f8047,_0x49023c){_0x3f8047=_0x3f8047-0x0;var _0x13796b=_0x7655[_0x3f8047];return _0x13796b;};'use strict';var multer=require(_0x5765('0x0'));var util=require('util');var path=require(_0x5765('0x1'));var timeout=require(_0x5765('0x2'));var express=require(_0x5765('0x3'));var router=express[_0x5765('0x4')]();var fs_extra=require(_0x5765('0x5'));var auth=require(_0x5765('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5765('0x7'));var controller=require('./action.controller');router[_0x5765('0x8')]('/:id',auth[_0x5765('0x9')](),controller[_0x5765('0xa')]);router['delete'](_0x5765('0xb'),auth[_0x5765('0x9')](),controller[_0x5765('0xc')]);module['exports']=router; \ No newline at end of file +var _0x4fd1=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete'];(function(_0x31a521,_0xe51ad3){var _0x777677=function(_0x3b019d){while(--_0x3b019d){_0x31a521['push'](_0x31a521['shift']());}};_0x777677(++_0xe51ad3);}(_0x4fd1,0x1a5));var _0x14fd=function(_0xd06f44,_0x54ad92){_0xd06f44=_0xd06f44-0x0;var _0x458ec2=_0x4fd1[_0xd06f44];return _0x458ec2;};'use strict';var multer=require(_0x14fd('0x0'));var util=require(_0x14fd('0x1'));var path=require('path');var timeout=require(_0x14fd('0x2'));var express=require(_0x14fd('0x3'));var router=express[_0x14fd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x14fd('0x5'));var interaction=require(_0x14fd('0x6'));var config=require(_0x14fd('0x7'));var controller=require('./action.controller');router[_0x14fd('0x8')](_0x14fd('0x9'),auth[_0x14fd('0xa')](),controller[_0x14fd('0xb')]);router[_0x14fd('0xc')]('/:id',auth[_0x14fd('0xa')](),controller['destroy']);module[_0x14fd('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 189e9fd..e197f47 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 _0x8ef6=['STRING','TEXT','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x15279f,_0x184358){_0x15279f=_0x15279f-0x0;var _0x3af840=_0x8ef6[_0x15279f];return _0x3af840;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x68ef('0x2')]},'parent':{'type':Sequelize[_0x68ef('0x2')]},'table':{'type':Sequelize[_0x68ef('0x2')]},'conditions':{'type':Sequelize[_0x68ef('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x33c5=['STRING','TEXT','exports'];(function(_0x5c78ac,_0x1bb54c){var _0x430d00=function(_0xb17afd){while(--_0xb17afd){_0x5c78ac['push'](_0x5c78ac['shift']());}};_0x430d00(++_0x1bb54c);}(_0x33c5,0xe6));var _0x533c=function(_0x2dbce7,_0x57cb8d){_0x2dbce7=_0x2dbce7-0x0;var _0x3a3ed0=_0x33c5[_0x2dbce7];return _0x3a3ed0;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'name':{'type':Sequelize[_0x533c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x533c('0x1')]},'table':{'type':Sequelize[_0x533c('0x1')]},'conditions':{'type':Sequelize[_0x533c('0x2')]},'joins':{'type':Sequelize[_0x533c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 69302b7..4635806 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 _0x0fe2=['keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','AnalyticMetric','keyBy','select','from','table','MetricId','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','DATE(%s)','IS\x20NULL','IS\x20EMPTY','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','metric','output','web','fullPath','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','run','runReport','ROUND(%s)','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x3d773f,_0x3462b3){var _0x22bf3a=function(_0x2d295e){while(--_0x2d295e){_0x3d773f['push'](_0x3d773f['shift']());}};_0x22bf3a(++_0x3462b3);}(_0x0fe2,0x1cd));var _0x20fe=function(_0x66e905,_0x510d76){_0x66e905=_0x66e905-0x0;var _0x427cde=_0x0fe2[_0x66e905];return _0x427cde;};'use strict';var emlformat=require(_0x20fe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x20fe('0x1'));var jsonpatch=require(_0x20fe('0x2'));var rp=require(_0x20fe('0x3'));var moment=require(_0x20fe('0x4'));var BPromise=require(_0x20fe('0x5'));var Mustache=require('mustache');var util=require(_0x20fe('0x6'));var path=require('path');var sox=require(_0x20fe('0x7'));var csv=require(_0x20fe('0x8'));var ejs=require(_0x20fe('0x9'));var fs=require('fs');var fs_extra=require(_0x20fe('0xa'));var _=require(_0x20fe('0xb'));var squel=require(_0x20fe('0xc'));var crypto=require(_0x20fe('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x20fe('0xe'));var toCsv=require(_0x20fe('0x8'));var querystring=require(_0x20fe('0xf'));var Papa=require(_0x20fe('0x10'));var Redis=require(_0x20fe('0x11'));var authService=require(_0x20fe('0x12'));var qs=require(_0x20fe('0x13'));var as=require(_0x20fe('0x14'));var hardwareService=require(_0x20fe('0x15'));var logger=require(_0x20fe('0x16'))(_0x20fe('0x17'));var utils=require(_0x20fe('0x18'));var config=require(_0x20fe('0x19'));var licenseUtil=require(_0x20fe('0x1a'));var db=require(_0x20fe('0x1b'))['db'];var dbH=require(_0x20fe('0x1b'))[_0x20fe('0x1c')];function respondWithStatusCode(_0x4fa76e,_0x4d39db){_0x4d39db=_0x4d39db||0xcc;return function(_0x43fe69){if(_0x43fe69){return _0x4fa76e[_0x20fe('0x1d')](_0x4d39db);}return _0x4fa76e[_0x20fe('0x1e')](_0x4d39db)['end']();};}function respondWithResult(_0x8321e5,_0xb61f48){_0xb61f48=_0xb61f48||0xc8;return function(_0x42439e){if(_0x42439e){return _0x8321e5['status'](_0xb61f48)[_0x20fe('0x1f')](_0x42439e);}};}function respondWithFilteredResult(_0x595ecf,_0x4c365b){return function(_0x33aa00){if(_0x33aa00){var _0x233af4=typeof _0x4c365b['offset']==='undefined'&&typeof _0x4c365b[_0x20fe('0x20')]===_0x20fe('0x21');var _0x4be167=_0x33aa00[_0x20fe('0x22')];var _0x37a1cf=_0x233af4?0x0:_0x4c365b[_0x20fe('0x23')];var _0x224976=_0x233af4?_0x33aa00[_0x20fe('0x22')]:_0x4c365b['offset']+_0x4c365b[_0x20fe('0x20')];var _0x3f8a60;if(_0x224976>=_0x4be167){_0x224976=_0x4be167;_0x3f8a60=0xc8;}else{_0x3f8a60=0xce;}_0x595ecf[_0x20fe('0x1e')](_0x3f8a60);return _0x595ecf[_0x20fe('0x24')](_0x20fe('0x25'),_0x37a1cf+'-'+_0x224976+'/'+_0x4be167)[_0x20fe('0x1f')](_0x33aa00);}return null;};}function patchUpdates(_0x39dd85){return function(_0x26300e){try{jsonpatch[_0x20fe('0x26')](_0x26300e,_0x39dd85,!![]);}catch(_0x50641f){return BPromise[_0x20fe('0x27')](_0x50641f);}return _0x26300e[_0x20fe('0x28')]();};}function saveUpdates(_0x58554d,_0x25b709){return function(_0x224ec7){if(_0x224ec7){return _0x224ec7[_0x20fe('0x29')](_0x58554d)[_0x20fe('0x2a')](function(_0x45ceb6){return _0x45ceb6;});}return null;};}function removeEntity(_0x1f37cf,_0x2681a1){return function(_0x42bc38){if(_0x42bc38){return _0x42bc38[_0x20fe('0x2b')]()[_0x20fe('0x2a')](function(){var _0x946857=_0x42bc38[_0x20fe('0x2c')]({'plain':!![]});var _0xb22223='CustomReports';return db[_0x20fe('0x2d')][_0x20fe('0x2b')]({'where':{'type':_0xb22223,'resourceId':_0x946857['id']}})[_0x20fe('0x2a')](function(){return _0x42bc38;});})[_0x20fe('0x2a')](function(){_0x1f37cf[_0x20fe('0x1e')](0xcc)[_0x20fe('0x2e')]();});}};}function handleEntityNotFound(_0x37f55b,_0x239019){return function(_0x5ec608){if(!_0x5ec608){_0x37f55b[_0x20fe('0x1d')](0x194);}return _0x5ec608;};}function handleError(_0x3daa9a,_0x22c023){_0x22c023=_0x22c023||0x1f4;return function(_0x329afc){logger[_0x20fe('0x2f')](_0x329afc['stack']);if(_0x329afc['name']){delete _0x329afc[_0x20fe('0x30')];}_0x3daa9a['status'](_0x22c023)['send'](_0x329afc);};}exports[_0x20fe('0x31')]=function(_0x1da6d7,_0x53784e){var _0x27202b={},_0x495449={},_0x210f15={'count':0x0,'rows':[]};var _0x39bbf5=_[_0x20fe('0x32')](db[_0x20fe('0x33')][_0x20fe('0x34')],function(_0x2cb051){return{'name':_0x2cb051[_0x20fe('0x35')],'type':_0x2cb051[_0x20fe('0x36')][_0x20fe('0x37')]};});_0x495449[_0x20fe('0x38')]=_[_0x20fe('0x32')](_0x39bbf5,_0x20fe('0x30'));_0x495449[_0x20fe('0x39')]=_[_0x20fe('0x3a')](_0x1da6d7[_0x20fe('0x39')]);_0x495449[_0x20fe('0x3b')]=_[_0x20fe('0x3c')](_0x495449['model'],_0x495449[_0x20fe('0x39')]);_0x27202b['attributes']=_['intersection'](_0x495449[_0x20fe('0x38')],qs[_0x20fe('0x3d')](_0x1da6d7[_0x20fe('0x39')][_0x20fe('0x3d')]));_0x27202b[_0x20fe('0x3e')]=_0x27202b[_0x20fe('0x3e')][_0x20fe('0x3f')]?_0x27202b[_0x20fe('0x3e')]:_0x495449[_0x20fe('0x38')];if(!_0x1da6d7[_0x20fe('0x39')]['hasOwnProperty']('nolimit')){_0x27202b[_0x20fe('0x20')]=qs[_0x20fe('0x20')](_0x1da6d7[_0x20fe('0x39')][_0x20fe('0x20')]);_0x27202b[_0x20fe('0x23')]=qs[_0x20fe('0x23')](_0x1da6d7[_0x20fe('0x39')][_0x20fe('0x23')]);}_0x27202b[_0x20fe('0x40')]=qs[_0x20fe('0x41')](_0x1da6d7['query'][_0x20fe('0x41')]);_0x27202b[_0x20fe('0x42')]=qs[_0x20fe('0x3b')](_[_0x20fe('0x43')](_0x1da6d7[_0x20fe('0x39')],_0x495449['filters']),_0x39bbf5);if(_0x1da6d7[_0x20fe('0x39')][_0x20fe('0x44')]){_0x27202b[_0x20fe('0x42')]=_['merge'](_0x27202b[_0x20fe('0x42')],{'$or':_[_0x20fe('0x32')](_0x39bbf5,function(_0x175988){if(_0x175988[_0x20fe('0x36')]!==_0x20fe('0x45')){var _0x548353={};_0x548353[_0x175988['name']]={'$like':'%'+_0x1da6d7[_0x20fe('0x39')][_0x20fe('0x44')]+'%'};return _0x548353;}})});}_0x27202b=_[_0x20fe('0x46')]({},_0x27202b,_0x1da6d7[_0x20fe('0x47')]);var _0x1a40fb={'where':_0x27202b[_0x20fe('0x42')]};return db[_0x20fe('0x33')]['count'](_0x1a40fb)[_0x20fe('0x2a')](function(_0x45db91){_0x210f15[_0x20fe('0x22')]=_0x45db91;if(_0x1da6d7[_0x20fe('0x39')][_0x20fe('0x48')]){_0x27202b['include']=[{'all':!![]}];}return db[_0x20fe('0x33')][_0x20fe('0x49')](_0x27202b);})[_0x20fe('0x2a')](function(_0x99eb7e){_0x210f15[_0x20fe('0x4a')]=_0x99eb7e;return _0x210f15;})[_0x20fe('0x2a')](respondWithFilteredResult(_0x53784e,_0x27202b))[_0x20fe('0x4b')](handleError(_0x53784e,null));};exports[_0x20fe('0x4c')]=function(_0x2e2e66,_0x4b9bf9){var _0x514b85={'raw':![],'where':{'id':_0x2e2e66['params']['id']}},_0x155e2c={};_0x155e2c[_0x20fe('0x38')]=_[_0x20fe('0x3a')](db[_0x20fe('0x33')][_0x20fe('0x34')]);_0x155e2c['query']=_[_0x20fe('0x3a')](_0x2e2e66[_0x20fe('0x39')]);_0x155e2c['filters']=_[_0x20fe('0x3c')](_0x155e2c[_0x20fe('0x38')],_0x155e2c[_0x20fe('0x39')]);_0x514b85[_0x20fe('0x3e')]=_[_0x20fe('0x3c')](_0x155e2c[_0x20fe('0x38')],qs[_0x20fe('0x3d')](_0x2e2e66['query'][_0x20fe('0x3d')]));_0x514b85[_0x20fe('0x3e')]=_0x514b85[_0x20fe('0x3e')][_0x20fe('0x3f')]?_0x514b85[_0x20fe('0x3e')]:_0x155e2c[_0x20fe('0x38')];if(_0x2e2e66[_0x20fe('0x39')][_0x20fe('0x48')]){_0x514b85[_0x20fe('0x4d')]=[{'all':!![]}];}_0x514b85=_['merge']({},_0x514b85,_0x2e2e66['options']);return db[_0x20fe('0x33')]['find'](_0x514b85)[_0x20fe('0x2a')](handleEntityNotFound(_0x4b9bf9,null))[_0x20fe('0x2a')](respondWithResult(_0x4b9bf9,null))[_0x20fe('0x4b')](handleError(_0x4b9bf9,null));};exports[_0x20fe('0x4e')]=function(_0x5b6722,_0x409669){return db[_0x20fe('0x33')]['create'](_0x5b6722[_0x20fe('0x4f')],{})['then'](function(_0xde803c){var _0x56ffed=_0x5b6722['user'][_0x20fe('0x2c')]({'plain':!![]});if(!_0x56ffed)throw new Error(_0x20fe('0x50'));if(_0x56ffed['role']===_0x20fe('0x51')){var _0x79ad3d=_0xde803c[_0x20fe('0x2c')]({'plain':!![]});var _0x572027='Reports';return db[_0x20fe('0x52')][_0x20fe('0x53')]({'where':{'name':_0x572027,'userProfileId':_0x56ffed[_0x20fe('0x54')]},'raw':!![]})[_0x20fe('0x2a')](function(_0x1dd33b){if(_0x1dd33b&&_0x1dd33b[_0x20fe('0x55')]===0x0){return db[_0x20fe('0x2d')]['create']({'name':_0x79ad3d[_0x20fe('0x30')],'resourceId':_0x79ad3d['id'],'type':'CustomReports','sectionId':_0x1dd33b['id']},{})['then'](function(){return _0xde803c;});}else{return _0xde803c;}})['catch'](function(_0x259396){logger[_0x20fe('0x2f')](_0x20fe('0x56'),_0x259396);throw _0x259396;});}return _0xde803c;})[_0x20fe('0x2a')](respondWithResult(_0x409669,0xc9))[_0x20fe('0x4b')](handleError(_0x409669,null));};exports[_0x20fe('0x29')]=function(_0x5173b4,_0x2bdb9b){if(_0x5173b4[_0x20fe('0x4f')]['id']){delete _0x5173b4['body']['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x5173b4['params']['id']}})[_0x20fe('0x2a')](handleEntityNotFound(_0x2bdb9b,null))[_0x20fe('0x2a')](saveUpdates(_0x5173b4[_0x20fe('0x4f')],null))[_0x20fe('0x2a')](respondWithResult(_0x2bdb9b,null))[_0x20fe('0x4b')](handleError(_0x2bdb9b,null));};exports[_0x20fe('0x2b')]=function(_0x57b526,_0x3ab744){return db[_0x20fe('0x33')][_0x20fe('0x53')]({'where':{'id':_0x57b526[_0x20fe('0x57')]['id']}})[_0x20fe('0x2a')](handleEntityNotFound(_0x3ab744,null))['then'](removeEntity(_0x3ab744,null))[_0x20fe('0x4b')](handleError(_0x3ab744,null));};exports[_0x20fe('0x58')]=function(_0x1fb486,_0x1851b4){var _0x2ac4d5=0xa;var _0x1ab451=[_0x20fe('0x59'),_0x20fe('0x5a'),_0x20fe('0x5b'),_0x20fe('0x5c')];var _0x2b56aa={'SUM':'SUM(%s)','COUNT':_0x20fe('0x5d'),'COUNT DISTINCT':_0x20fe('0x5e'),'MAX':_0x20fe('0x5f'),'MIN':_0x20fe('0x60'),'AVG':_0x20fe('0x61'),'GROUP_CONCAT':_0x20fe('0x62'),'GROUP_CONCAT ASC':_0x20fe('0x63'),'GROUP_CONCAT DESC':_0x20fe('0x64')};var _0x1ddb80={'SEC_TO_TIME':_0x20fe('0x65'),'DATE':'DATE(%s)','HOUR':_0x20fe('0x66'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x20fe('0x67')};var _0x4298c8=function(_0x14db5b){return!_[_0x20fe('0x68')](['IS\x20NULL',_0x20fe('0x69'),'IS\x20EMPTY',_0x20fe('0x6a')],_0x14db5b);};var _0x420f54=function(_0x50e316){if(!_0x50e316||!_0x50e316['rules'][_0x20fe('0x3f')]){return'';}for(var _0x23e12c='(',_0x480193=0x0;_0x480193<_0x50e316[_0x20fe('0x6b')][_0x20fe('0x3f')];_0x480193+=0x1){_0x480193>0x0&&(_0x23e12c+='\x20'+_0x50e316[_0x20fe('0x6c')]+'\x20');_0x23e12c+=_0x50e316[_0x20fe('0x6b')][_0x480193][_0x20fe('0x6d')]?_0x420f54(_0x50e316[_0x20fe('0x6b')][_0x480193][_0x20fe('0x6d')]):_0x50e316[_0x20fe('0x6b')][_0x480193][_0x20fe('0x6e')]+'\x20'+_0x50e316[_0x20fe('0x6b')][_0x480193][_0x20fe('0x6f')]+(_0x4298c8(_0x50e316['rules'][_0x480193]['condition'])?'\x20'+_0x50e316[_0x20fe('0x6b')][_0x480193]['value']:'');}return _0x23e12c+')';};var _0x3d7dcb={'where':{'id':_0x1fb486[_0x20fe('0x57')]['id']}},_0xe129b0,_0x49ae5a,_0x5c6740,_0x5363a7,_0x50efe3;_0x3d7dcb=_['merge']({},_0x3d7dcb,_0x1fb486[_0x20fe('0x47')]);return db[_0x20fe('0x33')][_0x20fe('0x53')](_0x3d7dcb)['then'](function(_0x1cd4e6){if(_0x1cd4e6){_0xe129b0=_0x1cd4e6;return _0x1cd4e6[_0x20fe('0x70')]();}return null;})[_0x20fe('0x2a')](function(_0x3e8c12){if(_0x3e8c12){if(!_0x3e8c12[_0x20fe('0x3f')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x49ae5a=_0x3e8c12;return db[_0x20fe('0x71')][_0x20fe('0x49')]({'raw':!![]});}return null;})[_0x20fe('0x2a')](function(_0x2b61a5){if(_0x2b61a5){_0x5c6740=_[_0x20fe('0x72')](_0x2b61a5,'id');var _0xf0914;var _0x1b98a8=squel[_0x20fe('0x73')]();_0x1b98a8[_0x20fe('0x74')](_0xe129b0[_0x20fe('0x75')]);for(var _0x3280bb=0x0;_0x3280bb<_0x49ae5a[_0x20fe('0x3f')];_0x3280bb+=0x1){_0xf0914=_0x49ae5a[_0x3280bb]['MetricId']?_0x5c6740[_0x49ae5a[_0x3280bb][_0x20fe('0x76')]]['metric']:_0x49ae5a[_0x3280bb]['field'];_0xf0914=_0x49ae5a[_0x3280bb]['function']?_[_0x20fe('0x77')](_0x2b56aa[_0x49ae5a[_0x3280bb][_0x20fe('0x78')]],'%s',_0xf0914):_0xf0914;_0xf0914=_0x49ae5a[_0x3280bb]['format']?_[_0x20fe('0x77')](_0x1ddb80[_0x49ae5a[_0x3280bb][_0x20fe('0x79')]],'%s',_0xf0914):_0xf0914;if(_0x49ae5a[_0x3280bb][_0x20fe('0x7a')]){_0x1b98a8[_0x20fe('0x6d')](_0xf0914);}_0x49ae5a[_0x3280bb][_0x20fe('0x7b')]&&_0x1b98a8['order'](_0xf0914,_0x49ae5a[_0x3280bb]['orderBy']===_0x20fe('0x7c')?![]:!![]);_0x1b98a8[_0x20fe('0x6e')](_0xf0914,_0x49ae5a[_0x3280bb][_0x20fe('0x7d')]||_0xf0914);}if(_0xe129b0[_0x20fe('0x7e')]){_0xe129b0['joins']=JSON[_0x20fe('0x7f')](_0xe129b0['joins']);for(var _0x2bccef=0x0;_0x2bccef<_0xe129b0['joins'][_0x20fe('0x3f')];_0x2bccef+=0x1){if(_0xe129b0[_0x20fe('0x7e')][_0x2bccef]['type']&&_['includes'](_0x1ab451,_0xe129b0[_0x20fe('0x7e')][_0x2bccef][_0x20fe('0x36')])&&_0xe129b0[_0x20fe('0x7e')][_0x2bccef][_0x20fe('0x80')]&&_0xe129b0[_0x20fe('0x7e')][_0x2bccef][_0x20fe('0x81')]&&_0xe129b0[_0x20fe('0x7e')][_0x2bccef]['foreignKey']){_0x1b98a8[_0xe129b0[_0x20fe('0x7e')][_0x2bccef]['type']](_0xe129b0[_0x20fe('0x7e')][_0x2bccef][_0x20fe('0x81')],null,util[_0x20fe('0x79')](_0x20fe('0x82'),_0xe129b0['table'],_0xe129b0[_0x20fe('0x7e')][_0x2bccef]['parentKey'],_0xe129b0[_0x20fe('0x7e')][_0x2bccef][_0x20fe('0x81')],_0xe129b0[_0x20fe('0x7e')][_0x2bccef][_0x20fe('0x83')]));}}}if(_0xe129b0[_0x20fe('0x84')]){_0xe129b0[_0x20fe('0x84')]=JSON[_0x20fe('0x7f')](_0xe129b0[_0x20fe('0x84')]);_0x1b98a8[_0x20fe('0x42')](_0x420f54(_0xe129b0[_0x20fe('0x84')]['group']));}_0x50efe3=_0x1b98a8[_0x20fe('0x85')]();_0x1b98a8[_0x20fe('0x20')](_0x2ac4d5);_0x1b98a8['offset'](0x0);logger[_0x20fe('0x86')](_0x20fe('0x87'),_0x1b98a8[_0x20fe('0x88')]());return dbH['sequelize'][_0x20fe('0x39')](_0x1b98a8['toString'](),{'type':dbH[_0x20fe('0x89')][_0x20fe('0x8a')][_0x20fe('0x8b')]});}})[_0x20fe('0x2a')](respondWithResult(_0x1851b4,null))['catch'](handleError(_0x1851b4,null));};function runReport(_0x33d7b5,_0x45b39d,_0x2faed9){var _0x387f36=_0x45b39d[_0x20fe('0x30')];var _0x10c050=0xa;var _0x4637d2=['join',_0x20fe('0x5a'),_0x20fe('0x5b'),_0x20fe('0x5c')];var _0x5969ce={'SUM':_0x20fe('0x8c'),'COUNT':_0x20fe('0x5d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x20fe('0x5f'),'MIN':'MIN(%s)','AVG':_0x20fe('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x20fe('0x63'),'GROUP_CONCAT DESC':_0x20fe('0x64')};var _0x21cdb7={'SEC_TO_TIME':_0x20fe('0x65'),'DATE':_0x20fe('0x8d'),'HOUR':_0x20fe('0x66'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x20fe('0x67')};var _0x5f3260=function(_0x99d173){return!_[_0x20fe('0x68')]([_0x20fe('0x8e'),'IS\x20NOT\x20NULL',_0x20fe('0x8f'),_0x20fe('0x6a')],_0x99d173);};var _0x476769=function(_0x13dab9){if(!_0x13dab9||!_0x13dab9['rules'][_0x20fe('0x3f')]){return'';}for(var _0x3d131f='(',_0x56d746=0x0;_0x56d746<_0x13dab9[_0x20fe('0x6b')]['length'];_0x56d746+=0x1){_0x56d746>0x0&&(_0x3d131f+='\x20'+_0x13dab9[_0x20fe('0x6c')]+'\x20');_0x3d131f+=_0x13dab9[_0x20fe('0x6b')][_0x56d746][_0x20fe('0x6d')]?_0x476769(_0x13dab9[_0x20fe('0x6b')][_0x56d746][_0x20fe('0x6d')]):_0x13dab9[_0x20fe('0x6b')][_0x56d746][_0x20fe('0x6e')]+'\x20'+_0x13dab9[_0x20fe('0x6b')][_0x56d746][_0x20fe('0x6f')]+(_0x5f3260(_0x13dab9[_0x20fe('0x6b')][_0x56d746][_0x20fe('0x6f')])?'\x20'+_0x13dab9[_0x20fe('0x6b')][_0x56d746][_0x20fe('0x90')]:'');}return _0x3d131f+')';};var _0x229790={'where':{'id':_0x33d7b5['id']}},_0x231d32,_0x22c95e,_0x15f988,_0x4074b9,_0x407987;_0x229790=_[_0x20fe('0x46')]({},_0x229790,_0x2faed9);return db['AnalyticCustomReport'][_0x20fe('0x53')](_0x229790)[_0x20fe('0x2a')](function(_0x121c4d){if(_0x121c4d){_0x231d32=_0x121c4d;return _0x121c4d['getFields']();}return null;})[_0x20fe('0x2a')](function(_0x31747b){if(_0x31747b){if(!_0x31747b[_0x20fe('0x3f')]){throw new db[(_0x20fe('0x91'))][(_0x20fe('0x92'))](_0x20fe('0x93'),0x193);}_0x22c95e=_0x31747b;return db[_0x20fe('0x71')][_0x20fe('0x49')]({'raw':!![]});}return null;})[_0x20fe('0x2a')](function(_0x55e4e5){if(_0x55e4e5){_0x15f988=_[_0x20fe('0x72')](_0x55e4e5,'id');var _0x2d33e2;var _0xbc8659=squel[_0x20fe('0x73')]();_0xbc8659[_0x20fe('0x74')](_0x231d32['table']);for(var _0x27553d=0x0;_0x27553d<_0x22c95e[_0x20fe('0x3f')];_0x27553d+=0x1){_0x2d33e2=_0x22c95e[_0x27553d][_0x20fe('0x76')]?_0x15f988[_0x22c95e[_0x27553d]['MetricId']][_0x20fe('0x94')]:_0x22c95e[_0x27553d][_0x20fe('0x6e')];_0x2d33e2=_0x22c95e[_0x27553d]['function']?_['replace'](_0x5969ce[_0x22c95e[_0x27553d][_0x20fe('0x78')]],'%s',_0x2d33e2):_0x2d33e2;_0x2d33e2=_0x22c95e[_0x27553d]['format']?_[_0x20fe('0x77')](_0x21cdb7[_0x22c95e[_0x27553d][_0x20fe('0x79')]],'%s',_0x2d33e2):_0x2d33e2;if(_0x22c95e[_0x27553d]['groupBy']){_0xbc8659['group'](_0x2d33e2);}_0x22c95e[_0x27553d][_0x20fe('0x7b')]&&_0xbc8659[_0x20fe('0x40')](_0x2d33e2,_0x22c95e[_0x27553d]['orderBy']===_0x20fe('0x7c')?![]:!![]);_0xbc8659[_0x20fe('0x6e')](_0x2d33e2,_0x22c95e[_0x27553d][_0x20fe('0x7d')]||_0x2d33e2);}if(_0x231d32[_0x20fe('0x7e')]){_0x231d32[_0x20fe('0x7e')]=JSON['parse'](_0x231d32[_0x20fe('0x7e')]);for(var _0x4479fb=0x0;_0x4479fb<_0x231d32['joins'][_0x20fe('0x3f')];_0x4479fb+=0x1){if(_0x231d32[_0x20fe('0x7e')][_0x4479fb][_0x20fe('0x36')]&&_['includes'](_0x4637d2,_0x231d32[_0x20fe('0x7e')][_0x4479fb][_0x20fe('0x36')])&&_0x231d32[_0x20fe('0x7e')][_0x4479fb][_0x20fe('0x80')]&&_0x231d32[_0x20fe('0x7e')][_0x4479fb][_0x20fe('0x81')]&&_0x231d32[_0x20fe('0x7e')][_0x4479fb]['foreignKey']){_0xbc8659[_0x231d32[_0x20fe('0x7e')][_0x4479fb][_0x20fe('0x36')]](_0x231d32[_0x20fe('0x7e')][_0x4479fb]['foreignTable'],null,util[_0x20fe('0x79')]('%s.%s\x20=\x20%s.%s',_0x231d32['table'],_0x231d32[_0x20fe('0x7e')][_0x4479fb][_0x20fe('0x80')],_0x231d32[_0x20fe('0x7e')][_0x4479fb][_0x20fe('0x81')],_0x231d32[_0x20fe('0x7e')][_0x4479fb][_0x20fe('0x83')]));}}}if(_0x231d32[_0x20fe('0x84')]){_0x231d32[_0x20fe('0x84')]=JSON[_0x20fe('0x7f')](_0x231d32[_0x20fe('0x84')]);_0xbc8659[_0x20fe('0x42')](_0x476769(_0x231d32[_0x20fe('0x84')][_0x20fe('0x6d')]));}_0x407987=_0xbc8659[_0x20fe('0x85')]();_0xbc8659[_0x20fe('0x20')](_0x10c050);_0xbc8659[_0x20fe('0x23')](0x0);return;}})[_0x20fe('0x2a')](function(){if(_0x45b39d[_0x20fe('0x95')]===_0x20fe('0x96')){return null;}var _0x255e4e=_[_0x20fe('0x46')](_0x45b39d,{'name':_0x45b39d[_0x20fe('0x97')]||_0x45b39d['name']||_0x231d32[_0x20fe('0x30')],'basename':_0x387f36,'savename':util[_0x20fe('0x79')](_0x20fe('0x98'),_0x45b39d[_0x20fe('0x30')]||_0x231d32[_0x20fe('0x30')],require(_0x20fe('0x99'))['generate'](0x4),_0x45b39d[_0x20fe('0x95')]||_0x20fe('0x9a')),'reportId':_0x231d32['id'],'reportType':_0x20fe('0x9b')});return db[_0x20fe('0x9c')][_0x20fe('0x4e')](_0x255e4e,{'raw':!![]});})[_0x20fe('0x2a')](function(_0x4e2f35){if(_0x231d32['table']===_0x20fe('0x9d')){_0x407987[_0x20fe('0x42')](_0x231d32[_0x20fe('0x75')]+_0x20fe('0x9e'),_0x45b39d[_0x20fe('0x9f')],_0x45b39d[_0x20fe('0xa0')]);}else{_0x407987[_0x20fe('0x42')](_0x231d32['table']+_0x20fe('0xa1'),_0x45b39d['startDate'],_0x45b39d[_0x20fe('0xa0')]);}if(_0x4e2f35){logger[_0x20fe('0xa2')](_0x20fe('0xa3'),_0x407987[_0x20fe('0x88')]());require(_0x20fe('0xa4'))[_0x20fe('0xa5')](path[_0x20fe('0x59')](__dirname,'../../components/export/',_0x4e2f35[_0x20fe('0x95')]),[_0x4e2f35['id'],_0x407987[_0x20fe('0x88')](),path[_0x20fe('0x59')](__dirname,_0x20fe('0xa6'),_0x4e2f35[_0x20fe('0xa7')]),_0x387f36]);return _0x4e2f35;}else{var _0x553287=squel[_0x20fe('0x73')]();_0x553287[_0x20fe('0x74')]('('+_0x407987[_0x20fe('0x88')]()+')',_0x20fe('0xa8'));_0x553287['field'](_0x20fe('0xa9'),'count');_0x407987[_0x20fe('0x20')](_0x45b39d[_0x20fe('0x20')]||_0x10c050);_0x407987['offset'](_0x45b39d[_0x20fe('0x23')]||0x0);return dbH[_0x20fe('0x89')][_0x20fe('0x39')](_0x553287[_0x20fe('0x88')](),{'type':dbH[_0x20fe('0x89')][_0x20fe('0x8a')]['SELECT']})[_0x20fe('0x2a')](function(_0x312f80){if(!_0x312f80[_0x20fe('0x3f')]){_0x4074b9=0x0;}else{_0x4074b9=_0x312f80[0x0]['count']||0x0;}return dbH[_0x20fe('0x89')][_0x20fe('0x39')](_0x407987[_0x20fe('0x88')](),{'type':dbH['sequelize'][_0x20fe('0x8a')]['SELECT']});})['then'](function(_0x477d6f){return{'rows':_0x477d6f||[],'count':_0x4074b9};});}});}exports[_0x20fe('0xaa')]=function(_0x49af98,_0x4aefb4){return runReport(_0x49af98[_0x20fe('0x57')],_0x49af98[_0x20fe('0x39')],_0x49af98[_0x20fe('0x47')])[_0x20fe('0x2a')](respondWithResult(_0x4aefb4,null))[_0x20fe('0x4b')](handleError(_0x4aefb4,null));};exports[_0x20fe('0xab')]=runReport;exports[_0x20fe('0x39')]=function(_0x494569,_0x35707b){var _0x524647=0xa;var _0x1e3ca8=[_0x20fe('0x59'),'left_join',_0x20fe('0x5b'),_0x20fe('0x5c')];var _0x20a391={'SUM':_0x20fe('0x8c'),'COUNT':_0x20fe('0x5d'),'COUNT DISTINCT':_0x20fe('0x5e'),'MAX':_0x20fe('0x5f'),'MIN':_0x20fe('0x60'),'AVG':_0x20fe('0x61'),'GROUP_CONCAT':_0x20fe('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x20fe('0x64')};var _0x4474b3={'SEC_TO_TIME':_0x20fe('0x65'),'DATE':_0x20fe('0x8d'),'HOUR':'HOUR(%s)','ROUND':_0x20fe('0xac'),'UNIX_TIMESTAMP':_0x20fe('0x67')};var _0x5388b6=function(_0x4d0ef4){return!_[_0x20fe('0x68')]([_0x20fe('0x8e'),_0x20fe('0x69'),_0x20fe('0x8f'),_0x20fe('0x6a')],_0x4d0ef4);};var _0x4664ce=function(_0x3c6d98){if(!_0x3c6d98||!_0x3c6d98[_0x20fe('0x6b')]['length']){return'';}for(var _0x7957a8='(',_0x5ff89c=0x0;_0x5ff89c<_0x3c6d98[_0x20fe('0x6b')][_0x20fe('0x3f')];_0x5ff89c+=0x1){_0x5ff89c>0x0&&(_0x7957a8+='\x20'+_0x3c6d98[_0x20fe('0x6c')]+'\x20');_0x7957a8+=_0x3c6d98['rules'][_0x5ff89c][_0x20fe('0x6d')]?_0x4664ce(_0x3c6d98[_0x20fe('0x6b')][_0x5ff89c]['group']):_0x3c6d98[_0x20fe('0x6b')][_0x5ff89c][_0x20fe('0x6e')]+'\x20'+_0x3c6d98[_0x20fe('0x6b')][_0x5ff89c][_0x20fe('0x6f')]+(_0x5388b6(_0x3c6d98[_0x20fe('0x6b')][_0x5ff89c]['condition'])?'\x20'+_0x3c6d98[_0x20fe('0x6b')][_0x5ff89c][_0x20fe('0x90')]:'');}return _0x7957a8+')';};var _0x3aa420={'where':{'id':_0x494569[_0x20fe('0x57')]['id']}},_0x1ee437,_0x144153,_0x5767c2,_0x5ddd34,_0x4e2b9b;_0x3aa420=_[_0x20fe('0x46')]({},_0x3aa420,_0x494569[_0x20fe('0x47')]);return db[_0x20fe('0x33')][_0x20fe('0x53')](_0x3aa420)[_0x20fe('0x2a')](function(_0x33910a){if(_0x33910a){_0x1ee437=_0x33910a;return _0x33910a[_0x20fe('0x70')]();}return null;})['then'](function(_0xe366fb){if(_0xe366fb){if(!_0xe366fb[_0x20fe('0x3f')]){throw new db[(_0x20fe('0x91'))][(_0x20fe('0x92'))](_0x20fe('0x93'),0x193);}_0x144153=_0xe366fb;return db[_0x20fe('0x71')][_0x20fe('0x49')]({'raw':!![]});}return null;})[_0x20fe('0x2a')](function(_0x4df5c1){if(_0x4df5c1){_0x5767c2=_[_0x20fe('0x72')](_0x4df5c1,'id');var _0x425b53;var _0x127261=squel[_0x20fe('0x73')]();_0x127261[_0x20fe('0x74')](_0x1ee437[_0x20fe('0x75')]);for(var _0x160e3f=0x0;_0x160e3f<_0x144153[_0x20fe('0x3f')];_0x160e3f+=0x1){_0x425b53=_0x144153[_0x160e3f][_0x20fe('0x76')]?_0x5767c2[_0x144153[_0x160e3f]['MetricId']][_0x20fe('0x94')]:_0x144153[_0x160e3f][_0x20fe('0x6e')];_0x425b53=_0x144153[_0x160e3f][_0x20fe('0x78')]?_[_0x20fe('0x77')](_0x20a391[_0x144153[_0x160e3f]['function']],'%s',_0x425b53):_0x425b53;_0x425b53=_0x144153[_0x160e3f][_0x20fe('0x79')]?_[_0x20fe('0x77')](_0x4474b3[_0x144153[_0x160e3f][_0x20fe('0x79')]],'%s',_0x425b53):_0x425b53;if(_0x144153[_0x160e3f][_0x20fe('0x7a')]){_0x127261[_0x20fe('0x6d')](_0x425b53);}_0x144153[_0x160e3f][_0x20fe('0x7b')]&&_0x127261[_0x20fe('0x40')](_0x425b53,_0x144153[_0x160e3f][_0x20fe('0x7b')]==='DESC'?![]:!![]);_0x127261['field'](_0x425b53,_0x144153[_0x160e3f][_0x20fe('0x7d')]||_0x425b53);}if(_0x1ee437[_0x20fe('0x7e')]){_0x1ee437[_0x20fe('0x7e')]=JSON[_0x20fe('0x7f')](_0x1ee437[_0x20fe('0x7e')]);for(var _0x4f92c6=0x0;_0x4f92c6<_0x1ee437['joins'][_0x20fe('0x3f')];_0x4f92c6+=0x1){if(_0x1ee437[_0x20fe('0x7e')][_0x4f92c6][_0x20fe('0x36')]&&_[_0x20fe('0x68')](_0x1e3ca8,_0x1ee437[_0x20fe('0x7e')][_0x4f92c6][_0x20fe('0x36')])&&_0x1ee437[_0x20fe('0x7e')][_0x4f92c6][_0x20fe('0x80')]&&_0x1ee437[_0x20fe('0x7e')][_0x4f92c6][_0x20fe('0x81')]&&_0x1ee437[_0x20fe('0x7e')][_0x4f92c6][_0x20fe('0x83')]){_0x127261[_0x1ee437[_0x20fe('0x7e')][_0x4f92c6][_0x20fe('0x36')]](_0x1ee437['joins'][_0x4f92c6][_0x20fe('0x81')],null,util[_0x20fe('0x79')]('%s.%s\x20=\x20%s.%s',_0x1ee437[_0x20fe('0x75')],_0x1ee437[_0x20fe('0x7e')][_0x4f92c6][_0x20fe('0x80')],_0x1ee437['joins'][_0x4f92c6][_0x20fe('0x81')],_0x1ee437[_0x20fe('0x7e')][_0x4f92c6][_0x20fe('0x83')]));}}}if(_0x1ee437[_0x20fe('0x84')]){_0x1ee437[_0x20fe('0x84')]=JSON['parse'](_0x1ee437[_0x20fe('0x84')]);_0x127261[_0x20fe('0x42')](_0x4664ce(_0x1ee437['conditions'][_0x20fe('0x6d')]));}_0x4e2b9b=_0x127261[_0x20fe('0x85')]();_0x127261[_0x20fe('0x20')](_0x524647);_0x127261[_0x20fe('0x23')](0x0);logger['debug'](_0x20fe('0x87'),_0x127261[_0x20fe('0x88')]());return dbH[_0x20fe('0x89')]['query'](_0x127261[_0x20fe('0x88')](),{'type':dbH[_0x20fe('0x89')][_0x20fe('0x8a')][_0x20fe('0x8b')]});}})[_0x20fe('0x2a')](function(){return{'sql':_0x4e2b9b['toString']()};})[_0x20fe('0x2a')](respondWithResult(_0x35707b,null))[_0x20fe('0x4b')](handleError(_0x35707b,null));}; \ No newline at end of file +var _0xbe78=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','undefined','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','get','CustomReports','UserProfileResource','error','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','preview','join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','table','MetricId','metric','replace','function','format','groupBy','orderBy','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','toString','sequelize','QueryTypes','left_join','cross_join','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','DESC','alias','output','web','fullPath','%s-%s.%s','randomstring','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../files/reports','from','countTable','COUNT(*)','SELECT','run','runReport','Limited\x20Query:','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xbe78,0x1e4));var _0x8be7=function(_0x298a8f,_0x395153){_0x298a8f=_0x298a8f-0x0;var _0x32a253=_0xbe78[_0x298a8f];return _0x32a253;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8be7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8be7('0x1'));var rp=require(_0x8be7('0x2'));var moment=require(_0x8be7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8be7('0x4'));var util=require('util');var path=require(_0x8be7('0x5'));var sox=require(_0x8be7('0x6'));var csv=require(_0x8be7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8be7('0x8'));var squel=require(_0x8be7('0x9'));var crypto=require('crypto');var jsforce=require(_0x8be7('0xa'));var deskjs=require(_0x8be7('0xb'));var toCsv=require(_0x8be7('0x7'));var querystring=require(_0x8be7('0xc'));var Papa=require(_0x8be7('0xd'));var Redis=require(_0x8be7('0xe'));var authService=require(_0x8be7('0xf'));var qs=require(_0x8be7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8be7('0x11'));var logger=require('../../config/logger')(_0x8be7('0x12'));var utils=require(_0x8be7('0x13'));var config=require(_0x8be7('0x14'));var licenseUtil=require(_0x8be7('0x15'));var db=require('../../mysqldb')['db'];var dbH=require(_0x8be7('0x16'))[_0x8be7('0x17')];function respondWithStatusCode(_0x303344,_0x587406){_0x587406=_0x587406||0xcc;return function(_0x1b8bb6){if(_0x1b8bb6){return _0x303344[_0x8be7('0x18')](_0x587406);}return _0x303344['status'](_0x587406)[_0x8be7('0x19')]();};}function respondWithResult(_0x1c50e1,_0x4d0b15){_0x4d0b15=_0x4d0b15||0xc8;return function(_0x33c895){if(_0x33c895){return _0x1c50e1[_0x8be7('0x1a')](_0x4d0b15)['json'](_0x33c895);}};}function respondWithFilteredResult(_0x2a4ff4,_0x17f2f0){return function(_0x19da1f){if(_0x19da1f){var _0xfbaca8=typeof _0x17f2f0['offset']==='undefined'&&typeof _0x17f2f0['limit']===_0x8be7('0x1b');var _0x20703d=_0x19da1f[_0x8be7('0x1c')];var _0x2708cf=_0xfbaca8?0x0:_0x17f2f0[_0x8be7('0x1d')];var _0x3e5000=_0xfbaca8?_0x19da1f['count']:_0x17f2f0['offset']+_0x17f2f0['limit'];var _0x16b0ab;if(_0x3e5000>=_0x20703d){_0x3e5000=_0x20703d;_0x16b0ab=0xc8;}else{_0x16b0ab=0xce;}_0x2a4ff4[_0x8be7('0x1a')](_0x16b0ab);return _0x2a4ff4['set'](_0x8be7('0x1e'),_0x2708cf+'-'+_0x3e5000+'/'+_0x20703d)[_0x8be7('0x1f')](_0x19da1f);}return null;};}function patchUpdates(_0x2c60e0){return function(_0x429c03){try{jsonpatch[_0x8be7('0x20')](_0x429c03,_0x2c60e0,!![]);}catch(_0x1af249){return BPromise[_0x8be7('0x21')](_0x1af249);}return _0x429c03[_0x8be7('0x22')]();};}function saveUpdates(_0x55050a,_0x24ac54){return function(_0x325817){if(_0x325817){return _0x325817[_0x8be7('0x23')](_0x55050a)['then'](function(_0x360a12){return _0x360a12;});}return null;};}function removeEntity(_0x86f368,_0x3bdec5){return function(_0x71141f){if(_0x71141f){return _0x71141f[_0x8be7('0x24')]()[_0x8be7('0x25')](function(){var _0x2f1242=_0x71141f[_0x8be7('0x26')]({'plain':!![]});var _0x4d7173=_0x8be7('0x27');return db[_0x8be7('0x28')][_0x8be7('0x24')]({'where':{'type':_0x4d7173,'resourceId':_0x2f1242['id']}})[_0x8be7('0x25')](function(){return _0x71141f;});})[_0x8be7('0x25')](function(){_0x86f368['status'](0xcc)[_0x8be7('0x19')]();});}};}function handleEntityNotFound(_0x447caa,_0x59ddd){return function(_0xe053ea){if(!_0xe053ea){_0x447caa[_0x8be7('0x18')](0x194);}return _0xe053ea;};}function handleError(_0x11646e,_0x4a1b97){_0x4a1b97=_0x4a1b97||0x1f4;return function(_0x4e2055){logger[_0x8be7('0x29')](_0x4e2055['stack']);if(_0x4e2055[_0x8be7('0x2a')]){delete _0x4e2055['name'];}_0x11646e[_0x8be7('0x1a')](_0x4a1b97)[_0x8be7('0x2b')](_0x4e2055);};}exports[_0x8be7('0x2c')]=function(_0x2ef415,_0x3f97e2){var _0x5bd155={},_0x3431c8={},_0x52ef90={'count':0x0,'rows':[]};var _0x2ded9a=_[_0x8be7('0x2d')](db[_0x8be7('0x2e')][_0x8be7('0x2f')],function(_0x2ca86e){return{'name':_0x2ca86e['fieldName'],'type':_0x2ca86e[_0x8be7('0x30')][_0x8be7('0x31')]};});_0x3431c8['model']=_[_0x8be7('0x2d')](_0x2ded9a,_0x8be7('0x2a'));_0x3431c8['query']=_[_0x8be7('0x32')](_0x2ef415[_0x8be7('0x33')]);_0x3431c8[_0x8be7('0x34')]=_[_0x8be7('0x35')](_0x3431c8['model'],_0x3431c8[_0x8be7('0x33')]);_0x5bd155[_0x8be7('0x36')]=_[_0x8be7('0x35')](_0x3431c8[_0x8be7('0x37')],qs[_0x8be7('0x38')](_0x2ef415['query'][_0x8be7('0x38')]));_0x5bd155[_0x8be7('0x36')]=_0x5bd155[_0x8be7('0x36')][_0x8be7('0x39')]?_0x5bd155[_0x8be7('0x36')]:_0x3431c8['model'];if(!_0x2ef415[_0x8be7('0x33')][_0x8be7('0x3a')]('nolimit')){_0x5bd155[_0x8be7('0x3b')]=qs['limit'](_0x2ef415[_0x8be7('0x33')][_0x8be7('0x3b')]);_0x5bd155[_0x8be7('0x1d')]=qs[_0x8be7('0x1d')](_0x2ef415['query'][_0x8be7('0x1d')]);}_0x5bd155[_0x8be7('0x3c')]=qs[_0x8be7('0x3d')](_0x2ef415['query'][_0x8be7('0x3d')]);_0x5bd155[_0x8be7('0x3e')]=qs[_0x8be7('0x34')](_[_0x8be7('0x3f')](_0x2ef415[_0x8be7('0x33')],_0x3431c8[_0x8be7('0x34')]),_0x2ded9a);if(_0x2ef415[_0x8be7('0x33')]['filter']){_0x5bd155[_0x8be7('0x3e')]=_[_0x8be7('0x40')](_0x5bd155[_0x8be7('0x3e')],{'$or':_['map'](_0x2ded9a,function(_0x3e90ca){if(_0x3e90ca['type']!==_0x8be7('0x41')){var _0x4ed41f={};_0x4ed41f[_0x3e90ca[_0x8be7('0x2a')]]={'$like':'%'+_0x2ef415[_0x8be7('0x33')][_0x8be7('0x42')]+'%'};return _0x4ed41f;}})});}_0x5bd155=_['merge']({},_0x5bd155,_0x2ef415[_0x8be7('0x43')]);var _0x561b42={'where':_0x5bd155[_0x8be7('0x3e')]};return db[_0x8be7('0x2e')][_0x8be7('0x1c')](_0x561b42)[_0x8be7('0x25')](function(_0x11ab52){_0x52ef90[_0x8be7('0x1c')]=_0x11ab52;if(_0x2ef415[_0x8be7('0x33')][_0x8be7('0x44')]){_0x5bd155[_0x8be7('0x45')]=[{'all':!![]}];}return db[_0x8be7('0x2e')]['findAll'](_0x5bd155);})[_0x8be7('0x25')](function(_0x5bc561){_0x52ef90['rows']=_0x5bc561;return _0x52ef90;})[_0x8be7('0x25')](respondWithFilteredResult(_0x3f97e2,_0x5bd155))[_0x8be7('0x46')](handleError(_0x3f97e2,null));};exports[_0x8be7('0x47')]=function(_0x51da89,_0x48e4a7){var _0x54822f={'raw':![],'where':{'id':_0x51da89[_0x8be7('0x48')]['id']}},_0x3dba1b={};_0x3dba1b[_0x8be7('0x37')]=_[_0x8be7('0x32')](db['AnalyticCustomReport'][_0x8be7('0x2f')]);_0x3dba1b[_0x8be7('0x33')]=_['keys'](_0x51da89['query']);_0x3dba1b[_0x8be7('0x34')]=_[_0x8be7('0x35')](_0x3dba1b[_0x8be7('0x37')],_0x3dba1b[_0x8be7('0x33')]);_0x54822f[_0x8be7('0x36')]=_[_0x8be7('0x35')](_0x3dba1b['model'],qs[_0x8be7('0x38')](_0x51da89['query'][_0x8be7('0x38')]));_0x54822f[_0x8be7('0x36')]=_0x54822f[_0x8be7('0x36')][_0x8be7('0x39')]?_0x54822f[_0x8be7('0x36')]:_0x3dba1b[_0x8be7('0x37')];if(_0x51da89[_0x8be7('0x33')][_0x8be7('0x44')]){_0x54822f['include']=[{'all':!![]}];}_0x54822f=_['merge']({},_0x54822f,_0x51da89[_0x8be7('0x43')]);return db[_0x8be7('0x2e')]['find'](_0x54822f)[_0x8be7('0x25')](handleEntityNotFound(_0x48e4a7,null))[_0x8be7('0x25')](respondWithResult(_0x48e4a7,null))['catch'](handleError(_0x48e4a7,null));};exports[_0x8be7('0x49')]=function(_0x1db3aa,_0x186179){return db[_0x8be7('0x2e')]['create'](_0x1db3aa[_0x8be7('0x4a')],{})[_0x8be7('0x25')](function(_0x571dff){var _0x20b42d=_0x1db3aa[_0x8be7('0x4b')][_0x8be7('0x26')]({'plain':!![]});if(!_0x20b42d)throw new Error(_0x8be7('0x4c'));if(_0x20b42d[_0x8be7('0x4d')]==='user'){var _0x1bad1c=_0x571dff[_0x8be7('0x26')]({'plain':!![]});var _0x2ffac2=_0x8be7('0x4e');return db[_0x8be7('0x4f')]['find']({'where':{'name':_0x2ffac2,'userProfileId':_0x20b42d[_0x8be7('0x50')]},'raw':!![]})[_0x8be7('0x25')](function(_0x49572e){if(_0x49572e&&_0x49572e[_0x8be7('0x51')]===0x0){return db[_0x8be7('0x28')][_0x8be7('0x49')]({'name':_0x1bad1c[_0x8be7('0x2a')],'resourceId':_0x1bad1c['id'],'type':_0x8be7('0x27'),'sectionId':_0x49572e['id']},{})[_0x8be7('0x25')](function(){return _0x571dff;});}else{return _0x571dff;}})[_0x8be7('0x46')](function(_0x24b3e4){logger[_0x8be7('0x29')](_0x8be7('0x52'),_0x24b3e4);throw _0x24b3e4;});}return _0x571dff;})[_0x8be7('0x25')](respondWithResult(_0x186179,0xc9))[_0x8be7('0x46')](handleError(_0x186179,null));};exports['update']=function(_0x2db158,_0xf08ff3){if(_0x2db158[_0x8be7('0x4a')]['id']){delete _0x2db158[_0x8be7('0x4a')]['id'];}return db[_0x8be7('0x2e')][_0x8be7('0x53')]({'where':{'id':_0x2db158[_0x8be7('0x48')]['id']}})['then'](handleEntityNotFound(_0xf08ff3,null))[_0x8be7('0x25')](saveUpdates(_0x2db158[_0x8be7('0x4a')],null))['then'](respondWithResult(_0xf08ff3,null))[_0x8be7('0x46')](handleError(_0xf08ff3,null));};exports[_0x8be7('0x24')]=function(_0x24fda1,_0x3d6162){return db['AnalyticCustomReport'][_0x8be7('0x53')]({'where':{'id':_0x24fda1[_0x8be7('0x48')]['id']}})[_0x8be7('0x25')](handleEntityNotFound(_0x3d6162,null))[_0x8be7('0x25')](removeEntity(_0x3d6162,null))['catch'](handleError(_0x3d6162,null));};exports[_0x8be7('0x54')]=function(_0x4fe6c7,_0x6269cc){var _0x563c6d=0xa;var _0x359e05=[_0x8be7('0x55'),'left_join',_0x8be7('0x56'),'cross_join'];var _0x28ccb2={'SUM':_0x8be7('0x57'),'COUNT':_0x8be7('0x58'),'COUNT DISTINCT':_0x8be7('0x59'),'MAX':_0x8be7('0x5a'),'MIN':_0x8be7('0x5b'),'AVG':_0x8be7('0x5c'),'GROUP_CONCAT':_0x8be7('0x5d'),'GROUP_CONCAT ASC':_0x8be7('0x5e'),'GROUP_CONCAT DESC':_0x8be7('0x5f')};var _0x3c2c37={'SEC_TO_TIME':_0x8be7('0x60'),'DATE':'DATE(%s)','HOUR':_0x8be7('0x61'),'ROUND':_0x8be7('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2b3cbe=function(_0x351cba){return!_[_0x8be7('0x63')]([_0x8be7('0x64'),'IS\x20NOT\x20NULL',_0x8be7('0x65'),'IS\x20NOT\x20EMPTY'],_0x351cba);};var _0x5f349e=function(_0x5ec189){if(!_0x5ec189||!_0x5ec189[_0x8be7('0x66')][_0x8be7('0x39')]){return'';}for(var _0x4dec7a='(',_0x1bc13d=0x0;_0x1bc13d<_0x5ec189[_0x8be7('0x66')]['length'];_0x1bc13d+=0x1){_0x1bc13d>0x0&&(_0x4dec7a+='\x20'+_0x5ec189[_0x8be7('0x67')]+'\x20');_0x4dec7a+=_0x5ec189['rules'][_0x1bc13d][_0x8be7('0x68')]?_0x5f349e(_0x5ec189[_0x8be7('0x66')][_0x1bc13d][_0x8be7('0x68')]):_0x5ec189[_0x8be7('0x66')][_0x1bc13d][_0x8be7('0x69')]+'\x20'+_0x5ec189[_0x8be7('0x66')][_0x1bc13d]['condition']+(_0x2b3cbe(_0x5ec189[_0x8be7('0x66')][_0x1bc13d][_0x8be7('0x6a')])?'\x20'+_0x5ec189[_0x8be7('0x66')][_0x1bc13d][_0x8be7('0x6b')]:'');}return _0x4dec7a+')';};var _0x426437={'where':{'id':_0x4fe6c7[_0x8be7('0x48')]['id']}},_0x2d2080,_0x1bd0ea,_0x47e172,_0x8c532a,_0x4a6628;_0x426437=_[_0x8be7('0x40')]({},_0x426437,_0x4fe6c7['options']);return db[_0x8be7('0x2e')][_0x8be7('0x53')](_0x426437)[_0x8be7('0x25')](function(_0x1e7d73){if(_0x1e7d73){_0x2d2080=_0x1e7d73;return _0x1e7d73[_0x8be7('0x6c')]();}return null;})[_0x8be7('0x25')](function(_0x226a7d){if(_0x226a7d){if(!_0x226a7d[_0x8be7('0x39')]){throw new db[(_0x8be7('0x6d'))][(_0x8be7('0x6e'))](_0x8be7('0x6f'),0x193);}_0x1bd0ea=_0x226a7d;return db[_0x8be7('0x70')][_0x8be7('0x71')]({'raw':!![]});}return null;})['then'](function(_0x39f0e5){if(_0x39f0e5){_0x47e172=_[_0x8be7('0x72')](_0x39f0e5,'id');var _0x1cb70b;var _0x3cbc51=squel[_0x8be7('0x73')]();_0x3cbc51['from'](_0x2d2080[_0x8be7('0x74')]);for(var _0x2226a6=0x0;_0x2226a6<_0x1bd0ea[_0x8be7('0x39')];_0x2226a6+=0x1){_0x1cb70b=_0x1bd0ea[_0x2226a6][_0x8be7('0x75')]?_0x47e172[_0x1bd0ea[_0x2226a6][_0x8be7('0x75')]][_0x8be7('0x76')]:_0x1bd0ea[_0x2226a6][_0x8be7('0x69')];_0x1cb70b=_0x1bd0ea[_0x2226a6]['function']?_[_0x8be7('0x77')](_0x28ccb2[_0x1bd0ea[_0x2226a6][_0x8be7('0x78')]],'%s',_0x1cb70b):_0x1cb70b;_0x1cb70b=_0x1bd0ea[_0x2226a6][_0x8be7('0x79')]?_['replace'](_0x3c2c37[_0x1bd0ea[_0x2226a6][_0x8be7('0x79')]],'%s',_0x1cb70b):_0x1cb70b;if(_0x1bd0ea[_0x2226a6][_0x8be7('0x7a')]){_0x3cbc51[_0x8be7('0x68')](_0x1cb70b);}_0x1bd0ea[_0x2226a6][_0x8be7('0x7b')]&&_0x3cbc51[_0x8be7('0x3c')](_0x1cb70b,_0x1bd0ea[_0x2226a6][_0x8be7('0x7b')]==='DESC'?![]:!![]);_0x3cbc51[_0x8be7('0x69')](_0x1cb70b,_0x1bd0ea[_0x2226a6]['alias']||_0x1cb70b);}if(_0x2d2080[_0x8be7('0x7c')]){_0x2d2080[_0x8be7('0x7c')]=JSON['parse'](_0x2d2080[_0x8be7('0x7c')]);for(var _0xe2998=0x0;_0xe2998<_0x2d2080[_0x8be7('0x7c')][_0x8be7('0x39')];_0xe2998+=0x1){if(_0x2d2080[_0x8be7('0x7c')][_0xe2998][_0x8be7('0x30')]&&_['includes'](_0x359e05,_0x2d2080['joins'][_0xe2998][_0x8be7('0x30')])&&_0x2d2080['joins'][_0xe2998][_0x8be7('0x7d')]&&_0x2d2080[_0x8be7('0x7c')][_0xe2998][_0x8be7('0x7e')]&&_0x2d2080[_0x8be7('0x7c')][_0xe2998][_0x8be7('0x7f')]){_0x3cbc51[_0x2d2080[_0x8be7('0x7c')][_0xe2998][_0x8be7('0x30')]](_0x2d2080[_0x8be7('0x7c')][_0xe2998][_0x8be7('0x7e')],null,util['format'](_0x8be7('0x80'),_0x2d2080['table'],_0x2d2080[_0x8be7('0x7c')][_0xe2998][_0x8be7('0x7d')],_0x2d2080['joins'][_0xe2998][_0x8be7('0x7e')],_0x2d2080[_0x8be7('0x7c')][_0xe2998][_0x8be7('0x7f')]));}}}if(_0x2d2080['conditions']){_0x2d2080[_0x8be7('0x81')]=JSON[_0x8be7('0x82')](_0x2d2080['conditions']);_0x3cbc51[_0x8be7('0x3e')](_0x5f349e(_0x2d2080['conditions']['group']));}_0x4a6628=_0x3cbc51[_0x8be7('0x83')]();_0x3cbc51[_0x8be7('0x3b')](_0x563c6d);_0x3cbc51[_0x8be7('0x1d')](0x0);logger[_0x8be7('0x84')]('Limited\x20Query:',_0x3cbc51[_0x8be7('0x85')]());return dbH[_0x8be7('0x86')][_0x8be7('0x33')](_0x3cbc51[_0x8be7('0x85')](),{'type':dbH[_0x8be7('0x86')][_0x8be7('0x87')]['SELECT']});}})[_0x8be7('0x25')](respondWithResult(_0x6269cc,null))[_0x8be7('0x46')](handleError(_0x6269cc,null));};function runReport(_0x3eb910,_0x2c9a22,_0x5cca9c){var _0x1b850e=_0x2c9a22[_0x8be7('0x2a')];var _0x4369f3=0xa;var _0x504d78=['join',_0x8be7('0x88'),_0x8be7('0x56'),_0x8be7('0x89')];var _0x20cc23={'SUM':_0x8be7('0x57'),'COUNT':_0x8be7('0x58'),'COUNT DISTINCT':_0x8be7('0x59'),'MAX':_0x8be7('0x5a'),'MIN':_0x8be7('0x5b'),'AVG':_0x8be7('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x8be7('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x59b191={'SEC_TO_TIME':_0x8be7('0x60'),'DATE':_0x8be7('0x8a'),'HOUR':'HOUR(%s)','ROUND':_0x8be7('0x62'),'UNIX_TIMESTAMP':_0x8be7('0x8b')};var _0x160d18=function(_0x550ac0){return!_[_0x8be7('0x63')]([_0x8be7('0x64'),'IS\x20NOT\x20NULL',_0x8be7('0x65'),_0x8be7('0x8c')],_0x550ac0);};var _0x4ea475=function(_0x104067){if(!_0x104067||!_0x104067[_0x8be7('0x66')][_0x8be7('0x39')]){return'';}for(var _0xf0c0e5='(',_0xfc0265=0x0;_0xfc0265<_0x104067['rules'][_0x8be7('0x39')];_0xfc0265+=0x1){_0xfc0265>0x0&&(_0xf0c0e5+='\x20'+_0x104067[_0x8be7('0x67')]+'\x20');_0xf0c0e5+=_0x104067['rules'][_0xfc0265]['group']?_0x4ea475(_0x104067[_0x8be7('0x66')][_0xfc0265]['group']):_0x104067[_0x8be7('0x66')][_0xfc0265][_0x8be7('0x69')]+'\x20'+_0x104067['rules'][_0xfc0265]['condition']+(_0x160d18(_0x104067[_0x8be7('0x66')][_0xfc0265][_0x8be7('0x6a')])?'\x20'+_0x104067['rules'][_0xfc0265][_0x8be7('0x6b')]:'');}return _0xf0c0e5+')';};var _0x4aa5a8={'where':{'id':_0x3eb910['id']}},_0x594943,_0x66ad04,_0x588699,_0xa28c6b,_0x3eef19;_0x4aa5a8=_[_0x8be7('0x40')]({},_0x4aa5a8,_0x5cca9c);return db['AnalyticCustomReport'][_0x8be7('0x53')](_0x4aa5a8)[_0x8be7('0x25')](function(_0x1c3958){if(_0x1c3958){_0x594943=_0x1c3958;return _0x1c3958['getFields']();}return null;})[_0x8be7('0x25')](function(_0xd7fdc0){if(_0xd7fdc0){if(!_0xd7fdc0[_0x8be7('0x39')]){throw new db[(_0x8be7('0x6d'))][(_0x8be7('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x66ad04=_0xd7fdc0;return db[_0x8be7('0x70')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x53cfe3){if(_0x53cfe3){_0x588699=_[_0x8be7('0x72')](_0x53cfe3,'id');var _0xb6a54d;var _0xfb91e8=squel['select']();_0xfb91e8['from'](_0x594943['table']);for(var _0x28f4ca=0x0;_0x28f4ca<_0x66ad04['length'];_0x28f4ca+=0x1){_0xb6a54d=_0x66ad04[_0x28f4ca]['MetricId']?_0x588699[_0x66ad04[_0x28f4ca]['MetricId']][_0x8be7('0x76')]:_0x66ad04[_0x28f4ca][_0x8be7('0x69')];_0xb6a54d=_0x66ad04[_0x28f4ca][_0x8be7('0x78')]?_[_0x8be7('0x77')](_0x20cc23[_0x66ad04[_0x28f4ca][_0x8be7('0x78')]],'%s',_0xb6a54d):_0xb6a54d;_0xb6a54d=_0x66ad04[_0x28f4ca][_0x8be7('0x79')]?_[_0x8be7('0x77')](_0x59b191[_0x66ad04[_0x28f4ca][_0x8be7('0x79')]],'%s',_0xb6a54d):_0xb6a54d;if(_0x66ad04[_0x28f4ca][_0x8be7('0x7a')]){_0xfb91e8[_0x8be7('0x68')](_0xb6a54d);}_0x66ad04[_0x28f4ca][_0x8be7('0x7b')]&&_0xfb91e8[_0x8be7('0x3c')](_0xb6a54d,_0x66ad04[_0x28f4ca][_0x8be7('0x7b')]===_0x8be7('0x8d')?![]:!![]);_0xfb91e8[_0x8be7('0x69')](_0xb6a54d,_0x66ad04[_0x28f4ca][_0x8be7('0x8e')]||_0xb6a54d);}if(_0x594943[_0x8be7('0x7c')]){_0x594943[_0x8be7('0x7c')]=JSON[_0x8be7('0x82')](_0x594943[_0x8be7('0x7c')]);for(var _0x31927b=0x0;_0x31927b<_0x594943[_0x8be7('0x7c')][_0x8be7('0x39')];_0x31927b+=0x1){if(_0x594943[_0x8be7('0x7c')][_0x31927b][_0x8be7('0x30')]&&_[_0x8be7('0x63')](_0x504d78,_0x594943[_0x8be7('0x7c')][_0x31927b][_0x8be7('0x30')])&&_0x594943[_0x8be7('0x7c')][_0x31927b][_0x8be7('0x7d')]&&_0x594943[_0x8be7('0x7c')][_0x31927b][_0x8be7('0x7e')]&&_0x594943[_0x8be7('0x7c')][_0x31927b][_0x8be7('0x7f')]){_0xfb91e8[_0x594943[_0x8be7('0x7c')][_0x31927b][_0x8be7('0x30')]](_0x594943['joins'][_0x31927b][_0x8be7('0x7e')],null,util[_0x8be7('0x79')](_0x8be7('0x80'),_0x594943[_0x8be7('0x74')],_0x594943['joins'][_0x31927b]['parentKey'],_0x594943['joins'][_0x31927b][_0x8be7('0x7e')],_0x594943['joins'][_0x31927b][_0x8be7('0x7f')]));}}}if(_0x594943[_0x8be7('0x81')]){_0x594943[_0x8be7('0x81')]=JSON['parse'](_0x594943[_0x8be7('0x81')]);_0xfb91e8[_0x8be7('0x3e')](_0x4ea475(_0x594943[_0x8be7('0x81')][_0x8be7('0x68')]));}_0x3eef19=_0xfb91e8[_0x8be7('0x83')]();_0xfb91e8[_0x8be7('0x3b')](_0x4369f3);_0xfb91e8[_0x8be7('0x1d')](0x0);return;}})['then'](function(){if(_0x2c9a22[_0x8be7('0x8f')]===_0x8be7('0x90')){return null;}var _0x4e5c66=_[_0x8be7('0x40')](_0x2c9a22,{'name':_0x2c9a22[_0x8be7('0x91')]||_0x2c9a22[_0x8be7('0x2a')]||_0x594943[_0x8be7('0x2a')],'basename':_0x1b850e,'savename':util[_0x8be7('0x79')](_0x8be7('0x92'),_0x2c9a22['name']||_0x594943[_0x8be7('0x2a')],require(_0x8be7('0x93'))['generate'](0x4),_0x2c9a22['output']||_0x8be7('0x94')),'reportId':_0x594943['id'],'reportType':'custom'});return db[_0x8be7('0x95')]['create'](_0x4e5c66,{'raw':!![]});})[_0x8be7('0x25')](function(_0x51b628){if(_0x594943['table']==='cdr'){_0x3eef19['where'](_0x594943[_0x8be7('0x74')]+_0x8be7('0x96'),_0x2c9a22[_0x8be7('0x97')],_0x2c9a22['endDate']);}else{_0x3eef19[_0x8be7('0x3e')](_0x594943[_0x8be7('0x74')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2c9a22[_0x8be7('0x97')],_0x2c9a22[_0x8be7('0x98')]);}if(_0x51b628){logger[_0x8be7('0x99')](_0x8be7('0x9a'),_0x3eef19[_0x8be7('0x85')]());require(_0x8be7('0x9b'))['fork'](path['join'](__dirname,'../../components/export/',_0x51b628[_0x8be7('0x8f')]),[_0x51b628['id'],_0x3eef19[_0x8be7('0x85')](),path[_0x8be7('0x55')](__dirname,_0x8be7('0x9c'),_0x51b628['savename']),_0x1b850e]);return _0x51b628;}else{var _0xe1474c=squel[_0x8be7('0x73')]();_0xe1474c[_0x8be7('0x9d')]('('+_0x3eef19[_0x8be7('0x85')]()+')',_0x8be7('0x9e'));_0xe1474c[_0x8be7('0x69')](_0x8be7('0x9f'),_0x8be7('0x1c'));_0x3eef19[_0x8be7('0x3b')](_0x2c9a22[_0x8be7('0x3b')]||_0x4369f3);_0x3eef19['offset'](_0x2c9a22[_0x8be7('0x1d')]||0x0);return dbH[_0x8be7('0x86')][_0x8be7('0x33')](_0xe1474c[_0x8be7('0x85')](),{'type':dbH['sequelize'][_0x8be7('0x87')][_0x8be7('0xa0')]})[_0x8be7('0x25')](function(_0x3cea13){if(!_0x3cea13[_0x8be7('0x39')]){_0xa28c6b=0x0;}else{_0xa28c6b=_0x3cea13[0x0][_0x8be7('0x1c')]||0x0;}return dbH[_0x8be7('0x86')][_0x8be7('0x33')](_0x3eef19[_0x8be7('0x85')](),{'type':dbH[_0x8be7('0x86')][_0x8be7('0x87')][_0x8be7('0xa0')]});})[_0x8be7('0x25')](function(_0x354374){return{'rows':_0x354374||[],'count':_0xa28c6b};});}});}exports[_0x8be7('0xa1')]=function(_0x372c9c,_0xd31306){return runReport(_0x372c9c[_0x8be7('0x48')],_0x372c9c[_0x8be7('0x33')],_0x372c9c['options'])[_0x8be7('0x25')](respondWithResult(_0xd31306,null))['catch'](handleError(_0xd31306,null));};exports[_0x8be7('0xa2')]=runReport;exports[_0x8be7('0x33')]=function(_0x3d6eb0,_0x476dbe){var _0x4d5611=0xa;var _0x28d811=['join',_0x8be7('0x88'),_0x8be7('0x56'),'cross_join'];var _0x1a7f64={'SUM':'SUM(%s)','COUNT':_0x8be7('0x58'),'COUNT DISTINCT':_0x8be7('0x59'),'MAX':_0x8be7('0x5a'),'MIN':'MIN(%s)','AVG':_0x8be7('0x5c'),'GROUP_CONCAT':_0x8be7('0x5d'),'GROUP_CONCAT ASC':_0x8be7('0x5e'),'GROUP_CONCAT DESC':_0x8be7('0x5f')};var _0x4d9512={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x8be7('0x8a'),'HOUR':_0x8be7('0x61'),'ROUND':_0x8be7('0x62'),'UNIX_TIMESTAMP':_0x8be7('0x8b')};var _0x4408c2=function(_0x480b79){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0x8be7('0x65'),_0x8be7('0x8c')],_0x480b79);};var _0x5ad76e=function(_0x119f85){if(!_0x119f85||!_0x119f85[_0x8be7('0x66')][_0x8be7('0x39')]){return'';}for(var _0xc41fb3='(',_0x375c8a=0x0;_0x375c8a<_0x119f85[_0x8be7('0x66')][_0x8be7('0x39')];_0x375c8a+=0x1){_0x375c8a>0x0&&(_0xc41fb3+='\x20'+_0x119f85[_0x8be7('0x67')]+'\x20');_0xc41fb3+=_0x119f85[_0x8be7('0x66')][_0x375c8a][_0x8be7('0x68')]?_0x5ad76e(_0x119f85[_0x8be7('0x66')][_0x375c8a][_0x8be7('0x68')]):_0x119f85[_0x8be7('0x66')][_0x375c8a]['field']+'\x20'+_0x119f85[_0x8be7('0x66')][_0x375c8a][_0x8be7('0x6a')]+(_0x4408c2(_0x119f85['rules'][_0x375c8a][_0x8be7('0x6a')])?'\x20'+_0x119f85[_0x8be7('0x66')][_0x375c8a]['value']:'');}return _0xc41fb3+')';};var _0x1c6eaf={'where':{'id':_0x3d6eb0[_0x8be7('0x48')]['id']}},_0x4e3f51,_0x339126,_0x2c719c,_0x5780c1,_0x167237;_0x1c6eaf=_[_0x8be7('0x40')]({},_0x1c6eaf,_0x3d6eb0[_0x8be7('0x43')]);return db[_0x8be7('0x2e')][_0x8be7('0x53')](_0x1c6eaf)['then'](function(_0x44fb65){if(_0x44fb65){_0x4e3f51=_0x44fb65;return _0x44fb65['getFields']();}return null;})['then'](function(_0x13d80d){if(_0x13d80d){if(!_0x13d80d['length']){throw new db[(_0x8be7('0x6d'))][(_0x8be7('0x6e'))](_0x8be7('0x6f'),0x193);}_0x339126=_0x13d80d;return db[_0x8be7('0x70')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1e08d3){if(_0x1e08d3){_0x2c719c=_[_0x8be7('0x72')](_0x1e08d3,'id');var _0x35570e;var _0x314660=squel['select']();_0x314660[_0x8be7('0x9d')](_0x4e3f51[_0x8be7('0x74')]);for(var _0x7fa18b=0x0;_0x7fa18b<_0x339126[_0x8be7('0x39')];_0x7fa18b+=0x1){_0x35570e=_0x339126[_0x7fa18b][_0x8be7('0x75')]?_0x2c719c[_0x339126[_0x7fa18b][_0x8be7('0x75')]][_0x8be7('0x76')]:_0x339126[_0x7fa18b][_0x8be7('0x69')];_0x35570e=_0x339126[_0x7fa18b]['function']?_['replace'](_0x1a7f64[_0x339126[_0x7fa18b][_0x8be7('0x78')]],'%s',_0x35570e):_0x35570e;_0x35570e=_0x339126[_0x7fa18b][_0x8be7('0x79')]?_[_0x8be7('0x77')](_0x4d9512[_0x339126[_0x7fa18b][_0x8be7('0x79')]],'%s',_0x35570e):_0x35570e;if(_0x339126[_0x7fa18b][_0x8be7('0x7a')]){_0x314660[_0x8be7('0x68')](_0x35570e);}_0x339126[_0x7fa18b][_0x8be7('0x7b')]&&_0x314660[_0x8be7('0x3c')](_0x35570e,_0x339126[_0x7fa18b][_0x8be7('0x7b')]===_0x8be7('0x8d')?![]:!![]);_0x314660[_0x8be7('0x69')](_0x35570e,_0x339126[_0x7fa18b]['alias']||_0x35570e);}if(_0x4e3f51['joins']){_0x4e3f51['joins']=JSON[_0x8be7('0x82')](_0x4e3f51['joins']);for(var _0x4d11f9=0x0;_0x4d11f9<_0x4e3f51[_0x8be7('0x7c')][_0x8be7('0x39')];_0x4d11f9+=0x1){if(_0x4e3f51[_0x8be7('0x7c')][_0x4d11f9][_0x8be7('0x30')]&&_[_0x8be7('0x63')](_0x28d811,_0x4e3f51[_0x8be7('0x7c')][_0x4d11f9][_0x8be7('0x30')])&&_0x4e3f51[_0x8be7('0x7c')][_0x4d11f9][_0x8be7('0x7d')]&&_0x4e3f51[_0x8be7('0x7c')][_0x4d11f9][_0x8be7('0x7e')]&&_0x4e3f51[_0x8be7('0x7c')][_0x4d11f9]['foreignKey']){_0x314660[_0x4e3f51['joins'][_0x4d11f9][_0x8be7('0x30')]](_0x4e3f51['joins'][_0x4d11f9][_0x8be7('0x7e')],null,util['format'](_0x8be7('0x80'),_0x4e3f51['table'],_0x4e3f51[_0x8be7('0x7c')][_0x4d11f9][_0x8be7('0x7d')],_0x4e3f51[_0x8be7('0x7c')][_0x4d11f9][_0x8be7('0x7e')],_0x4e3f51[_0x8be7('0x7c')][_0x4d11f9]['foreignKey']));}}}if(_0x4e3f51[_0x8be7('0x81')]){_0x4e3f51[_0x8be7('0x81')]=JSON['parse'](_0x4e3f51[_0x8be7('0x81')]);_0x314660[_0x8be7('0x3e')](_0x5ad76e(_0x4e3f51['conditions'][_0x8be7('0x68')]));}_0x167237=_0x314660['clone']();_0x314660[_0x8be7('0x3b')](_0x4d5611);_0x314660[_0x8be7('0x1d')](0x0);logger[_0x8be7('0x84')](_0x8be7('0xa3'),_0x314660[_0x8be7('0x85')]());return dbH['sequelize'][_0x8be7('0x33')](_0x314660['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x8be7('0xa0')]});}})[_0x8be7('0x25')](function(){return{'sql':_0x167237[_0x8be7('0x85')]()};})[_0x8be7('0x25')](respondWithResult(_0x476dbe,null))[_0x8be7('0x46')](handleError(_0x476dbe,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 7973459..04bba0e 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 _0x107f=['rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x5b862e,_0x3bc15f){var _0x4d2295=function(_0x54c2ae){while(--_0x54c2ae){_0x5b862e['push'](_0x5b862e['shift']());}};_0x4d2295(++_0x3bc15f);}(_0x107f,0x12e));var _0xf107=function(_0x1ff788,_0x1f5446){_0x1ff788=_0x1ff788-0x0;var _0x1182b4=_0x107f[_0x1ff788];return _0x1182b4;};'use strict';var _=require(_0xf107('0x0'));var util=require(_0xf107('0x1'));var logger=require(_0xf107('0x2'))('api');var moment=require(_0xf107('0x3'));var BPromise=require('bluebird');var rp=require(_0xf107('0x4'));var fs=require('fs');var path=require(_0xf107('0x5'));var rimraf=require(_0xf107('0x6'));var config=require(_0xf107('0x7'));var attributes=require(_0xf107('0x8'));module['exports']=function(_0x3a2d98,_0x32db58){return _0x3a2d98[_0xf107('0x9')](_0xf107('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9416=['request-promise','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xc37473,_0x22b810){var _0x36137b=function(_0x1cc239){while(--_0x1cc239){_0xc37473['push'](_0xc37473['shift']());}};_0x36137b(++_0x22b810);}(_0x9416,0x1e8));var _0x6941=function(_0x1138f5,_0x48435e){_0x1138f5=_0x1138f5-0x0;var _0xbe8e44=_0x9416[_0x1138f5];return _0xbe8e44;};'use strict';var _=require(_0x6941('0x0'));var util=require(_0x6941('0x1'));var logger=require(_0x6941('0x2'))(_0x6941('0x3'));var moment=require(_0x6941('0x4'));var BPromise=require(_0x6941('0x5'));var rp=require(_0x6941('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6941('0x7'));var attributes=require(_0x6941('0x8'));module[_0x6941('0x9')]=function(_0x3fbf4f,_0x4e6210){return _0x3fbf4f[_0x6941('0xa')](_0x6941('0xb'),attributes,{'tableName':_0x6941('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 1836f9c..3800bd3 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 _0xdc67=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1971a2,_0x408867){var _0x7c986f=function(_0xf6d122){while(--_0xf6d122){_0x1971a2['push'](_0x1971a2['shift']());}};_0x7c986f(++_0x408867);}(_0xdc67,0xd1));var _0x7dc6=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0xdc67[_0x13ac10];return _0x28eda2;};'use strict';var _=require(_0x7dc6('0x0'));var util=require(_0x7dc6('0x1'));var moment=require(_0x7dc6('0x2'));var BPromise=require(_0x7dc6('0x3'));var rs=require(_0x7dc6('0x4'));var fs=require('fs');var Redis=require(_0x7dc6('0x5'));var db=require(_0x7dc6('0x6'))['db'];var utils=require(_0x7dc6('0x7'));var logger=require(_0x7dc6('0x8'))(_0x7dc6('0x9'));var config=require(_0x7dc6('0xa'));var jayson=require(_0x7dc6('0xb'));var client=jayson[_0x7dc6('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x304495,_0x2a0ac5,_0x356baf){return new BPromise(function(_0x109943,_0x5e731f){return client[_0x7dc6('0xd')](_0x304495,_0x356baf)[_0x7dc6('0xe')](function(_0x22262f){logger[_0x7dc6('0xf')](_0x7dc6('0x10'),_0x2a0ac5,_0x7dc6('0x11'));logger[_0x7dc6('0x12')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x2a0ac5,_0x7dc6('0x11'),JSON[_0x7dc6('0x13')](_0x22262f));if(_0x22262f[_0x7dc6('0x14')]){if(_0x22262f[_0x7dc6('0x14')][_0x7dc6('0x15')]===0x1f4){logger['error'](_0x7dc6('0x10'),_0x2a0ac5,_0x22262f['error'][_0x7dc6('0x16')]);return _0x5e731f(_0x22262f[_0x7dc6('0x14')][_0x7dc6('0x16')]);}logger[_0x7dc6('0x14')](_0x7dc6('0x10'),_0x2a0ac5,_0x22262f[_0x7dc6('0x14')][_0x7dc6('0x16')]);return _0x109943(_0x22262f[_0x7dc6('0x14')]['message']);}else{logger[_0x7dc6('0xf')](_0x7dc6('0x10'),_0x2a0ac5,'request\x20sent');_0x109943(_0x22262f['result'][_0x7dc6('0x16')]);}})['catch'](function(_0x2565c8){logger['error'](_0x7dc6('0x10'),_0x2a0ac5,_0x2565c8);_0x5e731f(_0x2565c8);});});} \ No newline at end of file +var _0x71a1=['jayson/promise','client','http','request','then','debug','request\x20sent','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment'];(function(_0x1699e9,_0x1f2652){var _0x14b104=function(_0x319079){while(--_0x319079){_0x1699e9['push'](_0x1699e9['shift']());}};_0x14b104(++_0x1f2652);}(_0x71a1,0x77));var _0x171a=function(_0x517c34,_0x3c9445){_0x517c34=_0x517c34-0x0;var _0x35bb0a=_0x71a1[_0x517c34];return _0x35bb0a;};'use strict';var _=require(_0x171a('0x0'));var util=require(_0x171a('0x1'));var moment=require(_0x171a('0x2'));var BPromise=require(_0x171a('0x3'));var rs=require(_0x171a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x171a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x171a('0x6'));var jayson=require(_0x171a('0x7'));var client=jayson[_0x171a('0x8')][_0x171a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x356441,_0x4ce0d2,_0x150361){return new BPromise(function(_0x3717a4,_0x3b1495){return client[_0x171a('0xa')](_0x356441,_0x150361)[_0x171a('0xb')](function(_0x2aaa9b){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x4ce0d2,'request\x20sent');logger[_0x171a('0xc')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4ce0d2,_0x171a('0xd'),JSON['stringify'](_0x2aaa9b));if(_0x2aaa9b[_0x171a('0xe')]){if(_0x2aaa9b[_0x171a('0xe')][_0x171a('0xf')]===0x1f4){logger[_0x171a('0xe')](_0x171a('0x10'),_0x4ce0d2,_0x2aaa9b[_0x171a('0xe')][_0x171a('0x11')]);return _0x3b1495(_0x2aaa9b[_0x171a('0xe')][_0x171a('0x11')]);}logger['error'](_0x171a('0x10'),_0x4ce0d2,_0x2aaa9b[_0x171a('0xe')][_0x171a('0x11')]);return _0x3717a4(_0x2aaa9b[_0x171a('0xe')]['message']);}else{logger[_0x171a('0x12')](_0x171a('0x10'),_0x4ce0d2,_0x171a('0xd'));_0x3717a4(_0x2aaa9b[_0x171a('0x13')]['message']);}})[_0x171a('0x14')](function(_0xc342a5){logger[_0x171a('0xe')](_0x171a('0x10'),_0x4ce0d2,_0xc342a5);_0x3b1495(_0xc342a5);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 0a6097b..860d789 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 _0x261c=['/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index'];(function(_0x3cfe4f,_0x462a7a){var _0x383174=function(_0x1a92e2){while(--_0x1a92e2){_0x3cfe4f['push'](_0x3cfe4f['shift']());}};_0x383174(++_0x462a7a);}(_0x261c,0x1ad));var _0xc261=function(_0x1a547e,_0x5917d3){_0x1a547e=_0x1a547e-0x0;var _0x5ebdaf=_0x261c[_0x1a547e];return _0x5ebdaf;};'use strict';var multer=require(_0xc261('0x0'));var util=require(_0xc261('0x1'));var path=require('path');var timeout=require(_0xc261('0x2'));var express=require(_0xc261('0x3'));var router=express[_0xc261('0x4')]();var fs_extra=require(_0xc261('0x5'));var auth=require(_0xc261('0x6'));var interaction=require(_0xc261('0x7'));var config=require(_0xc261('0x8'));var controller=require(_0xc261('0x9'));router[_0xc261('0xa')]('/',auth[_0xc261('0xb')](),controller[_0xc261('0xc')]);router[_0xc261('0xa')](_0xc261('0xd'),auth[_0xc261('0xb')](),controller[_0xc261('0xe')]);router[_0xc261('0xa')](_0xc261('0xf'),auth['isAuthenticated'](),controller[_0xc261('0x10')]);router[_0xc261('0xa')](_0xc261('0x11'),auth['isAuthenticated'](),controller[_0xc261('0x12')]);router[_0xc261('0xa')](_0xc261('0x13'),auth[_0xc261('0xb')](),controller[_0xc261('0x14')]);router['post']('/',auth[_0xc261('0xb')](),controller[_0xc261('0x15')]);router[_0xc261('0x16')](_0xc261('0xd'),auth['isAuthenticated'](),controller[_0xc261('0x17')]);router['delete'](_0xc261('0xd'),auth[_0xc261('0xb')](),controller[_0xc261('0x18')]);module[_0xc261('0x19')]=router; \ No newline at end of file +var _0x5a3d=['./analyticCustomReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','query','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x5a3d,0x156));var _0xd5a3=function(_0x2c3a8f,_0x374e56){_0x2c3a8f=_0x2c3a8f-0x0;var _0x189412=_0x5a3d[_0x2c3a8f];return _0x189412;};'use strict';var multer=require(_0xd5a3('0x0'));var util=require(_0xd5a3('0x1'));var path=require(_0xd5a3('0x2'));var timeout=require(_0xd5a3('0x3'));var express=require('express');var router=express[_0xd5a3('0x4')]();var fs_extra=require(_0xd5a3('0x5'));var auth=require(_0xd5a3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd5a3('0x7'));var controller=require(_0xd5a3('0x8'));router[_0xd5a3('0x9')]('/',auth['isAuthenticated'](),controller[_0xd5a3('0xa')]);router[_0xd5a3('0x9')](_0xd5a3('0xb'),auth[_0xd5a3('0xc')](),controller[_0xd5a3('0xd')]);router[_0xd5a3('0x9')](_0xd5a3('0xe'),auth['isAuthenticated'](),controller[_0xd5a3('0xf')]);router['get'](_0xd5a3('0x10'),auth[_0xd5a3('0xc')](),controller[_0xd5a3('0x11')]);router[_0xd5a3('0x9')]('/:id/query',auth[_0xd5a3('0xc')](),controller[_0xd5a3('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd5a3('0x13')]);router[_0xd5a3('0x14')](_0xd5a3('0xb'),auth[_0xd5a3('0xc')](),controller[_0xd5a3('0x15')]);router[_0xd5a3('0x16')](_0xd5a3('0xb'),auth[_0xd5a3('0xc')](),controller[_0xd5a3('0x17')]);module[_0xd5a3('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 7721d30..d8f5e27 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 _0x4819=['TEXT','exports','STRING'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0x4819,0xcd));var _0x9481=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0x4819[_0x2ef8f1];return _0x17498d;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9481('0x1')]},'parent':{'type':Sequelize[_0x9481('0x1')]},'table':{'type':Sequelize[_0x9481('0x1')]},'conditions':{'type':Sequelize[_0x9481('0x2')]},'joins':{'type':Sequelize[_0x9481('0x2')]}}; \ No newline at end of file +var _0x98a8=['sequelize','exports','STRING','TEXT'];(function(_0x511692,_0xb0aefe){var _0x36b5e4=function(_0x332063){while(--_0x332063){_0x511692['push'](_0x511692['shift']());}};_0x36b5e4(++_0xb0aefe);}(_0x98a8,0x12c));var _0x898a=function(_0x21bdfc,_0x4cdc14){_0x21bdfc=_0x21bdfc-0x0;var _0x55e977=_0x98a8[_0x21bdfc];return _0x55e977;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'name':{'type':Sequelize[_0x898a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x898a('0x2')]},'parent':{'type':Sequelize[_0x898a('0x2')]},'table':{'type':Sequelize[_0x898a('0x2')]},'conditions':{'type':Sequelize[_0x898a('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 7a33ecb..6610250 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 _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(_0x246119,_0x30a4f3){var _0x59c74f=function(_0x313fb5){while(--_0x313fb5){_0x246119['push'](_0x246119['shift']());}};_0x59c74f(++_0x30a4f3);}(_0x7a54,0x106));var _0x47a5=function(_0x4fd387,_0x1fdba9){_0x4fd387=_0x4fd387-0x0;var _0x1e10f9=_0x7a54[_0x4fd387];return _0x1e10f9;};'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 +var _0x46ed=['SEC_TO_TIME(%s)','value','AnalyticMetric','select','DESC','output','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','left_join','COUNT(%s)','MIN(%s)','AVG(%s)','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','QueryTypes','SELECT'];(function(_0x1631b3,_0x4afc82){var _0x1d91c3=function(_0x27fdfe){while(--_0x27fdfe){_0x1631b3['push'](_0x1631b3['shift']());}};_0x1d91c3(++_0x4afc82);}(_0x46ed,0x168));var _0xd46e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x46ed[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xf3048c,_0x27dbfb){_0x27dbfb=_0x27dbfb||0xcc;return function(_0x53b309){if(_0x53b309){return _0xf3048c['sendStatus'](_0x27dbfb);}return _0xf3048c[_0xd46e('0x1a')](_0x27dbfb)[_0xd46e('0x1b')]();};}function respondWithResult(_0x1e9aae,_0x3fdf88){_0x3fdf88=_0x3fdf88||0xc8;return function(_0x50c7c3){if(_0x50c7c3){return _0x1e9aae[_0xd46e('0x1a')](_0x3fdf88)[_0xd46e('0x1c')](_0x50c7c3);}};}function respondWithFilteredResult(_0x417402,_0x3d72ce){return function(_0x36a317){if(_0x36a317){var _0x47fa8f=typeof _0x3d72ce[_0xd46e('0x1d')]===_0xd46e('0x1e')&&typeof _0x3d72ce[_0xd46e('0x1f')]==='undefined';var _0x5ddd04=_0x36a317[_0xd46e('0x20')];var _0x1bd574=_0x47fa8f?0x0:_0x3d72ce['offset'];var _0x4fd1f2=_0x47fa8f?_0x36a317[_0xd46e('0x20')]:_0x3d72ce[_0xd46e('0x1d')]+_0x3d72ce[_0xd46e('0x1f')];var _0x2273c5;if(_0x4fd1f2>=_0x5ddd04){_0x4fd1f2=_0x5ddd04;_0x2273c5=0xc8;}else{_0x2273c5=0xce;}_0x417402[_0xd46e('0x1a')](_0x2273c5);return _0x417402[_0xd46e('0x21')](_0xd46e('0x22'),_0x1bd574+'-'+_0x4fd1f2+'/'+_0x5ddd04)[_0xd46e('0x1c')](_0x36a317);}return null;};}function patchUpdates(_0xb4940){return function(_0x3c7e91){try{jsonpatch[_0xd46e('0x23')](_0x3c7e91,_0xb4940,!![]);}catch(_0x5ba94d){return BPromise[_0xd46e('0x24')](_0x5ba94d);}return _0x3c7e91[_0xd46e('0x25')]();};}function saveUpdates(_0x79aa51,_0x45ce0b){return function(_0x128246){if(_0x128246){return _0x128246[_0xd46e('0x26')](_0x79aa51)[_0xd46e('0x27')](function(_0x8a1be){return _0x8a1be;});}return null;};}function removeEntity(_0x62dea5,_0x4cf899){return function(_0x314570){if(_0x314570){return _0x314570['destroy']()['then'](function(){var _0x371054=_0x314570[_0xd46e('0x28')]({'plain':!![]});var _0x21135f=_0xd46e('0x29');return db[_0xd46e('0x2a')][_0xd46e('0x2b')]({'where':{'type':_0x21135f,'resourceId':_0x371054['id']}})[_0xd46e('0x27')](function(){return _0x314570;});})['then'](function(){_0x62dea5[_0xd46e('0x1a')](0xcc)[_0xd46e('0x1b')]();});}};}function handleEntityNotFound(_0xddbce9,_0x17db79){return function(_0x96f15c){if(!_0x96f15c){_0xddbce9[_0xd46e('0x2c')](0x194);}return _0x96f15c;};}function handleError(_0x58aeef,_0x465d54){_0x465d54=_0x465d54||0x1f4;return function(_0x3a1ced){logger[_0xd46e('0x2d')](_0x3a1ced[_0xd46e('0x2e')]);if(_0x3a1ced[_0xd46e('0x2f')]){delete _0x3a1ced[_0xd46e('0x2f')];}_0x58aeef[_0xd46e('0x1a')](_0x465d54)[_0xd46e('0x30')](_0x3a1ced);};}exports[_0xd46e('0x31')]=function(_0x45ea47,_0x2ff785){var _0x504324={},_0x2f4a1b={},_0x5ed8dc={'count':0x0,'rows':[]};var _0x1248ce=_[_0xd46e('0x32')](db[_0xd46e('0x33')][_0xd46e('0x34')],function(_0x5ef248){return{'name':_0x5ef248[_0xd46e('0x35')],'type':_0x5ef248[_0xd46e('0x36')]['key']};});_0x2f4a1b[_0xd46e('0x37')]=_[_0xd46e('0x32')](_0x1248ce,'name');_0x2f4a1b[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x45ea47[_0xd46e('0x38')]);_0x2f4a1b['filters']=_['intersection'](_0x2f4a1b[_0xd46e('0x37')],_0x2f4a1b[_0xd46e('0x38')]);_0x504324[_0xd46e('0x3a')]=_[_0xd46e('0x3b')](_0x2f4a1b[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x504324['attributes']=_0x504324[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x504324[_0xd46e('0x3a')]:_0x2f4a1b[_0xd46e('0x37')];if(!_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3e')](_0xd46e('0x3f'))){_0x504324['limit']=qs[_0xd46e('0x1f')](_0x45ea47[_0xd46e('0x38')]['limit']);_0x504324[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x1d')]);}_0x504324['order']=qs[_0xd46e('0x40')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x40')]);_0x504324[_0xd46e('0x41')]=qs[_0xd46e('0x42')](_[_0xd46e('0x43')](_0x45ea47[_0xd46e('0x38')],_0x2f4a1b[_0xd46e('0x42')]),_0x1248ce);if(_0x45ea47['query'][_0xd46e('0x44')]){_0x504324[_0xd46e('0x41')]=_[_0xd46e('0x45')](_0x504324[_0xd46e('0x41')],{'$or':_[_0xd46e('0x32')](_0x1248ce,function(_0x56f99c){if(_0x56f99c[_0xd46e('0x36')]!=='VIRTUAL'){var _0x55230d={};_0x55230d[_0x56f99c['name']]={'$like':'%'+_0x45ea47['query'][_0xd46e('0x44')]+'%'};return _0x55230d;}})});}_0x504324=_['merge']({},_0x504324,_0x45ea47[_0xd46e('0x46')]);var _0x40720e={'where':_0x504324['where']};return db[_0xd46e('0x33')][_0xd46e('0x20')](_0x40720e)[_0xd46e('0x27')](function(_0x31ba12){_0x5ed8dc[_0xd46e('0x20')]=_0x31ba12;if(_0x45ea47[_0xd46e('0x38')][_0xd46e('0x47')]){_0x504324[_0xd46e('0x48')]=[{'all':!![]}];}return db[_0xd46e('0x33')][_0xd46e('0x49')](_0x504324);})[_0xd46e('0x27')](function(_0x5ea048){_0x5ed8dc['rows']=_0x5ea048;return _0x5ed8dc;})['then'](respondWithFilteredResult(_0x2ff785,_0x504324))[_0xd46e('0x4a')](handleError(_0x2ff785,null));};exports['show']=function(_0x168d35,_0x272f5f){var _0x3fdf67={'raw':!![],'where':{'id':_0x168d35[_0xd46e('0x4b')]['id']}},_0x416505={};_0x416505[_0xd46e('0x37')]=_[_0xd46e('0x39')](db[_0xd46e('0x33')]['rawAttributes']);_0x416505[_0xd46e('0x38')]=_['keys'](_0x168d35[_0xd46e('0x38')]);_0x416505[_0xd46e('0x42')]=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],_0x416505[_0xd46e('0x38')]);_0x3fdf67['attributes']=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x168d35[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x3fdf67['attributes']=_0x3fdf67[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x3fdf67[_0xd46e('0x3a')]:_0x416505[_0xd46e('0x37')];if(_0x168d35[_0xd46e('0x38')]['includeAll']){_0x3fdf67[_0xd46e('0x48')]=[{'all':!![]}];}_0x3fdf67=_[_0xd46e('0x45')]({},_0x3fdf67,_0x168d35[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fdf67)[_0xd46e('0x27')](handleEntityNotFound(_0x272f5f,null))[_0xd46e('0x27')](respondWithResult(_0x272f5f,null))[_0xd46e('0x4a')](handleError(_0x272f5f,null));};exports['create']=function(_0xf9dab,_0x71a8dc){return db[_0xd46e('0x33')][_0xd46e('0x4d')](_0xf9dab[_0xd46e('0x4e')],{})['then'](function(_0x4ae314){var _0x3a94cf=_0xf9dab[_0xd46e('0x4f')][_0xd46e('0x28')]({'plain':!![]});if(!_0x3a94cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a94cf['role']===_0xd46e('0x4f')){var _0x9d8638=_0x4ae314['get']({'plain':!![]});var _0x2eee92=_0xd46e('0x50');return db[_0xd46e('0x51')][_0xd46e('0x4c')]({'where':{'name':_0x2eee92,'userProfileId':_0x3a94cf[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x27')](function(_0x80ed51){if(_0x80ed51&&_0x80ed51[_0xd46e('0x53')]===0x0){return db['UserProfileResource'][_0xd46e('0x4d')]({'name':_0x9d8638[_0xd46e('0x2f')],'resourceId':_0x9d8638['id'],'type':_0xd46e('0x29'),'sectionId':_0x80ed51['id']},{})[_0xd46e('0x27')](function(){return _0x4ae314;});}else{return _0x4ae314;}})['catch'](function(_0x56dd9a){logger[_0xd46e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56dd9a);throw _0x56dd9a;});}return _0x4ae314;})[_0xd46e('0x27')](respondWithResult(_0x71a8dc,0xc9))[_0xd46e('0x4a')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x26')]=function(_0x31f7eb,_0x5a7870){if(_0x31f7eb[_0xd46e('0x4e')]['id']){delete _0x31f7eb['body']['id'];}return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x31f7eb[_0xd46e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7870,null))[_0xd46e('0x27')](saveUpdates(_0x31f7eb[_0xd46e('0x4e')],null))[_0xd46e('0x27')](respondWithResult(_0x5a7870,null))[_0xd46e('0x4a')](handleError(_0x5a7870,null));};exports[_0xd46e('0x2b')]=function(_0x2cc676,_0x2760ef){return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x2cc676[_0xd46e('0x4b')]['id']}})[_0xd46e('0x27')](handleEntityNotFound(_0x2760ef,null))[_0xd46e('0x27')](removeEntity(_0x2760ef,null))[_0xd46e('0x4a')](handleError(_0x2760ef,null));};exports[_0xd46e('0x54')]=function(_0x47a86c,_0x3ec709){var _0x37a22f=0xa;var _0xe0cd61=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0xaf9641={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x481dce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x2dacb4=function(_0x2f9fcb){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x2f9fcb);};var _0x1aaa99=function(_0x272514){if(!_0x272514||!_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x476f09='(',_0x5067b7=0x0;_0x5067b7<_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')];_0x5067b7+=0x1){_0x5067b7>0x0&&(_0x476f09+='\x20'+_0x272514[_0xd46e('0x68')]+'\x20');_0x476f09+=_0x272514['rules'][_0x5067b7][_0xd46e('0x69')]?_0x1aaa99(_0x272514[_0xd46e('0x67')][_0x5067b7]['group']):_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6a')]+'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['condition']+(_0x2dacb4(_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6b')])?'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['value']:'');}return _0x476f09+')';};var _0xe5f8cd={'where':{'id':_0x47a86c[_0xd46e('0x4b')]['id']}},_0x516e7d,_0x32eed0,_0x148187,_0x35db1b,_0x4f3ba0;_0xe5f8cd=_[_0xd46e('0x45')]({},_0xe5f8cd,_0x47a86c[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0xe5f8cd)[_0xd46e('0x27')](function(_0x16f906){if(_0x16f906){_0x516e7d=_0x16f906;return _0x16f906[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0x3e55a3){if(_0x3e55a3){if(!_0x3e55a3[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))](_0xd46e('0x6f'),0x193);}_0x32eed0=_0x3e55a3;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3e0ed5){if(_0x3e0ed5){_0x148187=_[_0xd46e('0x70')](_0x3e0ed5,'id');var _0x2fff69;var _0x249938=squel['select']();_0x249938[_0xd46e('0x71')](_0x516e7d[_0xd46e('0x72')]);for(var _0xfb4073=0x0;_0xfb4073<_0x32eed0[_0xd46e('0x3d')];_0xfb4073+=0x1){_0x2fff69=_0x32eed0[_0xfb4073]['MetricId']?_0x148187[_0x32eed0[_0xfb4073][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x32eed0[_0xfb4073]['field'];_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0xaf9641[_0x32eed0[_0xfb4073]['function']],'%s',_0x2fff69):_0x2fff69;_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x481dce[_0x32eed0[_0xfb4073]['format']],'%s',_0x2fff69):_0x2fff69;if(_0x32eed0[_0xfb4073][_0xd46e('0x78')]){_0x249938['group'](_0x2fff69);}_0x32eed0[_0xfb4073][_0xd46e('0x79')]&&_0x249938[_0xd46e('0x7a')](_0x2fff69,_0x32eed0[_0xfb4073]['orderBy']==='DESC'?![]:!![]);_0x249938[_0xd46e('0x6a')](_0x2fff69,_0x32eed0[_0xfb4073][_0xd46e('0x7b')]||_0x2fff69);}if(_0x516e7d[_0xd46e('0x7c')]){_0x516e7d[_0xd46e('0x7c')]=JSON['parse'](_0x516e7d[_0xd46e('0x7c')]);for(var _0x372509=0x0;_0x372509<_0x516e7d['joins'][_0xd46e('0x3d')];_0x372509+=0x1){if(_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0xe0cd61,_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')])&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7d')]&&_0x516e7d[_0xd46e('0x7c')][_0x372509]['foreignTable']&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7e')]){_0x249938[_0x516e7d['joins'][_0x372509][_0xd46e('0x36')]](_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0x516e7d[_0xd46e('0x72')],_0x516e7d['joins'][_0x372509]['parentKey'],_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],_0x516e7d['joins'][_0x372509]['foreignKey']));}}}if(_0x516e7d['conditions']){_0x516e7d[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x516e7d[_0xd46e('0x81')]);_0x249938['where'](_0x1aaa99(_0x516e7d[_0xd46e('0x81')][_0xd46e('0x69')]));}_0x4f3ba0=_0x249938[_0xd46e('0x83')]();_0x249938['limit'](_0x37a22f);_0x249938['offset'](0x0);logger['debug']('Limited\x20Query:',_0x249938[_0xd46e('0x84')]());return dbH['sequelize'][_0xd46e('0x38')](_0x249938['toString'](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](respondWithResult(_0x3ec709,null))[_0xd46e('0x4a')](handleError(_0x3ec709,null));};function runReport(_0xf16d87,_0x99872a,_0x57a7cc){var _0x586024=_0x99872a[_0xd46e('0x2f')];var _0x383919=0xa;var _0x114f2c=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0x4ca21f={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x5ef4cc={'SEC_TO_TIME':_0xd46e('0x87'),'DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x88460a=function(_0x3a3744){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x3a3744);};var _0x3c476d=function(_0x1b2a6d){if(!_0x1b2a6d||!_0x1b2a6d[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x441f73='(',_0x1d2738=0x0;_0x1d2738<_0x1b2a6d['rules'][_0xd46e('0x3d')];_0x1d2738+=0x1){_0x1d2738>0x0&&(_0x441f73+='\x20'+_0x1b2a6d['operator']+'\x20');_0x441f73+=_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x69')]?_0x3c476d(_0x1b2a6d['rules'][_0x1d2738][_0xd46e('0x69')]):_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6a')]+'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')]+(_0x88460a(_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')])?'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x88')]:'');}return _0x441f73+')';};var _0x3fa34d={'where':{'id':_0xf16d87['id']}},_0xc098c9,_0x5f5ba7,_0x493df5,_0x18e140,_0x459a0c;_0x3fa34d=_[_0xd46e('0x45')]({},_0x3fa34d,_0x57a7cc);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fa34d)[_0xd46e('0x27')](function(_0x5b554e){if(_0x5b554e){_0xc098c9=_0x5b554e;return _0x5b554e[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0xa254f5){if(_0xa254f5){if(!_0xa254f5[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5f5ba7=_0xa254f5;return db[_0xd46e('0x89')][_0xd46e('0x49')]({'raw':!![]});}return null;})['then'](function(_0x3c8d68){if(_0x3c8d68){_0x493df5=_[_0xd46e('0x70')](_0x3c8d68,'id');var _0x9e222d;var _0x3da17e=squel[_0xd46e('0x8a')]();_0x3da17e[_0xd46e('0x71')](_0xc098c9[_0xd46e('0x72')]);for(var _0x282f71=0x0;_0x282f71<_0x5f5ba7[_0xd46e('0x3d')];_0x282f71+=0x1){_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x73')]?_0x493df5[_0x5f5ba7[_0x282f71][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x5f5ba7[_0x282f71][_0xd46e('0x6a')];_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x75')]?_['replace'](_0x4ca21f[_0x5f5ba7[_0x282f71]['function']],'%s',_0x9e222d):_0x9e222d;_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x5ef4cc[_0x5f5ba7[_0x282f71][_0xd46e('0x77')]],'%s',_0x9e222d):_0x9e222d;if(_0x5f5ba7[_0x282f71][_0xd46e('0x78')]){_0x3da17e[_0xd46e('0x69')](_0x9e222d);}_0x5f5ba7[_0x282f71][_0xd46e('0x79')]&&_0x3da17e['order'](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x3da17e[_0xd46e('0x6a')](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x7b')]||_0x9e222d);}if(_0xc098c9['joins']){_0xc098c9[_0xd46e('0x7c')]=JSON[_0xd46e('0x82')](_0xc098c9['joins']);for(var _0xdf967c=0x0;_0xdf967c<_0xc098c9['joins']['length'];_0xdf967c+=0x1){if(_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x114f2c,_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['type'])&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7d')]&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7f')]&&_0xc098c9['joins'][_0xdf967c]['foreignKey']){_0x3da17e[_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]](_0xc098c9['joins'][_0xdf967c]['foreignTable'],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0xc098c9[_0xd46e('0x72')],_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['parentKey'],_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x7f')],_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7e')]));}}}if(_0xc098c9[_0xd46e('0x81')]){_0xc098c9[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0xc098c9[_0xd46e('0x81')]);_0x3da17e[_0xd46e('0x41')](_0x3c476d(_0xc098c9['conditions'][_0xd46e('0x69')]));}_0x459a0c=_0x3da17e[_0xd46e('0x83')]();_0x3da17e['limit'](_0x383919);_0x3da17e['offset'](0x0);return;}})[_0xd46e('0x27')](function(){if(_0x99872a[_0xd46e('0x8c')]==='web'){return null;}var _0x5e637d=_[_0xd46e('0x45')](_0x99872a,{'name':_0x99872a[_0xd46e('0x8d')]||_0x99872a['name']||_0xc098c9[_0xd46e('0x2f')],'basename':_0x586024,'savename':util[_0xd46e('0x77')](_0xd46e('0x8e'),_0x99872a[_0xd46e('0x2f')]||_0xc098c9[_0xd46e('0x2f')],require(_0xd46e('0x8f'))['generate'](0x4),_0x99872a[_0xd46e('0x8c')]||_0xd46e('0x90')),'reportId':_0xc098c9['id'],'reportType':_0xd46e('0x91')});return db[_0xd46e('0x92')][_0xd46e('0x4d')](_0x5e637d,{'raw':!![]});})[_0xd46e('0x27')](function(_0x3311a6){if(_0xc098c9[_0xd46e('0x72')]===_0xd46e('0x93')){_0x459a0c[_0xd46e('0x41')](_0xc098c9[_0xd46e('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x99872a[_0xd46e('0x94')],_0x99872a['endDate']);}else{_0x459a0c['where'](_0xc098c9[_0xd46e('0x72')]+_0xd46e('0x95'),_0x99872a[_0xd46e('0x94')],_0x99872a[_0xd46e('0x96')]);}if(_0x3311a6){logger[_0xd46e('0x97')](_0xd46e('0x98'),_0x459a0c[_0xd46e('0x84')]());require(_0xd46e('0x99'))['fork'](path[_0xd46e('0x55')](__dirname,'../../components/export/',_0x3311a6[_0xd46e('0x8c')]),[_0x3311a6['id'],_0x459a0c[_0xd46e('0x84')](),path[_0xd46e('0x55')](__dirname,_0xd46e('0x9a'),_0x3311a6[_0xd46e('0x9b')]),_0x586024]);return _0x3311a6;}else{var _0x399918=squel[_0xd46e('0x8a')]();_0x399918[_0xd46e('0x71')]('('+_0x459a0c['toString']()+')',_0xd46e('0x9c'));_0x399918[_0xd46e('0x6a')](_0xd46e('0x9d'),'count');_0x459a0c[_0xd46e('0x1f')](_0x99872a[_0xd46e('0x1f')]||_0x383919);_0x459a0c[_0xd46e('0x1d')](_0x99872a['offset']||0x0);return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x399918[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]})['then'](function(_0x4967ff){if(!_0x4967ff[_0xd46e('0x3d')]){_0x18e140=0x0;}else{_0x18e140=_0x4967ff[0x0][_0xd46e('0x20')]||0x0;}return dbH['sequelize'][_0xd46e('0x38')](_0x459a0c[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]});})[_0xd46e('0x27')](function(_0x4bb76b){return{'rows':_0x4bb76b||[],'count':_0x18e140};});}});}exports['run']=function(_0x204a9f,_0x52ca5a){return runReport(_0x204a9f[_0xd46e('0x4b')],_0x204a9f[_0xd46e('0x38')],_0x204a9f['options'])[_0xd46e('0x27')](respondWithResult(_0x52ca5a,null))[_0xd46e('0x4a')](handleError(_0x52ca5a,null));};exports[_0xd46e('0x9f')]=runReport;exports[_0xd46e('0x38')]=function(_0x786ae,_0x537c73){var _0x1610bd=0xa;var _0x20cc4c=[_0xd46e('0x55'),_0xd46e('0xa0'),_0xd46e('0x56'),_0xd46e('0x57')];var _0x368742={'SUM':_0xd46e('0x58'),'COUNT':_0xd46e('0xa1'),'COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':_0xd46e('0xa2'),'AVG':_0xd46e('0xa3'),'GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x285cf8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc87da2=function(_0x195f02){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),'IS\x20NOT\x20NULL',_0xd46e('0x65'),_0xd46e('0x66')],_0x195f02);};var _0x44322f=function(_0x49959f){if(!_0x49959f||!_0x49959f['rules'][_0xd46e('0x3d')]){return'';}for(var _0x2094e5='(',_0x85aac1=0x0;_0x85aac1<_0x49959f[_0xd46e('0x67')][_0xd46e('0x3d')];_0x85aac1+=0x1){_0x85aac1>0x0&&(_0x2094e5+='\x20'+_0x49959f[_0xd46e('0x68')]+'\x20');_0x2094e5+=_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]?_0x44322f(_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]):_0x49959f['rules'][_0x85aac1][_0xd46e('0x6a')]+'\x20'+_0x49959f['rules'][_0x85aac1]['condition']+(_0xc87da2(_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x6b')])?'\x20'+_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x88')]:'');}return _0x2094e5+')';};var _0x101a29={'where':{'id':_0x786ae[_0xd46e('0x4b')]['id']}},_0x3a44da,_0x417068,_0x52e73e,_0x206077,_0xe729b6;_0x101a29=_[_0xd46e('0x45')]({},_0x101a29,_0x786ae[_0xd46e('0x46')]);return db['AnalyticDefaultReport'][_0xd46e('0x4c')](_0x101a29)[_0xd46e('0x27')](function(_0x1d08bb){if(_0x1d08bb){_0x3a44da=_0x1d08bb;return _0x1d08bb['getFields']();}return null;})[_0xd46e('0x27')](function(_0x8c6ed1){if(_0x8c6ed1){if(!_0x8c6ed1['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xd46e('0x6f'),0x193);}_0x417068=_0x8c6ed1;return db[_0xd46e('0x89')]['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3a13f8){if(_0x3a13f8){_0x52e73e=_['keyBy'](_0x3a13f8,'id');var _0x5a8661;var _0x157fb0=squel[_0xd46e('0x8a')]();_0x157fb0[_0xd46e('0x71')](_0x3a44da[_0xd46e('0x72')]);for(var _0x50750f=0x0;_0x50750f<_0x417068['length'];_0x50750f+=0x1){_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x73')]?_0x52e73e[_0x417068[_0x50750f][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x417068[_0x50750f][_0xd46e('0x6a')];_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0x368742[_0x417068[_0x50750f][_0xd46e('0x75')]],'%s',_0x5a8661):_0x5a8661;_0x5a8661=_0x417068[_0x50750f]['format']?_[_0xd46e('0x76')](_0x285cf8[_0x417068[_0x50750f][_0xd46e('0x77')]],'%s',_0x5a8661):_0x5a8661;if(_0x417068[_0x50750f]['groupBy']){_0x157fb0[_0xd46e('0x69')](_0x5a8661);}_0x417068[_0x50750f][_0xd46e('0x79')]&&_0x157fb0[_0xd46e('0x7a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x157fb0[_0xd46e('0x6a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x7b')]||_0x5a8661);}if(_0x3a44da[_0xd46e('0x7c')]){_0x3a44da['joins']=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x7c')]);for(var _0x3c819b=0x0;_0x3c819b<_0x3a44da[_0xd46e('0x7c')][_0xd46e('0x3d')];_0x3c819b+=0x1){if(_0x3a44da['joins'][_0x3c819b][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x20cc4c,_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')])&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7d')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']){_0x157fb0[_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')]](_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3a44da[_0xd46e('0x72')],_0x3a44da['joins'][_0x3c819b][_0xd46e('0x7d')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']));}}}if(_0x3a44da[_0xd46e('0x81')]){_0x3a44da[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x81')]);_0x157fb0[_0xd46e('0x41')](_0x44322f(_0x3a44da[_0xd46e('0x81')][_0xd46e('0x69')]));}_0xe729b6=_0x157fb0[_0xd46e('0x83')]();_0x157fb0[_0xd46e('0x1f')](_0x1610bd);_0x157fb0['offset'](0x0);logger['debug'](_0xd46e('0xa4'),_0x157fb0['toString']());return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x157fb0[_0xd46e('0x84')](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](function(){return{'sql':_0xe729b6['toString']()};})['then'](respondWithResult(_0x537c73,null))[_0xd46e('0x4a')](handleError(_0x537c73,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index b0d58a8..9586db0 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 _0xceff=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','AnalyticDefaultReport','analytics_default_reports'];(function(_0x38b9f7,_0x1e8eff){var _0x3e0626=function(_0x1fb64a){while(--_0x1fb64a){_0x38b9f7['push'](_0x38b9f7['shift']());}};_0x3e0626(++_0x1e8eff);}(_0xceff,0xb4));var _0xfcef=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xceff[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xfcef('0x0'));var util=require(_0xfcef('0x1'));var logger=require(_0xfcef('0x2'))(_0xfcef('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcef('0x4'));var rimraf=require(_0xfcef('0x5'));var config=require(_0xfcef('0x6'));var attributes=require(_0xfcef('0x7'));module['exports']=function(_0x1448b5,_0x3c677f){return _0x1448b5['define'](_0xfcef('0x8'),attributes,{'tableName':_0xfcef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce8a=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','exports','define','AnalyticDefaultReport'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0xce8a,0x122));var _0xace8=function(_0xe598bd,_0x2129b2){_0xe598bd=_0xe598bd-0x0;var _0x38a7aa=_0xce8a[_0xe598bd];return _0x38a7aa;};'use strict';var _=require(_0xace8('0x0'));var util=require(_0xace8('0x1'));var logger=require(_0xace8('0x2'))('api');var moment=require(_0xace8('0x3'));var BPromise=require(_0xace8('0x4'));var rp=require(_0xace8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xace8('0x6'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0xace8('0x7')]=function(_0x505c49,_0x40a141){return _0x505c49[_0xace8('0x8')](_0xace8('0x9'),attributes,{'tableName':'analytics_default_reports','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 eff2405..f22b05c 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 _0xbe49=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s'];(function(_0x56dcf3,_0x2636b0){var _0x1e81b9=function(_0x2f2e76){while(--_0x2f2e76){_0x56dcf3['push'](_0x56dcf3['shift']());}};_0x1e81b9(++_0x2636b0);}(_0xbe49,0xeb));var _0x9be4=function(_0x49ea80,_0x42c27c){_0x49ea80=_0x49ea80-0x0;var _0xbd8b7d=_0xbe49[_0x49ea80];return _0xbd8b7d;};'use strict';var _=require(_0x9be4('0x0'));var util=require(_0x9be4('0x1'));var moment=require(_0x9be4('0x2'));var BPromise=require(_0x9be4('0x3'));var rs=require(_0x9be4('0x4'));var fs=require('fs');var Redis=require(_0x9be4('0x5'));var db=require(_0x9be4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9be4('0x7'))(_0x9be4('0x8'));var config=require(_0x9be4('0x9'));var jayson=require(_0x9be4('0xa'));var client=jayson['client'][_0x9be4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1feadf,_0x376037,_0x37eab0){return new BPromise(function(_0x428a1b,_0x31747e){return client[_0x9be4('0xc')](_0x1feadf,_0x37eab0)['then'](function(_0x37f443){logger[_0x9be4('0xd')](_0x9be4('0xe'),_0x376037,_0x9be4('0xf'));logger[_0x9be4('0x10')](_0x9be4('0x11'),_0x376037,_0x9be4('0xf'),JSON[_0x9be4('0x12')](_0x37f443));if(_0x37f443[_0x9be4('0x13')]){if(_0x37f443[_0x9be4('0x13')]['code']===0x1f4){logger[_0x9be4('0x13')](_0x9be4('0xe'),_0x376037,_0x37f443[_0x9be4('0x13')][_0x9be4('0x14')]);return _0x31747e(_0x37f443[_0x9be4('0x13')][_0x9be4('0x14')]);}logger[_0x9be4('0x13')](_0x9be4('0xe'),_0x376037,_0x37f443['error'][_0x9be4('0x14')]);return _0x428a1b(_0x37f443[_0x9be4('0x13')][_0x9be4('0x14')]);}else{logger[_0x9be4('0xd')](_0x9be4('0xe'),_0x376037,_0x9be4('0xf'));_0x428a1b(_0x37f443[_0x9be4('0x15')][_0x9be4('0x14')]);}})[_0x9be4('0x16')](function(_0x5abaff){logger[_0x9be4('0x13')](_0x9be4('0xe'),_0x376037,_0x5abaff);_0x31747e(_0x5abaff);});});} \ No newline at end of file +var _0xf9be=['request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','lodash','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x44f641,_0x5e93a8){var _0x5036c0=function(_0x4e5a40){while(--_0x4e5a40){_0x44f641['push'](_0x44f641['shift']());}};_0x5036c0(++_0x5e93a8);}(_0xf9be,0x8f));var _0xef9b=function(_0x538fd8,_0x24ed11){_0x538fd8=_0x538fd8-0x0;var _0x279fb4=_0xf9be[_0x538fd8];return _0x279fb4;};'use strict';var _=require(_0xef9b('0x0'));var util=require('util');var moment=require(_0xef9b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xef9b('0x2'));var logger=require(_0xef9b('0x3'))(_0xef9b('0x4'));var config=require(_0xef9b('0x5'));var jayson=require(_0xef9b('0x6'));var client=jayson[_0xef9b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18d7ac,_0x4f2dfc,_0x145c6e){return new BPromise(function(_0x3f1f31,_0x417acc){return client['request'](_0x18d7ac,_0x145c6e)[_0xef9b('0x8')](function(_0x1b1e14){logger['info'](_0xef9b('0x9'),_0x4f2dfc,_0xef9b('0xa'));logger[_0xef9b('0xb')](_0xef9b('0xc'),_0x4f2dfc,_0xef9b('0xa'),JSON[_0xef9b('0xd')](_0x1b1e14));if(_0x1b1e14[_0xef9b('0xe')]){if(_0x1b1e14[_0xef9b('0xe')]['code']===0x1f4){logger[_0xef9b('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4f2dfc,_0x1b1e14['error'][_0xef9b('0xf')]);return _0x417acc(_0x1b1e14[_0xef9b('0xe')]['message']);}logger['error'](_0xef9b('0x9'),_0x4f2dfc,_0x1b1e14['error']['message']);return _0x3f1f31(_0x1b1e14[_0xef9b('0xe')]['message']);}else{logger[_0xef9b('0x10')](_0xef9b('0x9'),_0x4f2dfc,'request\x20sent');_0x3f1f31(_0x1b1e14['result'][_0xef9b('0xf')]);}})['catch'](function(_0x42fd74){logger[_0xef9b('0xe')](_0xef9b('0x9'),_0x4f2dfc,_0x42fd74);_0x417acc(_0x42fd74);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 54f94d8..d47746c 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 _0x65e1=['multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','update','delete','destroy'];(function(_0x597351,_0x5aed9f){var _0x410cd7=function(_0x511d62){while(--_0x511d62){_0x597351['push'](_0x597351['shift']());}};_0x410cd7(++_0x5aed9f);}(_0x65e1,0x159));var _0x165e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x65e1[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x165e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x165e('0x1'));var express=require(_0x165e('0x2'));var router=express['Router']();var fs_extra=require(_0x165e('0x3'));var auth=require(_0x165e('0x4'));var interaction=require(_0x165e('0x5'));var config=require(_0x165e('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0x165e('0x7')]('/',auth['isAuthenticated'](),controller[_0x165e('0x8')]);router['get'](_0x165e('0x9'),auth[_0x165e('0xa')](),controller[_0x165e('0xb')]);router[_0x165e('0x7')](_0x165e('0xc'),auth[_0x165e('0xa')](),controller[_0x165e('0xd')]);router[_0x165e('0x7')](_0x165e('0xe'),auth['isAuthenticated'](),controller[_0x165e('0xf')]);router[_0x165e('0x7')](_0x165e('0x10'),auth[_0x165e('0xa')](),controller['query']);router[_0x165e('0x11')]('/',auth[_0x165e('0xa')](),controller[_0x165e('0x12')]);router[_0x165e('0x13')](_0x165e('0x9'),auth[_0x165e('0xa')](),controller[_0x165e('0x14')]);router[_0x165e('0x15')](_0x165e('0x9'),auth[_0x165e('0xa')](),controller[_0x165e('0x16')]);module['exports']=router; \ No newline at end of file +var _0xec0a=['delete','exports','multer','util','path','connect-timeout','express','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put','update'];(function(_0x3776d2,_0x2b7686){var _0x4cd7e3=function(_0x187c76){while(--_0x187c76){_0x3776d2['push'](_0x3776d2['shift']());}};_0x4cd7e3(++_0x2b7686);}(_0xec0a,0x86));var _0xaec0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xec0a[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xaec0('0x0'));var util=require(_0xaec0('0x1'));var path=require(_0xaec0('0x2'));var timeout=require(_0xaec0('0x3'));var express=require(_0xaec0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaec0('0x5'));var controller=require(_0xaec0('0x6'));router[_0xaec0('0x7')]('/',auth[_0xaec0('0x8')](),controller[_0xaec0('0x9')]);router[_0xaec0('0x7')](_0xaec0('0xa'),auth[_0xaec0('0x8')](),controller['show']);router['get'](_0xaec0('0xb'),auth[_0xaec0('0x8')](),controller[_0xaec0('0xc')]);router[_0xaec0('0x7')](_0xaec0('0xd'),auth[_0xaec0('0x8')](),controller[_0xaec0('0xe')]);router[_0xaec0('0x7')](_0xaec0('0xf'),auth[_0xaec0('0x8')](),controller[_0xaec0('0x10')]);router[_0xaec0('0x11')]('/',auth[_0xaec0('0x8')](),controller['create']);router[_0xaec0('0x12')](_0xaec0('0xa'),auth[_0xaec0('0x8')](),controller[_0xaec0('0x13')]);router[_0xaec0('0x14')](_0xaec0('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xaec0('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index bbbcfd4..7ab52c1 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 _0x5f41=['manual','INTEGER','sequelize','exports','STRING','ENUM','xlsx','csv','DATE','Loading'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5f41,0x8e));var _0x15f4=function(_0x671b44,_0x4a78ce){_0x671b44=_0x671b44-0x0;var _0x188e79=_0x5f41[_0x671b44];return _0x188e79;};'use strict';var Sequelize=require(_0x15f4('0x0'));var moment=require('moment');module[_0x15f4('0x1')]={'name':{'type':Sequelize[_0x15f4('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x15f4('0x3')]('csv','pdf',_0x15f4('0x4')),'allowNull':![],'defaultValue':_0x15f4('0x5')},'savename':{'type':Sequelize[_0x15f4('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x15f4('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x15f4('0x2')],'defaultValue':_0x15f4('0x7')},'type':{'type':Sequelize[_0x15f4('0x3')](_0x15f4('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0x15f4('0x8')},'reportId':{'type':Sequelize[_0x15f4('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x15f4('0x2')]}}; \ No newline at end of file +var _0x1839=['pdf','xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv'];(function(_0x576ca7,_0x3d360a){var _0x4cb695=function(_0x5adf2e){while(--_0x5adf2e){_0x576ca7['push'](_0x576ca7['shift']());}};_0x4cb695(++_0x3d360a);}(_0x1839,0x157));var _0x9183=function(_0x58c6db,_0x2e5fa3){_0x58c6db=_0x58c6db-0x0;var _0x33de5c=_0x1839[_0x58c6db];return _0x33de5c;};'use strict';var Sequelize=require(_0x9183('0x0'));var moment=require(_0x9183('0x1'));module['exports']={'name':{'type':Sequelize[_0x9183('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x9183('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x9183('0x3')](_0x9183('0x4'),_0x9183('0x5'),_0x9183('0x6')),'allowNull':![],'defaultValue':_0x9183('0x4')},'savename':{'type':Sequelize[_0x9183('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x9183('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x9183('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x9183('0x3')](_0x9183('0x8'),_0x9183('0x9')),'allowNull':![],'defaultValue':_0x9183('0x8')},'reportId':{'type':Sequelize[_0x9183('0xa')](0xb)[_0x9183('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 5fe80af..b2639d3 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 _0x7f43=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','Content-Range','then','destroy','get','end','stack','name','index','AnalyticExtractedReport','type','key','map','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','download','basename','savename','existsSync','join','root','Sequelize','ValidationError','exists','server/files/reports','format','%s.%s','output','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x7f43,0x115));var _0x37f4=function(_0x15a316,_0x12265b){_0x15a316=_0x15a316-0x0;var _0xb9bd29=_0x7f43[_0x15a316];return _0xb9bd29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x37f4('0x0'));var zipdir=require(_0x37f4('0x1'));var jsonpatch=require(_0x37f4('0x2'));var rp=require(_0x37f4('0x3'));var moment=require(_0x37f4('0x4'));var BPromise=require(_0x37f4('0x5'));var Mustache=require(_0x37f4('0x6'));var util=require(_0x37f4('0x7'));var path=require('path');var sox=require(_0x37f4('0x8'));var csv=require(_0x37f4('0x9'));var ejs=require(_0x37f4('0xa'));var fs=require('fs');var fs_extra=require(_0x37f4('0xb'));var _=require('lodash');var squel=require(_0x37f4('0xc'));var crypto=require(_0x37f4('0xd'));var jsforce=require(_0x37f4('0xe'));var deskjs=require(_0x37f4('0xf'));var toCsv=require(_0x37f4('0x9'));var querystring=require(_0x37f4('0x10'));var Papa=require(_0x37f4('0x11'));var Redis=require(_0x37f4('0x12'));var authService=require(_0x37f4('0x13'));var qs=require(_0x37f4('0x14'));var as=require(_0x37f4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x37f4('0x16'))(_0x37f4('0x17'));var utils=require(_0x37f4('0x18'));var config=require(_0x37f4('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x37f4('0x1a'))['db'];function respondWithStatusCode(_0x5916b3,_0x3fa7b8){_0x3fa7b8=_0x3fa7b8||0xcc;return function(_0x2de657){if(_0x2de657){return _0x5916b3[_0x37f4('0x1b')](_0x3fa7b8);}return _0x5916b3['status'](_0x3fa7b8)['end']();};}function respondWithResult(_0xc62a36,_0x5affc5){_0x5affc5=_0x5affc5||0xc8;return function(_0x1c2a11){if(_0x1c2a11){return _0xc62a36['status'](_0x5affc5)[_0x37f4('0x1c')](_0x1c2a11);}};}function respondWithFilteredResult(_0x4f9798,_0x239908){return function(_0x57fc82){if(_0x57fc82){var _0x47a117=typeof _0x239908[_0x37f4('0x1d')]===_0x37f4('0x1e')&&typeof _0x239908[_0x37f4('0x1f')]==='undefined';var _0x2edcd6=_0x57fc82['count'];var _0x4c4cf0=_0x47a117?0x0:_0x239908['offset'];var _0x3aa90d=_0x47a117?_0x57fc82[_0x37f4('0x20')]:_0x239908[_0x37f4('0x1d')]+_0x239908[_0x37f4('0x1f')];var _0x4e70b5;if(_0x3aa90d>=_0x2edcd6){_0x3aa90d=_0x2edcd6;_0x4e70b5=0xc8;}else{_0x4e70b5=0xce;}_0x4f9798[_0x37f4('0x21')](_0x4e70b5);return _0x4f9798['set'](_0x37f4('0x22'),_0x4c4cf0+'-'+_0x3aa90d+'/'+_0x2edcd6)[_0x37f4('0x1c')](_0x57fc82);}return null;};}function patchUpdates(_0x1373a2){return function(_0xc739c6){try{jsonpatch['apply'](_0xc739c6,_0x1373a2,!![]);}catch(_0x7b2639){return BPromise['reject'](_0x7b2639);}return _0xc739c6['save']();};}function saveUpdates(_0x43aad2,_0x35469a){return function(_0x46c241){if(_0x46c241){return _0x46c241['update'](_0x43aad2)[_0x37f4('0x23')](function(_0xa67034){return _0xa67034;});}return null;};}function removeEntity(_0x325b63,_0x5c5913){return function(_0x52e55a){if(_0x52e55a){return _0x52e55a[_0x37f4('0x24')]()[_0x37f4('0x23')](function(){var _0x3bd16b=_0x52e55a[_0x37f4('0x25')]({'plain':!![]});var _0x3f2276='ExtractedReports';return db['UserProfileResource'][_0x37f4('0x24')]({'where':{'type':_0x3f2276,'resourceId':_0x3bd16b['id']}})[_0x37f4('0x23')](function(){return _0x52e55a;});})[_0x37f4('0x23')](function(){_0x325b63[_0x37f4('0x21')](0xcc)[_0x37f4('0x26')]();});}};}function handleEntityNotFound(_0x3d5b83,_0x23c033){return function(_0x5c069a){if(!_0x5c069a){_0x3d5b83[_0x37f4('0x1b')](0x194);}return _0x5c069a;};}function handleError(_0x255713,_0x557052){_0x557052=_0x557052||0x1f4;return function(_0x598092){logger['error'](_0x598092[_0x37f4('0x27')]);if(_0x598092[_0x37f4('0x28')]){delete _0x598092[_0x37f4('0x28')];}_0x255713[_0x37f4('0x21')](_0x557052)['send'](_0x598092);};}exports[_0x37f4('0x29')]=function(_0x5346ad,_0x3a3fbd){var _0x2215f3={},_0x2c414b={},_0x41c00b={'count':0x0,'rows':[]};var _0x39bf3e=_['map'](db[_0x37f4('0x2a')]['rawAttributes'],function(_0x17ee15){return{'name':_0x17ee15['fieldName'],'type':_0x17ee15[_0x37f4('0x2b')][_0x37f4('0x2c')]};});_0x2c414b['model']=_[_0x37f4('0x2d')](_0x39bf3e,_0x37f4('0x28'));_0x2c414b[_0x37f4('0x2e')]=_['keys'](_0x5346ad['query']);_0x2c414b[_0x37f4('0x2f')]=_[_0x37f4('0x30')](_0x2c414b[_0x37f4('0x31')],_0x2c414b[_0x37f4('0x2e')]);_0x2215f3[_0x37f4('0x32')]=_[_0x37f4('0x30')](_0x2c414b[_0x37f4('0x31')],qs[_0x37f4('0x33')](_0x5346ad['query']['fields']));_0x2215f3[_0x37f4('0x32')]=_0x2215f3[_0x37f4('0x32')][_0x37f4('0x34')]?_0x2215f3[_0x37f4('0x32')]:_0x2c414b[_0x37f4('0x31')];if(!_0x5346ad[_0x37f4('0x2e')]['hasOwnProperty'](_0x37f4('0x35'))){_0x2215f3['limit']=qs[_0x37f4('0x1f')](_0x5346ad['query'][_0x37f4('0x1f')]);_0x2215f3['offset']=qs[_0x37f4('0x1d')](_0x5346ad[_0x37f4('0x2e')]['offset']);}_0x2215f3[_0x37f4('0x36')]=qs['sort'](_0x5346ad[_0x37f4('0x2e')][_0x37f4('0x37')]);_0x2215f3[_0x37f4('0x38')]=qs[_0x37f4('0x2f')](_[_0x37f4('0x39')](_0x5346ad['query'],_0x2c414b[_0x37f4('0x2f')]),_0x39bf3e);if(_0x5346ad[_0x37f4('0x2e')]['filter']){_0x2215f3['where']=_['merge'](_0x2215f3[_0x37f4('0x38')],{'$or':_['map'](_0x39bf3e,function(_0x4915eb){if(_0x4915eb[_0x37f4('0x2b')]!==_0x37f4('0x3a')){var _0x2f7cc2={};_0x2f7cc2[_0x4915eb[_0x37f4('0x28')]]={'$like':'%'+_0x5346ad[_0x37f4('0x2e')][_0x37f4('0x3b')]+'%'};return _0x2f7cc2;}})});}_0x2215f3=_[_0x37f4('0x3c')]({},_0x2215f3,_0x5346ad[_0x37f4('0x3d')]);var _0x26715a={'where':_0x2215f3[_0x37f4('0x38')]};return db[_0x37f4('0x2a')][_0x37f4('0x20')](_0x26715a)[_0x37f4('0x23')](function(_0x3f10f7){_0x41c00b[_0x37f4('0x20')]=_0x3f10f7;if(_0x5346ad[_0x37f4('0x2e')][_0x37f4('0x3e')]){_0x2215f3['include']=[{'all':!![]}];}return db[_0x37f4('0x2a')][_0x37f4('0x3f')](_0x2215f3);})[_0x37f4('0x23')](function(_0x4c5fd9){_0x41c00b['rows']=_0x4c5fd9;return _0x41c00b;})[_0x37f4('0x23')](respondWithFilteredResult(_0x3a3fbd,_0x2215f3))[_0x37f4('0x40')](handleError(_0x3a3fbd,null));};exports[_0x37f4('0x41')]=function(_0x4e3096,_0x545fe0){var _0x769a18={'raw':!![],'where':{'id':_0x4e3096[_0x37f4('0x42')]['id']}},_0x5ca9e3={};_0x5ca9e3[_0x37f4('0x31')]=_[_0x37f4('0x43')](db[_0x37f4('0x2a')]['rawAttributes']);_0x5ca9e3[_0x37f4('0x2e')]=_[_0x37f4('0x43')](_0x4e3096[_0x37f4('0x2e')]);_0x5ca9e3[_0x37f4('0x2f')]=_[_0x37f4('0x30')](_0x5ca9e3[_0x37f4('0x31')],_0x5ca9e3[_0x37f4('0x2e')]);_0x769a18[_0x37f4('0x32')]=_[_0x37f4('0x30')](_0x5ca9e3[_0x37f4('0x31')],qs[_0x37f4('0x33')](_0x4e3096['query']['fields']));_0x769a18[_0x37f4('0x32')]=_0x769a18[_0x37f4('0x32')][_0x37f4('0x34')]?_0x769a18[_0x37f4('0x32')]:_0x5ca9e3[_0x37f4('0x31')];if(_0x4e3096[_0x37f4('0x2e')][_0x37f4('0x3e')]){_0x769a18['include']=[{'all':!![]}];}_0x769a18=_['merge']({},_0x769a18,_0x4e3096['options']);return db[_0x37f4('0x2a')][_0x37f4('0x44')](_0x769a18)[_0x37f4('0x23')](handleEntityNotFound(_0x545fe0,null))['then'](respondWithResult(_0x545fe0,null))[_0x37f4('0x40')](handleError(_0x545fe0,null));};exports[_0x37f4('0x45')]=function(_0x5f285e,_0x17e2cf){return db[_0x37f4('0x2a')]['create'](_0x5f285e['body'],{})['then'](function(_0x545fdc){var _0x1afc17=_0x5f285e[_0x37f4('0x46')][_0x37f4('0x25')]({'plain':!![]});if(!_0x1afc17)throw new Error(_0x37f4('0x47'));if(_0x1afc17[_0x37f4('0x48')]===_0x37f4('0x46')){var _0x31fb3b=_0x545fdc[_0x37f4('0x25')]({'plain':!![]});var _0xf009ea=_0x37f4('0x49');return db[_0x37f4('0x4a')]['find']({'where':{'name':_0xf009ea,'userProfileId':_0x1afc17[_0x37f4('0x4b')]},'raw':!![]})[_0x37f4('0x23')](function(_0x3348fc){if(_0x3348fc&&_0x3348fc[_0x37f4('0x4c')]===0x0){return db[_0x37f4('0x4d')]['create']({'name':_0x31fb3b['name'],'resourceId':_0x31fb3b['id'],'type':_0x3348fc[_0x37f4('0x28')],'sectionId':_0x3348fc['id']},{})[_0x37f4('0x23')](function(){return _0x545fdc;});}else{return _0x545fdc;}})[_0x37f4('0x40')](function(_0x431a68){logger[_0x37f4('0x4e')](_0x37f4('0x4f'),_0x431a68);throw _0x431a68;});}return _0x545fdc;})[_0x37f4('0x23')](respondWithResult(_0x17e2cf,0xc9))[_0x37f4('0x40')](handleError(_0x17e2cf,null));};exports[_0x37f4('0x50')]=function(_0x141b91,_0xda8f17){if(_0x141b91[_0x37f4('0x51')]['id']){delete _0x141b91[_0x37f4('0x51')]['id'];}return db[_0x37f4('0x2a')][_0x37f4('0x44')]({'where':{'id':_0x141b91[_0x37f4('0x42')]['id']}})['then'](handleEntityNotFound(_0xda8f17,null))[_0x37f4('0x23')](saveUpdates(_0x141b91[_0x37f4('0x51')],null))['then'](respondWithResult(_0xda8f17,null))['catch'](handleError(_0xda8f17,null));};exports[_0x37f4('0x24')]=function(_0x3caad4,_0xe18279){return db[_0x37f4('0x2a')][_0x37f4('0x44')]({'where':{'id':_0x3caad4[_0x37f4('0x42')]['id']}})['then'](handleEntityNotFound(_0xe18279,null))['then'](removeEntity(_0xe18279,null))['catch'](handleError(_0xe18279,null));};exports[_0x37f4('0x52')]=function(_0x79e2a1,_0x117129,_0x47b3d5){return db['AnalyticExtractedReport'][_0x37f4('0x44')]({'where':{'id':_0x79e2a1[_0x37f4('0x42')]['id']},'attributes':['name',_0x37f4('0x53'),_0x37f4('0x54'),'output'],'raw':!![]})[_0x37f4('0x23')](handleEntityNotFound(_0x117129,null))[_0x37f4('0x23')](function(_0x28c258){if(_0x28c258){if(!fs[_0x37f4('0x55')](path[_0x37f4('0x56')](config[_0x37f4('0x57')],'server/files/reports',_0x28c258[_0x37f4('0x54')]))){throw new db[(_0x37f4('0x58'))][(_0x37f4('0x59'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x79e2a1[_0x37f4('0x2e')][_0x37f4('0x5a')]){return _0x117129[_0x37f4('0x1b')](0xc8);}return _0x117129['download'](path[_0x37f4('0x56')](config[_0x37f4('0x57')],_0x37f4('0x5b'),_0x28c258['savename']),util[_0x37f4('0x5c')](_0x37f4('0x5d'),_0x28c258[_0x37f4('0x53')]||_0x28c258[_0x37f4('0x28')],_0x28c258[_0x37f4('0x5e')][_0x37f4('0x5f')]()));}})[_0x37f4('0x40')](handleError(_0x117129,null));}; \ No newline at end of file +var _0xf4ea=['params','AnalyticExtractedReport','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','basename','join','root','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','ExtractedReports','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show'];(function(_0x57fda8,_0x5e80a0){var _0x11c895=function(_0xd08d0e){while(--_0xd08d0e){_0x57fda8['push'](_0x57fda8['shift']());}};_0x11c895(++_0x5e80a0);}(_0xf4ea,0x72));var _0xaf4e=function(_0x2d2885,_0x667d70){_0x2d2885=_0x2d2885-0x0;var _0x2cea6=_0xf4ea[_0x2d2885];return _0x2cea6;};'use strict';var emlformat=require(_0xaf4e('0x0'));var rimraf=require(_0xaf4e('0x1'));var zipdir=require(_0xaf4e('0x2'));var jsonpatch=require(_0xaf4e('0x3'));var rp=require(_0xaf4e('0x4'));var moment=require(_0xaf4e('0x5'));var BPromise=require(_0xaf4e('0x6'));var Mustache=require(_0xaf4e('0x7'));var util=require(_0xaf4e('0x8'));var path=require(_0xaf4e('0x9'));var sox=require(_0xaf4e('0xa'));var csv=require(_0xaf4e('0xb'));var ejs=require(_0xaf4e('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaf4e('0xd'));var jsforce=require(_0xaf4e('0xe'));var deskjs=require(_0xaf4e('0xf'));var toCsv=require(_0xaf4e('0xb'));var querystring=require(_0xaf4e('0x10'));var Papa=require(_0xaf4e('0x11'));var Redis=require(_0xaf4e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xaf4e('0x13'));var as=require(_0xaf4e('0x14'));var hardwareService=require(_0xaf4e('0x15'));var logger=require(_0xaf4e('0x16'))('api');var utils=require(_0xaf4e('0x17'));var config=require(_0xaf4e('0x18'));var licenseUtil=require(_0xaf4e('0x19'));var db=require(_0xaf4e('0x1a'))['db'];function respondWithStatusCode(_0x30d3ab,_0xe22f66){_0xe22f66=_0xe22f66||0xcc;return function(_0x1b806a){if(_0x1b806a){return _0x30d3ab[_0xaf4e('0x1b')](_0xe22f66);}return _0x30d3ab[_0xaf4e('0x1c')](_0xe22f66)[_0xaf4e('0x1d')]();};}function respondWithResult(_0x50c267,_0x5c85f7){_0x5c85f7=_0x5c85f7||0xc8;return function(_0x22634f){if(_0x22634f){return _0x50c267[_0xaf4e('0x1c')](_0x5c85f7)['json'](_0x22634f);}};}function respondWithFilteredResult(_0x613c15,_0x557e17){return function(_0x5f34b6){if(_0x5f34b6){var _0x144c9a=typeof _0x557e17[_0xaf4e('0x1e')]===_0xaf4e('0x1f')&&typeof _0x557e17[_0xaf4e('0x20')]==='undefined';var _0x643865=_0x5f34b6[_0xaf4e('0x21')];var _0x209351=_0x144c9a?0x0:_0x557e17[_0xaf4e('0x1e')];var _0x498921=_0x144c9a?_0x5f34b6[_0xaf4e('0x21')]:_0x557e17[_0xaf4e('0x1e')]+_0x557e17[_0xaf4e('0x20')];var _0x428df6;if(_0x498921>=_0x643865){_0x498921=_0x643865;_0x428df6=0xc8;}else{_0x428df6=0xce;}_0x613c15[_0xaf4e('0x1c')](_0x428df6);return _0x613c15[_0xaf4e('0x22')](_0xaf4e('0x23'),_0x209351+'-'+_0x498921+'/'+_0x643865)[_0xaf4e('0x24')](_0x5f34b6);}return null;};}function patchUpdates(_0x13c8b7){return function(_0x288381){try{jsonpatch['apply'](_0x288381,_0x13c8b7,!![]);}catch(_0x4997d8){return BPromise['reject'](_0x4997d8);}return _0x288381['save']();};}function saveUpdates(_0x550918,_0xcac193){return function(_0x5254dc){if(_0x5254dc){return _0x5254dc[_0xaf4e('0x25')](_0x550918)[_0xaf4e('0x26')](function(_0x3c91ed){return _0x3c91ed;});}return null;};}function removeEntity(_0x1ac236,_0x3f6145){return function(_0x266dff){if(_0x266dff){return _0x266dff['destroy']()[_0xaf4e('0x26')](function(){var _0x109d68=_0x266dff['get']({'plain':!![]});var _0x292a69=_0xaf4e('0x27');return db[_0xaf4e('0x28')][_0xaf4e('0x29')]({'where':{'type':_0x292a69,'resourceId':_0x109d68['id']}})[_0xaf4e('0x26')](function(){return _0x266dff;});})[_0xaf4e('0x26')](function(){_0x1ac236[_0xaf4e('0x1c')](0xcc)[_0xaf4e('0x1d')]();});}};}function handleEntityNotFound(_0x442a74,_0x50d31f){return function(_0x21852c){if(!_0x21852c){_0x442a74[_0xaf4e('0x1b')](0x194);}return _0x21852c;};}function handleError(_0x64b995,_0x44766b){_0x44766b=_0x44766b||0x1f4;return function(_0x432422){logger[_0xaf4e('0x2a')](_0x432422['stack']);if(_0x432422[_0xaf4e('0x2b')]){delete _0x432422[_0xaf4e('0x2b')];}_0x64b995['status'](_0x44766b)[_0xaf4e('0x2c')](_0x432422);};}exports[_0xaf4e('0x2d')]=function(_0x2052a6,_0x261632){var _0x48ee2c={},_0x200ea8={},_0x5bd581={'count':0x0,'rows':[]};var _0x219dde=_[_0xaf4e('0x2e')](db['AnalyticExtractedReport'][_0xaf4e('0x2f')],function(_0x405ef4){return{'name':_0x405ef4[_0xaf4e('0x30')],'type':_0x405ef4[_0xaf4e('0x31')][_0xaf4e('0x32')]};});_0x200ea8[_0xaf4e('0x33')]=_[_0xaf4e('0x2e')](_0x219dde,_0xaf4e('0x2b'));_0x200ea8[_0xaf4e('0x34')]=_[_0xaf4e('0x35')](_0x2052a6[_0xaf4e('0x34')]);_0x200ea8[_0xaf4e('0x36')]=_['intersection'](_0x200ea8['model'],_0x200ea8[_0xaf4e('0x34')]);_0x48ee2c[_0xaf4e('0x37')]=_[_0xaf4e('0x38')](_0x200ea8[_0xaf4e('0x33')],qs[_0xaf4e('0x39')](_0x2052a6[_0xaf4e('0x34')]['fields']));_0x48ee2c[_0xaf4e('0x37')]=_0x48ee2c['attributes'][_0xaf4e('0x3a')]?_0x48ee2c[_0xaf4e('0x37')]:_0x200ea8[_0xaf4e('0x33')];if(!_0x2052a6[_0xaf4e('0x34')]['hasOwnProperty'](_0xaf4e('0x3b'))){_0x48ee2c[_0xaf4e('0x20')]=qs[_0xaf4e('0x20')](_0x2052a6[_0xaf4e('0x34')][_0xaf4e('0x20')]);_0x48ee2c[_0xaf4e('0x1e')]=qs[_0xaf4e('0x1e')](_0x2052a6['query'][_0xaf4e('0x1e')]);}_0x48ee2c[_0xaf4e('0x3c')]=qs['sort'](_0x2052a6[_0xaf4e('0x34')][_0xaf4e('0x3d')]);_0x48ee2c[_0xaf4e('0x3e')]=qs[_0xaf4e('0x36')](_[_0xaf4e('0x3f')](_0x2052a6[_0xaf4e('0x34')],_0x200ea8[_0xaf4e('0x36')]),_0x219dde);if(_0x2052a6[_0xaf4e('0x34')][_0xaf4e('0x40')]){_0x48ee2c['where']=_[_0xaf4e('0x41')](_0x48ee2c[_0xaf4e('0x3e')],{'$or':_['map'](_0x219dde,function(_0x3d84d8){if(_0x3d84d8[_0xaf4e('0x31')]!==_0xaf4e('0x42')){var _0x1e2136={};_0x1e2136[_0x3d84d8[_0xaf4e('0x2b')]]={'$like':'%'+_0x2052a6[_0xaf4e('0x34')][_0xaf4e('0x40')]+'%'};return _0x1e2136;}})});}_0x48ee2c=_[_0xaf4e('0x41')]({},_0x48ee2c,_0x2052a6[_0xaf4e('0x43')]);var _0x47a3b6={'where':_0x48ee2c[_0xaf4e('0x3e')]};return db['AnalyticExtractedReport']['count'](_0x47a3b6)[_0xaf4e('0x26')](function(_0x54f370){_0x5bd581[_0xaf4e('0x21')]=_0x54f370;if(_0x2052a6['query'][_0xaf4e('0x44')]){_0x48ee2c['include']=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x48ee2c);})[_0xaf4e('0x26')](function(_0x1dc9e1){_0x5bd581[_0xaf4e('0x45')]=_0x1dc9e1;return _0x5bd581;})['then'](respondWithFilteredResult(_0x261632,_0x48ee2c))[_0xaf4e('0x46')](handleError(_0x261632,null));};exports[_0xaf4e('0x47')]=function(_0x2cd419,_0x377f80){var _0x2d254b={'raw':!![],'where':{'id':_0x2cd419[_0xaf4e('0x48')]['id']}},_0x53de24={};_0x53de24['model']=_['keys'](db[_0xaf4e('0x49')][_0xaf4e('0x2f')]);_0x53de24['query']=_[_0xaf4e('0x35')](_0x2cd419[_0xaf4e('0x34')]);_0x53de24[_0xaf4e('0x36')]=_[_0xaf4e('0x38')](_0x53de24[_0xaf4e('0x33')],_0x53de24[_0xaf4e('0x34')]);_0x2d254b[_0xaf4e('0x37')]=_[_0xaf4e('0x38')](_0x53de24['model'],qs[_0xaf4e('0x39')](_0x2cd419[_0xaf4e('0x34')][_0xaf4e('0x39')]));_0x2d254b[_0xaf4e('0x37')]=_0x2d254b[_0xaf4e('0x37')][_0xaf4e('0x3a')]?_0x2d254b[_0xaf4e('0x37')]:_0x53de24[_0xaf4e('0x33')];if(_0x2cd419['query'][_0xaf4e('0x44')]){_0x2d254b['include']=[{'all':!![]}];}_0x2d254b=_[_0xaf4e('0x41')]({},_0x2d254b,_0x2cd419[_0xaf4e('0x43')]);return db[_0xaf4e('0x49')][_0xaf4e('0x4a')](_0x2d254b)[_0xaf4e('0x26')](handleEntityNotFound(_0x377f80,null))[_0xaf4e('0x26')](respondWithResult(_0x377f80,null))[_0xaf4e('0x46')](handleError(_0x377f80,null));};exports['create']=function(_0xb1be38,_0x4f989d){return db['AnalyticExtractedReport'][_0xaf4e('0x4b')](_0xb1be38[_0xaf4e('0x4c')],{})[_0xaf4e('0x26')](function(_0x5bd666){var _0x399776=_0xb1be38[_0xaf4e('0x4d')][_0xaf4e('0x4e')]({'plain':!![]});if(!_0x399776)throw new Error(_0xaf4e('0x4f'));if(_0x399776[_0xaf4e('0x50')]===_0xaf4e('0x4d')){var _0x26402b=_0x5bd666[_0xaf4e('0x4e')]({'plain':!![]});var _0x323c4b=_0xaf4e('0x27');return db['UserProfileSection'][_0xaf4e('0x4a')]({'where':{'name':_0x323c4b,'userProfileId':_0x399776[_0xaf4e('0x51')]},'raw':!![]})[_0xaf4e('0x26')](function(_0x2e02cc){if(_0x2e02cc&&_0x2e02cc[_0xaf4e('0x52')]===0x0){return db[_0xaf4e('0x28')][_0xaf4e('0x4b')]({'name':_0x26402b[_0xaf4e('0x2b')],'resourceId':_0x26402b['id'],'type':_0x2e02cc[_0xaf4e('0x2b')],'sectionId':_0x2e02cc['id']},{})[_0xaf4e('0x26')](function(){return _0x5bd666;});}else{return _0x5bd666;}})[_0xaf4e('0x46')](function(_0x5abe8f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5abe8f);throw _0x5abe8f;});}return _0x5bd666;})[_0xaf4e('0x26')](respondWithResult(_0x4f989d,0xc9))[_0xaf4e('0x46')](handleError(_0x4f989d,null));};exports[_0xaf4e('0x25')]=function(_0x31e544,_0x5bdf0a){if(_0x31e544[_0xaf4e('0x4c')]['id']){delete _0x31e544[_0xaf4e('0x4c')]['id'];}return db[_0xaf4e('0x49')][_0xaf4e('0x4a')]({'where':{'id':_0x31e544[_0xaf4e('0x48')]['id']}})['then'](handleEntityNotFound(_0x5bdf0a,null))[_0xaf4e('0x26')](saveUpdates(_0x31e544[_0xaf4e('0x4c')],null))[_0xaf4e('0x26')](respondWithResult(_0x5bdf0a,null))['catch'](handleError(_0x5bdf0a,null));};exports['destroy']=function(_0x4e5e2e,_0x18bd1b){return db[_0xaf4e('0x49')][_0xaf4e('0x4a')]({'where':{'id':_0x4e5e2e[_0xaf4e('0x48')]['id']}})[_0xaf4e('0x26')](handleEntityNotFound(_0x18bd1b,null))[_0xaf4e('0x26')](removeEntity(_0x18bd1b,null))[_0xaf4e('0x46')](handleError(_0x18bd1b,null));};exports['download']=function(_0x4856b2,_0x1616f5,_0x2d93f2){return db[_0xaf4e('0x49')]['find']({'where':{'id':_0x4856b2[_0xaf4e('0x48')]['id']},'attributes':['name',_0xaf4e('0x53'),'savename','output'],'raw':!![]})[_0xaf4e('0x26')](handleEntityNotFound(_0x1616f5,null))[_0xaf4e('0x26')](function(_0x1284c4){if(_0x1284c4){if(!fs['existsSync'](path[_0xaf4e('0x54')](config[_0xaf4e('0x55')],'server/files/reports',_0x1284c4[_0xaf4e('0x56')]))){throw new db[(_0xaf4e('0x57'))]['ValidationError'](_0xaf4e('0x58'));}if(_0x4856b2[_0xaf4e('0x34')][_0xaf4e('0x59')]){return _0x1616f5[_0xaf4e('0x1b')](0xc8);}return _0x1616f5['download'](path[_0xaf4e('0x54')](config['root'],_0xaf4e('0x5a'),_0x1284c4[_0xaf4e('0x56')]),util['format']('%s.%s',_0x1284c4['basename']||_0x1284c4[_0xaf4e('0x2b')],_0x1284c4[_0xaf4e('0x5b')][_0xaf4e('0x5c')]()));}})[_0xaf4e('0x46')](handleError(_0x1616f5,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 11a1bb6..87642e5 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 _0xdc50=['rimraf','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3e9695,_0x2657a2){var _0x15a2df=function(_0x4906cd){while(--_0x4906cd){_0x3e9695['push'](_0x3e9695['shift']());}};_0x15a2df(++_0x2657a2);}(_0xdc50,0x166));var _0x0dc5=function(_0x569f22,_0x53c4fa){_0x569f22=_0x569f22-0x0;var _0x50f1f8=_0xdc50[_0x569f22];return _0x50f1f8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0dc5('0x0'))(_0x0dc5('0x1'));var moment=require('moment');var BPromise=require(_0x0dc5('0x2'));var rp=require(_0x0dc5('0x3'));var fs=require('fs');var path=require(_0x0dc5('0x4'));var rimraf=require(_0x0dc5('0x5'));var config=require('../../config/environment');var attributes=require(_0x0dc5('0x6'));module[_0x0dc5('0x7')]=function(_0x16919e,_0x2a15fc){return _0x16919e[_0x0dc5('0x8')](_0x0dc5('0x9'),attributes,{'tableName':_0x0dc5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45fd=['analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticExtractedReport'];(function(_0x46c79f,_0x13e5ba){var _0x4b5cad=function(_0x3f5c30){while(--_0x3f5c30){_0x46c79f['push'](_0x46c79f['shift']());}};_0x4b5cad(++_0x13e5ba);}(_0x45fd,0xef));var _0xd45f=function(_0x1e9273,_0x48ee6d){_0x1e9273=_0x1e9273-0x0;var _0x3187f8=_0x45fd[_0x1e9273];return _0x3187f8;};'use strict';var _=require(_0xd45f('0x0'));var util=require(_0xd45f('0x1'));var logger=require(_0xd45f('0x2'))(_0xd45f('0x3'));var moment=require(_0xd45f('0x4'));var BPromise=require(_0xd45f('0x5'));var rp=require(_0xd45f('0x6'));var fs=require('fs');var path=require(_0xd45f('0x7'));var rimraf=require(_0xd45f('0x8'));var config=require(_0xd45f('0x9'));var attributes=require('./analyticExtractedReport.attributes');module[_0xd45f('0xa')]=function(_0x4c9261,_0x4cf83b){return _0x4c9261[_0xd45f('0xb')](_0xd45f('0xc'),attributes,{'tableName':_0xd45f('0xd'),'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 86c773c..3ebdc14 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 _0x04ad=['message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1966f3,_0x210ea3){var _0x17575f=function(_0x7b18fb){while(--_0x7b18fb){_0x1966f3['push'](_0x1966f3['shift']());}};_0x17575f(++_0x210ea3);}(_0x04ad,0x1b9));var _0xd04a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x04ad[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd04a('0x0'));var util=require('util');var moment=require(_0xd04a('0x1'));var BPromise=require(_0xd04a('0x2'));var rs=require(_0xd04a('0x3'));var fs=require('fs');var Redis=require(_0xd04a('0x4'));var db=require(_0xd04a('0x5'))['db'];var utils=require(_0xd04a('0x6'));var logger=require('../../config/logger')(_0xd04a('0x7'));var config=require('../../config/environment');var jayson=require(_0xd04a('0x8'));var client=jayson[_0xd04a('0x9')][_0xd04a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c77e0,_0x1b2f06,_0x2413de){return new BPromise(function(_0x27cf60,_0x2893ce){return client[_0xd04a('0xb')](_0x1c77e0,_0x2413de)[_0xd04a('0xc')](function(_0x5b6a26){logger[_0xd04a('0xd')](_0xd04a('0xe'),_0x1b2f06,_0xd04a('0xf'));logger[_0xd04a('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x1b2f06,_0xd04a('0xf'),JSON[_0xd04a('0x11')](_0x5b6a26));if(_0x5b6a26['error']){if(_0x5b6a26[_0xd04a('0x12')]['code']===0x1f4){logger[_0xd04a('0x12')](_0xd04a('0xe'),_0x1b2f06,_0x5b6a26[_0xd04a('0x12')][_0xd04a('0x13')]);return _0x2893ce(_0x5b6a26[_0xd04a('0x12')][_0xd04a('0x13')]);}logger[_0xd04a('0x12')](_0xd04a('0xe'),_0x1b2f06,_0x5b6a26[_0xd04a('0x12')][_0xd04a('0x13')]);return _0x27cf60(_0x5b6a26[_0xd04a('0x12')][_0xd04a('0x13')]);}else{logger[_0xd04a('0xd')](_0xd04a('0xe'),_0x1b2f06,_0xd04a('0xf'));_0x27cf60(_0x5b6a26['result']['message']);}})['catch'](function(_0x328b65){logger['error'](_0xd04a('0xe'),_0x1b2f06,_0x328b65);_0x2893ce(_0x328b65);});});} \ No newline at end of file +var _0xd60e=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x34aaff,_0x19d822){var _0x390093=function(_0x515ba0){while(--_0x515ba0){_0x34aaff['push'](_0x34aaff['shift']());}};_0x390093(++_0x19d822);}(_0xd60e,0x1d6));var _0xed60=function(_0x3e4b35,_0xaf563f){_0x3e4b35=_0x3e4b35-0x0;var _0x23289b=_0xd60e[_0x3e4b35];return _0x23289b;};'use strict';var _=require(_0xed60('0x0'));var util=require(_0xed60('0x1'));var moment=require(_0xed60('0x2'));var BPromise=require('bluebird');var rs=require(_0xed60('0x3'));var fs=require('fs');var Redis=require(_0xed60('0x4'));var db=require(_0xed60('0x5'))['db'];var utils=require(_0xed60('0x6'));var logger=require(_0xed60('0x7'))(_0xed60('0x8'));var config=require('../../config/environment');var jayson=require(_0xed60('0x9'));var client=jayson['client'][_0xed60('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37a5cb,_0x42bca1,_0x962cf1){return new BPromise(function(_0x1b0401,_0x3a3f74){return client[_0xed60('0xb')](_0x37a5cb,_0x962cf1)[_0xed60('0xc')](function(_0x38babe){logger[_0xed60('0xd')](_0xed60('0xe'),_0x42bca1,_0xed60('0xf'));logger['debug'](_0xed60('0x10'),_0x42bca1,_0xed60('0xf'),JSON[_0xed60('0x11')](_0x38babe));if(_0x38babe['error']){if(_0x38babe['error'][_0xed60('0x12')]===0x1f4){logger[_0xed60('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x42bca1,_0x38babe[_0xed60('0x13')][_0xed60('0x14')]);return _0x3a3f74(_0x38babe[_0xed60('0x13')][_0xed60('0x14')]);}logger[_0xed60('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x42bca1,_0x38babe['error']['message']);return _0x1b0401(_0x38babe[_0xed60('0x13')][_0xed60('0x14')]);}else{logger[_0xed60('0xd')](_0xed60('0xe'),_0x42bca1,_0xed60('0xf'));_0x1b0401(_0x38babe[_0xed60('0x15')][_0xed60('0x14')]);}})[_0xed60('0x16')](function(_0x64ecb){logger[_0xed60('0x13')](_0xed60('0xe'),_0x42bca1,_0x64ecb);_0x3a3f74(_0x64ecb);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index c92d584..a16af34 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 _0x7781=['post','create','put','update','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','show','download'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7781,0x16f));var _0x1778=function(_0x3b1892,_0x3af7ff){_0x3b1892=_0x3b1892-0x0;var _0x2b8bef=_0x7781[_0x3b1892];return _0x2b8bef;};'use strict';var multer=require(_0x1778('0x0'));var util=require(_0x1778('0x1'));var path=require('path');var timeout=require(_0x1778('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1778('0x3'));var auth=require(_0x1778('0x4'));var interaction=require(_0x1778('0x5'));var config=require('../../config/environment');var controller=require(_0x1778('0x6'));router['get']('/',auth[_0x1778('0x7')](),controller[_0x1778('0x8')]);router[_0x1778('0x9')](_0x1778('0xa'),auth[_0x1778('0x7')](),controller[_0x1778('0xb')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x1778('0xc')]);router[_0x1778('0xd')]('/',auth[_0x1778('0x7')](),controller[_0x1778('0xe')]);router[_0x1778('0xf')](_0x1778('0xa'),auth[_0x1778('0x7')](),controller[_0x1778('0x10')]);router[_0x1778('0x11')](_0x1778('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1778('0x12')]=router; \ No newline at end of file +var _0x4b53=['create','put','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','post'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x4b53,0x116));var _0x34b5=function(_0x3c572c,_0x1c79cc){_0x3c572c=_0x3c572c-0x0;var _0x2766bc=_0x4b53[_0x3c572c];return _0x2766bc;};'use strict';var multer=require('multer');var util=require(_0x34b5('0x0'));var path=require(_0x34b5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x34b5('0x2')]();var fs_extra=require(_0x34b5('0x3'));var auth=require(_0x34b5('0x4'));var interaction=require(_0x34b5('0x5'));var config=require(_0x34b5('0x6'));var controller=require(_0x34b5('0x7'));router['get']('/',auth[_0x34b5('0x8')](),controller[_0x34b5('0x9')]);router[_0x34b5('0xa')](_0x34b5('0xb'),auth[_0x34b5('0x8')](),controller[_0x34b5('0xc')]);router[_0x34b5('0xa')](_0x34b5('0xd'),auth[_0x34b5('0x8')](),controller[_0x34b5('0xe')]);router[_0x34b5('0xf')]('/',auth[_0x34b5('0x8')](),controller[_0x34b5('0x10')]);router[_0x34b5('0x11')](_0x34b5('0xb'),auth[_0x34b5('0x8')](),controller['update']);router[_0x34b5('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x34b5('0x13')]);module[_0x34b5('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index da70b41..ec997ac 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 _0xfa37=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x2f3325,_0x53a82c){var _0x326a15=function(_0x5eb262){while(--_0x5eb262){_0x2f3325['push'](_0x2f3325['shift']());}};_0x326a15(++_0x53a82c);}(_0xfa37,0x12a));var _0x7fa3=function(_0x2509e9,_0x450c2e){_0x2509e9=_0x2509e9-0x0;var _0x4f5621=_0xfa37[_0x2509e9];return _0x4f5621;};'use strict';var Sequelize=require(_0x7fa3('0x0'));module[_0x7fa3('0x1')]={'field':{'type':Sequelize[_0x7fa3('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x7fa3('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x7fa3('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x7fa3('0x3')]},'custom':{'type':Sequelize[_0x7fa3('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x276b=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x270774,_0x3863f2){var _0x21583c=function(_0x4ec71a){while(--_0x4ec71a){_0x270774['push'](_0x270774['shift']());}};_0x21583c(++_0x3863f2);}(_0x276b,0x1e4));var _0xb276=function(_0x45fefc,_0x3a077f){_0x45fefc=_0x45fefc-0x0;var _0x6b31ef=_0x276b[_0x45fefc];return _0x6b31ef;};'use strict';var Sequelize=require(_0xb276('0x0'));module['exports']={'field':{'type':Sequelize[_0xb276('0x1')]},'alias':{'type':Sequelize[_0xb276('0x2')]},'function':{'type':Sequelize[_0xb276('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xb276('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xb276('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 c3f7cb1..4ae31f8 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 _0xa98f=['update','then','destroy','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','findAll','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save'];(function(_0x1f2be7,_0x55f91b){var _0x221ec6=function(_0x469e26){while(--_0x469e26){_0x1f2be7['push'](_0x1f2be7['shift']());}};_0x221ec6(++_0x55f91b);}(_0xa98f,0x1c9));var _0xfa98=function(_0xdd50f7,_0x7fdc20){_0xdd50f7=_0xdd50f7-0x0;var _0x2be739=_0xa98f[_0xdd50f7];return _0x2be739;};'use strict';var emlformat=require(_0xfa98('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfa98('0x1'));var rp=require(_0xfa98('0x2'));var moment=require('moment');var BPromise=require(_0xfa98('0x3'));var Mustache=require(_0xfa98('0x4'));var util=require(_0xfa98('0x5'));var path=require(_0xfa98('0x6'));var sox=require(_0xfa98('0x7'));var csv=require(_0xfa98('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa98('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfa98('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfa98('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfa98('0xc'));var Redis=require(_0xfa98('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xfa98('0xe'));var as=require(_0xfa98('0xf'));var hardwareService=require(_0xfa98('0x10'));var logger=require(_0xfa98('0x11'))(_0xfa98('0x12'));var utils=require('../../config/utils');var config=require(_0xfa98('0x13'));var licenseUtil=require(_0xfa98('0x14'));var db=require(_0xfa98('0x15'))['db'];function respondWithStatusCode(_0x3b9e84,_0x389788){_0x389788=_0x389788||0xcc;return function(_0x23b1e1){if(_0x23b1e1){return _0x3b9e84[_0xfa98('0x16')](_0x389788);}return _0x3b9e84['status'](_0x389788)[_0xfa98('0x17')]();};}function respondWithResult(_0x1fe1a4,_0xddcb84){_0xddcb84=_0xddcb84||0xc8;return function(_0x4ab1e0){if(_0x4ab1e0){return _0x1fe1a4[_0xfa98('0x18')](_0xddcb84)[_0xfa98('0x19')](_0x4ab1e0);}};}function respondWithFilteredResult(_0x46d536,_0x2d68c5){return function(_0x587071){if(_0x587071){var _0x31eb09=typeof _0x2d68c5['offset']===_0xfa98('0x1a')&&typeof _0x2d68c5[_0xfa98('0x1b')]===_0xfa98('0x1a');var _0xbf363c=_0x587071[_0xfa98('0x1c')];var _0x54963d=_0x31eb09?0x0:_0x2d68c5['offset'];var _0x2fac2c=_0x31eb09?_0x587071[_0xfa98('0x1c')]:_0x2d68c5[_0xfa98('0x1d')]+_0x2d68c5['limit'];var _0x3590c;if(_0x2fac2c>=_0xbf363c){_0x2fac2c=_0xbf363c;_0x3590c=0xc8;}else{_0x3590c=0xce;}_0x46d536[_0xfa98('0x18')](_0x3590c);return _0x46d536[_0xfa98('0x1e')](_0xfa98('0x1f'),_0x54963d+'-'+_0x2fac2c+'/'+_0xbf363c)[_0xfa98('0x19')](_0x587071);}return null;};}function patchUpdates(_0x267421){return function(_0x4007bd){try{jsonpatch[_0xfa98('0x20')](_0x4007bd,_0x267421,!![]);}catch(_0x2e1b1c){return BPromise[_0xfa98('0x21')](_0x2e1b1c);}return _0x4007bd[_0xfa98('0x22')]();};}function saveUpdates(_0x1cee0f,_0x4463c3){return function(_0x241c97){if(_0x241c97){return _0x241c97[_0xfa98('0x23')](_0x1cee0f)[_0xfa98('0x24')](function(_0x4968d2){return _0x4968d2;});}return null;};}function removeEntity(_0x19c2cf,_0x332127){return function(_0x68587){if(_0x68587){return _0x68587[_0xfa98('0x25')]()[_0xfa98('0x24')](function(){_0x19c2cf['status'](0xcc)[_0xfa98('0x17')]();});}};}function handleEntityNotFound(_0x1b4d4f,_0x11249d){return function(_0x2e3ac0){if(!_0x2e3ac0){_0x1b4d4f[_0xfa98('0x16')](0x194);}return _0x2e3ac0;};}function handleError(_0x1485b,_0x54fdb7){_0x54fdb7=_0x54fdb7||0x1f4;return function(_0x4f4d45){logger[_0xfa98('0x26')](_0x4f4d45[_0xfa98('0x27')]);if(_0x4f4d45[_0xfa98('0x28')]){delete _0x4f4d45[_0xfa98('0x28')];}_0x1485b[_0xfa98('0x18')](_0x54fdb7)[_0xfa98('0x29')](_0x4f4d45);};}exports['index']=function(_0x280bfa,_0x1ef80d){var _0x489f35={},_0xc734d5={},_0x4f144c={'count':0x0,'rows':[]};var _0x5865d3=_[_0xfa98('0x2a')](db[_0xfa98('0x2b')][_0xfa98('0x2c')],function(_0xba5d7){return{'name':_0xba5d7[_0xfa98('0x2d')],'type':_0xba5d7[_0xfa98('0x2e')]['key']};});_0xc734d5[_0xfa98('0x2f')]=_[_0xfa98('0x2a')](_0x5865d3,'name');_0xc734d5[_0xfa98('0x30')]=_[_0xfa98('0x31')](_0x280bfa[_0xfa98('0x30')]);_0xc734d5['filters']=_[_0xfa98('0x32')](_0xc734d5[_0xfa98('0x2f')],_0xc734d5[_0xfa98('0x30')]);_0x489f35[_0xfa98('0x33')]=_[_0xfa98('0x32')](_0xc734d5[_0xfa98('0x2f')],qs[_0xfa98('0x34')](_0x280bfa[_0xfa98('0x30')][_0xfa98('0x34')]));_0x489f35[_0xfa98('0x33')]=_0x489f35[_0xfa98('0x33')][_0xfa98('0x35')]?_0x489f35[_0xfa98('0x33')]:_0xc734d5[_0xfa98('0x2f')];if(!_0x280bfa[_0xfa98('0x30')][_0xfa98('0x36')](_0xfa98('0x37'))){_0x489f35[_0xfa98('0x1b')]=qs['limit'](_0x280bfa['query'][_0xfa98('0x1b')]);_0x489f35[_0xfa98('0x1d')]=qs[_0xfa98('0x1d')](_0x280bfa[_0xfa98('0x30')]['offset']);}_0x489f35[_0xfa98('0x38')]=qs[_0xfa98('0x39')](_0x280bfa[_0xfa98('0x30')]['sort']);_0x489f35['where']=qs['filters'](_[_0xfa98('0x3a')](_0x280bfa[_0xfa98('0x30')],_0xc734d5[_0xfa98('0x3b')]),_0x5865d3);if(_0x280bfa[_0xfa98('0x30')][_0xfa98('0x3c')]){_0x489f35[_0xfa98('0x3d')]=_['merge'](_0x489f35[_0xfa98('0x3d')],{'$or':_['map'](_0x5865d3,function(_0x165d44){if(_0x165d44[_0xfa98('0x2e')]!==_0xfa98('0x3e')){var _0x2f301b={};_0x2f301b[_0x165d44[_0xfa98('0x28')]]={'$like':'%'+_0x280bfa['query'][_0xfa98('0x3c')]+'%'};return _0x2f301b;}})});}_0x489f35=_['merge']({},_0x489f35,_0x280bfa[_0xfa98('0x3f')]);var _0x132de0={'where':_0x489f35[_0xfa98('0x3d')]};return db[_0xfa98('0x2b')]['count'](_0x132de0)['then'](function(_0x592307){_0x4f144c['count']=_0x592307;if(_0x280bfa[_0xfa98('0x30')][_0xfa98('0x40')]){_0x489f35[_0xfa98('0x41')]=[{'all':!![]}];}return db[_0xfa98('0x2b')]['findAll'](_0x489f35);})['then'](function(_0x45fe84){_0x4f144c[_0xfa98('0x42')]=_0x45fe84;return _0x4f144c;})['then'](respondWithFilteredResult(_0x1ef80d,_0x489f35))[_0xfa98('0x43')](handleError(_0x1ef80d,null));};exports[_0xfa98('0x44')]=function(_0x58b5c8,_0x374a20){var _0x24be15={'raw':![],'where':{'id':_0x58b5c8[_0xfa98('0x45')]['id']}},_0x48b14f={};_0x48b14f[_0xfa98('0x2f')]=_['keys'](db[_0xfa98('0x2b')][_0xfa98('0x2c')]);_0x48b14f[_0xfa98('0x30')]=_[_0xfa98('0x31')](_0x58b5c8[_0xfa98('0x30')]);_0x48b14f['filters']=_[_0xfa98('0x32')](_0x48b14f[_0xfa98('0x2f')],_0x48b14f['query']);_0x24be15[_0xfa98('0x33')]=_[_0xfa98('0x32')](_0x48b14f[_0xfa98('0x2f')],qs['fields'](_0x58b5c8[_0xfa98('0x30')][_0xfa98('0x34')]));_0x24be15[_0xfa98('0x33')]=_0x24be15[_0xfa98('0x33')][_0xfa98('0x35')]?_0x24be15[_0xfa98('0x33')]:_0x48b14f[_0xfa98('0x2f')];if(_0x58b5c8[_0xfa98('0x30')][_0xfa98('0x40')]){_0x24be15['include']=[{'all':!![]}];}_0x24be15=_[_0xfa98('0x46')]({},_0x24be15,_0x58b5c8[_0xfa98('0x3f')]);return db[_0xfa98('0x2b')][_0xfa98('0x47')](_0x24be15)[_0xfa98('0x24')](handleEntityNotFound(_0x374a20,null))[_0xfa98('0x24')](respondWithResult(_0x374a20,null))[_0xfa98('0x43')](handleError(_0x374a20,null));};exports[_0xfa98('0x48')]=function(_0x37a24a,_0x44a842){return db['AnalyticFieldReport']['create'](_0x37a24a[_0xfa98('0x49')],{})[_0xfa98('0x24')](respondWithResult(_0x44a842,0xc9))[_0xfa98('0x43')](handleError(_0x44a842,null));};exports[_0xfa98('0x4a')]=function(_0x52601d,_0x91c955){return db[_0xfa98('0x2b')]['bulkCreate'](_0x52601d[_0xfa98('0x49')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x91c955,0xc9))[_0xfa98('0x43')](handleError(_0x91c955,null));};exports[_0xfa98('0x23')]=function(_0x1e3c72,_0x25334f){if(_0x1e3c72[_0xfa98('0x49')]['id']){delete _0x1e3c72[_0xfa98('0x49')]['id'];}return db[_0xfa98('0x2b')][_0xfa98('0x47')]({'where':{'id':_0x1e3c72[_0xfa98('0x45')]['id']}})[_0xfa98('0x24')](handleEntityNotFound(_0x25334f,null))['then'](saveUpdates(_0x1e3c72['body'],null))[_0xfa98('0x24')](respondWithResult(_0x25334f,null))[_0xfa98('0x43')](handleError(_0x25334f,null));};exports[_0xfa98('0x25')]=function(_0x371f43,_0x28fd19){return db['AnalyticFieldReport'][_0xfa98('0x47')]({'where':{'id':_0x371f43[_0xfa98('0x45')]['id']}})[_0xfa98('0x24')](handleEntityNotFound(_0x28fd19,null))[_0xfa98('0x24')](removeEntity(_0x28fd19,null))['catch'](handleError(_0x28fd19,null));};exports[_0xfa98('0x4b')]=function(_0x3feb02,_0x1f896b){return db[_0xfa98('0x2b')][_0xfa98('0x25')]({'where':{'id':_0x3feb02[_0xfa98('0x30')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xfa98('0x24')](respondWithResult(_0x1f896b,0xcc))[_0xfa98('0x43')](handleError(_0x1f896b,null));};exports[_0xfa98('0x4c')]=function(_0x2887ba,_0x48ab9f,_0x3d8fc2){return db[_0xfa98('0x4d')][_0xfa98('0x4e')]({'where':{'id':_0x2887ba[_0xfa98('0x45')]['id']}})['then'](handleEntityNotFound(_0x48ab9f,null))[_0xfa98('0x24')](function(_0x1e702c){if(_0x1e702c){return db[_0xfa98('0x4f')][_0xfa98('0x50')](function(_0x2975bc){return db[_0xfa98('0x2b')]['destroy']({'where':{'CustomReportId':_0x2887ba[_0xfa98('0x45')]['id']},'transaction':_0x2975bc})[_0xfa98('0x24')](function(_0x52233c){var _0x3fb329=_[_0xfa98('0x2a')](_0x2887ba[_0xfa98('0x49')],function(_0x415954){delete _0x415954['id'];_0x415954['CustomReportId']=_0x2887ba[_0xfa98('0x45')]['id'];return _0x415954;});return db[_0xfa98('0x2b')][_0xfa98('0x4a')](_0x3fb329,{'transaction':_0x2975bc});});})[_0xfa98('0x24')](function(){return db[_0xfa98('0x2b')][_0xfa98('0x51')]({'where':{'CustomReportId':_0x2887ba[_0xfa98('0x45')]['id']}});});}})['then'](respondWithResult(_0x48ab9f,null))[_0xfa98('0x43')](handleError(_0x48ab9f,null));}; \ No newline at end of file +var _0x7ded=['model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','keys','length','find','catch','body','bulkCreate','bulkDestroy','ids','addFields','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type'];(function(_0x593bf9,_0x3cc8e){var _0x3e0a31=function(_0x55f593){while(--_0x55f593){_0x593bf9['push'](_0x593bf9['shift']());}};_0x3e0a31(++_0x3cc8e);}(_0x7ded,0x170));var _0xd7de=function(_0x5b8c92,_0x5cc8bf){_0x5b8c92=_0x5b8c92-0x0;var _0x4d6213=_0x7ded[_0x5b8c92];return _0x4d6213;};'use strict';var emlformat=require(_0xd7de('0x0'));var rimraf=require(_0xd7de('0x1'));var zipdir=require(_0xd7de('0x2'));var jsonpatch=require(_0xd7de('0x3'));var rp=require(_0xd7de('0x4'));var moment=require(_0xd7de('0x5'));var BPromise=require(_0xd7de('0x6'));var Mustache=require(_0xd7de('0x7'));var util=require(_0xd7de('0x8'));var path=require(_0xd7de('0x9'));var sox=require(_0xd7de('0xa'));var csv=require(_0xd7de('0xb'));var ejs=require(_0xd7de('0xc'));var fs=require('fs');var fs_extra=require(_0xd7de('0xd'));var _=require(_0xd7de('0xe'));var squel=require(_0xd7de('0xf'));var crypto=require(_0xd7de('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xd7de('0x11'));var toCsv=require(_0xd7de('0xb'));var querystring=require(_0xd7de('0x12'));var Papa=require(_0xd7de('0x13'));var Redis=require('ioredis');var authService=require(_0xd7de('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd7de('0x15'));var hardwareService=require(_0xd7de('0x16'));var logger=require(_0xd7de('0x17'))(_0xd7de('0x18'));var utils=require(_0xd7de('0x19'));var config=require(_0xd7de('0x1a'));var licenseUtil=require(_0xd7de('0x1b'));var db=require(_0xd7de('0x1c'))['db'];function respondWithStatusCode(_0x127ed1,_0x52a842){_0x52a842=_0x52a842||0xcc;return function(_0x4282be){if(_0x4282be){return _0x127ed1[_0xd7de('0x1d')](_0x52a842);}return _0x127ed1[_0xd7de('0x1e')](_0x52a842)[_0xd7de('0x1f')]();};}function respondWithResult(_0x45a98d,_0xb08fcf){_0xb08fcf=_0xb08fcf||0xc8;return function(_0x2bc22d){if(_0x2bc22d){return _0x45a98d[_0xd7de('0x1e')](_0xb08fcf)[_0xd7de('0x20')](_0x2bc22d);}};}function respondWithFilteredResult(_0xcefe1f,_0x52e837){return function(_0x186ddb){if(_0x186ddb){var _0x1aaaef=typeof _0x52e837[_0xd7de('0x21')]==='undefined'&&typeof _0x52e837[_0xd7de('0x22')]===_0xd7de('0x23');var _0x402e99=_0x186ddb['count'];var _0x2c8820=_0x1aaaef?0x0:_0x52e837['offset'];var _0x6e314c=_0x1aaaef?_0x186ddb['count']:_0x52e837[_0xd7de('0x21')]+_0x52e837['limit'];var _0x42961a;if(_0x6e314c>=_0x402e99){_0x6e314c=_0x402e99;_0x42961a=0xc8;}else{_0x42961a=0xce;}_0xcefe1f[_0xd7de('0x1e')](_0x42961a);return _0xcefe1f[_0xd7de('0x24')](_0xd7de('0x25'),_0x2c8820+'-'+_0x6e314c+'/'+_0x402e99)[_0xd7de('0x20')](_0x186ddb);}return null;};}function patchUpdates(_0x1adcf7){return function(_0x68591c){try{jsonpatch[_0xd7de('0x26')](_0x68591c,_0x1adcf7,!![]);}catch(_0x4e66bd){return BPromise['reject'](_0x4e66bd);}return _0x68591c[_0xd7de('0x27')]();};}function saveUpdates(_0x25c992,_0x3ad977){return function(_0x411e3d){if(_0x411e3d){return _0x411e3d[_0xd7de('0x28')](_0x25c992)[_0xd7de('0x29')](function(_0x514678){return _0x514678;});}return null;};}function removeEntity(_0x2e71c5,_0x328600){return function(_0x1eb29e){if(_0x1eb29e){return _0x1eb29e[_0xd7de('0x2a')]()[_0xd7de('0x29')](function(){_0x2e71c5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf1a826,_0x3255be){return function(_0x527b63){if(!_0x527b63){_0xf1a826[_0xd7de('0x1d')](0x194);}return _0x527b63;};}function handleError(_0x3dcb95,_0x59cd8d){_0x59cd8d=_0x59cd8d||0x1f4;return function(_0x1b04a3){logger[_0xd7de('0x2b')](_0x1b04a3[_0xd7de('0x2c')]);if(_0x1b04a3[_0xd7de('0x2d')]){delete _0x1b04a3[_0xd7de('0x2d')];}_0x3dcb95['status'](_0x59cd8d)['send'](_0x1b04a3);};}exports[_0xd7de('0x2e')]=function(_0x5a5f90,_0x2865cf){var _0x5c8ec2={},_0x3a2f38={},_0x472dd3={'count':0x0,'rows':[]};var _0x33846d=_[_0xd7de('0x2f')](db[_0xd7de('0x30')][_0xd7de('0x31')],function(_0xdb68cb){return{'name':_0xdb68cb[_0xd7de('0x32')],'type':_0xdb68cb[_0xd7de('0x33')]['key']};});_0x3a2f38[_0xd7de('0x34')]=_[_0xd7de('0x2f')](_0x33846d,_0xd7de('0x2d'));_0x3a2f38[_0xd7de('0x35')]=_['keys'](_0x5a5f90[_0xd7de('0x35')]);_0x3a2f38[_0xd7de('0x36')]=_['intersection'](_0x3a2f38[_0xd7de('0x34')],_0x3a2f38[_0xd7de('0x35')]);_0x5c8ec2[_0xd7de('0x37')]=_[_0xd7de('0x38')](_0x3a2f38[_0xd7de('0x34')],qs[_0xd7de('0x39')](_0x5a5f90[_0xd7de('0x35')][_0xd7de('0x39')]));_0x5c8ec2[_0xd7de('0x37')]=_0x5c8ec2[_0xd7de('0x37')]['length']?_0x5c8ec2['attributes']:_0x3a2f38[_0xd7de('0x34')];if(!_0x5a5f90[_0xd7de('0x35')][_0xd7de('0x3a')](_0xd7de('0x3b'))){_0x5c8ec2[_0xd7de('0x22')]=qs[_0xd7de('0x22')](_0x5a5f90[_0xd7de('0x35')][_0xd7de('0x22')]);_0x5c8ec2['offset']=qs[_0xd7de('0x21')](_0x5a5f90[_0xd7de('0x35')][_0xd7de('0x21')]);}_0x5c8ec2[_0xd7de('0x3c')]=qs[_0xd7de('0x3d')](_0x5a5f90['query'][_0xd7de('0x3d')]);_0x5c8ec2[_0xd7de('0x3e')]=qs['filters'](_[_0xd7de('0x3f')](_0x5a5f90[_0xd7de('0x35')],_0x3a2f38['filters']),_0x33846d);if(_0x5a5f90[_0xd7de('0x35')][_0xd7de('0x40')]){_0x5c8ec2[_0xd7de('0x3e')]=_['merge'](_0x5c8ec2[_0xd7de('0x3e')],{'$or':_[_0xd7de('0x2f')](_0x33846d,function(_0x439c45){if(_0x439c45[_0xd7de('0x33')]!==_0xd7de('0x41')){var _0x3d4c2f={};_0x3d4c2f[_0x439c45[_0xd7de('0x2d')]]={'$like':'%'+_0x5a5f90[_0xd7de('0x35')]['filter']+'%'};return _0x3d4c2f;}})});}_0x5c8ec2=_[_0xd7de('0x42')]({},_0x5c8ec2,_0x5a5f90[_0xd7de('0x43')]);var _0x5c1af3={'where':_0x5c8ec2[_0xd7de('0x3e')]};return db[_0xd7de('0x30')]['count'](_0x5c1af3)[_0xd7de('0x29')](function(_0x1b117c){_0x472dd3['count']=_0x1b117c;if(_0x5a5f90[_0xd7de('0x35')][_0xd7de('0x44')]){_0x5c8ec2[_0xd7de('0x45')]=[{'all':!![]}];}return db[_0xd7de('0x30')][_0xd7de('0x46')](_0x5c8ec2);})[_0xd7de('0x29')](function(_0x117023){_0x472dd3[_0xd7de('0x47')]=_0x117023;return _0x472dd3;})[_0xd7de('0x29')](respondWithFilteredResult(_0x2865cf,_0x5c8ec2))['catch'](handleError(_0x2865cf,null));};exports['show']=function(_0x1f71ef,_0xe19289){var _0x5d98ca={'raw':![],'where':{'id':_0x1f71ef[_0xd7de('0x48')]['id']}},_0x443ba4={};_0x443ba4[_0xd7de('0x34')]=_[_0xd7de('0x49')](db[_0xd7de('0x30')]['rawAttributes']);_0x443ba4[_0xd7de('0x35')]=_[_0xd7de('0x49')](_0x1f71ef['query']);_0x443ba4[_0xd7de('0x36')]=_[_0xd7de('0x38')](_0x443ba4[_0xd7de('0x34')],_0x443ba4['query']);_0x5d98ca[_0xd7de('0x37')]=_[_0xd7de('0x38')](_0x443ba4[_0xd7de('0x34')],qs[_0xd7de('0x39')](_0x1f71ef[_0xd7de('0x35')][_0xd7de('0x39')]));_0x5d98ca[_0xd7de('0x37')]=_0x5d98ca[_0xd7de('0x37')][_0xd7de('0x4a')]?_0x5d98ca['attributes']:_0x443ba4['model'];if(_0x1f71ef['query']['includeAll']){_0x5d98ca[_0xd7de('0x45')]=[{'all':!![]}];}_0x5d98ca=_[_0xd7de('0x42')]({},_0x5d98ca,_0x1f71ef[_0xd7de('0x43')]);return db[_0xd7de('0x30')][_0xd7de('0x4b')](_0x5d98ca)[_0xd7de('0x29')](handleEntityNotFound(_0xe19289,null))['then'](respondWithResult(_0xe19289,null))[_0xd7de('0x4c')](handleError(_0xe19289,null));};exports['create']=function(_0x59f70e,_0x143095){return db[_0xd7de('0x30')]['create'](_0x59f70e[_0xd7de('0x4d')],{})[_0xd7de('0x29')](respondWithResult(_0x143095,0xc9))[_0xd7de('0x4c')](handleError(_0x143095,null));};exports[_0xd7de('0x4e')]=function(_0xd89fe7,_0x5d5f33){return db['AnalyticFieldReport'][_0xd7de('0x4e')](_0xd89fe7[_0xd7de('0x4d')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5d5f33,0xc9))['catch'](handleError(_0x5d5f33,null));};exports['update']=function(_0x6ba49f,_0x17198d){if(_0x6ba49f[_0xd7de('0x4d')]['id']){delete _0x6ba49f[_0xd7de('0x4d')]['id'];}return db[_0xd7de('0x30')]['find']({'where':{'id':_0x6ba49f['params']['id']}})[_0xd7de('0x29')](handleEntityNotFound(_0x17198d,null))[_0xd7de('0x29')](saveUpdates(_0x6ba49f[_0xd7de('0x4d')],null))[_0xd7de('0x29')](respondWithResult(_0x17198d,null))[_0xd7de('0x4c')](handleError(_0x17198d,null));};exports[_0xd7de('0x2a')]=function(_0x209ac4,_0x174750){return db[_0xd7de('0x30')]['find']({'where':{'id':_0x209ac4[_0xd7de('0x48')]['id']}})['then'](handleEntityNotFound(_0x174750,null))[_0xd7de('0x29')](removeEntity(_0x174750,null))[_0xd7de('0x4c')](handleError(_0x174750,null));};exports[_0xd7de('0x4f')]=function(_0x3af21c,_0x8229aa){return db[_0xd7de('0x30')]['destroy']({'where':{'id':_0x3af21c[_0xd7de('0x35')][_0xd7de('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0xd7de('0x29')](respondWithResult(_0x8229aa,0xcc))[_0xd7de('0x4c')](handleError(_0x8229aa,null));};exports[_0xd7de('0x51')]=function(_0x1c8c52,_0x2152e3,_0x50dc8d){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x1c8c52['params']['id']}})[_0xd7de('0x29')](handleEntityNotFound(_0x2152e3,null))['then'](function(_0x627351){if(_0x627351){return db['sequelize'][_0xd7de('0x52')](function(_0x36a367){return db[_0xd7de('0x30')]['destroy']({'where':{'CustomReportId':_0x1c8c52[_0xd7de('0x48')]['id']},'transaction':_0x36a367})[_0xd7de('0x29')](function(_0x18a504){var _0x544275=_[_0xd7de('0x2f')](_0x1c8c52['body'],function(_0x17fba6){delete _0x17fba6['id'];_0x17fba6[_0xd7de('0x53')]=_0x1c8c52[_0xd7de('0x48')]['id'];return _0x17fba6;});return db[_0xd7de('0x30')][_0xd7de('0x4e')](_0x544275,{'transaction':_0x36a367});});})[_0xd7de('0x29')](function(){return db[_0xd7de('0x30')][_0xd7de('0x46')]({'where':{'CustomReportId':_0x1c8c52[_0xd7de('0x48')]['id']}});});}})[_0xd7de('0x29')](respondWithResult(_0x2152e3,null))[_0xd7de('0x4c')](handleError(_0x2152e3,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 69c4cb2..6d6720d 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 _0x729b=['./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5118bb,_0x3e52a6){var _0x3813be=function(_0x74baad){while(--_0x74baad){_0x5118bb['push'](_0x5118bb['shift']());}};_0x3813be(++_0x3e52a6);}(_0x729b,0x1f0));var _0xb729=function(_0x4c8423,_0x49cac5){_0x4c8423=_0x4c8423-0x0;var _0x13baf8=_0x729b[_0x4c8423];return _0x13baf8;};'use strict';var _=require('lodash');var util=require(_0xb729('0x0'));var logger=require('../../config/logger')(_0xb729('0x1'));var moment=require(_0xb729('0x2'));var BPromise=require(_0xb729('0x3'));var rp=require(_0xb729('0x4'));var fs=require('fs');var path=require(_0xb729('0x5'));var rimraf=require(_0xb729('0x6'));var config=require(_0xb729('0x7'));var attributes=require(_0xb729('0x8'));module['exports']=function(_0x50d9fe,_0x9d8e0){return _0x50d9fe[_0xb729('0x9')](_0xb729('0xa'),attributes,{'tableName':_0xb729('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43a4=['analytics_report_fields','lodash','../../config/logger','api','exports','define','AnalyticFieldReport'];(function(_0x888385,_0x9cdc66){var _0x22d5c2=function(_0x3b1599){while(--_0x3b1599){_0x888385['push'](_0x888385['shift']());}};_0x22d5c2(++_0x9cdc66);}(_0x43a4,0x1b3));var _0x443a=function(_0x3fce4e,_0x18e429){_0x3fce4e=_0x3fce4e-0x0;var _0x393360=_0x43a4[_0x3fce4e];return _0x393360;};'use strict';var _=require(_0x443a('0x0'));var util=require('util');var logger=require(_0x443a('0x1'))(_0x443a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x443a('0x3')]=function(_0x4d7472,_0xf1a737){return _0x4d7472[_0x443a('0x4')](_0x443a('0x5'),attributes,{'tableName':_0x443a('0x6'),'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 fa4765e..1fe12d4 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 _0x4ec1=['http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1f5303,_0x354414){var _0x84ef1a=function(_0x27e275){while(--_0x27e275){_0x1f5303['push'](_0x1f5303['shift']());}};_0x84ef1a(++_0x354414);}(_0x4ec1,0x173));var _0x14ec=function(_0x4038d7,_0x5ad97b){_0x4038d7=_0x4038d7-0x0;var _0x472ff6=_0x4ec1[_0x4038d7];return _0x472ff6;};'use strict';var _=require(_0x14ec('0x0'));var util=require('util');var moment=require(_0x14ec('0x1'));var BPromise=require('bluebird');var rs=require(_0x14ec('0x2'));var fs=require('fs');var Redis=require(_0x14ec('0x3'));var db=require(_0x14ec('0x4'))['db'];var utils=require(_0x14ec('0x5'));var logger=require('../../config/logger')(_0x14ec('0x6'));var config=require(_0x14ec('0x7'));var jayson=require(_0x14ec('0x8'));var client=jayson['client'][_0x14ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b9e07,_0x192127,_0x510aae){return new BPromise(function(_0x3c8bb3,_0x5d883c){return client[_0x14ec('0xa')](_0x4b9e07,_0x510aae)[_0x14ec('0xb')](function(_0xd9062e){logger[_0x14ec('0xc')](_0x14ec('0xd'),_0x192127,_0x14ec('0xe'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x192127,_0x14ec('0xe'),JSON['stringify'](_0xd9062e));if(_0xd9062e[_0x14ec('0xf')]){if(_0xd9062e[_0x14ec('0xf')][_0x14ec('0x10')]===0x1f4){logger['error'](_0x14ec('0xd'),_0x192127,_0xd9062e['error'][_0x14ec('0x11')]);return _0x5d883c(_0xd9062e[_0x14ec('0xf')][_0x14ec('0x11')]);}logger[_0x14ec('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x192127,_0xd9062e[_0x14ec('0xf')][_0x14ec('0x11')]);return _0x3c8bb3(_0xd9062e[_0x14ec('0xf')][_0x14ec('0x11')]);}else{logger['info'](_0x14ec('0xd'),_0x192127,'request\x20sent');_0x3c8bb3(_0xd9062e['result'][_0x14ec('0x11')]);}})[_0x14ec('0x12')](function(_0xc02c41){logger[_0x14ec('0xf')](_0x14ec('0xd'),_0x192127,_0xc02c41);_0x5d883c(_0xc02c41);});});} \ No newline at end of file +var _0xe7ed=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0x4d35f3,_0x19ba66){var _0x382fea=function(_0x2c2390){while(--_0x2c2390){_0x4d35f3['push'](_0x4d35f3['shift']());}};_0x382fea(++_0x19ba66);}(_0xe7ed,0xe5));var _0xde7e=function(_0x3eb5ae,_0x4e1617){_0x3eb5ae=_0x3eb5ae-0x0;var _0x4f8648=_0xe7ed[_0x3eb5ae];return _0x4f8648;};'use strict';var _=require(_0xde7e('0x0'));var util=require(_0xde7e('0x1'));var moment=require(_0xde7e('0x2'));var BPromise=require(_0xde7e('0x3'));var rs=require(_0xde7e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde7e('0x5'))['db'];var utils=require(_0xde7e('0x6'));var logger=require(_0xde7e('0x7'))(_0xde7e('0x8'));var config=require(_0xde7e('0x9'));var jayson=require(_0xde7e('0xa'));var client=jayson[_0xde7e('0xb')][_0xde7e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x519c77,_0x2d707a,_0x8b74ae){return new BPromise(function(_0x4ade80,_0x17430b){return client[_0xde7e('0xd')](_0x519c77,_0x8b74ae)[_0xde7e('0xe')](function(_0x2cdf23){logger[_0xde7e('0xf')](_0xde7e('0x10'),_0x2d707a,_0xde7e('0x11'));logger['debug'](_0xde7e('0x12'),_0x2d707a,_0xde7e('0x11'),JSON['stringify'](_0x2cdf23));if(_0x2cdf23['error']){if(_0x2cdf23[_0xde7e('0x13')]['code']===0x1f4){logger[_0xde7e('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2d707a,_0x2cdf23[_0xde7e('0x13')][_0xde7e('0x14')]);return _0x17430b(_0x2cdf23[_0xde7e('0x13')][_0xde7e('0x14')]);}logger[_0xde7e('0x13')](_0xde7e('0x10'),_0x2d707a,_0x2cdf23['error'][_0xde7e('0x14')]);return _0x4ade80(_0x2cdf23[_0xde7e('0x13')][_0xde7e('0x14')]);}else{logger[_0xde7e('0xf')](_0xde7e('0x10'),_0x2d707a,'request\x20sent');_0x4ade80(_0x2cdf23[_0xde7e('0x15')][_0xde7e('0x14')]);}})[_0xde7e('0x16')](function(_0x593828){logger[_0xde7e('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2d707a,_0x593828);_0x17430b(_0x593828);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 0c98713..7c00ca7 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(_0x1bf189,_0x2f8b71){var _0x14292c=function(_0x10d012){while(--_0x10d012){_0x1bf189['push'](_0x1bf189['shift']());}};_0x14292c(++_0x2f8b71);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x591245,_0x3c46cd){var _0x42fc30=function(_0x78f882){while(--_0x78f882){_0x591245['push'](_0x591245['shift']());}};_0x42fc30(++_0x3c46cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 64e8611..5d2db2e 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 _0x9f3e=['sequelize','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f3e,0x1c4));var _0xe9f3=function(_0xb35d16,_0x48e785){_0xb35d16=_0xb35d16-0x0;var _0x6642e=_0x9f3e[_0xb35d16];return _0x6642e;};'use strict';var Sequelize=require(_0xe9f3('0x0'));module[_0xe9f3('0x1')]={'name':{'type':Sequelize[_0xe9f3('0x2')],'allowNull':![],'unique':_0xe9f3('0x3')},'table':{'type':Sequelize[_0xe9f3('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x063c=['name','TEXT','exports','STRING'];(function(_0x13413c,_0x4b9e44){var _0xc1cbee=function(_0x1c7cc4){while(--_0x1c7cc4){_0x13413c['push'](_0x13413c['shift']());}};_0xc1cbee(++_0x4b9e44);}(_0x063c,0xba));var _0xc063=function(_0x5c22f3,_0x5cbed6){_0x5c22f3=_0x5c22f3-0x0;var _0x3d89a1=_0x063c[_0x5c22f3];return _0x3d89a1;};'use strict';var Sequelize=require('sequelize');module[_0xc063('0x0')]={'name':{'type':Sequelize[_0xc063('0x1')],'allowNull':![],'unique':_0xc063('0x2')},'table':{'type':Sequelize[_0xc063('0x1')]},'metric':{'type':Sequelize[_0xc063('0x3')]},'description':{'type':Sequelize[_0xc063('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 0a25e84..02031f5 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 _0x6aa7=['json','apply','reject','save','update','then','destroy','get','Metrics','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','catch','error','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range'];(function(_0x2c4702,_0x3857ed){var _0x54d0a3=function(_0x903ba8){while(--_0x903ba8){_0x2c4702['push'](_0x2c4702['shift']());}};_0x54d0a3(++_0x3857ed);}(_0x6aa7,0x178));var _0x76aa=function(_0x40034d,_0x109736){_0x40034d=_0x40034d-0x0;var _0x1d71f1=_0x6aa7[_0x40034d];return _0x1d71f1;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){var _0x2cba6d=_0x3cd039[_0x76aa('0x29')]({'plain':!![]});var _0x26b75e=_0x76aa('0x2a');return db['UserProfileResource'][_0x76aa('0x28')]({'where':{'type':_0x26b75e,'resourceId':_0x2cba6d['id']}})[_0x76aa('0x27')](function(){return _0x3cd039;});})[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x2f9316,_0x25a803){return function(_0x282d0a){if(!_0x282d0a){_0x2f9316[_0x76aa('0x19')](0x194);}return _0x282d0a;};}function handleError(_0x1bdc3d,_0x545b06){_0x545b06=_0x545b06||0x1f4;return function(_0x3fcb7f){logger['error'](_0x3fcb7f[_0x76aa('0x2b')]);if(_0x3fcb7f[_0x76aa('0x2c')]){delete _0x3fcb7f[_0x76aa('0x2c')];}_0x1bdc3d[_0x76aa('0x1a')](_0x545b06)[_0x76aa('0x2d')](_0x3fcb7f);};}exports[_0x76aa('0x2e')]=function(_0x2ee0f9,_0x3827ec){var _0x19fd4f={},_0x3ea05a={},_0x5edcd8={'count':0x0,'rows':[]};var _0x430ad6=_[_0x76aa('0x2f')](db[_0x76aa('0x30')][_0x76aa('0x31')],function(_0x458ac3){return{'name':_0x458ac3[_0x76aa('0x32')],'type':_0x458ac3[_0x76aa('0x33')]['key']};});_0x3ea05a[_0x76aa('0x34')]=_[_0x76aa('0x2f')](_0x430ad6,'name');_0x3ea05a[_0x76aa('0x35')]=_['keys'](_0x2ee0f9[_0x76aa('0x35')]);_0x3ea05a['filters']=_[_0x76aa('0x36')](_0x3ea05a['model'],_0x3ea05a['query']);_0x19fd4f[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x3ea05a[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x2ee0f9['query']['fields']));_0x19fd4f[_0x76aa('0x37')]=_0x19fd4f[_0x76aa('0x37')][_0x76aa('0x39')]?_0x19fd4f[_0x76aa('0x37')]:_0x3ea05a[_0x76aa('0x34')];if(!_0x2ee0f9['query'][_0x76aa('0x3a')]('nolimit')){_0x19fd4f['limit']=qs[_0x76aa('0x1f')](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1f')]);_0x19fd4f[_0x76aa('0x1e')]=qs['offset'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1e')]);}_0x19fd4f[_0x76aa('0x3b')]=qs['sort'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x3c')]);_0x19fd4f[_0x76aa('0x3d')]=qs[_0x76aa('0x3e')](_[_0x76aa('0x3f')](_0x2ee0f9[_0x76aa('0x35')],_0x3ea05a[_0x76aa('0x3e')]),_0x430ad6);if(_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]){_0x19fd4f['where']=_[_0x76aa('0x41')](_0x19fd4f[_0x76aa('0x3d')],{'$or':_[_0x76aa('0x2f')](_0x430ad6,function(_0xa824e8){if(_0xa824e8[_0x76aa('0x33')]!==_0x76aa('0x42')){var _0x572fdb={};_0x572fdb[_0xa824e8['name']]={'$like':'%'+_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]+'%'};return _0x572fdb;}})});}_0x19fd4f=_[_0x76aa('0x41')]({},_0x19fd4f,_0x2ee0f9[_0x76aa('0x43')]);var _0x50599f={'where':_0x19fd4f[_0x76aa('0x3d')]};return db[_0x76aa('0x30')][_0x76aa('0x1d')](_0x50599f)[_0x76aa('0x27')](function(_0x1138b5){_0x5edcd8['count']=_0x1138b5;if(_0x2ee0f9[_0x76aa('0x35')]['includeAll']){_0x19fd4f[_0x76aa('0x44')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x19fd4f);})['then'](function(_0x144f0a){_0x5edcd8['rows']=_0x144f0a;return _0x5edcd8;})['then'](respondWithFilteredResult(_0x3827ec,_0x19fd4f))['catch'](handleError(_0x3827ec,null));};exports[_0x76aa('0x45')]=function(_0x3fd153,_0x116dc5){var _0x2c0744={'raw':!![],'where':{'id':_0x3fd153['params']['id']}},_0x27a52e={};_0x27a52e[_0x76aa('0x34')]=_[_0x76aa('0x46')](db[_0x76aa('0x30')][_0x76aa('0x31')]);_0x27a52e[_0x76aa('0x35')]=_['keys'](_0x3fd153[_0x76aa('0x35')]);_0x27a52e[_0x76aa('0x3e')]=_['intersection'](_0x27a52e[_0x76aa('0x34')],_0x27a52e['query']);_0x2c0744[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x27a52e[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x3fd153[_0x76aa('0x35')][_0x76aa('0x38')]));_0x2c0744[_0x76aa('0x37')]=_0x2c0744[_0x76aa('0x37')][_0x76aa('0x39')]?_0x2c0744[_0x76aa('0x37')]:_0x27a52e['model'];if(_0x3fd153[_0x76aa('0x35')]['includeAll']){_0x2c0744[_0x76aa('0x44')]=[{'all':!![]}];}_0x2c0744=_[_0x76aa('0x41')]({},_0x2c0744,_0x3fd153[_0x76aa('0x43')]);return db[_0x76aa('0x30')]['find'](_0x2c0744)['then'](handleEntityNotFound(_0x116dc5,null))[_0x76aa('0x27')](respondWithResult(_0x116dc5,null))['catch'](handleError(_0x116dc5,null));};exports[_0x76aa('0x47')]=function(_0x302a0c,_0x4315b3){return db[_0x76aa('0x30')][_0x76aa('0x47')](_0x302a0c[_0x76aa('0x48')],{})['then'](function(_0x564546){var _0x2fcf8f=_0x302a0c[_0x76aa('0x49')][_0x76aa('0x29')]({'plain':!![]});if(!_0x2fcf8f)throw new Error(_0x76aa('0x4a'));if(_0x2fcf8f[_0x76aa('0x4b')]===_0x76aa('0x49')){var _0x4c52d5=_0x564546[_0x76aa('0x29')]({'plain':!![]});var _0x2d631e=_0x76aa('0x2a');return db['UserProfileSection'][_0x76aa('0x4c')]({'where':{'name':_0x2d631e,'userProfileId':_0x2fcf8f['userProfileId']},'raw':!![]})[_0x76aa('0x27')](function(_0x5e1d84){if(_0x5e1d84&&_0x5e1d84[_0x76aa('0x4d')]===0x0){return db[_0x76aa('0x4e')][_0x76aa('0x47')]({'name':_0x4c52d5[_0x76aa('0x2c')],'resourceId':_0x4c52d5['id'],'type':_0x5e1d84[_0x76aa('0x2c')],'sectionId':_0x5e1d84['id']},{})[_0x76aa('0x27')](function(){return _0x564546;});}else{return _0x564546;}})[_0x76aa('0x4f')](function(_0x4f2c2b){logger[_0x76aa('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f2c2b);throw _0x4f2c2b;});}return _0x564546;})[_0x76aa('0x27')](respondWithResult(_0x4315b3,0xc9))[_0x76aa('0x4f')](handleError(_0x4315b3,null));};exports[_0x76aa('0x26')]=function(_0x53be10,_0x3fa7ec){if(_0x53be10[_0x76aa('0x48')]['id']){delete _0x53be10[_0x76aa('0x48')]['id'];}return db['AnalyticMetric'][_0x76aa('0x4c')]({'where':{'id':_0x53be10[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x3fa7ec,null))[_0x76aa('0x27')](saveUpdates(_0x53be10['body'],null))[_0x76aa('0x27')](respondWithResult(_0x3fa7ec,null))[_0x76aa('0x4f')](handleError(_0x3fa7ec,null));};exports[_0x76aa('0x28')]=function(_0x410933,_0x2027f8){return db[_0x76aa('0x30')]['find']({'where':{'id':_0x410933[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x2027f8,null))[_0x76aa('0x27')](removeEntity(_0x2027f8,null))[_0x76aa('0x4f')](handleError(_0x2027f8,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(_0x542e93,_0x237e84){var _0x7b7dbd=function(_0x1f6fbd){while(--_0x1f6fbd){_0x542e93['push'](_0x542e93['shift']());}};_0x7b7dbd(++_0x237e84);}(_0x7217,0x19e));var _0x7721=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x7217[_0x2160a9];return _0xa88cf7;};'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 6f81526..ceed844 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 _0x077e=['./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_0x077e,0x14a));var _0xe077=function(_0x20006a,_0x30e3a9){_0x20006a=_0x20006a-0x0;var _0x5e26ac=_0x077e[_0x20006a];return _0x5e26ac;};'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 +var _0xee4a=['api','moment','request-promise','rimraf','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger'];(function(_0x48c19b,_0x3a1721){var _0x7b88f=function(_0x4e45e9){while(--_0x4e45e9){_0x48c19b['push'](_0x48c19b['shift']());}};_0x7b88f(++_0x3a1721);}(_0xee4a,0x9e));var _0xaee4=function(_0x513907,_0x4fe0d2){_0x513907=_0x513907-0x0;var _0x6dc209=_0xee4a[_0x513907];return _0x6dc209;};'use strict';var _=require(_0xaee4('0x0'));var util=require('util');var logger=require(_0xaee4('0x1'))(_0xaee4('0x2'));var moment=require(_0xaee4('0x3'));var BPromise=require('bluebird');var rp=require(_0xaee4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaee4('0x5'));var config=require('../../config/environment');var attributes=require(_0xaee4('0x6'));module['exports']=function(_0x23f47b,_0x555e98){return _0x23f47b[_0xaee4('0x7')](_0xaee4('0x8'),attributes,{'tableName':_0xaee4('0x9'),'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 ee3c20e..e63436e 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 _0x2158=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x154183,_0x591587){var _0x14918e=function(_0xfc4f13){while(--_0xfc4f13){_0x154183['push'](_0x154183['shift']());}};_0x14918e(++_0x591587);}(_0x2158,0x90));var _0x8215=function(_0x36a172,_0x231a17){_0x36a172=_0x36a172-0x0;var _0x60f068=_0x2158[_0x36a172];return _0x60f068;};'use strict';var _=require(_0x8215('0x0'));var util=require(_0x8215('0x1'));var moment=require(_0x8215('0x2'));var BPromise=require(_0x8215('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8215('0x4'));var db=require(_0x8215('0x5'))['db'];var utils=require(_0x8215('0x6'));var logger=require(_0x8215('0x7'))(_0x8215('0x8'));var config=require(_0x8215('0x9'));var jayson=require(_0x8215('0xa'));var client=jayson[_0x8215('0xb')][_0x8215('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a31e4,_0x51ca6a,_0x2bacd1){return new BPromise(function(_0xcf8d23,_0x252d6c){return client[_0x8215('0xd')](_0x5a31e4,_0x2bacd1)[_0x8215('0xe')](function(_0x2cb3d8){logger['info'](_0x8215('0xf'),_0x51ca6a,_0x8215('0x10'));logger['debug'](_0x8215('0x11'),_0x51ca6a,'request\x20sent',JSON[_0x8215('0x12')](_0x2cb3d8));if(_0x2cb3d8[_0x8215('0x13')]){if(_0x2cb3d8[_0x8215('0x13')][_0x8215('0x14')]===0x1f4){logger[_0x8215('0x13')](_0x8215('0xf'),_0x51ca6a,_0x2cb3d8[_0x8215('0x13')][_0x8215('0x15')]);return _0x252d6c(_0x2cb3d8[_0x8215('0x13')][_0x8215('0x15')]);}logger[_0x8215('0x13')](_0x8215('0xf'),_0x51ca6a,_0x2cb3d8['error'][_0x8215('0x15')]);return _0xcf8d23(_0x2cb3d8['error'][_0x8215('0x15')]);}else{logger[_0x8215('0x16')](_0x8215('0xf'),_0x51ca6a,'request\x20sent');_0xcf8d23(_0x2cb3d8['result'][_0x8215('0x15')]);}})[_0x8215('0x17')](function(_0x49208c){logger[_0x8215('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x51ca6a,_0x49208c);_0x252d6c(_0x49208c);});});} \ No newline at end of file +var _0x061a=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2c59ed,_0x585b81){var _0xfbca76=function(_0x556209){while(--_0x556209){_0x2c59ed['push'](_0x2c59ed['shift']());}};_0xfbca76(++_0x585b81);}(_0x061a,0x11b));var _0xa061=function(_0x3ed491,_0x11d29b){_0x3ed491=_0x3ed491-0x0;var _0x5ef2ff=_0x061a[_0x3ed491];return _0x5ef2ff;};'use strict';var _=require(_0xa061('0x0'));var util=require(_0xa061('0x1'));var moment=require(_0xa061('0x2'));var BPromise=require(_0xa061('0x3'));var rs=require(_0xa061('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa061('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa061('0x6'))(_0xa061('0x7'));var config=require('../../config/environment');var jayson=require(_0xa061('0x8'));var client=jayson[_0xa061('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b7e1d,_0x335e75,_0x15fb21){return new BPromise(function(_0x4a316d,_0x5f0bf2){return client[_0xa061('0xa')](_0x2b7e1d,_0x15fb21)['then'](function(_0x3c299f){logger[_0xa061('0xb')](_0xa061('0xc'),_0x335e75,_0xa061('0xd'));logger[_0xa061('0xe')](_0xa061('0xf'),_0x335e75,_0xa061('0xd'),JSON[_0xa061('0x10')](_0x3c299f));if(_0x3c299f[_0xa061('0x11')]){if(_0x3c299f['error'][_0xa061('0x12')]===0x1f4){logger[_0xa061('0x11')](_0xa061('0xc'),_0x335e75,_0x3c299f[_0xa061('0x11')]['message']);return _0x5f0bf2(_0x3c299f[_0xa061('0x11')][_0xa061('0x13')]);}logger[_0xa061('0x11')](_0xa061('0xc'),_0x335e75,_0x3c299f[_0xa061('0x11')][_0xa061('0x13')]);return _0x4a316d(_0x3c299f[_0xa061('0x11')][_0xa061('0x13')]);}else{logger[_0xa061('0xb')](_0xa061('0xc'),_0x335e75,_0xa061('0xd'));_0x4a316d(_0x3c299f[_0xa061('0x14')]['message']);}})[_0xa061('0x15')](function(_0x567389){logger[_0xa061('0x11')](_0xa061('0xc'),_0x335e75,_0x567389);_0x5f0bf2(_0x567389);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index dab0c92..d64bd84 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 _0x294b=['../../components/auth/service','./analyticMetric.controller','get','isAuthenticated','index','create','put','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x21a735,_0xa8f5a3){var _0xcfd1bb=function(_0x2414b7){while(--_0x2414b7){_0x21a735['push'](_0x21a735['shift']());}};_0xcfd1bb(++_0xa8f5a3);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb294('0x0'));var util=require('util');var path=require(_0xb294('0x1'));var timeout=require(_0xb294('0x2'));var express=require(_0xb294('0x3'));var router=express[_0xb294('0x4')]();var fs_extra=require(_0xb294('0x5'));var auth=require(_0xb294('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb294('0x7'));router[_0xb294('0x8')]('/',auth[_0xb294('0x9')](),controller[_0xb294('0xa')]);router[_0xb294('0x8')]('/:id',auth[_0xb294('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xb294('0xb')]);router[_0xb294('0xc')](_0xb294('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb294('0xd'),auth[_0xb294('0x9')](),controller[_0xb294('0xe')]);module[_0xb294('0xf')]=router; \ No newline at end of file +var _0xaba6=['delete','destroy','multer','util','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','show','create','/:id','update'];(function(_0x230913,_0x425c31){var _0x339bf2=function(_0x2ba708){while(--_0x2ba708){_0x230913['push'](_0x230913['shift']());}};_0x339bf2(++_0x425c31);}(_0xaba6,0xe2));var _0x6aba=function(_0x3cf58d,_0x394240){_0x3cf58d=_0x3cf58d-0x0;var _0x284a3f=_0xaba6[_0x3cf58d];return _0x284a3f;};'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')]('/:id',auth[_0x6aba('0x7')](),controller[_0x6aba('0x8')]);router['post']('/',auth[_0x6aba('0x7')](),controller[_0x6aba('0x9')]);router['put'](_0x6aba('0xa'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xb')]);router[_0x6aba('0xc')](_0x6aba('0xa'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xd')]);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 60a5750..1551e6f 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 _0xa622=['sequelize','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa622,0x154));var _0x2a62=function(_0x4ae040,_0x38d925){_0x4ae040=_0x4ae040-0x0;var _0x196b51=_0xa622[_0x4ae040];return _0x196b51;};'use strict';var Sequelize=require(_0x2a62('0x0'));module['exports']={'tree':{'type':Sequelize[_0x2a62('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb139=['sequelize','exports','TEXT'];(function(_0x7afbc4,_0x2b2e35){var _0x3dce84=function(_0x2ca18d){while(--_0x2ca18d){_0x7afbc4['push'](_0x7afbc4['shift']());}};_0x3dce84(++_0x2b2e35);}(_0xb139,0x19e));var _0x9b13=function(_0x236572,_0x5eec3f){_0x236572=_0x236572-0x0;var _0x479a92=_0xb139[_0x236572];return _0x479a92;};'use strict';var Sequelize=require(_0x9b13('0x0'));module[_0x9b13('0x1')]={'tree':{'type':Sequelize[_0x9b13('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 1891626..51ecc51 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 _0xbeed=['error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','findAll','catch','show','params','include','create','body','find','destroy','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end'];(function(_0x1b703f,_0x2fd83a){var _0x1a41f3=function(_0x3a5400){while(--_0x3a5400){_0x1b703f['push'](_0x1b703f['shift']());}};_0x1a41f3(++_0x2fd83a);}(_0xbeed,0xb1));var _0xdbee=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbeed[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xdbee('0x0'));var rimraf=require(_0xdbee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbee('0x2'));var rp=require('request-promise');var moment=require(_0xdbee('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdbee('0x4'));var util=require(_0xdbee('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xdbee('0x6'));var ejs=require(_0xdbee('0x7'));var fs=require('fs');var fs_extra=require(_0xdbee('0x8'));var _=require(_0xdbee('0x9'));var squel=require(_0xdbee('0xa'));var crypto=require(_0xdbee('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdbee('0x6'));var querystring=require(_0xdbee('0xc'));var Papa=require('papaparse');var Redis=require(_0xdbee('0xd'));var authService=require(_0xdbee('0xe'));var qs=require(_0xdbee('0xf'));var as=require(_0xdbee('0x10'));var hardwareService=require(_0xdbee('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xdbee('0x12'));var licenseUtil=require(_0xdbee('0x13'));var db=require(_0xdbee('0x14'))['db'];function respondWithStatusCode(_0x3a6c8d,_0x53e064){_0x53e064=_0x53e064||0xcc;return function(_0x1adcf2){if(_0x1adcf2){return _0x3a6c8d[_0xdbee('0x15')](_0x53e064);}return _0x3a6c8d['status'](_0x53e064)['end']();};}function respondWithResult(_0x3b5299,_0xa17743){_0xa17743=_0xa17743||0xc8;return function(_0x45ac78){if(_0x45ac78){return _0x3b5299[_0xdbee('0x16')](_0xa17743)[_0xdbee('0x17')](_0x45ac78);}};}function respondWithFilteredResult(_0x14f81d,_0x3b036f){return function(_0x4d1791){if(_0x4d1791){var _0x598da2=typeof _0x3b036f[_0xdbee('0x18')]==='undefined'&&typeof _0x3b036f[_0xdbee('0x19')]===_0xdbee('0x1a');var _0x16f7c7=_0x4d1791[_0xdbee('0x1b')];var _0x27bee0=_0x598da2?0x0:_0x3b036f['offset'];var _0x37f815=_0x598da2?_0x4d1791[_0xdbee('0x1b')]:_0x3b036f['offset']+_0x3b036f[_0xdbee('0x19')];var _0x664538;if(_0x37f815>=_0x16f7c7){_0x37f815=_0x16f7c7;_0x664538=0xc8;}else{_0x664538=0xce;}_0x14f81d[_0xdbee('0x16')](_0x664538);return _0x14f81d[_0xdbee('0x1c')](_0xdbee('0x1d'),_0x27bee0+'-'+_0x37f815+'/'+_0x16f7c7)[_0xdbee('0x17')](_0x4d1791);}return null;};}function patchUpdates(_0xcb4814){return function(_0x147fed){try{jsonpatch[_0xdbee('0x1e')](_0x147fed,_0xcb4814,!![]);}catch(_0x90e3b){return BPromise[_0xdbee('0x1f')](_0x90e3b);}return _0x147fed[_0xdbee('0x20')]();};}function saveUpdates(_0x28f8df,_0x5f0f98){return function(_0xca7d4c){if(_0xca7d4c){return _0xca7d4c[_0xdbee('0x21')](_0x28f8df)[_0xdbee('0x22')](function(_0x649972){return _0x649972;});}return null;};}function removeEntity(_0x24ced7,_0x3d4844){return function(_0x58cf2d){if(_0x58cf2d){return _0x58cf2d['destroy']()[_0xdbee('0x22')](function(){_0x24ced7[_0xdbee('0x16')](0xcc)[_0xdbee('0x23')]();});}};}function handleEntityNotFound(_0x4b6767,_0x44a2b6){return function(_0x3ca7f3){if(!_0x3ca7f3){_0x4b6767['sendStatus'](0x194);}return _0x3ca7f3;};}function handleError(_0x278338,_0x39f429){_0x39f429=_0x39f429||0x1f4;return function(_0x3d781d){logger[_0xdbee('0x24')](_0x3d781d[_0xdbee('0x25')]);if(_0x3d781d[_0xdbee('0x26')]){delete _0x3d781d[_0xdbee('0x26')];}_0x278338[_0xdbee('0x16')](_0x39f429)[_0xdbee('0x27')](_0x3d781d);};}exports[_0xdbee('0x28')]=function(_0x2e864d,_0x3efe7a){var _0x32d7e7={},_0x19bf0a={},_0x191c67={'count':0x0,'rows':[]};var _0x49b4fa=_[_0xdbee('0x29')](db['AnalyticTreeReport']['rawAttributes'],function(_0x42f188){return{'name':_0x42f188[_0xdbee('0x2a')],'type':_0x42f188[_0xdbee('0x2b')]['key']};});_0x19bf0a[_0xdbee('0x2c')]=_[_0xdbee('0x29')](_0x49b4fa,'name');_0x19bf0a[_0xdbee('0x2d')]=_[_0xdbee('0x2e')](_0x2e864d['query']);_0x19bf0a[_0xdbee('0x2f')]=_[_0xdbee('0x30')](_0x19bf0a[_0xdbee('0x2c')],_0x19bf0a['query']);_0x32d7e7[_0xdbee('0x31')]=_[_0xdbee('0x30')](_0x19bf0a['model'],qs[_0xdbee('0x32')](_0x2e864d['query'][_0xdbee('0x32')]));_0x32d7e7[_0xdbee('0x31')]=_0x32d7e7['attributes'][_0xdbee('0x33')]?_0x32d7e7[_0xdbee('0x31')]:_0x19bf0a[_0xdbee('0x2c')];if(!_0x2e864d[_0xdbee('0x2d')]['hasOwnProperty'](_0xdbee('0x34'))){_0x32d7e7[_0xdbee('0x19')]=qs[_0xdbee('0x19')](_0x2e864d[_0xdbee('0x2d')][_0xdbee('0x19')]);_0x32d7e7[_0xdbee('0x18')]=qs[_0xdbee('0x18')](_0x2e864d[_0xdbee('0x2d')]['offset']);}_0x32d7e7['order']=qs[_0xdbee('0x35')](_0x2e864d[_0xdbee('0x2d')][_0xdbee('0x35')]);_0x32d7e7[_0xdbee('0x36')]=qs['filters'](_[_0xdbee('0x37')](_0x2e864d[_0xdbee('0x2d')],_0x19bf0a[_0xdbee('0x2f')]),_0x49b4fa);if(_0x2e864d['query'][_0xdbee('0x38')]){_0x32d7e7[_0xdbee('0x36')]=_[_0xdbee('0x39')](_0x32d7e7[_0xdbee('0x36')],{'$or':_[_0xdbee('0x29')](_0x49b4fa,function(_0x45c47a){if(_0x45c47a[_0xdbee('0x2b')]!==_0xdbee('0x3a')){var _0x587516={};_0x587516[_0x45c47a[_0xdbee('0x26')]]={'$like':'%'+_0x2e864d[_0xdbee('0x2d')][_0xdbee('0x38')]+'%'};return _0x587516;}})});}_0x32d7e7=_['merge']({},_0x32d7e7,_0x2e864d[_0xdbee('0x3b')]);var _0x4aabe7={'where':_0x32d7e7[_0xdbee('0x36')]};return db[_0xdbee('0x3c')][_0xdbee('0x1b')](_0x4aabe7)[_0xdbee('0x22')](function(_0x5ce087){_0x191c67[_0xdbee('0x1b')]=_0x5ce087;if(_0x2e864d[_0xdbee('0x2d')][_0xdbee('0x3d')]){_0x32d7e7['include']=[{'all':!![]}];}return db[_0xdbee('0x3c')][_0xdbee('0x3e')](_0x32d7e7);})[_0xdbee('0x22')](function(_0x245b52){_0x191c67['rows']=_0x245b52;return _0x191c67;})[_0xdbee('0x22')](respondWithFilteredResult(_0x3efe7a,_0x32d7e7))[_0xdbee('0x3f')](handleError(_0x3efe7a,null));};exports[_0xdbee('0x40')]=function(_0xb170db,_0x487765){var _0x245fb2={'raw':!![],'where':{'id':_0xb170db[_0xdbee('0x41')]['id']}},_0x5d19c1={};_0x5d19c1[_0xdbee('0x2c')]=_[_0xdbee('0x2e')](db[_0xdbee('0x3c')]['rawAttributes']);_0x5d19c1[_0xdbee('0x2d')]=_[_0xdbee('0x2e')](_0xb170db[_0xdbee('0x2d')]);_0x5d19c1[_0xdbee('0x2f')]=_['intersection'](_0x5d19c1['model'],_0x5d19c1['query']);_0x245fb2[_0xdbee('0x31')]=_[_0xdbee('0x30')](_0x5d19c1['model'],qs[_0xdbee('0x32')](_0xb170db[_0xdbee('0x2d')]['fields']));_0x245fb2['attributes']=_0x245fb2[_0xdbee('0x31')][_0xdbee('0x33')]?_0x245fb2['attributes']:_0x5d19c1[_0xdbee('0x2c')];if(_0xb170db[_0xdbee('0x2d')][_0xdbee('0x3d')]){_0x245fb2[_0xdbee('0x42')]=[{'all':!![]}];}_0x245fb2=_[_0xdbee('0x39')]({},_0x245fb2,_0xb170db[_0xdbee('0x3b')]);return db[_0xdbee('0x3c')]['find'](_0x245fb2)['then'](handleEntityNotFound(_0x487765,null))[_0xdbee('0x22')](respondWithResult(_0x487765,null))[_0xdbee('0x3f')](handleError(_0x487765,null));};exports[_0xdbee('0x43')]=function(_0x564691,_0x1edc0f){return db[_0xdbee('0x3c')][_0xdbee('0x43')](_0x564691[_0xdbee('0x44')],{})[_0xdbee('0x22')](respondWithResult(_0x1edc0f,0xc9))[_0xdbee('0x3f')](handleError(_0x1edc0f,null));};exports[_0xdbee('0x21')]=function(_0x8b7765,_0x2d6f0a){if(_0x8b7765[_0xdbee('0x44')]['id']){delete _0x8b7765[_0xdbee('0x44')]['id'];}return db[_0xdbee('0x3c')][_0xdbee('0x45')]({'where':{'id':_0x8b7765['params']['id']}})[_0xdbee('0x22')](handleEntityNotFound(_0x2d6f0a,null))['then'](saveUpdates(_0x8b7765[_0xdbee('0x44')],null))[_0xdbee('0x22')](respondWithResult(_0x2d6f0a,null))['catch'](handleError(_0x2d6f0a,null));};exports[_0xdbee('0x46')]=function(_0x390da6,_0x27ab6c){return db[_0xdbee('0x3c')][_0xdbee('0x45')]({'where':{'id':_0x390da6[_0xdbee('0x41')]['id']}})[_0xdbee('0x22')](handleEntityNotFound(_0x27ab6c,null))['then'](removeEntity(_0x27ab6c,null))['catch'](handleError(_0x27ab6c,null));}; \ No newline at end of file +var _0xe192=['offset','Content-Range','save','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','length','find','create','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count'];(function(_0x236838,_0x5f5c55){var _0x3ae028=function(_0x2c88ce){while(--_0x2c88ce){_0x236838['push'](_0x236838['shift']());}};_0x3ae028(++_0x5f5c55);}(_0xe192,0x1aa));var _0x2e19=function(_0x3c8b0b,_0x52f3d5){_0x3c8b0b=_0x3c8b0b-0x0;var _0x5049fc=_0xe192[_0x3c8b0b];return _0x5049fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e19('0x0'));var zipdir=require(_0x2e19('0x1'));var jsonpatch=require(_0x2e19('0x2'));var rp=require(_0x2e19('0x3'));var moment=require(_0x2e19('0x4'));var BPromise=require(_0x2e19('0x5'));var Mustache=require(_0x2e19('0x6'));var util=require(_0x2e19('0x7'));var path=require(_0x2e19('0x8'));var sox=require(_0x2e19('0x9'));var csv=require(_0x2e19('0xa'));var ejs=require(_0x2e19('0xb'));var fs=require('fs');var fs_extra=require(_0x2e19('0xc'));var _=require(_0x2e19('0xd'));var squel=require(_0x2e19('0xe'));var crypto=require('crypto');var jsforce=require(_0x2e19('0xf'));var deskjs=require(_0x2e19('0x10'));var toCsv=require(_0x2e19('0xa'));var querystring=require(_0x2e19('0x11'));var Papa=require(_0x2e19('0x12'));var Redis=require(_0x2e19('0x13'));var authService=require(_0x2e19('0x14'));var qs=require(_0x2e19('0x15'));var as=require(_0x2e19('0x16'));var hardwareService=require(_0x2e19('0x17'));var logger=require(_0x2e19('0x18'))(_0x2e19('0x19'));var utils=require('../../config/utils');var config=require(_0x2e19('0x1a'));var licenseUtil=require(_0x2e19('0x1b'));var db=require(_0x2e19('0x1c'))['db'];function respondWithStatusCode(_0x1ca227,_0x4969e8){_0x4969e8=_0x4969e8||0xcc;return function(_0x59a110){if(_0x59a110){return _0x1ca227[_0x2e19('0x1d')](_0x4969e8);}return _0x1ca227[_0x2e19('0x1e')](_0x4969e8)[_0x2e19('0x1f')]();};}function respondWithResult(_0x179558,_0x1c72c4){_0x1c72c4=_0x1c72c4||0xc8;return function(_0x4ccecc){if(_0x4ccecc){return _0x179558['status'](_0x1c72c4)[_0x2e19('0x20')](_0x4ccecc);}};}function respondWithFilteredResult(_0x159e49,_0x1a66e8){return function(_0x95a906){if(_0x95a906){var _0x17d61b=typeof _0x1a66e8['offset']==='undefined'&&typeof _0x1a66e8[_0x2e19('0x21')]===_0x2e19('0x22');var _0x443b4b=_0x95a906[_0x2e19('0x23')];var _0x23e02b=_0x17d61b?0x0:_0x1a66e8[_0x2e19('0x24')];var _0x304a6d=_0x17d61b?_0x95a906[_0x2e19('0x23')]:_0x1a66e8[_0x2e19('0x24')]+_0x1a66e8[_0x2e19('0x21')];var _0x18b17a;if(_0x304a6d>=_0x443b4b){_0x304a6d=_0x443b4b;_0x18b17a=0xc8;}else{_0x18b17a=0xce;}_0x159e49[_0x2e19('0x1e')](_0x18b17a);return _0x159e49['set'](_0x2e19('0x25'),_0x23e02b+'-'+_0x304a6d+'/'+_0x443b4b)[_0x2e19('0x20')](_0x95a906);}return null;};}function patchUpdates(_0x400063){return function(_0x1bcebe){try{jsonpatch['apply'](_0x1bcebe,_0x400063,!![]);}catch(_0x53b4b2){return BPromise['reject'](_0x53b4b2);}return _0x1bcebe[_0x2e19('0x26')]();};}function saveUpdates(_0x292d49,_0xe06133){return function(_0x159f04){if(_0x159f04){return _0x159f04['update'](_0x292d49)[_0x2e19('0x27')](function(_0x686b25){return _0x686b25;});}return null;};}function removeEntity(_0x51792c,_0x44f365){return function(_0x1c0a47){if(_0x1c0a47){return _0x1c0a47[_0x2e19('0x28')]()[_0x2e19('0x27')](function(){_0x51792c['status'](0xcc)[_0x2e19('0x1f')]();});}};}function handleEntityNotFound(_0x2e25b7,_0x16a6e5){return function(_0x422757){if(!_0x422757){_0x2e25b7[_0x2e19('0x1d')](0x194);}return _0x422757;};}function handleError(_0x45e433,_0x34946d){_0x34946d=_0x34946d||0x1f4;return function(_0x5d97ac){logger[_0x2e19('0x29')](_0x5d97ac[_0x2e19('0x2a')]);if(_0x5d97ac[_0x2e19('0x2b')]){delete _0x5d97ac[_0x2e19('0x2b')];}_0x45e433[_0x2e19('0x1e')](_0x34946d)[_0x2e19('0x2c')](_0x5d97ac);};}exports[_0x2e19('0x2d')]=function(_0x85cae0,_0x131f91){var _0x24fe8c={},_0x2633ef={},_0x8e0064={'count':0x0,'rows':[]};var _0x154a32=_[_0x2e19('0x2e')](db[_0x2e19('0x2f')][_0x2e19('0x30')],function(_0x3b0074){return{'name':_0x3b0074[_0x2e19('0x31')],'type':_0x3b0074[_0x2e19('0x32')]['key']};});_0x2633ef[_0x2e19('0x33')]=_['map'](_0x154a32,_0x2e19('0x2b'));_0x2633ef[_0x2e19('0x34')]=_['keys'](_0x85cae0[_0x2e19('0x34')]);_0x2633ef[_0x2e19('0x35')]=_[_0x2e19('0x36')](_0x2633ef[_0x2e19('0x33')],_0x2633ef[_0x2e19('0x34')]);_0x24fe8c[_0x2e19('0x37')]=_['intersection'](_0x2633ef['model'],qs[_0x2e19('0x38')](_0x85cae0[_0x2e19('0x34')][_0x2e19('0x38')]));_0x24fe8c[_0x2e19('0x37')]=_0x24fe8c[_0x2e19('0x37')]['length']?_0x24fe8c[_0x2e19('0x37')]:_0x2633ef[_0x2e19('0x33')];if(!_0x85cae0[_0x2e19('0x34')][_0x2e19('0x39')](_0x2e19('0x3a'))){_0x24fe8c[_0x2e19('0x21')]=qs[_0x2e19('0x21')](_0x85cae0[_0x2e19('0x34')]['limit']);_0x24fe8c[_0x2e19('0x24')]=qs[_0x2e19('0x24')](_0x85cae0['query'][_0x2e19('0x24')]);}_0x24fe8c[_0x2e19('0x3b')]=qs['sort'](_0x85cae0['query'][_0x2e19('0x3c')]);_0x24fe8c[_0x2e19('0x3d')]=qs[_0x2e19('0x35')](_['pick'](_0x85cae0['query'],_0x2633ef[_0x2e19('0x35')]),_0x154a32);if(_0x85cae0[_0x2e19('0x34')][_0x2e19('0x3e')]){_0x24fe8c[_0x2e19('0x3d')]=_[_0x2e19('0x3f')](_0x24fe8c[_0x2e19('0x3d')],{'$or':_[_0x2e19('0x2e')](_0x154a32,function(_0x14c609){if(_0x14c609[_0x2e19('0x32')]!=='VIRTUAL'){var _0x153b25={};_0x153b25[_0x14c609['name']]={'$like':'%'+_0x85cae0['query'][_0x2e19('0x3e')]+'%'};return _0x153b25;}})});}_0x24fe8c=_[_0x2e19('0x3f')]({},_0x24fe8c,_0x85cae0[_0x2e19('0x40')]);var _0x22894a={'where':_0x24fe8c[_0x2e19('0x3d')]};return db[_0x2e19('0x2f')][_0x2e19('0x23')](_0x22894a)[_0x2e19('0x27')](function(_0x2041a3){_0x8e0064[_0x2e19('0x23')]=_0x2041a3;if(_0x85cae0[_0x2e19('0x34')][_0x2e19('0x41')]){_0x24fe8c['include']=[{'all':!![]}];}return db[_0x2e19('0x2f')][_0x2e19('0x42')](_0x24fe8c);})[_0x2e19('0x27')](function(_0x423e7c){_0x8e0064[_0x2e19('0x43')]=_0x423e7c;return _0x8e0064;})[_0x2e19('0x27')](respondWithFilteredResult(_0x131f91,_0x24fe8c))[_0x2e19('0x44')](handleError(_0x131f91,null));};exports[_0x2e19('0x45')]=function(_0x52c0ec,_0x392b18){var _0xdd976b={'raw':!![],'where':{'id':_0x52c0ec[_0x2e19('0x46')]['id']}},_0x337e6c={};_0x337e6c[_0x2e19('0x33')]=_['keys'](db[_0x2e19('0x2f')][_0x2e19('0x30')]);_0x337e6c['query']=_[_0x2e19('0x47')](_0x52c0ec[_0x2e19('0x34')]);_0x337e6c[_0x2e19('0x35')]=_[_0x2e19('0x36')](_0x337e6c[_0x2e19('0x33')],_0x337e6c[_0x2e19('0x34')]);_0xdd976b[_0x2e19('0x37')]=_['intersection'](_0x337e6c[_0x2e19('0x33')],qs[_0x2e19('0x38')](_0x52c0ec[_0x2e19('0x34')]['fields']));_0xdd976b['attributes']=_0xdd976b[_0x2e19('0x37')][_0x2e19('0x48')]?_0xdd976b[_0x2e19('0x37')]:_0x337e6c['model'];if(_0x52c0ec['query'][_0x2e19('0x41')]){_0xdd976b['include']=[{'all':!![]}];}_0xdd976b=_['merge']({},_0xdd976b,_0x52c0ec[_0x2e19('0x40')]);return db[_0x2e19('0x2f')][_0x2e19('0x49')](_0xdd976b)[_0x2e19('0x27')](handleEntityNotFound(_0x392b18,null))[_0x2e19('0x27')](respondWithResult(_0x392b18,null))[_0x2e19('0x44')](handleError(_0x392b18,null));};exports[_0x2e19('0x4a')]=function(_0x37566e,_0x4de9d0){return db[_0x2e19('0x2f')][_0x2e19('0x4a')](_0x37566e['body'],{})[_0x2e19('0x27')](respondWithResult(_0x4de9d0,0xc9))[_0x2e19('0x44')](handleError(_0x4de9d0,null));};exports[_0x2e19('0x4b')]=function(_0xe4a8df,_0x19ca82){if(_0xe4a8df[_0x2e19('0x4c')]['id']){delete _0xe4a8df[_0x2e19('0x4c')]['id'];}return db[_0x2e19('0x2f')][_0x2e19('0x49')]({'where':{'id':_0xe4a8df[_0x2e19('0x46')]['id']}})[_0x2e19('0x27')](handleEntityNotFound(_0x19ca82,null))[_0x2e19('0x27')](saveUpdates(_0xe4a8df[_0x2e19('0x4c')],null))[_0x2e19('0x27')](respondWithResult(_0x19ca82,null))[_0x2e19('0x44')](handleError(_0x19ca82,null));};exports['destroy']=function(_0x226ff5,_0x17cc25){return db[_0x2e19('0x2f')][_0x2e19('0x49')]({'where':{'id':_0x226ff5[_0x2e19('0x46')]['id']}})[_0x2e19('0x27')](handleEntityNotFound(_0x17cc25,null))[_0x2e19('0x27')](removeEntity(_0x17cc25,null))['catch'](handleError(_0x17cc25,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index bcc2720..04eb833 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 _0x7f11=['define','AnalyticTreeReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./analyticTreeReport.attributes'];(function(_0x32f2d9,_0x547052){var _0x117ad6=function(_0x1027c5){while(--_0x1027c5){_0x32f2d9['push'](_0x32f2d9['shift']());}};_0x117ad6(++_0x547052);}(_0x7f11,0x66));var _0x17f1=function(_0x4c70db,_0x1df59d){_0x4c70db=_0x4c70db-0x0;var _0x1b7b25=_0x7f11[_0x4c70db];return _0x1b7b25;};'use strict';var _=require(_0x17f1('0x0'));var util=require('util');var logger=require(_0x17f1('0x1'))(_0x17f1('0x2'));var moment=require(_0x17f1('0x3'));var BPromise=require(_0x17f1('0x4'));var rp=require(_0x17f1('0x5'));var fs=require('fs');var path=require(_0x17f1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x17f1('0x7'));module['exports']=function(_0x226e14,_0x4c896d){return _0x226e14[_0x17f1('0x8')](_0x17f1('0x9'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0b1=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x49253c,_0x235b0d){var _0x42d467=function(_0x2cd2c7){while(--_0x2cd2c7){_0x49253c['push'](_0x49253c['shift']());}};_0x42d467(++_0x235b0d);}(_0xf0b1,0x1ae));var _0x1f0b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf0b1[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x1f0b('0x0'));var util=require(_0x1f0b('0x1'));var logger=require(_0x1f0b('0x2'))(_0x1f0b('0x3'));var moment=require(_0x1f0b('0x4'));var BPromise=require(_0x1f0b('0x5'));var rp=require(_0x1f0b('0x6'));var fs=require('fs');var path=require(_0x1f0b('0x7'));var rimraf=require(_0x1f0b('0x8'));var config=require(_0x1f0b('0x9'));var attributes=require(_0x1f0b('0xa'));module[_0x1f0b('0xb')]=function(_0x2a3e8f,_0x38d595){return _0x2a3e8f[_0x1f0b('0xc')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 53dd1a4..5b117bc 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x579117,_0x5d4f27){var _0x246084=function(_0x108795){while(--_0x108795){_0x579117['push'](_0x579117['shift']());}};_0x246084(++_0x5d4f27);}(_0x5f2f,0x73));var _0xf5f2=function(_0x24226d,_0x36ec22){_0x24226d=_0x24226d-0x0;var _0x4127bd=_0x5f2f[_0x24226d];return _0x4127bd;};'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')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +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(_0x421a7a,_0x19753e){var _0x4fab44=function(_0x2b857a){while(--_0x2b857a){_0x421a7a['push'](_0x421a7a['shift']());}};_0x4fab44(++_0x19753e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc4aa[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var 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 8d5b5f3..531a83d 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 _0xfd3f=['put','/:id','update','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','show','post','create'];(function(_0x28d7b5,_0x1305a4){var _0x1ed035=function(_0x57e1f6){while(--_0x57e1f6){_0x28d7b5['push'](_0x28d7b5['shift']());}};_0x1ed035(++_0x1305a4);}(_0xfd3f,0x1e4));var _0xffd3=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0xfd3f[_0x525af9];return _0x129fbf;};'use strict';var multer=require(_0xffd3('0x0'));var util=require(_0xffd3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xffd3('0x2')]();var fs_extra=require(_0xffd3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xffd3('0x4'));var config=require(_0xffd3('0x5'));var controller=require(_0xffd3('0x6'));router[_0xffd3('0x7')]('/',auth[_0xffd3('0x8')](),controller['index']);router[_0xffd3('0x7')]('/:id',auth[_0xffd3('0x8')](),controller[_0xffd3('0x9')]);router[_0xffd3('0xa')]('/',auth[_0xffd3('0x8')](),controller[_0xffd3('0xb')]);router[_0xffd3('0xc')](_0xffd3('0xd'),auth[_0xffd3('0x8')](),controller[_0xffd3('0xe')]);router['delete'](_0xffd3('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xffd3('0xf')]=router; \ No newline at end of file +var _0xd15a=['get','isAuthenticated','post','create','put','update','/:id','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','index'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xd15a,0x1dd));var _0xad15=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd15a[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xad15('0x0'));var path=require('path');var timeout=require(_0xad15('0x1'));var express=require(_0xad15('0x2'));var router=express['Router']();var fs_extra=require(_0xad15('0x3'));var auth=require(_0xad15('0x4'));var interaction=require(_0xad15('0x5'));var config=require(_0xad15('0x6'));var controller=require(_0xad15('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xad15('0x8')]);router[_0xad15('0x9')]('/:id',auth[_0xad15('0xa')](),controller['show']);router[_0xad15('0xb')]('/',auth[_0xad15('0xa')](),controller[_0xad15('0xc')]);router[_0xad15('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xad15('0xe')]);router['delete'](_0xad15('0xf'),auth['isAuthenticated'](),controller[_0xad15('0x10')]);module[_0xad15('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 700e9fe..eb825ee 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 _0x2fda=['sequelize','STRING'];(function(_0x6b686c,_0x197055){var _0x52f7e6=function(_0x571400){while(--_0x571400){_0x6b686c['push'](_0x6b686c['shift']());}};_0x52f7e6(++_0x197055);}(_0x2fda,0x186));var _0xa2fd=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x2fda[_0xf0bcac];return _0x4e4c65;};'use strict';var Sequelize=require(_0xa2fd('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xa2fd('0x1')]},'type':{'type':Sequelize[_0xa2fd('0x1')]}}; \ No newline at end of file +var _0xd6d6=['STRING','sequelize','exports'];(function(_0x2ea6b4,_0x4c6f08){var _0x56bfed=function(_0x577131){while(--_0x577131){_0x2ea6b4['push'](_0x2ea6b4['shift']());}};_0x56bfed(++_0x4c6f08);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x2b95f3,_0x58cc2f){_0x2b95f3=_0x2b95f3-0x0;var _0x18b017=_0xd6d6[_0x2b95f3];return _0x18b017;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'name':{'type':Sequelize[_0x6d6d('0x2')]},'basename':{'type':Sequelize[_0x6d6d('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index b924631..02e923f 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 _0x89f8=['util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','undefined','offset','count','set','Content-Range','apply','update','then','sendStatus','error','stack','send','index','Attachment','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','include','get','omit','createdAt','body','updatedAt','create','find','destroy','originalname','basename','file','mimetype','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x51f5c8,_0x2aa90d){var _0x30789e=function(_0x3c5640){while(--_0x3c5640){_0x51f5c8['push'](_0x51f5c8['shift']());}};_0x30789e(++_0x2aa90d);}(_0x89f8,0xb2));var _0x889f=function(_0x4c145e,_0x2a7ca6){_0x4c145e=_0x4c145e-0x0;var _0x159842=_0x89f8[_0x4c145e];return _0x159842;};'use strict';var emlformat=require(_0x889f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x889f('0x1'));var rp=require(_0x889f('0x2'));var moment=require(_0x889f('0x3'));var BPromise=require(_0x889f('0x4'));var Mustache=require(_0x889f('0x5'));var util=require(_0x889f('0x6'));var path=require(_0x889f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x889f('0x8'));var fs=require('fs');var fs_extra=require(_0x889f('0x9'));var _=require(_0x889f('0xa'));var squel=require(_0x889f('0xb'));var crypto=require(_0x889f('0xc'));var jsforce=require(_0x889f('0xd'));var deskjs=require(_0x889f('0xe'));var toCsv=require(_0x889f('0xf'));var querystring=require(_0x889f('0x10'));var Papa=require(_0x889f('0x11'));var Redis=require(_0x889f('0x12'));var authService=require(_0x889f('0x13'));var qs=require(_0x889f('0x14'));var as=require(_0x889f('0x15'));var hardwareService=require(_0x889f('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x889f('0x17'));var config=require(_0x889f('0x18'));var licenseUtil=require(_0x889f('0x19'));var db=require(_0x889f('0x1a'))['db'];function respondWithStatusCode(_0x4b9ea6,_0x1a558b){_0x1a558b=_0x1a558b||0xcc;return function(_0x53201b){if(_0x53201b){return _0x4b9ea6['sendStatus'](_0x1a558b);}return _0x4b9ea6[_0x889f('0x1b')](_0x1a558b)['end']();};}function respondWithResult(_0x35fc10,_0x36b6ef){_0x36b6ef=_0x36b6ef||0xc8;return function(_0x5efdca){if(_0x5efdca){return _0x35fc10[_0x889f('0x1b')](_0x36b6ef)[_0x889f('0x1c')](_0x5efdca);}};}function respondWithFilteredResult(_0x2be878,_0x59e671){return function(_0x271463){if(_0x271463){var _0x57c8cd=typeof _0x59e671['offset']==='undefined'&&typeof _0x59e671[_0x889f('0x1d')]===_0x889f('0x1e');var _0x23bafa=_0x271463['count'];var _0x209b00=_0x57c8cd?0x0:_0x59e671[_0x889f('0x1f')];var _0x3b530f=_0x57c8cd?_0x271463[_0x889f('0x20')]:_0x59e671[_0x889f('0x1f')]+_0x59e671[_0x889f('0x1d')];var _0x8dce8a;if(_0x3b530f>=_0x23bafa){_0x3b530f=_0x23bafa;_0x8dce8a=0xc8;}else{_0x8dce8a=0xce;}_0x2be878['status'](_0x8dce8a);return _0x2be878[_0x889f('0x21')](_0x889f('0x22'),_0x209b00+'-'+_0x3b530f+'/'+_0x23bafa)[_0x889f('0x1c')](_0x271463);}return null;};}function patchUpdates(_0x4786ef){return function(_0x1a5216){try{jsonpatch[_0x889f('0x23')](_0x1a5216,_0x4786ef,!![]);}catch(_0xa47325){return BPromise['reject'](_0xa47325);}return _0x1a5216['save']();};}function saveUpdates(_0x20a9e5,_0x5e447a){return function(_0x51dbee){if(_0x51dbee){return _0x51dbee[_0x889f('0x24')](_0x20a9e5)[_0x889f('0x25')](function(_0x37832c){return _0x37832c;});}return null;};}function removeEntity(_0x1426bd,_0x5bf909){return function(_0x5f10b8){if(_0x5f10b8){return _0x5f10b8['destroy']()['then'](function(){_0x1426bd[_0x889f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x238c87,_0x5f118a){return function(_0x52362e){if(!_0x52362e){_0x238c87[_0x889f('0x26')](0x194);}return _0x52362e;};}function handleError(_0xcc290d,_0x4a70bb){_0x4a70bb=_0x4a70bb||0x1f4;return function(_0x23ef54){logger[_0x889f('0x27')](_0x23ef54[_0x889f('0x28')]);if(_0x23ef54['name']){delete _0x23ef54['name'];}_0xcc290d[_0x889f('0x1b')](_0x4a70bb)[_0x889f('0x29')](_0x23ef54);};}exports[_0x889f('0x2a')]=function(_0x588f81,_0x56ef9c){var _0x504b0c={},_0x1f2e90={},_0x5e74f9={'count':0x0,'rows':[]};var _0x232b84=_['map'](db[_0x889f('0x2b')][_0x889f('0x2c')],function(_0x2769ed){return{'name':_0x2769ed[_0x889f('0x2d')],'type':_0x2769ed[_0x889f('0x2e')][_0x889f('0x2f')]};});_0x1f2e90[_0x889f('0x30')]=_[_0x889f('0x31')](_0x232b84,_0x889f('0x32'));_0x1f2e90[_0x889f('0x33')]=_[_0x889f('0x34')](_0x588f81[_0x889f('0x33')]);_0x1f2e90[_0x889f('0x35')]=_[_0x889f('0x36')](_0x1f2e90[_0x889f('0x30')],_0x1f2e90['query']);_0x504b0c[_0x889f('0x37')]=_[_0x889f('0x36')](_0x1f2e90[_0x889f('0x30')],qs['fields'](_0x588f81['query'][_0x889f('0x38')]));_0x504b0c[_0x889f('0x37')]=_0x504b0c['attributes'][_0x889f('0x39')]?_0x504b0c['attributes']:_0x1f2e90[_0x889f('0x30')];if(!_0x588f81[_0x889f('0x33')][_0x889f('0x3a')](_0x889f('0x3b'))){_0x504b0c['limit']=qs[_0x889f('0x1d')](_0x588f81[_0x889f('0x33')][_0x889f('0x1d')]);_0x504b0c[_0x889f('0x1f')]=qs[_0x889f('0x1f')](_0x588f81[_0x889f('0x33')][_0x889f('0x1f')]);}_0x504b0c[_0x889f('0x3c')]=qs[_0x889f('0x3d')](_0x588f81[_0x889f('0x33')][_0x889f('0x3d')]);_0x504b0c['where']=qs[_0x889f('0x35')](_[_0x889f('0x3e')](_0x588f81[_0x889f('0x33')],_0x1f2e90[_0x889f('0x35')]),_0x232b84);if(_0x588f81[_0x889f('0x33')][_0x889f('0x3f')]){_0x504b0c[_0x889f('0x40')]=_['merge'](_0x504b0c['where'],{'$or':_['map'](_0x232b84,function(_0x3541bf){if(_0x3541bf[_0x889f('0x2e')]!==_0x889f('0x41')){var _0x178942={};_0x178942[_0x3541bf['name']]={'$like':'%'+_0x588f81[_0x889f('0x33')][_0x889f('0x3f')]+'%'};return _0x178942;}})});}_0x504b0c=_[_0x889f('0x42')]({},_0x504b0c,_0x588f81[_0x889f('0x43')]);var _0x2c956a={'where':_0x504b0c['where']};return db[_0x889f('0x2b')]['count'](_0x2c956a)[_0x889f('0x25')](function(_0x55878f){_0x5e74f9['count']=_0x55878f;if(_0x588f81[_0x889f('0x33')][_0x889f('0x44')]){_0x504b0c['include']=[{'all':!![]}];}return db[_0x889f('0x2b')][_0x889f('0x45')](_0x504b0c);})['then'](function(_0x3b5f99){_0x5e74f9[_0x889f('0x46')]=_0x3b5f99;return _0x5e74f9;})[_0x889f('0x25')](respondWithFilteredResult(_0x56ef9c,_0x504b0c))[_0x889f('0x47')](handleError(_0x56ef9c,null));};exports['show']=function(_0x5ed1c4,_0x31806a){var _0x134cfd={'raw':!![],'where':{'id':_0x5ed1c4[_0x889f('0x48')]['id']}},_0x11f772={};_0x11f772[_0x889f('0x30')]=_[_0x889f('0x34')](db[_0x889f('0x2b')][_0x889f('0x2c')]);_0x11f772['query']=_['keys'](_0x5ed1c4[_0x889f('0x33')]);_0x11f772[_0x889f('0x35')]=_['intersection'](_0x11f772[_0x889f('0x30')],_0x11f772[_0x889f('0x33')]);_0x134cfd[_0x889f('0x37')]=_[_0x889f('0x36')](_0x11f772['model'],qs[_0x889f('0x38')](_0x5ed1c4['query'][_0x889f('0x38')]));_0x134cfd[_0x889f('0x37')]=_0x134cfd[_0x889f('0x37')][_0x889f('0x39')]?_0x134cfd[_0x889f('0x37')]:_0x11f772[_0x889f('0x30')];if(_0x5ed1c4[_0x889f('0x33')][_0x889f('0x44')]){_0x134cfd[_0x889f('0x49')]=[{'all':!![]}];}_0x134cfd=_[_0x889f('0x42')]({},_0x134cfd,_0x5ed1c4['options']);return db[_0x889f('0x2b')]['find'](_0x134cfd)['then'](handleEntityNotFound(_0x31806a,null))[_0x889f('0x25')](respondWithResult(_0x31806a,null))[_0x889f('0x47')](handleError(_0x31806a,null));};exports['clone']=function(_0x2c6dcf,_0x480543){var _0x302b21={'where':{'id':_0x2c6dcf['params']['id']}},_0x9c77fc={};_0x9c77fc[_0x889f('0x30')]=_[_0x889f('0x34')](db['Attachment'][_0x889f('0x2c')]);_0x302b21[_0x889f('0x37')]=_[_0x889f('0x36')](_0x9c77fc[_0x889f('0x30')],qs[_0x889f('0x38')](_0x2c6dcf['query'][_0x889f('0x38')]));_0x302b21['attributes']=_0x302b21[_0x889f('0x37')][_0x889f('0x39')]?_0x302b21[_0x889f('0x37')]:_0x9c77fc[_0x889f('0x30')];if(_0x2c6dcf['query'][_0x889f('0x44')]){_0x302b21[_0x889f('0x49')]=[{'all':!![]}];}_0x302b21=_[_0x889f('0x42')]({},_0x302b21,_0x2c6dcf[_0x889f('0x43')]);return db[_0x889f('0x2b')]['find'](_0x302b21)[_0x889f('0x25')](handleEntityNotFound(_0x480543,null))[_0x889f('0x25')](function(_0x582440){if(_0x582440){var _0x3e14d5=_0x582440[_0x889f('0x4a')]({'plain':!![]});_0x3e14d5=qs[_0x889f('0x4b')](_0x3e14d5,['id',_0x889f('0x4c'),'updatedAt']);_0x2c6dcf[_0x889f('0x4d')]=_[_0x889f('0x4b')](_0x2c6dcf[_0x889f('0x4d')],['id',_0x889f('0x4c'),_0x889f('0x4e')]);return db[_0x889f('0x2b')][_0x889f('0x4f')](_[_0x889f('0x42')](_0x3e14d5,_0x2c6dcf[_0x889f('0x4d')]),{'include':_0x2c6dcf['query'][_0x889f('0x44')]?[{'all':!![]}]:undefined});}})[_0x889f('0x25')](respondWithResult(_0x480543,0xc9))['catch'](handleError(_0x480543,null));};exports[_0x889f('0x24')]=function(_0x3f851a,_0xf4631f){if(_0x3f851a['body']['id']){delete _0x3f851a[_0x889f('0x4d')]['id'];}return db[_0x889f('0x2b')][_0x889f('0x50')]({'where':{'id':_0x3f851a[_0x889f('0x48')]['id']}})[_0x889f('0x25')](handleEntityNotFound(_0xf4631f,null))['then'](saveUpdates(_0x3f851a[_0x889f('0x4d')],null))['then'](respondWithResult(_0xf4631f,null))[_0x889f('0x47')](handleError(_0xf4631f,null));};exports[_0x889f('0x51')]=function(_0x358ca0,_0x6d0d04){return db[_0x889f('0x2b')][_0x889f('0x50')]({'where':{'id':_0x358ca0[_0x889f('0x48')]['id']}})[_0x889f('0x25')](handleEntityNotFound(_0x6d0d04,null))[_0x889f('0x25')](removeEntity(_0x6d0d04,null))[_0x889f('0x47')](handleError(_0x6d0d04,null));};exports[_0x889f('0x4f')]=function(_0x34415b,_0x275546,_0x2ccf03){_0x34415b[_0x889f('0x4d')][_0x889f('0x32')]=_0x34415b['file'][_0x889f('0x52')];_0x34415b[_0x889f('0x4d')][_0x889f('0x53')]=_0x34415b[_0x889f('0x54')]['filename'];_0x34415b[_0x889f('0x4d')]['type']=_0x34415b['file'][_0x889f('0x55')];return db[_0x889f('0x2b')]['create'](_0x34415b[_0x889f('0x4d')])[_0x889f('0x25')](respondWithResult(_0x275546,0xc9))[_0x889f('0x47')](handleError(_0x275546,null));};exports[_0x889f('0x56')]=function(_0x5d2524,_0x582f60,_0x27fcf1){return db['Attachment'][_0x889f('0x57')]({'where':{'id':_0x5d2524['params']['id']},'raw':!![]})[_0x889f('0x25')](handleEntityNotFound(_0x582f60,null))['then'](function(_0x335ffb){if(_0x335ffb){var _0x1f6c40=_0x335ffb[_0x889f('0x58')]!==null;var _0x2b1693=path[_0x889f('0x59')](config[_0x889f('0x5a')],'server/files/attachments/');if(_0x1f6c40){_0x2b1693=path[_0x889f('0x59')](_0x2b1693,_0x889f('0x5b'));}var _0x39c7b8=path[_0x889f('0x59')](_0x2b1693,_0x335ffb[_0x889f('0x53')]);return _0x582f60['download'](_0x39c7b8);}})[_0x889f('0x47')](handleError(_0x582f60,null));}; \ No newline at end of file +var _0x6835=['catch','clone','createdAt','updatedAt','body','omit','create','file','originalname','basename','filename','mimetype','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','save','update','then','destroy','sendStatus','name','index','map','Attachment','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','show','params','keys','includeAll','find'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x6835,0x1b2));var _0x5683=function(_0x3523f0,_0x47c0ef){_0x3523f0=_0x3523f0-0x0;var _0x3ea56b=_0x6835[_0x3523f0];return _0x3ea56b;};'use strict';var emlformat=require(_0x5683('0x0'));var rimraf=require(_0x5683('0x1'));var zipdir=require(_0x5683('0x2'));var jsonpatch=require(_0x5683('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5683('0x4'));var Mustache=require(_0x5683('0x5'));var util=require(_0x5683('0x6'));var path=require(_0x5683('0x7'));var sox=require('sox');var csv=require(_0x5683('0x8'));var ejs=require(_0x5683('0x9'));var fs=require('fs');var fs_extra=require(_0x5683('0xa'));var _=require(_0x5683('0xb'));var squel=require(_0x5683('0xc'));var crypto=require('crypto');var jsforce=require(_0x5683('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5683('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5683('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5683('0x10'));var hardwareService=require(_0x5683('0x11'));var logger=require('../../config/logger')(_0x5683('0x12'));var utils=require(_0x5683('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5683('0x14'))['db'];function respondWithStatusCode(_0x104a31,_0x23afab){_0x23afab=_0x23afab||0xcc;return function(_0x13d628){if(_0x13d628){return _0x104a31['sendStatus'](_0x23afab);}return _0x104a31[_0x5683('0x15')](_0x23afab)[_0x5683('0x16')]();};}function respondWithResult(_0x3edb5b,_0x12adc7){_0x12adc7=_0x12adc7||0xc8;return function(_0x565583){if(_0x565583){return _0x3edb5b[_0x5683('0x15')](_0x12adc7)[_0x5683('0x17')](_0x565583);}};}function respondWithFilteredResult(_0x4ec84f,_0x11ddd7){return function(_0x1f4004){if(_0x1f4004){var _0x514ef6=typeof _0x11ddd7[_0x5683('0x18')]===_0x5683('0x19')&&typeof _0x11ddd7[_0x5683('0x1a')]===_0x5683('0x19');var _0x18ceaf=_0x1f4004['count'];var _0x301da8=_0x514ef6?0x0:_0x11ddd7['offset'];var _0x2c3ccb=_0x514ef6?_0x1f4004['count']:_0x11ddd7[_0x5683('0x18')]+_0x11ddd7[_0x5683('0x1a')];var _0x17d2e9;if(_0x2c3ccb>=_0x18ceaf){_0x2c3ccb=_0x18ceaf;_0x17d2e9=0xc8;}else{_0x17d2e9=0xce;}_0x4ec84f[_0x5683('0x15')](_0x17d2e9);return _0x4ec84f['set']('Content-Range',_0x301da8+'-'+_0x2c3ccb+'/'+_0x18ceaf)[_0x5683('0x17')](_0x1f4004);}return null;};}function patchUpdates(_0x34c63b){return function(_0x4e4efc){try{jsonpatch['apply'](_0x4e4efc,_0x34c63b,!![]);}catch(_0x516887){return BPromise['reject'](_0x516887);}return _0x4e4efc[_0x5683('0x1b')]();};}function saveUpdates(_0x10f31e,_0x45e789){return function(_0x257ae1){if(_0x257ae1){return _0x257ae1[_0x5683('0x1c')](_0x10f31e)[_0x5683('0x1d')](function(_0x2e1528){return _0x2e1528;});}return null;};}function removeEntity(_0x3b0a1d,_0x1f2014){return function(_0x378c9f){if(_0x378c9f){return _0x378c9f[_0x5683('0x1e')]()[_0x5683('0x1d')](function(){_0x3b0a1d[_0x5683('0x15')](0xcc)[_0x5683('0x16')]();});}};}function handleEntityNotFound(_0x439890,_0x2aab25){return function(_0x4cb8be){if(!_0x4cb8be){_0x439890[_0x5683('0x1f')](0x194);}return _0x4cb8be;};}function handleError(_0x490bec,_0x3df662){_0x3df662=_0x3df662||0x1f4;return function(_0x28f373){logger['error'](_0x28f373['stack']);if(_0x28f373['name']){delete _0x28f373[_0x5683('0x20')];}_0x490bec['status'](_0x3df662)['send'](_0x28f373);};}exports[_0x5683('0x21')]=function(_0x1bcad5,_0x49f598){var _0x24373d={},_0x3e036d={},_0x46bb19={'count':0x0,'rows':[]};var _0x2c46d3=_[_0x5683('0x22')](db[_0x5683('0x23')][_0x5683('0x24')],function(_0x2af320){return{'name':_0x2af320['fieldName'],'type':_0x2af320[_0x5683('0x25')][_0x5683('0x26')]};});_0x3e036d[_0x5683('0x27')]=_[_0x5683('0x22')](_0x2c46d3,_0x5683('0x20'));_0x3e036d[_0x5683('0x28')]=_['keys'](_0x1bcad5['query']);_0x3e036d[_0x5683('0x29')]=_['intersection'](_0x3e036d[_0x5683('0x27')],_0x3e036d['query']);_0x24373d['attributes']=_[_0x5683('0x2a')](_0x3e036d[_0x5683('0x27')],qs[_0x5683('0x2b')](_0x1bcad5[_0x5683('0x28')]['fields']));_0x24373d['attributes']=_0x24373d[_0x5683('0x2c')][_0x5683('0x2d')]?_0x24373d[_0x5683('0x2c')]:_0x3e036d[_0x5683('0x27')];if(!_0x1bcad5[_0x5683('0x28')][_0x5683('0x2e')](_0x5683('0x2f'))){_0x24373d[_0x5683('0x1a')]=qs['limit'](_0x1bcad5[_0x5683('0x28')][_0x5683('0x1a')]);_0x24373d[_0x5683('0x18')]=qs[_0x5683('0x18')](_0x1bcad5[_0x5683('0x28')][_0x5683('0x18')]);}_0x24373d[_0x5683('0x30')]=qs[_0x5683('0x31')](_0x1bcad5[_0x5683('0x28')][_0x5683('0x31')]);_0x24373d[_0x5683('0x32')]=qs[_0x5683('0x29')](_[_0x5683('0x33')](_0x1bcad5[_0x5683('0x28')],_0x3e036d[_0x5683('0x29')]),_0x2c46d3);if(_0x1bcad5['query'][_0x5683('0x34')]){_0x24373d[_0x5683('0x32')]=_[_0x5683('0x35')](_0x24373d['where'],{'$or':_[_0x5683('0x22')](_0x2c46d3,function(_0x374c24){if(_0x374c24['type']!==_0x5683('0x36')){var _0x528b02={};_0x528b02[_0x374c24['name']]={'$like':'%'+_0x1bcad5[_0x5683('0x28')]['filter']+'%'};return _0x528b02;}})});}_0x24373d=_['merge']({},_0x24373d,_0x1bcad5[_0x5683('0x37')]);var _0x1da2bd={'where':_0x24373d[_0x5683('0x32')]};return db['Attachment'][_0x5683('0x38')](_0x1da2bd)[_0x5683('0x1d')](function(_0x3019cf){_0x46bb19['count']=_0x3019cf;if(_0x1bcad5[_0x5683('0x28')]['includeAll']){_0x24373d[_0x5683('0x39')]=[{'all':!![]}];}return db['Attachment'][_0x5683('0x3a')](_0x24373d);})[_0x5683('0x1d')](function(_0x392234){_0x46bb19['rows']=_0x392234;return _0x46bb19;})[_0x5683('0x1d')](respondWithFilteredResult(_0x49f598,_0x24373d))['catch'](handleError(_0x49f598,null));};exports[_0x5683('0x3b')]=function(_0x5353a8,_0x25b870){var _0x58983f={'raw':!![],'where':{'id':_0x5353a8[_0x5683('0x3c')]['id']}},_0x96a69f={};_0x96a69f[_0x5683('0x27')]=_[_0x5683('0x3d')](db[_0x5683('0x23')][_0x5683('0x24')]);_0x96a69f[_0x5683('0x28')]=_[_0x5683('0x3d')](_0x5353a8[_0x5683('0x28')]);_0x96a69f[_0x5683('0x29')]=_['intersection'](_0x96a69f['model'],_0x96a69f[_0x5683('0x28')]);_0x58983f[_0x5683('0x2c')]=_['intersection'](_0x96a69f[_0x5683('0x27')],qs[_0x5683('0x2b')](_0x5353a8[_0x5683('0x28')][_0x5683('0x2b')]));_0x58983f[_0x5683('0x2c')]=_0x58983f[_0x5683('0x2c')][_0x5683('0x2d')]?_0x58983f['attributes']:_0x96a69f[_0x5683('0x27')];if(_0x5353a8['query'][_0x5683('0x3e')]){_0x58983f['include']=[{'all':!![]}];}_0x58983f=_[_0x5683('0x35')]({},_0x58983f,_0x5353a8[_0x5683('0x37')]);return db[_0x5683('0x23')][_0x5683('0x3f')](_0x58983f)[_0x5683('0x1d')](handleEntityNotFound(_0x25b870,null))[_0x5683('0x1d')](respondWithResult(_0x25b870,null))[_0x5683('0x40')](handleError(_0x25b870,null));};exports[_0x5683('0x41')]=function(_0x5297f8,_0x312bcc){var _0x482fd0={'where':{'id':_0x5297f8['params']['id']}},_0x39abf9={};_0x39abf9['model']=_[_0x5683('0x3d')](db[_0x5683('0x23')][_0x5683('0x24')]);_0x482fd0[_0x5683('0x2c')]=_[_0x5683('0x2a')](_0x39abf9[_0x5683('0x27')],qs[_0x5683('0x2b')](_0x5297f8[_0x5683('0x28')][_0x5683('0x2b')]));_0x482fd0[_0x5683('0x2c')]=_0x482fd0[_0x5683('0x2c')][_0x5683('0x2d')]?_0x482fd0[_0x5683('0x2c')]:_0x39abf9[_0x5683('0x27')];if(_0x5297f8[_0x5683('0x28')][_0x5683('0x3e')]){_0x482fd0[_0x5683('0x39')]=[{'all':!![]}];}_0x482fd0=_[_0x5683('0x35')]({},_0x482fd0,_0x5297f8[_0x5683('0x37')]);return db['Attachment']['find'](_0x482fd0)[_0x5683('0x1d')](handleEntityNotFound(_0x312bcc,null))['then'](function(_0x4053be){if(_0x4053be){var _0x29a812=_0x4053be['get']({'plain':!![]});_0x29a812=qs['omit'](_0x29a812,['id',_0x5683('0x42'),_0x5683('0x43')]);_0x5297f8[_0x5683('0x44')]=_[_0x5683('0x45')](_0x5297f8[_0x5683('0x44')],['id',_0x5683('0x42'),_0x5683('0x43')]);return db[_0x5683('0x23')][_0x5683('0x46')](_[_0x5683('0x35')](_0x29a812,_0x5297f8[_0x5683('0x44')]),{'include':_0x5297f8[_0x5683('0x28')][_0x5683('0x3e')]?[{'all':!![]}]:undefined});}})[_0x5683('0x1d')](respondWithResult(_0x312bcc,0xc9))[_0x5683('0x40')](handleError(_0x312bcc,null));};exports[_0x5683('0x1c')]=function(_0x44c944,_0x206a1e){if(_0x44c944[_0x5683('0x44')]['id']){delete _0x44c944['body']['id'];}return db[_0x5683('0x23')][_0x5683('0x3f')]({'where':{'id':_0x44c944[_0x5683('0x3c')]['id']}})[_0x5683('0x1d')](handleEntityNotFound(_0x206a1e,null))[_0x5683('0x1d')](saveUpdates(_0x44c944[_0x5683('0x44')],null))['then'](respondWithResult(_0x206a1e,null))[_0x5683('0x40')](handleError(_0x206a1e,null));};exports['destroy']=function(_0x3cb8a4,_0x5ee403){return db[_0x5683('0x23')]['find']({'where':{'id':_0x3cb8a4[_0x5683('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5ee403,null))[_0x5683('0x1d')](removeEntity(_0x5ee403,null))[_0x5683('0x40')](handleError(_0x5ee403,null));};exports[_0x5683('0x46')]=function(_0xaa50e8,_0x1c888b,_0x13a956){_0xaa50e8['body'][_0x5683('0x20')]=_0xaa50e8[_0x5683('0x47')][_0x5683('0x48')];_0xaa50e8[_0x5683('0x44')][_0x5683('0x49')]=_0xaa50e8[_0x5683('0x47')][_0x5683('0x4a')];_0xaa50e8[_0x5683('0x44')][_0x5683('0x25')]=_0xaa50e8[_0x5683('0x47')][_0x5683('0x4b')];return db[_0x5683('0x23')][_0x5683('0x46')](_0xaa50e8['body'])[_0x5683('0x1d')](respondWithResult(_0x1c888b,0xc9))[_0x5683('0x40')](handleError(_0x1c888b,null));};exports['download']=function(_0x30bd95,_0x437fc8,_0x2dac2d){return db[_0x5683('0x23')][_0x5683('0x4c')]({'where':{'id':_0x30bd95[_0x5683('0x3c')]['id']},'raw':!![]})[_0x5683('0x1d')](handleEntityNotFound(_0x437fc8,null))[_0x5683('0x1d')](function(_0x4ab746){if(_0x4ab746){var _0xec1333=_0x4ab746[_0x5683('0x4d')]!==null;var _0x2fedce=path[_0x5683('0x4e')](config[_0x5683('0x4f')],_0x5683('0x50'));if(_0xec1333){_0x2fedce=path['join'](_0x2fedce,_0x5683('0x51'));}var _0xd4293e=path[_0x5683('0x4e')](_0x2fedce,_0x4ab746[_0x5683('0x49')]);return _0x437fc8[_0x5683('0x52')](_0xd4293e);}})[_0x5683('0x40')](handleError(_0x437fc8,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 4644915..ce52919 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 _0xfe8f=['exports','define','Attachment','attachments','lodash','util','../../config/logger','moment','./attachment.attributes'];(function(_0x59cd21,_0x231dc9){var _0x1a4964=function(_0x49aa20){while(--_0x49aa20){_0x59cd21['push'](_0x59cd21['shift']());}};_0x1a4964(++_0x231dc9);}(_0xfe8f,0xc1));var _0xffe8=function(_0x46287f,_0x5498c8){_0x46287f=_0x46287f-0x0;var _0xbea8e=_0xfe8f[_0x46287f];return _0xbea8e;};'use strict';var _=require(_0xffe8('0x0'));var util=require(_0xffe8('0x1'));var logger=require(_0xffe8('0x2'))('api');var moment=require(_0xffe8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xffe8('0x4'));module[_0xffe8('0x5')]=function(_0x52fb1f,_0x332ba1){return _0x52fb1f[_0xffe8('0x6')](_0xffe8('0x7'),attributes,{'tableName':_0xffe8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf30=['util','api','moment','request-promise','path','rimraf','../../config/environment','./attachment.attributes','define','Attachment','attachments','lodash'];(function(_0x4ee5a8,_0x82f571){var _0x326b22=function(_0x59927e){while(--_0x59927e){_0x4ee5a8['push'](_0x4ee5a8['shift']());}};_0x326b22(++_0x82f571);}(_0xaf30,0x1d3));var _0x0af3=function(_0x2bd1ec,_0x3fe65f){_0x2bd1ec=_0x2bd1ec-0x0;var _0x2f7577=_0xaf30[_0x2bd1ec];return _0x2f7577;};'use strict';var _=require(_0x0af3('0x0'));var util=require(_0x0af3('0x1'));var logger=require('../../config/logger')(_0x0af3('0x2'));var moment=require(_0x0af3('0x3'));var BPromise=require('bluebird');var rp=require(_0x0af3('0x4'));var fs=require('fs');var path=require(_0x0af3('0x5'));var rimraf=require(_0x0af3('0x6'));var config=require(_0x0af3('0x7'));var attributes=require(_0x0af3('0x8'));module['exports']=function(_0x518e9f,_0x285bba){return _0x518e9f[_0x0af3('0x9')](_0x0af3('0xa'),attributes,{'tableName':_0x0af3('0xb'),'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 e4242b7..7d63c90 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 _0x20ce=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateAttachment','Attachment','body','options','raw','lodash'];(function(_0x3d88af,_0x239079){var _0x598f38=function(_0x397f9e){while(--_0x397f9e){_0x3d88af['push'](_0x3d88af['shift']());}};_0x598f38(++_0x239079);}(_0x20ce,0x10d));var _0xe20c=function(_0x2eb40a,_0x383c64){_0x2eb40a=_0x2eb40a-0x0;var _0x221cff=_0x20ce[_0x2eb40a];return _0x221cff;};'use strict';var _=require(_0xe20c('0x0'));var util=require(_0xe20c('0x1'));var moment=require(_0xe20c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe20c('0x3'));var fs=require('fs');var Redis=require(_0xe20c('0x4'));var db=require(_0xe20c('0x5'))['db'];var utils=require(_0xe20c('0x6'));var logger=require(_0xe20c('0x7'))(_0xe20c('0x8'));var config=require(_0xe20c('0x9'));var jayson=require(_0xe20c('0xa'));var client=jayson[_0xe20c('0xb')][_0xe20c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x893e48,_0x26b9be,_0x2d88b5){return new BPromise(function(_0x8f79ad,_0x290fb5){return client[_0xe20c('0xd')](_0x893e48,_0x2d88b5)[_0xe20c('0xe')](function(_0x385d61){logger[_0xe20c('0xf')](_0xe20c('0x10'),_0x26b9be,_0xe20c('0x11'));logger[_0xe20c('0x12')](_0xe20c('0x13'),_0x26b9be,_0xe20c('0x11'),JSON['stringify'](_0x385d61));if(_0x385d61[_0xe20c('0x14')]){if(_0x385d61[_0xe20c('0x14')][_0xe20c('0x15')]===0x1f4){logger[_0xe20c('0x14')](_0xe20c('0x10'),_0x26b9be,_0x385d61['error'][_0xe20c('0x16')]);return _0x290fb5(_0x385d61[_0xe20c('0x14')]['message']);}logger[_0xe20c('0x14')](_0xe20c('0x10'),_0x26b9be,_0x385d61[_0xe20c('0x14')]['message']);return _0x8f79ad(_0x385d61[_0xe20c('0x14')][_0xe20c('0x16')]);}else{logger[_0xe20c('0xf')](_0xe20c('0x10'),_0x26b9be,'request\x20sent');_0x8f79ad(_0x385d61[_0xe20c('0x17')]['message']);}})[_0xe20c('0x18')](function(_0x4061ed){logger[_0xe20c('0x14')](_0xe20c('0x10'),_0x26b9be,_0x4061ed);_0x290fb5(_0x4061ed);});});}exports[_0xe20c('0x19')]=function(_0x2d58a7){var _0x2a4292=this;return new Promise(function(_0x3d8df5,_0x305f2f){return db[_0xe20c('0x1a')]['create'](_0x2d58a7[_0xe20c('0x1b')],{'raw':_0x2d58a7[_0xe20c('0x1c')]?_0x2d58a7[_0xe20c('0x1c')][_0xe20c('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x563070){logger[_0xe20c('0xf')](_0xe20c('0x19'),_0x2d58a7);logger[_0xe20c('0x12')]('CreateAttachment',_0x2d58a7,JSON['stringify'](_0x563070));_0x3d8df5(_0x563070);})[_0xe20c('0x18')](function(_0x281449){logger[_0xe20c('0x14')](_0xe20c('0x19'),_0x281449['message'],_0x2d58a7);_0x305f2f(_0x2a4292[_0xe20c('0x14')](0x1f4,_0x281449['message']));});});}; \ No newline at end of file +var _0x1e69=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','CreateAttachment','Attachment','create','body','options','raw','then','catch','util','moment'];(function(_0xf7e64c,_0x5caaf5){var _0x1b0084=function(_0x440417){while(--_0x440417){_0xf7e64c['push'](_0xf7e64c['shift']());}};_0x1b0084(++_0x5caaf5);}(_0x1e69,0x85));var _0x91e6=function(_0x2777f3,_0x1526f9){_0x2777f3=_0x2777f3-0x0;var _0x413144=_0x1e69[_0x2777f3];return _0x413144;};'use strict';var _=require('lodash');var util=require(_0x91e6('0x0'));var moment=require(_0x91e6('0x1'));var BPromise=require(_0x91e6('0x2'));var rs=require(_0x91e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x91e6('0x4'));var logger=require(_0x91e6('0x5'))(_0x91e6('0x6'));var config=require(_0x91e6('0x7'));var jayson=require(_0x91e6('0x8'));var client=jayson[_0x91e6('0x9')][_0x91e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2733bf,_0x1347c3,_0x375184){return new BPromise(function(_0x266fe6,_0x46edd7){return client[_0x91e6('0xb')](_0x2733bf,_0x375184)['then'](function(_0x57682b){logger[_0x91e6('0xc')](_0x91e6('0xd'),_0x1347c3,_0x91e6('0xe'));logger[_0x91e6('0xf')]('Attachment,\x20%s,\x20%s,\x20%s',_0x1347c3,_0x91e6('0xe'),JSON[_0x91e6('0x10')](_0x57682b));if(_0x57682b[_0x91e6('0x11')]){if(_0x57682b[_0x91e6('0x11')]['code']===0x1f4){logger[_0x91e6('0x11')](_0x91e6('0xd'),_0x1347c3,_0x57682b[_0x91e6('0x11')][_0x91e6('0x12')]);return _0x46edd7(_0x57682b[_0x91e6('0x11')][_0x91e6('0x12')]);}logger[_0x91e6('0x11')]('Attachment,\x20%s,\x20%s',_0x1347c3,_0x57682b[_0x91e6('0x11')][_0x91e6('0x12')]);return _0x266fe6(_0x57682b[_0x91e6('0x11')][_0x91e6('0x12')]);}else{logger['info'](_0x91e6('0xd'),_0x1347c3,_0x91e6('0xe'));_0x266fe6(_0x57682b['result'][_0x91e6('0x12')]);}})['catch'](function(_0x57d30d){logger['error']('Attachment,\x20%s,\x20%s',_0x1347c3,_0x57d30d);_0x46edd7(_0x57d30d);});});}exports[_0x91e6('0x13')]=function(_0xdc9327){var _0x4b53b0=this;return new Promise(function(_0x5bda45,_0x368329){return db[_0x91e6('0x14')][_0x91e6('0x15')](_0xdc9327[_0x91e6('0x16')],{'raw':_0xdc9327[_0x91e6('0x17')]?_0xdc9327[_0x91e6('0x17')][_0x91e6('0x18')]===undefined?!![]:![]:!![]})[_0x91e6('0x19')](function(_0x604e03){logger[_0x91e6('0xc')]('CreateAttachment',_0xdc9327);logger[_0x91e6('0xf')](_0x91e6('0x13'),_0xdc9327,JSON[_0x91e6('0x10')](_0x604e03));_0x5bda45(_0x604e03);})[_0x91e6('0x1a')](function(_0x29172b){logger[_0x91e6('0x11')]('CreateAttachment',_0x29172b['message'],_0xdc9327);_0x368329(_0x4b53b0[_0x91e6('0x11')](0x1f4,_0x29172b[_0x91e6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 448be46..3ec444d 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 _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x48661d,_0x4f7a43){var _0x462d59=function(_0x5c5e3c){while(--_0x5c5e3c){_0x48661d['push'](_0x48661d['shift']());}};_0x462d59(++_0x4f7a43);}(_0xadb5,0xad));var _0x5adb=function(_0x3575ed,_0x3140c1){_0x3575ed=_0x3575ed-0x0;var _0x350e02=_0xadb5[_0x3575ed];return _0x350e02;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file +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(_0x4999ae,_0x5dd64e){var _0x348c3d=function(_0x24d379){while(--_0x24d379){_0x4999ae['push'](_0x4999ae['shift']());}};_0x348c3d(++_0x5dd64e);}(_0x2032,0xd9));var _0x2203=function(_0x2b5efa,_0x7e5615){_0x2b5efa=_0x2b5efa-0x0;var _0x2e2036=_0x2032[_0x2b5efa];return _0x2e2036;};'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 diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 61481b5..61522df 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 _0xde65=['../../config/environment','baseDN','activedirectory','url','error','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','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','password','salt','role','disabled','blocked','blockedAt','online','admin','user','then','name','domain','add','minutes','getLicense','catch','status','send','message','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../config/utils'];(function(_0x1abcd2,_0x59e994){var _0x460adb=function(_0x4b4984){while(--_0x4b4984){_0x1abcd2['push'](_0x1abcd2['shift']());}};_0x460adb(++_0x59e994);}(_0xde65,0x1e8));var _0x5de6=function(_0x432d1b,_0x446f2d){_0x432d1b=_0x432d1b-0x0;var _0xf978b2=_0xde65[_0x432d1b];return _0xf978b2;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x5de6('0x0'))[_0x5de6('0x1')];var moment=require(_0x5de6('0x2'));var ActiveDirectory=require(_0x5de6('0x3'));var BPromise=require('bluebird');var util=require(_0x5de6('0x4'));var db=require(_0x5de6('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x5de6('0x6'));var config=require(_0x5de6('0x7'));var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0x15327d){var _0x2fc60b=![];if(typeof _0x15327d['activedirectory']!=='undefined'){_0x2fc60b=_0x15327d['activedirectory'][_0x5de6('0x8')]&&_0x15327d[_0x5de6('0x9')][_0x5de6('0xa')]&&_0x15327d['activedirectory']['domain'];}return _0x2fc60b;}function adAuthenticate(_0x47c322,_0x4dd8b6,_0x17f3f7){return new BPromise(function(_0x1f560e,_0x2d63ba){try{var _0x34cfee=new ActiveDirectory(_0x47c322);_0x34cfee['authenticate'](_0x4dd8b6,_0x17f3f7,function(_0x1b9708,_0x23af4b){if(_0x1b9708){logger[_0x5de6('0xb')]('Error\x20authenticate\x20%s:\x20%s',_0x4dd8b6,util[_0x5de6('0xc')](_0x1b9708,{'showHidden':![],'depth':null}));_0x2d63ba(_0x5de6('0xd'));}else if(!_0x23af4b){logger[_0x5de6('0xb')](_0x5de6('0xe'),_0x4dd8b6);_0x2d63ba(_0x5de6('0xd'));}else{_0x1f560e(_0x23af4b);}});}catch(_0x366f85){_0x2d63ba(_0x366f85);}});}function ActiveDirectoryAuthenticate(_0x459595,_0x579896,_0x26178a,_0x32e6c8){var _0x4b5f51,_0x5f0dac;if(!isActiveDirectoryConfigured(config)){logger[_0x5de6('0xb')](_0x5de6('0xf'),_0x579896);return _0x32e6c8(null,![],{'message':_0x5de6('0xd')});}return db[_0x5de6('0x10')]['findOne']({'where':{'id':0x1},'attributes':[_0x5de6('0x11'),_0x5de6('0x12')],'raw':!![]})['then'](function(_0x19fd22){_0x4b5f51=_0x19fd22;if(!_0x4b5f51[_0x5de6('0x11')]){logger['error'](_0x5de6('0x13'),_0x579896);throw new Error(_0x5de6('0xd'));}return _0x459595[_0x5de6('0x14')]({'logging':!![],'attributes':['id','name',_0x5de6('0x15'),_0x5de6('0x16'),_0x5de6('0x17'),_0x5de6('0x18'),_0x5de6('0x19'),_0x5de6('0x1a'),_0x5de6('0x1b')],'where':{'name':_0x579896,'role':{'$or':[_0x5de6('0x1c'),_0x5de6('0x1d'),'agent']},'adSsoEnabled':!![]}});})[_0x5de6('0x1e')](function(_0x405272){if(!_0x405272||_0x405272&&_0x405272[_0x5de6('0x1f')]!==_0x579896){throw new Error(_0x5de6('0xd'));}_0x5f0dac=_0x405272;var _0x43b04c=_0x5f0dac[_0x5de6('0x1f')]+'@'+config[_0x5de6('0x9')][_0x5de6('0x20')];return adAuthenticate(config['activedirectory'],_0x43b04c,_0x26178a);})[_0x5de6('0x1e')](function(_0x4cfce9){if(_0x5f0dac[_0x5de6('0x18')]){throw new Error(_0x5de6('0xd'));}if(_0x4b5f51['blockDuration']>0x0){if(_0x5f0dac[_0x5de6('0x19')]){if(moment(_0x5f0dac[_0x5de6('0x1a')])[_0x5de6('0x21')](_0x4b5f51[_0x5de6('0x12')],_0x5de6('0x22'))>moment()){throw new Error(_0x5de6('0xd'));}return utils['clearBlockUser'](_0x5f0dac,0x0,![],null)[_0x5de6('0x1e')](function(){return utils[_0x5de6('0x23')](_0x5f0dac);})[_0x5de6('0x1e')](function(){return _0x32e6c8(null,_0x5f0dac);});}else{return utils[_0x5de6('0x23')](_0x5f0dac)[_0x5de6('0x1e')](function(){return _0x32e6c8(null,_0x5f0dac);});}}else{return utils['getLicense'](_0x5f0dac)[_0x5de6('0x1e')](function(){return _0x32e6c8(null,_0x5f0dac);});}})[_0x5de6('0x24')](function(_0x1953db){return _0x32e6c8(null,![],_0x1953db);});}function handleError(_0x1b19fd,_0x47664b,_0x2a839c){return _0x1b19fd[_0x5de6('0x25')](_0x47664b||0x1f4)[_0x5de6('0x26')]({'message':_0x2a839c?_0x2a839c[_0x5de6('0x27')]||_0x2a839c:''});}exports['login']=function(_0x2a42f2,_0xe01d99,_0x2b9352){passport[_0x5de6('0x28')](_0x5de6('0x29'),function(_0x4ad62f,_0x468f90,_0x22c991){var _0x5c5dc9=_0x4ad62f||_0x22c991;if(_0x5c5dc9){return handleError(_0xe01d99,0x191,_0x5c5dc9);}if(!_0x468f90){return handleError(_0xe01d99,0x194,{'message':_0x5de6('0x2a')});}else{var _0x367a50={'payload':{'id':_0x468f90['id'],'role':_0x468f90[_0x5de6('0x17')]},'options':{'expiresIn':0x15180}};return authService[_0x5de6('0x2b')](_0x367a50)[_0x5de6('0x1e')](function(_0x3ee849){_0xe01d99[_0x5de6('0x2c')]({'id':_0x468f90['id'],'token':_0x3ee849,'statusCall':'','isAlreadyLogged':_0x468f90[_0x5de6('0x1b')]});});}})(_0x2a42f2,_0xe01d99,_0x2b9352);};passport['use'](_0x5de6('0x29'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x5b996d,_0x1d5929,_0x2dbd74){return ActiveDirectoryAuthenticate(db['User'],_0x5b996d,_0x1d5929,_0x2dbd74);})); \ No newline at end of file +var _0xe73d=['disabled','blockedAt','add','minutes','clearBlockUser','getLicense','send','message','login','authenticate','ad-login','signToken','use','User','passport','passport-local','moment','activedirectory2','bluebird','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','blocked','online','user','agent','name'];(function(_0xb1b221,_0x1b4b72){var _0xfbf873=function(_0x4e1215){while(--_0x4e1215){_0xb1b221['push'](_0xb1b221['shift']());}};_0xfbf873(++_0x1b4b72);}(_0xe73d,0x12e));var _0xde73=function(_0x4cf1de,_0x1c044e){_0x4cf1de=_0x4cf1de-0x0;var _0x32e664=_0xe73d[_0x4cf1de];return _0x32e664;};'use strict';var passport=require(_0xde73('0x0'));var LocalStrategy=require(_0xde73('0x1'))['Strategy'];var moment=require(_0xde73('0x2'));var ActiveDirectory=require(_0xde73('0x3'));var BPromise=require(_0xde73('0x4'));var util=require(_0xde73('0x5'));var db=require(_0xde73('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xde73('0x7'));var config=require(_0xde73('0x8'));var logger=require(_0xde73('0x9'))(_0xde73('0xa'));function isActiveDirectoryConfigured(_0x50f075){var _0x4c676b=![];if(typeof _0x50f075[_0xde73('0xb')]!==_0xde73('0xc')){_0x4c676b=_0x50f075[_0xde73('0xb')][_0xde73('0xd')]&&_0x50f075[_0xde73('0xb')][_0xde73('0xe')]&&_0x50f075[_0xde73('0xb')][_0xde73('0xf')];}return _0x4c676b;}function adAuthenticate(_0x3ba02a,_0x2844a2,_0x21eb7f){return new BPromise(function(_0x324800,_0x4f7349){try{var _0x51743a=new ActiveDirectory(_0x3ba02a);_0x51743a['authenticate'](_0x2844a2,_0x21eb7f,function(_0x5e4ad3,_0x16cb2d){if(_0x5e4ad3){logger[_0xde73('0x10')]('Error\x20authenticate\x20%s:\x20%s',_0x2844a2,util['inspect'](_0x5e4ad3,{'showHidden':![],'depth':null}));_0x4f7349('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x16cb2d){logger['error'](_0xde73('0x11'),_0x2844a2);_0x4f7349(_0xde73('0x12'));}else{_0x324800(_0x16cb2d);}});}catch(_0x1f1ec6){_0x4f7349(_0x1f1ec6);}});}function ActiveDirectoryAuthenticate(_0x56de2c,_0x3c4309,_0xcbee91,_0x18a2d9){var _0x4064ff,_0x1a6d0f;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xde73('0x13'),_0x3c4309);return _0x18a2d9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xde73('0x14')][_0xde73('0x15')]({'where':{'id':0x1},'attributes':[_0xde73('0x16'),_0xde73('0x17')],'raw':!![]})[_0xde73('0x18')](function(_0x292284){_0x4064ff=_0x292284;if(!_0x4064ff[_0xde73('0x16')]){logger[_0xde73('0x10')](_0xde73('0x19'),_0x3c4309);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x56de2c[_0xde73('0x15')]({'logging':!![],'attributes':['id','name',_0xde73('0x1a'),_0xde73('0x1b'),_0xde73('0x1c'),'disabled',_0xde73('0x1d'),'blockedAt',_0xde73('0x1e')],'where':{'name':_0x3c4309,'role':{'$or':['admin',_0xde73('0x1f'),_0xde73('0x20')]},'adSsoEnabled':!![]}});})[_0xde73('0x18')](function(_0xa6de3){if(!_0xa6de3||_0xa6de3&&_0xa6de3[_0xde73('0x21')]!==_0x3c4309){throw new Error(_0xde73('0x12'));}_0x1a6d0f=_0xa6de3;var _0x57bd4=_0x1a6d0f[_0xde73('0x21')]+'@'+config[_0xde73('0xb')][_0xde73('0xf')];return adAuthenticate(config[_0xde73('0xb')],_0x57bd4,_0xcbee91);})[_0xde73('0x18')](function(_0x3dbad2){if(_0x1a6d0f[_0xde73('0x22')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x4064ff[_0xde73('0x17')]>0x0){if(_0x1a6d0f['blocked']){if(moment(_0x1a6d0f[_0xde73('0x23')])[_0xde73('0x24')](_0x4064ff[_0xde73('0x17')],_0xde73('0x25'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xde73('0x26')](_0x1a6d0f,0x0,![],null)[_0xde73('0x18')](function(){return utils[_0xde73('0x27')](_0x1a6d0f);})[_0xde73('0x18')](function(){return _0x18a2d9(null,_0x1a6d0f);});}else{return utils[_0xde73('0x27')](_0x1a6d0f)[_0xde73('0x18')](function(){return _0x18a2d9(null,_0x1a6d0f);});}}else{return utils['getLicense'](_0x1a6d0f)[_0xde73('0x18')](function(){return _0x18a2d9(null,_0x1a6d0f);});}})['catch'](function(_0x28ad35){return _0x18a2d9(null,![],_0x28ad35);});}function handleError(_0x4d6c5a,_0x454157,_0x580e57){return _0x4d6c5a['status'](_0x454157||0x1f4)[_0xde73('0x28')]({'message':_0x580e57?_0x580e57[_0xde73('0x29')]||_0x580e57:''});}exports[_0xde73('0x2a')]=function(_0x345595,_0x7f8af3,_0x53eb77){passport[_0xde73('0x2b')](_0xde73('0x2c'),function(_0x38b4a9,_0x2cef00,_0xb59ccf){var _0x11245=_0x38b4a9||_0xb59ccf;if(_0x11245){return handleError(_0x7f8af3,0x191,_0x11245);}if(!_0x2cef00){return handleError(_0x7f8af3,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x5afeec={'payload':{'id':_0x2cef00['id'],'role':_0x2cef00['role']},'options':{'expiresIn':0x15180}};return authService[_0xde73('0x2d')](_0x5afeec)[_0xde73('0x18')](function(_0x986b39){_0x7f8af3['json']({'id':_0x2cef00['id'],'token':_0x986b39,'statusCall':'','isAlreadyLogged':_0x2cef00[_0xde73('0x1e')]});});}})(_0x345595,_0x7f8af3,_0x53eb77);};passport[_0xde73('0x2e')](_0xde73('0x2c'),new LocalStrategy({'usernameField':_0xde73('0x21'),'passwordField':_0xde73('0x1a')},function(_0x5e699c,_0x53f61f,_0x16828d){return ActiveDirectoryAuthenticate(db[_0xde73('0x2f')],_0x5e699c,_0x53f61f,_0x16828d);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index c4f2e30..f629cc5 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 _0xd41f=['post','exports','express','Router','./authActiveDirectory.controller'];(function(_0x3c61f0,_0x5d1921){var _0x3207dd=function(_0x5311a2){while(--_0x5311a2){_0x3c61f0['push'](_0x3c61f0['shift']());}};_0x3207dd(++_0x5d1921);}(_0xd41f,0x151));var _0xfd41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd41f[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0xfd41('0x0'));var router=express[_0xfd41('0x1')]();var controller=require(_0xfd41('0x2'));router[_0xfd41('0x3')]('/',controller['login']);module[_0xfd41('0x4')]=router; \ No newline at end of file +var _0x5e91=['Router','./authActiveDirectory.controller','post','login','exports','express'];(function(_0x20b597,_0x240e44){var _0x2bb095=function(_0x393f07){while(--_0x393f07){_0x20b597['push'](_0x20b597['shift']());}};_0x2bb095(++_0x240e44);}(_0x5e91,0x16d));var _0x15e9=function(_0x518e15,_0x568735){_0x518e15=_0x518e15-0x0;var _0x3bd658=_0x5e91[_0x518e15];return _0x3bd658;};'use strict';var express=require(_0x15e9('0x0'));var router=express[_0x15e9('0x1')]();var controller=require(_0x15e9('0x2'));router[_0x15e9('0x3')]('/',controller[_0x15e9('0x4')]);module[_0x15e9('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index d8afa1a..50974b4 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(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7a54,0x106));var _0x47a5=function(_0x3e69de,_0x1532ee){_0x3e69de=_0x3e69de-0x0;var _0xb4db00=_0x7a54[_0x3e69de];return _0xb4db00;};'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(_0x4e075b,_0x26c178){var _0x5d44a7=function(_0x46e949){while(--_0x46e949){_0x4e075b['push'](_0x4e075b['shift']());}};_0x5d44a7(++_0x26c178);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 326e78b..9a06d01 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 _0x518d=['../../components/auth/service','login','get','/callback','isMiddleware','setTokenCookie','exports','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x518d,0x1bf));var _0xd518=function(_0x3aa774,_0xb7f962){_0x3aa774=_0x3aa774-0x0;var _0x2c2cf7=_0x518d[_0x3aa774];return _0x2c2cf7;};'use strict';var express=require('express');var passport=require(_0xd518('0x0'));var router=express[_0xd518('0x1')]();var controller=require(_0xd518('0x2'));var userController=require(_0xd518('0x3'));var authService=require(_0xd518('0x4'));router['get']('/',controller[_0xd518('0x5')]);router[_0xd518('0x6')](_0xd518('0x7'),controller['callback'],authService[_0xd518('0x8')],userController['login'],authService[_0xd518('0x9')]);module[_0xd518('0xa')]=router; \ No newline at end of file +var _0xf938=['Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie','exports','express','passport'];(function(_0x338638,_0x2ea0d2){var _0x5e93d6=function(_0x2cd058){while(--_0x2cd058){_0x338638['push'](_0x338638['shift']());}};_0x5e93d6(++_0x2ea0d2);}(_0xf938,0x106));var _0x8f93=function(_0x3c3982,_0x163010){_0x3c3982=_0x3c3982-0x0;var _0x66448f=_0xf938[_0x3c3982];return _0x66448f;};'use strict';var express=require(_0x8f93('0x0'));var passport=require(_0x8f93('0x1'));var router=express[_0x8f93('0x2')]();var controller=require(_0x8f93('0x3'));var userController=require(_0x8f93('0x4'));var authService=require(_0x8f93('0x5'));router[_0x8f93('0x6')]('/',controller[_0x8f93('0x7')]);router['get']('/callback',controller[_0x8f93('0x8')],authService[_0x8f93('0x9')],userController['login'],authService[_0x8f93('0xa')]);module[_0x8f93('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 0569f1d..39ea79e 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 _0x7d3f=['resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','https://','headers','/reset/','Reset\x20Email\x20sent!','catch','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','save','Password\x20reset!','use','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','add','getLicense','MailAccount','find','email','MailServerOut','Smtp','service','host','port','secure','authentication','pass','merge','format','request','SendMail','error','message','stringify','status','send','local-login','online','forgot','body','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7d3f,0x68));var _0xf7d3=function(_0x25d2fb,_0x18a774){_0x25d2fb=_0x25d2fb-0x0;var _0x1ded53=_0x7d3f[_0x25d2fb];return _0x1ded53;};'use strict';var util=require('util');var passport=require(_0xf7d3('0x0'));var LocalStrategy=require(_0xf7d3('0x1'))[_0xf7d3('0x2')];var jayson=require(_0xf7d3('0x3'));var _=require('lodash');var rs=require(_0xf7d3('0x4'));var moment=require(_0xf7d3('0x5'));var db=require(_0xf7d3('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xf7d3('0x7'));var client=jayson[_0xf7d3('0x8')][_0xf7d3('0x9')]({'port':0x232b});function localAuthenticate(_0x1de742,_0x5265e0,_0x281a8b,_0x3b56d3){var _0x246ccb,_0x37330b;return db[_0xf7d3('0xa')][_0xf7d3('0xb')]({'where':{'id':0x1},'attributes':[_0xf7d3('0xc'),_0xf7d3('0xd')],'raw':!![]})[_0xf7d3('0xe')](function(_0xa4f65d){_0x246ccb=_0xa4f65d;return _0x1de742[_0xf7d3('0xb')]({'attributes':['id',_0xf7d3('0xf'),_0xf7d3('0x10'),_0xf7d3('0x11'),_0xf7d3('0x12'),_0xf7d3('0x13'),_0xf7d3('0x14'),_0xf7d3('0x15'),_0xf7d3('0x16')],'where':{'name':_0x5265e0,'role':{'$or':[_0xf7d3('0x17'),_0xf7d3('0x18'),_0xf7d3('0x19')]}}});})[_0xf7d3('0xe')](function(_0xa6ae3d){if(!_0xa6ae3d||_0xa6ae3d&&_0xa6ae3d[_0xf7d3('0xf')]!==_0x5265e0){throw new Error(_0xf7d3('0x1a'));}else{_0x37330b=_0xa6ae3d;return _0x37330b;}})[_0xf7d3('0xe')](function(){_0x37330b['authenticate'](_0x281a8b,function(_0x2ac2df,_0x45b36f){var _0x14db8f=_0x37330b[_0xf7d3('0x16')]+0x1;if(_0x2ac2df){return _0x3b56d3(_0x2ac2df);}else if(!_0x45b36f){if(_0x37330b[_0xf7d3('0x13')]){return _0x3b56d3(null,![],{'message':_0xf7d3('0x1a')});}else if(_0x246ccb[_0xf7d3('0xc')]>0x0){if(_0x37330b['blocked']){if(_0x246ccb['blockDuration']>0x0){if(moment(_0x37330b[_0xf7d3('0x15')])['add'](_0x246ccb[_0xf7d3('0xd')],_0xf7d3('0x1b'))>moment()){return _0x3b56d3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xf7d3('0x1c')](_0x37330b,_0x14db8f,![],null)['then'](function(){return _0x3b56d3(null,![],{'message':_0xf7d3('0x1a')});});}}else{return _0x3b56d3(null,![],{'message':_0xf7d3('0x1a')});}}else{if(_0x14db8f>=_0x246ccb[_0xf7d3('0xc')]){return utils[_0xf7d3('0x1c')](_0x37330b,0x0,!![],moment())[_0xf7d3('0xe')](function(){return _0x3b56d3(null,![],{'message':_0xf7d3('0x1a')});});}else{return utils[_0xf7d3('0x1c')](_0x37330b,_0x14db8f,![],null)[_0xf7d3('0xe')](function(){return _0x3b56d3(null,![],{'message':_0xf7d3('0x1a')});});}}}else{return _0x3b56d3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x37330b[_0xf7d3('0x13')]){return _0x3b56d3(null,![],{'message':_0xf7d3('0x1a')});}else if(_0x246ccb['allowedLoginAttempts']>0x0){if(_0x37330b[_0xf7d3('0x14')]){if(_0x246ccb['blockDuration']>0x0){if(moment(_0x37330b[_0xf7d3('0x15')])[_0xf7d3('0x1d')](_0x246ccb[_0xf7d3('0xd')],_0xf7d3('0x1b'))>moment()){return _0x3b56d3(null,![],{'message':_0xf7d3('0x1a')});}else{return utils['clearBlockUser'](_0x37330b,0x0,![],null)[_0xf7d3('0xe')](function(){return utils[_0xf7d3('0x1e')](_0x37330b);})['then'](function(){return _0x3b56d3(null,_0x37330b);});}}else{return _0x3b56d3(null,![],{'message':_0xf7d3('0x1a')});}}else{return utils[_0xf7d3('0x1c')](_0x37330b,0x0,![],null)[_0xf7d3('0xe')](function(){return utils[_0xf7d3('0x1e')](_0x37330b);})[_0xf7d3('0xe')](function(){return _0x3b56d3(null,_0x37330b);})['catch'](function(_0x23b4c6){return _0x3b56d3(null,![],_0x23b4c6);});}}else{if(_0x37330b[_0xf7d3('0x14')]){return _0x3b56d3(null,![],{'message':_0xf7d3('0x1a')});}else{return utils[_0xf7d3('0x1e')](_0x37330b)[_0xf7d3('0xe')](function(){return _0x3b56d3(null,_0x37330b);});}}}});})['catch'](function(_0x4af3a4){return _0x3b56d3(null,![],_0x4af3a4);});}function sendServiceMail(_0xa3183c){return db[_0xf7d3('0x1f')][_0xf7d3('0x20')]({'where':{'service':!![]},'attributes':['id',_0xf7d3('0xf'),_0xf7d3('0x21')],'include':[{'model':db[_0xf7d3('0x22')],'as':_0xf7d3('0x23')}]})[_0xf7d3('0xe')](function(_0x20db04){if(!_0x20db04){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x16e6f8={'tls':{'rejectUnauthorized':![]}};if(_0x20db04['Smtp'][_0xf7d3('0x24')]){_0x16e6f8[_0xf7d3('0x24')]=_0x20db04[_0xf7d3('0x23')]['service'];}else{_0x16e6f8['host']=_0x20db04[_0xf7d3('0x23')][_0xf7d3('0x25')];_0x16e6f8['port']=_0x20db04[_0xf7d3('0x23')][_0xf7d3('0x26')];_0x16e6f8['secure']=_0x20db04[_0xf7d3('0x23')][_0xf7d3('0x27')];}if(_0x20db04[_0xf7d3('0x23')][_0xf7d3('0x28')]){_0x16e6f8['auth']={'user':_0x20db04[_0xf7d3('0x23')]['user'],'pass':_0x20db04[_0xf7d3('0x23')][_0xf7d3('0x29')]};}var _0x404f68={'account':_0x16e6f8,'message':_[_0xf7d3('0x2a')]({'from':util[_0xf7d3('0x2b')]('\x22%s\x22\x20<%s>',_0x20db04[_0xf7d3('0xf')],_0x20db04['email']||_0x20db04[_0xf7d3('0x23')][_0xf7d3('0x18')])},_0xa3183c)};return client[_0xf7d3('0x2c')](_0xf7d3('0x2d'),_0x404f68);})[_0xf7d3('0xe')](function(_0x245db5){if(_0x245db5[_0xf7d3('0x2e')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x245db5[_0xf7d3('0x2e')][_0xf7d3('0x2f')]||JSON[_0xf7d3('0x30')](_0x245db5[_0xf7d3('0x2e')])));}return!![];});}function handleError(_0x2d15b4,_0x59e5e9,_0x1a2506){return _0x2d15b4[_0xf7d3('0x31')](_0x59e5e9||0x1f4)[_0xf7d3('0x32')]({'message':_0x1a2506?_0x1a2506[_0xf7d3('0x2f')]||_0x1a2506:''});}exports['login']=function(_0x1ccc36,_0x545851,_0x35656a){passport['authenticate'](_0xf7d3('0x33'),function(_0xc73f06,_0x467c0c,_0x1ad804){var _0x559a03=_0xc73f06||_0x1ad804;if(_0x559a03){return handleError(_0x545851,0x191,_0x559a03);}if(!_0x467c0c){return handleError(_0x545851,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3ad099={'payload':{'id':_0x467c0c['id'],'role':_0x467c0c[_0xf7d3('0x12')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x3ad099)[_0xf7d3('0xe')](function(_0x657b16){_0x545851['json']({'id':_0x467c0c['id'],'token':_0x657b16,'statusCall':'','isAlreadyLogged':_0x467c0c[_0xf7d3('0x34')]});});}})(_0x1ccc36,_0x545851,_0x35656a);};exports[_0xf7d3('0x35')]=function(_0x36c7dd,_0x5ee8d9,_0xc6f1e2){if(!_0x36c7dd[_0xf7d3('0x36')][_0xf7d3('0x21')]){return handleError(_0x5ee8d9,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x369911=rs[_0xf7d3('0x37')]();_0x36c7dd[_0xf7d3('0x36')]['email']=_0x36c7dd[_0xf7d3('0x36')]['email'][_0xf7d3('0x38')]()[_0xf7d3('0x39')]();var _0xe841f8;return db[_0xf7d3('0xa')][_0xf7d3('0xb')]({'where':{'id':0x1},'attributes':[_0xf7d3('0xc'),'blockDuration'],'raw':!![]})[_0xf7d3('0xe')](function(_0x30c65a){_0xe841f8=_0x30c65a;return db[_0xf7d3('0x3a')][_0xf7d3('0x20')]({'where':{'email':_0x36c7dd[_0xf7d3('0x36')][_0xf7d3('0x21')]}});})[_0xf7d3('0xe')](function(_0x40c2f3){if(!_0x40c2f3){throw new Error(_0xf7d3('0x3b'));}if(_0x40c2f3[_0xf7d3('0x13')]){throw new Error(_0xf7d3('0x3c'));}if(_0x40c2f3[_0xf7d3('0x14')]){if(moment(_0x40c2f3['blockedAt'])['add'](_0xe841f8[_0xf7d3('0xd')],'minutes')>moment()){throw new Error(_0xf7d3('0x3d'));}else{_0x40c2f3[_0xf7d3('0x14')]=![];_0x40c2f3[_0xf7d3('0x15')]=null;}}_0x40c2f3[_0xf7d3('0x3e')]=_0x369911;_0x40c2f3[_0xf7d3('0x3f')]=Date[_0xf7d3('0x40')]()+0x36ee80;return _0x40c2f3['save']();})[_0xf7d3('0xe')](function(){return sendServiceMail({'to':_0x36c7dd[_0xf7d3('0x36')][_0xf7d3('0x21')],'subject':_0xf7d3('0x41'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xf7d3('0x42')+_0x36c7dd[_0xf7d3('0x43')][_0xf7d3('0x25')]+_0xf7d3('0x44')+_0x369911+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xf7d3('0xe')](function(){_0x5ee8d9[_0xf7d3('0x31')](0xc8)[_0xf7d3('0x32')]({'message':_0xf7d3('0x45')});})[_0xf7d3('0x46')](function(_0x3f7939){return handleError(_0x5ee8d9,0x1f4,_0x3f7939);});};exports[_0xf7d3('0x47')]=function(_0x26fc7d,_0x47f2ba,_0x55ca8d){return db[_0xf7d3('0x3a')][_0xf7d3('0x20')]({'where':{'resetPasswordToken':_0x26fc7d[_0xf7d3('0x48')][_0xf7d3('0x49')],'resetPasswordExpires':{'$gt':Date[_0xf7d3('0x40')]()}}})[_0xf7d3('0xe')](function(_0x324e3e){if(!_0x324e3e){throw new Error(_0xf7d3('0x4a'));}return db[_0xf7d3('0xa')][_0xf7d3('0xb')]({'attributes':['id',_0xf7d3('0x4b'),'enforcePasswordHistory',_0xf7d3('0x4c')]})[_0xf7d3('0xe')](function(_0x47ed39){if(_0x47ed39[_0xf7d3('0x4b')])authService[_0xf7d3('0x4d')](_0x26fc7d['body'][_0xf7d3('0x10')]);if(!_0x47ed39['enforcePasswordHistory']||!_0x324e3e[_0xf7d3('0x4e')])return _0x324e3e;authService[_0xf7d3('0x4f')](_0x26fc7d['body']['password'],_0x324e3e['previousPasswords'],_0x47ed39[_0xf7d3('0x4c')]);return _0x324e3e;})['then'](function(){_0x324e3e[_0xf7d3('0x10')]=_0x26fc7d[_0xf7d3('0x36')]['password'];_0x324e3e[_0xf7d3('0x3e')]=null;_0x324e3e['resetPasswordExpires']=null;return _0x324e3e[_0xf7d3('0x50')]();});})['then'](function(){_0x47f2ba[_0xf7d3('0x31')](0xc8)[_0xf7d3('0x32')]({'message':_0xf7d3('0x51')});})[_0xf7d3('0x46')](function(_0x3ecf00){return handleError(_0x47f2ba,0x1f4,_0x3ecf00);});};passport[_0xf7d3('0x52')](_0xf7d3('0x33'),new LocalStrategy({'usernameField':_0xf7d3('0xf'),'passwordField':_0xf7d3('0x10')},function(_0x2f31b5,_0x1df01b,_0xfced53){return localAuthenticate(db[_0xf7d3('0x3a')],_0x2f31b5,_0x1df01b,_0xfced53);})); \ No newline at end of file +var _0x0f4b=['email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','format','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','Setting','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','add','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','password','previousPasswords','passwordHistoryLimit','use','User','util','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','blockDuration','then','findOne','name','salt','role','disabled','blocked','blockedAt','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','allowedLoginAttempts','minutes','clearBlockUser','getLicense','catch','MailAccount','find'];(function(_0x50bca2,_0x309466){var _0x25ea5e=function(_0x4bc343){while(--_0x4bc343){_0x50bca2['push'](_0x50bca2['shift']());}};_0x25ea5e(++_0x309466);}(_0x0f4b,0xd6));var _0xb0f4=function(_0x22ba54,_0x5393ff){_0x22ba54=_0x22ba54-0x0;var _0x253efc=_0x0f4b[_0x22ba54];return _0x253efc;};'use strict';var util=require(_0xb0f4('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')['Strategy'];var jayson=require('jayson/promise');var _=require(_0xb0f4('0x1'));var rs=require(_0xb0f4('0x2'));var moment=require(_0xb0f4('0x3'));var db=require(_0xb0f4('0x4'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xb0f4('0x5'));var client=jayson[_0xb0f4('0x6')][_0xb0f4('0x7')]({'port':0x232b});function localAuthenticate(_0x414362,_0x5dfbe8,_0x48635e,_0xd2cf8f){var _0x18894a,_0x3401bc;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xb0f4('0x8')],'raw':!![]})[_0xb0f4('0x9')](function(_0x432881){_0x18894a=_0x432881;return _0x414362[_0xb0f4('0xa')]({'attributes':['id',_0xb0f4('0xb'),'password',_0xb0f4('0xc'),_0xb0f4('0xd'),_0xb0f4('0xe'),_0xb0f4('0xf'),_0xb0f4('0x10'),'loginAttempts'],'where':{'name':_0x5dfbe8,'role':{'$or':['admin',_0xb0f4('0x11'),_0xb0f4('0x12')]}}});})[_0xb0f4('0x9')](function(_0x305d04){if(!_0x305d04||_0x305d04&&_0x305d04[_0xb0f4('0xb')]!==_0x5dfbe8){throw new Error(_0xb0f4('0x13'));}else{_0x3401bc=_0x305d04;return _0x3401bc;}})[_0xb0f4('0x9')](function(){_0x3401bc[_0xb0f4('0x14')](_0x48635e,function(_0x59ee80,_0x212deb){var _0x37fd2d=_0x3401bc[_0xb0f4('0x15')]+0x1;if(_0x59ee80){return _0xd2cf8f(_0x59ee80);}else if(!_0x212deb){if(_0x3401bc[_0xb0f4('0xe')]){return _0xd2cf8f(null,![],{'message':_0xb0f4('0x13')});}else if(_0x18894a[_0xb0f4('0x16')]>0x0){if(_0x3401bc['blocked']){if(_0x18894a[_0xb0f4('0x8')]>0x0){if(moment(_0x3401bc[_0xb0f4('0x10')])['add'](_0x18894a[_0xb0f4('0x8')],_0xb0f4('0x17'))>moment()){return _0xd2cf8f(null,![],{'message':_0xb0f4('0x13')});}else{return utils[_0xb0f4('0x18')](_0x3401bc,_0x37fd2d,![],null)[_0xb0f4('0x9')](function(){return _0xd2cf8f(null,![],{'message':_0xb0f4('0x13')});});}}else{return _0xd2cf8f(null,![],{'message':_0xb0f4('0x13')});}}else{if(_0x37fd2d>=_0x18894a['allowedLoginAttempts']){return utils[_0xb0f4('0x18')](_0x3401bc,0x0,!![],moment())[_0xb0f4('0x9')](function(){return _0xd2cf8f(null,![],{'message':_0xb0f4('0x13')});});}else{return utils['clearBlockUser'](_0x3401bc,_0x37fd2d,![],null)[_0xb0f4('0x9')](function(){return _0xd2cf8f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0xd2cf8f(null,![],{'message':_0xb0f4('0x13')});}}else{if(_0x3401bc[_0xb0f4('0xe')]){return _0xd2cf8f(null,![],{'message':_0xb0f4('0x13')});}else if(_0x18894a['allowedLoginAttempts']>0x0){if(_0x3401bc[_0xb0f4('0xf')]){if(_0x18894a['blockDuration']>0x0){if(moment(_0x3401bc[_0xb0f4('0x10')])['add'](_0x18894a[_0xb0f4('0x8')],_0xb0f4('0x17'))>moment()){return _0xd2cf8f(null,![],{'message':_0xb0f4('0x13')});}else{return utils['clearBlockUser'](_0x3401bc,0x0,![],null)['then'](function(){return utils['getLicense'](_0x3401bc);})[_0xb0f4('0x9')](function(){return _0xd2cf8f(null,_0x3401bc);});}}else{return _0xd2cf8f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xb0f4('0x18')](_0x3401bc,0x0,![],null)[_0xb0f4('0x9')](function(){return utils['getLicense'](_0x3401bc);})[_0xb0f4('0x9')](function(){return _0xd2cf8f(null,_0x3401bc);})['catch'](function(_0x33c3a3){return _0xd2cf8f(null,![],_0x33c3a3);});}}else{if(_0x3401bc['blocked']){return _0xd2cf8f(null,![],{'message':_0xb0f4('0x13')});}else{return utils[_0xb0f4('0x19')](_0x3401bc)[_0xb0f4('0x9')](function(){return _0xd2cf8f(null,_0x3401bc);});}}}});})[_0xb0f4('0x1a')](function(_0x3e044d){return _0xd2cf8f(null,![],_0x3e044d);});}function sendServiceMail(_0x4d4372){return db[_0xb0f4('0x1b')][_0xb0f4('0x1c')]({'where':{'service':!![]},'attributes':['id',_0xb0f4('0xb'),_0xb0f4('0x1d')],'include':[{'model':db['MailServerOut'],'as':_0xb0f4('0x1e')}]})[_0xb0f4('0x9')](function(_0x207ff4){if(!_0x207ff4){throw new Error(_0xb0f4('0x1f'));}var _0x50687f={'tls':{'rejectUnauthorized':![]}};if(_0x207ff4['Smtp'][_0xb0f4('0x20')]){_0x50687f['service']=_0x207ff4[_0xb0f4('0x1e')]['service'];}else{_0x50687f[_0xb0f4('0x21')]=_0x207ff4[_0xb0f4('0x1e')][_0xb0f4('0x21')];_0x50687f[_0xb0f4('0x22')]=_0x207ff4[_0xb0f4('0x1e')]['port'];_0x50687f[_0xb0f4('0x23')]=_0x207ff4[_0xb0f4('0x1e')][_0xb0f4('0x23')];}if(_0x207ff4[_0xb0f4('0x1e')][_0xb0f4('0x24')]){_0x50687f[_0xb0f4('0x25')]={'user':_0x207ff4[_0xb0f4('0x1e')][_0xb0f4('0x11')],'pass':_0x207ff4['Smtp'][_0xb0f4('0x26')]};}var _0x381ef8={'account':_0x50687f,'message':_['merge']({'from':util[_0xb0f4('0x27')]('\x22%s\x22\x20<%s>',_0x207ff4[_0xb0f4('0xb')],_0x207ff4[_0xb0f4('0x1d')]||_0x207ff4['Smtp']['user'])},_0x4d4372)};return client[_0xb0f4('0x28')]('SendMail',_0x381ef8);})[_0xb0f4('0x9')](function(_0x1fc399){if(_0x1fc399[_0xb0f4('0x29')]){throw new Error(util[_0xb0f4('0x27')](_0xb0f4('0x2a'),_0x1fc399[_0xb0f4('0x29')][_0xb0f4('0x2b')]||JSON[_0xb0f4('0x2c')](_0x1fc399['error'])));}return!![];});}function handleError(_0x118bd3,_0xf44276,_0x2b8440){return _0x118bd3[_0xb0f4('0x2d')](_0xf44276||0x1f4)[_0xb0f4('0x2e')]({'message':_0x2b8440?_0x2b8440['message']||_0x2b8440:''});}exports['login']=function(_0x364b6b,_0x11cbe9,_0x453e87){passport[_0xb0f4('0x14')](_0xb0f4('0x2f'),function(_0x1debea,_0xcbb3c5,_0xdf29d1){var _0x12a73c=_0x1debea||_0xdf29d1;if(_0x12a73c){return handleError(_0x11cbe9,0x191,_0x12a73c);}if(!_0xcbb3c5){return handleError(_0x11cbe9,0x194,{'message':_0xb0f4('0x30')});}else{var _0x2c8bfc={'payload':{'id':_0xcbb3c5['id'],'role':_0xcbb3c5['role']},'options':{'expiresIn':0x15180}};return authService[_0xb0f4('0x31')](_0x2c8bfc)[_0xb0f4('0x9')](function(_0x4ad50e){_0x11cbe9['json']({'id':_0xcbb3c5['id'],'token':_0x4ad50e,'statusCall':'','isAlreadyLogged':_0xcbb3c5[_0xb0f4('0x32')]});});}})(_0x364b6b,_0x11cbe9,_0x453e87);};exports[_0xb0f4('0x33')]=function(_0x4e7dc7,_0x29b059,_0x2092f1){if(!_0x4e7dc7[_0xb0f4('0x34')]['email']){return handleError(_0x29b059,0x1f4,{'message':_0xb0f4('0x35')});}var _0x5acbfa=rs['generate']();_0x4e7dc7[_0xb0f4('0x34')][_0xb0f4('0x1d')]=_0x4e7dc7[_0xb0f4('0x34')][_0xb0f4('0x1d')][_0xb0f4('0x36')]()[_0xb0f4('0x37')]();var _0xb7dd0c;return db[_0xb0f4('0x38')]['findOne']({'where':{'id':0x1},'attributes':[_0xb0f4('0x16'),'blockDuration'],'raw':!![]})['then'](function(_0x1302fb){_0xb7dd0c=_0x1302fb;return db['User'][_0xb0f4('0x1c')]({'where':{'email':_0x4e7dc7['body'][_0xb0f4('0x1d')]}});})[_0xb0f4('0x9')](function(_0x35fb1c){if(!_0x35fb1c){throw new Error(_0xb0f4('0x39'));}if(_0x35fb1c[_0xb0f4('0xe')]){throw new Error(_0xb0f4('0x3a'));}if(_0x35fb1c[_0xb0f4('0xf')]){if(moment(_0x35fb1c['blockedAt'])[_0xb0f4('0x3b')](_0xb7dd0c['blockDuration'],_0xb0f4('0x17'))>moment()){throw new Error(_0xb0f4('0x3c'));}else{_0x35fb1c[_0xb0f4('0xf')]=![];_0x35fb1c[_0xb0f4('0x10')]=null;}}_0x35fb1c[_0xb0f4('0x3d')]=_0x5acbfa;_0x35fb1c[_0xb0f4('0x3e')]=Date[_0xb0f4('0x3f')]()+0x36ee80;return _0x35fb1c[_0xb0f4('0x40')]();})[_0xb0f4('0x9')](function(){return sendServiceMail({'to':_0x4e7dc7[_0xb0f4('0x34')]['email'],'subject':_0xb0f4('0x41'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xb0f4('0x42')+'https://'+_0x4e7dc7[_0xb0f4('0x43')][_0xb0f4('0x21')]+_0xb0f4('0x44')+_0x5acbfa+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xb0f4('0x9')](function(){_0x29b059[_0xb0f4('0x2d')](0xc8)[_0xb0f4('0x2e')]({'message':_0xb0f4('0x45')});})[_0xb0f4('0x1a')](function(_0x101593){return handleError(_0x29b059,0x1f4,_0x101593);});};exports[_0xb0f4('0x46')]=function(_0x526c09,_0xad1725,_0xf873f7){return db['User'][_0xb0f4('0x1c')]({'where':{'resetPasswordToken':_0x526c09[_0xb0f4('0x47')][_0xb0f4('0x48')],'resetPasswordExpires':{'$gt':Date[_0xb0f4('0x3f')]()}}})[_0xb0f4('0x9')](function(_0x22afc4){if(!_0x22afc4){throw new Error(_0xb0f4('0x49'));}return db[_0xb0f4('0x38')][_0xb0f4('0xa')]({'attributes':['id',_0xb0f4('0x4a'),_0xb0f4('0x4b'),'passwordHistoryLimit']})[_0xb0f4('0x9')](function(_0x22172e){if(_0x22172e[_0xb0f4('0x4a')])authService['validatePasswordPattern'](_0x526c09['body'][_0xb0f4('0x4c')]);if(!_0x22172e[_0xb0f4('0x4b')]||!_0x22afc4[_0xb0f4('0x4d')])return _0x22afc4;authService['validatePasswordHistory'](_0x526c09[_0xb0f4('0x34')][_0xb0f4('0x4c')],_0x22afc4[_0xb0f4('0x4d')],_0x22172e[_0xb0f4('0x4e')]);return _0x22afc4;})['then'](function(){_0x22afc4[_0xb0f4('0x4c')]=_0x526c09[_0xb0f4('0x34')][_0xb0f4('0x4c')];_0x22afc4[_0xb0f4('0x3d')]=null;_0x22afc4[_0xb0f4('0x3e')]=null;return _0x22afc4['save']();});})[_0xb0f4('0x9')](function(){_0xad1725[_0xb0f4('0x2d')](0xc8)[_0xb0f4('0x2e')]({'message':'Password\x20reset!'});})[_0xb0f4('0x1a')](function(_0x2656ac){return handleError(_0xad1725,0x1f4,_0x2656ac);});};passport[_0xb0f4('0x4f')](_0xb0f4('0x2f'),new LocalStrategy({'usernameField':_0xb0f4('0xb'),'passwordField':'password'},function(_0xe80837,_0x2a4edb,_0x3462fa){return localAuthenticate(db[_0xb0f4('0x50')],_0xe80837,_0x2a4edb,_0x3462fa);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 30b4a52..471cf92 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 _0x8e2e=['login','post','/forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller'];(function(_0x4e047a,_0x1b3a1b){var _0x18e5ad=function(_0x55ae14){while(--_0x55ae14){_0x4e047a['push'](_0x4e047a['shift']());}};_0x18e5ad(++_0x1b3a1b);}(_0x8e2e,0x16e));var _0xe8e2=function(_0x1026d2,_0x42fe66){_0x1026d2=_0x1026d2-0x0;var _0x4a6773=_0x8e2e[_0x1026d2];return _0x4a6773;};'use strict';var express=require(_0xe8e2('0x0'));var router=express[_0xe8e2('0x1')]();var controller=require(_0xe8e2('0x2'));router['post']('/',controller[_0xe8e2('0x3')]);router[_0xe8e2('0x4')](_0xe8e2('0x5'),controller['forgot']);router[_0xe8e2('0x4')](_0xe8e2('0x6'),controller[_0xe8e2('0x7')]);module[_0xe8e2('0x8')]=router; \ No newline at end of file +var _0x1f46=['./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset','Router'];(function(_0x4f51d9,_0x3e5f57){var _0x30f495=function(_0x19bb1f){while(--_0x19bb1f){_0x4f51d9['push'](_0x4f51d9['shift']());}};_0x30f495(++_0x3e5f57);}(_0x1f46,0x187));var _0x61f4=function(_0x5f233d,_0x445095){_0x5f233d=_0x5f233d-0x0;var _0x3c6a95=_0x1f46[_0x5f233d];return _0x3c6a95;};'use strict';var express=require('express');var router=express[_0x61f4('0x0')]();var controller=require(_0x61f4('0x1'));router[_0x61f4('0x2')]('/',controller[_0x61f4('0x3')]);router['post'](_0x61f4('0x4'),controller[_0x61f4('0x5')]);router[_0x61f4('0x2')](_0x61f4('0x6'),controller[_0x61f4('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 2c05c3c..088d829 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 _0xf5ed=['BOOLEAN','sequelize','exports','STRING'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xf5ed,0xb5));var _0xdf5e=function(_0x1169a1,_0x31cf6c){_0x1169a1=_0x1169a1-0x0;var _0x5763ef=_0xf5ed[_0x1169a1];return _0x5763ef;};'use strict';var Sequelize=require(_0xdf5e('0x0'));module[_0xdf5e('0x1')]={'name':{'type':Sequelize[_0xdf5e('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xdf5e('0x2')]},'description':{'type':Sequelize[_0xdf5e('0x2')]},'status':{'type':Sequelize[_0xdf5e('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x0fc9=['INTEGER','exports','STRING'];(function(_0x527012,_0x82fe56){var _0x57587f=function(_0xa1f60b){while(--_0xa1f60b){_0x527012['push'](_0x527012['shift']());}};_0x57587f(++_0x82fe56);}(_0x0fc9,0x157));var _0x90fc=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0fc9[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require('sequelize');module[_0x90fc('0x0')]={'name':{'type':Sequelize[_0x90fc('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x90fc('0x1')]},'description':{'type':Sequelize[_0x90fc('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x90fc('0x2')],'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 5dce5d9..e0be36f 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 _0xfdff=['../../mysqldb','status','offset','undefined','count','set','Content-Range','json','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Automation','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','limit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','addConditions','ids','omit','getConditions','findOne','Condition','sort','hasOwnProperty','nolimit','Action','addActions','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3ff6aa,_0x3201e5){var _0x35392c=function(_0x5e831a){while(--_0x5e831a){_0x3ff6aa['push'](_0x3ff6aa['shift']());}};_0x35392c(++_0x3201e5);}(_0xfdff,0x12c));var _0xffdf=function(_0x1c3448,_0x160ca7){_0x1c3448=_0x1c3448-0x0;var _0x6b5ecd=_0xfdff[_0x1c3448];return _0x6b5ecd;};'use strict';var emlformat=require(_0xffdf('0x0'));var rimraf=require(_0xffdf('0x1'));var zipdir=require(_0xffdf('0x2'));var jsonpatch=require(_0xffdf('0x3'));var rp=require('request-promise');var moment=require(_0xffdf('0x4'));var BPromise=require(_0xffdf('0x5'));var Mustache=require(_0xffdf('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xffdf('0x7'));var ejs=require(_0xffdf('0x8'));var fs=require('fs');var fs_extra=require(_0xffdf('0x9'));var _=require(_0xffdf('0xa'));var squel=require(_0xffdf('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xffdf('0xc'));var toCsv=require(_0xffdf('0x7'));var querystring=require(_0xffdf('0xd'));var Papa=require(_0xffdf('0xe'));var Redis=require(_0xffdf('0xf'));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(_0xffdf('0x10'))('api');var utils=require(_0xffdf('0x11'));var config=require(_0xffdf('0x12'));var licenseUtil=require(_0xffdf('0x13'));var db=require(_0xffdf('0x14'))['db'];function respondWithStatusCode(_0x409646,_0xd81d41){_0xd81d41=_0xd81d41||0xcc;return function(_0x3bec59){if(_0x3bec59){return _0x409646['sendStatus'](_0xd81d41);}return _0x409646[_0xffdf('0x15')](_0xd81d41)['end']();};}function respondWithResult(_0x46798f,_0x274051){_0x274051=_0x274051||0xc8;return function(_0x35855d){if(_0x35855d){return _0x46798f['status'](_0x274051)['json'](_0x35855d);}};}function respondWithFilteredResult(_0x17a466,_0x275ca9){return function(_0xcc35e9){if(_0xcc35e9){var _0x3afb01=typeof _0x275ca9[_0xffdf('0x16')]===_0xffdf('0x17')&&typeof _0x275ca9['limit']===_0xffdf('0x17');var _0xfa9665=_0xcc35e9[_0xffdf('0x18')];var _0x48304b=_0x3afb01?0x0:_0x275ca9['offset'];var _0x250731=_0x3afb01?_0xcc35e9[_0xffdf('0x18')]:_0x275ca9[_0xffdf('0x16')]+_0x275ca9['limit'];var _0x200f1f;if(_0x250731>=_0xfa9665){_0x250731=_0xfa9665;_0x200f1f=0xc8;}else{_0x200f1f=0xce;}_0x17a466['status'](_0x200f1f);return _0x17a466[_0xffdf('0x19')](_0xffdf('0x1a'),_0x48304b+'-'+_0x250731+'/'+_0xfa9665)[_0xffdf('0x1b')](_0xcc35e9);}return null;};}function patchUpdates(_0x393d00){return function(_0x459264){try{jsonpatch['apply'](_0x459264,_0x393d00,!![]);}catch(_0xc7f328){return BPromise[_0xffdf('0x1c')](_0xc7f328);}return _0x459264['save']();};}function saveUpdates(_0x1042d3,_0x1b34be){return function(_0x4506b8){if(_0x4506b8){return _0x4506b8[_0xffdf('0x1d')](_0x1042d3)[_0xffdf('0x1e')](function(_0x2bf452){return _0x2bf452;});}return null;};}function removeEntity(_0x4ffaaf,_0xede149){return function(_0x11336f){if(_0x11336f){return _0x11336f[_0xffdf('0x1f')]()[_0xffdf('0x1e')](function(){_0x4ffaaf[_0xffdf('0x15')](0xcc)[_0xffdf('0x20')]();});}};}function handleEntityNotFound(_0x33f6d4,_0x5dd6d2){return function(_0x26466b){if(!_0x26466b){_0x33f6d4[_0xffdf('0x21')](0x194);}return _0x26466b;};}function handleError(_0x25a36b,_0x242d30){_0x242d30=_0x242d30||0x1f4;return function(_0x20c9ab){logger[_0xffdf('0x22')](_0x20c9ab[_0xffdf('0x23')]);if(_0x20c9ab[_0xffdf('0x24')]){delete _0x20c9ab[_0xffdf('0x24')];}_0x25a36b[_0xffdf('0x15')](_0x242d30)[_0xffdf('0x25')](_0x20c9ab);};}exports[_0xffdf('0x26')]=function(_0x10953c,_0x11155d){var _0x52355e={},_0xcf6f40={},_0x1469dd={'count':0x0,'rows':[]};var _0x3b23c4=_[_0xffdf('0x27')](db[_0xffdf('0x28')][_0xffdf('0x29')],function(_0x4821de){return{'name':_0x4821de['fieldName'],'type':_0x4821de['type'][_0xffdf('0x2a')]};});_0xcf6f40[_0xffdf('0x2b')]=_[_0xffdf('0x27')](_0x3b23c4,_0xffdf('0x24'));_0xcf6f40[_0xffdf('0x2c')]=_[_0xffdf('0x2d')](_0x10953c[_0xffdf('0x2c')]);_0xcf6f40[_0xffdf('0x2e')]=_[_0xffdf('0x2f')](_0xcf6f40['model'],_0xcf6f40[_0xffdf('0x2c')]);_0x52355e['attributes']=_[_0xffdf('0x2f')](_0xcf6f40['model'],qs[_0xffdf('0x30')](_0x10953c[_0xffdf('0x2c')]['fields']));_0x52355e[_0xffdf('0x31')]=_0x52355e[_0xffdf('0x31')][_0xffdf('0x32')]?_0x52355e['attributes']:_0xcf6f40[_0xffdf('0x2b')];if(!_0x10953c['query']['hasOwnProperty']('nolimit')){_0x52355e[_0xffdf('0x33')]=qs[_0xffdf('0x33')](_0x10953c[_0xffdf('0x2c')][_0xffdf('0x33')]);_0x52355e[_0xffdf('0x16')]=qs['offset'](_0x10953c[_0xffdf('0x2c')][_0xffdf('0x16')]);}_0x52355e[_0xffdf('0x34')]=qs['sort'](_0x10953c[_0xffdf('0x2c')]['sort']);_0x52355e[_0xffdf('0x35')]=qs[_0xffdf('0x2e')](_[_0xffdf('0x36')](_0x10953c[_0xffdf('0x2c')],_0xcf6f40[_0xffdf('0x2e')]),_0x3b23c4);if(_0x10953c[_0xffdf('0x2c')][_0xffdf('0x37')]){_0x52355e[_0xffdf('0x35')]=_[_0xffdf('0x38')](_0x52355e[_0xffdf('0x35')],{'$or':_['map'](_0x3b23c4,function(_0x1e4281){if(_0x1e4281['type']!==_0xffdf('0x39')){var _0x447867={};_0x447867[_0x1e4281[_0xffdf('0x24')]]={'$like':'%'+_0x10953c[_0xffdf('0x2c')][_0xffdf('0x37')]+'%'};return _0x447867;}})});}_0x52355e=_[_0xffdf('0x38')]({},_0x52355e,_0x10953c[_0xffdf('0x3a')]);var _0x476b02={'where':_0x52355e[_0xffdf('0x35')]};return db['Automation'][_0xffdf('0x18')](_0x476b02)[_0xffdf('0x1e')](function(_0x293ec4){_0x1469dd[_0xffdf('0x18')]=_0x293ec4;if(_0x10953c[_0xffdf('0x2c')][_0xffdf('0x3b')]){_0x52355e['include']=[{'all':!![]}];}return db[_0xffdf('0x28')][_0xffdf('0x3c')](_0x52355e);})[_0xffdf('0x1e')](function(_0x544eac){_0x1469dd['rows']=_0x544eac;return _0x1469dd;})['then'](respondWithFilteredResult(_0x11155d,_0x52355e))[_0xffdf('0x3d')](handleError(_0x11155d,null));};exports[_0xffdf('0x3e')]=function(_0x144532,_0x506468){var _0x562a3c={'raw':![],'where':{'id':_0x144532[_0xffdf('0x3f')]['id']}},_0x5d5a2f={};_0x5d5a2f[_0xffdf('0x2b')]=_[_0xffdf('0x2d')](db[_0xffdf('0x28')]['rawAttributes']);_0x5d5a2f[_0xffdf('0x2c')]=_['keys'](_0x144532[_0xffdf('0x2c')]);_0x5d5a2f[_0xffdf('0x2e')]=_[_0xffdf('0x2f')](_0x5d5a2f['model'],_0x5d5a2f['query']);_0x562a3c[_0xffdf('0x31')]=_[_0xffdf('0x2f')](_0x5d5a2f[_0xffdf('0x2b')],qs[_0xffdf('0x30')](_0x144532['query'][_0xffdf('0x30')]));_0x562a3c['attributes']=_0x562a3c[_0xffdf('0x31')][_0xffdf('0x32')]?_0x562a3c[_0xffdf('0x31')]:_0x5d5a2f[_0xffdf('0x2b')];if(_0x144532[_0xffdf('0x2c')][_0xffdf('0x3b')]){_0x562a3c[_0xffdf('0x40')]=[{'all':!![]}];}_0x562a3c=_[_0xffdf('0x38')]({},_0x562a3c,_0x144532['options']);return db[_0xffdf('0x28')][_0xffdf('0x41')](_0x562a3c)['then'](handleEntityNotFound(_0x506468,null))[_0xffdf('0x1e')](respondWithResult(_0x506468,null))[_0xffdf('0x3d')](handleError(_0x506468,null));};exports['create']=function(_0x188500,_0x35b384){return db[_0xffdf('0x28')][_0xffdf('0x42')](_0x188500[_0xffdf('0x43')],{})[_0xffdf('0x1e')](respondWithResult(_0x35b384,0xc9))[_0xffdf('0x3d')](handleError(_0x35b384,null));};exports[_0xffdf('0x1d')]=function(_0x4b3b64,_0x36e71b){if(_0x4b3b64[_0xffdf('0x43')]['id']){delete _0x4b3b64[_0xffdf('0x43')]['id'];}return db[_0xffdf('0x28')]['find']({'where':{'id':_0x4b3b64[_0xffdf('0x3f')]['id']}})[_0xffdf('0x1e')](handleEntityNotFound(_0x36e71b,null))[_0xffdf('0x1e')](saveUpdates(_0x4b3b64[_0xffdf('0x43')],null))[_0xffdf('0x1e')](respondWithResult(_0x36e71b,null))[_0xffdf('0x3d')](handleError(_0x36e71b,null));};exports[_0xffdf('0x1f')]=function(_0x50c327,_0x2dbb45){return db[_0xffdf('0x28')]['find']({'where':{'id':_0x50c327[_0xffdf('0x3f')]['id']}})[_0xffdf('0x1e')](handleEntityNotFound(_0x2dbb45,null))['then'](removeEntity(_0x2dbb45,null))[_0xffdf('0x3d')](handleError(_0x2dbb45,null));};exports['addConditions']=function(_0x50f5e6,_0x32ff77,_0x465e9c){return db['Condition'][_0xffdf('0x41')]({'where':{'id':_0x50f5e6[_0xffdf('0x3f')]['id']}})[_0xffdf('0x1e')](handleEntityNotFound(_0x32ff77,null))['then'](function(_0x14d44d){if(_0x14d44d){return _0x14d44d[_0xffdf('0x44')](_0x50f5e6[_0xffdf('0x43')][_0xffdf('0x45')],_[_0xffdf('0x46')](_0x50f5e6[_0xffdf('0x43')],['ids','id'])||{});}})[_0xffdf('0x1e')](respondWithResult(_0x32ff77,null))[_0xffdf('0x3d')](handleError(_0x32ff77,null));};exports[_0xffdf('0x47')]=function(_0x39e104,_0x1b0233,_0x3ace0a){var _0x17e128={};var _0x2f015d={};var _0x2ad05c;var _0xccb05a;return db[_0xffdf('0x28')][_0xffdf('0x48')]({'where':{'id':_0x39e104[_0xffdf('0x3f')]['id']}})[_0xffdf('0x1e')](handleEntityNotFound(_0x1b0233,null))[_0xffdf('0x1e')](function(_0x5dcfc6){if(_0x5dcfc6){_0x2ad05c=_0x5dcfc6;_0x2f015d[_0xffdf('0x2b')]=_[_0xffdf('0x2d')](db[_0xffdf('0x49')][_0xffdf('0x29')]);_0x2f015d['query']=_['keys'](_0x39e104[_0xffdf('0x2c')]);_0x2f015d['filters']=_['intersection'](_0x2f015d[_0xffdf('0x2b')],_0x2f015d['query']);_0x17e128[_0xffdf('0x31')]=_[_0xffdf('0x2f')](_0x2f015d[_0xffdf('0x2b')],qs['fields'](_0x39e104[_0xffdf('0x2c')][_0xffdf('0x30')]));_0x17e128[_0xffdf('0x31')]=_0x17e128[_0xffdf('0x31')][_0xffdf('0x32')]?_0x17e128[_0xffdf('0x31')]:_0x2f015d[_0xffdf('0x2b')];_0x17e128['order']=qs[_0xffdf('0x4a')](_0x39e104[_0xffdf('0x2c')]['sort']);_0x17e128[_0xffdf('0x35')]=qs[_0xffdf('0x2e')](_['pick'](_0x39e104[_0xffdf('0x2c')],_0x2f015d[_0xffdf('0x2e')]));if(_0x39e104[_0xffdf('0x2c')][_0xffdf('0x37')]){_0x17e128[_0xffdf('0x35')]=_[_0xffdf('0x38')](_0x17e128['where'],{'$or':_[_0xffdf('0x27')](_0x17e128['attributes'],function(_0x595a0a){var _0x16fec0={};_0x16fec0[_0x595a0a]={'$like':'%'+_0x39e104[_0xffdf('0x2c')][_0xffdf('0x37')]+'%'};return _0x16fec0;})});}_0x17e128=_[_0xffdf('0x38')]({},_0x17e128,_0x39e104[_0xffdf('0x3a')]);return _0x2ad05c['getConditions'](_0x17e128);}})[_0xffdf('0x1e')](function(_0x33d147){if(_0x33d147){_0xccb05a=_0x33d147['length'];if(!_0x39e104[_0xffdf('0x2c')][_0xffdf('0x4b')](_0xffdf('0x4c'))){_0x17e128[_0xffdf('0x33')]=qs['limit'](_0x39e104['query'][_0xffdf('0x33')]);_0x17e128[_0xffdf('0x16')]=qs[_0xffdf('0x16')](_0x39e104[_0xffdf('0x2c')]['offset']);}return _0x2ad05c[_0xffdf('0x47')](_0x17e128);}})[_0xffdf('0x1e')](function(_0x562951){if(_0x562951){return _0x562951?{'count':_0xccb05a,'rows':_0x562951}:null;}})['then'](respondWithResult(_0x1b0233,null))[_0xffdf('0x3d')](handleError(_0x1b0233,null));};exports['addActions']=function(_0x1dbab2,_0x18d082,_0x232a06){return db[_0xffdf('0x4d')][_0xffdf('0x41')]({'where':{'id':_0x1dbab2[_0xffdf('0x3f')]['id']}})[_0xffdf('0x1e')](handleEntityNotFound(_0x18d082,null))[_0xffdf('0x1e')](function(_0x4ef90c){if(_0x4ef90c){return _0x4ef90c[_0xffdf('0x4e')](_0x1dbab2[_0xffdf('0x43')][_0xffdf('0x45')],_[_0xffdf('0x46')](_0x1dbab2['body'],[_0xffdf('0x45'),'id'])||{});}})[_0xffdf('0x1e')](respondWithResult(_0x18d082,null))['catch'](handleError(_0x18d082,null));};exports['getActions']=function(_0x4d5408,_0x3f6422,_0x545c73){var _0x3775b4={};var _0x46208a={};var _0x3a42f7;var _0x15ed40;return db[_0xffdf('0x28')][_0xffdf('0x48')]({'where':{'id':_0x4d5408[_0xffdf('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3f6422,null))['then'](function(_0x4c9554){if(_0x4c9554){_0x3a42f7=_0x4c9554;_0x46208a['model']=_[_0xffdf('0x2d')](db[_0xffdf('0x4d')][_0xffdf('0x29')]);_0x46208a['query']=_[_0xffdf('0x2d')](_0x4d5408[_0xffdf('0x2c')]);_0x46208a[_0xffdf('0x2e')]=_[_0xffdf('0x2f')](_0x46208a[_0xffdf('0x2b')],_0x46208a[_0xffdf('0x2c')]);_0x3775b4[_0xffdf('0x31')]=_[_0xffdf('0x2f')](_0x46208a[_0xffdf('0x2b')],qs[_0xffdf('0x30')](_0x4d5408['query'][_0xffdf('0x30')]));_0x3775b4[_0xffdf('0x31')]=_0x3775b4[_0xffdf('0x31')][_0xffdf('0x32')]?_0x3775b4[_0xffdf('0x31')]:_0x46208a['model'];_0x3775b4[_0xffdf('0x34')]=qs[_0xffdf('0x4a')](_0x4d5408[_0xffdf('0x2c')][_0xffdf('0x4a')]);_0x3775b4[_0xffdf('0x35')]=qs[_0xffdf('0x2e')](_[_0xffdf('0x36')](_0x4d5408[_0xffdf('0x2c')],_0x46208a[_0xffdf('0x2e')]));if(_0x4d5408['query'][_0xffdf('0x37')]){_0x3775b4[_0xffdf('0x35')]=_[_0xffdf('0x38')](_0x3775b4[_0xffdf('0x35')],{'$or':_[_0xffdf('0x27')](_0x3775b4[_0xffdf('0x31')],function(_0x50e1bb){var _0x119be7={};_0x119be7[_0x50e1bb]={'$like':'%'+_0x4d5408[_0xffdf('0x2c')][_0xffdf('0x37')]+'%'};return _0x119be7;})});}_0x3775b4=_[_0xffdf('0x38')]({},_0x3775b4,_0x4d5408['options']);return _0x3a42f7[_0xffdf('0x4f')](_0x3775b4);}})[_0xffdf('0x1e')](function(_0x449a52){if(_0x449a52){_0x15ed40=_0x449a52[_0xffdf('0x32')];if(!_0x4d5408[_0xffdf('0x2c')]['hasOwnProperty'](_0xffdf('0x4c'))){_0x3775b4['limit']=qs[_0xffdf('0x33')](_0x4d5408[_0xffdf('0x2c')][_0xffdf('0x33')]);_0x3775b4[_0xffdf('0x16')]=qs[_0xffdf('0x16')](_0x4d5408['query'][_0xffdf('0x16')]);}return _0x3a42f7['getActions'](_0x3775b4);}})[_0xffdf('0x1e')](function(_0x13b280){if(_0x13b280){return _0x13b280?{'count':_0x15ed40,'rows':_0x13b280}:null;}})['then'](respondWithResult(_0x3f6422,null))['catch'](handleError(_0x3f6422,null));}; \ No newline at end of file +var _0xcdef=['create','body','params','addConditions','ids','omit','getConditions','order','addActions','Action','findOne','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Automation','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','rawAttributes','include'];(function(_0x5e8284,_0x51b7d7){var _0xeeab4c=function(_0x584491){while(--_0x584491){_0x5e8284['push'](_0x5e8284['shift']());}};_0xeeab4c(++_0x51b7d7);}(_0xcdef,0xbe));var _0xfcde=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcdef[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfcde('0x0'));var zipdir=require(_0xfcde('0x1'));var jsonpatch=require(_0xfcde('0x2'));var rp=require(_0xfcde('0x3'));var moment=require(_0xfcde('0x4'));var BPromise=require(_0xfcde('0x5'));var Mustache=require('mustache');var util=require(_0xfcde('0x6'));var path=require(_0xfcde('0x7'));var sox=require(_0xfcde('0x8'));var csv=require(_0xfcde('0x9'));var ejs=require(_0xfcde('0xa'));var fs=require('fs');var fs_extra=require(_0xfcde('0xb'));var _=require(_0xfcde('0xc'));var squel=require(_0xfcde('0xd'));var crypto=require(_0xfcde('0xe'));var jsforce=require(_0xfcde('0xf'));var deskjs=require(_0xfcde('0x10'));var toCsv=require(_0xfcde('0x9'));var querystring=require(_0xfcde('0x11'));var Papa=require(_0xfcde('0x12'));var Redis=require(_0xfcde('0x13'));var authService=require(_0xfcde('0x14'));var qs=require(_0xfcde('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcde('0x16'));var logger=require(_0xfcde('0x17'))(_0xfcde('0x18'));var utils=require(_0xfcde('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xfcde('0x1a'));var db=require(_0xfcde('0x1b'))['db'];function respondWithStatusCode(_0x2708a7,_0x332533){_0x332533=_0x332533||0xcc;return function(_0x526f1b){if(_0x526f1b){return _0x2708a7[_0xfcde('0x1c')](_0x332533);}return _0x2708a7[_0xfcde('0x1d')](_0x332533)[_0xfcde('0x1e')]();};}function respondWithResult(_0x1a5b06,_0x1f780b){_0x1f780b=_0x1f780b||0xc8;return function(_0x497a95){if(_0x497a95){return _0x1a5b06[_0xfcde('0x1d')](_0x1f780b)[_0xfcde('0x1f')](_0x497a95);}};}function respondWithFilteredResult(_0x243c1c,_0x212d3d){return function(_0x34c02c){if(_0x34c02c){var _0xae15e4=typeof _0x212d3d[_0xfcde('0x20')]===_0xfcde('0x21')&&typeof _0x212d3d[_0xfcde('0x22')]===_0xfcde('0x21');var _0x49b7c2=_0x34c02c['count'];var _0x45989e=_0xae15e4?0x0:_0x212d3d[_0xfcde('0x20')];var _0x51f5af=_0xae15e4?_0x34c02c[_0xfcde('0x23')]:_0x212d3d[_0xfcde('0x20')]+_0x212d3d[_0xfcde('0x22')];var _0x2cb246;if(_0x51f5af>=_0x49b7c2){_0x51f5af=_0x49b7c2;_0x2cb246=0xc8;}else{_0x2cb246=0xce;}_0x243c1c[_0xfcde('0x1d')](_0x2cb246);return _0x243c1c[_0xfcde('0x24')](_0xfcde('0x25'),_0x45989e+'-'+_0x51f5af+'/'+_0x49b7c2)['json'](_0x34c02c);}return null;};}function patchUpdates(_0x23ee53){return function(_0x1ba3bb){try{jsonpatch[_0xfcde('0x26')](_0x1ba3bb,_0x23ee53,!![]);}catch(_0x6e30a6){return BPromise[_0xfcde('0x27')](_0x6e30a6);}return _0x1ba3bb[_0xfcde('0x28')]();};}function saveUpdates(_0x8603df,_0xd34c8d){return function(_0x202b3){if(_0x202b3){return _0x202b3[_0xfcde('0x29')](_0x8603df)[_0xfcde('0x2a')](function(_0x59f11c){return _0x59f11c;});}return null;};}function removeEntity(_0x2c9479,_0x1f766f){return function(_0x4d171d){if(_0x4d171d){return _0x4d171d[_0xfcde('0x2b')]()[_0xfcde('0x2a')](function(){_0x2c9479[_0xfcde('0x1d')](0xcc)[_0xfcde('0x1e')]();});}};}function handleEntityNotFound(_0x183bc3,_0x664c80){return function(_0xc347ee){if(!_0xc347ee){_0x183bc3[_0xfcde('0x1c')](0x194);}return _0xc347ee;};}function handleError(_0x4464fd,_0x703bf){_0x703bf=_0x703bf||0x1f4;return function(_0x1fe588){logger[_0xfcde('0x2c')](_0x1fe588[_0xfcde('0x2d')]);if(_0x1fe588['name']){delete _0x1fe588[_0xfcde('0x2e')];}_0x4464fd['status'](_0x703bf)[_0xfcde('0x2f')](_0x1fe588);};}exports[_0xfcde('0x30')]=function(_0x319749,_0x31ec58){var _0x4208fa={},_0x482850={},_0x392d28={'count':0x0,'rows':[]};var _0x5b8365=_['map'](db[_0xfcde('0x31')]['rawAttributes'],function(_0xdbe7f5){return{'name':_0xdbe7f5[_0xfcde('0x32')],'type':_0xdbe7f5[_0xfcde('0x33')][_0xfcde('0x34')]};});_0x482850[_0xfcde('0x35')]=_[_0xfcde('0x36')](_0x5b8365,'name');_0x482850[_0xfcde('0x37')]=_[_0xfcde('0x38')](_0x319749[_0xfcde('0x37')]);_0x482850[_0xfcde('0x39')]=_[_0xfcde('0x3a')](_0x482850[_0xfcde('0x35')],_0x482850[_0xfcde('0x37')]);_0x4208fa[_0xfcde('0x3b')]=_['intersection'](_0x482850[_0xfcde('0x35')],qs['fields'](_0x319749[_0xfcde('0x37')][_0xfcde('0x3c')]));_0x4208fa[_0xfcde('0x3b')]=_0x4208fa[_0xfcde('0x3b')][_0xfcde('0x3d')]?_0x4208fa['attributes']:_0x482850['model'];if(!_0x319749[_0xfcde('0x37')][_0xfcde('0x3e')](_0xfcde('0x3f'))){_0x4208fa[_0xfcde('0x22')]=qs[_0xfcde('0x22')](_0x319749[_0xfcde('0x37')][_0xfcde('0x22')]);_0x4208fa[_0xfcde('0x20')]=qs[_0xfcde('0x20')](_0x319749['query']['offset']);}_0x4208fa['order']=qs[_0xfcde('0x40')](_0x319749[_0xfcde('0x37')]['sort']);_0x4208fa['where']=qs[_0xfcde('0x39')](_[_0xfcde('0x41')](_0x319749['query'],_0x482850[_0xfcde('0x39')]),_0x5b8365);if(_0x319749[_0xfcde('0x37')][_0xfcde('0x42')]){_0x4208fa[_0xfcde('0x43')]=_[_0xfcde('0x44')](_0x4208fa[_0xfcde('0x43')],{'$or':_[_0xfcde('0x36')](_0x5b8365,function(_0x1bf762){if(_0x1bf762[_0xfcde('0x33')]!==_0xfcde('0x45')){var _0x2d1b61={};_0x2d1b61[_0x1bf762[_0xfcde('0x2e')]]={'$like':'%'+_0x319749[_0xfcde('0x37')][_0xfcde('0x42')]+'%'};return _0x2d1b61;}})});}_0x4208fa=_[_0xfcde('0x44')]({},_0x4208fa,_0x319749[_0xfcde('0x46')]);var _0x508baf={'where':_0x4208fa[_0xfcde('0x43')]};return db[_0xfcde('0x31')]['count'](_0x508baf)[_0xfcde('0x2a')](function(_0x27462b){_0x392d28[_0xfcde('0x23')]=_0x27462b;if(_0x319749[_0xfcde('0x37')][_0xfcde('0x47')]){_0x4208fa['include']=[{'all':!![]}];}return db[_0xfcde('0x31')][_0xfcde('0x48')](_0x4208fa);})[_0xfcde('0x2a')](function(_0x518bc5){_0x392d28['rows']=_0x518bc5;return _0x392d28;})['then'](respondWithFilteredResult(_0x31ec58,_0x4208fa))[_0xfcde('0x49')](handleError(_0x31ec58,null));};exports[_0xfcde('0x4a')]=function(_0x40eb2f,_0xe3ebd0){var _0x33d104={'raw':![],'where':{'id':_0x40eb2f['params']['id']}},_0x55449a={};_0x55449a[_0xfcde('0x35')]=_[_0xfcde('0x38')](db['Automation'][_0xfcde('0x4b')]);_0x55449a[_0xfcde('0x37')]=_[_0xfcde('0x38')](_0x40eb2f[_0xfcde('0x37')]);_0x55449a[_0xfcde('0x39')]=_[_0xfcde('0x3a')](_0x55449a['model'],_0x55449a['query']);_0x33d104['attributes']=_[_0xfcde('0x3a')](_0x55449a[_0xfcde('0x35')],qs['fields'](_0x40eb2f[_0xfcde('0x37')][_0xfcde('0x3c')]));_0x33d104[_0xfcde('0x3b')]=_0x33d104[_0xfcde('0x3b')][_0xfcde('0x3d')]?_0x33d104['attributes']:_0x55449a[_0xfcde('0x35')];if(_0x40eb2f['query'][_0xfcde('0x47')]){_0x33d104[_0xfcde('0x4c')]=[{'all':!![]}];}_0x33d104=_[_0xfcde('0x44')]({},_0x33d104,_0x40eb2f[_0xfcde('0x46')]);return db[_0xfcde('0x31')]['find'](_0x33d104)[_0xfcde('0x2a')](handleEntityNotFound(_0xe3ebd0,null))[_0xfcde('0x2a')](respondWithResult(_0xe3ebd0,null))[_0xfcde('0x49')](handleError(_0xe3ebd0,null));};exports[_0xfcde('0x4d')]=function(_0x1f1b59,_0x35f3b5){return db[_0xfcde('0x31')][_0xfcde('0x4d')](_0x1f1b59[_0xfcde('0x4e')],{})[_0xfcde('0x2a')](respondWithResult(_0x35f3b5,0xc9))[_0xfcde('0x49')](handleError(_0x35f3b5,null));};exports[_0xfcde('0x29')]=function(_0x276e8f,_0x4fb7c9){if(_0x276e8f['body']['id']){delete _0x276e8f[_0xfcde('0x4e')]['id'];}return db['Automation']['find']({'where':{'id':_0x276e8f[_0xfcde('0x4f')]['id']}})[_0xfcde('0x2a')](handleEntityNotFound(_0x4fb7c9,null))['then'](saveUpdates(_0x276e8f[_0xfcde('0x4e')],null))[_0xfcde('0x2a')](respondWithResult(_0x4fb7c9,null))[_0xfcde('0x49')](handleError(_0x4fb7c9,null));};exports['destroy']=function(_0x1856aa,_0x3780ea){return db[_0xfcde('0x31')]['find']({'where':{'id':_0x1856aa[_0xfcde('0x4f')]['id']}})[_0xfcde('0x2a')](handleEntityNotFound(_0x3780ea,null))[_0xfcde('0x2a')](removeEntity(_0x3780ea,null))[_0xfcde('0x49')](handleError(_0x3780ea,null));};exports[_0xfcde('0x50')]=function(_0xf81d56,_0x4029c0,_0x246a4a){return db['Condition']['find']({'where':{'id':_0xf81d56[_0xfcde('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4029c0,null))[_0xfcde('0x2a')](function(_0x3a721b){if(_0x3a721b){return _0x3a721b[_0xfcde('0x50')](_0xf81d56[_0xfcde('0x4e')][_0xfcde('0x51')],_[_0xfcde('0x52')](_0xf81d56[_0xfcde('0x4e')],[_0xfcde('0x51'),'id'])||{});}})[_0xfcde('0x2a')](respondWithResult(_0x4029c0,null))[_0xfcde('0x49')](handleError(_0x4029c0,null));};exports[_0xfcde('0x53')]=function(_0x55b32f,_0x5aabc7,_0x3964eb){var _0xc36aa2={};var _0x11c106={};var _0x274b80;var _0x220477;return db['Automation']['findOne']({'where':{'id':_0x55b32f[_0xfcde('0x4f')]['id']}})[_0xfcde('0x2a')](handleEntityNotFound(_0x5aabc7,null))[_0xfcde('0x2a')](function(_0x495fb6){if(_0x495fb6){_0x274b80=_0x495fb6;_0x11c106['model']=_[_0xfcde('0x38')](db['Condition'][_0xfcde('0x4b')]);_0x11c106[_0xfcde('0x37')]=_[_0xfcde('0x38')](_0x55b32f['query']);_0x11c106['filters']=_[_0xfcde('0x3a')](_0x11c106[_0xfcde('0x35')],_0x11c106['query']);_0xc36aa2['attributes']=_['intersection'](_0x11c106[_0xfcde('0x35')],qs[_0xfcde('0x3c')](_0x55b32f[_0xfcde('0x37')][_0xfcde('0x3c')]));_0xc36aa2[_0xfcde('0x3b')]=_0xc36aa2[_0xfcde('0x3b')]['length']?_0xc36aa2[_0xfcde('0x3b')]:_0x11c106['model'];_0xc36aa2[_0xfcde('0x54')]=qs[_0xfcde('0x40')](_0x55b32f[_0xfcde('0x37')][_0xfcde('0x40')]);_0xc36aa2[_0xfcde('0x43')]=qs['filters'](_[_0xfcde('0x41')](_0x55b32f[_0xfcde('0x37')],_0x11c106[_0xfcde('0x39')]));if(_0x55b32f[_0xfcde('0x37')]['filter']){_0xc36aa2['where']=_['merge'](_0xc36aa2[_0xfcde('0x43')],{'$or':_[_0xfcde('0x36')](_0xc36aa2[_0xfcde('0x3b')],function(_0x3990a3){var _0x31aa2c={};_0x31aa2c[_0x3990a3]={'$like':'%'+_0x55b32f[_0xfcde('0x37')][_0xfcde('0x42')]+'%'};return _0x31aa2c;})});}_0xc36aa2=_['merge']({},_0xc36aa2,_0x55b32f[_0xfcde('0x46')]);return _0x274b80['getConditions'](_0xc36aa2);}})[_0xfcde('0x2a')](function(_0x3a9ae6){if(_0x3a9ae6){_0x220477=_0x3a9ae6['length'];if(!_0x55b32f['query']['hasOwnProperty'](_0xfcde('0x3f'))){_0xc36aa2[_0xfcde('0x22')]=qs[_0xfcde('0x22')](_0x55b32f['query'][_0xfcde('0x22')]);_0xc36aa2[_0xfcde('0x20')]=qs[_0xfcde('0x20')](_0x55b32f[_0xfcde('0x37')][_0xfcde('0x20')]);}return _0x274b80[_0xfcde('0x53')](_0xc36aa2);}})[_0xfcde('0x2a')](function(_0x4c7efa){if(_0x4c7efa){return _0x4c7efa?{'count':_0x220477,'rows':_0x4c7efa}:null;}})[_0xfcde('0x2a')](respondWithResult(_0x5aabc7,null))[_0xfcde('0x49')](handleError(_0x5aabc7,null));};exports[_0xfcde('0x55')]=function(_0x479c85,_0x56c6b6,_0x924a73){return db[_0xfcde('0x56')]['find']({'where':{'id':_0x479c85[_0xfcde('0x4f')]['id']}})[_0xfcde('0x2a')](handleEntityNotFound(_0x56c6b6,null))[_0xfcde('0x2a')](function(_0x412418){if(_0x412418){return _0x412418[_0xfcde('0x55')](_0x479c85[_0xfcde('0x4e')][_0xfcde('0x51')],_[_0xfcde('0x52')](_0x479c85[_0xfcde('0x4e')],[_0xfcde('0x51'),'id'])||{});}})[_0xfcde('0x2a')](respondWithResult(_0x56c6b6,null))[_0xfcde('0x49')](handleError(_0x56c6b6,null));};exports['getActions']=function(_0x5337ec,_0x5ceb9a,_0xacacaf){var _0x372b51={};var _0x1dc0d8={};var _0x3b3d6b;var _0x5b88b3;return db[_0xfcde('0x31')][_0xfcde('0x57')]({'where':{'id':_0x5337ec[_0xfcde('0x4f')]['id']}})[_0xfcde('0x2a')](handleEntityNotFound(_0x5ceb9a,null))[_0xfcde('0x2a')](function(_0x591d03){if(_0x591d03){_0x3b3d6b=_0x591d03;_0x1dc0d8[_0xfcde('0x35')]=_['keys'](db[_0xfcde('0x56')][_0xfcde('0x4b')]);_0x1dc0d8[_0xfcde('0x37')]=_['keys'](_0x5337ec[_0xfcde('0x37')]);_0x1dc0d8['filters']=_[_0xfcde('0x3a')](_0x1dc0d8[_0xfcde('0x35')],_0x1dc0d8[_0xfcde('0x37')]);_0x372b51[_0xfcde('0x3b')]=_[_0xfcde('0x3a')](_0x1dc0d8[_0xfcde('0x35')],qs[_0xfcde('0x3c')](_0x5337ec[_0xfcde('0x37')]['fields']));_0x372b51[_0xfcde('0x3b')]=_0x372b51['attributes'][_0xfcde('0x3d')]?_0x372b51[_0xfcde('0x3b')]:_0x1dc0d8[_0xfcde('0x35')];_0x372b51[_0xfcde('0x54')]=qs['sort'](_0x5337ec['query'][_0xfcde('0x40')]);_0x372b51['where']=qs['filters'](_[_0xfcde('0x41')](_0x5337ec[_0xfcde('0x37')],_0x1dc0d8[_0xfcde('0x39')]));if(_0x5337ec[_0xfcde('0x37')][_0xfcde('0x42')]){_0x372b51['where']=_[_0xfcde('0x44')](_0x372b51[_0xfcde('0x43')],{'$or':_['map'](_0x372b51[_0xfcde('0x3b')],function(_0xb2f4d7){var _0x4001a7={};_0x4001a7[_0xb2f4d7]={'$like':'%'+_0x5337ec['query']['filter']+'%'};return _0x4001a7;})});}_0x372b51=_['merge']({},_0x372b51,_0x5337ec[_0xfcde('0x46')]);return _0x3b3d6b[_0xfcde('0x58')](_0x372b51);}})[_0xfcde('0x2a')](function(_0x2a7d73){if(_0x2a7d73){_0x5b88b3=_0x2a7d73[_0xfcde('0x3d')];if(!_0x5337ec[_0xfcde('0x37')][_0xfcde('0x3e')]('nolimit')){_0x372b51[_0xfcde('0x22')]=qs[_0xfcde('0x22')](_0x5337ec[_0xfcde('0x37')][_0xfcde('0x22')]);_0x372b51[_0xfcde('0x20')]=qs['offset'](_0x5337ec['query'][_0xfcde('0x20')]);}return _0x3b3d6b['getActions'](_0x372b51);}})[_0xfcde('0x2a')](function(_0x3dbf1e){if(_0x3dbf1e){return _0x3dbf1e?{'count':_0x5b88b3,'rows':_0x3dbf1e}:null;}})['then'](respondWithResult(_0x5ceb9a,null))[_0xfcde('0x49')](handleError(_0x5ceb9a,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 1592f66..a824786 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 _0x0f03=['request-promise','path','rimraf','../../config/environment','exports','Automation','tools_automations','lodash','util','moment','bluebird'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x0f03,0x167));var _0x30f0=function(_0x38fd64,_0x1185f5){_0x38fd64=_0x38fd64-0x0;var _0x89e52a=_0x0f03[_0x38fd64];return _0x89e52a;};'use strict';var _=require(_0x30f0('0x0'));var util=require(_0x30f0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x30f0('0x2'));var BPromise=require(_0x30f0('0x3'));var rp=require(_0x30f0('0x4'));var fs=require('fs');var path=require(_0x30f0('0x5'));var rimraf=require(_0x30f0('0x6'));var config=require(_0x30f0('0x7'));var attributes=require('./automation.attributes');module[_0x30f0('0x8')]=function(_0x204175,_0x2ccfb9){return _0x204175['define'](_0x30f0('0x9'),attributes,{'tableName':_0x30f0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde2c=['tools_automations','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./automation.attributes','exports','define','Automation'];(function(_0x526d6c,_0x1cc58a){var _0x43b854=function(_0x2768d5){while(--_0x2768d5){_0x526d6c['push'](_0x526d6c['shift']());}};_0x43b854(++_0x1cc58a);}(_0xde2c,0x140));var _0xcde2=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xde2c[_0x22f8ab];return _0x2a70e5;};'use strict';var _=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var logger=require(_0xcde2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcde2('0x3'));var rp=require(_0xcde2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcde2('0x5'));var attributes=require(_0xcde2('0x6'));module[_0xcde2('0x7')]=function(_0x26b311,_0x12ea44){return _0x26b311[_0xcde2('0x8')](_0xcde2('0x9'),attributes,{'tableName':_0xcde2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index a93a201..a3702bb 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 _0x75dc=['debug','Automation,\x20%s,\x20%s,\x20%s','error','code','Automation,\x20%s,\x20%s','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent'];(function(_0x5a8316,_0x36874b){var _0x325d0b=function(_0x1ea7c5){while(--_0x1ea7c5){_0x5a8316['push'](_0x5a8316['shift']());}};_0x325d0b(++_0x36874b);}(_0x75dc,0x1d7));var _0xc75d=function(_0x1db498,_0x4589c4){_0x1db498=_0x1db498-0x0;var _0x5a171f=_0x75dc[_0x1db498];return _0x5a171f;};'use strict';var _=require(_0xc75d('0x0'));var util=require(_0xc75d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc75d('0x2'));var db=require(_0xc75d('0x3'))['db'];var utils=require(_0xc75d('0x4'));var logger=require(_0xc75d('0x5'))(_0xc75d('0x6'));var config=require(_0xc75d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc75d('0x8')][_0xc75d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x928edc,_0x5d75a9,_0x1ed94f){return new BPromise(function(_0x182591,_0x645b48){return client[_0xc75d('0xa')](_0x928edc,_0x1ed94f)['then'](function(_0x264fcb){logger['info']('Automation,\x20%s,\x20%s',_0x5d75a9,_0xc75d('0xb'));logger[_0xc75d('0xc')](_0xc75d('0xd'),_0x5d75a9,_0xc75d('0xb'),JSON['stringify'](_0x264fcb));if(_0x264fcb[_0xc75d('0xe')]){if(_0x264fcb[_0xc75d('0xe')][_0xc75d('0xf')]===0x1f4){logger[_0xc75d('0xe')](_0xc75d('0x10'),_0x5d75a9,_0x264fcb[_0xc75d('0xe')][_0xc75d('0x11')]);return _0x645b48(_0x264fcb['error'][_0xc75d('0x11')]);}logger[_0xc75d('0xe')](_0xc75d('0x10'),_0x5d75a9,_0x264fcb[_0xc75d('0xe')]['message']);return _0x182591(_0x264fcb['error'][_0xc75d('0x11')]);}else{logger[_0xc75d('0x12')](_0xc75d('0x10'),_0x5d75a9,_0xc75d('0xb'));_0x182591(_0x264fcb[_0xc75d('0x13')][_0xc75d('0x11')]);}})[_0xc75d('0x14')](function(_0x4b8552){logger[_0xc75d('0xe')](_0xc75d('0x10'),_0x5d75a9,_0x4b8552);_0x645b48(_0x4b8552);});});} \ No newline at end of file +var _0x5ae9=['client','http','request','then','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','Automation,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0xf1e3ec,_0x32deef){var _0x565b82=function(_0x11f60f){while(--_0x11f60f){_0xf1e3ec['push'](_0xf1e3ec['shift']());}};_0x565b82(++_0x32deef);}(_0x5ae9,0x19b));var _0x95ae=function(_0x69e89e,_0x1fb302){_0x69e89e=_0x69e89e-0x0;var _0x39b87d=_0x5ae9[_0x69e89e];return _0x39b87d;};'use strict';var _=require(_0x95ae('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x95ae('0x1'));var rs=require(_0x95ae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95ae('0x3'))['db'];var utils=require(_0x95ae('0x4'));var logger=require('../../config/logger')(_0x95ae('0x5'));var config=require('../../config/environment');var jayson=require(_0x95ae('0x6'));var client=jayson[_0x95ae('0x7')][_0x95ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xec2c41,_0x3c4cda,_0x4df142){return new BPromise(function(_0x588bab,_0x19ba28){return client[_0x95ae('0x9')](_0xec2c41,_0x4df142)[_0x95ae('0xa')](function(_0x25b2ec){logger['info']('Automation,\x20%s,\x20%s',_0x3c4cda,_0x95ae('0xb'));logger[_0x95ae('0xc')](_0x95ae('0xd'),_0x3c4cda,_0x95ae('0xb'),JSON['stringify'](_0x25b2ec));if(_0x25b2ec['error']){if(_0x25b2ec[_0x95ae('0xe')]['code']===0x1f4){logger[_0x95ae('0xe')](_0x95ae('0xf'),_0x3c4cda,_0x25b2ec['error'][_0x95ae('0x10')]);return _0x19ba28(_0x25b2ec[_0x95ae('0xe')][_0x95ae('0x10')]);}logger['error'](_0x95ae('0xf'),_0x3c4cda,_0x25b2ec[_0x95ae('0xe')][_0x95ae('0x10')]);return _0x588bab(_0x25b2ec['error'][_0x95ae('0x10')]);}else{logger['info'](_0x95ae('0xf'),_0x3c4cda,'request\x20sent');_0x588bab(_0x25b2ec[_0x95ae('0x11')][_0x95ae('0x10')]);}})[_0x95ae('0x12')](function(_0x11e960){logger[_0x95ae('0xe')](_0x95ae('0xf'),_0x3c4cda,_0x11e960);_0x19ba28(_0x11e960);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 8305863..6f77baf 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 _0xfb3c=['put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions'];(function(_0x46fd18,_0x529cf9){var _0x277c05=function(_0x3c8578){while(--_0x3c8578){_0x46fd18['push'](_0x46fd18['shift']());}};_0x277c05(++_0x529cf9);}(_0xfb3c,0x1df));var _0xcfb3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xfb3c[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xcfb3('0x0'));var util=require(_0xcfb3('0x1'));var path=require(_0xcfb3('0x2'));var timeout=require(_0xcfb3('0x3'));var express=require('express');var router=express[_0xcfb3('0x4')]();var fs_extra=require(_0xcfb3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcfb3('0x6'));var config=require(_0xcfb3('0x7'));var controller=require('./automation.controller');router[_0xcfb3('0x8')]('/',auth['isAuthenticated'](),controller[_0xcfb3('0x9')]);router[_0xcfb3('0x8')](_0xcfb3('0xa'),auth[_0xcfb3('0xb')](),controller[_0xcfb3('0xc')]);router[_0xcfb3('0x8')](_0xcfb3('0xd'),auth[_0xcfb3('0xb')](),controller[_0xcfb3('0xe')]);router['get'](_0xcfb3('0xf'),auth[_0xcfb3('0xb')](),controller[_0xcfb3('0x10')]);router[_0xcfb3('0x11')]('/',auth[_0xcfb3('0xb')](),controller[_0xcfb3('0x12')]);router[_0xcfb3('0x11')](_0xcfb3('0xd'),auth[_0xcfb3('0xb')](),controller[_0xcfb3('0x13')]);router[_0xcfb3('0x11')](_0xcfb3('0xf'),auth[_0xcfb3('0xb')](),controller[_0xcfb3('0x14')]);router[_0xcfb3('0x15')]('/:id',auth[_0xcfb3('0xb')](),controller[_0xcfb3('0x16')]);router[_0xcfb3('0x17')]('/:id',auth[_0xcfb3('0xb')](),controller['destroy']);module[_0xcfb3('0x18')]=router; \ No newline at end of file +var _0x9491=['get','index','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x481b07,_0x170d5d){var _0x10dec8=function(_0x352132){while(--_0x352132){_0x481b07['push'](_0x481b07['shift']());}};_0x10dec8(++_0x170d5d);}(_0x9491,0xb6));var _0x1949=function(_0x2c7d36,_0x4428eb){_0x2c7d36=_0x2c7d36-0x0;var _0x368dfd=_0x9491[_0x2c7d36];return _0x368dfd;};'use strict';var multer=require(_0x1949('0x0'));var util=require(_0x1949('0x1'));var path=require(_0x1949('0x2'));var timeout=require(_0x1949('0x3'));var express=require(_0x1949('0x4'));var router=express[_0x1949('0x5')]();var fs_extra=require(_0x1949('0x6'));var auth=require(_0x1949('0x7'));var interaction=require(_0x1949('0x8'));var config=require(_0x1949('0x9'));var controller=require('./automation.controller');router[_0x1949('0xa')]('/',auth['isAuthenticated'](),controller[_0x1949('0xb')]);router[_0x1949('0xa')]('/:id',auth[_0x1949('0xc')](),controller[_0x1949('0xd')]);router[_0x1949('0xa')](_0x1949('0xe'),auth[_0x1949('0xc')](),controller[_0x1949('0xf')]);router[_0x1949('0xa')](_0x1949('0x10'),auth[_0x1949('0xc')](),controller[_0x1949('0x11')]);router[_0x1949('0x12')]('/',auth['isAuthenticated'](),controller[_0x1949('0x13')]);router[_0x1949('0x12')](_0x1949('0xe'),auth[_0x1949('0xc')](),controller[_0x1949('0x14')]);router[_0x1949('0x12')]('/:id/actions',auth[_0x1949('0xc')](),controller['addActions']);router['put'](_0x1949('0x15'),auth[_0x1949('0xc')](),controller[_0x1949('0x16')]);router['delete'](_0x1949('0x15'),auth[_0x1949('0xc')](),controller[_0x1949('0x17')]);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 e72cd78..4d2f3c0 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 _0xa5a4=['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)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','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','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED'];(function(_0x50f891,_0x238839){var _0x24889c=function(_0x27c900){while(--_0x27c900){_0x50f891['push'](_0x50f891['shift']());}};_0x24889c(++_0x238839);}(_0xa5a4,0x14e));var _0x4a5a=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xa5a4[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require(_0x4a5a('0x0'));module['exports']={'name':{'type':Sequelize[_0x4a5a('0x1')],'unique':_0x4a5a('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x4a5a('0x3')](_0x4a5a('0x4')),'allowNull':![],'defaultValue':_0x4a5a('0x4')},'description':{'type':Sequelize[_0x4a5a('0x1')]},'active':{'type':Sequelize[_0x4a5a('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x4a5a('0x6')](0x4)[_0x4a5a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4a5a('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4a5a('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4a5a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4a5a('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4a5a('0x6')](0x3)[_0x4a5a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4a5a('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4a5a('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4a5a('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x4a5a('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4a5a('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4a5a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4a5a('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4a5a('0x6')](0x3)[_0x4a5a('0x7')],'defaultValue':0x3,'comment':_0x4a5a('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4a5a('0x6')](0x5)[_0x4a5a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x4a5a('0x6')](0x3)[_0x4a5a('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4a5a('0xf')},'dialTimezone':{'type':Sequelize[_0x4a5a('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4a5a('0x1')],'defaultValue':_0x4a5a('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x4a5a('0x3')](_0x4a5a('0x11'),_0x4a5a('0x12'),_0x4a5a('0x13')),'defaultValue':_0x4a5a('0x11')},'dialAMDActive':{'type':Sequelize[_0x4a5a('0x5')],'defaultValue':0x0,'comment':_0x4a5a('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4a5a('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4a5a('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x4a5a('0x6')](0x9)[_0x4a5a('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4a5a('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4a5a('0x6')](0x9)[_0x4a5a('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4a5a('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4a5a('0x6')](0x9)[_0x4a5a('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4a5a('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x4a5a('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4a5a('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4a5a('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4a5a('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4a5a('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4a5a('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4a5a('0x6')](0x9)[_0x4a5a('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4a5a('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4a5a('0x3')](_0x4a5a('0x1d'),_0x4a5a('0x1e')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x4a5a('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4a5a('0x6')](0x3)[_0x4a5a('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4a5a('0x1f')},'dialCutDigit':{'type':Sequelize[_0x4a5a('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4a5a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4a5a('0x6')](0x5)[_0x4a5a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4a5a('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x4a5a('0x6')](0x3)[_0x4a5a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4a5a('0x21')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4a5a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4a5a('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4a5a('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4a5a('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x4a5a('0x6')](0x3)[_0x4a5a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x4a5a('0x6')](0x5)[_0x4a5a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4a5a('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4a5a('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4a5a('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4a5a('0x25')}}; \ No newline at end of file +var _0x8251=['exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','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\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8251,0x8f));var _0x1825=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x8251[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x1825('0x0'));module[_0x1825('0x1')]={'name':{'type':Sequelize[_0x1825('0x2')],'unique':_0x1825('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1825('0x4')](_0x1825('0x5')),'allowNull':![],'defaultValue':_0x1825('0x5')},'description':{'type':Sequelize[_0x1825('0x2')]},'active':{'type':Sequelize[_0x1825('0x6')],'defaultValue':0x0,'comment':_0x1825('0x7')},'limitCalls':{'type':Sequelize[_0x1825('0x8')](0x4)[_0x1825('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1825('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1825('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1825('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1825('0x8')](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1825('0x8')](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1825('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1825('0x9')],'defaultValue':0x3,'comment':_0x1825('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1825('0x8')](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x1825('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1825('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x1825('0xf'),'never',_0x1825('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x1825('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1825('0x8')](0x9)[_0x1825('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1825('0x11')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x1825('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1825('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1825('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1825('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1825('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x1825('0x8')](0x9)[_0x1825('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1825('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1825('0x8')](0x9)[_0x1825('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1825('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1825('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1825('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1825('0x8')](0x5)[_0x1825('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1825('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1825('0x8')](0x9)[_0x1825('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1825('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1825('0x4')](_0x1825('0x19'),_0x1825('0x1a')),'defaultValue':_0x1825('0x19')},'dialPrefix':{'type':Sequelize[_0x1825('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1825('0x1b')},'dialCutDigit':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1825('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1825('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1825('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0x1d')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1825('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1825('0x8')](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1825('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1825('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 2df3e57..b02c92c 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 _0x2931=['onlyIfOpen','CmListId','CampaignId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','IvrCampaigns','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','create','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','body','omit','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','findOne','CampaignId','CmHopper','findAll','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)'];(function(_0x51b739,_0x432ddc){var _0x22ce9f=function(_0x5ea34d){while(--_0x5ea34d){_0x51b739['push'](_0x51b739['shift']());}};_0x22ce9f(++_0x432ddc);}(_0x2931,0x8f));var _0x1293=function(_0x293855,_0x51c6f8){_0x293855=_0x293855-0x0;var _0x2dd5f9=_0x2931[_0x293855];return _0x2dd5f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1293('0x0'));var zipdir=require(_0x1293('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1293('0x2'));var moment=require(_0x1293('0x3'));var BPromise=require(_0x1293('0x4'));var Mustache=require(_0x1293('0x5'));var util=require(_0x1293('0x6'));var path=require('path');var sox=require(_0x1293('0x7'));var csv=require(_0x1293('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1293('0x9'));var squel=require(_0x1293('0xa'));var crypto=require(_0x1293('0xb'));var jsforce=require(_0x1293('0xc'));var deskjs=require(_0x1293('0xd'));var toCsv=require(_0x1293('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1293('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1293('0xf'));var as=require(_0x1293('0x10'));var hardwareService=require(_0x1293('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x1293('0x12'));var config=require(_0x1293('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1293('0x14'))['db'];function respondWithStatusCode(_0x322c7a,_0x5723ad){_0x5723ad=_0x5723ad||0xcc;return function(_0x121fb8){if(_0x121fb8){return _0x322c7a[_0x1293('0x15')](_0x5723ad);}return _0x322c7a[_0x1293('0x16')](_0x5723ad)[_0x1293('0x17')]();};}function respondWithResult(_0x13f0fd,_0x4c70a5){_0x4c70a5=_0x4c70a5||0xc8;return function(_0x3d2ad5){if(_0x3d2ad5){return _0x13f0fd[_0x1293('0x16')](_0x4c70a5)[_0x1293('0x18')](_0x3d2ad5);}};}function respondWithFilteredResult(_0x2cec31,_0x1ebe03){return function(_0xa93996){if(_0xa93996){var _0x3bc2ee=typeof _0x1ebe03[_0x1293('0x19')]===_0x1293('0x1a')&&typeof _0x1ebe03[_0x1293('0x1b')]==='undefined';var _0x49183d=_0xa93996['count'];var _0x3f02f1=_0x3bc2ee?0x0:_0x1ebe03['offset'];var _0x245c4b=_0x3bc2ee?_0xa93996[_0x1293('0x1c')]:_0x1ebe03['offset']+_0x1ebe03[_0x1293('0x1b')];var _0x2cea9d;if(_0x245c4b>=_0x49183d){_0x245c4b=_0x49183d;_0x2cea9d=0xc8;}else{_0x2cea9d=0xce;}_0x2cec31[_0x1293('0x16')](_0x2cea9d);return _0x2cec31['set']('Content-Range',_0x3f02f1+'-'+_0x245c4b+'/'+_0x49183d)[_0x1293('0x18')](_0xa93996);}return null;};}function patchUpdates(_0xb87d20){return function(_0x13feb2){try{jsonpatch[_0x1293('0x1d')](_0x13feb2,_0xb87d20,!![]);}catch(_0x3855d2){return BPromise[_0x1293('0x1e')](_0x3855d2);}return _0x13feb2[_0x1293('0x1f')]();};}function saveUpdates(_0xc5fff0,_0x324087){return function(_0x331b91){if(_0x331b91){return _0x331b91[_0x1293('0x20')](_0xc5fff0)[_0x1293('0x21')](function(_0x1907ab){return _0x1907ab;});}return null;};}function removeEntity(_0x31cf85,_0x56c22a){return function(_0x350e5d){if(_0x350e5d){return _0x350e5d[_0x1293('0x22')]()[_0x1293('0x21')](function(){var _0x1188a1=_0x350e5d[_0x1293('0x23')]({'plain':!![]});var _0x5430ea=_0x1293('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x5430ea,'resourceId':_0x1188a1['id']}})[_0x1293('0x21')](function(){return _0x350e5d;});})[_0x1293('0x21')](function(){_0x31cf85[_0x1293('0x16')](0xcc)[_0x1293('0x17')]();});}};}function handleEntityNotFound(_0x498478,_0x4e29ff){return function(_0x30bf68){if(!_0x30bf68){_0x498478[_0x1293('0x15')](0x194);}return _0x30bf68;};}function handleError(_0x4d1561,_0x259204){_0x259204=_0x259204||0x1f4;return function(_0x238d89){logger[_0x1293('0x25')](_0x238d89[_0x1293('0x26')]);if(_0x238d89[_0x1293('0x27')]){delete _0x238d89[_0x1293('0x27')];}_0x4d1561[_0x1293('0x16')](_0x259204)[_0x1293('0x28')](_0x238d89);};}exports[_0x1293('0x29')]=function(_0xd26f9f,_0x1c00b5){var _0x3ad47b={},_0x148eb9={},_0x373fe1={'count':0x0,'rows':[]};var _0x241cac=_[_0x1293('0x2a')](db[_0x1293('0x2b')][_0x1293('0x2c')],function(_0x2cbdb6){return{'name':_0x2cbdb6[_0x1293('0x2d')],'type':_0x2cbdb6[_0x1293('0x2e')][_0x1293('0x2f')]};});_0x148eb9['model']=_[_0x1293('0x2a')](_0x241cac,_0x1293('0x27'));_0x148eb9[_0x1293('0x30')]=_[_0x1293('0x31')](_0xd26f9f[_0x1293('0x30')]);_0x148eb9[_0x1293('0x32')]=_[_0x1293('0x33')](_0x148eb9['model'],_0x148eb9['query']);_0x3ad47b['attributes']=_[_0x1293('0x33')](_0x148eb9[_0x1293('0x34')],qs[_0x1293('0x35')](_0xd26f9f[_0x1293('0x30')]['fields']));_0x3ad47b[_0x1293('0x36')]=_0x3ad47b[_0x1293('0x36')][_0x1293('0x37')]?_0x3ad47b[_0x1293('0x36')]:_0x148eb9[_0x1293('0x34')];if(!_0xd26f9f['query'][_0x1293('0x38')](_0x1293('0x39'))){_0x3ad47b[_0x1293('0x1b')]=qs[_0x1293('0x1b')](_0xd26f9f[_0x1293('0x30')][_0x1293('0x1b')]);_0x3ad47b[_0x1293('0x19')]=qs[_0x1293('0x19')](_0xd26f9f[_0x1293('0x30')][_0x1293('0x19')]);}_0x3ad47b[_0x1293('0x3a')]=qs[_0x1293('0x3b')](_0xd26f9f[_0x1293('0x30')][_0x1293('0x3b')]);_0x3ad47b[_0x1293('0x3c')]=qs[_0x1293('0x32')](_[_0x1293('0x3d')](_0xd26f9f[_0x1293('0x30')],_0x148eb9[_0x1293('0x32')]),_0x241cac);if(_0xd26f9f['query'][_0x1293('0x3e')]){_0x3ad47b[_0x1293('0x3c')]=_[_0x1293('0x3f')](_0x3ad47b[_0x1293('0x3c')],{'$or':_[_0x1293('0x2a')](_0x241cac,function(_0x15ff16){if(_0x15ff16[_0x1293('0x2e')]!==_0x1293('0x40')){var _0x11d2ae={};_0x11d2ae[_0x15ff16['name']]={'$like':'%'+_0xd26f9f[_0x1293('0x30')][_0x1293('0x3e')]+'%'};return _0x11d2ae;}})});}_0x3ad47b=_[_0x1293('0x3f')]({},_0x3ad47b,_0xd26f9f['options']);var _0x2f083d={'where':_0x3ad47b[_0x1293('0x3c')]};return db['Campaign'][_0x1293('0x1c')](_0x2f083d)['then'](function(_0x29599b){_0x373fe1[_0x1293('0x1c')]=_0x29599b;if(_0xd26f9f[_0x1293('0x30')][_0x1293('0x41')]){_0x3ad47b[_0x1293('0x42')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x3ad47b);})[_0x1293('0x21')](function(_0x361899){_0x373fe1[_0x1293('0x43')]=_0x361899;return _0x373fe1;})[_0x1293('0x21')](respondWithFilteredResult(_0x1c00b5,_0x3ad47b))[_0x1293('0x44')](handleError(_0x1c00b5,null));};exports[_0x1293('0x45')]=function(_0xbca291,_0x45cc23){var _0x396796={'raw':![],'where':{'id':_0xbca291[_0x1293('0x46')]['id']}},_0x2a19d5={};_0x2a19d5[_0x1293('0x34')]=_[_0x1293('0x31')](db[_0x1293('0x2b')][_0x1293('0x2c')]);_0x2a19d5[_0x1293('0x30')]=_['keys'](_0xbca291['query']);_0x2a19d5[_0x1293('0x32')]=_[_0x1293('0x33')](_0x2a19d5['model'],_0x2a19d5[_0x1293('0x30')]);_0x396796[_0x1293('0x36')]=_[_0x1293('0x33')](_0x2a19d5[_0x1293('0x34')],qs[_0x1293('0x35')](_0xbca291[_0x1293('0x30')][_0x1293('0x35')]));_0x396796[_0x1293('0x36')]=_0x396796['attributes'][_0x1293('0x37')]?_0x396796[_0x1293('0x36')]:_0x2a19d5[_0x1293('0x34')];if(_0xbca291['query'][_0x1293('0x41')]){_0x396796[_0x1293('0x42')]=[{'all':!![]}];}_0x396796=_[_0x1293('0x3f')]({},_0x396796,_0xbca291[_0x1293('0x47')]);return db['Campaign']['find'](_0x396796)[_0x1293('0x21')](handleEntityNotFound(_0x45cc23,null))['then'](respondWithResult(_0x45cc23,null))[_0x1293('0x44')](handleError(_0x45cc23,null));};exports[_0x1293('0x48')]=function(_0x519431,_0x56f77d){return db[_0x1293('0x2b')]['create'](_0x519431['body'],{})[_0x1293('0x21')](function(_0x1308c8){var _0x4a7603=_0x519431[_0x1293('0x49')][_0x1293('0x23')]({'plain':!![]});if(!_0x4a7603)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a7603['role']===_0x1293('0x49')){var _0x58da96=_0x1308c8['get']({'plain':!![]});var _0x47238b=_0x1293('0x24');return db[_0x1293('0x4a')][_0x1293('0x4b')]({'where':{'name':_0x47238b,'userProfileId':_0x4a7603[_0x1293('0x4c')]},'raw':!![]})['then'](function(_0x2c9c75){if(_0x2c9c75&&_0x2c9c75[_0x1293('0x4d')]===0x0){return db[_0x1293('0x4e')]['create']({'name':_0x58da96['name'],'resourceId':_0x58da96['id'],'type':_0x2c9c75[_0x1293('0x27')],'sectionId':_0x2c9c75['id']},{})[_0x1293('0x21')](function(){return _0x1308c8;});}else{return _0x1308c8;}})['catch'](function(_0x4efb5b){logger[_0x1293('0x25')](_0x1293('0x4f'),_0x4efb5b);throw _0x4efb5b;});}return _0x1308c8;})[_0x1293('0x21')](respondWithResult(_0x56f77d,0xc9))[_0x1293('0x44')](handleError(_0x56f77d,null));};exports[_0x1293('0x50')]=function(_0x3be4a4,_0x1e7f65){var _0x2b735b={'where':{'id':_0x3be4a4[_0x1293('0x46')]['id']}},_0x1d7127={};_0x1d7127['model']=_[_0x1293('0x31')](db[_0x1293('0x2b')][_0x1293('0x2c')]);_0x2b735b['attributes']=_[_0x1293('0x33')](_0x1d7127[_0x1293('0x34')],qs['fields'](_0x3be4a4[_0x1293('0x30')][_0x1293('0x35')]));_0x2b735b['attributes']=_0x2b735b[_0x1293('0x36')][_0x1293('0x37')]?_0x2b735b[_0x1293('0x36')]:_0x1d7127[_0x1293('0x34')];if(_0x3be4a4['query'][_0x1293('0x41')]){_0x2b735b[_0x1293('0x42')]=[{'all':!![]}];}_0x2b735b=_[_0x1293('0x3f')]({},_0x2b735b,_0x3be4a4[_0x1293('0x47')]);return db[_0x1293('0x2b')][_0x1293('0x4b')](_0x2b735b)['then'](handleEntityNotFound(_0x1e7f65,null))[_0x1293('0x21')](function(_0x39ac40){if(_0x39ac40){var _0x35f5c3=_0x39ac40[_0x1293('0x23')]({'plain':!![]});_0x35f5c3=qs['omit'](_0x35f5c3,['id','createdAt',_0x1293('0x51')]);_0x3be4a4[_0x1293('0x52')]=_[_0x1293('0x53')](_0x3be4a4[_0x1293('0x52')],['id',_0x1293('0x54'),_0x1293('0x51')]);return db['Campaign'][_0x1293('0x48')](_[_0x1293('0x3f')](_0x35f5c3,_0x3be4a4[_0x1293('0x52')]),{'include':_0x3be4a4[_0x1293('0x30')]['includeAll']?[{'all':!![]}]:undefined})[_0x1293('0x21')](function(_0x3f5e64){var _0x3f9ca3=_0x3be4a4[_0x1293('0x49')][_0x1293('0x23')]({'plain':!![]});if(!_0x3f9ca3)throw new Error(_0x1293('0x55'));if(_0x3f9ca3[_0x1293('0x56')]===_0x1293('0x49')){var _0x4c7ad0=_0x3f5e64['get']({'plain':!![]});var _0x509493=_0x1293('0x24');return db[_0x1293('0x4a')][_0x1293('0x4b')]({'where':{'name':_0x509493,'userProfileId':_0x3f9ca3[_0x1293('0x4c')]},'raw':!![]})[_0x1293('0x21')](function(_0x4291e8){if(_0x4291e8&&_0x4291e8[_0x1293('0x4d')]===0x0){return db[_0x1293('0x4e')][_0x1293('0x48')]({'name':_0x4c7ad0[_0x1293('0x27')],'resourceId':_0x4c7ad0['id'],'type':_0x4291e8[_0x1293('0x27')],'sectionId':_0x4291e8['id']},{})[_0x1293('0x21')](function(){return _0x3f5e64;});}else{return _0x3f5e64;}})[_0x1293('0x44')](function(_0x2d31b4){logger[_0x1293('0x25')](_0x1293('0x4f'),_0x2d31b4);throw _0x2d31b4;});}return _0x3f5e64;});}})['then'](respondWithResult(_0x1e7f65,0xc9))[_0x1293('0x44')](handleError(_0x1e7f65,null));};exports[_0x1293('0x20')]=function(_0x89d448,_0x502db3){if(_0x89d448['body']['id']){delete _0x89d448[_0x1293('0x52')]['id'];}return db[_0x1293('0x2b')]['find']({'where':{'id':_0x89d448['params']['id']}})[_0x1293('0x21')](handleEntityNotFound(_0x502db3,null))[_0x1293('0x21')](saveUpdates(_0x89d448['body'],null))[_0x1293('0x21')](respondWithResult(_0x502db3,null))['catch'](handleError(_0x502db3,null));};exports[_0x1293('0x22')]=function(_0x493bc3,_0x4cec47){return db[_0x1293('0x2b')][_0x1293('0x4b')]({'where':{'id':_0x493bc3[_0x1293('0x46')]['id']}})[_0x1293('0x21')](handleEntityNotFound(_0x4cec47,null))['then'](removeEntity(_0x4cec47,null))[_0x1293('0x44')](handleError(_0x4cec47,null));};exports['getHoppers']=function(_0x4a20bb,_0x28fa7c,_0x4a43e8){var _0x12e65c={'raw':!![],'where':{}};var _0x22f2ed={};var _0x58d866={'count':0x0,'rows':[]};return db[_0x1293('0x2b')][_0x1293('0x57')]({'where':{'id':_0x4a20bb[_0x1293('0x46')]['id']}})['then'](handleEntityNotFound(_0x28fa7c,null))[_0x1293('0x21')](function(_0xbf46a1){if(_0xbf46a1){_0x22f2ed['model']=_[_0x1293('0x31')](db['CmHopper'][_0x1293('0x2c')]);_0x22f2ed['query']=_[_0x1293('0x31')](_0x4a20bb[_0x1293('0x30')]);_0x22f2ed['filters']=_[_0x1293('0x33')](_0x22f2ed[_0x1293('0x34')],_0x22f2ed[_0x1293('0x30')]);_0x12e65c[_0x1293('0x36')]=_[_0x1293('0x33')](_0x22f2ed[_0x1293('0x34')],qs['fields'](_0x4a20bb[_0x1293('0x30')]['fields']));_0x12e65c[_0x1293('0x36')]=_0x12e65c[_0x1293('0x36')][_0x1293('0x37')]?_0x12e65c[_0x1293('0x36')]:_0x22f2ed[_0x1293('0x34')];if(!_0x4a20bb[_0x1293('0x30')][_0x1293('0x38')](_0x1293('0x39'))){_0x12e65c[_0x1293('0x1b')]=qs[_0x1293('0x1b')](_0x4a20bb['query']['limit']);_0x12e65c[_0x1293('0x19')]=qs[_0x1293('0x19')](_0x4a20bb[_0x1293('0x30')][_0x1293('0x19')]);}_0x12e65c[_0x1293('0x3a')]=qs['sort'](_0x4a20bb[_0x1293('0x30')][_0x1293('0x3b')]);_0x12e65c['where']=qs['filters'](_['pick'](_0x4a20bb['query'],_0x22f2ed[_0x1293('0x32')]));_0x12e65c[_0x1293('0x3c')][_0x1293('0x58')]=_0xbf46a1['id'];if(_0x4a20bb['query']['filter']){_0x12e65c[_0x1293('0x3c')]=_[_0x1293('0x3f')](_0x12e65c[_0x1293('0x3c')],{'$or':_['map'](_0x12e65c[_0x1293('0x36')],function(_0x279522){var _0x57e823={};_0x57e823[_0x279522]={'$like':'%'+_0x4a20bb['query'][_0x1293('0x3e')]+'%'};return _0x57e823;})});}_0x12e65c=_[_0x1293('0x3f')]({},_0x12e65c,_0x4a20bb[_0x1293('0x47')]);return db[_0x1293('0x59')][_0x1293('0x1c')]({'where':_0x12e65c['where']})[_0x1293('0x21')](function(_0x48f9ee){_0x58d866[_0x1293('0x1c')]=_0x48f9ee;if(_0x4a20bb[_0x1293('0x30')][_0x1293('0x41')]){_0x12e65c[_0x1293('0x42')]=[{'all':!![]}];}return db[_0x1293('0x59')][_0x1293('0x5a')](_0x12e65c);})[_0x1293('0x21')](function(_0x2ca591){_0x58d866[_0x1293('0x43')]=_0x2ca591;return _0x58d866;});}})[_0x1293('0x21')](respondWithFilteredResult(_0x28fa7c,_0x12e65c))[_0x1293('0x44')](handleError(_0x28fa7c,null));};exports['getHopperHistories']=function(_0x41e06e,_0xc5cf4e,_0x145cb2){var _0x4ca1d3={'raw':!![],'where':{}};var _0x206e79={};var _0x549f7e={'count':0x0,'rows':[]};return db[_0x1293('0x2b')][_0x1293('0x57')]({'where':{'id':_0x41e06e[_0x1293('0x46')]['id']}})[_0x1293('0x21')](handleEntityNotFound(_0xc5cf4e,null))[_0x1293('0x21')](function(_0x4bd925){if(_0x4bd925){_0x206e79[_0x1293('0x34')]=_[_0x1293('0x31')](db[_0x1293('0x5b')][_0x1293('0x2c')]);_0x206e79[_0x1293('0x30')]=_[_0x1293('0x31')](_0x41e06e[_0x1293('0x30')]);_0x206e79['filters']=_[_0x1293('0x33')](_0x206e79[_0x1293('0x34')],_0x206e79[_0x1293('0x30')]);_0x4ca1d3[_0x1293('0x36')]=_[_0x1293('0x33')](_0x206e79['model'],qs['fields'](_0x41e06e[_0x1293('0x30')][_0x1293('0x35')]));_0x4ca1d3[_0x1293('0x36')]=_0x4ca1d3['attributes'][_0x1293('0x37')]?_0x4ca1d3[_0x1293('0x36')]:_0x206e79['model'];if(!_0x41e06e[_0x1293('0x30')][_0x1293('0x38')](_0x1293('0x39'))){_0x4ca1d3[_0x1293('0x1b')]=qs[_0x1293('0x1b')](_0x41e06e[_0x1293('0x30')]['limit']);_0x4ca1d3[_0x1293('0x19')]=qs[_0x1293('0x19')](_0x41e06e[_0x1293('0x30')][_0x1293('0x19')]);}_0x4ca1d3[_0x1293('0x3a')]=qs['sort'](_0x41e06e['query']['sort']);_0x4ca1d3[_0x1293('0x3c')]=qs[_0x1293('0x32')](_['pick'](_0x41e06e['query'],_0x206e79[_0x1293('0x32')]));_0x4ca1d3[_0x1293('0x3c')][_0x1293('0x58')]=_0x4bd925['id'];if(_0x41e06e[_0x1293('0x30')]['filter']){_0x4ca1d3[_0x1293('0x3c')]=_['merge'](_0x4ca1d3['where'],{'$or':_[_0x1293('0x2a')](_0x4ca1d3[_0x1293('0x36')],function(_0x386b04){var _0x255349={};_0x255349[_0x386b04]={'$like':'%'+_0x41e06e[_0x1293('0x30')]['filter']+'%'};return _0x255349;})});}_0x4ca1d3=_['merge']({},_0x4ca1d3,_0x41e06e['options']);return db['CmHopperHistory']['count']({'where':_0x4ca1d3[_0x1293('0x3c')]})[_0x1293('0x21')](function(_0x4740f0){_0x549f7e['count']=_0x4740f0;if(_0x41e06e[_0x1293('0x30')][_0x1293('0x41')]){_0x4ca1d3[_0x1293('0x42')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x1293('0x5a')](_0x4ca1d3);})[_0x1293('0x21')](function(_0x2f7cab){_0x549f7e['rows']=_0x2f7cab;return _0x549f7e;});}})[_0x1293('0x21')](respondWithFilteredResult(_0xc5cf4e,_0x4ca1d3))['catch'](handleError(_0xc5cf4e,null));};exports[_0x1293('0x5c')]=function(_0x3d2d90,_0x2af9dc,_0x1f226d){var _0x207f31={'raw':!![],'where':{}};var _0x474154={};var _0x21f645={'count':0x0,'rows':[]};return db[_0x1293('0x2b')][_0x1293('0x57')]({'where':{'id':_0x3d2d90[_0x1293('0x46')]['id']}})['then'](handleEntityNotFound(_0x2af9dc,null))['then'](function(_0x262e65){if(_0x262e65){_0x474154[_0x1293('0x34')]=_[_0x1293('0x31')](db[_0x1293('0x5d')][_0x1293('0x2c')]);_0x474154['query']=_[_0x1293('0x31')](_0x3d2d90[_0x1293('0x30')]);_0x474154[_0x1293('0x32')]=_[_0x1293('0x33')](_0x474154[_0x1293('0x34')],_0x474154[_0x1293('0x30')]);_0x207f31[_0x1293('0x36')]=_[_0x1293('0x33')](_0x474154[_0x1293('0x34')],qs['fields'](_0x3d2d90['query'][_0x1293('0x35')]));_0x207f31['attributes']=_0x207f31[_0x1293('0x36')][_0x1293('0x37')]?_0x207f31[_0x1293('0x36')]:_0x474154['model'];if(!_0x3d2d90[_0x1293('0x30')][_0x1293('0x38')](_0x1293('0x39'))){_0x207f31[_0x1293('0x1b')]=qs[_0x1293('0x1b')](_0x3d2d90['query'][_0x1293('0x1b')]);_0x207f31[_0x1293('0x19')]=qs[_0x1293('0x19')](_0x3d2d90[_0x1293('0x30')]['offset']);}_0x207f31[_0x1293('0x3a')]=qs[_0x1293('0x3b')](_0x3d2d90[_0x1293('0x30')][_0x1293('0x3b')]);_0x207f31['where']=qs[_0x1293('0x32')](_[_0x1293('0x3d')](_0x3d2d90['query'],_0x474154[_0x1293('0x32')]));_0x207f31[_0x1293('0x3c')][_0x1293('0x58')]=_0x262e65['id'];if(_0x3d2d90[_0x1293('0x30')][_0x1293('0x3e')]){_0x207f31[_0x1293('0x3c')]=_['merge'](_0x207f31[_0x1293('0x3c')],{'$or':_[_0x1293('0x2a')](_0x207f31[_0x1293('0x36')],function(_0x28058a){var _0x10ed18={};_0x10ed18[_0x28058a]={'$like':'%'+_0x3d2d90[_0x1293('0x30')][_0x1293('0x3e')]+'%'};return _0x10ed18;})});}_0x207f31=_[_0x1293('0x3f')]({},_0x207f31,_0x3d2d90['options']);return db['CmHopperFinal'][_0x1293('0x1c')]({'where':_0x207f31[_0x1293('0x3c')]})[_0x1293('0x21')](function(_0x3cadb9){_0x21f645[_0x1293('0x1c')]=_0x3cadb9;if(_0x3d2d90[_0x1293('0x30')][_0x1293('0x41')]){_0x207f31[_0x1293('0x42')]=[{'all':!![]}];}return db[_0x1293('0x5d')][_0x1293('0x5a')](_0x207f31);})[_0x1293('0x21')](function(_0x3a33b4){_0x21f645[_0x1293('0x43')]=_0x3a33b4;return _0x21f645;});}})[_0x1293('0x21')](respondWithFilteredResult(_0x2af9dc,_0x207f31))['catch'](handleError(_0x2af9dc,null));};exports['getHopperBlacks']=function(_0x155ddd,_0x281b46,_0x6e4468){var _0xd10ec1={'raw':!![],'where':{}};var _0x43145a={};var _0x44f3ae={'count':0x0,'rows':[]};return db['Campaign'][_0x1293('0x57')]({'where':{'id':_0x155ddd['params']['id']}})[_0x1293('0x21')](handleEntityNotFound(_0x281b46,null))[_0x1293('0x21')](function(_0x153197){if(_0x153197){_0x43145a[_0x1293('0x34')]=_['keys'](db[_0x1293('0x5e')][_0x1293('0x2c')]);_0x43145a[_0x1293('0x30')]=_[_0x1293('0x31')](_0x155ddd[_0x1293('0x30')]);_0x43145a[_0x1293('0x32')]=_[_0x1293('0x33')](_0x43145a[_0x1293('0x34')],_0x43145a[_0x1293('0x30')]);_0xd10ec1['attributes']=_['intersection'](_0x43145a[_0x1293('0x34')],qs[_0x1293('0x35')](_0x155ddd[_0x1293('0x30')][_0x1293('0x35')]));_0xd10ec1[_0x1293('0x36')]=_0xd10ec1[_0x1293('0x36')]['length']?_0xd10ec1[_0x1293('0x36')]:_0x43145a[_0x1293('0x34')];if(!_0x155ddd[_0x1293('0x30')][_0x1293('0x38')](_0x1293('0x39'))){_0xd10ec1[_0x1293('0x1b')]=qs[_0x1293('0x1b')](_0x155ddd[_0x1293('0x30')]['limit']);_0xd10ec1[_0x1293('0x19')]=qs[_0x1293('0x19')](_0x155ddd[_0x1293('0x30')][_0x1293('0x19')]);}_0xd10ec1['order']=qs[_0x1293('0x3b')](_0x155ddd[_0x1293('0x30')][_0x1293('0x3b')]);_0xd10ec1[_0x1293('0x3c')]=qs[_0x1293('0x32')](_[_0x1293('0x3d')](_0x155ddd['query'],_0x43145a[_0x1293('0x32')]));_0xd10ec1[_0x1293('0x3c')][_0x1293('0x58')]=_0x153197['id'];if(_0x155ddd[_0x1293('0x30')][_0x1293('0x3e')]){_0xd10ec1[_0x1293('0x3c')]=_[_0x1293('0x3f')](_0xd10ec1['where'],{'$or':_[_0x1293('0x2a')](_0xd10ec1[_0x1293('0x36')],function(_0x943661){var _0x1d392e={};_0x1d392e[_0x943661]={'$like':'%'+_0x155ddd[_0x1293('0x30')]['filter']+'%'};return _0x1d392e;})});}_0xd10ec1=_['merge']({},_0xd10ec1,_0x155ddd[_0x1293('0x47')]);return db[_0x1293('0x5e')][_0x1293('0x1c')]({'where':_0xd10ec1[_0x1293('0x3c')]})['then'](function(_0x59896c){_0x44f3ae[_0x1293('0x1c')]=_0x59896c;if(_0x155ddd[_0x1293('0x30')][_0x1293('0x41')]){_0xd10ec1[_0x1293('0x42')]=[{'all':!![]}];}return db[_0x1293('0x5e')][_0x1293('0x5a')](_0xd10ec1);})[_0x1293('0x21')](function(_0x3d7399){_0x44f3ae['rows']=_0x3d7399;return _0x44f3ae;});}})[_0x1293('0x21')](respondWithFilteredResult(_0x281b46,_0xd10ec1))[_0x1293('0x44')](handleError(_0x281b46,null));};exports[_0x1293('0x5f')]=function(_0x15d1e1,_0x322cee,_0x44126a){var _0xe6eaae={};var _0x1f9011={};var _0x564718;var _0x3c7a42;return db[_0x1293('0x2b')][_0x1293('0x57')]({'where':{'id':_0x15d1e1[_0x1293('0x46')]['id']}})[_0x1293('0x21')](handleEntityNotFound(_0x322cee,null))[_0x1293('0x21')](function(_0x245abe){if(_0x245abe){_0x564718=_0x245abe;_0x1f9011[_0x1293('0x34')]=_[_0x1293('0x31')](db[_0x1293('0x60')][_0x1293('0x2c')]);_0x1f9011[_0x1293('0x30')]=_[_0x1293('0x31')](_0x15d1e1[_0x1293('0x30')]);_0x1f9011['filters']=_['intersection'](_0x1f9011[_0x1293('0x34')],_0x1f9011[_0x1293('0x30')]);_0xe6eaae[_0x1293('0x36')]=_[_0x1293('0x33')](_0x1f9011[_0x1293('0x34')],qs[_0x1293('0x35')](_0x15d1e1[_0x1293('0x30')]['fields']));_0xe6eaae['attributes']=_0xe6eaae['attributes'][_0x1293('0x37')]?_0xe6eaae[_0x1293('0x36')]:_0x1f9011[_0x1293('0x34')];_0xe6eaae['order']=qs['sort'](_0x15d1e1[_0x1293('0x30')]['sort']);_0xe6eaae[_0x1293('0x3c')]=qs[_0x1293('0x32')](_[_0x1293('0x3d')](_0x15d1e1['query'],_0x1f9011[_0x1293('0x32')]));if(_0x15d1e1['query'][_0x1293('0x3e')]){_0xe6eaae[_0x1293('0x3c')]=_['merge'](_0xe6eaae[_0x1293('0x3c')],{'$or':_['map'](_0xe6eaae['attributes'],function(_0x8ec662){var _0x4b9d5d={};_0x4b9d5d[_0x8ec662]={'$like':'%'+_0x15d1e1[_0x1293('0x30')][_0x1293('0x3e')]+'%'};return _0x4b9d5d;})});}_0xe6eaae=_['merge']({},_0xe6eaae,_0x15d1e1['options']);return _0x564718[_0x1293('0x5f')](_0xe6eaae);}})[_0x1293('0x21')](function(_0x33da48){if(_0x33da48){_0x3c7a42=_0x33da48[_0x1293('0x37')];if(!_0x15d1e1[_0x1293('0x30')]['hasOwnProperty']('nolimit')){_0xe6eaae['limit']=qs['limit'](_0x15d1e1[_0x1293('0x30')]['limit']);_0xe6eaae[_0x1293('0x19')]=qs['offset'](_0x15d1e1[_0x1293('0x30')][_0x1293('0x19')]);}return _0x564718[_0x1293('0x5f')](_0xe6eaae);}})[_0x1293('0x21')](function(_0x2029b4){if(_0x2029b4){return _0x2029b4?{'count':_0x3c7a42,'rows':_0x2029b4}:null;}})[_0x1293('0x21')](respondWithResult(_0x322cee,null))[_0x1293('0x44')](handleError(_0x322cee,null));};exports[_0x1293('0x61')]=function(_0xc646fe,_0x1daa41,_0x2d985d){var _0x256585,_0x9798ed;return db[_0x1293('0x2b')][_0x1293('0x4b')]({'where':{'id':_0xc646fe['params']['id']}})[_0x1293('0x21')](handleEntityNotFound(_0x1daa41,null))[_0x1293('0x21')](function(_0x3120db){if(_0x3120db){_0x9798ed=_0x3120db;return _0x3120db[_0x1293('0x61')](_0xc646fe[_0x1293('0x52')][_0x1293('0x62')],_[_0x1293('0x53')](_0xc646fe[_0x1293('0x52')],[_0x1293('0x62'),'id'])||{});}return null;})[_0x1293('0x63')](function(_0x24c948){var _0x16e60a;_0x256585=_0x24c948||[];var _0x1e0976=[];if(_0x24c948){for(var _0x154e25=0x0;_0x154e25<_0x24c948[_0x1293('0x37')];_0x154e25+=0x1){var _0x45ec03=_0x24c948[_0x154e25][_0x1293('0x23')]({'plain':!![]});_0x9798ed['dialCheckDuplicateType']=_0xc646fe[_0x1293('0x52')][_0x1293('0x64')]?_0xc646fe['body']['dialCheckDuplicateType']:_0x9798ed[_0x1293('0x64')];switch(_0x9798ed[_0x1293('0x64')]){case _0x1293('0x65'):_0x16e60a=squel[_0x1293('0x66')]()[_0x1293('0x67')](_0x1293('0x68'))[_0x1293('0x69')]([_0x1293('0x6a'),_0x1293('0x6b'),_0x1293('0x6c'),_0x1293('0x6d'),'CampaignId','createdAt','updatedAt'],squel[_0x1293('0x6e')]()[_0x1293('0x6f')](_0x1293('0x6a'),_0x1293('0x6a'))[_0x1293('0x6f')](_0x1293('0x70'),_0x1293('0x6b'))[_0x1293('0x6f')]('id',_0x1293('0x6c'))[_0x1293('0x6f')](_0x45ec03['CmListId'][_0x1293('0x71')](),_0x1293('0x6d'))['field'](_0xc646fe[_0x1293('0x46')]['id'][_0x1293('0x71')](),_0x1293('0x58'))[_0x1293('0x6f')](_0x1293('0x70'),_0x1293('0x54'))['field'](_0x1293('0x70'),_0x1293('0x51'))['from'](_0x1293('0x72'))[_0x1293('0x3c')](_0x1293('0x73'))[_0x1293('0x3c')](_0x1293('0x74'),_0x45ec03['CmListId'][_0x1293('0x71')]())[_0x1293('0x3c')](_0x1293('0x75'))[_0x1293('0x3c')](_0x1293('0x76'),squel[_0x1293('0x6e')]()['field'](_0x1293('0x77'))[_0x1293('0x78')](_0x1293('0x79'))[_0x1293('0x3c')]('CampaignId\x20=\x20?',_0xc646fe['params']['id'][_0x1293('0x71')]()))[_0x1293('0x3c')](_0x1293('0x76'),squel[_0x1293('0x6e')]()[_0x1293('0x6f')](_0x1293('0x7a'))[_0x1293('0x78')](_0x1293('0x68'))[_0x1293('0x3c')]('CampaignId\x20=\x20?',_0xc646fe[_0x1293('0x46')]['id']['toString']())))[_0x1293('0x71')]();break;case _0x1293('0x7b'):_0x16e60a=squel[_0x1293('0x66')]()[_0x1293('0x67')](_0x1293('0x68'))['fromQuery']([_0x1293('0x6a'),_0x1293('0x6b'),'ContactId',_0x1293('0x6d'),_0x1293('0x58'),_0x1293('0x54'),_0x1293('0x51')],squel[_0x1293('0x6e')]()[_0x1293('0x6f')](_0x1293('0x6a'),_0x1293('0x6a'))['field'](_0x1293('0x70'),_0x1293('0x6b'))[_0x1293('0x6f')]('id',_0x1293('0x6c'))['field'](_0x45ec03[_0x1293('0x7c')][_0x1293('0x71')](),_0x1293('0x6d'))[_0x1293('0x6f')](_0xc646fe[_0x1293('0x46')]['id'][_0x1293('0x71')](),_0x1293('0x58'))[_0x1293('0x6f')](_0x1293('0x70'),_0x1293('0x54'))[_0x1293('0x6f')]('NOW()',_0x1293('0x51'))[_0x1293('0x78')]('cm_contacts')[_0x1293('0x3c')]('deletedAt\x20IS\x20NULL')[_0x1293('0x3c')]('ListId\x20=\x20?',_0x45ec03['CmListId'][_0x1293('0x71')]())[_0x1293('0x3c')](_0x1293('0x75'))['where'](_0x1293('0x76'),squel['select']()['field'](_0x1293('0x7a'))[_0x1293('0x78')](_0x1293('0x68'))[_0x1293('0x3c')](_0x1293('0x7d'),_0xc646fe['params']['id'][_0x1293('0x71')]())))[_0x1293('0x71')]();break;default:_0x16e60a=squel[_0x1293('0x66')]()[_0x1293('0x67')](_0x1293('0x68'))[_0x1293('0x69')]([_0x1293('0x6a'),'scheduledAt','ContactId',_0x1293('0x6d'),_0x1293('0x58'),'createdAt','updatedAt'],squel[_0x1293('0x6e')]()['field'](_0x1293('0x6a'),_0x1293('0x6a'))['field'](_0x1293('0x70'),_0x1293('0x6b'))['field']('id',_0x1293('0x6c'))['field'](_0x45ec03['CmListId'][_0x1293('0x71')](),_0x1293('0x6d'))['field'](_0xc646fe[_0x1293('0x46')]['id']['toString'](),_0x1293('0x58'))['field']('NOW()',_0x1293('0x54'))['field'](_0x1293('0x70'),_0x1293('0x51'))['from'](_0x1293('0x72'))['where'](_0x1293('0x73'))[_0x1293('0x3c')]('ListId\x20=\x20?',_0x45ec03[_0x1293('0x7c')][_0x1293('0x71')]())['where'](_0x1293('0x75')))['toString']();}_0x1e0976[_0x1293('0x7e')](db[_0x1293('0x7f')][_0x1293('0x30')](_0x16e60a));}return BPromise[_0x1293('0x80')](_0x1e0976);}})['then'](function(){return _0x256585;})[_0x1293('0x21')](respondWithResult(_0x1daa41,null))['catch'](handleError(_0x1daa41,null));};exports[_0x1293('0x81')]=function(_0x39b7a2,_0x3566ba,_0x2eea04){return db[_0x1293('0x2b')][_0x1293('0x4b')]({'where':{'id':_0x39b7a2[_0x1293('0x46')]['id']}})[_0x1293('0x21')](handleEntityNotFound(_0x3566ba,null))[_0x1293('0x21')](function(_0x5818a4){if(_0x5818a4){return _0x5818a4[_0x1293('0x81')](_0x39b7a2['query'][_0x1293('0x62')]);}})[_0x1293('0x21')](function(_0x45bc56){if(_0x45bc56){return db[_0x1293('0x59')][_0x1293('0x22')]({'where':{'ListId':_0x39b7a2[_0x1293('0x30')][_0x1293('0x62')],'CampaignId':_0x39b7a2['params']['id']}})[_0x1293('0x21')](function(){return _0x45bc56;});}})[_0x1293('0x21')](respondWithStatusCode(_0x3566ba,null))[_0x1293('0x44')](handleError(_0x3566ba,null));};exports['getBlackLists']=function(_0x323117,_0x273b29,_0x71982c){var _0xf7fd43={};var _0x4471bd={};var _0x2ddd07;var _0x56c568;return db[_0x1293('0x2b')][_0x1293('0x57')]({'where':{'id':_0x323117[_0x1293('0x46')]['id']}})[_0x1293('0x21')](handleEntityNotFound(_0x273b29,null))['then'](function(_0x4f5366){if(_0x4f5366){_0x2ddd07=_0x4f5366;_0x4471bd[_0x1293('0x34')]=_[_0x1293('0x31')](db[_0x1293('0x60')]['rawAttributes']);_0x4471bd[_0x1293('0x30')]=_[_0x1293('0x31')](_0x323117[_0x1293('0x30')]);_0x4471bd[_0x1293('0x32')]=_[_0x1293('0x33')](_0x4471bd['model'],_0x4471bd[_0x1293('0x30')]);_0xf7fd43[_0x1293('0x36')]=_[_0x1293('0x33')](_0x4471bd[_0x1293('0x34')],qs[_0x1293('0x35')](_0x323117[_0x1293('0x30')][_0x1293('0x35')]));_0xf7fd43[_0x1293('0x36')]=_0xf7fd43[_0x1293('0x36')][_0x1293('0x37')]?_0xf7fd43[_0x1293('0x36')]:_0x4471bd['model'];_0xf7fd43[_0x1293('0x3a')]=qs['sort'](_0x323117[_0x1293('0x30')][_0x1293('0x3b')]);_0xf7fd43['where']=qs['filters'](_['pick'](_0x323117['query'],_0x4471bd[_0x1293('0x32')]));if(_0x323117['query']['filter']){_0xf7fd43[_0x1293('0x3c')]=_[_0x1293('0x3f')](_0xf7fd43[_0x1293('0x3c')],{'$or':_['map'](_0xf7fd43[_0x1293('0x36')],function(_0x2663b7){var _0x27db89={};_0x27db89[_0x2663b7]={'$like':'%'+_0x323117[_0x1293('0x30')]['filter']+'%'};return _0x27db89;})});}_0xf7fd43=_[_0x1293('0x3f')]({},_0xf7fd43,_0x323117[_0x1293('0x47')]);return _0x2ddd07[_0x1293('0x82')](_0xf7fd43);}})['then'](function(_0x4daf4b){if(_0x4daf4b){_0x56c568=_0x4daf4b[_0x1293('0x37')];if(!_0x323117['query'][_0x1293('0x38')](_0x1293('0x39'))){_0xf7fd43['limit']=qs[_0x1293('0x1b')](_0x323117[_0x1293('0x30')][_0x1293('0x1b')]);_0xf7fd43[_0x1293('0x19')]=qs[_0x1293('0x19')](_0x323117['query'][_0x1293('0x19')]);}return _0x2ddd07[_0x1293('0x82')](_0xf7fd43);}})['then'](function(_0x2d07b1){if(_0x2d07b1){return _0x2d07b1?{'count':_0x56c568,'rows':_0x2d07b1}:null;}})[_0x1293('0x21')](respondWithResult(_0x273b29,null))[_0x1293('0x44')](handleError(_0x273b29,null));};exports[_0x1293('0x83')]=function(_0x5100fc,_0x355fc0,_0x4c1229){var _0x5acb96,_0x1ba48b;return db['Campaign'][_0x1293('0x4b')]({'where':{'id':_0x5100fc[_0x1293('0x46')]['id']}})[_0x1293('0x21')](handleEntityNotFound(_0x355fc0,null))[_0x1293('0x21')](function(_0x567f53){if(_0x567f53){_0x1ba48b=_0x567f53;return _0x567f53['addBlackLists'](_0x5100fc['body'][_0x1293('0x62')],_['omit'](_0x5100fc[_0x1293('0x52')],[_0x1293('0x62'),'id'])||{});}return null;})[_0x1293('0x63')](function(_0x5cbebe){var _0x3d74ae;_0x5acb96=_0x5cbebe||[];var _0x4ea93c=[];if(_0x5cbebe){for(var _0x85b869=0x0;_0x85b869<_0x5cbebe['length'];_0x85b869+=0x1){var _0x4e7188=_0x5cbebe[_0x85b869][_0x1293('0x23')]({'plain':!![]});_0x3d74ae=squel[_0x1293('0x66')]()[_0x1293('0x67')]('cm_hopper_black')[_0x1293('0x69')]([_0x1293('0x6a'),_0x1293('0x6c'),'ListId',_0x1293('0x58'),_0x1293('0x54'),_0x1293('0x51')],squel[_0x1293('0x6e')]()[_0x1293('0x6f')](_0x1293('0x6a'),_0x1293('0x6a'))[_0x1293('0x6f')]('id','ContactId')[_0x1293('0x6f')](_0x4e7188[_0x1293('0x7c')][_0x1293('0x71')](),_0x1293('0x6d'))[_0x1293('0x6f')](_0x5100fc[_0x1293('0x46')]['id']['toString'](),_0x1293('0x58'))[_0x1293('0x6f')]('NOW()',_0x1293('0x54'))[_0x1293('0x6f')]('NOW()',_0x1293('0x51'))[_0x1293('0x78')](_0x1293('0x72'))[_0x1293('0x3c')](_0x1293('0x73'))[_0x1293('0x3c')](_0x1293('0x74'),_0x4e7188[_0x1293('0x7c')][_0x1293('0x71')]())[_0x1293('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x1293('0x71')]();_0x4ea93c[_0x1293('0x7e')](db[_0x1293('0x7f')][_0x1293('0x30')](_0x3d74ae));}return BPromise['all'](_0x4ea93c);}})[_0x1293('0x21')](function(){return _0x5acb96;})[_0x1293('0x21')](respondWithResult(_0x355fc0,null))[_0x1293('0x44')](handleError(_0x355fc0,null));};exports[_0x1293('0x84')]=function(_0x431c20,_0x2dbdf6,_0x3e489c){return db[_0x1293('0x2b')][_0x1293('0x4b')]({'where':{'id':_0x431c20[_0x1293('0x46')]['id']}})['then'](handleEntityNotFound(_0x2dbdf6,null))[_0x1293('0x21')](function(_0x16e090){if(_0x16e090){return _0x16e090['removeBlackLists'](_0x431c20[_0x1293('0x30')][_0x1293('0x62')]);}})[_0x1293('0x21')](function(_0x219da6){if(_0x219da6){return db[_0x1293('0x5e')][_0x1293('0x22')]({'where':{'ListId':_0x431c20[_0x1293('0x30')]['ids'],'CampaignId':_0x431c20['params']['id']}})[_0x1293('0x21')](function(){return _0x219da6;});}})[_0x1293('0x21')](respondWithStatusCode(_0x2dbdf6,null))['catch'](handleError(_0x2dbdf6,null));}; \ No newline at end of file +var _0x6971=['getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','IvrCampaigns','UserProfileResource','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Campaign','include','findAll','rows','catch','show','length','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','find','userProfileId','autoAssociation','error','clone','params','omit','createdAt','updatedAt','body','UserProfileSection','getHoppers','CmHopper','nolimit','CampaignId','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','push','sequelize','all','removeLists'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6971,0x8d));var _0x1697=function(_0x488023,_0x22660b){_0x488023=_0x488023-0x0;var _0x1140c7=_0x6971[_0x488023];return _0x1140c7;};'use strict';var emlformat=require(_0x1697('0x0'));var rimraf=require(_0x1697('0x1'));var zipdir=require(_0x1697('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1697('0x3'));var moment=require(_0x1697('0x4'));var BPromise=require(_0x1697('0x5'));var Mustache=require(_0x1697('0x6'));var util=require(_0x1697('0x7'));var path=require(_0x1697('0x8'));var sox=require('sox');var csv=require(_0x1697('0x9'));var ejs=require(_0x1697('0xa'));var fs=require('fs');var fs_extra=require(_0x1697('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1697('0xc'));var deskjs=require(_0x1697('0xd'));var toCsv=require(_0x1697('0x9'));var querystring=require(_0x1697('0xe'));var Papa=require(_0x1697('0xf'));var Redis=require(_0x1697('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1697('0x11'));var as=require(_0x1697('0x12'));var hardwareService=require(_0x1697('0x13'));var logger=require('../../config/logger')(_0x1697('0x14'));var utils=require(_0x1697('0x15'));var config=require(_0x1697('0x16'));var licenseUtil=require(_0x1697('0x17'));var db=require(_0x1697('0x18'))['db'];function respondWithStatusCode(_0x179405,_0x8941b4){_0x8941b4=_0x8941b4||0xcc;return function(_0x58dcf8){if(_0x58dcf8){return _0x179405[_0x1697('0x19')](_0x8941b4);}return _0x179405[_0x1697('0x1a')](_0x8941b4)[_0x1697('0x1b')]();};}function respondWithResult(_0x2356ce,_0xd7830a){_0xd7830a=_0xd7830a||0xc8;return function(_0x15d617){if(_0x15d617){return _0x2356ce['status'](_0xd7830a)['json'](_0x15d617);}};}function respondWithFilteredResult(_0x25e8a7,_0xde21e0){return function(_0xeabfe){if(_0xeabfe){var _0x203818=typeof _0xde21e0[_0x1697('0x1c')]===_0x1697('0x1d')&&typeof _0xde21e0[_0x1697('0x1e')]===_0x1697('0x1d');var _0x1a752b=_0xeabfe[_0x1697('0x1f')];var _0xc085a=_0x203818?0x0:_0xde21e0['offset'];var _0x23ab50=_0x203818?_0xeabfe[_0x1697('0x1f')]:_0xde21e0[_0x1697('0x1c')]+_0xde21e0[_0x1697('0x1e')];var _0x599a5a;if(_0x23ab50>=_0x1a752b){_0x23ab50=_0x1a752b;_0x599a5a=0xc8;}else{_0x599a5a=0xce;}_0x25e8a7[_0x1697('0x1a')](_0x599a5a);return _0x25e8a7[_0x1697('0x20')](_0x1697('0x21'),_0xc085a+'-'+_0x23ab50+'/'+_0x1a752b)[_0x1697('0x22')](_0xeabfe);}return null;};}function patchUpdates(_0x26623f){return function(_0x1e14c3){try{jsonpatch[_0x1697('0x23')](_0x1e14c3,_0x26623f,!![]);}catch(_0x4d1dc0){return BPromise[_0x1697('0x24')](_0x4d1dc0);}return _0x1e14c3[_0x1697('0x25')]();};}function saveUpdates(_0x4217e3,_0x2d4aca){return function(_0x39f011){if(_0x39f011){return _0x39f011[_0x1697('0x26')](_0x4217e3)['then'](function(_0x22d9a8){return _0x22d9a8;});}return null;};}function removeEntity(_0x3aa99e,_0xe58ee5){return function(_0x14e871){if(_0x14e871){return _0x14e871[_0x1697('0x27')]()[_0x1697('0x28')](function(){var _0x174a3f=_0x14e871['get']({'plain':!![]});var _0x4e34b9=_0x1697('0x29');return db[_0x1697('0x2a')][_0x1697('0x27')]({'where':{'type':_0x4e34b9,'resourceId':_0x174a3f['id']}})['then'](function(){return _0x14e871;});})[_0x1697('0x28')](function(){_0x3aa99e['status'](0xcc)[_0x1697('0x1b')]();});}};}function handleEntityNotFound(_0x3c5559,_0x574d09){return function(_0x2ccb38){if(!_0x2ccb38){_0x3c5559['sendStatus'](0x194);}return _0x2ccb38;};}function handleError(_0x3d838f,_0x4ceadf){_0x4ceadf=_0x4ceadf||0x1f4;return function(_0x6936c4){logger['error'](_0x6936c4[_0x1697('0x2b')]);if(_0x6936c4[_0x1697('0x2c')]){delete _0x6936c4[_0x1697('0x2c')];}_0x3d838f[_0x1697('0x1a')](_0x4ceadf)[_0x1697('0x2d')](_0x6936c4);};}exports[_0x1697('0x2e')]=function(_0x3e5b0c,_0x16216d){var _0x4cb843={},_0x5c7741={},_0x4f924f={'count':0x0,'rows':[]};var _0x3d9c6b=_[_0x1697('0x2f')](db['Campaign'][_0x1697('0x30')],function(_0x4b9f4a){return{'name':_0x4b9f4a['fieldName'],'type':_0x4b9f4a[_0x1697('0x31')][_0x1697('0x32')]};});_0x5c7741[_0x1697('0x33')]=_['map'](_0x3d9c6b,_0x1697('0x2c'));_0x5c7741[_0x1697('0x34')]=_[_0x1697('0x35')](_0x3e5b0c['query']);_0x5c7741[_0x1697('0x36')]=_[_0x1697('0x37')](_0x5c7741[_0x1697('0x33')],_0x5c7741[_0x1697('0x34')]);_0x4cb843[_0x1697('0x38')]=_[_0x1697('0x37')](_0x5c7741[_0x1697('0x33')],qs[_0x1697('0x39')](_0x3e5b0c[_0x1697('0x34')]['fields']));_0x4cb843[_0x1697('0x38')]=_0x4cb843[_0x1697('0x38')]['length']?_0x4cb843['attributes']:_0x5c7741[_0x1697('0x33')];if(!_0x3e5b0c[_0x1697('0x34')][_0x1697('0x3a')]('nolimit')){_0x4cb843[_0x1697('0x1e')]=qs[_0x1697('0x1e')](_0x3e5b0c['query'][_0x1697('0x1e')]);_0x4cb843['offset']=qs['offset'](_0x3e5b0c[_0x1697('0x34')][_0x1697('0x1c')]);}_0x4cb843[_0x1697('0x3b')]=qs[_0x1697('0x3c')](_0x3e5b0c['query'][_0x1697('0x3c')]);_0x4cb843[_0x1697('0x3d')]=qs[_0x1697('0x36')](_[_0x1697('0x3e')](_0x3e5b0c['query'],_0x5c7741[_0x1697('0x36')]),_0x3d9c6b);if(_0x3e5b0c['query'][_0x1697('0x3f')]){_0x4cb843['where']=_[_0x1697('0x40')](_0x4cb843['where'],{'$or':_[_0x1697('0x2f')](_0x3d9c6b,function(_0x5ce0d1){if(_0x5ce0d1[_0x1697('0x31')]!==_0x1697('0x41')){var _0x3845aa={};_0x3845aa[_0x5ce0d1[_0x1697('0x2c')]]={'$like':'%'+_0x3e5b0c[_0x1697('0x34')][_0x1697('0x3f')]+'%'};return _0x3845aa;}})});}_0x4cb843=_[_0x1697('0x40')]({},_0x4cb843,_0x3e5b0c[_0x1697('0x42')]);var _0x5402e1={'where':_0x4cb843[_0x1697('0x3d')]};return db[_0x1697('0x43')]['count'](_0x5402e1)['then'](function(_0x2fc0f7){_0x4f924f[_0x1697('0x1f')]=_0x2fc0f7;if(_0x3e5b0c[_0x1697('0x34')]['includeAll']){_0x4cb843[_0x1697('0x44')]=[{'all':!![]}];}return db[_0x1697('0x43')][_0x1697('0x45')](_0x4cb843);})[_0x1697('0x28')](function(_0x651da7){_0x4f924f[_0x1697('0x46')]=_0x651da7;return _0x4f924f;})[_0x1697('0x28')](respondWithFilteredResult(_0x16216d,_0x4cb843))[_0x1697('0x47')](handleError(_0x16216d,null));};exports[_0x1697('0x48')]=function(_0x506054,_0x52c796){var _0x2ffa2a={'raw':![],'where':{'id':_0x506054['params']['id']}},_0x198888={};_0x198888['model']=_[_0x1697('0x35')](db['Campaign'][_0x1697('0x30')]);_0x198888['query']=_[_0x1697('0x35')](_0x506054[_0x1697('0x34')]);_0x198888[_0x1697('0x36')]=_[_0x1697('0x37')](_0x198888[_0x1697('0x33')],_0x198888['query']);_0x2ffa2a[_0x1697('0x38')]=_[_0x1697('0x37')](_0x198888[_0x1697('0x33')],qs[_0x1697('0x39')](_0x506054['query'][_0x1697('0x39')]));_0x2ffa2a[_0x1697('0x38')]=_0x2ffa2a[_0x1697('0x38')][_0x1697('0x49')]?_0x2ffa2a[_0x1697('0x38')]:_0x198888[_0x1697('0x33')];if(_0x506054[_0x1697('0x34')][_0x1697('0x4a')]){_0x2ffa2a[_0x1697('0x44')]=[{'all':!![]}];}_0x2ffa2a=_[_0x1697('0x40')]({},_0x2ffa2a,_0x506054[_0x1697('0x42')]);return db['Campaign']['find'](_0x2ffa2a)[_0x1697('0x28')](handleEntityNotFound(_0x52c796,null))[_0x1697('0x28')](respondWithResult(_0x52c796,null))[_0x1697('0x47')](handleError(_0x52c796,null));};exports['create']=function(_0x3874e6,_0x4ecdfb){return db[_0x1697('0x43')][_0x1697('0x4b')](_0x3874e6['body'],{})[_0x1697('0x28')](function(_0x54aa6c){var _0x3d32e4=_0x3874e6['user']['get']({'plain':!![]});if(!_0x3d32e4)throw new Error(_0x1697('0x4c'));if(_0x3d32e4[_0x1697('0x4d')]===_0x1697('0x4e')){var _0x53f61c=_0x54aa6c[_0x1697('0x4f')]({'plain':!![]});var _0x5f5305=_0x1697('0x29');return db['UserProfileSection'][_0x1697('0x50')]({'where':{'name':_0x5f5305,'userProfileId':_0x3d32e4[_0x1697('0x51')]},'raw':!![]})['then'](function(_0x279b82){if(_0x279b82&&_0x279b82[_0x1697('0x52')]===0x0){return db[_0x1697('0x2a')][_0x1697('0x4b')]({'name':_0x53f61c['name'],'resourceId':_0x53f61c['id'],'type':_0x279b82['name'],'sectionId':_0x279b82['id']},{})[_0x1697('0x28')](function(){return _0x54aa6c;});}else{return _0x54aa6c;}})['catch'](function(_0xa13a39){logger[_0x1697('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa13a39);throw _0xa13a39;});}return _0x54aa6c;})[_0x1697('0x28')](respondWithResult(_0x4ecdfb,0xc9))[_0x1697('0x47')](handleError(_0x4ecdfb,null));};exports[_0x1697('0x54')]=function(_0x205310,_0x247631){var _0x1269ed={'where':{'id':_0x205310[_0x1697('0x55')]['id']}},_0x59da39={};_0x59da39[_0x1697('0x33')]=_[_0x1697('0x35')](db[_0x1697('0x43')][_0x1697('0x30')]);_0x1269ed[_0x1697('0x38')]=_[_0x1697('0x37')](_0x59da39['model'],qs[_0x1697('0x39')](_0x205310[_0x1697('0x34')][_0x1697('0x39')]));_0x1269ed[_0x1697('0x38')]=_0x1269ed['attributes']['length']?_0x1269ed[_0x1697('0x38')]:_0x59da39[_0x1697('0x33')];if(_0x205310[_0x1697('0x34')][_0x1697('0x4a')]){_0x1269ed[_0x1697('0x44')]=[{'all':!![]}];}_0x1269ed=_[_0x1697('0x40')]({},_0x1269ed,_0x205310['options']);return db[_0x1697('0x43')][_0x1697('0x50')](_0x1269ed)['then'](handleEntityNotFound(_0x247631,null))[_0x1697('0x28')](function(_0xf881c3){if(_0xf881c3){var _0x460f9c=_0xf881c3[_0x1697('0x4f')]({'plain':!![]});_0x460f9c=qs[_0x1697('0x56')](_0x460f9c,['id',_0x1697('0x57'),_0x1697('0x58')]);_0x205310[_0x1697('0x59')]=_[_0x1697('0x56')](_0x205310[_0x1697('0x59')],['id',_0x1697('0x57'),_0x1697('0x58')]);return db[_0x1697('0x43')][_0x1697('0x4b')](_['merge'](_0x460f9c,_0x205310[_0x1697('0x59')]),{'include':_0x205310['query'][_0x1697('0x4a')]?[{'all':!![]}]:undefined})[_0x1697('0x28')](function(_0x338cfa){var _0x20838a=_0x205310['user'][_0x1697('0x4f')]({'plain':!![]});if(!_0x20838a)throw new Error(_0x1697('0x4c'));if(_0x20838a[_0x1697('0x4d')]===_0x1697('0x4e')){var _0x266d35=_0x338cfa[_0x1697('0x4f')]({'plain':!![]});var _0x4f235a=_0x1697('0x29');return db[_0x1697('0x5a')][_0x1697('0x50')]({'where':{'name':_0x4f235a,'userProfileId':_0x20838a[_0x1697('0x51')]},'raw':!![]})[_0x1697('0x28')](function(_0x4b4a47){if(_0x4b4a47&&_0x4b4a47[_0x1697('0x52')]===0x0){return db[_0x1697('0x2a')]['create']({'name':_0x266d35[_0x1697('0x2c')],'resourceId':_0x266d35['id'],'type':_0x4b4a47[_0x1697('0x2c')],'sectionId':_0x4b4a47['id']},{})[_0x1697('0x28')](function(){return _0x338cfa;});}else{return _0x338cfa;}})[_0x1697('0x47')](function(_0x47704a){logger[_0x1697('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47704a);throw _0x47704a;});}return _0x338cfa;});}})[_0x1697('0x28')](respondWithResult(_0x247631,0xc9))['catch'](handleError(_0x247631,null));};exports[_0x1697('0x26')]=function(_0x1e6ea8,_0x49c278){if(_0x1e6ea8['body']['id']){delete _0x1e6ea8[_0x1697('0x59')]['id'];}return db[_0x1697('0x43')]['find']({'where':{'id':_0x1e6ea8[_0x1697('0x55')]['id']}})[_0x1697('0x28')](handleEntityNotFound(_0x49c278,null))[_0x1697('0x28')](saveUpdates(_0x1e6ea8['body'],null))['then'](respondWithResult(_0x49c278,null))['catch'](handleError(_0x49c278,null));};exports['destroy']=function(_0x5ac1bd,_0x3c3145){return db[_0x1697('0x43')][_0x1697('0x50')]({'where':{'id':_0x5ac1bd[_0x1697('0x55')]['id']}})[_0x1697('0x28')](handleEntityNotFound(_0x3c3145,null))[_0x1697('0x28')](removeEntity(_0x3c3145,null))[_0x1697('0x47')](handleError(_0x3c3145,null));};exports[_0x1697('0x5b')]=function(_0x4c5a87,_0x4c3a97,_0x2cb988){var _0x5b560c={'raw':!![],'where':{}};var _0x821e6a={};var _0xa6f314={'count':0x0,'rows':[]};return db[_0x1697('0x43')]['findOne']({'where':{'id':_0x4c5a87[_0x1697('0x55')]['id']}})[_0x1697('0x28')](handleEntityNotFound(_0x4c3a97,null))[_0x1697('0x28')](function(_0x4ee11f){if(_0x4ee11f){_0x821e6a[_0x1697('0x33')]=_[_0x1697('0x35')](db[_0x1697('0x5c')][_0x1697('0x30')]);_0x821e6a['query']=_[_0x1697('0x35')](_0x4c5a87['query']);_0x821e6a[_0x1697('0x36')]=_[_0x1697('0x37')](_0x821e6a[_0x1697('0x33')],_0x821e6a[_0x1697('0x34')]);_0x5b560c[_0x1697('0x38')]=_[_0x1697('0x37')](_0x821e6a[_0x1697('0x33')],qs[_0x1697('0x39')](_0x4c5a87[_0x1697('0x34')][_0x1697('0x39')]));_0x5b560c[_0x1697('0x38')]=_0x5b560c[_0x1697('0x38')][_0x1697('0x49')]?_0x5b560c['attributes']:_0x821e6a['model'];if(!_0x4c5a87[_0x1697('0x34')][_0x1697('0x3a')](_0x1697('0x5d'))){_0x5b560c[_0x1697('0x1e')]=qs[_0x1697('0x1e')](_0x4c5a87[_0x1697('0x34')][_0x1697('0x1e')]);_0x5b560c['offset']=qs[_0x1697('0x1c')](_0x4c5a87[_0x1697('0x34')][_0x1697('0x1c')]);}_0x5b560c[_0x1697('0x3b')]=qs[_0x1697('0x3c')](_0x4c5a87[_0x1697('0x34')][_0x1697('0x3c')]);_0x5b560c['where']=qs[_0x1697('0x36')](_[_0x1697('0x3e')](_0x4c5a87[_0x1697('0x34')],_0x821e6a['filters']));_0x5b560c[_0x1697('0x3d')][_0x1697('0x5e')]=_0x4ee11f['id'];if(_0x4c5a87[_0x1697('0x34')][_0x1697('0x3f')]){_0x5b560c[_0x1697('0x3d')]=_[_0x1697('0x40')](_0x5b560c['where'],{'$or':_[_0x1697('0x2f')](_0x5b560c[_0x1697('0x38')],function(_0x43dcf1){var _0x39c037={};_0x39c037[_0x43dcf1]={'$like':'%'+_0x4c5a87[_0x1697('0x34')]['filter']+'%'};return _0x39c037;})});}_0x5b560c=_[_0x1697('0x40')]({},_0x5b560c,_0x4c5a87[_0x1697('0x42')]);return db[_0x1697('0x5c')][_0x1697('0x1f')]({'where':_0x5b560c[_0x1697('0x3d')]})['then'](function(_0xca501f){_0xa6f314[_0x1697('0x1f')]=_0xca501f;if(_0x4c5a87['query']['includeAll']){_0x5b560c[_0x1697('0x44')]=[{'all':!![]}];}return db[_0x1697('0x5c')][_0x1697('0x45')](_0x5b560c);})[_0x1697('0x28')](function(_0x11b9f3){_0xa6f314[_0x1697('0x46')]=_0x11b9f3;return _0xa6f314;});}})['then'](respondWithFilteredResult(_0x4c3a97,_0x5b560c))[_0x1697('0x47')](handleError(_0x4c3a97,null));};exports['getHopperHistories']=function(_0x552d3a,_0x1ab017,_0x4c2790){var _0x250a51={'raw':!![],'where':{}};var _0x266d5e={};var _0x513bbc={'count':0x0,'rows':[]};return db[_0x1697('0x43')][_0x1697('0x5f')]({'where':{'id':_0x552d3a['params']['id']}})['then'](handleEntityNotFound(_0x1ab017,null))[_0x1697('0x28')](function(_0x320ff9){if(_0x320ff9){_0x266d5e[_0x1697('0x33')]=_[_0x1697('0x35')](db['CmHopperHistory'][_0x1697('0x30')]);_0x266d5e[_0x1697('0x34')]=_['keys'](_0x552d3a[_0x1697('0x34')]);_0x266d5e[_0x1697('0x36')]=_['intersection'](_0x266d5e[_0x1697('0x33')],_0x266d5e[_0x1697('0x34')]);_0x250a51['attributes']=_[_0x1697('0x37')](_0x266d5e['model'],qs['fields'](_0x552d3a[_0x1697('0x34')]['fields']));_0x250a51[_0x1697('0x38')]=_0x250a51[_0x1697('0x38')][_0x1697('0x49')]?_0x250a51[_0x1697('0x38')]:_0x266d5e[_0x1697('0x33')];if(!_0x552d3a[_0x1697('0x34')][_0x1697('0x3a')](_0x1697('0x5d'))){_0x250a51[_0x1697('0x1e')]=qs[_0x1697('0x1e')](_0x552d3a['query'][_0x1697('0x1e')]);_0x250a51['offset']=qs[_0x1697('0x1c')](_0x552d3a[_0x1697('0x34')][_0x1697('0x1c')]);}_0x250a51[_0x1697('0x3b')]=qs[_0x1697('0x3c')](_0x552d3a[_0x1697('0x34')][_0x1697('0x3c')]);_0x250a51[_0x1697('0x3d')]=qs['filters'](_[_0x1697('0x3e')](_0x552d3a['query'],_0x266d5e[_0x1697('0x36')]));_0x250a51['where']['CampaignId']=_0x320ff9['id'];if(_0x552d3a[_0x1697('0x34')][_0x1697('0x3f')]){_0x250a51[_0x1697('0x3d')]=_['merge'](_0x250a51[_0x1697('0x3d')],{'$or':_[_0x1697('0x2f')](_0x250a51[_0x1697('0x38')],function(_0x380202){var _0x23b990={};_0x23b990[_0x380202]={'$like':'%'+_0x552d3a['query']['filter']+'%'};return _0x23b990;})});}_0x250a51=_['merge']({},_0x250a51,_0x552d3a[_0x1697('0x42')]);return db['CmHopperHistory'][_0x1697('0x1f')]({'where':_0x250a51['where']})[_0x1697('0x28')](function(_0x26ce8b){_0x513bbc[_0x1697('0x1f')]=_0x26ce8b;if(_0x552d3a[_0x1697('0x34')]['includeAll']){_0x250a51[_0x1697('0x44')]=[{'all':!![]}];}return db[_0x1697('0x60')][_0x1697('0x45')](_0x250a51);})[_0x1697('0x28')](function(_0x854c3b){_0x513bbc['rows']=_0x854c3b;return _0x513bbc;});}})['then'](respondWithFilteredResult(_0x1ab017,_0x250a51))[_0x1697('0x47')](handleError(_0x1ab017,null));};exports[_0x1697('0x61')]=function(_0x810bf2,_0x1eb5e2,_0x4399eb){var _0x3440c9={'raw':!![],'where':{}};var _0x9c373b={};var _0x30dcdb={'count':0x0,'rows':[]};return db[_0x1697('0x43')][_0x1697('0x5f')]({'where':{'id':_0x810bf2[_0x1697('0x55')]['id']}})[_0x1697('0x28')](handleEntityNotFound(_0x1eb5e2,null))[_0x1697('0x28')](function(_0x21c8cb){if(_0x21c8cb){_0x9c373b[_0x1697('0x33')]=_['keys'](db[_0x1697('0x62')]['rawAttributes']);_0x9c373b[_0x1697('0x34')]=_[_0x1697('0x35')](_0x810bf2[_0x1697('0x34')]);_0x9c373b[_0x1697('0x36')]=_[_0x1697('0x37')](_0x9c373b[_0x1697('0x33')],_0x9c373b['query']);_0x3440c9[_0x1697('0x38')]=_['intersection'](_0x9c373b[_0x1697('0x33')],qs['fields'](_0x810bf2[_0x1697('0x34')][_0x1697('0x39')]));_0x3440c9[_0x1697('0x38')]=_0x3440c9[_0x1697('0x38')][_0x1697('0x49')]?_0x3440c9['attributes']:_0x9c373b[_0x1697('0x33')];if(!_0x810bf2['query'][_0x1697('0x3a')]('nolimit')){_0x3440c9[_0x1697('0x1e')]=qs['limit'](_0x810bf2[_0x1697('0x34')][_0x1697('0x1e')]);_0x3440c9['offset']=qs[_0x1697('0x1c')](_0x810bf2['query']['offset']);}_0x3440c9[_0x1697('0x3b')]=qs['sort'](_0x810bf2['query'][_0x1697('0x3c')]);_0x3440c9[_0x1697('0x3d')]=qs[_0x1697('0x36')](_[_0x1697('0x3e')](_0x810bf2[_0x1697('0x34')],_0x9c373b['filters']));_0x3440c9[_0x1697('0x3d')]['CampaignId']=_0x21c8cb['id'];if(_0x810bf2['query']['filter']){_0x3440c9[_0x1697('0x3d')]=_[_0x1697('0x40')](_0x3440c9[_0x1697('0x3d')],{'$or':_[_0x1697('0x2f')](_0x3440c9[_0x1697('0x38')],function(_0x1b037c){var _0x5c275a={};_0x5c275a[_0x1b037c]={'$like':'%'+_0x810bf2[_0x1697('0x34')]['filter']+'%'};return _0x5c275a;})});}_0x3440c9=_[_0x1697('0x40')]({},_0x3440c9,_0x810bf2[_0x1697('0x42')]);return db[_0x1697('0x62')]['count']({'where':_0x3440c9[_0x1697('0x3d')]})[_0x1697('0x28')](function(_0x45ce37){_0x30dcdb['count']=_0x45ce37;if(_0x810bf2[_0x1697('0x34')]['includeAll']){_0x3440c9['include']=[{'all':!![]}];}return db[_0x1697('0x62')][_0x1697('0x45')](_0x3440c9);})[_0x1697('0x28')](function(_0x334bdd){_0x30dcdb[_0x1697('0x46')]=_0x334bdd;return _0x30dcdb;});}})[_0x1697('0x28')](respondWithFilteredResult(_0x1eb5e2,_0x3440c9))[_0x1697('0x47')](handleError(_0x1eb5e2,null));};exports[_0x1697('0x63')]=function(_0x26648e,_0x53cff9,_0x381c16){var _0x2630cf={'raw':!![],'where':{}};var _0x3405a0={};var _0x3f6b0e={'count':0x0,'rows':[]};return db[_0x1697('0x43')][_0x1697('0x5f')]({'where':{'id':_0x26648e[_0x1697('0x55')]['id']}})[_0x1697('0x28')](handleEntityNotFound(_0x53cff9,null))[_0x1697('0x28')](function(_0x280e20){if(_0x280e20){_0x3405a0['model']=_[_0x1697('0x35')](db[_0x1697('0x64')][_0x1697('0x30')]);_0x3405a0['query']=_[_0x1697('0x35')](_0x26648e[_0x1697('0x34')]);_0x3405a0[_0x1697('0x36')]=_['intersection'](_0x3405a0[_0x1697('0x33')],_0x3405a0[_0x1697('0x34')]);_0x2630cf[_0x1697('0x38')]=_[_0x1697('0x37')](_0x3405a0['model'],qs[_0x1697('0x39')](_0x26648e[_0x1697('0x34')][_0x1697('0x39')]));_0x2630cf[_0x1697('0x38')]=_0x2630cf[_0x1697('0x38')][_0x1697('0x49')]?_0x2630cf['attributes']:_0x3405a0[_0x1697('0x33')];if(!_0x26648e[_0x1697('0x34')][_0x1697('0x3a')](_0x1697('0x5d'))){_0x2630cf[_0x1697('0x1e')]=qs[_0x1697('0x1e')](_0x26648e[_0x1697('0x34')]['limit']);_0x2630cf['offset']=qs[_0x1697('0x1c')](_0x26648e['query'][_0x1697('0x1c')]);}_0x2630cf['order']=qs['sort'](_0x26648e[_0x1697('0x34')][_0x1697('0x3c')]);_0x2630cf[_0x1697('0x3d')]=qs[_0x1697('0x36')](_[_0x1697('0x3e')](_0x26648e[_0x1697('0x34')],_0x3405a0[_0x1697('0x36')]));_0x2630cf[_0x1697('0x3d')]['CampaignId']=_0x280e20['id'];if(_0x26648e[_0x1697('0x34')][_0x1697('0x3f')]){_0x2630cf[_0x1697('0x3d')]=_[_0x1697('0x40')](_0x2630cf[_0x1697('0x3d')],{'$or':_['map'](_0x2630cf[_0x1697('0x38')],function(_0x18cbf9){var _0x50a79b={};_0x50a79b[_0x18cbf9]={'$like':'%'+_0x26648e[_0x1697('0x34')][_0x1697('0x3f')]+'%'};return _0x50a79b;})});}_0x2630cf=_[_0x1697('0x40')]({},_0x2630cf,_0x26648e[_0x1697('0x42')]);return db[_0x1697('0x64')]['count']({'where':_0x2630cf['where']})[_0x1697('0x28')](function(_0x4cb699){_0x3f6b0e['count']=_0x4cb699;if(_0x26648e['query'][_0x1697('0x4a')]){_0x2630cf[_0x1697('0x44')]=[{'all':!![]}];}return db[_0x1697('0x64')][_0x1697('0x45')](_0x2630cf);})['then'](function(_0x314f93){_0x3f6b0e[_0x1697('0x46')]=_0x314f93;return _0x3f6b0e;});}})['then'](respondWithFilteredResult(_0x53cff9,_0x2630cf))[_0x1697('0x47')](handleError(_0x53cff9,null));};exports[_0x1697('0x65')]=function(_0x248669,_0x369284,_0x5e7278){var _0xe24aac={};var _0x467f1a={};var _0x5c709c;var _0x2188d7;return db['Campaign']['findOne']({'where':{'id':_0x248669[_0x1697('0x55')]['id']}})[_0x1697('0x28')](handleEntityNotFound(_0x369284,null))[_0x1697('0x28')](function(_0x58a66a){if(_0x58a66a){_0x5c709c=_0x58a66a;_0x467f1a[_0x1697('0x33')]=_[_0x1697('0x35')](db['CmList'][_0x1697('0x30')]);_0x467f1a[_0x1697('0x34')]=_[_0x1697('0x35')](_0x248669['query']);_0x467f1a[_0x1697('0x36')]=_[_0x1697('0x37')](_0x467f1a['model'],_0x467f1a[_0x1697('0x34')]);_0xe24aac[_0x1697('0x38')]=_[_0x1697('0x37')](_0x467f1a[_0x1697('0x33')],qs['fields'](_0x248669[_0x1697('0x34')][_0x1697('0x39')]));_0xe24aac[_0x1697('0x38')]=_0xe24aac[_0x1697('0x38')]['length']?_0xe24aac[_0x1697('0x38')]:_0x467f1a[_0x1697('0x33')];_0xe24aac[_0x1697('0x3b')]=qs[_0x1697('0x3c')](_0x248669[_0x1697('0x34')][_0x1697('0x3c')]);_0xe24aac[_0x1697('0x3d')]=qs[_0x1697('0x36')](_[_0x1697('0x3e')](_0x248669[_0x1697('0x34')],_0x467f1a[_0x1697('0x36')]));if(_0x248669[_0x1697('0x34')][_0x1697('0x3f')]){_0xe24aac['where']=_[_0x1697('0x40')](_0xe24aac[_0x1697('0x3d')],{'$or':_['map'](_0xe24aac[_0x1697('0x38')],function(_0x109ec8){var _0x40ecfb={};_0x40ecfb[_0x109ec8]={'$like':'%'+_0x248669[_0x1697('0x34')][_0x1697('0x3f')]+'%'};return _0x40ecfb;})});}_0xe24aac=_[_0x1697('0x40')]({},_0xe24aac,_0x248669[_0x1697('0x42')]);return _0x5c709c[_0x1697('0x65')](_0xe24aac);}})[_0x1697('0x28')](function(_0x1352df){if(_0x1352df){_0x2188d7=_0x1352df[_0x1697('0x49')];if(!_0x248669[_0x1697('0x34')][_0x1697('0x3a')](_0x1697('0x5d'))){_0xe24aac[_0x1697('0x1e')]=qs[_0x1697('0x1e')](_0x248669[_0x1697('0x34')][_0x1697('0x1e')]);_0xe24aac[_0x1697('0x1c')]=qs['offset'](_0x248669['query'][_0x1697('0x1c')]);}return _0x5c709c[_0x1697('0x65')](_0xe24aac);}})[_0x1697('0x28')](function(_0x1292db){if(_0x1292db){return _0x1292db?{'count':_0x2188d7,'rows':_0x1292db}:null;}})[_0x1697('0x28')](respondWithResult(_0x369284,null))['catch'](handleError(_0x369284,null));};exports['addLists']=function(_0x2f4fe4,_0x1089cf,_0x579548){var _0x1a8006,_0x3ee227;return db[_0x1697('0x43')][_0x1697('0x50')]({'where':{'id':_0x2f4fe4[_0x1697('0x55')]['id']}})['then'](handleEntityNotFound(_0x1089cf,null))[_0x1697('0x28')](function(_0x7b8ae9){if(_0x7b8ae9){_0x3ee227=_0x7b8ae9;return _0x7b8ae9[_0x1697('0x66')](_0x2f4fe4[_0x1697('0x59')][_0x1697('0x67')],_[_0x1697('0x56')](_0x2f4fe4[_0x1697('0x59')],['ids','id'])||{});}return null;})[_0x1697('0x68')](function(_0x5062b6){var _0x3370a6;_0x1a8006=_0x5062b6||[];var _0x2efdd3=[];if(_0x5062b6){for(var _0x32bb04=0x0;_0x32bb04<_0x5062b6[_0x1697('0x49')];_0x32bb04+=0x1){var _0x48e05d=_0x5062b6[_0x32bb04]['get']({'plain':!![]});_0x3ee227[_0x1697('0x69')]=_0x2f4fe4[_0x1697('0x59')][_0x1697('0x69')]?_0x2f4fe4[_0x1697('0x59')][_0x1697('0x69')]:_0x3ee227[_0x1697('0x69')];switch(_0x3ee227[_0x1697('0x69')]){case'always':_0x3370a6=squel[_0x1697('0x6a')]()[_0x1697('0x6b')](_0x1697('0x6c'))[_0x1697('0x6d')]([_0x1697('0x6e'),_0x1697('0x6f'),_0x1697('0x70'),_0x1697('0x71'),_0x1697('0x5e'),_0x1697('0x57'),'updatedAt'],squel['select']()[_0x1697('0x72')](_0x1697('0x6e'),_0x1697('0x6e'))[_0x1697('0x72')](_0x1697('0x73'),_0x1697('0x6f'))[_0x1697('0x72')]('id',_0x1697('0x70'))[_0x1697('0x72')](_0x48e05d[_0x1697('0x74')][_0x1697('0x75')](),_0x1697('0x71'))[_0x1697('0x72')](_0x2f4fe4[_0x1697('0x55')]['id']['toString'](),'CampaignId')['field'](_0x1697('0x73'),_0x1697('0x57'))['field'](_0x1697('0x73'),_0x1697('0x58'))[_0x1697('0x76')](_0x1697('0x77'))[_0x1697('0x3d')](_0x1697('0x78'))['where']('ListId\x20=\x20?',_0x48e05d['CmListId'][_0x1697('0x75')]())[_0x1697('0x3d')](_0x1697('0x79'))[_0x1697('0x3d')](_0x1697('0x7a'),squel[_0x1697('0x7b')]()[_0x1697('0x72')](_0x1697('0x7c'))[_0x1697('0x76')](_0x1697('0x7d'))['where'](_0x1697('0x7e'),_0x2f4fe4['params']['id']['toString']()))[_0x1697('0x3d')](_0x1697('0x7a'),squel[_0x1697('0x7b')]()[_0x1697('0x72')]('COALESCE(phone,\x27\x27)')[_0x1697('0x76')]('cm_hopper')[_0x1697('0x3d')](_0x1697('0x7e'),_0x2f4fe4[_0x1697('0x55')]['id']['toString']())))[_0x1697('0x75')]();break;case _0x1697('0x7f'):_0x3370a6=squel['insert']()[_0x1697('0x6b')]('cm_hopper')[_0x1697('0x6d')]([_0x1697('0x6e'),_0x1697('0x6f'),_0x1697('0x70'),_0x1697('0x71'),_0x1697('0x5e'),_0x1697('0x57'),_0x1697('0x58')],squel[_0x1697('0x7b')]()[_0x1697('0x72')]('phone',_0x1697('0x6e'))[_0x1697('0x72')]('NOW()',_0x1697('0x6f'))[_0x1697('0x72')]('id',_0x1697('0x70'))[_0x1697('0x72')](_0x48e05d[_0x1697('0x74')][_0x1697('0x75')](),_0x1697('0x71'))[_0x1697('0x72')](_0x2f4fe4['params']['id'][_0x1697('0x75')](),'CampaignId')[_0x1697('0x72')]('NOW()',_0x1697('0x57'))['field'](_0x1697('0x73'),_0x1697('0x58'))[_0x1697('0x76')](_0x1697('0x77'))[_0x1697('0x3d')](_0x1697('0x78'))[_0x1697('0x3d')]('ListId\x20=\x20?',_0x48e05d[_0x1697('0x74')][_0x1697('0x75')]())[_0x1697('0x3d')](_0x1697('0x79'))[_0x1697('0x3d')](_0x1697('0x7a'),squel['select']()[_0x1697('0x72')]('COALESCE(phone,\x27\x27)')[_0x1697('0x76')](_0x1697('0x6c'))[_0x1697('0x3d')](_0x1697('0x7e'),_0x2f4fe4[_0x1697('0x55')]['id'][_0x1697('0x75')]())))[_0x1697('0x75')]();break;default:_0x3370a6=squel[_0x1697('0x6a')]()[_0x1697('0x6b')]('cm_hopper')['fromQuery']([_0x1697('0x6e'),_0x1697('0x6f'),_0x1697('0x70'),'ListId',_0x1697('0x5e'),_0x1697('0x57'),'updatedAt'],squel['select']()[_0x1697('0x72')](_0x1697('0x6e'),'phone')[_0x1697('0x72')](_0x1697('0x73'),'scheduledAt')[_0x1697('0x72')]('id',_0x1697('0x70'))[_0x1697('0x72')](_0x48e05d['CmListId'][_0x1697('0x75')](),_0x1697('0x71'))[_0x1697('0x72')](_0x2f4fe4[_0x1697('0x55')]['id']['toString'](),'CampaignId')['field'](_0x1697('0x73'),_0x1697('0x57'))[_0x1697('0x72')](_0x1697('0x73'),_0x1697('0x58'))[_0x1697('0x76')]('cm_contacts')[_0x1697('0x3d')](_0x1697('0x78'))[_0x1697('0x3d')](_0x1697('0x80'),_0x48e05d[_0x1697('0x74')]['toString']())[_0x1697('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0x1697('0x75')]();}_0x2efdd3[_0x1697('0x81')](db[_0x1697('0x82')][_0x1697('0x34')](_0x3370a6));}return BPromise[_0x1697('0x83')](_0x2efdd3);}})[_0x1697('0x28')](function(){return _0x1a8006;})[_0x1697('0x28')](respondWithResult(_0x1089cf,null))[_0x1697('0x47')](handleError(_0x1089cf,null));};exports[_0x1697('0x84')]=function(_0x3bdd30,_0x43f837,_0x50d1d9){return db['Campaign'][_0x1697('0x50')]({'where':{'id':_0x3bdd30[_0x1697('0x55')]['id']}})[_0x1697('0x28')](handleEntityNotFound(_0x43f837,null))[_0x1697('0x28')](function(_0x126e44){if(_0x126e44){return _0x126e44['removeLists'](_0x3bdd30[_0x1697('0x34')][_0x1697('0x67')]);}})[_0x1697('0x28')](function(_0x1de66c){if(_0x1de66c){return db[_0x1697('0x5c')][_0x1697('0x27')]({'where':{'ListId':_0x3bdd30[_0x1697('0x34')][_0x1697('0x67')],'CampaignId':_0x3bdd30[_0x1697('0x55')]['id']}})[_0x1697('0x28')](function(){return _0x1de66c;});}})['then'](respondWithStatusCode(_0x43f837,null))['catch'](handleError(_0x43f837,null));};exports[_0x1697('0x85')]=function(_0x35cc60,_0x196f16,_0x533e84){var _0x1d45b2={};var _0x5b0194={};var _0x1129e8;var _0x11d3c8;return db[_0x1697('0x43')][_0x1697('0x5f')]({'where':{'id':_0x35cc60[_0x1697('0x55')]['id']}})[_0x1697('0x28')](handleEntityNotFound(_0x196f16,null))[_0x1697('0x28')](function(_0x4356b9){if(_0x4356b9){_0x1129e8=_0x4356b9;_0x5b0194['model']=_[_0x1697('0x35')](db['CmList']['rawAttributes']);_0x5b0194[_0x1697('0x34')]=_[_0x1697('0x35')](_0x35cc60[_0x1697('0x34')]);_0x5b0194[_0x1697('0x36')]=_[_0x1697('0x37')](_0x5b0194['model'],_0x5b0194['query']);_0x1d45b2[_0x1697('0x38')]=_[_0x1697('0x37')](_0x5b0194[_0x1697('0x33')],qs[_0x1697('0x39')](_0x35cc60[_0x1697('0x34')][_0x1697('0x39')]));_0x1d45b2['attributes']=_0x1d45b2[_0x1697('0x38')][_0x1697('0x49')]?_0x1d45b2['attributes']:_0x5b0194['model'];_0x1d45b2[_0x1697('0x3b')]=qs['sort'](_0x35cc60[_0x1697('0x34')][_0x1697('0x3c')]);_0x1d45b2[_0x1697('0x3d')]=qs[_0x1697('0x36')](_['pick'](_0x35cc60[_0x1697('0x34')],_0x5b0194[_0x1697('0x36')]));if(_0x35cc60['query'][_0x1697('0x3f')]){_0x1d45b2[_0x1697('0x3d')]=_[_0x1697('0x40')](_0x1d45b2['where'],{'$or':_[_0x1697('0x2f')](_0x1d45b2['attributes'],function(_0x31a953){var _0x1344a6={};_0x1344a6[_0x31a953]={'$like':'%'+_0x35cc60['query'][_0x1697('0x3f')]+'%'};return _0x1344a6;})});}_0x1d45b2=_['merge']({},_0x1d45b2,_0x35cc60['options']);return _0x1129e8[_0x1697('0x85')](_0x1d45b2);}})[_0x1697('0x28')](function(_0x320109){if(_0x320109){_0x11d3c8=_0x320109['length'];if(!_0x35cc60[_0x1697('0x34')][_0x1697('0x3a')](_0x1697('0x5d'))){_0x1d45b2[_0x1697('0x1e')]=qs[_0x1697('0x1e')](_0x35cc60['query']['limit']);_0x1d45b2[_0x1697('0x1c')]=qs[_0x1697('0x1c')](_0x35cc60[_0x1697('0x34')][_0x1697('0x1c')]);}return _0x1129e8['getBlackLists'](_0x1d45b2);}})[_0x1697('0x28')](function(_0x5d7040){if(_0x5d7040){return _0x5d7040?{'count':_0x11d3c8,'rows':_0x5d7040}:null;}})[_0x1697('0x28')](respondWithResult(_0x196f16,null))[_0x1697('0x47')](handleError(_0x196f16,null));};exports[_0x1697('0x86')]=function(_0x5497a3,_0x121ef3,_0x17d546){var _0x3c9f41,_0x4621b5;return db[_0x1697('0x43')][_0x1697('0x50')]({'where':{'id':_0x5497a3[_0x1697('0x55')]['id']}})[_0x1697('0x28')](handleEntityNotFound(_0x121ef3,null))[_0x1697('0x28')](function(_0x8a3a36){if(_0x8a3a36){_0x4621b5=_0x8a3a36;return _0x8a3a36[_0x1697('0x86')](_0x5497a3['body'][_0x1697('0x67')],_[_0x1697('0x56')](_0x5497a3[_0x1697('0x59')],[_0x1697('0x67'),'id'])||{});}return null;})[_0x1697('0x68')](function(_0x170b11){var _0x18a933;_0x3c9f41=_0x170b11||[];var _0x629923=[];if(_0x170b11){for(var _0x696a7c=0x0;_0x696a7c<_0x170b11['length'];_0x696a7c+=0x1){var _0x1ae99a=_0x170b11[_0x696a7c][_0x1697('0x4f')]({'plain':!![]});_0x18a933=squel[_0x1697('0x6a')]()[_0x1697('0x6b')](_0x1697('0x87'))[_0x1697('0x6d')]([_0x1697('0x6e'),_0x1697('0x70'),_0x1697('0x71'),_0x1697('0x5e'),_0x1697('0x57'),_0x1697('0x58')],squel[_0x1697('0x7b')]()[_0x1697('0x72')](_0x1697('0x6e'),_0x1697('0x6e'))[_0x1697('0x72')]('id','ContactId')[_0x1697('0x72')](_0x1ae99a[_0x1697('0x74')][_0x1697('0x75')](),_0x1697('0x71'))[_0x1697('0x72')](_0x5497a3[_0x1697('0x55')]['id'][_0x1697('0x75')](),_0x1697('0x5e'))['field']('NOW()','createdAt')[_0x1697('0x72')](_0x1697('0x73'),_0x1697('0x58'))[_0x1697('0x76')](_0x1697('0x77'))[_0x1697('0x3d')](_0x1697('0x78'))[_0x1697('0x3d')]('ListId\x20=\x20?',_0x1ae99a[_0x1697('0x74')][_0x1697('0x75')]())[_0x1697('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0x1697('0x75')]();_0x629923[_0x1697('0x81')](db[_0x1697('0x82')][_0x1697('0x34')](_0x18a933));}return BPromise['all'](_0x629923);}})[_0x1697('0x28')](function(){return _0x3c9f41;})[_0x1697('0x28')](respondWithResult(_0x121ef3,null))[_0x1697('0x47')](handleError(_0x121ef3,null));};exports[_0x1697('0x88')]=function(_0x3b9826,_0x3be810,_0x4fc6bc){return db['Campaign'][_0x1697('0x50')]({'where':{'id':_0x3b9826[_0x1697('0x55')]['id']}})['then'](handleEntityNotFound(_0x3be810,null))[_0x1697('0x28')](function(_0x364265){if(_0x364265){return _0x364265['removeBlackLists'](_0x3b9826[_0x1697('0x34')][_0x1697('0x67')]);}})[_0x1697('0x28')](function(_0x488990){if(_0x488990){return db[_0x1697('0x64')]['destroy']({'where':{'ListId':_0x3b9826['query'][_0x1697('0x67')],'CampaignId':_0x3b9826[_0x1697('0x55')]['id']}})[_0x1697('0x28')](function(){return _0x488990;});}})['then'](respondWithStatusCode(_0x3be810,null))[_0x1697('0x47')](handleError(_0x3be810,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 8540aed..fb720d6 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 7e5a898..1224f78 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 _0x74f0=['result','catch','GetCampaign','options','where','attributes','limit','include','map','model','then','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x15294d,_0x4f6a0d){var _0x4f6dab=function(_0x42c241){while(--_0x42c241){_0x15294d['push'](_0x15294d['shift']());}};_0x4f6dab(++_0x4f6a0d);}(_0x74f0,0xf3));var _0x074f=function(_0x4492af,_0x47e25d){_0x4492af=_0x4492af-0x0;var _0x216729=_0x74f0[_0x4492af];return _0x216729;};'use strict';var _=require('lodash');var util=require(_0x074f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x074f('0x1'));var fs=require('fs');var Redis=require(_0x074f('0x2'));var db=require(_0x074f('0x3'))['db'];var utils=require(_0x074f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x074f('0x5'));var jayson=require(_0x074f('0x6'));var client=jayson[_0x074f('0x7')][_0x074f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10b244,_0x395b3c,_0x3dd440){return new BPromise(function(_0x547297,_0x7108e1){return client[_0x074f('0x9')](_0x10b244,_0x3dd440)['then'](function(_0x252a2e){logger[_0x074f('0xa')](_0x074f('0xb'),_0x395b3c,_0x074f('0xc'));logger[_0x074f('0xd')]('Campaign,\x20%s,\x20%s,\x20%s',_0x395b3c,'request\x20sent',JSON[_0x074f('0xe')](_0x252a2e));if(_0x252a2e[_0x074f('0xf')]){if(_0x252a2e[_0x074f('0xf')][_0x074f('0x10')]===0x1f4){logger[_0x074f('0xf')](_0x074f('0xb'),_0x395b3c,_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);return _0x7108e1(_0x252a2e[_0x074f('0xf')]['message']);}logger[_0x074f('0xf')]('Campaign,\x20%s,\x20%s',_0x395b3c,_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);return _0x547297(_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);}else{logger[_0x074f('0xa')](_0x074f('0xb'),_0x395b3c,_0x074f('0xc'));_0x547297(_0x252a2e[_0x074f('0x12')][_0x074f('0x11')]);}})[_0x074f('0x13')](function(_0x40fd10){logger['error'](_0x074f('0xb'),_0x395b3c,_0x40fd10);_0x7108e1(_0x40fd10);});});}exports[_0x074f('0x14')]=function(_0x200e43){var _0x3facd8=this;return new Promise(function(_0x315e7d,_0x1c5406){return db['Campaign']['findAll']({'raw':_0x200e43[_0x074f('0x15')]?_0x200e43['options']['raw']===undefined?!![]:![]:!![],'where':_0x200e43[_0x074f('0x15')]?_0x200e43[_0x074f('0x15')][_0x074f('0x16')]||null:null,'attributes':_0x200e43[_0x074f('0x15')]?_0x200e43[_0x074f('0x15')][_0x074f('0x17')]||null:null,'limit':_0x200e43[_0x074f('0x15')]?_0x200e43[_0x074f('0x15')][_0x074f('0x18')]||null:null,'include':_0x200e43[_0x074f('0x15')]?_0x200e43[_0x074f('0x15')][_0x074f('0x19')]?_[_0x074f('0x1a')](_0x200e43[_0x074f('0x15')][_0x074f('0x19')],function(_0x1bd2c7){return{'model':db[_0x1bd2c7[_0x074f('0x1b')]],'as':_0x1bd2c7['as'],'attributes':_0x1bd2c7[_0x074f('0x17')],'include':_0x1bd2c7[_0x074f('0x19')]?_[_0x074f('0x1a')](_0x1bd2c7['include'],function(_0x4ee6ac){return{'model':db[_0x4ee6ac['model']],'as':_0x4ee6ac['as'],'attributes':_0x4ee6ac[_0x074f('0x17')],'include':_0x4ee6ac[_0x074f('0x19')]?_[_0x074f('0x1a')](_0x4ee6ac[_0x074f('0x19')],function(_0x5aabea){return{'model':db[_0x5aabea[_0x074f('0x1b')]],'as':_0x5aabea['as'],'attributes':_0x5aabea[_0x074f('0x17')]};}):[]};}):[]};}):[]:[]})[_0x074f('0x1c')](function(_0x312119){logger[_0x074f('0xa')](_0x074f('0x14'),_0x200e43);logger['debug'](_0x074f('0x14'),_0x200e43,JSON[_0x074f('0xe')](_0x312119));_0x315e7d(_0x312119);})[_0x074f('0x13')](function(_0x53b76d){logger[_0x074f('0xf')]('GetCampaign',_0x53b76d['message'],_0x200e43);_0x1c5406(_0x3facd8[_0x074f('0xf')](0x1f4,_0x53b76d['message']));});});}; \ No newline at end of file +var _0x330c=['attributes','include','map','model','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','findAll','options','raw','where'];(function(_0x5dbbc6,_0x141f04){var _0x38a7fc=function(_0x505723){while(--_0x505723){_0x5dbbc6['push'](_0x5dbbc6['shift']());}};_0x38a7fc(++_0x141f04);}(_0x330c,0x186));var _0xc330=function(_0x2761ff,_0x55c929){_0x2761ff=_0x2761ff-0x0;var _0x36f62b=_0x330c[_0x2761ff];return _0x36f62b;};'use strict';var _=require(_0xc330('0x0'));var util=require(_0xc330('0x1'));var moment=require(_0xc330('0x2'));var BPromise=require(_0xc330('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc330('0x4'));var db=require(_0xc330('0x5'))['db'];var utils=require(_0xc330('0x6'));var logger=require(_0xc330('0x7'))(_0xc330('0x8'));var config=require(_0xc330('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a6a2e,_0x97255c,_0x253c40){return new BPromise(function(_0x114bf0,_0x2c6b74){return client[_0xc330('0xa')](_0x1a6a2e,_0x253c40)[_0xc330('0xb')](function(_0x48480e){logger[_0xc330('0xc')](_0xc330('0xd'),_0x97255c,_0xc330('0xe'));logger['debug'](_0xc330('0xf'),_0x97255c,_0xc330('0xe'),JSON[_0xc330('0x10')](_0x48480e));if(_0x48480e[_0xc330('0x11')]){if(_0x48480e[_0xc330('0x11')][_0xc330('0x12')]===0x1f4){logger[_0xc330('0x11')](_0xc330('0xd'),_0x97255c,_0x48480e[_0xc330('0x11')]['message']);return _0x2c6b74(_0x48480e['error'][_0xc330('0x13')]);}logger[_0xc330('0x11')]('Campaign,\x20%s,\x20%s',_0x97255c,_0x48480e[_0xc330('0x11')][_0xc330('0x13')]);return _0x114bf0(_0x48480e[_0xc330('0x11')][_0xc330('0x13')]);}else{logger[_0xc330('0xc')](_0xc330('0xd'),_0x97255c,_0xc330('0xe'));_0x114bf0(_0x48480e[_0xc330('0x14')][_0xc330('0x13')]);}})['catch'](function(_0x1dae13){logger[_0xc330('0x11')]('Campaign,\x20%s,\x20%s',_0x97255c,_0x1dae13);_0x2c6b74(_0x1dae13);});});}exports[_0xc330('0x15')]=function(_0x3f3d74){var _0x46f47c=this;return new Promise(function(_0x259adc,_0xd51374){return db['Campaign'][_0xc330('0x16')]({'raw':_0x3f3d74['options']?_0x3f3d74[_0xc330('0x17')][_0xc330('0x18')]===undefined?!![]:![]:!![],'where':_0x3f3d74[_0xc330('0x17')]?_0x3f3d74[_0xc330('0x17')][_0xc330('0x19')]||null:null,'attributes':_0x3f3d74[_0xc330('0x17')]?_0x3f3d74[_0xc330('0x17')][_0xc330('0x1a')]||null:null,'limit':_0x3f3d74[_0xc330('0x17')]?_0x3f3d74[_0xc330('0x17')]['limit']||null:null,'include':_0x3f3d74['options']?_0x3f3d74[_0xc330('0x17')][_0xc330('0x1b')]?_[_0xc330('0x1c')](_0x3f3d74[_0xc330('0x17')][_0xc330('0x1b')],function(_0x46caae){return{'model':db[_0x46caae[_0xc330('0x1d')]],'as':_0x46caae['as'],'attributes':_0x46caae[_0xc330('0x1a')],'include':_0x46caae[_0xc330('0x1b')]?_[_0xc330('0x1c')](_0x46caae[_0xc330('0x1b')],function(_0x248132){return{'model':db[_0x248132[_0xc330('0x1d')]],'as':_0x248132['as'],'attributes':_0x248132['attributes'],'include':_0x248132[_0xc330('0x1b')]?_['map'](_0x248132[_0xc330('0x1b')],function(_0x2aaf78){return{'model':db[_0x2aaf78[_0xc330('0x1d')]],'as':_0x2aaf78['as'],'attributes':_0x2aaf78['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f50df){logger['info']('GetCampaign',_0x3f3d74);logger[_0xc330('0x1e')](_0xc330('0x15'),_0x3f3d74,JSON[_0xc330('0x10')](_0x5f50df));_0x259adc(_0x5f50df);})[_0xc330('0x1f')](function(_0x381fe5){logger[_0xc330('0x11')]('GetCampaign',_0x381fe5[_0xc330('0x13')],_0x3f3d74);_0xd51374(_0x46f47c['error'](0x1f4,_0x381fe5[_0xc330('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 23025d2..c174272 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 _0x076b=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','index','get','/:id','getHoppers','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getLists','/:id/blacklists','post','create','/:id/clone','clone','/:id/lists','addLists','update','delete','destroy','removeLists','exports','multer','util'];(function(_0x4c378e,_0x286afb){var _0xf41ce7=function(_0x48d22e){while(--_0x48d22e){_0x4c378e['push'](_0x4c378e['shift']());}};_0xf41ce7(++_0x286afb);}(_0x076b,0x76));var _0xb076=function(_0x5eb5d5,_0x2f2f8c){_0x5eb5d5=_0x5eb5d5-0x0;var _0x323399=_0x076b[_0x5eb5d5];return _0x323399;};'use strict';var multer=require(_0xb076('0x0'));var util=require(_0xb076('0x1'));var path=require(_0xb076('0x2'));var timeout=require(_0xb076('0x3'));var express=require(_0xb076('0x4'));var router=express['Router']();var fs_extra=require(_0xb076('0x5'));var auth=require(_0xb076('0x6'));var interaction=require(_0xb076('0x7'));var config=require('../../config/environment');var controller=require(_0xb076('0x8'));router['get']('/',auth[_0xb076('0x9')](),controller[_0xb076('0xa')]);router[_0xb076('0xb')](_0xb076('0xc'),auth[_0xb076('0x9')](),controller['show']);router['get']('/:id/hoppers',auth[_0xb076('0x9')](),controller[_0xb076('0xd')]);router[_0xb076('0xb')]('/:id/hopper_histories',auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xb076('0xb')](_0xb076('0xe'),auth['isAuthenticated'](),controller[_0xb076('0xf')]);router[_0xb076('0xb')](_0xb076('0x10'),auth[_0xb076('0x9')](),controller['getHopperBlacks']);router[_0xb076('0xb')]('/:id/lists',auth['isAuthenticated'](),controller[_0xb076('0x11')]);router[_0xb076('0xb')](_0xb076('0x12'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xb076('0x13')]('/',auth[_0xb076('0x9')](),controller[_0xb076('0x14')]);router[_0xb076('0x13')](_0xb076('0x15'),auth[_0xb076('0x9')](),controller[_0xb076('0x16')]);router[_0xb076('0x13')](_0xb076('0x17'),auth[_0xb076('0x9')](),controller[_0xb076('0x18')]);router['post'](_0xb076('0x12'),auth['isAuthenticated'](),controller['addBlackLists']);router['put'](_0xb076('0xc'),auth[_0xb076('0x9')](),controller[_0xb076('0x19')]);router[_0xb076('0x1a')](_0xb076('0xc'),auth[_0xb076('0x9')](),controller[_0xb076('0x1b')]);router[_0xb076('0x1a')](_0xb076('0x17'),auth['isAuthenticated'](),controller[_0xb076('0x1c')]);router[_0xb076('0x1a')]('/:id/blacklists',auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xb076('0x1d')]=router; \ No newline at end of file +var _0x0c02=['getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories'];(function(_0x2dc098,_0x48eb28){var _0x391d8d=function(_0x54bdb7){while(--_0x54bdb7){_0x2dc098['push'](_0x2dc098['shift']());}};_0x391d8d(++_0x48eb28);}(_0x0c02,0x142));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x20c0('0x0'));var util=require(_0x20c0('0x1'));var path=require(_0x20c0('0x2'));var timeout=require(_0x20c0('0x3'));var express=require(_0x20c0('0x4'));var router=express[_0x20c0('0x5')]();var fs_extra=require(_0x20c0('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xb')]);router['get'](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0xd')]);router[_0x20c0('0x9')](_0x20c0('0xe'),auth[_0x20c0('0xa')](),controller[_0x20c0('0xf')]);router[_0x20c0('0x9')](_0x20c0('0x10'),auth[_0x20c0('0xa')](),controller[_0x20c0('0x11')]);router[_0x20c0('0x9')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x20c0('0x12')]);router[_0x20c0('0x9')](_0x20c0('0x13'),auth[_0x20c0('0xa')](),controller[_0x20c0('0x14')]);router[_0x20c0('0x9')](_0x20c0('0x15'),auth['isAuthenticated'](),controller[_0x20c0('0x16')]);router[_0x20c0('0x9')](_0x20c0('0x17'),auth['isAuthenticated'](),controller[_0x20c0('0x18')]);router[_0x20c0('0x19')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0x1a')]);router[_0x20c0('0x19')](_0x20c0('0x1b'),auth['isAuthenticated'](),controller[_0x20c0('0x1c')]);router['post'](_0x20c0('0x15'),auth[_0x20c0('0xa')](),controller[_0x20c0('0x1d')]);router[_0x20c0('0x19')](_0x20c0('0x17'),auth[_0x20c0('0xa')](),controller['addBlackLists']);router['put'](_0x20c0('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller['destroy']);router[_0x20c0('0x1e')](_0x20c0('0x15'),auth[_0x20c0('0xa')](),controller[_0x20c0('0x1f')]);router['delete']('/:id/blacklists',auth[_0x20c0('0xa')](),controller[_0x20c0('0x20')]);module[_0x20c0('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 0c1c05e..a47e3ac 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 _0x002f=['STRING','key','sequelize'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0x002f,0x176));var _0xf002=function(_0x1466ba,_0x4cd93e){_0x1466ba=_0x1466ba-0x0;var _0x56a71b=_0x002f[_0x1466ba];return _0x56a71b;};'use strict';var Sequelize=require(_0xf002('0x0'));module['exports']={'key':{'type':Sequelize[_0xf002('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xf002('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xf002('0x2'));}}}; \ No newline at end of file +var _0xf4e9=['STRING','TEXT','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x3bf96b,_0x3d6609){var _0x1fe476=function(_0x364e80){while(--_0x364e80){_0x3bf96b['push'](_0x3bf96b['shift']());}};_0x1fe476(++_0x3d6609);}(_0xf4e9,0xa6));var _0x9f4e=function(_0x263a1c,_0xde5b93){_0x263a1c=_0x263a1c-0x0;var _0x54532d=_0xf4e9[_0x263a1c];return _0x54532d;};'use strict';var Sequelize=require(_0x9f4e('0x0'));module[_0x9f4e('0x1')]={'key':{'type':Sequelize[_0x9f4e('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x9f4e('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x9f4e('0x4')],'get':function(){return this[_0x9f4e('0x5')](_0x9f4e('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 9d18f89..8b79aa7 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 _0xad2b=['UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../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','set','Content-Range','reject','update','then','get','UserProfileResource','destroy','error','name','send','index','map','CannedAnswer','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','body','find','params','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role'];(function(_0x452968,_0x31e391){var _0xb6f9ae=function(_0x263987){while(--_0x263987){_0x452968['push'](_0x452968['shift']());}};_0xb6f9ae(++_0x31e391);}(_0xad2b,0x1b3));var _0xbad2=function(_0x4fecf8,_0x528530){_0x4fecf8=_0x4fecf8-0x0;var _0x4e492f=_0xad2b[_0x4fecf8];return _0x4e492f;};'use strict';var emlformat=require(_0xbad2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbad2('0x1'));var jsonpatch=require(_0xbad2('0x2'));var rp=require('request-promise');var moment=require(_0xbad2('0x3'));var BPromise=require(_0xbad2('0x4'));var Mustache=require(_0xbad2('0x5'));var util=require(_0xbad2('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbad2('0x7'));var ejs=require(_0xbad2('0x8'));var fs=require('fs');var fs_extra=require(_0xbad2('0x9'));var _=require('lodash');var squel=require(_0xbad2('0xa'));var crypto=require(_0xbad2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbad2('0xc'));var toCsv=require(_0xbad2('0x7'));var querystring=require(_0xbad2('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbad2('0xe'));var qs=require(_0xbad2('0xf'));var as=require(_0xbad2('0x10'));var hardwareService=require(_0xbad2('0x11'));var logger=require(_0xbad2('0x12'))(_0xbad2('0x13'));var utils=require('../../config/utils');var config=require(_0xbad2('0x14'));var licenseUtil=require(_0xbad2('0x15'));var db=require(_0xbad2('0x16'))['db'];function respondWithStatusCode(_0x15cddc,_0x1d9e8f){_0x1d9e8f=_0x1d9e8f||0xcc;return function(_0xe2f577){if(_0xe2f577){return _0x15cddc[_0xbad2('0x17')](_0x1d9e8f);}return _0x15cddc[_0xbad2('0x18')](_0x1d9e8f)[_0xbad2('0x19')]();};}function respondWithResult(_0x35ed23,_0x775d0f){_0x775d0f=_0x775d0f||0xc8;return function(_0x5959a7){if(_0x5959a7){return _0x35ed23[_0xbad2('0x18')](_0x775d0f)[_0xbad2('0x1a')](_0x5959a7);}};}function respondWithFilteredResult(_0x24b996,_0x107bdf){return function(_0x5792fe){if(_0x5792fe){var _0x22ac45=typeof _0x107bdf[_0xbad2('0x1b')]===_0xbad2('0x1c')&&typeof _0x107bdf[_0xbad2('0x1d')]===_0xbad2('0x1c');var _0x3d516a=_0x5792fe['count'];var _0x24d5d7=_0x22ac45?0x0:_0x107bdf[_0xbad2('0x1b')];var _0x13b676=_0x22ac45?_0x5792fe[_0xbad2('0x1e')]:_0x107bdf[_0xbad2('0x1b')]+_0x107bdf[_0xbad2('0x1d')];var _0x882103;if(_0x13b676>=_0x3d516a){_0x13b676=_0x3d516a;_0x882103=0xc8;}else{_0x882103=0xce;}_0x24b996[_0xbad2('0x18')](_0x882103);return _0x24b996[_0xbad2('0x1f')](_0xbad2('0x20'),_0x24d5d7+'-'+_0x13b676+'/'+_0x3d516a)[_0xbad2('0x1a')](_0x5792fe);}return null;};}function patchUpdates(_0x6d61a2){return function(_0x3f71ae){try{jsonpatch['apply'](_0x3f71ae,_0x6d61a2,!![]);}catch(_0xb5c3a3){return BPromise[_0xbad2('0x21')](_0xb5c3a3);}return _0x3f71ae['save']();};}function saveUpdates(_0x2c11ed,_0x2f1ae2){return function(_0x30a380){if(_0x30a380){return _0x30a380[_0xbad2('0x22')](_0x2c11ed)[_0xbad2('0x23')](function(_0x288d53){return _0x288d53;});}return null;};}function removeEntity(_0xd59143,_0x33f044){return function(_0x390d53){if(_0x390d53){return _0x390d53['destroy']()[_0xbad2('0x23')](function(){var _0x325e18=_0x390d53[_0xbad2('0x24')]({'plain':!![]});var _0x3dc8fa='CannedAnswers';return db[_0xbad2('0x25')][_0xbad2('0x26')]({'where':{'type':_0x3dc8fa,'resourceId':_0x325e18['id']}})[_0xbad2('0x23')](function(){return _0x390d53;});})[_0xbad2('0x23')](function(){_0xd59143['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3189e6,_0x3dc96b){return function(_0x59b374){if(!_0x59b374){_0x3189e6[_0xbad2('0x17')](0x194);}return _0x59b374;};}function handleError(_0x404587,_0x50e451){_0x50e451=_0x50e451||0x1f4;return function(_0x6519d1){logger[_0xbad2('0x27')](_0x6519d1['stack']);if(_0x6519d1[_0xbad2('0x28')]){delete _0x6519d1[_0xbad2('0x28')];}_0x404587[_0xbad2('0x18')](_0x50e451)[_0xbad2('0x29')](_0x6519d1);};}exports[_0xbad2('0x2a')]=function(_0x5ea9b5,_0x1739eb){var _0x1821b6={},_0x4bda25={},_0x4031bb={'count':0x0,'rows':[]};var _0x258123=_[_0xbad2('0x2b')](db[_0xbad2('0x2c')][_0xbad2('0x2d')],function(_0x443c4f){return{'name':_0x443c4f[_0xbad2('0x2e')],'type':_0x443c4f['type'][_0xbad2('0x2f')]};});_0x4bda25[_0xbad2('0x30')]=_[_0xbad2('0x2b')](_0x258123,'name');_0x4bda25['query']=_[_0xbad2('0x31')](_0x5ea9b5['query']);_0x4bda25[_0xbad2('0x32')]=_[_0xbad2('0x33')](_0x4bda25[_0xbad2('0x30')],_0x4bda25[_0xbad2('0x34')]);_0x1821b6[_0xbad2('0x35')]=_['intersection'](_0x4bda25[_0xbad2('0x30')],qs[_0xbad2('0x36')](_0x5ea9b5[_0xbad2('0x34')][_0xbad2('0x36')]));_0x1821b6['attributes']=_0x1821b6[_0xbad2('0x35')][_0xbad2('0x37')]?_0x1821b6[_0xbad2('0x35')]:_0x4bda25[_0xbad2('0x30')];if(!_0x5ea9b5[_0xbad2('0x34')][_0xbad2('0x38')](_0xbad2('0x39'))){_0x1821b6[_0xbad2('0x1d')]=qs[_0xbad2('0x1d')](_0x5ea9b5[_0xbad2('0x34')]['limit']);_0x1821b6['offset']=qs[_0xbad2('0x1b')](_0x5ea9b5['query'][_0xbad2('0x1b')]);}_0x1821b6[_0xbad2('0x3a')]=qs[_0xbad2('0x3b')](_0x5ea9b5[_0xbad2('0x34')][_0xbad2('0x3b')]);_0x1821b6[_0xbad2('0x3c')]=qs[_0xbad2('0x32')](_['pick'](_0x5ea9b5[_0xbad2('0x34')],_0x4bda25['filters']),_0x258123);if(_0x5ea9b5['query'][_0xbad2('0x3d')]){_0x1821b6['where']=_[_0xbad2('0x3e')](_0x1821b6[_0xbad2('0x3c')],{'$or':[{'key':{'$like':'%'+_0x5ea9b5[_0xbad2('0x34')][_0xbad2('0x3d')]+'%'}},{'value':{'$like':'%'+_0x5ea9b5[_0xbad2('0x34')][_0xbad2('0x3d')]+'%'}}]});}_0x1821b6=_[_0xbad2('0x3e')]({},_0x1821b6,_0x5ea9b5[_0xbad2('0x3f')]);var _0x237a7a={'where':_0x1821b6[_0xbad2('0x3c')]};return db[_0xbad2('0x2c')][_0xbad2('0x1e')](_0x237a7a)['then'](function(_0x3bd4bb){_0x4031bb[_0xbad2('0x1e')]=_0x3bd4bb;if(_0x5ea9b5[_0xbad2('0x34')][_0xbad2('0x40')]){_0x1821b6[_0xbad2('0x41')]=[{'all':!![]}];}return db['CannedAnswer'][_0xbad2('0x42')](_0x1821b6);})[_0xbad2('0x23')](function(_0x54b23c){_0x4031bb['rows']=_0x54b23c;return _0x4031bb;})[_0xbad2('0x23')](respondWithFilteredResult(_0x1739eb,_0x1821b6))['catch'](handleError(_0x1739eb,null));};exports['show']=function(_0x494915,_0x2b674f){var _0x19c63b={'raw':!![],'where':{'id':_0x494915['params']['id']}},_0x57cae9={};_0x57cae9[_0xbad2('0x30')]=_[_0xbad2('0x31')](db['CannedAnswer'][_0xbad2('0x2d')]);_0x57cae9['query']=_[_0xbad2('0x31')](_0x494915['query']);_0x57cae9['filters']=_[_0xbad2('0x33')](_0x57cae9[_0xbad2('0x30')],_0x57cae9[_0xbad2('0x34')]);_0x19c63b[_0xbad2('0x35')]=_[_0xbad2('0x33')](_0x57cae9[_0xbad2('0x30')],qs[_0xbad2('0x36')](_0x494915[_0xbad2('0x34')][_0xbad2('0x36')]));_0x19c63b[_0xbad2('0x35')]=_0x19c63b[_0xbad2('0x35')]['length']?_0x19c63b[_0xbad2('0x35')]:_0x57cae9[_0xbad2('0x30')];if(_0x494915[_0xbad2('0x34')][_0xbad2('0x40')]){_0x19c63b['include']=[{'all':!![]}];}_0x19c63b=_[_0xbad2('0x3e')]({},_0x19c63b,_0x494915['options']);return db[_0xbad2('0x2c')]['find'](_0x19c63b)[_0xbad2('0x23')](handleEntityNotFound(_0x2b674f,null))[_0xbad2('0x23')](respondWithResult(_0x2b674f,null))['catch'](handleError(_0x2b674f,null));};exports[_0xbad2('0x22')]=function(_0x3bdc61,_0x47e75e){if(_0x3bdc61['body']['id']){delete _0x3bdc61[_0xbad2('0x43')]['id'];}return db[_0xbad2('0x2c')][_0xbad2('0x44')]({'where':{'id':_0x3bdc61[_0xbad2('0x45')]['id']}})[_0xbad2('0x23')](handleEntityNotFound(_0x47e75e,null))[_0xbad2('0x23')](saveUpdates(_0x3bdc61[_0xbad2('0x43')],null))[_0xbad2('0x23')](respondWithResult(_0x47e75e,null))[_0xbad2('0x46')](handleError(_0x47e75e,null));};exports[_0xbad2('0x26')]=function(_0x708415,_0xbbeb3a){return db[_0xbad2('0x2c')]['find']({'where':{'id':_0x708415[_0xbad2('0x45')]['id']}})[_0xbad2('0x23')](handleEntityNotFound(_0xbbeb3a,null))[_0xbad2('0x23')](removeEntity(_0xbbeb3a,null))['catch'](handleError(_0xbbeb3a,null));};exports[_0xbad2('0x47')]=function(_0x510520,_0x100f54){var _0xa6664f={'key':_0x510520[_0xbad2('0x43')][_0xbad2('0x2f')]};if(_0x510520[_0xbad2('0x43')][_0xbad2('0x48')]){_0xa6664f[_0xbad2('0x48')]=_0x510520[_0xbad2('0x43')][_0xbad2('0x48')];}else if(_0x510520[_0xbad2('0x43')][_0xbad2('0x49')]){_0xa6664f[_0xbad2('0x49')]=_0x510520[_0xbad2('0x43')]['SmsAccountId'];}else if(_0x510520[_0xbad2('0x43')][_0xbad2('0x4a')]){_0xa6664f['OpenchannelAccountId']=_0x510520['body'][_0xbad2('0x4a')];}else if(_0x510520['body']['ChatWebsiteId']){_0xa6664f['ChatWebsiteId']=_0x510520['body'][_0xbad2('0x4b')];}return db[_0xbad2('0x2c')]['find']({'where':_0xa6664f})[_0xbad2('0x23')](function(_0x4440c6){if(_0x4440c6){throw new db[(_0xbad2('0x4c'))][(_0xbad2('0x4d'))](_0xbad2('0x4e'));}return db['CannedAnswer']['create'](_0x510520['body']);})[_0xbad2('0x23')](function(_0xfd9172){var _0x3855d2=_0x510520[_0xbad2('0x4f')][_0xbad2('0x24')]({'plain':!![]});if(!_0x3855d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3855d2[_0xbad2('0x50')]===_0xbad2('0x4f')){var _0x1ef275=_0xfd9172[_0xbad2('0x24')]({'plain':!![]});return db[_0xbad2('0x51')][_0xbad2('0x44')]({'where':{'name':_0xbad2('0x52'),'userProfileId':_0x3855d2[_0xbad2('0x53')]},'raw':!![]})[_0xbad2('0x23')](function(_0xeca223){if(_0xeca223&&_0xeca223[_0xbad2('0x54')]===0x0){return db[_0xbad2('0x25')][_0xbad2('0x47')]({'name':_0x1ef275[_0xbad2('0x28')],'resourceId':_0x1ef275['id'],'type':_0xeca223[_0xbad2('0x28')],'sectionId':_0xeca223['id']},{})[_0xbad2('0x23')](function(){return _0xfd9172;});}else{return _0xfd9172;}})['catch'](function(_0xa78a9c){logger[_0xbad2('0x27')](_0xbad2('0x55'),_0xa78a9c);throw _0xa78a9c;});}return _0xfd9172;})[_0xbad2('0x23')](respondWithResult(_0x100f54,0xc9))[_0xbad2('0x46')](handleError(_0x100f54,null));}; \ No newline at end of file +var _0x5a12=['ejs','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','get','CannedAnswers','error','name','send','map','CannedAnswer','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','catch','show','rawAttributes','body','find','params','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x5a12,0x144));var _0x25a1=function(_0x58d1cf,_0x33e549){_0x58d1cf=_0x58d1cf-0x0;var _0x50287e=_0x5a12[_0x58d1cf];return _0x50287e;};'use strict';var emlformat=require(_0x25a1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x25a1('0x1'));var jsonpatch=require(_0x25a1('0x2'));var rp=require('request-promise');var moment=require(_0x25a1('0x3'));var BPromise=require(_0x25a1('0x4'));var Mustache=require('mustache');var util=require(_0x25a1('0x5'));var path=require(_0x25a1('0x6'));var sox=require('sox');var csv=require(_0x25a1('0x7'));var ejs=require(_0x25a1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x25a1('0x9'));var jsforce=require(_0x25a1('0xa'));var deskjs=require(_0x25a1('0xb'));var toCsv=require(_0x25a1('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x25a1('0xc'));var authService=require(_0x25a1('0xd'));var qs=require(_0x25a1('0xe'));var as=require(_0x25a1('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x25a1('0x10'))(_0x25a1('0x11'));var utils=require(_0x25a1('0x12'));var config=require(_0x25a1('0x13'));var licenseUtil=require(_0x25a1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x124cc8,_0x5e222a){_0x5e222a=_0x5e222a||0xcc;return function(_0x3e6198){if(_0x3e6198){return _0x124cc8[_0x25a1('0x15')](_0x5e222a);}return _0x124cc8[_0x25a1('0x16')](_0x5e222a)[_0x25a1('0x17')]();};}function respondWithResult(_0xd59724,_0x4b0519){_0x4b0519=_0x4b0519||0xc8;return function(_0x752b38){if(_0x752b38){return _0xd59724[_0x25a1('0x16')](_0x4b0519)[_0x25a1('0x18')](_0x752b38);}};}function respondWithFilteredResult(_0x518b26,_0x119282){return function(_0x2f3251){if(_0x2f3251){var _0x14d116=typeof _0x119282[_0x25a1('0x19')]===_0x25a1('0x1a')&&typeof _0x119282['limit']===_0x25a1('0x1a');var _0x4f759e=_0x2f3251[_0x25a1('0x1b')];var _0x131128=_0x14d116?0x0:_0x119282[_0x25a1('0x19')];var _0x49a213=_0x14d116?_0x2f3251['count']:_0x119282['offset']+_0x119282[_0x25a1('0x1c')];var _0x39a7af;if(_0x49a213>=_0x4f759e){_0x49a213=_0x4f759e;_0x39a7af=0xc8;}else{_0x39a7af=0xce;}_0x518b26[_0x25a1('0x16')](_0x39a7af);return _0x518b26[_0x25a1('0x1d')](_0x25a1('0x1e'),_0x131128+'-'+_0x49a213+'/'+_0x4f759e)['json'](_0x2f3251);}return null;};}function patchUpdates(_0x146c2c){return function(_0x43e31){try{jsonpatch['apply'](_0x43e31,_0x146c2c,!![]);}catch(_0x1768e9){return BPromise[_0x25a1('0x1f')](_0x1768e9);}return _0x43e31['save']();};}function saveUpdates(_0x16efcd,_0x4a8f8e){return function(_0x5c5ebe){if(_0x5c5ebe){return _0x5c5ebe[_0x25a1('0x20')](_0x16efcd)[_0x25a1('0x21')](function(_0x1a4e92){return _0x1a4e92;});}return null;};}function removeEntity(_0x318d02,_0x112af1){return function(_0x3af4a4){if(_0x3af4a4){return _0x3af4a4[_0x25a1('0x22')]()['then'](function(){var _0x34be55=_0x3af4a4[_0x25a1('0x23')]({'plain':!![]});var _0x585f7f=_0x25a1('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x585f7f,'resourceId':_0x34be55['id']}})[_0x25a1('0x21')](function(){return _0x3af4a4;});})[_0x25a1('0x21')](function(){_0x318d02[_0x25a1('0x16')](0xcc)[_0x25a1('0x17')]();});}};}function handleEntityNotFound(_0x5f5172,_0x2a2c02){return function(_0x4817b7){if(!_0x4817b7){_0x5f5172[_0x25a1('0x15')](0x194);}return _0x4817b7;};}function handleError(_0xe5242a,_0x51daed){_0x51daed=_0x51daed||0x1f4;return function(_0x550866){logger[_0x25a1('0x25')](_0x550866['stack']);if(_0x550866[_0x25a1('0x26')]){delete _0x550866['name'];}_0xe5242a[_0x25a1('0x16')](_0x51daed)[_0x25a1('0x27')](_0x550866);};}exports['index']=function(_0x12c00f,_0x2cdc89){var _0x13b662={},_0x10ce86={},_0x555d4b={'count':0x0,'rows':[]};var _0x18882a=_[_0x25a1('0x28')](db[_0x25a1('0x29')]['rawAttributes'],function(_0x53b8d5){return{'name':_0x53b8d5[_0x25a1('0x2a')],'type':_0x53b8d5[_0x25a1('0x2b')]['key']};});_0x10ce86['model']=_[_0x25a1('0x28')](_0x18882a,_0x25a1('0x26'));_0x10ce86['query']=_[_0x25a1('0x2c')](_0x12c00f[_0x25a1('0x2d')]);_0x10ce86[_0x25a1('0x2e')]=_[_0x25a1('0x2f')](_0x10ce86[_0x25a1('0x30')],_0x10ce86[_0x25a1('0x2d')]);_0x13b662[_0x25a1('0x31')]=_['intersection'](_0x10ce86['model'],qs[_0x25a1('0x32')](_0x12c00f[_0x25a1('0x2d')][_0x25a1('0x32')]));_0x13b662[_0x25a1('0x31')]=_0x13b662['attributes'][_0x25a1('0x33')]?_0x13b662[_0x25a1('0x31')]:_0x10ce86[_0x25a1('0x30')];if(!_0x12c00f['query'][_0x25a1('0x34')](_0x25a1('0x35'))){_0x13b662[_0x25a1('0x1c')]=qs[_0x25a1('0x1c')](_0x12c00f['query'][_0x25a1('0x1c')]);_0x13b662['offset']=qs['offset'](_0x12c00f[_0x25a1('0x2d')][_0x25a1('0x19')]);}_0x13b662['order']=qs[_0x25a1('0x36')](_0x12c00f['query']['sort']);_0x13b662[_0x25a1('0x37')]=qs[_0x25a1('0x2e')](_[_0x25a1('0x38')](_0x12c00f[_0x25a1('0x2d')],_0x10ce86[_0x25a1('0x2e')]),_0x18882a);if(_0x12c00f[_0x25a1('0x2d')]['filter']){_0x13b662['where']=_[_0x25a1('0x39')](_0x13b662['where'],{'$or':[{'key':{'$like':'%'+_0x12c00f[_0x25a1('0x2d')][_0x25a1('0x3a')]+'%'}},{'value':{'$like':'%'+_0x12c00f['query'][_0x25a1('0x3a')]+'%'}}]});}_0x13b662=_[_0x25a1('0x39')]({},_0x13b662,_0x12c00f[_0x25a1('0x3b')]);var _0x366c04={'where':_0x13b662[_0x25a1('0x37')]};return db[_0x25a1('0x29')][_0x25a1('0x1b')](_0x366c04)[_0x25a1('0x21')](function(_0x73282b){_0x555d4b[_0x25a1('0x1b')]=_0x73282b;if(_0x12c00f[_0x25a1('0x2d')][_0x25a1('0x3c')]){_0x13b662[_0x25a1('0x3d')]=[{'all':!![]}];}return db[_0x25a1('0x29')]['findAll'](_0x13b662);})[_0x25a1('0x21')](function(_0x57559f){_0x555d4b['rows']=_0x57559f;return _0x555d4b;})['then'](respondWithFilteredResult(_0x2cdc89,_0x13b662))[_0x25a1('0x3e')](handleError(_0x2cdc89,null));};exports[_0x25a1('0x3f')]=function(_0x6e1de7,_0x241407){var _0x101039={'raw':!![],'where':{'id':_0x6e1de7['params']['id']}},_0x1a5599={};_0x1a5599[_0x25a1('0x30')]=_['keys'](db[_0x25a1('0x29')][_0x25a1('0x40')]);_0x1a5599[_0x25a1('0x2d')]=_['keys'](_0x6e1de7[_0x25a1('0x2d')]);_0x1a5599[_0x25a1('0x2e')]=_['intersection'](_0x1a5599[_0x25a1('0x30')],_0x1a5599['query']);_0x101039['attributes']=_['intersection'](_0x1a5599[_0x25a1('0x30')],qs['fields'](_0x6e1de7[_0x25a1('0x2d')][_0x25a1('0x32')]));_0x101039[_0x25a1('0x31')]=_0x101039[_0x25a1('0x31')][_0x25a1('0x33')]?_0x101039[_0x25a1('0x31')]:_0x1a5599[_0x25a1('0x30')];if(_0x6e1de7[_0x25a1('0x2d')]['includeAll']){_0x101039[_0x25a1('0x3d')]=[{'all':!![]}];}_0x101039=_[_0x25a1('0x39')]({},_0x101039,_0x6e1de7[_0x25a1('0x3b')]);return db[_0x25a1('0x29')]['find'](_0x101039)['then'](handleEntityNotFound(_0x241407,null))[_0x25a1('0x21')](respondWithResult(_0x241407,null))[_0x25a1('0x3e')](handleError(_0x241407,null));};exports[_0x25a1('0x20')]=function(_0x2a2f27,_0x477e5b){if(_0x2a2f27[_0x25a1('0x41')]['id']){delete _0x2a2f27[_0x25a1('0x41')]['id'];}return db[_0x25a1('0x29')][_0x25a1('0x42')]({'where':{'id':_0x2a2f27[_0x25a1('0x43')]['id']}})[_0x25a1('0x21')](handleEntityNotFound(_0x477e5b,null))[_0x25a1('0x21')](saveUpdates(_0x2a2f27[_0x25a1('0x41')],null))[_0x25a1('0x21')](respondWithResult(_0x477e5b,null))[_0x25a1('0x3e')](handleError(_0x477e5b,null));};exports[_0x25a1('0x22')]=function(_0x7aa76a,_0x58fb04){return db['CannedAnswer'][_0x25a1('0x42')]({'where':{'id':_0x7aa76a[_0x25a1('0x43')]['id']}})[_0x25a1('0x21')](handleEntityNotFound(_0x58fb04,null))[_0x25a1('0x21')](removeEntity(_0x58fb04,null))[_0x25a1('0x3e')](handleError(_0x58fb04,null));};exports[_0x25a1('0x44')]=function(_0x372eb7,_0x9a072f){var _0x4f6306={'key':_0x372eb7[_0x25a1('0x41')][_0x25a1('0x45')]};if(_0x372eb7[_0x25a1('0x41')][_0x25a1('0x46')]){_0x4f6306[_0x25a1('0x46')]=_0x372eb7[_0x25a1('0x41')][_0x25a1('0x46')];}else if(_0x372eb7[_0x25a1('0x41')][_0x25a1('0x47')]){_0x4f6306[_0x25a1('0x47')]=_0x372eb7[_0x25a1('0x41')]['SmsAccountId'];}else if(_0x372eb7['body'][_0x25a1('0x48')]){_0x4f6306[_0x25a1('0x48')]=_0x372eb7['body'][_0x25a1('0x48')];}else if(_0x372eb7[_0x25a1('0x41')][_0x25a1('0x49')]){_0x4f6306[_0x25a1('0x49')]=_0x372eb7[_0x25a1('0x41')][_0x25a1('0x49')];}return db[_0x25a1('0x29')][_0x25a1('0x42')]({'where':_0x4f6306})[_0x25a1('0x21')](function(_0x1b9c66){if(_0x1b9c66){throw new db[(_0x25a1('0x4a'))][(_0x25a1('0x4b'))](_0x25a1('0x4c'));}return db['CannedAnswer'][_0x25a1('0x44')](_0x372eb7['body']);})[_0x25a1('0x21')](function(_0x12f50a){var _0x4c9ebe=_0x372eb7['user'][_0x25a1('0x23')]({'plain':!![]});if(!_0x4c9ebe)throw new Error(_0x25a1('0x4d'));if(_0x4c9ebe['role']===_0x25a1('0x4e')){var _0x53f5d5=_0x12f50a[_0x25a1('0x23')]({'plain':!![]});return db[_0x25a1('0x4f')][_0x25a1('0x42')]({'where':{'name':_0x25a1('0x24'),'userProfileId':_0x4c9ebe[_0x25a1('0x50')]},'raw':!![]})[_0x25a1('0x21')](function(_0x27cfa0){if(_0x27cfa0&&_0x27cfa0[_0x25a1('0x51')]===0x0){return db[_0x25a1('0x52')]['create']({'name':_0x53f5d5[_0x25a1('0x26')],'resourceId':_0x53f5d5['id'],'type':_0x27cfa0[_0x25a1('0x26')],'sectionId':_0x27cfa0['id']},{})[_0x25a1('0x21')](function(){return _0x12f50a;});}else{return _0x12f50a;}})[_0x25a1('0x3e')](function(_0x164fee){logger[_0x25a1('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x164fee);throw _0x164fee;});}return _0x12f50a;})['then'](respondWithResult(_0x9a072f,0xc9))['catch'](handleError(_0x9a072f,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 1bce7dd..d8d815c 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 _0xc579=['CannedAnswer','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x203a74,_0x2d48de){var _0x161fd2=function(_0xa88620){while(--_0xa88620){_0x203a74['push'](_0x203a74['shift']());}};_0x161fd2(++_0x2d48de);}(_0xc579,0xa2));var _0x9c57=function(_0x5976fb,_0x29cd8f){_0x5976fb=_0x5976fb-0x0;var _0x591baf=_0xc579[_0x5976fb];return _0x591baf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9c57('0x0'))(_0x9c57('0x1'));var moment=require(_0x9c57('0x2'));var BPromise=require('bluebird');var rp=require(_0x9c57('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c57('0x4'));var config=require(_0x9c57('0x5'));var attributes=require('./cannedAnswer.attributes');module[_0x9c57('0x6')]=function(_0x4bce64,_0x413bfb){return _0x4bce64[_0x9c57('0x7')](_0x9c57('0x8'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9c57('0x9')});}; \ No newline at end of file +var _0xd071=['path','rimraf','../../config/environment','./cannedAnswer.attributes','define','utf8mb4','util','../../config/logger','bluebird','request-promise'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0xd071,0x10a));var _0x1d07=function(_0x6f53c8,_0xbaf621){_0x6f53c8=_0x6f53c8-0x0;var _0x4c602e=_0xd071[_0x6f53c8];return _0x4c602e;};'use strict';var _=require('lodash');var util=require(_0x1d07('0x0'));var logger=require(_0x1d07('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1d07('0x2'));var rp=require(_0x1d07('0x3'));var fs=require('fs');var path=require(_0x1d07('0x4'));var rimraf=require(_0x1d07('0x5'));var config=require(_0x1d07('0x6'));var attributes=require(_0x1d07('0x7'));module['exports']=function(_0x5efd22,_0x76bda0){return _0x5efd22[_0x1d07('0x8')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1d07('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 52753e6..4ed92b9 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(_0x335ea7,_0x1fd9e1){var _0x262b1e=function(_0x151961){while(--_0x151961){_0x335ea7['push'](_0x335ea7['shift']());}};_0x262b1e(++_0x1fd9e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x544926,_0x1989a3){var _0x50aa05=function(_0x4f2bdc){while(--_0x4f2bdc){_0x544926['push'](_0x544926['shift']());}};_0x50aa05(++_0x1989a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 77e5ef2..061d6e3 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 _0xf1f6=['util','path','express','Router','fs-extra','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x1ac56c,_0x2a2881){var _0x3e51f9=function(_0x319064){while(--_0x319064){_0x1ac56c['push'](_0x1ac56c['shift']());}};_0x3e51f9(++_0x2a2881);}(_0xf1f6,0x155));var _0x6f1f=function(_0x44b5ae,_0x53a025){_0x44b5ae=_0x44b5ae-0x0;var _0x55556d=_0xf1f6[_0x44b5ae];return _0x55556d;};'use strict';var multer=require(_0x6f1f('0x0'));var util=require(_0x6f1f('0x1'));var path=require(_0x6f1f('0x2'));var timeout=require('connect-timeout');var express=require(_0x6f1f('0x3'));var router=express[_0x6f1f('0x4')]();var fs_extra=require(_0x6f1f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6f1f('0x6'));var controller=require(_0x6f1f('0x7'));router[_0x6f1f('0x8')]('/',auth[_0x6f1f('0x9')](),controller[_0x6f1f('0xa')]);router[_0x6f1f('0x8')](_0x6f1f('0xb'),auth[_0x6f1f('0x9')](),controller[_0x6f1f('0xc')]);router[_0x6f1f('0xd')]('/',auth[_0x6f1f('0x9')](),controller[_0x6f1f('0xe')]);router[_0x6f1f('0xf')](_0x6f1f('0xb'),auth['isAuthenticated'](),controller[_0x6f1f('0x10')]);router['delete'](_0x6f1f('0xb'),auth[_0x6f1f('0x9')](),controller[_0x6f1f('0x11')]);module[_0x6f1f('0x12')]=router; \ No newline at end of file +var _0xf006=['Router','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x370504,_0x2d0864){var _0x51db64=function(_0x4e74b2){while(--_0x4e74b2){_0x370504['push'](_0x370504['shift']());}};_0x51db64(++_0x2d0864);}(_0xf006,0x14f));var _0x6f00=function(_0x137191,_0x18bd3a){_0x137191=_0x137191-0x0;var _0x3f49a4=_0xf006[_0x137191];return _0x3f49a4;};'use strict';var multer=require(_0x6f00('0x0'));var util=require(_0x6f00('0x1'));var path=require(_0x6f00('0x2'));var timeout=require(_0x6f00('0x3'));var express=require(_0x6f00('0x4'));var router=express[_0x6f00('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6f00('0x6'));var interaction=require(_0x6f00('0x7'));var config=require('../../config/environment');var controller=require(_0x6f00('0x8'));router[_0x6f00('0x9')]('/',auth[_0x6f00('0xa')](),controller[_0x6f00('0xb')]);router[_0x6f00('0x9')]('/:id',auth[_0x6f00('0xa')](),controller['show']);router[_0x6f00('0xc')]('/',auth[_0x6f00('0xa')](),controller[_0x6f00('0xd')]);router[_0x6f00('0xe')]('/:id',auth[_0x6f00('0xa')](),controller[_0x6f00('0xf')]);router[_0x6f00('0x10')](_0x6f00('0x11'),auth[_0x6f00('0xa')](),controller[_0x6f00('0x12')]);module[_0x6f00('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 8aaae3d..ab9ec89 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 _0xb544=['STRING','DATE','1970-01-01\x2000:00:01'];(function(_0x300c13,_0x52d18d){var _0x34ecb7=function(_0x3201ac){while(--_0x3201ac){_0x300c13['push'](_0x300c13['shift']());}};_0x34ecb7(++_0x52d18d);}(_0xb544,0xd0));var _0x4b54=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xb544[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x4b54('0x0')],'allowNull':![],'defaultValue':_0x4b54('0x1')},'clid':{'type':Sequelize[_0x4b54('0x2')]},'src':{'type':Sequelize[_0x4b54('0x2')]},'dst':{'type':Sequelize[_0x4b54('0x2')]},'dcontext':{'type':Sequelize[_0x4b54('0x2')]},'channel':{'type':Sequelize[_0x4b54('0x2')]},'dstchannel':{'type':Sequelize[_0x4b54('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4b54('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4b54('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4b54('0x2')]},'linkedid':{'type':Sequelize[_0x4b54('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x4b54('0x2')]},'type':{'type':Sequelize[_0x4b54('0x2')]},'tag':{'type':Sequelize[_0x4b54('0x2')]}}; \ No newline at end of file +var _0xc0d6=['STRING','INTEGER','exports','1970-01-01\x2000:00:01'];(function(_0x10af40,_0x4963f6){var _0x43eae2=function(_0x52e672){while(--_0x52e672){_0x10af40['push'](_0x10af40['shift']());}};_0x43eae2(++_0x4963f6);}(_0xc0d6,0x1ce));var _0x6c0d=function(_0x4c83cc,_0x45753d){_0x4c83cc=_0x4c83cc-0x0;var _0x466bd8=_0xc0d6[_0x4c83cc];return _0x466bd8;};'use strict';var Sequelize=require('sequelize');module[_0x6c0d('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x6c0d('0x1')},'clid':{'type':Sequelize[_0x6c0d('0x2')]},'src':{'type':Sequelize[_0x6c0d('0x2')]},'dst':{'type':Sequelize[_0x6c0d('0x2')]},'dcontext':{'type':Sequelize[_0x6c0d('0x2')]},'channel':{'type':Sequelize[_0x6c0d('0x2')]},'dstchannel':{'type':Sequelize[_0x6c0d('0x2')]},'lastapp':{'type':Sequelize[_0x6c0d('0x2')]},'lastdata':{'type':Sequelize[_0x6c0d('0x2')]},'duration':{'type':Sequelize[_0x6c0d('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x6c0d('0x2')]},'userfield':{'type':Sequelize[_0x6c0d('0x2')]},'uniqueid':{'type':Sequelize[_0x6c0d('0x2')]},'linkedid':{'type':Sequelize[_0x6c0d('0x2')]},'sequence':{'type':Sequelize[_0x6c0d('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6c0d('0x2')]},'tag':{'type':Sequelize[_0x6c0d('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 65cf2d3..326b1b0 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 _0xb458=['reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','Cdr','includeAll','rows','catch','show','include','find','create','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x16c3f5,_0x26c24c){var _0x30b926=function(_0x3712e7){while(--_0x3712e7){_0x16c3f5['push'](_0x16c3f5['shift']());}};_0x30b926(++_0x26c24c);}(_0xb458,0x103));var _0x8b45=function(_0x528a67,_0x3d0bc5){_0x528a67=_0x528a67-0x0;var _0xc2deb5=_0xb458[_0x528a67];return _0xc2deb5;};'use strict';var emlformat=require(_0x8b45('0x0'));var rimraf=require(_0x8b45('0x1'));var zipdir=require(_0x8b45('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8b45('0x3'));var BPromise=require(_0x8b45('0x4'));var Mustache=require(_0x8b45('0x5'));var util=require(_0x8b45('0x6'));var path=require('path');var sox=require(_0x8b45('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b45('0x8'));var _=require(_0x8b45('0x9'));var squel=require(_0x8b45('0xa'));var crypto=require(_0x8b45('0xb'));var jsforce=require(_0x8b45('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8b45('0xd'));var querystring=require(_0x8b45('0xe'));var Papa=require(_0x8b45('0xf'));var Redis=require(_0x8b45('0x10'));var authService=require(_0x8b45('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8b45('0x12'));var hardwareService=require(_0x8b45('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8b45('0x14'));var db=require(_0x8b45('0x15'))['db'];function respondWithStatusCode(_0x37c220,_0x52c4db){_0x52c4db=_0x52c4db||0xcc;return function(_0x30d38c){if(_0x30d38c){return _0x37c220[_0x8b45('0x16')](_0x52c4db);}return _0x37c220[_0x8b45('0x17')](_0x52c4db)[_0x8b45('0x18')]();};}function respondWithResult(_0x32babc,_0x2ad2ae){_0x2ad2ae=_0x2ad2ae||0xc8;return function(_0x5f0b20){if(_0x5f0b20){return _0x32babc['status'](_0x2ad2ae)[_0x8b45('0x19')](_0x5f0b20);}};}function respondWithFilteredResult(_0x23f1dd,_0x445170){return function(_0x39c1d1){if(_0x39c1d1){var _0x4781d7=typeof _0x445170[_0x8b45('0x1a')]===_0x8b45('0x1b')&&typeof _0x445170[_0x8b45('0x1c')]===_0x8b45('0x1b');var _0x391d1e=_0x39c1d1[_0x8b45('0x1d')];var _0x21d5b2=_0x4781d7?0x0:_0x445170[_0x8b45('0x1a')];var _0x43ffb7=_0x4781d7?_0x39c1d1[_0x8b45('0x1d')]:_0x445170[_0x8b45('0x1a')]+_0x445170[_0x8b45('0x1c')];var _0x309e23;if(_0x43ffb7>=_0x391d1e){_0x43ffb7=_0x391d1e;_0x309e23=0xc8;}else{_0x309e23=0xce;}_0x23f1dd['status'](_0x309e23);return _0x23f1dd[_0x8b45('0x1e')](_0x8b45('0x1f'),_0x21d5b2+'-'+_0x43ffb7+'/'+_0x391d1e)[_0x8b45('0x19')](_0x39c1d1);}return null;};}function patchUpdates(_0x46e21a){return function(_0x3e1438){try{jsonpatch[_0x8b45('0x20')](_0x3e1438,_0x46e21a,!![]);}catch(_0x2f4f1c){return BPromise[_0x8b45('0x21')](_0x2f4f1c);}return _0x3e1438['save']();};}function saveUpdates(_0x52f93f,_0x41154a){return function(_0x580e17){if(_0x580e17){return _0x580e17[_0x8b45('0x22')](_0x52f93f)[_0x8b45('0x23')](function(_0x30f405){return _0x30f405;});}return null;};}function removeEntity(_0x45e2db,_0x165570){return function(_0x2b8526){if(_0x2b8526){return _0x2b8526[_0x8b45('0x24')]()['then'](function(){_0x45e2db['status'](0xcc)[_0x8b45('0x18')]();});}};}function handleEntityNotFound(_0x2c2c06,_0x500044){return function(_0x5723a2){if(!_0x5723a2){_0x2c2c06[_0x8b45('0x16')](0x194);}return _0x5723a2;};}function handleError(_0x32f6f0,_0x2ca2d9){_0x2ca2d9=_0x2ca2d9||0x1f4;return function(_0x2f37bc){logger['error'](_0x2f37bc[_0x8b45('0x25')]);if(_0x2f37bc[_0x8b45('0x26')]){delete _0x2f37bc[_0x8b45('0x26')];}_0x32f6f0[_0x8b45('0x17')](_0x2ca2d9)[_0x8b45('0x27')](_0x2f37bc);};}exports[_0x8b45('0x28')]=function(_0x461017,_0x234f62){var _0x1733a7={},_0xf21bd1={},_0x339c73={'count':0x0,'rows':[]};var _0x1ba2d4=_[_0x8b45('0x29')](db['Cdr'][_0x8b45('0x2a')],function(_0x36db96){return{'name':_0x36db96[_0x8b45('0x2b')],'type':_0x36db96[_0x8b45('0x2c')][_0x8b45('0x2d')]};});_0xf21bd1[_0x8b45('0x2e')]=_[_0x8b45('0x29')](_0x1ba2d4,_0x8b45('0x26'));_0xf21bd1['query']=_[_0x8b45('0x2f')](_0x461017[_0x8b45('0x30')]);_0xf21bd1[_0x8b45('0x31')]=_[_0x8b45('0x32')](_0xf21bd1[_0x8b45('0x2e')],_0xf21bd1['query']);_0x1733a7[_0x8b45('0x33')]=_['intersection'](_0xf21bd1['model'],qs[_0x8b45('0x34')](_0x461017[_0x8b45('0x30')][_0x8b45('0x34')]));_0x1733a7[_0x8b45('0x33')]=_0x1733a7[_0x8b45('0x33')][_0x8b45('0x35')]?_0x1733a7['attributes']:_0xf21bd1[_0x8b45('0x2e')];if(!_0x461017[_0x8b45('0x30')][_0x8b45('0x36')](_0x8b45('0x37'))){_0x1733a7['limit']=qs[_0x8b45('0x1c')](_0x461017[_0x8b45('0x30')][_0x8b45('0x1c')]);_0x1733a7['offset']=qs[_0x8b45('0x1a')](_0x461017[_0x8b45('0x30')][_0x8b45('0x1a')]);}_0x1733a7['order']=qs[_0x8b45('0x38')](_0x461017[_0x8b45('0x30')][_0x8b45('0x38')]);_0x1733a7[_0x8b45('0x39')]=qs['filters'](_[_0x8b45('0x3a')](_0x461017[_0x8b45('0x30')],_0xf21bd1[_0x8b45('0x31')]),_0x1ba2d4);if(_0x461017[_0x8b45('0x30')][_0x8b45('0x3b')]){_0x1733a7[_0x8b45('0x39')]=_['merge'](_0x1733a7['where'],{'$or':_[_0x8b45('0x29')](_0x1ba2d4,function(_0x179f3b){if(_0x179f3b[_0x8b45('0x2c')]!==_0x8b45('0x3c')){var _0x23eb2e={};_0x23eb2e[_0x179f3b['name']]={'$like':'%'+_0x461017[_0x8b45('0x30')]['filter']+'%'};return _0x23eb2e;}})});}_0x1733a7=_[_0x8b45('0x3d')]({},_0x1733a7,_0x461017[_0x8b45('0x3e')]);var _0x5fae26={'where':_0x1733a7[_0x8b45('0x39')]};return db[_0x8b45('0x3f')][_0x8b45('0x1d')](_0x5fae26)[_0x8b45('0x23')](function(_0x1e9d50){_0x339c73[_0x8b45('0x1d')]=_0x1e9d50;if(_0x461017[_0x8b45('0x30')][_0x8b45('0x40')]){_0x1733a7['include']=[{'all':!![]}];}return db[_0x8b45('0x3f')]['findAll'](_0x1733a7);})[_0x8b45('0x23')](function(_0x4eda71){_0x339c73[_0x8b45('0x41')]=_0x4eda71;return _0x339c73;})[_0x8b45('0x23')](respondWithFilteredResult(_0x234f62,_0x1733a7))[_0x8b45('0x42')](handleError(_0x234f62,null));};exports[_0x8b45('0x43')]=function(_0x454cbc,_0x2770bc){var _0x58e663={'raw':!![],'where':{'id':_0x454cbc['params']['id']}},_0x6fbca4={};_0x6fbca4['model']=_[_0x8b45('0x2f')](db[_0x8b45('0x3f')][_0x8b45('0x2a')]);_0x6fbca4['query']=_[_0x8b45('0x2f')](_0x454cbc['query']);_0x6fbca4[_0x8b45('0x31')]=_[_0x8b45('0x32')](_0x6fbca4[_0x8b45('0x2e')],_0x6fbca4[_0x8b45('0x30')]);_0x58e663[_0x8b45('0x33')]=_[_0x8b45('0x32')](_0x6fbca4['model'],qs[_0x8b45('0x34')](_0x454cbc[_0x8b45('0x30')][_0x8b45('0x34')]));_0x58e663[_0x8b45('0x33')]=_0x58e663[_0x8b45('0x33')][_0x8b45('0x35')]?_0x58e663[_0x8b45('0x33')]:_0x6fbca4[_0x8b45('0x2e')];if(_0x454cbc[_0x8b45('0x30')][_0x8b45('0x40')]){_0x58e663[_0x8b45('0x44')]=[{'all':!![]}];}_0x58e663=_[_0x8b45('0x3d')]({},_0x58e663,_0x454cbc[_0x8b45('0x3e')]);return db[_0x8b45('0x3f')][_0x8b45('0x45')](_0x58e663)[_0x8b45('0x23')](handleEntityNotFound(_0x2770bc,null))['then'](respondWithResult(_0x2770bc,null))['catch'](handleError(_0x2770bc,null));};exports['create']=function(_0x308b0d,_0x214e28){return db[_0x8b45('0x3f')][_0x8b45('0x46')](_0x308b0d[_0x8b45('0x47')],{})[_0x8b45('0x23')](respondWithResult(_0x214e28,0xc9))[_0x8b45('0x42')](handleError(_0x214e28,null));};exports[_0x8b45('0x22')]=function(_0x5e2a03,_0x102d01){if(_0x5e2a03['body']['id']){delete _0x5e2a03[_0x8b45('0x47')]['id'];}return db[_0x8b45('0x3f')][_0x8b45('0x45')]({'where':{'id':_0x5e2a03[_0x8b45('0x48')]['id']}})['then'](handleEntityNotFound(_0x102d01,null))[_0x8b45('0x23')](saveUpdates(_0x5e2a03[_0x8b45('0x47')],null))['then'](respondWithResult(_0x102d01,null))[_0x8b45('0x42')](handleError(_0x102d01,null));};exports[_0x8b45('0x24')]=function(_0x52970c,_0xceb596){return db[_0x8b45('0x3f')][_0x8b45('0x45')]({'where':{'id':_0x52970c[_0x8b45('0x48')]['id']}})[_0x8b45('0x23')](handleEntityNotFound(_0xceb596,null))[_0x8b45('0x23')](removeEntity(_0xceb596,null))['catch'](handleError(_0xceb596,null));};exports['describe']=function(_0x3f7a16,_0x2a2e59){return db[_0x8b45('0x3f')]['describe']()[_0x8b45('0x23')](respondWithResult(_0x2a2e59,null))[_0x8b45('0x42')](handleError(_0x2a2e59,null));}; \ No newline at end of file +var _0x3eea=['length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','intersection','find','create','body','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','Cdr','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x592f0f,_0x41ec58){_0x592f0f=_0x592f0f-0x0;var _0x22b520=_0x3eea[_0x592f0f];return _0x22b520;};'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('0x2a')](_0x3fa094,'name');_0x78e581[_0xa3ee('0x31')]=_['keys'](_0x59c6f9[_0xa3ee('0x31')]);_0x78e581[_0xa3ee('0x32')]=_['intersection'](_0x78e581[_0xa3ee('0x30')],_0x78e581['query']);_0x4abf49[_0xa3ee('0x33')]=_['intersection'](_0x78e581[_0xa3ee('0x30')],qs[_0xa3ee('0x34')](_0x59c6f9[_0xa3ee('0x31')][_0xa3ee('0x34')]));_0x4abf49[_0xa3ee('0x33')]=_0x4abf49['attributes'][_0xa3ee('0x35')]?_0x4abf49[_0xa3ee('0x33')]:_0x78e581[_0xa3ee('0x30')];if(!_0x59c6f9['query'][_0xa3ee('0x36')]('nolimit')){_0x4abf49[_0xa3ee('0x1b')]=qs['limit'](_0x59c6f9[_0xa3ee('0x31')]['limit']);_0x4abf49[_0xa3ee('0x19')]=qs[_0xa3ee('0x19')](_0x59c6f9[_0xa3ee('0x31')][_0xa3ee('0x19')]);}_0x4abf49[_0xa3ee('0x37')]=qs[_0xa3ee('0x38')](_0x59c6f9[_0xa3ee('0x31')][_0xa3ee('0x38')]);_0x4abf49[_0xa3ee('0x39')]=qs[_0xa3ee('0x32')](_[_0xa3ee('0x3a')](_0x59c6f9[_0xa3ee('0x31')],_0x78e581[_0xa3ee('0x32')]),_0x3fa094);if(_0x59c6f9['query'][_0xa3ee('0x3b')]){_0x4abf49[_0xa3ee('0x39')]=_[_0xa3ee('0x3c')](_0x4abf49[_0xa3ee('0x39')],{'$or':_['map'](_0x3fa094,function(_0x257627){if(_0x257627[_0xa3ee('0x2e')]!==_0xa3ee('0x3d')){var _0x5b95e3={};_0x5b95e3[_0x257627[_0xa3ee('0x27')]]={'$like':'%'+_0x59c6f9[_0xa3ee('0x31')]['filter']+'%'};return _0x5b95e3;}})});}_0x4abf49=_[_0xa3ee('0x3c')]({},_0x4abf49,_0x59c6f9[_0xa3ee('0x3e')]);var _0x4ef99a={'where':_0x4abf49[_0xa3ee('0x39')]};return db[_0xa3ee('0x2b')][_0xa3ee('0x1c')](_0x4ef99a)[_0xa3ee('0x23')](function(_0x1f0023){_0x481358[_0xa3ee('0x1c')]=_0x1f0023;if(_0x59c6f9[_0xa3ee('0x31')][_0xa3ee('0x3f')]){_0x4abf49[_0xa3ee('0x40')]=[{'all':!![]}];}return db[_0xa3ee('0x2b')][_0xa3ee('0x41')](_0x4abf49);})['then'](function(_0x5aa4b3){_0x481358['rows']=_0x5aa4b3;return _0x481358;})[_0xa3ee('0x23')](respondWithFilteredResult(_0x5ba571,_0x4abf49))[_0xa3ee('0x42')](handleError(_0x5ba571,null));};exports['show']=function(_0xca106f,_0x425f69){var _0x279834={'raw':!![],'where':{'id':_0xca106f[_0xa3ee('0x43')]['id']}},_0x55f47f={};_0x55f47f['model']=_[_0xa3ee('0x44')](db[_0xa3ee('0x2b')][_0xa3ee('0x2c')]);_0x55f47f[_0xa3ee('0x31')]=_[_0xa3ee('0x44')](_0xca106f[_0xa3ee('0x31')]);_0x55f47f[_0xa3ee('0x32')]=_[_0xa3ee('0x45')](_0x55f47f[_0xa3ee('0x30')],_0x55f47f[_0xa3ee('0x31')]);_0x279834[_0xa3ee('0x33')]=_[_0xa3ee('0x45')](_0x55f47f[_0xa3ee('0x30')],qs[_0xa3ee('0x34')](_0xca106f[_0xa3ee('0x31')][_0xa3ee('0x34')]));_0x279834[_0xa3ee('0x33')]=_0x279834[_0xa3ee('0x33')]['length']?_0x279834[_0xa3ee('0x33')]:_0x55f47f[_0xa3ee('0x30')];if(_0xca106f[_0xa3ee('0x31')][_0xa3ee('0x3f')]){_0x279834['include']=[{'all':!![]}];}_0x279834=_[_0xa3ee('0x3c')]({},_0x279834,_0xca106f['options']);return db[_0xa3ee('0x2b')][_0xa3ee('0x46')](_0x279834)[_0xa3ee('0x23')](handleEntityNotFound(_0x425f69,null))[_0xa3ee('0x23')](respondWithResult(_0x425f69,null))[_0xa3ee('0x42')](handleError(_0x425f69,null));};exports[_0xa3ee('0x47')]=function(_0xd723ad,_0xbb0148){return db[_0xa3ee('0x2b')][_0xa3ee('0x47')](_0xd723ad['body'],{})[_0xa3ee('0x23')](respondWithResult(_0xbb0148,0xc9))['catch'](handleError(_0xbb0148,null));};exports['update']=function(_0xaad29c,_0x2f7171){if(_0xaad29c[_0xa3ee('0x48')]['id']){delete _0xaad29c[_0xa3ee('0x48')]['id'];}return db[_0xa3ee('0x2b')][_0xa3ee('0x46')]({'where':{'id':_0xaad29c[_0xa3ee('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f7171,null))[_0xa3ee('0x23')](saveUpdates(_0xaad29c[_0xa3ee('0x48')],null))['then'](respondWithResult(_0x2f7171,null))[_0xa3ee('0x42')](handleError(_0x2f7171,null));};exports[_0xa3ee('0x24')]=function(_0x2f1db4,_0x5ec981){return db['Cdr'][_0xa3ee('0x46')]({'where':{'id':_0x2f1db4[_0xa3ee('0x43')]['id']}})[_0xa3ee('0x23')](handleEntityNotFound(_0x5ec981,null))[_0xa3ee('0x23')](removeEntity(_0x5ec981,null))[_0xa3ee('0x42')](handleError(_0x5ec981,null));};exports['describe']=function(_0x55678e,_0x15b55e){return db[_0xa3ee('0x2b')]['describe']()[_0xa3ee('0x23')](respondWithResult(_0x15b55e,null))[_0xa3ee('0x42')](handleError(_0x15b55e,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index c2fdd13..ea99b40 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(_0x5f150a,_0x501ccc){var _0x176cb7=function(_0x4b0881){while(--_0x4b0881){_0x5f150a['push'](_0x5f150a['shift']());}};_0x176cb7(++_0x501ccc);}(_0x7a54,0x106));var _0x47a5=function(_0x135701,_0x7a64cb){_0x135701=_0x135701-0x0;var _0x224490=_0x7a54[_0x135701];return _0x224490;};'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(_0x47e84f,_0x579e95){var _0x542252=function(_0x1217c9){while(--_0x1217c9){_0x47e84f['push'](_0x47e84f['shift']());}};_0x542252(++_0x579e95);}(_0x7a54,0x106));var _0x47a5=function(_0x27a848,_0x412f74){_0x27a848=_0x27a848-0x0;var _0x4e640d=_0x7a54[_0x27a848];return _0x4e640d;};'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 9c05c10..754822b 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 _0x81d5=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','Cdr,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x51ae60,_0x6dd534){var _0x3154e4=function(_0x42d4c1){while(--_0x42d4c1){_0x51ae60['push'](_0x51ae60['shift']());}};_0x3154e4(++_0x6dd534);}(_0x81d5,0x15b));var _0x581d=function(_0x397215,_0x1ee983){_0x397215=_0x397215-0x0;var _0x16e305=_0x81d5[_0x397215];return _0x16e305;};'use strict';var _=require('lodash');var util=require(_0x581d('0x0'));var moment=require(_0x581d('0x1'));var BPromise=require(_0x581d('0x2'));var rs=require(_0x581d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x581d('0x4'))['db'];var utils=require(_0x581d('0x5'));var logger=require(_0x581d('0x6'))(_0x581d('0x7'));var config=require(_0x581d('0x8'));var jayson=require(_0x581d('0x9'));var client=jayson['client'][_0x581d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99a6d3,_0x635a4,_0x563d05){return new BPromise(function(_0x179bfc,_0x252706){return client[_0x581d('0xb')](_0x99a6d3,_0x563d05)[_0x581d('0xc')](function(_0x4c583f){logger[_0x581d('0xd')]('Cdr,\x20%s,\x20%s',_0x635a4,_0x581d('0xe'));logger[_0x581d('0xf')](_0x581d('0x10'),_0x635a4,_0x581d('0xe'),JSON[_0x581d('0x11')](_0x4c583f));if(_0x4c583f[_0x581d('0x12')]){if(_0x4c583f[_0x581d('0x12')]['code']===0x1f4){logger[_0x581d('0x12')]('Cdr,\x20%s,\x20%s',_0x635a4,_0x4c583f[_0x581d('0x12')][_0x581d('0x13')]);return _0x252706(_0x4c583f[_0x581d('0x12')][_0x581d('0x13')]);}logger['error'](_0x581d('0x14'),_0x635a4,_0x4c583f['error'][_0x581d('0x13')]);return _0x179bfc(_0x4c583f['error']['message']);}else{logger[_0x581d('0xd')]('Cdr,\x20%s,\x20%s',_0x635a4,_0x581d('0xe'));_0x179bfc(_0x4c583f['result'][_0x581d('0x13')]);}})[_0x581d('0x15')](function(_0x13e0fd){logger[_0x581d('0x12')](_0x581d('0x14'),_0x635a4,_0x13e0fd);_0x252706(_0x13e0fd);});});} \ No newline at end of file +var _0x179e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1dc3a1,_0x588a78){var _0x27b58f=function(_0x48b9b0){while(--_0x48b9b0){_0x1dc3a1['push'](_0x1dc3a1['shift']());}};_0x27b58f(++_0x588a78);}(_0x179e,0xca));var _0xe179=function(_0x5d7539,_0x27c3e9){_0x5d7539=_0x5d7539-0x0;var _0x23bb29=_0x179e[_0x5d7539];return _0x23bb29;};'use strict';var _=require(_0xe179('0x0'));var util=require(_0xe179('0x1'));var moment=require(_0xe179('0x2'));var BPromise=require(_0xe179('0x3'));var rs=require(_0xe179('0x4'));var fs=require('fs');var Redis=require(_0xe179('0x5'));var db=require(_0xe179('0x6'))['db'];var utils=require(_0xe179('0x7'));var logger=require(_0xe179('0x8'))(_0xe179('0x9'));var config=require('../../config/environment');var jayson=require(_0xe179('0xa'));var client=jayson[_0xe179('0xb')][_0xe179('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4905e8,_0x16707e,_0x467d98){return new BPromise(function(_0x3a2108,_0xa6b05a){return client[_0xe179('0xd')](_0x4905e8,_0x467d98)['then'](function(_0x3e1d9b){logger[_0xe179('0xe')](_0xe179('0xf'),_0x16707e,_0xe179('0x10'));logger[_0xe179('0x11')]('Cdr,\x20%s,\x20%s,\x20%s',_0x16707e,_0xe179('0x10'),JSON[_0xe179('0x12')](_0x3e1d9b));if(_0x3e1d9b[_0xe179('0x13')]){if(_0x3e1d9b['error'][_0xe179('0x14')]===0x1f4){logger[_0xe179('0x13')](_0xe179('0xf'),_0x16707e,_0x3e1d9b['error'][_0xe179('0x15')]);return _0xa6b05a(_0x3e1d9b[_0xe179('0x13')][_0xe179('0x15')]);}logger[_0xe179('0x13')](_0xe179('0xf'),_0x16707e,_0x3e1d9b['error'][_0xe179('0x15')]);return _0x3a2108(_0x3e1d9b[_0xe179('0x13')][_0xe179('0x15')]);}else{logger[_0xe179('0xe')](_0xe179('0xf'),_0x16707e,_0xe179('0x10'));_0x3a2108(_0x3e1d9b['result'][_0xe179('0x15')]);}})[_0xe179('0x16')](function(_0x23c745){logger['error'](_0xe179('0xf'),_0x16707e,_0x23c745);_0xa6b05a(_0x23c745);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index d435e5f..09dae2f 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x233ac3,_0x195d3d){var _0x2dac9f=function(_0x2aadfa){while(--_0x2aadfa){_0x233ac3['push'](_0x233ac3['shift']());}};_0x2dac9f(++_0x195d3d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 2ca1261..7ae9600 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 _0x11ad=['exports','noop','TEXT','STRING','sequelize'];(function(_0x20181d,_0x4967f4){var _0x1fc5a2=function(_0x3e69dc){while(--_0x3e69dc){_0x20181d['push'](_0x20181d['shift']());}};_0x1fc5a2(++_0x4967f4);}(_0x11ad,0x13a));var _0xd11a=function(_0x171bd1,_0x295561){_0x171bd1=_0x171bd1-0x0;var _0x25bf60=_0x11ad[_0x171bd1];return _0x25bf60;};'use strict';var Sequelize=require(_0xd11a('0x0'));module[_0xd11a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd11a('0x2')},'appdata':{'type':Sequelize[_0xd11a('0x3')]()},'description':{'type':Sequelize[_0xd11a('0x4')]},'interval':{'type':Sequelize[_0xd11a('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xfee2=['INTEGER','STRING','TEXT'];(function(_0x147c96,_0x309657){var _0x4ec711=function(_0x3cf7c9){while(--_0x3cf7c9){_0x147c96['push'](_0x147c96['shift']());}};_0x4ec711(++_0x309657);}(_0xfee2,0x1ec));var _0x2fee=function(_0x132836,_0x2bcae1){_0x132836=_0x132836-0x0;var _0x314e44=_0xfee2[_0x132836];return _0x314e44;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x2fee('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x2fee('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2fee('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index c6244e0..7c8dbe7 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 _0x153f=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x2d5987,_0x2de9cd){var _0x15b7c5=function(_0x27c0d0){while(--_0x27c0d0){_0x2d5987['push'](_0x2d5987['shift']());}};_0x15b7c5(++_0x2de9cd);}(_0x153f,0x15b));var _0xf153=function(_0x3fd25c,_0x546595){_0x3fd25c=_0x3fd25c-0x0;var _0x1b2a83=_0x153f[_0x3fd25c];return _0x1b2a83;};'use strict';var emlformat=require(_0xf153('0x0'));var rimraf=require(_0xf153('0x1'));var zipdir=require(_0xf153('0x2'));var jsonpatch=require(_0xf153('0x3'));var rp=require(_0xf153('0x4'));var moment=require(_0xf153('0x5'));var BPromise=require(_0xf153('0x6'));var Mustache=require('mustache');var util=require(_0xf153('0x7'));var path=require('path');var sox=require(_0xf153('0x8'));var csv=require(_0xf153('0x9'));var ejs=require(_0xf153('0xa'));var fs=require('fs');var fs_extra=require(_0xf153('0xb'));var _=require(_0xf153('0xc'));var squel=require('squel');var crypto=require(_0xf153('0xd'));var jsforce=require(_0xf153('0xe'));var deskjs=require(_0xf153('0xf'));var toCsv=require(_0xf153('0x9'));var querystring=require(_0xf153('0x10'));var Papa=require(_0xf153('0x11'));var Redis=require(_0xf153('0x12'));var authService=require(_0xf153('0x13'));var qs=require(_0xf153('0x14'));var as=require(_0xf153('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf153('0x16'))(_0xf153('0x17'));var utils=require(_0xf153('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf153('0x19'));var db=require(_0xf153('0x1a'))['db'];function respondWithStatusCode(_0x65756d,_0x1cc666){_0x1cc666=_0x1cc666||0xcc;return function(_0x256b7d){if(_0x256b7d){return _0x65756d[_0xf153('0x1b')](_0x1cc666);}return _0x65756d[_0xf153('0x1c')](_0x1cc666)[_0xf153('0x1d')]();};}function respondWithResult(_0x3e34fb,_0x4c5283){_0x4c5283=_0x4c5283||0xc8;return function(_0x18be7e){if(_0x18be7e){return _0x3e34fb[_0xf153('0x1c')](_0x4c5283)[_0xf153('0x1e')](_0x18be7e);}};}function respondWithFilteredResult(_0x406e6f,_0x3afea2){return function(_0x68f436){if(_0x68f436){var _0x273a90=typeof _0x3afea2[_0xf153('0x1f')]==='undefined'&&typeof _0x3afea2[_0xf153('0x20')]==='undefined';var _0x37093a=_0x68f436[_0xf153('0x21')];var _0x138dbe=_0x273a90?0x0:_0x3afea2[_0xf153('0x1f')];var _0x4e790d=_0x273a90?_0x68f436[_0xf153('0x21')]:_0x3afea2[_0xf153('0x1f')]+_0x3afea2[_0xf153('0x20')];var _0x14b83f;if(_0x4e790d>=_0x37093a){_0x4e790d=_0x37093a;_0x14b83f=0xc8;}else{_0x14b83f=0xce;}_0x406e6f[_0xf153('0x1c')](_0x14b83f);return _0x406e6f[_0xf153('0x22')](_0xf153('0x23'),_0x138dbe+'-'+_0x4e790d+'/'+_0x37093a)[_0xf153('0x1e')](_0x68f436);}return null;};}function patchUpdates(_0x3735a7){return function(_0x1dd340){try{jsonpatch[_0xf153('0x24')](_0x1dd340,_0x3735a7,!![]);}catch(_0x3665a2){return BPromise['reject'](_0x3665a2);}return _0x1dd340[_0xf153('0x25')]();};}function saveUpdates(_0x395f28,_0x3d3e41){return function(_0x32e759){if(_0x32e759){return _0x32e759[_0xf153('0x26')](_0x395f28)[_0xf153('0x27')](function(_0x465d88){return _0x465d88;});}return null;};}function removeEntity(_0x4376f7,_0xf67cde){return function(_0x38190c){if(_0x38190c){return _0x38190c[_0xf153('0x28')]()[_0xf153('0x27')](function(){_0x4376f7[_0xf153('0x1c')](0xcc)[_0xf153('0x1d')]();});}};}function handleEntityNotFound(_0xe490f8,_0x35f9da){return function(_0x141ef4){if(!_0x141ef4){_0xe490f8[_0xf153('0x1b')](0x194);}return _0x141ef4;};}function handleError(_0x23acc3,_0x17f7a4){_0x17f7a4=_0x17f7a4||0x1f4;return function(_0x48ebdc){logger[_0xf153('0x29')](_0x48ebdc[_0xf153('0x2a')]);if(_0x48ebdc['name']){delete _0x48ebdc[_0xf153('0x2b')];}_0x23acc3[_0xf153('0x1c')](_0x17f7a4)['send'](_0x48ebdc);};}exports[_0xf153('0x2c')]=function(_0x10295e,_0x261ac0){var _0x2b9a9c={'raw':!![],'where':{'id':_0x10295e[_0xf153('0x2d')]['id']}},_0x339e96={};_0x339e96[_0xf153('0x2e')]=_[_0xf153('0x2f')](db[_0xf153('0x30')][_0xf153('0x31')]);_0x339e96[_0xf153('0x32')]=_[_0xf153('0x2f')](_0x10295e['query']);_0x339e96[_0xf153('0x33')]=_[_0xf153('0x34')](_0x339e96[_0xf153('0x2e')],_0x339e96[_0xf153('0x32')]);_0x2b9a9c['attributes']=_['intersection'](_0x339e96[_0xf153('0x2e')],qs['fields'](_0x10295e['query'][_0xf153('0x35')]));_0x2b9a9c['attributes']=_0x2b9a9c[_0xf153('0x36')]['length']?_0x2b9a9c[_0xf153('0x36')]:_0x339e96[_0xf153('0x2e')];if(_0x10295e['query'][_0xf153('0x37')]){_0x2b9a9c[_0xf153('0x38')]=[{'all':!![]}];}_0x2b9a9c=_[_0xf153('0x39')]({},_0x2b9a9c,_0x10295e[_0xf153('0x3a')]);return db[_0xf153('0x30')][_0xf153('0x3b')](_0x2b9a9c)['then'](handleEntityNotFound(_0x261ac0,null))[_0xf153('0x27')](respondWithResult(_0x261ac0,null))['catch'](handleError(_0x261ac0,null));};exports[_0xf153('0x26')]=function(_0x2523c0,_0x9b3f4c){if(_0x2523c0[_0xf153('0x3c')]['id']){delete _0x2523c0[_0xf153('0x3c')]['id'];}return db[_0xf153('0x30')]['find']({'where':{'id':_0x2523c0[_0xf153('0x2d')]['id']}})[_0xf153('0x27')](handleEntityNotFound(_0x9b3f4c,null))[_0xf153('0x27')](saveUpdates(_0x2523c0['body'],null))[_0xf153('0x27')](respondWithResult(_0x9b3f4c,null))[_0xf153('0x3d')](handleError(_0x9b3f4c,null));};exports[_0xf153('0x28')]=function(_0x254692,_0x36c5cd){return db[_0xf153('0x30')]['find']({'where':{'id':_0x254692[_0xf153('0x2d')]['id']}})[_0xf153('0x27')](handleEntityNotFound(_0x36c5cd,null))['then'](removeEntity(_0x36c5cd,null))[_0xf153('0x3d')](handleError(_0x36c5cd,null));}; \ No newline at end of file +var _0xf2fa=['api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','show','params','model','ChatApplication','rawAttributes','keys','query','filters','intersection','attributes','fields','length','merge','options','catch','body','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xf2fa,0xd0));var _0xaf2f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf2fa[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaf2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaf2f('0x1'));var rp=require(_0xaf2f('0x2'));var moment=require(_0xaf2f('0x3'));var BPromise=require(_0xaf2f('0x4'));var Mustache=require(_0xaf2f('0x5'));var util=require(_0xaf2f('0x6'));var path=require(_0xaf2f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf2f('0x9'));var squel=require(_0xaf2f('0xa'));var crypto=require(_0xaf2f('0xb'));var jsforce=require(_0xaf2f('0xc'));var deskjs=require(_0xaf2f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaf2f('0xe'));var authService=require(_0xaf2f('0xf'));var qs=require(_0xaf2f('0x10'));var as=require(_0xaf2f('0x11'));var hardwareService=require(_0xaf2f('0x12'));var logger=require(_0xaf2f('0x13'))(_0xaf2f('0x14'));var utils=require(_0xaf2f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xaf2f('0x16'));var db=require(_0xaf2f('0x17'))['db'];function respondWithStatusCode(_0x3dea79,_0x578499){_0x578499=_0x578499||0xcc;return function(_0x57cdb0){if(_0x57cdb0){return _0x3dea79['sendStatus'](_0x578499);}return _0x3dea79[_0xaf2f('0x18')](_0x578499)[_0xaf2f('0x19')]();};}function respondWithResult(_0x580fa6,_0x305755){_0x305755=_0x305755||0xc8;return function(_0x131862){if(_0x131862){return _0x580fa6['status'](_0x305755)[_0xaf2f('0x1a')](_0x131862);}};}function respondWithFilteredResult(_0x4db0fc,_0x402485){return function(_0x30905b){if(_0x30905b){var _0x3d475a=typeof _0x402485[_0xaf2f('0x1b')]===_0xaf2f('0x1c')&&typeof _0x402485[_0xaf2f('0x1d')]===_0xaf2f('0x1c');var _0x2a5d4a=_0x30905b[_0xaf2f('0x1e')];var _0x244435=_0x3d475a?0x0:_0x402485['offset'];var _0x1a2d28=_0x3d475a?_0x30905b[_0xaf2f('0x1e')]:_0x402485['offset']+_0x402485['limit'];var _0xb64c0e;if(_0x1a2d28>=_0x2a5d4a){_0x1a2d28=_0x2a5d4a;_0xb64c0e=0xc8;}else{_0xb64c0e=0xce;}_0x4db0fc[_0xaf2f('0x18')](_0xb64c0e);return _0x4db0fc['set'](_0xaf2f('0x1f'),_0x244435+'-'+_0x1a2d28+'/'+_0x2a5d4a)['json'](_0x30905b);}return null;};}function patchUpdates(_0x2dbd9b){return function(_0x5a6c9d){try{jsonpatch[_0xaf2f('0x20')](_0x5a6c9d,_0x2dbd9b,!![]);}catch(_0xccf664){return BPromise['reject'](_0xccf664);}return _0x5a6c9d[_0xaf2f('0x21')]();};}function saveUpdates(_0x42b7ae,_0x359dc2){return function(_0x19da71){if(_0x19da71){return _0x19da71[_0xaf2f('0x22')](_0x42b7ae)[_0xaf2f('0x23')](function(_0x2fe731){return _0x2fe731;});}return null;};}function removeEntity(_0x1da2bb,_0x4f5018){return function(_0x5f199d){if(_0x5f199d){return _0x5f199d[_0xaf2f('0x24')]()[_0xaf2f('0x23')](function(){_0x1da2bb[_0xaf2f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f7440,_0x38ecee){return function(_0x29fc22){if(!_0x29fc22){_0x1f7440[_0xaf2f('0x25')](0x194);}return _0x29fc22;};}function handleError(_0x2f2068,_0x324876){_0x324876=_0x324876||0x1f4;return function(_0x593e4d){logger['error'](_0x593e4d['stack']);if(_0x593e4d[_0xaf2f('0x26')]){delete _0x593e4d['name'];}_0x2f2068['status'](_0x324876)[_0xaf2f('0x27')](_0x593e4d);};}exports[_0xaf2f('0x28')]=function(_0x16eb77,_0x21bf39){var _0x2374dd={'raw':!![],'where':{'id':_0x16eb77[_0xaf2f('0x29')]['id']}},_0x5a752a={};_0x5a752a[_0xaf2f('0x2a')]=_['keys'](db[_0xaf2f('0x2b')][_0xaf2f('0x2c')]);_0x5a752a['query']=_[_0xaf2f('0x2d')](_0x16eb77[_0xaf2f('0x2e')]);_0x5a752a[_0xaf2f('0x2f')]=_[_0xaf2f('0x30')](_0x5a752a['model'],_0x5a752a[_0xaf2f('0x2e')]);_0x2374dd[_0xaf2f('0x31')]=_['intersection'](_0x5a752a['model'],qs[_0xaf2f('0x32')](_0x16eb77['query'][_0xaf2f('0x32')]));_0x2374dd[_0xaf2f('0x31')]=_0x2374dd[_0xaf2f('0x31')][_0xaf2f('0x33')]?_0x2374dd[_0xaf2f('0x31')]:_0x5a752a['model'];if(_0x16eb77[_0xaf2f('0x2e')]['includeAll']){_0x2374dd['include']=[{'all':!![]}];}_0x2374dd=_[_0xaf2f('0x34')]({},_0x2374dd,_0x16eb77[_0xaf2f('0x35')]);return db['ChatApplication']['find'](_0x2374dd)[_0xaf2f('0x23')](handleEntityNotFound(_0x21bf39,null))[_0xaf2f('0x23')](respondWithResult(_0x21bf39,null))[_0xaf2f('0x36')](handleError(_0x21bf39,null));};exports[_0xaf2f('0x22')]=function(_0x4c30e8,_0x552c6e){if(_0x4c30e8[_0xaf2f('0x37')]['id']){delete _0x4c30e8['body']['id'];}return db[_0xaf2f('0x2b')][_0xaf2f('0x38')]({'where':{'id':_0x4c30e8[_0xaf2f('0x29')]['id']}})[_0xaf2f('0x23')](handleEntityNotFound(_0x552c6e,null))[_0xaf2f('0x23')](saveUpdates(_0x4c30e8[_0xaf2f('0x37')],null))[_0xaf2f('0x23')](respondWithResult(_0x552c6e,null))[_0xaf2f('0x36')](handleError(_0x552c6e,null));};exports['destroy']=function(_0x5db64e,_0x3e3ca6){return db['ChatApplication'][_0xaf2f('0x38')]({'where':{'id':_0x5db64e['params']['id']}})[_0xaf2f('0x23')](handleEntityNotFound(_0x3e3ca6,null))[_0xaf2f('0x23')](removeEntity(_0x3e3ca6,null))['catch'](handleError(_0x3e3ca6,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 6c48115..f7f2386 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 _0xa947=['util','../../config/logger','api','moment','bluebird','request-promise','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x482032,_0x453897){var _0x51e174=function(_0x47bc54){while(--_0x47bc54){_0x482032['push'](_0x482032['shift']());}};_0x51e174(++_0x453897);}(_0xa947,0x11d));var _0x7a94=function(_0x31f4d4,_0x543cd2){_0x31f4d4=_0x31f4d4-0x0;var _0x1b9025=_0xa947[_0x31f4d4];return _0x1b9025;};'use strict';var _=require(_0x7a94('0x0'));var util=require(_0x7a94('0x1'));var logger=require(_0x7a94('0x2'))(_0x7a94('0x3'));var moment=require(_0x7a94('0x4'));var BPromise=require(_0x7a94('0x5'));var rp=require(_0x7a94('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7a94('0x7'));module['exports']=function(_0x2ea02c,_0x281dc9){return _0x2ea02c[_0x7a94('0x8')](_0x7a94('0x9'),attributes,{'tableName':_0x7a94('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7a94('0xb'),'collate':_0x7a94('0xc')});}; \ No newline at end of file +var _0xf626=['../../config/environment','./chatApplication.attributes','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path'];(function(_0x43f7f8,_0x179534){var _0x3687a3=function(_0x23982f){while(--_0x23982f){_0x43f7f8['push'](_0x43f7f8['shift']());}};_0x3687a3(++_0x179534);}(_0xf626,0x17a));var _0x6f62=function(_0x5a48fd,_0xefc08e){_0x5a48fd=_0x5a48fd-0x0;var _0x5c005d=_0xf626[_0x5a48fd];return _0x5c005d;};'use strict';var _=require(_0x6f62('0x0'));var util=require(_0x6f62('0x1'));var logger=require('../../config/logger')(_0x6f62('0x2'));var moment=require(_0x6f62('0x3'));var BPromise=require('bluebird');var rp=require(_0x6f62('0x4'));var fs=require('fs');var path=require(_0x6f62('0x5'));var rimraf=require('rimraf');var config=require(_0x6f62('0x6'));var attributes=require(_0x6f62('0x7'));module['exports']=function(_0x1b44d8,_0x38d82b){return _0x1b44d8[_0x6f62('0x8')](_0x6f62('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6f62('0xa'),'collate':_0x6f62('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index a2f31f5..ffcb2e2 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 _0x61ed=['result','catch','moment','ioredis','../../config/utils','../../config/logger','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x77be21,_0xe7cf26){var _0x27e5d3=function(_0x5df819){while(--_0x5df819){_0x77be21['push'](_0x77be21['shift']());}};_0x27e5d3(++_0xe7cf26);}(_0x61ed,0x1ef));var _0xd61e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x61ed[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd61e('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd61e('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xd61e('0x2'));var logger=require(_0xd61e('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd61e('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x58cb29,_0x553962,_0x32c38f){return new BPromise(function(_0x51e8ad,_0x46df99){return client[_0xd61e('0x5')](_0x58cb29,_0x32c38f)[_0xd61e('0x6')](function(_0x26e725){logger[_0xd61e('0x7')](_0xd61e('0x8'),_0x553962,_0xd61e('0x9'));logger[_0xd61e('0xa')](_0xd61e('0xb'),_0x553962,_0xd61e('0x9'),JSON[_0xd61e('0xc')](_0x26e725));if(_0x26e725[_0xd61e('0xd')]){if(_0x26e725[_0xd61e('0xd')]['code']===0x1f4){logger[_0xd61e('0xd')](_0xd61e('0x8'),_0x553962,_0x26e725[_0xd61e('0xd')][_0xd61e('0xe')]);return _0x46df99(_0x26e725['error']['message']);}logger['error'](_0xd61e('0x8'),_0x553962,_0x26e725[_0xd61e('0xd')]['message']);return _0x51e8ad(_0x26e725[_0xd61e('0xd')][_0xd61e('0xe')]);}else{logger['info'](_0xd61e('0x8'),_0x553962,_0xd61e('0x9'));_0x51e8ad(_0x26e725[_0xd61e('0xf')][_0xd61e('0xe')]);}})[_0xd61e('0x10')](function(_0x189de1){logger[_0xd61e('0xd')](_0xd61e('0x8'),_0x553962,_0x189de1);_0x46df99(_0x189de1);});});} \ No newline at end of file +var _0x8b98=['catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x5681e6,_0xfc2aa1){var _0x38f9b4=function(_0x3f6129){while(--_0x3f6129){_0x5681e6['push'](_0x5681e6['shift']());}};_0x38f9b4(++_0xfc2aa1);}(_0x8b98,0x12d));var _0x88b9=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x8b98[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x88b9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x88b9('0x1'));var rs=require(_0x88b9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x88b9('0x3'));var logger=require(_0x88b9('0x4'))(_0x88b9('0x5'));var config=require('../../config/environment');var jayson=require(_0x88b9('0x6'));var client=jayson[_0x88b9('0x7')][_0x88b9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x251300,_0x150521,_0x2f2f05){return new BPromise(function(_0x494bc0,_0x5f3ada){return client[_0x88b9('0x9')](_0x251300,_0x2f2f05)[_0x88b9('0xa')](function(_0x277547){logger[_0x88b9('0xb')](_0x88b9('0xc'),_0x150521,'request\x20sent');logger[_0x88b9('0xd')](_0x88b9('0xe'),_0x150521,_0x88b9('0xf'),JSON['stringify'](_0x277547));if(_0x277547[_0x88b9('0x10')]){if(_0x277547[_0x88b9('0x10')][_0x88b9('0x11')]===0x1f4){logger[_0x88b9('0x10')](_0x88b9('0xc'),_0x150521,_0x277547['error'][_0x88b9('0x12')]);return _0x5f3ada(_0x277547[_0x88b9('0x10')][_0x88b9('0x12')]);}logger[_0x88b9('0x10')]('ChatApplication,\x20%s,\x20%s',_0x150521,_0x277547[_0x88b9('0x10')]['message']);return _0x494bc0(_0x277547[_0x88b9('0x10')][_0x88b9('0x12')]);}else{logger[_0x88b9('0xb')](_0x88b9('0xc'),_0x150521,_0x88b9('0xf'));_0x494bc0(_0x277547['result'][_0x88b9('0x12')]);}})[_0x88b9('0x13')](function(_0x2fdfab){logger[_0x88b9('0x10')](_0x88b9('0xc'),_0x150521,_0x2fdfab);_0x5f3ada(_0x2fdfab);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 4cf364e..3975828 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 _0x825f=['path','connect-timeout','express','../../components/auth/service','./chatApplication.controller','/:id','isAuthenticated','put','update','delete','destroy','exports','util'];(function(_0x4dcdc4,_0x4c7b7f){var _0x3af19c=function(_0x5951ef){while(--_0x5951ef){_0x4dcdc4['push'](_0x4dcdc4['shift']());}};_0x3af19c(++_0x4c7b7f);}(_0x825f,0xc2));var _0xf825=function(_0x265fca,_0x245fdf){_0x265fca=_0x265fca-0x0;var _0x43428a=_0x825f[_0x265fca];return _0x43428a;};'use strict';var multer=require('multer');var util=require(_0xf825('0x0'));var path=require(_0xf825('0x1'));var timeout=require(_0xf825('0x2'));var express=require(_0xf825('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf825('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf825('0x5'));router['get'](_0xf825('0x6'),auth[_0xf825('0x7')](),controller['show']);router[_0xf825('0x8')](_0xf825('0x6'),auth['isAuthenticated'](),controller[_0xf825('0x9')]);router[_0xf825('0xa')](_0xf825('0x6'),auth[_0xf825('0x7')](),controller[_0xf825('0xb')]);module[_0xf825('0xc')]=router; \ No newline at end of file +var _0x67d5=['update','destroy','exports','multer','util','express','Router','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','put'];(function(_0xa26b00,_0x1a2bca){var _0x2a496b=function(_0x86c2b8){while(--_0x86c2b8){_0xa26b00['push'](_0xa26b00['shift']());}};_0x2a496b(++_0x1a2bca);}(_0x67d5,0x189));var _0x567d=function(_0x9f30ce,_0x540faf){_0x9f30ce=_0x9f30ce-0x0;var _0x3f826f=_0x67d5[_0x9f30ce];return _0x3f826f;};'use strict';var multer=require(_0x567d('0x0'));var util=require(_0x567d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x567d('0x2'));var router=express[_0x567d('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x567d('0x4'));var controller=require(_0x567d('0x5'));router[_0x567d('0x6')](_0x567d('0x7'),auth[_0x567d('0x8')](),controller['show']);router[_0x567d('0x9')](_0x567d('0x7'),auth[_0x567d('0x8')](),controller[_0x567d('0xa')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x567d('0xb')]);module[_0x567d('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 851f06c..804cc3e 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 _0x9627=['sequelize','STRING','BOOLEAN'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0x9627,0x8a));var _0x7962=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x9627[_0x1203f];return _0x365f0a;};'use strict';var Sequelize=require(_0x7962('0x0'));module['exports']={'name':{'type':Sequelize[_0x7962('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7962('0x1')]},'write':{'type':Sequelize[_0x7962('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4ccb=['STRING','BOOLEAN','sequelize','exports'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0x4ccb,0x196));var _0xb4cc=function(_0x2122b7,_0x12b8e5){_0x2122b7=_0x2122b7-0x0;var _0x1a4922=_0x4ccb[_0x2122b7];return _0x1a4922;};'use strict';var Sequelize=require(_0xb4cc('0x0'));module[_0xb4cc('0x1')]={'name':{'type':Sequelize[_0xb4cc('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xb4cc('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 fe6332a..3683d73 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 _0x3fd4=['undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','ChatGroup','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','User','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','offset','limit'];(function(_0x45e975,_0x31aac7){var _0x18b5eb=function(_0x4ec993){while(--_0x4ec993){_0x45e975['push'](_0x45e975['shift']());}};_0x18b5eb(++_0x31aac7);}(_0x3fd4,0x1d5));var _0x43fd=function(_0x1ed05b,_0x2da36d){_0x1ed05b=_0x1ed05b-0x0;var _0x2668be=_0x3fd4[_0x1ed05b];return _0x2668be;};'use strict';var emlformat=require(_0x43fd('0x0'));var rimraf=require(_0x43fd('0x1'));var zipdir=require(_0x43fd('0x2'));var jsonpatch=require(_0x43fd('0x3'));var rp=require(_0x43fd('0x4'));var moment=require(_0x43fd('0x5'));var BPromise=require(_0x43fd('0x6'));var Mustache=require(_0x43fd('0x7'));var util=require('util');var path=require(_0x43fd('0x8'));var sox=require(_0x43fd('0x9'));var csv=require(_0x43fd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43fd('0xb'));var _=require(_0x43fd('0xc'));var squel=require(_0x43fd('0xd'));var crypto=require('crypto');var jsforce=require(_0x43fd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x43fd('0xa'));var querystring=require(_0x43fd('0xf'));var Papa=require(_0x43fd('0x10'));var Redis=require(_0x43fd('0x11'));var authService=require(_0x43fd('0x12'));var qs=require(_0x43fd('0x13'));var as=require(_0x43fd('0x14'));var hardwareService=require(_0x43fd('0x15'));var logger=require(_0x43fd('0x16'))(_0x43fd('0x17'));var utils=require(_0x43fd('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x43fd('0x19'))['db'];config[_0x43fd('0x1a')]=_['defaults'](config[_0x43fd('0x1a')],{'host':_0x43fd('0x1b'),'port':0x18eb});var socket=require(_0x43fd('0x1c'))(new Redis(config['redis']));require(_0x43fd('0x1d'))[_0x43fd('0x1e')](socket);function respondWithStatusCode(_0x593aa5,_0x5026cc){_0x5026cc=_0x5026cc||0xcc;return function(_0x103ecf){if(_0x103ecf){return _0x593aa5[_0x43fd('0x1f')](_0x5026cc);}return _0x593aa5[_0x43fd('0x20')](_0x5026cc)[_0x43fd('0x21')]();};}function respondWithResult(_0x2edc09,_0x15173b){_0x15173b=_0x15173b||0xc8;return function(_0x5cda1c){if(_0x5cda1c){return _0x2edc09['status'](_0x15173b)['json'](_0x5cda1c);}};}function respondWithFilteredResult(_0xd19956,_0x22de98){return function(_0x1ed1d0){if(_0x1ed1d0){var _0x1f2536=typeof _0x22de98[_0x43fd('0x22')]==='undefined'&&typeof _0x22de98[_0x43fd('0x23')]===_0x43fd('0x24');var _0x25a23e=_0x1ed1d0[_0x43fd('0x25')];var _0x5a5feb=_0x1f2536?0x0:_0x22de98[_0x43fd('0x22')];var _0x592cad=_0x1f2536?_0x1ed1d0[_0x43fd('0x25')]:_0x22de98[_0x43fd('0x22')]+_0x22de98[_0x43fd('0x23')];var _0x39d898;if(_0x592cad>=_0x25a23e){_0x592cad=_0x25a23e;_0x39d898=0xc8;}else{_0x39d898=0xce;}_0xd19956[_0x43fd('0x20')](_0x39d898);return _0xd19956[_0x43fd('0x26')](_0x43fd('0x27'),_0x5a5feb+'-'+_0x592cad+'/'+_0x25a23e)[_0x43fd('0x28')](_0x1ed1d0);}return null;};}function patchUpdates(_0x1cfdbf){return function(_0x1ffe1e){try{jsonpatch[_0x43fd('0x29')](_0x1ffe1e,_0x1cfdbf,!![]);}catch(_0x22de5d){return BPromise[_0x43fd('0x2a')](_0x22de5d);}return _0x1ffe1e[_0x43fd('0x2b')]();};}function saveUpdates(_0x2b8592,_0x411783){return function(_0x340a06){if(_0x340a06){return _0x340a06[_0x43fd('0x2c')](_0x2b8592)[_0x43fd('0x2d')](function(_0x57e02e){return _0x57e02e;});}return null;};}function removeEntity(_0x58a1e3,_0xae3952){return function(_0x1964f8){if(_0x1964f8){return _0x1964f8['destroy']()[_0x43fd('0x2d')](function(){_0x58a1e3[_0x43fd('0x20')](0xcc)[_0x43fd('0x21')]();});}};}function handleEntityNotFound(_0xdc2b1d,_0x5438e6){return function(_0x4aea0a){if(!_0x4aea0a){_0xdc2b1d[_0x43fd('0x1f')](0x194);}return _0x4aea0a;};}function handleError(_0x620a1d,_0x24e679){_0x24e679=_0x24e679||0x1f4;return function(_0x4f02b3){logger[_0x43fd('0x2e')](_0x4f02b3[_0x43fd('0x2f')]);if(_0x4f02b3[_0x43fd('0x30')]){delete _0x4f02b3['name'];}_0x620a1d[_0x43fd('0x20')](_0x24e679)[_0x43fd('0x31')](_0x4f02b3);};}exports[_0x43fd('0x32')]=function(_0x4919a4,_0x47f9cb){var _0x471da9={},_0x381f8d={},_0x42ab15={'count':0x0,'rows':[]};var _0x7efa7d=_[_0x43fd('0x33')](db[_0x43fd('0x34')]['rawAttributes'],function(_0x280b2f){return{'name':_0x280b2f[_0x43fd('0x35')],'type':_0x280b2f[_0x43fd('0x36')][_0x43fd('0x37')]};});_0x381f8d[_0x43fd('0x38')]=_['map'](_0x7efa7d,'name');_0x381f8d['query']=_[_0x43fd('0x39')](_0x4919a4['query']);_0x381f8d['filters']=_[_0x43fd('0x3a')](_0x381f8d['model'],_0x381f8d[_0x43fd('0x3b')]);_0x471da9[_0x43fd('0x3c')]=_[_0x43fd('0x3a')](_0x381f8d[_0x43fd('0x38')],qs['fields'](_0x4919a4['query'][_0x43fd('0x3d')]));_0x471da9[_0x43fd('0x3c')]=_0x471da9[_0x43fd('0x3c')][_0x43fd('0x3e')]?_0x471da9[_0x43fd('0x3c')]:_0x381f8d[_0x43fd('0x38')];if(!_0x4919a4[_0x43fd('0x3b')][_0x43fd('0x3f')](_0x43fd('0x40'))){_0x471da9[_0x43fd('0x23')]=qs['limit'](_0x4919a4[_0x43fd('0x3b')][_0x43fd('0x23')]);_0x471da9[_0x43fd('0x22')]=qs['offset'](_0x4919a4[_0x43fd('0x3b')][_0x43fd('0x22')]);}_0x471da9[_0x43fd('0x41')]=qs[_0x43fd('0x42')](_0x4919a4['query'][_0x43fd('0x42')]);_0x471da9[_0x43fd('0x43')]=qs['filters'](_[_0x43fd('0x44')](_0x4919a4[_0x43fd('0x3b')],_0x381f8d[_0x43fd('0x45')]),_0x7efa7d);if(_0x4919a4['query'][_0x43fd('0x46')]){_0x471da9[_0x43fd('0x43')]=_['merge'](_0x471da9['where'],{'$or':_[_0x43fd('0x33')](_0x7efa7d,function(_0x28d384){if(_0x28d384[_0x43fd('0x36')]!==_0x43fd('0x47')){var _0x1898ee={};_0x1898ee[_0x28d384[_0x43fd('0x30')]]={'$like':'%'+_0x4919a4[_0x43fd('0x3b')][_0x43fd('0x46')]+'%'};return _0x1898ee;}})});}_0x471da9=_[_0x43fd('0x48')]({},_0x471da9,_0x4919a4[_0x43fd('0x49')]);var _0x15be26={'where':_0x471da9[_0x43fd('0x43')]};return db[_0x43fd('0x34')][_0x43fd('0x25')](_0x15be26)[_0x43fd('0x2d')](function(_0x4174e2){_0x42ab15[_0x43fd('0x25')]=_0x4174e2;if(_0x4919a4[_0x43fd('0x3b')][_0x43fd('0x4a')]){_0x471da9[_0x43fd('0x4b')]=[{'all':!![]}];}return db['ChatGroup'][_0x43fd('0x4c')](_0x471da9);})['then'](function(_0x19e91a){_0x42ab15[_0x43fd('0x4d')]=_0x19e91a;return _0x42ab15;})[_0x43fd('0x2d')](respondWithFilteredResult(_0x47f9cb,_0x471da9))[_0x43fd('0x4e')](handleError(_0x47f9cb,null));};exports[_0x43fd('0x4f')]=function(_0x2e2840,_0xa3e756){var _0x2d0320={'raw':!![],'where':{'id':_0x2e2840[_0x43fd('0x50')]['id']}},_0x3ad0f7={};_0x3ad0f7['model']=_['keys'](db['ChatGroup'][_0x43fd('0x51')]);_0x3ad0f7[_0x43fd('0x3b')]=_['keys'](_0x2e2840[_0x43fd('0x3b')]);_0x3ad0f7[_0x43fd('0x45')]=_[_0x43fd('0x3a')](_0x3ad0f7[_0x43fd('0x38')],_0x3ad0f7['query']);_0x2d0320[_0x43fd('0x3c')]=_[_0x43fd('0x3a')](_0x3ad0f7['model'],qs['fields'](_0x2e2840[_0x43fd('0x3b')][_0x43fd('0x3d')]));_0x2d0320[_0x43fd('0x3c')]=_0x2d0320['attributes'][_0x43fd('0x3e')]?_0x2d0320[_0x43fd('0x3c')]:_0x3ad0f7[_0x43fd('0x38')];if(_0x2e2840[_0x43fd('0x3b')][_0x43fd('0x4a')]){_0x2d0320['include']=[{'all':!![]}];}_0x2d0320=_[_0x43fd('0x48')]({},_0x2d0320,_0x2e2840[_0x43fd('0x49')]);return db[_0x43fd('0x34')][_0x43fd('0x52')](_0x2d0320)[_0x43fd('0x2d')](handleEntityNotFound(_0xa3e756,null))[_0x43fd('0x2d')](respondWithResult(_0xa3e756,null))[_0x43fd('0x4e')](handleError(_0xa3e756,null));};exports[_0x43fd('0x53')]=function(_0x1456c1,_0x1c14e7){return db['ChatGroup'][_0x43fd('0x53')](_0x1456c1[_0x43fd('0x54')],{})['then'](respondWithResult(_0x1c14e7,0xc9))[_0x43fd('0x4e')](handleError(_0x1c14e7,null));};exports[_0x43fd('0x2c')]=function(_0x249fbc,_0xeac450){if(_0x249fbc[_0x43fd('0x54')]['id']){delete _0x249fbc[_0x43fd('0x54')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x249fbc[_0x43fd('0x50')]['id']}})[_0x43fd('0x2d')](handleEntityNotFound(_0xeac450,null))[_0x43fd('0x2d')](saveUpdates(_0x249fbc[_0x43fd('0x54')],null))[_0x43fd('0x2d')](respondWithResult(_0xeac450,null))[_0x43fd('0x4e')](handleError(_0xeac450,null));};exports['destroy']=function(_0x5d488b,_0x1abf6b){return db[_0x43fd('0x34')]['find']({'where':{'id':_0x5d488b['params']['id']}})[_0x43fd('0x2d')](handleEntityNotFound(_0x1abf6b,null))['then'](removeEntity(_0x1abf6b,null))[_0x43fd('0x4e')](handleError(_0x1abf6b,null));};exports[_0x43fd('0x55')]=function(_0x2221bf,_0x10f931){return db[_0x43fd('0x34')][_0x43fd('0x55')]()[_0x43fd('0x2d')](respondWithResult(_0x10f931,null))[_0x43fd('0x4e')](handleError(_0x10f931,null));};exports[_0x43fd('0x56')]=function(_0x51a9b5,_0x1ac152,_0x76c914){return db[_0x43fd('0x57')]['count']({'where':{'ChatGroupId':_0x51a9b5[_0x43fd('0x50')]['id'],'ToId':_0x51a9b5[_0x43fd('0x58')]['id'],'read':![]}})['then'](function(_0x3b594f){return{'id':_[_0x43fd('0x59')](_0x51a9b5[_0x43fd('0x50')]['id']),'count':_0x3b594f};})[_0x43fd('0x2d')](respondWithResult(_0x1ac152,null))['catch'](handleError(_0x1ac152,null));};exports[_0x43fd('0x5a')]=function(_0x4f2170,_0x17381b,_0x594dbb){return db['ChatGroup'][_0x43fd('0x52')]({'where':{'id':_0x4f2170[_0x43fd('0x50')]['id']}})[_0x43fd('0x2d')](handleEntityNotFound(_0x17381b,null))[_0x43fd('0x2d')](function(_0x42970b){if(_0x42970b){return _0x42970b['addMembers'](_0x4f2170['body'][_0x43fd('0x5b')],_['omit'](_0x4f2170[_0x43fd('0x54')],[_0x43fd('0x5b'),'id'])||{});}})[_0x43fd('0x2d')](respondWithResult(_0x17381b,null))['catch'](handleError(_0x17381b,null));};exports['getMembers']=function(_0x211d6b,_0x2cefed,_0x2a40fa){var _0x158c9e={};var _0x4a9a8a={};var _0x46eba7;var _0x4abe1d;return db[_0x43fd('0x34')]['findOne']({'where':{'id':_0x211d6b['params']['id']}})[_0x43fd('0x2d')](handleEntityNotFound(_0x2cefed,null))['then'](function(_0xa39fdc){if(_0xa39fdc){_0x46eba7=_0xa39fdc;_0x4a9a8a[_0x43fd('0x38')]=_[_0x43fd('0x39')](db[_0x43fd('0x5c')][_0x43fd('0x51')]);_0x4a9a8a[_0x43fd('0x3b')]=_['keys'](_0x211d6b[_0x43fd('0x3b')]);_0x4a9a8a['filters']=_[_0x43fd('0x3a')](_0x4a9a8a[_0x43fd('0x38')],_0x4a9a8a[_0x43fd('0x3b')]);_0x158c9e[_0x43fd('0x3c')]=_[_0x43fd('0x3a')](_0x4a9a8a[_0x43fd('0x38')],qs[_0x43fd('0x3d')](_0x211d6b['query'][_0x43fd('0x3d')]));_0x158c9e[_0x43fd('0x3c')]=_0x158c9e[_0x43fd('0x3c')][_0x43fd('0x3e')]?_0x158c9e[_0x43fd('0x3c')]:_0x4a9a8a['model'];_0x158c9e[_0x43fd('0x41')]=qs[_0x43fd('0x42')](_0x211d6b[_0x43fd('0x3b')]['sort']);_0x158c9e[_0x43fd('0x43')]=qs[_0x43fd('0x45')](_[_0x43fd('0x44')](_0x211d6b[_0x43fd('0x3b')],_0x4a9a8a[_0x43fd('0x45')]));if(_0x211d6b[_0x43fd('0x3b')]['filter']){_0x158c9e[_0x43fd('0x43')]=_[_0x43fd('0x48')](_0x158c9e[_0x43fd('0x43')],{'$or':_[_0x43fd('0x33')](_0x158c9e['attributes'],function(_0x4d3d86){var _0xaf7d1d={};_0xaf7d1d[_0x4d3d86]={'$like':'%'+_0x211d6b[_0x43fd('0x3b')][_0x43fd('0x46')]+'%'};return _0xaf7d1d;})});}_0x158c9e=_['merge']({},_0x158c9e,_0x211d6b[_0x43fd('0x49')]);return _0x46eba7[_0x43fd('0x5d')](_0x158c9e);}})[_0x43fd('0x2d')](function(_0x13ab19){if(_0x13ab19){_0x4abe1d=_0x13ab19[_0x43fd('0x3e')];if(!_0x211d6b['query'][_0x43fd('0x3f')](_0x43fd('0x40'))){_0x158c9e[_0x43fd('0x23')]=qs[_0x43fd('0x23')](_0x211d6b[_0x43fd('0x3b')][_0x43fd('0x23')]);_0x158c9e[_0x43fd('0x22')]=qs[_0x43fd('0x22')](_0x211d6b[_0x43fd('0x3b')][_0x43fd('0x22')]);}return _0x46eba7[_0x43fd('0x5d')](_0x158c9e);}})[_0x43fd('0x2d')](function(_0x5d2a09){if(_0x5d2a09){return _0x5d2a09?{'count':_0x4abe1d,'rows':_0x5d2a09}:null;}})[_0x43fd('0x2d')](respondWithResult(_0x2cefed,null))['catch'](handleError(_0x2cefed,null));};exports[_0x43fd('0x5e')]=function(_0x2f0922,_0x233e9c,_0x240e9d){return db[_0x43fd('0x34')]['find']({'where':{'id':_0x2f0922[_0x43fd('0x50')]['id']}})[_0x43fd('0x2d')](handleEntityNotFound(_0x233e9c,null))[_0x43fd('0x2d')](function(_0x39b12d){if(_0x39b12d){return _0x39b12d[_0x43fd('0x5e')](_0x2f0922[_0x43fd('0x3b')]['ids']);}})['then'](respondWithStatusCode(_0x233e9c,null))[_0x43fd('0x4e')](handleError(_0x233e9c,null));};exports[_0x43fd('0x5f')]=function(_0x378a5b,_0x428aaa,_0xca2298){if(_0x378a5b['body']['id']){delete _0x378a5b[_0x43fd('0x54')]['id'];}return db[_0x43fd('0x34')][_0x43fd('0x52')]({'where':{'id':_0x378a5b['params']['id']}})[_0x43fd('0x2d')](handleEntityNotFound(_0x428aaa,null))['then'](function(_0x155ded){if(_0x155ded){_0x378a5b[_0x43fd('0x54')][_0x43fd('0x60')]=_0x155ded['id'];return db['ChatInternalMessage'][_0x43fd('0x53')](_0x378a5b[_0x43fd('0x54')]);}})['then'](respondWithResult(_0x428aaa,null))[_0x43fd('0x4e')](handleError(_0x428aaa,null));};exports[_0x43fd('0x61')]=function(_0x52e020,_0x4668c4,_0x1a88fa){var _0x19477={};var _0x459af1={};var _0xf24c6;var _0x1e6d95;return db[_0x43fd('0x34')][_0x43fd('0x62')]({'where':{'id':_0x52e020[_0x43fd('0x50')]['id']}})[_0x43fd('0x2d')](handleEntityNotFound(_0x4668c4,null))['then'](function(_0x1f2368){if(_0x1f2368){_0xf24c6=_0x1f2368;_0x459af1['model']=_[_0x43fd('0x39')](db['ChatInternalMessage']['rawAttributes']);_0x459af1[_0x43fd('0x3b')]=_[_0x43fd('0x39')](_0x52e020['query']);_0x459af1[_0x43fd('0x45')]=_[_0x43fd('0x3a')](_0x459af1[_0x43fd('0x38')],_0x459af1[_0x43fd('0x3b')]);_0x19477[_0x43fd('0x3c')]=_[_0x43fd('0x3a')](_0x459af1['model'],qs[_0x43fd('0x3d')](_0x52e020['query'][_0x43fd('0x3d')]));_0x19477[_0x43fd('0x3c')]=_0x19477[_0x43fd('0x3c')][_0x43fd('0x3e')]?_0x19477[_0x43fd('0x3c')]:_0x459af1[_0x43fd('0x38')];_0x19477['order']=qs[_0x43fd('0x42')](_0x52e020[_0x43fd('0x3b')]['sort']);_0x19477[_0x43fd('0x43')]=qs['filters'](_[_0x43fd('0x44')](_0x52e020[_0x43fd('0x3b')],_0x459af1[_0x43fd('0x45')]));if(_0x52e020[_0x43fd('0x3b')]['filter']){_0x19477[_0x43fd('0x43')]=_['merge'](_0x19477[_0x43fd('0x43')],{'$or':_['map'](_0x19477[_0x43fd('0x3c')],function(_0x413ce0){var _0x4273ce={};_0x4273ce[_0x413ce0]={'$like':'%'+_0x52e020['query'][_0x43fd('0x46')]+'%'};return _0x4273ce;})});}if(_0x52e020[_0x43fd('0x3b')]['$gte']){var _0x442310=_0x52e020[_0x43fd('0x3b')][_0x43fd('0x63')]['split'](',');var _0x21d485={};_0x21d485[_0x442310[0x0]]={'$gte':moment(_0x442310[0x1])[_0x43fd('0x64')]('YYYY-MM-DD\x20HH:mm:ss')};_0x19477[_0x43fd('0x43')]=_['merge'](_0x19477[_0x43fd('0x43')],_0x21d485);}_0x19477=_[_0x43fd('0x48')]({},_0x19477,_0x52e020[_0x43fd('0x49')]);return _0xf24c6[_0x43fd('0x61')](_0x19477);}})[_0x43fd('0x2d')](function(_0x369f14){if(_0x369f14){_0x1e6d95=_0x369f14[_0x43fd('0x3e')];if(!_0x52e020[_0x43fd('0x3b')][_0x43fd('0x3f')]('nolimit')){_0x19477[_0x43fd('0x23')]=qs['limit'](_0x52e020[_0x43fd('0x3b')][_0x43fd('0x23')]);_0x19477[_0x43fd('0x22')]=qs[_0x43fd('0x22')](_0x52e020[_0x43fd('0x3b')][_0x43fd('0x22')]);}return _0xf24c6['getMessages'](_0x19477);}})[_0x43fd('0x2d')](function(_0x4c9d91){if(_0x4c9d91){return _0x4c9d91?{'count':_0x1e6d95,'rows':_0x4c9d91}:null;}})[_0x43fd('0x2d')](respondWithResult(_0x4668c4,null))['catch'](handleError(_0x4668c4,null));}; \ No newline at end of file +var _0x8808=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatGroup.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','keys','find','create','body','describe','toInteger','addMembers','ids','omit','findOne','User','getMembers','removeMembers','ChatGroupId','ChatInternalMessage','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0x8808,0x172));var _0x8880=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x8808[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x8880('0x0'));var rimraf=require(_0x8880('0x1'));var zipdir=require(_0x8880('0x2'));var jsonpatch=require(_0x8880('0x3'));var rp=require(_0x8880('0x4'));var moment=require(_0x8880('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8880('0x6'));var util=require(_0x8880('0x7'));var path=require(_0x8880('0x8'));var sox=require(_0x8880('0x9'));var csv=require(_0x8880('0xa'));var ejs=require(_0x8880('0xb'));var fs=require('fs');var fs_extra=require(_0x8880('0xc'));var _=require(_0x8880('0xd'));var squel=require(_0x8880('0xe'));var crypto=require(_0x8880('0xf'));var jsforce=require(_0x8880('0x10'));var deskjs=require(_0x8880('0x11'));var toCsv=require(_0x8880('0xa'));var querystring=require(_0x8880('0x12'));var Papa=require(_0x8880('0x13'));var Redis=require(_0x8880('0x14'));var authService=require(_0x8880('0x15'));var qs=require(_0x8880('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8880('0x17'))('api');var utils=require(_0x8880('0x18'));var config=require(_0x8880('0x19'));var licenseUtil=require(_0x8880('0x1a'));var db=require(_0x8880('0x1b'))['db'];config['redis']=_[_0x8880('0x1c')](config[_0x8880('0x1d')],{'host':_0x8880('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8880('0x1d')]));require(_0x8880('0x1f'))[_0x8880('0x20')](socket);function respondWithStatusCode(_0x476a6e,_0x15c09a){_0x15c09a=_0x15c09a||0xcc;return function(_0x4c567c){if(_0x4c567c){return _0x476a6e['sendStatus'](_0x15c09a);}return _0x476a6e[_0x8880('0x21')](_0x15c09a)[_0x8880('0x22')]();};}function respondWithResult(_0x46c8e9,_0x44cf91){_0x44cf91=_0x44cf91||0xc8;return function(_0x431a5d){if(_0x431a5d){return _0x46c8e9[_0x8880('0x21')](_0x44cf91)[_0x8880('0x23')](_0x431a5d);}};}function respondWithFilteredResult(_0x280fc5,_0x43f5df){return function(_0x1ffca1){if(_0x1ffca1){var _0x47ef94=typeof _0x43f5df[_0x8880('0x24')]===_0x8880('0x25')&&typeof _0x43f5df[_0x8880('0x26')]==='undefined';var _0x39b0af=_0x1ffca1[_0x8880('0x27')];var _0x1cc4e6=_0x47ef94?0x0:_0x43f5df[_0x8880('0x24')];var _0x4f5c58=_0x47ef94?_0x1ffca1[_0x8880('0x27')]:_0x43f5df[_0x8880('0x24')]+_0x43f5df[_0x8880('0x26')];var _0x1a4eb2;if(_0x4f5c58>=_0x39b0af){_0x4f5c58=_0x39b0af;_0x1a4eb2=0xc8;}else{_0x1a4eb2=0xce;}_0x280fc5[_0x8880('0x21')](_0x1a4eb2);return _0x280fc5['set'](_0x8880('0x28'),_0x1cc4e6+'-'+_0x4f5c58+'/'+_0x39b0af)['json'](_0x1ffca1);}return null;};}function patchUpdates(_0x17af2c){return function(_0x3df0eb){try{jsonpatch[_0x8880('0x29')](_0x3df0eb,_0x17af2c,!![]);}catch(_0x166170){return BPromise[_0x8880('0x2a')](_0x166170);}return _0x3df0eb[_0x8880('0x2b')]();};}function saveUpdates(_0x217d17,_0x1838c7){return function(_0x4e46b2){if(_0x4e46b2){return _0x4e46b2[_0x8880('0x2c')](_0x217d17)[_0x8880('0x2d')](function(_0x11a946){return _0x11a946;});}return null;};}function removeEntity(_0x28efb3,_0xbe1507){return function(_0x19a337){if(_0x19a337){return _0x19a337['destroy']()['then'](function(){_0x28efb3[_0x8880('0x21')](0xcc)[_0x8880('0x22')]();});}};}function handleEntityNotFound(_0x412752,_0xaee4a6){return function(_0x228c5b){if(!_0x228c5b){_0x412752[_0x8880('0x2e')](0x194);}return _0x228c5b;};}function handleError(_0x2f3f36,_0x2e999f){_0x2e999f=_0x2e999f||0x1f4;return function(_0x2ef47f){logger[_0x8880('0x2f')](_0x2ef47f['stack']);if(_0x2ef47f[_0x8880('0x30')]){delete _0x2ef47f[_0x8880('0x30')];}_0x2f3f36[_0x8880('0x21')](_0x2e999f)[_0x8880('0x31')](_0x2ef47f);};}exports[_0x8880('0x32')]=function(_0x1723d1,_0x59d668){var _0x5b2385={},_0x5c553c={},_0xcd999={'count':0x0,'rows':[]};var _0x5e2d44=_[_0x8880('0x33')](db[_0x8880('0x34')][_0x8880('0x35')],function(_0x2ee757){return{'name':_0x2ee757[_0x8880('0x36')],'type':_0x2ee757[_0x8880('0x37')][_0x8880('0x38')]};});_0x5c553c[_0x8880('0x39')]=_['map'](_0x5e2d44,'name');_0x5c553c[_0x8880('0x3a')]=_['keys'](_0x1723d1['query']);_0x5c553c[_0x8880('0x3b')]=_[_0x8880('0x3c')](_0x5c553c[_0x8880('0x39')],_0x5c553c['query']);_0x5b2385[_0x8880('0x3d')]=_[_0x8880('0x3c')](_0x5c553c[_0x8880('0x39')],qs[_0x8880('0x3e')](_0x1723d1['query'][_0x8880('0x3e')]));_0x5b2385[_0x8880('0x3d')]=_0x5b2385[_0x8880('0x3d')][_0x8880('0x3f')]?_0x5b2385[_0x8880('0x3d')]:_0x5c553c[_0x8880('0x39')];if(!_0x1723d1[_0x8880('0x3a')][_0x8880('0x40')](_0x8880('0x41'))){_0x5b2385[_0x8880('0x26')]=qs[_0x8880('0x26')](_0x1723d1[_0x8880('0x3a')]['limit']);_0x5b2385[_0x8880('0x24')]=qs['offset'](_0x1723d1[_0x8880('0x3a')][_0x8880('0x24')]);}_0x5b2385[_0x8880('0x42')]=qs[_0x8880('0x43')](_0x1723d1[_0x8880('0x3a')]['sort']);_0x5b2385[_0x8880('0x44')]=qs['filters'](_[_0x8880('0x45')](_0x1723d1[_0x8880('0x3a')],_0x5c553c[_0x8880('0x3b')]),_0x5e2d44);if(_0x1723d1['query'][_0x8880('0x46')]){_0x5b2385['where']=_[_0x8880('0x47')](_0x5b2385[_0x8880('0x44')],{'$or':_[_0x8880('0x33')](_0x5e2d44,function(_0x1d7781){if(_0x1d7781[_0x8880('0x37')]!=='VIRTUAL'){var _0x57bd60={};_0x57bd60[_0x1d7781[_0x8880('0x30')]]={'$like':'%'+_0x1723d1[_0x8880('0x3a')][_0x8880('0x46')]+'%'};return _0x57bd60;}})});}_0x5b2385=_[_0x8880('0x47')]({},_0x5b2385,_0x1723d1[_0x8880('0x48')]);var _0x1bdfe2={'where':_0x5b2385[_0x8880('0x44')]};return db[_0x8880('0x34')][_0x8880('0x27')](_0x1bdfe2)['then'](function(_0x344aa5){_0xcd999[_0x8880('0x27')]=_0x344aa5;if(_0x1723d1[_0x8880('0x3a')][_0x8880('0x49')]){_0x5b2385[_0x8880('0x4a')]=[{'all':!![]}];}return db['ChatGroup'][_0x8880('0x4b')](_0x5b2385);})[_0x8880('0x2d')](function(_0x45e85c){_0xcd999['rows']=_0x45e85c;return _0xcd999;})[_0x8880('0x2d')](respondWithFilteredResult(_0x59d668,_0x5b2385))[_0x8880('0x4c')](handleError(_0x59d668,null));};exports['show']=function(_0x54383e,_0x5449ea){var _0x2e8054={'raw':!![],'where':{'id':_0x54383e[_0x8880('0x4d')]['id']}},_0x5d9b7c={};_0x5d9b7c['model']=_[_0x8880('0x4e')](db[_0x8880('0x34')][_0x8880('0x35')]);_0x5d9b7c[_0x8880('0x3a')]=_[_0x8880('0x4e')](_0x54383e[_0x8880('0x3a')]);_0x5d9b7c[_0x8880('0x3b')]=_[_0x8880('0x3c')](_0x5d9b7c[_0x8880('0x39')],_0x5d9b7c[_0x8880('0x3a')]);_0x2e8054[_0x8880('0x3d')]=_[_0x8880('0x3c')](_0x5d9b7c[_0x8880('0x39')],qs[_0x8880('0x3e')](_0x54383e[_0x8880('0x3a')][_0x8880('0x3e')]));_0x2e8054['attributes']=_0x2e8054['attributes'][_0x8880('0x3f')]?_0x2e8054['attributes']:_0x5d9b7c[_0x8880('0x39')];if(_0x54383e[_0x8880('0x3a')][_0x8880('0x49')]){_0x2e8054[_0x8880('0x4a')]=[{'all':!![]}];}_0x2e8054=_[_0x8880('0x47')]({},_0x2e8054,_0x54383e[_0x8880('0x48')]);return db[_0x8880('0x34')][_0x8880('0x4f')](_0x2e8054)[_0x8880('0x2d')](handleEntityNotFound(_0x5449ea,null))[_0x8880('0x2d')](respondWithResult(_0x5449ea,null))[_0x8880('0x4c')](handleError(_0x5449ea,null));};exports[_0x8880('0x50')]=function(_0xc8227e,_0x18f69d){return db['ChatGroup'][_0x8880('0x50')](_0xc8227e[_0x8880('0x51')],{})[_0x8880('0x2d')](respondWithResult(_0x18f69d,0xc9))[_0x8880('0x4c')](handleError(_0x18f69d,null));};exports[_0x8880('0x2c')]=function(_0x2e0452,_0x50b89b){if(_0x2e0452[_0x8880('0x51')]['id']){delete _0x2e0452[_0x8880('0x51')]['id'];}return db[_0x8880('0x34')][_0x8880('0x4f')]({'where':{'id':_0x2e0452[_0x8880('0x4d')]['id']}})['then'](handleEntityNotFound(_0x50b89b,null))[_0x8880('0x2d')](saveUpdates(_0x2e0452['body'],null))[_0x8880('0x2d')](respondWithResult(_0x50b89b,null))[_0x8880('0x4c')](handleError(_0x50b89b,null));};exports['destroy']=function(_0x42b3d1,_0x546470){return db[_0x8880('0x34')][_0x8880('0x4f')]({'where':{'id':_0x42b3d1['params']['id']}})[_0x8880('0x2d')](handleEntityNotFound(_0x546470,null))[_0x8880('0x2d')](removeEntity(_0x546470,null))[_0x8880('0x4c')](handleError(_0x546470,null));};exports['describe']=function(_0x217027,_0x479c39){return db[_0x8880('0x34')][_0x8880('0x52')]()[_0x8880('0x2d')](respondWithResult(_0x479c39,null))['catch'](handleError(_0x479c39,null));};exports['getUnread']=function(_0xf881ed,_0x16ef50,_0x1aecef){return db['ChatInternalMessage'][_0x8880('0x27')]({'where':{'ChatGroupId':_0xf881ed[_0x8880('0x4d')]['id'],'ToId':_0xf881ed['user']['id'],'read':![]}})['then'](function(_0x275a4a){return{'id':_[_0x8880('0x53')](_0xf881ed['params']['id']),'count':_0x275a4a};})['then'](respondWithResult(_0x16ef50,null))[_0x8880('0x4c')](handleError(_0x16ef50,null));};exports['addMembers']=function(_0x161697,_0x57ac7b,_0x5084a2){return db[_0x8880('0x34')]['find']({'where':{'id':_0x161697[_0x8880('0x4d')]['id']}})[_0x8880('0x2d')](handleEntityNotFound(_0x57ac7b,null))['then'](function(_0x38e063){if(_0x38e063){return _0x38e063[_0x8880('0x54')](_0x161697[_0x8880('0x51')][_0x8880('0x55')],_[_0x8880('0x56')](_0x161697[_0x8880('0x51')],[_0x8880('0x55'),'id'])||{});}})[_0x8880('0x2d')](respondWithResult(_0x57ac7b,null))[_0x8880('0x4c')](handleError(_0x57ac7b,null));};exports['getMembers']=function(_0x5ef424,_0x16e303,_0x565be6){var _0xa3c437={};var _0x17cb32={};var _0x590ea4;var _0x470e36;return db[_0x8880('0x34')][_0x8880('0x57')]({'where':{'id':_0x5ef424[_0x8880('0x4d')]['id']}})['then'](handleEntityNotFound(_0x16e303,null))[_0x8880('0x2d')](function(_0x134826){if(_0x134826){_0x590ea4=_0x134826;_0x17cb32[_0x8880('0x39')]=_['keys'](db[_0x8880('0x58')][_0x8880('0x35')]);_0x17cb32[_0x8880('0x3a')]=_[_0x8880('0x4e')](_0x5ef424[_0x8880('0x3a')]);_0x17cb32['filters']=_[_0x8880('0x3c')](_0x17cb32['model'],_0x17cb32['query']);_0xa3c437[_0x8880('0x3d')]=_[_0x8880('0x3c')](_0x17cb32[_0x8880('0x39')],qs[_0x8880('0x3e')](_0x5ef424[_0x8880('0x3a')][_0x8880('0x3e')]));_0xa3c437[_0x8880('0x3d')]=_0xa3c437[_0x8880('0x3d')][_0x8880('0x3f')]?_0xa3c437[_0x8880('0x3d')]:_0x17cb32[_0x8880('0x39')];_0xa3c437['order']=qs[_0x8880('0x43')](_0x5ef424[_0x8880('0x3a')][_0x8880('0x43')]);_0xa3c437['where']=qs['filters'](_[_0x8880('0x45')](_0x5ef424['query'],_0x17cb32[_0x8880('0x3b')]));if(_0x5ef424[_0x8880('0x3a')]['filter']){_0xa3c437[_0x8880('0x44')]=_[_0x8880('0x47')](_0xa3c437[_0x8880('0x44')],{'$or':_[_0x8880('0x33')](_0xa3c437[_0x8880('0x3d')],function(_0x127c27){var _0x4282d5={};_0x4282d5[_0x127c27]={'$like':'%'+_0x5ef424['query'][_0x8880('0x46')]+'%'};return _0x4282d5;})});}_0xa3c437=_[_0x8880('0x47')]({},_0xa3c437,_0x5ef424['options']);return _0x590ea4['getMembers'](_0xa3c437);}})[_0x8880('0x2d')](function(_0x370c98){if(_0x370c98){_0x470e36=_0x370c98[_0x8880('0x3f')];if(!_0x5ef424[_0x8880('0x3a')]['hasOwnProperty'](_0x8880('0x41'))){_0xa3c437[_0x8880('0x26')]=qs[_0x8880('0x26')](_0x5ef424[_0x8880('0x3a')][_0x8880('0x26')]);_0xa3c437[_0x8880('0x24')]=qs[_0x8880('0x24')](_0x5ef424[_0x8880('0x3a')][_0x8880('0x24')]);}return _0x590ea4[_0x8880('0x59')](_0xa3c437);}})[_0x8880('0x2d')](function(_0x5f2fb0){if(_0x5f2fb0){return _0x5f2fb0?{'count':_0x470e36,'rows':_0x5f2fb0}:null;}})[_0x8880('0x2d')](respondWithResult(_0x16e303,null))[_0x8880('0x4c')](handleError(_0x16e303,null));};exports[_0x8880('0x5a')]=function(_0x133b8e,_0x15c829,_0x163a5e){return db[_0x8880('0x34')][_0x8880('0x4f')]({'where':{'id':_0x133b8e[_0x8880('0x4d')]['id']}})[_0x8880('0x2d')](handleEntityNotFound(_0x15c829,null))[_0x8880('0x2d')](function(_0x385a78){if(_0x385a78){return _0x385a78[_0x8880('0x5a')](_0x133b8e['query'][_0x8880('0x55')]);}})[_0x8880('0x2d')](respondWithStatusCode(_0x15c829,null))[_0x8880('0x4c')](handleError(_0x15c829,null));};exports['addMessage']=function(_0x1e9b4a,_0x380295,_0x5d69e4){if(_0x1e9b4a['body']['id']){delete _0x1e9b4a['body']['id'];}return db[_0x8880('0x34')][_0x8880('0x4f')]({'where':{'id':_0x1e9b4a[_0x8880('0x4d')]['id']}})['then'](handleEntityNotFound(_0x380295,null))['then'](function(_0x518880){if(_0x518880){_0x1e9b4a[_0x8880('0x51')][_0x8880('0x5b')]=_0x518880['id'];return db[_0x8880('0x5c')][_0x8880('0x50')](_0x1e9b4a[_0x8880('0x51')]);}})[_0x8880('0x2d')](respondWithResult(_0x380295,null))[_0x8880('0x4c')](handleError(_0x380295,null));};exports[_0x8880('0x5d')]=function(_0x1506a4,_0x25a3c6,_0x70c113){var _0x45ade2={};var _0x428445={};var _0x2e7d47;var _0x323508;return db['ChatGroup'][_0x8880('0x57')]({'where':{'id':_0x1506a4['params']['id']}})[_0x8880('0x2d')](handleEntityNotFound(_0x25a3c6,null))['then'](function(_0x32c2e6){if(_0x32c2e6){_0x2e7d47=_0x32c2e6;_0x428445[_0x8880('0x39')]=_[_0x8880('0x4e')](db['ChatInternalMessage'][_0x8880('0x35')]);_0x428445[_0x8880('0x3a')]=_[_0x8880('0x4e')](_0x1506a4[_0x8880('0x3a')]);_0x428445[_0x8880('0x3b')]=_[_0x8880('0x3c')](_0x428445[_0x8880('0x39')],_0x428445[_0x8880('0x3a')]);_0x45ade2[_0x8880('0x3d')]=_[_0x8880('0x3c')](_0x428445[_0x8880('0x39')],qs[_0x8880('0x3e')](_0x1506a4[_0x8880('0x3a')]['fields']));_0x45ade2[_0x8880('0x3d')]=_0x45ade2[_0x8880('0x3d')][_0x8880('0x3f')]?_0x45ade2[_0x8880('0x3d')]:_0x428445[_0x8880('0x39')];_0x45ade2[_0x8880('0x42')]=qs[_0x8880('0x43')](_0x1506a4[_0x8880('0x3a')][_0x8880('0x43')]);_0x45ade2[_0x8880('0x44')]=qs[_0x8880('0x3b')](_[_0x8880('0x45')](_0x1506a4[_0x8880('0x3a')],_0x428445[_0x8880('0x3b')]));if(_0x1506a4[_0x8880('0x3a')][_0x8880('0x46')]){_0x45ade2[_0x8880('0x44')]=_[_0x8880('0x47')](_0x45ade2['where'],{'$or':_[_0x8880('0x33')](_0x45ade2[_0x8880('0x3d')],function(_0x45fcac){var _0x3bcd2f={};_0x3bcd2f[_0x45fcac]={'$like':'%'+_0x1506a4[_0x8880('0x3a')][_0x8880('0x46')]+'%'};return _0x3bcd2f;})});}if(_0x1506a4[_0x8880('0x3a')][_0x8880('0x5e')]){var _0x8570ab=_0x1506a4['query'][_0x8880('0x5e')]['split'](',');var _0x18d106={};_0x18d106[_0x8570ab[0x0]]={'$gte':moment(_0x8570ab[0x1])['format'](_0x8880('0x5f'))};_0x45ade2[_0x8880('0x44')]=_[_0x8880('0x47')](_0x45ade2[_0x8880('0x44')],_0x18d106);}_0x45ade2=_[_0x8880('0x47')]({},_0x45ade2,_0x1506a4[_0x8880('0x48')]);return _0x2e7d47[_0x8880('0x5d')](_0x45ade2);}})[_0x8880('0x2d')](function(_0x36b59c){if(_0x36b59c){_0x323508=_0x36b59c['length'];if(!_0x1506a4[_0x8880('0x3a')][_0x8880('0x40')](_0x8880('0x41'))){_0x45ade2[_0x8880('0x26')]=qs[_0x8880('0x26')](_0x1506a4[_0x8880('0x3a')][_0x8880('0x26')]);_0x45ade2[_0x8880('0x24')]=qs['offset'](_0x1506a4[_0x8880('0x3a')]['offset']);}return _0x2e7d47[_0x8880('0x5d')](_0x45ade2);}})[_0x8880('0x2d')](function(_0x2e45db){if(_0x2e45db){return _0x2e45db?{'count':_0x323508,'rows':_0x2e45db}:null;}})[_0x8880('0x2d')](respondWithResult(_0x25a3c6,null))[_0x8880('0x4c')](handleError(_0x25a3c6,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 401331f..b11bf52 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 _0xde4d=['ChatGroup','setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0xde4d,0xf1));var _0xdde4=function(_0xc13e8d,_0x345257){_0xc13e8d=_0xc13e8d-0x0;var _0x2e8b98=_0xde4d[_0xc13e8d];return _0x2e8b98;};'use strict';var EventEmitter=require(_0xdde4('0x0'));var ChatGroup=require(_0xdde4('0x1'))['db'][_0xdde4('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xdde4('0x3')](0x0);var events={'afterCreate':_0xdde4('0x4'),'afterUpdate':_0xdde4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5b8add){return function(_0x55ac7f,_0x570662,_0x4fee63){ChatGroupEvents[_0xdde4('0x6')](_0x5b8add+':'+_0x55ac7f['id'],_0x55ac7f);ChatGroupEvents['emit'](_0x5b8add,_0x55ac7f);_0x4fee63(null);};}for(var e in events){if(events[_0xdde4('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xdde4('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xb0e5=['emit','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save'];(function(_0x349963,_0x3efd39){var _0x188bba=function(_0x2a5654){while(--_0x2a5654){_0x349963['push'](_0x349963['shift']());}};_0x188bba(++_0x3efd39);}(_0xb0e5,0x1ad));var _0x5b0e=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0xb0e5[_0x383356];return _0x32ee5a;};'use strict';var EventEmitter=require(_0x5b0e('0x0'));var ChatGroup=require(_0x5b0e('0x1'))['db'][_0x5b0e('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5b0e('0x3')](0x0);var events={'afterCreate':_0x5b0e('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x232b17){return function(_0x582501,_0x38ca7c,_0x553588){ChatGroupEvents[_0x5b0e('0x5')](_0x232b17+':'+_0x582501['id'],_0x582501);ChatGroupEvents[_0x5b0e('0x5')](_0x232b17,_0x582501);_0x553588(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x5b0e('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 75961d4..d00b7d9 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 _0xee42=['bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','api','moment'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xee42,0x71));var _0x2ee4=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xee42[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x2ee4('0x0'));var util=require(_0x2ee4('0x1'));var logger=require('../../config/logger')(_0x2ee4('0x2'));var moment=require(_0x2ee4('0x3'));var BPromise=require(_0x2ee4('0x4'));var rp=require(_0x2ee4('0x5'));var fs=require('fs');var path=require(_0x2ee4('0x6'));var rimraf=require(_0x2ee4('0x7'));var config=require('../../config/environment');var attributes=require(_0x2ee4('0x8'));module[_0x2ee4('0x9')]=function(_0x3769ff,_0x5e8c04){return _0x3769ff[_0x2ee4('0xa')](_0x2ee4('0xb'),attributes,{'tableName':_0x2ee4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x332d=['chat_groups','lodash','../../config/logger','api','bluebird','request-promise','./chatGroup.attributes','define','ChatGroup'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x332d,0x1cc));var _0xd332=function(_0x309378,_0x559b91){_0x309378=_0x309378-0x0;var _0x438595=_0x332d[_0x309378];return _0x438595;};'use strict';var _=require(_0xd332('0x0'));var util=require('util');var logger=require(_0xd332('0x1'))(_0xd332('0x2'));var moment=require('moment');var BPromise=require(_0xd332('0x3'));var rp=require(_0xd332('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd332('0x5'));module['exports']=function(_0xf329c5,_0x357ef9){return _0xf329c5[_0xd332('0x6')](_0xd332('0x7'),attributes,{'tableName':_0xd332('0x8'),'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 abaabdf..13968a1 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 _0xfaba=['register','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket'];(function(_0xe41b50,_0x4c80c6){var _0x197d37=function(_0x18743d){while(--_0x18743d){_0xe41b50['push'](_0xe41b50['shift']());}};_0x197d37(++_0x4c80c6);}(_0xfaba,0xa2));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xafab('0x0'));var util=require(_0xafab('0x1'));var moment=require(_0xafab('0x2'));var BPromise=require(_0xafab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafab('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xafab('0x5'))('rpc');var config=require(_0xafab('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xafab('0x7')]['http']({'port':0x232a});config[_0xafab('0x8')]=_[_0xafab('0x9')](config['redis'],{'host':_0xafab('0xa'),'port':0x18eb});var socket=require(_0xafab('0xb'))(new Redis(config['redis']));require(_0xafab('0xc'))[_0xafab('0xd')](socket);function respondWithRpcPromise(_0x4d86dd,_0x5a2281,_0x40273b){return new BPromise(function(_0x14294b,_0x3f359e){return client['request'](_0x4d86dd,_0x40273b)[_0xafab('0xe')](function(_0x5b6d95){logger['info'](_0xafab('0xf'),_0x5a2281,_0xafab('0x10'));logger[_0xafab('0x11')](_0xafab('0x12'),_0x5a2281,_0xafab('0x10'),JSON[_0xafab('0x13')](_0x5b6d95));if(_0x5b6d95[_0xafab('0x14')]){if(_0x5b6d95['error'][_0xafab('0x15')]===0x1f4){logger[_0xafab('0x14')]('ChatGroup,\x20%s,\x20%s',_0x5a2281,_0x5b6d95[_0xafab('0x14')][_0xafab('0x16')]);return _0x3f359e(_0x5b6d95['error'][_0xafab('0x16')]);}logger[_0xafab('0x14')]('ChatGroup,\x20%s,\x20%s',_0x5a2281,_0x5b6d95['error'][_0xafab('0x16')]);return _0x14294b(_0x5b6d95[_0xafab('0x14')][_0xafab('0x16')]);}else{logger[_0xafab('0x17')]('ChatGroup,\x20%s,\x20%s',_0x5a2281,_0xafab('0x10'));_0x14294b(_0x5b6d95['result'][_0xafab('0x16')]);}})[_0xafab('0x18')](function(_0x475af9){logger['error'](_0xafab('0xf'),_0x5a2281,_0x475af9);_0x3f359e(_0x475af9);});});} \ No newline at end of file +var _0xad86=['ChatGroup,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./chatGroup.socket','register','request','then','request\x20sent','debug','error','message'];(function(_0x13cefb,_0x397f7e){var _0x164d99=function(_0x2dd63e){while(--_0x2dd63e){_0x13cefb['push'](_0x13cefb['shift']());}};_0x164d99(++_0x397f7e);}(_0xad86,0x194));var _0x6ad8=function(_0x54d072,_0x268a3a){_0x54d072=_0x54d072-0x0;var _0x5f5967=_0xad86[_0x54d072];return _0x5f5967;};'use strict';var _=require(_0x6ad8('0x0'));var util=require(_0x6ad8('0x1'));var moment=require(_0x6ad8('0x2'));var BPromise=require(_0x6ad8('0x3'));var rs=require(_0x6ad8('0x4'));var fs=require('fs');var Redis=require(_0x6ad8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ad8('0x6'))(_0x6ad8('0x7'));var config=require(_0x6ad8('0x8'));var jayson=require(_0x6ad8('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x6ad8('0xa')]=_[_0x6ad8('0xb')](config[_0x6ad8('0xa')],{'host':_0x6ad8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6ad8('0xd'))[_0x6ad8('0xe')](socket);function respondWithRpcPromise(_0x3a9cae,_0x1c04bc,_0x355abf){return new BPromise(function(_0x3a6b94,_0x41332f){return client[_0x6ad8('0xf')](_0x3a9cae,_0x355abf)[_0x6ad8('0x10')](function(_0x5ca991){logger['info']('ChatGroup,\x20%s,\x20%s',_0x1c04bc,_0x6ad8('0x11'));logger[_0x6ad8('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1c04bc,_0x6ad8('0x11'),JSON['stringify'](_0x5ca991));if(_0x5ca991[_0x6ad8('0x13')]){if(_0x5ca991[_0x6ad8('0x13')]['code']===0x1f4){logger[_0x6ad8('0x13')]('ChatGroup,\x20%s,\x20%s',_0x1c04bc,_0x5ca991[_0x6ad8('0x13')][_0x6ad8('0x14')]);return _0x41332f(_0x5ca991[_0x6ad8('0x13')][_0x6ad8('0x14')]);}logger['error'](_0x6ad8('0x15'),_0x1c04bc,_0x5ca991[_0x6ad8('0x13')][_0x6ad8('0x14')]);return _0x3a6b94(_0x5ca991[_0x6ad8('0x13')]['message']);}else{logger[_0x6ad8('0x16')](_0x6ad8('0x15'),_0x1c04bc,'request\x20sent');_0x3a6b94(_0x5ca991[_0x6ad8('0x17')]['message']);}})[_0x6ad8('0x18')](function(_0x157fa2){logger[_0x6ad8('0x13')](_0x6ad8('0x15'),_0x1c04bc,_0x157fa2);_0x41332f(_0x157fa2);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index d2d9f22..766d4e3 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 _0x7cf7=['register','./chatGroup.events','save','remove','update','emit','removeListener'];(function(_0x37999b,_0x22a7b8){var _0x4e2224=function(_0x90c4f6){while(--_0x90c4f6){_0x37999b['push'](_0x37999b['shift']());}};_0x4e2224(++_0x22a7b8);}(_0x7cf7,0xef));var _0x77cf=function(_0x2d4294,_0x56e06c){_0x2d4294=_0x2d4294-0x0;var _0xcb6eb6=_0x7cf7[_0x2d4294];return _0xcb6eb6;};'use strict';var ChatGroupEvents=require(_0x77cf('0x0'));var events=[_0x77cf('0x1'),_0x77cf('0x2'),_0x77cf('0x3')];function createListener(_0x44f135,_0x381e7b){return function(_0x25f87d){_0x381e7b[_0x77cf('0x4')](_0x44f135,_0x25f87d);};}function removeListener(_0x3dc619,_0x318bff){return function(){ChatGroupEvents[_0x77cf('0x5')](_0x3dc619,_0x318bff);};}exports[_0x77cf('0x6')]=function(_0x10290a){for(var _0x5a9146=0x0,_0x313864=events['length'];_0x5a9146<_0x313864;_0x5a9146++){var _0x1202b0=events[_0x5a9146];var _0x195242=createListener('chatGroup:'+_0x1202b0,_0x10290a);ChatGroupEvents['on'](_0x1202b0,_0x195242);}}; \ No newline at end of file +var _0x3fc9=['save','remove','update','emit','register','length','chatGroup:','./chatGroup.events'];(function(_0x3d70f3,_0x380c3f){var _0x2396c5=function(_0x3f4c64){while(--_0x3f4c64){_0x3d70f3['push'](_0x3d70f3['shift']());}};_0x2396c5(++_0x380c3f);}(_0x3fc9,0xbf));var _0x93fc=function(_0x84a189,_0x323ae4){_0x84a189=_0x84a189-0x0;var _0x476af8=_0x3fc9[_0x84a189];return _0x476af8;};'use strict';var ChatGroupEvents=require(_0x93fc('0x0'));var events=[_0x93fc('0x1'),_0x93fc('0x2'),_0x93fc('0x3')];function createListener(_0x22bbe2,_0x4d0774){return function(_0x1fc04b){_0x4d0774[_0x93fc('0x4')](_0x22bbe2,_0x1fc04b);};}function removeListener(_0x5a8c97,_0x41093f){return function(){ChatGroupEvents['removeListener'](_0x5a8c97,_0x41093f);};}exports[_0x93fc('0x5')]=function(_0x13fc73){for(var _0x17207f=0x0,_0x52824c=events[_0x93fc('0x6')];_0x17207f<_0x52824c;_0x17207f++){var _0x2b5d8f=events[_0x17207f];var _0x6e901f=createListener(_0x93fc('0x7')+_0x2b5d8f,_0x13fc73);ChatGroupEvents['on'](_0x2b5d8f,_0x6e901f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 2bfb537..edb8908 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 _0x8fd2=['./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/unread','getUnread','getMembers','/:id/messages','create','post','/:id/members','addMembers','addMessage','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service'];(function(_0x2c7e47,_0xb45af6){var _0x28c28f=function(_0x3e2bcf){while(--_0x3e2bcf){_0x2c7e47['push'](_0x2c7e47['shift']());}};_0x28c28f(++_0xb45af6);}(_0x8fd2,0x1a3));var _0x28fd=function(_0x198809,_0x1ddc19){_0x198809=_0x198809-0x0;var _0x1cd128=_0x8fd2[_0x198809];return _0x1cd128;};'use strict';var multer=require(_0x28fd('0x0'));var util=require(_0x28fd('0x1'));var path=require(_0x28fd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x28fd('0x3')]();var fs_extra=require(_0x28fd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x28fd('0x5'));var config=require('../../config/environment');var controller=require(_0x28fd('0x6'));router['get']('/',auth[_0x28fd('0x7')](),controller[_0x28fd('0x8')]);router[_0x28fd('0x9')](_0x28fd('0xa'),auth[_0x28fd('0x7')](),controller[_0x28fd('0xb')]);router['get'](_0x28fd('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x28fd('0x9')](_0x28fd('0xd'),auth[_0x28fd('0x7')](),controller[_0x28fd('0xe')]);router[_0x28fd('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0x28fd('0xf')]);router[_0x28fd('0x9')](_0x28fd('0x10'),auth[_0x28fd('0x7')](),controller['getMessages']);router['post']('/',auth[_0x28fd('0x7')](),controller[_0x28fd('0x11')]);router[_0x28fd('0x12')](_0x28fd('0x13'),auth[_0x28fd('0x7')](),controller[_0x28fd('0x14')]);router['post'](_0x28fd('0x10'),auth[_0x28fd('0x7')](),controller[_0x28fd('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x28fd('0x16')](_0x28fd('0xc'),auth['isAuthenticated'](),controller[_0x28fd('0x17')]);router['delete'](_0x28fd('0x13'),auth[_0x28fd('0x7')](),controller['removeMembers']);module[_0x28fd('0x18')]=router; \ No newline at end of file +var _0xddd9=['../../config/environment','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','show','/:id/unread','getMembers','/:id/messages','getMessages','post','create','/:id/members','addMessage','put','delete','removeMembers','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2f8530,_0x5cbd67){var _0x5e814e=function(_0x490b29){while(--_0x490b29){_0x2f8530['push'](_0x2f8530['shift']());}};_0x5e814e(++_0x5cbd67);}(_0xddd9,0xd0));var _0x9ddd=function(_0x22eee6,_0x335eca){_0x22eee6=_0x22eee6-0x0;var _0x4607bf=_0xddd9[_0x22eee6];return _0x4607bf;};'use strict';var multer=require('multer');var util=require(_0x9ddd('0x0'));var path=require(_0x9ddd('0x1'));var timeout=require(_0x9ddd('0x2'));var express=require(_0x9ddd('0x3'));var router=express[_0x9ddd('0x4')]();var fs_extra=require(_0x9ddd('0x5'));var auth=require(_0x9ddd('0x6'));var interaction=require(_0x9ddd('0x7'));var config=require(_0x9ddd('0x8'));var controller=require(_0x9ddd('0x9'));router[_0x9ddd('0xa')]('/',auth[_0x9ddd('0xb')](),controller[_0x9ddd('0xc')]);router[_0x9ddd('0xa')]('/describe',auth[_0x9ddd('0xb')](),controller[_0x9ddd('0xd')]);router[_0x9ddd('0xa')](_0x9ddd('0xe'),auth['isAuthenticated'](),controller[_0x9ddd('0xf')]);router['get'](_0x9ddd('0x10'),auth['isAuthenticated'](),controller['getUnread']);router[_0x9ddd('0xa')]('/:id/members',auth[_0x9ddd('0xb')](),controller[_0x9ddd('0x11')]);router[_0x9ddd('0xa')](_0x9ddd('0x12'),auth[_0x9ddd('0xb')](),controller[_0x9ddd('0x13')]);router[_0x9ddd('0x14')]('/',auth[_0x9ddd('0xb')](),controller[_0x9ddd('0x15')]);router[_0x9ddd('0x14')](_0x9ddd('0x16'),auth[_0x9ddd('0xb')](),controller['addMembers']);router[_0x9ddd('0x14')](_0x9ddd('0x12'),auth['isAuthenticated'](),controller[_0x9ddd('0x17')]);router[_0x9ddd('0x18')](_0x9ddd('0xe'),auth[_0x9ddd('0xb')](),controller['update']);router[_0x9ddd('0x19')](_0x9ddd('0xe'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x9ddd('0x16'),auth[_0x9ddd('0xb')](),controller[_0x9ddd('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 55cdeda..ee9fc72 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 _0x38c9=['long','out','sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0x5bd055,_0x463d01){var _0xbecdaf=function(_0x10bbc4){while(--_0x10bbc4){_0x5bd055['push'](_0x5bd055['shift']());}};_0xbecdaf(++_0x463d01);}(_0x38c9,0x199));var _0x938c=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0x38c9[_0x2d994d];return _0xd54be4;};'use strict';var Sequelize=require(_0x938c('0x0'));module[_0x938c('0x1')]={'closed':{'type':Sequelize[_0x938c('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x938c('0x3')](_0x938c('0x4'),_0x938c('0x5')),'defaultValue':_0x938c('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x938c('0x6')]},'mailTranscript':{'type':Sequelize[_0x938c('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x938c('0x8')]},'disposition':{'type':Sequelize[_0x938c('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x938c('0x7')]},'note':{'type':Sequelize[_0x938c('0x7')]},'browserName':{'type':Sequelize[_0x938c('0x7')]},'browserVersion':{'type':Sequelize[_0x938c('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x938c('0x7')]},'deviceVendor':{'type':Sequelize[_0x938c('0x7')]},'deviceType':{'type':Sequelize[_0x938c('0x7')]},'referer':{'type':Sequelize[_0x938c('0x6')]},'customerIp':{'type':Sequelize[_0x938c('0x7')]},'formData':{'type':Sequelize[_0x938c('0x6')](_0x938c('0x9'))},'read1stAt':{'type':Sequelize[_0x938c('0x8')]},'lastMsgAt':{'type':Sequelize[_0x938c('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x938c('0x3')]('in',_0x938c('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x938c('0x7')]},'customerPort':{'type':Sequelize[_0x938c('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x938c('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x938c('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x7072=['long','out','exports','BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','DATE'];(function(_0x530ec8,_0x3b402d){var _0xdd83a5=function(_0x55b080){while(--_0x55b080){_0x530ec8['push'](_0x530ec8['shift']());}};_0xdd83a5(++_0x3b402d);}(_0x7072,0x138));var _0x2707=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x7072[_0x11ce46];return _0x368a1e;};'use strict';var Sequelize=require('sequelize');module[_0x2707('0x0')]={'closed':{'type':Sequelize[_0x2707('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x2707('0x2')]},'ratingType':{'type':Sequelize[_0x2707('0x3')](_0x2707('0x4'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x2707('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x2707('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x2707('0x7')]},'disposition':{'type':Sequelize[_0x2707('0x6')]},'secondDisposition':{'type':Sequelize[_0x2707('0x6')]},'thirdDisposition':{'type':Sequelize[_0x2707('0x6')]},'note':{'type':Sequelize[_0x2707('0x6')]},'browserName':{'type':Sequelize[_0x2707('0x6')]},'browserVersion':{'type':Sequelize[_0x2707('0x6')]},'osName':{'type':Sequelize[_0x2707('0x6')]},'osVersion':{'type':Sequelize[_0x2707('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x2707('0x6')]},'referer':{'type':Sequelize[_0x2707('0x5')]},'customerIp':{'type':Sequelize[_0x2707('0x6')]},'formData':{'type':Sequelize[_0x2707('0x5')](_0x2707('0x8'))},'read1stAt':{'type':Sequelize[_0x2707('0x7')]},'lastMsgAt':{'type':Sequelize[_0x2707('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x2707('0x3')]('in',_0x2707('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x2707('0x6')]},'customerPort':{'type':Sequelize[_0x2707('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x2707('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x2707('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 1620fe6..c5e0b6a 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 _0xb2ff=['chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','keys','some','compact','isEmpty','forEach','ChatWebsiteId','i.ChatWebsiteId\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','replace','isNumeric','i.id\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','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','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','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','includeAll','include','options','create','update','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','POST','isNull','follow','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','AbandonInteraction','file','filename','Attachment','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','transcript-%s.txt','now','pathTranscript','Messages','format','agentAlias','customer','Visitor','website_alias','System','agent_alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','pass','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','omit','getMessages','hasOwnProperty','filter','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','secret','includeAgent','findAll','addTags','ids','spread','emit','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','osName','referer','customerPort','tail','existsSync','pipe','createWriteStream','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','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','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','name','merge','body','contact','interaction','account','Users','map','fullname','TagIds','Tags','split','push','talking','answered','unmanaged','abandoned','total','closed','UserId','waiting','disposition','ChatInteraction','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','length','nolimit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2ff,0xd9));var _0xfb2f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb2ff[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xfb2f('0x0'));var rimraf=require(_0xfb2f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb2f('0x2'));var rp=require(_0xfb2f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfb2f('0x4'));var util=require(_0xfb2f('0x5'));var path=require(_0xfb2f('0x6'));var sox=require('sox');var csv=require(_0xfb2f('0x7'));var ejs=require(_0xfb2f('0x8'));var fs=require('fs');var fs_extra=require(_0xfb2f('0x9'));var _=require(_0xfb2f('0xa'));var squel=require(_0xfb2f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfb2f('0x7'));var querystring=require(_0xfb2f('0xc'));var Papa=require(_0xfb2f('0xd'));var Redis=require(_0xfb2f('0xe'));var authService=require(_0xfb2f('0xf'));var qs=require(_0xfb2f('0x10'));var as=require(_0xfb2f('0x11'));var pdf=require(_0xfb2f('0x12'));var hardwareService=require(_0xfb2f('0x13'));var logger=require(_0xfb2f('0x14'))(_0xfb2f('0x15'));var utils=require(_0xfb2f('0x16'));var config=require(_0xfb2f('0x17'));var licenseUtil=require(_0xfb2f('0x18'));var db=require(_0xfb2f('0x19'))['db'];config[_0xfb2f('0x1a')]=_[_0xfb2f('0x1b')](config[_0xfb2f('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xfb2f('0x1c'))(new Redis(config[_0xfb2f('0x1a')]));require('./chatInteraction.socket')[_0xfb2f('0x1d')](socket);var jayson=require(_0xfb2f('0x1e'));var client=jayson[_0xfb2f('0x1f')][_0xfb2f('0x20')]({'port':0x232b});var client9004=jayson[_0xfb2f('0x1f')][_0xfb2f('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x21d473,_0x429fa7,_0x2a5ca1,_0x19510e){return new BPromise(function(_0x2349fb,_0x1efb54){var _0x26e299=_0x19510e||client;return _0x26e299[_0xfb2f('0x21')](_0x21d473,_0x2a5ca1)[_0xfb2f('0x22')](function(_0x1c87fd){logger[_0xfb2f('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x429fa7,'request\x20sent');logger[_0xfb2f('0x24')](_0xfb2f('0x25'),_0x429fa7,'request\x20sent',JSON[_0xfb2f('0x26')](_0x1c87fd));if(_0x1c87fd[_0xfb2f('0x27')]){if(_0x1c87fd[_0xfb2f('0x27')][_0xfb2f('0x28')]===0x1f4){logger['error'](_0xfb2f('0x29'),_0x429fa7,_0x1c87fd[_0xfb2f('0x27')]['message']);return _0x1efb54(_0x1c87fd['error'][_0xfb2f('0x2a')]);}logger[_0xfb2f('0x27')](_0xfb2f('0x29'),_0x429fa7,_0x1c87fd['error']['message']);return _0x2349fb(_0x1c87fd[_0xfb2f('0x27')][_0xfb2f('0x2a')]);}else{logger[_0xfb2f('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x429fa7,_0xfb2f('0x2b'));_0x2349fb(_0x1c87fd[_0xfb2f('0x2c')][_0xfb2f('0x2a')]);}})[_0xfb2f('0x2d')](function(_0x53a533){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x429fa7,_0x53a533);_0x1efb54(_0x53a533);});});}function respondWithStatusCode(_0xf764b0,_0x8fbf33){_0x8fbf33=_0x8fbf33||0xcc;return function(_0x4ee9ae){if(_0x4ee9ae){return _0xf764b0[_0xfb2f('0x2e')](_0x8fbf33);}return _0xf764b0[_0xfb2f('0x2f')](_0x8fbf33)[_0xfb2f('0x30')]();};}function respondWithResult(_0x3fe26e,_0x2d9a79){_0x2d9a79=_0x2d9a79||0xc8;return function(_0x4d6d85){if(_0x4d6d85){return _0x3fe26e[_0xfb2f('0x2f')](_0x2d9a79)[_0xfb2f('0x31')](_0x4d6d85);}};}function respondWithFilteredResult(_0x1397bc,_0x305947){return function(_0x53311b){if(_0x53311b){var _0x2ab583=typeof _0x305947['offset']===_0xfb2f('0x32')&&typeof _0x305947['limit']===_0xfb2f('0x32');var _0x2a00e3=_0x53311b[_0xfb2f('0x33')];var _0x3a41da=_0x2ab583?0x0:_0x305947[_0xfb2f('0x34')];var _0x3fe487=_0x2ab583?_0x53311b[_0xfb2f('0x33')]:_0x305947[_0xfb2f('0x34')]+_0x305947[_0xfb2f('0x35')];var _0x376a8b;if(_0x3fe487>=_0x2a00e3){_0x3fe487=_0x2a00e3;_0x376a8b=0xc8;}else{_0x376a8b=0xce;}_0x1397bc[_0xfb2f('0x2f')](_0x376a8b);return _0x1397bc[_0xfb2f('0x36')](_0xfb2f('0x37'),_0x3a41da+'-'+_0x3fe487+'/'+_0x2a00e3)['json'](_0x53311b);}return null;};}function patchUpdates(_0x4a0bc3){return function(_0x4253cc){try{jsonpatch[_0xfb2f('0x38')](_0x4253cc,_0x4a0bc3,!![]);}catch(_0x4305a5){return BPromise[_0xfb2f('0x39')](_0x4305a5);}return _0x4253cc[_0xfb2f('0x3a')]();};}function saveUpdates(_0x34d5e9,_0x46dabe){return function(_0x1a99cc){if(_0x1a99cc){return _0x1a99cc['update'](_0x34d5e9)[_0xfb2f('0x22')](function(_0x13d811){return _0x13d811;});}return null;};}function removeEntity(_0x337c94,_0x3a4e0b){return function(_0x569b13){if(_0x569b13){return _0x569b13['destroy']()[_0xfb2f('0x22')](function(){_0x337c94[_0xfb2f('0x2f')](0xcc)[_0xfb2f('0x30')]();});}};}function handleEntityNotFound(_0x226d2c,_0x30f401){return function(_0x162702){if(!_0x162702){_0x226d2c[_0xfb2f('0x2e')](0x194);}return _0x162702;};}function handleError(_0x336091,_0x228c75){_0x228c75=_0x228c75||0x1f4;return function(_0x34cf41){logger['error'](_0x34cf41['stack']);if(_0x34cf41[_0xfb2f('0x3b')]){delete _0x34cf41[_0xfb2f('0x3b')];}_0x336091['status'](_0x228c75)['send'](_0x34cf41);};}function getMustacheRender(_0x3166d6,_0x1fad77){return Mustache['render'](_0x3166d6,_[_0xfb2f('0x3c')](_0x1fad77[_0xfb2f('0x3d')],{'contact':_0x1fad77[_0xfb2f('0x3e')],'message':_0x1fad77['message'],'agent':_0x1fad77['agent'],'interaction':_0x1fad77[_0xfb2f('0x3f')],'account':_0x1fad77[_0xfb2f('0x40')]}))||'';}function getInteractionUsers(_0x15b5b6,_0x3de0ab){return new BPromise(function(_0x542bc3,_0x14cc71){try{if(_0x3de0ab[_0x15b5b6['id']]){_0x15b5b6[_0xfb2f('0x41')]=_[_0xfb2f('0x42')](_0x3de0ab[_0x15b5b6['id']],function(_0xcf5237){return{'id':_0xcf5237['id'],'fullname':_0xcf5237[_0xfb2f('0x43')]};});}}catch(_0x29004a){_0x14cc71(_0x29004a);}_0x542bc3(_0x15b5b6);});}function getInteractionTags(_0x44c5d6,_0x9c6475){return new BPromise(function(_0x49a65f,_0x3572a1){try{if(_0x44c5d6[_0xfb2f('0x44')]){_0x44c5d6[_0xfb2f('0x45')]=[];_0x44c5d6['TagIds'][_0xfb2f('0x46')](',')['forEach'](function(_0x462bed){_0x44c5d6[_0xfb2f('0x45')][_0xfb2f('0x47')](_0x9c6475[_0x462bed]);});}delete _0x44c5d6['TagIds'];}catch(_0x41672e){_0x3572a1(_0x41672e);}_0x49a65f(_0x44c5d6);});}function updateChatInteraction(_0x11ef22,_0x5c47d2,_0x360c2e){return new BPromise(function(_0x519b0f,_0x226786){return getInteractionUsers(_0x11ef22,_0x360c2e)[_0xfb2f('0x22')](function(_0x490d42){return getInteractionTags(_0x490d42,_0x5c47d2);})[_0xfb2f('0x22')](function(_0x1e5295){return getStateInteraction(_0x1e5295);})['then'](function(_0x1cb3ca){_0x519b0f(_0x1cb3ca);})[_0xfb2f('0x2d')](function(_0x29b3ca){_0x226786(_0x29b3ca);});});}function getStateInteraction(_0x186cda){return new BPromise(function(_0x4a1fb5){_0x186cda['waiting']=0x0;_0x186cda[_0xfb2f('0x48')]=0x0;_0x186cda[_0xfb2f('0x49')]=0x0;_0x186cda[_0xfb2f('0x4a')]=0x0;_0x186cda[_0xfb2f('0x4b')]=0x0;_0x186cda[_0xfb2f('0x4c')]=0x0;if(!_0x186cda[_0xfb2f('0x4d')]&&!_0x186cda[_0xfb2f('0x4e')]){_0x186cda['waiting']+=0x1;}if(!_0x186cda['closed']&&_0x186cda['UserId']){_0x186cda[_0xfb2f('0x48')]+=0x1;if(_0x186cda[_0xfb2f('0x4f')]){_0x186cda[_0xfb2f('0x4f')]-=0x1;}}if(_0x186cda['closed']&&_0x186cda['disposition']==='abandoned'){_0x186cda[_0xfb2f('0x4b')]+=0x1;if(_0x186cda[_0xfb2f('0x4f')]){_0x186cda[_0xfb2f('0x4f')]-=0x1;}}else if(_0x186cda[_0xfb2f('0x4d')]&&!_0x186cda[_0xfb2f('0x4e')]&&_0x186cda[_0xfb2f('0x50')]){_0x186cda[_0xfb2f('0x4a')]+=0x1;if(_0x186cda['waiting']){_0x186cda[_0xfb2f('0x4f')]-=0x1;}}else if(_0x186cda[_0xfb2f('0x4d')]&&_0x186cda['UserId']){_0x186cda[_0xfb2f('0x49')]+=0x1;if(_0x186cda[_0xfb2f('0x48')]){_0x186cda[_0xfb2f('0x48')]-=0x1;}}_0x186cda[_0xfb2f('0x4c')]+=0x1;_0x4a1fb5(_0x186cda);});}exports['index']=function(_0x1d7844,_0x4bb218){var _0x431f39={},_0x2fcb14={},_0x297611={'count':0x0,'rows':[]};var _0x5bf59a=_[_0xfb2f('0x42')](db[_0xfb2f('0x51')][_0xfb2f('0x52')],function(_0x1739c7){return{'name':_0x1739c7[_0xfb2f('0x53')],'type':_0x1739c7['type'][_0xfb2f('0x54')]};});_0x2fcb14[_0xfb2f('0x55')]=_[_0xfb2f('0x42')](_0x5bf59a,_0xfb2f('0x3b'));_0x2fcb14['query']=_['keys'](_0x1d7844['query']);_0x2fcb14[_0xfb2f('0x56')]=_[_0xfb2f('0x57')](_0x2fcb14[_0xfb2f('0x55')],_0x2fcb14[_0xfb2f('0x58')]);_0x431f39[_0xfb2f('0x59')]=_[_0xfb2f('0x57')](_0x2fcb14['model'],qs[_0xfb2f('0x5a')](_0x1d7844[_0xfb2f('0x58')][_0xfb2f('0x5a')]));_0x431f39[_0xfb2f('0x59')]=_0x431f39['attributes'][_0xfb2f('0x5b')]?_0x431f39['attributes']:_0x2fcb14['model'];if(!_0x1d7844[_0xfb2f('0x58')]['hasOwnProperty'](_0xfb2f('0x5c'))){_0x431f39['limit']=qs[_0xfb2f('0x35')](_0x1d7844[_0xfb2f('0x58')]['limit']);_0x431f39['offset']=qs['offset'](_0x1d7844[_0xfb2f('0x58')][_0xfb2f('0x34')]);}_0x431f39['order']=qs[_0xfb2f('0x5d')](_0x1d7844[_0xfb2f('0x58')][_0xfb2f('0x5d')]);_0x431f39[_0xfb2f('0x5e')]=qs[_0xfb2f('0x56')](_[_0xfb2f('0x5f')](_0x1d7844[_0xfb2f('0x58')],_0x2fcb14[_0xfb2f('0x56')]),_0x5bf59a);var _0x5787fe=[];var _0x3d1b7f=squel[_0xfb2f('0x60')]()[_0xfb2f('0x61')]('id')[_0xfb2f('0x61')](_0xfb2f('0x3b'))[_0xfb2f('0x61')](_0xfb2f('0x62'))[_0xfb2f('0x63')]('tools_tags');var _0x1621db=squel[_0xfb2f('0x60')]()['field'](_0xfb2f('0x64'))['field'](_0xfb2f('0x65'))[_0xfb2f('0x61')](_0xfb2f('0x66'))[_0xfb2f('0x63')](_0xfb2f('0x67'),'ui')[_0xfb2f('0x68')](_0xfb2f('0x69'),'u','u.id\x20=\x20ui.UserId');var _0xeab266=squel[_0xfb2f('0x60')]()[_0xfb2f('0x63')](_0xfb2f('0x6a'),'i')[_0xfb2f('0x68')](_0xfb2f('0x6b'),'c',_0xfb2f('0x6c'))['left_join'](_0xfb2f('0x69'),'o','o.id\x20=\x20i.UserId')[_0xfb2f('0x68')](_0xfb2f('0x6d'),'a',_0xfb2f('0x6e'))[_0xfb2f('0x68')](_0xfb2f('0x6f'),'me',_0xfb2f('0x70'))[_0xfb2f('0x68')](_0xfb2f('0x71'),'it',_0xfb2f('0x72'))[_0xfb2f('0x68')](_0xfb2f('0x73'),'t',_0xfb2f('0x74'));var _0x38991a=squel[_0xfb2f('0x75')]();var _0x1f3a9e=[];var _0x4f9416=squel[_0xfb2f('0x75')]();var _0x5a3f96;if(_0x1d7844[_0xfb2f('0x58')][_0xfb2f('0x76')]){_0x5a3f96=as[_0xfb2f('0x77')](_0x1d7844[_0xfb2f('0x58')][_0xfb2f('0x76')]);var _0x248fa7=_0x5a3f96[_0xfb2f('0x78')];for(var _0x4bd6c5=0x0;_0x4bd6c5<_0x5a3f96[_0xfb2f('0x79')][_0xfb2f('0x5b')];_0x4bd6c5++){var _0x21e61a=_0x5a3f96['conditions'][_0x4bd6c5];var _0x5b4b1c='i';var _0x1409e5=_['find'](_0x5bf59a,[_0xfb2f('0x3b'),_0x21e61a[_0xfb2f('0x61')]]);if(!_0x1409e5){switch(_0x21e61a[_0xfb2f('0x61')]){case _0xfb2f('0x7a'):if(_0x21e61a[_0xfb2f('0x7b')]==0x1){_0xeab266[_0xfb2f('0x7c')]('`'+_0x21e61a['field']+_0xfb2f('0x7d'));}else{_0xeab266[_0xfb2f('0x7c')]('`'+_0x21e61a['field']+_0xfb2f('0x7e'));}break;case'Contact':if(_0x21e61a[_0xfb2f('0x7f')]==='$substring'){if(_0x21e61a[_0xfb2f('0x7b')][_0xfb2f('0x46')]('\x20')[_0xfb2f('0x5b')]>0x1){_0x38991a[_0x248fa7](_0xfb2f('0x80'),qs['getFullTextValue'](_0x21e61a[_0xfb2f('0x7b')]),null);}else{var _0xdc693f='%'+_0x21e61a['value']+'%';_0x38991a[_0x248fa7]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xdc693f,_0xdc693f,_0xdc693f);}}else{_0x1409e5=_[_0xfb2f('0x81')](_0x5bf59a,[_0xfb2f('0x3b'),'ContactId']);_0x21e61a[_0xfb2f('0x61')]=_0xfb2f('0x82');_0x1ee02d=as[_0xfb2f('0x83')](_0x5b4b1c,_0x1409e5[_0xfb2f('0x84')],_0x21e61a);_0x38991a[_0x248fa7](_0x1ee02d[_0xfb2f('0x85')],_0x1ee02d[_0xfb2f('0x7b')][_0xfb2f('0x86')],_0x1ee02d['value'][_0xfb2f('0x30')]);}break;case _0xfb2f('0x87'):var _0x5e38ff=_0x21e61a['value']['split'](',')[_0xfb2f('0x42')](function(_0x4656c0){return Number(_0x4656c0);});_0x5e38ff['forEach'](function(_0x48499){_0x4f9416['or'](_0xfb2f('0x88'),'%,'+_0x48499+',%');});_0x1f3a9e=_[_0xfb2f('0x89')](_0x1f3a9e,_0x5e38ff);break;case _0xfb2f('0x8a'):if(_0x21e61a[_0xfb2f('0x7f')]===_0xfb2f('0x8b')){_0x38991a[_0x248fa7]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x21e61a[_0xfb2f('0x7b')]+'%',null);}else{_0x1409e5=_['find'](_0x5bf59a,[_0xfb2f('0x3b'),_0xfb2f('0x4e')]);_0x21e61a[_0xfb2f('0x61')]=_0xfb2f('0x4e');_0x1ee02d=as['buildExpression'](_0x5b4b1c,_0x1409e5[_0xfb2f('0x84')],_0x21e61a);_0x38991a[_0x248fa7](_0x1ee02d[_0xfb2f('0x85')],_0x1ee02d[_0xfb2f('0x7b')]['start'],_0x1ee02d[_0xfb2f('0x7b')][_0xfb2f('0x30')]);}break;case _0xfb2f('0x3d'):_0x1ee02d=as['buildExpression']('me',null,_0x21e61a);_0x38991a[_0x248fa7](_0x1ee02d[_0xfb2f('0x85')],_0x1ee02d['value'][_0xfb2f('0x86')],_0x1ee02d[_0xfb2f('0x7b')][_0xfb2f('0x30')]);break;}}else{var _0x1ee02d=as[_0xfb2f('0x83')](_0x5b4b1c,_0x1409e5[_0xfb2f('0x84')],_0x21e61a);_0x38991a[_0x248fa7](_0x1ee02d[_0xfb2f('0x85')],_0x1ee02d['value'][_0xfb2f('0x86')],_0x1ee02d['value'][_0xfb2f('0x30')]);}}}else{var _0x3c2527=_(_0x1d7844[_0xfb2f('0x58')])[_0xfb2f('0x8c')]()[_0xfb2f('0x42')](function(_0x154c96){return _[_0xfb2f('0x8d')](_0x5bf59a,[_0xfb2f('0x3b'),_0x154c96])?_0x154c96:undefined;})[_0xfb2f('0x8e')]()[_0xfb2f('0x7b')]();if(!_[_0xfb2f('0x8f')](_0x3c2527)){_0x3c2527[_0xfb2f('0x90')](function(_0x4c2abe){if(_0x4c2abe===_0xfb2f('0x91')){_0xeab266[_0xfb2f('0x5e')](_0xfb2f('0x92'),[][_0xfb2f('0x93')](_0x1d7844[_0xfb2f('0x58')][_0x4c2abe]));}else if(_0x4c2abe===_0xfb2f('0x94')){var _0x5d4803=JSON[_0xfb2f('0x95')](_0x1d7844[_0xfb2f('0x58')][_0x4c2abe])[_0xfb2f('0x96')];var _0x9133d8=JSON[_0xfb2f('0x95')](_0x1d7844[_0xfb2f('0x58')][_0x4c2abe])['$lte'];_0xeab266['where'](_0xfb2f('0x97'),_0x5d4803,_0x9133d8);}else{if(_0x1d7844['query'][_0x4c2abe]===_0xfb2f('0x98')){_0xeab266['where']('i.'+_0x4c2abe+_0xfb2f('0x99'));}else{_0xeab266['where']('i.'+_0x4c2abe+_0xfb2f('0x9a'),_0x1d7844[_0xfb2f('0x58')][_0x4c2abe]);}}});}if(_0x1d7844[_0xfb2f('0x58')][_0xfb2f('0x9b')]){if(_0x1d7844[_0xfb2f('0x58')][_0xfb2f('0x9b')]==0x1){_0xeab266[_0xfb2f('0x7c')](_0xfb2f('0x9c'));}else{_0xeab266[_0xfb2f('0x7c')](_0xfb2f('0x9d'));}}if(_0x1d7844[_0xfb2f('0x58')][_0xfb2f('0x9e')]){_0x1f3a9e=_[_0xfb2f('0x9f')](_0x1d7844['query']['tag'])?_0x1d7844[_0xfb2f('0x58')][_0xfb2f('0x9e')]:new Array(_0x1d7844[_0xfb2f('0x58')][_0xfb2f('0x9e')]);_0x1f3a9e[_0xfb2f('0x90')](function(_0x2ff31b){_0x4f9416['or'](_0xfb2f('0x88'),'%,'+_0x2ff31b+',%');});}if(_0x1d7844[_0xfb2f('0x58')]['filter']){var _0x207a26=_0x1d7844[_0xfb2f('0x58')]['filter'][_0xfb2f('0xa0')]('\x5c','\x5c\x5c')[_0xfb2f('0xa0')](/'/g,'\x27\x27');if(qs[_0xfb2f('0xa1')](_0x207a26)){_0x38991a['or'](_0xfb2f('0xa2'),_0x207a26+'%');}else{_0x38991a['or'](_0xfb2f('0xa3'),qs['getFullTextValue'](_0x207a26))['or'](_0xfb2f('0xa4'),_0x207a26+'%');}}}_0xeab266[_0xfb2f('0x5e')](_0x38991a);_0xeab266[_0xfb2f('0xa5')](_0xfb2f('0xa6'));var _0x46d56c={'type':db[_0xfb2f('0xa7')][_0xfb2f('0xa8')][_0xfb2f('0xa9')],'raw':!![]};var _0x1cb240=_0xeab266[_0xfb2f('0xaa')]();_0x1cb240[_0xfb2f('0x61')](_0xfb2f('0xa6'));_0x1cb240[_0xfb2f('0x61')](_0xfb2f('0xab'),_0xfb2f('0x7a'));if(_0x431f39[_0xfb2f('0xac')]){_0x431f39[_0xfb2f('0xac')]['forEach'](function(_0x45c136){var _0x517d87=_0x45c136[0x0]==='contactName'?_0x45c136[0x0]:'i.'+_0x45c136[0x0];_0xeab266['order'](_0x517d87,_0x45c136[0x1]===_0xfb2f('0xad')?![]:!![]);});}if(!_[_0xfb2f('0x8f')](_0x1f3a9e)){_0xeab266['having'](_0x4f9416);_0x1cb240[_0xfb2f('0x5e')](_0xfb2f('0xae'),_0x1f3a9e);}BPromise[_0xfb2f('0xaf')]()[_0xfb2f('0x22')](function(){if(!_0x5a3f96){if(_0x1d7844[_0xfb2f('0x58')][_0xfb2f('0x91')])return;_0x1cb240[_0xfb2f('0x5e')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0xeab266['where'](_0xfb2f('0xb0'));return;}if(_0x1d7844[_0xfb2f('0xb1')]['role']!=='agent')return;return _0x1d7844[_0xfb2f('0xb1')][_0xfb2f('0xb2')]({'attributes':['id'],'raw':!![]})[_0xfb2f('0x22')](function(_0x913a27){if(_[_0xfb2f('0x8f')](_0x913a27)){_0x1cb240[_0xfb2f('0x5e')](_0xfb2f('0xb3'));_0xeab266['where'](_0xfb2f('0xb3'));}else{_0x1cb240[_0xfb2f('0x5e')](_0xfb2f('0x92'),_[_0xfb2f('0x42')](_0x913a27,'id'));_0xeab266[_0xfb2f('0x5e')](_0xfb2f('0x92'),_['map'](_0x913a27,'id'));}});})[_0xfb2f('0x22')](function(){if(_0x1d7844[_0xfb2f('0xb1')]['role']==='agent'&&!_0x5a3f96&&!_0x1d7844[_0xfb2f('0x58')][_0xfb2f('0x91')])return[];return db[_0xfb2f('0xb4')][_0xfb2f('0x58')](_0x1cb240[_0xfb2f('0xb5')](),_0x46d56c);})[_0xfb2f('0x22')](function(_0x1431b5){_0x297611[_0xfb2f('0x33')]=_0x1431b5[_0xfb2f('0x5b')];if(_0x297611[_0xfb2f('0x33')]===0x0)return[];return db[_0xfb2f('0xb4')][_0xfb2f('0x58')](_0x3d1b7f['toString'](),_0x46d56c)[_0xfb2f('0x22')](function(_0x1145a9){_0x5787fe=_[_0xfb2f('0xb6')](_0x1145a9,'id');_0x46d56c=_[_0xfb2f('0x3c')](_0x46d56c,{'model':db[_0xfb2f('0x51')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1d7844[_0xfb2f('0x58')][_0xfb2f('0x5a')]){_0x431f39['attributes'][_0xfb2f('0x90')](function(_0x181fd6){_0xeab266[_0xfb2f('0x61')]('i.'+_0x181fd6);});}else{_0xeab266[_0xfb2f('0x61')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xfb2f('0x7a'));_0xeab266['field'](_0xfb2f('0xb7'),_0xfb2f('0xb8'));_0xeab266['field'](_0xfb2f('0xb9'),_0xfb2f('0xba'));_0xeab266[_0xfb2f('0x61')](_0xfb2f('0xbb'),_0xfb2f('0xbc'));_0xeab266[_0xfb2f('0x61')](_0xfb2f('0xbd'));_0xeab266[_0xfb2f('0x61')](_0xfb2f('0xbe'),_0xfb2f('0xbf'));_0xeab266['field'](_0xfb2f('0xc0'),'Contact.lastName');_0xeab266[_0xfb2f('0x61')](_0xfb2f('0xc1'),'Contact.email');_0xeab266['field'](_0xfb2f('0xc2'),_0xfb2f('0xc3'));_0xeab266[_0xfb2f('0x61')](_0xfb2f('0xc4'),'Contact.mobile');_0xeab266[_0xfb2f('0x61')](_0xfb2f('0xc5'),_0xfb2f('0xc6'));_0xeab266['field'](_0xfb2f('0xc7'),_0xfb2f('0xc8'));_0xeab266[_0xfb2f('0x61')](_0xfb2f('0xc9'),_0xfb2f('0xca'));_0xeab266['field'](_0xfb2f('0xcb'),_0xfb2f('0x44'));}if(_0x431f39[_0xfb2f('0x35')])_0xeab266[_0xfb2f('0x35')](_0x431f39[_0xfb2f('0x35')]);if(_0x431f39['offset'])_0xeab266['offset'](_0x431f39[_0xfb2f('0x34')]);return db['sequelize']['query'](_0xeab266['toString'](),_0x46d56c);})['then'](function(_0x10771a){if(_0x10771a[_0xfb2f('0x5b')]>0x0)_0x1621db[_0xfb2f('0x5e')](_0xfb2f('0xcc'),_['map'](_0x10771a,'id'));return db['sequelize'][_0xfb2f('0x58')](_0x1621db[_0xfb2f('0xb5')](),_0x46d56c)[_0xfb2f('0x22')](function(_0x588abb){var _0x3b9611=_[_0xfb2f('0xcd')](_0x588abb,_0xfb2f('0xce'));var _0xc7179e=[];_0x10771a['forEach'](function(_0x8c5ea8){_0xc7179e['push'](updateChatInteraction(_0x8c5ea8,_0x5787fe,_0x3b9611));});return BPromise[_0xfb2f('0xcf')](_0xc7179e);});});})['then'](function(_0x5c8d96){_0x297611[_0xfb2f('0xd0')]=_0x5c8d96;return _0x297611;})['then'](respondWithFilteredResult(_0x4bb218,_0x431f39))[_0xfb2f('0x2d')](handleError(_0x4bb218,null));};exports[_0xfb2f('0xd1')]=function(_0x42857b,_0x488558){var _0x40af22={'raw':![],'where':{'id':_0x42857b[_0xfb2f('0xd2')]['id']}},_0x427392={};_0x427392['model']=_['keys'](db['ChatInteraction'][_0xfb2f('0x52')]);_0x427392[_0xfb2f('0x58')]=_['keys'](_0x42857b['query']);_0x427392[_0xfb2f('0x56')]=_[_0xfb2f('0x57')](_0x427392['model'],_0x427392[_0xfb2f('0x58')]);_0x40af22[_0xfb2f('0x59')]=_[_0xfb2f('0x57')](_0x427392[_0xfb2f('0x55')],qs[_0xfb2f('0x5a')](_0x42857b[_0xfb2f('0x58')]['fields']));_0x40af22[_0xfb2f('0x59')]=_0x40af22[_0xfb2f('0x59')][_0xfb2f('0x5b')]?_0x40af22['attributes']:_0x427392[_0xfb2f('0x55')];if(_0x42857b['query'][_0xfb2f('0xd3')]){_0x40af22[_0xfb2f('0xd4')]=[{'all':!![]}];}_0x40af22=_[_0xfb2f('0x3c')]({},_0x40af22,_0x42857b[_0xfb2f('0xd5')]);return db[_0xfb2f('0x51')]['find'](_0x40af22)[_0xfb2f('0x22')](handleEntityNotFound(_0x488558,null))['then'](respondWithResult(_0x488558,null))[_0xfb2f('0x2d')](handleError(_0x488558,null));};exports['create']=function(_0x2d3f9d,_0x50b77c){return db[_0xfb2f('0x51')][_0xfb2f('0xd6')](_0x2d3f9d[_0xfb2f('0x3d')],{})[_0xfb2f('0x22')](respondWithResult(_0x50b77c,0xc9))['catch'](handleError(_0x50b77c,null));};exports[_0xfb2f('0xd7')]=function(_0x5f9b85,_0x1be95e){if(_0x5f9b85[_0xfb2f('0x3d')]['id']){delete _0x5f9b85[_0xfb2f('0x3d')]['id'];}return db[_0xfb2f('0x51')]['find']({'where':{'id':_0x5f9b85['params']['id']}})['then'](handleEntityNotFound(_0x1be95e,null))[_0xfb2f('0x22')](saveUpdates(_0x5f9b85[_0xfb2f('0x3d')],null))[_0xfb2f('0x22')](respondWithResult(_0x1be95e,null))['catch'](handleError(_0x1be95e,null));};exports[_0xfb2f('0xd8')]=function(_0x283e3b,_0x255fd1){return db[_0xfb2f('0x51')][_0xfb2f('0x81')]({'where':{'id':_0x283e3b['params']['id']}})[_0xfb2f('0x22')](handleEntityNotFound(_0x255fd1,null))['then'](removeEntity(_0x255fd1,null))[_0xfb2f('0x2d')](handleError(_0x255fd1,null));};exports[_0xfb2f('0xd9')]=function(_0x1f9d52,_0x5d905e){return db[_0xfb2f('0x51')][_0xfb2f('0xd9')]()[_0xfb2f('0x22')](respondWithResult(_0x5d905e,null))[_0xfb2f('0x2d')](handleError(_0x5d905e,null));};exports[_0xfb2f('0xda')]=function(_0x25190f,_0x5d688a){var _0x53cc89=_0x25190f[_0xfb2f('0xd2')]['id'];var _0x1393fe;var _0x20bcef;var _0x49c4e6;return db[_0xfb2f('0x51')][_0xfb2f('0xdb')]({'where':{'id':_0x53cc89}})[_0xfb2f('0x22')](function(_0x43f086){_0x1393fe=_0x43f086;return db[_0xfb2f('0xdc')][_0xfb2f('0xdb')]({'where':{'id':_0x43f086['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0xfb2f('0xdd'),_0xfb2f('0xde'),_0xfb2f('0xdf'),_0xfb2f('0xe0')],'raw':!![]});})[_0xfb2f('0x22')](function(_0x48ab26){if(_0x48ab26&&_0x48ab26[_0xfb2f('0xe1')]&&_0x48ab26[_0xfb2f('0xdd')]){_0x20bcef=_0x48ab26;var _0x38f586={'interaction':{'id':_0x53cc89},'agent':{'id':_0x25190f[_0xfb2f('0xb1')]['id'],'name':_0x25190f['user'][_0xfb2f('0x3b')],'fullname':_0x25190f[_0xfb2f('0xb1')][_0xfb2f('0x43')],'email':_0x25190f[_0xfb2f('0xb1')][_0xfb2f('0xe2')]},'contact':_0x25190f[_0xfb2f('0x3d')]['contact'],'account':_0x25190f['body'][_0xfb2f('0x40')]};var _0x2b39e1={'rejectUnauthorized':![],'method':_0xfb2f('0xe3'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x48ab26[_0xfb2f('0xe1')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x25190f[_0xfb2f('0xb1')]['email']],'buttons':null,'topic':_0x20bcef[_0xfb2f('0xde')],'note':_[_0xfb2f('0xe4')](_0x20bcef[_0xfb2f('0xdf')])?null:getMustacheRender(_0x20bcef[_0xfb2f('0xdf')],_0x38f586),'metadata':null},'redirect':_0xfb2f('0xe5'),'json':!![]};try{if(!_[_0xfb2f('0xe4')](_0x20bcef[_0xfb2f('0xe0')])){var _0xe93610=getMustacheRender(_0x20bcef[_0xfb2f('0xe0')],_0x38f586);var _0x1daaa4=JSON[_0xfb2f('0x95')](_0xe93610);_0x2b39e1[_0xfb2f('0x3d')]['metadata']=_0x1daaa4;}}catch(_0x75b6ef){throw new db[(_0xfb2f('0xa7'))][(_0xfb2f('0xe6'))](_0xfb2f('0xe7'));}return rp(_0x2b39e1);}else{throw new db[(_0xfb2f('0xa7'))][(_0xfb2f('0xe6'))](_0xfb2f('0xe8'));}})[_0xfb2f('0x22')](function(_0x138732){_0x49c4e6=_0x138732;if(_0x49c4e6['id']){var _0x57df02={'body':_0x49c4e6[_0xfb2f('0xe9')],'ChatWebsiteId':_0x20bcef['id'],'ChatInteractionId':_0x1393fe['id'],'direction':_0xfb2f('0xea'),'UserId':_0x25190f[_0xfb2f('0xb1')]['id']};return db[_0xfb2f('0xeb')][_0xfb2f('0xd6')](_0x57df02,{});}else{throw new db['Sequelize'][(_0xfb2f('0xe6'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xfb2f('0x22')](function(){return _0x1393fe[_0xfb2f('0xec')]({'vidaooSessionId':_0x49c4e6['id']});})[_0xfb2f('0x22')](respondWithResult(_0x5d688a,null))['catch'](handleError(_0x5d688a,null));};exports[_0xfb2f('0xed')]=function(_0xd9f14,_0x2127c1){if(_0xd9f14[_0xfb2f('0x3d')]['id']){delete _0xd9f14[_0xfb2f('0x3d')]['id'];}return db[_0xfb2f('0x51')][_0xfb2f('0x81')]({'where':{'id':_0xd9f14[_0xfb2f('0xd2')]['id']},'include':[{'model':db[_0xfb2f('0xee')],'as':_0xfb2f('0xef')}]})[_0xfb2f('0x22')](handleEntityNotFound(_0x2127c1,null))[_0xfb2f('0x22')](saveUpdates(_0xd9f14[_0xfb2f('0x3d')],null))[_0xfb2f('0x22')](respondWithResult(_0x2127c1,null))[_0xfb2f('0x2d')](handleError(_0x2127c1,null));};exports[_0xfb2f('0xf0')]=function(_0x1f635b,_0x4b9e48,_0x52ce6f){if(_0x1f635b[_0xfb2f('0x3d')]['id']){delete _0x1f635b['body']['id'];}return db[_0xfb2f('0x51')]['find']({'where':{'id':_0x1f635b[_0xfb2f('0xd2')]['id']}})['then'](function(_0x217cdb){if(!_0x217cdb){logger[_0xfb2f('0x27')](_0xfb2f('0xf1'),'abandon',0x194,'entity\x20not\x20found');_0x4b9e48[_0xfb2f('0x2e')](0x194);}else{if(_0x217cdb[_0xfb2f('0x4e')]){throw new db[(_0xfb2f('0xa7'))]['ValidationError'](_0xfb2f('0xf2'));}}return _0x217cdb;})[_0xfb2f('0x22')](function(_0x1307c2){if(_0x1307c2){return _0x1307c2[_0xfb2f('0xd7')]({'closed':_0x1f635b[_0xfb2f('0x3d')][_0xfb2f('0x4d')],'disposition':_0x1f635b[_0xfb2f('0x3d')][_0xfb2f('0x50')]})['then'](function(_0xb1d12){return _0xb1d12;});}})[_0xfb2f('0x22')](function(_0x1d8a2e){return respondWithRpcPromise(_0xfb2f('0xf3'),_0xfb2f('0xf0'),_0x1f635b[_0xfb2f('0x3d')],client9004);})[_0xfb2f('0x22')](respondWithResult(_0x4b9e48,null))[_0xfb2f('0x2d')](handleError(_0x4b9e48,null));};exports['attachmentUpload']=function(_0x51cc3b,_0xfddf80,_0x5d8ca0){_0x51cc3b[_0xfb2f('0x3d')][_0xfb2f('0x3b')]=_0x51cc3b[_0xfb2f('0xf4')]['originalname'];_0x51cc3b[_0xfb2f('0x3d')]['basename']=_0x51cc3b['file'][_0xfb2f('0xf5')];_0x51cc3b[_0xfb2f('0x3d')][_0xfb2f('0x84')]=_0x51cc3b['file']['mimetype'];return db['Attachment'][_0xfb2f('0xd6')](_0x51cc3b['body'])[_0xfb2f('0x22')](respondWithResult(_0xfddf80,0xc9))[_0xfb2f('0x2d')](handleError(_0xfddf80,null));};exports['attachmentDownload']=function(_0x441bf9,_0xd13d6f,_0x1af635){return db[_0xfb2f('0x51')]['findOne']({'where':{'id':_0x441bf9['params']['id']},'raw':!![]})[_0xfb2f('0x22')](handleEntityNotFound(_0xd13d6f,null))['then'](function(_0x437ea8){if(_0x437ea8){if(_0x437ea8[_0xfb2f('0x4d')]){return _0xd13d6f['status'](0x193)[_0xfb2f('0x31')]({'status':0x193,'message':'Unauthorized'});}return db[_0xfb2f('0xf6')][_0xfb2f('0xdb')]({'where':{'id':_0x441bf9[_0xfb2f('0x58')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0xd13d6f,null));}})['then'](function(_0x58c5ee){if(_0x58c5ee){var _0x3a0280=_0x58c5ee[_0xfb2f('0xf7')]!==null;var _0xfd9f34=path[_0xfb2f('0xf8')](config[_0xfb2f('0xf9')],_0xfb2f('0xfa'));if(_0x3a0280){_0xfd9f34=path['join'](_0xfd9f34,_0xfb2f('0xfb'));}var _0x2e5535=path[_0xfb2f('0xf8')](_0xfd9f34,_0x58c5ee[_0xfb2f('0xfc')]);return _0xd13d6f[_0xfb2f('0xfd')](_0x2e5535);}})[_0xfb2f('0x2d')](handleError(_0xd13d6f,null));};exports[_0xfb2f('0xfe')]=function(_0x317e66,_0x5c133b){var _0x3e2dc0=null;var _0x3129fb=null;var _0x1a4e4c=null;var _0x68cb74=null;if(_0x317e66[_0xfb2f('0x3d')]['id']){delete _0x317e66[_0xfb2f('0x3d')]['id'];}if(_0x317e66[_0xfb2f('0x3d')][_0xfb2f('0xff')]){_0x68cb74=path[_0xfb2f('0xf8')](config[_0xfb2f('0xf9')],'server/files/chat/upload/',util['format'](_0xfb2f('0x100'),Date[_0xfb2f('0x101')]()));_0x317e66[_0xfb2f('0x3d')][_0xfb2f('0x102')]=_0x68cb74;}return db[_0xfb2f('0x51')][_0xfb2f('0x81')]({'where':{'id':_0x317e66[_0xfb2f('0xd2')]['id']},'include':[{'model':db[_0xfb2f('0xeb')],'as':'Messages','include':[{'model':db[_0xfb2f('0x8a')],'as':_0xfb2f('0x8a')}]}]})['then'](handleEntityNotFound(_0x5c133b,null))[_0xfb2f('0x22')](saveUpdates(_0x317e66[_0xfb2f('0x3d')],null))[_0xfb2f('0x22')](function(_0x5a9eae){if(_0x5a9eae){_0x3e2dc0=_0x5a9eae;return db['ChatWebsite'][_0xfb2f('0x81')]({'where':{'id':_0x3e2dc0['ChatWebsiteId']}});}})['then'](function(_0x780462){if(_0x780462){_0x1a4e4c=_0x780462;return db[_0xfb2f('0xee')]['find']({'where':{'id':_0x3e2dc0[_0xfb2f('0x82')]}});}})[_0xfb2f('0x22')](function(_0x38d5f8){if(_0x38d5f8){_0x3129fb=_0x38d5f8;if(_0x68cb74){var _0x256049=null;for(var _0x127366=0x1;_0x127366<_0x3e2dc0[_0xfb2f('0x103')][_0xfb2f('0x5b')];++_0x127366){_0x256049=_0x3e2dc0[_0xfb2f('0x103')][_0x127366];var _0x1f606e=_0x256049[_0xfb2f('0x4e')]?util[_0xfb2f('0x104')]('%s%d',_0x1a4e4c[_0xfb2f('0x105')],_0x256049[_0xfb2f('0x4e')]):'System';var _0x45b804=_0x317e66[_0xfb2f('0x3d')][_0xfb2f('0x106')]||util[_0xfb2f('0x104')]('%s%d',_0xfb2f('0x107'),_0x256049[_0xfb2f('0x82')]);switch(_0x1a4e4c['agentIdentifier']){case _0xfb2f('0x108'):_0x1f606e=_0x256049[_0xfb2f('0x4e')]?util['format']('%s%d',_0x1a4e4c[_0xfb2f('0x105')],_0x256049[_0xfb2f('0x4e')]):_0xfb2f('0x109');break;case _0xfb2f('0x10a'):_0x1f606e=_0x256049[_0xfb2f('0x4e')]?_0x256049[_0xfb2f('0x8a')]['alias']||_0x256049[_0xfb2f('0x8a')][_0xfb2f('0x43')]:_0xfb2f('0x109');break;case'agent_fullname':_0x1f606e=_0x256049['UserId']?_0x256049[_0xfb2f('0x8a')]['fullname']:_0xfb2f('0x109');break;default:_0x1f606e=_0x256049['UserId']?util[_0xfb2f('0x104')]('%s%d',_0x1a4e4c[_0xfb2f('0x105')],_0x256049[_0xfb2f('0x4e')]):_0xfb2f('0x109');}var _0x3c2d6e=util['format'](_0xfb2f('0x10b'),moment(_0x256049['createdAt'])[_0xfb2f('0x104')](_0xfb2f('0x10c')),_0x256049[_0xfb2f('0x10d')]==='in'?_0x45b804:_0x1f606e,_0x256049['body']);if(!_0x256049['secret']){fs[_0xfb2f('0x10e')](_0x68cb74,_0x3c2d6e);}}return db[_0xfb2f('0x10f')][_0xfb2f('0xdb')]({'where':{'service':!![]},'include':[{'model':db[_0xfb2f('0x110')],'as':_0xfb2f('0x111'),'raw':!![]}]});}}})[_0xfb2f('0x22')](function(_0x32e60e){if(_0x32e60e&&_0x32e60e['Smtp']&&_0x317e66[_0xfb2f('0x3d')]){var _0x537c55={'tls':{'rejectUnauthorized':![]}};if(_0x32e60e['Smtp'][_0xfb2f('0x112')]){_0x537c55[_0xfb2f('0x112')]=_0x32e60e[_0xfb2f('0x111')][_0xfb2f('0x112')];}else{_0x537c55[_0xfb2f('0x113')]=_0x32e60e[_0xfb2f('0x111')][_0xfb2f('0x113')];_0x537c55[_0xfb2f('0x114')]=_0x32e60e[_0xfb2f('0x111')][_0xfb2f('0x114')];_0x537c55[_0xfb2f('0x115')]=_0x32e60e[_0xfb2f('0x111')]['secure'];}if(_0x32e60e[_0xfb2f('0x111')]['authentication']){_0x537c55[_0xfb2f('0x116')]={'user':_0x32e60e[_0xfb2f('0x111')]['user'],'pass':_0x32e60e[_0xfb2f('0x111')][_0xfb2f('0x117')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x537c55,'message':{'from':util[_0xfb2f('0x104')](_0xfb2f('0x118'),_0x32e60e[_0xfb2f('0x3b')],_0x32e60e['email']||_0x32e60e[_0xfb2f('0x111')][_0xfb2f('0xb1')]),'to':_0x317e66[_0xfb2f('0x3d')][_0xfb2f('0xff')],'subject':_0xfb2f('0x119'),'text':util[_0xfb2f('0x104')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x317e66[_0xfb2f('0x3d')]['mailTranscript']),'attachments':[{'path':_0x68cb74}]}})[_0xfb2f('0x22')](function(){return _0x3e2dc0;})[_0xfb2f('0x2d')](function(_0x24ee8c){console[_0xfb2f('0x27')](_0x24ee8c);});}else{return _0x3e2dc0;}})[_0xfb2f('0x22')](respondWithStatusCode(_0x5c133b,0xc8))[_0xfb2f('0x2d')](handleError(_0x5c133b,null));};exports[_0xfb2f('0x11a')]=function(_0x1cfb54,_0xd13a88,_0x1d4f36){return db[_0xfb2f('0xeb')][_0xfb2f('0x81')]({'where':{'id':_0x1cfb54[_0xfb2f('0xd2')]['id']}})[_0xfb2f('0x22')](handleEntityNotFound(_0xd13a88,null))[_0xfb2f('0x22')](function(_0x15fe6e){if(_0x15fe6e){return _0x15fe6e[_0xfb2f('0x11a')](_0x1cfb54['body']['ids'],_[_0xfb2f('0x11b')](_0x1cfb54[_0xfb2f('0x3d')],['ids','id'])||{});}})[_0xfb2f('0x22')](respondWithResult(_0xd13a88,null))['catch'](handleError(_0xd13a88,null));};exports[_0xfb2f('0x11c')]=function(_0x5f15c9,_0x2f04be,_0x49d46c){var _0x4e509c={'raw':![],'where':{}};var _0x205828={};var _0xa3e147={'count':0x0,'rows':[]};return db[_0xfb2f('0x51')]['findOne']({'where':{'id':_0x5f15c9[_0xfb2f('0xd2')]['id']}})[_0xfb2f('0x22')](handleEntityNotFound(_0x2f04be,null))[_0xfb2f('0x22')](function(_0x14e7fd){if(_0x14e7fd){_0x205828['model']=_['keys'](db[_0xfb2f('0xeb')][_0xfb2f('0x52')]);_0x205828['query']=_['keys'](_0x5f15c9[_0xfb2f('0x58')]);_0x205828[_0xfb2f('0x56')]=_[_0xfb2f('0x57')](_0x205828[_0xfb2f('0x55')],_0x205828['query']);_0x4e509c['attributes']=_[_0xfb2f('0x57')](_0x205828['model'],qs[_0xfb2f('0x5a')](_0x5f15c9[_0xfb2f('0x58')][_0xfb2f('0x5a')]));_0x4e509c[_0xfb2f('0x59')]=_0x4e509c[_0xfb2f('0x59')][_0xfb2f('0x5b')]?_0x4e509c[_0xfb2f('0x59')]:_0x205828[_0xfb2f('0x55')];if(!_0x5f15c9[_0xfb2f('0x58')][_0xfb2f('0x11d')]('nolimit')){_0x4e509c[_0xfb2f('0x35')]=qs['limit'](_0x5f15c9[_0xfb2f('0x58')][_0xfb2f('0x35')]);_0x4e509c[_0xfb2f('0x34')]=qs[_0xfb2f('0x34')](_0x5f15c9[_0xfb2f('0x58')]['offset']);}_0x4e509c[_0xfb2f('0xac')]=qs['sort'](_0x5f15c9[_0xfb2f('0x58')]['sort']);_0x4e509c['where']=qs[_0xfb2f('0x56')](_[_0xfb2f('0x5f')](_0x5f15c9['query'],_0x205828[_0xfb2f('0x56')]));_0x4e509c[_0xfb2f('0x5e')][_0xfb2f('0xce')]=_0x14e7fd['id'];if(_0x5f15c9['query'][_0xfb2f('0x11e')]){_0x4e509c[_0xfb2f('0x5e')]=_[_0xfb2f('0x3c')](_0x4e509c[_0xfb2f('0x5e')],{'$or':_[_0xfb2f('0x42')](_0x4e509c[_0xfb2f('0x59')],function(_0x3257c7){var _0x2177a8={};_0x2177a8[_0x3257c7]={'$like':'%'+_0x5f15c9[_0xfb2f('0x58')][_0xfb2f('0x11e')]+'%'};return _0x2177a8;})});}if(_0x5f15c9[_0xfb2f('0x58')]['$gte']){var _0x1a4c3f=_0x5f15c9[_0xfb2f('0x58')][_0xfb2f('0x96')]['split'](',');var _0x1daf3e={};_0x1daf3e[_0x1a4c3f[0x0]]={'$gte':moment(_0x1a4c3f[0x1])['format'](_0xfb2f('0x11f'))};_0x4e509c[_0xfb2f('0x5e')]=_['merge'](_0x4e509c['where'],_0x1daf3e);}_0x4e509c=_['merge']({},_0x4e509c,_0x5f15c9[_0xfb2f('0xd5')]);return db['ChatMessage'][_0xfb2f('0x33')]({'where':_0x4e509c[_0xfb2f('0x5e')]})[_0xfb2f('0x22')](function(_0xb050ca){_0xa3e147[_0xfb2f('0x33')]=_0xb050ca;if(_0x5f15c9[_0xfb2f('0x58')][_0xfb2f('0xd3')]){_0x4e509c[_0xfb2f('0xd4')]=[{'all':!![]}];}return db[_0xfb2f('0xeb')]['findAll'](_0x4e509c);})[_0xfb2f('0x22')](function(_0x4a5997){_0xa3e147[_0xfb2f('0xd0')]=_0x4a5997;return _0xa3e147;});}})[_0xfb2f('0x22')](respondWithFilteredResult(_0x2f04be,_0x4e509c))[_0xfb2f('0x2d')](handleError(_0x2f04be,null));};exports[_0xfb2f('0x120')]=function(_0x5ce51a,_0x3dee86,_0x59b71b){var _0x33a4b0={'where':{}},_0x305d49={},_0x197d73={'count':0x0,'rows':[]};return db[_0xfb2f('0x51')][_0xfb2f('0xdb')]({'where':{'id':_0x5ce51a[_0xfb2f('0xd2')]['id']}})['then'](handleEntityNotFound(_0x3dee86,null))[_0xfb2f('0x22')](function(_0x2937b3){if(_0x2937b3){_0x305d49[_0xfb2f('0x55')]=_['keys'](db[_0xfb2f('0xeb')][_0xfb2f('0x52')]);_0x305d49['query']=_[_0xfb2f('0x8c')](_0x5ce51a[_0xfb2f('0x58')]);_0x305d49[_0xfb2f('0x56')]=_[_0xfb2f('0x57')](_0x305d49['model'],_0x305d49[_0xfb2f('0x58')]);_0x33a4b0[_0xfb2f('0x59')]=_[_0xfb2f('0x57')](_0x305d49[_0xfb2f('0x55')],qs[_0xfb2f('0x5a')](_0x5ce51a[_0xfb2f('0x58')][_0xfb2f('0x5a')]));_0x33a4b0[_0xfb2f('0x59')]=_0x33a4b0[_0xfb2f('0x59')][_0xfb2f('0x5b')]?_0x33a4b0[_0xfb2f('0x59')]:_0x305d49[_0xfb2f('0x55')];if(!_0x5ce51a[_0xfb2f('0x58')][_0xfb2f('0x11d')](_0xfb2f('0x5c'))){_0x33a4b0[_0xfb2f('0x35')]=qs[_0xfb2f('0x35')](_0x5ce51a['query'][_0xfb2f('0x35')]);_0x33a4b0[_0xfb2f('0x34')]=qs[_0xfb2f('0x34')](_0x5ce51a[_0xfb2f('0x58')]['offset']);}_0x33a4b0[_0xfb2f('0xac')]=qs[_0xfb2f('0x5d')](_0x5ce51a[_0xfb2f('0x58')][_0xfb2f('0x5d')]);_0x33a4b0[_0xfb2f('0x5e')]=qs['filters'](_[_0xfb2f('0x5f')](_0x5ce51a[_0xfb2f('0x58')],_0x305d49[_0xfb2f('0x56')]));_0x33a4b0[_0xfb2f('0x5e')]['ChatInteractionId']=_0x2937b3['id'];if(_0x5ce51a[_0xfb2f('0x58')][_0xfb2f('0x11e')]){_0x33a4b0[_0xfb2f('0x5e')]=_[_0xfb2f('0x3c')](_0x33a4b0[_0xfb2f('0x5e')],{'$or':_[_0xfb2f('0x42')](_0x33a4b0['attributes'],function(_0x44286a){var _0x29ee8f={};_0x29ee8f[_0x44286a]={'$like':'%'+_0x5ce51a[_0xfb2f('0x58')][_0xfb2f('0x11e')]+'%'};return _0x29ee8f;})});}_0x33a4b0[_0xfb2f('0x5e')][_0xfb2f('0x121')]=![];if(_0x5ce51a['query']['id']){_0x33a4b0['where']['id']={'$gt':_0x5ce51a['query']['id']};}_0x33a4b0=_[_0xfb2f('0x3c')]({},_0x33a4b0,_0x5ce51a[_0xfb2f('0xd5')]);return db[_0xfb2f('0xeb')][_0xfb2f('0x33')]({'where':_0x33a4b0[_0xfb2f('0x5e')]})[_0xfb2f('0x22')](function(_0x561134){_0x197d73[_0xfb2f('0x33')]=_0x561134;_0x33a4b0[_0xfb2f('0xd4')]=[];if(_0x5ce51a[_0xfb2f('0x58')][_0xfb2f('0x122')]){_0x33a4b0[_0xfb2f('0xd4')][_0xfb2f('0x47')]({'model':db[_0xfb2f('0x8a')],'as':_0xfb2f('0x8a'),'attributes':['id',_0xfb2f('0x43'),'alias']});}if(_0x5ce51a['query']['includeAll']){_0x33a4b0[_0xfb2f('0xd4')]=[{'all':!![]}];}return db['ChatMessage'][_0xfb2f('0x123')](_0x33a4b0);})[_0xfb2f('0x22')](function(_0x50124d){_0x197d73['rows']=_0x50124d;return _0x197d73;});}})['then'](respondWithFilteredResult(_0x3dee86,_0x33a4b0))[_0xfb2f('0x2d')](handleError(_0x3dee86,null));};exports[_0xfb2f('0x124')]=function(_0x13e135,_0x4ddeaa,_0x5f42f9){return db['ChatInteraction']['find']({'where':{'id':_0x13e135[_0xfb2f('0xd2')]['id']}})[_0xfb2f('0x22')](handleEntityNotFound(_0x4ddeaa,null))[_0xfb2f('0x22')](function(_0x4776f6){if(_0x4776f6){return _0x4776f6['setTags'](_0x13e135[_0xfb2f('0x3d')][_0xfb2f('0x125')],_['omit'](_0x13e135['body'],[_0xfb2f('0x125'),'id'])||{})[_0xfb2f('0x126')](function(){return db[_0xfb2f('0x87')][_0xfb2f('0x123')]({'attributes':['id',_0xfb2f('0x3b'),_0xfb2f('0x62')],'where':{'id':_0x13e135[_0xfb2f('0x3d')][_0xfb2f('0x125')]}});})['then'](function(_0x2d9db5){socket[_0xfb2f('0x127')]('chatInteractionTags:save',{'id':Number(_0x13e135[_0xfb2f('0xd2')]['id']),'tags':_0x2d9db5||[]});return{'id':Number(_0x13e135[_0xfb2f('0xd2')]['id']),'tags':_0x2d9db5||[]};});}})[_0xfb2f('0x22')](respondWithResult(_0x4ddeaa,null))[_0xfb2f('0x2d')](handleError(_0x4ddeaa,null));};exports[_0xfb2f('0x128')]=function(_0x419290,_0x4abf1e,_0x153d64){return db[_0xfb2f('0x51')]['find']({'where':{'id':_0x419290['params']['id']}})['then'](handleEntityNotFound(_0x4abf1e,null))[_0xfb2f('0x22')](function(_0x103101){if(_0x103101){return _0x103101[_0xfb2f('0x128')](_0x419290[_0xfb2f('0x58')]['ids']);}})['then'](respondWithStatusCode(_0x4abf1e,null))[_0xfb2f('0x2d')](handleError(_0x4abf1e,null));};exports[_0xfb2f('0xfd')]=function(_0x5f9503,_0x4840a0){var _0x2937dd=moment()[_0xfb2f('0x129')]()[_0xfb2f('0xb5')]();var _0x5446a2=path[_0xfb2f('0xf8')](config[_0xfb2f('0xf9')],_0xfb2f('0x12a'),_0xfb2f('0x12b'),_0xfb2f('0x12c'));var _0xce1355=path[_0xfb2f('0xf8')](config[_0xfb2f('0xf9')],_0xfb2f('0x12a'),_0xfb2f('0x12b'),_0xfb2f('0x12d'));var _0x2c83a4=path[_0xfb2f('0xf8')](_0x5446a2,_0x2937dd);var _0x56f763=util['format'](_0xfb2f('0x12e'),_0x5f9503['params']['id'],_0x2937dd);var _0x31a110=path['join'](_0x5446a2,_0x56f763);var _0xa2a4e2=[];_0xa2a4e2[_0xfb2f('0x47')]({'model':db[_0xfb2f('0x8a')],'as':_0xfb2f('0x8a'),'attributes':['id',_0xfb2f('0x43')],'raw':!![]});_0xa2a4e2['push']({'model':db[_0xfb2f('0xee')],'as':'Contact','attributes':['id',_0xfb2f('0x12f'),_0xfb2f('0x130')],'raw':!![]});if(_0x5f9503[_0xfb2f('0x58')][_0xfb2f('0x12d')]){_0xa2a4e2[_0xfb2f('0x47')]({'model':db[_0xfb2f('0xf6')],'as':_0xfb2f('0xf6'),'raw':!![]});}var _0x11fef5=[{'model':db[_0xfb2f('0xeb')],'as':_0xfb2f('0x103'),'attributes':['id','body',_0xfb2f('0x94'),_0xfb2f('0x10d'),'secret',_0xfb2f('0x9b')],'include':_0xa2a4e2}];_0x11fef5['push']({'model':db[_0xfb2f('0xdc')],'as':_0xfb2f('0x131'),'attributes':['id',_0xfb2f('0x3b')]});_0x11fef5[_0xfb2f('0x47')]({'model':db[_0xfb2f('0x8a')],'as':_0xfb2f('0x132'),'attributes':['id','fullname']});return db[_0xfb2f('0x51')]['find']({'where':{'id':_0x5f9503[_0xfb2f('0xd2')]['id']},'include':_0x11fef5})[_0xfb2f('0x22')](handleEntityNotFound(_0x4840a0,null))[_0xfb2f('0x22')](function(_0x26baa5){if(_0x26baa5){var _0x4428be=_0x26baa5[_0xfb2f('0x133')]({'plain':!![]});fs[_0xfb2f('0x134')](_0x2c83a4);var _0x40e602={'channel':_0xfb2f('0x135'),'account':_0x4428be[_0xfb2f('0x131')][_0xfb2f('0x3b')],'agent':_0x4428be[_0xfb2f('0x132')]?_0x4428be[_0xfb2f('0x132')][_0xfb2f('0x43')]:_0xfb2f('0x136'),'createdAt':moment(_0x4428be[_0xfb2f('0x94')])['format'](_0xfb2f('0x11f'))[_0xfb2f('0xb5')](),'closedAt':_0x4428be[_0xfb2f('0x4d')]?moment(_0x4428be[_0xfb2f('0x137')])['format'](_0xfb2f('0x11f'))[_0xfb2f('0xb5')]():'','disposition':_0x4428be[_0xfb2f('0x50')],'chatInfo':{'browser':_0x4428be['browserName'],'os':_0x4428be[_0xfb2f('0x138')],'referer':_0x4428be[_0xfb2f('0x139')],'customerIp':_0x4428be['customerIp'],'customerPort':_0x4428be[_0xfb2f('0x13a')]?_0x4428be[_0xfb2f('0x13a')]:'N.A.'},'messages':_(_0x4428be[_0xfb2f('0x103')])[_0xfb2f('0x13b')]()[_0xfb2f('0x11e')]({'secret':![]})[_0xfb2f('0x42')](function(_0x315077){if(_0x315077['Attachment']){var _0x2becc5=path[_0xfb2f('0xf8')](_0xce1355,_0x315077[_0xfb2f('0xf6')][_0xfb2f('0xfc')]);if(fs[_0xfb2f('0x13c')](_0x2becc5)){fs['createReadStream'](_0x2becc5)[_0xfb2f('0x13d')](fs[_0xfb2f('0x13e')](path['join'](_0x2c83a4,_0x315077[_0xfb2f('0xf6')][_0xfb2f('0xfc')])));}}return{'date':moment(_0x315077[_0xfb2f('0x94')])[_0xfb2f('0x104')](_0xfb2f('0x11f'))[_0xfb2f('0xb5')](),'sender':_0x315077[_0xfb2f('0x10d')]===_0xfb2f('0xea')?_0x315077['User']?_0x315077[_0xfb2f('0x8a')][_0xfb2f('0x43')]:_0xfb2f('0x109'):_0x315077[_0xfb2f('0xef')][_0xfb2f('0x12f')]+(_0x315077[_0xfb2f('0xef')][_0xfb2f('0x130')]?'\x20'+_0x315077['Contact']['lastName']:''),'body':_0x315077[_0xfb2f('0xf6')]?_0x315077[_0xfb2f('0xf6')][_0xfb2f('0xfc')]:_0x315077[_0xfb2f('0x3d')],'direction':_0x315077[_0xfb2f('0x10d')]===_0xfb2f('0xea')?'A':'C','secret':_0x315077[_0xfb2f('0x121')],'read':_0x315077[_0xfb2f('0x9b')],'attachment':_0x315077['Attachment']};})[_0xfb2f('0x7b')]()};return ejs[_0xfb2f('0x13f')](path[_0xfb2f('0xf8')](config[_0xfb2f('0xf9')],_0xfb2f('0x12a'),_0xfb2f('0x140'),_0xfb2f('0x141')),{'interaction':_0x40e602})[_0xfb2f('0x22')](function(_0x184b20){var _0x316358=path[_0xfb2f('0xf8')](_0x2c83a4,'transcript-'+_0x4428be['id']+'-'+_0x2937dd+'.pdf');var _0xdb3ea7={'path':_0x316358,'channel':_0xfb2f('0x135'),'interactionId':_0x4428be['id']};return pdf[_0xfb2f('0x142')](_0x184b20,_0xdb3ea7);})[_0xfb2f('0x22')](function(){return new BPromise(function(_0x2184ce,_0x1402c2){zipdir(_0x2c83a4,{'saveTo':_0x31a110},function(_0x1898fb,_0x45532d){if(_0x1898fb)return _0x1402c2(_0x1898fb);return _0x2184ce(_0x45532d);});})[_0xfb2f('0x22')](function(){return new BPromise(function(_0x369ec3,_0x2bb940){rimraf(_0x2c83a4,function(_0x5af30f){if(_0x5af30f)_0x2bb940(_0x5af30f);return _0x369ec3();});});})['then'](function(){return _0x4840a0[_0xfb2f('0xfd')](_0x31a110,_0x56f763,function(_0x174ea3){if(_0x174ea3){console[_0xfb2f('0x143')](_0xfb2f('0x144'),_0x174ea3);}else{fs[_0xfb2f('0x145')](_0x31a110);}});});});}else{return _0x4840a0[_0xfb2f('0x2e')](0xc8);}})[_0xfb2f('0x2d')](handleError(_0x4840a0,null));}; \ No newline at end of file +var _0x0daa=['i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\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','QueryTypes','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','keyBy','a.key','Account.key','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','c.firstName','Contact.firstName','c.lastName','c.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','toString','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','show','params','fields','includeAll','include','options','create','describe','findOne','ChatWebsite','vidaooApiKey','vidaooTopic','vidaooEscalation','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','vidaooNote','follow','vidaooMetadata','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','update','disposition','AbandonInteraction','abandon','file','originalname','basename','type','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','ChatMessage','User','Messages','System','%s%d','Visitor','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','includeAgent','findAll','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','Account','Owner','get','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','pipe','createWriteStream','out','views','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','http','client','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','destroy','stack','name','send','render','merge','body','contact','agent','interaction','Users','map','fullname','TagIds','Tags','push','talking','answered','unmanaged','abandoned','total','closed','UserId','waiting','index','ChatInteraction','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','getFullTextValue','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','some','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','parse','$lte'];(function(_0x10a8dc,_0x411b1f){var _0x248e4f=function(_0x759cfc){while(--_0x759cfc){_0x10a8dc['push'](_0x10a8dc['shift']());}};_0x248e4f(++_0x411b1f);}(_0x0daa,0xad));var _0xa0da=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0daa[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xa0da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa0da('0x1'));var jsonpatch=require(_0xa0da('0x2'));var rp=require(_0xa0da('0x3'));var moment=require(_0xa0da('0x4'));var BPromise=require(_0xa0da('0x5'));var Mustache=require(_0xa0da('0x6'));var util=require(_0xa0da('0x7'));var path=require(_0xa0da('0x8'));var sox=require('sox');var csv=require(_0xa0da('0x9'));var ejs=require(_0xa0da('0xa'));var fs=require('fs');var fs_extra=require(_0xa0da('0xb'));var _=require(_0xa0da('0xc'));var squel=require('squel');var crypto=require(_0xa0da('0xd'));var jsforce=require(_0xa0da('0xe'));var deskjs=require(_0xa0da('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa0da('0x10'));var Papa=require(_0xa0da('0x11'));var Redis=require(_0xa0da('0x12'));var authService=require(_0xa0da('0x13'));var qs=require(_0xa0da('0x14'));var as=require(_0xa0da('0x15'));var pdf=require(_0xa0da('0x16'));var hardwareService=require(_0xa0da('0x17'));var logger=require(_0xa0da('0x18'))(_0xa0da('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa0da('0x1a'));var db=require(_0xa0da('0x1b'))['db'];config[_0xa0da('0x1c')]=_[_0xa0da('0x1d')](config[_0xa0da('0x1c')],{'host':_0xa0da('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa0da('0x1c')]));require(_0xa0da('0x1f'))[_0xa0da('0x20')](socket);var jayson=require(_0xa0da('0x21'));var client=jayson['client'][_0xa0da('0x22')]({'port':0x232b});var client9004=jayson[_0xa0da('0x23')][_0xa0da('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x31f280,_0x4ecc6e,_0x5ae777,_0x33766f){return new BPromise(function(_0x3392c7,_0x3a8079){var _0x13b608=_0x33766f||client;return _0x13b608['request'](_0x31f280,_0x5ae777)[_0xa0da('0x24')](function(_0x51a3bd){logger[_0xa0da('0x25')](_0xa0da('0x26'),_0x4ecc6e,_0xa0da('0x27'));logger[_0xa0da('0x28')](_0xa0da('0x29'),_0x4ecc6e,'request\x20sent',JSON[_0xa0da('0x2a')](_0x51a3bd));if(_0x51a3bd[_0xa0da('0x2b')]){if(_0x51a3bd[_0xa0da('0x2b')][_0xa0da('0x2c')]===0x1f4){logger[_0xa0da('0x2b')](_0xa0da('0x26'),_0x4ecc6e,_0x51a3bd[_0xa0da('0x2b')][_0xa0da('0x2d')]);return _0x3a8079(_0x51a3bd['error']['message']);}logger[_0xa0da('0x2b')](_0xa0da('0x26'),_0x4ecc6e,_0x51a3bd[_0xa0da('0x2b')]['message']);return _0x3392c7(_0x51a3bd['error']['message']);}else{logger[_0xa0da('0x25')](_0xa0da('0x26'),_0x4ecc6e,'request\x20sent');_0x3392c7(_0x51a3bd['result'][_0xa0da('0x2d')]);}})[_0xa0da('0x2e')](function(_0x36471f){logger[_0xa0da('0x2b')](_0xa0da('0x26'),_0x4ecc6e,_0x36471f);_0x3a8079(_0x36471f);});});}function respondWithStatusCode(_0x2b887d,_0x270fc1){_0x270fc1=_0x270fc1||0xcc;return function(_0x1d206d){if(_0x1d206d){return _0x2b887d[_0xa0da('0x2f')](_0x270fc1);}return _0x2b887d[_0xa0da('0x30')](_0x270fc1)[_0xa0da('0x31')]();};}function respondWithResult(_0x3b25cf,_0x5097ec){_0x5097ec=_0x5097ec||0xc8;return function(_0x291411){if(_0x291411){return _0x3b25cf[_0xa0da('0x30')](_0x5097ec)[_0xa0da('0x32')](_0x291411);}};}function respondWithFilteredResult(_0x59912d,_0x476cd8){return function(_0x4883d5){if(_0x4883d5){var _0x31b921=typeof _0x476cd8[_0xa0da('0x33')]==='undefined'&&typeof _0x476cd8['limit']==='undefined';var _0x4571b3=_0x4883d5['count'];var _0x1ae804=_0x31b921?0x0:_0x476cd8[_0xa0da('0x33')];var _0x24f8ea=_0x31b921?_0x4883d5[_0xa0da('0x34')]:_0x476cd8[_0xa0da('0x33')]+_0x476cd8[_0xa0da('0x35')];var _0x4191d4;if(_0x24f8ea>=_0x4571b3){_0x24f8ea=_0x4571b3;_0x4191d4=0xc8;}else{_0x4191d4=0xce;}_0x59912d[_0xa0da('0x30')](_0x4191d4);return _0x59912d[_0xa0da('0x36')](_0xa0da('0x37'),_0x1ae804+'-'+_0x24f8ea+'/'+_0x4571b3)[_0xa0da('0x32')](_0x4883d5);}return null;};}function patchUpdates(_0x106c0c){return function(_0x26cabf){try{jsonpatch[_0xa0da('0x38')](_0x26cabf,_0x106c0c,!![]);}catch(_0x3c7775){return BPromise['reject'](_0x3c7775);}return _0x26cabf['save']();};}function saveUpdates(_0x5d008,_0x145cae){return function(_0x3d5231){if(_0x3d5231){return _0x3d5231['update'](_0x5d008)[_0xa0da('0x24')](function(_0x1c160b){return _0x1c160b;});}return null;};}function removeEntity(_0x49cb0c,_0x495b6c){return function(_0x231323){if(_0x231323){return _0x231323[_0xa0da('0x39')]()[_0xa0da('0x24')](function(){_0x49cb0c[_0xa0da('0x30')](0xcc)[_0xa0da('0x31')]();});}};}function handleEntityNotFound(_0x141684,_0x1177b3){return function(_0x14ba86){if(!_0x14ba86){_0x141684['sendStatus'](0x194);}return _0x14ba86;};}function handleError(_0xc68ea8,_0x2c4f13){_0x2c4f13=_0x2c4f13||0x1f4;return function(_0x4cbbbe){logger[_0xa0da('0x2b')](_0x4cbbbe[_0xa0da('0x3a')]);if(_0x4cbbbe[_0xa0da('0x3b')]){delete _0x4cbbbe[_0xa0da('0x3b')];}_0xc68ea8[_0xa0da('0x30')](_0x2c4f13)[_0xa0da('0x3c')](_0x4cbbbe);};}function getMustacheRender(_0x1bcbd7,_0x14d665){return Mustache[_0xa0da('0x3d')](_0x1bcbd7,_[_0xa0da('0x3e')](_0x14d665[_0xa0da('0x3f')],{'contact':_0x14d665[_0xa0da('0x40')],'message':_0x14d665[_0xa0da('0x2d')],'agent':_0x14d665[_0xa0da('0x41')],'interaction':_0x14d665[_0xa0da('0x42')],'account':_0x14d665['account']}))||'';}function getInteractionUsers(_0x394a4b,_0x5ad874){return new BPromise(function(_0x46b165,_0x1ed182){try{if(_0x5ad874[_0x394a4b['id']]){_0x394a4b[_0xa0da('0x43')]=_[_0xa0da('0x44')](_0x5ad874[_0x394a4b['id']],function(_0x345e03){return{'id':_0x345e03['id'],'fullname':_0x345e03[_0xa0da('0x45')]};});}}catch(_0x5c2531){_0x1ed182(_0x5c2531);}_0x46b165(_0x394a4b);});}function getInteractionTags(_0x5bf7e2,_0x164aab){return new BPromise(function(_0xed760c,_0x3cfd14){try{if(_0x5bf7e2[_0xa0da('0x46')]){_0x5bf7e2[_0xa0da('0x47')]=[];_0x5bf7e2[_0xa0da('0x46')]['split'](',')['forEach'](function(_0x43c7c3){_0x5bf7e2[_0xa0da('0x47')][_0xa0da('0x48')](_0x164aab[_0x43c7c3]);});}delete _0x5bf7e2[_0xa0da('0x46')];}catch(_0x39cdd7){_0x3cfd14(_0x39cdd7);}_0xed760c(_0x5bf7e2);});}function updateChatInteraction(_0x284431,_0x279df1,_0x1c8d01){return new BPromise(function(_0x5e0ebd,_0x2ca93f){return getInteractionUsers(_0x284431,_0x1c8d01)[_0xa0da('0x24')](function(_0x1a1c09){return getInteractionTags(_0x1a1c09,_0x279df1);})[_0xa0da('0x24')](function(_0x25f406){return getStateInteraction(_0x25f406);})['then'](function(_0x16a589){_0x5e0ebd(_0x16a589);})[_0xa0da('0x2e')](function(_0x4dbc1d){_0x2ca93f(_0x4dbc1d);});});}function getStateInteraction(_0x2b0d66){return new BPromise(function(_0x59baab){_0x2b0d66['waiting']=0x0;_0x2b0d66[_0xa0da('0x49')]=0x0;_0x2b0d66[_0xa0da('0x4a')]=0x0;_0x2b0d66[_0xa0da('0x4b')]=0x0;_0x2b0d66[_0xa0da('0x4c')]=0x0;_0x2b0d66[_0xa0da('0x4d')]=0x0;if(!_0x2b0d66[_0xa0da('0x4e')]&&!_0x2b0d66[_0xa0da('0x4f')]){_0x2b0d66[_0xa0da('0x50')]+=0x1;}if(!_0x2b0d66[_0xa0da('0x4e')]&&_0x2b0d66[_0xa0da('0x4f')]){_0x2b0d66['talking']+=0x1;if(_0x2b0d66['waiting']){_0x2b0d66[_0xa0da('0x50')]-=0x1;}}if(_0x2b0d66[_0xa0da('0x4e')]&&_0x2b0d66['disposition']===_0xa0da('0x4c')){_0x2b0d66[_0xa0da('0x4c')]+=0x1;if(_0x2b0d66[_0xa0da('0x50')]){_0x2b0d66[_0xa0da('0x50')]-=0x1;}}else if(_0x2b0d66[_0xa0da('0x4e')]&&!_0x2b0d66[_0xa0da('0x4f')]&&_0x2b0d66['disposition']){_0x2b0d66[_0xa0da('0x4b')]+=0x1;if(_0x2b0d66['waiting']){_0x2b0d66[_0xa0da('0x50')]-=0x1;}}else if(_0x2b0d66[_0xa0da('0x4e')]&&_0x2b0d66['UserId']){_0x2b0d66[_0xa0da('0x4a')]+=0x1;if(_0x2b0d66[_0xa0da('0x49')]){_0x2b0d66['talking']-=0x1;}}_0x2b0d66[_0xa0da('0x4d')]+=0x1;_0x59baab(_0x2b0d66);});}exports[_0xa0da('0x51')]=function(_0x7d475a,_0x3eced3){var _0x2fd145={},_0x134af8={},_0x404f46={'count':0x0,'rows':[]};var _0x1e7ced=_[_0xa0da('0x44')](db[_0xa0da('0x52')][_0xa0da('0x53')],function(_0x514bb0){return{'name':_0x514bb0[_0xa0da('0x54')],'type':_0x514bb0['type'][_0xa0da('0x55')]};});_0x134af8[_0xa0da('0x56')]=_['map'](_0x1e7ced,_0xa0da('0x3b'));_0x134af8['query']=_[_0xa0da('0x57')](_0x7d475a[_0xa0da('0x58')]);_0x134af8[_0xa0da('0x59')]=_[_0xa0da('0x5a')](_0x134af8[_0xa0da('0x56')],_0x134af8[_0xa0da('0x58')]);_0x2fd145[_0xa0da('0x5b')]=_['intersection'](_0x134af8[_0xa0da('0x56')],qs['fields'](_0x7d475a['query']['fields']));_0x2fd145['attributes']=_0x2fd145[_0xa0da('0x5b')][_0xa0da('0x5c')]?_0x2fd145[_0xa0da('0x5b')]:_0x134af8['model'];if(!_0x7d475a[_0xa0da('0x58')][_0xa0da('0x5d')](_0xa0da('0x5e'))){_0x2fd145[_0xa0da('0x35')]=qs[_0xa0da('0x35')](_0x7d475a[_0xa0da('0x58')][_0xa0da('0x35')]);_0x2fd145[_0xa0da('0x33')]=qs[_0xa0da('0x33')](_0x7d475a[_0xa0da('0x58')][_0xa0da('0x33')]);}_0x2fd145[_0xa0da('0x5f')]=qs[_0xa0da('0x60')](_0x7d475a[_0xa0da('0x58')]['sort']);_0x2fd145[_0xa0da('0x61')]=qs['filters'](_['pick'](_0x7d475a[_0xa0da('0x58')],_0x134af8['filters']),_0x1e7ced);var _0x346575=[];var _0xb55224=squel[_0xa0da('0x62')]()[_0xa0da('0x63')]('id')[_0xa0da('0x63')](_0xa0da('0x3b'))[_0xa0da('0x63')](_0xa0da('0x64'))[_0xa0da('0x65')](_0xa0da('0x66'));var _0x5d0812=squel[_0xa0da('0x62')]()['field'](_0xa0da('0x67'))[_0xa0da('0x63')](_0xa0da('0x68'))[_0xa0da('0x63')](_0xa0da('0x69'))[_0xa0da('0x65')](_0xa0da('0x6a'),'ui')[_0xa0da('0x6b')]('users','u',_0xa0da('0x6c'));var _0xde2ebd=squel[_0xa0da('0x62')]()[_0xa0da('0x65')]('chat_interactions','i')[_0xa0da('0x6b')]('cm_contacts','c',_0xa0da('0x6d'))[_0xa0da('0x6b')](_0xa0da('0x6e'),'o','o.id\x20=\x20i.UserId')[_0xa0da('0x6b')](_0xa0da('0x6f'),'a',_0xa0da('0x70'))[_0xa0da('0x6b')]('chat_messages','me',_0xa0da('0x71'))['left_join'](_0xa0da('0x72'),'it',_0xa0da('0x73'))[_0xa0da('0x6b')](_0xa0da('0x66'),'t','t.id\x20=\x20it.TagId');var _0x1bf5ee=squel[_0xa0da('0x74')]();var _0x3d3ee8=[];var _0x46485a=squel[_0xa0da('0x74')]();var _0x2c30ce;if(_0x7d475a[_0xa0da('0x58')][_0xa0da('0x75')]){_0x2c30ce=as[_0xa0da('0x76')](_0x7d475a[_0xa0da('0x58')][_0xa0da('0x75')]);var _0x949651=_0x2c30ce[_0xa0da('0x77')];for(var _0x1190ab=0x0;_0x1190ab<_0x2c30ce[_0xa0da('0x78')][_0xa0da('0x5c')];_0x1190ab++){var _0x42af4e=_0x2c30ce[_0xa0da('0x78')][_0x1190ab];var _0x1a4c4d='i';var _0x3be496=_[_0xa0da('0x79')](_0x1e7ced,['name',_0x42af4e['field']]);if(!_0x3be496){switch(_0x42af4e[_0xa0da('0x63')]){case _0xa0da('0x7a'):if(_0x42af4e[_0xa0da('0x7b')]==0x1){_0xde2ebd[_0xa0da('0x7c')]('`'+_0x42af4e[_0xa0da('0x63')]+_0xa0da('0x7d'));}else{_0xde2ebd[_0xa0da('0x7c')]('`'+_0x42af4e['field']+_0xa0da('0x7e'));}break;case _0xa0da('0x7f'):if(_0x42af4e[_0xa0da('0x80')]===_0xa0da('0x81')){if(_0x42af4e['value'][_0xa0da('0x82')]('\x20')[_0xa0da('0x5c')]>0x1){_0x1bf5ee[_0x949651]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa0da('0x83')](_0x42af4e[_0xa0da('0x7b')]),null);}else{var _0x259296='%'+_0x42af4e['value']+'%';_0x1bf5ee[_0x949651]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x259296,_0x259296,_0x259296);}}else{_0x3be496=_['find'](_0x1e7ced,[_0xa0da('0x3b'),_0xa0da('0x84')]);_0x42af4e['field']=_0xa0da('0x84');_0x2f36b1=as[_0xa0da('0x85')](_0x1a4c4d,_0x3be496['type'],_0x42af4e);_0x1bf5ee[_0x949651](_0x2f36b1[_0xa0da('0x86')],_0x2f36b1['value'][_0xa0da('0x87')],_0x2f36b1[_0xa0da('0x7b')][_0xa0da('0x31')]);}break;case _0xa0da('0x88'):var _0x375718=_0x42af4e[_0xa0da('0x7b')]['split'](',')[_0xa0da('0x44')](function(_0x5968c2){return Number(_0x5968c2);});_0x375718[_0xa0da('0x89')](function(_0x3934f2){_0x46485a['or'](_0xa0da('0x8a'),'%,'+_0x3934f2+',%');});_0x3d3ee8=_['union'](_0x3d3ee8,_0x375718);break;case'User':if(_0x42af4e['operator']===_0xa0da('0x81')){_0x1bf5ee[_0x949651]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x42af4e[_0xa0da('0x7b')]+'%',null);}else{_0x3be496=_['find'](_0x1e7ced,[_0xa0da('0x3b'),_0xa0da('0x4f')]);_0x42af4e[_0xa0da('0x63')]=_0xa0da('0x4f');_0x2f36b1=as[_0xa0da('0x85')](_0x1a4c4d,_0x3be496['type'],_0x42af4e);_0x1bf5ee[_0x949651](_0x2f36b1[_0xa0da('0x86')],_0x2f36b1['value'][_0xa0da('0x87')],_0x2f36b1[_0xa0da('0x7b')][_0xa0da('0x31')]);}break;case _0xa0da('0x3f'):_0x2f36b1=as[_0xa0da('0x85')]('me',null,_0x42af4e);_0x1bf5ee[_0x949651](_0x2f36b1['text'],_0x2f36b1['value'][_0xa0da('0x87')],_0x2f36b1['value'][_0xa0da('0x31')]);break;}}else{var _0x2f36b1=as[_0xa0da('0x85')](_0x1a4c4d,_0x3be496['type'],_0x42af4e);_0x1bf5ee[_0x949651](_0x2f36b1[_0xa0da('0x86')],_0x2f36b1['value']['start'],_0x2f36b1[_0xa0da('0x7b')][_0xa0da('0x31')]);}}}else{var _0x5a7e6f=_(_0x7d475a[_0xa0da('0x58')])[_0xa0da('0x57')]()[_0xa0da('0x44')](function(_0x35a669){return _[_0xa0da('0x8b')](_0x1e7ced,[_0xa0da('0x3b'),_0x35a669])?_0x35a669:undefined;})['compact']()['value']();if(!_[_0xa0da('0x8c')](_0x5a7e6f)){_0x5a7e6f['forEach'](function(_0x4cfb8e){if(_0x4cfb8e===_0xa0da('0x8d')){_0xde2ebd[_0xa0da('0x61')](_0xa0da('0x8e'),[][_0xa0da('0x8f')](_0x7d475a[_0xa0da('0x58')][_0x4cfb8e]));}else if(_0x4cfb8e==='createdAt'){var _0x3ef66c=JSON[_0xa0da('0x90')](_0x7d475a[_0xa0da('0x58')][_0x4cfb8e])['$gte'];var _0x4a1f23=JSON['parse'](_0x7d475a[_0xa0da('0x58')][_0x4cfb8e])[_0xa0da('0x91')];_0xde2ebd['where'](_0xa0da('0x92'),_0x3ef66c,_0x4a1f23);}else{if(_0x7d475a[_0xa0da('0x58')][_0x4cfb8e]==='null'){_0xde2ebd['where']('i.'+_0x4cfb8e+_0xa0da('0x93'));}else{_0xde2ebd[_0xa0da('0x61')]('i.'+_0x4cfb8e+'\x20=\x20?',_0x7d475a[_0xa0da('0x58')][_0x4cfb8e]);}}});}if(_0x7d475a[_0xa0da('0x58')][_0xa0da('0x94')]){if(_0x7d475a[_0xa0da('0x58')][_0xa0da('0x94')]==0x1){_0xde2ebd[_0xa0da('0x7c')](_0xa0da('0x95'));}else{_0xde2ebd[_0xa0da('0x7c')](_0xa0da('0x96'));}}if(_0x7d475a[_0xa0da('0x58')][_0xa0da('0x97')]){_0x3d3ee8=_['isArray'](_0x7d475a['query'][_0xa0da('0x97')])?_0x7d475a[_0xa0da('0x58')][_0xa0da('0x97')]:new Array(_0x7d475a[_0xa0da('0x58')]['tag']);_0x3d3ee8[_0xa0da('0x89')](function(_0x1db5cf){_0x46485a['or'](_0xa0da('0x8a'),'%,'+_0x1db5cf+',%');});}if(_0x7d475a[_0xa0da('0x58')][_0xa0da('0x98')]){var _0x4994e0=_0x7d475a[_0xa0da('0x58')][_0xa0da('0x98')]['replace']('\x5c','\x5c\x5c')[_0xa0da('0x99')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4994e0)){_0x1bf5ee['or'](_0xa0da('0x9a'),_0x4994e0+'%');}else{_0x1bf5ee['or'](_0xa0da('0x9b'),qs['getFullTextValue'](_0x4994e0))['or'](_0xa0da('0x9c'),_0x4994e0+'%');}}}_0xde2ebd[_0xa0da('0x61')](_0x1bf5ee);_0xde2ebd[_0xa0da('0x9d')](_0xa0da('0x9e'));var _0x304fc6={'type':db['Sequelize'][_0xa0da('0x9f')]['SELECT'],'raw':!![]};var _0xfae3f5=_0xde2ebd[_0xa0da('0xa0')]();_0xfae3f5['field'](_0xa0da('0x9e'));_0xfae3f5[_0xa0da('0x63')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa0da('0x7a'));if(_0x2fd145[_0xa0da('0x5f')]){_0x2fd145[_0xa0da('0x5f')][_0xa0da('0x89')](function(_0x707a6){var _0x1fa9ea=_0x707a6[0x0]===_0xa0da('0xa1')?_0x707a6[0x0]:'i.'+_0x707a6[0x0];_0xde2ebd['order'](_0x1fa9ea,_0x707a6[0x1]===_0xa0da('0xa2')?![]:!![]);});}if(!_[_0xa0da('0x8c')](_0x3d3ee8)){_0xde2ebd[_0xa0da('0x7c')](_0x46485a);_0xfae3f5[_0xa0da('0x61')](_0xa0da('0xa3'),_0x3d3ee8);}BPromise[_0xa0da('0xa4')]()['then'](function(){if(!_0x2c30ce){if(_0x7d475a[_0xa0da('0x58')]['ChatWebsiteId'])return;_0xfae3f5[_0xa0da('0x61')](_0xa0da('0xa5'));_0xde2ebd['where'](_0xa0da('0xa5'));return;}if(_0x7d475a[_0xa0da('0xa6')][_0xa0da('0xa7')]!==_0xa0da('0x41'))return;return _0x7d475a[_0xa0da('0xa6')][_0xa0da('0xa8')]({'attributes':['id'],'raw':!![]})[_0xa0da('0x24')](function(_0x4b42dd){if(_[_0xa0da('0x8c')](_0x4b42dd)){_0xfae3f5[_0xa0da('0x61')](_0xa0da('0xa9'));_0xde2ebd[_0xa0da('0x61')](_0xa0da('0xa9'));}else{_0xfae3f5['where'](_0xa0da('0x8e'),_[_0xa0da('0x44')](_0x4b42dd,'id'));_0xde2ebd[_0xa0da('0x61')](_0xa0da('0x8e'),_['map'](_0x4b42dd,'id'));}});})['then'](function(){if(_0x7d475a['user'][_0xa0da('0xa7')]==='agent'&&!_0x2c30ce&&!_0x7d475a[_0xa0da('0x58')][_0xa0da('0x8d')])return[];return db[_0xa0da('0xaa')][_0xa0da('0x58')](_0xfae3f5['toString'](),_0x304fc6);})[_0xa0da('0x24')](function(_0x2f8258){_0x404f46[_0xa0da('0x34')]=_0x2f8258[_0xa0da('0x5c')];if(_0x404f46['count']===0x0)return[];return db['sequelize'][_0xa0da('0x58')](_0xb55224['toString'](),_0x304fc6)[_0xa0da('0x24')](function(_0x4f23f9){_0x346575=_[_0xa0da('0xab')](_0x4f23f9,'id');_0x304fc6=_[_0xa0da('0x3e')](_0x304fc6,{'model':db[_0xa0da('0x52')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x7d475a[_0xa0da('0x58')]['fields']){_0x2fd145[_0xa0da('0x5b')][_0xa0da('0x89')](function(_0x1dbe0a){_0xde2ebd['field']('i.'+_0x1dbe0a);});}else{_0xde2ebd['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa0da('0x7a'));_0xde2ebd['field'](_0xa0da('0xac'),_0xa0da('0xad'));_0xde2ebd[_0xa0da('0x63')](_0xa0da('0xae'),'Account.mandatoryDisposition');_0xde2ebd['field'](_0xa0da('0xaf'),_0xa0da('0xa1'));_0xde2ebd[_0xa0da('0x63')]('i.*');_0xde2ebd[_0xa0da('0x63')](_0xa0da('0xb0'),_0xa0da('0xb1'));_0xde2ebd['field'](_0xa0da('0xb2'),'Contact.lastName');_0xde2ebd[_0xa0da('0x63')](_0xa0da('0xb3'),'Contact.email');_0xde2ebd[_0xa0da('0x63')]('c.phone','Contact.phone');_0xde2ebd[_0xa0da('0x63')](_0xa0da('0xb4'),_0xa0da('0xb5'));_0xde2ebd[_0xa0da('0x63')](_0xa0da('0xb6'),_0xa0da('0xb7'));_0xde2ebd[_0xa0da('0x63')](_0xa0da('0xb8'),'Owner.fullname');_0xde2ebd[_0xa0da('0x63')](_0xa0da('0xb9'),'Owner.internal');_0xde2ebd[_0xa0da('0x63')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xa0da('0x46'));}if(_0x2fd145[_0xa0da('0x35')])_0xde2ebd[_0xa0da('0x35')](_0x2fd145[_0xa0da('0x35')]);if(_0x2fd145['offset'])_0xde2ebd[_0xa0da('0x33')](_0x2fd145['offset']);return db[_0xa0da('0xaa')][_0xa0da('0x58')](_0xde2ebd[_0xa0da('0xba')](),_0x304fc6);})[_0xa0da('0x24')](function(_0x3f190f){if(_0x3f190f[_0xa0da('0x5c')]>0x0)_0x5d0812['where'](_0xa0da('0xbb'),_['map'](_0x3f190f,'id'));return db[_0xa0da('0xaa')][_0xa0da('0x58')](_0x5d0812[_0xa0da('0xba')](),_0x304fc6)[_0xa0da('0x24')](function(_0x506c3f){var _0x5e364c=_[_0xa0da('0xbc')](_0x506c3f,_0xa0da('0xbd'));var _0xaa3cae=[];_0x3f190f[_0xa0da('0x89')](function(_0xa62f27){_0xaa3cae[_0xa0da('0x48')](updateChatInteraction(_0xa62f27,_0x346575,_0x5e364c));});return BPromise[_0xa0da('0xbe')](_0xaa3cae);});});})[_0xa0da('0x24')](function(_0x25ebed){_0x404f46['rows']=_0x25ebed;return _0x404f46;})['then'](respondWithFilteredResult(_0x3eced3,_0x2fd145))[_0xa0da('0x2e')](handleError(_0x3eced3,null));};exports[_0xa0da('0xbf')]=function(_0x3ed99e,_0x5492e4){var _0x10c05a={'raw':![],'where':{'id':_0x3ed99e[_0xa0da('0xc0')]['id']}},_0x5e0415={};_0x5e0415['model']=_[_0xa0da('0x57')](db[_0xa0da('0x52')][_0xa0da('0x53')]);_0x5e0415['query']=_['keys'](_0x3ed99e[_0xa0da('0x58')]);_0x5e0415[_0xa0da('0x59')]=_[_0xa0da('0x5a')](_0x5e0415[_0xa0da('0x56')],_0x5e0415[_0xa0da('0x58')]);_0x10c05a[_0xa0da('0x5b')]=_[_0xa0da('0x5a')](_0x5e0415[_0xa0da('0x56')],qs[_0xa0da('0xc1')](_0x3ed99e[_0xa0da('0x58')][_0xa0da('0xc1')]));_0x10c05a['attributes']=_0x10c05a['attributes'][_0xa0da('0x5c')]?_0x10c05a['attributes']:_0x5e0415[_0xa0da('0x56')];if(_0x3ed99e[_0xa0da('0x58')][_0xa0da('0xc2')]){_0x10c05a[_0xa0da('0xc3')]=[{'all':!![]}];}_0x10c05a=_[_0xa0da('0x3e')]({},_0x10c05a,_0x3ed99e[_0xa0da('0xc4')]);return db[_0xa0da('0x52')][_0xa0da('0x79')](_0x10c05a)[_0xa0da('0x24')](handleEntityNotFound(_0x5492e4,null))['then'](respondWithResult(_0x5492e4,null))[_0xa0da('0x2e')](handleError(_0x5492e4,null));};exports['create']=function(_0x38cdd7,_0x18cbdb){return db['ChatInteraction'][_0xa0da('0xc5')](_0x38cdd7[_0xa0da('0x3f')],{})[_0xa0da('0x24')](respondWithResult(_0x18cbdb,0xc9))[_0xa0da('0x2e')](handleError(_0x18cbdb,null));};exports['update']=function(_0x5d1f00,_0x289aca){if(_0x5d1f00[_0xa0da('0x3f')]['id']){delete _0x5d1f00[_0xa0da('0x3f')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x5d1f00[_0xa0da('0xc0')]['id']}})[_0xa0da('0x24')](handleEntityNotFound(_0x289aca,null))[_0xa0da('0x24')](saveUpdates(_0x5d1f00[_0xa0da('0x3f')],null))[_0xa0da('0x24')](respondWithResult(_0x289aca,null))['catch'](handleError(_0x289aca,null));};exports[_0xa0da('0x39')]=function(_0x4dcf88,_0x2aeb73){return db['ChatInteraction'][_0xa0da('0x79')]({'where':{'id':_0x4dcf88[_0xa0da('0xc0')]['id']}})[_0xa0da('0x24')](handleEntityNotFound(_0x2aeb73,null))[_0xa0da('0x24')](removeEntity(_0x2aeb73,null))['catch'](handleError(_0x2aeb73,null));};exports[_0xa0da('0xc6')]=function(_0x3ce1df,_0x1f05cc){return db[_0xa0da('0x52')][_0xa0da('0xc6')]()['then'](respondWithResult(_0x1f05cc,null))[_0xa0da('0x2e')](handleError(_0x1f05cc,null));};exports['createVidaooSession']=function(_0x466c8d,_0x2aeb7c){var _0x1d522c=_0x466c8d[_0xa0da('0xc0')]['id'];var _0x4435d9;var _0x53b052;var _0x51ae05;return db[_0xa0da('0x52')][_0xa0da('0xc7')]({'where':{'id':_0x1d522c}})[_0xa0da('0x24')](function(_0x432775){_0x4435d9=_0x432775;return db[_0xa0da('0xc8')][_0xa0da('0xc7')]({'where':{'id':_0x432775[_0xa0da('0x8d')]},'attributes':['id',_0xa0da('0xc9'),'vidaooEscalation',_0xa0da('0xca'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0xa0da('0x24')](function(_0xc8ba2b){if(_0xc8ba2b&&_0xc8ba2b['vidaooApiKey']&&_0xc8ba2b[_0xa0da('0xcb')]){_0x53b052=_0xc8ba2b;var _0x5dc58e={'interaction':{'id':_0x1d522c},'agent':{'id':_0x466c8d[_0xa0da('0xa6')]['id'],'name':_0x466c8d[_0xa0da('0xa6')][_0xa0da('0x3b')],'fullname':_0x466c8d[_0xa0da('0xa6')]['fullname'],'email':_0x466c8d[_0xa0da('0xa6')]['email']},'contact':_0x466c8d['body'][_0xa0da('0x40')],'account':_0x466c8d['body'][_0xa0da('0xcc')]};var _0x4285bf={'rejectUnauthorized':![],'method':_0xa0da('0xcd'),'url':_0xa0da('0xce'),'headers':{'X-APIKEY':_0xc8ba2b[_0xa0da('0xc9')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x466c8d['user'][_0xa0da('0xcf')]],'buttons':null,'topic':_0x53b052[_0xa0da('0xca')],'note':_[_0xa0da('0xd0')](_0x53b052[_0xa0da('0xd1')])?null:getMustacheRender(_0x53b052['vidaooNote'],_0x5dc58e),'metadata':null},'redirect':_0xa0da('0xd2'),'json':!![]};try{if(!_[_0xa0da('0xd0')](_0x53b052['vidaooMetadata'])){var _0x217dae=getMustacheRender(_0x53b052[_0xa0da('0xd3')],_0x5dc58e);var _0x449cd5=JSON['parse'](_0x217dae);_0x4285bf['body'][_0xa0da('0xd4')]=_0x449cd5;}}catch(_0x22bb61){throw new db[(_0xa0da('0xd5'))]['ValidationError'](_0xa0da('0xd6'));}return rp(_0x4285bf);}else{throw new db[(_0xa0da('0xd5'))][(_0xa0da('0xd7'))](_0xa0da('0xd8'));}})['then'](function(_0x2cfe34){_0x51ae05=_0x2cfe34;if(_0x51ae05['id']){var _0x16353a={'body':_0x51ae05[_0xa0da('0xd9')],'ChatWebsiteId':_0x53b052['id'],'ChatInteractionId':_0x4435d9['id'],'direction':'out','UserId':_0x466c8d[_0xa0da('0xa6')]['id']};return db['ChatMessage'][_0xa0da('0xc5')](_0x16353a,{});}else{throw new db[(_0xa0da('0xd5'))][(_0xa0da('0xd7'))](_0xa0da('0xda'));}})[_0xa0da('0x24')](function(){return _0x4435d9[_0xa0da('0xdb')]({'vidaooSessionId':_0x51ae05['id']});})[_0xa0da('0x24')](respondWithResult(_0x2aeb7c,null))['catch'](handleError(_0x2aeb7c,null));};exports[_0xa0da('0xdc')]=function(_0x2b9c36,_0x2241b6){if(_0x2b9c36[_0xa0da('0x3f')]['id']){delete _0x2b9c36[_0xa0da('0x3f')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x2b9c36['params']['id']},'include':[{'model':db[_0xa0da('0xdd')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x2241b6,null))['then'](saveUpdates(_0x2b9c36[_0xa0da('0x3f')],null))[_0xa0da('0x24')](respondWithResult(_0x2241b6,null))[_0xa0da('0x2e')](handleError(_0x2241b6,null));};exports['abandon']=function(_0x4b86ee,_0x322e31,_0x118f83){if(_0x4b86ee[_0xa0da('0x3f')]['id']){delete _0x4b86ee[_0xa0da('0x3f')]['id'];}return db[_0xa0da('0x52')][_0xa0da('0x79')]({'where':{'id':_0x4b86ee[_0xa0da('0xc0')]['id']}})[_0xa0da('0x24')](function(_0xb423){if(!_0xb423){logger[_0xa0da('0x2b')](_0xa0da('0xde'),'abandon',0x194,_0xa0da('0xdf'));_0x322e31['sendStatus'](0x194);}else{if(_0xb423[_0xa0da('0x4f')]){throw new db[(_0xa0da('0xd5'))][(_0xa0da('0xd7'))](_0xa0da('0xe0'));}}return _0xb423;})['then'](function(_0x554b01){if(_0x554b01){return _0x554b01[_0xa0da('0xe1')]({'closed':_0x4b86ee['body']['closed'],'disposition':_0x4b86ee[_0xa0da('0x3f')][_0xa0da('0xe2')]})[_0xa0da('0x24')](function(_0x226aa8){return _0x226aa8;});}})[_0xa0da('0x24')](function(_0x1432ad){return respondWithRpcPromise(_0xa0da('0xe3'),_0xa0da('0xe4'),_0x4b86ee[_0xa0da('0x3f')],client9004);})[_0xa0da('0x24')](respondWithResult(_0x322e31,null))['catch'](handleError(_0x322e31,null));};exports['attachmentUpload']=function(_0x5db1fb,_0x58e552,_0x2602eb){_0x5db1fb['body'][_0xa0da('0x3b')]=_0x5db1fb[_0xa0da('0xe5')][_0xa0da('0xe6')];_0x5db1fb[_0xa0da('0x3f')][_0xa0da('0xe7')]=_0x5db1fb['file']['filename'];_0x5db1fb[_0xa0da('0x3f')][_0xa0da('0xe8')]=_0x5db1fb[_0xa0da('0xe5')][_0xa0da('0xe9')];return db[_0xa0da('0xea')][_0xa0da('0xc5')](_0x5db1fb['body'])['then'](respondWithResult(_0x58e552,0xc9))[_0xa0da('0x2e')](handleError(_0x58e552,null));};exports[_0xa0da('0xeb')]=function(_0x37f598,_0x4a82d9,_0x4b0917){return db[_0xa0da('0x52')][_0xa0da('0xc7')]({'where':{'id':_0x37f598['params']['id']},'raw':!![]})[_0xa0da('0x24')](handleEntityNotFound(_0x4a82d9,null))[_0xa0da('0x24')](function(_0x4f3af8){if(_0x4f3af8){if(_0x4f3af8[_0xa0da('0x4e')]){return _0x4a82d9[_0xa0da('0x30')](0x193)[_0xa0da('0x32')]({'status':0x193,'message':_0xa0da('0xec')});}return db[_0xa0da('0xea')]['findOne']({'where':{'id':_0x37f598[_0xa0da('0x58')][_0xa0da('0xed')]},'raw':!![]})[_0xa0da('0x24')](handleEntityNotFound(_0x4a82d9,null));}})[_0xa0da('0x24')](function(_0x577423){if(_0x577423){var _0x212fe7=_0x577423[_0xa0da('0xee')]!==null;var _0x2b8d33=path[_0xa0da('0xef')](config[_0xa0da('0xf0')],_0xa0da('0xf1'));if(_0x212fe7){_0x2b8d33=path[_0xa0da('0xef')](_0x2b8d33,'offline-chat/');}var _0x1547a8=path['join'](_0x2b8d33,_0x577423[_0xa0da('0xe7')]);return _0x4a82d9['download'](_0x1547a8);}})[_0xa0da('0x2e')](handleError(_0x4a82d9,null));};exports['close']=function(_0x356d14,_0x4bbe38){var _0x4aa632=null;var _0x3457f0=null;var _0x17bd67=null;var _0x4b3f43=null;if(_0x356d14[_0xa0da('0x3f')]['id']){delete _0x356d14['body']['id'];}if(_0x356d14['body']['mailTranscript']){_0x4b3f43=path[_0xa0da('0xef')](config[_0xa0da('0xf0')],_0xa0da('0xf2'),util[_0xa0da('0xf3')](_0xa0da('0xf4'),Date['now']()));_0x356d14['body'][_0xa0da('0xf5')]=_0x4b3f43;}return db[_0xa0da('0x52')][_0xa0da('0x79')]({'where':{'id':_0x356d14[_0xa0da('0xc0')]['id']},'include':[{'model':db[_0xa0da('0xf6')],'as':'Messages','include':[{'model':db[_0xa0da('0xf7')],'as':_0xa0da('0xf7')}]}]})[_0xa0da('0x24')](handleEntityNotFound(_0x4bbe38,null))[_0xa0da('0x24')](saveUpdates(_0x356d14['body'],null))[_0xa0da('0x24')](function(_0x100d2b){if(_0x100d2b){_0x4aa632=_0x100d2b;return db[_0xa0da('0xc8')][_0xa0da('0x79')]({'where':{'id':_0x4aa632[_0xa0da('0x8d')]}});}})['then'](function(_0x3b2379){if(_0x3b2379){_0x17bd67=_0x3b2379;return db['CmContact'][_0xa0da('0x79')]({'where':{'id':_0x4aa632[_0xa0da('0x84')]}});}})[_0xa0da('0x24')](function(_0x5eeaed){if(_0x5eeaed){_0x3457f0=_0x5eeaed;if(_0x4b3f43){var _0x8f47af=null;for(var _0x5bb3e9=0x1;_0x5bb3e9<_0x4aa632[_0xa0da('0xf8')][_0xa0da('0x5c')];++_0x5bb3e9){_0x8f47af=_0x4aa632['Messages'][_0x5bb3e9];var _0x531062=_0x8f47af[_0xa0da('0x4f')]?util[_0xa0da('0xf3')]('%s%d',_0x17bd67['agentAlias'],_0x8f47af[_0xa0da('0x4f')]):_0xa0da('0xf9');var _0xec3d7a=_0x356d14[_0xa0da('0x3f')]['customer']||util[_0xa0da('0xf3')](_0xa0da('0xfa'),_0xa0da('0xfb'),_0x8f47af[_0xa0da('0x84')]);switch(_0x17bd67['agentIdentifier']){case _0xa0da('0xfc'):_0x531062=_0x8f47af[_0xa0da('0x4f')]?util[_0xa0da('0xf3')](_0xa0da('0xfa'),_0x17bd67['agentAlias'],_0x8f47af[_0xa0da('0x4f')]):_0xa0da('0xf9');break;case _0xa0da('0xfd'):_0x531062=_0x8f47af[_0xa0da('0x4f')]?_0x8f47af[_0xa0da('0xf7')][_0xa0da('0xfe')]||_0x8f47af['User'][_0xa0da('0x45')]:'System';break;case _0xa0da('0xff'):_0x531062=_0x8f47af[_0xa0da('0x4f')]?_0x8f47af[_0xa0da('0xf7')][_0xa0da('0x45')]:_0xa0da('0xf9');break;default:_0x531062=_0x8f47af[_0xa0da('0x4f')]?util['format'](_0xa0da('0xfa'),_0x17bd67['agentAlias'],_0x8f47af['UserId']):'System';}var _0x5e2406=util[_0xa0da('0xf3')](_0xa0da('0x100'),moment(_0x8f47af['createdAt'])['format'](_0xa0da('0x101')),_0x8f47af[_0xa0da('0x102')]==='in'?_0xec3d7a:_0x531062,_0x8f47af[_0xa0da('0x3f')]);if(!_0x8f47af[_0xa0da('0x103')]){fs['appendFileSync'](_0x4b3f43,_0x5e2406);}}return db[_0xa0da('0x104')][_0xa0da('0xc7')]({'where':{'service':!![]},'include':[{'model':db[_0xa0da('0x105')],'as':_0xa0da('0x106'),'raw':!![]}]});}}})[_0xa0da('0x24')](function(_0x2f1f07){if(_0x2f1f07&&_0x2f1f07[_0xa0da('0x106')]&&_0x356d14[_0xa0da('0x3f')]){var _0x22654d={'tls':{'rejectUnauthorized':![]}};if(_0x2f1f07[_0xa0da('0x106')][_0xa0da('0x107')]){_0x22654d['service']=_0x2f1f07[_0xa0da('0x106')]['service'];}else{_0x22654d[_0xa0da('0x108')]=_0x2f1f07[_0xa0da('0x106')][_0xa0da('0x108')];_0x22654d[_0xa0da('0x109')]=_0x2f1f07[_0xa0da('0x106')]['port'];_0x22654d[_0xa0da('0x10a')]=_0x2f1f07[_0xa0da('0x106')][_0xa0da('0x10a')];}if(_0x2f1f07[_0xa0da('0x106')]['authentication']){_0x22654d[_0xa0da('0x10b')]={'user':_0x2f1f07['Smtp'][_0xa0da('0xa6')],'pass':_0x2f1f07['Smtp']['pass']};}return respondWithRpcPromise(_0xa0da('0x10c'),'sendMail',{'account':_0x22654d,'message':{'from':util[_0xa0da('0xf3')]('\x22%s\x22\x20<%s>',_0x2f1f07['name'],_0x2f1f07[_0xa0da('0xcf')]||_0x2f1f07[_0xa0da('0x106')][_0xa0da('0xa6')]),'to':_0x356d14[_0xa0da('0x3f')]['mailTranscript'],'subject':_0xa0da('0x10d'),'text':util[_0xa0da('0xf3')](_0xa0da('0x10e'),_0x356d14[_0xa0da('0x3f')]['mailTranscript']),'attachments':[{'path':_0x4b3f43}]}})[_0xa0da('0x24')](function(){return _0x4aa632;})['catch'](function(_0x3bd31d){console[_0xa0da('0x2b')](_0x3bd31d);});}else{return _0x4aa632;}})[_0xa0da('0x24')](respondWithStatusCode(_0x4bbe38,0xc8))[_0xa0da('0x2e')](handleError(_0x4bbe38,null));};exports['addMessage']=function(_0x1ba9c0,_0x1777f7,_0x24ee7c){return db[_0xa0da('0xf6')][_0xa0da('0x79')]({'where':{'id':_0x1ba9c0[_0xa0da('0xc0')]['id']}})[_0xa0da('0x24')](handleEntityNotFound(_0x1777f7,null))[_0xa0da('0x24')](function(_0x235680){if(_0x235680){return _0x235680[_0xa0da('0x10f')](_0x1ba9c0[_0xa0da('0x3f')][_0xa0da('0x110')],_[_0xa0da('0x111')](_0x1ba9c0[_0xa0da('0x3f')],[_0xa0da('0x110'),'id'])||{});}})[_0xa0da('0x24')](respondWithResult(_0x1777f7,null))[_0xa0da('0x2e')](handleError(_0x1777f7,null));};exports[_0xa0da('0x112')]=function(_0x5e145e,_0x41252a,_0xfc6929){var _0x57dc3b={'raw':![],'where':{}};var _0x34a801={};var _0x3d7a86={'count':0x0,'rows':[]};return db[_0xa0da('0x52')][_0xa0da('0xc7')]({'where':{'id':_0x5e145e[_0xa0da('0xc0')]['id']}})['then'](handleEntityNotFound(_0x41252a,null))[_0xa0da('0x24')](function(_0x451369){if(_0x451369){_0x34a801['model']=_[_0xa0da('0x57')](db[_0xa0da('0xf6')][_0xa0da('0x53')]);_0x34a801['query']=_[_0xa0da('0x57')](_0x5e145e[_0xa0da('0x58')]);_0x34a801['filters']=_[_0xa0da('0x5a')](_0x34a801[_0xa0da('0x56')],_0x34a801[_0xa0da('0x58')]);_0x57dc3b[_0xa0da('0x5b')]=_[_0xa0da('0x5a')](_0x34a801[_0xa0da('0x56')],qs[_0xa0da('0xc1')](_0x5e145e[_0xa0da('0x58')][_0xa0da('0xc1')]));_0x57dc3b['attributes']=_0x57dc3b['attributes'][_0xa0da('0x5c')]?_0x57dc3b['attributes']:_0x34a801[_0xa0da('0x56')];if(!_0x5e145e[_0xa0da('0x58')][_0xa0da('0x5d')](_0xa0da('0x5e'))){_0x57dc3b[_0xa0da('0x35')]=qs['limit'](_0x5e145e[_0xa0da('0x58')][_0xa0da('0x35')]);_0x57dc3b['offset']=qs['offset'](_0x5e145e[_0xa0da('0x58')][_0xa0da('0x33')]);}_0x57dc3b[_0xa0da('0x5f')]=qs[_0xa0da('0x60')](_0x5e145e[_0xa0da('0x58')][_0xa0da('0x60')]);_0x57dc3b[_0xa0da('0x61')]=qs[_0xa0da('0x59')](_[_0xa0da('0x113')](_0x5e145e[_0xa0da('0x58')],_0x34a801[_0xa0da('0x59')]));_0x57dc3b[_0xa0da('0x61')][_0xa0da('0xbd')]=_0x451369['id'];if(_0x5e145e[_0xa0da('0x58')][_0xa0da('0x98')]){_0x57dc3b[_0xa0da('0x61')]=_[_0xa0da('0x3e')](_0x57dc3b['where'],{'$or':_[_0xa0da('0x44')](_0x57dc3b['attributes'],function(_0x2bee5e){var _0x232d55={};_0x232d55[_0x2bee5e]={'$like':'%'+_0x5e145e['query']['filter']+'%'};return _0x232d55;})});}if(_0x5e145e[_0xa0da('0x58')][_0xa0da('0x114')]){var _0x1ebef5=_0x5e145e[_0xa0da('0x58')][_0xa0da('0x114')]['split'](',');var _0x523f73={};_0x523f73[_0x1ebef5[0x0]]={'$gte':moment(_0x1ebef5[0x1])[_0xa0da('0xf3')](_0xa0da('0x115'))};_0x57dc3b['where']=_[_0xa0da('0x3e')](_0x57dc3b[_0xa0da('0x61')],_0x523f73);}_0x57dc3b=_['merge']({},_0x57dc3b,_0x5e145e[_0xa0da('0xc4')]);return db['ChatMessage'][_0xa0da('0x34')]({'where':_0x57dc3b[_0xa0da('0x61')]})[_0xa0da('0x24')](function(_0x5165fc){_0x3d7a86['count']=_0x5165fc;if(_0x5e145e['query'][_0xa0da('0xc2')]){_0x57dc3b[_0xa0da('0xc3')]=[{'all':!![]}];}return db[_0xa0da('0xf6')]['findAll'](_0x57dc3b);})['then'](function(_0x2e687a){_0x3d7a86[_0xa0da('0x116')]=_0x2e687a;return _0x3d7a86;});}})[_0xa0da('0x24')](respondWithFilteredResult(_0x41252a,_0x57dc3b))[_0xa0da('0x2e')](handleError(_0x41252a,null));};exports['getMyMessages']=function(_0x2796f5,_0xe99c87,_0x16948f){var _0x23aab4={'where':{}},_0x223fb6={},_0x4a705d={'count':0x0,'rows':[]};return db[_0xa0da('0x52')]['findOne']({'where':{'id':_0x2796f5[_0xa0da('0xc0')]['id']}})[_0xa0da('0x24')](handleEntityNotFound(_0xe99c87,null))['then'](function(_0x40fc1f){if(_0x40fc1f){_0x223fb6[_0xa0da('0x56')]=_['keys'](db[_0xa0da('0xf6')]['rawAttributes']);_0x223fb6[_0xa0da('0x58')]=_['keys'](_0x2796f5[_0xa0da('0x58')]);_0x223fb6[_0xa0da('0x59')]=_['intersection'](_0x223fb6[_0xa0da('0x56')],_0x223fb6[_0xa0da('0x58')]);_0x23aab4['attributes']=_[_0xa0da('0x5a')](_0x223fb6['model'],qs[_0xa0da('0xc1')](_0x2796f5['query'][_0xa0da('0xc1')]));_0x23aab4['attributes']=_0x23aab4[_0xa0da('0x5b')][_0xa0da('0x5c')]?_0x23aab4[_0xa0da('0x5b')]:_0x223fb6[_0xa0da('0x56')];if(!_0x2796f5[_0xa0da('0x58')][_0xa0da('0x5d')](_0xa0da('0x5e'))){_0x23aab4[_0xa0da('0x35')]=qs[_0xa0da('0x35')](_0x2796f5['query']['limit']);_0x23aab4[_0xa0da('0x33')]=qs['offset'](_0x2796f5[_0xa0da('0x58')][_0xa0da('0x33')]);}_0x23aab4['order']=qs[_0xa0da('0x60')](_0x2796f5[_0xa0da('0x58')][_0xa0da('0x60')]);_0x23aab4[_0xa0da('0x61')]=qs[_0xa0da('0x59')](_[_0xa0da('0x113')](_0x2796f5[_0xa0da('0x58')],_0x223fb6[_0xa0da('0x59')]));_0x23aab4[_0xa0da('0x61')][_0xa0da('0xbd')]=_0x40fc1f['id'];if(_0x2796f5[_0xa0da('0x58')][_0xa0da('0x98')]){_0x23aab4[_0xa0da('0x61')]=_['merge'](_0x23aab4[_0xa0da('0x61')],{'$or':_[_0xa0da('0x44')](_0x23aab4[_0xa0da('0x5b')],function(_0x48376c){var _0x120205={};_0x120205[_0x48376c]={'$like':'%'+_0x2796f5[_0xa0da('0x58')][_0xa0da('0x98')]+'%'};return _0x120205;})});}_0x23aab4[_0xa0da('0x61')][_0xa0da('0x103')]=![];if(_0x2796f5['query']['id']){_0x23aab4['where']['id']={'$gt':_0x2796f5['query']['id']};}_0x23aab4=_[_0xa0da('0x3e')]({},_0x23aab4,_0x2796f5['options']);return db[_0xa0da('0xf6')]['count']({'where':_0x23aab4[_0xa0da('0x61')]})[_0xa0da('0x24')](function(_0x55e270){_0x4a705d['count']=_0x55e270;_0x23aab4['include']=[];if(_0x2796f5['query'][_0xa0da('0x117')]){_0x23aab4[_0xa0da('0xc3')][_0xa0da('0x48')]({'model':db[_0xa0da('0xf7')],'as':_0xa0da('0xf7'),'attributes':['id',_0xa0da('0x45'),_0xa0da('0xfe')]});}if(_0x2796f5[_0xa0da('0x58')][_0xa0da('0xc2')]){_0x23aab4['include']=[{'all':!![]}];}return db['ChatMessage'][_0xa0da('0x118')](_0x23aab4);})[_0xa0da('0x24')](function(_0x3e362b){_0x4a705d[_0xa0da('0x116')]=_0x3e362b;return _0x4a705d;});}})[_0xa0da('0x24')](respondWithFilteredResult(_0xe99c87,_0x23aab4))[_0xa0da('0x2e')](handleError(_0xe99c87,null));};exports[_0xa0da('0x119')]=function(_0x4e22a6,_0x1c4748,_0x22015f){return db['ChatInteraction'][_0xa0da('0x79')]({'where':{'id':_0x4e22a6[_0xa0da('0xc0')]['id']}})[_0xa0da('0x24')](handleEntityNotFound(_0x1c4748,null))[_0xa0da('0x24')](function(_0x248773){if(_0x248773){return _0x248773[_0xa0da('0x11a')](_0x4e22a6[_0xa0da('0x3f')][_0xa0da('0x110')],_['omit'](_0x4e22a6[_0xa0da('0x3f')],['ids','id'])||{})[_0xa0da('0x11b')](function(){return db[_0xa0da('0x88')][_0xa0da('0x118')]({'attributes':['id','name',_0xa0da('0x64')],'where':{'id':_0x4e22a6[_0xa0da('0x3f')][_0xa0da('0x110')]}});})[_0xa0da('0x24')](function(_0x2b2983){socket[_0xa0da('0x11c')](_0xa0da('0x11d'),{'id':Number(_0x4e22a6[_0xa0da('0xc0')]['id']),'tags':_0x2b2983||[]});return{'id':Number(_0x4e22a6['params']['id']),'tags':_0x2b2983||[]};});}})[_0xa0da('0x24')](respondWithResult(_0x1c4748,null))[_0xa0da('0x2e')](handleError(_0x1c4748,null));};exports[_0xa0da('0x11e')]=function(_0x5d2eb9,_0x61cce4,_0x5923d8){return db['ChatInteraction'][_0xa0da('0x79')]({'where':{'id':_0x5d2eb9[_0xa0da('0xc0')]['id']}})['then'](handleEntityNotFound(_0x61cce4,null))['then'](function(_0x3b958f){if(_0x3b958f){return _0x3b958f[_0xa0da('0x11e')](_0x5d2eb9['query'][_0xa0da('0x110')]);}})[_0xa0da('0x24')](respondWithStatusCode(_0x61cce4,null))[_0xa0da('0x2e')](handleError(_0x61cce4,null));};exports['download']=function(_0x1e85ed,_0x5881ec){var _0x76bc3c=moment()[_0xa0da('0x11f')]()[_0xa0da('0xba')]();var _0x219dbf=path[_0xa0da('0xef')](config[_0xa0da('0xf0')],_0xa0da('0x120'),_0xa0da('0x121'),_0xa0da('0x122'));var _0x8e0205=path[_0xa0da('0xef')](config[_0xa0da('0xf0')],_0xa0da('0x120'),'files',_0xa0da('0x123'));var _0x1300a4=path[_0xa0da('0xef')](_0x219dbf,_0x76bc3c);var _0x347541=util[_0xa0da('0xf3')](_0xa0da('0x124'),_0x1e85ed[_0xa0da('0xc0')]['id'],_0x76bc3c);var _0x5ef281=path[_0xa0da('0xef')](_0x219dbf,_0x347541);var _0x442305=[];_0x442305[_0xa0da('0x48')]({'model':db[_0xa0da('0xf7')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x442305[_0xa0da('0x48')]({'model':db[_0xa0da('0xdd')],'as':'Contact','attributes':['id',_0xa0da('0x125'),_0xa0da('0x126')],'raw':!![]});if(_0x1e85ed['query'][_0xa0da('0x123')]){_0x442305[_0xa0da('0x48')]({'model':db[_0xa0da('0xea')],'as':_0xa0da('0xea'),'raw':!![]});}var _0x18f0ac=[{'model':db[_0xa0da('0xf6')],'as':_0xa0da('0xf8'),'attributes':['id',_0xa0da('0x3f'),_0xa0da('0x127'),_0xa0da('0x102'),_0xa0da('0x103'),_0xa0da('0x94')],'include':_0x442305}];_0x18f0ac[_0xa0da('0x48')]({'model':db['ChatWebsite'],'as':_0xa0da('0x128'),'attributes':['id','name']});_0x18f0ac[_0xa0da('0x48')]({'model':db[_0xa0da('0xf7')],'as':_0xa0da('0x129'),'attributes':['id','fullname']});return db[_0xa0da('0x52')][_0xa0da('0x79')]({'where':{'id':_0x1e85ed[_0xa0da('0xc0')]['id']},'include':_0x18f0ac})[_0xa0da('0x24')](handleEntityNotFound(_0x5881ec,null))['then'](function(_0x54f122){if(_0x54f122){var _0x5002a9=_0x54f122[_0xa0da('0x12a')]({'plain':!![]});fs['mkdirSync'](_0x1300a4);var _0x58d2c0={'channel':_0xa0da('0x12b'),'account':_0x5002a9[_0xa0da('0x128')][_0xa0da('0x3b')],'agent':_0x5002a9[_0xa0da('0x129')]?_0x5002a9[_0xa0da('0x129')][_0xa0da('0x45')]:_0xa0da('0x12c'),'createdAt':moment(_0x5002a9[_0xa0da('0x127')])[_0xa0da('0xf3')](_0xa0da('0x115'))['toString'](),'closedAt':_0x5002a9['closed']?moment(_0x5002a9[_0xa0da('0x12d')])[_0xa0da('0xf3')](_0xa0da('0x115'))[_0xa0da('0xba')]():'','disposition':_0x5002a9[_0xa0da('0xe2')],'chatInfo':{'browser':_0x5002a9[_0xa0da('0x12e')],'os':_0x5002a9[_0xa0da('0x12f')],'referer':_0x5002a9[_0xa0da('0x130')],'customerIp':_0x5002a9[_0xa0da('0x131')],'customerPort':_0x5002a9[_0xa0da('0x132')]?_0x5002a9[_0xa0da('0x132')]:_0xa0da('0x12c')},'messages':_(_0x5002a9[_0xa0da('0xf8')])['tail']()[_0xa0da('0x98')]({'secret':![]})[_0xa0da('0x44')](function(_0x59e073){if(_0x59e073[_0xa0da('0xea')]){var _0x53afd8=path['join'](_0x8e0205,_0x59e073[_0xa0da('0xea')][_0xa0da('0xe7')]);if(fs[_0xa0da('0x133')](_0x53afd8)){fs['createReadStream'](_0x53afd8)[_0xa0da('0x134')](fs[_0xa0da('0x135')](path[_0xa0da('0xef')](_0x1300a4,_0x59e073['Attachment'][_0xa0da('0xe7')])));}}return{'date':moment(_0x59e073['createdAt'])[_0xa0da('0xf3')](_0xa0da('0x115'))[_0xa0da('0xba')](),'sender':_0x59e073[_0xa0da('0x102')]===_0xa0da('0x136')?_0x59e073[_0xa0da('0xf7')]?_0x59e073[_0xa0da('0xf7')][_0xa0da('0x45')]:_0xa0da('0xf9'):_0x59e073[_0xa0da('0x7f')][_0xa0da('0x125')]+(_0x59e073[_0xa0da('0x7f')][_0xa0da('0x126')]?'\x20'+_0x59e073[_0xa0da('0x7f')][_0xa0da('0x126')]:''),'body':_0x59e073[_0xa0da('0xea')]?_0x59e073[_0xa0da('0xea')][_0xa0da('0xe7')]:_0x59e073[_0xa0da('0x3f')],'direction':_0x59e073[_0xa0da('0x102')]===_0xa0da('0x136')?'A':'C','secret':_0x59e073['secret'],'read':_0x59e073[_0xa0da('0x94')],'attachment':_0x59e073[_0xa0da('0xea')]};})['value']()};return ejs['renderFile'](path[_0xa0da('0xef')](config['root'],_0xa0da('0x120'),_0xa0da('0x137'),'downloadInteraction.ejs'),{'interaction':_0x58d2c0})[_0xa0da('0x24')](function(_0x2ad434){var _0x24ef63=path[_0xa0da('0xef')](_0x1300a4,_0xa0da('0x138')+_0x5002a9['id']+'-'+_0x76bc3c+_0xa0da('0x139'));var _0x3bdf4c={'path':_0x24ef63,'channel':_0xa0da('0x12b'),'interactionId':_0x5002a9['id']};return pdf[_0xa0da('0x13a')](_0x2ad434,_0x3bdf4c);})[_0xa0da('0x24')](function(){return new BPromise(function(_0x208fc0,_0x6ade3f){zipdir(_0x1300a4,{'saveTo':_0x5ef281},function(_0x54469a,_0x32d939){if(_0x54469a)return _0x6ade3f(_0x54469a);return _0x208fc0(_0x32d939);});})[_0xa0da('0x24')](function(){return new BPromise(function(_0x23a75e,_0x56c0b6){rimraf(_0x1300a4,function(_0xa96834){if(_0xa96834)_0x56c0b6(_0xa96834);return _0x23a75e();});});})[_0xa0da('0x24')](function(){return _0x5881ec[_0xa0da('0x13b')](_0x5ef281,_0x347541,function(_0x5dca94){if(_0x5dca94){console[_0xa0da('0x13c')](_0xa0da('0x13d'),_0x5dca94);}else{fs[_0xa0da('0x13e')](_0x5ef281);}});});});}else{return _0x5881ec[_0xa0da('0x2f')](0xc8);}})[_0xa0da('0x2e')](handleError(_0x5881ec,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index d62e3b6..d1809a1 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 _0x3cdb=['length','emit','catch','hook','exports','events','ChatInteraction','setMaxListeners','update','remove','getUsers','map','findAll','then','setDataValue','unreadMessages'];(function(_0x5130aa,_0x441b77){var _0x125ec6=function(_0x4d3bf2){while(--_0x4d3bf2){_0x5130aa['push'](_0x5130aa['shift']());}};_0x125ec6(++_0x441b77);}(_0x3cdb,0x75));var _0xb3cd=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0x3cdb[_0x35ef6b];return _0x3ad145;};'use strict';var EventEmitter=require(_0xb3cd('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xb3cd('0x1')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb3cd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb3cd('0x3'),'afterDestroy':_0xb3cd('0x4')};function emitEvent(_0x4e71aa){return function(_0x877eb6,_0xa13a2a,_0x599ba7){_0x877eb6[_0xb3cd('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0xe44bf7){_0x877eb6['setDataValue']('Users',_0xe44bf7[_0xb3cd('0x6')](function(_0x3c2d45){return{'id':_0x3c2d45['id']};}));return ChatMessage[_0xb3cd('0x7')]({'where':{'ChatInteractionId':_0x877eb6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb3cd('0x8')](function(_0x4bd9be){_0x877eb6[_0xb3cd('0x9')](_0xb3cd('0xa'),_0x4bd9be[_0xb3cd('0xb')]);ChatInteractionEvents[_0xb3cd('0xc')](_0x4e71aa+':'+_0x877eb6['id'],_0x877eb6);ChatInteractionEvents['emit'](_0x4e71aa,_0x877eb6);_0x599ba7(null);})[_0xb3cd('0xd')](_0x599ba7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xb3cd('0xe')](e,emitEvent(event));}}module[_0xb3cd('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x702c=['catch','hasOwnProperty','exports','../../mysqldb','ChatInteraction','ChatMessage','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0x702c,0x103));var _0xc702=function(_0x45bff2,_0x1bbbf7){_0x45bff2=_0x45bff2-0x0;var _0x208b71=_0x702c[_0x45bff2];return _0x208b71;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xc702('0x0'))['db'][_0xc702('0x1')];var ChatMessage=require(_0xc702('0x0'))['db'][_0xc702('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc702('0x3'),'afterDestroy':_0xc702('0x4')};function emitEvent(_0xa469c3){return function(_0x4852f8,_0x484ab1,_0x61d95e){_0x4852f8[_0xc702('0x5')]({'attributes':['id'],'raw':!![]})[_0xc702('0x6')](function(_0x5eb161){_0x4852f8[_0xc702('0x7')](_0xc702('0x8'),_0x5eb161[_0xc702('0x9')](function(_0x4bc4f0){return{'id':_0x4bc4f0['id']};}));return ChatMessage[_0xc702('0xa')]({'where':{'ChatInteractionId':_0x4852f8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc702('0x6')](function(_0x5a2333){_0x4852f8[_0xc702('0x7')](_0xc702('0xb'),_0x5a2333['length']);ChatInteractionEvents['emit'](_0xa469c3+':'+_0x4852f8['id'],_0x4852f8);ChatInteractionEvents[_0xc702('0xc')](_0xa469c3,_0x4852f8);_0x61d95e(null);})[_0xc702('0xd')](_0x61d95e(null));};}for(var e in events){if(events[_0xc702('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xc702('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 45b95f3..8cd75e5 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 _0x21c5=['ChatInteraction','chat_interactions','changed','closed','closedAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./chatInteraction.attributes','exports'];(function(_0xf72786,_0x1a0ddd){var _0x113f3e=function(_0x57337a){while(--_0x57337a){_0xf72786['push'](_0xf72786['shift']());}};_0x113f3e(++_0x1a0ddd);}(_0x21c5,0xa7));var _0x521c=function(_0x57392e,_0x2ba38b){_0x57392e=_0x57392e-0x0;var _0x1f2183=_0x21c5[_0x57392e];return _0x1f2183;};'use strict';var _=require(_0x521c('0x0'));var util=require(_0x521c('0x1'));var logger=require(_0x521c('0x2'))('api');var moment=require(_0x521c('0x3'));var BPromise=require(_0x521c('0x4'));var rp=require(_0x521c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x521c('0x6'));var attributes=require(_0x521c('0x7'));module[_0x521c('0x8')]=function(_0x4e4164,_0x2fc3dc){return _0x4e4164['define'](_0x521c('0x9'),attributes,{'tableName':_0x521c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x28e264,_0x503ebe,_0x5a5c10){if(_0x28e264[_0x521c('0xb')](_0x521c('0xc'))){_0x28e264[_0x521c('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5a5c10(null,_0x28e264);}},'charset':_0x521c('0xe'),'collate':_0x521c('0xf')});}; \ No newline at end of file +var _0x4298=['bluebird','request-promise','rimraf','../../config/environment','exports','define','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','moment'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0x4298,0xa2));var _0x8429=function(_0x12574d,_0x140fc5){_0x12574d=_0x12574d-0x0;var _0x3b77f5=_0x4298[_0x12574d];return _0x3b77f5;};'use strict';var _=require(_0x8429('0x0'));var util=require(_0x8429('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8429('0x2'));var BPromise=require(_0x8429('0x3'));var rp=require(_0x8429('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8429('0x5'));var config=require(_0x8429('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x8429('0x7')]=function(_0x537df4,_0x197837){return _0x537df4[_0x8429('0x8')]('ChatInteraction',attributes,{'tableName':_0x8429('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x569e28,_0x3abaf0,_0x20156e){if(_0x569e28[_0x8429('0xa')](_0x8429('0xb'))){_0x569e28[_0x8429('0xc')]=moment()['format'](_0x8429('0xd'));}_0x20156e(null,_0x569e28);}},'charset':_0x8429('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index de82c81..9ee2ef7 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 _0x05a9=['stringify','error','code','message','info','UpdateChatInteraction','update','options','raw','attributes','limit','catch','ChatInteraction','find','where','body','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x246652,_0x1035a5){var _0x542681=function(_0x1003b2){while(--_0x1003b2){_0x246652['push'](_0x246652['shift']());}};_0x542681(++_0x1035a5);}(_0x05a9,0x1f2));var _0x905a=function(_0x314e5e,_0xdceb37){_0x314e5e=_0x314e5e-0x0;var _0x34cfe7=_0x05a9[_0x314e5e];return _0x34cfe7;};'use strict';var _=require('lodash');var util=require(_0x905a('0x0'));var moment=require(_0x905a('0x1'));var BPromise=require(_0x905a('0x2'));var rs=require(_0x905a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x905a('0x4'))['db'];var utils=require(_0x905a('0x5'));var logger=require(_0x905a('0x6'))(_0x905a('0x7'));var config=require(_0x905a('0x8'));var jayson=require(_0x905a('0x9'));var client=jayson[_0x905a('0xa')][_0x905a('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x905a('0xc')],{'host':_0x905a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x905a('0xc')]));require(_0x905a('0xe'))[_0x905a('0xf')](socket);function respondWithRpcPromise(_0x14c7cc,_0xffb6fd,_0x1cb52d){return new BPromise(function(_0x4a75ba,_0x5c0740){return client[_0x905a('0x10')](_0x14c7cc,_0x1cb52d)[_0x905a('0x11')](function(_0xeb2bfa){logger['info'](_0x905a('0x12'),_0xffb6fd,_0x905a('0x13'));logger[_0x905a('0x14')](_0x905a('0x15'),_0xffb6fd,_0x905a('0x13'),JSON[_0x905a('0x16')](_0xeb2bfa));if(_0xeb2bfa[_0x905a('0x17')]){if(_0xeb2bfa[_0x905a('0x17')][_0x905a('0x18')]===0x1f4){logger['error'](_0x905a('0x12'),_0xffb6fd,_0xeb2bfa[_0x905a('0x17')][_0x905a('0x19')]);return _0x5c0740(_0xeb2bfa['error'][_0x905a('0x19')]);}logger[_0x905a('0x17')](_0x905a('0x12'),_0xffb6fd,_0xeb2bfa[_0x905a('0x17')][_0x905a('0x19')]);return _0x4a75ba(_0xeb2bfa[_0x905a('0x17')]['message']);}else{logger[_0x905a('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0xffb6fd,_0x905a('0x13'));_0x4a75ba(_0xeb2bfa['result'][_0x905a('0x19')]);}})['catch'](function(_0xeb058b){logger['error']('ChatInteraction,\x20%s,\x20%s',_0xffb6fd,_0xeb058b);_0x5c0740(_0xeb058b);});});}exports[_0x905a('0x1b')]=function(_0xa1b5c){var _0x523580=this;return new Promise(function(_0x1af6c9,_0x4f7338){return db['ChatInteraction'][_0x905a('0x1c')](_0xa1b5c['body'],{'raw':_0xa1b5c[_0x905a('0x1d')]?_0xa1b5c[_0x905a('0x1d')][_0x905a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa1b5c[_0x905a('0x1d')]?_0xa1b5c[_0x905a('0x1d')]['where']||null:null,'attributes':_0xa1b5c[_0x905a('0x1d')]?_0xa1b5c[_0x905a('0x1d')][_0x905a('0x1f')]||null:null,'limit':_0xa1b5c[_0x905a('0x1d')]?_0xa1b5c['options'][_0x905a('0x20')]||null:null})[_0x905a('0x11')](function(_0x1626c8){logger['info']('UpdateChatInteraction',_0xa1b5c);logger[_0x905a('0x14')](_0x905a('0x1b'),_0xa1b5c,JSON['stringify'](_0x1626c8));_0x1af6c9(_0x1626c8);})[_0x905a('0x21')](function(_0x3cbadc){logger[_0x905a('0x17')](_0x905a('0x1b'),_0x3cbadc[_0x905a('0x19')],_0xa1b5c);_0x4f7338(_0x523580['error'](0x1f4,_0x3cbadc[_0x905a('0x19')]));});});};exports['AddTagsToChatInteraction']=function(_0x5b9f99){return new Promise(function(_0x2556ca,_0x4060c6){return db[_0x905a('0x22')][_0x905a('0x23')]({'where':_0x5b9f99[_0x905a('0x1d')]?_0x5b9f99[_0x905a('0x1d')][_0x905a('0x24')]||null:null})['then'](function(_0x1f988d){if(_0x1f988d){return _0x1f988d['addTags'](_0x5b9f99[_0x905a('0x25')]['ids'],_['omit'](_0x5b9f99[_0x905a('0x25')],['ids','id'])||{});}})[_0x905a('0x26')](function(_0x5c1d77){logger[_0x905a('0x1a')](_0x905a('0x27'),_0x5b9f99);logger[_0x905a('0x14')](_0x905a('0x27'),_0x5b9f99,JSON[_0x905a('0x16')](_0x5c1d77));_0x2556ca(_0x5c1d77);})[_0x905a('0x21')](function(_0x5a58ef){logger[_0x905a('0x17')](_0x905a('0x27'),_0x5a58ef[_0x905a('0x19')],_0x5b9f99);_0x4060c6(_this[_0x905a('0x17')](0x1f4,_0x5a58ef[_0x905a('0x19')]));});});}; \ No newline at end of file +var _0xdeba=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','ChatInteraction','update','body','options','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','find','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x23d50e,_0x378059){var _0x1ce88f=function(_0x33ea5b){while(--_0x33ea5b){_0x23d50e['push'](_0x23d50e['shift']());}};_0x1ce88f(++_0x378059);}(_0xdeba,0x155));var _0xadeb=function(_0x298077,_0x5c7d21){_0x298077=_0x298077-0x0;var _0x22a343=_0xdeba[_0x298077];return _0x22a343;};'use strict';var _=require('lodash');var util=require(_0xadeb('0x0'));var moment=require(_0xadeb('0x1'));var BPromise=require(_0xadeb('0x2'));var rs=require(_0xadeb('0x3'));var fs=require('fs');var Redis=require(_0xadeb('0x4'));var db=require(_0xadeb('0x5'))['db'];var utils=require(_0xadeb('0x6'));var logger=require(_0xadeb('0x7'))('rpc');var config=require(_0xadeb('0x8'));var jayson=require(_0xadeb('0x9'));var client=jayson[_0xadeb('0xa')][_0xadeb('0xb')]({'port':0x232a});config[_0xadeb('0xc')]=_[_0xadeb('0xd')](config['redis'],{'host':_0xadeb('0xe'),'port':0x18eb});var socket=require(_0xadeb('0xf'))(new Redis(config[_0xadeb('0xc')]));require('./chatInteraction.socket')[_0xadeb('0x10')](socket);function respondWithRpcPromise(_0x2657cc,_0x450b11,_0x1e088b){return new BPromise(function(_0x47c2ed,_0x192f1b){return client[_0xadeb('0x11')](_0x2657cc,_0x1e088b)[_0xadeb('0x12')](function(_0x3398ea){logger[_0xadeb('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x450b11,_0xadeb('0x14'));logger[_0xadeb('0x15')](_0xadeb('0x16'),_0x450b11,'request\x20sent',JSON[_0xadeb('0x17')](_0x3398ea));if(_0x3398ea[_0xadeb('0x18')]){if(_0x3398ea[_0xadeb('0x18')][_0xadeb('0x19')]===0x1f4){logger[_0xadeb('0x18')](_0xadeb('0x1a'),_0x450b11,_0x3398ea['error'][_0xadeb('0x1b')]);return _0x192f1b(_0x3398ea[_0xadeb('0x18')][_0xadeb('0x1b')]);}logger['error'](_0xadeb('0x1a'),_0x450b11,_0x3398ea[_0xadeb('0x18')][_0xadeb('0x1b')]);return _0x47c2ed(_0x3398ea['error']['message']);}else{logger['info'](_0xadeb('0x1a'),_0x450b11,_0xadeb('0x14'));_0x47c2ed(_0x3398ea[_0xadeb('0x1c')]['message']);}})[_0xadeb('0x1d')](function(_0xcf107){logger[_0xadeb('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x450b11,_0xcf107);_0x192f1b(_0xcf107);});});}exports['UpdateChatInteraction']=function(_0x386bc4){var _0x21481d=this;return new Promise(function(_0x5655f4,_0x1ab8a0){return db[_0xadeb('0x1e')][_0xadeb('0x1f')](_0x386bc4[_0xadeb('0x20')],{'raw':_0x386bc4[_0xadeb('0x21')]?_0x386bc4[_0xadeb('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x386bc4['options']?_0x386bc4[_0xadeb('0x21')][_0xadeb('0x22')]||null:null,'attributes':_0x386bc4[_0xadeb('0x21')]?_0x386bc4[_0xadeb('0x21')][_0xadeb('0x23')]||null:null,'limit':_0x386bc4[_0xadeb('0x21')]?_0x386bc4[_0xadeb('0x21')][_0xadeb('0x24')]||null:null})[_0xadeb('0x12')](function(_0x5ce21f){logger['info']('UpdateChatInteraction',_0x386bc4);logger[_0xadeb('0x15')]('UpdateChatInteraction',_0x386bc4,JSON[_0xadeb('0x17')](_0x5ce21f));_0x5655f4(_0x5ce21f);})[_0xadeb('0x1d')](function(_0x32a06b){logger['error'](_0xadeb('0x25'),_0x32a06b[_0xadeb('0x1b')],_0x386bc4);_0x1ab8a0(_0x21481d[_0xadeb('0x18')](0x1f4,_0x32a06b[_0xadeb('0x1b')]));});});};exports[_0xadeb('0x26')]=function(_0x49abc0){return new Promise(function(_0x59e66a,_0x37038f){return db[_0xadeb('0x1e')][_0xadeb('0x27')]({'where':_0x49abc0[_0xadeb('0x21')]?_0x49abc0['options'][_0xadeb('0x22')]||null:null})[_0xadeb('0x12')](function(_0x2af22b){if(_0x2af22b){return _0x2af22b[_0xadeb('0x28')](_0x49abc0[_0xadeb('0x20')][_0xadeb('0x29')],_[_0xadeb('0x2a')](_0x49abc0['body'],['ids','id'])||{});}})['spread'](function(_0x55d30b){logger[_0xadeb('0x13')](_0xadeb('0x2b'),_0x49abc0);logger[_0xadeb('0x15')]('AddTags',_0x49abc0,JSON[_0xadeb('0x17')](_0x55d30b));_0x59e66a(_0x55d30b);})['catch'](function(_0x53de8a){logger[_0xadeb('0x18')](_0xadeb('0x2b'),_0x53de8a[_0xadeb('0x1b')],_0x49abc0);_0x37038f(_this[_0xadeb('0x18')](0x1f4,_0x53de8a[_0xadeb('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 78f4f74..c779b2c 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 _0xcd4c=['remove','update','emit','length','chatInteraction:','save'];(function(_0x19f6ce,_0x4c4f0b){var _0x2ef4aa=function(_0x189964){while(--_0x189964){_0x19f6ce['push'](_0x19f6ce['shift']());}};_0x2ef4aa(++_0x4c4f0b);}(_0xcd4c,0x11f));var _0xccd4=function(_0x1d817c,_0x2f175c){_0x1d817c=_0x1d817c-0x0;var _0x5a30e0=_0xcd4c[_0x1d817c];return _0x5a30e0;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xccd4('0x0'),_0xccd4('0x1'),_0xccd4('0x2')];function createListener(_0x447ed0,_0x2756ba){return function(_0x4b0faa){_0x2756ba[_0xccd4('0x3')](_0x447ed0,_0x4b0faa);};}function removeListener(_0x4848e6,_0xe07840){return function(){ChatInteractionEvents['removeListener'](_0x4848e6,_0xe07840);};}exports['register']=function(_0x360fc8){for(var _0x35901b=0x0,_0x4c63c3=events[_0xccd4('0x4')];_0x35901b<_0x4c63c3;_0x35901b++){var _0x4cb0ef=events[_0x35901b];var _0x488e3f=createListener(_0xccd4('0x5')+_0x4cb0ef,_0x360fc8);ChatInteractionEvents['on'](_0x4cb0ef,_0x488e3f);}}; \ No newline at end of file +var _0xeccd=['removeListener','register','./chatInteraction.events','remove','update','emit'];(function(_0x41c232,_0x5449e8){var _0x401c61=function(_0x172e34){while(--_0x172e34){_0x41c232['push'](_0x41c232['shift']());}};_0x401c61(++_0x5449e8);}(_0xeccd,0x1b2));var _0xdecc=function(_0x52b4a9,_0x2d7cb8){_0x52b4a9=_0x52b4a9-0x0;var _0x21b469=_0xeccd[_0x52b4a9];return _0x21b469;};'use strict';var ChatInteractionEvents=require(_0xdecc('0x0'));var events=['save',_0xdecc('0x1'),_0xdecc('0x2')];function createListener(_0x425b5e,_0x29485c){return function(_0x1fe5ba){_0x29485c[_0xdecc('0x3')](_0x425b5e,_0x1fe5ba);};}function removeListener(_0x5e5041,_0x5890ff){return function(){ChatInteractionEvents[_0xdecc('0x4')](_0x5e5041,_0x5890ff);};}exports[_0xdecc('0x5')]=function(_0x4a192c){for(var _0xc97e86=0x0,_0x50a16d=events['length'];_0xc97e86<_0x50a16d;_0xc97e86++){var _0x273df6=events[_0xc97e86];var _0x4f454e=createListener('chatInteraction:'+_0x273df6,_0x4a192c);ChatInteractionEvents['on'](_0x273df6,_0x4f454e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 4fd111d..e064299 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 _0xd3d0=['post','create','createVidaooSession','diskStorage','join','root','format','%s-%s','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','/:id/custom_update','customUpdate','put','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','exports','multer','util','connect-timeout','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/my_messages','getMyMessages','/:id/download','download'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd3d0,0x86));var _0x0d3d=function(_0x157c6e,_0x169855){_0x157c6e=_0x157c6e-0x0;var _0x29b2e5=_0xd3d0[_0x157c6e];return _0x29b2e5;};'use strict';var multer=require(_0x0d3d('0x0'));var util=require(_0x0d3d('0x1'));var path=require('path');var timeout=require(_0x0d3d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0d3d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0d3d('0x4'));var controller=require(_0x0d3d('0x5'));router[_0x0d3d('0x6')]('/',auth[_0x0d3d('0x7')](),controller[_0x0d3d('0x8')]);router[_0x0d3d('0x6')](_0x0d3d('0x9'),auth[_0x0d3d('0x7')](),controller[_0x0d3d('0xa')]);router[_0x0d3d('0x6')](_0x0d3d('0xb'),auth[_0x0d3d('0xc')](),controller['show']);router[_0x0d3d('0x6')](_0x0d3d('0xd'),auth[_0x0d3d('0xc')](),controller[_0x0d3d('0xe')]);router[_0x0d3d('0x6')]('/:id/messages',auth[_0x0d3d('0x7')](),controller['getMessages']);router[_0x0d3d('0x6')](_0x0d3d('0xf'),auth[_0x0d3d('0xc')](),controller[_0x0d3d('0x10')]);router[_0x0d3d('0x6')](_0x0d3d('0x11'),auth['isAuthenticated'](),controller[_0x0d3d('0x12')]);router[_0x0d3d('0x13')]('/',auth[_0x0d3d('0x7')](),controller[_0x0d3d('0x14')]);router['post']('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x0d3d('0x15')]);var upload=multer({'storage':multer[_0x0d3d('0x16')]({'destination':function(_0x215357,_0xf3fbbe,_0x5b9e92){_0x5b9e92(null,path[_0x0d3d('0x17')](config[_0x0d3d('0x18')],'server/files/attachments/'));},'filename':function(_0x5493d2,_0x471f98,_0x20a364){_0x20a364(null,util[_0x0d3d('0x19')](_0x0d3d('0x1a'),Date[_0x0d3d('0x1b')](),_0x471f98[_0x0d3d('0x1c')][_0x0d3d('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0d3d('0x13')](_0x0d3d('0x1e'),upload['single'](_0x0d3d('0x1f')),controller[_0x0d3d('0x20')]);router[_0x0d3d('0x13')](_0x0d3d('0x21'),auth[_0x0d3d('0xc')](),controller[_0x0d3d('0x22')]);router[_0x0d3d('0x13')](_0x0d3d('0x23'),auth['isAuthenticated'](),interaction[_0x0d3d('0x24')](_0x0d3d('0x25'),_0x0d3d('0x26')),controller[_0x0d3d('0x27')]);router['put'](_0x0d3d('0xb'),auth[_0x0d3d('0x7')](),interaction['tracked'](_0x0d3d('0x25'),_0x0d3d('0x28')),controller['update']);router['put'](_0x0d3d('0x29'),controller[_0x0d3d('0x2a')]);router[_0x0d3d('0x2b')](_0x0d3d('0x2c'),auth[_0x0d3d('0xc')](),controller['abandon']);router[_0x0d3d('0x2b')](_0x0d3d('0x2d'),controller[_0x0d3d('0x2e')]);router[_0x0d3d('0x2f')]('/:id',auth[_0x0d3d('0x7')](),interaction[_0x0d3d('0x24')]('chat',_0x0d3d('0x30')),controller['destroy']);router['delete'](_0x0d3d('0x23'),auth[_0x0d3d('0x7')](),controller[_0x0d3d('0x31')]);module[_0x0d3d('0x32')]=router; \ No newline at end of file +var _0xed4d=['create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','%s-%s','now','originalname','replace','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','update','/:id/custom_update','customUpdate','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','multer','util','connect-timeout','express','fs-extra','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post'];(function(_0x3bbeb6,_0x409c16){var _0x5d29c4=function(_0x5e2453){while(--_0x5e2453){_0x3bbeb6['push'](_0x3bbeb6['shift']());}};_0x5d29c4(++_0x409c16);}(_0xed4d,0xb2));var _0xded4=function(_0x417aed,_0x3bfe07){_0x417aed=_0x417aed-0x0;var _0xebf6=_0xed4d[_0x417aed];return _0xebf6;};'use strict';var multer=require(_0xded4('0x0'));var util=require(_0xded4('0x1'));var path=require('path');var timeout=require(_0xded4('0x2'));var express=require(_0xded4('0x3'));var router=express['Router']();var fs_extra=require(_0xded4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xded4('0x5'));var controller=require(_0xded4('0x6'));router[_0xded4('0x7')]('/',auth[_0xded4('0x8')](),controller[_0xded4('0x9')]);router[_0xded4('0x7')](_0xded4('0xa'),auth[_0xded4('0x8')](),controller['describe']);router['get'](_0xded4('0xb'),auth[_0xded4('0xc')](),controller[_0xded4('0xd')]);router['get'](_0xded4('0xe'),auth[_0xded4('0xc')](),controller[_0xded4('0xf')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xded4('0x10')]);router['get'](_0xded4('0x11'),auth[_0xded4('0xc')](),controller[_0xded4('0x12')]);router[_0xded4('0x7')](_0xded4('0x13'),auth['isAuthenticated'](),controller[_0xded4('0x14')]);router[_0xded4('0x15')]('/',auth['isAuthenticated'](),controller[_0xded4('0x16')]);router[_0xded4('0x15')](_0xded4('0x17'),auth[_0xded4('0x8')](),controller[_0xded4('0x18')]);var upload=multer({'storage':multer[_0xded4('0x19')]({'destination':function(_0x11a330,_0x3afb84,_0x4c4999){_0x4c4999(null,path['join'](config[_0xded4('0x1a')],_0xded4('0x1b')));},'filename':function(_0x40bf0e,_0x20bfef,_0x5794f5){_0x5794f5(null,util['format'](_0xded4('0x1c'),Date[_0xded4('0x1d')](),_0x20bfef[_0xded4('0x1e')][_0xded4('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0xded4('0x20')](_0xded4('0x21')),controller[_0xded4('0x22')]);router[_0xded4('0x15')](_0xded4('0x23'),auth[_0xded4('0xc')](),controller[_0xded4('0x24')]);router['post'](_0xded4('0x25'),auth[_0xded4('0x8')](),interaction[_0xded4('0x26')](_0xded4('0x27'),_0xded4('0x28')),controller['addTags']);router[_0xded4('0x29')](_0xded4('0xb'),auth[_0xded4('0x8')](),interaction['tracked'](_0xded4('0x27'),'chatinteraction:update'),controller[_0xded4('0x2a')]);router['put'](_0xded4('0x2b'),controller[_0xded4('0x2c')]);router[_0xded4('0x29')]('/:id/abandon',auth[_0xded4('0xc')](),controller['abandon']);router[_0xded4('0x29')](_0xded4('0x2d'),controller['close']);router[_0xded4('0x2e')](_0xded4('0xb'),auth[_0xded4('0x8')](),interaction[_0xded4('0x26')](_0xded4('0x27'),_0xded4('0x2f')),controller[_0xded4('0x30')]);router[_0xded4('0x2e')]('/:id/tags',auth['isAuthenticated'](),controller[_0xded4('0x31')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 7dfea49..641f8de 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 _0x5963=['medium','BOOLEAN','sequelize','exports','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5963,0x183));var _0x3596=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5963[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x3596('0x0'));module[_0x3596('0x1')]={'body':{'type':Sequelize[_0x3596('0x2')](_0x3596('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3596('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc612=['BOOLEAN','INTEGER','sequelize','medium'];(function(_0x3cefb6,_0x492b6a){var _0x2bdd42=function(_0x1f3cf8){while(--_0x1f3cf8){_0x3cefb6['push'](_0x3cefb6['shift']());}};_0x2bdd42(++_0x492b6a);}(_0xc612,0xb6));var _0x2c61=function(_0x155f1a,_0x18d30e){_0x155f1a=_0x155f1a-0x0;var _0x8526df=_0xc612[_0x155f1a];return _0x8526df;};'use strict';var Sequelize=require(_0x2c61('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x2c61('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x2c61('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x2c61('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 8c0fd34..e0e5457 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 _0x07d5=['UserProfileSection','Agents','autoAssociation','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','index','ChatInternalMessage','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','fields','find','create','body','destroy','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','findAll','agent','fullname','role','online','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','user'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x07d5,0x7a));var _0x507d=function(_0xd29aea,_0x4920bf){_0xd29aea=_0xd29aea-0x0;var _0x303ac7=_0x07d5[_0xd29aea];return _0x303ac7;};'use strict';var emlformat=require(_0x507d('0x0'));var rimraf=require(_0x507d('0x1'));var zipdir=require(_0x507d('0x2'));var jsonpatch=require(_0x507d('0x3'));var rp=require(_0x507d('0x4'));var moment=require(_0x507d('0x5'));var BPromise=require(_0x507d('0x6'));var Mustache=require(_0x507d('0x7'));var util=require(_0x507d('0x8'));var path=require(_0x507d('0x9'));var sox=require(_0x507d('0xa'));var csv=require('to-csv');var ejs=require(_0x507d('0xb'));var fs=require('fs');var fs_extra=require(_0x507d('0xc'));var _=require(_0x507d('0xd'));var squel=require('squel');var crypto=require(_0x507d('0xe'));var jsforce=require(_0x507d('0xf'));var deskjs=require(_0x507d('0x10'));var toCsv=require(_0x507d('0x11'));var querystring=require(_0x507d('0x12'));var Papa=require(_0x507d('0x13'));var Redis=require(_0x507d('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x507d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x507d('0x16'))(_0x507d('0x17'));var utils=require(_0x507d('0x18'));var config=require(_0x507d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x507d('0x1a'))['db'];config[_0x507d('0x1b')]=_[_0x507d('0x1c')](config['redis'],{'host':_0x507d('0x1d'),'port':0x18eb});var socket=require(_0x507d('0x1e'))(new Redis(config[_0x507d('0x1b')]));require(_0x507d('0x1f'))[_0x507d('0x20')](socket);function respondWithStatusCode(_0x46d742,_0x5bfee7){_0x5bfee7=_0x5bfee7||0xcc;return function(_0x2c432a){if(_0x2c432a){return _0x46d742[_0x507d('0x21')](_0x5bfee7);}return _0x46d742[_0x507d('0x22')](_0x5bfee7)[_0x507d('0x23')]();};}function respondWithResult(_0x6cce9d,_0x19225a){_0x19225a=_0x19225a||0xc8;return function(_0x3057c3){if(_0x3057c3){return _0x6cce9d[_0x507d('0x22')](_0x19225a)[_0x507d('0x24')](_0x3057c3);}};}function respondWithFilteredResult(_0x4b4c8f,_0x2d1fab){return function(_0xdde2cf){if(_0xdde2cf){var _0x2c1638=typeof _0x2d1fab[_0x507d('0x25')]===_0x507d('0x26')&&typeof _0x2d1fab[_0x507d('0x27')]==='undefined';var _0x57df61=_0xdde2cf[_0x507d('0x28')];var _0x4f6a54=_0x2c1638?0x0:_0x2d1fab[_0x507d('0x25')];var _0x34dc78=_0x2c1638?_0xdde2cf['count']:_0x2d1fab[_0x507d('0x25')]+_0x2d1fab[_0x507d('0x27')];var _0x161454;if(_0x34dc78>=_0x57df61){_0x34dc78=_0x57df61;_0x161454=0xc8;}else{_0x161454=0xce;}_0x4b4c8f[_0x507d('0x22')](_0x161454);return _0x4b4c8f[_0x507d('0x29')](_0x507d('0x2a'),_0x4f6a54+'-'+_0x34dc78+'/'+_0x57df61)['json'](_0xdde2cf);}return null;};}function patchUpdates(_0x4afe45){return function(_0x2044a1){try{jsonpatch['apply'](_0x2044a1,_0x4afe45,!![]);}catch(_0x8b539e){return BPromise[_0x507d('0x2b')](_0x8b539e);}return _0x2044a1[_0x507d('0x2c')]();};}function saveUpdates(_0x225b68,_0x3f7570){return function(_0x16ae9f){if(_0x16ae9f){return _0x16ae9f[_0x507d('0x2d')](_0x225b68)[_0x507d('0x2e')](function(_0x391c68){return _0x391c68;});}return null;};}function removeEntity(_0x2d880c,_0x28da74){return function(_0x1f96ab){if(_0x1f96ab){return _0x1f96ab['destroy']()[_0x507d('0x2e')](function(){_0x2d880c[_0x507d('0x22')](0xcc)[_0x507d('0x23')]();});}};}function handleEntityNotFound(_0x3e8643,_0x3d88e8){return function(_0x49ad1c){if(!_0x49ad1c){_0x3e8643['sendStatus'](0x194);}return _0x49ad1c;};}function handleError(_0x3592f9,_0x4765e2){_0x4765e2=_0x4765e2||0x1f4;return function(_0x557305){logger[_0x507d('0x2f')](_0x557305[_0x507d('0x30')]);if(_0x557305[_0x507d('0x31')]){delete _0x557305[_0x507d('0x31')];}_0x3592f9['status'](_0x4765e2)['send'](_0x557305);};}exports[_0x507d('0x32')]=function(_0x20361b,_0x2fcb08){var _0x266480={},_0x59041f={},_0x50b7a0={'count':0x0,'rows':[]};var _0x252c75=_['map'](db[_0x507d('0x33')][_0x507d('0x34')],function(_0x5af985){return{'name':_0x5af985[_0x507d('0x35')],'type':_0x5af985[_0x507d('0x36')][_0x507d('0x37')]};});_0x59041f['model']=_[_0x507d('0x38')](_0x252c75,_0x507d('0x31'));_0x59041f[_0x507d('0x39')]=_['keys'](_0x20361b[_0x507d('0x39')]);_0x59041f[_0x507d('0x3a')]=_[_0x507d('0x3b')](_0x59041f[_0x507d('0x3c')],_0x59041f[_0x507d('0x39')]);_0x266480['attributes']=_[_0x507d('0x3b')](_0x59041f[_0x507d('0x3c')],qs['fields'](_0x20361b[_0x507d('0x39')]['fields']));_0x266480[_0x507d('0x3d')]=_0x266480[_0x507d('0x3d')][_0x507d('0x3e')]?_0x266480[_0x507d('0x3d')]:_0x59041f[_0x507d('0x3c')];if(!_0x20361b[_0x507d('0x39')][_0x507d('0x3f')](_0x507d('0x40'))){_0x266480['limit']=qs[_0x507d('0x27')](_0x20361b['query']['limit']);_0x266480['offset']=qs[_0x507d('0x25')](_0x20361b[_0x507d('0x39')][_0x507d('0x25')]);}_0x266480[_0x507d('0x41')]=qs[_0x507d('0x42')](_0x20361b[_0x507d('0x39')][_0x507d('0x42')]);_0x266480['where']=qs[_0x507d('0x3a')](_[_0x507d('0x43')](_0x20361b['query'],_0x59041f[_0x507d('0x3a')]),_0x252c75);if(_0x20361b[_0x507d('0x39')][_0x507d('0x44')]){_0x266480[_0x507d('0x45')]=_[_0x507d('0x46')](_0x266480['where'],{'$or':_['map'](_0x252c75,function(_0x3cdb0b){if(_0x3cdb0b[_0x507d('0x36')]!==_0x507d('0x47')){var _0x45255a={};_0x45255a[_0x3cdb0b[_0x507d('0x31')]]={'$like':'%'+_0x20361b[_0x507d('0x39')][_0x507d('0x44')]+'%'};return _0x45255a;}})});}_0x266480=_['merge']({},_0x266480,_0x20361b[_0x507d('0x48')]);var _0x4bf627={'where':_0x266480['where']};return db[_0x507d('0x33')]['count'](_0x4bf627)[_0x507d('0x2e')](function(_0x5950b6){_0x50b7a0['count']=_0x5950b6;if(_0x20361b[_0x507d('0x39')][_0x507d('0x49')]){_0x266480[_0x507d('0x4a')]=[{'all':!![]}];}return db[_0x507d('0x33')]['findAll'](_0x266480);})[_0x507d('0x2e')](function(_0x7a3b){_0x50b7a0[_0x507d('0x4b')]=_0x7a3b;return _0x50b7a0;})[_0x507d('0x2e')](respondWithFilteredResult(_0x2fcb08,_0x266480))[_0x507d('0x4c')](handleError(_0x2fcb08,null));};exports['show']=function(_0x109622,_0x3046df){var _0x1d88b9={'raw':!![],'where':{'id':_0x109622[_0x507d('0x4d')]['id']}},_0x3b6ba1={};_0x3b6ba1[_0x507d('0x3c')]=_[_0x507d('0x4e')](db[_0x507d('0x33')]['rawAttributes']);_0x3b6ba1[_0x507d('0x39')]=_[_0x507d('0x4e')](_0x109622[_0x507d('0x39')]);_0x3b6ba1['filters']=_['intersection'](_0x3b6ba1[_0x507d('0x3c')],_0x3b6ba1['query']);_0x1d88b9['attributes']=_[_0x507d('0x3b')](_0x3b6ba1[_0x507d('0x3c')],qs[_0x507d('0x4f')](_0x109622[_0x507d('0x39')]['fields']));_0x1d88b9[_0x507d('0x3d')]=_0x1d88b9[_0x507d('0x3d')][_0x507d('0x3e')]?_0x1d88b9[_0x507d('0x3d')]:_0x3b6ba1[_0x507d('0x3c')];if(_0x109622['query'][_0x507d('0x49')]){_0x1d88b9[_0x507d('0x4a')]=[{'all':!![]}];}_0x1d88b9=_[_0x507d('0x46')]({},_0x1d88b9,_0x109622[_0x507d('0x48')]);return db[_0x507d('0x33')][_0x507d('0x50')](_0x1d88b9)[_0x507d('0x2e')](handleEntityNotFound(_0x3046df,null))[_0x507d('0x2e')](respondWithResult(_0x3046df,null))[_0x507d('0x4c')](handleError(_0x3046df,null));};exports[_0x507d('0x51')]=function(_0x5a94b8,_0x252851){return db['ChatInternalMessage'][_0x507d('0x51')](_0x5a94b8[_0x507d('0x52')],{})[_0x507d('0x2e')](respondWithResult(_0x252851,0xc9))['catch'](handleError(_0x252851,null));};exports[_0x507d('0x2d')]=function(_0x501161,_0x323773){if(_0x501161[_0x507d('0x52')]['id']){delete _0x501161[_0x507d('0x52')]['id'];}return db['ChatInternalMessage'][_0x507d('0x50')]({'where':{'id':_0x501161['params']['id']}})[_0x507d('0x2e')](handleEntityNotFound(_0x323773,null))[_0x507d('0x2e')](saveUpdates(_0x501161[_0x507d('0x52')],null))[_0x507d('0x2e')](respondWithResult(_0x323773,null))[_0x507d('0x4c')](handleError(_0x323773,null));};exports[_0x507d('0x53')]=function(_0xe4631,_0x428ff1){return db[_0x507d('0x33')][_0x507d('0x50')]({'where':{'id':_0xe4631[_0x507d('0x4d')]['id']}})[_0x507d('0x2e')](handleEntityNotFound(_0x428ff1,null))[_0x507d('0x2e')](removeEntity(_0x428ff1,null))[_0x507d('0x4c')](handleError(_0x428ff1,null));};exports['describe']=function(_0x46c9db,_0x3c5f84){return db['ChatInternalMessage'][_0x507d('0x54')]()[_0x507d('0x2e')](respondWithResult(_0x3c5f84,null))[_0x507d('0x4c')](handleError(_0x3c5f84,null));};function wrapUser(_0x3782c1){return function(_0x33c2a0){var _0x1917b6=_0x3782c1[_0x507d('0x55')]({'plain':!![]});_0x1917b6[_0x507d('0x56')]=[];if(_0x33c2a0){_0x1917b6[_0x507d('0x57')]=_0x33c2a0[_0x507d('0x58')];_0x1917b6['lastMessage']=_0x33c2a0;}else{_0x1917b6['lastMessageAt']=moment(0x0)[_0x507d('0x59')](_0x507d('0x5a'));_0x1917b6[_0x507d('0x5b')]={};}return _0x1917b6;};}exports[_0x507d('0x5c')]=function(_0x1fa337,_0x4cedcf,_0x14e633){var _0xdcb973=[];return db[_0x507d('0x5d')][_0x507d('0x5e')]({'where':{'role':[_0x507d('0x5f'),'admin','user']},'attributes':['id',_0x507d('0x60'),'name',_0x507d('0x61'),'userpic','internal',_0x507d('0x62'),'lastLoginAt',_0x507d('0x63'),_0x507d('0x64')],'order':qs['sort']('-online'),'include':[{'model':db[_0x507d('0x65')],'as':_0x507d('0x66'),'attributes':['id',_0x507d('0x31'),_0x507d('0x36')],'through':{'attributes':[]}}]})['then'](function(_0x71e3aa){if(_0x71e3aa){var _0x3b0e57=_0x1fa337[_0x507d('0x67')][_0x507d('0x55')]({'plain':!![]});if(!_0x3b0e57)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b0e57[_0x507d('0x61')]===_0x507d('0x67')){return db[_0x507d('0x68')][_0x507d('0x50')]({'where':{'name':_0x507d('0x69'),'userProfileId':_0x3b0e57['userProfileId']},'raw':!![]})['then'](function(_0x2e2e58){if(_0x2e2e58){if(_0x2e2e58[_0x507d('0x6a')]===0x0){return db['UserProfileResource'][_0x507d('0x5e')]({'where':{'sectionId':_0x2e2e58['id']},'raw':!![]})[_0x507d('0x2e')](function(_0x181310){var _0x13f9bd=[];if(_['isEmpty'](_0x181310)){_0x13f9bd=_[_0x507d('0x44')](_0x71e3aa,function(_0x3080aa){if(_0x3080aa[_0x507d('0x61')]!==_0x507d('0x5f')){return _0x3080aa;}});return _0x13f9bd;}else{for(var _0x1a9c75=0x0;_0x1a9c75<_0x71e3aa[_0x507d('0x3e')];_0x1a9c75++){var _0x43b801=_0x71e3aa[_0x1a9c75];if(_0x43b801[_0x507d('0x61')]==='agent'){var _0x229f61=_[_0x507d('0x50')](_0x181310,function(_0x520a1c){return _0x520a1c['resourceId']===_0x43b801['id'];});if(_0x229f61)_0x13f9bd[_0x507d('0x6b')](_0x43b801);}else{_0x13f9bd[_0x507d('0x6b')](_0x43b801);}}return _0x13f9bd;}});}else{return _0x71e3aa;}}else{var _0x156ff3=_['filter'](_0x71e3aa,function(_0x379b7d){if(_0x379b7d['role']!==_0x507d('0x5f')){return _0x379b7d;}});return _0x156ff3;}});}else{return _0x71e3aa;}}})[_0x507d('0x2e')](function(_0x20e26f){var _0x95b022=[];if(_0x20e26f){_0xdcb973=_0x20e26f;for(var _0x3f1fb8=0x0;_0x3f1fb8<_0x20e26f[_0x507d('0x3e')];_0x3f1fb8+=0x1){_0xdcb973[_0x3f1fb8][_0x507d('0x56')]=[];_0x95b022['push'](db[_0x507d('0x33')]['find']({'where':{'FromId':[_0x1fa337[_0x507d('0x67')]['id'],_0x20e26f[_0x3f1fb8]['id']],'ToId':[_0x1fa337[_0x507d('0x67')]['id'],_0x20e26f[_0x3f1fb8]['id']],'ChatGroupId':null},'attributes':['id',_0x507d('0x58'),_0x507d('0x6c'),_0x507d('0x6d'),_0x507d('0x6e'),_0x507d('0x52')],'order':qs['sort'](_0x507d('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x507d('0x2e')](wrapUser(_0x20e26f[_0x3f1fb8])));}return BPromise[_0x507d('0x70')](_0x95b022);}return[];})['then'](function(_0x11c508){return{'rows':_0x11c508,'count':_0x11c508['length']};})[_0x507d('0x2e')](respondWithResult(_0x4cedcf,null))[_0x507d('0x4c')](handleError(_0x4cedcf,null));}; \ No newline at end of file +var _0x0ba9=['sort','where','pick','merge','filter','includeAll','include','ChatInternalMessage','findAll','rows','catch','show','rawAttributes','options','create','body','find','params','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','user','fullname','role','userpic','internal','allowmessenger','showWebBar','-online','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','ToId','read','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','end','status','offset','undefined','count','set','json','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','fieldName','type','key','keys','filters','query','intersection','model','fields','attributes','length','hasOwnProperty','limit','order'];(function(_0x4dbf8f,_0x1c8ecc){var _0x1d6a7a=function(_0x27196d){while(--_0x27196d){_0x4dbf8f['push'](_0x4dbf8f['shift']());}};_0x1d6a7a(++_0x1c8ecc);}(_0x0ba9,0x103));var _0x90ba=function(_0x5c8a67,_0x49a8bc){_0x5c8a67=_0x5c8a67-0x0;var _0x4b56b9=_0x0ba9[_0x5c8a67];return _0x4b56b9;};'use strict';var emlformat=require(_0x90ba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x90ba('0x1'));var jsonpatch=require(_0x90ba('0x2'));var rp=require(_0x90ba('0x3'));var moment=require(_0x90ba('0x4'));var BPromise=require(_0x90ba('0x5'));var Mustache=require(_0x90ba('0x6'));var util=require('util');var path=require('path');var sox=require(_0x90ba('0x7'));var csv=require('to-csv');var ejs=require(_0x90ba('0x8'));var fs=require('fs');var fs_extra=require(_0x90ba('0x9'));var _=require('lodash');var squel=require(_0x90ba('0xa'));var crypto=require(_0x90ba('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x90ba('0xc'));var toCsv=require(_0x90ba('0xd'));var querystring=require(_0x90ba('0xe'));var Papa=require(_0x90ba('0xf'));var Redis=require(_0x90ba('0x10'));var authService=require(_0x90ba('0x11'));var qs=require(_0x90ba('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90ba('0x13'));var logger=require('../../config/logger')(_0x90ba('0x14'));var utils=require(_0x90ba('0x15'));var config=require(_0x90ba('0x16'));var licenseUtil=require(_0x90ba('0x17'));var db=require(_0x90ba('0x18'))['db'];config[_0x90ba('0x19')]=_[_0x90ba('0x1a')](config['redis'],{'host':_0x90ba('0x1b'),'port':0x18eb});var socket=require(_0x90ba('0x1c'))(new Redis(config[_0x90ba('0x19')]));require(_0x90ba('0x1d'))['register'](socket);function respondWithStatusCode(_0xb08071,_0x3cc056){_0x3cc056=_0x3cc056||0xcc;return function(_0x2acb7f){if(_0x2acb7f){return _0xb08071['sendStatus'](_0x3cc056);}return _0xb08071['status'](_0x3cc056)[_0x90ba('0x1e')]();};}function respondWithResult(_0x1e625a,_0x12785d){_0x12785d=_0x12785d||0xc8;return function(_0x142806){if(_0x142806){return _0x1e625a[_0x90ba('0x1f')](_0x12785d)['json'](_0x142806);}};}function respondWithFilteredResult(_0x1a3005,_0x252468){return function(_0x169f97){if(_0x169f97){var _0x1e97dc=typeof _0x252468[_0x90ba('0x20')]===_0x90ba('0x21')&&typeof _0x252468['limit']===_0x90ba('0x21');var _0x4e21aa=_0x169f97['count'];var _0x546ff3=_0x1e97dc?0x0:_0x252468[_0x90ba('0x20')];var _0x1807e2=_0x1e97dc?_0x169f97[_0x90ba('0x22')]:_0x252468[_0x90ba('0x20')]+_0x252468['limit'];var _0x2992e3;if(_0x1807e2>=_0x4e21aa){_0x1807e2=_0x4e21aa;_0x2992e3=0xc8;}else{_0x2992e3=0xce;}_0x1a3005['status'](_0x2992e3);return _0x1a3005[_0x90ba('0x23')]('Content-Range',_0x546ff3+'-'+_0x1807e2+'/'+_0x4e21aa)[_0x90ba('0x24')](_0x169f97);}return null;};}function patchUpdates(_0x4d7b0d){return function(_0x439320){try{jsonpatch['apply'](_0x439320,_0x4d7b0d,!![]);}catch(_0x18f6d9){return BPromise[_0x90ba('0x25')](_0x18f6d9);}return _0x439320[_0x90ba('0x26')]();};}function saveUpdates(_0x58a6b7,_0xb5d67b){return function(_0x10bb76){if(_0x10bb76){return _0x10bb76[_0x90ba('0x27')](_0x58a6b7)['then'](function(_0x3e5bd5){return _0x3e5bd5;});}return null;};}function removeEntity(_0x3c519e,_0x2532c9){return function(_0x16c326){if(_0x16c326){return _0x16c326[_0x90ba('0x28')]()[_0x90ba('0x29')](function(){_0x3c519e[_0x90ba('0x1f')](0xcc)[_0x90ba('0x1e')]();});}};}function handleEntityNotFound(_0x586bf8,_0x4bac4b){return function(_0x342ec1){if(!_0x342ec1){_0x586bf8[_0x90ba('0x2a')](0x194);}return _0x342ec1;};}function handleError(_0x5dab2a,_0x2c6ed3){_0x2c6ed3=_0x2c6ed3||0x1f4;return function(_0x33bb53){logger[_0x90ba('0x2b')](_0x33bb53[_0x90ba('0x2c')]);if(_0x33bb53['name']){delete _0x33bb53[_0x90ba('0x2d')];}_0x5dab2a['status'](_0x2c6ed3)[_0x90ba('0x2e')](_0x33bb53);};}exports['index']=function(_0x5c4bf9,_0x4d0edb){var _0x6d5c13={},_0x2f5692={},_0x3dde61={'count':0x0,'rows':[]};var _0x330faf=_[_0x90ba('0x2f')](db['ChatInternalMessage']['rawAttributes'],function(_0x78b37e){return{'name':_0x78b37e[_0x90ba('0x30')],'type':_0x78b37e[_0x90ba('0x31')][_0x90ba('0x32')]};});_0x2f5692['model']=_[_0x90ba('0x2f')](_0x330faf,_0x90ba('0x2d'));_0x2f5692['query']=_[_0x90ba('0x33')](_0x5c4bf9['query']);_0x2f5692[_0x90ba('0x34')]=_['intersection'](_0x2f5692['model'],_0x2f5692[_0x90ba('0x35')]);_0x6d5c13['attributes']=_[_0x90ba('0x36')](_0x2f5692[_0x90ba('0x37')],qs[_0x90ba('0x38')](_0x5c4bf9['query'][_0x90ba('0x38')]));_0x6d5c13[_0x90ba('0x39')]=_0x6d5c13[_0x90ba('0x39')][_0x90ba('0x3a')]?_0x6d5c13[_0x90ba('0x39')]:_0x2f5692[_0x90ba('0x37')];if(!_0x5c4bf9['query'][_0x90ba('0x3b')]('nolimit')){_0x6d5c13[_0x90ba('0x3c')]=qs[_0x90ba('0x3c')](_0x5c4bf9['query'][_0x90ba('0x3c')]);_0x6d5c13['offset']=qs['offset'](_0x5c4bf9[_0x90ba('0x35')][_0x90ba('0x20')]);}_0x6d5c13[_0x90ba('0x3d')]=qs['sort'](_0x5c4bf9[_0x90ba('0x35')][_0x90ba('0x3e')]);_0x6d5c13[_0x90ba('0x3f')]=qs['filters'](_[_0x90ba('0x40')](_0x5c4bf9[_0x90ba('0x35')],_0x2f5692[_0x90ba('0x34')]),_0x330faf);if(_0x5c4bf9[_0x90ba('0x35')]['filter']){_0x6d5c13[_0x90ba('0x3f')]=_[_0x90ba('0x41')](_0x6d5c13['where'],{'$or':_[_0x90ba('0x2f')](_0x330faf,function(_0x53dc81){if(_0x53dc81[_0x90ba('0x31')]!=='VIRTUAL'){var _0x4c0d69={};_0x4c0d69[_0x53dc81[_0x90ba('0x2d')]]={'$like':'%'+_0x5c4bf9[_0x90ba('0x35')][_0x90ba('0x42')]+'%'};return _0x4c0d69;}})});}_0x6d5c13=_[_0x90ba('0x41')]({},_0x6d5c13,_0x5c4bf9['options']);var _0x1e1ae7={'where':_0x6d5c13[_0x90ba('0x3f')]};return db['ChatInternalMessage']['count'](_0x1e1ae7)['then'](function(_0x321745){_0x3dde61['count']=_0x321745;if(_0x5c4bf9[_0x90ba('0x35')][_0x90ba('0x43')]){_0x6d5c13[_0x90ba('0x44')]=[{'all':!![]}];}return db[_0x90ba('0x45')][_0x90ba('0x46')](_0x6d5c13);})[_0x90ba('0x29')](function(_0x2b2222){_0x3dde61[_0x90ba('0x47')]=_0x2b2222;return _0x3dde61;})[_0x90ba('0x29')](respondWithFilteredResult(_0x4d0edb,_0x6d5c13))[_0x90ba('0x48')](handleError(_0x4d0edb,null));};exports[_0x90ba('0x49')]=function(_0x578a96,_0x7c21af){var _0x427396={'raw':!![],'where':{'id':_0x578a96['params']['id']}},_0x4e3688={};_0x4e3688[_0x90ba('0x37')]=_[_0x90ba('0x33')](db[_0x90ba('0x45')][_0x90ba('0x4a')]);_0x4e3688[_0x90ba('0x35')]=_[_0x90ba('0x33')](_0x578a96[_0x90ba('0x35')]);_0x4e3688[_0x90ba('0x34')]=_[_0x90ba('0x36')](_0x4e3688['model'],_0x4e3688['query']);_0x427396[_0x90ba('0x39')]=_[_0x90ba('0x36')](_0x4e3688['model'],qs[_0x90ba('0x38')](_0x578a96['query'][_0x90ba('0x38')]));_0x427396[_0x90ba('0x39')]=_0x427396[_0x90ba('0x39')][_0x90ba('0x3a')]?_0x427396[_0x90ba('0x39')]:_0x4e3688['model'];if(_0x578a96[_0x90ba('0x35')]['includeAll']){_0x427396[_0x90ba('0x44')]=[{'all':!![]}];}_0x427396=_['merge']({},_0x427396,_0x578a96[_0x90ba('0x4b')]);return db['ChatInternalMessage']['find'](_0x427396)[_0x90ba('0x29')](handleEntityNotFound(_0x7c21af,null))[_0x90ba('0x29')](respondWithResult(_0x7c21af,null))[_0x90ba('0x48')](handleError(_0x7c21af,null));};exports[_0x90ba('0x4c')]=function(_0x5d92b6,_0x39978e){return db[_0x90ba('0x45')][_0x90ba('0x4c')](_0x5d92b6[_0x90ba('0x4d')],{})[_0x90ba('0x29')](respondWithResult(_0x39978e,0xc9))[_0x90ba('0x48')](handleError(_0x39978e,null));};exports[_0x90ba('0x27')]=function(_0x1d3420,_0x84a7da){if(_0x1d3420[_0x90ba('0x4d')]['id']){delete _0x1d3420[_0x90ba('0x4d')]['id'];}return db[_0x90ba('0x45')][_0x90ba('0x4e')]({'where':{'id':_0x1d3420[_0x90ba('0x4f')]['id']}})[_0x90ba('0x29')](handleEntityNotFound(_0x84a7da,null))[_0x90ba('0x29')](saveUpdates(_0x1d3420[_0x90ba('0x4d')],null))[_0x90ba('0x29')](respondWithResult(_0x84a7da,null))[_0x90ba('0x48')](handleError(_0x84a7da,null));};exports['destroy']=function(_0x2e3217,_0x2bdecd){return db[_0x90ba('0x45')][_0x90ba('0x4e')]({'where':{'id':_0x2e3217['params']['id']}})['then'](handleEntityNotFound(_0x2bdecd,null))['then'](removeEntity(_0x2bdecd,null))[_0x90ba('0x48')](handleError(_0x2bdecd,null));};exports['describe']=function(_0x11969e,_0x44c3ce){return db[_0x90ba('0x45')][_0x90ba('0x50')]()[_0x90ba('0x29')](respondWithResult(_0x44c3ce,null))[_0x90ba('0x48')](handleError(_0x44c3ce,null));};function wrapUser(_0x208c88){return function(_0x54ca0f){var _0x2dad8e=_0x208c88[_0x90ba('0x51')]({'plain':!![]});_0x2dad8e[_0x90ba('0x52')]=[];if(_0x54ca0f){_0x2dad8e[_0x90ba('0x53')]=_0x54ca0f[_0x90ba('0x54')];_0x2dad8e['lastMessage']=_0x54ca0f;}else{_0x2dad8e[_0x90ba('0x53')]=moment(0x0)[_0x90ba('0x55')](_0x90ba('0x56'));_0x2dad8e['lastMessage']={};}return _0x2dad8e;};}exports[_0x90ba('0x57')]=function(_0x4b81b0,_0x54892f,_0x136c58){var _0x50b366=[];return db[_0x90ba('0x58')]['findAll']({'where':{'role':[_0x90ba('0x59'),'admin',_0x90ba('0x5a')]},'attributes':['id',_0x90ba('0x5b'),_0x90ba('0x2d'),_0x90ba('0x5c'),_0x90ba('0x5d'),_0x90ba('0x5e'),'online','lastLoginAt',_0x90ba('0x5f'),_0x90ba('0x60')],'order':qs['sort'](_0x90ba('0x61')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x90ba('0x2d'),_0x90ba('0x31')],'through':{'attributes':[]}}]})['then'](function(_0x2c5586){if(_0x2c5586){var _0x21896b=_0x4b81b0[_0x90ba('0x5a')][_0x90ba('0x51')]({'plain':!![]});if(!_0x21896b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21896b['role']===_0x90ba('0x5a')){return db[_0x90ba('0x62')]['find']({'where':{'name':'Agents','userProfileId':_0x21896b[_0x90ba('0x63')]},'raw':!![]})[_0x90ba('0x29')](function(_0x590e11){if(_0x590e11){if(_0x590e11[_0x90ba('0x64')]===0x0){return db[_0x90ba('0x65')][_0x90ba('0x46')]({'where':{'sectionId':_0x590e11['id']},'raw':!![]})['then'](function(_0x39f57e){var _0x2348ad=[];if(_[_0x90ba('0x66')](_0x39f57e)){_0x2348ad=_[_0x90ba('0x42')](_0x2c5586,function(_0x5725d4){if(_0x5725d4[_0x90ba('0x5c')]!==_0x90ba('0x59')){return _0x5725d4;}});return _0x2348ad;}else{for(var _0x1f915e=0x0;_0x1f915e<_0x2c5586[_0x90ba('0x3a')];_0x1f915e++){var _0x1125c7=_0x2c5586[_0x1f915e];if(_0x1125c7[_0x90ba('0x5c')]==='agent'){var _0x3696f1=_[_0x90ba('0x4e')](_0x39f57e,function(_0x3bee90){return _0x3bee90['resourceId']===_0x1125c7['id'];});if(_0x3696f1)_0x2348ad[_0x90ba('0x67')](_0x1125c7);}else{_0x2348ad[_0x90ba('0x67')](_0x1125c7);}}return _0x2348ad;}});}else{return _0x2c5586;}}else{var _0x366243=_[_0x90ba('0x42')](_0x2c5586,function(_0x23e78b){if(_0x23e78b['role']!==_0x90ba('0x59')){return _0x23e78b;}});return _0x366243;}});}else{return _0x2c5586;}}})[_0x90ba('0x29')](function(_0x134e7a){var _0x2ba584=[];if(_0x134e7a){_0x50b366=_0x134e7a;for(var _0x5a8d4a=0x0;_0x5a8d4a<_0x134e7a['length'];_0x5a8d4a+=0x1){_0x50b366[_0x5a8d4a][_0x90ba('0x52')]=[];_0x2ba584[_0x90ba('0x67')](db['ChatInternalMessage'][_0x90ba('0x4e')]({'where':{'FromId':[_0x4b81b0[_0x90ba('0x5a')]['id'],_0x134e7a[_0x5a8d4a]['id']],'ToId':[_0x4b81b0[_0x90ba('0x5a')]['id'],_0x134e7a[_0x5a8d4a]['id']],'ChatGroupId':null},'attributes':['id',_0x90ba('0x54'),'FromId',_0x90ba('0x68'),_0x90ba('0x69'),'body'],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x134e7a[_0x5a8d4a])));}return BPromise[_0x90ba('0x6a')](_0x2ba584);}return[];})[_0x90ba('0x29')](function(_0xcfc02){return{'rows':_0xcfc02,'count':_0xcfc02['length']};})[_0x90ba('0x29')](respondWithResult(_0x54892f,null))[_0x90ba('0x48')](handleError(_0x54892f,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 09949dc..4b7bdb2 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 _0x3790=['emit','hasOwnProperty','exports','../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove'];(function(_0x594c67,_0x341da5){var _0x26bf8d=function(_0x4ac9c8){while(--_0x4ac9c8){_0x594c67['push'](_0x594c67['shift']());}};_0x26bf8d(++_0x341da5);}(_0x3790,0xa3));var _0x0379=function(_0xb47bb8,_0xf12bd4){_0xb47bb8=_0xb47bb8-0x0;var _0x5ccb4d=_0x3790[_0xb47bb8];return _0x5ccb4d;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x0379('0x0'))['db'][_0x0379('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0379('0x2')](0x0);var events={'afterCreate':_0x0379('0x3'),'afterUpdate':'update','afterDestroy':_0x0379('0x4')};function emitEvent(_0x235950){return function(_0x361530,_0x5a3f54,_0x2471f7){ChatInternalMessageEvents['emit'](_0x235950+':'+_0x361530['id'],_0x361530);ChatInternalMessageEvents[_0x0379('0x5')](_0x235950,_0x361530);_0x2471f7(null);};}for(var e in events){if(events[_0x0379('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x0379('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xaf3f=['ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaf3f,0x11e));var _0xfaf3=function(_0x17146e,_0x31ae04){_0x17146e=_0x17146e-0x0;var _0x100284=_0xaf3f[_0x17146e];return _0x100284;};'use strict';var EventEmitter=require(_0xfaf3('0x0'));var ChatInternalMessage=require(_0xfaf3('0x1'))['db'][_0xfaf3('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xfaf3('0x3')](0x0);var events={'afterCreate':_0xfaf3('0x4'),'afterUpdate':_0xfaf3('0x5'),'afterDestroy':_0xfaf3('0x6')};function emitEvent(_0x6104df){return function(_0xde4fb2,_0x17339b,_0x3f4296){ChatInternalMessageEvents[_0xfaf3('0x7')](_0x6104df+':'+_0xde4fb2['id'],_0xde4fb2);ChatInternalMessageEvents['emit'](_0x6104df,_0xde4fb2);_0x3f4296(null);};}for(var e in events){if(events[_0xfaf3('0x8')](e)){var event=events[e];ChatInternalMessage['hook'](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 9c1a53a..525d422 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 _0x9c9d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','chat_internal_messages','lodash','util','../../config/logger'];(function(_0x457b64,_0x49a219){var _0x437111=function(_0x3dad3d){while(--_0x3dad3d){_0x457b64['push'](_0x457b64['shift']());}};_0x437111(++_0x49a219);}(_0x9c9d,0xe7));var _0xd9c9=function(_0x3889d8,_0x4a325e){_0x3889d8=_0x3889d8-0x0;var _0x17d501=_0x9c9d[_0x3889d8];return _0x17d501;};'use strict';var _=require(_0xd9c9('0x0'));var util=require(_0xd9c9('0x1'));var logger=require(_0xd9c9('0x2'))(_0xd9c9('0x3'));var moment=require(_0xd9c9('0x4'));var BPromise=require(_0xd9c9('0x5'));var rp=require(_0xd9c9('0x6'));var fs=require('fs');var path=require(_0xd9c9('0x7'));var rimraf=require(_0xd9c9('0x8'));var config=require(_0xd9c9('0x9'));var attributes=require(_0xd9c9('0xa'));module[_0xd9c9('0xb')]=function(_0x37203f,_0x28b615){return _0x37203f['define']('ChatInternalMessage',attributes,{'tableName':_0xd9c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa18f=['utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','utf8mb4'];(function(_0x344adc,_0x183c37){var _0x4014b2=function(_0xe809e5){while(--_0xe809e5){_0x344adc['push'](_0x344adc['shift']());}};_0x4014b2(++_0x183c37);}(_0xa18f,0x135));var _0xfa18=function(_0x44f479,_0x5b7691){_0x44f479=_0x44f479-0x0;var _0x3eab87=_0xa18f[_0x44f479];return _0x3eab87;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xfa18('0x0'));var moment=require(_0xfa18('0x1'));var BPromise=require(_0xfa18('0x2'));var rp=require(_0xfa18('0x3'));var fs=require('fs');var path=require(_0xfa18('0x4'));var rimraf=require(_0xfa18('0x5'));var config=require(_0xfa18('0x6'));var attributes=require(_0xfa18('0x7'));module['exports']=function(_0x2e5dc0,_0x4dc7c3){return _0x2e5dc0[_0xfa18('0x8')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfa18('0x9'),'collate':_0xfa18('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index e9101f7..ec0c343 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 _0xc009=['info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','request','then'];(function(_0x55e724,_0x8f22f1){var _0x1b317c=function(_0x21d4dd){while(--_0x21d4dd){_0x55e724['push'](_0x55e724['shift']());}};_0x1b317c(++_0x8f22f1);}(_0xc009,0x1de));var _0x9c00=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0xc009[_0x2c7dc6];return _0x10002b;};'use strict';var _=require(_0x9c00('0x0'));var util=require(_0x9c00('0x1'));var moment=require(_0x9c00('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c00('0x3'));var fs=require('fs');var Redis=require(_0x9c00('0x4'));var db=require(_0x9c00('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c00('0x6'))(_0x9c00('0x7'));var config=require(_0x9c00('0x8'));var jayson=require(_0x9c00('0x9'));var client=jayson[_0x9c00('0xa')][_0x9c00('0xb')]({'port':0x232a});config[_0x9c00('0xc')]=_['defaults'](config[_0x9c00('0xc')],{'host':_0x9c00('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c00('0xc')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x233c58,_0x24c62f,_0x2aa939){return new BPromise(function(_0x34a895,_0x30f79a){return client[_0x9c00('0xe')](_0x233c58,_0x2aa939)[_0x9c00('0xf')](function(_0x26947b){logger[_0x9c00('0x10')](_0x9c00('0x11'),_0x24c62f,_0x9c00('0x12'));logger[_0x9c00('0x13')](_0x9c00('0x14'),_0x24c62f,'request\x20sent',JSON['stringify'](_0x26947b));if(_0x26947b['error']){if(_0x26947b[_0x9c00('0x15')][_0x9c00('0x16')]===0x1f4){logger[_0x9c00('0x15')](_0x9c00('0x11'),_0x24c62f,_0x26947b[_0x9c00('0x15')][_0x9c00('0x17')]);return _0x30f79a(_0x26947b[_0x9c00('0x15')][_0x9c00('0x17')]);}logger[_0x9c00('0x15')](_0x9c00('0x11'),_0x24c62f,_0x26947b[_0x9c00('0x15')][_0x9c00('0x17')]);return _0x34a895(_0x26947b[_0x9c00('0x15')][_0x9c00('0x17')]);}else{logger[_0x9c00('0x10')](_0x9c00('0x11'),_0x24c62f,'request\x20sent');_0x34a895(_0x26947b[_0x9c00('0x18')][_0x9c00('0x17')]);}})[_0x9c00('0x19')](function(_0x4e1940){logger[_0x9c00('0x15')](_0x9c00('0x11'),_0x24c62f,_0x4e1940);_0x30f79a(_0x4e1940);});});} \ No newline at end of file +var _0x1a6b=['register','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','localhost','./chatInternalMessage.socket'];(function(_0x5db57d,_0x471c3b){var _0x241ee8=function(_0x3fa4a8){while(--_0x3fa4a8){_0x5db57d['push'](_0x5db57d['shift']());}};_0x241ee8(++_0x471c3b);}(_0x1a6b,0x94));var _0xb1a6=function(_0xfe748d,_0x94dcc8){_0xfe748d=_0xfe748d-0x0;var _0x3616c8=_0x1a6b[_0xfe748d];return _0x3616c8;};'use strict';var _=require(_0xb1a6('0x0'));var util=require(_0xb1a6('0x1'));var moment=require(_0xb1a6('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1a6('0x3'));var fs=require('fs');var Redis=require(_0xb1a6('0x4'));var db=require(_0xb1a6('0x5'))['db'];var utils=require(_0xb1a6('0x6'));var logger=require('../../config/logger')(_0xb1a6('0x7'));var config=require('../../config/environment');var jayson=require(_0xb1a6('0x8'));var client=jayson[_0xb1a6('0x9')]['http']({'port':0x232a});config[_0xb1a6('0xa')]=_['defaults'](config[_0xb1a6('0xa')],{'host':_0xb1a6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb1a6('0xa')]));require(_0xb1a6('0xc'))[_0xb1a6('0xd')](socket);function respondWithRpcPromise(_0x2dc37d,_0x4e585e,_0x41cde3){return new BPromise(function(_0x211cdd,_0x19fd96){return client['request'](_0x2dc37d,_0x41cde3)['then'](function(_0x4bffda){logger['info'](_0xb1a6('0xe'),_0x4e585e,_0xb1a6('0xf'));logger['debug'](_0xb1a6('0x10'),_0x4e585e,'request\x20sent',JSON['stringify'](_0x4bffda));if(_0x4bffda[_0xb1a6('0x11')]){if(_0x4bffda['error'][_0xb1a6('0x12')]===0x1f4){logger['error'](_0xb1a6('0xe'),_0x4e585e,_0x4bffda[_0xb1a6('0x11')][_0xb1a6('0x13')]);return _0x19fd96(_0x4bffda['error'][_0xb1a6('0x13')]);}logger['error'](_0xb1a6('0xe'),_0x4e585e,_0x4bffda['error'][_0xb1a6('0x13')]);return _0x211cdd(_0x4bffda['error'][_0xb1a6('0x13')]);}else{logger[_0xb1a6('0x14')](_0xb1a6('0xe'),_0x4e585e,_0xb1a6('0xf'));_0x211cdd(_0x4bffda[_0xb1a6('0x15')][_0xb1a6('0x13')]);}})[_0xb1a6('0x16')](function(_0x5e42ca){logger[_0xb1a6('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x4e585e,_0x5e42ca);_0x19fd96(_0x5e42ca);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 0f1152d..9daefbf 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 _0x38a6=['emit','removeListener','register','length','chatInternalMessage:','save','update'];(function(_0x47c25d,_0x898bb6){var _0x5f3c81=function(_0x45f31e){while(--_0x45f31e){_0x47c25d['push'](_0x47c25d['shift']());}};_0x5f3c81(++_0x898bb6);}(_0x38a6,0x17f));var _0x638a=function(_0x4651f0,_0x42a139){_0x4651f0=_0x4651f0-0x0;var _0x207b83=_0x38a6[_0x4651f0];return _0x207b83;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x638a('0x0'),'remove',_0x638a('0x1')];function createListener(_0xc6650c,_0x12e2b5){return function(_0x1ca0fa){_0x12e2b5[_0x638a('0x2')](_0xc6650c,_0x1ca0fa);};}function removeListener(_0x521ce5,_0x3a10d5){return function(){ChatInternalMessageEvents[_0x638a('0x3')](_0x521ce5,_0x3a10d5);};}exports[_0x638a('0x4')]=function(_0x5e6722){for(var _0x1adb91=0x0,_0x279a88=events[_0x638a('0x5')];_0x1adb91<_0x279a88;_0x1adb91++){var _0x279fa2=events[_0x1adb91];var _0xc7cdbc=createListener(_0x638a('0x6')+_0x279fa2,_0x5e6722);ChatInternalMessageEvents['on'](_0x279fa2,_0xc7cdbc);}}; \ No newline at end of file +var _0x06ab=['register','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener'];(function(_0x21d36e,_0x5dc096){var _0x4cc307=function(_0x4ae995){while(--_0x4ae995){_0x21d36e['push'](_0x21d36e['shift']());}};_0x4cc307(++_0x5dc096);}(_0x06ab,0xe2));var _0xb06a=function(_0x3a51d0,_0x2dd9a9){_0x3a51d0=_0x3a51d0-0x0;var _0x51db5e=_0x06ab[_0x3a51d0];return _0x51db5e;};'use strict';var ChatInternalMessageEvents=require(_0xb06a('0x0'));var events=[_0xb06a('0x1'),_0xb06a('0x2'),_0xb06a('0x3')];function createListener(_0x2c86e8,_0x199887){return function(_0x5c9cc){_0x199887[_0xb06a('0x4')](_0x2c86e8,_0x5c9cc);};}function removeListener(_0x473bf7,_0x54df6d){return function(){ChatInternalMessageEvents[_0xb06a('0x5')](_0x473bf7,_0x54df6d);};}exports[_0xb06a('0x6')]=function(_0x4942ff){for(var _0x3e17e5=0x0,_0x6bec8=events['length'];_0x3e17e5<_0x6bec8;_0x3e17e5++){var _0x21266a=events[_0x3e17e5];var _0xe288ac=createListener(_0xb06a('0x7')+_0x21266a,_0x4942ff);ChatInternalMessageEvents['on'](_0x21266a,_0xe288ac);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 927479f..b482ad9 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 _0xab51=['isAuthenticated','/describe','describe','/users','/:id','show','put','update','exports','multer','path','express','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xab51,0xe9));var _0x1ab5=function(_0x47b52e,_0x4f3e30){_0x47b52e=_0x47b52e-0x0;var _0x20867e=_0xab51[_0x47b52e];return _0x20867e;};'use strict';var multer=require(_0x1ab5('0x0'));var util=require('util');var path=require(_0x1ab5('0x1'));var timeout=require('connect-timeout');var express=require(_0x1ab5('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1ab5('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1ab5('0x4'));var controller=require(_0x1ab5('0x5'));router[_0x1ab5('0x6')]('/',auth[_0x1ab5('0x7')](),controller['index']);router[_0x1ab5('0x6')](_0x1ab5('0x8'),auth[_0x1ab5('0x7')](),controller[_0x1ab5('0x9')]);router[_0x1ab5('0x6')](_0x1ab5('0xa'),auth[_0x1ab5('0x7')](),controller['getUsers']);router[_0x1ab5('0x6')](_0x1ab5('0xb'),auth[_0x1ab5('0x7')](),controller[_0x1ab5('0xc')]);router['post']('/',auth[_0x1ab5('0x7')](),controller['create']);router[_0x1ab5('0xd')](_0x1ab5('0xb'),controller[_0x1ab5('0xe')]);router['delete']('/:id',auth[_0x1ab5('0x7')](),controller['destroy']);module[_0x1ab5('0xf')]=router; \ No newline at end of file +var _0x5288=['create','put','delete','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/users','getUsers','/:id','show'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5288,0xca));var _0x8528=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x5288[_0x2aec52];return _0x3b8835;};'use strict';var multer=require('multer');var util=require(_0x8528('0x0'));var path=require(_0x8528('0x1'));var timeout=require('connect-timeout');var express=require(_0x8528('0x2'));var router=express['Router']();var fs_extra=require(_0x8528('0x3'));var auth=require(_0x8528('0x4'));var interaction=require(_0x8528('0x5'));var config=require(_0x8528('0x6'));var controller=require('./chatInternalMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8528('0x7')]('/describe',auth[_0x8528('0x8')](),controller[_0x8528('0x9')]);router[_0x8528('0x7')](_0x8528('0xa'),auth[_0x8528('0x8')](),controller[_0x8528('0xb')]);router['get'](_0x8528('0xc'),auth[_0x8528('0x8')](),controller[_0x8528('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8528('0xe')]);router[_0x8528('0xf')](_0x8528('0xc'),controller['update']);router[_0x8528('0x10')](_0x8528('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x8528('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index ec1f4eb..ef7e793 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 _0x2ca5=['medium','BOOLEAN','out','DATE','STRING','exports','TEXT'];(function(_0x4e7267,_0x3c8118){var _0x4d1b49=function(_0x4f6c2e){while(--_0x4f6c2e){_0x4e7267['push'](_0x4e7267['shift']());}};_0x4d1b49(++_0x3c8118);}(_0x2ca5,0x108));var _0x52ca=function(_0x578a80,_0x412698){_0x578a80=_0x578a80-0x0;var _0x4b4ba8=_0x2ca5[_0x578a80];return _0x4b4ba8;};'use strict';var Sequelize=require('sequelize');module[_0x52ca('0x0')]={'body':{'type':Sequelize[_0x52ca('0x1')](_0x52ca('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x52ca('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x52ca('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x52ca('0x5')]},'providerName':{'type':Sequelize[_0x52ca('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7334=['out','DATE','STRING','sequelize','exports','TEXT','BOOLEAN'];(function(_0x36e704,_0x28c34a){var _0xfb5833=function(_0x51ad64){while(--_0x51ad64){_0x36e704['push'](_0x36e704['shift']());}};_0xfb5833(++_0x28c34a);}(_0x7334,0x184));var _0x4733=function(_0x4f8c45,_0x3818e4){_0x4f8c45=_0x4f8c45-0x0;var _0x3e8562=_0x7334[_0x4f8c45];return _0x3e8562;};'use strict';var Sequelize=require(_0x4733('0x0'));module[_0x4733('0x1')]={'body':{'type':Sequelize[_0x4733('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x4733('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4733('0x4')),'defaultValue':_0x4733('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4733('0x5')]},'providerName':{'type':Sequelize[_0x4733('0x6')]},'providerResponse':{'type':Sequelize[_0x4733('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 2825c57..091b277 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 _0xd62f=['util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ChatMessage','fieldName','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','../../config/logger','accept','readAt','format','UserId','user','agent','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','contact','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xd62f,0x106));var _0xfd62=function(_0x3fb30c,_0x30d88e){_0x3fb30c=_0x3fb30c-0x0;var _0x3ff3b3=_0xd62f[_0x3fb30c];return _0x3ff3b3;};'use strict';var emlformat=require(_0xfd62('0x0'));var rimraf=require(_0xfd62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd62('0x2'));var rp=require(_0xfd62('0x3'));var moment=require('moment');var BPromise=require(_0xfd62('0x4'));var Mustache=require(_0xfd62('0x5'));var util=require(_0xfd62('0x6'));var path=require('path');var sox=require(_0xfd62('0x7'));var csv=require(_0xfd62('0x8'));var ejs=require(_0xfd62('0x9'));var fs=require('fs');var fs_extra=require(_0xfd62('0xa'));var _=require(_0xfd62('0xb'));var squel=require('squel');var crypto=require(_0xfd62('0xc'));var jsforce=require(_0xfd62('0xd'));var deskjs=require(_0xfd62('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfd62('0xf'));var Papa=require(_0xfd62('0x10'));var Redis=require(_0xfd62('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfd62('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd62('0x13'));var logger=require('../../config/logger')(_0xfd62('0x14'));var utils=require(_0xfd62('0x15'));var config=require(_0xfd62('0x16'));var licenseUtil=require(_0xfd62('0x17'));var db=require(_0xfd62('0x18'))['db'];config[_0xfd62('0x19')]=_[_0xfd62('0x1a')](config[_0xfd62('0x19')],{'host':_0xfd62('0x1b'),'port':0x18eb});var socket=require(_0xfd62('0x1c'))(new Redis(config[_0xfd62('0x19')]));require(_0xfd62('0x1d'))[_0xfd62('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xfd62('0x1f')][_0xfd62('0x20')]({'port':0x232c});var client9002=jayson[_0xfd62('0x1f')][_0xfd62('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x33c927,_0xcadda,_0x20bd9c,_0x239c22){return new BPromise(function(_0x17671d,_0x1b7076){var _0x33763b=_0x239c22||client;return _0x33763b[_0xfd62('0x21')](_0x33c927,_0x20bd9c)['then'](function(_0x5c4248){logger[_0xfd62('0x22')](_0xfd62('0x23'),_0xcadda,_0xfd62('0x24'));logger[_0xfd62('0x25')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0xcadda,_0xfd62('0x24'),JSON[_0xfd62('0x26')](_0x5c4248));if(_0x5c4248[_0xfd62('0x27')]){if(_0x5c4248['error'][_0xfd62('0x28')]===0x1f4){logger[_0xfd62('0x27')](_0xfd62('0x23'),_0xcadda,_0x5c4248[_0xfd62('0x27')][_0xfd62('0x29')]);return _0x1b7076(_0x5c4248[_0xfd62('0x27')][_0xfd62('0x29')]);}logger[_0xfd62('0x27')](_0xfd62('0x23'),_0xcadda,_0x5c4248[_0xfd62('0x27')][_0xfd62('0x29')]);return _0x17671d(_0x5c4248['error']['message']);}else{logger['info'](_0xfd62('0x23'),_0xcadda,_0xfd62('0x24'));_0x17671d(_0x5c4248[_0xfd62('0x2a')][_0xfd62('0x29')]);}})['catch'](function(_0x277d33){logger[_0xfd62('0x27')](_0xfd62('0x23'),_0xcadda,_0x277d33);_0x1b7076(_0x277d33);});});}function respondWithStatusCode(_0x4dd42a,_0x2065ed){_0x2065ed=_0x2065ed||0xcc;return function(_0x30ca84){if(_0x30ca84){return _0x4dd42a[_0xfd62('0x2b')](_0x2065ed);}return _0x4dd42a[_0xfd62('0x2c')](_0x2065ed)[_0xfd62('0x2d')]();};}function respondWithResult(_0x5c0e1d,_0x1ee853){_0x1ee853=_0x1ee853||0xc8;return function(_0x531826){if(_0x531826){return _0x5c0e1d[_0xfd62('0x2c')](_0x1ee853)[_0xfd62('0x2e')](_0x531826);}};}function respondWithFilteredResult(_0x51d932,_0x305945){return function(_0xb4efc2){if(_0xb4efc2){var _0x5e139e=typeof _0x305945[_0xfd62('0x2f')]==='undefined'&&typeof _0x305945['limit']==='undefined';var _0x3206ed=_0xb4efc2[_0xfd62('0x30')];var _0x183a5e=_0x5e139e?0x0:_0x305945['offset'];var _0x3a59d6=_0x5e139e?_0xb4efc2[_0xfd62('0x30')]:_0x305945[_0xfd62('0x2f')]+_0x305945[_0xfd62('0x31')];var _0x2aa8a4;if(_0x3a59d6>=_0x3206ed){_0x3a59d6=_0x3206ed;_0x2aa8a4=0xc8;}else{_0x2aa8a4=0xce;}_0x51d932['status'](_0x2aa8a4);return _0x51d932[_0xfd62('0x32')](_0xfd62('0x33'),_0x183a5e+'-'+_0x3a59d6+'/'+_0x3206ed)[_0xfd62('0x2e')](_0xb4efc2);}return null;};}function patchUpdates(_0x4a9cc5){return function(_0x1dd8a8){try{jsonpatch[_0xfd62('0x34')](_0x1dd8a8,_0x4a9cc5,!![]);}catch(_0x33ad04){return BPromise[_0xfd62('0x35')](_0x33ad04);}return _0x1dd8a8[_0xfd62('0x36')]();};}function saveUpdates(_0xc1afe5,_0x52753f){return function(_0x2f1a80){if(_0x2f1a80){return _0x2f1a80[_0xfd62('0x37')](_0xc1afe5)[_0xfd62('0x38')](function(_0x51c3c5){return _0x51c3c5;});}return null;};}function removeEntity(_0x305698,_0x476ad5){return function(_0x4d7926){if(_0x4d7926){return _0x4d7926[_0xfd62('0x39')]()[_0xfd62('0x38')](function(){_0x305698[_0xfd62('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x138428,_0x350e63){return function(_0x3e53bc){if(!_0x3e53bc){_0x138428['sendStatus'](0x194);}return _0x3e53bc;};}function handleError(_0x147392,_0x9e991b){_0x9e991b=_0x9e991b||0x1f4;return function(_0x4317c4){logger[_0xfd62('0x27')](_0x4317c4[_0xfd62('0x3a')]);if(_0x4317c4[_0xfd62('0x3b')]){delete _0x4317c4[_0xfd62('0x3b')];}_0x147392[_0xfd62('0x2c')](_0x9e991b)[_0xfd62('0x3c')](_0x4317c4);};}exports[_0xfd62('0x3d')]=function(_0x66ef6a,_0x5129f2){var _0x4e8190={},_0x41b882={},_0x48faa6={'count':0x0,'rows':[]};var _0x1db99a=_[_0xfd62('0x3e')](db[_0xfd62('0x3f')]['rawAttributes'],function(_0x42ce09){return{'name':_0x42ce09[_0xfd62('0x40')],'type':_0x42ce09['type'][_0xfd62('0x41')]};});_0x41b882['model']=_[_0xfd62('0x3e')](_0x1db99a,_0xfd62('0x3b'));_0x41b882['query']=_[_0xfd62('0x42')](_0x66ef6a['query']);_0x41b882[_0xfd62('0x43')]=_[_0xfd62('0x44')](_0x41b882[_0xfd62('0x45')],_0x41b882[_0xfd62('0x46')]);_0x4e8190[_0xfd62('0x47')]=_[_0xfd62('0x44')](_0x41b882[_0xfd62('0x45')],qs[_0xfd62('0x48')](_0x66ef6a[_0xfd62('0x46')][_0xfd62('0x48')]));_0x4e8190['attributes']=_0x4e8190['attributes'][_0xfd62('0x49')]?_0x4e8190[_0xfd62('0x47')]:_0x41b882[_0xfd62('0x45')];if(!_0x66ef6a['query'][_0xfd62('0x4a')]('nolimit')){_0x4e8190['limit']=qs[_0xfd62('0x31')](_0x66ef6a[_0xfd62('0x46')][_0xfd62('0x31')]);_0x4e8190[_0xfd62('0x2f')]=qs['offset'](_0x66ef6a[_0xfd62('0x46')][_0xfd62('0x2f')]);}_0x4e8190[_0xfd62('0x4b')]=qs[_0xfd62('0x4c')](_0x66ef6a[_0xfd62('0x46')][_0xfd62('0x4c')]);_0x4e8190['where']=qs[_0xfd62('0x43')](_['pick'](_0x66ef6a[_0xfd62('0x46')],_0x41b882['filters']),_0x1db99a);if(_0x66ef6a[_0xfd62('0x46')][_0xfd62('0x4d')]){_0x4e8190[_0xfd62('0x4e')]=_[_0xfd62('0x4f')](_0x4e8190[_0xfd62('0x4e')],{'$or':_['map'](_0x1db99a,function(_0x5e068c){if(_0x5e068c[_0xfd62('0x50')]!==_0xfd62('0x51')){var _0x11b5d7={};_0x11b5d7[_0x5e068c[_0xfd62('0x3b')]]={'$like':'%'+_0x66ef6a[_0xfd62('0x46')][_0xfd62('0x4d')]+'%'};return _0x11b5d7;}})});}_0x4e8190=_[_0xfd62('0x4f')]({},_0x4e8190,_0x66ef6a[_0xfd62('0x52')]);var _0x4e25fd={'where':_0x4e8190['where']};return db[_0xfd62('0x3f')]['count'](_0x4e25fd)[_0xfd62('0x38')](function(_0x3d627a){_0x48faa6['count']=_0x3d627a;if(_0x66ef6a[_0xfd62('0x46')][_0xfd62('0x53')]){_0x4e8190[_0xfd62('0x54')]=[{'all':!![]}];}return db[_0xfd62('0x3f')][_0xfd62('0x55')](_0x4e8190);})[_0xfd62('0x38')](function(_0x25af82){_0x48faa6[_0xfd62('0x56')]=_0x25af82;return _0x48faa6;})[_0xfd62('0x38')](respondWithFilteredResult(_0x5129f2,_0x4e8190))[_0xfd62('0x57')](handleError(_0x5129f2,null));};exports[_0xfd62('0x58')]=function(_0x3a40e4,_0x5dd432){var _0x1946ed={'raw':!![],'where':{'id':_0x3a40e4[_0xfd62('0x59')]['id']}},_0x218bcb={};_0x218bcb[_0xfd62('0x45')]=_[_0xfd62('0x42')](db[_0xfd62('0x3f')][_0xfd62('0x5a')]);_0x218bcb[_0xfd62('0x46')]=_[_0xfd62('0x42')](_0x3a40e4['query']);_0x218bcb[_0xfd62('0x43')]=_[_0xfd62('0x44')](_0x218bcb['model'],_0x218bcb['query']);_0x1946ed['attributes']=_['intersection'](_0x218bcb[_0xfd62('0x45')],qs['fields'](_0x3a40e4[_0xfd62('0x46')][_0xfd62('0x48')]));_0x1946ed[_0xfd62('0x47')]=_0x1946ed[_0xfd62('0x47')][_0xfd62('0x49')]?_0x1946ed['attributes']:_0x218bcb[_0xfd62('0x45')];if(_0x3a40e4['query']['includeAll']){_0x1946ed[_0xfd62('0x54')]=[{'all':!![]}];}_0x1946ed=_[_0xfd62('0x4f')]({},_0x1946ed,_0x3a40e4[_0xfd62('0x52')]);return db[_0xfd62('0x3f')][_0xfd62('0x5b')](_0x1946ed)[_0xfd62('0x38')](handleEntityNotFound(_0x5dd432,null))[_0xfd62('0x38')](respondWithResult(_0x5dd432,null))[_0xfd62('0x57')](handleError(_0x5dd432,null));};exports[_0xfd62('0x5c')]=function(_0x5bd841,_0x7d99e){return db[_0xfd62('0x3f')][_0xfd62('0x5c')](_0x5bd841['body'],{})['then'](respondWithResult(_0x7d99e,0xc9))[_0xfd62('0x57')](handleError(_0x7d99e,null));};exports[_0xfd62('0x37')]=function(_0x6ef660,_0x2a9af3){if(_0x6ef660[_0xfd62('0x5d')]['id']){delete _0x6ef660[_0xfd62('0x5d')]['id'];}return db[_0xfd62('0x3f')][_0xfd62('0x5b')]({'where':{'id':_0x6ef660[_0xfd62('0x59')]['id']}})[_0xfd62('0x38')](handleEntityNotFound(_0x2a9af3,null))[_0xfd62('0x38')](saveUpdates(_0x6ef660[_0xfd62('0x5d')],null))[_0xfd62('0x38')](respondWithResult(_0x2a9af3,null))[_0xfd62('0x57')](handleError(_0x2a9af3,null));};exports[_0xfd62('0x39')]=function(_0x53f7b9,_0x4eb1dd){return db[_0xfd62('0x3f')]['find']({'where':{'id':_0x53f7b9[_0xfd62('0x59')]['id']}})[_0xfd62('0x38')](handleEntityNotFound(_0x4eb1dd,null))[_0xfd62('0x38')](removeEntity(_0x4eb1dd,null))[_0xfd62('0x57')](handleError(_0x4eb1dd,null));};exports[_0xfd62('0x5e')]=function(_0x108abd,_0x13e287){return db['ChatMessage'][_0xfd62('0x5e')]()['then'](respondWithResult(_0x13e287,null))[_0xfd62('0x57')](handleError(_0x13e287,null));};var interaction_log=require(_0xfd62('0x5f'))('chat-interactions');exports[_0xfd62('0x60')]=function(_0x3a6b89,_0x2d6145,_0x3bff68){var _0x2acf04={'agent':{},'channel':'chat'};if(_0x3a6b89[_0xfd62('0x5d')]['id']){delete _0x3a6b89['body']['id'];}_0x3a6b89['body']['read']=!![];_0x3a6b89[_0xfd62('0x5d')][_0xfd62('0x61')]=moment()[_0xfd62('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x3a6b89[_0xfd62('0x5d')][_0xfd62('0x63')]=_0x3a6b89[_0xfd62('0x5d')]['UserId']||_0x3a6b89[_0xfd62('0x64')]['id'];_0x2acf04[_0xfd62('0x65')]['id']=_0x3a6b89[_0xfd62('0x5d')][_0xfd62('0x63')];return db[_0xfd62('0x3f')][_0xfd62('0x5b')]({'where':{'id':_0x3a6b89[_0xfd62('0x59')]['id'],'UserId':null}})[_0xfd62('0x38')](handleEntityNotFound(_0x2d6145,null))['then'](saveUpdates(_0x3a6b89[_0xfd62('0x5d')],null))[_0xfd62('0x38')](function(_0x51eab5){if(_0x51eab5){_0x2acf04['message']=_0x51eab5['get']({'plain':!![]});return db[_0xfd62('0x66')][_0xfd62('0x5b')]({'where':{'id':_0x51eab5[_0xfd62('0x67')]}});}return null;})[_0xfd62('0x38')](handleEntityNotFound(_0x2d6145,null))['then'](function(_0x1940fa){if(_0x1940fa){return _0x1940fa[_0xfd62('0x37')]({'UserId':_0x3a6b89[_0xfd62('0x5d')]['UserId'],'read1stAt':_[_0xfd62('0x68')](_0x1940fa[_0xfd62('0x69')])?moment()[_0xfd62('0x62')](_0xfd62('0x6a')):undefined});}return null;})[_0xfd62('0x38')](function(_0x281c49){if(_0x281c49){_0x2acf04[_0xfd62('0x6b')]=_0x281c49[_0xfd62('0x6c')]({'plain':!![]});interaction_log[_0xfd62('0x22')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3a6b89[_0xfd62('0x64')]['id'],_0x3a6b89[_0xfd62('0x64')][_0xfd62('0x3b')],_0x3a6b89[_0xfd62('0x64')][_0xfd62('0x6d')],_0x2acf04[_0xfd62('0x6b')]['id'],_0x3a6b89[_0xfd62('0x5d')]?JSON[_0xfd62('0x26')](_0x3a6b89[_0xfd62('0x5d')]):_0xfd62('0x6e'));return respondWithRpcPromise(_0xfd62('0x6f'),'acceptMessage',_0x2acf04);}return null;})[_0xfd62('0x38')](function(_0x3e4295){var _0xb2b9d8=_0xfd62('0x70')+_0x3e4295[_0xfd62('0x29')][_0xfd62('0x71')];return db[_0xfd62('0x72')][_0xfd62('0x46')](_0xb2b9d8,{'type':db[_0xfd62('0x73')][_0xfd62('0x74')][_0xfd62('0x75')],'raw':!![]})[_0xfd62('0x38')](function(_0x321eb6){return _0x321eb6;});})[_0xfd62('0x38')](function(_0x5112c3){if(_0x5112c3){_0x2acf04[_0xfd62('0x29')]['contact']=_0x5112c3[0x0];if(!_0x3a6b89[_0xfd62('0x5d')][_0xfd62('0x63')])return;return db[_0xfd62('0x76')]['find']({'where':{'id':_0x3a6b89[_0xfd62('0x5d')][_0xfd62('0x63')],'role':'agent'},'attributes':['id',_0xfd62('0x3b'),_0xfd62('0x77'),_0xfd62('0x78'),_0xfd62('0x79')],'raw':!![]});}return null;})[_0xfd62('0x38')](function(_0xed65a1){if(!_0xed65a1)return null;_0x2acf04[_0xfd62('0x29')]['agent']=_0xed65a1;return _0x2acf04;})['then'](function(_0x396ddb){if(_0x396ddb){if(_0x3a6b89['body'][_0xfd62('0x7a')]){_0x2acf04[_0xfd62('0x29')][_0xfd62('0x7b')]=util[_0xfd62('0x62')](_0xfd62('0x7c'),_0x3a6b89[_0xfd62('0x64')][_0xfd62('0x3b')]);_0x2acf04[_0xfd62('0x29')][_0xfd62('0x7d')]=_0x2acf04[_0xfd62('0x7d')];_0x2acf04[_0xfd62('0x29')][_0xfd62('0x7e')]=_0x2acf04[_0xfd62('0x7d')];_0x2acf04[_0xfd62('0x29')][_0xfd62('0x7f')]=_0xfd62('0x60');return respondWithRpcPromise(_0xfd62('0x80'),_0xfd62('0x80'),{'event':'acceptmessage','message':_[_0xfd62('0x4f')](_0x2acf04[_0xfd62('0x29')],JSON['parse'](_0x2acf04[_0xfd62('0x6b')]['formData']))},client9002)[_0xfd62('0x38')](function(){return _0x2acf04;});}return _0x2acf04;}return null;})['then'](respondWithResult(_0x2d6145,null))[_0xfd62('0x57')](handleError(_0x2d6145,null));};var interaction_log=require(_0xfd62('0x5f'))('chat-interactions');exports[_0xfd62('0x35')]=function(_0x5a4767,_0x2a15d5,_0x1d4040){var _0x7359be={'agent':{},'channel':_0xfd62('0x81')};if(_0x5a4767[_0xfd62('0x5d')]['id']){delete _0x5a4767['body']['id'];}_0x5a4767['body'][_0xfd62('0x63')]=_0x5a4767[_0xfd62('0x5d')][_0xfd62('0x63')]||_0x5a4767['user']['id'];_0x7359be[_0xfd62('0x65')]['id']=_0x5a4767[_0xfd62('0x5d')][_0xfd62('0x63')];return db[_0xfd62('0x3f')]['find']({'where':{'id':_0x5a4767[_0xfd62('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2a15d5,null))['then'](function(_0x10c02e){if(_0x10c02e){_0x7359be[_0xfd62('0x29')]=_0x10c02e[_0xfd62('0x6c')]({'plain':!![]});return db['ChatInteraction'][_0xfd62('0x5b')]({'where':{'id':_0x10c02e[_0xfd62('0x67')]}});}return null;})[_0xfd62('0x38')](handleEntityNotFound(_0x2a15d5,null))[_0xfd62('0x38')](function(_0x45d754){if(_0x45d754){_0x7359be['interaction']=_0x45d754[_0xfd62('0x6c')]({'plain':!![]});interaction_log[_0xfd62('0x22')](_0xfd62('0x82'),_0x5a4767[_0xfd62('0x64')]['id'],_0x5a4767[_0xfd62('0x64')][_0xfd62('0x3b')],_0x5a4767['user'][_0xfd62('0x6d')],_0x7359be[_0xfd62('0x6b')]['id'],_0x5a4767['body']?JSON['stringify'](_0x5a4767[_0xfd62('0x5d')]):'null');return respondWithRpcPromise('RejectMessage',_0xfd62('0x83'),_0x7359be);}return null;})[_0xfd62('0x38')](function(_0x19a969){var _0x1263b9=_0xfd62('0x70')+_0x19a969['message']['ContactId'];return db[_0xfd62('0x72')][_0xfd62('0x46')](_0x1263b9,{'type':db[_0xfd62('0x73')][_0xfd62('0x74')][_0xfd62('0x75')],'raw':!![]})[_0xfd62('0x38')](function(_0x1d2a2d){return _0x1d2a2d;});})[_0xfd62('0x38')](function(_0x1ed90e){if(_0x1ed90e){_0x7359be[_0xfd62('0x29')][_0xfd62('0x84')]=_0x1ed90e[0x0];if(!_0x5a4767['body'][_0xfd62('0x63')])return;return db[_0xfd62('0x76')]['find']({'where':{'id':_0x5a4767['body'][_0xfd62('0x63')],'role':'agent'},'attributes':['id',_0xfd62('0x3b'),_0xfd62('0x77'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x1c81b8){if(!_0x1c81b8)return null;_0x7359be[_0xfd62('0x29')][_0xfd62('0x65')]=_0x1c81b8;return _0x7359be;})[_0xfd62('0x38')](function(_0x31324e){if(_0x31324e){_0x31324e[_0xfd62('0x29')][_0xfd62('0x7b')]=util[_0xfd62('0x62')](_0xfd62('0x7c'),_0x5a4767[_0xfd62('0x64')]['name']);_0x31324e[_0xfd62('0x29')][_0xfd62('0x7d')]=_0x7359be[_0xfd62('0x7d')];_0x31324e[_0xfd62('0x29')][_0xfd62('0x7e')]=_0x7359be[_0xfd62('0x7d')];_0x31324e[_0xfd62('0x29')][_0xfd62('0x7f')]=_0xfd62('0x35');respondWithRpcPromise(_0xfd62('0x80'),_0xfd62('0x80'),{'event':_0xfd62('0x85'),'message':_[_0xfd62('0x4f')](_0x7359be['message'],JSON['parse'](_0x7359be['interaction']['formData']))},client9002);return _0x7359be;}return null;})['then'](respondWithResult(_0x2a15d5,null))[_0xfd62('0x57')](handleError(_0x2a15d5,null));}; \ No newline at end of file +var _0x2d84=['register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','stack','name','send','ChatMessage','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','rawAttributes','includeAll','find','create','body','update','params','describe','accept','chat','readAt','format','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','../../config/logger','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x2d84,0x6d));var _0x42d8=function(_0x5f5904,_0x5c6d26){_0x5f5904=_0x5f5904-0x0;var _0x2400f2=_0x2d84[_0x5f5904];return _0x2400f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x42d8('0x0'));var zipdir=require(_0x42d8('0x1'));var jsonpatch=require(_0x42d8('0x2'));var rp=require(_0x42d8('0x3'));var moment=require(_0x42d8('0x4'));var BPromise=require(_0x42d8('0x5'));var Mustache=require(_0x42d8('0x6'));var util=require(_0x42d8('0x7'));var path=require(_0x42d8('0x8'));var sox=require('sox');var csv=require(_0x42d8('0x9'));var ejs=require(_0x42d8('0xa'));var fs=require('fs');var fs_extra=require(_0x42d8('0xb'));var _=require(_0x42d8('0xc'));var squel=require('squel');var crypto=require(_0x42d8('0xd'));var jsforce=require(_0x42d8('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x42d8('0xf'));var Papa=require(_0x42d8('0x10'));var Redis=require('ioredis');var authService=require(_0x42d8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x42d8('0x12'));var hardwareService=require(_0x42d8('0x13'));var logger=require('../../config/logger')(_0x42d8('0x14'));var utils=require(_0x42d8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x42d8('0x16'));var db=require(_0x42d8('0x17'))['db'];config[_0x42d8('0x18')]=_[_0x42d8('0x19')](config[_0x42d8('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x42d8('0x1a'))(new Redis(config[_0x42d8('0x18')]));require(_0x42d8('0x1b'))[_0x42d8('0x1c')](socket);var jayson=require(_0x42d8('0x1d'));var client=jayson[_0x42d8('0x1e')][_0x42d8('0x1f')]({'port':0x232c});var client9002=jayson[_0x42d8('0x1e')][_0x42d8('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x438fc0,_0x2749e6,_0x18802a,_0xa01c72){return new BPromise(function(_0x43e8c8,_0x109c82){var _0x4dc1f4=_0xa01c72||client;return _0x4dc1f4[_0x42d8('0x20')](_0x438fc0,_0x18802a)[_0x42d8('0x21')](function(_0x5ca335){logger[_0x42d8('0x22')](_0x42d8('0x23'),_0x2749e6,_0x42d8('0x24'));logger[_0x42d8('0x25')](_0x42d8('0x26'),_0x2749e6,_0x42d8('0x24'),JSON[_0x42d8('0x27')](_0x5ca335));if(_0x5ca335['error']){if(_0x5ca335[_0x42d8('0x28')]['code']===0x1f4){logger[_0x42d8('0x28')](_0x42d8('0x23'),_0x2749e6,_0x5ca335[_0x42d8('0x28')][_0x42d8('0x29')]);return _0x109c82(_0x5ca335['error'][_0x42d8('0x29')]);}logger[_0x42d8('0x28')]('ChatMessage,\x20%s,\x20%s',_0x2749e6,_0x5ca335[_0x42d8('0x28')][_0x42d8('0x29')]);return _0x43e8c8(_0x5ca335[_0x42d8('0x28')][_0x42d8('0x29')]);}else{logger['info'](_0x42d8('0x23'),_0x2749e6,'request\x20sent');_0x43e8c8(_0x5ca335[_0x42d8('0x2a')][_0x42d8('0x29')]);}})[_0x42d8('0x2b')](function(_0x21bec2){logger['error'](_0x42d8('0x23'),_0x2749e6,_0x21bec2);_0x109c82(_0x21bec2);});});}function respondWithStatusCode(_0x13b6f5,_0x3746c8){_0x3746c8=_0x3746c8||0xcc;return function(_0xf3bda3){if(_0xf3bda3){return _0x13b6f5[_0x42d8('0x2c')](_0x3746c8);}return _0x13b6f5[_0x42d8('0x2d')](_0x3746c8)[_0x42d8('0x2e')]();};}function respondWithResult(_0x3b1ead,_0x5abb05){_0x5abb05=_0x5abb05||0xc8;return function(_0xf90eeb){if(_0xf90eeb){return _0x3b1ead[_0x42d8('0x2d')](_0x5abb05)[_0x42d8('0x2f')](_0xf90eeb);}};}function respondWithFilteredResult(_0x13b5c9,_0x5bb616){return function(_0x3ed97a){if(_0x3ed97a){var _0x29125d=typeof _0x5bb616[_0x42d8('0x30')]===_0x42d8('0x31')&&typeof _0x5bb616[_0x42d8('0x32')]==='undefined';var _0x1646f2=_0x3ed97a[_0x42d8('0x33')];var _0x26c93a=_0x29125d?0x0:_0x5bb616['offset'];var _0x566ba9=_0x29125d?_0x3ed97a[_0x42d8('0x33')]:_0x5bb616[_0x42d8('0x30')]+_0x5bb616[_0x42d8('0x32')];var _0x1c9c16;if(_0x566ba9>=_0x1646f2){_0x566ba9=_0x1646f2;_0x1c9c16=0xc8;}else{_0x1c9c16=0xce;}_0x13b5c9[_0x42d8('0x2d')](_0x1c9c16);return _0x13b5c9[_0x42d8('0x34')](_0x42d8('0x35'),_0x26c93a+'-'+_0x566ba9+'/'+_0x1646f2)[_0x42d8('0x2f')](_0x3ed97a);}return null;};}function patchUpdates(_0xcae40f){return function(_0x51ffbb){try{jsonpatch[_0x42d8('0x36')](_0x51ffbb,_0xcae40f,!![]);}catch(_0x477c09){return BPromise[_0x42d8('0x37')](_0x477c09);}return _0x51ffbb[_0x42d8('0x38')]();};}function saveUpdates(_0x267a46,_0x1872c4){return function(_0xe5c3af){if(_0xe5c3af){return _0xe5c3af['update'](_0x267a46)[_0x42d8('0x21')](function(_0x36b25c){return _0x36b25c;});}return null;};}function removeEntity(_0x53e980,_0x4b9c1e){return function(_0x135e4e){if(_0x135e4e){return _0x135e4e[_0x42d8('0x39')]()[_0x42d8('0x21')](function(){_0x53e980['status'](0xcc)[_0x42d8('0x2e')]();});}};}function handleEntityNotFound(_0x215b3a,_0x1e5e68){return function(_0x1119b2){if(!_0x1119b2){_0x215b3a[_0x42d8('0x2c')](0x194);}return _0x1119b2;};}function handleError(_0x41a24d,_0x239fce){_0x239fce=_0x239fce||0x1f4;return function(_0x131ab4){logger[_0x42d8('0x28')](_0x131ab4[_0x42d8('0x3a')]);if(_0x131ab4[_0x42d8('0x3b')]){delete _0x131ab4[_0x42d8('0x3b')];}_0x41a24d[_0x42d8('0x2d')](_0x239fce)[_0x42d8('0x3c')](_0x131ab4);};}exports['index']=function(_0x55093e,_0x32c8ff){var _0x6d800f={},_0x5a3111={},_0x4580cf={'count':0x0,'rows':[]};var _0x3d28e1=_['map'](db[_0x42d8('0x3d')]['rawAttributes'],function(_0x2bc4d8){return{'name':_0x2bc4d8[_0x42d8('0x3e')],'type':_0x2bc4d8[_0x42d8('0x3f')]['key']};});_0x5a3111['model']=_[_0x42d8('0x40')](_0x3d28e1,_0x42d8('0x3b'));_0x5a3111[_0x42d8('0x41')]=_[_0x42d8('0x42')](_0x55093e[_0x42d8('0x41')]);_0x5a3111[_0x42d8('0x43')]=_[_0x42d8('0x44')](_0x5a3111[_0x42d8('0x45')],_0x5a3111[_0x42d8('0x41')]);_0x6d800f[_0x42d8('0x46')]=_[_0x42d8('0x44')](_0x5a3111['model'],qs[_0x42d8('0x47')](_0x55093e[_0x42d8('0x41')][_0x42d8('0x47')]));_0x6d800f[_0x42d8('0x46')]=_0x6d800f[_0x42d8('0x46')][_0x42d8('0x48')]?_0x6d800f[_0x42d8('0x46')]:_0x5a3111[_0x42d8('0x45')];if(!_0x55093e[_0x42d8('0x41')][_0x42d8('0x49')](_0x42d8('0x4a'))){_0x6d800f[_0x42d8('0x32')]=qs[_0x42d8('0x32')](_0x55093e[_0x42d8('0x41')][_0x42d8('0x32')]);_0x6d800f[_0x42d8('0x30')]=qs[_0x42d8('0x30')](_0x55093e['query'][_0x42d8('0x30')]);}_0x6d800f['order']=qs[_0x42d8('0x4b')](_0x55093e['query']['sort']);_0x6d800f[_0x42d8('0x4c')]=qs['filters'](_[_0x42d8('0x4d')](_0x55093e[_0x42d8('0x41')],_0x5a3111[_0x42d8('0x43')]),_0x3d28e1);if(_0x55093e['query'][_0x42d8('0x4e')]){_0x6d800f[_0x42d8('0x4c')]=_[_0x42d8('0x4f')](_0x6d800f['where'],{'$or':_['map'](_0x3d28e1,function(_0x53661f){if(_0x53661f['type']!==_0x42d8('0x50')){var _0x6dc0fc={};_0x6dc0fc[_0x53661f['name']]={'$like':'%'+_0x55093e[_0x42d8('0x41')]['filter']+'%'};return _0x6dc0fc;}})});}_0x6d800f=_[_0x42d8('0x4f')]({},_0x6d800f,_0x55093e[_0x42d8('0x51')]);var _0x3ba57b={'where':_0x6d800f[_0x42d8('0x4c')]};return db[_0x42d8('0x3d')][_0x42d8('0x33')](_0x3ba57b)[_0x42d8('0x21')](function(_0x1ec34c){_0x4580cf[_0x42d8('0x33')]=_0x1ec34c;if(_0x55093e[_0x42d8('0x41')]['includeAll']){_0x6d800f[_0x42d8('0x52')]=[{'all':!![]}];}return db['ChatMessage'][_0x42d8('0x53')](_0x6d800f);})[_0x42d8('0x21')](function(_0x4848d4){_0x4580cf[_0x42d8('0x54')]=_0x4848d4;return _0x4580cf;})[_0x42d8('0x21')](respondWithFilteredResult(_0x32c8ff,_0x6d800f))['catch'](handleError(_0x32c8ff,null));};exports[_0x42d8('0x55')]=function(_0x39e914,_0x380c94){var _0x167b48={'raw':!![],'where':{'id':_0x39e914['params']['id']}},_0x2865ac={};_0x2865ac['model']=_[_0x42d8('0x42')](db[_0x42d8('0x3d')][_0x42d8('0x56')]);_0x2865ac[_0x42d8('0x41')]=_[_0x42d8('0x42')](_0x39e914['query']);_0x2865ac[_0x42d8('0x43')]=_[_0x42d8('0x44')](_0x2865ac[_0x42d8('0x45')],_0x2865ac[_0x42d8('0x41')]);_0x167b48[_0x42d8('0x46')]=_[_0x42d8('0x44')](_0x2865ac[_0x42d8('0x45')],qs['fields'](_0x39e914[_0x42d8('0x41')]['fields']));_0x167b48[_0x42d8('0x46')]=_0x167b48[_0x42d8('0x46')][_0x42d8('0x48')]?_0x167b48[_0x42d8('0x46')]:_0x2865ac[_0x42d8('0x45')];if(_0x39e914[_0x42d8('0x41')][_0x42d8('0x57')]){_0x167b48['include']=[{'all':!![]}];}_0x167b48=_['merge']({},_0x167b48,_0x39e914[_0x42d8('0x51')]);return db[_0x42d8('0x3d')][_0x42d8('0x58')](_0x167b48)[_0x42d8('0x21')](handleEntityNotFound(_0x380c94,null))[_0x42d8('0x21')](respondWithResult(_0x380c94,null))[_0x42d8('0x2b')](handleError(_0x380c94,null));};exports['create']=function(_0x4ac632,_0x7b1139){return db[_0x42d8('0x3d')][_0x42d8('0x59')](_0x4ac632[_0x42d8('0x5a')],{})[_0x42d8('0x21')](respondWithResult(_0x7b1139,0xc9))['catch'](handleError(_0x7b1139,null));};exports[_0x42d8('0x5b')]=function(_0x4ac2a4,_0x4760a9){if(_0x4ac2a4[_0x42d8('0x5a')]['id']){delete _0x4ac2a4[_0x42d8('0x5a')]['id'];}return db[_0x42d8('0x3d')][_0x42d8('0x58')]({'where':{'id':_0x4ac2a4[_0x42d8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4760a9,null))[_0x42d8('0x21')](saveUpdates(_0x4ac2a4[_0x42d8('0x5a')],null))['then'](respondWithResult(_0x4760a9,null))[_0x42d8('0x2b')](handleError(_0x4760a9,null));};exports[_0x42d8('0x39')]=function(_0x40c26d,_0x58a154){return db[_0x42d8('0x3d')][_0x42d8('0x58')]({'where':{'id':_0x40c26d['params']['id']}})[_0x42d8('0x21')](handleEntityNotFound(_0x58a154,null))[_0x42d8('0x21')](removeEntity(_0x58a154,null))['catch'](handleError(_0x58a154,null));};exports[_0x42d8('0x5d')]=function(_0x367aeb,_0x349739){return db[_0x42d8('0x3d')][_0x42d8('0x5d')]()[_0x42d8('0x21')](respondWithResult(_0x349739,null))[_0x42d8('0x2b')](handleError(_0x349739,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x42d8('0x5e')]=function(_0x52e17e,_0x2d24f6,_0x5e3898){var _0x2676e7={'agent':{},'channel':_0x42d8('0x5f')};if(_0x52e17e[_0x42d8('0x5a')]['id']){delete _0x52e17e['body']['id'];}_0x52e17e['body']['read']=!![];_0x52e17e[_0x42d8('0x5a')][_0x42d8('0x60')]=moment()[_0x42d8('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x52e17e[_0x42d8('0x5a')][_0x42d8('0x62')]=_0x52e17e[_0x42d8('0x5a')]['UserId']||_0x52e17e[_0x42d8('0x63')]['id'];_0x2676e7[_0x42d8('0x64')]['id']=_0x52e17e[_0x42d8('0x5a')][_0x42d8('0x62')];return db[_0x42d8('0x3d')][_0x42d8('0x58')]({'where':{'id':_0x52e17e[_0x42d8('0x5c')]['id'],'UserId':null}})[_0x42d8('0x21')](handleEntityNotFound(_0x2d24f6,null))[_0x42d8('0x21')](saveUpdates(_0x52e17e['body'],null))[_0x42d8('0x21')](function(_0x5e502e){if(_0x5e502e){_0x2676e7['message']=_0x5e502e[_0x42d8('0x65')]({'plain':!![]});return db[_0x42d8('0x66')][_0x42d8('0x58')]({'where':{'id':_0x5e502e[_0x42d8('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x2d24f6,null))[_0x42d8('0x21')](function(_0x4a1d18){if(_0x4a1d18){return _0x4a1d18['update']({'UserId':_0x52e17e[_0x42d8('0x5a')][_0x42d8('0x62')],'read1stAt':_[_0x42d8('0x68')](_0x4a1d18[_0x42d8('0x69')])?moment()[_0x42d8('0x61')](_0x42d8('0x6a')):undefined});}return null;})[_0x42d8('0x21')](function(_0x1c871d){if(_0x1c871d){_0x2676e7[_0x42d8('0x6b')]=_0x1c871d[_0x42d8('0x65')]({'plain':!![]});interaction_log[_0x42d8('0x22')](_0x42d8('0x6c'),_0x52e17e[_0x42d8('0x63')]['id'],_0x52e17e[_0x42d8('0x63')]['name'],_0x52e17e[_0x42d8('0x63')]['role'],_0x2676e7[_0x42d8('0x6b')]['id'],_0x52e17e[_0x42d8('0x5a')]?JSON[_0x42d8('0x27')](_0x52e17e[_0x42d8('0x5a')]):_0x42d8('0x6d'));return respondWithRpcPromise(_0x42d8('0x6e'),_0x42d8('0x6f'),_0x2676e7);}return null;})['then'](function(_0x4d2c72){var _0x2f1bea='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4d2c72['message'][_0x42d8('0x70')];return db[_0x42d8('0x71')][_0x42d8('0x41')](_0x2f1bea,{'type':db[_0x42d8('0x72')][_0x42d8('0x73')]['SELECT'],'raw':!![]})[_0x42d8('0x21')](function(_0x25bc53){return _0x25bc53;});})[_0x42d8('0x21')](function(_0x5161b8){if(_0x5161b8){_0x2676e7['message'][_0x42d8('0x74')]=_0x5161b8[0x0];if(!_0x52e17e['body'][_0x42d8('0x62')])return;return db['User'][_0x42d8('0x58')]({'where':{'id':_0x52e17e[_0x42d8('0x5a')][_0x42d8('0x62')],'role':_0x42d8('0x64')},'attributes':['id','name',_0x42d8('0x75'),_0x42d8('0x76'),_0x42d8('0x77')],'raw':!![]});}return null;})[_0x42d8('0x21')](function(_0x13123c){if(!_0x13123c)return null;_0x2676e7[_0x42d8('0x29')][_0x42d8('0x64')]=_0x13123c;return _0x2676e7;})['then'](function(_0x21dd29){if(_0x21dd29){if(_0x52e17e[_0x42d8('0x5a')][_0x42d8('0x78')]){_0x2676e7[_0x42d8('0x29')][_0x42d8('0x79')]=util[_0x42d8('0x61')](_0x42d8('0x7a'),_0x52e17e[_0x42d8('0x63')][_0x42d8('0x3b')]);_0x2676e7[_0x42d8('0x29')][_0x42d8('0x7b')]=_0x2676e7[_0x42d8('0x7b')];_0x2676e7[_0x42d8('0x29')][_0x42d8('0x7c')]=_0x2676e7[_0x42d8('0x7b')];_0x2676e7[_0x42d8('0x29')][_0x42d8('0x7d')]=_0x42d8('0x5e');return respondWithRpcPromise(_0x42d8('0x7e'),_0x42d8('0x7e'),{'event':'acceptmessage','message':_[_0x42d8('0x4f')](_0x2676e7[_0x42d8('0x29')],JSON[_0x42d8('0x7f')](_0x2676e7[_0x42d8('0x6b')][_0x42d8('0x80')]))},client9002)[_0x42d8('0x21')](function(){return _0x2676e7;});}return _0x2676e7;}return null;})['then'](respondWithResult(_0x2d24f6,null))[_0x42d8('0x2b')](handleError(_0x2d24f6,null));};var interaction_log=require(_0x42d8('0x81'))(_0x42d8('0x82'));exports[_0x42d8('0x37')]=function(_0x48bb88,_0x5ed066,_0x1690c4){var _0x3dad98={'agent':{},'channel':'chat'};if(_0x48bb88[_0x42d8('0x5a')]['id']){delete _0x48bb88[_0x42d8('0x5a')]['id'];}_0x48bb88[_0x42d8('0x5a')]['UserId']=_0x48bb88[_0x42d8('0x5a')]['UserId']||_0x48bb88[_0x42d8('0x63')]['id'];_0x3dad98[_0x42d8('0x64')]['id']=_0x48bb88[_0x42d8('0x5a')][_0x42d8('0x62')];return db['ChatMessage'][_0x42d8('0x58')]({'where':{'id':_0x48bb88[_0x42d8('0x5c')]['id'],'UserId':null}})[_0x42d8('0x21')](handleEntityNotFound(_0x5ed066,null))[_0x42d8('0x21')](function(_0x3487ce){if(_0x3487ce){_0x3dad98[_0x42d8('0x29')]=_0x3487ce['get']({'plain':!![]});return db[_0x42d8('0x66')]['find']({'where':{'id':_0x3487ce['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5ed066,null))[_0x42d8('0x21')](function(_0x58793f){if(_0x58793f){_0x3dad98['interaction']=_0x58793f[_0x42d8('0x65')]({'plain':!![]});interaction_log['info'](_0x42d8('0x83'),_0x48bb88[_0x42d8('0x63')]['id'],_0x48bb88['user'][_0x42d8('0x3b')],_0x48bb88[_0x42d8('0x63')][_0x42d8('0x84')],_0x3dad98['interaction']['id'],_0x48bb88[_0x42d8('0x5a')]?JSON[_0x42d8('0x27')](_0x48bb88[_0x42d8('0x5a')]):_0x42d8('0x6d'));return respondWithRpcPromise(_0x42d8('0x85'),'rejectMessage',_0x3dad98);}return null;})[_0x42d8('0x21')](function(_0x232ef0){var _0x397ab9=_0x42d8('0x86')+_0x232ef0[_0x42d8('0x29')][_0x42d8('0x70')];return db[_0x42d8('0x71')]['query'](_0x397ab9,{'type':db['Sequelize'][_0x42d8('0x73')][_0x42d8('0x87')],'raw':!![]})[_0x42d8('0x21')](function(_0x34b6cb){return _0x34b6cb;});})[_0x42d8('0x21')](function(_0x2d1c6d){if(_0x2d1c6d){_0x3dad98[_0x42d8('0x29')][_0x42d8('0x74')]=_0x2d1c6d[0x0];if(!_0x48bb88[_0x42d8('0x5a')][_0x42d8('0x62')])return;return db['User']['find']({'where':{'id':_0x48bb88[_0x42d8('0x5a')][_0x42d8('0x62')],'role':_0x42d8('0x64')},'attributes':['id',_0x42d8('0x3b'),'fullname',_0x42d8('0x76'),'internal'],'raw':!![]});}return null;})[_0x42d8('0x21')](function(_0x3bd748){if(!_0x3bd748)return null;_0x3dad98[_0x42d8('0x29')][_0x42d8('0x64')]=_0x3bd748;return _0x3dad98;})[_0x42d8('0x21')](function(_0x4520fb){if(_0x4520fb){_0x4520fb['message']['interface']=util[_0x42d8('0x61')](_0x42d8('0x7a'),_0x48bb88['user'][_0x42d8('0x3b')]);_0x4520fb[_0x42d8('0x29')][_0x42d8('0x7b')]=_0x3dad98[_0x42d8('0x7b')];_0x4520fb['message']['motionChannel']=_0x3dad98[_0x42d8('0x7b')];_0x4520fb[_0x42d8('0x29')][_0x42d8('0x7d')]='reject';respondWithRpcPromise(_0x42d8('0x7e'),'EventManager',{'event':_0x42d8('0x88'),'message':_['merge'](_0x3dad98['message'],JSON[_0x42d8('0x7f')](_0x3dad98[_0x42d8('0x6b')][_0x42d8('0x80')]))},client9002);return _0x3dad98;}return null;})[_0x42d8('0x21')](respondWithResult(_0x5ed066,null))[_0x42d8('0x2b')](handleError(_0x5ed066,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 5c69c50..23472f7 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 _0x6493=['save','update','remove','emit','hasOwnProperty','exports','events','ChatMessage'];(function(_0x24c60a,_0x4dca0c){var _0x35f041=function(_0x59d38c){while(--_0x59d38c){_0x24c60a['push'](_0x24c60a['shift']());}};_0x35f041(++_0x4dca0c);}(_0x6493,0x1a6));var _0x3649=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x6493[_0x50cfc3];return _0x5c11ef;};'use strict';var EventEmitter=require(_0x3649('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x3649('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3649('0x2'),'afterUpdate':_0x3649('0x3'),'afterDestroy':_0x3649('0x4')};function emitEvent(_0x5d7497){return function(_0xf076cc,_0x4f5508,_0x625ab4){ChatMessageEvents[_0x3649('0x5')](_0x5d7497+':'+_0xf076cc['id'],_0xf076cc);ChatMessageEvents['emit'](_0x5d7497,_0xf076cc);_0x625ab4(null);};}for(var e in events){if(events[_0x3649('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x3649('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x89dc=['ChatMessage','update','remove','emit','hook','events'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0x89dc,0xe9));var _0xc89d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x89dc[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xc89d('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xc89d('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc89d('0x2'),'afterDestroy':_0xc89d('0x3')};function emitEvent(_0x15e5d9){return function(_0x2f0263,_0x23a29f,_0x60f93f){ChatMessageEvents[_0xc89d('0x4')](_0x15e5d9+':'+_0x2f0263['id'],_0x2f0263);ChatMessageEvents[_0xc89d('0x4')](_0x15e5d9,_0x2f0263);_0x60f93f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xc89d('0x5')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 2c30ffc..39ec565 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 _0x5044=['bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','then','createdAt','catch','utf8mb4','util','api','moment'];(function(_0x357979,_0x56feef){var _0xabb42f=function(_0x447f9d){while(--_0x447f9d){_0x357979['push'](_0x357979['shift']());}};_0xabb42f(++_0x56feef);}(_0x5044,0xc8));var _0x4504=function(_0xeeebaa,_0x23ecb3){_0xeeebaa=_0xeeebaa-0x0;var _0x3a9fc4=_0x5044[_0xeeebaa];return _0x3a9fc4;};'use strict';var _=require('lodash');var util=require(_0x4504('0x0'));var logger=require('../../config/logger')(_0x4504('0x1'));var moment=require(_0x4504('0x2'));var BPromise=require(_0x4504('0x3'));var rp=require(_0x4504('0x4'));var fs=require('fs');var path=require(_0x4504('0x5'));var rimraf=require(_0x4504('0x6'));var config=require(_0x4504('0x7'));var attributes=require(_0x4504('0x8'));module['exports']=function(_0x10b50f,_0x40195b){return _0x10b50f[_0x4504('0x9')](_0x4504('0xa'),attributes,{'tableName':_0x4504('0xb'),'paranoid':![],'indexes':[{'name':_0x4504('0xc'),'fields':[_0x4504('0xd')],'type':_0x4504('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1719c1,_0x56961c,_0xe150a1){var _0x5693ac=_0x10b50f[_0x4504('0xf')];var _0x337392=_0x1719c1[_0x4504('0x10')]({'plain':!![]});if(_0x337392[_0x4504('0x11')][_0x4504('0x12')]()==='in'||_0x337392[_0x4504('0x11')][_0x4504('0x12')]()===_0x4504('0x13')&&!_0x337392[_0x4504('0x14')]&&!_[_0x4504('0x15')](_0x337392[_0x4504('0x16')])){_0x5693ac[_0x4504('0x17')][_0x4504('0x18')]({'where':{'id':_0x337392['ChatInteractionId']}})[_0x4504('0x19')](function(_0x1f6c56){if(_0x1f6c56){_0x1f6c56['update']({'lastMsgAt':_0x337392[_0x4504('0x1a')],'lastMsgDirection':_0x337392[_0x4504('0x11')][_0x4504('0x12')]()});}})[_0x4504('0x1b')](function(_0x4c773a){console['error'](_0x4c773a);});}_0xe150a1();}},'charset':_0x4504('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2b78=['then','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','ChatInteractionId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b78,0x10a));var _0x82b7=function(_0x2b38f7,_0x3897af){_0x2b38f7=_0x2b38f7-0x0;var _0x4f8e27=_0x2b78[_0x2b38f7];return _0x4f8e27;};'use strict';var _=require('lodash');var util=require(_0x82b7('0x0'));var logger=require(_0x82b7('0x1'))(_0x82b7('0x2'));var moment=require(_0x82b7('0x3'));var BPromise=require(_0x82b7('0x4'));var rp=require(_0x82b7('0x5'));var fs=require('fs');var path=require(_0x82b7('0x6'));var rimraf=require(_0x82b7('0x7'));var config=require(_0x82b7('0x8'));var attributes=require('./chatMessage.attributes');module[_0x82b7('0x9')]=function(_0x4a7f8c,_0x1bebfe){return _0x4a7f8c[_0x82b7('0xa')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x82b7('0xb')],'type':_0x82b7('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c044a,_0x425928,_0x297c9c){var _0x1b05b4=_0x4a7f8c[_0x82b7('0xd')];var _0x5f41cf=_0x3c044a['get']({'plain':!![]});if(_0x5f41cf[_0x82b7('0xe')]['toLowerCase']()==='in'||_0x5f41cf['direction'][_0x82b7('0xf')]()===_0x82b7('0x10')&&!_0x5f41cf[_0x82b7('0x11')]&&!_['isNil'](_0x5f41cf[_0x82b7('0x12')])){_0x1b05b4['ChatInteraction']['findOne']({'where':{'id':_0x5f41cf[_0x82b7('0x13')]}})[_0x82b7('0x14')](function(_0x3ac2f9){if(_0x3ac2f9){_0x3ac2f9[_0x82b7('0x15')]({'lastMsgAt':_0x5f41cf[_0x82b7('0x16')],'lastMsgDirection':_0x5f41cf[_0x82b7('0xe')][_0x82b7('0xf')]()});}})[_0x82b7('0x17')](function(_0x312cc9){console[_0x82b7('0x18')](_0x312cc9);});}_0x297c9c();}},'charset':'utf8mb4','collate':_0x82b7('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index a9f3120..17d07d3 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 _0xf713=['register','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','ChatMessage','create','body','options','raw','then','CreateChatMessage','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./chatMessage.socket'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf713,0x1f1));var _0x3f71=function(_0x46aaaa,_0x3af897){_0x46aaaa=_0x46aaaa-0x0;var _0x26d04e=_0xf713[_0x46aaaa];return _0x26d04e;};'use strict';var _=require(_0x3f71('0x0'));var util=require(_0x3f71('0x1'));var moment=require(_0x3f71('0x2'));var BPromise=require(_0x3f71('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f71('0x4'));var db=require(_0x3f71('0x5'))['db'];var utils=require(_0x3f71('0x6'));var logger=require(_0x3f71('0x7'))(_0x3f71('0x8'));var config=require('../../config/environment');var jayson=require(_0x3f71('0x9'));var client=jayson['client'][_0x3f71('0xa')]({'port':0x232a});config[_0x3f71('0xb')]=_[_0x3f71('0xc')](config[_0x3f71('0xb')],{'host':_0x3f71('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f71('0xb')]));require(_0x3f71('0xe'))[_0x3f71('0xf')](socket);function respondWithRpcPromise(_0x1beae3,_0x5dfe20,_0x58706e){return new BPromise(function(_0xafc4a7,_0x4464d4){return client['request'](_0x1beae3,_0x58706e)['then'](function(_0x49b761){logger[_0x3f71('0x10')](_0x3f71('0x11'),_0x5dfe20,_0x3f71('0x12'));logger['debug'](_0x3f71('0x13'),_0x5dfe20,_0x3f71('0x12'),JSON['stringify'](_0x49b761));if(_0x49b761['error']){if(_0x49b761['error'][_0x3f71('0x14')]===0x1f4){logger[_0x3f71('0x15')](_0x3f71('0x11'),_0x5dfe20,_0x49b761['error'][_0x3f71('0x16')]);return _0x4464d4(_0x49b761[_0x3f71('0x15')]['message']);}logger[_0x3f71('0x15')](_0x3f71('0x11'),_0x5dfe20,_0x49b761[_0x3f71('0x15')]['message']);return _0xafc4a7(_0x49b761[_0x3f71('0x15')][_0x3f71('0x16')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x5dfe20,_0x3f71('0x12'));_0xafc4a7(_0x49b761[_0x3f71('0x17')]['message']);}})['catch'](function(_0x52829a){logger[_0x3f71('0x15')](_0x3f71('0x11'),_0x5dfe20,_0x52829a);_0x4464d4(_0x52829a);});});}exports['CreateChatMessage']=function(_0x416db1){var _0x26f45f=this;return new Promise(function(_0x15de3c,_0x2cfa4e){return db[_0x3f71('0x18')][_0x3f71('0x19')](_0x416db1[_0x3f71('0x1a')],{'raw':_0x416db1[_0x3f71('0x1b')]?_0x416db1['options'][_0x3f71('0x1c')]===undefined?!![]:![]:!![]})[_0x3f71('0x1d')](function(_0x1f379e){logger[_0x3f71('0x10')](_0x3f71('0x1e'),_0x416db1);logger['debug']('CreateChatMessage',_0x416db1,JSON[_0x3f71('0x1f')](_0x1f379e));_0x15de3c(_0x1f379e);})['catch'](function(_0x6337e8){logger[_0x3f71('0x15')](_0x3f71('0x1e'),_0x6337e8[_0x3f71('0x16')],_0x416db1);_0x2cfa4e(_0x26f45f[_0x3f71('0x15')](0x1f4,_0x6337e8['message']));});});}; \ No newline at end of file +var _0x2f99=['error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','ChatMessage','create','body','info','CreateChatMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./chatMessage.socket','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x38152a,_0x5702d9){var _0x479de9=function(_0x3396a2){while(--_0x3396a2){_0x38152a['push'](_0x38152a['shift']());}};_0x479de9(++_0x5702d9);}(_0x2f99,0x184));var _0x92f9=function(_0x212652,_0x514a74){_0x212652=_0x212652-0x0;var _0x47453b=_0x2f99[_0x212652];return _0x47453b;};'use strict';var _=require(_0x92f9('0x0'));var util=require(_0x92f9('0x1'));var moment=require(_0x92f9('0x2'));var BPromise=require(_0x92f9('0x3'));var rs=require(_0x92f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92f9('0x5'))['db'];var utils=require(_0x92f9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x92f9('0x7'));var jayson=require(_0x92f9('0x8'));var client=jayson[_0x92f9('0x9')]['http']({'port':0x232a});config['redis']=_[_0x92f9('0xa')](config[_0x92f9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x92f9('0xc'))(new Redis(config['redis']));require(_0x92f9('0xd'))['register'](socket);function respondWithRpcPromise(_0x37a68b,_0x2e5907,_0x54a0a4){return new BPromise(function(_0x52ac82,_0x38825f){return client['request'](_0x37a68b,_0x54a0a4)[_0x92f9('0xe')](function(_0x290d05){logger['info']('ChatMessage,\x20%s,\x20%s',_0x2e5907,_0x92f9('0xf'));logger[_0x92f9('0x10')](_0x92f9('0x11'),_0x2e5907,_0x92f9('0xf'),JSON['stringify'](_0x290d05));if(_0x290d05[_0x92f9('0x12')]){if(_0x290d05[_0x92f9('0x12')][_0x92f9('0x13')]===0x1f4){logger[_0x92f9('0x12')](_0x92f9('0x14'),_0x2e5907,_0x290d05[_0x92f9('0x12')][_0x92f9('0x15')]);return _0x38825f(_0x290d05['error'][_0x92f9('0x15')]);}logger[_0x92f9('0x12')](_0x92f9('0x14'),_0x2e5907,_0x290d05[_0x92f9('0x12')][_0x92f9('0x15')]);return _0x52ac82(_0x290d05[_0x92f9('0x12')][_0x92f9('0x15')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x2e5907,'request\x20sent');_0x52ac82(_0x290d05[_0x92f9('0x16')][_0x92f9('0x15')]);}})[_0x92f9('0x17')](function(_0x2a7ce5){logger[_0x92f9('0x12')](_0x92f9('0x14'),_0x2e5907,_0x2a7ce5);_0x38825f(_0x2a7ce5);});});}exports['CreateChatMessage']=function(_0x59825c){var _0x5201a5=this;return new Promise(function(_0x34a11e,_0x389c49){return db[_0x92f9('0x18')][_0x92f9('0x19')](_0x59825c[_0x92f9('0x1a')],{'raw':_0x59825c['options']?_0x59825c['options']['raw']===undefined?!![]:![]:!![]})[_0x92f9('0xe')](function(_0x382ffd){logger[_0x92f9('0x1b')](_0x92f9('0x1c'),_0x59825c);logger['debug']('CreateChatMessage',_0x59825c,JSON['stringify'](_0x382ffd));_0x34a11e(_0x382ffd);})['catch'](function(_0x1ac21b){logger[_0x92f9('0x12')](_0x92f9('0x1c'),_0x1ac21b['message'],_0x59825c);_0x389c49(_0x5201a5[_0x92f9('0x12')](0x1f4,_0x1ac21b['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 932a31c..604eee0 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 _0x9879=['remove','emit','removeListener','register','chatMessage:','./chatMessage.events','save'];(function(_0x290694,_0x281935){var _0x5a0f2e=function(_0x58d7d4){while(--_0x58d7d4){_0x290694['push'](_0x290694['shift']());}};_0x5a0f2e(++_0x281935);}(_0x9879,0x98));var _0x9987=function(_0x2112ad,_0x3a7eb7){_0x2112ad=_0x2112ad-0x0;var _0x46a2b4=_0x9879[_0x2112ad];return _0x46a2b4;};'use strict';var ChatMessageEvents=require(_0x9987('0x0'));var events=[_0x9987('0x1'),_0x9987('0x2'),'update'];function createListener(_0xadce9d,_0x525218){return function(_0x3a2473){_0x525218[_0x9987('0x3')](_0xadce9d,_0x3a2473);};}function removeListener(_0x1fd45d,_0xcc5722){return function(){ChatMessageEvents[_0x9987('0x4')](_0x1fd45d,_0xcc5722);};}exports[_0x9987('0x5')]=function(_0x4258df){for(var _0x4d479d=0x0,_0x34d2fd=events['length'];_0x4d479d<_0x34d2fd;_0x4d479d++){var _0x6cb988=events[_0x4d479d];var _0x3e5538=createListener(_0x9987('0x6')+_0x6cb988,_0x4258df);ChatMessageEvents['on'](_0x6cb988,_0x3e5538);}}; \ No newline at end of file +var _0x814b=['removeListener','register','length','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0x814b,0x1a2));var _0xb814=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x814b[_0xcd0918];return _0x250704;};'use strict';var ChatMessageEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){ChatMessageEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);ChatMessageEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 0f4a803..fcf0e74 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 _0x0ca2=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0x0ca2,0x1b1));var _0x20ca=function(_0x38dcff,_0x5f249d){_0x38dcff=_0x38dcff-0x0;var _0x6cb881=_0x0ca2[_0x38dcff];return _0x6cb881;};'use strict';var multer=require(_0x20ca('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x20ca('0x1'));var express=require(_0x20ca('0x2'));var router=express[_0x20ca('0x3')]();var fs_extra=require(_0x20ca('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x20ca('0x5'));var config=require(_0x20ca('0x6'));var controller=require('./chatMessage.controller');router[_0x20ca('0x7')]('/',auth[_0x20ca('0x8')](),controller[_0x20ca('0x9')]);router['get'](_0x20ca('0xa'),auth[_0x20ca('0x8')](),controller[_0x20ca('0xb')]);router['get'](_0x20ca('0xc'),auth[_0x20ca('0x8')](),controller['show']);router[_0x20ca('0xd')]('/',auth[_0x20ca('0x8')](),interaction['tracked']('chat',_0x20ca('0xe')),controller[_0x20ca('0xf')]);router[_0x20ca('0x10')](_0x20ca('0xc'),controller[_0x20ca('0x11')]);router['put'](_0x20ca('0x12'),auth[_0x20ca('0x8')](),controller[_0x20ca('0x13')]);router[_0x20ca('0x10')](_0x20ca('0x14'),auth['isAuthenticated'](),controller['reject']);router['delete']('/:id',auth[_0x20ca('0x8')](),controller[_0x20ca('0x15')]);module[_0x20ca('0x16')]=router; \ No newline at end of file +var _0x9818=['destroy','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','chat','create','put','/:id/accept','accept','/:id/reject','reject'];(function(_0x357434,_0x478793){var _0xe2e560=function(_0x325323){while(--_0x325323){_0x357434['push'](_0x357434['shift']());}};_0xe2e560(++_0x478793);}(_0x9818,0x109));var _0x8981=function(_0xc54d9e,_0x504125){_0xc54d9e=_0xc54d9e-0x0;var _0x4e539e=_0x9818[_0xc54d9e];return _0x4e539e;};'use strict';var multer=require(_0x8981('0x0'));var util=require('util');var path=require(_0x8981('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8981('0x2')]();var fs_extra=require(_0x8981('0x3'));var auth=require(_0x8981('0x4'));var interaction=require(_0x8981('0x5'));var config=require(_0x8981('0x6'));var controller=require(_0x8981('0x7'));router[_0x8981('0x8')]('/',auth[_0x8981('0x9')](),controller[_0x8981('0xa')]);router[_0x8981('0x8')](_0x8981('0xb'),auth[_0x8981('0x9')](),controller[_0x8981('0xc')]);router[_0x8981('0x8')](_0x8981('0xd'),auth[_0x8981('0x9')](),controller[_0x8981('0xe')]);router['post']('/',auth[_0x8981('0x9')](),interaction[_0x8981('0xf')](_0x8981('0x10'),'chatmessage:create'),controller[_0x8981('0x11')]);router[_0x8981('0x12')](_0x8981('0xd'),controller['update']);router['put'](_0x8981('0x13'),auth[_0x8981('0x9')](),controller[_0x8981('0x14')]);router['put'](_0x8981('0x15'),auth[_0x8981('0x9')](),controller[_0x8981('0x16')]);router['delete'](_0x8981('0xd'),auth[_0x8981('0x9')](),controller[_0x8981('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index f540503..e87f801 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 _0x5f66=['medium','TEXT','exports'];(function(_0x405367,_0x5163a5){var _0x37720d=function(_0x541621){while(--_0x541621){_0x405367['push'](_0x405367['shift']());}};_0x37720d(++_0x5163a5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x46ee20,_0xeb8361){var _0x539ab2=function(_0x2bef94){while(--_0x2bef94){_0x46ee20['push'](_0x46ee20['shift']());}};_0x539ab2(++_0xeb8361);}(_0xdb28,0x106));var _0x8db2=function(_0xa43d89,_0x2b7695){_0xa43d89=_0xa43d89-0x0;var _0x286cf8=_0xdb28[_0xa43d89];return _0x286cf8;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index c60b611..7086009 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(_0x106602,_0x3c148d){var _0x96746c=function(_0x589049){while(--_0x589049){_0x106602['push'](_0x106602['shift']());}};_0x96746c(++_0x3c148d);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +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(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x7a54,0x106));var _0x47a5=function(_0x2c9fb7,_0xcd78c6){_0x2c9fb7=_0x2c9fb7-0x0;var _0x2f8cbb=_0x7a54[_0x2c9fb7];return _0x2f8cbb;};'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 3011b65..f898d39 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 _0x04f1=['ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4a51d3,_0x12c4f7){var _0x3634f7=function(_0x406433){while(--_0x406433){_0x4a51d3['push'](_0x4a51d3['shift']());}};_0x3634f7(++_0x12c4f7);}(_0x04f1,0xc4));var _0x104f=function(_0x330471,_0x6f5e56){_0x330471=_0x330471-0x0;var _0x5d9896=_0x04f1[_0x330471];return _0x5d9896;};'use strict';var EventEmitter=require(_0x104f('0x0'));var ChatOfflineMessage=require(_0x104f('0x1'))['db'][_0x104f('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x104f('0x3')](0x0);var events={'afterCreate':_0x104f('0x4'),'afterUpdate':_0x104f('0x5'),'afterDestroy':_0x104f('0x6')};function emitEvent(_0x4081f4){return function(_0xda86bc,_0x10944b,_0x34238c){ChatOfflineMessageEvents[_0x104f('0x7')](_0x4081f4+':'+_0xda86bc['id'],_0xda86bc);ChatOfflineMessageEvents[_0x104f('0x7')](_0x4081f4,_0xda86bc);_0x34238c(null);};}for(var e in events){if(events[_0x104f('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x104f('0x9')](e,emitEvent(event));}}module[_0x104f('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x3d94=['ChatOfflineMessage','setMaxListeners','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x1849fe,_0x4ac4c4){var _0x527ed1=function(_0x58207b){while(--_0x58207b){_0x1849fe['push'](_0x1849fe['shift']());}};_0x527ed1(++_0x4ac4c4);}(_0x3d94,0xd7));var _0x43d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d94[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x43d9('0x0'))['db'][_0x43d9('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x43d9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x43d9('0x3'),'afterDestroy':_0x43d9('0x4')};function emitEvent(_0x53c70e){return function(_0x4e1f75,_0x11d27c,_0x461167){ChatOfflineMessageEvents['emit'](_0x53c70e+':'+_0x4e1f75['id'],_0x4e1f75);ChatOfflineMessageEvents[_0x43d9('0x5')](_0x53c70e,_0x4e1f75);_0x461167(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x43d9('0x6')](e,emitEvent(event));}}module[_0x43d9('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 39e9b8e..88dfd23 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 _0xc79d=['exports','ChatOfflineMessage','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x3815b3,_0x15e650){var _0x12b75a=function(_0x22d3e9){while(--_0x22d3e9){_0x3815b3['push'](_0x3815b3['shift']());}};_0x12b75a(++_0x15e650);}(_0xc79d,0x11b));var _0xdc79=function(_0x4bb986,_0x11d6cf){_0x4bb986=_0x4bb986-0x0;var _0x3da06b=_0xc79d[_0x4bb986];return _0x3da06b;};'use strict';var attributes=require(_0xdc79('0x0'));module[_0xdc79('0x1')]=function(_0x3b8ff4){return _0x3b8ff4['define'](_0xdc79('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xdc79('0x3')});}; \ No newline at end of file +var _0x55c5=['utf8mb4','./chatOfflineMessage.attributes','ChatOfflineMessage','chat_offline_messages'];(function(_0x5597a0,_0x35c11e){var _0x2fc8d6=function(_0x492dcb){while(--_0x492dcb){_0x5597a0['push'](_0x5597a0['shift']());}};_0x2fc8d6(++_0x35c11e);}(_0x55c5,0x151));var _0x555c=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x55c5[_0x4dcc2d];return _0x1bbd79;};'use strict';var attributes=require(_0x555c('0x0'));module['exports']=function(_0x4d3b90){return _0x4d3b90['define'](_0x555c('0x1'),attributes,{'tableName':_0x555c('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x555c('0x3'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index c8996b1..81fa272 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 _0xbf63=['client','http','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x242007,_0x3cb6f2){var _0x433fef=function(_0x4a0df1){while(--_0x4a0df1){_0x242007['push'](_0x242007['shift']());}};_0x433fef(++_0x3cb6f2);}(_0xbf63,0x1eb));var _0x3bf6=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbf63[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x3bf6('0x0'));var util=require('util');var moment=require(_0x3bf6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3bf6('0x2'));var db=require(_0x3bf6('0x3'))['db'];var utils=require(_0x3bf6('0x4'));var logger=require(_0x3bf6('0x5'))(_0x3bf6('0x6'));var config=require(_0x3bf6('0x7'));var jayson=require(_0x3bf6('0x8'));var client=jayson[_0x3bf6('0x9')][_0x3bf6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x260724,_0x986dfe,_0x24f11b){return new BPromise(function(_0x5c8783,_0x36ff95){return client['request'](_0x260724,_0x24f11b)['then'](function(_0x2119ab){logger[_0x3bf6('0xb')](_0x3bf6('0xc'),_0x986dfe,'request\x20sent');logger[_0x3bf6('0xd')](_0x3bf6('0xe'),_0x986dfe,_0x3bf6('0xf'),JSON[_0x3bf6('0x10')](_0x2119ab));if(_0x2119ab['error']){if(_0x2119ab[_0x3bf6('0x11')][_0x3bf6('0x12')]===0x1f4){logger[_0x3bf6('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x986dfe,_0x2119ab[_0x3bf6('0x11')]['message']);return _0x36ff95(_0x2119ab[_0x3bf6('0x11')][_0x3bf6('0x13')]);}logger[_0x3bf6('0x11')](_0x3bf6('0xc'),_0x986dfe,_0x2119ab['error']['message']);return _0x5c8783(_0x2119ab['error']['message']);}else{logger[_0x3bf6('0xb')](_0x3bf6('0xc'),_0x986dfe,_0x3bf6('0xf'));_0x5c8783(_0x2119ab['result'][_0x3bf6('0x13')]);}})['catch'](function(_0x3bae00){logger[_0x3bf6('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x986dfe,_0x3bae00);_0x36ff95(_0x3bae00);});});} \ No newline at end of file +var _0xcf09=['jayson/promise','client','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment'];(function(_0xa19291,_0x52415a){var _0x4953f9=function(_0x419422){while(--_0x419422){_0xa19291['push'](_0xa19291['shift']());}};_0x4953f9(++_0x52415a);}(_0xcf09,0x8c));var _0x9cf0=function(_0x59f5b3,_0x1e52d4){_0x59f5b3=_0x59f5b3-0x0;var _0x4d0d7e=_0xcf09[_0x59f5b3];return _0x4d0d7e;};'use strict';var _=require(_0x9cf0('0x0'));var util=require('util');var moment=require(_0x9cf0('0x1'));var BPromise=require(_0x9cf0('0x2'));var rs=require(_0x9cf0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9cf0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9cf0('0x5'))('rpc');var config=require(_0x9cf0('0x6'));var jayson=require(_0x9cf0('0x7'));var client=jayson[_0x9cf0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fc528,_0x3f0e14,_0x30335b){return new BPromise(function(_0x42edb6,_0x59cc88){return client['request'](_0x2fc528,_0x30335b)[_0x9cf0('0x9')](function(_0x51a422){logger[_0x9cf0('0xa')](_0x9cf0('0xb'),_0x3f0e14,_0x9cf0('0xc'));logger[_0x9cf0('0xd')](_0x9cf0('0xe'),_0x3f0e14,_0x9cf0('0xc'),JSON[_0x9cf0('0xf')](_0x51a422));if(_0x51a422[_0x9cf0('0x10')]){if(_0x51a422[_0x9cf0('0x10')][_0x9cf0('0x11')]===0x1f4){logger[_0x9cf0('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3f0e14,_0x51a422['error']['message']);return _0x59cc88(_0x51a422[_0x9cf0('0x10')]['message']);}logger[_0x9cf0('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3f0e14,_0x51a422[_0x9cf0('0x10')][_0x9cf0('0x12')]);return _0x42edb6(_0x51a422[_0x9cf0('0x10')][_0x9cf0('0x12')]);}else{logger['info'](_0x9cf0('0xb'),_0x3f0e14,_0x9cf0('0xc'));_0x42edb6(_0x51a422[_0x9cf0('0x13')][_0x9cf0('0x12')]);}})[_0x9cf0('0x14')](function(_0x21c193){logger['error'](_0x9cf0('0xb'),_0x3f0e14,_0x21c193);_0x59cc88(_0x21c193);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index c8a920f..12a77f1 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 _0x8412=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','destroy','exports'];(function(_0x17ae21,_0x4882ca){var _0x2bca97=function(_0x55faa5){while(--_0x55faa5){_0x17ae21['push'](_0x17ae21['shift']());}};_0x2bca97(++_0x4882ca);}(_0x8412,0x1b5));var _0x2841=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0x8412[_0x49a57c];return _0x4e0316;};'use strict';var multer=require(_0x2841('0x0'));var util=require(_0x2841('0x1'));var path=require('path');var timeout=require(_0x2841('0x2'));var express=require(_0x2841('0x3'));var router=express['Router']();var fs_extra=require(_0x2841('0x4'));var auth=require(_0x2841('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2841('0x6'));router[_0x2841('0x7')]('/',auth[_0x2841('0x8')](),controller[_0x2841('0x9')]);router[_0x2841('0x7')](_0x2841('0xa'),auth[_0x2841('0x8')](),controller[_0x2841('0xb')]);router[_0x2841('0x7')](_0x2841('0xc'),auth[_0x2841('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2841('0xd')]);router[_0x2841('0xe')](_0x2841('0xc'),auth[_0x2841('0x8')](),controller[_0x2841('0xf')]);router[_0x2841('0x10')](_0x2841('0xc'),auth[_0x2841('0x8')](),controller[_0x2841('0x11')]);module[_0x2841('0x12')]=router; \ No newline at end of file +var _0x4388=['./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4ab9a7,_0x291df1){var _0xd08799=function(_0x32bd6a){while(--_0x32bd6a){_0x4ab9a7['push'](_0x4ab9a7['shift']());}};_0xd08799(++_0x291df1);}(_0x4388,0x10b));var _0x8438=function(_0x479f5f,_0x34d2da){_0x479f5f=_0x479f5f-0x0;var _0x4832e3=_0x4388[_0x479f5f];return _0x4832e3;};'use strict';var multer=require(_0x8438('0x0'));var util=require('util');var path=require(_0x8438('0x1'));var timeout=require(_0x8438('0x2'));var express=require(_0x8438('0x3'));var router=express[_0x8438('0x4')]();var fs_extra=require(_0x8438('0x5'));var auth=require(_0x8438('0x6'));var interaction=require(_0x8438('0x7'));var config=require(_0x8438('0x8'));var controller=require(_0x8438('0x9'));router[_0x8438('0xa')]('/',auth[_0x8438('0xb')](),controller[_0x8438('0xc')]);router[_0x8438('0xa')](_0x8438('0xd'),auth['isAuthenticated'](),controller[_0x8438('0xe')]);router[_0x8438('0xa')](_0x8438('0xf'),auth[_0x8438('0xb')](),controller[_0x8438('0x10')]);router[_0x8438('0x11')]('/',auth[_0x8438('0xb')](),controller[_0x8438('0x12')]);router[_0x8438('0x13')](_0x8438('0xf'),auth[_0x8438('0xb')](),controller[_0x8438('0x14')]);router['delete'](_0x8438('0xf'),auth[_0x8438('0xb')](),controller[_0x8438('0x15')]);module[_0x8438('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index c48249f..822dd02 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 _0x487a=['STRING','timeout','mouseOver','sequelize'];(function(_0x34f045,_0xab3e6c){var _0x3b1896=function(_0x504abc){while(--_0x504abc){_0x34f045['push'](_0x34f045['shift']());}};_0x3b1896(++_0xab3e6c);}(_0x487a,0x18b));var _0xa487=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x487a[_0x361d3f];return _0x320229;};'use strict';var Sequelize=require(_0xa487('0x0'));module['exports']={'name':{'type':Sequelize[_0xa487('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0xa487('0x2')),'defaultValue':_0xa487('0x3')},'selector':{'type':Sequelize[_0xa487('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x02dc=['STRING','ENUM','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x402125,_0x3546a9){var _0x183c8b=function(_0x732136){while(--_0x732136){_0x402125['push'](_0x402125['shift']());}};_0x183c8b(++_0x3546a9);}(_0x02dc,0x1e1));var _0xc02d=function(_0x495efe,_0x23c04e){_0x495efe=_0x495efe-0x0;var _0x7f1752=_0x02dc[_0x495efe];return _0x7f1752;};'use strict';var Sequelize=require(_0xc02d('0x0'));module[_0xc02d('0x1')]={'name':{'type':Sequelize[_0xc02d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc02d('0x3')](_0xc02d('0x4'),_0xc02d('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xc02d('0x2')]},'timeout':{'type':Sequelize[_0xc02d('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 34998ab..150cd51 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 _0xdb4b=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','save','update','then','destroy','error','stack','name','send','show','params','model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','attributes','length','includeAll','include','merge','options','find','catch','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x5ede00,_0x4c78a8){var _0x3ad6e5=function(_0x914a52){while(--_0x914a52){_0x5ede00['push'](_0x5ede00['shift']());}};_0x3ad6e5(++_0x4c78a8);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x41e45d,_0x1ee3b0){_0x41e45d=_0x41e45d-0x0;var _0x4d3aac=_0xdb4b[_0x41e45d];return _0x4d3aac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbdb4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbdb4('0x1'));var rp=require(_0xbdb4('0x2'));var moment=require(_0xbdb4('0x3'));var BPromise=require(_0xbdb4('0x4'));var Mustache=require('mustache');var util=require(_0xbdb4('0x5'));var path=require(_0xbdb4('0x6'));var sox=require(_0xbdb4('0x7'));var csv=require(_0xbdb4('0x8'));var ejs=require(_0xbdb4('0x9'));var fs=require('fs');var fs_extra=require(_0xbdb4('0xa'));var _=require(_0xbdb4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbdb4('0xc'));var deskjs=require(_0xbdb4('0xd'));var toCsv=require(_0xbdb4('0x8'));var querystring=require(_0xbdb4('0xe'));var Papa=require('papaparse');var Redis=require(_0xbdb4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbdb4('0x10'));var as=require(_0xbdb4('0x11'));var hardwareService=require(_0xbdb4('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xbdb4('0x13'));var config=require(_0xbdb4('0x14'));var licenseUtil=require(_0xbdb4('0x15'));var db=require(_0xbdb4('0x16'))['db'];function respondWithStatusCode(_0x5f1825,_0x4fadb2){_0x4fadb2=_0x4fadb2||0xcc;return function(_0xd2eaa5){if(_0xd2eaa5){return _0x5f1825[_0xbdb4('0x17')](_0x4fadb2);}return _0x5f1825[_0xbdb4('0x18')](_0x4fadb2)[_0xbdb4('0x19')]();};}function respondWithResult(_0x3e0801,_0x310780){_0x310780=_0x310780||0xc8;return function(_0x4a2ae3){if(_0x4a2ae3){return _0x3e0801['status'](_0x310780)[_0xbdb4('0x1a')](_0x4a2ae3);}};}function respondWithFilteredResult(_0x4386e1,_0x5d84f6){return function(_0x446124){if(_0x446124){var _0x19a69b=typeof _0x5d84f6['offset']==='undefined'&&typeof _0x5d84f6[_0xbdb4('0x1b')]===_0xbdb4('0x1c');var _0x52c7ca=_0x446124[_0xbdb4('0x1d')];var _0x113471=_0x19a69b?0x0:_0x5d84f6['offset'];var _0x2ca1d5=_0x19a69b?_0x446124[_0xbdb4('0x1d')]:_0x5d84f6[_0xbdb4('0x1e')]+_0x5d84f6['limit'];var _0x50d0af;if(_0x2ca1d5>=_0x52c7ca){_0x2ca1d5=_0x52c7ca;_0x50d0af=0xc8;}else{_0x50d0af=0xce;}_0x4386e1[_0xbdb4('0x18')](_0x50d0af);return _0x4386e1[_0xbdb4('0x1f')]('Content-Range',_0x113471+'-'+_0x2ca1d5+'/'+_0x52c7ca)[_0xbdb4('0x1a')](_0x446124);}return null;};}function patchUpdates(_0x2d72d9){return function(_0x21b32d){try{jsonpatch['apply'](_0x21b32d,_0x2d72d9,!![]);}catch(_0x1bbabc){return BPromise['reject'](_0x1bbabc);}return _0x21b32d[_0xbdb4('0x20')]();};}function saveUpdates(_0x182758,_0x40efbe){return function(_0x2320e9){if(_0x2320e9){return _0x2320e9[_0xbdb4('0x21')](_0x182758)[_0xbdb4('0x22')](function(_0x5780ba){return _0x5780ba;});}return null;};}function removeEntity(_0x3db8aa,_0x18b284){return function(_0x2ea4f4){if(_0x2ea4f4){return _0x2ea4f4[_0xbdb4('0x23')]()[_0xbdb4('0x22')](function(){_0x3db8aa['status'](0xcc)[_0xbdb4('0x19')]();});}};}function handleEntityNotFound(_0x18a6f6,_0x3d440a){return function(_0x5b46a1){if(!_0x5b46a1){_0x18a6f6['sendStatus'](0x194);}return _0x5b46a1;};}function handleError(_0x1ab9b1,_0x22ba6c){_0x22ba6c=_0x22ba6c||0x1f4;return function(_0x3b3e0b){logger[_0xbdb4('0x24')](_0x3b3e0b[_0xbdb4('0x25')]);if(_0x3b3e0b[_0xbdb4('0x26')]){delete _0x3b3e0b[_0xbdb4('0x26')];}_0x1ab9b1[_0xbdb4('0x18')](_0x22ba6c)[_0xbdb4('0x27')](_0x3b3e0b);};}exports[_0xbdb4('0x28')]=function(_0x52ebf5,_0x81ec7d){var _0x11a783={'raw':!![],'where':{'id':_0x52ebf5[_0xbdb4('0x29')]['id']}},_0x1246a7={};_0x1246a7[_0xbdb4('0x2a')]=_['keys'](db[_0xbdb4('0x2b')][_0xbdb4('0x2c')]);_0x1246a7[_0xbdb4('0x2d')]=_[_0xbdb4('0x2e')](_0x52ebf5[_0xbdb4('0x2d')]);_0x1246a7[_0xbdb4('0x2f')]=_[_0xbdb4('0x30')](_0x1246a7[_0xbdb4('0x2a')],_0x1246a7['query']);_0x11a783[_0xbdb4('0x31')]=_[_0xbdb4('0x30')](_0x1246a7['model'],qs['fields'](_0x52ebf5[_0xbdb4('0x2d')]['fields']));_0x11a783[_0xbdb4('0x31')]=_0x11a783[_0xbdb4('0x31')][_0xbdb4('0x32')]?_0x11a783[_0xbdb4('0x31')]:_0x1246a7['model'];if(_0x52ebf5[_0xbdb4('0x2d')][_0xbdb4('0x33')]){_0x11a783[_0xbdb4('0x34')]=[{'all':!![]}];}_0x11a783=_[_0xbdb4('0x35')]({},_0x11a783,_0x52ebf5[_0xbdb4('0x36')]);return db[_0xbdb4('0x2b')][_0xbdb4('0x37')](_0x11a783)[_0xbdb4('0x22')](handleEntityNotFound(_0x81ec7d,null))[_0xbdb4('0x22')](respondWithResult(_0x81ec7d,null))[_0xbdb4('0x38')](handleError(_0x81ec7d,null));};exports[_0xbdb4('0x39')]=function(_0x134401,_0x4e15e1){return db[_0xbdb4('0x2b')][_0xbdb4('0x39')](_0x134401[_0xbdb4('0x3a')],{})[_0xbdb4('0x22')](respondWithResult(_0x4e15e1,0xc9))['catch'](handleError(_0x4e15e1,null));};exports[_0xbdb4('0x21')]=function(_0xe25e14,_0x410f96){if(_0xe25e14[_0xbdb4('0x3a')]['id']){delete _0xe25e14[_0xbdb4('0x3a')]['id'];}return db[_0xbdb4('0x2b')][_0xbdb4('0x37')]({'where':{'id':_0xe25e14[_0xbdb4('0x29')]['id']}})[_0xbdb4('0x22')](handleEntityNotFound(_0x410f96,null))[_0xbdb4('0x22')](saveUpdates(_0xe25e14['body'],null))[_0xbdb4('0x22')](respondWithResult(_0x410f96,null))[_0xbdb4('0x38')](handleError(_0x410f96,null));};exports[_0xbdb4('0x23')]=function(_0x49c5db,_0x45952f){return db[_0xbdb4('0x2b')][_0xbdb4('0x37')]({'where':{'id':_0x49c5db[_0xbdb4('0x29')]['id']}})['then'](handleEntityNotFound(_0x45952f,null))[_0xbdb4('0x22')](removeEntity(_0x45952f,null))['catch'](handleError(_0x45952f,null));}; \ No newline at end of file +var _0xff98=['count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','keys','ChatProactiveAction','rawAttributes','query','intersection','model','attributes','fields','length','includeAll','merge','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff98,0x9c));var _0x8ff9=function(_0x4e0bc4,_0x4803f2){_0x4e0bc4=_0x4e0bc4-0x0;var _0x43309b=_0xff98[_0x4e0bc4];return _0x43309b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ff9('0x0'));var zipdir=require(_0x8ff9('0x1'));var jsonpatch=require(_0x8ff9('0x2'));var rp=require(_0x8ff9('0x3'));var moment=require('moment');var BPromise=require(_0x8ff9('0x4'));var Mustache=require('mustache');var util=require(_0x8ff9('0x5'));var path=require('path');var sox=require(_0x8ff9('0x6'));var csv=require('to-csv');var ejs=require(_0x8ff9('0x7'));var fs=require('fs');var fs_extra=require(_0x8ff9('0x8'));var _=require(_0x8ff9('0x9'));var squel=require(_0x8ff9('0xa'));var crypto=require(_0x8ff9('0xb'));var jsforce=require(_0x8ff9('0xc'));var deskjs=require(_0x8ff9('0xd'));var toCsv=require(_0x8ff9('0xe'));var querystring=require('querystring');var Papa=require(_0x8ff9('0xf'));var Redis=require(_0x8ff9('0x10'));var authService=require(_0x8ff9('0x11'));var qs=require(_0x8ff9('0x12'));var as=require(_0x8ff9('0x13'));var hardwareService=require(_0x8ff9('0x14'));var logger=require(_0x8ff9('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8ff9('0x16'));var db=require(_0x8ff9('0x17'))['db'];function respondWithStatusCode(_0x440659,_0x4d7d7c){_0x4d7d7c=_0x4d7d7c||0xcc;return function(_0x3c655c){if(_0x3c655c){return _0x440659[_0x8ff9('0x18')](_0x4d7d7c);}return _0x440659[_0x8ff9('0x19')](_0x4d7d7c)[_0x8ff9('0x1a')]();};}function respondWithResult(_0x405aac,_0x169a0e){_0x169a0e=_0x169a0e||0xc8;return function(_0x340068){if(_0x340068){return _0x405aac['status'](_0x169a0e)[_0x8ff9('0x1b')](_0x340068);}};}function respondWithFilteredResult(_0x25ca31,_0x313d09){return function(_0x5b5a3e){if(_0x5b5a3e){var _0x42e911=typeof _0x313d09['offset']===_0x8ff9('0x1c')&&typeof _0x313d09['limit']==='undefined';var _0x4b321a=_0x5b5a3e['count'];var _0x20d149=_0x42e911?0x0:_0x313d09[_0x8ff9('0x1d')];var _0xad903b=_0x42e911?_0x5b5a3e[_0x8ff9('0x1e')]:_0x313d09[_0x8ff9('0x1d')]+_0x313d09[_0x8ff9('0x1f')];var _0x34390b;if(_0xad903b>=_0x4b321a){_0xad903b=_0x4b321a;_0x34390b=0xc8;}else{_0x34390b=0xce;}_0x25ca31['status'](_0x34390b);return _0x25ca31[_0x8ff9('0x20')](_0x8ff9('0x21'),_0x20d149+'-'+_0xad903b+'/'+_0x4b321a)[_0x8ff9('0x1b')](_0x5b5a3e);}return null;};}function patchUpdates(_0x47eb4d){return function(_0x39d4d1){try{jsonpatch[_0x8ff9('0x22')](_0x39d4d1,_0x47eb4d,!![]);}catch(_0xbd1c60){return BPromise[_0x8ff9('0x23')](_0xbd1c60);}return _0x39d4d1[_0x8ff9('0x24')]();};}function saveUpdates(_0x34a7ec,_0x1fc0a9){return function(_0x2ca5c3){if(_0x2ca5c3){return _0x2ca5c3[_0x8ff9('0x25')](_0x34a7ec)[_0x8ff9('0x26')](function(_0x1551af){return _0x1551af;});}return null;};}function removeEntity(_0x2979b0,_0x3aff05){return function(_0x58e7b9){if(_0x58e7b9){return _0x58e7b9['destroy']()[_0x8ff9('0x26')](function(){_0x2979b0['status'](0xcc)[_0x8ff9('0x1a')]();});}};}function handleEntityNotFound(_0x5a1116,_0x27f154){return function(_0x469786){if(!_0x469786){_0x5a1116[_0x8ff9('0x18')](0x194);}return _0x469786;};}function handleError(_0x2bf341,_0x1afa74){_0x1afa74=_0x1afa74||0x1f4;return function(_0xcdd5d8){logger[_0x8ff9('0x27')](_0xcdd5d8[_0x8ff9('0x28')]);if(_0xcdd5d8[_0x8ff9('0x29')]){delete _0xcdd5d8[_0x8ff9('0x29')];}_0x2bf341['status'](_0x1afa74)[_0x8ff9('0x2a')](_0xcdd5d8);};}exports[_0x8ff9('0x2b')]=function(_0x3b89ec,_0x1a921a){var _0x470654={'raw':!![],'where':{'id':_0x3b89ec[_0x8ff9('0x2c')]['id']}},_0x5c2a7a={};_0x5c2a7a['model']=_[_0x8ff9('0x2d')](db[_0x8ff9('0x2e')][_0x8ff9('0x2f')]);_0x5c2a7a[_0x8ff9('0x30')]=_[_0x8ff9('0x2d')](_0x3b89ec[_0x8ff9('0x30')]);_0x5c2a7a['filters']=_[_0x8ff9('0x31')](_0x5c2a7a[_0x8ff9('0x32')],_0x5c2a7a[_0x8ff9('0x30')]);_0x470654[_0x8ff9('0x33')]=_[_0x8ff9('0x31')](_0x5c2a7a[_0x8ff9('0x32')],qs['fields'](_0x3b89ec['query'][_0x8ff9('0x34')]));_0x470654['attributes']=_0x470654[_0x8ff9('0x33')][_0x8ff9('0x35')]?_0x470654[_0x8ff9('0x33')]:_0x5c2a7a[_0x8ff9('0x32')];if(_0x3b89ec[_0x8ff9('0x30')][_0x8ff9('0x36')]){_0x470654['include']=[{'all':!![]}];}_0x470654=_[_0x8ff9('0x37')]({},_0x470654,_0x3b89ec[_0x8ff9('0x38')]);return db[_0x8ff9('0x2e')][_0x8ff9('0x39')](_0x470654)['then'](handleEntityNotFound(_0x1a921a,null))[_0x8ff9('0x26')](respondWithResult(_0x1a921a,null))[_0x8ff9('0x3a')](handleError(_0x1a921a,null));};exports[_0x8ff9('0x3b')]=function(_0x41d2a3,_0x3d4f55){return db[_0x8ff9('0x2e')][_0x8ff9('0x3b')](_0x41d2a3[_0x8ff9('0x3c')],{})['then'](respondWithResult(_0x3d4f55,0xc9))[_0x8ff9('0x3a')](handleError(_0x3d4f55,null));};exports[_0x8ff9('0x25')]=function(_0x51e677,_0x5227ee){if(_0x51e677[_0x8ff9('0x3c')]['id']){delete _0x51e677[_0x8ff9('0x3c')]['id'];}return db[_0x8ff9('0x2e')][_0x8ff9('0x39')]({'where':{'id':_0x51e677[_0x8ff9('0x2c')]['id']}})['then'](handleEntityNotFound(_0x5227ee,null))[_0x8ff9('0x26')](saveUpdates(_0x51e677[_0x8ff9('0x3c')],null))[_0x8ff9('0x26')](respondWithResult(_0x5227ee,null))[_0x8ff9('0x3a')](handleError(_0x5227ee,null));};exports[_0x8ff9('0x3d')]=function(_0x439cc3,_0x2a01e7){return db[_0x8ff9('0x2e')][_0x8ff9('0x39')]({'where':{'id':_0x439cc3[_0x8ff9('0x2c')]['id']}})[_0x8ff9('0x26')](handleEntityNotFound(_0x2a01e7,null))[_0x8ff9('0x26')](removeEntity(_0x2a01e7,null))[_0x8ff9('0x3a')](handleError(_0x2a01e7,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 063f474..144db42 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 _0x2fbd=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','chat_proactive_actions','lodash'];(function(_0xe92a5f,_0x3084b3){var _0x2dbbd7=function(_0x4d1504){while(--_0x4d1504){_0xe92a5f['push'](_0xe92a5f['shift']());}};_0x2dbbd7(++_0x3084b3);}(_0x2fbd,0x1f3));var _0xd2fb=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x2fbd[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xd2fb('0x0'));var util=require('util');var logger=require(_0xd2fb('0x1'))(_0xd2fb('0x2'));var moment=require('moment');var BPromise=require(_0xd2fb('0x3'));var rp=require(_0xd2fb('0x4'));var fs=require('fs');var path=require(_0xd2fb('0x5'));var rimraf=require('rimraf');var config=require(_0xd2fb('0x6'));var attributes=require(_0xd2fb('0x7'));module[_0xd2fb('0x8')]=function(_0x374520,_0x233fa9){return _0x374520['define']('ChatProactiveAction',attributes,{'tableName':_0xd2fb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77b4=['ChatProactiveAction','chat_proactive_actions','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x18d85c,_0x444b45){var _0x58977e=function(_0x4d01a4){while(--_0x4d01a4){_0x18d85c['push'](_0x18d85c['shift']());}};_0x58977e(++_0x444b45);}(_0x77b4,0x1e6));var _0x477b=function(_0xf20b6,_0x49ddbb){_0xf20b6=_0xf20b6-0x0;var _0x4ff567=_0x77b4[_0xf20b6];return _0x4ff567;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x477b('0x0'))(_0x477b('0x1'));var moment=require(_0x477b('0x2'));var BPromise=require(_0x477b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x477b('0x4'));var rimraf=require('rimraf');var config=require(_0x477b('0x5'));var attributes=require(_0x477b('0x6'));module[_0x477b('0x7')]=function(_0x223f92,_0x459c61){return _0x223f92[_0x477b('0x8')](_0x477b('0x9'),attributes,{'tableName':_0x477b('0xa'),'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 6945e6d..3da24b9 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 _0xdaf2=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdaf2,0xb2));var _0x2daf=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0xdaf2[_0x282a1f];return _0x296ea7;};'use strict';var _=require(_0x2daf('0x0'));var util=require(_0x2daf('0x1'));var moment=require(_0x2daf('0x2'));var BPromise=require(_0x2daf('0x3'));var rs=require(_0x2daf('0x4'));var fs=require('fs');var Redis=require(_0x2daf('0x5'));var db=require(_0x2daf('0x6'))['db'];var utils=require(_0x2daf('0x7'));var logger=require(_0x2daf('0x8'))(_0x2daf('0x9'));var config=require(_0x2daf('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2daf('0xb')][_0x2daf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x587952,_0x3f61cd,_0x2fc951){return new BPromise(function(_0x509990,_0x30a8ec){return client[_0x2daf('0xd')](_0x587952,_0x2fc951)[_0x2daf('0xe')](function(_0x2692bb){logger['info'](_0x2daf('0xf'),_0x3f61cd,'request\x20sent');logger['debug'](_0x2daf('0x10'),_0x3f61cd,_0x2daf('0x11'),JSON[_0x2daf('0x12')](_0x2692bb));if(_0x2692bb[_0x2daf('0x13')]){if(_0x2692bb[_0x2daf('0x13')][_0x2daf('0x14')]===0x1f4){logger[_0x2daf('0x13')](_0x2daf('0xf'),_0x3f61cd,_0x2692bb[_0x2daf('0x13')][_0x2daf('0x15')]);return _0x30a8ec(_0x2692bb[_0x2daf('0x13')][_0x2daf('0x15')]);}logger[_0x2daf('0x13')](_0x2daf('0xf'),_0x3f61cd,_0x2692bb[_0x2daf('0x13')]['message']);return _0x509990(_0x2692bb[_0x2daf('0x13')][_0x2daf('0x15')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x3f61cd,_0x2daf('0x11'));_0x509990(_0x2692bb['result'][_0x2daf('0x15')]);}})[_0x2daf('0x16')](function(_0x545e85){logger['error'](_0x2daf('0xf'),_0x3f61cd,_0x545e85);_0x30a8ec(_0x545e85);});});} \ No newline at end of file +var _0x1585=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x184fd7,_0x5c88c6){var _0x422dcc=function(_0x43282a){while(--_0x43282a){_0x184fd7['push'](_0x184fd7['shift']());}};_0x422dcc(++_0x5c88c6);}(_0x1585,0xa2));var _0x5158=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x1585[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x5158('0x0'));var util=require(_0x5158('0x1'));var moment=require(_0x5158('0x2'));var BPromise=require(_0x5158('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5158('0x4'))['db'];var utils=require(_0x5158('0x5'));var logger=require(_0x5158('0x6'))(_0x5158('0x7'));var config=require(_0x5158('0x8'));var jayson=require(_0x5158('0x9'));var client=jayson[_0x5158('0xa')][_0x5158('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4894c2,_0xd6ba30,_0x54cb8d){return new BPromise(function(_0x201fcc,_0x2cfa54){return client['request'](_0x4894c2,_0x54cb8d)['then'](function(_0x3dce69){logger[_0x5158('0xc')](_0x5158('0xd'),_0xd6ba30,_0x5158('0xe'));logger[_0x5158('0xf')](_0x5158('0x10'),_0xd6ba30,_0x5158('0xe'),JSON[_0x5158('0x11')](_0x3dce69));if(_0x3dce69[_0x5158('0x12')]){if(_0x3dce69[_0x5158('0x12')][_0x5158('0x13')]===0x1f4){logger[_0x5158('0x12')](_0x5158('0xd'),_0xd6ba30,_0x3dce69[_0x5158('0x12')]['message']);return _0x2cfa54(_0x3dce69['error'][_0x5158('0x14')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0xd6ba30,_0x3dce69['error']['message']);return _0x201fcc(_0x3dce69[_0x5158('0x12')][_0x5158('0x14')]);}else{logger[_0x5158('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0xd6ba30,_0x5158('0xe'));_0x201fcc(_0x3dce69[_0x5158('0x15')][_0x5158('0x14')]);}})[_0x5158('0x16')](function(_0x16e359){logger[_0x5158('0x12')](_0x5158('0xd'),_0xd6ba30,_0x16e359);_0x2cfa54(_0x16e359);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index cb53295..c848d0a 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 _0x2675=['../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','express','Router'];(function(_0x263094,_0x58765b){var _0x26bb41=function(_0x32e4f6){while(--_0x32e4f6){_0x263094['push'](_0x263094['shift']());}};_0x26bb41(++_0x58765b);}(_0x2675,0x75));var _0x5267=function(_0x5a316a,_0x417323){_0x5a316a=_0x5a316a-0x0;var _0x4f4cc5=_0x2675[_0x5a316a];return _0x4f4cc5;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5267('0x3'));var interaction=require(_0x5267('0x4'));var config=require('../../config/environment');var controller=require(_0x5267('0x5'));router[_0x5267('0x6')](_0x5267('0x7'),auth[_0x5267('0x8')](),controller[_0x5267('0x9')]);router[_0x5267('0xa')]('/',auth['isAuthenticated'](),controller[_0x5267('0xb')]);router[_0x5267('0xc')]('/:id',auth[_0x5267('0x8')](),controller['update']);router[_0x5267('0xd')](_0x5267('0x7'),auth[_0x5267('0x8')](),controller['destroy']);module[_0x5267('0xe')]=router; \ No newline at end of file +var _0x5075=['show','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','isAuthenticated'];(function(_0x4b26e0,_0x566fea){var _0x2d9757=function(_0x5f353b){while(--_0x5f353b){_0x4b26e0['push'](_0x4b26e0['shift']());}};_0x2d9757(++_0x566fea);}(_0x5075,0x73));var _0x5507=function(_0x26447e,_0x2e9c94){_0x26447e=_0x26447e-0x0;var _0x38cc1a=_0x5075[_0x26447e];return _0x38cc1a;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var fs_extra=require(_0x5507('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var controller=require(_0x5507('0x9'));router['get']('/:id',auth[_0x5507('0xa')](),controller[_0x5507('0xb')]);router['post']('/',auth[_0x5507('0xa')](),controller[_0x5507('0xc')]);router[_0x5507('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5507('0xe')]);router[_0x5507('0xf')](_0x5507('0x10'),auth[_0x5507('0xa')](),controller['destroy']);module[_0x5507('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 7202ff4..7b1a1d3 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 _0xc0de=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x490412,_0x4044b0){var _0x5b178=function(_0x270e76){while(--_0x270e76){_0x490412['push'](_0x490412['shift']());}};_0x5b178(++_0x4044b0);}(_0xc0de,0x101));var _0xec0d=function(_0x404f0d,_0x4b54b3){_0x404f0d=_0x404f0d-0x0;var _0x11dd7f=_0xc0de[_0x404f0d];return _0x11dd7f;};'use strict';var Sequelize=require(_0xec0d('0x0'));module[_0xec0d('0x1')]={'name':{'type':Sequelize[_0xec0d('0x2')],'unique':_0xec0d('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xec0d('0x2')]},'timeout':{'type':Sequelize[_0xec0d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xec0d('0x5')](_0xec0d('0x6'),'beepall',_0xec0d('0x7'))}}; \ No newline at end of file +var _0x597d=['name','ENUM','rrmemory','roundrobin','sequelize','STRING'];(function(_0xbe5044,_0x3a729f){var _0x3271b1=function(_0x3149b8){while(--_0x3149b8){_0xbe5044['push'](_0xbe5044['shift']());}};_0x3271b1(++_0x3a729f);}(_0x597d,0x166));var _0xd597=function(_0x5135db,_0x15c1b5){_0x5135db=_0x5135db-0x0;var _0x25d98c=_0x597d[_0x5135db];return _0x25d98c;};'use strict';var Sequelize=require(_0xd597('0x0'));module['exports']={'name':{'type':Sequelize[_0xd597('0x1')],'unique':_0xd597('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd597('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd597('0x3')](_0xd597('0x4'),'beepall',_0xd597('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 1fa9bd9..35285de 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 _0x7600=['to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','map','ChatQueue','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','role','ChatQueues','UserProfileSection','userProfileId','getMembers','findOne','hasOwnProperty','ChatQueueId','UserChatQueue','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','chatPause','Team','getTeams','Agents','voicePause','interface','flatMap','transaction','addTeams','each','userChatQueue:save','removeTeams','ids','field','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','all','compact','isEmpty','removeAgents','forEach','emit','addAgents','omit','spread','userChatQueue:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util'];(function(_0x22bee0,_0x412ecb){var _0x2d295b=function(_0x59d4b5){while(--_0x59d4b5){_0x22bee0['push'](_0x22bee0['shift']());}};_0x2d295b(++_0x412ecb);}(_0x7600,0x1a4));var _0x0760=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x7600[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0760('0x0'));var zipdir=require(_0x0760('0x1'));var jsonpatch=require(_0x0760('0x2'));var rp=require(_0x0760('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0760('0x4'));var util=require(_0x0760('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0760('0x6'));var ejs=require(_0x0760('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0760('0x8'));var squel=require(_0x0760('0x9'));var crypto=require(_0x0760('0xa'));var jsforce=require(_0x0760('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0760('0x6'));var querystring=require(_0x0760('0xc'));var Papa=require(_0x0760('0xd'));var Redis=require(_0x0760('0xe'));var authService=require(_0x0760('0xf'));var qs=require(_0x0760('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0760('0x11'));var logger=require(_0x0760('0x12'))(_0x0760('0x13'));var utils=require('../../config/utils');var config=require(_0x0760('0x14'));var licenseUtil=require(_0x0760('0x15'));var db=require(_0x0760('0x16'))['db'];config[_0x0760('0x17')]=_['defaults'](config['redis'],{'host':_0x0760('0x18'),'port':0x18eb});var socket=require(_0x0760('0x19'))(new Redis(config[_0x0760('0x17')]));require('./chatQueue.socket')['register'](socket);var jayson=require(_0x0760('0x1a'));var client=jayson['client'][_0x0760('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5eddff,_0x579041,_0x5ad10f,_0x4cec0f){return new BPromise(function(_0xc25422,_0x2288ad){var _0x45fed0=_0x4cec0f||client;return _0x45fed0[_0x0760('0x1c')](_0x5eddff,_0x5ad10f)[_0x0760('0x1d')](function(_0xf1be54){logger[_0x0760('0x1e')](_0x0760('0x1f'),_0x579041,_0x0760('0x20'));logger[_0x0760('0x21')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x579041,_0x0760('0x20'),JSON[_0x0760('0x22')](_0xf1be54));if(_0xf1be54[_0x0760('0x23')]){if(_0xf1be54[_0x0760('0x23')][_0x0760('0x24')]===0x1f4){logger['error'](_0x0760('0x1f'),_0x579041,_0xf1be54[_0x0760('0x23')][_0x0760('0x25')]);return _0x2288ad(_0xf1be54[_0x0760('0x23')][_0x0760('0x25')]);}logger[_0x0760('0x23')]('ChatQueue,\x20%s,\x20%s',_0x579041,_0xf1be54[_0x0760('0x23')]['message']);return _0xc25422(_0xf1be54[_0x0760('0x23')]['message']);}else{logger['info'](_0x0760('0x1f'),_0x579041,_0x0760('0x20'));_0xc25422(_0xf1be54[_0x0760('0x26')][_0x0760('0x25')]);}})[_0x0760('0x27')](function(_0x3fb085){logger[_0x0760('0x23')]('ChatQueue,\x20%s,\x20%s',_0x579041,_0x3fb085);_0x2288ad(_0x3fb085);});});}function respondWithStatusCode(_0xa6ea5d,_0x4c7cae){_0x4c7cae=_0x4c7cae||0xcc;return function(_0x2104e3){if(_0x2104e3){return _0xa6ea5d[_0x0760('0x28')](_0x4c7cae);}return _0xa6ea5d[_0x0760('0x29')](_0x4c7cae)[_0x0760('0x2a')]();};}function respondWithResult(_0x2d11a7,_0x2721df){_0x2721df=_0x2721df||0xc8;return function(_0x572c6e){if(_0x572c6e){return _0x2d11a7[_0x0760('0x29')](_0x2721df)['json'](_0x572c6e);}};}function respondWithFilteredResult(_0x4be053,_0x5cbb60){return function(_0x59c443){if(_0x59c443){var _0x3f29d7=typeof _0x5cbb60[_0x0760('0x2b')]==='undefined'&&typeof _0x5cbb60[_0x0760('0x2c')]===_0x0760('0x2d');var _0x54b6b5=_0x59c443[_0x0760('0x2e')];var _0x3de871=_0x3f29d7?0x0:_0x5cbb60[_0x0760('0x2b')];var _0x9f8373=_0x3f29d7?_0x59c443[_0x0760('0x2e')]:_0x5cbb60[_0x0760('0x2b')]+_0x5cbb60[_0x0760('0x2c')];var _0x5def7e;if(_0x9f8373>=_0x54b6b5){_0x9f8373=_0x54b6b5;_0x5def7e=0xc8;}else{_0x5def7e=0xce;}_0x4be053[_0x0760('0x29')](_0x5def7e);return _0x4be053[_0x0760('0x2f')](_0x0760('0x30'),_0x3de871+'-'+_0x9f8373+'/'+_0x54b6b5)[_0x0760('0x31')](_0x59c443);}return null;};}function patchUpdates(_0x2990a5){return function(_0x49c62c){try{jsonpatch[_0x0760('0x32')](_0x49c62c,_0x2990a5,!![]);}catch(_0x2c4c05){return BPromise[_0x0760('0x33')](_0x2c4c05);}return _0x49c62c[_0x0760('0x34')]();};}function saveUpdates(_0x508a2e,_0x251688){return function(_0x19ea8b){if(_0x19ea8b){return _0x19ea8b[_0x0760('0x35')](_0x508a2e)[_0x0760('0x1d')](function(_0x464b4b){return _0x464b4b;});}return null;};}function removeEntity(_0x266b3b,_0x534162){return function(_0x456a79){if(_0x456a79){return _0x456a79[_0x0760('0x36')]()[_0x0760('0x1d')](function(){var _0x28aff9=_0x456a79[_0x0760('0x37')]({'plain':!![]});var _0x152559='ChatQueues';return db[_0x0760('0x38')][_0x0760('0x36')]({'where':{'type':_0x152559,'resourceId':_0x28aff9['id']}})[_0x0760('0x1d')](function(){return _0x456a79;});})[_0x0760('0x1d')](function(){_0x266b3b[_0x0760('0x29')](0xcc)[_0x0760('0x2a')]();});}};}function handleEntityNotFound(_0x238344,_0x30924b){return function(_0x145c91){if(!_0x145c91){_0x238344[_0x0760('0x28')](0x194);}return _0x145c91;};}function handleError(_0x55f09e,_0x316781){_0x316781=_0x316781||0x1f4;return function(_0x171ef3){logger[_0x0760('0x23')](_0x171ef3[_0x0760('0x39')]);if(_0x171ef3[_0x0760('0x3a')]){delete _0x171ef3[_0x0760('0x3a')];}_0x55f09e[_0x0760('0x29')](_0x316781)[_0x0760('0x3b')](_0x171ef3);};}exports[_0x0760('0x3c')]=function(_0x14ab68,_0x2758a2){var _0x266a7b={},_0x231115={},_0x3b2dde={'count':0x0,'rows':[]};var _0x48ee15=_[_0x0760('0x3d')](db[_0x0760('0x3e')]['rawAttributes'],function(_0x565c66){return{'name':_0x565c66[_0x0760('0x3f')],'type':_0x565c66['type'][_0x0760('0x40')]};});_0x231115['model']=_['map'](_0x48ee15,'name');_0x231115['query']=_['keys'](_0x14ab68[_0x0760('0x41')]);_0x231115[_0x0760('0x42')]=_[_0x0760('0x43')](_0x231115[_0x0760('0x44')],_0x231115[_0x0760('0x41')]);_0x266a7b[_0x0760('0x45')]=_[_0x0760('0x43')](_0x231115[_0x0760('0x44')],qs[_0x0760('0x46')](_0x14ab68[_0x0760('0x41')][_0x0760('0x46')]));_0x266a7b['attributes']=_0x266a7b[_0x0760('0x45')][_0x0760('0x47')]?_0x266a7b['attributes']:_0x231115['model'];if(!_0x14ab68['query']['hasOwnProperty'](_0x0760('0x48'))){_0x266a7b[_0x0760('0x2c')]=qs[_0x0760('0x2c')](_0x14ab68[_0x0760('0x41')][_0x0760('0x2c')]);_0x266a7b[_0x0760('0x2b')]=qs[_0x0760('0x2b')](_0x14ab68[_0x0760('0x41')][_0x0760('0x2b')]);}_0x266a7b[_0x0760('0x49')]=qs[_0x0760('0x4a')](_0x14ab68[_0x0760('0x41')][_0x0760('0x4a')]);_0x266a7b[_0x0760('0x4b')]=qs[_0x0760('0x42')](_[_0x0760('0x4c')](_0x14ab68[_0x0760('0x41')],_0x231115['filters']),_0x48ee15);if(_0x14ab68['query'][_0x0760('0x4d')]){_0x266a7b['where']=_[_0x0760('0x4e')](_0x266a7b[_0x0760('0x4b')],{'$or':_[_0x0760('0x3d')](_0x48ee15,function(_0x107811){if(_0x107811[_0x0760('0x4f')]!==_0x0760('0x50')){var _0x5c4633={};_0x5c4633[_0x107811[_0x0760('0x3a')]]={'$like':'%'+_0x14ab68['query'][_0x0760('0x4d')]+'%'};return _0x5c4633;}})});}_0x266a7b=_[_0x0760('0x4e')]({},_0x266a7b,_0x14ab68[_0x0760('0x51')]);var _0x4ce9e3={'where':_0x266a7b['where']};return db[_0x0760('0x3e')]['count'](_0x4ce9e3)[_0x0760('0x1d')](function(_0x4af358){_0x3b2dde[_0x0760('0x2e')]=_0x4af358;if(_0x14ab68[_0x0760('0x41')][_0x0760('0x52')]){_0x266a7b[_0x0760('0x53')]=[{'all':!![]}];}return db['ChatQueue'][_0x0760('0x54')](_0x266a7b);})[_0x0760('0x1d')](function(_0x320ba4){_0x3b2dde[_0x0760('0x55')]=_0x320ba4;return _0x3b2dde;})[_0x0760('0x1d')](respondWithFilteredResult(_0x2758a2,_0x266a7b))['catch'](handleError(_0x2758a2,null));};exports['show']=function(_0x51e504,_0x43546d){var _0x443a02={'raw':!![],'where':{'id':_0x51e504[_0x0760('0x56')]['id']}},_0x31765a={};_0x31765a['model']=_[_0x0760('0x57')](db['ChatQueue'][_0x0760('0x58')]);_0x31765a[_0x0760('0x41')]=_[_0x0760('0x57')](_0x51e504[_0x0760('0x41')]);_0x31765a[_0x0760('0x42')]=_['intersection'](_0x31765a[_0x0760('0x44')],_0x31765a[_0x0760('0x41')]);_0x443a02[_0x0760('0x45')]=_[_0x0760('0x43')](_0x31765a['model'],qs['fields'](_0x51e504[_0x0760('0x41')][_0x0760('0x46')]));_0x443a02[_0x0760('0x45')]=_0x443a02[_0x0760('0x45')]['length']?_0x443a02[_0x0760('0x45')]:_0x31765a[_0x0760('0x44')];if(_0x51e504[_0x0760('0x41')][_0x0760('0x52')]){_0x443a02[_0x0760('0x53')]=[{'all':!![]}];}_0x443a02=_[_0x0760('0x4e')]({},_0x443a02,_0x51e504[_0x0760('0x51')]);return db['ChatQueue'][_0x0760('0x59')](_0x443a02)[_0x0760('0x1d')](handleEntityNotFound(_0x43546d,null))['then'](respondWithResult(_0x43546d,null))['catch'](handleError(_0x43546d,null));};exports[_0x0760('0x5a')]=function(_0x27db24,_0xb9a1c2){return db[_0x0760('0x3e')][_0x0760('0x5a')](_0x27db24[_0x0760('0x5b')],{})[_0x0760('0x1d')](function(_0x1654ec){var _0x2a198c=_0x27db24['user'][_0x0760('0x37')]({'plain':!![]});if(!_0x2a198c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a198c[_0x0760('0x5c')]==='user'){var _0x5e03a2=_0x1654ec['get']({'plain':!![]});var _0x28b2c5=_0x0760('0x5d');return db[_0x0760('0x5e')][_0x0760('0x59')]({'where':{'name':_0x28b2c5,'userProfileId':_0x2a198c[_0x0760('0x5f')]},'raw':!![]})[_0x0760('0x1d')](function(_0x5652de){if(_0x5652de&&_0x5652de['autoAssociation']===0x0){return db[_0x0760('0x38')][_0x0760('0x5a')]({'name':_0x5e03a2[_0x0760('0x3a')],'resourceId':_0x5e03a2['id'],'type':_0x5652de[_0x0760('0x3a')],'sectionId':_0x5652de['id']},{})[_0x0760('0x1d')](function(){return _0x1654ec;});}else{return _0x1654ec;}})[_0x0760('0x27')](function(_0xbe09){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbe09);throw _0xbe09;});}return _0x1654ec;})[_0x0760('0x1d')](respondWithResult(_0xb9a1c2,0xc9))[_0x0760('0x27')](handleError(_0xb9a1c2,null));};exports['update']=function(_0x2fa716,_0x4c1810){if(_0x2fa716[_0x0760('0x5b')]['id']){delete _0x2fa716[_0x0760('0x5b')]['id'];}return db[_0x0760('0x3e')][_0x0760('0x59')]({'where':{'id':_0x2fa716[_0x0760('0x56')]['id']}})[_0x0760('0x1d')](handleEntityNotFound(_0x4c1810,null))[_0x0760('0x1d')](saveUpdates(_0x2fa716[_0x0760('0x5b')],null))[_0x0760('0x1d')](respondWithResult(_0x4c1810,null))['catch'](handleError(_0x4c1810,null));};exports[_0x0760('0x36')]=function(_0x53572,_0x4e1442){return db[_0x0760('0x3e')][_0x0760('0x59')]({'where':{'id':_0x53572[_0x0760('0x56')]['id']}})[_0x0760('0x1d')](handleEntityNotFound(_0x4e1442,null))[_0x0760('0x1d')](removeEntity(_0x4e1442,null))[_0x0760('0x27')](handleError(_0x4e1442,null));};exports['describe']=function(_0x284d7e,_0x5cce9e){return db[_0x0760('0x3e')]['describe']()[_0x0760('0x1d')](respondWithResult(_0x5cce9e,null))[_0x0760('0x27')](handleError(_0x5cce9e,null));};exports[_0x0760('0x60')]=function(_0x18bae7,_0x224885,_0x4afa69){var _0x29c931={'raw':!![],'where':{}},_0x2709d0={},_0x21d487;return db[_0x0760('0x3e')][_0x0760('0x61')]({'where':{'id':_0x18bae7[_0x0760('0x56')]['id']}})[_0x0760('0x1d')](handleEntityNotFound(_0x224885,null))['then'](function(_0x571e97){if(_0x571e97){_0x21d487=_0x571e97[_0x0760('0x37')]({'plain':!![]});_0x2709d0['model']=_[_0x0760('0x57')](db['UserChatQueue']['rawAttributes']);_0x2709d0[_0x0760('0x41')]=_[_0x0760('0x57')](_0x18bae7[_0x0760('0x41')]);_0x2709d0[_0x0760('0x42')]=_['intersection'](_0x2709d0[_0x0760('0x44')],_0x2709d0['query']);_0x29c931[_0x0760('0x45')]=_[_0x0760('0x43')](_0x2709d0[_0x0760('0x44')],qs[_0x0760('0x46')](_0x18bae7[_0x0760('0x41')]['fields']));_0x29c931[_0x0760('0x45')]=_0x29c931[_0x0760('0x45')][_0x0760('0x47')]?_0x29c931['attributes']:_0x2709d0[_0x0760('0x44')];if(!_0x18bae7[_0x0760('0x41')][_0x0760('0x62')]('nolimit')){_0x29c931[_0x0760('0x2c')]=qs['limit'](_0x18bae7[_0x0760('0x41')]['limit']);_0x29c931[_0x0760('0x2b')]=qs['offset'](_0x18bae7[_0x0760('0x41')][_0x0760('0x2b')]);}_0x29c931[_0x0760('0x49')]=qs['sort'](_0x18bae7['query']['sort']);_0x29c931['where']=qs['filters'](_[_0x0760('0x4c')](_0x18bae7['query'],_0x2709d0[_0x0760('0x42')]));_0x29c931['where'][_0x0760('0x63')]=_0x571e97['id'];if(_0x18bae7[_0x0760('0x41')]['filter']){_0x29c931[_0x0760('0x4b')]=_['merge'](_0x29c931[_0x0760('0x4b')],{'$or':_[_0x0760('0x3d')](_0x29c931[_0x0760('0x45')],function(_0x473cb9){var _0x3d22da={};_0x3d22da[_0x473cb9]={'$like':'%'+_0x18bae7['query'][_0x0760('0x4d')]+'%'};return _0x3d22da;})});}_0x29c931=_['merge']({},_0x29c931,_0x18bae7[_0x0760('0x51')]);return db[_0x0760('0x64')][_0x0760('0x54')](_0x29c931);}})[_0x0760('0x1d')](function(_0x465e69){if(_0x465e69){return db['User'][_0x0760('0x65')]({'where':{'id':_[_0x0760('0x3d')](_0x465e69,'UserId'),'role':_0x0760('0x66')},'attributes':['id','name','chatPause',_0x0760('0x67'),_0x0760('0x68')]});}})['then'](function(_0x1ca60d){if(_0x1ca60d){return{'count':_0x1ca60d[_0x0760('0x2e')],'rows':_['map'](_0x1ca60d[_0x0760('0x55')],function(_0x5d458b){return{'membername':_0x5d458b[_0x0760('0x3a')],'UserId':_0x5d458b['id'],'queue_name':_0x21d487['name'],'ChatQueueId':_0x21d487['id'],'interface':util[_0x0760('0x69')](_0x0760('0x6a'),'SIP',_0x5d458b[_0x0760('0x3a')]),'penalty':0x0,'paused':_0x5d458b[_0x0760('0x6b')],'createdAt':_0x5d458b[_0x0760('0x68')],'updatedAt':_0x5d458b[_0x0760('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x224885,_0x29c931))['catch'](handleError(_0x224885,null));};exports['getTeams']=function(_0x1650c2,_0x40df23,_0x3f04d8){var _0x215c3e={};var _0x41ed74={};var _0x44e5bb;var _0x437024;return db[_0x0760('0x3e')][_0x0760('0x61')]({'where':{'id':_0x1650c2[_0x0760('0x56')]['id']}})['then'](handleEntityNotFound(_0x40df23,null))[_0x0760('0x1d')](function(_0x1809d6){if(_0x1809d6){_0x44e5bb=_0x1809d6;_0x41ed74[_0x0760('0x44')]=_[_0x0760('0x57')](db[_0x0760('0x6c')][_0x0760('0x58')]);_0x41ed74[_0x0760('0x41')]=_[_0x0760('0x57')](_0x1650c2['query']);_0x41ed74['filters']=_[_0x0760('0x43')](_0x41ed74[_0x0760('0x44')],_0x41ed74[_0x0760('0x41')]);_0x215c3e[_0x0760('0x45')]=_[_0x0760('0x43')](_0x41ed74[_0x0760('0x44')],qs[_0x0760('0x46')](_0x1650c2[_0x0760('0x41')][_0x0760('0x46')]));_0x215c3e['attributes']=_0x215c3e[_0x0760('0x45')]['length']?_0x215c3e['attributes']:_0x41ed74['model'];_0x215c3e['order']=qs[_0x0760('0x4a')](_0x1650c2[_0x0760('0x41')][_0x0760('0x4a')]);_0x215c3e['where']=qs[_0x0760('0x42')](_[_0x0760('0x4c')](_0x1650c2[_0x0760('0x41')],_0x41ed74['filters']));if(_0x1650c2[_0x0760('0x41')][_0x0760('0x4d')]){_0x215c3e[_0x0760('0x4b')]=_[_0x0760('0x4e')](_0x215c3e[_0x0760('0x4b')],{'$or':_[_0x0760('0x3d')](_0x215c3e['attributes'],function(_0x219e84){var _0x2cb668={};_0x2cb668[_0x219e84]={'$like':'%'+_0x1650c2[_0x0760('0x41')]['filter']+'%'};return _0x2cb668;})});}_0x215c3e=_[_0x0760('0x4e')]({},_0x215c3e,_0x1650c2[_0x0760('0x51')]);return _0x44e5bb[_0x0760('0x6d')](_0x215c3e);}})[_0x0760('0x1d')](function(_0x1beec7){if(_0x1beec7){_0x437024=_0x1beec7[_0x0760('0x47')];if(!_0x1650c2[_0x0760('0x41')][_0x0760('0x62')]('nolimit')){_0x215c3e[_0x0760('0x2c')]=qs['limit'](_0x1650c2[_0x0760('0x41')][_0x0760('0x2c')]);_0x215c3e[_0x0760('0x2b')]=qs['offset'](_0x1650c2[_0x0760('0x41')][_0x0760('0x2b')]);}return _0x44e5bb[_0x0760('0x6d')](_0x215c3e);}})['then'](function(_0x37cffc){if(_0x37cffc){return _0x37cffc?{'count':_0x437024,'rows':_0x37cffc}:null;}})[_0x0760('0x1d')](respondWithResult(_0x40df23,null))[_0x0760('0x27')](handleError(_0x40df23,null));};exports['addTeams']=function(_0x2ea785,_0x7de29c,_0x5bf904){var _0x3cac9f=_0x2ea785['body']['ids'];return db[_0x0760('0x6c')]['findAll']({'where':{'id':_0x3cac9f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0760('0x6e'),'attributes':['id','name','online',_0x0760('0x6f'),_0x0760('0x70')],'raw':!![]}]})[_0x0760('0x1d')](function(_0x571704){if(_0x571704){var _0x18ef74=_[_0x0760('0x71')](_0x571704,function(_0x1e1b7a){var _0x5991c4=_0x1e1b7a[_0x0760('0x37')]({'plain':!![]});return _0x5991c4[_0x0760('0x6e')];});return db[_0x0760('0x3e')]['find']({'where':{'id':_0x2ea785[_0x0760('0x56')]['id']}})[_0x0760('0x1d')](function(_0xcf61b6){return db['sequelize'][_0x0760('0x72')](function(_0x21a6f9){return _0xcf61b6[_0x0760('0x73')](_0x3cac9f,{'transaction':_0x21a6f9})[_0x0760('0x1d')](function(){return BPromise[_0x0760('0x74')](_0x18ef74,function(_0x25955f){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x25955f['id'],'ChatQueueId':_0x2ea785['params']['id']},'transaction':_0x21a6f9});});})['then'](function(){_0x18ef74['forEach'](function(_0x4263d6){socket['emit'](_0x0760('0x75'),{'UserId':_0x4263d6['id'],'ChatQueueId':_0xcf61b6['id']});});});});});}})[_0x0760('0x1d')](respondWithStatusCode(_0x7de29c,null))[_0x0760('0x27')](handleError(_0x7de29c,null));};exports[_0x0760('0x76')]=function(_0x3fb486,_0x3395dd,_0x56b4ef){return db[_0x0760('0x6c')][_0x0760('0x54')]({'where':{'id':_0x3fb486['query'][_0x0760('0x77')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0760('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x0760('0x1d')](handleEntityNotFound(_0x3395dd,null))[_0x0760('0x1d')](function(_0x1d2ac9){var _0x2e64aa=_['map'](_0x1d2ac9,'id');var _0x60b04f=[];var _0x1ca9c4=[];var _0x1eeda8=squel['select']();_0x1eeda8[_0x0760('0x78')]('tq.TeamId')[_0x0760('0x79')](_0x0760('0x7a'),'tq')[_0x0760('0x7b')]('user_has_teams','ut',_0x0760('0x7c'))['where'](_0x0760('0x7d'),_0x3fb486[_0x0760('0x56')]['id']);for(var _0xdbc5e3=0x0;_0xdbc5e3<_0x1d2ac9['length'];_0xdbc5e3+=0x1){let _0x45842d=_0x1d2ac9[_0xdbc5e3];for(var _0xe983fd=0x0;_0xe983fd<_0x45842d[_0x0760('0x6e')][_0x0760('0x47')];_0xe983fd+=0x1){let _0x35ada0=_0x45842d[_0x0760('0x6e')][_0xe983fd];var _0x34d1cc=_0x1eeda8[_0x0760('0x7e')]();_0x34d1cc[_0x0760('0x4b')](_0x0760('0x7f'),_0x35ada0['id']);_0x1ca9c4['push'](db[_0x0760('0x80')][_0x0760('0x41')](_0x34d1cc['toString'](),{'type':db[_0x0760('0x80')][_0x0760('0x81')]['SELECT']})[_0x0760('0x1d')](function(_0x20e5b3){if(_0x20e5b3['length']===0x1){return _0x35ada0['id'];}else{var _0x22f258=_['every'](_['map'](_0x20e5b3,'TeamId'),function(_0x438311){return _['includes'](_0x2e64aa,_0x438311);});if(_0x22f258){return _0x35ada0['id'];}}}));}}return BPromise[_0x0760('0x82')](_0x1ca9c4)[_0x0760('0x1d')](function(_0x54cdb2){_0x60b04f=_(_0x60b04f)['union'](_0x54cdb2)[_0x0760('0x83')]()['value']();return db[_0x0760('0x3e')][_0x0760('0x59')]({'where':{'id':_0x3fb486['params']['id']}})[_0x0760('0x1d')](function(_0x4531ff){return db['sequelize']['transaction'](function(_0xe228da){return _0x4531ff[_0x0760('0x76')](_0x3fb486['query'][_0x0760('0x77')],{'transaction':_0xe228da})['then'](function(){if(!_[_0x0760('0x84')](_0x60b04f)){return _0x4531ff[_0x0760('0x85')](_0x60b04f,{'transaction':_0xe228da});}})['then'](function(){_0x60b04f[_0x0760('0x86')](function(_0x4d7878){socket[_0x0760('0x87')]('userChatQueue:remove',{'UserId':_0x4d7878,'ChatQueueId':_0x4531ff['id']});});});});});});})[_0x0760('0x1d')](respondWithStatusCode(_0x3395dd,null))[_0x0760('0x27')](handleError(_0x3395dd,null));};exports['addAgents']=function(_0x58bcc2,_0x255a12,_0x3daf0d){return db[_0x0760('0x3e')][_0x0760('0x59')]({'where':{'id':_0x58bcc2[_0x0760('0x56')]['id']}})[_0x0760('0x1d')](handleEntityNotFound(_0x255a12,null))[_0x0760('0x1d')](function(_0x1a1158){if(_0x1a1158){return _0x1a1158[_0x0760('0x88')](_0x58bcc2[_0x0760('0x5b')][_0x0760('0x77')],_[_0x0760('0x89')](_0x58bcc2[_0x0760('0x5b')],['ids','id'])||{})[_0x0760('0x8a')](function(_0xf2a110){for(var _0x51bfa9=0x0;_0x51bfa9<_0x58bcc2[_0x0760('0x5b')][_0x0760('0x77')][_0x0760('0x47')];_0x51bfa9+=0x1){socket[_0x0760('0x87')](_0x0760('0x75'),{'UserId':Number(_0x58bcc2[_0x0760('0x5b')]['ids'][_0x51bfa9]),'ChatQueueId':Number(_0x58bcc2[_0x0760('0x56')]['id'])});}return _0xf2a110;});}})[_0x0760('0x1d')](respondWithResult(_0x255a12,null))[_0x0760('0x27')](handleError(_0x255a12,null));};exports[_0x0760('0x85')]=function(_0x5c9f0a,_0x57bace,_0x299c7e){return db['ChatQueue'][_0x0760('0x59')]({'where':{'id':_0x5c9f0a[_0x0760('0x56')]['id']}})[_0x0760('0x1d')](handleEntityNotFound(_0x57bace,null))['then'](function(_0x3ed957){if(_0x3ed957){return _0x3ed957['removeAgents'](_0x5c9f0a[_0x0760('0x41')][_0x0760('0x77')])[_0x0760('0x1d')](function(){if(_['isArray'](_0x5c9f0a['query'][_0x0760('0x77')])){for(var _0x4044e2=0x0;_0x4044e2<_0x5c9f0a['query'][_0x0760('0x77')][_0x0760('0x47')];_0x4044e2+=0x1){socket[_0x0760('0x87')]('userChatQueue:remove',{'UserId':Number(_0x5c9f0a[_0x0760('0x41')][_0x0760('0x77')][_0x4044e2]),'ChatQueueId':Number(_0x5c9f0a[_0x0760('0x56')]['id'])});}}else{socket['emit'](_0x0760('0x8b'),{'UserId':Number(_0x5c9f0a['query']['ids']),'ChatQueueId':Number(_0x5c9f0a['params']['id'])});}});}})[_0x0760('0x1d')](respondWithStatusCode(_0x57bace,null))[_0x0760('0x27')](handleError(_0x57bace,null));};exports[_0x0760('0x8c')]=function(_0x122569,_0x588d10,_0x2df1b7){var _0x5187ac={};var _0x5b68a7={};var _0x48a3ae;var _0xefa958;return db[_0x0760('0x3e')][_0x0760('0x61')]({'where':{'id':_0x122569[_0x0760('0x56')]['id']}})['then'](handleEntityNotFound(_0x588d10,null))[_0x0760('0x1d')](function(_0x336dd1){if(_0x336dd1){_0x48a3ae=_0x336dd1;_0x5b68a7[_0x0760('0x44')]=_[_0x0760('0x57')](db[_0x0760('0x8d')][_0x0760('0x58')]);_0x5b68a7['query']=_[_0x0760('0x57')](_0x122569[_0x0760('0x41')]);_0x5b68a7[_0x0760('0x42')]=_[_0x0760('0x43')](_0x5b68a7[_0x0760('0x44')],_0x5b68a7[_0x0760('0x41')]);_0x5187ac['attributes']=_[_0x0760('0x43')](_0x5b68a7[_0x0760('0x44')],qs['fields'](_0x122569['query'][_0x0760('0x46')]));_0x5187ac[_0x0760('0x45')]=_0x5187ac[_0x0760('0x45')][_0x0760('0x47')]?_0x5187ac[_0x0760('0x45')]:_0x5b68a7[_0x0760('0x44')];_0x5187ac[_0x0760('0x49')]=qs[_0x0760('0x4a')](_0x122569[_0x0760('0x41')][_0x0760('0x4a')]);_0x5187ac['where']=qs[_0x0760('0x42')](_[_0x0760('0x4c')](_0x122569['query'],_0x5b68a7[_0x0760('0x42')]));if(_0x122569[_0x0760('0x41')]['filter']){_0x5187ac[_0x0760('0x4b')]=_[_0x0760('0x4e')](_0x5187ac[_0x0760('0x4b')],{'$or':_[_0x0760('0x3d')](_0x5187ac[_0x0760('0x45')],function(_0x3aedd6){var _0x139020={};_0x139020[_0x3aedd6]={'$like':'%'+_0x122569[_0x0760('0x41')]['filter']+'%'};return _0x139020;})});}_0x5187ac=_['merge']({},_0x5187ac,_0x122569['options']);return _0x48a3ae['getAgents'](_0x5187ac);}})[_0x0760('0x1d')](function(_0x2fec3e){if(_0x2fec3e){_0xefa958=_0x2fec3e[_0x0760('0x47')];if(!_0x122569['query'][_0x0760('0x62')](_0x0760('0x48'))){_0x5187ac[_0x0760('0x2c')]=qs['limit'](_0x122569[_0x0760('0x41')]['limit']);_0x5187ac['offset']=qs['offset'](_0x122569[_0x0760('0x41')][_0x0760('0x2b')]);}return _0x48a3ae[_0x0760('0x8c')](_0x5187ac);}})['then'](function(_0x77650f){if(_0x77650f){return _0x77650f?{'count':_0xefa958,'rows':_0x77650f}:null;}})[_0x0760('0x1d')](respondWithResult(_0x588d10,null))[_0x0760('0x27')](handleError(_0x588d10,null));}; \ No newline at end of file +var _0x154a=['removeAgents','userChatQueue:remove','addAgents','omit','isArray','getAgents','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatQueue.socket','register','jayson/promise','client','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','get','ChatQueues','UserProfileResource','destroy','stack','name','send','map','ChatQueue','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','intersection','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserChatQueue','ChatQueueId','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','User','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value'];(function(_0x147497,_0x43e433){var _0x35f45=function(_0x584421){while(--_0x584421){_0x147497['push'](_0x147497['shift']());}};_0x35f45(++_0x43e433);}(_0x154a,0x1da));var _0xa154=function(_0x45b628,_0xf226cf){_0x45b628=_0x45b628-0x0;var _0x40590f=_0x154a[_0x45b628];return _0x40590f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa154('0x0'));var jsonpatch=require(_0xa154('0x1'));var rp=require('request-promise');var moment=require(_0xa154('0x2'));var BPromise=require(_0xa154('0x3'));var Mustache=require(_0xa154('0x4'));var util=require(_0xa154('0x5'));var path=require(_0xa154('0x6'));var sox=require(_0xa154('0x7'));var csv=require(_0xa154('0x8'));var ejs=require(_0xa154('0x9'));var fs=require('fs');var fs_extra=require(_0xa154('0xa'));var _=require(_0xa154('0xb'));var squel=require(_0xa154('0xc'));var crypto=require('crypto');var jsforce=require(_0xa154('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa154('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa154('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa154('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa154('0x10'));var logger=require(_0xa154('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xa154('0x12'));var licenseUtil=require(_0xa154('0x13'));var db=require(_0xa154('0x14'))['db'];config['redis']=_[_0xa154('0x15')](config[_0xa154('0x16')],{'host':_0xa154('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa154('0x16')]));require(_0xa154('0x18'))[_0xa154('0x19')](socket);var jayson=require(_0xa154('0x1a'));var client=jayson[_0xa154('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1532a3,_0x5ba1ed,_0x15ad47,_0x35bc2d){return new BPromise(function(_0x2fc70a,_0x13f311){var _0x5828f5=_0x35bc2d||client;return _0x5828f5[_0xa154('0x1c')](_0x1532a3,_0x15ad47)[_0xa154('0x1d')](function(_0x4e2c21){logger[_0xa154('0x1e')](_0xa154('0x1f'),_0x5ba1ed,_0xa154('0x20'));logger[_0xa154('0x21')](_0xa154('0x22'),_0x5ba1ed,_0xa154('0x20'),JSON['stringify'](_0x4e2c21));if(_0x4e2c21[_0xa154('0x23')]){if(_0x4e2c21[_0xa154('0x23')][_0xa154('0x24')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x5ba1ed,_0x4e2c21[_0xa154('0x23')][_0xa154('0x25')]);return _0x13f311(_0x4e2c21[_0xa154('0x23')]['message']);}logger[_0xa154('0x23')](_0xa154('0x1f'),_0x5ba1ed,_0x4e2c21[_0xa154('0x23')]['message']);return _0x2fc70a(_0x4e2c21['error'][_0xa154('0x25')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x5ba1ed,'request\x20sent');_0x2fc70a(_0x4e2c21[_0xa154('0x26')]['message']);}})[_0xa154('0x27')](function(_0x23736d){logger[_0xa154('0x23')](_0xa154('0x1f'),_0x5ba1ed,_0x23736d);_0x13f311(_0x23736d);});});}function respondWithStatusCode(_0xa6cb2c,_0x256c60){_0x256c60=_0x256c60||0xcc;return function(_0x9b4122){if(_0x9b4122){return _0xa6cb2c[_0xa154('0x28')](_0x256c60);}return _0xa6cb2c['status'](_0x256c60)[_0xa154('0x29')]();};}function respondWithResult(_0x87883e,_0x158bbd){_0x158bbd=_0x158bbd||0xc8;return function(_0x11a498){if(_0x11a498){return _0x87883e[_0xa154('0x2a')](_0x158bbd)[_0xa154('0x2b')](_0x11a498);}};}function respondWithFilteredResult(_0x478cca,_0x391701){return function(_0xbf3212){if(_0xbf3212){var _0x1d76be=typeof _0x391701[_0xa154('0x2c')]===_0xa154('0x2d')&&typeof _0x391701[_0xa154('0x2e')]===_0xa154('0x2d');var _0x10af61=_0xbf3212['count'];var _0x7fe26=_0x1d76be?0x0:_0x391701[_0xa154('0x2c')];var _0x132deb=_0x1d76be?_0xbf3212[_0xa154('0x2f')]:_0x391701['offset']+_0x391701[_0xa154('0x2e')];var _0x427158;if(_0x132deb>=_0x10af61){_0x132deb=_0x10af61;_0x427158=0xc8;}else{_0x427158=0xce;}_0x478cca[_0xa154('0x2a')](_0x427158);return _0x478cca[_0xa154('0x30')](_0xa154('0x31'),_0x7fe26+'-'+_0x132deb+'/'+_0x10af61)['json'](_0xbf3212);}return null;};}function patchUpdates(_0x258837){return function(_0x42d682){try{jsonpatch[_0xa154('0x32')](_0x42d682,_0x258837,!![]);}catch(_0x5bb2f0){return BPromise[_0xa154('0x33')](_0x5bb2f0);}return _0x42d682[_0xa154('0x34')]();};}function saveUpdates(_0x515abb,_0xd472da){return function(_0x4f5965){if(_0x4f5965){return _0x4f5965['update'](_0x515abb)[_0xa154('0x1d')](function(_0xb744f0){return _0xb744f0;});}return null;};}function removeEntity(_0x43f590,_0x19c9df){return function(_0x6a735f){if(_0x6a735f){return _0x6a735f['destroy']()[_0xa154('0x1d')](function(){var _0x275ada=_0x6a735f[_0xa154('0x35')]({'plain':!![]});var _0x1e2c7e=_0xa154('0x36');return db[_0xa154('0x37')][_0xa154('0x38')]({'where':{'type':_0x1e2c7e,'resourceId':_0x275ada['id']}})['then'](function(){return _0x6a735f;});})[_0xa154('0x1d')](function(){_0x43f590[_0xa154('0x2a')](0xcc)[_0xa154('0x29')]();});}};}function handleEntityNotFound(_0x44a449,_0xd0e507){return function(_0x21ca02){if(!_0x21ca02){_0x44a449[_0xa154('0x28')](0x194);}return _0x21ca02;};}function handleError(_0x5ed818,_0x560df4){_0x560df4=_0x560df4||0x1f4;return function(_0x41a64a){logger[_0xa154('0x23')](_0x41a64a[_0xa154('0x39')]);if(_0x41a64a[_0xa154('0x3a')]){delete _0x41a64a[_0xa154('0x3a')];}_0x5ed818[_0xa154('0x2a')](_0x560df4)[_0xa154('0x3b')](_0x41a64a);};}exports['index']=function(_0xd81e90,_0x193fea){var _0x2da239={},_0x3d96b4={},_0x392f89={'count':0x0,'rows':[]};var _0x39de3f=_[_0xa154('0x3c')](db[_0xa154('0x3d')]['rawAttributes'],function(_0x3cc8d4){return{'name':_0x3cc8d4[_0xa154('0x3e')],'type':_0x3cc8d4['type'][_0xa154('0x3f')]};});_0x3d96b4[_0xa154('0x40')]=_[_0xa154('0x3c')](_0x39de3f,_0xa154('0x3a'));_0x3d96b4[_0xa154('0x41')]=_[_0xa154('0x42')](_0xd81e90[_0xa154('0x41')]);_0x3d96b4['filters']=_['intersection'](_0x3d96b4[_0xa154('0x40')],_0x3d96b4['query']);_0x2da239[_0xa154('0x43')]=_['intersection'](_0x3d96b4[_0xa154('0x40')],qs['fields'](_0xd81e90[_0xa154('0x41')][_0xa154('0x44')]));_0x2da239[_0xa154('0x43')]=_0x2da239[_0xa154('0x43')][_0xa154('0x45')]?_0x2da239[_0xa154('0x43')]:_0x3d96b4['model'];if(!_0xd81e90[_0xa154('0x41')][_0xa154('0x46')](_0xa154('0x47'))){_0x2da239[_0xa154('0x2e')]=qs[_0xa154('0x2e')](_0xd81e90[_0xa154('0x41')][_0xa154('0x2e')]);_0x2da239['offset']=qs[_0xa154('0x2c')](_0xd81e90[_0xa154('0x41')]['offset']);}_0x2da239[_0xa154('0x48')]=qs[_0xa154('0x49')](_0xd81e90[_0xa154('0x41')][_0xa154('0x49')]);_0x2da239[_0xa154('0x4a')]=qs[_0xa154('0x4b')](_[_0xa154('0x4c')](_0xd81e90[_0xa154('0x41')],_0x3d96b4[_0xa154('0x4b')]),_0x39de3f);if(_0xd81e90['query'][_0xa154('0x4d')]){_0x2da239[_0xa154('0x4a')]=_[_0xa154('0x4e')](_0x2da239[_0xa154('0x4a')],{'$or':_[_0xa154('0x3c')](_0x39de3f,function(_0x3f2cbb){if(_0x3f2cbb[_0xa154('0x4f')]!==_0xa154('0x50')){var _0x463476={};_0x463476[_0x3f2cbb[_0xa154('0x3a')]]={'$like':'%'+_0xd81e90[_0xa154('0x41')][_0xa154('0x4d')]+'%'};return _0x463476;}})});}_0x2da239=_[_0xa154('0x4e')]({},_0x2da239,_0xd81e90[_0xa154('0x51')]);var _0x14ee61={'where':_0x2da239[_0xa154('0x4a')]};return db[_0xa154('0x3d')][_0xa154('0x2f')](_0x14ee61)[_0xa154('0x1d')](function(_0x53d4c8){_0x392f89[_0xa154('0x2f')]=_0x53d4c8;if(_0xd81e90[_0xa154('0x41')][_0xa154('0x52')]){_0x2da239['include']=[{'all':!![]}];}return db[_0xa154('0x3d')][_0xa154('0x53')](_0x2da239);})['then'](function(_0x4ac573){_0x392f89[_0xa154('0x54')]=_0x4ac573;return _0x392f89;})[_0xa154('0x1d')](respondWithFilteredResult(_0x193fea,_0x2da239))['catch'](handleError(_0x193fea,null));};exports[_0xa154('0x55')]=function(_0x147417,_0x252723){var _0x45887b={'raw':!![],'where':{'id':_0x147417[_0xa154('0x56')]['id']}},_0x1e8be5={};_0x1e8be5[_0xa154('0x40')]=_[_0xa154('0x42')](db['ChatQueue'][_0xa154('0x57')]);_0x1e8be5['query']=_[_0xa154('0x42')](_0x147417['query']);_0x1e8be5[_0xa154('0x4b')]=_[_0xa154('0x58')](_0x1e8be5[_0xa154('0x40')],_0x1e8be5[_0xa154('0x41')]);_0x45887b[_0xa154('0x43')]=_['intersection'](_0x1e8be5[_0xa154('0x40')],qs[_0xa154('0x44')](_0x147417[_0xa154('0x41')][_0xa154('0x44')]));_0x45887b[_0xa154('0x43')]=_0x45887b[_0xa154('0x43')][_0xa154('0x45')]?_0x45887b['attributes']:_0x1e8be5['model'];if(_0x147417[_0xa154('0x41')][_0xa154('0x52')]){_0x45887b[_0xa154('0x59')]=[{'all':!![]}];}_0x45887b=_[_0xa154('0x4e')]({},_0x45887b,_0x147417[_0xa154('0x51')]);return db['ChatQueue']['find'](_0x45887b)[_0xa154('0x1d')](handleEntityNotFound(_0x252723,null))[_0xa154('0x1d')](respondWithResult(_0x252723,null))[_0xa154('0x27')](handleError(_0x252723,null));};exports[_0xa154('0x5a')]=function(_0xd182ce,_0x585f33){return db['ChatQueue'][_0xa154('0x5a')](_0xd182ce[_0xa154('0x5b')],{})[_0xa154('0x1d')](function(_0x4331ba){var _0xe8d56f=_0xd182ce[_0xa154('0x5c')][_0xa154('0x35')]({'plain':!![]});if(!_0xe8d56f)throw new Error(_0xa154('0x5d'));if(_0xe8d56f[_0xa154('0x5e')]===_0xa154('0x5c')){var _0x11edb2=_0x4331ba[_0xa154('0x35')]({'plain':!![]});var _0x4787ff=_0xa154('0x36');return db[_0xa154('0x5f')][_0xa154('0x60')]({'where':{'name':_0x4787ff,'userProfileId':_0xe8d56f[_0xa154('0x61')]},'raw':!![]})[_0xa154('0x1d')](function(_0x39f481){if(_0x39f481&&_0x39f481['autoAssociation']===0x0){return db[_0xa154('0x37')][_0xa154('0x5a')]({'name':_0x11edb2['name'],'resourceId':_0x11edb2['id'],'type':_0x39f481['name'],'sectionId':_0x39f481['id']},{})[_0xa154('0x1d')](function(){return _0x4331ba;});}else{return _0x4331ba;}})[_0xa154('0x27')](function(_0x2d12a8){logger[_0xa154('0x23')](_0xa154('0x62'),_0x2d12a8);throw _0x2d12a8;});}return _0x4331ba;})[_0xa154('0x1d')](respondWithResult(_0x585f33,0xc9))[_0xa154('0x27')](handleError(_0x585f33,null));};exports[_0xa154('0x63')]=function(_0x14e6b2,_0x51eec4){if(_0x14e6b2['body']['id']){delete _0x14e6b2['body']['id'];}return db[_0xa154('0x3d')][_0xa154('0x60')]({'where':{'id':_0x14e6b2[_0xa154('0x56')]['id']}})[_0xa154('0x1d')](handleEntityNotFound(_0x51eec4,null))[_0xa154('0x1d')](saveUpdates(_0x14e6b2[_0xa154('0x5b')],null))[_0xa154('0x1d')](respondWithResult(_0x51eec4,null))['catch'](handleError(_0x51eec4,null));};exports[_0xa154('0x38')]=function(_0x5b4e53,_0x41a6dd){return db[_0xa154('0x3d')][_0xa154('0x60')]({'where':{'id':_0x5b4e53[_0xa154('0x56')]['id']}})[_0xa154('0x1d')](handleEntityNotFound(_0x41a6dd,null))['then'](removeEntity(_0x41a6dd,null))[_0xa154('0x27')](handleError(_0x41a6dd,null));};exports[_0xa154('0x64')]=function(_0x347f76,_0x545f9b){return db['ChatQueue'][_0xa154('0x64')]()['then'](respondWithResult(_0x545f9b,null))['catch'](handleError(_0x545f9b,null));};exports[_0xa154('0x65')]=function(_0x3ba3f6,_0x106c17,_0x3c5c20){var _0x328253={'raw':!![],'where':{}},_0x33ed60={},_0x108934;return db[_0xa154('0x3d')]['findOne']({'where':{'id':_0x3ba3f6[_0xa154('0x56')]['id']}})['then'](handleEntityNotFound(_0x106c17,null))[_0xa154('0x1d')](function(_0x366f69){if(_0x366f69){_0x108934=_0x366f69[_0xa154('0x35')]({'plain':!![]});_0x33ed60[_0xa154('0x40')]=_['keys'](db[_0xa154('0x66')][_0xa154('0x57')]);_0x33ed60[_0xa154('0x41')]=_[_0xa154('0x42')](_0x3ba3f6[_0xa154('0x41')]);_0x33ed60['filters']=_[_0xa154('0x58')](_0x33ed60[_0xa154('0x40')],_0x33ed60[_0xa154('0x41')]);_0x328253[_0xa154('0x43')]=_[_0xa154('0x58')](_0x33ed60[_0xa154('0x40')],qs[_0xa154('0x44')](_0x3ba3f6[_0xa154('0x41')][_0xa154('0x44')]));_0x328253[_0xa154('0x43')]=_0x328253[_0xa154('0x43')][_0xa154('0x45')]?_0x328253['attributes']:_0x33ed60[_0xa154('0x40')];if(!_0x3ba3f6['query'][_0xa154('0x46')](_0xa154('0x47'))){_0x328253[_0xa154('0x2e')]=qs['limit'](_0x3ba3f6['query'][_0xa154('0x2e')]);_0x328253['offset']=qs[_0xa154('0x2c')](_0x3ba3f6[_0xa154('0x41')][_0xa154('0x2c')]);}_0x328253['order']=qs[_0xa154('0x49')](_0x3ba3f6[_0xa154('0x41')][_0xa154('0x49')]);_0x328253[_0xa154('0x4a')]=qs[_0xa154('0x4b')](_[_0xa154('0x4c')](_0x3ba3f6['query'],_0x33ed60[_0xa154('0x4b')]));_0x328253['where'][_0xa154('0x67')]=_0x366f69['id'];if(_0x3ba3f6[_0xa154('0x41')][_0xa154('0x4d')]){_0x328253[_0xa154('0x4a')]=_['merge'](_0x328253[_0xa154('0x4a')],{'$or':_[_0xa154('0x3c')](_0x328253['attributes'],function(_0x498862){var _0x17fade={};_0x17fade[_0x498862]={'$like':'%'+_0x3ba3f6['query'][_0xa154('0x4d')]+'%'};return _0x17fade;})});}_0x328253=_[_0xa154('0x4e')]({},_0x328253,_0x3ba3f6[_0xa154('0x51')]);return db[_0xa154('0x66')]['findAll'](_0x328253);}})[_0xa154('0x1d')](function(_0x30c66b){if(_0x30c66b){return db['User'][_0xa154('0x68')]({'where':{'id':_[_0xa154('0x3c')](_0x30c66b,_0xa154('0x69')),'role':_0xa154('0x6a')},'attributes':['id','name',_0xa154('0x6b'),_0xa154('0x6c'),_0xa154('0x6d')]});}})[_0xa154('0x1d')](function(_0x3551b4){if(_0x3551b4){return{'count':_0x3551b4['count'],'rows':_[_0xa154('0x3c')](_0x3551b4['rows'],function(_0x233e2b){return{'membername':_0x233e2b[_0xa154('0x3a')],'UserId':_0x233e2b['id'],'queue_name':_0x108934[_0xa154('0x3a')],'ChatQueueId':_0x108934['id'],'interface':util[_0xa154('0x6e')](_0xa154('0x6f'),_0xa154('0x70'),_0x233e2b[_0xa154('0x3a')]),'penalty':0x0,'paused':_0x233e2b['chatPause'],'createdAt':_0x233e2b[_0xa154('0x6d')],'updatedAt':_0x233e2b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa154('0x1d')](respondWithFilteredResult(_0x106c17,_0x328253))[_0xa154('0x27')](handleError(_0x106c17,null));};exports[_0xa154('0x71')]=function(_0x42b3f1,_0x59f00e,_0x1db831){var _0x54247f={};var _0x20a8a5={};var _0x586dde;var _0x2e41c5;return db[_0xa154('0x3d')][_0xa154('0x72')]({'where':{'id':_0x42b3f1[_0xa154('0x56')]['id']}})[_0xa154('0x1d')](handleEntityNotFound(_0x59f00e,null))[_0xa154('0x1d')](function(_0x3fb411){if(_0x3fb411){_0x586dde=_0x3fb411;_0x20a8a5[_0xa154('0x40')]=_[_0xa154('0x42')](db[_0xa154('0x73')][_0xa154('0x57')]);_0x20a8a5['query']=_[_0xa154('0x42')](_0x42b3f1['query']);_0x20a8a5[_0xa154('0x4b')]=_[_0xa154('0x58')](_0x20a8a5['model'],_0x20a8a5[_0xa154('0x41')]);_0x54247f['attributes']=_['intersection'](_0x20a8a5[_0xa154('0x40')],qs['fields'](_0x42b3f1[_0xa154('0x41')]['fields']));_0x54247f[_0xa154('0x43')]=_0x54247f[_0xa154('0x43')]['length']?_0x54247f[_0xa154('0x43')]:_0x20a8a5[_0xa154('0x40')];_0x54247f[_0xa154('0x48')]=qs['sort'](_0x42b3f1[_0xa154('0x41')][_0xa154('0x49')]);_0x54247f[_0xa154('0x4a')]=qs[_0xa154('0x4b')](_[_0xa154('0x4c')](_0x42b3f1[_0xa154('0x41')],_0x20a8a5[_0xa154('0x4b')]));if(_0x42b3f1[_0xa154('0x41')][_0xa154('0x4d')]){_0x54247f['where']=_[_0xa154('0x4e')](_0x54247f[_0xa154('0x4a')],{'$or':_[_0xa154('0x3c')](_0x54247f[_0xa154('0x43')],function(_0x1c895d){var _0x58a422={};_0x58a422[_0x1c895d]={'$like':'%'+_0x42b3f1[_0xa154('0x41')][_0xa154('0x4d')]+'%'};return _0x58a422;})});}_0x54247f=_[_0xa154('0x4e')]({},_0x54247f,_0x42b3f1['options']);return _0x586dde['getTeams'](_0x54247f);}})[_0xa154('0x1d')](function(_0x50771c){if(_0x50771c){_0x2e41c5=_0x50771c['length'];if(!_0x42b3f1['query'][_0xa154('0x46')]('nolimit')){_0x54247f['limit']=qs['limit'](_0x42b3f1[_0xa154('0x41')][_0xa154('0x2e')]);_0x54247f[_0xa154('0x2c')]=qs['offset'](_0x42b3f1['query'][_0xa154('0x2c')]);}return _0x586dde[_0xa154('0x71')](_0x54247f);}})['then'](function(_0x494479){if(_0x494479){return _0x494479?{'count':_0x2e41c5,'rows':_0x494479}:null;}})[_0xa154('0x1d')](respondWithResult(_0x59f00e,null))[_0xa154('0x27')](handleError(_0x59f00e,null));};exports[_0xa154('0x74')]=function(_0x554665,_0x24a9fc,_0x4f1501){var _0x15fa22=_0x554665[_0xa154('0x5b')]['ids'];return db[_0xa154('0x73')]['findAll']({'where':{'id':_0x15fa22},'attributes':['id'],'include':[{'model':db[_0xa154('0x75')],'as':_0xa154('0x76'),'attributes':['id','name',_0xa154('0x77'),_0xa154('0x78'),'interface'],'raw':!![]}]})[_0xa154('0x1d')](function(_0x445228){if(_0x445228){var _0x28ca2a=_[_0xa154('0x79')](_0x445228,function(_0x2ecca8){var _0x45b292=_0x2ecca8['get']({'plain':!![]});return _0x45b292['Agents'];});return db[_0xa154('0x3d')]['find']({'where':{'id':_0x554665[_0xa154('0x56')]['id']}})['then'](function(_0x120ddb){return db[_0xa154('0x7a')][_0xa154('0x7b')](function(_0xf82f66){return _0x120ddb[_0xa154('0x74')](_0x15fa22,{'transaction':_0xf82f66})[_0xa154('0x1d')](function(){return BPromise['each'](_0x28ca2a,function(_0xca4d2c){return db[_0xa154('0x66')][_0xa154('0x7c')]({'where':{'UserId':_0xca4d2c['id'],'ChatQueueId':_0x554665[_0xa154('0x56')]['id']},'transaction':_0xf82f66});});})[_0xa154('0x1d')](function(){_0x28ca2a[_0xa154('0x7d')](function(_0x567978){socket[_0xa154('0x7e')](_0xa154('0x7f'),{'UserId':_0x567978['id'],'ChatQueueId':_0x120ddb['id']});});});});});}})[_0xa154('0x1d')](respondWithStatusCode(_0x24a9fc,null))[_0xa154('0x27')](handleError(_0x24a9fc,null));};exports[_0xa154('0x80')]=function(_0x412fb0,_0x2b4848,_0x566dcb){return db[_0xa154('0x73')][_0xa154('0x53')]({'where':{'id':_0x412fb0[_0xa154('0x41')][_0xa154('0x81')]},'attributes':['id'],'include':[{'model':db[_0xa154('0x75')],'as':_0xa154('0x76'),'attributes':['id'],'raw':!![]}]})[_0xa154('0x1d')](handleEntityNotFound(_0x2b4848,null))[_0xa154('0x1d')](function(_0x17fc8a){var _0x48313b=_[_0xa154('0x3c')](_0x17fc8a,'id');var _0x498252=[];var _0x50247b=[];var _0x117c3b=squel[_0xa154('0x82')]();_0x117c3b['field'](_0xa154('0x83'))[_0xa154('0x84')](_0xa154('0x85'),'tq')[_0xa154('0x86')](_0xa154('0x87'),'ut',_0xa154('0x88'))[_0xa154('0x4a')](_0xa154('0x89'),_0x412fb0[_0xa154('0x56')]['id']);for(var _0x19b69e=0x0;_0x19b69e<_0x17fc8a[_0xa154('0x45')];_0x19b69e+=0x1){let _0x4cf4e3=_0x17fc8a[_0x19b69e];for(var _0x43f20c=0x0;_0x43f20c<_0x4cf4e3[_0xa154('0x76')]['length'];_0x43f20c+=0x1){let _0x1cfa75=_0x4cf4e3[_0xa154('0x76')][_0x43f20c];var _0xff592=_0x117c3b[_0xa154('0x8a')]();_0xff592['where'](_0xa154('0x8b'),_0x1cfa75['id']);_0x50247b[_0xa154('0x8c')](db['sequelize'][_0xa154('0x41')](_0xff592[_0xa154('0x8d')](),{'type':db[_0xa154('0x7a')][_0xa154('0x8e')][_0xa154('0x8f')]})[_0xa154('0x1d')](function(_0x360d64){if(_0x360d64[_0xa154('0x45')]===0x1){return _0x1cfa75['id'];}else{var _0x495a4d=_[_0xa154('0x90')](_['map'](_0x360d64,_0xa154('0x91')),function(_0xde1934){return _[_0xa154('0x92')](_0x48313b,_0xde1934);});if(_0x495a4d){return _0x1cfa75['id'];}}}));}}return BPromise['all'](_0x50247b)[_0xa154('0x1d')](function(_0x248bea){_0x498252=_(_0x498252)[_0xa154('0x93')](_0x248bea)[_0xa154('0x94')]()[_0xa154('0x95')]();return db[_0xa154('0x3d')][_0xa154('0x60')]({'where':{'id':_0x412fb0['params']['id']}})[_0xa154('0x1d')](function(_0x3e6e53){return db[_0xa154('0x7a')][_0xa154('0x7b')](function(_0x45edf1){return _0x3e6e53[_0xa154('0x80')](_0x412fb0[_0xa154('0x41')][_0xa154('0x81')],{'transaction':_0x45edf1})['then'](function(){if(!_['isEmpty'](_0x498252)){return _0x3e6e53[_0xa154('0x96')](_0x498252,{'transaction':_0x45edf1});}})[_0xa154('0x1d')](function(){_0x498252[_0xa154('0x7d')](function(_0x1d210b){socket['emit'](_0xa154('0x97'),{'UserId':_0x1d210b,'ChatQueueId':_0x3e6e53['id']});});});});});});})['then'](respondWithStatusCode(_0x2b4848,null))[_0xa154('0x27')](handleError(_0x2b4848,null));};exports[_0xa154('0x98')]=function(_0x15e77c,_0x5e5ce8,_0x533a0c){return db['ChatQueue'][_0xa154('0x60')]({'where':{'id':_0x15e77c['params']['id']}})[_0xa154('0x1d')](handleEntityNotFound(_0x5e5ce8,null))[_0xa154('0x1d')](function(_0x566603){if(_0x566603){return _0x566603['addAgents'](_0x15e77c['body']['ids'],_[_0xa154('0x99')](_0x15e77c['body'],[_0xa154('0x81'),'id'])||{})['spread'](function(_0x5117e7){for(var _0x4dfdad=0x0;_0x4dfdad<_0x15e77c[_0xa154('0x5b')]['ids'][_0xa154('0x45')];_0x4dfdad+=0x1){socket[_0xa154('0x7e')](_0xa154('0x7f'),{'UserId':Number(_0x15e77c[_0xa154('0x5b')][_0xa154('0x81')][_0x4dfdad]),'ChatQueueId':Number(_0x15e77c[_0xa154('0x56')]['id'])});}return _0x5117e7;});}})[_0xa154('0x1d')](respondWithResult(_0x5e5ce8,null))[_0xa154('0x27')](handleError(_0x5e5ce8,null));};exports[_0xa154('0x96')]=function(_0x5ee5a1,_0x199728,_0x107679){return db['ChatQueue'][_0xa154('0x60')]({'where':{'id':_0x5ee5a1[_0xa154('0x56')]['id']}})[_0xa154('0x1d')](handleEntityNotFound(_0x199728,null))[_0xa154('0x1d')](function(_0x22e5e7){if(_0x22e5e7){return _0x22e5e7[_0xa154('0x96')](_0x5ee5a1['query']['ids'])[_0xa154('0x1d')](function(){if(_[_0xa154('0x9a')](_0x5ee5a1['query'][_0xa154('0x81')])){for(var _0x382be4=0x0;_0x382be4<_0x5ee5a1['query'][_0xa154('0x81')]['length'];_0x382be4+=0x1){socket[_0xa154('0x7e')](_0xa154('0x97'),{'UserId':Number(_0x5ee5a1['query'][_0xa154('0x81')][_0x382be4]),'ChatQueueId':Number(_0x5ee5a1['params']['id'])});}}else{socket[_0xa154('0x7e')](_0xa154('0x97'),{'UserId':Number(_0x5ee5a1[_0xa154('0x41')][_0xa154('0x81')]),'ChatQueueId':Number(_0x5ee5a1[_0xa154('0x56')]['id'])});}});}})[_0xa154('0x1d')](respondWithStatusCode(_0x199728,null))[_0xa154('0x27')](handleError(_0x199728,null));};exports['getAgents']=function(_0x89b67,_0x4c42a8,_0x252f2c){var _0x48ed47={};var _0x3ead19={};var _0x543eb;var _0x5329c0;return db[_0xa154('0x3d')][_0xa154('0x72')]({'where':{'id':_0x89b67[_0xa154('0x56')]['id']}})[_0xa154('0x1d')](handleEntityNotFound(_0x4c42a8,null))[_0xa154('0x1d')](function(_0x4ceee2){if(_0x4ceee2){_0x543eb=_0x4ceee2;_0x3ead19[_0xa154('0x40')]=_[_0xa154('0x42')](db[_0xa154('0x75')][_0xa154('0x57')]);_0x3ead19[_0xa154('0x41')]=_[_0xa154('0x42')](_0x89b67[_0xa154('0x41')]);_0x3ead19[_0xa154('0x4b')]=_['intersection'](_0x3ead19[_0xa154('0x40')],_0x3ead19[_0xa154('0x41')]);_0x48ed47['attributes']=_[_0xa154('0x58')](_0x3ead19['model'],qs[_0xa154('0x44')](_0x89b67['query'][_0xa154('0x44')]));_0x48ed47[_0xa154('0x43')]=_0x48ed47['attributes']['length']?_0x48ed47['attributes']:_0x3ead19[_0xa154('0x40')];_0x48ed47[_0xa154('0x48')]=qs[_0xa154('0x49')](_0x89b67[_0xa154('0x41')]['sort']);_0x48ed47[_0xa154('0x4a')]=qs[_0xa154('0x4b')](_[_0xa154('0x4c')](_0x89b67[_0xa154('0x41')],_0x3ead19['filters']));if(_0x89b67[_0xa154('0x41')]['filter']){_0x48ed47[_0xa154('0x4a')]=_[_0xa154('0x4e')](_0x48ed47[_0xa154('0x4a')],{'$or':_[_0xa154('0x3c')](_0x48ed47[_0xa154('0x43')],function(_0x2a8e79){var _0x2d36fb={};_0x2d36fb[_0x2a8e79]={'$like':'%'+_0x89b67['query']['filter']+'%'};return _0x2d36fb;})});}_0x48ed47=_[_0xa154('0x4e')]({},_0x48ed47,_0x89b67[_0xa154('0x51')]);return _0x543eb[_0xa154('0x9b')](_0x48ed47);}})[_0xa154('0x1d')](function(_0x57216a){if(_0x57216a){_0x5329c0=_0x57216a['length'];if(!_0x89b67[_0xa154('0x41')][_0xa154('0x46')](_0xa154('0x47'))){_0x48ed47[_0xa154('0x2e')]=qs[_0xa154('0x2e')](_0x89b67[_0xa154('0x41')][_0xa154('0x2e')]);_0x48ed47['offset']=qs['offset'](_0x89b67[_0xa154('0x41')][_0xa154('0x2c')]);}return _0x543eb[_0xa154('0x9b')](_0x48ed47);}})['then'](function(_0x31f348){if(_0x31f348){return _0x31f348?{'count':_0x5329c0,'rows':_0x31f348}:null;}})[_0xa154('0x1d')](respondWithResult(_0x4c42a8,null))[_0xa154('0x27')](handleError(_0x4c42a8,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 890f6c4..19e099d 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 _0x0dec=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners'];(function(_0x1becfa,_0x1ae0dd){var _0x171363=function(_0x25813f){while(--_0x25813f){_0x1becfa['push'](_0x1becfa['shift']());}};_0x171363(++_0x1ae0dd);}(_0x0dec,0x11c));var _0xc0de=function(_0xb775a,_0x3fc4c0){_0xb775a=_0xb775a-0x0;var _0x117be0=_0x0dec[_0xb775a];return _0x117be0;};'use strict';var EventEmitter=require(_0xc0de('0x0'));var ChatQueue=require(_0xc0de('0x1'))['db'][_0xc0de('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xc0de('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc0de('0x4'),'afterDestroy':'remove'};function emitEvent(_0x54fc4d){return function(_0x24091c,_0x1a263e,_0x9ae6b){ChatQueueEvents[_0xc0de('0x5')](_0x54fc4d+':'+_0x24091c['id'],_0x24091c);ChatQueueEvents[_0xc0de('0x5')](_0x54fc4d,_0x24091c);_0x9ae6b(null);};}for(var e in events){if(events[_0xc0de('0x6')](e)){var event=events[e];ChatQueue[_0xc0de('0x7')](e,emitEvent(event));}}module[_0xc0de('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x3b0d=['hasOwnProperty','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x1d56fb,_0x4ae684){var _0x371057=function(_0x48b240){while(--_0x48b240){_0x1d56fb['push'](_0x1d56fb['shift']());}};_0x371057(++_0x4ae684);}(_0x3b0d,0x1db));var _0xd3b0=function(_0x37a41a,_0x5190b4){_0x37a41a=_0x37a41a-0x0;var _0x269792=_0x3b0d[_0x37a41a];return _0x269792;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xd3b0('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd3b0('0x1')](0x0);var events={'afterCreate':_0xd3b0('0x2'),'afterUpdate':'update','afterDestroy':_0xd3b0('0x3')};function emitEvent(_0x4af7b8){return function(_0x6ca1da,_0x3d07ea,_0x2a78d4){ChatQueueEvents[_0xd3b0('0x4')](_0x4af7b8+':'+_0x6ca1da['id'],_0x6ca1da);ChatQueueEvents[_0xd3b0('0x4')](_0x4af7b8,_0x6ca1da);_0x2a78d4(null);};}for(var e in events){if(events[_0xd3b0('0x5')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 8b694cb..1ece0f5 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 _0xaf60=['bluebird','request-promise','path','rimraf','../../config/environment','define','ChatQueue','chat_queues','lodash','util','api','moment'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xaf60,0x104));var _0x0af6=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xaf60[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0af6('0x0'));var util=require(_0x0af6('0x1'));var logger=require('../../config/logger')(_0x0af6('0x2'));var moment=require(_0x0af6('0x3'));var BPromise=require(_0x0af6('0x4'));var rp=require(_0x0af6('0x5'));var fs=require('fs');var path=require(_0x0af6('0x6'));var rimraf=require(_0x0af6('0x7'));var config=require(_0x0af6('0x8'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x493b56,_0xa9f08b){return _0x493b56[_0x0af6('0x9')](_0x0af6('0xa'),attributes,{'tableName':_0x0af6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbc4=['ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','path','../../config/environment','./chatQueue.attributes','exports'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xbbc4,0x65));var _0x4bbc=function(_0x377176,_0x1b885f){_0x377176=_0x377176-0x0;var _0x48f344=_0xbbc4[_0x377176];return _0x48f344;};'use strict';var _=require(_0x4bbc('0x0'));var util=require(_0x4bbc('0x1'));var logger=require(_0x4bbc('0x2'))(_0x4bbc('0x3'));var moment=require(_0x4bbc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bbc('0x5'));var rimraf=require('rimraf');var config=require(_0x4bbc('0x6'));var attributes=require(_0x4bbc('0x7'));module[_0x4bbc('0x8')]=function(_0x34c846,_0x5afe9a){return _0x34c846['define'](_0x4bbc('0x9'),attributes,{'tableName':_0x4bbc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index ad2b758..7301db2 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 _0xcdf0=['code','message','ChatQueue,\x20%s,\x20%s','GetChatQueue','ChatQueue','options','raw','where','attributes','limit','include','model','map','catch','find','ShowChatQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x5b04ac,_0x14b9b5){var _0x106281=function(_0x29c3c7){while(--_0x29c3c7){_0x5b04ac['push'](_0x5b04ac['shift']());}};_0x106281(++_0x14b9b5);}(_0xcdf0,0xa8));var _0x0cdf=function(_0x139039,_0x510018){_0x139039=_0x139039-0x0;var _0x5c0a41=_0xcdf0[_0x139039];return _0x5c0a41;};'use strict';var _=require(_0x0cdf('0x0'));var util=require(_0x0cdf('0x1'));var moment=require(_0x0cdf('0x2'));var BPromise=require(_0x0cdf('0x3'));var rs=require(_0x0cdf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cdf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cdf('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0cdf('0x7'));var client=jayson[_0x0cdf('0x8')][_0x0cdf('0x9')]({'port':0x232a});config[_0x0cdf('0xa')]=_[_0x0cdf('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0cdf('0xc'))(new Redis(config['redis']));require(_0x0cdf('0xd'))[_0x0cdf('0xe')](socket);function respondWithRpcPromise(_0x563bcf,_0x408dd2,_0xcee711){return new BPromise(function(_0x175199,_0x50a91e){return client[_0x0cdf('0xf')](_0x563bcf,_0xcee711)[_0x0cdf('0x10')](function(_0x35c189){logger[_0x0cdf('0x11')]('ChatQueue,\x20%s,\x20%s',_0x408dd2,_0x0cdf('0x12'));logger[_0x0cdf('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x408dd2,_0x0cdf('0x12'),JSON[_0x0cdf('0x14')](_0x35c189));if(_0x35c189[_0x0cdf('0x15')]){if(_0x35c189[_0x0cdf('0x15')][_0x0cdf('0x16')]===0x1f4){logger[_0x0cdf('0x15')]('ChatQueue,\x20%s,\x20%s',_0x408dd2,_0x35c189[_0x0cdf('0x15')][_0x0cdf('0x17')]);return _0x50a91e(_0x35c189['error'][_0x0cdf('0x17')]);}logger[_0x0cdf('0x15')](_0x0cdf('0x18'),_0x408dd2,_0x35c189[_0x0cdf('0x15')]['message']);return _0x175199(_0x35c189['error'][_0x0cdf('0x17')]);}else{logger['info'](_0x0cdf('0x18'),_0x408dd2,_0x0cdf('0x12'));_0x175199(_0x35c189['result']['message']);}})['catch'](function(_0x5c40d5){logger[_0x0cdf('0x15')]('ChatQueue,\x20%s,\x20%s',_0x408dd2,_0x5c40d5);_0x50a91e(_0x5c40d5);});});}exports[_0x0cdf('0x19')]=function(_0x43ed8d){var _0x240016=this;return new Promise(function(_0x689b64,_0x44613c){return db[_0x0cdf('0x1a')]['findAll']({'raw':_0x43ed8d[_0x0cdf('0x1b')]?_0x43ed8d[_0x0cdf('0x1b')][_0x0cdf('0x1c')]===undefined?!![]:![]:!![],'where':_0x43ed8d[_0x0cdf('0x1b')]?_0x43ed8d[_0x0cdf('0x1b')][_0x0cdf('0x1d')]||null:null,'attributes':_0x43ed8d['options']?_0x43ed8d['options'][_0x0cdf('0x1e')]||null:null,'limit':_0x43ed8d[_0x0cdf('0x1b')]?_0x43ed8d[_0x0cdf('0x1b')][_0x0cdf('0x1f')]||null:null,'include':_0x43ed8d[_0x0cdf('0x1b')]?_0x43ed8d['options'][_0x0cdf('0x20')]?_['map'](_0x43ed8d[_0x0cdf('0x1b')][_0x0cdf('0x20')],function(_0xe8005f){return{'model':db[_0xe8005f[_0x0cdf('0x21')]],'as':_0xe8005f['as'],'attributes':_0xe8005f[_0x0cdf('0x1e')],'include':_0xe8005f[_0x0cdf('0x20')]?_[_0x0cdf('0x22')](_0xe8005f[_0x0cdf('0x20')],function(_0xfe3418){return{'model':db[_0xfe3418[_0x0cdf('0x21')]],'as':_0xfe3418['as'],'attributes':_0xfe3418['attributes'],'include':_0xfe3418[_0x0cdf('0x20')]?_[_0x0cdf('0x22')](_0xfe3418[_0x0cdf('0x20')],function(_0x54fd1c){return{'model':db[_0x54fd1c['model']],'as':_0x54fd1c['as'],'attributes':_0x54fd1c[_0x0cdf('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1560ae){logger['info'](_0x0cdf('0x19'),_0x43ed8d);logger[_0x0cdf('0x13')](_0x0cdf('0x19'),_0x43ed8d,JSON[_0x0cdf('0x14')](_0x1560ae));_0x689b64(_0x1560ae);})[_0x0cdf('0x23')](function(_0x498fce){logger[_0x0cdf('0x15')]('GetChatQueue',_0x498fce['message'],_0x43ed8d);_0x44613c(_0x240016[_0x0cdf('0x15')](0x1f4,_0x498fce[_0x0cdf('0x17')]));});});};exports['ShowChatQueue']=function(_0x1413cc){var _0x45c3de=this;return new Promise(function(_0x49fdd2,_0x4c8880){return db['ChatQueue'][_0x0cdf('0x24')]({'raw':_0x1413cc[_0x0cdf('0x1b')]?_0x1413cc[_0x0cdf('0x1b')][_0x0cdf('0x1c')]===undefined?!![]:![]:!![],'where':_0x1413cc['options']?_0x1413cc[_0x0cdf('0x1b')]['where']||null:null,'attributes':_0x1413cc[_0x0cdf('0x1b')]?_0x1413cc[_0x0cdf('0x1b')][_0x0cdf('0x1e')]||null:null,'include':_0x1413cc[_0x0cdf('0x1b')]?_0x1413cc['options'][_0x0cdf('0x20')]?_[_0x0cdf('0x22')](_0x1413cc['options'][_0x0cdf('0x20')],function(_0x574c61){return{'model':db[_0x574c61[_0x0cdf('0x21')]],'as':_0x574c61['as'],'attributes':_0x574c61[_0x0cdf('0x1e')],'include':_0x574c61[_0x0cdf('0x20')]?_[_0x0cdf('0x22')](_0x574c61[_0x0cdf('0x20')],function(_0x2ed8a7){return{'model':db[_0x2ed8a7[_0x0cdf('0x21')]],'as':_0x2ed8a7['as'],'attributes':_0x2ed8a7[_0x0cdf('0x1e')],'include':_0x2ed8a7[_0x0cdf('0x20')]?_[_0x0cdf('0x22')](_0x2ed8a7[_0x0cdf('0x20')],function(_0xcdf2f7){return{'model':db[_0xcdf2f7[_0x0cdf('0x21')]],'as':_0xcdf2f7['as'],'attributes':_0xcdf2f7['attributes']};}):[]};}):[]};}):[]:[]})[_0x0cdf('0x10')](function(_0x3baaa6){logger[_0x0cdf('0x11')](_0x0cdf('0x25'),_0x1413cc);logger['debug'](_0x0cdf('0x25'),_0x1413cc,JSON[_0x0cdf('0x14')](_0x3baaa6));_0x49fdd2(_0x3baaa6);})[_0x0cdf('0x23')](function(_0x93a288){logger['error']('ShowChatQueue',_0x93a288['message'],_0x1413cc);_0x4c8880(_0x45c3de[_0x0cdf('0x15')](0x1f4,_0x93a288[_0x0cdf('0x17')]));});});}; \ No newline at end of file +var _0xc16f=['ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','options','raw','attributes','include','map','model','then','ShowChatQueue','ChatQueue','find','where','lodash','util','bluebird','randomstring'];(function(_0x52a121,_0x22c41c){var _0x52835c=function(_0xbd8f0e){while(--_0xbd8f0e){_0x52a121['push'](_0x52a121['shift']());}};_0x52835c(++_0x22c41c);}(_0xc16f,0xe6));var _0xfc16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc16f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfc16('0x0'));var util=require(_0xfc16('0x1'));var moment=require('moment');var BPromise=require(_0xfc16('0x2'));var rs=require(_0xfc16('0x3'));var fs=require('fs');var Redis=require(_0xfc16('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfc16('0x5'))('rpc');var config=require(_0xfc16('0x6'));var jayson=require(_0xfc16('0x7'));var client=jayson[_0xfc16('0x8')][_0xfc16('0x9')]({'port':0x232a});config[_0xfc16('0xa')]=_[_0xfc16('0xb')](config[_0xfc16('0xa')],{'host':_0xfc16('0xc'),'port':0x18eb});var socket=require(_0xfc16('0xd'))(new Redis(config[_0xfc16('0xa')]));require(_0xfc16('0xe'))['register'](socket);function respondWithRpcPromise(_0x49ff5c,_0x31223b,_0x550b75){return new BPromise(function(_0x496f1f,_0x41d23f){return client[_0xfc16('0xf')](_0x49ff5c,_0x550b75)['then'](function(_0x4ec77a){logger[_0xfc16('0x10')](_0xfc16('0x11'),_0x31223b,_0xfc16('0x12'));logger[_0xfc16('0x13')](_0xfc16('0x14'),_0x31223b,_0xfc16('0x12'),JSON[_0xfc16('0x15')](_0x4ec77a));if(_0x4ec77a[_0xfc16('0x16')]){if(_0x4ec77a['error'][_0xfc16('0x17')]===0x1f4){logger[_0xfc16('0x16')](_0xfc16('0x11'),_0x31223b,_0x4ec77a[_0xfc16('0x16')][_0xfc16('0x18')]);return _0x41d23f(_0x4ec77a[_0xfc16('0x16')][_0xfc16('0x18')]);}logger[_0xfc16('0x16')](_0xfc16('0x11'),_0x31223b,_0x4ec77a['error']['message']);return _0x496f1f(_0x4ec77a['error']['message']);}else{logger['info'](_0xfc16('0x11'),_0x31223b,'request\x20sent');_0x496f1f(_0x4ec77a[_0xfc16('0x19')][_0xfc16('0x18')]);}})[_0xfc16('0x1a')](function(_0x8327f8){logger[_0xfc16('0x16')](_0xfc16('0x11'),_0x31223b,_0x8327f8);_0x41d23f(_0x8327f8);});});}exports[_0xfc16('0x1b')]=function(_0x4df326){var _0x5118f0=this;return new Promise(function(_0x4cf424,_0x53a050){return db['ChatQueue']['findAll']({'raw':_0x4df326[_0xfc16('0x1c')]?_0x4df326[_0xfc16('0x1c')][_0xfc16('0x1d')]===undefined?!![]:![]:!![],'where':_0x4df326[_0xfc16('0x1c')]?_0x4df326['options']['where']||null:null,'attributes':_0x4df326[_0xfc16('0x1c')]?_0x4df326[_0xfc16('0x1c')][_0xfc16('0x1e')]||null:null,'limit':_0x4df326['options']?_0x4df326[_0xfc16('0x1c')]['limit']||null:null,'include':_0x4df326[_0xfc16('0x1c')]?_0x4df326[_0xfc16('0x1c')][_0xfc16('0x1f')]?_[_0xfc16('0x20')](_0x4df326['options'][_0xfc16('0x1f')],function(_0x4b15a0){return{'model':db[_0x4b15a0[_0xfc16('0x21')]],'as':_0x4b15a0['as'],'attributes':_0x4b15a0[_0xfc16('0x1e')],'include':_0x4b15a0['include']?_[_0xfc16('0x20')](_0x4b15a0[_0xfc16('0x1f')],function(_0x45291e){return{'model':db[_0x45291e[_0xfc16('0x21')]],'as':_0x45291e['as'],'attributes':_0x45291e[_0xfc16('0x1e')],'include':_0x45291e[_0xfc16('0x1f')]?_['map'](_0x45291e['include'],function(_0x148e17){return{'model':db[_0x148e17[_0xfc16('0x21')]],'as':_0x148e17['as'],'attributes':_0x148e17['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc16('0x22')](function(_0x138bdc){logger[_0xfc16('0x10')]('GetChatQueue',_0x4df326);logger[_0xfc16('0x13')](_0xfc16('0x1b'),_0x4df326,JSON[_0xfc16('0x15')](_0x138bdc));_0x4cf424(_0x138bdc);})[_0xfc16('0x1a')](function(_0x1d54bc){logger[_0xfc16('0x16')](_0xfc16('0x1b'),_0x1d54bc[_0xfc16('0x18')],_0x4df326);_0x53a050(_0x5118f0[_0xfc16('0x16')](0x1f4,_0x1d54bc['message']));});});};exports[_0xfc16('0x23')]=function(_0x4a8d85){var _0x5914e8=this;return new Promise(function(_0x395635,_0x54d962){return db[_0xfc16('0x24')][_0xfc16('0x25')]({'raw':_0x4a8d85[_0xfc16('0x1c')]?_0x4a8d85[_0xfc16('0x1c')][_0xfc16('0x1d')]===undefined?!![]:![]:!![],'where':_0x4a8d85['options']?_0x4a8d85[_0xfc16('0x1c')][_0xfc16('0x26')]||null:null,'attributes':_0x4a8d85['options']?_0x4a8d85[_0xfc16('0x1c')]['attributes']||null:null,'include':_0x4a8d85[_0xfc16('0x1c')]?_0x4a8d85['options'][_0xfc16('0x1f')]?_[_0xfc16('0x20')](_0x4a8d85[_0xfc16('0x1c')][_0xfc16('0x1f')],function(_0xcc2c22){return{'model':db[_0xcc2c22[_0xfc16('0x21')]],'as':_0xcc2c22['as'],'attributes':_0xcc2c22[_0xfc16('0x1e')],'include':_0xcc2c22['include']?_[_0xfc16('0x20')](_0xcc2c22[_0xfc16('0x1f')],function(_0x26385b){return{'model':db[_0x26385b['model']],'as':_0x26385b['as'],'attributes':_0x26385b[_0xfc16('0x1e')],'include':_0x26385b['include']?_[_0xfc16('0x20')](_0x26385b[_0xfc16('0x1f')],function(_0x5df64a){return{'model':db[_0x5df64a[_0xfc16('0x21')]],'as':_0x5df64a['as'],'attributes':_0x5df64a[_0xfc16('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfc16('0x22')](function(_0x2d5ddb){logger[_0xfc16('0x10')](_0xfc16('0x23'),_0x4a8d85);logger[_0xfc16('0x13')]('ShowChatQueue',_0x4a8d85,JSON[_0xfc16('0x15')](_0x2d5ddb));_0x395635(_0x2d5ddb);})[_0xfc16('0x1a')](function(_0xd78564){logger[_0xfc16('0x16')](_0xfc16('0x23'),_0xd78564['message'],_0x4a8d85);_0x54d962(_0x5914e8[_0xfc16('0x16')](0x1f4,_0xd78564[_0xfc16('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 2058e30..b4d9a9a 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 _0x0bde=['save','update','emit','removeListener','register','length','chatQueue:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bde,0xe7));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xe0bd('0x0'),'remove',_0xe0bd('0x1')];function createListener(_0x3dc984,_0x1d8922){return function(_0x1e198a){_0x1d8922[_0xe0bd('0x2')](_0x3dc984,_0x1e198a);};}function removeListener(_0x5541b9,_0x34df88){return function(){ChatQueueEvents[_0xe0bd('0x3')](_0x5541b9,_0x34df88);};}exports[_0xe0bd('0x4')]=function(_0x3b712a){for(var _0x22bfd1=0x0,_0x26393f=events[_0xe0bd('0x5')];_0x22bfd1<_0x26393f;_0x22bfd1++){var _0x491dc7=events[_0x22bfd1];var _0x40b36a=createListener(_0xe0bd('0x6')+_0x491dc7,_0x3b712a);ChatQueueEvents['on'](_0x491dc7,_0x40b36a);}}; \ No newline at end of file +var _0x6737=['chatQueue:','save','remove','emit','removeListener'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6737,0xe2));var _0x7673=function(_0x168c14,_0x2d9ef8){_0x168c14=_0x168c14-0x0;var _0x1971d2=_0x6737[_0x168c14];return _0x1971d2;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x7673('0x0'),_0x7673('0x1'),'update'];function createListener(_0x2f05d4,_0x2a9cd0){return function(_0x43ee27){_0x2a9cd0[_0x7673('0x2')](_0x2f05d4,_0x43ee27);};}function removeListener(_0x54002e,_0x32e6f2){return function(){ChatQueueEvents[_0x7673('0x3')](_0x54002e,_0x32e6f2);};}exports['register']=function(_0x2f5edc){for(var _0x15230f=0x0,_0x5af802=events['length'];_0x15230f<_0x5af802;_0x15230f++){var _0x53d67d=events[_0x15230f];var _0x5292f7=createListener(_0x7673('0x4')+_0x53d67d,_0x2f5edc);ChatQueueEvents['on'](_0x53d67d,_0x5292f7);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index c14f999..44ceaf8 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x3da767,_0x3fa5d5){var _0x4e6656=function(_0x23e313){while(--_0x23e313){_0x3da767['push'](_0x3da767['shift']());}};_0x4e6656(++_0x3fa5d5);}(_0xe14b,0x93));var _0xbe14=function(_0x1c8fa5,_0x1e40b6){_0x1c8fa5=_0x1c8fa5-0x0;var _0x556021=_0xe14b[_0x1c8fa5];return _0x556021;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x210b7a,_0x28743e){var _0x275540=function(_0x41fac9){while(--_0x41fac9){_0x210b7a['push'](_0x210b7a['shift']());}};_0x275540(++_0x28743e);}(_0xe14b,0x93));var _0xbe14=function(_0xcb7f03,_0x32a5fb){_0xcb7f03=_0xcb7f03-0x0;var _0x3d81b3=_0xe14b[_0xcb7f03];return _0x3d81b3;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index f2aefe6..dc44312 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 _0xb401=['moment','STRING','DATE'];(function(_0x33834e,_0x4ff743){var _0xcdeaf4=function(_0x1eeeb4){while(--_0x1eeeb4){_0x33834e['push'](_0x33834e['shift']());}};_0xcdeaf4(++_0x4ff743);}(_0xb401,0x1e0));var _0x1b40=function(_0x26393f,_0x19f926){_0x26393f=_0x26393f-0x0;var _0x965b07=_0xb401[_0x26393f];return _0x965b07;};'use strict';var moment=require(_0x1b40('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1b40('0x1')]},'joinAt':{'type':Sequelize[_0x1b40('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1b40('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x1b40('0x1')]}}; \ No newline at end of file +var _0x3f60=['sequelize','exports','STRING','DATE'];(function(_0x188424,_0x170940){var _0x120cb3=function(_0x43a13d){while(--_0x43a13d){_0x188424['push'](_0x188424['shift']());}};_0x120cb3(++_0x170940);}(_0x3f60,0xc4));var _0x03f6=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0x3f60[_0x28c939];return _0x527fe9;};'use strict';var moment=require('moment');var Sequelize=require(_0x03f6('0x0'));module[_0x03f6('0x1')]={'uniqueid':{'type':Sequelize[_0x03f6('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x03f6('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x03f6('0x3')]},'acceptAt':{'type':Sequelize[_0x03f6('0x3')]},'exitAt':{'type':Sequelize[_0x03f6('0x3')]},'reason':{'type':Sequelize[_0x03f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index c888ead..313429e 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 _0xdc86=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','name','send','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x438f8d,_0x2d7e05){var _0x245c9b=function(_0xdc9086){while(--_0xdc9086){_0x438f8d['push'](_0x438f8d['shift']());}};_0x245c9b(++_0x2d7e05);}(_0xdc86,0x118));var _0x6dc8=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xdc86[_0x25d386];return _0x857f4a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6dc8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6dc8('0x1'));var rp=require('request-promise');var moment=require(_0x6dc8('0x2'));var BPromise=require(_0x6dc8('0x3'));var Mustache=require(_0x6dc8('0x4'));var util=require(_0x6dc8('0x5'));var path=require(_0x6dc8('0x6'));var sox=require('sox');var csv=require(_0x6dc8('0x7'));var ejs=require(_0x6dc8('0x8'));var fs=require('fs');var fs_extra=require(_0x6dc8('0x9'));var _=require(_0x6dc8('0xa'));var squel=require(_0x6dc8('0xb'));var crypto=require(_0x6dc8('0xc'));var jsforce=require(_0x6dc8('0xd'));var deskjs=require(_0x6dc8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6dc8('0xf'));var Papa=require('papaparse');var Redis=require(_0x6dc8('0x10'));var authService=require(_0x6dc8('0x11'));var qs=require(_0x6dc8('0x12'));var as=require(_0x6dc8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6dc8('0x14'))(_0x6dc8('0x15'));var utils=require(_0x6dc8('0x16'));var config=require(_0x6dc8('0x17'));var licenseUtil=require(_0x6dc8('0x18'));var db=require(_0x6dc8('0x19'))['db'];function respondWithStatusCode(_0x49e474,_0x36e427){_0x36e427=_0x36e427||0xcc;return function(_0x542c8b){if(_0x542c8b){return _0x49e474['sendStatus'](_0x36e427);}return _0x49e474[_0x6dc8('0x1a')](_0x36e427)[_0x6dc8('0x1b')]();};}function respondWithResult(_0x21be3d,_0x58c295){_0x58c295=_0x58c295||0xc8;return function(_0x23acc6){if(_0x23acc6){return _0x21be3d[_0x6dc8('0x1a')](_0x58c295)[_0x6dc8('0x1c')](_0x23acc6);}};}function respondWithFilteredResult(_0x45a2f7,_0x28158d){return function(_0x4782c8){if(_0x4782c8){var _0x351c11=typeof _0x28158d[_0x6dc8('0x1d')]===_0x6dc8('0x1e')&&typeof _0x28158d['limit']==='undefined';var _0x2702c5=_0x4782c8[_0x6dc8('0x1f')];var _0x209ae4=_0x351c11?0x0:_0x28158d[_0x6dc8('0x1d')];var _0x2f3b94=_0x351c11?_0x4782c8['count']:_0x28158d['offset']+_0x28158d['limit'];var _0x2247c4;if(_0x2f3b94>=_0x2702c5){_0x2f3b94=_0x2702c5;_0x2247c4=0xc8;}else{_0x2247c4=0xce;}_0x45a2f7['status'](_0x2247c4);return _0x45a2f7[_0x6dc8('0x20')]('Content-Range',_0x209ae4+'-'+_0x2f3b94+'/'+_0x2702c5)[_0x6dc8('0x1c')](_0x4782c8);}return null;};}function patchUpdates(_0x4467a1){return function(_0x3e161a){try{jsonpatch[_0x6dc8('0x21')](_0x3e161a,_0x4467a1,!![]);}catch(_0x1949be){return BPromise[_0x6dc8('0x22')](_0x1949be);}return _0x3e161a[_0x6dc8('0x23')]();};}function saveUpdates(_0x38ce80,_0x1436d1){return function(_0x5526cd){if(_0x5526cd){return _0x5526cd[_0x6dc8('0x24')](_0x38ce80)[_0x6dc8('0x25')](function(_0x30afb5){return _0x30afb5;});}return null;};}function removeEntity(_0x49b5a8,_0xf69b){return function(_0x5c78db){if(_0x5c78db){return _0x5c78db[_0x6dc8('0x26')]()[_0x6dc8('0x25')](function(){_0x49b5a8[_0x6dc8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56895f,_0x1983f8){return function(_0x14ec58){if(!_0x14ec58){_0x56895f['sendStatus'](0x194);}return _0x14ec58;};}function handleError(_0x4596db,_0x4636be){_0x4636be=_0x4636be||0x1f4;return function(_0x36b904){logger['error'](_0x36b904['stack']);if(_0x36b904[_0x6dc8('0x27')]){delete _0x36b904[_0x6dc8('0x27')];}_0x4596db['status'](_0x4636be)[_0x6dc8('0x28')](_0x36b904);};}exports['index']=function(_0x482cc6,_0x4e9f46){var _0x63da34={},_0x283a42={},_0x35e1fc={'count':0x0,'rows':[]};var _0x1fde66=_[_0x6dc8('0x29')](db[_0x6dc8('0x2a')][_0x6dc8('0x2b')],function(_0x437671){return{'name':_0x437671[_0x6dc8('0x2c')],'type':_0x437671[_0x6dc8('0x2d')]['key']};});_0x283a42[_0x6dc8('0x2e')]=_['map'](_0x1fde66,'name');_0x283a42[_0x6dc8('0x2f')]=_[_0x6dc8('0x30')](_0x482cc6[_0x6dc8('0x2f')]);_0x283a42[_0x6dc8('0x31')]=_['intersection'](_0x283a42[_0x6dc8('0x2e')],_0x283a42['query']);_0x63da34[_0x6dc8('0x32')]=_['intersection'](_0x283a42[_0x6dc8('0x2e')],qs[_0x6dc8('0x33')](_0x482cc6['query'][_0x6dc8('0x33')]));_0x63da34[_0x6dc8('0x32')]=_0x63da34['attributes'][_0x6dc8('0x34')]?_0x63da34[_0x6dc8('0x32')]:_0x283a42[_0x6dc8('0x2e')];if(!_0x482cc6[_0x6dc8('0x2f')][_0x6dc8('0x35')]('nolimit')){_0x63da34['limit']=qs[_0x6dc8('0x36')](_0x482cc6['query'][_0x6dc8('0x36')]);_0x63da34[_0x6dc8('0x1d')]=qs['offset'](_0x482cc6['query'][_0x6dc8('0x1d')]);}_0x63da34['order']=qs[_0x6dc8('0x37')](_0x482cc6[_0x6dc8('0x2f')][_0x6dc8('0x37')]);_0x63da34[_0x6dc8('0x38')]=qs[_0x6dc8('0x31')](_[_0x6dc8('0x39')](_0x482cc6[_0x6dc8('0x2f')],_0x283a42['filters']),_0x1fde66);if(_0x482cc6[_0x6dc8('0x2f')][_0x6dc8('0x3a')]){_0x63da34[_0x6dc8('0x38')]=_[_0x6dc8('0x3b')](_0x63da34[_0x6dc8('0x38')],{'$or':_[_0x6dc8('0x29')](_0x1fde66,function(_0x14822f){if(_0x14822f[_0x6dc8('0x2d')]!==_0x6dc8('0x3c')){var _0x5b5e67={};_0x5b5e67[_0x14822f['name']]={'$like':'%'+_0x482cc6[_0x6dc8('0x2f')][_0x6dc8('0x3a')]+'%'};return _0x5b5e67;}})});}_0x63da34=_['merge']({},_0x63da34,_0x482cc6[_0x6dc8('0x3d')]);var _0x2f4078={'where':_0x63da34[_0x6dc8('0x38')]};return db[_0x6dc8('0x2a')][_0x6dc8('0x1f')](_0x2f4078)[_0x6dc8('0x25')](function(_0x400070){_0x35e1fc[_0x6dc8('0x1f')]=_0x400070;if(_0x482cc6[_0x6dc8('0x2f')][_0x6dc8('0x3e')]){_0x63da34[_0x6dc8('0x3f')]=[{'all':!![]}];}return db[_0x6dc8('0x2a')][_0x6dc8('0x40')](_0x63da34);})[_0x6dc8('0x25')](function(_0xc46154){_0x35e1fc[_0x6dc8('0x41')]=_0xc46154;return _0x35e1fc;})[_0x6dc8('0x25')](respondWithFilteredResult(_0x4e9f46,_0x63da34))[_0x6dc8('0x42')](handleError(_0x4e9f46,null));};exports['show']=function(_0x483868,_0x1b5d94){var _0x34d6ca={'raw':!![],'where':{'id':_0x483868[_0x6dc8('0x43')]['id']}},_0x2de273={};_0x2de273[_0x6dc8('0x2e')]=_[_0x6dc8('0x30')](db[_0x6dc8('0x2a')][_0x6dc8('0x2b')]);_0x2de273[_0x6dc8('0x2f')]=_['keys'](_0x483868[_0x6dc8('0x2f')]);_0x2de273[_0x6dc8('0x31')]=_[_0x6dc8('0x44')](_0x2de273[_0x6dc8('0x2e')],_0x2de273[_0x6dc8('0x2f')]);_0x34d6ca['attributes']=_[_0x6dc8('0x44')](_0x2de273['model'],qs[_0x6dc8('0x33')](_0x483868['query']['fields']));_0x34d6ca['attributes']=_0x34d6ca['attributes'][_0x6dc8('0x34')]?_0x34d6ca[_0x6dc8('0x32')]:_0x2de273[_0x6dc8('0x2e')];if(_0x483868[_0x6dc8('0x2f')][_0x6dc8('0x3e')]){_0x34d6ca[_0x6dc8('0x3f')]=[{'all':!![]}];}_0x34d6ca=_[_0x6dc8('0x3b')]({},_0x34d6ca,_0x483868[_0x6dc8('0x3d')]);return db[_0x6dc8('0x2a')][_0x6dc8('0x45')](_0x34d6ca)['then'](handleEntityNotFound(_0x1b5d94,null))['then'](respondWithResult(_0x1b5d94,null))[_0x6dc8('0x42')](handleError(_0x1b5d94,null));};exports[_0x6dc8('0x46')]=function(_0x151b05,_0x2b516a){return db[_0x6dc8('0x2a')][_0x6dc8('0x46')](_0x151b05[_0x6dc8('0x47')],{})[_0x6dc8('0x25')](respondWithResult(_0x2b516a,0xc9))[_0x6dc8('0x42')](handleError(_0x2b516a,null));};exports['update']=function(_0x8fe06e,_0x387f48){if(_0x8fe06e[_0x6dc8('0x47')]['id']){delete _0x8fe06e[_0x6dc8('0x47')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x8fe06e[_0x6dc8('0x43')]['id']}})['then'](handleEntityNotFound(_0x387f48,null))[_0x6dc8('0x25')](saveUpdates(_0x8fe06e[_0x6dc8('0x47')],null))['then'](respondWithResult(_0x387f48,null))['catch'](handleError(_0x387f48,null));};exports['destroy']=function(_0x3707f8,_0x6e3f57){return db[_0x6dc8('0x2a')]['find']({'where':{'id':_0x3707f8[_0x6dc8('0x43')]['id']}})[_0x6dc8('0x25')](handleEntityNotFound(_0x6e3f57,null))[_0x6dc8('0x25')](removeEntity(_0x6e3f57,null))[_0x6dc8('0x42')](handleError(_0x6e3f57,null));};exports[_0x6dc8('0x48')]=function(_0x2db363,_0x5e9e5d){return db[_0x6dc8('0x2a')][_0x6dc8('0x48')]()['then'](respondWithResult(_0x5e9e5d,null))[_0x6dc8('0x42')](handleError(_0x5e9e5d,null));}; \ No newline at end of file +var _0x88b0=['filter','merge','where','options','includeAll','include','rows','catch','show','ChatQueueReport','find','create','body','params','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x553126,_0xaf8ac0){var _0x3076a1=function(_0x4650ef){while(--_0x4650ef){_0x553126['push'](_0x553126['shift']());}};_0x3076a1(++_0xaf8ac0);}(_0x88b0,0x1cb));var _0x088b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x88b0[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x088b('0x0'));var rimraf=require(_0x088b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x088b('0x2'));var moment=require(_0x088b('0x3'));var BPromise=require(_0x088b('0x4'));var Mustache=require(_0x088b('0x5'));var util=require('util');var path=require(_0x088b('0x6'));var sox=require(_0x088b('0x7'));var csv=require(_0x088b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x088b('0x9'));var squel=require(_0x088b('0xa'));var crypto=require(_0x088b('0xb'));var jsforce=require(_0x088b('0xc'));var deskjs=require(_0x088b('0xd'));var toCsv=require(_0x088b('0x8'));var querystring=require(_0x088b('0xe'));var Papa=require('papaparse');var Redis=require(_0x088b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x088b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x088b('0x11'));var logger=require(_0x088b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x088b('0x13'));var licenseUtil=require(_0x088b('0x14'));var db=require(_0x088b('0x15'))['db'];function respondWithStatusCode(_0x4c8a3b,_0x458b1c){_0x458b1c=_0x458b1c||0xcc;return function(_0x19f6c2){if(_0x19f6c2){return _0x4c8a3b[_0x088b('0x16')](_0x458b1c);}return _0x4c8a3b['status'](_0x458b1c)[_0x088b('0x17')]();};}function respondWithResult(_0x2a1e5c,_0x1b0771){_0x1b0771=_0x1b0771||0xc8;return function(_0xf6bd53){if(_0xf6bd53){return _0x2a1e5c[_0x088b('0x18')](_0x1b0771)[_0x088b('0x19')](_0xf6bd53);}};}function respondWithFilteredResult(_0x462392,_0x500ed5){return function(_0x393335){if(_0x393335){var _0x1c1096=typeof _0x500ed5[_0x088b('0x1a')]===_0x088b('0x1b')&&typeof _0x500ed5[_0x088b('0x1c')]===_0x088b('0x1b');var _0x54a27e=_0x393335[_0x088b('0x1d')];var _0x3ce059=_0x1c1096?0x0:_0x500ed5[_0x088b('0x1a')];var _0x31d121=_0x1c1096?_0x393335[_0x088b('0x1d')]:_0x500ed5['offset']+_0x500ed5['limit'];var _0x35e006;if(_0x31d121>=_0x54a27e){_0x31d121=_0x54a27e;_0x35e006=0xc8;}else{_0x35e006=0xce;}_0x462392[_0x088b('0x18')](_0x35e006);return _0x462392[_0x088b('0x1e')](_0x088b('0x1f'),_0x3ce059+'-'+_0x31d121+'/'+_0x54a27e)[_0x088b('0x19')](_0x393335);}return null;};}function patchUpdates(_0x6ecfbe){return function(_0x565220){try{jsonpatch[_0x088b('0x20')](_0x565220,_0x6ecfbe,!![]);}catch(_0x293604){return BPromise[_0x088b('0x21')](_0x293604);}return _0x565220['save']();};}function saveUpdates(_0x52f955,_0x464949){return function(_0x1db300){if(_0x1db300){return _0x1db300[_0x088b('0x22')](_0x52f955)['then'](function(_0x187350){return _0x187350;});}return null;};}function removeEntity(_0xcfc1c6,_0x5a9cbf){return function(_0x4b4d3f){if(_0x4b4d3f){return _0x4b4d3f['destroy']()[_0x088b('0x23')](function(){_0xcfc1c6['status'](0xcc)[_0x088b('0x17')]();});}};}function handleEntityNotFound(_0x4178d0,_0x8f18b7){return function(_0x2c551f){if(!_0x2c551f){_0x4178d0[_0x088b('0x16')](0x194);}return _0x2c551f;};}function handleError(_0x16495e,_0x525bf0){_0x525bf0=_0x525bf0||0x1f4;return function(_0x339eb9){logger[_0x088b('0x24')](_0x339eb9[_0x088b('0x25')]);if(_0x339eb9['name']){delete _0x339eb9[_0x088b('0x26')];}_0x16495e[_0x088b('0x18')](_0x525bf0)[_0x088b('0x27')](_0x339eb9);};}exports[_0x088b('0x28')]=function(_0x5e1449,_0x53b932){var _0x2e513={},_0x44e8a6={},_0x3921c8={'count':0x0,'rows':[]};var _0x193a00=_[_0x088b('0x29')](db['ChatQueueReport'][_0x088b('0x2a')],function(_0xb97ad6){return{'name':_0xb97ad6[_0x088b('0x2b')],'type':_0xb97ad6[_0x088b('0x2c')][_0x088b('0x2d')]};});_0x44e8a6['model']=_[_0x088b('0x29')](_0x193a00,_0x088b('0x26'));_0x44e8a6[_0x088b('0x2e')]=_[_0x088b('0x2f')](_0x5e1449[_0x088b('0x2e')]);_0x44e8a6[_0x088b('0x30')]=_[_0x088b('0x31')](_0x44e8a6[_0x088b('0x32')],_0x44e8a6[_0x088b('0x2e')]);_0x2e513[_0x088b('0x33')]=_[_0x088b('0x31')](_0x44e8a6['model'],qs[_0x088b('0x34')](_0x5e1449[_0x088b('0x2e')][_0x088b('0x34')]));_0x2e513[_0x088b('0x33')]=_0x2e513['attributes'][_0x088b('0x35')]?_0x2e513['attributes']:_0x44e8a6[_0x088b('0x32')];if(!_0x5e1449['query'][_0x088b('0x36')](_0x088b('0x37'))){_0x2e513[_0x088b('0x1c')]=qs[_0x088b('0x1c')](_0x5e1449[_0x088b('0x2e')][_0x088b('0x1c')]);_0x2e513[_0x088b('0x1a')]=qs['offset'](_0x5e1449[_0x088b('0x2e')][_0x088b('0x1a')]);}_0x2e513[_0x088b('0x38')]=qs['sort'](_0x5e1449[_0x088b('0x2e')][_0x088b('0x39')]);_0x2e513['where']=qs[_0x088b('0x30')](_[_0x088b('0x3a')](_0x5e1449[_0x088b('0x2e')],_0x44e8a6[_0x088b('0x30')]),_0x193a00);if(_0x5e1449['query'][_0x088b('0x3b')]){_0x2e513['where']=_[_0x088b('0x3c')](_0x2e513[_0x088b('0x3d')],{'$or':_[_0x088b('0x29')](_0x193a00,function(_0x4d9caf){if(_0x4d9caf[_0x088b('0x2c')]!=='VIRTUAL'){var _0x1cc801={};_0x1cc801[_0x4d9caf[_0x088b('0x26')]]={'$like':'%'+_0x5e1449[_0x088b('0x2e')][_0x088b('0x3b')]+'%'};return _0x1cc801;}})});}_0x2e513=_[_0x088b('0x3c')]({},_0x2e513,_0x5e1449[_0x088b('0x3e')]);var _0x258ee4={'where':_0x2e513[_0x088b('0x3d')]};return db['ChatQueueReport'][_0x088b('0x1d')](_0x258ee4)[_0x088b('0x23')](function(_0xce5ffc){_0x3921c8['count']=_0xce5ffc;if(_0x5e1449[_0x088b('0x2e')][_0x088b('0x3f')]){_0x2e513[_0x088b('0x40')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x2e513);})['then'](function(_0x530133){_0x3921c8[_0x088b('0x41')]=_0x530133;return _0x3921c8;})[_0x088b('0x23')](respondWithFilteredResult(_0x53b932,_0x2e513))[_0x088b('0x42')](handleError(_0x53b932,null));};exports[_0x088b('0x43')]=function(_0xe27d96,_0x15a35a){var _0x4bc14d={'raw':!![],'where':{'id':_0xe27d96['params']['id']}},_0x3b894d={};_0x3b894d['model']=_['keys'](db['ChatQueueReport'][_0x088b('0x2a')]);_0x3b894d[_0x088b('0x2e')]=_[_0x088b('0x2f')](_0xe27d96[_0x088b('0x2e')]);_0x3b894d[_0x088b('0x30')]=_[_0x088b('0x31')](_0x3b894d[_0x088b('0x32')],_0x3b894d[_0x088b('0x2e')]);_0x4bc14d[_0x088b('0x33')]=_[_0x088b('0x31')](_0x3b894d[_0x088b('0x32')],qs['fields'](_0xe27d96[_0x088b('0x2e')][_0x088b('0x34')]));_0x4bc14d[_0x088b('0x33')]=_0x4bc14d[_0x088b('0x33')]['length']?_0x4bc14d[_0x088b('0x33')]:_0x3b894d['model'];if(_0xe27d96[_0x088b('0x2e')][_0x088b('0x3f')]){_0x4bc14d[_0x088b('0x40')]=[{'all':!![]}];}_0x4bc14d=_['merge']({},_0x4bc14d,_0xe27d96[_0x088b('0x3e')]);return db[_0x088b('0x44')][_0x088b('0x45')](_0x4bc14d)[_0x088b('0x23')](handleEntityNotFound(_0x15a35a,null))[_0x088b('0x23')](respondWithResult(_0x15a35a,null))[_0x088b('0x42')](handleError(_0x15a35a,null));};exports[_0x088b('0x46')]=function(_0x117c4b,_0x173888){return db['ChatQueueReport'][_0x088b('0x46')](_0x117c4b[_0x088b('0x47')],{})[_0x088b('0x23')](respondWithResult(_0x173888,0xc9))[_0x088b('0x42')](handleError(_0x173888,null));};exports[_0x088b('0x22')]=function(_0x301212,_0x32d95a){if(_0x301212[_0x088b('0x47')]['id']){delete _0x301212['body']['id'];}return db[_0x088b('0x44')][_0x088b('0x45')]({'where':{'id':_0x301212[_0x088b('0x48')]['id']}})[_0x088b('0x23')](handleEntityNotFound(_0x32d95a,null))['then'](saveUpdates(_0x301212[_0x088b('0x47')],null))[_0x088b('0x23')](respondWithResult(_0x32d95a,null))[_0x088b('0x42')](handleError(_0x32d95a,null));};exports['destroy']=function(_0x40e19e,_0x59ae27){return db['ChatQueueReport'][_0x088b('0x45')]({'where':{'id':_0x40e19e[_0x088b('0x48')]['id']}})[_0x088b('0x23')](handleEntityNotFound(_0x59ae27,null))[_0x088b('0x23')](removeEntity(_0x59ae27,null))[_0x088b('0x42')](handleError(_0x59ae27,null));};exports[_0x088b('0x49')]=function(_0x1900f8,_0x4b19c8){return db[_0x088b('0x44')][_0x088b('0x49')]()['then'](respondWithResult(_0x4b19c8,null))[_0x088b('0x42')](handleError(_0x4b19c8,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 5133754..45360b7 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x550184,_0x566062){var _0x565008=function(_0xfd7ada){while(--_0xfd7ada){_0x550184['push'](_0x550184['shift']());}};_0x565008(++_0x566062);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3b32ef,_0x465cae){var _0x54fd60=function(_0x56ee3e){while(--_0x56ee3e){_0x3b32ef['push'](_0x3b32ef['shift']());}};_0x54fd60(++_0x465cae);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index ca2662e..7f63892 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 _0x32d7=['http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x32d7,0xd0));var _0x732d=function(_0x311909,_0x414bf7){_0x311909=_0x311909-0x0;var _0x8d3163=_0x32d7[_0x311909];return _0x8d3163;};'use strict';var _=require(_0x732d('0x0'));var util=require('util');var moment=require(_0x732d('0x1'));var BPromise=require(_0x732d('0x2'));var rs=require(_0x732d('0x3'));var fs=require('fs');var Redis=require(_0x732d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x732d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x732d('0x6'));var jayson=require(_0x732d('0x7'));var client=jayson[_0x732d('0x8')][_0x732d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d430a,_0x259c51,_0x243a03){return new BPromise(function(_0x3ba72a,_0x58fe13){return client['request'](_0x4d430a,_0x243a03)[_0x732d('0xa')](function(_0x386f83){logger[_0x732d('0xb')](_0x732d('0xc'),_0x259c51,_0x732d('0xd'));logger[_0x732d('0xe')](_0x732d('0xf'),_0x259c51,_0x732d('0xd'),JSON['stringify'](_0x386f83));if(_0x386f83['error']){if(_0x386f83[_0x732d('0x10')]['code']===0x1f4){logger[_0x732d('0x10')](_0x732d('0xc'),_0x259c51,_0x386f83[_0x732d('0x10')][_0x732d('0x11')]);return _0x58fe13(_0x386f83[_0x732d('0x10')]['message']);}logger[_0x732d('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x259c51,_0x386f83[_0x732d('0x10')][_0x732d('0x11')]);return _0x3ba72a(_0x386f83[_0x732d('0x10')][_0x732d('0x11')]);}else{logger[_0x732d('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x259c51,'request\x20sent');_0x3ba72a(_0x386f83[_0x732d('0x12')]['message']);}})[_0x732d('0x13')](function(_0x29ac79){logger[_0x732d('0x10')](_0x732d('0xc'),_0x259c51,_0x29ac79);_0x58fe13(_0x29ac79);});});}exports[_0x732d('0x14')]=function(_0x14ef5d){var _0x12c152=this;return new Promise(function(_0x3264d4,_0x261e2c){return db[_0x732d('0x15')][_0x732d('0x16')](_0x14ef5d[_0x732d('0x17')],{'raw':_0x14ef5d[_0x732d('0x18')]?_0x14ef5d[_0x732d('0x18')][_0x732d('0x19')]===undefined?!![]:![]:!![]})[_0x732d('0xa')](function(_0x4afbb5){logger[_0x732d('0xb')](_0x732d('0x14'),_0x14ef5d);logger[_0x732d('0xe')](_0x732d('0x14'),_0x14ef5d,JSON['stringify'](_0x4afbb5));_0x3264d4(_0x4afbb5);})['catch'](function(_0x2b2769){logger['error']('CreateChatQueueReport',_0x2b2769['message'],_0x14ef5d);_0x261e2c(_0x12c152['error'](0x1f4,_0x2b2769[_0x732d('0x11')]));});});};exports[_0x732d('0x1a')]=function(_0x19c43f){var _0x37695c=this;return new Promise(function(_0x2a7c06,_0x259cf7){return db[_0x732d('0x15')][_0x732d('0x1b')](_0x19c43f[_0x732d('0x17')],{'raw':_0x19c43f['options']?_0x19c43f[_0x732d('0x18')][_0x732d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19c43f['options']?_0x19c43f['options'][_0x732d('0x1c')]||null:null,'attributes':_0x19c43f[_0x732d('0x18')]?_0x19c43f[_0x732d('0x18')][_0x732d('0x1d')]||null:null,'limit':_0x19c43f[_0x732d('0x18')]?_0x19c43f['options'][_0x732d('0x1e')]||null:null})['then'](function(_0x337926){logger[_0x732d('0xb')]('UpdateChatQueueReport',_0x19c43f);logger[_0x732d('0xe')]('UpdateChatQueueReport',_0x19c43f,JSON['stringify'](_0x337926));_0x2a7c06(_0x337926);})[_0x732d('0x13')](function(_0x26b9da){logger['error'](_0x732d('0x1a'),_0x26b9da['message'],_0x19c43f);_0x259cf7(_0x37695c['error'](0x1f4,_0x26b9da[_0x732d('0x11')]));});});}; \ No newline at end of file +var _0x5fe0=['body','options','then','stringify','UpdateChatQueueReport','update','raw','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateChatQueueReport','ChatQueueReport'];(function(_0x42565a,_0x441e1b){var _0x4a8397=function(_0x15146e){while(--_0x15146e){_0x42565a['push'](_0x42565a['shift']());}};_0x4a8397(++_0x441e1b);}(_0x5fe0,0x110));var _0x05fe=function(_0x4ff746,_0x3ccef9){_0x4ff746=_0x4ff746-0x0;var _0x17a81c=_0x5fe0[_0x4ff746];return _0x17a81c;};'use strict';var _=require(_0x05fe('0x0'));var util=require('util');var moment=require(_0x05fe('0x1'));var BPromise=require(_0x05fe('0x2'));var rs=require(_0x05fe('0x3'));var fs=require('fs');var Redis=require(_0x05fe('0x4'));var db=require(_0x05fe('0x5'))['db'];var utils=require(_0x05fe('0x6'));var logger=require(_0x05fe('0x7'))(_0x05fe('0x8'));var config=require(_0x05fe('0x9'));var jayson=require(_0x05fe('0xa'));var client=jayson['client'][_0x05fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x232241,_0x372cf6,_0x3935ce){return new BPromise(function(_0x449072,_0x53b95f){return client[_0x05fe('0xc')](_0x232241,_0x3935ce)['then'](function(_0xf85fc0){logger[_0x05fe('0xd')](_0x05fe('0xe'),_0x372cf6,'request\x20sent');logger[_0x05fe('0xf')](_0x05fe('0x10'),_0x372cf6,'request\x20sent',JSON['stringify'](_0xf85fc0));if(_0xf85fc0['error']){if(_0xf85fc0[_0x05fe('0x11')][_0x05fe('0x12')]===0x1f4){logger[_0x05fe('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x372cf6,_0xf85fc0[_0x05fe('0x11')]['message']);return _0x53b95f(_0xf85fc0[_0x05fe('0x11')][_0x05fe('0x13')]);}logger[_0x05fe('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x372cf6,_0xf85fc0[_0x05fe('0x11')][_0x05fe('0x13')]);return _0x449072(_0xf85fc0['error'][_0x05fe('0x13')]);}else{logger['info'](_0x05fe('0xe'),_0x372cf6,_0x05fe('0x14'));_0x449072(_0xf85fc0[_0x05fe('0x15')][_0x05fe('0x13')]);}})[_0x05fe('0x16')](function(_0x43db99){logger[_0x05fe('0x11')](_0x05fe('0xe'),_0x372cf6,_0x43db99);_0x53b95f(_0x43db99);});});}exports[_0x05fe('0x17')]=function(_0x519310){var _0xfed279=this;return new Promise(function(_0x14d194,_0x422216){return db[_0x05fe('0x18')]['create'](_0x519310[_0x05fe('0x19')],{'raw':_0x519310[_0x05fe('0x1a')]?_0x519310[_0x05fe('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x05fe('0x1b')](function(_0x4b3d0e){logger[_0x05fe('0xd')](_0x05fe('0x17'),_0x519310);logger[_0x05fe('0xf')](_0x05fe('0x17'),_0x519310,JSON[_0x05fe('0x1c')](_0x4b3d0e));_0x14d194(_0x4b3d0e);})[_0x05fe('0x16')](function(_0x20f2a0){logger['error']('CreateChatQueueReport',_0x20f2a0[_0x05fe('0x13')],_0x519310);_0x422216(_0xfed279[_0x05fe('0x11')](0x1f4,_0x20f2a0[_0x05fe('0x13')]));});});};exports[_0x05fe('0x1d')]=function(_0x18d62c){var _0x501568=this;return new Promise(function(_0x5ba968,_0x11c687){return db['ChatQueueReport'][_0x05fe('0x1e')](_0x18d62c[_0x05fe('0x19')],{'raw':_0x18d62c[_0x05fe('0x1a')]?_0x18d62c[_0x05fe('0x1a')][_0x05fe('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18d62c['options']?_0x18d62c[_0x05fe('0x1a')]['where']||null:null,'attributes':_0x18d62c['options']?_0x18d62c[_0x05fe('0x1a')]['attributes']||null:null,'limit':_0x18d62c['options']?_0x18d62c['options'][_0x05fe('0x20')]||null:null})[_0x05fe('0x1b')](function(_0x19fc23){logger[_0x05fe('0xd')]('UpdateChatQueueReport',_0x18d62c);logger['debug'](_0x05fe('0x1d'),_0x18d62c,JSON[_0x05fe('0x1c')](_0x19fc23));_0x5ba968(_0x19fc23);})[_0x05fe('0x16')](function(_0x31e9bb){logger['error'](_0x05fe('0x1d'),_0x31e9bb[_0x05fe('0x13')],_0x18d62c);_0x11c687(_0x501568[_0x05fe('0x11')](0x1f4,_0x31e9bb[_0x05fe('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 4dbd0bd..fdc8372 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 _0x6e5a=['../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e5a,0xc2));var _0xa6e5=function(_0xdab60b,_0x147160){_0xdab60b=_0xdab60b-0x0;var _0x2826ef=_0x6e5a[_0xdab60b];return _0x2826ef;};'use strict';var multer=require(_0xa6e5('0x0'));var util=require(_0xa6e5('0x1'));var path=require(_0xa6e5('0x2'));var timeout=require(_0xa6e5('0x3'));var express=require(_0xa6e5('0x4'));var router=express['Router']();var fs_extra=require(_0xa6e5('0x5'));var auth=require(_0xa6e5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa6e5('0x7'));var controller=require(_0xa6e5('0x8'));router[_0xa6e5('0x9')]('/',auth[_0xa6e5('0xa')](),controller[_0xa6e5('0xb')]);router['get'](_0xa6e5('0xc'),auth['isAuthenticated'](),controller[_0xa6e5('0xd')]);router[_0xa6e5('0x9')](_0xa6e5('0xe'),auth[_0xa6e5('0xa')](),controller[_0xa6e5('0xf')]);router[_0xa6e5('0x10')]('/',auth['isAuthenticated'](),controller[_0xa6e5('0x11')]);router['put'](_0xa6e5('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa6e5('0xe'),auth[_0xa6e5('0xa')](),controller[_0xa6e5('0x12')]);module[_0xa6e5('0x13')]=router; \ No newline at end of file +var _0x2be3=['fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x2be3,0xd7));var _0x32be=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x2be3[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0x32be('0x0'));var util=require(_0x32be('0x1'));var path=require('path');var timeout=require(_0x32be('0x2'));var express=require(_0x32be('0x3'));var router=express[_0x32be('0x4')]();var fs_extra=require(_0x32be('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x32be('0x6'));var config=require(_0x32be('0x7'));var controller=require(_0x32be('0x8'));router[_0x32be('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x32be('0xa'),auth[_0x32be('0xb')](),controller[_0x32be('0xc')]);router[_0x32be('0x9')](_0x32be('0xd'),auth[_0x32be('0xb')](),controller[_0x32be('0xe')]);router[_0x32be('0xf')]('/',auth[_0x32be('0xb')](),controller['create']);router[_0x32be('0x10')](_0x32be('0xd'),auth[_0x32be('0xb')](),controller[_0x32be('0x11')]);router['delete'](_0x32be('0xd'),auth['isAuthenticated'](),controller[_0x32be('0x12')]);module[_0x32be('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index b3f768c..0cc4352 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x4fca65,_0x3ac3c4){var _0xce59a6=function(_0x20ea25){while(--_0x20ea25){_0x4fca65['push'](_0x4fca65['shift']());}};_0xce59a6(++_0x3ac3c4);}(_0x70e0,0x17b));var _0x070e=function(_0x180026,_0x5464ef){_0x180026=_0x180026-0x0;var _0x2b2ccb=_0x70e0[_0x180026];return _0x2b2ccb;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x26b622,_0x237e9e){var _0x58a028=function(_0xde1652){while(--_0xde1652){_0x26b622['push'](_0x26b622['shift']());}};_0x58a028(++_0x237e9e);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index fc9b84e..d33ab0e 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 _0xdab9=['filter','merge','VIRTUAL','options','ChatTransferReport','include','catch','params','fields','includeAll','find','create','body','destroy','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','reject','save','then','stack','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','length','limit','order','sort','where'];(function(_0x575d3d,_0x1b92d7){var _0x49e231=function(_0x524fe4){while(--_0x524fe4){_0x575d3d['push'](_0x575d3d['shift']());}};_0x49e231(++_0x1b92d7);}(_0xdab9,0x1dd));var _0x9dab=function(_0x4825c5,_0x125934){_0x4825c5=_0x4825c5-0x0;var _0x312de3=_0xdab9[_0x4825c5];return _0x312de3;};'use strict';var emlformat=require(_0x9dab('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9dab('0x1'));var moment=require(_0x9dab('0x2'));var BPromise=require(_0x9dab('0x3'));var Mustache=require(_0x9dab('0x4'));var util=require(_0x9dab('0x5'));var path=require(_0x9dab('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9dab('0x7'));var fs=require('fs');var fs_extra=require(_0x9dab('0x8'));var _=require(_0x9dab('0x9'));var squel=require(_0x9dab('0xa'));var crypto=require(_0x9dab('0xb'));var jsforce=require(_0x9dab('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9dab('0xd'));var querystring=require(_0x9dab('0xe'));var Papa=require(_0x9dab('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(_0x9dab('0x10'));var logger=require(_0x9dab('0x11'))(_0x9dab('0x12'));var utils=require(_0x9dab('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9dab('0x14'))['db'];function respondWithStatusCode(_0x577260,_0x1898f3){_0x1898f3=_0x1898f3||0xcc;return function(_0xcbb13){if(_0xcbb13){return _0x577260[_0x9dab('0x15')](_0x1898f3);}return _0x577260[_0x9dab('0x16')](_0x1898f3)[_0x9dab('0x17')]();};}function respondWithResult(_0x597e7b,_0x35583e){_0x35583e=_0x35583e||0xc8;return function(_0x15b278){if(_0x15b278){return _0x597e7b[_0x9dab('0x16')](_0x35583e)[_0x9dab('0x18')](_0x15b278);}};}function respondWithFilteredResult(_0x3e452f,_0x2c0d8b){return function(_0x405b51){if(_0x405b51){var _0x3b2a5e=typeof _0x2c0d8b[_0x9dab('0x19')]===_0x9dab('0x1a')&&typeof _0x2c0d8b['limit']===_0x9dab('0x1a');var _0xe861fd=_0x405b51[_0x9dab('0x1b')];var _0x56b79d=_0x3b2a5e?0x0:_0x2c0d8b['offset'];var _0x588859=_0x3b2a5e?_0x405b51[_0x9dab('0x1b')]:_0x2c0d8b[_0x9dab('0x19')]+_0x2c0d8b['limit'];var _0x149b5b;if(_0x588859>=_0xe861fd){_0x588859=_0xe861fd;_0x149b5b=0xc8;}else{_0x149b5b=0xce;}_0x3e452f[_0x9dab('0x16')](_0x149b5b);return _0x3e452f[_0x9dab('0x1c')]('Content-Range',_0x56b79d+'-'+_0x588859+'/'+_0xe861fd)['json'](_0x405b51);}return null;};}function patchUpdates(_0x36b9a4){return function(_0x5a29df){try{jsonpatch['apply'](_0x5a29df,_0x36b9a4,!![]);}catch(_0x621315){return BPromise[_0x9dab('0x1d')](_0x621315);}return _0x5a29df[_0x9dab('0x1e')]();};}function saveUpdates(_0x29d898,_0x3d45d0){return function(_0x5ade75){if(_0x5ade75){return _0x5ade75['update'](_0x29d898)[_0x9dab('0x1f')](function(_0x2a0d80){return _0x2a0d80;});}return null;};}function removeEntity(_0x5f3506,_0x507a92){return function(_0x24b92f){if(_0x24b92f){return _0x24b92f['destroy']()[_0x9dab('0x1f')](function(){_0x5f3506[_0x9dab('0x16')](0xcc)[_0x9dab('0x17')]();});}};}function handleEntityNotFound(_0x1c9b79,_0x5b8e72){return function(_0x29d211){if(!_0x29d211){_0x1c9b79[_0x9dab('0x15')](0x194);}return _0x29d211;};}function handleError(_0x302b06,_0x45f1dc){_0x45f1dc=_0x45f1dc||0x1f4;return function(_0x18ea48){logger['error'](_0x18ea48[_0x9dab('0x20')]);if(_0x18ea48['name']){delete _0x18ea48['name'];}_0x302b06[_0x9dab('0x16')](_0x45f1dc)['send'](_0x18ea48);};}exports[_0x9dab('0x21')]=function(_0xbd5eae,_0x22fe41){var _0x117de7={},_0x414c00={},_0x5be9cf={'count':0x0,'rows':[]};var _0x36d9b1=_[_0x9dab('0x22')](db['ChatTransferReport'][_0x9dab('0x23')],function(_0x47943d){return{'name':_0x47943d[_0x9dab('0x24')],'type':_0x47943d[_0x9dab('0x25')][_0x9dab('0x26')]};});_0x414c00[_0x9dab('0x27')]=_['map'](_0x36d9b1,_0x9dab('0x28'));_0x414c00[_0x9dab('0x29')]=_[_0x9dab('0x2a')](_0xbd5eae[_0x9dab('0x29')]);_0x414c00[_0x9dab('0x2b')]=_[_0x9dab('0x2c')](_0x414c00['model'],_0x414c00[_0x9dab('0x29')]);_0x117de7[_0x9dab('0x2d')]=_[_0x9dab('0x2c')](_0x414c00[_0x9dab('0x27')],qs['fields'](_0xbd5eae[_0x9dab('0x29')]['fields']));_0x117de7[_0x9dab('0x2d')]=_0x117de7[_0x9dab('0x2d')][_0x9dab('0x2e')]?_0x117de7[_0x9dab('0x2d')]:_0x414c00[_0x9dab('0x27')];if(!_0xbd5eae[_0x9dab('0x29')]['hasOwnProperty']('nolimit')){_0x117de7['limit']=qs['limit'](_0xbd5eae['query'][_0x9dab('0x2f')]);_0x117de7[_0x9dab('0x19')]=qs[_0x9dab('0x19')](_0xbd5eae[_0x9dab('0x29')]['offset']);}_0x117de7[_0x9dab('0x30')]=qs[_0x9dab('0x31')](_0xbd5eae['query'][_0x9dab('0x31')]);_0x117de7[_0x9dab('0x32')]=qs[_0x9dab('0x2b')](_['pick'](_0xbd5eae[_0x9dab('0x29')],_0x414c00['filters']),_0x36d9b1);if(_0xbd5eae[_0x9dab('0x29')][_0x9dab('0x33')]){_0x117de7[_0x9dab('0x32')]=_[_0x9dab('0x34')](_0x117de7['where'],{'$or':_[_0x9dab('0x22')](_0x36d9b1,function(_0x38f8c1){if(_0x38f8c1[_0x9dab('0x25')]!==_0x9dab('0x35')){var _0x18d0c5={};_0x18d0c5[_0x38f8c1[_0x9dab('0x28')]]={'$like':'%'+_0xbd5eae[_0x9dab('0x29')][_0x9dab('0x33')]+'%'};return _0x18d0c5;}})});}_0x117de7=_[_0x9dab('0x34')]({},_0x117de7,_0xbd5eae[_0x9dab('0x36')]);var _0x1afa8b={'where':_0x117de7[_0x9dab('0x32')]};return db[_0x9dab('0x37')]['count'](_0x1afa8b)[_0x9dab('0x1f')](function(_0xdf3827){_0x5be9cf[_0x9dab('0x1b')]=_0xdf3827;if(_0xbd5eae[_0x9dab('0x29')]['includeAll']){_0x117de7[_0x9dab('0x38')]=[{'all':!![]}];}return db[_0x9dab('0x37')]['findAll'](_0x117de7);})['then'](function(_0x416c2c){_0x5be9cf['rows']=_0x416c2c;return _0x5be9cf;})['then'](respondWithFilteredResult(_0x22fe41,_0x117de7))[_0x9dab('0x39')](handleError(_0x22fe41,null));};exports['show']=function(_0x33fd32,_0x2f47ad){var _0x409230={'raw':!![],'where':{'id':_0x33fd32[_0x9dab('0x3a')]['id']}},_0x16d350={};_0x16d350[_0x9dab('0x27')]=_[_0x9dab('0x2a')](db[_0x9dab('0x37')][_0x9dab('0x23')]);_0x16d350[_0x9dab('0x29')]=_['keys'](_0x33fd32[_0x9dab('0x29')]);_0x16d350[_0x9dab('0x2b')]=_[_0x9dab('0x2c')](_0x16d350[_0x9dab('0x27')],_0x16d350[_0x9dab('0x29')]);_0x409230['attributes']=_['intersection'](_0x16d350[_0x9dab('0x27')],qs[_0x9dab('0x3b')](_0x33fd32['query'][_0x9dab('0x3b')]));_0x409230['attributes']=_0x409230[_0x9dab('0x2d')][_0x9dab('0x2e')]?_0x409230['attributes']:_0x16d350[_0x9dab('0x27')];if(_0x33fd32[_0x9dab('0x29')][_0x9dab('0x3c')]){_0x409230['include']=[{'all':!![]}];}_0x409230=_['merge']({},_0x409230,_0x33fd32[_0x9dab('0x36')]);return db[_0x9dab('0x37')][_0x9dab('0x3d')](_0x409230)[_0x9dab('0x1f')](handleEntityNotFound(_0x2f47ad,null))[_0x9dab('0x1f')](respondWithResult(_0x2f47ad,null))[_0x9dab('0x39')](handleError(_0x2f47ad,null));};exports[_0x9dab('0x3e')]=function(_0x49bb90,_0x374191){return db[_0x9dab('0x37')][_0x9dab('0x3e')](_0x49bb90[_0x9dab('0x3f')],{})['then'](respondWithResult(_0x374191,0xc9))[_0x9dab('0x39')](handleError(_0x374191,null));};exports['update']=function(_0x44ac90,_0x11c77e){if(_0x44ac90['body']['id']){delete _0x44ac90['body']['id'];}return db[_0x9dab('0x37')][_0x9dab('0x3d')]({'where':{'id':_0x44ac90[_0x9dab('0x3a')]['id']}})[_0x9dab('0x1f')](handleEntityNotFound(_0x11c77e,null))['then'](saveUpdates(_0x44ac90[_0x9dab('0x3f')],null))[_0x9dab('0x1f')](respondWithResult(_0x11c77e,null))[_0x9dab('0x39')](handleError(_0x11c77e,null));};exports[_0x9dab('0x40')]=function(_0x5938f0,_0x40ff4f){return db[_0x9dab('0x37')][_0x9dab('0x3d')]({'where':{'id':_0x5938f0[_0x9dab('0x3a')]['id']}})['then'](handleEntityNotFound(_0x40ff4f,null))['then'](removeEntity(_0x40ff4f,null))[_0x9dab('0x39')](handleError(_0x40ff4f,null));};exports[_0x9dab('0x41')]=function(_0x35620f,_0x210150){return db['ChatTransferReport'][_0x9dab('0x41')]()['then'](respondWithResult(_0x210150,null))[_0x9dab('0x39')](handleError(_0x210150,null));}; \ No newline at end of file +var _0xdc75=['options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','send','index','map','ChatTransferReport','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc75,0xa8));var _0x5dc7=function(_0x1fdd74,_0x1428a9){_0x1fdd74=_0x1fdd74-0x0;var _0x344f8c=_0xdc75[_0x1fdd74];return _0x344f8c;};'use strict';var emlformat=require(_0x5dc7('0x0'));var rimraf=require(_0x5dc7('0x1'));var zipdir=require(_0x5dc7('0x2'));var jsonpatch=require(_0x5dc7('0x3'));var rp=require(_0x5dc7('0x4'));var moment=require(_0x5dc7('0x5'));var BPromise=require(_0x5dc7('0x6'));var Mustache=require(_0x5dc7('0x7'));var util=require('util');var path=require(_0x5dc7('0x8'));var sox=require(_0x5dc7('0x9'));var csv=require(_0x5dc7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5dc7('0xb'));var _=require(_0x5dc7('0xc'));var squel=require(_0x5dc7('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5dc7('0xe'));var toCsv=require(_0x5dc7('0xa'));var querystring=require(_0x5dc7('0xf'));var Papa=require(_0x5dc7('0x10'));var Redis=require(_0x5dc7('0x11'));var authService=require(_0x5dc7('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5dc7('0x13'))(_0x5dc7('0x14'));var utils=require(_0x5dc7('0x15'));var config=require(_0x5dc7('0x16'));var licenseUtil=require(_0x5dc7('0x17'));var db=require(_0x5dc7('0x18'))['db'];function respondWithStatusCode(_0x356074,_0x40d7a9){_0x40d7a9=_0x40d7a9||0xcc;return function(_0x327d93){if(_0x327d93){return _0x356074[_0x5dc7('0x19')](_0x40d7a9);}return _0x356074[_0x5dc7('0x1a')](_0x40d7a9)[_0x5dc7('0x1b')]();};}function respondWithResult(_0x17deba,_0x5ece82){_0x5ece82=_0x5ece82||0xc8;return function(_0x53bfea){if(_0x53bfea){return _0x17deba[_0x5dc7('0x1a')](_0x5ece82)[_0x5dc7('0x1c')](_0x53bfea);}};}function respondWithFilteredResult(_0x390d86,_0x2b7404){return function(_0x2f8626){if(_0x2f8626){var _0x5c37d9=typeof _0x2b7404[_0x5dc7('0x1d')]==='undefined'&&typeof _0x2b7404[_0x5dc7('0x1e')]==='undefined';var _0x57e7da=_0x2f8626[_0x5dc7('0x1f')];var _0x4b4bf6=_0x5c37d9?0x0:_0x2b7404[_0x5dc7('0x1d')];var _0x41dcb8=_0x5c37d9?_0x2f8626['count']:_0x2b7404['offset']+_0x2b7404[_0x5dc7('0x1e')];var _0xd0bb4e;if(_0x41dcb8>=_0x57e7da){_0x41dcb8=_0x57e7da;_0xd0bb4e=0xc8;}else{_0xd0bb4e=0xce;}_0x390d86['status'](_0xd0bb4e);return _0x390d86[_0x5dc7('0x20')](_0x5dc7('0x21'),_0x4b4bf6+'-'+_0x41dcb8+'/'+_0x57e7da)[_0x5dc7('0x1c')](_0x2f8626);}return null;};}function patchUpdates(_0x2dfc78){return function(_0x31eb1a){try{jsonpatch[_0x5dc7('0x22')](_0x31eb1a,_0x2dfc78,!![]);}catch(_0x5e1598){return BPromise[_0x5dc7('0x23')](_0x5e1598);}return _0x31eb1a[_0x5dc7('0x24')]();};}function saveUpdates(_0x54a550,_0x44df0d){return function(_0x57da8b){if(_0x57da8b){return _0x57da8b['update'](_0x54a550)[_0x5dc7('0x25')](function(_0x2f10e7){return _0x2f10e7;});}return null;};}function removeEntity(_0x40451d,_0x334556){return function(_0x2f5d1e){if(_0x2f5d1e){return _0x2f5d1e[_0x5dc7('0x26')]()[_0x5dc7('0x25')](function(){_0x40451d[_0x5dc7('0x1a')](0xcc)[_0x5dc7('0x1b')]();});}};}function handleEntityNotFound(_0x59dfee,_0x13be16){return function(_0x598f37){if(!_0x598f37){_0x59dfee[_0x5dc7('0x19')](0x194);}return _0x598f37;};}function handleError(_0x3c9e0f,_0x1b449f){_0x1b449f=_0x1b449f||0x1f4;return function(_0x6a34aa){logger[_0x5dc7('0x27')](_0x6a34aa['stack']);if(_0x6a34aa['name']){delete _0x6a34aa['name'];}_0x3c9e0f[_0x5dc7('0x1a')](_0x1b449f)[_0x5dc7('0x28')](_0x6a34aa);};}exports[_0x5dc7('0x29')]=function(_0x52de48,_0x5923d2){var _0x144c3b={},_0x27a09b={},_0x48dd17={'count':0x0,'rows':[]};var _0x1c7f54=_[_0x5dc7('0x2a')](db[_0x5dc7('0x2b')]['rawAttributes'],function(_0x3491a5){return{'name':_0x3491a5[_0x5dc7('0x2c')],'type':_0x3491a5[_0x5dc7('0x2d')][_0x5dc7('0x2e')]};});_0x27a09b[_0x5dc7('0x2f')]=_[_0x5dc7('0x2a')](_0x1c7f54,_0x5dc7('0x30'));_0x27a09b[_0x5dc7('0x31')]=_[_0x5dc7('0x32')](_0x52de48[_0x5dc7('0x31')]);_0x27a09b[_0x5dc7('0x33')]=_[_0x5dc7('0x34')](_0x27a09b[_0x5dc7('0x2f')],_0x27a09b[_0x5dc7('0x31')]);_0x144c3b[_0x5dc7('0x35')]=_[_0x5dc7('0x34')](_0x27a09b[_0x5dc7('0x2f')],qs['fields'](_0x52de48['query'][_0x5dc7('0x36')]));_0x144c3b['attributes']=_0x144c3b['attributes'][_0x5dc7('0x37')]?_0x144c3b[_0x5dc7('0x35')]:_0x27a09b[_0x5dc7('0x2f')];if(!_0x52de48[_0x5dc7('0x31')][_0x5dc7('0x38')]('nolimit')){_0x144c3b[_0x5dc7('0x1e')]=qs['limit'](_0x52de48[_0x5dc7('0x31')][_0x5dc7('0x1e')]);_0x144c3b[_0x5dc7('0x1d')]=qs[_0x5dc7('0x1d')](_0x52de48[_0x5dc7('0x31')][_0x5dc7('0x1d')]);}_0x144c3b[_0x5dc7('0x39')]=qs[_0x5dc7('0x3a')](_0x52de48[_0x5dc7('0x31')]['sort']);_0x144c3b[_0x5dc7('0x3b')]=qs['filters'](_['pick'](_0x52de48['query'],_0x27a09b[_0x5dc7('0x33')]),_0x1c7f54);if(_0x52de48['query'][_0x5dc7('0x3c')]){_0x144c3b['where']=_['merge'](_0x144c3b[_0x5dc7('0x3b')],{'$or':_[_0x5dc7('0x2a')](_0x1c7f54,function(_0x423e6f){if(_0x423e6f[_0x5dc7('0x2d')]!==_0x5dc7('0x3d')){var _0x122bd2={};_0x122bd2[_0x423e6f['name']]={'$like':'%'+_0x52de48['query'][_0x5dc7('0x3c')]+'%'};return _0x122bd2;}})});}_0x144c3b=_[_0x5dc7('0x3e')]({},_0x144c3b,_0x52de48[_0x5dc7('0x3f')]);var _0x5eb362={'where':_0x144c3b[_0x5dc7('0x3b')]};return db[_0x5dc7('0x2b')][_0x5dc7('0x1f')](_0x5eb362)[_0x5dc7('0x25')](function(_0x57f367){_0x48dd17[_0x5dc7('0x1f')]=_0x57f367;if(_0x52de48['query'][_0x5dc7('0x40')]){_0x144c3b['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x5dc7('0x41')](_0x144c3b);})[_0x5dc7('0x25')](function(_0x3c760a){_0x48dd17[_0x5dc7('0x42')]=_0x3c760a;return _0x48dd17;})[_0x5dc7('0x25')](respondWithFilteredResult(_0x5923d2,_0x144c3b))[_0x5dc7('0x43')](handleError(_0x5923d2,null));};exports[_0x5dc7('0x44')]=function(_0xdac48b,_0x255089){var _0x2f5ca2={'raw':!![],'where':{'id':_0xdac48b[_0x5dc7('0x45')]['id']}},_0x8fe8e2={};_0x8fe8e2[_0x5dc7('0x2f')]=_[_0x5dc7('0x32')](db[_0x5dc7('0x2b')][_0x5dc7('0x46')]);_0x8fe8e2[_0x5dc7('0x31')]=_[_0x5dc7('0x32')](_0xdac48b[_0x5dc7('0x31')]);_0x8fe8e2[_0x5dc7('0x33')]=_['intersection'](_0x8fe8e2[_0x5dc7('0x2f')],_0x8fe8e2[_0x5dc7('0x31')]);_0x2f5ca2[_0x5dc7('0x35')]=_['intersection'](_0x8fe8e2[_0x5dc7('0x2f')],qs[_0x5dc7('0x36')](_0xdac48b[_0x5dc7('0x31')][_0x5dc7('0x36')]));_0x2f5ca2[_0x5dc7('0x35')]=_0x2f5ca2['attributes'][_0x5dc7('0x37')]?_0x2f5ca2[_0x5dc7('0x35')]:_0x8fe8e2['model'];if(_0xdac48b[_0x5dc7('0x31')][_0x5dc7('0x40')]){_0x2f5ca2[_0x5dc7('0x47')]=[{'all':!![]}];}_0x2f5ca2=_[_0x5dc7('0x3e')]({},_0x2f5ca2,_0xdac48b[_0x5dc7('0x3f')]);return db['ChatTransferReport'][_0x5dc7('0x48')](_0x2f5ca2)[_0x5dc7('0x25')](handleEntityNotFound(_0x255089,null))[_0x5dc7('0x25')](respondWithResult(_0x255089,null))[_0x5dc7('0x43')](handleError(_0x255089,null));};exports[_0x5dc7('0x49')]=function(_0x1d514e,_0x2e5900){return db[_0x5dc7('0x2b')][_0x5dc7('0x49')](_0x1d514e[_0x5dc7('0x4a')],{})[_0x5dc7('0x25')](respondWithResult(_0x2e5900,0xc9))['catch'](handleError(_0x2e5900,null));};exports[_0x5dc7('0x4b')]=function(_0x31b5b,_0x502a51){if(_0x31b5b[_0x5dc7('0x4a')]['id']){delete _0x31b5b[_0x5dc7('0x4a')]['id'];}return db[_0x5dc7('0x2b')][_0x5dc7('0x48')]({'where':{'id':_0x31b5b['params']['id']}})['then'](handleEntityNotFound(_0x502a51,null))[_0x5dc7('0x25')](saveUpdates(_0x31b5b[_0x5dc7('0x4a')],null))[_0x5dc7('0x25')](respondWithResult(_0x502a51,null))[_0x5dc7('0x43')](handleError(_0x502a51,null));};exports['destroy']=function(_0x2b77b4,_0x105ed8){return db[_0x5dc7('0x2b')]['find']({'where':{'id':_0x2b77b4[_0x5dc7('0x45')]['id']}})[_0x5dc7('0x25')](handleEntityNotFound(_0x105ed8,null))[_0x5dc7('0x25')](removeEntity(_0x105ed8,null))['catch'](handleError(_0x105ed8,null));};exports[_0x5dc7('0x4c')]=function(_0x4b9aec,_0x33dedd){return db[_0x5dc7('0x2b')][_0x5dc7('0x4c')]()[_0x5dc7('0x25')](respondWithResult(_0x33dedd,null))['catch'](handleError(_0x33dedd,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 92995fd..58bf1f3 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 _0x69d4=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','uniqueid'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0x69d4,0x18c));var _0x469d=function(_0x5f46e7,_0x62f9f8){_0x5f46e7=_0x5f46e7-0x0;var _0x567e95=_0x69d4[_0x5f46e7];return _0x567e95;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x469d('0x0'))(_0x469d('0x1'));var moment=require(_0x469d('0x2'));var BPromise=require('bluebird');var rp=require(_0x469d('0x3'));var fs=require('fs');var path=require(_0x469d('0x4'));var rimraf=require(_0x469d('0x5'));var config=require(_0x469d('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x469d('0x7')]=function(_0x1f7305,_0x449970){return _0x1f7305[_0x469d('0x8')](_0x469d('0x9'),attributes,{'tableName':_0x469d('0xa'),'paranoid':![],'indexes':[{'name':_0x469d('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x717d=['../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x22ba76,_0x40395b){var _0xb3aebe=function(_0x15aa7b){while(--_0x15aa7b){_0x22ba76['push'](_0x22ba76['shift']());}};_0xb3aebe(++_0x40395b);}(_0x717d,0xaf));var _0xd717=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0x717d[_0x46cf00];return _0x3974dc;};'use strict';var _=require('lodash');var util=require(_0xd717('0x0'));var logger=require(_0xd717('0x1'))(_0xd717('0x2'));var moment=require(_0xd717('0x3'));var BPromise=require(_0xd717('0x4'));var rp=require(_0xd717('0x5'));var fs=require('fs');var path=require(_0xd717('0x6'));var rimraf=require('rimraf');var config=require(_0xd717('0x7'));var attributes=require('./chatTransferReport.attributes');module[_0xd717('0x8')]=function(_0x1773e3,_0x9dd627){return _0x1773e3[_0xd717('0x9')](_0xd717('0xa'),attributes,{'tableName':_0xd717('0xb'),'paranoid':![],'indexes':[{'name':_0xd717('0xc'),'fields':[_0xd717('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 9e89692..a531751 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 _0x98f6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x98f6,0x8c));var _0x698f=function(_0x13b3b5,_0x52d8d8){_0x13b3b5=_0x13b3b5-0x0;var _0x337cd0=_0x98f6[_0x13b3b5];return _0x337cd0;};'use strict';var _=require(_0x698f('0x0'));var util=require(_0x698f('0x1'));var moment=require(_0x698f('0x2'));var BPromise=require(_0x698f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x698f('0x4'));var db=require(_0x698f('0x5'))['db'];var utils=require(_0x698f('0x6'));var logger=require(_0x698f('0x7'))(_0x698f('0x8'));var config=require('../../config/environment');var jayson=require(_0x698f('0x9'));var client=jayson[_0x698f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x960efd,_0x3e717a,_0xccf45e){return new BPromise(function(_0x1a4ebc,_0x318a6b){return client[_0x698f('0xb')](_0x960efd,_0xccf45e)[_0x698f('0xc')](function(_0x208513){logger['info'](_0x698f('0xd'),_0x3e717a,_0x698f('0xe'));logger[_0x698f('0xf')](_0x698f('0x10'),_0x3e717a,_0x698f('0xe'),JSON[_0x698f('0x11')](_0x208513));if(_0x208513[_0x698f('0x12')]){if(_0x208513[_0x698f('0x12')][_0x698f('0x13')]===0x1f4){logger[_0x698f('0x12')](_0x698f('0xd'),_0x3e717a,_0x208513['error'][_0x698f('0x14')]);return _0x318a6b(_0x208513[_0x698f('0x12')]['message']);}logger[_0x698f('0x12')](_0x698f('0xd'),_0x3e717a,_0x208513[_0x698f('0x12')]['message']);return _0x1a4ebc(_0x208513[_0x698f('0x12')][_0x698f('0x14')]);}else{logger[_0x698f('0x15')]('ChatTransferReport,\x20%s,\x20%s',_0x3e717a,'request\x20sent');_0x1a4ebc(_0x208513[_0x698f('0x16')][_0x698f('0x14')]);}})[_0x698f('0x17')](function(_0x1374ca){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x3e717a,_0x1374ca);_0x318a6b(_0x1374ca);});});} \ No newline at end of file +var _0x7f32=['stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x7f32,0x78));var _0x27f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7f32[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x27f3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x27f3('0x1'));var fs=require('fs');var Redis=require(_0x27f3('0x2'));var db=require(_0x27f3('0x3'))['db'];var utils=require(_0x27f3('0x4'));var logger=require('../../config/logger')(_0x27f3('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x27f3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x575e01,_0x21d619,_0xef6d96){return new BPromise(function(_0x2bc4b5,_0x14f645){return client[_0x27f3('0x7')](_0x575e01,_0xef6d96)['then'](function(_0x2a621f){logger[_0x27f3('0x8')](_0x27f3('0x9'),_0x21d619,_0x27f3('0xa'));logger[_0x27f3('0xb')](_0x27f3('0xc'),_0x21d619,_0x27f3('0xa'),JSON[_0x27f3('0xd')](_0x2a621f));if(_0x2a621f[_0x27f3('0xe')]){if(_0x2a621f[_0x27f3('0xe')][_0x27f3('0xf')]===0x1f4){logger[_0x27f3('0xe')](_0x27f3('0x9'),_0x21d619,_0x2a621f['error']['message']);return _0x14f645(_0x2a621f[_0x27f3('0xe')][_0x27f3('0x10')]);}logger[_0x27f3('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x21d619,_0x2a621f['error'][_0x27f3('0x10')]);return _0x2bc4b5(_0x2a621f[_0x27f3('0xe')][_0x27f3('0x10')]);}else{logger[_0x27f3('0x8')](_0x27f3('0x9'),_0x21d619,_0x27f3('0xa'));_0x2bc4b5(_0x2a621f[_0x27f3('0x11')]['message']);}})[_0x27f3('0x12')](function(_0x1292ff){logger[_0x27f3('0xe')](_0x27f3('0x9'),_0x21d619,_0x1292ff);_0x14f645(_0x1292ff);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 2574d4d..4af20aa 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 _0xdb09=['describe','/:id','show','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xdb09,0x94));var _0x9db0=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xdb09[_0x42245d];return _0x4b211a;};'use strict';var multer=require(_0x9db0('0x0'));var util=require(_0x9db0('0x1'));var path=require(_0x9db0('0x2'));var timeout=require('connect-timeout');var express=require(_0x9db0('0x3'));var router=express[_0x9db0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9db0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9db0('0x6'));var controller=require(_0x9db0('0x7'));router[_0x9db0('0x8')]('/',auth[_0x9db0('0x9')](),controller[_0x9db0('0xa')]);router[_0x9db0('0x8')](_0x9db0('0xb'),auth[_0x9db0('0x9')](),controller[_0x9db0('0xc')]);router['get'](_0x9db0('0xd'),auth[_0x9db0('0x9')](),controller[_0x9db0('0xe')]);router['post']('/',auth[_0x9db0('0x9')](),controller[_0x9db0('0xf')]);router[_0x9db0('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9db0('0x11')]('/:id',auth[_0x9db0('0x9')](),controller[_0x9db0('0x12')]);module[_0x9db0('0x13')]=router; \ No newline at end of file +var _0xf96d=['./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x606023,_0x26bf62){var _0x321b7a=function(_0x4c6ab0){while(--_0x4c6ab0){_0x606023['push'](_0x606023['shift']());}};_0x321b7a(++_0x26bf62);}(_0xf96d,0x1f0));var _0xdf96=function(_0x4bd1ec,_0x25336c){_0x4bd1ec=_0x4bd1ec-0x0;var _0x9c767b=_0xf96d[_0x4bd1ec];return _0x9c767b;};'use strict';var multer=require(_0xdf96('0x0'));var util=require(_0xdf96('0x1'));var path=require(_0xdf96('0x2'));var timeout=require(_0xdf96('0x3'));var express=require(_0xdf96('0x4'));var router=express[_0xdf96('0x5')]();var fs_extra=require(_0xdf96('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdf96('0x7'));var controller=require(_0xdf96('0x8'));router[_0xdf96('0x9')]('/',auth[_0xdf96('0xa')](),controller['index']);router[_0xdf96('0x9')](_0xdf96('0xb'),auth[_0xdf96('0xa')](),controller[_0xdf96('0xc')]);router[_0xdf96('0x9')](_0xdf96('0xd'),auth[_0xdf96('0xa')](),controller['show']);router[_0xdf96('0xe')]('/',auth['isAuthenticated'](),controller[_0xdf96('0xf')]);router['put'](_0xdf96('0xd'),auth[_0xdf96('0xa')](),controller['update']);router[_0xdf96('0x10')](_0xdf96('0xd'),auth[_0xdf96('0xa')](),controller['destroy']);module[_0xdf96('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 1875573..25c4c71 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 _0xa67c=['offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','randomstring','exports','address','STRING','email','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Send','Feedback','star','thumb','stringify','name','text','input','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments'];(function(_0x3b08de,_0x63ddd0){var _0x53fbe4=function(_0x16eea2){while(--_0x16eea2){_0x3b08de['push'](_0x3b08de['shift']());}};_0x53fbe4(++_0x63ddd0);}(_0xa67c,0x187));var _0xca67=function(_0x4a88d1,_0x353ff6){_0x4a88d1=_0x4a88d1-0x0;var _0x3918ab=_0xa67c[_0x4a88d1];return _0x3918ab;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xca67('0x0'));module[_0xca67('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xca67('0x2')},'description':{'type':Sequelize[_0xca67('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xca67('0x4')},'mapKeyOffline':{'type':Sequelize[_0xca67('0x3')],'defaultValue':_0xca67('0x4')},'key':{'type':Sequelize[_0xca67('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xca67('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xca67('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xca67('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xca67('0x3')],'allowNull':![],'defaultValue':_0xca67('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xca67('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xca67('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xca67('0x8')]('rounded','squared'),'defaultValue':_0xca67('0x9')},'header_online':{'type':Sequelize[_0xca67('0x3')],'defaultValue':_0xca67('0xa')},'start_chat_button':{'type':Sequelize[_0xca67('0x3')],'defaultValue':_0xca67('0xb')},'offline_chat_button':{'type':Sequelize[_0xca67('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xca67('0xc')},'download_transcript':{'type':Sequelize[_0xca67('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xca67('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xca67('0x3')],'defaultValue':_0xca67('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xca67('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xca67('0xe')]},'closingQuestion':{'type':Sequelize[_0xca67('0x3')],'defaultValue':_0xca67('0xf')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xca67('0x3')],'defaultValue':_0xca67('0x10')},'placeholderMessage':{'type':Sequelize[_0xca67('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xca67('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xca67('0x3')],'defaultValue':_0xca67('0x11')},'skipMessageButton':{'type':Sequelize[_0xca67('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xca67('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xca67('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xca67('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xca67('0x3')],'defaultValue':_0xca67('0x12')},'ratingType':{'type':Sequelize[_0xca67('0x8')](_0xca67('0x13'),_0xca67('0x14')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xca67('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xca67('0xe')],'defaultValue':function(){return JSON[_0xca67('0x15')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xca67('0x16'),'type':_0xca67('0x17'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xca67('0x18'),'props':{'title':_0xca67('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xca67('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xca67('0x19')](_0xca67('0x1a'))?JSON[_0xca67('0x1b')](this[_0xca67('0x19')]('onlineForm')):{};},'set':function(_0x192277){return this[_0xca67('0x1c')](_0xca67('0x1a'),JSON[_0xca67('0x15')](_0x192277));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xca67('0x15')]({'items':[{'type':_0xca67('0x18'),'props':{'title':_0xca67('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xca67('0x4')},'variable':null},{'type':_0xca67('0x1d'),'config':{'placeholder':'Comments'},'props':{'title':_0xca67('0x1e'),'helpText':_0xca67('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0xca67('0x19')](_0xca67('0x20'))?JSON[_0xca67('0x1b')](this[_0xca67('0x19')](_0xca67('0x20'))):{};},'set':function(_0x5882d2){return this[_0xca67('0x1c')]('offlineForm',JSON[_0xca67('0x15')](_0x5882d2));}},'token':{'type':Sequelize[_0xca67('0x3')],'defaultValue':function(){return rs[_0xca67('0x21')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xca67('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xca67('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xca67('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xca67('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xca67('0x3')],'defaultValue':_0xca67('0x22')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xca67('0x3')],'defaultValue':_0xca67('0x23')},'enableUnmanagedNote':{'type':Sequelize[_0xca67('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xca67('0x3')],'defaultValue':_0xca67('0x24')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xca67('0x11')},'enableCustomerAttachment':{'type':Sequelize[_0xca67('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xca67('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xca67('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xca67('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xca67('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xca67('0x25');}},'notificationSound':{'type':Sequelize[_0xca67('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xca67('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xca67('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xca67('0x3')],'defaultValue':_0xca67('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0xca67('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xca67('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xca67('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xca67('0x3')],'defaultValue':_0xca67('0x27')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xca67('0x28')},'defaultTitle':{'type':Sequelize[_0xca67('0x3')]},'customerAvatar':{'type':Sequelize[_0xca67('0xe')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xca67('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xca67('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xca67('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xca67('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xca67('0x3')],'defaultValue':_0xca67('0x2a')},'systemAvatar':{'type':Sequelize[_0xca67('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xca67('0x2b')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xca67('0x2c'),'set':function(_0x47d2d3){if(!_0x47d2d3)this[_0xca67('0x1c')]('mandatoryDispositionPauseId',null);this[_0xca67('0x1c')](_0xca67('0x2d'),_0x47d2d3);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xca67('0x3')]},'vidaooTopic':{'type':Sequelize[_0xca67('0x3')],'allowNull':![],'defaultValue':_0xca67('0x2e')},'vidaooNote':{'type':Sequelize[_0xca67('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xca67('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xca67('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xd756=['Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','input','name','text','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xd756,0xbe));var _0x6d75=function(_0x1999fe,_0x22e290){_0x1999fe=_0x1999fe-0x0;var _0x3e2df8=_0xd756[_0x1999fe];return _0x3e2df8;};'use strict';var Sequelize=require(_0x6d75('0x0'));var rs=require(_0x6d75('0x1'));module[_0x6d75('0x2')]={'name':{'type':Sequelize[_0x6d75('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x6d75('0x3')],'allowNull':![],'unique':_0x6d75('0x4')},'description':{'type':Sequelize[_0x6d75('0x3')]},'mapKey':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0x5')},'mapKeyOffline':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x6d75('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6d75('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6d75('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6d75('0x3')],'allowNull':![],'defaultValue':_0x6d75('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6d75('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6d75('0x3')]},'animation':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded','squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0xa')},'start_chat_button':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0xb')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x6d75('0xc')},'download_transcript':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6d75('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x6d75('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6d75('0xe')]},'closingQuestion':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0x11')},'noteTitle':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0x12')},'placeholderMessage':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0x13')},'closingMessage':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x6d75('0xb')},'skipMessageButton':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0x15')},'conditionAgreement':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0x16')},'ratingType':{'type':Sequelize[_0x6d75('0x17')](_0x6d75('0x18'),'thumb'),'defaultValue':_0x6d75('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x6d75('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6d75('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x6d75('0x19'),'variable':null,'config':{'placeholder':_0x6d75('0x1a'),'type':_0x6d75('0x1b'),'required':!![]},'props':{'title':_0x6d75('0x1a'),'helpText':''}},{'type':_0x6d75('0x19'),'props':{'title':_0x6d75('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x6d75('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6d75('0x1c')](_0x6d75('0x1d'))?JSON[_0x6d75('0x1e')](this[_0x6d75('0x1c')](_0x6d75('0x1d'))):{};},'set':function(_0x29b4d1){return this[_0x6d75('0x1f')](_0x6d75('0x1d'),JSON[_0x6d75('0x20')](_0x29b4d1));}},'offlineForm':{'type':Sequelize[_0x6d75('0xe')],'defaultValue':function(){return JSON[_0x6d75('0x20')]({'items':[{'type':_0x6d75('0x19'),'props':{'title':_0x6d75('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x6d75('0x5'),'type':'email'},'variable':null},{'type':_0x6d75('0x21'),'config':{'placeholder':_0x6d75('0x22')},'props':{'title':_0x6d75('0x22'),'helpText':_0x6d75('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x6d75('0x1c')](_0x6d75('0x24'))?JSON[_0x6d75('0x1e')](this[_0x6d75('0x1c')](_0x6d75('0x24'))):{};},'set':function(_0x2767f0){return this[_0x6d75('0x1f')](_0x6d75('0x24'),JSON[_0x6d75('0x20')](_0x2767f0));}},'token':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':function(){return rs[_0x6d75('0x25')]();}},'autoclose':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6d75('0x3')]},'forwardOffline':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0x26')},'waitingMessage':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0x28')},'offlineMessageBody':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6d75('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6d75('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6d75('0xe')],'defaultValue':function(){return _0x6d75('0x2a');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x6d75('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6d75('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x6d75('0x2c')},'verticalAlignment':{'type':Sequelize[_0x6d75('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':_0x6d75('0x2d')},'messagesAlignment':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x6d75('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6d75('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6d75('0x3')],'allowNull':![],'defaultValue':_0x6d75('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6d75('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x6d75('0x2f')},'systemAvatar':{'type':Sequelize[_0x6d75('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6d75('0x8')],'comment':_0x6d75('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':![],'comment':_0x6d75('0x31'),'set':function(_0x2d7e59){if(!_0x2d7e59)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x6d75('0x1f')](_0x6d75('0x32'),_0x2d7e59);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6d75('0x3')]},'vidaooTopic':{'type':Sequelize[_0x6d75('0x3')],'allowNull':![],'defaultValue':_0x6d75('0x33')},'vidaooNote':{'type':Sequelize[_0x6d75('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x6d75('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6d75('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6d75('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 08665b5..4028b0d 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 _0x0b0e=['mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','mimetype','server','files','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','forwardOffline','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','email','offlineMessageSubject','MailAccountId','originalname','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','attachments','remove','addInteraction','getInteractions','User','Owner','internal','Tag','Tags','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','getProactiveActions','virtual','License','chatLicenseExceeded','Intervals','all','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','labelText','color_button','backgroundColor','addApplications','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','addProactiveActions','chatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','omit','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','html-to-text','jayson/promise','http','client','request','then','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','ChatWebsiteId','Disposition','getDispositions','rawAttributes','findAll','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','ids','addLogo','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','sitepic','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','existsSync','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','setUA','headers','user-agent','getResult','chat','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','orderBy','defaults','ListId','CmContact','contact','customerIp','cf-connecting-ip','first','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','externalUrl','interaction','ChatInteraction','spread','lastName','messageId','created','push','*,*,*,*','AttachmentId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','mapKeyOffline'];(function(_0x28d086,_0x173545){var _0x384a21=function(_0x481810){while(--_0x481810){_0x28d086['push'](_0x28d086['shift']());}};_0x384a21(++_0x173545);}(_0x0b0e,0x187));var _0xe0b0=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0x0b0e[_0x10c16d];return _0x5896f4;};'use strict';var BPromise=require(_0xe0b0('0x0'));var Mustache=require('mustache');var util=require(_0xe0b0('0x1'));var path=require('path');var ejs=require(_0xe0b0('0x2'));var fs=require('fs');var fs_extra=require(_0xe0b0('0x3'));var _=require(_0xe0b0('0x4'));var querystring=require(_0xe0b0('0x5'));var Redis=require(_0xe0b0('0x6'));var qs=require(_0xe0b0('0x7'));var logger=require(_0xe0b0('0x8'))(_0xe0b0('0x9'));var config=require(_0xe0b0('0xa'));var db=require(_0xe0b0('0xb'))['db'];config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);var htmlToText=require(_0xe0b0('0x10'));var jayson=require(_0xe0b0('0x11'));var client=jayson['client'][_0xe0b0('0x12')]({'port':0x232c});var client9002=jayson[_0xe0b0('0x13')]['http']({'port':0x232a});var client9003=jayson[_0xe0b0('0x13')][_0xe0b0('0x12')]({'port':0x232b});var client9001=jayson[_0xe0b0('0x13')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3068c0,_0x1c358a,_0x3cc19a,_0x45f914){return new BPromise(function(_0x34fed4,_0x4d2bf7){var _0x3782be=_0x45f914||client;return _0x3782be[_0xe0b0('0x14')](_0x3068c0,_0x3cc19a)[_0xe0b0('0x15')](function(_0x24babd){logger[_0xe0b0('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x1c358a,_0xe0b0('0x17'));logger['debug'](_0xe0b0('0x18'),_0x1c358a,_0xe0b0('0x17'),JSON['stringify'](_0x24babd));if(_0x24babd[_0xe0b0('0x19')]){if(_0x24babd['error'][_0xe0b0('0x1a')]===0x1f4){logger[_0xe0b0('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x1c358a,_0x24babd['error'][_0xe0b0('0x1b')]);return _0x4d2bf7(_0x24babd['error']['message']);}logger['error'](_0xe0b0('0x1c'),_0x1c358a,_0x24babd['error']['message']);return _0x34fed4(_0x24babd[_0xe0b0('0x19')]['message']);}else{logger[_0xe0b0('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x1c358a,_0xe0b0('0x17'));_0x34fed4(_0x24babd[_0xe0b0('0x1d')][_0xe0b0('0x1b')]);}})[_0xe0b0('0x1e')](function(_0x2cf6a1){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1c358a,_0x2cf6a1);_0x4d2bf7(_0x2cf6a1);});});}function respondWithStatusCode(_0x2fa820,_0x5512bb){_0x5512bb=_0x5512bb||0xcc;return function(_0x12b260){if(_0x12b260){return _0x2fa820[_0xe0b0('0x1f')](_0x5512bb);}return _0x2fa820['status'](_0x5512bb)[_0xe0b0('0x20')]();};}function respondWithResult(_0x503883,_0x2208d0){_0x2208d0=_0x2208d0||0xc8;return function(_0x49a727){if(_0x49a727){return _0x503883[_0xe0b0('0x21')](_0x2208d0)['json'](_0x49a727);}};}function respondWithFilteredResult(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(_0x4700cc){var _0x4aafbe=typeof _0x4de537[_0xe0b0('0x22')]==='undefined'&&typeof _0x4de537[_0xe0b0('0x23')]===_0xe0b0('0x24');var _0x1f1ebd=_0x4700cc[_0xe0b0('0x25')];var _0x3ec2=_0x4aafbe?0x0:_0x4de537[_0xe0b0('0x22')];var _0x5200a6=_0x4aafbe?_0x4700cc[_0xe0b0('0x25')]:_0x4de537[_0xe0b0('0x22')]+_0x4de537['limit'];var _0x15e13b;if(_0x5200a6>=_0x1f1ebd){_0x5200a6=_0x1f1ebd;_0x15e13b=0xc8;}else{_0x15e13b=0xce;}_0x3e5c88[_0xe0b0('0x21')](_0x15e13b);return _0x3e5c88[_0xe0b0('0x26')](_0xe0b0('0x27'),_0x3ec2+'-'+_0x5200a6+'/'+_0x1f1ebd)[_0xe0b0('0x28')](_0x4700cc);}return null;};}function saveUpdates(_0x254cad){return function(_0x136bd4){if(_0x136bd4){return _0x136bd4['update'](_0x254cad)[_0xe0b0('0x15')](function(_0x3c0109){return _0x3c0109;});}return null;};}function removeEntity(_0x48a9b5){return function(_0x4fe400){if(_0x4fe400){return _0x4fe400[_0xe0b0('0x29')]()[_0xe0b0('0x15')](function(){var _0x422575=_0x4fe400[_0xe0b0('0x2a')]({'plain':!![]});var _0x2ab1b1='ChatWebsites';return db[_0xe0b0('0x2b')][_0xe0b0('0x29')]({'where':{'type':_0x2ab1b1,'resourceId':_0x422575['id']}})[_0xe0b0('0x15')](function(){return _0x4fe400;});})[_0xe0b0('0x15')](function(){_0x48a9b5[_0xe0b0('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ebf2a){return function(_0x208945){if(!_0x208945){_0x3ebf2a[_0xe0b0('0x1f')](0x194);}return _0x208945;};}function handleError(_0x31c6f5,_0x3575bc){_0x3575bc=_0x3575bc||0x1f4;return function(_0x12eeb8){logger[_0xe0b0('0x19')](_0x12eeb8[_0xe0b0('0x2c')]);if(_0x12eeb8[_0xe0b0('0x2d')]){delete _0x12eeb8[_0xe0b0('0x2d')];}_0x31c6f5[_0xe0b0('0x21')](_0x3575bc)[_0xe0b0('0x2e')](_0x12eeb8);};}exports[_0xe0b0('0x2f')]=function(_0x2a1c44,_0xca25d){var _0x4cf80c={'include':[{'model':db[_0xe0b0('0x30')],'as':_0xe0b0('0x31')}]},_0x121608={},_0x135be5={'count':0x0,'rows':[]};var _0x1a2d24=_[_0xe0b0('0x32')](db[_0xe0b0('0x33')]['rawAttributes'],function(_0x521243){return{'name':_0x521243['fieldName'],'type':_0x521243['type'][_0xe0b0('0x34')]};});_0x121608[_0xe0b0('0x35')]=_[_0xe0b0('0x32')](_0x1a2d24,'name');_0x121608[_0xe0b0('0x36')]=_[_0xe0b0('0x37')](_0x2a1c44[_0xe0b0('0x36')]);_0x121608[_0xe0b0('0x38')]=_['intersection'](_0x121608[_0xe0b0('0x35')],_0x121608[_0xe0b0('0x36')]);_0x4cf80c[_0xe0b0('0x39')]=_[_0xe0b0('0x3a')](_0x121608[_0xe0b0('0x35')],qs[_0xe0b0('0x3b')](_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x4cf80c[_0xe0b0('0x39')]=_0x4cf80c['attributes'][_0xe0b0('0x3c')]?_0x4cf80c['attributes']:_0x121608[_0xe0b0('0x35')];if(!_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x3d')](_0xe0b0('0x3e'))){_0x4cf80c['limit']=qs[_0xe0b0('0x23')](_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x23')]);_0x4cf80c[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x22')]);}_0x4cf80c[_0xe0b0('0x3f')]=qs['sort'](_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x40')]);_0x4cf80c['where']=qs['filters'](_[_0xe0b0('0x41')](_0x2a1c44[_0xe0b0('0x36')],_0x121608['filters']),_0x1a2d24);if(_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x42')]){_0x4cf80c[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x4cf80c[_0xe0b0('0x43')],{'$or':_['map'](_0x1a2d24,function(_0x5d2fa2){if(_0x5d2fa2['type']!==_0xe0b0('0x45')){var _0x38e715={};_0x38e715[_0x5d2fa2['name']]={'$like':'%'+_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x38e715;}})});}_0x4cf80c=_[_0xe0b0('0x44')]({},_0x4cf80c,_0x2a1c44[_0xe0b0('0x46')]);var _0x16ccca={'where':_0x4cf80c['where']};return db['ChatWebsite'][_0xe0b0('0x25')](_0x16ccca)[_0xe0b0('0x15')](function(_0x393218){_0x135be5[_0xe0b0('0x25')]=_0x393218;if(_0x2a1c44[_0xe0b0('0x36')]['includeAll']){_0x4cf80c[_0xe0b0('0x47')]=[{'all':!![]}];}return db[_0xe0b0('0x33')]['findAll'](_0x4cf80c);})['then'](function(_0x5ddad1){_0x135be5[_0xe0b0('0x48')]=_0x5ddad1;return _0x135be5;})[_0xe0b0('0x15')](respondWithFilteredResult(_0xca25d,_0x4cf80c))[_0xe0b0('0x1e')](handleError(_0xca25d,null));};exports[_0xe0b0('0x49')]=function(_0x5b1756,_0x2e2b10){var _0x87d8f3={'raw':![],'where':{'id':_0x5b1756['params']['id']},'include':[{'model':db[_0xe0b0('0x30')],'as':_0xe0b0('0x31')}]},_0x483f12={};_0x483f12['model']=_[_0xe0b0('0x37')](db[_0xe0b0('0x33')]['rawAttributes']);_0x483f12['query']=_[_0xe0b0('0x37')](_0x5b1756['query']);_0x483f12[_0xe0b0('0x38')]=_[_0xe0b0('0x3a')](_0x483f12[_0xe0b0('0x35')],_0x483f12[_0xe0b0('0x36')]);_0x87d8f3[_0xe0b0('0x39')]=_[_0xe0b0('0x3a')](_0x483f12['model'],qs['fields'](_0x5b1756[_0xe0b0('0x36')]['fields']));_0x87d8f3['attributes']=_0x87d8f3[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x87d8f3['attributes']:_0x483f12['model'];if(_0x5b1756[_0xe0b0('0x36')][_0xe0b0('0x4a')]){_0x87d8f3[_0xe0b0('0x47')]=[{'all':!![]}];}_0x87d8f3=_[_0xe0b0('0x44')]({},_0x87d8f3,_0x5b1756[_0xe0b0('0x46')]);return db[_0xe0b0('0x33')][_0xe0b0('0x4b')](_0x87d8f3)['then'](handleEntityNotFound(_0x2e2b10,null))[_0xe0b0('0x15')](respondWithResult(_0x2e2b10,null))['catch'](handleError(_0x2e2b10,null));};exports[_0xe0b0('0x4c')]=function(_0x54106c,_0x5b2055){return db[_0xe0b0('0x33')][_0xe0b0('0x4c')](_0x54106c[_0xe0b0('0x4d')],{})[_0xe0b0('0x15')](function(_0x3d8013){var _0x2a588d=_0x54106c[_0xe0b0('0x4e')][_0xe0b0('0x2a')]({'plain':!![]});if(!_0x2a588d)throw new Error(_0xe0b0('0x4f'));if(_0x2a588d['role']===_0xe0b0('0x4e')){var _0x57ccc9=_0x3d8013[_0xe0b0('0x2a')]({'plain':!![]});var _0x3ae36e=_0xe0b0('0x50');return db[_0xe0b0('0x51')][_0xe0b0('0x4b')]({'where':{'name':_0x3ae36e,'userProfileId':_0x2a588d[_0xe0b0('0x52')]},'raw':!![]})['then'](function(_0x1a057c){if(_0x1a057c&&_0x1a057c[_0xe0b0('0x53')]===0x0){return db[_0xe0b0('0x2b')][_0xe0b0('0x4c')]({'name':_0x57ccc9[_0xe0b0('0x2d')],'resourceId':_0x57ccc9['id'],'type':_0x1a057c[_0xe0b0('0x2d')],'sectionId':_0x1a057c['id']},{})[_0xe0b0('0x15')](function(){return _0x3d8013;});}else{return _0x3d8013;}})[_0xe0b0('0x1e')](function(_0x85824c){logger[_0xe0b0('0x19')](_0xe0b0('0x54'),_0x85824c);throw _0x85824c;});}return _0x3d8013;})[_0xe0b0('0x15')](respondWithResult(_0x5b2055,0xc9))[_0xe0b0('0x1e')](handleError(_0x5b2055,null));};exports[_0xe0b0('0x55')]=function(_0xcdf97,_0x34c642){if(_0xcdf97[_0xe0b0('0x4d')]['id']){delete _0xcdf97[_0xe0b0('0x4d')]['id'];}return db['ChatWebsite'][_0xe0b0('0x4b')]({'where':{'id':_0xcdf97[_0xe0b0('0x56')]['id']},'include':[{'model':db[_0xe0b0('0x30')],'as':_0xe0b0('0x31')}]})[_0xe0b0('0x15')](handleEntityNotFound(_0x34c642,null))[_0xe0b0('0x15')](saveUpdates(_0xcdf97[_0xe0b0('0x4d')],null))['then'](respondWithResult(_0x34c642,null))['catch'](handleError(_0x34c642,null));};exports[_0xe0b0('0x29')]=function(_0x2a0415,_0x157556){return db['ChatWebsite'][_0xe0b0('0x4b')]({'where':{'id':_0x2a0415[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x157556,null))[_0xe0b0('0x15')](removeEntity(_0x157556,null))[_0xe0b0('0x1e')](handleError(_0x157556,null));};exports['describe']=function(_0x370f8c,_0x242120){return db[_0xe0b0('0x33')]['describe']()[_0xe0b0('0x15')](respondWithResult(_0x242120,null))[_0xe0b0('0x1e')](handleError(_0x242120,null));};exports['addDisposition']=function(_0x1bd249,_0x4c5478){if(_0x1bd249['body']['id']){delete _0x1bd249[_0xe0b0('0x4d')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x1bd249[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x4c5478,null))[_0xe0b0('0x15')](function(_0x1a4fad){if(_0x1a4fad){_0x1bd249['body'][_0xe0b0('0x57')]=_0x1a4fad['id'];return db[_0xe0b0('0x58')][_0xe0b0('0x4c')](_0x1bd249[_0xe0b0('0x4d')]);}})[_0xe0b0('0x15')](respondWithResult(_0x4c5478,null))[_0xe0b0('0x1e')](handleError(_0x4c5478,null));};exports[_0xe0b0('0x59')]=function(_0x224f1e,_0x514df5){var _0x51940f={'raw':![],'where':{}};var _0x4b41a={};var _0x35144f={'count':0x0,'rows':[]};return db[_0xe0b0('0x33')]['findOne']({'where':{'id':_0x224f1e['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x514df5,null))[_0xe0b0('0x15')](function(_0x5d7cf4){if(_0x5d7cf4){_0x4b41a['model']=_[_0xe0b0('0x37')](db[_0xe0b0('0x58')][_0xe0b0('0x5a')]);_0x4b41a[_0xe0b0('0x36')]=_[_0xe0b0('0x37')](_0x224f1e[_0xe0b0('0x36')]);_0x4b41a[_0xe0b0('0x38')]=_[_0xe0b0('0x3a')](_0x4b41a['model'],_0x4b41a[_0xe0b0('0x36')]);_0x51940f[_0xe0b0('0x39')]=_[_0xe0b0('0x3a')](_0x4b41a['model'],qs['fields'](_0x224f1e['query']['fields']));_0x51940f['attributes']=_0x51940f['attributes'][_0xe0b0('0x3c')]?_0x51940f['attributes']:_0x4b41a['model'];if(!_0x224f1e[_0xe0b0('0x36')][_0xe0b0('0x3d')](_0xe0b0('0x3e'))){_0x51940f[_0xe0b0('0x23')]=qs[_0xe0b0('0x23')](_0x224f1e[_0xe0b0('0x36')][_0xe0b0('0x23')]);_0x51940f[_0xe0b0('0x22')]=qs['offset'](_0x224f1e[_0xe0b0('0x36')][_0xe0b0('0x22')]);}_0x51940f[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x224f1e[_0xe0b0('0x36')][_0xe0b0('0x40')]);_0x51940f[_0xe0b0('0x43')]=qs['filters'](_[_0xe0b0('0x41')](_0x224f1e['query'],_0x4b41a[_0xe0b0('0x38')]));_0x51940f[_0xe0b0('0x43')][_0xe0b0('0x57')]=_0x5d7cf4['id'];if(_0x224f1e[_0xe0b0('0x36')]['filter']){_0x51940f[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x51940f['where'],{'$or':_['map'](_0x51940f[_0xe0b0('0x39')],function(_0x30adc5){var _0x196625={};_0x196625[_0x30adc5]={'$like':'%'+_0x224f1e[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x196625;})});}_0x51940f=_[_0xe0b0('0x44')]({},_0x51940f,_0x224f1e[_0xe0b0('0x46')]);return db[_0xe0b0('0x58')][_0xe0b0('0x25')]({'where':_0x51940f[_0xe0b0('0x43')]})['then'](function(_0x4c512b){_0x35144f[_0xe0b0('0x25')]=_0x4c512b;if(_0x224f1e['query']['includeAll']){_0x51940f['include']=[{'all':!![]}];}return db['Disposition'][_0xe0b0('0x5b')](_0x51940f);})['then'](function(_0x654d2b){_0x35144f[_0xe0b0('0x48')]=_0x654d2b;return _0x35144f;});}})[_0xe0b0('0x15')](respondWithFilteredResult(_0x514df5,_0x51940f))[_0xe0b0('0x1e')](handleError(_0x514df5,null));};exports['removeDispositions']=function(_0x31b218,_0x948708){return db['ChatWebsite'][_0xe0b0('0x4b')]({'where':{'id':_0x31b218[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x948708,null))[_0xe0b0('0x15')](function(_0x27af09){if(_0x27af09){return _0x27af09['removeDispositions'](_0x31b218['query']['ids']);}})['then'](respondWithStatusCode(_0x948708,null))['catch'](handleError(_0x948708,null));};exports[_0xe0b0('0x5c')]=function(_0x567e1a,_0x3c09af){if(_0x567e1a['body']['id']){delete _0x567e1a[_0xe0b0('0x4d')]['id'];}return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x567e1a[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x3c09af,null))[_0xe0b0('0x15')](function(_0x58da19){if(_0x58da19){_0x567e1a['body']['ChatWebsiteId']=_0x58da19['id'];return db['CannedAnswer'][_0xe0b0('0x4c')](_0x567e1a[_0xe0b0('0x4d')]);}})[_0xe0b0('0x15')](respondWithResult(_0x3c09af,null))[_0xe0b0('0x1e')](handleError(_0x3c09af,null));};exports[_0xe0b0('0x5d')]=function(_0x534881,_0x234716){var _0x39a07b={'raw':![],'where':{}};var _0xf77616={};var _0xc6090e={'count':0x0,'rows':[]};return db[_0xe0b0('0x33')][_0xe0b0('0x5e')]({'where':{'id':_0x534881[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x234716,null))[_0xe0b0('0x15')](function(_0x5565ef){if(_0x5565ef){_0xf77616['model']=_[_0xe0b0('0x37')](db[_0xe0b0('0x5f')]['rawAttributes']);_0xf77616[_0xe0b0('0x36')]=_[_0xe0b0('0x37')](_0x534881[_0xe0b0('0x36')]);_0xf77616[_0xe0b0('0x38')]=_[_0xe0b0('0x3a')](_0xf77616[_0xe0b0('0x35')],_0xf77616[_0xe0b0('0x36')]);_0x39a07b[_0xe0b0('0x39')]=_['intersection'](_0xf77616['model'],qs['fields'](_0x534881[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x39a07b['attributes']=_0x39a07b[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x39a07b[_0xe0b0('0x39')]:_0xf77616[_0xe0b0('0x35')];if(!_0x534881['query']['hasOwnProperty']('nolimit')){_0x39a07b[_0xe0b0('0x23')]=qs[_0xe0b0('0x23')](_0x534881['query'][_0xe0b0('0x23')]);_0x39a07b[_0xe0b0('0x22')]=qs['offset'](_0x534881['query'][_0xe0b0('0x22')]);}_0x39a07b['order']=qs[_0xe0b0('0x40')](_0x534881['query'][_0xe0b0('0x40')]);_0x39a07b[_0xe0b0('0x43')]=qs[_0xe0b0('0x38')](_[_0xe0b0('0x41')](_0x534881[_0xe0b0('0x36')],_0xf77616[_0xe0b0('0x38')]));_0x39a07b[_0xe0b0('0x43')][_0xe0b0('0x57')]=_0x5565ef['id'];if(_0x534881[_0xe0b0('0x36')]['filter']){_0x39a07b[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x39a07b[_0xe0b0('0x43')],{'$or':_['map'](_0x39a07b[_0xe0b0('0x39')],function(_0x4ad24f){var _0x328c96={};_0x328c96[_0x4ad24f]={'$like':'%'+_0x534881[_0xe0b0('0x36')]['filter']+'%'};return _0x328c96;})});}_0x39a07b=_[_0xe0b0('0x44')]({},_0x39a07b,_0x534881['options']);return db['CannedAnswer'][_0xe0b0('0x25')]({'where':_0x39a07b['where']})['then'](function(_0x4f027c){_0xc6090e[_0xe0b0('0x25')]=_0x4f027c;if(_0x534881[_0xe0b0('0x36')][_0xe0b0('0x4a')]){_0x39a07b[_0xe0b0('0x47')]=[{'all':!![]}];}return db[_0xe0b0('0x5f')]['findAll'](_0x39a07b);})[_0xe0b0('0x15')](function(_0x4609d5){_0xc6090e[_0xe0b0('0x48')]=_0x4609d5;return _0xc6090e;});}})['then'](respondWithFilteredResult(_0x234716,_0x39a07b))[_0xe0b0('0x1e')](handleError(_0x234716,null));};exports[_0xe0b0('0x60')]=function(_0x5817aa,_0x5854ea){return db[_0xe0b0('0x33')]['find']({'where':{'id':_0x5817aa[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x5854ea,null))[_0xe0b0('0x15')](function(_0x7ae597){if(_0x7ae597){return _0x7ae597[_0xe0b0('0x60')](_0x5817aa[_0xe0b0('0x36')][_0xe0b0('0x61')]);}})['then'](respondWithStatusCode(_0x5854ea,null))[_0xe0b0('0x1e')](handleError(_0x5854ea,null));};exports[_0xe0b0('0x62')]=function(_0x135fec,_0x42add7){_0x135fec[_0xe0b0('0x4d')]['sitepic']=_0x135fec['file'][_0xe0b0('0x63')];return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x135fec[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x42add7,null))[_0xe0b0('0x15')](saveUpdates(_0x135fec[_0xe0b0('0x4d')],null))[_0xe0b0('0x15')](respondWithResult(_0x42add7,null))[_0xe0b0('0x1e')](handleError(_0x42add7,null));};exports[_0xe0b0('0x64')]=function(_0x4fe048,_0xac45e6){_0x4fe048[_0xe0b0('0x4d')][_0xe0b0('0x65')]=_0x4fe048[_0xe0b0('0x66')]['filename'];return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x4fe048[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0xac45e6,null))[_0xe0b0('0x15')](saveUpdates(_0x4fe048['body'],null))[_0xe0b0('0x15')](respondWithResult(_0xac45e6,null))['catch'](handleError(_0xac45e6,null));};exports[_0xe0b0('0x67')]=function(_0x196ab7,_0x3d8f17){_0x196ab7[_0xe0b0('0x4d')][_0xe0b0('0x68')]=_0x196ab7['file']['filename'];return db[_0xe0b0('0x33')]['find']({'where':{'id':_0x196ab7[_0xe0b0('0x56')]['id']}})['then'](handleEntityNotFound(_0x3d8f17,null))[_0xe0b0('0x15')](saveUpdates(_0x196ab7[_0xe0b0('0x4d')],null))[_0xe0b0('0x15')](respondWithResult(_0x3d8f17,null))[_0xe0b0('0x1e')](handleError(_0x3d8f17,null));};exports[_0xe0b0('0x69')]=function(_0x1bb4da,_0x43ff30){_0x1bb4da['body']['systemAvatar']=_0x1bb4da[_0xe0b0('0x66')][_0xe0b0('0x63')];return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x1bb4da[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x43ff30,null))[_0xe0b0('0x15')](saveUpdates(_0x1bb4da[_0xe0b0('0x4d')],null))[_0xe0b0('0x15')](respondWithResult(_0x43ff30,null))[_0xe0b0('0x1e')](handleError(_0x43ff30,null));};exports['getLogo']=function(_0x4a4880,_0x3dd34e){var _0x26caf8=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x6c'));var _0x43c2bb={'where':{'id':_0x4a4880[_0xe0b0('0x56')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x4c4748=![];return require(_0xe0b0('0x6d'))[_0xe0b0('0x6e')]()[_0xe0b0('0x15')](function(_0x467f0e){if(_0x467f0e){_0x4c4748=_0x467f0e[_0xe0b0('0x6f')];}})[_0xe0b0('0x15')](function(){return db[_0xe0b0('0x33')][_0xe0b0('0x4b')](_0x43c2bb);})[_0xe0b0('0x15')](handleEntityNotFound(_0x3dd34e,null))[_0xe0b0('0x15')](function(_0x4cbe35){if(_0x4cbe35){if(!_[_0xe0b0('0x70')](_0x4cbe35[_0xe0b0('0x71')])){if(fs['existsSync'](path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x72'),_0x4cbe35[_0xe0b0('0x71')]))&&_0x4c4748){_0x26caf8=path[_0xe0b0('0x6a')](config['root'],_0xe0b0('0x72'),_0x4cbe35[_0xe0b0('0x71')]);}}return _0x3dd34e[_0xe0b0('0x73')](_0x26caf8);}})[_0xe0b0('0x1e')](handleError(_0x3dd34e,null));};exports[_0xe0b0('0x74')]=function(_0x5f1fd3,_0x475404){var _0x58d61b=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x75'));var _0x539a12={'where':{'id':_0x5f1fd3['params']['id']},'attributes':['id',_0xe0b0('0x65')],'raw':!![]};return db[_0xe0b0('0x33')][_0xe0b0('0x4b')](_0x539a12)['then'](handleEntityNotFound(_0x475404,null))['then'](function(_0x5da5eb){if(_0x5da5eb){if(!_['isNil'](_0x5da5eb['agentAvatar'])){if(fs['existsSync'](path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],'server/files/images/avatars/',_0x5da5eb[_0xe0b0('0x65')]))){_0x58d61b=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x76'),_0x5da5eb[_0xe0b0('0x65')]);}}return _0x475404['download'](_0x58d61b);}})['catch'](handleError(_0x475404,null));};exports[_0xe0b0('0x77')]=function(_0xd2dd5a,_0x3e592c){var _0x52dfd8=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x78'));var _0xd231c4={'where':{'id':_0xd2dd5a[_0xe0b0('0x56')]['id']},'attributes':['id',_0xe0b0('0x68'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0xd231c4)[_0xe0b0('0x15')](handleEntityNotFound(_0x3e592c,null))[_0xe0b0('0x15')](function(_0x9f9d8d){if(_0x9f9d8d){if(!_[_0xe0b0('0x70')](_0x9f9d8d[_0xe0b0('0x68')])){if(fs[_0xe0b0('0x79')](path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],'server/files/images/avatars/',_0x9f9d8d['customerAvatar']))&&_0x9f9d8d[_0xe0b0('0x7a')]){_0x52dfd8=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],'server/files/images/avatars/',_0x9f9d8d[_0xe0b0('0x68')]);}}return _0x3e592c[_0xe0b0('0x73')](_0x52dfd8);}})[_0xe0b0('0x1e')](handleError(_0x3e592c,null));};exports['getSystemAvatar']=function(_0x36fa1f,_0x4d2ca9){var _0x74693e=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x7b'));var _0x3b133a={'where':{'id':_0x36fa1f[_0xe0b0('0x56')]['id']},'attributes':['id',_0xe0b0('0x7c')],'raw':!![]};return db['ChatWebsite'][_0xe0b0('0x4b')](_0x3b133a)[_0xe0b0('0x15')](handleEntityNotFound(_0x4d2ca9,null))['then'](function(_0x44e4a8){if(_0x44e4a8){if(!_[_0xe0b0('0x70')](_0x44e4a8[_0xe0b0('0x7c')])){if(fs['existsSync'](path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x76'),_0x44e4a8['systemAvatar']))){_0x74693e=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x76'),_0x44e4a8[_0xe0b0('0x7c')]);}}return _0x4d2ca9[_0xe0b0('0x73')](_0x74693e);}})[_0xe0b0('0x1e')](handleError(_0x4d2ca9,null));};exports['notify']=function(_0x44da91,_0x701ba){var _0x21db87=require(_0xe0b0('0x7d'));var _0x11452e=new _0x21db87();var _0xaca03c=_0x11452e[_0xe0b0('0x7e')](_0x44da91[_0xe0b0('0x7f')][_0xe0b0('0x80')])[_0xe0b0('0x81')]();var _0xde3bca={'body':_0x44da91['body'],'channel':_0xe0b0('0x82')};var _0x51bab6=[];var _0x56c497=[];var _0x1d1981={};var _0x1c29dd=![];return db['CmContact'][_0xe0b0('0x83')]()[_0xe0b0('0x15')](function(_0x141b38){if(!_0x141b38){throw new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x86'));}_0x51bab6=_[_0xe0b0('0x87')](_[_0xe0b0('0x37')](_0x141b38),[_0xe0b0('0x88'),'updatedAt']);_0x56c497=_[_0xe0b0('0x87')](_[_0xe0b0('0x37')](_0x141b38),[_0xe0b0('0x88'),_0xe0b0('0x89'),'CompanyId','ListId']);if(_0x44da91[_0xe0b0('0x4d')]['id']){delete _0x44da91[_0xe0b0('0x4d')]['id'];}if(_[_0xe0b0('0x70')](_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x8a')])){throw new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x8b'));}if(_[_0xe0b0('0x70')](_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x4d')])||_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x4d')]===''){throw new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x8c'));}if(_[_0xe0b0('0x70')](_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x8d')])){throw new db['Sequelize'][(_0xe0b0('0x85'))](_0xe0b0('0x8e')+_0x56c497);}if(!_[_0xe0b0('0x8f')](_0x56c497,_0x44da91['body'][_0xe0b0('0x8d')])){throw new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x90')+_0x56c497);}_0x1d1981[_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x8d')]]=_0x44da91[_0xe0b0('0x4d')]['from'];})[_0xe0b0('0x15')](function(){return db['ChatWebsite'][_0xe0b0('0x4b')]({'where':{'id':_0x44da91['params']['id']},'include':[{'model':db[_0xe0b0('0x91')],'as':_0xe0b0('0x92'),'include':[{'model':db['CmContact'],'as':_0xe0b0('0x93'),'where':_0x1d1981,'limit':0x1,'order':[['updatedAt',_0xe0b0('0x94')]]}]},{'model':db[_0xe0b0('0x95')],'as':_0xe0b0('0x96')}]});})[_0xe0b0('0x15')](handleEntityNotFound(_0x701ba,null))[_0xe0b0('0x15')](function(_0x13199b){if(_0x13199b&&_0x13199b[_0xe0b0('0x92')]){_0xde3bca[_0xe0b0('0x97')]=_0x13199b;_0xde3bca['applications']=_0x13199b[_0xe0b0('0x96')];_0xde3bca['list']=_0x13199b['List'];_0xde3bca[_0xe0b0('0x98')]=_[_0xe0b0('0x99')](_0xde3bca[_0xe0b0('0x98')],['priority'],['asc']);if(_0xde3bca[_0xe0b0('0x97')][_0xe0b0('0x96')]){delete _0xde3bca['account'][_0xe0b0('0x96')];}if(_0xde3bca[_0xe0b0('0x97')][_0xe0b0('0x92')]&&_0xde3bca[_0xe0b0('0x97')][_0xe0b0('0x92')][_0xe0b0('0x93')][_0xe0b0('0x3c')]){return _0xde3bca[_0xe0b0('0x97')][_0xe0b0('0x92')]['Contacts'][0x0];}var _0x569400=_[_0xe0b0('0x9a')](_0x44da91[_0xe0b0('0x4d')],{'firstName':_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x8a')],'ListId':_0x13199b[_0xe0b0('0x9b')]});_0x569400[_0x44da91[_0xe0b0('0x4d')]['mapKey']]=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x8a')];return db[_0xe0b0('0x9c')][_0xe0b0('0x4c')](_0x569400,{'fields':_0x51bab6,'raw':!![]});}})[_0xe0b0('0x15')](handleEntityNotFound(_0x701ba,null))['then'](function(_0x3ae295){_0xde3bca[_0xe0b0('0x9d')]=_0x3ae295;var _0x321b0b=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x9e')];if(_0x44da91[_0xe0b0('0x7f')][_0xe0b0('0x9f')]){_0x321b0b=_0x44da91[_0xe0b0('0x7f')][_0xe0b0('0x9f')];}else if(_0x44da91[_0xe0b0('0x7f')]['x-forwarded-for']){_0x321b0b=_[_0xe0b0('0xa0')](_0x44da91[_0xe0b0('0x7f')]['x-forwarded-for'][_0xe0b0('0xa1')](','));}if(_0x3ae295){var _0x494567={'ContactId':_0x3ae295['id'],'ChatWebsiteId':_0x44da91[_0xe0b0('0x56')]['id'],'from':(_0x3ae295[_0xe0b0('0xa2')]||'')+'\x20'+(_0x3ae295['lastName']||''),'customerIp':_0x321b0b,'customerPort':_0x44da91[_0xe0b0('0x7f')][_0xe0b0('0xa3')]?_0x44da91[_0xe0b0('0x7f')][_0xe0b0('0xa3')]:null,'referer':_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xa4')],'browserName':_0xaca03c[_0xe0b0('0xa5')]['name']&&_0xaca03c['browser'][_0xe0b0('0xa6')]?util[_0xe0b0('0xa7')](_0xe0b0('0xa8'),_0xaca03c['browser'][_0xe0b0('0x2d')],_0xaca03c[_0xe0b0('0xa5')][_0xe0b0('0xa6')]):_0xe0b0('0xa9'),'browserVersion':_0xaca03c[_0xe0b0('0xa5')][_0xe0b0('0xa6')]||_0xe0b0('0xa9'),'osName':util[_0xe0b0('0xa7')](_0xe0b0('0xa8'),_0xaca03c['os'][_0xe0b0('0x2d')],_0xaca03c['os']['version']),'osVersion':_0xaca03c['os']['version'],'deviceModel':_0xaca03c[_0xe0b0('0xaa')][_0xe0b0('0x35')]&&_0xaca03c[_0xe0b0('0xaa')][_0xe0b0('0xab')]?util[_0xe0b0('0xa7')](_0xe0b0('0xac'),_0xaca03c[_0xe0b0('0xaa')]['model'],_0xaca03c[_0xe0b0('0xaa')][_0xe0b0('0xab')],_0xaca03c[_0xe0b0('0xaa')]['type']):null,'deviceVendor':_0xaca03c[_0xe0b0('0xaa')][_0xe0b0('0xab')],'deviceType':_0xaca03c['device']['type'],'formData':JSON[_0xe0b0('0xad')](_0x44da91['body'])};var _0x7eef44={'ChatWebsiteId':_0x44da91['params']['id'],'closed':![]};if(_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xae')]){_0x7eef44['threadId']=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xae')];return db['ChatInteraction'][_0xe0b0('0x4b')]({'where':_0x7eef44})['then'](function(_0x1395be){if(_0x1395be){return[_0x1395be,![]];}_0x494567[_0xe0b0('0xae')]=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xae')];_0x494567[_0xe0b0('0xaf')]=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xaf')];return db['ChatInteraction'][_0xe0b0('0x4c')](_0x494567)[_0xe0b0('0x15')](function(_0x5e1db2){return[_0x5e1db2,!![]];});});}_0x7eef44['ContactId']=_0x3ae295['id'];if(_0x44da91[_0xe0b0('0x4d')]['interaction']&&_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xb0')]['id']){_0x7eef44['id']=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xb0')]['id'];return db[_0xe0b0('0xb1')][_0xe0b0('0x4b')]({'where':_0x7eef44})[_0xe0b0('0x15')](function(_0x8364b0){if(_0x8364b0){return[_0x8364b0,![]];}return db[_0xe0b0('0xb1')][_0xe0b0('0x4c')](_0x494567)[_0xe0b0('0x15')](function(_0x3fc0d6){return[_0x3fc0d6,!![]];});});}return db[_0xe0b0('0xb1')][_0xe0b0('0x4c')](_0x494567)['then'](function(_0x180b6c){return[_0x180b6c,!![]];});}})[_0xe0b0('0xb2')](function(_0x2cd15d,_0x3e82b4){if(_0x2cd15d){_0x1c29dd=_0x3e82b4;if(!_0x3e82b4){var _0x3cbf47={'from':(_0xde3bca['contact'][_0xe0b0('0xa2')]||'')+'\x20'+(_0xde3bca[_0xe0b0('0x9d')][_0xe0b0('0xb3')]||'')};if(_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xae')]&&_0x44da91[_0xe0b0('0x4d')]['messageId']&&_0x44da91[_0xe0b0('0x4d')]['threadId']!=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xb4')]){_0x3cbf47[_0xe0b0('0xae')]=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xb4')];}return _0x2cd15d[_0xe0b0('0x55')](_0x3cbf47);}else{return _0x2cd15d;}}})['then'](function(_0xe574f1){_0xde3bca[_0xe0b0('0xb0')]=_0xe574f1[_0xe0b0('0x2a')]({'plain':!![]});_0xde3bca[_0xe0b0('0xb0')][_0xe0b0('0xb5')]=_0x1c29dd;if(_0xde3bca[_0xe0b0('0xb0')][_0xe0b0('0xb5')]){if(_0xde3bca[_0xe0b0('0x97')]['autoclose']){_0xde3bca['applications'][_0xe0b0('0xb6')]({'id':0x0,'priority':_0xde3bca['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0xe0b0('0xb7')});}}return db['ChatMessage']['create']({'body':_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x4d')],'ChatWebsiteId':_0x44da91[_0xe0b0('0x56')]['id'],'ChatInteractionId':_0xe574f1['id'],'direction':'in','ContactId':_0xde3bca[_0xe0b0('0x9d')]['id'],'AttachmentId':_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xb8')]});})[_0xe0b0('0x15')](function(_0x450b09){_0xde3bca[_0xe0b0('0x1b')]=_0x450b09;if(_0xde3bca[_0xe0b0('0xb0')]['UserId']){return db['User'][_0xe0b0('0x4b')]({'attributes':['id',_0xe0b0('0x2d')],'where':{'id':_0xde3bca[_0xe0b0('0xb0')]['UserId']}})['then'](function(_0x254691){if(_0x254691){_0xde3bca['applications'][_0xe0b0('0xb9')]({'id':0x0,'priority':0x0,'app':_0xe0b0('0xba'),'appdata':_0x254691['name']+','+(_0xde3bca[_0xe0b0('0x97')][_0xe0b0('0xbb')]||0xa),'interval':_0xe0b0('0xb7')});_0xde3bca[_0xe0b0('0xbc')]=!![];}return respondWithRpcPromise(_0xe0b0('0xbd'),_0xe0b0('0xbe'),_0xde3bca);});}return respondWithRpcPromise(_0xe0b0('0xbd'),'startRouting',_0xde3bca);})[_0xe0b0('0x15')](function(_0xea6b40){respondWithRpcPromise(_0xe0b0('0xbf'),_0xe0b0('0xbf'),{'event':_0xe0b0('0xc0'),'message':_0xea6b40},client9002);return _0xea6b40;})['then'](respondWithResult(_0x701ba,null))['catch'](handleError(_0x701ba,null));};exports[_0xe0b0('0xc1')]=function(_0x4a8dfc,_0x4bfa22){var _0x3df5c8,_0x588a19,_0x36901a;var _0x151da2=[];var _0x330ed5={};var _0x35f5c1=_0x4a8dfc['files']||[];var _0x50b163=[];var _0x42affa;return db[_0xe0b0('0x9c')][_0xe0b0('0x83')]()[_0xe0b0('0x15')](function(_0xbafa53){if(!_0xbafa53){throw new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x86'));}_0x151da2=_['difference'](_[_0xe0b0('0x37')](_0xbafa53),[_0xe0b0('0x88'),_0xe0b0('0x89'),'CompanyId',_0xe0b0('0x9b')]);if(_0x4a8dfc[_0xe0b0('0x4d')]['id']){delete _0x4a8dfc[_0xe0b0('0x4d')]['id'];}if(_[_0xe0b0('0x70')](_0x4a8dfc[_0xe0b0('0x4d')][_0xe0b0('0x8a')])){throw _0x4bfa22['status'](0x1f4)[_0xe0b0('0x2e')](new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))]('from\x20is\x20mandatory'));}if(_[_0xe0b0('0x70')](_0x4a8dfc[_0xe0b0('0x4d')][_0xe0b0('0x4d')])||_0x4a8dfc[_0xe0b0('0x4d')]['body']===''){throw _0x4bfa22[_0xe0b0('0x21')](0x1f4)[_0xe0b0('0x2e')](new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x8c')));}if(_[_0xe0b0('0x70')](_0x4a8dfc[_0xe0b0('0x4d')][_0xe0b0('0xc2')])){throw _0x4bfa22['status'](0x1f4)[_0xe0b0('0x2e')](new db['Sequelize']['ValidationError'](_0xe0b0('0xc3')+_0x151da2));}if(!_[_0xe0b0('0x8f')](_0x151da2,_0x4a8dfc[_0xe0b0('0x4d')]['mapKeyOffline'])){throw _0x4bfa22[_0xe0b0('0x21')](0x1f4)['send'](new db[(_0xe0b0('0x84'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x151da2));}_0x330ed5[_0x4a8dfc['body'][_0xe0b0('0xc2')]]=_0x4a8dfc[_0xe0b0('0x4d')]['from'];})[_0xe0b0('0x15')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x4a8dfc[_0xe0b0('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0xe0b0('0x92')},{'model':db[_0xe0b0('0xc4')],'as':_0xe0b0('0xc4')}]});})[_0xe0b0('0x15')](handleEntityNotFound(_0x4bfa22,null))['then'](function(_0x2fe1ab){if(_0x2fe1ab&&_0x2fe1ab[_0xe0b0('0x92')]){_0x588a19=_0x2fe1ab;var _0x4187aa=_[_0xe0b0('0x9a')](_0x4a8dfc[_0xe0b0('0x4d')],{'firstName':_0x4a8dfc['body'][_0xe0b0('0x8a')],'phone':_0x4a8dfc[_0xe0b0('0x4d')]['from'],'ListId':_0x2fe1ab[_0xe0b0('0x9b')]});_0x4187aa[_0x4a8dfc['body'][_0xe0b0('0xc2')]]=_0x4a8dfc[_0xe0b0('0x4d')][_0xe0b0('0x8a')];return db[_0xe0b0('0x9c')][_0xe0b0('0xc5')]({'where':_0x330ed5,'defaults':_0x4187aa});}})[_0xe0b0('0xb2')](function(_0x403f30){if(_0x403f30){_0x36901a=_0x403f30;var _0x5b7b02=fs['readFileSync'](path[_0xe0b0('0x6a')](config['root'],_0xe0b0('0xc6')),_0xe0b0('0xc7'));var _0xdde041=ejs[_0xe0b0('0xc8')](_0x5b7b02,{'body':_[_0xe0b0('0xc9')](_0x4a8dfc[_0xe0b0('0x4d')]['body']),'bodyTitle':_0x588a19['offlineMessageBody']});return db[_0xe0b0('0xca')][_0xe0b0('0x4c')]({'body':_0xdde041,'plainBody':htmlToText['fromString'](_0xdde041),'ContactId':_0x403f30['id'],'ChatWebsiteId':_0x588a19['id']});}})[_0xe0b0('0x15')](function(_0x2d0ba8){_0x42affa=_0x2d0ba8;if(_0x35f5c1['length']){var _0x2ad35d=_0x35f5c1[_0xe0b0('0x32')](function(_0x337db8){return{'name':_0x337db8['originalname'],'basename':_0x337db8[_0xe0b0('0x63')],'type':_0x337db8[_0xe0b0('0xcb')],'ChatOfflineMessageId':_0x2d0ba8['id']};});_0x50b163=_0x2ad35d[_0xe0b0('0x32')](_0x24d9ee=>{var _0x57e90f={'filename':_0x24d9ee[_0xe0b0('0x2d')],'path':path['join'](config[_0xe0b0('0x6b')],_0xe0b0('0xcc'),_0xe0b0('0xcd'),'attachments',_0xe0b0('0xce'),_0x24d9ee[_0xe0b0('0xcf')])};return _0x57e90f;});if(!_0x588a19[_0xe0b0('0xd0')]){return db[_0xe0b0('0xd1')]['transaction'](function(_0x1266c8){return db[_0xe0b0('0xd2')][_0xe0b0('0xd3')](_0x2ad35d,{'transaction':_0x1266c8});});}}})[_0xe0b0('0x15')](function(){if(_0x42affa){_0x3df5c8=_0x42affa;return db[_0xe0b0('0xc4')][_0xe0b0('0x5e')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})['then'](function(_0x25d3fe){if(_0x25d3fe&&_0x25d3fe['Smtp']&&_0x588a19[_0xe0b0('0xd4')]&&_0x588a19['forwardOfflineAddress']){var _0x47d689={'tls':{'rejectUnauthorized':![]}};if(_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0xd6')]){_0x47d689[_0xe0b0('0xd6')]=_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0xd6')];}else{_0x47d689[_0xe0b0('0xd7')]=_0x25d3fe[_0xe0b0('0xd5')]['host'];_0x47d689[_0xe0b0('0xd8')]=_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0xd8')];_0x47d689[_0xe0b0('0xd9')]=_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0xd9')];}if(_0x25d3fe['Smtp']['authentication']){_0x47d689[_0xe0b0('0xda')]={'user':_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0x4e')],'pass':_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0xdb')]};}return respondWithRpcPromise(_0xe0b0('0xdc'),_0xe0b0('0xdd'),{'account':_0x47d689,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x25d3fe[_0xe0b0('0x2d')],_0x25d3fe[_0xe0b0('0xde')]||_0x25d3fe[_0xe0b0('0xd5')]['user']),'to':_0x588a19['forwardOfflineAddress'],'subject':_0x588a19[_0xe0b0('0xdf')],'html':_0x3df5c8[_0xe0b0('0x4d')],'attachments':_0x50b163}},client9003)[_0xe0b0('0x15')](function(){return _0x3df5c8;})[_0xe0b0('0x1e')](function(_0x1427a9){console[_0xe0b0('0x19')](_0x1427a9);});}})[_0xe0b0('0x15')](function(){if(_0x588a19&&_0x588a19[_0xe0b0('0xd0')]&&_0x588a19[_0xe0b0('0xe0')]){var _0x233c95=[];if(_0x35f5c1['length']){_0x233c95=_0x35f5c1[_0xe0b0('0x32')](function(_0x4a577b){return{'name':_0x4a577b[_0xe0b0('0xe1')],'basename':_0x4a577b['filename'],'type':_0x4a577b[_0xe0b0('0xcb')],'ChatOfflineMessageId':_0x42affa['id']};});}var _0x326470;if(!_['isNil'](_0x588a19[_0xe0b0('0xe2')])){var _0x41fd0e=_[_0xe0b0('0x32')](_0x4a8dfc['body'],function(_0x172318){return _0x172318;});var _0xb3018b=_['toPairsIn'](_0x41fd0e)[0x0];var _0x34338e=_[_0xe0b0('0xe3')](_0xb3018b,function(_0x50828f){return _0x50828f;});_0x326470=_0x34338e[0x1][_0x588a19['subjectOffline']];}var _0x33c97b={'from':_0x36901a[_0xe0b0('0xde')],'firstName':_0x36901a['firstName'],'lastName':_0x36901a['lastName'],'mapKey':_0xe0b0('0xde'),'message':{'from':_0x36901a['email'],'to':_0x588a19[_0xe0b0('0xc4')][_0xe0b0('0xde')],'cc':'','subject':_[_0xe0b0('0x70')](_0x326470)?_0x588a19[_0xe0b0('0xdf')]:_0x326470,'messageId':'','sentAt':new Date(),'attach':_0x233c95[_0xe0b0('0x3c')],'attachments':_0x233c95,'originChannel':_0xe0b0('0xe4'),'ChatWebsiteId':_0x588a19['id'],'ChatOfflineMessageId':_0x3df5c8['id'],'originTo':_0x588a19[_0xe0b0('0xc4')]['email']},'body':_0x3df5c8[_0xe0b0('0x4d')]};var _0x5f059f={'account':{'id':_0x588a19['MailAccountId']},'body':_0x33c97b,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xe0b0('0xe5'),_0xe0b0('0xe6'),_0x5f059f,client9001)[_0xe0b0('0x15')](function(){return _0x3df5c8;})[_0xe0b0('0x1e')](function(_0x21ccfe){console['error'](_0x21ccfe);});}return;})['then'](function(){if(_0x3df5c8){return _0x3df5c8;}})['then'](respondWithResult(_0x4bfa22,null))['catch'](function(_0x41b52){console[_0xe0b0('0x19')](_0xe0b0('0x1e'),_0x41b52);for(var _0x5d8613 of _0x35f5c1){var _0x2c18b9=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0xcc'),_0xe0b0('0xcd'),_0xe0b0('0xe7'),_0xe0b0('0xce'),_0x5d8613['filename']);fs_extra[_0xe0b0('0xe8')](_0x2c18b9)[_0xe0b0('0x1e')](function(_0x2bb49d){console[_0xe0b0('0x19')]('Could\x20not\x20remove\x20attachment\x20file',_0x2c18b9,_0x2bb49d);});}});};exports[_0xe0b0('0xe9')]=function(_0x20f040,_0x3eb643){return db[_0xe0b0('0xb1')]['find']({'where':{'id':_0x20f040['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x3eb643,null))[_0xe0b0('0x15')](function(_0x26bd6c){if(_0x26bd6c){return _0x26bd6c[_0xe0b0('0xe9')](_0x20f040[_0xe0b0('0x4d')][_0xe0b0('0x61')],_['omit'](_0x20f040[_0xe0b0('0x4d')],[_0xe0b0('0x61'),'id'])||{});}})[_0xe0b0('0x15')](respondWithResult(_0x3eb643,null))[_0xe0b0('0x1e')](handleError(_0x3eb643,null));};exports[_0xe0b0('0xea')]=function(_0x48706b,_0x164b25){var _0x51afab={'raw':![],'where':{}};var _0x49632d={};var _0x257dda={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x48706b[_0xe0b0('0x56')]['id']}})['then'](handleEntityNotFound(_0x164b25,null))['then'](function(_0x5a04c8){if(_0x5a04c8){_0x49632d[_0xe0b0('0x35')]=_[_0xe0b0('0x37')](db['ChatInteraction'][_0xe0b0('0x5a')]);_0x49632d['query']=_[_0xe0b0('0x37')](_0x48706b[_0xe0b0('0x36')]);_0x49632d[_0xe0b0('0x38')]=_[_0xe0b0('0x3a')](_0x49632d['model'],_0x49632d['query']);_0x51afab['attributes']=_[_0xe0b0('0x3a')](_0x49632d[_0xe0b0('0x35')],qs['fields'](_0x48706b['query'][_0xe0b0('0x3b')]));_0x51afab[_0xe0b0('0x39')]=_0x51afab[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x51afab['attributes']:_0x49632d['model'];if(!_0x48706b[_0xe0b0('0x36')][_0xe0b0('0x3d')]('nolimit')){_0x51afab[_0xe0b0('0x23')]=qs[_0xe0b0('0x23')](_0x48706b['query']['limit']);_0x51afab['offset']=qs[_0xe0b0('0x22')](_0x48706b[_0xe0b0('0x36')]['offset']);}_0x51afab[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x48706b[_0xe0b0('0x36')][_0xe0b0('0x40')]);_0x51afab['where']=qs[_0xe0b0('0x38')](_[_0xe0b0('0x41')](_0x48706b['query'],_0x49632d['filters']));_0x51afab['where'][_0xe0b0('0x57')]=_0x5a04c8['id'];if(_0x48706b['query'][_0xe0b0('0x42')]){_0x51afab['where']=_['merge'](_0x51afab[_0xe0b0('0x43')],{'$or':_[_0xe0b0('0x32')](_0x51afab[_0xe0b0('0x39')],function(_0xe1891c){var _0x4cfd4f={};_0x4cfd4f[_0xe1891c]={'$like':'%'+_0x48706b['query']['filter']+'%'};return _0x4cfd4f;})});}_0x51afab=_['merge']({},_0x51afab,_0x48706b[_0xe0b0('0x46')]);return db[_0xe0b0('0xb1')][_0xe0b0('0x25')]({'where':_0x51afab['where']})[_0xe0b0('0x15')](function(_0x1f1133){_0x257dda['count']=_0x1f1133;if(_0x48706b[_0xe0b0('0x36')][_0xe0b0('0x4a')]){_0x51afab[_0xe0b0('0x47')]=[{'model':db[_0xe0b0('0x9c')],'as':'Contact','required':![]},{'model':db[_0xe0b0('0xeb')],'as':_0xe0b0('0xec'),'attributes':[_0xe0b0('0x2d'),'fullname',_0xe0b0('0xed')],'required':![]},{'model':db[_0xe0b0('0xee')],'as':_0xe0b0('0xef'),'attributes':['id',_0xe0b0('0x2d'),'color'],'where':_0x48706b[_0xe0b0('0x36')][_0xe0b0('0xf0')]?{'id':_0x48706b[_0xe0b0('0x36')][_0xe0b0('0xf0')]}:undefined,'required':_0x48706b[_0xe0b0('0x36')]['tag']?!![]:![]}];}return db[_0xe0b0('0xb1')][_0xe0b0('0x5b')](_0x51afab);})['then'](function(_0xb263f6){_0x257dda[_0xe0b0('0x48')]=_0xb263f6;return _0x257dda;});}})[_0xe0b0('0x15')](respondWithFilteredResult(_0x164b25,_0x51afab))[_0xe0b0('0x1e')](handleError(_0x164b25,null));};function iftimePromise(_0x1ffc75,_0x3a39d7){return respondWithRpcPromise('Command',_0xe0b0('0xf1'),{'command':_0x3a39d7[_0xe0b0('0xf2')]?util[_0xe0b0('0xa7')](_0xe0b0('0xf3'),_0x1ffc75[_0xe0b0('0xf4')],_0x3a39d7[_0xe0b0('0xf2')]):util[_0xe0b0('0xa7')](_0xe0b0('0xf5'),_0x1ffc75[_0xe0b0('0xf4')])},client9002)[_0xe0b0('0x15')](function(_0x4d12b2){var _0xeeff22=_0x4d12b2&&_0x4d12b2['indexOf'](_0xe0b0('0xf6'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x3a39d7['id'],_0x1ffc75['id'],_0x1ffc75[_0xe0b0('0xf4')],_0xeeff22?_0xe0b0('0xf7'):'OFFLINE',_0x3a39d7['timezone']?_0x3a39d7[_0xe0b0('0xf2')]:_0xe0b0('0xf8'));return _0xeeff22;})['catch'](function(_0x5501c2){logger[_0xe0b0('0x19')](_0xe0b0('0xf9'),_0x3a39d7['id'],_0x1ffc75['id'],_0x1ffc75['interval'],util[_0xe0b0('0xfa')](_0x5501c2,{'showHidden':![],'depth':null}),_0x3a39d7[_0xe0b0('0xf2')]?_0x3a39d7[_0xe0b0('0xf2')]:_0xe0b0('0xf8'));return![];});}exports['getSnippet']=function(_0x230ff2,_0x22d53d){var _0x2251c2=0x0;var _0x24271d=0x0;var _0x385ffb=![];var _0x594eaa;var _0x2932c3;return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x230ff2['params']['id']},'include':[{'model':db[_0xe0b0('0xfb')],'as':_0xe0b0('0xfb'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xe0b0('0xf4')],'raw':!![]}]}]})[_0xe0b0('0x15')](handleEntityNotFound(_0x22d53d,null))[_0xe0b0('0x15')](function(_0x46fbdc){if(_0x46fbdc){_0x594eaa=_0x46fbdc;return _0x46fbdc[_0xe0b0('0xfc')]({'raw':!![]});}})[_0xe0b0('0x15')](function(_0x34e1bf){if(_0x594eaa){if(_0x34e1bf){_0x2932c3=_0x34e1bf;}}return require('../../config/license/util')['getLicense']();})['then'](function(_0x5c001a){if(_0x5c001a){_0x24271d=_0x5c001a[_0xe0b0('0xfd')];_0x385ffb=_0x5c001a[_0xe0b0('0x6f')];}})[_0xe0b0('0x15')](function(){return db['ChatInteraction'][_0xe0b0('0x25')]({'where':{'closed':![]}});})[_0xe0b0('0x15')](function(_0x1a5a0f){_0x2251c2=_0x1a5a0f;if(_0x24271d&&_0x1a5a0f>_0x24271d){return db[_0xe0b0('0xfe')][_0xe0b0('0x5e')]({'where':{'id':0x1}})[_0xe0b0('0x15')](function(_0x5910e6){if(_0x5910e6){_0x5910e6['increment'](_0xe0b0('0xff'));}});}})[_0xe0b0('0x15')](function(){if(_0x594eaa[_0xe0b0('0xfb')]&&_0x594eaa[_0xe0b0('0xfb')][_0xe0b0('0x100')]){var _0x55e2ba=[];for(var _0x1e4f9d=0x0;_0x1e4f9d<_0x594eaa[_0xe0b0('0xfb')][_0xe0b0('0x100')][_0xe0b0('0x3c')];_0x1e4f9d++){var _0x224e67=_0x594eaa[_0xe0b0('0xfb')][_0xe0b0('0x100')][_0x1e4f9d][_0xe0b0('0x2a')]({'plain':!![]});_0x55e2ba[_0xe0b0('0xb6')](iftimePromise(_0x224e67,_0x594eaa));}return BPromise[_0xe0b0('0x101')](_0x55e2ba)['then'](function(_0x5bc9dc){return _['some'](_0x5bc9dc);});}else{return!![];}})[_0xe0b0('0x15')](function(_0x344877){var _0xa604c3=fs[_0xe0b0('0x102')](path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x103')),'utf8');var _0xa6e316={'remote':_0x594eaa[_0xe0b0('0x104')],'query':querystring[_0xe0b0('0xad')](_['merge'](_0x594eaa[_0xe0b0('0x2a')]({'plain':!![]}),{'customerIp':_0x230ff2[_0xe0b0('0x7f')]['x-forwarded-for']||_0x230ff2[_0xe0b0('0x7f')][_0xe0b0('0x105')]||_0x230ff2[_0xe0b0('0x106')][_0xe0b0('0x107')]||_0x230ff2['ip'],'referer':_0x230ff2['headers']['referer'],'openedInteractions':_0x2251c2,'maxInteractions':_0x24271d,'virtual':_0x385ffb[_0xe0b0('0xfd')],'online':_0x344877,'custom':_0x385ffb}))['replace'](/'/g,'\x5c\x27')};_0x22d53d[_0xe0b0('0x2e')](ejs['render'](Mustache[_0xe0b0('0xc8')](_0xa604c3,_0xa6e316),{'proactiveActions':_0x2932c3,'alignment':_0x594eaa[_0xe0b0('0x108')],'verticalAlignment':_0x594eaa[_0xe0b0('0x109')],'div_color':_0x594eaa['color'],'labelText':_0x594eaa[_0xe0b0('0x10a')],'text_color':_0x594eaa['textColor'],'button_color':_0x594eaa[_0xe0b0('0x10b')],'background_color':_0x594eaa[_0xe0b0('0x10c')]}));})['catch'](handleError(_0x22d53d,null));};exports[_0xe0b0('0x10d')]=function(_0x3888d7,_0x2ed835){var _0x8c9efb=_0x3888d7['params']['id'];var _0x161a8c=_0x3888d7[_0xe0b0('0x4d')];var _0x2522f7=0xc8;var _0x523818=null;return db[_0xe0b0('0xd1')]['transaction']({'isolationLevel':db[_0xe0b0('0xd1')]['Transaction'][_0xe0b0('0x10e')][_0xe0b0('0x10f')]},function(_0x18d0eb){return db['ChatWebsite'][_0xe0b0('0x5e')]({'where':{'id':_0x8c9efb},'transaction':_0x18d0eb})[_0xe0b0('0x15')](function(_0x2eb954){if(_0x2eb954){return db[_0xe0b0('0x95')][_0xe0b0('0x29')]({'where':{'ChatWebsiteId':_0x8c9efb},'transaction':_0x18d0eb})[_0xe0b0('0x15')](function(){var _0x2961c1=_['map'](_0x161a8c,function(_0x31063b){_0x31063b['ChatWebsiteId']=_0x8c9efb;return _0x31063b;});return db[_0xe0b0('0x95')]['bulkCreate'](_0x2961c1,{'transaction':_0x18d0eb});});}else{_0x2522f7=0x194;_0x523818=[];}});})[_0xe0b0('0x15')](function(){if(_0x2522f7!==0x194){return db[_0xe0b0('0x95')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x8c9efb},'order':'priority'})[_0xe0b0('0x15')](function(_0x32c330){_0x523818=_0x32c330;});}})[_0xe0b0('0x1e')](function(_0x299f82){_0x2522f7=0x1f4;logger[_0xe0b0('0x19')](_0x299f82[_0xe0b0('0x2c')]);if(_0x299f82['name']){delete _0x299f82[_0xe0b0('0x2d')];}_0x523818=_0x299f82;})[_0xe0b0('0x110')](function(){if(_0x523818===null){_0x2ed835['sendStatus'](_0x2522f7);}else{if(_0x2522f7===0x1f4){_0x2ed835[_0xe0b0('0x21')](_0x2522f7)[_0xe0b0('0x2e')](_0x523818);}else{_0x2ed835[_0xe0b0('0x21')](_0x2522f7)[_0xe0b0('0x28')](_0x523818);}}});};exports[_0xe0b0('0x111')]=function(_0x5ac9af,_0x220bb1){var _0x51fab9={};var _0x2309cf={};var _0x436d2c;var _0x3b6cac;return db[_0xe0b0('0x33')][_0xe0b0('0x5e')]({'where':{'id':_0x5ac9af['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x220bb1,null))[_0xe0b0('0x15')](function(_0x49da50){if(_0x49da50){_0x436d2c=_0x49da50;_0x2309cf[_0xe0b0('0x35')]=_[_0xe0b0('0x37')](db[_0xe0b0('0x95')][_0xe0b0('0x5a')]);_0x2309cf[_0xe0b0('0x36')]=_['keys'](_0x5ac9af['query']);_0x2309cf['filters']=_[_0xe0b0('0x3a')](_0x2309cf[_0xe0b0('0x35')],_0x2309cf[_0xe0b0('0x36')]);_0x51fab9['attributes']=_[_0xe0b0('0x3a')](_0x2309cf['model'],qs[_0xe0b0('0x3b')](_0x5ac9af[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x51fab9[_0xe0b0('0x39')]=_0x51fab9[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x51fab9['attributes']:_0x2309cf[_0xe0b0('0x35')];_0x51fab9[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x5ac9af['query'][_0xe0b0('0x40')]);_0x51fab9[_0xe0b0('0x43')]=qs['filters'](_[_0xe0b0('0x41')](_0x5ac9af['query'],_0x2309cf[_0xe0b0('0x38')]));if(_0x5ac9af[_0xe0b0('0x36')][_0xe0b0('0x42')]){_0x51fab9[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x51fab9[_0xe0b0('0x43')],{'$or':_[_0xe0b0('0x32')](_0x51fab9[_0xe0b0('0x39')],function(_0x41e4be){var _0x3338bb={};_0x3338bb[_0x41e4be]={'$like':'%'+_0x5ac9af[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x3338bb;})});}_0x51fab9=_[_0xe0b0('0x44')]({},_0x51fab9,_0x5ac9af[_0xe0b0('0x46')]);return _0x436d2c['getApplications'](_0x51fab9);}})[_0xe0b0('0x15')](function(_0xce17d3){if(_0xce17d3){_0x3b6cac=_0xce17d3[_0xe0b0('0x3c')];if(!_0x5ac9af[_0xe0b0('0x36')][_0xe0b0('0x3d')](_0xe0b0('0x3e'))){_0x51fab9[_0xe0b0('0x23')]=qs[_0xe0b0('0x23')](_0x5ac9af[_0xe0b0('0x36')][_0xe0b0('0x23')]);_0x51fab9[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x5ac9af['query'][_0xe0b0('0x22')]);}return _0x436d2c['getApplications'](_0x51fab9);}})['then'](function(_0xd60c40){if(_0xd60c40){return _0xd60c40?{'count':_0x3b6cac,'rows':_0xd60c40}:null;}})[_0xe0b0('0x15')](respondWithResult(_0x220bb1,null))['catch'](handleError(_0x220bb1,null));};exports[_0xe0b0('0x112')]=function(_0x1ebfdc,_0x5d1b30){return db[_0xe0b0('0x113')][_0xe0b0('0x4b')]({'where':{'id':_0x1ebfdc[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x5d1b30,null))[_0xe0b0('0x15')](function(_0x4ba58d){if(_0x4ba58d){return _0x4ba58d[_0xe0b0('0x112')](_0x1ebfdc[_0xe0b0('0x4d')][_0xe0b0('0x61')],_['omit'](_0x1ebfdc[_0xe0b0('0x4d')],[_0xe0b0('0x61'),'id'])||{});}})[_0xe0b0('0x15')](respondWithResult(_0x5d1b30,null))[_0xe0b0('0x1e')](handleError(_0x5d1b30,null));};exports[_0xe0b0('0xfc')]=function(_0x15373d,_0x207b52){var _0x421f85={};var _0x7a18d8={};var _0x245796;var _0x51d6f0;return db['ChatWebsite'][_0xe0b0('0x5e')]({'where':{'id':_0x15373d['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x207b52,null))['then'](function(_0xaad4b4){if(_0xaad4b4){_0x245796=_0xaad4b4;_0x7a18d8[_0xe0b0('0x35')]=_[_0xe0b0('0x37')](db['ChatProactiveAction']['rawAttributes']);_0x7a18d8['query']=_[_0xe0b0('0x37')](_0x15373d[_0xe0b0('0x36')]);_0x7a18d8['filters']=_[_0xe0b0('0x3a')](_0x7a18d8[_0xe0b0('0x35')],_0x7a18d8[_0xe0b0('0x36')]);_0x421f85[_0xe0b0('0x39')]=_[_0xe0b0('0x3a')](_0x7a18d8[_0xe0b0('0x35')],qs[_0xe0b0('0x3b')](_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x421f85[_0xe0b0('0x39')]=_0x421f85[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x421f85[_0xe0b0('0x39')]:_0x7a18d8['model'];_0x421f85[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x40')]);_0x421f85[_0xe0b0('0x43')]=qs[_0xe0b0('0x38')](_[_0xe0b0('0x41')](_0x15373d[_0xe0b0('0x36')],_0x7a18d8[_0xe0b0('0x38')]));if(_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x42')]){_0x421f85[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x421f85[_0xe0b0('0x43')],{'$or':_['map'](_0x421f85[_0xe0b0('0x39')],function(_0x12fec1){var _0x1fc2ba={};_0x1fc2ba[_0x12fec1]={'$like':'%'+_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x1fc2ba;})});}_0x421f85=_['merge']({},_0x421f85,_0x15373d[_0xe0b0('0x46')]);return _0x245796[_0xe0b0('0xfc')](_0x421f85);}})['then'](function(_0x4ed950){if(_0x4ed950){_0x51d6f0=_0x4ed950['length'];if(!_0x15373d[_0xe0b0('0x36')]['hasOwnProperty'](_0xe0b0('0x3e'))){_0x421f85[_0xe0b0('0x23')]=qs['limit'](_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x23')]);_0x421f85['offset']=qs[_0xe0b0('0x22')](_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x22')]);}return _0x245796['getProactiveActions'](_0x421f85);}})[_0xe0b0('0x15')](function(_0xac72b0){if(_0xac72b0){return _0xac72b0?{'count':_0x51d6f0,'rows':_0xac72b0}:null;}})[_0xe0b0('0x15')](respondWithResult(_0x207b52,null))[_0xe0b0('0x1e')](handleError(_0x207b52,null));};exports[_0xe0b0('0x114')]=function(_0x806731,_0x5632cd){var _0x454673=_0x806731[_0xe0b0('0x36')][_0xe0b0('0x115')]===_0xe0b0('0x116')?_0xe0b0('0x117'):_0xe0b0('0x118');return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'attributes':['id',_0x454673],'where':{'id':_0x806731['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x5632cd,null))[_0xe0b0('0x15')](function(_0xc88c18){if(_0xc88c18){var _0x3ea089=_0xc88c18[_0x454673];var _0x30af0e=_0x3ea089&&_0x3ea089[_0xe0b0('0x119')]?_0x3ea089[_0xe0b0('0x119')]:[];_0x5632cd[_0xe0b0('0x2e')]({'fromKey':_['isNil'](_0x3ea089[_0xe0b0('0x11a')])?undefined:_0x3ea089[_0xe0b0('0x11a')],'count':_0x30af0e['length'],'rows':_0x30af0e});}})[_0xe0b0('0x1e')](handleError(_0x5632cd,null));};exports[_0xe0b0('0x11b')]=function(_0x443352,_0x404b24){var _0x1654d4={'raw':![],'where':{}};var _0x1214bd={};var _0x150f88={'count':0x0,'rows':[]};return db[_0xe0b0('0x33')][_0xe0b0('0x5e')]({'where':{'id':_0x443352[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x404b24,null))['then'](function(_0x2bafbe){if(_0x2bafbe){_0x1214bd[_0xe0b0('0x35')]=_[_0xe0b0('0x37')](db[_0xe0b0('0xca')][_0xe0b0('0x5a')]);_0x1214bd['query']=_[_0xe0b0('0x37')](_0x443352['query']);_0x1214bd['filters']=_[_0xe0b0('0x3a')](_0x1214bd[_0xe0b0('0x35')],_0x1214bd[_0xe0b0('0x36')]);_0x1654d4[_0xe0b0('0x39')]=_[_0xe0b0('0x3a')](_0x1214bd[_0xe0b0('0x35')],qs['fields'](_0x443352[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x1654d4[_0xe0b0('0x39')]=_0x1654d4[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x1654d4[_0xe0b0('0x39')]:_0x1214bd[_0xe0b0('0x35')];if(!_0x443352['query'][_0xe0b0('0x3d')](_0xe0b0('0x3e'))){_0x1654d4[_0xe0b0('0x23')]=qs[_0xe0b0('0x23')](_0x443352['query']['limit']);_0x1654d4[_0xe0b0('0x22')]=qs['offset'](_0x443352[_0xe0b0('0x36')]['offset']);}_0x1654d4[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x443352[_0xe0b0('0x36')]['sort']);_0x1654d4['where']=qs[_0xe0b0('0x38')](_[_0xe0b0('0x41')](_0x443352[_0xe0b0('0x36')],_0x1214bd['filters']));_0x1654d4[_0xe0b0('0x43')][_0xe0b0('0x57')]=_0x2bafbe['id'];if(_0x443352[_0xe0b0('0x36')][_0xe0b0('0x42')]){_0x1654d4[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x1654d4[_0xe0b0('0x43')],{'$or':_[_0xe0b0('0x32')](_0x1654d4[_0xe0b0('0x39')],function(_0x5815f5){var _0x1eacdf={};_0x1eacdf[_0x5815f5]={'$like':'%'+_0x443352[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x1eacdf;})});}_0x1654d4=_[_0xe0b0('0x44')]({},_0x1654d4,_0x443352[_0xe0b0('0x46')]);return db[_0xe0b0('0xca')][_0xe0b0('0x25')]({'where':_0x1654d4[_0xe0b0('0x43')]})[_0xe0b0('0x15')](function(_0x4496d0){_0x150f88[_0xe0b0('0x25')]=_0x4496d0;if(_0x443352['query']['includeAll']){_0x1654d4['include']=[{'all':!![]}];}else{_0x1654d4['include']=[{'model':db[_0xe0b0('0x9c')],'as':_0xe0b0('0x11c'),'required':![]},{'model':db[_0xe0b0('0xd2')],'as':_0xe0b0('0x11d'),'required':![]}];}return db[_0xe0b0('0xca')][_0xe0b0('0x5b')](_0x1654d4);})[_0xe0b0('0x15')](function(_0x306f80){_0x150f88[_0xe0b0('0x48')]=_0x306f80;return _0x150f88;});}})['then'](respondWithFilteredResult(_0x404b24,_0x1654d4))['catch'](handleError(_0x404b24,null));};exports[_0xe0b0('0x11e')]=function(_0x2c6de2,_0x49f1df){return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x2c6de2[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x49f1df,null))['then'](function(_0x1612e9){if(_0x1612e9){return _0x1612e9['addAgents'](_0x2c6de2[_0xe0b0('0x4d')][_0xe0b0('0x61')],_[_0xe0b0('0x11f')](_0x2c6de2[_0xe0b0('0x4d')],[_0xe0b0('0x61'),'id'])||{})[_0xe0b0('0xb2')](function(_0x9d6a15){for(var _0x2601ab=0x0;_0x2601ab<_0x2c6de2[_0xe0b0('0x4d')]['ids']['length'];_0x2601ab+=0x1){socket[_0xe0b0('0x120')]('userChatWebsite:save',{'UserId':Number(_0x2c6de2[_0xe0b0('0x4d')][_0xe0b0('0x61')][_0x2601ab]),'ChatWebsiteId':Number(_0x2c6de2[_0xe0b0('0x56')]['id'])});}return _0x9d6a15;});}})[_0xe0b0('0x15')](respondWithResult(_0x49f1df,null))[_0xe0b0('0x1e')](handleError(_0x49f1df,null));};exports[_0xe0b0('0x121')]=function(_0x3c3bc2,_0x285e1d){return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x3c3bc2['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x285e1d,null))['then'](function(_0x1a6915){if(_0x1a6915){return _0x1a6915['removeAgents'](_0x3c3bc2[_0xe0b0('0x36')][_0xe0b0('0x61')])[_0xe0b0('0x15')](function(){if(_[_0xe0b0('0x122')](_0x3c3bc2[_0xe0b0('0x36')][_0xe0b0('0x61')])){for(var _0x82d32f=0x0;_0x82d32f<_0x3c3bc2[_0xe0b0('0x36')][_0xe0b0('0x61')][_0xe0b0('0x3c')];_0x82d32f+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x3c3bc2[_0xe0b0('0x36')][_0xe0b0('0x61')][_0x82d32f]),'ChatWebsiteId':Number(_0x3c3bc2[_0xe0b0('0x56')]['id'])});}}else{socket[_0xe0b0('0x120')](_0xe0b0('0x123'),{'UserId':Number(_0x3c3bc2[_0xe0b0('0x36')][_0xe0b0('0x61')]),'ChatWebsiteId':Number(_0x3c3bc2[_0xe0b0('0x56')]['id'])});}});}})[_0xe0b0('0x15')](respondWithStatusCode(_0x285e1d,null))[_0xe0b0('0x1e')](handleError(_0x285e1d,null));};exports[_0xe0b0('0x124')]=function(_0x54e11c,_0x4d6351){var _0x2e872b={};var _0x1f9b27={};var _0x229485;var _0x21a549;return db[_0xe0b0('0x33')]['findOne']({'where':{'id':_0x54e11c[_0xe0b0('0x56')]['id']}})['then'](handleEntityNotFound(_0x4d6351,null))[_0xe0b0('0x15')](function(_0x4d04bf){if(_0x4d04bf){_0x229485=_0x4d04bf;_0x1f9b27[_0xe0b0('0x35')]=_[_0xe0b0('0x37')](db[_0xe0b0('0xeb')][_0xe0b0('0x5a')]);_0x1f9b27[_0xe0b0('0x36')]=_[_0xe0b0('0x37')](_0x54e11c[_0xe0b0('0x36')]);_0x1f9b27['filters']=_['intersection'](_0x1f9b27['model'],_0x1f9b27['query']);_0x2e872b[_0xe0b0('0x39')]=_['intersection'](_0x1f9b27['model'],qs['fields'](_0x54e11c[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x2e872b[_0xe0b0('0x39')]=_0x2e872b[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x2e872b['attributes']:_0x1f9b27['model'];_0x2e872b[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x54e11c[_0xe0b0('0x36')][_0xe0b0('0x40')]);_0x2e872b[_0xe0b0('0x43')]=qs['filters'](_['pick'](_0x54e11c[_0xe0b0('0x36')],_0x1f9b27[_0xe0b0('0x38')]));if(_0x54e11c[_0xe0b0('0x36')]['filter']){_0x2e872b['where']=_[_0xe0b0('0x44')](_0x2e872b[_0xe0b0('0x43')],{'$or':_[_0xe0b0('0x32')](_0x2e872b[_0xe0b0('0x39')],function(_0x9a8a0d){var _0x938810={};_0x938810[_0x9a8a0d]={'$like':'%'+_0x54e11c[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x938810;})});}_0x2e872b=_['merge']({},_0x2e872b,_0x54e11c['options']);return _0x229485[_0xe0b0('0x124')](_0x2e872b);}})[_0xe0b0('0x15')](function(_0x1717d3){if(_0x1717d3){_0x21a549=_0x1717d3[_0xe0b0('0x3c')];if(!_0x54e11c[_0xe0b0('0x36')][_0xe0b0('0x3d')](_0xe0b0('0x3e'))){_0x2e872b[_0xe0b0('0x23')]=qs['limit'](_0x54e11c[_0xe0b0('0x36')]['limit']);_0x2e872b[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x54e11c[_0xe0b0('0x36')]['offset']);}return _0x229485[_0xe0b0('0x124')](_0x2e872b);}})[_0xe0b0('0x15')](function(_0x7d6993){if(_0x7d6993){return _0x7d6993?{'count':_0x21a549,'rows':_0x7d6993}:null;}})[_0xe0b0('0x15')](respondWithResult(_0x4d6351,null))[_0xe0b0('0x1e')](handleError(_0x4d6351,null));}; \ No newline at end of file +var _0x0b0e=['mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','mimetype','server','files','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','forwardOffline','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','email','offlineMessageSubject','MailAccountId','originalname','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','attachments','remove','addInteraction','getInteractions','User','Owner','internal','Tag','Tags','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','getProactiveActions','virtual','License','chatLicenseExceeded','Intervals','all','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','labelText','color_button','backgroundColor','addApplications','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','addProactiveActions','chatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','omit','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','html-to-text','jayson/promise','http','client','request','then','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','ChatWebsiteId','Disposition','getDispositions','rawAttributes','findAll','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','ids','addLogo','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','sitepic','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','existsSync','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','setUA','headers','user-agent','getResult','chat','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','orderBy','defaults','ListId','CmContact','contact','customerIp','cf-connecting-ip','first','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','externalUrl','interaction','ChatInteraction','spread','lastName','messageId','created','push','*,*,*,*','AttachmentId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','mapKeyOffline'];(function(_0x47ce15,_0x41c6d4){var _0x2a34a8=function(_0x341efc){while(--_0x341efc){_0x47ce15['push'](_0x47ce15['shift']());}};_0x2a34a8(++_0x41c6d4);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0x0b0e[_0x3a8dc1];return _0x4b3595;};'use strict';var BPromise=require(_0xe0b0('0x0'));var Mustache=require('mustache');var util=require(_0xe0b0('0x1'));var path=require('path');var ejs=require(_0xe0b0('0x2'));var fs=require('fs');var fs_extra=require(_0xe0b0('0x3'));var _=require(_0xe0b0('0x4'));var querystring=require(_0xe0b0('0x5'));var Redis=require(_0xe0b0('0x6'));var qs=require(_0xe0b0('0x7'));var logger=require(_0xe0b0('0x8'))(_0xe0b0('0x9'));var config=require(_0xe0b0('0xa'));var db=require(_0xe0b0('0xb'))['db'];config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);var htmlToText=require(_0xe0b0('0x10'));var jayson=require(_0xe0b0('0x11'));var client=jayson['client'][_0xe0b0('0x12')]({'port':0x232c});var client9002=jayson[_0xe0b0('0x13')]['http']({'port':0x232a});var client9003=jayson[_0xe0b0('0x13')][_0xe0b0('0x12')]({'port':0x232b});var client9001=jayson[_0xe0b0('0x13')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3068c0,_0x1c358a,_0x3cc19a,_0x45f914){return new BPromise(function(_0x34fed4,_0x4d2bf7){var _0x3782be=_0x45f914||client;return _0x3782be[_0xe0b0('0x14')](_0x3068c0,_0x3cc19a)[_0xe0b0('0x15')](function(_0x24babd){logger[_0xe0b0('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x1c358a,_0xe0b0('0x17'));logger['debug'](_0xe0b0('0x18'),_0x1c358a,_0xe0b0('0x17'),JSON['stringify'](_0x24babd));if(_0x24babd[_0xe0b0('0x19')]){if(_0x24babd['error'][_0xe0b0('0x1a')]===0x1f4){logger[_0xe0b0('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x1c358a,_0x24babd['error'][_0xe0b0('0x1b')]);return _0x4d2bf7(_0x24babd['error']['message']);}logger['error'](_0xe0b0('0x1c'),_0x1c358a,_0x24babd['error']['message']);return _0x34fed4(_0x24babd[_0xe0b0('0x19')]['message']);}else{logger[_0xe0b0('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x1c358a,_0xe0b0('0x17'));_0x34fed4(_0x24babd[_0xe0b0('0x1d')][_0xe0b0('0x1b')]);}})[_0xe0b0('0x1e')](function(_0x2cf6a1){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1c358a,_0x2cf6a1);_0x4d2bf7(_0x2cf6a1);});});}function respondWithStatusCode(_0x2fa820,_0x5512bb){_0x5512bb=_0x5512bb||0xcc;return function(_0x12b260){if(_0x12b260){return _0x2fa820[_0xe0b0('0x1f')](_0x5512bb);}return _0x2fa820['status'](_0x5512bb)[_0xe0b0('0x20')]();};}function respondWithResult(_0x503883,_0x2208d0){_0x2208d0=_0x2208d0||0xc8;return function(_0x49a727){if(_0x49a727){return _0x503883[_0xe0b0('0x21')](_0x2208d0)['json'](_0x49a727);}};}function respondWithFilteredResult(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(_0x4700cc){var _0x4aafbe=typeof _0x4de537[_0xe0b0('0x22')]==='undefined'&&typeof _0x4de537[_0xe0b0('0x23')]===_0xe0b0('0x24');var _0x1f1ebd=_0x4700cc[_0xe0b0('0x25')];var _0x3ec2=_0x4aafbe?0x0:_0x4de537[_0xe0b0('0x22')];var _0x5200a6=_0x4aafbe?_0x4700cc[_0xe0b0('0x25')]:_0x4de537[_0xe0b0('0x22')]+_0x4de537['limit'];var _0x15e13b;if(_0x5200a6>=_0x1f1ebd){_0x5200a6=_0x1f1ebd;_0x15e13b=0xc8;}else{_0x15e13b=0xce;}_0x3e5c88[_0xe0b0('0x21')](_0x15e13b);return _0x3e5c88[_0xe0b0('0x26')](_0xe0b0('0x27'),_0x3ec2+'-'+_0x5200a6+'/'+_0x1f1ebd)[_0xe0b0('0x28')](_0x4700cc);}return null;};}function saveUpdates(_0x254cad){return function(_0x136bd4){if(_0x136bd4){return _0x136bd4['update'](_0x254cad)[_0xe0b0('0x15')](function(_0x3c0109){return _0x3c0109;});}return null;};}function removeEntity(_0x48a9b5){return function(_0x4fe400){if(_0x4fe400){return _0x4fe400[_0xe0b0('0x29')]()[_0xe0b0('0x15')](function(){var _0x422575=_0x4fe400[_0xe0b0('0x2a')]({'plain':!![]});var _0x2ab1b1='ChatWebsites';return db[_0xe0b0('0x2b')][_0xe0b0('0x29')]({'where':{'type':_0x2ab1b1,'resourceId':_0x422575['id']}})[_0xe0b0('0x15')](function(){return _0x4fe400;});})[_0xe0b0('0x15')](function(){_0x48a9b5[_0xe0b0('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ebf2a){return function(_0x208945){if(!_0x208945){_0x3ebf2a[_0xe0b0('0x1f')](0x194);}return _0x208945;};}function handleError(_0x31c6f5,_0x3575bc){_0x3575bc=_0x3575bc||0x1f4;return function(_0x12eeb8){logger[_0xe0b0('0x19')](_0x12eeb8[_0xe0b0('0x2c')]);if(_0x12eeb8[_0xe0b0('0x2d')]){delete _0x12eeb8[_0xe0b0('0x2d')];}_0x31c6f5[_0xe0b0('0x21')](_0x3575bc)[_0xe0b0('0x2e')](_0x12eeb8);};}exports[_0xe0b0('0x2f')]=function(_0x2a1c44,_0xca25d){var _0x4cf80c={'include':[{'model':db[_0xe0b0('0x30')],'as':_0xe0b0('0x31')}]},_0x121608={},_0x135be5={'count':0x0,'rows':[]};var _0x1a2d24=_[_0xe0b0('0x32')](db[_0xe0b0('0x33')]['rawAttributes'],function(_0x521243){return{'name':_0x521243['fieldName'],'type':_0x521243['type'][_0xe0b0('0x34')]};});_0x121608[_0xe0b0('0x35')]=_[_0xe0b0('0x32')](_0x1a2d24,'name');_0x121608[_0xe0b0('0x36')]=_[_0xe0b0('0x37')](_0x2a1c44[_0xe0b0('0x36')]);_0x121608[_0xe0b0('0x38')]=_['intersection'](_0x121608[_0xe0b0('0x35')],_0x121608[_0xe0b0('0x36')]);_0x4cf80c[_0xe0b0('0x39')]=_[_0xe0b0('0x3a')](_0x121608[_0xe0b0('0x35')],qs[_0xe0b0('0x3b')](_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x4cf80c[_0xe0b0('0x39')]=_0x4cf80c['attributes'][_0xe0b0('0x3c')]?_0x4cf80c['attributes']:_0x121608[_0xe0b0('0x35')];if(!_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x3d')](_0xe0b0('0x3e'))){_0x4cf80c['limit']=qs[_0xe0b0('0x23')](_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x23')]);_0x4cf80c[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x22')]);}_0x4cf80c[_0xe0b0('0x3f')]=qs['sort'](_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x40')]);_0x4cf80c['where']=qs['filters'](_[_0xe0b0('0x41')](_0x2a1c44[_0xe0b0('0x36')],_0x121608['filters']),_0x1a2d24);if(_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x42')]){_0x4cf80c[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x4cf80c[_0xe0b0('0x43')],{'$or':_['map'](_0x1a2d24,function(_0x5d2fa2){if(_0x5d2fa2['type']!==_0xe0b0('0x45')){var _0x38e715={};_0x38e715[_0x5d2fa2['name']]={'$like':'%'+_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x38e715;}})});}_0x4cf80c=_[_0xe0b0('0x44')]({},_0x4cf80c,_0x2a1c44[_0xe0b0('0x46')]);var _0x16ccca={'where':_0x4cf80c['where']};return db['ChatWebsite'][_0xe0b0('0x25')](_0x16ccca)[_0xe0b0('0x15')](function(_0x393218){_0x135be5[_0xe0b0('0x25')]=_0x393218;if(_0x2a1c44[_0xe0b0('0x36')]['includeAll']){_0x4cf80c[_0xe0b0('0x47')]=[{'all':!![]}];}return db[_0xe0b0('0x33')]['findAll'](_0x4cf80c);})['then'](function(_0x5ddad1){_0x135be5[_0xe0b0('0x48')]=_0x5ddad1;return _0x135be5;})[_0xe0b0('0x15')](respondWithFilteredResult(_0xca25d,_0x4cf80c))[_0xe0b0('0x1e')](handleError(_0xca25d,null));};exports[_0xe0b0('0x49')]=function(_0x5b1756,_0x2e2b10){var _0x87d8f3={'raw':![],'where':{'id':_0x5b1756['params']['id']},'include':[{'model':db[_0xe0b0('0x30')],'as':_0xe0b0('0x31')}]},_0x483f12={};_0x483f12['model']=_[_0xe0b0('0x37')](db[_0xe0b0('0x33')]['rawAttributes']);_0x483f12['query']=_[_0xe0b0('0x37')](_0x5b1756['query']);_0x483f12[_0xe0b0('0x38')]=_[_0xe0b0('0x3a')](_0x483f12[_0xe0b0('0x35')],_0x483f12[_0xe0b0('0x36')]);_0x87d8f3[_0xe0b0('0x39')]=_[_0xe0b0('0x3a')](_0x483f12['model'],qs['fields'](_0x5b1756[_0xe0b0('0x36')]['fields']));_0x87d8f3['attributes']=_0x87d8f3[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x87d8f3['attributes']:_0x483f12['model'];if(_0x5b1756[_0xe0b0('0x36')][_0xe0b0('0x4a')]){_0x87d8f3[_0xe0b0('0x47')]=[{'all':!![]}];}_0x87d8f3=_[_0xe0b0('0x44')]({},_0x87d8f3,_0x5b1756[_0xe0b0('0x46')]);return db[_0xe0b0('0x33')][_0xe0b0('0x4b')](_0x87d8f3)['then'](handleEntityNotFound(_0x2e2b10,null))[_0xe0b0('0x15')](respondWithResult(_0x2e2b10,null))['catch'](handleError(_0x2e2b10,null));};exports[_0xe0b0('0x4c')]=function(_0x54106c,_0x5b2055){return db[_0xe0b0('0x33')][_0xe0b0('0x4c')](_0x54106c[_0xe0b0('0x4d')],{})[_0xe0b0('0x15')](function(_0x3d8013){var _0x2a588d=_0x54106c[_0xe0b0('0x4e')][_0xe0b0('0x2a')]({'plain':!![]});if(!_0x2a588d)throw new Error(_0xe0b0('0x4f'));if(_0x2a588d['role']===_0xe0b0('0x4e')){var _0x57ccc9=_0x3d8013[_0xe0b0('0x2a')]({'plain':!![]});var _0x3ae36e=_0xe0b0('0x50');return db[_0xe0b0('0x51')][_0xe0b0('0x4b')]({'where':{'name':_0x3ae36e,'userProfileId':_0x2a588d[_0xe0b0('0x52')]},'raw':!![]})['then'](function(_0x1a057c){if(_0x1a057c&&_0x1a057c[_0xe0b0('0x53')]===0x0){return db[_0xe0b0('0x2b')][_0xe0b0('0x4c')]({'name':_0x57ccc9[_0xe0b0('0x2d')],'resourceId':_0x57ccc9['id'],'type':_0x1a057c[_0xe0b0('0x2d')],'sectionId':_0x1a057c['id']},{})[_0xe0b0('0x15')](function(){return _0x3d8013;});}else{return _0x3d8013;}})[_0xe0b0('0x1e')](function(_0x85824c){logger[_0xe0b0('0x19')](_0xe0b0('0x54'),_0x85824c);throw _0x85824c;});}return _0x3d8013;})[_0xe0b0('0x15')](respondWithResult(_0x5b2055,0xc9))[_0xe0b0('0x1e')](handleError(_0x5b2055,null));};exports[_0xe0b0('0x55')]=function(_0xcdf97,_0x34c642){if(_0xcdf97[_0xe0b0('0x4d')]['id']){delete _0xcdf97[_0xe0b0('0x4d')]['id'];}return db['ChatWebsite'][_0xe0b0('0x4b')]({'where':{'id':_0xcdf97[_0xe0b0('0x56')]['id']},'include':[{'model':db[_0xe0b0('0x30')],'as':_0xe0b0('0x31')}]})[_0xe0b0('0x15')](handleEntityNotFound(_0x34c642,null))[_0xe0b0('0x15')](saveUpdates(_0xcdf97[_0xe0b0('0x4d')],null))['then'](respondWithResult(_0x34c642,null))['catch'](handleError(_0x34c642,null));};exports[_0xe0b0('0x29')]=function(_0x2a0415,_0x157556){return db['ChatWebsite'][_0xe0b0('0x4b')]({'where':{'id':_0x2a0415[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x157556,null))[_0xe0b0('0x15')](removeEntity(_0x157556,null))[_0xe0b0('0x1e')](handleError(_0x157556,null));};exports['describe']=function(_0x370f8c,_0x242120){return db[_0xe0b0('0x33')]['describe']()[_0xe0b0('0x15')](respondWithResult(_0x242120,null))[_0xe0b0('0x1e')](handleError(_0x242120,null));};exports['addDisposition']=function(_0x1bd249,_0x4c5478){if(_0x1bd249['body']['id']){delete _0x1bd249[_0xe0b0('0x4d')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x1bd249[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x4c5478,null))[_0xe0b0('0x15')](function(_0x1a4fad){if(_0x1a4fad){_0x1bd249['body'][_0xe0b0('0x57')]=_0x1a4fad['id'];return db[_0xe0b0('0x58')][_0xe0b0('0x4c')](_0x1bd249[_0xe0b0('0x4d')]);}})[_0xe0b0('0x15')](respondWithResult(_0x4c5478,null))[_0xe0b0('0x1e')](handleError(_0x4c5478,null));};exports[_0xe0b0('0x59')]=function(_0x224f1e,_0x514df5){var _0x51940f={'raw':![],'where':{}};var _0x4b41a={};var _0x35144f={'count':0x0,'rows':[]};return db[_0xe0b0('0x33')]['findOne']({'where':{'id':_0x224f1e['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x514df5,null))[_0xe0b0('0x15')](function(_0x5d7cf4){if(_0x5d7cf4){_0x4b41a['model']=_[_0xe0b0('0x37')](db[_0xe0b0('0x58')][_0xe0b0('0x5a')]);_0x4b41a[_0xe0b0('0x36')]=_[_0xe0b0('0x37')](_0x224f1e[_0xe0b0('0x36')]);_0x4b41a[_0xe0b0('0x38')]=_[_0xe0b0('0x3a')](_0x4b41a['model'],_0x4b41a[_0xe0b0('0x36')]);_0x51940f[_0xe0b0('0x39')]=_[_0xe0b0('0x3a')](_0x4b41a['model'],qs['fields'](_0x224f1e['query']['fields']));_0x51940f['attributes']=_0x51940f['attributes'][_0xe0b0('0x3c')]?_0x51940f['attributes']:_0x4b41a['model'];if(!_0x224f1e[_0xe0b0('0x36')][_0xe0b0('0x3d')](_0xe0b0('0x3e'))){_0x51940f[_0xe0b0('0x23')]=qs[_0xe0b0('0x23')](_0x224f1e[_0xe0b0('0x36')][_0xe0b0('0x23')]);_0x51940f[_0xe0b0('0x22')]=qs['offset'](_0x224f1e[_0xe0b0('0x36')][_0xe0b0('0x22')]);}_0x51940f[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x224f1e[_0xe0b0('0x36')][_0xe0b0('0x40')]);_0x51940f[_0xe0b0('0x43')]=qs['filters'](_[_0xe0b0('0x41')](_0x224f1e['query'],_0x4b41a[_0xe0b0('0x38')]));_0x51940f[_0xe0b0('0x43')][_0xe0b0('0x57')]=_0x5d7cf4['id'];if(_0x224f1e[_0xe0b0('0x36')]['filter']){_0x51940f[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x51940f['where'],{'$or':_['map'](_0x51940f[_0xe0b0('0x39')],function(_0x30adc5){var _0x196625={};_0x196625[_0x30adc5]={'$like':'%'+_0x224f1e[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x196625;})});}_0x51940f=_[_0xe0b0('0x44')]({},_0x51940f,_0x224f1e[_0xe0b0('0x46')]);return db[_0xe0b0('0x58')][_0xe0b0('0x25')]({'where':_0x51940f[_0xe0b0('0x43')]})['then'](function(_0x4c512b){_0x35144f[_0xe0b0('0x25')]=_0x4c512b;if(_0x224f1e['query']['includeAll']){_0x51940f['include']=[{'all':!![]}];}return db['Disposition'][_0xe0b0('0x5b')](_0x51940f);})['then'](function(_0x654d2b){_0x35144f[_0xe0b0('0x48')]=_0x654d2b;return _0x35144f;});}})[_0xe0b0('0x15')](respondWithFilteredResult(_0x514df5,_0x51940f))[_0xe0b0('0x1e')](handleError(_0x514df5,null));};exports['removeDispositions']=function(_0x31b218,_0x948708){return db['ChatWebsite'][_0xe0b0('0x4b')]({'where':{'id':_0x31b218[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x948708,null))[_0xe0b0('0x15')](function(_0x27af09){if(_0x27af09){return _0x27af09['removeDispositions'](_0x31b218['query']['ids']);}})['then'](respondWithStatusCode(_0x948708,null))['catch'](handleError(_0x948708,null));};exports[_0xe0b0('0x5c')]=function(_0x567e1a,_0x3c09af){if(_0x567e1a['body']['id']){delete _0x567e1a[_0xe0b0('0x4d')]['id'];}return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x567e1a[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x3c09af,null))[_0xe0b0('0x15')](function(_0x58da19){if(_0x58da19){_0x567e1a['body']['ChatWebsiteId']=_0x58da19['id'];return db['CannedAnswer'][_0xe0b0('0x4c')](_0x567e1a[_0xe0b0('0x4d')]);}})[_0xe0b0('0x15')](respondWithResult(_0x3c09af,null))[_0xe0b0('0x1e')](handleError(_0x3c09af,null));};exports[_0xe0b0('0x5d')]=function(_0x534881,_0x234716){var _0x39a07b={'raw':![],'where':{}};var _0xf77616={};var _0xc6090e={'count':0x0,'rows':[]};return db[_0xe0b0('0x33')][_0xe0b0('0x5e')]({'where':{'id':_0x534881[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x234716,null))[_0xe0b0('0x15')](function(_0x5565ef){if(_0x5565ef){_0xf77616['model']=_[_0xe0b0('0x37')](db[_0xe0b0('0x5f')]['rawAttributes']);_0xf77616[_0xe0b0('0x36')]=_[_0xe0b0('0x37')](_0x534881[_0xe0b0('0x36')]);_0xf77616[_0xe0b0('0x38')]=_[_0xe0b0('0x3a')](_0xf77616[_0xe0b0('0x35')],_0xf77616[_0xe0b0('0x36')]);_0x39a07b[_0xe0b0('0x39')]=_['intersection'](_0xf77616['model'],qs['fields'](_0x534881[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x39a07b['attributes']=_0x39a07b[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x39a07b[_0xe0b0('0x39')]:_0xf77616[_0xe0b0('0x35')];if(!_0x534881['query']['hasOwnProperty']('nolimit')){_0x39a07b[_0xe0b0('0x23')]=qs[_0xe0b0('0x23')](_0x534881['query'][_0xe0b0('0x23')]);_0x39a07b[_0xe0b0('0x22')]=qs['offset'](_0x534881['query'][_0xe0b0('0x22')]);}_0x39a07b['order']=qs[_0xe0b0('0x40')](_0x534881['query'][_0xe0b0('0x40')]);_0x39a07b[_0xe0b0('0x43')]=qs[_0xe0b0('0x38')](_[_0xe0b0('0x41')](_0x534881[_0xe0b0('0x36')],_0xf77616[_0xe0b0('0x38')]));_0x39a07b[_0xe0b0('0x43')][_0xe0b0('0x57')]=_0x5565ef['id'];if(_0x534881[_0xe0b0('0x36')]['filter']){_0x39a07b[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x39a07b[_0xe0b0('0x43')],{'$or':_['map'](_0x39a07b[_0xe0b0('0x39')],function(_0x4ad24f){var _0x328c96={};_0x328c96[_0x4ad24f]={'$like':'%'+_0x534881[_0xe0b0('0x36')]['filter']+'%'};return _0x328c96;})});}_0x39a07b=_[_0xe0b0('0x44')]({},_0x39a07b,_0x534881['options']);return db['CannedAnswer'][_0xe0b0('0x25')]({'where':_0x39a07b['where']})['then'](function(_0x4f027c){_0xc6090e[_0xe0b0('0x25')]=_0x4f027c;if(_0x534881[_0xe0b0('0x36')][_0xe0b0('0x4a')]){_0x39a07b[_0xe0b0('0x47')]=[{'all':!![]}];}return db[_0xe0b0('0x5f')]['findAll'](_0x39a07b);})[_0xe0b0('0x15')](function(_0x4609d5){_0xc6090e[_0xe0b0('0x48')]=_0x4609d5;return _0xc6090e;});}})['then'](respondWithFilteredResult(_0x234716,_0x39a07b))[_0xe0b0('0x1e')](handleError(_0x234716,null));};exports[_0xe0b0('0x60')]=function(_0x5817aa,_0x5854ea){return db[_0xe0b0('0x33')]['find']({'where':{'id':_0x5817aa[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x5854ea,null))[_0xe0b0('0x15')](function(_0x7ae597){if(_0x7ae597){return _0x7ae597[_0xe0b0('0x60')](_0x5817aa[_0xe0b0('0x36')][_0xe0b0('0x61')]);}})['then'](respondWithStatusCode(_0x5854ea,null))[_0xe0b0('0x1e')](handleError(_0x5854ea,null));};exports[_0xe0b0('0x62')]=function(_0x135fec,_0x42add7){_0x135fec[_0xe0b0('0x4d')]['sitepic']=_0x135fec['file'][_0xe0b0('0x63')];return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x135fec[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x42add7,null))[_0xe0b0('0x15')](saveUpdates(_0x135fec[_0xe0b0('0x4d')],null))[_0xe0b0('0x15')](respondWithResult(_0x42add7,null))[_0xe0b0('0x1e')](handleError(_0x42add7,null));};exports[_0xe0b0('0x64')]=function(_0x4fe048,_0xac45e6){_0x4fe048[_0xe0b0('0x4d')][_0xe0b0('0x65')]=_0x4fe048[_0xe0b0('0x66')]['filename'];return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x4fe048[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0xac45e6,null))[_0xe0b0('0x15')](saveUpdates(_0x4fe048['body'],null))[_0xe0b0('0x15')](respondWithResult(_0xac45e6,null))['catch'](handleError(_0xac45e6,null));};exports[_0xe0b0('0x67')]=function(_0x196ab7,_0x3d8f17){_0x196ab7[_0xe0b0('0x4d')][_0xe0b0('0x68')]=_0x196ab7['file']['filename'];return db[_0xe0b0('0x33')]['find']({'where':{'id':_0x196ab7[_0xe0b0('0x56')]['id']}})['then'](handleEntityNotFound(_0x3d8f17,null))[_0xe0b0('0x15')](saveUpdates(_0x196ab7[_0xe0b0('0x4d')],null))[_0xe0b0('0x15')](respondWithResult(_0x3d8f17,null))[_0xe0b0('0x1e')](handleError(_0x3d8f17,null));};exports[_0xe0b0('0x69')]=function(_0x1bb4da,_0x43ff30){_0x1bb4da['body']['systemAvatar']=_0x1bb4da[_0xe0b0('0x66')][_0xe0b0('0x63')];return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x1bb4da[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x43ff30,null))[_0xe0b0('0x15')](saveUpdates(_0x1bb4da[_0xe0b0('0x4d')],null))[_0xe0b0('0x15')](respondWithResult(_0x43ff30,null))[_0xe0b0('0x1e')](handleError(_0x43ff30,null));};exports['getLogo']=function(_0x4a4880,_0x3dd34e){var _0x26caf8=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x6c'));var _0x43c2bb={'where':{'id':_0x4a4880[_0xe0b0('0x56')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x4c4748=![];return require(_0xe0b0('0x6d'))[_0xe0b0('0x6e')]()[_0xe0b0('0x15')](function(_0x467f0e){if(_0x467f0e){_0x4c4748=_0x467f0e[_0xe0b0('0x6f')];}})[_0xe0b0('0x15')](function(){return db[_0xe0b0('0x33')][_0xe0b0('0x4b')](_0x43c2bb);})[_0xe0b0('0x15')](handleEntityNotFound(_0x3dd34e,null))[_0xe0b0('0x15')](function(_0x4cbe35){if(_0x4cbe35){if(!_[_0xe0b0('0x70')](_0x4cbe35[_0xe0b0('0x71')])){if(fs['existsSync'](path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x72'),_0x4cbe35[_0xe0b0('0x71')]))&&_0x4c4748){_0x26caf8=path[_0xe0b0('0x6a')](config['root'],_0xe0b0('0x72'),_0x4cbe35[_0xe0b0('0x71')]);}}return _0x3dd34e[_0xe0b0('0x73')](_0x26caf8);}})[_0xe0b0('0x1e')](handleError(_0x3dd34e,null));};exports[_0xe0b0('0x74')]=function(_0x5f1fd3,_0x475404){var _0x58d61b=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x75'));var _0x539a12={'where':{'id':_0x5f1fd3['params']['id']},'attributes':['id',_0xe0b0('0x65')],'raw':!![]};return db[_0xe0b0('0x33')][_0xe0b0('0x4b')](_0x539a12)['then'](handleEntityNotFound(_0x475404,null))['then'](function(_0x5da5eb){if(_0x5da5eb){if(!_['isNil'](_0x5da5eb['agentAvatar'])){if(fs['existsSync'](path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],'server/files/images/avatars/',_0x5da5eb[_0xe0b0('0x65')]))){_0x58d61b=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x76'),_0x5da5eb[_0xe0b0('0x65')]);}}return _0x475404['download'](_0x58d61b);}})['catch'](handleError(_0x475404,null));};exports[_0xe0b0('0x77')]=function(_0xd2dd5a,_0x3e592c){var _0x52dfd8=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x78'));var _0xd231c4={'where':{'id':_0xd2dd5a[_0xe0b0('0x56')]['id']},'attributes':['id',_0xe0b0('0x68'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0xd231c4)[_0xe0b0('0x15')](handleEntityNotFound(_0x3e592c,null))[_0xe0b0('0x15')](function(_0x9f9d8d){if(_0x9f9d8d){if(!_[_0xe0b0('0x70')](_0x9f9d8d[_0xe0b0('0x68')])){if(fs[_0xe0b0('0x79')](path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],'server/files/images/avatars/',_0x9f9d8d['customerAvatar']))&&_0x9f9d8d[_0xe0b0('0x7a')]){_0x52dfd8=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],'server/files/images/avatars/',_0x9f9d8d[_0xe0b0('0x68')]);}}return _0x3e592c[_0xe0b0('0x73')](_0x52dfd8);}})[_0xe0b0('0x1e')](handleError(_0x3e592c,null));};exports['getSystemAvatar']=function(_0x36fa1f,_0x4d2ca9){var _0x74693e=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x7b'));var _0x3b133a={'where':{'id':_0x36fa1f[_0xe0b0('0x56')]['id']},'attributes':['id',_0xe0b0('0x7c')],'raw':!![]};return db['ChatWebsite'][_0xe0b0('0x4b')](_0x3b133a)[_0xe0b0('0x15')](handleEntityNotFound(_0x4d2ca9,null))['then'](function(_0x44e4a8){if(_0x44e4a8){if(!_[_0xe0b0('0x70')](_0x44e4a8[_0xe0b0('0x7c')])){if(fs['existsSync'](path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x76'),_0x44e4a8['systemAvatar']))){_0x74693e=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x76'),_0x44e4a8[_0xe0b0('0x7c')]);}}return _0x4d2ca9[_0xe0b0('0x73')](_0x74693e);}})[_0xe0b0('0x1e')](handleError(_0x4d2ca9,null));};exports['notify']=function(_0x44da91,_0x701ba){var _0x21db87=require(_0xe0b0('0x7d'));var _0x11452e=new _0x21db87();var _0xaca03c=_0x11452e[_0xe0b0('0x7e')](_0x44da91[_0xe0b0('0x7f')][_0xe0b0('0x80')])[_0xe0b0('0x81')]();var _0xde3bca={'body':_0x44da91['body'],'channel':_0xe0b0('0x82')};var _0x51bab6=[];var _0x56c497=[];var _0x1d1981={};var _0x1c29dd=![];return db['CmContact'][_0xe0b0('0x83')]()[_0xe0b0('0x15')](function(_0x141b38){if(!_0x141b38){throw new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x86'));}_0x51bab6=_[_0xe0b0('0x87')](_[_0xe0b0('0x37')](_0x141b38),[_0xe0b0('0x88'),'updatedAt']);_0x56c497=_[_0xe0b0('0x87')](_[_0xe0b0('0x37')](_0x141b38),[_0xe0b0('0x88'),_0xe0b0('0x89'),'CompanyId','ListId']);if(_0x44da91[_0xe0b0('0x4d')]['id']){delete _0x44da91[_0xe0b0('0x4d')]['id'];}if(_[_0xe0b0('0x70')](_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x8a')])){throw new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x8b'));}if(_[_0xe0b0('0x70')](_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x4d')])||_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x4d')]===''){throw new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x8c'));}if(_[_0xe0b0('0x70')](_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x8d')])){throw new db['Sequelize'][(_0xe0b0('0x85'))](_0xe0b0('0x8e')+_0x56c497);}if(!_[_0xe0b0('0x8f')](_0x56c497,_0x44da91['body'][_0xe0b0('0x8d')])){throw new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x90')+_0x56c497);}_0x1d1981[_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x8d')]]=_0x44da91[_0xe0b0('0x4d')]['from'];})[_0xe0b0('0x15')](function(){return db['ChatWebsite'][_0xe0b0('0x4b')]({'where':{'id':_0x44da91['params']['id']},'include':[{'model':db[_0xe0b0('0x91')],'as':_0xe0b0('0x92'),'include':[{'model':db['CmContact'],'as':_0xe0b0('0x93'),'where':_0x1d1981,'limit':0x1,'order':[['updatedAt',_0xe0b0('0x94')]]}]},{'model':db[_0xe0b0('0x95')],'as':_0xe0b0('0x96')}]});})[_0xe0b0('0x15')](handleEntityNotFound(_0x701ba,null))[_0xe0b0('0x15')](function(_0x13199b){if(_0x13199b&&_0x13199b[_0xe0b0('0x92')]){_0xde3bca[_0xe0b0('0x97')]=_0x13199b;_0xde3bca['applications']=_0x13199b[_0xe0b0('0x96')];_0xde3bca['list']=_0x13199b['List'];_0xde3bca[_0xe0b0('0x98')]=_[_0xe0b0('0x99')](_0xde3bca[_0xe0b0('0x98')],['priority'],['asc']);if(_0xde3bca[_0xe0b0('0x97')][_0xe0b0('0x96')]){delete _0xde3bca['account'][_0xe0b0('0x96')];}if(_0xde3bca[_0xe0b0('0x97')][_0xe0b0('0x92')]&&_0xde3bca[_0xe0b0('0x97')][_0xe0b0('0x92')][_0xe0b0('0x93')][_0xe0b0('0x3c')]){return _0xde3bca[_0xe0b0('0x97')][_0xe0b0('0x92')]['Contacts'][0x0];}var _0x569400=_[_0xe0b0('0x9a')](_0x44da91[_0xe0b0('0x4d')],{'firstName':_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x8a')],'ListId':_0x13199b[_0xe0b0('0x9b')]});_0x569400[_0x44da91[_0xe0b0('0x4d')]['mapKey']]=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x8a')];return db[_0xe0b0('0x9c')][_0xe0b0('0x4c')](_0x569400,{'fields':_0x51bab6,'raw':!![]});}})[_0xe0b0('0x15')](handleEntityNotFound(_0x701ba,null))['then'](function(_0x3ae295){_0xde3bca[_0xe0b0('0x9d')]=_0x3ae295;var _0x321b0b=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x9e')];if(_0x44da91[_0xe0b0('0x7f')][_0xe0b0('0x9f')]){_0x321b0b=_0x44da91[_0xe0b0('0x7f')][_0xe0b0('0x9f')];}else if(_0x44da91[_0xe0b0('0x7f')]['x-forwarded-for']){_0x321b0b=_[_0xe0b0('0xa0')](_0x44da91[_0xe0b0('0x7f')]['x-forwarded-for'][_0xe0b0('0xa1')](','));}if(_0x3ae295){var _0x494567={'ContactId':_0x3ae295['id'],'ChatWebsiteId':_0x44da91[_0xe0b0('0x56')]['id'],'from':(_0x3ae295[_0xe0b0('0xa2')]||'')+'\x20'+(_0x3ae295['lastName']||''),'customerIp':_0x321b0b,'customerPort':_0x44da91[_0xe0b0('0x7f')][_0xe0b0('0xa3')]?_0x44da91[_0xe0b0('0x7f')][_0xe0b0('0xa3')]:null,'referer':_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xa4')],'browserName':_0xaca03c[_0xe0b0('0xa5')]['name']&&_0xaca03c['browser'][_0xe0b0('0xa6')]?util[_0xe0b0('0xa7')](_0xe0b0('0xa8'),_0xaca03c['browser'][_0xe0b0('0x2d')],_0xaca03c[_0xe0b0('0xa5')][_0xe0b0('0xa6')]):_0xe0b0('0xa9'),'browserVersion':_0xaca03c[_0xe0b0('0xa5')][_0xe0b0('0xa6')]||_0xe0b0('0xa9'),'osName':util[_0xe0b0('0xa7')](_0xe0b0('0xa8'),_0xaca03c['os'][_0xe0b0('0x2d')],_0xaca03c['os']['version']),'osVersion':_0xaca03c['os']['version'],'deviceModel':_0xaca03c[_0xe0b0('0xaa')][_0xe0b0('0x35')]&&_0xaca03c[_0xe0b0('0xaa')][_0xe0b0('0xab')]?util[_0xe0b0('0xa7')](_0xe0b0('0xac'),_0xaca03c[_0xe0b0('0xaa')]['model'],_0xaca03c[_0xe0b0('0xaa')][_0xe0b0('0xab')],_0xaca03c[_0xe0b0('0xaa')]['type']):null,'deviceVendor':_0xaca03c[_0xe0b0('0xaa')][_0xe0b0('0xab')],'deviceType':_0xaca03c['device']['type'],'formData':JSON[_0xe0b0('0xad')](_0x44da91['body'])};var _0x7eef44={'ChatWebsiteId':_0x44da91['params']['id'],'closed':![]};if(_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xae')]){_0x7eef44['threadId']=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xae')];return db['ChatInteraction'][_0xe0b0('0x4b')]({'where':_0x7eef44})['then'](function(_0x1395be){if(_0x1395be){return[_0x1395be,![]];}_0x494567[_0xe0b0('0xae')]=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xae')];_0x494567[_0xe0b0('0xaf')]=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xaf')];return db['ChatInteraction'][_0xe0b0('0x4c')](_0x494567)[_0xe0b0('0x15')](function(_0x5e1db2){return[_0x5e1db2,!![]];});});}_0x7eef44['ContactId']=_0x3ae295['id'];if(_0x44da91[_0xe0b0('0x4d')]['interaction']&&_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xb0')]['id']){_0x7eef44['id']=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xb0')]['id'];return db[_0xe0b0('0xb1')][_0xe0b0('0x4b')]({'where':_0x7eef44})[_0xe0b0('0x15')](function(_0x8364b0){if(_0x8364b0){return[_0x8364b0,![]];}return db[_0xe0b0('0xb1')][_0xe0b0('0x4c')](_0x494567)[_0xe0b0('0x15')](function(_0x3fc0d6){return[_0x3fc0d6,!![]];});});}return db[_0xe0b0('0xb1')][_0xe0b0('0x4c')](_0x494567)['then'](function(_0x180b6c){return[_0x180b6c,!![]];});}})[_0xe0b0('0xb2')](function(_0x2cd15d,_0x3e82b4){if(_0x2cd15d){_0x1c29dd=_0x3e82b4;if(!_0x3e82b4){var _0x3cbf47={'from':(_0xde3bca['contact'][_0xe0b0('0xa2')]||'')+'\x20'+(_0xde3bca[_0xe0b0('0x9d')][_0xe0b0('0xb3')]||'')};if(_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xae')]&&_0x44da91[_0xe0b0('0x4d')]['messageId']&&_0x44da91[_0xe0b0('0x4d')]['threadId']!=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xb4')]){_0x3cbf47[_0xe0b0('0xae')]=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xb4')];}return _0x2cd15d[_0xe0b0('0x55')](_0x3cbf47);}else{return _0x2cd15d;}}})['then'](function(_0xe574f1){_0xde3bca[_0xe0b0('0xb0')]=_0xe574f1[_0xe0b0('0x2a')]({'plain':!![]});_0xde3bca[_0xe0b0('0xb0')][_0xe0b0('0xb5')]=_0x1c29dd;if(_0xde3bca[_0xe0b0('0xb0')][_0xe0b0('0xb5')]){if(_0xde3bca[_0xe0b0('0x97')]['autoclose']){_0xde3bca['applications'][_0xe0b0('0xb6')]({'id':0x0,'priority':_0xde3bca['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0xe0b0('0xb7')});}}return db['ChatMessage']['create']({'body':_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x4d')],'ChatWebsiteId':_0x44da91[_0xe0b0('0x56')]['id'],'ChatInteractionId':_0xe574f1['id'],'direction':'in','ContactId':_0xde3bca[_0xe0b0('0x9d')]['id'],'AttachmentId':_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xb8')]});})[_0xe0b0('0x15')](function(_0x450b09){_0xde3bca[_0xe0b0('0x1b')]=_0x450b09;if(_0xde3bca[_0xe0b0('0xb0')]['UserId']){return db['User'][_0xe0b0('0x4b')]({'attributes':['id',_0xe0b0('0x2d')],'where':{'id':_0xde3bca[_0xe0b0('0xb0')]['UserId']}})['then'](function(_0x254691){if(_0x254691){_0xde3bca['applications'][_0xe0b0('0xb9')]({'id':0x0,'priority':0x0,'app':_0xe0b0('0xba'),'appdata':_0x254691['name']+','+(_0xde3bca[_0xe0b0('0x97')][_0xe0b0('0xbb')]||0xa),'interval':_0xe0b0('0xb7')});_0xde3bca[_0xe0b0('0xbc')]=!![];}return respondWithRpcPromise(_0xe0b0('0xbd'),_0xe0b0('0xbe'),_0xde3bca);});}return respondWithRpcPromise(_0xe0b0('0xbd'),'startRouting',_0xde3bca);})[_0xe0b0('0x15')](function(_0xea6b40){respondWithRpcPromise(_0xe0b0('0xbf'),_0xe0b0('0xbf'),{'event':_0xe0b0('0xc0'),'message':_0xea6b40},client9002);return _0xea6b40;})['then'](respondWithResult(_0x701ba,null))['catch'](handleError(_0x701ba,null));};exports[_0xe0b0('0xc1')]=function(_0x4a8dfc,_0x4bfa22){var _0x3df5c8,_0x588a19,_0x36901a;var _0x151da2=[];var _0x330ed5={};var _0x35f5c1=_0x4a8dfc['files']||[];var _0x50b163=[];var _0x42affa;return db[_0xe0b0('0x9c')][_0xe0b0('0x83')]()[_0xe0b0('0x15')](function(_0xbafa53){if(!_0xbafa53){throw new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x86'));}_0x151da2=_['difference'](_[_0xe0b0('0x37')](_0xbafa53),[_0xe0b0('0x88'),_0xe0b0('0x89'),'CompanyId',_0xe0b0('0x9b')]);if(_0x4a8dfc[_0xe0b0('0x4d')]['id']){delete _0x4a8dfc[_0xe0b0('0x4d')]['id'];}if(_[_0xe0b0('0x70')](_0x4a8dfc[_0xe0b0('0x4d')][_0xe0b0('0x8a')])){throw _0x4bfa22['status'](0x1f4)[_0xe0b0('0x2e')](new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))]('from\x20is\x20mandatory'));}if(_[_0xe0b0('0x70')](_0x4a8dfc[_0xe0b0('0x4d')][_0xe0b0('0x4d')])||_0x4a8dfc[_0xe0b0('0x4d')]['body']===''){throw _0x4bfa22[_0xe0b0('0x21')](0x1f4)[_0xe0b0('0x2e')](new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x8c')));}if(_[_0xe0b0('0x70')](_0x4a8dfc[_0xe0b0('0x4d')][_0xe0b0('0xc2')])){throw _0x4bfa22['status'](0x1f4)[_0xe0b0('0x2e')](new db['Sequelize']['ValidationError'](_0xe0b0('0xc3')+_0x151da2));}if(!_[_0xe0b0('0x8f')](_0x151da2,_0x4a8dfc[_0xe0b0('0x4d')]['mapKeyOffline'])){throw _0x4bfa22[_0xe0b0('0x21')](0x1f4)['send'](new db[(_0xe0b0('0x84'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x151da2));}_0x330ed5[_0x4a8dfc['body'][_0xe0b0('0xc2')]]=_0x4a8dfc[_0xe0b0('0x4d')]['from'];})[_0xe0b0('0x15')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x4a8dfc[_0xe0b0('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0xe0b0('0x92')},{'model':db[_0xe0b0('0xc4')],'as':_0xe0b0('0xc4')}]});})[_0xe0b0('0x15')](handleEntityNotFound(_0x4bfa22,null))['then'](function(_0x2fe1ab){if(_0x2fe1ab&&_0x2fe1ab[_0xe0b0('0x92')]){_0x588a19=_0x2fe1ab;var _0x4187aa=_[_0xe0b0('0x9a')](_0x4a8dfc[_0xe0b0('0x4d')],{'firstName':_0x4a8dfc['body'][_0xe0b0('0x8a')],'phone':_0x4a8dfc[_0xe0b0('0x4d')]['from'],'ListId':_0x2fe1ab[_0xe0b0('0x9b')]});_0x4187aa[_0x4a8dfc['body'][_0xe0b0('0xc2')]]=_0x4a8dfc[_0xe0b0('0x4d')][_0xe0b0('0x8a')];return db[_0xe0b0('0x9c')][_0xe0b0('0xc5')]({'where':_0x330ed5,'defaults':_0x4187aa});}})[_0xe0b0('0xb2')](function(_0x403f30){if(_0x403f30){_0x36901a=_0x403f30;var _0x5b7b02=fs['readFileSync'](path[_0xe0b0('0x6a')](config['root'],_0xe0b0('0xc6')),_0xe0b0('0xc7'));var _0xdde041=ejs[_0xe0b0('0xc8')](_0x5b7b02,{'body':_[_0xe0b0('0xc9')](_0x4a8dfc[_0xe0b0('0x4d')]['body']),'bodyTitle':_0x588a19['offlineMessageBody']});return db[_0xe0b0('0xca')][_0xe0b0('0x4c')]({'body':_0xdde041,'plainBody':htmlToText['fromString'](_0xdde041),'ContactId':_0x403f30['id'],'ChatWebsiteId':_0x588a19['id']});}})[_0xe0b0('0x15')](function(_0x2d0ba8){_0x42affa=_0x2d0ba8;if(_0x35f5c1['length']){var _0x2ad35d=_0x35f5c1[_0xe0b0('0x32')](function(_0x337db8){return{'name':_0x337db8['originalname'],'basename':_0x337db8[_0xe0b0('0x63')],'type':_0x337db8[_0xe0b0('0xcb')],'ChatOfflineMessageId':_0x2d0ba8['id']};});_0x50b163=_0x2ad35d[_0xe0b0('0x32')](_0x24d9ee=>{var _0x57e90f={'filename':_0x24d9ee[_0xe0b0('0x2d')],'path':path['join'](config[_0xe0b0('0x6b')],_0xe0b0('0xcc'),_0xe0b0('0xcd'),'attachments',_0xe0b0('0xce'),_0x24d9ee[_0xe0b0('0xcf')])};return _0x57e90f;});if(!_0x588a19[_0xe0b0('0xd0')]){return db[_0xe0b0('0xd1')]['transaction'](function(_0x1266c8){return db[_0xe0b0('0xd2')][_0xe0b0('0xd3')](_0x2ad35d,{'transaction':_0x1266c8});});}}})[_0xe0b0('0x15')](function(){if(_0x42affa){_0x3df5c8=_0x42affa;return db[_0xe0b0('0xc4')][_0xe0b0('0x5e')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})['then'](function(_0x25d3fe){if(_0x25d3fe&&_0x25d3fe['Smtp']&&_0x588a19[_0xe0b0('0xd4')]&&_0x588a19['forwardOfflineAddress']){var _0x47d689={'tls':{'rejectUnauthorized':![]}};if(_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0xd6')]){_0x47d689[_0xe0b0('0xd6')]=_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0xd6')];}else{_0x47d689[_0xe0b0('0xd7')]=_0x25d3fe[_0xe0b0('0xd5')]['host'];_0x47d689[_0xe0b0('0xd8')]=_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0xd8')];_0x47d689[_0xe0b0('0xd9')]=_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0xd9')];}if(_0x25d3fe['Smtp']['authentication']){_0x47d689[_0xe0b0('0xda')]={'user':_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0x4e')],'pass':_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0xdb')]};}return respondWithRpcPromise(_0xe0b0('0xdc'),_0xe0b0('0xdd'),{'account':_0x47d689,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x25d3fe[_0xe0b0('0x2d')],_0x25d3fe[_0xe0b0('0xde')]||_0x25d3fe[_0xe0b0('0xd5')]['user']),'to':_0x588a19['forwardOfflineAddress'],'subject':_0x588a19[_0xe0b0('0xdf')],'html':_0x3df5c8[_0xe0b0('0x4d')],'attachments':_0x50b163}},client9003)[_0xe0b0('0x15')](function(){return _0x3df5c8;})[_0xe0b0('0x1e')](function(_0x1427a9){console[_0xe0b0('0x19')](_0x1427a9);});}})[_0xe0b0('0x15')](function(){if(_0x588a19&&_0x588a19[_0xe0b0('0xd0')]&&_0x588a19[_0xe0b0('0xe0')]){var _0x233c95=[];if(_0x35f5c1['length']){_0x233c95=_0x35f5c1[_0xe0b0('0x32')](function(_0x4a577b){return{'name':_0x4a577b[_0xe0b0('0xe1')],'basename':_0x4a577b['filename'],'type':_0x4a577b[_0xe0b0('0xcb')],'ChatOfflineMessageId':_0x42affa['id']};});}var _0x326470;if(!_['isNil'](_0x588a19[_0xe0b0('0xe2')])){var _0x41fd0e=_[_0xe0b0('0x32')](_0x4a8dfc['body'],function(_0x172318){return _0x172318;});var _0xb3018b=_['toPairsIn'](_0x41fd0e)[0x0];var _0x34338e=_[_0xe0b0('0xe3')](_0xb3018b,function(_0x50828f){return _0x50828f;});_0x326470=_0x34338e[0x1][_0x588a19['subjectOffline']];}var _0x33c97b={'from':_0x36901a[_0xe0b0('0xde')],'firstName':_0x36901a['firstName'],'lastName':_0x36901a['lastName'],'mapKey':_0xe0b0('0xde'),'message':{'from':_0x36901a['email'],'to':_0x588a19[_0xe0b0('0xc4')][_0xe0b0('0xde')],'cc':'','subject':_[_0xe0b0('0x70')](_0x326470)?_0x588a19[_0xe0b0('0xdf')]:_0x326470,'messageId':'','sentAt':new Date(),'attach':_0x233c95[_0xe0b0('0x3c')],'attachments':_0x233c95,'originChannel':_0xe0b0('0xe4'),'ChatWebsiteId':_0x588a19['id'],'ChatOfflineMessageId':_0x3df5c8['id'],'originTo':_0x588a19[_0xe0b0('0xc4')]['email']},'body':_0x3df5c8[_0xe0b0('0x4d')]};var _0x5f059f={'account':{'id':_0x588a19['MailAccountId']},'body':_0x33c97b,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xe0b0('0xe5'),_0xe0b0('0xe6'),_0x5f059f,client9001)[_0xe0b0('0x15')](function(){return _0x3df5c8;})[_0xe0b0('0x1e')](function(_0x21ccfe){console['error'](_0x21ccfe);});}return;})['then'](function(){if(_0x3df5c8){return _0x3df5c8;}})['then'](respondWithResult(_0x4bfa22,null))['catch'](function(_0x41b52){console[_0xe0b0('0x19')](_0xe0b0('0x1e'),_0x41b52);for(var _0x5d8613 of _0x35f5c1){var _0x2c18b9=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0xcc'),_0xe0b0('0xcd'),_0xe0b0('0xe7'),_0xe0b0('0xce'),_0x5d8613['filename']);fs_extra[_0xe0b0('0xe8')](_0x2c18b9)[_0xe0b0('0x1e')](function(_0x2bb49d){console[_0xe0b0('0x19')]('Could\x20not\x20remove\x20attachment\x20file',_0x2c18b9,_0x2bb49d);});}});};exports[_0xe0b0('0xe9')]=function(_0x20f040,_0x3eb643){return db[_0xe0b0('0xb1')]['find']({'where':{'id':_0x20f040['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x3eb643,null))[_0xe0b0('0x15')](function(_0x26bd6c){if(_0x26bd6c){return _0x26bd6c[_0xe0b0('0xe9')](_0x20f040[_0xe0b0('0x4d')][_0xe0b0('0x61')],_['omit'](_0x20f040[_0xe0b0('0x4d')],[_0xe0b0('0x61'),'id'])||{});}})[_0xe0b0('0x15')](respondWithResult(_0x3eb643,null))[_0xe0b0('0x1e')](handleError(_0x3eb643,null));};exports[_0xe0b0('0xea')]=function(_0x48706b,_0x164b25){var _0x51afab={'raw':![],'where':{}};var _0x49632d={};var _0x257dda={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x48706b[_0xe0b0('0x56')]['id']}})['then'](handleEntityNotFound(_0x164b25,null))['then'](function(_0x5a04c8){if(_0x5a04c8){_0x49632d[_0xe0b0('0x35')]=_[_0xe0b0('0x37')](db['ChatInteraction'][_0xe0b0('0x5a')]);_0x49632d['query']=_[_0xe0b0('0x37')](_0x48706b[_0xe0b0('0x36')]);_0x49632d[_0xe0b0('0x38')]=_[_0xe0b0('0x3a')](_0x49632d['model'],_0x49632d['query']);_0x51afab['attributes']=_[_0xe0b0('0x3a')](_0x49632d[_0xe0b0('0x35')],qs['fields'](_0x48706b['query'][_0xe0b0('0x3b')]));_0x51afab[_0xe0b0('0x39')]=_0x51afab[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x51afab['attributes']:_0x49632d['model'];if(!_0x48706b[_0xe0b0('0x36')][_0xe0b0('0x3d')]('nolimit')){_0x51afab[_0xe0b0('0x23')]=qs[_0xe0b0('0x23')](_0x48706b['query']['limit']);_0x51afab['offset']=qs[_0xe0b0('0x22')](_0x48706b[_0xe0b0('0x36')]['offset']);}_0x51afab[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x48706b[_0xe0b0('0x36')][_0xe0b0('0x40')]);_0x51afab['where']=qs[_0xe0b0('0x38')](_[_0xe0b0('0x41')](_0x48706b['query'],_0x49632d['filters']));_0x51afab['where'][_0xe0b0('0x57')]=_0x5a04c8['id'];if(_0x48706b['query'][_0xe0b0('0x42')]){_0x51afab['where']=_['merge'](_0x51afab[_0xe0b0('0x43')],{'$or':_[_0xe0b0('0x32')](_0x51afab[_0xe0b0('0x39')],function(_0xe1891c){var _0x4cfd4f={};_0x4cfd4f[_0xe1891c]={'$like':'%'+_0x48706b['query']['filter']+'%'};return _0x4cfd4f;})});}_0x51afab=_['merge']({},_0x51afab,_0x48706b[_0xe0b0('0x46')]);return db[_0xe0b0('0xb1')][_0xe0b0('0x25')]({'where':_0x51afab['where']})[_0xe0b0('0x15')](function(_0x1f1133){_0x257dda['count']=_0x1f1133;if(_0x48706b[_0xe0b0('0x36')][_0xe0b0('0x4a')]){_0x51afab[_0xe0b0('0x47')]=[{'model':db[_0xe0b0('0x9c')],'as':'Contact','required':![]},{'model':db[_0xe0b0('0xeb')],'as':_0xe0b0('0xec'),'attributes':[_0xe0b0('0x2d'),'fullname',_0xe0b0('0xed')],'required':![]},{'model':db[_0xe0b0('0xee')],'as':_0xe0b0('0xef'),'attributes':['id',_0xe0b0('0x2d'),'color'],'where':_0x48706b[_0xe0b0('0x36')][_0xe0b0('0xf0')]?{'id':_0x48706b[_0xe0b0('0x36')][_0xe0b0('0xf0')]}:undefined,'required':_0x48706b[_0xe0b0('0x36')]['tag']?!![]:![]}];}return db[_0xe0b0('0xb1')][_0xe0b0('0x5b')](_0x51afab);})['then'](function(_0xb263f6){_0x257dda[_0xe0b0('0x48')]=_0xb263f6;return _0x257dda;});}})[_0xe0b0('0x15')](respondWithFilteredResult(_0x164b25,_0x51afab))[_0xe0b0('0x1e')](handleError(_0x164b25,null));};function iftimePromise(_0x1ffc75,_0x3a39d7){return respondWithRpcPromise('Command',_0xe0b0('0xf1'),{'command':_0x3a39d7[_0xe0b0('0xf2')]?util[_0xe0b0('0xa7')](_0xe0b0('0xf3'),_0x1ffc75[_0xe0b0('0xf4')],_0x3a39d7[_0xe0b0('0xf2')]):util[_0xe0b0('0xa7')](_0xe0b0('0xf5'),_0x1ffc75[_0xe0b0('0xf4')])},client9002)[_0xe0b0('0x15')](function(_0x4d12b2){var _0xeeff22=_0x4d12b2&&_0x4d12b2['indexOf'](_0xe0b0('0xf6'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x3a39d7['id'],_0x1ffc75['id'],_0x1ffc75[_0xe0b0('0xf4')],_0xeeff22?_0xe0b0('0xf7'):'OFFLINE',_0x3a39d7['timezone']?_0x3a39d7[_0xe0b0('0xf2')]:_0xe0b0('0xf8'));return _0xeeff22;})['catch'](function(_0x5501c2){logger[_0xe0b0('0x19')](_0xe0b0('0xf9'),_0x3a39d7['id'],_0x1ffc75['id'],_0x1ffc75['interval'],util[_0xe0b0('0xfa')](_0x5501c2,{'showHidden':![],'depth':null}),_0x3a39d7[_0xe0b0('0xf2')]?_0x3a39d7[_0xe0b0('0xf2')]:_0xe0b0('0xf8'));return![];});}exports['getSnippet']=function(_0x230ff2,_0x22d53d){var _0x2251c2=0x0;var _0x24271d=0x0;var _0x385ffb=![];var _0x594eaa;var _0x2932c3;return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x230ff2['params']['id']},'include':[{'model':db[_0xe0b0('0xfb')],'as':_0xe0b0('0xfb'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xe0b0('0xf4')],'raw':!![]}]}]})[_0xe0b0('0x15')](handleEntityNotFound(_0x22d53d,null))[_0xe0b0('0x15')](function(_0x46fbdc){if(_0x46fbdc){_0x594eaa=_0x46fbdc;return _0x46fbdc[_0xe0b0('0xfc')]({'raw':!![]});}})[_0xe0b0('0x15')](function(_0x34e1bf){if(_0x594eaa){if(_0x34e1bf){_0x2932c3=_0x34e1bf;}}return require('../../config/license/util')['getLicense']();})['then'](function(_0x5c001a){if(_0x5c001a){_0x24271d=_0x5c001a[_0xe0b0('0xfd')];_0x385ffb=_0x5c001a[_0xe0b0('0x6f')];}})[_0xe0b0('0x15')](function(){return db['ChatInteraction'][_0xe0b0('0x25')]({'where':{'closed':![]}});})[_0xe0b0('0x15')](function(_0x1a5a0f){_0x2251c2=_0x1a5a0f;if(_0x24271d&&_0x1a5a0f>_0x24271d){return db[_0xe0b0('0xfe')][_0xe0b0('0x5e')]({'where':{'id':0x1}})[_0xe0b0('0x15')](function(_0x5910e6){if(_0x5910e6){_0x5910e6['increment'](_0xe0b0('0xff'));}});}})[_0xe0b0('0x15')](function(){if(_0x594eaa[_0xe0b0('0xfb')]&&_0x594eaa[_0xe0b0('0xfb')][_0xe0b0('0x100')]){var _0x55e2ba=[];for(var _0x1e4f9d=0x0;_0x1e4f9d<_0x594eaa[_0xe0b0('0xfb')][_0xe0b0('0x100')][_0xe0b0('0x3c')];_0x1e4f9d++){var _0x224e67=_0x594eaa[_0xe0b0('0xfb')][_0xe0b0('0x100')][_0x1e4f9d][_0xe0b0('0x2a')]({'plain':!![]});_0x55e2ba[_0xe0b0('0xb6')](iftimePromise(_0x224e67,_0x594eaa));}return BPromise[_0xe0b0('0x101')](_0x55e2ba)['then'](function(_0x5bc9dc){return _['some'](_0x5bc9dc);});}else{return!![];}})[_0xe0b0('0x15')](function(_0x344877){var _0xa604c3=fs[_0xe0b0('0x102')](path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x103')),'utf8');var _0xa6e316={'remote':_0x594eaa[_0xe0b0('0x104')],'query':querystring[_0xe0b0('0xad')](_['merge'](_0x594eaa[_0xe0b0('0x2a')]({'plain':!![]}),{'customerIp':_0x230ff2[_0xe0b0('0x7f')]['x-forwarded-for']||_0x230ff2[_0xe0b0('0x7f')][_0xe0b0('0x105')]||_0x230ff2[_0xe0b0('0x106')][_0xe0b0('0x107')]||_0x230ff2['ip'],'referer':_0x230ff2['headers']['referer'],'openedInteractions':_0x2251c2,'maxInteractions':_0x24271d,'virtual':_0x385ffb[_0xe0b0('0xfd')],'online':_0x344877,'custom':_0x385ffb}))['replace'](/'/g,'\x5c\x27')};_0x22d53d[_0xe0b0('0x2e')](ejs['render'](Mustache[_0xe0b0('0xc8')](_0xa604c3,_0xa6e316),{'proactiveActions':_0x2932c3,'alignment':_0x594eaa[_0xe0b0('0x108')],'verticalAlignment':_0x594eaa[_0xe0b0('0x109')],'div_color':_0x594eaa['color'],'labelText':_0x594eaa[_0xe0b0('0x10a')],'text_color':_0x594eaa['textColor'],'button_color':_0x594eaa[_0xe0b0('0x10b')],'background_color':_0x594eaa[_0xe0b0('0x10c')]}));})['catch'](handleError(_0x22d53d,null));};exports[_0xe0b0('0x10d')]=function(_0x3888d7,_0x2ed835){var _0x8c9efb=_0x3888d7['params']['id'];var _0x161a8c=_0x3888d7[_0xe0b0('0x4d')];var _0x2522f7=0xc8;var _0x523818=null;return db[_0xe0b0('0xd1')]['transaction']({'isolationLevel':db[_0xe0b0('0xd1')]['Transaction'][_0xe0b0('0x10e')][_0xe0b0('0x10f')]},function(_0x18d0eb){return db['ChatWebsite'][_0xe0b0('0x5e')]({'where':{'id':_0x8c9efb},'transaction':_0x18d0eb})[_0xe0b0('0x15')](function(_0x2eb954){if(_0x2eb954){return db[_0xe0b0('0x95')][_0xe0b0('0x29')]({'where':{'ChatWebsiteId':_0x8c9efb},'transaction':_0x18d0eb})[_0xe0b0('0x15')](function(){var _0x2961c1=_['map'](_0x161a8c,function(_0x31063b){_0x31063b['ChatWebsiteId']=_0x8c9efb;return _0x31063b;});return db[_0xe0b0('0x95')]['bulkCreate'](_0x2961c1,{'transaction':_0x18d0eb});});}else{_0x2522f7=0x194;_0x523818=[];}});})[_0xe0b0('0x15')](function(){if(_0x2522f7!==0x194){return db[_0xe0b0('0x95')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x8c9efb},'order':'priority'})[_0xe0b0('0x15')](function(_0x32c330){_0x523818=_0x32c330;});}})[_0xe0b0('0x1e')](function(_0x299f82){_0x2522f7=0x1f4;logger[_0xe0b0('0x19')](_0x299f82[_0xe0b0('0x2c')]);if(_0x299f82['name']){delete _0x299f82[_0xe0b0('0x2d')];}_0x523818=_0x299f82;})[_0xe0b0('0x110')](function(){if(_0x523818===null){_0x2ed835['sendStatus'](_0x2522f7);}else{if(_0x2522f7===0x1f4){_0x2ed835[_0xe0b0('0x21')](_0x2522f7)[_0xe0b0('0x2e')](_0x523818);}else{_0x2ed835[_0xe0b0('0x21')](_0x2522f7)[_0xe0b0('0x28')](_0x523818);}}});};exports[_0xe0b0('0x111')]=function(_0x5ac9af,_0x220bb1){var _0x51fab9={};var _0x2309cf={};var _0x436d2c;var _0x3b6cac;return db[_0xe0b0('0x33')][_0xe0b0('0x5e')]({'where':{'id':_0x5ac9af['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x220bb1,null))[_0xe0b0('0x15')](function(_0x49da50){if(_0x49da50){_0x436d2c=_0x49da50;_0x2309cf[_0xe0b0('0x35')]=_[_0xe0b0('0x37')](db[_0xe0b0('0x95')][_0xe0b0('0x5a')]);_0x2309cf[_0xe0b0('0x36')]=_['keys'](_0x5ac9af['query']);_0x2309cf['filters']=_[_0xe0b0('0x3a')](_0x2309cf[_0xe0b0('0x35')],_0x2309cf[_0xe0b0('0x36')]);_0x51fab9['attributes']=_[_0xe0b0('0x3a')](_0x2309cf['model'],qs[_0xe0b0('0x3b')](_0x5ac9af[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x51fab9[_0xe0b0('0x39')]=_0x51fab9[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x51fab9['attributes']:_0x2309cf[_0xe0b0('0x35')];_0x51fab9[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x5ac9af['query'][_0xe0b0('0x40')]);_0x51fab9[_0xe0b0('0x43')]=qs['filters'](_[_0xe0b0('0x41')](_0x5ac9af['query'],_0x2309cf[_0xe0b0('0x38')]));if(_0x5ac9af[_0xe0b0('0x36')][_0xe0b0('0x42')]){_0x51fab9[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x51fab9[_0xe0b0('0x43')],{'$or':_[_0xe0b0('0x32')](_0x51fab9[_0xe0b0('0x39')],function(_0x41e4be){var _0x3338bb={};_0x3338bb[_0x41e4be]={'$like':'%'+_0x5ac9af[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x3338bb;})});}_0x51fab9=_[_0xe0b0('0x44')]({},_0x51fab9,_0x5ac9af[_0xe0b0('0x46')]);return _0x436d2c['getApplications'](_0x51fab9);}})[_0xe0b0('0x15')](function(_0xce17d3){if(_0xce17d3){_0x3b6cac=_0xce17d3[_0xe0b0('0x3c')];if(!_0x5ac9af[_0xe0b0('0x36')][_0xe0b0('0x3d')](_0xe0b0('0x3e'))){_0x51fab9[_0xe0b0('0x23')]=qs[_0xe0b0('0x23')](_0x5ac9af[_0xe0b0('0x36')][_0xe0b0('0x23')]);_0x51fab9[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x5ac9af['query'][_0xe0b0('0x22')]);}return _0x436d2c['getApplications'](_0x51fab9);}})['then'](function(_0xd60c40){if(_0xd60c40){return _0xd60c40?{'count':_0x3b6cac,'rows':_0xd60c40}:null;}})[_0xe0b0('0x15')](respondWithResult(_0x220bb1,null))['catch'](handleError(_0x220bb1,null));};exports[_0xe0b0('0x112')]=function(_0x1ebfdc,_0x5d1b30){return db[_0xe0b0('0x113')][_0xe0b0('0x4b')]({'where':{'id':_0x1ebfdc[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x5d1b30,null))[_0xe0b0('0x15')](function(_0x4ba58d){if(_0x4ba58d){return _0x4ba58d[_0xe0b0('0x112')](_0x1ebfdc[_0xe0b0('0x4d')][_0xe0b0('0x61')],_['omit'](_0x1ebfdc[_0xe0b0('0x4d')],[_0xe0b0('0x61'),'id'])||{});}})[_0xe0b0('0x15')](respondWithResult(_0x5d1b30,null))[_0xe0b0('0x1e')](handleError(_0x5d1b30,null));};exports[_0xe0b0('0xfc')]=function(_0x15373d,_0x207b52){var _0x421f85={};var _0x7a18d8={};var _0x245796;var _0x51d6f0;return db['ChatWebsite'][_0xe0b0('0x5e')]({'where':{'id':_0x15373d['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x207b52,null))['then'](function(_0xaad4b4){if(_0xaad4b4){_0x245796=_0xaad4b4;_0x7a18d8[_0xe0b0('0x35')]=_[_0xe0b0('0x37')](db['ChatProactiveAction']['rawAttributes']);_0x7a18d8['query']=_[_0xe0b0('0x37')](_0x15373d[_0xe0b0('0x36')]);_0x7a18d8['filters']=_[_0xe0b0('0x3a')](_0x7a18d8[_0xe0b0('0x35')],_0x7a18d8[_0xe0b0('0x36')]);_0x421f85[_0xe0b0('0x39')]=_[_0xe0b0('0x3a')](_0x7a18d8[_0xe0b0('0x35')],qs[_0xe0b0('0x3b')](_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x421f85[_0xe0b0('0x39')]=_0x421f85[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x421f85[_0xe0b0('0x39')]:_0x7a18d8['model'];_0x421f85[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x40')]);_0x421f85[_0xe0b0('0x43')]=qs[_0xe0b0('0x38')](_[_0xe0b0('0x41')](_0x15373d[_0xe0b0('0x36')],_0x7a18d8[_0xe0b0('0x38')]));if(_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x42')]){_0x421f85[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x421f85[_0xe0b0('0x43')],{'$or':_['map'](_0x421f85[_0xe0b0('0x39')],function(_0x12fec1){var _0x1fc2ba={};_0x1fc2ba[_0x12fec1]={'$like':'%'+_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x1fc2ba;})});}_0x421f85=_['merge']({},_0x421f85,_0x15373d[_0xe0b0('0x46')]);return _0x245796[_0xe0b0('0xfc')](_0x421f85);}})['then'](function(_0x4ed950){if(_0x4ed950){_0x51d6f0=_0x4ed950['length'];if(!_0x15373d[_0xe0b0('0x36')]['hasOwnProperty'](_0xe0b0('0x3e'))){_0x421f85[_0xe0b0('0x23')]=qs['limit'](_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x23')]);_0x421f85['offset']=qs[_0xe0b0('0x22')](_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x22')]);}return _0x245796['getProactiveActions'](_0x421f85);}})[_0xe0b0('0x15')](function(_0xac72b0){if(_0xac72b0){return _0xac72b0?{'count':_0x51d6f0,'rows':_0xac72b0}:null;}})[_0xe0b0('0x15')](respondWithResult(_0x207b52,null))[_0xe0b0('0x1e')](handleError(_0x207b52,null));};exports[_0xe0b0('0x114')]=function(_0x806731,_0x5632cd){var _0x454673=_0x806731[_0xe0b0('0x36')][_0xe0b0('0x115')]===_0xe0b0('0x116')?_0xe0b0('0x117'):_0xe0b0('0x118');return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'attributes':['id',_0x454673],'where':{'id':_0x806731['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x5632cd,null))[_0xe0b0('0x15')](function(_0xc88c18){if(_0xc88c18){var _0x3ea089=_0xc88c18[_0x454673];var _0x30af0e=_0x3ea089&&_0x3ea089[_0xe0b0('0x119')]?_0x3ea089[_0xe0b0('0x119')]:[];_0x5632cd[_0xe0b0('0x2e')]({'fromKey':_['isNil'](_0x3ea089[_0xe0b0('0x11a')])?undefined:_0x3ea089[_0xe0b0('0x11a')],'count':_0x30af0e['length'],'rows':_0x30af0e});}})[_0xe0b0('0x1e')](handleError(_0x5632cd,null));};exports[_0xe0b0('0x11b')]=function(_0x443352,_0x404b24){var _0x1654d4={'raw':![],'where':{}};var _0x1214bd={};var _0x150f88={'count':0x0,'rows':[]};return db[_0xe0b0('0x33')][_0xe0b0('0x5e')]({'where':{'id':_0x443352[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x404b24,null))['then'](function(_0x2bafbe){if(_0x2bafbe){_0x1214bd[_0xe0b0('0x35')]=_[_0xe0b0('0x37')](db[_0xe0b0('0xca')][_0xe0b0('0x5a')]);_0x1214bd['query']=_[_0xe0b0('0x37')](_0x443352['query']);_0x1214bd['filters']=_[_0xe0b0('0x3a')](_0x1214bd[_0xe0b0('0x35')],_0x1214bd[_0xe0b0('0x36')]);_0x1654d4[_0xe0b0('0x39')]=_[_0xe0b0('0x3a')](_0x1214bd[_0xe0b0('0x35')],qs['fields'](_0x443352[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x1654d4[_0xe0b0('0x39')]=_0x1654d4[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x1654d4[_0xe0b0('0x39')]:_0x1214bd[_0xe0b0('0x35')];if(!_0x443352['query'][_0xe0b0('0x3d')](_0xe0b0('0x3e'))){_0x1654d4[_0xe0b0('0x23')]=qs[_0xe0b0('0x23')](_0x443352['query']['limit']);_0x1654d4[_0xe0b0('0x22')]=qs['offset'](_0x443352[_0xe0b0('0x36')]['offset']);}_0x1654d4[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x443352[_0xe0b0('0x36')]['sort']);_0x1654d4['where']=qs[_0xe0b0('0x38')](_[_0xe0b0('0x41')](_0x443352[_0xe0b0('0x36')],_0x1214bd['filters']));_0x1654d4[_0xe0b0('0x43')][_0xe0b0('0x57')]=_0x2bafbe['id'];if(_0x443352[_0xe0b0('0x36')][_0xe0b0('0x42')]){_0x1654d4[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x1654d4[_0xe0b0('0x43')],{'$or':_[_0xe0b0('0x32')](_0x1654d4[_0xe0b0('0x39')],function(_0x5815f5){var _0x1eacdf={};_0x1eacdf[_0x5815f5]={'$like':'%'+_0x443352[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x1eacdf;})});}_0x1654d4=_[_0xe0b0('0x44')]({},_0x1654d4,_0x443352[_0xe0b0('0x46')]);return db[_0xe0b0('0xca')][_0xe0b0('0x25')]({'where':_0x1654d4[_0xe0b0('0x43')]})[_0xe0b0('0x15')](function(_0x4496d0){_0x150f88[_0xe0b0('0x25')]=_0x4496d0;if(_0x443352['query']['includeAll']){_0x1654d4['include']=[{'all':!![]}];}else{_0x1654d4['include']=[{'model':db[_0xe0b0('0x9c')],'as':_0xe0b0('0x11c'),'required':![]},{'model':db[_0xe0b0('0xd2')],'as':_0xe0b0('0x11d'),'required':![]}];}return db[_0xe0b0('0xca')][_0xe0b0('0x5b')](_0x1654d4);})[_0xe0b0('0x15')](function(_0x306f80){_0x150f88[_0xe0b0('0x48')]=_0x306f80;return _0x150f88;});}})['then'](respondWithFilteredResult(_0x404b24,_0x1654d4))['catch'](handleError(_0x404b24,null));};exports[_0xe0b0('0x11e')]=function(_0x2c6de2,_0x49f1df){return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x2c6de2[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x49f1df,null))['then'](function(_0x1612e9){if(_0x1612e9){return _0x1612e9['addAgents'](_0x2c6de2[_0xe0b0('0x4d')][_0xe0b0('0x61')],_[_0xe0b0('0x11f')](_0x2c6de2[_0xe0b0('0x4d')],[_0xe0b0('0x61'),'id'])||{})[_0xe0b0('0xb2')](function(_0x9d6a15){for(var _0x2601ab=0x0;_0x2601ab<_0x2c6de2[_0xe0b0('0x4d')]['ids']['length'];_0x2601ab+=0x1){socket[_0xe0b0('0x120')]('userChatWebsite:save',{'UserId':Number(_0x2c6de2[_0xe0b0('0x4d')][_0xe0b0('0x61')][_0x2601ab]),'ChatWebsiteId':Number(_0x2c6de2[_0xe0b0('0x56')]['id'])});}return _0x9d6a15;});}})[_0xe0b0('0x15')](respondWithResult(_0x49f1df,null))[_0xe0b0('0x1e')](handleError(_0x49f1df,null));};exports[_0xe0b0('0x121')]=function(_0x3c3bc2,_0x285e1d){return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x3c3bc2['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x285e1d,null))['then'](function(_0x1a6915){if(_0x1a6915){return _0x1a6915['removeAgents'](_0x3c3bc2[_0xe0b0('0x36')][_0xe0b0('0x61')])[_0xe0b0('0x15')](function(){if(_[_0xe0b0('0x122')](_0x3c3bc2[_0xe0b0('0x36')][_0xe0b0('0x61')])){for(var _0x82d32f=0x0;_0x82d32f<_0x3c3bc2[_0xe0b0('0x36')][_0xe0b0('0x61')][_0xe0b0('0x3c')];_0x82d32f+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x3c3bc2[_0xe0b0('0x36')][_0xe0b0('0x61')][_0x82d32f]),'ChatWebsiteId':Number(_0x3c3bc2[_0xe0b0('0x56')]['id'])});}}else{socket[_0xe0b0('0x120')](_0xe0b0('0x123'),{'UserId':Number(_0x3c3bc2[_0xe0b0('0x36')][_0xe0b0('0x61')]),'ChatWebsiteId':Number(_0x3c3bc2[_0xe0b0('0x56')]['id'])});}});}})[_0xe0b0('0x15')](respondWithStatusCode(_0x285e1d,null))[_0xe0b0('0x1e')](handleError(_0x285e1d,null));};exports[_0xe0b0('0x124')]=function(_0x54e11c,_0x4d6351){var _0x2e872b={};var _0x1f9b27={};var _0x229485;var _0x21a549;return db[_0xe0b0('0x33')]['findOne']({'where':{'id':_0x54e11c[_0xe0b0('0x56')]['id']}})['then'](handleEntityNotFound(_0x4d6351,null))[_0xe0b0('0x15')](function(_0x4d04bf){if(_0x4d04bf){_0x229485=_0x4d04bf;_0x1f9b27[_0xe0b0('0x35')]=_[_0xe0b0('0x37')](db[_0xe0b0('0xeb')][_0xe0b0('0x5a')]);_0x1f9b27[_0xe0b0('0x36')]=_[_0xe0b0('0x37')](_0x54e11c[_0xe0b0('0x36')]);_0x1f9b27['filters']=_['intersection'](_0x1f9b27['model'],_0x1f9b27['query']);_0x2e872b[_0xe0b0('0x39')]=_['intersection'](_0x1f9b27['model'],qs['fields'](_0x54e11c[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x2e872b[_0xe0b0('0x39')]=_0x2e872b[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x2e872b['attributes']:_0x1f9b27['model'];_0x2e872b[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x54e11c[_0xe0b0('0x36')][_0xe0b0('0x40')]);_0x2e872b[_0xe0b0('0x43')]=qs['filters'](_['pick'](_0x54e11c[_0xe0b0('0x36')],_0x1f9b27[_0xe0b0('0x38')]));if(_0x54e11c[_0xe0b0('0x36')]['filter']){_0x2e872b['where']=_[_0xe0b0('0x44')](_0x2e872b[_0xe0b0('0x43')],{'$or':_[_0xe0b0('0x32')](_0x2e872b[_0xe0b0('0x39')],function(_0x9a8a0d){var _0x938810={};_0x938810[_0x9a8a0d]={'$like':'%'+_0x54e11c[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x938810;})});}_0x2e872b=_['merge']({},_0x2e872b,_0x54e11c['options']);return _0x229485[_0xe0b0('0x124')](_0x2e872b);}})[_0xe0b0('0x15')](function(_0x1717d3){if(_0x1717d3){_0x21a549=_0x1717d3[_0xe0b0('0x3c')];if(!_0x54e11c[_0xe0b0('0x36')][_0xe0b0('0x3d')](_0xe0b0('0x3e'))){_0x2e872b[_0xe0b0('0x23')]=qs['limit'](_0x54e11c[_0xe0b0('0x36')]['limit']);_0x2e872b[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x54e11c[_0xe0b0('0x36')]['offset']);}return _0x229485[_0xe0b0('0x124')](_0x2e872b);}})[_0xe0b0('0x15')](function(_0x7d6993){if(_0x7d6993){return _0x7d6993?{'count':_0x21a549,'rows':_0x7d6993}:null;}})[_0xe0b0('0x15')](respondWithResult(_0x4d6351,null))[_0xe0b0('0x1e')](handleError(_0x4d6351,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index c87cd5f..18e1e3a 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 _0x5f10=['emit','hasOwnProperty','hook','events','../../mysqldb','update','remove'];(function(_0x375643,_0x51aca6){var _0x1db199=function(_0x5a5a38){while(--_0x5a5a38){_0x375643['push'](_0x375643['shift']());}};_0x1db199(++_0x51aca6);}(_0x5f10,0xd5));var _0x05f1=function(_0x40cdfa,_0x1cf634){_0x40cdfa=_0x40cdfa-0x0;var _0x2c5e4d=_0x5f10[_0x40cdfa];return _0x2c5e4d;};'use strict';var EventEmitter=require(_0x05f1('0x0'));var ChatWebsite=require(_0x05f1('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x05f1('0x2'),'afterDestroy':_0x05f1('0x3')};function emitEvent(_0x2eaff1){return function(_0xcb88e1,_0xa8d3b9,_0x23747b){ChatWebsiteEvents['emit'](_0x2eaff1+':'+_0xcb88e1['id'],_0xcb88e1);ChatWebsiteEvents[_0x05f1('0x4')](_0x2eaff1,_0xcb88e1);_0x23747b(null);};}for(var e in events){if(events[_0x05f1('0x5')](e)){var event=events[e];ChatWebsite[_0x05f1('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x61b8=['exports','events','../../mysqldb','ChatWebsite','save','emit','hasOwnProperty','hook'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x61b8,0x169));var _0x861b=function(_0x4a9853,_0x20d5ac){_0x4a9853=_0x4a9853-0x0;var _0x430f0f=_0x61b8[_0x4a9853];return _0x430f0f;};'use strict';var EventEmitter=require(_0x861b('0x0'));var ChatWebsite=require(_0x861b('0x1'))['db'][_0x861b('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x861b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x37b79f){return function(_0x10e70b,_0x4b139c,_0x56a7a9){ChatWebsiteEvents[_0x861b('0x4')](_0x37b79f+':'+_0x10e70b['id'],_0x10e70b);ChatWebsiteEvents[_0x861b('0x4')](_0x37b79f,_0x10e70b);_0x56a7a9(null);};}for(var e in events){if(events[_0x861b('0x5')](e)){var event=events[e];ChatWebsite[_0x861b('0x6')](e,emitEvent(event));}}module[_0x861b('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 55cf158..48ecee0 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 _0xc5aa=['lodash','util','../../config/logger','moment','request-promise','rimraf','./chatWebsite.attributes','exports','define','chat_websites'];(function(_0x3e8cae,_0x4cb96a){var _0x45c4d6=function(_0x4bf3a5){while(--_0x4bf3a5){_0x3e8cae['push'](_0x3e8cae['shift']());}};_0x45c4d6(++_0x4cb96a);}(_0xc5aa,0xd2));var _0xac5a=function(_0xfd27d0,_0x5800ae){_0xfd27d0=_0xfd27d0-0x0;var _0x4623e3=_0xc5aa[_0xfd27d0];return _0x4623e3;};'use strict';var _=require(_0xac5a('0x0'));var util=require(_0xac5a('0x1'));var logger=require(_0xac5a('0x2'))('api');var moment=require(_0xac5a('0x3'));var BPromise=require('bluebird');var rp=require(_0xac5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac5a('0x5'));var config=require('../../config/environment');var attributes=require(_0xac5a('0x6'));module[_0xac5a('0x7')]=function(_0x560e01,_0x1fec6f){return _0x560e01[_0xac5a('0x8')]('ChatWebsite',attributes,{'tableName':_0xac5a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb86=['request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment'];(function(_0x10b92e,_0x5083fd){var _0x209ae3=function(_0xb7a2d0){while(--_0xb7a2d0){_0x10b92e['push'](_0x10b92e['shift']());}};_0x209ae3(++_0x5083fd);}(_0xdb86,0x1e9));var _0x6db8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb86[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6db8('0x0'));var util=require(_0x6db8('0x1'));var logger=require(_0x6db8('0x2'))(_0x6db8('0x3'));var moment=require(_0x6db8('0x4'));var BPromise=require('bluebird');var rp=require(_0x6db8('0x5'));var fs=require('fs');var path=require(_0x6db8('0x6'));var rimraf=require('rimraf');var config=require(_0x6db8('0x7'));var attributes=require(_0x6db8('0x8'));module[_0x6db8('0x9')]=function(_0x5501c2,_0x7ea444){return _0x5501c2[_0x6db8('0xa')](_0x6db8('0xb'),attributes,{'tableName':_0x6db8('0xc'),'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 3c07a7b..541b516 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 _0xb03f=['message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error'];(function(_0x1dcbcc,_0x31a0fc){var _0x38590e=function(_0xd1a9aa){while(--_0xd1a9aa){_0x1dcbcc['push'](_0x1dcbcc['shift']());}};_0x38590e(++_0x31a0fc);}(_0xb03f,0x1d6));var _0xfb03=function(_0x4f229e,_0x1b1e6c){_0x4f229e=_0x4f229e-0x0;var _0x407c5e=_0xb03f[_0x4f229e];return _0x407c5e;};'use strict';var _=require(_0xfb03('0x0'));var util=require(_0xfb03('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfb03('0x2'));var fs=require('fs');var Redis=require(_0xfb03('0x3'));var db=require(_0xfb03('0x4'))['db'];var utils=require(_0xfb03('0x5'));var logger=require(_0xfb03('0x6'))(_0xfb03('0x7'));var config=require(_0xfb03('0x8'));var jayson=require(_0xfb03('0x9'));var client=jayson['client'][_0xfb03('0xa')]({'port':0x232a});config[_0xfb03('0xb')]=_[_0xfb03('0xc')](config[_0xfb03('0xb')],{'host':_0xfb03('0xd'),'port':0x18eb});var socket=require(_0xfb03('0xe'))(new Redis(config[_0xfb03('0xb')]));require(_0xfb03('0xf'))[_0xfb03('0x10')](socket);function respondWithRpcPromise(_0x16294b,_0xec4547,_0x1937ed){return new BPromise(function(_0x3d27de,_0x5d4a93){return client['request'](_0x16294b,_0x1937ed)[_0xfb03('0x11')](function(_0x2d1429){logger[_0xfb03('0x12')](_0xfb03('0x13'),_0xec4547,_0xfb03('0x14'));logger[_0xfb03('0x15')](_0xfb03('0x16'),_0xec4547,_0xfb03('0x14'),JSON['stringify'](_0x2d1429));if(_0x2d1429[_0xfb03('0x17')]){if(_0x2d1429['error']['code']===0x1f4){logger['error'](_0xfb03('0x13'),_0xec4547,_0x2d1429[_0xfb03('0x17')][_0xfb03('0x18')]);return _0x5d4a93(_0x2d1429[_0xfb03('0x17')][_0xfb03('0x18')]);}logger[_0xfb03('0x17')](_0xfb03('0x13'),_0xec4547,_0x2d1429[_0xfb03('0x17')]['message']);return _0x3d27de(_0x2d1429[_0xfb03('0x17')][_0xfb03('0x18')]);}else{logger[_0xfb03('0x12')](_0xfb03('0x13'),_0xec4547,_0xfb03('0x14'));_0x3d27de(_0x2d1429[_0xfb03('0x19')][_0xfb03('0x18')]);}})['catch'](function(_0x29fd50){logger[_0xfb03('0x17')](_0xfb03('0x13'),_0xec4547,_0x29fd50);_0x5d4a93(_0x29fd50);});});} \ No newline at end of file +var _0x4993=['code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xd2d54,_0x5329f7){var _0x78b113=function(_0x7d2b29){while(--_0x7d2b29){_0xd2d54['push'](_0xd2d54['shift']());}};_0x78b113(++_0x5329f7);}(_0x4993,0x9a));var _0x3499=function(_0x393f62,_0x4dfe05){_0x393f62=_0x393f62-0x0;var _0xdd72e0=_0x4993[_0x393f62];return _0xdd72e0;};'use strict';var _=require(_0x3499('0x0'));var util=require(_0x3499('0x1'));var moment=require(_0x3499('0x2'));var BPromise=require(_0x3499('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3499('0x4'));var db=require(_0x3499('0x5'))['db'];var utils=require(_0x3499('0x6'));var logger=require(_0x3499('0x7'))(_0x3499('0x8'));var config=require(_0x3499('0x9'));var jayson=require(_0x3499('0xa'));var client=jayson[_0x3499('0xb')][_0x3499('0xc')]({'port':0x232a});config[_0x3499('0xd')]=_['defaults'](config['redis'],{'host':_0x3499('0xe'),'port':0x18eb});var socket=require(_0x3499('0xf'))(new Redis(config[_0x3499('0xd')]));require('./chatWebsite.socket')[_0x3499('0x10')](socket);function respondWithRpcPromise(_0x503f10,_0x2a4c2b,_0x4fb259){return new BPromise(function(_0x523c7b,_0x24426f){return client[_0x3499('0x11')](_0x503f10,_0x4fb259)[_0x3499('0x12')](function(_0x5454a7){logger[_0x3499('0x13')](_0x3499('0x14'),_0x2a4c2b,_0x3499('0x15'));logger[_0x3499('0x16')](_0x3499('0x17'),_0x2a4c2b,_0x3499('0x15'),JSON[_0x3499('0x18')](_0x5454a7));if(_0x5454a7[_0x3499('0x19')]){if(_0x5454a7[_0x3499('0x19')][_0x3499('0x1a')]===0x1f4){logger[_0x3499('0x19')](_0x3499('0x14'),_0x2a4c2b,_0x5454a7[_0x3499('0x19')]['message']);return _0x24426f(_0x5454a7[_0x3499('0x19')]['message']);}logger[_0x3499('0x19')](_0x3499('0x14'),_0x2a4c2b,_0x5454a7[_0x3499('0x19')][_0x3499('0x1b')]);return _0x523c7b(_0x5454a7[_0x3499('0x19')][_0x3499('0x1b')]);}else{logger[_0x3499('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x2a4c2b,_0x3499('0x15'));_0x523c7b(_0x5454a7[_0x3499('0x1c')][_0x3499('0x1b')]);}})[_0x3499('0x1d')](function(_0x4523eb){logger['error'](_0x3499('0x14'),_0x2a4c2b,_0x4523eb);_0x24426f(_0x4523eb);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c1d6034..43478de 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 _0xb737=['register','length','chatWebsite:','./chatWebsite.events','remove','emit','removeListener'];(function(_0x405fea,_0x53c2c4){var _0x34660a=function(_0x48f100){while(--_0x48f100){_0x405fea['push'](_0x405fea['shift']());}};_0x34660a(++_0x53c2c4);}(_0xb737,0x199));var _0x7b73=function(_0xea68d,_0x41ca4b){_0xea68d=_0xea68d-0x0;var _0x4be40b=_0xb737[_0xea68d];return _0x4be40b;};'use strict';var ChatWebsiteEvents=require(_0x7b73('0x0'));var events=['save',_0x7b73('0x1'),'update'];function createListener(_0x3fe21d,_0x27360e){return function(_0x53105a){_0x27360e[_0x7b73('0x2')](_0x3fe21d,_0x53105a);};}function removeListener(_0x58399f,_0xa64b01){return function(){ChatWebsiteEvents[_0x7b73('0x3')](_0x58399f,_0xa64b01);};}exports[_0x7b73('0x4')]=function(_0x55765e){for(var _0x3b2aa7=0x0,_0x4396c6=events[_0x7b73('0x5')];_0x3b2aa7<_0x4396c6;_0x3b2aa7++){var _0x2b9679=events[_0x3b2aa7];var _0x5b08ac=createListener(_0x7b73('0x6')+_0x2b9679,_0x55765e);ChatWebsiteEvents['on'](_0x2b9679,_0x5b08ac);}}; \ No newline at end of file +var _0x804a=['update','emit','./chatWebsite.events','save','remove'];(function(_0xa39e92,_0x43b1d6){var _0x4e4379=function(_0x150666){while(--_0x150666){_0xa39e92['push'](_0xa39e92['shift']());}};_0x4e4379(++_0x43b1d6);}(_0x804a,0x106));var _0xa804=function(_0x4ebe34,_0x2d2426){_0x4ebe34=_0x4ebe34-0x0;var _0x1ed3e9=_0x804a[_0x4ebe34];return _0x1ed3e9;};'use strict';var ChatWebsiteEvents=require(_0xa804('0x0'));var events=[_0xa804('0x1'),_0xa804('0x2'),_0xa804('0x3')];function createListener(_0x3f3ee5,_0xcba5ab){return function(_0x34977d){_0xcba5ab[_0xa804('0x4')](_0x3f3ee5,_0x34977d);};}function removeListener(_0x2fa262,_0x51f56b){return function(){ChatWebsiteEvents['removeListener'](_0x2fa262,_0x51f56b);};}exports['register']=function(_0x1afcd0){for(var _0x5b5a60=0x0,_0x1c9279=events['length'];_0x5b5a60<_0x1c9279;_0x5b5a60++){var _0xd17168=events[_0x5b5a60];var _0xc97c44=createListener('chatWebsite:'+_0xd17168,_0x1afcd0);ChatWebsiteEvents['on'](_0xd17168,_0xc97c44);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 8e2334f..276df31 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 _0x5b3c=['server/files/images/avatars/','single','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','replace','extname','/:id/offline','any','offline','/:id/interactions','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','/:id/avatar'];(function(_0x14a862,_0x2b559d){var _0x245eb5=function(_0x6e014c){while(--_0x6e014c){_0x14a862['push'](_0x14a862['shift']());}};_0x245eb5(++_0x2b559d);}(_0x5b3c,0x13a));var _0xc5b3=function(_0x5cb66d,_0x549ff3){_0x5cb66d=_0x5cb66d-0x0;var _0x557c4a=_0x5b3c[_0x5cb66d];return _0x557c4a;};'use strict';var multer=require('multer');var util=require(_0xc5b3('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc5b3('0x1'));var router=express[_0xc5b3('0x2')]();var fs_extra=require(_0xc5b3('0x3'));var auth=require(_0xc5b3('0x4'));var interaction=require(_0xc5b3('0x5'));var config=require(_0xc5b3('0x6'));var controller=require(_0xc5b3('0x7'));router[_0xc5b3('0x8')]('/',auth['isAuthenticated'](),controller[_0xc5b3('0x9')]);router[_0xc5b3('0x8')](_0xc5b3('0xa'),auth[_0xc5b3('0xb')](),controller[_0xc5b3('0xc')]);router[_0xc5b3('0x8')](_0xc5b3('0xd'),auth[_0xc5b3('0xb')](),controller[_0xc5b3('0xe')]);router[_0xc5b3('0x8')](_0xc5b3('0xf'),auth[_0xc5b3('0xb')](),controller[_0xc5b3('0x10')]);router[_0xc5b3('0x8')](_0xc5b3('0x11'),auth[_0xc5b3('0xb')](),controller[_0xc5b3('0x12')]);router['get'](_0xc5b3('0x13'),controller['getLogo']);router[_0xc5b3('0x8')]('/:id/avatar',controller[_0xc5b3('0x14')]);router['get'](_0xc5b3('0x15'),controller[_0xc5b3('0x16')]);router['get'](_0xc5b3('0x17'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0xc5b3('0xb')](),controller[_0xc5b3('0x18')]);router[_0xc5b3('0x8')](_0xc5b3('0x19'),controller[_0xc5b3('0x1a')]);router['get'](_0xc5b3('0x1b'),auth[_0xc5b3('0xb')](),controller[_0xc5b3('0x1c')]);router[_0xc5b3('0x8')](_0xc5b3('0x1d'),auth[_0xc5b3('0xb')](),controller[_0xc5b3('0x1e')]);router['get']('/:id/fields',controller[_0xc5b3('0x1f')]);router['get'](_0xc5b3('0x20'),auth[_0xc5b3('0xb')](),controller[_0xc5b3('0x21')]);router[_0xc5b3('0x8')](_0xc5b3('0x22'),auth[_0xc5b3('0xb')](),controller[_0xc5b3('0x23')]);router['post']('/',auth[_0xc5b3('0xb')](),controller[_0xc5b3('0x24')]);router[_0xc5b3('0x25')](_0xc5b3('0xf'),auth[_0xc5b3('0xb')](),controller[_0xc5b3('0x26')]);router[_0xc5b3('0x25')](_0xc5b3('0x11'),auth[_0xc5b3('0xb')](),controller[_0xc5b3('0x27')]);var upload=multer({'storage':multer[_0xc5b3('0x28')]({'destination':function(_0x3f9f72,_0x521cb3,_0xad8c3f){_0xad8c3f(null,path[_0xc5b3('0x29')](config[_0xc5b3('0x2a')],_0xc5b3('0x2b')));},'filename':function(_0x45bc93,_0x52d8d9,_0x3243bd){_0x3243bd(null,util[_0xc5b3('0x2c')](_0xc5b3('0x2d'),Date[_0xc5b3('0x2e')](),_0x52d8d9[_0xc5b3('0x2f')]));}})});router[_0xc5b3('0x25')](_0xc5b3('0x13'),upload['single'](_0xc5b3('0x30')),controller[_0xc5b3('0x31')]);var upload=multer({'storage':multer[_0xc5b3('0x28')]({'destination':function(_0x113d75,_0x255e14,_0x36e416){_0x36e416(null,path['join'](config[_0xc5b3('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x1b0fd0,_0x1949c6,_0x294e0d){_0x294e0d(null,util[_0xc5b3('0x2c')](_0xc5b3('0x2d'),Date[_0xc5b3('0x2e')](),_0x1949c6[_0xc5b3('0x2f')]));}})});router[_0xc5b3('0x25')](_0xc5b3('0x32'),upload['single']('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0xc5b3('0x28')]({'destination':function(_0xeecdff,_0x18ddaf,_0x53ae9f){_0x53ae9f(null,path[_0xc5b3('0x29')](config['root'],_0xc5b3('0x33')));},'filename':function(_0x543afa,_0x1eee33,_0x20ffb5){_0x20ffb5(null,util['format'](_0xc5b3('0x2d'),Date[_0xc5b3('0x2e')](),_0x1eee33['originalname']));}})});router['post'](_0xc5b3('0x15'),upload[_0xc5b3('0x34')](_0xc5b3('0x30')),controller[_0xc5b3('0x35')]);var upload=multer({'storage':multer[_0xc5b3('0x28')]({'destination':function(_0x491dcd,_0x463c05,_0xe6554){_0xe6554(null,path[_0xc5b3('0x29')](config[_0xc5b3('0x2a')],_0xc5b3('0x33')));},'filename':function(_0x10b5f1,_0x142c6b,_0x551129){_0x551129(null,util[_0xc5b3('0x2c')](_0xc5b3('0x2d'),Date['now'](),_0x142c6b[_0xc5b3('0x2f')]));}})});router[_0xc5b3('0x25')]('/:id/system_avatar',upload[_0xc5b3('0x34')](_0xc5b3('0x30')),controller[_0xc5b3('0x36')]);router[_0xc5b3('0x25')](_0xc5b3('0x37'),controller[_0xc5b3('0x38')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x3586de,_0x572082,_0x131fde){const _0x5e6a2b=path[_0xc5b3('0x29')](config[_0xc5b3('0x2a')],_0xc5b3('0x39'),'attachments','offline-chat');fs_extra['ensureDir'](_0x5e6a2b,function(){_0x131fde(null,_0x5e6a2b);});},'filename':function(_0x2af728,_0x4bbcf3,_0x1ede8e){const _0x196a63=_0x4bbcf3[_0xc5b3('0x2f')][_0xc5b3('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2f2b58=path[_0xc5b3('0x3b')](_0x196a63);const _0x43a3cb=Date[_0xc5b3('0x2e')]()+'-'+_0x196a63[_0xc5b3('0x3a')](_0x2f2b58,'')+_0x2f2b58;_0x1ede8e(null,_0x43a3cb);}})});router['post'](_0xc5b3('0x3c'),offlineUploadMulter[_0xc5b3('0x3d')](),controller[_0xc5b3('0x3e')]);router[_0xc5b3('0x25')](_0xc5b3('0x3f'),auth[_0xc5b3('0xb')](),controller['addInteraction']);router['post']('/:id/applications',auth[_0xc5b3('0xb')](),controller['addApplications']);router[_0xc5b3('0x25')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xc5b3('0x40')]);router[_0xc5b3('0x25')](_0xc5b3('0x22'),auth[_0xc5b3('0xb')](),controller[_0xc5b3('0x41')]);router[_0xc5b3('0x42')]('/:id',auth['isAuthenticated'](),controller[_0xc5b3('0x43')]);router[_0xc5b3('0x44')](_0xc5b3('0xd'),auth[_0xc5b3('0xb')](),controller[_0xc5b3('0x45')]);router[_0xc5b3('0x44')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xc5b3('0x44')](_0xc5b3('0x11'),auth[_0xc5b3('0xb')](),controller[_0xc5b3('0x46')]);router[_0xc5b3('0x44')](_0xc5b3('0x22'),auth[_0xc5b3('0xb')](),controller[_0xc5b3('0x47')]);module[_0xc5b3('0x48')]=router; \ No newline at end of file +var _0x177d=['%s-%s','now','single','file','server/files/images/avatars/','originalname','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','ensureDir','replace','any','addInteraction','addApplications','addProactiveActions','put','update','delete','destroy','/:id/canned_answers','removeAnswers','exports','multer','path','connect-timeout','express','Router','fs-extra','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','format'];(function(_0xa02fa9,_0x3f1faf){var _0x318bdd=function(_0xdaff90){while(--_0xdaff90){_0xa02fa9['push'](_0xa02fa9['shift']());}};_0x318bdd(++_0x3f1faf);}(_0x177d,0x19e));var _0xd177=function(_0x473052,_0x76a5ab){_0x473052=_0x473052-0x0;var _0x56c813=_0x177d[_0x473052];return _0x56c813;};'use strict';var multer=require(_0xd177('0x0'));var util=require('util');var path=require(_0xd177('0x1'));var timeout=require(_0xd177('0x2'));var express=require(_0xd177('0x3'));var router=express[_0xd177('0x4')]();var fs_extra=require(_0xd177('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0xd177('0x6')]('/',auth[_0xd177('0x7')](),controller[_0xd177('0x8')]);router[_0xd177('0x6')](_0xd177('0x9'),auth[_0xd177('0x7')](),controller[_0xd177('0xa')]);router['get'](_0xd177('0xb'),auth[_0xd177('0x7')](),controller['show']);router[_0xd177('0x6')](_0xd177('0xc'),auth['isAuthenticated'](),controller[_0xd177('0xd')]);router[_0xd177('0x6')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0xd177('0x6')](_0xd177('0xe'),controller[_0xd177('0xf')]);router[_0xd177('0x6')](_0xd177('0x10'),controller['getAvatar']);router[_0xd177('0x6')](_0xd177('0x11'),controller[_0xd177('0x12')]);router[_0xd177('0x6')](_0xd177('0x13'),controller[_0xd177('0x14')]);router['get'](_0xd177('0x15'),auth['isAuthenticated'](),controller[_0xd177('0x16')]);router[_0xd177('0x6')](_0xd177('0x17'),controller[_0xd177('0x18')]);router['get']('/:id/applications',auth[_0xd177('0x7')](),controller[_0xd177('0x19')]);router[_0xd177('0x6')](_0xd177('0x1a'),auth['isAuthenticated'](),controller[_0xd177('0x1b')]);router[_0xd177('0x6')](_0xd177('0x1c'),controller[_0xd177('0x1d')]);router[_0xd177('0x6')](_0xd177('0x1e'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0xd177('0x6')](_0xd177('0x1f'),auth['isAuthenticated'](),controller[_0xd177('0x20')]);router[_0xd177('0x21')]('/',auth[_0xd177('0x7')](),controller[_0xd177('0x22')]);router[_0xd177('0x21')](_0xd177('0xc'),auth[_0xd177('0x7')](),controller[_0xd177('0x23')]);router[_0xd177('0x21')]('/:id/canned_answers',auth[_0xd177('0x7')](),controller[_0xd177('0x24')]);var upload=multer({'storage':multer[_0xd177('0x25')]({'destination':function(_0xe44075,_0x9d5475,_0x54ff45){_0x54ff45(null,path[_0xd177('0x26')](config[_0xd177('0x27')],'server/files/images/logos/'));},'filename':function(_0x2e749d,_0x304683,_0x56c9a1){_0x56c9a1(null,util[_0xd177('0x28')](_0xd177('0x29'),Date[_0xd177('0x2a')](),_0x304683['originalname']));}})});router[_0xd177('0x21')]('/:id/logo',upload[_0xd177('0x2b')](_0xd177('0x2c')),controller['addLogo']);var upload=multer({'storage':multer[_0xd177('0x25')]({'destination':function(_0x44aec5,_0x16f5f6,_0x32f154){_0x32f154(null,path[_0xd177('0x26')](config[_0xd177('0x27')],_0xd177('0x2d')));},'filename':function(_0x5dcee6,_0x3490f8,_0x117ca9){_0x117ca9(null,util[_0xd177('0x28')]('%s-%s',Date[_0xd177('0x2a')](),_0x3490f8[_0xd177('0x2e')]));}})});router['post'](_0xd177('0x10'),upload[_0xd177('0x2b')](_0xd177('0x2c')),controller['addAvatar']);var upload=multer({'storage':multer[_0xd177('0x25')]({'destination':function(_0x47cb4d,_0x11455a,_0x3b6cc8){_0x3b6cc8(null,path[_0xd177('0x26')](config[_0xd177('0x27')],_0xd177('0x2d')));},'filename':function(_0x28b152,_0x562e4f,_0x554ccd){_0x554ccd(null,util[_0xd177('0x28')](_0xd177('0x29'),Date['now'](),_0x562e4f['originalname']));}})});router[_0xd177('0x21')](_0xd177('0x11'),upload['single'](_0xd177('0x2c')),controller[_0xd177('0x2f')]);var upload=multer({'storage':multer[_0xd177('0x25')]({'destination':function(_0x14c102,_0x4ea905,_0xc0ecc7){_0xc0ecc7(null,path['join'](config[_0xd177('0x27')],'server/files/images/avatars/'));},'filename':function(_0x1da683,_0x60c6a4,_0x129ab3){_0x129ab3(null,util['format'](_0xd177('0x29'),Date['now'](),_0x60c6a4[_0xd177('0x2e')]));}})});router['post'](_0xd177('0x13'),upload[_0xd177('0x2b')]('file'),controller[_0xd177('0x30')]);router[_0xd177('0x21')](_0xd177('0x31'),controller[_0xd177('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0xd177('0x25')]({'destination':function(_0x2aed70,_0x36dbb6,_0x171e68){const _0x47a845=path[_0xd177('0x26')](config[_0xd177('0x27')],_0xd177('0x33'),'attachments','offline-chat');fs_extra[_0xd177('0x34')](_0x47a845,function(){_0x171e68(null,_0x47a845);});},'filename':function(_0x250053,_0x55a465,_0x68734e){const _0x171dc1=_0x55a465[_0xd177('0x2e')][_0xd177('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x32bed6=path['extname'](_0x171dc1);const _0x47aefa=Date[_0xd177('0x2a')]()+'-'+_0x171dc1[_0xd177('0x35')](_0x32bed6,'')+_0x32bed6;_0x68734e(null,_0x47aefa);}})});router[_0xd177('0x21')]('/:id/offline',offlineUploadMulter[_0xd177('0x36')](),controller['offline']);router[_0xd177('0x21')](_0xd177('0x15'),auth['isAuthenticated'](),controller[_0xd177('0x37')]);router[_0xd177('0x21')]('/:id/applications',auth[_0xd177('0x7')](),controller[_0xd177('0x38')]);router['post']('/:id/proactive_actions',auth[_0xd177('0x7')](),controller[_0xd177('0x39')]);router[_0xd177('0x21')](_0xd177('0x1f'),auth[_0xd177('0x7')](),controller['addAgents']);router[_0xd177('0x3a')](_0xd177('0xb'),auth[_0xd177('0x7')](),controller[_0xd177('0x3b')]);router[_0xd177('0x3c')](_0xd177('0xb'),auth['isAuthenticated'](),controller[_0xd177('0x3d')]);router['delete']('/:id/dispositions',auth[_0xd177('0x7')](),controller['removeDispositions']);router['delete'](_0xd177('0x3e'),auth['isAuthenticated'](),controller[_0xd177('0x3f')]);router[_0xd177('0x3c')](_0xd177('0x1f'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xd177('0x40')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 2246159..a694d6c 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 _0xf0e8=['use','isAuthenticated','beaver-logger/server','express','../components/auth/service','Router','env','production','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs'];(function(_0x48a046,_0x3d3471){var _0x908221=function(_0xf6a32d){while(--_0xf6a32d){_0x48a046['push'](_0x48a046['shift']());}};_0x908221(++_0x3d3471);}(_0xf0e8,0x6e));var _0x8f0e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf0e8[_0x42cae2];return _0x5f256f;};var beaverLogger=require(_0x8f0e('0x0'));var express=require(_0x8f0e('0x1'));var auth=require(_0x8f0e('0x2'));var config=require('../config/environment');var router=express[_0x8f0e('0x3')]();var isProduction=config[_0x8f0e('0x4')]===_0x8f0e('0x5')||![];function clientSideLogs(_0x59243f,_0x3b4517,_0x1c69d2){var _0x1d138e=_0x59243f['app'][_0x8f0e('0x6')](_0x8f0e('0x7'));if(!_0x1d138e){throw new Error(_0x8f0e('0x8'));}return beaverLogger['expressEndpoint']({'uri':_0x8f0e('0x9'),'logger':_0x1d138e,'enableCors':!isProduction})(_0x59243f,_0x3b4517,_0x1c69d2);}router[_0x8f0e('0xa')](auth[_0x8f0e('0xb')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0x9f9c=['../components/auth/service','../config/environment','Router','production','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','exports','express'];(function(_0x2a9153,_0x44fd73){var _0x2f6615=function(_0x3d50c9){while(--_0x3d50c9){_0x2a9153['push'](_0x2a9153['shift']());}};_0x2f6615(++_0x44fd73);}(_0x9f9c,0x1ee));var _0xc9f9=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x9f9c[_0x3e5086];return _0xfeb102;};var beaverLogger=require('beaver-logger/server');var express=require(_0xc9f9('0x0'));var auth=require(_0xc9f9('0x1'));var config=require(_0xc9f9('0x2'));var router=express[_0xc9f9('0x3')]();var isProduction=config['env']===_0xc9f9('0x4')||![];function clientSideLogs(_0x425d29,_0x41dabc,_0x1066ed){var _0x315bbf=_0x425d29['app']['get'](_0xc9f9('0x5'));if(!_0x315bbf){throw new Error(_0xc9f9('0x6'));}return beaverLogger[_0xc9f9('0x7')]({'uri':_0xc9f9('0x8'),'logger':_0x315bbf,'enableCors':!isProduction})(_0x425d29,_0x41dabc,_0x1066ed);}router[_0xc9f9('0x9')](auth['isAuthenticated'](),clientSideLogs);module[_0xc9f9('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 12ec933..23585cf 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 _0x91b0=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','STRING','ENUM','AmazonAWS','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x3bbd21,_0x23f22d){var _0x11908b=function(_0x337f92){while(--_0x337f92){_0x3bbd21['push'](_0x3bbd21['shift']());}};_0x11908b(++_0x23f22d);}(_0x91b0,0x1c9));var _0x091b=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x91b0[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x091b('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x091b('0x1')](_0x091b('0x2'),_0x091b('0x3'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x091b('0x1')](_0x091b('0x4'),_0x091b('0x5'))},'data1':{'type':Sequelize['STRING'],'comment':_0x091b('0x6')},'data2':{'type':Sequelize['STRING'],'comment':_0x091b('0x7')},'data3':{'type':Sequelize[_0x091b('0x0')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x091b('0x0')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x091b('0x8')],'comment':_0x091b('0x9')},'data6':{'type':Sequelize[_0x091b('0x8')],'comment':_0x091b('0xa')},'data7':{'type':Sequelize[_0x091b('0x8')],'comment':_0x091b('0xb')}}; \ No newline at end of file +var _0x5c54=['MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','STRING','ENUM','Google','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x25bcee,_0x66ea75){var _0x20d1dc=function(_0x25bb80){while(--_0x25bb80){_0x25bcee['push'](_0x25bcee['shift']());}};_0x20d1dc(++_0x66ea75);}(_0x5c54,0x14d));var _0x45c5=function(_0x1521e6,_0x28a2de){_0x1521e6=_0x1521e6-0x0;var _0x4fe6d3=_0x5c54[_0x1521e6];return _0x4fe6d3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x45c5('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x45c5('0x1')]('AmazonAWS',_0x45c5('0x2'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x45c5('0x1')]('Outlook365',_0x45c5('0x3'))},'data1':{'type':Sequelize[_0x45c5('0x0')],'comment':_0x45c5('0x4')},'data2':{'type':Sequelize['STRING'],'comment':_0x45c5('0x5')},'data3':{'type':Sequelize['STRING'],'comment':_0x45c5('0x6')},'data4':{'type':Sequelize[_0x45c5('0x0')],'comment':_0x45c5('0x7')},'data5':{'type':Sequelize[_0x45c5('0x8')],'comment':_0x45c5('0x9')},'data6':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index a7d66e6..73443f4 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 _0xea36=['error','stack','name','padEnd','slice','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','CloudProvider','includeAll','include','findAll','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','length','create','body','values','includes','join','encryptString','find','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','data6','refresh_token','emit','microsoftAuthorization:error','send','lodash','../../config/environment','../../mysqldb','redis','defaults','localhost','sendStatus','status','json','offset','count','limit','set','Content-Range','update','then','end'];(function(_0x4ec114,_0x57ecc6){var _0x4d42d1=function(_0xf6c3d2){while(--_0xf6c3d2){_0x4ec114['push'](_0x4ec114['shift']());}};_0x4d42d1(++_0x57ecc6);}(_0xea36,0xee));var _0x6ea3=function(_0x2e0c3e,_0x25f51e){_0x2e0c3e=_0x2e0c3e-0x0;var _0x8cfb79=_0xea36[_0x2e0c3e];return _0x8cfb79;};'use strict';var _=require(_0x6ea3('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require(_0x6ea3('0x1'));var logger=require('../../config/logger')('api');var db=require(_0x6ea3('0x2'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x6ea3('0x3')]=_[_0x6ea3('0x4')](config[_0x6ea3('0x3')],{'host':_0x6ea3('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6ea3('0x3')]));var redis=new Redis(config[_0x6ea3('0x3')]);function respondWithStatusCode(_0x47125e,_0x1673cb){_0x1673cb=_0x1673cb||0xcc;return function(_0x1f054c){if(_0x1f054c){return _0x47125e[_0x6ea3('0x6')](_0x1673cb);}return _0x47125e[_0x6ea3('0x7')](_0x1673cb)['end']();};}function respondWithResult(_0x257877,_0x1f9fca){_0x1f9fca=_0x1f9fca||0xc8;return function(_0x8bd91c){if(_0x8bd91c){return _0x257877['status'](_0x1f9fca)[_0x6ea3('0x8')](_0x8bd91c);}};}function respondWithFilteredResult(_0x1e08db,_0x4cdb83){return function(_0x24f6a5){if(_0x24f6a5){var _0x4e41aa=typeof _0x4cdb83[_0x6ea3('0x9')]==='undefined'&&typeof _0x4cdb83['limit']==='undefined';var _0x513e53=_0x24f6a5[_0x6ea3('0xa')];var _0x46d90a=_0x4e41aa?0x0:_0x4cdb83[_0x6ea3('0x9')];var _0x30942a=_0x4e41aa?_0x24f6a5[_0x6ea3('0xa')]:_0x4cdb83[_0x6ea3('0x9')]+_0x4cdb83[_0x6ea3('0xb')];var _0x4c2a01;if(_0x30942a>=_0x513e53){_0x30942a=_0x513e53;_0x4c2a01=0xc8;}else{_0x4c2a01=0xce;}_0x1e08db[_0x6ea3('0x7')](_0x4c2a01);return _0x1e08db[_0x6ea3('0xc')](_0x6ea3('0xd'),_0x46d90a+'-'+_0x30942a+'/'+_0x513e53)[_0x6ea3('0x8')](_0x24f6a5);}return null;};}function saveUpdates(_0x3d7e4c){return function(_0x3fa4c4){if(_0x3fa4c4){return _0x3fa4c4[_0x6ea3('0xe')](_0x3d7e4c)['then'](function(_0x4071ff){return _0x4071ff;});}return null;};}function removeEntity(_0x3ee652){return function(_0x319af3){if(_0x319af3){return _0x319af3['destroy']()[_0x6ea3('0xf')](function(){_0x3ee652[_0x6ea3('0x7')](0xcc)[_0x6ea3('0x10')]();});}};}function handleEntityNotFound(_0x554ff5){return function(_0x189afc){if(!_0x189afc){_0x554ff5[_0x6ea3('0x6')](0x194);}return _0x189afc;};}function handleError(_0x1c4ae1,_0x1d6a6b){_0x1d6a6b=_0x1d6a6b||0x1f4;return function(_0x20a6a3){logger[_0x6ea3('0x11')](_0x20a6a3[_0x6ea3('0x12')]);if(_0x20a6a3[_0x6ea3('0x13')]){delete _0x20a6a3[_0x6ea3('0x13')];}_0x1c4ae1[_0x6ea3('0x7')](_0x1d6a6b)['send'](_0x20a6a3);};}function maskClientSecret(_0x300fdf){return _[_0x6ea3('0x14')](_0x300fdf[_0x6ea3('0x15')](0x0,0x3),0x14,'*');}exports[_0x6ea3('0x16')]=function(_0x595421,_0x2866fa){var _0x953510={},_0x2e80ce={},_0x588ffd={'count':0x0,'rows':[]};var _0x385fb4=_[_0x6ea3('0x17')](db['CloudProvider'][_0x6ea3('0x18')],function(_0x223120){return{'name':_0x223120[_0x6ea3('0x19')],'type':_0x223120[_0x6ea3('0x1a')][_0x6ea3('0x1b')]};});_0x2e80ce['model']=_[_0x6ea3('0x17')](_0x385fb4,_0x6ea3('0x13'));_0x2e80ce[_0x6ea3('0x1c')]=_['keys'](_0x595421[_0x6ea3('0x1c')]);_0x2e80ce['filters']=_[_0x6ea3('0x1d')](_0x2e80ce[_0x6ea3('0x1e')],_0x2e80ce[_0x6ea3('0x1c')]);_0x953510[_0x6ea3('0x1f')]=_[_0x6ea3('0x1d')](_0x2e80ce['model'],qs[_0x6ea3('0x20')](_0x595421[_0x6ea3('0x1c')]['fields']));_0x953510[_0x6ea3('0x1f')]=_0x953510[_0x6ea3('0x1f')]['length']?_0x953510[_0x6ea3('0x1f')]:_0x2e80ce[_0x6ea3('0x1e')];if(!_0x595421[_0x6ea3('0x1c')][_0x6ea3('0x21')]('nolimit')){_0x953510[_0x6ea3('0xb')]=qs[_0x6ea3('0xb')](_0x595421[_0x6ea3('0x1c')]['limit']);_0x953510[_0x6ea3('0x9')]=qs[_0x6ea3('0x9')](_0x595421[_0x6ea3('0x1c')][_0x6ea3('0x9')]);}_0x953510[_0x6ea3('0x22')]=qs['sort'](_0x595421[_0x6ea3('0x1c')][_0x6ea3('0x23')]);_0x953510[_0x6ea3('0x24')]=qs[_0x6ea3('0x25')](_[_0x6ea3('0x26')](_0x595421[_0x6ea3('0x1c')],_0x2e80ce[_0x6ea3('0x25')]),_0x385fb4);if(_0x595421[_0x6ea3('0x1c')][_0x6ea3('0x27')]){_0x953510['where']=_[_0x6ea3('0x28')](_0x953510[_0x6ea3('0x24')],{'$or':_[_0x6ea3('0x17')](_0x385fb4,function(_0x2ad400){if(_0x2ad400[_0x6ea3('0x1a')]!=='VIRTUAL'){var _0x3f25a9={};_0x3f25a9[_0x2ad400[_0x6ea3('0x13')]]={'$like':'%'+_0x595421[_0x6ea3('0x1c')][_0x6ea3('0x27')]+'%'};return _0x3f25a9;}})});}_0x953510=_[_0x6ea3('0x28')]({},_0x953510,_0x595421[_0x6ea3('0x29')]);var _0x28843b={'where':_0x953510[_0x6ea3('0x24')]};return db[_0x6ea3('0x2a')][_0x6ea3('0xa')](_0x28843b)[_0x6ea3('0xf')](function(_0x3cbbeb){_0x588ffd[_0x6ea3('0xa')]=_0x3cbbeb;if(_0x595421[_0x6ea3('0x1c')][_0x6ea3('0x2b')]){_0x953510[_0x6ea3('0x2c')]=[{'all':!![]}];}return db[_0x6ea3('0x2a')][_0x6ea3('0x2d')](_0x953510);})[_0x6ea3('0xf')](function(_0x3262bf){_0x588ffd['rows']=_['map'](_0x3262bf,function(_0x3359db){if(_0x3359db[_0x6ea3('0x2e')]===_0x6ea3('0x2f')){var _0x3d1234=encryptor[_0x6ea3('0x30')](_0x3359db[_0x6ea3('0x31')]);_0x3359db['data3']=maskClientSecret(_0x3d1234);}return _0x3359db;});return _0x588ffd;})['then'](respondWithFilteredResult(_0x2866fa,_0x953510))[_0x6ea3('0x32')](handleError(_0x2866fa,null));};exports[_0x6ea3('0x33')]=function(_0x566ce7,_0xbc9478){var _0x1e3061={'raw':!![],'where':{'id':_0x566ce7[_0x6ea3('0x34')]['id']}},_0x20711f={};_0x20711f[_0x6ea3('0x1e')]=_[_0x6ea3('0x35')](db[_0x6ea3('0x2a')][_0x6ea3('0x18')]);_0x20711f['query']=_[_0x6ea3('0x35')](_0x566ce7[_0x6ea3('0x1c')]);_0x20711f[_0x6ea3('0x25')]=_[_0x6ea3('0x1d')](_0x20711f[_0x6ea3('0x1e')],_0x20711f[_0x6ea3('0x1c')]);_0x1e3061['attributes']=_[_0x6ea3('0x1d')](_0x20711f[_0x6ea3('0x1e')],qs['fields'](_0x566ce7[_0x6ea3('0x1c')][_0x6ea3('0x20')]));_0x1e3061[_0x6ea3('0x1f')]=_0x1e3061[_0x6ea3('0x1f')][_0x6ea3('0x36')]?_0x1e3061[_0x6ea3('0x1f')]:_0x20711f[_0x6ea3('0x1e')];if(_0x566ce7[_0x6ea3('0x1c')][_0x6ea3('0x2b')]){_0x1e3061['include']=[{'all':!![]}];}_0x1e3061=_[_0x6ea3('0x28')]({},_0x1e3061,_0x566ce7[_0x6ea3('0x29')]);return db[_0x6ea3('0x2a')]['find'](_0x1e3061)[_0x6ea3('0xf')](handleEntityNotFound(_0xbc9478,null))[_0x6ea3('0xf')](function(_0x2be763){if(_0x2be763[_0x6ea3('0x2e')]==='MicrosoftAzure'){var _0x55e7c0=encryptor[_0x6ea3('0x30')](_0x2be763[_0x6ea3('0x31')]);_0x2be763['data3']=maskClientSecret(_0x55e7c0);}return _0x2be763;})[_0x6ea3('0xf')](respondWithResult(_0xbc9478,null))['catch'](handleError(_0xbc9478,null));};exports[_0x6ea3('0x37')]=function(_0x11216f,_0x1ec912){if(!_0x11216f[_0x6ea3('0x38')][_0x6ea3('0x13')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x11216f[_0x6ea3('0x38')]['service'])throw new Error('Service\x20parameter\x20not\x20specified');var _0x5a16e2=db[_0x6ea3('0x2a')]['rawAttributes'][_0x6ea3('0x2e')][_0x6ea3('0x39')];if(!_0x5a16e2[_0x6ea3('0x3a')](_0x11216f[_0x6ea3('0x38')][_0x6ea3('0x2e')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x5a16e2[_0x6ea3('0x3b')](',\x20'));if(_0x11216f[_0x6ea3('0x38')][_0x6ea3('0x2e')]===_0x6ea3('0x2f')&&_0x11216f[_0x6ea3('0x38')]['data3']){_0x11216f[_0x6ea3('0x38')]['data3']=encryptor[_0x6ea3('0x3c')](_0x11216f[_0x6ea3('0x38')][_0x6ea3('0x31')]);}return db[_0x6ea3('0x2a')][_0x6ea3('0x37')](_0x11216f['body'],{})[_0x6ea3('0xf')](respondWithResult(_0x1ec912,0xc9))[_0x6ea3('0x32')](handleError(_0x1ec912,null));};exports[_0x6ea3('0xe')]=function(_0x9d6aeb,_0x55ef97){if(_0x9d6aeb['body']['id']){delete _0x9d6aeb[_0x6ea3('0x38')]['id'];}return db[_0x6ea3('0x2a')]['find']({'where':{'id':_0x9d6aeb[_0x6ea3('0x34')]['id']}})['then'](handleEntityNotFound(_0x55ef97,null))[_0x6ea3('0xf')](function(_0x13ceaf){if(_0x13ceaf[_0x6ea3('0x2e')]===_0x6ea3('0x2f')&&_0x9d6aeb[_0x6ea3('0x38')][_0x6ea3('0x31')]){_0x9d6aeb['body']['data3']=encryptor[_0x6ea3('0x3c')](_0x9d6aeb[_0x6ea3('0x38')]['data3']);}return _0x13ceaf;})[_0x6ea3('0xf')](saveUpdates(_0x9d6aeb[_0x6ea3('0x38')],null))[_0x6ea3('0xf')](respondWithResult(_0x55ef97,null))[_0x6ea3('0x32')](handleError(_0x55ef97,null));};exports['destroy']=function(_0x566512,_0x1ed59c){return db[_0x6ea3('0x2a')][_0x6ea3('0x3d')]({'where':{'id':_0x566512[_0x6ea3('0x34')]['id']}})['then'](handleEntityNotFound(_0x1ed59c,null))[_0x6ea3('0xf')](removeEntity(_0x1ed59c,null))[_0x6ea3('0x32')](handleError(_0x1ed59c,null));};exports[_0x6ea3('0x3e')]=function(_0x137d1a,_0x10f46c){return db[_0x6ea3('0x2a')][_0x6ea3('0x3f')]({'where':{'id':_0x137d1a['params']['id']},'raw':!![]})[_0x6ea3('0xf')](function(_0x49ff30){if(!_0x49ff30)return _0x10f46c['sendStatus'](0x194);return{'url':oauth[_0x6ea3('0x40')](_0x49ff30,_0x137d1a[_0x6ea3('0x41')]['id'])};})[_0x6ea3('0xf')](respondWithResult(_0x10f46c,null))['catch'](handleError(_0x10f46c,null));};exports[_0x6ea3('0x42')]=function(_0x16eccf,_0x2f5208){var _0x2361f0=_0x16eccf[_0x6ea3('0x38')];var _0x3829a8;var _0x82ddbb;if(_0x2361f0['error'])throw _0x2361f0;redis[_0x6ea3('0x43')](_0x2361f0[_0x6ea3('0x44')])['then'](function(_0xab608d){if(!_0xab608d)throw new Error(_0x6ea3('0x45'));_0x3829a8=JSON[_0x6ea3('0x46')](_0xab608d);var _0x590110=Buffer[_0x6ea3('0x47')](_0x2361f0[_0x6ea3('0x44')],_0x6ea3('0x48'))['toString'](_0x6ea3('0x49'));_0x82ddbb=JSON[_0x6ea3('0x46')](_0x590110);if(!oauth[_0x6ea3('0x4a')](_0x2361f0['id_token'],_0x3829a8[_0x6ea3('0x4b')]))throw new Error(_0x6ea3('0x4c'));redis[_0x6ea3('0x4d')](_0x2361f0[_0x6ea3('0x44')]);return oauth[_0x6ea3('0x4e')](_0x2361f0['code'],_0x3829a8);})[_0x6ea3('0xf')](function(_0x2b1081){_0x3829a8[_0x6ea3('0x4f')]=_0x2b1081['access_token'];_0x3829a8[_0x6ea3('0x50')]=_0x2b1081[_0x6ea3('0x51')];return db[_0x6ea3('0x2a')][_0x6ea3('0xe')]({'data5':_0x3829a8['data5'],'data6':_0x3829a8['data6']},{'where':{'id':_0x3829a8['id']}});})[_0x6ea3('0xf')](function(){oauth['startRefreshInterval'](_0x3829a8);socket[_0x6ea3('0x52')]('microsoftAuthorization:success',{'id':_0x82ddbb['id']});return;})[_0x6ea3('0xf')](respondWithStatusCode(_0x2f5208,null))[_0x6ea3('0x32')](function(_0x3a73e3){if(_0x82ddbb){socket[_0x6ea3('0x52')](_0x6ea3('0x53'),{'id':_0x82ddbb['id']});}if(!_0x3829a8){logger[_0x6ea3('0x11')]('Invalid\x20authentication\x20state\x20parameter',_0x3a73e3);return _0x2f5208[_0x6ea3('0x7')](0x1f4)[_0x6ea3('0x54')](_0x3a73e3['message']);}logger[_0x6ea3('0x11')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s',_0x3829a8['id'],_0x3a73e3);});}; \ No newline at end of file +var _0x0566=['includeAll','include','service','catch','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','create','find','encryptString','params','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','base64','toString','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','code','access_token','data6','refresh_token','data5','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s','lodash','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','slice','map','CloudProvider','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','MicrosoftAzure','decryptString','data3','show','rawAttributes'];(function(_0x403bff,_0x5c8c32){var _0x1a7736=function(_0x1a088f){while(--_0x1a088f){_0x403bff['push'](_0x403bff['shift']());}};_0x1a7736(++_0x5c8c32);}(_0x0566,0x13c));var _0x6056=function(_0x19ddfd,_0x2bd2d9){_0x19ddfd=_0x19ddfd-0x0;var _0x523a04=_0x0566[_0x19ddfd];return _0x523a04;};'use strict';var _=require(_0x6056('0x0'));var Redis=require('ioredis');var qs=require(_0x6056('0x1'));var encryptor=require(_0x6056('0x2'));var config=require(_0x6056('0x3'));var logger=require('../../config/logger')(_0x6056('0x4'));var db=require(_0x6056('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x6056('0x6')]=_[_0x6056('0x7')](config[_0x6056('0x6')],{'host':_0x6056('0x8'),'port':0x18eb});var socket=require(_0x6056('0x9'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0xd2a6c8,_0x203ac6){_0x203ac6=_0x203ac6||0xcc;return function(_0x44c943){if(_0x44c943){return _0xd2a6c8[_0x6056('0xa')](_0x203ac6);}return _0xd2a6c8[_0x6056('0xb')](_0x203ac6)[_0x6056('0xc')]();};}function respondWithResult(_0x4431f4,_0x50ca4d){_0x50ca4d=_0x50ca4d||0xc8;return function(_0x41765d){if(_0x41765d){return _0x4431f4[_0x6056('0xb')](_0x50ca4d)[_0x6056('0xd')](_0x41765d);}};}function respondWithFilteredResult(_0x27f983,_0x31d5e){return function(_0x1bba06){if(_0x1bba06){var _0x3e678a=typeof _0x31d5e[_0x6056('0xe')]===_0x6056('0xf')&&typeof _0x31d5e[_0x6056('0x10')]===_0x6056('0xf');var _0x3275c1=_0x1bba06['count'];var _0x35b703=_0x3e678a?0x0:_0x31d5e[_0x6056('0xe')];var _0x2e1c60=_0x3e678a?_0x1bba06[_0x6056('0x11')]:_0x31d5e['offset']+_0x31d5e['limit'];var _0x2c43ce;if(_0x2e1c60>=_0x3275c1){_0x2e1c60=_0x3275c1;_0x2c43ce=0xc8;}else{_0x2c43ce=0xce;}_0x27f983[_0x6056('0xb')](_0x2c43ce);return _0x27f983[_0x6056('0x12')](_0x6056('0x13'),_0x35b703+'-'+_0x2e1c60+'/'+_0x3275c1)[_0x6056('0xd')](_0x1bba06);}return null;};}function saveUpdates(_0x415475){return function(_0x39cd7a){if(_0x39cd7a){return _0x39cd7a[_0x6056('0x14')](_0x415475)[_0x6056('0x15')](function(_0x236306){return _0x236306;});}return null;};}function removeEntity(_0x39068b){return function(_0x28de90){if(_0x28de90){return _0x28de90[_0x6056('0x16')]()['then'](function(){_0x39068b[_0x6056('0xb')](0xcc)[_0x6056('0xc')]();});}};}function handleEntityNotFound(_0xc671b2){return function(_0x173c6a){if(!_0x173c6a){_0xc671b2[_0x6056('0xa')](0x194);}return _0x173c6a;};}function handleError(_0x3ccdaa,_0xc6eac){_0xc6eac=_0xc6eac||0x1f4;return function(_0xbd48db){logger[_0x6056('0x17')](_0xbd48db[_0x6056('0x18')]);if(_0xbd48db['name']){delete _0xbd48db[_0x6056('0x19')];}_0x3ccdaa[_0x6056('0xb')](_0xc6eac)['send'](_0xbd48db);};}function maskClientSecret(_0x9801f6){return _['padEnd'](_0x9801f6[_0x6056('0x1a')](0x0,0x3),0x14,'*');}exports['index']=function(_0x41de70,_0x3e9584){var _0x4a4e06={},_0x32ac94={},_0x31b770={'count':0x0,'rows':[]};var _0x4580ac=_[_0x6056('0x1b')](db[_0x6056('0x1c')]['rawAttributes'],function(_0x55443c){return{'name':_0x55443c[_0x6056('0x1d')],'type':_0x55443c['type']['key']};});_0x32ac94[_0x6056('0x1e')]=_[_0x6056('0x1b')](_0x4580ac,'name');_0x32ac94[_0x6056('0x1f')]=_[_0x6056('0x20')](_0x41de70[_0x6056('0x1f')]);_0x32ac94[_0x6056('0x21')]=_[_0x6056('0x22')](_0x32ac94[_0x6056('0x1e')],_0x32ac94[_0x6056('0x1f')]);_0x4a4e06[_0x6056('0x23')]=_[_0x6056('0x22')](_0x32ac94[_0x6056('0x1e')],qs[_0x6056('0x24')](_0x41de70[_0x6056('0x1f')][_0x6056('0x24')]));_0x4a4e06[_0x6056('0x23')]=_0x4a4e06['attributes'][_0x6056('0x25')]?_0x4a4e06['attributes']:_0x32ac94[_0x6056('0x1e')];if(!_0x41de70[_0x6056('0x1f')][_0x6056('0x26')](_0x6056('0x27'))){_0x4a4e06[_0x6056('0x10')]=qs[_0x6056('0x10')](_0x41de70['query'][_0x6056('0x10')]);_0x4a4e06[_0x6056('0xe')]=qs['offset'](_0x41de70['query'][_0x6056('0xe')]);}_0x4a4e06[_0x6056('0x28')]=qs['sort'](_0x41de70[_0x6056('0x1f')][_0x6056('0x29')]);_0x4a4e06[_0x6056('0x2a')]=qs[_0x6056('0x21')](_[_0x6056('0x2b')](_0x41de70['query'],_0x32ac94['filters']),_0x4580ac);if(_0x41de70['query'][_0x6056('0x2c')]){_0x4a4e06[_0x6056('0x2a')]=_[_0x6056('0x2d')](_0x4a4e06[_0x6056('0x2a')],{'$or':_[_0x6056('0x1b')](_0x4580ac,function(_0x198b3e){if(_0x198b3e[_0x6056('0x2e')]!==_0x6056('0x2f')){var _0x1f1226={};_0x1f1226[_0x198b3e['name']]={'$like':'%'+_0x41de70[_0x6056('0x1f')]['filter']+'%'};return _0x1f1226;}})});}_0x4a4e06=_[_0x6056('0x2d')]({},_0x4a4e06,_0x41de70[_0x6056('0x30')]);var _0x40b0ba={'where':_0x4a4e06['where']};return db[_0x6056('0x1c')][_0x6056('0x11')](_0x40b0ba)['then'](function(_0x3ab043){_0x31b770[_0x6056('0x11')]=_0x3ab043;if(_0x41de70['query']['includeAll']){_0x4a4e06['include']=[{'all':!![]}];}return db[_0x6056('0x1c')][_0x6056('0x31')](_0x4a4e06);})[_0x6056('0x15')](function(_0x752966){_0x31b770[_0x6056('0x32')]=_['map'](_0x752966,function(_0x69bc46){if(_0x69bc46['service']===_0x6056('0x33')){var _0x21b5f3=encryptor[_0x6056('0x34')](_0x69bc46[_0x6056('0x35')]);_0x69bc46[_0x6056('0x35')]=maskClientSecret(_0x21b5f3);}return _0x69bc46;});return _0x31b770;})[_0x6056('0x15')](respondWithFilteredResult(_0x3e9584,_0x4a4e06))['catch'](handleError(_0x3e9584,null));};exports[_0x6056('0x36')]=function(_0x4361fb,_0x19563f){var _0x4de28d={'raw':!![],'where':{'id':_0x4361fb['params']['id']}},_0xa895c8={};_0xa895c8[_0x6056('0x1e')]=_[_0x6056('0x20')](db['CloudProvider'][_0x6056('0x37')]);_0xa895c8[_0x6056('0x1f')]=_[_0x6056('0x20')](_0x4361fb['query']);_0xa895c8[_0x6056('0x21')]=_['intersection'](_0xa895c8[_0x6056('0x1e')],_0xa895c8[_0x6056('0x1f')]);_0x4de28d['attributes']=_[_0x6056('0x22')](_0xa895c8[_0x6056('0x1e')],qs[_0x6056('0x24')](_0x4361fb[_0x6056('0x1f')][_0x6056('0x24')]));_0x4de28d[_0x6056('0x23')]=_0x4de28d[_0x6056('0x23')][_0x6056('0x25')]?_0x4de28d[_0x6056('0x23')]:_0xa895c8[_0x6056('0x1e')];if(_0x4361fb[_0x6056('0x1f')][_0x6056('0x38')]){_0x4de28d[_0x6056('0x39')]=[{'all':!![]}];}_0x4de28d=_[_0x6056('0x2d')]({},_0x4de28d,_0x4361fb[_0x6056('0x30')]);return db['CloudProvider']['find'](_0x4de28d)['then'](handleEntityNotFound(_0x19563f,null))[_0x6056('0x15')](function(_0x507176){if(_0x507176[_0x6056('0x3a')]===_0x6056('0x33')){var _0x4f2fca=encryptor[_0x6056('0x34')](_0x507176[_0x6056('0x35')]);_0x507176[_0x6056('0x35')]=maskClientSecret(_0x4f2fca);}return _0x507176;})[_0x6056('0x15')](respondWithResult(_0x19563f,null))[_0x6056('0x3b')](handleError(_0x19563f,null));};exports['create']=function(_0x3d2cdf,_0x54af4d){if(!_0x3d2cdf[_0x6056('0x3c')][_0x6056('0x19')])throw new Error(_0x6056('0x3d'));if(!_0x3d2cdf[_0x6056('0x3c')][_0x6056('0x3a')])throw new Error(_0x6056('0x3e'));var _0xa8e787=db['CloudProvider'][_0x6056('0x37')][_0x6056('0x3a')][_0x6056('0x3f')];if(!_0xa8e787['includes'](_0x3d2cdf[_0x6056('0x3c')][_0x6056('0x3a')]))throw new Error(_0x6056('0x40')+_0xa8e787['join'](',\x20'));if(_0x3d2cdf[_0x6056('0x3c')][_0x6056('0x3a')]===_0x6056('0x33')&&_0x3d2cdf[_0x6056('0x3c')][_0x6056('0x35')]){_0x3d2cdf[_0x6056('0x3c')][_0x6056('0x35')]=encryptor['encryptString'](_0x3d2cdf['body'][_0x6056('0x35')]);}return db[_0x6056('0x1c')][_0x6056('0x41')](_0x3d2cdf[_0x6056('0x3c')],{})[_0x6056('0x15')](respondWithResult(_0x54af4d,0xc9))[_0x6056('0x3b')](handleError(_0x54af4d,null));};exports[_0x6056('0x14')]=function(_0x1c0f68,_0x46ff3d){if(_0x1c0f68[_0x6056('0x3c')]['id']){delete _0x1c0f68[_0x6056('0x3c')]['id'];}return db[_0x6056('0x1c')][_0x6056('0x42')]({'where':{'id':_0x1c0f68['params']['id']}})[_0x6056('0x15')](handleEntityNotFound(_0x46ff3d,null))['then'](function(_0x47cec7){if(_0x47cec7[_0x6056('0x3a')]==='MicrosoftAzure'&&_0x1c0f68[_0x6056('0x3c')][_0x6056('0x35')]){_0x1c0f68['body'][_0x6056('0x35')]=encryptor[_0x6056('0x43')](_0x1c0f68[_0x6056('0x3c')][_0x6056('0x35')]);}return _0x47cec7;})[_0x6056('0x15')](saveUpdates(_0x1c0f68[_0x6056('0x3c')],null))['then'](respondWithResult(_0x46ff3d,null))[_0x6056('0x3b')](handleError(_0x46ff3d,null));};exports[_0x6056('0x16')]=function(_0x3f3c9e,_0x4cbfdb){return db['CloudProvider'][_0x6056('0x42')]({'where':{'id':_0x3f3c9e[_0x6056('0x44')]['id']}})[_0x6056('0x15')](handleEntityNotFound(_0x4cbfdb,null))[_0x6056('0x15')](removeEntity(_0x4cbfdb,null))[_0x6056('0x3b')](handleError(_0x4cbfdb,null));};exports['oauth2MicrosoftAuthorize']=function(_0x5cbf2c,_0x571c12){return db['CloudProvider'][_0x6056('0x45')]({'where':{'id':_0x5cbf2c['params']['id']},'raw':!![]})[_0x6056('0x15')](function(_0x124486){if(!_0x124486)return _0x571c12[_0x6056('0xa')](0x194);return{'url':oauth[_0x6056('0x46')](_0x124486,_0x5cbf2c[_0x6056('0x47')]['id'])};})[_0x6056('0x15')](respondWithResult(_0x571c12,null))['catch'](handleError(_0x571c12,null));};exports[_0x6056('0x48')]=function(_0x5cb3ab,_0x3b53c5){var _0x381cc0=_0x5cb3ab[_0x6056('0x3c')];var _0x609c1f;var _0x379edf;if(_0x381cc0['error'])throw _0x381cc0;redis['get'](_0x381cc0[_0x6056('0x49')])['then'](function(_0x61c6d9){if(!_0x61c6d9)throw new Error(_0x6056('0x4a'));_0x609c1f=JSON[_0x6056('0x4b')](_0x61c6d9);var _0x1c98a7=Buffer['from'](_0x381cc0['state'],_0x6056('0x4c'))[_0x6056('0x4d')]('ascii');_0x379edf=JSON[_0x6056('0x4b')](_0x1c98a7);if(!oauth[_0x6056('0x4e')](_0x381cc0[_0x6056('0x4f')],_0x609c1f['oauth2Claims']))throw new Error(_0x6056('0x50'));redis[_0x6056('0x51')](_0x381cc0[_0x6056('0x49')]);return oauth['getOauth2MicrosoftAccessToken'](_0x381cc0[_0x6056('0x52')],_0x609c1f);})[_0x6056('0x15')](function(_0x476333){_0x609c1f['data5']=_0x476333[_0x6056('0x53')];_0x609c1f[_0x6056('0x54')]=_0x476333[_0x6056('0x55')];return db[_0x6056('0x1c')][_0x6056('0x14')]({'data5':_0x609c1f[_0x6056('0x56')],'data6':_0x609c1f[_0x6056('0x54')]},{'where':{'id':_0x609c1f['id']}});})[_0x6056('0x15')](function(){oauth['startRefreshInterval'](_0x609c1f);socket[_0x6056('0x57')](_0x6056('0x58'),{'id':_0x379edf['id']});return;})['then'](respondWithStatusCode(_0x3b53c5,null))[_0x6056('0x3b')](function(_0x45b0ce){if(_0x379edf){socket['emit'](_0x6056('0x59'),{'id':_0x379edf['id']});}if(!_0x609c1f){logger[_0x6056('0x17')](_0x6056('0x5a'),_0x45b0ce);return _0x3b53c5[_0x6056('0xb')](0x1f4)['send'](_0x45b0ce[_0x6056('0x5b')]);}logger['error'](_0x6056('0x5c'),_0x609c1f['id'],_0x45b0ce);});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 384b8f2..1a9e9d1 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 _0xa270=['../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xa270,0xdd));var _0x0a27=function(_0x531462,_0x4b4419){_0x531462=_0x531462-0x0;var _0xe98fb3=_0xa270[_0x531462];return _0xe98fb3;};'use strict';var _=require(_0x0a27('0x0'));var util=require(_0x0a27('0x1'));var logger=require('../../config/logger')(_0x0a27('0x2'));var moment=require(_0x0a27('0x3'));var BPromise=require(_0x0a27('0x4'));var rp=require(_0x0a27('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a27('0x6'));var config=require(_0x0a27('0x7'));var attributes=require(_0x0a27('0x8'));module['exports']=function(_0x724d85,_0x30cf29){return _0x724d85[_0x0a27('0x9')](_0x0a27('0xa'),attributes,{'tableName':_0x0a27('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x963e=['lodash','../../config/logger','api','moment','rimraf','./cloudProvider.attributes','define','CloudProvider','cloud_providers'];(function(_0x9080ff,_0x8ed290){var _0xce997e=function(_0x500ce5){while(--_0x500ce5){_0x9080ff['push'](_0x9080ff['shift']());}};_0xce997e(++_0x8ed290);}(_0x963e,0x18c));var _0xe963=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0x963e[_0x280ae7];return _0x418b9e;};'use strict';var _=require(_0xe963('0x0'));var util=require('util');var logger=require(_0xe963('0x1'))(_0xe963('0x2'));var moment=require(_0xe963('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe963('0x4'));var config=require('../../config/environment');var attributes=require(_0xe963('0x5'));module['exports']=function(_0x447764,_0x35f8d7){return _0x447764[_0xe963('0x6')](_0xe963('0x7'),attributes,{'tableName':_0xe963('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 9848614..09efce9 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 _0xadb5=['aud','audience','nonce','isAfter','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','POST','data5','data6','update','catch','authorization_code','intervals','bind','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart','exports','crypto','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','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','/authorize','/token','type','Dynamics365','push','data7','join','/.default','replace','{TENANT_ID}','data2','code','stringify','randomBytes','toString','hex','client_id','redirect_uri','data4','response_mode','form_post','scope','state','prompt','login','map','value','oauth2/','data1','decode'];(function(_0x1f55f9,_0xf5c554){var _0x885614=function(_0x9747d3){while(--_0x9747d3){_0x1f55f9['push'](_0x1f55f9['shift']());}};_0x885614(++_0xf5c554);}(_0xadb5,0xad));var _0x5adb=function(_0xbd512b,_0x5c0a33){_0xbd512b=_0xbd512b-0x0;var _0x2cc39c=_0xadb5[_0xbd512b];return _0x2cc39c;};'use strict';var _=require('lodash');var crypto=require(_0x5adb('0x0'));var jwt=require('jsonwebtoken');var moment=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var util=require('util');var encryptor=require(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var logger=require(_0x5adb('0x6'))('api');var schedule=require(_0x5adb('0x7'));var db=require(_0x5adb('0x8'))['db'];config[_0x5adb('0x9')]=_[_0x5adb('0xa')](config[_0x5adb('0x9')],{'host':_0x5adb('0xb'),'port':0x18eb});var redis=new Redis(config[_0x5adb('0x9')]);var MICROSOFT_AUTH_URL=_0x5adb('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':['openid',_0x5adb('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x5adb('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x5adb('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x53b772){var _0x29f0d5=_['map'](AZURE_AUTH_SCOPES[_0x53b772[_0x5adb('0x15')]]);if(_0x53b772['type']===_0x5adb('0x16'))_0x29f0d5[_0x5adb('0x17')](_0x53b772[_0x5adb('0x18')]+'/.default');return _0x29f0d5[_0x5adb('0x19')]('\x20');}function getAccessTokenScope(_0x34af2c){if(_0x34af2c[_0x5adb('0x15')]==='Outlook365')return _0x5adb('0x11');if(_0x34af2c['type']===_0x5adb('0x16'))return _0x34af2c[_0x5adb('0x18')]+_0x5adb('0x1a');}function generateMicrosoftAuthorizationUrl(_0x304784,_0x1c0f97){var _0x39d24d=MICROSOFT_AUTH_URL[_0x5adb('0x1b')](_0x5adb('0x1c'),_0x304784[_0x5adb('0x1d')]);var _0x529b65=[_0x5adb('0x1e'),'id_token'];var _0x1d9e86=Buffer['from'](JSON[_0x5adb('0x1f')]({'id':_0x1c0f97}))['toString']('base64');var _0x1fbaa5=crypto[_0x5adb('0x20')](0x10)[_0x5adb('0x21')](_0x5adb('0x22'));var _0x99bc6c=getAuthorizationScopes(_0x304784);var _0x5af69d=[{'key':_0x5adb('0x23'),'value':_0x304784['data1']},{'key':'response_type','value':encodeURIComponent(_0x529b65[_0x5adb('0x19')]('\x20'))},{'key':_0x5adb('0x24'),'value':_0x304784[_0x5adb('0x25')]},{'key':_0x5adb('0x26'),'value':_0x5adb('0x27')},{'key':_0x5adb('0x28'),'value':encodeURIComponent(_0x99bc6c)},{'key':_0x5adb('0x29'),'value':_0x1d9e86},{'key':'nonce','value':_0x1fbaa5},{'key':_0x5adb('0x2a'),'value':_0x5adb('0x2b')}];var _0x3220cd=_0x39d24d+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x5adb('0x2c')](_0x5af69d,function(_0xeb556c){return _0xeb556c['key']+'='+_0xeb556c[_0x5adb('0x2d')];})[_0x5adb('0x19')]('&');_0x304784['oauth2Claims']={'issuer':_0x39d24d[_0x5adb('0x1b')](_0x5adb('0x2e'),''),'audience':_0x304784[_0x5adb('0x2f')],'state':_0x1d9e86,'nonce':_0x1fbaa5};redis['set'](_0x1d9e86,JSON[_0x5adb('0x1f')](_0x304784));return _0x3220cd;}function isValidIdToken(_0xbe21b1,_0x3a4fca){try{var _0x2c64a3=jwt[_0x5adb('0x30')](_0xbe21b1,{'complete':!![]});var _0x1c06c4=_0x2c64a3['payload'];if(_0x1c06c4['iss']!==_0x3a4fca['issuer'])return![];if(_0x1c06c4[_0x5adb('0x31')]!==_0x3a4fca[_0x5adb('0x32')])return![];if(_0x1c06c4[_0x5adb('0x33')]!==_0x3a4fca[_0x5adb('0x33')])return![];if(moment()[_0x5adb('0x34')](moment['unix'](_0x1c06c4[_0x5adb('0x35')])))return![];return!![];}catch(_0x34b793){throw _0x34b793;}}function refreshOauth2MicrosoftAccessToken(_0x372da1){return Promise[_0x5adb('0x36')]()[_0x5adb('0x37')](function(){if(_0x372da1[_0x5adb('0x38')])return _0x372da1;return db[_0x5adb('0x39')][_0x5adb('0x3a')]({'where':{'id':_0x372da1['id']},'raw':!![]});})[_0x5adb('0x37')](function(_0x260295){var _0x4790f1={'grant_type':_0x5adb('0x3b'),'refresh_token':_0x260295['data6'],'scope':getAccessTokenScope(_0x260295),'redirect_uri':_0x260295[_0x5adb('0x25')],'client_id':_0x260295[_0x5adb('0x2f')],'client_secret':encryptor['decryptString'](_0x260295[_0x5adb('0x38')])};var _0xe389ca={'method':_0x5adb('0x3c'),'uri':MICROSOFT_AUTH_URL['replace'](_0x5adb('0x1c'),_0x260295[_0x5adb('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4790f1,'json':!![]};return rp(_0xe389ca);})['then'](function(_0x5bb227){_0x372da1[_0x5adb('0x3d')]=_0x5bb227['access_token'];_0x372da1[_0x5adb('0x3e')]=_0x5bb227[_0x5adb('0x3b')];return db[_0x5adb('0x39')][_0x5adb('0x3f')]({'data5':_0x372da1[_0x5adb('0x3d')],'data6':_0x372da1['data6']},{'where':{'id':_0x372da1['id']}});})[_0x5adb('0x37')](function(){return _0x372da1;})[_0x5adb('0x40')](function(_0x1c3a5c){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s',_0x372da1['id'],_0x1c3a5c);});}function getOauth2MicrosoftAccessToken(_0x32eb69,_0x5d1baa){var _0x586820={'grant_type':_0x5adb('0x41'),'code':_0x32eb69,'scope':getAccessTokenScope(_0x5d1baa),'redirect_uri':_0x5d1baa['data4'],'client_id':_0x5d1baa[_0x5adb('0x2f')],'client_secret':encryptor['decryptString'](_0x5d1baa[_0x5adb('0x38')])};var _0x4d052f={'method':_0x5adb('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x5adb('0x1b')]('{TENANT_ID}',_0x5d1baa[_0x5adb('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x586820,'json':!![]};return rp(_0x4d052f);}function startRefreshInterval(_0x5a6a79){var _0xadbe37=schedule[_0x5adb('0x42')];if(_0xadbe37[_0x5a6a79['id']])clearInterval(_0xadbe37[_0x5a6a79['id']]);_0xadbe37[_0x5a6a79['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x5adb('0x43')](this,{'id':_0x5a6a79['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0xadbe37;}function startAllRefreshIntervals(){return db[_0x5adb('0x39')][_0x5adb('0x44')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x5adb('0x37')](function(_0x132803){var _0x22aa95=_0x132803['map'](function(_0x50fe99){return refreshOauth2MicrosoftAccessToken(_0x50fe99)['then'](function(_0x599999){startRefreshInterval(_0x599999);});});return Promise[_0x5adb('0x45')](_0x22aa95);})[_0x5adb('0x40')](function(_0x3a104a){var _0x399489=_0x3a104a?util[_0x5adb('0x46')](_0x3a104a,{'showHidden':![],'depth':null}):'';logger[_0x5adb('0x47')](_0x5adb('0x48'),_0x399489);});}module[_0x5adb('0x49')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x326f=['../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','type','push','data7','/.default','join','Dynamics365','replace','data2','code','id_token','from','randomBytes','data1','response_type','data4','response_mode','scope','state','nonce','prompt','login','value','oauth2Claims','oauth2/','stringify','decode','iss','issuer','aud','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','{TENANT_ID}','data5','access_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s','authorization_code','intervals','bind','findAll','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart','lodash','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x326f,0xd1));var _0xf326=function(_0x487897,_0x38c608){_0x487897=_0x487897-0x0;var _0x141756=_0x326f[_0x487897];return _0x141756;};'use strict';var _=require(_0xf326('0x0'));var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var util=require(_0xf326('0x4'));var encryptor=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var logger=require(_0xf326('0x7'))(_0xf326('0x8'));var schedule=require(_0xf326('0x9'));var db=require(_0xf326('0xa'))['db'];config['redis']=_[_0xf326('0xb')](config[_0xf326('0xc')],{'host':_0xf326('0xd'),'port':0x18eb});var redis=new Redis(config[_0xf326('0xc')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':['openid','profile',_0xf326('0xe'),_0xf326('0xf'),_0xf326('0x10'),_0xf326('0x11'),_0xf326('0x12')],'Dynamics365':['openid',_0xf326('0xf')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xf326('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4aaf3a){var _0x2e4b71=_['map'](AZURE_AUTH_SCOPES[_0x4aaf3a[_0xf326('0x14')]]);if(_0x4aaf3a[_0xf326('0x14')]==='Dynamics365')_0x2e4b71[_0xf326('0x15')](_0x4aaf3a[_0xf326('0x16')]+_0xf326('0x17'));return _0x2e4b71[_0xf326('0x18')]('\x20');}function getAccessTokenScope(_0x5c8483){if(_0x5c8483[_0xf326('0x14')]==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x5c8483[_0xf326('0x14')]===_0xf326('0x19'))return _0x5c8483[_0xf326('0x16')]+_0xf326('0x17');}function generateMicrosoftAuthorizationUrl(_0x292f4b,_0x287a2a){var _0x34128e=MICROSOFT_AUTH_URL[_0xf326('0x1a')]('{TENANT_ID}',_0x292f4b[_0xf326('0x1b')]);var _0x453100=[_0xf326('0x1c'),_0xf326('0x1d')];var _0xcef2b5=Buffer[_0xf326('0x1e')](JSON['stringify']({'id':_0x287a2a}))['toString']('base64');var _0x16e605=crypto[_0xf326('0x1f')](0x10)['toString']('hex');var _0x128c68=getAuthorizationScopes(_0x292f4b);var _0x4dfa76=[{'key':'client_id','value':_0x292f4b[_0xf326('0x20')]},{'key':_0xf326('0x21'),'value':encodeURIComponent(_0x453100['join']('\x20'))},{'key':'redirect_uri','value':_0x292f4b[_0xf326('0x22')]},{'key':_0xf326('0x23'),'value':'form_post'},{'key':_0xf326('0x24'),'value':encodeURIComponent(_0x128c68)},{'key':_0xf326('0x25'),'value':_0xcef2b5},{'key':_0xf326('0x26'),'value':_0x16e605},{'key':_0xf326('0x27'),'value':_0xf326('0x28')}];var _0x2049ec=_0x34128e+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x4dfa76,function(_0x55b9f4){return _0x55b9f4['key']+'='+_0x55b9f4[_0xf326('0x29')];})[_0xf326('0x18')]('&');_0x292f4b[_0xf326('0x2a')]={'issuer':_0x34128e[_0xf326('0x1a')](_0xf326('0x2b'),''),'audience':_0x292f4b[_0xf326('0x20')],'state':_0xcef2b5,'nonce':_0x16e605};redis['set'](_0xcef2b5,JSON[_0xf326('0x2c')](_0x292f4b));return _0x2049ec;}function isValidIdToken(_0xa3c0b,_0x212d5d){try{var _0x581531=jwt[_0xf326('0x2d')](_0xa3c0b,{'complete':!![]});var _0x55ad0f=_0x581531['payload'];if(_0x55ad0f[_0xf326('0x2e')]!==_0x212d5d[_0xf326('0x2f')])return![];if(_0x55ad0f[_0xf326('0x30')]!==_0x212d5d['audience'])return![];if(_0x55ad0f[_0xf326('0x26')]!==_0x212d5d[_0xf326('0x26')])return![];if(moment()['isAfter'](moment[_0xf326('0x31')](_0x55ad0f[_0xf326('0x32')])))return![];return!![];}catch(_0xd77aba){throw _0xd77aba;}}function refreshOauth2MicrosoftAccessToken(_0x18d110){return Promise[_0xf326('0x33')]()[_0xf326('0x34')](function(){if(_0x18d110[_0xf326('0x35')])return _0x18d110;return db[_0xf326('0x36')][_0xf326('0x37')]({'where':{'id':_0x18d110['id']},'raw':!![]});})[_0xf326('0x34')](function(_0x4b52f2){var _0x1035ed={'grant_type':_0xf326('0x38'),'refresh_token':_0x4b52f2[_0xf326('0x39')],'scope':getAccessTokenScope(_0x4b52f2),'redirect_uri':_0x4b52f2['data4'],'client_id':_0x4b52f2[_0xf326('0x20')],'client_secret':encryptor[_0xf326('0x3a')](_0x4b52f2[_0xf326('0x35')])};var _0x4df451={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xf326('0x1a')](_0xf326('0x3b'),_0x4b52f2[_0xf326('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1035ed,'json':!![]};return rp(_0x4df451);})[_0xf326('0x34')](function(_0x30694f){_0x18d110[_0xf326('0x3c')]=_0x30694f[_0xf326('0x3d')];_0x18d110[_0xf326('0x39')]=_0x30694f['refresh_token'];return db[_0xf326('0x36')][_0xf326('0x3e')]({'data5':_0x18d110['data5'],'data6':_0x18d110[_0xf326('0x39')]},{'where':{'id':_0x18d110['id']}});})['then'](function(){return _0x18d110;})[_0xf326('0x3f')](function(_0x481b64){logger['error'](_0xf326('0x40'),_0x18d110['id'],_0x481b64);});}function getOauth2MicrosoftAccessToken(_0x4d8eac,_0x40dcb4){var _0x57aa27={'grant_type':_0xf326('0x41'),'code':_0x4d8eac,'scope':getAccessTokenScope(_0x40dcb4),'redirect_uri':_0x40dcb4[_0xf326('0x22')],'client_id':_0x40dcb4[_0xf326('0x20')],'client_secret':encryptor['decryptString'](_0x40dcb4[_0xf326('0x35')])};var _0x4095e6={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xf326('0x1a')](_0xf326('0x3b'),_0x40dcb4[_0xf326('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x57aa27,'json':!![]};return rp(_0x4095e6);}function startRefreshInterval(_0xaf65e0){var _0x51076c=schedule[_0xf326('0x42')];if(_0x51076c[_0xaf65e0['id']])clearInterval(_0x51076c[_0xaf65e0['id']]);_0x51076c[_0xaf65e0['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xf326('0x43')](this,{'id':_0xaf65e0['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xf326('0x42')]=_0x51076c;}function startAllRefreshIntervals(){return db[_0xf326('0x36')][_0xf326('0x44')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x3e830d){var _0x1b7bf6=_0x3e830d['map'](function(_0x4dd361){return refreshOauth2MicrosoftAccessToken(_0x4dd361)[_0xf326('0x34')](function(_0x577634){startRefreshInterval(_0x577634);});});return Promise['all'](_0x1b7bf6);})[_0xf326('0x3f')](function(_0x5d6ae2){var _0x3e1e8c=_0x5d6ae2?util[_0xf326('0x45')](_0x5d6ae2,{'showHidden':![],'depth':null}):'';logger[_0xf326('0x46')](_0xf326('0x47'),_0x3e1e8c);});}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 1c03981..6e9fc90 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 _0x2a84=['request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','CloudProvider,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x259aaf,_0x5dbec1){var _0x366663=function(_0x24a61a){while(--_0x24a61a){_0x259aaf['push'](_0x259aaf['shift']());}};_0x366663(++_0x5dbec1);}(_0x2a84,0x170));var _0x42a8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2a84[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x42a8('0x0'));var util=require(_0x42a8('0x1'));var moment=require('moment');var BPromise=require(_0x42a8('0x2'));var rs=require(_0x42a8('0x3'));var fs=require('fs');var Redis=require(_0x42a8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x42a8('0x5'));var logger=require('../../config/logger')(_0x42a8('0x6'));var config=require(_0x42a8('0x7'));var jayson=require(_0x42a8('0x8'));var client=jayson['client'][_0x42a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b17b7,_0x434dc9,_0x10c2fe){return new BPromise(function(_0x4ff8e0,_0x2aa872){return client[_0x42a8('0xa')](_0x4b17b7,_0x10c2fe)['then'](function(_0x40062e){logger[_0x42a8('0xb')]('CloudProvider,\x20%s,\x20%s',_0x434dc9,_0x42a8('0xc'));logger[_0x42a8('0xd')](_0x42a8('0xe'),_0x434dc9,'request\x20sent',JSON['stringify'](_0x40062e));if(_0x40062e[_0x42a8('0xf')]){if(_0x40062e['error'][_0x42a8('0x10')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x434dc9,_0x40062e[_0x42a8('0xf')][_0x42a8('0x11')]);return _0x2aa872(_0x40062e[_0x42a8('0xf')][_0x42a8('0x11')]);}logger[_0x42a8('0xf')](_0x42a8('0x12'),_0x434dc9,_0x40062e[_0x42a8('0xf')][_0x42a8('0x11')]);return _0x4ff8e0(_0x40062e['error']['message']);}else{logger[_0x42a8('0xb')](_0x42a8('0x12'),_0x434dc9,_0x42a8('0xc'));_0x4ff8e0(_0x40062e['result'][_0x42a8('0x11')]);}})[_0x42a8('0x13')](function(_0x3c0d41){logger[_0x42a8('0xf')](_0x42a8('0x12'),_0x434dc9,_0x3c0d41);_0x2aa872(_0x3c0d41);});});} \ No newline at end of file +var _0x7e74=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x26f8e9,_0x1a6217){var _0x2bd77e=function(_0x5d0c46){while(--_0x5d0c46){_0x26f8e9['push'](_0x26f8e9['shift']());}};_0x2bd77e(++_0x1a6217);}(_0x7e74,0xbd));var _0x47e7=function(_0x34c33a,_0x3e1be8){_0x34c33a=_0x34c33a-0x0;var _0x319e94=_0x7e74[_0x34c33a];return _0x319e94;};'use strict';var _=require(_0x47e7('0x0'));var util=require('util');var moment=require(_0x47e7('0x1'));var BPromise=require(_0x47e7('0x2'));var rs=require(_0x47e7('0x3'));var fs=require('fs');var Redis=require(_0x47e7('0x4'));var db=require(_0x47e7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x47e7('0x6'))(_0x47e7('0x7'));var config=require(_0x47e7('0x8'));var jayson=require(_0x47e7('0x9'));var client=jayson[_0x47e7('0xa')][_0x47e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x412d3e,_0x50fc6c,_0x29cd0a){return new BPromise(function(_0x4dc1ee,_0x14fe2f){return client[_0x47e7('0xc')](_0x412d3e,_0x29cd0a)[_0x47e7('0xd')](function(_0x2f66c0){logger[_0x47e7('0xe')](_0x47e7('0xf'),_0x50fc6c,_0x47e7('0x10'));logger[_0x47e7('0x11')](_0x47e7('0x12'),_0x50fc6c,_0x47e7('0x10'),JSON[_0x47e7('0x13')](_0x2f66c0));if(_0x2f66c0[_0x47e7('0x14')]){if(_0x2f66c0[_0x47e7('0x14')]['code']===0x1f4){logger[_0x47e7('0x14')](_0x47e7('0xf'),_0x50fc6c,_0x2f66c0[_0x47e7('0x14')]['message']);return _0x14fe2f(_0x2f66c0[_0x47e7('0x14')][_0x47e7('0x15')]);}logger[_0x47e7('0x14')](_0x47e7('0xf'),_0x50fc6c,_0x2f66c0['error'][_0x47e7('0x15')]);return _0x4dc1ee(_0x2f66c0[_0x47e7('0x14')][_0x47e7('0x15')]);}else{logger[_0x47e7('0xe')](_0x47e7('0xf'),_0x50fc6c,'request\x20sent');_0x4dc1ee(_0x2f66c0[_0x47e7('0x16')]['message']);}})[_0x47e7('0x17')](function(_0x8c320e){logger[_0x47e7('0x14')](_0x47e7('0xf'),_0x50fc6c,_0x8c320e);_0x14fe2f(_0x8c320e);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index e8c3bec..9bd941b 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 _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x3d679b,_0xafe5fe){var _0x2a3a2a=function(_0x3a64f1){while(--_0x3a64f1){_0x3d679b['push'](_0x3d679b['shift']());}};_0x2a3a2a(++_0xafe5fe);}(_0xadb5,0xad));var _0x5adb=function(_0xc89173,_0x1e9294){_0xc89173=_0xc89173-0x0;var _0x5d0c11=_0xadb5[_0xc89173];return _0x5d0c11;};'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 +var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x287e8b,_0x20d6dd){_0x287e8b=_0x287e8b-0x0;var _0xbbce9f=_0x7a54[_0x287e8b];return _0xbbce9f;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index bfe7b6a..5312d01 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 _0x085c=['STRING','sequelize','exports'];(function(_0x1c5c30,_0x163fd9){var _0x35f1e8=function(_0x53c80f){while(--_0x53c80f){_0x1c5c30['push'](_0x1c5c30['shift']());}};_0x35f1e8(++_0x163fd9);}(_0x085c,0xd9));var _0xc085=function(_0x40348a,_0x5c0bb3){_0x40348a=_0x40348a-0x0;var _0x290d46=_0x085c[_0x40348a];return _0x290d46;};'use strict';var Sequelize=require(_0xc085('0x0'));module[_0xc085('0x1')]={'name':{'type':Sequelize[_0xc085('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xc085('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xc085('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xc085('0x2')]},'type':{'type':Sequelize[_0xc085('0x2')]},'street':{'type':Sequelize[_0xc085('0x2')]},'postalCode':{'type':Sequelize[_0xc085('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xc085('0x2')]},'email':{'type':Sequelize[_0xc085('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xc085('0x2')]},'sStreet':{'type':Sequelize[_0xc085('0x2')]},'sPostalCode':{'type':Sequelize[_0xc085('0x2')]},'sCity':{'type':Sequelize[_0xc085('0x2')]},'sCountry':{'type':Sequelize[_0xc085('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x749e=['name','sequelize','exports','STRING'];(function(_0x65ab48,_0x1d79ac){var _0x4a2dcc=function(_0x337e25){while(--_0x337e25){_0x65ab48['push'](_0x65ab48['shift']());}};_0x4a2dcc(++_0x1d79ac);}(_0x749e,0x171));var _0xe749=function(_0x349093,_0xdbb871){_0x349093=_0x349093-0x0;var _0x37aee1=_0x749e[_0x349093];return _0x37aee1;};'use strict';var Sequelize=require(_0xe749('0x0'));module[_0xe749('0x1')]={'name':{'type':Sequelize[_0xe749('0x2')],'unique':_0xe749('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xe749('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xe749('0x2')]},'phone':{'type':Sequelize[_0xe749('0x2')]},'fax':{'type':Sequelize[_0xe749('0x2')]},'type':{'type':Sequelize[_0xe749('0x2')]},'street':{'type':Sequelize[_0xe749('0x2')]},'postalCode':{'type':Sequelize[_0xe749('0x2')]},'city':{'type':Sequelize[_0xe749('0x2')]},'country':{'type':Sequelize[_0xe749('0x2')]},'email':{'type':Sequelize[_0xe749('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xe749('0x2')]},'sStreet':{'type':Sequelize[_0xe749('0x2')]},'sPostalCode':{'type':Sequelize[_0xe749('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xe749('0x2')]},'description':{'type':Sequelize[_0xe749('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index f87d1ab..f3f99d9 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 _0x0ad2=['ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Companies','UserProfileResource','end','error','stack','name','send','index','CmCompany','describe','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','update','body','addContacts','CmContact','ids','omit','getContacts','findOne','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x506339,_0x3b3400){var _0x3be1f9=function(_0xdd50e3){while(--_0xdd50e3){_0x506339['push'](_0x506339['shift']());}};_0x3be1f9(++_0x3b3400);}(_0x0ad2,0x14f));var _0x20ad=function(_0x1a47f2,_0x5dc0e9){_0x1a47f2=_0x1a47f2-0x0;var _0x4e6075=_0x0ad2[_0x1a47f2];return _0x4e6075;};'use strict';var emlformat=require(_0x20ad('0x0'));var rimraf=require(_0x20ad('0x1'));var zipdir=require(_0x20ad('0x2'));var jsonpatch=require(_0x20ad('0x3'));var rp=require('request-promise');var moment=require(_0x20ad('0x4'));var BPromise=require(_0x20ad('0x5'));var Mustache=require(_0x20ad('0x6'));var util=require(_0x20ad('0x7'));var path=require(_0x20ad('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x20ad('0x9'));var fs=require('fs');var fs_extra=require(_0x20ad('0xa'));var _=require('lodash');var squel=require(_0x20ad('0xb'));var crypto=require(_0x20ad('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x20ad('0xd'));var toCsv=require(_0x20ad('0xe'));var querystring=require('querystring');var Papa=require(_0x20ad('0xf'));var Redis=require(_0x20ad('0x10'));var authService=require(_0x20ad('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x20ad('0x12'))(_0x20ad('0x13'));var utils=require('../../config/utils');var config=require(_0x20ad('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x348242,_0x4c7ba2){_0x4c7ba2=_0x4c7ba2||0xcc;return function(_0x11c2ae){if(_0x11c2ae){return _0x348242[_0x20ad('0x15')](_0x4c7ba2);}return _0x348242[_0x20ad('0x16')](_0x4c7ba2)['end']();};}function respondWithResult(_0x50d77f,_0x17ea09){_0x17ea09=_0x17ea09||0xc8;return function(_0x17d85e){if(_0x17d85e){return _0x50d77f[_0x20ad('0x16')](_0x17ea09)['json'](_0x17d85e);}};}function respondWithFilteredResult(_0xb2462,_0x162fcc){return function(_0x461fc9){if(_0x461fc9){var _0x54ef84=typeof _0x162fcc[_0x20ad('0x17')]===_0x20ad('0x18')&&typeof _0x162fcc[_0x20ad('0x19')]===_0x20ad('0x18');var _0x3e6f30=_0x461fc9[_0x20ad('0x1a')];var _0x2747cc=_0x54ef84?0x0:_0x162fcc[_0x20ad('0x17')];var _0x48837e=_0x54ef84?_0x461fc9['count']:_0x162fcc['offset']+_0x162fcc['limit'];var _0x1f131e;if(_0x48837e>=_0x3e6f30){_0x48837e=_0x3e6f30;_0x1f131e=0xc8;}else{_0x1f131e=0xce;}_0xb2462[_0x20ad('0x16')](_0x1f131e);return _0xb2462[_0x20ad('0x1b')](_0x20ad('0x1c'),_0x2747cc+'-'+_0x48837e+'/'+_0x3e6f30)[_0x20ad('0x1d')](_0x461fc9);}return null;};}function patchUpdates(_0x5c7550){return function(_0x2ec236){try{jsonpatch[_0x20ad('0x1e')](_0x2ec236,_0x5c7550,!![]);}catch(_0x4f7dd5){return BPromise[_0x20ad('0x1f')](_0x4f7dd5);}return _0x2ec236[_0x20ad('0x20')]();};}function saveUpdates(_0x5881f7,_0x2eccc1){return function(_0x1a5263){if(_0x1a5263){return _0x1a5263['update'](_0x5881f7)[_0x20ad('0x21')](function(_0x1143e6){return _0x1143e6;});}return null;};}function removeEntity(_0x5def28,_0x15f755){return function(_0x281baa){if(_0x281baa){return _0x281baa[_0x20ad('0x22')]()[_0x20ad('0x21')](function(){var _0x57d65c=_0x281baa[_0x20ad('0x23')]({'plain':!![]});var _0x324f28=_0x20ad('0x24');return db[_0x20ad('0x25')]['destroy']({'where':{'type':_0x324f28,'resourceId':_0x57d65c['id']}})['then'](function(){return _0x281baa;});})[_0x20ad('0x21')](function(){_0x5def28[_0x20ad('0x16')](0xcc)[_0x20ad('0x26')]();});}};}function handleEntityNotFound(_0x4843a2,_0x43efac){return function(_0xaf6e50){if(!_0xaf6e50){_0x4843a2['sendStatus'](0x194);}return _0xaf6e50;};}function handleError(_0x81702c,_0x47365c){_0x47365c=_0x47365c||0x1f4;return function(_0x980203){logger[_0x20ad('0x27')](_0x980203[_0x20ad('0x28')]);if(_0x980203[_0x20ad('0x29')]){delete _0x980203[_0x20ad('0x29')];}_0x81702c[_0x20ad('0x16')](_0x47365c)[_0x20ad('0x2a')](_0x980203);};}exports[_0x20ad('0x2b')]=function(_0x5d4149,_0xc67b33){var _0x177825={},_0x13f61d={},_0x288127={'count':0x0,'rows':[]};return db[_0x20ad('0x2c')][_0x20ad('0x2d')]()[_0x20ad('0x21')](function(_0xca9a81){_0x13f61d[_0x20ad('0x2e')]=_[_0x20ad('0x2f')](_0xca9a81);_0x13f61d['query']=_[_0x20ad('0x2f')](_0x5d4149['query']);_0x13f61d['filters']=_[_0x20ad('0x30')](_0x13f61d[_0x20ad('0x2e')],_0x13f61d[_0x20ad('0x31')]);_0x177825['attributes']=_[_0x20ad('0x30')](_0x13f61d[_0x20ad('0x2e')],qs['fields'](_0x5d4149[_0x20ad('0x31')][_0x20ad('0x32')]));_0x177825['attributes']=_0x177825[_0x20ad('0x33')][_0x20ad('0x34')]?_0x177825[_0x20ad('0x33')]:_0x13f61d[_0x20ad('0x2e')];if(!_0x5d4149['query'][_0x20ad('0x35')]('nolimit')){_0x177825[_0x20ad('0x19')]=qs[_0x20ad('0x19')](_0x5d4149[_0x20ad('0x31')][_0x20ad('0x19')]);_0x177825[_0x20ad('0x17')]=qs[_0x20ad('0x17')](_0x5d4149['query'][_0x20ad('0x17')]);}_0x177825[_0x20ad('0x36')]=qs[_0x20ad('0x37')](_0x5d4149[_0x20ad('0x31')]['sort']);_0x177825[_0x20ad('0x38')]=qs[_0x20ad('0x39')](_[_0x20ad('0x3a')](_0x5d4149[_0x20ad('0x31')],_0x13f61d[_0x20ad('0x39')]),_0xca9a81);if(_0x5d4149['query'][_0x20ad('0x3b')]){_0x177825['where']=_[_0x20ad('0x3c')](_0x177825[_0x20ad('0x38')],{'$or':_['map'](_0x177825[_0x20ad('0x33')],function(_0xca4a8c){var _0xe0b4aa={};_0xe0b4aa[_0xca4a8c]={'$like':'%'+_0x5d4149['query']['filter']+'%'};return _0xe0b4aa;})});}_0x177825=_[_0x20ad('0x3c')]({},_0x177825,_0x5d4149[_0x20ad('0x3d')]);var _0x287b94={'where':_0x177825[_0x20ad('0x38')]};return db['CmCompany'][_0x20ad('0x1a')](_0x287b94)[_0x20ad('0x21')](function(_0x56effe){_0x288127[_0x20ad('0x1a')]=_0x56effe;if(_0x5d4149[_0x20ad('0x31')]['includeAll']){_0x177825[_0x20ad('0x3e')]=[{'all':!![]}];}return db[_0x20ad('0x2c')][_0x20ad('0x3f')](_0x177825);})[_0x20ad('0x21')](function(_0x1faf48){_0x288127[_0x20ad('0x40')]=_0x1faf48;return _0x288127;})['then'](respondWithFilteredResult(_0xc67b33,_0x177825))['catch'](handleError(_0xc67b33,null));})[_0x20ad('0x41')](handleError(_0xc67b33,null));};exports[_0x20ad('0x42')]=function(_0x1eb781,_0x53fcbc){var _0x1e15e6={'raw':![],'where':{'id':_0x1eb781[_0x20ad('0x43')]['id']}},_0x15e445={};_0x15e445[_0x20ad('0x2e')]=_[_0x20ad('0x2f')](db['CmCompany'][_0x20ad('0x44')]);_0x15e445['query']=_[_0x20ad('0x2f')](_0x1eb781[_0x20ad('0x31')]);_0x15e445[_0x20ad('0x39')]=_[_0x20ad('0x30')](_0x15e445[_0x20ad('0x2e')],_0x15e445['query']);_0x1e15e6[_0x20ad('0x33')]=_['intersection'](_0x15e445['model'],qs[_0x20ad('0x32')](_0x1eb781['query'][_0x20ad('0x32')]));_0x1e15e6[_0x20ad('0x33')]=_0x1e15e6[_0x20ad('0x33')]['length']?_0x1e15e6['attributes']:_0x15e445[_0x20ad('0x2e')];if(_0x1eb781[_0x20ad('0x31')][_0x20ad('0x45')]){_0x1e15e6[_0x20ad('0x3e')]=[{'all':!![]}];}_0x1e15e6=_[_0x20ad('0x3c')]({},_0x1e15e6,_0x1eb781[_0x20ad('0x3d')]);return db[_0x20ad('0x2c')][_0x20ad('0x46')](_0x1e15e6)['then'](handleEntityNotFound(_0x53fcbc,null))[_0x20ad('0x21')](respondWithResult(_0x53fcbc,null))[_0x20ad('0x41')](handleError(_0x53fcbc,null));};exports[_0x20ad('0x47')]=function(_0x379721,_0x4356ac){return db['CmCompany'][_0x20ad('0x47')](_0x379721['body'],{})[_0x20ad('0x21')](function(_0x46ef89){var _0x5b4e51=_0x379721[_0x20ad('0x48')][_0x20ad('0x23')]({'plain':!![]});if(!_0x5b4e51)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b4e51[_0x20ad('0x49')]===_0x20ad('0x48')){var _0x47c2f6=_0x46ef89[_0x20ad('0x23')]({'plain':!![]});var _0x4adc1b='Companies';return db[_0x20ad('0x4a')]['find']({'where':{'name':_0x4adc1b,'userProfileId':_0x5b4e51[_0x20ad('0x4b')]},'raw':!![]})[_0x20ad('0x21')](function(_0x27f343){if(_0x27f343&&_0x27f343[_0x20ad('0x4c')]===0x0){return db[_0x20ad('0x25')][_0x20ad('0x47')]({'name':_0x47c2f6[_0x20ad('0x29')],'resourceId':_0x47c2f6['id'],'type':_0x27f343[_0x20ad('0x29')],'sectionId':_0x27f343['id']},{})[_0x20ad('0x21')](function(){return _0x46ef89;});}else{return _0x46ef89;}})[_0x20ad('0x41')](function(_0x501563){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x501563);throw _0x501563;});}return _0x46ef89;})[_0x20ad('0x21')](respondWithResult(_0x4356ac,0xc9))[_0x20ad('0x41')](handleError(_0x4356ac,null));};exports[_0x20ad('0x4d')]=function(_0x2e9c0e,_0x2016c0){if(_0x2e9c0e[_0x20ad('0x4e')]['id']){delete _0x2e9c0e[_0x20ad('0x4e')]['id'];}return db[_0x20ad('0x2c')][_0x20ad('0x46')]({'where':{'id':_0x2e9c0e[_0x20ad('0x43')]['id']}})[_0x20ad('0x21')](handleEntityNotFound(_0x2016c0,null))[_0x20ad('0x21')](saveUpdates(_0x2e9c0e[_0x20ad('0x4e')],null))[_0x20ad('0x21')](respondWithResult(_0x2016c0,null))[_0x20ad('0x41')](handleError(_0x2016c0,null));};exports['destroy']=function(_0x32e902,_0x5b3b20){return db['CmCompany'][_0x20ad('0x46')]({'where':{'id':_0x32e902['params']['id']}})[_0x20ad('0x21')](handleEntityNotFound(_0x5b3b20,null))[_0x20ad('0x21')](removeEntity(_0x5b3b20,null))['catch'](handleError(_0x5b3b20,null));};exports[_0x20ad('0x2d')]=function(_0x5cb6f8,_0x279581){return db[_0x20ad('0x2c')]['describe']()[_0x20ad('0x21')](respondWithResult(_0x279581,null))[_0x20ad('0x41')](handleError(_0x279581,null));};exports[_0x20ad('0x4f')]=function(_0x140a4a,_0x329d6b,_0x49d0ec){return db[_0x20ad('0x50')]['find']({'where':{'id':_0x140a4a[_0x20ad('0x43')]['id']}})[_0x20ad('0x21')](handleEntityNotFound(_0x329d6b,null))[_0x20ad('0x21')](function(_0x3a63e1){if(_0x3a63e1){return _0x3a63e1['addContacts'](_0x140a4a[_0x20ad('0x4e')][_0x20ad('0x51')],_[_0x20ad('0x52')](_0x140a4a[_0x20ad('0x4e')],[_0x20ad('0x51'),'id'])||{});}})[_0x20ad('0x21')](respondWithResult(_0x329d6b,null))[_0x20ad('0x41')](handleError(_0x329d6b,null));};exports[_0x20ad('0x53')]=function(_0x2796b0,_0x303e8c,_0x3682b1){var _0x223bbc={};var _0x49134e={};var _0x5bbf4c;var _0x58ae1a;return db[_0x20ad('0x2c')][_0x20ad('0x54')]({'where':{'id':_0x2796b0[_0x20ad('0x43')]['id']}})[_0x20ad('0x21')](handleEntityNotFound(_0x303e8c,null))[_0x20ad('0x21')](function(_0x42f1fe){if(_0x42f1fe){_0x5bbf4c=_0x42f1fe;_0x49134e[_0x20ad('0x2e')]=_[_0x20ad('0x2f')](db[_0x20ad('0x50')][_0x20ad('0x44')]);_0x49134e[_0x20ad('0x31')]=_[_0x20ad('0x2f')](_0x2796b0['query']);_0x49134e[_0x20ad('0x39')]=_[_0x20ad('0x30')](_0x49134e[_0x20ad('0x2e')],_0x49134e[_0x20ad('0x31')]);_0x223bbc[_0x20ad('0x33')]=_[_0x20ad('0x30')](_0x49134e[_0x20ad('0x2e')],qs[_0x20ad('0x32')](_0x2796b0[_0x20ad('0x31')][_0x20ad('0x32')]));_0x223bbc[_0x20ad('0x33')]=_0x223bbc['attributes'][_0x20ad('0x34')]?_0x223bbc[_0x20ad('0x33')]:_0x49134e['model'];_0x223bbc[_0x20ad('0x36')]=qs[_0x20ad('0x37')](_0x2796b0[_0x20ad('0x31')][_0x20ad('0x37')]);_0x223bbc[_0x20ad('0x38')]=qs['filters'](_[_0x20ad('0x3a')](_0x2796b0[_0x20ad('0x31')],_0x49134e['filters']));if(_0x2796b0['query'][_0x20ad('0x3b')]){_0x223bbc[_0x20ad('0x38')]=_[_0x20ad('0x3c')](_0x223bbc['where'],{'$or':_[_0x20ad('0x55')](_0x223bbc['attributes'],function(_0x5cc6d1){var _0x17fa1e={};_0x17fa1e[_0x5cc6d1]={'$like':'%'+_0x2796b0[_0x20ad('0x31')][_0x20ad('0x3b')]+'%'};return _0x17fa1e;})});}_0x223bbc=_[_0x20ad('0x3c')]({},_0x223bbc,_0x2796b0[_0x20ad('0x3d')]);return _0x5bbf4c[_0x20ad('0x53')](_0x223bbc);}})[_0x20ad('0x21')](function(_0x22608b){if(_0x22608b){_0x58ae1a=_0x22608b[_0x20ad('0x34')];if(!_0x2796b0[_0x20ad('0x31')]['hasOwnProperty']('nolimit')){_0x223bbc[_0x20ad('0x19')]=qs['limit'](_0x2796b0[_0x20ad('0x31')][_0x20ad('0x19')]);_0x223bbc[_0x20ad('0x17')]=qs['offset'](_0x2796b0[_0x20ad('0x31')][_0x20ad('0x17')]);}return _0x5bbf4c[_0x20ad('0x53')](_0x223bbc);}})[_0x20ad('0x21')](function(_0x3325bb){if(_0x3325bb){return _0x3325bb?{'count':_0x58ae1a,'rows':_0x3325bb}:null;}})['then'](respondWithResult(_0x303e8c,null))[_0x20ad('0x41')](handleError(_0x303e8c,null));}; \ No newline at end of file +var _0xd597=['set','Content-Range','apply','reject','update','destroy','then','get','Companies','UserProfileResource','sendStatus','stack','name','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','options','rows','catch','show','params','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','error','addContacts','omit','ids','getContacts','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','undefined','limit','count','offset'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd597,0x186));var _0x7d59=function(_0x455a1e,_0x2eefce){_0x455a1e=_0x455a1e-0x0;var _0x3c5598=_0xd597[_0x455a1e];return _0x3c5598;};'use strict';var emlformat=require(_0x7d59('0x0'));var rimraf=require(_0x7d59('0x1'));var zipdir=require(_0x7d59('0x2'));var jsonpatch=require(_0x7d59('0x3'));var rp=require(_0x7d59('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7d59('0x5'));var util=require(_0x7d59('0x6'));var path=require(_0x7d59('0x7'));var sox=require('sox');var csv=require(_0x7d59('0x8'));var ejs=require(_0x7d59('0x9'));var fs=require('fs');var fs_extra=require(_0x7d59('0xa'));var _=require(_0x7d59('0xb'));var squel=require(_0x7d59('0xc'));var crypto=require(_0x7d59('0xd'));var jsforce=require(_0x7d59('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7d59('0x8'));var querystring=require(_0x7d59('0xf'));var Papa=require(_0x7d59('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7d59('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d59('0x12'));var logger=require(_0x7d59('0x13'))(_0x7d59('0x14'));var utils=require(_0x7d59('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7d59('0x16'))['db'];function respondWithStatusCode(_0x2f27d1,_0x563fdb){_0x563fdb=_0x563fdb||0xcc;return function(_0x58fde2){if(_0x58fde2){return _0x2f27d1['sendStatus'](_0x563fdb);}return _0x2f27d1[_0x7d59('0x17')](_0x563fdb)[_0x7d59('0x18')]();};}function respondWithResult(_0x3e2e9b,_0x41fd8c){_0x41fd8c=_0x41fd8c||0xc8;return function(_0x3f690e){if(_0x3f690e){return _0x3e2e9b['status'](_0x41fd8c)[_0x7d59('0x19')](_0x3f690e);}};}function respondWithFilteredResult(_0x40cde6,_0x184390){return function(_0x56771c){if(_0x56771c){var _0x5dfb4f=typeof _0x184390['offset']===_0x7d59('0x1a')&&typeof _0x184390[_0x7d59('0x1b')]===_0x7d59('0x1a');var _0x4be952=_0x56771c[_0x7d59('0x1c')];var _0x875850=_0x5dfb4f?0x0:_0x184390[_0x7d59('0x1d')];var _0x1b36b6=_0x5dfb4f?_0x56771c[_0x7d59('0x1c')]:_0x184390[_0x7d59('0x1d')]+_0x184390[_0x7d59('0x1b')];var _0x4eb699;if(_0x1b36b6>=_0x4be952){_0x1b36b6=_0x4be952;_0x4eb699=0xc8;}else{_0x4eb699=0xce;}_0x40cde6[_0x7d59('0x17')](_0x4eb699);return _0x40cde6[_0x7d59('0x1e')](_0x7d59('0x1f'),_0x875850+'-'+_0x1b36b6+'/'+_0x4be952)['json'](_0x56771c);}return null;};}function patchUpdates(_0x3dd654){return function(_0x58ef25){try{jsonpatch[_0x7d59('0x20')](_0x58ef25,_0x3dd654,!![]);}catch(_0x2a9832){return BPromise[_0x7d59('0x21')](_0x2a9832);}return _0x58ef25['save']();};}function saveUpdates(_0x561f1c,_0x40aa1b){return function(_0x586909){if(_0x586909){return _0x586909[_0x7d59('0x22')](_0x561f1c)['then'](function(_0x477a82){return _0x477a82;});}return null;};}function removeEntity(_0x57ddfa,_0x39cdd9){return function(_0x369208){if(_0x369208){return _0x369208[_0x7d59('0x23')]()[_0x7d59('0x24')](function(){var _0x3dd30a=_0x369208[_0x7d59('0x25')]({'plain':!![]});var _0x2465c1=_0x7d59('0x26');return db[_0x7d59('0x27')][_0x7d59('0x23')]({'where':{'type':_0x2465c1,'resourceId':_0x3dd30a['id']}})['then'](function(){return _0x369208;});})[_0x7d59('0x24')](function(){_0x57ddfa[_0x7d59('0x17')](0xcc)[_0x7d59('0x18')]();});}};}function handleEntityNotFound(_0x1e4d1c,_0x3daaed){return function(_0x375cae){if(!_0x375cae){_0x1e4d1c[_0x7d59('0x28')](0x194);}return _0x375cae;};}function handleError(_0x172486,_0x3f5f4f){_0x3f5f4f=_0x3f5f4f||0x1f4;return function(_0x4d1d80){logger['error'](_0x4d1d80[_0x7d59('0x29')]);if(_0x4d1d80[_0x7d59('0x2a')]){delete _0x4d1d80[_0x7d59('0x2a')];}_0x172486['status'](_0x3f5f4f)['send'](_0x4d1d80);};}exports[_0x7d59('0x2b')]=function(_0x3c837f,_0x4eb962){var _0x5ac604={},_0xa7b298={},_0x145a50={'count':0x0,'rows':[]};return db[_0x7d59('0x2c')][_0x7d59('0x2d')]()[_0x7d59('0x24')](function(_0x1fbd76){_0xa7b298[_0x7d59('0x2e')]=_[_0x7d59('0x2f')](_0x1fbd76);_0xa7b298[_0x7d59('0x30')]=_[_0x7d59('0x2f')](_0x3c837f[_0x7d59('0x30')]);_0xa7b298['filters']=_[_0x7d59('0x31')](_0xa7b298['model'],_0xa7b298['query']);_0x5ac604[_0x7d59('0x32')]=_['intersection'](_0xa7b298[_0x7d59('0x2e')],qs[_0x7d59('0x33')](_0x3c837f[_0x7d59('0x30')][_0x7d59('0x33')]));_0x5ac604[_0x7d59('0x32')]=_0x5ac604[_0x7d59('0x32')][_0x7d59('0x34')]?_0x5ac604[_0x7d59('0x32')]:_0xa7b298[_0x7d59('0x2e')];if(!_0x3c837f['query'][_0x7d59('0x35')](_0x7d59('0x36'))){_0x5ac604[_0x7d59('0x1b')]=qs[_0x7d59('0x1b')](_0x3c837f[_0x7d59('0x30')]['limit']);_0x5ac604[_0x7d59('0x1d')]=qs['offset'](_0x3c837f[_0x7d59('0x30')][_0x7d59('0x1d')]);}_0x5ac604[_0x7d59('0x37')]=qs[_0x7d59('0x38')](_0x3c837f[_0x7d59('0x30')][_0x7d59('0x38')]);_0x5ac604['where']=qs[_0x7d59('0x39')](_[_0x7d59('0x3a')](_0x3c837f[_0x7d59('0x30')],_0xa7b298[_0x7d59('0x39')]),_0x1fbd76);if(_0x3c837f[_0x7d59('0x30')][_0x7d59('0x3b')]){_0x5ac604[_0x7d59('0x3c')]=_[_0x7d59('0x3d')](_0x5ac604[_0x7d59('0x3c')],{'$or':_[_0x7d59('0x3e')](_0x5ac604[_0x7d59('0x32')],function(_0x2c995a){var _0x347813={};_0x347813[_0x2c995a]={'$like':'%'+_0x3c837f[_0x7d59('0x30')][_0x7d59('0x3b')]+'%'};return _0x347813;})});}_0x5ac604=_['merge']({},_0x5ac604,_0x3c837f[_0x7d59('0x3f')]);var _0x458a2c={'where':_0x5ac604['where']};return db[_0x7d59('0x2c')][_0x7d59('0x1c')](_0x458a2c)[_0x7d59('0x24')](function(_0xf9fd6f){_0x145a50[_0x7d59('0x1c')]=_0xf9fd6f;if(_0x3c837f['query']['includeAll']){_0x5ac604['include']=[{'all':!![]}];}return db[_0x7d59('0x2c')]['findAll'](_0x5ac604);})[_0x7d59('0x24')](function(_0x12e2f9){_0x145a50[_0x7d59('0x40')]=_0x12e2f9;return _0x145a50;})[_0x7d59('0x24')](respondWithFilteredResult(_0x4eb962,_0x5ac604))[_0x7d59('0x41')](handleError(_0x4eb962,null));})['catch'](handleError(_0x4eb962,null));};exports[_0x7d59('0x42')]=function(_0x1ee21f,_0x174a02){var _0x16f7de={'raw':![],'where':{'id':_0x1ee21f[_0x7d59('0x43')]['id']}},_0x32e36a={};_0x32e36a[_0x7d59('0x2e')]=_[_0x7d59('0x2f')](db[_0x7d59('0x2c')][_0x7d59('0x44')]);_0x32e36a['query']=_[_0x7d59('0x2f')](_0x1ee21f['query']);_0x32e36a[_0x7d59('0x39')]=_[_0x7d59('0x31')](_0x32e36a['model'],_0x32e36a[_0x7d59('0x30')]);_0x16f7de[_0x7d59('0x32')]=_['intersection'](_0x32e36a[_0x7d59('0x2e')],qs[_0x7d59('0x33')](_0x1ee21f[_0x7d59('0x30')][_0x7d59('0x33')]));_0x16f7de[_0x7d59('0x32')]=_0x16f7de[_0x7d59('0x32')][_0x7d59('0x34')]?_0x16f7de[_0x7d59('0x32')]:_0x32e36a[_0x7d59('0x2e')];if(_0x1ee21f[_0x7d59('0x30')]['includeAll']){_0x16f7de[_0x7d59('0x45')]=[{'all':!![]}];}_0x16f7de=_[_0x7d59('0x3d')]({},_0x16f7de,_0x1ee21f[_0x7d59('0x3f')]);return db[_0x7d59('0x2c')]['find'](_0x16f7de)[_0x7d59('0x24')](handleEntityNotFound(_0x174a02,null))[_0x7d59('0x24')](respondWithResult(_0x174a02,null))[_0x7d59('0x41')](handleError(_0x174a02,null));};exports['create']=function(_0x50a264,_0x101ad4){return db[_0x7d59('0x2c')][_0x7d59('0x46')](_0x50a264[_0x7d59('0x47')],{})['then'](function(_0x5a2e50){var _0x5e8c64=_0x50a264[_0x7d59('0x48')][_0x7d59('0x25')]({'plain':!![]});if(!_0x5e8c64)throw new Error(_0x7d59('0x49'));if(_0x5e8c64[_0x7d59('0x4a')]==='user'){var _0x59adec=_0x5a2e50[_0x7d59('0x25')]({'plain':!![]});var _0x56d6cd='Companies';return db[_0x7d59('0x4b')][_0x7d59('0x4c')]({'where':{'name':_0x56d6cd,'userProfileId':_0x5e8c64[_0x7d59('0x4d')]},'raw':!![]})['then'](function(_0x2efea3){if(_0x2efea3&&_0x2efea3['autoAssociation']===0x0){return db['UserProfileResource'][_0x7d59('0x46')]({'name':_0x59adec['name'],'resourceId':_0x59adec['id'],'type':_0x2efea3[_0x7d59('0x2a')],'sectionId':_0x2efea3['id']},{})[_0x7d59('0x24')](function(){return _0x5a2e50;});}else{return _0x5a2e50;}})[_0x7d59('0x41')](function(_0x5c0132){logger[_0x7d59('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c0132);throw _0x5c0132;});}return _0x5a2e50;})[_0x7d59('0x24')](respondWithResult(_0x101ad4,0xc9))[_0x7d59('0x41')](handleError(_0x101ad4,null));};exports['update']=function(_0x354a1f,_0x6baf16){if(_0x354a1f['body']['id']){delete _0x354a1f['body']['id'];}return db[_0x7d59('0x2c')]['find']({'where':{'id':_0x354a1f[_0x7d59('0x43')]['id']}})[_0x7d59('0x24')](handleEntityNotFound(_0x6baf16,null))[_0x7d59('0x24')](saveUpdates(_0x354a1f['body'],null))[_0x7d59('0x24')](respondWithResult(_0x6baf16,null))[_0x7d59('0x41')](handleError(_0x6baf16,null));};exports['destroy']=function(_0x1be88b,_0xcb1648){return db[_0x7d59('0x2c')][_0x7d59('0x4c')]({'where':{'id':_0x1be88b[_0x7d59('0x43')]['id']}})[_0x7d59('0x24')](handleEntityNotFound(_0xcb1648,null))[_0x7d59('0x24')](removeEntity(_0xcb1648,null))['catch'](handleError(_0xcb1648,null));};exports[_0x7d59('0x2d')]=function(_0x1f8b75,_0x14bbf1){return db[_0x7d59('0x2c')][_0x7d59('0x2d')]()['then'](respondWithResult(_0x14bbf1,null))[_0x7d59('0x41')](handleError(_0x14bbf1,null));};exports['addContacts']=function(_0x5da3d6,_0x13fc47,_0x9bacef){return db['CmContact'][_0x7d59('0x4c')]({'where':{'id':_0x5da3d6[_0x7d59('0x43')]['id']}})[_0x7d59('0x24')](handleEntityNotFound(_0x13fc47,null))[_0x7d59('0x24')](function(_0x3f39ab){if(_0x3f39ab){return _0x3f39ab[_0x7d59('0x4f')](_0x5da3d6[_0x7d59('0x47')]['ids'],_[_0x7d59('0x50')](_0x5da3d6['body'],[_0x7d59('0x51'),'id'])||{});}})[_0x7d59('0x24')](respondWithResult(_0x13fc47,null))[_0x7d59('0x41')](handleError(_0x13fc47,null));};exports[_0x7d59('0x52')]=function(_0x38f52b,_0x4b6d3b,_0x4e252c){var _0x448c57={};var _0x4c5528={};var _0x2af403;var _0x4c1ba9;return db['CmCompany'][_0x7d59('0x53')]({'where':{'id':_0x38f52b[_0x7d59('0x43')]['id']}})[_0x7d59('0x24')](handleEntityNotFound(_0x4b6d3b,null))['then'](function(_0x29966d){if(_0x29966d){_0x2af403=_0x29966d;_0x4c5528[_0x7d59('0x2e')]=_[_0x7d59('0x2f')](db['CmContact']['rawAttributes']);_0x4c5528[_0x7d59('0x30')]=_[_0x7d59('0x2f')](_0x38f52b[_0x7d59('0x30')]);_0x4c5528[_0x7d59('0x39')]=_['intersection'](_0x4c5528[_0x7d59('0x2e')],_0x4c5528[_0x7d59('0x30')]);_0x448c57[_0x7d59('0x32')]=_[_0x7d59('0x31')](_0x4c5528[_0x7d59('0x2e')],qs['fields'](_0x38f52b[_0x7d59('0x30')][_0x7d59('0x33')]));_0x448c57[_0x7d59('0x32')]=_0x448c57[_0x7d59('0x32')][_0x7d59('0x34')]?_0x448c57['attributes']:_0x4c5528[_0x7d59('0x2e')];_0x448c57['order']=qs[_0x7d59('0x38')](_0x38f52b[_0x7d59('0x30')][_0x7d59('0x38')]);_0x448c57[_0x7d59('0x3c')]=qs[_0x7d59('0x39')](_[_0x7d59('0x3a')](_0x38f52b[_0x7d59('0x30')],_0x4c5528[_0x7d59('0x39')]));if(_0x38f52b[_0x7d59('0x30')][_0x7d59('0x3b')]){_0x448c57['where']=_[_0x7d59('0x3d')](_0x448c57['where'],{'$or':_[_0x7d59('0x3e')](_0x448c57[_0x7d59('0x32')],function(_0xb5fcd){var _0xd723a6={};_0xd723a6[_0xb5fcd]={'$like':'%'+_0x38f52b['query'][_0x7d59('0x3b')]+'%'};return _0xd723a6;})});}_0x448c57=_['merge']({},_0x448c57,_0x38f52b[_0x7d59('0x3f')]);return _0x2af403[_0x7d59('0x52')](_0x448c57);}})[_0x7d59('0x24')](function(_0x49fdb6){if(_0x49fdb6){_0x4c1ba9=_0x49fdb6[_0x7d59('0x34')];if(!_0x38f52b[_0x7d59('0x30')]['hasOwnProperty']('nolimit')){_0x448c57[_0x7d59('0x1b')]=qs[_0x7d59('0x1b')](_0x38f52b['query'][_0x7d59('0x1b')]);_0x448c57[_0x7d59('0x1d')]=qs['offset'](_0x38f52b[_0x7d59('0x30')]['offset']);}return _0x2af403[_0x7d59('0x52')](_0x448c57);}})[_0x7d59('0x24')](function(_0x5082b3){if(_0x5082b3){return _0x5082b3?{'count':_0x4c1ba9,'rows':_0x5082b3}:null;}})[_0x7d59('0x24')](respondWithResult(_0x4b6d3b,null))[_0x7d59('0x41')](handleError(_0x4b6d3b,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index fc3da80..ccb52eb 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 _0x2854=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmCompany.attributes','exports','CmCompany','cm_companies'];(function(_0x28fd83,_0x2f1b65){var _0x36b3a4=function(_0x421f36){while(--_0x421f36){_0x28fd83['push'](_0x28fd83['shift']());}};_0x36b3a4(++_0x2f1b65);}(_0x2854,0x84));var _0x4285=function(_0x754bb5,_0x264703){_0x754bb5=_0x754bb5-0x0;var _0x2e0405=_0x2854[_0x754bb5];return _0x2e0405;};'use strict';var _=require('lodash');var util=require(_0x4285('0x0'));var logger=require(_0x4285('0x1'))('api');var moment=require(_0x4285('0x2'));var BPromise=require(_0x4285('0x3'));var rp=require(_0x4285('0x4'));var fs=require('fs');var path=require(_0x4285('0x5'));var rimraf=require(_0x4285('0x6'));var config=require('../../config/environment');var attributes=require(_0x4285('0x7'));module[_0x4285('0x8')]=function(_0x2bc655,_0x27bec5){return _0x2bc655['define'](_0x4285('0x9'),attributes,{'tableName':_0x4285('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0575=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies'];(function(_0x520bb5,_0x402af0){var _0x470ba5=function(_0x319fbe){while(--_0x319fbe){_0x520bb5['push'](_0x520bb5['shift']());}};_0x470ba5(++_0x402af0);}(_0x0575,0x150));var _0x5057=function(_0x206454,_0x3fa516){_0x206454=_0x206454-0x0;var _0x47040f=_0x0575[_0x206454];return _0x47040f;};'use strict';var _=require(_0x5057('0x0'));var util=require(_0x5057('0x1'));var logger=require(_0x5057('0x2'))(_0x5057('0x3'));var moment=require('moment');var BPromise=require(_0x5057('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5057('0x5'));var rimraf=require(_0x5057('0x6'));var config=require(_0x5057('0x7'));var attributes=require(_0x5057('0x8'));module['exports']=function(_0x11bae3,_0x5ed3be){return _0x11bae3[_0x5057('0x9')](_0x5057('0xa'),attributes,{'tableName':_0x5057('0xb'),'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 e7ae566..a3fb023 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 _0x7996=['code','message','info','result','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmCompany,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7996,0x1b9));var _0x6799=function(_0xe1b5f6,_0x210c09){_0xe1b5f6=_0xe1b5f6-0x0;var _0x44636e=_0x7996[_0xe1b5f6];return _0x44636e;};'use strict';var _=require('lodash');var util=require(_0x6799('0x0'));var moment=require(_0x6799('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6799('0x2'));var db=require(_0x6799('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6799('0x4'))(_0x6799('0x5'));var config=require(_0x6799('0x6'));var jayson=require(_0x6799('0x7'));var client=jayson[_0x6799('0x8')][_0x6799('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c2322,_0x5c5f36,_0x1a6c8a){return new BPromise(function(_0x4aa8ff,_0x16fd07){return client[_0x6799('0xa')](_0x1c2322,_0x1a6c8a)['then'](function(_0x2581b3){logger['info'](_0x6799('0xb'),_0x5c5f36,_0x6799('0xc'));logger[_0x6799('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x5c5f36,'request\x20sent',JSON['stringify'](_0x2581b3));if(_0x2581b3[_0x6799('0xe')]){if(_0x2581b3[_0x6799('0xe')][_0x6799('0xf')]===0x1f4){logger[_0x6799('0xe')]('CmCompany,\x20%s,\x20%s',_0x5c5f36,_0x2581b3[_0x6799('0xe')][_0x6799('0x10')]);return _0x16fd07(_0x2581b3[_0x6799('0xe')]['message']);}logger[_0x6799('0xe')](_0x6799('0xb'),_0x5c5f36,_0x2581b3['error'][_0x6799('0x10')]);return _0x4aa8ff(_0x2581b3[_0x6799('0xe')][_0x6799('0x10')]);}else{logger[_0x6799('0x11')]('CmCompany,\x20%s,\x20%s',_0x5c5f36,'request\x20sent');_0x4aa8ff(_0x2581b3[_0x6799('0x12')][_0x6799('0x10')]);}})['catch'](function(_0x5c486c){logger[_0x6799('0xe')](_0x6799('0xb'),_0x5c5f36,_0x5c486c);_0x16fd07(_0x5c486c);});});} \ No newline at end of file +var _0xa869=['error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1fe129,_0xaef8a1){var _0xf4d5d2=function(_0x444a03){while(--_0x444a03){_0x1fe129['push'](_0x1fe129['shift']());}};_0xf4d5d2(++_0xaef8a1);}(_0xa869,0x1a8));var _0x9a86=function(_0x56837e,_0x5c7fc3){_0x56837e=_0x56837e-0x0;var _0x3116f4=_0xa869[_0x56837e];return _0x3116f4;};'use strict';var _=require('lodash');var util=require(_0x9a86('0x0'));var moment=require(_0x9a86('0x1'));var BPromise=require('bluebird');var rs=require(_0x9a86('0x2'));var fs=require('fs');var Redis=require(_0x9a86('0x3'));var db=require(_0x9a86('0x4'))['db'];var utils=require(_0x9a86('0x5'));var logger=require(_0x9a86('0x6'))(_0x9a86('0x7'));var config=require(_0x9a86('0x8'));var jayson=require(_0x9a86('0x9'));var client=jayson[_0x9a86('0xa')][_0x9a86('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x364dc7,_0x15165d,_0x36cdaa){return new BPromise(function(_0x4f7f52,_0x334c03){return client['request'](_0x364dc7,_0x36cdaa)[_0x9a86('0xc')](function(_0x3595ee){logger[_0x9a86('0xd')](_0x9a86('0xe'),_0x15165d,_0x9a86('0xf'));logger[_0x9a86('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x15165d,_0x9a86('0xf'),JSON['stringify'](_0x3595ee));if(_0x3595ee[_0x9a86('0x11')]){if(_0x3595ee['error']['code']===0x1f4){logger[_0x9a86('0x11')]('CmCompany,\x20%s,\x20%s',_0x15165d,_0x3595ee[_0x9a86('0x11')][_0x9a86('0x12')]);return _0x334c03(_0x3595ee[_0x9a86('0x11')][_0x9a86('0x12')]);}logger[_0x9a86('0x11')](_0x9a86('0xe'),_0x15165d,_0x3595ee[_0x9a86('0x11')]['message']);return _0x4f7f52(_0x3595ee[_0x9a86('0x11')][_0x9a86('0x12')]);}else{logger['info'](_0x9a86('0xe'),_0x15165d,'request\x20sent');_0x4f7f52(_0x3595ee[_0x9a86('0x13')][_0x9a86('0x12')]);}})[_0x9a86('0x14')](function(_0xecfa04){logger[_0x9a86('0x11')](_0x9a86('0xe'),_0x15165d,_0xecfa04);_0x334c03(_0xecfa04);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 30eea81..1e7c7b3 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 _0x8090=['addContacts','put','delete','destroy','exports','util','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','getContacts','post','create'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8090,0x69));var _0x0809=function(_0x470291,_0x1ce9b4){_0x470291=_0x470291-0x0;var _0x398a4e=_0x8090[_0x470291];return _0x398a4e;};'use strict';var multer=require('multer');var util=require(_0x0809('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0809('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x0809('0x2'));var config=require(_0x0809('0x3'));var controller=require(_0x0809('0x4'));router[_0x0809('0x5')]('/',auth[_0x0809('0x6')](),controller[_0x0809('0x7')]);router[_0x0809('0x5')](_0x0809('0x8'),auth['isAuthenticated'](),controller[_0x0809('0x9')]);router[_0x0809('0x5')](_0x0809('0xa'),auth[_0x0809('0x6')](),controller['show']);router[_0x0809('0x5')](_0x0809('0xb'),auth['isAuthenticated'](),controller[_0x0809('0xc')]);router[_0x0809('0xd')]('/',auth[_0x0809('0x6')](),controller[_0x0809('0xe')]);router['post'](_0x0809('0xb'),auth[_0x0809('0x6')](),controller[_0x0809('0xf')]);router[_0x0809('0x10')](_0x0809('0xa'),auth[_0x0809('0x6')](),controller['update']);router[_0x0809('0x11')]('/:id',auth[_0x0809('0x6')](),controller[_0x0809('0x12')]);module[_0x0809('0x13')]=router; \ No newline at end of file +var _0xdea1=['get','isAuthenticated','index','/describe','/:id','/:id/contacts','getContacts','post','addContacts','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmCompany.controller'];(function(_0xc37b0,_0x18f118){var _0x42ae14=function(_0x3b32af){while(--_0x3b32af){_0xc37b0['push'](_0xc37b0['shift']());}};_0x42ae14(++_0x18f118);}(_0xdea1,0xdf));var _0x1dea=function(_0x2af520,_0x1ede95){_0x2af520=_0x2af520-0x0;var _0x2384ff=_0xdea1[_0x2af520];return _0x2384ff;};'use strict';var multer=require(_0x1dea('0x0'));var util=require('util');var path=require(_0x1dea('0x1'));var timeout=require(_0x1dea('0x2'));var express=require(_0x1dea('0x3'));var router=express[_0x1dea('0x4')]();var fs_extra=require(_0x1dea('0x5'));var auth=require(_0x1dea('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1dea('0x7'));router[_0x1dea('0x8')]('/',auth[_0x1dea('0x9')](),controller[_0x1dea('0xa')]);router[_0x1dea('0x8')](_0x1dea('0xb'),auth[_0x1dea('0x9')](),controller['describe']);router[_0x1dea('0x8')](_0x1dea('0xc'),auth[_0x1dea('0x9')](),controller['show']);router['get'](_0x1dea('0xd'),auth[_0x1dea('0x9')](),controller[_0x1dea('0xe')]);router['post']('/',auth[_0x1dea('0x9')](),controller['create']);router[_0x1dea('0xf')](_0x1dea('0xd'),auth[_0x1dea('0x9')](),controller[_0x1dea('0x10')]);router[_0x1dea('0x11')](_0x1dea('0xc'),auth[_0x1dea('0x9')](),controller[_0x1dea('0x12')]);router['delete'](_0x1dea('0xc'),auth['isAuthenticated'](),controller[_0x1dea('0x13')]);module[_0x1dea('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 c1f3a1d..b19853b 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 _0x0b0e=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x406861,_0x4907f3){var _0x1ef280=function(_0x41c46e){while(--_0x41c46e){_0x406861['push'](_0x406861['shift']());}};_0x1ef280(++_0x4907f3);}(_0x0b0e,0x187));var _0xe0b0=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0x0b0e[_0x47adb8];return _0x4689a8;};'use strict';var _=require(_0xe0b0('0x0'));var Sequelize=require('sequelize');module[_0xe0b0('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xe0b0('0x2')]},'street':{'type':Sequelize[_0xe0b0('0x2')]},'postalCode':{'type':Sequelize[_0xe0b0('0x2')]},'city':{'type':Sequelize[_0xe0b0('0x2')]},'country':{'type':Sequelize[_0xe0b0('0x2')]},'dateOfBirth':{'type':Sequelize[_0xe0b0('0x2')]},'description':{'type':Sequelize[_0xe0b0('0x3')]},'phone':{'type':Sequelize[_0xe0b0('0x2')]},'mobile':{'type':Sequelize[_0xe0b0('0x2')]},'fax':{'type':Sequelize[_0xe0b0('0x2')]},'email':{'type':Sequelize[_0xe0b0('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xe0b0('0x2')]},'twitter':{'type':Sequelize[_0xe0b0('0x2')]},'skype':{'type':Sequelize[_0xe0b0('0x2')]},'teams':{'type':Sequelize[_0xe0b0('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xe0b0('0x2')]},'wechat':{'type':Sequelize[_0xe0b0('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xe0b0('0x4')]},'priority':{'type':Sequelize[_0xe0b0('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':Sequelize[_0xe0b0('0x6')]},'dialTimezone':{'type':Sequelize[_0xe0b0('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2032=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','NOW'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x2032,0xd9));var _0x2203=function(_0x102fb9,_0x40af79){_0x102fb9=_0x102fb9-0x0;var _0x12cadf=_0x2032[_0x102fb9];return _0x12cadf;};'use strict';var _=require('lodash');var Sequelize=require(_0x2203('0x0'));module[_0x2203('0x1')]={'firstName':{'type':Sequelize[_0x2203('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x2203('0x2')]},'postalCode':{'type':Sequelize[_0x2203('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x2203('0x2')]},'dateOfBirth':{'type':Sequelize[_0x2203('0x2')]},'description':{'type':Sequelize[_0x2203('0x3')]},'phone':{'type':Sequelize[_0x2203('0x2')]},'mobile':{'type':Sequelize[_0x2203('0x2')]},'fax':{'type':Sequelize[_0x2203('0x2')]},'email':{'type':Sequelize[_0x2203('0x2')]},'url':{'type':Sequelize[_0x2203('0x2')]},'facebook':{'type':Sequelize[_0x2203('0x2')]},'fb_data':{'type':Sequelize[_0x2203('0x2')]},'twitter':{'type':Sequelize[_0x2203('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x2203('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x2203('0x2')]},'telegram':{'type':Sequelize[_0x2203('0x2')]},'UserId':{'type':Sequelize[_0x2203('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x2203('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x2203('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x2203('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 918b904..0186c38 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 _0x6aa7=['uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','join','root','file','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','upload','createReadStream','parse','meta','import','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','pid','getJourney','mail','openchannel','fax','whatsapp','voice','-createdAt','resolve','toLowerCase','range','isValid','source','destination','callerid','endtime','note','createdAt','userSecondDisposition','userThirdDisposition','UserId','User','fullname','VoiceCallReport','findAndCountAll','channel','chat','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','customerIp','ratingType','ratingValue','referer','subject','externalUrl','threadId','startCase','flatten','sortBy','reverse','slice','moment','bluebird','util','path','lodash','squel','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','register','status','offset','undefined','count','limit','set','update','then','end','error','stack','name','send','index','describe','keys','length','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','fieldType','query','attributes','intersection','model','fields','order','sort','where','filters','pick','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','cm_contact_has_tags','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','find','Tag','value','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','map','filter','isNil','Contact','isEmpty','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','isArray','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','QueryTypes','SELECT','clone','c.id','DESC','having','t.id\x20IN\x20?','user','agent','some','conditions','getLists','c.ListId\x20IS\x20NULL','role','ListId','toString','sequelize','keyBy','merge','CmContact','c.lastName','c.email','c.ListId','c.CompanyId','Tags','TagIds','destroy','params','columnName','analytics','findAll','displayName','alias','custom','type','hasOwnProperty','catch','body','get','mergeWith','tags','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','timezones','utcOffset','each','duplicates','spread','show','$and','omit','cf_%d','pickBy','format','id\x20=\x20?','toParam','text','values','phone','getTags','rawAttributes','options','nolimit','setTags','ids','ContactId','includeAll','rows','getHopperHistories','include','getHopperFinals'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x6aa7,0x165));var _0x76aa=function(_0x1ac05b,_0x1abbf6){_0x1ac05b=_0x1ac05b-0x0;var _0x23585c=_0x6aa7[_0x1ac05b];return _0x23585c;};'use strict';var moment=require(_0x76aa('0x0'));var BPromise=require(_0x76aa('0x1'));var util=require(_0x76aa('0x2'));var path=require(_0x76aa('0x3'));var fs=require('fs');var _=require(_0x76aa('0x4'));var squel=require(_0x76aa('0x5'));var Papa=require(_0x76aa('0x6'));var Redis=require('ioredis');var qs=require(_0x76aa('0x7'));var as=require(_0x76aa('0x8'));var logger=require(_0x76aa('0x9'))(_0x76aa('0xa'));var config=require('../../config/environment');var shared=require(_0x76aa('0xb'));var db=require(_0x76aa('0xc'))['db'];config['redis']=_['defaults'](config[_0x76aa('0xd')],{'host':_0x76aa('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmContact.socket')[_0x76aa('0xf')](socket);function respondWithResult(_0x491533,_0x1e7a91){_0x1e7a91=_0x1e7a91||0xc8;return function(_0x27cfb8){if(_0x27cfb8){return _0x491533[_0x76aa('0x10')](_0x1e7a91)['json'](_0x27cfb8);}};}function respondWithFilteredResult(_0x219537,_0x3841ae){return function(_0x3a2c42){if(_0x3a2c42){var _0x5bd2e1=typeof _0x3841ae[_0x76aa('0x11')]===_0x76aa('0x12')&&typeof _0x3841ae['limit']==='undefined';var _0x47254b=_0x3a2c42['count'];var _0x3d3827=_0x5bd2e1?0x0:_0x3841ae['offset'];var _0x23f4e1=_0x5bd2e1?_0x3a2c42[_0x76aa('0x13')]:_0x3841ae[_0x76aa('0x11')]+_0x3841ae[_0x76aa('0x14')];var _0x15fd7c;if(_0x23f4e1>=_0x47254b){_0x23f4e1=_0x47254b;_0x15fd7c=0xc8;}else{_0x15fd7c=0xce;}_0x219537['status'](_0x15fd7c);return _0x219537[_0x76aa('0x15')]('Content-Range',_0x3d3827+'-'+_0x23f4e1+'/'+_0x47254b)['json'](_0x3a2c42);}return null;};}function saveUpdates(_0x3a22ec){return function(_0xd35fb0){if(_0xd35fb0){return _0xd35fb0[_0x76aa('0x16')](_0x3a22ec)[_0x76aa('0x17')](function(_0x736a51){return _0x736a51;});}return null;};}function removeEntity(_0x5c7135){return function(_0x2a68e7){if(_0x2a68e7){return _0x2a68e7['destroy']()[_0x76aa('0x17')](function(){_0x5c7135[_0x76aa('0x10')](0xcc)[_0x76aa('0x18')]();});}};}function handleEntityNotFound(_0x2f0c9c){return function(_0x34f294){if(!_0x34f294){_0x2f0c9c['sendStatus'](0x194);}return _0x34f294;};}function handleError(_0x3e2844,_0x429b6f){_0x429b6f=_0x429b6f||0x1f4;return function(_0x2e2539){logger[_0x76aa('0x19')](_0x2e2539[_0x76aa('0x1a')]);if(_0x2e2539['name']){delete _0x2e2539[_0x76aa('0x1b')];}_0x3e2844[_0x76aa('0x10')](_0x429b6f)[_0x76aa('0x1c')](_0x2e2539);};}exports[_0x76aa('0x1d')]=function(_0x574207,_0x83611f){var _0x13b1e0={},_0x23df4d={},_0x304ec7={'count':0x0,'rows':[]};return db['CmContact'][_0x76aa('0x1e')]()[_0x76aa('0x17')](function(_0x472cd5){var _0x9b727e=[];for(var _0x539bfc=0x0;_0x539bfc0x1){_0x5becef['or'](_0x76aa('0x58'),qs[_0x76aa('0x59')](_0x20803a),null);}else{if(qs['isNumeric'](_0x20803a)){_0x5becef['or'](_0x76aa('0x5a'),_0x20803a+'%');_0x5becef['or'](_0x76aa('0x5b'),_0x20803a+'%');_0x5becef['or']('c.mobile\x20LIKE\x20?',_0x20803a+'%');_0x5becef['or'](_0x76aa('0x5c'),_0x20803a+'%');}else if(qs[_0x76aa('0x5d')](_0x20803a)){_0x5becef['or']('c.email\x20LIKE\x20?',_0x20803a+'%');}else{_0x5becef['or'](_0x76aa('0x5e'),'%'+_0x20803a+'%');_0x5becef['or'](_0x76aa('0x5f'),'%'+_0x20803a+'%');_0x5becef['or'](_0x76aa('0x60'),'%'+_0x20803a+'%');}}}}_0x2828b2[_0x76aa('0x30')](_0x5becef);_0x2828b2[_0x76aa('0x61')]('c.id');var _0x32d87a={'type':db['Sequelize'][_0x76aa('0x62')][_0x76aa('0x63')],'raw':!![]};var _0x5eec12=_0x2828b2[_0x76aa('0x64')]()[_0x76aa('0x34')](_0x76aa('0x65'));if(_0x13b1e0[_0x76aa('0x2e')]){_0x13b1e0[_0x76aa('0x2e')]['forEach'](function(_0x49f35f){_0x2828b2['order']('c.'+_0x49f35f[0x0],_0x49f35f[0x1]===_0x76aa('0x66')?![]:!![]);});}if(!_[_0x76aa('0x51')](_0x3065f3)){_0x2828b2[_0x76aa('0x67')](_0x32592e);_0x5eec12[_0x76aa('0x30')](_0x76aa('0x68'),_0x3065f3);}BPromise['resolve']()[_0x76aa('0x17')](function(){if(!_0x167885)return;if(_0x574207[_0x76aa('0x69')]['role']!==_0x76aa('0x6a'))return;if(!_[_0x76aa('0x6b')](_0x167885[_0x76aa('0x6c')],[_0x76aa('0x34'),'User'])){return _0x574207[_0x76aa('0x69')][_0x76aa('0x6d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x111580){if(_[_0x76aa('0x51')](_0x111580)){_0x5eec12[_0x76aa('0x30')](_0x76aa('0x6e'));_0x2828b2[_0x76aa('0x30')](_0x76aa('0x6e'));}else{_0x5eec12[_0x76aa('0x30')](_0x76aa('0x52'),_[_0x76aa('0x4d')](_0x111580,'id'));_0x2828b2[_0x76aa('0x30')](_0x76aa('0x52'),_[_0x76aa('0x4d')](_0x111580,'id'));}});}})[_0x76aa('0x17')](function(){if(_0x574207[_0x76aa('0x69')][_0x76aa('0x6f')]===_0x76aa('0x6a')&&!_0x167885&&!_0x574207[_0x76aa('0x29')][_0x76aa('0x70')])return[];return db['sequelize'][_0x76aa('0x29')](_0x5eec12[_0x76aa('0x71')](),_0x32d87a);})[_0x76aa('0x17')](function(_0x5b281f){_0x304ec7['count']=_0x5b281f[_0x76aa('0x20')];if(_0x304ec7[_0x76aa('0x13')]===0x0)return[];return db[_0x76aa('0x72')][_0x76aa('0x29')](_0x4aa4dd['toString'](),_0x32d87a)[_0x76aa('0x17')](function(_0x3aef33){_0x572b7d=_[_0x76aa('0x73')](_0x3aef33,'id');_0x32d87a=_[_0x76aa('0x74')](_0x32d87a,{'model':db[_0x76aa('0x75')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x574207[_0x76aa('0x29')][_0x76aa('0x2d')]){_0x13b1e0[_0x76aa('0x2a')][_0x76aa('0x45')](function(_0x25f5fb){_0x2828b2[_0x76aa('0x34')]('c.'+_0x25f5fb);});}else{_0x2828b2[_0x76aa('0x34')]('c.id');_0x2828b2['field']('c.firstName');_0x2828b2['field'](_0x76aa('0x76'));_0x2828b2[_0x76aa('0x34')]('c.phone');_0x2828b2[_0x76aa('0x34')]('c.mobile');_0x2828b2[_0x76aa('0x34')]('c.fax');_0x2828b2[_0x76aa('0x34')](_0x76aa('0x77'));_0x2828b2[_0x76aa('0x34')](_0x76aa('0x78'));_0x2828b2[_0x76aa('0x34')]('c.createdAt');_0x2828b2[_0x76aa('0x34')]('c.deletedAt');_0x2828b2[_0x76aa('0x34')](_0x76aa('0x79'));_0x2828b2[_0x76aa('0x34')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x13b1e0[_0x76aa('0x14')])_0x2828b2[_0x76aa('0x14')](_0x13b1e0['limit']);if(_0x13b1e0[_0x76aa('0x11')])_0x2828b2[_0x76aa('0x11')](_0x13b1e0[_0x76aa('0x11')]);return db[_0x76aa('0x72')][_0x76aa('0x29')](_0x2828b2[_0x76aa('0x71')](),_0x32d87a);});})[_0x76aa('0x17')](function(_0x4f678c){_0x4f678c[_0x76aa('0x45')](function(_0x54d8a3){if(_0x54d8a3['TagIds']){_0x54d8a3[_0x76aa('0x7a')]=[];_0x54d8a3[_0x76aa('0x7b')][_0x76aa('0x44')](',')[_0x76aa('0x45')](function(_0xcf7f8a){_0x54d8a3[_0x76aa('0x7a')][_0x76aa('0x23')](_0x572b7d[_0xcf7f8a]);});}delete _0x54d8a3['TagIds'];});_0x304ec7['rows']=_0x4f678c;return _0x304ec7;})[_0x76aa('0x17')](respondWithFilteredResult(_0x83611f,_0x13b1e0));})['catch'](handleError(_0x83611f,null));};exports[_0x76aa('0x7c')]=function(_0x25b077,_0x1e2817){return db[_0x76aa('0x75')][_0x76aa('0x41')]({'where':{'id':_0x25b077[_0x76aa('0x7d')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1e2817,null))[_0x76aa('0x17')](removeEntity(_0x1e2817,null))['catch'](handleError(_0x1e2817,null));};exports['describe']=function(_0x124965,_0x5dc239){return db[_0x76aa('0x75')]['describe']()[_0x76aa('0x17')](function(_0x4d8d91){delete _0x4d8d91['tags'];for(var _0x3cb4b4=0x0;_0x3cb4b4=_0x1bd23e){_0x1aaa04=_0x1bd23e;_0xcf86c1=0xc8;}else{_0xcf86c1=0xce;}_0x38e330[_0xd67e('0xf')](_0xcf86c1);return _0x38e330[_0xd67e('0x15')](_0xd67e('0x16'),_0xa935f0+'-'+_0x1aaa04+'/'+_0x1bd23e)[_0xd67e('0x10')](_0x51932f);}return null;};}function saveUpdates(_0x19c651){return function(_0x5de1f3){if(_0x5de1f3){return _0x5de1f3['update'](_0x19c651)[_0xd67e('0x17')](function(_0x382729){return _0x382729;});}return null;};}function removeEntity(_0x493f89){return function(_0x2e27ab){if(_0x2e27ab){return _0x2e27ab[_0xd67e('0x18')]()[_0xd67e('0x17')](function(){_0x493f89[_0xd67e('0xf')](0xcc)[_0xd67e('0x19')]();});}};}function handleEntityNotFound(_0x3fbe2b){return function(_0x5bcc83){if(!_0x5bcc83){_0x3fbe2b[_0xd67e('0x1a')](0x194);}return _0x5bcc83;};}function handleError(_0x54fa78,_0x4e7b2a){_0x4e7b2a=_0x4e7b2a||0x1f4;return function(_0x22e885){logger[_0xd67e('0x1b')](_0x22e885[_0xd67e('0x1c')]);if(_0x22e885[_0xd67e('0x1d')]){delete _0x22e885[_0xd67e('0x1d')];}_0x54fa78['status'](_0x4e7b2a)[_0xd67e('0x1e')](_0x22e885);};}exports[_0xd67e('0x1f')]=function(_0x1cbb61,_0x217553){var _0x2d762e={},_0x3bee99={},_0x55122c={'count':0x0,'rows':[]};return db['CmContact'][_0xd67e('0x20')]()[_0xd67e('0x17')](function(_0x56a344){var _0x57cb3=[];for(var _0x56c6b6=0x0;_0x56c6b60x1){_0x5f538b['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd67e('0x5e')](_0x2a2646),null);}else{if(qs[_0xd67e('0x5f')](_0x2a2646)){_0x5f538b['or']('c.id\x20LIKE\x20?',_0x2a2646+'%');_0x5f538b['or'](_0xd67e('0x60'),_0x2a2646+'%');_0x5f538b['or'](_0xd67e('0x61'),_0x2a2646+'%');_0x5f538b['or'](_0xd67e('0x62'),_0x2a2646+'%');}else if(qs[_0xd67e('0x63')](_0x2a2646)){_0x5f538b['or'](_0xd67e('0x64'),_0x2a2646+'%');}else{_0x5f538b['or'](_0xd67e('0x65'),'%'+_0x2a2646+'%');_0x5f538b['or'](_0xd67e('0x66'),'%'+_0x2a2646+'%');_0x5f538b['or'](_0xd67e('0x64'),'%'+_0x2a2646+'%');}}}}_0x1412ff['where'](_0x5f538b);_0x1412ff[_0xd67e('0x67')](_0xd67e('0x68'));var _0x26f276={'type':db[_0xd67e('0x69')][_0xd67e('0x6a')][_0xd67e('0x6b')],'raw':!![]};var _0x321ad0=_0x1412ff[_0xd67e('0x6c')]()['field'](_0xd67e('0x68'));if(_0x2d762e[_0xd67e('0x6d')]){_0x2d762e[_0xd67e('0x6d')][_0xd67e('0x49')](function(_0x34eec3){_0x1412ff['order']('c.'+_0x34eec3[0x0],_0x34eec3[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x4e80eb)){_0x1412ff[_0xd67e('0x6e')](_0x191664);_0x321ad0[_0xd67e('0x3e')](_0xd67e('0x6f'),_0x4e80eb);}BPromise[_0xd67e('0x70')]()['then'](function(){if(!_0xcbc4e1)return;if(_0x1cbb61[_0xd67e('0x71')][_0xd67e('0x72')]!=='agent')return;if(!_[_0xd67e('0x73')](_0xcbc4e1[_0xd67e('0x44')],[_0xd67e('0x35'),_0xd67e('0x4b')])){return _0x1cbb61[_0xd67e('0x71')][_0xd67e('0x74')]({'attributes':['id'],'raw':!![]})[_0xd67e('0x17')](function(_0x37161b){if(_[_0xd67e('0x75')](_0x37161b)){_0x321ad0[_0xd67e('0x3e')](_0xd67e('0x76'));_0x1412ff['where'](_0xd67e('0x76'));}else{_0x321ad0['where']('c.ListId\x20IN\x20?',_[_0xd67e('0x48')](_0x37161b,'id'));_0x1412ff[_0xd67e('0x3e')]('c.ListId\x20IN\x20?',_[_0xd67e('0x48')](_0x37161b,'id'));}});}})[_0xd67e('0x17')](function(){if(_0x1cbb61['user']['role']==='agent'&&!_0xcbc4e1&&!_0x1cbb61[_0xd67e('0x2b')][_0xd67e('0x77')])return[];return db[_0xd67e('0x78')][_0xd67e('0x2b')](_0x321ad0[_0xd67e('0x79')](),_0x26f276);})['then'](function(_0x40e7a5){_0x55122c[_0xd67e('0x13')]=_0x40e7a5[_0xd67e('0x21')];if(_0x55122c[_0xd67e('0x13')]===0x0)return[];return db['sequelize'][_0xd67e('0x2b')](_0x56f159['toString'](),_0x26f276)['then'](function(_0x23449b){_0x583485=_['keyBy'](_0x23449b,'id');_0x26f276=_[_0xd67e('0x7a')](_0x26f276,{'model':db[_0xd67e('0x7b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1cbb61[_0xd67e('0x2b')]['fields']){_0x2d762e['attributes'][_0xd67e('0x49')](function(_0x1083f6){_0x1412ff[_0xd67e('0x35')]('c.'+_0x1083f6);});}else{_0x1412ff['field'](_0xd67e('0x68'));_0x1412ff['field'](_0xd67e('0x7c'));_0x1412ff[_0xd67e('0x35')](_0xd67e('0x7d'));_0x1412ff[_0xd67e('0x35')](_0xd67e('0x7e'));_0x1412ff[_0xd67e('0x35')](_0xd67e('0x7f'));_0x1412ff['field'](_0xd67e('0x80'));_0x1412ff[_0xd67e('0x35')](_0xd67e('0x81'));_0x1412ff['field'](_0xd67e('0x82'));_0x1412ff[_0xd67e('0x35')](_0xd67e('0x83'));_0x1412ff['field'](_0xd67e('0x84'));_0x1412ff['field'](_0xd67e('0x85'));_0x1412ff[_0xd67e('0x35')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xd67e('0x86'));}if(_0x2d762e['limit'])_0x1412ff[_0xd67e('0x11')](_0x2d762e['limit']);if(_0x2d762e[_0xd67e('0x14')])_0x1412ff['offset'](_0x2d762e[_0xd67e('0x14')]);return db[_0xd67e('0x78')]['query'](_0x1412ff['toString'](),_0x26f276);});})[_0xd67e('0x17')](function(_0x2a2f0b){_0x2a2f0b[_0xd67e('0x49')](function(_0x1d5e49){if(_0x1d5e49[_0xd67e('0x86')]){_0x1d5e49[_0xd67e('0x87')]=[];_0x1d5e49[_0xd67e('0x86')]['split'](',')['forEach'](function(_0x5866bc){_0x1d5e49['Tags'][_0xd67e('0x56')](_0x583485[_0x5866bc]);});}delete _0x1d5e49[_0xd67e('0x86')];});_0x55122c['rows']=_0x2a2f0b;return _0x55122c;})['then'](respondWithFilteredResult(_0x217553,_0x2d762e));})[_0xd67e('0x88')](handleError(_0x217553,null));};exports[_0xd67e('0x18')]=function(_0x292e93,_0x32e370){return db[_0xd67e('0x7b')][_0xd67e('0x45')]({'where':{'id':_0x292e93['params']['id']}})[_0xd67e('0x17')](handleEntityNotFound(_0x32e370,null))[_0xd67e('0x17')](removeEntity(_0x32e370,null))[_0xd67e('0x88')](handleError(_0x32e370,null));};exports['describe']=function(_0x495c22,_0x31374d){return db[_0xd67e('0x7b')][_0xd67e('0x20')]()[_0xd67e('0x17')](function(_0x5c26b8){delete _0x5c26b8[_0xd67e('0x89')];for(var _0x476ea4=0x0;_0x476ea4{}\s\\|]/g,'-');_0x568de8(null,util[_0xa060('0x1d')](_0xa060('0x1e'),path['basename'](_0x50bf7b[_0xa060('0x1c')],path[_0xa060('0x1f')](_0x50bf7b[_0xa060('0x1c')])),Date[_0xa060('0x20')](),path[_0xa060('0x1f')](_0x50bf7b[_0xa060('0x1c')])));}})});router[_0xa060('0x15')](_0xa060('0x21'),upload[_0xa060('0x22')](_0xa060('0x23')),controller[_0xa060('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xeaa5af,_0xc2bdbd,_0x14b905){_0x14b905(null,path[_0xa060('0x25')](config['root'],'server/files/tmp'));},'filename':function(_0x28f14b,_0x99a702,_0x238e33){_0x99a702['originalname']=_0x99a702['originalname'][_0xa060('0x26')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x238e33(null,util['format']('%s-%s%s',path['basename'](_0x99a702[_0xa060('0x1c')],path[_0xa060('0x1f')](_0x99a702[_0xa060('0x1c')])),Date['now'](),path[_0xa060('0x1f')](_0x99a702[_0xa060('0x1c')])));}})});router[_0xa060('0x15')](_0xa060('0x27'),upload[_0xa060('0x22')](_0xa060('0x23')),controller['upload']);router[_0xa060('0x15')](_0xa060('0x28'),auth['isAuthenticated'](),controller['import']);router[_0xa060('0x29')](_0xa060('0xa'),auth[_0xa060('0x8')](),controller['update']);router[_0xa060('0x2a')](_0xa060('0xa'),auth[_0xa060('0x8')](),controller[_0xa060('0x2b')]);module[_0xa060('0x2c')]=router; \ No newline at end of file +var _0x8a5b=['root','server/files/tmp','originalname','%s-%s%s','basename','now','/csv','single','file','uploadCsv','replace','/upload','upload','/upload/:id','import','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getTags','/:id/hoppers','getHoppers','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','post','/merge','merge','bulkCreate','/:id/tags','diskStorage','join'];(function(_0x1a15fc,_0xb96b63){var _0x7c4e5e=function(_0x48eeab){while(--_0x48eeab){_0x1a15fc['push'](_0x1a15fc['shift']());}};_0x7c4e5e(++_0xb96b63);}(_0x8a5b,0x1dd));var _0xb8a5=function(_0x52c3d5,_0x153853){_0x52c3d5=_0x52c3d5-0x0;var _0x3ec72a=_0x8a5b[_0x52c3d5];return _0x3ec72a;};'use strict';var multer=require(_0xb8a5('0x0'));var util=require(_0xb8a5('0x1'));var path=require(_0xb8a5('0x2'));var timeout=require(_0xb8a5('0x3'));var express=require(_0xb8a5('0x4'));var router=express[_0xb8a5('0x5')]();var fs_extra=require(_0xb8a5('0x6'));var auth=require(_0xb8a5('0x7'));var interaction=require(_0xb8a5('0x8'));var config=require(_0xb8a5('0x9'));var controller=require(_0xb8a5('0xa'));router['get']('/',auth[_0xb8a5('0xb')](),controller[_0xb8a5('0xc')]);router[_0xb8a5('0xd')](_0xb8a5('0xe'),auth[_0xb8a5('0xb')](),controller[_0xb8a5('0xf')]);router[_0xb8a5('0xd')](_0xb8a5('0x10'),auth[_0xb8a5('0xb')](),controller[_0xb8a5('0x11')]);router['get']('/:id/tags',auth[_0xb8a5('0xb')](),controller[_0xb8a5('0x12')]);router[_0xb8a5('0xd')](_0xb8a5('0x13'),auth[_0xb8a5('0xb')](),controller[_0xb8a5('0x14')]);router[_0xb8a5('0xd')]('/:id/hopper_histories',auth[_0xb8a5('0xb')](),controller['getHopperHistories']);router[_0xb8a5('0xd')](_0xb8a5('0x15'),auth[_0xb8a5('0xb')](),controller[_0xb8a5('0x16')]);router[_0xb8a5('0xd')](_0xb8a5('0x17'),auth[_0xb8a5('0xb')](),controller[_0xb8a5('0x18')]);router[_0xb8a5('0xd')](_0xb8a5('0x19'),auth[_0xb8a5('0xb')](),controller['getJourney']);router[_0xb8a5('0x1a')](_0xb8a5('0x1b'),auth[_0xb8a5('0xb')](),controller[_0xb8a5('0x1c')]);router[_0xb8a5('0x1a')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb8a5('0x1a')]('/create_many',auth[_0xb8a5('0xb')](),controller[_0xb8a5('0x1d')]);router['post'](_0xb8a5('0x1e'),auth['isAuthenticated'](),controller['setTags']);var upload=multer({'storage':multer[_0xb8a5('0x1f')]({'destination':function(_0x37c516,_0x57b32c,_0x5171e8){_0x5171e8(null,path[_0xb8a5('0x20')](config[_0xb8a5('0x21')],_0xb8a5('0x22')));},'filename':function(_0x3e55ff,_0x5184a3,_0x32f21f){_0x5184a3[_0xb8a5('0x23')]=_0x5184a3[_0xb8a5('0x23')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x32f21f(null,util['format'](_0xb8a5('0x24'),path[_0xb8a5('0x25')](_0x5184a3['originalname'],path['extname'](_0x5184a3[_0xb8a5('0x23')])),Date[_0xb8a5('0x26')](),path['extname'](_0x5184a3[_0xb8a5('0x23')])));}})});router[_0xb8a5('0x1a')](_0xb8a5('0x27'),upload[_0xb8a5('0x28')](_0xb8a5('0x29')),controller[_0xb8a5('0x2a')]);var upload=multer({'storage':multer[_0xb8a5('0x1f')]({'destination':function(_0x2ce4d1,_0x43db12,_0x10b23a){_0x10b23a(null,path[_0xb8a5('0x20')](config[_0xb8a5('0x21')],_0xb8a5('0x22')));},'filename':function(_0x5aad1f,_0x3c6166,_0x52eb61){_0x3c6166[_0xb8a5('0x23')]=_0x3c6166['originalname'][_0xb8a5('0x2b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52eb61(null,util['format']('%s-%s%s',path[_0xb8a5('0x25')](_0x3c6166[_0xb8a5('0x23')],path['extname'](_0x3c6166[_0xb8a5('0x23')])),Date[_0xb8a5('0x26')](),path['extname'](_0x3c6166[_0xb8a5('0x23')])));}})});router[_0xb8a5('0x1a')](_0xb8a5('0x2c'),upload['single'](_0xb8a5('0x29')),controller[_0xb8a5('0x2d')]);router[_0xb8a5('0x1a')](_0xb8a5('0x2e'),auth[_0xb8a5('0xb')](),controller[_0xb8a5('0x2f')]);router[_0xb8a5('0x30')](_0xb8a5('0x10'),auth[_0xb8a5('0xb')](),controller['update']);router[_0xb8a5('0x31')]('/:id',auth[_0xb8a5('0xb')](),controller['destroy']);module[_0xb8a5('0x32')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index de29ff9..74ede73 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 _0xe10e=['select','parse','values','stringify','setDataValue','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','STRING','alias','getDataValue','name','long'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe10e,0xa1));var _0xee10=function(_0x2e9e7a,_0x5b939a){_0x2e9e7a=_0x2e9e7a-0x0;var _0x1608b0=_0xe10e[_0x2e9e7a];return _0x1608b0;};'use strict';var Sequelize=require(_0xee10('0x0'));var _=require(_0xee10('0x1'));module[_0xee10('0x2')]={'name':{'type':Sequelize[_0xee10('0x3')],'get':function(_0x1a0b35){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0xee10('0x4')],'allowNull':![],'set':function(_0x15fda6){this['setDataValue'](_0xee10('0x5'),_0x15fda6?_0x15fda6:this[_0xee10('0x6')](_0xee10('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xee10('0x8')),'get':function(){if(this[_0xee10('0x6')]('type')===_0xee10('0x9')){return JSON[_0xee10('0xa')](this[_0xee10('0x6')](_0xee10('0xb')));}else{return this[_0xee10('0x6')]('values');}},'set':function(_0x5529a7){if(Array['isArray'](_0x5529a7)){this['setDataValue']('values',JSON[_0xee10('0xc')](_0x5529a7));}else{this[_0xee10('0xd')]('values',_0x5529a7);}}},'required':{'type':Sequelize[_0xee10('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xee10('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xee10('0xf')](_0xee10('0x10'))}}; \ No newline at end of file +var _0x545c=['isArray','stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL','alias','STRING','setDataValue','getDataValue','TEXT','long','parse','values'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x545c,0x111));var _0xc545=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0x545c[_0x479160];return _0x47ac6d;};'use strict';var Sequelize=require(_0xc545('0x0'));var _=require(_0xc545('0x1'));module[_0xc545('0x2')]={'name':{'type':Sequelize[_0xc545('0x3')],'get':function(_0x3167ed){return this['getDataValue'](_0xc545('0x4'));}},'alias':{'type':Sequelize[_0xc545('0x5')],'allowNull':![],'set':function(_0x194516){this[_0xc545('0x6')](_0xc545('0x4'),_0x194516?_0x194516:this[_0xc545('0x7')]('name'));}},'type':{'type':Sequelize[_0xc545('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xc545('0x8')](_0xc545('0x9')),'get':function(){if(this[_0xc545('0x7')]('type')==='select'){return JSON[_0xc545('0xa')](this[_0xc545('0x7')]('values'));}else{return this[_0xc545('0x7')](_0xc545('0xb'));}},'set':function(_0x221155){if(Array[_0xc545('0xc')](_0x221155)){this[_0xc545('0x6')](_0xc545('0xb'),JSON[_0xc545('0xd')](_0x221155));}else{this[_0xc545('0x6')](_0xc545('0xb'),_0x221155);}}},'required':{'type':Sequelize[_0xc545('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index fc79dab..ea31be5 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 _0xe413=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json','update','then','destroy','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','options','find','body','params','create','sequelize','Sequelize','TEXT','INTEGER','BOOLEAN','addColumn','cm_contacts','format','rimraf'];(function(_0x40b66c,_0x578758){var _0x2fd22b=function(_0x3b721b){while(--_0x3b721b){_0x40b66c['push'](_0x40b66c['shift']());}};_0x2fd22b(++_0x578758);}(_0xe413,0xa3));var _0x3e41=function(_0x4328da,_0x50228a){_0x4328da=_0x4328da-0x0;var _0x2398f4=_0xe413[_0x4328da];return _0x2398f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e41('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e41('0x1'));var rp=require(_0x3e41('0x2'));var moment=require(_0x3e41('0x3'));var BPromise=require(_0x3e41('0x4'));var Mustache=require(_0x3e41('0x5'));var util=require(_0x3e41('0x6'));var path=require(_0x3e41('0x7'));var sox=require('sox');var csv=require(_0x3e41('0x8'));var ejs=require(_0x3e41('0x9'));var fs=require('fs');var fs_extra=require(_0x3e41('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3e41('0xb'));var jsforce=require(_0x3e41('0xc'));var deskjs=require(_0x3e41('0xd'));var toCsv=require(_0x3e41('0x8'));var querystring=require('querystring');var Papa=require(_0x3e41('0xe'));var Redis=require(_0x3e41('0xf'));var authService=require(_0x3e41('0x10'));var qs=require(_0x3e41('0x11'));var as=require(_0x3e41('0x12'));var hardwareService=require(_0x3e41('0x13'));var logger=require('../../config/logger')(_0x3e41('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3e41('0x15'));var db=require(_0x3e41('0x16'))['db'];function respondWithStatusCode(_0x44930e,_0x2154bb){_0x2154bb=_0x2154bb||0xcc;return function(_0x27fc37){if(_0x27fc37){return _0x44930e[_0x3e41('0x17')](_0x2154bb);}return _0x44930e[_0x3e41('0x18')](_0x2154bb)[_0x3e41('0x19')]();};}function respondWithResult(_0x1e5192,_0x2ff939){_0x2ff939=_0x2ff939||0xc8;return function(_0x47dc7f){if(_0x47dc7f){return _0x1e5192[_0x3e41('0x18')](_0x2ff939)['json'](_0x47dc7f);}};}function respondWithFilteredResult(_0x1c35b5,_0x3bac59){return function(_0x2696ac){if(_0x2696ac){var _0x1d628a=typeof _0x3bac59[_0x3e41('0x1a')]===_0x3e41('0x1b')&&typeof _0x3bac59['limit']===_0x3e41('0x1b');var _0x19b49c=_0x2696ac[_0x3e41('0x1c')];var _0x4cf6c1=_0x1d628a?0x0:_0x3bac59['offset'];var _0x5369e6=_0x1d628a?_0x2696ac[_0x3e41('0x1c')]:_0x3bac59['offset']+_0x3bac59['limit'];var _0x163043;if(_0x5369e6>=_0x19b49c){_0x5369e6=_0x19b49c;_0x163043=0xc8;}else{_0x163043=0xce;}_0x1c35b5['status'](_0x163043);return _0x1c35b5['set'](_0x3e41('0x1d'),_0x4cf6c1+'-'+_0x5369e6+'/'+_0x19b49c)[_0x3e41('0x1e')](_0x2696ac);}return null;};}function patchUpdates(_0x44b1ad){return function(_0x5c6d03){try{jsonpatch['apply'](_0x5c6d03,_0x44b1ad,!![]);}catch(_0x49071f){return BPromise['reject'](_0x49071f);}return _0x5c6d03['save']();};}function saveUpdates(_0x8d3d90,_0xdededb){return function(_0x35e895){if(_0x35e895){return _0x35e895[_0x3e41('0x1f')](_0x8d3d90)[_0x3e41('0x20')](function(_0x4fc260){return _0x4fc260;});}return null;};}function removeEntity(_0x2c85f9,_0x1ddda5){return function(_0x2a0199){if(_0x2a0199){return _0x2a0199[_0x3e41('0x21')]()[_0x3e41('0x20')](function(){_0x2c85f9[_0x3e41('0x18')](0xcc)[_0x3e41('0x19')]();});}};}function handleEntityNotFound(_0x32b78a,_0x147bc6){return function(_0x2ac22e){if(!_0x2ac22e){_0x32b78a['sendStatus'](0x194);}return _0x2ac22e;};}function handleError(_0x4dbebb,_0x29abcb){_0x29abcb=_0x29abcb||0x1f4;return function(_0x5ab930){logger['error'](_0x5ab930[_0x3e41('0x22')]);if(_0x5ab930[_0x3e41('0x23')]){delete _0x5ab930['name'];}_0x4dbebb[_0x3e41('0x18')](_0x29abcb)[_0x3e41('0x24')](_0x5ab930);};}exports[_0x3e41('0x25')]=function(_0x57934a,_0x298262){var _0x3f07f5={},_0x312c9b={},_0x304706={'count':0x0,'rows':[]};var _0x45f5fa=_[_0x3e41('0x26')](db[_0x3e41('0x27')][_0x3e41('0x28')],function(_0x531b9c){return{'name':_0x531b9c[_0x3e41('0x29')],'type':_0x531b9c[_0x3e41('0x2a')][_0x3e41('0x2b')]};});_0x312c9b['model']=_[_0x3e41('0x2c')](_[_0x3e41('0x26')](_0x45f5fa,_0x3e41('0x23')),[_0x3e41('0x23')]);_0x312c9b[_0x3e41('0x2d')]=_['keys'](_0x57934a[_0x3e41('0x2d')]);_0x312c9b[_0x3e41('0x2e')]=_['intersection'](_0x312c9b[_0x3e41('0x2f')],_0x312c9b['query']);_0x3f07f5[_0x3e41('0x30')]=_[_0x3e41('0x31')](_0x312c9b['model'],qs[_0x3e41('0x32')](_0x57934a[_0x3e41('0x2d')][_0x3e41('0x32')]));_0x3f07f5['attributes']=_0x3f07f5[_0x3e41('0x30')][_0x3e41('0x33')]?_0x3f07f5[_0x3e41('0x30')]:_0x312c9b[_0x3e41('0x2f')];if(!_0x57934a[_0x3e41('0x2d')][_0x3e41('0x34')](_0x3e41('0x35'))){_0x3f07f5[_0x3e41('0x36')]=qs[_0x3e41('0x36')](_0x57934a['query'][_0x3e41('0x36')]);_0x3f07f5[_0x3e41('0x1a')]=qs[_0x3e41('0x1a')](_0x57934a[_0x3e41('0x2d')][_0x3e41('0x1a')]);}_0x3f07f5[_0x3e41('0x37')]=qs[_0x3e41('0x38')](_0x57934a[_0x3e41('0x2d')][_0x3e41('0x38')]);_0x3f07f5[_0x3e41('0x39')]=qs[_0x3e41('0x2e')](_[_0x3e41('0x3a')](_0x57934a[_0x3e41('0x2d')],_0x312c9b['filters']),_0x45f5fa);if(_0x57934a[_0x3e41('0x2d')][_0x3e41('0x3b')]){_0x3f07f5['where']=_[_0x3e41('0x3c')](_0x3f07f5[_0x3e41('0x39')],{'$or':_[_0x3e41('0x26')](_0x45f5fa,function(_0x177dd9){if(_0x177dd9[_0x3e41('0x2a')]!==_0x3e41('0x3d')){var _0x575fa4={};_0x575fa4[_0x177dd9[_0x3e41('0x23')]]={'$like':'%'+_0x57934a[_0x3e41('0x2d')][_0x3e41('0x3b')]+'%'};return _0x575fa4;}})});}_0x3f07f5=_[_0x3e41('0x3c')]({},_0x3f07f5,_0x57934a['options']);var _0x1404cb={'where':_0x3f07f5[_0x3e41('0x39')]};return db[_0x3e41('0x27')]['count'](_0x1404cb)['then'](function(_0x3883a0){_0x304706['count']=_0x3883a0;if(_0x57934a['query'][_0x3e41('0x3e')]){_0x3f07f5[_0x3e41('0x3f')]=[{'all':!![]}];}return db['CmCustomField'][_0x3e41('0x40')](_0x3f07f5);})['then'](function(_0x597d24){_0x304706[_0x3e41('0x41')]=_0x597d24;return _0x304706;})[_0x3e41('0x20')](respondWithFilteredResult(_0x298262,_0x3f07f5))[_0x3e41('0x42')](handleError(_0x298262,null));};exports[_0x3e41('0x43')]=function(_0x37732b,_0x335b81){var _0x4286c5={'raw':!![],'where':{'id':_0x37732b['params']['id']}},_0x8f5c22={};_0x8f5c22[_0x3e41('0x2f')]=_[_0x3e41('0x44')](db['CmCustomField'][_0x3e41('0x28')]);_0x8f5c22[_0x3e41('0x2d')]=_[_0x3e41('0x44')](_0x37732b[_0x3e41('0x2d')]);_0x8f5c22[_0x3e41('0x2e')]=_[_0x3e41('0x31')](_0x8f5c22['model'],_0x8f5c22[_0x3e41('0x2d')]);_0x4286c5[_0x3e41('0x30')]=_[_0x3e41('0x31')](_0x8f5c22['model'],qs[_0x3e41('0x32')](_0x37732b[_0x3e41('0x2d')][_0x3e41('0x32')]));_0x4286c5[_0x3e41('0x30')]=_0x4286c5[_0x3e41('0x30')]['length']?_0x4286c5[_0x3e41('0x30')]:_0x8f5c22[_0x3e41('0x2f')];if(_0x37732b[_0x3e41('0x2d')]['includeAll']){_0x4286c5[_0x3e41('0x3f')]=[{'all':!![]}];}_0x4286c5=_['merge']({},_0x4286c5,_0x37732b[_0x3e41('0x45')]);return db[_0x3e41('0x27')][_0x3e41('0x46')](_0x4286c5)[_0x3e41('0x20')](handleEntityNotFound(_0x335b81,null))[_0x3e41('0x20')](respondWithResult(_0x335b81,null))['catch'](handleError(_0x335b81,null));};exports[_0x3e41('0x1f')]=function(_0x2e4616,_0x52dfed){if(_0x2e4616[_0x3e41('0x47')]['id']){delete _0x2e4616[_0x3e41('0x47')]['id'];}return db[_0x3e41('0x27')][_0x3e41('0x46')]({'where':{'id':_0x2e4616[_0x3e41('0x48')]['id']}})['then'](handleEntityNotFound(_0x52dfed,null))[_0x3e41('0x20')](saveUpdates(_0x2e4616[_0x3e41('0x47')],null))[_0x3e41('0x20')](respondWithResult(_0x52dfed,null))[_0x3e41('0x42')](handleError(_0x52dfed,null));};exports[_0x3e41('0x21')]=function(_0x1f5fb7,_0x2d6d58){return db['CmCustomField'][_0x3e41('0x46')]({'where':{'id':_0x1f5fb7['params']['id']}})[_0x3e41('0x20')](handleEntityNotFound(_0x2d6d58,null))['then'](removeEntity(_0x2d6d58,null))[_0x3e41('0x42')](handleError(_0x2d6d58,null));};exports[_0x3e41('0x49')]=function(_0x2ede9c,_0x60d5bc){var _0x32b93d;return db[_0x3e41('0x4a')]['transaction'](function(_0x1be9b0){return db['CmCustomField'][_0x3e41('0x49')](_0x2ede9c[_0x3e41('0x47')],{'transaction':_0x1be9b0})[_0x3e41('0x20')](function(_0x1f19e0){_0x32b93d=_0x1f19e0;var _0x301e78={'type':db[_0x3e41('0x4b')][_0x3e41('0x4c')],'transaction':_0x1be9b0};switch(_0x2ede9c[_0x3e41('0x47')][_0x3e41('0x2a')]){case'text':_0x301e78['type']=db['Sequelize'][_0x3e41('0x4c')];break;case'number':_0x301e78[_0x3e41('0x2a')]=db['Sequelize'][_0x3e41('0x4d')];break;case'switch':_0x301e78['type']=db['Sequelize'][_0x3e41('0x4e')];_0x301e78['defaultValue']=![];break;default:}return db[_0x3e41('0x4a')]['queryInterface'][_0x3e41('0x4f')](_0x3e41('0x50'),util[_0x3e41('0x51')]('cf_%d',_0x32b93d['id']),_0x301e78);})[_0x3e41('0x20')](function(){return _0x32b93d;});})[_0x3e41('0x20')](respondWithResult(_0x60d5bc,0xc9))[_0x3e41('0x42')](handleError(_0x60d5bc,null));}; \ No newline at end of file +var _0xe20b=['destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','CmCustomField','findAll','rows','show','keys','find','catch','update','body','params','create','sequelize','transaction','TEXT','text','Sequelize','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then'];(function(_0x2699d7,_0x41d731){var _0x350f71=function(_0x305c46){while(--_0x305c46){_0x2699d7['push'](_0x2699d7['shift']());}};_0x350f71(++_0x41d731);}(_0xe20b,0xe5));var _0xbe20=function(_0x5c93af,_0x13f5a6){_0x5c93af=_0x5c93af-0x0;var _0x37b17e=_0xe20b[_0x5c93af];return _0x37b17e;};'use strict';var emlformat=require(_0xbe20('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe20('0x1'));var rp=require('request-promise');var moment=require(_0xbe20('0x2'));var BPromise=require(_0xbe20('0x3'));var Mustache=require(_0xbe20('0x4'));var util=require(_0xbe20('0x5'));var path=require(_0xbe20('0x6'));var sox=require(_0xbe20('0x7'));var csv=require(_0xbe20('0x8'));var ejs=require(_0xbe20('0x9'));var fs=require('fs');var fs_extra=require(_0xbe20('0xa'));var _=require('lodash');var squel=require(_0xbe20('0xb'));var crypto=require('crypto');var jsforce=require(_0xbe20('0xc'));var deskjs=require(_0xbe20('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbe20('0xe'));var Papa=require(_0xbe20('0xf'));var Redis=require(_0xbe20('0x10'));var authService=require(_0xbe20('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbe20('0x12'));var hardwareService=require(_0xbe20('0x13'));var logger=require('../../config/logger')(_0xbe20('0x14'));var utils=require(_0xbe20('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbe20('0x16'))['db'];function respondWithStatusCode(_0x417bcd,_0x165259){_0x165259=_0x165259||0xcc;return function(_0x17d344){if(_0x17d344){return _0x417bcd[_0xbe20('0x17')](_0x165259);}return _0x417bcd[_0xbe20('0x18')](_0x165259)[_0xbe20('0x19')]();};}function respondWithResult(_0xcbcc06,_0x618c5){_0x618c5=_0x618c5||0xc8;return function(_0x16c2d8){if(_0x16c2d8){return _0xcbcc06[_0xbe20('0x18')](_0x618c5)[_0xbe20('0x1a')](_0x16c2d8);}};}function respondWithFilteredResult(_0x362aec,_0x1707be){return function(_0x2d983b){if(_0x2d983b){var _0x55dd2f=typeof _0x1707be[_0xbe20('0x1b')]===_0xbe20('0x1c')&&typeof _0x1707be[_0xbe20('0x1d')]===_0xbe20('0x1c');var _0x53b6db=_0x2d983b[_0xbe20('0x1e')];var _0x44f662=_0x55dd2f?0x0:_0x1707be[_0xbe20('0x1b')];var _0x22b80d=_0x55dd2f?_0x2d983b['count']:_0x1707be[_0xbe20('0x1b')]+_0x1707be[_0xbe20('0x1d')];var _0x495a97;if(_0x22b80d>=_0x53b6db){_0x22b80d=_0x53b6db;_0x495a97=0xc8;}else{_0x495a97=0xce;}_0x362aec['status'](_0x495a97);return _0x362aec[_0xbe20('0x1f')](_0xbe20('0x20'),_0x44f662+'-'+_0x22b80d+'/'+_0x53b6db)[_0xbe20('0x1a')](_0x2d983b);}return null;};}function patchUpdates(_0x113524){return function(_0x210a41){try{jsonpatch[_0xbe20('0x21')](_0x210a41,_0x113524,!![]);}catch(_0x22d3e2){return BPromise['reject'](_0x22d3e2);}return _0x210a41['save']();};}function saveUpdates(_0x61191f,_0x2d40c1){return function(_0x319b3e){if(_0x319b3e){return _0x319b3e['update'](_0x61191f)[_0xbe20('0x22')](function(_0x834ed5){return _0x834ed5;});}return null;};}function removeEntity(_0xa91d0e,_0x2958dc){return function(_0x428921){if(_0x428921){return _0x428921[_0xbe20('0x23')]()['then'](function(){_0xa91d0e[_0xbe20('0x18')](0xcc)[_0xbe20('0x19')]();});}};}function handleEntityNotFound(_0x29b5b3,_0x50bbf8){return function(_0x210af7){if(!_0x210af7){_0x29b5b3[_0xbe20('0x17')](0x194);}return _0x210af7;};}function handleError(_0x2e9495,_0x167e5e){_0x167e5e=_0x167e5e||0x1f4;return function(_0x28d3a9){logger[_0xbe20('0x24')](_0x28d3a9['stack']);if(_0x28d3a9[_0xbe20('0x25')]){delete _0x28d3a9[_0xbe20('0x25')];}_0x2e9495[_0xbe20('0x18')](_0x167e5e)[_0xbe20('0x26')](_0x28d3a9);};}exports[_0xbe20('0x27')]=function(_0x3ede90,_0x528183){var _0x947ef1={},_0x42ba5e={},_0x1dfe6d={'count':0x0,'rows':[]};var _0x5690f1=_[_0xbe20('0x28')](db['CmCustomField'][_0xbe20('0x29')],function(_0x16b4d8){return{'name':_0x16b4d8[_0xbe20('0x2a')],'type':_0x16b4d8[_0xbe20('0x2b')][_0xbe20('0x2c')]};});_0x42ba5e[_0xbe20('0x2d')]=_[_0xbe20('0x2e')](_[_0xbe20('0x28')](_0x5690f1,_0xbe20('0x25')),['name']);_0x42ba5e[_0xbe20('0x2f')]=_['keys'](_0x3ede90[_0xbe20('0x2f')]);_0x42ba5e[_0xbe20('0x30')]=_[_0xbe20('0x31')](_0x42ba5e[_0xbe20('0x2d')],_0x42ba5e[_0xbe20('0x2f')]);_0x947ef1['attributes']=_['intersection'](_0x42ba5e[_0xbe20('0x2d')],qs[_0xbe20('0x32')](_0x3ede90[_0xbe20('0x2f')][_0xbe20('0x32')]));_0x947ef1[_0xbe20('0x33')]=_0x947ef1[_0xbe20('0x33')][_0xbe20('0x34')]?_0x947ef1[_0xbe20('0x33')]:_0x42ba5e['model'];if(!_0x3ede90[_0xbe20('0x2f')][_0xbe20('0x35')](_0xbe20('0x36'))){_0x947ef1[_0xbe20('0x1d')]=qs['limit'](_0x3ede90['query'][_0xbe20('0x1d')]);_0x947ef1[_0xbe20('0x1b')]=qs[_0xbe20('0x1b')](_0x3ede90[_0xbe20('0x2f')][_0xbe20('0x1b')]);}_0x947ef1['order']=qs['sort'](_0x3ede90[_0xbe20('0x2f')][_0xbe20('0x37')]);_0x947ef1['where']=qs['filters'](_[_0xbe20('0x38')](_0x3ede90[_0xbe20('0x2f')],_0x42ba5e[_0xbe20('0x30')]),_0x5690f1);if(_0x3ede90[_0xbe20('0x2f')][_0xbe20('0x39')]){_0x947ef1[_0xbe20('0x3a')]=_[_0xbe20('0x3b')](_0x947ef1[_0xbe20('0x3a')],{'$or':_[_0xbe20('0x28')](_0x5690f1,function(_0x3d783b){if(_0x3d783b[_0xbe20('0x2b')]!==_0xbe20('0x3c')){var _0x3b6d0a={};_0x3b6d0a[_0x3d783b[_0xbe20('0x25')]]={'$like':'%'+_0x3ede90['query'][_0xbe20('0x39')]+'%'};return _0x3b6d0a;}})});}_0x947ef1=_[_0xbe20('0x3b')]({},_0x947ef1,_0x3ede90[_0xbe20('0x3d')]);var _0x2f7a72={'where':_0x947ef1[_0xbe20('0x3a')]};return db['CmCustomField'][_0xbe20('0x1e')](_0x2f7a72)[_0xbe20('0x22')](function(_0x261113){_0x1dfe6d['count']=_0x261113;if(_0x3ede90[_0xbe20('0x2f')][_0xbe20('0x3e')]){_0x947ef1[_0xbe20('0x3f')]=[{'all':!![]}];}return db[_0xbe20('0x40')][_0xbe20('0x41')](_0x947ef1);})[_0xbe20('0x22')](function(_0x421d9b){_0x1dfe6d[_0xbe20('0x42')]=_0x421d9b;return _0x1dfe6d;})[_0xbe20('0x22')](respondWithFilteredResult(_0x528183,_0x947ef1))['catch'](handleError(_0x528183,null));};exports[_0xbe20('0x43')]=function(_0x24348b,_0xb8a721){var _0x2186ac={'raw':!![],'where':{'id':_0x24348b['params']['id']}},_0x1ca7c8={};_0x1ca7c8[_0xbe20('0x2d')]=_[_0xbe20('0x44')](db['CmCustomField']['rawAttributes']);_0x1ca7c8['query']=_[_0xbe20('0x44')](_0x24348b[_0xbe20('0x2f')]);_0x1ca7c8[_0xbe20('0x30')]=_[_0xbe20('0x31')](_0x1ca7c8[_0xbe20('0x2d')],_0x1ca7c8[_0xbe20('0x2f')]);_0x2186ac['attributes']=_[_0xbe20('0x31')](_0x1ca7c8[_0xbe20('0x2d')],qs[_0xbe20('0x32')](_0x24348b[_0xbe20('0x2f')][_0xbe20('0x32')]));_0x2186ac[_0xbe20('0x33')]=_0x2186ac[_0xbe20('0x33')][_0xbe20('0x34')]?_0x2186ac[_0xbe20('0x33')]:_0x1ca7c8['model'];if(_0x24348b[_0xbe20('0x2f')]['includeAll']){_0x2186ac[_0xbe20('0x3f')]=[{'all':!![]}];}_0x2186ac=_[_0xbe20('0x3b')]({},_0x2186ac,_0x24348b[_0xbe20('0x3d')]);return db['CmCustomField'][_0xbe20('0x45')](_0x2186ac)[_0xbe20('0x22')](handleEntityNotFound(_0xb8a721,null))[_0xbe20('0x22')](respondWithResult(_0xb8a721,null))[_0xbe20('0x46')](handleError(_0xb8a721,null));};exports[_0xbe20('0x47')]=function(_0x491979,_0x4fca2f){if(_0x491979[_0xbe20('0x48')]['id']){delete _0x491979['body']['id'];}return db['CmCustomField'][_0xbe20('0x45')]({'where':{'id':_0x491979['params']['id']}})[_0xbe20('0x22')](handleEntityNotFound(_0x4fca2f,null))[_0xbe20('0x22')](saveUpdates(_0x491979[_0xbe20('0x48')],null))[_0xbe20('0x22')](respondWithResult(_0x4fca2f,null))['catch'](handleError(_0x4fca2f,null));};exports[_0xbe20('0x23')]=function(_0x547c55,_0xe63d6a){return db['CmCustomField'][_0xbe20('0x45')]({'where':{'id':_0x547c55[_0xbe20('0x49')]['id']}})['then'](handleEntityNotFound(_0xe63d6a,null))[_0xbe20('0x22')](removeEntity(_0xe63d6a,null))[_0xbe20('0x46')](handleError(_0xe63d6a,null));};exports[_0xbe20('0x4a')]=function(_0x4c0354,_0x1dc2df){var _0x17beb5;return db[_0xbe20('0x4b')][_0xbe20('0x4c')](function(_0x22df72){return db[_0xbe20('0x40')][_0xbe20('0x4a')](_0x4c0354[_0xbe20('0x48')],{'transaction':_0x22df72})[_0xbe20('0x22')](function(_0x486354){_0x17beb5=_0x486354;var _0x197428={'type':db['Sequelize'][_0xbe20('0x4d')],'transaction':_0x22df72};switch(_0x4c0354['body'][_0xbe20('0x2b')]){case _0xbe20('0x4e'):_0x197428['type']=db[_0xbe20('0x4f')]['TEXT'];break;case _0xbe20('0x50'):_0x197428[_0xbe20('0x2b')]=db[_0xbe20('0x4f')]['INTEGER'];break;case _0xbe20('0x51'):_0x197428[_0xbe20('0x2b')]=db['Sequelize'][_0xbe20('0x52')];_0x197428[_0xbe20('0x53')]=![];break;default:}return db[_0xbe20('0x4b')][_0xbe20('0x54')][_0xbe20('0x55')]('cm_contacts',util[_0xbe20('0x56')](_0xbe20('0x57'),_0x17beb5['id']),_0x197428);})['then'](function(){return _0x17beb5;});})['then'](respondWithResult(_0x1dc2df,0xc9))[_0xbe20('0x46')](handleError(_0x1dc2df,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 683b367..cb46878 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 _0x0ef4=['bluebird','request-promise','path','rimraf','define','CmCustomField','lodash','util','../../config/logger','moment'];(function(_0x14c402,_0x2ac8a4){var _0x31696c=function(_0x4a238f){while(--_0x4a238f){_0x14c402['push'](_0x14c402['shift']());}};_0x31696c(++_0x2ac8a4);}(_0x0ef4,0x1e6));var _0x40ef=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x0ef4[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x40ef('0x0'));var util=require(_0x40ef('0x1'));var logger=require(_0x40ef('0x2'))('api');var moment=require(_0x40ef('0x3'));var BPromise=require(_0x40ef('0x4'));var rp=require(_0x40ef('0x5'));var fs=require('fs');var path=require(_0x40ef('0x6'));var rimraf=require(_0x40ef('0x7'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x2d607b,_0x2a6fbf){return _0x2d607b[_0x40ef('0x8')](_0x40ef('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1f2=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','CmCustomField','cm_custom_fields'];(function(_0x513545,_0x158f2e){var _0x18b7c5=function(_0x58514c){while(--_0x58514c){_0x513545['push'](_0x513545['shift']());}};_0x18b7c5(++_0x158f2e);}(_0xd1f2,0x1ef));var _0x2d1f=function(_0x189369,_0x3e5002){_0x189369=_0x189369-0x0;var _0x3a0e6a=_0xd1f2[_0x189369];return _0x3a0e6a;};'use strict';var _=require(_0x2d1f('0x0'));var util=require(_0x2d1f('0x1'));var logger=require(_0x2d1f('0x2'))(_0x2d1f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d1f('0x4'));var fs=require('fs');var path=require(_0x2d1f('0x5'));var rimraf=require(_0x2d1f('0x6'));var config=require(_0x2d1f('0x7'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x5c1d6e,_0x34b33c){return _0x5c1d6e[_0x2d1f('0x8')](_0x2d1f('0x9'),attributes,{'tableName':_0x2d1f('0xa'),'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 7076ae0..fdc7e33 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 _0xece6=['client','http','then','info','request\x20sent','debug','stringify','error','code','message','CmCustomField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1ef218,_0x43c9ce){var _0x223211=function(_0x1f0b8a){while(--_0x1f0b8a){_0x1ef218['push'](_0x1ef218['shift']());}};_0x223211(++_0x43c9ce);}(_0xece6,0x141));var _0x6ece=function(_0x3dc2f1,_0xcdc605){_0x3dc2f1=_0x3dc2f1-0x0;var _0x5f2730=_0xece6[_0x3dc2f1];return _0x5f2730;};'use strict';var _=require(_0x6ece('0x0'));var util=require(_0x6ece('0x1'));var moment=require(_0x6ece('0x2'));var BPromise=require(_0x6ece('0x3'));var rs=require(_0x6ece('0x4'));var fs=require('fs');var Redis=require(_0x6ece('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ece('0x6'))('rpc');var config=require(_0x6ece('0x7'));var jayson=require(_0x6ece('0x8'));var client=jayson[_0x6ece('0x9')][_0x6ece('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ff65d,_0x4ed99e,_0x59b5e1){return new BPromise(function(_0x1e01e2,_0x315f67){return client['request'](_0x4ff65d,_0x59b5e1)[_0x6ece('0xb')](function(_0x2ba87b){logger[_0x6ece('0xc')]('CmCustomField,\x20%s,\x20%s',_0x4ed99e,_0x6ece('0xd'));logger[_0x6ece('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4ed99e,'request\x20sent',JSON[_0x6ece('0xf')](_0x2ba87b));if(_0x2ba87b[_0x6ece('0x10')]){if(_0x2ba87b[_0x6ece('0x10')][_0x6ece('0x11')]===0x1f4){logger[_0x6ece('0x10')]('CmCustomField,\x20%s,\x20%s',_0x4ed99e,_0x2ba87b['error']['message']);return _0x315f67(_0x2ba87b[_0x6ece('0x10')][_0x6ece('0x12')]);}logger['error'](_0x6ece('0x13'),_0x4ed99e,_0x2ba87b['error'][_0x6ece('0x12')]);return _0x1e01e2(_0x2ba87b[_0x6ece('0x10')][_0x6ece('0x12')]);}else{logger['info'](_0x6ece('0x13'),_0x4ed99e,'request\x20sent');_0x1e01e2(_0x2ba87b[_0x6ece('0x14')]['message']);}})[_0x6ece('0x15')](function(_0xd387a7){logger[_0x6ece('0x10')](_0x6ece('0x13'),_0x4ed99e,_0xd387a7);_0x315f67(_0xd387a7);});});} \ No newline at end of file +var _0x87da=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5d3882,_0x528ff0){var _0x20b576=function(_0x18d3d3){while(--_0x18d3d3){_0x5d3882['push'](_0x5d3882['shift']());}};_0x20b576(++_0x528ff0);}(_0x87da,0x1b8));var _0xa87d=function(_0x1a41df,_0x6ed1b4){_0x1a41df=_0x1a41df-0x0;var _0xe96b76=_0x87da[_0x1a41df];return _0xe96b76;};'use strict';var _=require(_0xa87d('0x0'));var util=require(_0xa87d('0x1'));var moment=require(_0xa87d('0x2'));var BPromise=require(_0xa87d('0x3'));var rs=require(_0xa87d('0x4'));var fs=require('fs');var Redis=require(_0xa87d('0x5'));var db=require(_0xa87d('0x6'))['db'];var utils=require(_0xa87d('0x7'));var logger=require('../../config/logger')(_0xa87d('0x8'));var config=require(_0xa87d('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe5bd79,_0x586167,_0x125df0){return new BPromise(function(_0x313d6a,_0x37dfae){return client[_0xa87d('0xa')](_0xe5bd79,_0x125df0)[_0xa87d('0xb')](function(_0x2188f3){logger[_0xa87d('0xc')](_0xa87d('0xd'),_0x586167,_0xa87d('0xe'));logger['debug'](_0xa87d('0xf'),_0x586167,_0xa87d('0xe'),JSON[_0xa87d('0x10')](_0x2188f3));if(_0x2188f3['error']){if(_0x2188f3[_0xa87d('0x11')][_0xa87d('0x12')]===0x1f4){logger[_0xa87d('0x11')](_0xa87d('0xd'),_0x586167,_0x2188f3['error']['message']);return _0x37dfae(_0x2188f3[_0xa87d('0x11')]['message']);}logger[_0xa87d('0x11')]('CmCustomField,\x20%s,\x20%s',_0x586167,_0x2188f3[_0xa87d('0x11')][_0xa87d('0x13')]);return _0x313d6a(_0x2188f3[_0xa87d('0x11')][_0xa87d('0x13')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x586167,_0xa87d('0xe'));_0x313d6a(_0x2188f3['result'][_0xa87d('0x13')]);}})['catch'](function(_0x82a14c){logger['error'](_0xa87d('0xd'),_0x586167,_0x82a14c);_0x37dfae(_0x82a14c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index bfe42eb..95b7a46 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 _0xf163=['isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0xc40324,_0xda7b84){var _0x1b3304=function(_0xc45034){while(--_0xc45034){_0xc40324['push'](_0xc40324['shift']());}};_0x1b3304(++_0xda7b84);}(_0xf163,0x129));var _0x3f16=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0xf163[_0x256d6a];return _0x460058;};'use strict';var multer=require(_0x3f16('0x0'));var util=require('util');var path=require(_0x3f16('0x1'));var timeout=require(_0x3f16('0x2'));var express=require(_0x3f16('0x3'));var router=express[_0x3f16('0x4')]();var fs_extra=require(_0x3f16('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3f16('0x6'));var config=require(_0x3f16('0x7'));var controller=require('./cmCustomField.controller');router[_0x3f16('0x8')]('/',auth[_0x3f16('0x9')](),controller[_0x3f16('0xa')]);router[_0x3f16('0x8')](_0x3f16('0xb'),auth[_0x3f16('0x9')](),controller[_0x3f16('0xc')]);router[_0x3f16('0xd')]('/',auth[_0x3f16('0x9')](),controller[_0x3f16('0xe')]);router['put'](_0x3f16('0xb'),auth[_0x3f16('0x9')](),controller[_0x3f16('0xf')]);router[_0x3f16('0x10')](_0x3f16('0xb'),auth[_0x3f16('0x9')](),controller['destroy']);module[_0x3f16('0x11')]=router; \ No newline at end of file +var _0xdbb3=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy'];(function(_0xe9b125,_0x2e5a76){var _0x389cfc=function(_0x112169){while(--_0x112169){_0xe9b125['push'](_0xe9b125['shift']());}};_0x389cfc(++_0x2e5a76);}(_0xdbb3,0x1c2));var _0x3dbb=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xdbb3[_0x18cd5b];return _0x5eaa52;};'use strict';var multer=require(_0x3dbb('0x0'));var util=require(_0x3dbb('0x1'));var path=require(_0x3dbb('0x2'));var timeout=require(_0x3dbb('0x3'));var express=require(_0x3dbb('0x4'));var router=express['Router']();var fs_extra=require(_0x3dbb('0x5'));var auth=require(_0x3dbb('0x6'));var interaction=require(_0x3dbb('0x7'));var config=require('../../config/environment');var controller=require(_0x3dbb('0x8'));router[_0x3dbb('0x9')]('/',auth[_0x3dbb('0xa')](),controller['index']);router[_0x3dbb('0x9')](_0x3dbb('0xb'),auth['isAuthenticated'](),controller[_0x3dbb('0xc')]);router['post']('/',auth[_0x3dbb('0xa')](),controller[_0x3dbb('0xd')]);router[_0x3dbb('0xe')](_0x3dbb('0xb'),auth['isAuthenticated'](),controller[_0x3dbb('0xf')]);router[_0x3dbb('0x10')](_0x3dbb('0xb'),auth[_0x3dbb('0xa')](),controller[_0x3dbb('0x11')]);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 d2a9b7d..72fbe88 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 _0x93e9=['format','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE'];(function(_0x17d8c6,_0x1766b1){var _0x9321e2=function(_0x5e3122){while(--_0x5e3122){_0x17d8c6['push'](_0x17d8c6['shift']());}};_0x9321e2(++_0x1766b1);}(_0x93e9,0xcc));var _0x993e=function(_0xe51ce7,_0x408994){_0xe51ce7=_0xe51ce7-0x0;var _0x2747e2=_0x93e9[_0xe51ce7];return _0x2747e2;};'use strict';var moment=require(_0x993e('0x0'));var Sequelize=require(_0x993e('0x1'));module[_0x993e('0x2')]={'phone':{'type':Sequelize[_0x993e('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x993e('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x993e('0x5')],'defaultValue':moment()[_0x993e('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x993e('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x993e('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x993e('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x993e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x993e('0x5')]},'priority':{'type':Sequelize[_0x993e('0x7')](0x2)[_0x993e('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x993e('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x993e('0x9')},'ListId':{'type':Sequelize[_0x993e('0x7')],'unique':_0x993e('0x9')},'UserId':{'type':Sequelize[_0x993e('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x993e('0x7')],'unique':_0x993e('0x9')},'CampaignId':{'type':Sequelize[_0x993e('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x993e('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x993e('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x993e('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x8952=['STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','sequelize','exports'];(function(_0x417d0c,_0x2a5217){var _0x513f1d=function(_0x13e918){while(--_0x13e918){_0x417d0c['push'](_0x417d0c['shift']());}};_0x513f1d(++_0x2a5217);}(_0x8952,0x17e));var _0x2895=function(_0x4d6112,_0x5e5533){_0x4d6112=_0x4d6112-0x0;var _0x594d06=_0x8952[_0x4d6112];return _0x594d06;};'use strict';var moment=require('moment');var Sequelize=require(_0x2895('0x0'));module[_0x2895('0x1')]={'phone':{'type':Sequelize[_0x2895('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x2895('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x2895('0x4')],'defaultValue':moment()['format'](_0x2895('0x5'))},'countbusyretry':{'type':Sequelize[_0x2895('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2895('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x2895('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2895('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2895('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x2895('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x2895('0x6')],'unique':_0x2895('0x7')},'ListId':{'type':Sequelize[_0x2895('0x6')],'unique':_0x2895('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x2895('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x2895('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2895('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2895('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x2895('0x2')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'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 37016b8..5cba854 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 _0xb068=['json','undefined','limit','count','offset','set','Content-Range','save','update','then','error','stack','name','send','map','CmHopper','rawAttributes','type','model','query','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$ne','$not','$between','$like','$notLike','$iLike','$overlap','$contains','$contained','attributes','fields','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','updatedAt','state','statedesc','deleted','campaign','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','firstName','isNil','lastName','calleridname','finally','CmHopperFinal','getPreview','keys','getVoiceQueues','preview','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','outbound','hopperId','findOne','LOCK','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','getTimezone','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status'];(function(_0x2d5953,_0x24d5d8){var _0x96c2ba=function(_0x4195c5){while(--_0x4195c5){_0x2d5953['push'](_0x2d5953['shift']());}};_0x96c2ba(++_0x24d5d8);}(_0xb068,0x119));var _0x8b06=function(_0x11e103,_0x354b81){_0x11e103=_0x11e103-0x0;var _0x19f392=_0xb068[_0x11e103];return _0x19f392;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b06('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b06('0x1'));var rp=require(_0x8b06('0x2'));var moment=require(_0x8b06('0x3'));var BPromise=require(_0x8b06('0x4'));var Mustache=require('mustache');var util=require(_0x8b06('0x5'));var path=require(_0x8b06('0x6'));var sox=require(_0x8b06('0x7'));var csv=require(_0x8b06('0x8'));var ejs=require(_0x8b06('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b06('0xa'));var squel=require(_0x8b06('0xb'));var crypto=require(_0x8b06('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8b06('0xd'));var toCsv=require(_0x8b06('0x8'));var querystring=require('querystring');var Papa=require(_0x8b06('0xe'));var Redis=require(_0x8b06('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8b06('0x10'));var as=require(_0x8b06('0x11'));var hardwareService=require(_0x8b06('0x12'));var logger=require(_0x8b06('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var shared=require(_0x8b06('0x14'));var licenseUtil=require(_0x8b06('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34f1a8,_0x278d45){_0x278d45=_0x278d45||0xcc;return function(_0x583ffb){if(_0x583ffb){return _0x34f1a8[_0x8b06('0x16')](_0x278d45);}return _0x34f1a8['status'](_0x278d45)[_0x8b06('0x17')]();};}function respondWithResult(_0x48fd2f,_0x1c10d6){_0x1c10d6=_0x1c10d6||0xc8;return function(_0x1c6b57){if(_0x1c6b57){return _0x48fd2f[_0x8b06('0x18')](_0x1c10d6)[_0x8b06('0x19')](_0x1c6b57);}};}function respondWithFilteredResult(_0x41f4f2,_0x3b9d61){return function(_0x4f10e2){if(_0x4f10e2){var _0x5e1976=typeof _0x3b9d61['offset']===_0x8b06('0x1a')&&typeof _0x3b9d61[_0x8b06('0x1b')]==='undefined';var _0x5cc8af=_0x4f10e2[_0x8b06('0x1c')];var _0x5bdca3=_0x5e1976?0x0:_0x3b9d61['offset'];var _0x132a81=_0x5e1976?_0x4f10e2[_0x8b06('0x1c')]:_0x3b9d61[_0x8b06('0x1d')]+_0x3b9d61[_0x8b06('0x1b')];var _0x5662bc;if(_0x132a81>=_0x5cc8af){_0x132a81=_0x5cc8af;_0x5662bc=0xc8;}else{_0x5662bc=0xce;}_0x41f4f2['status'](_0x5662bc);return _0x41f4f2[_0x8b06('0x1e')](_0x8b06('0x1f'),_0x5bdca3+'-'+_0x132a81+'/'+_0x5cc8af)[_0x8b06('0x19')](_0x4f10e2);}return null;};}function patchUpdates(_0xef21f1){return function(_0xaffaca){try{jsonpatch['apply'](_0xaffaca,_0xef21f1,!![]);}catch(_0xe9c1d2){return BPromise['reject'](_0xe9c1d2);}return _0xaffaca[_0x8b06('0x20')]();};}function saveUpdates(_0x416451,_0x5d99b6){return function(_0x3e9490){if(_0x3e9490){return _0x3e9490[_0x8b06('0x21')](_0x416451)[_0x8b06('0x22')](function(_0x505c6d){return _0x505c6d;});}return null;};}function removeEntity(_0xe40364,_0x43caef){return function(_0x51bc32){if(_0x51bc32){return _0x51bc32['destroy']()[_0x8b06('0x22')](function(){_0xe40364['status'](0xcc)[_0x8b06('0x17')]();});}};}function handleEntityNotFound(_0x41c454,_0x382585){return function(_0x3c9e55){if(!_0x3c9e55){_0x41c454[_0x8b06('0x16')](0x194);}return _0x3c9e55;};}function handleError(_0x2b45cb,_0x3ecb26){_0x3ecb26=_0x3ecb26||0x1f4;return function(_0x429e51){logger[_0x8b06('0x23')](_0x429e51[_0x8b06('0x24')]);if(_0x429e51[_0x8b06('0x25')]){delete _0x429e51[_0x8b06('0x25')];}_0x2b45cb[_0x8b06('0x18')](_0x3ecb26)[_0x8b06('0x26')](_0x429e51);};}exports['index']=function(_0xe55b69,_0x720eca){var _0xfba18c={},_0x1153d2={},_0x5f2fe8={'count':0x0,'rows':[]};var _0x5aecda=_[_0x8b06('0x27')](db[_0x8b06('0x28')][_0x8b06('0x29')],function(_0x3df737){return{'name':_0x3df737['fieldName'],'type':_0x3df737[_0x8b06('0x2a')]['key']};});_0x1153d2[_0x8b06('0x2b')]=_[_0x8b06('0x27')](_0x5aecda,_0x8b06('0x25'));_0x1153d2[_0x8b06('0x2c')]=_['keys'](_0xe55b69[_0x8b06('0x2c')]);_0x1153d2[_0x8b06('0x2d')]=_[_0x8b06('0x2e')](_0x1153d2['model'],_0x1153d2['query']);_0x1153d2[_0x8b06('0x2d')]=_[_0x8b06('0x2f')](_0x1153d2[_0x8b06('0x2d')],[_0x8b06('0x30'),_0x8b06('0x31'),_0x8b06('0x32'),_0x8b06('0x33'),_0x8b06('0x34'),'$lte',_0x8b06('0x35'),'$eq',_0x8b06('0x36'),_0x8b06('0x37'),'$notBetween','$in','$notIn',_0x8b06('0x38'),_0x8b06('0x39'),_0x8b06('0x3a'),'$notILike',_0x8b06('0x38'),_0x8b06('0x3b'),_0x8b06('0x3c'),_0x8b06('0x3d'),'$any']);_0xfba18c[_0x8b06('0x3e')]=_['intersection'](_0x1153d2[_0x8b06('0x2b')],qs[_0x8b06('0x3f')](_0xe55b69[_0x8b06('0x2c')][_0x8b06('0x3f')]));_0xfba18c[_0x8b06('0x3e')]=_0xfba18c[_0x8b06('0x3e')]['length']?_0xfba18c['attributes']:_0x1153d2[_0x8b06('0x2b')];if(!_0xe55b69[_0x8b06('0x2c')][_0x8b06('0x40')]('nolimit')){_0xfba18c[_0x8b06('0x1b')]=qs[_0x8b06('0x1b')](_0xe55b69[_0x8b06('0x2c')]['limit']);_0xfba18c[_0x8b06('0x1d')]=qs[_0x8b06('0x1d')](_0xe55b69[_0x8b06('0x2c')][_0x8b06('0x1d')]);}_0xfba18c[_0x8b06('0x41')]=qs['sort'](_0xe55b69[_0x8b06('0x2c')][_0x8b06('0x42')]);_0xfba18c['where']=qs[_0x8b06('0x2d')](_['pick'](_0xe55b69['query'],_0x1153d2[_0x8b06('0x2d')]),_0x5aecda);if(_0xe55b69[_0x8b06('0x2c')][_0x8b06('0x43')]){_0xfba18c['where']=_['merge'](_0xfba18c[_0x8b06('0x44')],{'$or':_['map'](_0x5aecda,function(_0x33d752){if(_0x33d752[_0x8b06('0x2a')]!==_0x8b06('0x45')){var _0x452f94={};_0x452f94[_0x33d752[_0x8b06('0x25')]]={'$like':'%'+_0xe55b69['query'][_0x8b06('0x43')]+'%'};return _0x452f94;}})});}_0xfba18c=_[_0x8b06('0x46')]({},_0xfba18c,_0xe55b69[_0x8b06('0x47')]);var _0x579821={'where':_0xfba18c[_0x8b06('0x44')]};return db[_0x8b06('0x28')][_0x8b06('0x1c')](_0x579821)[_0x8b06('0x22')](function(_0x29e9ec){_0x5f2fe8[_0x8b06('0x1c')]=_0x29e9ec;if(_0xe55b69['query'][_0x8b06('0x48')]){_0xfba18c[_0x8b06('0x49')]=[{'all':!![]}];}return db[_0x8b06('0x28')][_0x8b06('0x4a')](_0xfba18c);})['then'](function(_0x4af3ae){_0x5f2fe8[_0x8b06('0x4b')]=_0x4af3ae;return _0x5f2fe8;})[_0x8b06('0x22')](respondWithFilteredResult(_0x720eca,_0xfba18c))[_0x8b06('0x4c')](handleError(_0x720eca,null));};exports[_0x8b06('0x4d')]=function(_0x5a6627,_0x58413c){var _0x10c550={'raw':!![],'where':{'id':_0x5a6627[_0x8b06('0x4e')]['id']}},_0x2190dd={};_0x2190dd[_0x8b06('0x2b')]=_['keys'](db['CmHopper']['rawAttributes']);_0x2190dd[_0x8b06('0x2c')]=_['keys'](_0x5a6627[_0x8b06('0x2c')]);_0x2190dd['filters']=_[_0x8b06('0x2e')](_0x2190dd['model'],_0x2190dd[_0x8b06('0x2c')]);_0x10c550[_0x8b06('0x3e')]=_[_0x8b06('0x2e')](_0x2190dd[_0x8b06('0x2b')],qs[_0x8b06('0x3f')](_0x5a6627[_0x8b06('0x2c')]['fields']));_0x10c550[_0x8b06('0x3e')]=_0x10c550[_0x8b06('0x3e')][_0x8b06('0x4f')]?_0x10c550[_0x8b06('0x3e')]:_0x2190dd[_0x8b06('0x2b')];if(_0x5a6627['query'][_0x8b06('0x48')]){_0x10c550[_0x8b06('0x49')]=[{'all':!![]}];}_0x10c550=_[_0x8b06('0x46')]({},_0x10c550,_0x5a6627[_0x8b06('0x47')]);return db['CmHopper'][_0x8b06('0x50')](_0x10c550)[_0x8b06('0x22')](handleEntityNotFound(_0x58413c,null))[_0x8b06('0x22')](respondWithResult(_0x58413c,null))[_0x8b06('0x4c')](handleError(_0x58413c,null));};exports[_0x8b06('0x51')]=function(_0xe4dc4a,_0xf1b4c6){return db['CmHopper'][_0x8b06('0x51')](_0xe4dc4a[_0x8b06('0x52')],{})[_0x8b06('0x22')](respondWithResult(_0xf1b4c6,0xc9))[_0x8b06('0x4c')](handleError(_0xf1b4c6,null));};exports[_0x8b06('0x21')]=function(_0x1c1c84,_0x4ab078){if(_0x1c1c84[_0x8b06('0x52')]['id']){delete _0x1c1c84['body']['id'];}return db[_0x8b06('0x28')][_0x8b06('0x50')]({'where':{'id':_0x1c1c84[_0x8b06('0x4e')]['id']}})[_0x8b06('0x22')](handleEntityNotFound(_0x4ab078,null))[_0x8b06('0x22')](saveUpdates(_0x1c1c84[_0x8b06('0x52')],null))[_0x8b06('0x22')](respondWithResult(_0x4ab078,null))[_0x8b06('0x4c')](handleError(_0x4ab078,null));};exports[_0x8b06('0x53')]=function(_0x4cb960,_0x354b6e){return db[_0x8b06('0x28')][_0x8b06('0x53')]()[_0x8b06('0x22')](respondWithResult(_0x354b6e,null))[_0x8b06('0x4c')](handleError(_0x354b6e,null));};exports[_0x8b06('0x54')]=function(_0x209431,_0x306e89){var _0x33b760;return db['CmHopper']['find']({'where':{'id':_0x209431[_0x8b06('0x4e')]['id']}})[_0x8b06('0x22')](handleEntityNotFound(_0x306e89,null))[_0x8b06('0x22')](function(_0x484269){if(_0x484269){return _0x484269[_0x8b06('0x54')]()[_0x8b06('0x22')](function(_0x450be3){return _0x450be3;});}})[_0x8b06('0x22')](function(_0x14afd2){_0x33b760=_0x14afd2;if(_0x14afd2){if(_0x14afd2[_0x8b06('0x55')]||_0x14afd2[_0x8b06('0x56')]){return db[_0x14afd2[_0x8b06('0x55')]?_0x8b06('0x57'):'Campaign']['find']({'where':{'id':_0x14afd2['VoiceQueueId']?_0x14afd2[_0x8b06('0x55')]:_0x14afd2[_0x8b06('0x56')]},'attributes':['id',_0x8b06('0x25')],'raw':!![]});}}})[_0x8b06('0x22')](function(_0x2579af){var _0x28ec3b={};if(_0x2579af){_['merge'](_0x28ec3b,_[_0x8b06('0x58')](_0x33b760[_0x8b06('0x59')],['createdAt',_0x8b06('0x5a'),'id']));_0x28ec3b[_0x8b06('0x5b')]=0x15;_0x28ec3b[_0x8b06('0x5c')]=_0x8b06('0x5d');_0x28ec3b[_0x8b06('0x5e')]=_0x2579af['name'];_0x28ec3b[_0x8b06('0x5f')]=_0x209431['user']['name'];_0x28ec3b[_0x8b06('0x60')]=_0x209431[_0x8b06('0x61')]['id'];_0x28ec3b[_0x8b06('0x5d')]=!![];_0x28ec3b[_0x8b06('0x62')]=moment()[_0x8b06('0x63')](_0x8b06('0x64'));_0x28ec3b[_0x8b06('0x65')]=_0x33b760[_0x8b06('0x66')];_0x28ec3b[_0x8b06('0x67')]=_0x33b760[_0x8b06('0x55')]?'queue':_0x8b06('0x68');return db[_0x8b06('0x69')][_0x8b06('0x50')]({'where':{'id':_0x28ec3b[_0x8b06('0x6a')]},'attributes':[_0x8b06('0x6b'),'lastName']})[_0x8b06('0x22')](function(_0x34952f){if(!_[_0x8b06('0x6c')](_0x306e89)&&!_[_0x8b06('0x6c')](_0x34952f[_0x8b06('0x6b')])){_0x28ec3b['calleridname']=_0x34952f[_0x8b06('0x6b')];if(!_['isNil'](_0x34952f[_0x8b06('0x6d')])){_0x28ec3b[_0x8b06('0x6e')]+='\x20'+_0x34952f['lastName'];}}})[_0x8b06('0x6f')](function(){return db[_0x8b06('0x70')][_0x8b06('0x51')](_0x28ec3b);});}})[_0x8b06('0x22')](function(){return _0x306e89[_0x8b06('0x18')](0xcc)[_0x8b06('0x17')]();})['catch'](handleError(_0x306e89,null));};exports[_0x8b06('0x71')]=function(_0x54b8a5,_0xbfd833,_0x58e252){var _0x472250=[];return db[_0x8b06('0x69')][_0x8b06('0x53')]()[_0x8b06('0x22')](function(_0x26cba3){_0x472250=_[_0x8b06('0x72')](_0x26cba3);return _0x54b8a5[_0x8b06('0x61')][_0x8b06('0x73')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x8b06('0x74')},'attributes':['id','dialOrderByScheduledAt',_0x8b06('0x75')],'raw':!![]});})[_0x8b06('0x22')](function(_0x47a34c){if(_0x47a34c&&_0x47a34c[_0x8b06('0x4f')]){return db[_0x8b06('0x76')][_0x8b06('0x77')](function(_0x4d7de3){var _0x5c5cc2={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8b06('0x63')](_0x8b06('0x64'))},'VoiceQueueId':{'$in':_[_0x8b06('0x27')](_0x47a34c,'id')},'$or':[{'UserId':null},{'UserId':_0x54b8a5[_0x8b06('0x61')]['id']}]};var _0x369b8e={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x47a34c)[_0x8b06('0x43')]([_0x8b06('0x75'),0x0])[_0x8b06('0x27')]('id')[_0x8b06('0x78')]()},'$or':[{'UserId':null},{'UserId':_0x54b8a5[_0x8b06('0x61')]['id']}]};var _0x43ce23={'$or':[_0x5c5cc2,_0x369b8e]};var _0x480b0e=[];if(_0x54b8a5[_0x8b06('0x52')]['direction']&&_0x54b8a5[_0x8b06('0x52')][_0x8b06('0x79')]===_0x8b06('0x7a')){if(!_['isEmpty'](_0x54b8a5['body'][_0x8b06('0x7b')])){_0x43ce23['id']={'$in':_0x54b8a5[_0x8b06('0x52')][_0x8b06('0x7b')]};}_0x480b0e=[[_0x8b06('0x7c'),_0x8b06('0x7d')],[_0x8b06('0x7e'),_0x47a34c[0x0][_0x8b06('0x7f')]===_0x8b06('0x7d')?_0x8b06('0x80'):_0x8b06('0x7d')],db[_0x8b06('0x76')][_0x8b06('0x81')](_0x8b06('0x82')),['id','DESC']];}else{if(!_[_0x8b06('0x83')](_0x54b8a5[_0x8b06('0x52')][_0x8b06('0x7b')])){_0x43ce23['id']={'$notIn':_0x54b8a5['body'][_0x8b06('0x7b')]};}_0x480b0e=[[_0x8b06('0x7c'),_0x8b06('0x80')],['scheduledAt',_0x47a34c[0x0][_0x8b06('0x7f')]],db['sequelize'][_0x8b06('0x81')](_0x8b06('0x84')),['id',_0x8b06('0x7d')]];}return db[_0x8b06('0x28')]['findOne']({'attributes':['id',_0x8b06('0x85'),_0x8b06('0x86')],'where':_0x43ce23,'order':_0x480b0e,'transaction':_0x4d7de3,'lock':_0x4d7de3['LOCK'][_0x8b06('0x87')],'include':[{'model':db['CmContact'],'as':_0x8b06('0x88'),'attributes':_0x472250,'include':[{'model':db[_0x8b06('0x89')],'as':_0x8b06('0x8a'),'attributes':['id',_0x8b06('0x25')]}]},{'model':db[_0x8b06('0x8b')],'as':_0x8b06('0x8c'),'attributes':['id','name']},{'model':db[_0x8b06('0x57')],'as':_0x8b06('0x8d'),'attributes':['id',_0x8b06('0x25'),_0x8b06('0x8e')]}]})[_0x8b06('0x22')](function(_0x5e5b91){if(_0x5e5b91){return _0x5e5b91[_0x8b06('0x21')]({'UserId':_0x54b8a5[_0x8b06('0x61')]['id']},{'transaction':_0x4d7de3});}});});}})[_0x8b06('0x22')](handleEntityNotFound(_0xbfd833,null))['then'](respondWithResult(_0xbfd833,null))['catch'](handleError(_0xbfd833,null));};exports[_0x8b06('0x8f')]=function(_0x2fe514,_0xef0c7,_0x1e4cb4){var _0x1ae8e3=[];return db[_0x8b06('0x69')]['describe']()[_0x8b06('0x22')](function(_0x2b0402){_0x1ae8e3=_[_0x8b06('0x72')](_0x2b0402);return _0x2fe514[_0x8b06('0x61')][_0x8b06('0x73')]({'where':{'type':_0x8b06('0x90'),'dialActive':!![],'dialMethod':_0x8b06('0x74')},'attributes':['id',_0x8b06('0x7f'),_0x8b06('0x75')],'raw':!![]});})[_0x8b06('0x22')](function(_0x10c5e2){if(_0x10c5e2&&_0x10c5e2[_0x8b06('0x4f')]){return db[_0x8b06('0x76')][_0x8b06('0x77')](function(_0x42d76){var _0x4180e5={'active':![],'recallme':!![],'id':_0x2fe514[_0x8b06('0x52')][_0x8b06('0x91')]};return db[_0x8b06('0x28')][_0x8b06('0x92')]({'attributes':['id','scheduledat','recallme'],'where':_0x4180e5,'transaction':_0x42d76,'lock':_0x42d76[_0x8b06('0x93')][_0x8b06('0x87')],'include':[{'model':db[_0x8b06('0x69')],'as':_0x8b06('0x88'),'attributes':_0x1ae8e3,'include':[{'model':db['CmCompany'],'as':_0x8b06('0x8a'),'attributes':['id',_0x8b06('0x25')]}]},{'model':db[_0x8b06('0x8b')],'as':_0x8b06('0x8c'),'attributes':['id',_0x8b06('0x25')]},{'model':db[_0x8b06('0x57')],'as':'Queue','attributes':['id',_0x8b06('0x25'),_0x8b06('0x8e')]}]})[_0x8b06('0x22')](function(_0x1db419){if(_0x1db419){return _0x1db419[_0x8b06('0x21')]({'UserId':_0x2fe514['user']['id']},{'transaction':_0x42d76});}});});}})[_0x8b06('0x22')](handleEntityNotFound(_0xef0c7,null))[_0x8b06('0x22')](respondWithResult(_0xef0c7,null))['catch'](handleError(_0xef0c7,null));};exports[_0x8b06('0x94')]=function(_0x371eca,_0x3b88ab,_0x2f1e1b){return _0x371eca[_0x8b06('0x61')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x8b06('0x74')},'attributes':['id'],'raw':!![]})[_0x8b06('0x22')](function(_0x212344){if(_0x212344&&_0x212344[_0x8b06('0x4f')]){return db[_0x8b06('0x28')][_0x8b06('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8b06('0x63')](_0x8b06('0x64'))},'VoiceQueueId':{'$in':_[_0x8b06('0x27')](_0x212344,'id')},'$or':[{'UserId':null},{'UserId':_0x371eca[_0x8b06('0x61')]['id']}]}});}return 0x0;})['then'](function(_0x32bbfc){if(!_['isNil'](_0x32bbfc)&&_['isNumber'](_0x32bbfc)){return _0x3b88ab[_0x8b06('0x18')](0xc8)[_0x8b06('0x19')]({'contacts':_0x32bbfc});}else{logger['error'](_0x8b06('0x95'),_0x8b06('0x94'),0x194,'entity\x20not\x20found');_0x3b88ab['sendStatus'](0x194);}})[_0x8b06('0x4c')](handleError(_0x3b88ab,null));};exports[_0x8b06('0x96')]=function(_0xc9e5b7,_0x1d7565,_0x40ae6c){var _0xb6f639=shared[_0x8b06('0x97')];var _0x2cd930=[];_[_0x8b06('0x27')](_0xb6f639,function(_0x1241d5){_0x2cd930['push']({'id':_0x1241d5[_0x8b06('0x25')],'name':_0x1241d5[_0x8b06('0x25')],'utcOffset':_0x1241d5['utcOffset']});});return _0x1d7565[_0x8b06('0x18')](0xc8)[_0x8b06('0x19')]({'tz':_0x2cd930});};exports[_0x8b06('0x98')]=function(_0x3f83ef,_0x55fc5b,_0x40b32b){var _0xac6b61=shared[_0x8b06('0x97')];var _0x3adcc8={};if(!_[_0x8b06('0x6c')](_0xac6b61[_0x3f83ef[_0x8b06('0x52')]['id']]))_0x3adcc8=_0xac6b61[_0x3f83ef['body']['id']];return _0x55fc5b['status'](0xc8)[_0x8b06('0x19')](_0x3adcc8);}; \ No newline at end of file +var _0xef8e=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','apply','save','then','destroy','stack','name','send','index','map','CmHopper','rawAttributes','key','model','keys','query','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','params','includeAll','find','create','body','update','describe','VoiceQueueId','Campaign','updatedAt','state','statedesc','deleted','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmContact','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','direction','isEmpty','hopperIds','priority','dialOrderByScheduledAt','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','recallme','LOCK','UPDATE','Contact','CmList','List','Queue','dialActive','hopperId','findOne','scheduledat','CmCompany','Company','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','utcOffset','getTimezone','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x5f0f7a,_0x244c53){var _0x8742e7=function(_0x48ff6e){while(--_0x48ff6e){_0x5f0f7a['push'](_0x5f0f7a['shift']());}};_0x8742e7(++_0x244c53);}(_0xef8e,0x8c));var _0xeef8=function(_0x3d00d6,_0x5d7797){_0x3d00d6=_0x3d00d6-0x0;var _0xf8b0a6=_0xef8e[_0x3d00d6];return _0xf8b0a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeef8('0x0'));var zipdir=require(_0xeef8('0x1'));var jsonpatch=require(_0xeef8('0x2'));var rp=require('request-promise');var moment=require(_0xeef8('0x3'));var BPromise=require(_0xeef8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeef8('0x5'));var sox=require(_0xeef8('0x6'));var csv=require(_0xeef8('0x7'));var ejs=require(_0xeef8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeef8('0x9'));var squel=require('squel');var crypto=require(_0xeef8('0xa'));var jsforce=require(_0xeef8('0xb'));var deskjs=require(_0xeef8('0xc'));var toCsv=require(_0xeef8('0x7'));var querystring=require(_0xeef8('0xd'));var Papa=require(_0xeef8('0xe'));var Redis=require(_0xeef8('0xf'));var authService=require(_0xeef8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xeef8('0x11'));var hardwareService=require(_0xeef8('0x12'));var logger=require(_0xeef8('0x13'))('api');var utils=require(_0xeef8('0x14'));var config=require(_0xeef8('0x15'));var shared=require(_0xeef8('0x15'));var licenseUtil=require(_0xeef8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58ff87,_0x48407b){_0x48407b=_0x48407b||0xcc;return function(_0x100540){if(_0x100540){return _0x58ff87[_0xeef8('0x17')](_0x48407b);}return _0x58ff87[_0xeef8('0x18')](_0x48407b)[_0xeef8('0x19')]();};}function respondWithResult(_0x74344f,_0x34f8de){_0x34f8de=_0x34f8de||0xc8;return function(_0xd9cc9f){if(_0xd9cc9f){return _0x74344f[_0xeef8('0x18')](_0x34f8de)[_0xeef8('0x1a')](_0xd9cc9f);}};}function respondWithFilteredResult(_0x40c74e,_0x29f1bb){return function(_0x226d92){if(_0x226d92){var _0x1a68fc=typeof _0x29f1bb['offset']==='undefined'&&typeof _0x29f1bb[_0xeef8('0x1b')]===_0xeef8('0x1c');var _0x52d611=_0x226d92[_0xeef8('0x1d')];var _0x5885f7=_0x1a68fc?0x0:_0x29f1bb['offset'];var _0x2459d7=_0x1a68fc?_0x226d92[_0xeef8('0x1d')]:_0x29f1bb['offset']+_0x29f1bb[_0xeef8('0x1b')];var _0x3c60fc;if(_0x2459d7>=_0x52d611){_0x2459d7=_0x52d611;_0x3c60fc=0xc8;}else{_0x3c60fc=0xce;}_0x40c74e['status'](_0x3c60fc);return _0x40c74e[_0xeef8('0x1e')](_0xeef8('0x1f'),_0x5885f7+'-'+_0x2459d7+'/'+_0x52d611)[_0xeef8('0x1a')](_0x226d92);}return null;};}function patchUpdates(_0x28e64a){return function(_0x2f55c7){try{jsonpatch[_0xeef8('0x20')](_0x2f55c7,_0x28e64a,!![]);}catch(_0x2614c4){return BPromise['reject'](_0x2614c4);}return _0x2f55c7[_0xeef8('0x21')]();};}function saveUpdates(_0xbc915e,_0x554629){return function(_0x3dde37){if(_0x3dde37){return _0x3dde37['update'](_0xbc915e)[_0xeef8('0x22')](function(_0x5f165){return _0x5f165;});}return null;};}function removeEntity(_0x1806b1,_0x2095e4){return function(_0x49d18e){if(_0x49d18e){return _0x49d18e[_0xeef8('0x23')]()[_0xeef8('0x22')](function(){_0x1806b1[_0xeef8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33c661,_0x130d93){return function(_0x4b41e5){if(!_0x4b41e5){_0x33c661[_0xeef8('0x17')](0x194);}return _0x4b41e5;};}function handleError(_0x1ead54,_0xc78d14){_0xc78d14=_0xc78d14||0x1f4;return function(_0x31f519){logger['error'](_0x31f519[_0xeef8('0x24')]);if(_0x31f519[_0xeef8('0x25')]){delete _0x31f519['name'];}_0x1ead54['status'](_0xc78d14)[_0xeef8('0x26')](_0x31f519);};}exports[_0xeef8('0x27')]=function(_0x3b82b2,_0x4f9e8e){var _0x4bf7e3={},_0xac749f={},_0x489bb9={'count':0x0,'rows':[]};var _0x13aabd=_[_0xeef8('0x28')](db[_0xeef8('0x29')][_0xeef8('0x2a')],function(_0x4adede){return{'name':_0x4adede['fieldName'],'type':_0x4adede['type'][_0xeef8('0x2b')]};});_0xac749f[_0xeef8('0x2c')]=_[_0xeef8('0x28')](_0x13aabd,_0xeef8('0x25'));_0xac749f['query']=_[_0xeef8('0x2d')](_0x3b82b2[_0xeef8('0x2e')]);_0xac749f[_0xeef8('0x2f')]=_['intersection'](_0xac749f[_0xeef8('0x2c')],_0xac749f['query']);_0xac749f[_0xeef8('0x2f')]=_[_0xeef8('0x30')](_0xac749f[_0xeef8('0x2f')],[_0xeef8('0x31'),_0xeef8('0x32'),_0xeef8('0x33'),_0xeef8('0x34'),_0xeef8('0x35'),_0xeef8('0x36'),_0xeef8('0x37'),'$eq',_0xeef8('0x38'),_0xeef8('0x39'),_0xeef8('0x3a'),_0xeef8('0x3b'),_0xeef8('0x3c'),_0xeef8('0x3d'),_0xeef8('0x3e'),_0xeef8('0x3f'),'$notILike',_0xeef8('0x3d'),_0xeef8('0x40'),_0xeef8('0x41'),_0xeef8('0x42'),_0xeef8('0x43')]);_0x4bf7e3['attributes']=_[_0xeef8('0x44')](_0xac749f[_0xeef8('0x2c')],qs[_0xeef8('0x45')](_0x3b82b2[_0xeef8('0x2e')][_0xeef8('0x45')]));_0x4bf7e3[_0xeef8('0x46')]=_0x4bf7e3[_0xeef8('0x46')][_0xeef8('0x47')]?_0x4bf7e3['attributes']:_0xac749f[_0xeef8('0x2c')];if(!_0x3b82b2[_0xeef8('0x2e')][_0xeef8('0x48')](_0xeef8('0x49'))){_0x4bf7e3['limit']=qs[_0xeef8('0x1b')](_0x3b82b2[_0xeef8('0x2e')][_0xeef8('0x1b')]);_0x4bf7e3['offset']=qs['offset'](_0x3b82b2['query'][_0xeef8('0x4a')]);}_0x4bf7e3[_0xeef8('0x4b')]=qs[_0xeef8('0x4c')](_0x3b82b2['query']['sort']);_0x4bf7e3[_0xeef8('0x4d')]=qs['filters'](_[_0xeef8('0x4e')](_0x3b82b2['query'],_0xac749f[_0xeef8('0x2f')]),_0x13aabd);if(_0x3b82b2[_0xeef8('0x2e')][_0xeef8('0x4f')]){_0x4bf7e3[_0xeef8('0x4d')]=_[_0xeef8('0x50')](_0x4bf7e3[_0xeef8('0x4d')],{'$or':_[_0xeef8('0x28')](_0x13aabd,function(_0x1f7eea){if(_0x1f7eea[_0xeef8('0x51')]!==_0xeef8('0x52')){var _0x3384ae={};_0x3384ae[_0x1f7eea[_0xeef8('0x25')]]={'$like':'%'+_0x3b82b2[_0xeef8('0x2e')][_0xeef8('0x4f')]+'%'};return _0x3384ae;}})});}_0x4bf7e3=_['merge']({},_0x4bf7e3,_0x3b82b2[_0xeef8('0x53')]);var _0x77f3f4={'where':_0x4bf7e3[_0xeef8('0x4d')]};return db['CmHopper']['count'](_0x77f3f4)[_0xeef8('0x22')](function(_0x56366d){_0x489bb9[_0xeef8('0x1d')]=_0x56366d;if(_0x3b82b2[_0xeef8('0x2e')]['includeAll']){_0x4bf7e3[_0xeef8('0x54')]=[{'all':!![]}];}return db[_0xeef8('0x29')][_0xeef8('0x55')](_0x4bf7e3);})[_0xeef8('0x22')](function(_0x52faf5){_0x489bb9['rows']=_0x52faf5;return _0x489bb9;})[_0xeef8('0x22')](respondWithFilteredResult(_0x4f9e8e,_0x4bf7e3))[_0xeef8('0x56')](handleError(_0x4f9e8e,null));};exports['show']=function(_0x41dee5,_0x26c18f){var _0x143cc7={'raw':!![],'where':{'id':_0x41dee5[_0xeef8('0x57')]['id']}},_0x34f080={};_0x34f080[_0xeef8('0x2c')]=_['keys'](db['CmHopper'][_0xeef8('0x2a')]);_0x34f080[_0xeef8('0x2e')]=_[_0xeef8('0x2d')](_0x41dee5[_0xeef8('0x2e')]);_0x34f080[_0xeef8('0x2f')]=_[_0xeef8('0x44')](_0x34f080[_0xeef8('0x2c')],_0x34f080['query']);_0x143cc7[_0xeef8('0x46')]=_[_0xeef8('0x44')](_0x34f080[_0xeef8('0x2c')],qs[_0xeef8('0x45')](_0x41dee5[_0xeef8('0x2e')]['fields']));_0x143cc7[_0xeef8('0x46')]=_0x143cc7[_0xeef8('0x46')][_0xeef8('0x47')]?_0x143cc7[_0xeef8('0x46')]:_0x34f080['model'];if(_0x41dee5[_0xeef8('0x2e')][_0xeef8('0x58')]){_0x143cc7[_0xeef8('0x54')]=[{'all':!![]}];}_0x143cc7=_[_0xeef8('0x50')]({},_0x143cc7,_0x41dee5[_0xeef8('0x53')]);return db[_0xeef8('0x29')][_0xeef8('0x59')](_0x143cc7)[_0xeef8('0x22')](handleEntityNotFound(_0x26c18f,null))['then'](respondWithResult(_0x26c18f,null))[_0xeef8('0x56')](handleError(_0x26c18f,null));};exports[_0xeef8('0x5a')]=function(_0x15ae8d,_0x3aba0a){return db['CmHopper']['create'](_0x15ae8d[_0xeef8('0x5b')],{})[_0xeef8('0x22')](respondWithResult(_0x3aba0a,0xc9))[_0xeef8('0x56')](handleError(_0x3aba0a,null));};exports[_0xeef8('0x5c')]=function(_0x50f5f9,_0x27a611){if(_0x50f5f9[_0xeef8('0x5b')]['id']){delete _0x50f5f9[_0xeef8('0x5b')]['id'];}return db[_0xeef8('0x29')]['find']({'where':{'id':_0x50f5f9[_0xeef8('0x57')]['id']}})['then'](handleEntityNotFound(_0x27a611,null))[_0xeef8('0x22')](saveUpdates(_0x50f5f9[_0xeef8('0x5b')],null))[_0xeef8('0x22')](respondWithResult(_0x27a611,null))[_0xeef8('0x56')](handleError(_0x27a611,null));};exports[_0xeef8('0x5d')]=function(_0x49c5c4,_0x390a7c){return db[_0xeef8('0x29')]['describe']()['then'](respondWithResult(_0x390a7c,null))[_0xeef8('0x56')](handleError(_0x390a7c,null));};exports[_0xeef8('0x23')]=function(_0x17f482,_0x373bd6){var _0x3a62a6;return db[_0xeef8('0x29')][_0xeef8('0x59')]({'where':{'id':_0x17f482['params']['id']}})[_0xeef8('0x22')](handleEntityNotFound(_0x373bd6,null))['then'](function(_0x576ddd){if(_0x576ddd){return _0x576ddd[_0xeef8('0x23')]()[_0xeef8('0x22')](function(_0x1d2693){return _0x1d2693;});}})['then'](function(_0x311089){_0x3a62a6=_0x311089;if(_0x311089){if(_0x311089['VoiceQueueId']||_0x311089['CampaignId']){return db[_0x311089[_0xeef8('0x5e')]?'VoiceQueue':_0xeef8('0x5f')][_0xeef8('0x59')]({'where':{'id':_0x311089['VoiceQueueId']?_0x311089[_0xeef8('0x5e')]:_0x311089['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x4c50fa){var _0x33a022={};if(_0x4c50fa){_['merge'](_0x33a022,_['omit'](_0x3a62a6['dataValues'],['createdAt',_0xeef8('0x60'),'id']));_0x33a022[_0xeef8('0x61')]=0x15;_0x33a022[_0xeef8('0x62')]=_0xeef8('0x63');_0x33a022['campaign']=_0x4c50fa[_0xeef8('0x25')];_0x33a022[_0xeef8('0x64')]=_0x17f482['user'][_0xeef8('0x25')];_0x33a022[_0xeef8('0x65')]=_0x17f482[_0xeef8('0x66')]['id'];_0x33a022[_0xeef8('0x63')]=!![];_0x33a022[_0xeef8('0x67')]=moment()[_0xeef8('0x68')](_0xeef8('0x69'));_0x33a022[_0xeef8('0x6a')]=_0x3a62a6[_0xeef8('0x6b')];_0x33a022[_0xeef8('0x6c')]=_0x3a62a6['VoiceQueueId']?'queue':_0xeef8('0x6d');return db['CmContact'][_0xeef8('0x59')]({'where':{'id':_0x33a022['ContactId']},'attributes':[_0xeef8('0x6e'),_0xeef8('0x6f')]})[_0xeef8('0x22')](function(_0x3e2b2f){if(!_[_0xeef8('0x70')](_0x373bd6)&&!_[_0xeef8('0x70')](_0x3e2b2f[_0xeef8('0x6e')])){_0x33a022[_0xeef8('0x71')]=_0x3e2b2f[_0xeef8('0x6e')];if(!_[_0xeef8('0x70')](_0x3e2b2f[_0xeef8('0x6f')])){_0x33a022[_0xeef8('0x71')]+='\x20'+_0x3e2b2f['lastName'];}}})[_0xeef8('0x72')](function(){return db[_0xeef8('0x73')][_0xeef8('0x5a')](_0x33a022);});}})[_0xeef8('0x22')](function(){return _0x373bd6[_0xeef8('0x18')](0xcc)[_0xeef8('0x19')]();})[_0xeef8('0x56')](handleError(_0x373bd6,null));};exports['getPreview']=function(_0x40ee5f,_0x16d492,_0x499943){var _0x3d0e70=[];return db[_0xeef8('0x74')]['describe']()[_0xeef8('0x22')](function(_0x30a293){_0x3d0e70=_['keys'](_0x30a293);return _0x40ee5f[_0xeef8('0x66')][_0xeef8('0x75')]({'where':{'type':_0xeef8('0x76'),'dialActive':!![],'dialMethod':_0xeef8('0x77')},'attributes':['id','dialOrderByScheduledAt',_0xeef8('0x78')],'raw':!![]});})[_0xeef8('0x22')](function(_0x5f315d){if(_0x5f315d&&_0x5f315d[_0xeef8('0x47')]){return db[_0xeef8('0x79')][_0xeef8('0x7a')](function(_0x481c84){var _0x1016c0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xeef8('0x68')](_0xeef8('0x69'))},'VoiceQueueId':{'$in':_[_0xeef8('0x28')](_0x5f315d,'id')},'$or':[{'UserId':null},{'UserId':_0x40ee5f[_0xeef8('0x66')]['id']}]};var _0x47279f={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5f315d)[_0xeef8('0x4f')]([_0xeef8('0x78'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x40ee5f[_0xeef8('0x66')]['id']}]};var _0x1f6004={'$or':[_0x1016c0,_0x47279f]};var _0x2c740d=[];if(_0x40ee5f[_0xeef8('0x5b')][_0xeef8('0x7b')]&&_0x40ee5f[_0xeef8('0x5b')][_0xeef8('0x7b')]==='prev'){if(!_[_0xeef8('0x7c')](_0x40ee5f[_0xeef8('0x5b')][_0xeef8('0x7d')])){_0x1f6004['id']={'$in':_0x40ee5f['body'][_0xeef8('0x7d')]};}_0x2c740d=[[_0xeef8('0x7e'),'ASC'],['scheduledAt',_0x5f315d[0x0][_0xeef8('0x7f')]===_0xeef8('0x80')?_0xeef8('0x81'):_0xeef8('0x80')],db[_0xeef8('0x79')][_0xeef8('0x82')](_0xeef8('0x83')),['id',_0xeef8('0x81')]];}else{if(!_[_0xeef8('0x7c')](_0x40ee5f[_0xeef8('0x5b')][_0xeef8('0x7d')])){_0x1f6004['id']={'$notIn':_0x40ee5f['body'][_0xeef8('0x7d')]};}_0x2c740d=[[_0xeef8('0x7e'),_0xeef8('0x81')],[_0xeef8('0x84'),_0x5f315d[0x0][_0xeef8('0x7f')]],db[_0xeef8('0x79')]['literal'](_0xeef8('0x85')),['id',_0xeef8('0x80')]];}return db[_0xeef8('0x29')]['findOne']({'attributes':['id','scheduledat',_0xeef8('0x86')],'where':_0x1f6004,'order':_0x2c740d,'transaction':_0x481c84,'lock':_0x481c84[_0xeef8('0x87')][_0xeef8('0x88')],'include':[{'model':db[_0xeef8('0x74')],'as':_0xeef8('0x89'),'attributes':_0x3d0e70,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0xeef8('0x25')]}]},{'model':db[_0xeef8('0x8a')],'as':_0xeef8('0x8b'),'attributes':['id',_0xeef8('0x25')]},{'model':db['VoiceQueue'],'as':_0xeef8('0x8c'),'attributes':['id','name',_0xeef8('0x8d')]}]})[_0xeef8('0x22')](function(_0x447e36){if(_0x447e36){return _0x447e36[_0xeef8('0x5c')]({'UserId':_0x40ee5f[_0xeef8('0x66')]['id']},{'transaction':_0x481c84});}});});}})[_0xeef8('0x22')](handleEntityNotFound(_0x16d492,null))[_0xeef8('0x22')](respondWithResult(_0x16d492,null))[_0xeef8('0x56')](handleError(_0x16d492,null));};exports['getPreviewRecall']=function(_0x239d39,_0x14e1ca,_0xec3446){var _0x427c13=[];return db['CmContact'][_0xeef8('0x5d')]()['then'](function(_0x1bfeb0){_0x427c13=_[_0xeef8('0x2d')](_0x1bfeb0);return _0x239d39[_0xeef8('0x66')][_0xeef8('0x75')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xeef8('0x77')},'attributes':['id',_0xeef8('0x7f'),_0xeef8('0x78')],'raw':!![]});})[_0xeef8('0x22')](function(_0x2b37ca){if(_0x2b37ca&&_0x2b37ca[_0xeef8('0x47')]){return db[_0xeef8('0x79')][_0xeef8('0x7a')](function(_0x52d1ec){var _0x3eb97a={'active':![],'recallme':!![],'id':_0x239d39[_0xeef8('0x5b')][_0xeef8('0x8e')]};return db[_0xeef8('0x29')][_0xeef8('0x8f')]({'attributes':['id',_0xeef8('0x90'),_0xeef8('0x86')],'where':_0x3eb97a,'transaction':_0x52d1ec,'lock':_0x52d1ec[_0xeef8('0x87')][_0xeef8('0x88')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x427c13,'include':[{'model':db[_0xeef8('0x91')],'as':_0xeef8('0x92'),'attributes':['id','name']}]},{'model':db[_0xeef8('0x8a')],'as':_0xeef8('0x8b'),'attributes':['id',_0xeef8('0x25')]},{'model':db['VoiceQueue'],'as':_0xeef8('0x8c'),'attributes':['id','name',_0xeef8('0x8d')]}]})[_0xeef8('0x22')](function(_0x10f8b7){if(_0x10f8b7){return _0x10f8b7[_0xeef8('0x5c')]({'UserId':_0x239d39['user']['id']},{'transaction':_0x52d1ec});}});});}})['then'](handleEntityNotFound(_0x14e1ca,null))[_0xeef8('0x22')](respondWithResult(_0x14e1ca,null))['catch'](handleError(_0x14e1ca,null));};exports['getOpenContacts']=function(_0x44f971,_0x38e9aa,_0x32db39){return _0x44f971[_0xeef8('0x66')][_0xeef8('0x75')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xeef8('0x77')},'attributes':['id'],'raw':!![]})[_0xeef8('0x22')](function(_0x52322a){if(_0x52322a&&_0x52322a[_0xeef8('0x47')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xeef8('0x68')](_0xeef8('0x69'))},'VoiceQueueId':{'$in':_[_0xeef8('0x28')](_0x52322a,'id')},'$or':[{'UserId':null},{'UserId':_0x44f971[_0xeef8('0x66')]['id']}]}});}return 0x0;})[_0xeef8('0x22')](function(_0x19bbf5){if(!_[_0xeef8('0x70')](_0x19bbf5)&&_[_0xeef8('0x93')](_0x19bbf5)){return _0x38e9aa[_0xeef8('0x18')](0xc8)[_0xeef8('0x1a')]({'contacts':_0x19bbf5});}else{logger[_0xeef8('0x94')](_0xeef8('0x95'),'getOpenContacts',0x194,_0xeef8('0x96'));_0x38e9aa[_0xeef8('0x17')](0x194);}})[_0xeef8('0x56')](handleError(_0x38e9aa,null));};exports['getTimezones']=function(_0x165bd6,_0x2c31c8,_0x402d38){var _0x3917fa=shared[_0xeef8('0x97')];var _0xfaa4ff=[];_[_0xeef8('0x28')](_0x3917fa,function(_0x248c6f){_0xfaa4ff[_0xeef8('0x98')]({'id':_0x248c6f['name'],'name':_0x248c6f['name'],'utcOffset':_0x248c6f[_0xeef8('0x99')]});});return _0x2c31c8[_0xeef8('0x18')](0xc8)[_0xeef8('0x1a')]({'tz':_0xfaa4ff});};exports[_0xeef8('0x9a')]=function(_0x47c054,_0x1c4e05,_0x417c60){var _0x423a6a=shared[_0xeef8('0x97')];var _0xcc8d69={};if(!_[_0xeef8('0x70')](_0x423a6a[_0x47c054[_0xeef8('0x5b')]['id']]))_0xcc8d69=_0x423a6a[_0x47c054[_0xeef8('0x5b')]['id']];return _0x1c4e05[_0xeef8('0x18')](0xc8)[_0xeef8('0x1a')](_0xcc8d69);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index f8dfb3d..cc54aa5 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 _0x5fab=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4068dc,_0x43e121){var _0x1a011d=function(_0xb50666){while(--_0xb50666){_0x4068dc['push'](_0x4068dc['shift']());}};_0x1a011d(++_0x43e121);}(_0x5fab,0x177));var _0xb5fa=function(_0x873d48,_0x3cf3c0){_0x873d48=_0x873d48-0x0;var _0x50c8ca=_0x5fab[_0x873d48];return _0x50c8ca;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['scheduledat']},{'name':_0xb5fa('0xe'),'fields':[_0xb5fa('0xe')]},{'name':_0xb5fa('0xf'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf0=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','api'];(function(_0x2f21cc,_0x295170){var _0x3e815e=function(_0x1f1167){while(--_0x1f1167){_0x2f21cc['push'](_0x2f21cc['shift']());}};_0x3e815e(++_0x295170);}(_0xfcf0,0x138));var _0x0fcf=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0xfcf0[_0x4aa838];return _0x3abff0;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x0fcf('0xc'),'fields':[_0x0fcf('0xc')]},{'name':_0x0fcf('0xd'),'fields':['phone']},{'name':_0x0fcf('0xe'),'fields':[_0x0fcf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 0dd713a..1d35e23 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 _0x7a0e=['all','GetContactDialer','dataValues','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','UPDATE','GetCmHopperPreview','keys','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','List','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','CmHopper,\x20%s,\x20%s','result','catch','GetCmHopper','findAll','options','raw','where','attributes','limit','include','map','model','CmHopper','find','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','update','active','DestroyCmHopper','destroy','CmContact','sequelize','transaction','order','LOCK','Contact','User','Agent','name','voicePause','length','UserId','push','includes'];(function(_0x5d1044,_0x18f656){var _0x3cd90e=function(_0x3c40be){while(--_0x3c40be){_0x5d1044['push'](_0x5d1044['shift']());}};_0x3cd90e(++_0x18f656);}(_0x7a0e,0x76));var _0xe7a0=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7a0e[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xe7a0('0x0'));var util=require(_0xe7a0('0x1'));var moment=require(_0xe7a0('0x2'));var BPromise=require(_0xe7a0('0x3'));var rs=require(_0xe7a0('0x4'));var fs=require('fs');var Redis=require(_0xe7a0('0x5'));var db=require(_0xe7a0('0x6'))['db'];var utils=require(_0xe7a0('0x7'));var logger=require('../../config/logger')(_0xe7a0('0x8'));var config=require(_0xe7a0('0x9'));var jayson=require(_0xe7a0('0xa'));const {validateExpressRequest}=require(_0xe7a0('0xb'));var client=jayson[_0xe7a0('0xc')][_0xe7a0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x46e6bc,_0x1b519e,_0x1e9d41){return new BPromise(function(_0x1fc47a,_0x2dbf20){return client[_0xe7a0('0xe')](_0x46e6bc,_0x1e9d41)[_0xe7a0('0xf')](function(_0x1f4ae5){logger[_0xe7a0('0x10')]('CmHopper,\x20%s,\x20%s',_0x1b519e,_0xe7a0('0x11'));logger[_0xe7a0('0x12')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x1b519e,'request\x20sent',JSON[_0xe7a0('0x13')](_0x1f4ae5));if(_0x1f4ae5[_0xe7a0('0x14')]){if(_0x1f4ae5[_0xe7a0('0x14')][_0xe7a0('0x15')]===0x1f4){logger[_0xe7a0('0x14')]('CmHopper,\x20%s,\x20%s',_0x1b519e,_0x1f4ae5[_0xe7a0('0x14')][_0xe7a0('0x16')]);return _0x2dbf20(_0x1f4ae5['error']['message']);}logger[_0xe7a0('0x14')]('CmHopper,\x20%s,\x20%s',_0x1b519e,_0x1f4ae5[_0xe7a0('0x14')][_0xe7a0('0x16')]);return _0x1fc47a(_0x1f4ae5['error'][_0xe7a0('0x16')]);}else{logger['info'](_0xe7a0('0x17'),_0x1b519e,_0xe7a0('0x11'));_0x1fc47a(_0x1f4ae5[_0xe7a0('0x18')][_0xe7a0('0x16')]);}})[_0xe7a0('0x19')](function(_0x54f01e){logger['error']('CmHopper,\x20%s,\x20%s',_0x1b519e,_0x54f01e);_0x2dbf20(_0x54f01e);});});}exports[_0xe7a0('0x1a')]=function(_0x34461f){var _0x484037=this;return new Promise(function(_0x20c6de,_0x267bc1){return db['CmHopper'][_0xe7a0('0x1b')]({'raw':_0x34461f[_0xe7a0('0x1c')]?_0x34461f[_0xe7a0('0x1c')][_0xe7a0('0x1d')]===undefined?!![]:![]:!![],'where':_0x34461f[_0xe7a0('0x1c')]?_0x34461f[_0xe7a0('0x1c')][_0xe7a0('0x1e')]||null:null,'attributes':_0x34461f[_0xe7a0('0x1c')]?_0x34461f['options'][_0xe7a0('0x1f')]||null:null,'limit':_0x34461f[_0xe7a0('0x1c')]?_0x34461f[_0xe7a0('0x1c')][_0xe7a0('0x20')]||null:null,'include':_0x34461f[_0xe7a0('0x1c')]?_0x34461f[_0xe7a0('0x1c')][_0xe7a0('0x21')]?_[_0xe7a0('0x22')](_0x34461f['options'][_0xe7a0('0x21')],function(_0x54508b){return{'model':db[_0x54508b[_0xe7a0('0x23')]],'as':_0x54508b['as'],'attributes':_0x54508b['attributes'],'include':_0x54508b[_0xe7a0('0x21')]?_[_0xe7a0('0x22')](_0x54508b[_0xe7a0('0x21')],function(_0x5516c0){return{'model':db[_0x5516c0[_0xe7a0('0x23')]],'as':_0x5516c0['as'],'attributes':_0x5516c0[_0xe7a0('0x1f')],'include':_0x5516c0[_0xe7a0('0x21')]?_['map'](_0x5516c0[_0xe7a0('0x21')],function(_0x58fc34){return{'model':db[_0x58fc34[_0xe7a0('0x23')]],'as':_0x58fc34['as'],'attributes':_0x58fc34['attributes']};}):[]};}):[]};}):[]:[]})[_0xe7a0('0xf')](function(_0x48d677){logger[_0xe7a0('0x10')](_0xe7a0('0x1a'),_0x34461f);logger[_0xe7a0('0x12')](_0xe7a0('0x1a'),_0x34461f,JSON[_0xe7a0('0x13')](_0x48d677));_0x20c6de(_0x48d677);})['catch'](function(_0x2d25cc){logger[_0xe7a0('0x14')](_0xe7a0('0x1a'),_0x2d25cc[_0xe7a0('0x16')],_0x34461f);_0x267bc1(_0x484037['error'](0x1f4,_0x2d25cc[_0xe7a0('0x16')]));});});};exports['ShowCmHopper']=function(_0x353a63){var _0x391e22=this;return new Promise(function(_0x232c1b,_0x142148){return db[_0xe7a0('0x24')][_0xe7a0('0x25')]({'raw':_0x353a63['options']?_0x353a63[_0xe7a0('0x1c')][_0xe7a0('0x1d')]===undefined?!![]:![]:!![],'where':_0x353a63['options']?_0x353a63['options'][_0xe7a0('0x1e')]||null:null,'attributes':_0x353a63['options']?_0x353a63['options'][_0xe7a0('0x1f')]||null:null,'include':_0x353a63[_0xe7a0('0x1c')]?_0x353a63[_0xe7a0('0x1c')][_0xe7a0('0x21')]?_['map'](_0x353a63[_0xe7a0('0x1c')]['include'],function(_0x2a105f){return{'model':db[_0x2a105f[_0xe7a0('0x23')]],'as':_0x2a105f['as'],'attributes':_0x2a105f[_0xe7a0('0x1f')],'include':_0x2a105f[_0xe7a0('0x21')]?_[_0xe7a0('0x22')](_0x2a105f[_0xe7a0('0x21')],function(_0x1caea6){return{'model':db[_0x1caea6[_0xe7a0('0x23')]],'as':_0x1caea6['as'],'attributes':_0x1caea6['attributes'],'include':_0x1caea6[_0xe7a0('0x21')]?_[_0xe7a0('0x22')](_0x1caea6['include'],function(_0x326329){return{'model':db[_0x326329[_0xe7a0('0x23')]],'as':_0x326329['as'],'attributes':_0x326329[_0xe7a0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe7a0('0xf')](function(_0x55b602){logger[_0xe7a0('0x10')]('ShowCmHopper',_0x353a63);logger['debug'](_0xe7a0('0x26'),_0x353a63,JSON[_0xe7a0('0x13')](_0x55b602));_0x232c1b(_0x55b602);})[_0xe7a0('0x19')](function(_0x567d6c){logger[_0xe7a0('0x14')]('ShowCmHopper',_0x567d6c[_0xe7a0('0x16')],_0x353a63);_0x142148(_0x391e22[_0xe7a0('0x14')](0x1f4,_0x567d6c['message']));});});};exports[_0xe7a0('0x27')]=function(_0x5b8a86){var _0x5d5641=this;return new Promise(function(_0x42e2f8,_0x570454){return db[_0xe7a0('0x24')]['create'](_0x5b8a86[_0xe7a0('0x28')],{'raw':_0x5b8a86[_0xe7a0('0x1c')]?_0x5b8a86[_0xe7a0('0x1c')][_0xe7a0('0x1d')]===undefined?!![]:![]:!![]})[_0xe7a0('0xf')](function(_0x29872c){logger['info']('CreateCmHopper',_0x5b8a86);logger['debug'](_0xe7a0('0x27'),_0x5b8a86,JSON[_0xe7a0('0x13')](_0x29872c));_0x42e2f8(_0x29872c);})[_0xe7a0('0x19')](function(_0x279a91){logger[_0xe7a0('0x14')](_0xe7a0('0x27'),_0x279a91[_0xe7a0('0x16')],_0x5b8a86);_0x570454(_0x5d5641[_0xe7a0('0x14')](0x1f4,_0x279a91['message']));});});};exports[_0xe7a0('0x29')]=function(_0x227212){var _0x598528=this;return new Promise(function(_0x1fb287,_0x2ae71b){return db[_0xe7a0('0x24')][_0xe7a0('0x2a')](_0x227212[_0xe7a0('0x28')],{'raw':_0x227212[_0xe7a0('0x1c')]?_0x227212[_0xe7a0('0x1c')][_0xe7a0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x227212[_0xe7a0('0x1c')]?_0x227212[_0xe7a0('0x1c')][_0xe7a0('0x1e')]||null:null,'attributes':_0x227212[_0xe7a0('0x1c')]?_0x227212[_0xe7a0('0x1c')][_0xe7a0('0x1f')]||null:null,'limit':_0x227212[_0xe7a0('0x1c')]?_0x227212[_0xe7a0('0x1c')][_0xe7a0('0x20')]||null:null})['then'](function(_0x1fefb8){logger['info'](_0xe7a0('0x29'),_0x227212);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xe7a0('0x13')](_0x227212[_0xe7a0('0x1c')][_0xe7a0('0x1e')]),_0x227212[_0xe7a0('0x28')][_0xe7a0('0x2b')]);logger['debug']('UpdateCmHopper',_0x227212,JSON[_0xe7a0('0x13')](_0x1fefb8));_0x1fb287(_0x1fefb8);})['catch'](function(_0x2ee946){logger[_0xe7a0('0x14')](_0xe7a0('0x29'),_0x2ee946[_0xe7a0('0x16')],_0x227212);_0x2ae71b(_0x598528['error'](0x1f4,_0x2ee946[_0xe7a0('0x16')]));});});};exports[_0xe7a0('0x2c')]=function(_0x369f4b){var _0x4ac0ff=this;return new Promise(function(_0x59b4fd,_0x4c188c){return db[_0xe7a0('0x24')][_0xe7a0('0x2d')]({'where':_0x369f4b['options']?_0x369f4b[_0xe7a0('0x1c')][_0xe7a0('0x1e')]||null:null})[_0xe7a0('0xf')](function(_0x18df8c){logger['info'](_0xe7a0('0x2c'),_0x369f4b);logger['debug'](_0xe7a0('0x2c'),_0x369f4b,JSON[_0xe7a0('0x13')](_0x18df8c));_0x59b4fd(_0x18df8c);})[_0xe7a0('0x19')](function(_0x24d242){logger['error'](_0xe7a0('0x2c'),_0x24d242[_0xe7a0('0x16')],_0x369f4b);_0x4c188c(_0x4ac0ff[_0xe7a0('0x14')](0x1f4,_0x24d242[_0xe7a0('0x16')]));});});};exports['GetContactDialer']=function(_0x3aa71b){var _0x4b9f0f=this;return new Promise(function(_0x409066,_0x225bbd){return db[_0xe7a0('0x2e')]['describe']()[_0xe7a0('0xf')](function(_0x5ac2ca){return db[_0xe7a0('0x2f')][_0xe7a0('0x30')](function(_0x2eba3e){return db[_0xe7a0('0x24')][_0xe7a0('0x1b')]({'where':_0x3aa71b[_0xe7a0('0x1c')]?_0x3aa71b[_0xe7a0('0x1c')][_0xe7a0('0x1e')]||null:null,'attributes':_0x3aa71b[_0xe7a0('0x1c')]?_0x3aa71b[_0xe7a0('0x1c')][_0xe7a0('0x1f')]||null:null,'limit':_0x3aa71b[_0xe7a0('0x1c')]?_0x3aa71b[_0xe7a0('0x1c')][_0xe7a0('0x20')]||null:null,'order':_0x3aa71b[_0xe7a0('0x1c')]?_0x3aa71b['options'][_0xe7a0('0x31')]||null:null,'transaction':_0x2eba3e,'lock':_0x2eba3e[_0xe7a0('0x32')]['UPDATE'],'include':[{'model':db[_0xe7a0('0x2e')],'as':_0xe7a0('0x33'),'attributes':_['keys'](_0x5ac2ca)},{'model':db[_0xe7a0('0x34')],'as':_0xe7a0('0x35'),'attributes':['id',_0xe7a0('0x36'),_0xe7a0('0x37')]}]})['then'](function(_0x4901cb){var _0x4df0af=[];var _0x2e5861=[];for(var _0x3e81c1=0x0;_0x3e81c1<_0x4901cb[_0xe7a0('0x38')];_0x3e81c1+=0x1){var _0x41f87a=_0x4901cb[_0x3e81c1][_0xe7a0('0x39')];if(_0x41f87a===null){_0x4df0af[_0xe7a0('0x3a')](_0x4901cb[_0x3e81c1][_0xe7a0('0x2a')](_0x3aa71b[_0xe7a0('0x28')],{'transaction':_0x2eba3e}));}else if(!_0x2e5861[_0xe7a0('0x3b')](_0x41f87a)){_0x2e5861[_0xe7a0('0x3a')](_0x41f87a);_0x4df0af['push'](_0x4901cb[_0x3e81c1][_0xe7a0('0x2a')](_0x3aa71b[_0xe7a0('0x28')],{'transaction':_0x2eba3e}));}}return BPromise[_0xe7a0('0x3c')](_0x4df0af);});})[_0xe7a0('0xf')](function(_0x38bc92){logger[_0xe7a0('0x10')](_0xe7a0('0x3d'),_0x3aa71b);if(_0x38bc92['length']>0x0){logger[_0xe7a0('0x10')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x38bc92[0x0][_0xe7a0('0x3e')]['id'],_0x38bc92[0x0][_0xe7a0('0x3e')]['ContactId'],_0x38bc92[0x0][_0xe7a0('0x3e')][_0xe7a0('0x2b')]);}logger[_0xe7a0('0x12')](_0xe7a0('0x3d'),_0x3aa71b,JSON[_0xe7a0('0x13')](_0x38bc92));_0x409066(_0x38bc92);})['catch'](function(_0x5176ec){logger['error'](_0xe7a0('0x3d'),_0x5176ec[_0xe7a0('0x16')],_0x3aa71b);_0x225bbd(_0x4b9f0f[_0xe7a0('0x14')](0x1f4,_0x5176ec[_0xe7a0('0x16')]));});});});};exports[_0xe7a0('0x3f')]=function(_0xd02700){var _0x13d673=this;return new Promise(function(_0x4a7008,_0x4a8dc8){return db[_0xe7a0('0x2f')]['transaction'](function(_0x4b2a70){return db[_0xe7a0('0x40')]['create'](_0xd02700[_0xe7a0('0x28')],{'raw':_0xd02700[_0xe7a0('0x1c')]?_0xd02700[_0xe7a0('0x1c')][_0xe7a0('0x1d')]===undefined?!![]:![]:!![],'transaction':_0x4b2a70})[_0xe7a0('0xf')](function(){logger[_0xe7a0('0x10')](_0xe7a0('0x41'),JSON[_0xe7a0('0x13')](_0xd02700[_0xe7a0('0x1c')][_0xe7a0('0x1e')]),_0xd02700['options']['where'][_0xe7a0('0x2b')]);return db[_0xe7a0('0x24')][_0xe7a0('0x2d')]({'where':_0xd02700[_0xe7a0('0x1c')]?_0xd02700[_0xe7a0('0x1c')][_0xe7a0('0x1e')]||null:null,'transaction':_0x4b2a70});});})[_0xe7a0('0xf')](function(_0x2f685d){logger[_0xe7a0('0x10')](_0xe7a0('0x3f'),_0xd02700);logger[_0xe7a0('0x12')]('MoveContactManagedDialer',_0xd02700,JSON['stringify'](_0x2f685d));_0x4a7008(_0x2f685d);})[_0xe7a0('0x19')](function(_0x3eed32){logger[_0xe7a0('0x14')](_0xe7a0('0x3f'),_0x3eed32[_0xe7a0('0x16')],_0xd02700);_0x4a8dc8(_0x13d673[_0xe7a0('0x14')](0x1f4,_0x3eed32[_0xe7a0('0x16')]));});});};exports[_0xe7a0('0x42')]=function(_0x1b5025){var _0x1d6202=this;return new Promise(function(_0x4b7238,_0x5eb63e){return db[_0xe7a0('0x24')][_0xe7a0('0x1b')]({'raw':_0x1b5025['options']?_0x1b5025[_0xe7a0('0x1c')][_0xe7a0('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b5025[_0xe7a0('0x1c')]?_0x1b5025[_0xe7a0('0x1c')][_0xe7a0('0x1e')]||null:null,'attributes':[[db[_0xe7a0('0x2f')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xe7a0('0x43')](_0xe7a0('0x44')+util[_0xe7a0('0x45')](_0xe7a0('0x46'),moment()[_0xe7a0('0x45')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xe7a0('0x47')))),_0xe7a0('0x48')]]})[_0xe7a0('0xf')](function(_0x4b87dd){logger[_0xe7a0('0x10')](_0xe7a0('0x42'),_0x1b5025);logger[_0xe7a0('0x12')](_0xe7a0('0x42'),_0x1b5025,JSON[_0xe7a0('0x13')](_0x4b87dd));_0x4b7238(_0x4b87dd);})[_0xe7a0('0x19')](function(_0x4a2d5d){logger['error'](_0xe7a0('0x42'),_0x4a2d5d[_0xe7a0('0x16')],_0x1b5025);_0x5eb63e(_0x1d6202[_0xe7a0('0x14')](0x1f4,_0x4a2d5d[_0xe7a0('0x16')]));});});};exports[_0xe7a0('0x49')]=function(_0x1c45f2){var _0x2e20a1=this;return new Promise(function(_0x3a0cf4,_0x2fb2f9){return db[_0xe7a0('0x2e')][_0xe7a0('0x4a')]()[_0xe7a0('0xf')](function(_0x555c23){return db[_0xe7a0('0x2f')][_0xe7a0('0x30')](function(_0x50b092){return db[_0xe7a0('0x24')]['findAll']({'where':_0x1c45f2['options']?_0x1c45f2[_0xe7a0('0x1c')][_0xe7a0('0x1e')]||null:null,'attributes':_0x1c45f2[_0xe7a0('0x1c')]?_0x1c45f2[_0xe7a0('0x1c')][_0xe7a0('0x1f')]||null:null,'limit':0x1,'order':_0x1c45f2[_0xe7a0('0x1c')]?_0x1c45f2['options'][_0xe7a0('0x31')]||null:null,'group':db[_0xe7a0('0x24')][_0xe7a0('0x39')],'transaction':_0x50b092,'lock':_0x50b092[_0xe7a0('0x32')][_0xe7a0('0x4b')],'include':_0x1c45f2[_0xe7a0('0x1c')]?_0x1c45f2[_0xe7a0('0x1c')][_0xe7a0('0x21')]?_[_0xe7a0('0x22')](_0x1c45f2[_0xe7a0('0x1c')]['include'],function(_0x292813){return{'model':db[_0x292813[_0xe7a0('0x23')]],'as':_0x292813['as'],'attributes':_0x292813[_0xe7a0('0x1f')],'include':_0x292813[_0xe7a0('0x21')]?_[_0xe7a0('0x22')](_0x292813[_0xe7a0('0x21')],function(_0x44c4d1){return{'model':db[_0x44c4d1['model']],'as':_0x44c4d1['as'],'attributes':_0x44c4d1[_0xe7a0('0x1f')],'include':_0x44c4d1[_0xe7a0('0x21')]?_[_0xe7a0('0x22')](_0x44c4d1[_0xe7a0('0x21')],function(_0x172693){return{'model':db[_0x172693[_0xe7a0('0x23')]],'as':_0x172693['as'],'attributes':_0x172693[_0xe7a0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe7a0('0xf')](function(_0x164366){var _0x3b0ccf=[];for(var _0x4029d0=0x0;_0x4029d0<_0x164366[_0xe7a0('0x38')];_0x4029d0+=0x1){_0x3b0ccf[_0xe7a0('0x3a')](_0x164366[_0x4029d0][_0xe7a0('0x2a')](_0x1c45f2['body'],{'transaction':_0x50b092}));}return BPromise[_0xe7a0('0x3c')](_0x3b0ccf);});})['then'](function(_0x5a0fe4){logger[_0xe7a0('0x10')](_0xe7a0('0x49'),_0x1c45f2);logger[_0xe7a0('0x12')]('GetContactRecallMe',_0x1c45f2,JSON[_0xe7a0('0x13')](_0x5a0fe4));_0x3a0cf4(_0x5a0fe4);})[_0xe7a0('0x19')](function(_0x3fa97a){logger['error'](_0xe7a0('0x49'),_0x3fa97a[_0xe7a0('0x16')],_0x1c45f2);_0x2fb2f9(_0x2e20a1['error'](0x1f4,_0x3fa97a[_0xe7a0('0x16')]));});});});};exports[_0xe7a0('0x4c')]=function(_0x4a16cc){var _0x3f356d=this;return new Promise(function(_0x582dba,_0x3dbe13){db[_0xe7a0('0x2e')][_0xe7a0('0x4a')]()[_0xe7a0('0xf')](function(_0x5bd93a){return db[_0xe7a0('0x24')][_0xe7a0('0x1b')]({'raw':_0x4a16cc['options']?_0x4a16cc[_0xe7a0('0x1c')][_0xe7a0('0x1d')]===undefined?!![]:![]:!![],'where':_0x4a16cc['options']?_0x4a16cc['options']['where']||null:null,'attributes':_0x4a16cc[_0xe7a0('0x1c')]?_0x4a16cc[_0xe7a0('0x1c')]['attributes']||null:null,'limit':_0x4a16cc['options']?_0x4a16cc['options'][_0xe7a0('0x20')]||null:null,'include':_0x4a16cc[_0xe7a0('0x1c')]?_0x4a16cc[_0xe7a0('0x1c')][_0xe7a0('0x21')]?_[_0xe7a0('0x22')](_0x4a16cc['options'][_0xe7a0('0x21')],function(_0x2e7612){return{'model':db[_0x2e7612[_0xe7a0('0x23')]],'as':_0x2e7612['as'],'attributes':_0x2e7612['as']==='Contact'?_[_0xe7a0('0x4d')](_0x5bd93a):_0x2e7612[_0xe7a0('0x1f')],'include':_0x2e7612[_0xe7a0('0x21')]?_['map'](_0x2e7612[_0xe7a0('0x21')],function(_0x4a5448){return{'model':db[_0x4a5448['model']],'as':_0x4a5448['as'],'attributes':_0x4a5448[_0xe7a0('0x1f')],'include':_0x4a5448[_0xe7a0('0x21')]?_[_0xe7a0('0x22')](_0x4a5448[_0xe7a0('0x21')],function(_0x41450d){return{'model':db[_0x41450d[_0xe7a0('0x23')]],'as':_0x41450d['as'],'attributes':_0x41450d[_0xe7a0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe7a0('0xf')](function(_0x31544b){logger[_0xe7a0('0x10')](_0xe7a0('0x1a'),_0x4a16cc);logger[_0xe7a0('0x12')](_0xe7a0('0x1a'),_0x4a16cc,JSON[_0xe7a0('0x13')](_0x31544b));_0x582dba(_0x31544b);})[_0xe7a0('0x19')](function(_0x32371b){logger[_0xe7a0('0x14')]('GetCmHopper',_0x32371b[_0xe7a0('0x16')],_0x4a16cc);_0x3dbe13(_0x3f356d[_0xe7a0('0x14')](0x1f4,_0x32371b[_0xe7a0('0x16')]));});});});};exports[_0xe7a0('0x4e')]=function(_0x29f651){var _0x48c584=this;return new Promise(function(_0x2b2857,_0x54d2ea){return db[_0xe7a0('0x2e')][_0xe7a0('0x4f')]({'raw':!![],'where':{'phone':_0x29f651[_0xe7a0('0x1c')][_0xe7a0('0x1e')]['phone']},'attributes':['id',_0xe7a0('0x50')],'order':[['id',_0xe7a0('0x51')]]})[_0xe7a0('0xf')](function(_0x459999){logger[_0xe7a0('0x10')](_0xe7a0('0x52'),_0x29f651);logger[_0xe7a0('0x12')](_0xe7a0('0x52'),_0x29f651,JSON[_0xe7a0('0x13')](_0x459999));_0x2b2857(_0x459999);})['catch'](function(_0x1fcba1){logger[_0xe7a0('0x14')](_0xe7a0('0x52'),_0x1fcba1[_0xe7a0('0x16')],_0x29f651);_0x54d2ea(_0x48c584['error'](0x1f4,_0x1fcba1['message']));});});};exports['ResetActiveCalls']=function(_0x54c2d2){var _0x287dfd=this;return new Promise(function(_0x567138,_0x9ea4d9){return db[_0xe7a0('0x2f')][_0xe7a0('0x30')](function(_0x4d69be){return db[_0xe7a0('0x24')][_0xe7a0('0x2a')]({'active':![]},{'where':{},'transaction':_0x4d69be})[_0xe7a0('0xf')](function(_0x172294){logger['info']('ResetActiveCalls',_0x54c2d2);logger[_0xe7a0('0x12')](_0xe7a0('0x53'),_0x54c2d2,JSON['stringify'](_0x172294));_0x567138(_0x172294);})[_0xe7a0('0x19')](function(_0x5df67c){logger[_0xe7a0('0x14')](_0xe7a0('0x53'),_0x5df67c[_0xe7a0('0x16')],_0x54c2d2);_0x9ea4d9(_0x287dfd[_0xe7a0('0x14')](0x1f4,_0x5df67c['message']));});});});};exports[_0xe7a0('0x54')]=function(_0x53f949){var _0x174fc0=this;var _0xcb21a2=_0x53f949[_0xe7a0('0x28')][_0xe7a0('0x1e')]['voiceQueueId'];var _0x1f9b5f=_0x53f949[_0xe7a0('0x28')][_0xe7a0('0x1e')][_0xe7a0('0x55')];return new Promise(function(_0x31b2c0,_0x40a594){return db[_0xe7a0('0x24')][_0xe7a0('0x1b')]({'where':{'voiceQueueId':_0xcb21a2,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xe7a0('0x2f')][_0xe7a0('0x43')](_0xe7a0('0x56')+_0x1f9b5f+_0xe7a0('0x57'))}},'include':[{'model':db[_0xe7a0('0x2e')],'as':_0xe7a0('0x33')},{'model':db[_0xe7a0('0x34')],'as':_0xe7a0('0x35'),'attributes':['id',_0xe7a0('0x36'),_0xe7a0('0x37')]},{'model':db['CmList'],'as':_0xe7a0('0x58')}]})[_0xe7a0('0xf')](function(_0x1c550a){return db['sequelize'][_0xe7a0('0x30')](function(_0x1f30e8){return db[_0xe7a0('0x24')][_0xe7a0('0x2a')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0xcb21a2,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize']['literal'](_0xe7a0('0x56')+_0x1f9b5f+_0xe7a0('0x57'))}},'transaction':_0x1f30e8})[_0xe7a0('0xf')](function(_0x1e4e9b){_0x31b2c0(_0x1c550a);})['catch'](function(_0xfe8629){logger[_0xe7a0('0x14')](_0xe7a0('0x54'),_0xfe8629[_0xe7a0('0x16')],_0x53f949);_0x40a594(validateExpressRequest);});});})[_0xe7a0('0x19')](function(_0x4e41b3){logger[_0xe7a0('0x14')](_0xe7a0('0x54'),_0x4e41b3[_0xe7a0('0x16')],_0x53f949);_0x40a594(_0x174fc0[_0xe7a0('0x14')](0x1f4,_0x4e41b3[_0xe7a0('0x16')]));});});}; \ No newline at end of file +var _0x83ca=['all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','transaction','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','GetCmHopperPreview','Contact','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','\x20MINUTE','CmList','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopper','CmHopper','findAll','options','raw','attributes','limit','include','map','model','find','where','ShowCmHopper','catch','create','body','CreateCmHopper','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','order','LOCK','UPDATE','keys','User','Agent','name','voicePause','update','push'];(function(_0x2cedbf,_0x42e81b){var _0x3014a9=function(_0x1bd0d7){while(--_0x1bd0d7){_0x2cedbf['push'](_0x2cedbf['shift']());}};_0x3014a9(++_0x42e81b);}(_0x83ca,0x1eb));var _0xa83c=function(_0x240a61,_0x29482d){_0x240a61=_0x240a61-0x0;var _0x34f97d=_0x83ca[_0x240a61];return _0x34f97d;};'use strict';var _=require(_0xa83c('0x0'));var util=require(_0xa83c('0x1'));var moment=require(_0xa83c('0x2'));var BPromise=require(_0xa83c('0x3'));var rs=require(_0xa83c('0x4'));var fs=require('fs');var Redis=require(_0xa83c('0x5'));var db=require(_0xa83c('0x6'))['db'];var utils=require(_0xa83c('0x7'));var logger=require(_0xa83c('0x8'))(_0xa83c('0x9'));var config=require(_0xa83c('0xa'));var jayson=require(_0xa83c('0xb'));const {validateExpressRequest}=require(_0xa83c('0xc'));var client=jayson[_0xa83c('0xd')][_0xa83c('0xe')]({'port':0x232a});function respondWithRpcPromise(_0x11319d,_0x5f23fd,_0x14a739){return new BPromise(function(_0x49e201,_0x48813b){return client[_0xa83c('0xf')](_0x11319d,_0x14a739)[_0xa83c('0x10')](function(_0x2dc3c2){logger[_0xa83c('0x11')](_0xa83c('0x12'),_0x5f23fd,_0xa83c('0x13'));logger[_0xa83c('0x14')](_0xa83c('0x15'),_0x5f23fd,_0xa83c('0x13'),JSON[_0xa83c('0x16')](_0x2dc3c2));if(_0x2dc3c2['error']){if(_0x2dc3c2[_0xa83c('0x17')][_0xa83c('0x18')]===0x1f4){logger[_0xa83c('0x17')](_0xa83c('0x12'),_0x5f23fd,_0x2dc3c2['error'][_0xa83c('0x19')]);return _0x48813b(_0x2dc3c2['error'][_0xa83c('0x19')]);}logger['error'](_0xa83c('0x12'),_0x5f23fd,_0x2dc3c2[_0xa83c('0x17')][_0xa83c('0x19')]);return _0x49e201(_0x2dc3c2[_0xa83c('0x17')]['message']);}else{logger['info']('CmHopper,\x20%s,\x20%s',_0x5f23fd,_0xa83c('0x13'));_0x49e201(_0x2dc3c2[_0xa83c('0x1a')][_0xa83c('0x19')]);}})['catch'](function(_0xad23d5){logger[_0xa83c('0x17')](_0xa83c('0x12'),_0x5f23fd,_0xad23d5);_0x48813b(_0xad23d5);});});}exports[_0xa83c('0x1b')]=function(_0x2de59c){var _0x2f12ea=this;return new Promise(function(_0x53f4a3,_0x55c609){return db[_0xa83c('0x1c')][_0xa83c('0x1d')]({'raw':_0x2de59c[_0xa83c('0x1e')]?_0x2de59c[_0xa83c('0x1e')][_0xa83c('0x1f')]===undefined?!![]:![]:!![],'where':_0x2de59c[_0xa83c('0x1e')]?_0x2de59c[_0xa83c('0x1e')]['where']||null:null,'attributes':_0x2de59c['options']?_0x2de59c[_0xa83c('0x1e')][_0xa83c('0x20')]||null:null,'limit':_0x2de59c[_0xa83c('0x1e')]?_0x2de59c[_0xa83c('0x1e')][_0xa83c('0x21')]||null:null,'include':_0x2de59c[_0xa83c('0x1e')]?_0x2de59c[_0xa83c('0x1e')][_0xa83c('0x22')]?_[_0xa83c('0x23')](_0x2de59c[_0xa83c('0x1e')]['include'],function(_0x33e76b){return{'model':db[_0x33e76b[_0xa83c('0x24')]],'as':_0x33e76b['as'],'attributes':_0x33e76b['attributes'],'include':_0x33e76b[_0xa83c('0x22')]?_[_0xa83c('0x23')](_0x33e76b['include'],function(_0x12f9bd){return{'model':db[_0x12f9bd[_0xa83c('0x24')]],'as':_0x12f9bd['as'],'attributes':_0x12f9bd[_0xa83c('0x20')],'include':_0x12f9bd['include']?_['map'](_0x12f9bd[_0xa83c('0x22')],function(_0x5962c7){return{'model':db[_0x5962c7[_0xa83c('0x24')]],'as':_0x5962c7['as'],'attributes':_0x5962c7[_0xa83c('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa83c('0x10')](function(_0x193e6a){logger[_0xa83c('0x11')](_0xa83c('0x1b'),_0x2de59c);logger['debug'](_0xa83c('0x1b'),_0x2de59c,JSON['stringify'](_0x193e6a));_0x53f4a3(_0x193e6a);})['catch'](function(_0x5095d4){logger[_0xa83c('0x17')]('GetCmHopper',_0x5095d4[_0xa83c('0x19')],_0x2de59c);_0x55c609(_0x2f12ea['error'](0x1f4,_0x5095d4['message']));});});};exports['ShowCmHopper']=function(_0x2a6474){var _0x356281=this;return new Promise(function(_0x103b62,_0x159be9){return db[_0xa83c('0x1c')][_0xa83c('0x25')]({'raw':_0x2a6474[_0xa83c('0x1e')]?_0x2a6474[_0xa83c('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2a6474[_0xa83c('0x1e')]?_0x2a6474[_0xa83c('0x1e')][_0xa83c('0x26')]||null:null,'attributes':_0x2a6474['options']?_0x2a6474[_0xa83c('0x1e')][_0xa83c('0x20')]||null:null,'include':_0x2a6474['options']?_0x2a6474[_0xa83c('0x1e')][_0xa83c('0x22')]?_[_0xa83c('0x23')](_0x2a6474[_0xa83c('0x1e')][_0xa83c('0x22')],function(_0x115c40){return{'model':db[_0x115c40[_0xa83c('0x24')]],'as':_0x115c40['as'],'attributes':_0x115c40[_0xa83c('0x20')],'include':_0x115c40[_0xa83c('0x22')]?_['map'](_0x115c40[_0xa83c('0x22')],function(_0x3acfde){return{'model':db[_0x3acfde[_0xa83c('0x24')]],'as':_0x3acfde['as'],'attributes':_0x3acfde[_0xa83c('0x20')],'include':_0x3acfde[_0xa83c('0x22')]?_[_0xa83c('0x23')](_0x3acfde['include'],function(_0x5bfc7b){return{'model':db[_0x5bfc7b[_0xa83c('0x24')]],'as':_0x5bfc7b['as'],'attributes':_0x5bfc7b[_0xa83c('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa83c('0x10')](function(_0x1c4c44){logger[_0xa83c('0x11')](_0xa83c('0x27'),_0x2a6474);logger['debug'](_0xa83c('0x27'),_0x2a6474,JSON[_0xa83c('0x16')](_0x1c4c44));_0x103b62(_0x1c4c44);})[_0xa83c('0x28')](function(_0x9ab2e3){logger[_0xa83c('0x17')](_0xa83c('0x27'),_0x9ab2e3[_0xa83c('0x19')],_0x2a6474);_0x159be9(_0x356281['error'](0x1f4,_0x9ab2e3[_0xa83c('0x19')]));});});};exports['CreateCmHopper']=function(_0x775f10){var _0x44881e=this;return new Promise(function(_0x2113ec,_0xa2b242){return db[_0xa83c('0x1c')][_0xa83c('0x29')](_0x775f10[_0xa83c('0x2a')],{'raw':_0x775f10[_0xa83c('0x1e')]?_0x775f10[_0xa83c('0x1e')][_0xa83c('0x1f')]===undefined?!![]:![]:!![]})[_0xa83c('0x10')](function(_0x5c8d8d){logger[_0xa83c('0x11')](_0xa83c('0x2b'),_0x775f10);logger[_0xa83c('0x14')]('CreateCmHopper',_0x775f10,JSON[_0xa83c('0x16')](_0x5c8d8d));_0x2113ec(_0x5c8d8d);})['catch'](function(_0x5394ad){logger[_0xa83c('0x17')](_0xa83c('0x2b'),_0x5394ad[_0xa83c('0x19')],_0x775f10);_0xa2b242(_0x44881e[_0xa83c('0x17')](0x1f4,_0x5394ad[_0xa83c('0x19')]));});});};exports[_0xa83c('0x2c')]=function(_0x1e38a7){var _0xacafd5=this;return new Promise(function(_0x27fc31,_0x30b4bb){return db['CmHopper']['update'](_0x1e38a7[_0xa83c('0x2a')],{'raw':_0x1e38a7[_0xa83c('0x1e')]?_0x1e38a7[_0xa83c('0x1e')][_0xa83c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e38a7['options']?_0x1e38a7[_0xa83c('0x1e')][_0xa83c('0x26')]||null:null,'attributes':_0x1e38a7[_0xa83c('0x1e')]?_0x1e38a7[_0xa83c('0x1e')][_0xa83c('0x20')]||null:null,'limit':_0x1e38a7[_0xa83c('0x1e')]?_0x1e38a7['options']['limit']||null:null})[_0xa83c('0x10')](function(_0x5474b3){logger[_0xa83c('0x11')](_0xa83c('0x2c'),_0x1e38a7);logger[_0xa83c('0x11')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xa83c('0x16')](_0x1e38a7[_0xa83c('0x1e')][_0xa83c('0x26')]),_0x1e38a7[_0xa83c('0x2a')]['active']);logger[_0xa83c('0x14')](_0xa83c('0x2c'),_0x1e38a7,JSON[_0xa83c('0x16')](_0x5474b3));_0x27fc31(_0x5474b3);})[_0xa83c('0x28')](function(_0x3f683c){logger['error'](_0xa83c('0x2c'),_0x3f683c[_0xa83c('0x19')],_0x1e38a7);_0x30b4bb(_0xacafd5[_0xa83c('0x17')](0x1f4,_0x3f683c[_0xa83c('0x19')]));});});};exports[_0xa83c('0x2d')]=function(_0xf61eb4){var _0xe41636=this;return new Promise(function(_0x4354a5,_0x7afe24){return db[_0xa83c('0x1c')][_0xa83c('0x2e')]({'where':_0xf61eb4[_0xa83c('0x1e')]?_0xf61eb4['options'][_0xa83c('0x26')]||null:null})[_0xa83c('0x10')](function(_0x58c0f9){logger['info'](_0xa83c('0x2d'),_0xf61eb4);logger[_0xa83c('0x14')](_0xa83c('0x2d'),_0xf61eb4,JSON[_0xa83c('0x16')](_0x58c0f9));_0x4354a5(_0x58c0f9);})[_0xa83c('0x28')](function(_0x5d0aef){logger[_0xa83c('0x17')](_0xa83c('0x2d'),_0x5d0aef[_0xa83c('0x19')],_0xf61eb4);_0x7afe24(_0xe41636[_0xa83c('0x17')](0x1f4,_0x5d0aef['message']));});});};exports[_0xa83c('0x2f')]=function(_0x4814b0){var _0x24aec5=this;return new Promise(function(_0x6d423f,_0x46170b){return db[_0xa83c('0x30')][_0xa83c('0x31')]()['then'](function(_0x136693){return db[_0xa83c('0x32')]['transaction'](function(_0x340c12){return db['CmHopper']['findAll']({'where':_0x4814b0[_0xa83c('0x1e')]?_0x4814b0[_0xa83c('0x1e')]['where']||null:null,'attributes':_0x4814b0[_0xa83c('0x1e')]?_0x4814b0[_0xa83c('0x1e')][_0xa83c('0x20')]||null:null,'limit':_0x4814b0[_0xa83c('0x1e')]?_0x4814b0['options']['limit']||null:null,'order':_0x4814b0[_0xa83c('0x1e')]?_0x4814b0[_0xa83c('0x1e')][_0xa83c('0x33')]||null:null,'transaction':_0x340c12,'lock':_0x340c12[_0xa83c('0x34')][_0xa83c('0x35')],'include':[{'model':db[_0xa83c('0x30')],'as':'Contact','attributes':_[_0xa83c('0x36')](_0x136693)},{'model':db[_0xa83c('0x37')],'as':_0xa83c('0x38'),'attributes':['id',_0xa83c('0x39'),_0xa83c('0x3a')]}]})[_0xa83c('0x10')](function(_0x1648f3){var _0x1774e5=[];var _0x1eecfa=[];for(var _0x10dfe6=0x0;_0x10dfe6<_0x1648f3['length'];_0x10dfe6+=0x1){var _0x52542c=_0x1648f3[_0x10dfe6]['UserId'];if(_0x52542c===null){_0x1774e5['push'](_0x1648f3[_0x10dfe6][_0xa83c('0x3b')](_0x4814b0[_0xa83c('0x2a')],{'transaction':_0x340c12}));}else if(!_0x1eecfa['includes'](_0x52542c)){_0x1eecfa[_0xa83c('0x3c')](_0x52542c);_0x1774e5['push'](_0x1648f3[_0x10dfe6][_0xa83c('0x3b')](_0x4814b0[_0xa83c('0x2a')],{'transaction':_0x340c12}));}}return BPromise[_0xa83c('0x3d')](_0x1774e5);});})[_0xa83c('0x10')](function(_0x41f0ce){logger['info'](_0xa83c('0x2f'),_0x4814b0);if(_0x41f0ce[_0xa83c('0x3e')]>0x0){logger[_0xa83c('0x11')](_0xa83c('0x3f'),_0x41f0ce[0x0][_0xa83c('0x40')]['id'],_0x41f0ce[0x0][_0xa83c('0x40')][_0xa83c('0x41')],_0x41f0ce[0x0][_0xa83c('0x40')][_0xa83c('0x42')]);}logger[_0xa83c('0x14')](_0xa83c('0x2f'),_0x4814b0,JSON[_0xa83c('0x16')](_0x41f0ce));_0x6d423f(_0x41f0ce);})['catch'](function(_0x18ebcd){logger[_0xa83c('0x17')](_0xa83c('0x2f'),_0x18ebcd[_0xa83c('0x19')],_0x4814b0);_0x46170b(_0x24aec5['error'](0x1f4,_0x18ebcd[_0xa83c('0x19')]));});});});};exports[_0xa83c('0x43')]=function(_0xaa9724){var _0x59b2c3=this;return new Promise(function(_0x59c53b,_0x47b990){return db[_0xa83c('0x32')][_0xa83c('0x44')](function(_0x3ef05c){return db[_0xa83c('0x45')]['create'](_0xaa9724['body'],{'raw':_0xaa9724['options']?_0xaa9724[_0xa83c('0x1e')][_0xa83c('0x1f')]===undefined?!![]:![]:!![],'transaction':_0x3ef05c})[_0xa83c('0x10')](function(){logger[_0xa83c('0x11')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xa83c('0x16')](_0xaa9724[_0xa83c('0x1e')]['where']),_0xaa9724[_0xa83c('0x1e')][_0xa83c('0x26')][_0xa83c('0x42')]);return db[_0xa83c('0x1c')][_0xa83c('0x2e')]({'where':_0xaa9724[_0xa83c('0x1e')]?_0xaa9724[_0xa83c('0x1e')][_0xa83c('0x26')]||null:null,'transaction':_0x3ef05c});});})[_0xa83c('0x10')](function(_0x212b53){logger[_0xa83c('0x11')]('MoveContactManagedDialer',_0xaa9724);logger[_0xa83c('0x14')](_0xa83c('0x43'),_0xaa9724,JSON[_0xa83c('0x16')](_0x212b53));_0x59c53b(_0x212b53);})['catch'](function(_0x147efe){logger[_0xa83c('0x17')](_0xa83c('0x43'),_0x147efe['message'],_0xaa9724);_0x47b990(_0x59b2c3['error'](0x1f4,_0x147efe[_0xa83c('0x19')]));});});};exports[_0xa83c('0x46')]=function(_0x4729ff){var _0x3fa179=this;return new Promise(function(_0x4b9944,_0x34c6e1){return db[_0xa83c('0x1c')][_0xa83c('0x1d')]({'raw':_0x4729ff['options']?_0x4729ff[_0xa83c('0x1e')][_0xa83c('0x1f')]===undefined?!![]:![]:!![],'where':_0x4729ff['options']?_0x4729ff['options'][_0xa83c('0x26')]||null:null,'attributes':[[db['sequelize']['fn'](_0xa83c('0x47'),db['sequelize']['fn']('IF',db['sequelize'][_0xa83c('0x48')](_0xa83c('0x49')+util[_0xa83c('0x4a')](_0xa83c('0x4b'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0xa83c('0x4c')))),_0xa83c('0x4d')]]})[_0xa83c('0x10')](function(_0x1a3737){logger[_0xa83c('0x11')]('CountReScheduled',_0x4729ff);logger[_0xa83c('0x14')](_0xa83c('0x46'),_0x4729ff,JSON[_0xa83c('0x16')](_0x1a3737));_0x4b9944(_0x1a3737);})['catch'](function(_0x200cb6){logger['error']('CountReScheduled',_0x200cb6[_0xa83c('0x19')],_0x4729ff);_0x34c6e1(_0x3fa179[_0xa83c('0x17')](0x1f4,_0x200cb6['message']));});});};exports[_0xa83c('0x4e')]=function(_0x22763e){var _0x56b990=this;return new Promise(function(_0x1fece8,_0x4f6432){return db[_0xa83c('0x30')][_0xa83c('0x31')]()[_0xa83c('0x10')](function(_0x335f7a){return db[_0xa83c('0x32')][_0xa83c('0x44')](function(_0x4d844c){return db[_0xa83c('0x1c')][_0xa83c('0x1d')]({'where':_0x22763e['options']?_0x22763e[_0xa83c('0x1e')][_0xa83c('0x26')]||null:null,'attributes':_0x22763e[_0xa83c('0x1e')]?_0x22763e[_0xa83c('0x1e')]['attributes']||null:null,'limit':0x1,'order':_0x22763e[_0xa83c('0x1e')]?_0x22763e['options']['order']||null:null,'group':db[_0xa83c('0x1c')][_0xa83c('0x4f')],'transaction':_0x4d844c,'lock':_0x4d844c['LOCK'][_0xa83c('0x35')],'include':_0x22763e[_0xa83c('0x1e')]?_0x22763e[_0xa83c('0x1e')]['include']?_[_0xa83c('0x23')](_0x22763e[_0xa83c('0x1e')][_0xa83c('0x22')],function(_0x894f6b){return{'model':db[_0x894f6b[_0xa83c('0x24')]],'as':_0x894f6b['as'],'attributes':_0x894f6b[_0xa83c('0x20')],'include':_0x894f6b[_0xa83c('0x22')]?_['map'](_0x894f6b[_0xa83c('0x22')],function(_0x1beef4){return{'model':db[_0x1beef4[_0xa83c('0x24')]],'as':_0x1beef4['as'],'attributes':_0x1beef4[_0xa83c('0x20')],'include':_0x1beef4[_0xa83c('0x22')]?_[_0xa83c('0x23')](_0x1beef4[_0xa83c('0x22')],function(_0x315529){return{'model':db[_0x315529[_0xa83c('0x24')]],'as':_0x315529['as'],'attributes':_0x315529[_0xa83c('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa83c('0x10')](function(_0x181b2f){var _0x312e84=[];for(var _0x4b0fa3=0x0;_0x4b0fa3<_0x181b2f['length'];_0x4b0fa3+=0x1){_0x312e84[_0xa83c('0x3c')](_0x181b2f[_0x4b0fa3][_0xa83c('0x3b')](_0x22763e[_0xa83c('0x2a')],{'transaction':_0x4d844c}));}return BPromise[_0xa83c('0x3d')](_0x312e84);});})[_0xa83c('0x10')](function(_0x397bf7){logger['info'](_0xa83c('0x4e'),_0x22763e);logger['debug'](_0xa83c('0x4e'),_0x22763e,JSON[_0xa83c('0x16')](_0x397bf7));_0x1fece8(_0x397bf7);})[_0xa83c('0x28')](function(_0x53d5de){logger[_0xa83c('0x17')](_0xa83c('0x4e'),_0x53d5de['message'],_0x22763e);_0x4f6432(_0x56b990[_0xa83c('0x17')](0x1f4,_0x53d5de[_0xa83c('0x19')]));});});});};exports[_0xa83c('0x50')]=function(_0x2f10b3){var _0x21830e=this;return new Promise(function(_0x401165,_0x16081f){db['CmContact'][_0xa83c('0x31')]()[_0xa83c('0x10')](function(_0x3661fc){return db['CmHopper'][_0xa83c('0x1d')]({'raw':_0x2f10b3[_0xa83c('0x1e')]?_0x2f10b3['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f10b3[_0xa83c('0x1e')]?_0x2f10b3['options']['where']||null:null,'attributes':_0x2f10b3['options']?_0x2f10b3['options'][_0xa83c('0x20')]||null:null,'limit':_0x2f10b3[_0xa83c('0x1e')]?_0x2f10b3[_0xa83c('0x1e')]['limit']||null:null,'include':_0x2f10b3['options']?_0x2f10b3[_0xa83c('0x1e')]['include']?_[_0xa83c('0x23')](_0x2f10b3[_0xa83c('0x1e')][_0xa83c('0x22')],function(_0x583729){return{'model':db[_0x583729[_0xa83c('0x24')]],'as':_0x583729['as'],'attributes':_0x583729['as']===_0xa83c('0x51')?_[_0xa83c('0x36')](_0x3661fc):_0x583729[_0xa83c('0x20')],'include':_0x583729[_0xa83c('0x22')]?_[_0xa83c('0x23')](_0x583729[_0xa83c('0x22')],function(_0x1dcf55){return{'model':db[_0x1dcf55[_0xa83c('0x24')]],'as':_0x1dcf55['as'],'attributes':_0x1dcf55['attributes'],'include':_0x1dcf55[_0xa83c('0x22')]?_[_0xa83c('0x23')](_0x1dcf55[_0xa83c('0x22')],function(_0x232004){return{'model':db[_0x232004[_0xa83c('0x24')]],'as':_0x232004['as'],'attributes':_0x232004[_0xa83c('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa83c('0x10')](function(_0x20b969){logger[_0xa83c('0x11')](_0xa83c('0x1b'),_0x2f10b3);logger['debug'](_0xa83c('0x1b'),_0x2f10b3,JSON[_0xa83c('0x16')](_0x20b969));_0x401165(_0x20b969);})['catch'](function(_0x18b6d4){logger[_0xa83c('0x17')](_0xa83c('0x1b'),_0x18b6d4[_0xa83c('0x19')],_0x2f10b3);_0x16081f(_0x21830e[_0xa83c('0x17')](0x1f4,_0x18b6d4[_0xa83c('0x19')]));});});});};exports['GetContactByPhone']=function(_0x2567ba){var _0x37feca=this;return new Promise(function(_0x199899,_0x1a3a3c){return db[_0xa83c('0x30')]['findOne']({'raw':!![],'where':{'phone':_0x2567ba[_0xa83c('0x1e')]['where'][_0xa83c('0x52')]},'attributes':['id',_0xa83c('0x53')],'order':[['id',_0xa83c('0x54')]]})['then'](function(_0x1dad41){logger[_0xa83c('0x11')](_0xa83c('0x55'),_0x2567ba);logger[_0xa83c('0x14')](_0xa83c('0x55'),_0x2567ba,JSON['stringify'](_0x1dad41));_0x199899(_0x1dad41);})[_0xa83c('0x28')](function(_0x19d147){logger[_0xa83c('0x17')]('getContactByPhone',_0x19d147[_0xa83c('0x19')],_0x2567ba);_0x1a3a3c(_0x37feca[_0xa83c('0x17')](0x1f4,_0x19d147[_0xa83c('0x19')]));});});};exports[_0xa83c('0x56')]=function(_0x4f003a){var _0x331f44=this;return new Promise(function(_0x23c7ce,_0x1e03cb){return db['sequelize']['transaction'](function(_0x3cfd59){return db[_0xa83c('0x1c')][_0xa83c('0x3b')]({'active':![]},{'where':{},'transaction':_0x3cfd59})[_0xa83c('0x10')](function(_0x1e677a){logger['info'](_0xa83c('0x56'),_0x4f003a);logger[_0xa83c('0x14')](_0xa83c('0x56'),_0x4f003a,JSON['stringify'](_0x1e677a));_0x23c7ce(_0x1e677a);})[_0xa83c('0x28')](function(_0x2b6003){logger[_0xa83c('0x17')]('ResetActiveCalls',_0x2b6003[_0xa83c('0x19')],_0x4f003a);_0x1e03cb(_0x331f44[_0xa83c('0x17')](0x1f4,_0x2b6003[_0xa83c('0x19')]));});});});};exports[_0xa83c('0x57')]=function(_0x58ede3){var _0x585084=this;var _0x592de3=_0x58ede3[_0xa83c('0x2a')][_0xa83c('0x26')][_0xa83c('0x58')];var _0x4d9984=_0x58ede3[_0xa83c('0x2a')][_0xa83c('0x26')][_0xa83c('0x59')];return new Promise(function(_0x4b990e,_0x5e8e62){return db['CmHopper'][_0xa83c('0x1d')]({'where':{'voiceQueueId':_0x592de3,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize'][_0xa83c('0x48')]('NOW()\x20+\x20INTERVAL\x20'+_0x4d9984+_0xa83c('0x5a'))}},'include':[{'model':db[_0xa83c('0x30')],'as':_0xa83c('0x51')},{'model':db[_0xa83c('0x37')],'as':_0xa83c('0x38'),'attributes':['id',_0xa83c('0x39'),_0xa83c('0x3a')]},{'model':db[_0xa83c('0x5b')],'as':'List'}]})['then'](function(_0xce1e9){return db['sequelize'][_0xa83c('0x44')](function(_0x5e5ef8){return db[_0xa83c('0x1c')][_0xa83c('0x3b')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x592de3,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xa83c('0x32')][_0xa83c('0x48')]('NOW()\x20+\x20INTERVAL\x20'+_0x4d9984+_0xa83c('0x5a'))}},'transaction':_0x5e5ef8})[_0xa83c('0x10')](function(_0x1e7bf3){_0x4b990e(_0xce1e9);})['catch'](function(_0x3bc2f9){logger[_0xa83c('0x17')](_0xa83c('0x57'),_0x3bc2f9['message'],_0x58ede3);_0x5e8e62(validateExpressRequest);});});})['catch'](function(_0x4ca8f0){logger[_0xa83c('0x17')](_0xa83c('0x57'),_0x4ca8f0[_0xa83c('0x19')],_0x58ede3);_0x5e8e62(_0x585084[_0xa83c('0x17')](0x1f4,_0x4ca8f0['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index ac24bd4..f14d51c 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 _0x2aec=['show','post','create','/preview','getPreview','/timezone','getTimezone','/previewrecall','getPreviewRecall','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x2aec,0x1dd));var _0xc2ae=function(_0x4f4348,_0xeeedb8){_0x4f4348=_0x4f4348-0x0;var _0x160a7b=_0x2aec[_0x4f4348];return _0x160a7b;};'use strict';var multer=require(_0xc2ae('0x0'));var util=require('util');var path=require(_0xc2ae('0x1'));var timeout=require('connect-timeout');var express=require(_0xc2ae('0x2'));var router=express[_0xc2ae('0x3')]();var fs_extra=require(_0xc2ae('0x4'));var auth=require(_0xc2ae('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc2ae('0x6'));router[_0xc2ae('0x7')]('/',auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x9')]);router[_0xc2ae('0x7')]('/describe',auth[_0xc2ae('0x8')](),controller[_0xc2ae('0xa')]);router[_0xc2ae('0x7')](_0xc2ae('0xb'),auth[_0xc2ae('0x8')](),controller[_0xc2ae('0xc')]);router[_0xc2ae('0x7')](_0xc2ae('0xd'),auth[_0xc2ae('0x8')](),controller[_0xc2ae('0xe')]);router['get'](_0xc2ae('0xf'),auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x10')]);router[_0xc2ae('0x11')]('/',auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x12')]);router[_0xc2ae('0x11')](_0xc2ae('0x13'),auth['isAuthenticated'](),controller[_0xc2ae('0x14')]);router[_0xc2ae('0x11')](_0xc2ae('0x15'),auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x16')]);router[_0xc2ae('0x11')](_0xc2ae('0x17'),auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x18')]);router[_0xc2ae('0x19')](_0xc2ae('0xf'),auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x1a')]);router['delete'](_0xc2ae('0xf'),auth[_0xc2ae('0x8')](),controller[_0xc2ae('0x1b')]);module[_0xc2ae('0x1c')]=router; \ No newline at end of file +var _0x93ac=['Router','fs-extra','../../config/environment','./cmHopper.controller','get','/describe','isAuthenticated','describe','/opencontacts','/timezones','getTimezones','show','post','create','/preview','/previewrecall','getPreviewRecall','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x22082b,_0x1a8a97){var _0x21d3e6=function(_0x13857b){while(--_0x13857b){_0x22082b['push'](_0x22082b['shift']());}};_0x21d3e6(++_0x1a8a97);}(_0x93ac,0x9e));var _0xc93a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x93ac[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc93a('0x0'));var util=require(_0xc93a('0x1'));var path=require(_0xc93a('0x2'));var timeout=require(_0xc93a('0x3'));var express=require('express');var router=express[_0xc93a('0x4')]();var fs_extra=require(_0xc93a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc93a('0x6'));var controller=require(_0xc93a('0x7'));router[_0xc93a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc93a('0x8')](_0xc93a('0x9'),auth[_0xc93a('0xa')](),controller[_0xc93a('0xb')]);router[_0xc93a('0x8')](_0xc93a('0xc'),auth['isAuthenticated'](),controller['getOpenContacts']);router['get'](_0xc93a('0xd'),auth[_0xc93a('0xa')](),controller[_0xc93a('0xe')]);router[_0xc93a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc93a('0xf')]);router[_0xc93a('0x10')]('/',auth[_0xc93a('0xa')](),controller[_0xc93a('0x11')]);router[_0xc93a('0x10')](_0xc93a('0x12'),auth[_0xc93a('0xa')](),controller['getPreview']);router[_0xc93a('0x10')]('/timezone',auth[_0xc93a('0xa')](),controller['getTimezone']);router[_0xc93a('0x10')](_0xc93a('0x13'),auth['isAuthenticated'](),controller[_0xc93a('0x14')]);router[_0xc93a('0x15')](_0xc93a('0x16'),auth[_0xc93a('0xa')](),controller[_0xc93a('0x17')]);router[_0xc93a('0x18')](_0xc93a('0x16'),auth['isAuthenticated'](),controller[_0xc93a('0x19')]);module[_0xc93a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index d57191e..03c08ea 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 _0x934f=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x4c2bec,_0x4fadfa){var _0x13a6b8=function(_0x59cf4e){while(--_0x59cf4e){_0x4c2bec['push'](_0x4c2bec['shift']());}};_0x13a6b8(++_0x4fadfa);}(_0x934f,0x1d2));var _0xf934=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x934f[_0x277107];return _0x1da046;};'use strict';var moment=require(_0xf934('0x0'));var Sequelize=require(_0xf934('0x1'));module[_0xf934('0x2')]={'phone':{'type':Sequelize[_0xf934('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xf934('0x4')],'unique':_0xf934('0x5')},'ListId':{'type':Sequelize[_0xf934('0x4')],'unique':_0xf934('0x5')},'VoiceQueueId':{'type':Sequelize[_0xf934('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x35c8=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0x35c8,0xa6));var _0x835c=function(_0x5991e0,_0x4db202){_0x5991e0=_0x5991e0-0x0;var _0x3922f9=_0x35c8[_0x5991e0];return _0x3922f9;};'use strict';var moment=require(_0x835c('0x0'));var Sequelize=require(_0x835c('0x1'));module[_0x835c('0x2')]={'phone':{'type':Sequelize[_0x835c('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x835c('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x835c('0x5')},'VoiceQueueId':{'type':Sequelize[_0x835c('0x4')],'unique':_0x835c('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 258557b..c0b2b60 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 _0xd0e4=['lodash','squel','jsforce','desk.js','papaparse','../../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','destroy','then','stack','name','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','CmHopperBlack','include','findAll','catch','show','keys','options','find','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox'];(function(_0x196a13,_0x2b47d6){var _0x59de2f=function(_0x3db65c){while(--_0x3db65c){_0x196a13['push'](_0x196a13['shift']());}};_0x59de2f(++_0x2b47d6);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x454918,_0x1dbc64){_0x454918=_0x454918-0x0;var _0x3a814b=_0xd0e4[_0x454918];return _0x3a814b;};'use strict';var emlformat=require(_0x4d0e('0x0'));var rimraf=require(_0x4d0e('0x1'));var zipdir=require(_0x4d0e('0x2'));var jsonpatch=require(_0x4d0e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4d0e('0x4'));var Mustache=require(_0x4d0e('0x5'));var util=require(_0x4d0e('0x6'));var path=require(_0x4d0e('0x7'));var sox=require(_0x4d0e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d0e('0x9'));var squel=require(_0x4d0e('0xa'));var crypto=require('crypto');var jsforce=require(_0x4d0e('0xb'));var deskjs=require(_0x4d0e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4d0e('0xd'));var Redis=require('ioredis');var authService=require(_0x4d0e('0xe'));var qs=require(_0x4d0e('0xf'));var as=require(_0x4d0e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d0e('0x11'))(_0x4d0e('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4d0e('0x13'));var db=require(_0x4d0e('0x14'))['db'];function respondWithStatusCode(_0x2d8006,_0x181c6a){_0x181c6a=_0x181c6a||0xcc;return function(_0x43594b){if(_0x43594b){return _0x2d8006[_0x4d0e('0x15')](_0x181c6a);}return _0x2d8006[_0x4d0e('0x16')](_0x181c6a)[_0x4d0e('0x17')]();};}function respondWithResult(_0x2139e8,_0x4fcf8d){_0x4fcf8d=_0x4fcf8d||0xc8;return function(_0x8f0fde){if(_0x8f0fde){return _0x2139e8[_0x4d0e('0x16')](_0x4fcf8d)[_0x4d0e('0x18')](_0x8f0fde);}};}function respondWithFilteredResult(_0x53d5d1,_0x3d0a15){return function(_0x4f077f){if(_0x4f077f){var _0x12efdb=typeof _0x3d0a15[_0x4d0e('0x19')]===_0x4d0e('0x1a')&&typeof _0x3d0a15[_0x4d0e('0x1b')]===_0x4d0e('0x1a');var _0x2ee85a=_0x4f077f[_0x4d0e('0x1c')];var _0x501c6b=_0x12efdb?0x0:_0x3d0a15[_0x4d0e('0x19')];var _0x2ea57f=_0x12efdb?_0x4f077f[_0x4d0e('0x1c')]:_0x3d0a15['offset']+_0x3d0a15[_0x4d0e('0x1b')];var _0x2846d1;if(_0x2ea57f>=_0x2ee85a){_0x2ea57f=_0x2ee85a;_0x2846d1=0xc8;}else{_0x2846d1=0xce;}_0x53d5d1[_0x4d0e('0x16')](_0x2846d1);return _0x53d5d1[_0x4d0e('0x1d')](_0x4d0e('0x1e'),_0x501c6b+'-'+_0x2ea57f+'/'+_0x2ee85a)[_0x4d0e('0x18')](_0x4f077f);}return null;};}function patchUpdates(_0x3dc65b){return function(_0x1d6e52){try{jsonpatch[_0x4d0e('0x1f')](_0x1d6e52,_0x3dc65b,!![]);}catch(_0x240a4c){return BPromise[_0x4d0e('0x20')](_0x240a4c);}return _0x1d6e52['save']();};}function saveUpdates(_0x5df7df,_0x18ecb5){return function(_0x1a1a3d){if(_0x1a1a3d){return _0x1a1a3d['update'](_0x5df7df)['then'](function(_0x3ee308){return _0x3ee308;});}return null;};}function removeEntity(_0x1e1ad2,_0x3092e1){return function(_0x13e74f){if(_0x13e74f){return _0x13e74f[_0x4d0e('0x21')]()[_0x4d0e('0x22')](function(){_0x1e1ad2[_0x4d0e('0x16')](0xcc)[_0x4d0e('0x17')]();});}};}function handleEntityNotFound(_0x3411dd,_0x557e6a){return function(_0x35f58a){if(!_0x35f58a){_0x3411dd[_0x4d0e('0x15')](0x194);}return _0x35f58a;};}function handleError(_0x1a237f,_0x128d38){_0x128d38=_0x128d38||0x1f4;return function(_0x25043b){logger['error'](_0x25043b[_0x4d0e('0x23')]);if(_0x25043b[_0x4d0e('0x24')]){delete _0x25043b['name'];}_0x1a237f[_0x4d0e('0x16')](_0x128d38)['send'](_0x25043b);};}exports['index']=function(_0x2127b4,_0x1073c6){var _0x427582={},_0x372a87={},_0x17f7c2={'count':0x0,'rows':[]};var _0x7e551d=_[_0x4d0e('0x25')](db['CmHopperBlack'][_0x4d0e('0x26')],function(_0x488e21){return{'name':_0x488e21['fieldName'],'type':_0x488e21[_0x4d0e('0x27')][_0x4d0e('0x28')]};});_0x372a87[_0x4d0e('0x29')]=_[_0x4d0e('0x25')](_0x7e551d,_0x4d0e('0x24'));_0x372a87[_0x4d0e('0x2a')]=_['keys'](_0x2127b4[_0x4d0e('0x2a')]);_0x372a87[_0x4d0e('0x2b')]=_[_0x4d0e('0x2c')](_0x372a87[_0x4d0e('0x29')],_0x372a87['query']);_0x427582[_0x4d0e('0x2d')]=_[_0x4d0e('0x2c')](_0x372a87[_0x4d0e('0x29')],qs[_0x4d0e('0x2e')](_0x2127b4[_0x4d0e('0x2a')][_0x4d0e('0x2e')]));_0x427582[_0x4d0e('0x2d')]=_0x427582['attributes'][_0x4d0e('0x2f')]?_0x427582[_0x4d0e('0x2d')]:_0x372a87['model'];if(!_0x2127b4[_0x4d0e('0x2a')][_0x4d0e('0x30')](_0x4d0e('0x31'))){_0x427582[_0x4d0e('0x1b')]=qs[_0x4d0e('0x1b')](_0x2127b4[_0x4d0e('0x2a')][_0x4d0e('0x1b')]);_0x427582[_0x4d0e('0x19')]=qs[_0x4d0e('0x19')](_0x2127b4[_0x4d0e('0x2a')][_0x4d0e('0x19')]);}_0x427582[_0x4d0e('0x32')]=qs[_0x4d0e('0x33')](_0x2127b4[_0x4d0e('0x2a')][_0x4d0e('0x33')]);_0x427582[_0x4d0e('0x34')]=qs['filters'](_['pick'](_0x2127b4[_0x4d0e('0x2a')],_0x372a87[_0x4d0e('0x2b')]),_0x7e551d);if(_0x2127b4[_0x4d0e('0x2a')][_0x4d0e('0x35')]){_0x427582[_0x4d0e('0x34')]=_[_0x4d0e('0x36')](_0x427582[_0x4d0e('0x34')],{'$or':_['map'](_0x7e551d,function(_0x10e4ea){if(_0x10e4ea[_0x4d0e('0x27')]!==_0x4d0e('0x37')){var _0x5b763e={};_0x5b763e[_0x10e4ea[_0x4d0e('0x24')]]={'$like':'%'+_0x2127b4[_0x4d0e('0x2a')]['filter']+'%'};return _0x5b763e;}})});}_0x427582=_[_0x4d0e('0x36')]({},_0x427582,_0x2127b4['options']);var _0x28aedf={'where':_0x427582['where']};return db[_0x4d0e('0x38')][_0x4d0e('0x1c')](_0x28aedf)['then'](function(_0x2903ea){_0x17f7c2[_0x4d0e('0x1c')]=_0x2903ea;if(_0x2127b4[_0x4d0e('0x2a')]['includeAll']){_0x427582[_0x4d0e('0x39')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x4d0e('0x3a')](_0x427582);})[_0x4d0e('0x22')](function(_0x193115){_0x17f7c2['rows']=_0x193115;return _0x17f7c2;})['then'](respondWithFilteredResult(_0x1073c6,_0x427582))[_0x4d0e('0x3b')](handleError(_0x1073c6,null));};exports[_0x4d0e('0x3c')]=function(_0x18dd56,_0x4d9fa8){var _0xfb47ff={'raw':!![],'where':{'id':_0x18dd56['params']['id']}},_0x1a7b57={};_0x1a7b57[_0x4d0e('0x29')]=_[_0x4d0e('0x3d')](db[_0x4d0e('0x38')]['rawAttributes']);_0x1a7b57[_0x4d0e('0x2a')]=_['keys'](_0x18dd56[_0x4d0e('0x2a')]);_0x1a7b57['filters']=_[_0x4d0e('0x2c')](_0x1a7b57[_0x4d0e('0x29')],_0x1a7b57[_0x4d0e('0x2a')]);_0xfb47ff[_0x4d0e('0x2d')]=_[_0x4d0e('0x2c')](_0x1a7b57[_0x4d0e('0x29')],qs[_0x4d0e('0x2e')](_0x18dd56[_0x4d0e('0x2a')][_0x4d0e('0x2e')]));_0xfb47ff[_0x4d0e('0x2d')]=_0xfb47ff[_0x4d0e('0x2d')][_0x4d0e('0x2f')]?_0xfb47ff[_0x4d0e('0x2d')]:_0x1a7b57[_0x4d0e('0x29')];if(_0x18dd56[_0x4d0e('0x2a')]['includeAll']){_0xfb47ff['include']=[{'all':!![]}];}_0xfb47ff=_[_0x4d0e('0x36')]({},_0xfb47ff,_0x18dd56[_0x4d0e('0x3e')]);return db[_0x4d0e('0x38')][_0x4d0e('0x3f')](_0xfb47ff)[_0x4d0e('0x22')](handleEntityNotFound(_0x4d9fa8,null))[_0x4d0e('0x22')](respondWithResult(_0x4d9fa8,null))[_0x4d0e('0x3b')](handleError(_0x4d9fa8,null));};exports[_0x4d0e('0x40')]=function(_0x2a8bd9,_0x639d65){if(_0x2a8bd9[_0x4d0e('0x41')]['id']){delete _0x2a8bd9['body']['id'];}return db[_0x4d0e('0x38')][_0x4d0e('0x3f')]({'where':{'id':_0x2a8bd9[_0x4d0e('0x42')]['id']}})[_0x4d0e('0x22')](handleEntityNotFound(_0x639d65,null))[_0x4d0e('0x22')](saveUpdates(_0x2a8bd9['body'],null))[_0x4d0e('0x22')](respondWithResult(_0x639d65,null))[_0x4d0e('0x3b')](handleError(_0x639d65,null));};exports[_0x4d0e('0x21')]=function(_0x472b7c,_0x2bbc6e){return db[_0x4d0e('0x38')]['find']({'where':{'id':_0x472b7c[_0x4d0e('0x42')]['id']}})['then'](handleEntityNotFound(_0x2bbc6e,null))[_0x4d0e('0x22')](removeEntity(_0x2bbc6e,null))[_0x4d0e('0x3b')](handleError(_0x2bbc6e,null));};exports[_0x4d0e('0x43')]=function(_0xe25cb9,_0x4be53d){return db[_0x4d0e('0x38')][_0x4d0e('0x43')]()[_0x4d0e('0x22')](respondWithResult(_0x4be53d,null))[_0x4d0e('0x3b')](handleError(_0x4be53d,null));}; \ No newline at end of file +var _0x3e5b=['hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../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','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length'];(function(_0x39f4b9,_0x1066cf){var _0x40797f=function(_0x2081c1){while(--_0x2081c1){_0x39f4b9['push'](_0x39f4b9['shift']());}};_0x40797f(++_0x1066cf);}(_0x3e5b,0x1e9));var _0xb3e5=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3e5b[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3e5('0x0'));var zipdir=require(_0xb3e5('0x1'));var jsonpatch=require(_0xb3e5('0x2'));var rp=require(_0xb3e5('0x3'));var moment=require('moment');var BPromise=require(_0xb3e5('0x4'));var Mustache=require(_0xb3e5('0x5'));var util=require('util');var path=require(_0xb3e5('0x6'));var sox=require(_0xb3e5('0x7'));var csv=require('to-csv');var ejs=require(_0xb3e5('0x8'));var fs=require('fs');var fs_extra=require(_0xb3e5('0x9'));var _=require(_0xb3e5('0xa'));var squel=require(_0xb3e5('0xb'));var crypto=require(_0xb3e5('0xc'));var jsforce=require(_0xb3e5('0xd'));var deskjs=require(_0xb3e5('0xe'));var toCsv=require(_0xb3e5('0xf'));var querystring=require(_0xb3e5('0x10'));var Papa=require(_0xb3e5('0x11'));var Redis=require('ioredis');var authService=require(_0xb3e5('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3e5('0x13'));var logger=require(_0xb3e5('0x14'))(_0xb3e5('0x15'));var utils=require(_0xb3e5('0x16'));var config=require(_0xb3e5('0x17'));var licenseUtil=require(_0xb3e5('0x18'));var db=require(_0xb3e5('0x19'))['db'];function respondWithStatusCode(_0x1544ba,_0x5431c6){_0x5431c6=_0x5431c6||0xcc;return function(_0x2d9472){if(_0x2d9472){return _0x1544ba[_0xb3e5('0x1a')](_0x5431c6);}return _0x1544ba[_0xb3e5('0x1b')](_0x5431c6)[_0xb3e5('0x1c')]();};}function respondWithResult(_0x3856fe,_0x3cb770){_0x3cb770=_0x3cb770||0xc8;return function(_0x5b06bd){if(_0x5b06bd){return _0x3856fe['status'](_0x3cb770)[_0xb3e5('0x1d')](_0x5b06bd);}};}function respondWithFilteredResult(_0x2c0a19,_0x1641d4){return function(_0x5cec4a){if(_0x5cec4a){var _0x53b9c5=typeof _0x1641d4[_0xb3e5('0x1e')]===_0xb3e5('0x1f')&&typeof _0x1641d4['limit']===_0xb3e5('0x1f');var _0x378c86=_0x5cec4a[_0xb3e5('0x20')];var _0x184d79=_0x53b9c5?0x0:_0x1641d4[_0xb3e5('0x1e')];var _0x35e319=_0x53b9c5?_0x5cec4a[_0xb3e5('0x20')]:_0x1641d4[_0xb3e5('0x1e')]+_0x1641d4[_0xb3e5('0x21')];var _0x403be7;if(_0x35e319>=_0x378c86){_0x35e319=_0x378c86;_0x403be7=0xc8;}else{_0x403be7=0xce;}_0x2c0a19['status'](_0x403be7);return _0x2c0a19[_0xb3e5('0x22')](_0xb3e5('0x23'),_0x184d79+'-'+_0x35e319+'/'+_0x378c86)[_0xb3e5('0x1d')](_0x5cec4a);}return null;};}function patchUpdates(_0x230375){return function(_0x5cf83b){try{jsonpatch[_0xb3e5('0x24')](_0x5cf83b,_0x230375,!![]);}catch(_0x171518){return BPromise[_0xb3e5('0x25')](_0x171518);}return _0x5cf83b[_0xb3e5('0x26')]();};}function saveUpdates(_0x1723f2,_0x355fe0){return function(_0x2c6d7b){if(_0x2c6d7b){return _0x2c6d7b[_0xb3e5('0x27')](_0x1723f2)[_0xb3e5('0x28')](function(_0x27d7f2){return _0x27d7f2;});}return null;};}function removeEntity(_0x10ede0,_0x555b0c){return function(_0x5b8f08){if(_0x5b8f08){return _0x5b8f08['destroy']()[_0xb3e5('0x28')](function(){_0x10ede0[_0xb3e5('0x1b')](0xcc)[_0xb3e5('0x1c')]();});}};}function handleEntityNotFound(_0x4c812d,_0x2bbff2){return function(_0x1e57ca){if(!_0x1e57ca){_0x4c812d['sendStatus'](0x194);}return _0x1e57ca;};}function handleError(_0x55c35b,_0x2c5d50){_0x2c5d50=_0x2c5d50||0x1f4;return function(_0x29f33b){logger['error'](_0x29f33b[_0xb3e5('0x29')]);if(_0x29f33b[_0xb3e5('0x2a')]){delete _0x29f33b[_0xb3e5('0x2a')];}_0x55c35b['status'](_0x2c5d50)[_0xb3e5('0x2b')](_0x29f33b);};}exports[_0xb3e5('0x2c')]=function(_0x3d2509,_0x4dc42d){var _0x119261={},_0xf081aa={},_0x5c321e={'count':0x0,'rows':[]};var _0x1a26c4=_[_0xb3e5('0x2d')](db[_0xb3e5('0x2e')][_0xb3e5('0x2f')],function(_0x184de1){return{'name':_0x184de1[_0xb3e5('0x30')],'type':_0x184de1['type'][_0xb3e5('0x31')]};});_0xf081aa[_0xb3e5('0x32')]=_[_0xb3e5('0x2d')](_0x1a26c4,'name');_0xf081aa[_0xb3e5('0x33')]=_[_0xb3e5('0x34')](_0x3d2509[_0xb3e5('0x33')]);_0xf081aa['filters']=_[_0xb3e5('0x35')](_0xf081aa['model'],_0xf081aa[_0xb3e5('0x33')]);_0x119261['attributes']=_[_0xb3e5('0x35')](_0xf081aa[_0xb3e5('0x32')],qs[_0xb3e5('0x36')](_0x3d2509[_0xb3e5('0x33')][_0xb3e5('0x36')]));_0x119261[_0xb3e5('0x37')]=_0x119261[_0xb3e5('0x37')][_0xb3e5('0x38')]?_0x119261['attributes']:_0xf081aa[_0xb3e5('0x32')];if(!_0x3d2509[_0xb3e5('0x33')][_0xb3e5('0x39')](_0xb3e5('0x3a'))){_0x119261[_0xb3e5('0x21')]=qs[_0xb3e5('0x21')](_0x3d2509[_0xb3e5('0x33')][_0xb3e5('0x21')]);_0x119261['offset']=qs[_0xb3e5('0x1e')](_0x3d2509['query']['offset']);}_0x119261[_0xb3e5('0x3b')]=qs[_0xb3e5('0x3c')](_0x3d2509[_0xb3e5('0x33')][_0xb3e5('0x3c')]);_0x119261[_0xb3e5('0x3d')]=qs[_0xb3e5('0x3e')](_['pick'](_0x3d2509[_0xb3e5('0x33')],_0xf081aa[_0xb3e5('0x3e')]),_0x1a26c4);if(_0x3d2509[_0xb3e5('0x33')][_0xb3e5('0x3f')]){_0x119261['where']=_[_0xb3e5('0x40')](_0x119261[_0xb3e5('0x3d')],{'$or':_[_0xb3e5('0x2d')](_0x1a26c4,function(_0x41e4d9){if(_0x41e4d9['type']!==_0xb3e5('0x41')){var _0x5e5057={};_0x5e5057[_0x41e4d9[_0xb3e5('0x2a')]]={'$like':'%'+_0x3d2509[_0xb3e5('0x33')][_0xb3e5('0x3f')]+'%'};return _0x5e5057;}})});}_0x119261=_[_0xb3e5('0x40')]({},_0x119261,_0x3d2509['options']);var _0x44447f={'where':_0x119261[_0xb3e5('0x3d')]};return db[_0xb3e5('0x2e')][_0xb3e5('0x20')](_0x44447f)[_0xb3e5('0x28')](function(_0x33dc0e){_0x5c321e[_0xb3e5('0x20')]=_0x33dc0e;if(_0x3d2509['query'][_0xb3e5('0x42')]){_0x119261[_0xb3e5('0x43')]=[{'all':!![]}];}return db[_0xb3e5('0x2e')][_0xb3e5('0x44')](_0x119261);})[_0xb3e5('0x28')](function(_0x278b23){_0x5c321e[_0xb3e5('0x45')]=_0x278b23;return _0x5c321e;})[_0xb3e5('0x28')](respondWithFilteredResult(_0x4dc42d,_0x119261))['catch'](handleError(_0x4dc42d,null));};exports[_0xb3e5('0x46')]=function(_0x2b080c,_0x71afcb){var _0x46d179={'raw':!![],'where':{'id':_0x2b080c[_0xb3e5('0x47')]['id']}},_0x510552={};_0x510552['model']=_['keys'](db[_0xb3e5('0x2e')][_0xb3e5('0x2f')]);_0x510552[_0xb3e5('0x33')]=_[_0xb3e5('0x34')](_0x2b080c['query']);_0x510552[_0xb3e5('0x3e')]=_['intersection'](_0x510552['model'],_0x510552[_0xb3e5('0x33')]);_0x46d179[_0xb3e5('0x37')]=_[_0xb3e5('0x35')](_0x510552[_0xb3e5('0x32')],qs[_0xb3e5('0x36')](_0x2b080c['query']['fields']));_0x46d179[_0xb3e5('0x37')]=_0x46d179[_0xb3e5('0x37')][_0xb3e5('0x38')]?_0x46d179[_0xb3e5('0x37')]:_0x510552['model'];if(_0x2b080c[_0xb3e5('0x33')][_0xb3e5('0x42')]){_0x46d179[_0xb3e5('0x43')]=[{'all':!![]}];}_0x46d179=_['merge']({},_0x46d179,_0x2b080c[_0xb3e5('0x48')]);return db['CmHopperBlack'][_0xb3e5('0x49')](_0x46d179)['then'](handleEntityNotFound(_0x71afcb,null))[_0xb3e5('0x28')](respondWithResult(_0x71afcb,null))[_0xb3e5('0x4a')](handleError(_0x71afcb,null));};exports[_0xb3e5('0x27')]=function(_0x1c4908,_0x34e313){if(_0x1c4908[_0xb3e5('0x4b')]['id']){delete _0x1c4908['body']['id'];}return db[_0xb3e5('0x2e')][_0xb3e5('0x49')]({'where':{'id':_0x1c4908[_0xb3e5('0x47')]['id']}})[_0xb3e5('0x28')](handleEntityNotFound(_0x34e313,null))[_0xb3e5('0x28')](saveUpdates(_0x1c4908[_0xb3e5('0x4b')],null))[_0xb3e5('0x28')](respondWithResult(_0x34e313,null))[_0xb3e5('0x4a')](handleError(_0x34e313,null));};exports[_0xb3e5('0x4c')]=function(_0x15d8f2,_0x443987){return db[_0xb3e5('0x2e')][_0xb3e5('0x49')]({'where':{'id':_0x15d8f2[_0xb3e5('0x47')]['id']}})[_0xb3e5('0x28')](handleEntityNotFound(_0x443987,null))[_0xb3e5('0x28')](removeEntity(_0x443987,null))[_0xb3e5('0x4a')](handleError(_0x443987,null));};exports[_0xb3e5('0x4d')]=function(_0x435960,_0x526388){return db[_0xb3e5('0x2e')]['describe']()[_0xb3e5('0x28')](respondWithResult(_0x526388,null))[_0xb3e5('0x4a')](handleError(_0x526388,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 71efde2..e418290 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 _0x2145=['define','CmHopperBlack','cm_hopper_black','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0x7c6234,_0xa0ddf5){var _0x514f1e=function(_0xef0c2b){while(--_0xef0c2b){_0x7c6234['push'](_0x7c6234['shift']());}};_0x514f1e(++_0xa0ddf5);}(_0x2145,0x179));var _0x5214=function(_0x269112,_0x2cde11){_0x269112=_0x269112-0x0;var _0x219c30=_0x2145[_0x269112];return _0x219c30;};'use strict';var _=require('lodash');var util=require(_0x5214('0x0'));var logger=require(_0x5214('0x1'))('api');var moment=require(_0x5214('0x2'));var BPromise=require(_0x5214('0x3'));var rp=require(_0x5214('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5214('0x5'));var config=require(_0x5214('0x6'));var attributes=require(_0x5214('0x7'));module['exports']=function(_0xa44df7,_0x513568){return _0xa44df7[_0x5214('0x8')](_0x5214('0x9'),attributes,{'tableName':_0x5214('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cba=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperBlack','cm_hopper_black'];(function(_0xff6c6c,_0x13ea5e){var _0x110a47=function(_0x76c089){while(--_0x76c089){_0xff6c6c['push'](_0xff6c6c['shift']());}};_0x110a47(++_0x13ea5e);}(_0x1cba,0xd8));var _0xa1cb=function(_0x20e3cc,_0x591d40){_0x20e3cc=_0x20e3cc-0x0;var _0x4579d6=_0x1cba[_0x20e3cc];return _0x4579d6;};'use strict';var _=require(_0xa1cb('0x0'));var util=require('util');var logger=require(_0xa1cb('0x1'))('api');var moment=require(_0xa1cb('0x2'));var BPromise=require(_0xa1cb('0x3'));var rp=require(_0xa1cb('0x4'));var fs=require('fs');var path=require(_0xa1cb('0x5'));var rimraf=require(_0xa1cb('0x6'));var config=require(_0xa1cb('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0xa1cb('0x8')]=function(_0x15583e,_0x1e5662){return _0x15583e[_0xa1cb('0x9')](_0xa1cb('0xa'),attributes,{'tableName':_0xa1cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 5d00165..2991462 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 _0xbc19=['attributes','limit','include','map','model','debug','catch','update','UpdateCmHopperBlack','DestroyCmHopperBlack','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where'];(function(_0x3a5da5,_0x58eaa0){var _0x2de0e5=function(_0x2f1d09){while(--_0x2f1d09){_0x3a5da5['push'](_0x3a5da5['shift']());}};_0x2de0e5(++_0x58eaa0);}(_0xbc19,0x79));var _0x9bc1=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xbc19[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x9bc1('0x0'));var moment=require('moment');var BPromise=require(_0x9bc1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9bc1('0x2'));var db=require(_0x9bc1('0x3'))['db'];var utils=require(_0x9bc1('0x4'));var logger=require(_0x9bc1('0x5'))('rpc');var config=require(_0x9bc1('0x6'));var jayson=require(_0x9bc1('0x7'));var client=jayson[_0x9bc1('0x8')][_0x9bc1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x239f12,_0x33155c,_0x25d709){return new BPromise(function(_0x26d1f2,_0x5bae70){return client[_0x9bc1('0xa')](_0x239f12,_0x25d709)[_0x9bc1('0xb')](function(_0x4b2c1f){logger[_0x9bc1('0xc')](_0x9bc1('0xd'),_0x33155c,_0x9bc1('0xe'));logger['debug'](_0x9bc1('0xf'),_0x33155c,_0x9bc1('0xe'),JSON[_0x9bc1('0x10')](_0x4b2c1f));if(_0x4b2c1f[_0x9bc1('0x11')]){if(_0x4b2c1f['error'][_0x9bc1('0x12')]===0x1f4){logger[_0x9bc1('0x11')](_0x9bc1('0xd'),_0x33155c,_0x4b2c1f[_0x9bc1('0x11')][_0x9bc1('0x13')]);return _0x5bae70(_0x4b2c1f[_0x9bc1('0x11')][_0x9bc1('0x13')]);}logger[_0x9bc1('0x11')](_0x9bc1('0xd'),_0x33155c,_0x4b2c1f[_0x9bc1('0x11')][_0x9bc1('0x13')]);return _0x26d1f2(_0x4b2c1f[_0x9bc1('0x11')][_0x9bc1('0x13')]);}else{logger[_0x9bc1('0xc')](_0x9bc1('0xd'),_0x33155c,_0x9bc1('0xe'));_0x26d1f2(_0x4b2c1f[_0x9bc1('0x14')][_0x9bc1('0x13')]);}})['catch'](function(_0x4f89a8){logger[_0x9bc1('0x11')](_0x9bc1('0xd'),_0x33155c,_0x4f89a8);_0x5bae70(_0x4f89a8);});});}exports[_0x9bc1('0x15')]=function(_0x41bec7){var _0x2aa6b3=this;return new Promise(function(_0x352004,_0x5193a0){return db[_0x9bc1('0x16')][_0x9bc1('0x17')]({'raw':_0x41bec7['options']?_0x41bec7[_0x9bc1('0x18')][_0x9bc1('0x19')]===undefined?!![]:![]:!![],'where':_0x41bec7[_0x9bc1('0x18')]?_0x41bec7[_0x9bc1('0x18')][_0x9bc1('0x1a')]||null:null,'attributes':_0x41bec7[_0x9bc1('0x18')]?_0x41bec7[_0x9bc1('0x18')][_0x9bc1('0x1b')]||null:null,'limit':_0x41bec7[_0x9bc1('0x18')]?_0x41bec7[_0x9bc1('0x18')][_0x9bc1('0x1c')]||null:null,'include':_0x41bec7[_0x9bc1('0x18')]?_0x41bec7[_0x9bc1('0x18')][_0x9bc1('0x1d')]?_[_0x9bc1('0x1e')](_0x41bec7[_0x9bc1('0x18')][_0x9bc1('0x1d')],function(_0x276b4b){return{'model':db[_0x276b4b[_0x9bc1('0x1f')]],'as':_0x276b4b['as'],'attributes':_0x276b4b['attributes'],'include':_0x276b4b[_0x9bc1('0x1d')]?_['map'](_0x276b4b[_0x9bc1('0x1d')],function(_0x472419){return{'model':db[_0x472419[_0x9bc1('0x1f')]],'as':_0x472419['as'],'attributes':_0x472419[_0x9bc1('0x1b')],'include':_0x472419['include']?_[_0x9bc1('0x1e')](_0x472419[_0x9bc1('0x1d')],function(_0x23c99d){return{'model':db[_0x23c99d[_0x9bc1('0x1f')]],'as':_0x23c99d['as'],'attributes':_0x23c99d['attributes']};}):[]};}):[]};}):[]:[]})[_0x9bc1('0xb')](function(_0x58061d){logger[_0x9bc1('0xc')](_0x9bc1('0x15'),_0x41bec7);logger[_0x9bc1('0x20')]('GetCmHopperBlack',_0x41bec7,JSON[_0x9bc1('0x10')](_0x58061d));_0x352004(_0x58061d);})[_0x9bc1('0x21')](function(_0x1e7db7){logger['error']('GetCmHopperBlack',_0x1e7db7[_0x9bc1('0x13')],_0x41bec7);_0x5193a0(_0x2aa6b3[_0x9bc1('0x11')](0x1f4,_0x1e7db7[_0x9bc1('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x3743c9){var _0x511111=this;return new Promise(function(_0x6ab88a,_0x539b62){return db[_0x9bc1('0x16')][_0x9bc1('0x22')](_0x3743c9['body'],{'raw':_0x3743c9[_0x9bc1('0x18')]?_0x3743c9[_0x9bc1('0x18')][_0x9bc1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3743c9[_0x9bc1('0x18')]?_0x3743c9[_0x9bc1('0x18')][_0x9bc1('0x1a')]||null:null,'attributes':_0x3743c9['options']?_0x3743c9[_0x9bc1('0x18')]['attributes']||null:null,'limit':_0x3743c9['options']?_0x3743c9[_0x9bc1('0x18')][_0x9bc1('0x1c')]||null:null})[_0x9bc1('0xb')](function(_0x2d4679){logger[_0x9bc1('0xc')](_0x9bc1('0x23'),_0x3743c9);logger[_0x9bc1('0x20')](_0x9bc1('0x23'),_0x3743c9,JSON['stringify'](_0x2d4679));_0x6ab88a(_0x2d4679);})[_0x9bc1('0x21')](function(_0x233317){logger['error'](_0x9bc1('0x23'),_0x233317[_0x9bc1('0x13')],_0x3743c9);_0x539b62(_0x511111[_0x9bc1('0x11')](0x1f4,_0x233317[_0x9bc1('0x13')]));});});};exports[_0x9bc1('0x24')]=function(_0x355cca){var _0x393b71=this;return new Promise(function(_0x4addd2,_0x347d81){return db[_0x9bc1('0x16')]['destroy']({'where':_0x355cca[_0x9bc1('0x18')]?_0x355cca[_0x9bc1('0x18')][_0x9bc1('0x1a')]||null:null})[_0x9bc1('0xb')](function(_0x3c3c5e){logger['info'](_0x9bc1('0x24'),_0x355cca);logger[_0x9bc1('0x20')](_0x9bc1('0x24'),_0x355cca,JSON['stringify'](_0x3c3c5e));_0x4addd2(_0x3c3c5e);})[_0x9bc1('0x21')](function(_0x4ab53d){logger[_0x9bc1('0x11')](_0x9bc1('0x24'),_0x4ab53d['message'],_0x355cca);_0x347d81(_0x393b71[_0x9bc1('0x11')](0x1f4,_0x4ab53d[_0x9bc1('0x13')]));});});}; \ No newline at end of file +var _0xdd61=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','findAll','options','raw','attributes','limit','include','map','model','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','CmHopperBlack','destroy','where','lodash','moment','bluebird'];(function(_0xb410f,_0x573d1d){var _0x3f6c79=function(_0x30a5c1){while(--_0x30a5c1){_0xb410f['push'](_0xb410f['shift']());}};_0x3f6c79(++_0x573d1d);}(_0xdd61,0x1aa));var _0x1dd6=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xdd61[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x1dd6('0x0'));var util=require('util');var moment=require(_0x1dd6('0x1'));var BPromise=require(_0x1dd6('0x2'));var rs=require(_0x1dd6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1dd6('0x4'))['db'];var utils=require(_0x1dd6('0x5'));var logger=require(_0x1dd6('0x6'))('rpc');var config=require(_0x1dd6('0x7'));var jayson=require(_0x1dd6('0x8'));var client=jayson[_0x1dd6('0x9')][_0x1dd6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20567d,_0x586234,_0x2770f0){return new BPromise(function(_0xe49fa3,_0x4b84f5){return client['request'](_0x20567d,_0x2770f0)[_0x1dd6('0xb')](function(_0x4268b9){logger[_0x1dd6('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x586234,_0x1dd6('0xd'));logger[_0x1dd6('0xe')](_0x1dd6('0xf'),_0x586234,_0x1dd6('0xd'),JSON[_0x1dd6('0x10')](_0x4268b9));if(_0x4268b9[_0x1dd6('0x11')]){if(_0x4268b9[_0x1dd6('0x11')][_0x1dd6('0x12')]===0x1f4){logger['error'](_0x1dd6('0x13'),_0x586234,_0x4268b9[_0x1dd6('0x11')][_0x1dd6('0x14')]);return _0x4b84f5(_0x4268b9['error'][_0x1dd6('0x14')]);}logger[_0x1dd6('0x11')](_0x1dd6('0x13'),_0x586234,_0x4268b9[_0x1dd6('0x11')][_0x1dd6('0x14')]);return _0xe49fa3(_0x4268b9[_0x1dd6('0x11')][_0x1dd6('0x14')]);}else{logger[_0x1dd6('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x586234,_0x1dd6('0xd'));_0xe49fa3(_0x4268b9[_0x1dd6('0x15')][_0x1dd6('0x14')]);}})[_0x1dd6('0x16')](function(_0xa0123c){logger[_0x1dd6('0x11')](_0x1dd6('0x13'),_0x586234,_0xa0123c);_0x4b84f5(_0xa0123c);});});}exports[_0x1dd6('0x17')]=function(_0x132c18){var _0x491d19=this;return new Promise(function(_0x349e5c,_0xccd210){return db['CmHopperBlack'][_0x1dd6('0x18')]({'raw':_0x132c18[_0x1dd6('0x19')]?_0x132c18[_0x1dd6('0x19')][_0x1dd6('0x1a')]===undefined?!![]:![]:!![],'where':_0x132c18[_0x1dd6('0x19')]?_0x132c18[_0x1dd6('0x19')]['where']||null:null,'attributes':_0x132c18[_0x1dd6('0x19')]?_0x132c18[_0x1dd6('0x19')][_0x1dd6('0x1b')]||null:null,'limit':_0x132c18[_0x1dd6('0x19')]?_0x132c18[_0x1dd6('0x19')][_0x1dd6('0x1c')]||null:null,'include':_0x132c18[_0x1dd6('0x19')]?_0x132c18[_0x1dd6('0x19')][_0x1dd6('0x1d')]?_[_0x1dd6('0x1e')](_0x132c18[_0x1dd6('0x19')][_0x1dd6('0x1d')],function(_0x780ebe){return{'model':db[_0x780ebe['model']],'as':_0x780ebe['as'],'attributes':_0x780ebe[_0x1dd6('0x1b')],'include':_0x780ebe[_0x1dd6('0x1d')]?_[_0x1dd6('0x1e')](_0x780ebe[_0x1dd6('0x1d')],function(_0x330557){return{'model':db[_0x330557[_0x1dd6('0x1f')]],'as':_0x330557['as'],'attributes':_0x330557[_0x1dd6('0x1b')],'include':_0x330557['include']?_[_0x1dd6('0x1e')](_0x330557[_0x1dd6('0x1d')],function(_0x25dcec){return{'model':db[_0x25dcec[_0x1dd6('0x1f')]],'as':_0x25dcec['as'],'attributes':_0x25dcec[_0x1dd6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1dd6('0xb')](function(_0x5f0643){logger['info'](_0x1dd6('0x17'),_0x132c18);logger[_0x1dd6('0xe')]('GetCmHopperBlack',_0x132c18,JSON[_0x1dd6('0x10')](_0x5f0643));_0x349e5c(_0x5f0643);})[_0x1dd6('0x16')](function(_0x1ebccb){logger[_0x1dd6('0x11')](_0x1dd6('0x17'),_0x1ebccb[_0x1dd6('0x14')],_0x132c18);_0xccd210(_0x491d19['error'](0x1f4,_0x1ebccb[_0x1dd6('0x14')]));});});};exports[_0x1dd6('0x20')]=function(_0x1ed358){var _0x4b6e31=this;return new Promise(function(_0x40f03a,_0xe6214d){return db['CmHopperBlack'][_0x1dd6('0x21')](_0x1ed358[_0x1dd6('0x22')],{'raw':_0x1ed358[_0x1dd6('0x19')]?_0x1ed358['options'][_0x1dd6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ed358['options']?_0x1ed358[_0x1dd6('0x19')]['where']||null:null,'attributes':_0x1ed358[_0x1dd6('0x19')]?_0x1ed358[_0x1dd6('0x19')]['attributes']||null:null,'limit':_0x1ed358['options']?_0x1ed358['options'][_0x1dd6('0x1c')]||null:null})[_0x1dd6('0xb')](function(_0x49dfcb){logger[_0x1dd6('0xc')](_0x1dd6('0x20'),_0x1ed358);logger[_0x1dd6('0xe')](_0x1dd6('0x20'),_0x1ed358,JSON[_0x1dd6('0x10')](_0x49dfcb));_0x40f03a(_0x49dfcb);})[_0x1dd6('0x16')](function(_0x581dc4){logger['error'](_0x1dd6('0x20'),_0x581dc4[_0x1dd6('0x14')],_0x1ed358);_0xe6214d(_0x4b6e31[_0x1dd6('0x11')](0x1f4,_0x581dc4[_0x1dd6('0x14')]));});});};exports[_0x1dd6('0x23')]=function(_0x4c9f49){var _0x5783fa=this;return new Promise(function(_0x39f97a,_0xcb7d2b){return db[_0x1dd6('0x24')][_0x1dd6('0x25')]({'where':_0x4c9f49['options']?_0x4c9f49['options'][_0x1dd6('0x26')]||null:null})[_0x1dd6('0xb')](function(_0x4860b5){logger[_0x1dd6('0xc')](_0x1dd6('0x23'),_0x4c9f49);logger[_0x1dd6('0xe')](_0x1dd6('0x23'),_0x4c9f49,JSON[_0x1dd6('0x10')](_0x4860b5));_0x39f97a(_0x4860b5);})[_0x1dd6('0x16')](function(_0x32286c){logger[_0x1dd6('0x11')](_0x1dd6('0x23'),_0x32286c[_0x1dd6('0x14')],_0x4c9f49);_0xcb7d2b(_0x5783fa[_0x1dd6('0x11')](0x1f4,_0x32286c['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index ec23ef2..e3a50a2 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 _0x5496=['../../config/environment','./cmHopperBlack.controller','index','get','isAuthenticated','describe','show','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x1b995b,_0x3d20b7){var _0x127993=function(_0x1399a4){while(--_0x1399a4){_0x1b995b['push'](_0x1b995b['shift']());}};_0x127993(++_0x3d20b7);}(_0x5496,0x175));var _0x6549=function(_0x18cd31,_0x43893f){_0x18cd31=_0x18cd31-0x0;var _0x392b3b=_0x5496[_0x18cd31];return _0x392b3b;};'use strict';var multer=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var path=require(_0x6549('0x2'));var timeout=require(_0x6549('0x3'));var express=require(_0x6549('0x4'));var router=express['Router']();var fs_extra=require(_0x6549('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var controller=require(_0x6549('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6549('0x9')]);router[_0x6549('0xa')]('/describe',auth[_0x6549('0xb')](),controller[_0x6549('0xc')]);router[_0x6549('0xa')]('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0xd')]);router[_0x6549('0xe')](_0x6549('0xf'),auth[_0x6549('0xb')](),controller[_0x6549('0x10')]);router['delete']('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0x11')]);module[_0x6549('0x12')]=router; \ No newline at end of file +var _0xc4aa=['isAuthenticated','index','/describe','/:id','show','update','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x575d91,_0x8bc34a){var _0x5ecb6c=function(_0x109333){while(--_0x109333){_0x575d91['push'](_0x575d91['shift']());}};_0x5ecb6c(++_0x8bc34a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['put'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router['delete'](_0xac4a('0xc'),auth['isAuthenticated'](),controller[_0xac4a('0xf')]);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 f5e94b3..ab592f3 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 _0xc284=['DATE','STRING','endtime','followuptime','seconds','setDataValue','BOOLEAN','sequelize','moment','INTEGER'];(function(_0x42d2af,_0x3961b5){var _0x1d6d63=function(_0x10833e){while(--_0x10833e){_0x42d2af['push'](_0x42d2af['shift']());}};_0x1d6d63(++_0x3961b5);}(_0xc284,0x101));var _0x4c28=function(_0x2ffb46,_0x441e67){_0x2ffb46=_0x2ffb46-0x0;var _0x1e35be=_0xc284[_0x2ffb46];return _0x1e35be;};'use strict';var Sequelize=require(_0x4c28('0x0'));var moment=require(_0x4c28('0x1'));module['exports']={'state':{'type':Sequelize[_0x4c28('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x4c28('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4c28('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4c28('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4c28('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x4c28('0x4')]},'originatecalleridname':{'type':Sequelize[_0x4c28('0x4')]},'calleridnum':{'type':Sequelize[_0x4c28('0x4')]},'calleridname':{'type':Sequelize[_0x4c28('0x4')]},'starttime':{'type':Sequelize[_0x4c28('0x3')]},'responsetime':{'type':Sequelize[_0x4c28('0x3')]},'answertime':{'type':Sequelize[_0x4c28('0x3')]},'droptime':{'type':Sequelize[_0x4c28('0x3')]},'endtime':{'type':Sequelize[_0x4c28('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4c28('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4c28('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4c28('0x4')]},'campaign':{'type':Sequelize[_0x4c28('0x4')]},'campaigntype':{'type':Sequelize[_0x4c28('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x4c28('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4c28('0x4')]},'dispositionat':{'type':Sequelize[_0x4c28('0x3')],'set':function(_0x4e1d3d){var _0x527d10=this['getDataValue'](_0x4c28('0x5'));if(_0x527d10&&_0x4e1d3d){this['setDataValue'](_0x4c28('0x6'),moment(_0x4e1d3d)['diff'](moment(_0x527d10),_0x4c28('0x7')));}return this[_0x4c28('0x8')]('dispositionat',_0x4e1d3d);}},'amd':{'type':Sequelize[_0x4c28('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4c28('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x4c28('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x4c28('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x4c28('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4c28('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4c28('0x3')]},'deleted':{'type':Sequelize[_0x4c28('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x4c28('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x4c28('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4c28('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4c28('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xda08=['seconds','BOOLEAN','moment','exports','INTEGER','STRING','DATE','setDataValue','followuptime','diff'];(function(_0xb0c9a8,_0x2389d4){var _0x2d7285=function(_0x58e0ed){while(--_0x58e0ed){_0xb0c9a8['push'](_0xb0c9a8['shift']());}};_0x2d7285(++_0x2389d4);}(_0xda08,0x1a6));var _0x8da0=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xda08[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8da0('0x0'));module[_0x8da0('0x1')]={'state':{'type':Sequelize[_0x8da0('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8da0('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8da0('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8da0('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x8da0('0x3')]},'calleridnum':{'type':Sequelize[_0x8da0('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8da0('0x4')]},'responsetime':{'type':Sequelize[_0x8da0('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x8da0('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x8da0('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8da0('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8da0('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8da0('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8da0('0x3')]},'campaign':{'type':Sequelize[_0x8da0('0x3')]},'campaigntype':{'type':Sequelize[_0x8da0('0x3')]},'membername':{'type':Sequelize[_0x8da0('0x3')]},'reason':{'type':Sequelize[_0x8da0('0x3')]},'disposition':{'type':Sequelize[_0x8da0('0x3')]},'secondDisposition':{'type':Sequelize[_0x8da0('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x8da0('0x4')],'set':function(_0x64ba3a){var _0x583470=this['getDataValue']('endtime');if(_0x583470&&_0x64ba3a){this[_0x8da0('0x5')](_0x8da0('0x6'),moment(_0x64ba3a)[_0x8da0('0x7')](moment(_0x583470),_0x8da0('0x8')));}return this[_0x8da0('0x5')]('dispositionat',_0x64ba3a);}},'amd':{'type':Sequelize[_0x8da0('0x9')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x8da0('0x4')]},'callback':{'type':Sequelize[_0x8da0('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8da0('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8da0('0x4')]},'deleted':{'type':Sequelize[_0x8da0('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8da0('0x4')]},'recallme':{'type':Sequelize[_0x8da0('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8da0('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x8da0('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8da0('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8da0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8da0('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8da0('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 9583ac0..7e4e18c 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 _0xbd51=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','from','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','then','includeAll','include','rows','show','params','keys','length','catch','describe','body','uniqueid','find','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','`state`\x20=\x208,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','scheduledAt'];(function(_0x1a5835,_0x323006){var _0x2aba14=function(_0xd092d4){while(--_0xd092d4){_0x1a5835['push'](_0x1a5835['shift']());}};_0x2aba14(++_0x323006);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x447fc1,_0x4ac546){_0x447fc1=_0x447fc1-0x0;var _0x4c77e3=_0xbd51[_0x447fc1];return _0x4c77e3;};'use strict';var emlformat=require(_0x1bd5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bd5('0x1'));var jsonpatch=require(_0x1bd5('0x2'));var rp=require(_0x1bd5('0x3'));var moment=require(_0x1bd5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1bd5('0x5'));var csv=require(_0x1bd5('0x6'));var ejs=require(_0x1bd5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1bd5('0x8'));var squel=require(_0x1bd5('0x9'));var crypto=require(_0x1bd5('0xa'));var jsforce=require(_0x1bd5('0xb'));var deskjs=require(_0x1bd5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1bd5('0xd'));var Papa=require('papaparse');var Redis=require(_0x1bd5('0xe'));var authService=require(_0x1bd5('0xf'));var qs=require(_0x1bd5('0x10'));var as=require(_0x1bd5('0x11'));var hardwareService=require(_0x1bd5('0x12'));var logger=require(_0x1bd5('0x13'))('api');var utils=require(_0x1bd5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1bd5('0x15'));var db=require(_0x1bd5('0x16'))['db'];function respondWithStatusCode(_0x37e8e1,_0x14606b){_0x14606b=_0x14606b||0xcc;return function(_0x177be0){if(_0x177be0){return _0x37e8e1[_0x1bd5('0x17')](_0x14606b);}return _0x37e8e1[_0x1bd5('0x18')](_0x14606b)['end']();};}function respondWithResult(_0x5650b5,_0x8b2390){_0x8b2390=_0x8b2390||0xc8;return function(_0x6d2c40){if(_0x6d2c40){return _0x5650b5[_0x1bd5('0x18')](_0x8b2390)[_0x1bd5('0x19')](_0x6d2c40);}};}function respondWithFilteredResult(_0x48d048,_0x5072c2){return function(_0xa63190){if(_0xa63190){var _0xc7277e=typeof _0x5072c2[_0x1bd5('0x1a')]===_0x1bd5('0x1b')&&typeof _0x5072c2[_0x1bd5('0x1c')]===_0x1bd5('0x1b');var _0x13cf34=_0xa63190[_0x1bd5('0x1d')];var _0x4670b5=_0xc7277e?0x0:_0x5072c2['offset'];var _0x53ad5e=_0xc7277e?_0xa63190[_0x1bd5('0x1d')]:_0x5072c2[_0x1bd5('0x1a')]+_0x5072c2[_0x1bd5('0x1c')];var _0xb95d4e;if(_0x53ad5e>=_0x13cf34){_0x53ad5e=_0x13cf34;_0xb95d4e=0xc8;}else{_0xb95d4e=0xce;}_0x48d048[_0x1bd5('0x18')](_0xb95d4e);return _0x48d048[_0x1bd5('0x1e')](_0x1bd5('0x1f'),_0x4670b5+'-'+_0x53ad5e+'/'+_0x13cf34)[_0x1bd5('0x19')](_0xa63190);}return null;};}function patchUpdates(_0x456051){return function(_0xb1ac1e){try{jsonpatch[_0x1bd5('0x20')](_0xb1ac1e,_0x456051,!![]);}catch(_0x2447c4){return BPromise[_0x1bd5('0x21')](_0x2447c4);}return _0xb1ac1e[_0x1bd5('0x22')]();};}function saveUpdates(_0x253d79,_0x46c580){return function(_0x1f13e7){if(_0x1f13e7){return _0x1f13e7[_0x1bd5('0x23')](_0x253d79)['then'](function(_0x42c43d){return _0x42c43d;});}return null;};}function removeEntity(_0x50c663,_0x18fd18){return function(_0x1e534e){if(_0x1e534e){return _0x1e534e[_0x1bd5('0x24')]()['then'](function(){_0x50c663[_0x1bd5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed551,_0x30676d){return function(_0x3dba4f){if(!_0x3dba4f){_0x2ed551[_0x1bd5('0x17')](0x194);}return _0x3dba4f;};}function handleError(_0x47c84b,_0x202ed3){_0x202ed3=_0x202ed3||0x1f4;return function(_0x69bb17){logger[_0x1bd5('0x25')](_0x69bb17[_0x1bd5('0x26')]);if(_0x69bb17['name']){delete _0x69bb17[_0x1bd5('0x27')];}_0x47c84b[_0x1bd5('0x18')](_0x202ed3)[_0x1bd5('0x28')](_0x69bb17);};}exports[_0x1bd5('0x29')]=function(_0xe54b9f,_0xc73670){var _0x4e72b2={},_0x289097={},_0x472b22={'count':0x0,'rows':[]};var _0x8d53ba=_['map'](db[_0x1bd5('0x2a')][_0x1bd5('0x2b')],function(_0x345181){return{'name':_0x345181[_0x1bd5('0x2c')],'type':_0x345181[_0x1bd5('0x2d')][_0x1bd5('0x2e')]};});_0x289097['model']=_['map'](_0x8d53ba,_0x1bd5('0x27'));_0x289097[_0x1bd5('0x2f')]=_['keys'](_0xe54b9f[_0x1bd5('0x2f')]);_0x289097[_0x1bd5('0x30')]=_[_0x1bd5('0x31')](_0x289097[_0x1bd5('0x32')],_0x289097['query']);_0x4e72b2[_0x1bd5('0x33')]=_[_0x1bd5('0x31')](_0x289097[_0x1bd5('0x32')],qs[_0x1bd5('0x34')](_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x34')]));_0x4e72b2[_0x1bd5('0x33')]=_0x4e72b2[_0x1bd5('0x33')]['length']?_0x4e72b2[_0x1bd5('0x33')]:_0x289097[_0x1bd5('0x32')];if(!_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x35')](_0x1bd5('0x36'))){_0x4e72b2[_0x1bd5('0x1c')]=qs[_0x1bd5('0x1c')](_0xe54b9f['query'][_0x1bd5('0x1c')]);_0x4e72b2[_0x1bd5('0x1a')]=qs[_0x1bd5('0x1a')](_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x1a')]);}_0x4e72b2[_0x1bd5('0x37')]=qs[_0x1bd5('0x38')](_0xe54b9f['query']['sort']);_0x4e72b2[_0x1bd5('0x39')]=qs[_0x1bd5('0x30')](_[_0x1bd5('0x3a')](_0xe54b9f['query'],_0x289097[_0x1bd5('0x30')]),_0x8d53ba);if(_0xe54b9f['query'][_0x1bd5('0x3b')]){_0x4e72b2[_0x1bd5('0x39')]=_[_0x1bd5('0x3c')](_0x4e72b2[_0x1bd5('0x39')],{'$or':_[_0x1bd5('0x3d')](_0x8d53ba,function(_0x2470ec){if(_0x2470ec[_0x1bd5('0x2d')]!==_0x1bd5('0x3e')){var _0x4bbefc={};_0x4bbefc[_0x2470ec[_0x1bd5('0x27')]]={'$like':'%'+_0xe54b9f[_0x1bd5('0x2f')]['filter']+'%'};return _0x4bbefc;}})});}_0x4e72b2=_[_0x1bd5('0x3c')]({},_0x4e72b2,_0xe54b9f[_0x1bd5('0x3f')]);var _0x20b25c={'where':_0x4e72b2['where']};return db[_0x1bd5('0x2a')][_0x1bd5('0x1d')](_0x20b25c)[_0x1bd5('0x40')](function(_0x4074f1){_0x472b22['count']=_0x4074f1;if(_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x41')]){_0x4e72b2[_0x1bd5('0x42')]=[{'all':!![]}];}return db[_0x1bd5('0x2a')]['findAll'](_0x4e72b2);})['then'](function(_0x40eeff){_0x472b22[_0x1bd5('0x43')]=_0x40eeff;return _0x472b22;})[_0x1bd5('0x40')](respondWithFilteredResult(_0xc73670,_0x4e72b2))['catch'](handleError(_0xc73670,null));};exports[_0x1bd5('0x44')]=function(_0x3b1092,_0x574d95){var _0x1eacac={'raw':!![],'where':{'id':_0x3b1092[_0x1bd5('0x45')]['id']}},_0x5761b8={};_0x5761b8[_0x1bd5('0x32')]=_['keys'](db[_0x1bd5('0x2a')][_0x1bd5('0x2b')]);_0x5761b8[_0x1bd5('0x2f')]=_[_0x1bd5('0x46')](_0x3b1092[_0x1bd5('0x2f')]);_0x5761b8[_0x1bd5('0x30')]=_[_0x1bd5('0x31')](_0x5761b8[_0x1bd5('0x32')],_0x5761b8[_0x1bd5('0x2f')]);_0x1eacac[_0x1bd5('0x33')]=_[_0x1bd5('0x31')](_0x5761b8[_0x1bd5('0x32')],qs['fields'](_0x3b1092[_0x1bd5('0x2f')][_0x1bd5('0x34')]));_0x1eacac[_0x1bd5('0x33')]=_0x1eacac['attributes'][_0x1bd5('0x47')]?_0x1eacac[_0x1bd5('0x33')]:_0x5761b8['model'];if(_0x3b1092[_0x1bd5('0x2f')]['includeAll']){_0x1eacac[_0x1bd5('0x42')]=[{'all':!![]}];}_0x1eacac=_['merge']({},_0x1eacac,_0x3b1092[_0x1bd5('0x3f')]);return db[_0x1bd5('0x2a')]['find'](_0x1eacac)[_0x1bd5('0x40')](handleEntityNotFound(_0x574d95,null))['then'](respondWithResult(_0x574d95,null))[_0x1bd5('0x48')](handleError(_0x574d95,null));};exports[_0x1bd5('0x49')]=function(_0x1a29f3,_0xe71454){return db[_0x1bd5('0x2a')][_0x1bd5('0x49')]()[_0x1bd5('0x40')](respondWithResult(_0xe71454,null))[_0x1bd5('0x48')](handleError(_0xe71454,null));};exports['update']=function(_0x13985e,_0x227a68){if(_0x13985e[_0x1bd5('0x4a')][_0x1bd5('0x4b')]){delete _0x13985e[_0x1bd5('0x4a')][_0x1bd5('0x4b')];}return db['CmHopperFinal'][_0x1bd5('0x4c')]({'where':{'uniqueid':_0x13985e[_0x1bd5('0x45')]['id']}})[_0x1bd5('0x40')](handleEntityNotFound(_0x227a68,null))[_0x1bd5('0x40')](saveUpdates(_0x13985e[_0x1bd5('0x4a')],null))[_0x1bd5('0x40')](respondWithResult(_0x227a68,null))[_0x1bd5('0x48')](handleError(_0x227a68,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x587c46,_0x126221,_0x2d713b){return db[_0x1bd5('0x2a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x587c46[_0x1bd5('0x45')]['id']},'attributes':[[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x50')))),'noSuchContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')]['literal'](_0x1bd5('0x51')))),'noAnswerContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x52')))),_0x1bd5('0x53')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')]('`state`\x20=\x208,\x201,\x20null'))),_0x1bd5('0x54')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x55')))),_0x1bd5('0x56')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x57')))),_0x1bd5('0x58')],[db['sequelize']['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x59')))),'reCallContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x5a')))),_0x1bd5('0x5b')]]})[_0x1bd5('0x40')](handleEntityNotFound(_0x126221,null))['then'](respondWithResult(_0x126221,null))['catch'](handleError(_0x126221,null));};exports[_0x1bd5('0x5c')]=function(_0xec9fac,_0x1790af,_0x54a8c4){return db['CmHopperFinal'][_0x1bd5('0x5d')]({'raw':![],'where':{'CampaignId':_0xec9fac['params']['id']},'attributes':[[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')]['literal'](_0x1bd5('0x50')))),'noSuchContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x5e')))),'congestionContacts'],[db['sequelize']['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x55')))),'dropContacts'],[db[_0x1bd5('0x4d')]['fn']('COUNT',db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x57')))),'abandonedContacts'],[db['sequelize']['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x59')))),_0x1bd5('0x5f')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x5a')))),_0x1bd5('0x5b')]]})[_0x1bd5('0x40')](handleEntityNotFound(_0x1790af,null))[_0x1bd5('0x40')](respondWithResult(_0x1790af,null))[_0x1bd5('0x48')](handleError(_0x1790af,null));};exports[_0x1bd5('0x60')]=function(_0x195176,_0x393a8f,_0x1ffbab){return db[_0x1bd5('0x61')][_0x1bd5('0x4c')]({'where':{'id':_0x195176[_0x1bd5('0x45')]['id']}})[_0x1bd5('0x40')](handleEntityNotFound(_0x393a8f,null))['then'](function(_0x3bd058){var _0x1d6223;if(_0x3bd058){_0x1d6223=squel[_0x1bd5('0x62')]()[_0x1bd5('0x63')](_0x1bd5('0x64'))[_0x1bd5('0x65')]([_0x1bd5('0x66'),'scheduledAt',_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x69'),_0x1bd5('0x6a'),'updatedAt'],squel[_0x1bd5('0x6b')]()[_0x1bd5('0x6c')](_0x1bd5('0x6d'),_0x1bd5('0x66'))[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x6f'))['field'](_0x1bd5('0x70'),'ContactId')['field'](_0x1bd5('0x71'),'ListId')[_0x1bd5('0x6c')](_0x1bd5('0x72'),'VoiceQueueId')[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x6a'))[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x73'))['from'](_0x1bd5('0x74'))[_0x1bd5('0x39')](_0x1bd5('0x75'),_0x195176[_0x1bd5('0x45')]['id']['toString']())['where'](_0x1bd5('0x76'),_0x195176[_0x1bd5('0x4a')][_0x1bd5('0x77')][_0x1bd5('0x78')]())['where'](_0x1bd5('0x79'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1bd5('0x6b')]()['field'](_0x1bd5('0x66'))[_0x1bd5('0x7a')](_0x1bd5('0x64'))[_0x1bd5('0x39')](_0x1bd5('0x75'),_0x195176[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]()))[_0x1bd5('0x39')](_0x1bd5('0x7b'),squel['select']()[_0x1bd5('0x6c')]('calleridnum')['from']('cm_hopper_final')[_0x1bd5('0x39')]('VoiceQueueId\x20=\x20?',_0x195176[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]())[_0x1bd5('0x39')](_0x1bd5('0x7c')))[_0x1bd5('0x7d')](_0x1bd5('0x67')))[_0x1bd5('0x78')]();return db['sequelize'][_0x1bd5('0x2f')](_0x1d6223);}return[];})['then'](respondWithResult(_0x393a8f,null))[_0x1bd5('0x48')](handleError(_0x393a8f,null));};exports[_0x1bd5('0x7e')]=function(_0x7d097,_0x50f2ac,_0x5db61c){return db[_0x1bd5('0x7f')]['find']({'where':{'id':_0x7d097[_0x1bd5('0x45')]['id']}})['then'](handleEntityNotFound(_0x50f2ac,null))[_0x1bd5('0x40')](function(_0x16f996){var _0x248d66;if(_0x16f996){_0x248d66=squel[_0x1bd5('0x62')]()[_0x1bd5('0x63')](_0x1bd5('0x64'))[_0x1bd5('0x65')]([_0x1bd5('0x66'),_0x1bd5('0x6f'),_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x80'),_0x1bd5('0x6a'),_0x1bd5('0x73')],squel['select']()[_0x1bd5('0x6c')](_0x1bd5('0x6d'),_0x1bd5('0x66'))['field'](_0x1bd5('0x6e'),_0x1bd5('0x6f'))['field'](_0x1bd5('0x70'),_0x1bd5('0x67'))[_0x1bd5('0x6c')]('ANY_VALUE(ListId)',_0x1bd5('0x68'))[_0x1bd5('0x6c')](_0x1bd5('0x81'),_0x1bd5('0x80'))['field'](_0x1bd5('0x6e'),_0x1bd5('0x6a'))[_0x1bd5('0x6c')]('NOW()',_0x1bd5('0x73'))[_0x1bd5('0x7a')]('cm_hopper_final')['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id']['toString']())['where'](_0x1bd5('0x76'),_0x7d097['body']['state'][_0x1bd5('0x78')]())['where'](_0x1bd5('0x79'))[_0x1bd5('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1bd5('0x6b')]()[_0x1bd5('0x6c')](_0x1bd5('0x66'))['from'](_0x1bd5('0x64'))['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]()))[_0x1bd5('0x39')](_0x1bd5('0x7b'),squel['select']()[_0x1bd5('0x6c')]('calleridnum')[_0x1bd5('0x7a')]('cm_hopper_final')['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]())[_0x1bd5('0x39')]('state\x20=\x204'))[_0x1bd5('0x7d')](_0x1bd5('0x67')))[_0x1bd5('0x78')]();return db[_0x1bd5('0x4d')][_0x1bd5('0x2f')](_0x248d66);}return[];})[_0x1bd5('0x40')](respondWithResult(_0x50f2ac,null))[_0x1bd5('0x48')](handleError(_0x50f2ac,null));};exports[_0x1bd5('0x83')]=function(_0x22e1f4,_0x347d06,_0x3cf023){return db[_0x1bd5('0x84')][_0x1bd5('0x85')]({'where':{'VoiceQueueId':_0x22e1f4[_0x1bd5('0x4a')]['VoiceQueueId'],'CampaignId':_0x22e1f4[_0x1bd5('0x4a')][_0x1bd5('0x80')],'ContactId':_0x22e1f4[_0x1bd5('0x4a')][_0x1bd5('0x67')]}})[_0x1bd5('0x40')](handleEntityNotFound(_0x347d06,null))[_0x1bd5('0x40')](function(_0x28f567){if(_0x28f567){return _0x28f567;}return null;})[_0x1bd5('0x40')](respondWithResult(_0x347d06,null))[_0x1bd5('0x48')](handleError(_0x347d06,null));}; \ No newline at end of file +var _0xfcf0=['noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','state\x20=\x20?','state','toString','VoiceQueueId\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ListId','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','describe','body','uniqueid','find','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null'];(function(_0x93be41,_0x46c7f2){var _0x5cf92a=function(_0x38096a){while(--_0x38096a){_0x93be41['push'](_0x93be41['shift']());}};_0x5cf92a(++_0x46c7f2);}(_0xfcf0,0x138));var _0x0fcf=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xfcf0[_0xa6cc5c];return _0x44803d;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':!![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')]()[_0x0fcf('0x24')](respondWithResult(_0x345188,null))['catch'](handleError(_0x345188,null));};exports['update']=function(_0x259c91,_0x243699){if(_0x259c91[_0x0fcf('0x47')][_0x0fcf('0x48')]){delete _0x259c91[_0x0fcf('0x47')][_0x0fcf('0x48')];}return db['CmHopperFinal'][_0x0fcf('0x49')]({'where':{'uniqueid':_0x259c91[_0x0fcf('0x43')]['id']}})['then'](handleEntityNotFound(_0x243699,null))[_0x0fcf('0x24')](saveUpdates(_0x259c91[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x243699,null))[_0x0fcf('0x42')](handleError(_0x243699,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0xc514bf,_0x382448,_0x1bb062){return db[_0x0fcf('0x2b')][_0x0fcf('0x4a')]({'raw':![],'where':{'VoiceQueueId':_0xc514bf[_0x0fcf('0x43')]['id']},'attributes':[[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x4e')))),_0x0fcf('0x4f')],[db[_0x0fcf('0x4b')]['fn']('COUNT',db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x50')))),_0x0fcf('0x51')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db['sequelize']['fn']('IF',db[_0x0fcf('0x4b')]['literal'](_0x0fcf('0x52')))),_0x0fcf('0x53')],[db['sequelize']['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x54')))),_0x0fcf('0x55')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x0fcf('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x0fcf('0x56')],[db[_0x0fcf('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x57')))),'abandonedContacts'],[db[_0x0fcf('0x4b')]['fn']('COUNT',db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')]('`state`\x20=\x2022,\x201,\x20null'))),_0x0fcf('0x58')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x59')))),_0x0fcf('0x5a')]]})[_0x0fcf('0x24')](handleEntityNotFound(_0x382448,null))[_0x0fcf('0x24')](respondWithResult(_0x382448,null))[_0x0fcf('0x42')](handleError(_0x382448,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x62d12e,_0x1dda2e,_0x6af0f5){return db[_0x0fcf('0x2b')][_0x0fcf('0x4a')]({'raw':![],'where':{'CampaignId':_0x62d12e[_0x0fcf('0x43')]['id']},'attributes':[[db[_0x0fcf('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0x0fcf('0x4f')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x50')))),_0x0fcf('0x51')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x52')))),_0x0fcf('0x53')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x54')))),_0x0fcf('0x55')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x5b')))),_0x0fcf('0x56')],[db['sequelize']['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x57')))),_0x0fcf('0x5c')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x0fcf('0x4b')]['fn']('COUNT',db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x0fcf('0x24')](handleEntityNotFound(_0x1dda2e,null))[_0x0fcf('0x24')](respondWithResult(_0x1dda2e,null))['catch'](handleError(_0x1dda2e,null));};exports[_0x0fcf('0x5d')]=function(_0x3cb75a,_0x5936a6,_0x3d02c1){return db[_0x0fcf('0x5e')][_0x0fcf('0x49')]({'where':{'id':_0x3cb75a[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x5936a6,null))[_0x0fcf('0x24')](function(_0x4704c9){var _0x4b1f10;if(_0x4704c9){_0x4b1f10=squel[_0x0fcf('0x5f')]()[_0x0fcf('0x60')](_0x0fcf('0x61'))[_0x0fcf('0x62')]([_0x0fcf('0x63'),_0x0fcf('0x64'),'ContactId','ListId',_0x0fcf('0x65'),_0x0fcf('0x66'),_0x0fcf('0x67')],squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x69'),_0x0fcf('0x63'))[_0x0fcf('0x6a')](_0x0fcf('0x6b'),_0x0fcf('0x64'))['field']('ANY_VALUE(ContactId)',_0x0fcf('0x6c'))['field'](_0x0fcf('0x6d'),'ListId')[_0x0fcf('0x6a')](_0x0fcf('0x6e'),_0x0fcf('0x65'))[_0x0fcf('0x6a')](_0x0fcf('0x6b'),'createdAt')[_0x0fcf('0x6a')](_0x0fcf('0x6b'),_0x0fcf('0x67'))[_0x0fcf('0x6f')]('cm_hopper_final')[_0x0fcf('0x3d')]('VoiceQueueId\x20=\x20?',_0x3cb75a[_0x0fcf('0x43')]['id']['toString']())[_0x0fcf('0x3d')](_0x0fcf('0x70'),_0x3cb75a['body'][_0x0fcf('0x71')][_0x0fcf('0x72')]())[_0x0fcf('0x3d')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x63'))[_0x0fcf('0x6f')](_0x0fcf('0x61'))[_0x0fcf('0x3d')](_0x0fcf('0x73'),_0x3cb75a[_0x0fcf('0x43')]['id'][_0x0fcf('0x72')]()))[_0x0fcf('0x3d')](_0x0fcf('0x74'),squel['select']()[_0x0fcf('0x6a')](_0x0fcf('0x75'))[_0x0fcf('0x6f')](_0x0fcf('0x76'))[_0x0fcf('0x3d')](_0x0fcf('0x73'),_0x3cb75a[_0x0fcf('0x43')]['id'][_0x0fcf('0x72')]())['where'](_0x0fcf('0x77')))[_0x0fcf('0x78')](_0x0fcf('0x6c')))[_0x0fcf('0x72')]();return db[_0x0fcf('0x4b')][_0x0fcf('0x33')](_0x4b1f10);}return[];})[_0x0fcf('0x24')](respondWithResult(_0x5936a6,null))['catch'](handleError(_0x5936a6,null));};exports[_0x0fcf('0x79')]=function(_0x489c6d,_0x18645d,_0x9e933e){return db[_0x0fcf('0x7a')]['find']({'where':{'id':_0x489c6d['params']['id']}})['then'](handleEntityNotFound(_0x18645d,null))['then'](function(_0x301991){var _0x46bcc2;if(_0x301991){_0x46bcc2=squel[_0x0fcf('0x5f')]()[_0x0fcf('0x60')](_0x0fcf('0x61'))[_0x0fcf('0x62')]([_0x0fcf('0x63'),_0x0fcf('0x64'),_0x0fcf('0x6c'),_0x0fcf('0x7b'),_0x0fcf('0x7c'),'createdAt',_0x0fcf('0x67')],squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x69'),'phone')[_0x0fcf('0x6a')](_0x0fcf('0x6b'),'scheduledAt')['field'](_0x0fcf('0x7d'),_0x0fcf('0x6c'))['field'](_0x0fcf('0x6d'),_0x0fcf('0x7b'))[_0x0fcf('0x6a')](_0x0fcf('0x7e'),_0x0fcf('0x7c'))[_0x0fcf('0x6a')](_0x0fcf('0x6b'),_0x0fcf('0x66'))['field'](_0x0fcf('0x6b'),_0x0fcf('0x67'))[_0x0fcf('0x6f')](_0x0fcf('0x76'))['where'](_0x0fcf('0x7f'),_0x489c6d['params']['id']['toString']())['where'](_0x0fcf('0x70'),_0x489c6d[_0x0fcf('0x47')][_0x0fcf('0x71')][_0x0fcf('0x72')]())[_0x0fcf('0x3d')](_0x0fcf('0x80'))[_0x0fcf('0x3d')](_0x0fcf('0x74'),squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x63'))[_0x0fcf('0x6f')](_0x0fcf('0x61'))[_0x0fcf('0x3d')](_0x0fcf('0x7f'),_0x489c6d[_0x0fcf('0x43')]['id'][_0x0fcf('0x72')]()))[_0x0fcf('0x3d')](_0x0fcf('0x74'),squel['select']()['field']('calleridnum')[_0x0fcf('0x6f')](_0x0fcf('0x76'))[_0x0fcf('0x3d')](_0x0fcf('0x7f'),_0x489c6d['params']['id']['toString']())['where'](_0x0fcf('0x77')))['group'](_0x0fcf('0x6c')))['toString']();return db[_0x0fcf('0x4b')]['query'](_0x46bcc2);}return[];})[_0x0fcf('0x24')](respondWithResult(_0x18645d,null))['catch'](handleError(_0x18645d,null));};exports['checkContactHopper']=function(_0x426625,_0x4ccae3,_0x2905fa){return db[_0x0fcf('0x81')][_0x0fcf('0x82')]({'where':{'VoiceQueueId':_0x426625[_0x0fcf('0x47')][_0x0fcf('0x65')],'CampaignId':_0x426625[_0x0fcf('0x47')][_0x0fcf('0x7c')],'ContactId':_0x426625[_0x0fcf('0x47')][_0x0fcf('0x6c')]}})[_0x0fcf('0x24')](handleEntityNotFound(_0x4ccae3,null))[_0x0fcf('0x24')](function(_0x274aa9){if(_0x274aa9){return _0x274aa9;}return null;})[_0x0fcf('0x24')](respondWithResult(_0x4ccae3,null))['catch'](handleError(_0x4ccae3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 127460e..6d1d698 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 _0x45c5=['define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x142ec2,_0x5bb03d){var _0x45ef4e=function(_0x4bc513){while(--_0x4bc513){_0x142ec2['push'](_0x142ec2['shift']());}};_0x45ef4e(++_0x5bb03d);}(_0x45c5,0xd5));var _0x545c=function(_0x18c6ba,_0x1cbb9e){_0x18c6ba=_0x18c6ba-0x0;var _0x225f1d=_0x45c5[_0x18c6ba];return _0x225f1d;};'use strict';var _=require(_0x545c('0x0'));var util=require(_0x545c('0x1'));var logger=require(_0x545c('0x2'))(_0x545c('0x3'));var moment=require(_0x545c('0x4'));var BPromise=require(_0x545c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x545c('0x6'));var rimraf=require(_0x545c('0x7'));var config=require(_0x545c('0x8'));var attributes=require(_0x545c('0x9'));module[_0x545c('0xa')]=function(_0x32dab4,_0x322b2d){return _0x32dab4[_0x545c('0xb')](_0x545c('0xc'),attributes,{'tableName':_0x545c('0xd'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x545c('0xe')]},{'name':_0x545c('0xf'),'fields':[_0x545c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x36e6=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./cmHopperFinal.attributes','exports','define'];(function(_0x306a55,_0x21e0a8){var _0x44daa2=function(_0x5331cc){while(--_0x5331cc){_0x306a55['push'](_0x306a55['shift']());}};_0x44daa2(++_0x21e0a8);}(_0x36e6,0x138));var _0x636e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36e6[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x636e('0x0'));var util=require(_0x636e('0x1'));var logger=require(_0x636e('0x2'))('api');var moment=require(_0x636e('0x3'));var BPromise=require(_0x636e('0x4'));var rp=require(_0x636e('0x5'));var fs=require('fs');var path=require(_0x636e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x636e('0x7'));module[_0x636e('0x8')]=function(_0x1147a3,_0x12cbc8){return _0x1147a3[_0x636e('0x9')](_0x636e('0xa'),attributes,{'tableName':_0x636e('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x636e('0xc')]},{'name':_0x636e('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index c725799..a357c47 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x474ffa,_0x1e32ec){var _0x4cc3ee=function(_0x3ada1f){while(--_0x3ada1f){_0x474ffa['push'](_0x474ffa['shift']());}};_0x4cc3ee(++_0x1e32ec);}(_0xb10b,0x12a));var _0xbb10=function(_0x37bf65,_0x220141){_0x37bf65=_0x37bf65-0x0;var _0x45a736=_0xb10b[_0x37bf65];return _0x45a736;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x2f2704,_0x476b8d){var _0x58c1cd=function(_0x5ce3dd){while(--_0x5ce3dd){_0x2f2704['push'](_0x2f2704['shift']());}};_0x58c1cd(++_0x476b8d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c9f56,_0x198760){_0x3c9f56=_0x3c9f56-0x0;var _0x33f1be=_0xb10b[_0x3c9f56];return _0x33f1be;};'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 e999a97..8b35985 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 _0xa200=['put','update','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper','checkContactHopper'];(function(_0x2f4b8d,_0x513ac6){var _0x44cc73=function(_0x426811){while(--_0x426811){_0x2f4b8d['push'](_0x2f4b8d['shift']());}};_0x44cc73(++_0x513ac6);}(_0xa200,0xd3));var _0x0a20=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa200[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0x0a20('0x0'));var path=require(_0x0a20('0x1'));var timeout=require(_0x0a20('0x2'));var express=require(_0x0a20('0x3'));var router=express['Router']();var fs_extra=require(_0x0a20('0x4'));var auth=require(_0x0a20('0x5'));var interaction=require(_0x0a20('0x6'));var config=require(_0x0a20('0x7'));var controller=require(_0x0a20('0x8'));router[_0x0a20('0x9')]('/',auth[_0x0a20('0xa')](),controller[_0x0a20('0xb')]);router[_0x0a20('0x9')](_0x0a20('0xc'),auth[_0x0a20('0xa')](),controller[_0x0a20('0xd')]);router[_0x0a20('0x9')](_0x0a20('0xe'),auth[_0x0a20('0xa')](),controller[_0x0a20('0xf')]);router[_0x0a20('0x9')]('/voice/queue/countAttributes/:id',auth[_0x0a20('0xa')](),controller[_0x0a20('0x10')]);router[_0x0a20('0x9')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0x0a20('0x11')]);router[_0x0a20('0x12')](_0x0a20('0x13'),auth[_0x0a20('0xa')](),controller[_0x0a20('0x14')]);router[_0x0a20('0x12')]('/voice/campaign/moveContacts/:id',auth[_0x0a20('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x0a20('0x12')](_0x0a20('0x15'),auth['isAuthenticated'](),controller[_0x0a20('0x16')]);router[_0x0a20('0x17')]('/:id',auth[_0x0a20('0xa')](),controller[_0x0a20('0x18')]);module[_0x0a20('0x19')]=router; \ No newline at end of file +var _0x6acc=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','get','/describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','exports','multer'];(function(_0x2a2ebb,_0x65031f){var _0x1dca2d=function(_0x6175bf){while(--_0x6175bf){_0x2a2ebb['push'](_0x2a2ebb['shift']());}};_0x1dca2d(++_0x65031f);}(_0x6acc,0x167));var _0xc6ac=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x6acc[_0x8a969d];return _0x1d8dc7;};'use strict';var multer=require(_0xc6ac('0x0'));var util=require(_0xc6ac('0x1'));var path=require(_0xc6ac('0x2'));var timeout=require(_0xc6ac('0x3'));var express=require(_0xc6ac('0x4'));var router=express['Router']();var fs_extra=require(_0xc6ac('0x5'));var auth=require(_0xc6ac('0x6'));var interaction=require(_0xc6ac('0x7'));var config=require(_0xc6ac('0x8'));var controller=require(_0xc6ac('0x9'));router['get']('/',auth[_0xc6ac('0xa')](),controller['index']);router[_0xc6ac('0xb')](_0xc6ac('0xc'),auth[_0xc6ac('0xa')](),controller['describe']);router[_0xc6ac('0xb')](_0xc6ac('0xd'),auth[_0xc6ac('0xa')](),controller[_0xc6ac('0xe')]);router[_0xc6ac('0xb')](_0xc6ac('0xf'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0xc6ac('0xb')](_0xc6ac('0x10'),auth[_0xc6ac('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xc6ac('0x11')]('/voice/queue/moveContacts/:id',auth[_0xc6ac('0xa')](),controller[_0xc6ac('0x12')]);router[_0xc6ac('0x11')](_0xc6ac('0x13'),auth[_0xc6ac('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0xc6ac('0x14'),auth[_0xc6ac('0xa')](),controller[_0xc6ac('0x15')]);router[_0xc6ac('0x16')](_0xc6ac('0xd'),auth['isAuthenticated'](),controller['update']);module[_0xc6ac('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 015b169..2f15a6d 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 _0x3411=['BOOLEAN','exports','STRING','DATE','INTEGER'];(function(_0x1faaa1,_0x1568dd){var _0x994ec=function(_0x298ef4){while(--_0x298ef4){_0x1faaa1['push'](_0x1faaa1['shift']());}};_0x994ec(++_0x1568dd);}(_0x3411,0x105));var _0x1341=function(_0x749b25,_0x4670b0){_0x749b25=_0x749b25-0x0;var _0x4daa11=_0x3411[_0x749b25];return _0x4daa11;};'use strict';var Sequelize=require('sequelize');module[_0x1341('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x1341('0x1')]},'scheduledat':{'type':Sequelize[_0x1341('0x2')]},'countbusyretry':{'type':Sequelize[_0x1341('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1341('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1341('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1341('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x1341('0x1')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1341('0x1')]},'calleridname':{'type':Sequelize[_0x1341('0x1')]},'starttime':{'type':Sequelize[_0x1341('0x2')]},'responsetime':{'type':Sequelize[_0x1341('0x2')]},'answertime':{'type':Sequelize[_0x1341('0x2')]},'droptime':{'type':Sequelize[_0x1341('0x2')]},'endtime':{'type':Sequelize[_0x1341('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1341('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1341('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x1341('0x1')]},'campaigntype':{'type':Sequelize[_0x1341('0x1')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x1341('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x1341('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1341('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1341('0x2')]},'recallme':{'type':Sequelize[_0x1341('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x1341('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1341('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1341('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1341('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1341('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1341('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1341('0x1')]}}; \ No newline at end of file +var _0xbdc1=['DATE','BOOLEAN','sequelize','INTEGER','STRING'];(function(_0x3ead12,_0x153779){var _0x359ebb=function(_0x1e4114){while(--_0x1e4114){_0x3ead12['push'](_0x3ead12['shift']());}};_0x359ebb(++_0x153779);}(_0xbdc1,0x147));var _0x1bdc=function(_0x175855,_0x25add7){_0x175855=_0x175855-0x0;var _0x5cdc1a=_0xbdc1[_0x175855];return _0x5cdc1a;};'use strict';var Sequelize=require(_0x1bdc('0x0'));module['exports']={'state':{'type':Sequelize[_0x1bdc('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x1bdc('0x2')]},'scheduledat':{'type':Sequelize[_0x1bdc('0x3')]},'countbusyretry':{'type':Sequelize[_0x1bdc('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1bdc('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1bdc('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x1bdc('0x2')]},'originatecalleridname':{'type':Sequelize[_0x1bdc('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1bdc('0x2')]},'starttime':{'type':Sequelize[_0x1bdc('0x3')]},'responsetime':{'type':Sequelize[_0x1bdc('0x3')]},'answertime':{'type':Sequelize[_0x1bdc('0x3')]},'droptime':{'type':Sequelize[_0x1bdc('0x3')]},'endtime':{'type':Sequelize[_0x1bdc('0x3')]},'ringtime':{'type':Sequelize[_0x1bdc('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1bdc('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1bdc('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1bdc('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1bdc('0x2')]},'campaign':{'type':Sequelize[_0x1bdc('0x2')]},'campaigntype':{'type':Sequelize[_0x1bdc('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x1bdc('0x2')]},'amd':{'type':Sequelize[_0x1bdc('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1bdc('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x1bdc('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1bdc('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1bdc('0x3')]},'recallme':{'type':Sequelize[_0x1bdc('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x1bdc('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1bdc('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1bdc('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1bdc('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1bdc('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 8c78a5e..f1ec662 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 _0x2e12=['query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','show','params','keys','intersection','find','catch','create','body','describe','update','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','json','reject','save','destroy','then','sendStatus','error','name','send','index','map','CmHopperHistory','rawAttributes','type','key'];(function(_0x3b30c7,_0x1e5cfe){var _0x525108=function(_0x57b08c){while(--_0x57b08c){_0x3b30c7['push'](_0x3b30c7['shift']());}};_0x525108(++_0x1e5cfe);}(_0x2e12,0x14d));var _0x22e1=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x2e12[_0x54d4a8];return _0x3b321b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22e1('0x0'));var zipdir=require(_0x22e1('0x1'));var jsonpatch=require(_0x22e1('0x2'));var rp=require(_0x22e1('0x3'));var moment=require(_0x22e1('0x4'));var BPromise=require(_0x22e1('0x5'));var Mustache=require(_0x22e1('0x6'));var util=require(_0x22e1('0x7'));var path=require(_0x22e1('0x8'));var sox=require(_0x22e1('0x9'));var csv=require(_0x22e1('0xa'));var ejs=require(_0x22e1('0xb'));var fs=require('fs');var fs_extra=require(_0x22e1('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x22e1('0xd'));var jsforce=require(_0x22e1('0xe'));var deskjs=require(_0x22e1('0xf'));var toCsv=require(_0x22e1('0xa'));var querystring=require('querystring');var Papa=require(_0x22e1('0x10'));var Redis=require(_0x22e1('0x11'));var authService=require(_0x22e1('0x12'));var qs=require(_0x22e1('0x13'));var as=require(_0x22e1('0x14'));var hardwareService=require(_0x22e1('0x15'));var logger=require('../../config/logger')(_0x22e1('0x16'));var utils=require('../../config/utils');var config=require(_0x22e1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x22e1('0x18'))['db'];function respondWithStatusCode(_0x4f64f0,_0x41ce03){_0x41ce03=_0x41ce03||0xcc;return function(_0x1f58d6){if(_0x1f58d6){return _0x4f64f0['sendStatus'](_0x41ce03);}return _0x4f64f0[_0x22e1('0x19')](_0x41ce03)[_0x22e1('0x1a')]();};}function respondWithResult(_0x57decb,_0x3f7f7d){_0x3f7f7d=_0x3f7f7d||0xc8;return function(_0xbed264){if(_0xbed264){return _0x57decb[_0x22e1('0x19')](_0x3f7f7d)['json'](_0xbed264);}};}function respondWithFilteredResult(_0x17df6f,_0x7b32bf){return function(_0x4f583c){if(_0x4f583c){var _0x1afaa5=typeof _0x7b32bf[_0x22e1('0x1b')]===_0x22e1('0x1c')&&typeof _0x7b32bf['limit']===_0x22e1('0x1c');var _0x1496aa=_0x4f583c[_0x22e1('0x1d')];var _0x5442d7=_0x1afaa5?0x0:_0x7b32bf[_0x22e1('0x1b')];var _0x403a94=_0x1afaa5?_0x4f583c[_0x22e1('0x1d')]:_0x7b32bf[_0x22e1('0x1b')]+_0x7b32bf[_0x22e1('0x1e')];var _0x3fc5c5;if(_0x403a94>=_0x1496aa){_0x403a94=_0x1496aa;_0x3fc5c5=0xc8;}else{_0x3fc5c5=0xce;}_0x17df6f[_0x22e1('0x19')](_0x3fc5c5);return _0x17df6f[_0x22e1('0x1f')]('Content-Range',_0x5442d7+'-'+_0x403a94+'/'+_0x1496aa)[_0x22e1('0x20')](_0x4f583c);}return null;};}function patchUpdates(_0x459f29){return function(_0x595415){try{jsonpatch['apply'](_0x595415,_0x459f29,!![]);}catch(_0x4436a1){return BPromise[_0x22e1('0x21')](_0x4436a1);}return _0x595415[_0x22e1('0x22')]();};}function saveUpdates(_0x3de792,_0x2bf1dd){return function(_0x1d83e6){if(_0x1d83e6){return _0x1d83e6['update'](_0x3de792)['then'](function(_0xf3896c){return _0xf3896c;});}return null;};}function removeEntity(_0x186a04,_0x273ec9){return function(_0x2a3d0d){if(_0x2a3d0d){return _0x2a3d0d[_0x22e1('0x23')]()[_0x22e1('0x24')](function(){_0x186a04[_0x22e1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eb2dc,_0x52e08b){return function(_0x4244c7){if(!_0x4244c7){_0x5eb2dc[_0x22e1('0x25')](0x194);}return _0x4244c7;};}function handleError(_0x67fab9,_0x1e6801){_0x1e6801=_0x1e6801||0x1f4;return function(_0x5f59cf){logger[_0x22e1('0x26')](_0x5f59cf['stack']);if(_0x5f59cf[_0x22e1('0x27')]){delete _0x5f59cf['name'];}_0x67fab9[_0x22e1('0x19')](_0x1e6801)[_0x22e1('0x28')](_0x5f59cf);};}exports[_0x22e1('0x29')]=function(_0x5b61f4,_0x4f33ed){var _0x418e12={},_0x2c501e={},_0x50d01c={'count':0x0,'rows':[]};var _0x4167ae=_[_0x22e1('0x2a')](db[_0x22e1('0x2b')][_0x22e1('0x2c')],function(_0x1c09d0){return{'name':_0x1c09d0['fieldName'],'type':_0x1c09d0[_0x22e1('0x2d')][_0x22e1('0x2e')]};});_0x2c501e['model']=_[_0x22e1('0x2a')](_0x4167ae,_0x22e1('0x27'));_0x2c501e[_0x22e1('0x2f')]=_['keys'](_0x5b61f4[_0x22e1('0x2f')]);_0x2c501e[_0x22e1('0x30')]=_['intersection'](_0x2c501e[_0x22e1('0x31')],_0x2c501e[_0x22e1('0x2f')]);_0x418e12[_0x22e1('0x32')]=_['intersection'](_0x2c501e[_0x22e1('0x31')],qs[_0x22e1('0x33')](_0x5b61f4[_0x22e1('0x2f')][_0x22e1('0x33')]));_0x418e12[_0x22e1('0x32')]=_0x418e12[_0x22e1('0x32')][_0x22e1('0x34')]?_0x418e12[_0x22e1('0x32')]:_0x2c501e['model'];if(!_0x5b61f4[_0x22e1('0x2f')][_0x22e1('0x35')](_0x22e1('0x36'))){_0x418e12[_0x22e1('0x1e')]=qs['limit'](_0x5b61f4['query'][_0x22e1('0x1e')]);_0x418e12[_0x22e1('0x1b')]=qs['offset'](_0x5b61f4[_0x22e1('0x2f')][_0x22e1('0x1b')]);}_0x418e12[_0x22e1('0x37')]=qs[_0x22e1('0x38')](_0x5b61f4[_0x22e1('0x2f')][_0x22e1('0x38')]);_0x418e12[_0x22e1('0x39')]=qs[_0x22e1('0x30')](_[_0x22e1('0x3a')](_0x5b61f4['query'],_0x2c501e[_0x22e1('0x30')]),_0x4167ae);if(_0x5b61f4['query']['filter']){_0x418e12[_0x22e1('0x39')]=_[_0x22e1('0x3b')](_0x418e12[_0x22e1('0x39')],{'$or':_[_0x22e1('0x2a')](_0x4167ae,function(_0x303aea){if(_0x303aea[_0x22e1('0x2d')]!=='VIRTUAL'){var _0x25815c={};_0x25815c[_0x303aea[_0x22e1('0x27')]]={'$like':'%'+_0x5b61f4[_0x22e1('0x2f')][_0x22e1('0x3c')]+'%'};return _0x25815c;}})});}_0x418e12=_[_0x22e1('0x3b')]({},_0x418e12,_0x5b61f4[_0x22e1('0x3d')]);var _0x32e597={'where':_0x418e12[_0x22e1('0x39')]};return db[_0x22e1('0x2b')][_0x22e1('0x1d')](_0x32e597)[_0x22e1('0x24')](function(_0x49bb8d){_0x50d01c[_0x22e1('0x1d')]=_0x49bb8d;if(_0x5b61f4[_0x22e1('0x2f')][_0x22e1('0x3e')]){_0x418e12[_0x22e1('0x3f')]=[{'all':!![]}];}return db[_0x22e1('0x2b')]['findAll'](_0x418e12);})[_0x22e1('0x24')](function(_0x15f564){_0x50d01c[_0x22e1('0x40')]=_0x15f564;return _0x50d01c;})[_0x22e1('0x24')](respondWithFilteredResult(_0x4f33ed,_0x418e12))['catch'](handleError(_0x4f33ed,null));};exports[_0x22e1('0x41')]=function(_0x1bcb81,_0xe528ce){var _0x438b24={'raw':!![],'where':{'id':_0x1bcb81[_0x22e1('0x42')]['id']}},_0x14cb9f={};_0x14cb9f[_0x22e1('0x31')]=_[_0x22e1('0x43')](db[_0x22e1('0x2b')][_0x22e1('0x2c')]);_0x14cb9f[_0x22e1('0x2f')]=_[_0x22e1('0x43')](_0x1bcb81[_0x22e1('0x2f')]);_0x14cb9f[_0x22e1('0x30')]=_['intersection'](_0x14cb9f[_0x22e1('0x31')],_0x14cb9f[_0x22e1('0x2f')]);_0x438b24['attributes']=_[_0x22e1('0x44')](_0x14cb9f[_0x22e1('0x31')],qs[_0x22e1('0x33')](_0x1bcb81['query'][_0x22e1('0x33')]));_0x438b24['attributes']=_0x438b24[_0x22e1('0x32')]['length']?_0x438b24[_0x22e1('0x32')]:_0x14cb9f[_0x22e1('0x31')];if(_0x1bcb81[_0x22e1('0x2f')]['includeAll']){_0x438b24[_0x22e1('0x3f')]=[{'all':!![]}];}_0x438b24=_['merge']({},_0x438b24,_0x1bcb81[_0x22e1('0x3d')]);return db[_0x22e1('0x2b')][_0x22e1('0x45')](_0x438b24)['then'](handleEntityNotFound(_0xe528ce,null))[_0x22e1('0x24')](respondWithResult(_0xe528ce,null))[_0x22e1('0x46')](handleError(_0xe528ce,null));};exports['create']=function(_0x66f08a,_0x361c7e){return db[_0x22e1('0x2b')][_0x22e1('0x47')](_0x66f08a[_0x22e1('0x48')],{})[_0x22e1('0x24')](respondWithResult(_0x361c7e,0xc9))[_0x22e1('0x46')](handleError(_0x361c7e,null));};exports[_0x22e1('0x49')]=function(_0x52dcca,_0x2687b6){return db[_0x22e1('0x2b')][_0x22e1('0x49')]()[_0x22e1('0x24')](respondWithResult(_0x2687b6,null))[_0x22e1('0x46')](handleError(_0x2687b6,null));};exports[_0x22e1('0x4a')]=function(_0x54bfca,_0x4696c9){if(_0x54bfca[_0x22e1('0x48')][_0x22e1('0x4b')]){delete _0x54bfca[_0x22e1('0x48')][_0x22e1('0x4b')];}return db[_0x22e1('0x2b')]['find']({'where':{'uniqueid':_0x54bfca[_0x22e1('0x42')]['id']}})['then'](handleEntityNotFound(_0x4696c9,null))[_0x22e1('0x24')](saveUpdates(_0x54bfca[_0x22e1('0x48')],null))[_0x22e1('0x24')](respondWithResult(_0x4696c9,null))[_0x22e1('0x46')](handleError(_0x4696c9,null));}; \ No newline at end of file +var _0xc38f=['undefined','count','set','Content-Range','reject','save','update','then','end','error','stack','name','send','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperHistory','includeAll','include','findAll','show','params','find','catch','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc38f,0xc6));var _0xfc38=function(_0xd88aa6,_0x37d167){_0xd88aa6=_0xd88aa6-0x0;var _0x17f85e=_0xc38f[_0xd88aa6];return _0x17f85e;};'use strict';var emlformat=require(_0xfc38('0x0'));var rimraf=require(_0xfc38('0x1'));var zipdir=require(_0xfc38('0x2'));var jsonpatch=require(_0xfc38('0x3'));var rp=require(_0xfc38('0x4'));var moment=require('moment');var BPromise=require(_0xfc38('0x5'));var Mustache=require(_0xfc38('0x6'));var util=require(_0xfc38('0x7'));var path=require(_0xfc38('0x8'));var sox=require(_0xfc38('0x9'));var csv=require(_0xfc38('0xa'));var ejs=require(_0xfc38('0xb'));var fs=require('fs');var fs_extra=require(_0xfc38('0xc'));var _=require(_0xfc38('0xd'));var squel=require(_0xfc38('0xe'));var crypto=require(_0xfc38('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xfc38('0x10'));var toCsv=require('to-csv');var querystring=require(_0xfc38('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfc38('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfc38('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc38('0x14'))(_0xfc38('0x15'));var utils=require(_0xfc38('0x16'));var config=require(_0xfc38('0x17'));var licenseUtil=require(_0xfc38('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4956c,_0x2cdf06){_0x2cdf06=_0x2cdf06||0xcc;return function(_0x117dbb){if(_0x117dbb){return _0x4956c[_0xfc38('0x19')](_0x2cdf06);}return _0x4956c[_0xfc38('0x1a')](_0x2cdf06)['end']();};}function respondWithResult(_0x2870d5,_0x3a0b6b){_0x3a0b6b=_0x3a0b6b||0xc8;return function(_0x555fa6){if(_0x555fa6){return _0x2870d5['status'](_0x3a0b6b)[_0xfc38('0x1b')](_0x555fa6);}};}function respondWithFilteredResult(_0x1ff7cf,_0x557292){return function(_0x5cd595){if(_0x5cd595){var _0x211021=typeof _0x557292[_0xfc38('0x1c')]==='undefined'&&typeof _0x557292[_0xfc38('0x1d')]===_0xfc38('0x1e');var _0x2299bc=_0x5cd595[_0xfc38('0x1f')];var _0xbf7d5d=_0x211021?0x0:_0x557292[_0xfc38('0x1c')];var _0x14f77e=_0x211021?_0x5cd595[_0xfc38('0x1f')]:_0x557292[_0xfc38('0x1c')]+_0x557292[_0xfc38('0x1d')];var _0x1cee7b;if(_0x14f77e>=_0x2299bc){_0x14f77e=_0x2299bc;_0x1cee7b=0xc8;}else{_0x1cee7b=0xce;}_0x1ff7cf[_0xfc38('0x1a')](_0x1cee7b);return _0x1ff7cf[_0xfc38('0x20')](_0xfc38('0x21'),_0xbf7d5d+'-'+_0x14f77e+'/'+_0x2299bc)['json'](_0x5cd595);}return null;};}function patchUpdates(_0x1f09ce){return function(_0x22b982){try{jsonpatch['apply'](_0x22b982,_0x1f09ce,!![]);}catch(_0x8a84ac){return BPromise[_0xfc38('0x22')](_0x8a84ac);}return _0x22b982[_0xfc38('0x23')]();};}function saveUpdates(_0x5d3ea7,_0x4c55d2){return function(_0x51ddfe){if(_0x51ddfe){return _0x51ddfe[_0xfc38('0x24')](_0x5d3ea7)[_0xfc38('0x25')](function(_0x426479){return _0x426479;});}return null;};}function removeEntity(_0x741d36,_0x31bfc6){return function(_0x1565f6){if(_0x1565f6){return _0x1565f6['destroy']()[_0xfc38('0x25')](function(){_0x741d36[_0xfc38('0x1a')](0xcc)[_0xfc38('0x26')]();});}};}function handleEntityNotFound(_0x2bdc32,_0x4d5696){return function(_0x4dd91a){if(!_0x4dd91a){_0x2bdc32[_0xfc38('0x19')](0x194);}return _0x4dd91a;};}function handleError(_0x563e35,_0x343e38){_0x343e38=_0x343e38||0x1f4;return function(_0x4af512){logger[_0xfc38('0x27')](_0x4af512[_0xfc38('0x28')]);if(_0x4af512['name']){delete _0x4af512[_0xfc38('0x29')];}_0x563e35[_0xfc38('0x1a')](_0x343e38)[_0xfc38('0x2a')](_0x4af512);};}exports['index']=function(_0x267adc,_0x147b02){var _0x3709e7={},_0x2cddc9={},_0x4dd6ad={'count':0x0,'rows':[]};var _0x8c0f74=_['map'](db['CmHopperHistory'][_0xfc38('0x2b')],function(_0x35c72c){return{'name':_0x35c72c['fieldName'],'type':_0x35c72c[_0xfc38('0x2c')][_0xfc38('0x2d')]};});_0x2cddc9[_0xfc38('0x2e')]=_[_0xfc38('0x2f')](_0x8c0f74,_0xfc38('0x29'));_0x2cddc9['query']=_[_0xfc38('0x30')](_0x267adc[_0xfc38('0x31')]);_0x2cddc9[_0xfc38('0x32')]=_[_0xfc38('0x33')](_0x2cddc9['model'],_0x2cddc9[_0xfc38('0x31')]);_0x3709e7[_0xfc38('0x34')]=_[_0xfc38('0x33')](_0x2cddc9['model'],qs['fields'](_0x267adc[_0xfc38('0x31')][_0xfc38('0x35')]));_0x3709e7[_0xfc38('0x34')]=_0x3709e7['attributes'][_0xfc38('0x36')]?_0x3709e7[_0xfc38('0x34')]:_0x2cddc9[_0xfc38('0x2e')];if(!_0x267adc[_0xfc38('0x31')][_0xfc38('0x37')](_0xfc38('0x38'))){_0x3709e7[_0xfc38('0x1d')]=qs[_0xfc38('0x1d')](_0x267adc[_0xfc38('0x31')][_0xfc38('0x1d')]);_0x3709e7[_0xfc38('0x1c')]=qs[_0xfc38('0x1c')](_0x267adc[_0xfc38('0x31')][_0xfc38('0x1c')]);}_0x3709e7['order']=qs['sort'](_0x267adc[_0xfc38('0x31')][_0xfc38('0x39')]);_0x3709e7[_0xfc38('0x3a')]=qs[_0xfc38('0x32')](_[_0xfc38('0x3b')](_0x267adc[_0xfc38('0x31')],_0x2cddc9[_0xfc38('0x32')]),_0x8c0f74);if(_0x267adc[_0xfc38('0x31')][_0xfc38('0x3c')]){_0x3709e7['where']=_[_0xfc38('0x3d')](_0x3709e7['where'],{'$or':_[_0xfc38('0x2f')](_0x8c0f74,function(_0x3d22fc){if(_0x3d22fc[_0xfc38('0x2c')]!==_0xfc38('0x3e')){var _0xf0075e={};_0xf0075e[_0x3d22fc[_0xfc38('0x29')]]={'$like':'%'+_0x267adc[_0xfc38('0x31')][_0xfc38('0x3c')]+'%'};return _0xf0075e;}})});}_0x3709e7=_[_0xfc38('0x3d')]({},_0x3709e7,_0x267adc[_0xfc38('0x3f')]);var _0x22130c={'where':_0x3709e7[_0xfc38('0x3a')]};return db[_0xfc38('0x40')][_0xfc38('0x1f')](_0x22130c)[_0xfc38('0x25')](function(_0x18822b){_0x4dd6ad[_0xfc38('0x1f')]=_0x18822b;if(_0x267adc[_0xfc38('0x31')][_0xfc38('0x41')]){_0x3709e7[_0xfc38('0x42')]=[{'all':!![]}];}return db[_0xfc38('0x40')][_0xfc38('0x43')](_0x3709e7);})[_0xfc38('0x25')](function(_0x590747){_0x4dd6ad['rows']=_0x590747;return _0x4dd6ad;})['then'](respondWithFilteredResult(_0x147b02,_0x3709e7))['catch'](handleError(_0x147b02,null));};exports[_0xfc38('0x44')]=function(_0x4ea484,_0x3bd74f){var _0x32938e={'raw':!![],'where':{'id':_0x4ea484[_0xfc38('0x45')]['id']}},_0x472f8e={};_0x472f8e[_0xfc38('0x2e')]=_[_0xfc38('0x30')](db[_0xfc38('0x40')][_0xfc38('0x2b')]);_0x472f8e[_0xfc38('0x31')]=_[_0xfc38('0x30')](_0x4ea484[_0xfc38('0x31')]);_0x472f8e[_0xfc38('0x32')]=_[_0xfc38('0x33')](_0x472f8e[_0xfc38('0x2e')],_0x472f8e[_0xfc38('0x31')]);_0x32938e[_0xfc38('0x34')]=_[_0xfc38('0x33')](_0x472f8e[_0xfc38('0x2e')],qs[_0xfc38('0x35')](_0x4ea484[_0xfc38('0x31')]['fields']));_0x32938e['attributes']=_0x32938e[_0xfc38('0x34')]['length']?_0x32938e[_0xfc38('0x34')]:_0x472f8e['model'];if(_0x4ea484['query'][_0xfc38('0x41')]){_0x32938e[_0xfc38('0x42')]=[{'all':!![]}];}_0x32938e=_[_0xfc38('0x3d')]({},_0x32938e,_0x4ea484[_0xfc38('0x3f')]);return db[_0xfc38('0x40')][_0xfc38('0x46')](_0x32938e)[_0xfc38('0x25')](handleEntityNotFound(_0x3bd74f,null))['then'](respondWithResult(_0x3bd74f,null))[_0xfc38('0x47')](handleError(_0x3bd74f,null));};exports[_0xfc38('0x48')]=function(_0x54efae,_0x521d90){return db[_0xfc38('0x40')][_0xfc38('0x48')](_0x54efae[_0xfc38('0x49')],{})[_0xfc38('0x25')](respondWithResult(_0x521d90,0xc9))[_0xfc38('0x47')](handleError(_0x521d90,null));};exports[_0xfc38('0x4a')]=function(_0xa9960a,_0xe78e60){return db[_0xfc38('0x40')]['describe']()[_0xfc38('0x25')](respondWithResult(_0xe78e60,null))['catch'](handleError(_0xe78e60,null));};exports[_0xfc38('0x24')]=function(_0x57df17,_0x568004){if(_0x57df17[_0xfc38('0x49')][_0xfc38('0x4b')]){delete _0x57df17['body'][_0xfc38('0x4b')];}return db['CmHopperHistory'][_0xfc38('0x46')]({'where':{'uniqueid':_0x57df17[_0xfc38('0x45')]['id']}})[_0xfc38('0x25')](handleEntityNotFound(_0x568004,null))[_0xfc38('0x25')](saveUpdates(_0x57df17[_0xfc38('0x49')],null))[_0xfc38('0x25')](respondWithResult(_0x568004,null))[_0xfc38('0x47')](handleError(_0x568004,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index d6b939b..0149614 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 _0x5464=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x5464,0x15d));var _0x4546=function(_0x11d4fe,_0x3db873){_0x11d4fe=_0x11d4fe-0x0;var _0x5d0d73=_0x5464[_0x11d4fe];return _0x5d0d73;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var logger=require(_0x4546('0x2'))('api');var moment=require(_0x4546('0x3'));var BPromise=require('bluebird');var rp=require(_0x4546('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4546('0x5'));var config=require(_0x4546('0x6'));var attributes=require(_0x4546('0x7'));module[_0x4546('0x8')]=function(_0x54228a,_0x57391f){return _0x54228a['define'](_0x4546('0x9'),attributes,{'tableName':_0x4546('0xa'),'paranoid':![],'indexes':[{'name':_0x4546('0xb'),'fields':[_0x4546('0xb')]},{'name':_0x4546('0xc'),'fields':[_0x4546('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x073d=['endtime','uniqueid','util','../../config/logger','api','bluebird','path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x073d,0xd2));var _0xd073=function(_0x45aac6,_0x13dafe){_0x45aac6=_0x45aac6-0x0;var _0x535760=_0x073d[_0x45aac6];return _0x535760;};'use strict';var _=require('lodash');var util=require(_0xd073('0x0'));var logger=require(_0xd073('0x1'))(_0xd073('0x2'));var moment=require('moment');var BPromise=require(_0xd073('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd073('0x4'));var rimraf=require(_0xd073('0x5'));var config=require('../../config/environment');var attributes=require(_0xd073('0x6'));module[_0xd073('0x7')]=function(_0x1799b8,_0x1fdaeb){return _0x1799b8[_0xd073('0x8')](_0xd073('0x9'),attributes,{'tableName':_0xd073('0xa'),'paranoid':![],'indexes':[{'name':_0xd073('0xb'),'fields':[_0xd073('0xb')]},{'name':_0xd073('0xc'),'fields':[_0xd073('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 4129588..92f4641 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 _0x56ce=['findAll','raw','where','COUNT','sequelize','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','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','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CmHopperHistory','create','body','options','CreateCmHopperHistory','AvgHandleTime'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x56ce,0x1e9));var _0xe56c=function(_0x3d5fc3,_0x2064ad){_0x3d5fc3=_0x3d5fc3-0x0;var _0x5846e1=_0x56ce[_0x3d5fc3];return _0x5846e1;};'use strict';var _=require(_0xe56c('0x0'));var util=require('util');var moment=require(_0xe56c('0x1'));var BPromise=require(_0xe56c('0x2'));var rs=require(_0xe56c('0x3'));var fs=require('fs');var Redis=require(_0xe56c('0x4'));var db=require(_0xe56c('0x5'))['db'];var utils=require(_0xe56c('0x6'));var logger=require(_0xe56c('0x7'))(_0xe56c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe56c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12dac0,_0xb90391,_0x375508){return new BPromise(function(_0x29fc69,_0x3cfb95){return client[_0xe56c('0xa')](_0x12dac0,_0x375508)[_0xe56c('0xb')](function(_0x263812){logger[_0xe56c('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0xb90391,'request\x20sent');logger[_0xe56c('0xd')](_0xe56c('0xe'),_0xb90391,_0xe56c('0xf'),JSON[_0xe56c('0x10')](_0x263812));if(_0x263812[_0xe56c('0x11')]){if(_0x263812[_0xe56c('0x11')][_0xe56c('0x12')]===0x1f4){logger[_0xe56c('0x11')](_0xe56c('0x13'),_0xb90391,_0x263812[_0xe56c('0x11')][_0xe56c('0x14')]);return _0x3cfb95(_0x263812[_0xe56c('0x11')][_0xe56c('0x14')]);}logger[_0xe56c('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0xb90391,_0x263812['error'][_0xe56c('0x14')]);return _0x29fc69(_0x263812[_0xe56c('0x11')][_0xe56c('0x14')]);}else{logger[_0xe56c('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0xb90391,'request\x20sent');_0x29fc69(_0x263812[_0xe56c('0x15')]['message']);}})[_0xe56c('0x16')](function(_0x499f8a){logger['error'](_0xe56c('0x13'),_0xb90391,_0x499f8a);_0x3cfb95(_0x499f8a);});});}exports['CreateCmHopperHistory']=function(_0x3d80bb){var _0x32db0f=this;return new Promise(function(_0x462431,_0x1fb35d){return db[_0xe56c('0x17')][_0xe56c('0x18')](_0x3d80bb[_0xe56c('0x19')],{'raw':_0x3d80bb[_0xe56c('0x1a')]?_0x3d80bb[_0xe56c('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xe56c('0xb')](function(_0x3f49e7){logger[_0xe56c('0xc')](_0xe56c('0x1b'),_0x3d80bb);logger['debug'](_0xe56c('0x1b'),_0x3d80bb,JSON[_0xe56c('0x10')](_0x3f49e7));_0x462431(_0x3f49e7);})['catch'](function(_0x34f8f5){logger[_0xe56c('0x11')](_0xe56c('0x1b'),_0x34f8f5['message'],_0x3d80bb);_0x1fb35d(_0x32db0f[_0xe56c('0x11')](0x1f4,_0x34f8f5['message']));});});};exports[_0xe56c('0x1c')]=function(_0x4bf585){var _0x17432f=this;return new Promise(function(_0x40dbc6,_0x55813a){return db[_0xe56c('0x17')][_0xe56c('0x1d')]({'raw':_0x4bf585[_0xe56c('0x1a')]?_0x4bf585[_0xe56c('0x1a')][_0xe56c('0x1e')]===undefined?!![]:![]:!![],'where':_0x4bf585[_0xe56c('0x1a')]?_0x4bf585[_0xe56c('0x1a')][_0xe56c('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0xe56c('0x20'),db[_0xe56c('0x21')]['col']('id')),_0xe56c('0x22')],[db[_0xe56c('0x21')]['fn'](_0xe56c('0x20'),db[_0xe56c('0x21')]['fn']('IF',db[_0xe56c('0x21')][_0xe56c('0x23')](_0xe56c('0x24')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn']('COUNT',db[_0xe56c('0x21')]['fn']('IF',db[_0xe56c('0x21')][_0xe56c('0x23')](_0xe56c('0x25')))),_0xe56c('0x26')],[db['sequelize']['fn'](_0xe56c('0x20'),db[_0xe56c('0x21')]['fn']('IF',db[_0xe56c('0x21')][_0xe56c('0x23')](_0xe56c('0x27')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xe56c('0x21')]['fn'](_0xe56c('0x28'),db['sequelize']['fn']('IF',db[_0xe56c('0x21')][_0xe56c('0x23')](_0xe56c('0x29')))),_0xe56c('0x2a')],[db[_0xe56c('0x21')]['fn']('AVG',db[_0xe56c('0x21')]['fn']('IF',db['sequelize'][_0xe56c('0x23')](_0xe56c('0x2b')))),'predictiveIntervalAvgTalktime']]})[_0xe56c('0xb')](function(_0x28505b){logger[_0xe56c('0xc')](_0xe56c('0x1c'),_0x4bf585);logger[_0xe56c('0xd')](_0xe56c('0x1c'),_0x4bf585,JSON[_0xe56c('0x10')](_0x28505b));_0x40dbc6(_0x28505b);})[_0xe56c('0x16')](function(_0x5103c0){logger[_0xe56c('0x11')](_0xe56c('0x1c'),_0x5103c0[_0xe56c('0x14')],_0x4bf585);_0x55813a(_0x17432f[_0xe56c('0x11')](0x1f4,_0x5103c0[_0xe56c('0x14')]));});});};exports[_0xe56c('0x2c')]=function(_0x3707a1){var _0x34dc9a=this;return new Promise(function(_0x4b7b7a,_0x254e80){return db[_0xe56c('0x17')][_0xe56c('0x1d')]({'raw':_0x3707a1[_0xe56c('0x1a')]?_0x3707a1[_0xe56c('0x1a')][_0xe56c('0x1e')]===undefined?!![]:![]:!![],'where':_0x3707a1['options']?_0x3707a1[_0xe56c('0x1a')][_0xe56c('0x1f')]||null:null,'attributes':[[_0xe56c('0x2d'),_0xe56c('0x2e')],[db['sequelize']['fn'](_0xe56c('0x20'),db[_0xe56c('0x21')]['fn']('IF',db[_0xe56c('0x21')]['literal'](_0xe56c('0x2f')))),_0xe56c('0x30')],[db[_0xe56c('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe56c('0x21')]['literal'](_0xe56c('0x31')))),_0xe56c('0x32')],[db[_0xe56c('0x21')]['fn'](_0xe56c('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xe56c('0x23')](_0xe56c('0x24')))),_0xe56c('0x33')],[db[_0xe56c('0x21')]['fn'](_0xe56c('0x20'),db[_0xe56c('0x21')]['fn']('IF',db[_0xe56c('0x21')][_0xe56c('0x23')](_0xe56c('0x34')))),'outboundBusyCallsDay'],[db[_0xe56c('0x21')]['fn']('COUNT',db[_0xe56c('0x21')]['fn']('IF',db[_0xe56c('0x21')][_0xe56c('0x23')](_0xe56c('0x35')))),_0xe56c('0x36')],[db[_0xe56c('0x21')]['fn'](_0xe56c('0x20'),db[_0xe56c('0x21')]['fn']('IF',db['sequelize'][_0xe56c('0x23')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xe56c('0x37')],[db['sequelize']['fn'](_0xe56c('0x20'),db['sequelize']['fn']('IF',db[_0xe56c('0x21')][_0xe56c('0x23')](_0xe56c('0x38')))),_0xe56c('0x39')],[db[_0xe56c('0x21')]['fn']('COUNT',db[_0xe56c('0x21')]['fn']('IF',db[_0xe56c('0x21')][_0xe56c('0x23')](_0xe56c('0x3a')))),_0xe56c('0x3b')],[db['sequelize']['fn'](_0xe56c('0x20'),db['sequelize']['fn']('IF',db[_0xe56c('0x21')][_0xe56c('0x23')](_0xe56c('0x3c')))),_0xe56c('0x3d')],[db[_0xe56c('0x21')]['fn'](_0xe56c('0x20'),db[_0xe56c('0x21')]['fn']('IF',db['sequelize'][_0xe56c('0x23')](_0xe56c('0x3e')))),_0xe56c('0x3f')],[db['sequelize']['fn'](_0xe56c('0x20'),db[_0xe56c('0x21')]['fn']('IF',db['sequelize'][_0xe56c('0x23')](_0xe56c('0x40')))),'outboundRejectCallsDay'],[db[_0xe56c('0x21')]['fn'](_0xe56c('0x20'),db[_0xe56c('0x21')]['fn']('IF',db[_0xe56c('0x21')][_0xe56c('0x23')](_0xe56c('0x41')))),_0xe56c('0x42')],[db[_0xe56c('0x21')]['fn'](_0xe56c('0x20'),db[_0xe56c('0x21')]['fn']('IF',db[_0xe56c('0x21')][_0xe56c('0x23')](_0xe56c('0x43')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0xe56c('0x20'),db[_0xe56c('0x21')]['fn']('IF',db[_0xe56c('0x21')][_0xe56c('0x23')](_0xe56c('0x44')))),_0xe56c('0x45')]],'group':[_0xe56c('0x2d')]})[_0xe56c('0xb')](function(_0x39d213){logger['info']('GetVoiceQueueHopperHistory',_0x3707a1);logger[_0xe56c('0xd')](_0xe56c('0x2c'),_0x3707a1,JSON['stringify'](_0x39d213));_0x4b7b7a(_0x39d213);})[_0xe56c('0x16')](function(_0x135f83){logger[_0xe56c('0x11')](_0xe56c('0x2c'),_0x135f83['message'],_0x3707a1);_0x254e80(_0x34dc9a[_0xe56c('0x11')](0x1f4,_0x135f83[_0xe56c('0x14')]));});});};exports[_0xe56c('0x46')]=function(_0x1aa2f6){var _0x59c09c=this;return new Promise(function(_0x137323,_0x2e0da2){return db[_0xe56c('0x17')]['findAll']({'raw':_0x1aa2f6['options']?_0x1aa2f6[_0xe56c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1aa2f6[_0xe56c('0x1a')]?_0x1aa2f6[_0xe56c('0x1a')][_0xe56c('0x1f')]||null:null,'attributes':[[_0xe56c('0x2d'),_0xe56c('0x2e')],[db[_0xe56c('0x21')]['fn'](_0xe56c('0x20'),db['sequelize'][_0xe56c('0x47')]('id')),_0xe56c('0x48')],[db[_0xe56c('0x21')]['fn'](_0xe56c('0x20'),db['sequelize']['fn']('IF',db[_0xe56c('0x21')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xe56c('0x49')]],'group':['campaign']})['then'](function(_0x42ff79){logger[_0xe56c('0xc')](_0xe56c('0x46'),_0x1aa2f6);logger['debug']('GetCampaignHopperHistory',_0x1aa2f6,JSON[_0xe56c('0x10')](_0x42ff79));_0x137323(_0x42ff79);})['catch'](function(_0x48db0a){logger['error'](_0xe56c('0x46'),_0x48db0a['message'],_0x1aa2f6);_0x2e0da2(_0x59c09c[_0xe56c('0x11')](0x1f4,_0x48db0a[_0xe56c('0x14')]));});});}; \ No newline at end of file +var _0xdfe9=['then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','debug','AvgHandleTime','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','catch','findAll','campaign','name','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','ivrTotalCallsDays','GetCampaignHopperHistory','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3a49eb,_0x434122){var _0x513bc9=function(_0xd36cf){while(--_0xd36cf){_0x3a49eb['push'](_0x3a49eb['shift']());}};_0x513bc9(++_0x434122);}(_0xdfe9,0xc3));var _0x9dfe=function(_0x3cd796,_0x101a9e){_0x3cd796=_0x3cd796-0x0;var _0x35e831=_0xdfe9[_0x3cd796];return _0x35e831;};'use strict';var _=require(_0x9dfe('0x0'));var util=require('util');var moment=require(_0x9dfe('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dfe('0x2'));var db=require(_0x9dfe('0x3'))['db'];var utils=require(_0x9dfe('0x4'));var logger=require(_0x9dfe('0x5'))(_0x9dfe('0x6'));var config=require(_0x9dfe('0x7'));var jayson=require(_0x9dfe('0x8'));var client=jayson[_0x9dfe('0x9')][_0x9dfe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3471f0,_0x13b6f8,_0x5e0faf){return new BPromise(function(_0x377c1e,_0xa21ae3){return client[_0x9dfe('0xb')](_0x3471f0,_0x5e0faf)[_0x9dfe('0xc')](function(_0xcd9ecb){logger[_0x9dfe('0xd')](_0x9dfe('0xe'),_0x13b6f8,_0x9dfe('0xf'));logger['debug'](_0x9dfe('0x10'),_0x13b6f8,_0x9dfe('0xf'),JSON[_0x9dfe('0x11')](_0xcd9ecb));if(_0xcd9ecb[_0x9dfe('0x12')]){if(_0xcd9ecb['error']['code']===0x1f4){logger[_0x9dfe('0x12')](_0x9dfe('0xe'),_0x13b6f8,_0xcd9ecb['error']['message']);return _0xa21ae3(_0xcd9ecb['error'][_0x9dfe('0x13')]);}logger[_0x9dfe('0x12')](_0x9dfe('0xe'),_0x13b6f8,_0xcd9ecb[_0x9dfe('0x12')][_0x9dfe('0x13')]);return _0x377c1e(_0xcd9ecb[_0x9dfe('0x12')][_0x9dfe('0x13')]);}else{logger[_0x9dfe('0xd')](_0x9dfe('0xe'),_0x13b6f8,'request\x20sent');_0x377c1e(_0xcd9ecb['result'][_0x9dfe('0x13')]);}})['catch'](function(_0x1a7cbe){logger[_0x9dfe('0x12')](_0x9dfe('0xe'),_0x13b6f8,_0x1a7cbe);_0xa21ae3(_0x1a7cbe);});});}exports[_0x9dfe('0x14')]=function(_0x15e32b){var _0x1bddd4=this;return new Promise(function(_0x5c7158,_0x270796){return db[_0x9dfe('0x15')][_0x9dfe('0x16')](_0x15e32b[_0x9dfe('0x17')],{'raw':_0x15e32b[_0x9dfe('0x18')]?_0x15e32b[_0x9dfe('0x18')][_0x9dfe('0x19')]===undefined?!![]:![]:!![]})[_0x9dfe('0xc')](function(_0x439cd4){logger[_0x9dfe('0xd')](_0x9dfe('0x14'),_0x15e32b);logger[_0x9dfe('0x1a')](_0x9dfe('0x14'),_0x15e32b,JSON[_0x9dfe('0x11')](_0x439cd4));_0x5c7158(_0x439cd4);})['catch'](function(_0x484f22){logger[_0x9dfe('0x12')](_0x9dfe('0x14'),_0x484f22[_0x9dfe('0x13')],_0x15e32b);_0x270796(_0x1bddd4[_0x9dfe('0x12')](0x1f4,_0x484f22[_0x9dfe('0x13')]));});});};exports[_0x9dfe('0x1b')]=function(_0x3354b7){var _0x361e5e=this;return new Promise(function(_0x3538bb,_0xf7fc28){return db[_0x9dfe('0x15')]['findAll']({'raw':_0x3354b7['options']?_0x3354b7[_0x9dfe('0x18')][_0x9dfe('0x19')]===undefined?!![]:![]:!![],'where':_0x3354b7['options']?_0x3354b7[_0x9dfe('0x18')][_0x9dfe('0x1c')]||null:null,'attributes':[[db[_0x9dfe('0x1d')]['fn']('COUNT',db[_0x9dfe('0x1d')][_0x9dfe('0x1e')]('id')),_0x9dfe('0x1f')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db['sequelize']['fn']('IF',db[_0x9dfe('0x1d')]['literal'](_0x9dfe('0x21')))),_0x9dfe('0x22')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x9dfe('0x20'),db['sequelize']['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x26'),db['sequelize']['fn']('IF',db['sequelize'][_0x9dfe('0x23')](_0x9dfe('0x27')))),_0x9dfe('0x28')],[db[_0x9dfe('0x1d')]['fn']('AVG',db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x29')))),_0x9dfe('0x2a')]]})['then'](function(_0x2747fd){logger[_0x9dfe('0xd')](_0x9dfe('0x1b'),_0x3354b7);logger[_0x9dfe('0x1a')](_0x9dfe('0x1b'),_0x3354b7,JSON[_0x9dfe('0x11')](_0x2747fd));_0x3538bb(_0x2747fd);})[_0x9dfe('0x2b')](function(_0x55a6c4){logger[_0x9dfe('0x12')](_0x9dfe('0x1b'),_0x55a6c4[_0x9dfe('0x13')],_0x3354b7);_0xf7fc28(_0x361e5e[_0x9dfe('0x12')](0x1f4,_0x55a6c4[_0x9dfe('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x31db7f){var _0x153868=this;return new Promise(function(_0x547c93,_0x2edf05){return db['CmHopperHistory'][_0x9dfe('0x2c')]({'raw':_0x31db7f[_0x9dfe('0x18')]?_0x31db7f[_0x9dfe('0x18')][_0x9dfe('0x19')]===undefined?!![]:![]:!![],'where':_0x31db7f[_0x9dfe('0x18')]?_0x31db7f['options']['where']||null:null,'attributes':[[_0x9dfe('0x2d'),_0x9dfe('0x2e')],[db['sequelize']['fn'](_0x9dfe('0x20'),db['sequelize']['fn']('IF',db[_0x9dfe('0x1d')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0x9dfe('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9dfe('0x1d')]['literal'](_0x9dfe('0x2f')))),_0x9dfe('0x30')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x21')))),_0x9dfe('0x31')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x32')))),_0x9dfe('0x33')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x9dfe('0x34')],[db['sequelize']['fn']('COUNT',db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x35')))),_0x9dfe('0x36')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x9dfe('0x37')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')]('`state`\x20=\x2012,\x201,\x20null'))),_0x9dfe('0x38')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')]('`state`\x20=\x2013,\x201,\x20null'))),_0x9dfe('0x39')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x3a')))),_0x9dfe('0x3b')],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x3c')))),_0x9dfe('0x3d')],[db['sequelize']['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x9dfe('0x3e')))),_0x9dfe('0x3f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x40')))),_0x9dfe('0x3d')],[db['sequelize']['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x41')))),'outboundReCallsDay']],'group':[_0x9dfe('0x2d')]})[_0x9dfe('0xc')](function(_0x5a1f13){logger[_0x9dfe('0xd')](_0x9dfe('0x42'),_0x31db7f);logger['debug'](_0x9dfe('0x42'),_0x31db7f,JSON[_0x9dfe('0x11')](_0x5a1f13));_0x547c93(_0x5a1f13);})[_0x9dfe('0x2b')](function(_0x5b2d25){logger[_0x9dfe('0x12')](_0x9dfe('0x42'),_0x5b2d25['message'],_0x31db7f);_0x2edf05(_0x153868['error'](0x1f4,_0x5b2d25[_0x9dfe('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0x589b68){var _0xa70ba3=this;return new Promise(function(_0x349c71,_0x14ef32){return db['CmHopperHistory']['findAll']({'raw':_0x589b68[_0x9dfe('0x18')]?_0x589b68[_0x9dfe('0x18')][_0x9dfe('0x19')]===undefined?!![]:![]:!![],'where':_0x589b68[_0x9dfe('0x18')]?_0x589b68[_0x9dfe('0x18')][_0x9dfe('0x1c')]||null:null,'attributes':[[_0x9dfe('0x2d'),'name'],[db[_0x9dfe('0x1d')]['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['col']('id')),_0x9dfe('0x43')],[db['sequelize']['fn'](_0x9dfe('0x20'),db[_0x9dfe('0x1d')]['fn']('IF',db[_0x9dfe('0x1d')][_0x9dfe('0x23')](_0x9dfe('0x21')))),'ivrAnswerCallsDay']],'group':[_0x9dfe('0x2d')]})[_0x9dfe('0xc')](function(_0x1fa4d9){logger[_0x9dfe('0xd')](_0x9dfe('0x44'),_0x589b68);logger[_0x9dfe('0x1a')](_0x9dfe('0x44'),_0x589b68,JSON[_0x9dfe('0x11')](_0x1fa4d9));_0x349c71(_0x1fa4d9);})[_0x9dfe('0x2b')](function(_0x4455fc){logger[_0x9dfe('0x12')]('GetCampaignHopperHistory',_0x4455fc[_0x9dfe('0x13')],_0x589b68);_0x14ef32(_0xa70ba3['error'](0x1f4,_0x4455fc['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index a99d8f5..83a5dcb 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 _0x33f7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','exports','path','connect-timeout','express','fs-extra'];(function(_0x471ff0,_0x150b17){var _0x53d782=function(_0x1bf332){while(--_0x1bf332){_0x471ff0['push'](_0x471ff0['shift']());}};_0x53d782(++_0x150b17);}(_0x33f7,0x19a));var _0x733f=function(_0x2c6c95,_0x3e88d6){_0x2c6c95=_0x2c6c95-0x0;var _0x109f35=_0x33f7[_0x2c6c95];return _0x109f35;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x733f('0x0'));var timeout=require(_0x733f('0x1'));var express=require(_0x733f('0x2'));var router=express['Router']();var fs_extra=require(_0x733f('0x3'));var auth=require(_0x733f('0x4'));var interaction=require(_0x733f('0x5'));var config=require(_0x733f('0x6'));var controller=require(_0x733f('0x7'));router[_0x733f('0x8')]('/',auth[_0x733f('0x9')](),controller[_0x733f('0xa')]);router[_0x733f('0x8')](_0x733f('0xb'),auth['isAuthenticated'](),controller[_0x733f('0xc')]);router['get'](_0x733f('0xd'),auth[_0x733f('0x9')](),controller[_0x733f('0xe')]);router[_0x733f('0xf')]('/',auth[_0x733f('0x9')](),controller['create']);router['put'](_0x733f('0xd'),auth['isAuthenticated'](),controller[_0x733f('0x10')]);module[_0x733f('0x11')]=router; \ No newline at end of file +var _0x3560=['isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x3560,0x108));var _0x0356=function(_0x2f2a6f,_0xe63e10){_0x2f2a6f=_0x2f2a6f-0x0;var _0x14441d=_0x3560[_0x2f2a6f];return _0x14441d;};'use strict';var multer=require(_0x0356('0x0'));var util=require('util');var path=require(_0x0356('0x1'));var timeout=require(_0x0356('0x2'));var express=require(_0x0356('0x3'));var router=express[_0x0356('0x4')]();var fs_extra=require(_0x0356('0x5'));var auth=require(_0x0356('0x6'));var interaction=require(_0x0356('0x7'));var config=require('../../config/environment');var controller=require(_0x0356('0x8'));router['get']('/',auth[_0x0356('0x9')](),controller[_0x0356('0xa')]);router[_0x0356('0xb')](_0x0356('0xc'),auth[_0x0356('0x9')](),controller[_0x0356('0xd')]);router[_0x0356('0xb')](_0x0356('0xe'),auth['isAuthenticated'](),controller[_0x0356('0xf')]);router[_0x0356('0x10')]('/',auth['isAuthenticated'](),controller[_0x0356('0x11')]);router[_0x0356('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0356('0x13')]);module[_0x0356('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index c55ecf6..ef6f3da 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 _0xfd7b=['STRING','name','exports'];(function(_0x2d729a,_0x26fe43){var _0x3ce628=function(_0x541103){while(--_0x541103){_0x2d729a['push'](_0x2d729a['shift']());}};_0x3ce628(++_0x26fe43);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0xfd7b[_0x4cbf20];return _0x582ae4;};'use strict';var Sequelize=require('sequelize');module[_0xbfd7('0x0')]={'name':{'type':Sequelize[_0xbfd7('0x1')],'unique':_0xbfd7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbfd7('0x1')]},'dialPrefix':{'type':Sequelize[_0xbfd7('0x1')]}}; \ No newline at end of file +var _0xe6c1=['exports','STRING','name'];(function(_0x58bdce,_0x50cd66){var _0x510119=function(_0x431c08){while(--_0x431c08){_0x58bdce['push'](_0x58bdce['shift']());}};_0x510119(++_0x50cd66);}(_0xe6c1,0xd8));var _0x1e6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6c1[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x1e6c('0x0')]={'name':{'type':Sequelize[_0x1e6c('0x1')],'unique':_0x1e6c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 7410b0b..5ae79d9 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 _0x6d13=['order','sort','where','pick','filter','merge','VIRTUAL','options','CmList','includeAll','include','findAll','rows','catch','params','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','each','omit','success','push','dataValues','errors','message','getContacts','CmCustomField','CustomFields','format','cf_%d','getContactsCsv','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','/tmp/list_%d_%s.csv','findOne','transaction','addCustomFields','TEXT','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','get','Lists','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit'];(function(_0x4dcf39,_0x1cae0d){var _0x41952b=function(_0x148887){while(--_0x148887){_0x4dcf39['push'](_0x4dcf39['shift']());}};_0x41952b(++_0x1cae0d);}(_0x6d13,0xe6));var _0x36d1=function(_0x57643b,_0x1706fe){_0x57643b=_0x57643b-0x0;var _0x53a35b=_0x6d13[_0x57643b];return _0x53a35b;};'use strict';var emlformat=require(_0x36d1('0x0'));var rimraf=require(_0x36d1('0x1'));var zipdir=require(_0x36d1('0x2'));var jsonpatch=require(_0x36d1('0x3'));var rp=require('request-promise');var moment=require(_0x36d1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x36d1('0x5'));var util=require(_0x36d1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x36d1('0x7'));var ejs=require(_0x36d1('0x8'));var fs=require('fs');var fs_extra=require(_0x36d1('0x9'));var _=require(_0x36d1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x36d1('0xb'));var deskjs=require(_0x36d1('0xc'));var toCsv=require(_0x36d1('0x7'));var querystring=require('querystring');var Papa=require(_0x36d1('0xd'));var Redis=require(_0x36d1('0xe'));var authService=require(_0x36d1('0xf'));var qs=require(_0x36d1('0x10'));var as=require(_0x36d1('0x11'));var hardwareService=require(_0x36d1('0x12'));var logger=require(_0x36d1('0x13'))('api');var utils=require(_0x36d1('0x14'));var config=require(_0x36d1('0x15'));var licenseUtil=require(_0x36d1('0x16'));var db=require(_0x36d1('0x17'))['db'];config[_0x36d1('0x18')]=_[_0x36d1('0x19')](config[_0x36d1('0x18')],{'host':_0x36d1('0x1a'),'port':0x18eb});var socket=require(_0x36d1('0x1b'))(new Redis(config['redis']));require(_0x36d1('0x1c'))[_0x36d1('0x1d')](socket);function respondWithStatusCode(_0x194612,_0x584e49){_0x584e49=_0x584e49||0xcc;return function(_0x3e2ea5){if(_0x3e2ea5){return _0x194612[_0x36d1('0x1e')](_0x584e49);}return _0x194612[_0x36d1('0x1f')](_0x584e49)['end']();};}function respondWithResult(_0x26dcb1,_0x2ae96d){_0x2ae96d=_0x2ae96d||0xc8;return function(_0x6258b7){if(_0x6258b7){return _0x26dcb1['status'](_0x2ae96d)[_0x36d1('0x20')](_0x6258b7);}};}function respondWithFilteredResult(_0x63c7f,_0x186950){return function(_0xaf2b6d){if(_0xaf2b6d){var _0x5dd5bb=typeof _0x186950[_0x36d1('0x21')]===_0x36d1('0x22')&&typeof _0x186950[_0x36d1('0x23')]==='undefined';var _0x4a679a=_0xaf2b6d[_0x36d1('0x24')];var _0x49637d=_0x5dd5bb?0x0:_0x186950[_0x36d1('0x21')];var _0x5475b0=_0x5dd5bb?_0xaf2b6d[_0x36d1('0x24')]:_0x186950[_0x36d1('0x21')]+_0x186950['limit'];var _0x5b81c8;if(_0x5475b0>=_0x4a679a){_0x5475b0=_0x4a679a;_0x5b81c8=0xc8;}else{_0x5b81c8=0xce;}_0x63c7f['status'](_0x5b81c8);return _0x63c7f[_0x36d1('0x25')]('Content-Range',_0x49637d+'-'+_0x5475b0+'/'+_0x4a679a)[_0x36d1('0x20')](_0xaf2b6d);}return null;};}function patchUpdates(_0x56e477){return function(_0x3e34c5){try{jsonpatch['apply'](_0x3e34c5,_0x56e477,!![]);}catch(_0x364cd4){return BPromise[_0x36d1('0x26')](_0x364cd4);}return _0x3e34c5[_0x36d1('0x27')]();};}function saveUpdates(_0x32b27e,_0x3b7ff3){return function(_0x14d60b){if(_0x14d60b){return _0x14d60b[_0x36d1('0x28')](_0x32b27e)['then'](function(_0xcfa10a){return _0xcfa10a;});}return null;};}function removeEntity(_0xfb944e,_0x303de1){return function(_0x35a079){if(_0x35a079){return _0x35a079[_0x36d1('0x29')]()[_0x36d1('0x2a')](function(){var _0x2e67ba=_0x35a079[_0x36d1('0x2b')]({'plain':!![]});var _0x459f29=_0x36d1('0x2c');return db[_0x36d1('0x2d')][_0x36d1('0x29')]({'where':{'type':_0x459f29,'resourceId':_0x2e67ba['id']}})[_0x36d1('0x2a')](function(){return _0x35a079;});})['then'](function(){_0xfb944e[_0x36d1('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfdc3fa,_0x40a43c){return function(_0x1da402){if(!_0x1da402){_0xfdc3fa[_0x36d1('0x1e')](0x194);}return _0x1da402;};}function handleError(_0x2c3b75,_0x2b6a9c){_0x2b6a9c=_0x2b6a9c||0x1f4;return function(_0x447e07){logger[_0x36d1('0x2e')](_0x447e07[_0x36d1('0x2f')]);if(_0x447e07[_0x36d1('0x30')]){delete _0x447e07[_0x36d1('0x30')];}_0x2c3b75[_0x36d1('0x1f')](_0x2b6a9c)[_0x36d1('0x31')](_0x447e07);};}exports['index']=function(_0x4824e9,_0x5aa2a7){var _0x179382={},_0x465d89={},_0xfc1120={'count':0x0,'rows':[]};var _0x11e4a3=_[_0x36d1('0x32')](db['CmList'][_0x36d1('0x33')],function(_0x4ace40){return{'name':_0x4ace40[_0x36d1('0x34')],'type':_0x4ace40[_0x36d1('0x35')][_0x36d1('0x36')]};});_0x465d89['model']=_['map'](_0x11e4a3,_0x36d1('0x30'));_0x465d89[_0x36d1('0x37')]=_[_0x36d1('0x38')](_0x4824e9[_0x36d1('0x37')]);_0x465d89[_0x36d1('0x39')]=_['intersection'](_0x465d89[_0x36d1('0x3a')],_0x465d89[_0x36d1('0x37')]);_0x179382[_0x36d1('0x3b')]=_[_0x36d1('0x3c')](_0x465d89[_0x36d1('0x3a')],qs['fields'](_0x4824e9[_0x36d1('0x37')]['fields']));_0x179382['attributes']=_0x179382['attributes'][_0x36d1('0x3d')]?_0x179382[_0x36d1('0x3b')]:_0x465d89[_0x36d1('0x3a')];if(!_0x4824e9[_0x36d1('0x37')][_0x36d1('0x3e')](_0x36d1('0x3f'))){_0x179382[_0x36d1('0x23')]=qs['limit'](_0x4824e9[_0x36d1('0x37')][_0x36d1('0x23')]);_0x179382[_0x36d1('0x21')]=qs[_0x36d1('0x21')](_0x4824e9[_0x36d1('0x37')][_0x36d1('0x21')]);}_0x179382[_0x36d1('0x40')]=qs[_0x36d1('0x41')](_0x4824e9[_0x36d1('0x37')]['sort']);_0x179382[_0x36d1('0x42')]=qs['filters'](_[_0x36d1('0x43')](_0x4824e9['query'],_0x465d89[_0x36d1('0x39')]),_0x11e4a3);if(_0x4824e9['query'][_0x36d1('0x44')]){_0x179382[_0x36d1('0x42')]=_[_0x36d1('0x45')](_0x179382[_0x36d1('0x42')],{'$or':_[_0x36d1('0x32')](_0x11e4a3,function(_0x3550e6){if(_0x3550e6[_0x36d1('0x35')]!==_0x36d1('0x46')){var _0x54d528={};_0x54d528[_0x3550e6['name']]={'$like':'%'+_0x4824e9[_0x36d1('0x37')][_0x36d1('0x44')]+'%'};return _0x54d528;}})});}_0x179382=_[_0x36d1('0x45')]({},_0x179382,_0x4824e9[_0x36d1('0x47')]);var _0x2394e1={'where':_0x179382[_0x36d1('0x42')]};return db[_0x36d1('0x48')]['count'](_0x2394e1)[_0x36d1('0x2a')](function(_0x38e1f1){_0xfc1120['count']=_0x38e1f1;if(_0x4824e9[_0x36d1('0x37')][_0x36d1('0x49')]){_0x179382[_0x36d1('0x4a')]=[{'all':!![]}];}return db[_0x36d1('0x48')][_0x36d1('0x4b')](_0x179382);})[_0x36d1('0x2a')](function(_0x340a6a){_0xfc1120[_0x36d1('0x4c')]=_0x340a6a;return _0xfc1120;})[_0x36d1('0x2a')](respondWithFilteredResult(_0x5aa2a7,_0x179382))[_0x36d1('0x4d')](handleError(_0x5aa2a7,null));};exports['show']=function(_0x1edbeb,_0x1432ce){var _0x3076ca={'raw':![],'where':{'id':_0x1edbeb[_0x36d1('0x4e')]['id']}},_0x36c3fb={};_0x36c3fb['model']=_[_0x36d1('0x38')](db[_0x36d1('0x48')]['rawAttributes']);_0x36c3fb[_0x36d1('0x37')]=_['keys'](_0x1edbeb[_0x36d1('0x37')]);_0x36c3fb[_0x36d1('0x39')]=_['intersection'](_0x36c3fb['model'],_0x36c3fb[_0x36d1('0x37')]);_0x3076ca['attributes']=_[_0x36d1('0x3c')](_0x36c3fb[_0x36d1('0x3a')],qs[_0x36d1('0x4f')](_0x1edbeb['query']['fields']));_0x3076ca[_0x36d1('0x3b')]=_0x3076ca[_0x36d1('0x3b')][_0x36d1('0x3d')]?_0x3076ca[_0x36d1('0x3b')]:_0x36c3fb[_0x36d1('0x3a')];if(_0x1edbeb[_0x36d1('0x37')][_0x36d1('0x49')]){_0x3076ca[_0x36d1('0x4a')]=[{'all':!![]}];}_0x3076ca=_['merge']({},_0x3076ca,_0x1edbeb[_0x36d1('0x47')]);return db['CmList']['find'](_0x3076ca)[_0x36d1('0x2a')](handleEntityNotFound(_0x1432ce,null))[_0x36d1('0x2a')](respondWithResult(_0x1432ce,null))[_0x36d1('0x4d')](handleError(_0x1432ce,null));};exports[_0x36d1('0x50')]=function(_0x3c9bf8,_0x4dfd5a){return db[_0x36d1('0x48')]['create'](_0x3c9bf8[_0x36d1('0x51')],{})['then'](function(_0x31d75a){var _0x487a75=_0x3c9bf8[_0x36d1('0x52')]['get']({'plain':!![]});if(!_0x487a75)throw new Error(_0x36d1('0x53'));if(_0x487a75[_0x36d1('0x54')]===_0x36d1('0x52')){var _0x2a041e=_0x31d75a[_0x36d1('0x2b')]({'plain':!![]});var _0x4bc098='Lists';return db[_0x36d1('0x55')][_0x36d1('0x56')]({'where':{'name':_0x4bc098,'userProfileId':_0x487a75[_0x36d1('0x57')]},'raw':!![]})[_0x36d1('0x2a')](function(_0x577a70){if(_0x577a70&&_0x577a70['autoAssociation']===0x0){return db[_0x36d1('0x2d')][_0x36d1('0x50')]({'name':_0x2a041e[_0x36d1('0x30')],'resourceId':_0x2a041e['id'],'type':_0x577a70[_0x36d1('0x30')],'sectionId':_0x577a70['id']},{})[_0x36d1('0x2a')](function(){return _0x31d75a;});}else{return _0x31d75a;}})[_0x36d1('0x4d')](function(_0x468b2a){logger[_0x36d1('0x2e')](_0x36d1('0x58'),_0x468b2a);throw _0x468b2a;});}return _0x31d75a;})[_0x36d1('0x2a')](respondWithResult(_0x4dfd5a,0xc9))[_0x36d1('0x4d')](handleError(_0x4dfd5a,null));};exports[_0x36d1('0x28')]=function(_0x1e7ab3,_0x14c51a){if(_0x1e7ab3['body']['id']){delete _0x1e7ab3[_0x36d1('0x51')]['id'];}return db['CmList'][_0x36d1('0x56')]({'where':{'id':_0x1e7ab3[_0x36d1('0x4e')]['id']}})[_0x36d1('0x2a')](handleEntityNotFound(_0x14c51a,null))[_0x36d1('0x2a')](saveUpdates(_0x1e7ab3[_0x36d1('0x51')],null))['then'](respondWithResult(_0x14c51a,null))[_0x36d1('0x4d')](handleError(_0x14c51a,null));};exports[_0x36d1('0x29')]=function(_0x3cf81a,_0x1d1319){return db[_0x36d1('0x48')][_0x36d1('0x56')]({'where':{'id':_0x3cf81a[_0x36d1('0x4e')]['id']}})[_0x36d1('0x2a')](handleEntityNotFound(_0x1d1319,null))[_0x36d1('0x2a')](removeEntity(_0x1d1319,null))[_0x36d1('0x4d')](handleError(_0x1d1319,null));};exports[_0x36d1('0x59')]=function(_0x1d6eb2,_0x40c253){return db[_0x36d1('0x48')][_0x36d1('0x59')]()[_0x36d1('0x2a')](respondWithResult(_0x40c253,null))[_0x36d1('0x4d')](handleError(_0x40c253,null));};exports[_0x36d1('0x5a')]=function(_0x58b377,_0x5c459a,_0xb97347){if(_0x58b377[_0x36d1('0x51')]['id']){delete _0x58b377['body']['id'];}return db[_0x36d1('0x48')]['find']({'where':{'id':_0x58b377[_0x36d1('0x4e')]['id']}})[_0x36d1('0x2a')](handleEntityNotFound(_0x5c459a,null))['then'](function(_0x1a9456){if(_0x1a9456){_0x58b377['body'][_0x36d1('0x5b')]=_0x1a9456['id'];return db[_0x36d1('0x5c')][_0x36d1('0x50')](_0x58b377['body']);}})[_0x36d1('0x2a')](respondWithResult(_0x5c459a,null))[_0x36d1('0x4d')](handleError(_0x5c459a,null));};exports[_0x36d1('0x5d')]=function(_0x469ae2,_0xa5bfe9,_0x43392a){var _0x35a557={'raw':![],'where':{}};var _0x275489={};var _0x3e7f16={'count':0x0,'rows':[]};return db[_0x36d1('0x48')]['findOne']({'where':{'id':_0x469ae2['params']['id']}})[_0x36d1('0x2a')](handleEntityNotFound(_0xa5bfe9,null))[_0x36d1('0x2a')](function(_0x505548){if(_0x505548){_0x275489['model']=_['keys'](db[_0x36d1('0x5c')]['rawAttributes']);_0x275489[_0x36d1('0x37')]=_[_0x36d1('0x38')](_0x469ae2[_0x36d1('0x37')]);_0x275489[_0x36d1('0x39')]=_[_0x36d1('0x3c')](_0x275489[_0x36d1('0x3a')],_0x275489[_0x36d1('0x37')]);_0x35a557[_0x36d1('0x3b')]=_[_0x36d1('0x3c')](_0x275489[_0x36d1('0x3a')],qs[_0x36d1('0x4f')](_0x469ae2['query'][_0x36d1('0x4f')]));_0x35a557[_0x36d1('0x3b')]=_0x35a557[_0x36d1('0x3b')][_0x36d1('0x3d')]?_0x35a557[_0x36d1('0x3b')]:_0x275489[_0x36d1('0x3a')];if(!_0x469ae2['query'][_0x36d1('0x3e')](_0x36d1('0x3f'))){_0x35a557[_0x36d1('0x23')]=qs[_0x36d1('0x23')](_0x469ae2['query'][_0x36d1('0x23')]);_0x35a557['offset']=qs['offset'](_0x469ae2[_0x36d1('0x37')]['offset']);}_0x35a557['order']=qs['sort'](_0x469ae2[_0x36d1('0x37')][_0x36d1('0x41')]);_0x35a557['where']=qs[_0x36d1('0x39')](_[_0x36d1('0x43')](_0x469ae2[_0x36d1('0x37')],_0x275489[_0x36d1('0x39')]));_0x35a557[_0x36d1('0x42')][_0x36d1('0x5b')]=_0x505548['id'];if(_0x469ae2[_0x36d1('0x37')][_0x36d1('0x44')]){_0x35a557[_0x36d1('0x42')]=_[_0x36d1('0x45')](_0x35a557['where'],{'$or':_['map'](_0x35a557[_0x36d1('0x3b')],function(_0x330053){var _0x156f6e={};_0x156f6e[_0x330053]={'$like':'%'+_0x469ae2[_0x36d1('0x37')][_0x36d1('0x44')]+'%'};return _0x156f6e;})});}_0x35a557=_[_0x36d1('0x45')]({},_0x35a557,_0x469ae2[_0x36d1('0x47')]);return db['Disposition']['count']({'where':_0x35a557[_0x36d1('0x42')]})[_0x36d1('0x2a')](function(_0x376801){_0x3e7f16[_0x36d1('0x24')]=_0x376801;if(_0x469ae2[_0x36d1('0x37')][_0x36d1('0x49')]){_0x35a557['include']=[{'all':!![]}];}return db[_0x36d1('0x5c')]['findAll'](_0x35a557);})[_0x36d1('0x2a')](function(_0x485d52){_0x3e7f16[_0x36d1('0x4c')]=_0x485d52;return _0x3e7f16;});}})[_0x36d1('0x2a')](respondWithFilteredResult(_0xa5bfe9,_0x35a557))[_0x36d1('0x4d')](handleError(_0xa5bfe9,null));};exports[_0x36d1('0x5e')]=function(_0x54330e,_0x33511b,_0x556acc){return db[_0x36d1('0x48')][_0x36d1('0x56')]({'where':{'id':_0x54330e[_0x36d1('0x4e')]['id']}})[_0x36d1('0x2a')](handleEntityNotFound(_0x33511b,null))[_0x36d1('0x2a')](function(_0x25eb5d){if(_0x25eb5d){return _0x25eb5d[_0x36d1('0x5e')](_0x54330e[_0x36d1('0x37')][_0x36d1('0x5f')]);}})[_0x36d1('0x2a')](respondWithStatusCode(_0x33511b,null))[_0x36d1('0x4d')](handleError(_0x33511b,null));};exports[_0x36d1('0x60')]=function(_0x2f1387,_0xa0bc75,_0x438e32){return db[_0x36d1('0x48')][_0x36d1('0x56')]({'where':{'id':_0x2f1387[_0x36d1('0x4e')]['id']}})['then'](handleEntityNotFound(_0xa0bc75,null))[_0x36d1('0x2a')](function(_0x55077c){if(_0x55077c){var _0x7eee2f=[];var _0x546e97={'success':[],'errors':[]};return db[_0x36d1('0x61')][_0x36d1('0x59')]()[_0x36d1('0x2a')](function(_0xfcfcf1){if(_0x2f1387['body'][_0x36d1('0x62')]&&_['isArray'](_0x2f1387['body'][_0x36d1('0x62')])){if(_0x2f1387[_0x36d1('0x51')][_0x36d1('0x62')][_0x36d1('0x3d')]){_0x2f1387[_0x36d1('0x51')][_0x36d1('0x62')]=_0x2f1387[_0x36d1('0x51')][_0x36d1('0x62')][_0x36d1('0x63')](';')+';';}else{_0x2f1387[_0x36d1('0x51')][_0x36d1('0x62')]=null;}}else{_0x2f1387[_0x36d1('0x51')][_0x36d1('0x62')]=null;}if(_0x2f1387[_0x36d1('0x51')]&&_[_0x36d1('0x64')](_0x2f1387['body'])){for(var _0x16fc50=0x0;_0x16fc50<_0x2f1387[_0x36d1('0x51')][_0x36d1('0x3d')];_0x16fc50+=0x1){_0x2f1387['body'][_0x16fc50][_0x36d1('0x5b')]=_0x2f1387[_0x36d1('0x4e')]['id'];_0x7eee2f['push'](_0x2f1387['body'][_0x16fc50]);}return BPromise[_0x36d1('0x65')](_0x7eee2f,function(_0x25de4c){return db[_0x36d1('0x61')][_0x36d1('0x50')](_[_0x36d1('0x66')](_0x25de4c,[_0x36d1('0x5f'),'id'])||{},{'fields':_[_0x36d1('0x38')](_0xfcfcf1),'raw':!![]})[_0x36d1('0x2a')](function(_0x7118bb){_0x546e97[_0x36d1('0x67')][_0x36d1('0x68')](_0x7118bb[_0x36d1('0x69')]);})['catch'](function(_0xd73f1c){_0x546e97[_0x36d1('0x6a')]['push']({'data':_0x25de4c,'error':_0xd73f1c[_0x36d1('0x6b')]});});})[_0x36d1('0x2a')](function(_0x3f47dc){return _0x546e97;})['catch'](function(_0x24906f){return _0x24906f;});}else{_0xa0bc75[_0x36d1('0x1f')](0x190)[_0x36d1('0x20')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x36d1('0x2a')](respondWithResult(_0xa0bc75,null))['catch'](handleError(_0xa0bc75,null));};exports[_0x36d1('0x6c')]=function(_0x29de58,_0x5ef946,_0x21fc0b){var _0xd20942;return db[_0x36d1('0x48')]['find']({'where':{'id':_0x29de58['params']['id']},'include':[{'model':db[_0x36d1('0x6d')],'as':_0x36d1('0x6e')}]})[_0x36d1('0x2a')](handleEntityNotFound(_0x5ef946,null))[_0x36d1('0x2a')](function(_0x570e8d){if(_0x570e8d){_0xd20942=_0x570e8d;return db[_0x36d1('0x61')][_0x36d1('0x33')];}})[_0x36d1('0x2a')](function(_0x339c9d){if(_0x339c9d){var _0x2cc0fc={};var _0x262cdd={};_0x262cdd[_0x36d1('0x3a')]=_['concat'](_[_0x36d1('0x38')](_0x339c9d),_[_0x36d1('0x32')](_0xd20942[_0x36d1('0x6e')],function(_0x1cf73f){return util[_0x36d1('0x6f')](_0x36d1('0x70'),_0x1cf73f['id']);}));_0x262cdd[_0x36d1('0x37')]=_[_0x36d1('0x38')](_0x29de58['query']);_0x262cdd['filters']=_['intersection'](_0x262cdd[_0x36d1('0x3a')],_0x262cdd[_0x36d1('0x37')]);_0x2cc0fc['attributes']=_[_0x36d1('0x3c')](_0x262cdd[_0x36d1('0x3a')],qs[_0x36d1('0x4f')](_0x29de58['query'][_0x36d1('0x4f')]));_0x2cc0fc[_0x36d1('0x3b')]=_0x2cc0fc[_0x36d1('0x3b')][_0x36d1('0x3d')]?_0x2cc0fc['attributes']:_0x262cdd[_0x36d1('0x3a')];if(!_0x29de58[_0x36d1('0x37')][_0x36d1('0x3e')](_0x36d1('0x3f'))){_0x2cc0fc['limit']=qs[_0x36d1('0x23')](_0x29de58[_0x36d1('0x37')]['limit']);_0x2cc0fc[_0x36d1('0x21')]=qs['offset'](_0x29de58[_0x36d1('0x37')][_0x36d1('0x21')]);}_0x2cc0fc[_0x36d1('0x40')]=qs[_0x36d1('0x41')](_0x29de58['query'][_0x36d1('0x41')]);_0x2cc0fc['where']=qs['filters'](_[_0x36d1('0x43')](_0x29de58[_0x36d1('0x37')],_0x262cdd[_0x36d1('0x39')]));_0x2cc0fc['raw']=!![];if(_0x29de58[_0x36d1('0x37')]['filter']){_0x2cc0fc[_0x36d1('0x42')]=_[_0x36d1('0x45')](_0x2cc0fc['where'],{'$or':_['map'](_0x2cc0fc[_0x36d1('0x3b')],function(_0x44427e){var _0xd47fb5={};_0xd47fb5[_0x44427e]={'$like':'%'+_0x29de58[_0x36d1('0x37')][_0x36d1('0x44')]+'%'};return _0xd47fb5;})});}_0x2cc0fc=_[_0x36d1('0x45')]({},_0x2cc0fc,_0x29de58[_0x36d1('0x47')]);return _0xd20942[_0x36d1('0x6c')](_0x2cc0fc);}})[_0x36d1('0x2a')](respondWithResult(_0x5ef946,null))['catch'](handleError(_0x5ef946,null));};exports[_0x36d1('0x71')]=function(_0x3e1c81,_0x151688,_0x41bc86){var _0x29c092;return db[_0x36d1('0x48')][_0x36d1('0x56')]({'where':{'id':_0x3e1c81[_0x36d1('0x4e')]['id']},'include':[{'model':db[_0x36d1('0x6d')],'as':_0x36d1('0x6e')}]})['then'](handleEntityNotFound(_0x151688,null))[_0x36d1('0x2a')](function(_0x4eb408){if(_0x4eb408){_0x29c092=_0x4eb408;return db['CmContact'][_0x36d1('0x33')];}})[_0x36d1('0x2a')](function(_0x37c8e8){if(_0x37c8e8){var _0x217ecf={};var _0x4d8a66={};_0x4d8a66[_0x36d1('0x3a')]=_['concat'](_[_0x36d1('0x38')](_0x37c8e8),_['map'](_0x29c092[_0x36d1('0x6e')],function(_0x23b1b6){return util[_0x36d1('0x6f')](_0x36d1('0x70'),_0x23b1b6['id']);}));_0x4d8a66[_0x36d1('0x37')]=_[_0x36d1('0x38')](_0x3e1c81[_0x36d1('0x37')]);_0x4d8a66[_0x36d1('0x39')]=_['intersection'](_0x4d8a66[_0x36d1('0x3a')],_0x4d8a66[_0x36d1('0x37')]);_0x217ecf[_0x36d1('0x3b')]=_[_0x36d1('0x3c')](_0x4d8a66[_0x36d1('0x3a')],qs[_0x36d1('0x4f')](_0x3e1c81[_0x36d1('0x37')][_0x36d1('0x4f')]));_0x217ecf[_0x36d1('0x3b')]=_0x217ecf[_0x36d1('0x3b')][_0x36d1('0x3d')]?_0x217ecf['attributes']:_0x4d8a66[_0x36d1('0x3a')];if(!_0x3e1c81[_0x36d1('0x37')]['hasOwnProperty'](_0x36d1('0x3f'))){_0x217ecf[_0x36d1('0x23')]=qs[_0x36d1('0x23')](_0x3e1c81[_0x36d1('0x37')]['limit']);_0x217ecf[_0x36d1('0x21')]=qs[_0x36d1('0x21')](_0x3e1c81[_0x36d1('0x37')][_0x36d1('0x21')]);}_0x217ecf['order']=qs[_0x36d1('0x41')](_0x3e1c81[_0x36d1('0x37')][_0x36d1('0x41')]);_0x217ecf['where']=qs['filters'](_[_0x36d1('0x43')](_0x3e1c81['query'],_0x4d8a66[_0x36d1('0x39')]));_0x217ecf['raw']=!![];if(_0x3e1c81['query']['filter']){_0x217ecf[_0x36d1('0x42')]=_['merge'](_0x217ecf[_0x36d1('0x42')],{'$or':_['map'](_0x217ecf[_0x36d1('0x3b')],function(_0x72c6c9){var _0xfacd29={};_0xfacd29[_0x72c6c9]={'$like':'%'+_0x3e1c81[_0x36d1('0x37')]['filter']+'%'};return _0xfacd29;})});}_0x217ecf=_[_0x36d1('0x45')]({},_0x217ecf,_0x3e1c81[_0x36d1('0x47')]);return _0x29c092[_0x36d1('0x6c')](_0x217ecf);}})[_0x36d1('0x2a')](function(_0x42655c){if(!_[_0x36d1('0x72')](_0x42655c)){var _0x4c02d3=toCsv(_0x42655c);var _0x35d768=Date[_0x36d1('0x73')]();fs[_0x36d1('0x74')](util[_0x36d1('0x6f')]('/tmp/list_%d_%s.csv',_0x29c092['id'],_0x35d768),_0x4c02d3);_0x151688[_0x36d1('0x75')](_0x36d1('0x76'),_0x36d1('0x77')+util[_0x36d1('0x6f')]('list_%d_%s.csv',_0x29c092['id'],_0x35d768));_0x151688[_0x36d1('0x75')](_0x36d1('0x78'),_0x36d1('0x79'));return _0x151688['download'](util[_0x36d1('0x6f')](_0x36d1('0x7a'),_0x29c092['id'],_0x35d768));}else{return _0x151688[_0x36d1('0x1e')](0xcc);}})['catch'](handleError(_0x151688,null));};exports['addCustomField']=function(_0x491453,_0xa0e820,_0x47d3f4){var _0x463de6;delete _0x491453['body']['id'];return db[_0x36d1('0x48')][_0x36d1('0x7b')]({'where':{'id':_0x491453[_0x36d1('0x4e')]['id']}})[_0x36d1('0x2a')](handleEntityNotFound(_0xa0e820,null))[_0x36d1('0x2a')](function(_0x330e66){if(_0x330e66){return db['sequelize'][_0x36d1('0x7c')](function(_0x404283){return db['CmCustomField'][_0x36d1('0x50')](_0x491453[_0x36d1('0x51')],{'transaction':_0x404283})[_0x36d1('0x2a')](function(_0x3c8cbb){_0x463de6=_0x3c8cbb;return _0x330e66[_0x36d1('0x7d')](_0x3c8cbb,{'transaction':_0x404283});})[_0x36d1('0x2a')](function(){var _0x118085={'type':db['Sequelize'][_0x36d1('0x7e')],'transaction':_0x404283};switch(_0x491453['body'][_0x36d1('0x35')]){case'text':_0x118085[_0x36d1('0x35')]=db[_0x36d1('0x7f')][_0x36d1('0x7e')];break;case _0x36d1('0x80'):_0x118085[_0x36d1('0x35')]=db['Sequelize'][_0x36d1('0x81')];break;case _0x36d1('0x82'):_0x118085[_0x36d1('0x35')]=db[_0x36d1('0x7f')][_0x36d1('0x83')];_0x118085[_0x36d1('0x84')]=![];break;default:}return db[_0x36d1('0x85')][_0x36d1('0x86')][_0x36d1('0x87')](_0x36d1('0x88'),util[_0x36d1('0x6f')](_0x36d1('0x89'),_0x463de6['id']),_0x118085);})[_0x36d1('0x2a')](function(){return _0x463de6;});});}})['then'](respondWithResult(_0xa0e820,null))['catch'](handleError(_0xa0e820,null));};exports[_0x36d1('0x8a')]=function(_0x5f36dd,_0x1b78d3,_0x483cd0){var _0x26ae75={};var _0xcd48d2={};var _0x45beb1;var _0x2314e2;return db['CmList'][_0x36d1('0x7b')]({'where':{'id':_0x5f36dd['params']['id']}})[_0x36d1('0x2a')](handleEntityNotFound(_0x1b78d3,null))[_0x36d1('0x2a')](function(_0x5aa575){if(_0x5aa575){_0x45beb1=_0x5aa575;_0xcd48d2['model']=_[_0x36d1('0x38')](db['CmCustomField']['rawAttributes']);_0xcd48d2[_0x36d1('0x37')]=_[_0x36d1('0x38')](_0x5f36dd['query']);_0xcd48d2['filters']=_['intersection'](_0xcd48d2[_0x36d1('0x3a')],_0xcd48d2['query']);_0x26ae75[_0x36d1('0x3b')]=_[_0x36d1('0x3c')](_0xcd48d2[_0x36d1('0x3a')],qs[_0x36d1('0x4f')](_0x5f36dd[_0x36d1('0x37')][_0x36d1('0x4f')]));_0x26ae75['attributes']=_0x26ae75['attributes'][_0x36d1('0x3d')]?_0x26ae75[_0x36d1('0x3b')]:_0xcd48d2[_0x36d1('0x3a')];_0x26ae75[_0x36d1('0x40')]=qs[_0x36d1('0x41')](_0x5f36dd[_0x36d1('0x37')][_0x36d1('0x41')]);_0x26ae75['where']=qs['filters'](_[_0x36d1('0x43')](_0x5f36dd[_0x36d1('0x37')],_0xcd48d2[_0x36d1('0x39')]));_0x26ae75[_0x36d1('0x42')]=_[_0x36d1('0x45')](_0x26ae75[_0x36d1('0x42')],{'$or':[{'ListId':_0x5aa575['id']},{'ListId':null}]});if(_0x5f36dd[_0x36d1('0x37')][_0x36d1('0x44')]){_0x26ae75['where']=_['merge'](_0x26ae75[_0x36d1('0x42')],{'$or':_[_0x36d1('0x32')](_0x26ae75['attributes'],function(_0x335eb7){var _0x99692e={};_0x99692e[_0x335eb7]={'$like':'%'+_0x5f36dd[_0x36d1('0x37')]['filter']+'%'};return _0x99692e;})});}_0x26ae75=_[_0x36d1('0x45')]({},_0x26ae75,_0x5f36dd[_0x36d1('0x47')]);return db['CmCustomField'][_0x36d1('0x8b')](_0x26ae75);}})[_0x36d1('0x2a')](respondWithResult(_0x1b78d3,null))[_0x36d1('0x4d')](handleError(_0x1b78d3,null));};exports[_0x36d1('0x8c')]=function(_0x367421,_0xa2277a,_0x11bae7){return db['CmList'][_0x36d1('0x56')]({'where':{'id':_0x367421[_0x36d1('0x4e')]['id']}})[_0x36d1('0x2a')](handleEntityNotFound(_0xa2277a,null))[_0x36d1('0x2a')](function(_0x416c7d){if(_0x416c7d){return _0x416c7d['addAgents'](_0x367421['body']['ids'],_[_0x36d1('0x66')](_0x367421[_0x36d1('0x51')],[_0x36d1('0x5f'),'id'])||{})[_0x36d1('0x8d')](function(_0x5e5125){for(var _0x474689=0x0;_0x474689<_0x367421['body']['ids'][_0x36d1('0x3d')];_0x474689+=0x1){socket[_0x36d1('0x8e')](_0x36d1('0x8f'),{'UserId':Number(_0x367421[_0x36d1('0x51')][_0x36d1('0x5f')][_0x474689]),'CmListId':Number(_0x367421['params']['id'])});}return _0x5e5125;});}})[_0x36d1('0x2a')](respondWithResult(_0xa2277a,null))[_0x36d1('0x4d')](handleError(_0xa2277a,null));};exports[_0x36d1('0x90')]=function(_0x389bad,_0x4a0ddd,_0x4b129e){return db['CmList'][_0x36d1('0x56')]({'where':{'id':_0x389bad[_0x36d1('0x4e')]['id']}})[_0x36d1('0x2a')](handleEntityNotFound(_0x4a0ddd,null))['then'](function(_0x1314e7){if(_0x1314e7){return _0x1314e7['removeAgents'](_0x389bad[_0x36d1('0x37')][_0x36d1('0x5f')])[_0x36d1('0x2a')](function(){if(_[_0x36d1('0x64')](_0x389bad[_0x36d1('0x37')]['ids'])){for(var _0x40cd52=0x0;_0x40cd52<_0x389bad[_0x36d1('0x37')]['ids'][_0x36d1('0x3d')];_0x40cd52+=0x1){socket[_0x36d1('0x8e')](_0x36d1('0x91'),{'UserId':Number(_0x389bad['query'][_0x36d1('0x5f')][_0x40cd52]),'CmListId':Number(_0x389bad[_0x36d1('0x4e')]['id'])});}}else{socket[_0x36d1('0x8e')](_0x36d1('0x91'),{'UserId':Number(_0x389bad[_0x36d1('0x37')][_0x36d1('0x5f')]),'CmListId':Number(_0x389bad[_0x36d1('0x4e')]['id'])});}});}})[_0x36d1('0x2a')](respondWithStatusCode(_0x4a0ddd,null))[_0x36d1('0x4d')](handleError(_0x4a0ddd,null));};exports[_0x36d1('0x92')]=function(_0x426819,_0xf614c3,_0x3dbedb){var _0x27f407={};var _0x223c8e={};var _0x18e077;var _0xc24d5f;return db[_0x36d1('0x48')]['findOne']({'where':{'id':_0x426819[_0x36d1('0x4e')]['id']}})['then'](handleEntityNotFound(_0xf614c3,null))[_0x36d1('0x2a')](function(_0xe30840){if(_0xe30840){_0x18e077=_0xe30840;_0x223c8e[_0x36d1('0x3a')]=_[_0x36d1('0x38')](db['User'][_0x36d1('0x33')]);_0x223c8e[_0x36d1('0x37')]=_[_0x36d1('0x38')](_0x426819[_0x36d1('0x37')]);_0x223c8e[_0x36d1('0x39')]=_['intersection'](_0x223c8e[_0x36d1('0x3a')],_0x223c8e[_0x36d1('0x37')]);_0x27f407[_0x36d1('0x3b')]=_['intersection'](_0x223c8e[_0x36d1('0x3a')],qs[_0x36d1('0x4f')](_0x426819[_0x36d1('0x37')][_0x36d1('0x4f')]));_0x27f407[_0x36d1('0x3b')]=_0x27f407[_0x36d1('0x3b')][_0x36d1('0x3d')]?_0x27f407[_0x36d1('0x3b')]:_0x223c8e['model'];_0x27f407['order']=qs[_0x36d1('0x41')](_0x426819[_0x36d1('0x37')][_0x36d1('0x41')]);_0x27f407['where']=qs[_0x36d1('0x39')](_[_0x36d1('0x43')](_0x426819['query'],_0x223c8e['filters']));if(_0x426819[_0x36d1('0x37')]['filter']){_0x27f407[_0x36d1('0x42')]=_[_0x36d1('0x45')](_0x27f407['where'],{'$or':_['map'](_0x27f407[_0x36d1('0x3b')],function(_0x412943){var _0x1c36ba={};_0x1c36ba[_0x412943]={'$like':'%'+_0x426819[_0x36d1('0x37')][_0x36d1('0x44')]+'%'};return _0x1c36ba;})});}_0x27f407=_[_0x36d1('0x45')]({},_0x27f407,_0x426819[_0x36d1('0x47')]);return _0x18e077[_0x36d1('0x92')](_0x27f407);}})[_0x36d1('0x2a')](function(_0x5ba888){if(_0x5ba888){_0xc24d5f=_0x5ba888[_0x36d1('0x3d')];if(!_0x426819['query'][_0x36d1('0x3e')](_0x36d1('0x3f'))){_0x27f407['limit']=qs[_0x36d1('0x23')](_0x426819[_0x36d1('0x37')][_0x36d1('0x23')]);_0x27f407[_0x36d1('0x21')]=qs[_0x36d1('0x21')](_0x426819[_0x36d1('0x37')][_0x36d1('0x21')]);}return _0x18e077[_0x36d1('0x92')](_0x27f407);}})[_0x36d1('0x2a')](function(_0x1bccb9){if(_0x1bccb9){return _0x1bccb9?{'count':_0xc24d5f,'rows':_0x1bccb9}:null;}})['then'](respondWithResult(_0xf614c3,null))['catch'](handleError(_0xf614c3,null));}; \ No newline at end of file +var _0x7602=['sort','include','findAll','rows','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','isEmpty','now','writeFileSync','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','cm_contacts','getCustomFields','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','rimraf','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','get','Lists','UserProfileResource','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','catch','show','params','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','find','describe','addDisposition','ListId','Disposition','getDispositions','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7602,0x1e8));var _0x2760=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x7602[_0xbd08b4];return _0x314f1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2760('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2760('0x1'));var rp=require('request-promise');var moment=require(_0x2760('0x2'));var BPromise=require(_0x2760('0x3'));var Mustache=require(_0x2760('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2760('0x5'));var ejs=require(_0x2760('0x6'));var fs=require('fs');var fs_extra=require(_0x2760('0x7'));var _=require(_0x2760('0x8'));var squel=require('squel');var crypto=require(_0x2760('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x2760('0xa'));var toCsv=require(_0x2760('0x5'));var querystring=require(_0x2760('0xb'));var Papa=require(_0x2760('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2760('0xd'));var hardwareService=require(_0x2760('0xe'));var logger=require(_0x2760('0xf'))('api');var utils=require(_0x2760('0x10'));var config=require(_0x2760('0x11'));var licenseUtil=require(_0x2760('0x12'));var db=require(_0x2760('0x13'))['db'];config['redis']=_[_0x2760('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2760('0x15'))(new Redis(config['redis']));require(_0x2760('0x16'))[_0x2760('0x17')](socket);function respondWithStatusCode(_0x414818,_0x5c6a3f){_0x5c6a3f=_0x5c6a3f||0xcc;return function(_0xfcf13a){if(_0xfcf13a){return _0x414818[_0x2760('0x18')](_0x5c6a3f);}return _0x414818[_0x2760('0x19')](_0x5c6a3f)[_0x2760('0x1a')]();};}function respondWithResult(_0xb62eca,_0x32f78e){_0x32f78e=_0x32f78e||0xc8;return function(_0x3d310f){if(_0x3d310f){return _0xb62eca['status'](_0x32f78e)[_0x2760('0x1b')](_0x3d310f);}};}function respondWithFilteredResult(_0x180b50,_0x4e4946){return function(_0x3d607d){if(_0x3d607d){var _0x41484d=typeof _0x4e4946[_0x2760('0x1c')]===_0x2760('0x1d')&&typeof _0x4e4946['limit']===_0x2760('0x1d');var _0x3353d9=_0x3d607d['count'];var _0x768594=_0x41484d?0x0:_0x4e4946[_0x2760('0x1c')];var _0x371ca3=_0x41484d?_0x3d607d['count']:_0x4e4946[_0x2760('0x1c')]+_0x4e4946[_0x2760('0x1e')];var _0x197698;if(_0x371ca3>=_0x3353d9){_0x371ca3=_0x3353d9;_0x197698=0xc8;}else{_0x197698=0xce;}_0x180b50[_0x2760('0x19')](_0x197698);return _0x180b50[_0x2760('0x1f')](_0x2760('0x20'),_0x768594+'-'+_0x371ca3+'/'+_0x3353d9)[_0x2760('0x1b')](_0x3d607d);}return null;};}function patchUpdates(_0x295c87){return function(_0x52c787){try{jsonpatch['apply'](_0x52c787,_0x295c87,!![]);}catch(_0x2fd2ce){return BPromise[_0x2760('0x21')](_0x2fd2ce);}return _0x52c787[_0x2760('0x22')]();};}function saveUpdates(_0x7cdaf9,_0x525983){return function(_0x3e57ff){if(_0x3e57ff){return _0x3e57ff[_0x2760('0x23')](_0x7cdaf9)[_0x2760('0x24')](function(_0x5e173a){return _0x5e173a;});}return null;};}function removeEntity(_0x1be726,_0x13e5e7){return function(_0x271408){if(_0x271408){return _0x271408[_0x2760('0x25')]()[_0x2760('0x24')](function(){var _0x51551d=_0x271408[_0x2760('0x26')]({'plain':!![]});var _0x18a618=_0x2760('0x27');return db[_0x2760('0x28')][_0x2760('0x25')]({'where':{'type':_0x18a618,'resourceId':_0x51551d['id']}})[_0x2760('0x24')](function(){return _0x271408;});})[_0x2760('0x24')](function(){_0x1be726[_0x2760('0x19')](0xcc)[_0x2760('0x1a')]();});}};}function handleEntityNotFound(_0x5cd234,_0x25f840){return function(_0x388b8e){if(!_0x388b8e){_0x5cd234[_0x2760('0x18')](0x194);}return _0x388b8e;};}function handleError(_0x5ab409,_0x29fc2c){_0x29fc2c=_0x29fc2c||0x1f4;return function(_0x989367){logger['error'](_0x989367[_0x2760('0x29')]);if(_0x989367[_0x2760('0x2a')]){delete _0x989367['name'];}_0x5ab409['status'](_0x29fc2c)[_0x2760('0x2b')](_0x989367);};}exports[_0x2760('0x2c')]=function(_0x2c482c,_0xcd959b){var _0xd3a07c={},_0x5cefdf={},_0x5865f8={'count':0x0,'rows':[]};var _0x248471=_[_0x2760('0x2d')](db[_0x2760('0x2e')][_0x2760('0x2f')],function(_0x250471){return{'name':_0x250471[_0x2760('0x30')],'type':_0x250471['type'][_0x2760('0x31')]};});_0x5cefdf[_0x2760('0x32')]=_[_0x2760('0x2d')](_0x248471,'name');_0x5cefdf[_0x2760('0x33')]=_[_0x2760('0x34')](_0x2c482c[_0x2760('0x33')]);_0x5cefdf[_0x2760('0x35')]=_['intersection'](_0x5cefdf[_0x2760('0x32')],_0x5cefdf[_0x2760('0x33')]);_0xd3a07c['attributes']=_['intersection'](_0x5cefdf[_0x2760('0x32')],qs['fields'](_0x2c482c[_0x2760('0x33')][_0x2760('0x36')]));_0xd3a07c[_0x2760('0x37')]=_0xd3a07c[_0x2760('0x37')][_0x2760('0x38')]?_0xd3a07c[_0x2760('0x37')]:_0x5cefdf[_0x2760('0x32')];if(!_0x2c482c[_0x2760('0x33')][_0x2760('0x39')](_0x2760('0x3a'))){_0xd3a07c[_0x2760('0x1e')]=qs['limit'](_0x2c482c[_0x2760('0x33')][_0x2760('0x1e')]);_0xd3a07c[_0x2760('0x1c')]=qs[_0x2760('0x1c')](_0x2c482c[_0x2760('0x33')][_0x2760('0x1c')]);}_0xd3a07c[_0x2760('0x3b')]=qs['sort'](_0x2c482c[_0x2760('0x33')]['sort']);_0xd3a07c[_0x2760('0x3c')]=qs['filters'](_[_0x2760('0x3d')](_0x2c482c[_0x2760('0x33')],_0x5cefdf['filters']),_0x248471);if(_0x2c482c[_0x2760('0x33')][_0x2760('0x3e')]){_0xd3a07c[_0x2760('0x3c')]=_[_0x2760('0x3f')](_0xd3a07c[_0x2760('0x3c')],{'$or':_[_0x2760('0x2d')](_0x248471,function(_0x496a8b){if(_0x496a8b[_0x2760('0x40')]!==_0x2760('0x41')){var _0x5f3eba={};_0x5f3eba[_0x496a8b[_0x2760('0x2a')]]={'$like':'%'+_0x2c482c[_0x2760('0x33')][_0x2760('0x3e')]+'%'};return _0x5f3eba;}})});}_0xd3a07c=_[_0x2760('0x3f')]({},_0xd3a07c,_0x2c482c[_0x2760('0x42')]);var _0x2b0714={'where':_0xd3a07c['where']};return db[_0x2760('0x2e')][_0x2760('0x43')](_0x2b0714)['then'](function(_0x29d541){_0x5865f8['count']=_0x29d541;if(_0x2c482c[_0x2760('0x33')][_0x2760('0x44')]){_0xd3a07c['include']=[{'all':!![]}];}return db[_0x2760('0x2e')]['findAll'](_0xd3a07c);})[_0x2760('0x24')](function(_0x146666){_0x5865f8['rows']=_0x146666;return _0x5865f8;})['then'](respondWithFilteredResult(_0xcd959b,_0xd3a07c))[_0x2760('0x45')](handleError(_0xcd959b,null));};exports[_0x2760('0x46')]=function(_0x4e9a41,_0x41c87a){var _0x408941={'raw':![],'where':{'id':_0x4e9a41[_0x2760('0x47')]['id']}},_0x259b97={};_0x259b97['model']=_[_0x2760('0x34')](db[_0x2760('0x2e')][_0x2760('0x2f')]);_0x259b97[_0x2760('0x33')]=_['keys'](_0x4e9a41[_0x2760('0x33')]);_0x259b97[_0x2760('0x35')]=_['intersection'](_0x259b97[_0x2760('0x32')],_0x259b97[_0x2760('0x33')]);_0x408941[_0x2760('0x37')]=_[_0x2760('0x48')](_0x259b97[_0x2760('0x32')],qs[_0x2760('0x36')](_0x4e9a41['query'][_0x2760('0x36')]));_0x408941['attributes']=_0x408941[_0x2760('0x37')][_0x2760('0x38')]?_0x408941[_0x2760('0x37')]:_0x259b97[_0x2760('0x32')];if(_0x4e9a41[_0x2760('0x33')][_0x2760('0x44')]){_0x408941['include']=[{'all':!![]}];}_0x408941=_[_0x2760('0x3f')]({},_0x408941,_0x4e9a41[_0x2760('0x42')]);return db[_0x2760('0x2e')]['find'](_0x408941)['then'](handleEntityNotFound(_0x41c87a,null))[_0x2760('0x24')](respondWithResult(_0x41c87a,null))[_0x2760('0x45')](handleError(_0x41c87a,null));};exports[_0x2760('0x49')]=function(_0x335f88,_0x583ccb){return db['CmList'][_0x2760('0x49')](_0x335f88[_0x2760('0x4a')],{})[_0x2760('0x24')](function(_0x3ba55b){var _0x563f20=_0x335f88[_0x2760('0x4b')][_0x2760('0x26')]({'plain':!![]});if(!_0x563f20)throw new Error(_0x2760('0x4c'));if(_0x563f20[_0x2760('0x4d')]===_0x2760('0x4b')){var _0x1f0e29=_0x3ba55b[_0x2760('0x26')]({'plain':!![]});var _0x1610c7=_0x2760('0x27');return db[_0x2760('0x4e')]['find']({'where':{'name':_0x1610c7,'userProfileId':_0x563f20[_0x2760('0x4f')]},'raw':!![]})['then'](function(_0x2be2c4){if(_0x2be2c4&&_0x2be2c4[_0x2760('0x50')]===0x0){return db[_0x2760('0x28')]['create']({'name':_0x1f0e29[_0x2760('0x2a')],'resourceId':_0x1f0e29['id'],'type':_0x2be2c4['name'],'sectionId':_0x2be2c4['id']},{})[_0x2760('0x24')](function(){return _0x3ba55b;});}else{return _0x3ba55b;}})[_0x2760('0x45')](function(_0x2a715a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a715a);throw _0x2a715a;});}return _0x3ba55b;})[_0x2760('0x24')](respondWithResult(_0x583ccb,0xc9))['catch'](handleError(_0x583ccb,null));};exports[_0x2760('0x23')]=function(_0x1a0486,_0x2de7b5){if(_0x1a0486[_0x2760('0x4a')]['id']){delete _0x1a0486['body']['id'];}return db[_0x2760('0x2e')][_0x2760('0x51')]({'where':{'id':_0x1a0486[_0x2760('0x47')]['id']}})[_0x2760('0x24')](handleEntityNotFound(_0x2de7b5,null))[_0x2760('0x24')](saveUpdates(_0x1a0486[_0x2760('0x4a')],null))['then'](respondWithResult(_0x2de7b5,null))[_0x2760('0x45')](handleError(_0x2de7b5,null));};exports[_0x2760('0x25')]=function(_0x4ffbd7,_0x5bc9fb){return db[_0x2760('0x2e')][_0x2760('0x51')]({'where':{'id':_0x4ffbd7[_0x2760('0x47')]['id']}})[_0x2760('0x24')](handleEntityNotFound(_0x5bc9fb,null))['then'](removeEntity(_0x5bc9fb,null))[_0x2760('0x45')](handleError(_0x5bc9fb,null));};exports[_0x2760('0x52')]=function(_0x54e1ed,_0x9160c4){return db[_0x2760('0x2e')][_0x2760('0x52')]()['then'](respondWithResult(_0x9160c4,null))['catch'](handleError(_0x9160c4,null));};exports[_0x2760('0x53')]=function(_0x4f62ed,_0x56e381,_0x18678d){if(_0x4f62ed[_0x2760('0x4a')]['id']){delete _0x4f62ed['body']['id'];}return db[_0x2760('0x2e')][_0x2760('0x51')]({'where':{'id':_0x4f62ed['params']['id']}})[_0x2760('0x24')](handleEntityNotFound(_0x56e381,null))[_0x2760('0x24')](function(_0x24c816){if(_0x24c816){_0x4f62ed[_0x2760('0x4a')][_0x2760('0x54')]=_0x24c816['id'];return db[_0x2760('0x55')][_0x2760('0x49')](_0x4f62ed['body']);}})[_0x2760('0x24')](respondWithResult(_0x56e381,null))['catch'](handleError(_0x56e381,null));};exports[_0x2760('0x56')]=function(_0x168115,_0x4b01ce,_0x513b49){var _0x4278dd={'raw':![],'where':{}};var _0x4b6835={};var _0x4a0b34={'count':0x0,'rows':[]};return db[_0x2760('0x2e')][_0x2760('0x57')]({'where':{'id':_0x168115[_0x2760('0x47')]['id']}})[_0x2760('0x24')](handleEntityNotFound(_0x4b01ce,null))['then'](function(_0x4f5cae){if(_0x4f5cae){_0x4b6835[_0x2760('0x32')]=_[_0x2760('0x34')](db[_0x2760('0x55')]['rawAttributes']);_0x4b6835['query']=_[_0x2760('0x34')](_0x168115[_0x2760('0x33')]);_0x4b6835['filters']=_[_0x2760('0x48')](_0x4b6835['model'],_0x4b6835[_0x2760('0x33')]);_0x4278dd[_0x2760('0x37')]=_[_0x2760('0x48')](_0x4b6835['model'],qs[_0x2760('0x36')](_0x168115[_0x2760('0x33')][_0x2760('0x36')]));_0x4278dd[_0x2760('0x37')]=_0x4278dd['attributes'][_0x2760('0x38')]?_0x4278dd[_0x2760('0x37')]:_0x4b6835[_0x2760('0x32')];if(!_0x168115[_0x2760('0x33')][_0x2760('0x39')]('nolimit')){_0x4278dd['limit']=qs[_0x2760('0x1e')](_0x168115['query'][_0x2760('0x1e')]);_0x4278dd[_0x2760('0x1c')]=qs[_0x2760('0x1c')](_0x168115[_0x2760('0x33')][_0x2760('0x1c')]);}_0x4278dd['order']=qs[_0x2760('0x58')](_0x168115['query'][_0x2760('0x58')]);_0x4278dd[_0x2760('0x3c')]=qs['filters'](_[_0x2760('0x3d')](_0x168115['query'],_0x4b6835[_0x2760('0x35')]));_0x4278dd[_0x2760('0x3c')][_0x2760('0x54')]=_0x4f5cae['id'];if(_0x168115[_0x2760('0x33')][_0x2760('0x3e')]){_0x4278dd[_0x2760('0x3c')]=_[_0x2760('0x3f')](_0x4278dd[_0x2760('0x3c')],{'$or':_['map'](_0x4278dd[_0x2760('0x37')],function(_0x2c4551){var _0x149b4a={};_0x149b4a[_0x2c4551]={'$like':'%'+_0x168115[_0x2760('0x33')][_0x2760('0x3e')]+'%'};return _0x149b4a;})});}_0x4278dd=_[_0x2760('0x3f')]({},_0x4278dd,_0x168115['options']);return db[_0x2760('0x55')][_0x2760('0x43')]({'where':_0x4278dd[_0x2760('0x3c')]})['then'](function(_0x3eccd6){_0x4a0b34[_0x2760('0x43')]=_0x3eccd6;if(_0x168115[_0x2760('0x33')]['includeAll']){_0x4278dd[_0x2760('0x59')]=[{'all':!![]}];}return db[_0x2760('0x55')][_0x2760('0x5a')](_0x4278dd);})[_0x2760('0x24')](function(_0x2c4807){_0x4a0b34[_0x2760('0x5b')]=_0x2c4807;return _0x4a0b34;});}})['then'](respondWithFilteredResult(_0x4b01ce,_0x4278dd))['catch'](handleError(_0x4b01ce,null));};exports['removeDispositions']=function(_0x3fcd1d,_0x142b55,_0x4bb82f){return db[_0x2760('0x2e')][_0x2760('0x51')]({'where':{'id':_0x3fcd1d[_0x2760('0x47')]['id']}})[_0x2760('0x24')](handleEntityNotFound(_0x142b55,null))[_0x2760('0x24')](function(_0x3f3bef){if(_0x3f3bef){return _0x3f3bef[_0x2760('0x5c')](_0x3fcd1d['query'][_0x2760('0x5d')]);}})[_0x2760('0x24')](respondWithStatusCode(_0x142b55,null))['catch'](handleError(_0x142b55,null));};exports[_0x2760('0x5e')]=function(_0x41d056,_0x1f78b8,_0x261ed6){return db['CmList'][_0x2760('0x51')]({'where':{'id':_0x41d056[_0x2760('0x47')]['id']}})[_0x2760('0x24')](handleEntityNotFound(_0x1f78b8,null))[_0x2760('0x24')](function(_0x11eead){if(_0x11eead){var _0x2bfcf2=[];var _0x1e5d48={'success':[],'errors':[]};return db[_0x2760('0x5f')]['describe']()[_0x2760('0x24')](function(_0x13b9ed){if(_0x41d056['body'][_0x2760('0x60')]&&_[_0x2760('0x61')](_0x41d056[_0x2760('0x4a')][_0x2760('0x60')])){if(_0x41d056['body'][_0x2760('0x60')][_0x2760('0x38')]){_0x41d056['body']['tags']=_0x41d056[_0x2760('0x4a')][_0x2760('0x60')][_0x2760('0x62')](';')+';';}else{_0x41d056[_0x2760('0x4a')][_0x2760('0x60')]=null;}}else{_0x41d056[_0x2760('0x4a')]['tags']=null;}if(_0x41d056[_0x2760('0x4a')]&&_[_0x2760('0x61')](_0x41d056[_0x2760('0x4a')])){for(var _0x1d5072=0x0;_0x1d5072<_0x41d056[_0x2760('0x4a')][_0x2760('0x38')];_0x1d5072+=0x1){_0x41d056['body'][_0x1d5072][_0x2760('0x54')]=_0x41d056[_0x2760('0x47')]['id'];_0x2bfcf2[_0x2760('0x63')](_0x41d056[_0x2760('0x4a')][_0x1d5072]);}return BPromise[_0x2760('0x64')](_0x2bfcf2,function(_0x49e1ff){return db[_0x2760('0x5f')][_0x2760('0x49')](_[_0x2760('0x65')](_0x49e1ff,[_0x2760('0x5d'),'id'])||{},{'fields':_[_0x2760('0x34')](_0x13b9ed),'raw':!![]})['then'](function(_0x9a8ca5){_0x1e5d48[_0x2760('0x66')]['push'](_0x9a8ca5[_0x2760('0x67')]);})['catch'](function(_0x465f63){_0x1e5d48[_0x2760('0x68')][_0x2760('0x63')]({'data':_0x49e1ff,'error':_0x465f63[_0x2760('0x69')]});});})[_0x2760('0x24')](function(_0x564fdb){return _0x1e5d48;})[_0x2760('0x45')](function(_0x135c52){return _0x135c52;});}else{_0x1f78b8[_0x2760('0x19')](0x190)[_0x2760('0x1b')]({'message':_0x2760('0x6a')});}});}})[_0x2760('0x24')](respondWithResult(_0x1f78b8,null))[_0x2760('0x45')](handleError(_0x1f78b8,null));};exports[_0x2760('0x6b')]=function(_0x16ca4d,_0x1266c2,_0x57c7f3){var _0x297bb7;return db[_0x2760('0x2e')][_0x2760('0x51')]({'where':{'id':_0x16ca4d[_0x2760('0x47')]['id']},'include':[{'model':db[_0x2760('0x6c')],'as':_0x2760('0x6d')}]})['then'](handleEntityNotFound(_0x1266c2,null))[_0x2760('0x24')](function(_0x221c2e){if(_0x221c2e){_0x297bb7=_0x221c2e;return db[_0x2760('0x5f')][_0x2760('0x2f')];}})[_0x2760('0x24')](function(_0x29816e){if(_0x29816e){var _0x10b39a={};var _0x557da8={};_0x557da8[_0x2760('0x32')]=_[_0x2760('0x6e')](_[_0x2760('0x34')](_0x29816e),_[_0x2760('0x2d')](_0x297bb7['CustomFields'],function(_0x32dc3f){return util[_0x2760('0x6f')](_0x2760('0x70'),_0x32dc3f['id']);}));_0x557da8[_0x2760('0x33')]=_[_0x2760('0x34')](_0x16ca4d[_0x2760('0x33')]);_0x557da8[_0x2760('0x35')]=_[_0x2760('0x48')](_0x557da8['model'],_0x557da8[_0x2760('0x33')]);_0x10b39a[_0x2760('0x37')]=_['intersection'](_0x557da8[_0x2760('0x32')],qs[_0x2760('0x36')](_0x16ca4d[_0x2760('0x33')][_0x2760('0x36')]));_0x10b39a[_0x2760('0x37')]=_0x10b39a[_0x2760('0x37')][_0x2760('0x38')]?_0x10b39a[_0x2760('0x37')]:_0x557da8['model'];if(!_0x16ca4d['query']['hasOwnProperty'](_0x2760('0x3a'))){_0x10b39a[_0x2760('0x1e')]=qs[_0x2760('0x1e')](_0x16ca4d[_0x2760('0x33')][_0x2760('0x1e')]);_0x10b39a['offset']=qs['offset'](_0x16ca4d['query'][_0x2760('0x1c')]);}_0x10b39a[_0x2760('0x3b')]=qs['sort'](_0x16ca4d[_0x2760('0x33')][_0x2760('0x58')]);_0x10b39a[_0x2760('0x3c')]=qs['filters'](_[_0x2760('0x3d')](_0x16ca4d['query'],_0x557da8['filters']));_0x10b39a[_0x2760('0x71')]=!![];if(_0x16ca4d['query'][_0x2760('0x3e')]){_0x10b39a[_0x2760('0x3c')]=_[_0x2760('0x3f')](_0x10b39a[_0x2760('0x3c')],{'$or':_['map'](_0x10b39a[_0x2760('0x37')],function(_0x528f86){var _0x30e61a={};_0x30e61a[_0x528f86]={'$like':'%'+_0x16ca4d['query'][_0x2760('0x3e')]+'%'};return _0x30e61a;})});}_0x10b39a=_[_0x2760('0x3f')]({},_0x10b39a,_0x16ca4d[_0x2760('0x42')]);return _0x297bb7['getContacts'](_0x10b39a);}})[_0x2760('0x24')](respondWithResult(_0x1266c2,null))['catch'](handleError(_0x1266c2,null));};exports[_0x2760('0x72')]=function(_0x638ae4,_0x420678,_0x299721){var _0x5b0945;return db[_0x2760('0x2e')][_0x2760('0x51')]({'where':{'id':_0x638ae4[_0x2760('0x47')]['id']},'include':[{'model':db[_0x2760('0x6c')],'as':_0x2760('0x6d')}]})['then'](handleEntityNotFound(_0x420678,null))[_0x2760('0x24')](function(_0x11fba3){if(_0x11fba3){_0x5b0945=_0x11fba3;return db[_0x2760('0x5f')]['rawAttributes'];}})[_0x2760('0x24')](function(_0x58dbb9){if(_0x58dbb9){var _0x351916={};var _0x5a42f5={};_0x5a42f5[_0x2760('0x32')]=_[_0x2760('0x6e')](_[_0x2760('0x34')](_0x58dbb9),_[_0x2760('0x2d')](_0x5b0945[_0x2760('0x6d')],function(_0x12a971){return util[_0x2760('0x6f')](_0x2760('0x70'),_0x12a971['id']);}));_0x5a42f5[_0x2760('0x33')]=_[_0x2760('0x34')](_0x638ae4[_0x2760('0x33')]);_0x5a42f5[_0x2760('0x35')]=_[_0x2760('0x48')](_0x5a42f5[_0x2760('0x32')],_0x5a42f5['query']);_0x351916[_0x2760('0x37')]=_[_0x2760('0x48')](_0x5a42f5[_0x2760('0x32')],qs[_0x2760('0x36')](_0x638ae4[_0x2760('0x33')][_0x2760('0x36')]));_0x351916[_0x2760('0x37')]=_0x351916[_0x2760('0x37')][_0x2760('0x38')]?_0x351916[_0x2760('0x37')]:_0x5a42f5[_0x2760('0x32')];if(!_0x638ae4[_0x2760('0x33')][_0x2760('0x39')](_0x2760('0x3a'))){_0x351916[_0x2760('0x1e')]=qs[_0x2760('0x1e')](_0x638ae4[_0x2760('0x33')][_0x2760('0x1e')]);_0x351916[_0x2760('0x1c')]=qs[_0x2760('0x1c')](_0x638ae4[_0x2760('0x33')]['offset']);}_0x351916[_0x2760('0x3b')]=qs[_0x2760('0x58')](_0x638ae4[_0x2760('0x33')]['sort']);_0x351916[_0x2760('0x3c')]=qs[_0x2760('0x35')](_['pick'](_0x638ae4[_0x2760('0x33')],_0x5a42f5[_0x2760('0x35')]));_0x351916[_0x2760('0x71')]=!![];if(_0x638ae4[_0x2760('0x33')]['filter']){_0x351916[_0x2760('0x3c')]=_[_0x2760('0x3f')](_0x351916['where'],{'$or':_[_0x2760('0x2d')](_0x351916['attributes'],function(_0x50af6f){var _0xae07ac={};_0xae07ac[_0x50af6f]={'$like':'%'+_0x638ae4['query'][_0x2760('0x3e')]+'%'};return _0xae07ac;})});}_0x351916=_['merge']({},_0x351916,_0x638ae4[_0x2760('0x42')]);return _0x5b0945[_0x2760('0x6b')](_0x351916);}})[_0x2760('0x24')](function(_0x3fdd59){if(!_[_0x2760('0x73')](_0x3fdd59)){var _0x443c18=toCsv(_0x3fdd59);var _0x3d876c=Date[_0x2760('0x74')]();fs[_0x2760('0x75')](util['format']('/tmp/list_%d_%s.csv',_0x5b0945['id'],_0x3d876c),_0x443c18);_0x420678[_0x2760('0x76')]('Content-disposition',_0x2760('0x77')+util[_0x2760('0x6f')](_0x2760('0x78'),_0x5b0945['id'],_0x3d876c));_0x420678[_0x2760('0x76')](_0x2760('0x79'),_0x2760('0x7a'));return _0x420678[_0x2760('0x7b')](util[_0x2760('0x6f')]('/tmp/list_%d_%s.csv',_0x5b0945['id'],_0x3d876c));}else{return _0x420678[_0x2760('0x18')](0xcc);}})['catch'](handleError(_0x420678,null));};exports['addCustomField']=function(_0x9d8616,_0x62b1ba,_0x2c7e3e){var _0x4873ea;delete _0x9d8616[_0x2760('0x4a')]['id'];return db[_0x2760('0x2e')][_0x2760('0x57')]({'where':{'id':_0x9d8616[_0x2760('0x47')]['id']}})['then'](handleEntityNotFound(_0x62b1ba,null))[_0x2760('0x24')](function(_0x36ce2d){if(_0x36ce2d){return db[_0x2760('0x7c')][_0x2760('0x7d')](function(_0xe9f6ae){return db[_0x2760('0x6c')][_0x2760('0x49')](_0x9d8616[_0x2760('0x4a')],{'transaction':_0xe9f6ae})[_0x2760('0x24')](function(_0x5bdd81){_0x4873ea=_0x5bdd81;return _0x36ce2d[_0x2760('0x7e')](_0x5bdd81,{'transaction':_0xe9f6ae});})['then'](function(){var _0x583cd3={'type':db['Sequelize'][_0x2760('0x7f')],'transaction':_0xe9f6ae};switch(_0x9d8616['body'][_0x2760('0x40')]){case _0x2760('0x80'):_0x583cd3['type']=db[_0x2760('0x81')][_0x2760('0x7f')];break;case _0x2760('0x82'):_0x583cd3[_0x2760('0x40')]=db['Sequelize'][_0x2760('0x83')];break;case _0x2760('0x84'):_0x583cd3[_0x2760('0x40')]=db[_0x2760('0x81')][_0x2760('0x85')];_0x583cd3['defaultValue']=![];break;default:}return db[_0x2760('0x7c')]['queryInterface']['addColumn'](_0x2760('0x86'),util['format']('cf_%s',_0x4873ea['id']),_0x583cd3);})['then'](function(){return _0x4873ea;});});}})[_0x2760('0x24')](respondWithResult(_0x62b1ba,null))[_0x2760('0x45')](handleError(_0x62b1ba,null));};exports[_0x2760('0x87')]=function(_0x22df1b,_0x3decbb,_0x1efbc6){var _0x87255b={};var _0x502c95={};var _0x14cf9f;var _0x171585;return db[_0x2760('0x2e')][_0x2760('0x57')]({'where':{'id':_0x22df1b['params']['id']}})['then'](handleEntityNotFound(_0x3decbb,null))[_0x2760('0x24')](function(_0x1e0800){if(_0x1e0800){_0x14cf9f=_0x1e0800;_0x502c95[_0x2760('0x32')]=_[_0x2760('0x34')](db[_0x2760('0x6c')]['rawAttributes']);_0x502c95[_0x2760('0x33')]=_[_0x2760('0x34')](_0x22df1b[_0x2760('0x33')]);_0x502c95[_0x2760('0x35')]=_['intersection'](_0x502c95[_0x2760('0x32')],_0x502c95[_0x2760('0x33')]);_0x87255b['attributes']=_[_0x2760('0x48')](_0x502c95['model'],qs[_0x2760('0x36')](_0x22df1b['query'][_0x2760('0x36')]));_0x87255b[_0x2760('0x37')]=_0x87255b[_0x2760('0x37')]['length']?_0x87255b[_0x2760('0x37')]:_0x502c95[_0x2760('0x32')];_0x87255b['order']=qs[_0x2760('0x58')](_0x22df1b[_0x2760('0x33')][_0x2760('0x58')]);_0x87255b[_0x2760('0x3c')]=qs[_0x2760('0x35')](_[_0x2760('0x3d')](_0x22df1b[_0x2760('0x33')],_0x502c95[_0x2760('0x35')]));_0x87255b[_0x2760('0x3c')]=_[_0x2760('0x3f')](_0x87255b[_0x2760('0x3c')],{'$or':[{'ListId':_0x1e0800['id']},{'ListId':null}]});if(_0x22df1b[_0x2760('0x33')][_0x2760('0x3e')]){_0x87255b[_0x2760('0x3c')]=_[_0x2760('0x3f')](_0x87255b['where'],{'$or':_[_0x2760('0x2d')](_0x87255b[_0x2760('0x37')],function(_0x33d978){var _0x262439={};_0x262439[_0x33d978]={'$like':'%'+_0x22df1b[_0x2760('0x33')][_0x2760('0x3e')]+'%'};return _0x262439;})});}_0x87255b=_[_0x2760('0x3f')]({},_0x87255b,_0x22df1b[_0x2760('0x42')]);return db['CmCustomField'][_0x2760('0x88')](_0x87255b);}})[_0x2760('0x24')](respondWithResult(_0x3decbb,null))[_0x2760('0x45')](handleError(_0x3decbb,null));};exports[_0x2760('0x89')]=function(_0x178398,_0x1c0688,_0x37fb84){return db[_0x2760('0x2e')][_0x2760('0x51')]({'where':{'id':_0x178398[_0x2760('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c0688,null))['then'](function(_0x3548ca){if(_0x3548ca){return _0x3548ca[_0x2760('0x89')](_0x178398['body']['ids'],_['omit'](_0x178398[_0x2760('0x4a')],[_0x2760('0x5d'),'id'])||{})[_0x2760('0x8a')](function(_0x16e47e){for(var _0x1bcd17=0x0;_0x1bcd17<_0x178398[_0x2760('0x4a')][_0x2760('0x5d')][_0x2760('0x38')];_0x1bcd17+=0x1){socket[_0x2760('0x8b')]('userCmList:save',{'UserId':Number(_0x178398[_0x2760('0x4a')][_0x2760('0x5d')][_0x1bcd17]),'CmListId':Number(_0x178398[_0x2760('0x47')]['id'])});}return _0x16e47e;});}})[_0x2760('0x24')](respondWithResult(_0x1c0688,null))['catch'](handleError(_0x1c0688,null));};exports[_0x2760('0x8c')]=function(_0x308a5c,_0x14db13,_0x1ff3e6){return db[_0x2760('0x2e')][_0x2760('0x51')]({'where':{'id':_0x308a5c[_0x2760('0x47')]['id']}})[_0x2760('0x24')](handleEntityNotFound(_0x14db13,null))[_0x2760('0x24')](function(_0xda2b53){if(_0xda2b53){return _0xda2b53[_0x2760('0x8c')](_0x308a5c[_0x2760('0x33')][_0x2760('0x5d')])[_0x2760('0x24')](function(){if(_[_0x2760('0x61')](_0x308a5c[_0x2760('0x33')][_0x2760('0x5d')])){for(var _0x295791=0x0;_0x295791<_0x308a5c[_0x2760('0x33')]['ids'][_0x2760('0x38')];_0x295791+=0x1){socket[_0x2760('0x8b')](_0x2760('0x8d'),{'UserId':Number(_0x308a5c[_0x2760('0x33')][_0x2760('0x5d')][_0x295791]),'CmListId':Number(_0x308a5c[_0x2760('0x47')]['id'])});}}else{socket[_0x2760('0x8b')](_0x2760('0x8d'),{'UserId':Number(_0x308a5c[_0x2760('0x33')][_0x2760('0x5d')]),'CmListId':Number(_0x308a5c[_0x2760('0x47')]['id'])});}});}})[_0x2760('0x24')](respondWithStatusCode(_0x14db13,null))[_0x2760('0x45')](handleError(_0x14db13,null));};exports[_0x2760('0x8e')]=function(_0x3c6659,_0x2d525a,_0x55ad68){var _0x2b5ead={};var _0x35eaba={};var _0x28a9ef;var _0x9350fa;return db['CmList'][_0x2760('0x57')]({'where':{'id':_0x3c6659[_0x2760('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d525a,null))[_0x2760('0x24')](function(_0x4d5697){if(_0x4d5697){_0x28a9ef=_0x4d5697;_0x35eaba[_0x2760('0x32')]=_[_0x2760('0x34')](db[_0x2760('0x8f')][_0x2760('0x2f')]);_0x35eaba['query']=_[_0x2760('0x34')](_0x3c6659[_0x2760('0x33')]);_0x35eaba['filters']=_[_0x2760('0x48')](_0x35eaba[_0x2760('0x32')],_0x35eaba[_0x2760('0x33')]);_0x2b5ead[_0x2760('0x37')]=_[_0x2760('0x48')](_0x35eaba['model'],qs[_0x2760('0x36')](_0x3c6659[_0x2760('0x33')]['fields']));_0x2b5ead[_0x2760('0x37')]=_0x2b5ead[_0x2760('0x37')][_0x2760('0x38')]?_0x2b5ead['attributes']:_0x35eaba[_0x2760('0x32')];_0x2b5ead[_0x2760('0x3b')]=qs[_0x2760('0x58')](_0x3c6659[_0x2760('0x33')]['sort']);_0x2b5ead['where']=qs['filters'](_[_0x2760('0x3d')](_0x3c6659[_0x2760('0x33')],_0x35eaba[_0x2760('0x35')]));if(_0x3c6659[_0x2760('0x33')][_0x2760('0x3e')]){_0x2b5ead[_0x2760('0x3c')]=_[_0x2760('0x3f')](_0x2b5ead[_0x2760('0x3c')],{'$or':_[_0x2760('0x2d')](_0x2b5ead[_0x2760('0x37')],function(_0x18ad3b){var _0x41a6df={};_0x41a6df[_0x18ad3b]={'$like':'%'+_0x3c6659[_0x2760('0x33')][_0x2760('0x3e')]+'%'};return _0x41a6df;})});}_0x2b5ead=_[_0x2760('0x3f')]({},_0x2b5ead,_0x3c6659[_0x2760('0x42')]);return _0x28a9ef[_0x2760('0x8e')](_0x2b5ead);}})[_0x2760('0x24')](function(_0x5b55b6){if(_0x5b55b6){_0x9350fa=_0x5b55b6['length'];if(!_0x3c6659[_0x2760('0x33')][_0x2760('0x39')](_0x2760('0x3a'))){_0x2b5ead[_0x2760('0x1e')]=qs[_0x2760('0x1e')](_0x3c6659[_0x2760('0x33')][_0x2760('0x1e')]);_0x2b5ead[_0x2760('0x1c')]=qs['offset'](_0x3c6659[_0x2760('0x33')][_0x2760('0x1c')]);}return _0x28a9ef[_0x2760('0x8e')](_0x2b5ead);}})[_0x2760('0x24')](function(_0x317642){if(_0x317642){return _0x317642?{'count':_0x9350fa,'rows':_0x317642}:null;}})[_0x2760('0x24')](respondWithResult(_0x2d525a,null))[_0x2760('0x45')](handleError(_0x2d525a,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index cbff888..fdf0fab 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe14b,0x93));var _0xbe14=function(_0x3caa84,_0x7e8d4e){_0x3caa84=_0x3caa84-0x0;var _0x5235bd=_0xe14b[_0x3caa84];return _0x5235bd;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x23785c,_0x1c6e72){var _0x2dc080=function(_0x353f41){while(--_0x353f41){_0x23785c['push'](_0x23785c['shift']());}};_0x2dc080(++_0x1c6e72);}(_0x7217,0x19e));var _0x7721=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x7217[_0x139a3c];return _0x2b375b;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 1d17a08..18d2bdf 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 _0xb821=['rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','../../config/logger','bluebird'];(function(_0x56fde6,_0x5d9b5a){var _0x3327c7=function(_0x5a2208){while(--_0x5a2208){_0x56fde6['push'](_0x56fde6['shift']());}};_0x3327c7(++_0x5d9b5a);}(_0xb821,0xa7));var _0x1b82=function(_0x342edc,_0x274e0c){_0x342edc=_0x342edc-0x0;var _0x424e9b=_0xb821[_0x342edc];return _0x424e9b;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x878f=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x878f,0x173));var _0xf878=function(_0x471d06,_0x5c33f2){_0x471d06=_0x471d06-0x0;var _0x3cff4c=_0x878f[_0x471d06];return _0x3cff4c;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var moment=require(_0xf878('0x3'));var BPromise=require(_0xf878('0x4'));var rp=require(_0xf878('0x5'));var fs=require('fs');var path=require(_0xf878('0x6'));var rimraf=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var attributes=require(_0xf878('0x9'));module[_0xf878('0xa')]=function(_0x4bc9aa,_0x4ac8d8){return _0x4bc9aa[_0xf878('0xb')](_0xf878('0xc'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 7e9d0c1..4a769cf 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 _0xf154=['socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost'];(function(_0x413898,_0x39ac60){var _0x520e78=function(_0x493181){while(--_0x493181){_0x413898['push'](_0x413898['shift']());}};_0x520e78(++_0x39ac60);}(_0xf154,0xab));var _0x4f15=function(_0x25817f,_0x2767f5){_0x25817f=_0x25817f-0x0;var _0x1ef102=_0xf154[_0x25817f];return _0x1ef102;};'use strict';var _=require(_0x4f15('0x0'));var util=require(_0x4f15('0x1'));var moment=require(_0x4f15('0x2'));var BPromise=require(_0x4f15('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f15('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f15('0x5'))('rpc');var config=require(_0x4f15('0x6'));var jayson=require(_0x4f15('0x7'));var client=jayson['client'][_0x4f15('0x8')]({'port':0x232a});config[_0x4f15('0x9')]=_['defaults'](config[_0x4f15('0x9')],{'host':_0x4f15('0xa'),'port':0x18eb});var socket=require(_0x4f15('0xb'))(new Redis(config['redis']));require(_0x4f15('0xc'))[_0x4f15('0xd')](socket);function respondWithRpcPromise(_0x42c13b,_0xd25f02,_0x5b7a58){return new BPromise(function(_0x470872,_0x3dee0d){return client[_0x4f15('0xe')](_0x42c13b,_0x5b7a58)[_0x4f15('0xf')](function(_0x282d84){logger[_0x4f15('0x10')](_0x4f15('0x11'),_0xd25f02,_0x4f15('0x12'));logger[_0x4f15('0x13')](_0x4f15('0x14'),_0xd25f02,_0x4f15('0x12'),JSON[_0x4f15('0x15')](_0x282d84));if(_0x282d84[_0x4f15('0x16')]){if(_0x282d84[_0x4f15('0x16')][_0x4f15('0x17')]===0x1f4){logger[_0x4f15('0x16')]('CmList,\x20%s,\x20%s',_0xd25f02,_0x282d84['error'][_0x4f15('0x18')]);return _0x3dee0d(_0x282d84[_0x4f15('0x16')][_0x4f15('0x18')]);}logger[_0x4f15('0x16')](_0x4f15('0x11'),_0xd25f02,_0x282d84['error'][_0x4f15('0x18')]);return _0x470872(_0x282d84[_0x4f15('0x16')][_0x4f15('0x18')]);}else{logger[_0x4f15('0x10')](_0x4f15('0x11'),_0xd25f02,'request\x20sent');_0x470872(_0x282d84[_0x4f15('0x19')][_0x4f15('0x18')]);}})['catch'](function(_0x129c92){logger[_0x4f15('0x16')](_0x4f15('0x11'),_0xd25f02,_0x129c92);_0x3dee0d(_0x129c92);});});} \ No newline at end of file +var _0x1a8c=['defaults','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x4853cb,_0x2015fa){var _0x8a8a8c=function(_0xc5a52b){while(--_0xc5a52b){_0x4853cb['push'](_0x4853cb['shift']());}};_0x8a8a8c(++_0x2015fa);}(_0x1a8c,0xf0));var _0xc1a8=function(_0x3dc305,_0x5b0a22){_0x3dc305=_0x3dc305-0x0;var _0x272d25=_0x1a8c[_0x3dc305];return _0x272d25;};'use strict';var _=require(_0xc1a8('0x0'));var util=require(_0xc1a8('0x1'));var moment=require(_0xc1a8('0x2'));var BPromise=require(_0xc1a8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc1a8('0x4'))['db'];var utils=require(_0xc1a8('0x5'));var logger=require(_0xc1a8('0x6'))(_0xc1a8('0x7'));var config=require(_0xc1a8('0x8'));var jayson=require(_0xc1a8('0x9'));var client=jayson[_0xc1a8('0xa')]['http']({'port':0x232a});config[_0xc1a8('0xb')]=_[_0xc1a8('0xc')](config[_0xc1a8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc1a8('0xd'))(new Redis(config[_0xc1a8('0xb')]));require(_0xc1a8('0xe'))[_0xc1a8('0xf')](socket);function respondWithRpcPromise(_0x5bdfd9,_0xdfd3ff,_0x41d9db){return new BPromise(function(_0x1b5827,_0xd7d7b7){return client[_0xc1a8('0x10')](_0x5bdfd9,_0x41d9db)[_0xc1a8('0x11')](function(_0x353f19){logger['info'](_0xc1a8('0x12'),_0xdfd3ff,_0xc1a8('0x13'));logger[_0xc1a8('0x14')](_0xc1a8('0x15'),_0xdfd3ff,_0xc1a8('0x13'),JSON[_0xc1a8('0x16')](_0x353f19));if(_0x353f19[_0xc1a8('0x17')]){if(_0x353f19['error']['code']===0x1f4){logger[_0xc1a8('0x17')](_0xc1a8('0x12'),_0xdfd3ff,_0x353f19[_0xc1a8('0x17')][_0xc1a8('0x18')]);return _0xd7d7b7(_0x353f19[_0xc1a8('0x17')][_0xc1a8('0x18')]);}logger[_0xc1a8('0x17')](_0xc1a8('0x12'),_0xdfd3ff,_0x353f19[_0xc1a8('0x17')][_0xc1a8('0x18')]);return _0x1b5827(_0x353f19[_0xc1a8('0x17')][_0xc1a8('0x18')]);}else{logger[_0xc1a8('0x19')](_0xc1a8('0x12'),_0xdfd3ff,'request\x20sent');_0x1b5827(_0x353f19[_0xc1a8('0x1a')][_0xc1a8('0x18')]);}})[_0xc1a8('0x1b')](function(_0x449c37){logger['error']('CmList,\x20%s,\x20%s',_0xdfd3ff,_0x449c37);_0xd7d7b7(_0x449c37);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 8796d94..726ca79 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 _0x4d38=['save','remove','update','emit','register','length','cmList:','./cmList.events'];(function(_0x22db67,_0x111580){var _0x28ac5b=function(_0x9b89c9){while(--_0x9b89c9){_0x22db67['push'](_0x22db67['shift']());}};_0x28ac5b(++_0x111580);}(_0x4d38,0xb7));var _0x84d3=function(_0x4ea809,_0x5416a6){_0x4ea809=_0x4ea809-0x0;var _0x31be45=_0x4d38[_0x4ea809];return _0x31be45;};'use strict';var CmListEvents=require(_0x84d3('0x0'));var events=[_0x84d3('0x1'),_0x84d3('0x2'),_0x84d3('0x3')];function createListener(_0x23f8e2,_0x31bf61){return function(_0x1c5d3d){_0x31bf61[_0x84d3('0x4')](_0x23f8e2,_0x1c5d3d);};}function removeListener(_0x2b937f,_0x28f4bb){return function(){CmListEvents['removeListener'](_0x2b937f,_0x28f4bb);};}exports[_0x84d3('0x5')]=function(_0x2edff8){for(var _0x22f805=0x0,_0x3dad03=events[_0x84d3('0x6')];_0x22f805<_0x3dad03;_0x22f805++){var _0x31007d=events[_0x22f805];var _0x254274=createListener(_0x84d3('0x7')+_0x31007d,_0x2edff8);CmListEvents['on'](_0x31007d,_0x254274);}}; \ No newline at end of file +var _0x6132=['save','remove','update','emit','removeListener','length','./cmList.events'];(function(_0x980ce1,_0x3be2d0){var _0x19d81d=function(_0x53bb4b){while(--_0x53bb4b){_0x980ce1['push'](_0x980ce1['shift']());}};_0x19d81d(++_0x3be2d0);}(_0x6132,0x13a));var _0x2613=function(_0x47466c,_0x32a63a){_0x47466c=_0x47466c-0x0;var _0x21beb4=_0x6132[_0x47466c];return _0x21beb4;};'use strict';var CmListEvents=require(_0x2613('0x0'));var events=[_0x2613('0x1'),_0x2613('0x2'),_0x2613('0x3')];function createListener(_0x4a191a,_0x2e19a7){return function(_0x1a9371){_0x2e19a7[_0x2613('0x4')](_0x4a191a,_0x1a9371);};}function removeListener(_0x35c979,_0x555746){return function(){CmListEvents[_0x2613('0x5')](_0x35c979,_0x555746);};}exports['register']=function(_0x59240d){for(var _0x30cac4=0x0,_0x309663=events[_0x2613('0x6')];_0x30cac4<_0x309663;_0x30cac4++){var _0x465a32=events[_0x30cac4];var _0xe295ea=createListener('cmList:'+_0x465a32,_0x59240d);CmListEvents['on'](_0x465a32,_0xe295ea);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 4b0c43c..5c0bf1e 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 _0xf1a8=['destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','post','addDisposition','addContacts','addCustomField','addAgents','put','/:id','delete'];(function(_0x288ee3,_0x54f028){var _0x5a9cdc=function(_0x395343){while(--_0x395343){_0x288ee3['push'](_0x288ee3['shift']());}};_0x5a9cdc(++_0x54f028);}(_0xf1a8,0x190));var _0x8f1a=function(_0x4595f3,_0x56c99f){_0x4595f3=_0x4595f3-0x0;var _0x3884b1=_0xf1a8[_0x4595f3];return _0x3884b1;};'use strict';var multer=require(_0x8f1a('0x0'));var util=require(_0x8f1a('0x1'));var path=require(_0x8f1a('0x2'));var timeout=require(_0x8f1a('0x3'));var express=require(_0x8f1a('0x4'));var router=express[_0x8f1a('0x5')]();var fs_extra=require(_0x8f1a('0x6'));var auth=require(_0x8f1a('0x7'));var interaction=require(_0x8f1a('0x8'));var config=require(_0x8f1a('0x9'));var controller=require(_0x8f1a('0xa'));router[_0x8f1a('0xb')]('/',auth['isAuthenticated'](),controller[_0x8f1a('0xc')]);router[_0x8f1a('0xb')](_0x8f1a('0xd'),auth[_0x8f1a('0xe')](),controller['describe']);router['get']('/:id',auth[_0x8f1a('0xe')](),controller[_0x8f1a('0xf')]);router[_0x8f1a('0xb')](_0x8f1a('0x10'),auth[_0x8f1a('0xe')](),controller[_0x8f1a('0x11')]);router[_0x8f1a('0xb')](_0x8f1a('0x12'),auth['isAuthenticated'](),controller[_0x8f1a('0x13')]);router[_0x8f1a('0xb')](_0x8f1a('0x14'),auth[_0x8f1a('0xe')](),controller['getContactsCsv']);router['get'](_0x8f1a('0x15'),auth[_0x8f1a('0xe')](),controller[_0x8f1a('0x16')]);router[_0x8f1a('0xb')](_0x8f1a('0x17'),auth[_0x8f1a('0xe')](),controller['getAgents']);router['post']('/',auth[_0x8f1a('0xe')](),controller['create']);router[_0x8f1a('0x18')]('/:id/dispositions',auth[_0x8f1a('0xe')](),controller[_0x8f1a('0x19')]);router[_0x8f1a('0x18')](_0x8f1a('0x12'),auth[_0x8f1a('0xe')](),controller[_0x8f1a('0x1a')]);router[_0x8f1a('0x18')](_0x8f1a('0x15'),auth['isAuthenticated'](),controller[_0x8f1a('0x1b')]);router['post'](_0x8f1a('0x17'),auth[_0x8f1a('0xe')](),controller[_0x8f1a('0x1c')]);router[_0x8f1a('0x1d')](_0x8f1a('0x1e'),auth[_0x8f1a('0xe')](),controller['update']);router[_0x8f1a('0x1f')](_0x8f1a('0x1e'),auth[_0x8f1a('0xe')](),controller[_0x8f1a('0x20')]);router['delete'](_0x8f1a('0x10'),auth[_0x8f1a('0xe')](),controller[_0x8f1a('0x21')]);router[_0x8f1a('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x8f1a('0x22')]);module[_0x8f1a('0x23')]=router; \ No newline at end of file +var _0x7f06=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addContacts','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe'];(function(_0x367361,_0x311488){var _0x195d2d=function(_0x2b20a4){while(--_0x2b20a4){_0x367361['push'](_0x367361['shift']());}};_0x195d2d(++_0x311488);}(_0x7f06,0xe8));var _0x67f0=function(_0x26764f,_0x43f4e7){_0x26764f=_0x26764f-0x0;var _0x53c715=_0x7f06[_0x26764f];return _0x53c715;};'use strict';var multer=require(_0x67f0('0x0'));var util=require(_0x67f0('0x1'));var path=require(_0x67f0('0x2'));var timeout=require('connect-timeout');var express=require(_0x67f0('0x3'));var router=express[_0x67f0('0x4')]();var fs_extra=require(_0x67f0('0x5'));var auth=require(_0x67f0('0x6'));var interaction=require(_0x67f0('0x7'));var config=require('../../config/environment');var controller=require(_0x67f0('0x8'));router[_0x67f0('0x9')]('/',auth[_0x67f0('0xa')](),controller[_0x67f0('0xb')]);router[_0x67f0('0x9')](_0x67f0('0xc'),auth['isAuthenticated'](),controller[_0x67f0('0xd')]);router[_0x67f0('0x9')](_0x67f0('0xe'),auth[_0x67f0('0xa')](),controller[_0x67f0('0xf')]);router[_0x67f0('0x9')](_0x67f0('0x10'),auth[_0x67f0('0xa')](),controller[_0x67f0('0x11')]);router['get'](_0x67f0('0x12'),auth[_0x67f0('0xa')](),controller['getContacts']);router[_0x67f0('0x9')](_0x67f0('0x13'),auth[_0x67f0('0xa')](),controller[_0x67f0('0x14')]);router[_0x67f0('0x9')](_0x67f0('0x15'),auth[_0x67f0('0xa')](),controller[_0x67f0('0x16')]);router[_0x67f0('0x9')]('/:id/users',auth[_0x67f0('0xa')](),controller[_0x67f0('0x17')]);router[_0x67f0('0x18')]('/',auth[_0x67f0('0xa')](),controller[_0x67f0('0x19')]);router[_0x67f0('0x18')](_0x67f0('0x10'),auth[_0x67f0('0xa')](),controller['addDisposition']);router[_0x67f0('0x18')](_0x67f0('0x12'),auth[_0x67f0('0xa')](),controller[_0x67f0('0x1a')]);router[_0x67f0('0x18')]('/:id/fields',auth['isAuthenticated'](),controller['addCustomField']);router['post'](_0x67f0('0x1b'),auth['isAuthenticated'](),controller[_0x67f0('0x1c')]);router[_0x67f0('0x1d')](_0x67f0('0xe'),auth[_0x67f0('0xa')](),controller[_0x67f0('0x1e')]);router[_0x67f0('0x1f')](_0x67f0('0xe'),auth[_0x67f0('0xa')](),controller[_0x67f0('0x20')]);router[_0x67f0('0x1f')](_0x67f0('0x10'),auth['isAuthenticated'](),controller[_0x67f0('0x21')]);router['delete'](_0x67f0('0x1b'),auth[_0x67f0('0xa')](),controller[_0x67f0('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 3c8212e..582fcb8 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 _0x99ca=['getDataValue','field','STRING','sequelize'];(function(_0x755c4,_0x31702a){var _0x43e0da=function(_0x2cfa03){while(--_0x2cfa03){_0x755c4['push'](_0x755c4['shift']());}};_0x43e0da(++_0x31702a);}(_0x99ca,0xab));var _0xa99c=function(_0xed90b1,_0x5caba5){_0xed90b1=_0xed90b1-0x0;var _0x53acb2=_0x99ca[_0xed90b1];return _0x53acb2;};'use strict';var Sequelize=require(_0xa99c('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x56f5a6){return this[_0xa99c('0x1')](_0xa99c('0x2'));}},'field':{'type':Sequelize[_0xa99c('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xa99c('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xb301=['field','exports','getDataValue'];(function(_0x14f5a6,_0x4e841b){var _0x114f5b=function(_0x1c8f86){while(--_0x1c8f86){_0x14f5a6['push'](_0x14f5a6['shift']());}};_0x114f5b(++_0x4e841b);}(_0xb301,0x8e));var _0x1b30=function(_0x37d8ef,_0x53fdea){_0x37d8ef=_0x37d8ef-0x0;var _0x520900=_0xb301[_0x37d8ef];return _0x520900;};'use strict';var Sequelize=require('sequelize');module[_0x1b30('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x34519e){return this[_0x1b30('0x1')](_0x1b30('0x2'));}},'field':{'type':Sequelize['STRING'],'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 d3aebe0..25c9cd3 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(_0x5514a3,_0x4d2bf2){var _0x508000=function(_0x105fe0){while(--_0x105fe0){_0x5514a3['push'](_0x5514a3['shift']());}};_0x508000(++_0x4d2bf2);}(_0x7a54,0x106));var _0x47a5=function(_0x2ac06c,_0x440271){_0x2ac06c=_0x2ac06c-0x0;var _0x3e439c=_0x7a54[_0x2ac06c];return _0x3e439c;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x2df32c,_0x36ad00){var _0x3c416b=function(_0x132a3b){while(--_0x132a3b){_0x2df32c['push'](_0x2df32c['shift']());}};_0x3c416b(++_0x36ad00);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 64cd161..d46d343 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 _0x42a6=['bluebird','request-promise','path','../../config/environment','define','Condition','util','../../config/logger','moment'];(function(_0x351a73,_0x575488){var _0x312a85=function(_0x4f1e85){while(--_0x4f1e85){_0x351a73['push'](_0x351a73['shift']());}};_0x312a85(++_0x575488);}(_0x42a6,0x14a));var _0x642a=function(_0x2a453b,_0x479c50){_0x2a453b=_0x2a453b-0x0;var _0x132f79=_0x42a6[_0x2a453b];return _0x132f79;};'use strict';var _=require('lodash');var util=require(_0x642a('0x0'));var logger=require(_0x642a('0x1'))('api');var moment=require(_0x642a('0x2'));var BPromise=require(_0x642a('0x3'));var rp=require(_0x642a('0x4'));var fs=require('fs');var path=require(_0x642a('0x5'));var rimraf=require('rimraf');var config=require(_0x642a('0x6'));var attributes=require('./condition.attributes');module['exports']=function(_0x1b5b31,_0x4b615e){return _0x1b5b31[_0x642a('0x7')](_0x642a('0x8'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f05=['path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','lodash','util','api','moment','request-promise'];(function(_0x1b3463,_0x43e1f5){var _0x29d544=function(_0x73f158){while(--_0x73f158){_0x1b3463['push'](_0x1b3463['shift']());}};_0x29d544(++_0x43e1f5);}(_0x5f05,0x157));var _0x55f0=function(_0xf8d2d2,_0x36eb1c){_0xf8d2d2=_0xf8d2d2-0x0;var _0x250eff=_0x5f05[_0xf8d2d2];return _0x250eff;};'use strict';var _=require(_0x55f0('0x0'));var util=require(_0x55f0('0x1'));var logger=require('../../config/logger')(_0x55f0('0x2'));var moment=require(_0x55f0('0x3'));var BPromise=require('bluebird');var rp=require(_0x55f0('0x4'));var fs=require('fs');var path=require(_0x55f0('0x5'));var rimraf=require(_0x55f0('0x6'));var config=require(_0x55f0('0x7'));var attributes=require(_0x55f0('0x8'));module[_0x55f0('0x9')]=function(_0x6ef054,_0x54a0d5){return _0x6ef054[_0x55f0('0xa')](_0x55f0('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index bc39e85..edeae4e 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 _0xdf8e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x4a4135,_0x4974f8){var _0x3c1d57=function(_0x4e4041){while(--_0x4e4041){_0x4a4135['push'](_0x4a4135['shift']());}};_0x3c1d57(++_0x4974f8);}(_0xdf8e,0x1be));var _0xedf8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdf8e[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xedf8('0x0'));var util=require(_0xedf8('0x1'));var moment=require(_0xedf8('0x2'));var BPromise=require('bluebird');var rs=require(_0xedf8('0x3'));var fs=require('fs');var Redis=require(_0xedf8('0x4'));var db=require(_0xedf8('0x5'))['db'];var utils=require(_0xedf8('0x6'));var logger=require(_0xedf8('0x7'))(_0xedf8('0x8'));var config=require(_0xedf8('0x9'));var jayson=require(_0xedf8('0xa'));var client=jayson[_0xedf8('0xb')][_0xedf8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4726f7,_0x449011,_0x3adeec){return new BPromise(function(_0xa93b98,_0x20a003){return client[_0xedf8('0xd')](_0x4726f7,_0x3adeec)[_0xedf8('0xe')](function(_0xb31eb0){logger[_0xedf8('0xf')](_0xedf8('0x10'),_0x449011,_0xedf8('0x11'));logger[_0xedf8('0x12')]('Condition,\x20%s,\x20%s,\x20%s',_0x449011,'request\x20sent',JSON[_0xedf8('0x13')](_0xb31eb0));if(_0xb31eb0['error']){if(_0xb31eb0[_0xedf8('0x14')][_0xedf8('0x15')]===0x1f4){logger['error'](_0xedf8('0x10'),_0x449011,_0xb31eb0[_0xedf8('0x14')][_0xedf8('0x16')]);return _0x20a003(_0xb31eb0['error'][_0xedf8('0x16')]);}logger[_0xedf8('0x14')](_0xedf8('0x10'),_0x449011,_0xb31eb0[_0xedf8('0x14')][_0xedf8('0x16')]);return _0xa93b98(_0xb31eb0['error'][_0xedf8('0x16')]);}else{logger[_0xedf8('0xf')]('Condition,\x20%s,\x20%s',_0x449011,_0xedf8('0x11'));_0xa93b98(_0xb31eb0[_0xedf8('0x17')][_0xedf8('0x16')]);}})[_0xedf8('0x18')](function(_0x15ca84){logger[_0xedf8('0x14')](_0xedf8('0x10'),_0x449011,_0x15ca84);_0x20a003(_0x15ca84);});});} \ No newline at end of file +var _0xf182=['rpc','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3f0756,_0x5e1905){var _0x11bdb2=function(_0x19f865){while(--_0x19f865){_0x3f0756['push'](_0x3f0756['shift']());}};_0x11bdb2(++_0x5e1905);}(_0xf182,0x134));var _0x2f18=function(_0x2075c6,_0x323535){_0x2075c6=_0x2075c6-0x0;var _0x337e43=_0xf182[_0x2075c6];return _0x337e43;};'use strict';var _=require(_0x2f18('0x0'));var util=require(_0x2f18('0x1'));var moment=require('moment');var BPromise=require(_0x2f18('0x2'));var rs=require(_0x2f18('0x3'));var fs=require('fs');var Redis=require(_0x2f18('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f18('0x5'));var logger=require(_0x2f18('0x6'))(_0x2f18('0x7'));var config=require(_0x2f18('0x8'));var jayson=require(_0x2f18('0x9'));var client=jayson[_0x2f18('0xa')][_0x2f18('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x170923,_0x293dd4,_0x57e0c5){return new BPromise(function(_0x43405d,_0x105b08){return client['request'](_0x170923,_0x57e0c5)[_0x2f18('0xc')](function(_0x378aca){logger[_0x2f18('0xd')](_0x2f18('0xe'),_0x293dd4,'request\x20sent');logger['debug'](_0x2f18('0xf'),_0x293dd4,_0x2f18('0x10'),JSON[_0x2f18('0x11')](_0x378aca));if(_0x378aca[_0x2f18('0x12')]){if(_0x378aca['error'][_0x2f18('0x13')]===0x1f4){logger[_0x2f18('0x12')](_0x2f18('0xe'),_0x293dd4,_0x378aca[_0x2f18('0x12')][_0x2f18('0x14')]);return _0x105b08(_0x378aca[_0x2f18('0x12')]['message']);}logger[_0x2f18('0x12')](_0x2f18('0xe'),_0x293dd4,_0x378aca[_0x2f18('0x12')][_0x2f18('0x14')]);return _0x43405d(_0x378aca['error'][_0x2f18('0x14')]);}else{logger[_0x2f18('0xd')](_0x2f18('0xe'),_0x293dd4,_0x2f18('0x10'));_0x43405d(_0x378aca['result'][_0x2f18('0x14')]);}})['catch'](function(_0x4a42fc){logger['error']('Condition,\x20%s,\x20%s',_0x293dd4,_0x4a42fc);_0x105b08(_0x4a42fc);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 84e95c0..90484ca 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 _0x7543=['../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x216ef8,_0x235d33){var _0x4f3921=function(_0x49ade7){while(--_0x49ade7){_0x216ef8['push'](_0x216ef8['shift']());}};_0x4f3921(++_0x235d33);}(_0x7543,0x147));var _0x3754=function(_0x1a5e1b,_0x1faa33){_0x1a5e1b=_0x1a5e1b-0x0;var _0x31ae77=_0x7543[_0x1a5e1b];return _0x31ae77;};'use strict';var multer=require(_0x3754('0x0'));var util=require(_0x3754('0x1'));var path=require(_0x3754('0x2'));var timeout=require(_0x3754('0x3'));var express=require(_0x3754('0x4'));var router=express[_0x3754('0x5')]();var fs_extra=require(_0x3754('0x6'));var auth=require(_0x3754('0x7'));var interaction=require(_0x3754('0x8'));var config=require(_0x3754('0x9'));var controller=require(_0x3754('0xa'));router[_0x3754('0xb')](_0x3754('0xc'),auth[_0x3754('0xd')](),controller[_0x3754('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3754('0xf')]);module['exports']=router; \ No newline at end of file +var _0x683a=['../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x549eee,_0x362edf){var _0x380255=function(_0x394466){while(--_0x394466){_0x549eee['push'](_0x549eee['shift']());}};_0x380255(++_0x362edf);}(_0x683a,0x1ca));var _0xa683=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x683a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa683('0x0'));var util=require('util');var path=require(_0xa683('0x1'));var timeout=require('connect-timeout');var express=require(_0xa683('0x2'));var router=express[_0xa683('0x3')]();var fs_extra=require(_0xa683('0x4'));var auth=require(_0xa683('0x5'));var interaction=require(_0xa683('0x6'));var config=require(_0xa683('0x7'));var controller=require(_0xa683('0x8'));router[_0xa683('0x9')](_0xa683('0xa'),auth[_0xa683('0xb')](),controller[_0xa683('0xc')]);router[_0xa683('0xd')](_0xa683('0xa'),auth[_0xa683('0xb')](),controller[_0xa683('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 62d06ee..e677ca4 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 _0xb7e7=['STRING','sequelize'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0xb7e7,0x121));var _0x7b7e=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xb7e7[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x4f6d07,_0x4641e3){var _0x17245d=function(_0xd06f89){while(--_0xd06f89){_0x4f6d07['push'](_0x4f6d07['shift']());}};_0x17245d(++_0x4641e3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 65eaf82..c0f218e 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 _0x7ca0=['localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','CustomDashboards','error','stack','name','send','index','Dashboard','fieldName','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','omit','createdAt','updatedAt','UserProfileResource','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','getItems','findOne','pick','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis'];(function(_0x489a68,_0xfd3005){var _0x64875a=function(_0x2deec8){while(--_0x2deec8){_0x489a68['push'](_0x489a68['shift']());}};_0x64875a(++_0xfd3005);}(_0x7ca0,0xe1));var _0x07ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ca0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07ca('0x0'));var zipdir=require(_0x07ca('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x07ca('0x2'));var moment=require(_0x07ca('0x3'));var BPromise=require(_0x07ca('0x4'));var Mustache=require(_0x07ca('0x5'));var util=require(_0x07ca('0x6'));var path=require(_0x07ca('0x7'));var sox=require(_0x07ca('0x8'));var csv=require(_0x07ca('0x9'));var ejs=require(_0x07ca('0xa'));var fs=require('fs');var fs_extra=require(_0x07ca('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x07ca('0xc'));var toCsv=require(_0x07ca('0x9'));var querystring=require(_0x07ca('0xd'));var Papa=require('papaparse');var Redis=require(_0x07ca('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x07ca('0xf'));var as=require(_0x07ca('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x07ca('0x11'));var utils=require(_0x07ca('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x07ca('0x13'));var db=require(_0x07ca('0x14'))['db'];config['redis']=_[_0x07ca('0x15')](config[_0x07ca('0x16')],{'host':_0x07ca('0x17'),'port':0x18eb});var socket=require(_0x07ca('0x18'))(new Redis(config[_0x07ca('0x16')]));require(_0x07ca('0x19'))['register'](socket);function respondWithStatusCode(_0x1fef98,_0x4b15ef){_0x4b15ef=_0x4b15ef||0xcc;return function(_0x1c672d){if(_0x1c672d){return _0x1fef98[_0x07ca('0x1a')](_0x4b15ef);}return _0x1fef98[_0x07ca('0x1b')](_0x4b15ef)[_0x07ca('0x1c')]();};}function respondWithResult(_0x5d3540,_0x4d7039){_0x4d7039=_0x4d7039||0xc8;return function(_0x2a2653){if(_0x2a2653){return _0x5d3540[_0x07ca('0x1b')](_0x4d7039)['json'](_0x2a2653);}};}function respondWithFilteredResult(_0x1b241f,_0x597342){return function(_0x13eecb){if(_0x13eecb){var _0x44e42f=typeof _0x597342[_0x07ca('0x1d')]===_0x07ca('0x1e')&&typeof _0x597342[_0x07ca('0x1f')]==='undefined';var _0x1e827a=_0x13eecb[_0x07ca('0x20')];var _0x2cb2ea=_0x44e42f?0x0:_0x597342['offset'];var _0x1eb10e=_0x44e42f?_0x13eecb['count']:_0x597342['offset']+_0x597342['limit'];var _0x36886d;if(_0x1eb10e>=_0x1e827a){_0x1eb10e=_0x1e827a;_0x36886d=0xc8;}else{_0x36886d=0xce;}_0x1b241f[_0x07ca('0x1b')](_0x36886d);return _0x1b241f[_0x07ca('0x21')](_0x07ca('0x22'),_0x2cb2ea+'-'+_0x1eb10e+'/'+_0x1e827a)[_0x07ca('0x23')](_0x13eecb);}return null;};}function patchUpdates(_0x247737){return function(_0x4595b1){try{jsonpatch[_0x07ca('0x24')](_0x4595b1,_0x247737,!![]);}catch(_0x4a26aa){return BPromise['reject'](_0x4a26aa);}return _0x4595b1[_0x07ca('0x25')]();};}function saveUpdates(_0x4e38be,_0x29eb5e){return function(_0x15c1ae){if(_0x15c1ae){return _0x15c1ae[_0x07ca('0x26')](_0x4e38be)[_0x07ca('0x27')](function(_0x4de754){return _0x4de754;});}return null;};}function removeEntity(_0x36fe85,_0x17970f){return function(_0x4ad2f6){if(_0x4ad2f6){return _0x4ad2f6[_0x07ca('0x28')]()[_0x07ca('0x27')](function(){var _0x5f1d1d=_0x4ad2f6[_0x07ca('0x29')]({'plain':!![]});var _0x24ae92=_0x07ca('0x2a');return db['UserProfileResource'][_0x07ca('0x28')]({'where':{'type':_0x24ae92,'resourceId':_0x5f1d1d['id']}})[_0x07ca('0x27')](function(){return _0x4ad2f6;});})[_0x07ca('0x27')](function(){_0x36fe85[_0x07ca('0x1b')](0xcc)[_0x07ca('0x1c')]();});}};}function handleEntityNotFound(_0x40b316,_0x32c8a3){return function(_0xa0e9df){if(!_0xa0e9df){_0x40b316[_0x07ca('0x1a')](0x194);}return _0xa0e9df;};}function handleError(_0x350576,_0x384b28){_0x384b28=_0x384b28||0x1f4;return function(_0x48056e){logger[_0x07ca('0x2b')](_0x48056e[_0x07ca('0x2c')]);if(_0x48056e[_0x07ca('0x2d')]){delete _0x48056e[_0x07ca('0x2d')];}_0x350576[_0x07ca('0x1b')](_0x384b28)[_0x07ca('0x2e')](_0x48056e);};}exports[_0x07ca('0x2f')]=function(_0x13a1f1,_0x1be6b3){var _0x353f44={},_0x3e6749={},_0x44ab25={'count':0x0,'rows':[]};var _0xebeee=_['map'](db[_0x07ca('0x30')]['rawAttributes'],function(_0x32b785){return{'name':_0x32b785[_0x07ca('0x31')],'type':_0x32b785['type'][_0x07ca('0x32')]};});_0x3e6749[_0x07ca('0x33')]=_[_0x07ca('0x34')](_0xebeee,_0x07ca('0x2d'));_0x3e6749['query']=_[_0x07ca('0x35')](_0x13a1f1['query']);_0x3e6749[_0x07ca('0x36')]=_[_0x07ca('0x37')](_0x3e6749['model'],_0x3e6749[_0x07ca('0x38')]);_0x353f44[_0x07ca('0x39')]=_['intersection'](_0x3e6749['model'],qs[_0x07ca('0x3a')](_0x13a1f1[_0x07ca('0x38')]['fields']));_0x353f44[_0x07ca('0x39')]=_0x353f44[_0x07ca('0x39')][_0x07ca('0x3b')]?_0x353f44[_0x07ca('0x39')]:_0x3e6749[_0x07ca('0x33')];if(!_0x13a1f1[_0x07ca('0x38')][_0x07ca('0x3c')]('nolimit')){_0x353f44[_0x07ca('0x1f')]=qs['limit'](_0x13a1f1[_0x07ca('0x38')][_0x07ca('0x1f')]);_0x353f44['offset']=qs[_0x07ca('0x1d')](_0x13a1f1[_0x07ca('0x38')][_0x07ca('0x1d')]);}_0x353f44[_0x07ca('0x3d')]=qs[_0x07ca('0x3e')](_0x13a1f1[_0x07ca('0x38')][_0x07ca('0x3e')]);_0x353f44[_0x07ca('0x3f')]=qs[_0x07ca('0x36')](_['pick'](_0x13a1f1['query'],_0x3e6749[_0x07ca('0x36')]),_0xebeee);if(_0x13a1f1[_0x07ca('0x38')][_0x07ca('0x40')]){_0x353f44[_0x07ca('0x3f')]=_['merge'](_0x353f44['where'],{'$or':_[_0x07ca('0x34')](_0xebeee,function(_0x3fb528){if(_0x3fb528[_0x07ca('0x41')]!=='VIRTUAL'){var _0x4dfcf5={};_0x4dfcf5[_0x3fb528[_0x07ca('0x2d')]]={'$like':'%'+_0x13a1f1[_0x07ca('0x38')][_0x07ca('0x40')]+'%'};return _0x4dfcf5;}})});}_0x353f44=_['merge']({},_0x353f44,_0x13a1f1['options']);var _0x34c530={'where':_0x353f44[_0x07ca('0x3f')]};return db[_0x07ca('0x30')][_0x07ca('0x20')](_0x34c530)[_0x07ca('0x27')](function(_0x2384d1){_0x44ab25[_0x07ca('0x20')]=_0x2384d1;if(_0x13a1f1[_0x07ca('0x38')][_0x07ca('0x42')]){_0x353f44[_0x07ca('0x43')]=[{'all':!![]}];}return db[_0x07ca('0x30')][_0x07ca('0x44')](_0x353f44);})[_0x07ca('0x27')](function(_0x24d511){_0x44ab25[_0x07ca('0x45')]=_0x24d511;return _0x44ab25;})[_0x07ca('0x27')](respondWithFilteredResult(_0x1be6b3,_0x353f44))[_0x07ca('0x46')](handleError(_0x1be6b3,null));};exports['show']=function(_0x3e4bda,_0xeb758c){var _0x141f08={'raw':![],'where':{'id':_0x3e4bda[_0x07ca('0x47')]['id']}},_0x1a17b1={};_0x1a17b1['model']=_[_0x07ca('0x35')](db[_0x07ca('0x30')][_0x07ca('0x48')]);_0x1a17b1[_0x07ca('0x38')]=_[_0x07ca('0x35')](_0x3e4bda[_0x07ca('0x38')]);_0x1a17b1[_0x07ca('0x36')]=_[_0x07ca('0x37')](_0x1a17b1[_0x07ca('0x33')],_0x1a17b1[_0x07ca('0x38')]);_0x141f08[_0x07ca('0x39')]=_[_0x07ca('0x37')](_0x1a17b1['model'],qs['fields'](_0x3e4bda[_0x07ca('0x38')][_0x07ca('0x3a')]));_0x141f08[_0x07ca('0x39')]=_0x141f08[_0x07ca('0x39')][_0x07ca('0x3b')]?_0x141f08['attributes']:_0x1a17b1['model'];if(_0x3e4bda[_0x07ca('0x38')][_0x07ca('0x42')]){_0x141f08[_0x07ca('0x43')]=[{'all':!![]}];}_0x141f08=_['merge']({},_0x141f08,_0x3e4bda[_0x07ca('0x49')]);return db[_0x07ca('0x30')][_0x07ca('0x4a')](_0x141f08)[_0x07ca('0x27')](handleEntityNotFound(_0xeb758c,null))[_0x07ca('0x27')](respondWithResult(_0xeb758c,null))[_0x07ca('0x46')](handleError(_0xeb758c,null));};exports['create']=function(_0x59bfc8,_0x49f281){return db[_0x07ca('0x30')][_0x07ca('0x4b')](_0x59bfc8[_0x07ca('0x4c')],{})[_0x07ca('0x27')](function(_0x3fc45c){var _0x162687=_0x59bfc8[_0x07ca('0x4d')]['get']({'plain':!![]});if(!_0x162687)throw new Error(_0x07ca('0x4e'));if(_0x162687[_0x07ca('0x4f')]===_0x07ca('0x4d')){var _0x5326d8=_0x3fc45c[_0x07ca('0x29')]({'plain':!![]});var _0x492649=_0x07ca('0x2a');return db[_0x07ca('0x50')][_0x07ca('0x4a')]({'where':{'name':_0x492649,'userProfileId':_0x162687[_0x07ca('0x51')]},'raw':!![]})['then'](function(_0x4e0b7a){if(_0x4e0b7a&&_0x4e0b7a[_0x07ca('0x52')]===0x0){return db['UserProfileResource'][_0x07ca('0x4b')]({'name':_0x5326d8['name'],'resourceId':_0x5326d8['id'],'type':_0x4e0b7a[_0x07ca('0x2d')],'sectionId':_0x4e0b7a['id']},{})[_0x07ca('0x27')](function(){return _0x3fc45c;});}else{return _0x3fc45c;}})[_0x07ca('0x46')](function(_0xb3d600){logger[_0x07ca('0x2b')](_0x07ca('0x53'),_0xb3d600);throw _0xb3d600;});}return _0x3fc45c;})[_0x07ca('0x27')](respondWithResult(_0x49f281,0xc9))[_0x07ca('0x46')](handleError(_0x49f281,null));};exports[_0x07ca('0x54')]=function(_0x48fce4,_0x5d3472){var _0x68609b={'where':{'id':_0x48fce4['params']['id']}},_0x3dbab4={};_0x3dbab4['model']=_['keys'](db[_0x07ca('0x30')][_0x07ca('0x48')]);_0x68609b['attributes']=_[_0x07ca('0x37')](_0x3dbab4[_0x07ca('0x33')],qs[_0x07ca('0x3a')](_0x48fce4[_0x07ca('0x38')]['fields']));_0x68609b[_0x07ca('0x39')]=_0x68609b[_0x07ca('0x39')][_0x07ca('0x3b')]?_0x68609b[_0x07ca('0x39')]:_0x3dbab4[_0x07ca('0x33')];if(_0x48fce4[_0x07ca('0x38')][_0x07ca('0x42')]){_0x68609b['include']=[{'all':!![]}];}_0x68609b=_[_0x07ca('0x55')]({},_0x68609b,_0x48fce4[_0x07ca('0x49')]);return db[_0x07ca('0x30')][_0x07ca('0x4a')](_0x68609b)[_0x07ca('0x27')](handleEntityNotFound(_0x5d3472,null))['then'](function(_0x2c97a4){if(_0x2c97a4){var _0x15f1b3=_0x2c97a4[_0x07ca('0x29')]({'plain':!![]});_0x15f1b3=qs[_0x07ca('0x56')](_0x15f1b3,['id',_0x07ca('0x57'),_0x07ca('0x58')]);_0x48fce4[_0x07ca('0x4c')]=_[_0x07ca('0x56')](_0x48fce4['body'],['id',_0x07ca('0x57'),'updatedAt']);return db[_0x07ca('0x30')][_0x07ca('0x4b')](_[_0x07ca('0x55')](_0x15f1b3,_0x48fce4[_0x07ca('0x4c')]),{'include':_0x48fce4[_0x07ca('0x38')][_0x07ca('0x42')]?[{'all':!![]}]:undefined})[_0x07ca('0x27')](function(_0x182af9){var _0x100e74=_0x48fce4['user'][_0x07ca('0x29')]({'plain':!![]});if(!_0x100e74)throw new Error(_0x07ca('0x4e'));if(_0x100e74[_0x07ca('0x4f')]===_0x07ca('0x4d')){var _0xd77bd7=_0x182af9[_0x07ca('0x29')]({'plain':!![]});var _0x302ba1='CustomDashboards';return db[_0x07ca('0x50')][_0x07ca('0x4a')]({'where':{'name':_0x302ba1,'userProfileId':_0x100e74[_0x07ca('0x51')]},'raw':!![]})[_0x07ca('0x27')](function(_0x2df4cd){if(_0x2df4cd&&_0x2df4cd[_0x07ca('0x52')]===0x0){return db[_0x07ca('0x59')]['create']({'name':_0xd77bd7[_0x07ca('0x2d')],'resourceId':_0xd77bd7['id'],'type':_0x2df4cd[_0x07ca('0x2d')],'sectionId':_0x2df4cd['id']},{})[_0x07ca('0x27')](function(){return _0x182af9;});}else{return _0x182af9;}})[_0x07ca('0x46')](function(_0x2e472d){logger[_0x07ca('0x2b')](_0x07ca('0x53'),_0x2e472d);throw _0x2e472d;});}return _0x182af9;});}})[_0x07ca('0x27')](respondWithResult(_0x5d3472,0xc9))[_0x07ca('0x46')](handleError(_0x5d3472,null));};exports[_0x07ca('0x26')]=function(_0x3bbbb8,_0x3d97ee){if(_0x3bbbb8[_0x07ca('0x4c')]['id']){delete _0x3bbbb8[_0x07ca('0x4c')]['id'];}return db[_0x07ca('0x30')]['find']({'where':{'id':_0x3bbbb8[_0x07ca('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d97ee,null))[_0x07ca('0x27')](saveUpdates(_0x3bbbb8[_0x07ca('0x4c')],null))[_0x07ca('0x27')](respondWithResult(_0x3d97ee,null))[_0x07ca('0x46')](handleError(_0x3d97ee,null));};exports[_0x07ca('0x28')]=function(_0x265bb0,_0x3fd0b5){return db[_0x07ca('0x30')][_0x07ca('0x4a')]({'where':{'id':_0x265bb0[_0x07ca('0x47')]['id']}})[_0x07ca('0x27')](handleEntityNotFound(_0x3fd0b5,null))['then'](removeEntity(_0x3fd0b5,null))['catch'](handleError(_0x3fd0b5,null));};function widgetAttributes(_0x2b453d){try{switch(_0x2b453d[_0x07ca('0x41')]){case'iframe':return[{'name':_0x07ca('0x5a'),'value':_0x2b453d[_0x07ca('0x5a')]||(_0x2b453d['attrs']&&_0x2b453d['attrs'][0x0]?_0x2b453d[_0x07ca('0x5b')][0x0][_0x07ca('0x5c')]:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0x2b453d[_0x07ca('0x5d')]||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d[_0x07ca('0x5b')][0x0]?_0x2b453d[_0x07ca('0x5b')][0x0][_0x07ca('0x5c')]:undefined)||''}];case _0x07ca('0x5e'):return[{'name':'attrHourFormat','value':_0x2b453d[_0x07ca('0x5f')]||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d[_0x07ca('0x5b')][0x0]?_0x2b453d[_0x07ca('0x5b')][0x0][_0x07ca('0x5c')]:undefined)||_0x07ca('0x60')},{'name':_0x07ca('0x61'),'value':_0x2b453d['attrTimezone']||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d[_0x07ca('0x5b')][0x1]?_0x2b453d[_0x07ca('0x5b')][0x1][_0x07ca('0x5c')]:undefined)||'0.00'},{'name':_0x07ca('0x62'),'value':_0x2b453d[_0x07ca('0x62')]||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d[_0x07ca('0x5b')][0x2]?_0x2b453d[_0x07ca('0x5b')][0x2][_0x07ca('0x5c')]:undefined)||0xc}];case _0x07ca('0x63'):return[{'name':'attrMetric','value':_0x2b453d[_0x07ca('0x64')]||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d[_0x07ca('0x5b')][0x0]?_0x2b453d[_0x07ca('0x5b')][0x0][_0x07ca('0x5c')]:undefined)||'total'},{'name':_0x07ca('0x65'),'value':_0x2b453d[_0x07ca('0x65')]||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d[_0x07ca('0x5b')][0x1]?_0x2b453d['attrs'][0x1][_0x07ca('0x5c')]:undefined)||[]},{'name':_0x07ca('0x62'),'value':_0x2b453d[_0x07ca('0x62')]||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d['attrs'][0x2]?_0x2b453d[_0x07ca('0x5b')][0x2][_0x07ca('0x5c')]:undefined)||0x14},{'name':_0x07ca('0x66'),'value':_0x2b453d[_0x07ca('0x66')]||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d[_0x07ca('0x5b')][0x3]?_0x2b453d['attrs'][0x3]['value']:undefined)||_0x07ca('0x67')},{'name':_0x07ca('0x68'),'value':_0x2b453d[_0x07ca('0x68')]||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d[_0x07ca('0x5b')][0x4]?_0x2b453d[_0x07ca('0x5b')][0x4]['value']:undefined)||''},{'name':_0x07ca('0x69'),'value':_0x2b453d[_0x07ca('0x69')]||(_0x2b453d['attrs']&&_0x2b453d['attrs'][0x5]?_0x2b453d['attrs'][0x5][_0x07ca('0x5c')]:undefined)||''},{'name':_0x07ca('0x6a'),'value':_0x2b453d[_0x07ca('0x6a')]||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d['attrs'][0x6]?_0x2b453d['attrs'][0x6][_0x07ca('0x5c')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2b453d[_0x07ca('0x6b')]||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d[_0x07ca('0x5b')][0x7]?_0x2b453d[_0x07ca('0x5b')][0x7][_0x07ca('0x5c')]:undefined)||''},{'name':_0x07ca('0x6c'),'value':_0x2b453d[_0x07ca('0x6c')]||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d[_0x07ca('0x5b')][0x8]?_0x2b453d[_0x07ca('0x5b')][0x8][_0x07ca('0x5c')]:undefined)||''},{'name':_0x07ca('0x6d'),'value':_0x2b453d[_0x07ca('0x6d')]||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d[_0x07ca('0x5b')][0x9]?_0x2b453d[_0x07ca('0x5b')][0x9][_0x07ca('0x5c')]:undefined)||''}];case _0x07ca('0x6e'):case'pie-chart':return[{'name':_0x07ca('0x6f'),'value':_0x2b453d[_0x07ca('0x6f')]||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d['attrs'][0x0]?_0x2b453d[_0x07ca('0x5b')][0x0][_0x07ca('0x5c')]:undefined)||_0x07ca('0x70')},{'name':_0x07ca('0x71'),'value':_0x2b453d[_0x07ca('0x71')]||(_0x2b453d['attrs']&&_0x2b453d[_0x07ca('0x5b')][0x1]?_0x2b453d[_0x07ca('0x5b')][0x1][_0x07ca('0x5c')]:undefined)||null},{'name':_0x07ca('0x72'),'value':_0x2b453d[_0x07ca('0x72')]||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d[_0x07ca('0x5b')][0x2]?_0x2b453d[_0x07ca('0x5b')][0x2][_0x07ca('0x5c')]:undefined)||null},{'name':_0x07ca('0x65'),'value':_0x2b453d[_0x07ca('0x65')]||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d['attrs'][0x3]?_0x2b453d[_0x07ca('0x5b')][0x3]['value']:undefined)||[]},{'name':_0x07ca('0x66'),'value':_0x2b453d[_0x07ca('0x66')]||(_0x2b453d['attrs']&&_0x2b453d['attrs'][0x4]?_0x2b453d['attrs'][0x4][_0x07ca('0x5c')]:undefined)||_0x07ca('0x67')},{'name':_0x07ca('0x68'),'value':_0x2b453d[_0x07ca('0x68')]||(_0x2b453d['attrs']&&_0x2b453d[_0x07ca('0x5b')][0x5]?_0x2b453d[_0x07ca('0x5b')][0x5][_0x07ca('0x5c')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2b453d[_0x07ca('0x69')]||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d[_0x07ca('0x5b')][0x6]?_0x2b453d[_0x07ca('0x5b')][0x6][_0x07ca('0x5c')]:undefined)||''},{'name':_0x07ca('0x6a'),'value':_0x2b453d[_0x07ca('0x6a')]||(_0x2b453d['attrs']&&_0x2b453d[_0x07ca('0x5b')][0x7]?_0x2b453d[_0x07ca('0x5b')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2b453d[_0x07ca('0x6b')]||(_0x2b453d['attrs']&&_0x2b453d[_0x07ca('0x5b')][0x8]?_0x2b453d[_0x07ca('0x5b')][0x8][_0x07ca('0x5c')]:undefined)||''},{'name':_0x07ca('0x6c'),'value':_0x2b453d[_0x07ca('0x6c')]||(_0x2b453d['attrs']&&_0x2b453d[_0x07ca('0x5b')][0x9]?_0x2b453d['attrs'][0x9][_0x07ca('0x5c')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2b453d[_0x07ca('0x6d')]||(_0x2b453d['attrs']&&_0x2b453d['attrs'][0xa]?_0x2b453d[_0x07ca('0x5b')][0xa]['value']:undefined)||''}];case _0x07ca('0x73'):return[{'name':_0x07ca('0x74'),'type':_0x2b453d['reportType']||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d[_0x07ca('0x5b')][0x0]?_0x2b453d[_0x07ca('0x5b')][0x0][_0x07ca('0x41')]:undefined)||null,'value':_0x2b453d['attrReport']||(_0x2b453d[_0x07ca('0x5b')]&&_0x2b453d[_0x07ca('0x5b')][0x0]?_0x2b453d[_0x07ca('0x5b')][0x0]['value']:undefined)||null},{'name':_0x07ca('0x75'),'value':_0x2b453d[_0x07ca('0x75')]||(_0x2b453d['attrs']&&_0x2b453d[_0x07ca('0x5b')][0x1]?_0x2b453d['attrs'][0x1][_0x07ca('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x499262){logger[_0x07ca('0x2b')](_0x07ca('0x76'),JSON['stringify'](_0x499262));return[];}}exports['addItem']=function(_0x589c83,_0x279b80,_0x4c5d3f){if(_0x589c83[_0x07ca('0x4c')]['id']){delete _0x589c83[_0x07ca('0x4c')]['id'];}return db[_0x07ca('0x30')][_0x07ca('0x4a')]({'where':{'id':_0x589c83[_0x07ca('0x47')]['id']}})['then'](handleEntityNotFound(_0x279b80,null))[_0x07ca('0x27')](function(_0x5c8abe){if(_0x5c8abe){_0x589c83[_0x07ca('0x4c')][_0x07ca('0x77')]=_0x5c8abe['id'];_0x589c83[_0x07ca('0x4c')][_0x07ca('0x5b')]=widgetAttributes(_0x589c83[_0x07ca('0x4c')]);return db[_0x07ca('0x78')]['create'](_0x589c83['body']);}})['then'](respondWithResult(_0x279b80,null))['catch'](handleError(_0x279b80,null));};exports[_0x07ca('0x79')]=function(_0xeaaa2a,_0x562f55,_0x469e7c){var _0x3ac3ba={};var _0x57e5c5={};var _0x1afe93;var _0x3533fc;return db['Dashboard'][_0x07ca('0x7a')]({'where':{'id':_0xeaaa2a[_0x07ca('0x47')]['id']}})[_0x07ca('0x27')](handleEntityNotFound(_0x562f55,null))['then'](function(_0x4b8292){if(_0x4b8292){_0x1afe93=_0x4b8292;_0x57e5c5['model']=_[_0x07ca('0x35')](db[_0x07ca('0x78')][_0x07ca('0x48')]);_0x57e5c5[_0x07ca('0x38')]=_['keys'](_0xeaaa2a[_0x07ca('0x38')]);_0x57e5c5[_0x07ca('0x36')]=_['intersection'](_0x57e5c5[_0x07ca('0x33')],_0x57e5c5[_0x07ca('0x38')]);_0x3ac3ba[_0x07ca('0x39')]=_[_0x07ca('0x37')](_0x57e5c5[_0x07ca('0x33')],qs[_0x07ca('0x3a')](_0xeaaa2a[_0x07ca('0x38')][_0x07ca('0x3a')]));_0x3ac3ba[_0x07ca('0x39')]=_0x3ac3ba[_0x07ca('0x39')][_0x07ca('0x3b')]?_0x3ac3ba[_0x07ca('0x39')]:_0x57e5c5[_0x07ca('0x33')];_0x3ac3ba['order']=qs[_0x07ca('0x3e')](_0xeaaa2a[_0x07ca('0x38')][_0x07ca('0x3e')]);_0x3ac3ba['where']=qs['filters'](_[_0x07ca('0x7b')](_0xeaaa2a['query'],_0x57e5c5[_0x07ca('0x36')]));if(_0xeaaa2a[_0x07ca('0x38')][_0x07ca('0x40')]){_0x3ac3ba['where']=_['merge'](_0x3ac3ba['where'],{'$or':_[_0x07ca('0x34')](_0x3ac3ba[_0x07ca('0x39')],function(_0x3a16d5){var _0x4c9c2e={};_0x4c9c2e[_0x3a16d5]={'$like':'%'+_0xeaaa2a[_0x07ca('0x38')]['filter']+'%'};return _0x4c9c2e;})});}_0x3ac3ba=_['merge']({},_0x3ac3ba,_0xeaaa2a[_0x07ca('0x49')]);return _0x1afe93[_0x07ca('0x79')](_0x3ac3ba);}})[_0x07ca('0x27')](function(_0x585329){if(_0x585329){_0x3533fc=_0x585329[_0x07ca('0x3b')];if(!_0xeaaa2a['query'][_0x07ca('0x3c')]('nolimit')){_0x3ac3ba[_0x07ca('0x1f')]=qs[_0x07ca('0x1f')](_0xeaaa2a[_0x07ca('0x38')][_0x07ca('0x1f')]);_0x3ac3ba[_0x07ca('0x1d')]=qs[_0x07ca('0x1d')](_0xeaaa2a[_0x07ca('0x38')][_0x07ca('0x1d')]);}return _0x1afe93['getItems'](_0x3ac3ba);}})['then'](function(_0x3d5f55){if(_0x3d5f55){return _0x3d5f55?{'count':_0x3533fc,'rows':_0x3d5f55}:null;}})[_0x07ca('0x27')](respondWithResult(_0x562f55,null))[_0x07ca('0x46')](handleError(_0x562f55,null));}; \ No newline at end of file +var _0x26ce=['name','index','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','options','include','findAll','rows','catch','show','params','length','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','body','omit','UserProfileSection','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrOpenchannelAccounts','attrWhatsappAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','findOne','map','getItems','nolimit','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','limit','undefined','count','offset','set','json','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack'];(function(_0x3356c1,_0x466047){var _0x15a715=function(_0x2d48cd){while(--_0x2d48cd){_0x3356c1['push'](_0x3356c1['shift']());}};_0x15a715(++_0x466047);}(_0x26ce,0x1e3));var _0xe26c=function(_0x58b62a,_0x1205a6){_0x58b62a=_0x58b62a-0x0;var _0x5c86be=_0x26ce[_0x58b62a];return _0x5c86be;};'use strict';var emlformat=require(_0xe26c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe26c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe26c('0x2'));var moment=require('moment');var BPromise=require(_0xe26c('0x3'));var Mustache=require(_0xe26c('0x4'));var util=require(_0xe26c('0x5'));var path=require('path');var sox=require(_0xe26c('0x6'));var csv=require(_0xe26c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe26c('0x8'));var _=require(_0xe26c('0x9'));var squel=require(_0xe26c('0xa'));var crypto=require(_0xe26c('0xb'));var jsforce=require(_0xe26c('0xc'));var deskjs=require(_0xe26c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe26c('0xe'));var Papa=require(_0xe26c('0xf'));var Redis=require(_0xe26c('0x10'));var authService=require(_0xe26c('0x11'));var qs=require(_0xe26c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe26c('0x13'))(_0xe26c('0x14'));var utils=require(_0xe26c('0x15'));var config=require(_0xe26c('0x16'));var licenseUtil=require(_0xe26c('0x17'));var db=require('../../mysqldb')['db'];config[_0xe26c('0x18')]=_[_0xe26c('0x19')](config['redis'],{'host':_0xe26c('0x1a'),'port':0x18eb});var socket=require(_0xe26c('0x1b'))(new Redis(config[_0xe26c('0x18')]));require('./dashboard.socket')[_0xe26c('0x1c')](socket);function respondWithStatusCode(_0x599f50,_0xf482b7){_0xf482b7=_0xf482b7||0xcc;return function(_0x4b36d9){if(_0x4b36d9){return _0x599f50[_0xe26c('0x1d')](_0xf482b7);}return _0x599f50[_0xe26c('0x1e')](_0xf482b7)[_0xe26c('0x1f')]();};}function respondWithResult(_0x1c43a0,_0x5b6bff){_0x5b6bff=_0x5b6bff||0xc8;return function(_0x222557){if(_0x222557){return _0x1c43a0[_0xe26c('0x1e')](_0x5b6bff)['json'](_0x222557);}};}function respondWithFilteredResult(_0x599085,_0x52237a){return function(_0x219b53){if(_0x219b53){var _0x44b2ef=typeof _0x52237a['offset']==='undefined'&&typeof _0x52237a[_0xe26c('0x20')]===_0xe26c('0x21');var _0x1736a2=_0x219b53[_0xe26c('0x22')];var _0x4849e9=_0x44b2ef?0x0:_0x52237a[_0xe26c('0x23')];var _0x17239c=_0x44b2ef?_0x219b53['count']:_0x52237a[_0xe26c('0x23')]+_0x52237a['limit'];var _0x15f076;if(_0x17239c>=_0x1736a2){_0x17239c=_0x1736a2;_0x15f076=0xc8;}else{_0x15f076=0xce;}_0x599085[_0xe26c('0x1e')](_0x15f076);return _0x599085[_0xe26c('0x24')]('Content-Range',_0x4849e9+'-'+_0x17239c+'/'+_0x1736a2)[_0xe26c('0x25')](_0x219b53);}return null;};}function patchUpdates(_0xcd872){return function(_0x19b7cb){try{jsonpatch[_0xe26c('0x26')](_0x19b7cb,_0xcd872,!![]);}catch(_0x54b0f3){return BPromise[_0xe26c('0x27')](_0x54b0f3);}return _0x19b7cb[_0xe26c('0x28')]();};}function saveUpdates(_0x4321b1,_0x304119){return function(_0x4d3e46){if(_0x4d3e46){return _0x4d3e46[_0xe26c('0x29')](_0x4321b1)[_0xe26c('0x2a')](function(_0x9749da){return _0x9749da;});}return null;};}function removeEntity(_0x2cdfe1,_0x2091be){return function(_0x1e0a56){if(_0x1e0a56){return _0x1e0a56[_0xe26c('0x2b')]()[_0xe26c('0x2a')](function(){var _0x1dd019=_0x1e0a56[_0xe26c('0x2c')]({'plain':!![]});var _0x4ae01f=_0xe26c('0x2d');return db[_0xe26c('0x2e')]['destroy']({'where':{'type':_0x4ae01f,'resourceId':_0x1dd019['id']}})[_0xe26c('0x2a')](function(){return _0x1e0a56;});})['then'](function(){_0x2cdfe1[_0xe26c('0x1e')](0xcc)[_0xe26c('0x1f')]();});}};}function handleEntityNotFound(_0x1cbab8,_0x1a5607){return function(_0x59636b){if(!_0x59636b){_0x1cbab8['sendStatus'](0x194);}return _0x59636b;};}function handleError(_0x1e0573,_0x45defe){_0x45defe=_0x45defe||0x1f4;return function(_0x1101b6){logger[_0xe26c('0x2f')](_0x1101b6[_0xe26c('0x30')]);if(_0x1101b6['name']){delete _0x1101b6[_0xe26c('0x31')];}_0x1e0573[_0xe26c('0x1e')](_0x45defe)['send'](_0x1101b6);};}exports[_0xe26c('0x32')]=function(_0x348218,_0x1ee5fe){var _0x729b53={},_0x1a6c8a={},_0x25c1d8={'count':0x0,'rows':[]};var _0x25e900=_['map'](db[_0xe26c('0x33')][_0xe26c('0x34')],function(_0xcc4377){return{'name':_0xcc4377[_0xe26c('0x35')],'type':_0xcc4377[_0xe26c('0x36')][_0xe26c('0x37')]};});_0x1a6c8a['model']=_['map'](_0x25e900,_0xe26c('0x31'));_0x1a6c8a[_0xe26c('0x38')]=_[_0xe26c('0x39')](_0x348218[_0xe26c('0x38')]);_0x1a6c8a[_0xe26c('0x3a')]=_[_0xe26c('0x3b')](_0x1a6c8a[_0xe26c('0x3c')],_0x1a6c8a['query']);_0x729b53[_0xe26c('0x3d')]=_[_0xe26c('0x3b')](_0x1a6c8a[_0xe26c('0x3c')],qs[_0xe26c('0x3e')](_0x348218[_0xe26c('0x38')][_0xe26c('0x3e')]));_0x729b53[_0xe26c('0x3d')]=_0x729b53[_0xe26c('0x3d')]['length']?_0x729b53[_0xe26c('0x3d')]:_0x1a6c8a['model'];if(!_0x348218[_0xe26c('0x38')][_0xe26c('0x3f')]('nolimit')){_0x729b53[_0xe26c('0x20')]=qs[_0xe26c('0x20')](_0x348218[_0xe26c('0x38')][_0xe26c('0x20')]);_0x729b53['offset']=qs['offset'](_0x348218[_0xe26c('0x38')]['offset']);}_0x729b53[_0xe26c('0x40')]=qs[_0xe26c('0x41')](_0x348218[_0xe26c('0x38')][_0xe26c('0x41')]);_0x729b53['where']=qs[_0xe26c('0x3a')](_[_0xe26c('0x42')](_0x348218[_0xe26c('0x38')],_0x1a6c8a['filters']),_0x25e900);if(_0x348218[_0xe26c('0x38')][_0xe26c('0x43')]){_0x729b53['where']=_[_0xe26c('0x44')](_0x729b53[_0xe26c('0x45')],{'$or':_['map'](_0x25e900,function(_0x5ac3f5){if(_0x5ac3f5['type']!=='VIRTUAL'){var _0x3d6a27={};_0x3d6a27[_0x5ac3f5[_0xe26c('0x31')]]={'$like':'%'+_0x348218[_0xe26c('0x38')][_0xe26c('0x43')]+'%'};return _0x3d6a27;}})});}_0x729b53=_[_0xe26c('0x44')]({},_0x729b53,_0x348218[_0xe26c('0x46')]);var _0x2838a0={'where':_0x729b53[_0xe26c('0x45')]};return db['Dashboard']['count'](_0x2838a0)[_0xe26c('0x2a')](function(_0x55c569){_0x25c1d8[_0xe26c('0x22')]=_0x55c569;if(_0x348218['query']['includeAll']){_0x729b53[_0xe26c('0x47')]=[{'all':!![]}];}return db[_0xe26c('0x33')][_0xe26c('0x48')](_0x729b53);})[_0xe26c('0x2a')](function(_0x26c51d){_0x25c1d8[_0xe26c('0x49')]=_0x26c51d;return _0x25c1d8;})[_0xe26c('0x2a')](respondWithFilteredResult(_0x1ee5fe,_0x729b53))[_0xe26c('0x4a')](handleError(_0x1ee5fe,null));};exports[_0xe26c('0x4b')]=function(_0x4ea076,_0x59438a){var _0x264f67={'raw':![],'where':{'id':_0x4ea076[_0xe26c('0x4c')]['id']}},_0x9d7a23={};_0x9d7a23[_0xe26c('0x3c')]=_[_0xe26c('0x39')](db[_0xe26c('0x33')][_0xe26c('0x34')]);_0x9d7a23[_0xe26c('0x38')]=_[_0xe26c('0x39')](_0x4ea076[_0xe26c('0x38')]);_0x9d7a23[_0xe26c('0x3a')]=_[_0xe26c('0x3b')](_0x9d7a23[_0xe26c('0x3c')],_0x9d7a23[_0xe26c('0x38')]);_0x264f67['attributes']=_[_0xe26c('0x3b')](_0x9d7a23['model'],qs[_0xe26c('0x3e')](_0x4ea076[_0xe26c('0x38')][_0xe26c('0x3e')]));_0x264f67[_0xe26c('0x3d')]=_0x264f67[_0xe26c('0x3d')][_0xe26c('0x4d')]?_0x264f67[_0xe26c('0x3d')]:_0x9d7a23['model'];if(_0x4ea076['query'][_0xe26c('0x4e')]){_0x264f67[_0xe26c('0x47')]=[{'all':!![]}];}_0x264f67=_[_0xe26c('0x44')]({},_0x264f67,_0x4ea076[_0xe26c('0x46')]);return db[_0xe26c('0x33')]['find'](_0x264f67)[_0xe26c('0x2a')](handleEntityNotFound(_0x59438a,null))[_0xe26c('0x2a')](respondWithResult(_0x59438a,null))[_0xe26c('0x4a')](handleError(_0x59438a,null));};exports[_0xe26c('0x4f')]=function(_0x2fb545,_0x237efc){return db['Dashboard'][_0xe26c('0x4f')](_0x2fb545['body'],{})[_0xe26c('0x2a')](function(_0x4c714e){var _0x582570=_0x2fb545[_0xe26c('0x50')][_0xe26c('0x2c')]({'plain':!![]});if(!_0x582570)throw new Error(_0xe26c('0x51'));if(_0x582570[_0xe26c('0x52')]===_0xe26c('0x50')){var _0x4711e7=_0x4c714e[_0xe26c('0x2c')]({'plain':!![]});var _0x589ccf=_0xe26c('0x2d');return db['UserProfileSection'][_0xe26c('0x53')]({'where':{'name':_0x589ccf,'userProfileId':_0x582570[_0xe26c('0x54')]},'raw':!![]})['then'](function(_0xb5ad5b){if(_0xb5ad5b&&_0xb5ad5b[_0xe26c('0x55')]===0x0){return db[_0xe26c('0x2e')]['create']({'name':_0x4711e7[_0xe26c('0x31')],'resourceId':_0x4711e7['id'],'type':_0xb5ad5b[_0xe26c('0x31')],'sectionId':_0xb5ad5b['id']},{})[_0xe26c('0x2a')](function(){return _0x4c714e;});}else{return _0x4c714e;}})[_0xe26c('0x4a')](function(_0xbf5401){logger[_0xe26c('0x2f')](_0xe26c('0x56'),_0xbf5401);throw _0xbf5401;});}return _0x4c714e;})[_0xe26c('0x2a')](respondWithResult(_0x237efc,0xc9))[_0xe26c('0x4a')](handleError(_0x237efc,null));};exports[_0xe26c('0x57')]=function(_0x123094,_0x569d6c){var _0x3ecfdc={'where':{'id':_0x123094[_0xe26c('0x4c')]['id']}},_0x22ba64={};_0x22ba64[_0xe26c('0x3c')]=_[_0xe26c('0x39')](db['Dashboard'][_0xe26c('0x34')]);_0x3ecfdc[_0xe26c('0x3d')]=_[_0xe26c('0x3b')](_0x22ba64['model'],qs[_0xe26c('0x3e')](_0x123094[_0xe26c('0x38')]['fields']));_0x3ecfdc[_0xe26c('0x3d')]=_0x3ecfdc[_0xe26c('0x3d')][_0xe26c('0x4d')]?_0x3ecfdc[_0xe26c('0x3d')]:_0x22ba64['model'];if(_0x123094['query'][_0xe26c('0x4e')]){_0x3ecfdc['include']=[{'all':!![]}];}_0x3ecfdc=_['merge']({},_0x3ecfdc,_0x123094[_0xe26c('0x46')]);return db[_0xe26c('0x33')][_0xe26c('0x53')](_0x3ecfdc)[_0xe26c('0x2a')](handleEntityNotFound(_0x569d6c,null))[_0xe26c('0x2a')](function(_0x38eee4){if(_0x38eee4){var _0x1bc91a=_0x38eee4[_0xe26c('0x2c')]({'plain':!![]});_0x1bc91a=qs['omit'](_0x1bc91a,['id',_0xe26c('0x58'),_0xe26c('0x59')]);_0x123094[_0xe26c('0x5a')]=_[_0xe26c('0x5b')](_0x123094[_0xe26c('0x5a')],['id',_0xe26c('0x58'),_0xe26c('0x59')]);return db[_0xe26c('0x33')][_0xe26c('0x4f')](_[_0xe26c('0x44')](_0x1bc91a,_0x123094[_0xe26c('0x5a')]),{'include':_0x123094['query'][_0xe26c('0x4e')]?[{'all':!![]}]:undefined})[_0xe26c('0x2a')](function(_0x22e02d){var _0x32ec34=_0x123094[_0xe26c('0x50')][_0xe26c('0x2c')]({'plain':!![]});if(!_0x32ec34)throw new Error(_0xe26c('0x51'));if(_0x32ec34['role']==='user'){var _0x421d98=_0x22e02d['get']({'plain':!![]});var _0x96a7a5=_0xe26c('0x2d');return db[_0xe26c('0x5c')][_0xe26c('0x53')]({'where':{'name':_0x96a7a5,'userProfileId':_0x32ec34[_0xe26c('0x54')]},'raw':!![]})[_0xe26c('0x2a')](function(_0x3e1865){if(_0x3e1865&&_0x3e1865[_0xe26c('0x55')]===0x0){return db[_0xe26c('0x2e')]['create']({'name':_0x421d98[_0xe26c('0x31')],'resourceId':_0x421d98['id'],'type':_0x3e1865[_0xe26c('0x31')],'sectionId':_0x3e1865['id']},{})[_0xe26c('0x2a')](function(){return _0x22e02d;});}else{return _0x22e02d;}})['catch'](function(_0x348f58){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x348f58);throw _0x348f58;});}return _0x22e02d;});}})[_0xe26c('0x2a')](respondWithResult(_0x569d6c,0xc9))[_0xe26c('0x4a')](handleError(_0x569d6c,null));};exports[_0xe26c('0x29')]=function(_0xb1536d,_0x45a99e){if(_0xb1536d[_0xe26c('0x5a')]['id']){delete _0xb1536d['body']['id'];}return db[_0xe26c('0x33')][_0xe26c('0x53')]({'where':{'id':_0xb1536d[_0xe26c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x45a99e,null))[_0xe26c('0x2a')](saveUpdates(_0xb1536d[_0xe26c('0x5a')],null))[_0xe26c('0x2a')](respondWithResult(_0x45a99e,null))[_0xe26c('0x4a')](handleError(_0x45a99e,null));};exports[_0xe26c('0x2b')]=function(_0x508de3,_0x20890d){return db[_0xe26c('0x33')][_0xe26c('0x53')]({'where':{'id':_0x508de3['params']['id']}})['then'](handleEntityNotFound(_0x20890d,null))['then'](removeEntity(_0x20890d,null))[_0xe26c('0x4a')](handleError(_0x20890d,null));};function widgetAttributes(_0x32b63c){try{switch(_0x32b63c['type']){case _0xe26c('0x5d'):return[{'name':_0xe26c('0x5e'),'value':_0x32b63c[_0xe26c('0x5e')]||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c[_0xe26c('0x5f')][0x0]?_0x32b63c[_0xe26c('0x5f')][0x0][_0xe26c('0x60')]:undefined)||_0xe26c('0x61')}];case _0xe26c('0x62'):return[{'name':_0xe26c('0x63'),'value':_0x32b63c[_0xe26c('0x63')]||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c[_0xe26c('0x5f')][0x0]?_0x32b63c[_0xe26c('0x5f')][0x0]['value']:undefined)||''}];case _0xe26c('0x64'):return[{'name':_0xe26c('0x65'),'value':_0x32b63c[_0xe26c('0x65')]||(_0x32b63c['attrs']&&_0x32b63c['attrs'][0x0]?_0x32b63c[_0xe26c('0x5f')][0x0]['value']:undefined)||_0xe26c('0x66')},{'name':'attrTimezone','value':_0x32b63c[_0xe26c('0x67')]||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c[_0xe26c('0x5f')][0x1]?_0x32b63c[_0xe26c('0x5f')][0x1]['value']:undefined)||_0xe26c('0x68')},{'name':_0xe26c('0x69'),'value':_0x32b63c[_0xe26c('0x69')]||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c['attrs'][0x2]?_0x32b63c[_0xe26c('0x5f')][0x2][_0xe26c('0x60')]:undefined)||0xc}];case'counter':return[{'name':_0xe26c('0x6a'),'value':_0x32b63c[_0xe26c('0x6a')]||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c[_0xe26c('0x5f')][0x0]?_0x32b63c[_0xe26c('0x5f')][0x0][_0xe26c('0x60')]:undefined)||_0xe26c('0x6b')},{'name':_0xe26c('0x6c'),'value':_0x32b63c['attrVoiceQueues']||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c['attrs'][0x1]?_0x32b63c[_0xe26c('0x5f')][0x1][_0xe26c('0x60')]:undefined)||[]},{'name':_0xe26c('0x69'),'value':_0x32b63c['attrFontSize']||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c[_0xe26c('0x5f')][0x2]?_0x32b63c['attrs'][0x2]['value']:undefined)||0x14},{'name':_0xe26c('0x6d'),'value':_0x32b63c['attrChannel']||(_0x32b63c['attrs']&&_0x32b63c[_0xe26c('0x5f')][0x3]?_0x32b63c[_0xe26c('0x5f')][0x3]['value']:undefined)||'voice'},{'name':_0xe26c('0x6e'),'value':_0x32b63c[_0xe26c('0x6e')]||(_0x32b63c['attrs']&&_0x32b63c[_0xe26c('0x5f')][0x4]?_0x32b63c[_0xe26c('0x5f')][0x4][_0xe26c('0x60')]:undefined)||''},{'name':_0xe26c('0x6f'),'value':_0x32b63c[_0xe26c('0x6f')]||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c[_0xe26c('0x5f')][0x5]?_0x32b63c[_0xe26c('0x5f')][0x5][_0xe26c('0x60')]:undefined)||''},{'name':_0xe26c('0x70'),'value':_0x32b63c[_0xe26c('0x70')]||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c[_0xe26c('0x5f')][0x6]?_0x32b63c['attrs'][0x6][_0xe26c('0x60')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x32b63c['attrOpenchannelAccounts']||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c[_0xe26c('0x5f')][0x7]?_0x32b63c[_0xe26c('0x5f')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x32b63c['attrWhatsappAccounts']||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c[_0xe26c('0x5f')][0x8]?_0x32b63c[_0xe26c('0x5f')][0x8][_0xe26c('0x60')]:undefined)||''},{'name':_0xe26c('0x71'),'value':_0x32b63c['attrChatWebsites']||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c['attrs'][0x9]?_0x32b63c[_0xe26c('0x5f')][0x9][_0xe26c('0x60')]:undefined)||''}];case _0xe26c('0x72'):case _0xe26c('0x73'):return[{'name':'attrSerie1','value':_0x32b63c[_0xe26c('0x74')]||(_0x32b63c['attrs']&&_0x32b63c[_0xe26c('0x5f')][0x0]?_0x32b63c[_0xe26c('0x5f')][0x0]['value']:undefined)||_0xe26c('0x6b')},{'name':_0xe26c('0x75'),'value':_0x32b63c[_0xe26c('0x75')]||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c[_0xe26c('0x5f')][0x1]?_0x32b63c['attrs'][0x1][_0xe26c('0x60')]:undefined)||null},{'name':_0xe26c('0x76'),'value':_0x32b63c['attrSerie3']||(_0x32b63c['attrs']&&_0x32b63c[_0xe26c('0x5f')][0x2]?_0x32b63c['attrs'][0x2][_0xe26c('0x60')]:undefined)||null},{'name':_0xe26c('0x6c'),'value':_0x32b63c[_0xe26c('0x6c')]||(_0x32b63c['attrs']&&_0x32b63c['attrs'][0x3]?_0x32b63c['attrs'][0x3][_0xe26c('0x60')]:undefined)||[]},{'name':'attrChannel','value':_0x32b63c[_0xe26c('0x6d')]||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c[_0xe26c('0x5f')][0x4]?_0x32b63c[_0xe26c('0x5f')][0x4]['value']:undefined)||_0xe26c('0x77')},{'name':_0xe26c('0x6e'),'value':_0x32b63c[_0xe26c('0x6e')]||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c['attrs'][0x5]?_0x32b63c['attrs'][0x5][_0xe26c('0x60')]:undefined)||''},{'name':_0xe26c('0x6f'),'value':_0x32b63c[_0xe26c('0x6f')]||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c[_0xe26c('0x5f')][0x6]?_0x32b63c[_0xe26c('0x5f')][0x6][_0xe26c('0x60')]:undefined)||''},{'name':_0xe26c('0x70'),'value':_0x32b63c[_0xe26c('0x70')]||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c['attrs'][0x7]?_0x32b63c[_0xe26c('0x5f')][0x7][_0xe26c('0x60')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x32b63c[_0xe26c('0x78')]||(_0x32b63c['attrs']&&_0x32b63c[_0xe26c('0x5f')][0x8]?_0x32b63c[_0xe26c('0x5f')][0x8][_0xe26c('0x60')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x32b63c[_0xe26c('0x79')]||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c['attrs'][0x9]?_0x32b63c['attrs'][0x9][_0xe26c('0x60')]:undefined)||''},{'name':_0xe26c('0x71'),'value':_0x32b63c[_0xe26c('0x71')]||(_0x32b63c['attrs']&&_0x32b63c['attrs'][0xa]?_0x32b63c['attrs'][0xa]['value']:undefined)||''}];case _0xe26c('0x7a'):return[{'name':_0xe26c('0x7b'),'type':_0x32b63c['reportType']||(_0x32b63c['attrs']&&_0x32b63c[_0xe26c('0x5f')][0x0]?_0x32b63c[_0xe26c('0x5f')][0x0][_0xe26c('0x36')]:undefined)||null,'value':_0x32b63c['attrReport']||(_0x32b63c[_0xe26c('0x5f')]&&_0x32b63c[_0xe26c('0x5f')][0x0]?_0x32b63c['attrs'][0x0]['value']:undefined)||null},{'name':_0xe26c('0x7c'),'value':_0x32b63c[_0xe26c('0x7c')]||(_0x32b63c['attrs']&&_0x32b63c[_0xe26c('0x5f')][0x1]?_0x32b63c['attrs'][0x1][_0xe26c('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x149ac1){logger['error'](_0xe26c('0x7d'),JSON[_0xe26c('0x7e')](_0x149ac1));return[];}}exports[_0xe26c('0x7f')]=function(_0x3832cc,_0x19cadd,_0x5f60d7){if(_0x3832cc['body']['id']){delete _0x3832cc['body']['id'];}return db[_0xe26c('0x33')]['find']({'where':{'id':_0x3832cc[_0xe26c('0x4c')]['id']}})[_0xe26c('0x2a')](handleEntityNotFound(_0x19cadd,null))['then'](function(_0xb5b2f1){if(_0xb5b2f1){_0x3832cc[_0xe26c('0x5a')][_0xe26c('0x80')]=_0xb5b2f1['id'];_0x3832cc[_0xe26c('0x5a')][_0xe26c('0x5f')]=widgetAttributes(_0x3832cc['body']);return db['DashboardItem'][_0xe26c('0x4f')](_0x3832cc[_0xe26c('0x5a')]);}})[_0xe26c('0x2a')](respondWithResult(_0x19cadd,null))[_0xe26c('0x4a')](handleError(_0x19cadd,null));};exports['getItems']=function(_0x3bc5c8,_0x1ca900,_0x3601d9){var _0x4c1cab={};var _0x11877a={};var _0x1b6326;var _0x47b83d;return db['Dashboard'][_0xe26c('0x81')]({'where':{'id':_0x3bc5c8[_0xe26c('0x4c')]['id']}})[_0xe26c('0x2a')](handleEntityNotFound(_0x1ca900,null))['then'](function(_0x235885){if(_0x235885){_0x1b6326=_0x235885;_0x11877a[_0xe26c('0x3c')]=_[_0xe26c('0x39')](db['DashboardItem'][_0xe26c('0x34')]);_0x11877a['query']=_[_0xe26c('0x39')](_0x3bc5c8[_0xe26c('0x38')]);_0x11877a['filters']=_[_0xe26c('0x3b')](_0x11877a[_0xe26c('0x3c')],_0x11877a[_0xe26c('0x38')]);_0x4c1cab[_0xe26c('0x3d')]=_[_0xe26c('0x3b')](_0x11877a['model'],qs[_0xe26c('0x3e')](_0x3bc5c8['query'][_0xe26c('0x3e')]));_0x4c1cab[_0xe26c('0x3d')]=_0x4c1cab[_0xe26c('0x3d')][_0xe26c('0x4d')]?_0x4c1cab[_0xe26c('0x3d')]:_0x11877a[_0xe26c('0x3c')];_0x4c1cab[_0xe26c('0x40')]=qs[_0xe26c('0x41')](_0x3bc5c8[_0xe26c('0x38')][_0xe26c('0x41')]);_0x4c1cab[_0xe26c('0x45')]=qs['filters'](_[_0xe26c('0x42')](_0x3bc5c8[_0xe26c('0x38')],_0x11877a[_0xe26c('0x3a')]));if(_0x3bc5c8[_0xe26c('0x38')][_0xe26c('0x43')]){_0x4c1cab['where']=_[_0xe26c('0x44')](_0x4c1cab['where'],{'$or':_[_0xe26c('0x82')](_0x4c1cab[_0xe26c('0x3d')],function(_0x3c909f){var _0x53d317={};_0x53d317[_0x3c909f]={'$like':'%'+_0x3bc5c8['query'][_0xe26c('0x43')]+'%'};return _0x53d317;})});}_0x4c1cab=_[_0xe26c('0x44')]({},_0x4c1cab,_0x3bc5c8['options']);return _0x1b6326[_0xe26c('0x83')](_0x4c1cab);}})[_0xe26c('0x2a')](function(_0x13420c){if(_0x13420c){_0x47b83d=_0x13420c[_0xe26c('0x4d')];if(!_0x3bc5c8[_0xe26c('0x38')][_0xe26c('0x3f')](_0xe26c('0x84'))){_0x4c1cab['limit']=qs[_0xe26c('0x20')](_0x3bc5c8['query']['limit']);_0x4c1cab['offset']=qs[_0xe26c('0x23')](_0x3bc5c8[_0xe26c('0x38')][_0xe26c('0x23')]);}return _0x1b6326[_0xe26c('0x83')](_0x4c1cab);}})[_0xe26c('0x2a')](function(_0x49bd07){if(_0x49bd07){return _0x49bd07?{'count':_0x47b83d,'rows':_0x49bd07}:null;}})[_0xe26c('0x2a')](respondWithResult(_0x1ca900,null))[_0xe26c('0x4a')](handleError(_0x1ca900,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index febbe88..d802f8d 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 _0xee9c=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','../../mysqldb','Dashboard'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0xee9c,0x1e6));var _0xcee9=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xee9c[_0x2261ce];return _0x524640;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xcee9('0x0'))['db'][_0xcee9('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xcee9('0x2')](0x0);var events={'afterCreate':_0xcee9('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5e56ca){return function(_0x192063,_0x54d95f,_0x4cf614){DashboardEvents[_0xcee9('0x4')](_0x5e56ca+':'+_0x192063['id'],_0x192063);DashboardEvents['emit'](_0x5e56ca,_0x192063);_0x4cf614(null);};}for(var e in events){if(events[_0xcee9('0x5')](e)){var event=events[e];Dashboard[_0xcee9('0x6')](e,emitEvent(event));}}module[_0xcee9('0x7')]=DashboardEvents; \ No newline at end of file +var _0x4649=['Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x21cb95,_0x498caf){var _0x57081e=function(_0x216f33){while(--_0x216f33){_0x21cb95['push'](_0x21cb95['shift']());}};_0x57081e(++_0x498caf);}(_0x4649,0x199));var _0x9464=function(_0x43e903,_0x446f1b){_0x43e903=_0x43e903-0x0;var _0x16c3da=_0x4649[_0x43e903];return _0x16c3da;};'use strict';var EventEmitter=require(_0x9464('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x9464('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9464('0x2')](0x0);var events={'afterCreate':_0x9464('0x3'),'afterUpdate':_0x9464('0x4'),'afterDestroy':_0x9464('0x5')};function emitEvent(_0x116137){return function(_0x2137d3,_0x58331a,_0xdfa97e){DashboardEvents['emit'](_0x116137+':'+_0x2137d3['id'],_0x2137d3);DashboardEvents[_0x9464('0x6')](_0x116137,_0x2137d3);_0xdfa97e(null);};}for(var e in events){if(events[_0x9464('0x7')](e)){var event=events[e];Dashboard[_0x9464('0x8')](e,emitEvent(event));}}module[_0x9464('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 581cdd0..f240968 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 _0x25cf=['moment','bluebird','path','../../config/environment','./dashboard.attributes','exports','define','dashboards'];(function(_0x16938f,_0x35e57f){var _0x5c66e9=function(_0x5167d7){while(--_0x5167d7){_0x16938f['push'](_0x16938f['shift']());}};_0x5c66e9(++_0x35e57f);}(_0x25cf,0x138));var _0xf25c=function(_0x509755,_0x27e1c6){_0x509755=_0x509755-0x0;var _0x47df7e=_0x25cf[_0x509755];return _0x47df7e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf25c('0x0'));var BPromise=require(_0xf25c('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf25c('0x2'));var rimraf=require('rimraf');var config=require(_0xf25c('0x3'));var attributes=require(_0xf25c('0x4'));module[_0xf25c('0x5')]=function(_0x339b11,_0x26e604){return _0x339b11[_0xf25c('0x6')]('Dashboard',attributes,{'tableName':_0xf25c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10ef=['request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api','bluebird'];(function(_0x3c90ba,_0x39ee29){var _0x34d72e=function(_0x44e0d9){while(--_0x44e0d9){_0x3c90ba['push'](_0x3c90ba['shift']());}};_0x34d72e(++_0x39ee29);}(_0x10ef,0x119));var _0xf10e=function(_0x26afb9,_0x1e7058){_0x26afb9=_0x26afb9-0x0;var _0x25330e=_0x10ef[_0x26afb9];return _0x25330e;};'use strict';var _=require(_0xf10e('0x0'));var util=require(_0xf10e('0x1'));var logger=require(_0xf10e('0x2'))(_0xf10e('0x3'));var moment=require('moment');var BPromise=require(_0xf10e('0x4'));var rp=require(_0xf10e('0x5'));var fs=require('fs');var path=require(_0xf10e('0x6'));var rimraf=require('rimraf');var config=require(_0xf10e('0x7'));var attributes=require(_0xf10e('0x8'));module[_0xf10e('0x9')]=function(_0x204cb5,_0x3f5265){return _0x204cb5[_0xf10e('0xa')](_0xf10e('0xb'),attributes,{'tableName':_0xf10e('0xc'),'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 0b9e845..f42e3bc 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 _0x575f=['error','message','result','catch','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','code'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0x575f,0x18a));var _0xf575=function(_0x272404,_0x14f5cd){_0x272404=_0x272404-0x0;var _0x2bfc14=_0x575f[_0x272404];return _0x2bfc14;};'use strict';var _=require('lodash');var util=require(_0xf575('0x0'));var moment=require(_0xf575('0x1'));var BPromise=require(_0xf575('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf575('0x3'))(_0xf575('0x4'));var config=require(_0xf575('0x5'));var jayson=require(_0xf575('0x6'));var client=jayson[_0xf575('0x7')][_0xf575('0x8')]({'port':0x232a});config[_0xf575('0x9')]=_[_0xf575('0xa')](config['redis'],{'host':_0xf575('0xb'),'port':0x18eb});var socket=require(_0xf575('0xc'))(new Redis(config[_0xf575('0x9')]));require('./dashboard.socket')[_0xf575('0xd')](socket);function respondWithRpcPromise(_0x141ac2,_0x280eef,_0xf465ee){return new BPromise(function(_0xae364e,_0x3f2382){return client[_0xf575('0xe')](_0x141ac2,_0xf465ee)[_0xf575('0xf')](function(_0x1c6219){logger[_0xf575('0x10')](_0xf575('0x11'),_0x280eef,_0xf575('0x12'));logger[_0xf575('0x13')](_0xf575('0x14'),_0x280eef,_0xf575('0x12'),JSON['stringify'](_0x1c6219));if(_0x1c6219['error']){if(_0x1c6219['error'][_0xf575('0x15')]===0x1f4){logger['error'](_0xf575('0x11'),_0x280eef,_0x1c6219[_0xf575('0x16')][_0xf575('0x17')]);return _0x3f2382(_0x1c6219[_0xf575('0x16')][_0xf575('0x17')]);}logger[_0xf575('0x16')]('Dashboard,\x20%s,\x20%s',_0x280eef,_0x1c6219['error'][_0xf575('0x17')]);return _0xae364e(_0x1c6219['error'][_0xf575('0x17')]);}else{logger[_0xf575('0x10')](_0xf575('0x11'),_0x280eef,_0xf575('0x12'));_0xae364e(_0x1c6219[_0xf575('0x18')][_0xf575('0x17')]);}})[_0xf575('0x19')](function(_0x1c42c9){logger[_0xf575('0x16')]('Dashboard,\x20%s,\x20%s',_0x280eef,_0x1c42c9);_0x3f2382(_0x1c42c9);});});} \ No newline at end of file +var _0x3411=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3441d7,_0x465329){var _0x64c81d=function(_0x20f2cd){while(--_0x20f2cd){_0x3441d7['push'](_0x3441d7['shift']());}};_0x64c81d(++_0x465329);}(_0x3411,0x1e8));var _0x1341=function(_0x3aa029,_0x3cd035){_0x3aa029=_0x3aa029-0x0;var _0x4cb9a5=_0x3411[_0x3aa029];return _0x4cb9a5;};'use strict';var _=require('lodash');var util=require(_0x1341('0x0'));var moment=require(_0x1341('0x1'));var BPromise=require('bluebird');var rs=require(_0x1341('0x2'));var fs=require('fs');var Redis=require(_0x1341('0x3'));var db=require(_0x1341('0x4'))['db'];var utils=require(_0x1341('0x5'));var logger=require(_0x1341('0x6'))(_0x1341('0x7'));var config=require(_0x1341('0x8'));var jayson=require(_0x1341('0x9'));var client=jayson[_0x1341('0xa')][_0x1341('0xb')]({'port':0x232a});config[_0x1341('0xc')]=_[_0x1341('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1341('0xe'))(new Redis(config[_0x1341('0xc')]));require(_0x1341('0xf'))['register'](socket);function respondWithRpcPromise(_0xb1a2b5,_0x3f9586,_0x41430c){return new BPromise(function(_0x5b168b,_0x2edc76){return client['request'](_0xb1a2b5,_0x41430c)['then'](function(_0x41b597){logger[_0x1341('0x10')](_0x1341('0x11'),_0x3f9586,_0x1341('0x12'));logger[_0x1341('0x13')](_0x1341('0x14'),_0x3f9586,_0x1341('0x12'),JSON[_0x1341('0x15')](_0x41b597));if(_0x41b597[_0x1341('0x16')]){if(_0x41b597[_0x1341('0x16')][_0x1341('0x17')]===0x1f4){logger[_0x1341('0x16')](_0x1341('0x11'),_0x3f9586,_0x41b597[_0x1341('0x16')]['message']);return _0x2edc76(_0x41b597[_0x1341('0x16')][_0x1341('0x18')]);}logger[_0x1341('0x16')]('Dashboard,\x20%s,\x20%s',_0x3f9586,_0x41b597[_0x1341('0x16')][_0x1341('0x18')]);return _0x5b168b(_0x41b597[_0x1341('0x16')]['message']);}else{logger[_0x1341('0x10')](_0x1341('0x11'),_0x3f9586,_0x1341('0x12'));_0x5b168b(_0x41b597[_0x1341('0x19')][_0x1341('0x18')]);}})[_0x1341('0x1a')](function(_0x281adf){logger[_0x1341('0x16')](_0x1341('0x11'),_0x3f9586,_0x281adf);_0x2edc76(_0x281adf);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 6b50eb3..39a5f80 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 _0xb06c=['save','remove','register'];(function(_0x152aa1,_0x307718){var _0x1bc01a=function(_0xd3211e){while(--_0xd3211e){_0x152aa1['push'](_0x152aa1['shift']());}};_0x1bc01a(++_0x307718);}(_0xb06c,0x141));var _0xcb06=function(_0x1d8486,_0x4f7c7e){_0x1d8486=_0x1d8486-0x0;var _0x16c51a=_0xb06c[_0x1d8486];return _0x16c51a;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xcb06('0x0'),_0xcb06('0x1'),'update'];function createListener(_0x4e1dca,_0x411d02){return function(_0x45d1aa){_0x411d02['emit'](_0x4e1dca,_0x45d1aa);};}function removeListener(_0x1c1176,_0x23c665){return function(){DashboardEvents['removeListener'](_0x1c1176,_0x23c665);};}exports[_0xcb06('0x2')]=function(_0x53f4a7){for(var _0x5f37b0=0x0,_0x16f9d8=events['length'];_0x5f37b0<_0x16f9d8;_0x5f37b0++){var _0xd971fe=events[_0x5f37b0];var _0x3c1e38=createListener('dashboard:'+_0xd971fe,_0x53f4a7);DashboardEvents['on'](_0xd971fe,_0x3c1e38);}}; \ No newline at end of file +var _0x0655=['remove','update','removeListener','register','length','dashboard:','./dashboard.events','save'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x0655,0x176));var _0x5065=function(_0x303862,_0x20b5ab){_0x303862=_0x303862-0x0;var _0xe6f228=_0x0655[_0x303862];return _0xe6f228;};'use strict';var DashboardEvents=require(_0x5065('0x0'));var events=[_0x5065('0x1'),_0x5065('0x2'),_0x5065('0x3')];function createListener(_0x4eb370,_0x20ae40){return function(_0x1f9111){_0x20ae40['emit'](_0x4eb370,_0x1f9111);};}function removeListener(_0x252885,_0x26e36f){return function(){DashboardEvents[_0x5065('0x4')](_0x252885,_0x26e36f);};}exports[_0x5065('0x5')]=function(_0x259727){for(var _0x4776dd=0x0,_0x4cfa03=events[_0x5065('0x6')];_0x4776dd<_0x4cfa03;_0x4776dd++){var _0x2ec3a3=events[_0x4776dd];var _0x49f1d0=createListener(_0x5065('0x7')+_0x2ec3a3,_0x259727);DashboardEvents['on'](_0x2ec3a3,_0x49f1d0);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5634aee..e4867fc 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 _0x7688=['../../config/environment','./dashboard.controller','isAuthenticated','get','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x8675c0,_0xc924aa){var _0x59a055=function(_0x2a3c6d){while(--_0x2a3c6d){_0x8675c0['push'](_0x8675c0['shift']());}};_0x59a055(++_0xc924aa);}(_0x7688,0x1f3));var _0x8768=function(_0x299611,_0x2a97ff){_0x299611=_0x299611-0x0;var _0x443eae=_0x7688[_0x299611];return _0x443eae;};'use strict';var multer=require(_0x8768('0x0'));var util=require(_0x8768('0x1'));var path=require(_0x8768('0x2'));var timeout=require(_0x8768('0x3'));var express=require(_0x8768('0x4'));var router=express[_0x8768('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8768('0x6'));var config=require(_0x8768('0x7'));var controller=require(_0x8768('0x8'));router['get']('/',auth[_0x8768('0x9')](),controller['index']);router['get']('/:id',auth[_0x8768('0x9')](),controller['show']);router[_0x8768('0xa')](_0x8768('0xb'),auth[_0x8768('0x9')](),controller[_0x8768('0xc')]);router[_0x8768('0xd')]('/',auth[_0x8768('0x9')](),controller[_0x8768('0xe')]);router[_0x8768('0xd')](_0x8768('0xf'),auth['isAuthenticated'](),controller[_0x8768('0x10')]);router[_0x8768('0xd')](_0x8768('0xb'),auth[_0x8768('0x9')](),controller[_0x8768('0x11')]);router[_0x8768('0x12')](_0x8768('0x13'),auth[_0x8768('0x9')](),controller[_0x8768('0x14')]);router[_0x8768('0x15')](_0x8768('0x13'),auth[_0x8768('0x9')](),controller[_0x8768('0x16')]);module['exports']=router; \ No newline at end of file +var _0xe23a=['show','/:id/items','post','create','/:id/clone','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id'];(function(_0x324628,_0x928ca1){var _0x6bca14=function(_0x41ee94){while(--_0x41ee94){_0x324628['push'](_0x324628['shift']());}};_0x6bca14(++_0x928ca1);}(_0xe23a,0x168));var _0xae23=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xe23a[_0x4dcc2d];return _0x1bbd79;};'use strict';var multer=require(_0xae23('0x0'));var util=require(_0xae23('0x1'));var path=require(_0xae23('0x2'));var timeout=require(_0xae23('0x3'));var express=require(_0xae23('0x4'));var router=express[_0xae23('0x5')]();var fs_extra=require(_0xae23('0x6'));var auth=require(_0xae23('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xae23('0x8'));var controller=require(_0xae23('0x9'));router[_0xae23('0xa')]('/',auth[_0xae23('0xb')](),controller[_0xae23('0xc')]);router[_0xae23('0xa')](_0xae23('0xd'),auth[_0xae23('0xb')](),controller[_0xae23('0xe')]);router[_0xae23('0xa')](_0xae23('0xf'),auth[_0xae23('0xb')](),controller['getItems']);router[_0xae23('0x10')]('/',auth[_0xae23('0xb')](),controller[_0xae23('0x11')]);router[_0xae23('0x10')](_0xae23('0x12'),auth['isAuthenticated'](),controller['clone']);router[_0xae23('0x10')](_0xae23('0xf'),auth[_0xae23('0xb')](),controller['addItem']);router[_0xae23('0x13')](_0xae23('0xd'),auth[_0xae23('0xb')](),controller['update']);router[_0xae23('0x14')](_0xae23('0xd'),auth[_0xae23('0xb')](),controller[_0xae23('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 4500877..fdb9515 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 _0xadb5=['long','parse','getDataValue','setDataValue','attrs','stringify','INTEGER','#2196f3','squel','exports','STRING'];(function(_0x498c26,_0x3b4e2c){var _0x45f52b=function(_0xa5bce4){while(--_0xa5bce4){_0x498c26['push'](_0x498c26['shift']());}};_0x45f52b(++_0x3b4e2c);}(_0xadb5,0xad));var _0x5adb=function(_0x1c2bee,_0x1c7c84){_0x1c2bee=_0x1c2bee-0x0;var _0x2d37d4=_0xadb5[_0x1c2bee];return _0x2d37d4;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x5adb('0x0'));var _=require('lodash');module[_0x5adb('0x1')]={'title':{'type':Sequelize[_0x5adb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5adb('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x5adb('0x3')),'get':function(){try{return JSON[_0x5adb('0x4')](this[_0x5adb('0x5')]('attrs'));}catch(_0x35a5d3){return[];}},'set':function(_0x168d89){try{this[_0x5adb('0x6')](_0x5adb('0x7'),JSON[_0x5adb('0x8')](_0x168d89));}catch(_0x353885){this[_0x5adb('0x6')](_0x5adb('0x7'),JSON[_0x5adb('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x5adb('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5adb('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5adb('0x9')]},'col':{'type':Sequelize[_0x5adb('0x9')]},'background':{'type':Sequelize[_0x5adb('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5adb('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5adb('0x2')]},'titleFontSize':{'type':Sequelize[_0x5adb('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x1261=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0x1261,0x144));var _0x1126=function(_0x409251,_0x40f525){_0x409251=_0x409251-0x0;var _0x216f47=_0x1261[_0x409251];return _0x216f47;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x1126('0x0'));var _=require(_0x1126('0x1'));module[_0x1126('0x2')]={'title':{'type':Sequelize[_0x1126('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1126('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x1126('0x4')](_0x1126('0x5')),'get':function(){try{return JSON[_0x1126('0x6')](this[_0x1126('0x7')](_0x1126('0x8')));}catch(_0x5a2189){return[];}},'set':function(_0x5c68c8){try{this[_0x1126('0x9')](_0x1126('0x8'),JSON['stringify'](_0x5c68c8));}catch(_0x17e5f0){this[_0x1126('0x9')](_0x1126('0x8'),JSON[_0x1126('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x1126('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1126('0xb')]},'col':{'type':Sequelize[_0x1126('0xb')]},'background':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1126('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 75f73d6..ad201d5 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 _0x1298=['intersection','attributes','fields','length','includeAll','merge','options','find','catch','destroy','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','type','attrReport','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','stack','name','send','show','params','model','keys','DashboardItem','query','filters'];(function(_0x477fba,_0x42530e){var _0x4ccb96=function(_0x3bf99a){while(--_0x3bf99a){_0x477fba['push'](_0x477fba['shift']());}};_0x4ccb96(++_0x42530e);}(_0x1298,0x19e));var _0x8129=function(_0x5b706c,_0x3ac790){_0x5b706c=_0x5b706c-0x0;var _0xd0a92c=_0x1298[_0x5b706c];return _0xd0a92c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8129('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8129('0x1'));var rp=require(_0x8129('0x2'));var moment=require(_0x8129('0x3'));var BPromise=require(_0x8129('0x4'));var Mustache=require(_0x8129('0x5'));var util=require(_0x8129('0x6'));var path=require(_0x8129('0x7'));var sox=require('sox');var csv=require(_0x8129('0x8'));var ejs=require(_0x8129('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8129('0xa'));var crypto=require(_0x8129('0xb'));var jsforce=require(_0x8129('0xc'));var deskjs=require(_0x8129('0xd'));var toCsv=require(_0x8129('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8129('0xe'));var as=require(_0x8129('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8129('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x8129('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8129('0x12')]=_[_0x8129('0x13')](config[_0x8129('0x12')],{'host':_0x8129('0x14'),'port':0x18eb});var socket=require(_0x8129('0x15'))(new Redis(config[_0x8129('0x12')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x4027bf,_0x5e7de8){_0x5e7de8=_0x5e7de8||0xcc;return function(_0x368154){if(_0x368154){return _0x4027bf['sendStatus'](_0x5e7de8);}return _0x4027bf[_0x8129('0x16')](_0x5e7de8)[_0x8129('0x17')]();};}function respondWithResult(_0x5544c4,_0x2ce595){_0x2ce595=_0x2ce595||0xc8;return function(_0x55fa91){if(_0x55fa91){return _0x5544c4[_0x8129('0x16')](_0x2ce595)[_0x8129('0x18')](_0x55fa91);}};}function respondWithFilteredResult(_0x41e0d3,_0x56efa1){return function(_0x17e742){if(_0x17e742){var _0x1ec668=typeof _0x56efa1[_0x8129('0x19')]===_0x8129('0x1a')&&typeof _0x56efa1[_0x8129('0x1b')]===_0x8129('0x1a');var _0x496727=_0x17e742['count'];var _0x1ac697=_0x1ec668?0x0:_0x56efa1['offset'];var _0x22c68d=_0x1ec668?_0x17e742[_0x8129('0x1c')]:_0x56efa1[_0x8129('0x19')]+_0x56efa1[_0x8129('0x1b')];var _0x6d2708;if(_0x22c68d>=_0x496727){_0x22c68d=_0x496727;_0x6d2708=0xc8;}else{_0x6d2708=0xce;}_0x41e0d3[_0x8129('0x16')](_0x6d2708);return _0x41e0d3[_0x8129('0x1d')](_0x8129('0x1e'),_0x1ac697+'-'+_0x22c68d+'/'+_0x496727)[_0x8129('0x18')](_0x17e742);}return null;};}function patchUpdates(_0x391eb0){return function(_0x511086){try{jsonpatch[_0x8129('0x1f')](_0x511086,_0x391eb0,!![]);}catch(_0xaf68ef){return BPromise[_0x8129('0x20')](_0xaf68ef);}return _0x511086[_0x8129('0x21')]();};}function saveUpdates(_0x5ad05c,_0x1b1bdd){return function(_0x20a2c3){if(_0x20a2c3){return _0x20a2c3['update'](_0x5ad05c)[_0x8129('0x22')](function(_0x58a641){return _0x58a641;});}return null;};}function removeEntity(_0x193df0,_0x3b6e8e){return function(_0x3aae61){if(_0x3aae61){return _0x3aae61['destroy']()[_0x8129('0x22')](function(){_0x193df0[_0x8129('0x16')](0xcc)[_0x8129('0x17')]();});}};}function handleEntityNotFound(_0x4b57f0,_0x5dd98d){return function(_0x2e4512){if(!_0x2e4512){_0x4b57f0[_0x8129('0x23')](0x194);}return _0x2e4512;};}function handleError(_0x481001,_0x2d59cb){_0x2d59cb=_0x2d59cb||0x1f4;return function(_0x467162){logger['error'](_0x467162[_0x8129('0x24')]);if(_0x467162[_0x8129('0x25')]){delete _0x467162['name'];}_0x481001[_0x8129('0x16')](_0x2d59cb)[_0x8129('0x26')](_0x467162);};}exports[_0x8129('0x27')]=function(_0x435356,_0x3c50ff){var _0x1e48b8={'raw':![],'where':{'id':_0x435356[_0x8129('0x28')]['id']}},_0x3708e3={};_0x3708e3[_0x8129('0x29')]=_[_0x8129('0x2a')](db[_0x8129('0x2b')]['rawAttributes']);_0x3708e3['query']=_[_0x8129('0x2a')](_0x435356[_0x8129('0x2c')]);_0x3708e3[_0x8129('0x2d')]=_[_0x8129('0x2e')](_0x3708e3['model'],_0x3708e3[_0x8129('0x2c')]);_0x1e48b8[_0x8129('0x2f')]=_[_0x8129('0x2e')](_0x3708e3[_0x8129('0x29')],qs[_0x8129('0x30')](_0x435356['query']['fields']));_0x1e48b8[_0x8129('0x2f')]=_0x1e48b8[_0x8129('0x2f')][_0x8129('0x31')]?_0x1e48b8[_0x8129('0x2f')]:_0x3708e3['model'];if(_0x435356['query'][_0x8129('0x32')]){_0x1e48b8['include']=[{'all':!![]}];}_0x1e48b8=_[_0x8129('0x33')]({},_0x1e48b8,_0x435356[_0x8129('0x34')]);return db[_0x8129('0x2b')][_0x8129('0x35')](_0x1e48b8)[_0x8129('0x22')](handleEntityNotFound(_0x3c50ff,null))[_0x8129('0x22')](respondWithResult(_0x3c50ff,null))[_0x8129('0x36')](handleError(_0x3c50ff,null));};exports[_0x8129('0x37')]=function(_0x56f555,_0x1d1231){return db[_0x8129('0x2b')]['find']({'where':{'id':_0x56f555['params']['id']}})['then'](handleEntityNotFound(_0x1d1231,null))[_0x8129('0x22')](removeEntity(_0x1d1231,null))[_0x8129('0x36')](handleError(_0x1d1231,null));};function widgetAttributes(_0x4672e6){try{switch(_0x4672e6['type']){case _0x8129('0x38'):return[{'name':'attrUrl','value':_0x4672e6[_0x8129('0x39')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0x0]?_0x4672e6[_0x8129('0x3a')][0x0][_0x8129('0x3b')]:undefined)||'https://'}];case _0x8129('0x3c'):return[{'name':_0x8129('0x3d'),'value':_0x4672e6[_0x8129('0x3d')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0x0]?_0x4672e6[_0x8129('0x3a')][0x0][_0x8129('0x3b')]:undefined)||''}];case _0x8129('0x3e'):return[{'name':_0x8129('0x3f'),'value':_0x4672e6[_0x8129('0x3f')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0x0]?_0x4672e6[_0x8129('0x3a')][0x0][_0x8129('0x3b')]:undefined)||'HH:mm:ss'},{'name':_0x8129('0x40'),'value':_0x4672e6[_0x8129('0x40')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0x1]?_0x4672e6['attrs'][0x1]['value']:undefined)||_0x8129('0x41')},{'name':_0x8129('0x42'),'value':_0x4672e6['attrFontSize']||(_0x4672e6['attrs']&&_0x4672e6[_0x8129('0x3a')][0x2]?_0x4672e6[_0x8129('0x3a')][0x2][_0x8129('0x3b')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x4672e6[_0x8129('0x43')]||(_0x4672e6['attrs']&&_0x4672e6['attrs'][0x0]?_0x4672e6[_0x8129('0x3a')][0x0][_0x8129('0x3b')]:undefined)||_0x8129('0x44')},{'name':_0x8129('0x45'),'value':_0x4672e6['attrVoiceQueues']||(_0x4672e6['attrs']&&_0x4672e6[_0x8129('0x3a')][0x1]?_0x4672e6[_0x8129('0x3a')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x4672e6[_0x8129('0x42')]||(_0x4672e6['attrs']&&_0x4672e6['attrs'][0x2]?_0x4672e6['attrs'][0x2]['value']:undefined)||0x14},{'name':_0x8129('0x46'),'value':_0x4672e6[_0x8129('0x46')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0x3]?_0x4672e6[_0x8129('0x3a')][0x3][_0x8129('0x3b')]:undefined)||_0x8129('0x47')},{'name':_0x8129('0x48'),'value':_0x4672e6[_0x8129('0x48')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6['attrs'][0x4]?_0x4672e6[_0x8129('0x3a')][0x4][_0x8129('0x3b')]:undefined)||''},{'name':_0x8129('0x49'),'value':_0x4672e6[_0x8129('0x49')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0x5]?_0x4672e6['attrs'][0x5]['value']:undefined)||''},{'name':_0x8129('0x4a'),'value':_0x4672e6[_0x8129('0x4a')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0x6]?_0x4672e6['attrs'][0x6][_0x8129('0x3b')]:undefined)||''},{'name':_0x8129('0x4b'),'value':_0x4672e6[_0x8129('0x4b')]||(_0x4672e6['attrs']&&_0x4672e6[_0x8129('0x3a')][0x7]?_0x4672e6[_0x8129('0x3a')][0x7][_0x8129('0x3b')]:undefined)||''},{'name':_0x8129('0x4c'),'value':_0x4672e6[_0x8129('0x4c')]||(_0x4672e6['attrs']&&_0x4672e6['attrs'][0x8]?_0x4672e6[_0x8129('0x3a')][0x8][_0x8129('0x3b')]:undefined)||''},{'name':_0x8129('0x4d'),'value':_0x4672e6[_0x8129('0x4d')]||(_0x4672e6['attrs']&&_0x4672e6[_0x8129('0x3a')][0x9]?_0x4672e6[_0x8129('0x3a')][0x9][_0x8129('0x3b')]:undefined)||''}];case _0x8129('0x4e'):case'pie-chart':return[{'name':'attrSerie1','value':_0x4672e6[_0x8129('0x4f')]||(_0x4672e6['attrs']&&_0x4672e6[_0x8129('0x3a')][0x0]?_0x4672e6[_0x8129('0x3a')][0x0]['value']:undefined)||_0x8129('0x44')},{'name':'attrSerie2','value':_0x4672e6[_0x8129('0x50')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0x1]?_0x4672e6['attrs'][0x1]['value']:undefined)||null},{'name':_0x8129('0x51'),'value':_0x4672e6[_0x8129('0x51')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6['attrs'][0x2]?_0x4672e6[_0x8129('0x3a')][0x2][_0x8129('0x3b')]:undefined)||null},{'name':_0x8129('0x45'),'value':_0x4672e6['attrVoiceQueues']||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0x3]?_0x4672e6[_0x8129('0x3a')][0x3][_0x8129('0x3b')]:undefined)||[]},{'name':_0x8129('0x46'),'value':_0x4672e6[_0x8129('0x46')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0x4]?_0x4672e6['attrs'][0x4][_0x8129('0x3b')]:undefined)||_0x8129('0x47')},{'name':_0x8129('0x48'),'value':_0x4672e6[_0x8129('0x48')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0x5]?_0x4672e6[_0x8129('0x3a')][0x5][_0x8129('0x3b')]:undefined)||''},{'name':_0x8129('0x49'),'value':_0x4672e6['attrFaxAccounts']||(_0x4672e6['attrs']&&_0x4672e6[_0x8129('0x3a')][0x6]?_0x4672e6[_0x8129('0x3a')][0x6][_0x8129('0x3b')]:undefined)||''},{'name':_0x8129('0x4a'),'value':_0x4672e6[_0x8129('0x4a')]||(_0x4672e6['attrs']&&_0x4672e6['attrs'][0x7]?_0x4672e6[_0x8129('0x3a')][0x7][_0x8129('0x3b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4672e6['attrOpenchannelAccounts']||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0x8]?_0x4672e6[_0x8129('0x3a')][0x8][_0x8129('0x3b')]:undefined)||''},{'name':_0x8129('0x4c'),'value':_0x4672e6[_0x8129('0x4c')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0x9]?_0x4672e6['attrs'][0x9][_0x8129('0x3b')]:undefined)||''},{'name':_0x8129('0x4d'),'value':_0x4672e6[_0x8129('0x4d')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0xa]?_0x4672e6[_0x8129('0x3a')][0xa][_0x8129('0x3b')]:undefined)||''}];case _0x8129('0x52'):return[{'name':'attrReport','type':_0x4672e6[_0x8129('0x53')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0x0]?_0x4672e6['attrs'][0x0][_0x8129('0x54')]:undefined)||null,'value':_0x4672e6[_0x8129('0x55')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0x0]?_0x4672e6[_0x8129('0x3a')][0x0][_0x8129('0x3b')]:undefined)||null},{'name':_0x8129('0x56'),'value':_0x4672e6[_0x8129('0x56')]||(_0x4672e6[_0x8129('0x3a')]&&_0x4672e6[_0x8129('0x3a')][0x1]?_0x4672e6[_0x8129('0x3a')][0x1][_0x8129('0x3b')]:undefined)||0x0}];default:return[];}}catch(_0x506c07){logger[_0x8129('0x57')](_0x8129('0x58'),JSON[_0x8129('0x59')](_0x506c07));return[];}}exports[_0x8129('0x5a')]=function(_0x4f1d6d,_0x305e36){if(_0x4f1d6d[_0x8129('0x5b')]){_0x4f1d6d['body'][_0x8129('0x3a')]=widgetAttributes(_0x4f1d6d['body']);}return db[_0x8129('0x2b')][_0x8129('0x5a')](_0x4f1d6d[_0x8129('0x5b')],{})['then'](respondWithResult(_0x305e36,0xc9))[_0x8129('0x36')](handleError(_0x305e36,null));};exports['update']=function(_0x13de91,_0xe98f78){if(_0x13de91[_0x8129('0x5b')]['id']){delete _0x13de91[_0x8129('0x5b')]['id'];}_0x13de91[_0x8129('0x5b')][_0x8129('0x3a')]=widgetAttributes(_0x13de91[_0x8129('0x5b')]);return db[_0x8129('0x2b')]['find']({'where':{'id':_0x13de91[_0x8129('0x28')]['id']}})[_0x8129('0x22')](handleEntityNotFound(_0xe98f78,null))[_0x8129('0x22')](saveUpdates(_0x13de91[_0x8129('0x5b')],null))['then'](respondWithResult(_0xe98f78,null))[_0x8129('0x36')](handleError(_0xe98f78,null));}; \ No newline at end of file +var _0xab3f=['attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','error','stack','name','send','params','keys','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','include','options','DashboardItem','find','destroy','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts'];(function(_0x35b7f1,_0x55e6bf){var _0x4e1c3f=function(_0x11b19a){while(--_0x11b19a){_0x35b7f1['push'](_0x35b7f1['shift']());}};_0x4e1c3f(++_0x55e6bf);}(_0xab3f,0x72));var _0xfab3=function(_0x3039ff,_0x410929){_0x3039ff=_0x3039ff-0x0;var _0x2da362=_0xab3f[_0x3039ff];return _0x2da362;};'use strict';var emlformat=require(_0xfab3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfab3('0x1'));var jsonpatch=require(_0xfab3('0x2'));var rp=require(_0xfab3('0x3'));var moment=require(_0xfab3('0x4'));var BPromise=require(_0xfab3('0x5'));var Mustache=require(_0xfab3('0x6'));var util=require(_0xfab3('0x7'));var path=require(_0xfab3('0x8'));var sox=require(_0xfab3('0x9'));var csv=require(_0xfab3('0xa'));var ejs=require(_0xfab3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfab3('0xc'));var squel=require(_0xfab3('0xd'));var crypto=require(_0xfab3('0xe'));var jsforce=require(_0xfab3('0xf'));var deskjs=require(_0xfab3('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfab3('0x11'));var Redis=require('ioredis');var authService=require(_0xfab3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfab3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfab3('0x14'))(_0xfab3('0x15'));var utils=require(_0xfab3('0x16'));var config=require(_0xfab3('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xfab3('0x18')](config[_0xfab3('0x19')],{'host':_0xfab3('0x1a'),'port':0x18eb});var socket=require(_0xfab3('0x1b'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0xfab3('0x1c')](socket);function respondWithStatusCode(_0x21b629,_0x5912b6){_0x5912b6=_0x5912b6||0xcc;return function(_0x237685){if(_0x237685){return _0x21b629[_0xfab3('0x1d')](_0x5912b6);}return _0x21b629[_0xfab3('0x1e')](_0x5912b6)[_0xfab3('0x1f')]();};}function respondWithResult(_0xd76ff9,_0x5d9ea1){_0x5d9ea1=_0x5d9ea1||0xc8;return function(_0x584115){if(_0x584115){return _0xd76ff9[_0xfab3('0x1e')](_0x5d9ea1)[_0xfab3('0x20')](_0x584115);}};}function respondWithFilteredResult(_0x3d3d77,_0xaac714){return function(_0x3d08b1){if(_0x3d08b1){var _0x23cd33=typeof _0xaac714[_0xfab3('0x21')]===_0xfab3('0x22')&&typeof _0xaac714[_0xfab3('0x23')]==='undefined';var _0x516fcc=_0x3d08b1[_0xfab3('0x24')];var _0x129e58=_0x23cd33?0x0:_0xaac714[_0xfab3('0x21')];var _0x4944c5=_0x23cd33?_0x3d08b1[_0xfab3('0x24')]:_0xaac714[_0xfab3('0x21')]+_0xaac714[_0xfab3('0x23')];var _0x1200f7;if(_0x4944c5>=_0x516fcc){_0x4944c5=_0x516fcc;_0x1200f7=0xc8;}else{_0x1200f7=0xce;}_0x3d3d77[_0xfab3('0x1e')](_0x1200f7);return _0x3d3d77['set']('Content-Range',_0x129e58+'-'+_0x4944c5+'/'+_0x516fcc)['json'](_0x3d08b1);}return null;};}function patchUpdates(_0x41f624){return function(_0x1d6de4){try{jsonpatch[_0xfab3('0x25')](_0x1d6de4,_0x41f624,!![]);}catch(_0x2e6fd3){return BPromise['reject'](_0x2e6fd3);}return _0x1d6de4[_0xfab3('0x26')]();};}function saveUpdates(_0x3f1688,_0x37265e){return function(_0x10699f){if(_0x10699f){return _0x10699f[_0xfab3('0x27')](_0x3f1688)['then'](function(_0x56516e){return _0x56516e;});}return null;};}function removeEntity(_0x4765fb,_0x1d6394){return function(_0x53de31){if(_0x53de31){return _0x53de31['destroy']()[_0xfab3('0x28')](function(){_0x4765fb[_0xfab3('0x1e')](0xcc)[_0xfab3('0x1f')]();});}};}function handleEntityNotFound(_0x55689d,_0x133d2b){return function(_0x2383bb){if(!_0x2383bb){_0x55689d[_0xfab3('0x1d')](0x194);}return _0x2383bb;};}function handleError(_0x2a189a,_0x504444){_0x504444=_0x504444||0x1f4;return function(_0x215105){logger[_0xfab3('0x29')](_0x215105[_0xfab3('0x2a')]);if(_0x215105[_0xfab3('0x2b')]){delete _0x215105[_0xfab3('0x2b')];}_0x2a189a[_0xfab3('0x1e')](_0x504444)[_0xfab3('0x2c')](_0x215105);};}exports['show']=function(_0xb6b6ce,_0xdb1d59){var _0x1ae467={'raw':![],'where':{'id':_0xb6b6ce[_0xfab3('0x2d')]['id']}},_0x43fdab={};_0x43fdab['model']=_[_0xfab3('0x2e')](db['DashboardItem'][_0xfab3('0x2f')]);_0x43fdab[_0xfab3('0x30')]=_['keys'](_0xb6b6ce[_0xfab3('0x30')]);_0x43fdab[_0xfab3('0x31')]=_[_0xfab3('0x32')](_0x43fdab[_0xfab3('0x33')],_0x43fdab[_0xfab3('0x30')]);_0x1ae467['attributes']=_[_0xfab3('0x32')](_0x43fdab[_0xfab3('0x33')],qs[_0xfab3('0x34')](_0xb6b6ce[_0xfab3('0x30')][_0xfab3('0x34')]));_0x1ae467[_0xfab3('0x35')]=_0x1ae467[_0xfab3('0x35')][_0xfab3('0x36')]?_0x1ae467[_0xfab3('0x35')]:_0x43fdab['model'];if(_0xb6b6ce['query'][_0xfab3('0x37')]){_0x1ae467[_0xfab3('0x38')]=[{'all':!![]}];}_0x1ae467=_['merge']({},_0x1ae467,_0xb6b6ce[_0xfab3('0x39')]);return db[_0xfab3('0x3a')][_0xfab3('0x3b')](_0x1ae467)[_0xfab3('0x28')](handleEntityNotFound(_0xdb1d59,null))[_0xfab3('0x28')](respondWithResult(_0xdb1d59,null))['catch'](handleError(_0xdb1d59,null));};exports[_0xfab3('0x3c')]=function(_0xcc2b6c,_0x6d9ba3){return db['DashboardItem']['find']({'where':{'id':_0xcc2b6c['params']['id']}})['then'](handleEntityNotFound(_0x6d9ba3,null))[_0xfab3('0x28')](removeEntity(_0x6d9ba3,null))[_0xfab3('0x3d')](handleError(_0x6d9ba3,null));};function widgetAttributes(_0x2438a0){try{switch(_0x2438a0[_0xfab3('0x3e')]){case _0xfab3('0x3f'):return[{'name':_0xfab3('0x40'),'value':_0x2438a0[_0xfab3('0x40')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0[_0xfab3('0x41')][0x0][_0xfab3('0x42')]:undefined)||_0xfab3('0x43')}];case _0xfab3('0x44'):return[{'name':_0xfab3('0x45'),'value':_0x2438a0['attrPath']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0[_0xfab3('0x41')][0x0][_0xfab3('0x42')]:undefined)||''}];case _0xfab3('0x46'):return[{'name':_0xfab3('0x47'),'value':_0x2438a0[_0xfab3('0x47')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0[_0xfab3('0x41')][0x0][_0xfab3('0x42')]:undefined)||'HH:mm:ss'},{'name':_0xfab3('0x48'),'value':_0x2438a0[_0xfab3('0x48')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x1]?_0x2438a0[_0xfab3('0x41')][0x1][_0xfab3('0x42')]:undefined)||'0.00'},{'name':_0xfab3('0x49'),'value':_0x2438a0[_0xfab3('0x49')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x2]?_0x2438a0['attrs'][0x2][_0xfab3('0x42')]:undefined)||0xc}];case _0xfab3('0x4a'):return[{'name':_0xfab3('0x4b'),'value':_0x2438a0['attrMetric']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0['attrs'][0x0][_0xfab3('0x42')]:undefined)||_0xfab3('0x4c')},{'name':'attrVoiceQueues','value':_0x2438a0['attrVoiceQueues']||(_0x2438a0['attrs']&&_0x2438a0['attrs'][0x1]?_0x2438a0[_0xfab3('0x41')][0x1][_0xfab3('0x42')]:undefined)||[]},{'name':'attrFontSize','value':_0x2438a0[_0xfab3('0x49')]||(_0x2438a0['attrs']&&_0x2438a0['attrs'][0x2]?_0x2438a0[_0xfab3('0x41')][0x2][_0xfab3('0x42')]:undefined)||0x14},{'name':_0xfab3('0x4d'),'value':_0x2438a0['attrChannel']||(_0x2438a0['attrs']&&_0x2438a0[_0xfab3('0x41')][0x3]?_0x2438a0[_0xfab3('0x41')][0x3][_0xfab3('0x42')]:undefined)||_0xfab3('0x4e')},{'name':_0xfab3('0x4f'),'value':_0x2438a0[_0xfab3('0x4f')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x4]?_0x2438a0[_0xfab3('0x41')][0x4][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x50'),'value':_0x2438a0[_0xfab3('0x50')]||(_0x2438a0['attrs']&&_0x2438a0[_0xfab3('0x41')][0x5]?_0x2438a0['attrs'][0x5][_0xfab3('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2438a0[_0xfab3('0x51')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0['attrs'][0x6]?_0x2438a0[_0xfab3('0x41')][0x6][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x52'),'value':_0x2438a0[_0xfab3('0x52')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0['attrs'][0x7]?_0x2438a0['attrs'][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2438a0[_0xfab3('0x53')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x8]?_0x2438a0[_0xfab3('0x41')][0x8][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x54'),'value':_0x2438a0['attrChatWebsites']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x9]?_0x2438a0[_0xfab3('0x41')][0x9]['value']:undefined)||''}];case _0xfab3('0x55'):case'pie-chart':return[{'name':_0xfab3('0x56'),'value':_0x2438a0['attrSerie1']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0[_0xfab3('0x41')][0x0][_0xfab3('0x42')]:undefined)||_0xfab3('0x4c')},{'name':_0xfab3('0x57'),'value':_0x2438a0['attrSerie2']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x1]?_0x2438a0[_0xfab3('0x41')][0x1][_0xfab3('0x42')]:undefined)||null},{'name':_0xfab3('0x58'),'value':_0x2438a0['attrSerie3']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0['attrs'][0x2]?_0x2438a0[_0xfab3('0x41')][0x2][_0xfab3('0x42')]:undefined)||null},{'name':_0xfab3('0x59'),'value':_0x2438a0[_0xfab3('0x59')]||(_0x2438a0['attrs']&&_0x2438a0[_0xfab3('0x41')][0x3]?_0x2438a0['attrs'][0x3]['value']:undefined)||[]},{'name':_0xfab3('0x4d'),'value':_0x2438a0[_0xfab3('0x4d')]||(_0x2438a0['attrs']&&_0x2438a0[_0xfab3('0x41')][0x4]?_0x2438a0[_0xfab3('0x41')][0x4]['value']:undefined)||_0xfab3('0x4e')},{'name':_0xfab3('0x4f'),'value':_0x2438a0[_0xfab3('0x4f')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x5]?_0x2438a0[_0xfab3('0x41')][0x5][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x50'),'value':_0x2438a0[_0xfab3('0x50')]||(_0x2438a0['attrs']&&_0x2438a0[_0xfab3('0x41')][0x6]?_0x2438a0[_0xfab3('0x41')][0x6][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x51'),'value':_0x2438a0[_0xfab3('0x51')]||(_0x2438a0['attrs']&&_0x2438a0['attrs'][0x7]?_0x2438a0[_0xfab3('0x41')][0x7][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x52'),'value':_0x2438a0['attrOpenchannelAccounts']||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0['attrs'][0x8]?_0x2438a0[_0xfab3('0x41')][0x8][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x53'),'value':_0x2438a0[_0xfab3('0x53')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x9]?_0x2438a0[_0xfab3('0x41')][0x9][_0xfab3('0x42')]:undefined)||''},{'name':_0xfab3('0x54'),'value':_0x2438a0[_0xfab3('0x54')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0xa]?_0x2438a0['attrs'][0xa][_0xfab3('0x42')]:undefined)||''}];case _0xfab3('0x5a'):return[{'name':_0xfab3('0x5b'),'type':_0x2438a0[_0xfab3('0x5c')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0['attrs'][0x0][_0xfab3('0x3e')]:undefined)||null,'value':_0x2438a0[_0xfab3('0x5b')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x0]?_0x2438a0[_0xfab3('0x41')][0x0]['value']:undefined)||null},{'name':_0xfab3('0x5d'),'value':_0x2438a0[_0xfab3('0x5d')]||(_0x2438a0[_0xfab3('0x41')]&&_0x2438a0[_0xfab3('0x41')][0x1]?_0x2438a0[_0xfab3('0x41')][0x1][_0xfab3('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x231489){logger['error'](_0xfab3('0x5e'),JSON[_0xfab3('0x5f')](_0x231489));return[];}}exports[_0xfab3('0x60')]=function(_0x1bccc0,_0x12141b){if(_0x1bccc0['body']){_0x1bccc0[_0xfab3('0x61')][_0xfab3('0x41')]=widgetAttributes(_0x1bccc0[_0xfab3('0x61')]);}return db['DashboardItem'][_0xfab3('0x60')](_0x1bccc0[_0xfab3('0x61')],{})[_0xfab3('0x28')](respondWithResult(_0x12141b,0xc9))['catch'](handleError(_0x12141b,null));};exports[_0xfab3('0x27')]=function(_0x3fdc2b,_0x36f011){if(_0x3fdc2b[_0xfab3('0x61')]['id']){delete _0x3fdc2b['body']['id'];}_0x3fdc2b['body'][_0xfab3('0x41')]=widgetAttributes(_0x3fdc2b[_0xfab3('0x61')]);return db[_0xfab3('0x3a')][_0xfab3('0x3b')]({'where':{'id':_0x3fdc2b['params']['id']}})[_0xfab3('0x28')](handleEntityNotFound(_0x36f011,null))[_0xfab3('0x28')](saveUpdates(_0x3fdc2b[_0xfab3('0x61')],null))['then'](respondWithResult(_0x36f011,null))[_0xfab3('0x3d')](handleError(_0x36f011,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 851b2e0..985e7fc 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 _0x651d=['exports','setMaxListeners','save','update','remove','emit','hook'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x651d,0x71));var _0xd651=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x651d[_0xa2c0a3];return _0x52c618;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd651('0x0')](0x0);var events={'afterCreate':_0xd651('0x1'),'afterUpdate':_0xd651('0x2'),'afterDestroy':_0xd651('0x3')};function emitEvent(_0x41e87e){return function(_0x329ff4,_0x54662f,_0x5027e9){DashboardItemEvents['emit'](_0x41e87e+':'+_0x329ff4['id'],_0x329ff4);DashboardItemEvents[_0xd651('0x4')](_0x41e87e,_0x329ff4);_0x5027e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xd651('0x5')](e,emitEvent(event));}}module[_0xd651('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0xaee1=['DashboardItem','save','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x4751ac,_0x44b9c6){var _0x803678=function(_0x56963a){while(--_0x56963a){_0x4751ac['push'](_0x4751ac['shift']());}};_0x803678(++_0x44b9c6);}(_0xaee1,0x12f));var _0x1aee=function(_0x2731c0,_0x41603d){_0x2731c0=_0x2731c0-0x0;var _0x2bc4d0=_0xaee1[_0x2731c0];return _0x2bc4d0;};'use strict';var EventEmitter=require(_0x1aee('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x1aee('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1aee('0x2'),'afterUpdate':_0x1aee('0x3'),'afterDestroy':_0x1aee('0x4')};function emitEvent(_0x14c59f){return function(_0x402859,_0x482a4a,_0x819ad2){DashboardItemEvents['emit'](_0x14c59f+':'+_0x402859['id'],_0x402859);DashboardItemEvents['emit'](_0x14c59f,_0x402859);_0x819ad2(null);};}for(var e in events){if(events[_0x1aee('0x5')](e)){var event=events[e];DashboardItem[_0x1aee('0x6')](e,emitEvent(event));}}module[_0x1aee('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 4cfa182..680ce74 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 _0x9bf9=['lodash','util','moment','bluebird','path','rimraf','./dashboardItem.attributes','exports','define'];(function(_0x2f1ebe,_0x2e340a){var _0x522491=function(_0x5d89ba){while(--_0x5d89ba){_0x2f1ebe['push'](_0x2f1ebe['shift']());}};_0x522491(++_0x2e340a);}(_0x9bf9,0x168));var _0x99bf=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9bf9[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x99bf('0x0'));var util=require(_0x99bf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x99bf('0x2'));var BPromise=require(_0x99bf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99bf('0x4'));var rimraf=require(_0x99bf('0x5'));var config=require('../../config/environment');var attributes=require(_0x99bf('0x6'));module[_0x99bf('0x7')]=function(_0x61ecac,_0x50d641){return _0x61ecac[_0x99bf('0x8')]('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b50=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','dashboard_items'];(function(_0x5090f7,_0x558ea8){var _0x456aff=function(_0x4bcc9d){while(--_0x4bcc9d){_0x5090f7['push'](_0x5090f7['shift']());}};_0x456aff(++_0x558ea8);}(_0x8b50,0x13f));var _0x08b5=function(_0x8ba8ac,_0x576610){_0x8ba8ac=_0x8ba8ac-0x0;var _0x246ec=_0x8b50[_0x8ba8ac];return _0x246ec;};'use strict';var _=require(_0x08b5('0x0'));var util=require(_0x08b5('0x1'));var logger=require(_0x08b5('0x2'))(_0x08b5('0x3'));var moment=require(_0x08b5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x08b5('0x5'));var rimraf=require(_0x08b5('0x6'));var config=require(_0x08b5('0x7'));var attributes=require(_0x08b5('0x8'));module[_0x08b5('0x9')]=function(_0x178411,_0x413e46){return _0x178411['define']('DashboardItem',attributes,{'tableName':_0x08b5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index bba7dc9..5f1d7c9 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 _0xe0e0=['defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','code','DashboardItem,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xe0e0,0x198));var _0x0e0e=function(_0x30e3ff,_0x61216e){_0x30e3ff=_0x30e3ff-0x0;var _0x58db1a=_0xe0e0[_0x30e3ff];return _0x58db1a;};'use strict';var _=require(_0x0e0e('0x0'));var util=require(_0x0e0e('0x1'));var moment=require(_0x0e0e('0x2'));var BPromise=require(_0x0e0e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e0e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e0e('0x5'));var logger=require(_0x0e0e('0x6'))(_0x0e0e('0x7'));var config=require('../../config/environment');var jayson=require(_0x0e0e('0x8'));var client=jayson[_0x0e0e('0x9')][_0x0e0e('0xa')]({'port':0x232a});config[_0x0e0e('0xb')]=_[_0x0e0e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0e0e('0xd'))(new Redis(config[_0x0e0e('0xb')]));require(_0x0e0e('0xe'))[_0x0e0e('0xf')](socket);function respondWithRpcPromise(_0xa0b120,_0x3f4d2e,_0x28d311){return new BPromise(function(_0xa0a5bf,_0x1b679e){return client[_0x0e0e('0x10')](_0xa0b120,_0x28d311)[_0x0e0e('0x11')](function(_0x3da759){logger['info']('DashboardItem,\x20%s,\x20%s',_0x3f4d2e,_0x0e0e('0x12'));logger[_0x0e0e('0x13')](_0x0e0e('0x14'),_0x3f4d2e,_0x0e0e('0x12'),JSON['stringify'](_0x3da759));if(_0x3da759['error']){if(_0x3da759['error'][_0x0e0e('0x15')]===0x1f4){logger['error'](_0x0e0e('0x16'),_0x3f4d2e,_0x3da759[_0x0e0e('0x17')][_0x0e0e('0x18')]);return _0x1b679e(_0x3da759['error']['message']);}logger[_0x0e0e('0x17')](_0x0e0e('0x16'),_0x3f4d2e,_0x3da759['error'][_0x0e0e('0x18')]);return _0xa0a5bf(_0x3da759[_0x0e0e('0x17')]['message']);}else{logger[_0x0e0e('0x19')](_0x0e0e('0x16'),_0x3f4d2e,'request\x20sent');_0xa0a5bf(_0x3da759[_0x0e0e('0x1a')][_0x0e0e('0x18')]);}})[_0x0e0e('0x1b')](function(_0x4c1177){logger[_0x0e0e('0x17')]('DashboardItem,\x20%s,\x20%s',_0x3f4d2e,_0x4c1177);_0x1b679e(_0x4c1177);});});} \ No newline at end of file +var _0x3945=['../../config/logger','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3945,0x13f));var _0x5394=function(_0xba4da3,_0x320792){_0xba4da3=_0xba4da3-0x0;var _0x211dbe=_0x3945[_0xba4da3];return _0x211dbe;};'use strict';var _=require(_0x5394('0x0'));var util=require(_0x5394('0x1'));var moment=require('moment');var BPromise=require(_0x5394('0x2'));var rs=require(_0x5394('0x3'));var fs=require('fs');var Redis=require(_0x5394('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5394('0x5'));var logger=require(_0x5394('0x6'))('rpc');var config=require(_0x5394('0x7'));var jayson=require(_0x5394('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x5394('0x9')]=_['defaults'](config[_0x5394('0x9')],{'host':_0x5394('0xa'),'port':0x18eb});var socket=require(_0x5394('0xb'))(new Redis(config[_0x5394('0x9')]));require(_0x5394('0xc'))[_0x5394('0xd')](socket);function respondWithRpcPromise(_0x6db28e,_0x399936,_0xb1c978){return new BPromise(function(_0xa36b61,_0x161585){return client[_0x5394('0xe')](_0x6db28e,_0xb1c978)['then'](function(_0x1db669){logger[_0x5394('0xf')](_0x5394('0x10'),_0x399936,_0x5394('0x11'));logger[_0x5394('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x399936,_0x5394('0x11'),JSON[_0x5394('0x13')](_0x1db669));if(_0x1db669[_0x5394('0x14')]){if(_0x1db669[_0x5394('0x14')][_0x5394('0x15')]===0x1f4){logger[_0x5394('0x14')](_0x5394('0x10'),_0x399936,_0x1db669[_0x5394('0x14')]['message']);return _0x161585(_0x1db669[_0x5394('0x14')][_0x5394('0x16')]);}logger[_0x5394('0x14')]('DashboardItem,\x20%s,\x20%s',_0x399936,_0x1db669['error'][_0x5394('0x16')]);return _0xa36b61(_0x1db669[_0x5394('0x14')][_0x5394('0x16')]);}else{logger[_0x5394('0xf')](_0x5394('0x10'),_0x399936,_0x5394('0x11'));_0xa36b61(_0x1db669[_0x5394('0x17')][_0x5394('0x16')]);}})[_0x5394('0x18')](function(_0x2da54a){logger[_0x5394('0x14')](_0x5394('0x10'),_0x399936,_0x2da54a);_0x161585(_0x2da54a);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 4910862..9707569 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 _0xcc6c=['length','dashboardItem:','emit','removeListener','register'];(function(_0x1071f7,_0x26e062){var _0x25bcdc=function(_0x2a1510){while(--_0x2a1510){_0x1071f7['push'](_0x1071f7['shift']());}};_0x25bcdc(++_0x26e062);}(_0xcc6c,0xa7));var _0xccc6=function(_0x125c09,_0x4da2af){_0x125c09=_0x125c09-0x0;var _0x99c2c2=_0xcc6c[_0x125c09];return _0x99c2c2;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save','remove','update'];function createListener(_0x50bdd9,_0x2c0b8f){return function(_0x314a6d){_0x2c0b8f[_0xccc6('0x0')](_0x50bdd9,_0x314a6d);};}function removeListener(_0x49245b,_0x4e594f){return function(){DashboardItemEvents[_0xccc6('0x1')](_0x49245b,_0x4e594f);};}exports[_0xccc6('0x2')]=function(_0x2cfa16){for(var _0x22d6f4=0x0,_0x51d7a5=events[_0xccc6('0x3')];_0x22d6f4<_0x51d7a5;_0x22d6f4++){var _0x44e8fb=events[_0x22d6f4];var _0x531265=createListener(_0xccc6('0x4')+_0x44e8fb,_0x2cfa16);DashboardItemEvents['on'](_0x44e8fb,_0x531265);}}; \ No newline at end of file +var _0x4b0d=['save','update','emit','removeListener','register','dashboardItem:','./dashboardItem.events'];(function(_0x3ee55a,_0x19aeea){var _0x581800=function(_0x636cb7){while(--_0x636cb7){_0x3ee55a['push'](_0x3ee55a['shift']());}};_0x581800(++_0x19aeea);}(_0x4b0d,0x187));var _0xd4b0=function(_0x34c6a3,_0x3e1a91){_0x34c6a3=_0x34c6a3-0x0;var _0x58fcda=_0x4b0d[_0x34c6a3];return _0x58fcda;};'use strict';var DashboardItemEvents=require(_0xd4b0('0x0'));var events=[_0xd4b0('0x1'),'remove',_0xd4b0('0x2')];function createListener(_0x4657ad,_0x13d08d){return function(_0x336296){_0x13d08d[_0xd4b0('0x3')](_0x4657ad,_0x336296);};}function removeListener(_0x127cd3,_0x600f75){return function(){DashboardItemEvents[_0xd4b0('0x4')](_0x127cd3,_0x600f75);};}exports[_0xd4b0('0x5')]=function(_0x57becf){for(var _0x6be4ac=0x0,_0x1f4547=events['length'];_0x6be4ac<_0x1f4547;_0x6be4ac++){var _0x1cdf72=events[_0x6be4ac];var _0x4f279b=createListener(_0xd4b0('0x6')+_0x1cdf72,_0x57becf);DashboardItemEvents['on'](_0x1cdf72,_0x4f279b);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 043a127..f0107d8 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 _0x175d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','update','destroy','exports'];(function(_0x4a6c9a,_0x440ef3){var _0x29fb92=function(_0xa1dfa3){while(--_0xa1dfa3){_0x4a6c9a['push'](_0x4a6c9a['shift']());}};_0x29fb92(++_0x440ef3);}(_0x175d,0xd8));var _0xd175=function(_0x5a7631,_0x16d41b){_0x5a7631=_0x5a7631-0x0;var _0x424119=_0x175d[_0x5a7631];return _0x424119;};'use strict';var multer=require(_0xd175('0x0'));var util=require(_0xd175('0x1'));var path=require(_0xd175('0x2'));var timeout=require(_0xd175('0x3'));var express=require(_0xd175('0x4'));var router=express[_0xd175('0x5')]();var fs_extra=require(_0xd175('0x6'));var auth=require(_0xd175('0x7'));var interaction=require(_0xd175('0x8'));var config=require('../../config/environment');var controller=require(_0xd175('0x9'));router['get'](_0xd175('0xa'),auth[_0xd175('0xb')](),controller[_0xd175('0xc')]);router[_0xd175('0xd')]('/',auth[_0xd175('0xb')](),controller[_0xd175('0xe')]);router['put'](_0xd175('0xa'),auth[_0xd175('0xb')](),controller[_0xd175('0xf')]);router['delete'](_0xd175('0xa'),auth[_0xd175('0xb')](),controller[_0xd175('0x10')]);module[_0xd175('0x11')]=router; \ No newline at end of file +var _0xd71d=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','/:id','delete'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd71d,0x1aa));var _0xdd71=function(_0x378720,_0xa711f1){_0x378720=_0x378720-0x0;var _0x47920a=_0xd71d[_0x378720];return _0x47920a;};'use strict';var multer=require(_0xdd71('0x0'));var util=require('util');var path=require(_0xdd71('0x1'));var timeout=require(_0xdd71('0x2'));var express=require(_0xdd71('0x3'));var router=express[_0xdd71('0x4')]();var fs_extra=require(_0xdd71('0x5'));var auth=require(_0xdd71('0x6'));var interaction=require(_0xdd71('0x7'));var config=require(_0xdd71('0x8'));var controller=require('./dashboardItem.controller');router[_0xdd71('0x9')]('/:id',auth[_0xdd71('0xa')](),controller[_0xdd71('0xb')]);router[_0xdd71('0xc')]('/',auth[_0xdd71('0xa')](),controller[_0xdd71('0xd')]);router['put'](_0xdd71('0xe'),auth[_0xdd71('0xa')](),controller['update']);router[_0xdd71('0xf')](_0xdd71('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xdd71('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index daee4c3..157059f 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 _0x4e6e=['second','first','sequelize','exports','STRING'];(function(_0x4b3e49,_0x9e566c){var _0x57e339=function(_0x1430e9){while(--_0x1430e9){_0x4b3e49['push'](_0x4b3e49['shift']());}};_0x57e339(++_0x9e566c);}(_0x4e6e,0x1b5));var _0xe4e6=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x4e6e[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0xe4e6('0x0'));module[_0xe4e6('0x1')]={'name':{'type':Sequelize[_0xe4e6('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0xe4e6('0x3'),'third'),'allowNull':![],'defaultValue':_0xe4e6('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8313=['third','first','sequelize','exports','STRING','ENUM','second'];(function(_0x42aabd,_0x217ade){var _0x2e83fb=function(_0x1508d8){while(--_0x1508d8){_0x42aabd['push'](_0x42aabd['shift']());}};_0x2e83fb(++_0x217ade);}(_0x8313,0x1bb));var _0x3831=function(_0x2f370c,_0x4225d3){_0x2f370c=_0x2f370c-0x0;var _0x2a513f=_0x8313[_0x2f370c];return _0x2a513f;};'use strict';var Sequelize=require(_0x3831('0x0'));module[_0x3831('0x1')]={'name':{'type':Sequelize[_0x3831('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x3831('0x3')]('first',_0x3831('0x4'),_0x3831('0x5')),'allowNull':![],'defaultValue':_0x3831('0x6')},'description':{'type':Sequelize[_0x3831('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 4701a5c..f92296b 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 _0xb403=['rows','catch','show','params','includeAll','include','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','Dispositions','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','type','VIRTUAL','filter','options','Disposition'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xb403,0x15e));var _0x3b40=function(_0x567ac9,_0x43b49e){_0x567ac9=_0x567ac9-0x0;var _0x101959=_0xb403[_0x567ac9];return _0x101959;};'use strict';var emlformat=require(_0x3b40('0x0'));var rimraf=require(_0x3b40('0x1'));var zipdir=require(_0x3b40('0x2'));var jsonpatch=require(_0x3b40('0x3'));var rp=require(_0x3b40('0x4'));var moment=require(_0x3b40('0x5'));var BPromise=require(_0x3b40('0x6'));var Mustache=require(_0x3b40('0x7'));var util=require(_0x3b40('0x8'));var path=require('path');var sox=require(_0x3b40('0x9'));var csv=require(_0x3b40('0xa'));var ejs=require(_0x3b40('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3b40('0xc'));var crypto=require(_0x3b40('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3b40('0xa'));var querystring=require(_0x3b40('0xe'));var Papa=require(_0x3b40('0xf'));var Redis=require(_0x3b40('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3b40('0x11'));var as=require(_0x3b40('0x12'));var hardwareService=require(_0x3b40('0x13'));var logger=require(_0x3b40('0x14'))(_0x3b40('0x15'));var utils=require(_0x3b40('0x16'));var config=require(_0x3b40('0x17'));var licenseUtil=require(_0x3b40('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x542016,_0x2e207e){_0x2e207e=_0x2e207e||0xcc;return function(_0x33a0ec){if(_0x33a0ec){return _0x542016['sendStatus'](_0x2e207e);}return _0x542016[_0x3b40('0x19')](_0x2e207e)[_0x3b40('0x1a')]();};}function respondWithResult(_0x25dd5c,_0x558bc1){_0x558bc1=_0x558bc1||0xc8;return function(_0x44ee2f){if(_0x44ee2f){return _0x25dd5c[_0x3b40('0x19')](_0x558bc1)[_0x3b40('0x1b')](_0x44ee2f);}};}function respondWithFilteredResult(_0x58a962,_0x232f8b){return function(_0x106f75){if(_0x106f75){var _0x30cc14=typeof _0x232f8b[_0x3b40('0x1c')]===_0x3b40('0x1d')&&typeof _0x232f8b['limit']===_0x3b40('0x1d');var _0x37254d=_0x106f75[_0x3b40('0x1e')];var _0x1039e2=_0x30cc14?0x0:_0x232f8b[_0x3b40('0x1c')];var _0x479cca=_0x30cc14?_0x106f75[_0x3b40('0x1e')]:_0x232f8b['offset']+_0x232f8b[_0x3b40('0x1f')];var _0x48fac4;if(_0x479cca>=_0x37254d){_0x479cca=_0x37254d;_0x48fac4=0xc8;}else{_0x48fac4=0xce;}_0x58a962['status'](_0x48fac4);return _0x58a962[_0x3b40('0x20')](_0x3b40('0x21'),_0x1039e2+'-'+_0x479cca+'/'+_0x37254d)[_0x3b40('0x1b')](_0x106f75);}return null;};}function patchUpdates(_0x11781e){return function(_0x33b509){try{jsonpatch['apply'](_0x33b509,_0x11781e,!![]);}catch(_0x1b3e66){return BPromise[_0x3b40('0x22')](_0x1b3e66);}return _0x33b509[_0x3b40('0x23')]();};}function saveUpdates(_0x426471,_0x2d9a64){return function(_0x247a9c){if(_0x247a9c){return _0x247a9c[_0x3b40('0x24')](_0x426471)[_0x3b40('0x25')](function(_0x4d7f2f){return _0x4d7f2f;});}return null;};}function removeEntity(_0xbc24cc,_0x5a7089){return function(_0x25d1e4){if(_0x25d1e4){return _0x25d1e4[_0x3b40('0x26')]()[_0x3b40('0x25')](function(){var _0x4b09d6=_0x25d1e4[_0x3b40('0x27')]({'plain':!![]});var _0x420e45=_0x3b40('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x420e45,'resourceId':_0x4b09d6['id']}})[_0x3b40('0x25')](function(){return _0x25d1e4;});})['then'](function(){_0xbc24cc[_0x3b40('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc8e6ce,_0x2ad4d6){return function(_0x675c68){if(!_0x675c68){_0xc8e6ce['sendStatus'](0x194);}return _0x675c68;};}function handleError(_0x4ec7c3,_0x279963){_0x279963=_0x279963||0x1f4;return function(_0x4da1a9){logger[_0x3b40('0x29')](_0x4da1a9[_0x3b40('0x2a')]);if(_0x4da1a9[_0x3b40('0x2b')]){delete _0x4da1a9['name'];}_0x4ec7c3[_0x3b40('0x19')](_0x279963)[_0x3b40('0x2c')](_0x4da1a9);};}exports[_0x3b40('0x2d')]=function(_0x501b71,_0x2f5568){var _0x677b0e={},_0x1f72cf={},_0xe18e65={'count':0x0,'rows':[]};var _0x5092c1=_[_0x3b40('0x2e')](db['Disposition'][_0x3b40('0x2f')],function(_0x13b512){return{'name':_0x13b512[_0x3b40('0x30')],'type':_0x13b512['type'][_0x3b40('0x31')]};});_0x1f72cf[_0x3b40('0x32')]=_[_0x3b40('0x2e')](_0x5092c1,_0x3b40('0x2b'));_0x1f72cf[_0x3b40('0x33')]=_[_0x3b40('0x34')](_0x501b71[_0x3b40('0x33')]);_0x1f72cf[_0x3b40('0x35')]=_[_0x3b40('0x36')](_0x1f72cf[_0x3b40('0x32')],_0x1f72cf[_0x3b40('0x33')]);_0x677b0e[_0x3b40('0x37')]=_[_0x3b40('0x36')](_0x1f72cf[_0x3b40('0x32')],qs['fields'](_0x501b71['query'][_0x3b40('0x38')]));_0x677b0e[_0x3b40('0x37')]=_0x677b0e[_0x3b40('0x37')][_0x3b40('0x39')]?_0x677b0e['attributes']:_0x1f72cf[_0x3b40('0x32')];if(!_0x501b71[_0x3b40('0x33')][_0x3b40('0x3a')](_0x3b40('0x3b'))){_0x677b0e['limit']=qs['limit'](_0x501b71[_0x3b40('0x33')][_0x3b40('0x1f')]);_0x677b0e['offset']=qs[_0x3b40('0x1c')](_0x501b71[_0x3b40('0x33')][_0x3b40('0x1c')]);}_0x677b0e[_0x3b40('0x3c')]=qs[_0x3b40('0x3d')](_0x501b71['query'][_0x3b40('0x3d')]);_0x677b0e['where']=qs[_0x3b40('0x35')](_[_0x3b40('0x3e')](_0x501b71[_0x3b40('0x33')],_0x1f72cf['filters']),_0x5092c1);if(_0x501b71[_0x3b40('0x33')]['filter']){_0x677b0e['where']=_[_0x3b40('0x3f')](_0x677b0e[_0x3b40('0x40')],{'$or':_[_0x3b40('0x2e')](_0x5092c1,function(_0x2a4911){if(_0x2a4911[_0x3b40('0x41')]!==_0x3b40('0x42')){var _0x5de39f={};_0x5de39f[_0x2a4911[_0x3b40('0x2b')]]={'$like':'%'+_0x501b71[_0x3b40('0x33')][_0x3b40('0x43')]+'%'};return _0x5de39f;}})});}_0x677b0e=_[_0x3b40('0x3f')]({},_0x677b0e,_0x501b71[_0x3b40('0x44')]);var _0x282749={'where':_0x677b0e['where']};return db['Disposition'][_0x3b40('0x1e')](_0x282749)[_0x3b40('0x25')](function(_0x548a04){_0xe18e65[_0x3b40('0x1e')]=_0x548a04;if(_0x501b71['query']['includeAll']){_0x677b0e['include']=[{'all':!![]}];}return db[_0x3b40('0x45')]['findAll'](_0x677b0e);})[_0x3b40('0x25')](function(_0x4f8eb8){_0xe18e65[_0x3b40('0x46')]=_0x4f8eb8;return _0xe18e65;})[_0x3b40('0x25')](respondWithFilteredResult(_0x2f5568,_0x677b0e))[_0x3b40('0x47')](handleError(_0x2f5568,null));};exports[_0x3b40('0x48')]=function(_0x5bc940,_0x4fff8f){var _0x207464={'raw':!![],'where':{'id':_0x5bc940[_0x3b40('0x49')]['id']}},_0x322801={};_0x322801['model']=_[_0x3b40('0x34')](db[_0x3b40('0x45')][_0x3b40('0x2f')]);_0x322801[_0x3b40('0x33')]=_[_0x3b40('0x34')](_0x5bc940[_0x3b40('0x33')]);_0x322801['filters']=_[_0x3b40('0x36')](_0x322801[_0x3b40('0x32')],_0x322801['query']);_0x207464[_0x3b40('0x37')]=_[_0x3b40('0x36')](_0x322801[_0x3b40('0x32')],qs[_0x3b40('0x38')](_0x5bc940[_0x3b40('0x33')][_0x3b40('0x38')]));_0x207464[_0x3b40('0x37')]=_0x207464[_0x3b40('0x37')][_0x3b40('0x39')]?_0x207464[_0x3b40('0x37')]:_0x322801[_0x3b40('0x32')];if(_0x5bc940[_0x3b40('0x33')][_0x3b40('0x4a')]){_0x207464[_0x3b40('0x4b')]=[{'all':!![]}];}_0x207464=_[_0x3b40('0x3f')]({},_0x207464,_0x5bc940[_0x3b40('0x44')]);return db['Disposition']['find'](_0x207464)[_0x3b40('0x25')](handleEntityNotFound(_0x4fff8f,null))[_0x3b40('0x25')](respondWithResult(_0x4fff8f,null))[_0x3b40('0x47')](handleError(_0x4fff8f,null));};exports[_0x3b40('0x4c')]=function(_0x564190,_0x51c158){return db[_0x3b40('0x45')][_0x3b40('0x4c')](_0x564190[_0x3b40('0x4d')],{})[_0x3b40('0x25')](function(_0x54ffde){var _0x55c8f4=_0x564190[_0x3b40('0x4e')][_0x3b40('0x27')]({'plain':!![]});if(!_0x55c8f4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55c8f4[_0x3b40('0x4f')]===_0x3b40('0x4e')){var _0x5f04ad=_0x54ffde[_0x3b40('0x27')]({'plain':!![]});var _0xc56a91='Dispositions';return db['UserProfileSection']['find']({'where':{'name':_0xc56a91,'userProfileId':_0x55c8f4[_0x3b40('0x50')]},'raw':!![]})['then'](function(_0x366bf5){if(_0x366bf5&&_0x366bf5[_0x3b40('0x51')]===0x0){return db['UserProfileResource'][_0x3b40('0x4c')]({'name':_0x5f04ad['name'],'resourceId':_0x5f04ad['id'],'type':_0x366bf5[_0x3b40('0x2b')],'sectionId':_0x366bf5['id']},{})[_0x3b40('0x25')](function(){return _0x54ffde;});}else{return _0x54ffde;}})[_0x3b40('0x47')](function(_0x7c0e4){logger[_0x3b40('0x29')](_0x3b40('0x52'),_0x7c0e4);throw _0x7c0e4;});}return _0x54ffde;})[_0x3b40('0x25')](respondWithResult(_0x51c158,0xc9))['catch'](handleError(_0x51c158,null));};exports[_0x3b40('0x24')]=function(_0x3c3758,_0x875d48){if(_0x3c3758[_0x3b40('0x4d')]['id']){delete _0x3c3758[_0x3b40('0x4d')]['id'];}return db['Disposition'][_0x3b40('0x53')]({'where':{'id':_0x3c3758['params']['id']}})[_0x3b40('0x25')](handleEntityNotFound(_0x875d48,null))['then'](saveUpdates(_0x3c3758[_0x3b40('0x4d')],null))[_0x3b40('0x25')](respondWithResult(_0x875d48,null))[_0x3b40('0x47')](handleError(_0x875d48,null));};exports['destroy']=function(_0x453b4d,_0x4e6f95){return db['Disposition']['find']({'where':{'id':_0x453b4d[_0x3b40('0x49')]['id']}})[_0x3b40('0x25')](handleEntityNotFound(_0x4e6f95,null))['then'](removeEntity(_0x4e6f95,null))[_0x3b40('0x47')](handleError(_0x4e6f95,null));}; \ No newline at end of file +var _0x4ec4=['index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','Disposition','includeAll','include','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','destroy','then','Dispositions','error','stack','name','send'];(function(_0x5dfcfb,_0x807061){var _0x250aa4=function(_0x5ebf96){while(--_0x5ebf96){_0x5dfcfb['push'](_0x5dfcfb['shift']());}};_0x250aa4(++_0x807061);}(_0x4ec4,0x125));var _0x44ec=function(_0x3478fb,_0x4bea5e){_0x3478fb=_0x3478fb-0x0;var _0x2d776f=_0x4ec4[_0x3478fb];return _0x2d776f;};'use strict';var emlformat=require(_0x44ec('0x0'));var rimraf=require(_0x44ec('0x1'));var zipdir=require(_0x44ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x44ec('0x3'));var moment=require(_0x44ec('0x4'));var BPromise=require(_0x44ec('0x5'));var Mustache=require(_0x44ec('0x6'));var util=require(_0x44ec('0x7'));var path=require(_0x44ec('0x8'));var sox=require('sox');var csv=require(_0x44ec('0x9'));var ejs=require(_0x44ec('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x44ec('0xb'));var squel=require(_0x44ec('0xc'));var crypto=require(_0x44ec('0xd'));var jsforce=require(_0x44ec('0xe'));var deskjs=require(_0x44ec('0xf'));var toCsv=require(_0x44ec('0x9'));var querystring=require(_0x44ec('0x10'));var Papa=require('papaparse');var Redis=require(_0x44ec('0x11'));var authService=require(_0x44ec('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x44ec('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x44ec('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x44ec('0x15'));var licenseUtil=require(_0x44ec('0x16'));var db=require(_0x44ec('0x17'))['db'];function respondWithStatusCode(_0x37ef19,_0x4cdf0c){_0x4cdf0c=_0x4cdf0c||0xcc;return function(_0x26a6eb){if(_0x26a6eb){return _0x37ef19[_0x44ec('0x18')](_0x4cdf0c);}return _0x37ef19[_0x44ec('0x19')](_0x4cdf0c)[_0x44ec('0x1a')]();};}function respondWithResult(_0x2dbd5e,_0x3bbf64){_0x3bbf64=_0x3bbf64||0xc8;return function(_0x3ee949){if(_0x3ee949){return _0x2dbd5e[_0x44ec('0x19')](_0x3bbf64)[_0x44ec('0x1b')](_0x3ee949);}};}function respondWithFilteredResult(_0x57fb32,_0x4beca6){return function(_0x348c9d){if(_0x348c9d){var _0x22fa25=typeof _0x4beca6[_0x44ec('0x1c')]==='undefined'&&typeof _0x4beca6[_0x44ec('0x1d')]==='undefined';var _0xa65c1f=_0x348c9d[_0x44ec('0x1e')];var _0x2d6d8c=_0x22fa25?0x0:_0x4beca6[_0x44ec('0x1c')];var _0x20f0d5=_0x22fa25?_0x348c9d['count']:_0x4beca6[_0x44ec('0x1c')]+_0x4beca6['limit'];var _0x3f2565;if(_0x20f0d5>=_0xa65c1f){_0x20f0d5=_0xa65c1f;_0x3f2565=0xc8;}else{_0x3f2565=0xce;}_0x57fb32[_0x44ec('0x19')](_0x3f2565);return _0x57fb32['set'](_0x44ec('0x1f'),_0x2d6d8c+'-'+_0x20f0d5+'/'+_0xa65c1f)['json'](_0x348c9d);}return null;};}function patchUpdates(_0x20cb5e){return function(_0x52aa71){try{jsonpatch[_0x44ec('0x20')](_0x52aa71,_0x20cb5e,!![]);}catch(_0x33a98c){return BPromise[_0x44ec('0x21')](_0x33a98c);}return _0x52aa71[_0x44ec('0x22')]();};}function saveUpdates(_0x48fede,_0x1968ba){return function(_0x142f73){if(_0x142f73){return _0x142f73[_0x44ec('0x23')](_0x48fede)['then'](function(_0x23316e){return _0x23316e;});}return null;};}function removeEntity(_0x5005,_0x48be86){return function(_0x2e8a28){if(_0x2e8a28){return _0x2e8a28[_0x44ec('0x24')]()[_0x44ec('0x25')](function(){var _0x3acc81=_0x2e8a28['get']({'plain':!![]});var _0x30a812=_0x44ec('0x26');return db['UserProfileResource'][_0x44ec('0x24')]({'where':{'type':_0x30a812,'resourceId':_0x3acc81['id']}})[_0x44ec('0x25')](function(){return _0x2e8a28;});})[_0x44ec('0x25')](function(){_0x5005[_0x44ec('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384d50,_0x3fa437){return function(_0x1beb81){if(!_0x1beb81){_0x384d50[_0x44ec('0x18')](0x194);}return _0x1beb81;};}function handleError(_0x5f5805,_0x22f2c9){_0x22f2c9=_0x22f2c9||0x1f4;return function(_0x3b4ef7){logger[_0x44ec('0x27')](_0x3b4ef7[_0x44ec('0x28')]);if(_0x3b4ef7[_0x44ec('0x29')]){delete _0x3b4ef7[_0x44ec('0x29')];}_0x5f5805[_0x44ec('0x19')](_0x22f2c9)[_0x44ec('0x2a')](_0x3b4ef7);};}exports[_0x44ec('0x2b')]=function(_0xdf4c7d,_0xd8d1){var _0x5dd1c1={},_0x49a79d={},_0x570763={'count':0x0,'rows':[]};var _0xbec5f=_[_0x44ec('0x2c')](db['Disposition'][_0x44ec('0x2d')],function(_0x35aba1){return{'name':_0x35aba1[_0x44ec('0x2e')],'type':_0x35aba1[_0x44ec('0x2f')][_0x44ec('0x30')]};});_0x49a79d[_0x44ec('0x31')]=_[_0x44ec('0x2c')](_0xbec5f,'name');_0x49a79d[_0x44ec('0x32')]=_[_0x44ec('0x33')](_0xdf4c7d[_0x44ec('0x32')]);_0x49a79d['filters']=_[_0x44ec('0x34')](_0x49a79d[_0x44ec('0x31')],_0x49a79d[_0x44ec('0x32')]);_0x5dd1c1[_0x44ec('0x35')]=_[_0x44ec('0x34')](_0x49a79d[_0x44ec('0x31')],qs[_0x44ec('0x36')](_0xdf4c7d[_0x44ec('0x32')][_0x44ec('0x36')]));_0x5dd1c1['attributes']=_0x5dd1c1['attributes'][_0x44ec('0x37')]?_0x5dd1c1[_0x44ec('0x35')]:_0x49a79d[_0x44ec('0x31')];if(!_0xdf4c7d[_0x44ec('0x32')][_0x44ec('0x38')](_0x44ec('0x39'))){_0x5dd1c1[_0x44ec('0x1d')]=qs['limit'](_0xdf4c7d['query'][_0x44ec('0x1d')]);_0x5dd1c1['offset']=qs[_0x44ec('0x1c')](_0xdf4c7d[_0x44ec('0x32')]['offset']);}_0x5dd1c1['order']=qs['sort'](_0xdf4c7d[_0x44ec('0x32')][_0x44ec('0x3a')]);_0x5dd1c1[_0x44ec('0x3b')]=qs[_0x44ec('0x3c')](_[_0x44ec('0x3d')](_0xdf4c7d[_0x44ec('0x32')],_0x49a79d['filters']),_0xbec5f);if(_0xdf4c7d[_0x44ec('0x32')][_0x44ec('0x3e')]){_0x5dd1c1['where']=_[_0x44ec('0x3f')](_0x5dd1c1[_0x44ec('0x3b')],{'$or':_['map'](_0xbec5f,function(_0x4e6595){if(_0x4e6595[_0x44ec('0x2f')]!=='VIRTUAL'){var _0x1d0a92={};_0x1d0a92[_0x4e6595['name']]={'$like':'%'+_0xdf4c7d[_0x44ec('0x32')][_0x44ec('0x3e')]+'%'};return _0x1d0a92;}})});}_0x5dd1c1=_[_0x44ec('0x3f')]({},_0x5dd1c1,_0xdf4c7d[_0x44ec('0x40')]);var _0x3771d8={'where':_0x5dd1c1[_0x44ec('0x3b')]};return db[_0x44ec('0x41')]['count'](_0x3771d8)['then'](function(_0x46e845){_0x570763[_0x44ec('0x1e')]=_0x46e845;if(_0xdf4c7d[_0x44ec('0x32')][_0x44ec('0x42')]){_0x5dd1c1[_0x44ec('0x43')]=[{'all':!![]}];}return db[_0x44ec('0x41')][_0x44ec('0x44')](_0x5dd1c1);})[_0x44ec('0x25')](function(_0x5e8397){_0x570763[_0x44ec('0x45')]=_0x5e8397;return _0x570763;})['then'](respondWithFilteredResult(_0xd8d1,_0x5dd1c1))[_0x44ec('0x46')](handleError(_0xd8d1,null));};exports[_0x44ec('0x47')]=function(_0x30b93f,_0x3a566d){var _0x2ef0f0={'raw':!![],'where':{'id':_0x30b93f['params']['id']}},_0x1ed1e9={};_0x1ed1e9[_0x44ec('0x31')]=_[_0x44ec('0x33')](db[_0x44ec('0x41')][_0x44ec('0x2d')]);_0x1ed1e9[_0x44ec('0x32')]=_[_0x44ec('0x33')](_0x30b93f[_0x44ec('0x32')]);_0x1ed1e9['filters']=_[_0x44ec('0x34')](_0x1ed1e9[_0x44ec('0x31')],_0x1ed1e9[_0x44ec('0x32')]);_0x2ef0f0[_0x44ec('0x35')]=_[_0x44ec('0x34')](_0x1ed1e9[_0x44ec('0x31')],qs[_0x44ec('0x36')](_0x30b93f[_0x44ec('0x32')][_0x44ec('0x36')]));_0x2ef0f0[_0x44ec('0x35')]=_0x2ef0f0[_0x44ec('0x35')][_0x44ec('0x37')]?_0x2ef0f0[_0x44ec('0x35')]:_0x1ed1e9['model'];if(_0x30b93f[_0x44ec('0x32')][_0x44ec('0x42')]){_0x2ef0f0['include']=[{'all':!![]}];}_0x2ef0f0=_[_0x44ec('0x3f')]({},_0x2ef0f0,_0x30b93f['options']);return db['Disposition'][_0x44ec('0x48')](_0x2ef0f0)['then'](handleEntityNotFound(_0x3a566d,null))[_0x44ec('0x25')](respondWithResult(_0x3a566d,null))['catch'](handleError(_0x3a566d,null));};exports[_0x44ec('0x49')]=function(_0x1b3e10,_0x905d70){return db[_0x44ec('0x41')][_0x44ec('0x49')](_0x1b3e10[_0x44ec('0x4a')],{})[_0x44ec('0x25')](function(_0x9c7d1d){var _0x450606=_0x1b3e10[_0x44ec('0x4b')][_0x44ec('0x4c')]({'plain':!![]});if(!_0x450606)throw new Error(_0x44ec('0x4d'));if(_0x450606[_0x44ec('0x4e')]===_0x44ec('0x4b')){var _0xe3753c=_0x9c7d1d['get']({'plain':!![]});var _0x7992f0=_0x44ec('0x26');return db['UserProfileSection'][_0x44ec('0x48')]({'where':{'name':_0x7992f0,'userProfileId':_0x450606[_0x44ec('0x4f')]},'raw':!![]})[_0x44ec('0x25')](function(_0x6b27ca){if(_0x6b27ca&&_0x6b27ca[_0x44ec('0x50')]===0x0){return db[_0x44ec('0x51')]['create']({'name':_0xe3753c['name'],'resourceId':_0xe3753c['id'],'type':_0x6b27ca[_0x44ec('0x29')],'sectionId':_0x6b27ca['id']},{})[_0x44ec('0x25')](function(){return _0x9c7d1d;});}else{return _0x9c7d1d;}})[_0x44ec('0x46')](function(_0x52d675){logger[_0x44ec('0x27')](_0x44ec('0x52'),_0x52d675);throw _0x52d675;});}return _0x9c7d1d;})[_0x44ec('0x25')](respondWithResult(_0x905d70,0xc9))[_0x44ec('0x46')](handleError(_0x905d70,null));};exports['update']=function(_0x422624,_0x5cfb7c){if(_0x422624['body']['id']){delete _0x422624[_0x44ec('0x4a')]['id'];}return db[_0x44ec('0x41')][_0x44ec('0x48')]({'where':{'id':_0x422624['params']['id']}})[_0x44ec('0x25')](handleEntityNotFound(_0x5cfb7c,null))[_0x44ec('0x25')](saveUpdates(_0x422624['body'],null))[_0x44ec('0x25')](respondWithResult(_0x5cfb7c,null))[_0x44ec('0x46')](handleError(_0x5cfb7c,null));};exports[_0x44ec('0x24')]=function(_0x4d8e85,_0x52a2f2){return db[_0x44ec('0x41')][_0x44ec('0x48')]({'where':{'id':_0x4d8e85[_0x44ec('0x53')]['id']}})[_0x44ec('0x25')](handleEntityNotFound(_0x52a2f2,null))[_0x44ec('0x25')](removeEntity(_0x52a2f2,null))[_0x44ec('0x46')](handleError(_0x52a2f2,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index f440322..39f54d1 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 _0x9553=['OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','ListId','name','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel'];(function(_0x351af1,_0x2770f7){var _0x2aaafd=function(_0x149d25){while(--_0x149d25){_0x351af1['push'](_0x351af1['shift']());}};_0x2aaafd(++_0x2770f7);}(_0x9553,0x16a));var _0x3955=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9553[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x3955('0x0'));var util=require(_0x3955('0x1'));var logger=require(_0x3955('0x2'))('api');var moment=require(_0x3955('0x3'));var BPromise=require(_0x3955('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3955('0x5'));var rimraf=require(_0x3955('0x6'));var config=require(_0x3955('0x7'));var attributes=require(_0x3955('0x8'));module[_0x3955('0x9')]=function(_0x39f161,_0x44c18b){return _0x39f161[_0x3955('0xa')](_0x3955('0xb'),attributes,{'tableName':_0x3955('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x3955('0xd'),'fields':['name',_0x3955('0xe')]},{'unique':!![],'name':'name_chat','fields':[_0x3955('0xf'),'ChatWebsiteId']},{'unique':!![],'name':_0x3955('0x10'),'fields':[_0x3955('0xf'),_0x3955('0x11')]},{'unique':!![],'name':_0x3955('0x12'),'fields':[_0x3955('0xf'),_0x3955('0x13')]},{'unique':!![],'name':_0x3955('0x14'),'fields':[_0x3955('0xf'),'FaxAccountId']},{'unique':!![],'name':_0x3955('0x15'),'fields':[_0x3955('0xf'),_0x3955('0x16')]},{'unique':!![],'name':_0x3955('0x17'),'fields':[_0x3955('0xf'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x33f1=['request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','SmsAccountId','FaxAccountId','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0x33f1,0x1bc));var _0x133f=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0x33f1[_0x3b594b];return _0x1ea5f8;};'use strict';var _=require(_0x133f('0x0'));var util=require(_0x133f('0x1'));var logger=require(_0x133f('0x2'))(_0x133f('0x3'));var moment=require(_0x133f('0x4'));var BPromise=require(_0x133f('0x5'));var rp=require(_0x133f('0x6'));var fs=require('fs');var path=require(_0x133f('0x7'));var rimraf=require(_0x133f('0x8'));var config=require(_0x133f('0x9'));var attributes=require(_0x133f('0xa'));module[_0x133f('0xb')]=function(_0x822ab6,_0x1770ad){return _0x822ab6[_0x133f('0xc')](_0x133f('0xd'),attributes,{'tableName':_0x133f('0xe'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x133f('0xf'),'fields':[_0x133f('0x10'),_0x133f('0x11')]},{'unique':!![],'name':_0x133f('0x12'),'fields':['name',_0x133f('0x13')]},{'unique':!![],'name':_0x133f('0x14'),'fields':[_0x133f('0x10'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x133f('0x10'),_0x133f('0x15')]},{'unique':!![],'name':'name_fax','fields':[_0x133f('0x10'),_0x133f('0x16')]},{'unique':!![],'name':'name_openchannel','fields':[_0x133f('0x10'),_0x133f('0x17')]},{'unique':!![],'name':_0x133f('0x18'),'fields':[_0x133f('0x10'),'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 ea6e51c..c0159ef 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(_0x403333,_0x5853ed){var _0xa8df20=function(_0x4bae4d){while(--_0x4bae4d){_0x403333['push'](_0x403333['shift']());}};_0xa8df20(++_0x5853ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2f09c1,_0x3b3bac){var _0x21a8b6=function(_0x284561){while(--_0x284561){_0x2f09c1['push'](_0x2f09c1['shift']());}};_0x21a8b6(++_0x3b3bac);}(_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 diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index fdefbf5..f4017d3 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 _0x945b=['express','Router','../../components/interaction/service','./disposition.controller','isAuthenticated','index','get','/:id','show','create','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x945b,0x1b7));var _0xb945=function(_0x2d7f58,_0x4d5c28){_0x2d7f58=_0x2d7f58-0x0;var _0x174c16=_0x945b[_0x2d7f58];return _0x174c16;};'use strict';var multer=require('multer');var util=require(_0xb945('0x0'));var path=require(_0xb945('0x1'));var timeout=require(_0xb945('0x2'));var express=require(_0xb945('0x3'));var router=express[_0xb945('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb945('0x5'));var config=require('../../config/environment');var controller=require(_0xb945('0x6'));router['get']('/',auth[_0xb945('0x7')](),controller[_0xb945('0x8')]);router[_0xb945('0x9')](_0xb945('0xa'),auth['isAuthenticated'](),controller[_0xb945('0xb')]);router['post']('/',auth[_0xb945('0x7')](),controller[_0xb945('0xc')]);router['put']('/:id',auth[_0xb945('0x7')](),controller[_0xb945('0xd')]);router[_0xb945('0xe')](_0xb945('0xa'),auth[_0xb945('0x7')](),controller[_0xb945('0xf')]);module[_0xb945('0x10')]=router; \ No newline at end of file +var _0xaa2f=['Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','post','create','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x18d238,_0x13cd79){var _0x2bd175=function(_0x50e7d4){while(--_0x50e7d4){_0x18d238['push'](_0x18d238['shift']());}};_0x2bd175(++_0x13cd79);}(_0xaa2f,0x12f));var _0xfaa2=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0xaa2f[_0x3227c1];return _0x31fd48;};'use strict';var multer=require('multer');var util=require(_0xfaa2('0x0'));var path=require(_0xfaa2('0x1'));var timeout=require(_0xfaa2('0x2'));var express=require('express');var router=express[_0xfaa2('0x3')]();var fs_extra=require(_0xfaa2('0x4'));var auth=require(_0xfaa2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfaa2('0x6'));var controller=require('./disposition.controller');router['get']('/',auth[_0xfaa2('0x7')](),controller['index']);router[_0xfaa2('0x8')](_0xfaa2('0x9'),auth[_0xfaa2('0x7')](),controller[_0xfaa2('0xa')]);router[_0xfaa2('0xb')]('/',auth[_0xfaa2('0x7')](),controller[_0xfaa2('0xc')]);router[_0xfaa2('0xd')](_0xfaa2('0x9'),auth[_0xfaa2('0x7')](),controller[_0xfaa2('0xe')]);router['delete'](_0xfaa2('0x9'),auth[_0xfaa2('0x7')](),controller[_0xfaa2('0xf')]);module[_0xfaa2('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 3aebb8a..27da075 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 _0xa6b3=['7200','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','9600','12000','14400'];(function(_0x5eff2b,_0x4a8a57){var _0x258fbb=function(_0x4d4fd1){while(--_0x4d4fd1){_0x5eff2b['push'](_0x5eff2b['shift']());}};_0x258fbb(++_0x4a8a57);}(_0xa6b3,0x72));var _0x3a6b=function(_0x120a72,_0x5da063){_0x120a72=_0x120a72-0x0;var _0x395e44=_0xa6b3[_0x120a72];return _0x395e44;};'use strict';var Sequelize=require('sequelize');module[_0x3a6b('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3a6b('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0x3a6b('0x2'),'no'),'defaultValue':_0x3a6b('0x2')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x3a6b('0x3')},'localstationid':{'type':Sequelize[_0x3a6b('0x1')],'unique':_0x3a6b('0x4')},'minrate':{'type':Sequelize[_0x3a6b('0x5')](_0x3a6b('0x6'),_0x3a6b('0x7'),'7200',_0x3a6b('0x8'),_0x3a6b('0x9'),_0x3a6b('0xa')),'defaultValue':_0x3a6b('0x7')},'maxrate':{'type':Sequelize[_0x3a6b('0x5')]('2400',_0x3a6b('0x7'),_0x3a6b('0xb'),_0x3a6b('0x8'),_0x3a6b('0x9'),'14400'),'defaultValue':_0x3a6b('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x3a6b('0xc')},'gateway':{'type':Sequelize[_0x3a6b('0x1')],'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[_0x3a6b('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x3a6b('0x5')](_0x3a6b('0xe'),_0x3a6b('0xf'),_0x3a6b('0x10'),_0x3a6b('0x11')),'defaultValue':_0x3a6b('0xe')},'key':{'type':Sequelize[_0x3a6b('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3a6b('0x12')],'defaultValue':function(){return _0x3a6b('0x13');}},'notificationSound':{'type':Sequelize[_0x3a6b('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3a6b('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3a6b('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3a6b('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3a6b('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3a6b('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3a6b('0x14')],'defaultValue':![],'comment':_0x3a6b('0x15'),'set':function(_0x58808c){if(!_0x58808c)this[_0x3a6b('0x16')](_0x3a6b('0x17'),null);this[_0x3a6b('0x16')](_0x3a6b('0x18'),_0x58808c);}}}; \ No newline at end of file +var _0xc8a3=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','14400','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT'];(function(_0xf31b5e,_0x22dde2){var _0x1191ba=function(_0x4070cf){while(--_0x4070cf){_0xf31b5e['push'](_0xf31b5e['shift']());}};_0x1191ba(++_0x22dde2);}(_0xc8a3,0x185));var _0x3c8a=function(_0x466ea2,_0x2ef94b){_0x466ea2=_0x466ea2-0x0;var _0x5c6ce9=_0xc8a3[_0x466ea2];return _0x5c6ce9;};'use strict';var Sequelize=require(_0x3c8a('0x0'));module[_0x3c8a('0x1')]={'name':{'type':Sequelize[_0x3c8a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x3c8a('0x3')](_0x3c8a('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x3c8a('0x5')},'localstationid':{'type':Sequelize[_0x3c8a('0x2')],'unique':_0x3c8a('0x6')},'minrate':{'type':Sequelize[_0x3c8a('0x3')](_0x3c8a('0x7'),_0x3c8a('0x8'),'7200',_0x3c8a('0x9'),'12000',_0x3c8a('0xa')),'defaultValue':_0x3c8a('0x8')},'maxrate':{'type':Sequelize[_0x3c8a('0x3')](_0x3c8a('0x7'),_0x3c8a('0x8'),'7200','9600',_0x3c8a('0xb'),_0x3c8a('0xa')),'defaultValue':_0x3c8a('0xa')},'modem':{'type':Sequelize[_0x3c8a('0x2')],'defaultValue':_0x3c8a('0xc')},'gateway':{'type':Sequelize[_0x3c8a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x3c8a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x3c8a('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x3c8a('0x3')](_0x3c8a('0xe'),_0x3c8a('0xf'),_0x3c8a('0x10'),_0x3c8a('0x11')),'defaultValue':_0x3c8a('0xe')},'key':{'type':Sequelize[_0x3c8a('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3c8a('0x12')],'defaultValue':function(){return _0x3c8a('0x13');}},'notificationSound':{'type':Sequelize[_0x3c8a('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3c8a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3c8a('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3c8a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3c8a('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'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[_0x3c8a('0x14')],'defaultValue':![],'comment':_0x3c8a('0x15'),'set':function(_0x310861){if(!_0x310861)this[_0x3c8a('0x16')]('mandatoryDispositionPauseId',null);this[_0x3c8a('0x16')](_0x3c8a('0x17'),_0x310861);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index c18e591..f34780b 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 _0x74e7=['description','Fax\x20Extension','appdata','push','Answer','Set','localstationid','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','omit','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','Contact\x20not\x20found','filename','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','info','debug','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','sendStatus','end','json','limit','undefined','offset','count','status','set','Content-Range','apply','reject','save','update','then','FaxAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','catch','params','options','find','create','body','role','user','get','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','findOne','Disposition','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','Tags','tag','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','finally','getApplications','context','from-voip-provider','exten','app'];(function(_0x6173fc,_0x32aadf){var _0x965fbe=function(_0x50d5b3){while(--_0x50d5b3){_0x6173fc['push'](_0x6173fc['shift']());}};_0x965fbe(++_0x32aadf);}(_0x74e7,0x1c8));var _0x774e=function(_0xbfc36a,_0x448690){_0xbfc36a=_0xbfc36a-0x0;var _0x4fa25c=_0x74e7[_0xbfc36a];return _0x4fa25c;};'use strict';var emlformat=require(_0x774e('0x0'));var rimraf=require(_0x774e('0x1'));var zipdir=require(_0x774e('0x2'));var jsonpatch=require(_0x774e('0x3'));var rp=require(_0x774e('0x4'));var moment=require(_0x774e('0x5'));var BPromise=require(_0x774e('0x6'));var Mustache=require(_0x774e('0x7'));var util=require('util');var path=require(_0x774e('0x8'));var sox=require('sox');var csv=require(_0x774e('0x9'));var ejs=require(_0x774e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x774e('0xb'));var crypto=require('crypto');var jsforce=require(_0x774e('0xc'));var deskjs=require(_0x774e('0xd'));var toCsv=require(_0x774e('0x9'));var querystring=require(_0x774e('0xe'));var Papa=require(_0x774e('0xf'));var Redis=require(_0x774e('0x10'));var authService=require(_0x774e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x774e('0x12'));var hardwareService=require(_0x774e('0x13'));var logger=require(_0x774e('0x14'))('api');var utils=require(_0x774e('0x15'));var config=require(_0x774e('0x16'));var licenseUtil=require(_0x774e('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x774e('0x18')](config[_0x774e('0x19')],{'host':_0x774e('0x1a'),'port':0x18eb});var socket=require(_0x774e('0x1b'))(new Redis(config[_0x774e('0x19')]));require(_0x774e('0x1c'))[_0x774e('0x1d')](socket);var jayson=require(_0x774e('0x1e'));var client=jayson[_0x774e('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x774e('0x1f')][_0x774e('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2f1472,_0x3d6f6c,_0x121f5b,_0x18aa7c){return new BPromise(function(_0x2eaa03,_0x3a4ea5){var _0x5dd1f9=_0x18aa7c||client;return _0x5dd1f9[_0x774e('0x21')](_0x2f1472,_0x121f5b)['then'](function(_0x4b2acd){logger[_0x774e('0x22')]('FaxAccount,\x20%s,\x20%s',_0x3d6f6c,'request\x20sent');logger[_0x774e('0x23')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3d6f6c,_0x774e('0x24'),JSON[_0x774e('0x25')](_0x4b2acd));if(_0x4b2acd[_0x774e('0x26')]){if(_0x4b2acd[_0x774e('0x26')][_0x774e('0x27')]===0x1f4){logger[_0x774e('0x26')](_0x774e('0x28'),_0x3d6f6c,_0x4b2acd[_0x774e('0x26')][_0x774e('0x29')]);return _0x3a4ea5(_0x4b2acd[_0x774e('0x26')][_0x774e('0x29')]);}logger[_0x774e('0x26')]('FaxAccount,\x20%s,\x20%s',_0x3d6f6c,_0x4b2acd['error']['message']);return _0x2eaa03(_0x4b2acd[_0x774e('0x26')]['message']);}else{logger[_0x774e('0x22')]('FaxAccount,\x20%s,\x20%s',_0x3d6f6c,_0x774e('0x24'));_0x2eaa03(_0x4b2acd[_0x774e('0x2a')][_0x774e('0x29')]);}})['catch'](function(_0x5979e5){logger[_0x774e('0x26')]('FaxAccount,\x20%s,\x20%s',_0x3d6f6c,_0x5979e5);_0x3a4ea5(_0x5979e5);});});}function respondWithStatusCode(_0xd1441e,_0xf567b6){_0xf567b6=_0xf567b6||0xcc;return function(_0x12d046){if(_0x12d046){return _0xd1441e[_0x774e('0x2b')](_0xf567b6);}return _0xd1441e['status'](_0xf567b6)[_0x774e('0x2c')]();};}function respondWithResult(_0x179453,_0x25af08){_0x25af08=_0x25af08||0xc8;return function(_0x3dc0b9){if(_0x3dc0b9){return _0x179453['status'](_0x25af08)[_0x774e('0x2d')](_0x3dc0b9);}};}function respondWithFilteredResult(_0x3fd311,_0x477e61){return function(_0x19d574){if(_0x19d574){var _0x38d6be=typeof _0x477e61['offset']==='undefined'&&typeof _0x477e61[_0x774e('0x2e')]===_0x774e('0x2f');var _0x4e2194=_0x19d574['count'];var _0x3b9c98=_0x38d6be?0x0:_0x477e61[_0x774e('0x30')];var _0x104f80=_0x38d6be?_0x19d574[_0x774e('0x31')]:_0x477e61[_0x774e('0x30')]+_0x477e61[_0x774e('0x2e')];var _0x2bee94;if(_0x104f80>=_0x4e2194){_0x104f80=_0x4e2194;_0x2bee94=0xc8;}else{_0x2bee94=0xce;}_0x3fd311[_0x774e('0x32')](_0x2bee94);return _0x3fd311[_0x774e('0x33')](_0x774e('0x34'),_0x3b9c98+'-'+_0x104f80+'/'+_0x4e2194)[_0x774e('0x2d')](_0x19d574);}return null;};}function patchUpdates(_0x4e5753){return function(_0x51fa6d){try{jsonpatch[_0x774e('0x35')](_0x51fa6d,_0x4e5753,!![]);}catch(_0x4433a6){return BPromise[_0x774e('0x36')](_0x4433a6);}return _0x51fa6d[_0x774e('0x37')]();};}function saveUpdates(_0x4b8f63,_0x5ba794){return function(_0x4f03fa){if(_0x4f03fa){return _0x4f03fa[_0x774e('0x38')](_0x4b8f63)[_0x774e('0x39')](function(_0x25be63){return _0x25be63;});}return null;};}function removeEntity(_0xd1ec8d,_0x2fd22f){return function(_0x4d0ccc){if(_0x4d0ccc){return _0x4d0ccc['destroy']()['then'](function(){var _0x24cc3e=_0x4d0ccc['get']({'plain':!![]});var _0xec73bb=_0x774e('0x3a');return db[_0x774e('0x3b')][_0x774e('0x3c')]({'where':{'type':_0xec73bb,'resourceId':_0x24cc3e['id']}})[_0x774e('0x39')](function(){return _0x4d0ccc;});})[_0x774e('0x39')](function(){_0xd1ec8d[_0x774e('0x32')](0xcc)[_0x774e('0x2c')]();});}};}function handleEntityNotFound(_0x4d8f4c,_0x1ac5c7){return function(_0x4925e9){if(!_0x4925e9){_0x4d8f4c[_0x774e('0x2b')](0x194);}return _0x4925e9;};}function handleError(_0x3987b3,_0x43271e){_0x43271e=_0x43271e||0x1f4;return function(_0x32f55c){logger[_0x774e('0x26')](_0x32f55c[_0x774e('0x3d')]);if(_0x32f55c[_0x774e('0x3e')]){delete _0x32f55c[_0x774e('0x3e')];}_0x3987b3[_0x774e('0x32')](_0x43271e)[_0x774e('0x3f')](_0x32f55c);};}exports[_0x774e('0x40')]=function(_0x224cb8,_0x57729d){var _0x57367e={'include':[{'model':db[_0x774e('0x41')],'as':_0x774e('0x42')}]},_0x1ffb63={},_0x396432={'count':0x0,'rows':[]};var _0x2bf59c=_[_0x774e('0x43')](db[_0x774e('0x44')][_0x774e('0x45')],function(_0x2c05f0){return{'name':_0x2c05f0[_0x774e('0x46')],'type':_0x2c05f0[_0x774e('0x47')][_0x774e('0x48')]};});_0x1ffb63['model']=_[_0x774e('0x43')](_0x2bf59c,_0x774e('0x3e'));_0x1ffb63[_0x774e('0x49')]=_[_0x774e('0x4a')](_0x224cb8[_0x774e('0x49')]);_0x1ffb63[_0x774e('0x4b')]=_[_0x774e('0x4c')](_0x1ffb63[_0x774e('0x4d')],_0x1ffb63[_0x774e('0x49')]);_0x57367e[_0x774e('0x4e')]=_[_0x774e('0x4c')](_0x1ffb63[_0x774e('0x4d')],qs[_0x774e('0x4f')](_0x224cb8[_0x774e('0x49')][_0x774e('0x4f')]));_0x57367e[_0x774e('0x4e')]=_0x57367e[_0x774e('0x4e')][_0x774e('0x50')]?_0x57367e[_0x774e('0x4e')]:_0x1ffb63[_0x774e('0x4d')];if(!_0x224cb8['query'][_0x774e('0x51')](_0x774e('0x52'))){_0x57367e[_0x774e('0x2e')]=qs['limit'](_0x224cb8[_0x774e('0x49')][_0x774e('0x2e')]);_0x57367e[_0x774e('0x30')]=qs[_0x774e('0x30')](_0x224cb8[_0x774e('0x49')]['offset']);}_0x57367e[_0x774e('0x53')]=qs[_0x774e('0x54')](_0x224cb8['query'][_0x774e('0x54')]);_0x57367e['where']=qs[_0x774e('0x4b')](_[_0x774e('0x55')](_0x224cb8['query'],_0x1ffb63['filters']),_0x2bf59c);if(_0x224cb8['query'][_0x774e('0x56')]){_0x57367e[_0x774e('0x57')]=_[_0x774e('0x58')](_0x57367e[_0x774e('0x57')],{'$or':_[_0x774e('0x43')](_0x2bf59c,function(_0x2fe503){if(_0x2fe503[_0x774e('0x47')]!=='VIRTUAL'){var _0x7e9fb9={};_0x7e9fb9[_0x2fe503[_0x774e('0x3e')]]={'$like':'%'+_0x224cb8[_0x774e('0x49')]['filter']+'%'};return _0x7e9fb9;}})});}_0x57367e=_[_0x774e('0x58')]({},_0x57367e,_0x224cb8['options']);var _0x4239b4={'where':_0x57367e[_0x774e('0x57')]};return db[_0x774e('0x44')][_0x774e('0x31')](_0x4239b4)['then'](function(_0x121fb6){_0x396432[_0x774e('0x31')]=_0x121fb6;if(_0x224cb8[_0x774e('0x49')][_0x774e('0x59')]){_0x57367e[_0x774e('0x5a')]=[{'all':!![]}];}return db[_0x774e('0x44')][_0x774e('0x5b')](_0x57367e);})['then'](function(_0x3a06c0){_0x396432['rows']=_0x3a06c0;return _0x396432;})['then'](respondWithFilteredResult(_0x57729d,_0x57367e))[_0x774e('0x5c')](handleError(_0x57729d,null));};exports['show']=function(_0xd2ab82,_0x3b8157){var _0x479291={'raw':![],'where':{'id':_0xd2ab82[_0x774e('0x5d')]['id']},'include':[{'model':db[_0x774e('0x41')],'as':_0x774e('0x42')}]},_0x132857={};_0x132857[_0x774e('0x4d')]=_[_0x774e('0x4a')](db[_0x774e('0x44')]['rawAttributes']);_0x132857[_0x774e('0x49')]=_['keys'](_0xd2ab82[_0x774e('0x49')]);_0x132857[_0x774e('0x4b')]=_[_0x774e('0x4c')](_0x132857['model'],_0x132857[_0x774e('0x49')]);_0x479291[_0x774e('0x4e')]=_['intersection'](_0x132857[_0x774e('0x4d')],qs['fields'](_0xd2ab82['query'][_0x774e('0x4f')]));_0x479291[_0x774e('0x4e')]=_0x479291[_0x774e('0x4e')]['length']?_0x479291[_0x774e('0x4e')]:_0x132857[_0x774e('0x4d')];if(_0xd2ab82['query'][_0x774e('0x59')]){_0x479291[_0x774e('0x5a')]=[{'all':!![]}];}_0x479291=_[_0x774e('0x58')]({},_0x479291,_0xd2ab82[_0x774e('0x5e')]);return db[_0x774e('0x44')][_0x774e('0x5f')](_0x479291)[_0x774e('0x39')](handleEntityNotFound(_0x3b8157,null))[_0x774e('0x39')](respondWithResult(_0x3b8157,null))[_0x774e('0x5c')](handleError(_0x3b8157,null));};exports[_0x774e('0x60')]=function(_0x363fd9,_0x1f11f5){return db['FaxAccount'][_0x774e('0x60')](_0x363fd9[_0x774e('0x61')],{})[_0x774e('0x39')](function(_0x22b127){var _0x519d96=_0x363fd9['user']['get']({'plain':!![]});if(!_0x519d96)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x519d96[_0x774e('0x62')]===_0x774e('0x63')){var _0x50aabc=_0x22b127[_0x774e('0x64')]({'plain':!![]});var _0x1d256e=_0x774e('0x3a');return db['UserProfileSection'][_0x774e('0x5f')]({'where':{'name':_0x1d256e,'userProfileId':_0x519d96[_0x774e('0x65')]},'raw':!![]})[_0x774e('0x39')](function(_0x476e59){if(_0x476e59&&_0x476e59['autoAssociation']===0x0){return db[_0x774e('0x3b')][_0x774e('0x60')]({'name':_0x50aabc[_0x774e('0x3e')],'resourceId':_0x50aabc['id'],'type':_0x476e59[_0x774e('0x3e')],'sectionId':_0x476e59['id']},{})['then'](function(){return _0x22b127;});}else{return _0x22b127;}})[_0x774e('0x5c')](function(_0x1f2e0e){logger[_0x774e('0x26')](_0x774e('0x66'),_0x1f2e0e);throw _0x1f2e0e;});}return _0x22b127;})[_0x774e('0x39')](respondWithResult(_0x1f11f5,0xc9))[_0x774e('0x5c')](handleError(_0x1f11f5,null));};exports[_0x774e('0x38')]=function(_0xb62c29,_0x1e8e74){if(_0xb62c29[_0x774e('0x61')]['id']){delete _0xb62c29[_0x774e('0x61')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0xb62c29[_0x774e('0x5d')]['id']},'include':[{'model':db[_0x774e('0x41')],'as':_0x774e('0x42')}]})['then'](handleEntityNotFound(_0x1e8e74,null))['then'](saveUpdates(_0xb62c29['body'],null))[_0x774e('0x39')](respondWithResult(_0x1e8e74,null))[_0x774e('0x5c')](handleError(_0x1e8e74,null));};exports[_0x774e('0x3c')]=function(_0x2d48c2,_0x1dce85){return db[_0x774e('0x44')][_0x774e('0x5f')]({'where':{'id':_0x2d48c2['params']['id']}})['then'](handleEntityNotFound(_0x1dce85,null))[_0x774e('0x39')](removeEntity(_0x1dce85,null))[_0x774e('0x5c')](handleError(_0x1dce85,null));};exports['describe']=function(_0x297e14,_0x5ef97e){return db['FaxAccount'][_0x774e('0x67')]()[_0x774e('0x39')](respondWithResult(_0x5ef97e,null))[_0x774e('0x5c')](handleError(_0x5ef97e,null));};exports[_0x774e('0x68')]=function(_0xae8e07,_0x221da9,_0x9485d7){if(_0xae8e07[_0x774e('0x61')]['id']){delete _0xae8e07['body']['id'];}return db[_0x774e('0x44')][_0x774e('0x5f')]({'where':{'id':_0xae8e07[_0x774e('0x5d')]['id']}})[_0x774e('0x39')](handleEntityNotFound(_0x221da9,null))['then'](function(_0x4b01fd){if(_0x4b01fd){_0xae8e07['body'][_0x774e('0x69')]=_0x4b01fd['id'];return db['Disposition'][_0x774e('0x60')](_0xae8e07[_0x774e('0x61')]);}})['then'](respondWithResult(_0x221da9,null))[_0x774e('0x5c')](handleError(_0x221da9,null));};exports['getDispositions']=function(_0x2c8295,_0x458385,_0x23f4b9){var _0x3ef1fb={'raw':![],'where':{}};var _0x491fb0={};var _0x4a4e1b={'count':0x0,'rows':[]};return db[_0x774e('0x44')][_0x774e('0x6a')]({'where':{'id':_0x2c8295[_0x774e('0x5d')]['id']}})[_0x774e('0x39')](handleEntityNotFound(_0x458385,null))[_0x774e('0x39')](function(_0x36d355){if(_0x36d355){_0x491fb0[_0x774e('0x4d')]=_[_0x774e('0x4a')](db[_0x774e('0x6b')]['rawAttributes']);_0x491fb0[_0x774e('0x49')]=_[_0x774e('0x4a')](_0x2c8295[_0x774e('0x49')]);_0x491fb0[_0x774e('0x4b')]=_['intersection'](_0x491fb0[_0x774e('0x4d')],_0x491fb0[_0x774e('0x49')]);_0x3ef1fb[_0x774e('0x4e')]=_[_0x774e('0x4c')](_0x491fb0[_0x774e('0x4d')],qs[_0x774e('0x4f')](_0x2c8295[_0x774e('0x49')][_0x774e('0x4f')]));_0x3ef1fb[_0x774e('0x4e')]=_0x3ef1fb[_0x774e('0x4e')][_0x774e('0x50')]?_0x3ef1fb[_0x774e('0x4e')]:_0x491fb0[_0x774e('0x4d')];if(!_0x2c8295['query']['hasOwnProperty'](_0x774e('0x52'))){_0x3ef1fb[_0x774e('0x2e')]=qs[_0x774e('0x2e')](_0x2c8295[_0x774e('0x49')][_0x774e('0x2e')]);_0x3ef1fb[_0x774e('0x30')]=qs[_0x774e('0x30')](_0x2c8295['query'][_0x774e('0x30')]);}_0x3ef1fb['order']=qs[_0x774e('0x54')](_0x2c8295[_0x774e('0x49')][_0x774e('0x54')]);_0x3ef1fb['where']=qs[_0x774e('0x4b')](_['pick'](_0x2c8295['query'],_0x491fb0[_0x774e('0x4b')]));_0x3ef1fb[_0x774e('0x57')][_0x774e('0x69')]=_0x36d355['id'];if(_0x2c8295['query'][_0x774e('0x56')]){_0x3ef1fb['where']=_['merge'](_0x3ef1fb[_0x774e('0x57')],{'$or':_[_0x774e('0x43')](_0x3ef1fb[_0x774e('0x4e')],function(_0x37a9b0){var _0xea4c52={};_0xea4c52[_0x37a9b0]={'$like':'%'+_0x2c8295[_0x774e('0x49')]['filter']+'%'};return _0xea4c52;})});}_0x3ef1fb=_[_0x774e('0x58')]({},_0x3ef1fb,_0x2c8295[_0x774e('0x5e')]);return db['Disposition'][_0x774e('0x31')]({'where':_0x3ef1fb[_0x774e('0x57')]})[_0x774e('0x39')](function(_0x27f799){_0x4a4e1b[_0x774e('0x31')]=_0x27f799;if(_0x2c8295['query']['includeAll']){_0x3ef1fb[_0x774e('0x5a')]=[{'all':!![]}];}return db[_0x774e('0x6b')][_0x774e('0x5b')](_0x3ef1fb);})[_0x774e('0x39')](function(_0x1c97e9){_0x4a4e1b[_0x774e('0x6c')]=_0x1c97e9;return _0x4a4e1b;});}})[_0x774e('0x39')](respondWithFilteredResult(_0x458385,_0x3ef1fb))[_0x774e('0x5c')](handleError(_0x458385,null));};exports['removeDispositions']=function(_0x2d4561,_0x40b3e3,_0x5a1926){return db[_0x774e('0x44')][_0x774e('0x5f')]({'where':{'id':_0x2d4561[_0x774e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x40b3e3,null))[_0x774e('0x39')](function(_0x4e603a){if(_0x4e603a){return _0x4e603a[_0x774e('0x6d')](_0x2d4561[_0x774e('0x49')][_0x774e('0x6e')]);}})[_0x774e('0x39')](respondWithStatusCode(_0x40b3e3,null))[_0x774e('0x5c')](handleError(_0x40b3e3,null));};exports['addAnswer']=function(_0x5051fe,_0x25df2e,_0x41ce16){if(_0x5051fe['body']['id']){delete _0x5051fe[_0x774e('0x61')]['id'];}return db[_0x774e('0x44')][_0x774e('0x5f')]({'where':{'id':_0x5051fe[_0x774e('0x5d')]['id']}})[_0x774e('0x39')](handleEntityNotFound(_0x25df2e,null))[_0x774e('0x39')](function(_0xa8453f){if(_0xa8453f){_0x5051fe[_0x774e('0x61')][_0x774e('0x69')]=_0xa8453f['id'];return db[_0x774e('0x6f')][_0x774e('0x60')](_0x5051fe[_0x774e('0x61')]);}})[_0x774e('0x39')](respondWithResult(_0x25df2e,null))['catch'](handleError(_0x25df2e,null));};exports[_0x774e('0x70')]=function(_0x59ca71,_0x3d2c48,_0x1f1c97){var _0x1f381a={'raw':![],'where':{}};var _0x2ba6fc={};var _0x4ca375={'count':0x0,'rows':[]};return db[_0x774e('0x44')][_0x774e('0x6a')]({'where':{'id':_0x59ca71['params']['id']}})['then'](handleEntityNotFound(_0x3d2c48,null))[_0x774e('0x39')](function(_0x47384d){if(_0x47384d){_0x2ba6fc['model']=_[_0x774e('0x4a')](db[_0x774e('0x6f')][_0x774e('0x45')]);_0x2ba6fc[_0x774e('0x49')]=_[_0x774e('0x4a')](_0x59ca71[_0x774e('0x49')]);_0x2ba6fc[_0x774e('0x4b')]=_[_0x774e('0x4c')](_0x2ba6fc[_0x774e('0x4d')],_0x2ba6fc[_0x774e('0x49')]);_0x1f381a[_0x774e('0x4e')]=_[_0x774e('0x4c')](_0x2ba6fc[_0x774e('0x4d')],qs[_0x774e('0x4f')](_0x59ca71['query']['fields']));_0x1f381a[_0x774e('0x4e')]=_0x1f381a['attributes'][_0x774e('0x50')]?_0x1f381a[_0x774e('0x4e')]:_0x2ba6fc[_0x774e('0x4d')];if(!_0x59ca71[_0x774e('0x49')]['hasOwnProperty'](_0x774e('0x52'))){_0x1f381a[_0x774e('0x2e')]=qs[_0x774e('0x2e')](_0x59ca71['query']['limit']);_0x1f381a['offset']=qs[_0x774e('0x30')](_0x59ca71['query']['offset']);}_0x1f381a[_0x774e('0x53')]=qs[_0x774e('0x54')](_0x59ca71[_0x774e('0x49')]['sort']);_0x1f381a[_0x774e('0x57')]=qs['filters'](_[_0x774e('0x55')](_0x59ca71[_0x774e('0x49')],_0x2ba6fc[_0x774e('0x4b')]));_0x1f381a[_0x774e('0x57')][_0x774e('0x69')]=_0x47384d['id'];if(_0x59ca71['query'][_0x774e('0x56')]){_0x1f381a[_0x774e('0x57')]=_['merge'](_0x1f381a[_0x774e('0x57')],{'$or':_[_0x774e('0x43')](_0x1f381a[_0x774e('0x4e')],function(_0x16d9cf){var _0x477aff={};_0x477aff[_0x16d9cf]={'$like':'%'+_0x59ca71['query'][_0x774e('0x56')]+'%'};return _0x477aff;})});}_0x1f381a=_[_0x774e('0x58')]({},_0x1f381a,_0x59ca71['options']);return db['CannedAnswer']['count']({'where':_0x1f381a[_0x774e('0x57')]})[_0x774e('0x39')](function(_0x4323a9){_0x4ca375[_0x774e('0x31')]=_0x4323a9;if(_0x59ca71[_0x774e('0x49')][_0x774e('0x59')]){_0x1f381a[_0x774e('0x5a')]=[{'all':!![]}];}return db[_0x774e('0x6f')][_0x774e('0x5b')](_0x1f381a);})[_0x774e('0x39')](function(_0x3bd8b2){_0x4ca375[_0x774e('0x6c')]=_0x3bd8b2;return _0x4ca375;});}})[_0x774e('0x39')](respondWithFilteredResult(_0x3d2c48,_0x1f381a))[_0x774e('0x5c')](handleError(_0x3d2c48,null));};exports[_0x774e('0x71')]=function(_0x3125b3,_0x34a097,_0x23bab7){return db[_0x774e('0x44')]['find']({'where':{'id':_0x3125b3['params']['id']}})['then'](handleEntityNotFound(_0x34a097,null))['then'](function(_0x1f8429){if(_0x1f8429){return _0x1f8429['removeAnswers'](_0x3125b3[_0x774e('0x49')][_0x774e('0x6e')]);}})[_0x774e('0x39')](respondWithStatusCode(_0x34a097,null))[_0x774e('0x5c')](handleError(_0x34a097,null));};exports[_0x774e('0x72')]=function(_0x2d0565,_0x5d341b,_0x1a564e){return db[_0x774e('0x73')][_0x774e('0x5f')]({'where':{'id':_0x2d0565[_0x774e('0x5d')]['id']}})[_0x774e('0x39')](handleEntityNotFound(_0x5d341b,null))[_0x774e('0x39')](function(_0x2635c3){if(_0x2635c3){return _0x2635c3[_0x774e('0x72')](_0x2d0565[_0x774e('0x61')][_0x774e('0x6e')],_['omit'](_0x2d0565['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x5d341b,null))['catch'](handleError(_0x5d341b,null));};exports[_0x774e('0x74')]=function(_0x2cbb6c,_0x45e760,_0xd95a1c){var _0x1286e9={'raw':![],'where':{}};var _0x56a148={};var _0x5023ad={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x2cbb6c[_0x774e('0x5d')]['id']}})[_0x774e('0x39')](handleEntityNotFound(_0x45e760,null))[_0x774e('0x39')](function(_0xb24438){if(_0xb24438){_0x56a148[_0x774e('0x4d')]=_[_0x774e('0x4a')](db['FaxInteraction']['rawAttributes']);_0x56a148[_0x774e('0x49')]=_['keys'](_0x2cbb6c['query']);_0x56a148[_0x774e('0x4b')]=_[_0x774e('0x4c')](_0x56a148[_0x774e('0x4d')],_0x56a148[_0x774e('0x49')]);_0x1286e9[_0x774e('0x4e')]=_[_0x774e('0x4c')](_0x56a148['model'],qs['fields'](_0x2cbb6c[_0x774e('0x49')][_0x774e('0x4f')]));_0x1286e9[_0x774e('0x4e')]=_0x1286e9[_0x774e('0x4e')][_0x774e('0x50')]?_0x1286e9[_0x774e('0x4e')]:_0x56a148[_0x774e('0x4d')];if(!_0x2cbb6c['query'][_0x774e('0x51')](_0x774e('0x52'))){_0x1286e9[_0x774e('0x2e')]=qs[_0x774e('0x2e')](_0x2cbb6c[_0x774e('0x49')]['limit']);_0x1286e9[_0x774e('0x30')]=qs[_0x774e('0x30')](_0x2cbb6c[_0x774e('0x49')][_0x774e('0x30')]);}_0x1286e9[_0x774e('0x53')]=qs['sort'](_0x2cbb6c[_0x774e('0x49')][_0x774e('0x54')]);_0x1286e9['where']=qs['filters'](_[_0x774e('0x55')](_0x2cbb6c[_0x774e('0x49')],_0x56a148[_0x774e('0x4b')]));_0x1286e9[_0x774e('0x57')][_0x774e('0x69')]=_0xb24438['id'];if(_0x2cbb6c['query'][_0x774e('0x56')]){_0x1286e9[_0x774e('0x57')]=_[_0x774e('0x58')](_0x1286e9[_0x774e('0x57')],{'$or':_['map'](_0x1286e9[_0x774e('0x4e')],function(_0x226ba0){var _0x56f6fb={};_0x56f6fb[_0x226ba0]={'$like':'%'+_0x2cbb6c[_0x774e('0x49')][_0x774e('0x56')]+'%'};return _0x56f6fb;})});}_0x1286e9=_['merge']({},_0x1286e9,_0x2cbb6c[_0x774e('0x5e')]);return db['FaxInteraction'][_0x774e('0x31')]({'where':_0x1286e9[_0x774e('0x57')]})[_0x774e('0x39')](function(_0x5bab77){_0x5023ad[_0x774e('0x31')]=_0x5bab77;if(_0x2cbb6c[_0x774e('0x49')][_0x774e('0x59')]){_0x1286e9[_0x774e('0x5a')]=[{'model':db[_0x774e('0x75')],'as':_0x774e('0x76'),'required':![]},{'model':db[_0x774e('0x77')],'as':_0x774e('0x78'),'attributes':[_0x774e('0x3e'),_0x774e('0x79'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x774e('0x7a'),'attributes':['id','name','color'],'where':_0x2cbb6c[_0x774e('0x49')][_0x774e('0x7b')]?{'id':_0x2cbb6c[_0x774e('0x49')][_0x774e('0x7b')]}:undefined,'required':_0x2cbb6c['query'][_0x774e('0x7b')]?!![]:![]}];}return db[_0x774e('0x73')][_0x774e('0x5b')](_0x1286e9);})[_0x774e('0x39')](function(_0xf72b02){_0x5023ad[_0x774e('0x6c')]=_0xf72b02;return _0x5023ad;});}})[_0x774e('0x39')](respondWithFilteredResult(_0x45e760,_0x1286e9))['catch'](handleError(_0x45e760,null));};exports[_0x774e('0x7c')]=function(_0x291f50,_0x4b98d5){var _0x359a0e=_0x291f50['params']['id'];var _0x330ab6=_0x291f50['body'];var _0x2640bd=0xc8;var _0x4dd3bd=null;return db['sequelize'][_0x774e('0x7d')]({'isolationLevel':db[_0x774e('0x7e')]['Transaction'][_0x774e('0x7f')][_0x774e('0x80')]},function(_0x524d0b){return db[_0x774e('0x44')][_0x774e('0x6a')]({'where':{'id':_0x359a0e},'transaction':_0x524d0b})[_0x774e('0x39')](function(_0x902d9a){if(_0x902d9a){return db[_0x774e('0x81')][_0x774e('0x3c')]({'where':{'FaxAccountId':_0x359a0e},'transaction':_0x524d0b})[_0x774e('0x39')](function(){var _0x5c70a0=_[_0x774e('0x43')](_0x330ab6,function(_0x490448){_0x490448[_0x774e('0x69')]=_0x359a0e;return _0x490448;});return db[_0x774e('0x81')][_0x774e('0x82')](_0x5c70a0,{'transaction':_0x524d0b});});}else{_0x2640bd=0x194;_0x4dd3bd=[];}});})['then'](function(){if(_0x2640bd!==0x194){return db[_0x774e('0x81')][_0x774e('0x83')]({'where':{'FaxAccountId':_0x359a0e},'order':'priority'})[_0x774e('0x39')](function(_0xc55a66){_0x4dd3bd=_0xc55a66;});}})[_0x774e('0x5c')](function(_0x26e984){_0x2640bd=0x1f4;logger['error'](_0x26e984[_0x774e('0x3d')]);if(_0x26e984[_0x774e('0x3e')]){delete _0x26e984[_0x774e('0x3e')];}_0x4dd3bd=_0x26e984;})[_0x774e('0x84')](function(){if(_0x4dd3bd===null){_0x4b98d5[_0x774e('0x2b')](_0x2640bd);}else{if(_0x2640bd===0x1f4){_0x4b98d5[_0x774e('0x32')](_0x2640bd)[_0x774e('0x3f')](_0x4dd3bd);}else{_0x4b98d5[_0x774e('0x32')](_0x2640bd)['json'](_0x4dd3bd);}}});};exports[_0x774e('0x85')]=function(_0x4eb957,_0x5365a8,_0x4fce7e){var _0x2264de={};var _0x16e84c={};var _0x45e954;var _0x37711d;return db['FaxAccount'][_0x774e('0x6a')]({'where':{'id':_0x4eb957[_0x774e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5365a8,null))[_0x774e('0x39')](function(_0x12df22){if(_0x12df22){_0x45e954=_0x12df22;_0x16e84c[_0x774e('0x4d')]=_[_0x774e('0x4a')](db[_0x774e('0x81')]['rawAttributes']);_0x16e84c['query']=_[_0x774e('0x4a')](_0x4eb957[_0x774e('0x49')]);_0x16e84c[_0x774e('0x4b')]=_['intersection'](_0x16e84c[_0x774e('0x4d')],_0x16e84c[_0x774e('0x49')]);_0x2264de[_0x774e('0x4e')]=_['intersection'](_0x16e84c[_0x774e('0x4d')],qs[_0x774e('0x4f')](_0x4eb957[_0x774e('0x49')]['fields']));_0x2264de[_0x774e('0x4e')]=_0x2264de[_0x774e('0x4e')][_0x774e('0x50')]?_0x2264de[_0x774e('0x4e')]:_0x16e84c[_0x774e('0x4d')];_0x2264de['order']=qs[_0x774e('0x54')](_0x4eb957['query'][_0x774e('0x54')]);_0x2264de[_0x774e('0x57')]=qs[_0x774e('0x4b')](_[_0x774e('0x55')](_0x4eb957['query'],_0x16e84c[_0x774e('0x4b')]));if(_0x4eb957[_0x774e('0x49')][_0x774e('0x56')]){_0x2264de[_0x774e('0x57')]=_['merge'](_0x2264de['where'],{'$or':_['map'](_0x2264de[_0x774e('0x4e')],function(_0x49cf95){var _0x19bf9f={};_0x19bf9f[_0x49cf95]={'$like':'%'+_0x4eb957[_0x774e('0x49')]['filter']+'%'};return _0x19bf9f;})});}_0x2264de=_[_0x774e('0x58')]({},_0x2264de,_0x4eb957[_0x774e('0x5e')]);return _0x45e954[_0x774e('0x85')](_0x2264de);}})['then'](function(_0x478bd6){if(_0x478bd6){_0x37711d=_0x478bd6[_0x774e('0x50')];if(!_0x4eb957[_0x774e('0x49')][_0x774e('0x51')]('nolimit')){_0x2264de[_0x774e('0x2e')]=qs[_0x774e('0x2e')](_0x4eb957[_0x774e('0x49')][_0x774e('0x2e')]);_0x2264de['offset']=qs[_0x774e('0x30')](_0x4eb957[_0x774e('0x49')][_0x774e('0x30')]);}return _0x45e954[_0x774e('0x85')](_0x2264de);}})['then'](function(_0x5b3e3d){if(_0x5b3e3d){return _0x5b3e3d?{'count':_0x37711d,'rows':_0x5b3e3d}:null;}})[_0x774e('0x39')](respondWithResult(_0x5365a8,null))[_0x774e('0x5c')](handleError(_0x5365a8,null));};function Extension(_0x3e54e5,_0x301cbd,_0x15aa19,_0xbded28){this[_0x774e('0x86')]=_0x774e('0x87');this[_0x774e('0x88')]=_0x3e54e5['localstationid'];this[_0x774e('0x89')]=_0xbded28;this[_0x774e('0x47')]='system';this[_0x774e('0x8a')]=_0x774e('0x8b');this[_0x774e('0x69')]=_0x3e54e5['id'];this['priority']=_0x301cbd;this[_0x774e('0x8c')]=_0x15aa19;}function createExtensionsReciveFax(_0x3f9e6c){var _0x3ed277=0x1;var _0x3ce7ff=[];_0x3ce7ff[_0x774e('0x8d')](new Extension(_0x3f9e6c,_0x3ed277,'',_0x774e('0x8e')));_0x3ed277+=0x1;_0x3ce7ff[_0x774e('0x8d')](new Extension(_0x3f9e6c,_0x3ed277,'CDR(type)=inbound-fax',_0x774e('0x8f')));_0x3ed277+=0x1;for(var _0x55e980 in _0x3f9e6c){if(_0x3f9e6c[_0x774e('0x51')](_0x55e980)&&(_0x55e980==='ecm'||_0x55e980===_0x774e('0x90')||_0x55e980===_0x774e('0x91')||_0x55e980===_0x774e('0x92')||_0x55e980===_0x774e('0x93')||_0x55e980===_0x774e('0x94')||_0x55e980==='minrate'||_0x55e980===_0x774e('0x95')||_0x55e980===_0x774e('0x96'))){_0x3ce7ff[_0x774e('0x8d')](new Extension(_0x3f9e6c,_0x3ed277,_0x774e('0x97')+_0x55e980+')='+_0x3f9e6c[_0x55e980],_0x774e('0x8f')));_0x3ed277+=0x1;}}_0x3ce7ff[_0x774e('0x8d')](new Extension(_0x3f9e6c,_0x3ed277,'6',_0x774e('0x98')));_0x3ed277+=0x1;_0x3ce7ff[_0x774e('0x8d')](new Extension(_0x3f9e6c,_0x3ed277,_0x774e('0x99'),_0x774e('0x9a')));_0x3ed277=0x0;return _0x3ce7ff;}exports[_0x774e('0x9b')]=function(_0x57aca5,_0x3a56e5,_0x56e92d){var _0x1f0b61;return db[_0x774e('0x7e')][_0x774e('0x7d')](function(_0x3e5511){return db[_0x774e('0x44')][_0x774e('0x60')](_0x57aca5['body'],{'transaction':_0x3e5511})[_0x774e('0x39')](function(_0x2a8bfe){_0x1f0b61=_0x2a8bfe[_0x774e('0x64')]({'plain':!![]});return db[_0x774e('0x9c')]['bulkCreate'](createExtensionsReciveFax(_0x1f0b61),{'transaction':_0x3e5511});});})['then'](function(){return _0x1f0b61;})['then'](respondWithResult(_0x3a56e5,null))['catch'](handleError(_0x3a56e5,null));};exports[_0x774e('0x9d')]=function(_0x328673,_0x1374c4,_0x156944){var _0x1c8bc0;return db[_0x774e('0x7e')]['transaction'](function(_0x404bfc){return db[_0x774e('0x44')]['update'](_0x328673[_0x774e('0x61')],{'where':{'id':_0x328673[_0x774e('0x61')]['id']},'transaction':_0x404bfc})['then'](function(_0x37ad67){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x328673[_0x774e('0x61')]['id']},'transaction':_0x404bfc})['then'](function(_0x44de2b){return db[_0x774e('0x9c')][_0x774e('0x82')](createExtensionsReciveFax(_[_0x774e('0x9e')](_0x328673[_0x774e('0x61')],['tech',_0x774e('0x48'),_0x774e('0x9f'),_0x774e('0xa0'),_0x774e('0xa1'),'ListId'])),{'transaction':_0x404bfc});});});})[_0x774e('0x39')](function(){return db[_0x774e('0x44')][_0x774e('0xa2')](_0x328673['body']['id']);})[_0x774e('0x39')](respondWithResult(_0x1374c4,null))[_0x774e('0x5c')](handleError(_0x1374c4,null));};exports[_0x774e('0xa3')]=function(_0x27b4e8,_0x46945e,_0x585b6e){var _0xa607d2={'raw':!![],'where':{}};var _0x47fd65={};var _0x2b8752={'count':0x0,'rows':[]};return db[_0x774e('0x44')][_0x774e('0x6a')]({'where':{'id':_0x27b4e8[_0x774e('0x5d')]['id']}})[_0x774e('0x39')](handleEntityNotFound(_0x46945e,null))[_0x774e('0x39')](function(_0x2f2218){if(_0x2f2218){_0x47fd65[_0x774e('0x4d')]=_[_0x774e('0x4a')](db[_0x774e('0xa4')]['rawAttributes']);_0x47fd65[_0x774e('0x49')]=_[_0x774e('0x4a')](_0x27b4e8['query']);_0x47fd65[_0x774e('0x4b')]=_[_0x774e('0x4c')](_0x47fd65['model'],_0x47fd65[_0x774e('0x49')]);_0xa607d2[_0x774e('0x4e')]=_[_0x774e('0x4c')](_0x47fd65[_0x774e('0x4d')],qs[_0x774e('0x4f')](_0x27b4e8[_0x774e('0x49')][_0x774e('0x4f')]));_0xa607d2['attributes']=_0xa607d2['attributes'][_0x774e('0x50')]?_0xa607d2[_0x774e('0x4e')]:_0x47fd65['model'];if(!_0x27b4e8['query']['hasOwnProperty'](_0x774e('0x52'))){_0xa607d2[_0x774e('0x2e')]=qs[_0x774e('0x2e')](_0x27b4e8[_0x774e('0x49')][_0x774e('0x2e')]);_0xa607d2['offset']=qs['offset'](_0x27b4e8[_0x774e('0x49')]['offset']);}_0xa607d2[_0x774e('0x53')]=qs[_0x774e('0x54')](_0x27b4e8[_0x774e('0x49')]['sort']);_0xa607d2[_0x774e('0x57')]=qs['filters'](_[_0x774e('0x55')](_0x27b4e8[_0x774e('0x49')],_0x47fd65[_0x774e('0x4b')]));_0xa607d2[_0x774e('0x57')]['FaxAccountId']=_0x2f2218['id'];if(_0x27b4e8['query']['filter']){_0xa607d2[_0x774e('0x57')]=_[_0x774e('0x58')](_0xa607d2[_0x774e('0x57')],{'$or':_[_0x774e('0x43')](_0xa607d2[_0x774e('0x4e')],function(_0x1ba219){var _0x2752b4={};_0x2752b4[_0x1ba219]={'$like':'%'+_0x27b4e8[_0x774e('0x49')]['filter']+'%'};return _0x2752b4;})});}if(_0x27b4e8['query'][_0x774e('0xa5')]){var _0xcc2c20=_0x27b4e8[_0x774e('0x49')]['$gte']['split'](',');var _0x5811de={};_0x5811de[_0xcc2c20[0x0]]={'$gte':moment(_0xcc2c20[0x1])['format'](_0x774e('0xa6'))};_0xa607d2[_0x774e('0x57')]=_['merge'](_0xa607d2[_0x774e('0x57')],_0x5811de);}_0xa607d2=_[_0x774e('0x58')]({},_0xa607d2,_0x27b4e8['options']);return db[_0x774e('0xa4')]['count']({'where':_0xa607d2[_0x774e('0x57')]})[_0x774e('0x39')](function(_0xf00bfd){_0x2b8752[_0x774e('0x31')]=_0xf00bfd;if(_0x27b4e8['query'][_0x774e('0x59')]){_0xa607d2[_0x774e('0x5a')]=[{'all':!![]}];}return db[_0x774e('0xa4')][_0x774e('0x5b')](_0xa607d2);})[_0x774e('0x39')](function(_0x404440){_0x2b8752['rows']=_0x404440;return _0x2b8752;});}})[_0x774e('0x39')](respondWithFilteredResult(_0x46945e,_0xa607d2))[_0x774e('0x5c')](handleError(_0x46945e,null));};exports[_0x774e('0x3f')]=function(_0x2745ed,_0x3d1836,_0x5b6916){var _0x343171,_0x544b1e={},_0x4788ab;if(_0x2745ed[_0x774e('0x61')]['to']){_0x4788ab=_0x2745ed[_0x774e('0x61')]['to'][0x0];}return db[_0x774e('0x44')]['find']({'where':{'id':_0x2745ed[_0x774e('0x5d')]['id']},'include':[{'model':db[_0x774e('0xa7')],'as':_0x774e('0xa8'),'include':[{'model':db[_0x774e('0x75')],'as':_0x774e('0xa9'),'where':{'fax':_0x4788ab},'limit':0x1,'order':[[_0x774e('0xa0'),_0x774e('0xaa')]]}]}]})['then'](handleEntityNotFound(_0x3d1836,null))['then'](function(_0x268633){_0x343171=_0x268633;if(_0x2745ed[_0x774e('0x61')][_0x774e('0xab')]&&_0x2745ed['body']['attachments'][_0x774e('0x50')]){for(var _0x5d9c77=0x0;_0x5d9c77<_0x2745ed[_0x774e('0x61')][_0x774e('0xab')][_0x774e('0x50')];_0x5d9c77+=0x1){_0x2745ed[_0x774e('0x61')][_0x774e('0xab')][_0x5d9c77]={'filename':_0x2745ed[_0x774e('0x61')]['attachments'][_0x5d9c77]['name'],'id':_0x2745ed['body'][_0x774e('0xab')][_0x5d9c77]['id'],'path':path[_0x774e('0xac')](config[_0x774e('0xad')],_0x774e('0xae'),_0x2745ed[_0x774e('0x61')][_0x774e('0xab')][_0x5d9c77][_0x774e('0xaf')])};}}return respondWithRpcPromise(_0x774e('0xb0'),_0x774e('0xb0'),{'FaxAccountId':_[_0x774e('0xb1')](_0x2745ed['params']['id'])?undefined:_0x2745ed[_0x774e('0x5d')]['id'],'path':_['isNil'](_0x2745ed[_0x774e('0x61')][_0x774e('0xab')][0x0][_0x774e('0x8')])?undefined:_0x2745ed[_0x774e('0x61')]['attachments'][0x0][_0x774e('0x8')],'fax':_[_0x774e('0xb1')](_0x2745ed['body']['to'][0x0])?undefined:_0x2745ed[_0x774e('0x61')]['to'][0x0]},client9002);})['then'](function(){if(_0x343171){if(_[_0x774e('0xb1')](_0x2745ed[_0x774e('0x61')]['from'])){_0x2745ed[_0x774e('0x61')][_0x774e('0xb2')]=util[_0x774e('0xb3')](_0x774e('0xb4'),_0x343171[_0x774e('0x3e')],_0x343171['fax']);}if(_0x343171[_0x774e('0xa8')]){if(_0x343171[_0x774e('0xa8')][_0x774e('0xa9')]['length']){return _0x343171[_0x774e('0xa8')]['Contacts'][0x0];}else{return db[_0x774e('0x75')][_0x774e('0x60')](_[_0x774e('0x18')](_0x2745ed['body'],{'firstName':_0x2745ed[_0x774e('0x61')]['to'][0x0],'phone':_0x2745ed[_0x774e('0x61')]['to'][0x0],'fax':_0x2745ed[_0x774e('0x61')]['to'][0x0],'ListId':_0x343171[_0x774e('0xb5')]}));}}else{throw new Error(_0x774e('0xb6'));}}else{throw new Error(_0x774e('0xb7'));}})[_0x774e('0x39')](function(_0xea483c){if(_0xea483c){return db[_0x774e('0x73')][_0x774e('0x5f')]({'where':{'ContactId':_0xea483c['id'],'closed':![],'FaxAccountId':_0x343171['id']}})['then'](function(_0x304afe){if(_0x304afe){return[_0x304afe,![]];}return db[_0x774e('0x73')]['create']({'UserId':_0x2745ed['user']['id'],'ContactId':_0xea483c['id'],'FaxAccountId':_0x343171['id'],'fax':_0x2745ed[_0x774e('0x61')]['to'][0x0],'firstMsgDirection':_0x774e('0xb8'),'Messages':[_[_0x774e('0x58')](_0x2745ed['body'],{'read':![],'body':_0x2745ed['body'][_0x774e('0xab')][0x0]['filename'],'FaxAccountId':_0x343171['id'],'UserId':_0x2745ed[_0x774e('0x63')]['id'],'ContactId':_0xea483c['id'],'AttachmentId':_0x2745ed[_0x774e('0x61')][_0x774e('0xab')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})['then'](function(_0x10aa50){return[_0x10aa50,!![]];});});}else{throw new Error(_0x774e('0xb9'));}})['spread'](function(_0x176a61,_0x355f10){if(_0x355f10){return _0x176a61;}return db['FaxMessage'][_0x774e('0x60')]({'direction':_0x774e('0xb8'),'read':![],'body':_0x2745ed[_0x774e('0x61')][_0x774e('0xab')][0x0][_0x774e('0xba')],'FaxAccountId':_0x343171['id'],'FaxInteractionId':_0x176a61['id'],'UserId':_0x2745ed['user']['id'],'ContactId':_0x176a61[_0x774e('0xbb')],'AttachmentId':_0x2745ed[_0x774e('0x61')]['attachments'][0x0]['id']})[_0x774e('0x39')](function(_0x37efeb){_0x176a61['dataValues']['Messages']=[];_0x176a61[_0x774e('0xbc')][_0x774e('0xbd')]['push'](_0x37efeb[_0x774e('0xbc')]);return _0x176a61;});})['then'](function(_0x41d9eb){respondWithRpcPromise(_0x774e('0xbe'),_0x774e('0xbe'),{'FaxAccountId':_[_0x774e('0xb1')](_0x2745ed[_0x774e('0x5d')]['id'])?undefined:_0x2745ed[_0x774e('0x5d')]['id'],'path':_[_0x774e('0xb1')](_0x2745ed['body'][_0x774e('0xab')][0x0][_0x774e('0x8')])?undefined:_0x2745ed[_0x774e('0x61')][_0x774e('0xab')][0x0][_0x774e('0x8')],'fax':_[_0x774e('0xb1')](_0x2745ed[_0x774e('0x61')]['to'][0x0])?undefined:_0x2745ed[_0x774e('0x61')]['to'][0x0],'AttachmentId':_0x2745ed[_0x774e('0x61')][_0x774e('0xab')][0x0]['id']},client9002)[_0x774e('0x39')](function(_0x59d924){logger['info'](_0x774e('0xbf'),_0x59d924);})[_0x774e('0x5c')](function(_0x481f53){logger['info'](_0x774e('0xbf'),_0x481f53);});return _0x41d9eb;})[_0x774e('0x39')](respondWithResult(_0x3d1836,null))[_0x774e('0x5c')](handleError(_0x3d1836,null));};exports[_0x774e('0xc0')]=function(_0x343e72,_0x2ef131,_0x460d3a){return db[_0x774e('0x44')][_0x774e('0x5f')]({'where':{'id':_0x343e72[_0x774e('0x5d')]['id']}})[_0x774e('0x39')](handleEntityNotFound(_0x2ef131,null))[_0x774e('0x39')](function(_0x38aa04){if(_0x38aa04){return _0x38aa04[_0x774e('0xc0')](_0x343e72[_0x774e('0x61')][_0x774e('0x6e')],_[_0x774e('0x9e')](_0x343e72[_0x774e('0x61')],['ids','id'])||{})[_0x774e('0xc1')](function(_0x36ee01){for(var _0x4eebf4=0x0;_0x4eebf4<_0x343e72['body'][_0x774e('0x6e')][_0x774e('0x50')];_0x4eebf4+=0x1){socket[_0x774e('0xc2')]('userFaxAccount:save',{'UserId':Number(_0x343e72['body'][_0x774e('0x6e')][_0x4eebf4]),'FaxAccountId':Number(_0x343e72[_0x774e('0x5d')]['id'])});}return _0x36ee01;});}})[_0x774e('0x39')](respondWithResult(_0x2ef131,null))[_0x774e('0x5c')](handleError(_0x2ef131,null));};exports['removeAgents']=function(_0x670607,_0x2d67cc,_0x3347b7){return db['FaxAccount']['find']({'where':{'id':_0x670607[_0x774e('0x5d')]['id']}})[_0x774e('0x39')](handleEntityNotFound(_0x2d67cc,null))[_0x774e('0x39')](function(_0x3785d4){if(_0x3785d4){return _0x3785d4[_0x774e('0xc3')](_0x670607[_0x774e('0x49')]['ids'])[_0x774e('0x39')](function(){if(_['isArray'](_0x670607[_0x774e('0x49')][_0x774e('0x6e')])){for(var _0x2a1d77=0x0;_0x2a1d77<_0x670607[_0x774e('0x49')][_0x774e('0x6e')][_0x774e('0x50')];_0x2a1d77+=0x1){socket[_0x774e('0xc2')](_0x774e('0xc4'),{'UserId':Number(_0x670607[_0x774e('0x49')]['ids'][_0x2a1d77]),'FaxAccountId':Number(_0x670607[_0x774e('0x5d')]['id'])});}}else{socket[_0x774e('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x670607['query'][_0x774e('0x6e')]),'FaxAccountId':Number(_0x670607[_0x774e('0x5d')]['id'])});}});}})[_0x774e('0x39')](respondWithStatusCode(_0x2d67cc,null))[_0x774e('0x5c')](handleError(_0x2d67cc,null));};exports['getAgents']=function(_0x1d0605,_0x2e829d,_0x467a78){var _0x7d173f={};var _0x45fb37={};var _0x1fa167;var _0x53381a;return db[_0x774e('0x44')][_0x774e('0x6a')]({'where':{'id':_0x1d0605['params']['id']}})[_0x774e('0x39')](handleEntityNotFound(_0x2e829d,null))['then'](function(_0xe3b9db){if(_0xe3b9db){_0x1fa167=_0xe3b9db;_0x45fb37[_0x774e('0x4d')]=_[_0x774e('0x4a')](db[_0x774e('0x77')][_0x774e('0x45')]);_0x45fb37[_0x774e('0x49')]=_['keys'](_0x1d0605[_0x774e('0x49')]);_0x45fb37['filters']=_[_0x774e('0x4c')](_0x45fb37[_0x774e('0x4d')],_0x45fb37[_0x774e('0x49')]);_0x7d173f['attributes']=_[_0x774e('0x4c')](_0x45fb37['model'],qs[_0x774e('0x4f')](_0x1d0605[_0x774e('0x49')][_0x774e('0x4f')]));_0x7d173f[_0x774e('0x4e')]=_0x7d173f[_0x774e('0x4e')][_0x774e('0x50')]?_0x7d173f['attributes']:_0x45fb37[_0x774e('0x4d')];_0x7d173f['order']=qs[_0x774e('0x54')](_0x1d0605[_0x774e('0x49')]['sort']);_0x7d173f['where']=qs['filters'](_['pick'](_0x1d0605[_0x774e('0x49')],_0x45fb37[_0x774e('0x4b')]));if(_0x1d0605[_0x774e('0x49')][_0x774e('0x56')]){_0x7d173f[_0x774e('0x57')]=_['merge'](_0x7d173f['where'],{'$or':_[_0x774e('0x43')](_0x7d173f[_0x774e('0x4e')],function(_0x1fa9fb){var _0x4e6621={};_0x4e6621[_0x1fa9fb]={'$like':'%'+_0x1d0605['query'][_0x774e('0x56')]+'%'};return _0x4e6621;})});}_0x7d173f=_[_0x774e('0x58')]({},_0x7d173f,_0x1d0605['options']);return _0x1fa167[_0x774e('0xc5')](_0x7d173f);}})['then'](function(_0x510443){if(_0x510443){_0x53381a=_0x510443[_0x774e('0x50')];if(!_0x1d0605[_0x774e('0x49')][_0x774e('0x51')](_0x774e('0x52'))){_0x7d173f['limit']=qs[_0x774e('0x2e')](_0x1d0605[_0x774e('0x49')]['limit']);_0x7d173f[_0x774e('0x30')]=qs[_0x774e('0x30')](_0x1d0605[_0x774e('0x49')][_0x774e('0x30')]);}return _0x1fa167['getAgents'](_0x7d173f);}})[_0x774e('0x39')](function(_0x3b320a){if(_0x3b320a){return _0x3b320a?{'count':_0x53381a,'rows':_0x3b320a}:null;}})[_0x774e('0x39')](respondWithResult(_0x2e829d,null))[_0x774e('0x5c')](handleError(_0x2e829d,null));}; \ No newline at end of file +var _0xedcc=['sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','show','params','mandatoryDispositionPause','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','rawAttributes','order','removeDispositions','ids','CannedAnswer','getAnswers','nolimit','FaxAccountId','rows','removeAnswers','addInteraction','FaxInteraction','CmContact','Contact','User','internal','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','system','appdata','push','Set','ecm','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','omit','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','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','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','UserProfileResource','sendStatus','stack','send','Pause','map','FaxAccount','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xedcc,0x78));var _0xcedc=function(_0x44c721,_0x34fc7a){_0x44c721=_0x44c721-0x0;var _0xf306aa=_0xedcc[_0x44c721];return _0xf306aa;};'use strict';var emlformat=require(_0xcedc('0x0'));var rimraf=require(_0xcedc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcedc('0x2'));var moment=require(_0xcedc('0x3'));var BPromise=require(_0xcedc('0x4'));var Mustache=require('mustache');var util=require(_0xcedc('0x5'));var path=require(_0xcedc('0x6'));var sox=require(_0xcedc('0x7'));var csv=require(_0xcedc('0x8'));var ejs=require(_0xcedc('0x9'));var fs=require('fs');var fs_extra=require(_0xcedc('0xa'));var _=require(_0xcedc('0xb'));var squel=require(_0xcedc('0xc'));var crypto=require(_0xcedc('0xd'));var jsforce=require(_0xcedc('0xe'));var deskjs=require(_0xcedc('0xf'));var toCsv=require(_0xcedc('0x8'));var querystring=require(_0xcedc('0x10'));var Papa=require('papaparse');var Redis=require(_0xcedc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcedc('0x12'));var as=require(_0xcedc('0x13'));var hardwareService=require(_0xcedc('0x14'));var logger=require(_0xcedc('0x15'))(_0xcedc('0x16'));var utils=require(_0xcedc('0x17'));var config=require(_0xcedc('0x18'));var licenseUtil=require(_0xcedc('0x19'));var db=require('../../mysqldb')['db'];config[_0xcedc('0x1a')]=_[_0xcedc('0x1b')](config['redis'],{'host':_0xcedc('0x1c'),'port':0x18eb});var socket=require(_0xcedc('0x1d'))(new Redis(config['redis']));require(_0xcedc('0x1e'))['register'](socket);var jayson=require(_0xcedc('0x1f'));var client=jayson[_0xcedc('0x20')][_0xcedc('0x21')]({'port':0x232c});var client9002=jayson[_0xcedc('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x557824,_0x272573,_0x4487c8,_0x1fade3){return new BPromise(function(_0x5a3b4f,_0x58398c){var _0x5113dd=_0x1fade3||client;return _0x5113dd['request'](_0x557824,_0x4487c8)[_0xcedc('0x22')](function(_0xfad49f){logger[_0xcedc('0x23')](_0xcedc('0x24'),_0x272573,_0xcedc('0x25'));logger[_0xcedc('0x26')](_0xcedc('0x27'),_0x272573,_0xcedc('0x25'),JSON[_0xcedc('0x28')](_0xfad49f));if(_0xfad49f['error']){if(_0xfad49f[_0xcedc('0x29')][_0xcedc('0x2a')]===0x1f4){logger[_0xcedc('0x29')]('FaxAccount,\x20%s,\x20%s',_0x272573,_0xfad49f[_0xcedc('0x29')][_0xcedc('0x2b')]);return _0x58398c(_0xfad49f[_0xcedc('0x29')]['message']);}logger[_0xcedc('0x29')](_0xcedc('0x24'),_0x272573,_0xfad49f['error'][_0xcedc('0x2b')]);return _0x5a3b4f(_0xfad49f[_0xcedc('0x29')]['message']);}else{logger[_0xcedc('0x23')]('FaxAccount,\x20%s,\x20%s',_0x272573,_0xcedc('0x25'));_0x5a3b4f(_0xfad49f[_0xcedc('0x2c')][_0xcedc('0x2b')]);}})[_0xcedc('0x2d')](function(_0x1aefbe){logger[_0xcedc('0x29')](_0xcedc('0x24'),_0x272573,_0x1aefbe);_0x58398c(_0x1aefbe);});});}function respondWithStatusCode(_0x1132bc,_0x5f5053){_0x5f5053=_0x5f5053||0xcc;return function(_0x4c337b){if(_0x4c337b){return _0x1132bc['sendStatus'](_0x5f5053);}return _0x1132bc[_0xcedc('0x2e')](_0x5f5053)[_0xcedc('0x2f')]();};}function respondWithResult(_0x1fd96c,_0x920e11){_0x920e11=_0x920e11||0xc8;return function(_0x284984){if(_0x284984){return _0x1fd96c[_0xcedc('0x2e')](_0x920e11)['json'](_0x284984);}};}function respondWithFilteredResult(_0x153a63,_0x5c06db){return function(_0x549d2c){if(_0x549d2c){var _0x40c975=typeof _0x5c06db[_0xcedc('0x30')]===_0xcedc('0x31')&&typeof _0x5c06db['limit']===_0xcedc('0x31');var _0x48d7fe=_0x549d2c['count'];var _0x31c607=_0x40c975?0x0:_0x5c06db[_0xcedc('0x30')];var _0x2f3a36=_0x40c975?_0x549d2c[_0xcedc('0x32')]:_0x5c06db[_0xcedc('0x30')]+_0x5c06db[_0xcedc('0x33')];var _0x98a9ca;if(_0x2f3a36>=_0x48d7fe){_0x2f3a36=_0x48d7fe;_0x98a9ca=0xc8;}else{_0x98a9ca=0xce;}_0x153a63[_0xcedc('0x2e')](_0x98a9ca);return _0x153a63[_0xcedc('0x34')](_0xcedc('0x35'),_0x31c607+'-'+_0x2f3a36+'/'+_0x48d7fe)[_0xcedc('0x36')](_0x549d2c);}return null;};}function patchUpdates(_0x35435a){return function(_0x1c0868){try{jsonpatch[_0xcedc('0x37')](_0x1c0868,_0x35435a,!![]);}catch(_0x358ecf){return BPromise[_0xcedc('0x38')](_0x358ecf);}return _0x1c0868[_0xcedc('0x39')]();};}function saveUpdates(_0x2f32bf,_0xd5ee8){return function(_0xb140e3){if(_0xb140e3){return _0xb140e3[_0xcedc('0x3a')](_0x2f32bf)[_0xcedc('0x22')](function(_0x4e66fe){return _0x4e66fe;});}return null;};}function removeEntity(_0x56c789,_0x2fe6b9){return function(_0x310532){if(_0x310532){return _0x310532[_0xcedc('0x3b')]()[_0xcedc('0x22')](function(){var _0x464006=_0x310532[_0xcedc('0x3c')]({'plain':!![]});var _0x57cbee='FaxAccounts';return db[_0xcedc('0x3d')][_0xcedc('0x3b')]({'where':{'type':_0x57cbee,'resourceId':_0x464006['id']}})[_0xcedc('0x22')](function(){return _0x310532;});})[_0xcedc('0x22')](function(){_0x56c789['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c540b,_0x43eea1){return function(_0x3fb4eb){if(!_0x3fb4eb){_0x3c540b[_0xcedc('0x3e')](0x194);}return _0x3fb4eb;};}function handleError(_0x5c7898,_0x175647){_0x175647=_0x175647||0x1f4;return function(_0x8fcbbe){logger[_0xcedc('0x29')](_0x8fcbbe[_0xcedc('0x3f')]);if(_0x8fcbbe['name']){delete _0x8fcbbe['name'];}_0x5c7898[_0xcedc('0x2e')](_0x175647)[_0xcedc('0x40')](_0x8fcbbe);};}exports['index']=function(_0x7b5bc5,_0x6b1dd4){var _0x14fa32={'include':[{'model':db[_0xcedc('0x41')],'as':'mandatoryDispositionPause'}]},_0x30a5f8={},_0x409009={'count':0x0,'rows':[]};var _0x586a52=_[_0xcedc('0x42')](db[_0xcedc('0x43')]['rawAttributes'],function(_0x2fd658){return{'name':_0x2fd658[_0xcedc('0x44')],'type':_0x2fd658[_0xcedc('0x45')][_0xcedc('0x46')]};});_0x30a5f8[_0xcedc('0x47')]=_[_0xcedc('0x42')](_0x586a52,_0xcedc('0x48'));_0x30a5f8[_0xcedc('0x49')]=_[_0xcedc('0x4a')](_0x7b5bc5[_0xcedc('0x49')]);_0x30a5f8[_0xcedc('0x4b')]=_[_0xcedc('0x4c')](_0x30a5f8[_0xcedc('0x47')],_0x30a5f8[_0xcedc('0x49')]);_0x14fa32[_0xcedc('0x4d')]=_['intersection'](_0x30a5f8[_0xcedc('0x47')],qs[_0xcedc('0x4e')](_0x7b5bc5[_0xcedc('0x49')][_0xcedc('0x4e')]));_0x14fa32[_0xcedc('0x4d')]=_0x14fa32[_0xcedc('0x4d')]['length']?_0x14fa32['attributes']:_0x30a5f8['model'];if(!_0x7b5bc5[_0xcedc('0x49')][_0xcedc('0x4f')]('nolimit')){_0x14fa32[_0xcedc('0x33')]=qs['limit'](_0x7b5bc5['query'][_0xcedc('0x33')]);_0x14fa32[_0xcedc('0x30')]=qs[_0xcedc('0x30')](_0x7b5bc5[_0xcedc('0x49')]['offset']);}_0x14fa32['order']=qs[_0xcedc('0x50')](_0x7b5bc5[_0xcedc('0x49')]['sort']);_0x14fa32[_0xcedc('0x51')]=qs[_0xcedc('0x4b')](_[_0xcedc('0x52')](_0x7b5bc5[_0xcedc('0x49')],_0x30a5f8[_0xcedc('0x4b')]),_0x586a52);if(_0x7b5bc5['query'][_0xcedc('0x53')]){_0x14fa32[_0xcedc('0x51')]=_[_0xcedc('0x54')](_0x14fa32[_0xcedc('0x51')],{'$or':_[_0xcedc('0x42')](_0x586a52,function(_0x4def6a){if(_0x4def6a[_0xcedc('0x45')]!==_0xcedc('0x55')){var _0x59a1e7={};_0x59a1e7[_0x4def6a['name']]={'$like':'%'+_0x7b5bc5[_0xcedc('0x49')]['filter']+'%'};return _0x59a1e7;}})});}_0x14fa32=_[_0xcedc('0x54')]({},_0x14fa32,_0x7b5bc5['options']);var _0x324676={'where':_0x14fa32[_0xcedc('0x51')]};return db[_0xcedc('0x43')][_0xcedc('0x32')](_0x324676)[_0xcedc('0x22')](function(_0x53d91e){_0x409009[_0xcedc('0x32')]=_0x53d91e;if(_0x7b5bc5[_0xcedc('0x49')][_0xcedc('0x56')]){_0x14fa32['include']=[{'all':!![]}];}return db[_0xcedc('0x43')][_0xcedc('0x57')](_0x14fa32);})['then'](function(_0x18dd7a){_0x409009['rows']=_0x18dd7a;return _0x409009;})[_0xcedc('0x22')](respondWithFilteredResult(_0x6b1dd4,_0x14fa32))[_0xcedc('0x2d')](handleError(_0x6b1dd4,null));};exports[_0xcedc('0x58')]=function(_0x46d3db,_0x33c71e){var _0x37822d={'raw':![],'where':{'id':_0x46d3db[_0xcedc('0x59')]['id']},'include':[{'model':db[_0xcedc('0x41')],'as':_0xcedc('0x5a')}]},_0x700d9c={};_0x700d9c[_0xcedc('0x47')]=_[_0xcedc('0x4a')](db[_0xcedc('0x43')]['rawAttributes']);_0x700d9c[_0xcedc('0x49')]=_[_0xcedc('0x4a')](_0x46d3db[_0xcedc('0x49')]);_0x700d9c[_0xcedc('0x4b')]=_[_0xcedc('0x4c')](_0x700d9c[_0xcedc('0x47')],_0x700d9c[_0xcedc('0x49')]);_0x37822d[_0xcedc('0x4d')]=_[_0xcedc('0x4c')](_0x700d9c['model'],qs['fields'](_0x46d3db[_0xcedc('0x49')][_0xcedc('0x4e')]));_0x37822d['attributes']=_0x37822d[_0xcedc('0x4d')][_0xcedc('0x5b')]?_0x37822d['attributes']:_0x700d9c[_0xcedc('0x47')];if(_0x46d3db[_0xcedc('0x49')]['includeAll']){_0x37822d[_0xcedc('0x5c')]=[{'all':!![]}];}_0x37822d=_[_0xcedc('0x54')]({},_0x37822d,_0x46d3db[_0xcedc('0x5d')]);return db[_0xcedc('0x43')][_0xcedc('0x5e')](_0x37822d)[_0xcedc('0x22')](handleEntityNotFound(_0x33c71e,null))[_0xcedc('0x22')](respondWithResult(_0x33c71e,null))['catch'](handleError(_0x33c71e,null));};exports[_0xcedc('0x5f')]=function(_0x258f1e,_0x30cf30){return db[_0xcedc('0x43')][_0xcedc('0x5f')](_0x258f1e[_0xcedc('0x60')],{})[_0xcedc('0x22')](function(_0x49e106){var _0x4827a4=_0x258f1e[_0xcedc('0x61')][_0xcedc('0x3c')]({'plain':!![]});if(!_0x4827a4)throw new Error(_0xcedc('0x62'));if(_0x4827a4[_0xcedc('0x63')]===_0xcedc('0x61')){var _0x532e89=_0x49e106[_0xcedc('0x3c')]({'plain':!![]});var _0x3e27f7=_0xcedc('0x64');return db[_0xcedc('0x65')][_0xcedc('0x5e')]({'where':{'name':_0x3e27f7,'userProfileId':_0x4827a4[_0xcedc('0x66')]},'raw':!![]})['then'](function(_0x1607b5){if(_0x1607b5&&_0x1607b5[_0xcedc('0x67')]===0x0){return db[_0xcedc('0x3d')][_0xcedc('0x5f')]({'name':_0x532e89['name'],'resourceId':_0x532e89['id'],'type':_0x1607b5[_0xcedc('0x48')],'sectionId':_0x1607b5['id']},{})[_0xcedc('0x22')](function(){return _0x49e106;});}else{return _0x49e106;}})[_0xcedc('0x2d')](function(_0x318c96){logger[_0xcedc('0x29')](_0xcedc('0x68'),_0x318c96);throw _0x318c96;});}return _0x49e106;})['then'](respondWithResult(_0x30cf30,0xc9))[_0xcedc('0x2d')](handleError(_0x30cf30,null));};exports[_0xcedc('0x3a')]=function(_0x520622,_0x2d283a){if(_0x520622[_0xcedc('0x60')]['id']){delete _0x520622[_0xcedc('0x60')]['id'];}return db[_0xcedc('0x43')][_0xcedc('0x5e')]({'where':{'id':_0x520622[_0xcedc('0x59')]['id']},'include':[{'model':db[_0xcedc('0x41')],'as':_0xcedc('0x5a')}]})[_0xcedc('0x22')](handleEntityNotFound(_0x2d283a,null))[_0xcedc('0x22')](saveUpdates(_0x520622['body'],null))[_0xcedc('0x22')](respondWithResult(_0x2d283a,null))[_0xcedc('0x2d')](handleError(_0x2d283a,null));};exports[_0xcedc('0x3b')]=function(_0x5cbd67,_0x26381c){return db[_0xcedc('0x43')]['find']({'where':{'id':_0x5cbd67[_0xcedc('0x59')]['id']}})['then'](handleEntityNotFound(_0x26381c,null))[_0xcedc('0x22')](removeEntity(_0x26381c,null))['catch'](handleError(_0x26381c,null));};exports[_0xcedc('0x69')]=function(_0xa2e975,_0x15644d){return db[_0xcedc('0x43')][_0xcedc('0x69')]()[_0xcedc('0x22')](respondWithResult(_0x15644d,null))[_0xcedc('0x2d')](handleError(_0x15644d,null));};exports[_0xcedc('0x6a')]=function(_0x296f9e,_0x3ea962,_0x4769d3){if(_0x296f9e[_0xcedc('0x60')]['id']){delete _0x296f9e[_0xcedc('0x60')]['id'];}return db['FaxAccount'][_0xcedc('0x5e')]({'where':{'id':_0x296f9e[_0xcedc('0x59')]['id']}})[_0xcedc('0x22')](handleEntityNotFound(_0x3ea962,null))[_0xcedc('0x22')](function(_0x519002){if(_0x519002){_0x296f9e[_0xcedc('0x60')]['FaxAccountId']=_0x519002['id'];return db[_0xcedc('0x6b')][_0xcedc('0x5f')](_0x296f9e['body']);}})[_0xcedc('0x22')](respondWithResult(_0x3ea962,null))['catch'](handleError(_0x3ea962,null));};exports[_0xcedc('0x6c')]=function(_0x564f8d,_0x45ff52,_0x45f2dc){var _0x4ed963={'raw':![],'where':{}};var _0xe39077={};var _0x196d0e={'count':0x0,'rows':[]};return db[_0xcedc('0x43')][_0xcedc('0x6d')]({'where':{'id':_0x564f8d['params']['id']}})[_0xcedc('0x22')](handleEntityNotFound(_0x45ff52,null))[_0xcedc('0x22')](function(_0x46d8d2){if(_0x46d8d2){_0xe39077[_0xcedc('0x47')]=_[_0xcedc('0x4a')](db[_0xcedc('0x6b')][_0xcedc('0x6e')]);_0xe39077[_0xcedc('0x49')]=_['keys'](_0x564f8d[_0xcedc('0x49')]);_0xe39077[_0xcedc('0x4b')]=_[_0xcedc('0x4c')](_0xe39077[_0xcedc('0x47')],_0xe39077[_0xcedc('0x49')]);_0x4ed963['attributes']=_['intersection'](_0xe39077[_0xcedc('0x47')],qs['fields'](_0x564f8d[_0xcedc('0x49')][_0xcedc('0x4e')]));_0x4ed963[_0xcedc('0x4d')]=_0x4ed963[_0xcedc('0x4d')][_0xcedc('0x5b')]?_0x4ed963[_0xcedc('0x4d')]:_0xe39077['model'];if(!_0x564f8d[_0xcedc('0x49')][_0xcedc('0x4f')]('nolimit')){_0x4ed963[_0xcedc('0x33')]=qs[_0xcedc('0x33')](_0x564f8d[_0xcedc('0x49')][_0xcedc('0x33')]);_0x4ed963[_0xcedc('0x30')]=qs[_0xcedc('0x30')](_0x564f8d[_0xcedc('0x49')][_0xcedc('0x30')]);}_0x4ed963[_0xcedc('0x6f')]=qs[_0xcedc('0x50')](_0x564f8d[_0xcedc('0x49')][_0xcedc('0x50')]);_0x4ed963['where']=qs[_0xcedc('0x4b')](_[_0xcedc('0x52')](_0x564f8d['query'],_0xe39077[_0xcedc('0x4b')]));_0x4ed963[_0xcedc('0x51')]['FaxAccountId']=_0x46d8d2['id'];if(_0x564f8d[_0xcedc('0x49')][_0xcedc('0x53')]){_0x4ed963[_0xcedc('0x51')]=_[_0xcedc('0x54')](_0x4ed963[_0xcedc('0x51')],{'$or':_['map'](_0x4ed963['attributes'],function(_0xc09c01){var _0x286b50={};_0x286b50[_0xc09c01]={'$like':'%'+_0x564f8d[_0xcedc('0x49')]['filter']+'%'};return _0x286b50;})});}_0x4ed963=_[_0xcedc('0x54')]({},_0x4ed963,_0x564f8d[_0xcedc('0x5d')]);return db[_0xcedc('0x6b')][_0xcedc('0x32')]({'where':_0x4ed963['where']})['then'](function(_0x4065df){_0x196d0e['count']=_0x4065df;if(_0x564f8d['query'][_0xcedc('0x56')]){_0x4ed963['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4ed963);})['then'](function(_0x12e1de){_0x196d0e['rows']=_0x12e1de;return _0x196d0e;});}})[_0xcedc('0x22')](respondWithFilteredResult(_0x45ff52,_0x4ed963))[_0xcedc('0x2d')](handleError(_0x45ff52,null));};exports[_0xcedc('0x70')]=function(_0x1fd0c1,_0x4092c0,_0x1f4307){return db['FaxAccount'][_0xcedc('0x5e')]({'where':{'id':_0x1fd0c1[_0xcedc('0x59')]['id']}})['then'](handleEntityNotFound(_0x4092c0,null))[_0xcedc('0x22')](function(_0x36e244){if(_0x36e244){return _0x36e244[_0xcedc('0x70')](_0x1fd0c1[_0xcedc('0x49')][_0xcedc('0x71')]);}})[_0xcedc('0x22')](respondWithStatusCode(_0x4092c0,null))[_0xcedc('0x2d')](handleError(_0x4092c0,null));};exports['addAnswer']=function(_0x19a802,_0x297e1f,_0x5cf7f0){if(_0x19a802[_0xcedc('0x60')]['id']){delete _0x19a802['body']['id'];}return db[_0xcedc('0x43')]['find']({'where':{'id':_0x19a802[_0xcedc('0x59')]['id']}})[_0xcedc('0x22')](handleEntityNotFound(_0x297e1f,null))[_0xcedc('0x22')](function(_0x28db70){if(_0x28db70){_0x19a802['body']['FaxAccountId']=_0x28db70['id'];return db[_0xcedc('0x72')][_0xcedc('0x5f')](_0x19a802['body']);}})['then'](respondWithResult(_0x297e1f,null))['catch'](handleError(_0x297e1f,null));};exports[_0xcedc('0x73')]=function(_0x509c40,_0x2b8bd6,_0x112c30){var _0x399f4b={'raw':![],'where':{}};var _0x5e5212={};var _0x43921f={'count':0x0,'rows':[]};return db[_0xcedc('0x43')]['findOne']({'where':{'id':_0x509c40[_0xcedc('0x59')]['id']}})[_0xcedc('0x22')](handleEntityNotFound(_0x2b8bd6,null))[_0xcedc('0x22')](function(_0x539d09){if(_0x539d09){_0x5e5212[_0xcedc('0x47')]=_['keys'](db[_0xcedc('0x72')][_0xcedc('0x6e')]);_0x5e5212[_0xcedc('0x49')]=_[_0xcedc('0x4a')](_0x509c40['query']);_0x5e5212[_0xcedc('0x4b')]=_[_0xcedc('0x4c')](_0x5e5212['model'],_0x5e5212[_0xcedc('0x49')]);_0x399f4b['attributes']=_[_0xcedc('0x4c')](_0x5e5212['model'],qs[_0xcedc('0x4e')](_0x509c40[_0xcedc('0x49')][_0xcedc('0x4e')]));_0x399f4b['attributes']=_0x399f4b[_0xcedc('0x4d')]['length']?_0x399f4b['attributes']:_0x5e5212['model'];if(!_0x509c40[_0xcedc('0x49')]['hasOwnProperty'](_0xcedc('0x74'))){_0x399f4b[_0xcedc('0x33')]=qs[_0xcedc('0x33')](_0x509c40[_0xcedc('0x49')][_0xcedc('0x33')]);_0x399f4b[_0xcedc('0x30')]=qs['offset'](_0x509c40[_0xcedc('0x49')][_0xcedc('0x30')]);}_0x399f4b[_0xcedc('0x6f')]=qs[_0xcedc('0x50')](_0x509c40['query'][_0xcedc('0x50')]);_0x399f4b[_0xcedc('0x51')]=qs[_0xcedc('0x4b')](_[_0xcedc('0x52')](_0x509c40['query'],_0x5e5212[_0xcedc('0x4b')]));_0x399f4b['where'][_0xcedc('0x75')]=_0x539d09['id'];if(_0x509c40[_0xcedc('0x49')][_0xcedc('0x53')]){_0x399f4b[_0xcedc('0x51')]=_[_0xcedc('0x54')](_0x399f4b[_0xcedc('0x51')],{'$or':_[_0xcedc('0x42')](_0x399f4b[_0xcedc('0x4d')],function(_0x1d0bef){var _0x1e8460={};_0x1e8460[_0x1d0bef]={'$like':'%'+_0x509c40['query']['filter']+'%'};return _0x1e8460;})});}_0x399f4b=_[_0xcedc('0x54')]({},_0x399f4b,_0x509c40[_0xcedc('0x5d')]);return db[_0xcedc('0x72')][_0xcedc('0x32')]({'where':_0x399f4b[_0xcedc('0x51')]})[_0xcedc('0x22')](function(_0x5a2b4e){_0x43921f[_0xcedc('0x32')]=_0x5a2b4e;if(_0x509c40[_0xcedc('0x49')][_0xcedc('0x56')]){_0x399f4b[_0xcedc('0x5c')]=[{'all':!![]}];}return db[_0xcedc('0x72')][_0xcedc('0x57')](_0x399f4b);})['then'](function(_0x3f4061){_0x43921f[_0xcedc('0x76')]=_0x3f4061;return _0x43921f;});}})[_0xcedc('0x22')](respondWithFilteredResult(_0x2b8bd6,_0x399f4b))[_0xcedc('0x2d')](handleError(_0x2b8bd6,null));};exports['removeAnswers']=function(_0xfc6e43,_0x458a20,_0x597386){return db[_0xcedc('0x43')][_0xcedc('0x5e')]({'where':{'id':_0xfc6e43[_0xcedc('0x59')]['id']}})['then'](handleEntityNotFound(_0x458a20,null))[_0xcedc('0x22')](function(_0x9bdf03){if(_0x9bdf03){return _0x9bdf03[_0xcedc('0x77')](_0xfc6e43[_0xcedc('0x49')][_0xcedc('0x71')]);}})[_0xcedc('0x22')](respondWithStatusCode(_0x458a20,null))[_0xcedc('0x2d')](handleError(_0x458a20,null));};exports[_0xcedc('0x78')]=function(_0x14432f,_0x5d5d4b,_0x36cb8d){return db[_0xcedc('0x79')][_0xcedc('0x5e')]({'where':{'id':_0x14432f[_0xcedc('0x59')]['id']}})[_0xcedc('0x22')](handleEntityNotFound(_0x5d5d4b,null))[_0xcedc('0x22')](function(_0x31e8de){if(_0x31e8de){return _0x31e8de['addInteraction'](_0x14432f['body'][_0xcedc('0x71')],_['omit'](_0x14432f[_0xcedc('0x60')],[_0xcedc('0x71'),'id'])||{});}})[_0xcedc('0x22')](respondWithResult(_0x5d5d4b,null))[_0xcedc('0x2d')](handleError(_0x5d5d4b,null));};exports['getInteractions']=function(_0x51fe11,_0x8d8d6b,_0x26f97c){var _0x357182={'raw':![],'where':{}};var _0x252a15={};var _0x5c8b61={'count':0x0,'rows':[]};return db[_0xcedc('0x43')][_0xcedc('0x6d')]({'where':{'id':_0x51fe11[_0xcedc('0x59')]['id']}})[_0xcedc('0x22')](handleEntityNotFound(_0x8d8d6b,null))[_0xcedc('0x22')](function(_0x31bcff){if(_0x31bcff){_0x252a15[_0xcedc('0x47')]=_['keys'](db[_0xcedc('0x79')]['rawAttributes']);_0x252a15['query']=_[_0xcedc('0x4a')](_0x51fe11[_0xcedc('0x49')]);_0x252a15[_0xcedc('0x4b')]=_[_0xcedc('0x4c')](_0x252a15['model'],_0x252a15[_0xcedc('0x49')]);_0x357182[_0xcedc('0x4d')]=_[_0xcedc('0x4c')](_0x252a15[_0xcedc('0x47')],qs[_0xcedc('0x4e')](_0x51fe11[_0xcedc('0x49')][_0xcedc('0x4e')]));_0x357182[_0xcedc('0x4d')]=_0x357182[_0xcedc('0x4d')][_0xcedc('0x5b')]?_0x357182[_0xcedc('0x4d')]:_0x252a15[_0xcedc('0x47')];if(!_0x51fe11[_0xcedc('0x49')][_0xcedc('0x4f')]('nolimit')){_0x357182['limit']=qs['limit'](_0x51fe11[_0xcedc('0x49')]['limit']);_0x357182[_0xcedc('0x30')]=qs[_0xcedc('0x30')](_0x51fe11[_0xcedc('0x49')][_0xcedc('0x30')]);}_0x357182['order']=qs['sort'](_0x51fe11[_0xcedc('0x49')][_0xcedc('0x50')]);_0x357182[_0xcedc('0x51')]=qs['filters'](_[_0xcedc('0x52')](_0x51fe11['query'],_0x252a15[_0xcedc('0x4b')]));_0x357182['where'][_0xcedc('0x75')]=_0x31bcff['id'];if(_0x51fe11[_0xcedc('0x49')][_0xcedc('0x53')]){_0x357182['where']=_[_0xcedc('0x54')](_0x357182[_0xcedc('0x51')],{'$or':_[_0xcedc('0x42')](_0x357182[_0xcedc('0x4d')],function(_0x559c1c){var _0x2f1366={};_0x2f1366[_0x559c1c]={'$like':'%'+_0x51fe11['query'][_0xcedc('0x53')]+'%'};return _0x2f1366;})});}_0x357182=_[_0xcedc('0x54')]({},_0x357182,_0x51fe11[_0xcedc('0x5d')]);return db[_0xcedc('0x79')][_0xcedc('0x32')]({'where':_0x357182[_0xcedc('0x51')]})[_0xcedc('0x22')](function(_0x552e57){_0x5c8b61[_0xcedc('0x32')]=_0x552e57;if(_0x51fe11[_0xcedc('0x49')][_0xcedc('0x56')]){_0x357182[_0xcedc('0x5c')]=[{'model':db[_0xcedc('0x7a')],'as':_0xcedc('0x7b'),'required':![]},{'model':db[_0xcedc('0x7c')],'as':'Owner','attributes':[_0xcedc('0x48'),'fullname',_0xcedc('0x7d')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'where':_0x51fe11[_0xcedc('0x49')][_0xcedc('0x7e')]?{'id':_0x51fe11[_0xcedc('0x49')][_0xcedc('0x7e')]}:undefined,'required':_0x51fe11['query'][_0xcedc('0x7e')]?!![]:![]}];}return db[_0xcedc('0x79')][_0xcedc('0x57')](_0x357182);})['then'](function(_0x337163){_0x5c8b61['rows']=_0x337163;return _0x5c8b61;});}})[_0xcedc('0x22')](respondWithFilteredResult(_0x8d8d6b,_0x357182))[_0xcedc('0x2d')](handleError(_0x8d8d6b,null));};exports['addApplications']=function(_0x359bf5,_0x4f709a){var _0x26c4b2=_0x359bf5['params']['id'];var _0x230b52=_0x359bf5[_0xcedc('0x60')];var _0x53a35f=0xc8;var _0x3a419e=null;return db[_0xcedc('0x7f')][_0xcedc('0x80')]({'isolationLevel':db[_0xcedc('0x7f')][_0xcedc('0x81')][_0xcedc('0x82')][_0xcedc('0x83')]},function(_0x547195){return db[_0xcedc('0x43')][_0xcedc('0x6d')]({'where':{'id':_0x26c4b2},'transaction':_0x547195})['then'](function(_0x59613f){if(_0x59613f){return db[_0xcedc('0x84')]['destroy']({'where':{'FaxAccountId':_0x26c4b2},'transaction':_0x547195})[_0xcedc('0x22')](function(){var _0x5bcd8f=_[_0xcedc('0x42')](_0x230b52,function(_0x2dd27f){_0x2dd27f[_0xcedc('0x75')]=_0x26c4b2;return _0x2dd27f;});return db['FaxApplication'][_0xcedc('0x85')](_0x5bcd8f,{'transaction':_0x547195});});}else{_0x53a35f=0x194;_0x3a419e=[];}});})[_0xcedc('0x22')](function(){if(_0x53a35f!==0x194){return db[_0xcedc('0x84')][_0xcedc('0x86')]({'where':{'FaxAccountId':_0x26c4b2},'order':_0xcedc('0x87')})[_0xcedc('0x22')](function(_0x126b20){_0x3a419e=_0x126b20;});}})[_0xcedc('0x2d')](function(_0x437109){_0x53a35f=0x1f4;logger[_0xcedc('0x29')](_0x437109[_0xcedc('0x3f')]);if(_0x437109[_0xcedc('0x48')]){delete _0x437109['name'];}_0x3a419e=_0x437109;})['finally'](function(){if(_0x3a419e===null){_0x4f709a[_0xcedc('0x3e')](_0x53a35f);}else{if(_0x53a35f===0x1f4){_0x4f709a['status'](_0x53a35f)['send'](_0x3a419e);}else{_0x4f709a['status'](_0x53a35f)['json'](_0x3a419e);}}});};exports['getApplications']=function(_0x47b50b,_0x1e2cea,_0x19cdee){var _0x4f3ac0={};var _0x5c97ac={};var _0x25436e;var _0x30b6ad;return db[_0xcedc('0x43')][_0xcedc('0x6d')]({'where':{'id':_0x47b50b[_0xcedc('0x59')]['id']}})[_0xcedc('0x22')](handleEntityNotFound(_0x1e2cea,null))[_0xcedc('0x22')](function(_0x217b78){if(_0x217b78){_0x25436e=_0x217b78;_0x5c97ac[_0xcedc('0x47')]=_['keys'](db[_0xcedc('0x84')][_0xcedc('0x6e')]);_0x5c97ac[_0xcedc('0x49')]=_[_0xcedc('0x4a')](_0x47b50b[_0xcedc('0x49')]);_0x5c97ac[_0xcedc('0x4b')]=_[_0xcedc('0x4c')](_0x5c97ac[_0xcedc('0x47')],_0x5c97ac[_0xcedc('0x49')]);_0x4f3ac0[_0xcedc('0x4d')]=_[_0xcedc('0x4c')](_0x5c97ac[_0xcedc('0x47')],qs[_0xcedc('0x4e')](_0x47b50b[_0xcedc('0x49')]['fields']));_0x4f3ac0[_0xcedc('0x4d')]=_0x4f3ac0[_0xcedc('0x4d')][_0xcedc('0x5b')]?_0x4f3ac0[_0xcedc('0x4d')]:_0x5c97ac[_0xcedc('0x47')];_0x4f3ac0[_0xcedc('0x6f')]=qs[_0xcedc('0x50')](_0x47b50b[_0xcedc('0x49')][_0xcedc('0x50')]);_0x4f3ac0[_0xcedc('0x51')]=qs[_0xcedc('0x4b')](_['pick'](_0x47b50b[_0xcedc('0x49')],_0x5c97ac[_0xcedc('0x4b')]));if(_0x47b50b['query'][_0xcedc('0x53')]){_0x4f3ac0['where']=_[_0xcedc('0x54')](_0x4f3ac0[_0xcedc('0x51')],{'$or':_['map'](_0x4f3ac0[_0xcedc('0x4d')],function(_0x4870f9){var _0x4fb19a={};_0x4fb19a[_0x4870f9]={'$like':'%'+_0x47b50b['query']['filter']+'%'};return _0x4fb19a;})});}_0x4f3ac0=_[_0xcedc('0x54')]({},_0x4f3ac0,_0x47b50b[_0xcedc('0x5d')]);return _0x25436e[_0xcedc('0x88')](_0x4f3ac0);}})[_0xcedc('0x22')](function(_0x61c0f3){if(_0x61c0f3){_0x30b6ad=_0x61c0f3[_0xcedc('0x5b')];if(!_0x47b50b[_0xcedc('0x49')][_0xcedc('0x4f')](_0xcedc('0x74'))){_0x4f3ac0[_0xcedc('0x33')]=qs[_0xcedc('0x33')](_0x47b50b[_0xcedc('0x49')][_0xcedc('0x33')]);_0x4f3ac0['offset']=qs['offset'](_0x47b50b[_0xcedc('0x49')][_0xcedc('0x30')]);}return _0x25436e[_0xcedc('0x88')](_0x4f3ac0);}})[_0xcedc('0x22')](function(_0x4b95e6){if(_0x4b95e6){return _0x4b95e6?{'count':_0x30b6ad,'rows':_0x4b95e6}:null;}})[_0xcedc('0x22')](respondWithResult(_0x1e2cea,null))[_0xcedc('0x2d')](handleError(_0x1e2cea,null));};function Extension(_0x1758c0,_0x1d71d3,_0x531953,_0x3fc56b){this[_0xcedc('0x89')]=_0xcedc('0x8a');this[_0xcedc('0x8b')]=_0x1758c0[_0xcedc('0x8c')];this['app']=_0x3fc56b;this['type']=_0xcedc('0x8d');this['description']='Fax\x20Extension';this[_0xcedc('0x75')]=_0x1758c0['id'];this[_0xcedc('0x87')]=_0x1d71d3;this[_0xcedc('0x8e')]=_0x531953;}function createExtensionsReciveFax(_0x3e2808){var _0x29e409=0x1;var _0x1cde53=[];_0x1cde53[_0xcedc('0x8f')](new Extension(_0x3e2808,_0x29e409,'','Answer'));_0x29e409+=0x1;_0x1cde53['push'](new Extension(_0x3e2808,_0x29e409,'CDR(type)=inbound-fax',_0xcedc('0x90')));_0x29e409+=0x1;for(var _0x4cea3b in _0x3e2808){if(_0x3e2808['hasOwnProperty'](_0x4cea3b)&&(_0x4cea3b===_0xcedc('0x91')||_0x4cea3b===_0xcedc('0x8c')||_0x4cea3b===_0xcedc('0x92')||_0x4cea3b===_0xcedc('0x93')||_0x4cea3b===_0xcedc('0x94')||_0x4cea3b==='maxrate'||_0x4cea3b===_0xcedc('0x95')||_0x4cea3b===_0xcedc('0x96')||_0x4cea3b===_0xcedc('0x97'))){_0x1cde53[_0xcedc('0x8f')](new Extension(_0x3e2808,_0x29e409,_0xcedc('0x98')+_0x4cea3b+')='+_0x3e2808[_0x4cea3b],_0xcedc('0x90')));_0x29e409+=0x1;}}_0x1cde53[_0xcedc('0x8f')](new Extension(_0x3e2808,_0x29e409,'6',_0xcedc('0x99')));_0x29e409+=0x1;_0x1cde53[_0xcedc('0x8f')](new Extension(_0x3e2808,_0x29e409,_0xcedc('0x9a'),_0xcedc('0x9b')));_0x29e409=0x0;return _0x1cde53;}exports['addAccountApplications']=function(_0x476ef5,_0x312f76,_0x202852){var _0xa1343d;return db[_0xcedc('0x7f')][_0xcedc('0x80')](function(_0x5d4af9){return db[_0xcedc('0x43')][_0xcedc('0x5f')](_0x476ef5[_0xcedc('0x60')],{'transaction':_0x5d4af9})['then'](function(_0x38c3a6){_0xa1343d=_0x38c3a6[_0xcedc('0x3c')]({'plain':!![]});return db[_0xcedc('0x9c')][_0xcedc('0x85')](createExtensionsReciveFax(_0xa1343d),{'transaction':_0x5d4af9});});})[_0xcedc('0x22')](function(){return _0xa1343d;})['then'](respondWithResult(_0x312f76,null))['catch'](handleError(_0x312f76,null));};exports[_0xcedc('0x9d')]=function(_0x4e7345,_0x86ffae,_0x40038f){var _0xe8282a;return db[_0xcedc('0x7f')][_0xcedc('0x80')](function(_0x2c3a6c){return db[_0xcedc('0x43')][_0xcedc('0x3a')](_0x4e7345[_0xcedc('0x60')],{'where':{'id':_0x4e7345[_0xcedc('0x60')]['id']},'transaction':_0x2c3a6c})[_0xcedc('0x22')](function(_0x5039f1){return db[_0xcedc('0x9c')]['destroy']({'where':{'FaxAccountId':_0x4e7345['body']['id']},'transaction':_0x2c3a6c})[_0xcedc('0x22')](function(_0x5183eb){return db[_0xcedc('0x9c')][_0xcedc('0x85')](createExtensionsReciveFax(_[_0xcedc('0x9e')](_0x4e7345[_0xcedc('0x60')],[_0xcedc('0x9f'),'key',_0xcedc('0xa0'),_0xcedc('0xa1'),_0xcedc('0xa2'),_0xcedc('0xa3')])),{'transaction':_0x2c3a6c});});});})[_0xcedc('0x22')](function(){return db['FaxAccount'][_0xcedc('0xa4')](_0x4e7345[_0xcedc('0x60')]['id']);})[_0xcedc('0x22')](respondWithResult(_0x86ffae,null))[_0xcedc('0x2d')](handleError(_0x86ffae,null));};exports[_0xcedc('0xa5')]=function(_0x5290c3,_0x202225,_0x2548f6){var _0x1c9557={'raw':!![],'where':{}};var _0x1937d7={};var _0x9b9550={'count':0x0,'rows':[]};return db[_0xcedc('0x43')][_0xcedc('0x6d')]({'where':{'id':_0x5290c3['params']['id']}})[_0xcedc('0x22')](handleEntityNotFound(_0x202225,null))[_0xcedc('0x22')](function(_0x5e8b0b){if(_0x5e8b0b){_0x1937d7[_0xcedc('0x47')]=_[_0xcedc('0x4a')](db[_0xcedc('0xa6')][_0xcedc('0x6e')]);_0x1937d7[_0xcedc('0x49')]=_['keys'](_0x5290c3[_0xcedc('0x49')]);_0x1937d7[_0xcedc('0x4b')]=_[_0xcedc('0x4c')](_0x1937d7['model'],_0x1937d7[_0xcedc('0x49')]);_0x1c9557[_0xcedc('0x4d')]=_[_0xcedc('0x4c')](_0x1937d7[_0xcedc('0x47')],qs[_0xcedc('0x4e')](_0x5290c3['query'][_0xcedc('0x4e')]));_0x1c9557['attributes']=_0x1c9557[_0xcedc('0x4d')][_0xcedc('0x5b')]?_0x1c9557[_0xcedc('0x4d')]:_0x1937d7[_0xcedc('0x47')];if(!_0x5290c3['query'][_0xcedc('0x4f')](_0xcedc('0x74'))){_0x1c9557[_0xcedc('0x33')]=qs[_0xcedc('0x33')](_0x5290c3[_0xcedc('0x49')][_0xcedc('0x33')]);_0x1c9557[_0xcedc('0x30')]=qs['offset'](_0x5290c3[_0xcedc('0x49')][_0xcedc('0x30')]);}_0x1c9557[_0xcedc('0x6f')]=qs['sort'](_0x5290c3['query']['sort']);_0x1c9557[_0xcedc('0x51')]=qs[_0xcedc('0x4b')](_[_0xcedc('0x52')](_0x5290c3[_0xcedc('0x49')],_0x1937d7[_0xcedc('0x4b')]));_0x1c9557[_0xcedc('0x51')][_0xcedc('0x75')]=_0x5e8b0b['id'];if(_0x5290c3['query'][_0xcedc('0x53')]){_0x1c9557[_0xcedc('0x51')]=_[_0xcedc('0x54')](_0x1c9557[_0xcedc('0x51')],{'$or':_['map'](_0x1c9557[_0xcedc('0x4d')],function(_0x22d472){var _0x577702={};_0x577702[_0x22d472]={'$like':'%'+_0x5290c3[_0xcedc('0x49')]['filter']+'%'};return _0x577702;})});}if(_0x5290c3[_0xcedc('0x49')][_0xcedc('0xa7')]){var _0x4d0a31=_0x5290c3[_0xcedc('0x49')][_0xcedc('0xa7')]['split'](',');var _0x2370eb={};_0x2370eb[_0x4d0a31[0x0]]={'$gte':moment(_0x4d0a31[0x1])['format'](_0xcedc('0xa8'))};_0x1c9557[_0xcedc('0x51')]=_[_0xcedc('0x54')](_0x1c9557['where'],_0x2370eb);}_0x1c9557=_[_0xcedc('0x54')]({},_0x1c9557,_0x5290c3[_0xcedc('0x5d')]);return db[_0xcedc('0xa6')][_0xcedc('0x32')]({'where':_0x1c9557[_0xcedc('0x51')]})[_0xcedc('0x22')](function(_0x3279b7){_0x9b9550[_0xcedc('0x32')]=_0x3279b7;if(_0x5290c3[_0xcedc('0x49')][_0xcedc('0x56')]){_0x1c9557[_0xcedc('0x5c')]=[{'all':!![]}];}return db[_0xcedc('0xa6')][_0xcedc('0x57')](_0x1c9557);})[_0xcedc('0x22')](function(_0x1e01e9){_0x9b9550[_0xcedc('0x76')]=_0x1e01e9;return _0x9b9550;});}})[_0xcedc('0x22')](respondWithFilteredResult(_0x202225,_0x1c9557))[_0xcedc('0x2d')](handleError(_0x202225,null));};exports[_0xcedc('0x40')]=function(_0x3b255f,_0x9516c,_0x448a31){var _0x1ccf52,_0x520bb2={},_0x32d408;if(_0x3b255f['body']['to']){_0x32d408=_0x3b255f[_0xcedc('0x60')]['to'][0x0];}return db[_0xcedc('0x43')][_0xcedc('0x5e')]({'where':{'id':_0x3b255f[_0xcedc('0x59')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xcedc('0x7a')],'as':_0xcedc('0xa9'),'where':{'fax':_0x32d408},'limit':0x1,'order':[[_0xcedc('0xa1'),_0xcedc('0xaa')]]}]}]})[_0xcedc('0x22')](handleEntityNotFound(_0x9516c,null))['then'](function(_0xd09d4d){_0x1ccf52=_0xd09d4d;if(_0x3b255f[_0xcedc('0x60')][_0xcedc('0xab')]&&_0x3b255f[_0xcedc('0x60')][_0xcedc('0xab')][_0xcedc('0x5b')]){for(var _0x4f354c=0x0;_0x4f354c<_0x3b255f['body'][_0xcedc('0xab')]['length'];_0x4f354c+=0x1){_0x3b255f[_0xcedc('0x60')][_0xcedc('0xab')][_0x4f354c]={'filename':_0x3b255f[_0xcedc('0x60')]['attachments'][_0x4f354c][_0xcedc('0x48')],'id':_0x3b255f[_0xcedc('0x60')][_0xcedc('0xab')][_0x4f354c]['id'],'path':path[_0xcedc('0xac')](config[_0xcedc('0xad')],_0xcedc('0xae'),_0x3b255f[_0xcedc('0x60')]['attachments'][_0x4f354c][_0xcedc('0xaf')])};}}return respondWithRpcPromise(_0xcedc('0xb0'),'CheckAfterSend',{'FaxAccountId':_[_0xcedc('0xb1')](_0x3b255f[_0xcedc('0x59')]['id'])?undefined:_0x3b255f[_0xcedc('0x59')]['id'],'path':_[_0xcedc('0xb1')](_0x3b255f['body'][_0xcedc('0xab')][0x0][_0xcedc('0x6')])?undefined:_0x3b255f[_0xcedc('0x60')][_0xcedc('0xab')][0x0]['path'],'fax':_[_0xcedc('0xb1')](_0x3b255f[_0xcedc('0x60')]['to'][0x0])?undefined:_0x3b255f['body']['to'][0x0]},client9002);})['then'](function(){if(_0x1ccf52){if(_[_0xcedc('0xb1')](_0x3b255f[_0xcedc('0x60')]['from'])){_0x3b255f[_0xcedc('0x60')][_0xcedc('0xb2')]=util[_0xcedc('0xb3')](_0xcedc('0xb4'),_0x1ccf52[_0xcedc('0x48')],_0x1ccf52['fax']);}if(_0x1ccf52[_0xcedc('0xb5')]){if(_0x1ccf52['List'][_0xcedc('0xa9')]['length']){return _0x1ccf52[_0xcedc('0xb5')][_0xcedc('0xa9')][0x0];}else{return db[_0xcedc('0x7a')][_0xcedc('0x5f')](_[_0xcedc('0x1b')](_0x3b255f[_0xcedc('0x60')],{'firstName':_0x3b255f[_0xcedc('0x60')]['to'][0x0],'phone':_0x3b255f[_0xcedc('0x60')]['to'][0x0],'fax':_0x3b255f[_0xcedc('0x60')]['to'][0x0],'ListId':_0x1ccf52[_0xcedc('0xa3')]}));}}else{throw new Error(_0xcedc('0xb6'));}}else{throw new Error(_0xcedc('0xb7'));}})['then'](function(_0x310b94){if(_0x310b94){return db[_0xcedc('0x79')]['find']({'where':{'ContactId':_0x310b94['id'],'closed':![],'FaxAccountId':_0x1ccf52['id']}})['then'](function(_0x3b32d1){if(_0x3b32d1){return[_0x3b32d1,![]];}return db[_0xcedc('0x79')][_0xcedc('0x5f')]({'UserId':_0x3b255f['user']['id'],'ContactId':_0x310b94['id'],'FaxAccountId':_0x1ccf52['id'],'fax':_0x3b255f['body']['to'][0x0],'firstMsgDirection':_0xcedc('0xb8'),'Messages':[_[_0xcedc('0x54')](_0x3b255f[_0xcedc('0x60')],{'read':![],'body':_0x3b255f[_0xcedc('0x60')]['attachments'][0x0][_0xcedc('0xb9')],'FaxAccountId':_0x1ccf52['id'],'UserId':_0x3b255f[_0xcedc('0x61')]['id'],'ContactId':_0x310b94['id'],'AttachmentId':_0x3b255f[_0xcedc('0x60')][_0xcedc('0xab')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0xcedc('0x22')](function(_0x220c53){return[_0x220c53,!![]];});});}else{throw new Error(_0xcedc('0xba'));}})[_0xcedc('0xbb')](function(_0x16c7c7,_0x16a450){if(_0x16a450){return _0x16c7c7;}return db[_0xcedc('0xa6')][_0xcedc('0x5f')]({'direction':_0xcedc('0xb8'),'read':![],'body':_0x3b255f[_0xcedc('0x60')]['attachments'][0x0][_0xcedc('0xb9')],'FaxAccountId':_0x1ccf52['id'],'FaxInteractionId':_0x16c7c7['id'],'UserId':_0x3b255f[_0xcedc('0x61')]['id'],'ContactId':_0x16c7c7[_0xcedc('0xbc')],'AttachmentId':_0x3b255f[_0xcedc('0x60')][_0xcedc('0xab')][0x0]['id']})[_0xcedc('0x22')](function(_0x43147f){_0x16c7c7[_0xcedc('0xbd')][_0xcedc('0xbe')]=[];_0x16c7c7[_0xcedc('0xbd')]['Messages']['push'](_0x43147f[_0xcedc('0xbd')]);return _0x16c7c7;});})[_0xcedc('0x22')](function(_0x2f3565){respondWithRpcPromise(_0xcedc('0xbf'),_0xcedc('0xbf'),{'FaxAccountId':_[_0xcedc('0xb1')](_0x3b255f[_0xcedc('0x59')]['id'])?undefined:_0x3b255f[_0xcedc('0x59')]['id'],'path':_['isNil'](_0x3b255f[_0xcedc('0x60')]['attachments'][0x0][_0xcedc('0x6')])?undefined:_0x3b255f['body'][_0xcedc('0xab')][0x0][_0xcedc('0x6')],'fax':_[_0xcedc('0xb1')](_0x3b255f[_0xcedc('0x60')]['to'][0x0])?undefined:_0x3b255f['body']['to'][0x0],'AttachmentId':_0x3b255f[_0xcedc('0x60')]['attachments'][0x0]['id']},client9002)[_0xcedc('0x22')](function(_0x54f2ef){logger['info'](_0xcedc('0xc0'),_0x54f2ef);})[_0xcedc('0x2d')](function(_0x566465){logger[_0xcedc('0x23')](_0xcedc('0xc0'),_0x566465);});return _0x2f3565;})['then'](respondWithResult(_0x9516c,null))[_0xcedc('0x2d')](handleError(_0x9516c,null));};exports['addAgents']=function(_0x5ca9ef,_0x889c05,_0x4b1fac){return db[_0xcedc('0x43')][_0xcedc('0x5e')]({'where':{'id':_0x5ca9ef['params']['id']}})['then'](handleEntityNotFound(_0x889c05,null))[_0xcedc('0x22')](function(_0x4a8e12){if(_0x4a8e12){return _0x4a8e12[_0xcedc('0xc1')](_0x5ca9ef[_0xcedc('0x60')][_0xcedc('0x71')],_[_0xcedc('0x9e')](_0x5ca9ef[_0xcedc('0x60')],[_0xcedc('0x71'),'id'])||{})['spread'](function(_0x503518){for(var _0x3bbbc2=0x0;_0x3bbbc2<_0x5ca9ef[_0xcedc('0x60')][_0xcedc('0x71')]['length'];_0x3bbbc2+=0x1){socket[_0xcedc('0xc2')](_0xcedc('0xc3'),{'UserId':Number(_0x5ca9ef['body']['ids'][_0x3bbbc2]),'FaxAccountId':Number(_0x5ca9ef['params']['id'])});}return _0x503518;});}})[_0xcedc('0x22')](respondWithResult(_0x889c05,null))[_0xcedc('0x2d')](handleError(_0x889c05,null));};exports[_0xcedc('0xc4')]=function(_0x1b37d3,_0x669a76,_0x3fd862){return db[_0xcedc('0x43')][_0xcedc('0x5e')]({'where':{'id':_0x1b37d3['params']['id']}})[_0xcedc('0x22')](handleEntityNotFound(_0x669a76,null))[_0xcedc('0x22')](function(_0x1ea776){if(_0x1ea776){return _0x1ea776[_0xcedc('0xc4')](_0x1b37d3[_0xcedc('0x49')][_0xcedc('0x71')])[_0xcedc('0x22')](function(){if(_[_0xcedc('0xc5')](_0x1b37d3[_0xcedc('0x49')][_0xcedc('0x71')])){for(var _0x237984=0x0;_0x237984<_0x1b37d3[_0xcedc('0x49')][_0xcedc('0x71')]['length'];_0x237984+=0x1){socket[_0xcedc('0xc2')](_0xcedc('0xc6'),{'UserId':Number(_0x1b37d3[_0xcedc('0x49')]['ids'][_0x237984]),'FaxAccountId':Number(_0x1b37d3[_0xcedc('0x59')]['id'])});}}else{socket[_0xcedc('0xc2')](_0xcedc('0xc6'),{'UserId':Number(_0x1b37d3[_0xcedc('0x49')][_0xcedc('0x71')]),'FaxAccountId':Number(_0x1b37d3[_0xcedc('0x59')]['id'])});}});}})[_0xcedc('0x22')](respondWithStatusCode(_0x669a76,null))[_0xcedc('0x2d')](handleError(_0x669a76,null));};exports[_0xcedc('0xc7')]=function(_0x509f0d,_0x3e9baa,_0x2caedb){var _0x378525={};var _0x42763a={};var _0x1b67ca;var _0x46cc26;return db[_0xcedc('0x43')][_0xcedc('0x6d')]({'where':{'id':_0x509f0d['params']['id']}})[_0xcedc('0x22')](handleEntityNotFound(_0x3e9baa,null))['then'](function(_0x164e39){if(_0x164e39){_0x1b67ca=_0x164e39;_0x42763a['model']=_[_0xcedc('0x4a')](db[_0xcedc('0x7c')][_0xcedc('0x6e')]);_0x42763a[_0xcedc('0x49')]=_[_0xcedc('0x4a')](_0x509f0d[_0xcedc('0x49')]);_0x42763a['filters']=_[_0xcedc('0x4c')](_0x42763a[_0xcedc('0x47')],_0x42763a['query']);_0x378525[_0xcedc('0x4d')]=_['intersection'](_0x42763a[_0xcedc('0x47')],qs[_0xcedc('0x4e')](_0x509f0d[_0xcedc('0x49')]['fields']));_0x378525[_0xcedc('0x4d')]=_0x378525[_0xcedc('0x4d')][_0xcedc('0x5b')]?_0x378525['attributes']:_0x42763a[_0xcedc('0x47')];_0x378525[_0xcedc('0x6f')]=qs['sort'](_0x509f0d[_0xcedc('0x49')][_0xcedc('0x50')]);_0x378525['where']=qs['filters'](_[_0xcedc('0x52')](_0x509f0d[_0xcedc('0x49')],_0x42763a[_0xcedc('0x4b')]));if(_0x509f0d['query'][_0xcedc('0x53')]){_0x378525[_0xcedc('0x51')]=_['merge'](_0x378525['where'],{'$or':_['map'](_0x378525[_0xcedc('0x4d')],function(_0x1dd7b4){var _0x36c5fe={};_0x36c5fe[_0x1dd7b4]={'$like':'%'+_0x509f0d[_0xcedc('0x49')][_0xcedc('0x53')]+'%'};return _0x36c5fe;})});}_0x378525=_[_0xcedc('0x54')]({},_0x378525,_0x509f0d[_0xcedc('0x5d')]);return _0x1b67ca[_0xcedc('0xc7')](_0x378525);}})['then'](function(_0x2b1881){if(_0x2b1881){_0x46cc26=_0x2b1881[_0xcedc('0x5b')];if(!_0x509f0d[_0xcedc('0x49')]['hasOwnProperty'](_0xcedc('0x74'))){_0x378525[_0xcedc('0x33')]=qs[_0xcedc('0x33')](_0x509f0d[_0xcedc('0x49')][_0xcedc('0x33')]);_0x378525['offset']=qs[_0xcedc('0x30')](_0x509f0d[_0xcedc('0x49')]['offset']);}return _0x1b67ca[_0xcedc('0xc7')](_0x378525);}})[_0xcedc('0x22')](function(_0xb8adbb){if(_0xb8adbb){return _0xb8adbb?{'count':_0x46cc26,'rows':_0xb8adbb}:null;}})['then'](respondWithResult(_0x3e9baa,null))[_0xcedc('0x2d')](handleError(_0x3e9baa,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 0077dc1..c160a6e 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 _0xfaa4=['hook','exports','events','../../mysqldb','FaxAccount','save','emit','hasOwnProperty'];(function(_0x2d3b46,_0x60950a){var _0x1042b3=function(_0x4f96ef){while(--_0x4f96ef){_0x2d3b46['push'](_0x2d3b46['shift']());}};_0x1042b3(++_0x60950a);}(_0xfaa4,0x17a));var _0x4faa=function(_0x277868,_0x35c220){_0x277868=_0x277868-0x0;var _0x3f0b8d=_0xfaa4[_0x277868];return _0x3f0b8d;};'use strict';var EventEmitter=require(_0x4faa('0x0'));var FaxAccount=require(_0x4faa('0x1'))['db'][_0x4faa('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4faa('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5967b3){return function(_0x541539,_0x5798df,_0x4055ef){FaxAccountEvents[_0x4faa('0x4')](_0x5967b3+':'+_0x541539['id'],_0x541539);FaxAccountEvents[_0x4faa('0x4')](_0x5967b3,_0x541539);_0x4055ef(null);};}for(var e in events){if(events[_0x4faa('0x5')](e)){var event=events[e];FaxAccount[_0x4faa('0x6')](e,emitEvent(event));}}module[_0x4faa('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x93b3=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','../../mysqldb','FaxAccount'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x93b3,0x1ae));var _0x393b=function(_0x22789a,_0x4a1c8c){_0x22789a=_0x22789a-0x0;var _0xede88=_0x93b3[_0x22789a];return _0xede88;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x393b('0x0'))['db'][_0x393b('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x393b('0x2')](0x0);var events={'afterCreate':_0x393b('0x3'),'afterUpdate':'update','afterDestroy':_0x393b('0x4')};function emitEvent(_0x25f9d1){return function(_0x12513c,_0x12be4d,_0x17ebb9){FaxAccountEvents[_0x393b('0x5')](_0x25f9d1+':'+_0x12513c['id'],_0x12513c);FaxAccountEvents[_0x393b('0x5')](_0x25f9d1,_0x12513c);_0x17ebb9(null);};}for(var e in events){if(events[_0x393b('0x6')](e)){var event=events[e];FaxAccount[_0x393b('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 09d0d65..0123019 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 _0x3383=['define','fax_accounts','lodash','util','../../config/logger','request-promise','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0x2ac0ed,_0x3e4a8d){var _0x328d78=function(_0x2fa3e3){while(--_0x2fa3e3){_0x2ac0ed['push'](_0x2ac0ed['shift']());}};_0x328d78(++_0x3e4a8d);}(_0x3383,0x1bb));var _0x3338=function(_0x3979ca,_0x721d3){_0x3979ca=_0x3979ca-0x0;var _0x2e7bea=_0x3383[_0x3979ca];return _0x2e7bea;};'use strict';var _=require(_0x3338('0x0'));var util=require(_0x3338('0x1'));var logger=require(_0x3338('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3338('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3338('0x4'));var config=require(_0x3338('0x5'));var attributes=require(_0x3338('0x6'));module['exports']=function(_0x26ea0a,_0x2d1f80){return _0x26ea0a[_0x3338('0x7')]('FaxAccount',attributes,{'tableName':_0x3338('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7253=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','util'];(function(_0x3386b3,_0x436194){var _0x1fb93c=function(_0x18a651){while(--_0x18a651){_0x3386b3['push'](_0x3386b3['shift']());}};_0x1fb93c(++_0x436194);}(_0x7253,0x1bb));var _0x3725=function(_0x1214d4,_0x3f7df1){_0x1214d4=_0x1214d4-0x0;var _0xe1e7f0=_0x7253[_0x1214d4];return _0xe1e7f0;};'use strict';var _=require('lodash');var util=require(_0x3725('0x0'));var logger=require(_0x3725('0x1'))(_0x3725('0x2'));var moment=require(_0x3725('0x3'));var BPromise=require(_0x3725('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3725('0x5'));var config=require(_0x3725('0x6'));var attributes=require(_0x3725('0x7'));module[_0x3725('0x8')]=function(_0x29ec95,_0x1a3efd){return _0x29ec95[_0x3725('0x9')](_0x3725('0xa'),attributes,{'tableName':_0x3725('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 7d5f6f6..86fd098 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 _0x669c=['model','GetFaxAccount','NotifyFaxAccount','body','CmContact','describe','ValidationError','difference','keys','createdAt','CompanyId','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','FaxAccount','CmList','List','Contacts','updatedAt','FaxApplication','get','account','Applications','list','applications','orderBy','priority','asc','ListId','create','fax','find','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','length','close','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','unshift','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','debug','request\x20sent','stringify','error','FaxAccount,\x20%s,\x20%s','message','catch','findAll','options','raw','limit','map','include','attributes'];(function(_0x5a8cdb,_0x1c1d29){var _0x4965af=function(_0x10b62d){while(--_0x10b62d){_0x5a8cdb['push'](_0x5a8cdb['shift']());}};_0x4965af(++_0x1c1d29);}(_0x669c,0x96));var _0xc669=function(_0x1cc025,_0x4a6fd8){_0x1cc025=_0x1cc025-0x0;var _0x565ab8=_0x669c[_0x1cc025];return _0x565ab8;};'use strict';var _=require(_0xc669('0x0'));var util=require(_0xc669('0x1'));var moment=require(_0xc669('0x2'));var BPromise=require(_0xc669('0x3'));var rs=require(_0xc669('0x4'));var fs=require('fs');var Redis=require(_0xc669('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc669('0x6'));var logger=require(_0xc669('0x7'))(_0xc669('0x8'));var config=require(_0xc669('0x9'));var jayson=require(_0xc669('0xa'));var client=jayson[_0xc669('0xb')][_0xc669('0xc')]({'port':0x232c});config[_0xc669('0xd')]=_[_0xc669('0xe')](config[_0xc669('0xd')],{'host':_0xc669('0xf'),'port':0x18eb});var socket=require(_0xc669('0x10'))(new Redis(config['redis']));require(_0xc669('0x11'))[_0xc669('0x12')](socket);function respondWithRpcPromise(_0x274410,_0x7fb533,_0x56a8ad){return new BPromise(function(_0x2df384,_0x1ad1ee){return client[_0xc669('0x13')](_0x274410,_0x56a8ad)[_0xc669('0x14')](function(_0x4698cb){logger[_0xc669('0x15')]('FaxAccount,\x20%s,\x20%s',_0x7fb533,'request\x20sent');logger[_0xc669('0x16')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x7fb533,_0xc669('0x17'),JSON[_0xc669('0x18')](_0x4698cb));if(_0x4698cb['error']){if(_0x4698cb[_0xc669('0x19')]['code']===0x1f4){logger[_0xc669('0x19')](_0xc669('0x1a'),_0x7fb533,_0x4698cb[_0xc669('0x19')][_0xc669('0x1b')]);return _0x1ad1ee(_0x4698cb['error'][_0xc669('0x1b')]);}logger['error'](_0xc669('0x1a'),_0x7fb533,_0x4698cb['error'][_0xc669('0x1b')]);return _0x2df384(_0x4698cb[_0xc669('0x19')][_0xc669('0x1b')]);}else{logger['info'](_0xc669('0x1a'),_0x7fb533,'request\x20sent');_0x2df384(_0x4698cb['result']['message']);}})[_0xc669('0x1c')](function(_0x640fa5){logger[_0xc669('0x19')]('FaxAccount,\x20%s,\x20%s',_0x7fb533,_0x640fa5);_0x1ad1ee(_0x640fa5);});});}exports['GetFaxAccount']=function(_0x559466){var _0x50d5fe=this;return new Promise(function(_0xe32275,_0x23ef21){return db['FaxAccount'][_0xc669('0x1d')]({'raw':_0x559466[_0xc669('0x1e')]?_0x559466[_0xc669('0x1e')][_0xc669('0x1f')]===undefined?!![]:![]:!![],'where':_0x559466[_0xc669('0x1e')]?_0x559466[_0xc669('0x1e')]['where']||null:null,'attributes':_0x559466[_0xc669('0x1e')]?_0x559466['options']['attributes']||null:null,'limit':_0x559466[_0xc669('0x1e')]?_0x559466['options'][_0xc669('0x20')]||null:null,'include':_0x559466[_0xc669('0x1e')]?_0x559466['options']['include']?_[_0xc669('0x21')](_0x559466[_0xc669('0x1e')][_0xc669('0x22')],function(_0x31e5d3){return{'model':db[_0x31e5d3['model']],'as':_0x31e5d3['as'],'attributes':_0x31e5d3[_0xc669('0x23')],'include':_0x31e5d3[_0xc669('0x22')]?_[_0xc669('0x21')](_0x31e5d3[_0xc669('0x22')],function(_0xce0204){return{'model':db[_0xce0204[_0xc669('0x24')]],'as':_0xce0204['as'],'attributes':_0xce0204[_0xc669('0x23')],'include':_0xce0204[_0xc669('0x22')]?_['map'](_0xce0204[_0xc669('0x22')],function(_0x507c68){return{'model':db[_0x507c68[_0xc669('0x24')]],'as':_0x507c68['as'],'attributes':_0x507c68['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x33b73e){logger[_0xc669('0x15')](_0xc669('0x25'),_0x559466);logger[_0xc669('0x16')](_0xc669('0x25'),_0x559466,JSON[_0xc669('0x18')](_0x33b73e));_0xe32275(_0x33b73e);})[_0xc669('0x1c')](function(_0x1b42e5){logger[_0xc669('0x19')](_0xc669('0x25'),_0x1b42e5[_0xc669('0x1b')],_0x559466);_0x23ef21(_0x50d5fe[_0xc669('0x19')](0x1f4,_0x1b42e5[_0xc669('0x1b')]));});});};exports[_0xc669('0x26')]=function(_0xe56d29,_0x1f159c,_0x5381fd){var _0x55610a=this;return new Promise(function(_0x1ec41a,_0xe64fb6){var _0x1ac9c0={'body':_0xe56d29[_0xc669('0x27')],'channel':'fax'};var _0x487e2d=[];var _0xe46b60=[];var _0x1fd8d3={};return db[_0xc669('0x28')][_0xc669('0x29')]()[_0xc669('0x14')](function(_0x3eca62){if(!_0x3eca62){throw new db['Sequelize'][(_0xc669('0x2a'))]('no\x20available\x20attributes');}_0x487e2d=_[_0xc669('0x2b')](_[_0xc669('0x2c')](_0x3eca62),[_0xc669('0x2d'),'updatedAt']);_0xe46b60=_['difference'](_['keys'](_0x3eca62),['createdAt','updatedAt',_0xc669('0x2e'),'ListId']);if(_0xe56d29[_0xc669('0x27')]['id']){delete _0xe56d29[_0xc669('0x27')]['id'];}if(_['isNil'](_0xe56d29[_0xc669('0x27')]['from'])){throw new db[(_0xc669('0x2f'))][(_0xc669('0x2a'))](_0xc669('0x30'));}if(_[_0xc669('0x31')](_0xe56d29[_0xc669('0x27')][_0xc669('0x27')])||_0xe56d29[_0xc669('0x27')][_0xc669('0x27')]===''){throw new db[(_0xc669('0x2f'))]['ValidationError'](_0xc669('0x32'));}if(_[_0xc669('0x31')](_0xe56d29[_0xc669('0x27')][_0xc669('0x33')])){throw new db['Sequelize']['ValidationError'](_0xc669('0x34')+_0xe46b60);}if(!_[_0xc669('0x35')](_0xe46b60,_0xe56d29[_0xc669('0x27')][_0xc669('0x33')])){throw new db['Sequelize'][(_0xc669('0x2a'))](_0xc669('0x36')+_0xe46b60);}_0x1fd8d3[_0xe56d29[_0xc669('0x27')][_0xc669('0x33')]]=_0xe56d29['body'][_0xc669('0x37')];})[_0xc669('0x14')](function(){return db[_0xc669('0x38')]['find']({'where':{'id':_0xe56d29['account']['id']},'include':[{'model':db[_0xc669('0x39')],'as':_0xc669('0x3a'),'include':[{'model':db[_0xc669('0x28')],'as':_0xc669('0x3b'),'where':_0x1fd8d3,'limit':0x1,'order':[[_0xc669('0x3c'),'DESC']]}]},{'model':db[_0xc669('0x3d')],'as':'Applications'}]});})[_0xc669('0x14')](function(_0x550061){if(_0x550061&&_0x550061['List']){var _0x442d1d=_0x550061[_0xc669('0x3e')]({'plain':!![]});_0x1ac9c0[_0xc669('0x3f')]=_0x442d1d;_0x1ac9c0['applications']=_0x442d1d[_0xc669('0x40')];_0x1ac9c0[_0xc669('0x41')]=_0x442d1d[_0xc669('0x3a')];_0x1ac9c0[_0xc669('0x42')]=_[_0xc669('0x43')](_0x1ac9c0[_0xc669('0x42')],[_0xc669('0x44')],[_0xc669('0x45')]);if(_0x1ac9c0[_0xc669('0x3f')][_0xc669('0x40')]){delete _0x1ac9c0[_0xc669('0x3f')]['Applications'];}if(_0x1ac9c0[_0xc669('0x3f')][_0xc669('0x3a')]&&_0x1ac9c0['account']['List'][_0xc669('0x3b')]['length']){return _0x1ac9c0[_0xc669('0x3f')][_0xc669('0x3a')][_0xc669('0x3b')][0x0];}var _0x9b246e=_[_0xc669('0xe')](_0xe56d29[_0xc669('0x27')],{'firstName':_0xe56d29[_0xc669('0x27')][_0xc669('0x37')],'ListId':_0x442d1d[_0xc669('0x46')]});_0x9b246e[_0xe56d29[_0xc669('0x27')][_0xc669('0x33')]]=_0xe56d29[_0xc669('0x27')][_0xc669('0x37')];return db[_0xc669('0x28')][_0xc669('0x47')](_0x9b246e,{'fields':_0x487e2d,'raw':!![]});}})[_0xc669('0x14')](function(_0x2df02e){_0x1ac9c0['contact']=_0x2df02e;if(_0x2df02e){var _0x61469d={'ContactId':_0x2df02e['id'],'FaxAccountId':_0xe56d29[_0xc669('0x3f')]['id'],'fax':_0x2df02e[_0xc669('0x48')]};return db['FaxInteraction'][_0xc669('0x49')]({'where':{'ContactId':_0x2df02e['id'],'closed':![],'FaxAccountId':_0xe56d29[_0xc669('0x3f')]['id']}})[_0xc669('0x14')](function(_0x4c3445){if(_0x4c3445){return[_0x4c3445,![]];}return db[_0xc669('0x4a')]['create'](_0x61469d)[_0xc669('0x14')](function(_0x5c0817){return[_0x5c0817,!![]];});});}else{throw new Error(_0xc669('0x4b'));}})[_0xc669('0x4c')](function(_0x59ec8c,_0x1f07cc){var _0x3bc8f5=_0x59ec8c[_0xc669('0x3e')]({'plain':!![]});if(_0x1f07cc){if(_0x1ac9c0[_0xc669('0x3f')][_0xc669('0x4d')]){_0x1ac9c0[_0xc669('0x42')][_0xc669('0x4e')]({'id':0x0,'priority':_0x1ac9c0[_0xc669('0x42')][_0xc669('0x4f')]+0x1,'app':_0xc669('0x50'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x3bc8f5[_0xc669('0x51')]=!![];}else{_0x3bc8f5['created']=![];}_0x1ac9c0[_0xc669('0x52')]=_0x3bc8f5;return db[_0xc669('0x53')][_0xc669('0x47')]({'body':_0xe56d29[_0xc669('0x27')]['body'],'FaxAccountId':_0xe56d29['account']['id'],'FaxInteractionId':_0x59ec8c['id'],'direction':'in','ContactId':_0x59ec8c[_0xc669('0x54')],'AttachmentId':_0xe56d29[_0xc669('0x27')][_0xc669('0x55')]});})[_0xc669('0x14')](function(_0x48d4bd){_0x1ac9c0[_0xc669('0x1b')]=_0x48d4bd;if(_0x1ac9c0[_0xc669('0x52')][_0xc669('0x56')]){return db[_0xc669('0x57')][_0xc669('0x49')]({'attributes':['id','name'],'where':{'id':_0x1ac9c0[_0xc669('0x52')][_0xc669('0x56')]}})[_0xc669('0x14')](function(_0x17de01){if(_0x17de01){_0x1ac9c0[_0xc669('0x42')][_0xc669('0x58')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x17de01[_0xc669('0x59')]+','+(_0x1ac9c0[_0xc669('0x3f')][_0xc669('0x5a')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x1ac9c0);});}return respondWithRpcPromise(_0xc669('0x5b'),_0xc669('0x5c'),_0x1ac9c0);})[_0xc669('0x14')](function(_0x5cecfa){_0x1ec41a(_0x5cecfa);})[_0xc669('0x1c')](function(_0x21b9ea){_0xe64fb6(_0x55610a[_0xc669('0x19')](0x1f4,_0x21b9ea[_0xc669('0x1b')]));});});}; \ No newline at end of file +var _0x48a8=['FaxApplication','Applications','applications','priority','length','contact','FaxInteraction','create','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FaxAccount','findAll','options','where','attributes','include','map','model','GetFaxAccount','stringify','NotifyFaxAccount','body','fax','CmContact','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','ListId','isNil','from','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts'];(function(_0xc9e9c2,_0x1d5696){var _0x36acfa=function(_0x44b114){while(--_0x44b114){_0xc9e9c2['push'](_0xc9e9c2['shift']());}};_0x36acfa(++_0x1d5696);}(_0x48a8,0x169));var _0x848a=function(_0x5582bd,_0x968636){_0x5582bd=_0x5582bd-0x0;var _0x517c97=_0x48a8[_0x5582bd];return _0x517c97;};'use strict';var _=require(_0x848a('0x0'));var util=require(_0x848a('0x1'));var moment=require(_0x848a('0x2'));var BPromise=require(_0x848a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x848a('0x4'))['db'];var utils=require(_0x848a('0x5'));var logger=require(_0x848a('0x6'))('rpc');var config=require(_0x848a('0x7'));var jayson=require(_0x848a('0x8'));var client=jayson[_0x848a('0x9')][_0x848a('0xa')]({'port':0x232c});config[_0x848a('0xb')]=_[_0x848a('0xc')](config[_0x848a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x848a('0xd'))(new Redis(config[_0x848a('0xb')]));require(_0x848a('0xe'))[_0x848a('0xf')](socket);function respondWithRpcPromise(_0x3b364e,_0x2738ba,_0x311d9c){return new BPromise(function(_0x145d6f,_0x473b87){return client['request'](_0x3b364e,_0x311d9c)[_0x848a('0x10')](function(_0x2953b7){logger[_0x848a('0x11')](_0x848a('0x12'),_0x2738ba,_0x848a('0x13'));logger[_0x848a('0x14')](_0x848a('0x15'),_0x2738ba,_0x848a('0x13'),JSON['stringify'](_0x2953b7));if(_0x2953b7['error']){if(_0x2953b7[_0x848a('0x16')][_0x848a('0x17')]===0x1f4){logger[_0x848a('0x16')](_0x848a('0x12'),_0x2738ba,_0x2953b7['error'][_0x848a('0x18')]);return _0x473b87(_0x2953b7['error'][_0x848a('0x18')]);}logger[_0x848a('0x16')](_0x848a('0x12'),_0x2738ba,_0x2953b7[_0x848a('0x16')][_0x848a('0x18')]);return _0x145d6f(_0x2953b7[_0x848a('0x16')][_0x848a('0x18')]);}else{logger[_0x848a('0x11')](_0x848a('0x12'),_0x2738ba,'request\x20sent');_0x145d6f(_0x2953b7[_0x848a('0x19')][_0x848a('0x18')]);}})[_0x848a('0x1a')](function(_0x1b58a6){logger[_0x848a('0x16')](_0x848a('0x12'),_0x2738ba,_0x1b58a6);_0x473b87(_0x1b58a6);});});}exports['GetFaxAccount']=function(_0x5b2227){var _0x2790a7=this;return new Promise(function(_0x354dcb,_0x4a84b7){return db[_0x848a('0x1b')][_0x848a('0x1c')]({'raw':_0x5b2227['options']?_0x5b2227[_0x848a('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5b2227[_0x848a('0x1d')]?_0x5b2227['options'][_0x848a('0x1e')]||null:null,'attributes':_0x5b2227[_0x848a('0x1d')]?_0x5b2227[_0x848a('0x1d')][_0x848a('0x1f')]||null:null,'limit':_0x5b2227[_0x848a('0x1d')]?_0x5b2227[_0x848a('0x1d')]['limit']||null:null,'include':_0x5b2227[_0x848a('0x1d')]?_0x5b2227[_0x848a('0x1d')][_0x848a('0x20')]?_[_0x848a('0x21')](_0x5b2227[_0x848a('0x1d')][_0x848a('0x20')],function(_0x4def45){return{'model':db[_0x4def45[_0x848a('0x22')]],'as':_0x4def45['as'],'attributes':_0x4def45['attributes'],'include':_0x4def45[_0x848a('0x20')]?_[_0x848a('0x21')](_0x4def45[_0x848a('0x20')],function(_0x47037a){return{'model':db[_0x47037a[_0x848a('0x22')]],'as':_0x47037a['as'],'attributes':_0x47037a['attributes'],'include':_0x47037a[_0x848a('0x20')]?_[_0x848a('0x21')](_0x47037a[_0x848a('0x20')],function(_0x3590c3){return{'model':db[_0x3590c3[_0x848a('0x22')]],'as':_0x3590c3['as'],'attributes':_0x3590c3[_0x848a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x124357){logger['info'](_0x848a('0x23'),_0x5b2227);logger[_0x848a('0x14')]('GetFaxAccount',_0x5b2227,JSON[_0x848a('0x24')](_0x124357));_0x354dcb(_0x124357);})[_0x848a('0x1a')](function(_0x26fe6b){logger[_0x848a('0x16')]('GetFaxAccount',_0x26fe6b[_0x848a('0x18')],_0x5b2227);_0x4a84b7(_0x2790a7[_0x848a('0x16')](0x1f4,_0x26fe6b[_0x848a('0x18')]));});});};exports[_0x848a('0x25')]=function(_0x42a7fd,_0x6b1343,_0x55ef34){var _0x4f1c0e=this;return new Promise(function(_0x572ab9,_0x4bef11){var _0x194927={'body':_0x42a7fd[_0x848a('0x26')],'channel':_0x848a('0x27')};var _0x2142aa=[];var _0x3a38ad=[];var _0x18f072={};return db[_0x848a('0x28')]['describe']()[_0x848a('0x10')](function(_0x360a0e){if(!_0x360a0e){throw new db['Sequelize'][(_0x848a('0x29'))](_0x848a('0x2a'));}_0x2142aa=_['difference'](_[_0x848a('0x2b')](_0x360a0e),[_0x848a('0x2c'),'updatedAt']);_0x3a38ad=_['difference'](_[_0x848a('0x2b')](_0x360a0e),[_0x848a('0x2c'),_0x848a('0x2d'),'CompanyId',_0x848a('0x2e')]);if(_0x42a7fd[_0x848a('0x26')]['id']){delete _0x42a7fd[_0x848a('0x26')]['id'];}if(_[_0x848a('0x2f')](_0x42a7fd['body'][_0x848a('0x30')])){throw new db[(_0x848a('0x31'))][(_0x848a('0x29'))]('from\x20is\x20mandatory');}if(_[_0x848a('0x2f')](_0x42a7fd[_0x848a('0x26')][_0x848a('0x26')])||_0x42a7fd['body'][_0x848a('0x26')]===''){throw new db[(_0x848a('0x31'))][(_0x848a('0x29'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x42a7fd[_0x848a('0x26')][_0x848a('0x32')])){throw new db[(_0x848a('0x31'))][(_0x848a('0x29'))](_0x848a('0x33')+_0x3a38ad);}if(!_[_0x848a('0x34')](_0x3a38ad,_0x42a7fd[_0x848a('0x26')][_0x848a('0x32')])){throw new db[(_0x848a('0x31'))][(_0x848a('0x29'))](_0x848a('0x35')+_0x3a38ad);}_0x18f072[_0x42a7fd[_0x848a('0x26')]['mapKey']]=_0x42a7fd[_0x848a('0x26')][_0x848a('0x30')];})[_0x848a('0x10')](function(){return db[_0x848a('0x1b')][_0x848a('0x36')]({'where':{'id':_0x42a7fd[_0x848a('0x37')]['id']},'include':[{'model':db[_0x848a('0x38')],'as':_0x848a('0x39'),'include':[{'model':db[_0x848a('0x28')],'as':_0x848a('0x3a'),'where':_0x18f072,'limit':0x1,'order':[[_0x848a('0x2d'),'DESC']]}]},{'model':db[_0x848a('0x3b')],'as':_0x848a('0x3c')}]});})[_0x848a('0x10')](function(_0x25a1d9){if(_0x25a1d9&&_0x25a1d9[_0x848a('0x39')]){var _0x375bf5=_0x25a1d9['get']({'plain':!![]});_0x194927[_0x848a('0x37')]=_0x375bf5;_0x194927['applications']=_0x375bf5['Applications'];_0x194927['list']=_0x375bf5[_0x848a('0x39')];_0x194927['applications']=_['orderBy'](_0x194927[_0x848a('0x3d')],[_0x848a('0x3e')],['asc']);if(_0x194927[_0x848a('0x37')][_0x848a('0x3c')]){delete _0x194927['account']['Applications'];}if(_0x194927[_0x848a('0x37')]['List']&&_0x194927[_0x848a('0x37')][_0x848a('0x39')][_0x848a('0x3a')][_0x848a('0x3f')]){return _0x194927['account'][_0x848a('0x39')][_0x848a('0x3a')][0x0];}var _0x309547=_['defaults'](_0x42a7fd[_0x848a('0x26')],{'firstName':_0x42a7fd[_0x848a('0x26')][_0x848a('0x30')],'ListId':_0x375bf5[_0x848a('0x2e')]});_0x309547[_0x42a7fd[_0x848a('0x26')][_0x848a('0x32')]]=_0x42a7fd[_0x848a('0x26')][_0x848a('0x30')];return db[_0x848a('0x28')]['create'](_0x309547,{'fields':_0x2142aa,'raw':!![]});}})[_0x848a('0x10')](function(_0x2f3a98){_0x194927[_0x848a('0x40')]=_0x2f3a98;if(_0x2f3a98){var _0x31a548={'ContactId':_0x2f3a98['id'],'FaxAccountId':_0x42a7fd['account']['id'],'fax':_0x2f3a98[_0x848a('0x27')]};return db['FaxInteraction'][_0x848a('0x36')]({'where':{'ContactId':_0x2f3a98['id'],'closed':![],'FaxAccountId':_0x42a7fd[_0x848a('0x37')]['id']}})[_0x848a('0x10')](function(_0x464729){if(_0x464729){return[_0x464729,![]];}return db[_0x848a('0x41')][_0x848a('0x42')](_0x31a548)[_0x848a('0x10')](function(_0xf5a57a){return[_0xf5a57a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x848a('0x43')](function(_0x2a0525,_0x19f40c){var _0x42ecc5=_0x2a0525['get']({'plain':!![]});if(_0x19f40c){if(_0x194927['account'][_0x848a('0x44')]){_0x194927['applications'][_0x848a('0x45')]({'id':0x0,'priority':_0x194927[_0x848a('0x3d')][_0x848a('0x3f')]+0x1,'app':_0x848a('0x46'),'appdata':_0x848a('0x47'),'interval':_0x848a('0x48')});}_0x42ecc5[_0x848a('0x49')]=!![];}else{_0x42ecc5[_0x848a('0x49')]=![];}_0x194927[_0x848a('0x4a')]=_0x42ecc5;return db[_0x848a('0x4b')][_0x848a('0x42')]({'body':_0x42a7fd[_0x848a('0x26')][_0x848a('0x26')],'FaxAccountId':_0x42a7fd[_0x848a('0x37')]['id'],'FaxInteractionId':_0x2a0525['id'],'direction':'in','ContactId':_0x2a0525[_0x848a('0x4c')],'AttachmentId':_0x42a7fd['body']['AttachmentId']});})[_0x848a('0x10')](function(_0x44437a){_0x194927[_0x848a('0x18')]=_0x44437a;if(_0x194927[_0x848a('0x4a')][_0x848a('0x4d')]){return db[_0x848a('0x4e')]['find']({'attributes':['id',_0x848a('0x4f')],'where':{'id':_0x194927[_0x848a('0x4a')][_0x848a('0x4d')]}})[_0x848a('0x10')](function(_0x148a51){if(_0x148a51){_0x194927['applications'][_0x848a('0x50')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x148a51[_0x848a('0x4f')]+','+(_0x194927[_0x848a('0x37')][_0x848a('0x51')]||0xa),'interval':_0x848a('0x48')});}return respondWithRpcPromise(_0x848a('0x52'),_0x848a('0x53'),_0x194927);});}return respondWithRpcPromise(_0x848a('0x52'),_0x848a('0x53'),_0x194927);})[_0x848a('0x10')](function(_0x5057f3){_0x572ab9(_0x5057f3);})['catch'](function(_0x59ee94){_0x4bef11(_0x4f1c0e[_0x848a('0x16')](0x1f4,_0x59ee94[_0x848a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 6175466..c348c86 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 _0xddc9=['remove','update','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x3494e8,_0x37e6e9){var _0x6bf55b=function(_0x3b0249){while(--_0x3b0249){_0x3494e8['push'](_0x3494e8['shift']());}};_0x6bf55b(++_0x37e6e9);}(_0xddc9,0xdf));var _0x9ddc=function(_0x39e376,_0x433bb4){_0x39e376=_0x39e376-0x0;var _0x580e9f=_0xddc9[_0x39e376];return _0x580e9f;};'use strict';var FaxAccountEvents=require(_0x9ddc('0x0'));var events=['save',_0x9ddc('0x1'),_0x9ddc('0x2')];function createListener(_0x471b7d,_0x33d380){return function(_0x6ce849){_0x33d380['emit'](_0x471b7d,_0x6ce849);};}function removeListener(_0x5c01e2,_0x350a){return function(){FaxAccountEvents[_0x9ddc('0x3')](_0x5c01e2,_0x350a);};}exports[_0x9ddc('0x4')]=function(_0x34044d){for(var _0x37fe58=0x0,_0x11b2eb=events[_0x9ddc('0x5')];_0x37fe58<_0x11b2eb;_0x37fe58++){var _0x43a729=events[_0x37fe58];var _0x316fd9=createListener(_0x9ddc('0x6')+_0x43a729,_0x34044d);FaxAccountEvents['on'](_0x43a729,_0x316fd9);}}; \ No newline at end of file +var _0x9a56=['faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener','register','length'];(function(_0x511b17,_0xe6b453){var _0x4fa333=function(_0x5f13e3){while(--_0x5f13e3){_0x511b17['push'](_0x511b17['shift']());}};_0x4fa333(++_0xe6b453);}(_0x9a56,0x157));var _0x69a5=function(_0x46e378,_0x37ad28){_0x46e378=_0x46e378-0x0;var _0x124224=_0x9a56[_0x46e378];return _0x124224;};'use strict';var FaxAccountEvents=require(_0x69a5('0x0'));var events=[_0x69a5('0x1'),_0x69a5('0x2'),_0x69a5('0x3')];function createListener(_0x29909c,_0x4d3e6c){return function(_0x236bd5){_0x4d3e6c[_0x69a5('0x4')](_0x29909c,_0x236bd5);};}function removeListener(_0x576f88,_0x1c8ad6){return function(){FaxAccountEvents[_0x69a5('0x5')](_0x576f88,_0x1c8ad6);};}exports[_0x69a5('0x6')]=function(_0x3061ed){for(var _0x29afa3=0x0,_0x204c7f=events[_0x69a5('0x7')];_0x29afa3<_0x204c7f;_0x29afa3++){var _0x3c38cd=events[_0x29afa3];var _0x39e70d=createListener(_0x69a5('0x8')+_0x3c38cd,_0x3061ed);FaxAccountEvents['on'](_0x3c38cd,_0x39e70d);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 17fb5f6..afa6e1b 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(_0x251b02,_0x38c0f7){var _0x14017c=function(_0x7a976a){while(--_0x7a976a){_0x251b02['push'](_0x251b02['shift']());}};_0x14017c(++_0x38c0f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x586e9d,_0x326859){var _0x173b38=function(_0x329f54){while(--_0x329f54){_0x586e9d['push'](_0x586e9d['shift']());}};_0x173b38(++_0x326859);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 87b6304..a2927fc 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 _0xef8e=['*,*,*,*','exports','INTEGER','noop','TEXT','STRING'];(function(_0x449fc1,_0x4384f9){var _0x3579b5=function(_0x3d2279){while(--_0x3d2279){_0x449fc1['push'](_0x449fc1['shift']());}};_0x3579b5(++_0x4384f9);}(_0xef8e,0x133));var _0xeef8=function(_0x5701d3,_0x275825){_0x5701d3=_0x5701d3-0x0;var _0x12a4c6=_0xef8e[_0x5701d3];return _0x12a4c6;};'use strict';var Sequelize=require('sequelize');module[_0xeef8('0x0')]={'priority':{'type':Sequelize[_0xeef8('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeef8('0x2')},'appdata':{'type':Sequelize[_0xeef8('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xeef8('0x4')],'defaultValue':_0xeef8('0x5')}}; \ No newline at end of file +var _0xf5f7=['STRING','TEXT','sequelize','INTEGER'];(function(_0x174390,_0x587f57){var _0x1ea387=function(_0x194067){while(--_0x194067){_0x174390['push'](_0x174390['shift']());}};_0x1ea387(++_0x587f57);}(_0xf5f7,0xc6));var _0x7f5f=function(_0x1fdb45,_0x473729){_0x1fdb45=_0x1fdb45-0x0;var _0x4ae11c=_0xf5f7[_0x1fdb45];return _0x4ae11c;};'use strict';var Sequelize=require(_0x7f5f('0x0'));module['exports']={'priority':{'type':Sequelize[_0x7f5f('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7f5f('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7f5f('0x3')]()},'description':{'type':Sequelize[_0x7f5f('0x2')]},'interval':{'type':Sequelize[_0x7f5f('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 094fb3b..8bf2670 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 _0xdcc9=['json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxApplication','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','options','find','catch','create','body','eml-format','rimraf','request-promise','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x1771e7,_0x2a12e3){var _0x3edb12=function(_0x50d464){while(--_0x50d464){_0x1771e7['push'](_0x1771e7['shift']());}};_0x3edb12(++_0x2a12e3);}(_0xdcc9,0x192));var _0x9dcc=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0xdcc9[_0x3f5dca];return _0x5b833a;};'use strict';var emlformat=require(_0x9dcc('0x0'));var rimraf=require(_0x9dcc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9dcc('0x2'));var moment=require('moment');var BPromise=require(_0x9dcc('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9dcc('0x4'));var csv=require('to-csv');var ejs=require(_0x9dcc('0x5'));var fs=require('fs');var fs_extra=require(_0x9dcc('0x6'));var _=require(_0x9dcc('0x7'));var squel=require(_0x9dcc('0x8'));var crypto=require(_0x9dcc('0x9'));var jsforce=require(_0x9dcc('0xa'));var deskjs=require(_0x9dcc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9dcc('0xc'));var Papa=require(_0x9dcc('0xd'));var Redis=require(_0x9dcc('0xe'));var authService=require(_0x9dcc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9dcc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9dcc('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x9dcc('0x12'));var licenseUtil=require(_0x9dcc('0x13'));var db=require(_0x9dcc('0x14'))['db'];function respondWithStatusCode(_0x1b4d1f,_0x48ced3){_0x48ced3=_0x48ced3||0xcc;return function(_0x47fbbc){if(_0x47fbbc){return _0x1b4d1f[_0x9dcc('0x15')](_0x48ced3);}return _0x1b4d1f[_0x9dcc('0x16')](_0x48ced3)[_0x9dcc('0x17')]();};}function respondWithResult(_0x3ecd4b,_0x299596){_0x299596=_0x299596||0xc8;return function(_0x1c2c7f){if(_0x1c2c7f){return _0x3ecd4b['status'](_0x299596)[_0x9dcc('0x18')](_0x1c2c7f);}};}function respondWithFilteredResult(_0xc99bc0,_0x106051){return function(_0x62261){if(_0x62261){var _0x268eb7=typeof _0x106051['offset']===_0x9dcc('0x19')&&typeof _0x106051[_0x9dcc('0x1a')]===_0x9dcc('0x19');var _0x1e955c=_0x62261[_0x9dcc('0x1b')];var _0x36bd42=_0x268eb7?0x0:_0x106051[_0x9dcc('0x1c')];var _0x6de793=_0x268eb7?_0x62261['count']:_0x106051[_0x9dcc('0x1c')]+_0x106051[_0x9dcc('0x1a')];var _0x50ce1c;if(_0x6de793>=_0x1e955c){_0x6de793=_0x1e955c;_0x50ce1c=0xc8;}else{_0x50ce1c=0xce;}_0xc99bc0['status'](_0x50ce1c);return _0xc99bc0[_0x9dcc('0x1d')](_0x9dcc('0x1e'),_0x36bd42+'-'+_0x6de793+'/'+_0x1e955c)[_0x9dcc('0x18')](_0x62261);}return null;};}function patchUpdates(_0x40dac5){return function(_0xc95331){try{jsonpatch['apply'](_0xc95331,_0x40dac5,!![]);}catch(_0x38a273){return BPromise[_0x9dcc('0x1f')](_0x38a273);}return _0xc95331[_0x9dcc('0x20')]();};}function saveUpdates(_0x3ddfa2,_0x32fe0d){return function(_0x30883d){if(_0x30883d){return _0x30883d[_0x9dcc('0x21')](_0x3ddfa2)[_0x9dcc('0x22')](function(_0x155d04){return _0x155d04;});}return null;};}function removeEntity(_0x542a80,_0x40363b){return function(_0x367d3){if(_0x367d3){return _0x367d3[_0x9dcc('0x23')]()[_0x9dcc('0x22')](function(){_0x542a80[_0x9dcc('0x16')](0xcc)[_0x9dcc('0x17')]();});}};}function handleEntityNotFound(_0x6223a9,_0x265593){return function(_0x4280a4){if(!_0x4280a4){_0x6223a9[_0x9dcc('0x15')](0x194);}return _0x4280a4;};}function handleError(_0x18bc9a,_0x753f7c){_0x753f7c=_0x753f7c||0x1f4;return function(_0x2bea14){logger[_0x9dcc('0x24')](_0x2bea14[_0x9dcc('0x25')]);if(_0x2bea14['name']){delete _0x2bea14[_0x9dcc('0x26')];}_0x18bc9a[_0x9dcc('0x16')](_0x753f7c)[_0x9dcc('0x27')](_0x2bea14);};}exports[_0x9dcc('0x28')]=function(_0x243ba8,_0x2e3f4b){var _0xa5b026={},_0x49ec90={},_0x1cdef2={'count':0x0,'rows':[]};var _0x590cfa=_[_0x9dcc('0x29')](db[_0x9dcc('0x2a')]['rawAttributes'],function(_0x5cb57f){return{'name':_0x5cb57f['fieldName'],'type':_0x5cb57f['type']['key']};});_0x49ec90['model']=_['map'](_0x590cfa,'name');_0x49ec90['query']=_[_0x9dcc('0x2b')](_0x243ba8[_0x9dcc('0x2c')]);_0x49ec90['filters']=_['intersection'](_0x49ec90[_0x9dcc('0x2d')],_0x49ec90[_0x9dcc('0x2c')]);_0xa5b026[_0x9dcc('0x2e')]=_[_0x9dcc('0x2f')](_0x49ec90['model'],qs[_0x9dcc('0x30')](_0x243ba8[_0x9dcc('0x2c')][_0x9dcc('0x30')]));_0xa5b026[_0x9dcc('0x2e')]=_0xa5b026[_0x9dcc('0x2e')][_0x9dcc('0x31')]?_0xa5b026[_0x9dcc('0x2e')]:_0x49ec90['model'];if(!_0x243ba8[_0x9dcc('0x2c')][_0x9dcc('0x32')](_0x9dcc('0x33'))){_0xa5b026[_0x9dcc('0x1a')]=qs['limit'](_0x243ba8[_0x9dcc('0x2c')]['limit']);_0xa5b026[_0x9dcc('0x1c')]=qs[_0x9dcc('0x1c')](_0x243ba8[_0x9dcc('0x2c')][_0x9dcc('0x1c')]);}_0xa5b026[_0x9dcc('0x34')]=qs[_0x9dcc('0x35')](_0x243ba8[_0x9dcc('0x2c')][_0x9dcc('0x35')]);_0xa5b026['where']=qs[_0x9dcc('0x36')](_[_0x9dcc('0x37')](_0x243ba8['query'],_0x49ec90[_0x9dcc('0x36')]),_0x590cfa);if(_0x243ba8[_0x9dcc('0x2c')][_0x9dcc('0x38')]){_0xa5b026[_0x9dcc('0x39')]=_[_0x9dcc('0x3a')](_0xa5b026[_0x9dcc('0x39')],{'$or':_[_0x9dcc('0x29')](_0x590cfa,function(_0x2dec36){if(_0x2dec36[_0x9dcc('0x3b')]!==_0x9dcc('0x3c')){var _0x323de2={};_0x323de2[_0x2dec36[_0x9dcc('0x26')]]={'$like':'%'+_0x243ba8[_0x9dcc('0x2c')][_0x9dcc('0x38')]+'%'};return _0x323de2;}})});}_0xa5b026=_[_0x9dcc('0x3a')]({},_0xa5b026,_0x243ba8['options']);var _0x436016={'where':_0xa5b026['where']};return db['FaxApplication'][_0x9dcc('0x1b')](_0x436016)[_0x9dcc('0x22')](function(_0x24ab8f){_0x1cdef2[_0x9dcc('0x1b')]=_0x24ab8f;if(_0x243ba8[_0x9dcc('0x2c')][_0x9dcc('0x3d')]){_0xa5b026['include']=[{'all':!![]}];}return db[_0x9dcc('0x2a')][_0x9dcc('0x3e')](_0xa5b026);})[_0x9dcc('0x22')](function(_0x6724a6){_0x1cdef2[_0x9dcc('0x3f')]=_0x6724a6;return _0x1cdef2;})[_0x9dcc('0x22')](respondWithFilteredResult(_0x2e3f4b,_0xa5b026))['catch'](handleError(_0x2e3f4b,null));};exports[_0x9dcc('0x40')]=function(_0x3a58fe,_0x55ca37){var _0x203f78={'raw':!![],'where':{'id':_0x3a58fe[_0x9dcc('0x41')]['id']}},_0x34033c={};_0x34033c[_0x9dcc('0x2d')]=_[_0x9dcc('0x2b')](db[_0x9dcc('0x2a')]['rawAttributes']);_0x34033c['query']=_['keys'](_0x3a58fe[_0x9dcc('0x2c')]);_0x34033c[_0x9dcc('0x36')]=_[_0x9dcc('0x2f')](_0x34033c['model'],_0x34033c[_0x9dcc('0x2c')]);_0x203f78[_0x9dcc('0x2e')]=_['intersection'](_0x34033c['model'],qs[_0x9dcc('0x30')](_0x3a58fe[_0x9dcc('0x2c')]['fields']));_0x203f78[_0x9dcc('0x2e')]=_0x203f78[_0x9dcc('0x2e')]['length']?_0x203f78[_0x9dcc('0x2e')]:_0x34033c[_0x9dcc('0x2d')];if(_0x3a58fe[_0x9dcc('0x2c')][_0x9dcc('0x3d')]){_0x203f78['include']=[{'all':!![]}];}_0x203f78=_[_0x9dcc('0x3a')]({},_0x203f78,_0x3a58fe[_0x9dcc('0x42')]);return db[_0x9dcc('0x2a')][_0x9dcc('0x43')](_0x203f78)[_0x9dcc('0x22')](handleEntityNotFound(_0x55ca37,null))['then'](respondWithResult(_0x55ca37,null))[_0x9dcc('0x44')](handleError(_0x55ca37,null));};exports[_0x9dcc('0x45')]=function(_0x577601,_0x8cfea8){return db[_0x9dcc('0x2a')][_0x9dcc('0x45')](_0x577601[_0x9dcc('0x46')],{})['then'](respondWithResult(_0x8cfea8,0xc9))[_0x9dcc('0x44')](handleError(_0x8cfea8,null));};exports[_0x9dcc('0x21')]=function(_0x51281e,_0x2bcaef){if(_0x51281e[_0x9dcc('0x46')]['id']){delete _0x51281e[_0x9dcc('0x46')]['id'];}return db['FaxApplication'][_0x9dcc('0x43')]({'where':{'id':_0x51281e[_0x9dcc('0x41')]['id']}})[_0x9dcc('0x22')](handleEntityNotFound(_0x2bcaef,null))[_0x9dcc('0x22')](saveUpdates(_0x51281e[_0x9dcc('0x46')],null))['then'](respondWithResult(_0x2bcaef,null))[_0x9dcc('0x44')](handleError(_0x2bcaef,null));};exports[_0x9dcc('0x23')]=function(_0x57b85c,_0x132a00){return db['FaxApplication'][_0x9dcc('0x43')]({'where':{'id':_0x57b85c[_0x9dcc('0x41')]['id']}})['then'](handleEntityNotFound(_0x132a00,null))[_0x9dcc('0x22')](removeEntity(_0x132a00,null))['catch'](handleError(_0x132a00,null));}; \ No newline at end of file +var _0x9547=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','index','map','FaxApplication','type','key','name','query','keys','intersection','model','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x9547,0x163));var _0x7954=function(_0x41fab4,_0x1214b8){_0x41fab4=_0x41fab4-0x0;var _0x3601a3=_0x9547[_0x41fab4];return _0x3601a3;};'use strict';var emlformat=require(_0x7954('0x0'));var rimraf=require(_0x7954('0x1'));var zipdir=require(_0x7954('0x2'));var jsonpatch=require(_0x7954('0x3'));var rp=require(_0x7954('0x4'));var moment=require('moment');var BPromise=require(_0x7954('0x5'));var Mustache=require(_0x7954('0x6'));var util=require('util');var path=require(_0x7954('0x7'));var sox=require(_0x7954('0x8'));var csv=require('to-csv');var ejs=require(_0x7954('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7954('0xa'));var squel=require(_0x7954('0xb'));var crypto=require(_0x7954('0xc'));var jsforce=require(_0x7954('0xd'));var deskjs=require(_0x7954('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7954('0xf'));var Redis=require(_0x7954('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7954('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7954('0x12'));var logger=require('../../config/logger')(_0x7954('0x13'));var utils=require(_0x7954('0x14'));var config=require(_0x7954('0x15'));var licenseUtil=require(_0x7954('0x16'));var db=require(_0x7954('0x17'))['db'];function respondWithStatusCode(_0x13a982,_0x20ba1a){_0x20ba1a=_0x20ba1a||0xcc;return function(_0x1081f6){if(_0x1081f6){return _0x13a982[_0x7954('0x18')](_0x20ba1a);}return _0x13a982[_0x7954('0x19')](_0x20ba1a)[_0x7954('0x1a')]();};}function respondWithResult(_0x555e97,_0x1c1c5e){_0x1c1c5e=_0x1c1c5e||0xc8;return function(_0x41c5b1){if(_0x41c5b1){return _0x555e97[_0x7954('0x19')](_0x1c1c5e)[_0x7954('0x1b')](_0x41c5b1);}};}function respondWithFilteredResult(_0x32cd6d,_0x5b307c){return function(_0x2cf5d2){if(_0x2cf5d2){var _0x15d7ae=typeof _0x5b307c[_0x7954('0x1c')]===_0x7954('0x1d')&&typeof _0x5b307c[_0x7954('0x1e')]===_0x7954('0x1d');var _0x25df6b=_0x2cf5d2[_0x7954('0x1f')];var _0x509a9f=_0x15d7ae?0x0:_0x5b307c[_0x7954('0x1c')];var _0x1b4d27=_0x15d7ae?_0x2cf5d2['count']:_0x5b307c['offset']+_0x5b307c[_0x7954('0x1e')];var _0x10041c;if(_0x1b4d27>=_0x25df6b){_0x1b4d27=_0x25df6b;_0x10041c=0xc8;}else{_0x10041c=0xce;}_0x32cd6d['status'](_0x10041c);return _0x32cd6d[_0x7954('0x20')](_0x7954('0x21'),_0x509a9f+'-'+_0x1b4d27+'/'+_0x25df6b)[_0x7954('0x1b')](_0x2cf5d2);}return null;};}function patchUpdates(_0x8167f1){return function(_0xd529e4){try{jsonpatch[_0x7954('0x22')](_0xd529e4,_0x8167f1,!![]);}catch(_0x3acadb){return BPromise[_0x7954('0x23')](_0x3acadb);}return _0xd529e4[_0x7954('0x24')]();};}function saveUpdates(_0x3d37ad,_0x56c8d1){return function(_0x5edc55){if(_0x5edc55){return _0x5edc55[_0x7954('0x25')](_0x3d37ad)[_0x7954('0x26')](function(_0x319933){return _0x319933;});}return null;};}function removeEntity(_0x3c7991,_0x3d2da0){return function(_0x444f7b){if(_0x444f7b){return _0x444f7b[_0x7954('0x27')]()[_0x7954('0x26')](function(){_0x3c7991[_0x7954('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33c9c0,_0x173812){return function(_0x1506d5){if(!_0x1506d5){_0x33c9c0['sendStatus'](0x194);}return _0x1506d5;};}function handleError(_0x26386c,_0x50605f){_0x50605f=_0x50605f||0x1f4;return function(_0x1e0385){logger['error'](_0x1e0385[_0x7954('0x28')]);if(_0x1e0385['name']){delete _0x1e0385['name'];}_0x26386c['status'](_0x50605f)[_0x7954('0x29')](_0x1e0385);};}exports[_0x7954('0x2a')]=function(_0xb5810e,_0x347e92){var _0x232869={},_0x46915a={},_0x4df4a9={'count':0x0,'rows':[]};var _0x38bbe6=_[_0x7954('0x2b')](db[_0x7954('0x2c')]['rawAttributes'],function(_0x285314){return{'name':_0x285314['fieldName'],'type':_0x285314[_0x7954('0x2d')][_0x7954('0x2e')]};});_0x46915a['model']=_['map'](_0x38bbe6,_0x7954('0x2f'));_0x46915a[_0x7954('0x30')]=_[_0x7954('0x31')](_0xb5810e[_0x7954('0x30')]);_0x46915a['filters']=_[_0x7954('0x32')](_0x46915a[_0x7954('0x33')],_0x46915a['query']);_0x232869['attributes']=_[_0x7954('0x32')](_0x46915a['model'],qs[_0x7954('0x34')](_0xb5810e[_0x7954('0x30')][_0x7954('0x34')]));_0x232869[_0x7954('0x35')]=_0x232869[_0x7954('0x35')][_0x7954('0x36')]?_0x232869['attributes']:_0x46915a['model'];if(!_0xb5810e[_0x7954('0x30')]['hasOwnProperty'](_0x7954('0x37'))){_0x232869[_0x7954('0x1e')]=qs[_0x7954('0x1e')](_0xb5810e['query']['limit']);_0x232869[_0x7954('0x1c')]=qs[_0x7954('0x1c')](_0xb5810e[_0x7954('0x30')][_0x7954('0x1c')]);}_0x232869['order']=qs[_0x7954('0x38')](_0xb5810e['query']['sort']);_0x232869[_0x7954('0x39')]=qs[_0x7954('0x3a')](_[_0x7954('0x3b')](_0xb5810e['query'],_0x46915a[_0x7954('0x3a')]),_0x38bbe6);if(_0xb5810e[_0x7954('0x30')][_0x7954('0x3c')]){_0x232869[_0x7954('0x39')]=_[_0x7954('0x3d')](_0x232869[_0x7954('0x39')],{'$or':_[_0x7954('0x2b')](_0x38bbe6,function(_0x3e6067){if(_0x3e6067['type']!==_0x7954('0x3e')){var _0x8368f9={};_0x8368f9[_0x3e6067[_0x7954('0x2f')]]={'$like':'%'+_0xb5810e['query'][_0x7954('0x3c')]+'%'};return _0x8368f9;}})});}_0x232869=_[_0x7954('0x3d')]({},_0x232869,_0xb5810e[_0x7954('0x3f')]);var _0x90c9db={'where':_0x232869['where']};return db[_0x7954('0x2c')]['count'](_0x90c9db)[_0x7954('0x26')](function(_0x4535f4){_0x4df4a9[_0x7954('0x1f')]=_0x4535f4;if(_0xb5810e[_0x7954('0x30')]['includeAll']){_0x232869[_0x7954('0x40')]=[{'all':!![]}];}return db[_0x7954('0x2c')][_0x7954('0x41')](_0x232869);})['then'](function(_0x5a9a2d){_0x4df4a9[_0x7954('0x42')]=_0x5a9a2d;return _0x4df4a9;})[_0x7954('0x26')](respondWithFilteredResult(_0x347e92,_0x232869))[_0x7954('0x43')](handleError(_0x347e92,null));};exports[_0x7954('0x44')]=function(_0x36efda,_0x5b667e){var _0x4f4413={'raw':!![],'where':{'id':_0x36efda[_0x7954('0x45')]['id']}},_0x431fdc={};_0x431fdc[_0x7954('0x33')]=_['keys'](db[_0x7954('0x2c')]['rawAttributes']);_0x431fdc['query']=_['keys'](_0x36efda[_0x7954('0x30')]);_0x431fdc['filters']=_[_0x7954('0x32')](_0x431fdc[_0x7954('0x33')],_0x431fdc[_0x7954('0x30')]);_0x4f4413[_0x7954('0x35')]=_[_0x7954('0x32')](_0x431fdc[_0x7954('0x33')],qs['fields'](_0x36efda[_0x7954('0x30')]['fields']));_0x4f4413[_0x7954('0x35')]=_0x4f4413[_0x7954('0x35')]['length']?_0x4f4413[_0x7954('0x35')]:_0x431fdc[_0x7954('0x33')];if(_0x36efda['query'][_0x7954('0x46')]){_0x4f4413[_0x7954('0x40')]=[{'all':!![]}];}_0x4f4413=_[_0x7954('0x3d')]({},_0x4f4413,_0x36efda[_0x7954('0x3f')]);return db['FaxApplication'][_0x7954('0x47')](_0x4f4413)[_0x7954('0x26')](handleEntityNotFound(_0x5b667e,null))['then'](respondWithResult(_0x5b667e,null))[_0x7954('0x43')](handleError(_0x5b667e,null));};exports['create']=function(_0x36532c,_0x4ee196){return db[_0x7954('0x2c')][_0x7954('0x48')](_0x36532c[_0x7954('0x49')],{})[_0x7954('0x26')](respondWithResult(_0x4ee196,0xc9))[_0x7954('0x43')](handleError(_0x4ee196,null));};exports[_0x7954('0x25')]=function(_0x5957ab,_0xacfa64){if(_0x5957ab[_0x7954('0x49')]['id']){delete _0x5957ab['body']['id'];}return db[_0x7954('0x2c')]['find']({'where':{'id':_0x5957ab['params']['id']}})['then'](handleEntityNotFound(_0xacfa64,null))['then'](saveUpdates(_0x5957ab[_0x7954('0x49')],null))['then'](respondWithResult(_0xacfa64,null))[_0x7954('0x43')](handleError(_0xacfa64,null));};exports[_0x7954('0x27')]=function(_0x99acd2,_0x2b721d){return db['FaxApplication']['find']({'where':{'id':_0x99acd2[_0x7954('0x45')]['id']}})[_0x7954('0x26')](handleEntityNotFound(_0x2b721d,null))[_0x7954('0x26')](removeEntity(_0x2b721d,null))[_0x7954('0x43')](handleError(_0x2b721d,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 8d4a72a..1bc024a 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 _0x2ca6=['exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','rimraf','./faxApplication.attributes'];(function(_0x569b7a,_0x377a61){var _0x39d00a=function(_0x1ee0bc){while(--_0x1ee0bc){_0x569b7a['push'](_0x569b7a['shift']());}};_0x39d00a(++_0x377a61);}(_0x2ca6,0x10d));var _0x62ca=function(_0x2c4ac5,_0x330f0f){_0x2c4ac5=_0x2c4ac5-0x0;var _0xaf3ef4=_0x2ca6[_0x2c4ac5];return _0xaf3ef4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x62ca('0x0'))(_0x62ca('0x1'));var moment=require(_0x62ca('0x2'));var BPromise=require('bluebird');var rp=require(_0x62ca('0x3'));var fs=require('fs');var path=require(_0x62ca('0x4'));var rimraf=require(_0x62ca('0x5'));var config=require('../../config/environment');var attributes=require(_0x62ca('0x6'));module[_0x62ca('0x7')]=function(_0xbdf552,_0x1bfc65){return _0xbdf552[_0x62ca('0x8')]('FaxApplication',attributes,{'tableName':_0x62ca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x62ca('0xa'),'collate':_0x62ca('0xb')});}; \ No newline at end of file +var _0xc1ff=['./faxApplication.attributes','exports','define','FaxApplication','fax_applications','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4cdad7,_0x4de804){var _0x3e23cf=function(_0x4e5085){while(--_0x4e5085){_0x4cdad7['push'](_0x4cdad7['shift']());}};_0x3e23cf(++_0x4de804);}(_0xc1ff,0x109));var _0xfc1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1ff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfc1f('0x0'))(_0xfc1f('0x1'));var moment=require(_0xfc1f('0x2'));var BPromise=require(_0xfc1f('0x3'));var rp=require(_0xfc1f('0x4'));var fs=require('fs');var path=require(_0xfc1f('0x5'));var rimraf=require(_0xfc1f('0x6'));var config=require(_0xfc1f('0x7'));var attributes=require(_0xfc1f('0x8'));module[_0xfc1f('0x9')]=function(_0x4d8327,_0x50953c){return _0x4d8327[_0xfc1f('0xa')](_0xfc1f('0xb'),attributes,{'tableName':_0xfc1f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 0e101e5..fa25d25 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 _0xd7a2=['where','attributes','limit','UpdateFaxApplication','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','FaxApplication','update','body','options','raw'];(function(_0x1446a1,_0x3a566f){var _0x123f09=function(_0x1c53a5){while(--_0x1c53a5){_0x1446a1['push'](_0x1446a1['shift']());}};_0x123f09(++_0x3a566f);}(_0xd7a2,0x18a));var _0x2d7a=function(_0x22fe35,_0x35e23d){_0x22fe35=_0x22fe35-0x0;var _0xe1774b=_0xd7a2[_0x22fe35];return _0xe1774b;};'use strict';var _=require(_0x2d7a('0x0'));var util=require(_0x2d7a('0x1'));var moment=require(_0x2d7a('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d7a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d7a('0x4'));var logger=require(_0x2d7a('0x5'))(_0x2d7a('0x6'));var config=require(_0x2d7a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2d7a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x256c1b,_0x3bfd47,_0x18ea3f){return new BPromise(function(_0x4d9381,_0x50f261){return client['request'](_0x256c1b,_0x18ea3f)[_0x2d7a('0x9')](function(_0x1fea14){logger[_0x2d7a('0xa')]('FaxApplication,\x20%s,\x20%s',_0x3bfd47,_0x2d7a('0xb'));logger[_0x2d7a('0xc')](_0x2d7a('0xd'),_0x3bfd47,_0x2d7a('0xb'),JSON[_0x2d7a('0xe')](_0x1fea14));if(_0x1fea14[_0x2d7a('0xf')]){if(_0x1fea14[_0x2d7a('0xf')][_0x2d7a('0x10')]===0x1f4){logger[_0x2d7a('0xf')](_0x2d7a('0x11'),_0x3bfd47,_0x1fea14['error']['message']);return _0x50f261(_0x1fea14[_0x2d7a('0xf')][_0x2d7a('0x12')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x3bfd47,_0x1fea14[_0x2d7a('0xf')][_0x2d7a('0x12')]);return _0x4d9381(_0x1fea14[_0x2d7a('0xf')][_0x2d7a('0x12')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x3bfd47,_0x2d7a('0xb'));_0x4d9381(_0x1fea14[_0x2d7a('0x13')][_0x2d7a('0x12')]);}})[_0x2d7a('0x14')](function(_0x369276){logger['error']('FaxApplication,\x20%s,\x20%s',_0x3bfd47,_0x369276);_0x50f261(_0x369276);});});}exports['UpdateFaxApplication']=function(_0x573a17){var _0x5f4faf=this;return new Promise(function(_0x3df8a8,_0x51fea5){return db[_0x2d7a('0x15')][_0x2d7a('0x16')](_0x573a17[_0x2d7a('0x17')],{'raw':_0x573a17[_0x2d7a('0x18')]?_0x573a17[_0x2d7a('0x18')][_0x2d7a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x573a17[_0x2d7a('0x18')]?_0x573a17['options'][_0x2d7a('0x1a')]||null:null,'attributes':_0x573a17['options']?_0x573a17['options'][_0x2d7a('0x1b')]||null:null,'limit':_0x573a17[_0x2d7a('0x18')]?_0x573a17['options'][_0x2d7a('0x1c')]||null:null})['then'](function(_0x4ac117){logger['info'](_0x2d7a('0x1d'),_0x573a17);logger[_0x2d7a('0xc')](_0x2d7a('0x1d'),_0x573a17,JSON[_0x2d7a('0xe')](_0x4ac117));_0x3df8a8(_0x4ac117);})[_0x2d7a('0x14')](function(_0x3bf93a){logger[_0x2d7a('0xf')](_0x2d7a('0x1d'),_0x3bf93a['message'],_0x573a17);_0x51fea5(_0x5f4faf['error'](0x1f4,_0x3bf93a[_0x2d7a('0x12')]));});});}; \ No newline at end of file +var _0xe73c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','FaxApplication,\x20%s,\x20%s','message','result','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','limit','debug','stringify','lodash','util','moment','bluebird'];(function(_0x52d104,_0x14d410){var _0x490160=function(_0x1be73b){while(--_0x1be73b){_0x52d104['push'](_0x52d104['shift']());}};_0x490160(++_0x14d410);}(_0xe73c,0x167));var _0xce73=function(_0x430914,_0x5343bc){_0x430914=_0x430914-0x0;var _0x3ecf61=_0xe73c[_0x430914];return _0x3ecf61;};'use strict';var _=require(_0xce73('0x0'));var util=require(_0xce73('0x1'));var moment=require(_0xce73('0x2'));var BPromise=require(_0xce73('0x3'));var rs=require(_0xce73('0x4'));var fs=require('fs');var Redis=require(_0xce73('0x5'));var db=require(_0xce73('0x6'))['db'];var utils=require(_0xce73('0x7'));var logger=require(_0xce73('0x8'))(_0xce73('0x9'));var config=require(_0xce73('0xa'));var jayson=require(_0xce73('0xb'));var client=jayson[_0xce73('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22667a,_0x5f2380,_0x4572c5){return new BPromise(function(_0x10096f,_0x27e5b7){return client[_0xce73('0xd')](_0x22667a,_0x4572c5)[_0xce73('0xe')](function(_0x5611af){logger[_0xce73('0xf')]('FaxApplication,\x20%s,\x20%s',_0x5f2380,_0xce73('0x10'));logger['debug'](_0xce73('0x11'),_0x5f2380,_0xce73('0x10'),JSON['stringify'](_0x5611af));if(_0x5611af[_0xce73('0x12')]){if(_0x5611af[_0xce73('0x12')][_0xce73('0x13')]===0x1f4){logger[_0xce73('0x12')](_0xce73('0x14'),_0x5f2380,_0x5611af['error'][_0xce73('0x15')]);return _0x27e5b7(_0x5611af[_0xce73('0x12')]['message']);}logger['error'](_0xce73('0x14'),_0x5f2380,_0x5611af['error'][_0xce73('0x15')]);return _0x10096f(_0x5611af['error'][_0xce73('0x15')]);}else{logger[_0xce73('0xf')](_0xce73('0x14'),_0x5f2380,'request\x20sent');_0x10096f(_0x5611af[_0xce73('0x16')][_0xce73('0x15')]);}})['catch'](function(_0xc832ad){logger[_0xce73('0x12')](_0xce73('0x14'),_0x5f2380,_0xc832ad);_0x27e5b7(_0xc832ad);});});}exports[_0xce73('0x17')]=function(_0x49457d){var _0x24ae3f=this;return new Promise(function(_0xd37879,_0x25eed8){return db[_0xce73('0x18')]['update'](_0x49457d[_0xce73('0x19')],{'raw':_0x49457d[_0xce73('0x1a')]?_0x49457d[_0xce73('0x1a')][_0xce73('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49457d[_0xce73('0x1a')]?_0x49457d[_0xce73('0x1a')][_0xce73('0x1c')]||null:null,'attributes':_0x49457d['options']?_0x49457d[_0xce73('0x1a')][_0xce73('0x1d')]||null:null,'limit':_0x49457d[_0xce73('0x1a')]?_0x49457d[_0xce73('0x1a')][_0xce73('0x1e')]||null:null})[_0xce73('0xe')](function(_0x1bf769){logger['info'](_0xce73('0x17'),_0x49457d);logger[_0xce73('0x1f')](_0xce73('0x17'),_0x49457d,JSON[_0xce73('0x20')](_0x1bf769));_0xd37879(_0x1bf769);})['catch'](function(_0x2d8573){logger[_0xce73('0x12')](_0xce73('0x17'),_0x2d8573[_0xce73('0x15')],_0x49457d);_0x25eed8(_0x24ae3f[_0xce73('0x12')](0x1f4,_0x2d8573[_0xce73('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 8ccfbf8..e128598 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c00=['delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x5c332e,_0x548df0){var _0x2aa206=function(_0x48969c){while(--_0x48969c){_0x5c332e['push'](_0x5c332e['shift']());}};_0x2aa206(++_0x548df0);}(_0x5c00,0x17e));var _0x05c0=function(_0x54a214,_0x287d40){_0x54a214=_0x54a214-0x0;var _0x1cd25f=_0x5c00[_0x54a214];return _0x1cd25f;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./faxApplication.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x05c0('0xd')]);router[_0x05c0('0xe')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router[_0x05c0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x05c0('0x12')]);module['exports']=router; \ No newline at end of file +var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x55fc1b,_0x16d022){var _0x26257d=function(_0x5b7a91){while(--_0x5b7a91){_0x55fc1b['push'](_0x55fc1b['shift']());}};_0x26257d(++_0x16d022);}(_0xda3f,0xec));var _0xfda3=function(_0x1ad51c,_0x17be9b){_0x1ad51c=_0x1ad51c-0x0;var _0x40bb15=_0xda3f[_0x1ad51c];return _0x40bb15;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./faxApplication.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b40cc99..4a993e2 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 _0x0895=['ENUM','DATE','STRING','out'];(function(_0x5a3ae1,_0x1284e6){var _0x1cff52=function(_0x3c06aa){while(--_0x3c06aa){_0x5a3ae1['push'](_0x5a3ae1['shift']());}};_0x1cff52(++_0x1284e6);}(_0x0895,0x119));var _0x5089=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0895[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5089('0x0')]},'disposition':{'type':Sequelize[_0x5089('0x1')]},'secondDisposition':{'type':Sequelize[_0x5089('0x1')]},'thirdDisposition':{'type':Sequelize[_0x5089('0x1')]},'note':{'type':Sequelize[_0x5089('0x1')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x5089('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x5089('0x2')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5089('0x0')]},'lastMsgDirection':{'type':Sequelize[_0x5089('0x3')]('in',_0x5089('0x2')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x0dff=['STRING','ENUM','out','BOOLEAN','DATE'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x0dff,0x12f));var _0xf0df=function(_0x1189ef,_0x47b5d9){_0x1189ef=_0x1189ef-0x0;var _0x14e202=_0x0dff[_0x1189ef];return _0x14e202;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xf0df('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf0df('0x1')]},'disposition':{'type':Sequelize[_0xf0df('0x2')]},'secondDisposition':{'type':Sequelize[_0xf0df('0x2')]},'thirdDisposition':{'type':Sequelize[_0xf0df('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xf0df('0x1')]},'fax':{'type':Sequelize[_0xf0df('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xf0df('0x3')]('in',_0xf0df('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf0df('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xf0df('0x3')]('in',_0xf0df('0x4')),'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 d28dac8..19d7bb4 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 _0xdb18=['to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','catch','waiting','talking','answered','unmanaged','closed','UserId','FaxInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','select','field','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','text','start','some','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','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)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','i.FaxAccountId\x20IS\x20NULL','user','sequelize','count','keyBy','merge','a.key','Account.key','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.*','Contact.firstName','c.lastName','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.FaxInteractionId\x20IN\x20?','groupBy','push','all','show','params','includeAll','include','options','create','describe','FaxMessage','addMessage','ids','omit','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel'];(function(_0x4383af,_0x4c0e7a){var _0x228e36=function(_0xe79cab){while(--_0xe79cab){_0x4383af['push'](_0x4383af['shift']());}};_0x228e36(++_0x4c0e7a);}(_0xdb18,0xd3));var _0x8db1=function(_0x5b080e,_0x4afcdc){_0x5b080e=_0x5b080e-0x0;var _0x541a0e=_0xdb18[_0x5b080e];return _0x541a0e;};'use strict';var emlformat=require(_0x8db1('0x0'));var rimraf=require(_0x8db1('0x1'));var zipdir=require(_0x8db1('0x2'));var jsonpatch=require(_0x8db1('0x3'));var rp=require(_0x8db1('0x4'));var moment=require(_0x8db1('0x5'));var BPromise=require(_0x8db1('0x6'));var Mustache=require(_0x8db1('0x7'));var util=require(_0x8db1('0x8'));var path=require(_0x8db1('0x9'));var sox=require(_0x8db1('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8db1('0xb'));var _=require(_0x8db1('0xc'));var squel=require(_0x8db1('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8db1('0xe'));var querystring=require(_0x8db1('0xf'));var Papa=require(_0x8db1('0x10'));var Redis=require('ioredis');var authService=require(_0x8db1('0x11'));var qs=require(_0x8db1('0x12'));var as=require(_0x8db1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db1('0x14'))(_0x8db1('0x15'));var utils=require(_0x8db1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8db1('0x17'));var db=require(_0x8db1('0x18'))['db'];config[_0x8db1('0x19')]=_[_0x8db1('0x1a')](config[_0x8db1('0x19')],{'host':_0x8db1('0x1b'),'port':0x18eb});var socket=require(_0x8db1('0x1c'))(new Redis(config[_0x8db1('0x19')]));require(_0x8db1('0x1d'))[_0x8db1('0x1e')](socket);function respondWithStatusCode(_0x4ca643,_0x2362de){_0x2362de=_0x2362de||0xcc;return function(_0x41462a){if(_0x41462a){return _0x4ca643[_0x8db1('0x1f')](_0x2362de);}return _0x4ca643[_0x8db1('0x20')](_0x2362de)[_0x8db1('0x21')]();};}function respondWithResult(_0x1ff461,_0x593270){_0x593270=_0x593270||0xc8;return function(_0x543b3f){if(_0x543b3f){return _0x1ff461[_0x8db1('0x20')](_0x593270)[_0x8db1('0x22')](_0x543b3f);}};}function respondWithFilteredResult(_0x433ef4,_0x1c232e){return function(_0x4246e3){if(_0x4246e3){var _0x16b236=typeof _0x1c232e[_0x8db1('0x23')]===_0x8db1('0x24')&&typeof _0x1c232e[_0x8db1('0x25')]==='undefined';var _0x4d801e=_0x4246e3['count'];var _0x3f6c5a=_0x16b236?0x0:_0x1c232e[_0x8db1('0x23')];var _0x558c04=_0x16b236?_0x4246e3['count']:_0x1c232e['offset']+_0x1c232e[_0x8db1('0x25')];var _0x1c3304;if(_0x558c04>=_0x4d801e){_0x558c04=_0x4d801e;_0x1c3304=0xc8;}else{_0x1c3304=0xce;}_0x433ef4['status'](_0x1c3304);return _0x433ef4['set'](_0x8db1('0x26'),_0x3f6c5a+'-'+_0x558c04+'/'+_0x4d801e)[_0x8db1('0x22')](_0x4246e3);}return null;};}function patchUpdates(_0x5b6dc3){return function(_0x447c58){try{jsonpatch[_0x8db1('0x27')](_0x447c58,_0x5b6dc3,!![]);}catch(_0x21fd82){return BPromise[_0x8db1('0x28')](_0x21fd82);}return _0x447c58[_0x8db1('0x29')]();};}function saveUpdates(_0x3bc701,_0x340959){return function(_0xf978a7){if(_0xf978a7){return _0xf978a7[_0x8db1('0x2a')](_0x3bc701)[_0x8db1('0x2b')](function(_0x2d2149){return _0x2d2149;});}return null;};}function removeEntity(_0x579c02,_0x48f8cf){return function(_0x1863f6){if(_0x1863f6){return _0x1863f6[_0x8db1('0x2c')]()['then'](function(){_0x579c02[_0x8db1('0x20')](0xcc)[_0x8db1('0x21')]();});}};}function handleEntityNotFound(_0x191c9f,_0x470a5c){return function(_0x1d40e1){if(!_0x1d40e1){_0x191c9f[_0x8db1('0x1f')](0x194);}return _0x1d40e1;};}function handleError(_0x8f2f67,_0x3b8063){_0x3b8063=_0x3b8063||0x1f4;return function(_0xc32f62){logger[_0x8db1('0x2d')](_0xc32f62[_0x8db1('0x2e')]);if(_0xc32f62[_0x8db1('0x2f')]){delete _0xc32f62[_0x8db1('0x2f')];}_0x8f2f67[_0x8db1('0x20')](_0x3b8063)[_0x8db1('0x30')](_0xc32f62);};}function getInteractionUsers(_0x3c57bc,_0x2db2f9){return new BPromise(function(_0x1d5f0e,_0x259b81){try{if(_0x2db2f9[_0x3c57bc['id']]){_0x3c57bc[_0x8db1('0x31')]=_[_0x8db1('0x32')](_0x2db2f9[_0x3c57bc['id']],function(_0x424d1e){return{'id':_0x424d1e['id'],'fullname':_0x424d1e[_0x8db1('0x33')]};});}}catch(_0x4dabed){_0x259b81(_0x4dabed);}_0x1d5f0e(_0x3c57bc);});}function getInteractionTags(_0x2f6fec,_0x8e5149){return new BPromise(function(_0x492640,_0xdda0a4){try{if(_0x2f6fec[_0x8db1('0x34')]){_0x2f6fec[_0x8db1('0x35')]=[];_0x2f6fec[_0x8db1('0x34')]['split'](',')[_0x8db1('0x36')](function(_0x426f3d){_0x2f6fec[_0x8db1('0x35')]['push'](_0x8e5149[_0x426f3d]);});}delete _0x2f6fec['TagIds'];}catch(_0x273a5f){_0xdda0a4(_0x273a5f);}_0x492640(_0x2f6fec);});}function updateFaxInteraction(_0x26def3,_0xcbf040,_0x1800c0){return new BPromise(function(_0x4bd793,_0x1185d5){return getInteractionUsers(_0x26def3,_0x1800c0)['then'](function(_0x23b8e0){return getInteractionTags(_0x23b8e0,_0xcbf040);})[_0x8db1('0x2b')](function(_0x22db2e){return getStateInteraction(_0x22db2e);})['then'](function(_0x5d01bc){_0x4bd793(_0x5d01bc);})[_0x8db1('0x37')](function(_0x53e668){_0x1185d5(_0x53e668);});});}function getStateInteraction(_0x34ba53){return new BPromise(function(_0x5afddb){_0x34ba53[_0x8db1('0x38')]=0x0;_0x34ba53[_0x8db1('0x39')]=0x0;_0x34ba53[_0x8db1('0x3a')]=0x0;_0x34ba53[_0x8db1('0x3b')]=0x0;_0x34ba53['total']=0x0;if(!_0x34ba53[_0x8db1('0x3c')]&&!_0x34ba53[_0x8db1('0x3d')]){_0x34ba53[_0x8db1('0x38')]+=0x1;}if(!_0x34ba53['closed']&&_0x34ba53[_0x8db1('0x3d')]){_0x34ba53['talking']+=0x1;if(_0x34ba53[_0x8db1('0x38')]){_0x34ba53[_0x8db1('0x38')]-=0x1;}}if(_0x34ba53[_0x8db1('0x3c')]&&_0x34ba53['UserId']){_0x34ba53['answered']+=0x1;if(_0x34ba53[_0x8db1('0x39')]){_0x34ba53[_0x8db1('0x39')]-=0x1;}}if(_0x34ba53['closed']&&!_0x34ba53[_0x8db1('0x3d')]){_0x34ba53[_0x8db1('0x3b')]+=0x1;if(_0x34ba53[_0x8db1('0x38')]){_0x34ba53[_0x8db1('0x38')]-=0x1;}}_0x34ba53['total']+=0x1;_0x5afddb(_0x34ba53);});}exports['index']=function(_0x3a4e6c,_0x184866){var _0xb65ee4={},_0x3531ff={},_0x1ddf85={'count':0x0,'rows':[]};var _0x1763c1=_['map'](db[_0x8db1('0x3e')][_0x8db1('0x3f')],function(_0x565e60){return{'name':_0x565e60[_0x8db1('0x40')],'type':_0x565e60[_0x8db1('0x41')]['key']};});_0x3531ff[_0x8db1('0x42')]=_['map'](_0x1763c1,_0x8db1('0x2f'));_0x3531ff[_0x8db1('0x43')]=_[_0x8db1('0x44')](_0x3a4e6c[_0x8db1('0x43')]);_0x3531ff[_0x8db1('0x45')]=_[_0x8db1('0x46')](_0x3531ff['model'],_0x3531ff['query']);_0xb65ee4[_0x8db1('0x47')]=_[_0x8db1('0x46')](_0x3531ff[_0x8db1('0x42')],qs[_0x8db1('0x48')](_0x3a4e6c['query'][_0x8db1('0x48')]));_0xb65ee4[_0x8db1('0x47')]=_0xb65ee4[_0x8db1('0x47')][_0x8db1('0x49')]?_0xb65ee4[_0x8db1('0x47')]:_0x3531ff['model'];if(!_0x3a4e6c[_0x8db1('0x43')]['hasOwnProperty'](_0x8db1('0x4a'))){_0xb65ee4[_0x8db1('0x25')]=qs[_0x8db1('0x25')](_0x3a4e6c[_0x8db1('0x43')][_0x8db1('0x25')]);_0xb65ee4[_0x8db1('0x23')]=qs[_0x8db1('0x23')](_0x3a4e6c[_0x8db1('0x43')][_0x8db1('0x23')]);}_0xb65ee4[_0x8db1('0x4b')]=qs[_0x8db1('0x4c')](_0x3a4e6c[_0x8db1('0x43')][_0x8db1('0x4c')]);_0xb65ee4['where']=qs['filters'](_[_0x8db1('0x4d')](_0x3a4e6c[_0x8db1('0x43')],_0x3531ff['filters']),_0x1763c1);var _0x14fb0f=[];var _0x5010a8=squel[_0x8db1('0x4e')]()['field']('id')['field'](_0x8db1('0x2f'))[_0x8db1('0x4f')]('color')[_0x8db1('0x50')](_0x8db1('0x51'));var _0x5b17fb=squel[_0x8db1('0x4e')]()[_0x8db1('0x4f')](_0x8db1('0x52'))[_0x8db1('0x4f')](_0x8db1('0x53'))[_0x8db1('0x4f')](_0x8db1('0x54'))['from'](_0x8db1('0x55'),'ui')['left_join']('users','u',_0x8db1('0x56'));var _0x184862=squel[_0x8db1('0x4e')]()[_0x8db1('0x50')](_0x8db1('0x57'),'i')[_0x8db1('0x58')](_0x8db1('0x59'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x8db1('0x58')]('users','o','o.id\x20=\x20i.UserId')[_0x8db1('0x58')](_0x8db1('0x5a'),'a',_0x8db1('0x5b'))[_0x8db1('0x58')](_0x8db1('0x5c'),'me','me.FaxInteractionId\x20=\x20i.id')['left_join'](_0x8db1('0x5d'),'it',_0x8db1('0x5e'))[_0x8db1('0x58')](_0x8db1('0x51'),'t','t.id\x20=\x20it.TagId');var _0x275a85=squel[_0x8db1('0x5f')]();var _0x574620=[];var _0x52ccb4=squel[_0x8db1('0x5f')]();var _0x20c44b;if(_0x3a4e6c[_0x8db1('0x43')]['search']){_0x20c44b=as['parseSearch'](_0x3a4e6c[_0x8db1('0x43')][_0x8db1('0x60')]);var _0x5d78ff=_0x20c44b[_0x8db1('0x61')];for(var _0x10d95c=0x0;_0x10d95c<_0x20c44b['conditions']['length'];_0x10d95c++){var _0x51d62c=_0x20c44b[_0x8db1('0x62')][_0x10d95c];var _0x10b994='i';var _0x967b6b=_['find'](_0x1763c1,[_0x8db1('0x2f'),_0x51d62c[_0x8db1('0x4f')]]);if(!_0x967b6b){switch(_0x51d62c['field']){case _0x8db1('0x63'):if(_0x51d62c[_0x8db1('0x64')]==0x1){_0x184862['having']('`'+_0x51d62c['field']+_0x8db1('0x65'));}else{_0x184862[_0x8db1('0x66')]('`'+_0x51d62c[_0x8db1('0x4f')]+_0x8db1('0x67'));}break;case _0x8db1('0x68'):if(_0x51d62c['operator']===_0x8db1('0x69')){if(_0x51d62c[_0x8db1('0x64')][_0x8db1('0x6a')]('\x20')[_0x8db1('0x49')]>0x1){_0x275a85[_0x5d78ff](_0x8db1('0x6b'),qs['getFullTextValue'](_0x51d62c[_0x8db1('0x64')]),null);}else{var _0x5d366a='%'+_0x51d62c[_0x8db1('0x64')]+'%';_0x275a85[_0x5d78ff](_0x8db1('0x6c'),_0x5d366a,_0x5d366a,_0x5d366a);}}else{_0x967b6b=_[_0x8db1('0x6d')](_0x1763c1,[_0x8db1('0x2f'),_0x8db1('0x6e')]);_0x51d62c[_0x8db1('0x4f')]=_0x8db1('0x6e');_0x50e777=as['buildExpression'](_0x10b994,_0x967b6b['type'],_0x51d62c);_0x275a85[_0x5d78ff](_0x50e777['text'],_0x50e777['value']['start'],_0x50e777['value'][_0x8db1('0x21')]);}break;case _0x8db1('0x6f'):var _0x24756c=_0x51d62c[_0x8db1('0x64')][_0x8db1('0x6a')](',')[_0x8db1('0x32')](function(_0x596101){return Number(_0x596101);});_0x24756c['forEach'](function(_0x2d6429){_0x52ccb4['or'](_0x8db1('0x70'),'%,'+_0x2d6429+',%');});_0x574620=_[_0x8db1('0x71')](_0x574620,_0x24756c);break;case _0x8db1('0x72'):if(_0x51d62c[_0x8db1('0x73')]===_0x8db1('0x69')){_0x275a85[_0x5d78ff](_0x8db1('0x74'),'%'+_0x51d62c['value']+'%',null);}else{_0x967b6b=_['find'](_0x1763c1,[_0x8db1('0x2f'),_0x8db1('0x3d')]);_0x51d62c[_0x8db1('0x4f')]=_0x8db1('0x3d');_0x50e777=as[_0x8db1('0x75')](_0x10b994,_0x967b6b[_0x8db1('0x41')],_0x51d62c);_0x275a85[_0x5d78ff](_0x50e777['text'],_0x50e777[_0x8db1('0x64')]['start'],_0x50e777[_0x8db1('0x64')]['end']);}break;case _0x8db1('0x76'):_0x50e777=as[_0x8db1('0x75')]('me',null,_0x51d62c);_0x275a85[_0x5d78ff](_0x50e777[_0x8db1('0x77')],_0x50e777[_0x8db1('0x64')][_0x8db1('0x78')],_0x50e777[_0x8db1('0x64')]['end']);break;}}else{var _0x50e777=as[_0x8db1('0x75')](_0x10b994,_0x967b6b[_0x8db1('0x41')],_0x51d62c);_0x275a85[_0x5d78ff](_0x50e777[_0x8db1('0x77')],_0x50e777[_0x8db1('0x64')][_0x8db1('0x78')],_0x50e777[_0x8db1('0x64')][_0x8db1('0x21')]);}}}else{var _0x2f74c4=_(_0x3a4e6c[_0x8db1('0x43')])['keys']()[_0x8db1('0x32')](function(_0x29bebb){return _[_0x8db1('0x79')](_0x1763c1,['name',_0x29bebb])?_0x29bebb:undefined;})[_0x8db1('0x7a')]()[_0x8db1('0x64')]();if(!_[_0x8db1('0x7b')](_0x2f74c4)){_0x2f74c4[_0x8db1('0x36')](function(_0xdc8fa){if(_0xdc8fa===_0x8db1('0x7c')){_0x184862[_0x8db1('0x7d')](_0x8db1('0x7e'),[][_0x8db1('0x7f')](_0x3a4e6c[_0x8db1('0x43')][_0xdc8fa]));}else if(_0xdc8fa===_0x8db1('0x80')){var _0x4e12f4=JSON[_0x8db1('0x81')](_0x3a4e6c['query'][_0xdc8fa])['$gte'];var _0x5d87be=JSON[_0x8db1('0x81')](_0x3a4e6c[_0x8db1('0x43')][_0xdc8fa])[_0x8db1('0x82')];_0x184862['where'](_0x8db1('0x83'),_0x4e12f4,_0x5d87be);}else{if(_0x3a4e6c['query'][_0xdc8fa]===_0x8db1('0x84')){_0x184862[_0x8db1('0x7d')]('i.'+_0xdc8fa+_0x8db1('0x85'));}else{_0x184862[_0x8db1('0x7d')]('i.'+_0xdc8fa+_0x8db1('0x86'),_0x3a4e6c['query'][_0xdc8fa]);}}});}if(_0x3a4e6c['query'][_0x8db1('0x87')]){if(_0x3a4e6c[_0x8db1('0x43')][_0x8db1('0x87')]==0x1){_0x184862[_0x8db1('0x66')](_0x8db1('0x88'));}else{_0x184862[_0x8db1('0x66')]('`unreadMessages`\x20>\x200');}}if(_0x3a4e6c[_0x8db1('0x43')][_0x8db1('0x89')]){_0x574620=_[_0x8db1('0x8a')](_0x3a4e6c[_0x8db1('0x43')]['tag'])?_0x3a4e6c[_0x8db1('0x43')]['tag']:new Array(_0x3a4e6c['query'][_0x8db1('0x89')]);_0x574620[_0x8db1('0x36')](function(_0x7747d2){_0x52ccb4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x7747d2+',%');});}if(_0x3a4e6c[_0x8db1('0x43')][_0x8db1('0x8b')]){var _0x28deff=_0x3a4e6c[_0x8db1('0x43')][_0x8db1('0x8b')][_0x8db1('0x8c')]('\x5c','\x5c\x5c')[_0x8db1('0x8c')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x28deff)){_0x275a85['or']('i.id\x20LIKE\x20?',_0x28deff+'%')['or']('i.fax\x20LIKE\x20?',_0x28deff+'%');}_0x275a85['or'](_0x8db1('0x8d'),_0x28deff+'%');}}_0x184862[_0x8db1('0x7d')](_0x275a85);_0x184862['group'](_0x8db1('0x8e'));var _0x1b8e94={'type':db[_0x8db1('0x8f')][_0x8db1('0x90')][_0x8db1('0x91')],'raw':!![]};var _0x36198e=_0x184862[_0x8db1('0x92')]();_0x36198e['field'](_0x8db1('0x8e'));_0x36198e[_0x8db1('0x4f')](_0x8db1('0x93'),_0x8db1('0x63'));if(_0xb65ee4[_0x8db1('0x4b')]){_0xb65ee4['order'][_0x8db1('0x36')](function(_0x3cd545){var _0x524255=_0x3cd545[0x0]===_0x8db1('0x94')?_0x3cd545[0x0]:'i.'+_0x3cd545[0x0];_0x184862[_0x8db1('0x4b')](_0x524255,_0x3cd545[0x1]===_0x8db1('0x95')?![]:!![]);});}if(!_[_0x8db1('0x7b')](_0x574620)){_0x184862['having'](_0x52ccb4);_0x36198e[_0x8db1('0x7d')](_0x8db1('0x96'),_0x574620);}BPromise[_0x8db1('0x97')]()[_0x8db1('0x2b')](function(){if(!_0x20c44b){if(_0x3a4e6c[_0x8db1('0x43')][_0x8db1('0x7c')])return;_0x36198e['where'](_0x8db1('0x98'));_0x184862[_0x8db1('0x7d')](_0x8db1('0x98'));return;}if(_0x3a4e6c['user'][_0x8db1('0x99')]!==_0x8db1('0x9a'))return;return _0x3a4e6c['user']['getFaxAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x423c64){if(_[_0x8db1('0x7b')](_0x423c64)){_0x36198e[_0x8db1('0x7d')](_0x8db1('0x9b'));_0x184862[_0x8db1('0x7d')](_0x8db1('0x9b'));}else{_0x36198e[_0x8db1('0x7d')]('i.FaxAccountId\x20IN\x20?',_[_0x8db1('0x32')](_0x423c64,'id'));_0x184862[_0x8db1('0x7d')](_0x8db1('0x7e'),_[_0x8db1('0x32')](_0x423c64,'id'));}});})[_0x8db1('0x2b')](function(){if(_0x3a4e6c[_0x8db1('0x9c')][_0x8db1('0x99')]===_0x8db1('0x9a')&&!_0x20c44b&&!_0x3a4e6c['query'][_0x8db1('0x7c')])return[];return db[_0x8db1('0x9d')]['query'](_0x36198e['toString'](),_0x1b8e94);})[_0x8db1('0x2b')](function(_0x3a3612){_0x1ddf85[_0x8db1('0x9e')]=_0x3a3612[_0x8db1('0x49')];if(_0x1ddf85[_0x8db1('0x9e')]===0x0)return[];return db[_0x8db1('0x9d')][_0x8db1('0x43')](_0x5010a8['toString'](),_0x1b8e94)[_0x8db1('0x2b')](function(_0x43eb86){_0x14fb0f=_[_0x8db1('0x9f')](_0x43eb86,'id');_0x1b8e94=_[_0x8db1('0xa0')](_0x1b8e94,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3a4e6c['query'][_0x8db1('0x48')]){_0xb65ee4[_0x8db1('0x47')][_0x8db1('0x36')](function(_0x47490d){_0x184862['field']('i.'+_0x47490d);});}else{_0x184862[_0x8db1('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8db1('0x63'));_0x184862[_0x8db1('0x4f')](_0x8db1('0xa1'),_0x8db1('0xa2'));_0x184862[_0x8db1('0x4f')]('a.mandatoryDisposition',_0x8db1('0xa3'));_0x184862[_0x8db1('0x4f')](_0x8db1('0xa4'),_0x8db1('0x94'));_0x184862[_0x8db1('0x4f')](_0x8db1('0xa5'));_0x184862['field']('c.firstName',_0x8db1('0xa6'));_0x184862['field'](_0x8db1('0xa7'),'Contact.lastName');_0x184862['field']('c.email','Contact.email');_0x184862['field']('c.phone','Contact.phone');_0x184862[_0x8db1('0x4f')]('c.mobile',_0x8db1('0xa8'));_0x184862[_0x8db1('0x4f')](_0x8db1('0xa9'),_0x8db1('0xaa'));_0x184862[_0x8db1('0x4f')](_0x8db1('0xab'),_0x8db1('0xac'));_0x184862[_0x8db1('0x4f')](_0x8db1('0xad'),_0x8db1('0xae'));_0x184862[_0x8db1('0x4f')](_0x8db1('0xaf'),_0x8db1('0x34'));}if(_0xb65ee4['limit'])_0x184862[_0x8db1('0x25')](_0xb65ee4[_0x8db1('0x25')]);if(_0xb65ee4[_0x8db1('0x23')])_0x184862[_0x8db1('0x23')](_0xb65ee4[_0x8db1('0x23')]);return db[_0x8db1('0x9d')][_0x8db1('0x43')](_0x184862[_0x8db1('0xb0')](),_0x1b8e94);})[_0x8db1('0x2b')](function(_0x4887a6){if(_0x4887a6['length']>0x0)_0x5b17fb['where'](_0x8db1('0xb1'),_[_0x8db1('0x32')](_0x4887a6,'id'));return db[_0x8db1('0x9d')][_0x8db1('0x43')](_0x5b17fb[_0x8db1('0xb0')](),_0x1b8e94)[_0x8db1('0x2b')](function(_0x4cdcd0){var _0x218d5d=_[_0x8db1('0xb2')](_0x4cdcd0,'FaxInteractionId');var _0x197338=[];_0x4887a6[_0x8db1('0x36')](function(_0x41bd46){_0x197338[_0x8db1('0xb3')](updateFaxInteraction(_0x41bd46,_0x14fb0f,_0x218d5d));});return BPromise[_0x8db1('0xb4')](_0x197338);});});})[_0x8db1('0x2b')](function(_0x1eb428){_0x1ddf85['rows']=_0x1eb428;return _0x1ddf85;})[_0x8db1('0x2b')](respondWithFilteredResult(_0x184866,_0xb65ee4))[_0x8db1('0x37')](handleError(_0x184866,null));};exports[_0x8db1('0xb5')]=function(_0x4e45be,_0x20b1d2){var _0x1531ff={'raw':![],'where':{'id':_0x4e45be[_0x8db1('0xb6')]['id']}},_0x195e78={};_0x195e78[_0x8db1('0x42')]=_[_0x8db1('0x44')](db[_0x8db1('0x3e')]['rawAttributes']);_0x195e78[_0x8db1('0x43')]=_[_0x8db1('0x44')](_0x4e45be[_0x8db1('0x43')]);_0x195e78[_0x8db1('0x45')]=_[_0x8db1('0x46')](_0x195e78[_0x8db1('0x42')],_0x195e78[_0x8db1('0x43')]);_0x1531ff[_0x8db1('0x47')]=_['intersection'](_0x195e78[_0x8db1('0x42')],qs[_0x8db1('0x48')](_0x4e45be['query'][_0x8db1('0x48')]));_0x1531ff[_0x8db1('0x47')]=_0x1531ff[_0x8db1('0x47')][_0x8db1('0x49')]?_0x1531ff[_0x8db1('0x47')]:_0x195e78[_0x8db1('0x42')];if(_0x4e45be[_0x8db1('0x43')][_0x8db1('0xb7')]){_0x1531ff[_0x8db1('0xb8')]=[{'all':!![]}];}_0x1531ff=_['merge']({},_0x1531ff,_0x4e45be[_0x8db1('0xb9')]);return db[_0x8db1('0x3e')][_0x8db1('0x6d')](_0x1531ff)[_0x8db1('0x2b')](handleEntityNotFound(_0x20b1d2,null))[_0x8db1('0x2b')](respondWithResult(_0x20b1d2,null))[_0x8db1('0x37')](handleError(_0x20b1d2,null));};exports[_0x8db1('0xba')]=function(_0x27654e,_0x27f273){return db[_0x8db1('0x3e')][_0x8db1('0xba')](_0x27654e[_0x8db1('0x76')],{})[_0x8db1('0x2b')](respondWithResult(_0x27f273,0xc9))[_0x8db1('0x37')](handleError(_0x27f273,null));};exports['update']=function(_0xc98cff,_0x34adce){if(_0xc98cff[_0x8db1('0x76')]['id']){delete _0xc98cff[_0x8db1('0x76')]['id'];}return db[_0x8db1('0x3e')][_0x8db1('0x6d')]({'where':{'id':_0xc98cff['params']['id']}})['then'](handleEntityNotFound(_0x34adce,null))['then'](saveUpdates(_0xc98cff['body'],null))[_0x8db1('0x2b')](respondWithResult(_0x34adce,null))[_0x8db1('0x37')](handleError(_0x34adce,null));};exports[_0x8db1('0x2c')]=function(_0xc67645,_0x4694d5){return db['FaxInteraction']['find']({'where':{'id':_0xc67645['params']['id']}})[_0x8db1('0x2b')](handleEntityNotFound(_0x4694d5,null))[_0x8db1('0x2b')](removeEntity(_0x4694d5,null))['catch'](handleError(_0x4694d5,null));};exports[_0x8db1('0xbb')]=function(_0x2cd486,_0x206905){return db[_0x8db1('0x3e')][_0x8db1('0xbb')]()['then'](respondWithResult(_0x206905,null))[_0x8db1('0x37')](handleError(_0x206905,null));};exports['addMessage']=function(_0x1cfd59,_0x308230,_0x4cc524){return db[_0x8db1('0xbc')]['find']({'where':{'id':_0x1cfd59['params']['id']}})[_0x8db1('0x2b')](handleEntityNotFound(_0x308230,null))[_0x8db1('0x2b')](function(_0x5541b8){if(_0x5541b8){return _0x5541b8[_0x8db1('0xbd')](_0x1cfd59[_0x8db1('0x76')][_0x8db1('0xbe')],_[_0x8db1('0xbf')](_0x1cfd59[_0x8db1('0x76')],['ids','id'])||{});}})[_0x8db1('0x2b')](respondWithResult(_0x308230,null))['catch'](handleError(_0x308230,null));};exports['getMessages']=function(_0x1b9732,_0x44b540,_0xc30eb3){var _0x3fedae={'raw':![],'where':{}};var _0x125d4d={};var _0x525484={'count':0x0,'rows':[]};return db[_0x8db1('0x3e')][_0x8db1('0xc0')]({'where':{'id':_0x1b9732['params']['id']}})[_0x8db1('0x2b')](handleEntityNotFound(_0x44b540,null))[_0x8db1('0x2b')](function(_0xc18d1d){if(_0xc18d1d){_0x125d4d[_0x8db1('0x42')]=_[_0x8db1('0x44')](db[_0x8db1('0xbc')][_0x8db1('0x3f')]);_0x125d4d['query']=_['keys'](_0x1b9732[_0x8db1('0x43')]);_0x125d4d[_0x8db1('0x45')]=_[_0x8db1('0x46')](_0x125d4d['model'],_0x125d4d['query']);_0x3fedae[_0x8db1('0x47')]=_[_0x8db1('0x46')](_0x125d4d[_0x8db1('0x42')],qs[_0x8db1('0x48')](_0x1b9732['query'][_0x8db1('0x48')]));_0x3fedae[_0x8db1('0x47')]=_0x3fedae['attributes'][_0x8db1('0x49')]?_0x3fedae['attributes']:_0x125d4d[_0x8db1('0x42')];if(!_0x1b9732[_0x8db1('0x43')][_0x8db1('0xc1')]('nolimit')){_0x3fedae[_0x8db1('0x25')]=qs[_0x8db1('0x25')](_0x1b9732[_0x8db1('0x43')][_0x8db1('0x25')]);_0x3fedae[_0x8db1('0x23')]=qs['offset'](_0x1b9732[_0x8db1('0x43')][_0x8db1('0x23')]);}_0x3fedae[_0x8db1('0x4b')]=qs[_0x8db1('0x4c')](_0x1b9732[_0x8db1('0x43')][_0x8db1('0x4c')]);_0x3fedae[_0x8db1('0x7d')]=qs['filters'](_['pick'](_0x1b9732[_0x8db1('0x43')],_0x125d4d[_0x8db1('0x45')]));_0x3fedae[_0x8db1('0x7d')]['FaxInteractionId']=_0xc18d1d['id'];if(_0x1b9732[_0x8db1('0x43')][_0x8db1('0x8b')]){_0x3fedae[_0x8db1('0x7d')]=_[_0x8db1('0xa0')](_0x3fedae[_0x8db1('0x7d')],{'$or':_[_0x8db1('0x32')](_0x3fedae['attributes'],function(_0x2906e3){var _0x592a60={};_0x592a60[_0x2906e3]={'$like':'%'+_0x1b9732[_0x8db1('0x43')][_0x8db1('0x8b')]+'%'};return _0x592a60;})});}if(_0x1b9732['query']['$gte']){var _0x226f77=_0x1b9732[_0x8db1('0x43')]['$gte'][_0x8db1('0x6a')](',');var _0x2e2400={};_0x2e2400[_0x226f77[0x0]]={'$gte':moment(_0x226f77[0x1])[_0x8db1('0xc2')](_0x8db1('0xc3'))};_0x3fedae[_0x8db1('0x7d')]=_[_0x8db1('0xa0')](_0x3fedae['where'],_0x2e2400);}_0x3fedae=_[_0x8db1('0xa0')]({},_0x3fedae,_0x1b9732[_0x8db1('0xb9')]);return db[_0x8db1('0xbc')][_0x8db1('0x9e')]({'where':_0x3fedae[_0x8db1('0x7d')]})[_0x8db1('0x2b')](function(_0x4ad793){_0x525484[_0x8db1('0x9e')]=_0x4ad793;if(_0x1b9732['query']['includeAll']){_0x3fedae[_0x8db1('0xb8')]=[{'all':!![]}];}return db[_0x8db1('0xbc')][_0x8db1('0xc4')](_0x3fedae);})[_0x8db1('0x2b')](function(_0x190de2){_0x525484[_0x8db1('0xc5')]=_0x190de2;return _0x525484;});}})[_0x8db1('0x2b')](respondWithFilteredResult(_0x44b540,_0x3fedae))['catch'](handleError(_0x44b540,null));};exports[_0x8db1('0xc6')]=function(_0x776b32,_0x2b1b4b,_0x4fd46d){return db[_0x8db1('0x3e')][_0x8db1('0x6d')]({'where':{'id':_0x776b32['params']['id']}})['then'](handleEntityNotFound(_0x2b1b4b,null))[_0x8db1('0x2b')](function(_0x2e2d8f){if(_0x2e2d8f){return _0x2e2d8f[_0x8db1('0xc7')](_0x776b32[_0x8db1('0x76')]['ids'],_[_0x8db1('0xbf')](_0x776b32[_0x8db1('0x76')],['ids','id'])||{})[_0x8db1('0xc8')](function(){return db[_0x8db1('0x6f')][_0x8db1('0xc4')]({'attributes':['id',_0x8db1('0x2f'),_0x8db1('0xc9')],'where':{'id':_0x776b32[_0x8db1('0x76')][_0x8db1('0xbe')]}});})[_0x8db1('0x2b')](function(_0x16f0ea){socket[_0x8db1('0xca')](_0x8db1('0xcb'),{'id':Number(_0x776b32[_0x8db1('0xb6')]['id']),'tags':_0x16f0ea||[]});return{'id':Number(_0x776b32['params']['id']),'tags':_0x16f0ea||[]};});}})['then'](respondWithResult(_0x2b1b4b,null))[_0x8db1('0x37')](handleError(_0x2b1b4b,null));};exports[_0x8db1('0xcc')]=function(_0x4deb44,_0x5a0331,_0x56c001){return db[_0x8db1('0x3e')][_0x8db1('0x6d')]({'where':{'id':_0x4deb44['params']['id']}})['then'](handleEntityNotFound(_0x5a0331,null))['then'](function(_0x39bfe6){if(_0x39bfe6){return _0x39bfe6[_0x8db1('0xcc')](_0x4deb44[_0x8db1('0x43')][_0x8db1('0xbe')]);}})[_0x8db1('0x2b')](respondWithStatusCode(_0x5a0331,null))['catch'](handleError(_0x5a0331,null));};exports[_0x8db1('0xcd')]=function(_0x31a251,_0x5d28e3){var _0x185ec1=moment()[_0x8db1('0xce')]()[_0x8db1('0xb0')]();var _0x121f92=path[_0x8db1('0xcf')](config[_0x8db1('0xd0')],_0x8db1('0xd1'),'files',_0x8db1('0xd2'));var _0x4d0e6d=path['join'](config[_0x8db1('0xd0')],_0x8db1('0xd1'),_0x8db1('0xd3'),_0x8db1('0xd4'));var _0x20a5d1=path[_0x8db1('0xcf')](_0x121f92,_0x185ec1);var _0x13dd8c=util[_0x8db1('0xc2')](_0x8db1('0xd5'),_0x31a251[_0x8db1('0xb6')]['id'],_0x185ec1);var _0x5152c5=path[_0x8db1('0xcf')](_0x121f92,_0x13dd8c);var _0x5a3d50=[];_0x5a3d50['push']({'model':db['Attachment'],'as':_0x8db1('0xd6'),'raw':!![]});var _0x44c216=[{'model':db['FaxMessage'],'as':_0x8db1('0xd7'),'attributes':['id',_0x8db1('0x76'),'createdAt'],'include':_0x5a3d50}];return db[_0x8db1('0x3e')][_0x8db1('0x6d')]({'where':{'id':_0x31a251['params']['id']},'include':_0x44c216})[_0x8db1('0x2b')](handleEntityNotFound(_0x5d28e3,null))['then'](function(_0x2e0d4f){if(_0x2e0d4f&&_0x2e0d4f[_0x8db1('0xd7')]){var _0x5e6a34=_0x2e0d4f[_0x8db1('0xd8')]({'plain':!![]});fs[_0x8db1('0xd9')](_0x20a5d1);for(var _0x5213cd=0x0;_0x5213cd<_0x5e6a34[_0x8db1('0xd7')][_0x8db1('0x49')];_0x5213cd++){var _0x13af4d=_0x5e6a34[_0x8db1('0xd7')][_0x5213cd]['Attachment'];if(_0x13af4d){var _0x46e570=path['join'](_0x4d0e6d,_0x13af4d[_0x8db1('0xda')]);if(fs[_0x8db1('0xdb')](_0x46e570)){fs[_0x8db1('0xdc')](_0x46e570)[_0x8db1('0xdd')](fs[_0x8db1('0xde')](path[_0x8db1('0xcf')](_0x20a5d1,_0x13af4d[_0x8db1('0xda')])));}}}return BPromise[_0x8db1('0x97')]()[_0x8db1('0x2b')](function(){return new BPromise(function(_0x8c79fa,_0x5f04b1){zipdir(_0x20a5d1,{'saveTo':_0x5152c5},function(_0x470992,_0x5213de){if(_0x470992)return _0x5f04b1(_0x470992);return _0x8c79fa(_0x5213de);});})['then'](function(){return new BPromise(function(_0x3dc36a,_0x5c17bd){rimraf(_0x20a5d1,function(_0x32fc1d){if(_0x32fc1d)_0x5c17bd(_0x32fc1d);return _0x3dc36a();});});})[_0x8db1('0x2b')](function(){return _0x5d28e3[_0x8db1('0xcd')](_0x5152c5,_0x13dd8c,function(_0x2efc14){if(_0x2efc14){console[_0x8db1('0xdf')](_0x8db1('0xe0'),_0x2efc14);}else{fs['unlinkSync'](_0x5152c5);}});});});}else{return _0x5d28e3['sendStatus'](0xc8);}})[_0x8db1('0x37')](handleError(_0x5d28e3,null));}; \ No newline at end of file +var _0x46a9=['expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','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','operator','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','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','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','clone','i.id','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','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','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','push','all','rows','show','rawAttributes','include','options','create','params','describe','addMessage','FaxMessage','ids','getMessages','findOne','pick','includeAll','findAll','addTags','omit','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','existsSync','createReadStream','createWriteStream','basename','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','waiting','total','closed','UserId','answered','talking','unmanaged','index','FaxInteraction','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','select','field','color','tools_tags','u.id','u.fullname','from','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','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'];(function(_0xeadc11,_0x27e378){var _0x4257b6=function(_0x38bb40){while(--_0x38bb40){_0xeadc11['push'](_0xeadc11['shift']());}};_0x4257b6(++_0x27e378);}(_0x46a9,0x162));var _0x946a=function(_0x1b4a9f,_0x425687){_0x1b4a9f=_0x1b4a9f-0x0;var _0x5a6e3c=_0x46a9[_0x1b4a9f];return _0x5a6e3c;};'use strict';var emlformat=require(_0x946a('0x0'));var rimraf=require(_0x946a('0x1'));var zipdir=require(_0x946a('0x2'));var jsonpatch=require(_0x946a('0x3'));var rp=require('request-promise');var moment=require(_0x946a('0x4'));var BPromise=require(_0x946a('0x5'));var Mustache=require(_0x946a('0x6'));var util=require(_0x946a('0x7'));var path=require('path');var sox=require(_0x946a('0x8'));var csv=require(_0x946a('0x9'));var ejs=require(_0x946a('0xa'));var fs=require('fs');var fs_extra=require(_0x946a('0xb'));var _=require(_0x946a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x946a('0xd'));var deskjs=require(_0x946a('0xe'));var toCsv=require(_0x946a('0x9'));var querystring=require(_0x946a('0xf'));var Papa=require('papaparse');var Redis=require(_0x946a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x946a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x946a('0x12'));var logger=require(_0x946a('0x13'))(_0x946a('0x14'));var utils=require(_0x946a('0x15'));var config=require(_0x946a('0x16'));var licenseUtil=require(_0x946a('0x17'));var db=require('../../mysqldb')['db'];config[_0x946a('0x18')]=_['defaults'](config[_0x946a('0x18')],{'host':_0x946a('0x19'),'port':0x18eb});var socket=require(_0x946a('0x1a'))(new Redis(config[_0x946a('0x18')]));require(_0x946a('0x1b'))[_0x946a('0x1c')](socket);function respondWithStatusCode(_0x5a8682,_0x31e494){_0x31e494=_0x31e494||0xcc;return function(_0x467a7a){if(_0x467a7a){return _0x5a8682[_0x946a('0x1d')](_0x31e494);}return _0x5a8682[_0x946a('0x1e')](_0x31e494)[_0x946a('0x1f')]();};}function respondWithResult(_0x184950,_0x33e682){_0x33e682=_0x33e682||0xc8;return function(_0xe56109){if(_0xe56109){return _0x184950[_0x946a('0x1e')](_0x33e682)[_0x946a('0x20')](_0xe56109);}};}function respondWithFilteredResult(_0x4d7b93,_0xa050ab){return function(_0x147205){if(_0x147205){var _0x4ab85c=typeof _0xa050ab[_0x946a('0x21')]===_0x946a('0x22')&&typeof _0xa050ab[_0x946a('0x23')]==='undefined';var _0xda8fd3=_0x147205['count'];var _0x11bad9=_0x4ab85c?0x0:_0xa050ab[_0x946a('0x21')];var _0x435fc2=_0x4ab85c?_0x147205[_0x946a('0x24')]:_0xa050ab[_0x946a('0x21')]+_0xa050ab['limit'];var _0x553e78;if(_0x435fc2>=_0xda8fd3){_0x435fc2=_0xda8fd3;_0x553e78=0xc8;}else{_0x553e78=0xce;}_0x4d7b93[_0x946a('0x1e')](_0x553e78);return _0x4d7b93[_0x946a('0x25')](_0x946a('0x26'),_0x11bad9+'-'+_0x435fc2+'/'+_0xda8fd3)[_0x946a('0x20')](_0x147205);}return null;};}function patchUpdates(_0x3180c4){return function(_0x38eac4){try{jsonpatch[_0x946a('0x27')](_0x38eac4,_0x3180c4,!![]);}catch(_0x827fd2){return BPromise[_0x946a('0x28')](_0x827fd2);}return _0x38eac4[_0x946a('0x29')]();};}function saveUpdates(_0x3d16d5,_0x84cac){return function(_0x2e9053){if(_0x2e9053){return _0x2e9053[_0x946a('0x2a')](_0x3d16d5)[_0x946a('0x2b')](function(_0x18beb2){return _0x18beb2;});}return null;};}function removeEntity(_0x11455b,_0x14eeb5){return function(_0x25db77){if(_0x25db77){return _0x25db77[_0x946a('0x2c')]()['then'](function(){_0x11455b[_0x946a('0x1e')](0xcc)[_0x946a('0x1f')]();});}};}function handleEntityNotFound(_0x261a92,_0x37d3e3){return function(_0x1f74f3){if(!_0x1f74f3){_0x261a92['sendStatus'](0x194);}return _0x1f74f3;};}function handleError(_0x37a18e,_0x4ae8cc){_0x4ae8cc=_0x4ae8cc||0x1f4;return function(_0xef088b){logger[_0x946a('0x2d')](_0xef088b['stack']);if(_0xef088b[_0x946a('0x2e')]){delete _0xef088b[_0x946a('0x2e')];}_0x37a18e['status'](_0x4ae8cc)[_0x946a('0x2f')](_0xef088b);};}function getInteractionUsers(_0x50134b,_0x5a6351){return new BPromise(function(_0x15760c,_0x43a49d){try{if(_0x5a6351[_0x50134b['id']]){_0x50134b[_0x946a('0x30')]=_[_0x946a('0x31')](_0x5a6351[_0x50134b['id']],function(_0x5750f3){return{'id':_0x5750f3['id'],'fullname':_0x5750f3[_0x946a('0x32')]};});}}catch(_0x33ff63){_0x43a49d(_0x33ff63);}_0x15760c(_0x50134b);});}function getInteractionTags(_0x164a4a,_0x270241){return new BPromise(function(_0xdf1b52,_0x11d7db){try{if(_0x164a4a[_0x946a('0x33')]){_0x164a4a[_0x946a('0x34')]=[];_0x164a4a[_0x946a('0x33')][_0x946a('0x35')](',')[_0x946a('0x36')](function(_0x578bb2){_0x164a4a[_0x946a('0x34')]['push'](_0x270241[_0x578bb2]);});}delete _0x164a4a[_0x946a('0x33')];}catch(_0x477fc2){_0x11d7db(_0x477fc2);}_0xdf1b52(_0x164a4a);});}function updateFaxInteraction(_0x1fd8b7,_0x36ae4c,_0x20a869){return new BPromise(function(_0x34e95f,_0x4262c5){return getInteractionUsers(_0x1fd8b7,_0x20a869)['then'](function(_0x549686){return getInteractionTags(_0x549686,_0x36ae4c);})[_0x946a('0x2b')](function(_0x1e7db5){return getStateInteraction(_0x1e7db5);})['then'](function(_0x2c9dd9){_0x34e95f(_0x2c9dd9);})[_0x946a('0x37')](function(_0x27d975){_0x4262c5(_0x27d975);});});}function getStateInteraction(_0x3ec609){return new BPromise(function(_0x716b2a){_0x3ec609[_0x946a('0x38')]=0x0;_0x3ec609['talking']=0x0;_0x3ec609['answered']=0x0;_0x3ec609['unmanaged']=0x0;_0x3ec609[_0x946a('0x39')]=0x0;if(!_0x3ec609['closed']&&!_0x3ec609['UserId']){_0x3ec609[_0x946a('0x38')]+=0x1;}if(!_0x3ec609[_0x946a('0x3a')]&&_0x3ec609[_0x946a('0x3b')]){_0x3ec609['talking']+=0x1;if(_0x3ec609[_0x946a('0x38')]){_0x3ec609['waiting']-=0x1;}}if(_0x3ec609[_0x946a('0x3a')]&&_0x3ec609[_0x946a('0x3b')]){_0x3ec609[_0x946a('0x3c')]+=0x1;if(_0x3ec609[_0x946a('0x3d')]){_0x3ec609[_0x946a('0x3d')]-=0x1;}}if(_0x3ec609['closed']&&!_0x3ec609[_0x946a('0x3b')]){_0x3ec609[_0x946a('0x3e')]+=0x1;if(_0x3ec609[_0x946a('0x38')]){_0x3ec609[_0x946a('0x38')]-=0x1;}}_0x3ec609['total']+=0x1;_0x716b2a(_0x3ec609);});}exports[_0x946a('0x3f')]=function(_0x4b2a07,_0x387c0d){var _0x4c1f8a={},_0x3b143={},_0x4cd711={'count':0x0,'rows':[]};var _0x63b37b=_[_0x946a('0x31')](db[_0x946a('0x40')]['rawAttributes'],function(_0x2d4c96){return{'name':_0x2d4c96['fieldName'],'type':_0x2d4c96[_0x946a('0x41')][_0x946a('0x42')]};});_0x3b143['model']=_[_0x946a('0x31')](_0x63b37b,'name');_0x3b143[_0x946a('0x43')]=_[_0x946a('0x44')](_0x4b2a07[_0x946a('0x43')]);_0x3b143['filters']=_[_0x946a('0x45')](_0x3b143['model'],_0x3b143[_0x946a('0x43')]);_0x4c1f8a[_0x946a('0x46')]=_[_0x946a('0x45')](_0x3b143[_0x946a('0x47')],qs['fields'](_0x4b2a07[_0x946a('0x43')][_0x946a('0x48')]));_0x4c1f8a[_0x946a('0x46')]=_0x4c1f8a['attributes'][_0x946a('0x49')]?_0x4c1f8a[_0x946a('0x46')]:_0x3b143[_0x946a('0x47')];if(!_0x4b2a07[_0x946a('0x43')][_0x946a('0x4a')](_0x946a('0x4b'))){_0x4c1f8a[_0x946a('0x23')]=qs['limit'](_0x4b2a07[_0x946a('0x43')]['limit']);_0x4c1f8a[_0x946a('0x21')]=qs[_0x946a('0x21')](_0x4b2a07[_0x946a('0x43')]['offset']);}_0x4c1f8a[_0x946a('0x4c')]=qs[_0x946a('0x4d')](_0x4b2a07['query'][_0x946a('0x4d')]);_0x4c1f8a[_0x946a('0x4e')]=qs[_0x946a('0x4f')](_['pick'](_0x4b2a07[_0x946a('0x43')],_0x3b143['filters']),_0x63b37b);var _0x989f03=[];var _0x3d9d6e=squel[_0x946a('0x50')]()[_0x946a('0x51')]('id')[_0x946a('0x51')]('name')[_0x946a('0x51')](_0x946a('0x52'))['from'](_0x946a('0x53'));var _0x5c7fee=squel[_0x946a('0x50')]()[_0x946a('0x51')](_0x946a('0x54'))['field'](_0x946a('0x55'))[_0x946a('0x51')]('ui.FaxInteractionId')[_0x946a('0x56')](_0x946a('0x57'),'ui')[_0x946a('0x58')]('users','u',_0x946a('0x59'));var _0x367181=squel[_0x946a('0x50')]()[_0x946a('0x56')](_0x946a('0x5a'),'i')['left_join'](_0x946a('0x5b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x946a('0x58')]('users','o',_0x946a('0x5c'))['left_join'](_0x946a('0x5d'),'a',_0x946a('0x5e'))[_0x946a('0x58')](_0x946a('0x5f'),'me',_0x946a('0x60'))['left_join'](_0x946a('0x61'),'it',_0x946a('0x62'))[_0x946a('0x58')](_0x946a('0x53'),'t',_0x946a('0x63'));var _0x12f6ee=squel[_0x946a('0x64')]();var _0xab38c1=[];var _0x587125=squel[_0x946a('0x64')]();var _0xb8bb49;if(_0x4b2a07[_0x946a('0x43')][_0x946a('0x65')]){_0xb8bb49=as['parseSearch'](_0x4b2a07['query'][_0x946a('0x65')]);var _0x5362a0=_0xb8bb49[_0x946a('0x66')];for(var _0x1bd8f6=0x0;_0x1bd8f6<_0xb8bb49[_0x946a('0x67')][_0x946a('0x49')];_0x1bd8f6++){var _0x3c60f4=_0xb8bb49[_0x946a('0x67')][_0x1bd8f6];var _0x3bfcf3='i';var _0x3e84d7=_[_0x946a('0x68')](_0x63b37b,[_0x946a('0x2e'),_0x3c60f4['field']]);if(!_0x3e84d7){switch(_0x3c60f4[_0x946a('0x51')]){case _0x946a('0x69'):if(_0x3c60f4[_0x946a('0x6a')]==0x1){_0x367181[_0x946a('0x6b')]('`'+_0x3c60f4[_0x946a('0x51')]+_0x946a('0x6c'));}else{_0x367181[_0x946a('0x6b')]('`'+_0x3c60f4['field']+_0x946a('0x6d'));}break;case _0x946a('0x6e'):if(_0x3c60f4['operator']===_0x946a('0x6f')){if(_0x3c60f4[_0x946a('0x6a')][_0x946a('0x35')]('\x20')[_0x946a('0x49')]>0x1){_0x12f6ee[_0x5362a0]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x946a('0x70')](_0x3c60f4['value']),null);}else{var _0x39b7c='%'+_0x3c60f4['value']+'%';_0x12f6ee[_0x5362a0](_0x946a('0x71'),_0x39b7c,_0x39b7c,_0x39b7c);}}else{_0x3e84d7=_[_0x946a('0x68')](_0x63b37b,[_0x946a('0x2e'),_0x946a('0x72')]);_0x3c60f4['field']=_0x946a('0x72');_0x3b587f=as[_0x946a('0x73')](_0x3bfcf3,_0x3e84d7[_0x946a('0x41')],_0x3c60f4);_0x12f6ee[_0x5362a0](_0x3b587f[_0x946a('0x74')],_0x3b587f[_0x946a('0x6a')][_0x946a('0x75')],_0x3b587f[_0x946a('0x6a')][_0x946a('0x1f')]);}break;case _0x946a('0x76'):var _0x22eda2=_0x3c60f4[_0x946a('0x6a')][_0x946a('0x35')](',')[_0x946a('0x31')](function(_0x3e6ab3){return Number(_0x3e6ab3);});_0x22eda2[_0x946a('0x36')](function(_0x4745b7){_0x587125['or'](_0x946a('0x77'),'%,'+_0x4745b7+',%');});_0xab38c1=_[_0x946a('0x78')](_0xab38c1,_0x22eda2);break;case _0x946a('0x79'):if(_0x3c60f4[_0x946a('0x7a')]==='$substring'){_0x12f6ee[_0x5362a0]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3c60f4[_0x946a('0x6a')]+'%',null);}else{_0x3e84d7=_[_0x946a('0x68')](_0x63b37b,[_0x946a('0x2e'),_0x946a('0x3b')]);_0x3c60f4['field']=_0x946a('0x3b');_0x3b587f=as['buildExpression'](_0x3bfcf3,_0x3e84d7['type'],_0x3c60f4);_0x12f6ee[_0x5362a0](_0x3b587f[_0x946a('0x74')],_0x3b587f[_0x946a('0x6a')]['start'],_0x3b587f[_0x946a('0x6a')][_0x946a('0x1f')]);}break;case _0x946a('0x7b'):_0x3b587f=as[_0x946a('0x73')]('me',null,_0x3c60f4);_0x12f6ee[_0x5362a0](_0x3b587f[_0x946a('0x74')],_0x3b587f[_0x946a('0x6a')][_0x946a('0x75')],_0x3b587f[_0x946a('0x6a')]['end']);break;}}else{var _0x3b587f=as[_0x946a('0x73')](_0x3bfcf3,_0x3e84d7['type'],_0x3c60f4);_0x12f6ee[_0x5362a0](_0x3b587f[_0x946a('0x74')],_0x3b587f['value'][_0x946a('0x75')],_0x3b587f[_0x946a('0x6a')][_0x946a('0x1f')]);}}}else{var _0x58b7e8=_(_0x4b2a07['query'])['keys']()[_0x946a('0x31')](function(_0x2fb6dd){return _[_0x946a('0x7c')](_0x63b37b,[_0x946a('0x2e'),_0x2fb6dd])?_0x2fb6dd:undefined;})[_0x946a('0x7d')]()[_0x946a('0x6a')]();if(!_[_0x946a('0x7e')](_0x58b7e8)){_0x58b7e8[_0x946a('0x36')](function(_0x3f1d20){if(_0x3f1d20===_0x946a('0x7f')){_0x367181[_0x946a('0x4e')](_0x946a('0x80'),[][_0x946a('0x81')](_0x4b2a07[_0x946a('0x43')][_0x3f1d20]));}else if(_0x3f1d20==='createdAt'){var _0x2c3c9a=JSON[_0x946a('0x82')](_0x4b2a07[_0x946a('0x43')][_0x3f1d20])[_0x946a('0x83')];var _0x5c6cce=JSON[_0x946a('0x82')](_0x4b2a07[_0x946a('0x43')][_0x3f1d20])[_0x946a('0x84')];_0x367181[_0x946a('0x4e')](_0x946a('0x85'),_0x2c3c9a,_0x5c6cce);}else{if(_0x4b2a07['query'][_0x3f1d20]===_0x946a('0x86')){_0x367181['where']('i.'+_0x3f1d20+_0x946a('0x87'));}else{_0x367181[_0x946a('0x4e')]('i.'+_0x3f1d20+_0x946a('0x88'),_0x4b2a07['query'][_0x3f1d20]);}}});}if(_0x4b2a07['query'][_0x946a('0x89')]){if(_0x4b2a07[_0x946a('0x43')][_0x946a('0x89')]==0x1){_0x367181['having'](_0x946a('0x8a'));}else{_0x367181[_0x946a('0x6b')](_0x946a('0x8b'));}}if(_0x4b2a07[_0x946a('0x43')][_0x946a('0x8c')]){_0xab38c1=_[_0x946a('0x8d')](_0x4b2a07[_0x946a('0x43')][_0x946a('0x8c')])?_0x4b2a07[_0x946a('0x43')][_0x946a('0x8c')]:new Array(_0x4b2a07[_0x946a('0x43')][_0x946a('0x8c')]);_0xab38c1[_0x946a('0x36')](function(_0x33f5c8){_0x587125['or'](_0x946a('0x77'),'%,'+_0x33f5c8+',%');});}if(_0x4b2a07[_0x946a('0x43')]['filter']){var _0x3c3b91=_0x4b2a07['query'][_0x946a('0x8e')][_0x946a('0x8f')]('\x5c','\x5c\x5c')[_0x946a('0x8f')](/'/g,'\x27\x27');if(qs[_0x946a('0x90')](_0x3c3b91)){_0x12f6ee['or'](_0x946a('0x91'),_0x3c3b91+'%')['or'](_0x946a('0x92'),_0x3c3b91+'%');}_0x12f6ee['or'](_0x946a('0x93'),_0x3c3b91+'%');}}_0x367181[_0x946a('0x4e')](_0x12f6ee);_0x367181[_0x946a('0x94')]('i.id');var _0x9c2c62={'type':db[_0x946a('0x95')]['QueryTypes']['SELECT'],'raw':!![]};var _0x566072=_0x367181[_0x946a('0x96')]();_0x566072[_0x946a('0x51')](_0x946a('0x97'));_0x566072[_0x946a('0x51')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x4c1f8a['order']){_0x4c1f8a[_0x946a('0x4c')][_0x946a('0x36')](function(_0x6a2c04){var _0x4e50bb=_0x6a2c04[0x0]==='contactName'?_0x6a2c04[0x0]:'i.'+_0x6a2c04[0x0];_0x367181[_0x946a('0x4c')](_0x4e50bb,_0x6a2c04[0x1]===_0x946a('0x98')?![]:!![]);});}if(!_['isEmpty'](_0xab38c1)){_0x367181[_0x946a('0x6b')](_0x587125);_0x566072[_0x946a('0x4e')](_0x946a('0x99'),_0xab38c1);}BPromise[_0x946a('0x9a')]()[_0x946a('0x2b')](function(){if(!_0xb8bb49){if(_0x4b2a07[_0x946a('0x43')][_0x946a('0x7f')])return;_0x566072['where'](_0x946a('0x9b'));_0x367181[_0x946a('0x4e')](_0x946a('0x9b'));return;}if(_0x4b2a07[_0x946a('0x9c')][_0x946a('0x9d')]!==_0x946a('0x9e'))return;return _0x4b2a07['user'][_0x946a('0x9f')]({'attributes':['id'],'raw':!![]})[_0x946a('0x2b')](function(_0x39daa8){if(_[_0x946a('0x7e')](_0x39daa8)){_0x566072[_0x946a('0x4e')](_0x946a('0xa0'));_0x367181[_0x946a('0x4e')](_0x946a('0xa0'));}else{_0x566072['where']('i.FaxAccountId\x20IN\x20?',_[_0x946a('0x31')](_0x39daa8,'id'));_0x367181[_0x946a('0x4e')](_0x946a('0x80'),_[_0x946a('0x31')](_0x39daa8,'id'));}});})[_0x946a('0x2b')](function(){if(_0x4b2a07[_0x946a('0x9c')][_0x946a('0x9d')]==='agent'&&!_0xb8bb49&&!_0x4b2a07[_0x946a('0x43')][_0x946a('0x7f')])return[];return db[_0x946a('0xa1')][_0x946a('0x43')](_0x566072['toString'](),_0x9c2c62);})[_0x946a('0x2b')](function(_0x143258){_0x4cd711['count']=_0x143258[_0x946a('0x49')];if(_0x4cd711[_0x946a('0x24')]===0x0)return[];return db[_0x946a('0xa1')][_0x946a('0x43')](_0x3d9d6e[_0x946a('0xa2')](),_0x9c2c62)[_0x946a('0x2b')](function(_0x46bfec){_0x989f03=_[_0x946a('0xa3')](_0x46bfec,'id');_0x9c2c62=_[_0x946a('0xa4')](_0x9c2c62,{'model':db[_0x946a('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b2a07[_0x946a('0x43')][_0x946a('0x48')]){_0x4c1f8a[_0x946a('0x46')][_0x946a('0x36')](function(_0xf7a73a){_0x367181[_0x946a('0x51')]('i.'+_0xf7a73a);});}else{_0x367181['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x946a('0x69'));_0x367181[_0x946a('0x51')](_0x946a('0xa5'),_0x946a('0xa6'));_0x367181['field'](_0x946a('0xa7'),_0x946a('0xa8'));_0x367181[_0x946a('0x51')](_0x946a('0xa9'),'contactName');_0x367181[_0x946a('0x51')](_0x946a('0xaa'));_0x367181[_0x946a('0x51')](_0x946a('0xab'),_0x946a('0xac'));_0x367181[_0x946a('0x51')]('c.lastName','Contact.lastName');_0x367181[_0x946a('0x51')]('c.email',_0x946a('0xad'));_0x367181['field']('c.phone',_0x946a('0xae'));_0x367181[_0x946a('0x51')]('c.mobile',_0x946a('0xaf'));_0x367181[_0x946a('0x51')](_0x946a('0xb0'),_0x946a('0xb1'));_0x367181['field'](_0x946a('0xb2'),_0x946a('0xb3'));_0x367181[_0x946a('0x51')](_0x946a('0xb4'),_0x946a('0xb5'));_0x367181[_0x946a('0x51')](_0x946a('0xb6'),'TagIds');}if(_0x4c1f8a[_0x946a('0x23')])_0x367181['limit'](_0x4c1f8a[_0x946a('0x23')]);if(_0x4c1f8a[_0x946a('0x21')])_0x367181[_0x946a('0x21')](_0x4c1f8a[_0x946a('0x21')]);return db[_0x946a('0xa1')][_0x946a('0x43')](_0x367181[_0x946a('0xa2')](),_0x9c2c62);})[_0x946a('0x2b')](function(_0x42eda6){if(_0x42eda6[_0x946a('0x49')]>0x0)_0x5c7fee[_0x946a('0x4e')](_0x946a('0xb7'),_[_0x946a('0x31')](_0x42eda6,'id'));return db['sequelize']['query'](_0x5c7fee['toString'](),_0x9c2c62)[_0x946a('0x2b')](function(_0x2a3a47){var _0x3ee64b=_['groupBy'](_0x2a3a47,_0x946a('0xb8'));var _0x5f3668=[];_0x42eda6[_0x946a('0x36')](function(_0x440639){_0x5f3668[_0x946a('0xb9')](updateFaxInteraction(_0x440639,_0x989f03,_0x3ee64b));});return BPromise[_0x946a('0xba')](_0x5f3668);});});})[_0x946a('0x2b')](function(_0x2d3f5b){_0x4cd711[_0x946a('0xbb')]=_0x2d3f5b;return _0x4cd711;})[_0x946a('0x2b')](respondWithFilteredResult(_0x387c0d,_0x4c1f8a))[_0x946a('0x37')](handleError(_0x387c0d,null));};exports[_0x946a('0xbc')]=function(_0x5881cc,_0x5b6206){var _0x501ddb={'raw':![],'where':{'id':_0x5881cc['params']['id']}},_0x1ef00e={};_0x1ef00e['model']=_[_0x946a('0x44')](db[_0x946a('0x40')][_0x946a('0xbd')]);_0x1ef00e[_0x946a('0x43')]=_['keys'](_0x5881cc[_0x946a('0x43')]);_0x1ef00e['filters']=_[_0x946a('0x45')](_0x1ef00e[_0x946a('0x47')],_0x1ef00e[_0x946a('0x43')]);_0x501ddb[_0x946a('0x46')]=_[_0x946a('0x45')](_0x1ef00e[_0x946a('0x47')],qs[_0x946a('0x48')](_0x5881cc['query']['fields']));_0x501ddb[_0x946a('0x46')]=_0x501ddb[_0x946a('0x46')]['length']?_0x501ddb[_0x946a('0x46')]:_0x1ef00e['model'];if(_0x5881cc[_0x946a('0x43')]['includeAll']){_0x501ddb[_0x946a('0xbe')]=[{'all':!![]}];}_0x501ddb=_[_0x946a('0xa4')]({},_0x501ddb,_0x5881cc[_0x946a('0xbf')]);return db['FaxInteraction'][_0x946a('0x68')](_0x501ddb)[_0x946a('0x2b')](handleEntityNotFound(_0x5b6206,null))[_0x946a('0x2b')](respondWithResult(_0x5b6206,null))[_0x946a('0x37')](handleError(_0x5b6206,null));};exports[_0x946a('0xc0')]=function(_0x4d396b,_0x5777e1){return db['FaxInteraction'][_0x946a('0xc0')](_0x4d396b[_0x946a('0x7b')],{})[_0x946a('0x2b')](respondWithResult(_0x5777e1,0xc9))[_0x946a('0x37')](handleError(_0x5777e1,null));};exports[_0x946a('0x2a')]=function(_0x418438,_0x2abce5){if(_0x418438['body']['id']){delete _0x418438[_0x946a('0x7b')]['id'];}return db['FaxInteraction'][_0x946a('0x68')]({'where':{'id':_0x418438[_0x946a('0xc1')]['id']}})[_0x946a('0x2b')](handleEntityNotFound(_0x2abce5,null))[_0x946a('0x2b')](saveUpdates(_0x418438[_0x946a('0x7b')],null))[_0x946a('0x2b')](respondWithResult(_0x2abce5,null))['catch'](handleError(_0x2abce5,null));};exports[_0x946a('0x2c')]=function(_0x172b4d,_0x53d5ac){return db['FaxInteraction'][_0x946a('0x68')]({'where':{'id':_0x172b4d[_0x946a('0xc1')]['id']}})[_0x946a('0x2b')](handleEntityNotFound(_0x53d5ac,null))['then'](removeEntity(_0x53d5ac,null))[_0x946a('0x37')](handleError(_0x53d5ac,null));};exports[_0x946a('0xc2')]=function(_0x9ae4f1,_0x51afd0){return db[_0x946a('0x40')][_0x946a('0xc2')]()[_0x946a('0x2b')](respondWithResult(_0x51afd0,null))['catch'](handleError(_0x51afd0,null));};exports[_0x946a('0xc3')]=function(_0xe955bc,_0x1099a7,_0x2ce65e){return db[_0x946a('0xc4')][_0x946a('0x68')]({'where':{'id':_0xe955bc[_0x946a('0xc1')]['id']}})[_0x946a('0x2b')](handleEntityNotFound(_0x1099a7,null))[_0x946a('0x2b')](function(_0x47fd56){if(_0x47fd56){return _0x47fd56[_0x946a('0xc3')](_0xe955bc[_0x946a('0x7b')][_0x946a('0xc5')],_['omit'](_0xe955bc[_0x946a('0x7b')],[_0x946a('0xc5'),'id'])||{});}})['then'](respondWithResult(_0x1099a7,null))[_0x946a('0x37')](handleError(_0x1099a7,null));};exports[_0x946a('0xc6')]=function(_0x58418e,_0x23912a,_0xcab241){var _0xe7378f={'raw':![],'where':{}};var _0x586b66={};var _0x1cf442={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x946a('0xc7')]({'where':{'id':_0x58418e['params']['id']}})[_0x946a('0x2b')](handleEntityNotFound(_0x23912a,null))['then'](function(_0x4137e8){if(_0x4137e8){_0x586b66[_0x946a('0x47')]=_[_0x946a('0x44')](db[_0x946a('0xc4')]['rawAttributes']);_0x586b66['query']=_[_0x946a('0x44')](_0x58418e['query']);_0x586b66[_0x946a('0x4f')]=_[_0x946a('0x45')](_0x586b66[_0x946a('0x47')],_0x586b66[_0x946a('0x43')]);_0xe7378f[_0x946a('0x46')]=_[_0x946a('0x45')](_0x586b66['model'],qs['fields'](_0x58418e[_0x946a('0x43')][_0x946a('0x48')]));_0xe7378f[_0x946a('0x46')]=_0xe7378f[_0x946a('0x46')]['length']?_0xe7378f[_0x946a('0x46')]:_0x586b66[_0x946a('0x47')];if(!_0x58418e['query'][_0x946a('0x4a')](_0x946a('0x4b'))){_0xe7378f[_0x946a('0x23')]=qs['limit'](_0x58418e['query'][_0x946a('0x23')]);_0xe7378f['offset']=qs['offset'](_0x58418e['query'][_0x946a('0x21')]);}_0xe7378f['order']=qs[_0x946a('0x4d')](_0x58418e[_0x946a('0x43')][_0x946a('0x4d')]);_0xe7378f[_0x946a('0x4e')]=qs[_0x946a('0x4f')](_[_0x946a('0xc8')](_0x58418e[_0x946a('0x43')],_0x586b66[_0x946a('0x4f')]));_0xe7378f[_0x946a('0x4e')][_0x946a('0xb8')]=_0x4137e8['id'];if(_0x58418e[_0x946a('0x43')][_0x946a('0x8e')]){_0xe7378f['where']=_['merge'](_0xe7378f[_0x946a('0x4e')],{'$or':_['map'](_0xe7378f[_0x946a('0x46')],function(_0x2f7278){var _0x3a2c42={};_0x3a2c42[_0x2f7278]={'$like':'%'+_0x58418e[_0x946a('0x43')][_0x946a('0x8e')]+'%'};return _0x3a2c42;})});}if(_0x58418e[_0x946a('0x43')][_0x946a('0x83')]){var _0x45a8a3=_0x58418e[_0x946a('0x43')]['$gte'][_0x946a('0x35')](',');var _0x5269ef={};_0x5269ef[_0x45a8a3[0x0]]={'$gte':moment(_0x45a8a3[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0xe7378f[_0x946a('0x4e')]=_[_0x946a('0xa4')](_0xe7378f[_0x946a('0x4e')],_0x5269ef);}_0xe7378f=_[_0x946a('0xa4')]({},_0xe7378f,_0x58418e[_0x946a('0xbf')]);return db[_0x946a('0xc4')][_0x946a('0x24')]({'where':_0xe7378f[_0x946a('0x4e')]})[_0x946a('0x2b')](function(_0x4afa1c){_0x1cf442[_0x946a('0x24')]=_0x4afa1c;if(_0x58418e['query'][_0x946a('0xc9')]){_0xe7378f[_0x946a('0xbe')]=[{'all':!![]}];}return db[_0x946a('0xc4')][_0x946a('0xca')](_0xe7378f);})[_0x946a('0x2b')](function(_0x1f0d10){_0x1cf442[_0x946a('0xbb')]=_0x1f0d10;return _0x1cf442;});}})['then'](respondWithFilteredResult(_0x23912a,_0xe7378f))['catch'](handleError(_0x23912a,null));};exports[_0x946a('0xcb')]=function(_0x1c7670,_0x536877,_0x23213d){return db[_0x946a('0x40')][_0x946a('0x68')]({'where':{'id':_0x1c7670[_0x946a('0xc1')]['id']}})['then'](handleEntityNotFound(_0x536877,null))[_0x946a('0x2b')](function(_0x2f1f44){if(_0x2f1f44){return _0x2f1f44['setTags'](_0x1c7670[_0x946a('0x7b')][_0x946a('0xc5')],_[_0x946a('0xcc')](_0x1c7670['body'],[_0x946a('0xc5'),'id'])||{})['spread'](function(){return db[_0x946a('0x76')][_0x946a('0xca')]({'attributes':['id','name',_0x946a('0x52')],'where':{'id':_0x1c7670[_0x946a('0x7b')][_0x946a('0xc5')]}});})[_0x946a('0x2b')](function(_0x54fba0){socket[_0x946a('0xcd')](_0x946a('0xce'),{'id':Number(_0x1c7670[_0x946a('0xc1')]['id']),'tags':_0x54fba0||[]});return{'id':Number(_0x1c7670[_0x946a('0xc1')]['id']),'tags':_0x54fba0||[]};});}})[_0x946a('0x2b')](respondWithResult(_0x536877,null))[_0x946a('0x37')](handleError(_0x536877,null));};exports[_0x946a('0xcf')]=function(_0x4a9925,_0x30bd6c,_0x2f0611){return db[_0x946a('0x40')][_0x946a('0x68')]({'where':{'id':_0x4a9925[_0x946a('0xc1')]['id']}})[_0x946a('0x2b')](handleEntityNotFound(_0x30bd6c,null))[_0x946a('0x2b')](function(_0x3cf1c8){if(_0x3cf1c8){return _0x3cf1c8['removeTags'](_0x4a9925[_0x946a('0x43')]['ids']);}})[_0x946a('0x2b')](respondWithStatusCode(_0x30bd6c,null))[_0x946a('0x37')](handleError(_0x30bd6c,null));};exports[_0x946a('0xd0')]=function(_0x453ed5,_0x22f59f){var _0x303ba4=moment()[_0x946a('0xd1')]()[_0x946a('0xa2')]();var _0x42f517=path[_0x946a('0xd2')](config[_0x946a('0xd3')],_0x946a('0xd4'),_0x946a('0xd5'),'tmp');var _0x3a676d=path[_0x946a('0xd2')](config[_0x946a('0xd3')],_0x946a('0xd4'),'files',_0x946a('0xd6'));var _0x149825=path[_0x946a('0xd2')](_0x42f517,_0x303ba4);var _0x20bff6=util['format'](_0x946a('0xd7'),_0x453ed5[_0x946a('0xc1')]['id'],_0x303ba4);var _0x537b63=path[_0x946a('0xd2')](_0x42f517,_0x20bff6);var _0x142a58=[];_0x142a58[_0x946a('0xb9')]({'model':db[_0x946a('0xd8')],'as':_0x946a('0xd8'),'raw':!![]});var _0x13df0b=[{'model':db[_0x946a('0xc4')],'as':_0x946a('0xd9'),'attributes':['id','body',_0x946a('0xda')],'include':_0x142a58}];return db[_0x946a('0x40')][_0x946a('0x68')]({'where':{'id':_0x453ed5[_0x946a('0xc1')]['id']},'include':_0x13df0b})[_0x946a('0x2b')](handleEntityNotFound(_0x22f59f,null))[_0x946a('0x2b')](function(_0x18caa1){if(_0x18caa1&&_0x18caa1['Messages']){var _0x158968=_0x18caa1[_0x946a('0xdb')]({'plain':!![]});fs['mkdirSync'](_0x149825);for(var _0x45f153=0x0;_0x45f153<_0x158968[_0x946a('0xd9')]['length'];_0x45f153++){var _0x31a515=_0x158968[_0x946a('0xd9')][_0x45f153][_0x946a('0xd8')];if(_0x31a515){var _0x557420=path[_0x946a('0xd2')](_0x3a676d,_0x31a515['basename']);if(fs[_0x946a('0xdc')](_0x557420)){fs[_0x946a('0xdd')](_0x557420)['pipe'](fs[_0x946a('0xde')](path['join'](_0x149825,_0x31a515[_0x946a('0xdf')])));}}}return BPromise[_0x946a('0x9a')]()[_0x946a('0x2b')](function(){return new BPromise(function(_0x3cacc6,_0x1eebb3){zipdir(_0x149825,{'saveTo':_0x537b63},function(_0x4df0e7,_0x6528d5){if(_0x4df0e7)return _0x1eebb3(_0x4df0e7);return _0x3cacc6(_0x6528d5);});})[_0x946a('0x2b')](function(){return new BPromise(function(_0xb9b24,_0x5acf8c){rimraf(_0x149825,function(_0x514f1e){if(_0x514f1e)_0x5acf8c(_0x514f1e);return _0xb9b24();});});})[_0x946a('0x2b')](function(){return _0x22f59f[_0x946a('0xd0')](_0x537b63,_0x20bff6,function(_0x52529c){if(_0x52529c){console[_0x946a('0xe0')](_0x946a('0xe1'),_0x52529c);}else{fs[_0x946a('0xe2')](_0x537b63);}});});});}else{return _0x22f59f[_0x946a('0x1d')](0xc8);}})['catch'](handleError(_0x22f59f,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 0816229..a67f05f 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 _0x56e1=['map','findAll','then','setDataValue','unreadMessages','length','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x56e1,0xcd));var _0x156e=function(_0xaf43f6,_0x150ea8){_0xaf43f6=_0xaf43f6-0x0;var _0x147bcc=_0x56e1[_0xaf43f6];return _0x147bcc;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x156e('0x0'))['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db'][_0x156e('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x156e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x156e('0x3'),'afterDestroy':_0x156e('0x4')};function emitEvent(_0x4adbaa){return function(_0x42a6f3,_0x1a46bd,_0x167639){_0x42a6f3['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3f6335){_0x42a6f3['setDataValue']('Users',_0x3f6335[_0x156e('0x5')](function(_0x40f92e){return{'id':_0x40f92e['id']};}));return FaxMessage[_0x156e('0x6')]({'where':{'FaxInteractionId':_0x42a6f3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x156e('0x7')](function(_0x632c10){_0x42a6f3[_0x156e('0x8')](_0x156e('0x9'),_0x632c10[_0x156e('0xa')]);FaxInteractionEvents['emit'](_0x4adbaa+':'+_0x42a6f3['id'],_0x42a6f3);FaxInteractionEvents['emit'](_0x4adbaa,_0x42a6f3);_0x167639(null);})[_0x156e('0xb')](_0x167639(null));};}for(var e in events){if(events[_0x156e('0xc')](e)){var event=events[e];FaxInteraction[_0x156e('0xd')](e,emitEvent(event));}}module[_0x156e('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x482c=['remove','getUsers','then','Users','map','unreadMessages','emit','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save'];(function(_0x3f94f9,_0x42774b){var _0x46f84f=function(_0xa080d8){while(--_0xa080d8){_0x3f94f9['push'](_0x3f94f9['shift']());}};_0x46f84f(++_0x42774b);}(_0x482c,0xcc));var _0xc482=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x482c[_0x5c351c];return _0x26f3b3;};'use strict';var EventEmitter=require(_0xc482('0x0'));var FaxInteraction=require(_0xc482('0x1'))['db'][_0xc482('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0xc482('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xc482('0x4')](0x0);var events={'afterCreate':_0xc482('0x5'),'afterUpdate':'update','afterDestroy':_0xc482('0x6')};function emitEvent(_0x2dbee9){return function(_0x1d4b71,_0x570445,_0x34d699){_0x1d4b71[_0xc482('0x7')]({'attributes':['id'],'raw':!![]})[_0xc482('0x8')](function(_0x157858){_0x1d4b71['setDataValue'](_0xc482('0x9'),_0x157858[_0xc482('0xa')](function(_0x534bc1){return{'id':_0x534bc1['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x1d4b71['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc482('0x8')](function(_0x1cea47){_0x1d4b71['setDataValue'](_0xc482('0xb'),_0x1cea47['length']);FaxInteractionEvents[_0xc482('0xc')](_0x2dbee9+':'+_0x1d4b71['id'],_0x1d4b71);FaxInteractionEvents[_0xc482('0xc')](_0x2dbee9,_0x1d4b71);_0x34d699(null);})['catch'](_0x34d699(null));};}for(var e in events){if(events[_0xc482('0xd')](e)){var event=events[e];FaxInteraction[_0xc482('0xe')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 9162ca7..e5e4e8f 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 _0x04f2=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0x04f2,0x8f));var _0x204f=function(_0xa37336,_0x2ea76f){_0xa37336=_0xa37336-0x0;var _0x17cd39=_0x04f2[_0xa37336];return _0x17cd39;};'use strict';var _=require(_0x204f('0x0'));var util=require('util');var logger=require(_0x204f('0x1'))(_0x204f('0x2'));var moment=require(_0x204f('0x3'));var BPromise=require(_0x204f('0x4'));var rp=require(_0x204f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x204f('0x6'));var config=require(_0x204f('0x7'));var attributes=require(_0x204f('0x8'));module['exports']=function(_0x104edd,_0x254bfa){return _0x104edd[_0x204f('0x9')](_0x204f('0xa'),attributes,{'tableName':_0x204f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x19fd98,_0x15699c,_0x56efc0){if(_0x19fd98[_0x204f('0xc')]('closed')){_0x19fd98[_0x204f('0xd')]=moment()[_0x204f('0xe')](_0x204f('0xf'));}_0x56efc0(null,_0x19fd98);}}});}; \ No newline at end of file +var _0x9f40=['path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise'];(function(_0xc02298,_0x21e5b8){var _0x3fea53=function(_0x4a7341){while(--_0x4a7341){_0xc02298['push'](_0xc02298['shift']());}};_0x3fea53(++_0x21e5b8);}(_0x9f40,0x9b));var _0x09f4=function(_0x323992,_0x4ef313){_0x323992=_0x323992-0x0;var _0x1a3cf2=_0x9f40[_0x323992];return _0x1a3cf2;};'use strict';var _=require('lodash');var util=require(_0x09f4('0x0'));var logger=require('../../config/logger')(_0x09f4('0x1'));var moment=require(_0x09f4('0x2'));var BPromise=require(_0x09f4('0x3'));var rp=require(_0x09f4('0x4'));var fs=require('fs');var path=require(_0x09f4('0x5'));var rimraf=require(_0x09f4('0x6'));var config=require('../../config/environment');var attributes=require(_0x09f4('0x7'));module[_0x09f4('0x8')]=function(_0x3fa54a,_0x14ad25){return _0x3fa54a[_0x09f4('0x9')](_0x09f4('0xa'),attributes,{'tableName':_0x09f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4219e0,_0x36f013,_0x4155e1){if(_0x4219e0[_0x09f4('0xc')](_0x09f4('0xd'))){_0x4219e0[_0x09f4('0xe')]=moment()['format'](_0x09f4('0xf'));}_0x4155e1(null,_0x4219e0);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 3c1fd35..09d0885 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 _0x9a0b=['request\x20sent','debug','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','FaxInteraction','update','options','raw','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','find','body','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info'];(function(_0x359df4,_0xb70943){var _0x26bd6d=function(_0x7e95bb){while(--_0x7e95bb){_0x359df4['push'](_0x359df4['shift']());}};_0x26bd6d(++_0xb70943);}(_0x9a0b,0x145));var _0xb9a0=function(_0x4032be,_0x38db34){_0x4032be=_0x4032be-0x0;var _0x5d7384=_0x9a0b[_0x4032be];return _0x5d7384;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb9a0('0x0'));var BPromise=require(_0xb9a0('0x1'));var rs=require(_0xb9a0('0x2'));var fs=require('fs');var Redis=require(_0xb9a0('0x3'));var db=require(_0xb9a0('0x4'))['db'];var utils=require(_0xb9a0('0x5'));var logger=require(_0xb9a0('0x6'))(_0xb9a0('0x7'));var config=require(_0xb9a0('0x8'));var jayson=require(_0xb9a0('0x9'));var client=jayson[_0xb9a0('0xa')]['http']({'port':0x232a});config['redis']=_[_0xb9a0('0xb')](config[_0xb9a0('0xc')],{'host':_0xb9a0('0xd'),'port':0x18eb});var socket=require(_0xb9a0('0xe'))(new Redis(config[_0xb9a0('0xc')]));require('./faxInteraction.socket')[_0xb9a0('0xf')](socket);function respondWithRpcPromise(_0x1df424,_0x27e890,_0x556360){return new BPromise(function(_0x12e287,_0xead181){return client[_0xb9a0('0x10')](_0x1df424,_0x556360)[_0xb9a0('0x11')](function(_0x3f9fef){logger[_0xb9a0('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x27e890,_0xb9a0('0x13'));logger[_0xb9a0('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x27e890,'request\x20sent',JSON[_0xb9a0('0x15')](_0x3f9fef));if(_0x3f9fef[_0xb9a0('0x16')]){if(_0x3f9fef[_0xb9a0('0x16')][_0xb9a0('0x17')]===0x1f4){logger['error'](_0xb9a0('0x18'),_0x27e890,_0x3f9fef[_0xb9a0('0x16')]['message']);return _0xead181(_0x3f9fef[_0xb9a0('0x16')][_0xb9a0('0x19')]);}logger[_0xb9a0('0x16')](_0xb9a0('0x18'),_0x27e890,_0x3f9fef[_0xb9a0('0x16')]['message']);return _0x12e287(_0x3f9fef['error'][_0xb9a0('0x19')]);}else{logger[_0xb9a0('0x12')](_0xb9a0('0x18'),_0x27e890,_0xb9a0('0x13'));_0x12e287(_0x3f9fef[_0xb9a0('0x1a')][_0xb9a0('0x19')]);}})[_0xb9a0('0x1b')](function(_0x34d56c){logger[_0xb9a0('0x16')](_0xb9a0('0x18'),_0x27e890,_0x34d56c);_0xead181(_0x34d56c);});});}exports['UpdateFaxInteraction']=function(_0x695dd4){var _0x148147=this;return new Promise(function(_0x2f0fa5,_0x33b36d){return db[_0xb9a0('0x1c')][_0xb9a0('0x1d')](_0x695dd4['body'],{'raw':_0x695dd4[_0xb9a0('0x1e')]?_0x695dd4[_0xb9a0('0x1e')][_0xb9a0('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x695dd4[_0xb9a0('0x1e')]?_0x695dd4[_0xb9a0('0x1e')][_0xb9a0('0x20')]||null:null,'attributes':_0x695dd4[_0xb9a0('0x1e')]?_0x695dd4[_0xb9a0('0x1e')][_0xb9a0('0x21')]||null:null,'limit':_0x695dd4[_0xb9a0('0x1e')]?_0x695dd4[_0xb9a0('0x1e')][_0xb9a0('0x22')]||null:null})[_0xb9a0('0x11')](function(_0x2d2437){logger['info'](_0xb9a0('0x23'),_0x695dd4);logger[_0xb9a0('0x14')]('UpdateFaxInteraction',_0x695dd4,JSON['stringify'](_0x2d2437));_0x2f0fa5(_0x2d2437);})[_0xb9a0('0x1b')](function(_0x1ff9f5){logger['error'](_0xb9a0('0x23'),_0x1ff9f5[_0xb9a0('0x19')],_0x695dd4);_0x33b36d(_0x148147[_0xb9a0('0x16')](0x1f4,_0x1ff9f5[_0xb9a0('0x19')]));});});};exports[_0xb9a0('0x24')]=function(_0x35c8b9){return new Promise(function(_0x19fffe,_0xf13743){return db[_0xb9a0('0x1c')][_0xb9a0('0x25')]({'where':_0x35c8b9[_0xb9a0('0x1e')]?_0x35c8b9[_0xb9a0('0x1e')][_0xb9a0('0x20')]||null:null})['then'](function(_0x5b6bea){if(_0x5b6bea){return _0x5b6bea['addTags'](_0x35c8b9[_0xb9a0('0x26')][_0xb9a0('0x27')],_[_0xb9a0('0x28')](_0x35c8b9['body'],['ids','id'])||{});}})[_0xb9a0('0x29')](function(_0x50f41c){logger[_0xb9a0('0x12')](_0xb9a0('0x2a'),_0x35c8b9);logger[_0xb9a0('0x14')](_0xb9a0('0x2a'),_0x35c8b9,JSON['stringify'](_0x50f41c));_0x19fffe(_0x50f41c);})[_0xb9a0('0x1b')](function(_0x575989){logger[_0xb9a0('0x16')](_0xb9a0('0x2a'),_0x575989[_0xb9a0('0x19')],_0x35c8b9);_0xf13743(_this['error'](0x1f4,_0x575989[_0xb9a0('0x19')]));});});}; \ No newline at end of file +var _0x1e76=['defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','info','result','catch','FaxInteraction','update','body','options','raw','attributes','limit','UpdateFaxInteraction','debug','find','addTags','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x2f5d45,_0x3843f4){var _0x4f7b47=function(_0x872989){while(--_0x872989){_0x2f5d45['push'](_0x2f5d45['shift']());}};_0x4f7b47(++_0x3843f4);}(_0x1e76,0xf5));var _0x61e7=function(_0x37770a,_0x468075){_0x37770a=_0x37770a-0x0;var _0x38292c=_0x1e76[_0x37770a];return _0x38292c;};'use strict';var _=require(_0x61e7('0x0'));var util=require(_0x61e7('0x1'));var moment=require(_0x61e7('0x2'));var BPromise=require('bluebird');var rs=require(_0x61e7('0x3'));var fs=require('fs');var Redis=require(_0x61e7('0x4'));var db=require(_0x61e7('0x5'))['db'];var utils=require(_0x61e7('0x6'));var logger=require(_0x61e7('0x7'))(_0x61e7('0x8'));var config=require(_0x61e7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x61e7('0xa')][_0x61e7('0xb')]({'port':0x232a});config[_0x61e7('0xc')]=_[_0x61e7('0xd')](config[_0x61e7('0xc')],{'host':_0x61e7('0xe'),'port':0x18eb});var socket=require(_0x61e7('0xf'))(new Redis(config[_0x61e7('0xc')]));require('./faxInteraction.socket')[_0x61e7('0x10')](socket);function respondWithRpcPromise(_0x25e14d,_0x256b57,_0x3b0506){return new BPromise(function(_0x5dcd4f,_0x4b2f9c){return client[_0x61e7('0x11')](_0x25e14d,_0x3b0506)[_0x61e7('0x12')](function(_0xfe37a6){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x256b57,_0x61e7('0x13'));logger['debug'](_0x61e7('0x14'),_0x256b57,_0x61e7('0x13'),JSON[_0x61e7('0x15')](_0xfe37a6));if(_0xfe37a6['error']){if(_0xfe37a6[_0x61e7('0x16')][_0x61e7('0x17')]===0x1f4){logger[_0x61e7('0x16')](_0x61e7('0x18'),_0x256b57,_0xfe37a6[_0x61e7('0x16')]['message']);return _0x4b2f9c(_0xfe37a6[_0x61e7('0x16')][_0x61e7('0x19')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x256b57,_0xfe37a6[_0x61e7('0x16')][_0x61e7('0x19')]);return _0x5dcd4f(_0xfe37a6[_0x61e7('0x16')][_0x61e7('0x19')]);}else{logger[_0x61e7('0x1a')](_0x61e7('0x18'),_0x256b57,_0x61e7('0x13'));_0x5dcd4f(_0xfe37a6[_0x61e7('0x1b')]['message']);}})[_0x61e7('0x1c')](function(_0x44c65f){logger[_0x61e7('0x16')](_0x61e7('0x18'),_0x256b57,_0x44c65f);_0x4b2f9c(_0x44c65f);});});}exports['UpdateFaxInteraction']=function(_0x5e77d6){var _0x1abbaf=this;return new Promise(function(_0x28144e,_0x50ffd2){return db[_0x61e7('0x1d')][_0x61e7('0x1e')](_0x5e77d6[_0x61e7('0x1f')],{'raw':_0x5e77d6[_0x61e7('0x20')]?_0x5e77d6[_0x61e7('0x20')][_0x61e7('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e77d6[_0x61e7('0x20')]?_0x5e77d6['options']['where']||null:null,'attributes':_0x5e77d6[_0x61e7('0x20')]?_0x5e77d6[_0x61e7('0x20')][_0x61e7('0x22')]||null:null,'limit':_0x5e77d6['options']?_0x5e77d6[_0x61e7('0x20')][_0x61e7('0x23')]||null:null})[_0x61e7('0x12')](function(_0x2492f0){logger[_0x61e7('0x1a')](_0x61e7('0x24'),_0x5e77d6);logger[_0x61e7('0x25')](_0x61e7('0x24'),_0x5e77d6,JSON[_0x61e7('0x15')](_0x2492f0));_0x28144e(_0x2492f0);})[_0x61e7('0x1c')](function(_0x49cb29){logger[_0x61e7('0x16')](_0x61e7('0x24'),_0x49cb29[_0x61e7('0x19')],_0x5e77d6);_0x50ffd2(_0x1abbaf[_0x61e7('0x16')](0x1f4,_0x49cb29['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x211566){return new Promise(function(_0x519db9,_0x5a8180){return db[_0x61e7('0x1d')][_0x61e7('0x26')]({'where':_0x211566[_0x61e7('0x20')]?_0x211566[_0x61e7('0x20')]['where']||null:null})['then'](function(_0x1d9dea){if(_0x1d9dea){return _0x1d9dea[_0x61e7('0x27')](_0x211566[_0x61e7('0x1f')]['ids'],_[_0x61e7('0x28')](_0x211566[_0x61e7('0x1f')],['ids','id'])||{});}})[_0x61e7('0x29')](function(_0x554867){logger['info'](_0x61e7('0x2a'),_0x211566);logger[_0x61e7('0x25')]('AddTags',_0x211566,JSON['stringify'](_0x554867));_0x519db9(_0x554867);})[_0x61e7('0x1c')](function(_0x19e213){logger['error'](_0x61e7('0x2a'),_0x19e213[_0x61e7('0x19')],_0x211566);_0x5a8180(_this[_0x61e7('0x16')](0x1f4,_0x19e213[_0x61e7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 48c8a41..ca4a71c 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 _0xf75e=['emit','removeListener','length','./faxInteraction.events','remove'];(function(_0x50098f,_0x15773d){var _0x5974a7=function(_0x15e3a9){while(--_0x15e3a9){_0x50098f['push'](_0x50098f['shift']());}};_0x5974a7(++_0x15773d);}(_0xf75e,0xf3));var _0xef75=function(_0x1191d0,_0x3ec933){_0x1191d0=_0x1191d0-0x0;var _0x536216=_0xf75e[_0x1191d0];return _0x536216;};'use strict';var FaxInteractionEvents=require(_0xef75('0x0'));var events=['save',_0xef75('0x1'),'update'];function createListener(_0x4b28e6,_0x308a5b){return function(_0x1546ad){_0x308a5b[_0xef75('0x2')](_0x4b28e6,_0x1546ad);};}function removeListener(_0x597c8e,_0x111a38){return function(){FaxInteractionEvents[_0xef75('0x3')](_0x597c8e,_0x111a38);};}exports['register']=function(_0x34c32f){for(var _0x25d9fb=0x0,_0x586091=events[_0xef75('0x4')];_0x25d9fb<_0x586091;_0x25d9fb++){var _0xd456a9=events[_0x25d9fb];var _0x5a2c35=createListener('faxInteraction:'+_0xd456a9,_0x34c32f);FaxInteractionEvents['on'](_0xd456a9,_0x5a2c35);}}; \ No newline at end of file +var _0x25b4=['length','faxInteraction:','save','remove','emit'];(function(_0x3c67b1,_0x58ad6d){var _0x9628a=function(_0x1e7c37){while(--_0x1e7c37){_0x3c67b1['push'](_0x3c67b1['shift']());}};_0x9628a(++_0x58ad6d);}(_0x25b4,0x192));var _0x425b=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0x25b4[_0x2cc8bb];return _0x140e40;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x425b('0x0'),_0x425b('0x1'),'update'];function createListener(_0x3194f3,_0x37077a){return function(_0x2a765d){_0x37077a[_0x425b('0x2')](_0x3194f3,_0x2a765d);};}function removeListener(_0x2bdd2f,_0x4fabab){return function(){FaxInteractionEvents['removeListener'](_0x2bdd2f,_0x4fabab);};}exports['register']=function(_0x5313d0){for(var _0x1f6fc4=0x0,_0x2e3a22=events[_0x425b('0x3')];_0x1f6fc4<_0x2e3a22;_0x1f6fc4++){var _0x437e98=events[_0x1f6fc4];var _0x146e1d=createListener(_0x425b('0x4')+_0x437e98,_0x5313d0);FaxInteractionEvents['on'](_0x437e98,_0x146e1d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 8a32ef1..1e44704 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 _0x7233=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','faxinteraction:destroy','delete','exports'];(function(_0x378f89,_0x13f5c7){var _0x3239d5=function(_0xd0423c){while(--_0xd0423c){_0x378f89['push'](_0x378f89['shift']());}};_0x3239d5(++_0x13f5c7);}(_0x7233,0x1b2));var _0x3723=function(_0x545955,_0x226c10){_0x545955=_0x545955-0x0;var _0x197994=_0x7233[_0x545955];return _0x197994;};'use strict';var multer=require(_0x3723('0x0'));var util=require(_0x3723('0x1'));var path=require(_0x3723('0x2'));var timeout=require(_0x3723('0x3'));var express=require(_0x3723('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3723('0x5'));var interaction=require(_0x3723('0x6'));var config=require(_0x3723('0x7'));var controller=require('./faxInteraction.controller');router[_0x3723('0x8')]('/',auth[_0x3723('0x9')](),controller[_0x3723('0xa')]);router[_0x3723('0x8')](_0x3723('0xb'),auth[_0x3723('0x9')](),controller[_0x3723('0xc')]);router[_0x3723('0x8')](_0x3723('0xd'),auth[_0x3723('0x9')](),controller[_0x3723('0xe')]);router['get'](_0x3723('0xf'),auth[_0x3723('0x9')](),controller[_0x3723('0x10')]);router[_0x3723('0x8')](_0x3723('0x11'),auth[_0x3723('0x9')](),controller[_0x3723('0x12')]);router[_0x3723('0x13')]('/',auth['isAuthenticated'](),controller[_0x3723('0x14')]);router[_0x3723('0x13')](_0x3723('0xf'),auth[_0x3723('0x9')](),controller[_0x3723('0x15')]);router[_0x3723('0x13')](_0x3723('0x16'),auth[_0x3723('0x9')](),interaction[_0x3723('0x17')](_0x3723('0x18'),_0x3723('0x19')),controller[_0x3723('0x1a')]);router['put'](_0x3723('0xd'),auth[_0x3723('0x9')](),interaction[_0x3723('0x17')](_0x3723('0x18'),_0x3723('0x1b')),controller['update']);router['delete'](_0x3723('0xd'),auth[_0x3723('0x9')](),interaction[_0x3723('0x17')](_0x3723('0x18'),_0x3723('0x1c')),controller['destroy']);router[_0x3723('0x1d')]('/:id/tags',auth[_0x3723('0x9')](),controller['removeTags']);module[_0x3723('0x1e')]=router; \ No newline at end of file +var _0xb071=['/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','/describe','/:id','getMessages','/:id/download','download','post','/:id/messages'];(function(_0x4051be,_0x4e30dc){var _0x10d8e5=function(_0x1ae1c2){while(--_0x1ae1c2){_0x4051be['push'](_0x4051be['shift']());}};_0x10d8e5(++_0x4e30dc);}(_0xb071,0x1da));var _0x1b07=function(_0x4f5e67,_0x163a00){_0x4f5e67=_0x4f5e67-0x0;var _0xa8e9dc=_0xb071[_0x4f5e67];return _0xa8e9dc;};'use strict';var multer=require(_0x1b07('0x0'));var util=require(_0x1b07('0x1'));var path=require(_0x1b07('0x2'));var timeout=require(_0x1b07('0x3'));var express=require(_0x1b07('0x4'));var router=express[_0x1b07('0x5')]();var fs_extra=require(_0x1b07('0x6'));var auth=require(_0x1b07('0x7'));var interaction=require(_0x1b07('0x8'));var config=require('../../config/environment');var controller=require(_0x1b07('0x9'));router[_0x1b07('0xa')]('/',auth[_0x1b07('0xb')](),controller['index']);router['get'](_0x1b07('0xc'),auth[_0x1b07('0xb')](),controller['describe']);router[_0x1b07('0xa')](_0x1b07('0xd'),auth[_0x1b07('0xb')](),controller['show']);router[_0x1b07('0xa')]('/:id/messages',auth[_0x1b07('0xb')](),controller[_0x1b07('0xe')]);router[_0x1b07('0xa')](_0x1b07('0xf'),auth['isAuthenticated'](),controller[_0x1b07('0x10')]);router[_0x1b07('0x11')]('/',auth[_0x1b07('0xb')](),controller['create']);router[_0x1b07('0x11')](_0x1b07('0x12'),auth[_0x1b07('0xb')](),controller['addMessage']);router[_0x1b07('0x11')](_0x1b07('0x13'),auth[_0x1b07('0xb')](),interaction[_0x1b07('0x14')](_0x1b07('0x15'),_0x1b07('0x16')),controller[_0x1b07('0x17')]);router[_0x1b07('0x18')](_0x1b07('0xd'),auth['isAuthenticated'](),interaction[_0x1b07('0x14')](_0x1b07('0x15'),_0x1b07('0x19')),controller[_0x1b07('0x1a')]);router[_0x1b07('0x1b')](_0x1b07('0xd'),auth[_0x1b07('0xb')](),interaction[_0x1b07('0x14')](_0x1b07('0x15'),'faxinteraction:destroy'),controller[_0x1b07('0x1c')]);router[_0x1b07('0x1b')](_0x1b07('0x13'),auth[_0x1b07('0xb')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index afa96d7..1adc326 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 _0x94dc=['ENUM','out','DATE','sequelize','TEXT','BOOLEAN'];(function(_0x368825,_0x8a5ddf){var _0x250e2c=function(_0x4c0a9c){while(--_0x4c0a9c){_0x368825['push'](_0x368825['shift']());}};_0x250e2c(++_0x8a5ddf);}(_0x94dc,0xb1));var _0xc94d=function(_0x17cd04,_0x3ceed6){_0x17cd04=_0x17cd04-0x0;var _0x32a787=_0x94dc[_0x17cd04];return _0x32a787;};'use strict';var Sequelize=require(_0xc94d('0x0'));module['exports']={'body':{'type':Sequelize[_0xc94d('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc94d('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc94d('0x3')]('in',_0xc94d('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xc94d('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xc94d('0x5')]}}; \ No newline at end of file +var _0xc090=['out','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x432038,_0x2ac6ad){var _0x10326f=function(_0x1a543f){while(--_0x1a543f){_0x432038['push'](_0x432038['shift']());}};_0x10326f(++_0x2ac6ad);}(_0xc090,0x112));var _0x0c09=function(_0x3ace8f,_0xbd8526){_0x3ace8f=_0x3ace8f-0x0;var _0x4a513b=_0xc090[_0x3ace8f];return _0x4a513b;};'use strict';var Sequelize=require(_0x0c09('0x0'));module[_0x0c09('0x1')]={'body':{'type':Sequelize[_0x0c09('0x2')](_0x0c09('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0c09('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0c09('0x5')]('in',_0x0c09('0x6')),'defaultValue':_0x0c09('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x0c09('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 2aaaa7b..d85b81d 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 _0x636e=['/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','attachments','Attachment','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','sendStatus','stack','send','index','map','FaxMessage','rawAttributes','fieldName','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','show','params','length','include','body','find','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','sequelize','QueryTypes','contact','User','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','email','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','FaxAccountId'];(function(_0x503be0,_0x581c8d){var _0x1466a6=function(_0x5c6205){while(--_0x5c6205){_0x503be0['push'](_0x503be0['shift']());}};_0x1466a6(++_0x581c8d);}(_0x636e,0x9b));var _0xe636=function(_0x136d94,_0x526d9e){_0x136d94=_0x136d94-0x0;var _0x1d7282=_0x636e[_0x136d94];return _0x1d7282;};'use strict';var emlformat=require(_0xe636('0x0'));var rimraf=require(_0xe636('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe636('0x2'));var rp=require('request-promise');var moment=require(_0xe636('0x3'));var BPromise=require(_0xe636('0x4'));var Mustache=require(_0xe636('0x5'));var util=require(_0xe636('0x6'));var path=require('path');var sox=require(_0xe636('0x7'));var csv=require('to-csv');var ejs=require(_0xe636('0x8'));var fs=require('fs');var fs_extra=require(_0xe636('0x9'));var _=require(_0xe636('0xa'));var squel=require(_0xe636('0xb'));var crypto=require(_0xe636('0xc'));var jsforce=require(_0xe636('0xd'));var deskjs=require(_0xe636('0xe'));var toCsv=require(_0xe636('0xf'));var querystring=require(_0xe636('0x10'));var Papa=require('papaparse');var Redis=require(_0xe636('0x11'));var authService=require(_0xe636('0x12'));var qs=require(_0xe636('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe636('0x14'))(_0xe636('0x15'));var utils=require(_0xe636('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe636('0x17'));var db=require('../../mysqldb')['db'];config[_0xe636('0x18')]=_['defaults'](config[_0xe636('0x18')],{'host':_0xe636('0x19'),'port':0x18eb});var socket=require(_0xe636('0x1a'))(new Redis(config[_0xe636('0x18')]));require(_0xe636('0x1b'))[_0xe636('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe636('0x1d')][_0xe636('0x1e')]({'port':0x232c});var client9002=jayson[_0xe636('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f2c36,_0x246655,_0x42b3f8,_0x1a90db){return new BPromise(function(_0x5de420,_0x2304f0){var _0x6267f7=_0x1a90db||client;return _0x6267f7[_0xe636('0x1f')](_0x3f2c36,_0x42b3f8)[_0xe636('0x20')](function(_0x468b66){logger[_0xe636('0x21')]('FaxMessage,\x20%s,\x20%s',_0x246655,_0xe636('0x22'));logger[_0xe636('0x23')](_0xe636('0x24'),_0x246655,_0xe636('0x22'),JSON[_0xe636('0x25')](_0x468b66));if(_0x468b66['error']){if(_0x468b66[_0xe636('0x26')][_0xe636('0x27')]===0x1f4){logger[_0xe636('0x26')](_0xe636('0x28'),_0x246655,_0x468b66[_0xe636('0x26')][_0xe636('0x29')]);return _0x2304f0(_0x468b66['error']['message']);}logger[_0xe636('0x26')]('FaxMessage,\x20%s,\x20%s',_0x246655,_0x468b66['error'][_0xe636('0x29')]);return _0x5de420(_0x468b66[_0xe636('0x26')][_0xe636('0x29')]);}else{logger['info'](_0xe636('0x28'),_0x246655,_0xe636('0x22'));_0x5de420(_0x468b66['result'][_0xe636('0x29')]);}})[_0xe636('0x2a')](function(_0x459c34){logger[_0xe636('0x26')](_0xe636('0x28'),_0x246655,_0x459c34);_0x2304f0(_0x459c34);});});}function respondWithStatusCode(_0xadd781,_0x4afc45){_0x4afc45=_0x4afc45||0xcc;return function(_0x3154e7){if(_0x3154e7){return _0xadd781['sendStatus'](_0x4afc45);}return _0xadd781[_0xe636('0x2b')](_0x4afc45)[_0xe636('0x2c')]();};}function respondWithResult(_0x30e4d5,_0x42bef){_0x42bef=_0x42bef||0xc8;return function(_0x2bec84){if(_0x2bec84){return _0x30e4d5[_0xe636('0x2b')](_0x42bef)[_0xe636('0x2d')](_0x2bec84);}};}function respondWithFilteredResult(_0x7ec764,_0x243b76){return function(_0x2fbfed){if(_0x2fbfed){var _0x5e4ff4=typeof _0x243b76[_0xe636('0x2e')]==='undefined'&&typeof _0x243b76[_0xe636('0x2f')]===_0xe636('0x30');var _0x394f1e=_0x2fbfed[_0xe636('0x31')];var _0x2aca82=_0x5e4ff4?0x0:_0x243b76[_0xe636('0x2e')];var _0x55ce0b=_0x5e4ff4?_0x2fbfed[_0xe636('0x31')]:_0x243b76[_0xe636('0x2e')]+_0x243b76[_0xe636('0x2f')];var _0x3f19a4;if(_0x55ce0b>=_0x394f1e){_0x55ce0b=_0x394f1e;_0x3f19a4=0xc8;}else{_0x3f19a4=0xce;}_0x7ec764[_0xe636('0x2b')](_0x3f19a4);return _0x7ec764[_0xe636('0x32')](_0xe636('0x33'),_0x2aca82+'-'+_0x55ce0b+'/'+_0x394f1e)[_0xe636('0x2d')](_0x2fbfed);}return null;};}function patchUpdates(_0x2ddec5){return function(_0x52c904){try{jsonpatch['apply'](_0x52c904,_0x2ddec5,!![]);}catch(_0xb7a64c){return BPromise[_0xe636('0x34')](_0xb7a64c);}return _0x52c904[_0xe636('0x35')]();};}function saveUpdates(_0x573afc,_0x1b5b73){return function(_0xfefb00){if(_0xfefb00){return _0xfefb00[_0xe636('0x36')](_0x573afc)[_0xe636('0x20')](function(_0x56a106){return _0x56a106;});}return null;};}function removeEntity(_0x18cada,_0x26724d){return function(_0x48d26a){if(_0x48d26a){return _0x48d26a[_0xe636('0x37')]()[_0xe636('0x20')](function(){_0x18cada[_0xe636('0x2b')](0xcc)[_0xe636('0x2c')]();});}};}function handleEntityNotFound(_0x2ffa27,_0x26c488){return function(_0xc230ef){if(!_0xc230ef){_0x2ffa27[_0xe636('0x38')](0x194);}return _0xc230ef;};}function handleError(_0x1864f5,_0x344bb2){_0x344bb2=_0x344bb2||0x1f4;return function(_0xbe2f15){logger[_0xe636('0x26')](_0xbe2f15[_0xe636('0x39')]);if(_0xbe2f15['name']){delete _0xbe2f15['name'];}_0x1864f5[_0xe636('0x2b')](_0x344bb2)[_0xe636('0x3a')](_0xbe2f15);};}exports[_0xe636('0x3b')]=function(_0x14367a,_0x57abec){var _0x355802={},_0x1fea40={},_0x1ffb8e={'count':0x0,'rows':[]};var _0x3ed2d1=_[_0xe636('0x3c')](db[_0xe636('0x3d')][_0xe636('0x3e')],function(_0x89f067){return{'name':_0x89f067[_0xe636('0x3f')],'type':_0x89f067['type']['key']};});_0x1fea40[_0xe636('0x40')]=_[_0xe636('0x3c')](_0x3ed2d1,_0xe636('0x41'));_0x1fea40[_0xe636('0x42')]=_[_0xe636('0x43')](_0x14367a[_0xe636('0x42')]);_0x1fea40[_0xe636('0x44')]=_[_0xe636('0x45')](_0x1fea40[_0xe636('0x40')],_0x1fea40[_0xe636('0x42')]);_0x355802[_0xe636('0x46')]=_['intersection'](_0x1fea40[_0xe636('0x40')],qs[_0xe636('0x47')](_0x14367a[_0xe636('0x42')][_0xe636('0x47')]));_0x355802[_0xe636('0x46')]=_0x355802['attributes']['length']?_0x355802[_0xe636('0x46')]:_0x1fea40[_0xe636('0x40')];if(!_0x14367a['query'][_0xe636('0x48')](_0xe636('0x49'))){_0x355802[_0xe636('0x2f')]=qs['limit'](_0x14367a['query'][_0xe636('0x2f')]);_0x355802[_0xe636('0x2e')]=qs['offset'](_0x14367a[_0xe636('0x42')][_0xe636('0x2e')]);}_0x355802[_0xe636('0x4a')]=qs[_0xe636('0x4b')](_0x14367a[_0xe636('0x42')][_0xe636('0x4b')]);_0x355802[_0xe636('0x4c')]=qs['filters'](_[_0xe636('0x4d')](_0x14367a[_0xe636('0x42')],_0x1fea40[_0xe636('0x44')]),_0x3ed2d1);if(_0x14367a['query'][_0xe636('0x4e')]){_0x355802['where']=_[_0xe636('0x4f')](_0x355802[_0xe636('0x4c')],{'$or':_['map'](_0x3ed2d1,function(_0x1caa64){if(_0x1caa64[_0xe636('0x50')]!=='VIRTUAL'){var _0x30b00b={};_0x30b00b[_0x1caa64['name']]={'$like':'%'+_0x14367a[_0xe636('0x42')][_0xe636('0x4e')]+'%'};return _0x30b00b;}})});}_0x355802=_['merge']({},_0x355802,_0x14367a[_0xe636('0x51')]);var _0x1d08a8={'where':_0x355802['where']};return db[_0xe636('0x3d')][_0xe636('0x31')](_0x1d08a8)['then'](function(_0x18f32e){_0x1ffb8e[_0xe636('0x31')]=_0x18f32e;if(_0x14367a[_0xe636('0x42')][_0xe636('0x52')]){_0x355802['include']=[{'all':!![]}];}return db[_0xe636('0x3d')][_0xe636('0x53')](_0x355802);})[_0xe636('0x20')](function(_0x2cfd33){_0x1ffb8e[_0xe636('0x54')]=_0x2cfd33;return _0x1ffb8e;})[_0xe636('0x20')](respondWithFilteredResult(_0x57abec,_0x355802))[_0xe636('0x2a')](handleError(_0x57abec,null));};exports[_0xe636('0x55')]=function(_0x3ad386,_0x1f9500){var _0x405d90={'raw':!![],'where':{'id':_0x3ad386[_0xe636('0x56')]['id']}},_0x370e7b={};_0x370e7b[_0xe636('0x40')]=_[_0xe636('0x43')](db[_0xe636('0x3d')][_0xe636('0x3e')]);_0x370e7b[_0xe636('0x42')]=_['keys'](_0x3ad386[_0xe636('0x42')]);_0x370e7b[_0xe636('0x44')]=_[_0xe636('0x45')](_0x370e7b[_0xe636('0x40')],_0x370e7b[_0xe636('0x42')]);_0x405d90[_0xe636('0x46')]=_[_0xe636('0x45')](_0x370e7b[_0xe636('0x40')],qs[_0xe636('0x47')](_0x3ad386['query']['fields']));_0x405d90[_0xe636('0x46')]=_0x405d90[_0xe636('0x46')][_0xe636('0x57')]?_0x405d90[_0xe636('0x46')]:_0x370e7b['model'];if(_0x3ad386[_0xe636('0x42')][_0xe636('0x52')]){_0x405d90[_0xe636('0x58')]=[{'all':!![]}];}_0x405d90=_[_0xe636('0x4f')]({},_0x405d90,_0x3ad386[_0xe636('0x51')]);return db[_0xe636('0x3d')]['find'](_0x405d90)[_0xe636('0x20')](handleEntityNotFound(_0x1f9500,null))[_0xe636('0x20')](respondWithResult(_0x1f9500,null))[_0xe636('0x2a')](handleError(_0x1f9500,null));};exports['update']=function(_0x4ecf46,_0x5b8b37){if(_0x4ecf46[_0xe636('0x59')]['id']){delete _0x4ecf46[_0xe636('0x59')]['id'];}return db[_0xe636('0x3d')][_0xe636('0x5a')]({'where':{'id':_0x4ecf46[_0xe636('0x56')]['id']}})['then'](handleEntityNotFound(_0x5b8b37,null))[_0xe636('0x20')](saveUpdates(_0x4ecf46[_0xe636('0x59')],null))[_0xe636('0x20')](respondWithResult(_0x5b8b37,null))[_0xe636('0x2a')](handleError(_0x5b8b37,null));};exports['destroy']=function(_0x4a73df,_0x856084){return db['FaxMessage'][_0xe636('0x5a')]({'where':{'id':_0x4a73df[_0xe636('0x56')]['id']}})['then'](handleEntityNotFound(_0x856084,null))[_0xe636('0x20')](removeEntity(_0x856084,null))[_0xe636('0x2a')](handleError(_0x856084,null));};exports[_0xe636('0x5b')]=function(_0x39a5db,_0x708e34){return db[_0xe636('0x3d')][_0xe636('0x5b')]()[_0xe636('0x20')](respondWithResult(_0x708e34,null))[_0xe636('0x2a')](handleError(_0x708e34,null));};var interaction_log=require('../../config/logger')(_0xe636('0x5c'));exports[_0xe636('0x5d')]=function(_0x4a0a09,_0x585b25,_0x19f8bc){var _0x344fcd={'agent':{},'channel':_0xe636('0x5e')};if(_0x4a0a09[_0xe636('0x59')]['id']){delete _0x4a0a09[_0xe636('0x59')]['id'];}_0x4a0a09[_0xe636('0x59')][_0xe636('0x5f')]=!![];_0x4a0a09['body'][_0xe636('0x60')]=moment()[_0xe636('0x61')](_0xe636('0x62'));_0x4a0a09[_0xe636('0x59')][_0xe636('0x63')]=_0x4a0a09[_0xe636('0x59')][_0xe636('0x63')]||_0x4a0a09['user']['id'];_0x344fcd['agent']['id']=_0x4a0a09[_0xe636('0x59')][_0xe636('0x63')];return db[_0xe636('0x3d')][_0xe636('0x5a')]({'where':{'id':_0x4a0a09[_0xe636('0x56')]['id'],'UserId':null}})[_0xe636('0x20')](handleEntityNotFound(_0x585b25,null))['then'](saveUpdates(_0x4a0a09[_0xe636('0x59')],null))[_0xe636('0x20')](function(_0x32d91b){if(_0x32d91b){_0x344fcd[_0xe636('0x29')]=_0x32d91b[_0xe636('0x64')]({'plain':!![]});return db[_0xe636('0x65')][_0xe636('0x5a')]({'where':{'id':_0x32d91b[_0xe636('0x66')]}});}return null;})[_0xe636('0x20')](handleEntityNotFound(_0x585b25,null))[_0xe636('0x20')](function(_0x1dec21){if(_0x1dec21){return _0x1dec21[_0xe636('0x36')]({'UserId':_0x4a0a09['body'][_0xe636('0x63')],'read1stAt':_[_0xe636('0x67')](_0x1dec21[_0xe636('0x68')])?moment()[_0xe636('0x61')](_0xe636('0x62')):undefined});}return null;})[_0xe636('0x20')](function(_0x15a7d8){if(_0x15a7d8){_0x344fcd[_0xe636('0x69')]=_0x15a7d8[_0xe636('0x64')]({'plain':!![]});interaction_log[_0xe636('0x21')](_0xe636('0x6a'),_0x4a0a09[_0xe636('0x6b')]['id'],_0x4a0a09[_0xe636('0x6b')]['name'],_0x4a0a09[_0xe636('0x6b')][_0xe636('0x6c')],_0x344fcd[_0xe636('0x69')]['id'],_0x4a0a09['body']?JSON[_0xe636('0x25')](_0x4a0a09['body']):_0xe636('0x6d'));return respondWithRpcPromise(_0xe636('0x6e'),_0xe636('0x6f'),_0x344fcd);}return null;})[_0xe636('0x20')](function(_0x64ce05){var _0x4dc7f2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x64ce05[_0xe636('0x29')]['ContactId'];return db[_0xe636('0x70')][_0xe636('0x42')](_0x4dc7f2,{'type':db['Sequelize'][_0xe636('0x71')]['SELECT'],'raw':!![]})[_0xe636('0x20')](function(_0x384385){return _0x384385;});})[_0xe636('0x20')](function(_0x494ba7){if(_0x494ba7){_0x344fcd[_0xe636('0x29')][_0xe636('0x72')]=_0x494ba7[0x0];if(!_0x4a0a09[_0xe636('0x59')][_0xe636('0x63')])return;return db[_0xe636('0x73')][_0xe636('0x5a')]({'where':{'id':_0x4a0a09[_0xe636('0x59')][_0xe636('0x63')],'role':_0xe636('0x74')},'attributes':['id','name',_0xe636('0x75'),'email',_0xe636('0x76')],'raw':!![]});}return null;})[_0xe636('0x20')](function(_0x5ca3d6){if(!_0x5ca3d6)return null;_0x344fcd[_0xe636('0x29')][_0xe636('0x74')]=_0x5ca3d6;return _0x344fcd;})[_0xe636('0x20')](function(_0x57d22b){if(_0x57d22b){if(_0x4a0a09['body'][_0xe636('0x77')]){_0x344fcd['message'][_0xe636('0x78')]=util[_0xe636('0x61')](_0xe636('0x79'),_0x4a0a09[_0xe636('0x6b')][_0xe636('0x41')]);_0x344fcd[_0xe636('0x29')]['channel']=_0x344fcd[_0xe636('0x7a')];_0x344fcd[_0xe636('0x29')][_0xe636('0x7b')]=_0x344fcd[_0xe636('0x7a')];_0x344fcd[_0xe636('0x29')][_0xe636('0x7c')]=_0xe636('0x5d');return respondWithRpcPromise(_0xe636('0x7d'),'EventManager',{'event':_0xe636('0x7e'),'message':_0x344fcd[_0xe636('0x29')]},client9002)[_0xe636('0x20')](function(){return _0x344fcd;});}return _0x344fcd;}return null;})[_0xe636('0x20')](respondWithResult(_0x585b25,null))['catch'](handleError(_0x585b25,null));};var interaction_log=require(_0xe636('0x14'))(_0xe636('0x5c'));exports[_0xe636('0x34')]=function(_0x1cf93e,_0x564654,_0x5a22df){var _0x32c918={'agent':{},'channel':_0xe636('0x5e')};if(_0x1cf93e[_0xe636('0x59')]['id']){delete _0x1cf93e[_0xe636('0x59')]['id'];}_0x1cf93e[_0xe636('0x59')][_0xe636('0x63')]=_0x1cf93e['body'][_0xe636('0x63')]||_0x1cf93e[_0xe636('0x6b')]['id'];_0x32c918[_0xe636('0x74')]['id']=_0x1cf93e[_0xe636('0x59')][_0xe636('0x63')];return db[_0xe636('0x3d')][_0xe636('0x5a')]({'where':{'id':_0x1cf93e['params']['id'],'UserId':null}})[_0xe636('0x20')](handleEntityNotFound(_0x564654,null))['then'](function(_0x44c18a){if(_0x44c18a){_0x32c918[_0xe636('0x29')]=_0x44c18a[_0xe636('0x64')]({'plain':!![]});return db[_0xe636('0x65')][_0xe636('0x5a')]({'where':{'id':_0x44c18a[_0xe636('0x66')]}});}return null;})[_0xe636('0x20')](handleEntityNotFound(_0x564654,null))[_0xe636('0x20')](function(_0x310490){if(_0x310490){_0x32c918[_0xe636('0x69')]=_0x310490[_0xe636('0x64')]({'plain':!![]});interaction_log[_0xe636('0x21')](_0xe636('0x7f'),_0x1cf93e[_0xe636('0x6b')]['id'],_0x1cf93e[_0xe636('0x6b')]['name'],_0x1cf93e[_0xe636('0x6b')][_0xe636('0x6c')],_0x32c918[_0xe636('0x69')]['id'],_0x1cf93e[_0xe636('0x59')]?JSON[_0xe636('0x25')](_0x1cf93e[_0xe636('0x59')]):'null');return respondWithRpcPromise(_0xe636('0x80'),'rejectMessage',_0x32c918);}return null;})['then'](function(_0x23f842){var _0x2264d9=_0xe636('0x81')+_0x23f842[_0xe636('0x29')][_0xe636('0x82')];return db[_0xe636('0x70')][_0xe636('0x42')](_0x2264d9,{'type':db[_0xe636('0x83')]['QueryTypes'][_0xe636('0x84')],'raw':!![]})['then'](function(_0x308b45){return _0x308b45;});})[_0xe636('0x20')](function(_0x82bc6d){if(_0x82bc6d){_0x32c918['message']['contact']=_0x82bc6d[0x0];if(!_0x1cf93e[_0xe636('0x59')][_0xe636('0x63')])return;return db[_0xe636('0x73')][_0xe636('0x5a')]({'where':{'id':_0x1cf93e[_0xe636('0x59')]['UserId'],'role':_0xe636('0x74')},'attributes':['id',_0xe636('0x41'),_0xe636('0x75'),_0xe636('0x85'),_0xe636('0x76')],'raw':!![]});}return null;})['then'](function(_0x4843b0){if(!_0x4843b0)return null;_0x32c918['message'][_0xe636('0x74')]=_0x4843b0;return _0x32c918;})['then'](function(_0xed769e){if(_0xed769e){_0xed769e[_0xe636('0x29')]['interface']=util[_0xe636('0x61')](_0xe636('0x79'),_0x1cf93e[_0xe636('0x6b')][_0xe636('0x41')]);_0xed769e['message'][_0xe636('0x7a')]=_0x32c918['channel'];_0xed769e[_0xe636('0x29')][_0xe636('0x7b')]=_0x32c918[_0xe636('0x7a')];_0xed769e[_0xe636('0x29')][_0xe636('0x7c')]=_0xe636('0x34');respondWithRpcPromise(_0xe636('0x7d'),_0xe636('0x7d'),{'event':_0xe636('0x86'),'message':_0xed769e['message']},client9002);return _0x32c918;}return null;})[_0xe636('0x20')](respondWithResult(_0x564654,null))[_0xe636('0x2a')](handleError(_0x564654,null));};exports[_0xe636('0x87')]=function(_0x179112,_0x2b21eb){var _0x5222f5;return db['FaxMessage'][_0xe636('0x87')](_0x179112[_0xe636('0x59')],{})[_0xe636('0x20')](function(_0x353bd2){_0x5222f5=_0x353bd2;return db[_0xe636('0x88')][_0xe636('0x89')]({'where':{'id':_0x5222f5[_0xe636('0x82')]}});})[_0xe636('0x20')](function(_0x2d18a0){if(_[_0xe636('0x67')](_0x2d18a0)){return;}else{_0x5222f5[_0xe636('0x5e')]=_0x2d18a0[_0xe636('0x5e')];return db['Attachment'][_0xe636('0x89')]({'where':{'id':_0x5222f5[_0xe636('0x8a')]}});}})[_0xe636('0x20')](function(_0x1945cc){return respondWithRpcPromise(_0xe636('0x8b'),_0xe636('0x8b'),{'FaxAccountId':_[_0xe636('0x67')](_0x179112[_0xe636('0x59')])?undefined:_0x179112[_0xe636('0x59')][_0xe636('0x8c')],'path':_[_0xe636('0x67')](_0x1945cc)?undefined:util['format'](_0xe636('0x8d'),_0x1945cc[_0xe636('0x8e')]),'fax':_[_0xe636('0x67')](_0x5222f5[_0xe636('0x5e')])?undefined:_0x5222f5[_0xe636('0x5e')],'AttachmentId':_0x5222f5['AttachmentId']},client9002);})[_0xe636('0x20')](respondWithResult(_0x2b21eb,0xc9))[_0xe636('0x2a')](handleError(_0x2b21eb,null));};exports[_0xe636('0x8f')]=function(_0x330cb4,_0x54b8de){var _0x1d32fe=path[_0xe636('0x90')](config[_0xe636('0x91')],'server','files',_0xe636('0x92'));return db[_0xe636('0x3d')][_0xe636('0x5a')]({'where':{'id':_0x330cb4['params']['id']},'include':[{'model':db[_0xe636('0x93')],'as':_0xe636('0x93')}]})['then'](handleEntityNotFound(_0x54b8de,null))['then'](function(_0x44ffa0){if(_0x44ffa0){return _0x54b8de['download'](path[_0xe636('0x90')](_0x1d32fe,_0x44ffa0[_0xe636('0x93')][_0xe636('0x8e')]));}})[_0xe636('0x2a')](handleError(_0x54b8de,null));}; \ No newline at end of file +var _0xc5dd=['options','includeAll','findAll','rows','show','include','body','find','params','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','info','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','interface','SIP/%s','motionChannel','channel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','internal','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','destroy','end','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x50db88,_0x8397d2){var _0x13861d=function(_0x2eaa01){while(--_0x2eaa01){_0x50db88['push'](_0x50db88['shift']());}};_0x13861d(++_0x8397d2);}(_0xc5dd,0x1ea));var _0xdc5d=function(_0x23259a,_0x4b32d4){_0x23259a=_0x23259a-0x0;var _0x395bce=_0xc5dd[_0x23259a];return _0x395bce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc5d('0x0'));var zipdir=require(_0xdc5d('0x1'));var jsonpatch=require(_0xdc5d('0x2'));var rp=require(_0xdc5d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdc5d('0x4'));var path=require(_0xdc5d('0x5'));var sox=require(_0xdc5d('0x6'));var csv=require('to-csv');var ejs=require(_0xdc5d('0x7'));var fs=require('fs');var fs_extra=require(_0xdc5d('0x8'));var _=require(_0xdc5d('0x9'));var squel=require(_0xdc5d('0xa'));var crypto=require(_0xdc5d('0xb'));var jsforce=require(_0xdc5d('0xc'));var deskjs=require(_0xdc5d('0xd'));var toCsv=require(_0xdc5d('0xe'));var querystring=require('querystring');var Papa=require(_0xdc5d('0xf'));var Redis=require(_0xdc5d('0x10'));var authService=require(_0xdc5d('0x11'));var qs=require(_0xdc5d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc5d('0x13'));var logger=require(_0xdc5d('0x14'))(_0xdc5d('0x15'));var utils=require(_0xdc5d('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xdc5d('0x17')]=_[_0xdc5d('0x18')](config[_0xdc5d('0x17')],{'host':_0xdc5d('0x19'),'port':0x18eb});var socket=require(_0xdc5d('0x1a'))(new Redis(config[_0xdc5d('0x17')]));require(_0xdc5d('0x1b'))[_0xdc5d('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdc5d('0x1d')][_0xdc5d('0x1e')]({'port':0x232c});var client9002=jayson[_0xdc5d('0x1d')][_0xdc5d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xb03d6,_0x21e99b,_0x102847,_0x3dcd81){return new BPromise(function(_0x1a0d01,_0x1671ec){var _0x550687=_0x3dcd81||client;return _0x550687[_0xdc5d('0x1f')](_0xb03d6,_0x102847)[_0xdc5d('0x20')](function(_0x276da8){logger['info'](_0xdc5d('0x21'),_0x21e99b,'request\x20sent');logger[_0xdc5d('0x22')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x21e99b,_0xdc5d('0x23'),JSON[_0xdc5d('0x24')](_0x276da8));if(_0x276da8[_0xdc5d('0x25')]){if(_0x276da8[_0xdc5d('0x25')][_0xdc5d('0x26')]===0x1f4){logger[_0xdc5d('0x25')](_0xdc5d('0x21'),_0x21e99b,_0x276da8[_0xdc5d('0x25')]['message']);return _0x1671ec(_0x276da8[_0xdc5d('0x25')][_0xdc5d('0x27')]);}logger[_0xdc5d('0x25')](_0xdc5d('0x21'),_0x21e99b,_0x276da8[_0xdc5d('0x25')]['message']);return _0x1a0d01(_0x276da8[_0xdc5d('0x25')][_0xdc5d('0x27')]);}else{logger['info'](_0xdc5d('0x21'),_0x21e99b,'request\x20sent');_0x1a0d01(_0x276da8['result']['message']);}})[_0xdc5d('0x28')](function(_0x330b9d){logger[_0xdc5d('0x25')](_0xdc5d('0x21'),_0x21e99b,_0x330b9d);_0x1671ec(_0x330b9d);});});}function respondWithStatusCode(_0x580c28,_0x1e7ba3){_0x1e7ba3=_0x1e7ba3||0xcc;return function(_0x3707fd){if(_0x3707fd){return _0x580c28[_0xdc5d('0x29')](_0x1e7ba3);}return _0x580c28[_0xdc5d('0x2a')](_0x1e7ba3)['end']();};}function respondWithResult(_0x21edff,_0x4d08bb){_0x4d08bb=_0x4d08bb||0xc8;return function(_0x20de1e){if(_0x20de1e){return _0x21edff[_0xdc5d('0x2a')](_0x4d08bb)[_0xdc5d('0x2b')](_0x20de1e);}};}function respondWithFilteredResult(_0x3d69bc,_0x5c5df1){return function(_0x334038){if(_0x334038){var _0xf486a1=typeof _0x5c5df1[_0xdc5d('0x2c')]===_0xdc5d('0x2d')&&typeof _0x5c5df1[_0xdc5d('0x2e')]===_0xdc5d('0x2d');var _0x3a6fd2=_0x334038['count'];var _0x4850e5=_0xf486a1?0x0:_0x5c5df1[_0xdc5d('0x2c')];var _0x40c39b=_0xf486a1?_0x334038[_0xdc5d('0x2f')]:_0x5c5df1[_0xdc5d('0x2c')]+_0x5c5df1[_0xdc5d('0x2e')];var _0x330b15;if(_0x40c39b>=_0x3a6fd2){_0x40c39b=_0x3a6fd2;_0x330b15=0xc8;}else{_0x330b15=0xce;}_0x3d69bc[_0xdc5d('0x2a')](_0x330b15);return _0x3d69bc['set'](_0xdc5d('0x30'),_0x4850e5+'-'+_0x40c39b+'/'+_0x3a6fd2)['json'](_0x334038);}return null;};}function patchUpdates(_0x558cec){return function(_0x2a1798){try{jsonpatch['apply'](_0x2a1798,_0x558cec,!![]);}catch(_0xa0d571){return BPromise[_0xdc5d('0x31')](_0xa0d571);}return _0x2a1798['save']();};}function saveUpdates(_0x4bfc98,_0x331082){return function(_0x57568a){if(_0x57568a){return _0x57568a[_0xdc5d('0x32')](_0x4bfc98)[_0xdc5d('0x20')](function(_0x489b68){return _0x489b68;});}return null;};}function removeEntity(_0x2a8eb3,_0x2eb737){return function(_0x4cf7d9){if(_0x4cf7d9){return _0x4cf7d9[_0xdc5d('0x33')]()[_0xdc5d('0x20')](function(){_0x2a8eb3['status'](0xcc)[_0xdc5d('0x34')]();});}};}function handleEntityNotFound(_0x10242c,_0x4e6dc9){return function(_0x157aa9){if(!_0x157aa9){_0x10242c[_0xdc5d('0x29')](0x194);}return _0x157aa9;};}function handleError(_0x28bfc3,_0x25511a){_0x25511a=_0x25511a||0x1f4;return function(_0x31e7eb){logger[_0xdc5d('0x25')](_0x31e7eb[_0xdc5d('0x35')]);if(_0x31e7eb[_0xdc5d('0x36')]){delete _0x31e7eb[_0xdc5d('0x36')];}_0x28bfc3[_0xdc5d('0x2a')](_0x25511a)['send'](_0x31e7eb);};}exports[_0xdc5d('0x37')]=function(_0x52338c,_0x53b8da){var _0x1e2e76={},_0x5bbe00={},_0x267459={'count':0x0,'rows':[]};var _0x162104=_[_0xdc5d('0x38')](db[_0xdc5d('0x39')][_0xdc5d('0x3a')],function(_0x209253){return{'name':_0x209253[_0xdc5d('0x3b')],'type':_0x209253[_0xdc5d('0x3c')][_0xdc5d('0x3d')]};});_0x5bbe00[_0xdc5d('0x3e')]=_['map'](_0x162104,_0xdc5d('0x36'));_0x5bbe00['query']=_[_0xdc5d('0x3f')](_0x52338c[_0xdc5d('0x40')]);_0x5bbe00[_0xdc5d('0x41')]=_[_0xdc5d('0x42')](_0x5bbe00[_0xdc5d('0x3e')],_0x5bbe00['query']);_0x1e2e76['attributes']=_[_0xdc5d('0x42')](_0x5bbe00[_0xdc5d('0x3e')],qs[_0xdc5d('0x43')](_0x52338c[_0xdc5d('0x40')][_0xdc5d('0x43')]));_0x1e2e76[_0xdc5d('0x44')]=_0x1e2e76[_0xdc5d('0x44')][_0xdc5d('0x45')]?_0x1e2e76[_0xdc5d('0x44')]:_0x5bbe00[_0xdc5d('0x3e')];if(!_0x52338c[_0xdc5d('0x40')][_0xdc5d('0x46')]('nolimit')){_0x1e2e76[_0xdc5d('0x2e')]=qs['limit'](_0x52338c['query'][_0xdc5d('0x2e')]);_0x1e2e76[_0xdc5d('0x2c')]=qs[_0xdc5d('0x2c')](_0x52338c[_0xdc5d('0x40')][_0xdc5d('0x2c')]);}_0x1e2e76[_0xdc5d('0x47')]=qs[_0xdc5d('0x48')](_0x52338c[_0xdc5d('0x40')]['sort']);_0x1e2e76['where']=qs[_0xdc5d('0x41')](_[_0xdc5d('0x49')](_0x52338c[_0xdc5d('0x40')],_0x5bbe00['filters']),_0x162104);if(_0x52338c[_0xdc5d('0x40')][_0xdc5d('0x4a')]){_0x1e2e76[_0xdc5d('0x4b')]=_[_0xdc5d('0x4c')](_0x1e2e76['where'],{'$or':_[_0xdc5d('0x38')](_0x162104,function(_0x2a83c1){if(_0x2a83c1[_0xdc5d('0x3c')]!==_0xdc5d('0x4d')){var _0x563f63={};_0x563f63[_0x2a83c1['name']]={'$like':'%'+_0x52338c[_0xdc5d('0x40')]['filter']+'%'};return _0x563f63;}})});}_0x1e2e76=_[_0xdc5d('0x4c')]({},_0x1e2e76,_0x52338c[_0xdc5d('0x4e')]);var _0x4741c9={'where':_0x1e2e76[_0xdc5d('0x4b')]};return db[_0xdc5d('0x39')][_0xdc5d('0x2f')](_0x4741c9)[_0xdc5d('0x20')](function(_0x52128e){_0x267459[_0xdc5d('0x2f')]=_0x52128e;if(_0x52338c[_0xdc5d('0x40')][_0xdc5d('0x4f')]){_0x1e2e76['include']=[{'all':!![]}];}return db[_0xdc5d('0x39')][_0xdc5d('0x50')](_0x1e2e76);})[_0xdc5d('0x20')](function(_0x18ab5f){_0x267459[_0xdc5d('0x51')]=_0x18ab5f;return _0x267459;})['then'](respondWithFilteredResult(_0x53b8da,_0x1e2e76))[_0xdc5d('0x28')](handleError(_0x53b8da,null));};exports[_0xdc5d('0x52')]=function(_0x1a187c,_0x35ca6d){var _0x14ffa2={'raw':!![],'where':{'id':_0x1a187c['params']['id']}},_0xea2275={};_0xea2275['model']=_[_0xdc5d('0x3f')](db[_0xdc5d('0x39')][_0xdc5d('0x3a')]);_0xea2275['query']=_[_0xdc5d('0x3f')](_0x1a187c[_0xdc5d('0x40')]);_0xea2275[_0xdc5d('0x41')]=_['intersection'](_0xea2275[_0xdc5d('0x3e')],_0xea2275[_0xdc5d('0x40')]);_0x14ffa2[_0xdc5d('0x44')]=_['intersection'](_0xea2275[_0xdc5d('0x3e')],qs[_0xdc5d('0x43')](_0x1a187c['query']['fields']));_0x14ffa2[_0xdc5d('0x44')]=_0x14ffa2['attributes'][_0xdc5d('0x45')]?_0x14ffa2[_0xdc5d('0x44')]:_0xea2275[_0xdc5d('0x3e')];if(_0x1a187c[_0xdc5d('0x40')][_0xdc5d('0x4f')]){_0x14ffa2[_0xdc5d('0x53')]=[{'all':!![]}];}_0x14ffa2=_['merge']({},_0x14ffa2,_0x1a187c['options']);return db[_0xdc5d('0x39')]['find'](_0x14ffa2)[_0xdc5d('0x20')](handleEntityNotFound(_0x35ca6d,null))[_0xdc5d('0x20')](respondWithResult(_0x35ca6d,null))[_0xdc5d('0x28')](handleError(_0x35ca6d,null));};exports[_0xdc5d('0x32')]=function(_0x34823b,_0x175ab1){if(_0x34823b[_0xdc5d('0x54')]['id']){delete _0x34823b[_0xdc5d('0x54')]['id'];}return db[_0xdc5d('0x39')][_0xdc5d('0x55')]({'where':{'id':_0x34823b[_0xdc5d('0x56')]['id']}})[_0xdc5d('0x20')](handleEntityNotFound(_0x175ab1,null))[_0xdc5d('0x20')](saveUpdates(_0x34823b[_0xdc5d('0x54')],null))[_0xdc5d('0x20')](respondWithResult(_0x175ab1,null))[_0xdc5d('0x28')](handleError(_0x175ab1,null));};exports[_0xdc5d('0x33')]=function(_0x4fe532,_0x2104cf){return db[_0xdc5d('0x39')][_0xdc5d('0x55')]({'where':{'id':_0x4fe532[_0xdc5d('0x56')]['id']}})[_0xdc5d('0x20')](handleEntityNotFound(_0x2104cf,null))[_0xdc5d('0x20')](removeEntity(_0x2104cf,null))[_0xdc5d('0x28')](handleError(_0x2104cf,null));};exports[_0xdc5d('0x57')]=function(_0x255a57,_0x187136){return db[_0xdc5d('0x39')][_0xdc5d('0x57')]()[_0xdc5d('0x20')](respondWithResult(_0x187136,null))[_0xdc5d('0x28')](handleError(_0x187136,null));};var interaction_log=require(_0xdc5d('0x14'))(_0xdc5d('0x58'));exports[_0xdc5d('0x59')]=function(_0x3e5c41,_0x3cf472,_0x48fe06){var _0x1c6ea0={'agent':{},'channel':_0xdc5d('0x5a')};if(_0x3e5c41[_0xdc5d('0x54')]['id']){delete _0x3e5c41[_0xdc5d('0x54')]['id'];}_0x3e5c41['body'][_0xdc5d('0x5b')]=!![];_0x3e5c41[_0xdc5d('0x54')][_0xdc5d('0x5c')]=moment()[_0xdc5d('0x5d')](_0xdc5d('0x5e'));_0x3e5c41[_0xdc5d('0x54')][_0xdc5d('0x5f')]=_0x3e5c41[_0xdc5d('0x54')]['UserId']||_0x3e5c41[_0xdc5d('0x60')]['id'];_0x1c6ea0[_0xdc5d('0x61')]['id']=_0x3e5c41[_0xdc5d('0x54')]['UserId'];return db[_0xdc5d('0x39')][_0xdc5d('0x55')]({'where':{'id':_0x3e5c41[_0xdc5d('0x56')]['id'],'UserId':null}})[_0xdc5d('0x20')](handleEntityNotFound(_0x3cf472,null))[_0xdc5d('0x20')](saveUpdates(_0x3e5c41[_0xdc5d('0x54')],null))[_0xdc5d('0x20')](function(_0x1e168a){if(_0x1e168a){_0x1c6ea0[_0xdc5d('0x27')]=_0x1e168a[_0xdc5d('0x62')]({'plain':!![]});return db[_0xdc5d('0x63')][_0xdc5d('0x55')]({'where':{'id':_0x1e168a[_0xdc5d('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x3cf472,null))[_0xdc5d('0x20')](function(_0x440acf){if(_0x440acf){return _0x440acf[_0xdc5d('0x32')]({'UserId':_0x3e5c41[_0xdc5d('0x54')]['UserId'],'read1stAt':_[_0xdc5d('0x65')](_0x440acf[_0xdc5d('0x66')])?moment()[_0xdc5d('0x5d')](_0xdc5d('0x5e')):undefined});}return null;})['then'](function(_0x2dbc20){if(_0x2dbc20){_0x1c6ea0[_0xdc5d('0x67')]=_0x2dbc20[_0xdc5d('0x62')]({'plain':!![]});interaction_log[_0xdc5d('0x68')](_0xdc5d('0x69'),_0x3e5c41[_0xdc5d('0x60')]['id'],_0x3e5c41[_0xdc5d('0x60')][_0xdc5d('0x36')],_0x3e5c41[_0xdc5d('0x60')][_0xdc5d('0x6a')],_0x1c6ea0[_0xdc5d('0x67')]['id'],_0x3e5c41['body']?JSON[_0xdc5d('0x24')](_0x3e5c41[_0xdc5d('0x54')]):_0xdc5d('0x6b'));return respondWithRpcPromise(_0xdc5d('0x6c'),'acceptMessage',_0x1c6ea0);}return null;})['then'](function(_0x11b963){var _0x25b56b=_0xdc5d('0x6d')+_0x11b963[_0xdc5d('0x27')][_0xdc5d('0x6e')];return db[_0xdc5d('0x6f')][_0xdc5d('0x40')](_0x25b56b,{'type':db[_0xdc5d('0x70')][_0xdc5d('0x71')][_0xdc5d('0x72')],'raw':!![]})[_0xdc5d('0x20')](function(_0x32cdfd){return _0x32cdfd;});})[_0xdc5d('0x20')](function(_0x4c3d89){if(_0x4c3d89){_0x1c6ea0[_0xdc5d('0x27')][_0xdc5d('0x73')]=_0x4c3d89[0x0];if(!_0x3e5c41[_0xdc5d('0x54')][_0xdc5d('0x5f')])return;return db[_0xdc5d('0x74')][_0xdc5d('0x55')]({'where':{'id':_0x3e5c41[_0xdc5d('0x54')][_0xdc5d('0x5f')],'role':_0xdc5d('0x61')},'attributes':['id',_0xdc5d('0x36'),_0xdc5d('0x75'),_0xdc5d('0x76'),'internal'],'raw':!![]});}return null;})[_0xdc5d('0x20')](function(_0x237a54){if(!_0x237a54)return null;_0x1c6ea0['message']['agent']=_0x237a54;return _0x1c6ea0;})[_0xdc5d('0x20')](function(_0x29ea48){if(_0x29ea48){if(_0x3e5c41[_0xdc5d('0x54')]['manual']){_0x1c6ea0[_0xdc5d('0x27')][_0xdc5d('0x77')]=util['format'](_0xdc5d('0x78'),_0x3e5c41[_0xdc5d('0x60')]['name']);_0x1c6ea0['message']['channel']=_0x1c6ea0['channel'];_0x1c6ea0['message'][_0xdc5d('0x79')]=_0x1c6ea0[_0xdc5d('0x7a')];_0x1c6ea0[_0xdc5d('0x27')][_0xdc5d('0x7b')]='accept';return respondWithRpcPromise(_0xdc5d('0x7c'),_0xdc5d('0x7c'),{'event':'acceptmessage','message':_0x1c6ea0[_0xdc5d('0x27')]},client9002)['then'](function(){return _0x1c6ea0;});}return _0x1c6ea0;}return null;})[_0xdc5d('0x20')](respondWithResult(_0x3cf472,null))[_0xdc5d('0x28')](handleError(_0x3cf472,null));};var interaction_log=require(_0xdc5d('0x14'))(_0xdc5d('0x58'));exports[_0xdc5d('0x31')]=function(_0x9ab217,_0x17c744,_0x14311c){var _0x388b2a={'agent':{},'channel':_0xdc5d('0x5a')};if(_0x9ab217['body']['id']){delete _0x9ab217['body']['id'];}_0x9ab217['body'][_0xdc5d('0x5f')]=_0x9ab217[_0xdc5d('0x54')][_0xdc5d('0x5f')]||_0x9ab217['user']['id'];_0x388b2a[_0xdc5d('0x61')]['id']=_0x9ab217[_0xdc5d('0x54')]['UserId'];return db['FaxMessage'][_0xdc5d('0x55')]({'where':{'id':_0x9ab217[_0xdc5d('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x17c744,null))[_0xdc5d('0x20')](function(_0x285f56){if(_0x285f56){_0x388b2a[_0xdc5d('0x27')]=_0x285f56[_0xdc5d('0x62')]({'plain':!![]});return db[_0xdc5d('0x63')][_0xdc5d('0x55')]({'where':{'id':_0x285f56[_0xdc5d('0x64')]}});}return null;})[_0xdc5d('0x20')](handleEntityNotFound(_0x17c744,null))[_0xdc5d('0x20')](function(_0x4e8147){if(_0x4e8147){_0x388b2a[_0xdc5d('0x67')]=_0x4e8147[_0xdc5d('0x62')]({'plain':!![]});interaction_log[_0xdc5d('0x68')](_0xdc5d('0x7d'),_0x9ab217[_0xdc5d('0x60')]['id'],_0x9ab217[_0xdc5d('0x60')][_0xdc5d('0x36')],_0x9ab217['user'][_0xdc5d('0x6a')],_0x388b2a[_0xdc5d('0x67')]['id'],_0x9ab217[_0xdc5d('0x54')]?JSON[_0xdc5d('0x24')](_0x9ab217[_0xdc5d('0x54')]):_0xdc5d('0x6b'));return respondWithRpcPromise(_0xdc5d('0x7e'),'rejectMessage',_0x388b2a);}return null;})['then'](function(_0x795a27){var _0x5a6fc1=_0xdc5d('0x6d')+_0x795a27[_0xdc5d('0x27')]['ContactId'];return db[_0xdc5d('0x6f')][_0xdc5d('0x40')](_0x5a6fc1,{'type':db[_0xdc5d('0x70')][_0xdc5d('0x71')][_0xdc5d('0x72')],'raw':!![]})['then'](function(_0x3ec917){return _0x3ec917;});})[_0xdc5d('0x20')](function(_0x137a30){if(_0x137a30){_0x388b2a['message'][_0xdc5d('0x73')]=_0x137a30[0x0];if(!_0x9ab217[_0xdc5d('0x54')]['UserId'])return;return db[_0xdc5d('0x74')][_0xdc5d('0x55')]({'where':{'id':_0x9ab217[_0xdc5d('0x54')]['UserId'],'role':'agent'},'attributes':['id','name',_0xdc5d('0x75'),_0xdc5d('0x76'),_0xdc5d('0x7f')],'raw':!![]});}return null;})[_0xdc5d('0x20')](function(_0x510680){if(!_0x510680)return null;_0x388b2a['message']['agent']=_0x510680;return _0x388b2a;})[_0xdc5d('0x20')](function(_0x1059b1){if(_0x1059b1){_0x1059b1[_0xdc5d('0x27')]['interface']=util['format'](_0xdc5d('0x78'),_0x9ab217[_0xdc5d('0x60')][_0xdc5d('0x36')]);_0x1059b1[_0xdc5d('0x27')][_0xdc5d('0x7a')]=_0x388b2a['channel'];_0x1059b1[_0xdc5d('0x27')][_0xdc5d('0x79')]=_0x388b2a['channel'];_0x1059b1[_0xdc5d('0x27')][_0xdc5d('0x7b')]=_0xdc5d('0x31');respondWithRpcPromise(_0xdc5d('0x7c'),_0xdc5d('0x7c'),{'event':_0xdc5d('0x80'),'message':_0x1059b1[_0xdc5d('0x27')]},client9002);return _0x388b2a;}return null;})[_0xdc5d('0x20')](respondWithResult(_0x17c744,null))[_0xdc5d('0x28')](handleError(_0x17c744,null));};exports['create']=function(_0x4675ae,_0x531458){var _0x23263b;return db['FaxMessage'][_0xdc5d('0x81')](_0x4675ae[_0xdc5d('0x54')],{})[_0xdc5d('0x20')](function(_0x155331){_0x23263b=_0x155331;return db[_0xdc5d('0x82')][_0xdc5d('0x83')]({'where':{'id':_0x23263b[_0xdc5d('0x6e')]}});})[_0xdc5d('0x20')](function(_0x4eeca9){if(_[_0xdc5d('0x65')](_0x4eeca9)){return;}else{_0x23263b[_0xdc5d('0x5a')]=_0x4eeca9[_0xdc5d('0x5a')];return db[_0xdc5d('0x84')][_0xdc5d('0x83')]({'where':{'id':_0x23263b[_0xdc5d('0x85')]}});}})['then'](function(_0x2b11c2){return respondWithRpcPromise(_0xdc5d('0x86'),_0xdc5d('0x86'),{'FaxAccountId':_[_0xdc5d('0x65')](_0x4675ae['body'])?undefined:_0x4675ae[_0xdc5d('0x54')][_0xdc5d('0x87')],'path':_['isNil'](_0x2b11c2)?undefined:util[_0xdc5d('0x5d')](_0xdc5d('0x88'),_0x2b11c2[_0xdc5d('0x89')]),'fax':_[_0xdc5d('0x65')](_0x23263b[_0xdc5d('0x5a')])?undefined:_0x23263b[_0xdc5d('0x5a')],'AttachmentId':_0x23263b[_0xdc5d('0x85')]},client9002);})[_0xdc5d('0x20')](respondWithResult(_0x531458,0xc9))[_0xdc5d('0x28')](handleError(_0x531458,null));};exports['download']=function(_0x4a609a,_0x11d8cf){var _0x57b8e8=path[_0xdc5d('0x8a')](config[_0xdc5d('0x8b')],_0xdc5d('0x8c'),'files',_0xdc5d('0x8d'));return db[_0xdc5d('0x39')]['find']({'where':{'id':_0x4a609a[_0xdc5d('0x56')]['id']},'include':[{'model':db['Attachment'],'as':_0xdc5d('0x84')}]})[_0xdc5d('0x20')](handleEntityNotFound(_0x11d8cf,null))[_0xdc5d('0x20')](function(_0x411532){if(_0x411532){return _0x11d8cf['download'](path[_0xdc5d('0x8a')](_0x57b8e8,_0x411532[_0xdc5d('0x84')]['basename']));}})[_0xdc5d('0x28')](handleError(_0x11d8cf,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index c9a9874..2eae649 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 _0x27f3=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x3ad71c,_0xac415c){var _0x55b9a6=function(_0x59869a){while(--_0x59869a){_0x3ad71c['push'](_0x3ad71c['shift']());}};_0x55b9a6(++_0xac415c);}(_0x27f3,0x1e9));var _0x327f=function(_0x4907de,_0x5bbdc6){_0x4907de=_0x4907de-0x0;var _0x482054=_0x27f3[_0x4907de];return _0x482054;};'use strict';var EventEmitter=require(_0x327f('0x0'));var FaxMessage=require(_0x327f('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x327f('0x2')](0x0);var events={'afterCreate':_0x327f('0x3'),'afterUpdate':'update','afterDestroy':_0x327f('0x4')};function emitEvent(_0x50c3c7){return function(_0xd14801,_0x32d8ff,_0x11be76){FaxMessageEvents[_0x327f('0x5')](_0x50c3c7+':'+_0xd14801['id'],_0xd14801);FaxMessageEvents[_0x327f('0x5')](_0x50c3c7,_0xd14801);_0x11be76(null);};}for(var e in events){if(events[_0x327f('0x6')](e)){var event=events[e];FaxMessage[_0x327f('0x7')](e,emitEvent(event));}}module[_0x327f('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x5334=['../../mysqldb','FaxMessage','setMaxListeners','save','remove','hasOwnProperty','events'];(function(_0x3cd91d,_0x163516){var _0x3b4fab=function(_0x1b3319){while(--_0x1b3319){_0x3cd91d['push'](_0x3cd91d['shift']());}};_0x3b4fab(++_0x163516);}(_0x5334,0x84));var _0x4533=function(_0x563559,_0x10cb97){_0x563559=_0x563559-0x0;var _0x1efabe=_0x5334[_0x563559];return _0x1efabe;};'use strict';var EventEmitter=require(_0x4533('0x0'));var FaxMessage=require(_0x4533('0x1'))['db'][_0x4533('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4533('0x3')](0x0);var events={'afterCreate':_0x4533('0x4'),'afterUpdate':'update','afterDestroy':_0x4533('0x5')};function emitEvent(_0x5176b5){return function(_0x42184d,_0x11ce61,_0x5cbca4){FaxMessageEvents['emit'](_0x5176b5+':'+_0x42184d['id'],_0x42184d);FaxMessageEvents['emit'](_0x5176b5,_0x42184d);_0x5cbca4(null);};}for(var e in events){if(events[_0x4533('0x6')](e)){var event=events[e];FaxMessage['hook'](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 07187e4..1b76a3f 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 _0x3195=['bluebird','rimraf','../../config/environment','define','FaxMessage','fax_messages','fti_fax_messages','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x1a37ba,_0x41e2dd){var _0xea71e1=function(_0x2f0db4){while(--_0x2f0db4){_0x1a37ba['push'](_0x1a37ba['shift']());}};_0xea71e1(++_0x41e2dd);}(_0x3195,0xc5));var _0x5319=function(_0x3ab429,_0x10c1bf){_0x3ab429=_0x3ab429-0x0;var _0x50cec3=_0x3195[_0x3ab429];return _0x50cec3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5319('0x0'))(_0x5319('0x1'));var moment=require(_0x5319('0x2'));var BPromise=require(_0x5319('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5319('0x4'));var config=require(_0x5319('0x5'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x145ace,_0x53cef2){return _0x145ace[_0x5319('0x6')](_0x5319('0x7'),attributes,{'tableName':_0x5319('0x8'),'paranoid':![],'indexes':[{'name':_0x5319('0x9'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d007b,_0x14ca1,_0x28c872){var _0x3d5209=_0x145ace[_0x5319('0xa')];var _0x13ca4e=_0x1d007b[_0x5319('0xb')]({'plain':!![]});if(_0x13ca4e[_0x5319('0xc')][_0x5319('0xd')]()==='in'||_0x13ca4e[_0x5319('0xc')][_0x5319('0xd')]()===_0x5319('0xe')&&!_0x13ca4e[_0x5319('0xf')]&&!_[_0x5319('0x10')](_0x13ca4e[_0x5319('0x11')])){_0x3d5209[_0x5319('0x12')]['findOne']({'where':{'id':_0x13ca4e[_0x5319('0x13')]}})[_0x5319('0x14')](function(_0x178e62){if(_0x178e62){_0x178e62['update']({'lastMsgAt':_0x13ca4e['createdAt'],'lastMsgDirection':_0x13ca4e[_0x5319('0xc')][_0x5319('0xd')]()});}})[_0x5319('0x15')](function(_0x1fb8db){console[_0x5319('0x16')](_0x1fb8db);});}_0x28c872();}},'charset':_0x5319('0x17'),'collate':_0x5319('0x18')});}; \ No newline at end of file +var _0x6053=['FaxInteraction','findOne','FaxInteractionId','then','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','../../config/environment','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','UserId'];(function(_0x1a9486,_0x2709e2){var _0x47518a=function(_0x5a2ee5){while(--_0x5a2ee5){_0x1a9486['push'](_0x1a9486['shift']());}};_0x47518a(++_0x2709e2);}(_0x6053,0x1ca));var _0x3605=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6053[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3605('0x0'));var logger=require('../../config/logger')(_0x3605('0x1'));var moment=require('moment');var BPromise=require(_0x3605('0x2'));var rp=require(_0x3605('0x3'));var fs=require('fs');var path=require(_0x3605('0x4'));var rimraf=require('rimraf');var config=require(_0x3605('0x5'));var attributes=require('./faxMessage.attributes');module[_0x3605('0x6')]=function(_0x498c8a,_0x28f175){return _0x498c8a['define'](_0x3605('0x7'),attributes,{'tableName':_0x3605('0x8'),'paranoid':![],'indexes':[{'name':_0x3605('0x9'),'fields':[_0x3605('0xa')],'type':_0x3605('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x264855,_0xe5417c,_0x4b97a6){var _0x540774=_0x498c8a[_0x3605('0xc')];var _0x5f4d27=_0x264855[_0x3605('0xd')]({'plain':!![]});if(_0x5f4d27[_0x3605('0xe')][_0x3605('0xf')]()==='in'||_0x5f4d27['direction'][_0x3605('0xf')]()==='out'&&!_0x5f4d27['secret']&&!_['isNil'](_0x5f4d27[_0x3605('0x10')])){_0x540774[_0x3605('0x11')][_0x3605('0x12')]({'where':{'id':_0x5f4d27[_0x3605('0x13')]}})[_0x3605('0x14')](function(_0x338e52){if(_0x338e52){_0x338e52['update']({'lastMsgAt':_0x5f4d27['createdAt'],'lastMsgDirection':_0x5f4d27[_0x3605('0xe')][_0x3605('0xf')]()});}})[_0x3605('0x15')](function(_0xd8e69e){console[_0x3605('0x16')](_0xd8e69e);});}_0x4b97a6();}},'charset':_0x3605('0x17'),'collate':_0x3605('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 1cbbf5c..c13e3be 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 _0xd0bb=['CreateFaxMessage','FaxMessage','create','body','options','update','raw','where','attributes','limit','UpdateFaxMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x248be0,_0x189220){var _0x2cafb0=function(_0x4a3e98){while(--_0x4a3e98){_0x248be0['push'](_0x248be0['shift']());}};_0x2cafb0(++_0x189220);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x10d618,_0x1f1c82){_0x10d618=_0x10d618-0x0;var _0x57d044=_0xd0bb[_0x10d618];return _0x57d044;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});config[_0xbd0b('0xa')]=_[_0xbd0b('0xb')](config['redis'],{'host':_0xbd0b('0xc'),'port':0x18eb});var socket=require(_0xbd0b('0xd'))(new Redis(config[_0xbd0b('0xa')]));require(_0xbd0b('0xe'))[_0xbd0b('0xf')](socket);function respondWithRpcPromise(_0x53d5e8,_0x51cf98,_0x14bc5b){return new BPromise(function(_0x110cf1,_0x4a69ff){return client[_0xbd0b('0x10')](_0x53d5e8,_0x14bc5b)[_0xbd0b('0x11')](function(_0x526258){logger[_0xbd0b('0x12')](_0xbd0b('0x13'),_0x51cf98,_0xbd0b('0x14'));logger[_0xbd0b('0x15')](_0xbd0b('0x16'),_0x51cf98,_0xbd0b('0x14'),JSON[_0xbd0b('0x17')](_0x526258));if(_0x526258[_0xbd0b('0x18')]){if(_0x526258[_0xbd0b('0x18')][_0xbd0b('0x19')]===0x1f4){logger[_0xbd0b('0x18')]('FaxMessage,\x20%s,\x20%s',_0x51cf98,_0x526258[_0xbd0b('0x18')]['message']);return _0x4a69ff(_0x526258['error'][_0xbd0b('0x1a')]);}logger[_0xbd0b('0x18')](_0xbd0b('0x13'),_0x51cf98,_0x526258[_0xbd0b('0x18')][_0xbd0b('0x1a')]);return _0x110cf1(_0x526258['error']['message']);}else{logger[_0xbd0b('0x12')](_0xbd0b('0x13'),_0x51cf98,_0xbd0b('0x14'));_0x110cf1(_0x526258[_0xbd0b('0x1b')][_0xbd0b('0x1a')]);}})[_0xbd0b('0x1c')](function(_0x5aeb79){logger[_0xbd0b('0x18')]('FaxMessage,\x20%s,\x20%s',_0x51cf98,_0x5aeb79);_0x4a69ff(_0x5aeb79);});});}exports[_0xbd0b('0x1d')]=function(_0x475801){var _0x2d02d0=this;return new Promise(function(_0x3053bb,_0x4b312d){return db[_0xbd0b('0x1e')][_0xbd0b('0x1f')](_0x475801[_0xbd0b('0x20')],{'raw':_0x475801['options']?_0x475801[_0xbd0b('0x21')]['raw']===undefined?!![]:![]:!![]})[_0xbd0b('0x11')](function(_0x3c4938){logger[_0xbd0b('0x12')](_0xbd0b('0x1d'),_0x475801);logger[_0xbd0b('0x15')]('CreateFaxMessage',_0x475801,JSON[_0xbd0b('0x17')](_0x3c4938));_0x3053bb(_0x3c4938);})['catch'](function(_0x3e7e9c){logger[_0xbd0b('0x18')](_0xbd0b('0x1d'),_0x3e7e9c[_0xbd0b('0x1a')],_0x475801);_0x4b312d(_0x2d02d0[_0xbd0b('0x18')](0x1f4,_0x3e7e9c[_0xbd0b('0x1a')]));});});};exports['UpdateFaxMessage']=function(_0x382f76){var _0x1b46a3=this;return new Promise(function(_0x33b752,_0x1b5a00){return db[_0xbd0b('0x1e')][_0xbd0b('0x22')](_0x382f76['body'],{'raw':_0x382f76[_0xbd0b('0x21')]?_0x382f76[_0xbd0b('0x21')][_0xbd0b('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x382f76['options']?_0x382f76['options'][_0xbd0b('0x24')]||null:null,'attributes':_0x382f76[_0xbd0b('0x21')]?_0x382f76[_0xbd0b('0x21')][_0xbd0b('0x25')]||null:null,'limit':_0x382f76[_0xbd0b('0x21')]?_0x382f76[_0xbd0b('0x21')][_0xbd0b('0x26')]||null:null})['then'](function(_0x45f7d6){logger[_0xbd0b('0x12')]('UpdateFaxMessage',_0x382f76);logger['debug'](_0xbd0b('0x27'),_0x382f76,JSON[_0xbd0b('0x17')](_0x45f7d6));_0x33b752(_0x45f7d6);})['catch'](function(_0x31bdd3){logger[_0xbd0b('0x18')](_0xbd0b('0x27'),_0x31bdd3[_0xbd0b('0x1a')],_0x382f76);_0x1b5a00(_0x1b46a3[_0xbd0b('0x18')](0x1f4,_0x31bdd3[_0xbd0b('0x1a')]));});});}; \ No newline at end of file +var _0x4b84=['CreateFaxMessage','FaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','attributes','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','defaults','localhost','./faxMessage.socket','register','request','then','info','request\x20sent','debug','error','message','FaxMessage,\x20%s,\x20%s','result'];(function(_0x987091,_0x495e60){var _0x3cca0b=function(_0x165d98){while(--_0x165d98){_0x987091['push'](_0x987091['shift']());}};_0x3cca0b(++_0x495e60);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0x4b84[_0x5ee3d3];return _0x4b272f;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});config['redis']=_[_0x44b8('0x7')](config['redis'],{'host':_0x44b8('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x44b8('0x9'))[_0x44b8('0xa')](socket);function respondWithRpcPromise(_0x30ebc3,_0x48a371,_0xc650ec){return new BPromise(function(_0x2cc74b,_0x4315f6){return client[_0x44b8('0xb')](_0x30ebc3,_0xc650ec)[_0x44b8('0xc')](function(_0x37e471){logger[_0x44b8('0xd')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'));logger[_0x44b8('0xf')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'),JSON['stringify'](_0x37e471));if(_0x37e471[_0x44b8('0x10')]){if(_0x37e471[_0x44b8('0x10')]['code']===0x1f4){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error'][_0x44b8('0x11')]);return _0x4315f6(_0x37e471[_0x44b8('0x10')][_0x44b8('0x11')]);}logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error']['message']);return _0x2cc74b(_0x37e471[_0x44b8('0x10')]['message']);}else{logger[_0x44b8('0xd')](_0x44b8('0x12'),_0x48a371,'request\x20sent');_0x2cc74b(_0x37e471[_0x44b8('0x13')][_0x44b8('0x11')]);}})['catch'](function(_0x89bc30){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x89bc30);_0x4315f6(_0x89bc30);});});}exports[_0x44b8('0x14')]=function(_0x8b4301){var _0xebfe79=this;return new Promise(function(_0x235bdc,_0x102ef9){return db[_0x44b8('0x15')][_0x44b8('0x16')](_0x8b4301[_0x44b8('0x17')],{'raw':_0x8b4301[_0x44b8('0x18')]?_0x8b4301[_0x44b8('0x18')][_0x44b8('0x19')]===undefined?!![]:![]:!![]})[_0x44b8('0xc')](function(_0x48327e){logger[_0x44b8('0xd')](_0x44b8('0x14'),_0x8b4301);logger[_0x44b8('0xf')](_0x44b8('0x14'),_0x8b4301,JSON[_0x44b8('0x1a')](_0x48327e));_0x235bdc(_0x48327e);})['catch'](function(_0x402497){logger['error'](_0x44b8('0x14'),_0x402497[_0x44b8('0x11')],_0x8b4301);_0x102ef9(_0xebfe79[_0x44b8('0x10')](0x1f4,_0x402497[_0x44b8('0x11')]));});});};exports[_0x44b8('0x1b')]=function(_0x59acbc){var _0x474f01=this;return new Promise(function(_0x502acf,_0x41d673){return db[_0x44b8('0x15')]['update'](_0x59acbc[_0x44b8('0x17')],{'raw':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['where']||null:null,'attributes':_0x59acbc[_0x44b8('0x18')]?_0x59acbc['options'][_0x44b8('0x1c')]||null:null,'limit':_0x59acbc['options']?_0x59acbc['options']['limit']||null:null})[_0x44b8('0xc')](function(_0x29b18d){logger[_0x44b8('0xd')](_0x44b8('0x1b'),_0x59acbc);logger[_0x44b8('0xf')](_0x44b8('0x1b'),_0x59acbc,JSON[_0x44b8('0x1a')](_0x29b18d));_0x502acf(_0x29b18d);})[_0x44b8('0x1d')](function(_0xd1d320){logger[_0x44b8('0x10')](_0x44b8('0x1b'),_0xd1d320[_0x44b8('0x11')],_0x59acbc);_0x41d673(_0x474f01[_0x44b8('0x10')](0x1f4,_0xd1d320['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 6f09180..3f78912 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 _0x4771=['length','./faxMessage.events','emit','removeListener','register'];(function(_0x5d0207,_0x4000c4){var _0xf3e249=function(_0x1a1fd9){while(--_0x1a1fd9){_0x5d0207['push'](_0x5d0207['shift']());}};_0xf3e249(++_0x4000c4);}(_0x4771,0x123));var _0x1477=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x4771[_0x1477ef];return _0x164acd;};'use strict';var FaxMessageEvents=require(_0x1477('0x0'));var events=['save','remove','update'];function createListener(_0x4404c9,_0x4bee9c){return function(_0x3a4627){_0x4bee9c[_0x1477('0x1')](_0x4404c9,_0x3a4627);};}function removeListener(_0x1eaeb1,_0x3d98a5){return function(){FaxMessageEvents[_0x1477('0x2')](_0x1eaeb1,_0x3d98a5);};}exports[_0x1477('0x3')]=function(_0x2000f9){for(var _0x33427f=0x0,_0x5f35f7=events[_0x1477('0x4')];_0x33427f<_0x5f35f7;_0x33427f++){var _0xc581a3=events[_0x33427f];var _0x4a09f9=createListener('faxMessage:'+_0xc581a3,_0x2000f9);FaxMessageEvents['on'](_0xc581a3,_0x4a09f9);}}; \ No newline at end of file +var _0x6c29=['emit','removeListener','length','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x31d006,_0x4e9af8){var _0x497be5=function(_0x42a7fc){while(--_0x42a7fc){_0x31d006['push'](_0x31d006['shift']());}};_0x497be5(++_0x4e9af8);}(_0x6c29,0x1f4));var _0x96c2=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0x6c29[_0x695b76];return _0x1dc21f;};'use strict';var FaxMessageEvents=require(_0x96c2('0x0'));var events=[_0x96c2('0x1'),_0x96c2('0x2'),_0x96c2('0x3')];function createListener(_0x269591,_0x347bdb){return function(_0x326084){_0x347bdb[_0x96c2('0x4')](_0x269591,_0x326084);};}function removeListener(_0xebbe8a,_0x323031){return function(){FaxMessageEvents[_0x96c2('0x5')](_0xebbe8a,_0x323031);};}exports['register']=function(_0x41fc4e){for(var _0xe1848=0x0,_0x30d036=events[_0x96c2('0x6')];_0xe1848<_0x30d036;_0xe1848++){var _0x285d5d=events[_0xe1848];var _0x2f7848=createListener(_0x96c2('0x7')+_0x285d5d,_0x41fc4e);FaxMessageEvents['on'](_0x285d5d,_0x2f7848);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index faf2314..5b1a403 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 _0x878f=['update','/:id/accept','accept','/:id/reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','/describe','/:id','/:id/download','isAuthenticated','post','fax','create','put'];(function(_0x409682,_0x370090){var _0x1ee901=function(_0xe93c56){while(--_0xe93c56){_0x409682['push'](_0x409682['shift']());}};_0x1ee901(++_0x370090);}(_0x878f,0x173));var _0xf878=function(_0x5aadb3,_0x2de529){_0x5aadb3=_0x5aadb3-0x0;var _0x4eeafa=_0x878f[_0x5aadb3];return _0x4eeafa;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf878('0xa')](_0xf878('0xd'),auth[_0xf878('0xe')](),controller['download']);router[_0xf878('0xf')]('/',auth[_0xf878('0xe')](),interaction['tracked'](_0xf878('0x10'),'faxmessage:create'),controller[_0xf878('0x11')]);router[_0xf878('0x12')](_0xf878('0xc'),auth['isAuthenticated'](),controller[_0xf878('0x13')]);router[_0xf878('0x12')](_0xf878('0x14'),auth['isAuthenticated'](),controller[_0xf878('0x15')]);router[_0xf878('0x12')](_0xf878('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0xf878('0x17')](_0xf878('0xc'),auth[_0xf878('0xe')](),controller[_0xf878('0x18')]);module[_0xf878('0x19')]=router; \ No newline at end of file +var _0x5ec6=['express','fs-extra','../../components/interaction/service','./faxMessage.controller','isAuthenticated','index','/describe','get','/:id','/:id/download','download','post','tracked','fax','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path'];(function(_0x184473,_0x4140bd){var _0x1425be=function(_0x3af70c){while(--_0x3af70c){_0x184473['push'](_0x184473['shift']());}};_0x1425be(++_0x4140bd);}(_0x5ec6,0x7f));var _0x65ec=function(_0x2277a1,_0x536b3e){_0x2277a1=_0x2277a1-0x0;var _0x33a642=_0x5ec6[_0x2277a1];return _0x33a642;};'use strict';var multer=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var path=require(_0x65ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x65ec('0x3'));var router=express['Router']();var fs_extra=require(_0x65ec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x65ec('0x5'));var config=require('../../config/environment');var controller=require(_0x65ec('0x6'));router['get']('/',auth[_0x65ec('0x7')](),controller[_0x65ec('0x8')]);router['get'](_0x65ec('0x9'),auth[_0x65ec('0x7')](),controller['describe']);router[_0x65ec('0xa')](_0x65ec('0xb'),auth[_0x65ec('0x7')](),controller['show']);router['get'](_0x65ec('0xc'),auth['isAuthenticated'](),controller[_0x65ec('0xd')]);router[_0x65ec('0xe')]('/',auth['isAuthenticated'](),interaction[_0x65ec('0xf')](_0x65ec('0x10'),'faxmessage:create'),controller[_0x65ec('0x11')]);router[_0x65ec('0x12')]('/:id',auth[_0x65ec('0x7')](),controller[_0x65ec('0x13')]);router[_0x65ec('0x12')](_0x65ec('0x14'),auth[_0x65ec('0x7')](),controller[_0x65ec('0x15')]);router[_0x65ec('0x12')](_0x65ec('0x16'),auth['isAuthenticated'](),controller[_0x65ec('0x17')]);router[_0x65ec('0x18')](_0x65ec('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x65ec('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 2854d3b..949d199 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 _0xcdd3=['exports','STRING','name','INTEGER','ENUM','rrmemory','sequelize'];(function(_0x41703b,_0x3bce2b){var _0x4654ef=function(_0x88973b){while(--_0x88973b){_0x41703b['push'](_0x41703b['shift']());}};_0x4654ef(++_0x3bce2b);}(_0xcdd3,0x109));var _0x3cdd=function(_0x298d18,_0x2364a1){_0x298d18=_0x298d18-0x0;var _0x3ecf4a=_0xcdd3[_0x298d18];return _0x3ecf4a;};'use strict';var Sequelize=require(_0x3cdd('0x0'));module[_0x3cdd('0x1')]={'name':{'type':Sequelize[_0x3cdd('0x2')],'unique':_0x3cdd('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3cdd('0x2')]},'timeout':{'type':Sequelize[_0x3cdd('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3cdd('0x5')](_0x3cdd('0x6'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3cdd('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x45a4=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x45a4,0x140));var _0x445a=function(_0x5f215b,_0x295e71){_0x5f215b=_0x5f215b-0x0;var _0x46614f=_0x45a4[_0x5f215b];return _0x46614f;};'use strict';var Sequelize=require(_0x445a('0x0'));module[_0x445a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x445a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x445a('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x445a('0x4'),_0x445a('0x5'),_0x445a('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x445a('0x3')],'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 a500003..dbd163b 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 _0xd4c5=['role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','createdAt','%s/%s','updatedAt','getTeams','findOne','hasOwnProperty','addTeams','ids','Team','Agents','flatMap','each','findOrCreate','userFaxQueue:save','removeTeams','select','tq.TeamId','from','team_has_fax_queues','join','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','isArray','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','update','then','get','FaxQueues','UserProfileResource','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FaxQueue','findAll','rows','catch','show','params','find','create','user'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0xd4c5,0x14e));var _0x5d4c=function(_0x242ede,_0x1b8655){_0x242ede=_0x242ede-0x0;var _0x12a8c7=_0xd4c5[_0x242ede];return _0x12a8c7;};'use strict';var emlformat=require(_0x5d4c('0x0'));var rimraf=require(_0x5d4c('0x1'));var zipdir=require(_0x5d4c('0x2'));var jsonpatch=require(_0x5d4c('0x3'));var rp=require(_0x5d4c('0x4'));var moment=require(_0x5d4c('0x5'));var BPromise=require(_0x5d4c('0x6'));var Mustache=require(_0x5d4c('0x7'));var util=require(_0x5d4c('0x8'));var path=require('path');var sox=require(_0x5d4c('0x9'));var csv=require(_0x5d4c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5d4c('0xb'));var _=require(_0x5d4c('0xc'));var squel=require(_0x5d4c('0xd'));var crypto=require(_0x5d4c('0xe'));var jsforce=require(_0x5d4c('0xf'));var deskjs=require(_0x5d4c('0x10'));var toCsv=require(_0x5d4c('0xa'));var querystring=require(_0x5d4c('0x11'));var Papa=require(_0x5d4c('0x12'));var Redis=require('ioredis');var authService=require(_0x5d4c('0x13'));var qs=require(_0x5d4c('0x14'));var as=require(_0x5d4c('0x15'));var hardwareService=require(_0x5d4c('0x16'));var logger=require(_0x5d4c('0x17'))(_0x5d4c('0x18'));var utils=require('../../config/utils');var config=require(_0x5d4c('0x19'));var licenseUtil=require(_0x5d4c('0x1a'));var db=require(_0x5d4c('0x1b'))['db'];config['redis']=_[_0x5d4c('0x1c')](config['redis'],{'host':_0x5d4c('0x1d'),'port':0x18eb});var socket=require(_0x5d4c('0x1e'))(new Redis(config[_0x5d4c('0x1f')]));require(_0x5d4c('0x20'))[_0x5d4c('0x21')](socket);function respondWithStatusCode(_0x795bce,_0x36268a){_0x36268a=_0x36268a||0xcc;return function(_0x2f2dfe){if(_0x2f2dfe){return _0x795bce[_0x5d4c('0x22')](_0x36268a);}return _0x795bce[_0x5d4c('0x23')](_0x36268a)['end']();};}function respondWithResult(_0x2bc567,_0x4ceb4c){_0x4ceb4c=_0x4ceb4c||0xc8;return function(_0x4519c9){if(_0x4519c9){return _0x2bc567[_0x5d4c('0x23')](_0x4ceb4c)[_0x5d4c('0x24')](_0x4519c9);}};}function respondWithFilteredResult(_0xacbd67,_0x1e70d6){return function(_0x57ff75){if(_0x57ff75){var _0x435a52=typeof _0x1e70d6[_0x5d4c('0x25')]==='undefined'&&typeof _0x1e70d6['limit']===_0x5d4c('0x26');var _0x3c5cbf=_0x57ff75['count'];var _0x3ccf7d=_0x435a52?0x0:_0x1e70d6[_0x5d4c('0x25')];var _0x14b277=_0x435a52?_0x57ff75[_0x5d4c('0x27')]:_0x1e70d6[_0x5d4c('0x25')]+_0x1e70d6[_0x5d4c('0x28')];var _0x51f70b;if(_0x14b277>=_0x3c5cbf){_0x14b277=_0x3c5cbf;_0x51f70b=0xc8;}else{_0x51f70b=0xce;}_0xacbd67[_0x5d4c('0x23')](_0x51f70b);return _0xacbd67['set'](_0x5d4c('0x29'),_0x3ccf7d+'-'+_0x14b277+'/'+_0x3c5cbf)[_0x5d4c('0x24')](_0x57ff75);}return null;};}function patchUpdates(_0x3c656a){return function(_0x59496f){try{jsonpatch['apply'](_0x59496f,_0x3c656a,!![]);}catch(_0xcb4996){return BPromise['reject'](_0xcb4996);}return _0x59496f['save']();};}function saveUpdates(_0x2eb81d,_0x58b205){return function(_0x569d18){if(_0x569d18){return _0x569d18[_0x5d4c('0x2a')](_0x2eb81d)['then'](function(_0x289df1){return _0x289df1;});}return null;};}function removeEntity(_0xf847cd,_0x2e6087){return function(_0x188db1){if(_0x188db1){return _0x188db1['destroy']()[_0x5d4c('0x2b')](function(){var _0x286c34=_0x188db1[_0x5d4c('0x2c')]({'plain':!![]});var _0x542402=_0x5d4c('0x2d');return db[_0x5d4c('0x2e')][_0x5d4c('0x2f')]({'where':{'type':_0x542402,'resourceId':_0x286c34['id']}})['then'](function(){return _0x188db1;});})['then'](function(){_0xf847cd[_0x5d4c('0x23')](0xcc)[_0x5d4c('0x30')]();});}};}function handleEntityNotFound(_0x21c2e2,_0x514dde){return function(_0x2cb287){if(!_0x2cb287){_0x21c2e2[_0x5d4c('0x22')](0x194);}return _0x2cb287;};}function handleError(_0x370095,_0x1764d5){_0x1764d5=_0x1764d5||0x1f4;return function(_0x1863b4){logger[_0x5d4c('0x31')](_0x1863b4[_0x5d4c('0x32')]);if(_0x1863b4[_0x5d4c('0x33')]){delete _0x1863b4['name'];}_0x370095['status'](_0x1764d5)[_0x5d4c('0x34')](_0x1863b4);};}exports[_0x5d4c('0x35')]=function(_0x404502,_0x6a4eda){var _0xc0880c={},_0x8df3b0={},_0x3fbe92={'count':0x0,'rows':[]};var _0x36fcc7=_[_0x5d4c('0x36')](db['FaxQueue'][_0x5d4c('0x37')],function(_0x5c1f8f){return{'name':_0x5c1f8f['fieldName'],'type':_0x5c1f8f[_0x5d4c('0x38')][_0x5d4c('0x39')]};});_0x8df3b0['model']=_[_0x5d4c('0x36')](_0x36fcc7,_0x5d4c('0x33'));_0x8df3b0[_0x5d4c('0x3a')]=_[_0x5d4c('0x3b')](_0x404502[_0x5d4c('0x3a')]);_0x8df3b0[_0x5d4c('0x3c')]=_[_0x5d4c('0x3d')](_0x8df3b0[_0x5d4c('0x3e')],_0x8df3b0[_0x5d4c('0x3a')]);_0xc0880c['attributes']=_[_0x5d4c('0x3d')](_0x8df3b0[_0x5d4c('0x3e')],qs['fields'](_0x404502[_0x5d4c('0x3a')][_0x5d4c('0x3f')]));_0xc0880c[_0x5d4c('0x40')]=_0xc0880c[_0x5d4c('0x40')][_0x5d4c('0x41')]?_0xc0880c[_0x5d4c('0x40')]:_0x8df3b0['model'];if(!_0x404502[_0x5d4c('0x3a')]['hasOwnProperty'](_0x5d4c('0x42'))){_0xc0880c[_0x5d4c('0x28')]=qs[_0x5d4c('0x28')](_0x404502['query'][_0x5d4c('0x28')]);_0xc0880c[_0x5d4c('0x25')]=qs[_0x5d4c('0x25')](_0x404502[_0x5d4c('0x3a')][_0x5d4c('0x25')]);}_0xc0880c[_0x5d4c('0x43')]=qs[_0x5d4c('0x44')](_0x404502[_0x5d4c('0x3a')][_0x5d4c('0x44')]);_0xc0880c[_0x5d4c('0x45')]=qs[_0x5d4c('0x3c')](_[_0x5d4c('0x46')](_0x404502[_0x5d4c('0x3a')],_0x8df3b0['filters']),_0x36fcc7);if(_0x404502[_0x5d4c('0x3a')][_0x5d4c('0x47')]){_0xc0880c[_0x5d4c('0x45')]=_[_0x5d4c('0x48')](_0xc0880c[_0x5d4c('0x45')],{'$or':_['map'](_0x36fcc7,function(_0x288fc7){if(_0x288fc7[_0x5d4c('0x38')]!==_0x5d4c('0x49')){var _0x238138={};_0x238138[_0x288fc7[_0x5d4c('0x33')]]={'$like':'%'+_0x404502['query'][_0x5d4c('0x47')]+'%'};return _0x238138;}})});}_0xc0880c=_[_0x5d4c('0x48')]({},_0xc0880c,_0x404502[_0x5d4c('0x4a')]);var _0x467a6c={'where':_0xc0880c[_0x5d4c('0x45')]};return db['FaxQueue']['count'](_0x467a6c)['then'](function(_0x32055a){_0x3fbe92['count']=_0x32055a;if(_0x404502[_0x5d4c('0x3a')][_0x5d4c('0x4b')]){_0xc0880c[_0x5d4c('0x4c')]=[{'all':!![]}];}return db[_0x5d4c('0x4d')][_0x5d4c('0x4e')](_0xc0880c);})[_0x5d4c('0x2b')](function(_0x3848a9){_0x3fbe92[_0x5d4c('0x4f')]=_0x3848a9;return _0x3fbe92;})[_0x5d4c('0x2b')](respondWithFilteredResult(_0x6a4eda,_0xc0880c))[_0x5d4c('0x50')](handleError(_0x6a4eda,null));};exports[_0x5d4c('0x51')]=function(_0xb02ac3,_0x365dad){var _0x28814f={'raw':!![],'where':{'id':_0xb02ac3[_0x5d4c('0x52')]['id']}},_0x28de89={};_0x28de89[_0x5d4c('0x3e')]=_[_0x5d4c('0x3b')](db[_0x5d4c('0x4d')]['rawAttributes']);_0x28de89[_0x5d4c('0x3a')]=_['keys'](_0xb02ac3[_0x5d4c('0x3a')]);_0x28de89[_0x5d4c('0x3c')]=_[_0x5d4c('0x3d')](_0x28de89[_0x5d4c('0x3e')],_0x28de89[_0x5d4c('0x3a')]);_0x28814f[_0x5d4c('0x40')]=_[_0x5d4c('0x3d')](_0x28de89[_0x5d4c('0x3e')],qs[_0x5d4c('0x3f')](_0xb02ac3['query'][_0x5d4c('0x3f')]));_0x28814f['attributes']=_0x28814f[_0x5d4c('0x40')][_0x5d4c('0x41')]?_0x28814f[_0x5d4c('0x40')]:_0x28de89[_0x5d4c('0x3e')];if(_0xb02ac3['query']['includeAll']){_0x28814f[_0x5d4c('0x4c')]=[{'all':!![]}];}_0x28814f=_[_0x5d4c('0x48')]({},_0x28814f,_0xb02ac3['options']);return db['FaxQueue'][_0x5d4c('0x53')](_0x28814f)[_0x5d4c('0x2b')](handleEntityNotFound(_0x365dad,null))['then'](respondWithResult(_0x365dad,null))[_0x5d4c('0x50')](handleError(_0x365dad,null));};exports['create']=function(_0x1d0137,_0x3cf027){return db[_0x5d4c('0x4d')][_0x5d4c('0x54')](_0x1d0137['body'],{})['then'](function(_0x5565f7){var _0x203a79=_0x1d0137[_0x5d4c('0x55')]['get']({'plain':!![]});if(!_0x203a79)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x203a79[_0x5d4c('0x56')]===_0x5d4c('0x55')){var _0x3aa00c=_0x5565f7[_0x5d4c('0x2c')]({'plain':!![]});var _0x5e2496=_0x5d4c('0x2d');return db['UserProfileSection'][_0x5d4c('0x53')]({'where':{'name':_0x5e2496,'userProfileId':_0x203a79[_0x5d4c('0x57')]},'raw':!![]})['then'](function(_0x5484bb){if(_0x5484bb&&_0x5484bb[_0x5d4c('0x58')]===0x0){return db[_0x5d4c('0x2e')][_0x5d4c('0x54')]({'name':_0x3aa00c[_0x5d4c('0x33')],'resourceId':_0x3aa00c['id'],'type':_0x5484bb[_0x5d4c('0x33')],'sectionId':_0x5484bb['id']},{})[_0x5d4c('0x2b')](function(){return _0x5565f7;});}else{return _0x5565f7;}})['catch'](function(_0x586ae3){logger[_0x5d4c('0x31')](_0x5d4c('0x59'),_0x586ae3);throw _0x586ae3;});}return _0x5565f7;})[_0x5d4c('0x2b')](respondWithResult(_0x3cf027,0xc9))[_0x5d4c('0x50')](handleError(_0x3cf027,null));};exports[_0x5d4c('0x2a')]=function(_0x45daff,_0x18ef0f){if(_0x45daff['body']['id']){delete _0x45daff[_0x5d4c('0x5a')]['id'];}return db[_0x5d4c('0x4d')][_0x5d4c('0x53')]({'where':{'id':_0x45daff[_0x5d4c('0x52')]['id']}})[_0x5d4c('0x2b')](handleEntityNotFound(_0x18ef0f,null))[_0x5d4c('0x2b')](saveUpdates(_0x45daff[_0x5d4c('0x5a')],null))[_0x5d4c('0x2b')](respondWithResult(_0x18ef0f,null))['catch'](handleError(_0x18ef0f,null));};exports[_0x5d4c('0x2f')]=function(_0x45de74,_0x17bb06){return db[_0x5d4c('0x4d')][_0x5d4c('0x53')]({'where':{'id':_0x45de74['params']['id']}})[_0x5d4c('0x2b')](handleEntityNotFound(_0x17bb06,null))[_0x5d4c('0x2b')](removeEntity(_0x17bb06,null))[_0x5d4c('0x50')](handleError(_0x17bb06,null));};exports[_0x5d4c('0x5b')]=function(_0x179883,_0x4d142e){return db[_0x5d4c('0x4d')][_0x5d4c('0x5b')]()[_0x5d4c('0x2b')](respondWithResult(_0x4d142e,null))['catch'](handleError(_0x4d142e,null));};exports[_0x5d4c('0x5c')]=function(_0x1e8aa0,_0x5d9065,_0x39502b){var _0x396005={'raw':!![],'where':{}},_0x194b37={},_0x3fcd14;return db[_0x5d4c('0x4d')]['findOne']({'where':{'id':_0x1e8aa0[_0x5d4c('0x52')]['id']}})['then'](handleEntityNotFound(_0x5d9065,null))['then'](function(_0x55d4b4){if(_0x55d4b4){_0x3fcd14=_0x55d4b4[_0x5d4c('0x2c')]({'plain':!![]});_0x194b37[_0x5d4c('0x3e')]=_[_0x5d4c('0x3b')](db['UserFaxQueue'][_0x5d4c('0x37')]);_0x194b37[_0x5d4c('0x3a')]=_[_0x5d4c('0x3b')](_0x1e8aa0[_0x5d4c('0x3a')]);_0x194b37[_0x5d4c('0x3c')]=_['intersection'](_0x194b37[_0x5d4c('0x3e')],_0x194b37[_0x5d4c('0x3a')]);_0x396005[_0x5d4c('0x40')]=_[_0x5d4c('0x3d')](_0x194b37[_0x5d4c('0x3e')],qs[_0x5d4c('0x3f')](_0x1e8aa0['query'][_0x5d4c('0x3f')]));_0x396005[_0x5d4c('0x40')]=_0x396005[_0x5d4c('0x40')][_0x5d4c('0x41')]?_0x396005['attributes']:_0x194b37['model'];if(!_0x1e8aa0[_0x5d4c('0x3a')]['hasOwnProperty'](_0x5d4c('0x42'))){_0x396005[_0x5d4c('0x28')]=qs[_0x5d4c('0x28')](_0x1e8aa0['query'][_0x5d4c('0x28')]);_0x396005[_0x5d4c('0x25')]=qs[_0x5d4c('0x25')](_0x1e8aa0[_0x5d4c('0x3a')][_0x5d4c('0x25')]);}_0x396005[_0x5d4c('0x43')]=qs[_0x5d4c('0x44')](_0x1e8aa0['query']['sort']);_0x396005['where']=qs['filters'](_[_0x5d4c('0x46')](_0x1e8aa0[_0x5d4c('0x3a')],_0x194b37[_0x5d4c('0x3c')]));_0x396005[_0x5d4c('0x45')][_0x5d4c('0x5d')]=_0x55d4b4['id'];if(_0x1e8aa0['query'][_0x5d4c('0x47')]){_0x396005[_0x5d4c('0x45')]=_[_0x5d4c('0x48')](_0x396005[_0x5d4c('0x45')],{'$or':_[_0x5d4c('0x36')](_0x396005[_0x5d4c('0x40')],function(_0xc1322e){var _0x4b1072={};_0x4b1072[_0xc1322e]={'$like':'%'+_0x1e8aa0[_0x5d4c('0x3a')][_0x5d4c('0x47')]+'%'};return _0x4b1072;})});}_0x396005=_[_0x5d4c('0x48')]({},_0x396005,_0x1e8aa0[_0x5d4c('0x4a')]);return db['UserFaxQueue']['findAll'](_0x396005);}})['then'](function(_0xac7036){if(_0xac7036){return db[_0x5d4c('0x5e')][_0x5d4c('0x5f')]({'where':{'id':_['map'](_0xac7036,_0x5d4c('0x60')),'role':_0x5d4c('0x61')},'attributes':['id',_0x5d4c('0x33'),_0x5d4c('0x62'),'updatedAt',_0x5d4c('0x63')]});}})['then'](function(_0x464185){if(_0x464185){return{'count':_0x464185[_0x5d4c('0x27')],'rows':_[_0x5d4c('0x36')](_0x464185[_0x5d4c('0x4f')],function(_0x525713){return{'membername':_0x525713[_0x5d4c('0x33')],'UserId':_0x525713['id'],'queue_name':_0x3fcd14[_0x5d4c('0x33')],'FaxQueueId':_0x3fcd14['id'],'interface':util['format'](_0x5d4c('0x64'),'SIP',_0x525713[_0x5d4c('0x33')]),'penalty':0x0,'paused':_0x525713[_0x5d4c('0x62')],'createdAt':_0x525713[_0x5d4c('0x63')],'updatedAt':_0x525713[_0x5d4c('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5d4c('0x2b')](respondWithFilteredResult(_0x5d9065,_0x396005))[_0x5d4c('0x50')](handleError(_0x5d9065,null));};exports[_0x5d4c('0x66')]=function(_0x5098ce,_0x3f9fb6,_0x3717c0){var _0x50b8a2={};var _0x29fd28={};var _0x492221;var _0x6c94fc;return db[_0x5d4c('0x4d')][_0x5d4c('0x67')]({'where':{'id':_0x5098ce[_0x5d4c('0x52')]['id']}})[_0x5d4c('0x2b')](handleEntityNotFound(_0x3f9fb6,null))[_0x5d4c('0x2b')](function(_0x1d28d3){if(_0x1d28d3){_0x492221=_0x1d28d3;_0x29fd28[_0x5d4c('0x3e')]=_[_0x5d4c('0x3b')](db['Team']['rawAttributes']);_0x29fd28[_0x5d4c('0x3a')]=_[_0x5d4c('0x3b')](_0x5098ce['query']);_0x29fd28[_0x5d4c('0x3c')]=_[_0x5d4c('0x3d')](_0x29fd28[_0x5d4c('0x3e')],_0x29fd28['query']);_0x50b8a2[_0x5d4c('0x40')]=_[_0x5d4c('0x3d')](_0x29fd28['model'],qs['fields'](_0x5098ce[_0x5d4c('0x3a')]['fields']));_0x50b8a2[_0x5d4c('0x40')]=_0x50b8a2[_0x5d4c('0x40')][_0x5d4c('0x41')]?_0x50b8a2[_0x5d4c('0x40')]:_0x29fd28[_0x5d4c('0x3e')];_0x50b8a2[_0x5d4c('0x43')]=qs[_0x5d4c('0x44')](_0x5098ce[_0x5d4c('0x3a')][_0x5d4c('0x44')]);_0x50b8a2[_0x5d4c('0x45')]=qs[_0x5d4c('0x3c')](_[_0x5d4c('0x46')](_0x5098ce['query'],_0x29fd28[_0x5d4c('0x3c')]));if(_0x5098ce['query'][_0x5d4c('0x47')]){_0x50b8a2[_0x5d4c('0x45')]=_[_0x5d4c('0x48')](_0x50b8a2[_0x5d4c('0x45')],{'$or':_[_0x5d4c('0x36')](_0x50b8a2[_0x5d4c('0x40')],function(_0x4acaeb){var _0x3230a6={};_0x3230a6[_0x4acaeb]={'$like':'%'+_0x5098ce['query'][_0x5d4c('0x47')]+'%'};return _0x3230a6;})});}_0x50b8a2=_[_0x5d4c('0x48')]({},_0x50b8a2,_0x5098ce[_0x5d4c('0x4a')]);return _0x492221[_0x5d4c('0x66')](_0x50b8a2);}})[_0x5d4c('0x2b')](function(_0x5f0c02){if(_0x5f0c02){_0x6c94fc=_0x5f0c02[_0x5d4c('0x41')];if(!_0x5098ce[_0x5d4c('0x3a')][_0x5d4c('0x68')](_0x5d4c('0x42'))){_0x50b8a2['limit']=qs['limit'](_0x5098ce[_0x5d4c('0x3a')][_0x5d4c('0x28')]);_0x50b8a2[_0x5d4c('0x25')]=qs[_0x5d4c('0x25')](_0x5098ce[_0x5d4c('0x3a')][_0x5d4c('0x25')]);}return _0x492221['getTeams'](_0x50b8a2);}})['then'](function(_0x19e885){if(_0x19e885){return _0x19e885?{'count':_0x6c94fc,'rows':_0x19e885}:null;}})[_0x5d4c('0x2b')](respondWithResult(_0x3f9fb6,null))['catch'](handleError(_0x3f9fb6,null));};exports[_0x5d4c('0x69')]=function(_0x5ec819,_0x2c76dd,_0x57f03e){var _0x288d41=_0x5ec819['body'][_0x5d4c('0x6a')];return db[_0x5d4c('0x6b')]['findAll']({'where':{'id':_0x288d41},'attributes':['id'],'include':[{'model':db[_0x5d4c('0x5e')],'as':_0x5d4c('0x6c'),'attributes':['id',_0x5d4c('0x33'),'online','voicePause','interface'],'raw':!![]}]})['then'](function(_0x1bdccb){if(_0x1bdccb){var _0x45cc88=_[_0x5d4c('0x6d')](_0x1bdccb,function(_0x444dbe){var _0x518973=_0x444dbe[_0x5d4c('0x2c')]({'plain':!![]});return _0x518973['Agents'];});return db[_0x5d4c('0x4d')]['find']({'where':{'id':_0x5ec819[_0x5d4c('0x52')]['id']}})['then'](function(_0x566e3f){return db['sequelize']['transaction'](function(_0x263ee1){return _0x566e3f[_0x5d4c('0x69')](_0x288d41,{'transaction':_0x263ee1})[_0x5d4c('0x2b')](function(){return BPromise[_0x5d4c('0x6e')](_0x45cc88,function(_0x36eafc){return db['UserFaxQueue'][_0x5d4c('0x6f')]({'where':{'UserId':_0x36eafc['id'],'FaxQueueId':_0x5ec819[_0x5d4c('0x52')]['id']},'transaction':_0x263ee1});});})[_0x5d4c('0x2b')](function(){_0x45cc88['forEach'](function(_0x41618d){socket['emit'](_0x5d4c('0x70'),{'UserId':_0x41618d['id'],'FaxQueueId':_0x566e3f['id']});});});});});}})['then'](respondWithStatusCode(_0x2c76dd,null))[_0x5d4c('0x50')](handleError(_0x2c76dd,null));};exports[_0x5d4c('0x71')]=function(_0x439144,_0x29ee0f,_0x19611b){return db['Team'][_0x5d4c('0x4e')]({'where':{'id':_0x439144[_0x5d4c('0x3a')][_0x5d4c('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x5d4c('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5d4c('0x2b')](handleEntityNotFound(_0x29ee0f,null))[_0x5d4c('0x2b')](function(_0x163b8e){var _0x1de4e9=_[_0x5d4c('0x36')](_0x163b8e,'id');var _0x42fb77=[];var _0x42a232=[];var _0x314276=squel[_0x5d4c('0x72')]();_0x314276['field'](_0x5d4c('0x73'))[_0x5d4c('0x74')](_0x5d4c('0x75'),'tq')[_0x5d4c('0x76')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5d4c('0x45')](_0x5d4c('0x77'),_0x439144['params']['id']);for(var _0x413e01=0x0;_0x413e01<_0x163b8e[_0x5d4c('0x41')];_0x413e01+=0x1){let _0x1632e7=_0x163b8e[_0x413e01];for(var _0x4fb78f=0x0;_0x4fb78f<_0x1632e7[_0x5d4c('0x6c')][_0x5d4c('0x41')];_0x4fb78f+=0x1){let _0x8989c7=_0x1632e7[_0x5d4c('0x6c')][_0x4fb78f];var _0x12132b=_0x314276[_0x5d4c('0x78')]();_0x12132b['where'](_0x5d4c('0x79'),_0x8989c7['id']);_0x42a232[_0x5d4c('0x7a')](db[_0x5d4c('0x7b')][_0x5d4c('0x3a')](_0x12132b[_0x5d4c('0x7c')](),{'type':db['sequelize'][_0x5d4c('0x7d')][_0x5d4c('0x7e')]})[_0x5d4c('0x2b')](function(_0x382465){if(_0x382465[_0x5d4c('0x41')]===0x1){return _0x8989c7['id'];}else{var _0x7baf1d=_[_0x5d4c('0x7f')](_[_0x5d4c('0x36')](_0x382465,_0x5d4c('0x80')),function(_0x51257c){return _['includes'](_0x1de4e9,_0x51257c);});if(_0x7baf1d){return _0x8989c7['id'];}}}));}}return BPromise[_0x5d4c('0x81')](_0x42a232)[_0x5d4c('0x2b')](function(_0x372b1f){_0x42fb77=_(_0x42fb77)['union'](_0x372b1f)[_0x5d4c('0x82')]()['value']();return db[_0x5d4c('0x4d')][_0x5d4c('0x53')]({'where':{'id':_0x439144['params']['id']}})[_0x5d4c('0x2b')](function(_0x1e3676){return db[_0x5d4c('0x7b')][_0x5d4c('0x83')](function(_0x480be4){return _0x1e3676['removeTeams'](_0x439144[_0x5d4c('0x3a')]['ids'],{'transaction':_0x480be4})['then'](function(){if(!_[_0x5d4c('0x84')](_0x42fb77)){return _0x1e3676[_0x5d4c('0x85')](_0x42fb77,{'transaction':_0x480be4});}})['then'](function(){_0x42fb77[_0x5d4c('0x86')](function(_0x18622d){socket['emit'](_0x5d4c('0x87'),{'UserId':_0x18622d,'FaxQueueId':_0x1e3676['id']});});});});});});})[_0x5d4c('0x2b')](respondWithStatusCode(_0x29ee0f,null))[_0x5d4c('0x50')](handleError(_0x29ee0f,null));};exports[_0x5d4c('0x88')]=function(_0x574d5b,_0x144bf4,_0x2c911e){return db[_0x5d4c('0x4d')]['find']({'where':{'id':_0x574d5b[_0x5d4c('0x52')]['id']}})[_0x5d4c('0x2b')](handleEntityNotFound(_0x144bf4,null))[_0x5d4c('0x2b')](function(_0x36c8ae){if(_0x36c8ae){return _0x36c8ae[_0x5d4c('0x88')](_0x574d5b[_0x5d4c('0x5a')][_0x5d4c('0x6a')],_['omit'](_0x574d5b[_0x5d4c('0x5a')],['ids','id'])||{})['spread'](function(_0x231993){for(var _0x2f6c03=0x0;_0x2f6c03<_0x574d5b['body'][_0x5d4c('0x6a')][_0x5d4c('0x41')];_0x2f6c03+=0x1){socket['emit'](_0x5d4c('0x70'),{'UserId':Number(_0x574d5b[_0x5d4c('0x5a')][_0x5d4c('0x6a')][_0x2f6c03]),'FaxQueueId':Number(_0x574d5b['params']['id'])});}return _0x231993;});}})[_0x5d4c('0x2b')](respondWithResult(_0x144bf4,null))[_0x5d4c('0x50')](handleError(_0x144bf4,null));};exports[_0x5d4c('0x85')]=function(_0x1f21df,_0x3d2dfe,_0x215ad4){return db[_0x5d4c('0x4d')][_0x5d4c('0x53')]({'where':{'id':_0x1f21df['params']['id']}})['then'](handleEntityNotFound(_0x3d2dfe,null))[_0x5d4c('0x2b')](function(_0x917504){if(_0x917504){return _0x917504['removeAgents'](_0x1f21df['query'][_0x5d4c('0x6a')])[_0x5d4c('0x2b')](function(){if(_[_0x5d4c('0x89')](_0x1f21df[_0x5d4c('0x3a')][_0x5d4c('0x6a')])){for(var _0x5b55e0=0x0;_0x5b55e0<_0x1f21df[_0x5d4c('0x3a')][_0x5d4c('0x6a')][_0x5d4c('0x41')];_0x5b55e0+=0x1){socket[_0x5d4c('0x8a')](_0x5d4c('0x87'),{'UserId':Number(_0x1f21df[_0x5d4c('0x3a')]['ids'][_0x5b55e0]),'FaxQueueId':Number(_0x1f21df[_0x5d4c('0x52')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x1f21df[_0x5d4c('0x3a')]['ids']),'FaxQueueId':Number(_0x1f21df[_0x5d4c('0x52')]['id'])});}});}})[_0x5d4c('0x2b')](respondWithStatusCode(_0x3d2dfe,null))[_0x5d4c('0x50')](handleError(_0x3d2dfe,null));};exports[_0x5d4c('0x8b')]=function(_0x1fccd0,_0x2ce8da,_0x1686a8){var _0x5a2a31={};var _0x2ae010={};var _0x225eeb;var _0x1a0129;return db['FaxQueue'][_0x5d4c('0x67')]({'where':{'id':_0x1fccd0[_0x5d4c('0x52')]['id']}})['then'](handleEntityNotFound(_0x2ce8da,null))[_0x5d4c('0x2b')](function(_0x4ea04c){if(_0x4ea04c){_0x225eeb=_0x4ea04c;_0x2ae010[_0x5d4c('0x3e')]=_[_0x5d4c('0x3b')](db['User'][_0x5d4c('0x37')]);_0x2ae010[_0x5d4c('0x3a')]=_[_0x5d4c('0x3b')](_0x1fccd0['query']);_0x2ae010[_0x5d4c('0x3c')]=_['intersection'](_0x2ae010[_0x5d4c('0x3e')],_0x2ae010[_0x5d4c('0x3a')]);_0x5a2a31[_0x5d4c('0x40')]=_[_0x5d4c('0x3d')](_0x2ae010['model'],qs[_0x5d4c('0x3f')](_0x1fccd0[_0x5d4c('0x3a')][_0x5d4c('0x3f')]));_0x5a2a31[_0x5d4c('0x40')]=_0x5a2a31['attributes'][_0x5d4c('0x41')]?_0x5a2a31[_0x5d4c('0x40')]:_0x2ae010[_0x5d4c('0x3e')];_0x5a2a31[_0x5d4c('0x43')]=qs['sort'](_0x1fccd0[_0x5d4c('0x3a')][_0x5d4c('0x44')]);_0x5a2a31[_0x5d4c('0x45')]=qs[_0x5d4c('0x3c')](_[_0x5d4c('0x46')](_0x1fccd0['query'],_0x2ae010[_0x5d4c('0x3c')]));if(_0x1fccd0[_0x5d4c('0x3a')][_0x5d4c('0x47')]){_0x5a2a31[_0x5d4c('0x45')]=_[_0x5d4c('0x48')](_0x5a2a31['where'],{'$or':_[_0x5d4c('0x36')](_0x5a2a31[_0x5d4c('0x40')],function(_0x27146a){var _0x295591={};_0x295591[_0x27146a]={'$like':'%'+_0x1fccd0[_0x5d4c('0x3a')][_0x5d4c('0x47')]+'%'};return _0x295591;})});}_0x5a2a31=_[_0x5d4c('0x48')]({},_0x5a2a31,_0x1fccd0[_0x5d4c('0x4a')]);return _0x225eeb[_0x5d4c('0x8b')](_0x5a2a31);}})[_0x5d4c('0x2b')](function(_0x1c4117){if(_0x1c4117){_0x1a0129=_0x1c4117[_0x5d4c('0x41')];if(!_0x1fccd0[_0x5d4c('0x3a')][_0x5d4c('0x68')](_0x5d4c('0x42'))){_0x5a2a31[_0x5d4c('0x28')]=qs[_0x5d4c('0x28')](_0x1fccd0[_0x5d4c('0x3a')][_0x5d4c('0x28')]);_0x5a2a31[_0x5d4c('0x25')]=qs[_0x5d4c('0x25')](_0x1fccd0[_0x5d4c('0x3a')][_0x5d4c('0x25')]);}return _0x225eeb[_0x5d4c('0x8b')](_0x5a2a31);}})[_0x5d4c('0x2b')](function(_0x4dafd7){if(_0x4dafd7){return _0x4dafd7?{'count':_0x1a0129,'rows':_0x4dafd7}:null;}})[_0x5d4c('0x2b')](respondWithResult(_0x2ce8da,null))['catch'](handleError(_0x2ce8da,null));}; \ No newline at end of file +var _0x45a0=['findOne','UserFaxQueue','FaxQueueId','findAll','User','UserId','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','all','union','compact','ids','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','name','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','count','includeAll','include','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0x45a0,0x140));var _0x045a=function(_0x5c003e,_0x30930d){_0x5c003e=_0x5c003e-0x0;var _0x36baa5=_0x45a0[_0x5c003e];return _0x36baa5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x045a('0x0'));var zipdir=require(_0x045a('0x1'));var jsonpatch=require(_0x045a('0x2'));var rp=require(_0x045a('0x3'));var moment=require(_0x045a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x045a('0x5'));var sox=require(_0x045a('0x6'));var csv=require(_0x045a('0x7'));var ejs=require(_0x045a('0x8'));var fs=require('fs');var fs_extra=require(_0x045a('0x9'));var _=require('lodash');var squel=require(_0x045a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x045a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x045a('0xc'));var Papa=require(_0x045a('0xd'));var Redis=require(_0x045a('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x045a('0xf'));var hardwareService=require(_0x045a('0x10'));var logger=require(_0x045a('0x11'))(_0x045a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x045a('0x13')]=_[_0x045a('0x14')](config[_0x045a('0x13')],{'host':_0x045a('0x15'),'port':0x18eb});var socket=require(_0x045a('0x16'))(new Redis(config['redis']));require(_0x045a('0x17'))[_0x045a('0x18')](socket);function respondWithStatusCode(_0x2a3cf2,_0x2bf95f){_0x2bf95f=_0x2bf95f||0xcc;return function(_0x59ba51){if(_0x59ba51){return _0x2a3cf2['sendStatus'](_0x2bf95f);}return _0x2a3cf2[_0x045a('0x19')](_0x2bf95f)['end']();};}function respondWithResult(_0x36db35,_0x43cd72){_0x43cd72=_0x43cd72||0xc8;return function(_0x381098){if(_0x381098){return _0x36db35[_0x045a('0x19')](_0x43cd72)[_0x045a('0x1a')](_0x381098);}};}function respondWithFilteredResult(_0x19bf36,_0x51ee5b){return function(_0xdc58b2){if(_0xdc58b2){var _0x4ce97f=typeof _0x51ee5b[_0x045a('0x1b')]===_0x045a('0x1c')&&typeof _0x51ee5b['limit']==='undefined';var _0x135d07=_0xdc58b2['count'];var _0x2146f7=_0x4ce97f?0x0:_0x51ee5b[_0x045a('0x1b')];var _0x198c2c=_0x4ce97f?_0xdc58b2['count']:_0x51ee5b[_0x045a('0x1b')]+_0x51ee5b[_0x045a('0x1d')];var _0x592d68;if(_0x198c2c>=_0x135d07){_0x198c2c=_0x135d07;_0x592d68=0xc8;}else{_0x592d68=0xce;}_0x19bf36[_0x045a('0x19')](_0x592d68);return _0x19bf36[_0x045a('0x1e')](_0x045a('0x1f'),_0x2146f7+'-'+_0x198c2c+'/'+_0x135d07)[_0x045a('0x1a')](_0xdc58b2);}return null;};}function patchUpdates(_0x1176e8){return function(_0x5072d0){try{jsonpatch[_0x045a('0x20')](_0x5072d0,_0x1176e8,!![]);}catch(_0x525798){return BPromise[_0x045a('0x21')](_0x525798);}return _0x5072d0[_0x045a('0x22')]();};}function saveUpdates(_0x1a8da0,_0x25cc6b){return function(_0x3d8a6a){if(_0x3d8a6a){return _0x3d8a6a[_0x045a('0x23')](_0x1a8da0)[_0x045a('0x24')](function(_0x5c196b){return _0x5c196b;});}return null;};}function removeEntity(_0x537944,_0x573b81){return function(_0x3391f7){if(_0x3391f7){return _0x3391f7[_0x045a('0x25')]()[_0x045a('0x24')](function(){var _0x4a5612=_0x3391f7[_0x045a('0x26')]({'plain':!![]});var _0x3d24da=_0x045a('0x27');return db[_0x045a('0x28')]['destroy']({'where':{'type':_0x3d24da,'resourceId':_0x4a5612['id']}})['then'](function(){return _0x3391f7;});})['then'](function(){_0x537944[_0x045a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x67854b,_0x3e318d){return function(_0x1c629d){if(!_0x1c629d){_0x67854b['sendStatus'](0x194);}return _0x1c629d;};}function handleError(_0x21128a,_0x595d32){_0x595d32=_0x595d32||0x1f4;return function(_0x42e23c){logger[_0x045a('0x29')](_0x42e23c['stack']);if(_0x42e23c[_0x045a('0x2a')]){delete _0x42e23c[_0x045a('0x2a')];}_0x21128a[_0x045a('0x19')](_0x595d32)['send'](_0x42e23c);};}exports[_0x045a('0x2b')]=function(_0x7178ac,_0x27ff91){var _0x530a82={},_0x722b7e={},_0x3a1170={'count':0x0,'rows':[]};var _0x3712bd=_[_0x045a('0x2c')](db[_0x045a('0x2d')][_0x045a('0x2e')],function(_0x204849){return{'name':_0x204849[_0x045a('0x2f')],'type':_0x204849[_0x045a('0x30')][_0x045a('0x31')]};});_0x722b7e[_0x045a('0x32')]=_[_0x045a('0x2c')](_0x3712bd,_0x045a('0x2a'));_0x722b7e['query']=_[_0x045a('0x33')](_0x7178ac['query']);_0x722b7e[_0x045a('0x34')]=_[_0x045a('0x35')](_0x722b7e[_0x045a('0x32')],_0x722b7e['query']);_0x530a82[_0x045a('0x36')]=_[_0x045a('0x35')](_0x722b7e[_0x045a('0x32')],qs[_0x045a('0x37')](_0x7178ac[_0x045a('0x38')]['fields']));_0x530a82['attributes']=_0x530a82['attributes'][_0x045a('0x39')]?_0x530a82['attributes']:_0x722b7e[_0x045a('0x32')];if(!_0x7178ac[_0x045a('0x38')][_0x045a('0x3a')](_0x045a('0x3b'))){_0x530a82[_0x045a('0x1d')]=qs[_0x045a('0x1d')](_0x7178ac[_0x045a('0x38')][_0x045a('0x1d')]);_0x530a82[_0x045a('0x1b')]=qs[_0x045a('0x1b')](_0x7178ac[_0x045a('0x38')]['offset']);}_0x530a82[_0x045a('0x3c')]=qs[_0x045a('0x3d')](_0x7178ac['query'][_0x045a('0x3d')]);_0x530a82[_0x045a('0x3e')]=qs[_0x045a('0x34')](_[_0x045a('0x3f')](_0x7178ac['query'],_0x722b7e[_0x045a('0x34')]),_0x3712bd);if(_0x7178ac[_0x045a('0x38')]['filter']){_0x530a82[_0x045a('0x3e')]=_['merge'](_0x530a82[_0x045a('0x3e')],{'$or':_[_0x045a('0x2c')](_0x3712bd,function(_0x12fef1){if(_0x12fef1[_0x045a('0x30')]!==_0x045a('0x40')){var _0x140f09={};_0x140f09[_0x12fef1['name']]={'$like':'%'+_0x7178ac['query'][_0x045a('0x41')]+'%'};return _0x140f09;}})});}_0x530a82=_[_0x045a('0x42')]({},_0x530a82,_0x7178ac[_0x045a('0x43')]);var _0x2422a6={'where':_0x530a82[_0x045a('0x3e')]};return db['FaxQueue']['count'](_0x2422a6)['then'](function(_0x19767a){_0x3a1170[_0x045a('0x44')]=_0x19767a;if(_0x7178ac[_0x045a('0x38')][_0x045a('0x45')]){_0x530a82[_0x045a('0x46')]=[{'all':!![]}];}return db[_0x045a('0x2d')]['findAll'](_0x530a82);})[_0x045a('0x24')](function(_0x3c0dc7){_0x3a1170[_0x045a('0x47')]=_0x3c0dc7;return _0x3a1170;})[_0x045a('0x24')](respondWithFilteredResult(_0x27ff91,_0x530a82))[_0x045a('0x48')](handleError(_0x27ff91,null));};exports['show']=function(_0x5ec3a4,_0x1293be){var _0x3eea32={'raw':!![],'where':{'id':_0x5ec3a4[_0x045a('0x49')]['id']}},_0x515f49={};_0x515f49[_0x045a('0x32')]=_[_0x045a('0x33')](db[_0x045a('0x2d')][_0x045a('0x2e')]);_0x515f49[_0x045a('0x38')]=_['keys'](_0x5ec3a4['query']);_0x515f49['filters']=_[_0x045a('0x35')](_0x515f49['model'],_0x515f49['query']);_0x3eea32['attributes']=_[_0x045a('0x35')](_0x515f49[_0x045a('0x32')],qs[_0x045a('0x37')](_0x5ec3a4['query'][_0x045a('0x37')]));_0x3eea32[_0x045a('0x36')]=_0x3eea32[_0x045a('0x36')]['length']?_0x3eea32['attributes']:_0x515f49[_0x045a('0x32')];if(_0x5ec3a4[_0x045a('0x38')][_0x045a('0x45')]){_0x3eea32[_0x045a('0x46')]=[{'all':!![]}];}_0x3eea32=_[_0x045a('0x42')]({},_0x3eea32,_0x5ec3a4['options']);return db[_0x045a('0x2d')][_0x045a('0x4a')](_0x3eea32)[_0x045a('0x24')](handleEntityNotFound(_0x1293be,null))[_0x045a('0x24')](respondWithResult(_0x1293be,null))['catch'](handleError(_0x1293be,null));};exports['create']=function(_0x54ca73,_0xf57d81){return db[_0x045a('0x2d')][_0x045a('0x4b')](_0x54ca73[_0x045a('0x4c')],{})[_0x045a('0x24')](function(_0x5a4531){var _0x21b2de=_0x54ca73[_0x045a('0x4d')]['get']({'plain':!![]});if(!_0x21b2de)throw new Error(_0x045a('0x4e'));if(_0x21b2de[_0x045a('0x4f')]==='user'){var _0x4431f6=_0x5a4531[_0x045a('0x26')]({'plain':!![]});var _0x56cdb2=_0x045a('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x56cdb2,'userProfileId':_0x21b2de[_0x045a('0x50')]},'raw':!![]})[_0x045a('0x24')](function(_0x5e322b){if(_0x5e322b&&_0x5e322b[_0x045a('0x51')]===0x0){return db[_0x045a('0x28')][_0x045a('0x4b')]({'name':_0x4431f6[_0x045a('0x2a')],'resourceId':_0x4431f6['id'],'type':_0x5e322b[_0x045a('0x2a')],'sectionId':_0x5e322b['id']},{})[_0x045a('0x24')](function(){return _0x5a4531;});}else{return _0x5a4531;}})['catch'](function(_0x58ea7d){logger['error'](_0x045a('0x52'),_0x58ea7d);throw _0x58ea7d;});}return _0x5a4531;})['then'](respondWithResult(_0xf57d81,0xc9))['catch'](handleError(_0xf57d81,null));};exports[_0x045a('0x23')]=function(_0x3ac78e,_0x427104){if(_0x3ac78e[_0x045a('0x4c')]['id']){delete _0x3ac78e[_0x045a('0x4c')]['id'];}return db[_0x045a('0x2d')]['find']({'where':{'id':_0x3ac78e[_0x045a('0x49')]['id']}})['then'](handleEntityNotFound(_0x427104,null))['then'](saveUpdates(_0x3ac78e[_0x045a('0x4c')],null))['then'](respondWithResult(_0x427104,null))[_0x045a('0x48')](handleError(_0x427104,null));};exports[_0x045a('0x25')]=function(_0x3d638b,_0x5ba409){return db[_0x045a('0x2d')][_0x045a('0x4a')]({'where':{'id':_0x3d638b[_0x045a('0x49')]['id']}})[_0x045a('0x24')](handleEntityNotFound(_0x5ba409,null))[_0x045a('0x24')](removeEntity(_0x5ba409,null))[_0x045a('0x48')](handleError(_0x5ba409,null));};exports[_0x045a('0x53')]=function(_0x15deb2,_0x15b69d){return db[_0x045a('0x2d')]['describe']()['then'](respondWithResult(_0x15b69d,null))[_0x045a('0x48')](handleError(_0x15b69d,null));};exports[_0x045a('0x54')]=function(_0x3491a4,_0x689321,_0x1988a6){var _0x56ad47={'raw':!![],'where':{}},_0x58fee2={},_0x9a0468;return db[_0x045a('0x2d')][_0x045a('0x55')]({'where':{'id':_0x3491a4[_0x045a('0x49')]['id']}})['then'](handleEntityNotFound(_0x689321,null))['then'](function(_0x8817d9){if(_0x8817d9){_0x9a0468=_0x8817d9[_0x045a('0x26')]({'plain':!![]});_0x58fee2[_0x045a('0x32')]=_[_0x045a('0x33')](db[_0x045a('0x56')]['rawAttributes']);_0x58fee2[_0x045a('0x38')]=_[_0x045a('0x33')](_0x3491a4['query']);_0x58fee2[_0x045a('0x34')]=_[_0x045a('0x35')](_0x58fee2[_0x045a('0x32')],_0x58fee2[_0x045a('0x38')]);_0x56ad47['attributes']=_[_0x045a('0x35')](_0x58fee2['model'],qs[_0x045a('0x37')](_0x3491a4['query'][_0x045a('0x37')]));_0x56ad47['attributes']=_0x56ad47[_0x045a('0x36')][_0x045a('0x39')]?_0x56ad47[_0x045a('0x36')]:_0x58fee2[_0x045a('0x32')];if(!_0x3491a4['query'][_0x045a('0x3a')](_0x045a('0x3b'))){_0x56ad47[_0x045a('0x1d')]=qs['limit'](_0x3491a4[_0x045a('0x38')][_0x045a('0x1d')]);_0x56ad47['offset']=qs[_0x045a('0x1b')](_0x3491a4['query'][_0x045a('0x1b')]);}_0x56ad47[_0x045a('0x3c')]=qs['sort'](_0x3491a4['query'][_0x045a('0x3d')]);_0x56ad47['where']=qs[_0x045a('0x34')](_[_0x045a('0x3f')](_0x3491a4[_0x045a('0x38')],_0x58fee2[_0x045a('0x34')]));_0x56ad47[_0x045a('0x3e')][_0x045a('0x57')]=_0x8817d9['id'];if(_0x3491a4['query'][_0x045a('0x41')]){_0x56ad47[_0x045a('0x3e')]=_[_0x045a('0x42')](_0x56ad47['where'],{'$or':_[_0x045a('0x2c')](_0x56ad47[_0x045a('0x36')],function(_0x2ff93e){var _0x4dc923={};_0x4dc923[_0x2ff93e]={'$like':'%'+_0x3491a4['query']['filter']+'%'};return _0x4dc923;})});}_0x56ad47=_[_0x045a('0x42')]({},_0x56ad47,_0x3491a4['options']);return db['UserFaxQueue'][_0x045a('0x58')](_0x56ad47);}})[_0x045a('0x24')](function(_0x4d8fe6){if(_0x4d8fe6){return db[_0x045a('0x59')]['findAndCountAll']({'where':{'id':_[_0x045a('0x2c')](_0x4d8fe6,_0x045a('0x5a')),'role':_0x045a('0x5b')},'attributes':['id','name',_0x045a('0x5c'),_0x045a('0x5d'),_0x045a('0x5e')]});}})['then'](function(_0x53b312){if(_0x53b312){return{'count':_0x53b312[_0x045a('0x44')],'rows':_[_0x045a('0x2c')](_0x53b312['rows'],function(_0x4f99b0){return{'membername':_0x4f99b0[_0x045a('0x2a')],'UserId':_0x4f99b0['id'],'queue_name':_0x9a0468[_0x045a('0x2a')],'FaxQueueId':_0x9a0468['id'],'interface':util['format'](_0x045a('0x5f'),_0x045a('0x60'),_0x4f99b0[_0x045a('0x2a')]),'penalty':0x0,'paused':_0x4f99b0[_0x045a('0x5c')],'createdAt':_0x4f99b0[_0x045a('0x5e')],'updatedAt':_0x4f99b0[_0x045a('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x689321,_0x56ad47))[_0x045a('0x48')](handleError(_0x689321,null));};exports[_0x045a('0x61')]=function(_0x18d32,_0x594187,_0x3ae1a6){var _0x5808bd={};var _0x5d55d6={};var _0x19f50a;var _0xc1ade5;return db[_0x045a('0x2d')]['findOne']({'where':{'id':_0x18d32['params']['id']}})[_0x045a('0x24')](handleEntityNotFound(_0x594187,null))['then'](function(_0x17dfc5){if(_0x17dfc5){_0x19f50a=_0x17dfc5;_0x5d55d6[_0x045a('0x32')]=_[_0x045a('0x33')](db[_0x045a('0x62')][_0x045a('0x2e')]);_0x5d55d6['query']=_['keys'](_0x18d32[_0x045a('0x38')]);_0x5d55d6[_0x045a('0x34')]=_['intersection'](_0x5d55d6[_0x045a('0x32')],_0x5d55d6[_0x045a('0x38')]);_0x5808bd[_0x045a('0x36')]=_[_0x045a('0x35')](_0x5d55d6[_0x045a('0x32')],qs['fields'](_0x18d32['query'][_0x045a('0x37')]));_0x5808bd[_0x045a('0x36')]=_0x5808bd['attributes'][_0x045a('0x39')]?_0x5808bd['attributes']:_0x5d55d6[_0x045a('0x32')];_0x5808bd[_0x045a('0x3c')]=qs[_0x045a('0x3d')](_0x18d32[_0x045a('0x38')][_0x045a('0x3d')]);_0x5808bd['where']=qs[_0x045a('0x34')](_[_0x045a('0x3f')](_0x18d32[_0x045a('0x38')],_0x5d55d6[_0x045a('0x34')]));if(_0x18d32[_0x045a('0x38')][_0x045a('0x41')]){_0x5808bd[_0x045a('0x3e')]=_[_0x045a('0x42')](_0x5808bd['where'],{'$or':_[_0x045a('0x2c')](_0x5808bd['attributes'],function(_0x3b3171){var _0x2500a4={};_0x2500a4[_0x3b3171]={'$like':'%'+_0x18d32[_0x045a('0x38')]['filter']+'%'};return _0x2500a4;})});}_0x5808bd=_['merge']({},_0x5808bd,_0x18d32[_0x045a('0x43')]);return _0x19f50a[_0x045a('0x61')](_0x5808bd);}})[_0x045a('0x24')](function(_0x51c472){if(_0x51c472){_0xc1ade5=_0x51c472[_0x045a('0x39')];if(!_0x18d32['query'][_0x045a('0x3a')](_0x045a('0x3b'))){_0x5808bd['limit']=qs[_0x045a('0x1d')](_0x18d32[_0x045a('0x38')][_0x045a('0x1d')]);_0x5808bd['offset']=qs[_0x045a('0x1b')](_0x18d32['query']['offset']);}return _0x19f50a[_0x045a('0x61')](_0x5808bd);}})[_0x045a('0x24')](function(_0x20093d){if(_0x20093d){return _0x20093d?{'count':_0xc1ade5,'rows':_0x20093d}:null;}})[_0x045a('0x24')](respondWithResult(_0x594187,null))['catch'](handleError(_0x594187,null));};exports[_0x045a('0x63')]=function(_0x2f1b9e,_0x393152,_0x45e3c3){var _0x3edc49=_0x2f1b9e[_0x045a('0x4c')]['ids'];return db[_0x045a('0x62')][_0x045a('0x58')]({'where':{'id':_0x3edc49},'attributes':['id'],'include':[{'model':db['User'],'as':_0x045a('0x64'),'attributes':['id',_0x045a('0x2a'),_0x045a('0x65'),_0x045a('0x66'),_0x045a('0x67')],'raw':!![]}]})['then'](function(_0x5b8628){if(_0x5b8628){var _0x597cec=_['flatMap'](_0x5b8628,function(_0x12dedc){var _0x2d9de1=_0x12dedc[_0x045a('0x26')]({'plain':!![]});return _0x2d9de1[_0x045a('0x64')];});return db['FaxQueue']['find']({'where':{'id':_0x2f1b9e[_0x045a('0x49')]['id']}})[_0x045a('0x24')](function(_0x28eae6){return db[_0x045a('0x68')][_0x045a('0x69')](function(_0x4055a0){return _0x28eae6[_0x045a('0x63')](_0x3edc49,{'transaction':_0x4055a0})[_0x045a('0x24')](function(){return BPromise['each'](_0x597cec,function(_0xd097c4){return db[_0x045a('0x56')][_0x045a('0x6a')]({'where':{'UserId':_0xd097c4['id'],'FaxQueueId':_0x2f1b9e[_0x045a('0x49')]['id']},'transaction':_0x4055a0});});})[_0x045a('0x24')](function(){_0x597cec[_0x045a('0x6b')](function(_0x2a2e60){socket[_0x045a('0x6c')](_0x045a('0x6d'),{'UserId':_0x2a2e60['id'],'FaxQueueId':_0x28eae6['id']});});});});});}})[_0x045a('0x24')](respondWithStatusCode(_0x393152,null))['catch'](handleError(_0x393152,null));};exports[_0x045a('0x6e')]=function(_0x414e94,_0x4633e4,_0x559767){return db['Team'][_0x045a('0x58')]({'where':{'id':_0x414e94['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x045a('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x045a('0x24')](handleEntityNotFound(_0x4633e4,null))[_0x045a('0x24')](function(_0x3373a6){var _0x3b3a3f=_[_0x045a('0x2c')](_0x3373a6,'id');var _0x546908=[];var _0x4ecc8f=[];var _0x430a6b=squel[_0x045a('0x6f')]();_0x430a6b[_0x045a('0x70')](_0x045a('0x71'))[_0x045a('0x72')](_0x045a('0x73'),'tq')['join'](_0x045a('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x045a('0x75'),_0x414e94[_0x045a('0x49')]['id']);for(var _0x923fb3=0x0;_0x923fb3<_0x3373a6[_0x045a('0x39')];_0x923fb3+=0x1){let _0x5633bd=_0x3373a6[_0x923fb3];for(var _0x4b20ef=0x0;_0x4b20ef<_0x5633bd[_0x045a('0x64')][_0x045a('0x39')];_0x4b20ef+=0x1){let _0x5e12a8=_0x5633bd[_0x045a('0x64')][_0x4b20ef];var _0x4f1921=_0x430a6b[_0x045a('0x76')]();_0x4f1921[_0x045a('0x3e')](_0x045a('0x77'),_0x5e12a8['id']);_0x4ecc8f[_0x045a('0x78')](db['sequelize'][_0x045a('0x38')](_0x4f1921['toString'](),{'type':db[_0x045a('0x68')][_0x045a('0x79')][_0x045a('0x7a')]})['then'](function(_0x561de7){if(_0x561de7[_0x045a('0x39')]===0x1){return _0x5e12a8['id'];}else{var _0x30ba79=_['every'](_['map'](_0x561de7,_0x045a('0x7b')),function(_0x55921a){return _['includes'](_0x3b3a3f,_0x55921a);});if(_0x30ba79){return _0x5e12a8['id'];}}}));}}return BPromise[_0x045a('0x7c')](_0x4ecc8f)[_0x045a('0x24')](function(_0x52f24f){_0x546908=_(_0x546908)[_0x045a('0x7d')](_0x52f24f)[_0x045a('0x7e')]()['value']();return db[_0x045a('0x2d')][_0x045a('0x4a')]({'where':{'id':_0x414e94[_0x045a('0x49')]['id']}})[_0x045a('0x24')](function(_0x51cf27){return db['sequelize'][_0x045a('0x69')](function(_0x3c47d2){return _0x51cf27[_0x045a('0x6e')](_0x414e94['query'][_0x045a('0x7f')],{'transaction':_0x3c47d2})['then'](function(){if(!_['isEmpty'](_0x546908)){return _0x51cf27[_0x045a('0x80')](_0x546908,{'transaction':_0x3c47d2});}})['then'](function(){_0x546908[_0x045a('0x6b')](function(_0x55a1cd){socket[_0x045a('0x6c')](_0x045a('0x81'),{'UserId':_0x55a1cd,'FaxQueueId':_0x51cf27['id']});});});});});});})['then'](respondWithStatusCode(_0x4633e4,null))[_0x045a('0x48')](handleError(_0x4633e4,null));};exports[_0x045a('0x82')]=function(_0x24445b,_0x2cdca6,_0x215c80){return db[_0x045a('0x2d')][_0x045a('0x4a')]({'where':{'id':_0x24445b[_0x045a('0x49')]['id']}})[_0x045a('0x24')](handleEntityNotFound(_0x2cdca6,null))[_0x045a('0x24')](function(_0x32b781){if(_0x32b781){return _0x32b781[_0x045a('0x82')](_0x24445b[_0x045a('0x4c')][_0x045a('0x7f')],_[_0x045a('0x83')](_0x24445b[_0x045a('0x4c')],[_0x045a('0x7f'),'id'])||{})[_0x045a('0x84')](function(_0x3b0959){for(var _0x2d3ca0=0x0;_0x2d3ca0<_0x24445b[_0x045a('0x4c')][_0x045a('0x7f')][_0x045a('0x39')];_0x2d3ca0+=0x1){socket['emit'](_0x045a('0x6d'),{'UserId':Number(_0x24445b[_0x045a('0x4c')][_0x045a('0x7f')][_0x2d3ca0]),'FaxQueueId':Number(_0x24445b[_0x045a('0x49')]['id'])});}return _0x3b0959;});}})[_0x045a('0x24')](respondWithResult(_0x2cdca6,null))[_0x045a('0x48')](handleError(_0x2cdca6,null));};exports[_0x045a('0x80')]=function(_0x1931a9,_0x540402,_0x11af53){return db[_0x045a('0x2d')][_0x045a('0x4a')]({'where':{'id':_0x1931a9[_0x045a('0x49')]['id']}})[_0x045a('0x24')](handleEntityNotFound(_0x540402,null))[_0x045a('0x24')](function(_0x46baf2){if(_0x46baf2){return _0x46baf2[_0x045a('0x80')](_0x1931a9[_0x045a('0x38')][_0x045a('0x7f')])[_0x045a('0x24')](function(){if(_[_0x045a('0x85')](_0x1931a9[_0x045a('0x38')][_0x045a('0x7f')])){for(var _0x2b942a=0x0;_0x2b942a<_0x1931a9[_0x045a('0x38')][_0x045a('0x7f')][_0x045a('0x39')];_0x2b942a+=0x1){socket[_0x045a('0x6c')]('userFaxQueue:remove',{'UserId':Number(_0x1931a9[_0x045a('0x38')][_0x045a('0x7f')][_0x2b942a]),'FaxQueueId':Number(_0x1931a9[_0x045a('0x49')]['id'])});}}else{socket['emit'](_0x045a('0x81'),{'UserId':Number(_0x1931a9[_0x045a('0x38')][_0x045a('0x7f')]),'FaxQueueId':Number(_0x1931a9[_0x045a('0x49')]['id'])});}});}})[_0x045a('0x24')](respondWithStatusCode(_0x540402,null))[_0x045a('0x48')](handleError(_0x540402,null));};exports[_0x045a('0x86')]=function(_0xa0002a,_0x5b478e,_0x4579a8){var _0x1264a7={};var _0x6ddcd4={};var _0x1dcdab;var _0xf91c61;return db['FaxQueue']['findOne']({'where':{'id':_0xa0002a[_0x045a('0x49')]['id']}})[_0x045a('0x24')](handleEntityNotFound(_0x5b478e,null))['then'](function(_0x4c9583){if(_0x4c9583){_0x1dcdab=_0x4c9583;_0x6ddcd4[_0x045a('0x32')]=_[_0x045a('0x33')](db[_0x045a('0x59')][_0x045a('0x2e')]);_0x6ddcd4[_0x045a('0x38')]=_['keys'](_0xa0002a['query']);_0x6ddcd4[_0x045a('0x34')]=_[_0x045a('0x35')](_0x6ddcd4['model'],_0x6ddcd4[_0x045a('0x38')]);_0x1264a7[_0x045a('0x36')]=_[_0x045a('0x35')](_0x6ddcd4['model'],qs['fields'](_0xa0002a[_0x045a('0x38')][_0x045a('0x37')]));_0x1264a7['attributes']=_0x1264a7[_0x045a('0x36')][_0x045a('0x39')]?_0x1264a7['attributes']:_0x6ddcd4['model'];_0x1264a7[_0x045a('0x3c')]=qs[_0x045a('0x3d')](_0xa0002a['query'][_0x045a('0x3d')]);_0x1264a7[_0x045a('0x3e')]=qs[_0x045a('0x34')](_[_0x045a('0x3f')](_0xa0002a[_0x045a('0x38')],_0x6ddcd4['filters']));if(_0xa0002a[_0x045a('0x38')][_0x045a('0x41')]){_0x1264a7['where']=_['merge'](_0x1264a7[_0x045a('0x3e')],{'$or':_[_0x045a('0x2c')](_0x1264a7['attributes'],function(_0x3133b5){var _0x440a79={};_0x440a79[_0x3133b5]={'$like':'%'+_0xa0002a[_0x045a('0x38')][_0x045a('0x41')]+'%'};return _0x440a79;})});}_0x1264a7=_['merge']({},_0x1264a7,_0xa0002a[_0x045a('0x43')]);return _0x1dcdab['getAgents'](_0x1264a7);}})['then'](function(_0x2fba7f){if(_0x2fba7f){_0xf91c61=_0x2fba7f['length'];if(!_0xa0002a[_0x045a('0x38')]['hasOwnProperty'](_0x045a('0x3b'))){_0x1264a7[_0x045a('0x1d')]=qs['limit'](_0xa0002a[_0x045a('0x38')][_0x045a('0x1d')]);_0x1264a7[_0x045a('0x1b')]=qs['offset'](_0xa0002a[_0x045a('0x38')][_0x045a('0x1b')]);}return _0x1dcdab['getAgents'](_0x1264a7);}})['then'](function(_0x11f1ae){if(_0x11f1ae){return _0x11f1ae?{'count':_0xf91c61,'rows':_0x11f1ae}:null;}})['then'](respondWithResult(_0x5b478e,null))[_0x045a('0x48')](handleError(_0x5b478e,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index baef76b..d25d0a4 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 _0x0aae=['hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0aae,0x156));var _0xe0aa=function(_0x34803f,_0x3de05e){_0x34803f=_0x34803f-0x0;var _0x261286=_0x0aae[_0x34803f];return _0x261286;};'use strict';var EventEmitter=require(_0xe0aa('0x0'));var FaxQueue=require(_0xe0aa('0x1'))['db'][_0xe0aa('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xe0aa('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe0aa('0x4'),'afterDestroy':_0xe0aa('0x5')};function emitEvent(_0x197906){return function(_0x3c56d8,_0x5c54ac,_0x269939){FaxQueueEvents[_0xe0aa('0x6')](_0x197906+':'+_0x3c56d8['id'],_0x3c56d8);FaxQueueEvents[_0xe0aa('0x6')](_0x197906,_0x3c56d8);_0x269939(null);};}for(var e in events){if(events[_0xe0aa('0x7')](e)){var event=events[e];FaxQueue[_0xe0aa('0x8')](e,emitEvent(event));}}module[_0xe0aa('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0xb1f4=['hook','exports','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb1f4,0x173));var _0x4b1f=function(_0x4dcfc3,_0x65e123){_0x4dcfc3=_0x4dcfc3-0x0;var _0x400cd8=_0xb1f4[_0x4dcfc3];return _0x400cd8;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0x4b1f('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x4b1f('0x1')](0x0);var events={'afterCreate':_0x4b1f('0x2'),'afterUpdate':_0x4b1f('0x3'),'afterDestroy':_0x4b1f('0x4')};function emitEvent(_0x5d7b11){return function(_0x539ce1,_0x56385e,_0x7af53c){FaxQueueEvents[_0x4b1f('0x5')](_0x5d7b11+':'+_0x539ce1['id'],_0x539ce1);FaxQueueEvents['emit'](_0x5d7b11,_0x539ce1);_0x7af53c(null);};}for(var e in events){if(events[_0x4b1f('0x6')](e)){var event=events[e];FaxQueue[_0x4b1f('0x7')](e,emitEvent(event));}}module[_0x4b1f('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 44dae61..d886741 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 _0xa123=['exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes'];(function(_0x4d76ff,_0x356fda){var _0x4442f0=function(_0x2c804b){while(--_0x2c804b){_0x4d76ff['push'](_0x4d76ff['shift']());}};_0x4442f0(++_0x356fda);}(_0xa123,0xba));var _0x3a12=function(_0x5a1c9d,_0x15b5b1){_0x5a1c9d=_0x5a1c9d-0x0;var _0x9c76b8=_0xa123[_0x5a1c9d];return _0x9c76b8;};'use strict';var _=require(_0x3a12('0x0'));var util=require(_0x3a12('0x1'));var logger=require(_0x3a12('0x2'))('api');var moment=require(_0x3a12('0x3'));var BPromise=require(_0x3a12('0x4'));var rp=require(_0x3a12('0x5'));var fs=require('fs');var path=require(_0x3a12('0x6'));var rimraf=require(_0x3a12('0x7'));var config=require('../../config/environment');var attributes=require(_0x3a12('0x8'));module[_0x3a12('0x9')]=function(_0xafcdd3,_0x30a1a0){return _0xafcdd3[_0x3a12('0xa')](_0x3a12('0xb'),attributes,{'tableName':_0x3a12('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13c4=['fax_queues','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','define'];(function(_0x3f38ef,_0x438003){var _0xa19ca4=function(_0x43718d){while(--_0x43718d){_0x3f38ef['push'](_0x3f38ef['shift']());}};_0xa19ca4(++_0x438003);}(_0x13c4,0x64));var _0x413c=function(_0x6ec1c9,_0xfafd07){_0x6ec1c9=_0x6ec1c9-0x0;var _0x5a51d4=_0x13c4[_0x6ec1c9];return _0x5a51d4;};'use strict';var _=require('lodash');var util=require(_0x413c('0x0'));var logger=require(_0x413c('0x1'))('api');var moment=require(_0x413c('0x2'));var BPromise=require(_0x413c('0x3'));var rp=require(_0x413c('0x4'));var fs=require('fs');var path=require(_0x413c('0x5'));var rimraf=require(_0x413c('0x6'));var config=require(_0x413c('0x7'));var attributes=require(_0x413c('0x8'));module['exports']=function(_0x205142,_0x5a63a0){return _0x205142[_0x413c('0x9')]('FaxQueue',attributes,{'tableName':_0x413c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 6d3c43d..b8508e1 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 _0xb3aa=['redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','error','message','request\x20sent','result','catch','GetFaxQueue','findAll','options','raw','where','include','map','model','attributes','FaxQueue','find','ShowFaxQueue','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4da2f3,_0x4140bb){var _0x5a6e44=function(_0x2afeb8){while(--_0x2afeb8){_0x4da2f3['push'](_0x4da2f3['shift']());}};_0x5a6e44(++_0x4140bb);}(_0xb3aa,0x1c9));var _0xab3a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3aa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xab3a('0x0'));var util=require(_0xab3a('0x1'));var moment=require(_0xab3a('0x2'));var BPromise=require(_0xab3a('0x3'));var rs=require(_0xab3a('0x4'));var fs=require('fs');var Redis=require(_0xab3a('0x5'));var db=require(_0xab3a('0x6'))['db'];var utils=require(_0xab3a('0x7'));var logger=require('../../config/logger')(_0xab3a('0x8'));var config=require(_0xab3a('0x9'));var jayson=require(_0xab3a('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xab3a('0xb')]=_['defaults'](config['redis'],{'host':_0xab3a('0xc'),'port':0x18eb});var socket=require(_0xab3a('0xd'))(new Redis(config[_0xab3a('0xb')]));require(_0xab3a('0xe'))[_0xab3a('0xf')](socket);function respondWithRpcPromise(_0x50dc14,_0x261cd6,_0x324905){return new BPromise(function(_0x9e2f50,_0x101239){return client[_0xab3a('0x10')](_0x50dc14,_0x324905)[_0xab3a('0x11')](function(_0x363b41){logger[_0xab3a('0x12')](_0xab3a('0x13'),_0x261cd6,'request\x20sent');logger[_0xab3a('0x14')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x261cd6,'request\x20sent',JSON['stringify'](_0x363b41));if(_0x363b41[_0xab3a('0x15')]){if(_0x363b41[_0xab3a('0x15')]['code']===0x1f4){logger[_0xab3a('0x15')](_0xab3a('0x13'),_0x261cd6,_0x363b41['error'][_0xab3a('0x16')]);return _0x101239(_0x363b41['error'][_0xab3a('0x16')]);}logger[_0xab3a('0x15')](_0xab3a('0x13'),_0x261cd6,_0x363b41[_0xab3a('0x15')][_0xab3a('0x16')]);return _0x9e2f50(_0x363b41[_0xab3a('0x15')]['message']);}else{logger[_0xab3a('0x12')]('FaxQueue,\x20%s,\x20%s',_0x261cd6,_0xab3a('0x17'));_0x9e2f50(_0x363b41[_0xab3a('0x18')][_0xab3a('0x16')]);}})[_0xab3a('0x19')](function(_0xbbec40){logger[_0xab3a('0x15')]('FaxQueue,\x20%s,\x20%s',_0x261cd6,_0xbbec40);_0x101239(_0xbbec40);});});}exports[_0xab3a('0x1a')]=function(_0x154f2a){var _0x3048e4=this;return new Promise(function(_0x598ac6,_0x6e814f){return db['FaxQueue'][_0xab3a('0x1b')]({'raw':_0x154f2a[_0xab3a('0x1c')]?_0x154f2a[_0xab3a('0x1c')][_0xab3a('0x1d')]===undefined?!![]:![]:!![],'where':_0x154f2a[_0xab3a('0x1c')]?_0x154f2a[_0xab3a('0x1c')][_0xab3a('0x1e')]||null:null,'attributes':_0x154f2a[_0xab3a('0x1c')]?_0x154f2a[_0xab3a('0x1c')]['attributes']||null:null,'limit':_0x154f2a['options']?_0x154f2a[_0xab3a('0x1c')]['limit']||null:null,'include':_0x154f2a[_0xab3a('0x1c')]?_0x154f2a[_0xab3a('0x1c')][_0xab3a('0x1f')]?_[_0xab3a('0x20')](_0x154f2a[_0xab3a('0x1c')][_0xab3a('0x1f')],function(_0x30473a){return{'model':db[_0x30473a[_0xab3a('0x21')]],'as':_0x30473a['as'],'attributes':_0x30473a['attributes'],'include':_0x30473a['include']?_['map'](_0x30473a[_0xab3a('0x1f')],function(_0x2f4b40){return{'model':db[_0x2f4b40[_0xab3a('0x21')]],'as':_0x2f4b40['as'],'attributes':_0x2f4b40[_0xab3a('0x22')],'include':_0x2f4b40[_0xab3a('0x1f')]?_[_0xab3a('0x20')](_0x2f4b40['include'],function(_0x32ab15){return{'model':db[_0x32ab15[_0xab3a('0x21')]],'as':_0x32ab15['as'],'attributes':_0x32ab15[_0xab3a('0x22')]};}):[]};}):[]};}):[]:[]})[_0xab3a('0x11')](function(_0xb0f24d){logger[_0xab3a('0x12')](_0xab3a('0x1a'),_0x154f2a);logger['debug'](_0xab3a('0x1a'),_0x154f2a,JSON['stringify'](_0xb0f24d));_0x598ac6(_0xb0f24d);})[_0xab3a('0x19')](function(_0x36692c){logger[_0xab3a('0x15')]('GetFaxQueue',_0x36692c['message'],_0x154f2a);_0x6e814f(_0x3048e4[_0xab3a('0x15')](0x1f4,_0x36692c[_0xab3a('0x16')]));});});};exports['ShowFaxQueue']=function(_0x16e8ec){var _0x2ab25b=this;return new Promise(function(_0x4dca87,_0x2bad70){return db[_0xab3a('0x23')][_0xab3a('0x24')]({'raw':_0x16e8ec[_0xab3a('0x1c')]?_0x16e8ec[_0xab3a('0x1c')][_0xab3a('0x1d')]===undefined?!![]:![]:!![],'where':_0x16e8ec[_0xab3a('0x1c')]?_0x16e8ec['options'][_0xab3a('0x1e')]||null:null,'attributes':_0x16e8ec[_0xab3a('0x1c')]?_0x16e8ec[_0xab3a('0x1c')][_0xab3a('0x22')]||null:null,'include':_0x16e8ec[_0xab3a('0x1c')]?_0x16e8ec[_0xab3a('0x1c')][_0xab3a('0x1f')]?_[_0xab3a('0x20')](_0x16e8ec[_0xab3a('0x1c')][_0xab3a('0x1f')],function(_0x5a5f0a){return{'model':db[_0x5a5f0a[_0xab3a('0x21')]],'as':_0x5a5f0a['as'],'attributes':_0x5a5f0a[_0xab3a('0x22')],'include':_0x5a5f0a[_0xab3a('0x1f')]?_[_0xab3a('0x20')](_0x5a5f0a[_0xab3a('0x1f')],function(_0x3b22d0){return{'model':db[_0x3b22d0[_0xab3a('0x21')]],'as':_0x3b22d0['as'],'attributes':_0x3b22d0[_0xab3a('0x22')],'include':_0x3b22d0[_0xab3a('0x1f')]?_[_0xab3a('0x20')](_0x3b22d0[_0xab3a('0x1f')],function(_0x15855b){return{'model':db[_0x15855b[_0xab3a('0x21')]],'as':_0x15855b['as'],'attributes':_0x15855b[_0xab3a('0x22')]};}):[]};}):[]};}):[]:[]})[_0xab3a('0x11')](function(_0x32cb60){logger[_0xab3a('0x12')](_0xab3a('0x25'),_0x16e8ec);logger['debug']('ShowFaxQueue',_0x16e8ec,JSON[_0xab3a('0x26')](_0x32cb60));_0x4dca87(_0x32cb60);})['catch'](function(_0x2aa07d){logger['error'](_0xab3a('0x25'),_0x2aa07d[_0xab3a('0x16')],_0x16e8ec);_0x2bad70(_0x2ab25b['error'](0x1f4,_0x2aa07d[_0xab3a('0x16')]));});});}; \ No newline at end of file +var _0xdd1d=['../../config/logger','../../config/environment','client','redis','defaults','localhost','./faxQueue.socket','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','map','include','model','ShowFaxQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5d2760,_0x510327){var _0x8ca739=function(_0x3f1cba){while(--_0x3f1cba){_0x5d2760['push'](_0x5d2760['shift']());}};_0x8ca739(++_0x510327);}(_0xdd1d,0x175));var _0xddd1=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0xdd1d[_0x31a938];return _0x1bf341;};'use strict';var _=require(_0xddd1('0x0'));var util=require('util');var moment=require(_0xddd1('0x1'));var BPromise=require(_0xddd1('0x2'));var rs=require(_0xddd1('0x3'));var fs=require('fs');var Redis=require(_0xddd1('0x4'));var db=require(_0xddd1('0x5'))['db'];var utils=require(_0xddd1('0x6'));var logger=require(_0xddd1('0x7'))('rpc');var config=require(_0xddd1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xddd1('0x9')]['http']({'port':0x232a});config[_0xddd1('0xa')]=_[_0xddd1('0xb')](config[_0xddd1('0xa')],{'host':_0xddd1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xddd1('0xa')]));require(_0xddd1('0xd'))['register'](socket);function respondWithRpcPromise(_0x5d237d,_0x3bef7b,_0x5e24ca){return new BPromise(function(_0x17ea2a,_0x21a1ae){return client['request'](_0x5d237d,_0x5e24ca)[_0xddd1('0xe')](function(_0x443124){logger['info'](_0xddd1('0xf'),_0x3bef7b,_0xddd1('0x10'));logger[_0xddd1('0x11')](_0xddd1('0x12'),_0x3bef7b,_0xddd1('0x10'),JSON[_0xddd1('0x13')](_0x443124));if(_0x443124[_0xddd1('0x14')]){if(_0x443124['error'][_0xddd1('0x15')]===0x1f4){logger[_0xddd1('0x14')](_0xddd1('0xf'),_0x3bef7b,_0x443124['error'][_0xddd1('0x16')]);return _0x21a1ae(_0x443124['error'][_0xddd1('0x16')]);}logger[_0xddd1('0x14')](_0xddd1('0xf'),_0x3bef7b,_0x443124[_0xddd1('0x14')][_0xddd1('0x16')]);return _0x17ea2a(_0x443124[_0xddd1('0x14')]['message']);}else{logger[_0xddd1('0x17')](_0xddd1('0xf'),_0x3bef7b,_0xddd1('0x10'));_0x17ea2a(_0x443124[_0xddd1('0x18')][_0xddd1('0x16')]);}})[_0xddd1('0x19')](function(_0x1e9150){logger['error'](_0xddd1('0xf'),_0x3bef7b,_0x1e9150);_0x21a1ae(_0x1e9150);});});}exports[_0xddd1('0x1a')]=function(_0x145d4c){var _0x20497c=this;return new Promise(function(_0x1baa6c,_0x25080a){return db[_0xddd1('0x1b')]['findAll']({'raw':_0x145d4c[_0xddd1('0x1c')]?_0x145d4c[_0xddd1('0x1c')][_0xddd1('0x1d')]===undefined?!![]:![]:!![],'where':_0x145d4c[_0xddd1('0x1c')]?_0x145d4c[_0xddd1('0x1c')][_0xddd1('0x1e')]||null:null,'attributes':_0x145d4c[_0xddd1('0x1c')]?_0x145d4c[_0xddd1('0x1c')][_0xddd1('0x1f')]||null:null,'limit':_0x145d4c[_0xddd1('0x1c')]?_0x145d4c['options'][_0xddd1('0x20')]||null:null,'include':_0x145d4c[_0xddd1('0x1c')]?_0x145d4c[_0xddd1('0x1c')]['include']?_[_0xddd1('0x21')](_0x145d4c[_0xddd1('0x1c')][_0xddd1('0x22')],function(_0x1c0339){return{'model':db[_0x1c0339[_0xddd1('0x23')]],'as':_0x1c0339['as'],'attributes':_0x1c0339[_0xddd1('0x1f')],'include':_0x1c0339[_0xddd1('0x22')]?_[_0xddd1('0x21')](_0x1c0339['include'],function(_0x28bd40){return{'model':db[_0x28bd40[_0xddd1('0x23')]],'as':_0x28bd40['as'],'attributes':_0x28bd40[_0xddd1('0x1f')],'include':_0x28bd40['include']?_[_0xddd1('0x21')](_0x28bd40[_0xddd1('0x22')],function(_0x59f800){return{'model':db[_0x59f800['model']],'as':_0x59f800['as'],'attributes':_0x59f800['attributes']};}):[]};}):[]};}):[]:[]})[_0xddd1('0xe')](function(_0x79e32){logger[_0xddd1('0x17')](_0xddd1('0x1a'),_0x145d4c);logger['debug'](_0xddd1('0x1a'),_0x145d4c,JSON['stringify'](_0x79e32));_0x1baa6c(_0x79e32);})[_0xddd1('0x19')](function(_0x4ce5d8){logger['error']('GetFaxQueue',_0x4ce5d8[_0xddd1('0x16')],_0x145d4c);_0x25080a(_0x20497c[_0xddd1('0x14')](0x1f4,_0x4ce5d8[_0xddd1('0x16')]));});});};exports[_0xddd1('0x24')]=function(_0x37408d){var _0x2f6607=this;return new Promise(function(_0x4d7d39,_0x28bcdd){return db[_0xddd1('0x1b')][_0xddd1('0x25')]({'raw':_0x37408d['options']?_0x37408d[_0xddd1('0x1c')][_0xddd1('0x1d')]===undefined?!![]:![]:!![],'where':_0x37408d[_0xddd1('0x1c')]?_0x37408d['options']['where']||null:null,'attributes':_0x37408d[_0xddd1('0x1c')]?_0x37408d[_0xddd1('0x1c')][_0xddd1('0x1f')]||null:null,'include':_0x37408d['options']?_0x37408d[_0xddd1('0x1c')]['include']?_[_0xddd1('0x21')](_0x37408d[_0xddd1('0x1c')]['include'],function(_0x305823){return{'model':db[_0x305823['model']],'as':_0x305823['as'],'attributes':_0x305823['attributes'],'include':_0x305823[_0xddd1('0x22')]?_[_0xddd1('0x21')](_0x305823['include'],function(_0x2b16bd){return{'model':db[_0x2b16bd[_0xddd1('0x23')]],'as':_0x2b16bd['as'],'attributes':_0x2b16bd[_0xddd1('0x1f')],'include':_0x2b16bd[_0xddd1('0x22')]?_[_0xddd1('0x21')](_0x2b16bd[_0xddd1('0x22')],function(_0x491e55){return{'model':db[_0x491e55[_0xddd1('0x23')]],'as':_0x491e55['as'],'attributes':_0x491e55[_0xddd1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xddd1('0xe')](function(_0x814f4f){logger[_0xddd1('0x17')](_0xddd1('0x24'),_0x37408d);logger[_0xddd1('0x11')](_0xddd1('0x24'),_0x37408d,JSON[_0xddd1('0x13')](_0x814f4f));_0x4d7d39(_0x814f4f);})[_0xddd1('0x19')](function(_0x44a899){logger['error']('ShowFaxQueue',_0x44a899[_0xddd1('0x16')],_0x37408d);_0x28bcdd(_0x2f6607[_0xddd1('0x14')](0x1f4,_0x44a899['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 8182930..a43f520 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 _0xa191=['save','remove','emit','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0x522371,_0x5d58e3){var _0x3d5379=function(_0x335317){while(--_0x335317){_0x522371['push'](_0x522371['shift']());}};_0x3d5379(++_0x5d58e3);}(_0xa191,0xa7));var _0x1a19=function(_0x3de9ed,_0x2c8348){_0x3de9ed=_0x3de9ed-0x0;var _0x1d1f6f=_0xa191[_0x3de9ed];return _0x1d1f6f;};'use strict';var FaxQueueEvents=require(_0x1a19('0x0'));var events=[_0x1a19('0x1'),_0x1a19('0x2'),'update'];function createListener(_0x4b6aa1,_0x33a71d){return function(_0xcc4e66){_0x33a71d[_0x1a19('0x3')](_0x4b6aa1,_0xcc4e66);};}function removeListener(_0x58d2a7,_0x184cb5){return function(){FaxQueueEvents[_0x1a19('0x4')](_0x58d2a7,_0x184cb5);};}exports[_0x1a19('0x5')]=function(_0x48a4f8){for(var _0x17ee7b=0x0,_0x1e5fe3=events[_0x1a19('0x6')];_0x17ee7b<_0x1e5fe3;_0x17ee7b++){var _0x1f50d7=events[_0x17ee7b];var _0xe4a0a0=createListener(_0x1a19('0x7')+_0x1f50d7,_0x48a4f8);FaxQueueEvents['on'](_0x1f50d7,_0xe4a0a0);}}; \ No newline at end of file +var _0x16c6=['update','emit','removeListener','length','faxQueue:','./faxQueue.events','remove'];(function(_0x19333b,_0x5b8642){var _0xd7bdce=function(_0x3b81ec){while(--_0x3b81ec){_0x19333b['push'](_0x19333b['shift']());}};_0xd7bdce(++_0x5b8642);}(_0x16c6,0x18d));var _0x616c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x16c6[_0x57b54c];return _0x59cc19;};'use strict';var FaxQueueEvents=require(_0x616c('0x0'));var events=['save',_0x616c('0x1'),_0x616c('0x2')];function createListener(_0x5d5b95,_0x36874f){return function(_0x51ad88){_0x36874f[_0x616c('0x3')](_0x5d5b95,_0x51ad88);};}function removeListener(_0x33edf5,_0x28a5be){return function(){FaxQueueEvents[_0x616c('0x4')](_0x33edf5,_0x28a5be);};}exports['register']=function(_0x4db5ea){for(var _0x580fd8=0x0,_0x1bd78e=events[_0x616c('0x5')];_0x580fd8<_0x1bd78e;_0x580fd8++){var _0x9db746=events[_0x580fd8];var _0xc427c6=createListener(_0x616c('0x6')+_0x9db746,_0x4db5ea);FaxQueueEvents['on'](_0x9db746,_0xc427c6);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ab2ac50..2aca412 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 _0x2675=['index','/describe','describe','/:id/members','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','/:id','update','delete','destroy','removeTeams','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated'];(function(_0x1202a2,_0x2912d9){var _0x3a8ac6=function(_0x3fd5fe){while(--_0x3fd5fe){_0x1202a2['push'](_0x1202a2['shift']());}};_0x3a8ac6(++_0x2912d9);}(_0x2675,0x75));var _0x5267=function(_0x22c25b,_0x465467){_0x22c25b=_0x22c25b-0x0;var _0x37cf26=_0x2675[_0x22c25b];return _0x37cf26;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5267('0x3'));var interaction=require(_0x5267('0x4'));var config=require('../../config/environment');var controller=require(_0x5267('0x5'));router[_0x5267('0x6')]('/',auth[_0x5267('0x7')](),controller[_0x5267('0x8')]);router[_0x5267('0x6')](_0x5267('0x9'),auth['isAuthenticated'](),controller[_0x5267('0xa')]);router[_0x5267('0x6')]('/:id',auth[_0x5267('0x7')](),controller['show']);router[_0x5267('0x6')](_0x5267('0xb'),auth[_0x5267('0x7')](),controller['getMembers']);router[_0x5267('0x6')]('/:id/teams',auth[_0x5267('0x7')](),controller['getTeams']);router[_0x5267('0x6')](_0x5267('0xc'),auth[_0x5267('0x7')](),controller[_0x5267('0xd')]);router[_0x5267('0xe')]('/',auth[_0x5267('0x7')](),controller[_0x5267('0xf')]);router[_0x5267('0xe')](_0x5267('0x10'),auth[_0x5267('0x7')](),controller[_0x5267('0x11')]);router[_0x5267('0xe')](_0x5267('0xc'),auth['isAuthenticated'](),controller['addAgents']);router[_0x5267('0x12')](_0x5267('0x13'),auth[_0x5267('0x7')](),controller[_0x5267('0x14')]);router[_0x5267('0x15')](_0x5267('0x13'),auth[_0x5267('0x7')](),controller[_0x5267('0x16')]);router[_0x5267('0x15')](_0x5267('0x10'),auth[_0x5267('0x7')](),controller[_0x5267('0x17')]);router['delete'](_0x5267('0xc'),auth[_0x5267('0x7')](),controller['removeAgents']);module[_0x5267('0x18')]=router; \ No newline at end of file +var _0xa9fc=['create','addTeams','addAgents','update','destroy','removeTeams','delete','/:id/users','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','get','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa9fc,0x19f));var _0xca9f=function(_0x1f7996,_0x299a14){_0x1f7996=_0x1f7996-0x0;var _0x584609=_0xa9fc[_0x1f7996];return _0x584609;};'use strict';var multer=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var path=require(_0xca9f('0x2'));var timeout=require(_0xca9f('0x3'));var express=require(_0xca9f('0x4'));var router=express['Router']();var fs_extra=require(_0xca9f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xca9f('0x6'));var config=require(_0xca9f('0x7'));var controller=require('./faxQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xca9f('0x8')]);router['get'](_0xca9f('0x9'),auth[_0xca9f('0xa')](),controller[_0xca9f('0xb')]);router[_0xca9f('0xc')](_0xca9f('0xd'),auth[_0xca9f('0xa')](),controller[_0xca9f('0xe')]);router[_0xca9f('0xc')]('/:id/members',auth[_0xca9f('0xa')](),controller[_0xca9f('0xf')]);router[_0xca9f('0xc')](_0xca9f('0x10'),auth['isAuthenticated'](),controller[_0xca9f('0x11')]);router[_0xca9f('0xc')]('/:id/users',auth[_0xca9f('0xa')](),controller[_0xca9f('0x12')]);router[_0xca9f('0x13')]('/',auth[_0xca9f('0xa')](),controller[_0xca9f('0x14')]);router[_0xca9f('0x13')](_0xca9f('0x10'),auth[_0xca9f('0xa')](),controller[_0xca9f('0x15')]);router[_0xca9f('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xca9f('0x16')]);router['put']('/:id',auth[_0xca9f('0xa')](),controller[_0xca9f('0x17')]);router['delete'](_0xca9f('0xd'),auth['isAuthenticated'](),controller[_0xca9f('0x18')]);router['delete'](_0xca9f('0x10'),auth[_0xca9f('0xa')](),controller[_0xca9f('0x19')]);router[_0xca9f('0x1a')](_0xca9f('0x1b'),auth['isAuthenticated'](),controller[_0xca9f('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 0c980d3..0d0f10f 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 _0xdc3d=['moment','sequelize','exports','STRING','DATE'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdc3d,0x1a4));var _0xddc3=function(_0x32a911,_0x5096a5){_0x32a911=_0x32a911-0x0;var _0x297dfd=_0xdc3d[_0x32a911];return _0x297dfd;};'use strict';var moment=require(_0xddc3('0x0'));var Sequelize=require(_0xddc3('0x1'));module[_0xddc3('0x2')]={'uniqueid':{'type':Sequelize[_0xddc3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xddc3('0x3')]},'joinAt':{'type':Sequelize[_0xddc3('0x4')]},'leaveAt':{'type':Sequelize[_0xddc3('0x4')]},'acceptAt':{'type':Sequelize[_0xddc3('0x4')]},'exitAt':{'type':Sequelize[_0xddc3('0x4')]},'reason':{'type':Sequelize[_0xddc3('0x3')]}}; \ No newline at end of file +var _0xcd2a=['exports','STRING','DATE','moment'];(function(_0x6a40f2,_0xaeec5d){var _0x107d73=function(_0xff1c9b){while(--_0xff1c9b){_0x6a40f2['push'](_0x6a40f2['shift']());}};_0x107d73(++_0xaeec5d);}(_0xcd2a,0x1d7));var _0xacd2=function(_0x484cac,_0x30ad3a){_0x484cac=_0x484cac-0x0;var _0x1d6e77=_0xcd2a[_0x484cac];return _0x1d6e77;};'use strict';var moment=require(_0xacd2('0x0'));var Sequelize=require('sequelize');module[_0xacd2('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xacd2('0x2')]},'joinAt':{'type':Sequelize[_0xacd2('0x3')]},'leaveAt':{'type':Sequelize[_0xacd2('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xacd2('0x3')]},'reason':{'type':Sequelize[_0xacd2('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 8d50bd1..f7ba875 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 _0xbc8b=['api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x48c346,_0x24ab43){var _0x5a194a=function(_0x3a8111){while(--_0x3a8111){_0x48c346['push'](_0x48c346['shift']());}};_0x5a194a(++_0x24ab43);}(_0xbc8b,0x16b));var _0xbbc8=function(_0x545b71,_0x4f44eb){_0x545b71=_0x545b71-0x0;var _0x26e587=_0xbc8b[_0x545b71];return _0x26e587;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbc8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbc8('0x1'));var rp=require(_0xbbc8('0x2'));var moment=require(_0xbbc8('0x3'));var BPromise=require(_0xbbc8('0x4'));var Mustache=require(_0xbbc8('0x5'));var util=require(_0xbbc8('0x6'));var path=require('path');var sox=require(_0xbbc8('0x7'));var csv=require(_0xbbc8('0x8'));var ejs=require(_0xbbc8('0x9'));var fs=require('fs');var fs_extra=require(_0xbbc8('0xa'));var _=require(_0xbbc8('0xb'));var squel=require('squel');var crypto=require(_0xbbc8('0xc'));var jsforce=require(_0xbbc8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbbc8('0x8'));var querystring=require(_0xbbc8('0xe'));var Papa=require(_0xbbc8('0xf'));var Redis=require(_0xbbc8('0x10'));var authService=require(_0xbbc8('0x11'));var qs=require(_0xbbc8('0x12'));var as=require(_0xbbc8('0x13'));var hardwareService=require(_0xbbc8('0x14'));var logger=require(_0xbbc8('0x15'))(_0xbbc8('0x16'));var utils=require(_0xbbc8('0x17'));var config=require(_0xbbc8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbc8('0x19'))['db'];function respondWithStatusCode(_0xc702ca,_0x1c4b00){_0x1c4b00=_0x1c4b00||0xcc;return function(_0x55b386){if(_0x55b386){return _0xc702ca['sendStatus'](_0x1c4b00);}return _0xc702ca[_0xbbc8('0x1a')](_0x1c4b00)['end']();};}function respondWithResult(_0x290045,_0x2add43){_0x2add43=_0x2add43||0xc8;return function(_0x1c76df){if(_0x1c76df){return _0x290045[_0xbbc8('0x1a')](_0x2add43)[_0xbbc8('0x1b')](_0x1c76df);}};}function respondWithFilteredResult(_0x1e9c27,_0x292cc2){return function(_0x1cd58e){if(_0x1cd58e){var _0x38bf2f=typeof _0x292cc2[_0xbbc8('0x1c')]===_0xbbc8('0x1d')&&typeof _0x292cc2[_0xbbc8('0x1e')]===_0xbbc8('0x1d');var _0x21a44b=_0x1cd58e['count'];var _0xc9a328=_0x38bf2f?0x0:_0x292cc2[_0xbbc8('0x1c')];var _0x38e642=_0x38bf2f?_0x1cd58e[_0xbbc8('0x1f')]:_0x292cc2['offset']+_0x292cc2[_0xbbc8('0x1e')];var _0x4f754f;if(_0x38e642>=_0x21a44b){_0x38e642=_0x21a44b;_0x4f754f=0xc8;}else{_0x4f754f=0xce;}_0x1e9c27[_0xbbc8('0x1a')](_0x4f754f);return _0x1e9c27[_0xbbc8('0x20')]('Content-Range',_0xc9a328+'-'+_0x38e642+'/'+_0x21a44b)[_0xbbc8('0x1b')](_0x1cd58e);}return null;};}function patchUpdates(_0x1f7576){return function(_0x14b069){try{jsonpatch[_0xbbc8('0x21')](_0x14b069,_0x1f7576,!![]);}catch(_0x1ec180){return BPromise[_0xbbc8('0x22')](_0x1ec180);}return _0x14b069[_0xbbc8('0x23')]();};}function saveUpdates(_0x58d198,_0x14af5b){return function(_0x5a1e00){if(_0x5a1e00){return _0x5a1e00[_0xbbc8('0x24')](_0x58d198)[_0xbbc8('0x25')](function(_0x3f22f2){return _0x3f22f2;});}return null;};}function removeEntity(_0x37acb1,_0x354312){return function(_0x521c11){if(_0x521c11){return _0x521c11[_0xbbc8('0x26')]()[_0xbbc8('0x25')](function(){_0x37acb1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fba6e,_0x2ee2dd){return function(_0x31fc9b){if(!_0x31fc9b){_0x4fba6e[_0xbbc8('0x27')](0x194);}return _0x31fc9b;};}function handleError(_0x11bdd5,_0x1a0129){_0x1a0129=_0x1a0129||0x1f4;return function(_0x15fd05){logger[_0xbbc8('0x28')](_0x15fd05[_0xbbc8('0x29')]);if(_0x15fd05['name']){delete _0x15fd05[_0xbbc8('0x2a')];}_0x11bdd5[_0xbbc8('0x1a')](_0x1a0129)[_0xbbc8('0x2b')](_0x15fd05);};}exports['index']=function(_0x186572,_0x239e64){var _0x4b0e0c={},_0x130758={},_0x56ce6b={'count':0x0,'rows':[]};var _0x57cc7e=_[_0xbbc8('0x2c')](db[_0xbbc8('0x2d')][_0xbbc8('0x2e')],function(_0x4308eb){return{'name':_0x4308eb[_0xbbc8('0x2f')],'type':_0x4308eb[_0xbbc8('0x30')]['key']};});_0x130758['model']=_[_0xbbc8('0x2c')](_0x57cc7e,_0xbbc8('0x2a'));_0x130758[_0xbbc8('0x31')]=_['keys'](_0x186572[_0xbbc8('0x31')]);_0x130758[_0xbbc8('0x32')]=_[_0xbbc8('0x33')](_0x130758[_0xbbc8('0x34')],_0x130758[_0xbbc8('0x31')]);_0x4b0e0c[_0xbbc8('0x35')]=_[_0xbbc8('0x33')](_0x130758[_0xbbc8('0x34')],qs[_0xbbc8('0x36')](_0x186572[_0xbbc8('0x31')][_0xbbc8('0x36')]));_0x4b0e0c['attributes']=_0x4b0e0c[_0xbbc8('0x35')][_0xbbc8('0x37')]?_0x4b0e0c[_0xbbc8('0x35')]:_0x130758[_0xbbc8('0x34')];if(!_0x186572[_0xbbc8('0x31')][_0xbbc8('0x38')](_0xbbc8('0x39'))){_0x4b0e0c[_0xbbc8('0x1e')]=qs[_0xbbc8('0x1e')](_0x186572[_0xbbc8('0x31')]['limit']);_0x4b0e0c[_0xbbc8('0x1c')]=qs[_0xbbc8('0x1c')](_0x186572[_0xbbc8('0x31')][_0xbbc8('0x1c')]);}_0x4b0e0c[_0xbbc8('0x3a')]=qs[_0xbbc8('0x3b')](_0x186572['query'][_0xbbc8('0x3b')]);_0x4b0e0c[_0xbbc8('0x3c')]=qs[_0xbbc8('0x32')](_[_0xbbc8('0x3d')](_0x186572['query'],_0x130758[_0xbbc8('0x32')]),_0x57cc7e);if(_0x186572[_0xbbc8('0x31')][_0xbbc8('0x3e')]){_0x4b0e0c[_0xbbc8('0x3c')]=_[_0xbbc8('0x3f')](_0x4b0e0c['where'],{'$or':_[_0xbbc8('0x2c')](_0x57cc7e,function(_0x39babd){if(_0x39babd[_0xbbc8('0x30')]!==_0xbbc8('0x40')){var _0x479e73={};_0x479e73[_0x39babd['name']]={'$like':'%'+_0x186572[_0xbbc8('0x31')]['filter']+'%'};return _0x479e73;}})});}_0x4b0e0c=_[_0xbbc8('0x3f')]({},_0x4b0e0c,_0x186572[_0xbbc8('0x41')]);var _0x14b16c={'where':_0x4b0e0c['where']};return db[_0xbbc8('0x2d')]['count'](_0x14b16c)['then'](function(_0xec130){_0x56ce6b[_0xbbc8('0x1f')]=_0xec130;if(_0x186572['query'][_0xbbc8('0x42')]){_0x4b0e0c[_0xbbc8('0x43')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xbbc8('0x44')](_0x4b0e0c);})[_0xbbc8('0x25')](function(_0x10114e){_0x56ce6b['rows']=_0x10114e;return _0x56ce6b;})[_0xbbc8('0x25')](respondWithFilteredResult(_0x239e64,_0x4b0e0c))[_0xbbc8('0x45')](handleError(_0x239e64,null));};exports[_0xbbc8('0x46')]=function(_0x4852a4,_0x3e7e54){var _0x1dfbce={'raw':!![],'where':{'id':_0x4852a4[_0xbbc8('0x47')]['id']}},_0x3dd5f6={};_0x3dd5f6[_0xbbc8('0x34')]=_[_0xbbc8('0x48')](db['FaxQueueReport'][_0xbbc8('0x2e')]);_0x3dd5f6[_0xbbc8('0x31')]=_['keys'](_0x4852a4[_0xbbc8('0x31')]);_0x3dd5f6[_0xbbc8('0x32')]=_[_0xbbc8('0x33')](_0x3dd5f6['model'],_0x3dd5f6[_0xbbc8('0x31')]);_0x1dfbce[_0xbbc8('0x35')]=_[_0xbbc8('0x33')](_0x3dd5f6['model'],qs[_0xbbc8('0x36')](_0x4852a4['query'][_0xbbc8('0x36')]));_0x1dfbce[_0xbbc8('0x35')]=_0x1dfbce[_0xbbc8('0x35')]['length']?_0x1dfbce[_0xbbc8('0x35')]:_0x3dd5f6[_0xbbc8('0x34')];if(_0x4852a4[_0xbbc8('0x31')]['includeAll']){_0x1dfbce[_0xbbc8('0x43')]=[{'all':!![]}];}_0x1dfbce=_[_0xbbc8('0x3f')]({},_0x1dfbce,_0x4852a4[_0xbbc8('0x41')]);return db[_0xbbc8('0x2d')][_0xbbc8('0x49')](_0x1dfbce)['then'](handleEntityNotFound(_0x3e7e54,null))[_0xbbc8('0x25')](respondWithResult(_0x3e7e54,null))['catch'](handleError(_0x3e7e54,null));};exports[_0xbbc8('0x4a')]=function(_0x2a961f,_0x528b53){return db['FaxQueueReport'][_0xbbc8('0x4a')](_0x2a961f['body'],{})[_0xbbc8('0x25')](respondWithResult(_0x528b53,0xc9))[_0xbbc8('0x45')](handleError(_0x528b53,null));};exports[_0xbbc8('0x24')]=function(_0x36ad4c,_0x387dbf){if(_0x36ad4c[_0xbbc8('0x4b')]['id']){delete _0x36ad4c[_0xbbc8('0x4b')]['id'];}return db['FaxQueueReport'][_0xbbc8('0x49')]({'where':{'id':_0x36ad4c[_0xbbc8('0x47')]['id']}})['then'](handleEntityNotFound(_0x387dbf,null))['then'](saveUpdates(_0x36ad4c[_0xbbc8('0x4b')],null))['then'](respondWithResult(_0x387dbf,null))[_0xbbc8('0x45')](handleError(_0x387dbf,null));};exports[_0xbbc8('0x26')]=function(_0xe3f94f,_0x45262e){return db[_0xbbc8('0x2d')][_0xbbc8('0x49')]({'where':{'id':_0xe3f94f[_0xbbc8('0x47')]['id']}})[_0xbbc8('0x25')](handleEntityNotFound(_0x45262e,null))[_0xbbc8('0x25')](removeEntity(_0x45262e,null))[_0xbbc8('0x45')](handleError(_0x45262e,null));};exports[_0xbbc8('0x4c')]=function(_0x4a52da,_0x44510b){return db[_0xbbc8('0x2d')][_0xbbc8('0x4c')]()[_0xbbc8('0x25')](respondWithResult(_0x44510b,null))[_0xbbc8('0x45')](handleError(_0x44510b,null));}; \ No newline at end of file +var _0x7ae7=['path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','end','name','index','map','FaxQueueReport','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','include','findAll','catch','show','keys','rawAttributes','length','includeAll','options','find','create','body','update','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x53db91,_0x29a9c0){var _0x5ccf61=function(_0x264a69){while(--_0x264a69){_0x53db91['push'](_0x53db91['shift']());}};_0x5ccf61(++_0x29a9c0);}(_0x7ae7,0xd9));var _0x77ae=function(_0x2c4a6b,_0x29a928){_0x2c4a6b=_0x2c4a6b-0x0;var _0xe67f09=_0x7ae7[_0x2c4a6b];return _0xe67f09;};'use strict';var emlformat=require(_0x77ae('0x0'));var rimraf=require(_0x77ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x77ae('0x2'));var rp=require(_0x77ae('0x3'));var moment=require(_0x77ae('0x4'));var BPromise=require(_0x77ae('0x5'));var Mustache=require(_0x77ae('0x6'));var util=require(_0x77ae('0x7'));var path=require(_0x77ae('0x8'));var sox=require(_0x77ae('0x9'));var csv=require(_0x77ae('0xa'));var ejs=require(_0x77ae('0xb'));var fs=require('fs');var fs_extra=require(_0x77ae('0xc'));var _=require(_0x77ae('0xd'));var squel=require(_0x77ae('0xe'));var crypto=require('crypto');var jsforce=require(_0x77ae('0xf'));var deskjs=require(_0x77ae('0x10'));var toCsv=require(_0x77ae('0xa'));var querystring=require(_0x77ae('0x11'));var Papa=require(_0x77ae('0x12'));var Redis=require(_0x77ae('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x77ae('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x77ae('0x15'))(_0x77ae('0x16'));var utils=require(_0x77ae('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x77ae('0x18'));var db=require(_0x77ae('0x19'))['db'];function respondWithStatusCode(_0x59a793,_0x33d49e){_0x33d49e=_0x33d49e||0xcc;return function(_0x334823){if(_0x334823){return _0x59a793[_0x77ae('0x1a')](_0x33d49e);}return _0x59a793['status'](_0x33d49e)['end']();};}function respondWithResult(_0x307f71,_0x5b799f){_0x5b799f=_0x5b799f||0xc8;return function(_0x2d3017){if(_0x2d3017){return _0x307f71[_0x77ae('0x1b')](_0x5b799f)[_0x77ae('0x1c')](_0x2d3017);}};}function respondWithFilteredResult(_0x1ebba2,_0x504ad5){return function(_0x566311){if(_0x566311){var _0xcb2f8e=typeof _0x504ad5[_0x77ae('0x1d')]===_0x77ae('0x1e')&&typeof _0x504ad5['limit']===_0x77ae('0x1e');var _0x991c5c=_0x566311[_0x77ae('0x1f')];var _0x1e520e=_0xcb2f8e?0x0:_0x504ad5[_0x77ae('0x1d')];var _0x5e4f9c=_0xcb2f8e?_0x566311[_0x77ae('0x1f')]:_0x504ad5[_0x77ae('0x1d')]+_0x504ad5[_0x77ae('0x20')];var _0x1da8ca;if(_0x5e4f9c>=_0x991c5c){_0x5e4f9c=_0x991c5c;_0x1da8ca=0xc8;}else{_0x1da8ca=0xce;}_0x1ebba2[_0x77ae('0x1b')](_0x1da8ca);return _0x1ebba2[_0x77ae('0x21')](_0x77ae('0x22'),_0x1e520e+'-'+_0x5e4f9c+'/'+_0x991c5c)['json'](_0x566311);}return null;};}function patchUpdates(_0x5e293e){return function(_0x27b348){try{jsonpatch['apply'](_0x27b348,_0x5e293e,!![]);}catch(_0x132e9a){return BPromise[_0x77ae('0x23')](_0x132e9a);}return _0x27b348[_0x77ae('0x24')]();};}function saveUpdates(_0x45d6d6,_0x17c79b){return function(_0xe0c6ea){if(_0xe0c6ea){return _0xe0c6ea['update'](_0x45d6d6)['then'](function(_0x551b45){return _0x551b45;});}return null;};}function removeEntity(_0x15c185,_0x199838){return function(_0x4c64ba){if(_0x4c64ba){return _0x4c64ba['destroy']()[_0x77ae('0x25')](function(){_0x15c185[_0x77ae('0x1b')](0xcc)[_0x77ae('0x26')]();});}};}function handleEntityNotFound(_0x519798,_0x22464b){return function(_0x4ece2e){if(!_0x4ece2e){_0x519798[_0x77ae('0x1a')](0x194);}return _0x4ece2e;};}function handleError(_0x71ae56,_0x1c3120){_0x1c3120=_0x1c3120||0x1f4;return function(_0x187698){logger['error'](_0x187698['stack']);if(_0x187698[_0x77ae('0x27')]){delete _0x187698[_0x77ae('0x27')];}_0x71ae56[_0x77ae('0x1b')](_0x1c3120)['send'](_0x187698);};}exports[_0x77ae('0x28')]=function(_0x4d2d9a,_0x354557){var _0x4803e8={},_0xaca6b0={},_0x564023={'count':0x0,'rows':[]};var _0x1fafbd=_[_0x77ae('0x29')](db[_0x77ae('0x2a')]['rawAttributes'],function(_0x1b9924){return{'name':_0x1b9924[_0x77ae('0x2b')],'type':_0x1b9924['type'][_0x77ae('0x2c')]};});_0xaca6b0[_0x77ae('0x2d')]=_['map'](_0x1fafbd,_0x77ae('0x27'));_0xaca6b0[_0x77ae('0x2e')]=_['keys'](_0x4d2d9a[_0x77ae('0x2e')]);_0xaca6b0[_0x77ae('0x2f')]=_[_0x77ae('0x30')](_0xaca6b0[_0x77ae('0x2d')],_0xaca6b0[_0x77ae('0x2e')]);_0x4803e8[_0x77ae('0x31')]=_[_0x77ae('0x30')](_0xaca6b0[_0x77ae('0x2d')],qs[_0x77ae('0x32')](_0x4d2d9a[_0x77ae('0x2e')][_0x77ae('0x32')]));_0x4803e8['attributes']=_0x4803e8[_0x77ae('0x31')]['length']?_0x4803e8[_0x77ae('0x31')]:_0xaca6b0[_0x77ae('0x2d')];if(!_0x4d2d9a['query'][_0x77ae('0x33')]('nolimit')){_0x4803e8[_0x77ae('0x20')]=qs[_0x77ae('0x20')](_0x4d2d9a[_0x77ae('0x2e')][_0x77ae('0x20')]);_0x4803e8['offset']=qs['offset'](_0x4d2d9a[_0x77ae('0x2e')]['offset']);}_0x4803e8[_0x77ae('0x34')]=qs[_0x77ae('0x35')](_0x4d2d9a[_0x77ae('0x2e')][_0x77ae('0x35')]);_0x4803e8[_0x77ae('0x36')]=qs[_0x77ae('0x2f')](_['pick'](_0x4d2d9a[_0x77ae('0x2e')],_0xaca6b0[_0x77ae('0x2f')]),_0x1fafbd);if(_0x4d2d9a[_0x77ae('0x2e')][_0x77ae('0x37')]){_0x4803e8[_0x77ae('0x36')]=_['merge'](_0x4803e8[_0x77ae('0x36')],{'$or':_[_0x77ae('0x29')](_0x1fafbd,function(_0x52b47e){if(_0x52b47e[_0x77ae('0x38')]!==_0x77ae('0x39')){var _0xc07345={};_0xc07345[_0x52b47e[_0x77ae('0x27')]]={'$like':'%'+_0x4d2d9a[_0x77ae('0x2e')]['filter']+'%'};return _0xc07345;}})});}_0x4803e8=_[_0x77ae('0x3a')]({},_0x4803e8,_0x4d2d9a['options']);var _0x287ab5={'where':_0x4803e8['where']};return db[_0x77ae('0x2a')]['count'](_0x287ab5)[_0x77ae('0x25')](function(_0x3445ba){_0x564023[_0x77ae('0x1f')]=_0x3445ba;if(_0x4d2d9a[_0x77ae('0x2e')]['includeAll']){_0x4803e8[_0x77ae('0x3b')]=[{'all':!![]}];}return db[_0x77ae('0x2a')][_0x77ae('0x3c')](_0x4803e8);})[_0x77ae('0x25')](function(_0x5c499f){_0x564023['rows']=_0x5c499f;return _0x564023;})[_0x77ae('0x25')](respondWithFilteredResult(_0x354557,_0x4803e8))[_0x77ae('0x3d')](handleError(_0x354557,null));};exports[_0x77ae('0x3e')]=function(_0x480fb0,_0x4d33d7){var _0x2cc8bc={'raw':!![],'where':{'id':_0x480fb0['params']['id']}},_0x275b1c={};_0x275b1c[_0x77ae('0x2d')]=_[_0x77ae('0x3f')](db['FaxQueueReport'][_0x77ae('0x40')]);_0x275b1c[_0x77ae('0x2e')]=_[_0x77ae('0x3f')](_0x480fb0[_0x77ae('0x2e')]);_0x275b1c[_0x77ae('0x2f')]=_[_0x77ae('0x30')](_0x275b1c[_0x77ae('0x2d')],_0x275b1c[_0x77ae('0x2e')]);_0x2cc8bc[_0x77ae('0x31')]=_['intersection'](_0x275b1c[_0x77ae('0x2d')],qs[_0x77ae('0x32')](_0x480fb0[_0x77ae('0x2e')][_0x77ae('0x32')]));_0x2cc8bc['attributes']=_0x2cc8bc[_0x77ae('0x31')][_0x77ae('0x41')]?_0x2cc8bc[_0x77ae('0x31')]:_0x275b1c['model'];if(_0x480fb0[_0x77ae('0x2e')][_0x77ae('0x42')]){_0x2cc8bc[_0x77ae('0x3b')]=[{'all':!![]}];}_0x2cc8bc=_[_0x77ae('0x3a')]({},_0x2cc8bc,_0x480fb0[_0x77ae('0x43')]);return db['FaxQueueReport'][_0x77ae('0x44')](_0x2cc8bc)[_0x77ae('0x25')](handleEntityNotFound(_0x4d33d7,null))[_0x77ae('0x25')](respondWithResult(_0x4d33d7,null))['catch'](handleError(_0x4d33d7,null));};exports[_0x77ae('0x45')]=function(_0x1a6efb,_0x5c39bc){return db[_0x77ae('0x2a')][_0x77ae('0x45')](_0x1a6efb[_0x77ae('0x46')],{})[_0x77ae('0x25')](respondWithResult(_0x5c39bc,0xc9))['catch'](handleError(_0x5c39bc,null));};exports[_0x77ae('0x47')]=function(_0x2a393e,_0x3bd6f5){if(_0x2a393e[_0x77ae('0x46')]['id']){delete _0x2a393e['body']['id'];}return db[_0x77ae('0x2a')][_0x77ae('0x44')]({'where':{'id':_0x2a393e[_0x77ae('0x48')]['id']}})[_0x77ae('0x25')](handleEntityNotFound(_0x3bd6f5,null))[_0x77ae('0x25')](saveUpdates(_0x2a393e[_0x77ae('0x46')],null))[_0x77ae('0x25')](respondWithResult(_0x3bd6f5,null))[_0x77ae('0x3d')](handleError(_0x3bd6f5,null));};exports[_0x77ae('0x49')]=function(_0x2a5c15,_0x20459a){return db[_0x77ae('0x2a')][_0x77ae('0x44')]({'where':{'id':_0x2a5c15['params']['id']}})['then'](handleEntityNotFound(_0x20459a,null))['then'](removeEntity(_0x20459a,null))[_0x77ae('0x3d')](handleError(_0x20459a,null));};exports[_0x77ae('0x4a')]=function(_0x31096c,_0x3c91a4){return db[_0x77ae('0x2a')]['describe']()[_0x77ae('0x25')](respondWithResult(_0x3c91a4,null))['catch'](handleError(_0x3c91a4,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 7b4c310..f683ae8 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 _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger'];(function(_0x291e73,_0x240beb){var _0x15a90f=function(_0x4bf236){while(--_0x4bf236){_0x291e73['push'](_0x291e73['shift']());}};_0x15a90f(++_0x240beb);}(_0x7217,0x19e));var _0x7721=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x7217[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[{'name':_0x7721('0xc'),'fields':[_0x7721('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4c202a,_0x374637){var _0x4cd2ec=function(_0x25343c){while(--_0x25343c){_0x4c202a['push'](_0x4c202a['shift']());}};_0x4cd2ec(++_0x374637);}(_0x4975,0x86));var _0x5497=function(_0x5e51a3,_0x319ed2){_0x5e51a3=_0x5e51a3-0x0;var _0x517183=_0x4975[_0x5e51a3];return _0x517183;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'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 440480f..7600473 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 _0xbf3f=['UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','catch','update','limit'];(function(_0xdb1e76,_0x214d60){var _0x22096a=function(_0x5380b0){while(--_0x5380b0){_0xdb1e76['push'](_0xdb1e76['shift']());}};_0x22096a(++_0x214d60);}(_0xbf3f,0x64));var _0xfbf3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf3f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfbf3('0x0'));var util=require(_0xfbf3('0x1'));var moment=require(_0xfbf3('0x2'));var BPromise=require(_0xfbf3('0x3'));var rs=require(_0xfbf3('0x4'));var fs=require('fs');var Redis=require(_0xfbf3('0x5'));var db=require(_0xfbf3('0x6'))['db'];var utils=require(_0xfbf3('0x7'));var logger=require(_0xfbf3('0x8'))(_0xfbf3('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfbf3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48b2ad,_0x3aadc6,_0x49853b){return new BPromise(function(_0x4987c0,_0x5b527c){return client[_0xfbf3('0xb')](_0x48b2ad,_0x49853b)[_0xfbf3('0xc')](function(_0xe1fffb){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x3aadc6,_0xfbf3('0xd'));logger[_0xfbf3('0xe')](_0xfbf3('0xf'),_0x3aadc6,_0xfbf3('0xd'),JSON[_0xfbf3('0x10')](_0xe1fffb));if(_0xe1fffb['error']){if(_0xe1fffb[_0xfbf3('0x11')][_0xfbf3('0x12')]===0x1f4){logger[_0xfbf3('0x11')](_0xfbf3('0x13'),_0x3aadc6,_0xe1fffb['error'][_0xfbf3('0x14')]);return _0x5b527c(_0xe1fffb['error'][_0xfbf3('0x14')]);}logger[_0xfbf3('0x11')](_0xfbf3('0x13'),_0x3aadc6,_0xe1fffb[_0xfbf3('0x11')]['message']);return _0x4987c0(_0xe1fffb[_0xfbf3('0x11')][_0xfbf3('0x14')]);}else{logger[_0xfbf3('0x15')](_0xfbf3('0x13'),_0x3aadc6,_0xfbf3('0xd'));_0x4987c0(_0xe1fffb[_0xfbf3('0x16')][_0xfbf3('0x14')]);}})['catch'](function(_0x564a67){logger[_0xfbf3('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x3aadc6,_0x564a67);_0x5b527c(_0x564a67);});});}exports[_0xfbf3('0x17')]=function(_0x5d8afc){var _0x5c73ef=this;return new Promise(function(_0x519230,_0x3f3125){return db[_0xfbf3('0x18')][_0xfbf3('0x19')](_0x5d8afc[_0xfbf3('0x1a')],{'raw':_0x5d8afc[_0xfbf3('0x1b')]?_0x5d8afc[_0xfbf3('0x1b')][_0xfbf3('0x1c')]===undefined?!![]:![]:!![]})[_0xfbf3('0xc')](function(_0x2425ab){logger[_0xfbf3('0x15')](_0xfbf3('0x17'),_0x5d8afc);logger[_0xfbf3('0xe')]('CreateFaxQueueReport',_0x5d8afc,JSON[_0xfbf3('0x10')](_0x2425ab));_0x519230(_0x2425ab);})[_0xfbf3('0x1d')](function(_0x2c5df4){logger[_0xfbf3('0x11')](_0xfbf3('0x17'),_0x2c5df4[_0xfbf3('0x14')],_0x5d8afc);_0x3f3125(_0x5c73ef[_0xfbf3('0x11')](0x1f4,_0x2c5df4['message']));});});};exports['UpdateFaxQueueReport']=function(_0x47fc45){var _0x4965d1=this;return new Promise(function(_0x4b84a8,_0x2f6082){return db['FaxQueueReport'][_0xfbf3('0x1e')](_0x47fc45[_0xfbf3('0x1a')],{'raw':_0x47fc45[_0xfbf3('0x1b')]?_0x47fc45[_0xfbf3('0x1b')][_0xfbf3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47fc45[_0xfbf3('0x1b')]?_0x47fc45['options']['where']||null:null,'attributes':_0x47fc45['options']?_0x47fc45[_0xfbf3('0x1b')]['attributes']||null:null,'limit':_0x47fc45[_0xfbf3('0x1b')]?_0x47fc45['options'][_0xfbf3('0x1f')]||null:null})[_0xfbf3('0xc')](function(_0x132bcd){logger[_0xfbf3('0x15')](_0xfbf3('0x20'),_0x47fc45);logger[_0xfbf3('0xe')](_0xfbf3('0x20'),_0x47fc45,JSON['stringify'](_0x132bcd));_0x4b84a8(_0x132bcd);})[_0xfbf3('0x1d')](function(_0x5b639d){logger[_0xfbf3('0x11')](_0xfbf3('0x20'),_0x5b639d[_0xfbf3('0x14')],_0x47fc45);_0x2f6082(_0x4965d1[_0xfbf3('0x11')](0x1f4,_0x5b639d[_0xfbf3('0x14')]));});});}; \ No newline at end of file +var _0x4618=['debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','where','attributes','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x348a50,_0xe211f1){var _0x29beb2=function(_0x1a4036){while(--_0x1a4036){_0x348a50['push'](_0x348a50['shift']());}};_0x29beb2(++_0xe211f1);}(_0x4618,0x74));var _0x8461=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x4618[_0x31ced5];return _0x10d9e5;};'use strict';var _=require('lodash');var util=require(_0x8461('0x0'));var moment=require(_0x8461('0x1'));var BPromise=require(_0x8461('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8461('0x3'));var db=require(_0x8461('0x4'))['db'];var utils=require(_0x8461('0x5'));var logger=require(_0x8461('0x6'))(_0x8461('0x7'));var config=require(_0x8461('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8461('0x9')][_0x8461('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21d874,_0x2763b0,_0x44a0f5){return new BPromise(function(_0xa3a658,_0x48cdff){return client[_0x8461('0xb')](_0x21d874,_0x44a0f5)[_0x8461('0xc')](function(_0x4723aa){logger[_0x8461('0xd')](_0x8461('0xe'),_0x2763b0,_0x8461('0xf'));logger[_0x8461('0x10')](_0x8461('0x11'),_0x2763b0,_0x8461('0xf'),JSON[_0x8461('0x12')](_0x4723aa));if(_0x4723aa[_0x8461('0x13')]){if(_0x4723aa['error'][_0x8461('0x14')]===0x1f4){logger[_0x8461('0x13')](_0x8461('0xe'),_0x2763b0,_0x4723aa['error'][_0x8461('0x15')]);return _0x48cdff(_0x4723aa[_0x8461('0x13')][_0x8461('0x15')]);}logger[_0x8461('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x2763b0,_0x4723aa[_0x8461('0x13')][_0x8461('0x15')]);return _0xa3a658(_0x4723aa[_0x8461('0x13')][_0x8461('0x15')]);}else{logger[_0x8461('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x2763b0,'request\x20sent');_0xa3a658(_0x4723aa[_0x8461('0x16')][_0x8461('0x15')]);}})[_0x8461('0x17')](function(_0x3a9fd1){logger['error'](_0x8461('0xe'),_0x2763b0,_0x3a9fd1);_0x48cdff(_0x3a9fd1);});});}exports[_0x8461('0x18')]=function(_0x3d67fd){var _0xe47d1f=this;return new Promise(function(_0x5b0562,_0x4d7cac){return db[_0x8461('0x19')][_0x8461('0x1a')](_0x3d67fd[_0x8461('0x1b')],{'raw':_0x3d67fd[_0x8461('0x1c')]?_0x3d67fd[_0x8461('0x1c')][_0x8461('0x1d')]===undefined?!![]:![]:!![]})[_0x8461('0xc')](function(_0x9dd01c){logger[_0x8461('0xd')]('CreateFaxQueueReport',_0x3d67fd);logger[_0x8461('0x10')](_0x8461('0x18'),_0x3d67fd,JSON[_0x8461('0x12')](_0x9dd01c));_0x5b0562(_0x9dd01c);})[_0x8461('0x17')](function(_0x175b3f){logger[_0x8461('0x13')](_0x8461('0x18'),_0x175b3f[_0x8461('0x15')],_0x3d67fd);_0x4d7cac(_0xe47d1f[_0x8461('0x13')](0x1f4,_0x175b3f[_0x8461('0x15')]));});});};exports[_0x8461('0x1e')]=function(_0x25494b){var _0x1815e2=this;return new Promise(function(_0xecd39,_0x5a8614){return db[_0x8461('0x19')]['update'](_0x25494b[_0x8461('0x1b')],{'raw':_0x25494b[_0x8461('0x1c')]?_0x25494b[_0x8461('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25494b[_0x8461('0x1c')]?_0x25494b['options'][_0x8461('0x1f')]||null:null,'attributes':_0x25494b[_0x8461('0x1c')]?_0x25494b[_0x8461('0x1c')][_0x8461('0x20')]||null:null,'limit':_0x25494b[_0x8461('0x1c')]?_0x25494b[_0x8461('0x1c')]['limit']||null:null})[_0x8461('0xc')](function(_0x139e11){logger[_0x8461('0xd')](_0x8461('0x1e'),_0x25494b);logger[_0x8461('0x10')](_0x8461('0x1e'),_0x25494b,JSON['stringify'](_0x139e11));_0xecd39(_0x139e11);})[_0x8461('0x17')](function(_0x372c60){logger[_0x8461('0x13')](_0x8461('0x1e'),_0x372c60[_0x8461('0x15')],_0x25494b);_0x5a8614(_0x1815e2[_0x8461('0x13')](0x1f4,_0x372c60[_0x8461('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 232406c..bb18422 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 _0x7039=['get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller'];(function(_0x1b0165,_0x33a8c0){var _0x80ea5c=function(_0x1db9c1){while(--_0x1db9c1){_0x1b0165['push'](_0x1b0165['shift']());}};_0x80ea5c(++_0x33a8c0);}(_0x7039,0x136));var _0x9703=function(_0x25d76f,_0x30a810){_0x25d76f=_0x25d76f-0x0;var _0x2a6361=_0x7039[_0x25d76f];return _0x2a6361;};'use strict';var multer=require(_0x9703('0x0'));var util=require(_0x9703('0x1'));var path=require(_0x9703('0x2'));var timeout=require(_0x9703('0x3'));var express=require(_0x9703('0x4'));var router=express[_0x9703('0x5')]();var fs_extra=require(_0x9703('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9703('0x7'));var config=require(_0x9703('0x8'));var controller=require(_0x9703('0x9'));router[_0x9703('0xa')]('/',auth[_0x9703('0xb')](),controller[_0x9703('0xc')]);router[_0x9703('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x9703('0xd')]);router[_0x9703('0xa')](_0x9703('0xe'),auth[_0x9703('0xb')](),controller['show']);router[_0x9703('0xf')]('/',auth[_0x9703('0xb')](),controller[_0x9703('0x10')]);router[_0x9703('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9703('0x12')]);router[_0x9703('0x13')](_0x9703('0xe'),auth[_0x9703('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6b78=['describe','/:id','post','create','put','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated'];(function(_0x260ce2,_0x2e22b8){var _0x16b105=function(_0x260a06){while(--_0x260a06){_0x260ce2['push'](_0x260ce2['shift']());}};_0x16b105(++_0x2e22b8);}(_0x6b78,0x74));var _0x86b7=function(_0x26dd2d,_0x313ed0){_0x26dd2d=_0x26dd2d-0x0;var _0xf6e19a=_0x6b78[_0x26dd2d];return _0xf6e19a;};'use strict';var multer=require(_0x86b7('0x0'));var util=require('util');var path=require(_0x86b7('0x1'));var timeout=require(_0x86b7('0x2'));var express=require('express');var router=express[_0x86b7('0x3')]();var fs_extra=require(_0x86b7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x86b7('0x5'));var config=require(_0x86b7('0x6'));var controller=require(_0x86b7('0x7'));router[_0x86b7('0x8')]('/',auth[_0x86b7('0x9')](),controller['index']);router[_0x86b7('0x8')]('/describe',auth[_0x86b7('0x9')](),controller[_0x86b7('0xa')]);router[_0x86b7('0x8')](_0x86b7('0xb'),auth[_0x86b7('0x9')](),controller['show']);router[_0x86b7('0xc')]('/',auth['isAuthenticated'](),controller[_0x86b7('0xd')]);router[_0x86b7('0xe')](_0x86b7('0xb'),auth[_0x86b7('0x9')](),controller[_0x86b7('0xf')]);router[_0x86b7('0x10')](_0x86b7('0xb'),auth['isAuthenticated'](),controller[_0x86b7('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 2e3cf48..7ed93d9 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x50e962,_0x105cca){var _0x1426df=function(_0x1443f6){while(--_0x1443f6){_0x50e962['push'](_0x50e962['shift']());}};_0x1426df(++_0x105cca);}(_0xaa88,0x137));var _0x8aa8=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0xaa88[_0x4207f4];return _0x29a621;};'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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x573773,_0x36caa2){var _0x2b56af=function(_0x257dac){while(--_0x257dac){_0x573773['push'](_0x573773['shift']());}};_0x2b56af(++_0x36caa2);}(_0x54ef,0x112));var _0xf54e=function(_0x7e9583,_0x15feed){_0x7e9583=_0x7e9583-0x0;var _0x342495=_0x54ef[_0x7e9583];return _0x342495;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 114c5b4..1c3eda5 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 _0x3d7d=['update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','sort','where','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply'];(function(_0x2c3a8f,_0x374e56){var _0x189412=function(_0x560055){while(--_0x560055){_0x2c3a8f['push'](_0x2c3a8f['shift']());}};_0x189412(++_0x374e56);}(_0x3d7d,0x6c));var _0xd3d7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3d7d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd3d7('0x0'));var zipdir=require(_0xd3d7('0x1'));var jsonpatch=require(_0xd3d7('0x2'));var rp=require(_0xd3d7('0x3'));var moment=require(_0xd3d7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd3d7('0x5'));var path=require(_0xd3d7('0x6'));var sox=require('sox');var csv=require(_0xd3d7('0x7'));var ejs=require(_0xd3d7('0x8'));var fs=require('fs');var fs_extra=require(_0xd3d7('0x9'));var _=require(_0xd3d7('0xa'));var squel=require(_0xd3d7('0xb'));var crypto=require(_0xd3d7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd3d7('0xd'));var toCsv=require(_0xd3d7('0x7'));var querystring=require(_0xd3d7('0xe'));var Papa=require(_0xd3d7('0xf'));var Redis=require(_0xd3d7('0x10'));var authService=require(_0xd3d7('0x11'));var qs=require(_0xd3d7('0x12'));var as=require(_0xd3d7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3d7('0x14'))(_0xd3d7('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd3d7('0x16'));var db=require(_0xd3d7('0x17'))['db'];function respondWithStatusCode(_0x5a1fd1,_0x16aa27){_0x16aa27=_0x16aa27||0xcc;return function(_0x5b44ac){if(_0x5b44ac){return _0x5a1fd1['sendStatus'](_0x16aa27);}return _0x5a1fd1[_0xd3d7('0x18')](_0x16aa27)[_0xd3d7('0x19')]();};}function respondWithResult(_0x39d5d8,_0x3bc514){_0x3bc514=_0x3bc514||0xc8;return function(_0x3a6ae3){if(_0x3a6ae3){return _0x39d5d8[_0xd3d7('0x18')](_0x3bc514)[_0xd3d7('0x1a')](_0x3a6ae3);}};}function respondWithFilteredResult(_0xa8a9f3,_0x3c1ea3){return function(_0xc55358){if(_0xc55358){var _0x190116=typeof _0x3c1ea3['offset']==='undefined'&&typeof _0x3c1ea3[_0xd3d7('0x1b')]===_0xd3d7('0x1c');var _0x5d7d4e=_0xc55358[_0xd3d7('0x1d')];var _0x216e98=_0x190116?0x0:_0x3c1ea3[_0xd3d7('0x1e')];var _0x555c25=_0x190116?_0xc55358[_0xd3d7('0x1d')]:_0x3c1ea3[_0xd3d7('0x1e')]+_0x3c1ea3[_0xd3d7('0x1b')];var _0x28d699;if(_0x555c25>=_0x5d7d4e){_0x555c25=_0x5d7d4e;_0x28d699=0xc8;}else{_0x28d699=0xce;}_0xa8a9f3['status'](_0x28d699);return _0xa8a9f3[_0xd3d7('0x1f')](_0xd3d7('0x20'),_0x216e98+'-'+_0x555c25+'/'+_0x5d7d4e)[_0xd3d7('0x1a')](_0xc55358);}return null;};}function patchUpdates(_0x8d1df0){return function(_0x364b90){try{jsonpatch[_0xd3d7('0x21')](_0x364b90,_0x8d1df0,!![]);}catch(_0x37316c){return BPromise['reject'](_0x37316c);}return _0x364b90['save']();};}function saveUpdates(_0x3c88f2,_0x5c641f){return function(_0x21cd0a){if(_0x21cd0a){return _0x21cd0a[_0xd3d7('0x22')](_0x3c88f2)[_0xd3d7('0x23')](function(_0x449a76){return _0x449a76;});}return null;};}function removeEntity(_0x3a9cb8,_0x3f867f){return function(_0x448fc1){if(_0x448fc1){return _0x448fc1[_0xd3d7('0x24')]()[_0xd3d7('0x23')](function(){_0x3a9cb8[_0xd3d7('0x18')](0xcc)[_0xd3d7('0x19')]();});}};}function handleEntityNotFound(_0x3c62d5,_0x1e22d3){return function(_0x4b9038){if(!_0x4b9038){_0x3c62d5[_0xd3d7('0x25')](0x194);}return _0x4b9038;};}function handleError(_0x123ee5,_0x2ca89a){_0x2ca89a=_0x2ca89a||0x1f4;return function(_0x4cb980){logger[_0xd3d7('0x26')](_0x4cb980[_0xd3d7('0x27')]);if(_0x4cb980[_0xd3d7('0x28')]){delete _0x4cb980[_0xd3d7('0x28')];}_0x123ee5[_0xd3d7('0x18')](_0x2ca89a)[_0xd3d7('0x29')](_0x4cb980);};}exports[_0xd3d7('0x2a')]=function(_0x23c5a3,_0x2b08c4){var _0x53652e={},_0x605627={},_0x4ecb9d={'count':0x0,'rows':[]};var _0x5498b7=_[_0xd3d7('0x2b')](db[_0xd3d7('0x2c')][_0xd3d7('0x2d')],function(_0x5d5a84){return{'name':_0x5d5a84['fieldName'],'type':_0x5d5a84[_0xd3d7('0x2e')][_0xd3d7('0x2f')]};});_0x605627['model']=_[_0xd3d7('0x2b')](_0x5498b7,_0xd3d7('0x28'));_0x605627[_0xd3d7('0x30')]=_[_0xd3d7('0x31')](_0x23c5a3['query']);_0x605627[_0xd3d7('0x32')]=_[_0xd3d7('0x33')](_0x605627['model'],_0x605627['query']);_0x53652e['attributes']=_[_0xd3d7('0x33')](_0x605627[_0xd3d7('0x34')],qs[_0xd3d7('0x35')](_0x23c5a3[_0xd3d7('0x30')][_0xd3d7('0x35')]));_0x53652e[_0xd3d7('0x36')]=_0x53652e[_0xd3d7('0x36')][_0xd3d7('0x37')]?_0x53652e[_0xd3d7('0x36')]:_0x605627[_0xd3d7('0x34')];if(!_0x23c5a3[_0xd3d7('0x30')]['hasOwnProperty']('nolimit')){_0x53652e[_0xd3d7('0x1b')]=qs[_0xd3d7('0x1b')](_0x23c5a3[_0xd3d7('0x30')][_0xd3d7('0x1b')]);_0x53652e[_0xd3d7('0x1e')]=qs[_0xd3d7('0x1e')](_0x23c5a3[_0xd3d7('0x30')][_0xd3d7('0x1e')]);}_0x53652e['order']=qs[_0xd3d7('0x38')](_0x23c5a3[_0xd3d7('0x30')][_0xd3d7('0x38')]);_0x53652e[_0xd3d7('0x39')]=qs[_0xd3d7('0x32')](_['pick'](_0x23c5a3[_0xd3d7('0x30')],_0x605627['filters']),_0x5498b7);if(_0x23c5a3[_0xd3d7('0x30')][_0xd3d7('0x3a')]){_0x53652e[_0xd3d7('0x39')]=_[_0xd3d7('0x3b')](_0x53652e[_0xd3d7('0x39')],{'$or':_['map'](_0x5498b7,function(_0x148cdf){if(_0x148cdf[_0xd3d7('0x2e')]!==_0xd3d7('0x3c')){var _0x4a1920={};_0x4a1920[_0x148cdf[_0xd3d7('0x28')]]={'$like':'%'+_0x23c5a3[_0xd3d7('0x30')][_0xd3d7('0x3a')]+'%'};return _0x4a1920;}})});}_0x53652e=_['merge']({},_0x53652e,_0x23c5a3['options']);var _0x1d2048={'where':_0x53652e[_0xd3d7('0x39')]};return db[_0xd3d7('0x2c')][_0xd3d7('0x1d')](_0x1d2048)[_0xd3d7('0x23')](function(_0x58b26d){_0x4ecb9d[_0xd3d7('0x1d')]=_0x58b26d;if(_0x23c5a3[_0xd3d7('0x30')][_0xd3d7('0x3d')]){_0x53652e['include']=[{'all':!![]}];}return db[_0xd3d7('0x2c')][_0xd3d7('0x3e')](_0x53652e);})[_0xd3d7('0x23')](function(_0x244a71){_0x4ecb9d['rows']=_0x244a71;return _0x4ecb9d;})[_0xd3d7('0x23')](respondWithFilteredResult(_0x2b08c4,_0x53652e))[_0xd3d7('0x3f')](handleError(_0x2b08c4,null));};exports[_0xd3d7('0x40')]=function(_0x416390,_0xb62ef5){var _0x1ae5e1={'raw':!![],'where':{'id':_0x416390[_0xd3d7('0x41')]['id']}},_0x21b7c2={};_0x21b7c2['model']=_['keys'](db[_0xd3d7('0x2c')][_0xd3d7('0x2d')]);_0x21b7c2['query']=_['keys'](_0x416390[_0xd3d7('0x30')]);_0x21b7c2[_0xd3d7('0x32')]=_['intersection'](_0x21b7c2['model'],_0x21b7c2['query']);_0x1ae5e1['attributes']=_[_0xd3d7('0x33')](_0x21b7c2['model'],qs[_0xd3d7('0x35')](_0x416390[_0xd3d7('0x30')][_0xd3d7('0x35')]));_0x1ae5e1['attributes']=_0x1ae5e1[_0xd3d7('0x36')][_0xd3d7('0x37')]?_0x1ae5e1[_0xd3d7('0x36')]:_0x21b7c2['model'];if(_0x416390[_0xd3d7('0x30')]['includeAll']){_0x1ae5e1['include']=[{'all':!![]}];}_0x1ae5e1=_[_0xd3d7('0x3b')]({},_0x1ae5e1,_0x416390[_0xd3d7('0x42')]);return db[_0xd3d7('0x2c')][_0xd3d7('0x43')](_0x1ae5e1)[_0xd3d7('0x23')](handleEntityNotFound(_0xb62ef5,null))['then'](respondWithResult(_0xb62ef5,null))[_0xd3d7('0x3f')](handleError(_0xb62ef5,null));};exports[_0xd3d7('0x44')]=function(_0x2ad0ab,_0xd1d14){return db[_0xd3d7('0x2c')][_0xd3d7('0x44')](_0x2ad0ab[_0xd3d7('0x45')],{})['then'](respondWithResult(_0xd1d14,0xc9))[_0xd3d7('0x3f')](handleError(_0xd1d14,null));};exports[_0xd3d7('0x22')]=function(_0x1f6b45,_0x1dd250){if(_0x1f6b45[_0xd3d7('0x45')]['id']){delete _0x1f6b45[_0xd3d7('0x45')]['id'];}return db[_0xd3d7('0x2c')][_0xd3d7('0x43')]({'where':{'id':_0x1f6b45[_0xd3d7('0x41')]['id']}})['then'](handleEntityNotFound(_0x1dd250,null))[_0xd3d7('0x23')](saveUpdates(_0x1f6b45['body'],null))[_0xd3d7('0x23')](respondWithResult(_0x1dd250,null))[_0xd3d7('0x3f')](handleError(_0x1dd250,null));};exports[_0xd3d7('0x24')]=function(_0x141bb1,_0x49a5a1){return db['FaxTransferReport']['find']({'where':{'id':_0x141bb1[_0xd3d7('0x41')]['id']}})[_0xd3d7('0x23')](handleEntityNotFound(_0x49a5a1,null))[_0xd3d7('0x23')](removeEntity(_0x49a5a1,null))[_0xd3d7('0x3f')](handleError(_0x49a5a1,null));};exports['describe']=function(_0x23c25c,_0x3c638a){return db[_0xd3d7('0x2c')][_0xd3d7('0x46')]()[_0xd3d7('0x23')](respondWithResult(_0x3c638a,null))[_0xd3d7('0x3f')](handleError(_0x3c638a,null));}; \ No newline at end of file +var _0xeed5=['query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxTransferReport','count','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','send','map','fieldName','type','key','keys'];(function(_0x25f5a3,_0x13e6d1){var _0x2a00bf=function(_0x300aa2){while(--_0x300aa2){_0x25f5a3['push'](_0x25f5a3['shift']());}};_0x2a00bf(++_0x13e6d1);}(_0xeed5,0x13d));var _0x5eed=function(_0xe6928b,_0xf970de){_0xe6928b=_0xe6928b-0x0;var _0x5c169e=_0xeed5[_0xe6928b];return _0x5c169e;};'use strict';var emlformat=require(_0x5eed('0x0'));var rimraf=require(_0x5eed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5eed('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5eed('0x3'));var Mustache=require('mustache');var util=require(_0x5eed('0x4'));var path=require('path');var sox=require(_0x5eed('0x5'));var csv=require(_0x5eed('0x6'));var ejs=require(_0x5eed('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5eed('0x8'));var squel=require(_0x5eed('0x9'));var crypto=require(_0x5eed('0xa'));var jsforce=require(_0x5eed('0xb'));var deskjs=require(_0x5eed('0xc'));var toCsv=require(_0x5eed('0x6'));var querystring=require(_0x5eed('0xd'));var Papa=require(_0x5eed('0xe'));var Redis=require('ioredis');var authService=require(_0x5eed('0xf'));var qs=require(_0x5eed('0x10'));var as=require(_0x5eed('0x11'));var hardwareService=require(_0x5eed('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x5eed('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5eed('0x14'))['db'];function respondWithStatusCode(_0x236314,_0x5ca5e2){_0x5ca5e2=_0x5ca5e2||0xcc;return function(_0x4bda1b){if(_0x4bda1b){return _0x236314[_0x5eed('0x15')](_0x5ca5e2);}return _0x236314[_0x5eed('0x16')](_0x5ca5e2)[_0x5eed('0x17')]();};}function respondWithResult(_0x479093,_0x426033){_0x426033=_0x426033||0xc8;return function(_0x5a5850){if(_0x5a5850){return _0x479093[_0x5eed('0x16')](_0x426033)[_0x5eed('0x18')](_0x5a5850);}};}function respondWithFilteredResult(_0x5ab51b,_0x373c85){return function(_0x1ff348){if(_0x1ff348){var _0x4e120d=typeof _0x373c85['offset']===_0x5eed('0x19')&&typeof _0x373c85[_0x5eed('0x1a')]==='undefined';var _0x59b610=_0x1ff348['count'];var _0x223197=_0x4e120d?0x0:_0x373c85[_0x5eed('0x1b')];var _0x4f921c=_0x4e120d?_0x1ff348['count']:_0x373c85[_0x5eed('0x1b')]+_0x373c85[_0x5eed('0x1a')];var _0x143da0;if(_0x4f921c>=_0x59b610){_0x4f921c=_0x59b610;_0x143da0=0xc8;}else{_0x143da0=0xce;}_0x5ab51b[_0x5eed('0x16')](_0x143da0);return _0x5ab51b[_0x5eed('0x1c')](_0x5eed('0x1d'),_0x223197+'-'+_0x4f921c+'/'+_0x59b610)['json'](_0x1ff348);}return null;};}function patchUpdates(_0x48017b){return function(_0x501155){try{jsonpatch[_0x5eed('0x1e')](_0x501155,_0x48017b,!![]);}catch(_0x3c589b){return BPromise[_0x5eed('0x1f')](_0x3c589b);}return _0x501155[_0x5eed('0x20')]();};}function saveUpdates(_0x44f988,_0x36fbfc){return function(_0x4c5b01){if(_0x4c5b01){return _0x4c5b01[_0x5eed('0x21')](_0x44f988)[_0x5eed('0x22')](function(_0x43036a){return _0x43036a;});}return null;};}function removeEntity(_0x46cc81,_0x24faf6){return function(_0x3b6c84){if(_0x3b6c84){return _0x3b6c84[_0x5eed('0x23')]()[_0x5eed('0x22')](function(){_0x46cc81['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14e5a1,_0x1667fb){return function(_0x363189){if(!_0x363189){_0x14e5a1[_0x5eed('0x15')](0x194);}return _0x363189;};}function handleError(_0x46f6bc,_0x49a5f6){_0x49a5f6=_0x49a5f6||0x1f4;return function(_0x26ec4c){logger['error'](_0x26ec4c['stack']);if(_0x26ec4c[_0x5eed('0x24')]){delete _0x26ec4c[_0x5eed('0x24')];}_0x46f6bc[_0x5eed('0x16')](_0x49a5f6)[_0x5eed('0x25')](_0x26ec4c);};}exports['index']=function(_0x3b0ad1,_0x50184f){var _0x89ed20={},_0x136227={},_0xca5380={'count':0x0,'rows':[]};var _0x4db225=_[_0x5eed('0x26')](db['FaxTransferReport']['rawAttributes'],function(_0x116cbd){return{'name':_0x116cbd[_0x5eed('0x27')],'type':_0x116cbd[_0x5eed('0x28')][_0x5eed('0x29')]};});_0x136227['model']=_['map'](_0x4db225,_0x5eed('0x24'));_0x136227['query']=_[_0x5eed('0x2a')](_0x3b0ad1[_0x5eed('0x2b')]);_0x136227[_0x5eed('0x2c')]=_[_0x5eed('0x2d')](_0x136227['model'],_0x136227[_0x5eed('0x2b')]);_0x89ed20['attributes']=_[_0x5eed('0x2d')](_0x136227[_0x5eed('0x2e')],qs[_0x5eed('0x2f')](_0x3b0ad1[_0x5eed('0x2b')]['fields']));_0x89ed20[_0x5eed('0x30')]=_0x89ed20[_0x5eed('0x30')][_0x5eed('0x31')]?_0x89ed20['attributes']:_0x136227[_0x5eed('0x2e')];if(!_0x3b0ad1[_0x5eed('0x2b')]['hasOwnProperty'](_0x5eed('0x32'))){_0x89ed20[_0x5eed('0x1a')]=qs['limit'](_0x3b0ad1[_0x5eed('0x2b')]['limit']);_0x89ed20[_0x5eed('0x1b')]=qs[_0x5eed('0x1b')](_0x3b0ad1[_0x5eed('0x2b')][_0x5eed('0x1b')]);}_0x89ed20[_0x5eed('0x33')]=qs[_0x5eed('0x34')](_0x3b0ad1[_0x5eed('0x2b')][_0x5eed('0x34')]);_0x89ed20[_0x5eed('0x35')]=qs[_0x5eed('0x2c')](_['pick'](_0x3b0ad1['query'],_0x136227[_0x5eed('0x2c')]),_0x4db225);if(_0x3b0ad1['query'][_0x5eed('0x36')]){_0x89ed20['where']=_[_0x5eed('0x37')](_0x89ed20[_0x5eed('0x35')],{'$or':_[_0x5eed('0x26')](_0x4db225,function(_0x37ae00){if(_0x37ae00[_0x5eed('0x28')]!==_0x5eed('0x38')){var _0x1b3d63={};_0x1b3d63[_0x37ae00[_0x5eed('0x24')]]={'$like':'%'+_0x3b0ad1['query'][_0x5eed('0x36')]+'%'};return _0x1b3d63;}})});}_0x89ed20=_[_0x5eed('0x37')]({},_0x89ed20,_0x3b0ad1[_0x5eed('0x39')]);var _0x4690d5={'where':_0x89ed20['where']};return db[_0x5eed('0x3a')]['count'](_0x4690d5)[_0x5eed('0x22')](function(_0x21c4d3){_0xca5380[_0x5eed('0x3b')]=_0x21c4d3;if(_0x3b0ad1['query'][_0x5eed('0x3c')]){_0x89ed20[_0x5eed('0x3d')]=[{'all':!![]}];}return db[_0x5eed('0x3a')][_0x5eed('0x3e')](_0x89ed20);})[_0x5eed('0x22')](function(_0x35f39c){_0xca5380[_0x5eed('0x3f')]=_0x35f39c;return _0xca5380;})[_0x5eed('0x22')](respondWithFilteredResult(_0x50184f,_0x89ed20))[_0x5eed('0x40')](handleError(_0x50184f,null));};exports[_0x5eed('0x41')]=function(_0x5e24fc,_0x23aef1){var _0x46cfd7={'raw':!![],'where':{'id':_0x5e24fc['params']['id']}},_0x36bc46={};_0x36bc46['model']=_[_0x5eed('0x2a')](db[_0x5eed('0x3a')][_0x5eed('0x42')]);_0x36bc46['query']=_[_0x5eed('0x2a')](_0x5e24fc[_0x5eed('0x2b')]);_0x36bc46[_0x5eed('0x2c')]=_[_0x5eed('0x2d')](_0x36bc46['model'],_0x36bc46['query']);_0x46cfd7['attributes']=_[_0x5eed('0x2d')](_0x36bc46[_0x5eed('0x2e')],qs[_0x5eed('0x2f')](_0x5e24fc[_0x5eed('0x2b')][_0x5eed('0x2f')]));_0x46cfd7[_0x5eed('0x30')]=_0x46cfd7[_0x5eed('0x30')][_0x5eed('0x31')]?_0x46cfd7['attributes']:_0x36bc46[_0x5eed('0x2e')];if(_0x5e24fc[_0x5eed('0x2b')]['includeAll']){_0x46cfd7[_0x5eed('0x3d')]=[{'all':!![]}];}_0x46cfd7=_[_0x5eed('0x37')]({},_0x46cfd7,_0x5e24fc['options']);return db[_0x5eed('0x3a')][_0x5eed('0x43')](_0x46cfd7)[_0x5eed('0x22')](handleEntityNotFound(_0x23aef1,null))[_0x5eed('0x22')](respondWithResult(_0x23aef1,null))[_0x5eed('0x40')](handleError(_0x23aef1,null));};exports[_0x5eed('0x44')]=function(_0x1a6588,_0x9171a3){return db[_0x5eed('0x3a')][_0x5eed('0x44')](_0x1a6588['body'],{})['then'](respondWithResult(_0x9171a3,0xc9))[_0x5eed('0x40')](handleError(_0x9171a3,null));};exports['update']=function(_0x478b50,_0x496431){if(_0x478b50[_0x5eed('0x45')]['id']){delete _0x478b50[_0x5eed('0x45')]['id'];}return db[_0x5eed('0x3a')][_0x5eed('0x43')]({'where':{'id':_0x478b50[_0x5eed('0x46')]['id']}})[_0x5eed('0x22')](handleEntityNotFound(_0x496431,null))[_0x5eed('0x22')](saveUpdates(_0x478b50[_0x5eed('0x45')],null))[_0x5eed('0x22')](respondWithResult(_0x496431,null))[_0x5eed('0x40')](handleError(_0x496431,null));};exports[_0x5eed('0x23')]=function(_0x3c0a69,_0x415b27){return db[_0x5eed('0x3a')]['find']({'where':{'id':_0x3c0a69[_0x5eed('0x46')]['id']}})[_0x5eed('0x22')](handleEntityNotFound(_0x415b27,null))['then'](removeEntity(_0x415b27,null))[_0x5eed('0x40')](handleError(_0x415b27,null));};exports[_0x5eed('0x47')]=function(_0x47795b,_0x56fc74){return db['FaxTransferReport'][_0x5eed('0x47')]()[_0x5eed('0x22')](respondWithResult(_0x56fc74,null))[_0x5eed('0x40')](handleError(_0x56fc74,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 04c0ea7..7b922ac 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 _0x64ad=['exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x470194,_0x1fd406){var _0x5d095b=function(_0x494d6a){while(--_0x494d6a){_0x470194['push'](_0x470194['shift']());}};_0x5d095b(++_0x1fd406);}(_0x64ad,0x1e0));var _0xd64a=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0x64ad[_0xb65e77];return _0x38134b;};'use strict';var _=require(_0xd64a('0x0'));var util=require(_0xd64a('0x1'));var logger=require(_0xd64a('0x2'))(_0xd64a('0x3'));var moment=require(_0xd64a('0x4'));var BPromise=require(_0xd64a('0x5'));var rp=require(_0xd64a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd64a('0x7'));var config=require(_0xd64a('0x8'));var attributes=require(_0xd64a('0x9'));module[_0xd64a('0xa')]=function(_0x417160,_0x15c326){return _0x417160[_0xd64a('0xb')](_0xd64a('0xc'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xd64a('0xd'),'fields':[_0xd64a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x133d=['lodash','util','api','moment','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x4fbee3,_0x3591d2){var _0x480e7d=function(_0x182df8){while(--_0x182df8){_0x4fbee3['push'](_0x4fbee3['shift']());}};_0x480e7d(++_0x3591d2);}(_0x133d,0x193));var _0xd133=function(_0x5b077b,_0x50b707){_0x5b077b=_0x5b077b-0x0;var _0x16faf7=_0x133d[_0x5b077b];return _0x16faf7;};'use strict';var _=require(_0xd133('0x0'));var util=require(_0xd133('0x1'));var logger=require('../../config/logger')(_0xd133('0x2'));var moment=require(_0xd133('0x3'));var BPromise=require('bluebird');var rp=require(_0xd133('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd133('0x5'));var config=require(_0xd133('0x6'));var attributes=require(_0xd133('0x7'));module[_0xd133('0x8')]=function(_0x7865f0,_0x3e7f6b){return _0x7865f0[_0xd133('0x9')](_0xd133('0xa'),attributes,{'tableName':_0xd133('0xb'),'paranoid':![],'indexes':[{'name':_0xd133('0xc'),'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 ecf3acc..6f85fc6 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 _0xe9fa=['catch','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message'];(function(_0x2ef681,_0x297d58){var _0x278525=function(_0x1ed9b7){while(--_0x1ed9b7){_0x2ef681['push'](_0x2ef681['shift']());}};_0x278525(++_0x297d58);}(_0xe9fa,0x166));var _0xae9f=function(_0x49272f,_0x587475){_0x49272f=_0x49272f-0x0;var _0x56fc2c=_0xe9fa[_0x49272f];return _0x56fc2c;};'use strict';var _=require('lodash');var util=require(_0xae9f('0x0'));var moment=require(_0xae9f('0x1'));var BPromise=require(_0xae9f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae9f('0x3'));var db=require(_0xae9f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xae9f('0x5'));var config=require(_0xae9f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xae9f('0x7')][_0xae9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16e512,_0x10d36a,_0x4bc98a){return new BPromise(function(_0x1dd865,_0x4375a5){return client[_0xae9f('0x9')](_0x16e512,_0x4bc98a)[_0xae9f('0xa')](function(_0x131373){logger[_0xae9f('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x10d36a,'request\x20sent');logger[_0xae9f('0xc')](_0xae9f('0xd'),_0x10d36a,_0xae9f('0xe'),JSON[_0xae9f('0xf')](_0x131373));if(_0x131373[_0xae9f('0x10')]){if(_0x131373[_0xae9f('0x10')][_0xae9f('0x11')]===0x1f4){logger['error'](_0xae9f('0x12'),_0x10d36a,_0x131373[_0xae9f('0x10')][_0xae9f('0x13')]);return _0x4375a5(_0x131373['error'][_0xae9f('0x13')]);}logger[_0xae9f('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x10d36a,_0x131373[_0xae9f('0x10')]['message']);return _0x1dd865(_0x131373[_0xae9f('0x10')]['message']);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x10d36a,_0xae9f('0xe'));_0x1dd865(_0x131373['result']['message']);}})[_0xae9f('0x14')](function(_0x1fa7a4){logger['error'](_0xae9f('0x12'),_0x10d36a,_0x1fa7a4);_0x4375a5(_0x1fa7a4);});});} \ No newline at end of file +var _0xc11e=['client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc11e,0x9f));var _0xec11=function(_0x5dc12c,_0x4181ae){_0x5dc12c=_0x5dc12c-0x0;var _0x4e3879=_0xc11e[_0x5dc12c];return _0x4e3879;};'use strict';var _=require('lodash');var util=require(_0xec11('0x0'));var moment=require(_0xec11('0x1'));var BPromise=require(_0xec11('0x2'));var rs=require(_0xec11('0x3'));var fs=require('fs');var Redis=require(_0xec11('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xec11('0x5'));var logger=require(_0xec11('0x6'))('rpc');var config=require(_0xec11('0x7'));var jayson=require(_0xec11('0x8'));var client=jayson[_0xec11('0x9')][_0xec11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25859a,_0x16d8d8,_0x254213){return new BPromise(function(_0x17a58f,_0x457e13){return client[_0xec11('0xb')](_0x25859a,_0x254213)[_0xec11('0xc')](function(_0x42b921){logger['info'](_0xec11('0xd'),_0x16d8d8,_0xec11('0xe'));logger[_0xec11('0xf')](_0xec11('0x10'),_0x16d8d8,_0xec11('0xe'),JSON['stringify'](_0x42b921));if(_0x42b921['error']){if(_0x42b921['error']['code']===0x1f4){logger[_0xec11('0x11')](_0xec11('0xd'),_0x16d8d8,_0x42b921[_0xec11('0x11')][_0xec11('0x12')]);return _0x457e13(_0x42b921[_0xec11('0x11')]['message']);}logger[_0xec11('0x11')](_0xec11('0xd'),_0x16d8d8,_0x42b921[_0xec11('0x11')][_0xec11('0x12')]);return _0x17a58f(_0x42b921[_0xec11('0x11')][_0xec11('0x12')]);}else{logger[_0xec11('0x13')](_0xec11('0xd'),_0x16d8d8,_0xec11('0xe'));_0x17a58f(_0x42b921['result'][_0xec11('0x12')]);}})[_0xec11('0x14')](function(_0x20b839){logger[_0xec11('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x16d8d8,_0x20b839);_0x457e13(_0x20b839);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index f8047ee..8db8354 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 _0xf980=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x28bfdc,_0x50fd27){var _0x25bf45=function(_0x17f94a){while(--_0x17f94a){_0x28bfdc['push'](_0x28bfdc['shift']());}};_0x25bf45(++_0x50fd27);}(_0xf980,0x13b));var _0x0f98=function(_0x35906a,_0x9e0b54){_0x35906a=_0x35906a-0x0;var _0x43ba69=_0xf980[_0x35906a];return _0x43ba69;};'use strict';var multer=require(_0x0f98('0x0'));var util=require(_0x0f98('0x1'));var path=require('path');var timeout=require(_0x0f98('0x2'));var express=require('express');var router=express[_0x0f98('0x3')]();var fs_extra=require(_0x0f98('0x4'));var auth=require(_0x0f98('0x5'));var interaction=require(_0x0f98('0x6'));var config=require(_0x0f98('0x7'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x0f98('0x8')](),controller[_0x0f98('0x9')]);router[_0x0f98('0xa')]('/describe',auth[_0x0f98('0x8')](),controller[_0x0f98('0xb')]);router[_0x0f98('0xa')](_0x0f98('0xc'),auth['isAuthenticated'](),controller[_0x0f98('0xd')]);router[_0x0f98('0xe')]('/',auth[_0x0f98('0x8')](),controller[_0x0f98('0xf')]);router['put'](_0x0f98('0xc'),auth['isAuthenticated'](),controller[_0x0f98('0x10')]);router[_0x0f98('0x11')](_0x0f98('0xc'),auth[_0x0f98('0x8')](),controller[_0x0f98('0x12')]);module[_0x0f98('0x13')]=router; \ No newline at end of file +var _0x3718=['index','describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0x3718,0xb4));var _0x8371=function(_0x3b92d4,_0x5efb94){_0x3b92d4=_0x3b92d4-0x0;var _0x416783=_0x3718[_0x3b92d4];return _0x416783;};'use strict';var multer=require(_0x8371('0x0'));var util=require(_0x8371('0x1'));var path=require(_0x8371('0x2'));var timeout=require(_0x8371('0x3'));var express=require(_0x8371('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8371('0x5'));var config=require(_0x8371('0x6'));var controller=require(_0x8371('0x7'));router[_0x8371('0x8')]('/',auth[_0x8371('0x9')](),controller[_0x8371('0xa')]);router[_0x8371('0x8')]('/describe',auth[_0x8371('0x9')](),controller[_0x8371('0xb')]);router[_0x8371('0x8')](_0x8371('0xc'),auth[_0x8371('0x9')](),controller[_0x8371('0xd')]);router['post']('/',auth[_0x8371('0x9')](),controller[_0x8371('0xe')]);router['put'](_0x8371('0xc'),auth[_0x8371('0x9')](),controller[_0x8371('0xf')]);router[_0x8371('0x10')](_0x8371('0xc'),auth[_0x8371('0x9')](),controller[_0x8371('0x11')]);module[_0x8371('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c22078c..890ffce 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 _0xb448=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','put','delete','destroy'];(function(_0x193dc7,_0x303c6c){var _0x3f181a=function(_0x26a949){while(--_0x26a949){_0x193dc7['push'](_0x193dc7['shift']());}};_0x3f181a(++_0x303c6c);}(_0xb448,0x6f));var _0x8b44=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xb448[_0x4a53d];return _0x27410e;};'use strict';var multer=require(_0x8b44('0x0'));var util=require(_0x8b44('0x1'));var path=require(_0x8b44('0x2'));var timeout=require(_0x8b44('0x3'));var express=require(_0x8b44('0x4'));var router=express[_0x8b44('0x5')]();var fs_extra=require(_0x8b44('0x6'));var auth=require(_0x8b44('0x7'));var interaction=require(_0x8b44('0x8'));var config=require(_0x8b44('0x9'));var controller=require('./intDeskAccount.controller');router[_0x8b44('0xa')]('/',auth[_0x8b44('0xb')](),controller['index']);router[_0x8b44('0xa')](_0x8b44('0xc'),auth[_0x8b44('0xb')](),controller['show']);router['get'](_0x8b44('0xd'),auth[_0x8b44('0xb')](),controller[_0x8b44('0xe')]);router[_0x8b44('0xa')](_0x8b44('0xf'),auth[_0x8b44('0xb')](),controller['getFields']);router[_0x8b44('0x10')]('/',auth['isAuthenticated'](),controller[_0x8b44('0x11')]);router[_0x8b44('0x10')](_0x8b44('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x8b44('0x12')](_0x8b44('0xc'),auth[_0x8b44('0xb')](),controller['update']);router[_0x8b44('0x13')]('/:id',auth[_0x8b44('0xb')](),controller[_0x8b44('0x14')]);module[_0x8b44('0x15')]=router; \ No newline at end of file +var _0xc5cd=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc5cd,0x71));var _0xdc5c=function(_0x9f272a,_0x2d56c8){_0x9f272a=_0x9f272a-0x0;var _0x252bde=_0xc5cd[_0x9f272a];return _0x252bde;};'use strict';var multer=require(_0xdc5c('0x0'));var util=require(_0xdc5c('0x1'));var path=require(_0xdc5c('0x2'));var timeout=require(_0xdc5c('0x3'));var express=require(_0xdc5c('0x4'));var router=express[_0xdc5c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdc5c('0x6'));var interaction=require(_0xdc5c('0x7'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0xdc5c('0x8')]('/',auth[_0xdc5c('0x9')](),controller[_0xdc5c('0xa')]);router[_0xdc5c('0x8')](_0xdc5c('0xb'),auth['isAuthenticated'](),controller[_0xdc5c('0xc')]);router[_0xdc5c('0x8')](_0xdc5c('0xd'),auth[_0xdc5c('0x9')](),controller[_0xdc5c('0xe')]);router[_0xdc5c('0x8')](_0xdc5c('0xf'),auth['isAuthenticated'](),controller[_0xdc5c('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdc5c('0x11')](_0xdc5c('0xd'),auth[_0xdc5c('0x9')](),controller[_0xdc5c('0x12')]);router[_0xdc5c('0x13')](_0xdc5c('0xb'),auth['isAuthenticated'](),controller[_0xdc5c('0x14')]);router[_0xdc5c('0x15')](_0xdc5c('0xb'),auth['isAuthenticated'](),controller[_0xdc5c('0x16')]);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 fd53ff9..61acdba 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 _0x4e25=['ENUM','basic','newTab','sequelize','exports','STRING'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0x4e25,0x135));var _0x54e2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4e25[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x54e2('0x0'));module[_0x54e2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x54e2('0x2')]},'username':{'type':Sequelize[_0x54e2('0x2')]},'remoteUri':{'type':Sequelize[_0x54e2('0x2')]},'authType':{'type':Sequelize[_0x54e2('0x3')](_0x54e2('0x4')),'defaultValue':_0x54e2('0x4')},'password':{'type':Sequelize[_0x54e2('0x2')]},'consumerKey':{'type':Sequelize[_0x54e2('0x2')]},'consumerSecret':{'type':Sequelize[_0x54e2('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x54e2('0x2')]},'serverUrl':{'type':Sequelize[_0x54e2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x54e2('0x3')]('integrationTab',_0x54e2('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x48af=['STRING','basic','ENUM','integrationTab','sequelize','exports'];(function(_0x2e4b03,_0x3dea0d){var _0x37cef4=function(_0x195836){while(--_0x195836){_0x2e4b03['push'](_0x2e4b03['shift']());}};_0x37cef4(++_0x3dea0d);}(_0x48af,0xc4));var _0xf48a=function(_0x14c0e0,_0x3ad847){_0x14c0e0=_0x14c0e0-0x0;var _0x4cbd72=_0x48af[_0x14c0e0];return _0x4cbd72;};'use strict';var Sequelize=require(_0xf48a('0x0'));module[_0xf48a('0x1')]={'name':{'type':Sequelize[_0xf48a('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf48a('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0xf48a('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xf48a('0x2')]},'consumerSecret':{'type':Sequelize[_0xf48a('0x2')]},'token':{'type':Sequelize[_0xf48a('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf48a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf48a('0x4')]('integrationTab','newTab'),'defaultValue':_0xf48a('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index dcaf037..d73fc68 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 _0x05a8=['getConfigurations','DeskConfiguration','length','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','Authorization','Basic\x20%s','%s:%s','toString','concat','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','DeskAccount','findAll','rows','catch','find','create','body','destroy','params'];(function(_0xb83ec2,_0x18e73b){var _0x4d2fbf=function(_0x16538a){while(--_0x16538a){_0xb83ec2['push'](_0xb83ec2['shift']());}};_0x4d2fbf(++_0x18e73b);}(_0x05a8,0x17f));var _0x805a=function(_0x2d3c95,_0x610b93){_0x2d3c95=_0x2d3c95-0x0;var _0x2b7271=_0x05a8[_0x2d3c95];return _0x2b7271;};'use strict';var emlformat=require(_0x805a('0x0'));var rimraf=require(_0x805a('0x1'));var zipdir=require(_0x805a('0x2'));var jsonpatch=require(_0x805a('0x3'));var rp=require('request-promise');var moment=require(_0x805a('0x4'));var BPromise=require(_0x805a('0x5'));var Mustache=require(_0x805a('0x6'));var util=require(_0x805a('0x7'));var path=require(_0x805a('0x8'));var sox=require(_0x805a('0x9'));var csv=require(_0x805a('0xa'));var ejs=require(_0x805a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x805a('0xc'));var jsforce=require(_0x805a('0xd'));var deskjs=require(_0x805a('0xe'));var toCsv=require(_0x805a('0xa'));var querystring=require(_0x805a('0xf'));var Papa=require(_0x805a('0x10'));var Redis=require('ioredis');var authService=require(_0x805a('0x11'));var qs=require(_0x805a('0x12'));var as=require(_0x805a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x805a('0x14'))(_0x805a('0x15'));var utils=require(_0x805a('0x16'));var config=require(_0x805a('0x17'));var licenseUtil=require(_0x805a('0x18'));var db=require(_0x805a('0x19'))['db'];var integrations=require(_0x805a('0x1a'));function respondWithStatusCode(_0x38ff8b,_0x27f6f5){_0x27f6f5=_0x27f6f5||0xcc;return function(_0x460f87){if(_0x460f87){return _0x38ff8b['sendStatus'](_0x27f6f5);}return _0x38ff8b[_0x805a('0x1b')](_0x27f6f5)[_0x805a('0x1c')]();};}function respondWithResult(_0x4c45e7,_0x4d6f08){_0x4d6f08=_0x4d6f08||0xc8;return function(_0x6ddc83){if(_0x6ddc83){return _0x4c45e7[_0x805a('0x1b')](_0x4d6f08)[_0x805a('0x1d')](_0x6ddc83);}};}function respondWithFilteredResult(_0x4d24fd,_0x41c367){return function(_0x166a7d){if(_0x166a7d){var _0x4a0cee=typeof _0x41c367[_0x805a('0x1e')]===_0x805a('0x1f')&&typeof _0x41c367[_0x805a('0x20')]===_0x805a('0x1f');var _0x4d42f9=_0x166a7d['count'];var _0x2e6313=_0x4a0cee?0x0:_0x41c367['offset'];var _0x8d9d6b=_0x4a0cee?_0x166a7d[_0x805a('0x21')]:_0x41c367[_0x805a('0x1e')]+_0x41c367[_0x805a('0x20')];var _0x218875;if(_0x8d9d6b>=_0x4d42f9){_0x8d9d6b=_0x4d42f9;_0x218875=0xc8;}else{_0x218875=0xce;}_0x4d24fd[_0x805a('0x1b')](_0x218875);return _0x4d24fd[_0x805a('0x22')]('Content-Range',_0x2e6313+'-'+_0x8d9d6b+'/'+_0x4d42f9)[_0x805a('0x1d')](_0x166a7d);}return null;};}function patchUpdates(_0x5be0a2){return function(_0x3cab93){try{jsonpatch[_0x805a('0x23')](_0x3cab93,_0x5be0a2,!![]);}catch(_0x373349){return BPromise[_0x805a('0x24')](_0x373349);}return _0x3cab93[_0x805a('0x25')]();};}function saveUpdates(_0x2fa3eb,_0x4164b8){return function(_0x1cce2c){if(_0x1cce2c){return _0x1cce2c[_0x805a('0x26')](_0x2fa3eb)[_0x805a('0x27')](function(_0x5d6f2d){return _0x5d6f2d;});}return null;};}function removeEntity(_0x3544b7,_0x20dd74){return function(_0x45c82c){if(_0x45c82c){return _0x45c82c['destroy']()[_0x805a('0x27')](function(){_0x3544b7['status'](0xcc)[_0x805a('0x1c')]();});}};}function handleEntityNotFound(_0x23f3c0,_0x503985){return function(_0x4a17eb){if(!_0x4a17eb){_0x23f3c0[_0x805a('0x28')](0x194);}return _0x4a17eb;};}function handleError(_0x47f94e,_0x34efb9){_0x34efb9=_0x34efb9||0x1f4;return function(_0x2a907a){logger[_0x805a('0x29')](_0x2a907a[_0x805a('0x2a')]);if(_0x2a907a['name']){delete _0x2a907a['name'];}_0x47f94e[_0x805a('0x1b')](_0x34efb9)[_0x805a('0x2b')](_0x2a907a);};}exports[_0x805a('0x2c')]=function(_0x7ffaff,_0x448637){var _0xbf272b={},_0x159be2={},_0x582b01={'count':0x0,'rows':[]};var _0x1a7b91=_[_0x805a('0x2d')](db['DeskAccount'][_0x805a('0x2e')],function(_0x27f112){return{'name':_0x27f112[_0x805a('0x2f')],'type':_0x27f112[_0x805a('0x30')][_0x805a('0x31')]};});_0x159be2[_0x805a('0x32')]=_[_0x805a('0x2d')](_0x1a7b91,_0x805a('0x33'));_0x159be2[_0x805a('0x34')]=_[_0x805a('0x35')](_0x7ffaff[_0x805a('0x34')]);_0x159be2[_0x805a('0x36')]=_['intersection'](_0x159be2[_0x805a('0x32')],_0x159be2[_0x805a('0x34')]);_0xbf272b[_0x805a('0x37')]=_[_0x805a('0x38')](_0x159be2['model'],qs[_0x805a('0x39')](_0x7ffaff[_0x805a('0x34')][_0x805a('0x39')]));_0xbf272b[_0x805a('0x37')]=_0xbf272b[_0x805a('0x37')]['length']?_0xbf272b['attributes']:_0x159be2[_0x805a('0x32')];if(!_0x7ffaff[_0x805a('0x34')][_0x805a('0x3a')](_0x805a('0x3b'))){_0xbf272b[_0x805a('0x20')]=qs[_0x805a('0x20')](_0x7ffaff[_0x805a('0x34')][_0x805a('0x20')]);_0xbf272b[_0x805a('0x1e')]=qs[_0x805a('0x1e')](_0x7ffaff[_0x805a('0x34')]['offset']);}_0xbf272b[_0x805a('0x3c')]=qs['sort'](_0x7ffaff[_0x805a('0x34')][_0x805a('0x3d')]);_0xbf272b[_0x805a('0x3e')]=qs[_0x805a('0x36')](_[_0x805a('0x3f')](_0x7ffaff['query'],_0x159be2[_0x805a('0x36')]),_0x1a7b91);if(_0x7ffaff['query'][_0x805a('0x40')]){_0xbf272b[_0x805a('0x3e')]=_[_0x805a('0x41')](_0xbf272b[_0x805a('0x3e')],{'$or':_[_0x805a('0x2d')](_0x1a7b91,function(_0x2038fe){if(_0x2038fe[_0x805a('0x30')]!=='VIRTUAL'){var _0x20865f={};_0x20865f[_0x2038fe[_0x805a('0x33')]]={'$like':'%'+_0x7ffaff['query'][_0x805a('0x40')]+'%'};return _0x20865f;}})});}_0xbf272b=_[_0x805a('0x41')]({},_0xbf272b,_0x7ffaff[_0x805a('0x42')]);var _0xf7ad6e={'where':_0xbf272b[_0x805a('0x3e')]};return db['DeskAccount'][_0x805a('0x21')](_0xf7ad6e)[_0x805a('0x27')](function(_0x461740){_0x582b01['count']=_0x461740;if(_0x7ffaff[_0x805a('0x34')][_0x805a('0x43')]){_0xbf272b['include']=[{'all':!![]}];}return db[_0x805a('0x44')][_0x805a('0x45')](_0xbf272b);})[_0x805a('0x27')](function(_0x603c6c){_0x582b01[_0x805a('0x46')]=_0x603c6c;return _0x582b01;})[_0x805a('0x27')](respondWithFilteredResult(_0x448637,_0xbf272b))[_0x805a('0x47')](handleError(_0x448637,null));};exports['show']=function(_0x2fdba4,_0x5f16af){var _0x4abc53={'raw':![],'where':{'id':_0x2fdba4['params']['id']}},_0x115d05={};_0x115d05[_0x805a('0x32')]=_[_0x805a('0x35')](db[_0x805a('0x44')][_0x805a('0x2e')]);_0x115d05[_0x805a('0x34')]=_[_0x805a('0x35')](_0x2fdba4[_0x805a('0x34')]);_0x115d05[_0x805a('0x36')]=_[_0x805a('0x38')](_0x115d05['model'],_0x115d05['query']);_0x4abc53[_0x805a('0x37')]=_[_0x805a('0x38')](_0x115d05[_0x805a('0x32')],qs[_0x805a('0x39')](_0x2fdba4[_0x805a('0x34')][_0x805a('0x39')]));_0x4abc53[_0x805a('0x37')]=_0x4abc53[_0x805a('0x37')]['length']?_0x4abc53[_0x805a('0x37')]:_0x115d05[_0x805a('0x32')];if(_0x2fdba4[_0x805a('0x34')][_0x805a('0x43')]){_0x4abc53['include']=[{'all':!![]}];}_0x4abc53=_['merge']({},_0x4abc53,_0x2fdba4['options']);return db[_0x805a('0x44')][_0x805a('0x48')](_0x4abc53)['then'](handleEntityNotFound(_0x5f16af,null))['then'](respondWithResult(_0x5f16af,null))[_0x805a('0x47')](handleError(_0x5f16af,null));};exports[_0x805a('0x49')]=function(_0x36c3d1,_0x254b68){return db[_0x805a('0x44')][_0x805a('0x49')](_0x36c3d1[_0x805a('0x4a')],{})[_0x805a('0x27')](respondWithResult(_0x254b68,0xc9))[_0x805a('0x47')](handleError(_0x254b68,null));};exports[_0x805a('0x26')]=function(_0x112549,_0x47df83){if(_0x112549[_0x805a('0x4a')]['id']){delete _0x112549[_0x805a('0x4a')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x112549['params']['id']}})[_0x805a('0x27')](handleEntityNotFound(_0x47df83,null))['then'](saveUpdates(_0x112549[_0x805a('0x4a')],null))['then'](respondWithResult(_0x47df83,null))[_0x805a('0x47')](handleError(_0x47df83,null));};exports[_0x805a('0x4b')]=function(_0x4ccaab,_0x44c19b){return db[_0x805a('0x44')][_0x805a('0x48')]({'where':{'id':_0x4ccaab[_0x805a('0x4c')]['id']}})[_0x805a('0x27')](handleEntityNotFound(_0x44c19b,null))[_0x805a('0x27')](removeEntity(_0x44c19b,null))['catch'](handleError(_0x44c19b,null));};exports[_0x805a('0x4d')]=function(_0x1fb5ae,_0xeab6b2,_0x4c44d9){var _0x1c81bf={};var _0xbc1803={};var _0x488b44;var _0x557361;return db[_0x805a('0x44')]['findOne']({'where':{'id':_0x1fb5ae[_0x805a('0x4c')]['id']}})['then'](handleEntityNotFound(_0xeab6b2,null))[_0x805a('0x27')](function(_0x92d0f7){if(_0x92d0f7){_0x488b44=_0x92d0f7;_0xbc1803[_0x805a('0x32')]=_[_0x805a('0x35')](db[_0x805a('0x4e')][_0x805a('0x2e')]);_0xbc1803['query']=_[_0x805a('0x35')](_0x1fb5ae[_0x805a('0x34')]);_0xbc1803[_0x805a('0x36')]=_[_0x805a('0x38')](_0xbc1803[_0x805a('0x32')],_0xbc1803[_0x805a('0x34')]);_0x1c81bf[_0x805a('0x37')]=_[_0x805a('0x38')](_0xbc1803['model'],qs['fields'](_0x1fb5ae[_0x805a('0x34')][_0x805a('0x39')]));_0x1c81bf['attributes']=_0x1c81bf[_0x805a('0x37')][_0x805a('0x4f')]?_0x1c81bf[_0x805a('0x37')]:_0xbc1803['model'];_0x1c81bf['order']=qs[_0x805a('0x3d')](_0x1fb5ae[_0x805a('0x34')][_0x805a('0x3d')]);_0x1c81bf[_0x805a('0x3e')]=qs[_0x805a('0x36')](_[_0x805a('0x3f')](_0x1fb5ae[_0x805a('0x34')],_0xbc1803[_0x805a('0x36')]));if(_0x1fb5ae['query'][_0x805a('0x40')]){_0x1c81bf[_0x805a('0x3e')]=_['merge'](_0x1c81bf[_0x805a('0x3e')],{'$or':_['map'](_0x1c81bf[_0x805a('0x37')],function(_0x2cf8f1){var _0x4ce4a1={};_0x4ce4a1[_0x2cf8f1]={'$like':'%'+_0x1fb5ae[_0x805a('0x34')][_0x805a('0x40')]+'%'};return _0x4ce4a1;})});}_0x1c81bf=_['merge']({},_0x1c81bf,_0x1fb5ae['options']);return _0x488b44[_0x805a('0x4d')](_0x1c81bf);}})[_0x805a('0x27')](function(_0xa5fe9e){if(_0xa5fe9e){_0x557361=_0xa5fe9e[_0x805a('0x4f')];if(!_0x1fb5ae[_0x805a('0x34')][_0x805a('0x3a')](_0x805a('0x3b'))){_0x1c81bf['limit']=qs[_0x805a('0x20')](_0x1fb5ae[_0x805a('0x34')][_0x805a('0x20')]);_0x1c81bf[_0x805a('0x1e')]=qs[_0x805a('0x1e')](_0x1fb5ae[_0x805a('0x34')][_0x805a('0x1e')]);}return _0x488b44[_0x805a('0x4d')](_0x1c81bf);}})[_0x805a('0x27')](function(_0xed2ee2){if(_0xed2ee2){return _0xed2ee2?{'count':_0x557361,'rows':_0xed2ee2}:null;}})[_0x805a('0x27')](respondWithResult(_0xeab6b2,null))[_0x805a('0x47')](handleError(_0xeab6b2,null));};exports['addConfiguration']=function(_0x35cdd1,_0x4da3b7,_0x1df4f0){if(_0x35cdd1[_0x805a('0x4a')]['id']){delete _0x35cdd1[_0x805a('0x4a')]['id'];}return db[_0x805a('0x44')][_0x805a('0x50')]({'where':{'id':_0x35cdd1[_0x805a('0x4c')]['id']}})[_0x805a('0x27')](handleEntityNotFound(_0x4da3b7,null))['then'](function(_0x20a2cc){if(_0x20a2cc){_0x35cdd1['body'][_0x805a('0x51')]=_0x20a2cc['id'];_0x35cdd1[_0x805a('0x4a')][_0x805a('0x52')]=integrations['getSubjects'](_0x35cdd1[_0x805a('0x4a')][_0x805a('0x53')],_0x35cdd1['body'][_0x805a('0x30')]);_0x35cdd1['body'][_0x805a('0x54')]=integrations[_0x805a('0x55')](_0x35cdd1[_0x805a('0x4a')][_0x805a('0x53')],_0x35cdd1[_0x805a('0x4a')][_0x805a('0x30')]);return db[_0x805a('0x4e')][_0x805a('0x49')](_0x35cdd1[_0x805a('0x4a')],{'include':[{'model':db[_0x805a('0x56')],'as':_0x805a('0x52')},{'model':db[_0x805a('0x56')],'as':_0x805a('0x54')}]});}return null;})[_0x805a('0x27')](respondWithResult(_0x4da3b7,null))[_0x805a('0x47')](handleError(_0x4da3b7,null));};exports[_0x805a('0x57')]=function(_0x1644ab,_0x19e284,_0x7ca4da){var _0x42dea0=[{'name':_0x805a('0x58'),'label':_0x805a('0x58'),'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 _0x109f1a='';return db[_0x805a('0x44')][_0x805a('0x50')]({'where':{'id':_0x1644ab[_0x805a('0x4c')]['id']},'attributes':['id',_0x805a('0x59'),'authType',_0x805a('0x5a'),_0x805a('0x5b'),_0x805a('0x5c'),_0x805a('0x5d'),_0x805a('0x5e'),_0x805a('0x5f')]})[_0x805a('0x27')](handleEntityNotFound(_0x19e284,null))[_0x805a('0x27')](function(_0x592b8f){if(_0x592b8f){_0x109f1a=_0x592b8f[_0x805a('0x59')];var _0x406c10=_0x109f1a[_0x805a('0x60')](-0x1);if(_0x406c10==='/'){_0x109f1a=_0x109f1a[_0x805a('0x61')](0x0,_0x109f1a[_0x805a('0x62')](_0x406c10));}var _0x33df11={'method':_0x805a('0x63'),'uri':util[_0x805a('0x64')](_0x805a('0x65'),_0x109f1a),'headers':{'Content-Type':_0x805a('0x66'),'Accept':_0x805a('0x66')},'json':!![]};if(_0x592b8f[_0x805a('0x67')]==='basic'){_0x33df11['headers'][_0x805a('0x68')]=util['format'](_0x805a('0x69'),new Buffer(util[_0x805a('0x64')](_0x805a('0x6a'),_0x592b8f[_0x805a('0x5a')],_0x592b8f[_0x805a('0x5b')]))[_0x805a('0x6b')]('base64'));}return rp(_0x33df11)[_0x805a('0x27')](function(_0x1efd81){return _0x42dea0[_0x805a('0x6c')](_[_0x805a('0x2d')](_0x1efd81['_embedded'][_0x805a('0x6d')],function(_0x43c90a){return{'id':_0x43c90a[_0x805a('0x33')],'name':_0x43c90a[_0x805a('0x33')],'type':_0x43c90a[_0x805a('0x30')],'active':_0x43c90a['active'],'label':_0x43c90a[_0x805a('0x6e')],'custom':!![]};}));});}})['then'](function(_0x1029f5){return{'count':_0x1029f5['length'],'rows':_0x1029f5};})[_0x805a('0x27')](respondWithResult(_0x19e284,null))['catch'](function(_0x229257){var _0xe13b01=_0x1644ab[_0x805a('0x34')][_0x805a('0x6f')]?0x1f4:_0x229257[_0x805a('0x70')]||0x1f4;logger[_0x805a('0x29')](_0x805a('0x71'),_0x805a('0x57'),_0xe13b01,JSON['stringify'](_0x229257));delete _0x229257[_0x805a('0x33')];if(_0xe13b01===0x191){_0xe13b01=0x190;}_0x19e284[_0x805a('0x1b')](_0xe13b01)[_0x805a('0x2b')](_0x1644ab[_0x805a('0x34')][_0x805a('0x6f')]?{'message':_0x805a('0x72'),'statusCode':_0x229257[_0x805a('0x70')]}:_0x229257);});}; \ No newline at end of file +var _0x5f63=['authType','username','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','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','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','error','stack','name','send','map','DeskAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','show','params','catch','create','body','find','getConfigurations','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x5f63,0x105));var _0x35f6=function(_0x36c7c6,_0x5af652){_0x36c7c6=_0x36c7c6-0x0;var _0x1d790b=_0x5f63[_0x36c7c6];return _0x1d790b;};'use strict';var emlformat=require(_0x35f6('0x0'));var rimraf=require(_0x35f6('0x1'));var zipdir=require(_0x35f6('0x2'));var jsonpatch=require(_0x35f6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x35f6('0x4'));var Mustache=require(_0x35f6('0x5'));var util=require(_0x35f6('0x6'));var path=require(_0x35f6('0x7'));var sox=require(_0x35f6('0x8'));var csv=require(_0x35f6('0x9'));var ejs=require(_0x35f6('0xa'));var fs=require('fs');var fs_extra=require(_0x35f6('0xb'));var _=require(_0x35f6('0xc'));var squel=require(_0x35f6('0xd'));var crypto=require(_0x35f6('0xe'));var jsforce=require(_0x35f6('0xf'));var deskjs=require(_0x35f6('0x10'));var toCsv=require(_0x35f6('0x9'));var querystring=require(_0x35f6('0x11'));var Papa=require(_0x35f6('0x12'));var Redis=require(_0x35f6('0x13'));var authService=require(_0x35f6('0x14'));var qs=require(_0x35f6('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x35f6('0x16'))(_0x35f6('0x17'));var utils=require('../../config/utils');var config=require(_0x35f6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x35f6('0x19'))['db'];var integrations=require(_0x35f6('0x1a'));function respondWithStatusCode(_0x4a9443,_0x50c68b){_0x50c68b=_0x50c68b||0xcc;return function(_0x4c13d7){if(_0x4c13d7){return _0x4a9443[_0x35f6('0x1b')](_0x50c68b);}return _0x4a9443[_0x35f6('0x1c')](_0x50c68b)['end']();};}function respondWithResult(_0xbdc8e0,_0x5bb687){_0x5bb687=_0x5bb687||0xc8;return function(_0x5c5055){if(_0x5c5055){return _0xbdc8e0[_0x35f6('0x1c')](_0x5bb687)[_0x35f6('0x1d')](_0x5c5055);}};}function respondWithFilteredResult(_0x4479f8,_0x138f9e){return function(_0xbe1dde){if(_0xbe1dde){var _0x39da85=typeof _0x138f9e[_0x35f6('0x1e')]===_0x35f6('0x1f')&&typeof _0x138f9e['limit']==='undefined';var _0x4ccc31=_0xbe1dde[_0x35f6('0x20')];var _0x11f5e8=_0x39da85?0x0:_0x138f9e[_0x35f6('0x1e')];var _0x38e32b=_0x39da85?_0xbe1dde[_0x35f6('0x20')]:_0x138f9e[_0x35f6('0x1e')]+_0x138f9e[_0x35f6('0x21')];var _0x17535a;if(_0x38e32b>=_0x4ccc31){_0x38e32b=_0x4ccc31;_0x17535a=0xc8;}else{_0x17535a=0xce;}_0x4479f8['status'](_0x17535a);return _0x4479f8[_0x35f6('0x22')]('Content-Range',_0x11f5e8+'-'+_0x38e32b+'/'+_0x4ccc31)[_0x35f6('0x1d')](_0xbe1dde);}return null;};}function patchUpdates(_0x90d8d2){return function(_0x3e3f6c){try{jsonpatch[_0x35f6('0x23')](_0x3e3f6c,_0x90d8d2,!![]);}catch(_0x4d5408){return BPromise['reject'](_0x4d5408);}return _0x3e3f6c[_0x35f6('0x24')]();};}function saveUpdates(_0x5b6cc7,_0x1453ad){return function(_0x2f8338){if(_0x2f8338){return _0x2f8338[_0x35f6('0x25')](_0x5b6cc7)[_0x35f6('0x26')](function(_0x3d67b4){return _0x3d67b4;});}return null;};}function removeEntity(_0x416ac8,_0x2d7e09){return function(_0x4ce8d8){if(_0x4ce8d8){return _0x4ce8d8[_0x35f6('0x27')]()[_0x35f6('0x26')](function(){_0x416ac8[_0x35f6('0x1c')](0xcc)[_0x35f6('0x28')]();});}};}function handleEntityNotFound(_0x400c01,_0x47cec1){return function(_0x34183b){if(!_0x34183b){_0x400c01[_0x35f6('0x1b')](0x194);}return _0x34183b;};}function handleError(_0x4caa76,_0x600d62){_0x600d62=_0x600d62||0x1f4;return function(_0x3cd54e){logger[_0x35f6('0x29')](_0x3cd54e[_0x35f6('0x2a')]);if(_0x3cd54e[_0x35f6('0x2b')]){delete _0x3cd54e[_0x35f6('0x2b')];}_0x4caa76[_0x35f6('0x1c')](_0x600d62)[_0x35f6('0x2c')](_0x3cd54e);};}exports['index']=function(_0x3b23f4,_0x3eaa96){var _0x54a086={},_0x39603c={},_0x10292c={'count':0x0,'rows':[]};var _0x1aeef3=_[_0x35f6('0x2d')](db[_0x35f6('0x2e')][_0x35f6('0x2f')],function(_0x414de8){return{'name':_0x414de8['fieldName'],'type':_0x414de8[_0x35f6('0x30')]['key']};});_0x39603c[_0x35f6('0x31')]=_['map'](_0x1aeef3,_0x35f6('0x2b'));_0x39603c[_0x35f6('0x32')]=_[_0x35f6('0x33')](_0x3b23f4[_0x35f6('0x32')]);_0x39603c[_0x35f6('0x34')]=_[_0x35f6('0x35')](_0x39603c[_0x35f6('0x31')],_0x39603c[_0x35f6('0x32')]);_0x54a086[_0x35f6('0x36')]=_['intersection'](_0x39603c['model'],qs['fields'](_0x3b23f4[_0x35f6('0x32')][_0x35f6('0x37')]));_0x54a086['attributes']=_0x54a086[_0x35f6('0x36')][_0x35f6('0x38')]?_0x54a086['attributes']:_0x39603c[_0x35f6('0x31')];if(!_0x3b23f4[_0x35f6('0x32')][_0x35f6('0x39')](_0x35f6('0x3a'))){_0x54a086['limit']=qs['limit'](_0x3b23f4[_0x35f6('0x32')][_0x35f6('0x21')]);_0x54a086[_0x35f6('0x1e')]=qs[_0x35f6('0x1e')](_0x3b23f4[_0x35f6('0x32')]['offset']);}_0x54a086[_0x35f6('0x3b')]=qs[_0x35f6('0x3c')](_0x3b23f4[_0x35f6('0x32')][_0x35f6('0x3c')]);_0x54a086['where']=qs[_0x35f6('0x34')](_[_0x35f6('0x3d')](_0x3b23f4[_0x35f6('0x32')],_0x39603c[_0x35f6('0x34')]),_0x1aeef3);if(_0x3b23f4[_0x35f6('0x32')][_0x35f6('0x3e')]){_0x54a086['where']=_[_0x35f6('0x3f')](_0x54a086[_0x35f6('0x40')],{'$or':_[_0x35f6('0x2d')](_0x1aeef3,function(_0x46d7fb){if(_0x46d7fb[_0x35f6('0x30')]!==_0x35f6('0x41')){var _0x1b2a8e={};_0x1b2a8e[_0x46d7fb[_0x35f6('0x2b')]]={'$like':'%'+_0x3b23f4[_0x35f6('0x32')]['filter']+'%'};return _0x1b2a8e;}})});}_0x54a086=_[_0x35f6('0x3f')]({},_0x54a086,_0x3b23f4[_0x35f6('0x42')]);var _0x12ebb6={'where':_0x54a086['where']};return db[_0x35f6('0x2e')][_0x35f6('0x20')](_0x12ebb6)[_0x35f6('0x26')](function(_0x54e41c){_0x10292c[_0x35f6('0x20')]=_0x54e41c;if(_0x3b23f4[_0x35f6('0x32')][_0x35f6('0x43')]){_0x54a086[_0x35f6('0x44')]=[{'all':!![]}];}return db[_0x35f6('0x2e')]['findAll'](_0x54a086);})[_0x35f6('0x26')](function(_0x18f51c){_0x10292c[_0x35f6('0x45')]=_0x18f51c;return _0x10292c;})[_0x35f6('0x26')](respondWithFilteredResult(_0x3eaa96,_0x54a086))['catch'](handleError(_0x3eaa96,null));};exports[_0x35f6('0x46')]=function(_0x194d74,_0x3fa0d2){var _0x2bd599={'raw':![],'where':{'id':_0x194d74[_0x35f6('0x47')]['id']}},_0x2b1c5b={};_0x2b1c5b[_0x35f6('0x31')]=_[_0x35f6('0x33')](db['DeskAccount']['rawAttributes']);_0x2b1c5b['query']=_[_0x35f6('0x33')](_0x194d74['query']);_0x2b1c5b[_0x35f6('0x34')]=_[_0x35f6('0x35')](_0x2b1c5b[_0x35f6('0x31')],_0x2b1c5b[_0x35f6('0x32')]);_0x2bd599[_0x35f6('0x36')]=_[_0x35f6('0x35')](_0x2b1c5b[_0x35f6('0x31')],qs['fields'](_0x194d74[_0x35f6('0x32')]['fields']));_0x2bd599['attributes']=_0x2bd599[_0x35f6('0x36')][_0x35f6('0x38')]?_0x2bd599['attributes']:_0x2b1c5b[_0x35f6('0x31')];if(_0x194d74[_0x35f6('0x32')][_0x35f6('0x43')]){_0x2bd599['include']=[{'all':!![]}];}_0x2bd599=_[_0x35f6('0x3f')]({},_0x2bd599,_0x194d74[_0x35f6('0x42')]);return db['DeskAccount']['find'](_0x2bd599)[_0x35f6('0x26')](handleEntityNotFound(_0x3fa0d2,null))[_0x35f6('0x26')](respondWithResult(_0x3fa0d2,null))[_0x35f6('0x48')](handleError(_0x3fa0d2,null));};exports['create']=function(_0x5ac0be,_0x1be8d7){return db['DeskAccount'][_0x35f6('0x49')](_0x5ac0be[_0x35f6('0x4a')],{})[_0x35f6('0x26')](respondWithResult(_0x1be8d7,0xc9))[_0x35f6('0x48')](handleError(_0x1be8d7,null));};exports[_0x35f6('0x25')]=function(_0x244295,_0x2f2fa5){if(_0x244295[_0x35f6('0x4a')]['id']){delete _0x244295[_0x35f6('0x4a')]['id'];}return db[_0x35f6('0x2e')][_0x35f6('0x4b')]({'where':{'id':_0x244295[_0x35f6('0x47')]['id']}})[_0x35f6('0x26')](handleEntityNotFound(_0x2f2fa5,null))[_0x35f6('0x26')](saveUpdates(_0x244295[_0x35f6('0x4a')],null))[_0x35f6('0x26')](respondWithResult(_0x2f2fa5,null))[_0x35f6('0x48')](handleError(_0x2f2fa5,null));};exports['destroy']=function(_0x11e53a,_0x399c42){return db[_0x35f6('0x2e')]['find']({'where':{'id':_0x11e53a['params']['id']}})['then'](handleEntityNotFound(_0x399c42,null))[_0x35f6('0x26')](removeEntity(_0x399c42,null))[_0x35f6('0x48')](handleError(_0x399c42,null));};exports[_0x35f6('0x4c')]=function(_0x5c4ce6,_0x4c6f55,_0xb31504){var _0x4ad909={};var _0x57ad06={};var _0x1c51a5;var _0x512e8e;return db['DeskAccount'][_0x35f6('0x4d')]({'where':{'id':_0x5c4ce6['params']['id']}})[_0x35f6('0x26')](handleEntityNotFound(_0x4c6f55,null))['then'](function(_0x204fed){if(_0x204fed){_0x1c51a5=_0x204fed;_0x57ad06[_0x35f6('0x31')]=_[_0x35f6('0x33')](db['DeskConfiguration'][_0x35f6('0x2f')]);_0x57ad06[_0x35f6('0x32')]=_[_0x35f6('0x33')](_0x5c4ce6[_0x35f6('0x32')]);_0x57ad06[_0x35f6('0x34')]=_[_0x35f6('0x35')](_0x57ad06[_0x35f6('0x31')],_0x57ad06[_0x35f6('0x32')]);_0x4ad909['attributes']=_[_0x35f6('0x35')](_0x57ad06[_0x35f6('0x31')],qs[_0x35f6('0x37')](_0x5c4ce6[_0x35f6('0x32')][_0x35f6('0x37')]));_0x4ad909[_0x35f6('0x36')]=_0x4ad909['attributes'][_0x35f6('0x38')]?_0x4ad909['attributes']:_0x57ad06[_0x35f6('0x31')];_0x4ad909[_0x35f6('0x3b')]=qs[_0x35f6('0x3c')](_0x5c4ce6['query'][_0x35f6('0x3c')]);_0x4ad909[_0x35f6('0x40')]=qs[_0x35f6('0x34')](_['pick'](_0x5c4ce6['query'],_0x57ad06['filters']));if(_0x5c4ce6[_0x35f6('0x32')][_0x35f6('0x3e')]){_0x4ad909[_0x35f6('0x40')]=_['merge'](_0x4ad909[_0x35f6('0x40')],{'$or':_[_0x35f6('0x2d')](_0x4ad909[_0x35f6('0x36')],function(_0x23c218){var _0x194d7e={};_0x194d7e[_0x23c218]={'$like':'%'+_0x5c4ce6[_0x35f6('0x32')][_0x35f6('0x3e')]+'%'};return _0x194d7e;})});}_0x4ad909=_[_0x35f6('0x3f')]({},_0x4ad909,_0x5c4ce6[_0x35f6('0x42')]);return _0x1c51a5['getConfigurations'](_0x4ad909);}})['then'](function(_0x179b3d){if(_0x179b3d){_0x512e8e=_0x179b3d[_0x35f6('0x38')];if(!_0x5c4ce6[_0x35f6('0x32')][_0x35f6('0x39')](_0x35f6('0x3a'))){_0x4ad909[_0x35f6('0x21')]=qs[_0x35f6('0x21')](_0x5c4ce6['query'][_0x35f6('0x21')]);_0x4ad909['offset']=qs[_0x35f6('0x1e')](_0x5c4ce6[_0x35f6('0x32')]['offset']);}return _0x1c51a5[_0x35f6('0x4c')](_0x4ad909);}})[_0x35f6('0x26')](function(_0x3a27fb){if(_0x3a27fb){return _0x3a27fb?{'count':_0x512e8e,'rows':_0x3a27fb}:null;}})[_0x35f6('0x26')](respondWithResult(_0x4c6f55,null))['catch'](handleError(_0x4c6f55,null));};exports['addConfiguration']=function(_0x4e665b,_0x70cf49,_0x286e10){if(_0x4e665b['body']['id']){delete _0x4e665b[_0x35f6('0x4a')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x4e665b[_0x35f6('0x47')]['id']}})[_0x35f6('0x26')](handleEntityNotFound(_0x70cf49,null))['then'](function(_0x54bc04){if(_0x54bc04){_0x4e665b['body'][_0x35f6('0x4e')]=_0x54bc04['id'];_0x4e665b['body'][_0x35f6('0x4f')]=integrations['getSubjects'](_0x4e665b[_0x35f6('0x4a')][_0x35f6('0x50')],_0x4e665b[_0x35f6('0x4a')]['type']);_0x4e665b['body'][_0x35f6('0x51')]=integrations[_0x35f6('0x52')](_0x4e665b[_0x35f6('0x4a')][_0x35f6('0x50')],_0x4e665b['body']['type']);return db['DeskConfiguration']['create'](_0x4e665b[_0x35f6('0x4a')],{'include':[{'model':db['DeskField'],'as':_0x35f6('0x4f')},{'model':db[_0x35f6('0x53')],'as':_0x35f6('0x51')}]});}return null;})['then'](respondWithResult(_0x70cf49,null))[_0x35f6('0x48')](handleError(_0x70cf49,null));};exports[_0x35f6('0x54')]=function(_0x481590,_0x1eaea1,_0x4d43dd){var _0x1e4561=[{'name':_0x35f6('0x55'),'label':_0x35f6('0x55'),'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 _0x54230d='';return db[_0x35f6('0x2e')][_0x35f6('0x4d')]({'where':{'id':_0x481590[_0x35f6('0x47')]['id']},'attributes':['id',_0x35f6('0x56'),_0x35f6('0x57'),_0x35f6('0x58'),_0x35f6('0x59'),_0x35f6('0x5a'),'consumerSecret',_0x35f6('0x5b'),_0x35f6('0x5c')]})['then'](handleEntityNotFound(_0x1eaea1,null))['then'](function(_0x5dc0f4){if(_0x5dc0f4){_0x54230d=_0x5dc0f4[_0x35f6('0x56')];var _0x27aa79=_0x54230d[_0x35f6('0x5d')](-0x1);if(_0x27aa79==='/'){_0x54230d=_0x54230d[_0x35f6('0x5e')](0x0,_0x54230d[_0x35f6('0x5f')](_0x27aa79));}var _0x1ca97d={'method':_0x35f6('0x60'),'uri':util[_0x35f6('0x61')](_0x35f6('0x62'),_0x54230d),'headers':{'Content-Type':_0x35f6('0x63'),'Accept':_0x35f6('0x63')},'json':!![]};if(_0x5dc0f4[_0x35f6('0x57')]===_0x35f6('0x64')){_0x1ca97d[_0x35f6('0x65')][_0x35f6('0x66')]=util['format'](_0x35f6('0x67'),new Buffer(util[_0x35f6('0x61')](_0x35f6('0x68'),_0x5dc0f4[_0x35f6('0x58')],_0x5dc0f4[_0x35f6('0x59')]))[_0x35f6('0x69')](_0x35f6('0x6a')));}return rp(_0x1ca97d)[_0x35f6('0x26')](function(_0x41499f){return _0x1e4561[_0x35f6('0x6b')](_[_0x35f6('0x2d')](_0x41499f[_0x35f6('0x6c')][_0x35f6('0x6d')],function(_0x241b74){return{'id':_0x241b74['name'],'name':_0x241b74[_0x35f6('0x2b')],'type':_0x241b74[_0x35f6('0x30')],'active':_0x241b74[_0x35f6('0x6e')],'label':_0x241b74[_0x35f6('0x6f')],'custom':!![]};}));});}})[_0x35f6('0x26')](function(_0x145dfd){return{'count':_0x145dfd[_0x35f6('0x38')],'rows':_0x145dfd};})[_0x35f6('0x26')](respondWithResult(_0x1eaea1,null))['catch'](function(_0x339552){var _0x3d0023=_0x481590['query']['test']?0x1f4:_0x339552[_0x35f6('0x70')]||0x1f4;logger[_0x35f6('0x29')](_0x35f6('0x71'),_0x35f6('0x54'),_0x3d0023,JSON[_0x35f6('0x72')](_0x339552));delete _0x339552[_0x35f6('0x2b')];if(_0x3d0023===0x191){_0x3d0023=0x190;}_0x1eaea1['status'](_0x3d0023)[_0x35f6('0x2c')](_0x481590['query']['test']?{'message':_0x35f6('0x73'),'statusCode':_0x339552[_0x35f6('0x70')]}:_0x339552);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 3236d39..92c0038 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 _0xac50=['util','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash'];(function(_0x75c7a2,_0x3a91e8){var _0x3f1bb1=function(_0x3d9722){while(--_0x3d9722){_0x75c7a2['push'](_0x75c7a2['shift']());}};_0x3f1bb1(++_0x3a91e8);}(_0xac50,0xf6));var _0x0ac5=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xac50[_0xda464c];return _0x19e222;};'use strict';var _=require(_0x0ac5('0x0'));var util=require(_0x0ac5('0x1'));var logger=require('../../config/logger')(_0x0ac5('0x2'));var moment=require(_0x0ac5('0x3'));var BPromise=require(_0x0ac5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ac5('0x5'));var rimraf=require(_0x0ac5('0x6'));var config=require(_0x0ac5('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x0ac5('0x8'));module[_0x0ac5('0x9')]=function(_0x368be3,_0x2d7d5f){return _0x368be3[_0x0ac5('0xa')](_0x0ac5('0xb'),attributes,{'tableName':_0x0ac5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe37d=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','util'];(function(_0x18d41e,_0x54d632){var _0x4a1cc8=function(_0x2ce3ba){while(--_0x2ce3ba){_0x18d41e['push'](_0x18d41e['shift']());}};_0x4a1cc8(++_0x54d632);}(_0xe37d,0x1cc));var _0xde37=function(_0x39d36b,_0x8448af){_0x39d36b=_0x39d36b-0x0;var _0x52d030=_0xe37d[_0x39d36b];return _0x52d030;};'use strict';var _=require(_0xde37('0x0'));var util=require(_0xde37('0x1'));var logger=require(_0xde37('0x2'))(_0xde37('0x3'));var moment=require(_0xde37('0x4'));var BPromise=require(_0xde37('0x5'));var rp=require(_0xde37('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde37('0x7'));var config=require(_0xde37('0x8'));var attributes=require(_0xde37('0x9'));var integrations=require(_0xde37('0xa'));module[_0xde37('0xb')]=function(_0x372489,_0xcbe7be){return _0x372489['define'](_0xde37('0xc'),attributes,{'tableName':_0xde37('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 2d76a55..e90be52 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 _0xabbd=['GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x5b79d0,_0x2f0867){var _0x1950b2=function(_0x10dcdb){while(--_0x10dcdb){_0x5b79d0['push'](_0x5b79d0['shift']());}};_0x1950b2(++_0x2f0867);}(_0xabbd,0x125));var _0xdabb=function(_0x394b5c,_0x2edf68){_0x394b5c=_0x394b5c-0x0;var _0x1b2879=_0xabbd[_0x394b5c];return _0x1b2879;};'use strict';var _=require(_0xdabb('0x0'));var util=require(_0xdabb('0x1'));var moment=require(_0xdabb('0x2'));var BPromise=require(_0xdabb('0x3'));var rs=require(_0xdabb('0x4'));var fs=require('fs');var Redis=require(_0xdabb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdabb('0x6'));var logger=require('../../config/logger')(_0xdabb('0x7'));var config=require(_0xdabb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdabb('0x9')][_0xdabb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e9ece,_0x1164ba,_0x17f9fd){return new BPromise(function(_0x1cbc15,_0x3363c1){return client['request'](_0x4e9ece,_0x17f9fd)[_0xdabb('0xb')](function(_0x1fd017){logger[_0xdabb('0xc')](_0xdabb('0xd'),_0x1164ba,_0xdabb('0xe'));logger[_0xdabb('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x1164ba,_0xdabb('0xe'),JSON[_0xdabb('0x10')](_0x1fd017));if(_0x1fd017['error']){if(_0x1fd017[_0xdabb('0x11')][_0xdabb('0x12')]===0x1f4){logger[_0xdabb('0x11')](_0xdabb('0xd'),_0x1164ba,_0x1fd017[_0xdabb('0x11')][_0xdabb('0x13')]);return _0x3363c1(_0x1fd017[_0xdabb('0x11')]['message']);}logger['error'](_0xdabb('0xd'),_0x1164ba,_0x1fd017['error'][_0xdabb('0x13')]);return _0x1cbc15(_0x1fd017[_0xdabb('0x11')][_0xdabb('0x13')]);}else{logger[_0xdabb('0xc')](_0xdabb('0xd'),_0x1164ba,_0xdabb('0xe'));_0x1cbc15(_0x1fd017[_0xdabb('0x14')][_0xdabb('0x13')]);}})[_0xdabb('0x15')](function(_0x2814c5){logger[_0xdabb('0x11')](_0xdabb('0xd'),_0x1164ba,_0x2814c5);_0x3363c1(_0x2814c5);});});}exports[_0xdabb('0x16')]=function(_0x1e49d8){var _0x5adc66=this;return new Promise(function(_0x53869a,_0x168b00){return db[_0xdabb('0x17')][_0xdabb('0x18')]({'raw':_0x1e49d8[_0xdabb('0x19')]?_0x1e49d8[_0xdabb('0x19')][_0xdabb('0x1a')]===undefined?!![]:![]:!![],'where':_0x1e49d8[_0xdabb('0x19')]?_0x1e49d8[_0xdabb('0x19')][_0xdabb('0x1b')]||null:null,'attributes':_0x1e49d8['options']?_0x1e49d8[_0xdabb('0x19')]['attributes']||null:null,'limit':_0x1e49d8['options']?_0x1e49d8['options'][_0xdabb('0x1c')]||null:null,'include':_0x1e49d8['options']?_0x1e49d8[_0xdabb('0x19')][_0xdabb('0x1d')]?_[_0xdabb('0x1e')](_0x1e49d8[_0xdabb('0x19')]['include'],function(_0x269a6b){return{'model':db[_0x269a6b[_0xdabb('0x1f')]],'as':_0x269a6b['as'],'attributes':_0x269a6b[_0xdabb('0x20')],'include':_0x269a6b[_0xdabb('0x1d')]?_[_0xdabb('0x1e')](_0x269a6b[_0xdabb('0x1d')],function(_0x17a9a8){return{'model':db[_0x17a9a8[_0xdabb('0x1f')]],'as':_0x17a9a8['as'],'attributes':_0x17a9a8['attributes'],'include':_0x17a9a8[_0xdabb('0x1d')]?_[_0xdabb('0x1e')](_0x17a9a8['include'],function(_0x2bcf1c){return{'model':db[_0x2bcf1c[_0xdabb('0x1f')]],'as':_0x2bcf1c['as'],'attributes':_0x2bcf1c['attributes']};}):[]};}):[]};}):[]:[]})[_0xdabb('0xb')](function(_0x55305d){logger[_0xdabb('0xc')](_0xdabb('0x16'),_0x1e49d8);logger[_0xdabb('0xf')](_0xdabb('0x16'),_0x1e49d8,JSON[_0xdabb('0x10')](_0x55305d));_0x53869a(_0x55305d);})['catch'](function(_0x4d6e49){logger['error'](_0xdabb('0x16'),_0x4d6e49[_0xdabb('0x13')],_0x1e49d8);_0x168b00(_0x5adc66[_0xdabb('0x11')](0x1f4,_0x4d6e49[_0xdabb('0x13')]));});});};exports[_0xdabb('0x21')]=function(_0x2075b0){var _0x3c249b=this;return new Promise(function(_0x1f4372,_0x1b7feb){return db[_0xdabb('0x17')][_0xdabb('0x22')]({'raw':_0x2075b0[_0xdabb('0x19')]?_0x2075b0[_0xdabb('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2075b0[_0xdabb('0x19')]?_0x2075b0[_0xdabb('0x19')][_0xdabb('0x1b')]||null:null,'attributes':_0x2075b0[_0xdabb('0x19')]?_0x2075b0[_0xdabb('0x19')][_0xdabb('0x20')]||null:null,'include':_0x2075b0['options']?_0x2075b0['options'][_0xdabb('0x1d')]?_['map'](_0x2075b0[_0xdabb('0x19')][_0xdabb('0x1d')],function(_0x11b6f1){return{'model':db[_0x11b6f1[_0xdabb('0x1f')]],'as':_0x11b6f1['as'],'attributes':_0x11b6f1[_0xdabb('0x20')],'include':_0x11b6f1[_0xdabb('0x1d')]?_[_0xdabb('0x1e')](_0x11b6f1[_0xdabb('0x1d')],function(_0x2161f5){return{'model':db[_0x2161f5[_0xdabb('0x1f')]],'as':_0x2161f5['as'],'attributes':_0x2161f5[_0xdabb('0x20')],'include':_0x2161f5[_0xdabb('0x1d')]?_['map'](_0x2161f5[_0xdabb('0x1d')],function(_0x4c6ef0){return{'model':db[_0x4c6ef0['model']],'as':_0x4c6ef0['as'],'attributes':_0x4c6ef0[_0xdabb('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59af80){logger[_0xdabb('0xc')](_0xdabb('0x21'),_0x2075b0);logger[_0xdabb('0xf')](_0xdabb('0x21'),_0x2075b0,JSON[_0xdabb('0x10')](_0x59af80));_0x1f4372(_0x59af80);})['catch'](function(_0x1c9141){logger[_0xdabb('0x11')](_0xdabb('0x21'),_0x1c9141[_0xdabb('0x13')],_0x2075b0);_0x1b7feb(_0x3c249b[_0xdabb('0x11')](0x1f4,_0x1c9141[_0xdabb('0x13')]));});});}; \ No newline at end of file +var _0x3c60=['debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','code','error','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','stringify','ShowDeskAccount','find'];(function(_0x254e5d,_0x47b17d){var _0x279a8f=function(_0x100258){while(--_0x100258){_0x254e5d['push'](_0x254e5d['shift']());}};_0x279a8f(++_0x47b17d);}(_0x3c60,0x1a5));var _0x03c6=function(_0x48c4ef,_0x319d44){_0x48c4ef=_0x48c4ef-0x0;var _0x435715=_0x3c60[_0x48c4ef];return _0x435715;};'use strict';var _=require(_0x03c6('0x0'));var util=require(_0x03c6('0x1'));var moment=require('moment');var BPromise=require(_0x03c6('0x2'));var rs=require(_0x03c6('0x3'));var fs=require('fs');var Redis=require(_0x03c6('0x4'));var db=require(_0x03c6('0x5'))['db'];var utils=require(_0x03c6('0x6'));var logger=require(_0x03c6('0x7'))('rpc');var config=require(_0x03c6('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x03c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x86e3c9,_0x9fa151,_0x3df28d){return new BPromise(function(_0x20b22a,_0x4571c0){return client[_0x03c6('0xa')](_0x86e3c9,_0x3df28d)[_0x03c6('0xb')](function(_0x24ad45){logger['info'](_0x03c6('0xc'),_0x9fa151,_0x03c6('0xd'));logger['debug'](_0x03c6('0xe'),_0x9fa151,'request\x20sent',JSON['stringify'](_0x24ad45));if(_0x24ad45['error']){if(_0x24ad45['error'][_0x03c6('0xf')]===0x1f4){logger[_0x03c6('0x10')](_0x03c6('0xc'),_0x9fa151,_0x24ad45[_0x03c6('0x10')][_0x03c6('0x11')]);return _0x4571c0(_0x24ad45[_0x03c6('0x10')][_0x03c6('0x11')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x9fa151,_0x24ad45['error'][_0x03c6('0x11')]);return _0x20b22a(_0x24ad45[_0x03c6('0x10')][_0x03c6('0x11')]);}else{logger['info'](_0x03c6('0xc'),_0x9fa151,_0x03c6('0xd'));_0x20b22a(_0x24ad45['result'][_0x03c6('0x11')]);}})[_0x03c6('0x12')](function(_0x4d7615){logger[_0x03c6('0x10')]('DeskAccount,\x20%s,\x20%s',_0x9fa151,_0x4d7615);_0x4571c0(_0x4d7615);});});}exports[_0x03c6('0x13')]=function(_0x4cdc8f){var _0x294a9d=this;return new Promise(function(_0xfe87a2,_0x33739d){return db[_0x03c6('0x14')][_0x03c6('0x15')]({'raw':_0x4cdc8f['options']?_0x4cdc8f[_0x03c6('0x16')][_0x03c6('0x17')]===undefined?!![]:![]:!![],'where':_0x4cdc8f['options']?_0x4cdc8f['options'][_0x03c6('0x18')]||null:null,'attributes':_0x4cdc8f[_0x03c6('0x16')]?_0x4cdc8f[_0x03c6('0x16')][_0x03c6('0x19')]||null:null,'limit':_0x4cdc8f[_0x03c6('0x16')]?_0x4cdc8f['options'][_0x03c6('0x1a')]||null:null,'include':_0x4cdc8f[_0x03c6('0x16')]?_0x4cdc8f[_0x03c6('0x16')][_0x03c6('0x1b')]?_['map'](_0x4cdc8f[_0x03c6('0x16')]['include'],function(_0x3c2da9){return{'model':db[_0x3c2da9['model']],'as':_0x3c2da9['as'],'attributes':_0x3c2da9[_0x03c6('0x19')],'include':_0x3c2da9['include']?_[_0x03c6('0x1c')](_0x3c2da9[_0x03c6('0x1b')],function(_0x331f46){return{'model':db[_0x331f46[_0x03c6('0x1d')]],'as':_0x331f46['as'],'attributes':_0x331f46['attributes'],'include':_0x331f46[_0x03c6('0x1b')]?_['map'](_0x331f46['include'],function(_0x45f3de){return{'model':db[_0x45f3de[_0x03c6('0x1d')]],'as':_0x45f3de['as'],'attributes':_0x45f3de[_0x03c6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x03c6('0xb')](function(_0x217deb){logger[_0x03c6('0x1e')](_0x03c6('0x13'),_0x4cdc8f);logger['debug']('GetDeskAccount',_0x4cdc8f,JSON[_0x03c6('0x1f')](_0x217deb));_0xfe87a2(_0x217deb);})[_0x03c6('0x12')](function(_0x31b226){logger['error'](_0x03c6('0x13'),_0x31b226[_0x03c6('0x11')],_0x4cdc8f);_0x33739d(_0x294a9d[_0x03c6('0x10')](0x1f4,_0x31b226['message']));});});};exports[_0x03c6('0x20')]=function(_0x3f738a){var _0x29a240=this;return new Promise(function(_0x5e94df,_0x26bd99){return db[_0x03c6('0x14')][_0x03c6('0x21')]({'raw':_0x3f738a[_0x03c6('0x16')]?_0x3f738a[_0x03c6('0x16')][_0x03c6('0x17')]===undefined?!![]:![]:!![],'where':_0x3f738a['options']?_0x3f738a[_0x03c6('0x16')][_0x03c6('0x18')]||null:null,'attributes':_0x3f738a[_0x03c6('0x16')]?_0x3f738a[_0x03c6('0x16')][_0x03c6('0x19')]||null:null,'include':_0x3f738a[_0x03c6('0x16')]?_0x3f738a['options'][_0x03c6('0x1b')]?_[_0x03c6('0x1c')](_0x3f738a['options'][_0x03c6('0x1b')],function(_0x31b563){return{'model':db[_0x31b563['model']],'as':_0x31b563['as'],'attributes':_0x31b563[_0x03c6('0x19')],'include':_0x31b563[_0x03c6('0x1b')]?_[_0x03c6('0x1c')](_0x31b563[_0x03c6('0x1b')],function(_0x23e061){return{'model':db[_0x23e061[_0x03c6('0x1d')]],'as':_0x23e061['as'],'attributes':_0x23e061[_0x03c6('0x19')],'include':_0x23e061[_0x03c6('0x1b')]?_[_0x03c6('0x1c')](_0x23e061[_0x03c6('0x1b')],function(_0x1e9c5c){return{'model':db[_0x1e9c5c[_0x03c6('0x1d')]],'as':_0x1e9c5c['as'],'attributes':_0x1e9c5c[_0x03c6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x03c6('0xb')](function(_0x13ce38){logger[_0x03c6('0x1e')](_0x03c6('0x20'),_0x3f738a);logger[_0x03c6('0x22')]('ShowDeskAccount',_0x3f738a,JSON[_0x03c6('0x1f')](_0x13ce38));_0x5e94df(_0x13ce38);})[_0x03c6('0x12')](function(_0x345480){logger[_0x03c6('0x10')](_0x03c6('0x20'),_0x345480[_0x03c6('0x11')],_0x3f738a);_0x26bd99(_0x29a240[_0x03c6('0x10')](0x1f4,_0x345480[_0x03c6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 8fb4373..5c3f9dd 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 _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3eca45,_0x43192e){var _0x57fa4a=function(_0x46bf5f){while(--_0x46bf5f){_0x3eca45['push'](_0x3eca45['shift']());}};_0x57fa4a(++_0x43192e);}(_0x34e8,0x12c));var _0x834e=function(_0xc40aea,_0x25cb5f){_0xc40aea=_0xc40aea-0x0;var _0xf8ce42=_0x34e8[_0xc40aea];return _0xf8ce42;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x6c0b0a,_0x496391){var _0x5f456a=function(_0x5ae918){while(--_0x5ae918){_0x6c0b0a['push'](_0x6c0b0a['shift']());}};_0x5f456a(++_0x496391);}(_0x55ca,0x126));var _0xa55c=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x55ca[_0x40a825];return _0x273a54;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index e4a9e6b..a909291 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 _0x1725=['exports','STRING','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1725,0x155));var _0x5172=function(_0x2f2781,_0x579a21){_0x2f2781=_0x2f2781-0x0;var _0x5d14e4=_0x1725[_0x2f2781];return _0x5d14e4;};'use strict';var Sequelize=require(_0x5172('0x0'));module[_0x5172('0x1')]={'name':{'type':Sequelize[_0x5172('0x2')]},'description':{'type':Sequelize[_0x5172('0x2')]}}; \ No newline at end of file +var _0xfe55=['STRING','sequelize','exports'];(function(_0x2baaa1,_0x2d624a){var _0x50cd60=function(_0xd9a18a){while(--_0xd9a18a){_0x2baaa1['push'](_0x2baaa1['shift']());}};_0x50cd60(++_0x2d624a);}(_0xfe55,0x64));var _0x5fe5=function(_0x810025,_0x34bb04){_0x810025=_0x810025-0x0;var _0x4dbc81=_0xfe55[_0x810025];return _0x4dbc81;};'use strict';var Sequelize=require(_0x5fe5('0x0'));module[_0x5fe5('0x1')]={'name':{'type':Sequelize[_0x5fe5('0x2')]},'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 3ee33eb..0a2b5ac 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 _0xf203=['options','count','includeAll','rows','show','params','keys','length','include','find','catch','update','body','getFields','findOne','sort','nolimit','DeskField','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','set','Content-Range','apply','then','destroy','error','stack','name','index','map','DeskConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','order','where','pick','VIRTUAL','filter','merge'];(function(_0x34c814,_0x3c3540){var _0x3016aa=function(_0x391be5){while(--_0x391be5){_0x34c814['push'](_0x34c814['shift']());}};_0x3016aa(++_0x3c3540);}(_0xf203,0xb8));var _0x3f20=function(_0x3ed7ca,_0x568412){_0x3ed7ca=_0x3ed7ca-0x0;var _0x304dd5=_0xf203[_0x3ed7ca];return _0x304dd5;};'use strict';var emlformat=require(_0x3f20('0x0'));var rimraf=require(_0x3f20('0x1'));var zipdir=require(_0x3f20('0x2'));var jsonpatch=require(_0x3f20('0x3'));var rp=require(_0x3f20('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3f20('0x5'));var util=require(_0x3f20('0x6'));var path=require(_0x3f20('0x7'));var sox=require(_0x3f20('0x8'));var csv=require(_0x3f20('0x9'));var ejs=require(_0x3f20('0xa'));var fs=require('fs');var fs_extra=require(_0x3f20('0xb'));var _=require('lodash');var squel=require(_0x3f20('0xc'));var crypto=require(_0x3f20('0xd'));var jsforce=require(_0x3f20('0xe'));var deskjs=require(_0x3f20('0xf'));var toCsv=require(_0x3f20('0x9'));var querystring=require('querystring');var Papa=require(_0x3f20('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3f20('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f20('0x12'))(_0x3f20('0x13'));var utils=require(_0x3f20('0x14'));var config=require(_0x3f20('0x15'));var licenseUtil=require(_0x3f20('0x16'));var db=require(_0x3f20('0x17'))['db'];function respondWithStatusCode(_0x205209,_0x2f1ef2){_0x2f1ef2=_0x2f1ef2||0xcc;return function(_0x2580f1){if(_0x2580f1){return _0x205209[_0x3f20('0x18')](_0x2f1ef2);}return _0x205209[_0x3f20('0x19')](_0x2f1ef2)[_0x3f20('0x1a')]();};}function respondWithResult(_0x5278e5,_0x2ebcb7){_0x2ebcb7=_0x2ebcb7||0xc8;return function(_0x34a8a7){if(_0x34a8a7){return _0x5278e5[_0x3f20('0x19')](_0x2ebcb7)['json'](_0x34a8a7);}};}function respondWithFilteredResult(_0x37d200,_0x4c93a7){return function(_0xc715dd){if(_0xc715dd){var _0x2c690d=typeof _0x4c93a7[_0x3f20('0x1b')]==='undefined'&&typeof _0x4c93a7[_0x3f20('0x1c')]===_0x3f20('0x1d');var _0x338866=_0xc715dd['count'];var _0x3563ba=_0x2c690d?0x0:_0x4c93a7[_0x3f20('0x1b')];var _0x144cab=_0x2c690d?_0xc715dd['count']:_0x4c93a7['offset']+_0x4c93a7[_0x3f20('0x1c')];var _0x19b4ea;if(_0x144cab>=_0x338866){_0x144cab=_0x338866;_0x19b4ea=0xc8;}else{_0x19b4ea=0xce;}_0x37d200[_0x3f20('0x19')](_0x19b4ea);return _0x37d200[_0x3f20('0x1e')](_0x3f20('0x1f'),_0x3563ba+'-'+_0x144cab+'/'+_0x338866)['json'](_0xc715dd);}return null;};}function patchUpdates(_0x4f5539){return function(_0xfa85ae){try{jsonpatch[_0x3f20('0x20')](_0xfa85ae,_0x4f5539,!![]);}catch(_0x5f4ae4){return BPromise['reject'](_0x5f4ae4);}return _0xfa85ae['save']();};}function saveUpdates(_0x4b7172,_0x3d0864){return function(_0x8b0f31){if(_0x8b0f31){return _0x8b0f31['update'](_0x4b7172)[_0x3f20('0x21')](function(_0x31f016){return _0x31f016;});}return null;};}function removeEntity(_0x4ebc96,_0x2c0bae){return function(_0x1f0e66){if(_0x1f0e66){return _0x1f0e66[_0x3f20('0x22')]()[_0x3f20('0x21')](function(){_0x4ebc96[_0x3f20('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c5f48,_0x2f0905){return function(_0x48e83a){if(!_0x48e83a){_0x2c5f48[_0x3f20('0x18')](0x194);}return _0x48e83a;};}function handleError(_0x5cf18f,_0x269883){_0x269883=_0x269883||0x1f4;return function(_0x54a241){logger[_0x3f20('0x23')](_0x54a241[_0x3f20('0x24')]);if(_0x54a241[_0x3f20('0x25')]){delete _0x54a241['name'];}_0x5cf18f[_0x3f20('0x19')](_0x269883)['send'](_0x54a241);};}exports[_0x3f20('0x26')]=function(_0x331418,_0x33d2ea){var _0xc6af88={},_0x514bea={},_0x57ebdc={'count':0x0,'rows':[]};var _0xc8553e=_[_0x3f20('0x27')](db[_0x3f20('0x28')][_0x3f20('0x29')],function(_0x5a828c){return{'name':_0x5a828c['fieldName'],'type':_0x5a828c[_0x3f20('0x2a')][_0x3f20('0x2b')]};});_0x514bea[_0x3f20('0x2c')]=_['map'](_0xc8553e,_0x3f20('0x25'));_0x514bea[_0x3f20('0x2d')]=_['keys'](_0x331418['query']);_0x514bea[_0x3f20('0x2e')]=_[_0x3f20('0x2f')](_0x514bea[_0x3f20('0x2c')],_0x514bea[_0x3f20('0x2d')]);_0xc6af88[_0x3f20('0x30')]=_[_0x3f20('0x2f')](_0x514bea[_0x3f20('0x2c')],qs[_0x3f20('0x31')](_0x331418[_0x3f20('0x2d')][_0x3f20('0x31')]));_0xc6af88[_0x3f20('0x30')]=_0xc6af88[_0x3f20('0x30')]['length']?_0xc6af88[_0x3f20('0x30')]:_0x514bea[_0x3f20('0x2c')];if(!_0x331418['query']['hasOwnProperty']('nolimit')){_0xc6af88[_0x3f20('0x1c')]=qs[_0x3f20('0x1c')](_0x331418['query'][_0x3f20('0x1c')]);_0xc6af88[_0x3f20('0x1b')]=qs[_0x3f20('0x1b')](_0x331418[_0x3f20('0x2d')]['offset']);}_0xc6af88[_0x3f20('0x32')]=qs['sort'](_0x331418[_0x3f20('0x2d')]['sort']);_0xc6af88[_0x3f20('0x33')]=qs[_0x3f20('0x2e')](_[_0x3f20('0x34')](_0x331418[_0x3f20('0x2d')],_0x514bea[_0x3f20('0x2e')]),_0xc8553e);if(_0x331418[_0x3f20('0x2d')]['filter']){_0xc6af88[_0x3f20('0x33')]=_['merge'](_0xc6af88[_0x3f20('0x33')],{'$or':_[_0x3f20('0x27')](_0xc8553e,function(_0x64bd6a){if(_0x64bd6a['type']!==_0x3f20('0x35')){var _0x1e70de={};_0x1e70de[_0x64bd6a[_0x3f20('0x25')]]={'$like':'%'+_0x331418['query'][_0x3f20('0x36')]+'%'};return _0x1e70de;}})});}_0xc6af88=_[_0x3f20('0x37')]({},_0xc6af88,_0x331418[_0x3f20('0x38')]);var _0x275a0d={'where':_0xc6af88[_0x3f20('0x33')]};return db[_0x3f20('0x28')]['count'](_0x275a0d)[_0x3f20('0x21')](function(_0x3f3ff4){_0x57ebdc[_0x3f20('0x39')]=_0x3f3ff4;if(_0x331418['query'][_0x3f20('0x3a')]){_0xc6af88['include']=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0xc6af88);})[_0x3f20('0x21')](function(_0x32866c){_0x57ebdc[_0x3f20('0x3b')]=_0x32866c;return _0x57ebdc;})[_0x3f20('0x21')](respondWithFilteredResult(_0x33d2ea,_0xc6af88))['catch'](handleError(_0x33d2ea,null));};exports[_0x3f20('0x3c')]=function(_0x25b37e,_0x21cd5f){var _0x114cbb={'raw':![],'where':{'id':_0x25b37e[_0x3f20('0x3d')]['id']}},_0x49b7e2={};_0x49b7e2['model']=_[_0x3f20('0x3e')](db[_0x3f20('0x28')]['rawAttributes']);_0x49b7e2[_0x3f20('0x2d')]=_[_0x3f20('0x3e')](_0x25b37e['query']);_0x49b7e2[_0x3f20('0x2e')]=_[_0x3f20('0x2f')](_0x49b7e2[_0x3f20('0x2c')],_0x49b7e2[_0x3f20('0x2d')]);_0x114cbb[_0x3f20('0x30')]=_[_0x3f20('0x2f')](_0x49b7e2['model'],qs[_0x3f20('0x31')](_0x25b37e['query'][_0x3f20('0x31')]));_0x114cbb[_0x3f20('0x30')]=_0x114cbb['attributes'][_0x3f20('0x3f')]?_0x114cbb[_0x3f20('0x30')]:_0x49b7e2[_0x3f20('0x2c')];if(_0x25b37e['query'][_0x3f20('0x3a')]){_0x114cbb[_0x3f20('0x40')]=[{'all':!![]}];}_0x114cbb=_['merge']({},_0x114cbb,_0x25b37e[_0x3f20('0x38')]);return db[_0x3f20('0x28')][_0x3f20('0x41')](_0x114cbb)['then'](handleEntityNotFound(_0x21cd5f,null))[_0x3f20('0x21')](respondWithResult(_0x21cd5f,null))['catch'](handleError(_0x21cd5f,null));};exports['create']=function(_0x4e31ad,_0x594cfa){return db['DeskConfiguration']['create'](_0x4e31ad['body'],{})[_0x3f20('0x21')](respondWithResult(_0x594cfa,0xc9))[_0x3f20('0x42')](handleError(_0x594cfa,null));};exports[_0x3f20('0x43')]=function(_0x27eb04,_0x506c7a){if(_0x27eb04[_0x3f20('0x44')]['id']){delete _0x27eb04[_0x3f20('0x44')]['id'];}return db[_0x3f20('0x28')][_0x3f20('0x41')]({'where':{'id':_0x27eb04['params']['id']}})[_0x3f20('0x21')](handleEntityNotFound(_0x506c7a,null))[_0x3f20('0x21')](saveUpdates(_0x27eb04[_0x3f20('0x44')],null))[_0x3f20('0x21')](respondWithResult(_0x506c7a,null))[_0x3f20('0x42')](handleError(_0x506c7a,null));};exports['destroy']=function(_0x3c0950,_0x570e29){return db[_0x3f20('0x28')]['find']({'where':{'id':_0x3c0950['params']['id']}})['then'](handleEntityNotFound(_0x570e29,null))[_0x3f20('0x21')](removeEntity(_0x570e29,null))[_0x3f20('0x42')](handleError(_0x570e29,null));};exports[_0x3f20('0x45')]=function(_0x14ec63,_0x1d5a73,_0x4e2ccf){var _0x44f3df={};var _0x2e8e9c={};var _0x3d0c6b;var _0x448cf5;return db[_0x3f20('0x28')][_0x3f20('0x46')]({'where':{'id':_0x14ec63[_0x3f20('0x3d')]['id']}})[_0x3f20('0x21')](handleEntityNotFound(_0x1d5a73,null))[_0x3f20('0x21')](function(_0x2d5024){if(_0x2d5024){_0x3d0c6b=_0x2d5024;_0x2e8e9c[_0x3f20('0x2c')]=_[_0x3f20('0x3e')](db['DeskField'][_0x3f20('0x29')]);_0x2e8e9c[_0x3f20('0x2d')]=_['keys'](_0x14ec63[_0x3f20('0x2d')]);_0x2e8e9c[_0x3f20('0x2e')]=_[_0x3f20('0x2f')](_0x2e8e9c[_0x3f20('0x2c')],_0x2e8e9c[_0x3f20('0x2d')]);_0x44f3df['attributes']=_['intersection'](_0x2e8e9c[_0x3f20('0x2c')],qs[_0x3f20('0x31')](_0x14ec63['query'][_0x3f20('0x31')]));_0x44f3df[_0x3f20('0x30')]=_0x44f3df[_0x3f20('0x30')][_0x3f20('0x3f')]?_0x44f3df[_0x3f20('0x30')]:_0x2e8e9c[_0x3f20('0x2c')];_0x44f3df['order']=qs[_0x3f20('0x47')](_0x14ec63['query']['sort']);_0x44f3df[_0x3f20('0x33')]=qs[_0x3f20('0x2e')](_[_0x3f20('0x34')](_0x14ec63['query'],_0x2e8e9c[_0x3f20('0x2e')]));if(_0x14ec63[_0x3f20('0x2d')][_0x3f20('0x36')]){_0x44f3df[_0x3f20('0x33')]=_['merge'](_0x44f3df['where'],{'$or':_[_0x3f20('0x27')](_0x44f3df[_0x3f20('0x30')],function(_0xc6ae59){var _0x224da7={};_0x224da7[_0xc6ae59]={'$like':'%'+_0x14ec63[_0x3f20('0x2d')][_0x3f20('0x36')]+'%'};return _0x224da7;})});}_0x44f3df=_[_0x3f20('0x37')]({},_0x44f3df,_0x14ec63[_0x3f20('0x38')]);return _0x3d0c6b[_0x3f20('0x45')](_0x44f3df);}})[_0x3f20('0x21')](function(_0x45dcbe){if(_0x45dcbe){_0x448cf5=_0x45dcbe['length'];if(!_0x14ec63[_0x3f20('0x2d')]['hasOwnProperty'](_0x3f20('0x48'))){_0x44f3df[_0x3f20('0x1c')]=qs[_0x3f20('0x1c')](_0x14ec63[_0x3f20('0x2d')][_0x3f20('0x1c')]);_0x44f3df[_0x3f20('0x1b')]=qs[_0x3f20('0x1b')](_0x14ec63[_0x3f20('0x2d')]['offset']);}return _0x3d0c6b[_0x3f20('0x45')](_0x44f3df);}})[_0x3f20('0x21')](function(_0x5954f8){if(_0x5954f8){return _0x5954f8?{'count':_0x448cf5,'rows':_0x5954f8}:null;}})[_0x3f20('0x21')](respondWithResult(_0x1d5a73,null))[_0x3f20('0x42')](handleError(_0x1d5a73,null));};exports['getSubjects']=function(_0x541a88,_0x3794bd,_0x5c1f77){var _0x867171={};var _0x4db3d3={};var _0x583de3;var _0x3a545d;return db[_0x3f20('0x28')][_0x3f20('0x46')]({'where':{'id':_0x541a88[_0x3f20('0x3d')]['id']}})[_0x3f20('0x21')](handleEntityNotFound(_0x3794bd,null))[_0x3f20('0x21')](function(_0x5ac733){if(_0x5ac733){_0x583de3=_0x5ac733;_0x4db3d3[_0x3f20('0x2c')]=_[_0x3f20('0x3e')](db[_0x3f20('0x49')]['rawAttributes']);_0x4db3d3[_0x3f20('0x2d')]=_[_0x3f20('0x3e')](_0x541a88[_0x3f20('0x2d')]);_0x4db3d3[_0x3f20('0x2e')]=_[_0x3f20('0x2f')](_0x4db3d3[_0x3f20('0x2c')],_0x4db3d3[_0x3f20('0x2d')]);_0x867171['attributes']=_[_0x3f20('0x2f')](_0x4db3d3[_0x3f20('0x2c')],qs['fields'](_0x541a88['query'][_0x3f20('0x31')]));_0x867171[_0x3f20('0x30')]=_0x867171[_0x3f20('0x30')][_0x3f20('0x3f')]?_0x867171['attributes']:_0x4db3d3['model'];_0x867171['order']=qs[_0x3f20('0x47')](_0x541a88[_0x3f20('0x2d')]['sort']);_0x867171[_0x3f20('0x33')]=qs[_0x3f20('0x2e')](_[_0x3f20('0x34')](_0x541a88[_0x3f20('0x2d')],_0x4db3d3['filters']));if(_0x541a88['query']['filter']){_0x867171[_0x3f20('0x33')]=_[_0x3f20('0x37')](_0x867171[_0x3f20('0x33')],{'$or':_['map'](_0x867171[_0x3f20('0x30')],function(_0x28d03c){var _0x1e2f7e={};_0x1e2f7e[_0x28d03c]={'$like':'%'+_0x541a88[_0x3f20('0x2d')][_0x3f20('0x36')]+'%'};return _0x1e2f7e;})});}_0x867171=_[_0x3f20('0x37')]({},_0x867171,_0x541a88['options']);return _0x583de3[_0x3f20('0x4a')](_0x867171);}})[_0x3f20('0x21')](function(_0x285544){if(_0x285544){_0x3a545d=_0x285544[_0x3f20('0x3f')];if(!_0x541a88[_0x3f20('0x2d')][_0x3f20('0x4b')]('nolimit')){_0x867171[_0x3f20('0x1c')]=qs[_0x3f20('0x1c')](_0x541a88[_0x3f20('0x2d')][_0x3f20('0x1c')]);_0x867171[_0x3f20('0x1b')]=qs[_0x3f20('0x1b')](_0x541a88[_0x3f20('0x2d')][_0x3f20('0x1b')]);}return _0x583de3[_0x3f20('0x4a')](_0x867171);}})[_0x3f20('0x21')](function(_0x50b7b4){if(_0x50b7b4){return _0x50b7b4?{'count':_0x3a545d,'rows':_0x50b7b4}:null;}})[_0x3f20('0x21')](respondWithResult(_0x3794bd,null))['catch'](handleError(_0x3794bd,null));};exports[_0x3f20('0x4c')]=function(_0x46cef5,_0x3d3a07,_0x554263){var _0x536af7={};var _0x1105a6={};var _0x479821;var _0x5add40;return db[_0x3f20('0x28')][_0x3f20('0x46')]({'where':{'id':_0x46cef5[_0x3f20('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3d3a07,null))['then'](function(_0x4dcad3){if(_0x4dcad3){_0x479821=_0x4dcad3;_0x1105a6[_0x3f20('0x2c')]=_[_0x3f20('0x3e')](db['DeskField'][_0x3f20('0x29')]);_0x1105a6[_0x3f20('0x2d')]=_[_0x3f20('0x3e')](_0x46cef5[_0x3f20('0x2d')]);_0x1105a6['filters']=_[_0x3f20('0x2f')](_0x1105a6[_0x3f20('0x2c')],_0x1105a6[_0x3f20('0x2d')]);_0x536af7[_0x3f20('0x30')]=_[_0x3f20('0x2f')](_0x1105a6['model'],qs[_0x3f20('0x31')](_0x46cef5[_0x3f20('0x2d')]['fields']));_0x536af7['attributes']=_0x536af7[_0x3f20('0x30')][_0x3f20('0x3f')]?_0x536af7[_0x3f20('0x30')]:_0x1105a6['model'];_0x536af7[_0x3f20('0x32')]=qs[_0x3f20('0x47')](_0x46cef5[_0x3f20('0x2d')][_0x3f20('0x47')]);_0x536af7[_0x3f20('0x33')]=qs['filters'](_[_0x3f20('0x34')](_0x46cef5[_0x3f20('0x2d')],_0x1105a6['filters']));if(_0x46cef5['query'][_0x3f20('0x36')]){_0x536af7[_0x3f20('0x33')]=_[_0x3f20('0x37')](_0x536af7['where'],{'$or':_['map'](_0x536af7[_0x3f20('0x30')],function(_0x4e7f13){var _0x3015b9={};_0x3015b9[_0x4e7f13]={'$like':'%'+_0x46cef5[_0x3f20('0x2d')][_0x3f20('0x36')]+'%'};return _0x3015b9;})});}_0x536af7=_[_0x3f20('0x37')]({},_0x536af7,_0x46cef5[_0x3f20('0x38')]);return _0x479821['getDescriptions'](_0x536af7);}})['then'](function(_0x76b8cd){if(_0x76b8cd){_0x5add40=_0x76b8cd[_0x3f20('0x3f')];if(!_0x46cef5[_0x3f20('0x2d')][_0x3f20('0x4b')](_0x3f20('0x48'))){_0x536af7[_0x3f20('0x1c')]=qs[_0x3f20('0x1c')](_0x46cef5[_0x3f20('0x2d')][_0x3f20('0x1c')]);_0x536af7[_0x3f20('0x1b')]=qs[_0x3f20('0x1b')](_0x46cef5[_0x3f20('0x2d')]['offset']);}return _0x479821[_0x3f20('0x4c')](_0x536af7);}})['then'](function(_0x583dd9){if(_0x583dd9){return _0x583dd9?{'count':_0x5add40,'rows':_0x583dd9}:null;}})[_0x3f20('0x21')](respondWithResult(_0x3d3a07,null))[_0x3f20('0x42')](handleError(_0x3d3a07,null));};exports[_0x3f20('0x4d')]=function(_0x2a18e2,_0x2af1a2,_0x3af5dd){var _0x55a8ca={};var _0x1772a2={};var _0x1cc629;var _0x55537a;return db['DeskConfiguration']['findOne']({'where':{'id':_0x2a18e2[_0x3f20('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2af1a2,null))[_0x3f20('0x21')](function(_0x3035b9){if(_0x3035b9){_0x1cc629=_0x3035b9;_0x1772a2[_0x3f20('0x2c')]=_['keys'](db[_0x3f20('0x4e')][_0x3f20('0x29')]);_0x1772a2['query']=_[_0x3f20('0x3e')](_0x2a18e2[_0x3f20('0x2d')]);_0x1772a2[_0x3f20('0x2e')]=_[_0x3f20('0x2f')](_0x1772a2[_0x3f20('0x2c')],_0x1772a2[_0x3f20('0x2d')]);_0x55a8ca[_0x3f20('0x30')]=_[_0x3f20('0x2f')](_0x1772a2[_0x3f20('0x2c')],qs['fields'](_0x2a18e2[_0x3f20('0x2d')][_0x3f20('0x31')]));_0x55a8ca[_0x3f20('0x30')]=_0x55a8ca[_0x3f20('0x30')][_0x3f20('0x3f')]?_0x55a8ca[_0x3f20('0x30')]:_0x1772a2[_0x3f20('0x2c')];_0x55a8ca[_0x3f20('0x32')]=qs[_0x3f20('0x47')](_0x2a18e2[_0x3f20('0x2d')][_0x3f20('0x47')]);_0x55a8ca['where']=qs[_0x3f20('0x2e')](_[_0x3f20('0x34')](_0x2a18e2[_0x3f20('0x2d')],_0x1772a2[_0x3f20('0x2e')]));if(_0x2a18e2[_0x3f20('0x2d')]['filter']){_0x55a8ca['where']=_['merge'](_0x55a8ca[_0x3f20('0x33')],{'$or':_[_0x3f20('0x27')](_0x55a8ca['attributes'],function(_0x76e1dc){var _0x58f916={};_0x58f916[_0x76e1dc]={'$like':'%'+_0x2a18e2[_0x3f20('0x2d')][_0x3f20('0x36')]+'%'};return _0x58f916;})});}_0x55a8ca=_[_0x3f20('0x37')]({},_0x55a8ca,_0x2a18e2['options']);return _0x1cc629['getTags'](_0x55a8ca);}})[_0x3f20('0x21')](function(_0x15c1a6){if(_0x15c1a6){_0x55537a=_0x15c1a6['length'];if(!_0x2a18e2[_0x3f20('0x2d')][_0x3f20('0x4b')](_0x3f20('0x48'))){_0x55a8ca['limit']=qs['limit'](_0x2a18e2[_0x3f20('0x2d')]['limit']);_0x55a8ca['offset']=qs[_0x3f20('0x1b')](_0x2a18e2[_0x3f20('0x2d')][_0x3f20('0x1b')]);}return _0x1cc629[_0x3f20('0x4d')](_0x55a8ca);}})['then'](function(_0x514193){if(_0x514193){return _0x514193?{'count':_0x55537a,'rows':_0x514193}:null;}})[_0x3f20('0x21')](respondWithResult(_0x2af1a2,null))['catch'](handleError(_0x2af1a2,null));};exports[_0x3f20('0x4f')]=function(_0x33bc1d,_0x5db019,_0xcd195a){if(_0x33bc1d[_0x3f20('0x44')]['id']){delete _0x33bc1d[_0x3f20('0x44')]['id'];}return db['DeskConfiguration'][_0x3f20('0x46')]({'where':{'id':_0x33bc1d[_0x3f20('0x3d')]['id']}})[_0x3f20('0x21')](handleEntityNotFound(_0x5db019,null))[_0x3f20('0x21')](function(_0x564791){if(_0x564791){return _0x564791['setTags'](_0x33bc1d['body']['ids']||[]);}return null;})[_0x3f20('0x21')](respondWithResult(_0x5db019,null))[_0x3f20('0x42')](handleError(_0x5db019,null));}; \ No newline at end of file +var _0xeb22=['../../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','save','update','then','destroy','error','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','DeskConfiguration','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','getFields','findOne','DeskField','filters','order','pick','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','ids','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x5abd9e,_0x39b193){var _0x9fff7e=function(_0x28d754){while(--_0x28d754){_0x5abd9e['push'](_0x5abd9e['shift']());}};_0x9fff7e(++_0x39b193);}(_0xeb22,0x14b));var _0x2eb2=function(_0x3a21c0,_0x348451){_0x3a21c0=_0x3a21c0-0x0;var _0x411e84=_0xeb22[_0x3a21c0];return _0x411e84;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2eb2('0x0'));var zipdir=require(_0x2eb2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2eb2('0x2'));var moment=require(_0x2eb2('0x3'));var BPromise=require(_0x2eb2('0x4'));var Mustache=require(_0x2eb2('0x5'));var util=require('util');var path=require(_0x2eb2('0x6'));var sox=require('sox');var csv=require(_0x2eb2('0x7'));var ejs=require(_0x2eb2('0x8'));var fs=require('fs');var fs_extra=require(_0x2eb2('0x9'));var _=require(_0x2eb2('0xa'));var squel=require(_0x2eb2('0xb'));var crypto=require(_0x2eb2('0xc'));var jsforce=require(_0x2eb2('0xd'));var deskjs=require(_0x2eb2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2eb2('0xf'));var Redis=require(_0x2eb2('0x10'));var authService=require(_0x2eb2('0x11'));var qs=require(_0x2eb2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2eb2('0x13'));var logger=require(_0x2eb2('0x14'))(_0x2eb2('0x15'));var utils=require(_0x2eb2('0x16'));var config=require(_0x2eb2('0x17'));var licenseUtil=require(_0x2eb2('0x18'));var db=require(_0x2eb2('0x19'))['db'];function respondWithStatusCode(_0x532804,_0x4cb77e){_0x4cb77e=_0x4cb77e||0xcc;return function(_0x4a8ced){if(_0x4a8ced){return _0x532804[_0x2eb2('0x1a')](_0x4cb77e);}return _0x532804[_0x2eb2('0x1b')](_0x4cb77e)[_0x2eb2('0x1c')]();};}function respondWithResult(_0x2582e3,_0xa221a2){_0xa221a2=_0xa221a2||0xc8;return function(_0x1e1b9c){if(_0x1e1b9c){return _0x2582e3['status'](_0xa221a2)[_0x2eb2('0x1d')](_0x1e1b9c);}};}function respondWithFilteredResult(_0x5e721b,_0x55e79f){return function(_0x330f98){if(_0x330f98){var _0x5d7011=typeof _0x55e79f[_0x2eb2('0x1e')]===_0x2eb2('0x1f')&&typeof _0x55e79f[_0x2eb2('0x20')]===_0x2eb2('0x1f');var _0x5e53da=_0x330f98[_0x2eb2('0x21')];var _0xea1713=_0x5d7011?0x0:_0x55e79f[_0x2eb2('0x1e')];var _0x3e15f8=_0x5d7011?_0x330f98[_0x2eb2('0x21')]:_0x55e79f[_0x2eb2('0x1e')]+_0x55e79f['limit'];var _0x2d3ea2;if(_0x3e15f8>=_0x5e53da){_0x3e15f8=_0x5e53da;_0x2d3ea2=0xc8;}else{_0x2d3ea2=0xce;}_0x5e721b[_0x2eb2('0x1b')](_0x2d3ea2);return _0x5e721b[_0x2eb2('0x22')](_0x2eb2('0x23'),_0xea1713+'-'+_0x3e15f8+'/'+_0x5e53da)[_0x2eb2('0x1d')](_0x330f98);}return null;};}function patchUpdates(_0x5c9edd){return function(_0x2c4b01){try{jsonpatch['apply'](_0x2c4b01,_0x5c9edd,!![]);}catch(_0x54597b){return BPromise[_0x2eb2('0x24')](_0x54597b);}return _0x2c4b01[_0x2eb2('0x25')]();};}function saveUpdates(_0xf99a55,_0x3ff68d){return function(_0x162a50){if(_0x162a50){return _0x162a50[_0x2eb2('0x26')](_0xf99a55)[_0x2eb2('0x27')](function(_0x3c9663){return _0x3c9663;});}return null;};}function removeEntity(_0x3e8550,_0x2194f5){return function(_0x3ab5d3){if(_0x3ab5d3){return _0x3ab5d3[_0x2eb2('0x28')]()[_0x2eb2('0x27')](function(){_0x3e8550[_0x2eb2('0x1b')](0xcc)[_0x2eb2('0x1c')]();});}};}function handleEntityNotFound(_0x226097,_0x5f56fa){return function(_0x252c72){if(!_0x252c72){_0x226097['sendStatus'](0x194);}return _0x252c72;};}function handleError(_0x4d0a9b,_0xf238a6){_0xf238a6=_0xf238a6||0x1f4;return function(_0x58cccf){logger[_0x2eb2('0x29')](_0x58cccf[_0x2eb2('0x2a')]);if(_0x58cccf['name']){delete _0x58cccf[_0x2eb2('0x2b')];}_0x4d0a9b[_0x2eb2('0x1b')](_0xf238a6)[_0x2eb2('0x2c')](_0x58cccf);};}exports['index']=function(_0x6c514,_0x29c7b7){var _0x2fd818={},_0x3032c6={},_0x4bc394={'count':0x0,'rows':[]};var _0x2112fb=_[_0x2eb2('0x2d')](db['DeskConfiguration']['rawAttributes'],function(_0x5838ce){return{'name':_0x5838ce[_0x2eb2('0x2e')],'type':_0x5838ce[_0x2eb2('0x2f')][_0x2eb2('0x30')]};});_0x3032c6[_0x2eb2('0x31')]=_[_0x2eb2('0x2d')](_0x2112fb,_0x2eb2('0x2b'));_0x3032c6[_0x2eb2('0x32')]=_[_0x2eb2('0x33')](_0x6c514[_0x2eb2('0x32')]);_0x3032c6['filters']=_[_0x2eb2('0x34')](_0x3032c6[_0x2eb2('0x31')],_0x3032c6[_0x2eb2('0x32')]);_0x2fd818[_0x2eb2('0x35')]=_['intersection'](_0x3032c6[_0x2eb2('0x31')],qs[_0x2eb2('0x36')](_0x6c514[_0x2eb2('0x32')]['fields']));_0x2fd818[_0x2eb2('0x35')]=_0x2fd818[_0x2eb2('0x35')][_0x2eb2('0x37')]?_0x2fd818['attributes']:_0x3032c6[_0x2eb2('0x31')];if(!_0x6c514[_0x2eb2('0x32')]['hasOwnProperty'](_0x2eb2('0x38'))){_0x2fd818['limit']=qs[_0x2eb2('0x20')](_0x6c514[_0x2eb2('0x32')][_0x2eb2('0x20')]);_0x2fd818[_0x2eb2('0x1e')]=qs['offset'](_0x6c514[_0x2eb2('0x32')][_0x2eb2('0x1e')]);}_0x2fd818['order']=qs['sort'](_0x6c514[_0x2eb2('0x32')][_0x2eb2('0x39')]);_0x2fd818[_0x2eb2('0x3a')]=qs['filters'](_['pick'](_0x6c514[_0x2eb2('0x32')],_0x3032c6['filters']),_0x2112fb);if(_0x6c514['query']['filter']){_0x2fd818[_0x2eb2('0x3a')]=_[_0x2eb2('0x3b')](_0x2fd818[_0x2eb2('0x3a')],{'$or':_[_0x2eb2('0x2d')](_0x2112fb,function(_0x2b9d54){if(_0x2b9d54[_0x2eb2('0x2f')]!==_0x2eb2('0x3c')){var _0x3981e1={};_0x3981e1[_0x2b9d54[_0x2eb2('0x2b')]]={'$like':'%'+_0x6c514['query'][_0x2eb2('0x3d')]+'%'};return _0x3981e1;}})});}_0x2fd818=_[_0x2eb2('0x3b')]({},_0x2fd818,_0x6c514['options']);var _0x499f85={'where':_0x2fd818[_0x2eb2('0x3a')]};return db['DeskConfiguration'][_0x2eb2('0x21')](_0x499f85)['then'](function(_0x124a64){_0x4bc394['count']=_0x124a64;if(_0x6c514['query'][_0x2eb2('0x3e')]){_0x2fd818[_0x2eb2('0x3f')]=[{'all':!![]}];}return db[_0x2eb2('0x40')][_0x2eb2('0x41')](_0x2fd818);})['then'](function(_0x55376e){_0x4bc394[_0x2eb2('0x42')]=_0x55376e;return _0x4bc394;})[_0x2eb2('0x27')](respondWithFilteredResult(_0x29c7b7,_0x2fd818))[_0x2eb2('0x43')](handleError(_0x29c7b7,null));};exports[_0x2eb2('0x44')]=function(_0x4bcebb,_0x3fb287){var _0x4446c9={'raw':![],'where':{'id':_0x4bcebb[_0x2eb2('0x45')]['id']}},_0x9f8815={};_0x9f8815['model']=_[_0x2eb2('0x33')](db[_0x2eb2('0x40')][_0x2eb2('0x46')]);_0x9f8815[_0x2eb2('0x32')]=_[_0x2eb2('0x33')](_0x4bcebb[_0x2eb2('0x32')]);_0x9f8815['filters']=_[_0x2eb2('0x34')](_0x9f8815[_0x2eb2('0x31')],_0x9f8815[_0x2eb2('0x32')]);_0x4446c9[_0x2eb2('0x35')]=_[_0x2eb2('0x34')](_0x9f8815['model'],qs[_0x2eb2('0x36')](_0x4bcebb[_0x2eb2('0x32')][_0x2eb2('0x36')]));_0x4446c9['attributes']=_0x4446c9[_0x2eb2('0x35')][_0x2eb2('0x37')]?_0x4446c9[_0x2eb2('0x35')]:_0x9f8815['model'];if(_0x4bcebb['query'][_0x2eb2('0x3e')]){_0x4446c9['include']=[{'all':!![]}];}_0x4446c9=_[_0x2eb2('0x3b')]({},_0x4446c9,_0x4bcebb[_0x2eb2('0x47')]);return db[_0x2eb2('0x40')][_0x2eb2('0x48')](_0x4446c9)[_0x2eb2('0x27')](handleEntityNotFound(_0x3fb287,null))[_0x2eb2('0x27')](respondWithResult(_0x3fb287,null))['catch'](handleError(_0x3fb287,null));};exports[_0x2eb2('0x49')]=function(_0x2199d3,_0x563df0){return db[_0x2eb2('0x40')]['create'](_0x2199d3['body'],{})['then'](respondWithResult(_0x563df0,0xc9))[_0x2eb2('0x43')](handleError(_0x563df0,null));};exports[_0x2eb2('0x26')]=function(_0xbfa4aa,_0x1dab76){if(_0xbfa4aa['body']['id']){delete _0xbfa4aa[_0x2eb2('0x4a')]['id'];}return db[_0x2eb2('0x40')][_0x2eb2('0x48')]({'where':{'id':_0xbfa4aa[_0x2eb2('0x45')]['id']}})[_0x2eb2('0x27')](handleEntityNotFound(_0x1dab76,null))[_0x2eb2('0x27')](saveUpdates(_0xbfa4aa['body'],null))[_0x2eb2('0x27')](respondWithResult(_0x1dab76,null))[_0x2eb2('0x43')](handleError(_0x1dab76,null));};exports['destroy']=function(_0x32dbc,_0x26ea52){return db[_0x2eb2('0x40')]['find']({'where':{'id':_0x32dbc[_0x2eb2('0x45')]['id']}})[_0x2eb2('0x27')](handleEntityNotFound(_0x26ea52,null))[_0x2eb2('0x27')](removeEntity(_0x26ea52,null))['catch'](handleError(_0x26ea52,null));};exports[_0x2eb2('0x4b')]=function(_0x32ba1d,_0x34f51e,_0x3288cf){var _0xa09f58={};var _0x4f7f09={};var _0x265d94;var _0x4bde75;return db['DeskConfiguration'][_0x2eb2('0x4c')]({'where':{'id':_0x32ba1d[_0x2eb2('0x45')]['id']}})[_0x2eb2('0x27')](handleEntityNotFound(_0x34f51e,null))[_0x2eb2('0x27')](function(_0xb2557d){if(_0xb2557d){_0x265d94=_0xb2557d;_0x4f7f09[_0x2eb2('0x31')]=_['keys'](db[_0x2eb2('0x4d')][_0x2eb2('0x46')]);_0x4f7f09[_0x2eb2('0x32')]=_[_0x2eb2('0x33')](_0x32ba1d['query']);_0x4f7f09[_0x2eb2('0x4e')]=_[_0x2eb2('0x34')](_0x4f7f09[_0x2eb2('0x31')],_0x4f7f09[_0x2eb2('0x32')]);_0xa09f58[_0x2eb2('0x35')]=_[_0x2eb2('0x34')](_0x4f7f09[_0x2eb2('0x31')],qs['fields'](_0x32ba1d[_0x2eb2('0x32')][_0x2eb2('0x36')]));_0xa09f58[_0x2eb2('0x35')]=_0xa09f58[_0x2eb2('0x35')][_0x2eb2('0x37')]?_0xa09f58['attributes']:_0x4f7f09[_0x2eb2('0x31')];_0xa09f58[_0x2eb2('0x4f')]=qs[_0x2eb2('0x39')](_0x32ba1d[_0x2eb2('0x32')]['sort']);_0xa09f58[_0x2eb2('0x3a')]=qs[_0x2eb2('0x4e')](_[_0x2eb2('0x50')](_0x32ba1d['query'],_0x4f7f09[_0x2eb2('0x4e')]));if(_0x32ba1d[_0x2eb2('0x32')][_0x2eb2('0x3d')]){_0xa09f58[_0x2eb2('0x3a')]=_[_0x2eb2('0x3b')](_0xa09f58[_0x2eb2('0x3a')],{'$or':_[_0x2eb2('0x2d')](_0xa09f58[_0x2eb2('0x35')],function(_0x449be6){var _0x1eee32={};_0x1eee32[_0x449be6]={'$like':'%'+_0x32ba1d['query'][_0x2eb2('0x3d')]+'%'};return _0x1eee32;})});}_0xa09f58=_[_0x2eb2('0x3b')]({},_0xa09f58,_0x32ba1d[_0x2eb2('0x47')]);return _0x265d94[_0x2eb2('0x4b')](_0xa09f58);}})['then'](function(_0x24507f){if(_0x24507f){_0x4bde75=_0x24507f['length'];if(!_0x32ba1d[_0x2eb2('0x32')][_0x2eb2('0x51')](_0x2eb2('0x38'))){_0xa09f58[_0x2eb2('0x20')]=qs[_0x2eb2('0x20')](_0x32ba1d['query'][_0x2eb2('0x20')]);_0xa09f58[_0x2eb2('0x1e')]=qs[_0x2eb2('0x1e')](_0x32ba1d['query'][_0x2eb2('0x1e')]);}return _0x265d94[_0x2eb2('0x4b')](_0xa09f58);}})[_0x2eb2('0x27')](function(_0x1875e4){if(_0x1875e4){return _0x1875e4?{'count':_0x4bde75,'rows':_0x1875e4}:null;}})[_0x2eb2('0x27')](respondWithResult(_0x34f51e,null))[_0x2eb2('0x43')](handleError(_0x34f51e,null));};exports[_0x2eb2('0x52')]=function(_0x359eb4,_0x2fcbbd,_0xc7987f){var _0x143c8d={};var _0x5b4b94={};var _0x5b096e;var _0x1f8e10;return db[_0x2eb2('0x40')][_0x2eb2('0x4c')]({'where':{'id':_0x359eb4[_0x2eb2('0x45')]['id']}})[_0x2eb2('0x27')](handleEntityNotFound(_0x2fcbbd,null))['then'](function(_0x3ea1d8){if(_0x3ea1d8){_0x5b096e=_0x3ea1d8;_0x5b4b94[_0x2eb2('0x31')]=_[_0x2eb2('0x33')](db[_0x2eb2('0x4d')][_0x2eb2('0x46')]);_0x5b4b94[_0x2eb2('0x32')]=_[_0x2eb2('0x33')](_0x359eb4[_0x2eb2('0x32')]);_0x5b4b94['filters']=_['intersection'](_0x5b4b94[_0x2eb2('0x31')],_0x5b4b94[_0x2eb2('0x32')]);_0x143c8d[_0x2eb2('0x35')]=_[_0x2eb2('0x34')](_0x5b4b94['model'],qs[_0x2eb2('0x36')](_0x359eb4[_0x2eb2('0x32')]['fields']));_0x143c8d[_0x2eb2('0x35')]=_0x143c8d['attributes'][_0x2eb2('0x37')]?_0x143c8d[_0x2eb2('0x35')]:_0x5b4b94[_0x2eb2('0x31')];_0x143c8d['order']=qs[_0x2eb2('0x39')](_0x359eb4[_0x2eb2('0x32')][_0x2eb2('0x39')]);_0x143c8d[_0x2eb2('0x3a')]=qs[_0x2eb2('0x4e')](_[_0x2eb2('0x50')](_0x359eb4[_0x2eb2('0x32')],_0x5b4b94[_0x2eb2('0x4e')]));if(_0x359eb4[_0x2eb2('0x32')]['filter']){_0x143c8d['where']=_[_0x2eb2('0x3b')](_0x143c8d[_0x2eb2('0x3a')],{'$or':_[_0x2eb2('0x2d')](_0x143c8d[_0x2eb2('0x35')],function(_0x565846){var _0x4f4f0e={};_0x4f4f0e[_0x565846]={'$like':'%'+_0x359eb4[_0x2eb2('0x32')][_0x2eb2('0x3d')]+'%'};return _0x4f4f0e;})});}_0x143c8d=_[_0x2eb2('0x3b')]({},_0x143c8d,_0x359eb4['options']);return _0x5b096e[_0x2eb2('0x52')](_0x143c8d);}})[_0x2eb2('0x27')](function(_0x177f8d){if(_0x177f8d){_0x1f8e10=_0x177f8d[_0x2eb2('0x37')];if(!_0x359eb4[_0x2eb2('0x32')][_0x2eb2('0x51')](_0x2eb2('0x38'))){_0x143c8d[_0x2eb2('0x20')]=qs[_0x2eb2('0x20')](_0x359eb4[_0x2eb2('0x32')][_0x2eb2('0x20')]);_0x143c8d['offset']=qs[_0x2eb2('0x1e')](_0x359eb4[_0x2eb2('0x32')][_0x2eb2('0x1e')]);}return _0x5b096e[_0x2eb2('0x52')](_0x143c8d);}})[_0x2eb2('0x27')](function(_0x52545f){if(_0x52545f){return _0x52545f?{'count':_0x1f8e10,'rows':_0x52545f}:null;}})[_0x2eb2('0x27')](respondWithResult(_0x2fcbbd,null))[_0x2eb2('0x43')](handleError(_0x2fcbbd,null));};exports[_0x2eb2('0x53')]=function(_0xff01b,_0x55245e,_0x2b78f4){var _0x586456={};var _0x406c88={};var _0x5be1e0;var _0x4cf938;return db[_0x2eb2('0x40')]['findOne']({'where':{'id':_0xff01b[_0x2eb2('0x45')]['id']}})['then'](handleEntityNotFound(_0x55245e,null))[_0x2eb2('0x27')](function(_0x22f38c){if(_0x22f38c){_0x5be1e0=_0x22f38c;_0x406c88[_0x2eb2('0x31')]=_[_0x2eb2('0x33')](db[_0x2eb2('0x4d')][_0x2eb2('0x46')]);_0x406c88[_0x2eb2('0x32')]=_[_0x2eb2('0x33')](_0xff01b['query']);_0x406c88['filters']=_['intersection'](_0x406c88[_0x2eb2('0x31')],_0x406c88['query']);_0x586456[_0x2eb2('0x35')]=_[_0x2eb2('0x34')](_0x406c88[_0x2eb2('0x31')],qs['fields'](_0xff01b[_0x2eb2('0x32')][_0x2eb2('0x36')]));_0x586456[_0x2eb2('0x35')]=_0x586456[_0x2eb2('0x35')]['length']?_0x586456[_0x2eb2('0x35')]:_0x406c88['model'];_0x586456[_0x2eb2('0x4f')]=qs['sort'](_0xff01b[_0x2eb2('0x32')][_0x2eb2('0x39')]);_0x586456[_0x2eb2('0x3a')]=qs[_0x2eb2('0x4e')](_[_0x2eb2('0x50')](_0xff01b['query'],_0x406c88[_0x2eb2('0x4e')]));if(_0xff01b[_0x2eb2('0x32')][_0x2eb2('0x3d')]){_0x586456[_0x2eb2('0x3a')]=_[_0x2eb2('0x3b')](_0x586456[_0x2eb2('0x3a')],{'$or':_['map'](_0x586456[_0x2eb2('0x35')],function(_0x25ce4d){var _0x1b51a0={};_0x1b51a0[_0x25ce4d]={'$like':'%'+_0xff01b[_0x2eb2('0x32')][_0x2eb2('0x3d')]+'%'};return _0x1b51a0;})});}_0x586456=_[_0x2eb2('0x3b')]({},_0x586456,_0xff01b[_0x2eb2('0x47')]);return _0x5be1e0['getDescriptions'](_0x586456);}})['then'](function(_0x3585e2){if(_0x3585e2){_0x4cf938=_0x3585e2[_0x2eb2('0x37')];if(!_0xff01b[_0x2eb2('0x32')]['hasOwnProperty'](_0x2eb2('0x38'))){_0x586456[_0x2eb2('0x20')]=qs[_0x2eb2('0x20')](_0xff01b[_0x2eb2('0x32')]['limit']);_0x586456[_0x2eb2('0x1e')]=qs['offset'](_0xff01b[_0x2eb2('0x32')][_0x2eb2('0x1e')]);}return _0x5be1e0[_0x2eb2('0x53')](_0x586456);}})[_0x2eb2('0x27')](function(_0x303d11){if(_0x303d11){return _0x303d11?{'count':_0x4cf938,'rows':_0x303d11}:null;}})[_0x2eb2('0x27')](respondWithResult(_0x55245e,null))[_0x2eb2('0x43')](handleError(_0x55245e,null));};exports['getTags']=function(_0x205d4f,_0xad4bf9,_0x34f580){var _0x42ba05={};var _0x7b2bde={};var _0x3dc2e2;var _0x36a73a;return db[_0x2eb2('0x40')]['findOne']({'where':{'id':_0x205d4f[_0x2eb2('0x45')]['id']}})[_0x2eb2('0x27')](handleEntityNotFound(_0xad4bf9,null))['then'](function(_0x2e757e){if(_0x2e757e){_0x3dc2e2=_0x2e757e;_0x7b2bde[_0x2eb2('0x31')]=_[_0x2eb2('0x33')](db[_0x2eb2('0x54')][_0x2eb2('0x46')]);_0x7b2bde[_0x2eb2('0x32')]=_[_0x2eb2('0x33')](_0x205d4f[_0x2eb2('0x32')]);_0x7b2bde[_0x2eb2('0x4e')]=_[_0x2eb2('0x34')](_0x7b2bde[_0x2eb2('0x31')],_0x7b2bde[_0x2eb2('0x32')]);_0x42ba05['attributes']=_[_0x2eb2('0x34')](_0x7b2bde[_0x2eb2('0x31')],qs[_0x2eb2('0x36')](_0x205d4f[_0x2eb2('0x32')]['fields']));_0x42ba05['attributes']=_0x42ba05[_0x2eb2('0x35')][_0x2eb2('0x37')]?_0x42ba05['attributes']:_0x7b2bde['model'];_0x42ba05[_0x2eb2('0x4f')]=qs[_0x2eb2('0x39')](_0x205d4f[_0x2eb2('0x32')][_0x2eb2('0x39')]);_0x42ba05[_0x2eb2('0x3a')]=qs[_0x2eb2('0x4e')](_[_0x2eb2('0x50')](_0x205d4f['query'],_0x7b2bde['filters']));if(_0x205d4f[_0x2eb2('0x32')][_0x2eb2('0x3d')]){_0x42ba05[_0x2eb2('0x3a')]=_[_0x2eb2('0x3b')](_0x42ba05[_0x2eb2('0x3a')],{'$or':_[_0x2eb2('0x2d')](_0x42ba05[_0x2eb2('0x35')],function(_0x5c0777){var _0x471f29={};_0x471f29[_0x5c0777]={'$like':'%'+_0x205d4f[_0x2eb2('0x32')][_0x2eb2('0x3d')]+'%'};return _0x471f29;})});}_0x42ba05=_[_0x2eb2('0x3b')]({},_0x42ba05,_0x205d4f[_0x2eb2('0x47')]);return _0x3dc2e2[_0x2eb2('0x55')](_0x42ba05);}})[_0x2eb2('0x27')](function(_0x450ce4){if(_0x450ce4){_0x36a73a=_0x450ce4[_0x2eb2('0x37')];if(!_0x205d4f[_0x2eb2('0x32')]['hasOwnProperty']('nolimit')){_0x42ba05[_0x2eb2('0x20')]=qs[_0x2eb2('0x20')](_0x205d4f[_0x2eb2('0x32')][_0x2eb2('0x20')]);_0x42ba05['offset']=qs[_0x2eb2('0x1e')](_0x205d4f['query']['offset']);}return _0x3dc2e2[_0x2eb2('0x55')](_0x42ba05);}})[_0x2eb2('0x27')](function(_0x3754a1){if(_0x3754a1){return _0x3754a1?{'count':_0x36a73a,'rows':_0x3754a1}:null;}})[_0x2eb2('0x27')](respondWithResult(_0xad4bf9,null))[_0x2eb2('0x43')](handleError(_0xad4bf9,null));};exports['setTags']=function(_0x5ce8cc,_0x2d2e04,_0x4532fb){if(_0x5ce8cc['body']['id']){delete _0x5ce8cc[_0x2eb2('0x4a')]['id'];}return db[_0x2eb2('0x40')]['findOne']({'where':{'id':_0x5ce8cc[_0x2eb2('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d2e04,null))[_0x2eb2('0x27')](function(_0x5a5d62){if(_0x5a5d62){return _0x5a5d62['setTags'](_0x5ce8cc[_0x2eb2('0x4a')][_0x2eb2('0x56')]||[]);}return null;})[_0x2eb2('0x27')](respondWithResult(_0x2d2e04,null))[_0x2eb2('0x43')](handleError(_0x2d2e04,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 39c7f76..7cf1053 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 _0x2227=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','lodash'];(function(_0x2aaf98,_0x4bf142){var _0x2d7774=function(_0x1b1e59){while(--_0x1b1e59){_0x2aaf98['push'](_0x2aaf98['shift']());}};_0x2d7774(++_0x4bf142);}(_0x2227,0x143));var _0x7222=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0x2227[_0x2d8434];return _0x26b9e4;};'use strict';var _=require(_0x7222('0x0'));var util=require('util');var logger=require(_0x7222('0x1'))(_0x7222('0x2'));var moment=require(_0x7222('0x3'));var BPromise=require(_0x7222('0x4'));var rp=require(_0x7222('0x5'));var fs=require('fs');var path=require(_0x7222('0x6'));var rimraf=require(_0x7222('0x7'));var config=require(_0x7222('0x8'));var attributes=require(_0x7222('0x9'));module['exports']=function(_0x2cdd4b,_0x3e62d3){return _0x2cdd4b[_0x7222('0xa')](_0x7222('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2621=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','lodash','util'];(function(_0x8f448c,_0x5587a4){var _0x24b4e3=function(_0x486544){while(--_0x486544){_0x8f448c['push'](_0x8f448c['shift']());}};_0x24b4e3(++_0x5587a4);}(_0x2621,0x1d2));var _0x1262=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2621[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1262('0x0'));var util=require(_0x1262('0x1'));var logger=require(_0x1262('0x2'))(_0x1262('0x3'));var moment=require(_0x1262('0x4'));var BPromise=require(_0x1262('0x5'));var rp=require(_0x1262('0x6'));var fs=require('fs');var path=require(_0x1262('0x7'));var rimraf=require(_0x1262('0x8'));var config=require(_0x1262('0x9'));var attributes=require(_0x1262('0xa'));module[_0x1262('0xb')]=function(_0x421716,_0x16075c){return _0x421716['define'](_0x1262('0xc'),attributes,{'tableName':'int_desk_configurations','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 704e163..c01cb21 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 _0x7275=['util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x2aa2db,_0x1de39d){var _0x57eb41=function(_0x49d87a){while(--_0x49d87a){_0x2aa2db['push'](_0x2aa2db['shift']());}};_0x57eb41(++_0x1de39d);}(_0x7275,0x143));var _0x5727=function(_0x4f26e7,_0x35de07){_0x4f26e7=_0x4f26e7-0x0;var _0x5e501c=_0x7275[_0x4f26e7];return _0x5e501c;};'use strict';var _=require(_0x5727('0x0'));var util=require(_0x5727('0x1'));var moment=require(_0x5727('0x2'));var BPromise=require('bluebird');var rs=require(_0x5727('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5727('0x4'))['db'];var utils=require(_0x5727('0x5'));var logger=require('../../config/logger')(_0x5727('0x6'));var config=require(_0x5727('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x336262,_0x49184a,_0x33a6fe){return new BPromise(function(_0x4de37c,_0x129402){return client['request'](_0x336262,_0x33a6fe)[_0x5727('0x8')](function(_0x18e712){logger['info'](_0x5727('0x9'),_0x49184a,_0x5727('0xa'));logger['debug'](_0x5727('0xb'),_0x49184a,_0x5727('0xa'),JSON['stringify'](_0x18e712));if(_0x18e712[_0x5727('0xc')]){if(_0x18e712[_0x5727('0xc')][_0x5727('0xd')]===0x1f4){logger[_0x5727('0xc')](_0x5727('0x9'),_0x49184a,_0x18e712[_0x5727('0xc')]['message']);return _0x129402(_0x18e712[_0x5727('0xc')][_0x5727('0xe')]);}logger[_0x5727('0xc')](_0x5727('0x9'),_0x49184a,_0x18e712[_0x5727('0xc')][_0x5727('0xe')]);return _0x4de37c(_0x18e712[_0x5727('0xc')]['message']);}else{logger[_0x5727('0xf')](_0x5727('0x9'),_0x49184a,_0x5727('0xa'));_0x4de37c(_0x18e712[_0x5727('0x10')][_0x5727('0xe')]);}})[_0x5727('0x11')](function(_0x273dc9){logger['error'](_0x5727('0x9'),_0x49184a,_0x273dc9);_0x129402(_0x273dc9);});});} \ No newline at end of file +var _0xa413=['result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info'];(function(_0x39cbe4,_0x4a7958){var _0xe76ba7=function(_0x332a08){while(--_0x332a08){_0x39cbe4['push'](_0x39cbe4['shift']());}};_0xe76ba7(++_0x4a7958);}(_0xa413,0x1e5));var _0x3a41=function(_0x5413c1,_0x3e9985){_0x5413c1=_0x5413c1-0x0;var _0x39cef7=_0xa413[_0x5413c1];return _0x39cef7;};'use strict';var _=require(_0x3a41('0x0'));var util=require('util');var moment=require(_0x3a41('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a41('0x2'));var fs=require('fs');var Redis=require(_0x3a41('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3a41('0x4'))(_0x3a41('0x5'));var config=require(_0x3a41('0x6'));var jayson=require(_0x3a41('0x7'));var client=jayson[_0x3a41('0x8')][_0x3a41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45f6d2,_0x407d52,_0xca7253){return new BPromise(function(_0x473cd2,_0x27c2e5){return client['request'](_0x45f6d2,_0xca7253)[_0x3a41('0xa')](function(_0x570304){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x407d52,_0x3a41('0xb'));logger['debug'](_0x3a41('0xc'),_0x407d52,'request\x20sent',JSON[_0x3a41('0xd')](_0x570304));if(_0x570304[_0x3a41('0xe')]){if(_0x570304['error'][_0x3a41('0xf')]===0x1f4){logger[_0x3a41('0xe')](_0x3a41('0x10'),_0x407d52,_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);return _0x27c2e5(_0x570304['error'][_0x3a41('0x11')]);}logger[_0x3a41('0xe')](_0x3a41('0x10'),_0x407d52,_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);return _0x473cd2(_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);}else{logger[_0x3a41('0x12')](_0x3a41('0x10'),_0x407d52,_0x3a41('0xb'));_0x473cd2(_0x570304[_0x3a41('0x13')]['message']);}})[_0x3a41('0x14')](function(_0x30d675){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x407d52,_0x30d675);_0x27c2e5(_0x30d675);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index febaf05..b70fd4f 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 _0x7b77=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x1bd1b8,_0x55a6fa){var _0x2c3dea=function(_0x426b92){while(--_0x426b92){_0x1bd1b8['push'](_0x1bd1b8['shift']());}};_0x2c3dea(++_0x55a6fa);}(_0x7b77,0x179));var _0x77b7=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x7b77[_0x3fba9f];return _0x192cf1;};'use strict';var multer=require(_0x77b7('0x0'));var util=require(_0x77b7('0x1'));var path=require(_0x77b7('0x2'));var timeout=require(_0x77b7('0x3'));var express=require('express');var router=express[_0x77b7('0x4')]();var fs_extra=require(_0x77b7('0x5'));var auth=require(_0x77b7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x77b7('0x7'));var controller=require(_0x77b7('0x8'));router[_0x77b7('0x9')]('/',auth[_0x77b7('0xa')](),controller[_0x77b7('0xb')]);router[_0x77b7('0x9')]('/:id',auth[_0x77b7('0xa')](),controller[_0x77b7('0xc')]);router[_0x77b7('0xd')]('/',auth['isAuthenticated'](),controller[_0x77b7('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x77b7('0xf')]);router[_0x77b7('0x10')]('/:id',auth[_0x77b7('0xa')](),controller[_0x77b7('0x11')]);module[_0x77b7('0x12')]=router; \ No newline at end of file +var _0xdc7e=['fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x12b36c,_0x37af5c){var _0x11eb1e=function(_0x34b018){while(--_0x34b018){_0x12b36c['push'](_0x12b36c['shift']());}};_0x11eb1e(++_0x37af5c);}(_0xdc7e,0x1e9));var _0xedc7=function(_0x202a7a,_0x1d910b){_0x202a7a=_0x202a7a-0x0;var _0x5f4254=_0xdc7e[_0x202a7a];return _0x5f4254;};'use strict';var multer=require(_0xedc7('0x0'));var util=require(_0xedc7('0x1'));var path=require('path');var timeout=require(_0xedc7('0x2'));var express=require(_0xedc7('0x3'));var router=express[_0xedc7('0x4')]();var fs_extra=require(_0xedc7('0x5'));var auth=require(_0xedc7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xedc7('0x7'));var controller=require('./intDeskField.controller');router[_0xedc7('0x8')]('/',auth['isAuthenticated'](),controller[_0xedc7('0x9')]);router[_0xedc7('0x8')](_0xedc7('0xa'),auth['isAuthenticated'](),controller[_0xedc7('0xb')]);router[_0xedc7('0xc')]('/',auth[_0xedc7('0xd')](),controller[_0xedc7('0xe')]);router[_0xedc7('0xf')](_0xedc7('0xa'),auth[_0xedc7('0xd')](),controller[_0xedc7('0x10')]);router[_0xedc7('0x11')](_0xedc7('0xa'),auth[_0xedc7('0xd')](),controller['destroy']);module[_0xedc7('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 80c4c2c..f04dd15 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 _0x4420=['customVariable','string','variable','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x5a0f6b,_0x36abbe){var _0x14f144=function(_0x4aaf68){while(--_0x4aaf68){_0x5a0f6b['push'](_0x5a0f6b['shift']());}};_0x14f144(++_0x36abbe);}(_0x4420,0x1ad));var _0x0442=function(_0x1b862f,_0x33bb1a){_0x1b862f=_0x1b862f-0x0;var _0x408042=_0x4420[_0x1b862f];return _0x408042;};'use strict';var Sequelize=require(_0x0442('0x0'));module[_0x0442('0x1')]={'type':{'type':Sequelize[_0x0442('0x2')]('string','variable',_0x0442('0x3'),'keyValue','picklist'),'defaultValue':_0x0442('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0442('0x2')](_0x0442('0x4'),_0x0442('0x5'),'customVariable')},'keyContent':{'type':Sequelize[_0x0442('0x6')]},'idField':{'type':Sequelize[_0x0442('0x6')]},'nameField':{'type':Sequelize[_0x0442('0x6')]},'customField':{'type':Sequelize[_0x0442('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0442('0x6')]}}; \ No newline at end of file +var _0xc33d=['STRING','variable','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x25e009,_0x458c1a){var _0x3dd51b=function(_0x3046da){while(--_0x3046da){_0x25e009['push'](_0x25e009['shift']());}};_0x3dd51b(++_0x458c1a);}(_0xc33d,0x110));var _0xdc33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc33d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdc33('0x0'));module[_0xdc33('0x1')]={'type':{'type':Sequelize[_0xdc33('0x2')](_0xdc33('0x3'),'variable',_0xdc33('0x4'),_0xdc33('0x5'),_0xdc33('0x6')),'defaultValue':_0xdc33('0x3')},'content':{'type':Sequelize[_0xdc33('0x7')]},'key':{'type':Sequelize[_0xdc33('0x7')]},'keyType':{'type':Sequelize[_0xdc33('0x2')](_0xdc33('0x3'),_0xdc33('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0xdc33('0x7')]},'idField':{'type':Sequelize[_0xdc33('0x7')]},'nameField':{'type':Sequelize[_0xdc33('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'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 7abb55e..5490128 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 _0xf03a=['error','stack','send','index','map','DeskField','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','include','findAll','catch','show','params','length','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','limit','undefined','count','status','set','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x3f0cae,_0x23fd65){var _0x1ed385=function(_0x51a2c2){while(--_0x51a2c2){_0x3f0cae['push'](_0x3f0cae['shift']());}};_0x1ed385(++_0x23fd65);}(_0xf03a,0x1a0));var _0xaf03=function(_0x1d9761,_0x53cc57){_0x1d9761=_0x1d9761-0x0;var _0x2d6c8b=_0xf03a[_0x1d9761];return _0x2d6c8b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf03('0x0'));var zipdir=require(_0xaf03('0x1'));var jsonpatch=require(_0xaf03('0x2'));var rp=require(_0xaf03('0x3'));var moment=require('moment');var BPromise=require(_0xaf03('0x4'));var Mustache=require(_0xaf03('0x5'));var util=require('util');var path=require(_0xaf03('0x6'));var sox=require(_0xaf03('0x7'));var csv=require(_0xaf03('0x8'));var ejs=require(_0xaf03('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf03('0xa'));var squel=require('squel');var crypto=require(_0xaf03('0xb'));var jsforce=require(_0xaf03('0xc'));var deskjs=require(_0xaf03('0xd'));var toCsv=require(_0xaf03('0x8'));var querystring=require(_0xaf03('0xe'));var Papa=require(_0xaf03('0xf'));var Redis=require('ioredis');var authService=require(_0xaf03('0x10'));var qs=require(_0xaf03('0x11'));var as=require(_0xaf03('0x12'));var hardwareService=require(_0xaf03('0x13'));var logger=require(_0xaf03('0x14'))('api');var utils=require(_0xaf03('0x15'));var config=require(_0xaf03('0x16'));var licenseUtil=require(_0xaf03('0x17'));var db=require(_0xaf03('0x18'))['db'];function respondWithStatusCode(_0x37156e,_0x216ccd){_0x216ccd=_0x216ccd||0xcc;return function(_0x2b1ccf){if(_0x2b1ccf){return _0x37156e['sendStatus'](_0x216ccd);}return _0x37156e['status'](_0x216ccd)[_0xaf03('0x19')]();};}function respondWithResult(_0x525cfb,_0x464635){_0x464635=_0x464635||0xc8;return function(_0x550e22){if(_0x550e22){return _0x525cfb['status'](_0x464635)[_0xaf03('0x1a')](_0x550e22);}};}function respondWithFilteredResult(_0x2d825c,_0x38ca61){return function(_0x2de266){if(_0x2de266){var _0x342f7a=typeof _0x38ca61[_0xaf03('0x1b')]==='undefined'&&typeof _0x38ca61[_0xaf03('0x1c')]===_0xaf03('0x1d');var _0x12bd6=_0x2de266[_0xaf03('0x1e')];var _0x24a074=_0x342f7a?0x0:_0x38ca61[_0xaf03('0x1b')];var _0x5cede9=_0x342f7a?_0x2de266['count']:_0x38ca61[_0xaf03('0x1b')]+_0x38ca61[_0xaf03('0x1c')];var _0x3f5064;if(_0x5cede9>=_0x12bd6){_0x5cede9=_0x12bd6;_0x3f5064=0xc8;}else{_0x3f5064=0xce;}_0x2d825c[_0xaf03('0x1f')](_0x3f5064);return _0x2d825c[_0xaf03('0x20')]('Content-Range',_0x24a074+'-'+_0x5cede9+'/'+_0x12bd6)[_0xaf03('0x1a')](_0x2de266);}return null;};}function patchUpdates(_0x55eca3){return function(_0x14f5e3){try{jsonpatch[_0xaf03('0x21')](_0x14f5e3,_0x55eca3,!![]);}catch(_0x9e28b4){return BPromise[_0xaf03('0x22')](_0x9e28b4);}return _0x14f5e3[_0xaf03('0x23')]();};}function saveUpdates(_0x3664b6,_0x230dd7){return function(_0x1cefca){if(_0x1cefca){return _0x1cefca[_0xaf03('0x24')](_0x3664b6)[_0xaf03('0x25')](function(_0x1e8cac){return _0x1e8cac;});}return null;};}function removeEntity(_0x49cb83,_0x47647f){return function(_0x1ab68b){if(_0x1ab68b){return _0x1ab68b[_0xaf03('0x26')]()[_0xaf03('0x25')](function(){_0x49cb83['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38aa61,_0x382e43){return function(_0x4db61b){if(!_0x4db61b){_0x38aa61[_0xaf03('0x27')](0x194);}return _0x4db61b;};}function handleError(_0xec24e2,_0x247b05){_0x247b05=_0x247b05||0x1f4;return function(_0x1b1ac8){logger[_0xaf03('0x28')](_0x1b1ac8[_0xaf03('0x29')]);if(_0x1b1ac8['name']){delete _0x1b1ac8['name'];}_0xec24e2[_0xaf03('0x1f')](_0x247b05)[_0xaf03('0x2a')](_0x1b1ac8);};}exports[_0xaf03('0x2b')]=function(_0x166a23,_0x416728){var _0x3a74b9={},_0x2e2d91={},_0x4e98c1={'count':0x0,'rows':[]};var _0x256ed5=_[_0xaf03('0x2c')](db[_0xaf03('0x2d')][_0xaf03('0x2e')],function(_0xe05319){return{'name':_0xe05319['fieldName'],'type':_0xe05319[_0xaf03('0x2f')][_0xaf03('0x30')]};});_0x2e2d91['model']=_[_0xaf03('0x2c')](_0x256ed5,'name');_0x2e2d91[_0xaf03('0x31')]=_[_0xaf03('0x32')](_0x166a23[_0xaf03('0x31')]);_0x2e2d91[_0xaf03('0x33')]=_[_0xaf03('0x34')](_0x2e2d91[_0xaf03('0x35')],_0x2e2d91['query']);_0x3a74b9[_0xaf03('0x36')]=_['intersection'](_0x2e2d91[_0xaf03('0x35')],qs[_0xaf03('0x37')](_0x166a23[_0xaf03('0x31')][_0xaf03('0x37')]));_0x3a74b9['attributes']=_0x3a74b9['attributes']['length']?_0x3a74b9[_0xaf03('0x36')]:_0x2e2d91[_0xaf03('0x35')];if(!_0x166a23[_0xaf03('0x31')][_0xaf03('0x38')]('nolimit')){_0x3a74b9[_0xaf03('0x1c')]=qs[_0xaf03('0x1c')](_0x166a23[_0xaf03('0x31')][_0xaf03('0x1c')]);_0x3a74b9['offset']=qs[_0xaf03('0x1b')](_0x166a23['query'][_0xaf03('0x1b')]);}_0x3a74b9[_0xaf03('0x39')]=qs[_0xaf03('0x3a')](_0x166a23[_0xaf03('0x31')][_0xaf03('0x3a')]);_0x3a74b9[_0xaf03('0x3b')]=qs[_0xaf03('0x33')](_[_0xaf03('0x3c')](_0x166a23[_0xaf03('0x31')],_0x2e2d91['filters']),_0x256ed5);if(_0x166a23[_0xaf03('0x31')][_0xaf03('0x3d')]){_0x3a74b9[_0xaf03('0x3b')]=_[_0xaf03('0x3e')](_0x3a74b9[_0xaf03('0x3b')],{'$or':_['map'](_0x256ed5,function(_0x2e22c8){if(_0x2e22c8['type']!==_0xaf03('0x3f')){var _0x477b31={};_0x477b31[_0x2e22c8[_0xaf03('0x40')]]={'$like':'%'+_0x166a23[_0xaf03('0x31')]['filter']+'%'};return _0x477b31;}})});}_0x3a74b9=_[_0xaf03('0x3e')]({},_0x3a74b9,_0x166a23[_0xaf03('0x41')]);var _0x41a323={'where':_0x3a74b9[_0xaf03('0x3b')]};return db[_0xaf03('0x2d')][_0xaf03('0x1e')](_0x41a323)[_0xaf03('0x25')](function(_0x49236c){_0x4e98c1['count']=_0x49236c;if(_0x166a23[_0xaf03('0x31')]['includeAll']){_0x3a74b9[_0xaf03('0x42')]=[{'all':!![]}];}return db[_0xaf03('0x2d')][_0xaf03('0x43')](_0x3a74b9);})[_0xaf03('0x25')](function(_0x184a88){_0x4e98c1['rows']=_0x184a88;return _0x4e98c1;})[_0xaf03('0x25')](respondWithFilteredResult(_0x416728,_0x3a74b9))[_0xaf03('0x44')](handleError(_0x416728,null));};exports[_0xaf03('0x45')]=function(_0x17efbd,_0x11c11e){var _0x27ad10={'raw':!![],'where':{'id':_0x17efbd[_0xaf03('0x46')]['id']}},_0x133531={};_0x133531['model']=_[_0xaf03('0x32')](db[_0xaf03('0x2d')][_0xaf03('0x2e')]);_0x133531[_0xaf03('0x31')]=_['keys'](_0x17efbd[_0xaf03('0x31')]);_0x133531[_0xaf03('0x33')]=_[_0xaf03('0x34')](_0x133531[_0xaf03('0x35')],_0x133531[_0xaf03('0x31')]);_0x27ad10[_0xaf03('0x36')]=_['intersection'](_0x133531[_0xaf03('0x35')],qs[_0xaf03('0x37')](_0x17efbd[_0xaf03('0x31')][_0xaf03('0x37')]));_0x27ad10['attributes']=_0x27ad10[_0xaf03('0x36')][_0xaf03('0x47')]?_0x27ad10[_0xaf03('0x36')]:_0x133531[_0xaf03('0x35')];if(_0x17efbd[_0xaf03('0x31')][_0xaf03('0x48')]){_0x27ad10[_0xaf03('0x42')]=[{'all':!![]}];}_0x27ad10=_['merge']({},_0x27ad10,_0x17efbd[_0xaf03('0x41')]);return db[_0xaf03('0x2d')][_0xaf03('0x49')](_0x27ad10)[_0xaf03('0x25')](handleEntityNotFound(_0x11c11e,null))['then'](respondWithResult(_0x11c11e,null))[_0xaf03('0x44')](handleError(_0x11c11e,null));};exports['create']=function(_0x5a073b,_0x14dc29){return db[_0xaf03('0x2d')][_0xaf03('0x4a')](_0x5a073b['body'],{})[_0xaf03('0x25')](respondWithResult(_0x14dc29,0xc9))[_0xaf03('0x44')](handleError(_0x14dc29,null));};exports['update']=function(_0x53767e,_0x172cc0){if(_0x53767e[_0xaf03('0x4b')]['id']){delete _0x53767e[_0xaf03('0x4b')]['id'];}return db[_0xaf03('0x2d')][_0xaf03('0x49')]({'where':{'id':_0x53767e[_0xaf03('0x46')]['id']}})[_0xaf03('0x25')](handleEntityNotFound(_0x172cc0,null))['then'](saveUpdates(_0x53767e[_0xaf03('0x4b')],null))['then'](respondWithResult(_0x172cc0,null))['catch'](handleError(_0x172cc0,null));};exports[_0xaf03('0x26')]=function(_0x235043,_0x83c57f){return db[_0xaf03('0x2d')]['find']({'where':{'id':_0x235043[_0xaf03('0x46')]['id']}})[_0xaf03('0x25')](handleEntityNotFound(_0x83c57f,null))[_0xaf03('0x25')](removeEntity(_0x83c57f,null))[_0xaf03('0x44')](handleError(_0x83c57f,null));}; \ No newline at end of file +var _0xa68e=['querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','send','index','DeskField','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x53d95a,_0x5a5c24){var _0x48975a=function(_0x22d45a){while(--_0x22d45a){_0x53d95a['push'](_0x53d95a['shift']());}};_0x48975a(++_0x5a5c24);}(_0xa68e,0xd3));var _0xea68=function(_0x3a4838,_0x5eb63c){_0x3a4838=_0x3a4838-0x0;var _0x10fc53=_0xa68e[_0x3a4838];return _0x10fc53;};'use strict';var emlformat=require(_0xea68('0x0'));var rimraf=require(_0xea68('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea68('0x2'));var rp=require(_0xea68('0x3'));var moment=require(_0xea68('0x4'));var BPromise=require(_0xea68('0x5'));var Mustache=require(_0xea68('0x6'));var util=require(_0xea68('0x7'));var path=require(_0xea68('0x8'));var sox=require(_0xea68('0x9'));var csv=require(_0xea68('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea68('0xb'));var _=require(_0xea68('0xc'));var squel=require(_0xea68('0xd'));var crypto=require(_0xea68('0xe'));var jsforce=require(_0xea68('0xf'));var deskjs=require(_0xea68('0x10'));var toCsv=require(_0xea68('0xa'));var querystring=require(_0xea68('0x11'));var Papa=require(_0xea68('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xea68('0x13'));var hardwareService=require(_0xea68('0x14'));var logger=require('../../config/logger')(_0xea68('0x15'));var utils=require(_0xea68('0x16'));var config=require(_0xea68('0x17'));var licenseUtil=require(_0xea68('0x18'));var db=require(_0xea68('0x19'))['db'];function respondWithStatusCode(_0x82f070,_0x36c239){_0x36c239=_0x36c239||0xcc;return function(_0x1e73d3){if(_0x1e73d3){return _0x82f070[_0xea68('0x1a')](_0x36c239);}return _0x82f070[_0xea68('0x1b')](_0x36c239)[_0xea68('0x1c')]();};}function respondWithResult(_0x540a23,_0x17bd4a){_0x17bd4a=_0x17bd4a||0xc8;return function(_0x5d460c){if(_0x5d460c){return _0x540a23[_0xea68('0x1b')](_0x17bd4a)[_0xea68('0x1d')](_0x5d460c);}};}function respondWithFilteredResult(_0x4f0b72,_0x4b520a){return function(_0x3f591d){if(_0x3f591d){var _0x1d1ae5=typeof _0x4b520a[_0xea68('0x1e')]===_0xea68('0x1f')&&typeof _0x4b520a[_0xea68('0x20')]===_0xea68('0x1f');var _0x255cfb=_0x3f591d[_0xea68('0x21')];var _0x38cb81=_0x1d1ae5?0x0:_0x4b520a[_0xea68('0x1e')];var _0x4cc7e6=_0x1d1ae5?_0x3f591d['count']:_0x4b520a['offset']+_0x4b520a[_0xea68('0x20')];var _0x43cbbe;if(_0x4cc7e6>=_0x255cfb){_0x4cc7e6=_0x255cfb;_0x43cbbe=0xc8;}else{_0x43cbbe=0xce;}_0x4f0b72[_0xea68('0x1b')](_0x43cbbe);return _0x4f0b72['set']('Content-Range',_0x38cb81+'-'+_0x4cc7e6+'/'+_0x255cfb)[_0xea68('0x1d')](_0x3f591d);}return null;};}function patchUpdates(_0x48f636){return function(_0x28e643){try{jsonpatch[_0xea68('0x22')](_0x28e643,_0x48f636,!![]);}catch(_0x1d2eb5){return BPromise[_0xea68('0x23')](_0x1d2eb5);}return _0x28e643['save']();};}function saveUpdates(_0x5033bf,_0x39bcfa){return function(_0x5e7cf1){if(_0x5e7cf1){return _0x5e7cf1[_0xea68('0x24')](_0x5033bf)[_0xea68('0x25')](function(_0x1744f3){return _0x1744f3;});}return null;};}function removeEntity(_0x577d0a,_0x151a69){return function(_0x42aa24){if(_0x42aa24){return _0x42aa24[_0xea68('0x26')]()[_0xea68('0x25')](function(){_0x577d0a[_0xea68('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f1d0e,_0x2d0029){return function(_0x19e327){if(!_0x19e327){_0x2f1d0e[_0xea68('0x1a')](0x194);}return _0x19e327;};}function handleError(_0x24fdf5,_0x2a0ff5){_0x2a0ff5=_0x2a0ff5||0x1f4;return function(_0x277948){logger[_0xea68('0x27')](_0x277948[_0xea68('0x28')]);if(_0x277948[_0xea68('0x29')]){delete _0x277948[_0xea68('0x29')];}_0x24fdf5['status'](_0x2a0ff5)[_0xea68('0x2a')](_0x277948);};}exports[_0xea68('0x2b')]=function(_0x36384e,_0xe0879e){var _0x481eb3={},_0x8c72ed={},_0x54ce75={'count':0x0,'rows':[]};var _0x17ef94=_['map'](db[_0xea68('0x2c')][_0xea68('0x2d')],function(_0x33c3c3){return{'name':_0x33c3c3[_0xea68('0x2e')],'type':_0x33c3c3['type'][_0xea68('0x2f')]};});_0x8c72ed[_0xea68('0x30')]=_[_0xea68('0x31')](_0x17ef94,_0xea68('0x29'));_0x8c72ed[_0xea68('0x32')]=_[_0xea68('0x33')](_0x36384e[_0xea68('0x32')]);_0x8c72ed[_0xea68('0x34')]=_[_0xea68('0x35')](_0x8c72ed['model'],_0x8c72ed[_0xea68('0x32')]);_0x481eb3['attributes']=_[_0xea68('0x35')](_0x8c72ed[_0xea68('0x30')],qs[_0xea68('0x36')](_0x36384e[_0xea68('0x32')][_0xea68('0x36')]));_0x481eb3['attributes']=_0x481eb3[_0xea68('0x37')][_0xea68('0x38')]?_0x481eb3['attributes']:_0x8c72ed[_0xea68('0x30')];if(!_0x36384e[_0xea68('0x32')][_0xea68('0x39')](_0xea68('0x3a'))){_0x481eb3['limit']=qs['limit'](_0x36384e[_0xea68('0x32')]['limit']);_0x481eb3[_0xea68('0x1e')]=qs['offset'](_0x36384e[_0xea68('0x32')][_0xea68('0x1e')]);}_0x481eb3[_0xea68('0x3b')]=qs['sort'](_0x36384e['query'][_0xea68('0x3c')]);_0x481eb3['where']=qs[_0xea68('0x34')](_[_0xea68('0x3d')](_0x36384e['query'],_0x8c72ed[_0xea68('0x34')]),_0x17ef94);if(_0x36384e['query'][_0xea68('0x3e')]){_0x481eb3[_0xea68('0x3f')]=_[_0xea68('0x40')](_0x481eb3[_0xea68('0x3f')],{'$or':_['map'](_0x17ef94,function(_0x3f92a3){if(_0x3f92a3['type']!==_0xea68('0x41')){var _0x5314c2={};_0x5314c2[_0x3f92a3[_0xea68('0x29')]]={'$like':'%'+_0x36384e[_0xea68('0x32')][_0xea68('0x3e')]+'%'};return _0x5314c2;}})});}_0x481eb3=_['merge']({},_0x481eb3,_0x36384e['options']);var _0x41852e={'where':_0x481eb3[_0xea68('0x3f')]};return db[_0xea68('0x2c')][_0xea68('0x21')](_0x41852e)[_0xea68('0x25')](function(_0x264f0f){_0x54ce75['count']=_0x264f0f;if(_0x36384e['query'][_0xea68('0x42')]){_0x481eb3['include']=[{'all':!![]}];}return db[_0xea68('0x2c')][_0xea68('0x43')](_0x481eb3);})[_0xea68('0x25')](function(_0x3f04c4){_0x54ce75[_0xea68('0x44')]=_0x3f04c4;return _0x54ce75;})['then'](respondWithFilteredResult(_0xe0879e,_0x481eb3))[_0xea68('0x45')](handleError(_0xe0879e,null));};exports[_0xea68('0x46')]=function(_0x4c1db7,_0x35634a){var _0x461b8b={'raw':!![],'where':{'id':_0x4c1db7[_0xea68('0x47')]['id']}},_0xb99c04={};_0xb99c04[_0xea68('0x30')]=_[_0xea68('0x33')](db[_0xea68('0x2c')][_0xea68('0x2d')]);_0xb99c04[_0xea68('0x32')]=_['keys'](_0x4c1db7[_0xea68('0x32')]);_0xb99c04['filters']=_[_0xea68('0x35')](_0xb99c04[_0xea68('0x30')],_0xb99c04['query']);_0x461b8b[_0xea68('0x37')]=_['intersection'](_0xb99c04[_0xea68('0x30')],qs[_0xea68('0x36')](_0x4c1db7[_0xea68('0x32')]['fields']));_0x461b8b['attributes']=_0x461b8b['attributes']['length']?_0x461b8b['attributes']:_0xb99c04[_0xea68('0x30')];if(_0x4c1db7[_0xea68('0x32')]['includeAll']){_0x461b8b['include']=[{'all':!![]}];}_0x461b8b=_[_0xea68('0x40')]({},_0x461b8b,_0x4c1db7[_0xea68('0x48')]);return db[_0xea68('0x2c')][_0xea68('0x49')](_0x461b8b)[_0xea68('0x25')](handleEntityNotFound(_0x35634a,null))[_0xea68('0x25')](respondWithResult(_0x35634a,null))[_0xea68('0x45')](handleError(_0x35634a,null));};exports[_0xea68('0x4a')]=function(_0x3ee5ea,_0x1b0249){return db['DeskField'][_0xea68('0x4a')](_0x3ee5ea['body'],{})[_0xea68('0x25')](respondWithResult(_0x1b0249,0xc9))[_0xea68('0x45')](handleError(_0x1b0249,null));};exports[_0xea68('0x24')]=function(_0x1f9c45,_0x1b17f1){if(_0x1f9c45[_0xea68('0x4b')]['id']){delete _0x1f9c45[_0xea68('0x4b')]['id'];}return db[_0xea68('0x2c')][_0xea68('0x49')]({'where':{'id':_0x1f9c45['params']['id']}})[_0xea68('0x25')](handleEntityNotFound(_0x1b17f1,null))['then'](saveUpdates(_0x1f9c45['body'],null))[_0xea68('0x25')](respondWithResult(_0x1b17f1,null))['catch'](handleError(_0x1b17f1,null));};exports[_0xea68('0x26')]=function(_0x4dd956,_0x605ba0){return db['DeskField'][_0xea68('0x49')]({'where':{'id':_0x4dd956[_0xea68('0x47')]['id']}})[_0xea68('0x25')](handleEntityNotFound(_0x605ba0,null))[_0xea68('0x25')](removeEntity(_0x605ba0,null))['catch'](handleError(_0x605ba0,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index fbc603a..f28c652 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 _0x943a=['api','moment','bluebird','request-promise','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId'];(function(_0x50d5b1,_0x2e4eae){var _0x3fded0=function(_0x4670df){while(--_0x4670df){_0x50d5b1['push'](_0x50d5b1['shift']());}};_0x3fded0(++_0x2e4eae);}(_0x943a,0x9c));var _0xa943=function(_0x5ae674,_0xfb459a){_0x5ae674=_0x5ae674-0x0;var _0x4d4082=_0x943a[_0x5ae674];return _0x4d4082;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa943('0x0'));var moment=require(_0xa943('0x1'));var BPromise=require(_0xa943('0x2'));var rp=require(_0xa943('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa943('0x4'));var attributes=require(_0xa943('0x5'));module[_0xa943('0x6')]=function(_0x404976,_0x330263){return _0x404976[_0xa943('0x7')](_0xa943('0x8'),attributes,{'tableName':_0xa943('0x9'),'paranoid':![],'indexes':[{'name':_0xa943('0xa'),'fields':[_0xa943('0xb'),_0xa943('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3bce=['FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','desk_unique_index','idField'];(function(_0x4c0d82,_0x440239){var _0x23ff35=function(_0x1522cf){while(--_0x1522cf){_0x4c0d82['push'](_0x4c0d82['shift']());}};_0x23ff35(++_0x440239);}(_0x3bce,0x131));var _0xe3bc=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x3bce[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xe3bc('0x0'));var util=require(_0xe3bc('0x1'));var logger=require(_0xe3bc('0x2'))(_0xe3bc('0x3'));var moment=require(_0xe3bc('0x4'));var BPromise=require('bluebird');var rp=require(_0xe3bc('0x5'));var fs=require('fs');var path=require(_0xe3bc('0x6'));var rimraf=require(_0xe3bc('0x7'));var config=require(_0xe3bc('0x8'));var attributes=require(_0xe3bc('0x9'));module[_0xe3bc('0xa')]=function(_0x799b71,_0x201931){return _0x799b71[_0xe3bc('0xb')](_0xe3bc('0xc'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xe3bc('0xd'),'fields':[_0xe3bc('0xe'),_0xe3bc('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 40002fc..b3142aa 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 _0xc582=['rpc','../../config/environment','client','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x40f4cc,_0x432f55){var _0x458315=function(_0xcfda5e){while(--_0xcfda5e){_0x40f4cc['push'](_0x40f4cc['shift']());}};_0x458315(++_0x432f55);}(_0xc582,0x187));var _0x2c58=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0xc582[_0x52684f];return _0x4a55f0;};'use strict';var _=require(_0x2c58('0x0'));var util=require('util');var moment=require(_0x2c58('0x1'));var BPromise=require(_0x2c58('0x2'));var rs=require(_0x2c58('0x3'));var fs=require('fs');var Redis=require(_0x2c58('0x4'));var db=require(_0x2c58('0x5'))['db'];var utils=require(_0x2c58('0x6'));var logger=require(_0x2c58('0x7'))(_0x2c58('0x8'));var config=require(_0x2c58('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2c58('0xa')][_0x2c58('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42e6df,_0x196ac2,_0x77acb7){return new BPromise(function(_0x5e9f13,_0x351a97){return client['request'](_0x42e6df,_0x77acb7)[_0x2c58('0xc')](function(_0xb9967d){logger[_0x2c58('0xd')](_0x2c58('0xe'),_0x196ac2,_0x2c58('0xf'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x196ac2,_0x2c58('0xf'),JSON[_0x2c58('0x10')](_0xb9967d));if(_0xb9967d[_0x2c58('0x11')]){if(_0xb9967d['error']['code']===0x1f4){logger[_0x2c58('0x11')](_0x2c58('0xe'),_0x196ac2,_0xb9967d['error'][_0x2c58('0x12')]);return _0x351a97(_0xb9967d[_0x2c58('0x11')][_0x2c58('0x12')]);}logger['error'](_0x2c58('0xe'),_0x196ac2,_0xb9967d[_0x2c58('0x11')][_0x2c58('0x12')]);return _0x5e9f13(_0xb9967d[_0x2c58('0x11')][_0x2c58('0x12')]);}else{logger[_0x2c58('0xd')]('DeskField,\x20%s,\x20%s',_0x196ac2,_0x2c58('0xf'));_0x5e9f13(_0xb9967d[_0x2c58('0x13')][_0x2c58('0x12')]);}})[_0x2c58('0x14')](function(_0x915163){logger[_0x2c58('0x11')](_0x2c58('0xe'),_0x196ac2,_0x915163);_0x351a97(_0x915163);});});} \ No newline at end of file +var _0x9d8a=['debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x29ced0,_0x152d0b){var _0x1b068e=function(_0x2ff695){while(--_0x2ff695){_0x29ced0['push'](_0x29ced0['shift']());}};_0x1b068e(++_0x152d0b);}(_0x9d8a,0xb0));var _0xa9d8=function(_0x2d224c,_0x4602fa){_0x2d224c=_0x2d224c-0x0;var _0x47f222=_0x9d8a[_0x2d224c];return _0x47f222;};'use strict';var _=require(_0xa9d8('0x0'));var util=require(_0xa9d8('0x1'));var moment=require(_0xa9d8('0x2'));var BPromise=require('bluebird');var rs=require(_0xa9d8('0x3'));var fs=require('fs');var Redis=require(_0xa9d8('0x4'));var db=require(_0xa9d8('0x5'))['db'];var utils=require(_0xa9d8('0x6'));var logger=require('../../config/logger')(_0xa9d8('0x7'));var config=require(_0xa9d8('0x8'));var jayson=require(_0xa9d8('0x9'));var client=jayson[_0xa9d8('0xa')][_0xa9d8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6f613a,_0x21e999,_0x5371ef){return new BPromise(function(_0x4bc10d,_0x47c950){return client['request'](_0x6f613a,_0x5371ef)[_0xa9d8('0xc')](function(_0x3bf1bc){logger[_0xa9d8('0xd')](_0xa9d8('0xe'),_0x21e999,_0xa9d8('0xf'));logger[_0xa9d8('0x10')](_0xa9d8('0x11'),_0x21e999,'request\x20sent',JSON[_0xa9d8('0x12')](_0x3bf1bc));if(_0x3bf1bc['error']){if(_0x3bf1bc[_0xa9d8('0x13')][_0xa9d8('0x14')]===0x1f4){logger[_0xa9d8('0x13')]('DeskField,\x20%s,\x20%s',_0x21e999,_0x3bf1bc[_0xa9d8('0x13')][_0xa9d8('0x15')]);return _0x47c950(_0x3bf1bc[_0xa9d8('0x13')][_0xa9d8('0x15')]);}logger[_0xa9d8('0x13')](_0xa9d8('0xe'),_0x21e999,_0x3bf1bc[_0xa9d8('0x13')][_0xa9d8('0x15')]);return _0x4bc10d(_0x3bf1bc['error']['message']);}else{logger[_0xa9d8('0xd')](_0xa9d8('0xe'),_0x21e999,_0xa9d8('0xf'));_0x4bc10d(_0x3bf1bc[_0xa9d8('0x16')][_0xa9d8('0x15')]);}})[_0xa9d8('0x17')](function(_0x43ee85){logger[_0xa9d8('0x13')](_0xa9d8('0xe'),_0x21e999,_0x43ee85);_0x47c950(_0x43ee85);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 07727f4..e392c2f 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 _0xeef1=['put','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration'];(function(_0x5cdf25,_0x5860ed){var _0x2b6520=function(_0xe6ef1b){while(--_0xe6ef1b){_0x5cdf25['push'](_0x5cdf25['shift']());}};_0x2b6520(++_0x5860ed);}(_0xeef1,0x157));var _0x1eef=function(_0x2f2cb4,_0x1dad86){_0x2f2cb4=_0x2f2cb4-0x0;var _0x94ce=_0xeef1[_0x2f2cb4];return _0x94ce;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1eef('0x0'));var timeout=require(_0x1eef('0x1'));var express=require(_0x1eef('0x2'));var router=express[_0x1eef('0x3')]();var fs_extra=require(_0x1eef('0x4'));var auth=require(_0x1eef('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1eef('0x6'));router[_0x1eef('0x7')]('/',auth[_0x1eef('0x8')](),controller[_0x1eef('0x9')]);router['get'](_0x1eef('0xa'),auth[_0x1eef('0x8')](),controller[_0x1eef('0xb')]);router[_0x1eef('0x7')](_0x1eef('0xc'),auth[_0x1eef('0x8')](),controller[_0x1eef('0xd')]);router[_0x1eef('0x7')]('/:id/fields',auth[_0x1eef('0x8')](),controller[_0x1eef('0xe')]);router[_0x1eef('0xf')]('/',auth[_0x1eef('0x8')](),controller['create']);router[_0x1eef('0xf')](_0x1eef('0xc'),auth['isAuthenticated'](),controller[_0x1eef('0x10')]);router[_0x1eef('0x11')](_0x1eef('0xa'),auth[_0x1eef('0x8')](),controller[_0x1eef('0x12')]);router['delete']('/:id',auth[_0x1eef('0x8')](),controller['destroy']);module[_0x1eef('0x13')]=router; \ No newline at end of file +var _0x58cf=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x58cf,0x102));var _0xf58c=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0x58cf[_0x4536a4];return _0x4fd1c1;};'use strict';var multer=require(_0xf58c('0x0'));var util=require(_0xf58c('0x1'));var path=require(_0xf58c('0x2'));var timeout=require(_0xf58c('0x3'));var express=require(_0xf58c('0x4'));var router=express[_0xf58c('0x5')]();var fs_extra=require(_0xf58c('0x6'));var auth=require(_0xf58c('0x7'));var interaction=require(_0xf58c('0x8'));var config=require(_0xf58c('0x9'));var controller=require(_0xf58c('0xa'));router[_0xf58c('0xb')]('/',auth[_0xf58c('0xc')](),controller[_0xf58c('0xd')]);router['get'](_0xf58c('0xe'),auth[_0xf58c('0xc')](),controller['show']);router[_0xf58c('0xb')](_0xf58c('0xf'),auth[_0xf58c('0xc')](),controller[_0xf58c('0x10')]);router[_0xf58c('0xb')](_0xf58c('0x11'),auth[_0xf58c('0xc')](),controller[_0xf58c('0x12')]);router[_0xf58c('0x13')]('/',auth[_0xf58c('0xc')](),controller[_0xf58c('0x14')]);router[_0xf58c('0x13')](_0xf58c('0xf'),auth[_0xf58c('0xc')](),controller[_0xf58c('0x15')]);router[_0xf58c('0x16')](_0xf58c('0xe'),auth[_0xf58c('0xc')](),controller[_0xf58c('0x17')]);router[_0xf58c('0x18')](_0xf58c('0xe'),auth[_0xf58c('0xc')](),controller[_0xf58c('0x19')]);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 d8a385a..6964f23 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 _0xe209=['sequelize','exports','STRING'];(function(_0x3266a1,_0x2b2894){var _0x7ee93b=function(_0x34748a){while(--_0x34748a){_0x3266a1['push'](_0x3266a1['shift']());}};_0x7ee93b(++_0x2b2894);}(_0xe209,0x12c));var _0x9e20=function(_0x304fec,_0x182687){_0x304fec=_0x304fec-0x0;var _0x565c2e=_0xe209[_0x304fec];return _0x565c2e;};'use strict';var Sequelize=require(_0x9e20('0x0'));module[_0x9e20('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9e20('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x9e20('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x9e20('0x2')]},'serverUrl':{'type':Sequelize[_0x9e20('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9e20('0x2')]}}; \ No newline at end of file +var _0x7bb8=['sequelize','exports','STRING'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x7bb8,0x1ce));var _0x87bb=function(_0x4ad011,_0x3c3b0b){_0x4ad011=_0x4ad011-0x0;var _0x7e5a0b=_0x7bb8[_0x4ad011];return _0x7e5a0b;};'use strict';var Sequelize=require(_0x87bb('0x0'));module[_0x87bb('0x1')]={'name':{'type':Sequelize[_0x87bb('0x2')]},'username':{'type':Sequelize[_0x87bb('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x87bb('0x2')]},'clientId':{'type':Sequelize[_0x87bb('0x2')]},'clientSecret':{'type':Sequelize[_0x87bb('0x2')]},'serverUrl':{'type':Sequelize[_0x87bb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x87bb('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 76f1a10..935aa9a 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 _0xe4b8=['squel','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','destroy','end','stack','name','index','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','then','includeAll','findAll','catch','show','params','filters','include','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','Subjects','channel','Dynamics365Field','Descriptions','getFields','ticketType','incident','description','customerid','phonenumber','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientId','clientSecret','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','LogicalName','forEach','@odata.type','substring','lastIndexOf','PicklistAttributeMetadata','push','all','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','send','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','DisplayName','TrueOption','true','OptionSet','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra'];(function(_0x3ae389,_0x17e31c){var _0x205073=function(_0x146df9){while(--_0x146df9){_0x3ae389['push'](_0x3ae389['shift']());}};_0x205073(++_0x17e31c);}(_0xe4b8,0x179));var _0x8e4b=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xe4b8[_0x4fbfd9];return _0x31dc94;};'use strict';var emlformat=require(_0x8e4b('0x0'));var rimraf=require(_0x8e4b('0x1'));var zipdir=require(_0x8e4b('0x2'));var jsonpatch=require(_0x8e4b('0x3'));var rp=require(_0x8e4b('0x4'));var moment=require(_0x8e4b('0x5'));var BPromise=require(_0x8e4b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8e4b('0x7'));var sox=require(_0x8e4b('0x8'));var csv=require(_0x8e4b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e4b('0xa'));var _=require('lodash');var squel=require(_0x8e4b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8e4b('0xc'));var Redis=require('ioredis');var authService=require(_0x8e4b('0xd'));var qs=require(_0x8e4b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e4b('0xf'));var logger=require(_0x8e4b('0x10'))(_0x8e4b('0x11'));var utils=require('../../config/utils');var config=require(_0x8e4b('0x12'));var licenseUtil=require(_0x8e4b('0x13'));var db=require(_0x8e4b('0x14'))['db'];var integrations=require(_0x8e4b('0x15'));function respondWithStatusCode(_0x30b1c8,_0x30d9d1){_0x30d9d1=_0x30d9d1||0xcc;return function(_0x55be2c){if(_0x55be2c){return _0x30b1c8[_0x8e4b('0x16')](_0x30d9d1);}return _0x30b1c8['status'](_0x30d9d1)['end']();};}function respondWithResult(_0x2e8e71,_0x261e76){_0x261e76=_0x261e76||0xc8;return function(_0x19e83d){if(_0x19e83d){return _0x2e8e71[_0x8e4b('0x17')](_0x261e76)[_0x8e4b('0x18')](_0x19e83d);}};}function respondWithFilteredResult(_0x4d10fd,_0x4b0197){return function(_0xfff6b){if(_0xfff6b){var _0x526cdb=typeof _0x4b0197['offset']===_0x8e4b('0x19')&&typeof _0x4b0197['limit']===_0x8e4b('0x19');var _0x512c2a=_0xfff6b[_0x8e4b('0x1a')];var _0x139118=_0x526cdb?0x0:_0x4b0197['offset'];var _0x5639f4=_0x526cdb?_0xfff6b[_0x8e4b('0x1a')]:_0x4b0197[_0x8e4b('0x1b')]+_0x4b0197[_0x8e4b('0x1c')];var _0x349a24;if(_0x5639f4>=_0x512c2a){_0x5639f4=_0x512c2a;_0x349a24=0xc8;}else{_0x349a24=0xce;}_0x4d10fd[_0x8e4b('0x17')](_0x349a24);return _0x4d10fd[_0x8e4b('0x1d')](_0x8e4b('0x1e'),_0x139118+'-'+_0x5639f4+'/'+_0x512c2a)[_0x8e4b('0x18')](_0xfff6b);}return null;};}function patchUpdates(_0x9eeb68){return function(_0x26b6b6){try{jsonpatch[_0x8e4b('0x1f')](_0x26b6b6,_0x9eeb68,!![]);}catch(_0xaae343){return BPromise['reject'](_0xaae343);}return _0x26b6b6[_0x8e4b('0x20')]();};}function saveUpdates(_0x16ff18,_0x5f3043){return function(_0x1f49c8){if(_0x1f49c8){return _0x1f49c8[_0x8e4b('0x21')](_0x16ff18)['then'](function(_0x2bd4e7){return _0x2bd4e7;});}return null;};}function removeEntity(_0x719300,_0x5e8915){return function(_0x10828b){if(_0x10828b){return _0x10828b[_0x8e4b('0x22')]()['then'](function(){_0x719300[_0x8e4b('0x17')](0xcc)[_0x8e4b('0x23')]();});}};}function handleEntityNotFound(_0xbd7008,_0x376202){return function(_0x25a240){if(!_0x25a240){_0xbd7008[_0x8e4b('0x16')](0x194);}return _0x25a240;};}function handleError(_0x535f71,_0x395927){_0x395927=_0x395927||0x1f4;return function(_0x51e17a){logger['error'](_0x51e17a[_0x8e4b('0x24')]);if(_0x51e17a[_0x8e4b('0x25')]){delete _0x51e17a['name'];}_0x535f71[_0x8e4b('0x17')](_0x395927)['send'](_0x51e17a);};}exports[_0x8e4b('0x26')]=function(_0x5c5c34,_0x2fd8da){var _0xe991c2={},_0x1b2759={},_0x36d657={'count':0x0,'rows':[]};var _0x32ceb7=_[_0x8e4b('0x27')](db[_0x8e4b('0x28')][_0x8e4b('0x29')],function(_0x4f823c){return{'name':_0x4f823c['fieldName'],'type':_0x4f823c[_0x8e4b('0x2a')][_0x8e4b('0x2b')]};});_0x1b2759[_0x8e4b('0x2c')]=_[_0x8e4b('0x27')](_0x32ceb7,_0x8e4b('0x25'));_0x1b2759[_0x8e4b('0x2d')]=_[_0x8e4b('0x2e')](_0x5c5c34[_0x8e4b('0x2d')]);_0x1b2759['filters']=_[_0x8e4b('0x2f')](_0x1b2759[_0x8e4b('0x2c')],_0x1b2759[_0x8e4b('0x2d')]);_0xe991c2[_0x8e4b('0x30')]=_[_0x8e4b('0x2f')](_0x1b2759['model'],qs[_0x8e4b('0x31')](_0x5c5c34[_0x8e4b('0x2d')][_0x8e4b('0x31')]));_0xe991c2[_0x8e4b('0x30')]=_0xe991c2[_0x8e4b('0x30')][_0x8e4b('0x32')]?_0xe991c2[_0x8e4b('0x30')]:_0x1b2759[_0x8e4b('0x2c')];if(!_0x5c5c34['query'][_0x8e4b('0x33')](_0x8e4b('0x34'))){_0xe991c2[_0x8e4b('0x1c')]=qs[_0x8e4b('0x1c')](_0x5c5c34[_0x8e4b('0x2d')][_0x8e4b('0x1c')]);_0xe991c2[_0x8e4b('0x1b')]=qs[_0x8e4b('0x1b')](_0x5c5c34[_0x8e4b('0x2d')][_0x8e4b('0x1b')]);}_0xe991c2[_0x8e4b('0x35')]=qs[_0x8e4b('0x36')](_0x5c5c34[_0x8e4b('0x2d')]['sort']);_0xe991c2[_0x8e4b('0x37')]=qs['filters'](_[_0x8e4b('0x38')](_0x5c5c34[_0x8e4b('0x2d')],_0x1b2759['filters']),_0x32ceb7);if(_0x5c5c34[_0x8e4b('0x2d')]['filter']){_0xe991c2[_0x8e4b('0x37')]=_[_0x8e4b('0x39')](_0xe991c2[_0x8e4b('0x37')],{'$or':_[_0x8e4b('0x27')](_0x32ceb7,function(_0x3bde13){if(_0x3bde13['type']!=='VIRTUAL'){var _0x1acb2b={};_0x1acb2b[_0x3bde13[_0x8e4b('0x25')]]={'$like':'%'+_0x5c5c34[_0x8e4b('0x2d')][_0x8e4b('0x3a')]+'%'};return _0x1acb2b;}})});}_0xe991c2=_[_0x8e4b('0x39')]({},_0xe991c2,_0x5c5c34[_0x8e4b('0x3b')]);var _0x3b3d52={'where':_0xe991c2['where']};return db[_0x8e4b('0x28')]['count'](_0x3b3d52)[_0x8e4b('0x3c')](function(_0x595bfc){_0x36d657[_0x8e4b('0x1a')]=_0x595bfc;if(_0x5c5c34['query'][_0x8e4b('0x3d')]){_0xe991c2['include']=[{'all':!![]}];}return db[_0x8e4b('0x28')][_0x8e4b('0x3e')](_0xe991c2);})[_0x8e4b('0x3c')](function(_0xeaf785){_0x36d657['rows']=_0xeaf785;return _0x36d657;})[_0x8e4b('0x3c')](respondWithFilteredResult(_0x2fd8da,_0xe991c2))[_0x8e4b('0x3f')](handleError(_0x2fd8da,null));};exports[_0x8e4b('0x40')]=function(_0x38574d,_0x27fafa){var _0x2a850f={'raw':![],'where':{'id':_0x38574d[_0x8e4b('0x41')]['id']}},_0x1b8493={};_0x1b8493[_0x8e4b('0x2c')]=_[_0x8e4b('0x2e')](db[_0x8e4b('0x28')]['rawAttributes']);_0x1b8493[_0x8e4b('0x2d')]=_[_0x8e4b('0x2e')](_0x38574d[_0x8e4b('0x2d')]);_0x1b8493[_0x8e4b('0x42')]=_[_0x8e4b('0x2f')](_0x1b8493[_0x8e4b('0x2c')],_0x1b8493[_0x8e4b('0x2d')]);_0x2a850f['attributes']=_[_0x8e4b('0x2f')](_0x1b8493[_0x8e4b('0x2c')],qs[_0x8e4b('0x31')](_0x38574d[_0x8e4b('0x2d')][_0x8e4b('0x31')]));_0x2a850f[_0x8e4b('0x30')]=_0x2a850f[_0x8e4b('0x30')][_0x8e4b('0x32')]?_0x2a850f[_0x8e4b('0x30')]:_0x1b8493[_0x8e4b('0x2c')];if(_0x38574d[_0x8e4b('0x2d')][_0x8e4b('0x3d')]){_0x2a850f[_0x8e4b('0x43')]=[{'all':!![]}];}_0x2a850f=_[_0x8e4b('0x39')]({},_0x2a850f,_0x38574d[_0x8e4b('0x3b')]);return db[_0x8e4b('0x28')][_0x8e4b('0x44')](_0x2a850f)[_0x8e4b('0x3c')](handleEntityNotFound(_0x27fafa,null))[_0x8e4b('0x3c')](respondWithResult(_0x27fafa,null))[_0x8e4b('0x3f')](handleError(_0x27fafa,null));};exports[_0x8e4b('0x45')]=function(_0x460653,_0x587a4d){return db[_0x8e4b('0x28')][_0x8e4b('0x45')](_0x460653[_0x8e4b('0x46')],{})[_0x8e4b('0x3c')](respondWithResult(_0x587a4d,0xc9))[_0x8e4b('0x3f')](handleError(_0x587a4d,null));};exports[_0x8e4b('0x21')]=function(_0x3b7447,_0x36a554){if(_0x3b7447[_0x8e4b('0x46')]['id']){delete _0x3b7447[_0x8e4b('0x46')]['id'];}return db[_0x8e4b('0x28')][_0x8e4b('0x44')]({'where':{'id':_0x3b7447['params']['id']}})[_0x8e4b('0x3c')](handleEntityNotFound(_0x36a554,null))[_0x8e4b('0x3c')](saveUpdates(_0x3b7447[_0x8e4b('0x46')],null))[_0x8e4b('0x3c')](respondWithResult(_0x36a554,null))['catch'](handleError(_0x36a554,null));};exports[_0x8e4b('0x22')]=function(_0x89059a,_0x2de321){return db['Dynamics365Account'][_0x8e4b('0x44')]({'where':{'id':_0x89059a[_0x8e4b('0x41')]['id']}})[_0x8e4b('0x3c')](handleEntityNotFound(_0x2de321,null))[_0x8e4b('0x3c')](removeEntity(_0x2de321,null))[_0x8e4b('0x3f')](handleError(_0x2de321,null));};exports[_0x8e4b('0x47')]=function(_0x20aa6a,_0x5eea7c,_0x2e35a8){var _0x17da38={};var _0x3e694c={};var _0x22a3f8;var _0x212a45;return db[_0x8e4b('0x28')][_0x8e4b('0x48')]({'where':{'id':_0x20aa6a['params']['id']}})[_0x8e4b('0x3c')](handleEntityNotFound(_0x5eea7c,null))[_0x8e4b('0x3c')](function(_0x18c7ab){if(_0x18c7ab){_0x22a3f8=_0x18c7ab;_0x3e694c[_0x8e4b('0x2c')]=_[_0x8e4b('0x2e')](db[_0x8e4b('0x49')]['rawAttributes']);_0x3e694c['query']=_['keys'](_0x20aa6a['query']);_0x3e694c[_0x8e4b('0x42')]=_[_0x8e4b('0x2f')](_0x3e694c[_0x8e4b('0x2c')],_0x3e694c[_0x8e4b('0x2d')]);_0x17da38['attributes']=_['intersection'](_0x3e694c[_0x8e4b('0x2c')],qs[_0x8e4b('0x31')](_0x20aa6a[_0x8e4b('0x2d')][_0x8e4b('0x31')]));_0x17da38[_0x8e4b('0x30')]=_0x17da38['attributes'][_0x8e4b('0x32')]?_0x17da38['attributes']:_0x3e694c['model'];_0x17da38['order']=qs['sort'](_0x20aa6a[_0x8e4b('0x2d')][_0x8e4b('0x36')]);_0x17da38[_0x8e4b('0x37')]=qs[_0x8e4b('0x42')](_[_0x8e4b('0x38')](_0x20aa6a['query'],_0x3e694c[_0x8e4b('0x42')]));if(_0x20aa6a['query'][_0x8e4b('0x3a')]){_0x17da38[_0x8e4b('0x37')]=_[_0x8e4b('0x39')](_0x17da38[_0x8e4b('0x37')],{'$or':_['map'](_0x17da38['attributes'],function(_0x3ded9a){var _0x54fe1f={};_0x54fe1f[_0x3ded9a]={'$like':'%'+_0x20aa6a[_0x8e4b('0x2d')][_0x8e4b('0x3a')]+'%'};return _0x54fe1f;})});}_0x17da38=_['merge']({},_0x17da38,_0x20aa6a[_0x8e4b('0x3b')]);return _0x22a3f8[_0x8e4b('0x47')](_0x17da38);}})[_0x8e4b('0x3c')](function(_0x60e626){if(_0x60e626){_0x212a45=_0x60e626[_0x8e4b('0x32')];if(!_0x20aa6a[_0x8e4b('0x2d')][_0x8e4b('0x33')](_0x8e4b('0x34'))){_0x17da38[_0x8e4b('0x1c')]=qs[_0x8e4b('0x1c')](_0x20aa6a[_0x8e4b('0x2d')][_0x8e4b('0x1c')]);_0x17da38['offset']=qs[_0x8e4b('0x1b')](_0x20aa6a['query']['offset']);}return _0x22a3f8[_0x8e4b('0x47')](_0x17da38);}})['then'](function(_0x55d367){if(_0x55d367){return _0x55d367?{'count':_0x212a45,'rows':_0x55d367}:null;}})[_0x8e4b('0x3c')](respondWithResult(_0x5eea7c,null))['catch'](handleError(_0x5eea7c,null));};exports[_0x8e4b('0x4a')]=function(_0x3cb072,_0x16e0f9,_0x30bee6){if(_0x3cb072[_0x8e4b('0x46')]['id']){delete _0x3cb072['body']['id'];}return db['Dynamics365Account'][_0x8e4b('0x48')]({'where':{'id':_0x3cb072[_0x8e4b('0x41')]['id']}})['then'](handleEntityNotFound(_0x16e0f9,null))[_0x8e4b('0x3c')](function(_0xc853f0){if(_0xc853f0){_0x3cb072[_0x8e4b('0x46')]['AccountId']=_0xc853f0['id'];_0x3cb072[_0x8e4b('0x46')][_0x8e4b('0x4b')]=integrations['getSubjects'](_0x3cb072[_0x8e4b('0x46')][_0x8e4b('0x4c')],_0x3cb072[_0x8e4b('0x46')][_0x8e4b('0x2a')]);_0x3cb072[_0x8e4b('0x46')]['Descriptions']=integrations['getDescriptions'](_0x3cb072[_0x8e4b('0x46')]['channel'],_0x3cb072[_0x8e4b('0x46')]['type']);return db[_0x8e4b('0x49')]['create'](_0x3cb072[_0x8e4b('0x46')],{'include':[{'model':db[_0x8e4b('0x4d')],'as':_0x8e4b('0x4b')},{'model':db['Dynamics365Field'],'as':_0x8e4b('0x4e')}]});}return null;})[_0x8e4b('0x3c')](respondWithResult(_0x16e0f9,null))[_0x8e4b('0x3f')](handleError(_0x16e0f9,null));};exports[_0x8e4b('0x4f')]=function(_0xc4c880,_0x2d8c08,_0x34977a){var _0x15a274=_0xc4c880[_0x8e4b('0x2d')][_0x8e4b('0x50')];var _0xa3ed6e=_0x15a274===_0x8e4b('0x51')?'Incident':'PhoneCall';var _0x51dc8c='';var _0x1e908a='';var _0x5b6c55='';var _0x32c515='';var _0x2f421d='';var _0x216aa3='';var _0x135f55='';var _0x3c7cee='';var _0x8eb135=['title',_0x8e4b('0x52'),_0x8e4b('0x53'),'ownerid','caseorigincode','subject',_0x8e4b('0x54'),'regardingobjectid','directioncode','phonecall_activity_parties'];var _0x1717dd=['accountidname','accountidyominame',_0x8e4b('0x55'),_0x8e4b('0x56'),'contactidname',_0x8e4b('0x57'),_0x8e4b('0x58'),_0x8e4b('0x59'),_0x8e4b('0x5a'),_0x8e4b('0x5b'),_0x8e4b('0x5c'),'createdbyyominame',_0x8e4b('0x5d'),'createdonbehalfbyname',_0x8e4b('0x5e'),_0x8e4b('0x5f'),_0x8e4b('0x60'),_0x8e4b('0x61'),'emailaddress',_0x8e4b('0x62'),'entityimage_timestamp','entityimage_url',_0x8e4b('0x63'),_0x8e4b('0x64'),_0x8e4b('0x65'),_0x8e4b('0x66'),_0x8e4b('0x67'),_0x8e4b('0x68'),_0x8e4b('0x69'),_0x8e4b('0x6a'),_0x8e4b('0x6b'),'modifiedbyexternalpartyname',_0x8e4b('0x6c'),_0x8e4b('0x6d'),'modifiedbyyominame',_0x8e4b('0x6e'),_0x8e4b('0x6f'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x8e4b('0x70'),_0x8e4b('0x71'),_0x8e4b('0x72'),_0x8e4b('0x73'),_0x8e4b('0x74'),_0x8e4b('0x75'),_0x8e4b('0x76'),'parentcaseidname',_0x8e4b('0x77'),_0x8e4b('0x78'),_0x8e4b('0x79'),_0x8e4b('0x7a'),_0x8e4b('0x7b'),'resolveby',_0x8e4b('0x7c'),_0x8e4b('0x7d'),'responsiblecontactidname',_0x8e4b('0x7e'),_0x8e4b('0x7f'),_0x8e4b('0x80'),'slaname',_0x8e4b('0x81'),_0x8e4b('0x82'),_0x8e4b('0x83'),_0x8e4b('0x84'),_0x8e4b('0x85'),_0x8e4b('0x86'),'transactioncurrencyidname','traversedpath',_0x8e4b('0x87'),_0x8e4b('0x88')];var _0x46234e=_0x8eb135[_0x8e4b('0x89')](_0x1717dd);return db['Dynamics365Account'][_0x8e4b('0x48')]({'where':{'id':_0xc4c880['params']['id']},'attributes':['id',_0x8e4b('0x8a'),_0x8e4b('0x8b'),_0x8e4b('0x8c'),'tenantId',_0x8e4b('0x8d'),_0x8e4b('0x8e')]})[_0x8e4b('0x3c')](handleEntityNotFound(_0x2d8c08,null))[_0x8e4b('0x3c')](function(_0x12fbce){if(_0x12fbce){_0x3c7cee=_0x12fbce['remoteUri'];var _0x5f1767=_0x3c7cee['slice'](-0x1);if(_0x5f1767==='/'){_0x3c7cee=_0x3c7cee['substring'](0x0,_0x3c7cee['lastIndexOf'](_0x5f1767));}_0x135f55=util[_0x8e4b('0x8f')](_0x8e4b('0x90'),_0x3c7cee);var _0xb8379f={'method':_0x8e4b('0x91'),'uri':_0x8e4b('0x92')+_0x12fbce[_0x8e4b('0x93')]+_0x8e4b('0x94'),'form':{'client_id':_0x12fbce['clientId'],'resource':_0x3c7cee,'username':_0x12fbce[_0x8e4b('0x8a')],'password':_0x12fbce[_0x8e4b('0x8b')],'grant_type':_0x8e4b('0x8b'),'client_secret':_0x12fbce[_0x8e4b('0x8e')]},'json':!![]};return rp(_0xb8379f);}})[_0x8e4b('0x3c')](function(_0x22aa1b){_0x216aa3=_0x22aa1b[_0x8e4b('0x95')];var _0x22a9ff={'method':_0x8e4b('0x96'),'uri':encodeURI(_0x135f55+_0x8e4b('0x97')+_0xa3ed6e+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x216aa3,'If-None-Match':null,'OData-Version':_0x8e4b('0x98')},'json':!![]};return rp(_0x22a9ff);})[_0x8e4b('0x3c')](function(_0x483841){var _0x47c53c=_0x483841['value'][0x0];var _0x2fac98=_0x47c53c[_0x8e4b('0x99')];var _0x26e445={'method':_0x8e4b('0x96'),'uri':_0x135f55+'EntityDefinitions('+_0x2fac98+_0x8e4b('0x9a'),'headers':{'Authorization':_0x8e4b('0x9b')+_0x216aa3,'If-None-Match':null,'OData-Version':_0x8e4b('0x98')},'json':!![]};return rp(_0x26e445);})[_0x8e4b('0x3c')](function(_0x18151b){_0x51dc8c=_0x18151b;_0x1e908a=_0x51dc8c[_0x8e4b('0x9c')];_0x1e908a=_[_0x8e4b('0x9d')](_0x1e908a,function(_0x409669){return!_0x46234e['includes'](_0x409669[_0x8e4b('0x9e')]);});var _0x5e271a=[];var _0x4cfdac=[];_0x1e908a[_0x8e4b('0x9f')](function(_0x31a75b){if(_0x31a75b['@odata.type']){var _0x90f1d5=_0x31a75b[_0x8e4b('0xa0')][_0x8e4b('0xa1')](_0x31a75b[_0x8e4b('0xa0')][_0x8e4b('0xa2')]('.')+0x1);if(_0x90f1d5===_0x8e4b('0xa3')){_0x5e271a[_0x8e4b('0xa4')](getSelectList(_0x135f55,_0x15a274,_0x4cfdac,_0x51dc8c[_0x8e4b('0x99')],_0x31a75b[_0x8e4b('0x99')],_0x216aa3));}}});return Promise[_0x8e4b('0xa5')](_0x5e271a);})[_0x8e4b('0x3c')](function(_0x5ab9db){_0x5b6c55=_0x5ab9db[0x0];var _0x2bc6ef=[];var _0x4f1217=[];_0x1e908a['forEach'](function(_0x480075){if(!_['isNil'](_0x480075[_0x8e4b('0xa0')])){var _0x3816e5=_0x480075[_0x8e4b('0xa0')][_0x8e4b('0xa1')](_0x480075[_0x8e4b('0xa0')][_0x8e4b('0xa2')]('.')+0x1);if(_0x3816e5==='BooleanAttributeMetadata'){_0x2bc6ef[_0x8e4b('0xa4')](getBooleanList(_0x135f55,_0x15a274,_0x4f1217,_0x51dc8c['MetadataId'],_0x480075['MetadataId'],_0x216aa3));}}});return Promise[_0x8e4b('0xa5')](_0x2bc6ef);})[_0x8e4b('0x3c')](function(_0x18cc29){_0x32c515=_0x18cc29[0x0];var _0x1f199e=[];var _0x4cd79c=[];_0x1e908a[_0x8e4b('0x9f')](function(_0xebf807){if(_0xebf807[_0x8e4b('0xa0')]){var _0x22dc66=_0xebf807['@odata.type'][_0x8e4b('0xa1')](_0xebf807[_0x8e4b('0xa0')][_0x8e4b('0xa2')]('.')+0x1);if(_0x22dc66==='StringAttributeMetadata'||_0x22dc66===_0x8e4b('0xa6')||_0x22dc66===_0x8e4b('0xa7')||_0x22dc66===_0x8e4b('0xa8')||_0x22dc66===_0x8e4b('0xa9')||_0x22dc66===_0x8e4b('0xaa')||_0x22dc66===_0x8e4b('0xab')||_0x22dc66==='EntityNameAttributeMetadata'||_0x22dc66===_0x8e4b('0xac')||_0x22dc66===_0x8e4b('0xad')){_0x1f199e[_0x8e4b('0xa4')](getInputList(_0x135f55,_0x15a274,_0x22dc66,_0x4cd79c,_0x51dc8c[_0x8e4b('0x99')],_0xebf807[_0x8e4b('0x99')],_0x216aa3));}}});return Promise[_0x8e4b('0xa5')](_0x1f199e);})[_0x8e4b('0x3c')](function(_0x590df9){_0x2f421d=_0x590df9[0x0];var _0x1d4784=_0x5b6c55[_0x8e4b('0x89')](_0x32c515)[_0x8e4b('0x89')](_0x2f421d);var _0x1132cb={'count':_0x1d4784[_0x8e4b('0x32')],'rows':_0x1d4784};return _0x1132cb;})[_0x8e4b('0x3c')](respondWithResult(_0x2d8c08,null))[_0x8e4b('0x3f')](function(_0x2042c7){var _0x501e04=_0xc4c880[_0x8e4b('0x2d')][_0x8e4b('0xae')]?0x1f4:_0x2042c7[_0x8e4b('0xaf')]||0x1f4;logger[_0x8e4b('0xb0')](_0x2042c7[_0x8e4b('0x24')]);delete _0x2042c7[_0x8e4b('0x25')];if(_0x501e04===0x191){_0x501e04=0x190;}_0x2d8c08[_0x8e4b('0x17')](_0x501e04)[_0x8e4b('0xb1')](_0xc4c880[_0x8e4b('0x2d')][_0x8e4b('0xae')]?{'message':_0x8e4b('0xb2'),'statusCode':_0x2042c7[_0x8e4b('0xaf')]}:_0x2042c7);});};function getSelectList(_0x3651ce,_0x499990,_0xc51f7d,_0x2a4e67,_0x3dc3fe,_0x574812){var _0x4b5b24={'method':_0x8e4b('0x96'),'uri':_0x3651ce+_0x8e4b('0xb3')+_0x2a4e67+_0x8e4b('0xb4')+_0x3dc3fe+_0x8e4b('0xb5')+_0x8e4b('0xb6'),'headers':{'Authorization':_0x8e4b('0x9b')+_0x574812,'If-None-Match':null,'OData-Version':_0x8e4b('0x98')},'json':!![]};return rp(_0x4b5b24)[_0x8e4b('0x3c')](function(_0x3fe26c){var _0x55b546=[];var _0x2885c1=_0x3fe26c['OptionSet'][_0x8e4b('0xb7')];_0x2885c1['forEach'](function(_0x456247){_0x55b546[_0x8e4b('0xa4')]({'name':_0x456247[_0x8e4b('0xb8')][_0x8e4b('0xb9')][_0x8e4b('0xb8')],'value':String(_0x456247['Value'])});});var _0x5780fe={'id':_0x499990+'_'+_0x3fe26c[_0x8e4b('0x9e')],'name':_0x3fe26c[_0x8e4b('0xba')][_0x8e4b('0xb9')][_0x8e4b('0xb8')],'custom':![],'options':_0x55b546};_0xc51f7d[_0x8e4b('0xa4')](_0x5780fe);return _0xc51f7d;});}function getBooleanList(_0x124201,_0x85aba4,_0x5440fb,_0x58a5f6,_0x151acc,_0x4b95c9){var _0x70d1cf={'method':'GET','uri':_0x124201+_0x8e4b('0xb3')+_0x58a5f6+_0x8e4b('0xb4')+_0x151acc+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x8e4b('0x9b')+_0x4b95c9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x70d1cf)[_0x8e4b('0x3c')](function(_0x503fcb){var _0x3a649f=[];_0x3a649f[_0x8e4b('0xa4')]({'name':_0x503fcb['OptionSet'][_0x8e4b('0xbb')][_0x8e4b('0xb8')][_0x8e4b('0xb9')][_0x8e4b('0xb8')],'value':_0x8e4b('0xbc')},{'name':_0x503fcb[_0x8e4b('0xbd')][_0x8e4b('0xbe')][_0x8e4b('0xb8')][_0x8e4b('0xb9')]['Label'],'value':_0x8e4b('0xbf')});var _0x5f216e={'id':_0x85aba4+'_'+_0x503fcb['LogicalName'],'name':_0x503fcb[_0x8e4b('0xba')]['UserLocalizedLabel'][_0x8e4b('0xb8')],'custom':![],'options':_0x3a649f};_0x5440fb[_0x8e4b('0xa4')](_0x5f216e);return _0x5440fb;});}function getInputList(_0x47db5a,_0x2a9cfe,_0x1d10d9,_0x4c1b12,_0x3ee951,_0x14add5,_0x344868){var _0x471942={'method':'GET','uri':_0x47db5a+'EntityDefinitions('+_0x3ee951+_0x8e4b('0xb4')+_0x14add5+_0x8e4b('0xc0')+_0x1d10d9+_0x8e4b('0xc1'),'headers':{'Authorization':'Bearer\x20'+_0x344868,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x471942)[_0x8e4b('0x3c')](function(_0x383f1d){var _0x3793df={'id':_0x2a9cfe+'_'+_0x383f1d[_0x8e4b('0x9e')],'name':_0x383f1d[_0x8e4b('0xba')][_0x8e4b('0xb9')]?_0x383f1d[_0x8e4b('0xba')][_0x8e4b('0xb9')][_0x8e4b('0xb8')]:_0x383f1d['LogicalName'],'custom':![],'options':[]};_0x4c1b12[_0x8e4b('0xa4')](_0x3793df);return _0x4c1b12;});} \ No newline at end of file +var _0xcf1c=['rimraf','fast-json-patch','request-promise','moment','bluebird','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/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','Dynamics365Configuration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','incident','title','description','customerid','ownerid','caseorigincode','phonenumber','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdonbehalfbyname','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','POST','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','forEach','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','DisplayName','eml-format'];(function(_0x5899fc,_0x4e0a77){var _0x377f7c=function(_0x38cdd3){while(--_0x38cdd3){_0x5899fc['push'](_0x5899fc['shift']());}};_0x377f7c(++_0x4e0a77);}(_0xcf1c,0x18d));var _0xccf1=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0xcf1c[_0x1cd674];return _0x27928f;};'use strict';var emlformat=require(_0xccf1('0x0'));var rimraf=require(_0xccf1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xccf1('0x2'));var rp=require(_0xccf1('0x3'));var moment=require(_0xccf1('0x4'));var BPromise=require(_0xccf1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xccf1('0x6'));var csv=require('to-csv');var ejs=require(_0xccf1('0x7'));var fs=require('fs');var fs_extra=require(_0xccf1('0x8'));var _=require(_0xccf1('0x9'));var squel=require(_0xccf1('0xa'));var crypto=require(_0xccf1('0xb'));var jsforce=require(_0xccf1('0xc'));var deskjs=require(_0xccf1('0xd'));var toCsv=require(_0xccf1('0xe'));var querystring=require(_0xccf1('0xf'));var Papa=require(_0xccf1('0x10'));var Redis=require(_0xccf1('0x11'));var authService=require(_0xccf1('0x12'));var qs=require(_0xccf1('0x13'));var as=require(_0xccf1('0x14'));var hardwareService=require(_0xccf1('0x15'));var logger=require(_0xccf1('0x16'))(_0xccf1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xccf1('0x18'));var db=require(_0xccf1('0x19'))['db'];var integrations=require(_0xccf1('0x1a'));function respondWithStatusCode(_0x3789c2,_0x3da424){_0x3da424=_0x3da424||0xcc;return function(_0x568b81){if(_0x568b81){return _0x3789c2['sendStatus'](_0x3da424);}return _0x3789c2[_0xccf1('0x1b')](_0x3da424)[_0xccf1('0x1c')]();};}function respondWithResult(_0x1170e1,_0x44b68a){_0x44b68a=_0x44b68a||0xc8;return function(_0x95a852){if(_0x95a852){return _0x1170e1['status'](_0x44b68a)[_0xccf1('0x1d')](_0x95a852);}};}function respondWithFilteredResult(_0x537996,_0x4e91cd){return function(_0x1ceb48){if(_0x1ceb48){var _0x381da9=typeof _0x4e91cd[_0xccf1('0x1e')]===_0xccf1('0x1f')&&typeof _0x4e91cd[_0xccf1('0x20')]===_0xccf1('0x1f');var _0x262e47=_0x1ceb48['count'];var _0x414f23=_0x381da9?0x0:_0x4e91cd['offset'];var _0x473a31=_0x381da9?_0x1ceb48['count']:_0x4e91cd[_0xccf1('0x1e')]+_0x4e91cd[_0xccf1('0x20')];var _0x590174;if(_0x473a31>=_0x262e47){_0x473a31=_0x262e47;_0x590174=0xc8;}else{_0x590174=0xce;}_0x537996[_0xccf1('0x1b')](_0x590174);return _0x537996[_0xccf1('0x21')]('Content-Range',_0x414f23+'-'+_0x473a31+'/'+_0x262e47)['json'](_0x1ceb48);}return null;};}function patchUpdates(_0x4bcb98){return function(_0x43c982){try{jsonpatch[_0xccf1('0x22')](_0x43c982,_0x4bcb98,!![]);}catch(_0x5b8a37){return BPromise['reject'](_0x5b8a37);}return _0x43c982[_0xccf1('0x23')]();};}function saveUpdates(_0xb819a6,_0x43d622){return function(_0xe8c94){if(_0xe8c94){return _0xe8c94[_0xccf1('0x24')](_0xb819a6)[_0xccf1('0x25')](function(_0x2aa979){return _0x2aa979;});}return null;};}function removeEntity(_0x396bcb,_0x75b9f6){return function(_0x4a4de5){if(_0x4a4de5){return _0x4a4de5[_0xccf1('0x26')]()[_0xccf1('0x25')](function(){_0x396bcb[_0xccf1('0x1b')](0xcc)[_0xccf1('0x1c')]();});}};}function handleEntityNotFound(_0x17f5a9,_0x13827d){return function(_0x3d1011){if(!_0x3d1011){_0x17f5a9[_0xccf1('0x27')](0x194);}return _0x3d1011;};}function handleError(_0x34799e,_0xec56ce){_0xec56ce=_0xec56ce||0x1f4;return function(_0x40b762){logger[_0xccf1('0x28')](_0x40b762[_0xccf1('0x29')]);if(_0x40b762['name']){delete _0x40b762[_0xccf1('0x2a')];}_0x34799e[_0xccf1('0x1b')](_0xec56ce)[_0xccf1('0x2b')](_0x40b762);};}exports[_0xccf1('0x2c')]=function(_0x5a83b8,_0x2b069f){var _0x2e3c50={},_0x39f66a={},_0x33bcba={'count':0x0,'rows':[]};var _0x2abc80=_[_0xccf1('0x2d')](db[_0xccf1('0x2e')][_0xccf1('0x2f')],function(_0x3d8fc3){return{'name':_0x3d8fc3['fieldName'],'type':_0x3d8fc3[_0xccf1('0x30')][_0xccf1('0x31')]};});_0x39f66a[_0xccf1('0x32')]=_[_0xccf1('0x2d')](_0x2abc80,_0xccf1('0x2a'));_0x39f66a['query']=_[_0xccf1('0x33')](_0x5a83b8[_0xccf1('0x34')]);_0x39f66a[_0xccf1('0x35')]=_[_0xccf1('0x36')](_0x39f66a[_0xccf1('0x32')],_0x39f66a['query']);_0x2e3c50['attributes']=_[_0xccf1('0x36')](_0x39f66a[_0xccf1('0x32')],qs[_0xccf1('0x37')](_0x5a83b8[_0xccf1('0x34')]['fields']));_0x2e3c50[_0xccf1('0x38')]=_0x2e3c50[_0xccf1('0x38')][_0xccf1('0x39')]?_0x2e3c50[_0xccf1('0x38')]:_0x39f66a[_0xccf1('0x32')];if(!_0x5a83b8[_0xccf1('0x34')][_0xccf1('0x3a')]('nolimit')){_0x2e3c50[_0xccf1('0x20')]=qs[_0xccf1('0x20')](_0x5a83b8[_0xccf1('0x34')][_0xccf1('0x20')]);_0x2e3c50[_0xccf1('0x1e')]=qs[_0xccf1('0x1e')](_0x5a83b8[_0xccf1('0x34')][_0xccf1('0x1e')]);}_0x2e3c50[_0xccf1('0x3b')]=qs[_0xccf1('0x3c')](_0x5a83b8[_0xccf1('0x34')][_0xccf1('0x3c')]);_0x2e3c50['where']=qs[_0xccf1('0x35')](_[_0xccf1('0x3d')](_0x5a83b8['query'],_0x39f66a[_0xccf1('0x35')]),_0x2abc80);if(_0x5a83b8[_0xccf1('0x34')][_0xccf1('0x3e')]){_0x2e3c50[_0xccf1('0x3f')]=_[_0xccf1('0x40')](_0x2e3c50[_0xccf1('0x3f')],{'$or':_[_0xccf1('0x2d')](_0x2abc80,function(_0x258722){if(_0x258722[_0xccf1('0x30')]!==_0xccf1('0x41')){var _0x570a04={};_0x570a04[_0x258722[_0xccf1('0x2a')]]={'$like':'%'+_0x5a83b8['query']['filter']+'%'};return _0x570a04;}})});}_0x2e3c50=_[_0xccf1('0x40')]({},_0x2e3c50,_0x5a83b8[_0xccf1('0x42')]);var _0x53554e={'where':_0x2e3c50[_0xccf1('0x3f')]};return db[_0xccf1('0x2e')]['count'](_0x53554e)['then'](function(_0x28248d){_0x33bcba[_0xccf1('0x43')]=_0x28248d;if(_0x5a83b8[_0xccf1('0x34')][_0xccf1('0x44')]){_0x2e3c50[_0xccf1('0x45')]=[{'all':!![]}];}return db[_0xccf1('0x2e')][_0xccf1('0x46')](_0x2e3c50);})[_0xccf1('0x25')](function(_0x52d09d){_0x33bcba[_0xccf1('0x47')]=_0x52d09d;return _0x33bcba;})[_0xccf1('0x25')](respondWithFilteredResult(_0x2b069f,_0x2e3c50))[_0xccf1('0x48')](handleError(_0x2b069f,null));};exports[_0xccf1('0x49')]=function(_0x5b0a0f,_0x1d3535){var _0x3fee3b={'raw':![],'where':{'id':_0x5b0a0f['params']['id']}},_0x2b14b0={};_0x2b14b0['model']=_[_0xccf1('0x33')](db[_0xccf1('0x2e')]['rawAttributes']);_0x2b14b0[_0xccf1('0x34')]=_['keys'](_0x5b0a0f[_0xccf1('0x34')]);_0x2b14b0[_0xccf1('0x35')]=_[_0xccf1('0x36')](_0x2b14b0[_0xccf1('0x32')],_0x2b14b0[_0xccf1('0x34')]);_0x3fee3b[_0xccf1('0x38')]=_[_0xccf1('0x36')](_0x2b14b0[_0xccf1('0x32')],qs[_0xccf1('0x37')](_0x5b0a0f[_0xccf1('0x34')][_0xccf1('0x37')]));_0x3fee3b[_0xccf1('0x38')]=_0x3fee3b[_0xccf1('0x38')]['length']?_0x3fee3b[_0xccf1('0x38')]:_0x2b14b0[_0xccf1('0x32')];if(_0x5b0a0f[_0xccf1('0x34')][_0xccf1('0x44')]){_0x3fee3b[_0xccf1('0x45')]=[{'all':!![]}];}_0x3fee3b=_[_0xccf1('0x40')]({},_0x3fee3b,_0x5b0a0f[_0xccf1('0x42')]);return db[_0xccf1('0x2e')][_0xccf1('0x4a')](_0x3fee3b)[_0xccf1('0x25')](handleEntityNotFound(_0x1d3535,null))['then'](respondWithResult(_0x1d3535,null))[_0xccf1('0x48')](handleError(_0x1d3535,null));};exports[_0xccf1('0x4b')]=function(_0x2d14f1,_0x43d76a){return db[_0xccf1('0x2e')][_0xccf1('0x4b')](_0x2d14f1['body'],{})['then'](respondWithResult(_0x43d76a,0xc9))[_0xccf1('0x48')](handleError(_0x43d76a,null));};exports[_0xccf1('0x24')]=function(_0x4955a2,_0x4e43ec){if(_0x4955a2[_0xccf1('0x4c')]['id']){delete _0x4955a2[_0xccf1('0x4c')]['id'];}return db[_0xccf1('0x2e')][_0xccf1('0x4a')]({'where':{'id':_0x4955a2[_0xccf1('0x4d')]['id']}})[_0xccf1('0x25')](handleEntityNotFound(_0x4e43ec,null))['then'](saveUpdates(_0x4955a2['body'],null))[_0xccf1('0x25')](respondWithResult(_0x4e43ec,null))[_0xccf1('0x48')](handleError(_0x4e43ec,null));};exports['destroy']=function(_0x1f131f,_0x2e7e5a){return db[_0xccf1('0x2e')]['find']({'where':{'id':_0x1f131f[_0xccf1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2e7e5a,null))['then'](removeEntity(_0x2e7e5a,null))[_0xccf1('0x48')](handleError(_0x2e7e5a,null));};exports[_0xccf1('0x4e')]=function(_0x35245d,_0x2fea19,_0x1037b4){var _0x221f0e={};var _0x52ff0d={};var _0x36a020;var _0x3d4628;return db[_0xccf1('0x2e')]['findOne']({'where':{'id':_0x35245d[_0xccf1('0x4d')]['id']}})[_0xccf1('0x25')](handleEntityNotFound(_0x2fea19,null))[_0xccf1('0x25')](function(_0x2f0724){if(_0x2f0724){_0x36a020=_0x2f0724;_0x52ff0d['model']=_[_0xccf1('0x33')](db[_0xccf1('0x4f')][_0xccf1('0x2f')]);_0x52ff0d[_0xccf1('0x34')]=_['keys'](_0x35245d['query']);_0x52ff0d[_0xccf1('0x35')]=_[_0xccf1('0x36')](_0x52ff0d[_0xccf1('0x32')],_0x52ff0d[_0xccf1('0x34')]);_0x221f0e[_0xccf1('0x38')]=_[_0xccf1('0x36')](_0x52ff0d['model'],qs[_0xccf1('0x37')](_0x35245d[_0xccf1('0x34')][_0xccf1('0x37')]));_0x221f0e['attributes']=_0x221f0e[_0xccf1('0x38')]['length']?_0x221f0e[_0xccf1('0x38')]:_0x52ff0d[_0xccf1('0x32')];_0x221f0e[_0xccf1('0x3b')]=qs[_0xccf1('0x3c')](_0x35245d[_0xccf1('0x34')]['sort']);_0x221f0e['where']=qs['filters'](_['pick'](_0x35245d['query'],_0x52ff0d[_0xccf1('0x35')]));if(_0x35245d['query'][_0xccf1('0x3e')]){_0x221f0e[_0xccf1('0x3f')]=_['merge'](_0x221f0e['where'],{'$or':_['map'](_0x221f0e['attributes'],function(_0x17a141){var _0x4c127a={};_0x4c127a[_0x17a141]={'$like':'%'+_0x35245d[_0xccf1('0x34')][_0xccf1('0x3e')]+'%'};return _0x4c127a;})});}_0x221f0e=_[_0xccf1('0x40')]({},_0x221f0e,_0x35245d[_0xccf1('0x42')]);return _0x36a020[_0xccf1('0x4e')](_0x221f0e);}})['then'](function(_0x1eb2ee){if(_0x1eb2ee){_0x3d4628=_0x1eb2ee['length'];if(!_0x35245d[_0xccf1('0x34')][_0xccf1('0x3a')](_0xccf1('0x50'))){_0x221f0e[_0xccf1('0x20')]=qs[_0xccf1('0x20')](_0x35245d['query'][_0xccf1('0x20')]);_0x221f0e[_0xccf1('0x1e')]=qs[_0xccf1('0x1e')](_0x35245d[_0xccf1('0x34')][_0xccf1('0x1e')]);}return _0x36a020['getConfigurations'](_0x221f0e);}})[_0xccf1('0x25')](function(_0x41215e){if(_0x41215e){return _0x41215e?{'count':_0x3d4628,'rows':_0x41215e}:null;}})[_0xccf1('0x25')](respondWithResult(_0x2fea19,null))['catch'](handleError(_0x2fea19,null));};exports[_0xccf1('0x51')]=function(_0x1f4f16,_0x5cf3a9,_0x4a5f22){if(_0x1f4f16[_0xccf1('0x4c')]['id']){delete _0x1f4f16[_0xccf1('0x4c')]['id'];}return db[_0xccf1('0x2e')][_0xccf1('0x52')]({'where':{'id':_0x1f4f16[_0xccf1('0x4d')]['id']}})[_0xccf1('0x25')](handleEntityNotFound(_0x5cf3a9,null))[_0xccf1('0x25')](function(_0x3f682f){if(_0x3f682f){_0x1f4f16[_0xccf1('0x4c')][_0xccf1('0x53')]=_0x3f682f['id'];_0x1f4f16[_0xccf1('0x4c')][_0xccf1('0x54')]=integrations[_0xccf1('0x55')](_0x1f4f16['body'][_0xccf1('0x56')],_0x1f4f16[_0xccf1('0x4c')][_0xccf1('0x30')]);_0x1f4f16['body'][_0xccf1('0x57')]=integrations[_0xccf1('0x58')](_0x1f4f16[_0xccf1('0x4c')][_0xccf1('0x56')],_0x1f4f16[_0xccf1('0x4c')]['type']);return db['Dynamics365Configuration'][_0xccf1('0x4b')](_0x1f4f16['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0xccf1('0x54')},{'model':db[_0xccf1('0x59')],'as':_0xccf1('0x57')}]});}return null;})[_0xccf1('0x25')](respondWithResult(_0x5cf3a9,null))['catch'](handleError(_0x5cf3a9,null));};exports[_0xccf1('0x5a')]=function(_0x56533b,_0x247861,_0x58d9db){var _0x300437=_0x56533b['query']['ticketType'];var _0x58a821=_0x300437===_0xccf1('0x5b')?'Incident':'PhoneCall';var _0x237874='';var _0x2797e7='';var _0x59037c='';var _0x14fdc7='';var _0x213ae7='';var _0x51e828='';var _0x10a87e='';var _0xd7642f='';var _0x26c47b=[_0xccf1('0x5c'),_0xccf1('0x5d'),_0xccf1('0x5e'),_0xccf1('0x5f'),_0xccf1('0x60'),'subject',_0xccf1('0x61'),'regardingobjectid','directioncode',_0xccf1('0x62')];var _0x49d0fc=['accountidname',_0xccf1('0x63'),_0xccf1('0x64'),_0xccf1('0x65'),_0xccf1('0x66'),'contactidyominame',_0xccf1('0x67'),_0xccf1('0x68'),'createdbyexternalpartyname',_0xccf1('0x69'),_0xccf1('0x6a'),'createdbyyominame','createdon',_0xccf1('0x6b'),'createdonbehalfbyyominame','customeridname','customeridtype',_0xccf1('0x6c'),_0xccf1('0x6d'),_0xccf1('0x6e'),'entityimage_timestamp',_0xccf1('0x6f'),_0xccf1('0x70'),_0xccf1('0x71'),'firstresponsebykpiidname',_0xccf1('0x72'),_0xccf1('0x73'),_0xccf1('0x74'),_0xccf1('0x75'),_0xccf1('0x76'),_0xccf1('0x77'),_0xccf1('0x78'),_0xccf1('0x79'),_0xccf1('0x7a'),'modifiedbyyominame',_0xccf1('0x7b'),_0xccf1('0x7c'),_0xccf1('0x7d'),'msdyn_incidenttypename',_0xccf1('0x7e'),'numberofchildincidents','onholdtime','overriddencreatedon',_0xccf1('0x7f'),_0xccf1('0x80'),_0xccf1('0x81'),_0xccf1('0x82'),_0xccf1('0x83'),_0xccf1('0x84'),'prioritycodename',_0xccf1('0x85'),_0xccf1('0x86'),'resolveby','resolvebykpiidname',_0xccf1('0x87'),_0xccf1('0x88'),_0xccf1('0x89'),_0xccf1('0x8a'),_0xccf1('0x8b'),'slaname',_0xccf1('0x8c'),_0xccf1('0x8d'),_0xccf1('0x8e'),'subjectidname','ticketnumber',_0xccf1('0x8f'),_0xccf1('0x90'),_0xccf1('0x91'),'utcconversiontimezonecode',_0xccf1('0x92')];var _0x452366=_0x26c47b[_0xccf1('0x93')](_0x49d0fc);return db[_0xccf1('0x2e')][_0xccf1('0x52')]({'where':{'id':_0x56533b[_0xccf1('0x4d')]['id']},'attributes':['id',_0xccf1('0x94'),_0xccf1('0x95'),_0xccf1('0x96'),_0xccf1('0x97'),_0xccf1('0x98'),_0xccf1('0x99')]})[_0xccf1('0x25')](handleEntityNotFound(_0x247861,null))[_0xccf1('0x25')](function(_0x462502){if(_0x462502){_0xd7642f=_0x462502[_0xccf1('0x96')];var _0x2e5e21=_0xd7642f[_0xccf1('0x9a')](-0x1);if(_0x2e5e21==='/'){_0xd7642f=_0xd7642f[_0xccf1('0x9b')](0x0,_0xd7642f['lastIndexOf'](_0x2e5e21));}_0x10a87e=util['format']('%s/api/data/v9.0/',_0xd7642f);var _0x18aeff={'method':_0xccf1('0x9c'),'uri':'https://login.microsoftonline.com/'+_0x462502[_0xccf1('0x97')]+_0xccf1('0x9d'),'form':{'client_id':_0x462502[_0xccf1('0x98')],'resource':_0xd7642f,'username':_0x462502[_0xccf1('0x94')],'password':_0x462502[_0xccf1('0x95')],'grant_type':_0xccf1('0x95'),'client_secret':_0x462502['clientSecret']},'json':!![]};return rp(_0x18aeff);}})[_0xccf1('0x25')](function(_0x58dcf3){_0x51e828=_0x58dcf3[_0xccf1('0x9e')];var _0x3a4c66={'method':'GET','uri':encodeURI(_0x10a87e+_0xccf1('0x9f')+_0x58a821+'\x27'),'headers':{'Authorization':_0xccf1('0xa0')+_0x51e828,'If-None-Match':null,'OData-Version':_0xccf1('0xa1')},'json':!![]};return rp(_0x3a4c66);})['then'](function(_0xb9eb90){var _0x1d794f=_0xb9eb90[_0xccf1('0xa2')][0x0];var _0x14aa8b=_0x1d794f[_0xccf1('0xa3')];var _0x3ae336={'method':_0xccf1('0xa4'),'uri':_0x10a87e+_0xccf1('0xa5')+_0x14aa8b+_0xccf1('0xa6'),'headers':{'Authorization':'Bearer\x20'+_0x51e828,'If-None-Match':null,'OData-Version':_0xccf1('0xa1')},'json':!![]};return rp(_0x3ae336);})[_0xccf1('0x25')](function(_0x5a1287){_0x237874=_0x5a1287;_0x2797e7=_0x237874['Attributes'];_0x2797e7=_[_0xccf1('0xa7')](_0x2797e7,function(_0x30632d){return!_0x452366[_0xccf1('0xa8')](_0x30632d['LogicalName']);});var _0x43d612=[];var _0x576c26=[];_0x2797e7['forEach'](function(_0x1cad8a){if(_0x1cad8a['@odata.type']){var _0x3ad6f0=_0x1cad8a[_0xccf1('0xa9')][_0xccf1('0x9b')](_0x1cad8a[_0xccf1('0xa9')][_0xccf1('0xaa')]('.')+0x1);if(_0x3ad6f0===_0xccf1('0xab')){_0x43d612[_0xccf1('0xac')](getSelectList(_0x10a87e,_0x300437,_0x576c26,_0x237874[_0xccf1('0xa3')],_0x1cad8a[_0xccf1('0xa3')],_0x51e828));}}});return Promise[_0xccf1('0xad')](_0x43d612);})['then'](function(_0x24b3d9){_0x59037c=_0x24b3d9[0x0];var _0x4a91b2=[];var _0x5d9da3=[];_0x2797e7[_0xccf1('0xae')](function(_0x3c6c68){if(!_['isNil'](_0x3c6c68[_0xccf1('0xa9')])){var _0x38c005=_0x3c6c68['@odata.type'][_0xccf1('0x9b')](_0x3c6c68[_0xccf1('0xa9')][_0xccf1('0xaa')]('.')+0x1);if(_0x38c005==='BooleanAttributeMetadata'){_0x4a91b2[_0xccf1('0xac')](getBooleanList(_0x10a87e,_0x300437,_0x5d9da3,_0x237874['MetadataId'],_0x3c6c68[_0xccf1('0xa3')],_0x51e828));}}});return Promise[_0xccf1('0xad')](_0x4a91b2);})[_0xccf1('0x25')](function(_0x4b8330){_0x14fdc7=_0x4b8330[0x0];var _0x2adc07=[];var _0x3546b0=[];_0x2797e7[_0xccf1('0xae')](function(_0x14de93){if(_0x14de93[_0xccf1('0xa9')]){var _0x292c96=_0x14de93[_0xccf1('0xa9')][_0xccf1('0x9b')](_0x14de93[_0xccf1('0xa9')][_0xccf1('0xaa')]('.')+0x1);if(_0x292c96===_0xccf1('0xaf')||_0x292c96===_0xccf1('0xb0')||_0x292c96===_0xccf1('0xb1')||_0x292c96===_0xccf1('0xb2')||_0x292c96===_0xccf1('0xb3')||_0x292c96==='DateTimeAttributeMetadata'||_0x292c96===_0xccf1('0xb4')||_0x292c96==='EntityNameAttributeMetadata'||_0x292c96===_0xccf1('0xb5')||_0x292c96==='DecimalAttributeMetadata'){_0x2adc07[_0xccf1('0xac')](getInputList(_0x10a87e,_0x300437,_0x292c96,_0x3546b0,_0x237874['MetadataId'],_0x14de93[_0xccf1('0xa3')],_0x51e828));}}});return Promise['all'](_0x2adc07);})[_0xccf1('0x25')](function(_0x2b210d){_0x213ae7=_0x2b210d[0x0];var _0xe4950=_0x59037c[_0xccf1('0x93')](_0x14fdc7)[_0xccf1('0x93')](_0x213ae7);var _0x5636e3={'count':_0xe4950['length'],'rows':_0xe4950};return _0x5636e3;})[_0xccf1('0x25')](respondWithResult(_0x247861,null))[_0xccf1('0x48')](function(_0x9392a9){var _0x40984c=_0x56533b[_0xccf1('0x34')][_0xccf1('0xb6')]?0x1f4:_0x9392a9[_0xccf1('0xb7')]||0x1f4;logger[_0xccf1('0x28')](_0x9392a9[_0xccf1('0x29')]);delete _0x9392a9[_0xccf1('0x2a')];if(_0x40984c===0x191){_0x40984c=0x190;}_0x247861[_0xccf1('0x1b')](_0x40984c)[_0xccf1('0x2b')](_0x56533b['query'][_0xccf1('0xb6')]?{'message':_0xccf1('0xb8'),'statusCode':_0x9392a9[_0xccf1('0xb7')]}:_0x9392a9);});};function getSelectList(_0x1fc7cd,_0x22d8a9,_0x124a97,_0x5cfbbd,_0x82e7e4,_0x3e579b){var _0x247e31={'method':_0xccf1('0xa4'),'uri':_0x1fc7cd+_0xccf1('0xa5')+_0x5cfbbd+_0xccf1('0xb9')+_0x82e7e4+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xccf1('0xba'),'headers':{'Authorization':'Bearer\x20'+_0x3e579b,'If-None-Match':null,'OData-Version':_0xccf1('0xa1')},'json':!![]};return rp(_0x247e31)['then'](function(_0x1363fb){var _0x2449e9=[];var _0x35b0b3=_0x1363fb[_0xccf1('0xbb')][_0xccf1('0xbc')];_0x35b0b3[_0xccf1('0xae')](function(_0x51df54){_0x2449e9['push']({'name':_0x51df54[_0xccf1('0xbd')][_0xccf1('0xbe')][_0xccf1('0xbd')],'value':String(_0x51df54[_0xccf1('0xbf')])});});var _0x35a0cd={'id':_0x22d8a9+'_'+_0x1363fb[_0xccf1('0xc0')],'name':_0x1363fb['DisplayName'][_0xccf1('0xbe')]['Label'],'custom':![],'options':_0x2449e9};_0x124a97[_0xccf1('0xac')](_0x35a0cd);return _0x124a97;});}function getBooleanList(_0x2dfdf9,_0x45429b,_0x5aa8d4,_0x50a0f6,_0x3446dd,_0x32548d){var _0x296055={'method':'GET','uri':_0x2dfdf9+_0xccf1('0xa5')+_0x50a0f6+_0xccf1('0xb9')+_0x3446dd+_0xccf1('0xc1'),'headers':{'Authorization':_0xccf1('0xa0')+_0x32548d,'If-None-Match':null,'OData-Version':_0xccf1('0xa1')},'json':!![]};return rp(_0x296055)[_0xccf1('0x25')](function(_0x415c4e){var _0x4e3011=[];_0x4e3011[_0xccf1('0xac')]({'name':_0x415c4e[_0xccf1('0xbb')][_0xccf1('0xc2')][_0xccf1('0xbd')]['UserLocalizedLabel'][_0xccf1('0xbd')],'value':_0xccf1('0xc3')},{'name':_0x415c4e['OptionSet']['FalseOption'][_0xccf1('0xbd')][_0xccf1('0xbe')][_0xccf1('0xbd')],'value':_0xccf1('0xc4')});var _0x402464={'id':_0x45429b+'_'+_0x415c4e[_0xccf1('0xc0')],'name':_0x415c4e['DisplayName'][_0xccf1('0xbe')][_0xccf1('0xbd')],'custom':![],'options':_0x4e3011};_0x5aa8d4[_0xccf1('0xac')](_0x402464);return _0x5aa8d4;});}function getInputList(_0x4f92ec,_0x153321,_0x5b2b7a,_0x252da5,_0x5bbced,_0x4f66df,_0xbba79a){var _0x18c6aa={'method':_0xccf1('0xa4'),'uri':_0x4f92ec+_0xccf1('0xa5')+_0x5bbced+_0xccf1('0xb9')+_0x4f66df+_0xccf1('0xc5')+_0x5b2b7a+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xccf1('0xa0')+_0xbba79a,'If-None-Match':null,'OData-Version':_0xccf1('0xa1')},'json':!![]};return rp(_0x18c6aa)['then'](function(_0x413caf){var _0x3e48b2={'id':_0x153321+'_'+_0x413caf[_0xccf1('0xc0')],'name':_0x413caf['DisplayName']['UserLocalizedLabel']?_0x413caf[_0xccf1('0xc6')]['UserLocalizedLabel']['Label']:_0x413caf['LogicalName'],'custom':![],'options':[]};_0x252da5[_0xccf1('0xac')](_0x3e48b2);return _0x252da5;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 879cf64..412af5b 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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x519418,_0x17b5b1){var _0x28d0ef=function(_0x34d19c){while(--_0x34d19c){_0x519418['push'](_0x519418['shift']());}};_0x28d0ef(++_0x17b5b1);}(_0x757a,0xde));var _0xa757=function(_0x1f3466,_0x17c721){_0x1f3466=_0x1f3466-0x0;var _0x545e9f=_0x757a[_0x1f3466];return _0x545e9f;};'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'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x159d15,_0x50164c){var _0x55b25a=function(_0x3520e5){while(--_0x3520e5){_0x159d15['push'](_0x159d15['shift']());}};_0x55b25a(++_0x50164c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'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 8d59e9e..db60726 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 _0xd59b=['ShowDynamics365Account','Dynamics365Account','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','GetDynamics365Account','findAll','options','where','attributes','limit','map','model','include','catch'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0xd59b,0x1ee));var _0xbd59=function(_0x597e1c,_0xd3e0b2){_0x597e1c=_0x597e1c-0x0;var _0x2e6471=_0xd59b[_0x597e1c];return _0x2e6471;};'use strict';var _=require(_0xbd59('0x0'));var util=require(_0xbd59('0x1'));var moment=require(_0xbd59('0x2'));var BPromise=require(_0xbd59('0x3'));var rs=require(_0xbd59('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd59('0x5'))['db'];var utils=require(_0xbd59('0x6'));var logger=require(_0xbd59('0x7'))(_0xbd59('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46e2d7,_0x225caa,_0x5dd84a){return new BPromise(function(_0xcdde57,_0x551129){return client[_0xbd59('0x9')](_0x46e2d7,_0x5dd84a)[_0xbd59('0xa')](function(_0x172b2c){logger[_0xbd59('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x225caa,_0xbd59('0xc'));logger[_0xbd59('0xd')](_0xbd59('0xe'),_0x225caa,_0xbd59('0xc'),JSON[_0xbd59('0xf')](_0x172b2c));if(_0x172b2c['error']){if(_0x172b2c[_0xbd59('0x10')][_0xbd59('0x11')]===0x1f4){logger[_0xbd59('0x10')](_0xbd59('0x12'),_0x225caa,_0x172b2c['error'][_0xbd59('0x13')]);return _0x551129(_0x172b2c['error']['message']);}logger[_0xbd59('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x225caa,_0x172b2c['error'][_0xbd59('0x13')]);return _0xcdde57(_0x172b2c['error'][_0xbd59('0x13')]);}else{logger['info'](_0xbd59('0x12'),_0x225caa,_0xbd59('0xc'));_0xcdde57(_0x172b2c[_0xbd59('0x14')][_0xbd59('0x13')]);}})['catch'](function(_0x3a0a3b){logger[_0xbd59('0x10')](_0xbd59('0x12'),_0x225caa,_0x3a0a3b);_0x551129(_0x3a0a3b);});});}exports[_0xbd59('0x15')]=function(_0x498748){var _0x130264=this;return new Promise(function(_0x38e5e2,_0x125cba){return db['Dynamics365Account'][_0xbd59('0x16')]({'raw':_0x498748[_0xbd59('0x17')]?_0x498748['options']['raw']===undefined?!![]:![]:!![],'where':_0x498748[_0xbd59('0x17')]?_0x498748[_0xbd59('0x17')][_0xbd59('0x18')]||null:null,'attributes':_0x498748[_0xbd59('0x17')]?_0x498748['options'][_0xbd59('0x19')]||null:null,'limit':_0x498748[_0xbd59('0x17')]?_0x498748[_0xbd59('0x17')][_0xbd59('0x1a')]||null:null,'include':_0x498748['options']?_0x498748[_0xbd59('0x17')]['include']?_[_0xbd59('0x1b')](_0x498748['options']['include'],function(_0xae8d61){return{'model':db[_0xae8d61[_0xbd59('0x1c')]],'as':_0xae8d61['as'],'attributes':_0xae8d61['attributes'],'include':_0xae8d61[_0xbd59('0x1d')]?_[_0xbd59('0x1b')](_0xae8d61[_0xbd59('0x1d')],function(_0xacfc14){return{'model':db[_0xacfc14[_0xbd59('0x1c')]],'as':_0xacfc14['as'],'attributes':_0xacfc14[_0xbd59('0x19')],'include':_0xacfc14[_0xbd59('0x1d')]?_['map'](_0xacfc14[_0xbd59('0x1d')],function(_0x19ae59){return{'model':db[_0x19ae59[_0xbd59('0x1c')]],'as':_0x19ae59['as'],'attributes':_0x19ae59[_0xbd59('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbd59('0xa')](function(_0x1e2f5b){logger['info']('GetDynamics365Account',_0x498748);logger[_0xbd59('0xd')](_0xbd59('0x15'),_0x498748,JSON[_0xbd59('0xf')](_0x1e2f5b));_0x38e5e2(_0x1e2f5b);})[_0xbd59('0x1e')](function(_0x313fdd){logger[_0xbd59('0x10')](_0xbd59('0x15'),_0x313fdd['message'],_0x498748);_0x125cba(_0x130264[_0xbd59('0x10')](0x1f4,_0x313fdd[_0xbd59('0x13')]));});});};exports[_0xbd59('0x1f')]=function(_0x4c0920){var _0x44887e=this;return new Promise(function(_0x367ca8,_0x51b9c7){return db[_0xbd59('0x20')][_0xbd59('0x21')]({'raw':_0x4c0920['options']?_0x4c0920[_0xbd59('0x17')][_0xbd59('0x22')]===undefined?!![]:![]:!![],'where':_0x4c0920[_0xbd59('0x17')]?_0x4c0920['options'][_0xbd59('0x18')]||null:null,'attributes':_0x4c0920[_0xbd59('0x17')]?_0x4c0920[_0xbd59('0x17')][_0xbd59('0x19')]||null:null,'include':_0x4c0920[_0xbd59('0x17')]?_0x4c0920[_0xbd59('0x17')][_0xbd59('0x1d')]?_[_0xbd59('0x1b')](_0x4c0920[_0xbd59('0x17')][_0xbd59('0x1d')],function(_0x4c3041){return{'model':db[_0x4c3041[_0xbd59('0x1c')]],'as':_0x4c3041['as'],'attributes':_0x4c3041[_0xbd59('0x19')],'include':_0x4c3041[_0xbd59('0x1d')]?_['map'](_0x4c3041[_0xbd59('0x1d')],function(_0x37a690){return{'model':db[_0x37a690[_0xbd59('0x1c')]],'as':_0x37a690['as'],'attributes':_0x37a690[_0xbd59('0x19')],'include':_0x37a690[_0xbd59('0x1d')]?_[_0xbd59('0x1b')](_0x37a690[_0xbd59('0x1d')],function(_0x1825f0){return{'model':db[_0x1825f0[_0xbd59('0x1c')]],'as':_0x1825f0['as'],'attributes':_0x1825f0[_0xbd59('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbd59('0xa')](function(_0x397fe7){logger[_0xbd59('0xb')](_0xbd59('0x1f'),_0x4c0920);logger[_0xbd59('0xd')](_0xbd59('0x1f'),_0x4c0920,JSON[_0xbd59('0xf')](_0x397fe7));_0x367ca8(_0x397fe7);})['catch'](function(_0x52f754){logger['error'](_0xbd59('0x1f'),_0x52f754[_0xbd59('0x13')],_0x4c0920);_0x51b9c7(_0x44887e[_0xbd59('0x10')](0x1f4,_0x52f754[_0xbd59('0x13')]));});});}; \ No newline at end of file +var _0x61a2=['result','catch','findAll','options','raw','attributes','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message'];(function(_0x5ddf08,_0x354c45){var _0x1cdf54=function(_0x4f4bde){while(--_0x4f4bde){_0x5ddf08['push'](_0x5ddf08['shift']());}};_0x1cdf54(++_0x354c45);}(_0x61a2,0x12d));var _0x261a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x61a2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x261a('0x0'));var util=require('util');var moment=require(_0x261a('0x1'));var BPromise=require('bluebird');var rs=require(_0x261a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x261a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x261a('0x4'))(_0x261a('0x5'));var config=require(_0x261a('0x6'));var jayson=require(_0x261a('0x7'));var client=jayson['client'][_0x261a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b49b9,_0x490272,_0x2ec26e){return new BPromise(function(_0x374007,_0x1f20b1){return client['request'](_0x4b49b9,_0x2ec26e)[_0x261a('0x9')](function(_0xda9e8d){logger[_0x261a('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x490272,_0x261a('0xb'));logger[_0x261a('0xc')](_0x261a('0xd'),_0x490272,_0x261a('0xb'),JSON[_0x261a('0xe')](_0xda9e8d));if(_0xda9e8d['error']){if(_0xda9e8d[_0x261a('0xf')][_0x261a('0x10')]===0x1f4){logger['error'](_0x261a('0x11'),_0x490272,_0xda9e8d[_0x261a('0xf')][_0x261a('0x12')]);return _0x1f20b1(_0xda9e8d[_0x261a('0xf')][_0x261a('0x12')]);}logger[_0x261a('0xf')](_0x261a('0x11'),_0x490272,_0xda9e8d[_0x261a('0xf')][_0x261a('0x12')]);return _0x374007(_0xda9e8d[_0x261a('0xf')][_0x261a('0x12')]);}else{logger[_0x261a('0xa')](_0x261a('0x11'),_0x490272,_0x261a('0xb'));_0x374007(_0xda9e8d[_0x261a('0x13')]['message']);}})[_0x261a('0x14')](function(_0x21e9d0){logger['error'](_0x261a('0x11'),_0x490272,_0x21e9d0);_0x1f20b1(_0x21e9d0);});});}exports['GetDynamics365Account']=function(_0x49c9c7){var _0x1c30a8=this;return new Promise(function(_0x598878,_0x211f1f){return db['Dynamics365Account'][_0x261a('0x15')]({'raw':_0x49c9c7[_0x261a('0x16')]?_0x49c9c7[_0x261a('0x16')][_0x261a('0x17')]===undefined?!![]:![]:!![],'where':_0x49c9c7['options']?_0x49c9c7['options']['where']||null:null,'attributes':_0x49c9c7[_0x261a('0x16')]?_0x49c9c7[_0x261a('0x16')][_0x261a('0x18')]||null:null,'limit':_0x49c9c7['options']?_0x49c9c7[_0x261a('0x16')][_0x261a('0x19')]||null:null,'include':_0x49c9c7[_0x261a('0x16')]?_0x49c9c7[_0x261a('0x16')][_0x261a('0x1a')]?_[_0x261a('0x1b')](_0x49c9c7[_0x261a('0x16')][_0x261a('0x1a')],function(_0x8330b0){return{'model':db[_0x8330b0[_0x261a('0x1c')]],'as':_0x8330b0['as'],'attributes':_0x8330b0[_0x261a('0x18')],'include':_0x8330b0['include']?_[_0x261a('0x1b')](_0x8330b0[_0x261a('0x1a')],function(_0x469096){return{'model':db[_0x469096[_0x261a('0x1c')]],'as':_0x469096['as'],'attributes':_0x469096[_0x261a('0x18')],'include':_0x469096[_0x261a('0x1a')]?_[_0x261a('0x1b')](_0x469096[_0x261a('0x1a')],function(_0x214d74){return{'model':db[_0x214d74[_0x261a('0x1c')]],'as':_0x214d74['as'],'attributes':_0x214d74['attributes']};}):[]};}):[]};}):[]:[]})[_0x261a('0x9')](function(_0x100e6a){logger[_0x261a('0xa')]('GetDynamics365Account',_0x49c9c7);logger[_0x261a('0xc')](_0x261a('0x1d'),_0x49c9c7,JSON['stringify'](_0x100e6a));_0x598878(_0x100e6a);})[_0x261a('0x14')](function(_0x54e66e){logger[_0x261a('0xf')](_0x261a('0x1d'),_0x54e66e[_0x261a('0x12')],_0x49c9c7);_0x211f1f(_0x1c30a8['error'](0x1f4,_0x54e66e['message']));});});};exports[_0x261a('0x1e')]=function(_0x4a238c){var _0x36a665=this;return new Promise(function(_0x478a07,_0x2a47cf){return db['Dynamics365Account']['find']({'raw':_0x4a238c[_0x261a('0x16')]?_0x4a238c[_0x261a('0x16')][_0x261a('0x17')]===undefined?!![]:![]:!![],'where':_0x4a238c[_0x261a('0x16')]?_0x4a238c[_0x261a('0x16')][_0x261a('0x1f')]||null:null,'attributes':_0x4a238c[_0x261a('0x16')]?_0x4a238c[_0x261a('0x16')][_0x261a('0x18')]||null:null,'include':_0x4a238c['options']?_0x4a238c[_0x261a('0x16')]['include']?_[_0x261a('0x1b')](_0x4a238c[_0x261a('0x16')]['include'],function(_0x79a94b){return{'model':db[_0x79a94b['model']],'as':_0x79a94b['as'],'attributes':_0x79a94b[_0x261a('0x18')],'include':_0x79a94b[_0x261a('0x1a')]?_[_0x261a('0x1b')](_0x79a94b[_0x261a('0x1a')],function(_0x296124){return{'model':db[_0x296124['model']],'as':_0x296124['as'],'attributes':_0x296124[_0x261a('0x18')],'include':_0x296124['include']?_[_0x261a('0x1b')](_0x296124['include'],function(_0x279421){return{'model':db[_0x279421['model']],'as':_0x279421['as'],'attributes':_0x279421['attributes']};}):[]};}):[]};}):[]:[]})[_0x261a('0x9')](function(_0x36f902){logger['info']('ShowDynamics365Account',_0x4a238c);logger['debug'](_0x261a('0x1e'),_0x4a238c,JSON['stringify'](_0x36f902));_0x478a07(_0x36f902);})[_0x261a('0x14')](function(_0x5c7e4d){logger[_0x261a('0xf')]('ShowDynamics365Account',_0x5c7e4d['message'],_0x4a238c);_0x2a47cf(_0x36a665[_0x261a('0xf')](0x1f4,_0x5c7e4d[_0x261a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 16d0bf2..a7b3f5d 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 _0xca6d=['get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getDescriptions','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0xca6d,0x75));var _0xdca6=function(_0x221b20,_0x4d612d){_0x221b20=_0x221b20-0x0;var _0x23d251=_0xca6d[_0x221b20];return _0x23d251;};'use strict';var multer=require('multer');var util=require(_0xdca6('0x0'));var path=require(_0xdca6('0x1'));var timeout=require(_0xdca6('0x2'));var express=require(_0xdca6('0x3'));var router=express[_0xdca6('0x4')]();var fs_extra=require(_0xdca6('0x5'));var auth=require(_0xdca6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdca6('0x7'));var controller=require(_0xdca6('0x8'));router[_0xdca6('0x9')]('/',auth[_0xdca6('0xa')](),controller['index']);router['get']('/:id',auth[_0xdca6('0xa')](),controller[_0xdca6('0xb')]);router['get'](_0xdca6('0xc'),auth[_0xdca6('0xa')](),controller[_0xdca6('0xd')]);router[_0xdca6('0x9')](_0xdca6('0xe'),auth[_0xdca6('0xa')](),controller['getSubjects']);router[_0xdca6('0x9')]('/:id/descriptions',auth[_0xdca6('0xa')](),controller[_0xdca6('0xf')]);router['post']('/',auth[_0xdca6('0xa')](),controller['create']);router[_0xdca6('0x10')](_0xdca6('0x11'),auth['isAuthenticated'](),controller[_0xdca6('0x12')]);router[_0xdca6('0x13')](_0xdca6('0x11'),auth[_0xdca6('0xa')](),controller['destroy']);module[_0xdca6('0x14')]=router; \ No newline at end of file +var _0xd11e=['isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get'];(function(_0x119e7a,_0x57584f){var _0x41725c=function(_0x429f97){while(--_0x429f97){_0x119e7a['push'](_0x119e7a['shift']());}};_0x41725c(++_0x57584f);}(_0xd11e,0xe6));var _0xed11=function(_0x54f634,_0x4a8120){_0x54f634=_0x54f634-0x0;var _0x551cd8=_0xd11e[_0x54f634];return _0x551cd8;};'use strict';var multer=require('multer');var util=require(_0xed11('0x0'));var path=require(_0xed11('0x1'));var timeout=require(_0xed11('0x2'));var express=require(_0xed11('0x3'));var router=express[_0xed11('0x4')]();var fs_extra=require(_0xed11('0x5'));var auth=require(_0xed11('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xed11('0x7'));var controller=require(_0xed11('0x8'));router[_0xed11('0x9')]('/',auth[_0xed11('0xa')](),controller['index']);router[_0xed11('0x9')](_0xed11('0xb'),auth[_0xed11('0xa')](),controller[_0xed11('0xc')]);router[_0xed11('0x9')](_0xed11('0xd'),auth['isAuthenticated'](),controller[_0xed11('0xe')]);router['get'](_0xed11('0xf'),auth[_0xed11('0xa')](),controller['getSubjects']);router['get'](_0xed11('0x10'),auth[_0xed11('0xa')](),controller[_0xed11('0x11')]);router[_0xed11('0x12')]('/',auth[_0xed11('0xa')](),controller[_0xed11('0x13')]);router[_0xed11('0x14')](_0xed11('0xb'),auth[_0xed11('0xa')](),controller['update']);router[_0xed11('0x15')]('/:id',auth[_0xed11('0xa')](),controller[_0xed11('0x16')]);module[_0xed11('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 3950d55..fd17c4b 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 _0x9ba3=['exports','STRING','ENUM','phonecall','incident','contact','nothing','sequelize'];(function(_0x83ac26,_0x29f04d){var _0x2ce0f7=function(_0x6a1d45){while(--_0x6a1d45){_0x83ac26['push'](_0x83ac26['shift']());}};_0x2ce0f7(++_0x29f04d);}(_0x9ba3,0x137));var _0x39ba=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9ba3[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x39ba('0x0'));module[_0x39ba('0x1')]={'name':{'type':Sequelize[_0x39ba('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x39ba('0x3')]('incident',_0x39ba('0x4')),'defaultValue':_0x39ba('0x5')},'moduleCreate':{'type':Sequelize[_0x39ba('0x3')](_0x39ba('0x6'),_0x39ba('0x7')),'defaultValue':_0x39ba('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x5df3=['phonecall','ENUM','contact','nothing','sequelize','STRING','incident'];(function(_0x1370d3,_0x1307f2){var _0x509fcb=function(_0x3ff47b){while(--_0x3ff47b){_0x1370d3['push'](_0x1370d3['shift']());}};_0x509fcb(++_0x1307f2);}(_0x5df3,0x1cb));var _0x35df=function(_0x215393,_0x4c406d){_0x215393=_0x215393-0x0;var _0x595198=_0x5df3[_0x215393];return _0x595198;};'use strict';var Sequelize=require(_0x35df('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x35df('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x35df('0x2'),_0x35df('0x3')),'defaultValue':_0x35df('0x2')},'moduleCreate':{'type':Sequelize[_0x35df('0x4')](_0x35df('0x5'),_0x35df('0x6')),'defaultValue':_0x35df('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 559597e..30a6741 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 _0xe32d=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','rawAttributes','includeAll','find','create','body','getFields','findOne','Dynamics365Field','order','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x5e2338,_0x443a51){var _0x4990aa=function(_0x5ae127){while(--_0x5ae127){_0x5e2338['push'](_0x5e2338['shift']());}};_0x4990aa(++_0x443a51);}(_0xe32d,0x1b2));var _0xde32=function(_0x41f02a,_0x42174e){_0x41f02a=_0x41f02a-0x0;var _0x3dc780=_0xe32d[_0x41f02a];return _0x3dc780;};'use strict';var emlformat=require(_0xde32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xde32('0x1'));var jsonpatch=require(_0xde32('0x2'));var rp=require(_0xde32('0x3'));var moment=require(_0xde32('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xde32('0x5'));var util=require(_0xde32('0x6'));var path=require(_0xde32('0x7'));var sox=require(_0xde32('0x8'));var csv=require(_0xde32('0x9'));var ejs=require(_0xde32('0xa'));var fs=require('fs');var fs_extra=require(_0xde32('0xb'));var _=require('lodash');var squel=require(_0xde32('0xc'));var crypto=require(_0xde32('0xd'));var jsforce=require(_0xde32('0xe'));var deskjs=require(_0xde32('0xf'));var toCsv=require(_0xde32('0x9'));var querystring=require(_0xde32('0x10'));var Papa=require(_0xde32('0x11'));var Redis=require(_0xde32('0x12'));var authService=require(_0xde32('0x13'));var qs=require(_0xde32('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xde32('0x15'));var utils=require('../../config/utils');var config=require(_0xde32('0x16'));var licenseUtil=require(_0xde32('0x17'));var db=require(_0xde32('0x18'))['db'];function respondWithStatusCode(_0x17b874,_0x26724a){_0x26724a=_0x26724a||0xcc;return function(_0x49775a){if(_0x49775a){return _0x17b874[_0xde32('0x19')](_0x26724a);}return _0x17b874[_0xde32('0x1a')](_0x26724a)[_0xde32('0x1b')]();};}function respondWithResult(_0x1c52de,_0x113cfa){_0x113cfa=_0x113cfa||0xc8;return function(_0x37dc4d){if(_0x37dc4d){return _0x1c52de['status'](_0x113cfa)[_0xde32('0x1c')](_0x37dc4d);}};}function respondWithFilteredResult(_0x2f3261,_0x285e02){return function(_0x9514cf){if(_0x9514cf){var _0x549a66=typeof _0x285e02[_0xde32('0x1d')]===_0xde32('0x1e')&&typeof _0x285e02[_0xde32('0x1f')]===_0xde32('0x1e');var _0x4781ba=_0x9514cf[_0xde32('0x20')];var _0x138699=_0x549a66?0x0:_0x285e02[_0xde32('0x1d')];var _0x3b225f=_0x549a66?_0x9514cf[_0xde32('0x20')]:_0x285e02[_0xde32('0x1d')]+_0x285e02[_0xde32('0x1f')];var _0x2686e5;if(_0x3b225f>=_0x4781ba){_0x3b225f=_0x4781ba;_0x2686e5=0xc8;}else{_0x2686e5=0xce;}_0x2f3261[_0xde32('0x1a')](_0x2686e5);return _0x2f3261[_0xde32('0x21')]('Content-Range',_0x138699+'-'+_0x3b225f+'/'+_0x4781ba)[_0xde32('0x1c')](_0x9514cf);}return null;};}function patchUpdates(_0x2e6450){return function(_0x195944){try{jsonpatch[_0xde32('0x22')](_0x195944,_0x2e6450,!![]);}catch(_0x1da6b7){return BPromise[_0xde32('0x23')](_0x1da6b7);}return _0x195944[_0xde32('0x24')]();};}function saveUpdates(_0x59a38e,_0x5c3a4c){return function(_0xf2bedd){if(_0xf2bedd){return _0xf2bedd[_0xde32('0x25')](_0x59a38e)[_0xde32('0x26')](function(_0x1a6da4){return _0x1a6da4;});}return null;};}function removeEntity(_0x55c99c,_0x280e75){return function(_0x130ad2){if(_0x130ad2){return _0x130ad2[_0xde32('0x27')]()[_0xde32('0x26')](function(){_0x55c99c[_0xde32('0x1a')](0xcc)[_0xde32('0x1b')]();});}};}function handleEntityNotFound(_0x5d1ed8,_0x58486){return function(_0x57840d){if(!_0x57840d){_0x5d1ed8['sendStatus'](0x194);}return _0x57840d;};}function handleError(_0x12bb06,_0x1dc6dc){_0x1dc6dc=_0x1dc6dc||0x1f4;return function(_0x2b9154){logger[_0xde32('0x28')](_0x2b9154[_0xde32('0x29')]);if(_0x2b9154[_0xde32('0x2a')]){delete _0x2b9154[_0xde32('0x2a')];}_0x12bb06[_0xde32('0x1a')](_0x1dc6dc)[_0xde32('0x2b')](_0x2b9154);};}exports[_0xde32('0x2c')]=function(_0xd3cb91,_0x5ecf62){var _0x3384ae={},_0x115f3f={},_0x1d390c={'count':0x0,'rows':[]};var _0x5c2f3c=_[_0xde32('0x2d')](db[_0xde32('0x2e')]['rawAttributes'],function(_0x19e304){return{'name':_0x19e304[_0xde32('0x2f')],'type':_0x19e304[_0xde32('0x30')][_0xde32('0x31')]};});_0x115f3f[_0xde32('0x32')]=_[_0xde32('0x2d')](_0x5c2f3c,_0xde32('0x2a'));_0x115f3f[_0xde32('0x33')]=_[_0xde32('0x34')](_0xd3cb91[_0xde32('0x33')]);_0x115f3f[_0xde32('0x35')]=_[_0xde32('0x36')](_0x115f3f['model'],_0x115f3f[_0xde32('0x33')]);_0x3384ae[_0xde32('0x37')]=_[_0xde32('0x36')](_0x115f3f[_0xde32('0x32')],qs['fields'](_0xd3cb91['query'][_0xde32('0x38')]));_0x3384ae[_0xde32('0x37')]=_0x3384ae['attributes'][_0xde32('0x39')]?_0x3384ae[_0xde32('0x37')]:_0x115f3f[_0xde32('0x32')];if(!_0xd3cb91['query'][_0xde32('0x3a')](_0xde32('0x3b'))){_0x3384ae[_0xde32('0x1f')]=qs[_0xde32('0x1f')](_0xd3cb91['query'][_0xde32('0x1f')]);_0x3384ae['offset']=qs['offset'](_0xd3cb91['query']['offset']);}_0x3384ae['order']=qs[_0xde32('0x3c')](_0xd3cb91['query'][_0xde32('0x3c')]);_0x3384ae[_0xde32('0x3d')]=qs[_0xde32('0x35')](_[_0xde32('0x3e')](_0xd3cb91[_0xde32('0x33')],_0x115f3f['filters']),_0x5c2f3c);if(_0xd3cb91[_0xde32('0x33')][_0xde32('0x3f')]){_0x3384ae['where']=_[_0xde32('0x40')](_0x3384ae[_0xde32('0x3d')],{'$or':_[_0xde32('0x2d')](_0x5c2f3c,function(_0x37fd62){if(_0x37fd62[_0xde32('0x30')]!==_0xde32('0x41')){var _0x153920={};_0x153920[_0x37fd62['name']]={'$like':'%'+_0xd3cb91[_0xde32('0x33')][_0xde32('0x3f')]+'%'};return _0x153920;}})});}_0x3384ae=_['merge']({},_0x3384ae,_0xd3cb91[_0xde32('0x42')]);var _0x318e6b={'where':_0x3384ae[_0xde32('0x3d')]};return db[_0xde32('0x2e')][_0xde32('0x20')](_0x318e6b)[_0xde32('0x26')](function(_0x4b3fbd){_0x1d390c[_0xde32('0x20')]=_0x4b3fbd;if(_0xd3cb91[_0xde32('0x33')]['includeAll']){_0x3384ae[_0xde32('0x43')]=[{'all':!![]}];}return db[_0xde32('0x2e')]['findAll'](_0x3384ae);})[_0xde32('0x26')](function(_0x18a7f7){_0x1d390c[_0xde32('0x44')]=_0x18a7f7;return _0x1d390c;})[_0xde32('0x26')](respondWithFilteredResult(_0x5ecf62,_0x3384ae))[_0xde32('0x45')](handleError(_0x5ecf62,null));};exports['show']=function(_0x10a4ee,_0x533ce7){var _0xc2f9f1={'raw':![],'where':{'id':_0x10a4ee[_0xde32('0x46')]['id']}},_0x3bcb1d={};_0x3bcb1d[_0xde32('0x32')]=_[_0xde32('0x34')](db[_0xde32('0x2e')][_0xde32('0x47')]);_0x3bcb1d['query']=_[_0xde32('0x34')](_0x10a4ee[_0xde32('0x33')]);_0x3bcb1d[_0xde32('0x35')]=_[_0xde32('0x36')](_0x3bcb1d[_0xde32('0x32')],_0x3bcb1d['query']);_0xc2f9f1[_0xde32('0x37')]=_[_0xde32('0x36')](_0x3bcb1d[_0xde32('0x32')],qs['fields'](_0x10a4ee['query'][_0xde32('0x38')]));_0xc2f9f1[_0xde32('0x37')]=_0xc2f9f1[_0xde32('0x37')][_0xde32('0x39')]?_0xc2f9f1[_0xde32('0x37')]:_0x3bcb1d[_0xde32('0x32')];if(_0x10a4ee[_0xde32('0x33')][_0xde32('0x48')]){_0xc2f9f1[_0xde32('0x43')]=[{'all':!![]}];}_0xc2f9f1=_[_0xde32('0x40')]({},_0xc2f9f1,_0x10a4ee[_0xde32('0x42')]);return db[_0xde32('0x2e')][_0xde32('0x49')](_0xc2f9f1)[_0xde32('0x26')](handleEntityNotFound(_0x533ce7,null))[_0xde32('0x26')](respondWithResult(_0x533ce7,null))['catch'](handleError(_0x533ce7,null));};exports[_0xde32('0x4a')]=function(_0x3c9b6c,_0x1fa3fd){return db[_0xde32('0x2e')]['create'](_0x3c9b6c[_0xde32('0x4b')],{})[_0xde32('0x26')](respondWithResult(_0x1fa3fd,0xc9))['catch'](handleError(_0x1fa3fd,null));};exports[_0xde32('0x25')]=function(_0x19391b,_0x1223d3){if(_0x19391b[_0xde32('0x4b')]['id']){delete _0x19391b['body']['id'];}return db[_0xde32('0x2e')]['find']({'where':{'id':_0x19391b[_0xde32('0x46')]['id']}})[_0xde32('0x26')](handleEntityNotFound(_0x1223d3,null))[_0xde32('0x26')](saveUpdates(_0x19391b[_0xde32('0x4b')],null))[_0xde32('0x26')](respondWithResult(_0x1223d3,null))['catch'](handleError(_0x1223d3,null));};exports[_0xde32('0x27')]=function(_0xffff89,_0x4df25a){return db[_0xde32('0x2e')]['find']({'where':{'id':_0xffff89[_0xde32('0x46')]['id']}})[_0xde32('0x26')](handleEntityNotFound(_0x4df25a,null))[_0xde32('0x26')](removeEntity(_0x4df25a,null))[_0xde32('0x45')](handleError(_0x4df25a,null));};exports[_0xde32('0x4c')]=function(_0x2cb10b,_0x454823,_0x202a52){var _0x6df54b={};var _0x2addbf={};var _0x2066aa;var _0x292194;return db[_0xde32('0x2e')][_0xde32('0x4d')]({'where':{'id':_0x2cb10b['params']['id']}})[_0xde32('0x26')](handleEntityNotFound(_0x454823,null))[_0xde32('0x26')](function(_0x494adb){if(_0x494adb){_0x2066aa=_0x494adb;_0x2addbf[_0xde32('0x32')]=_['keys'](db[_0xde32('0x4e')][_0xde32('0x47')]);_0x2addbf['query']=_[_0xde32('0x34')](_0x2cb10b[_0xde32('0x33')]);_0x2addbf[_0xde32('0x35')]=_[_0xde32('0x36')](_0x2addbf[_0xde32('0x32')],_0x2addbf[_0xde32('0x33')]);_0x6df54b[_0xde32('0x37')]=_['intersection'](_0x2addbf[_0xde32('0x32')],qs[_0xde32('0x38')](_0x2cb10b[_0xde32('0x33')][_0xde32('0x38')]));_0x6df54b[_0xde32('0x37')]=_0x6df54b[_0xde32('0x37')][_0xde32('0x39')]?_0x6df54b[_0xde32('0x37')]:_0x2addbf[_0xde32('0x32')];_0x6df54b[_0xde32('0x4f')]=qs[_0xde32('0x3c')](_0x2cb10b[_0xde32('0x33')][_0xde32('0x3c')]);_0x6df54b['where']=qs[_0xde32('0x35')](_[_0xde32('0x3e')](_0x2cb10b[_0xde32('0x33')],_0x2addbf[_0xde32('0x35')]));if(_0x2cb10b[_0xde32('0x33')]['filter']){_0x6df54b[_0xde32('0x3d')]=_['merge'](_0x6df54b[_0xde32('0x3d')],{'$or':_[_0xde32('0x2d')](_0x6df54b[_0xde32('0x37')],function(_0x58890a){var _0x131811={};_0x131811[_0x58890a]={'$like':'%'+_0x2cb10b[_0xde32('0x33')][_0xde32('0x3f')]+'%'};return _0x131811;})});}_0x6df54b=_['merge']({},_0x6df54b,_0x2cb10b[_0xde32('0x42')]);return _0x2066aa[_0xde32('0x4c')](_0x6df54b);}})[_0xde32('0x26')](function(_0x3aeebd){if(_0x3aeebd){_0x292194=_0x3aeebd[_0xde32('0x39')];if(!_0x2cb10b[_0xde32('0x33')]['hasOwnProperty'](_0xde32('0x3b'))){_0x6df54b[_0xde32('0x1f')]=qs[_0xde32('0x1f')](_0x2cb10b[_0xde32('0x33')]['limit']);_0x6df54b[_0xde32('0x1d')]=qs['offset'](_0x2cb10b['query'][_0xde32('0x1d')]);}return _0x2066aa['getFields'](_0x6df54b);}})[_0xde32('0x26')](function(_0x973424){if(_0x973424){return _0x973424?{'count':_0x292194,'rows':_0x973424}:null;}})[_0xde32('0x26')](respondWithResult(_0x454823,null))[_0xde32('0x45')](handleError(_0x454823,null));};exports['getSubjects']=function(_0x14e8de,_0x5e085b,_0x3c600f){var _0x398aea={};var _0x56befa={};var _0x3cf808;var _0x1824b5;return db[_0xde32('0x2e')][_0xde32('0x4d')]({'where':{'id':_0x14e8de[_0xde32('0x46')]['id']}})[_0xde32('0x26')](handleEntityNotFound(_0x5e085b,null))['then'](function(_0x216efb){if(_0x216efb){_0x3cf808=_0x216efb;_0x56befa[_0xde32('0x32')]=_[_0xde32('0x34')](db[_0xde32('0x4e')]['rawAttributes']);_0x56befa[_0xde32('0x33')]=_[_0xde32('0x34')](_0x14e8de[_0xde32('0x33')]);_0x56befa[_0xde32('0x35')]=_[_0xde32('0x36')](_0x56befa['model'],_0x56befa[_0xde32('0x33')]);_0x398aea[_0xde32('0x37')]=_[_0xde32('0x36')](_0x56befa[_0xde32('0x32')],qs[_0xde32('0x38')](_0x14e8de['query'][_0xde32('0x38')]));_0x398aea[_0xde32('0x37')]=_0x398aea[_0xde32('0x37')]['length']?_0x398aea['attributes']:_0x56befa['model'];_0x398aea['order']=qs[_0xde32('0x3c')](_0x14e8de[_0xde32('0x33')][_0xde32('0x3c')]);_0x398aea[_0xde32('0x3d')]=qs[_0xde32('0x35')](_[_0xde32('0x3e')](_0x14e8de[_0xde32('0x33')],_0x56befa['filters']));if(_0x14e8de[_0xde32('0x33')][_0xde32('0x3f')]){_0x398aea[_0xde32('0x3d')]=_[_0xde32('0x40')](_0x398aea[_0xde32('0x3d')],{'$or':_[_0xde32('0x2d')](_0x398aea['attributes'],function(_0x1a3b88){var _0x54c496={};_0x54c496[_0x1a3b88]={'$like':'%'+_0x14e8de[_0xde32('0x33')]['filter']+'%'};return _0x54c496;})});}_0x398aea=_[_0xde32('0x40')]({},_0x398aea,_0x14e8de[_0xde32('0x42')]);return _0x3cf808[_0xde32('0x50')](_0x398aea);}})[_0xde32('0x26')](function(_0x3fe4f7){if(_0x3fe4f7){_0x1824b5=_0x3fe4f7['length'];if(!_0x14e8de[_0xde32('0x33')]['hasOwnProperty'](_0xde32('0x3b'))){_0x398aea[_0xde32('0x1f')]=qs[_0xde32('0x1f')](_0x14e8de[_0xde32('0x33')][_0xde32('0x1f')]);_0x398aea[_0xde32('0x1d')]=qs[_0xde32('0x1d')](_0x14e8de[_0xde32('0x33')][_0xde32('0x1d')]);}return _0x3cf808[_0xde32('0x50')](_0x398aea);}})['then'](function(_0x4c6ef4){if(_0x4c6ef4){return _0x4c6ef4?{'count':_0x1824b5,'rows':_0x4c6ef4}:null;}})[_0xde32('0x26')](respondWithResult(_0x5e085b,null))[_0xde32('0x45')](handleError(_0x5e085b,null));};exports['getDescriptions']=function(_0x2f8797,_0xbb624c,_0x45fa7c){var _0x1cb4e7={};var _0x495de3={};var _0x431623;var _0x17f6ed;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x2f8797[_0xde32('0x46')]['id']}})[_0xde32('0x26')](handleEntityNotFound(_0xbb624c,null))[_0xde32('0x26')](function(_0x2b2a90){if(_0x2b2a90){_0x431623=_0x2b2a90;_0x495de3[_0xde32('0x32')]=_[_0xde32('0x34')](db[_0xde32('0x4e')][_0xde32('0x47')]);_0x495de3['query']=_[_0xde32('0x34')](_0x2f8797[_0xde32('0x33')]);_0x495de3['filters']=_[_0xde32('0x36')](_0x495de3['model'],_0x495de3[_0xde32('0x33')]);_0x1cb4e7[_0xde32('0x37')]=_[_0xde32('0x36')](_0x495de3[_0xde32('0x32')],qs[_0xde32('0x38')](_0x2f8797[_0xde32('0x33')][_0xde32('0x38')]));_0x1cb4e7[_0xde32('0x37')]=_0x1cb4e7[_0xde32('0x37')][_0xde32('0x39')]?_0x1cb4e7[_0xde32('0x37')]:_0x495de3[_0xde32('0x32')];_0x1cb4e7[_0xde32('0x4f')]=qs[_0xde32('0x3c')](_0x2f8797[_0xde32('0x33')][_0xde32('0x3c')]);_0x1cb4e7[_0xde32('0x3d')]=qs[_0xde32('0x35')](_['pick'](_0x2f8797['query'],_0x495de3['filters']));if(_0x2f8797['query'][_0xde32('0x3f')]){_0x1cb4e7['where']=_['merge'](_0x1cb4e7[_0xde32('0x3d')],{'$or':_[_0xde32('0x2d')](_0x1cb4e7[_0xde32('0x37')],function(_0x501106){var _0x542ab8={};_0x542ab8[_0x501106]={'$like':'%'+_0x2f8797['query'][_0xde32('0x3f')]+'%'};return _0x542ab8;})});}_0x1cb4e7=_[_0xde32('0x40')]({},_0x1cb4e7,_0x2f8797[_0xde32('0x42')]);return _0x431623['getDescriptions'](_0x1cb4e7);}})['then'](function(_0x46f6b3){if(_0x46f6b3){_0x17f6ed=_0x46f6b3[_0xde32('0x39')];if(!_0x2f8797[_0xde32('0x33')]['hasOwnProperty'](_0xde32('0x3b'))){_0x1cb4e7[_0xde32('0x1f')]=qs[_0xde32('0x1f')](_0x2f8797['query']['limit']);_0x1cb4e7[_0xde32('0x1d')]=qs[_0xde32('0x1d')](_0x2f8797[_0xde32('0x33')][_0xde32('0x1d')]);}return _0x431623[_0xde32('0x51')](_0x1cb4e7);}})['then'](function(_0x4aecac){if(_0x4aecac){return _0x4aecac?{'count':_0x17f6ed,'rows':_0x4aecac}:null;}})[_0xde32('0x26')](respondWithResult(_0xbb624c,null))['catch'](handleError(_0xbb624c,null));}; \ No newline at end of file +var _0x2a33=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','Dynamics365Configuration','rawAttributes','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','Dynamics365Field','pick','getSubjects','findOne','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2a33,0x1df));var _0x32a3=function(_0x5e0810,_0x74dd07){_0x5e0810=_0x5e0810-0x0;var _0x5c3aae=_0x2a33[_0x5e0810];return _0x5c3aae;};'use strict';var emlformat=require(_0x32a3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x32a3('0x1'));var rp=require(_0x32a3('0x2'));var moment=require(_0x32a3('0x3'));var BPromise=require(_0x32a3('0x4'));var Mustache=require(_0x32a3('0x5'));var util=require(_0x32a3('0x6'));var path=require(_0x32a3('0x7'));var sox=require(_0x32a3('0x8'));var csv=require(_0x32a3('0x9'));var ejs=require(_0x32a3('0xa'));var fs=require('fs');var fs_extra=require(_0x32a3('0xb'));var _=require(_0x32a3('0xc'));var squel=require('squel');var crypto=require(_0x32a3('0xd'));var jsforce=require(_0x32a3('0xe'));var deskjs=require(_0x32a3('0xf'));var toCsv=require(_0x32a3('0x9'));var querystring=require(_0x32a3('0x10'));var Papa=require('papaparse');var Redis=require(_0x32a3('0x11'));var authService=require(_0x32a3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x32a3('0x13'));var hardwareService=require(_0x32a3('0x14'));var logger=require(_0x32a3('0x15'))(_0x32a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x32a3('0x17'));var db=require(_0x32a3('0x18'))['db'];function respondWithStatusCode(_0x33bcc2,_0x2b5e6c){_0x2b5e6c=_0x2b5e6c||0xcc;return function(_0x48b270){if(_0x48b270){return _0x33bcc2['sendStatus'](_0x2b5e6c);}return _0x33bcc2['status'](_0x2b5e6c)['end']();};}function respondWithResult(_0x28ee46,_0x2fe0e4){_0x2fe0e4=_0x2fe0e4||0xc8;return function(_0x2725c9){if(_0x2725c9){return _0x28ee46[_0x32a3('0x19')](_0x2fe0e4)[_0x32a3('0x1a')](_0x2725c9);}};}function respondWithFilteredResult(_0x459c43,_0xf763ef){return function(_0x43ccf3){if(_0x43ccf3){var _0x2d6e6c=typeof _0xf763ef['offset']===_0x32a3('0x1b')&&typeof _0xf763ef['limit']==='undefined';var _0x566c68=_0x43ccf3['count'];var _0x43a6cd=_0x2d6e6c?0x0:_0xf763ef['offset'];var _0x213831=_0x2d6e6c?_0x43ccf3[_0x32a3('0x1c')]:_0xf763ef[_0x32a3('0x1d')]+_0xf763ef[_0x32a3('0x1e')];var _0x1c3ba8;if(_0x213831>=_0x566c68){_0x213831=_0x566c68;_0x1c3ba8=0xc8;}else{_0x1c3ba8=0xce;}_0x459c43[_0x32a3('0x19')](_0x1c3ba8);return _0x459c43[_0x32a3('0x1f')](_0x32a3('0x20'),_0x43a6cd+'-'+_0x213831+'/'+_0x566c68)['json'](_0x43ccf3);}return null;};}function patchUpdates(_0x4fb56c){return function(_0x5ebe98){try{jsonpatch[_0x32a3('0x21')](_0x5ebe98,_0x4fb56c,!![]);}catch(_0x2e0c30){return BPromise[_0x32a3('0x22')](_0x2e0c30);}return _0x5ebe98[_0x32a3('0x23')]();};}function saveUpdates(_0x553a60,_0x4a2e48){return function(_0x12424b){if(_0x12424b){return _0x12424b[_0x32a3('0x24')](_0x553a60)[_0x32a3('0x25')](function(_0x588dc6){return _0x588dc6;});}return null;};}function removeEntity(_0x2c11c1,_0x47e699){return function(_0x5de90b){if(_0x5de90b){return _0x5de90b[_0x32a3('0x26')]()[_0x32a3('0x25')](function(){_0x2c11c1[_0x32a3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e251d,_0x36ffc7){return function(_0x45d062){if(!_0x45d062){_0x5e251d[_0x32a3('0x27')](0x194);}return _0x45d062;};}function handleError(_0x28f63e,_0x338c50){_0x338c50=_0x338c50||0x1f4;return function(_0x1f762f){logger[_0x32a3('0x28')](_0x1f762f[_0x32a3('0x29')]);if(_0x1f762f[_0x32a3('0x2a')]){delete _0x1f762f[_0x32a3('0x2a')];}_0x28f63e['status'](_0x338c50)['send'](_0x1f762f);};}exports[_0x32a3('0x2b')]=function(_0x46b7e3,_0x2b6420){var _0x36dd6d={},_0x203661={},_0x5b300e={'count':0x0,'rows':[]};var _0x373441=_['map'](db[_0x32a3('0x2c')][_0x32a3('0x2d')],function(_0x5e0fbb){return{'name':_0x5e0fbb['fieldName'],'type':_0x5e0fbb['type'][_0x32a3('0x2e')]};});_0x203661['model']=_[_0x32a3('0x2f')](_0x373441,_0x32a3('0x2a'));_0x203661[_0x32a3('0x30')]=_[_0x32a3('0x31')](_0x46b7e3[_0x32a3('0x30')]);_0x203661[_0x32a3('0x32')]=_['intersection'](_0x203661[_0x32a3('0x33')],_0x203661[_0x32a3('0x30')]);_0x36dd6d['attributes']=_[_0x32a3('0x34')](_0x203661['model'],qs[_0x32a3('0x35')](_0x46b7e3['query']['fields']));_0x36dd6d['attributes']=_0x36dd6d[_0x32a3('0x36')][_0x32a3('0x37')]?_0x36dd6d[_0x32a3('0x36')]:_0x203661[_0x32a3('0x33')];if(!_0x46b7e3['query'][_0x32a3('0x38')](_0x32a3('0x39'))){_0x36dd6d['limit']=qs[_0x32a3('0x1e')](_0x46b7e3[_0x32a3('0x30')][_0x32a3('0x1e')]);_0x36dd6d['offset']=qs[_0x32a3('0x1d')](_0x46b7e3[_0x32a3('0x30')]['offset']);}_0x36dd6d[_0x32a3('0x3a')]=qs[_0x32a3('0x3b')](_0x46b7e3[_0x32a3('0x30')][_0x32a3('0x3b')]);_0x36dd6d[_0x32a3('0x3c')]=qs[_0x32a3('0x32')](_['pick'](_0x46b7e3[_0x32a3('0x30')],_0x203661['filters']),_0x373441);if(_0x46b7e3['query'][_0x32a3('0x3d')]){_0x36dd6d['where']=_[_0x32a3('0x3e')](_0x36dd6d['where'],{'$or':_[_0x32a3('0x2f')](_0x373441,function(_0x2c296a){if(_0x2c296a[_0x32a3('0x3f')]!==_0x32a3('0x40')){var _0x23dcaa={};_0x23dcaa[_0x2c296a[_0x32a3('0x2a')]]={'$like':'%'+_0x46b7e3[_0x32a3('0x30')]['filter']+'%'};return _0x23dcaa;}})});}_0x36dd6d=_[_0x32a3('0x3e')]({},_0x36dd6d,_0x46b7e3[_0x32a3('0x41')]);var _0x5bfa87={'where':_0x36dd6d[_0x32a3('0x3c')]};return db[_0x32a3('0x2c')]['count'](_0x5bfa87)[_0x32a3('0x25')](function(_0x19c84e){_0x5b300e[_0x32a3('0x1c')]=_0x19c84e;if(_0x46b7e3[_0x32a3('0x30')][_0x32a3('0x42')]){_0x36dd6d[_0x32a3('0x43')]=[{'all':!![]}];}return db[_0x32a3('0x2c')][_0x32a3('0x44')](_0x36dd6d);})[_0x32a3('0x25')](function(_0x10ca09){_0x5b300e[_0x32a3('0x45')]=_0x10ca09;return _0x5b300e;})[_0x32a3('0x25')](respondWithFilteredResult(_0x2b6420,_0x36dd6d))[_0x32a3('0x46')](handleError(_0x2b6420,null));};exports[_0x32a3('0x47')]=function(_0x40988a,_0x286418){var _0x22f500={'raw':![],'where':{'id':_0x40988a[_0x32a3('0x48')]['id']}},_0x2c54bc={};_0x2c54bc[_0x32a3('0x33')]=_[_0x32a3('0x31')](db[_0x32a3('0x2c')][_0x32a3('0x2d')]);_0x2c54bc[_0x32a3('0x30')]=_[_0x32a3('0x31')](_0x40988a[_0x32a3('0x30')]);_0x2c54bc['filters']=_['intersection'](_0x2c54bc['model'],_0x2c54bc[_0x32a3('0x30')]);_0x22f500[_0x32a3('0x36')]=_[_0x32a3('0x34')](_0x2c54bc[_0x32a3('0x33')],qs[_0x32a3('0x35')](_0x40988a['query']['fields']));_0x22f500['attributes']=_0x22f500['attributes'][_0x32a3('0x37')]?_0x22f500[_0x32a3('0x36')]:_0x2c54bc[_0x32a3('0x33')];if(_0x40988a[_0x32a3('0x30')][_0x32a3('0x42')]){_0x22f500[_0x32a3('0x43')]=[{'all':!![]}];}_0x22f500=_[_0x32a3('0x3e')]({},_0x22f500,_0x40988a[_0x32a3('0x41')]);return db[_0x32a3('0x2c')][_0x32a3('0x49')](_0x22f500)['then'](handleEntityNotFound(_0x286418,null))[_0x32a3('0x25')](respondWithResult(_0x286418,null))[_0x32a3('0x46')](handleError(_0x286418,null));};exports['create']=function(_0x3acdfc,_0x49d6c0){return db[_0x32a3('0x2c')][_0x32a3('0x4a')](_0x3acdfc[_0x32a3('0x4b')],{})[_0x32a3('0x25')](respondWithResult(_0x49d6c0,0xc9))['catch'](handleError(_0x49d6c0,null));};exports[_0x32a3('0x24')]=function(_0x57ef01,_0x22f38b){if(_0x57ef01[_0x32a3('0x4b')]['id']){delete _0x57ef01['body']['id'];}return db[_0x32a3('0x2c')][_0x32a3('0x49')]({'where':{'id':_0x57ef01[_0x32a3('0x48')]['id']}})[_0x32a3('0x25')](handleEntityNotFound(_0x22f38b,null))[_0x32a3('0x25')](saveUpdates(_0x57ef01['body'],null))[_0x32a3('0x25')](respondWithResult(_0x22f38b,null))['catch'](handleError(_0x22f38b,null));};exports[_0x32a3('0x26')]=function(_0x5b236f,_0x1b6c36){return db[_0x32a3('0x2c')][_0x32a3('0x49')]({'where':{'id':_0x5b236f[_0x32a3('0x48')]['id']}})[_0x32a3('0x25')](handleEntityNotFound(_0x1b6c36,null))[_0x32a3('0x25')](removeEntity(_0x1b6c36,null))[_0x32a3('0x46')](handleError(_0x1b6c36,null));};exports[_0x32a3('0x4c')]=function(_0x33da61,_0x51ddb0,_0x231582){var _0x57e2a2={};var _0x5ea3ae={};var _0x14bd25;var _0x5e0cd8;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x33da61[_0x32a3('0x48')]['id']}})[_0x32a3('0x25')](handleEntityNotFound(_0x51ddb0,null))[_0x32a3('0x25')](function(_0x448d3f){if(_0x448d3f){_0x14bd25=_0x448d3f;_0x5ea3ae[_0x32a3('0x33')]=_[_0x32a3('0x31')](db[_0x32a3('0x4d')]['rawAttributes']);_0x5ea3ae[_0x32a3('0x30')]=_['keys'](_0x33da61['query']);_0x5ea3ae[_0x32a3('0x32')]=_[_0x32a3('0x34')](_0x5ea3ae[_0x32a3('0x33')],_0x5ea3ae[_0x32a3('0x30')]);_0x57e2a2[_0x32a3('0x36')]=_[_0x32a3('0x34')](_0x5ea3ae[_0x32a3('0x33')],qs[_0x32a3('0x35')](_0x33da61['query'][_0x32a3('0x35')]));_0x57e2a2[_0x32a3('0x36')]=_0x57e2a2[_0x32a3('0x36')][_0x32a3('0x37')]?_0x57e2a2[_0x32a3('0x36')]:_0x5ea3ae[_0x32a3('0x33')];_0x57e2a2[_0x32a3('0x3a')]=qs[_0x32a3('0x3b')](_0x33da61['query']['sort']);_0x57e2a2['where']=qs['filters'](_[_0x32a3('0x4e')](_0x33da61[_0x32a3('0x30')],_0x5ea3ae[_0x32a3('0x32')]));if(_0x33da61['query'][_0x32a3('0x3d')]){_0x57e2a2['where']=_['merge'](_0x57e2a2[_0x32a3('0x3c')],{'$or':_[_0x32a3('0x2f')](_0x57e2a2['attributes'],function(_0x223b28){var _0x322fba={};_0x322fba[_0x223b28]={'$like':'%'+_0x33da61[_0x32a3('0x30')][_0x32a3('0x3d')]+'%'};return _0x322fba;})});}_0x57e2a2=_['merge']({},_0x57e2a2,_0x33da61[_0x32a3('0x41')]);return _0x14bd25[_0x32a3('0x4c')](_0x57e2a2);}})[_0x32a3('0x25')](function(_0x3512bb){if(_0x3512bb){_0x5e0cd8=_0x3512bb[_0x32a3('0x37')];if(!_0x33da61[_0x32a3('0x30')][_0x32a3('0x38')](_0x32a3('0x39'))){_0x57e2a2[_0x32a3('0x1e')]=qs[_0x32a3('0x1e')](_0x33da61[_0x32a3('0x30')]['limit']);_0x57e2a2[_0x32a3('0x1d')]=qs[_0x32a3('0x1d')](_0x33da61[_0x32a3('0x30')][_0x32a3('0x1d')]);}return _0x14bd25[_0x32a3('0x4c')](_0x57e2a2);}})[_0x32a3('0x25')](function(_0x53db76){if(_0x53db76){return _0x53db76?{'count':_0x5e0cd8,'rows':_0x53db76}:null;}})[_0x32a3('0x25')](respondWithResult(_0x51ddb0,null))[_0x32a3('0x46')](handleError(_0x51ddb0,null));};exports[_0x32a3('0x4f')]=function(_0x1c58d0,_0x95b4a2,_0x41bdaa){var _0x4edd70={};var _0x420184={};var _0x3a703b;var _0x2781b6;return db[_0x32a3('0x2c')][_0x32a3('0x50')]({'where':{'id':_0x1c58d0['params']['id']}})[_0x32a3('0x25')](handleEntityNotFound(_0x95b4a2,null))['then'](function(_0x129e94){if(_0x129e94){_0x3a703b=_0x129e94;_0x420184['model']=_[_0x32a3('0x31')](db[_0x32a3('0x4d')]['rawAttributes']);_0x420184[_0x32a3('0x30')]=_['keys'](_0x1c58d0[_0x32a3('0x30')]);_0x420184[_0x32a3('0x32')]=_[_0x32a3('0x34')](_0x420184[_0x32a3('0x33')],_0x420184[_0x32a3('0x30')]);_0x4edd70[_0x32a3('0x36')]=_['intersection'](_0x420184[_0x32a3('0x33')],qs[_0x32a3('0x35')](_0x1c58d0[_0x32a3('0x30')][_0x32a3('0x35')]));_0x4edd70[_0x32a3('0x36')]=_0x4edd70['attributes'][_0x32a3('0x37')]?_0x4edd70[_0x32a3('0x36')]:_0x420184['model'];_0x4edd70['order']=qs[_0x32a3('0x3b')](_0x1c58d0[_0x32a3('0x30')][_0x32a3('0x3b')]);_0x4edd70[_0x32a3('0x3c')]=qs[_0x32a3('0x32')](_[_0x32a3('0x4e')](_0x1c58d0['query'],_0x420184[_0x32a3('0x32')]));if(_0x1c58d0[_0x32a3('0x30')][_0x32a3('0x3d')]){_0x4edd70['where']=_[_0x32a3('0x3e')](_0x4edd70[_0x32a3('0x3c')],{'$or':_[_0x32a3('0x2f')](_0x4edd70[_0x32a3('0x36')],function(_0x3a5b3d){var _0x2e181d={};_0x2e181d[_0x3a5b3d]={'$like':'%'+_0x1c58d0[_0x32a3('0x30')][_0x32a3('0x3d')]+'%'};return _0x2e181d;})});}_0x4edd70=_[_0x32a3('0x3e')]({},_0x4edd70,_0x1c58d0[_0x32a3('0x41')]);return _0x3a703b['getSubjects'](_0x4edd70);}})[_0x32a3('0x25')](function(_0x9e812){if(_0x9e812){_0x2781b6=_0x9e812[_0x32a3('0x37')];if(!_0x1c58d0[_0x32a3('0x30')][_0x32a3('0x38')](_0x32a3('0x39'))){_0x4edd70[_0x32a3('0x1e')]=qs[_0x32a3('0x1e')](_0x1c58d0['query']['limit']);_0x4edd70[_0x32a3('0x1d')]=qs['offset'](_0x1c58d0[_0x32a3('0x30')][_0x32a3('0x1d')]);}return _0x3a703b['getSubjects'](_0x4edd70);}})[_0x32a3('0x25')](function(_0x46cb58){if(_0x46cb58){return _0x46cb58?{'count':_0x2781b6,'rows':_0x46cb58}:null;}})[_0x32a3('0x25')](respondWithResult(_0x95b4a2,null))[_0x32a3('0x46')](handleError(_0x95b4a2,null));};exports[_0x32a3('0x51')]=function(_0x1f03ab,_0x496bba,_0x595629){var _0x3f2c2b={};var _0x506ffc={};var _0x5f1be5;var _0x16f522;return db[_0x32a3('0x2c')][_0x32a3('0x50')]({'where':{'id':_0x1f03ab[_0x32a3('0x48')]['id']}})[_0x32a3('0x25')](handleEntityNotFound(_0x496bba,null))['then'](function(_0x1d69dd){if(_0x1d69dd){_0x5f1be5=_0x1d69dd;_0x506ffc['model']=_[_0x32a3('0x31')](db[_0x32a3('0x4d')][_0x32a3('0x2d')]);_0x506ffc[_0x32a3('0x30')]=_['keys'](_0x1f03ab[_0x32a3('0x30')]);_0x506ffc[_0x32a3('0x32')]=_[_0x32a3('0x34')](_0x506ffc['model'],_0x506ffc['query']);_0x3f2c2b[_0x32a3('0x36')]=_[_0x32a3('0x34')](_0x506ffc[_0x32a3('0x33')],qs[_0x32a3('0x35')](_0x1f03ab['query'][_0x32a3('0x35')]));_0x3f2c2b['attributes']=_0x3f2c2b[_0x32a3('0x36')][_0x32a3('0x37')]?_0x3f2c2b[_0x32a3('0x36')]:_0x506ffc['model'];_0x3f2c2b[_0x32a3('0x3a')]=qs['sort'](_0x1f03ab[_0x32a3('0x30')][_0x32a3('0x3b')]);_0x3f2c2b[_0x32a3('0x3c')]=qs[_0x32a3('0x32')](_['pick'](_0x1f03ab['query'],_0x506ffc[_0x32a3('0x32')]));if(_0x1f03ab[_0x32a3('0x30')][_0x32a3('0x3d')]){_0x3f2c2b[_0x32a3('0x3c')]=_[_0x32a3('0x3e')](_0x3f2c2b[_0x32a3('0x3c')],{'$or':_[_0x32a3('0x2f')](_0x3f2c2b[_0x32a3('0x36')],function(_0x3f1a80){var _0x3739c5={};_0x3739c5[_0x3f1a80]={'$like':'%'+_0x1f03ab[_0x32a3('0x30')]['filter']+'%'};return _0x3739c5;})});}_0x3f2c2b=_[_0x32a3('0x3e')]({},_0x3f2c2b,_0x1f03ab[_0x32a3('0x41')]);return _0x5f1be5[_0x32a3('0x51')](_0x3f2c2b);}})[_0x32a3('0x25')](function(_0x82ab5){if(_0x82ab5){_0x16f522=_0x82ab5[_0x32a3('0x37')];if(!_0x1f03ab['query'][_0x32a3('0x38')]('nolimit')){_0x3f2c2b[_0x32a3('0x1e')]=qs[_0x32a3('0x1e')](_0x1f03ab[_0x32a3('0x30')][_0x32a3('0x1e')]);_0x3f2c2b[_0x32a3('0x1d')]=qs[_0x32a3('0x1d')](_0x1f03ab[_0x32a3('0x30')]['offset']);}return _0x5f1be5[_0x32a3('0x51')](_0x3f2c2b);}})[_0x32a3('0x25')](function(_0x22d8ec){if(_0x22d8ec){return _0x22d8ec?{'count':_0x16f522,'rows':_0x22d8ec}:null;}})['then'](respondWithResult(_0x496bba,null))['catch'](handleError(_0x496bba,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 0e5fea7..081810f 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 _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','int_dynamics365_configurations','lodash','util','api'];(function(_0x40d55c,_0x519c00){var _0x2a4279=function(_0x57b1cf){while(--_0x57b1cf){_0x40d55c['push'](_0x40d55c['shift']());}};_0x2a4279(++_0x519c00);}(_0xa41a,0x6b));var _0xaa41=function(_0x394cc7,_0x314571){_0x394cc7=_0x394cc7-0x0;var _0xa56a29=_0xa41a[_0x394cc7];return _0xa56a29;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Dynamics365Configuration',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb43b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x3353b0,_0x1285cd){var _0x403438=function(_0xff0da6){while(--_0xff0da6){_0x3353b0['push'](_0x3353b0['shift']());}};_0x403438(++_0x1285cd);}(_0xb43b,0x1b2));var _0xbb43=function(_0x303252,_0x230c8e){_0x303252=_0x303252-0x0;var _0x18202c=_0xb43b[_0x303252];return _0x18202c;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'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 bf8c486..83ba6b5 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 _0x93a2=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x93a2,0x134));var _0x293a=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0x93a2[_0x14a862];return _0x245eb5;};'use strict';var _=require(_0x293a('0x0'));var util=require(_0x293a('0x1'));var moment=require(_0x293a('0x2'));var BPromise=require(_0x293a('0x3'));var rs=require(_0x293a('0x4'));var fs=require('fs');var Redis=require(_0x293a('0x5'));var db=require(_0x293a('0x6'))['db'];var utils=require(_0x293a('0x7'));var logger=require(_0x293a('0x8'))('rpc');var config=require(_0x293a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x293a('0xa')][_0x293a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fb19d,_0x38c5ce,_0x50c4a4){return new BPromise(function(_0x78a675,_0x57286e){return client[_0x293a('0xc')](_0x4fb19d,_0x50c4a4)[_0x293a('0xd')](function(_0x271994){logger[_0x293a('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x38c5ce,_0x293a('0xf'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x38c5ce,'request\x20sent',JSON[_0x293a('0x10')](_0x271994));if(_0x271994[_0x293a('0x11')]){if(_0x271994[_0x293a('0x11')][_0x293a('0x12')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x38c5ce,_0x271994['error'][_0x293a('0x13')]);return _0x57286e(_0x271994[_0x293a('0x11')][_0x293a('0x13')]);}logger[_0x293a('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x38c5ce,_0x271994[_0x293a('0x11')][_0x293a('0x13')]);return _0x78a675(_0x271994['error'][_0x293a('0x13')]);}else{logger[_0x293a('0xe')](_0x293a('0x14'),_0x38c5ce,_0x293a('0xf'));_0x78a675(_0x271994['result'][_0x293a('0x13')]);}})['catch'](function(_0x5301d4){logger[_0x293a('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x38c5ce,_0x5301d4);_0x57286e(_0x5301d4);});});} \ No newline at end of file +var _0xd9af=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment'];(function(_0x5e7514,_0x30c2e1){var _0x12f472=function(_0x33ddb6){while(--_0x33ddb6){_0x5e7514['push'](_0x5e7514['shift']());}};_0x12f472(++_0x30c2e1);}(_0xd9af,0xe4));var _0xfd9a=function(_0x267426,_0x5cea64){_0x267426=_0x267426-0x0;var _0x334782=_0xd9af[_0x267426];return _0x334782;};'use strict';var _=require(_0xfd9a('0x0'));var util=require(_0xfd9a('0x1'));var moment=require(_0xfd9a('0x2'));var BPromise=require('bluebird');var rs=require(_0xfd9a('0x3'));var fs=require('fs');var Redis=require(_0xfd9a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd9a('0x5'));var logger=require(_0xfd9a('0x6'))(_0xfd9a('0x7'));var config=require(_0xfd9a('0x8'));var jayson=require(_0xfd9a('0x9'));var client=jayson[_0xfd9a('0xa')][_0xfd9a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xec49bd,_0x5ba577,_0xe79d31){return new BPromise(function(_0x2ddde4,_0x4b398d){return client[_0xfd9a('0xc')](_0xec49bd,_0xe79d31)[_0xfd9a('0xd')](function(_0x48fa20){logger[_0xfd9a('0xe')](_0xfd9a('0xf'),_0x5ba577,_0xfd9a('0x10'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x5ba577,_0xfd9a('0x10'),JSON['stringify'](_0x48fa20));if(_0x48fa20[_0xfd9a('0x11')]){if(_0x48fa20[_0xfd9a('0x11')][_0xfd9a('0x12')]===0x1f4){logger[_0xfd9a('0x11')](_0xfd9a('0xf'),_0x5ba577,_0x48fa20[_0xfd9a('0x11')][_0xfd9a('0x13')]);return _0x4b398d(_0x48fa20[_0xfd9a('0x11')]['message']);}logger[_0xfd9a('0x11')](_0xfd9a('0xf'),_0x5ba577,_0x48fa20[_0xfd9a('0x11')][_0xfd9a('0x13')]);return _0x2ddde4(_0x48fa20['error'][_0xfd9a('0x13')]);}else{logger[_0xfd9a('0xe')](_0xfd9a('0xf'),_0x5ba577,_0xfd9a('0x10'));_0x2ddde4(_0x48fa20[_0xfd9a('0x14')]['message']);}})['catch'](function(_0x27e804){logger['error'](_0xfd9a('0xf'),_0x5ba577,_0x27e804);_0x4b398d(_0x27e804);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 90bb337..af337d6 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 _0x8c65=['../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x29fcaf,_0x20c943){var _0x4adcb2=function(_0x59e82a){while(--_0x59e82a){_0x29fcaf['push'](_0x29fcaf['shift']());}};_0x4adcb2(++_0x20c943);}(_0x8c65,0x10b));var _0x58c6=function(_0x37f85a,_0x240e20){_0x37f85a=_0x37f85a-0x0;var _0x190eeb=_0x8c65[_0x37f85a];return _0x190eeb;};'use strict';var multer=require('multer');var util=require(_0x58c6('0x0'));var path=require(_0x58c6('0x1'));var timeout=require(_0x58c6('0x2'));var express=require('express');var router=express[_0x58c6('0x3')]();var fs_extra=require(_0x58c6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x58c6('0x5'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0x58c6('0x6')]('/',auth[_0x58c6('0x7')](),controller['index']);router[_0x58c6('0x6')](_0x58c6('0x8'),auth[_0x58c6('0x7')](),controller[_0x58c6('0x9')]);router[_0x58c6('0xa')]('/',auth[_0x58c6('0x7')](),controller[_0x58c6('0xb')]);router[_0x58c6('0xc')](_0x58c6('0x8'),auth['isAuthenticated'](),controller[_0x58c6('0xd')]);router[_0x58c6('0xe')]('/:id',auth[_0x58c6('0x7')](),controller[_0x58c6('0xf')]);module[_0x58c6('0x10')]=router; \ No newline at end of file +var _0x6994=['create','put','update','destroy','exports','util','path','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6994,0x135));var _0x4699=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x6994[_0x5627e1];return _0x2f013f;};'use strict';var multer=require('multer');var util=require(_0x4699('0x0'));var path=require(_0x4699('0x1'));var timeout=require('connect-timeout');var express=require(_0x4699('0x2'));var router=express[_0x4699('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4699('0x4'));var controller=require('./intDynamics365Field.controller');router[_0x4699('0x5')]('/',auth[_0x4699('0x6')](),controller[_0x4699('0x7')]);router[_0x4699('0x5')](_0x4699('0x8'),auth[_0x4699('0x6')](),controller[_0x4699('0x9')]);router[_0x4699('0xa')]('/',auth[_0x4699('0x6')](),controller[_0x4699('0xb')]);router[_0x4699('0xc')](_0x4699('0x8'),auth[_0x4699('0x6')](),controller[_0x4699('0xd')]);router['delete'](_0x4699('0x8'),auth[_0x4699('0x6')](),controller[_0x4699('0xe')]);module[_0x4699('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 ba7c35d..1e80458 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 _0xd661=['variable','keyValue','STRING','string','customVariable','BOOLEAN','sequelize','ENUM'];(function(_0x10a102,_0x54dcf7){var _0x5b819e=function(_0x5a6eda){while(--_0x5a6eda){_0x10a102['push'](_0x10a102['shift']());}};_0x5b819e(++_0x54dcf7);}(_0xd661,0x116));var _0x1d66=function(_0x660458,_0xb8d968){_0x660458=_0x660458-0x0;var _0x6d089e=_0xd661[_0x660458];return _0x6d089e;};'use strict';var Sequelize=require(_0x1d66('0x0'));module['exports']={'type':{'type':Sequelize[_0x1d66('0x1')]('string',_0x1d66('0x2'),'customVariable',_0x1d66('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x1d66('0x4')]},'key':{'type':Sequelize[_0x1d66('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x1d66('0x5'),_0x1d66('0x2'),_0x1d66('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1d66('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1d66('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1d66('0x4')]}}; \ No newline at end of file +var _0xf37a=['STRING','variable','BOOLEAN','sequelize','string','customVariable'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0xf37a,0x171));var _0xaf37=function(_0x1a00e8,_0x2746b8){_0x1a00e8=_0x1a00e8-0x0;var _0x5acb59=_0xf37a[_0x1a00e8];return _0x5acb59;};'use strict';var Sequelize=require(_0xaf37('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xaf37('0x1'),'variable',_0xaf37('0x2'),'keyValue','picklist'),'defaultValue':_0xaf37('0x1')},'content':{'type':Sequelize[_0xaf37('0x3')]},'key':{'type':Sequelize[_0xaf37('0x3')]},'keyType':{'type':Sequelize['ENUM'](_0xaf37('0x1'),_0xaf37('0x4'),_0xaf37('0x2'))},'keyContent':{'type':Sequelize[_0xaf37('0x3')]},'idField':{'type':Sequelize[_0xaf37('0x3')]},'nameField':{'type':Sequelize[_0xaf37('0x3')]},'customField':{'type':Sequelize[_0xaf37('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaf37('0x3')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 294d006..f977cc6 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 _0xa9bf=['reject','save','update','then','destroy','name','index','Dynamics365Field','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','map','VIRTUAL','merge','options','includeAll','include','catch','params','rawAttributes','find','create','body','rimraf','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','end','json','offset','undefined','limit','count','status','set','Content-Range','apply'];(function(_0x566414,_0x374fcc){var _0x488866=function(_0x46b6aa){while(--_0x46b6aa){_0x566414['push'](_0x566414['shift']());}};_0x488866(++_0x374fcc);}(_0xa9bf,0x14d));var _0xfa9b=function(_0x59c20e,_0x272105){_0x59c20e=_0x59c20e-0x0;var _0x383b97=_0xa9bf[_0x59c20e];return _0x383b97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa9b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfa9b('0x1'));var Mustache=require(_0xfa9b('0x2'));var util=require(_0xfa9b('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xfa9b('0x4'));var ejs=require(_0xfa9b('0x5'));var fs=require('fs');var fs_extra=require(_0xfa9b('0x6'));var _=require(_0xfa9b('0x7'));var squel=require(_0xfa9b('0x8'));var crypto=require(_0xfa9b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xfa9b('0xa'));var toCsv=require(_0xfa9b('0x4'));var querystring=require(_0xfa9b('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfa9b('0xc'));var qs=require(_0xfa9b('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa9b('0xe'))(_0xfa9b('0xf'));var utils=require(_0xfa9b('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x589676,_0x1865ac){_0x1865ac=_0x1865ac||0xcc;return function(_0x3851bc){if(_0x3851bc){return _0x589676['sendStatus'](_0x1865ac);}return _0x589676['status'](_0x1865ac)[_0xfa9b('0x11')]();};}function respondWithResult(_0x5315f7,_0x26314f){_0x26314f=_0x26314f||0xc8;return function(_0xd3a9a){if(_0xd3a9a){return _0x5315f7['status'](_0x26314f)[_0xfa9b('0x12')](_0xd3a9a);}};}function respondWithFilteredResult(_0x1d85a7,_0xbcd17f){return function(_0x2aa083){if(_0x2aa083){var _0x39d793=typeof _0xbcd17f[_0xfa9b('0x13')]===_0xfa9b('0x14')&&typeof _0xbcd17f[_0xfa9b('0x15')]===_0xfa9b('0x14');var _0x83f92=_0x2aa083[_0xfa9b('0x16')];var _0x15dff0=_0x39d793?0x0:_0xbcd17f['offset'];var _0x12688b=_0x39d793?_0x2aa083[_0xfa9b('0x16')]:_0xbcd17f['offset']+_0xbcd17f[_0xfa9b('0x15')];var _0xdd1a3c;if(_0x12688b>=_0x83f92){_0x12688b=_0x83f92;_0xdd1a3c=0xc8;}else{_0xdd1a3c=0xce;}_0x1d85a7[_0xfa9b('0x17')](_0xdd1a3c);return _0x1d85a7[_0xfa9b('0x18')](_0xfa9b('0x19'),_0x15dff0+'-'+_0x12688b+'/'+_0x83f92)[_0xfa9b('0x12')](_0x2aa083);}return null;};}function patchUpdates(_0x48d201){return function(_0x151aef){try{jsonpatch[_0xfa9b('0x1a')](_0x151aef,_0x48d201,!![]);}catch(_0x57bd1f){return BPromise[_0xfa9b('0x1b')](_0x57bd1f);}return _0x151aef[_0xfa9b('0x1c')]();};}function saveUpdates(_0xde127a,_0x369829){return function(_0x1b66e9){if(_0x1b66e9){return _0x1b66e9[_0xfa9b('0x1d')](_0xde127a)[_0xfa9b('0x1e')](function(_0xd647e5){return _0xd647e5;});}return null;};}function removeEntity(_0x2655af,_0x5d0df1){return function(_0x86b86f){if(_0x86b86f){return _0x86b86f[_0xfa9b('0x1f')]()[_0xfa9b('0x1e')](function(){_0x2655af[_0xfa9b('0x17')](0xcc)[_0xfa9b('0x11')]();});}};}function handleEntityNotFound(_0x285b41,_0x55662d){return function(_0x493067){if(!_0x493067){_0x285b41['sendStatus'](0x194);}return _0x493067;};}function handleError(_0x1212f3,_0x4139a3){_0x4139a3=_0x4139a3||0x1f4;return function(_0x587e52){logger['error'](_0x587e52['stack']);if(_0x587e52[_0xfa9b('0x20')]){delete _0x587e52['name'];}_0x1212f3[_0xfa9b('0x17')](_0x4139a3)['send'](_0x587e52);};}exports[_0xfa9b('0x21')]=function(_0x4698d1,_0x22a029){var _0x540f54={},_0xa0f71={},_0x49f574={'count':0x0,'rows':[]};var _0x516d2d=_['map'](db[_0xfa9b('0x22')]['rawAttributes'],function(_0x1e2088){return{'name':_0x1e2088[_0xfa9b('0x23')],'type':_0x1e2088['type']['key']};});_0xa0f71[_0xfa9b('0x24')]=_['map'](_0x516d2d,_0xfa9b('0x20'));_0xa0f71[_0xfa9b('0x25')]=_[_0xfa9b('0x26')](_0x4698d1[_0xfa9b('0x25')]);_0xa0f71[_0xfa9b('0x27')]=_['intersection'](_0xa0f71['model'],_0xa0f71[_0xfa9b('0x25')]);_0x540f54[_0xfa9b('0x28')]=_[_0xfa9b('0x29')](_0xa0f71[_0xfa9b('0x24')],qs['fields'](_0x4698d1[_0xfa9b('0x25')][_0xfa9b('0x2a')]));_0x540f54[_0xfa9b('0x28')]=_0x540f54[_0xfa9b('0x28')][_0xfa9b('0x2b')]?_0x540f54['attributes']:_0xa0f71[_0xfa9b('0x24')];if(!_0x4698d1[_0xfa9b('0x25')][_0xfa9b('0x2c')]('nolimit')){_0x540f54[_0xfa9b('0x15')]=qs[_0xfa9b('0x15')](_0x4698d1[_0xfa9b('0x25')][_0xfa9b('0x15')]);_0x540f54[_0xfa9b('0x13')]=qs['offset'](_0x4698d1['query']['offset']);}_0x540f54['order']=qs['sort'](_0x4698d1[_0xfa9b('0x25')][_0xfa9b('0x2d')]);_0x540f54[_0xfa9b('0x2e')]=qs[_0xfa9b('0x27')](_['pick'](_0x4698d1['query'],_0xa0f71[_0xfa9b('0x27')]),_0x516d2d);if(_0x4698d1[_0xfa9b('0x25')][_0xfa9b('0x2f')]){_0x540f54[_0xfa9b('0x2e')]=_['merge'](_0x540f54[_0xfa9b('0x2e')],{'$or':_[_0xfa9b('0x30')](_0x516d2d,function(_0x535da2){if(_0x535da2['type']!==_0xfa9b('0x31')){var _0x4cead5={};_0x4cead5[_0x535da2[_0xfa9b('0x20')]]={'$like':'%'+_0x4698d1[_0xfa9b('0x25')][_0xfa9b('0x2f')]+'%'};return _0x4cead5;}})});}_0x540f54=_[_0xfa9b('0x32')]({},_0x540f54,_0x4698d1[_0xfa9b('0x33')]);var _0x1d0ec1={'where':_0x540f54['where']};return db[_0xfa9b('0x22')][_0xfa9b('0x16')](_0x1d0ec1)['then'](function(_0x2f598a){_0x49f574[_0xfa9b('0x16')]=_0x2f598a;if(_0x4698d1[_0xfa9b('0x25')][_0xfa9b('0x34')]){_0x540f54[_0xfa9b('0x35')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x540f54);})[_0xfa9b('0x1e')](function(_0x1941ac){_0x49f574['rows']=_0x1941ac;return _0x49f574;})[_0xfa9b('0x1e')](respondWithFilteredResult(_0x22a029,_0x540f54))[_0xfa9b('0x36')](handleError(_0x22a029,null));};exports['show']=function(_0x443d3c,_0x4a2ceb){var _0x591066={'raw':!![],'where':{'id':_0x443d3c[_0xfa9b('0x37')]['id']}},_0x4bbb13={};_0x4bbb13[_0xfa9b('0x24')]=_[_0xfa9b('0x26')](db[_0xfa9b('0x22')][_0xfa9b('0x38')]);_0x4bbb13[_0xfa9b('0x25')]=_[_0xfa9b('0x26')](_0x443d3c[_0xfa9b('0x25')]);_0x4bbb13['filters']=_['intersection'](_0x4bbb13[_0xfa9b('0x24')],_0x4bbb13[_0xfa9b('0x25')]);_0x591066[_0xfa9b('0x28')]=_[_0xfa9b('0x29')](_0x4bbb13['model'],qs[_0xfa9b('0x2a')](_0x443d3c[_0xfa9b('0x25')][_0xfa9b('0x2a')]));_0x591066[_0xfa9b('0x28')]=_0x591066[_0xfa9b('0x28')]['length']?_0x591066[_0xfa9b('0x28')]:_0x4bbb13['model'];if(_0x443d3c[_0xfa9b('0x25')][_0xfa9b('0x34')]){_0x591066[_0xfa9b('0x35')]=[{'all':!![]}];}_0x591066=_[_0xfa9b('0x32')]({},_0x591066,_0x443d3c[_0xfa9b('0x33')]);return db[_0xfa9b('0x22')][_0xfa9b('0x39')](_0x591066)[_0xfa9b('0x1e')](handleEntityNotFound(_0x4a2ceb,null))['then'](respondWithResult(_0x4a2ceb,null))[_0xfa9b('0x36')](handleError(_0x4a2ceb,null));};exports[_0xfa9b('0x3a')]=function(_0x34fed3,_0x40781d){return db['Dynamics365Field']['create'](_0x34fed3[_0xfa9b('0x3b')],{})[_0xfa9b('0x1e')](respondWithResult(_0x40781d,0xc9))[_0xfa9b('0x36')](handleError(_0x40781d,null));};exports['update']=function(_0x508107,_0x53c698){if(_0x508107[_0xfa9b('0x3b')]['id']){delete _0x508107[_0xfa9b('0x3b')]['id'];}return db['Dynamics365Field'][_0xfa9b('0x39')]({'where':{'id':_0x508107[_0xfa9b('0x37')]['id']}})['then'](handleEntityNotFound(_0x53c698,null))[_0xfa9b('0x1e')](saveUpdates(_0x508107[_0xfa9b('0x3b')],null))[_0xfa9b('0x1e')](respondWithResult(_0x53c698,null))[_0xfa9b('0x36')](handleError(_0x53c698,null));};exports[_0xfa9b('0x1f')]=function(_0x3c9379,_0x29b6cc){return db[_0xfa9b('0x22')][_0xfa9b('0x39')]({'where':{'id':_0x3c9379[_0xfa9b('0x37')]['id']}})[_0xfa9b('0x1e')](handleEntityNotFound(_0x29b6cc,null))[_0xfa9b('0x1e')](removeEntity(_0x29b6cc,null))[_0xfa9b('0x36')](handleError(_0x29b6cc,null));}; \ No newline at end of file +var _0xb847=['../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','rows','params','keys','includeAll','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2edbcf,_0x3cab42){var _0x251a5d=function(_0x5001ee){while(--_0x5001ee){_0x2edbcf['push'](_0x2edbcf['shift']());}};_0x251a5d(++_0x3cab42);}(_0xb847,0x1d7));var _0x7b84=function(_0x588f2c,_0x10e069){_0x588f2c=_0x588f2c-0x0;var _0x467467=_0xb847[_0x588f2c];return _0x467467;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b84('0x0'));var zipdir=require(_0x7b84('0x1'));var jsonpatch=require(_0x7b84('0x2'));var rp=require(_0x7b84('0x3'));var moment=require(_0x7b84('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7b84('0x5'));var util=require(_0x7b84('0x6'));var path=require('path');var sox=require(_0x7b84('0x7'));var csv=require(_0x7b84('0x8'));var ejs=require(_0x7b84('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7b84('0xa'));var crypto=require(_0x7b84('0xb'));var jsforce=require(_0x7b84('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7b84('0xd'));var Papa=require(_0x7b84('0xe'));var Redis=require(_0x7b84('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7b84('0x10'));var as=require(_0x7b84('0x11'));var hardwareService=require(_0x7b84('0x12'));var logger=require(_0x7b84('0x13'))(_0x7b84('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b84('0x15'));var db=require(_0x7b84('0x16'))['db'];function respondWithStatusCode(_0x28e766,_0x5862b2){_0x5862b2=_0x5862b2||0xcc;return function(_0x336585){if(_0x336585){return _0x28e766[_0x7b84('0x17')](_0x5862b2);}return _0x28e766[_0x7b84('0x18')](_0x5862b2)[_0x7b84('0x19')]();};}function respondWithResult(_0x54e1d0,_0x1c8c9f){_0x1c8c9f=_0x1c8c9f||0xc8;return function(_0x50f189){if(_0x50f189){return _0x54e1d0[_0x7b84('0x18')](_0x1c8c9f)[_0x7b84('0x1a')](_0x50f189);}};}function respondWithFilteredResult(_0x33c80c,_0x2ce8c2){return function(_0x3b681e){if(_0x3b681e){var _0x3d754b=typeof _0x2ce8c2[_0x7b84('0x1b')]===_0x7b84('0x1c')&&typeof _0x2ce8c2[_0x7b84('0x1d')]===_0x7b84('0x1c');var _0x3ea713=_0x3b681e[_0x7b84('0x1e')];var _0xd5ab98=_0x3d754b?0x0:_0x2ce8c2['offset'];var _0x3ddbdd=_0x3d754b?_0x3b681e['count']:_0x2ce8c2[_0x7b84('0x1b')]+_0x2ce8c2[_0x7b84('0x1d')];var _0x35d59d;if(_0x3ddbdd>=_0x3ea713){_0x3ddbdd=_0x3ea713;_0x35d59d=0xc8;}else{_0x35d59d=0xce;}_0x33c80c[_0x7b84('0x18')](_0x35d59d);return _0x33c80c['set'](_0x7b84('0x1f'),_0xd5ab98+'-'+_0x3ddbdd+'/'+_0x3ea713)[_0x7b84('0x1a')](_0x3b681e);}return null;};}function patchUpdates(_0xaadd13){return function(_0x237c23){try{jsonpatch['apply'](_0x237c23,_0xaadd13,!![]);}catch(_0xfd15b4){return BPromise[_0x7b84('0x20')](_0xfd15b4);}return _0x237c23[_0x7b84('0x21')]();};}function saveUpdates(_0x39f4d0,_0x3e618f){return function(_0x35d3dd){if(_0x35d3dd){return _0x35d3dd[_0x7b84('0x22')](_0x39f4d0)[_0x7b84('0x23')](function(_0x1aac4f){return _0x1aac4f;});}return null;};}function removeEntity(_0x462cb5,_0x5072e1){return function(_0x2cbe96){if(_0x2cbe96){return _0x2cbe96[_0x7b84('0x24')]()['then'](function(){_0x462cb5['status'](0xcc)[_0x7b84('0x19')]();});}};}function handleEntityNotFound(_0x322fe8,_0x4a5f14){return function(_0x4c8d99){if(!_0x4c8d99){_0x322fe8['sendStatus'](0x194);}return _0x4c8d99;};}function handleError(_0x1ae552,_0x172fe8){_0x172fe8=_0x172fe8||0x1f4;return function(_0x1d6059){logger['error'](_0x1d6059[_0x7b84('0x25')]);if(_0x1d6059[_0x7b84('0x26')]){delete _0x1d6059[_0x7b84('0x26')];}_0x1ae552[_0x7b84('0x18')](_0x172fe8)[_0x7b84('0x27')](_0x1d6059);};}exports[_0x7b84('0x28')]=function(_0x36b4a6,_0x3973c9){var _0x2a8c8f={},_0x6e084b={},_0x5b2f5e={'count':0x0,'rows':[]};var _0x266a72=_[_0x7b84('0x29')](db[_0x7b84('0x2a')][_0x7b84('0x2b')],function(_0x123675){return{'name':_0x123675[_0x7b84('0x2c')],'type':_0x123675[_0x7b84('0x2d')]['key']};});_0x6e084b[_0x7b84('0x2e')]=_['map'](_0x266a72,'name');_0x6e084b[_0x7b84('0x2f')]=_['keys'](_0x36b4a6[_0x7b84('0x2f')]);_0x6e084b[_0x7b84('0x30')]=_[_0x7b84('0x31')](_0x6e084b['model'],_0x6e084b[_0x7b84('0x2f')]);_0x2a8c8f[_0x7b84('0x32')]=_['intersection'](_0x6e084b[_0x7b84('0x2e')],qs[_0x7b84('0x33')](_0x36b4a6[_0x7b84('0x2f')]['fields']));_0x2a8c8f[_0x7b84('0x32')]=_0x2a8c8f[_0x7b84('0x32')][_0x7b84('0x34')]?_0x2a8c8f[_0x7b84('0x32')]:_0x6e084b[_0x7b84('0x2e')];if(!_0x36b4a6[_0x7b84('0x2f')][_0x7b84('0x35')](_0x7b84('0x36'))){_0x2a8c8f[_0x7b84('0x1d')]=qs[_0x7b84('0x1d')](_0x36b4a6['query'][_0x7b84('0x1d')]);_0x2a8c8f[_0x7b84('0x1b')]=qs[_0x7b84('0x1b')](_0x36b4a6[_0x7b84('0x2f')][_0x7b84('0x1b')]);}_0x2a8c8f['order']=qs['sort'](_0x36b4a6[_0x7b84('0x2f')][_0x7b84('0x37')]);_0x2a8c8f[_0x7b84('0x38')]=qs['filters'](_['pick'](_0x36b4a6[_0x7b84('0x2f')],_0x6e084b[_0x7b84('0x30')]),_0x266a72);if(_0x36b4a6[_0x7b84('0x2f')]['filter']){_0x2a8c8f[_0x7b84('0x38')]=_[_0x7b84('0x39')](_0x2a8c8f[_0x7b84('0x38')],{'$or':_[_0x7b84('0x29')](_0x266a72,function(_0x5f3cbf){if(_0x5f3cbf[_0x7b84('0x2d')]!==_0x7b84('0x3a')){var _0x36733b={};_0x36733b[_0x5f3cbf[_0x7b84('0x26')]]={'$like':'%'+_0x36b4a6['query']['filter']+'%'};return _0x36733b;}})});}_0x2a8c8f=_[_0x7b84('0x39')]({},_0x2a8c8f,_0x36b4a6[_0x7b84('0x3b')]);var _0x5d7a41={'where':_0x2a8c8f[_0x7b84('0x38')]};return db[_0x7b84('0x2a')][_0x7b84('0x1e')](_0x5d7a41)[_0x7b84('0x23')](function(_0xe47ecf){_0x5b2f5e[_0x7b84('0x1e')]=_0xe47ecf;if(_0x36b4a6['query']['includeAll']){_0x2a8c8f[_0x7b84('0x3c')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x7b84('0x3d')](_0x2a8c8f);})[_0x7b84('0x23')](function(_0xbdfa8d){_0x5b2f5e[_0x7b84('0x3e')]=_0xbdfa8d;return _0x5b2f5e;})[_0x7b84('0x23')](respondWithFilteredResult(_0x3973c9,_0x2a8c8f))['catch'](handleError(_0x3973c9,null));};exports['show']=function(_0x2f7d42,_0x3cf944){var _0x35337f={'raw':!![],'where':{'id':_0x2f7d42[_0x7b84('0x3f')]['id']}},_0xff7cef={};_0xff7cef['model']=_[_0x7b84('0x40')](db['Dynamics365Field'][_0x7b84('0x2b')]);_0xff7cef[_0x7b84('0x2f')]=_[_0x7b84('0x40')](_0x2f7d42['query']);_0xff7cef['filters']=_['intersection'](_0xff7cef[_0x7b84('0x2e')],_0xff7cef[_0x7b84('0x2f')]);_0x35337f[_0x7b84('0x32')]=_[_0x7b84('0x31')](_0xff7cef['model'],qs[_0x7b84('0x33')](_0x2f7d42[_0x7b84('0x2f')][_0x7b84('0x33')]));_0x35337f[_0x7b84('0x32')]=_0x35337f[_0x7b84('0x32')]['length']?_0x35337f[_0x7b84('0x32')]:_0xff7cef[_0x7b84('0x2e')];if(_0x2f7d42[_0x7b84('0x2f')][_0x7b84('0x41')]){_0x35337f[_0x7b84('0x3c')]=[{'all':!![]}];}_0x35337f=_['merge']({},_0x35337f,_0x2f7d42['options']);return db[_0x7b84('0x2a')][_0x7b84('0x42')](_0x35337f)['then'](handleEntityNotFound(_0x3cf944,null))[_0x7b84('0x23')](respondWithResult(_0x3cf944,null))[_0x7b84('0x43')](handleError(_0x3cf944,null));};exports[_0x7b84('0x44')]=function(_0x4888b7,_0x2252d8){return db[_0x7b84('0x2a')][_0x7b84('0x44')](_0x4888b7[_0x7b84('0x45')],{})['then'](respondWithResult(_0x2252d8,0xc9))['catch'](handleError(_0x2252d8,null));};exports['update']=function(_0x5e5f60,_0x5ed002){if(_0x5e5f60[_0x7b84('0x45')]['id']){delete _0x5e5f60[_0x7b84('0x45')]['id'];}return db['Dynamics365Field'][_0x7b84('0x42')]({'where':{'id':_0x5e5f60['params']['id']}})[_0x7b84('0x23')](handleEntityNotFound(_0x5ed002,null))['then'](saveUpdates(_0x5e5f60[_0x7b84('0x45')],null))['then'](respondWithResult(_0x5ed002,null))[_0x7b84('0x43')](handleError(_0x5ed002,null));};exports[_0x7b84('0x24')]=function(_0x3e183d,_0x418d16){return db['Dynamics365Field'][_0x7b84('0x42')]({'where':{'id':_0x3e183d[_0x7b84('0x3f')]['id']}})['then'](handleEntityNotFound(_0x418d16,null))['then'](removeEntity(_0x418d16,null))[_0x7b84('0x43')](handleError(_0x418d16,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 5fb8948..7d74082 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 _0xc925=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0xc925,0x1de));var _0x5c92=function(_0x1663e2,_0x3717e6){_0x1663e2=_0x1663e2-0x0;var _0x595f28=_0xc925[_0x1663e2];return _0x595f28;};'use strict';var _=require(_0x5c92('0x0'));var util=require(_0x5c92('0x1'));var logger=require(_0x5c92('0x2'))(_0x5c92('0x3'));var moment=require(_0x5c92('0x4'));var BPromise=require(_0x5c92('0x5'));var rp=require(_0x5c92('0x6'));var fs=require('fs');var path=require(_0x5c92('0x7'));var rimraf=require(_0x5c92('0x8'));var config=require(_0x5c92('0x9'));var attributes=require(_0x5c92('0xa'));module[_0x5c92('0xb')]=function(_0x5b2fd3,_0x45cc93){return _0x5b2fd3[_0x5c92('0xc')](_0x5c92('0xd'),attributes,{'tableName':_0x5c92('0xe'),'paranoid':![],'indexes':[{'name':_0x5c92('0xf'),'fields':[_0x5c92('0x10'),_0x5c92('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0795=['define','Dynamics365Field','idField','FieldId','util','../../config/logger','path','rimraf','./intDynamics365Field.attributes'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x0795,0x1ea));var _0x5079=function(_0x32c5bb,_0x41fd8e){_0x32c5bb=_0x32c5bb-0x0;var _0x3c21d8=_0x0795[_0x32c5bb];return _0x3c21d8;};'use strict';var _=require('lodash');var util=require(_0x5079('0x0'));var logger=require(_0x5079('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5079('0x2'));var rimraf=require(_0x5079('0x3'));var config=require('../../config/environment');var attributes=require(_0x5079('0x4'));module['exports']=function(_0x398180,_0x3e2a99){return _0x398180[_0x5079('0x5')](_0x5079('0x6'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x5079('0x7'),_0x5079('0x8')],'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 4b125f7..3af8ce7 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 _0x36b6=['Dynamics365Field,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code'];(function(_0x4a5a1a,_0x498227){var _0xaa93a3=function(_0x2efd86){while(--_0x2efd86){_0x4a5a1a['push'](_0x4a5a1a['shift']());}};_0xaa93a3(++_0x498227);}(_0x36b6,0x152));var _0x636b=function(_0x1f1659,_0x270cf9){_0x1f1659=_0x1f1659-0x0;var _0x5d5c06=_0x36b6[_0x1f1659];return _0x5d5c06;};'use strict';var _=require(_0x636b('0x0'));var util=require(_0x636b('0x1'));var moment=require(_0x636b('0x2'));var BPromise=require(_0x636b('0x3'));var rs=require(_0x636b('0x4'));var fs=require('fs');var Redis=require(_0x636b('0x5'));var db=require(_0x636b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x636b('0x7'))(_0x636b('0x8'));var config=require(_0x636b('0x9'));var jayson=require(_0x636b('0xa'));var client=jayson[_0x636b('0xb')][_0x636b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d2ecb,_0x4d3e1a,_0x40d518){return new BPromise(function(_0x2a95a3,_0x195083){return client[_0x636b('0xd')](_0x2d2ecb,_0x40d518)[_0x636b('0xe')](function(_0x3f14fd){logger[_0x636b('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x4d3e1a,'request\x20sent');logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4d3e1a,_0x636b('0x10'),JSON['stringify'](_0x3f14fd));if(_0x3f14fd['error']){if(_0x3f14fd[_0x636b('0x11')][_0x636b('0x12')]===0x1f4){logger['error'](_0x636b('0x13'),_0x4d3e1a,_0x3f14fd[_0x636b('0x11')][_0x636b('0x14')]);return _0x195083(_0x3f14fd[_0x636b('0x11')][_0x636b('0x14')]);}logger[_0x636b('0x11')](_0x636b('0x13'),_0x4d3e1a,_0x3f14fd[_0x636b('0x11')][_0x636b('0x14')]);return _0x2a95a3(_0x3f14fd[_0x636b('0x11')]['message']);}else{logger[_0x636b('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x4d3e1a,_0x636b('0x10'));_0x2a95a3(_0x3f14fd['result'][_0x636b('0x14')]);}})['catch'](function(_0x309fbc){logger['error'](_0x636b('0x13'),_0x4d3e1a,_0x309fbc);_0x195083(_0x309fbc);});});} \ No newline at end of file +var _0x1ecc=['../../config/environment','client','http','request','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','info','catch','lodash','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x556403,_0x2dc02a){var _0x3280af=function(_0x51e596){while(--_0x51e596){_0x556403['push'](_0x556403['shift']());}};_0x3280af(++_0x2dc02a);}(_0x1ecc,0x1d6));var _0xc1ec=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0x1ecc[_0x1e9424];return _0x1bd96c;};'use strict';var _=require(_0xc1ec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc1ec('0x1'));var rs=require(_0xc1ec('0x2'));var fs=require('fs');var Redis=require(_0xc1ec('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc1ec('0x4'))('rpc');var config=require(_0xc1ec('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc1ec('0x6')][_0xc1ec('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2198db,_0x6e80bc,_0x2ed85a){return new BPromise(function(_0xc84d01,_0x39e520){return client[_0xc1ec('0x8')](_0x2198db,_0x2ed85a)['then'](function(_0x3f902c){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x6e80bc,_0xc1ec('0x9'));logger[_0xc1ec('0xa')](_0xc1ec('0xb'),_0x6e80bc,_0xc1ec('0x9'),JSON[_0xc1ec('0xc')](_0x3f902c));if(_0x3f902c[_0xc1ec('0xd')]){if(_0x3f902c['error'][_0xc1ec('0xe')]===0x1f4){logger[_0xc1ec('0xd')](_0xc1ec('0xf'),_0x6e80bc,_0x3f902c[_0xc1ec('0xd')][_0xc1ec('0x10')]);return _0x39e520(_0x3f902c[_0xc1ec('0xd')][_0xc1ec('0x10')]);}logger[_0xc1ec('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x6e80bc,_0x3f902c['error'][_0xc1ec('0x10')]);return _0xc84d01(_0x3f902c['error'][_0xc1ec('0x10')]);}else{logger[_0xc1ec('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x6e80bc,_0xc1ec('0x9'));_0xc84d01(_0x3f902c['result'][_0xc1ec('0x10')]);}})[_0xc1ec('0x12')](function(_0x1cfda2){logger[_0xc1ec('0xd')](_0xc1ec('0xf'),_0x6e80bc,_0x1cfda2);_0x39e520(_0x1cfda2);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index a5ef083..6e688af 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 _0x2520=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','post','/:id/configurations','put','update','delete','destroy','multer','util','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2520,0x177));var _0x0252=function(_0x27eedf,_0x46e59b){_0x27eedf=_0x27eedf-0x0;var _0xa82468=_0x2520[_0x27eedf];return _0xa82468;};'use strict';var multer=require(_0x0252('0x0'));var util=require(_0x0252('0x1'));var path=require(_0x0252('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0252('0x3')]();var fs_extra=require(_0x0252('0x4'));var auth=require(_0x0252('0x5'));var interaction=require(_0x0252('0x6'));var config=require(_0x0252('0x7'));var controller=require(_0x0252('0x8'));router[_0x0252('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0252('0x9')](_0x0252('0xa'),auth[_0x0252('0xb')](),controller[_0x0252('0xc')]);router[_0x0252('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0252('0xd')]);router[_0x0252('0x9')](_0x0252('0xe'),auth[_0x0252('0xb')](),controller['getFields']);router['post']('/',auth[_0x0252('0xb')](),controller['create']);router[_0x0252('0xf')](_0x0252('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x0252('0x11')]('/:id',auth[_0x0252('0xb')](),controller[_0x0252('0x12')]);router[_0x0252('0x13')](_0x0252('0xa'),auth[_0x0252('0xb')](),controller[_0x0252('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe920=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x16a3c9,_0x33a497){var _0x4bc674=function(_0x5dbd14){while(--_0x5dbd14){_0x16a3c9['push'](_0x16a3c9['shift']());}};_0x4bc674(++_0x33a497);}(_0xe920,0x91));var _0x0e92=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xe920[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x0e92('0x0'));var util=require(_0x0e92('0x1'));var path=require('path');var timeout=require(_0x0e92('0x2'));var express=require(_0x0e92('0x3'));var router=express[_0x0e92('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0e92('0x5'));var interaction=require(_0x0e92('0x6'));var config=require(_0x0e92('0x7'));var controller=require(_0x0e92('0x8'));router[_0x0e92('0x9')]('/',auth[_0x0e92('0xa')](),controller[_0x0e92('0xb')]);router[_0x0e92('0x9')](_0x0e92('0xc'),auth['isAuthenticated'](),controller[_0x0e92('0xd')]);router[_0x0e92('0x9')](_0x0e92('0xe'),auth[_0x0e92('0xa')](),controller[_0x0e92('0xf')]);router[_0x0e92('0x9')](_0x0e92('0x10'),auth['isAuthenticated'](),controller[_0x0e92('0x11')]);router[_0x0e92('0x12')]('/',auth[_0x0e92('0xa')](),controller[_0x0e92('0x13')]);router[_0x0e92('0x12')](_0x0e92('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x0e92('0x14')](_0x0e92('0xc'),auth['isAuthenticated'](),controller[_0x0e92('0x15')]);router[_0x0e92('0x16')](_0x0e92('0xc'),auth[_0x0e92('0xa')](),controller[_0x0e92('0x17')]);module[_0x0e92('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 31bb275..bd50b18 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 _0x25e7=['sequelize','exports','STRING','username','remoteUri'];(function(_0x4fe35d,_0x21fee1){var _0x5bb28e=function(_0x214051){while(--_0x214051){_0x4fe35d['push'](_0x4fe35d['shift']());}};_0x5bb28e(++_0x21fee1);}(_0x25e7,0x1d6));var _0x725e=function(_0x4717b8,_0x331c49){_0x4717b8=_0x4717b8-0x0;var _0x42a536=_0x25e7[_0x4717b8];return _0x42a536;};'use strict';var Sequelize=require(_0x725e('0x0'));module[_0x725e('0x1')]={'name':{'type':Sequelize[_0x725e('0x2')]},'description':{'type':Sequelize[_0x725e('0x2')]},'username':{'type':Sequelize[_0x725e('0x2')],'unique':_0x725e('0x3')},'apiKey':{'type':Sequelize[_0x725e('0x2')]},'remoteUri':{'type':Sequelize[_0x725e('0x2')],'unique':_0x725e('0x4')},'serverUrl':{'type':Sequelize[_0x725e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['remoteUri','exports','STRING','username'];(function(_0x38af48,_0x400460){var _0x445384=function(_0x464435){while(--_0x464435){_0x38af48['push'](_0x38af48['shift']());}};_0x445384(++_0x400460);}(_0xadb5,0xad));var _0x5adb=function(_0x42d492,_0x380f49){_0x42d492=_0x42d492-0x0;var _0x158539=_0xadb5[_0x42d492];return _0x158539;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5adb('0x1')]},'username':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x3')},'serverUrl':{'type':Sequelize[_0x5adb('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index fba38a9..f2dc7b0 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 _0xb634=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','includeAll','findAll','rows','catch','show','params','keys','length','include','create','body','find','destroy','findOne','FreshdeskConfiguration','order','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','channel','FreshdeskField','Descriptions','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','custom_text','custom_dropdown','label','default','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json'];(function(_0x5813e1,_0x14b28b){var _0x3082cf=function(_0xabb9ee){while(--_0xabb9ee){_0x5813e1['push'](_0x5813e1['shift']());}};_0x3082cf(++_0x14b28b);}(_0xb634,0x1c0));var _0x4b63=function(_0x253f18,_0x4fe5e9){_0x253f18=_0x253f18-0x0;var _0x23c6c3=_0xb634[_0x253f18];return _0x23c6c3;};'use strict';var emlformat=require(_0x4b63('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b63('0x1'));var jsonpatch=require(_0x4b63('0x2'));var rp=require(_0x4b63('0x3'));var moment=require('moment');var BPromise=require(_0x4b63('0x4'));var Mustache=require(_0x4b63('0x5'));var util=require(_0x4b63('0x6'));var path=require(_0x4b63('0x7'));var sox=require(_0x4b63('0x8'));var csv=require(_0x4b63('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b63('0xa'));var squel=require('squel');var crypto=require(_0x4b63('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4b63('0xc'));var toCsv=require(_0x4b63('0x9'));var querystring=require('querystring');var Papa=require(_0x4b63('0xd'));var Redis=require(_0x4b63('0xe'));var authService=require(_0x4b63('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4b63('0x10'));var hardwareService=require(_0x4b63('0x11'));var logger=require(_0x4b63('0x12'))(_0x4b63('0x13'));var utils=require(_0x4b63('0x14'));var config=require(_0x4b63('0x15'));var licenseUtil=require(_0x4b63('0x16'));var db=require(_0x4b63('0x17'))['db'];var integrations=require(_0x4b63('0x18'));function respondWithStatusCode(_0x2d4985,_0x121bfd){_0x121bfd=_0x121bfd||0xcc;return function(_0x1419f1){if(_0x1419f1){return _0x2d4985['sendStatus'](_0x121bfd);}return _0x2d4985[_0x4b63('0x19')](_0x121bfd)[_0x4b63('0x1a')]();};}function respondWithResult(_0x35a5fb,_0x1d0374){_0x1d0374=_0x1d0374||0xc8;return function(_0x2a1ac4){if(_0x2a1ac4){return _0x35a5fb[_0x4b63('0x19')](_0x1d0374)[_0x4b63('0x1b')](_0x2a1ac4);}};}function respondWithFilteredResult(_0x5c94c6,_0x975c4b){return function(_0x49709e){if(_0x49709e){var _0xc64de5=typeof _0x975c4b[_0x4b63('0x1c')]===_0x4b63('0x1d')&&typeof _0x975c4b[_0x4b63('0x1e')]===_0x4b63('0x1d');var _0x225a14=_0x49709e[_0x4b63('0x1f')];var _0x499224=_0xc64de5?0x0:_0x975c4b['offset'];var _0x710564=_0xc64de5?_0x49709e['count']:_0x975c4b[_0x4b63('0x1c')]+_0x975c4b[_0x4b63('0x1e')];var _0x432827;if(_0x710564>=_0x225a14){_0x710564=_0x225a14;_0x432827=0xc8;}else{_0x432827=0xce;}_0x5c94c6['status'](_0x432827);return _0x5c94c6[_0x4b63('0x20')](_0x4b63('0x21'),_0x499224+'-'+_0x710564+'/'+_0x225a14)['json'](_0x49709e);}return null;};}function patchUpdates(_0x59a3d2){return function(_0x1765b5){try{jsonpatch[_0x4b63('0x22')](_0x1765b5,_0x59a3d2,!![]);}catch(_0xc7c856){return BPromise[_0x4b63('0x23')](_0xc7c856);}return _0x1765b5[_0x4b63('0x24')]();};}function saveUpdates(_0x167337,_0x2350dc){return function(_0x22dd9a){if(_0x22dd9a){return _0x22dd9a[_0x4b63('0x25')](_0x167337)[_0x4b63('0x26')](function(_0xacb37a){return _0xacb37a;});}return null;};}function removeEntity(_0x269faf,_0x8940d6){return function(_0x3d7d75){if(_0x3d7d75){return _0x3d7d75['destroy']()[_0x4b63('0x26')](function(){_0x269faf[_0x4b63('0x19')](0xcc)[_0x4b63('0x1a')]();});}};}function handleEntityNotFound(_0x26b6f9,_0x11326d){return function(_0x50473a){if(!_0x50473a){_0x26b6f9[_0x4b63('0x27')](0x194);}return _0x50473a;};}function handleError(_0x495478,_0x417d92){_0x417d92=_0x417d92||0x1f4;return function(_0x2d8e52){logger['error'](_0x2d8e52['stack']);if(_0x2d8e52[_0x4b63('0x28')]){delete _0x2d8e52[_0x4b63('0x28')];}_0x495478[_0x4b63('0x19')](_0x417d92)[_0x4b63('0x29')](_0x2d8e52);};}exports[_0x4b63('0x2a')]=function(_0x208af0,_0x1e7ed0){var _0x5a9648={},_0x310ab0={},_0x56497c={'count':0x0,'rows':[]};var _0x5679d5=_['map'](db['FreshdeskAccount'][_0x4b63('0x2b')],function(_0x5741c4){return{'name':_0x5741c4[_0x4b63('0x2c')],'type':_0x5741c4[_0x4b63('0x2d')][_0x4b63('0x2e')]};});_0x310ab0[_0x4b63('0x2f')]=_[_0x4b63('0x30')](_0x5679d5,'name');_0x310ab0[_0x4b63('0x31')]=_['keys'](_0x208af0[_0x4b63('0x31')]);_0x310ab0[_0x4b63('0x32')]=_[_0x4b63('0x33')](_0x310ab0[_0x4b63('0x2f')],_0x310ab0[_0x4b63('0x31')]);_0x5a9648[_0x4b63('0x34')]=_['intersection'](_0x310ab0[_0x4b63('0x2f')],qs['fields'](_0x208af0['query'][_0x4b63('0x35')]));_0x5a9648[_0x4b63('0x34')]=_0x5a9648[_0x4b63('0x34')]['length']?_0x5a9648[_0x4b63('0x34')]:_0x310ab0['model'];if(!_0x208af0[_0x4b63('0x31')][_0x4b63('0x36')]('nolimit')){_0x5a9648[_0x4b63('0x1e')]=qs['limit'](_0x208af0[_0x4b63('0x31')]['limit']);_0x5a9648[_0x4b63('0x1c')]=qs[_0x4b63('0x1c')](_0x208af0[_0x4b63('0x31')]['offset']);}_0x5a9648['order']=qs[_0x4b63('0x37')](_0x208af0['query']['sort']);_0x5a9648[_0x4b63('0x38')]=qs['filters'](_[_0x4b63('0x39')](_0x208af0[_0x4b63('0x31')],_0x310ab0[_0x4b63('0x32')]),_0x5679d5);if(_0x208af0[_0x4b63('0x31')][_0x4b63('0x3a')]){_0x5a9648['where']=_[_0x4b63('0x3b')](_0x5a9648['where'],{'$or':_[_0x4b63('0x30')](_0x5679d5,function(_0x232c12){if(_0x232c12[_0x4b63('0x2d')]!==_0x4b63('0x3c')){var _0x2888c0={};_0x2888c0[_0x232c12[_0x4b63('0x28')]]={'$like':'%'+_0x208af0[_0x4b63('0x31')][_0x4b63('0x3a')]+'%'};return _0x2888c0;}})});}_0x5a9648=_[_0x4b63('0x3b')]({},_0x5a9648,_0x208af0[_0x4b63('0x3d')]);var _0x1b2eb5={'where':_0x5a9648[_0x4b63('0x38')]};return db[_0x4b63('0x3e')][_0x4b63('0x1f')](_0x1b2eb5)[_0x4b63('0x26')](function(_0x58c94d){_0x56497c['count']=_0x58c94d;if(_0x208af0[_0x4b63('0x31')][_0x4b63('0x3f')]){_0x5a9648['include']=[{'all':!![]}];}return db[_0x4b63('0x3e')][_0x4b63('0x40')](_0x5a9648);})[_0x4b63('0x26')](function(_0xbc542e){_0x56497c[_0x4b63('0x41')]=_0xbc542e;return _0x56497c;})[_0x4b63('0x26')](respondWithFilteredResult(_0x1e7ed0,_0x5a9648))[_0x4b63('0x42')](handleError(_0x1e7ed0,null));};exports[_0x4b63('0x43')]=function(_0x26a22c,_0x5ebe9c){var _0x45cc94={'raw':![],'where':{'id':_0x26a22c[_0x4b63('0x44')]['id']}},_0x522b1c={};_0x522b1c['model']=_[_0x4b63('0x45')](db[_0x4b63('0x3e')][_0x4b63('0x2b')]);_0x522b1c[_0x4b63('0x31')]=_[_0x4b63('0x45')](_0x26a22c[_0x4b63('0x31')]);_0x522b1c[_0x4b63('0x32')]=_[_0x4b63('0x33')](_0x522b1c['model'],_0x522b1c[_0x4b63('0x31')]);_0x45cc94[_0x4b63('0x34')]=_[_0x4b63('0x33')](_0x522b1c[_0x4b63('0x2f')],qs[_0x4b63('0x35')](_0x26a22c[_0x4b63('0x31')][_0x4b63('0x35')]));_0x45cc94[_0x4b63('0x34')]=_0x45cc94[_0x4b63('0x34')][_0x4b63('0x46')]?_0x45cc94[_0x4b63('0x34')]:_0x522b1c[_0x4b63('0x2f')];if(_0x26a22c[_0x4b63('0x31')]['includeAll']){_0x45cc94[_0x4b63('0x47')]=[{'all':!![]}];}_0x45cc94=_[_0x4b63('0x3b')]({},_0x45cc94,_0x26a22c['options']);return db[_0x4b63('0x3e')]['find'](_0x45cc94)[_0x4b63('0x26')](handleEntityNotFound(_0x5ebe9c,null))[_0x4b63('0x26')](respondWithResult(_0x5ebe9c,null))[_0x4b63('0x42')](handleError(_0x5ebe9c,null));};exports[_0x4b63('0x48')]=function(_0x403f46,_0x362138){return db[_0x4b63('0x3e')][_0x4b63('0x48')](_0x403f46[_0x4b63('0x49')],{})[_0x4b63('0x26')](respondWithResult(_0x362138,0xc9))[_0x4b63('0x42')](handleError(_0x362138,null));};exports[_0x4b63('0x25')]=function(_0x35f4cf,_0x503afe){if(_0x35f4cf['body']['id']){delete _0x35f4cf[_0x4b63('0x49')]['id'];}return db['FreshdeskAccount'][_0x4b63('0x4a')]({'where':{'id':_0x35f4cf[_0x4b63('0x44')]['id']}})[_0x4b63('0x26')](handleEntityNotFound(_0x503afe,null))[_0x4b63('0x26')](saveUpdates(_0x35f4cf['body'],null))[_0x4b63('0x26')](respondWithResult(_0x503afe,null))[_0x4b63('0x42')](handleError(_0x503afe,null));};exports[_0x4b63('0x4b')]=function(_0xf07322,_0x4bae0a){return db[_0x4b63('0x3e')][_0x4b63('0x4a')]({'where':{'id':_0xf07322[_0x4b63('0x44')]['id']}})['then'](handleEntityNotFound(_0x4bae0a,null))[_0x4b63('0x26')](removeEntity(_0x4bae0a,null))[_0x4b63('0x42')](handleError(_0x4bae0a,null));};exports['getConfigurations']=function(_0x5dd48a,_0x227135,_0x376971){var _0x38a783={};var _0xcf3ed8={};var _0x31b050;var _0x4bd769;return db[_0x4b63('0x3e')][_0x4b63('0x4c')]({'where':{'id':_0x5dd48a[_0x4b63('0x44')]['id']}})['then'](handleEntityNotFound(_0x227135,null))[_0x4b63('0x26')](function(_0x121a92){if(_0x121a92){_0x31b050=_0x121a92;_0xcf3ed8[_0x4b63('0x2f')]=_['keys'](db[_0x4b63('0x4d')]['rawAttributes']);_0xcf3ed8['query']=_[_0x4b63('0x45')](_0x5dd48a[_0x4b63('0x31')]);_0xcf3ed8[_0x4b63('0x32')]=_[_0x4b63('0x33')](_0xcf3ed8[_0x4b63('0x2f')],_0xcf3ed8[_0x4b63('0x31')]);_0x38a783[_0x4b63('0x34')]=_[_0x4b63('0x33')](_0xcf3ed8[_0x4b63('0x2f')],qs['fields'](_0x5dd48a['query']['fields']));_0x38a783[_0x4b63('0x34')]=_0x38a783[_0x4b63('0x34')]['length']?_0x38a783[_0x4b63('0x34')]:_0xcf3ed8[_0x4b63('0x2f')];_0x38a783[_0x4b63('0x4e')]=qs['sort'](_0x5dd48a[_0x4b63('0x31')][_0x4b63('0x37')]);_0x38a783['where']=qs[_0x4b63('0x32')](_[_0x4b63('0x39')](_0x5dd48a['query'],_0xcf3ed8['filters']));if(_0x5dd48a[_0x4b63('0x31')]['filter']){_0x38a783[_0x4b63('0x38')]=_[_0x4b63('0x3b')](_0x38a783[_0x4b63('0x38')],{'$or':_[_0x4b63('0x30')](_0x38a783[_0x4b63('0x34')],function(_0x2d1bea){var _0x33eb0a={};_0x33eb0a[_0x2d1bea]={'$like':'%'+_0x5dd48a['query'][_0x4b63('0x3a')]+'%'};return _0x33eb0a;})});}_0x38a783=_['merge']({},_0x38a783,_0x5dd48a[_0x4b63('0x3d')]);return _0x31b050[_0x4b63('0x4f')](_0x38a783);}})[_0x4b63('0x26')](function(_0x24bd85){if(_0x24bd85){_0x4bd769=_0x24bd85['length'];if(!_0x5dd48a[_0x4b63('0x31')][_0x4b63('0x36')](_0x4b63('0x50'))){_0x38a783['limit']=qs['limit'](_0x5dd48a[_0x4b63('0x31')][_0x4b63('0x1e')]);_0x38a783[_0x4b63('0x1c')]=qs[_0x4b63('0x1c')](_0x5dd48a['query'][_0x4b63('0x1c')]);}return _0x31b050[_0x4b63('0x4f')](_0x38a783);}})[_0x4b63('0x26')](function(_0x18cd77){if(_0x18cd77){return _0x18cd77?{'count':_0x4bd769,'rows':_0x18cd77}:null;}})[_0x4b63('0x26')](respondWithResult(_0x227135,null))[_0x4b63('0x42')](handleError(_0x227135,null));};exports[_0x4b63('0x51')]=function(_0x349b67,_0x5c9d69,_0xc0fae3){if(_0x349b67[_0x4b63('0x49')]['id']){delete _0x349b67[_0x4b63('0x49')]['id'];}return db[_0x4b63('0x3e')][_0x4b63('0x4c')]({'where':{'id':_0x349b67['params']['id']}})[_0x4b63('0x26')](handleEntityNotFound(_0x5c9d69,null))[_0x4b63('0x26')](function(_0x2ad248){if(_0x2ad248){_0x349b67['body'][_0x4b63('0x52')]=_0x2ad248['id'];_0x349b67['body'][_0x4b63('0x53')]=integrations['getSubjects'](_0x349b67[_0x4b63('0x49')][_0x4b63('0x54')],_0x349b67[_0x4b63('0x49')]['type']);_0x349b67[_0x4b63('0x49')]['Descriptions']=integrations['getDescriptions'](_0x349b67[_0x4b63('0x49')][_0x4b63('0x54')],_0x349b67[_0x4b63('0x49')][_0x4b63('0x2d')]);return db['FreshdeskConfiguration'][_0x4b63('0x48')](_0x349b67[_0x4b63('0x49')],{'include':[{'model':db['FreshdeskField'],'as':_0x4b63('0x53')},{'model':db[_0x4b63('0x55')],'as':_0x4b63('0x56')}]});}return null;})[_0x4b63('0x26')](respondWithResult(_0x5c9d69,null))[_0x4b63('0x42')](handleError(_0x5c9d69,null));};exports['getFields']=function(_0x4b5ad3,_0x189b81,_0x592257){var _0x1fc747='';return db[_0x4b63('0x3e')][_0x4b63('0x4c')]({'where':{'id':_0x4b5ad3[_0x4b63('0x44')]['id']},'attributes':['id','remoteUri',_0x4b63('0x57')]})[_0x4b63('0x26')](handleEntityNotFound(_0x189b81,null))[_0x4b63('0x26')](function(_0x9fe3b){if(_0x9fe3b){_0x1fc747=_0x9fe3b['remoteUri'];var _0x4faafc=_0x1fc747[_0x4b63('0x58')](-0x1);if(_0x4faafc==='/'){_0x1fc747=_0x1fc747[_0x4b63('0x59')](0x0,_0x1fc747[_0x4b63('0x5a')](_0x4faafc));}return rp({'method':_0x4b63('0x5b'),'uri':util[_0x4b63('0x5c')](_0x4b63('0x5d'),_0x1fc747,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x4b63('0x5c')](_0x4b63('0x5e'),new Buffer(util[_0x4b63('0x5c')](_0x4b63('0x5f'),_0x9fe3b['apiKey']))[_0x4b63('0x60')](_0x4b63('0x61')))},'json':!![]});}})[_0x4b63('0x26')](function(_0x48bf70){if(_0x48bf70){var _0x166ec6=[_0x4b63('0x62'),_0x4b63('0x63'),_0x4b63('0x64'),_0x4b63('0x65'),'status',_0x4b63('0x66'),_0x4b63('0x67'),_0x4b63('0x68'),_0x4b63('0x69'),_0x4b63('0x67'),_0x4b63('0x6a')];_[_0x4b63('0x6b')](_0x48bf70,function(_0x52fcbd){return _0x166ec6['includes'](_0x52fcbd[_0x4b63('0x28')])||!_0x52fcbd['default']&&_0x52fcbd[_0x4b63('0x2d')]!==_0x4b63('0x6c')&&_0x52fcbd[_0x4b63('0x2d')]!==_0x4b63('0x6d');});return{'count':_0x48bf70[_0x4b63('0x46')],'rows':_[_0x4b63('0x30')](_0x48bf70,function(_0x800119){return{'id':_0x800119[_0x4b63('0x28')],'name':_0x800119[_0x4b63('0x6e')],'custom':!_0x800119[_0x4b63('0x6f')],'options':_0x800119[_0x4b63('0x70')]?_['map'](_0x800119['choices'],function(_0x484b11){return{'name':_[_0x4b63('0x71')](_0x484b11),'value':_0x484b11};}):[]};})};}})[_0x4b63('0x26')](respondWithResult(_0x189b81,null))['catch'](function(_0x2e23c3){var _0x642f79=_0x4b5ad3[_0x4b63('0x31')]['test']?0x1f4:_0x2e23c3[_0x4b63('0x72')]||0x1f4;logger['error'](_0x4b63('0x73'),_0x4b63('0x74'),_0x642f79,JSON['stringify'](_0x2e23c3));delete _0x2e23c3['name'];if(_0x642f79===0x191){_0x642f79=0x190;}_0x189b81[_0x4b63('0x19')](_0x642f79)[_0x4b63('0x29')](_0x4b5ad3[_0x4b63('0x31')][_0x4b63('0x75')]?{'message':_0x4b63('0x76'),'statusCode':_0x2e23c3[_0x4b63('0x72')]}:_0x2e23c3);});}; \ No newline at end of file +var _0x0457=['order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','findOne','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','subject','description','priority','group','source','ticket_type','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','destroy','getConfigurations','FreshdeskConfiguration'];(function(_0x48f382,_0x5527f5){var _0x42fdbd=function(_0x23d828){while(--_0x23d828){_0x48f382['push'](_0x48f382['shift']());}};_0x42fdbd(++_0x5527f5);}(_0x0457,0x11f));var _0x7045=function(_0x483ae4,_0x12dc19){_0x483ae4=_0x483ae4-0x0;var _0x11c240=_0x0457[_0x483ae4];return _0x11c240;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7045('0x0'));var zipdir=require(_0x7045('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7045('0x2'));var moment=require(_0x7045('0x3'));var BPromise=require(_0x7045('0x4'));var Mustache=require(_0x7045('0x5'));var util=require(_0x7045('0x6'));var path=require(_0x7045('0x7'));var sox=require('sox');var csv=require(_0x7045('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7045('0x9'));var _=require(_0x7045('0xa'));var squel=require(_0x7045('0xb'));var crypto=require(_0x7045('0xc'));var jsforce=require(_0x7045('0xd'));var deskjs=require(_0x7045('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7045('0xf'));var Redis=require(_0x7045('0x10'));var authService=require(_0x7045('0x11'));var qs=require(_0x7045('0x12'));var as=require(_0x7045('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7045('0x14'))(_0x7045('0x15'));var utils=require(_0x7045('0x16'));var config=require(_0x7045('0x17'));var licenseUtil=require(_0x7045('0x18'));var db=require(_0x7045('0x19'))['db'];var integrations=require(_0x7045('0x1a'));function respondWithStatusCode(_0x5230a8,_0x12cfc2){_0x12cfc2=_0x12cfc2||0xcc;return function(_0x1b6043){if(_0x1b6043){return _0x5230a8['sendStatus'](_0x12cfc2);}return _0x5230a8['status'](_0x12cfc2)[_0x7045('0x1b')]();};}function respondWithResult(_0x1dee00,_0x47fc71){_0x47fc71=_0x47fc71||0xc8;return function(_0xafba4b){if(_0xafba4b){return _0x1dee00[_0x7045('0x1c')](_0x47fc71)[_0x7045('0x1d')](_0xafba4b);}};}function respondWithFilteredResult(_0x38c059,_0xb8fdae){return function(_0x50ede5){if(_0x50ede5){var _0x38aaa6=typeof _0xb8fdae[_0x7045('0x1e')]===_0x7045('0x1f')&&typeof _0xb8fdae[_0x7045('0x20')]===_0x7045('0x1f');var _0x1d1e30=_0x50ede5[_0x7045('0x21')];var _0x2d800e=_0x38aaa6?0x0:_0xb8fdae[_0x7045('0x1e')];var _0xc75b70=_0x38aaa6?_0x50ede5['count']:_0xb8fdae['offset']+_0xb8fdae[_0x7045('0x20')];var _0x186767;if(_0xc75b70>=_0x1d1e30){_0xc75b70=_0x1d1e30;_0x186767=0xc8;}else{_0x186767=0xce;}_0x38c059[_0x7045('0x1c')](_0x186767);return _0x38c059[_0x7045('0x22')]('Content-Range',_0x2d800e+'-'+_0xc75b70+'/'+_0x1d1e30)['json'](_0x50ede5);}return null;};}function patchUpdates(_0xd3ecd5){return function(_0x1f011f){try{jsonpatch[_0x7045('0x23')](_0x1f011f,_0xd3ecd5,!![]);}catch(_0x4b00e2){return BPromise[_0x7045('0x24')](_0x4b00e2);}return _0x1f011f[_0x7045('0x25')]();};}function saveUpdates(_0x4ac436,_0x17edf7){return function(_0x2124fc){if(_0x2124fc){return _0x2124fc['update'](_0x4ac436)[_0x7045('0x26')](function(_0x4003ad){return _0x4003ad;});}return null;};}function removeEntity(_0x1ac24f,_0x466803){return function(_0x4e2d76){if(_0x4e2d76){return _0x4e2d76['destroy']()[_0x7045('0x26')](function(){_0x1ac24f[_0x7045('0x1c')](0xcc)[_0x7045('0x1b')]();});}};}function handleEntityNotFound(_0x1694bf,_0x54508a){return function(_0x138281){if(!_0x138281){_0x1694bf[_0x7045('0x27')](0x194);}return _0x138281;};}function handleError(_0x5f4f60,_0x39cdfa){_0x39cdfa=_0x39cdfa||0x1f4;return function(_0xace1f0){logger[_0x7045('0x28')](_0xace1f0[_0x7045('0x29')]);if(_0xace1f0['name']){delete _0xace1f0[_0x7045('0x2a')];}_0x5f4f60[_0x7045('0x1c')](_0x39cdfa)[_0x7045('0x2b')](_0xace1f0);};}exports[_0x7045('0x2c')]=function(_0x2628d0,_0x297a4d){var _0x109a88={},_0x4e078b={},_0x408b46={'count':0x0,'rows':[]};var _0x3360c5=_[_0x7045('0x2d')](db[_0x7045('0x2e')][_0x7045('0x2f')],function(_0x565a28){return{'name':_0x565a28[_0x7045('0x30')],'type':_0x565a28[_0x7045('0x31')]['key']};});_0x4e078b[_0x7045('0x32')]=_['map'](_0x3360c5,'name');_0x4e078b[_0x7045('0x33')]=_[_0x7045('0x34')](_0x2628d0[_0x7045('0x33')]);_0x4e078b['filters']=_[_0x7045('0x35')](_0x4e078b[_0x7045('0x32')],_0x4e078b[_0x7045('0x33')]);_0x109a88[_0x7045('0x36')]=_['intersection'](_0x4e078b[_0x7045('0x32')],qs[_0x7045('0x37')](_0x2628d0[_0x7045('0x33')]['fields']));_0x109a88[_0x7045('0x36')]=_0x109a88[_0x7045('0x36')][_0x7045('0x38')]?_0x109a88[_0x7045('0x36')]:_0x4e078b[_0x7045('0x32')];if(!_0x2628d0[_0x7045('0x33')][_0x7045('0x39')]('nolimit')){_0x109a88['limit']=qs[_0x7045('0x20')](_0x2628d0['query'][_0x7045('0x20')]);_0x109a88[_0x7045('0x1e')]=qs['offset'](_0x2628d0[_0x7045('0x33')][_0x7045('0x1e')]);}_0x109a88['order']=qs[_0x7045('0x3a')](_0x2628d0[_0x7045('0x33')][_0x7045('0x3a')]);_0x109a88[_0x7045('0x3b')]=qs[_0x7045('0x3c')](_[_0x7045('0x3d')](_0x2628d0[_0x7045('0x33')],_0x4e078b[_0x7045('0x3c')]),_0x3360c5);if(_0x2628d0[_0x7045('0x33')][_0x7045('0x3e')]){_0x109a88[_0x7045('0x3b')]=_['merge'](_0x109a88['where'],{'$or':_[_0x7045('0x2d')](_0x3360c5,function(_0x32d6b6){if(_0x32d6b6[_0x7045('0x31')]!=='VIRTUAL'){var _0x50d9d4={};_0x50d9d4[_0x32d6b6['name']]={'$like':'%'+_0x2628d0['query']['filter']+'%'};return _0x50d9d4;}})});}_0x109a88=_[_0x7045('0x3f')]({},_0x109a88,_0x2628d0[_0x7045('0x40')]);var _0x3680fb={'where':_0x109a88[_0x7045('0x3b')]};return db[_0x7045('0x2e')][_0x7045('0x21')](_0x3680fb)[_0x7045('0x26')](function(_0x28e77d){_0x408b46[_0x7045('0x21')]=_0x28e77d;if(_0x2628d0[_0x7045('0x33')][_0x7045('0x41')]){_0x109a88[_0x7045('0x42')]=[{'all':!![]}];}return db[_0x7045('0x2e')][_0x7045('0x43')](_0x109a88);})['then'](function(_0x1ed25e){_0x408b46[_0x7045('0x44')]=_0x1ed25e;return _0x408b46;})[_0x7045('0x26')](respondWithFilteredResult(_0x297a4d,_0x109a88))[_0x7045('0x45')](handleError(_0x297a4d,null));};exports[_0x7045('0x46')]=function(_0x2d150d,_0x5d2dde){var _0x92dded={'raw':![],'where':{'id':_0x2d150d['params']['id']}},_0x3468b2={};_0x3468b2[_0x7045('0x32')]=_['keys'](db[_0x7045('0x2e')][_0x7045('0x2f')]);_0x3468b2[_0x7045('0x33')]=_[_0x7045('0x34')](_0x2d150d['query']);_0x3468b2[_0x7045('0x3c')]=_[_0x7045('0x35')](_0x3468b2[_0x7045('0x32')],_0x3468b2[_0x7045('0x33')]);_0x92dded[_0x7045('0x36')]=_[_0x7045('0x35')](_0x3468b2['model'],qs[_0x7045('0x37')](_0x2d150d[_0x7045('0x33')][_0x7045('0x37')]));_0x92dded['attributes']=_0x92dded[_0x7045('0x36')][_0x7045('0x38')]?_0x92dded['attributes']:_0x3468b2[_0x7045('0x32')];if(_0x2d150d[_0x7045('0x33')]['includeAll']){_0x92dded['include']=[{'all':!![]}];}_0x92dded=_['merge']({},_0x92dded,_0x2d150d[_0x7045('0x40')]);return db['FreshdeskAccount'][_0x7045('0x47')](_0x92dded)['then'](handleEntityNotFound(_0x5d2dde,null))[_0x7045('0x26')](respondWithResult(_0x5d2dde,null))[_0x7045('0x45')](handleError(_0x5d2dde,null));};exports['create']=function(_0xa99024,_0x182907){return db['FreshdeskAccount'][_0x7045('0x48')](_0xa99024[_0x7045('0x49')],{})[_0x7045('0x26')](respondWithResult(_0x182907,0xc9))[_0x7045('0x45')](handleError(_0x182907,null));};exports[_0x7045('0x4a')]=function(_0x26da26,_0x24d265){if(_0x26da26[_0x7045('0x49')]['id']){delete _0x26da26[_0x7045('0x49')]['id'];}return db[_0x7045('0x2e')][_0x7045('0x47')]({'where':{'id':_0x26da26[_0x7045('0x4b')]['id']}})['then'](handleEntityNotFound(_0x24d265,null))[_0x7045('0x26')](saveUpdates(_0x26da26[_0x7045('0x49')],null))['then'](respondWithResult(_0x24d265,null))['catch'](handleError(_0x24d265,null));};exports[_0x7045('0x4c')]=function(_0x4652db,_0x294997){return db[_0x7045('0x2e')][_0x7045('0x47')]({'where':{'id':_0x4652db[_0x7045('0x4b')]['id']}})[_0x7045('0x26')](handleEntityNotFound(_0x294997,null))[_0x7045('0x26')](removeEntity(_0x294997,null))[_0x7045('0x45')](handleError(_0x294997,null));};exports[_0x7045('0x4d')]=function(_0x398032,_0x221217,_0x59b72d){var _0x4821e0={};var _0x16bee0={};var _0x3d23cb;var _0x10cae2;return db[_0x7045('0x2e')]['findOne']({'where':{'id':_0x398032[_0x7045('0x4b')]['id']}})[_0x7045('0x26')](handleEntityNotFound(_0x221217,null))[_0x7045('0x26')](function(_0x2f0e5f){if(_0x2f0e5f){_0x3d23cb=_0x2f0e5f;_0x16bee0['model']=_['keys'](db[_0x7045('0x4e')]['rawAttributes']);_0x16bee0[_0x7045('0x33')]=_['keys'](_0x398032[_0x7045('0x33')]);_0x16bee0['filters']=_[_0x7045('0x35')](_0x16bee0['model'],_0x16bee0[_0x7045('0x33')]);_0x4821e0[_0x7045('0x36')]=_[_0x7045('0x35')](_0x16bee0['model'],qs[_0x7045('0x37')](_0x398032[_0x7045('0x33')][_0x7045('0x37')]));_0x4821e0['attributes']=_0x4821e0[_0x7045('0x36')][_0x7045('0x38')]?_0x4821e0[_0x7045('0x36')]:_0x16bee0[_0x7045('0x32')];_0x4821e0[_0x7045('0x4f')]=qs[_0x7045('0x3a')](_0x398032[_0x7045('0x33')][_0x7045('0x3a')]);_0x4821e0['where']=qs[_0x7045('0x3c')](_[_0x7045('0x3d')](_0x398032['query'],_0x16bee0['filters']));if(_0x398032[_0x7045('0x33')][_0x7045('0x3e')]){_0x4821e0[_0x7045('0x3b')]=_['merge'](_0x4821e0[_0x7045('0x3b')],{'$or':_[_0x7045('0x2d')](_0x4821e0[_0x7045('0x36')],function(_0x2eca3e){var _0x2c26a0={};_0x2c26a0[_0x2eca3e]={'$like':'%'+_0x398032['query']['filter']+'%'};return _0x2c26a0;})});}_0x4821e0=_['merge']({},_0x4821e0,_0x398032[_0x7045('0x40')]);return _0x3d23cb[_0x7045('0x4d')](_0x4821e0);}})[_0x7045('0x26')](function(_0x2a2709){if(_0x2a2709){_0x10cae2=_0x2a2709[_0x7045('0x38')];if(!_0x398032['query'][_0x7045('0x39')](_0x7045('0x50'))){_0x4821e0[_0x7045('0x20')]=qs[_0x7045('0x20')](_0x398032['query'][_0x7045('0x20')]);_0x4821e0[_0x7045('0x1e')]=qs[_0x7045('0x1e')](_0x398032[_0x7045('0x33')][_0x7045('0x1e')]);}return _0x3d23cb['getConfigurations'](_0x4821e0);}})[_0x7045('0x26')](function(_0x39fae3){if(_0x39fae3){return _0x39fae3?{'count':_0x10cae2,'rows':_0x39fae3}:null;}})[_0x7045('0x26')](respondWithResult(_0x221217,null))[_0x7045('0x45')](handleError(_0x221217,null));};exports[_0x7045('0x51')]=function(_0x302430,_0x545d48,_0x35fec7){if(_0x302430[_0x7045('0x49')]['id']){delete _0x302430['body']['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x302430[_0x7045('0x4b')]['id']}})[_0x7045('0x26')](handleEntityNotFound(_0x545d48,null))[_0x7045('0x26')](function(_0x2eea09){if(_0x2eea09){_0x302430[_0x7045('0x49')][_0x7045('0x52')]=_0x2eea09['id'];_0x302430[_0x7045('0x49')][_0x7045('0x53')]=integrations[_0x7045('0x54')](_0x302430['body'][_0x7045('0x55')],_0x302430[_0x7045('0x49')][_0x7045('0x31')]);_0x302430[_0x7045('0x49')][_0x7045('0x56')]=integrations[_0x7045('0x57')](_0x302430[_0x7045('0x49')][_0x7045('0x55')],_0x302430[_0x7045('0x49')][_0x7045('0x31')]);return db['FreshdeskConfiguration'][_0x7045('0x48')](_0x302430[_0x7045('0x49')],{'include':[{'model':db['FreshdeskField'],'as':_0x7045('0x53')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0x7045('0x26')](respondWithResult(_0x545d48,null))[_0x7045('0x45')](handleError(_0x545d48,null));};exports[_0x7045('0x58')]=function(_0x43c0c5,_0x2d4575,_0x11729a){var _0xc3bca1='';return db[_0x7045('0x2e')][_0x7045('0x59')]({'where':{'id':_0x43c0c5[_0x7045('0x4b')]['id']},'attributes':['id',_0x7045('0x5a'),_0x7045('0x5b')]})[_0x7045('0x26')](handleEntityNotFound(_0x2d4575,null))[_0x7045('0x26')](function(_0x227667){if(_0x227667){_0xc3bca1=_0x227667['remoteUri'];var _0xce53fb=_0xc3bca1[_0x7045('0x5c')](-0x1);if(_0xce53fb==='/'){_0xc3bca1=_0xc3bca1[_0x7045('0x5d')](0x0,_0xc3bca1[_0x7045('0x5e')](_0xce53fb));}return rp({'method':_0x7045('0x5f'),'uri':util[_0x7045('0x60')](_0x7045('0x61'),_0xc3bca1,_0x7045('0x62')),'headers':{'Authorization':util[_0x7045('0x60')](_0x7045('0x63'),new Buffer(util[_0x7045('0x60')](_0x7045('0x64'),_0x227667[_0x7045('0x5b')]))[_0x7045('0x65')]('base64'))},'json':!![]});}})['then'](function(_0x42ab68){if(_0x42ab68){var _0x152027=[_0x7045('0x66'),_0x7045('0x67'),'agent',_0x7045('0x68'),_0x7045('0x1c'),_0x7045('0x69'),_0x7045('0x6a'),_0x7045('0x6b'),_0x7045('0x6c'),_0x7045('0x6a'),_0x7045('0x6d')];_['remove'](_0x42ab68,function(_0x23d72f){return _0x152027[_0x7045('0x6e')](_0x23d72f['name'])||!_0x23d72f[_0x7045('0x6f')]&&_0x23d72f['type']!==_0x7045('0x70')&&_0x23d72f[_0x7045('0x31')]!==_0x7045('0x71');});return{'count':_0x42ab68[_0x7045('0x38')],'rows':_[_0x7045('0x2d')](_0x42ab68,function(_0x8a8ae4){return{'id':_0x8a8ae4[_0x7045('0x2a')],'name':_0x8a8ae4[_0x7045('0x72')],'custom':!_0x8a8ae4['default'],'options':_0x8a8ae4[_0x7045('0x73')]?_[_0x7045('0x2d')](_0x8a8ae4['choices'],function(_0x160362){return{'name':_[_0x7045('0x74')](_0x160362),'value':_0x160362};}):[]};})};}})['then'](respondWithResult(_0x2d4575,null))['catch'](function(_0x4a5dbe){var _0x1f3117=_0x43c0c5[_0x7045('0x33')][_0x7045('0x75')]?0x1f4:_0x4a5dbe['statusCode']||0x1f4;logger[_0x7045('0x28')](_0x7045('0x76'),_0x7045('0x58'),_0x1f3117,JSON[_0x7045('0x77')](_0x4a5dbe));delete _0x4a5dbe[_0x7045('0x2a')];if(_0x1f3117===0x191){_0x1f3117=0x190;}_0x2d4575[_0x7045('0x1c')](_0x1f3117)[_0x7045('0x2b')](_0x43c0c5['query'][_0x7045('0x75')]?{'message':_0x7045('0x78'),'statusCode':_0x4a5dbe[_0x7045('0x79')]}:_0x4a5dbe);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index eb85d98..5640153 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 _0x2cdf=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','moment'];(function(_0x36cc2c,_0x20980f){var _0x33736f=function(_0x3b623a){while(--_0x3b623a){_0x36cc2c['push'](_0x36cc2c['shift']());}};_0x33736f(++_0x20980f);}(_0x2cdf,0x115));var _0xf2cd=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x2cdf[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require('lodash');var util=require(_0xf2cd('0x0'));var logger=require(_0xf2cd('0x1'))('api');var moment=require(_0xf2cd('0x2'));var BPromise=require(_0xf2cd('0x3'));var rp=require(_0xf2cd('0x4'));var fs=require('fs');var path=require(_0xf2cd('0x5'));var rimraf=require(_0xf2cd('0x6'));var config=require(_0xf2cd('0x7'));var attributes=require(_0xf2cd('0x8'));var integrations=require(_0xf2cd('0x9'));module[_0xf2cd('0xa')]=function(_0x24ecde,_0xa9ae40){return _0x24ecde[_0xf2cd('0xb')](_0xf2cd('0xc'),attributes,{'tableName':_0xf2cd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6f5=['int_freshdesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount'];(function(_0x31659b,_0x3f07a1){var _0x48b140=function(_0x3b295c){while(--_0x3b295c){_0x31659b['push'](_0x31659b['shift']());}};_0x48b140(++_0x3f07a1);}(_0xa6f5,0x194));var _0x5a6f=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xa6f5[_0x424a9a];return _0xa7831c;};'use strict';var _=require('lodash');var util=require(_0x5a6f('0x0'));var logger=require(_0x5a6f('0x1'))(_0x5a6f('0x2'));var moment=require(_0x5a6f('0x3'));var BPromise=require(_0x5a6f('0x4'));var rp=require(_0x5a6f('0x5'));var fs=require('fs');var path=require(_0x5a6f('0x6'));var rimraf=require('rimraf');var config=require(_0x5a6f('0x7'));var attributes=require(_0x5a6f('0x8'));var integrations=require(_0x5a6f('0x9'));module['exports']=function(_0x3d044e,_0x369bfb){return _0x3d044e[_0x5a6f('0xa')](_0x5a6f('0xb'),attributes,{'tableName':_0x5a6f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index b4f3cf1..6b6d2a4 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 _0x8881=['moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','catch','find','ShowFreshdeskAccount','lodash','util'];(function(_0x1f2d5b,_0x362d37){var _0x2b20d5=function(_0xa2a4d4){while(--_0xa2a4d4){_0x1f2d5b['push'](_0x1f2d5b['shift']());}};_0x2b20d5(++_0x362d37);}(_0x8881,0xd0));var _0x1888=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0x8881[_0x49052b];return _0x48c045;};'use strict';var _=require(_0x1888('0x0'));var util=require(_0x1888('0x1'));var moment=require(_0x1888('0x2'));var BPromise=require(_0x1888('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1888('0x4'))['db'];var utils=require(_0x1888('0x5'));var logger=require('../../config/logger')(_0x1888('0x6'));var config=require('../../config/environment');var jayson=require(_0x1888('0x7'));var client=jayson['client'][_0x1888('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39a92b,_0x13c2d0,_0x11a187){return new BPromise(function(_0x352473,_0x4b8569){return client[_0x1888('0x9')](_0x39a92b,_0x11a187)[_0x1888('0xa')](function(_0x2184c3){logger[_0x1888('0xb')](_0x1888('0xc'),_0x13c2d0,_0x1888('0xd'));logger[_0x1888('0xe')](_0x1888('0xf'),_0x13c2d0,_0x1888('0xd'),JSON[_0x1888('0x10')](_0x2184c3));if(_0x2184c3['error']){if(_0x2184c3[_0x1888('0x11')][_0x1888('0x12')]===0x1f4){logger[_0x1888('0x11')](_0x1888('0xc'),_0x13c2d0,_0x2184c3[_0x1888('0x11')][_0x1888('0x13')]);return _0x4b8569(_0x2184c3[_0x1888('0x11')][_0x1888('0x13')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x13c2d0,_0x2184c3[_0x1888('0x11')][_0x1888('0x13')]);return _0x352473(_0x2184c3['error'][_0x1888('0x13')]);}else{logger[_0x1888('0xb')](_0x1888('0xc'),_0x13c2d0,_0x1888('0xd'));_0x352473(_0x2184c3[_0x1888('0x14')][_0x1888('0x13')]);}})['catch'](function(_0xf7aec7){logger['error'](_0x1888('0xc'),_0x13c2d0,_0xf7aec7);_0x4b8569(_0xf7aec7);});});}exports[_0x1888('0x15')]=function(_0x15cd10){var _0x2e93df=this;return new Promise(function(_0x2c7791,_0x352c7e){return db[_0x1888('0x16')][_0x1888('0x17')]({'raw':_0x15cd10['options']?_0x15cd10[_0x1888('0x18')][_0x1888('0x19')]===undefined?!![]:![]:!![],'where':_0x15cd10[_0x1888('0x18')]?_0x15cd10[_0x1888('0x18')][_0x1888('0x1a')]||null:null,'attributes':_0x15cd10[_0x1888('0x18')]?_0x15cd10[_0x1888('0x18')]['attributes']||null:null,'limit':_0x15cd10['options']?_0x15cd10[_0x1888('0x18')][_0x1888('0x1b')]||null:null,'include':_0x15cd10['options']?_0x15cd10[_0x1888('0x18')][_0x1888('0x1c')]?_[_0x1888('0x1d')](_0x15cd10['options']['include'],function(_0x381e7f){return{'model':db[_0x381e7f[_0x1888('0x1e')]],'as':_0x381e7f['as'],'attributes':_0x381e7f[_0x1888('0x1f')],'include':_0x381e7f['include']?_[_0x1888('0x1d')](_0x381e7f[_0x1888('0x1c')],function(_0x4cde6f){return{'model':db[_0x4cde6f[_0x1888('0x1e')]],'as':_0x4cde6f['as'],'attributes':_0x4cde6f[_0x1888('0x1f')],'include':_0x4cde6f[_0x1888('0x1c')]?_[_0x1888('0x1d')](_0x4cde6f[_0x1888('0x1c')],function(_0x52c728){return{'model':db[_0x52c728['model']],'as':_0x52c728['as'],'attributes':_0x52c728[_0x1888('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1888('0xa')](function(_0x5be4ca){logger[_0x1888('0xb')](_0x1888('0x15'),_0x15cd10);logger[_0x1888('0xe')](_0x1888('0x15'),_0x15cd10,JSON[_0x1888('0x10')](_0x5be4ca));_0x2c7791(_0x5be4ca);})[_0x1888('0x20')](function(_0x31ca86){logger[_0x1888('0x11')]('GetFreshdeskAccount',_0x31ca86[_0x1888('0x13')],_0x15cd10);_0x352c7e(_0x2e93df[_0x1888('0x11')](0x1f4,_0x31ca86['message']));});});};exports['ShowFreshdeskAccount']=function(_0x394314){var _0x13163c=this;return new Promise(function(_0x394aa2,_0x5eedbd){return db[_0x1888('0x16')][_0x1888('0x21')]({'raw':_0x394314['options']?_0x394314[_0x1888('0x18')][_0x1888('0x19')]===undefined?!![]:![]:!![],'where':_0x394314['options']?_0x394314[_0x1888('0x18')]['where']||null:null,'attributes':_0x394314[_0x1888('0x18')]?_0x394314['options'][_0x1888('0x1f')]||null:null,'include':_0x394314[_0x1888('0x18')]?_0x394314['options'][_0x1888('0x1c')]?_[_0x1888('0x1d')](_0x394314[_0x1888('0x18')]['include'],function(_0x584028){return{'model':db[_0x584028[_0x1888('0x1e')]],'as':_0x584028['as'],'attributes':_0x584028[_0x1888('0x1f')],'include':_0x584028['include']?_[_0x1888('0x1d')](_0x584028[_0x1888('0x1c')],function(_0x4306d2){return{'model':db[_0x4306d2[_0x1888('0x1e')]],'as':_0x4306d2['as'],'attributes':_0x4306d2['attributes'],'include':_0x4306d2[_0x1888('0x1c')]?_[_0x1888('0x1d')](_0x4306d2[_0x1888('0x1c')],function(_0x284df2){return{'model':db[_0x284df2[_0x1888('0x1e')]],'as':_0x284df2['as'],'attributes':_0x284df2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x59980d){logger[_0x1888('0xb')](_0x1888('0x22'),_0x394314);logger['debug']('ShowFreshdeskAccount',_0x394314,JSON[_0x1888('0x10')](_0x59980d));_0x394aa2(_0x59980d);})[_0x1888('0x20')](function(_0x502798){logger['error'](_0x1888('0x22'),_0x502798[_0x1888('0x13')],_0x394314);_0x5eedbd(_0x13163c[_0x1888('0x11')](0x1f4,_0x502798['message']));});});}; \ No newline at end of file +var _0xb08d=['attributes','limit','map','model','include','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','where'];(function(_0x44c935,_0x3653f0){var _0x465bee=function(_0x211d20){while(--_0x211d20){_0x44c935['push'](_0x44c935['shift']());}};_0x465bee(++_0x3653f0);}(_0xb08d,0x70));var _0xdb08=function(_0x58e42a,_0x1365a7){_0x58e42a=_0x58e42a-0x0;var _0x15a97f=_0xb08d[_0x58e42a];return _0x15a97f;};'use strict';var _=require(_0xdb08('0x0'));var util=require(_0xdb08('0x1'));var moment=require(_0xdb08('0x2'));var BPromise=require(_0xdb08('0x3'));var rs=require(_0xdb08('0x4'));var fs=require('fs');var Redis=require(_0xdb08('0x5'));var db=require(_0xdb08('0x6'))['db'];var utils=require(_0xdb08('0x7'));var logger=require(_0xdb08('0x8'))(_0xdb08('0x9'));var config=require(_0xdb08('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xdb08('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x447a99,_0x3fada5,_0x5d6af0){return new BPromise(function(_0x32d3be,_0x5e74f8){return client[_0xdb08('0xc')](_0x447a99,_0x5d6af0)[_0xdb08('0xd')](function(_0x2c8041){logger[_0xdb08('0xe')](_0xdb08('0xf'),_0x3fada5,'request\x20sent');logger[_0xdb08('0x10')](_0xdb08('0x11'),_0x3fada5,_0xdb08('0x12'),JSON[_0xdb08('0x13')](_0x2c8041));if(_0x2c8041[_0xdb08('0x14')]){if(_0x2c8041[_0xdb08('0x14')]['code']===0x1f4){logger[_0xdb08('0x14')](_0xdb08('0xf'),_0x3fada5,_0x2c8041[_0xdb08('0x14')]['message']);return _0x5e74f8(_0x2c8041[_0xdb08('0x14')]['message']);}logger['error'](_0xdb08('0xf'),_0x3fada5,_0x2c8041['error'][_0xdb08('0x15')]);return _0x32d3be(_0x2c8041[_0xdb08('0x14')]['message']);}else{logger[_0xdb08('0xe')](_0xdb08('0xf'),_0x3fada5,_0xdb08('0x12'));_0x32d3be(_0x2c8041[_0xdb08('0x16')][_0xdb08('0x15')]);}})[_0xdb08('0x17')](function(_0xd4980e){logger[_0xdb08('0x14')](_0xdb08('0xf'),_0x3fada5,_0xd4980e);_0x5e74f8(_0xd4980e);});});}exports[_0xdb08('0x18')]=function(_0x58e602){var _0x4f7fd1=this;return new Promise(function(_0x17d7df,_0x25269d){return db[_0xdb08('0x19')]['findAll']({'raw':_0x58e602[_0xdb08('0x1a')]?_0x58e602[_0xdb08('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x58e602[_0xdb08('0x1a')]?_0x58e602[_0xdb08('0x1a')][_0xdb08('0x1b')]||null:null,'attributes':_0x58e602[_0xdb08('0x1a')]?_0x58e602[_0xdb08('0x1a')][_0xdb08('0x1c')]||null:null,'limit':_0x58e602['options']?_0x58e602[_0xdb08('0x1a')][_0xdb08('0x1d')]||null:null,'include':_0x58e602[_0xdb08('0x1a')]?_0x58e602['options']['include']?_[_0xdb08('0x1e')](_0x58e602[_0xdb08('0x1a')]['include'],function(_0x3db709){return{'model':db[_0x3db709[_0xdb08('0x1f')]],'as':_0x3db709['as'],'attributes':_0x3db709[_0xdb08('0x1c')],'include':_0x3db709[_0xdb08('0x20')]?_[_0xdb08('0x1e')](_0x3db709[_0xdb08('0x20')],function(_0x38ce5a){return{'model':db[_0x38ce5a['model']],'as':_0x38ce5a['as'],'attributes':_0x38ce5a[_0xdb08('0x1c')],'include':_0x38ce5a['include']?_[_0xdb08('0x1e')](_0x38ce5a[_0xdb08('0x20')],function(_0x194334){return{'model':db[_0x194334['model']],'as':_0x194334['as'],'attributes':_0x194334[_0xdb08('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdb08('0xd')](function(_0x862808){logger[_0xdb08('0xe')](_0xdb08('0x18'),_0x58e602);logger[_0xdb08('0x10')](_0xdb08('0x18'),_0x58e602,JSON['stringify'](_0x862808));_0x17d7df(_0x862808);})[_0xdb08('0x17')](function(_0x4a7297){logger['error']('GetFreshdeskAccount',_0x4a7297[_0xdb08('0x15')],_0x58e602);_0x25269d(_0x4f7fd1[_0xdb08('0x14')](0x1f4,_0x4a7297[_0xdb08('0x15')]));});});};exports[_0xdb08('0x21')]=function(_0x354d48){var _0x3e7191=this;return new Promise(function(_0x296c67,_0x390727){return db[_0xdb08('0x19')][_0xdb08('0x22')]({'raw':_0x354d48[_0xdb08('0x1a')]?_0x354d48[_0xdb08('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x354d48[_0xdb08('0x1a')]?_0x354d48[_0xdb08('0x1a')]['where']||null:null,'attributes':_0x354d48[_0xdb08('0x1a')]?_0x354d48[_0xdb08('0x1a')][_0xdb08('0x1c')]||null:null,'include':_0x354d48['options']?_0x354d48['options'][_0xdb08('0x20')]?_[_0xdb08('0x1e')](_0x354d48[_0xdb08('0x1a')][_0xdb08('0x20')],function(_0x2e2aa1){return{'model':db[_0x2e2aa1[_0xdb08('0x1f')]],'as':_0x2e2aa1['as'],'attributes':_0x2e2aa1[_0xdb08('0x1c')],'include':_0x2e2aa1['include']?_[_0xdb08('0x1e')](_0x2e2aa1['include'],function(_0x7c4adf){return{'model':db[_0x7c4adf[_0xdb08('0x1f')]],'as':_0x7c4adf['as'],'attributes':_0x7c4adf['attributes'],'include':_0x7c4adf['include']?_[_0xdb08('0x1e')](_0x7c4adf[_0xdb08('0x20')],function(_0x4ad5f2){return{'model':db[_0x4ad5f2[_0xdb08('0x1f')]],'as':_0x4ad5f2['as'],'attributes':_0x4ad5f2[_0xdb08('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdb08('0xd')](function(_0x4d9890){logger[_0xdb08('0xe')](_0xdb08('0x21'),_0x354d48);logger['debug'](_0xdb08('0x21'),_0x354d48,JSON[_0xdb08('0x13')](_0x4d9890));_0x296c67(_0x4d9890);})[_0xdb08('0x17')](function(_0x4a2222){logger['error']('ShowFreshdeskAccount',_0x4a2222[_0xdb08('0x15')],_0x354d48);_0x390727(_0x3e7191['error'](0x1f4,_0x4a2222[_0xdb08('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index e0e1c6f..dbd8461 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 _0x3a78=['fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','show','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getTags','post','create','/:id/tags','update','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3a78,0x79));var _0x83a7=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x3a78[_0x4ae829];return _0x256b31;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x83a7('0x0'));var timeout=require(_0x83a7('0x1'));var express=require(_0x83a7('0x2'));var router=express[_0x83a7('0x3')]();var fs_extra=require(_0x83a7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x83a7('0x5'));var config=require(_0x83a7('0x6'));var controller=require(_0x83a7('0x7'));router[_0x83a7('0x8')]('/',auth['isAuthenticated'](),controller[_0x83a7('0x9')]);router[_0x83a7('0x8')](_0x83a7('0xa'),auth['isAuthenticated'](),controller[_0x83a7('0xb')]);router[_0x83a7('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x83a7('0xc')]);router[_0x83a7('0x8')](_0x83a7('0xd'),auth[_0x83a7('0xe')](),controller[_0x83a7('0xf')]);router['get'](_0x83a7('0x10'),auth[_0x83a7('0xe')](),controller['getDescriptions']);router[_0x83a7('0x8')]('/:id/tags',auth[_0x83a7('0xe')](),controller[_0x83a7('0x11')]);router[_0x83a7('0x12')]('/',auth[_0x83a7('0xe')](),controller[_0x83a7('0x13')]);router[_0x83a7('0x12')](_0x83a7('0x14'),auth[_0x83a7('0xe')](),controller['setTags']);router['put'](_0x83a7('0xa'),auth[_0x83a7('0xe')](),controller[_0x83a7('0x15')]);router[_0x83a7('0x16')](_0x83a7('0xa'),auth['isAuthenticated'](),controller[_0x83a7('0x17')]);module[_0x83a7('0x18')]=router; \ No newline at end of file +var _0x6337=['/:id/subjects','/:id/tags','getTags','post','create','setTags','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields'];(function(_0x4a8072,_0x435bab){var _0x11a4fe=function(_0x24b69a){while(--_0x24b69a){_0x4a8072['push'](_0x4a8072['shift']());}};_0x11a4fe(++_0x435bab);}(_0x6337,0x10e));var _0x7633=function(_0x6cbbf3,_0x5b6d9d){_0x6cbbf3=_0x6cbbf3-0x0;var _0x2e6e47=_0x6337[_0x6cbbf3];return _0x2e6e47;};'use strict';var multer=require(_0x7633('0x0'));var util=require(_0x7633('0x1'));var path=require(_0x7633('0x2'));var timeout=require(_0x7633('0x3'));var express=require('express');var router=express[_0x7633('0x4')]();var fs_extra=require(_0x7633('0x5'));var auth=require(_0x7633('0x6'));var interaction=require(_0x7633('0x7'));var config=require(_0x7633('0x8'));var controller=require(_0x7633('0x9'));router[_0x7633('0xa')]('/',auth[_0x7633('0xb')](),controller[_0x7633('0xc')]);router[_0x7633('0xa')](_0x7633('0xd'),auth[_0x7633('0xb')](),controller['show']);router['get'](_0x7633('0xe'),auth[_0x7633('0xb')](),controller[_0x7633('0xf')]);router['get'](_0x7633('0x10'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x7633('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0x7633('0x11'),auth[_0x7633('0xb')](),controller[_0x7633('0x12')]);router[_0x7633('0x13')]('/',auth[_0x7633('0xb')](),controller[_0x7633('0x14')]);router[_0x7633('0x13')](_0x7633('0x11'),auth[_0x7633('0xb')](),controller[_0x7633('0x15')]);router[_0x7633('0x16')](_0x7633('0xd'),auth[_0x7633('0xb')](),controller['update']);router[_0x7633('0x17')](_0x7633('0xd'),auth[_0x7633('0xb')](),controller[_0x7633('0x18')]);module[_0x7633('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 36bbc31..80aa1dc 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 _0xc01e=['sequelize','exports','STRING'];(function(_0x2f87cd,_0xcaf299){var _0x5d7eda=function(_0x37ffb0){while(--_0x37ffb0){_0x2f87cd['push'](_0x2f87cd['shift']());}};_0x5d7eda(++_0xcaf299);}(_0xc01e,0x66));var _0xec01=function(_0x47cde5,_0x17a17f){_0x47cde5=_0x47cde5-0x0;var _0x3e68bc=_0xc01e[_0x47cde5];return _0x3e68bc;};'use strict';var Sequelize=require(_0xec01('0x0'));module[_0xec01('0x1')]={'name':{'type':Sequelize[_0xec01('0x2')]},'description':{'type':Sequelize[_0xec01('0x2')]}}; \ No newline at end of file +var _0x43d2=['sequelize','exports','STRING'];(function(_0x533290,_0x31e3ae){var _0x23f13d=function(_0x3473fb){while(--_0x3473fb){_0x533290['push'](_0x533290['shift']());}};_0x23f13d(++_0x31e3ae);}(_0x43d2,0x198));var _0x243d=function(_0x31c5e9,_0x30e373){_0x31c5e9=_0x31c5e9-0x0;var _0x517a8d=_0x43d2[_0x31c5e9];return _0x517a8d;};'use strict';var Sequelize=require(_0x243d('0x0'));module[_0x243d('0x1')]={'name':{'type':Sequelize[_0x243d('0x2')]},'description':{'type':Sequelize[_0x243d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index d6e45dc..997e07d 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 _0x7929=['getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','index','key','model','map','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','FreshdeskConfiguration','include','findAll','catch','params','keys','rawAttributes','fields','length','includeAll','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions'];(function(_0x3b96f1,_0x2df3ab){var _0xc8f303=function(_0x3fa74d){while(--_0x3fa74d){_0x3b96f1['push'](_0x3b96f1['shift']());}};_0xc8f303(++_0x2df3ab);}(_0x7929,0xfa));var _0x9792=function(_0x1aed80,_0x3ca6f6){_0x1aed80=_0x1aed80-0x0;var _0x43961e=_0x7929[_0x1aed80];return _0x43961e;};'use strict';var emlformat=require(_0x9792('0x0'));var rimraf=require(_0x9792('0x1'));var zipdir=require(_0x9792('0x2'));var jsonpatch=require(_0x9792('0x3'));var rp=require(_0x9792('0x4'));var moment=require(_0x9792('0x5'));var BPromise=require(_0x9792('0x6'));var Mustache=require(_0x9792('0x7'));var util=require('util');var path=require(_0x9792('0x8'));var sox=require(_0x9792('0x9'));var csv=require(_0x9792('0xa'));var ejs=require(_0x9792('0xb'));var fs=require('fs');var fs_extra=require(_0x9792('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9792('0xd'));var jsforce=require(_0x9792('0xe'));var deskjs=require(_0x9792('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9792('0x10'));var Papa=require(_0x9792('0x11'));var Redis=require(_0x9792('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9792('0x13'));var hardwareService=require(_0x9792('0x14'));var logger=require(_0x9792('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9792('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa081c9,_0x36ef0c){_0x36ef0c=_0x36ef0c||0xcc;return function(_0x5abcd0){if(_0x5abcd0){return _0xa081c9[_0x9792('0x17')](_0x36ef0c);}return _0xa081c9[_0x9792('0x18')](_0x36ef0c)['end']();};}function respondWithResult(_0x36a9cd,_0x3e3bf8){_0x3e3bf8=_0x3e3bf8||0xc8;return function(_0x2c93c1){if(_0x2c93c1){return _0x36a9cd[_0x9792('0x18')](_0x3e3bf8)[_0x9792('0x19')](_0x2c93c1);}};}function respondWithFilteredResult(_0x42a6f4,_0x1a557a){return function(_0x3bcf18){if(_0x3bcf18){var _0x1a12b1=typeof _0x1a557a['offset']===_0x9792('0x1a')&&typeof _0x1a557a[_0x9792('0x1b')]==='undefined';var _0x3d9e63=_0x3bcf18[_0x9792('0x1c')];var _0x2d8662=_0x1a12b1?0x0:_0x1a557a[_0x9792('0x1d')];var _0x46e599=_0x1a12b1?_0x3bcf18[_0x9792('0x1c')]:_0x1a557a['offset']+_0x1a557a[_0x9792('0x1b')];var _0x3f28e9;if(_0x46e599>=_0x3d9e63){_0x46e599=_0x3d9e63;_0x3f28e9=0xc8;}else{_0x3f28e9=0xce;}_0x42a6f4[_0x9792('0x18')](_0x3f28e9);return _0x42a6f4['set'](_0x9792('0x1e'),_0x2d8662+'-'+_0x46e599+'/'+_0x3d9e63)['json'](_0x3bcf18);}return null;};}function patchUpdates(_0x57e69f){return function(_0x4af08f){try{jsonpatch[_0x9792('0x1f')](_0x4af08f,_0x57e69f,!![]);}catch(_0x2b7d29){return BPromise[_0x9792('0x20')](_0x2b7d29);}return _0x4af08f['save']();};}function saveUpdates(_0x15ec0b,_0x2a5f2e){return function(_0x5efd55){if(_0x5efd55){return _0x5efd55[_0x9792('0x21')](_0x15ec0b)['then'](function(_0x16fb41){return _0x16fb41;});}return null;};}function removeEntity(_0x51995c,_0x5b85ca){return function(_0x58b565){if(_0x58b565){return _0x58b565[_0x9792('0x22')]()[_0x9792('0x23')](function(){_0x51995c[_0x9792('0x18')](0xcc)[_0x9792('0x24')]();});}};}function handleEntityNotFound(_0x5cd787,_0x2f5ff9){return function(_0x4a9f2b){if(!_0x4a9f2b){_0x5cd787[_0x9792('0x17')](0x194);}return _0x4a9f2b;};}function handleError(_0x34ae6e,_0x4ca448){_0x4ca448=_0x4ca448||0x1f4;return function(_0x2605ed){logger[_0x9792('0x25')](_0x2605ed[_0x9792('0x26')]);if(_0x2605ed[_0x9792('0x27')]){delete _0x2605ed[_0x9792('0x27')];}_0x34ae6e[_0x9792('0x18')](_0x4ca448)[_0x9792('0x28')](_0x2605ed);};}exports[_0x9792('0x29')]=function(_0x4c5365,_0x506632){var _0x234a5d={},_0xd1caa2={},_0x58899a={'count':0x0,'rows':[]};var _0x56218f=_['map'](db['FreshdeskConfiguration']['rawAttributes'],function(_0x4b4007){return{'name':_0x4b4007['fieldName'],'type':_0x4b4007['type'][_0x9792('0x2a')]};});_0xd1caa2[_0x9792('0x2b')]=_[_0x9792('0x2c')](_0x56218f,'name');_0xd1caa2[_0x9792('0x2d')]=_['keys'](_0x4c5365[_0x9792('0x2d')]);_0xd1caa2['filters']=_[_0x9792('0x2e')](_0xd1caa2[_0x9792('0x2b')],_0xd1caa2[_0x9792('0x2d')]);_0x234a5d[_0x9792('0x2f')]=_[_0x9792('0x2e')](_0xd1caa2[_0x9792('0x2b')],qs['fields'](_0x4c5365[_0x9792('0x2d')]['fields']));_0x234a5d[_0x9792('0x2f')]=_0x234a5d[_0x9792('0x2f')]['length']?_0x234a5d['attributes']:_0xd1caa2[_0x9792('0x2b')];if(!_0x4c5365[_0x9792('0x2d')][_0x9792('0x30')](_0x9792('0x31'))){_0x234a5d[_0x9792('0x1b')]=qs[_0x9792('0x1b')](_0x4c5365[_0x9792('0x2d')][_0x9792('0x1b')]);_0x234a5d[_0x9792('0x1d')]=qs['offset'](_0x4c5365[_0x9792('0x2d')][_0x9792('0x1d')]);}_0x234a5d[_0x9792('0x32')]=qs[_0x9792('0x33')](_0x4c5365['query'][_0x9792('0x33')]);_0x234a5d[_0x9792('0x34')]=qs[_0x9792('0x35')](_[_0x9792('0x36')](_0x4c5365[_0x9792('0x2d')],_0xd1caa2[_0x9792('0x35')]),_0x56218f);if(_0x4c5365[_0x9792('0x2d')][_0x9792('0x37')]){_0x234a5d[_0x9792('0x34')]=_[_0x9792('0x38')](_0x234a5d[_0x9792('0x34')],{'$or':_[_0x9792('0x2c')](_0x56218f,function(_0x2654e9){if(_0x2654e9[_0x9792('0x39')]!==_0x9792('0x3a')){var _0x3356a6={};_0x3356a6[_0x2654e9[_0x9792('0x27')]]={'$like':'%'+_0x4c5365['query'][_0x9792('0x37')]+'%'};return _0x3356a6;}})});}_0x234a5d=_[_0x9792('0x38')]({},_0x234a5d,_0x4c5365[_0x9792('0x3b')]);var _0x1c306b={'where':_0x234a5d[_0x9792('0x34')]};return db[_0x9792('0x3c')][_0x9792('0x1c')](_0x1c306b)[_0x9792('0x23')](function(_0xf71c9d){_0x58899a[_0x9792('0x1c')]=_0xf71c9d;if(_0x4c5365[_0x9792('0x2d')]['includeAll']){_0x234a5d[_0x9792('0x3d')]=[{'all':!![]}];}return db[_0x9792('0x3c')][_0x9792('0x3e')](_0x234a5d);})['then'](function(_0x398e70){_0x58899a['rows']=_0x398e70;return _0x58899a;})['then'](respondWithFilteredResult(_0x506632,_0x234a5d))[_0x9792('0x3f')](handleError(_0x506632,null));};exports['show']=function(_0x43ff3b,_0x5938c3){var _0x183e8c={'raw':![],'where':{'id':_0x43ff3b[_0x9792('0x40')]['id']}},_0x5d6b4b={};_0x5d6b4b[_0x9792('0x2b')]=_[_0x9792('0x41')](db[_0x9792('0x3c')][_0x9792('0x42')]);_0x5d6b4b[_0x9792('0x2d')]=_['keys'](_0x43ff3b['query']);_0x5d6b4b[_0x9792('0x35')]=_[_0x9792('0x2e')](_0x5d6b4b[_0x9792('0x2b')],_0x5d6b4b[_0x9792('0x2d')]);_0x183e8c[_0x9792('0x2f')]=_['intersection'](_0x5d6b4b['model'],qs[_0x9792('0x43')](_0x43ff3b['query'][_0x9792('0x43')]));_0x183e8c[_0x9792('0x2f')]=_0x183e8c[_0x9792('0x2f')][_0x9792('0x44')]?_0x183e8c['attributes']:_0x5d6b4b[_0x9792('0x2b')];if(_0x43ff3b[_0x9792('0x2d')][_0x9792('0x45')]){_0x183e8c[_0x9792('0x3d')]=[{'all':!![]}];}_0x183e8c=_[_0x9792('0x38')]({},_0x183e8c,_0x43ff3b[_0x9792('0x3b')]);return db['FreshdeskConfiguration'][_0x9792('0x46')](_0x183e8c)[_0x9792('0x23')](handleEntityNotFound(_0x5938c3,null))[_0x9792('0x23')](respondWithResult(_0x5938c3,null))[_0x9792('0x3f')](handleError(_0x5938c3,null));};exports[_0x9792('0x47')]=function(_0x48d272,_0x4f2d32){return db[_0x9792('0x3c')][_0x9792('0x47')](_0x48d272['body'],{})['then'](respondWithResult(_0x4f2d32,0xc9))[_0x9792('0x3f')](handleError(_0x4f2d32,null));};exports['update']=function(_0xda3480,_0x3f61e3){if(_0xda3480['body']['id']){delete _0xda3480['body']['id'];}return db[_0x9792('0x3c')]['find']({'where':{'id':_0xda3480[_0x9792('0x40')]['id']}})[_0x9792('0x23')](handleEntityNotFound(_0x3f61e3,null))[_0x9792('0x23')](saveUpdates(_0xda3480[_0x9792('0x48')],null))[_0x9792('0x23')](respondWithResult(_0x3f61e3,null))[_0x9792('0x3f')](handleError(_0x3f61e3,null));};exports[_0x9792('0x22')]=function(_0x3a6bec,_0x4fffde){return db[_0x9792('0x3c')]['find']({'where':{'id':_0x3a6bec[_0x9792('0x40')]['id']}})[_0x9792('0x23')](handleEntityNotFound(_0x4fffde,null))[_0x9792('0x23')](removeEntity(_0x4fffde,null))[_0x9792('0x3f')](handleError(_0x4fffde,null));};exports[_0x9792('0x49')]=function(_0x1850f9,_0x6a1fe,_0x31ebca){var _0x3c9e47={};var _0xf7958f={};var _0x30ed0d;var _0x243d11;return db[_0x9792('0x3c')][_0x9792('0x4a')]({'where':{'id':_0x1850f9[_0x9792('0x40')]['id']}})[_0x9792('0x23')](handleEntityNotFound(_0x6a1fe,null))[_0x9792('0x23')](function(_0x5e514c){if(_0x5e514c){_0x30ed0d=_0x5e514c;_0xf7958f[_0x9792('0x2b')]=_[_0x9792('0x41')](db[_0x9792('0x4b')][_0x9792('0x42')]);_0xf7958f[_0x9792('0x2d')]=_[_0x9792('0x41')](_0x1850f9['query']);_0xf7958f['filters']=_[_0x9792('0x2e')](_0xf7958f[_0x9792('0x2b')],_0xf7958f[_0x9792('0x2d')]);_0x3c9e47['attributes']=_[_0x9792('0x2e')](_0xf7958f[_0x9792('0x2b')],qs['fields'](_0x1850f9['query'][_0x9792('0x43')]));_0x3c9e47['attributes']=_0x3c9e47[_0x9792('0x2f')][_0x9792('0x44')]?_0x3c9e47['attributes']:_0xf7958f[_0x9792('0x2b')];_0x3c9e47[_0x9792('0x32')]=qs['sort'](_0x1850f9['query'][_0x9792('0x33')]);_0x3c9e47['where']=qs['filters'](_[_0x9792('0x36')](_0x1850f9[_0x9792('0x2d')],_0xf7958f['filters']));if(_0x1850f9[_0x9792('0x2d')]['filter']){_0x3c9e47['where']=_[_0x9792('0x38')](_0x3c9e47[_0x9792('0x34')],{'$or':_[_0x9792('0x2c')](_0x3c9e47['attributes'],function(_0xabf996){var _0x420ce8={};_0x420ce8[_0xabf996]={'$like':'%'+_0x1850f9[_0x9792('0x2d')][_0x9792('0x37')]+'%'};return _0x420ce8;})});}_0x3c9e47=_[_0x9792('0x38')]({},_0x3c9e47,_0x1850f9[_0x9792('0x3b')]);return _0x30ed0d[_0x9792('0x49')](_0x3c9e47);}})[_0x9792('0x23')](function(_0x3718a5){if(_0x3718a5){_0x243d11=_0x3718a5['length'];if(!_0x1850f9[_0x9792('0x2d')][_0x9792('0x30')](_0x9792('0x31'))){_0x3c9e47[_0x9792('0x1b')]=qs[_0x9792('0x1b')](_0x1850f9['query'][_0x9792('0x1b')]);_0x3c9e47['offset']=qs[_0x9792('0x1d')](_0x1850f9['query'][_0x9792('0x1d')]);}return _0x30ed0d[_0x9792('0x49')](_0x3c9e47);}})[_0x9792('0x23')](function(_0x4ce55b){if(_0x4ce55b){return _0x4ce55b?{'count':_0x243d11,'rows':_0x4ce55b}:null;}})[_0x9792('0x23')](respondWithResult(_0x6a1fe,null))[_0x9792('0x3f')](handleError(_0x6a1fe,null));};exports[_0x9792('0x4c')]=function(_0x355ccd,_0x3a73c9,_0x318de0){var _0x52141e={};var _0x6a46e5={};var _0x2279ed;var _0x4147da;return db[_0x9792('0x3c')]['findOne']({'where':{'id':_0x355ccd['params']['id']}})[_0x9792('0x23')](handleEntityNotFound(_0x3a73c9,null))[_0x9792('0x23')](function(_0x2227e2){if(_0x2227e2){_0x2279ed=_0x2227e2;_0x6a46e5['model']=_['keys'](db[_0x9792('0x4b')]['rawAttributes']);_0x6a46e5['query']=_[_0x9792('0x41')](_0x355ccd[_0x9792('0x2d')]);_0x6a46e5[_0x9792('0x35')]=_['intersection'](_0x6a46e5[_0x9792('0x2b')],_0x6a46e5[_0x9792('0x2d')]);_0x52141e[_0x9792('0x2f')]=_[_0x9792('0x2e')](_0x6a46e5[_0x9792('0x2b')],qs['fields'](_0x355ccd[_0x9792('0x2d')][_0x9792('0x43')]));_0x52141e[_0x9792('0x2f')]=_0x52141e[_0x9792('0x2f')][_0x9792('0x44')]?_0x52141e[_0x9792('0x2f')]:_0x6a46e5[_0x9792('0x2b')];_0x52141e[_0x9792('0x32')]=qs[_0x9792('0x33')](_0x355ccd[_0x9792('0x2d')][_0x9792('0x33')]);_0x52141e[_0x9792('0x34')]=qs[_0x9792('0x35')](_[_0x9792('0x36')](_0x355ccd['query'],_0x6a46e5[_0x9792('0x35')]));if(_0x355ccd[_0x9792('0x2d')][_0x9792('0x37')]){_0x52141e[_0x9792('0x34')]=_[_0x9792('0x38')](_0x52141e[_0x9792('0x34')],{'$or':_[_0x9792('0x2c')](_0x52141e[_0x9792('0x2f')],function(_0x54a2e2){var _0x3e0e01={};_0x3e0e01[_0x54a2e2]={'$like':'%'+_0x355ccd[_0x9792('0x2d')][_0x9792('0x37')]+'%'};return _0x3e0e01;})});}_0x52141e=_[_0x9792('0x38')]({},_0x52141e,_0x355ccd[_0x9792('0x3b')]);return _0x2279ed[_0x9792('0x4c')](_0x52141e);}})[_0x9792('0x23')](function(_0x6bbc83){if(_0x6bbc83){_0x4147da=_0x6bbc83[_0x9792('0x44')];if(!_0x355ccd['query'][_0x9792('0x30')](_0x9792('0x31'))){_0x52141e[_0x9792('0x1b')]=qs[_0x9792('0x1b')](_0x355ccd[_0x9792('0x2d')]['limit']);_0x52141e['offset']=qs[_0x9792('0x1d')](_0x355ccd[_0x9792('0x2d')][_0x9792('0x1d')]);}return _0x2279ed[_0x9792('0x4c')](_0x52141e);}})[_0x9792('0x23')](function(_0x160780){if(_0x160780){return _0x160780?{'count':_0x4147da,'rows':_0x160780}:null;}})[_0x9792('0x23')](respondWithResult(_0x3a73c9,null))['catch'](handleError(_0x3a73c9,null));};exports['getDescriptions']=function(_0x248ce0,_0x48b408,_0x44103b){var _0x1a5d1e={};var _0x4ec82c={};var _0x3a0787;var _0x1b6189;return db[_0x9792('0x3c')][_0x9792('0x4a')]({'where':{'id':_0x248ce0[_0x9792('0x40')]['id']}})[_0x9792('0x23')](handleEntityNotFound(_0x48b408,null))[_0x9792('0x23')](function(_0x3bd7e6){if(_0x3bd7e6){_0x3a0787=_0x3bd7e6;_0x4ec82c[_0x9792('0x2b')]=_[_0x9792('0x41')](db[_0x9792('0x4b')][_0x9792('0x42')]);_0x4ec82c[_0x9792('0x2d')]=_[_0x9792('0x41')](_0x248ce0[_0x9792('0x2d')]);_0x4ec82c[_0x9792('0x35')]=_[_0x9792('0x2e')](_0x4ec82c[_0x9792('0x2b')],_0x4ec82c['query']);_0x1a5d1e['attributes']=_[_0x9792('0x2e')](_0x4ec82c[_0x9792('0x2b')],qs['fields'](_0x248ce0[_0x9792('0x2d')]['fields']));_0x1a5d1e[_0x9792('0x2f')]=_0x1a5d1e['attributes'][_0x9792('0x44')]?_0x1a5d1e['attributes']:_0x4ec82c[_0x9792('0x2b')];_0x1a5d1e[_0x9792('0x32')]=qs[_0x9792('0x33')](_0x248ce0[_0x9792('0x2d')][_0x9792('0x33')]);_0x1a5d1e['where']=qs[_0x9792('0x35')](_[_0x9792('0x36')](_0x248ce0[_0x9792('0x2d')],_0x4ec82c[_0x9792('0x35')]));if(_0x248ce0[_0x9792('0x2d')][_0x9792('0x37')]){_0x1a5d1e[_0x9792('0x34')]=_['merge'](_0x1a5d1e[_0x9792('0x34')],{'$or':_[_0x9792('0x2c')](_0x1a5d1e[_0x9792('0x2f')],function(_0x4241a5){var _0x23408c={};_0x23408c[_0x4241a5]={'$like':'%'+_0x248ce0['query'][_0x9792('0x37')]+'%'};return _0x23408c;})});}_0x1a5d1e=_[_0x9792('0x38')]({},_0x1a5d1e,_0x248ce0[_0x9792('0x3b')]);return _0x3a0787[_0x9792('0x4d')](_0x1a5d1e);}})[_0x9792('0x23')](function(_0x38d761){if(_0x38d761){_0x1b6189=_0x38d761['length'];if(!_0x248ce0[_0x9792('0x2d')][_0x9792('0x30')](_0x9792('0x31'))){_0x1a5d1e['limit']=qs[_0x9792('0x1b')](_0x248ce0[_0x9792('0x2d')]['limit']);_0x1a5d1e[_0x9792('0x1d')]=qs[_0x9792('0x1d')](_0x248ce0[_0x9792('0x2d')][_0x9792('0x1d')]);}return _0x3a0787['getDescriptions'](_0x1a5d1e);}})[_0x9792('0x23')](function(_0x2021cf){if(_0x2021cf){return _0x2021cf?{'count':_0x1b6189,'rows':_0x2021cf}:null;}})['then'](respondWithResult(_0x48b408,null))[_0x9792('0x3f')](handleError(_0x48b408,null));};exports[_0x9792('0x4e')]=function(_0x5efc5d,_0x42acbc,_0x3a75d5){var _0x2aee21={};var _0x309ec4={};var _0x5c08f;var _0x4c9252;return db[_0x9792('0x3c')]['findOne']({'where':{'id':_0x5efc5d[_0x9792('0x40')]['id']}})[_0x9792('0x23')](handleEntityNotFound(_0x42acbc,null))[_0x9792('0x23')](function(_0x352d9a){if(_0x352d9a){_0x5c08f=_0x352d9a;_0x309ec4[_0x9792('0x2b')]=_['keys'](db[_0x9792('0x4f')]['rawAttributes']);_0x309ec4['query']=_[_0x9792('0x41')](_0x5efc5d[_0x9792('0x2d')]);_0x309ec4['filters']=_[_0x9792('0x2e')](_0x309ec4[_0x9792('0x2b')],_0x309ec4[_0x9792('0x2d')]);_0x2aee21[_0x9792('0x2f')]=_[_0x9792('0x2e')](_0x309ec4[_0x9792('0x2b')],qs[_0x9792('0x43')](_0x5efc5d['query'][_0x9792('0x43')]));_0x2aee21[_0x9792('0x2f')]=_0x2aee21[_0x9792('0x2f')][_0x9792('0x44')]?_0x2aee21[_0x9792('0x2f')]:_0x309ec4[_0x9792('0x2b')];_0x2aee21[_0x9792('0x32')]=qs['sort'](_0x5efc5d[_0x9792('0x2d')][_0x9792('0x33')]);_0x2aee21[_0x9792('0x34')]=qs[_0x9792('0x35')](_[_0x9792('0x36')](_0x5efc5d[_0x9792('0x2d')],_0x309ec4[_0x9792('0x35')]));if(_0x5efc5d[_0x9792('0x2d')][_0x9792('0x37')]){_0x2aee21[_0x9792('0x34')]=_[_0x9792('0x38')](_0x2aee21[_0x9792('0x34')],{'$or':_['map'](_0x2aee21[_0x9792('0x2f')],function(_0x2e98b8){var _0x138d98={};_0x138d98[_0x2e98b8]={'$like':'%'+_0x5efc5d['query'][_0x9792('0x37')]+'%'};return _0x138d98;})});}_0x2aee21=_[_0x9792('0x38')]({},_0x2aee21,_0x5efc5d['options']);return _0x5c08f[_0x9792('0x4e')](_0x2aee21);}})[_0x9792('0x23')](function(_0x1c0bf9){if(_0x1c0bf9){_0x4c9252=_0x1c0bf9[_0x9792('0x44')];if(!_0x5efc5d[_0x9792('0x2d')]['hasOwnProperty'](_0x9792('0x31'))){_0x2aee21[_0x9792('0x1b')]=qs[_0x9792('0x1b')](_0x5efc5d[_0x9792('0x2d')]['limit']);_0x2aee21[_0x9792('0x1d')]=qs['offset'](_0x5efc5d['query']['offset']);}return _0x5c08f['getTags'](_0x2aee21);}})[_0x9792('0x23')](function(_0x31d910){if(_0x31d910){return _0x31d910?{'count':_0x4c9252,'rows':_0x31d910}:null;}})[_0x9792('0x23')](respondWithResult(_0x42acbc,null))['catch'](handleError(_0x42acbc,null));};exports[_0x9792('0x50')]=function(_0x3bd710,_0x35b7db,_0x1de922){if(_0x3bd710['body']['id']){delete _0x3bd710[_0x9792('0x48')]['id'];}return db['FreshdeskConfiguration'][_0x9792('0x4a')]({'where':{'id':_0x3bd710[_0x9792('0x40')]['id']}})['then'](handleEntityNotFound(_0x35b7db,null))['then'](function(_0x18ef98){if(_0x18ef98){return _0x18ef98['setTags'](_0x3bd710[_0x9792('0x48')][_0x9792('0x51')]||[]);}return null;})[_0x9792('0x23')](respondWithResult(_0x35b7db,null))[_0x9792('0x3f')](handleError(_0x35b7db,null));}; \ No newline at end of file +var _0x2c18=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','json','then','destroy','error','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','params','intersection','find','create','body','update','findOne','pick','options','getFields','FreshdeskField','getSubjects','getDescriptions','getTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x2c18,0x1c8));var _0x82c1=function(_0x36de10,_0xfe25e8){_0x36de10=_0x36de10-0x0;var _0x58100f=_0x2c18[_0x36de10];return _0x58100f;};'use strict';var emlformat=require(_0x82c1('0x0'));var rimraf=require(_0x82c1('0x1'));var zipdir=require(_0x82c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82c1('0x3'));var moment=require('moment');var BPromise=require(_0x82c1('0x4'));var Mustache=require(_0x82c1('0x5'));var util=require(_0x82c1('0x6'));var path=require(_0x82c1('0x7'));var sox=require(_0x82c1('0x8'));var csv=require(_0x82c1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82c1('0xa'));var _=require('lodash');var squel=require(_0x82c1('0xb'));var crypto=require(_0x82c1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x82c1('0xd'));var toCsv=require(_0x82c1('0x9'));var querystring=require(_0x82c1('0xe'));var Papa=require(_0x82c1('0xf'));var Redis=require('ioredis');var authService=require(_0x82c1('0x10'));var qs=require(_0x82c1('0x11'));var as=require(_0x82c1('0x12'));var hardwareService=require(_0x82c1('0x13'));var logger=require(_0x82c1('0x14'))(_0x82c1('0x15'));var utils=require(_0x82c1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x82c1('0x17'));var db=require(_0x82c1('0x18'))['db'];function respondWithStatusCode(_0x13af5c,_0x3228cf){_0x3228cf=_0x3228cf||0xcc;return function(_0x367c5d){if(_0x367c5d){return _0x13af5c[_0x82c1('0x19')](_0x3228cf);}return _0x13af5c[_0x82c1('0x1a')](_0x3228cf)[_0x82c1('0x1b')]();};}function respondWithResult(_0x253fc6,_0x2ef289){_0x2ef289=_0x2ef289||0xc8;return function(_0x15fba8){if(_0x15fba8){return _0x253fc6[_0x82c1('0x1a')](_0x2ef289)['json'](_0x15fba8);}};}function respondWithFilteredResult(_0x455958,_0x163685){return function(_0x101bc7){if(_0x101bc7){var _0x2b9a4e=typeof _0x163685['offset']===_0x82c1('0x1c')&&typeof _0x163685['limit']===_0x82c1('0x1c');var _0x231d04=_0x101bc7['count'];var _0x479f71=_0x2b9a4e?0x0:_0x163685['offset'];var _0x5978f7=_0x2b9a4e?_0x101bc7[_0x82c1('0x1d')]:_0x163685[_0x82c1('0x1e')]+_0x163685[_0x82c1('0x1f')];var _0xfc4c4;if(_0x5978f7>=_0x231d04){_0x5978f7=_0x231d04;_0xfc4c4=0xc8;}else{_0xfc4c4=0xce;}_0x455958[_0x82c1('0x1a')](_0xfc4c4);return _0x455958[_0x82c1('0x20')]('Content-Range',_0x479f71+'-'+_0x5978f7+'/'+_0x231d04)[_0x82c1('0x21')](_0x101bc7);}return null;};}function patchUpdates(_0x149e2c){return function(_0x34e99f){try{jsonpatch['apply'](_0x34e99f,_0x149e2c,!![]);}catch(_0x140dfe){return BPromise['reject'](_0x140dfe);}return _0x34e99f['save']();};}function saveUpdates(_0x332e0b,_0xf1b721){return function(_0x5643a3){if(_0x5643a3){return _0x5643a3['update'](_0x332e0b)[_0x82c1('0x22')](function(_0x1f973c){return _0x1f973c;});}return null;};}function removeEntity(_0x29ee5c,_0x244e72){return function(_0x485536){if(_0x485536){return _0x485536[_0x82c1('0x23')]()[_0x82c1('0x22')](function(){_0x29ee5c[_0x82c1('0x1a')](0xcc)[_0x82c1('0x1b')]();});}};}function handleEntityNotFound(_0x164e9e,_0x3c7960){return function(_0x5cff4c){if(!_0x5cff4c){_0x164e9e[_0x82c1('0x19')](0x194);}return _0x5cff4c;};}function handleError(_0x5a3974,_0x4ec8a7){_0x4ec8a7=_0x4ec8a7||0x1f4;return function(_0x4df29a){logger[_0x82c1('0x24')](_0x4df29a['stack']);if(_0x4df29a[_0x82c1('0x25')]){delete _0x4df29a[_0x82c1('0x25')];}_0x5a3974['status'](_0x4ec8a7)['send'](_0x4df29a);};}exports[_0x82c1('0x26')]=function(_0x35c49a,_0x1da4b2){var _0x312610={},_0x26a113={},_0x26cf56={'count':0x0,'rows':[]};var _0x2ec53c=_[_0x82c1('0x27')](db[_0x82c1('0x28')][_0x82c1('0x29')],function(_0x18b0df){return{'name':_0x18b0df[_0x82c1('0x2a')],'type':_0x18b0df[_0x82c1('0x2b')][_0x82c1('0x2c')]};});_0x26a113[_0x82c1('0x2d')]=_['map'](_0x2ec53c,'name');_0x26a113[_0x82c1('0x2e')]=_[_0x82c1('0x2f')](_0x35c49a[_0x82c1('0x2e')]);_0x26a113[_0x82c1('0x30')]=_['intersection'](_0x26a113[_0x82c1('0x2d')],_0x26a113[_0x82c1('0x2e')]);_0x312610[_0x82c1('0x31')]=_['intersection'](_0x26a113[_0x82c1('0x2d')],qs[_0x82c1('0x32')](_0x35c49a[_0x82c1('0x2e')][_0x82c1('0x32')]));_0x312610['attributes']=_0x312610['attributes'][_0x82c1('0x33')]?_0x312610[_0x82c1('0x31')]:_0x26a113[_0x82c1('0x2d')];if(!_0x35c49a[_0x82c1('0x2e')][_0x82c1('0x34')](_0x82c1('0x35'))){_0x312610[_0x82c1('0x1f')]=qs[_0x82c1('0x1f')](_0x35c49a['query'][_0x82c1('0x1f')]);_0x312610['offset']=qs[_0x82c1('0x1e')](_0x35c49a[_0x82c1('0x2e')][_0x82c1('0x1e')]);}_0x312610[_0x82c1('0x36')]=qs[_0x82c1('0x37')](_0x35c49a[_0x82c1('0x2e')][_0x82c1('0x37')]);_0x312610[_0x82c1('0x38')]=qs[_0x82c1('0x30')](_['pick'](_0x35c49a[_0x82c1('0x2e')],_0x26a113[_0x82c1('0x30')]),_0x2ec53c);if(_0x35c49a[_0x82c1('0x2e')]['filter']){_0x312610['where']=_[_0x82c1('0x39')](_0x312610[_0x82c1('0x38')],{'$or':_[_0x82c1('0x27')](_0x2ec53c,function(_0x2486ac){if(_0x2486ac[_0x82c1('0x2b')]!==_0x82c1('0x3a')){var _0x3cf85c={};_0x3cf85c[_0x2486ac['name']]={'$like':'%'+_0x35c49a[_0x82c1('0x2e')][_0x82c1('0x3b')]+'%'};return _0x3cf85c;}})});}_0x312610=_[_0x82c1('0x39')]({},_0x312610,_0x35c49a['options']);var _0x4aa4c5={'where':_0x312610[_0x82c1('0x38')]};return db[_0x82c1('0x28')]['count'](_0x4aa4c5)[_0x82c1('0x22')](function(_0x1e8bbb){_0x26cf56[_0x82c1('0x1d')]=_0x1e8bbb;if(_0x35c49a[_0x82c1('0x2e')][_0x82c1('0x3c')]){_0x312610['include']=[{'all':!![]}];}return db[_0x82c1('0x28')][_0x82c1('0x3d')](_0x312610);})[_0x82c1('0x22')](function(_0x402b29){_0x26cf56[_0x82c1('0x3e')]=_0x402b29;return _0x26cf56;})[_0x82c1('0x22')](respondWithFilteredResult(_0x1da4b2,_0x312610))[_0x82c1('0x3f')](handleError(_0x1da4b2,null));};exports['show']=function(_0x5745a1,_0x4e9255){var _0x10d8dc={'raw':![],'where':{'id':_0x5745a1[_0x82c1('0x40')]['id']}},_0x57ea59={};_0x57ea59[_0x82c1('0x2d')]=_[_0x82c1('0x2f')](db[_0x82c1('0x28')][_0x82c1('0x29')]);_0x57ea59[_0x82c1('0x2e')]=_[_0x82c1('0x2f')](_0x5745a1[_0x82c1('0x2e')]);_0x57ea59[_0x82c1('0x30')]=_['intersection'](_0x57ea59[_0x82c1('0x2d')],_0x57ea59[_0x82c1('0x2e')]);_0x10d8dc[_0x82c1('0x31')]=_[_0x82c1('0x41')](_0x57ea59[_0x82c1('0x2d')],qs[_0x82c1('0x32')](_0x5745a1['query'][_0x82c1('0x32')]));_0x10d8dc[_0x82c1('0x31')]=_0x10d8dc['attributes'][_0x82c1('0x33')]?_0x10d8dc[_0x82c1('0x31')]:_0x57ea59[_0x82c1('0x2d')];if(_0x5745a1[_0x82c1('0x2e')][_0x82c1('0x3c')]){_0x10d8dc['include']=[{'all':!![]}];}_0x10d8dc=_[_0x82c1('0x39')]({},_0x10d8dc,_0x5745a1['options']);return db['FreshdeskConfiguration'][_0x82c1('0x42')](_0x10d8dc)[_0x82c1('0x22')](handleEntityNotFound(_0x4e9255,null))[_0x82c1('0x22')](respondWithResult(_0x4e9255,null))[_0x82c1('0x3f')](handleError(_0x4e9255,null));};exports[_0x82c1('0x43')]=function(_0x3d549c,_0x488a53){return db['FreshdeskConfiguration']['create'](_0x3d549c[_0x82c1('0x44')],{})[_0x82c1('0x22')](respondWithResult(_0x488a53,0xc9))[_0x82c1('0x3f')](handleError(_0x488a53,null));};exports[_0x82c1('0x45')]=function(_0x5dc7d8,_0x5e1831){if(_0x5dc7d8[_0x82c1('0x44')]['id']){delete _0x5dc7d8[_0x82c1('0x44')]['id'];}return db[_0x82c1('0x28')][_0x82c1('0x42')]({'where':{'id':_0x5dc7d8[_0x82c1('0x40')]['id']}})['then'](handleEntityNotFound(_0x5e1831,null))[_0x82c1('0x22')](saveUpdates(_0x5dc7d8[_0x82c1('0x44')],null))[_0x82c1('0x22')](respondWithResult(_0x5e1831,null))[_0x82c1('0x3f')](handleError(_0x5e1831,null));};exports[_0x82c1('0x23')]=function(_0x23a697,_0x462138){return db['FreshdeskConfiguration'][_0x82c1('0x42')]({'where':{'id':_0x23a697[_0x82c1('0x40')]['id']}})['then'](handleEntityNotFound(_0x462138,null))[_0x82c1('0x22')](removeEntity(_0x462138,null))['catch'](handleError(_0x462138,null));};exports['getFields']=function(_0x569933,_0x46da74,_0x33c1eb){var _0x283c33={};var _0xe79541={};var _0x2be18d;var _0x557bc1;return db[_0x82c1('0x28')][_0x82c1('0x46')]({'where':{'id':_0x569933['params']['id']}})[_0x82c1('0x22')](handleEntityNotFound(_0x46da74,null))[_0x82c1('0x22')](function(_0x25367d){if(_0x25367d){_0x2be18d=_0x25367d;_0xe79541[_0x82c1('0x2d')]=_[_0x82c1('0x2f')](db['FreshdeskField'][_0x82c1('0x29')]);_0xe79541[_0x82c1('0x2e')]=_['keys'](_0x569933[_0x82c1('0x2e')]);_0xe79541['filters']=_[_0x82c1('0x41')](_0xe79541[_0x82c1('0x2d')],_0xe79541['query']);_0x283c33['attributes']=_[_0x82c1('0x41')](_0xe79541['model'],qs[_0x82c1('0x32')](_0x569933[_0x82c1('0x2e')][_0x82c1('0x32')]));_0x283c33[_0x82c1('0x31')]=_0x283c33['attributes']['length']?_0x283c33[_0x82c1('0x31')]:_0xe79541[_0x82c1('0x2d')];_0x283c33[_0x82c1('0x36')]=qs['sort'](_0x569933[_0x82c1('0x2e')]['sort']);_0x283c33[_0x82c1('0x38')]=qs[_0x82c1('0x30')](_[_0x82c1('0x47')](_0x569933[_0x82c1('0x2e')],_0xe79541[_0x82c1('0x30')]));if(_0x569933['query']['filter']){_0x283c33[_0x82c1('0x38')]=_[_0x82c1('0x39')](_0x283c33[_0x82c1('0x38')],{'$or':_[_0x82c1('0x27')](_0x283c33[_0x82c1('0x31')],function(_0x7d4802){var _0xd3174e={};_0xd3174e[_0x7d4802]={'$like':'%'+_0x569933[_0x82c1('0x2e')][_0x82c1('0x3b')]+'%'};return _0xd3174e;})});}_0x283c33=_[_0x82c1('0x39')]({},_0x283c33,_0x569933[_0x82c1('0x48')]);return _0x2be18d[_0x82c1('0x49')](_0x283c33);}})[_0x82c1('0x22')](function(_0x25cb8c){if(_0x25cb8c){_0x557bc1=_0x25cb8c['length'];if(!_0x569933[_0x82c1('0x2e')][_0x82c1('0x34')](_0x82c1('0x35'))){_0x283c33[_0x82c1('0x1f')]=qs[_0x82c1('0x1f')](_0x569933['query']['limit']);_0x283c33['offset']=qs[_0x82c1('0x1e')](_0x569933['query']['offset']);}return _0x2be18d['getFields'](_0x283c33);}})['then'](function(_0x2fb30f){if(_0x2fb30f){return _0x2fb30f?{'count':_0x557bc1,'rows':_0x2fb30f}:null;}})[_0x82c1('0x22')](respondWithResult(_0x46da74,null))[_0x82c1('0x3f')](handleError(_0x46da74,null));};exports['getSubjects']=function(_0x35a99e,_0x238b86,_0x3f2d5e){var _0x3707aa={};var _0x1eaa5b={};var _0x4eedc6;var _0x27ad9b;return db[_0x82c1('0x28')][_0x82c1('0x46')]({'where':{'id':_0x35a99e[_0x82c1('0x40')]['id']}})['then'](handleEntityNotFound(_0x238b86,null))[_0x82c1('0x22')](function(_0x297aaa){if(_0x297aaa){_0x4eedc6=_0x297aaa;_0x1eaa5b[_0x82c1('0x2d')]=_[_0x82c1('0x2f')](db[_0x82c1('0x4a')]['rawAttributes']);_0x1eaa5b[_0x82c1('0x2e')]=_['keys'](_0x35a99e[_0x82c1('0x2e')]);_0x1eaa5b[_0x82c1('0x30')]=_[_0x82c1('0x41')](_0x1eaa5b[_0x82c1('0x2d')],_0x1eaa5b[_0x82c1('0x2e')]);_0x3707aa[_0x82c1('0x31')]=_[_0x82c1('0x41')](_0x1eaa5b[_0x82c1('0x2d')],qs[_0x82c1('0x32')](_0x35a99e[_0x82c1('0x2e')][_0x82c1('0x32')]));_0x3707aa[_0x82c1('0x31')]=_0x3707aa[_0x82c1('0x31')]['length']?_0x3707aa[_0x82c1('0x31')]:_0x1eaa5b[_0x82c1('0x2d')];_0x3707aa[_0x82c1('0x36')]=qs['sort'](_0x35a99e[_0x82c1('0x2e')][_0x82c1('0x37')]);_0x3707aa['where']=qs['filters'](_[_0x82c1('0x47')](_0x35a99e[_0x82c1('0x2e')],_0x1eaa5b['filters']));if(_0x35a99e['query'][_0x82c1('0x3b')]){_0x3707aa[_0x82c1('0x38')]=_[_0x82c1('0x39')](_0x3707aa[_0x82c1('0x38')],{'$or':_[_0x82c1('0x27')](_0x3707aa[_0x82c1('0x31')],function(_0x2c9973){var _0x225f63={};_0x225f63[_0x2c9973]={'$like':'%'+_0x35a99e[_0x82c1('0x2e')][_0x82c1('0x3b')]+'%'};return _0x225f63;})});}_0x3707aa=_[_0x82c1('0x39')]({},_0x3707aa,_0x35a99e['options']);return _0x4eedc6[_0x82c1('0x4b')](_0x3707aa);}})[_0x82c1('0x22')](function(_0x489bc8){if(_0x489bc8){_0x27ad9b=_0x489bc8['length'];if(!_0x35a99e[_0x82c1('0x2e')]['hasOwnProperty'](_0x82c1('0x35'))){_0x3707aa[_0x82c1('0x1f')]=qs[_0x82c1('0x1f')](_0x35a99e[_0x82c1('0x2e')][_0x82c1('0x1f')]);_0x3707aa['offset']=qs[_0x82c1('0x1e')](_0x35a99e[_0x82c1('0x2e')]['offset']);}return _0x4eedc6[_0x82c1('0x4b')](_0x3707aa);}})[_0x82c1('0x22')](function(_0x42d84b){if(_0x42d84b){return _0x42d84b?{'count':_0x27ad9b,'rows':_0x42d84b}:null;}})[_0x82c1('0x22')](respondWithResult(_0x238b86,null))[_0x82c1('0x3f')](handleError(_0x238b86,null));};exports[_0x82c1('0x4c')]=function(_0x1d6007,_0x4f8406,_0x25cbeb){var _0x1c3d40={};var _0x4a53cc={};var _0x35f47b;var _0x1dd6c6;return db[_0x82c1('0x28')][_0x82c1('0x46')]({'where':{'id':_0x1d6007['params']['id']}})['then'](handleEntityNotFound(_0x4f8406,null))[_0x82c1('0x22')](function(_0x31483a){if(_0x31483a){_0x35f47b=_0x31483a;_0x4a53cc[_0x82c1('0x2d')]=_[_0x82c1('0x2f')](db[_0x82c1('0x4a')][_0x82c1('0x29')]);_0x4a53cc[_0x82c1('0x2e')]=_[_0x82c1('0x2f')](_0x1d6007[_0x82c1('0x2e')]);_0x4a53cc[_0x82c1('0x30')]=_['intersection'](_0x4a53cc[_0x82c1('0x2d')],_0x4a53cc['query']);_0x1c3d40[_0x82c1('0x31')]=_[_0x82c1('0x41')](_0x4a53cc['model'],qs[_0x82c1('0x32')](_0x1d6007[_0x82c1('0x2e')][_0x82c1('0x32')]));_0x1c3d40[_0x82c1('0x31')]=_0x1c3d40['attributes']['length']?_0x1c3d40[_0x82c1('0x31')]:_0x4a53cc[_0x82c1('0x2d')];_0x1c3d40['order']=qs[_0x82c1('0x37')](_0x1d6007[_0x82c1('0x2e')][_0x82c1('0x37')]);_0x1c3d40['where']=qs['filters'](_[_0x82c1('0x47')](_0x1d6007[_0x82c1('0x2e')],_0x4a53cc[_0x82c1('0x30')]));if(_0x1d6007[_0x82c1('0x2e')][_0x82c1('0x3b')]){_0x1c3d40['where']=_[_0x82c1('0x39')](_0x1c3d40['where'],{'$or':_[_0x82c1('0x27')](_0x1c3d40[_0x82c1('0x31')],function(_0x14b318){var _0x3e0434={};_0x3e0434[_0x14b318]={'$like':'%'+_0x1d6007[_0x82c1('0x2e')]['filter']+'%'};return _0x3e0434;})});}_0x1c3d40=_['merge']({},_0x1c3d40,_0x1d6007['options']);return _0x35f47b[_0x82c1('0x4c')](_0x1c3d40);}})[_0x82c1('0x22')](function(_0x1225b3){if(_0x1225b3){_0x1dd6c6=_0x1225b3['length'];if(!_0x1d6007[_0x82c1('0x2e')]['hasOwnProperty'](_0x82c1('0x35'))){_0x1c3d40[_0x82c1('0x1f')]=qs[_0x82c1('0x1f')](_0x1d6007[_0x82c1('0x2e')][_0x82c1('0x1f')]);_0x1c3d40[_0x82c1('0x1e')]=qs[_0x82c1('0x1e')](_0x1d6007[_0x82c1('0x2e')][_0x82c1('0x1e')]);}return _0x35f47b[_0x82c1('0x4c')](_0x1c3d40);}})[_0x82c1('0x22')](function(_0x50a051){if(_0x50a051){return _0x50a051?{'count':_0x1dd6c6,'rows':_0x50a051}:null;}})[_0x82c1('0x22')](respondWithResult(_0x4f8406,null))['catch'](handleError(_0x4f8406,null));};exports[_0x82c1('0x4d')]=function(_0x218a2d,_0x740c48,_0x54988d){var _0x1d5506={};var _0x9135={};var _0x52ef24;var _0xcd6b7c;return db[_0x82c1('0x28')][_0x82c1('0x46')]({'where':{'id':_0x218a2d[_0x82c1('0x40')]['id']}})[_0x82c1('0x22')](handleEntityNotFound(_0x740c48,null))[_0x82c1('0x22')](function(_0x3ab1cc){if(_0x3ab1cc){_0x52ef24=_0x3ab1cc;_0x9135['model']=_[_0x82c1('0x2f')](db['Tag']['rawAttributes']);_0x9135[_0x82c1('0x2e')]=_[_0x82c1('0x2f')](_0x218a2d[_0x82c1('0x2e')]);_0x9135['filters']=_[_0x82c1('0x41')](_0x9135[_0x82c1('0x2d')],_0x9135[_0x82c1('0x2e')]);_0x1d5506[_0x82c1('0x31')]=_[_0x82c1('0x41')](_0x9135[_0x82c1('0x2d')],qs[_0x82c1('0x32')](_0x218a2d['query'][_0x82c1('0x32')]));_0x1d5506['attributes']=_0x1d5506[_0x82c1('0x31')][_0x82c1('0x33')]?_0x1d5506['attributes']:_0x9135[_0x82c1('0x2d')];_0x1d5506[_0x82c1('0x36')]=qs[_0x82c1('0x37')](_0x218a2d[_0x82c1('0x2e')][_0x82c1('0x37')]);_0x1d5506[_0x82c1('0x38')]=qs[_0x82c1('0x30')](_[_0x82c1('0x47')](_0x218a2d['query'],_0x9135[_0x82c1('0x30')]));if(_0x218a2d[_0x82c1('0x2e')][_0x82c1('0x3b')]){_0x1d5506[_0x82c1('0x38')]=_['merge'](_0x1d5506[_0x82c1('0x38')],{'$or':_[_0x82c1('0x27')](_0x1d5506['attributes'],function(_0x108dcc){var _0x5ac8c7={};_0x5ac8c7[_0x108dcc]={'$like':'%'+_0x218a2d[_0x82c1('0x2e')][_0x82c1('0x3b')]+'%'};return _0x5ac8c7;})});}_0x1d5506=_[_0x82c1('0x39')]({},_0x1d5506,_0x218a2d[_0x82c1('0x48')]);return _0x52ef24[_0x82c1('0x4d')](_0x1d5506);}})['then'](function(_0x2d35e0){if(_0x2d35e0){_0xcd6b7c=_0x2d35e0['length'];if(!_0x218a2d[_0x82c1('0x2e')][_0x82c1('0x34')](_0x82c1('0x35'))){_0x1d5506[_0x82c1('0x1f')]=qs[_0x82c1('0x1f')](_0x218a2d[_0x82c1('0x2e')]['limit']);_0x1d5506[_0x82c1('0x1e')]=qs[_0x82c1('0x1e')](_0x218a2d[_0x82c1('0x2e')][_0x82c1('0x1e')]);}return _0x52ef24[_0x82c1('0x4d')](_0x1d5506);}})[_0x82c1('0x22')](function(_0x345d68){if(_0x345d68){return _0x345d68?{'count':_0xcd6b7c,'rows':_0x345d68}:null;}})[_0x82c1('0x22')](respondWithResult(_0x740c48,null))[_0x82c1('0x3f')](handleError(_0x740c48,null));};exports['setTags']=function(_0xda7f10,_0x1c57a4,_0x568cef){if(_0xda7f10[_0x82c1('0x44')]['id']){delete _0xda7f10['body']['id'];}return db['FreshdeskConfiguration'][_0x82c1('0x46')]({'where':{'id':_0xda7f10[_0x82c1('0x40')]['id']}})[_0x82c1('0x22')](handleEntityNotFound(_0x1c57a4,null))[_0x82c1('0x22')](function(_0x99b6e0){if(_0x99b6e0){return _0x99b6e0['setTags'](_0xda7f10['body'][_0x82c1('0x4e')]||[]);}return null;})[_0x82c1('0x22')](respondWithResult(_0x1c57a4,null))[_0x82c1('0x3f')](handleError(_0x1c57a4,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index d9e48f1..5bb6541 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 _0x6060=['lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x36628b,_0x9e370a){var _0x5680fe=function(_0x5605e5){while(--_0x5605e5){_0x36628b['push'](_0x36628b['shift']());}};_0x5680fe(++_0x9e370a);}(_0x6060,0x122));var _0x0606=function(_0x48ac58,_0x27efe2){_0x48ac58=_0x48ac58-0x0;var _0x560abc=_0x6060[_0x48ac58];return _0x560abc;};'use strict';var _=require(_0x0606('0x0'));var util=require('util');var logger=require(_0x0606('0x1'))(_0x0606('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0606('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0606('0x4'));var config=require(_0x0606('0x5'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x0606('0x6')]=function(_0x4d8976,_0x4f20b7){return _0x4d8976[_0x0606('0x7')](_0x0606('0x8'),attributes,{'tableName':_0x0606('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5cf=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x1f4516,_0x38614b){var _0x16dfec=function(_0x534bf0){while(--_0x534bf0){_0x1f4516['push'](_0x1f4516['shift']());}};_0x16dfec(++_0x38614b);}(_0xb5cf,0xb5));var _0xfb5c=function(_0x3e7478,_0x1b80bf){_0x3e7478=_0x3e7478-0x0;var _0x36b779=_0xb5cf[_0x3e7478];return _0x36b779;};'use strict';var _=require('lodash');var util=require(_0xfb5c('0x0'));var logger=require('../../config/logger')(_0xfb5c('0x1'));var moment=require(_0xfb5c('0x2'));var BPromise=require(_0xfb5c('0x3'));var rp=require(_0xfb5c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb5c('0x5'));var config=require('../../config/environment');var attributes=require(_0xfb5c('0x6'));module[_0xfb5c('0x7')]=function(_0x38db93,_0x461414){return _0x38db93[_0xfb5c('0x8')](_0xfb5c('0x9'),attributes,{'tableName':_0xfb5c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index f6dd99b..c21ce66 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 _0xa19b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x41ba6d,_0x341805){var _0x52ac82=function(_0x18401d){while(--_0x18401d){_0x41ba6d['push'](_0x41ba6d['shift']());}};_0x52ac82(++_0x341805);}(_0xa19b,0xeb));var _0xba19=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa19b[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xba19('0x0'));var util=require('util');var moment=require(_0xba19('0x1'));var BPromise=require(_0xba19('0x2'));var rs=require(_0xba19('0x3'));var fs=require('fs');var Redis=require(_0xba19('0x4'));var db=require(_0xba19('0x5'))['db'];var utils=require(_0xba19('0x6'));var logger=require(_0xba19('0x7'))(_0xba19('0x8'));var config=require(_0xba19('0x9'));var jayson=require(_0xba19('0xa'));var client=jayson['client'][_0xba19('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d65a2,_0x5c0e69,_0x119f0d){return new BPromise(function(_0x5cef12,_0x29118a){return client['request'](_0x1d65a2,_0x119f0d)[_0xba19('0xc')](function(_0x2c3e82){logger[_0xba19('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5c0e69,'request\x20sent');logger[_0xba19('0xe')](_0xba19('0xf'),_0x5c0e69,_0xba19('0x10'),JSON[_0xba19('0x11')](_0x2c3e82));if(_0x2c3e82[_0xba19('0x12')]){if(_0x2c3e82['error'][_0xba19('0x13')]===0x1f4){logger[_0xba19('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5c0e69,_0x2c3e82[_0xba19('0x12')][_0xba19('0x14')]);return _0x29118a(_0x2c3e82['error'][_0xba19('0x14')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x5c0e69,_0x2c3e82['error'][_0xba19('0x14')]);return _0x5cef12(_0x2c3e82['error']['message']);}else{logger['info'](_0xba19('0x15'),_0x5c0e69,_0xba19('0x10'));_0x5cef12(_0x2c3e82[_0xba19('0x16')]['message']);}})[_0xba19('0x17')](function(_0x125715){logger[_0xba19('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5c0e69,_0x125715);_0x29118a(_0x125715);});});} \ No newline at end of file +var _0x6a96=['error','message','info','request\x20sent','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x54bec9,_0x5ea931){var _0x26187f=function(_0x496f3b){while(--_0x496f3b){_0x54bec9['push'](_0x54bec9['shift']());}};_0x26187f(++_0x5ea931);}(_0x6a96,0xcd));var _0x66a9=function(_0x28089e,_0x530f8a){_0x28089e=_0x28089e-0x0;var _0x46a73c=_0x6a96[_0x28089e];return _0x46a73c;};'use strict';var _=require(_0x66a9('0x0'));var util=require('util');var moment=require(_0x66a9('0x1'));var BPromise=require(_0x66a9('0x2'));var rs=require(_0x66a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x66a9('0x5'))(_0x66a9('0x6'));var config=require('../../config/environment');var jayson=require(_0x66a9('0x7'));var client=jayson[_0x66a9('0x8')][_0x66a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e6bbc,_0x2219cc,_0x1d260d){return new BPromise(function(_0x4871a2,_0x2c362a){return client[_0x66a9('0xa')](_0x5e6bbc,_0x1d260d)[_0x66a9('0xb')](function(_0x3a6ac9){logger['info'](_0x66a9('0xc'),_0x2219cc,'request\x20sent');logger['debug'](_0x66a9('0xd'),_0x2219cc,'request\x20sent',JSON[_0x66a9('0xe')](_0x3a6ac9));if(_0x3a6ac9['error']){if(_0x3a6ac9[_0x66a9('0xf')]['code']===0x1f4){logger[_0x66a9('0xf')](_0x66a9('0xc'),_0x2219cc,_0x3a6ac9['error'][_0x66a9('0x10')]);return _0x2c362a(_0x3a6ac9[_0x66a9('0xf')][_0x66a9('0x10')]);}logger[_0x66a9('0xf')](_0x66a9('0xc'),_0x2219cc,_0x3a6ac9[_0x66a9('0xf')][_0x66a9('0x10')]);return _0x4871a2(_0x3a6ac9[_0x66a9('0xf')][_0x66a9('0x10')]);}else{logger[_0x66a9('0x11')](_0x66a9('0xc'),_0x2219cc,_0x66a9('0x12'));_0x4871a2(_0x3a6ac9['result'][_0x66a9('0x10')]);}})[_0x66a9('0x13')](function(_0x418d62){logger['error'](_0x66a9('0xc'),_0x2219cc,_0x418d62);_0x2c362a(_0x418d62);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 2b21ed5..077f907 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 _0x43fe=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x3c280f,_0x1232c3){var _0x29ab1b=function(_0x5e7dc9){while(--_0x5e7dc9){_0x3c280f['push'](_0x3c280f['shift']());}};_0x29ab1b(++_0x1232c3);}(_0x43fe,0x12c));var _0xe43f=function(_0x511d36,_0x5beb3e){_0x511d36=_0x511d36-0x0;var _0x4ca36e=_0x43fe[_0x511d36];return _0x4ca36e;};'use strict';var multer=require('multer');var util=require(_0xe43f('0x0'));var path=require(_0xe43f('0x1'));var timeout=require(_0xe43f('0x2'));var express=require(_0xe43f('0x3'));var router=express[_0xe43f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe43f('0x5'));var interaction=require(_0xe43f('0x6'));var config=require(_0xe43f('0x7'));var controller=require(_0xe43f('0x8'));router[_0xe43f('0x9')]('/',auth[_0xe43f('0xa')](),controller[_0xe43f('0xb')]);router[_0xe43f('0x9')](_0xe43f('0xc'),auth[_0xe43f('0xa')](),controller[_0xe43f('0xd')]);router['post']('/',auth[_0xe43f('0xa')](),controller[_0xe43f('0xe')]);router[_0xe43f('0xf')](_0xe43f('0xc'),auth[_0xe43f('0xa')](),controller[_0xe43f('0x10')]);router[_0xe43f('0x11')](_0xe43f('0xc'),auth[_0xe43f('0xa')](),controller[_0xe43f('0x12')]);module[_0xe43f('0x13')]=router; \ No newline at end of file +var _0xfaae=['util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x5594c4,_0xa78bce){var _0x45b1e1=function(_0x945999){while(--_0x945999){_0x5594c4['push'](_0x5594c4['shift']());}};_0x45b1e1(++_0xa78bce);}(_0xfaae,0x71));var _0xefaa=function(_0x31dab2,_0x1857ac){_0x31dab2=_0x31dab2-0x0;var _0x1b0bf2=_0xfaae[_0x31dab2];return _0x1b0bf2;};'use strict';var multer=require(_0xefaa('0x0'));var util=require(_0xefaa('0x1'));var path=require(_0xefaa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xefaa('0x3')]();var fs_extra=require(_0xefaa('0x4'));var auth=require(_0xefaa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xefaa('0x6'));var controller=require(_0xefaa('0x7'));router[_0xefaa('0x8')]('/',auth[_0xefaa('0x9')](),controller[_0xefaa('0xa')]);router[_0xefaa('0x8')](_0xefaa('0xb'),auth['isAuthenticated'](),controller[_0xefaa('0xc')]);router[_0xefaa('0xd')]('/',auth[_0xefaa('0x9')](),controller[_0xefaa('0xe')]);router[_0xefaa('0xf')](_0xefaa('0xb'),auth['isAuthenticated'](),controller[_0xefaa('0x10')]);router['delete'](_0xefaa('0xb'),auth[_0xefaa('0x9')](),controller[_0xefaa('0x11')]);module[_0xefaa('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index a89d3ee..d4541a9 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 _0x3baf=['sequelize','exports','ENUM','customVariable','keyValue','picklist','string','STRING','variable','BOOLEAN'];(function(_0x2caca6,_0xe0d7e9){var _0xa5842f=function(_0x1258e3){while(--_0x1258e3){_0x2caca6['push'](_0x2caca6['shift']());}};_0xa5842f(++_0xe0d7e9);}(_0x3baf,0x1b8));var _0xf3ba=function(_0x18c44d,_0x33976d){_0x18c44d=_0x18c44d-0x0;var _0x71abcf=_0x3baf[_0x18c44d];return _0x71abcf;};'use strict';var Sequelize=require(_0xf3ba('0x0'));module[_0xf3ba('0x1')]={'type':{'type':Sequelize[_0xf3ba('0x2')]('string','variable',_0xf3ba('0x3'),_0xf3ba('0x4'),_0xf3ba('0x5')),'defaultValue':_0xf3ba('0x6')},'content':{'type':Sequelize[_0xf3ba('0x7')]},'key':{'type':Sequelize[_0xf3ba('0x7')]},'keyType':{'type':Sequelize[_0xf3ba('0x2')](_0xf3ba('0x6'),_0xf3ba('0x8'),_0xf3ba('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf3ba('0x7')]},'customField':{'type':Sequelize[_0xf3ba('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf3ba('0x7')]}}; \ No newline at end of file +var _0x5a68=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x12d985,_0x140349){var _0x17ace0=function(_0x272be9){while(--_0x272be9){_0x12d985['push'](_0x12d985['shift']());}};_0x17ace0(++_0x140349);}(_0x5a68,0x1c3));var _0x85a6=function(_0x3ed914,_0x375055){_0x3ed914=_0x3ed914-0x0;var _0x407444=_0x5a68[_0x3ed914];return _0x407444;};'use strict';var Sequelize=require(_0x85a6('0x0'));module[_0x85a6('0x1')]={'type':{'type':Sequelize[_0x85a6('0x2')](_0x85a6('0x3'),_0x85a6('0x4'),_0x85a6('0x5'),_0x85a6('0x6'),_0x85a6('0x7')),'defaultValue':_0x85a6('0x3')},'content':{'type':Sequelize[_0x85a6('0x8')]},'key':{'type':Sequelize[_0x85a6('0x8')]},'keyType':{'type':Sequelize[_0x85a6('0x2')](_0x85a6('0x3'),_0x85a6('0x4'),_0x85a6('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x85a6('0x8')]},'nameField':{'type':Sequelize[_0x85a6('0x8')]},'customField':{'type':Sequelize[_0x85a6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x85a6('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 08f69fe..b3e719b 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 _0xbb53=['include','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','end','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','keys','length'];(function(_0x5777fa,_0x599500){var _0x570e6c=function(_0x3b4e82){while(--_0x3b4e82){_0x5777fa['push'](_0x5777fa['shift']());}};_0x570e6c(++_0x599500);}(_0xbb53,0x121));var _0x3bb5=function(_0x43dbd8,_0x4f70e6){_0x43dbd8=_0x43dbd8-0x0;var _0x4dac4d=_0xbb53[_0x43dbd8];return _0x4dac4d;};'use strict';var emlformat=require(_0x3bb5('0x0'));var rimraf=require(_0x3bb5('0x1'));var zipdir=require(_0x3bb5('0x2'));var jsonpatch=require(_0x3bb5('0x3'));var rp=require(_0x3bb5('0x4'));var moment=require(_0x3bb5('0x5'));var BPromise=require(_0x3bb5('0x6'));var Mustache=require(_0x3bb5('0x7'));var util=require(_0x3bb5('0x8'));var path=require(_0x3bb5('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3bb5('0xa'));var fs=require('fs');var fs_extra=require(_0x3bb5('0xb'));var _=require(_0x3bb5('0xc'));var squel=require(_0x3bb5('0xd'));var crypto=require(_0x3bb5('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3bb5('0xf'));var Papa=require(_0x3bb5('0x10'));var Redis=require(_0x3bb5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3bb5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bb5('0x13'))(_0x3bb5('0x14'));var utils=require('../../config/utils');var config=require(_0x3bb5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bb5('0x16'))['db'];function respondWithStatusCode(_0x511bd8,_0x526bf0){_0x526bf0=_0x526bf0||0xcc;return function(_0x223356){if(_0x223356){return _0x511bd8[_0x3bb5('0x17')](_0x526bf0);}return _0x511bd8[_0x3bb5('0x18')](_0x526bf0)['end']();};}function respondWithResult(_0xd578fc,_0x12e409){_0x12e409=_0x12e409||0xc8;return function(_0x519123){if(_0x519123){return _0xd578fc[_0x3bb5('0x18')](_0x12e409)[_0x3bb5('0x19')](_0x519123);}};}function respondWithFilteredResult(_0x5cec77,_0x5ca99f){return function(_0x50617f){if(_0x50617f){var _0x42ef1b=typeof _0x5ca99f[_0x3bb5('0x1a')]==='undefined'&&typeof _0x5ca99f[_0x3bb5('0x1b')]===_0x3bb5('0x1c');var _0x4656c4=_0x50617f[_0x3bb5('0x1d')];var _0x48bc25=_0x42ef1b?0x0:_0x5ca99f[_0x3bb5('0x1a')];var _0x1109d0=_0x42ef1b?_0x50617f[_0x3bb5('0x1d')]:_0x5ca99f['offset']+_0x5ca99f['limit'];var _0x19b177;if(_0x1109d0>=_0x4656c4){_0x1109d0=_0x4656c4;_0x19b177=0xc8;}else{_0x19b177=0xce;}_0x5cec77[_0x3bb5('0x18')](_0x19b177);return _0x5cec77[_0x3bb5('0x1e')]('Content-Range',_0x48bc25+'-'+_0x1109d0+'/'+_0x4656c4)[_0x3bb5('0x19')](_0x50617f);}return null;};}function patchUpdates(_0x2afe6e){return function(_0x3f94ad){try{jsonpatch[_0x3bb5('0x1f')](_0x3f94ad,_0x2afe6e,!![]);}catch(_0x21a3ff){return BPromise[_0x3bb5('0x20')](_0x21a3ff);}return _0x3f94ad['save']();};}function saveUpdates(_0x37444e,_0x3eae85){return function(_0x438a8d){if(_0x438a8d){return _0x438a8d[_0x3bb5('0x21')](_0x37444e)[_0x3bb5('0x22')](function(_0xfb9e8){return _0xfb9e8;});}return null;};}function removeEntity(_0x341a3f,_0x58c10f){return function(_0x1d2a24){if(_0x1d2a24){return _0x1d2a24[_0x3bb5('0x23')]()['then'](function(){_0x341a3f['status'](0xcc)[_0x3bb5('0x24')]();});}};}function handleEntityNotFound(_0x36cfda,_0x58acdb){return function(_0x483689){if(!_0x483689){_0x36cfda[_0x3bb5('0x17')](0x194);}return _0x483689;};}function handleError(_0x77a60f,_0x2fc543){_0x2fc543=_0x2fc543||0x1f4;return function(_0xc1c149){logger['error'](_0xc1c149['stack']);if(_0xc1c149[_0x3bb5('0x25')]){delete _0xc1c149['name'];}_0x77a60f[_0x3bb5('0x18')](_0x2fc543)[_0x3bb5('0x26')](_0xc1c149);};}exports[_0x3bb5('0x27')]=function(_0x534b15,_0x5f40ac){var _0x19e61d={},_0x39f1ad={},_0x17ada7={'count':0x0,'rows':[]};var _0x18304c=_[_0x3bb5('0x28')](db[_0x3bb5('0x29')][_0x3bb5('0x2a')],function(_0x5ce225){return{'name':_0x5ce225[_0x3bb5('0x2b')],'type':_0x5ce225[_0x3bb5('0x2c')][_0x3bb5('0x2d')]};});_0x39f1ad[_0x3bb5('0x2e')]=_[_0x3bb5('0x28')](_0x18304c,_0x3bb5('0x25'));_0x39f1ad[_0x3bb5('0x2f')]=_['keys'](_0x534b15[_0x3bb5('0x2f')]);_0x39f1ad[_0x3bb5('0x30')]=_['intersection'](_0x39f1ad[_0x3bb5('0x2e')],_0x39f1ad[_0x3bb5('0x2f')]);_0x19e61d[_0x3bb5('0x31')]=_[_0x3bb5('0x32')](_0x39f1ad[_0x3bb5('0x2e')],qs['fields'](_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x33')]));_0x19e61d[_0x3bb5('0x31')]=_0x19e61d[_0x3bb5('0x31')]['length']?_0x19e61d['attributes']:_0x39f1ad[_0x3bb5('0x2e')];if(!_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x34')](_0x3bb5('0x35'))){_0x19e61d[_0x3bb5('0x1b')]=qs[_0x3bb5('0x1b')](_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x1b')]);_0x19e61d[_0x3bb5('0x1a')]=qs['offset'](_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x1a')]);}_0x19e61d['order']=qs['sort'](_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x36')]);_0x19e61d[_0x3bb5('0x37')]=qs[_0x3bb5('0x30')](_['pick'](_0x534b15['query'],_0x39f1ad[_0x3bb5('0x30')]),_0x18304c);if(_0x534b15['query'][_0x3bb5('0x38')]){_0x19e61d['where']=_['merge'](_0x19e61d[_0x3bb5('0x37')],{'$or':_['map'](_0x18304c,function(_0x5edb47){if(_0x5edb47[_0x3bb5('0x2c')]!==_0x3bb5('0x39')){var _0x1384cd={};_0x1384cd[_0x5edb47['name']]={'$like':'%'+_0x534b15[_0x3bb5('0x2f')]['filter']+'%'};return _0x1384cd;}})});}_0x19e61d=_[_0x3bb5('0x3a')]({},_0x19e61d,_0x534b15['options']);var _0x235e3={'where':_0x19e61d[_0x3bb5('0x37')]};return db[_0x3bb5('0x29')][_0x3bb5('0x1d')](_0x235e3)[_0x3bb5('0x22')](function(_0x261d7b){_0x17ada7['count']=_0x261d7b;if(_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x3b')]){_0x19e61d['include']=[{'all':!![]}];}return db[_0x3bb5('0x29')][_0x3bb5('0x3c')](_0x19e61d);})[_0x3bb5('0x22')](function(_0x5cfb72){_0x17ada7[_0x3bb5('0x3d')]=_0x5cfb72;return _0x17ada7;})[_0x3bb5('0x22')](respondWithFilteredResult(_0x5f40ac,_0x19e61d))['catch'](handleError(_0x5f40ac,null));};exports[_0x3bb5('0x3e')]=function(_0x40da23,_0x7a294e){var _0x2291e9={'raw':!![],'where':{'id':_0x40da23[_0x3bb5('0x3f')]['id']}},_0x663685={};_0x663685[_0x3bb5('0x2e')]=_[_0x3bb5('0x40')](db[_0x3bb5('0x29')][_0x3bb5('0x2a')]);_0x663685[_0x3bb5('0x2f')]=_[_0x3bb5('0x40')](_0x40da23[_0x3bb5('0x2f')]);_0x663685[_0x3bb5('0x30')]=_['intersection'](_0x663685[_0x3bb5('0x2e')],_0x663685[_0x3bb5('0x2f')]);_0x2291e9['attributes']=_['intersection'](_0x663685[_0x3bb5('0x2e')],qs[_0x3bb5('0x33')](_0x40da23[_0x3bb5('0x2f')][_0x3bb5('0x33')]));_0x2291e9[_0x3bb5('0x31')]=_0x2291e9[_0x3bb5('0x31')][_0x3bb5('0x41')]?_0x2291e9[_0x3bb5('0x31')]:_0x663685['model'];if(_0x40da23['query'][_0x3bb5('0x3b')]){_0x2291e9[_0x3bb5('0x42')]=[{'all':!![]}];}_0x2291e9=_[_0x3bb5('0x3a')]({},_0x2291e9,_0x40da23['options']);return db[_0x3bb5('0x29')]['find'](_0x2291e9)[_0x3bb5('0x22')](handleEntityNotFound(_0x7a294e,null))[_0x3bb5('0x22')](respondWithResult(_0x7a294e,null))[_0x3bb5('0x43')](handleError(_0x7a294e,null));};exports[_0x3bb5('0x44')]=function(_0x11352e,_0x2b7c68){return db['FreshdeskField'][_0x3bb5('0x44')](_0x11352e[_0x3bb5('0x45')],{})['then'](respondWithResult(_0x2b7c68,0xc9))[_0x3bb5('0x43')](handleError(_0x2b7c68,null));};exports[_0x3bb5('0x21')]=function(_0x5075bd,_0x41edf7){if(_0x5075bd[_0x3bb5('0x45')]['id']){delete _0x5075bd[_0x3bb5('0x45')]['id'];}return db[_0x3bb5('0x29')][_0x3bb5('0x46')]({'where':{'id':_0x5075bd['params']['id']}})[_0x3bb5('0x22')](handleEntityNotFound(_0x41edf7,null))[_0x3bb5('0x22')](saveUpdates(_0x5075bd['body'],null))['then'](respondWithResult(_0x41edf7,null))[_0x3bb5('0x43')](handleError(_0x41edf7,null));};exports[_0x3bb5('0x23')]=function(_0x1e5b64,_0x90d5b6){return db[_0x3bb5('0x29')]['find']({'where':{'id':_0x1e5b64[_0x3bb5('0x3f')]['id']}})[_0x3bb5('0x22')](handleEntityNotFound(_0x90d5b6,null))[_0x3bb5('0x22')](removeEntity(_0x90d5b6,null))[_0x3bb5('0x43')](handleError(_0x90d5b6,null));}; \ No newline at end of file +var _0x1306=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','type','VIRTUAL','filter','then','includeAll','include','findAll','rows','show','params','keys','length','options','find','catch','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x1306,0x17a));var _0x6130=function(_0x1dd051,_0x179215){_0x1dd051=_0x1dd051-0x0;var _0x28e3ed=_0x1306[_0x1dd051];return _0x28e3ed;};'use strict';var emlformat=require(_0x6130('0x0'));var rimraf=require(_0x6130('0x1'));var zipdir=require(_0x6130('0x2'));var jsonpatch=require(_0x6130('0x3'));var rp=require(_0x6130('0x4'));var moment=require(_0x6130('0x5'));var BPromise=require(_0x6130('0x6'));var Mustache=require(_0x6130('0x7'));var util=require(_0x6130('0x8'));var path=require(_0x6130('0x9'));var sox=require(_0x6130('0xa'));var csv=require(_0x6130('0xb'));var ejs=require(_0x6130('0xc'));var fs=require('fs');var fs_extra=require(_0x6130('0xd'));var _=require(_0x6130('0xe'));var squel=require(_0x6130('0xf'));var crypto=require(_0x6130('0x10'));var jsforce=require(_0x6130('0x11'));var deskjs=require(_0x6130('0x12'));var toCsv=require(_0x6130('0xb'));var querystring=require(_0x6130('0x13'));var Papa=require(_0x6130('0x14'));var Redis=require(_0x6130('0x15'));var authService=require(_0x6130('0x16'));var qs=require(_0x6130('0x17'));var as=require(_0x6130('0x18'));var hardwareService=require(_0x6130('0x19'));var logger=require(_0x6130('0x1a'))(_0x6130('0x1b'));var utils=require('../../config/utils');var config=require(_0x6130('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x6130('0x1d'))['db'];function respondWithStatusCode(_0x2fbf3d,_0x5e0234){_0x5e0234=_0x5e0234||0xcc;return function(_0x1c0339){if(_0x1c0339){return _0x2fbf3d[_0x6130('0x1e')](_0x5e0234);}return _0x2fbf3d[_0x6130('0x1f')](_0x5e0234)[_0x6130('0x20')]();};}function respondWithResult(_0x1d736c,_0x3470e8){_0x3470e8=_0x3470e8||0xc8;return function(_0x4cdac6){if(_0x4cdac6){return _0x1d736c[_0x6130('0x1f')](_0x3470e8)[_0x6130('0x21')](_0x4cdac6);}};}function respondWithFilteredResult(_0x3ef4c1,_0x401a70){return function(_0x4626a2){if(_0x4626a2){var _0x39b444=typeof _0x401a70[_0x6130('0x22')]===_0x6130('0x23')&&typeof _0x401a70[_0x6130('0x24')]==='undefined';var _0x4b9a20=_0x4626a2[_0x6130('0x25')];var _0x49803e=_0x39b444?0x0:_0x401a70[_0x6130('0x22')];var _0xb6575d=_0x39b444?_0x4626a2[_0x6130('0x25')]:_0x401a70[_0x6130('0x22')]+_0x401a70[_0x6130('0x24')];var _0x4b4b35;if(_0xb6575d>=_0x4b9a20){_0xb6575d=_0x4b9a20;_0x4b4b35=0xc8;}else{_0x4b4b35=0xce;}_0x3ef4c1[_0x6130('0x1f')](_0x4b4b35);return _0x3ef4c1['set'](_0x6130('0x26'),_0x49803e+'-'+_0xb6575d+'/'+_0x4b9a20)[_0x6130('0x21')](_0x4626a2);}return null;};}function patchUpdates(_0x18bb78){return function(_0x1839db){try{jsonpatch[_0x6130('0x27')](_0x1839db,_0x18bb78,!![]);}catch(_0x5c8b08){return BPromise['reject'](_0x5c8b08);}return _0x1839db[_0x6130('0x28')]();};}function saveUpdates(_0x534390,_0x30b4f2){return function(_0x289c7b){if(_0x289c7b){return _0x289c7b['update'](_0x534390)['then'](function(_0x54fc67){return _0x54fc67;});}return null;};}function removeEntity(_0x2a8aad,_0x5369e3){return function(_0x371b84){if(_0x371b84){return _0x371b84['destroy']()['then'](function(){_0x2a8aad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5069bf,_0x140468){return function(_0x1ba07d){if(!_0x1ba07d){_0x5069bf['sendStatus'](0x194);}return _0x1ba07d;};}function handleError(_0x188657,_0x552c54){_0x552c54=_0x552c54||0x1f4;return function(_0x306935){logger['error'](_0x306935['stack']);if(_0x306935[_0x6130('0x29')]){delete _0x306935[_0x6130('0x29')];}_0x188657[_0x6130('0x1f')](_0x552c54)[_0x6130('0x2a')](_0x306935);};}exports[_0x6130('0x2b')]=function(_0x392386,_0x2aa0e3){var _0x19eb47={},_0x14dff0={},_0x5809e4={'count':0x0,'rows':[]};var _0x5363cc=_[_0x6130('0x2c')](db[_0x6130('0x2d')][_0x6130('0x2e')],function(_0x4345ac){return{'name':_0x4345ac[_0x6130('0x2f')],'type':_0x4345ac['type'][_0x6130('0x30')]};});_0x14dff0[_0x6130('0x31')]=_[_0x6130('0x2c')](_0x5363cc,_0x6130('0x29'));_0x14dff0[_0x6130('0x32')]=_['keys'](_0x392386[_0x6130('0x32')]);_0x14dff0[_0x6130('0x33')]=_[_0x6130('0x34')](_0x14dff0['model'],_0x14dff0[_0x6130('0x32')]);_0x19eb47[_0x6130('0x35')]=_[_0x6130('0x34')](_0x14dff0[_0x6130('0x31')],qs[_0x6130('0x36')](_0x392386[_0x6130('0x32')][_0x6130('0x36')]));_0x19eb47[_0x6130('0x35')]=_0x19eb47[_0x6130('0x35')]['length']?_0x19eb47[_0x6130('0x35')]:_0x14dff0['model'];if(!_0x392386['query']['hasOwnProperty'](_0x6130('0x37'))){_0x19eb47[_0x6130('0x24')]=qs[_0x6130('0x24')](_0x392386[_0x6130('0x32')][_0x6130('0x24')]);_0x19eb47[_0x6130('0x22')]=qs[_0x6130('0x22')](_0x392386[_0x6130('0x32')]['offset']);}_0x19eb47[_0x6130('0x38')]=qs[_0x6130('0x39')](_0x392386['query'][_0x6130('0x39')]);_0x19eb47[_0x6130('0x3a')]=qs[_0x6130('0x33')](_['pick'](_0x392386[_0x6130('0x32')],_0x14dff0[_0x6130('0x33')]),_0x5363cc);if(_0x392386['query']['filter']){_0x19eb47[_0x6130('0x3a')]=_[_0x6130('0x3b')](_0x19eb47[_0x6130('0x3a')],{'$or':_['map'](_0x5363cc,function(_0x596c98){if(_0x596c98[_0x6130('0x3c')]!==_0x6130('0x3d')){var _0x3c6aac={};_0x3c6aac[_0x596c98[_0x6130('0x29')]]={'$like':'%'+_0x392386[_0x6130('0x32')][_0x6130('0x3e')]+'%'};return _0x3c6aac;}})});}_0x19eb47=_[_0x6130('0x3b')]({},_0x19eb47,_0x392386['options']);var _0x45bfe0={'where':_0x19eb47[_0x6130('0x3a')]};return db[_0x6130('0x2d')][_0x6130('0x25')](_0x45bfe0)[_0x6130('0x3f')](function(_0x3249f2){_0x5809e4[_0x6130('0x25')]=_0x3249f2;if(_0x392386['query'][_0x6130('0x40')]){_0x19eb47[_0x6130('0x41')]=[{'all':!![]}];}return db[_0x6130('0x2d')][_0x6130('0x42')](_0x19eb47);})[_0x6130('0x3f')](function(_0x142385){_0x5809e4[_0x6130('0x43')]=_0x142385;return _0x5809e4;})[_0x6130('0x3f')](respondWithFilteredResult(_0x2aa0e3,_0x19eb47))['catch'](handleError(_0x2aa0e3,null));};exports[_0x6130('0x44')]=function(_0x154891,_0x6eebc6){var _0x4c727b={'raw':!![],'where':{'id':_0x154891[_0x6130('0x45')]['id']}},_0x176506={};_0x176506[_0x6130('0x31')]=_['keys'](db['FreshdeskField'][_0x6130('0x2e')]);_0x176506[_0x6130('0x32')]=_[_0x6130('0x46')](_0x154891[_0x6130('0x32')]);_0x176506[_0x6130('0x33')]=_['intersection'](_0x176506[_0x6130('0x31')],_0x176506[_0x6130('0x32')]);_0x4c727b['attributes']=_[_0x6130('0x34')](_0x176506[_0x6130('0x31')],qs[_0x6130('0x36')](_0x154891[_0x6130('0x32')][_0x6130('0x36')]));_0x4c727b[_0x6130('0x35')]=_0x4c727b[_0x6130('0x35')][_0x6130('0x47')]?_0x4c727b['attributes']:_0x176506['model'];if(_0x154891[_0x6130('0x32')]['includeAll']){_0x4c727b[_0x6130('0x41')]=[{'all':!![]}];}_0x4c727b=_[_0x6130('0x3b')]({},_0x4c727b,_0x154891[_0x6130('0x48')]);return db[_0x6130('0x2d')][_0x6130('0x49')](_0x4c727b)[_0x6130('0x3f')](handleEntityNotFound(_0x6eebc6,null))[_0x6130('0x3f')](respondWithResult(_0x6eebc6,null))[_0x6130('0x4a')](handleError(_0x6eebc6,null));};exports[_0x6130('0x4b')]=function(_0x19dcb7,_0x3936a8){return db['FreshdeskField'][_0x6130('0x4b')](_0x19dcb7[_0x6130('0x4c')],{})[_0x6130('0x3f')](respondWithResult(_0x3936a8,0xc9))[_0x6130('0x4a')](handleError(_0x3936a8,null));};exports[_0x6130('0x4d')]=function(_0x13f591,_0x35939b){if(_0x13f591[_0x6130('0x4c')]['id']){delete _0x13f591[_0x6130('0x4c')]['id'];}return db[_0x6130('0x2d')]['find']({'where':{'id':_0x13f591[_0x6130('0x45')]['id']}})[_0x6130('0x3f')](handleEntityNotFound(_0x35939b,null))[_0x6130('0x3f')](saveUpdates(_0x13f591[_0x6130('0x4c')],null))[_0x6130('0x3f')](respondWithResult(_0x35939b,null))[_0x6130('0x4a')](handleError(_0x35939b,null));};exports[_0x6130('0x4e')]=function(_0x37ee0c,_0x3a64ef){return db['FreshdeskField'][_0x6130('0x49')]({'where':{'id':_0x37ee0c[_0x6130('0x45')]['id']}})[_0x6130('0x3f')](handleEntityNotFound(_0x3a64ef,null))[_0x6130('0x3f')](removeEntity(_0x3a64ef,null))[_0x6130('0x4a')](handleError(_0x3a64ef,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index bb639d0..15eeb47 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 _0xd0db=['FreshdeskField','freshdesk_unique_index','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd0db,0x7c));var _0xbd0d=function(_0x2e65cc,_0x44316e){_0x2e65cc=_0x2e65cc-0x0;var _0x53b68e=_0xd0db[_0x2e65cc];return _0x53b68e;};'use strict';var _=require('lodash');var util=require(_0xbd0d('0x0'));var logger=require(_0xbd0d('0x1'))(_0xbd0d('0x2'));var moment=require('moment');var BPromise=require(_0xbd0d('0x3'));var rp=require(_0xbd0d('0x4'));var fs=require('fs');var path=require(_0xbd0d('0x5'));var rimraf=require(_0xbd0d('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0x54bde6,_0x39549d){return _0x54bde6[_0xbd0d('0x7')](_0xbd0d('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xbd0d('0x9'),'fields':[_0xbd0d('0xa'),_0xbd0d('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0725=['api','moment','request-promise','path','rimraf','./intFreshdeskField.attributes','exports','util'];(function(_0x40bc32,_0x428c83){var _0x2351e3=function(_0x3ba9f0){while(--_0x3ba9f0){_0x40bc32['push'](_0x40bc32['shift']());}};_0x2351e3(++_0x428c83);}(_0x0725,0x167));var _0x5072=function(_0x108292,_0x25d60c){_0x108292=_0x108292-0x0;var _0x1889c1=_0x0725[_0x108292];return _0x1889c1;};'use strict';var _=require('lodash');var util=require(_0x5072('0x0'));var logger=require('../../config/logger')(_0x5072('0x1'));var moment=require(_0x5072('0x2'));var BPromise=require('bluebird');var rp=require(_0x5072('0x3'));var fs=require('fs');var path=require(_0x5072('0x4'));var rimraf=require(_0x5072('0x5'));var config=require('../../config/environment');var attributes=require(_0x5072('0x6'));module[_0x5072('0x7')]=function(_0x1954ea,_0x4a62a0){return _0x1954ea['define']('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index b3a36d6..6fd895c 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 _0x3a0c=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3a0c,0xfa));var _0xc3a0=function(_0x399e71,_0x335f4c){_0x399e71=_0x399e71-0x0;var _0x4c6c03=_0x3a0c[_0x399e71];return _0x4c6c03;};'use strict';var _=require(_0xc3a0('0x0'));var util=require(_0xc3a0('0x1'));var moment=require(_0xc3a0('0x2'));var BPromise=require(_0xc3a0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3a0('0x4'));var db=require(_0xc3a0('0x5'))['db'];var utils=require(_0xc3a0('0x6'));var logger=require('../../config/logger')(_0xc3a0('0x7'));var config=require('../../config/environment');var jayson=require(_0xc3a0('0x8'));var client=jayson['client'][_0xc3a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e8bde,_0x4cc388,_0x222a7b){return new BPromise(function(_0x55898b,_0x5c9a72){return client['request'](_0x4e8bde,_0x222a7b)[_0xc3a0('0xa')](function(_0x4f4732){logger[_0xc3a0('0xb')](_0xc3a0('0xc'),_0x4cc388,_0xc3a0('0xd'));logger[_0xc3a0('0xe')](_0xc3a0('0xf'),_0x4cc388,'request\x20sent',JSON['stringify'](_0x4f4732));if(_0x4f4732[_0xc3a0('0x10')]){if(_0x4f4732[_0xc3a0('0x10')][_0xc3a0('0x11')]===0x1f4){logger[_0xc3a0('0x10')](_0xc3a0('0xc'),_0x4cc388,_0x4f4732['error']['message']);return _0x5c9a72(_0x4f4732['error'][_0xc3a0('0x12')]);}logger['error'](_0xc3a0('0xc'),_0x4cc388,_0x4f4732[_0xc3a0('0x10')][_0xc3a0('0x12')]);return _0x55898b(_0x4f4732[_0xc3a0('0x10')][_0xc3a0('0x12')]);}else{logger['info'](_0xc3a0('0xc'),_0x4cc388,_0xc3a0('0xd'));_0x55898b(_0x4f4732[_0xc3a0('0x13')][_0xc3a0('0x12')]);}})[_0xc3a0('0x14')](function(_0x1dfc2d){logger[_0xc3a0('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x4cc388,_0x1dfc2d);_0x5c9a72(_0x1dfc2d);});});} \ No newline at end of file +var _0xda99=['FreshdeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','error'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xda99,0xaf));var _0x9da9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda99[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9da9('0x0'));var util=require(_0x9da9('0x1'));var moment=require(_0x9da9('0x2'));var BPromise=require(_0x9da9('0x3'));var rs=require(_0x9da9('0x4'));var fs=require('fs');var Redis=require(_0x9da9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9da9('0x6'))(_0x9da9('0x7'));var config=require('../../config/environment');var jayson=require(_0x9da9('0x8'));var client=jayson[_0x9da9('0x9')][_0x9da9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ba80f,_0x52a326,_0x3e615e){return new BPromise(function(_0x851eef,_0x59fb13){return client[_0x9da9('0xb')](_0x1ba80f,_0x3e615e)[_0x9da9('0xc')](function(_0x142648){logger[_0x9da9('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x52a326,'request\x20sent');logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x52a326,'request\x20sent',JSON['stringify'](_0x142648));if(_0x142648[_0x9da9('0xe')]){if(_0x142648[_0x9da9('0xe')]['code']===0x1f4){logger['error'](_0x9da9('0xf'),_0x52a326,_0x142648[_0x9da9('0xe')][_0x9da9('0x10')]);return _0x59fb13(_0x142648['error'][_0x9da9('0x10')]);}logger[_0x9da9('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x52a326,_0x142648[_0x9da9('0xe')][_0x9da9('0x10')]);return _0x851eef(_0x142648[_0x9da9('0xe')][_0x9da9('0x10')]);}else{logger[_0x9da9('0xd')](_0x9da9('0xf'),_0x52a326,'request\x20sent');_0x851eef(_0x142648[_0x9da9('0x11')][_0x9da9('0x10')]);}})[_0x9da9('0x12')](function(_0x1d6cc8){logger[_0x9da9('0xe')](_0x9da9('0xf'),_0x52a326,_0x1d6cc8);_0x59fb13(_0x1d6cc8);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 717ebf7..f46187c 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 _0xe511=['get','index','show','getConfigurations','/:id/fields','isAuthenticated','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller'];(function(_0x4bed08,_0x5cac89){var _0x367f21=function(_0x527247){while(--_0x527247){_0x4bed08['push'](_0x4bed08['shift']());}};_0x367f21(++_0x5cac89);}(_0xe511,0x16f));var _0x1e51=function(_0x3903df,_0x4fae4c){_0x3903df=_0x3903df-0x0;var _0x1a2ac5=_0xe511[_0x3903df];return _0x1a2ac5;};'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')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0x8')](_0x1e51('0xc'),auth[_0x1e51('0xd')](),controller[_0x1e51('0xe')]);router[_0x1e51('0xf')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x10')]);router[_0x1e51('0xf')](_0x1e51('0x11'),auth[_0x1e51('0xd')](),controller[_0x1e51('0x12')]);router[_0x1e51('0x13')]('/:id',auth[_0x1e51('0xd')](),controller[_0x1e51('0x14')]);router[_0x1e51('0x15')](_0x1e51('0x16'),auth[_0x1e51('0xd')](),controller[_0x1e51('0x17')]);module[_0x1e51('0x18')]=router; \ No newline at end of file +var _0xb58b=['Router','fs-extra','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x40edf1,_0x301555){var _0x189930=function(_0xfc1510){while(--_0xfc1510){_0x40edf1['push'](_0x40edf1['shift']());}};_0x189930(++_0x301555);}(_0xb58b,0x1f1));var _0xbb58=function(_0x3996dc,_0x14cc15){_0x3996dc=_0x3996dc-0x0;var _0x3d1267=_0xb58b[_0x3996dc];return _0x3d1267;};'use strict';var multer=require('multer');var util=require(_0xbb58('0x0'));var path=require(_0xbb58('0x1'));var timeout=require(_0xbb58('0x2'));var express=require('express');var router=express[_0xbb58('0x3')]();var fs_extra=require(_0xbb58('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbb58('0x5'));var config=require('../../config/environment');var controller=require(_0xbb58('0x6'));router[_0xbb58('0x7')]('/',auth[_0xbb58('0x8')](),controller['index']);router[_0xbb58('0x7')](_0xbb58('0x9'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xa')]);router[_0xbb58('0x7')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xc')]);router[_0xbb58('0x7')](_0xbb58('0xd'),auth[_0xbb58('0x8')](),controller['getFields']);router[_0xbb58('0xe')]('/',auth['isAuthenticated'](),controller[_0xbb58('0xf')]);router[_0xbb58('0xe')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller['addConfiguration']);router[_0xbb58('0x10')](_0xbb58('0x9'),auth['isAuthenticated'](),controller[_0xbb58('0x11')]);router[_0xbb58('0x12')](_0xbb58('0x9'),auth[_0xbb58('0x8')](),controller[_0xbb58('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index f6e68d4..d436b71 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 _0xd7d1=['sequelize','exports','STRING','username','remoteUri'];(function(_0xf386c8,_0x3108c5){var _0x27dccf=function(_0x3a5dda){while(--_0x3a5dda){_0xf386c8['push'](_0xf386c8['shift']());}};_0x27dccf(++_0x3108c5);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x5ef857,_0x9d834a){_0x5ef857=_0x5ef857-0x0;var _0xe44f41=_0xd7d1[_0x5ef857];return _0xe44f41;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'name':{'type':Sequelize[_0x1d7d('0x2')]},'description':{'type':Sequelize[_0x1d7d('0x2')]},'username':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x3')},'apiKey':{'type':Sequelize[_0x1d7d('0x2')]},'remoteUri':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x4')},'serverUrl':{'type':Sequelize[_0x1d7d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7b84=['sequelize','exports','STRING','username','remoteUri'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x7b84,0x17c));var _0x47b8=function(_0x24dfae,_0x1fd133){_0x24dfae=_0x24dfae-0x0;var _0x161968=_0x7b84[_0x24dfae];return _0x161968;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')]},'description':{'type':Sequelize[_0x47b8('0x2')]},'username':{'type':Sequelize[_0x47b8('0x2')],'unique':_0x47b8('0x3')},'apiKey':{'type':Sequelize[_0x47b8('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x47b8('0x4')},'serverUrl':{'type':Sequelize[_0x47b8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 5b1f94f..0ae69c0 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 _0x92ab=['AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','username','apiKey','remoteUri','slice','substring','lastIndexOf','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration'];(function(_0x478a97,_0x43493d){var _0x359aba=function(_0x391570){while(--_0x391570){_0x478a97['push'](_0x478a97['shift']());}};_0x359aba(++_0x43493d);}(_0x92ab,0x1a3));var _0xb92a=function(_0x94bb67,_0x45c99e){_0x94bb67=_0x94bb67-0x0;var _0x31331a=_0x92ab[_0x94bb67];return _0x31331a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb92a('0x0'));var zipdir=require(_0xb92a('0x1'));var jsonpatch=require(_0xb92a('0x2'));var rp=require(_0xb92a('0x3'));var moment=require('moment');var BPromise=require(_0xb92a('0x4'));var Mustache=require(_0xb92a('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb92a('0x6'));var ejs=require(_0xb92a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb92a('0x8'));var squel=require(_0xb92a('0x9'));var crypto=require(_0xb92a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb92a('0xb'));var toCsv=require(_0xb92a('0x6'));var querystring=require(_0xb92a('0xc'));var Papa=require(_0xb92a('0xd'));var Redis=require(_0xb92a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb92a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb92a('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb92a('0x11'));var licenseUtil=require(_0xb92a('0x12'));var db=require(_0xb92a('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x571368,_0x566a72){_0x566a72=_0x566a72||0xcc;return function(_0xffa734){if(_0xffa734){return _0x571368[_0xb92a('0x14')](_0x566a72);}return _0x571368[_0xb92a('0x15')](_0x566a72)['end']();};}function respondWithResult(_0x5a737c,_0x1892bd){_0x1892bd=_0x1892bd||0xc8;return function(_0x1beaa5){if(_0x1beaa5){return _0x5a737c[_0xb92a('0x15')](_0x1892bd)[_0xb92a('0x16')](_0x1beaa5);}};}function respondWithFilteredResult(_0x49e61e,_0x1b7d7d){return function(_0x10510a){if(_0x10510a){var _0x1cd814=typeof _0x1b7d7d[_0xb92a('0x17')]===_0xb92a('0x18')&&typeof _0x1b7d7d[_0xb92a('0x19')]===_0xb92a('0x18');var _0x5c9b1c=_0x10510a[_0xb92a('0x1a')];var _0x5d140c=_0x1cd814?0x0:_0x1b7d7d[_0xb92a('0x17')];var _0x338729=_0x1cd814?_0x10510a['count']:_0x1b7d7d[_0xb92a('0x17')]+_0x1b7d7d[_0xb92a('0x19')];var _0x36badb;if(_0x338729>=_0x5c9b1c){_0x338729=_0x5c9b1c;_0x36badb=0xc8;}else{_0x36badb=0xce;}_0x49e61e['status'](_0x36badb);return _0x49e61e[_0xb92a('0x1b')](_0xb92a('0x1c'),_0x5d140c+'-'+_0x338729+'/'+_0x5c9b1c)[_0xb92a('0x16')](_0x10510a);}return null;};}function patchUpdates(_0x575f30){return function(_0x38c23e){try{jsonpatch[_0xb92a('0x1d')](_0x38c23e,_0x575f30,!![]);}catch(_0xf53b44){return BPromise[_0xb92a('0x1e')](_0xf53b44);}return _0x38c23e[_0xb92a('0x1f')]();};}function saveUpdates(_0x2a5af3,_0x39f257){return function(_0xee625d){if(_0xee625d){return _0xee625d[_0xb92a('0x20')](_0x2a5af3)[_0xb92a('0x21')](function(_0x53dd1c){return _0x53dd1c;});}return null;};}function removeEntity(_0xba5cdc,_0x26bc10){return function(_0x182c9e){if(_0x182c9e){return _0x182c9e[_0xb92a('0x22')]()[_0xb92a('0x21')](function(){_0xba5cdc['status'](0xcc)[_0xb92a('0x23')]();});}};}function handleEntityNotFound(_0x4c8391,_0x2de3f0){return function(_0x5205ec){if(!_0x5205ec){_0x4c8391[_0xb92a('0x14')](0x194);}return _0x5205ec;};}function handleError(_0x3ad253,_0x4f8c6b){_0x4f8c6b=_0x4f8c6b||0x1f4;return function(_0x3da0e2){logger[_0xb92a('0x24')](_0x3da0e2['stack']);if(_0x3da0e2['name']){delete _0x3da0e2['name'];}_0x3ad253[_0xb92a('0x15')](_0x4f8c6b)[_0xb92a('0x25')](_0x3da0e2);};}exports[_0xb92a('0x26')]=function(_0x2670ad,_0x4e74a5){var _0x377266={},_0x59743a={},_0x42437f={'count':0x0,'rows':[]};var _0x219d32=_[_0xb92a('0x27')](db[_0xb92a('0x28')][_0xb92a('0x29')],function(_0x4c83a8){return{'name':_0x4c83a8[_0xb92a('0x2a')],'type':_0x4c83a8[_0xb92a('0x2b')]['key']};});_0x59743a[_0xb92a('0x2c')]=_[_0xb92a('0x27')](_0x219d32,_0xb92a('0x2d'));_0x59743a[_0xb92a('0x2e')]=_[_0xb92a('0x2f')](_0x2670ad[_0xb92a('0x2e')]);_0x59743a[_0xb92a('0x30')]=_[_0xb92a('0x31')](_0x59743a[_0xb92a('0x2c')],_0x59743a['query']);_0x377266[_0xb92a('0x32')]=_[_0xb92a('0x31')](_0x59743a['model'],qs[_0xb92a('0x33')](_0x2670ad[_0xb92a('0x2e')][_0xb92a('0x33')]));_0x377266[_0xb92a('0x32')]=_0x377266[_0xb92a('0x32')][_0xb92a('0x34')]?_0x377266[_0xb92a('0x32')]:_0x59743a[_0xb92a('0x2c')];if(!_0x2670ad[_0xb92a('0x2e')]['hasOwnProperty'](_0xb92a('0x35'))){_0x377266['limit']=qs[_0xb92a('0x19')](_0x2670ad[_0xb92a('0x2e')][_0xb92a('0x19')]);_0x377266[_0xb92a('0x17')]=qs['offset'](_0x2670ad[_0xb92a('0x2e')][_0xb92a('0x17')]);}_0x377266[_0xb92a('0x36')]=qs['sort'](_0x2670ad[_0xb92a('0x2e')][_0xb92a('0x37')]);_0x377266[_0xb92a('0x38')]=qs[_0xb92a('0x30')](_[_0xb92a('0x39')](_0x2670ad[_0xb92a('0x2e')],_0x59743a[_0xb92a('0x30')]),_0x219d32);if(_0x2670ad[_0xb92a('0x2e')]['filter']){_0x377266[_0xb92a('0x38')]=_[_0xb92a('0x3a')](_0x377266['where'],{'$or':_[_0xb92a('0x27')](_0x219d32,function(_0x33611a){if(_0x33611a[_0xb92a('0x2b')]!==_0xb92a('0x3b')){var _0x38bd09={};_0x38bd09[_0x33611a['name']]={'$like':'%'+_0x2670ad[_0xb92a('0x2e')][_0xb92a('0x3c')]+'%'};return _0x38bd09;}})});}_0x377266=_[_0xb92a('0x3a')]({},_0x377266,_0x2670ad[_0xb92a('0x3d')]);var _0x4168a9={'where':_0x377266[_0xb92a('0x38')]};return db[_0xb92a('0x28')][_0xb92a('0x1a')](_0x4168a9)[_0xb92a('0x21')](function(_0x218d7f){_0x42437f['count']=_0x218d7f;if(_0x2670ad[_0xb92a('0x2e')][_0xb92a('0x3e')]){_0x377266[_0xb92a('0x3f')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xb92a('0x40')](_0x377266);})[_0xb92a('0x21')](function(_0x345cf4){_0x42437f[_0xb92a('0x41')]=_0x345cf4;return _0x42437f;})[_0xb92a('0x21')](respondWithFilteredResult(_0x4e74a5,_0x377266))[_0xb92a('0x42')](handleError(_0x4e74a5,null));};exports[_0xb92a('0x43')]=function(_0x9c5353,_0x59225c){var _0x1f316f={'raw':![],'where':{'id':_0x9c5353['params']['id']}},_0x2f84cd={};_0x2f84cd[_0xb92a('0x2c')]=_['keys'](db[_0xb92a('0x28')][_0xb92a('0x29')]);_0x2f84cd[_0xb92a('0x2e')]=_['keys'](_0x9c5353[_0xb92a('0x2e')]);_0x2f84cd[_0xb92a('0x30')]=_[_0xb92a('0x31')](_0x2f84cd[_0xb92a('0x2c')],_0x2f84cd[_0xb92a('0x2e')]);_0x1f316f[_0xb92a('0x32')]=_[_0xb92a('0x31')](_0x2f84cd[_0xb92a('0x2c')],qs[_0xb92a('0x33')](_0x9c5353[_0xb92a('0x2e')][_0xb92a('0x33')]));_0x1f316f[_0xb92a('0x32')]=_0x1f316f[_0xb92a('0x32')]['length']?_0x1f316f[_0xb92a('0x32')]:_0x2f84cd[_0xb92a('0x2c')];if(_0x9c5353[_0xb92a('0x2e')][_0xb92a('0x3e')]){_0x1f316f['include']=[{'all':!![]}];}_0x1f316f=_[_0xb92a('0x3a')]({},_0x1f316f,_0x9c5353[_0xb92a('0x3d')]);return db[_0xb92a('0x28')][_0xb92a('0x44')](_0x1f316f)[_0xb92a('0x21')](handleEntityNotFound(_0x59225c,null))[_0xb92a('0x21')](respondWithResult(_0x59225c,null))['catch'](handleError(_0x59225c,null));};exports['create']=function(_0x256d72,_0x3fc635){return db[_0xb92a('0x28')][_0xb92a('0x45')](_0x256d72['body'],{})[_0xb92a('0x21')](respondWithResult(_0x3fc635,0xc9))[_0xb92a('0x42')](handleError(_0x3fc635,null));};exports[_0xb92a('0x20')]=function(_0x30a04e,_0x190a70){if(_0x30a04e[_0xb92a('0x46')]['id']){delete _0x30a04e['body']['id'];}return db[_0xb92a('0x28')][_0xb92a('0x44')]({'where':{'id':_0x30a04e[_0xb92a('0x47')]['id']}})[_0xb92a('0x21')](handleEntityNotFound(_0x190a70,null))[_0xb92a('0x21')](saveUpdates(_0x30a04e[_0xb92a('0x46')],null))['then'](respondWithResult(_0x190a70,null))[_0xb92a('0x42')](handleError(_0x190a70,null));};exports['destroy']=function(_0x9c8bb6,_0x1aec21){return db['FreshsalesAccount'][_0xb92a('0x44')]({'where':{'id':_0x9c8bb6[_0xb92a('0x47')]['id']}})['then'](handleEntityNotFound(_0x1aec21,null))[_0xb92a('0x21')](removeEntity(_0x1aec21,null))[_0xb92a('0x42')](handleError(_0x1aec21,null));};exports[_0xb92a('0x48')]=function(_0xfaa289,_0x3470c8,_0x114fd1){var _0x3692c3={};var _0x38d619={};var _0x433041;var _0x431ceb;return db['FreshsalesAccount'][_0xb92a('0x49')]({'where':{'id':_0xfaa289[_0xb92a('0x47')]['id']}})[_0xb92a('0x21')](handleEntityNotFound(_0x3470c8,null))[_0xb92a('0x21')](function(_0x10a670){if(_0x10a670){_0x433041=_0x10a670;_0x38d619[_0xb92a('0x2c')]=_[_0xb92a('0x2f')](db[_0xb92a('0x4a')][_0xb92a('0x29')]);_0x38d619[_0xb92a('0x2e')]=_[_0xb92a('0x2f')](_0xfaa289[_0xb92a('0x2e')]);_0x38d619[_0xb92a('0x30')]=_[_0xb92a('0x31')](_0x38d619[_0xb92a('0x2c')],_0x38d619[_0xb92a('0x2e')]);_0x3692c3[_0xb92a('0x32')]=_['intersection'](_0x38d619[_0xb92a('0x2c')],qs[_0xb92a('0x33')](_0xfaa289[_0xb92a('0x2e')]['fields']));_0x3692c3[_0xb92a('0x32')]=_0x3692c3['attributes'][_0xb92a('0x34')]?_0x3692c3[_0xb92a('0x32')]:_0x38d619[_0xb92a('0x2c')];_0x3692c3[_0xb92a('0x36')]=qs[_0xb92a('0x37')](_0xfaa289[_0xb92a('0x2e')]['sort']);_0x3692c3['where']=qs[_0xb92a('0x30')](_[_0xb92a('0x39')](_0xfaa289[_0xb92a('0x2e')],_0x38d619['filters']));if(_0xfaa289[_0xb92a('0x2e')][_0xb92a('0x3c')]){_0x3692c3[_0xb92a('0x38')]=_['merge'](_0x3692c3[_0xb92a('0x38')],{'$or':_['map'](_0x3692c3[_0xb92a('0x32')],function(_0x5ea5f9){var _0x199f3e={};_0x199f3e[_0x5ea5f9]={'$like':'%'+_0xfaa289[_0xb92a('0x2e')][_0xb92a('0x3c')]+'%'};return _0x199f3e;})});}_0x3692c3=_[_0xb92a('0x3a')]({},_0x3692c3,_0xfaa289[_0xb92a('0x3d')]);return _0x433041[_0xb92a('0x48')](_0x3692c3);}})[_0xb92a('0x21')](function(_0x14560f){if(_0x14560f){_0x431ceb=_0x14560f['length'];if(!_0xfaa289[_0xb92a('0x2e')]['hasOwnProperty']('nolimit')){_0x3692c3[_0xb92a('0x19')]=qs[_0xb92a('0x19')](_0xfaa289['query']['limit']);_0x3692c3[_0xb92a('0x17')]=qs[_0xb92a('0x17')](_0xfaa289[_0xb92a('0x2e')][_0xb92a('0x17')]);}return _0x433041[_0xb92a('0x48')](_0x3692c3);}})[_0xb92a('0x21')](function(_0x12c59a){if(_0x12c59a){return _0x12c59a?{'count':_0x431ceb,'rows':_0x12c59a}:null;}})[_0xb92a('0x21')](respondWithResult(_0x3470c8,null))[_0xb92a('0x42')](handleError(_0x3470c8,null));};exports[_0xb92a('0x4b')]=function(_0x1ce85e,_0x376eef,_0x37e42f){if(_0x1ce85e['body']['id']){delete _0x1ce85e[_0xb92a('0x46')]['id'];}return db[_0xb92a('0x28')][_0xb92a('0x49')]({'where':{'id':_0x1ce85e[_0xb92a('0x47')]['id']}})[_0xb92a('0x21')](handleEntityNotFound(_0x376eef,null))[_0xb92a('0x21')](function(_0x4d7daa){if(_0x4d7daa){_0x1ce85e[_0xb92a('0x46')][_0xb92a('0x4c')]=_0x4d7daa['id'];_0x1ce85e[_0xb92a('0x46')][_0xb92a('0x4d')]=integrations[_0xb92a('0x4e')](_0x1ce85e[_0xb92a('0x46')]['channel'],_0x1ce85e['body'][_0xb92a('0x2b')]);_0x1ce85e['body'][_0xb92a('0x4f')]=integrations[_0xb92a('0x50')](_0x1ce85e['body'][_0xb92a('0x51')],_0x1ce85e[_0xb92a('0x46')][_0xb92a('0x2b')]);return db[_0xb92a('0x4a')][_0xb92a('0x45')](_0x1ce85e[_0xb92a('0x46')],{'include':[{'model':db[_0xb92a('0x52')],'as':'Subjects'},{'model':db[_0xb92a('0x52')],'as':_0xb92a('0x4f')}]});}return null;})['then'](respondWithResult(_0x376eef,null))[_0xb92a('0x42')](handleError(_0x376eef,null));};exports['getFields']=function(_0x4ed6aa,_0x5551f4,_0x1a7e2c){var _0x3517c5='';var _0x593b7e='';return db['FreshsalesAccount'][_0xb92a('0x49')]({'where':{'id':_0x4ed6aa[_0xb92a('0x47')]['id']},'attributes':['id',_0xb92a('0x53'),'remoteUri',_0xb92a('0x54')]})[_0xb92a('0x21')](handleEntityNotFound(_0x5551f4,null))[_0xb92a('0x21')](function(_0x5a7819){if(_0x5a7819){_0x593b7e=_0x5a7819['username'];_0x3517c5=_0x5a7819[_0xb92a('0x55')];var _0x559460=_0x5a7819['remoteUri'][_0xb92a('0x56')](-0x1);if(_0x559460==='/'){_0x3517c5=_0x3517c5[_0xb92a('0x57')](0x0,_0x3517c5[_0xb92a('0x58')](_0x559460));}return rp({'method':'GET','uri':util['format'](_0xb92a('0x59'),_0x3517c5,_0xb92a('0x5a')),'headers':{'Authorization':'Token\x20token='+_0x5a7819[_0xb92a('0x54')]},'json':!![]});}})[_0xb92a('0x21')](function(_0x5d8ae6){if(_0x5d8ae6){var _0x35a83a=_0x5d8ae6[_0xb92a('0x5b')];var _0x241b26=![];var _0x1223da=null;for(_0x1223da=0x0;_0x1223da<_0x35a83a[_0xb92a('0x34')];_0x1223da++){if(_0x35a83a[_0x1223da][_0xb92a('0x5c')]===_0x593b7e){_0x241b26=!![];}}if(_0x241b26){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xb92a('0x5d')});}}})['then'](respondWithResult(_0x5551f4,null))[_0xb92a('0x42')](function(_0x198dd3){var _0x1a6ab7=_0x4ed6aa[_0xb92a('0x2e')][_0xb92a('0x5e')]?0x1f4:_0x198dd3['statusCode']||0x1f4;logger['error'](_0xb92a('0x5f'),_0xb92a('0x60'),_0x1a6ab7,JSON['stringify'](_0x198dd3));delete _0x198dd3[_0xb92a('0x2d')];if(_0x1a6ab7===0x191){_0x1a6ab7=0x190;}_0x5551f4[_0xb92a('0x15')](_0x1a6ab7)[_0xb92a('0x25')](_0x4ed6aa['query'][_0xb92a('0x5e')]?{'message':_0xb92a('0x61'),'statusCode':_0x198dd3[_0xb92a('0x62')]}:_0x198dd3);});}; \ No newline at end of file +var _0x22cf=['catch','show','params','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','nolimit','addConfiguration','AccountId','getSubjects','channel','getDescriptions','FreshsalesField','Subjects','Descriptions','username','apiKey','remoteUri','substring','lastIndexOf','%s%s','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','limit','undefined','count','set','apply','update','then','end','error','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x259d21,_0x3d8c0d){var _0x3bee08=function(_0x5bfbf3){while(--_0x5bfbf3){_0x259d21['push'](_0x259d21['shift']());}};_0x3bee08(++_0x3d8c0d);}(_0x22cf,0x13f));var _0xf22c=function(_0x5b15cd,_0x3da949){_0x5b15cd=_0x5b15cd-0x0;var _0x3a9391=_0x22cf[_0x5b15cd];return _0x3a9391;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf22c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf22c('0x1'));var rp=require(_0xf22c('0x2'));var moment=require('moment');var BPromise=require(_0xf22c('0x3'));var Mustache=require(_0xf22c('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf22c('0x5'));var csv=require(_0xf22c('0x6'));var ejs=require(_0xf22c('0x7'));var fs=require('fs');var fs_extra=require(_0xf22c('0x8'));var _=require(_0xf22c('0x9'));var squel=require(_0xf22c('0xa'));var crypto=require(_0xf22c('0xb'));var jsforce=require(_0xf22c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf22c('0x6'));var querystring=require('querystring');var Papa=require(_0xf22c('0xd'));var Redis=require(_0xf22c('0xe'));var authService=require(_0xf22c('0xf'));var qs=require(_0xf22c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf22c('0x11'));var logger=require(_0xf22c('0x12'))(_0xf22c('0x13'));var utils=require(_0xf22c('0x14'));var config=require(_0xf22c('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3849b3,_0x3c02f0){_0x3c02f0=_0x3c02f0||0xcc;return function(_0x20a8f3){if(_0x20a8f3){return _0x3849b3['sendStatus'](_0x3c02f0);}return _0x3849b3[_0xf22c('0x16')](_0x3c02f0)['end']();};}function respondWithResult(_0x4d2689,_0x11083c){_0x11083c=_0x11083c||0xc8;return function(_0x461772){if(_0x461772){return _0x4d2689[_0xf22c('0x16')](_0x11083c)[_0xf22c('0x17')](_0x461772);}};}function respondWithFilteredResult(_0x3a552f,_0x50536a){return function(_0x5b3625){if(_0x5b3625){var _0x1ad461=typeof _0x50536a['offset']==='undefined'&&typeof _0x50536a[_0xf22c('0x18')]===_0xf22c('0x19');var _0x54f7ff=_0x5b3625[_0xf22c('0x1a')];var _0x573660=_0x1ad461?0x0:_0x50536a['offset'];var _0x2b2405=_0x1ad461?_0x5b3625[_0xf22c('0x1a')]:_0x50536a['offset']+_0x50536a[_0xf22c('0x18')];var _0x221ec0;if(_0x2b2405>=_0x54f7ff){_0x2b2405=_0x54f7ff;_0x221ec0=0xc8;}else{_0x221ec0=0xce;}_0x3a552f[_0xf22c('0x16')](_0x221ec0);return _0x3a552f[_0xf22c('0x1b')]('Content-Range',_0x573660+'-'+_0x2b2405+'/'+_0x54f7ff)[_0xf22c('0x17')](_0x5b3625);}return null;};}function patchUpdates(_0xac8648){return function(_0x5c3ecc){try{jsonpatch[_0xf22c('0x1c')](_0x5c3ecc,_0xac8648,!![]);}catch(_0x347e2f){return BPromise['reject'](_0x347e2f);}return _0x5c3ecc['save']();};}function saveUpdates(_0x114213,_0x58e934){return function(_0x339184){if(_0x339184){return _0x339184[_0xf22c('0x1d')](_0x114213)[_0xf22c('0x1e')](function(_0x38c5dd){return _0x38c5dd;});}return null;};}function removeEntity(_0x147f85,_0x1dbb3e){return function(_0x4047bf){if(_0x4047bf){return _0x4047bf['destroy']()[_0xf22c('0x1e')](function(){_0x147f85['status'](0xcc)[_0xf22c('0x1f')]();});}};}function handleEntityNotFound(_0x5f1322,_0x4159a4){return function(_0x4be8c3){if(!_0x4be8c3){_0x5f1322['sendStatus'](0x194);}return _0x4be8c3;};}function handleError(_0x2015fe,_0x46297a){_0x46297a=_0x46297a||0x1f4;return function(_0x24504f){logger[_0xf22c('0x20')](_0x24504f['stack']);if(_0x24504f['name']){delete _0x24504f[_0xf22c('0x21')];}_0x2015fe[_0xf22c('0x16')](_0x46297a)[_0xf22c('0x22')](_0x24504f);};}exports['index']=function(_0x5004a7,_0x14016e){var _0x1dbfca={},_0x2a5e56={},_0x171846={'count':0x0,'rows':[]};var _0x124854=_[_0xf22c('0x23')](db[_0xf22c('0x24')][_0xf22c('0x25')],function(_0x26c8df){return{'name':_0x26c8df[_0xf22c('0x26')],'type':_0x26c8df[_0xf22c('0x27')]['key']};});_0x2a5e56[_0xf22c('0x28')]=_[_0xf22c('0x23')](_0x124854,_0xf22c('0x21'));_0x2a5e56[_0xf22c('0x29')]=_[_0xf22c('0x2a')](_0x5004a7[_0xf22c('0x29')]);_0x2a5e56[_0xf22c('0x2b')]=_[_0xf22c('0x2c')](_0x2a5e56[_0xf22c('0x28')],_0x2a5e56['query']);_0x1dbfca[_0xf22c('0x2d')]=_['intersection'](_0x2a5e56['model'],qs[_0xf22c('0x2e')](_0x5004a7[_0xf22c('0x29')]['fields']));_0x1dbfca[_0xf22c('0x2d')]=_0x1dbfca[_0xf22c('0x2d')][_0xf22c('0x2f')]?_0x1dbfca[_0xf22c('0x2d')]:_0x2a5e56[_0xf22c('0x28')];if(!_0x5004a7[_0xf22c('0x29')][_0xf22c('0x30')]('nolimit')){_0x1dbfca['limit']=qs[_0xf22c('0x18')](_0x5004a7['query'][_0xf22c('0x18')]);_0x1dbfca[_0xf22c('0x31')]=qs[_0xf22c('0x31')](_0x5004a7['query'][_0xf22c('0x31')]);}_0x1dbfca[_0xf22c('0x32')]=qs['sort'](_0x5004a7[_0xf22c('0x29')][_0xf22c('0x33')]);_0x1dbfca[_0xf22c('0x34')]=qs[_0xf22c('0x2b')](_[_0xf22c('0x35')](_0x5004a7[_0xf22c('0x29')],_0x2a5e56[_0xf22c('0x2b')]),_0x124854);if(_0x5004a7[_0xf22c('0x29')][_0xf22c('0x36')]){_0x1dbfca[_0xf22c('0x34')]=_[_0xf22c('0x37')](_0x1dbfca[_0xf22c('0x34')],{'$or':_[_0xf22c('0x23')](_0x124854,function(_0x4d2ef9){if(_0x4d2ef9[_0xf22c('0x27')]!=='VIRTUAL'){var _0x2e9e3a={};_0x2e9e3a[_0x4d2ef9[_0xf22c('0x21')]]={'$like':'%'+_0x5004a7[_0xf22c('0x29')]['filter']+'%'};return _0x2e9e3a;}})});}_0x1dbfca=_[_0xf22c('0x37')]({},_0x1dbfca,_0x5004a7[_0xf22c('0x38')]);var _0x208737={'where':_0x1dbfca[_0xf22c('0x34')]};return db[_0xf22c('0x24')][_0xf22c('0x1a')](_0x208737)['then'](function(_0x265303){_0x171846[_0xf22c('0x1a')]=_0x265303;if(_0x5004a7['query'][_0xf22c('0x39')]){_0x1dbfca[_0xf22c('0x3a')]=[{'all':!![]}];}return db[_0xf22c('0x24')][_0xf22c('0x3b')](_0x1dbfca);})[_0xf22c('0x1e')](function(_0x18c7a9){_0x171846[_0xf22c('0x3c')]=_0x18c7a9;return _0x171846;})['then'](respondWithFilteredResult(_0x14016e,_0x1dbfca))[_0xf22c('0x3d')](handleError(_0x14016e,null));};exports[_0xf22c('0x3e')]=function(_0x363343,_0x57a78a){var _0x1a8e1a={'raw':![],'where':{'id':_0x363343[_0xf22c('0x3f')]['id']}},_0x48bce2={};_0x48bce2['model']=_[_0xf22c('0x2a')](db[_0xf22c('0x24')][_0xf22c('0x25')]);_0x48bce2['query']=_[_0xf22c('0x2a')](_0x363343[_0xf22c('0x29')]);_0x48bce2[_0xf22c('0x2b')]=_[_0xf22c('0x2c')](_0x48bce2[_0xf22c('0x28')],_0x48bce2['query']);_0x1a8e1a[_0xf22c('0x2d')]=_[_0xf22c('0x2c')](_0x48bce2[_0xf22c('0x28')],qs['fields'](_0x363343[_0xf22c('0x29')][_0xf22c('0x2e')]));_0x1a8e1a[_0xf22c('0x2d')]=_0x1a8e1a[_0xf22c('0x2d')][_0xf22c('0x2f')]?_0x1a8e1a[_0xf22c('0x2d')]:_0x48bce2[_0xf22c('0x28')];if(_0x363343['query'][_0xf22c('0x39')]){_0x1a8e1a[_0xf22c('0x3a')]=[{'all':!![]}];}_0x1a8e1a=_['merge']({},_0x1a8e1a,_0x363343[_0xf22c('0x38')]);return db[_0xf22c('0x24')][_0xf22c('0x40')](_0x1a8e1a)[_0xf22c('0x1e')](handleEntityNotFound(_0x57a78a,null))[_0xf22c('0x1e')](respondWithResult(_0x57a78a,null))[_0xf22c('0x3d')](handleError(_0x57a78a,null));};exports[_0xf22c('0x41')]=function(_0x474695,_0x413c53){return db[_0xf22c('0x24')]['create'](_0x474695['body'],{})[_0xf22c('0x1e')](respondWithResult(_0x413c53,0xc9))[_0xf22c('0x3d')](handleError(_0x413c53,null));};exports[_0xf22c('0x1d')]=function(_0x2de3f3,_0x236db0){if(_0x2de3f3[_0xf22c('0x42')]['id']){delete _0x2de3f3[_0xf22c('0x42')]['id'];}return db['FreshsalesAccount'][_0xf22c('0x40')]({'where':{'id':_0x2de3f3[_0xf22c('0x3f')]['id']}})[_0xf22c('0x1e')](handleEntityNotFound(_0x236db0,null))[_0xf22c('0x1e')](saveUpdates(_0x2de3f3[_0xf22c('0x42')],null))[_0xf22c('0x1e')](respondWithResult(_0x236db0,null))['catch'](handleError(_0x236db0,null));};exports['destroy']=function(_0x479031,_0x3d1da3){return db[_0xf22c('0x24')][_0xf22c('0x40')]({'where':{'id':_0x479031[_0xf22c('0x3f')]['id']}})[_0xf22c('0x1e')](handleEntityNotFound(_0x3d1da3,null))[_0xf22c('0x1e')](removeEntity(_0x3d1da3,null))[_0xf22c('0x3d')](handleError(_0x3d1da3,null));};exports[_0xf22c('0x43')]=function(_0x27b6ed,_0x5ab401,_0x38684d){var _0x2bbd73={};var _0x289f32={};var _0x13968f;var _0x19f6fd;return db['FreshsalesAccount'][_0xf22c('0x44')]({'where':{'id':_0x27b6ed['params']['id']}})[_0xf22c('0x1e')](handleEntityNotFound(_0x5ab401,null))['then'](function(_0x55733c){if(_0x55733c){_0x13968f=_0x55733c;_0x289f32[_0xf22c('0x28')]=_[_0xf22c('0x2a')](db[_0xf22c('0x45')][_0xf22c('0x25')]);_0x289f32['query']=_[_0xf22c('0x2a')](_0x27b6ed['query']);_0x289f32[_0xf22c('0x2b')]=_['intersection'](_0x289f32[_0xf22c('0x28')],_0x289f32[_0xf22c('0x29')]);_0x2bbd73['attributes']=_[_0xf22c('0x2c')](_0x289f32['model'],qs['fields'](_0x27b6ed['query'][_0xf22c('0x2e')]));_0x2bbd73[_0xf22c('0x2d')]=_0x2bbd73['attributes'][_0xf22c('0x2f')]?_0x2bbd73[_0xf22c('0x2d')]:_0x289f32[_0xf22c('0x28')];_0x2bbd73['order']=qs[_0xf22c('0x33')](_0x27b6ed['query'][_0xf22c('0x33')]);_0x2bbd73[_0xf22c('0x34')]=qs['filters'](_[_0xf22c('0x35')](_0x27b6ed[_0xf22c('0x29')],_0x289f32[_0xf22c('0x2b')]));if(_0x27b6ed[_0xf22c('0x29')][_0xf22c('0x36')]){_0x2bbd73[_0xf22c('0x34')]=_[_0xf22c('0x37')](_0x2bbd73[_0xf22c('0x34')],{'$or':_[_0xf22c('0x23')](_0x2bbd73[_0xf22c('0x2d')],function(_0x435bef){var _0x2957bb={};_0x2957bb[_0x435bef]={'$like':'%'+_0x27b6ed[_0xf22c('0x29')][_0xf22c('0x36')]+'%'};return _0x2957bb;})});}_0x2bbd73=_['merge']({},_0x2bbd73,_0x27b6ed[_0xf22c('0x38')]);return _0x13968f[_0xf22c('0x43')](_0x2bbd73);}})[_0xf22c('0x1e')](function(_0x41cc17){if(_0x41cc17){_0x19f6fd=_0x41cc17[_0xf22c('0x2f')];if(!_0x27b6ed['query']['hasOwnProperty'](_0xf22c('0x46'))){_0x2bbd73[_0xf22c('0x18')]=qs[_0xf22c('0x18')](_0x27b6ed['query'][_0xf22c('0x18')]);_0x2bbd73[_0xf22c('0x31')]=qs[_0xf22c('0x31')](_0x27b6ed[_0xf22c('0x29')][_0xf22c('0x31')]);}return _0x13968f[_0xf22c('0x43')](_0x2bbd73);}})[_0xf22c('0x1e')](function(_0x2572c8){if(_0x2572c8){return _0x2572c8?{'count':_0x19f6fd,'rows':_0x2572c8}:null;}})[_0xf22c('0x1e')](respondWithResult(_0x5ab401,null))['catch'](handleError(_0x5ab401,null));};exports[_0xf22c('0x47')]=function(_0x508946,_0x6ebc15,_0x4a40ff){if(_0x508946[_0xf22c('0x42')]['id']){delete _0x508946['body']['id'];}return db[_0xf22c('0x24')][_0xf22c('0x44')]({'where':{'id':_0x508946[_0xf22c('0x3f')]['id']}})[_0xf22c('0x1e')](handleEntityNotFound(_0x6ebc15,null))['then'](function(_0x3fdd32){if(_0x3fdd32){_0x508946['body'][_0xf22c('0x48')]=_0x3fdd32['id'];_0x508946['body']['Subjects']=integrations[_0xf22c('0x49')](_0x508946[_0xf22c('0x42')][_0xf22c('0x4a')],_0x508946['body'][_0xf22c('0x27')]);_0x508946[_0xf22c('0x42')]['Descriptions']=integrations[_0xf22c('0x4b')](_0x508946[_0xf22c('0x42')][_0xf22c('0x4a')],_0x508946[_0xf22c('0x42')][_0xf22c('0x27')]);return db[_0xf22c('0x45')][_0xf22c('0x41')](_0x508946[_0xf22c('0x42')],{'include':[{'model':db[_0xf22c('0x4c')],'as':_0xf22c('0x4d')},{'model':db[_0xf22c('0x4c')],'as':_0xf22c('0x4e')}]});}return null;})[_0xf22c('0x1e')](respondWithResult(_0x6ebc15,null))[_0xf22c('0x3d')](handleError(_0x6ebc15,null));};exports['getFields']=function(_0x3ffd5c,_0x181746,_0x59cfa2){var _0x27ac1a='';var _0x272639='';return db[_0xf22c('0x24')]['findOne']({'where':{'id':_0x3ffd5c[_0xf22c('0x3f')]['id']},'attributes':['id',_0xf22c('0x4f'),'remoteUri',_0xf22c('0x50')]})['then'](handleEntityNotFound(_0x181746,null))[_0xf22c('0x1e')](function(_0x18edaa){if(_0x18edaa){_0x272639=_0x18edaa[_0xf22c('0x4f')];_0x27ac1a=_0x18edaa['remoteUri'];var _0xbf91ab=_0x18edaa[_0xf22c('0x51')]['slice'](-0x1);if(_0xbf91ab==='/'){_0x27ac1a=_0x27ac1a[_0xf22c('0x52')](0x0,_0x27ac1a[_0xf22c('0x53')](_0xbf91ab));}return rp({'method':'GET','uri':util['format'](_0xf22c('0x54'),_0x27ac1a,'/api/selector/owners'),'headers':{'Authorization':_0xf22c('0x55')+_0x18edaa[_0xf22c('0x50')]},'json':!![]});}})[_0xf22c('0x1e')](function(_0x38c892){if(_0x38c892){var _0x25ac37=_0x38c892[_0xf22c('0x56')];var _0xc4533=![];var _0x2db427=null;for(_0x2db427=0x0;_0x2db427<_0x25ac37[_0xf22c('0x2f')];_0x2db427++){if(_0x25ac37[_0x2db427][_0xf22c('0x57')]===_0x272639){_0xc4533=!![];}}if(_0xc4533){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xf22c('0x58')});}}})['then'](respondWithResult(_0x181746,null))[_0xf22c('0x3d')](function(_0x2f7e8b){var _0x4cd239=_0x3ffd5c[_0xf22c('0x29')][_0xf22c('0x59')]?0x1f4:_0x2f7e8b[_0xf22c('0x5a')]||0x1f4;logger['error'](_0xf22c('0x5b'),_0xf22c('0x5c'),_0x4cd239,JSON[_0xf22c('0x5d')](_0x2f7e8b));delete _0x2f7e8b[_0xf22c('0x21')];if(_0x4cd239===0x191){_0x4cd239=0x190;}_0x181746[_0xf22c('0x16')](_0x4cd239)['send'](_0x3ffd5c[_0xf22c('0x29')]['test']?{'message':_0xf22c('0x5e'),'statusCode':_0x2f7e8b['statusCode']}:_0x2f7e8b);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index dac69a0..32837e9 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 _0x1883=['../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x302b5e,_0x564a8e){var _0x523ab7=function(_0x6aec8f){while(--_0x6aec8f){_0x302b5e['push'](_0x302b5e['shift']());}};_0x523ab7(++_0x564a8e);}(_0x1883,0xab));var _0x3188=function(_0x3e47a6,_0x38a9af){_0x3e47a6=_0x3e47a6-0x0;var _0x2c40e5=_0x1883[_0x3e47a6];return _0x2c40e5;};'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'));var integrations=require(_0x3188('0xb'));module[_0x3188('0xc')]=function(_0x33b62d,_0x24f2f1){return _0x33b62d[_0x3188('0xd')](_0x3188('0xe'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77d4=['../../components/integrations/configuration','exports','int_freshsales_accounts','util','api','bluebird','request-promise','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x210077,_0x574f90){var _0x29d21f=function(_0x417d2f){while(--_0x417d2f){_0x210077['push'](_0x210077['shift']());}};_0x29d21f(++_0x574f90);}(_0x77d4,0x108));var _0x477d=function(_0x52964f,_0x16e01b){_0x52964f=_0x52964f-0x0;var _0x21859e=_0x77d4[_0x52964f];return _0x21859e;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var logger=require('../../config/logger')(_0x477d('0x1'));var moment=require('moment');var BPromise=require(_0x477d('0x2'));var rp=require(_0x477d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x477d('0x4'));var attributes=require(_0x477d('0x5'));var integrations=require(_0x477d('0x6'));module[_0x477d('0x7')]=function(_0x2545e5,_0x45ca2d){return _0x2545e5['define']('FreshsalesAccount',attributes,{'tableName':_0x477d('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 d20f1d4..03bfeed 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 _0x4bd3=['where','attributes','limit','include','model','map','stringify','find','ShowFreshsalesAccount','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw'];(function(_0x29e35f,_0x4859ef){var _0x266b74=function(_0xc09e1){while(--_0xc09e1){_0x29e35f['push'](_0x29e35f['shift']());}};_0x266b74(++_0x4859ef);}(_0x4bd3,0x174));var _0x34bd=function(_0x276afa,_0x12c844){_0x276afa=_0x276afa-0x0;var _0x1a24e0=_0x4bd3[_0x276afa];return _0x1a24e0;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var moment=require(_0x34bd('0x1'));var BPromise=require(_0x34bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x34bd('0x3'));var logger=require(_0x34bd('0x4'))(_0x34bd('0x5'));var config=require('../../config/environment');var jayson=require(_0x34bd('0x6'));var client=jayson[_0x34bd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8744,_0x213716,_0x51a4d7){return new BPromise(function(_0xd600e1,_0x76de8d){return client[_0x34bd('0x8')](_0x3e8744,_0x51a4d7)[_0x34bd('0x9')](function(_0x1ac77f){logger[_0x34bd('0xa')]('FreshsalesAccount,\x20%s,\x20%s',_0x213716,_0x34bd('0xb'));logger[_0x34bd('0xc')](_0x34bd('0xd'),_0x213716,_0x34bd('0xb'),JSON['stringify'](_0x1ac77f));if(_0x1ac77f['error']){if(_0x1ac77f[_0x34bd('0xe')]['code']===0x1f4){logger['error'](_0x34bd('0xf'),_0x213716,_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);return _0x76de8d(_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);}logger[_0x34bd('0xe')](_0x34bd('0xf'),_0x213716,_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);return _0xd600e1(_0x1ac77f['error'][_0x34bd('0x10')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x213716,_0x34bd('0xb'));_0xd600e1(_0x1ac77f[_0x34bd('0x11')][_0x34bd('0x10')]);}})[_0x34bd('0x12')](function(_0x34b91b){logger[_0x34bd('0xe')](_0x34bd('0xf'),_0x213716,_0x34b91b);_0x76de8d(_0x34b91b);});});}exports[_0x34bd('0x13')]=function(_0x3b4bf8){var _0x72b197=this;return new Promise(function(_0x4b5ebb,_0x48d2ba){return db[_0x34bd('0x14')][_0x34bd('0x15')]({'raw':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8[_0x34bd('0x16')][_0x34bd('0x17')]===undefined?!![]:![]:!![],'where':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8[_0x34bd('0x16')][_0x34bd('0x18')]||null:null,'attributes':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8['options'][_0x34bd('0x19')]||null:null,'limit':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8[_0x34bd('0x16')][_0x34bd('0x1a')]||null:null,'include':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8['options']['include']?_['map'](_0x3b4bf8['options'][_0x34bd('0x1b')],function(_0x503a60){return{'model':db[_0x503a60[_0x34bd('0x1c')]],'as':_0x503a60['as'],'attributes':_0x503a60[_0x34bd('0x19')],'include':_0x503a60[_0x34bd('0x1b')]?_['map'](_0x503a60[_0x34bd('0x1b')],function(_0x14479a){return{'model':db[_0x14479a[_0x34bd('0x1c')]],'as':_0x14479a['as'],'attributes':_0x14479a[_0x34bd('0x19')],'include':_0x14479a['include']?_[_0x34bd('0x1d')](_0x14479a[_0x34bd('0x1b')],function(_0x264c94){return{'model':db[_0x264c94[_0x34bd('0x1c')]],'as':_0x264c94['as'],'attributes':_0x264c94['attributes']};}):[]};}):[]};}):[]:[]})[_0x34bd('0x9')](function(_0x3fe8b0){logger['info'](_0x34bd('0x13'),_0x3b4bf8);logger[_0x34bd('0xc')](_0x34bd('0x13'),_0x3b4bf8,JSON[_0x34bd('0x1e')](_0x3fe8b0));_0x4b5ebb(_0x3fe8b0);})[_0x34bd('0x12')](function(_0x4500c8){logger[_0x34bd('0xe')]('GetFreshsalesAccount',_0x4500c8[_0x34bd('0x10')],_0x3b4bf8);_0x48d2ba(_0x72b197[_0x34bd('0xe')](0x1f4,_0x4500c8['message']));});});};exports['ShowFreshsalesAccount']=function(_0x38bdba){var _0xca9897=this;return new Promise(function(_0xd176f7,_0x536b2c){return db['FreshsalesAccount'][_0x34bd('0x1f')]({'raw':_0x38bdba[_0x34bd('0x16')]?_0x38bdba[_0x34bd('0x16')][_0x34bd('0x17')]===undefined?!![]:![]:!![],'where':_0x38bdba['options']?_0x38bdba[_0x34bd('0x16')][_0x34bd('0x18')]||null:null,'attributes':_0x38bdba[_0x34bd('0x16')]?_0x38bdba[_0x34bd('0x16')][_0x34bd('0x19')]||null:null,'include':_0x38bdba[_0x34bd('0x16')]?_0x38bdba['options'][_0x34bd('0x1b')]?_['map'](_0x38bdba[_0x34bd('0x16')][_0x34bd('0x1b')],function(_0xf12ee6){return{'model':db[_0xf12ee6['model']],'as':_0xf12ee6['as'],'attributes':_0xf12ee6[_0x34bd('0x19')],'include':_0xf12ee6[_0x34bd('0x1b')]?_['map'](_0xf12ee6[_0x34bd('0x1b')],function(_0x21c7d6){return{'model':db[_0x21c7d6[_0x34bd('0x1c')]],'as':_0x21c7d6['as'],'attributes':_0x21c7d6['attributes'],'include':_0x21c7d6[_0x34bd('0x1b')]?_[_0x34bd('0x1d')](_0x21c7d6['include'],function(_0x117188){return{'model':db[_0x117188[_0x34bd('0x1c')]],'as':_0x117188['as'],'attributes':_0x117188[_0x34bd('0x19')]};}):[]};}):[]};}):[]:[]})[_0x34bd('0x9')](function(_0x320643){logger[_0x34bd('0xa')]('ShowFreshsalesAccount',_0x38bdba);logger['debug']('ShowFreshsalesAccount',_0x38bdba,JSON[_0x34bd('0x1e')](_0x320643));_0xd176f7(_0x320643);})[_0x34bd('0x12')](function(_0x5e30c5){logger['error'](_0x34bd('0x20'),_0x5e30c5['message'],_0x38bdba);_0x536b2c(_0xca9897['error'](0x1f4,_0x5e30c5[_0x34bd('0x10')]));});});}; \ No newline at end of file +var _0x627e=['request','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetFreshsalesAccount','findAll','raw','options','where','map','model','attributes','include','then','debug','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x627e,0x14a));var _0xe627=function(_0x478fd4,_0x487dce){_0x478fd4=_0x478fd4-0x0;var _0x2f2f2d=_0x627e[_0x478fd4];return _0x2f2f2d;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));var BPromise=require(_0xe627('0x3'));var rs=require(_0xe627('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe627('0x5'))['db'];var utils=require(_0xe627('0x6'));var logger=require(_0xe627('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe627('0x8')][_0xe627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45e49a,_0x2d4f63,_0xd5016e){return new BPromise(function(_0xe065b,_0x4bae52){return client[_0xe627('0xa')](_0x45e49a,_0xd5016e)['then'](function(_0x56549e){logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,'request\x20sent');logger['debug'](_0xe627('0xd'),_0x2d4f63,_0xe627('0xe'),JSON[_0xe627('0xf')](_0x56549e));if(_0x56549e[_0xe627('0x10')]){if(_0x56549e[_0xe627('0x10')][_0xe627('0x11')]===0x1f4){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x56549e[_0xe627('0x10')]['message']);return _0x4bae52(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}logger[_0xe627('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x2d4f63,_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);return _0xe065b(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}else{logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,_0xe627('0xe'));_0xe065b(_0x56549e['result'][_0xe627('0x12')]);}})[_0xe627('0x13')](function(_0x16c2d7){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x16c2d7);_0x4bae52(_0x16c2d7);});});}exports[_0xe627('0x14')]=function(_0x56559b){var _0x2fe46a=this;return new Promise(function(_0x538b22,_0x24fddd){return db['FreshsalesAccount'][_0xe627('0x15')]({'raw':_0x56559b['options']?_0x56559b['options'][_0xe627('0x16')]===undefined?!![]:![]:!![],'where':_0x56559b['options']?_0x56559b[_0xe627('0x17')][_0xe627('0x18')]||null:null,'attributes':_0x56559b['options']?_0x56559b['options']['attributes']||null:null,'limit':_0x56559b[_0xe627('0x17')]?_0x56559b[_0xe627('0x17')]['limit']||null:null,'include':_0x56559b[_0xe627('0x17')]?_0x56559b[_0xe627('0x17')]['include']?_[_0xe627('0x19')](_0x56559b[_0xe627('0x17')]['include'],function(_0x42f3d1){return{'model':db[_0x42f3d1[_0xe627('0x1a')]],'as':_0x42f3d1['as'],'attributes':_0x42f3d1[_0xe627('0x1b')],'include':_0x42f3d1['include']?_[_0xe627('0x19')](_0x42f3d1[_0xe627('0x1c')],function(_0x1a5081){return{'model':db[_0x1a5081[_0xe627('0x1a')]],'as':_0x1a5081['as'],'attributes':_0x1a5081['attributes'],'include':_0x1a5081[_0xe627('0x1c')]?_[_0xe627('0x19')](_0x1a5081[_0xe627('0x1c')],function(_0x29eb8e){return{'model':db[_0x29eb8e[_0xe627('0x1a')]],'as':_0x29eb8e['as'],'attributes':_0x29eb8e[_0xe627('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe627('0x1d')](function(_0x44c9f7){logger[_0xe627('0xb')]('GetFreshsalesAccount',_0x56559b);logger[_0xe627('0x1e')]('GetFreshsalesAccount',_0x56559b,JSON['stringify'](_0x44c9f7));_0x538b22(_0x44c9f7);})[_0xe627('0x13')](function(_0xdf63c8){logger['error'](_0xe627('0x14'),_0xdf63c8['message'],_0x56559b);_0x24fddd(_0x2fe46a[_0xe627('0x10')](0x1f4,_0xdf63c8['message']));});});};exports[_0xe627('0x1f')]=function(_0x26833a){var _0x5d8992=this;return new Promise(function(_0x33e9dd,_0x4f92c9){return db[_0xe627('0x20')][_0xe627('0x21')]({'raw':_0x26833a[_0xe627('0x17')]?_0x26833a[_0xe627('0x17')][_0xe627('0x16')]===undefined?!![]:![]:!![],'where':_0x26833a[_0xe627('0x17')]?_0x26833a[_0xe627('0x17')][_0xe627('0x18')]||null:null,'attributes':_0x26833a[_0xe627('0x17')]?_0x26833a[_0xe627('0x17')][_0xe627('0x1b')]||null:null,'include':_0x26833a['options']?_0x26833a['options'][_0xe627('0x1c')]?_['map'](_0x26833a[_0xe627('0x17')]['include'],function(_0x56d1d7){return{'model':db[_0x56d1d7[_0xe627('0x1a')]],'as':_0x56d1d7['as'],'attributes':_0x56d1d7['attributes'],'include':_0x56d1d7['include']?_[_0xe627('0x19')](_0x56d1d7[_0xe627('0x1c')],function(_0x55f001){return{'model':db[_0x55f001['model']],'as':_0x55f001['as'],'attributes':_0x55f001['attributes'],'include':_0x55f001['include']?_[_0xe627('0x19')](_0x55f001['include'],function(_0x39338c){return{'model':db[_0x39338c[_0xe627('0x1a')]],'as':_0x39338c['as'],'attributes':_0x39338c['attributes']};}):[]};}):[]};}):[]:[]})[_0xe627('0x1d')](function(_0x35a303){logger['info'](_0xe627('0x1f'),_0x26833a);logger[_0xe627('0x1e')](_0xe627('0x1f'),_0x26833a,JSON[_0xe627('0xf')](_0x35a303));_0x33e9dd(_0x35a303);})[_0xe627('0x13')](function(_0x28fd59){logger['error'](_0xe627('0x1f'),_0x28fd59['message'],_0x26833a);_0x4f92c9(_0x5d8992[_0xe627('0x10')](0x1f4,_0x28fd59['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 26154d2..5bcc14c 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 _0x0983=['/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x3b93dd,_0x2fcab1){var _0xe30ec7=function(_0x3449e7){while(--_0x3449e7){_0x3b93dd['push'](_0x3b93dd['shift']());}};_0xe30ec7(++_0x2fcab1);}(_0x0983,0xa4));var _0x3098=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0983[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x3098('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3098('0x1'));var express=require(_0x3098('0x2'));var router=express[_0x3098('0x3')]();var fs_extra=require(_0x3098('0x4'));var auth=require(_0x3098('0x5'));var interaction=require(_0x3098('0x6'));var config=require(_0x3098('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0x3098('0x8')](),controller[_0x3098('0x9')]);router[_0x3098('0xa')](_0x3098('0xb'),auth[_0x3098('0x8')](),controller[_0x3098('0xc')]);router['get']('/:id/subjects',auth[_0x3098('0x8')](),controller[_0x3098('0xd')]);router['get'](_0x3098('0xe'),auth[_0x3098('0x8')](),controller[_0x3098('0xf')]);router['get'](_0x3098('0x10'),auth[_0x3098('0x8')](),controller[_0x3098('0x11')]);router[_0x3098('0x12')]('/',auth[_0x3098('0x8')](),controller[_0x3098('0x13')]);router[_0x3098('0x14')](_0x3098('0xb'),auth['isAuthenticated'](),controller[_0x3098('0x15')]);router[_0x3098('0x16')](_0x3098('0xb'),auth[_0x3098('0x8')](),controller[_0x3098('0x17')]);module[_0x3098('0x18')]=router; \ No newline at end of file +var _0xabe3=['get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x39b68b,_0x4ad96d){var _0xae091f=function(_0x13b5e1){while(--_0x13b5e1){_0x39b68b['push'](_0x39b68b['shift']());}};_0xae091f(++_0x4ad96d);}(_0xabe3,0xc6));var _0x3abe=function(_0x1f36da,_0x54e2d2){_0x1f36da=_0x1f36da-0x0;var _0xb0d5b0=_0xabe3[_0x1f36da];return _0xb0d5b0;};'use strict';var multer=require(_0x3abe('0x0'));var util=require(_0x3abe('0x1'));var path=require(_0x3abe('0x2'));var timeout=require(_0x3abe('0x3'));var express=require(_0x3abe('0x4'));var router=express[_0x3abe('0x5')]();var fs_extra=require(_0x3abe('0x6'));var auth=require(_0x3abe('0x7'));var interaction=require(_0x3abe('0x8'));var config=require(_0x3abe('0x9'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x3abe('0xa')]('/',auth[_0x3abe('0xb')](),controller[_0x3abe('0xc')]);router[_0x3abe('0xa')](_0x3abe('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x3abe('0xa')](_0x3abe('0xe'),auth[_0x3abe('0xb')](),controller[_0x3abe('0xf')]);router[_0x3abe('0xa')](_0x3abe('0x10'),auth[_0x3abe('0xb')](),controller[_0x3abe('0x11')]);router[_0x3abe('0xa')](_0x3abe('0x12'),auth[_0x3abe('0xb')](),controller[_0x3abe('0x13')]);router[_0x3abe('0x14')]('/',auth[_0x3abe('0xb')](),controller[_0x3abe('0x15')]);router[_0x3abe('0x16')]('/:id',auth[_0x3abe('0xb')](),controller[_0x3abe('0x17')]);router['delete']('/:id',auth[_0x3abe('0xb')](),controller[_0x3abe('0x18')]);module[_0x3abe('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 7f89e5a..25c89e6 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 _0x6d41=['exports','STRING','sequelize'];(function(_0xe306e9,_0x56cd46){var _0x5668ef=function(_0x593e78){while(--_0x593e78){_0xe306e9['push'](_0xe306e9['shift']());}};_0x5668ef(++_0x56cd46);}(_0x6d41,0x125));var _0x16d4=function(_0x3d3d26,_0x5acdbb){_0x3d3d26=_0x3d3d26-0x0;var _0x1d8fc2=_0x6d41[_0x3d3d26];return _0x1d8fc2;};'use strict';var Sequelize=require(_0x16d4('0x0'));module[_0x16d4('0x1')]={'name':{'type':Sequelize[_0x16d4('0x2')]},'description':{'type':Sequelize[_0x16d4('0x2')]}}; \ No newline at end of file +var _0xaee8=['exports','STRING','sequelize'];(function(_0x26c448,_0x4c4861){var _0x293e4a=function(_0x4af00e){while(--_0x4af00e){_0x26c448['push'](_0x26c448['shift']());}};_0x293e4a(++_0x4c4861);}(_0xaee8,0x12b));var _0x8aee=function(_0x266ad8,_0x45346d){_0x266ad8=_0x266ad8-0x0;var _0x45b7de=_0xaee8[_0x266ad8];return _0x45b7de;};'use strict';var Sequelize=require(_0x8aee('0x0'));module[_0x8aee('0x1')]={'name':{'type':Sequelize[_0x8aee('0x2')]},'description':{'type':Sequelize[_0x8aee('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index c5b9deb..2202431 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 _0xd474=['../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','update','getSubjects','FreshsalesField','getDescriptions','findOne','nolimit','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x11cfca,_0x4f3bc6){var _0x2c8cd6=function(_0x490261){while(--_0x490261){_0x11cfca['push'](_0x11cfca['shift']());}};_0x2c8cd6(++_0x4f3bc6);}(_0xd474,0x135));var _0x4d47=function(_0x5c43e1,_0x4c1705){_0x5c43e1=_0x5c43e1-0x0;var _0x397fa7=_0xd474[_0x5c43e1];return _0x397fa7;};'use strict';var emlformat=require(_0x4d47('0x0'));var rimraf=require(_0x4d47('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d47('0x2'));var rp=require(_0x4d47('0x3'));var moment=require(_0x4d47('0x4'));var BPromise=require(_0x4d47('0x5'));var Mustache=require('mustache');var util=require(_0x4d47('0x6'));var path=require(_0x4d47('0x7'));var sox=require('sox');var csv=require(_0x4d47('0x8'));var ejs=require(_0x4d47('0x9'));var fs=require('fs');var fs_extra=require(_0x4d47('0xa'));var _=require(_0x4d47('0xb'));var squel=require(_0x4d47('0xc'));var crypto=require(_0x4d47('0xd'));var jsforce=require(_0x4d47('0xe'));var deskjs=require(_0x4d47('0xf'));var toCsv=require(_0x4d47('0x8'));var querystring=require(_0x4d47('0x10'));var Papa=require(_0x4d47('0x11'));var Redis=require(_0x4d47('0x12'));var authService=require(_0x4d47('0x13'));var qs=require(_0x4d47('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d47('0x15'));var logger=require(_0x4d47('0x16'))(_0x4d47('0x17'));var utils=require(_0x4d47('0x18'));var config=require(_0x4d47('0x19'));var licenseUtil=require(_0x4d47('0x1a'));var db=require(_0x4d47('0x1b'))['db'];function respondWithStatusCode(_0x3ff230,_0x1dcb3f){_0x1dcb3f=_0x1dcb3f||0xcc;return function(_0x2088e6){if(_0x2088e6){return _0x3ff230[_0x4d47('0x1c')](_0x1dcb3f);}return _0x3ff230['status'](_0x1dcb3f)[_0x4d47('0x1d')]();};}function respondWithResult(_0x5bac30,_0x2327a3){_0x2327a3=_0x2327a3||0xc8;return function(_0x15aa0e){if(_0x15aa0e){return _0x5bac30[_0x4d47('0x1e')](_0x2327a3)[_0x4d47('0x1f')](_0x15aa0e);}};}function respondWithFilteredResult(_0x45e7e8,_0x48eba8){return function(_0x44b121){if(_0x44b121){var _0x482cfd=typeof _0x48eba8[_0x4d47('0x20')]===_0x4d47('0x21')&&typeof _0x48eba8[_0x4d47('0x22')]==='undefined';var _0x68ccdb=_0x44b121['count'];var _0x2fe66c=_0x482cfd?0x0:_0x48eba8[_0x4d47('0x20')];var _0x592c1e=_0x482cfd?_0x44b121[_0x4d47('0x23')]:_0x48eba8['offset']+_0x48eba8[_0x4d47('0x22')];var _0x2a1884;if(_0x592c1e>=_0x68ccdb){_0x592c1e=_0x68ccdb;_0x2a1884=0xc8;}else{_0x2a1884=0xce;}_0x45e7e8['status'](_0x2a1884);return _0x45e7e8[_0x4d47('0x24')](_0x4d47('0x25'),_0x2fe66c+'-'+_0x592c1e+'/'+_0x68ccdb)[_0x4d47('0x1f')](_0x44b121);}return null;};}function patchUpdates(_0x1bb51a){return function(_0x572334){try{jsonpatch[_0x4d47('0x26')](_0x572334,_0x1bb51a,!![]);}catch(_0x41fba9){return BPromise[_0x4d47('0x27')](_0x41fba9);}return _0x572334[_0x4d47('0x28')]();};}function saveUpdates(_0x3914c1,_0x4cb061){return function(_0x41be38){if(_0x41be38){return _0x41be38['update'](_0x3914c1)[_0x4d47('0x29')](function(_0x563eea){return _0x563eea;});}return null;};}function removeEntity(_0x10bdd8,_0x2a0c0a){return function(_0x3c321f){if(_0x3c321f){return _0x3c321f[_0x4d47('0x2a')]()[_0x4d47('0x29')](function(){_0x10bdd8['status'](0xcc)[_0x4d47('0x1d')]();});}};}function handleEntityNotFound(_0x215c3f,_0x51a17f){return function(_0xb6a8f){if(!_0xb6a8f){_0x215c3f[_0x4d47('0x1c')](0x194);}return _0xb6a8f;};}function handleError(_0x2dc3b1,_0x1b4fdf){_0x1b4fdf=_0x1b4fdf||0x1f4;return function(_0x126a4b){logger[_0x4d47('0x2b')](_0x126a4b[_0x4d47('0x2c')]);if(_0x126a4b['name']){delete _0x126a4b[_0x4d47('0x2d')];}_0x2dc3b1[_0x4d47('0x1e')](_0x1b4fdf)['send'](_0x126a4b);};}exports[_0x4d47('0x2e')]=function(_0x4e3afa,_0x56ac2f){var _0x4803cb={},_0x49cc9a={},_0x4edc92={'count':0x0,'rows':[]};var _0x5e83c1=_[_0x4d47('0x2f')](db[_0x4d47('0x30')][_0x4d47('0x31')],function(_0x5cb2f5){return{'name':_0x5cb2f5[_0x4d47('0x32')],'type':_0x5cb2f5[_0x4d47('0x33')]['key']};});_0x49cc9a[_0x4d47('0x34')]=_['map'](_0x5e83c1,_0x4d47('0x2d'));_0x49cc9a[_0x4d47('0x35')]=_[_0x4d47('0x36')](_0x4e3afa[_0x4d47('0x35')]);_0x49cc9a[_0x4d47('0x37')]=_['intersection'](_0x49cc9a[_0x4d47('0x34')],_0x49cc9a['query']);_0x4803cb[_0x4d47('0x38')]=_[_0x4d47('0x39')](_0x49cc9a[_0x4d47('0x34')],qs[_0x4d47('0x3a')](_0x4e3afa['query'][_0x4d47('0x3a')]));_0x4803cb[_0x4d47('0x38')]=_0x4803cb[_0x4d47('0x38')][_0x4d47('0x3b')]?_0x4803cb[_0x4d47('0x38')]:_0x49cc9a[_0x4d47('0x34')];if(!_0x4e3afa[_0x4d47('0x35')][_0x4d47('0x3c')]('nolimit')){_0x4803cb[_0x4d47('0x22')]=qs[_0x4d47('0x22')](_0x4e3afa[_0x4d47('0x35')][_0x4d47('0x22')]);_0x4803cb[_0x4d47('0x20')]=qs[_0x4d47('0x20')](_0x4e3afa['query']['offset']);}_0x4803cb[_0x4d47('0x3d')]=qs['sort'](_0x4e3afa[_0x4d47('0x35')][_0x4d47('0x3e')]);_0x4803cb[_0x4d47('0x3f')]=qs[_0x4d47('0x37')](_[_0x4d47('0x40')](_0x4e3afa[_0x4d47('0x35')],_0x49cc9a[_0x4d47('0x37')]),_0x5e83c1);if(_0x4e3afa[_0x4d47('0x35')][_0x4d47('0x41')]){_0x4803cb['where']=_[_0x4d47('0x42')](_0x4803cb[_0x4d47('0x3f')],{'$or':_[_0x4d47('0x2f')](_0x5e83c1,function(_0x520ee0){if(_0x520ee0[_0x4d47('0x33')]!==_0x4d47('0x43')){var _0x38fc3f={};_0x38fc3f[_0x520ee0[_0x4d47('0x2d')]]={'$like':'%'+_0x4e3afa[_0x4d47('0x35')][_0x4d47('0x41')]+'%'};return _0x38fc3f;}})});}_0x4803cb=_[_0x4d47('0x42')]({},_0x4803cb,_0x4e3afa[_0x4d47('0x44')]);var _0x1736d2={'where':_0x4803cb[_0x4d47('0x3f')]};return db['FreshsalesConfiguration'][_0x4d47('0x23')](_0x1736d2)[_0x4d47('0x29')](function(_0x55cdfc){_0x4edc92[_0x4d47('0x23')]=_0x55cdfc;if(_0x4e3afa[_0x4d47('0x35')][_0x4d47('0x45')]){_0x4803cb[_0x4d47('0x46')]=[{'all':!![]}];}return db[_0x4d47('0x30')]['findAll'](_0x4803cb);})['then'](function(_0x242b95){_0x4edc92[_0x4d47('0x47')]=_0x242b95;return _0x4edc92;})[_0x4d47('0x29')](respondWithFilteredResult(_0x56ac2f,_0x4803cb))[_0x4d47('0x48')](handleError(_0x56ac2f,null));};exports['show']=function(_0x4c654f,_0x3cf88e){var _0x16b176={'raw':![],'where':{'id':_0x4c654f[_0x4d47('0x49')]['id']}},_0x2950a0={};_0x2950a0['model']=_[_0x4d47('0x36')](db[_0x4d47('0x30')][_0x4d47('0x31')]);_0x2950a0[_0x4d47('0x35')]=_['keys'](_0x4c654f[_0x4d47('0x35')]);_0x2950a0[_0x4d47('0x37')]=_[_0x4d47('0x39')](_0x2950a0[_0x4d47('0x34')],_0x2950a0[_0x4d47('0x35')]);_0x16b176[_0x4d47('0x38')]=_['intersection'](_0x2950a0[_0x4d47('0x34')],qs['fields'](_0x4c654f[_0x4d47('0x35')]['fields']));_0x16b176[_0x4d47('0x38')]=_0x16b176[_0x4d47('0x38')]['length']?_0x16b176['attributes']:_0x2950a0[_0x4d47('0x34')];if(_0x4c654f[_0x4d47('0x35')][_0x4d47('0x45')]){_0x16b176['include']=[{'all':!![]}];}_0x16b176=_['merge']({},_0x16b176,_0x4c654f[_0x4d47('0x44')]);return db[_0x4d47('0x30')][_0x4d47('0x4a')](_0x16b176)['then'](handleEntityNotFound(_0x3cf88e,null))[_0x4d47('0x29')](respondWithResult(_0x3cf88e,null))[_0x4d47('0x48')](handleError(_0x3cf88e,null));};exports['create']=function(_0x4b08fe,_0x52f855){return db[_0x4d47('0x30')][_0x4d47('0x4b')](_0x4b08fe[_0x4d47('0x4c')],{})[_0x4d47('0x29')](respondWithResult(_0x52f855,0xc9))[_0x4d47('0x48')](handleError(_0x52f855,null));};exports[_0x4d47('0x4d')]=function(_0x59648d,_0x5851ae){if(_0x59648d[_0x4d47('0x4c')]['id']){delete _0x59648d[_0x4d47('0x4c')]['id'];}return db[_0x4d47('0x30')][_0x4d47('0x4a')]({'where':{'id':_0x59648d[_0x4d47('0x49')]['id']}})[_0x4d47('0x29')](handleEntityNotFound(_0x5851ae,null))[_0x4d47('0x29')](saveUpdates(_0x59648d[_0x4d47('0x4c')],null))[_0x4d47('0x29')](respondWithResult(_0x5851ae,null))[_0x4d47('0x48')](handleError(_0x5851ae,null));};exports[_0x4d47('0x2a')]=function(_0x3529bf,_0x71076e){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x3529bf[_0x4d47('0x49')]['id']}})[_0x4d47('0x29')](handleEntityNotFound(_0x71076e,null))[_0x4d47('0x29')](removeEntity(_0x71076e,null))[_0x4d47('0x48')](handleError(_0x71076e,null));};exports[_0x4d47('0x4e')]=function(_0x5496,_0x403a2d,_0x464113){var _0x4f04cd={};var _0x5c4fdd={};var _0x33fbd2;var _0x48bec8;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x5496['params']['id']}})[_0x4d47('0x29')](handleEntityNotFound(_0x403a2d,null))['then'](function(_0x49b38c){if(_0x49b38c){_0x33fbd2=_0x49b38c;_0x5c4fdd[_0x4d47('0x34')]=_['keys'](db[_0x4d47('0x4f')][_0x4d47('0x31')]);_0x5c4fdd[_0x4d47('0x35')]=_[_0x4d47('0x36')](_0x5496[_0x4d47('0x35')]);_0x5c4fdd[_0x4d47('0x37')]=_[_0x4d47('0x39')](_0x5c4fdd[_0x4d47('0x34')],_0x5c4fdd[_0x4d47('0x35')]);_0x4f04cd[_0x4d47('0x38')]=_['intersection'](_0x5c4fdd[_0x4d47('0x34')],qs[_0x4d47('0x3a')](_0x5496[_0x4d47('0x35')][_0x4d47('0x3a')]));_0x4f04cd['attributes']=_0x4f04cd['attributes']['length']?_0x4f04cd[_0x4d47('0x38')]:_0x5c4fdd[_0x4d47('0x34')];_0x4f04cd[_0x4d47('0x3d')]=qs[_0x4d47('0x3e')](_0x5496[_0x4d47('0x35')][_0x4d47('0x3e')]);_0x4f04cd[_0x4d47('0x3f')]=qs[_0x4d47('0x37')](_[_0x4d47('0x40')](_0x5496[_0x4d47('0x35')],_0x5c4fdd[_0x4d47('0x37')]));if(_0x5496[_0x4d47('0x35')][_0x4d47('0x41')]){_0x4f04cd[_0x4d47('0x3f')]=_[_0x4d47('0x42')](_0x4f04cd[_0x4d47('0x3f')],{'$or':_[_0x4d47('0x2f')](_0x4f04cd[_0x4d47('0x38')],function(_0x147acd){var _0x243a3b={};_0x243a3b[_0x147acd]={'$like':'%'+_0x5496[_0x4d47('0x35')]['filter']+'%'};return _0x243a3b;})});}_0x4f04cd=_[_0x4d47('0x42')]({},_0x4f04cd,_0x5496[_0x4d47('0x44')]);return _0x33fbd2['getSubjects'](_0x4f04cd);}})[_0x4d47('0x29')](function(_0x408cca){if(_0x408cca){_0x48bec8=_0x408cca[_0x4d47('0x3b')];if(!_0x5496['query']['hasOwnProperty']('nolimit')){_0x4f04cd[_0x4d47('0x22')]=qs[_0x4d47('0x22')](_0x5496[_0x4d47('0x35')][_0x4d47('0x22')]);_0x4f04cd[_0x4d47('0x20')]=qs[_0x4d47('0x20')](_0x5496['query']['offset']);}return _0x33fbd2[_0x4d47('0x4e')](_0x4f04cd);}})[_0x4d47('0x29')](function(_0x2f5494){if(_0x2f5494){return _0x2f5494?{'count':_0x48bec8,'rows':_0x2f5494}:null;}})[_0x4d47('0x29')](respondWithResult(_0x403a2d,null))[_0x4d47('0x48')](handleError(_0x403a2d,null));};exports[_0x4d47('0x50')]=function(_0x27c805,_0x15202d,_0x2a4f3d){var _0x18f2e3={};var _0x621e56={};var _0x568d32;var _0x1c84d4;return db[_0x4d47('0x30')][_0x4d47('0x51')]({'where':{'id':_0x27c805[_0x4d47('0x49')]['id']}})['then'](handleEntityNotFound(_0x15202d,null))[_0x4d47('0x29')](function(_0x4cf327){if(_0x4cf327){_0x568d32=_0x4cf327;_0x621e56[_0x4d47('0x34')]=_[_0x4d47('0x36')](db[_0x4d47('0x4f')][_0x4d47('0x31')]);_0x621e56[_0x4d47('0x35')]=_[_0x4d47('0x36')](_0x27c805[_0x4d47('0x35')]);_0x621e56[_0x4d47('0x37')]=_[_0x4d47('0x39')](_0x621e56['model'],_0x621e56[_0x4d47('0x35')]);_0x18f2e3[_0x4d47('0x38')]=_[_0x4d47('0x39')](_0x621e56[_0x4d47('0x34')],qs['fields'](_0x27c805[_0x4d47('0x35')][_0x4d47('0x3a')]));_0x18f2e3['attributes']=_0x18f2e3[_0x4d47('0x38')][_0x4d47('0x3b')]?_0x18f2e3[_0x4d47('0x38')]:_0x621e56[_0x4d47('0x34')];_0x18f2e3[_0x4d47('0x3d')]=qs['sort'](_0x27c805[_0x4d47('0x35')]['sort']);_0x18f2e3[_0x4d47('0x3f')]=qs[_0x4d47('0x37')](_['pick'](_0x27c805[_0x4d47('0x35')],_0x621e56['filters']));if(_0x27c805[_0x4d47('0x35')][_0x4d47('0x41')]){_0x18f2e3['where']=_[_0x4d47('0x42')](_0x18f2e3[_0x4d47('0x3f')],{'$or':_[_0x4d47('0x2f')](_0x18f2e3[_0x4d47('0x38')],function(_0x19c004){var _0x4ae2be={};_0x4ae2be[_0x19c004]={'$like':'%'+_0x27c805[_0x4d47('0x35')][_0x4d47('0x41')]+'%'};return _0x4ae2be;})});}_0x18f2e3=_['merge']({},_0x18f2e3,_0x27c805['options']);return _0x568d32[_0x4d47('0x50')](_0x18f2e3);}})[_0x4d47('0x29')](function(_0x29c74c){if(_0x29c74c){_0x1c84d4=_0x29c74c[_0x4d47('0x3b')];if(!_0x27c805[_0x4d47('0x35')][_0x4d47('0x3c')](_0x4d47('0x52'))){_0x18f2e3['limit']=qs[_0x4d47('0x22')](_0x27c805[_0x4d47('0x35')][_0x4d47('0x22')]);_0x18f2e3['offset']=qs[_0x4d47('0x20')](_0x27c805['query'][_0x4d47('0x20')]);}return _0x568d32[_0x4d47('0x50')](_0x18f2e3);}})[_0x4d47('0x29')](function(_0x19f66f){if(_0x19f66f){return _0x19f66f?{'count':_0x1c84d4,'rows':_0x19f66f}:null;}})[_0x4d47('0x29')](respondWithResult(_0x15202d,null))[_0x4d47('0x48')](handleError(_0x15202d,null));};exports[_0x4d47('0x53')]=function(_0x394cc2,_0x522718,_0x43c4e0){var _0x6811f1={};var _0x7cdfe={};var _0x11a3d0;var _0x1f6775;return db[_0x4d47('0x30')][_0x4d47('0x51')]({'where':{'id':_0x394cc2[_0x4d47('0x49')]['id']}})['then'](handleEntityNotFound(_0x522718,null))[_0x4d47('0x29')](function(_0x374d83){if(_0x374d83){_0x11a3d0=_0x374d83;_0x7cdfe[_0x4d47('0x34')]=_['keys'](db[_0x4d47('0x4f')][_0x4d47('0x31')]);_0x7cdfe[_0x4d47('0x35')]=_[_0x4d47('0x36')](_0x394cc2[_0x4d47('0x35')]);_0x7cdfe[_0x4d47('0x37')]=_[_0x4d47('0x39')](_0x7cdfe[_0x4d47('0x34')],_0x7cdfe[_0x4d47('0x35')]);_0x6811f1[_0x4d47('0x38')]=_['intersection'](_0x7cdfe[_0x4d47('0x34')],qs[_0x4d47('0x3a')](_0x394cc2[_0x4d47('0x35')][_0x4d47('0x3a')]));_0x6811f1[_0x4d47('0x38')]=_0x6811f1[_0x4d47('0x38')][_0x4d47('0x3b')]?_0x6811f1[_0x4d47('0x38')]:_0x7cdfe[_0x4d47('0x34')];_0x6811f1[_0x4d47('0x3d')]=qs[_0x4d47('0x3e')](_0x394cc2[_0x4d47('0x35')]['sort']);_0x6811f1['where']=qs[_0x4d47('0x37')](_[_0x4d47('0x40')](_0x394cc2[_0x4d47('0x35')],_0x7cdfe[_0x4d47('0x37')]));if(_0x394cc2['query'][_0x4d47('0x41')]){_0x6811f1[_0x4d47('0x3f')]=_[_0x4d47('0x42')](_0x6811f1[_0x4d47('0x3f')],{'$or':_[_0x4d47('0x2f')](_0x6811f1[_0x4d47('0x38')],function(_0x43fe67){var _0x4eb29={};_0x4eb29[_0x43fe67]={'$like':'%'+_0x394cc2[_0x4d47('0x35')]['filter']+'%'};return _0x4eb29;})});}_0x6811f1=_[_0x4d47('0x42')]({},_0x6811f1,_0x394cc2[_0x4d47('0x44')]);return _0x11a3d0[_0x4d47('0x53')](_0x6811f1);}})['then'](function(_0x48f903){if(_0x48f903){_0x1f6775=_0x48f903[_0x4d47('0x3b')];if(!_0x394cc2[_0x4d47('0x35')]['hasOwnProperty'](_0x4d47('0x52'))){_0x6811f1[_0x4d47('0x22')]=qs[_0x4d47('0x22')](_0x394cc2[_0x4d47('0x35')][_0x4d47('0x22')]);_0x6811f1['offset']=qs[_0x4d47('0x20')](_0x394cc2[_0x4d47('0x35')][_0x4d47('0x20')]);}return _0x11a3d0[_0x4d47('0x53')](_0x6811f1);}})[_0x4d47('0x29')](function(_0x43fc3d){if(_0x43fc3d){return _0x43fc3d?{'count':_0x1f6775,'rows':_0x43fc3d}:null;}})[_0x4d47('0x29')](respondWithResult(_0x522718,null))['catch'](handleError(_0x522718,null));}; \ No newline at end of file +var _0x90c3=['stack','name','index','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','update','getSubjects','findOne','FreshsalesField','getDescriptions','hasOwnProperty','getFields','eml-format','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy'];(function(_0x24f655,_0x2f5613){var _0x4b748c=function(_0x27fec1){while(--_0x27fec1){_0x24f655['push'](_0x24f655['shift']());}};_0x4b748c(++_0x2f5613);}(_0x90c3,0x15f));var _0x390c=function(_0x3cbbf2,_0x56a1b6){_0x3cbbf2=_0x3cbbf2-0x0;var _0x1ffb6e=_0x90c3[_0x3cbbf2];return _0x1ffb6e;};'use strict';var emlformat=require(_0x390c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x390c('0x1'));var rp=require('request-promise');var moment=require(_0x390c('0x2'));var BPromise=require(_0x390c('0x3'));var Mustache=require(_0x390c('0x4'));var util=require('util');var path=require(_0x390c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x390c('0x6'));var fs=require('fs');var fs_extra=require(_0x390c('0x7'));var _=require(_0x390c('0x8'));var squel=require(_0x390c('0x9'));var crypto=require(_0x390c('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x390c('0xb'));var querystring=require('querystring');var Papa=require(_0x390c('0xc'));var Redis=require(_0x390c('0xd'));var authService=require(_0x390c('0xe'));var qs=require(_0x390c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x390c('0x10'));var logger=require('../../config/logger')(_0x390c('0x11'));var utils=require(_0x390c('0x12'));var config=require(_0x390c('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x505fde,_0x207214){_0x207214=_0x207214||0xcc;return function(_0x579f65){if(_0x579f65){return _0x505fde[_0x390c('0x14')](_0x207214);}return _0x505fde[_0x390c('0x15')](_0x207214)[_0x390c('0x16')]();};}function respondWithResult(_0x376b76,_0x4584c8){_0x4584c8=_0x4584c8||0xc8;return function(_0x84eb2c){if(_0x84eb2c){return _0x376b76[_0x390c('0x15')](_0x4584c8)[_0x390c('0x17')](_0x84eb2c);}};}function respondWithFilteredResult(_0x2fb7bb,_0x377bd9){return function(_0x2df1dc){if(_0x2df1dc){var _0x39ba6b=typeof _0x377bd9[_0x390c('0x18')]===_0x390c('0x19')&&typeof _0x377bd9['limit']===_0x390c('0x19');var _0x36c21c=_0x2df1dc[_0x390c('0x1a')];var _0x126083=_0x39ba6b?0x0:_0x377bd9[_0x390c('0x18')];var _0x2090e7=_0x39ba6b?_0x2df1dc['count']:_0x377bd9[_0x390c('0x18')]+_0x377bd9[_0x390c('0x1b')];var _0xde5f1;if(_0x2090e7>=_0x36c21c){_0x2090e7=_0x36c21c;_0xde5f1=0xc8;}else{_0xde5f1=0xce;}_0x2fb7bb[_0x390c('0x15')](_0xde5f1);return _0x2fb7bb[_0x390c('0x1c')](_0x390c('0x1d'),_0x126083+'-'+_0x2090e7+'/'+_0x36c21c)[_0x390c('0x17')](_0x2df1dc);}return null;};}function patchUpdates(_0x5399fb){return function(_0x27a9e9){try{jsonpatch[_0x390c('0x1e')](_0x27a9e9,_0x5399fb,!![]);}catch(_0x3039c5){return BPromise[_0x390c('0x1f')](_0x3039c5);}return _0x27a9e9['save']();};}function saveUpdates(_0x4b870e,_0xded526){return function(_0x427390){if(_0x427390){return _0x427390['update'](_0x4b870e)[_0x390c('0x20')](function(_0x2e84dc){return _0x2e84dc;});}return null;};}function removeEntity(_0x2af73f,_0x1a58ab){return function(_0x4b0196){if(_0x4b0196){return _0x4b0196[_0x390c('0x21')]()[_0x390c('0x20')](function(){_0x2af73f[_0x390c('0x15')](0xcc)[_0x390c('0x16')]();});}};}function handleEntityNotFound(_0x161b49,_0x25fda5){return function(_0x59102f){if(!_0x59102f){_0x161b49[_0x390c('0x14')](0x194);}return _0x59102f;};}function handleError(_0x527f55,_0x90920a){_0x90920a=_0x90920a||0x1f4;return function(_0x33dc69){logger['error'](_0x33dc69[_0x390c('0x22')]);if(_0x33dc69[_0x390c('0x23')]){delete _0x33dc69['name'];}_0x527f55[_0x390c('0x15')](_0x90920a)['send'](_0x33dc69);};}exports[_0x390c('0x24')]=function(_0x3ca217,_0x4079f4){var _0x4d4b1d={},_0x2e3aa5={},_0x2e054c={'count':0x0,'rows':[]};var _0xcd4ad8=_['map'](db[_0x390c('0x25')][_0x390c('0x26')],function(_0x5d3e48){return{'name':_0x5d3e48[_0x390c('0x27')],'type':_0x5d3e48['type'][_0x390c('0x28')]};});_0x2e3aa5[_0x390c('0x29')]=_['map'](_0xcd4ad8,_0x390c('0x23'));_0x2e3aa5[_0x390c('0x2a')]=_[_0x390c('0x2b')](_0x3ca217['query']);_0x2e3aa5['filters']=_[_0x390c('0x2c')](_0x2e3aa5[_0x390c('0x29')],_0x2e3aa5[_0x390c('0x2a')]);_0x4d4b1d[_0x390c('0x2d')]=_[_0x390c('0x2c')](_0x2e3aa5[_0x390c('0x29')],qs[_0x390c('0x2e')](_0x3ca217[_0x390c('0x2a')][_0x390c('0x2e')]));_0x4d4b1d['attributes']=_0x4d4b1d[_0x390c('0x2d')][_0x390c('0x2f')]?_0x4d4b1d[_0x390c('0x2d')]:_0x2e3aa5['model'];if(!_0x3ca217[_0x390c('0x2a')]['hasOwnProperty'](_0x390c('0x30'))){_0x4d4b1d[_0x390c('0x1b')]=qs[_0x390c('0x1b')](_0x3ca217['query'][_0x390c('0x1b')]);_0x4d4b1d[_0x390c('0x18')]=qs[_0x390c('0x18')](_0x3ca217['query'][_0x390c('0x18')]);}_0x4d4b1d[_0x390c('0x31')]=qs[_0x390c('0x32')](_0x3ca217['query']['sort']);_0x4d4b1d[_0x390c('0x33')]=qs[_0x390c('0x34')](_[_0x390c('0x35')](_0x3ca217['query'],_0x2e3aa5[_0x390c('0x34')]),_0xcd4ad8);if(_0x3ca217[_0x390c('0x2a')][_0x390c('0x36')]){_0x4d4b1d[_0x390c('0x33')]=_['merge'](_0x4d4b1d[_0x390c('0x33')],{'$or':_[_0x390c('0x37')](_0xcd4ad8,function(_0xa2053f){if(_0xa2053f[_0x390c('0x38')]!==_0x390c('0x39')){var _0x133b10={};_0x133b10[_0xa2053f[_0x390c('0x23')]]={'$like':'%'+_0x3ca217[_0x390c('0x2a')]['filter']+'%'};return _0x133b10;}})});}_0x4d4b1d=_[_0x390c('0x3a')]({},_0x4d4b1d,_0x3ca217[_0x390c('0x3b')]);var _0x1723dd={'where':_0x4d4b1d[_0x390c('0x33')]};return db[_0x390c('0x25')][_0x390c('0x1a')](_0x1723dd)[_0x390c('0x20')](function(_0x31a38c){_0x2e054c[_0x390c('0x1a')]=_0x31a38c;if(_0x3ca217[_0x390c('0x2a')][_0x390c('0x3c')]){_0x4d4b1d[_0x390c('0x3d')]=[{'all':!![]}];}return db[_0x390c('0x25')][_0x390c('0x3e')](_0x4d4b1d);})['then'](function(_0x40b526){_0x2e054c[_0x390c('0x3f')]=_0x40b526;return _0x2e054c;})[_0x390c('0x20')](respondWithFilteredResult(_0x4079f4,_0x4d4b1d))['catch'](handleError(_0x4079f4,null));};exports[_0x390c('0x40')]=function(_0x1d3ca2,_0x82a61f){var _0x3009a6={'raw':![],'where':{'id':_0x1d3ca2[_0x390c('0x41')]['id']}},_0x56baa1={};_0x56baa1['model']=_[_0x390c('0x2b')](db[_0x390c('0x25')][_0x390c('0x26')]);_0x56baa1[_0x390c('0x2a')]=_[_0x390c('0x2b')](_0x1d3ca2['query']);_0x56baa1['filters']=_[_0x390c('0x2c')](_0x56baa1[_0x390c('0x29')],_0x56baa1[_0x390c('0x2a')]);_0x3009a6[_0x390c('0x2d')]=_[_0x390c('0x2c')](_0x56baa1['model'],qs[_0x390c('0x2e')](_0x1d3ca2['query'][_0x390c('0x2e')]));_0x3009a6[_0x390c('0x2d')]=_0x3009a6[_0x390c('0x2d')]['length']?_0x3009a6[_0x390c('0x2d')]:_0x56baa1[_0x390c('0x29')];if(_0x1d3ca2[_0x390c('0x2a')][_0x390c('0x3c')]){_0x3009a6[_0x390c('0x3d')]=[{'all':!![]}];}_0x3009a6=_[_0x390c('0x3a')]({},_0x3009a6,_0x1d3ca2[_0x390c('0x3b')]);return db[_0x390c('0x25')][_0x390c('0x42')](_0x3009a6)[_0x390c('0x20')](handleEntityNotFound(_0x82a61f,null))['then'](respondWithResult(_0x82a61f,null))['catch'](handleError(_0x82a61f,null));};exports[_0x390c('0x43')]=function(_0x770635,_0x3085a4){return db[_0x390c('0x25')]['create'](_0x770635[_0x390c('0x44')],{})[_0x390c('0x20')](respondWithResult(_0x3085a4,0xc9))[_0x390c('0x45')](handleError(_0x3085a4,null));};exports[_0x390c('0x46')]=function(_0x4c94f8,_0xbb9a2b){if(_0x4c94f8[_0x390c('0x44')]['id']){delete _0x4c94f8[_0x390c('0x44')]['id'];}return db[_0x390c('0x25')][_0x390c('0x42')]({'where':{'id':_0x4c94f8[_0x390c('0x41')]['id']}})['then'](handleEntityNotFound(_0xbb9a2b,null))[_0x390c('0x20')](saveUpdates(_0x4c94f8[_0x390c('0x44')],null))[_0x390c('0x20')](respondWithResult(_0xbb9a2b,null))[_0x390c('0x45')](handleError(_0xbb9a2b,null));};exports[_0x390c('0x21')]=function(_0x3b0348,_0x48cd0a){return db[_0x390c('0x25')]['find']({'where':{'id':_0x3b0348['params']['id']}})[_0x390c('0x20')](handleEntityNotFound(_0x48cd0a,null))[_0x390c('0x20')](removeEntity(_0x48cd0a,null))[_0x390c('0x45')](handleError(_0x48cd0a,null));};exports[_0x390c('0x47')]=function(_0x7aec79,_0x309ef2,_0x27c3a9){var _0x1648fe={};var _0x49899a={};var _0x44dcf9;var _0x2cd54e;return db['FreshsalesConfiguration'][_0x390c('0x48')]({'where':{'id':_0x7aec79[_0x390c('0x41')]['id']}})[_0x390c('0x20')](handleEntityNotFound(_0x309ef2,null))[_0x390c('0x20')](function(_0x11005f){if(_0x11005f){_0x44dcf9=_0x11005f;_0x49899a['model']=_[_0x390c('0x2b')](db[_0x390c('0x49')][_0x390c('0x26')]);_0x49899a['query']=_['keys'](_0x7aec79['query']);_0x49899a[_0x390c('0x34')]=_['intersection'](_0x49899a[_0x390c('0x29')],_0x49899a[_0x390c('0x2a')]);_0x1648fe[_0x390c('0x2d')]=_[_0x390c('0x2c')](_0x49899a[_0x390c('0x29')],qs[_0x390c('0x2e')](_0x7aec79[_0x390c('0x2a')][_0x390c('0x2e')]));_0x1648fe[_0x390c('0x2d')]=_0x1648fe[_0x390c('0x2d')][_0x390c('0x2f')]?_0x1648fe[_0x390c('0x2d')]:_0x49899a[_0x390c('0x29')];_0x1648fe[_0x390c('0x31')]=qs[_0x390c('0x32')](_0x7aec79[_0x390c('0x2a')][_0x390c('0x32')]);_0x1648fe['where']=qs[_0x390c('0x34')](_['pick'](_0x7aec79[_0x390c('0x2a')],_0x49899a[_0x390c('0x34')]));if(_0x7aec79[_0x390c('0x2a')]['filter']){_0x1648fe[_0x390c('0x33')]=_[_0x390c('0x3a')](_0x1648fe['where'],{'$or':_[_0x390c('0x37')](_0x1648fe[_0x390c('0x2d')],function(_0xc21c8e){var _0x150aa4={};_0x150aa4[_0xc21c8e]={'$like':'%'+_0x7aec79[_0x390c('0x2a')][_0x390c('0x36')]+'%'};return _0x150aa4;})});}_0x1648fe=_[_0x390c('0x3a')]({},_0x1648fe,_0x7aec79[_0x390c('0x3b')]);return _0x44dcf9[_0x390c('0x47')](_0x1648fe);}})[_0x390c('0x20')](function(_0x5eef66){if(_0x5eef66){_0x2cd54e=_0x5eef66['length'];if(!_0x7aec79['query']['hasOwnProperty']('nolimit')){_0x1648fe['limit']=qs[_0x390c('0x1b')](_0x7aec79[_0x390c('0x2a')]['limit']);_0x1648fe[_0x390c('0x18')]=qs[_0x390c('0x18')](_0x7aec79[_0x390c('0x2a')][_0x390c('0x18')]);}return _0x44dcf9[_0x390c('0x47')](_0x1648fe);}})['then'](function(_0xf703ae){if(_0xf703ae){return _0xf703ae?{'count':_0x2cd54e,'rows':_0xf703ae}:null;}})[_0x390c('0x20')](respondWithResult(_0x309ef2,null))[_0x390c('0x45')](handleError(_0x309ef2,null));};exports[_0x390c('0x4a')]=function(_0x3a1b5c,_0x1da643,_0x4f2be9){var _0x3b1bba={};var _0x3f431c={};var _0x29dfd1;var _0x4dbb30;return db[_0x390c('0x25')][_0x390c('0x48')]({'where':{'id':_0x3a1b5c[_0x390c('0x41')]['id']}})[_0x390c('0x20')](handleEntityNotFound(_0x1da643,null))[_0x390c('0x20')](function(_0x46a626){if(_0x46a626){_0x29dfd1=_0x46a626;_0x3f431c[_0x390c('0x29')]=_['keys'](db['FreshsalesField'][_0x390c('0x26')]);_0x3f431c[_0x390c('0x2a')]=_[_0x390c('0x2b')](_0x3a1b5c[_0x390c('0x2a')]);_0x3f431c[_0x390c('0x34')]=_['intersection'](_0x3f431c[_0x390c('0x29')],_0x3f431c[_0x390c('0x2a')]);_0x3b1bba[_0x390c('0x2d')]=_[_0x390c('0x2c')](_0x3f431c[_0x390c('0x29')],qs['fields'](_0x3a1b5c['query'][_0x390c('0x2e')]));_0x3b1bba[_0x390c('0x2d')]=_0x3b1bba[_0x390c('0x2d')][_0x390c('0x2f')]?_0x3b1bba[_0x390c('0x2d')]:_0x3f431c[_0x390c('0x29')];_0x3b1bba[_0x390c('0x31')]=qs['sort'](_0x3a1b5c[_0x390c('0x2a')][_0x390c('0x32')]);_0x3b1bba[_0x390c('0x33')]=qs[_0x390c('0x34')](_['pick'](_0x3a1b5c[_0x390c('0x2a')],_0x3f431c['filters']));if(_0x3a1b5c[_0x390c('0x2a')]['filter']){_0x3b1bba[_0x390c('0x33')]=_[_0x390c('0x3a')](_0x3b1bba['where'],{'$or':_[_0x390c('0x37')](_0x3b1bba['attributes'],function(_0x1f0f08){var _0x31aef0={};_0x31aef0[_0x1f0f08]={'$like':'%'+_0x3a1b5c[_0x390c('0x2a')][_0x390c('0x36')]+'%'};return _0x31aef0;})});}_0x3b1bba=_[_0x390c('0x3a')]({},_0x3b1bba,_0x3a1b5c['options']);return _0x29dfd1['getDescriptions'](_0x3b1bba);}})[_0x390c('0x20')](function(_0x4ed9eb){if(_0x4ed9eb){_0x4dbb30=_0x4ed9eb[_0x390c('0x2f')];if(!_0x3a1b5c[_0x390c('0x2a')][_0x390c('0x4b')](_0x390c('0x30'))){_0x3b1bba['limit']=qs[_0x390c('0x1b')](_0x3a1b5c[_0x390c('0x2a')]['limit']);_0x3b1bba[_0x390c('0x18')]=qs[_0x390c('0x18')](_0x3a1b5c[_0x390c('0x2a')][_0x390c('0x18')]);}return _0x29dfd1['getDescriptions'](_0x3b1bba);}})['then'](function(_0x206697){if(_0x206697){return _0x206697?{'count':_0x4dbb30,'rows':_0x206697}:null;}})[_0x390c('0x20')](respondWithResult(_0x1da643,null))[_0x390c('0x45')](handleError(_0x1da643,null));};exports[_0x390c('0x4c')]=function(_0x16f829,_0x14fea2,_0x1097c6){var _0x58ea53={};var _0x1e5cc8={};var _0xdbe0f8;var _0x28bd43;return db['FreshsalesConfiguration'][_0x390c('0x48')]({'where':{'id':_0x16f829[_0x390c('0x41')]['id']}})[_0x390c('0x20')](handleEntityNotFound(_0x14fea2,null))[_0x390c('0x20')](function(_0x3277b7){if(_0x3277b7){_0xdbe0f8=_0x3277b7;_0x1e5cc8[_0x390c('0x29')]=_['keys'](db[_0x390c('0x49')][_0x390c('0x26')]);_0x1e5cc8[_0x390c('0x2a')]=_[_0x390c('0x2b')](_0x16f829[_0x390c('0x2a')]);_0x1e5cc8['filters']=_['intersection'](_0x1e5cc8[_0x390c('0x29')],_0x1e5cc8['query']);_0x58ea53[_0x390c('0x2d')]=_[_0x390c('0x2c')](_0x1e5cc8[_0x390c('0x29')],qs['fields'](_0x16f829[_0x390c('0x2a')][_0x390c('0x2e')]));_0x58ea53['attributes']=_0x58ea53['attributes'][_0x390c('0x2f')]?_0x58ea53['attributes']:_0x1e5cc8['model'];_0x58ea53['order']=qs[_0x390c('0x32')](_0x16f829['query']['sort']);_0x58ea53[_0x390c('0x33')]=qs[_0x390c('0x34')](_[_0x390c('0x35')](_0x16f829[_0x390c('0x2a')],_0x1e5cc8['filters']));if(_0x16f829[_0x390c('0x2a')][_0x390c('0x36')]){_0x58ea53[_0x390c('0x33')]=_[_0x390c('0x3a')](_0x58ea53['where'],{'$or':_[_0x390c('0x37')](_0x58ea53[_0x390c('0x2d')],function(_0x4ba2cd){var _0x327bfa={};_0x327bfa[_0x4ba2cd]={'$like':'%'+_0x16f829[_0x390c('0x2a')]['filter']+'%'};return _0x327bfa;})});}_0x58ea53=_[_0x390c('0x3a')]({},_0x58ea53,_0x16f829[_0x390c('0x3b')]);return _0xdbe0f8['getFields'](_0x58ea53);}})[_0x390c('0x20')](function(_0x30aeca){if(_0x30aeca){_0x28bd43=_0x30aeca['length'];if(!_0x16f829['query']['hasOwnProperty'](_0x390c('0x30'))){_0x58ea53[_0x390c('0x1b')]=qs[_0x390c('0x1b')](_0x16f829['query'][_0x390c('0x1b')]);_0x58ea53[_0x390c('0x18')]=qs[_0x390c('0x18')](_0x16f829[_0x390c('0x2a')][_0x390c('0x18')]);}return _0xdbe0f8[_0x390c('0x4c')](_0x58ea53);}})[_0x390c('0x20')](function(_0x2c9274){if(_0x2c9274){return _0x2c9274?{'count':_0x28bd43,'rows':_0x2c9274}:null;}})[_0x390c('0x20')](respondWithResult(_0x14fea2,null))[_0x390c('0x45')](handleError(_0x14fea2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 3bbafe3..cfcd0ca 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 _0xba3e=['lodash','util','api','moment','bluebird','request-promise','path','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xba3e,0x120));var _0xeba3=function(_0x4e7776,_0x3db0c4){_0x4e7776=_0x4e7776-0x0;var _0x434ada=_0xba3e[_0x4e7776];return _0x434ada;};'use strict';var _=require(_0xeba3('0x0'));var util=require(_0xeba3('0x1'));var logger=require('../../config/logger')(_0xeba3('0x2'));var moment=require(_0xeba3('0x3'));var BPromise=require(_0xeba3('0x4'));var rp=require(_0xeba3('0x5'));var fs=require('fs');var path=require(_0xeba3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeba3('0x7'));module[_0xeba3('0x8')]=function(_0x5c38bc,_0x24f238){return _0x5c38bc[_0xeba3('0x9')](_0xeba3('0xa'),attributes,{'tableName':_0xeba3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd4f=['int_freshsales_configurations','lodash','api','moment','bluebird','path','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0xcd4f,0xeb));var _0xfcd4=function(_0x296ee6,_0x2c9872){_0x296ee6=_0x296ee6-0x0;var _0x38d838=_0xcd4f[_0x296ee6];return _0x38d838;};'use strict';var _=require(_0xfcd4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfcd4('0x1'));var moment=require(_0xfcd4('0x2'));var BPromise=require(_0xfcd4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcd4('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfcd4('0x5'));module['exports']=function(_0x5b0231,_0x4b1e25){return _0x5b0231[_0xfcd4('0x6')](_0xfcd4('0x7'),attributes,{'tableName':_0xfcd4('0x8'),'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 d7aa6c6..a0994a3 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 _0xf995=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x3dcb96,_0x77f188){var _0x3a9582=function(_0x4f545b){while(--_0x4f545b){_0x3dcb96['push'](_0x3dcb96['shift']());}};_0x3a9582(++_0x77f188);}(_0xf995,0xf0));var _0x5f99=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf995[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x5f99('0x0'));var util=require(_0x5f99('0x1'));var moment=require(_0x5f99('0x2'));var BPromise=require(_0x5f99('0x3'));var rs=require(_0x5f99('0x4'));var fs=require('fs');var Redis=require(_0x5f99('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f99('0x6'));var logger=require(_0x5f99('0x7'))(_0x5f99('0x8'));var config=require('../../config/environment');var jayson=require(_0x5f99('0x9'));var client=jayson['client'][_0x5f99('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x364104,_0x2d192e,_0x6888c){return new BPromise(function(_0x15f6e2,_0x4b0b2b){return client['request'](_0x364104,_0x6888c)[_0x5f99('0xb')](function(_0x50d8af){logger[_0x5f99('0xc')](_0x5f99('0xd'),_0x2d192e,_0x5f99('0xe'));logger[_0x5f99('0xf')](_0x5f99('0x10'),_0x2d192e,_0x5f99('0xe'),JSON[_0x5f99('0x11')](_0x50d8af));if(_0x50d8af[_0x5f99('0x12')]){if(_0x50d8af['error'][_0x5f99('0x13')]===0x1f4){logger[_0x5f99('0x12')](_0x5f99('0xd'),_0x2d192e,_0x50d8af[_0x5f99('0x12')][_0x5f99('0x14')]);return _0x4b0b2b(_0x50d8af[_0x5f99('0x12')]['message']);}logger[_0x5f99('0x12')](_0x5f99('0xd'),_0x2d192e,_0x50d8af[_0x5f99('0x12')][_0x5f99('0x14')]);return _0x15f6e2(_0x50d8af[_0x5f99('0x12')][_0x5f99('0x14')]);}else{logger[_0x5f99('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2d192e,'request\x20sent');_0x15f6e2(_0x50d8af['result'][_0x5f99('0x14')]);}})[_0x5f99('0x15')](function(_0x19f9a4){logger[_0x5f99('0x12')](_0x5f99('0xd'),_0x2d192e,_0x19f9a4);_0x4b0b2b(_0x19f9a4);});});} \ No newline at end of file +var _0x889d=['jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x12ef2e,_0x412417){var _0x582975=function(_0x1cdd64){while(--_0x1cdd64){_0x12ef2e['push'](_0x12ef2e['shift']());}};_0x582975(++_0x412417);}(_0x889d,0xcb));var _0xd889=function(_0x9d37d9,_0x4cdbf8){_0x9d37d9=_0x9d37d9-0x0;var _0x22db05=_0x889d[_0x9d37d9];return _0x22db05;};'use strict';var _=require(_0xd889('0x0'));var util=require(_0xd889('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd889('0x2'));var fs=require('fs');var Redis=require(_0xd889('0x3'));var db=require(_0xd889('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd889('0x5'))('rpc');var config=require(_0xd889('0x6'));var jayson=require(_0xd889('0x7'));var client=jayson[_0xd889('0x8')][_0xd889('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2192c8,_0x3b43ba,_0x5914ea){return new BPromise(function(_0x449834,_0x1c165e){return client[_0xd889('0xa')](_0x2192c8,_0x5914ea)[_0xd889('0xb')](function(_0x388bc3){logger[_0xd889('0xc')](_0xd889('0xd'),_0x3b43ba,_0xd889('0xe'));logger[_0xd889('0xf')](_0xd889('0x10'),_0x3b43ba,_0xd889('0xe'),JSON[_0xd889('0x11')](_0x388bc3));if(_0x388bc3[_0xd889('0x12')]){if(_0x388bc3[_0xd889('0x12')][_0xd889('0x13')]===0x1f4){logger['error'](_0xd889('0xd'),_0x3b43ba,_0x388bc3['error']['message']);return _0x1c165e(_0x388bc3[_0xd889('0x12')][_0xd889('0x14')]);}logger[_0xd889('0x12')](_0xd889('0xd'),_0x3b43ba,_0x388bc3[_0xd889('0x12')][_0xd889('0x14')]);return _0x449834(_0x388bc3[_0xd889('0x12')][_0xd889('0x14')]);}else{logger[_0xd889('0xc')](_0xd889('0xd'),_0x3b43ba,_0xd889('0xe'));_0x449834(_0x388bc3['result'][_0xd889('0x14')]);}})['catch'](function(_0x4dcce9){logger[_0xd889('0x12')](_0xd889('0xd'),_0x3b43ba,_0x4dcce9);_0x1c165e(_0x4dcce9);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index f25602f..9ef3e1c 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 _0x0aaf=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','create','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0x1d603a,_0x2b814e){_0x1d603a=_0x1d603a-0x0;var _0x4b76b4=_0x0aaf[_0x1d603a];return _0x4b76b4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf0aa('0x0'));var timeout=require(_0xf0aa('0x1'));var express=require(_0xf0aa('0x2'));var router=express[_0xf0aa('0x3')]();var fs_extra=require(_0xf0aa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf0aa('0x5'));var config=require(_0xf0aa('0x6'));var controller=require('./intFreshsalesField.controller');router[_0xf0aa('0x7')]('/',auth['isAuthenticated'](),controller[_0xf0aa('0x8')]);router['get'](_0xf0aa('0x9'),auth[_0xf0aa('0xa')](),controller[_0xf0aa('0xb')]);router['post']('/',auth[_0xf0aa('0xa')](),controller[_0xf0aa('0xc')]);router['put'](_0xf0aa('0x9'),auth[_0xf0aa('0xa')](),controller[_0xf0aa('0xd')]);router[_0xf0aa('0xe')](_0xf0aa('0x9'),auth[_0xf0aa('0xa')](),controller[_0xf0aa('0xf')]);module[_0xf0aa('0x10')]=router; \ No newline at end of file +var _0xc7e9=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','post','create','put','update'];(function(_0x5ab6eb,_0x7a9ddf){var _0x30a8ce=function(_0x2b6ca7){while(--_0x2b6ca7){_0x5ab6eb['push'](_0x5ab6eb['shift']());}};_0x30a8ce(++_0x7a9ddf);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xc7e9[_0x1b6186];return _0x186121;};'use strict';var multer=require(_0x9c7e('0x0'));var util=require(_0x9c7e('0x1'));var path=require('path');var timeout=require(_0x9c7e('0x2'));var express=require(_0x9c7e('0x3'));var router=express[_0x9c7e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c7e('0x5'));var interaction=require(_0x9c7e('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0x9c7e('0x7')]('/',auth['isAuthenticated'](),controller[_0x9c7e('0x8')]);router[_0x9c7e('0x7')](_0x9c7e('0x9'),auth[_0x9c7e('0xa')](),controller['show']);router[_0x9c7e('0xb')]('/',auth[_0x9c7e('0xa')](),controller[_0x9c7e('0xc')]);router[_0x9c7e('0xd')]('/:id',auth[_0x9c7e('0xa')](),controller[_0x9c7e('0xe')]);router['delete'](_0x9c7e('0x9'),auth['isAuthenticated'](),controller[_0x9c7e('0xf')]);module[_0x9c7e('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 d9eeb79..8160b7a 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 _0x309b=['ENUM','variable','keyValue','string','STRING','customVariable','sequelize','exports'];(function(_0x392968,_0x22048a){var _0x2f58b0=function(_0x429b59){while(--_0x429b59){_0x392968['push'](_0x392968['shift']());}};_0x2f58b0(++_0x22048a);}(_0x309b,0x1d6));var _0xb309=function(_0x245af2,_0x413b85){_0x245af2=_0x245af2-0x0;var _0x27a341=_0x309b[_0x245af2];return _0x27a341;};'use strict';var Sequelize=require(_0xb309('0x0'));module[_0xb309('0x1')]={'type':{'type':Sequelize[_0xb309('0x2')]('string',_0xb309('0x3'),'customVariable',_0xb309('0x4'),'picklist'),'defaultValue':_0xb309('0x5')},'content':{'type':Sequelize[_0xb309('0x6')]},'key':{'type':Sequelize[_0xb309('0x6')]},'keyType':{'type':Sequelize[_0xb309('0x2')](_0xb309('0x5'),_0xb309('0x3'),_0xb309('0x7'))},'keyContent':{'type':Sequelize[_0xb309('0x6')]},'idField':{'type':Sequelize[_0xb309('0x6')]},'nameField':{'type':Sequelize[_0xb309('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb309('0x6')]}}; \ No newline at end of file +var _0x3d41=['customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN','sequelize','exports','variable'];(function(_0x3a56d1,_0x433541){var _0x1a6a75=function(_0x33b51c){while(--_0x33b51c){_0x3a56d1['push'](_0x3a56d1['shift']());}};_0x1a6a75(++_0x433541);}(_0x3d41,0x1bf));var _0x13d4=function(_0x43d701,_0x4bb2e9){_0x43d701=_0x43d701-0x0;var _0x2ec4c6=_0x3d41[_0x43d701];return _0x2ec4c6;};'use strict';var Sequelize=require(_0x13d4('0x0'));module[_0x13d4('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x13d4('0x2'),_0x13d4('0x3'),_0x13d4('0x4'),_0x13d4('0x5')),'defaultValue':_0x13d4('0x6')},'content':{'type':Sequelize[_0x13d4('0x7')]},'key':{'type':Sequelize[_0x13d4('0x7')]},'keyType':{'type':Sequelize[_0x13d4('0x8')]('string',_0x13d4('0x2'),_0x13d4('0x3'))},'keyContent':{'type':Sequelize[_0x13d4('0x7')]},'idField':{'type':Sequelize[_0x13d4('0x7')]},'nameField':{'type':Sequelize[_0x13d4('0x7')]},'customField':{'type':Sequelize[_0x13d4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x13d4('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index ce26253..048ea98 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 _0x4793=['querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','stack','name','send','index','map','FreshsalesField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','create','body','find','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x102031,_0x28fa77){var _0x44da4f=function(_0x15639a){while(--_0x15639a){_0x102031['push'](_0x102031['shift']());}};_0x44da4f(++_0x28fa77);}(_0x4793,0x1b9));var _0x3479=function(_0x3cd3e4,_0x1fabb8){_0x3cd3e4=_0x3cd3e4-0x0;var _0x12d75c=_0x4793[_0x3cd3e4];return _0x12d75c;};'use strict';var emlformat=require(_0x3479('0x0'));var rimraf=require(_0x3479('0x1'));var zipdir=require(_0x3479('0x2'));var jsonpatch=require(_0x3479('0x3'));var rp=require(_0x3479('0x4'));var moment=require('moment');var BPromise=require(_0x3479('0x5'));var Mustache=require(_0x3479('0x6'));var util=require(_0x3479('0x7'));var path=require('path');var sox=require(_0x3479('0x8'));var csv=require(_0x3479('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3479('0xa'));var _=require(_0x3479('0xb'));var squel=require(_0x3479('0xc'));var crypto=require(_0x3479('0xd'));var jsforce=require(_0x3479('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3479('0x9'));var querystring=require(_0x3479('0xf'));var Papa=require('papaparse');var Redis=require(_0x3479('0x10'));var authService=require(_0x3479('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3479('0x12'));var hardwareService=require(_0x3479('0x13'));var logger=require(_0x3479('0x14'))(_0x3479('0x15'));var utils=require('../../config/utils');var config=require(_0x3479('0x16'));var licenseUtil=require(_0x3479('0x17'));var db=require(_0x3479('0x18'))['db'];function respondWithStatusCode(_0xcb32d2,_0x1eeae4){_0x1eeae4=_0x1eeae4||0xcc;return function(_0x482bf9){if(_0x482bf9){return _0xcb32d2[_0x3479('0x19')](_0x1eeae4);}return _0xcb32d2[_0x3479('0x1a')](_0x1eeae4)['end']();};}function respondWithResult(_0x288cda,_0x58e46d){_0x58e46d=_0x58e46d||0xc8;return function(_0x58e00a){if(_0x58e00a){return _0x288cda[_0x3479('0x1a')](_0x58e46d)['json'](_0x58e00a);}};}function respondWithFilteredResult(_0x3d7055,_0x5b5ad){return function(_0x2b43d1){if(_0x2b43d1){var _0x1a831e=typeof _0x5b5ad[_0x3479('0x1b')]===_0x3479('0x1c')&&typeof _0x5b5ad[_0x3479('0x1d')]==='undefined';var _0x3840da=_0x2b43d1[_0x3479('0x1e')];var _0x3f248a=_0x1a831e?0x0:_0x5b5ad[_0x3479('0x1b')];var _0x4c22c4=_0x1a831e?_0x2b43d1[_0x3479('0x1e')]:_0x5b5ad[_0x3479('0x1b')]+_0x5b5ad[_0x3479('0x1d')];var _0x86541f;if(_0x4c22c4>=_0x3840da){_0x4c22c4=_0x3840da;_0x86541f=0xc8;}else{_0x86541f=0xce;}_0x3d7055[_0x3479('0x1a')](_0x86541f);return _0x3d7055[_0x3479('0x1f')](_0x3479('0x20'),_0x3f248a+'-'+_0x4c22c4+'/'+_0x3840da)[_0x3479('0x21')](_0x2b43d1);}return null;};}function patchUpdates(_0x2d7ab5){return function(_0x2fc8e9){try{jsonpatch[_0x3479('0x22')](_0x2fc8e9,_0x2d7ab5,!![]);}catch(_0x3d93ef){return BPromise[_0x3479('0x23')](_0x3d93ef);}return _0x2fc8e9[_0x3479('0x24')]();};}function saveUpdates(_0x23e954,_0x46c999){return function(_0xc60324){if(_0xc60324){return _0xc60324[_0x3479('0x25')](_0x23e954)[_0x3479('0x26')](function(_0x5d8f49){return _0x5d8f49;});}return null;};}function removeEntity(_0x3baf3e,_0x43beff){return function(_0x4838d7){if(_0x4838d7){return _0x4838d7['destroy']()[_0x3479('0x26')](function(){_0x3baf3e[_0x3479('0x1a')](0xcc)[_0x3479('0x27')]();});}};}function handleEntityNotFound(_0x109888,_0x2ef6e9){return function(_0xa6554c){if(!_0xa6554c){_0x109888[_0x3479('0x19')](0x194);}return _0xa6554c;};}function handleError(_0x17961b,_0x4a92d6){_0x4a92d6=_0x4a92d6||0x1f4;return function(_0x1ab854){logger['error'](_0x1ab854[_0x3479('0x28')]);if(_0x1ab854[_0x3479('0x29')]){delete _0x1ab854[_0x3479('0x29')];}_0x17961b[_0x3479('0x1a')](_0x4a92d6)[_0x3479('0x2a')](_0x1ab854);};}exports[_0x3479('0x2b')]=function(_0x4aaa8c,_0x26297f){var _0x1c7e96={},_0xefe7e6={},_0xb7c456={'count':0x0,'rows':[]};var _0xcdea43=_[_0x3479('0x2c')](db[_0x3479('0x2d')][_0x3479('0x2e')],function(_0x3a8499){return{'name':_0x3a8499['fieldName'],'type':_0x3a8499[_0x3479('0x2f')][_0x3479('0x30')]};});_0xefe7e6[_0x3479('0x31')]=_[_0x3479('0x2c')](_0xcdea43,'name');_0xefe7e6[_0x3479('0x32')]=_[_0x3479('0x33')](_0x4aaa8c[_0x3479('0x32')]);_0xefe7e6[_0x3479('0x34')]=_[_0x3479('0x35')](_0xefe7e6[_0x3479('0x31')],_0xefe7e6[_0x3479('0x32')]);_0x1c7e96[_0x3479('0x36')]=_['intersection'](_0xefe7e6[_0x3479('0x31')],qs['fields'](_0x4aaa8c[_0x3479('0x32')][_0x3479('0x37')]));_0x1c7e96[_0x3479('0x36')]=_0x1c7e96[_0x3479('0x36')][_0x3479('0x38')]?_0x1c7e96['attributes']:_0xefe7e6[_0x3479('0x31')];if(!_0x4aaa8c[_0x3479('0x32')][_0x3479('0x39')](_0x3479('0x3a'))){_0x1c7e96[_0x3479('0x1d')]=qs[_0x3479('0x1d')](_0x4aaa8c['query'][_0x3479('0x1d')]);_0x1c7e96[_0x3479('0x1b')]=qs[_0x3479('0x1b')](_0x4aaa8c[_0x3479('0x32')][_0x3479('0x1b')]);}_0x1c7e96[_0x3479('0x3b')]=qs[_0x3479('0x3c')](_0x4aaa8c[_0x3479('0x32')]['sort']);_0x1c7e96[_0x3479('0x3d')]=qs[_0x3479('0x34')](_[_0x3479('0x3e')](_0x4aaa8c[_0x3479('0x32')],_0xefe7e6[_0x3479('0x34')]),_0xcdea43);if(_0x4aaa8c['query'][_0x3479('0x3f')]){_0x1c7e96[_0x3479('0x3d')]=_['merge'](_0x1c7e96['where'],{'$or':_[_0x3479('0x2c')](_0xcdea43,function(_0x21784e){if(_0x21784e[_0x3479('0x2f')]!==_0x3479('0x40')){var _0x158bff={};_0x158bff[_0x21784e[_0x3479('0x29')]]={'$like':'%'+_0x4aaa8c[_0x3479('0x32')]['filter']+'%'};return _0x158bff;}})});}_0x1c7e96=_[_0x3479('0x41')]({},_0x1c7e96,_0x4aaa8c[_0x3479('0x42')]);var _0x23c537={'where':_0x1c7e96[_0x3479('0x3d')]};return db[_0x3479('0x2d')]['count'](_0x23c537)[_0x3479('0x26')](function(_0x4bac5f){_0xb7c456[_0x3479('0x1e')]=_0x4bac5f;if(_0x4aaa8c[_0x3479('0x32')][_0x3479('0x43')]){_0x1c7e96[_0x3479('0x44')]=[{'all':!![]}];}return db[_0x3479('0x2d')]['findAll'](_0x1c7e96);})[_0x3479('0x26')](function(_0x4fe703){_0xb7c456['rows']=_0x4fe703;return _0xb7c456;})[_0x3479('0x26')](respondWithFilteredResult(_0x26297f,_0x1c7e96))[_0x3479('0x45')](handleError(_0x26297f,null));};exports[_0x3479('0x46')]=function(_0x1ade75,_0x35b9df){var _0x4d67b6={'raw':!![],'where':{'id':_0x1ade75['params']['id']}},_0x29bffc={};_0x29bffc[_0x3479('0x31')]=_[_0x3479('0x33')](db[_0x3479('0x2d')][_0x3479('0x2e')]);_0x29bffc[_0x3479('0x32')]=_['keys'](_0x1ade75[_0x3479('0x32')]);_0x29bffc[_0x3479('0x34')]=_['intersection'](_0x29bffc[_0x3479('0x31')],_0x29bffc[_0x3479('0x32')]);_0x4d67b6[_0x3479('0x36')]=_[_0x3479('0x35')](_0x29bffc[_0x3479('0x31')],qs[_0x3479('0x37')](_0x1ade75['query'][_0x3479('0x37')]));_0x4d67b6[_0x3479('0x36')]=_0x4d67b6[_0x3479('0x36')][_0x3479('0x38')]?_0x4d67b6['attributes']:_0x29bffc[_0x3479('0x31')];if(_0x1ade75[_0x3479('0x32')][_0x3479('0x43')]){_0x4d67b6[_0x3479('0x44')]=[{'all':!![]}];}_0x4d67b6=_[_0x3479('0x41')]({},_0x4d67b6,_0x1ade75[_0x3479('0x42')]);return db[_0x3479('0x2d')]['find'](_0x4d67b6)[_0x3479('0x26')](handleEntityNotFound(_0x35b9df,null))['then'](respondWithResult(_0x35b9df,null))[_0x3479('0x45')](handleError(_0x35b9df,null));};exports['create']=function(_0x667e6d,_0x265c56){return db['FreshsalesField'][_0x3479('0x47')](_0x667e6d[_0x3479('0x48')],{})[_0x3479('0x26')](respondWithResult(_0x265c56,0xc9))[_0x3479('0x45')](handleError(_0x265c56,null));};exports[_0x3479('0x25')]=function(_0x5b0642,_0x54021f){if(_0x5b0642[_0x3479('0x48')]['id']){delete _0x5b0642[_0x3479('0x48')]['id'];}return db[_0x3479('0x2d')][_0x3479('0x49')]({'where':{'id':_0x5b0642[_0x3479('0x4a')]['id']}})[_0x3479('0x26')](handleEntityNotFound(_0x54021f,null))['then'](saveUpdates(_0x5b0642['body'],null))[_0x3479('0x26')](respondWithResult(_0x54021f,null))[_0x3479('0x45')](handleError(_0x54021f,null));};exports[_0x3479('0x4b')]=function(_0x408a88,_0x257da9){return db[_0x3479('0x2d')][_0x3479('0x49')]({'where':{'id':_0x408a88[_0x3479('0x4a')]['id']}})[_0x3479('0x26')](handleEntityNotFound(_0x257da9,null))[_0x3479('0x26')](removeEntity(_0x257da9,null))[_0x3479('0x45')](handleError(_0x257da9,null));}; \ No newline at end of file +var _0xf7c0=['rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','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','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','FreshsalesField','rows','catch','show','params','rawAttributes','find','create','body','eml-format'];(function(_0x421e5c,_0x3cb2ac){var _0x457ccb=function(_0x4c30cf){while(--_0x4c30cf){_0x421e5c['push'](_0x421e5c['shift']());}};_0x457ccb(++_0x3cb2ac);}(_0xf7c0,0x12b));var _0x0f7c=function(_0x58385a,_0x10c3e3){_0x58385a=_0x58385a-0x0;var _0x5b531a=_0xf7c0[_0x58385a];return _0x5b531a;};'use strict';var emlformat=require(_0x0f7c('0x0'));var rimraf=require(_0x0f7c('0x1'));var zipdir=require(_0x0f7c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f7c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0f7c('0x4'));var util=require('util');var path=require(_0x0f7c('0x5'));var sox=require(_0x0f7c('0x6'));var csv=require(_0x0f7c('0x7'));var ejs=require(_0x0f7c('0x8'));var fs=require('fs');var fs_extra=require(_0x0f7c('0x9'));var _=require('lodash');var squel=require(_0x0f7c('0xa'));var crypto=require(_0x0f7c('0xb'));var jsforce=require(_0x0f7c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0f7c('0x7'));var querystring=require(_0x0f7c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0f7c('0xe'));var qs=require(_0x0f7c('0xf'));var as=require(_0x0f7c('0x10'));var hardwareService=require(_0x0f7c('0x11'));var logger=require(_0x0f7c('0x12'))(_0x0f7c('0x13'));var utils=require(_0x0f7c('0x14'));var config=require(_0x0f7c('0x15'));var licenseUtil=require(_0x0f7c('0x16'));var db=require(_0x0f7c('0x17'))['db'];function respondWithStatusCode(_0x5b6967,_0x50af9c){_0x50af9c=_0x50af9c||0xcc;return function(_0x19bfbd){if(_0x19bfbd){return _0x5b6967[_0x0f7c('0x18')](_0x50af9c);}return _0x5b6967[_0x0f7c('0x19')](_0x50af9c)[_0x0f7c('0x1a')]();};}function respondWithResult(_0x1cf481,_0x3988ee){_0x3988ee=_0x3988ee||0xc8;return function(_0x7fac95){if(_0x7fac95){return _0x1cf481[_0x0f7c('0x19')](_0x3988ee)['json'](_0x7fac95);}};}function respondWithFilteredResult(_0x39b0ed,_0x359d91){return function(_0x3e07af){if(_0x3e07af){var _0x4c090f=typeof _0x359d91[_0x0f7c('0x1b')]===_0x0f7c('0x1c')&&typeof _0x359d91[_0x0f7c('0x1d')]==='undefined';var _0x146d76=_0x3e07af[_0x0f7c('0x1e')];var _0x1bd1de=_0x4c090f?0x0:_0x359d91[_0x0f7c('0x1b')];var _0x5d6fd5=_0x4c090f?_0x3e07af[_0x0f7c('0x1e')]:_0x359d91[_0x0f7c('0x1b')]+_0x359d91[_0x0f7c('0x1d')];var _0x53cb01;if(_0x5d6fd5>=_0x146d76){_0x5d6fd5=_0x146d76;_0x53cb01=0xc8;}else{_0x53cb01=0xce;}_0x39b0ed[_0x0f7c('0x19')](_0x53cb01);return _0x39b0ed[_0x0f7c('0x1f')](_0x0f7c('0x20'),_0x1bd1de+'-'+_0x5d6fd5+'/'+_0x146d76)['json'](_0x3e07af);}return null;};}function patchUpdates(_0x4b2549){return function(_0x31ccb8){try{jsonpatch[_0x0f7c('0x21')](_0x31ccb8,_0x4b2549,!![]);}catch(_0x52e604){return BPromise[_0x0f7c('0x22')](_0x52e604);}return _0x31ccb8[_0x0f7c('0x23')]();};}function saveUpdates(_0x4ce1cd,_0x54e77b){return function(_0xb8ed84){if(_0xb8ed84){return _0xb8ed84[_0x0f7c('0x24')](_0x4ce1cd)[_0x0f7c('0x25')](function(_0x3ab018){return _0x3ab018;});}return null;};}function removeEntity(_0x2b3025,_0x4e5e29){return function(_0x13a6d3){if(_0x13a6d3){return _0x13a6d3[_0x0f7c('0x26')]()[_0x0f7c('0x25')](function(){_0x2b3025[_0x0f7c('0x19')](0xcc)[_0x0f7c('0x1a')]();});}};}function handleEntityNotFound(_0x30bf4a,_0x25b11e){return function(_0x2f75e5){if(!_0x2f75e5){_0x30bf4a['sendStatus'](0x194);}return _0x2f75e5;};}function handleError(_0x5a5fa8,_0x5debf5){_0x5debf5=_0x5debf5||0x1f4;return function(_0x30d70f){logger[_0x0f7c('0x27')](_0x30d70f[_0x0f7c('0x28')]);if(_0x30d70f[_0x0f7c('0x29')]){delete _0x30d70f[_0x0f7c('0x29')];}_0x5a5fa8[_0x0f7c('0x19')](_0x5debf5)[_0x0f7c('0x2a')](_0x30d70f);};}exports[_0x0f7c('0x2b')]=function(_0x4c8256,_0x1d4d3b){var _0x5c4a5e={},_0x4be54e={},_0x14872c={'count':0x0,'rows':[]};var _0x39d25f=_['map'](db['FreshsalesField']['rawAttributes'],function(_0x39644c){return{'name':_0x39644c[_0x0f7c('0x2c')],'type':_0x39644c['type'][_0x0f7c('0x2d')]};});_0x4be54e[_0x0f7c('0x2e')]=_[_0x0f7c('0x2f')](_0x39d25f,_0x0f7c('0x29'));_0x4be54e[_0x0f7c('0x30')]=_[_0x0f7c('0x31')](_0x4c8256[_0x0f7c('0x30')]);_0x4be54e['filters']=_[_0x0f7c('0x32')](_0x4be54e[_0x0f7c('0x2e')],_0x4be54e[_0x0f7c('0x30')]);_0x5c4a5e[_0x0f7c('0x33')]=_['intersection'](_0x4be54e['model'],qs[_0x0f7c('0x34')](_0x4c8256['query'][_0x0f7c('0x34')]));_0x5c4a5e[_0x0f7c('0x33')]=_0x5c4a5e[_0x0f7c('0x33')][_0x0f7c('0x35')]?_0x5c4a5e[_0x0f7c('0x33')]:_0x4be54e[_0x0f7c('0x2e')];if(!_0x4c8256[_0x0f7c('0x30')]['hasOwnProperty'](_0x0f7c('0x36'))){_0x5c4a5e[_0x0f7c('0x1d')]=qs['limit'](_0x4c8256[_0x0f7c('0x30')][_0x0f7c('0x1d')]);_0x5c4a5e[_0x0f7c('0x1b')]=qs['offset'](_0x4c8256['query'][_0x0f7c('0x1b')]);}_0x5c4a5e[_0x0f7c('0x37')]=qs[_0x0f7c('0x38')](_0x4c8256[_0x0f7c('0x30')][_0x0f7c('0x38')]);_0x5c4a5e[_0x0f7c('0x39')]=qs[_0x0f7c('0x3a')](_[_0x0f7c('0x3b')](_0x4c8256[_0x0f7c('0x30')],_0x4be54e['filters']),_0x39d25f);if(_0x4c8256[_0x0f7c('0x30')][_0x0f7c('0x3c')]){_0x5c4a5e[_0x0f7c('0x39')]=_[_0x0f7c('0x3d')](_0x5c4a5e[_0x0f7c('0x39')],{'$or':_['map'](_0x39d25f,function(_0xdc13dc){if(_0xdc13dc[_0x0f7c('0x3e')]!==_0x0f7c('0x3f')){var _0x32fa73={};_0x32fa73[_0xdc13dc[_0x0f7c('0x29')]]={'$like':'%'+_0x4c8256['query'][_0x0f7c('0x3c')]+'%'};return _0x32fa73;}})});}_0x5c4a5e=_[_0x0f7c('0x3d')]({},_0x5c4a5e,_0x4c8256[_0x0f7c('0x40')]);var _0x1c6fa7={'where':_0x5c4a5e[_0x0f7c('0x39')]};return db['FreshsalesField'][_0x0f7c('0x1e')](_0x1c6fa7)[_0x0f7c('0x25')](function(_0x2968d3){_0x14872c[_0x0f7c('0x1e')]=_0x2968d3;if(_0x4c8256[_0x0f7c('0x30')]['includeAll']){_0x5c4a5e[_0x0f7c('0x41')]=[{'all':!![]}];}return db[_0x0f7c('0x42')]['findAll'](_0x5c4a5e);})[_0x0f7c('0x25')](function(_0x14619f){_0x14872c[_0x0f7c('0x43')]=_0x14619f;return _0x14872c;})['then'](respondWithFilteredResult(_0x1d4d3b,_0x5c4a5e))[_0x0f7c('0x44')](handleError(_0x1d4d3b,null));};exports[_0x0f7c('0x45')]=function(_0x10913e,_0x53c4e7){var _0xe0e56b={'raw':!![],'where':{'id':_0x10913e[_0x0f7c('0x46')]['id']}},_0x5e4b66={};_0x5e4b66['model']=_[_0x0f7c('0x31')](db[_0x0f7c('0x42')][_0x0f7c('0x47')]);_0x5e4b66[_0x0f7c('0x30')]=_[_0x0f7c('0x31')](_0x10913e[_0x0f7c('0x30')]);_0x5e4b66['filters']=_[_0x0f7c('0x32')](_0x5e4b66[_0x0f7c('0x2e')],_0x5e4b66['query']);_0xe0e56b[_0x0f7c('0x33')]=_['intersection'](_0x5e4b66[_0x0f7c('0x2e')],qs[_0x0f7c('0x34')](_0x10913e['query'][_0x0f7c('0x34')]));_0xe0e56b[_0x0f7c('0x33')]=_0xe0e56b[_0x0f7c('0x33')][_0x0f7c('0x35')]?_0xe0e56b[_0x0f7c('0x33')]:_0x5e4b66[_0x0f7c('0x2e')];if(_0x10913e[_0x0f7c('0x30')]['includeAll']){_0xe0e56b[_0x0f7c('0x41')]=[{'all':!![]}];}_0xe0e56b=_[_0x0f7c('0x3d')]({},_0xe0e56b,_0x10913e[_0x0f7c('0x40')]);return db['FreshsalesField'][_0x0f7c('0x48')](_0xe0e56b)['then'](handleEntityNotFound(_0x53c4e7,null))[_0x0f7c('0x25')](respondWithResult(_0x53c4e7,null))[_0x0f7c('0x44')](handleError(_0x53c4e7,null));};exports[_0x0f7c('0x49')]=function(_0x40c20a,_0x457778){return db[_0x0f7c('0x42')][_0x0f7c('0x49')](_0x40c20a[_0x0f7c('0x4a')],{})[_0x0f7c('0x25')](respondWithResult(_0x457778,0xc9))[_0x0f7c('0x44')](handleError(_0x457778,null));};exports[_0x0f7c('0x24')]=function(_0x4fbaae,_0x563695){if(_0x4fbaae[_0x0f7c('0x4a')]['id']){delete _0x4fbaae[_0x0f7c('0x4a')]['id'];}return db['FreshsalesField'][_0x0f7c('0x48')]({'where':{'id':_0x4fbaae['params']['id']}})['then'](handleEntityNotFound(_0x563695,null))[_0x0f7c('0x25')](saveUpdates(_0x4fbaae[_0x0f7c('0x4a')],null))[_0x0f7c('0x25')](respondWithResult(_0x563695,null))['catch'](handleError(_0x563695,null));};exports['destroy']=function(_0x261758,_0x169c5a){return db['FreshsalesField'][_0x0f7c('0x48')]({'where':{'id':_0x261758[_0x0f7c('0x46')]['id']}})[_0x0f7c('0x25')](handleEntityNotFound(_0x169c5a,null))[_0x0f7c('0x25')](removeEntity(_0x169c5a,null))[_0x0f7c('0x44')](handleError(_0x169c5a,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 5a696fd..638f851 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 _0xae8e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae8e,0xc3));var _0xeae8=function(_0x317dd9,_0x599846){_0x317dd9=_0x317dd9-0x0;var _0xba50ec=_0xae8e[_0x317dd9];return _0xba50ec;};'use strict';var _=require(_0xeae8('0x0'));var util=require(_0xeae8('0x1'));var logger=require(_0xeae8('0x2'))(_0xeae8('0x3'));var moment=require(_0xeae8('0x4'));var BPromise=require(_0xeae8('0x5'));var rp=require(_0xeae8('0x6'));var fs=require('fs');var path=require(_0xeae8('0x7'));var rimraf=require(_0xeae8('0x8'));var config=require(_0xeae8('0x9'));var attributes=require(_0xeae8('0xa'));module[_0xeae8('0xb')]=function(_0x23b0d7,_0x17345e){return _0x23b0d7[_0xeae8('0xc')](_0xeae8('0xd'),attributes,{'tableName':_0xeae8('0xe'),'paranoid':![],'indexes':[{'name':_0xeae8('0xf'),'fields':[_0xeae8('0x10'),_0xeae8('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x80cd=['FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes','exports'];(function(_0xc50f5f,_0x37e984){var _0x4582d1=function(_0x3783dd){while(--_0x3783dd){_0xc50f5f['push'](_0xc50f5f['shift']());}};_0x4582d1(++_0x37e984);}(_0x80cd,0x146));var _0xd80c=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0x80cd[_0x1e4f2d];return _0xd05ce5;};'use strict';var _=require('lodash');var util=require(_0xd80c('0x0'));var logger=require(_0xd80c('0x1'))(_0xd80c('0x2'));var moment=require(_0xd80c('0x3'));var BPromise=require(_0xd80c('0x4'));var rp=require(_0xd80c('0x5'));var fs=require('fs');var path=require(_0xd80c('0x6'));var rimraf=require(_0xd80c('0x7'));var config=require('../../config/environment');var attributes=require(_0xd80c('0x8'));module[_0xd80c('0x9')]=function(_0x21149c,_0x46dfa0){return _0x21149c['define'](_0xd80c('0xa'),attributes,{'tableName':_0xd80c('0xb'),'paranoid':![],'indexes':[{'name':_0xd80c('0xc'),'fields':[_0xd80c('0xd'),'FieldId'],'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 bbe5e34..1c48602 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 _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x29ed03,_0x505fe5){var _0x11bf35=function(_0x321229){while(--_0x321229){_0x29ed03['push'](_0x29ed03['shift']());}};_0x11bf35(++_0x505fe5);}(_0x187d,0x93));var _0xd187=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x187d[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file +var _0xeda8=['debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent'];(function(_0x42806f,_0x1d27ae){var _0x1a3f1e=function(_0xfb716d){while(--_0xfb716d){_0x42806f['push'](_0x42806f['shift']());}};_0x1a3f1e(++_0x1d27ae);}(_0xeda8,0x104));var _0x8eda=function(_0x381bd1,_0x5cf978){_0x381bd1=_0x381bd1-0x0;var _0x2cf7c9=_0xeda8[_0x381bd1];return _0x2cf7c9;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32abe8,_0x4e2ebb,_0x28b721){return new BPromise(function(_0x1b6a1d,_0x5aa93d){return client[_0x8eda('0xd')](_0x32abe8,_0x28b721)['then'](function(_0x4f7893){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x8eda('0xe'));logger[_0x8eda('0xf')](_0x8eda('0x10'),_0x4e2ebb,'request\x20sent',JSON[_0x8eda('0x11')](_0x4f7893));if(_0x4f7893['error']){if(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x13')]===0x1f4){logger[_0x8eda('0x12')](_0x8eda('0x14'),_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x5aa93d(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x1b6a1d(_0x4f7893['error'][_0x8eda('0x15')]);}else{logger[_0x8eda('0x16')](_0x8eda('0x14'),_0x4e2ebb,'request\x20sent');_0x1b6a1d(_0x4f7893[_0x8eda('0x17')]['message']);}})[_0x8eda('0x18')](function(_0x553382){logger[_0x8eda('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x553382);_0x5aa93d(_0x553382);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index e13285b..348d845 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(_0x5728e3,_0x1b18bd){var _0x14b9ed=function(_0x226a8a){while(--_0x226a8a){_0x5728e3['push'](_0x5728e3['shift']());}};_0x14b9ed(++_0x1b18bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 _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(_0x131832,_0x2235db){var _0x168e2f=function(_0x1b570b){while(--_0x1b570b){_0x131832['push'](_0x131832['shift']());}};_0x168e2f(++_0x2235db);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 52fdc9e..e529b95 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 _0xcaf2=['sequelize','STRING','username','ENUM','newTab','integrationTab'];(function(_0x5ac8fe,_0x143e86){var _0x243105=function(_0x57bd4d){while(--_0x57bd4d){_0x5ac8fe['push'](_0x5ac8fe['shift']());}};_0x243105(++_0x143e86);}(_0xcaf2,0x8a));var _0x2caf=function(_0x8f6830,_0x7c8a1e){_0x8f6830=_0x8f6830-0x0;var _0x4ce2e5=_0xcaf2[_0x8f6830];return _0x4ce2e5;};'use strict';var Sequelize=require(_0x2caf('0x0'));module['exports']={'name':{'type':Sequelize[_0x2caf('0x1')]},'description':{'type':Sequelize[_0x2caf('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2caf('0x2')},'remoteUri':{'type':Sequelize[_0x2caf('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2caf('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x2caf('0x1')]},'serverUrl':{'type':Sequelize[_0x2caf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2caf('0x3')]('integrationTab',_0x2caf('0x4')),'defaultValue':_0x2caf('0x5')}}; \ No newline at end of file +var _0x1a0a=['username','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x3f7650,_0x50cd0a){var _0x308e4f=function(_0x1aa1b8){while(--_0x1aa1b8){_0x3f7650['push'](_0x3f7650['shift']());}};_0x308e4f(++_0x50cd0a);}(_0x1a0a,0x196));var _0xa1a0=function(_0x39ad4c,_0x2fa27e){_0x39ad4c=_0x39ad4c-0x0;var _0xf3314d=_0x1a0a[_0x39ad4c];return _0xf3314d;};'use strict';var Sequelize=require(_0xa1a0('0x0'));module['exports']={'name':{'type':Sequelize[_0xa1a0('0x1')]},'description':{'type':Sequelize[_0xa1a0('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xa1a0('0x2')},'remoteUri':{'type':Sequelize[_0xa1a0('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xa1a0('0x1')]},'clientSecret':{'type':Sequelize[_0xa1a0('0x1')]},'securityToken':{'type':Sequelize[_0xa1a0('0x1')]},'serverUrl':{'type':Sequelize[_0xa1a0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa1a0('0x3')](_0xa1a0('0x4'),_0xa1a0('0x5')),'defaultValue':_0xa1a0('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 0ca8e97..260a278 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 _0xc524=['update','then','destroy','error','name','send','index','SalesforceAccount','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','includeAll','create','body','find','getConfigurations','findOne','options','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','username','password','securityToken','slice','substring','clientSecret','concat','isNil','ticketType','describe','OwnerId','Subject','string','picklist','boolean','textarea','remove','includes','picklistValues','label','value','True','true','false','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save'];(function(_0x70504d,_0x34e810){var _0x47e29b=function(_0x119dfe){while(--_0x119dfe){_0x70504d['push'](_0x70504d['shift']());}};_0x47e29b(++_0x34e810);}(_0xc524,0x144));var _0x4c52=function(_0x2e0f04,_0xa83c65){_0x2e0f04=_0x2e0f04-0x0;var _0x4711c8=_0xc524[_0x2e0f04];return _0x4711c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c52('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4c52('0x1'));var rp=require(_0x4c52('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4c52('0x3'));var util=require(_0x4c52('0x4'));var path=require(_0x4c52('0x5'));var sox=require(_0x4c52('0x6'));var csv=require(_0x4c52('0x7'));var ejs=require(_0x4c52('0x8'));var fs=require('fs');var fs_extra=require(_0x4c52('0x9'));var _=require(_0x4c52('0xa'));var squel=require(_0x4c52('0xb'));var crypto=require(_0x4c52('0xc'));var jsforce=require(_0x4c52('0xd'));var deskjs=require(_0x4c52('0xe'));var toCsv=require(_0x4c52('0x7'));var querystring=require(_0x4c52('0xf'));var Papa=require(_0x4c52('0x10'));var Redis=require('ioredis');var authService=require(_0x4c52('0x11'));var qs=require(_0x4c52('0x12'));var as=require(_0x4c52('0x13'));var hardwareService=require(_0x4c52('0x14'));var logger=require('../../config/logger')(_0x4c52('0x15'));var utils=require(_0x4c52('0x16'));var config=require(_0x4c52('0x17'));var licenseUtil=require(_0x4c52('0x18'));var db=require(_0x4c52('0x19'))['db'];var integrations=require(_0x4c52('0x1a'));function respondWithStatusCode(_0x4fd3da,_0x10fe83){_0x10fe83=_0x10fe83||0xcc;return function(_0xfa82aa){if(_0xfa82aa){return _0x4fd3da[_0x4c52('0x1b')](_0x10fe83);}return _0x4fd3da[_0x4c52('0x1c')](_0x10fe83)[_0x4c52('0x1d')]();};}function respondWithResult(_0x5cf2b3,_0x493b0d){_0x493b0d=_0x493b0d||0xc8;return function(_0x246f9f){if(_0x246f9f){return _0x5cf2b3['status'](_0x493b0d)[_0x4c52('0x1e')](_0x246f9f);}};}function respondWithFilteredResult(_0x59ff48,_0x3b53f8){return function(_0x232657){if(_0x232657){var _0x36d3f8=typeof _0x3b53f8[_0x4c52('0x1f')]===_0x4c52('0x20')&&typeof _0x3b53f8['limit']===_0x4c52('0x20');var _0x3caf5b=_0x232657[_0x4c52('0x21')];var _0x252eb4=_0x36d3f8?0x0:_0x3b53f8[_0x4c52('0x1f')];var _0xdddff8=_0x36d3f8?_0x232657[_0x4c52('0x21')]:_0x3b53f8[_0x4c52('0x1f')]+_0x3b53f8[_0x4c52('0x22')];var _0xb8e31d;if(_0xdddff8>=_0x3caf5b){_0xdddff8=_0x3caf5b;_0xb8e31d=0xc8;}else{_0xb8e31d=0xce;}_0x59ff48['status'](_0xb8e31d);return _0x59ff48[_0x4c52('0x23')](_0x4c52('0x24'),_0x252eb4+'-'+_0xdddff8+'/'+_0x3caf5b)[_0x4c52('0x1e')](_0x232657);}return null;};}function patchUpdates(_0x228a5e){return function(_0x8f399f){try{jsonpatch[_0x4c52('0x25')](_0x8f399f,_0x228a5e,!![]);}catch(_0xe142d){return BPromise['reject'](_0xe142d);}return _0x8f399f[_0x4c52('0x26')]();};}function saveUpdates(_0x1555d7,_0x3e155d){return function(_0x1ec2d5){if(_0x1ec2d5){return _0x1ec2d5[_0x4c52('0x27')](_0x1555d7)[_0x4c52('0x28')](function(_0x5b3777){return _0x5b3777;});}return null;};}function removeEntity(_0x28dd7f,_0x1fc82c){return function(_0x2a974b){if(_0x2a974b){return _0x2a974b[_0x4c52('0x29')]()['then'](function(){_0x28dd7f[_0x4c52('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52acb6,_0x18ae05){return function(_0x1db7ac){if(!_0x1db7ac){_0x52acb6['sendStatus'](0x194);}return _0x1db7ac;};}function handleError(_0x221a07,_0x3693f9){_0x3693f9=_0x3693f9||0x1f4;return function(_0x25772a){logger[_0x4c52('0x2a')](_0x25772a['stack']);if(_0x25772a[_0x4c52('0x2b')]){delete _0x25772a[_0x4c52('0x2b')];}_0x221a07['status'](_0x3693f9)[_0x4c52('0x2c')](_0x25772a);};}exports[_0x4c52('0x2d')]=function(_0x1149ef,_0x22ea16){var _0x3fd6f9={},_0x390d43={},_0x538164={'count':0x0,'rows':[]};var _0x3e0a9d=_['map'](db[_0x4c52('0x2e')][_0x4c52('0x2f')],function(_0x493e0b){return{'name':_0x493e0b['fieldName'],'type':_0x493e0b[_0x4c52('0x30')]['key']};});_0x390d43[_0x4c52('0x31')]=_[_0x4c52('0x32')](_0x3e0a9d,'name');_0x390d43[_0x4c52('0x33')]=_[_0x4c52('0x34')](_0x1149ef['query']);_0x390d43[_0x4c52('0x35')]=_['intersection'](_0x390d43[_0x4c52('0x31')],_0x390d43[_0x4c52('0x33')]);_0x3fd6f9['attributes']=_[_0x4c52('0x36')](_0x390d43[_0x4c52('0x31')],qs[_0x4c52('0x37')](_0x1149ef[_0x4c52('0x33')][_0x4c52('0x37')]));_0x3fd6f9[_0x4c52('0x38')]=_0x3fd6f9[_0x4c52('0x38')][_0x4c52('0x39')]?_0x3fd6f9[_0x4c52('0x38')]:_0x390d43[_0x4c52('0x31')];if(!_0x1149ef[_0x4c52('0x33')]['hasOwnProperty'](_0x4c52('0x3a'))){_0x3fd6f9[_0x4c52('0x22')]=qs[_0x4c52('0x22')](_0x1149ef[_0x4c52('0x33')]['limit']);_0x3fd6f9['offset']=qs[_0x4c52('0x1f')](_0x1149ef['query']['offset']);}_0x3fd6f9[_0x4c52('0x3b')]=qs[_0x4c52('0x3c')](_0x1149ef[_0x4c52('0x33')]['sort']);_0x3fd6f9[_0x4c52('0x3d')]=qs[_0x4c52('0x35')](_[_0x4c52('0x3e')](_0x1149ef[_0x4c52('0x33')],_0x390d43[_0x4c52('0x35')]),_0x3e0a9d);if(_0x1149ef[_0x4c52('0x33')]['filter']){_0x3fd6f9[_0x4c52('0x3d')]=_[_0x4c52('0x3f')](_0x3fd6f9[_0x4c52('0x3d')],{'$or':_['map'](_0x3e0a9d,function(_0xf8d291){if(_0xf8d291['type']!==_0x4c52('0x40')){var _0x282669={};_0x282669[_0xf8d291[_0x4c52('0x2b')]]={'$like':'%'+_0x1149ef[_0x4c52('0x33')][_0x4c52('0x41')]+'%'};return _0x282669;}})});}_0x3fd6f9=_[_0x4c52('0x3f')]({},_0x3fd6f9,_0x1149ef['options']);var _0xc2ca50={'where':_0x3fd6f9[_0x4c52('0x3d')]};return db[_0x4c52('0x2e')]['count'](_0xc2ca50)[_0x4c52('0x28')](function(_0x8d6072){_0x538164[_0x4c52('0x21')]=_0x8d6072;if(_0x1149ef[_0x4c52('0x33')]['includeAll']){_0x3fd6f9[_0x4c52('0x42')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x4c52('0x43')](_0x3fd6f9);})[_0x4c52('0x28')](function(_0x1f0004){_0x538164[_0x4c52('0x44')]=_0x1f0004;return _0x538164;})[_0x4c52('0x28')](respondWithFilteredResult(_0x22ea16,_0x3fd6f9))[_0x4c52('0x45')](handleError(_0x22ea16,null));};exports[_0x4c52('0x46')]=function(_0x4fa3c6,_0x27e9e6){var _0x5bd026={'raw':![],'where':{'id':_0x4fa3c6[_0x4c52('0x47')]['id']}},_0x56b2ff={};_0x56b2ff['model']=_['keys'](db[_0x4c52('0x2e')][_0x4c52('0x2f')]);_0x56b2ff[_0x4c52('0x33')]=_[_0x4c52('0x34')](_0x4fa3c6['query']);_0x56b2ff[_0x4c52('0x35')]=_[_0x4c52('0x36')](_0x56b2ff[_0x4c52('0x31')],_0x56b2ff[_0x4c52('0x33')]);_0x5bd026[_0x4c52('0x38')]=_[_0x4c52('0x36')](_0x56b2ff[_0x4c52('0x31')],qs[_0x4c52('0x37')](_0x4fa3c6[_0x4c52('0x33')][_0x4c52('0x37')]));_0x5bd026[_0x4c52('0x38')]=_0x5bd026[_0x4c52('0x38')][_0x4c52('0x39')]?_0x5bd026[_0x4c52('0x38')]:_0x56b2ff[_0x4c52('0x31')];if(_0x4fa3c6[_0x4c52('0x33')][_0x4c52('0x48')]){_0x5bd026['include']=[{'all':!![]}];}_0x5bd026=_[_0x4c52('0x3f')]({},_0x5bd026,_0x4fa3c6['options']);return db[_0x4c52('0x2e')]['find'](_0x5bd026)[_0x4c52('0x28')](handleEntityNotFound(_0x27e9e6,null))['then'](respondWithResult(_0x27e9e6,null))[_0x4c52('0x45')](handleError(_0x27e9e6,null));};exports[_0x4c52('0x49')]=function(_0x1decb6,_0x20fdee){return db[_0x4c52('0x2e')][_0x4c52('0x49')](_0x1decb6[_0x4c52('0x4a')],{})[_0x4c52('0x28')](respondWithResult(_0x20fdee,0xc9))[_0x4c52('0x45')](handleError(_0x20fdee,null));};exports[_0x4c52('0x27')]=function(_0x41f4f8,_0xf0cf74){if(_0x41f4f8['body']['id']){delete _0x41f4f8[_0x4c52('0x4a')]['id'];}return db['SalesforceAccount'][_0x4c52('0x4b')]({'where':{'id':_0x41f4f8[_0x4c52('0x47')]['id']}})[_0x4c52('0x28')](handleEntityNotFound(_0xf0cf74,null))[_0x4c52('0x28')](saveUpdates(_0x41f4f8[_0x4c52('0x4a')],null))[_0x4c52('0x28')](respondWithResult(_0xf0cf74,null))[_0x4c52('0x45')](handleError(_0xf0cf74,null));};exports['destroy']=function(_0x116ba9,_0x50a8af){return db['SalesforceAccount']['find']({'where':{'id':_0x116ba9[_0x4c52('0x47')]['id']}})[_0x4c52('0x28')](handleEntityNotFound(_0x50a8af,null))['then'](removeEntity(_0x50a8af,null))[_0x4c52('0x45')](handleError(_0x50a8af,null));};exports[_0x4c52('0x4c')]=function(_0x3a8903,_0x55933f,_0x54c8cc){var _0xd3d292={};var _0x514423={};var _0x36a439;var _0x2a79d4;return db['SalesforceAccount'][_0x4c52('0x4d')]({'where':{'id':_0x3a8903[_0x4c52('0x47')]['id']}})[_0x4c52('0x28')](handleEntityNotFound(_0x55933f,null))[_0x4c52('0x28')](function(_0x9a8e1c){if(_0x9a8e1c){_0x36a439=_0x9a8e1c;_0x514423['model']=_[_0x4c52('0x34')](db['SalesforceConfiguration'][_0x4c52('0x2f')]);_0x514423['query']=_[_0x4c52('0x34')](_0x3a8903['query']);_0x514423['filters']=_[_0x4c52('0x36')](_0x514423[_0x4c52('0x31')],_0x514423[_0x4c52('0x33')]);_0xd3d292[_0x4c52('0x38')]=_[_0x4c52('0x36')](_0x514423[_0x4c52('0x31')],qs[_0x4c52('0x37')](_0x3a8903['query'][_0x4c52('0x37')]));_0xd3d292[_0x4c52('0x38')]=_0xd3d292[_0x4c52('0x38')][_0x4c52('0x39')]?_0xd3d292[_0x4c52('0x38')]:_0x514423[_0x4c52('0x31')];_0xd3d292[_0x4c52('0x3b')]=qs[_0x4c52('0x3c')](_0x3a8903[_0x4c52('0x33')][_0x4c52('0x3c')]);_0xd3d292[_0x4c52('0x3d')]=qs[_0x4c52('0x35')](_['pick'](_0x3a8903[_0x4c52('0x33')],_0x514423['filters']));if(_0x3a8903['query'][_0x4c52('0x41')]){_0xd3d292[_0x4c52('0x3d')]=_[_0x4c52('0x3f')](_0xd3d292[_0x4c52('0x3d')],{'$or':_[_0x4c52('0x32')](_0xd3d292['attributes'],function(_0x31f914){var _0x3e475a={};_0x3e475a[_0x31f914]={'$like':'%'+_0x3a8903[_0x4c52('0x33')][_0x4c52('0x41')]+'%'};return _0x3e475a;})});}_0xd3d292=_[_0x4c52('0x3f')]({},_0xd3d292,_0x3a8903[_0x4c52('0x4e')]);return _0x36a439[_0x4c52('0x4c')](_0xd3d292);}})[_0x4c52('0x28')](function(_0x26e990){if(_0x26e990){_0x2a79d4=_0x26e990[_0x4c52('0x39')];if(!_0x3a8903[_0x4c52('0x33')][_0x4c52('0x4f')](_0x4c52('0x3a'))){_0xd3d292[_0x4c52('0x22')]=qs['limit'](_0x3a8903['query']['limit']);_0xd3d292[_0x4c52('0x1f')]=qs[_0x4c52('0x1f')](_0x3a8903[_0x4c52('0x33')][_0x4c52('0x1f')]);}return _0x36a439[_0x4c52('0x4c')](_0xd3d292);}})[_0x4c52('0x28')](function(_0x3c6830){if(_0x3c6830){return _0x3c6830?{'count':_0x2a79d4,'rows':_0x3c6830}:null;}})[_0x4c52('0x28')](respondWithResult(_0x55933f,null))[_0x4c52('0x45')](handleError(_0x55933f,null));};exports[_0x4c52('0x50')]=function(_0x1430a4,_0x1fbcea,_0x32cb9e){if(_0x1430a4[_0x4c52('0x4a')]['id']){delete _0x1430a4[_0x4c52('0x4a')]['id'];}return db[_0x4c52('0x2e')][_0x4c52('0x4d')]({'where':{'id':_0x1430a4[_0x4c52('0x47')]['id']}})[_0x4c52('0x28')](handleEntityNotFound(_0x1fbcea,null))[_0x4c52('0x28')](function(_0x5f10fc){if(_0x5f10fc){_0x1430a4[_0x4c52('0x4a')][_0x4c52('0x51')]=_0x5f10fc['id'];_0x1430a4[_0x4c52('0x4a')][_0x4c52('0x52')]=integrations[_0x4c52('0x53')](_0x1430a4[_0x4c52('0x4a')][_0x4c52('0x54')],_0x1430a4[_0x4c52('0x4a')][_0x4c52('0x30')]);_0x1430a4['body']['Descriptions']=integrations[_0x4c52('0x55')](_0x1430a4['body']['channel'],_0x1430a4[_0x4c52('0x4a')][_0x4c52('0x30')]);return db['SalesforceConfiguration'][_0x4c52('0x49')](_0x1430a4['body'],{'include':[{'model':db[_0x4c52('0x56')],'as':_0x4c52('0x52')},{'model':db['SalesforceField'],'as':_0x4c52('0x57')}]});}return null;})[_0x4c52('0x28')](respondWithResult(_0x1fbcea,null))[_0x4c52('0x45')](handleError(_0x1fbcea,null));};exports[_0x4c52('0x58')]=function(_0xe8a6ef,_0x7fcbde,_0x532ad4){var _0x395485;var _0x23ec23='';var _0x47a649=_0x4c52('0x59');return db[_0x4c52('0x2e')]['findOne']({'where':{'id':_0xe8a6ef[_0x4c52('0x47')]['id']},'attributes':['id',_0x4c52('0x5a'),_0x4c52('0x5b'),'clientSecret',_0x4c52('0x5c'),_0x4c52('0x5d'),_0x4c52('0x5e')]})[_0x4c52('0x28')](handleEntityNotFound(_0x7fcbde,null))['then'](function(_0x15eb83){if(_0x15eb83){_0x23ec23=_0x15eb83[_0x4c52('0x5a')];var _0x4311f2=_0x23ec23[_0x4c52('0x5f')](-0x1);if(_0x4311f2==='/'){_0x23ec23=_0x23ec23[_0x4c52('0x60')](0x0,_0x23ec23['lastIndexOf'](_0x4311f2));}_0x395485=new jsforce['Connection']({'oauth2':{'loginUrl':_0x23ec23,'clientId':_0x15eb83[_0x4c52('0x5b')],'clientSecret':_0x15eb83[_0x4c52('0x61')]}});return _0x395485['login'](_0x15eb83['username'],_0x15eb83['password'][_0x4c52('0x62')](_0x15eb83[_0x4c52('0x5e')]));}})['then'](function(_0xf9fa5b){if(_0xf9fa5b){if(!_[_0x4c52('0x63')](_0xe8a6ef[_0x4c52('0x33')][_0x4c52('0x64')])){_0x47a649=_0xe8a6ef['query'][_0x4c52('0x64')];}return _0x395485['sobject'](_0x47a649)[_0x4c52('0x65')]();}})['then'](function(_0x388d5b){var _0x531c06=[_0x4c52('0x66'),'ActivityDate','IsReminderSet','IsRecurrence',_0x4c52('0x67'),'Description'];var _0x324c9a=[_0x4c52('0x68'),'int',_0x4c52('0x69'),_0x4c52('0x6a'),'email',_0x4c52('0x6b'),'phone'];if(_0x388d5b){_[_0x4c52('0x6c')](_0x388d5b[_0x4c52('0x37')],function(_0x40f52d){return _0x531c06[_0x4c52('0x6d')](_0x40f52d[_0x4c52('0x2b')])||!_0x324c9a[_0x4c52('0x6d')](_0x40f52d[_0x4c52('0x30')]);});return{'count':_0x388d5b[_0x4c52('0x37')][_0x4c52('0x39')],'rows':_[_0x4c52('0x32')](_0x388d5b[_0x4c52('0x37')],function(_0x5a5742){return{'id':_0x5a5742['name'],'name':_0x5a5742['label'],'custom':_0x5a5742['custom'],'options':_0x5a5742[_0x4c52('0x6e')][_0x4c52('0x39')]>0x0?_[_0x4c52('0x32')](_0x5a5742[_0x4c52('0x6e')],function(_0x3478b2){return{'name':_0x3478b2[_0x4c52('0x6f')],'value':_0x3478b2[_0x4c52('0x70')]};}):_0x5a5742['type']==_0x4c52('0x6a')?[{'name':_0x4c52('0x71'),'value':_0x4c52('0x72')},{'name':'False','value':_0x4c52('0x73')}]:[]};})};}})['then'](respondWithResult(_0x7fcbde,null))[_0x4c52('0x45')](function(_0x317eb7){var _0x4c4a56=_0xe8a6ef[_0x4c52('0x33')][_0x4c52('0x74')]?0x1f4:_0x317eb7['statusCode']||0x1f4;logger['error'](_0x4c52('0x75'),_0x4c52('0x58'),_0x4c4a56,JSON[_0x4c52('0x76')](_0x317eb7));delete _0x317eb7[_0x4c52('0x2b')];if(_0x4c4a56===0x191){_0x4c4a56=0x190;}_0x7fcbde['status'](_0x4c4a56)[_0x4c52('0x2c')](_0xe8a6ef['query']['test']?{'message':_0x4c52('0x77'),'statusCode':_0x317eb7[_0x4c52('0x78')]}:_0x317eb7);});}; \ No newline at end of file +var _0xa979=['True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','save','update','then','sendStatus','error','stack','name','send','index','map','SalesforceAccount','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','getConfigurations','findOne','SalesforceConfiguration','where','nolimit','addConfiguration','AccountId','getSubjects','channel','getDescriptions','SalesforceField','Subjects','Descriptions','clientId','clientSecret','username','securityToken','slice','lastIndexOf','Connection','login','password','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','boolean','textarea','phone','remove','includes','label','custom','picklistValues','value'];(function(_0x266ddc,_0x45aa52){var _0x39c1d7=function(_0x4cd07c){while(--_0x4cd07c){_0x266ddc['push'](_0x266ddc['shift']());}};_0x39c1d7(++_0x45aa52);}(_0xa979,0x17a));var _0x9a97=function(_0x415d43,_0x309808){_0x415d43=_0x415d43-0x0;var _0x35def1=_0xa979[_0x415d43];return _0x35def1;};'use strict';var emlformat=require(_0x9a97('0x0'));var rimraf=require(_0x9a97('0x1'));var zipdir=require(_0x9a97('0x2'));var jsonpatch=require(_0x9a97('0x3'));var rp=require(_0x9a97('0x4'));var moment=require('moment');var BPromise=require(_0x9a97('0x5'));var Mustache=require(_0x9a97('0x6'));var util=require(_0x9a97('0x7'));var path=require(_0x9a97('0x8'));var sox=require(_0x9a97('0x9'));var csv=require(_0x9a97('0xa'));var ejs=require(_0x9a97('0xb'));var fs=require('fs');var fs_extra=require(_0x9a97('0xc'));var _=require(_0x9a97('0xd'));var squel=require('squel');var crypto=require(_0x9a97('0xe'));var jsforce=require(_0x9a97('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9a97('0x10'));var Papa=require(_0x9a97('0x11'));var Redis=require('ioredis');var authService=require(_0x9a97('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9a97('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a97('0x14'))(_0x9a97('0x15'));var utils=require(_0x9a97('0x16'));var config=require(_0x9a97('0x17'));var licenseUtil=require(_0x9a97('0x18'));var db=require(_0x9a97('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x8c03cd,_0xd39c9b){_0xd39c9b=_0xd39c9b||0xcc;return function(_0x25edfc){if(_0x25edfc){return _0x8c03cd['sendStatus'](_0xd39c9b);}return _0x8c03cd[_0x9a97('0x1a')](_0xd39c9b)['end']();};}function respondWithResult(_0x1489ad,_0x43f5d1){_0x43f5d1=_0x43f5d1||0xc8;return function(_0x23f51b){if(_0x23f51b){return _0x1489ad[_0x9a97('0x1a')](_0x43f5d1)[_0x9a97('0x1b')](_0x23f51b);}};}function respondWithFilteredResult(_0x21c7a5,_0x55af18){return function(_0x5e66cd){if(_0x5e66cd){var _0x555710=typeof _0x55af18[_0x9a97('0x1c')]===_0x9a97('0x1d')&&typeof _0x55af18[_0x9a97('0x1e')]==='undefined';var _0x56ca5c=_0x5e66cd[_0x9a97('0x1f')];var _0x333636=_0x555710?0x0:_0x55af18[_0x9a97('0x1c')];var _0x51de0f=_0x555710?_0x5e66cd[_0x9a97('0x1f')]:_0x55af18[_0x9a97('0x1c')]+_0x55af18[_0x9a97('0x1e')];var _0x388076;if(_0x51de0f>=_0x56ca5c){_0x51de0f=_0x56ca5c;_0x388076=0xc8;}else{_0x388076=0xce;}_0x21c7a5[_0x9a97('0x1a')](_0x388076);return _0x21c7a5['set'](_0x9a97('0x20'),_0x333636+'-'+_0x51de0f+'/'+_0x56ca5c)[_0x9a97('0x1b')](_0x5e66cd);}return null;};}function patchUpdates(_0xdf6eb1){return function(_0x33e21c){try{jsonpatch['apply'](_0x33e21c,_0xdf6eb1,!![]);}catch(_0x448b09){return BPromise['reject'](_0x448b09);}return _0x33e21c[_0x9a97('0x21')]();};}function saveUpdates(_0x24dfb5,_0x122367){return function(_0x6a3196){if(_0x6a3196){return _0x6a3196[_0x9a97('0x22')](_0x24dfb5)[_0x9a97('0x23')](function(_0x159032){return _0x159032;});}return null;};}function removeEntity(_0xac5c42,_0x571910){return function(_0x3d08b3){if(_0x3d08b3){return _0x3d08b3['destroy']()['then'](function(){_0xac5c42[_0x9a97('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5451,_0x49ccc8){return function(_0x2f3568){if(!_0x2f3568){_0x3c5451[_0x9a97('0x24')](0x194);}return _0x2f3568;};}function handleError(_0xaa4cd3,_0x49d58f){_0x49d58f=_0x49d58f||0x1f4;return function(_0x2c2abc){logger[_0x9a97('0x25')](_0x2c2abc[_0x9a97('0x26')]);if(_0x2c2abc['name']){delete _0x2c2abc[_0x9a97('0x27')];}_0xaa4cd3[_0x9a97('0x1a')](_0x49d58f)[_0x9a97('0x28')](_0x2c2abc);};}exports[_0x9a97('0x29')]=function(_0x4890d9,_0x553197){var _0x4d72b4={},_0x122097={},_0x587348={'count':0x0,'rows':[]};var _0xb48088=_[_0x9a97('0x2a')](db[_0x9a97('0x2b')]['rawAttributes'],function(_0x3275a4){return{'name':_0x3275a4['fieldName'],'type':_0x3275a4['type']['key']};});_0x122097['model']=_['map'](_0xb48088,'name');_0x122097[_0x9a97('0x2c')]=_[_0x9a97('0x2d')](_0x4890d9['query']);_0x122097['filters']=_[_0x9a97('0x2e')](_0x122097[_0x9a97('0x2f')],_0x122097[_0x9a97('0x2c')]);_0x4d72b4[_0x9a97('0x30')]=_['intersection'](_0x122097[_0x9a97('0x2f')],qs['fields'](_0x4890d9[_0x9a97('0x2c')][_0x9a97('0x31')]));_0x4d72b4[_0x9a97('0x30')]=_0x4d72b4[_0x9a97('0x30')]['length']?_0x4d72b4[_0x9a97('0x30')]:_0x122097[_0x9a97('0x2f')];if(!_0x4890d9[_0x9a97('0x2c')][_0x9a97('0x32')]('nolimit')){_0x4d72b4[_0x9a97('0x1e')]=qs[_0x9a97('0x1e')](_0x4890d9[_0x9a97('0x2c')][_0x9a97('0x1e')]);_0x4d72b4['offset']=qs['offset'](_0x4890d9['query'][_0x9a97('0x1c')]);}_0x4d72b4[_0x9a97('0x33')]=qs[_0x9a97('0x34')](_0x4890d9[_0x9a97('0x2c')][_0x9a97('0x34')]);_0x4d72b4['where']=qs[_0x9a97('0x35')](_[_0x9a97('0x36')](_0x4890d9['query'],_0x122097[_0x9a97('0x35')]),_0xb48088);if(_0x4890d9['query'][_0x9a97('0x37')]){_0x4d72b4['where']=_[_0x9a97('0x38')](_0x4d72b4['where'],{'$or':_['map'](_0xb48088,function(_0x380527){if(_0x380527[_0x9a97('0x39')]!==_0x9a97('0x3a')){var _0x2a2540={};_0x2a2540[_0x380527['name']]={'$like':'%'+_0x4890d9[_0x9a97('0x2c')]['filter']+'%'};return _0x2a2540;}})});}_0x4d72b4=_[_0x9a97('0x38')]({},_0x4d72b4,_0x4890d9[_0x9a97('0x3b')]);var _0x1ad934={'where':_0x4d72b4['where']};return db[_0x9a97('0x2b')][_0x9a97('0x1f')](_0x1ad934)[_0x9a97('0x23')](function(_0x542a8c){_0x587348['count']=_0x542a8c;if(_0x4890d9[_0x9a97('0x2c')]['includeAll']){_0x4d72b4[_0x9a97('0x3c')]=[{'all':!![]}];}return db[_0x9a97('0x2b')][_0x9a97('0x3d')](_0x4d72b4);})[_0x9a97('0x23')](function(_0x340756){_0x587348[_0x9a97('0x3e')]=_0x340756;return _0x587348;})[_0x9a97('0x23')](respondWithFilteredResult(_0x553197,_0x4d72b4))[_0x9a97('0x3f')](handleError(_0x553197,null));};exports['show']=function(_0x1bd6ea,_0x274e36){var _0x547a8e={'raw':![],'where':{'id':_0x1bd6ea[_0x9a97('0x40')]['id']}},_0x3daf44={};_0x3daf44[_0x9a97('0x2f')]=_['keys'](db[_0x9a97('0x2b')][_0x9a97('0x41')]);_0x3daf44[_0x9a97('0x2c')]=_[_0x9a97('0x2d')](_0x1bd6ea['query']);_0x3daf44[_0x9a97('0x35')]=_['intersection'](_0x3daf44[_0x9a97('0x2f')],_0x3daf44[_0x9a97('0x2c')]);_0x547a8e[_0x9a97('0x30')]=_[_0x9a97('0x2e')](_0x3daf44[_0x9a97('0x2f')],qs['fields'](_0x1bd6ea['query'][_0x9a97('0x31')]));_0x547a8e[_0x9a97('0x30')]=_0x547a8e[_0x9a97('0x30')][_0x9a97('0x42')]?_0x547a8e[_0x9a97('0x30')]:_0x3daf44[_0x9a97('0x2f')];if(_0x1bd6ea[_0x9a97('0x2c')]['includeAll']){_0x547a8e[_0x9a97('0x3c')]=[{'all':!![]}];}_0x547a8e=_[_0x9a97('0x38')]({},_0x547a8e,_0x1bd6ea['options']);return db[_0x9a97('0x2b')][_0x9a97('0x43')](_0x547a8e)[_0x9a97('0x23')](handleEntityNotFound(_0x274e36,null))['then'](respondWithResult(_0x274e36,null))[_0x9a97('0x3f')](handleError(_0x274e36,null));};exports[_0x9a97('0x44')]=function(_0x34f979,_0x576500){return db[_0x9a97('0x2b')][_0x9a97('0x44')](_0x34f979[_0x9a97('0x45')],{})['then'](respondWithResult(_0x576500,0xc9))[_0x9a97('0x3f')](handleError(_0x576500,null));};exports['update']=function(_0x533799,_0x6865ac){if(_0x533799[_0x9a97('0x45')]['id']){delete _0x533799['body']['id'];}return db['SalesforceAccount'][_0x9a97('0x43')]({'where':{'id':_0x533799[_0x9a97('0x40')]['id']}})[_0x9a97('0x23')](handleEntityNotFound(_0x6865ac,null))['then'](saveUpdates(_0x533799[_0x9a97('0x45')],null))[_0x9a97('0x23')](respondWithResult(_0x6865ac,null))[_0x9a97('0x3f')](handleError(_0x6865ac,null));};exports['destroy']=function(_0x5e976c,_0x1ca034){return db['SalesforceAccount'][_0x9a97('0x43')]({'where':{'id':_0x5e976c[_0x9a97('0x40')]['id']}})['then'](handleEntityNotFound(_0x1ca034,null))[_0x9a97('0x23')](removeEntity(_0x1ca034,null))[_0x9a97('0x3f')](handleError(_0x1ca034,null));};exports[_0x9a97('0x46')]=function(_0x2dfbd2,_0x2e8133,_0x34bbaf){var _0x36e362={};var _0x384027={};var _0x1cba40;var _0x55fd1c;return db[_0x9a97('0x2b')][_0x9a97('0x47')]({'where':{'id':_0x2dfbd2['params']['id']}})[_0x9a97('0x23')](handleEntityNotFound(_0x2e8133,null))[_0x9a97('0x23')](function(_0x46140c){if(_0x46140c){_0x1cba40=_0x46140c;_0x384027['model']=_[_0x9a97('0x2d')](db[_0x9a97('0x48')][_0x9a97('0x41')]);_0x384027[_0x9a97('0x2c')]=_['keys'](_0x2dfbd2[_0x9a97('0x2c')]);_0x384027['filters']=_[_0x9a97('0x2e')](_0x384027[_0x9a97('0x2f')],_0x384027[_0x9a97('0x2c')]);_0x36e362[_0x9a97('0x30')]=_[_0x9a97('0x2e')](_0x384027['model'],qs[_0x9a97('0x31')](_0x2dfbd2[_0x9a97('0x2c')][_0x9a97('0x31')]));_0x36e362['attributes']=_0x36e362['attributes']['length']?_0x36e362[_0x9a97('0x30')]:_0x384027[_0x9a97('0x2f')];_0x36e362[_0x9a97('0x33')]=qs[_0x9a97('0x34')](_0x2dfbd2[_0x9a97('0x2c')]['sort']);_0x36e362[_0x9a97('0x49')]=qs[_0x9a97('0x35')](_['pick'](_0x2dfbd2['query'],_0x384027['filters']));if(_0x2dfbd2[_0x9a97('0x2c')][_0x9a97('0x37')]){_0x36e362[_0x9a97('0x49')]=_[_0x9a97('0x38')](_0x36e362['where'],{'$or':_['map'](_0x36e362[_0x9a97('0x30')],function(_0x46af44){var _0x39d88d={};_0x39d88d[_0x46af44]={'$like':'%'+_0x2dfbd2[_0x9a97('0x2c')]['filter']+'%'};return _0x39d88d;})});}_0x36e362=_[_0x9a97('0x38')]({},_0x36e362,_0x2dfbd2['options']);return _0x1cba40['getConfigurations'](_0x36e362);}})['then'](function(_0x766e20){if(_0x766e20){_0x55fd1c=_0x766e20[_0x9a97('0x42')];if(!_0x2dfbd2[_0x9a97('0x2c')]['hasOwnProperty'](_0x9a97('0x4a'))){_0x36e362['limit']=qs[_0x9a97('0x1e')](_0x2dfbd2[_0x9a97('0x2c')][_0x9a97('0x1e')]);_0x36e362['offset']=qs[_0x9a97('0x1c')](_0x2dfbd2[_0x9a97('0x2c')]['offset']);}return _0x1cba40['getConfigurations'](_0x36e362);}})[_0x9a97('0x23')](function(_0x1a2534){if(_0x1a2534){return _0x1a2534?{'count':_0x55fd1c,'rows':_0x1a2534}:null;}})[_0x9a97('0x23')](respondWithResult(_0x2e8133,null))['catch'](handleError(_0x2e8133,null));};exports[_0x9a97('0x4b')]=function(_0xe8561a,_0x8ccb94,_0x2d457b){if(_0xe8561a[_0x9a97('0x45')]['id']){delete _0xe8561a[_0x9a97('0x45')]['id'];}return db[_0x9a97('0x2b')][_0x9a97('0x47')]({'where':{'id':_0xe8561a[_0x9a97('0x40')]['id']}})[_0x9a97('0x23')](handleEntityNotFound(_0x8ccb94,null))[_0x9a97('0x23')](function(_0x2561b6){if(_0x2561b6){_0xe8561a[_0x9a97('0x45')][_0x9a97('0x4c')]=_0x2561b6['id'];_0xe8561a[_0x9a97('0x45')]['Subjects']=integrations[_0x9a97('0x4d')](_0xe8561a[_0x9a97('0x45')][_0x9a97('0x4e')],_0xe8561a[_0x9a97('0x45')][_0x9a97('0x39')]);_0xe8561a['body']['Descriptions']=integrations[_0x9a97('0x4f')](_0xe8561a[_0x9a97('0x45')][_0x9a97('0x4e')],_0xe8561a[_0x9a97('0x45')]['type']);return db[_0x9a97('0x48')][_0x9a97('0x44')](_0xe8561a[_0x9a97('0x45')],{'include':[{'model':db[_0x9a97('0x50')],'as':_0x9a97('0x51')},{'model':db[_0x9a97('0x50')],'as':_0x9a97('0x52')}]});}return null;})[_0x9a97('0x23')](respondWithResult(_0x8ccb94,null))[_0x9a97('0x3f')](handleError(_0x8ccb94,null));};exports['getFields']=function(_0x4dc2f6,_0x18da7f,_0x2dd0c7){var _0x11ca4f;var _0x34992e='';var _0x529430='Task';return db[_0x9a97('0x2b')][_0x9a97('0x47')]({'where':{'id':_0x4dc2f6[_0x9a97('0x40')]['id']},'attributes':['id','remoteUri',_0x9a97('0x53'),_0x9a97('0x54'),_0x9a97('0x55'),'password',_0x9a97('0x56')]})[_0x9a97('0x23')](handleEntityNotFound(_0x18da7f,null))[_0x9a97('0x23')](function(_0x22fa66){if(_0x22fa66){_0x34992e=_0x22fa66['remoteUri'];var _0x1f28cb=_0x34992e[_0x9a97('0x57')](-0x1);if(_0x1f28cb==='/'){_0x34992e=_0x34992e['substring'](0x0,_0x34992e[_0x9a97('0x58')](_0x1f28cb));}_0x11ca4f=new jsforce[(_0x9a97('0x59'))]({'oauth2':{'loginUrl':_0x34992e,'clientId':_0x22fa66[_0x9a97('0x53')],'clientSecret':_0x22fa66[_0x9a97('0x54')]}});return _0x11ca4f[_0x9a97('0x5a')](_0x22fa66[_0x9a97('0x55')],_0x22fa66[_0x9a97('0x5b')][_0x9a97('0x5c')](_0x22fa66[_0x9a97('0x56')]));}})[_0x9a97('0x23')](function(_0x56ba25){if(_0x56ba25){if(!_[_0x9a97('0x5d')](_0x4dc2f6[_0x9a97('0x2c')][_0x9a97('0x5e')])){_0x529430=_0x4dc2f6[_0x9a97('0x2c')][_0x9a97('0x5e')];}return _0x11ca4f[_0x9a97('0x5f')](_0x529430)[_0x9a97('0x60')]();}})[_0x9a97('0x23')](function(_0x107065){var _0x425e6b=[_0x9a97('0x61'),_0x9a97('0x62'),_0x9a97('0x63'),_0x9a97('0x64'),_0x9a97('0x65'),_0x9a97('0x66')];var _0x5e8c68=['string',_0x9a97('0x67'),_0x9a97('0x68'),_0x9a97('0x69'),'email',_0x9a97('0x6a'),_0x9a97('0x6b')];if(_0x107065){_[_0x9a97('0x6c')](_0x107065[_0x9a97('0x31')],function(_0x47db34){return _0x425e6b[_0x9a97('0x6d')](_0x47db34[_0x9a97('0x27')])||!_0x5e8c68[_0x9a97('0x6d')](_0x47db34[_0x9a97('0x39')]);});return{'count':_0x107065[_0x9a97('0x31')][_0x9a97('0x42')],'rows':_[_0x9a97('0x2a')](_0x107065[_0x9a97('0x31')],function(_0x4054ec){return{'id':_0x4054ec[_0x9a97('0x27')],'name':_0x4054ec[_0x9a97('0x6e')],'custom':_0x4054ec[_0x9a97('0x6f')],'options':_0x4054ec[_0x9a97('0x70')][_0x9a97('0x42')]>0x0?_[_0x9a97('0x2a')](_0x4054ec[_0x9a97('0x70')],function(_0x3e372b){return{'name':_0x3e372b['label'],'value':_0x3e372b[_0x9a97('0x71')]};}):_0x4054ec[_0x9a97('0x39')]=='boolean'?[{'name':_0x9a97('0x72'),'value':_0x9a97('0x73')},{'name':_0x9a97('0x74'),'value':_0x9a97('0x75')}]:[]};})};}})[_0x9a97('0x23')](respondWithResult(_0x18da7f,null))[_0x9a97('0x3f')](function(_0x178fcc){var _0x1b3534=_0x4dc2f6[_0x9a97('0x2c')][_0x9a97('0x76')]?0x1f4:_0x178fcc[_0x9a97('0x77')]||0x1f4;logger[_0x9a97('0x25')](_0x9a97('0x78'),'getFields',_0x1b3534,JSON[_0x9a97('0x79')](_0x178fcc));delete _0x178fcc[_0x9a97('0x27')];if(_0x1b3534===0x191){_0x1b3534=0x190;}_0x18da7f['status'](_0x1b3534)['send'](_0x4dc2f6['query'][_0x9a97('0x76')]?{'message':_0x9a97('0x7a'),'statusCode':_0x178fcc['statusCode']}:_0x178fcc);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 875cb06..aa6285e 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 _0x782e=['rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','../../config/logger','api','bluebird','request-promise'];(function(_0x368e3c,_0xedcd82){var _0x34ad90=function(_0x1370e){while(--_0x1370e){_0x368e3c['push'](_0x368e3c['shift']());}};_0x34ad90(++_0xedcd82);}(_0x782e,0xb9));var _0xe782=function(_0x28d05a,_0x17bb93){_0x28d05a=_0x28d05a-0x0;var _0x3f8139=_0x782e[_0x28d05a];return _0x3f8139;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe782('0x0'))(_0xe782('0x1'));var moment=require('moment');var BPromise=require(_0xe782('0x2'));var rp=require(_0xe782('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe782('0x4'));var config=require(_0xe782('0x5'));var attributes=require(_0xe782('0x6'));var integrations=require(_0xe782('0x7'));module['exports']=function(_0x1b934f,_0x4a0cf3){return _0x1b934f['define'](_0xe782('0x8'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed7f=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','int_salesforce_accounts','api','moment','bluebird','request-promise'];(function(_0x1708cf,_0x25e35e){var _0x4743b3=function(_0x41c46d){while(--_0x41c46d){_0x1708cf['push'](_0x1708cf['shift']());}};_0x4743b3(++_0x25e35e);}(_0xed7f,0xd8));var _0xfed7=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0xed7f[_0x4bc4c8];return _0x3bb121;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xfed7('0x0'));var moment=require(_0xfed7('0x1'));var BPromise=require(_0xfed7('0x2'));var rp=require(_0xfed7('0x3'));var fs=require('fs');var path=require(_0xfed7('0x4'));var rimraf=require(_0xfed7('0x5'));var config=require(_0xfed7('0x6'));var attributes=require(_0xfed7('0x7'));var integrations=require(_0xfed7('0x8'));module['exports']=function(_0x585551,_0x21a8ca){return _0x585551[_0xfed7('0x9')]('SalesforceAccount',attributes,{'tableName':_0xfed7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 1fa220e..e230b8a 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 _0x1aac=['rpc','../../config/environment','client','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetSalesforceAccount','findAll','options','raw','attributes','include','model','map','ShowSalesforceAccount','SalesforceAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x222981,_0x108557){var _0x3fef8a=function(_0x399541){while(--_0x399541){_0x222981['push'](_0x222981['shift']());}};_0x3fef8a(++_0x108557);}(_0x1aac,0xca));var _0xc1aa=function(_0x1d6887,_0x493033){_0x1d6887=_0x1d6887-0x0;var _0x5f15bf=_0x1aac[_0x1d6887];return _0x5f15bf;};'use strict';var _=require(_0xc1aa('0x0'));var util=require(_0xc1aa('0x1'));var moment=require(_0xc1aa('0x2'));var BPromise=require(_0xc1aa('0x3'));var rs=require(_0xc1aa('0x4'));var fs=require('fs');var Redis=require(_0xc1aa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1aa('0x6'));var logger=require(_0xc1aa('0x7'))(_0xc1aa('0x8'));var config=require(_0xc1aa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc1aa('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b1575,_0x76b4a5,_0x255b3f){return new BPromise(function(_0xf70208,_0x4933c2){return client['request'](_0x4b1575,_0x255b3f)[_0xc1aa('0xb')](function(_0x5939b4){logger[_0xc1aa('0xc')](_0xc1aa('0xd'),_0x76b4a5,'request\x20sent');logger[_0xc1aa('0xe')](_0xc1aa('0xf'),_0x76b4a5,'request\x20sent',JSON[_0xc1aa('0x10')](_0x5939b4));if(_0x5939b4[_0xc1aa('0x11')]){if(_0x5939b4[_0xc1aa('0x11')][_0xc1aa('0x12')]===0x1f4){logger[_0xc1aa('0x11')](_0xc1aa('0xd'),_0x76b4a5,_0x5939b4[_0xc1aa('0x11')][_0xc1aa('0x13')]);return _0x4933c2(_0x5939b4['error']['message']);}logger[_0xc1aa('0x11')](_0xc1aa('0xd'),_0x76b4a5,_0x5939b4[_0xc1aa('0x11')][_0xc1aa('0x13')]);return _0xf70208(_0x5939b4['error'][_0xc1aa('0x13')]);}else{logger['info'](_0xc1aa('0xd'),_0x76b4a5,_0xc1aa('0x14'));_0xf70208(_0x5939b4[_0xc1aa('0x15')][_0xc1aa('0x13')]);}})[_0xc1aa('0x16')](function(_0x394d7a){logger[_0xc1aa('0x11')](_0xc1aa('0xd'),_0x76b4a5,_0x394d7a);_0x4933c2(_0x394d7a);});});}exports[_0xc1aa('0x17')]=function(_0x1e2b72){var _0x37069c=this;return new Promise(function(_0x4d8545,_0x525f44){return db['SalesforceAccount'][_0xc1aa('0x18')]({'raw':_0x1e2b72[_0xc1aa('0x19')]?_0x1e2b72[_0xc1aa('0x19')][_0xc1aa('0x1a')]===undefined?!![]:![]:!![],'where':_0x1e2b72[_0xc1aa('0x19')]?_0x1e2b72[_0xc1aa('0x19')]['where']||null:null,'attributes':_0x1e2b72[_0xc1aa('0x19')]?_0x1e2b72[_0xc1aa('0x19')][_0xc1aa('0x1b')]||null:null,'limit':_0x1e2b72['options']?_0x1e2b72['options']['limit']||null:null,'include':_0x1e2b72['options']?_0x1e2b72[_0xc1aa('0x19')][_0xc1aa('0x1c')]?_['map'](_0x1e2b72['options'][_0xc1aa('0x1c')],function(_0x1dbff1){return{'model':db[_0x1dbff1[_0xc1aa('0x1d')]],'as':_0x1dbff1['as'],'attributes':_0x1dbff1[_0xc1aa('0x1b')],'include':_0x1dbff1['include']?_[_0xc1aa('0x1e')](_0x1dbff1[_0xc1aa('0x1c')],function(_0x237ae9){return{'model':db[_0x237ae9[_0xc1aa('0x1d')]],'as':_0x237ae9['as'],'attributes':_0x237ae9[_0xc1aa('0x1b')],'include':_0x237ae9['include']?_[_0xc1aa('0x1e')](_0x237ae9[_0xc1aa('0x1c')],function(_0x1ba09){return{'model':db[_0x1ba09[_0xc1aa('0x1d')]],'as':_0x1ba09['as'],'attributes':_0x1ba09[_0xc1aa('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc1aa('0xb')](function(_0x5b4e9e){logger[_0xc1aa('0xc')](_0xc1aa('0x17'),_0x1e2b72);logger[_0xc1aa('0xe')](_0xc1aa('0x17'),_0x1e2b72,JSON['stringify'](_0x5b4e9e));_0x4d8545(_0x5b4e9e);})['catch'](function(_0x18fbcb){logger[_0xc1aa('0x11')](_0xc1aa('0x17'),_0x18fbcb[_0xc1aa('0x13')],_0x1e2b72);_0x525f44(_0x37069c[_0xc1aa('0x11')](0x1f4,_0x18fbcb['message']));});});};exports[_0xc1aa('0x1f')]=function(_0x4d36eb){var _0x22c30a=this;return new Promise(function(_0x12dda9,_0x15c4b4){return db[_0xc1aa('0x20')][_0xc1aa('0x21')]({'raw':_0x4d36eb[_0xc1aa('0x19')]?_0x4d36eb[_0xc1aa('0x19')][_0xc1aa('0x1a')]===undefined?!![]:![]:!![],'where':_0x4d36eb[_0xc1aa('0x19')]?_0x4d36eb['options'][_0xc1aa('0x22')]||null:null,'attributes':_0x4d36eb[_0xc1aa('0x19')]?_0x4d36eb[_0xc1aa('0x19')][_0xc1aa('0x1b')]||null:null,'include':_0x4d36eb[_0xc1aa('0x19')]?_0x4d36eb[_0xc1aa('0x19')]['include']?_[_0xc1aa('0x1e')](_0x4d36eb[_0xc1aa('0x19')][_0xc1aa('0x1c')],function(_0x20049a){return{'model':db[_0x20049a[_0xc1aa('0x1d')]],'as':_0x20049a['as'],'attributes':_0x20049a[_0xc1aa('0x1b')],'include':_0x20049a[_0xc1aa('0x1c')]?_[_0xc1aa('0x1e')](_0x20049a['include'],function(_0x59e0b4){return{'model':db[_0x59e0b4['model']],'as':_0x59e0b4['as'],'attributes':_0x59e0b4[_0xc1aa('0x1b')],'include':_0x59e0b4[_0xc1aa('0x1c')]?_['map'](_0x59e0b4[_0xc1aa('0x1c')],function(_0x1015a4){return{'model':db[_0x1015a4[_0xc1aa('0x1d')]],'as':_0x1015a4['as'],'attributes':_0x1015a4[_0xc1aa('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc1aa('0xb')](function(_0x5c96d6){logger[_0xc1aa('0xc')](_0xc1aa('0x1f'),_0x4d36eb);logger[_0xc1aa('0xe')](_0xc1aa('0x1f'),_0x4d36eb,JSON[_0xc1aa('0x10')](_0x5c96d6));_0x12dda9(_0x5c96d6);})['catch'](function(_0x538e33){logger[_0xc1aa('0x11')](_0xc1aa('0x1f'),_0x538e33[_0xc1aa('0x13')],_0x4d36eb);_0x15c4b4(_0x22c30a[_0xc1aa('0x11')](0x1f4,_0x538e33[_0xc1aa('0x13')]));});});}; \ No newline at end of file +var _0xdc3c=['rpc','../../config/environment','jayson/promise','client','http','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','include','model','map','then','ShowSalesforceAccount','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3d88a6,_0x158aad){var _0x118076=function(_0x1074f1){while(--_0x1074f1){_0x3d88a6['push'](_0x3d88a6['shift']());}};_0x118076(++_0x158aad);}(_0xdc3c,0x1b4));var _0xcdc3=function(_0x5e9531,_0x3b075e){_0x5e9531=_0x5e9531-0x0;var _0xa216f7=_0xdc3c[_0x5e9531];return _0xa216f7;};'use strict';var _=require(_0xcdc3('0x0'));var util=require('util');var moment=require(_0xcdc3('0x1'));var BPromise=require(_0xcdc3('0x2'));var rs=require(_0xcdc3('0x3'));var fs=require('fs');var Redis=require(_0xcdc3('0x4'));var db=require(_0xcdc3('0x5'))['db'];var utils=require(_0xcdc3('0x6'));var logger=require(_0xcdc3('0x7'))(_0xcdc3('0x8'));var config=require(_0xcdc3('0x9'));var jayson=require(_0xcdc3('0xa'));var client=jayson[_0xcdc3('0xb')][_0xcdc3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x406814,_0x428b03,_0x79b6b1){return new BPromise(function(_0xcbc8f1,_0x58c8f3){return client['request'](_0x406814,_0x79b6b1)['then'](function(_0x3aa1b2){logger[_0xcdc3('0xd')](_0xcdc3('0xe'),_0x428b03,_0xcdc3('0xf'));logger[_0xcdc3('0x10')](_0xcdc3('0x11'),_0x428b03,_0xcdc3('0xf'),JSON[_0xcdc3('0x12')](_0x3aa1b2));if(_0x3aa1b2[_0xcdc3('0x13')]){if(_0x3aa1b2['error']['code']===0x1f4){logger[_0xcdc3('0x13')](_0xcdc3('0xe'),_0x428b03,_0x3aa1b2[_0xcdc3('0x13')][_0xcdc3('0x14')]);return _0x58c8f3(_0x3aa1b2[_0xcdc3('0x13')][_0xcdc3('0x14')]);}logger[_0xcdc3('0x13')](_0xcdc3('0xe'),_0x428b03,_0x3aa1b2['error'][_0xcdc3('0x14')]);return _0xcbc8f1(_0x3aa1b2['error'][_0xcdc3('0x14')]);}else{logger['info'](_0xcdc3('0xe'),_0x428b03,_0xcdc3('0xf'));_0xcbc8f1(_0x3aa1b2[_0xcdc3('0x15')][_0xcdc3('0x14')]);}})[_0xcdc3('0x16')](function(_0xaf3ec3){logger[_0xcdc3('0x13')](_0xcdc3('0xe'),_0x428b03,_0xaf3ec3);_0x58c8f3(_0xaf3ec3);});});}exports[_0xcdc3('0x17')]=function(_0xc24bd1){var _0x1a28e6=this;return new Promise(function(_0x480c1c,_0x285adb){return db[_0xcdc3('0x18')][_0xcdc3('0x19')]({'raw':_0xc24bd1[_0xcdc3('0x1a')]?_0xc24bd1[_0xcdc3('0x1a')][_0xcdc3('0x1b')]===undefined?!![]:![]:!![],'where':_0xc24bd1['options']?_0xc24bd1['options']['where']||null:null,'attributes':_0xc24bd1[_0xcdc3('0x1a')]?_0xc24bd1['options'][_0xcdc3('0x1c')]||null:null,'limit':_0xc24bd1[_0xcdc3('0x1a')]?_0xc24bd1[_0xcdc3('0x1a')][_0xcdc3('0x1d')]||null:null,'include':_0xc24bd1[_0xcdc3('0x1a')]?_0xc24bd1[_0xcdc3('0x1a')][_0xcdc3('0x1e')]?_['map'](_0xc24bd1['options'][_0xcdc3('0x1e')],function(_0x2bc477){return{'model':db[_0x2bc477[_0xcdc3('0x1f')]],'as':_0x2bc477['as'],'attributes':_0x2bc477[_0xcdc3('0x1c')],'include':_0x2bc477['include']?_[_0xcdc3('0x20')](_0x2bc477[_0xcdc3('0x1e')],function(_0x499d63){return{'model':db[_0x499d63[_0xcdc3('0x1f')]],'as':_0x499d63['as'],'attributes':_0x499d63[_0xcdc3('0x1c')],'include':_0x499d63['include']?_[_0xcdc3('0x20')](_0x499d63[_0xcdc3('0x1e')],function(_0x41efc9){return{'model':db[_0x41efc9[_0xcdc3('0x1f')]],'as':_0x41efc9['as'],'attributes':_0x41efc9[_0xcdc3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcdc3('0x21')](function(_0x32a44d){logger[_0xcdc3('0xd')]('GetSalesforceAccount',_0xc24bd1);logger[_0xcdc3('0x10')]('GetSalesforceAccount',_0xc24bd1,JSON[_0xcdc3('0x12')](_0x32a44d));_0x480c1c(_0x32a44d);})[_0xcdc3('0x16')](function(_0x574da2){logger[_0xcdc3('0x13')](_0xcdc3('0x17'),_0x574da2['message'],_0xc24bd1);_0x285adb(_0x1a28e6[_0xcdc3('0x13')](0x1f4,_0x574da2[_0xcdc3('0x14')]));});});};exports[_0xcdc3('0x22')]=function(_0x117edd){var _0x3d64ac=this;return new Promise(function(_0x5baa2e,_0x359482){return db[_0xcdc3('0x18')][_0xcdc3('0x23')]({'raw':_0x117edd[_0xcdc3('0x1a')]?_0x117edd[_0xcdc3('0x1a')][_0xcdc3('0x1b')]===undefined?!![]:![]:!![],'where':_0x117edd[_0xcdc3('0x1a')]?_0x117edd[_0xcdc3('0x1a')][_0xcdc3('0x24')]||null:null,'attributes':_0x117edd['options']?_0x117edd[_0xcdc3('0x1a')][_0xcdc3('0x1c')]||null:null,'include':_0x117edd[_0xcdc3('0x1a')]?_0x117edd['options'][_0xcdc3('0x1e')]?_[_0xcdc3('0x20')](_0x117edd[_0xcdc3('0x1a')][_0xcdc3('0x1e')],function(_0x459919){return{'model':db[_0x459919[_0xcdc3('0x1f')]],'as':_0x459919['as'],'attributes':_0x459919[_0xcdc3('0x1c')],'include':_0x459919[_0xcdc3('0x1e')]?_[_0xcdc3('0x20')](_0x459919[_0xcdc3('0x1e')],function(_0x18dcee){return{'model':db[_0x18dcee[_0xcdc3('0x1f')]],'as':_0x18dcee['as'],'attributes':_0x18dcee[_0xcdc3('0x1c')],'include':_0x18dcee[_0xcdc3('0x1e')]?_[_0xcdc3('0x20')](_0x18dcee['include'],function(_0xb1935){return{'model':db[_0xb1935[_0xcdc3('0x1f')]],'as':_0xb1935['as'],'attributes':_0xb1935[_0xcdc3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcdc3('0x21')](function(_0x12b03e){logger[_0xcdc3('0xd')]('ShowSalesforceAccount',_0x117edd);logger[_0xcdc3('0x10')](_0xcdc3('0x22'),_0x117edd,JSON['stringify'](_0x12b03e));_0x5baa2e(_0x12b03e);})[_0xcdc3('0x16')](function(_0x144283){logger[_0xcdc3('0x13')](_0xcdc3('0x22'),_0x144283[_0xcdc3('0x14')],_0x117edd);_0x359482(_0x3d64ac[_0xcdc3('0x13')](0x1f4,_0x144283[_0xcdc3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 563d9a2..a1ed343 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 _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(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xdb28,0x106));var _0x8db2=function(_0x2c6eb0,_0x2d89e0){_0x2c6eb0=_0x2c6eb0-0x0;var _0x51d950=_0xdb28[_0x2c6eb0];return _0x51d950;};'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 +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x146f25,_0x54fcc3){var _0x33c988=function(_0x5a7258){while(--_0x5a7258){_0x146f25['push'](_0x146f25['shift']());}};_0x33c988(++_0x54fcc3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x50ac60,_0x5c7e9c){_0x50ac60=_0x50ac60-0x0;var _0x47b9da=_0x5f2f[_0x50ac60];return _0x47b9da;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('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 9c035f4..bc67fd2 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 _0xdd4d=['account','nothing','sequelize','exports','STRING','Task','Case','ENUM','contact_lead','contact','lead','account_contact_lead'];(function(_0x4753f5,_0x4d299){var _0x3aef9a=function(_0x1ef1af){while(--_0x1ef1af){_0x4753f5['push'](_0x4753f5['shift']());}};_0x3aef9a(++_0x4d299);}(_0xdd4d,0x152));var _0xddd4=function(_0x4af84b,_0x51700e){_0x4af84b=_0x4af84b-0x0;var _0x567bc8=_0xdd4d[_0x4af84b];return _0x567bc8;};'use strict';var Sequelize=require(_0xddd4('0x0'));module[_0xddd4('0x1')]={'name':{'type':Sequelize[_0xddd4('0x2')]},'description':{'type':Sequelize[_0xddd4('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xddd4('0x3'),_0xddd4('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xddd4('0x5')](_0xddd4('0x6'),_0xddd4('0x7'),_0xddd4('0x8'),_0xddd4('0x9'),_0xddd4('0xa')),'defaultValue':_0xddd4('0x6')},'moduleCreate':{'type':Sequelize[_0xddd4('0x5')](_0xddd4('0xb'),_0xddd4('0x7'),_0xddd4('0x8'),'account'),'defaultValue':_0xddd4('0x8')},'leadId':{'type':Sequelize[_0xddd4('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xddd4('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xddd4('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5656=['contact','sequelize','exports','STRING','ENUM','Task','contact_lead','lead','account_contact_lead'];(function(_0x5a96d4,_0x5d2700){var _0x52cf66=function(_0x3a07c4){while(--_0x3a07c4){_0x5a96d4['push'](_0x5a96d4['shift']());}};_0x52cf66(++_0x5d2700);}(_0x5656,0x1d5));var _0x6565=function(_0x49a05f,_0x3aaf04){_0x49a05f=_0x49a05f-0x0;var _0x50b6f2=_0x5656[_0x49a05f];return _0x50b6f2;};'use strict';var Sequelize=require(_0x6565('0x0'));module[_0x6565('0x1')]={'name':{'type':Sequelize[_0x6565('0x2')]},'description':{'type':Sequelize[_0x6565('0x2')]},'ticketType':{'type':Sequelize[_0x6565('0x3')]('Task','Case'),'defaultValue':_0x6565('0x4')},'moduleSearch':{'type':Sequelize[_0x6565('0x3')](_0x6565('0x5'),'contact',_0x6565('0x6'),_0x6565('0x7'),'account'),'defaultValue':_0x6565('0x5')},'moduleCreate':{'type':Sequelize[_0x6565('0x3')]('nothing',_0x6565('0x8'),'lead','account'),'defaultValue':_0x6565('0x6')},'leadId':{'type':Sequelize[_0x6565('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x6565('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x6565('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x6565('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 78c907b..62562a6 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 _0x7fd4=['include','findAll','catch','show','rawAttributes','find','create','body','params','findOne','SalesforceField','order','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll'];(function(_0x4fedc0,_0xfcf951){var _0x2f3116=function(_0x6b8034){while(--_0x6b8034){_0x4fedc0['push'](_0x4fedc0['shift']());}};_0x2f3116(++_0xfcf951);}(_0x7fd4,0x117));var _0x47fd=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0x7fd4[_0x367e5b];return _0x4b909e;};'use strict';var emlformat=require(_0x47fd('0x0'));var rimraf=require(_0x47fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47fd('0x2'));var rp=require(_0x47fd('0x3'));var moment=require(_0x47fd('0x4'));var BPromise=require(_0x47fd('0x5'));var Mustache=require(_0x47fd('0x6'));var util=require(_0x47fd('0x7'));var path=require('path');var sox=require(_0x47fd('0x8'));var csv=require(_0x47fd('0x9'));var ejs=require(_0x47fd('0xa'));var fs=require('fs');var fs_extra=require(_0x47fd('0xb'));var _=require(_0x47fd('0xc'));var squel=require(_0x47fd('0xd'));var crypto=require(_0x47fd('0xe'));var jsforce=require(_0x47fd('0xf'));var deskjs=require(_0x47fd('0x10'));var toCsv=require('to-csv');var querystring=require(_0x47fd('0x11'));var Papa=require(_0x47fd('0x12'));var Redis=require(_0x47fd('0x13'));var authService=require(_0x47fd('0x14'));var qs=require(_0x47fd('0x15'));var as=require(_0x47fd('0x16'));var hardwareService=require(_0x47fd('0x17'));var logger=require(_0x47fd('0x18'))(_0x47fd('0x19'));var utils=require(_0x47fd('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x47fd('0x1b'));var db=require(_0x47fd('0x1c'))['db'];function respondWithStatusCode(_0xaf1c81,_0x5d29de){_0x5d29de=_0x5d29de||0xcc;return function(_0x21152e){if(_0x21152e){return _0xaf1c81[_0x47fd('0x1d')](_0x5d29de);}return _0xaf1c81[_0x47fd('0x1e')](_0x5d29de)[_0x47fd('0x1f')]();};}function respondWithResult(_0x17a92e,_0x20c885){_0x20c885=_0x20c885||0xc8;return function(_0x33b315){if(_0x33b315){return _0x17a92e[_0x47fd('0x1e')](_0x20c885)[_0x47fd('0x20')](_0x33b315);}};}function respondWithFilteredResult(_0x1893c4,_0x579a03){return function(_0x39e6fb){if(_0x39e6fb){var _0x2b0a79=typeof _0x579a03[_0x47fd('0x21')]===_0x47fd('0x22')&&typeof _0x579a03[_0x47fd('0x23')]==='undefined';var _0x581fde=_0x39e6fb[_0x47fd('0x24')];var _0x4795ac=_0x2b0a79?0x0:_0x579a03[_0x47fd('0x21')];var _0x1f2155=_0x2b0a79?_0x39e6fb[_0x47fd('0x24')]:_0x579a03[_0x47fd('0x21')]+_0x579a03[_0x47fd('0x23')];var _0x1396c3;if(_0x1f2155>=_0x581fde){_0x1f2155=_0x581fde;_0x1396c3=0xc8;}else{_0x1396c3=0xce;}_0x1893c4['status'](_0x1396c3);return _0x1893c4[_0x47fd('0x25')](_0x47fd('0x26'),_0x4795ac+'-'+_0x1f2155+'/'+_0x581fde)[_0x47fd('0x20')](_0x39e6fb);}return null;};}function patchUpdates(_0x471673){return function(_0x4454af){try{jsonpatch[_0x47fd('0x27')](_0x4454af,_0x471673,!![]);}catch(_0x33589f){return BPromise[_0x47fd('0x28')](_0x33589f);}return _0x4454af[_0x47fd('0x29')]();};}function saveUpdates(_0x5ce65d,_0x12dd9f){return function(_0x1980b5){if(_0x1980b5){return _0x1980b5[_0x47fd('0x2a')](_0x5ce65d)[_0x47fd('0x2b')](function(_0x376ad6){return _0x376ad6;});}return null;};}function removeEntity(_0x5ce949,_0x23d3ec){return function(_0x1ada55){if(_0x1ada55){return _0x1ada55[_0x47fd('0x2c')]()[_0x47fd('0x2b')](function(){_0x5ce949['status'](0xcc)[_0x47fd('0x1f')]();});}};}function handleEntityNotFound(_0x1f96ef,_0x3577a6){return function(_0x1c11a7){if(!_0x1c11a7){_0x1f96ef[_0x47fd('0x1d')](0x194);}return _0x1c11a7;};}function handleError(_0x1329d0,_0x18f0aa){_0x18f0aa=_0x18f0aa||0x1f4;return function(_0x3ae3ef){logger[_0x47fd('0x2d')](_0x3ae3ef[_0x47fd('0x2e')]);if(_0x3ae3ef[_0x47fd('0x2f')]){delete _0x3ae3ef[_0x47fd('0x2f')];}_0x1329d0['status'](_0x18f0aa)[_0x47fd('0x30')](_0x3ae3ef);};}exports[_0x47fd('0x31')]=function(_0x2d2df0,_0x240745){var _0x11df99={},_0x5b51a7={},_0x2c5000={'count':0x0,'rows':[]};var _0x2e44e3=_[_0x47fd('0x32')](db[_0x47fd('0x33')]['rawAttributes'],function(_0x500011){return{'name':_0x500011[_0x47fd('0x34')],'type':_0x500011[_0x47fd('0x35')][_0x47fd('0x36')]};});_0x5b51a7['model']=_['map'](_0x2e44e3,_0x47fd('0x2f'));_0x5b51a7[_0x47fd('0x37')]=_[_0x47fd('0x38')](_0x2d2df0[_0x47fd('0x37')]);_0x5b51a7[_0x47fd('0x39')]=_[_0x47fd('0x3a')](_0x5b51a7[_0x47fd('0x3b')],_0x5b51a7[_0x47fd('0x37')]);_0x11df99[_0x47fd('0x3c')]=_['intersection'](_0x5b51a7[_0x47fd('0x3b')],qs[_0x47fd('0x3d')](_0x2d2df0[_0x47fd('0x37')][_0x47fd('0x3d')]));_0x11df99[_0x47fd('0x3c')]=_0x11df99[_0x47fd('0x3c')][_0x47fd('0x3e')]?_0x11df99[_0x47fd('0x3c')]:_0x5b51a7[_0x47fd('0x3b')];if(!_0x2d2df0[_0x47fd('0x37')][_0x47fd('0x3f')](_0x47fd('0x40'))){_0x11df99[_0x47fd('0x23')]=qs[_0x47fd('0x23')](_0x2d2df0[_0x47fd('0x37')][_0x47fd('0x23')]);_0x11df99[_0x47fd('0x21')]=qs[_0x47fd('0x21')](_0x2d2df0['query']['offset']);}_0x11df99['order']=qs[_0x47fd('0x41')](_0x2d2df0['query']['sort']);_0x11df99[_0x47fd('0x42')]=qs[_0x47fd('0x39')](_[_0x47fd('0x43')](_0x2d2df0['query'],_0x5b51a7[_0x47fd('0x39')]),_0x2e44e3);if(_0x2d2df0['query'][_0x47fd('0x44')]){_0x11df99[_0x47fd('0x42')]=_['merge'](_0x11df99[_0x47fd('0x42')],{'$or':_['map'](_0x2e44e3,function(_0x291e30){if(_0x291e30[_0x47fd('0x35')]!==_0x47fd('0x45')){var _0x3ff194={};_0x3ff194[_0x291e30[_0x47fd('0x2f')]]={'$like':'%'+_0x2d2df0[_0x47fd('0x37')]['filter']+'%'};return _0x3ff194;}})});}_0x11df99=_[_0x47fd('0x46')]({},_0x11df99,_0x2d2df0[_0x47fd('0x47')]);var _0x598734={'where':_0x11df99['where']};return db[_0x47fd('0x33')][_0x47fd('0x24')](_0x598734)[_0x47fd('0x2b')](function(_0x3423e4){_0x2c5000[_0x47fd('0x24')]=_0x3423e4;if(_0x2d2df0[_0x47fd('0x37')][_0x47fd('0x48')]){_0x11df99[_0x47fd('0x49')]=[{'all':!![]}];}return db[_0x47fd('0x33')][_0x47fd('0x4a')](_0x11df99);})['then'](function(_0x1758ce){_0x2c5000['rows']=_0x1758ce;return _0x2c5000;})[_0x47fd('0x2b')](respondWithFilteredResult(_0x240745,_0x11df99))[_0x47fd('0x4b')](handleError(_0x240745,null));};exports[_0x47fd('0x4c')]=function(_0x50514,_0x1c21aa){var _0xd30a={'raw':![],'where':{'id':_0x50514['params']['id']}},_0x4a9742={};_0x4a9742[_0x47fd('0x3b')]=_[_0x47fd('0x38')](db[_0x47fd('0x33')][_0x47fd('0x4d')]);_0x4a9742[_0x47fd('0x37')]=_[_0x47fd('0x38')](_0x50514['query']);_0x4a9742[_0x47fd('0x39')]=_[_0x47fd('0x3a')](_0x4a9742[_0x47fd('0x3b')],_0x4a9742[_0x47fd('0x37')]);_0xd30a[_0x47fd('0x3c')]=_[_0x47fd('0x3a')](_0x4a9742['model'],qs['fields'](_0x50514[_0x47fd('0x37')][_0x47fd('0x3d')]));_0xd30a['attributes']=_0xd30a[_0x47fd('0x3c')][_0x47fd('0x3e')]?_0xd30a[_0x47fd('0x3c')]:_0x4a9742[_0x47fd('0x3b')];if(_0x50514[_0x47fd('0x37')][_0x47fd('0x48')]){_0xd30a[_0x47fd('0x49')]=[{'all':!![]}];}_0xd30a=_[_0x47fd('0x46')]({},_0xd30a,_0x50514[_0x47fd('0x47')]);return db[_0x47fd('0x33')][_0x47fd('0x4e')](_0xd30a)[_0x47fd('0x2b')](handleEntityNotFound(_0x1c21aa,null))[_0x47fd('0x2b')](respondWithResult(_0x1c21aa,null))[_0x47fd('0x4b')](handleError(_0x1c21aa,null));};exports[_0x47fd('0x4f')]=function(_0x31d1da,_0x202260){return db[_0x47fd('0x33')][_0x47fd('0x4f')](_0x31d1da[_0x47fd('0x50')],{})['then'](respondWithResult(_0x202260,0xc9))[_0x47fd('0x4b')](handleError(_0x202260,null));};exports['update']=function(_0x4f23fa,_0x40dbe5){if(_0x4f23fa[_0x47fd('0x50')]['id']){delete _0x4f23fa['body']['id'];}return db[_0x47fd('0x33')][_0x47fd('0x4e')]({'where':{'id':_0x4f23fa[_0x47fd('0x51')]['id']}})[_0x47fd('0x2b')](handleEntityNotFound(_0x40dbe5,null))[_0x47fd('0x2b')](saveUpdates(_0x4f23fa['body'],null))['then'](respondWithResult(_0x40dbe5,null))['catch'](handleError(_0x40dbe5,null));};exports['destroy']=function(_0x38c41d,_0x23d6e7){return db['SalesforceConfiguration'][_0x47fd('0x4e')]({'where':{'id':_0x38c41d[_0x47fd('0x51')]['id']}})[_0x47fd('0x2b')](handleEntityNotFound(_0x23d6e7,null))['then'](removeEntity(_0x23d6e7,null))[_0x47fd('0x4b')](handleError(_0x23d6e7,null));};exports['getFields']=function(_0x6602a2,_0x4cebd3,_0x5d1783){var _0x502492={};var _0x5acc32={};var _0x105e0c;var _0x309c44;return db[_0x47fd('0x33')][_0x47fd('0x52')]({'where':{'id':_0x6602a2[_0x47fd('0x51')]['id']}})['then'](handleEntityNotFound(_0x4cebd3,null))[_0x47fd('0x2b')](function(_0x19d95f){if(_0x19d95f){_0x105e0c=_0x19d95f;_0x5acc32[_0x47fd('0x3b')]=_[_0x47fd('0x38')](db[_0x47fd('0x53')]['rawAttributes']);_0x5acc32[_0x47fd('0x37')]=_[_0x47fd('0x38')](_0x6602a2[_0x47fd('0x37')]);_0x5acc32[_0x47fd('0x39')]=_['intersection'](_0x5acc32['model'],_0x5acc32[_0x47fd('0x37')]);_0x502492['attributes']=_['intersection'](_0x5acc32['model'],qs['fields'](_0x6602a2[_0x47fd('0x37')]['fields']));_0x502492['attributes']=_0x502492['attributes'][_0x47fd('0x3e')]?_0x502492[_0x47fd('0x3c')]:_0x5acc32[_0x47fd('0x3b')];_0x502492[_0x47fd('0x54')]=qs[_0x47fd('0x41')](_0x6602a2[_0x47fd('0x37')][_0x47fd('0x41')]);_0x502492['where']=qs['filters'](_[_0x47fd('0x43')](_0x6602a2[_0x47fd('0x37')],_0x5acc32[_0x47fd('0x39')]));if(_0x6602a2[_0x47fd('0x37')]['filter']){_0x502492[_0x47fd('0x42')]=_['merge'](_0x502492['where'],{'$or':_['map'](_0x502492[_0x47fd('0x3c')],function(_0x5ddaa7){var _0x25d29e={};_0x25d29e[_0x5ddaa7]={'$like':'%'+_0x6602a2[_0x47fd('0x37')][_0x47fd('0x44')]+'%'};return _0x25d29e;})});}_0x502492=_[_0x47fd('0x46')]({},_0x502492,_0x6602a2[_0x47fd('0x47')]);return _0x105e0c[_0x47fd('0x55')](_0x502492);}})[_0x47fd('0x2b')](function(_0x499725){if(_0x499725){_0x309c44=_0x499725['length'];if(!_0x6602a2['query'][_0x47fd('0x3f')](_0x47fd('0x40'))){_0x502492[_0x47fd('0x23')]=qs[_0x47fd('0x23')](_0x6602a2[_0x47fd('0x37')][_0x47fd('0x23')]);_0x502492[_0x47fd('0x21')]=qs[_0x47fd('0x21')](_0x6602a2[_0x47fd('0x37')][_0x47fd('0x21')]);}return _0x105e0c['getFields'](_0x502492);}})['then'](function(_0x503ccc){if(_0x503ccc){return _0x503ccc?{'count':_0x309c44,'rows':_0x503ccc}:null;}})['then'](respondWithResult(_0x4cebd3,null))['catch'](handleError(_0x4cebd3,null));};exports['getSubjects']=function(_0x466d02,_0x4f7e12,_0x2838c9){var _0x54d1bb={};var _0x54bc47={};var _0x373222;var _0x532eef;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x466d02[_0x47fd('0x51')]['id']}})[_0x47fd('0x2b')](handleEntityNotFound(_0x4f7e12,null))[_0x47fd('0x2b')](function(_0x18b330){if(_0x18b330){_0x373222=_0x18b330;_0x54bc47['model']=_[_0x47fd('0x38')](db['SalesforceField']['rawAttributes']);_0x54bc47[_0x47fd('0x37')]=_[_0x47fd('0x38')](_0x466d02[_0x47fd('0x37')]);_0x54bc47['filters']=_[_0x47fd('0x3a')](_0x54bc47[_0x47fd('0x3b')],_0x54bc47[_0x47fd('0x37')]);_0x54d1bb[_0x47fd('0x3c')]=_['intersection'](_0x54bc47[_0x47fd('0x3b')],qs[_0x47fd('0x3d')](_0x466d02[_0x47fd('0x37')]['fields']));_0x54d1bb[_0x47fd('0x3c')]=_0x54d1bb[_0x47fd('0x3c')][_0x47fd('0x3e')]?_0x54d1bb[_0x47fd('0x3c')]:_0x54bc47[_0x47fd('0x3b')];_0x54d1bb[_0x47fd('0x54')]=qs[_0x47fd('0x41')](_0x466d02['query'][_0x47fd('0x41')]);_0x54d1bb[_0x47fd('0x42')]=qs[_0x47fd('0x39')](_[_0x47fd('0x43')](_0x466d02[_0x47fd('0x37')],_0x54bc47[_0x47fd('0x39')]));if(_0x466d02['query'][_0x47fd('0x44')]){_0x54d1bb[_0x47fd('0x42')]=_[_0x47fd('0x46')](_0x54d1bb['where'],{'$or':_['map'](_0x54d1bb['attributes'],function(_0x4e562b){var _0x5d37f3={};_0x5d37f3[_0x4e562b]={'$like':'%'+_0x466d02['query'][_0x47fd('0x44')]+'%'};return _0x5d37f3;})});}_0x54d1bb=_[_0x47fd('0x46')]({},_0x54d1bb,_0x466d02[_0x47fd('0x47')]);return _0x373222[_0x47fd('0x56')](_0x54d1bb);}})[_0x47fd('0x2b')](function(_0xdf0e54){if(_0xdf0e54){_0x532eef=_0xdf0e54[_0x47fd('0x3e')];if(!_0x466d02['query'][_0x47fd('0x3f')](_0x47fd('0x40'))){_0x54d1bb['limit']=qs[_0x47fd('0x23')](_0x466d02[_0x47fd('0x37')][_0x47fd('0x23')]);_0x54d1bb[_0x47fd('0x21')]=qs[_0x47fd('0x21')](_0x466d02['query'][_0x47fd('0x21')]);}return _0x373222['getSubjects'](_0x54d1bb);}})[_0x47fd('0x2b')](function(_0x5f56da){if(_0x5f56da){return _0x5f56da?{'count':_0x532eef,'rows':_0x5f56da}:null;}})[_0x47fd('0x2b')](respondWithResult(_0x4f7e12,null))[_0x47fd('0x4b')](handleError(_0x4f7e12,null));};exports[_0x47fd('0x57')]=function(_0x1a816c,_0x122972,_0x3ff12e){var _0x56087d={};var _0x5395fa={};var _0x4b6076;var _0x331647;return db[_0x47fd('0x33')][_0x47fd('0x52')]({'where':{'id':_0x1a816c[_0x47fd('0x51')]['id']}})[_0x47fd('0x2b')](handleEntityNotFound(_0x122972,null))[_0x47fd('0x2b')](function(_0x283b87){if(_0x283b87){_0x4b6076=_0x283b87;_0x5395fa[_0x47fd('0x3b')]=_[_0x47fd('0x38')](db[_0x47fd('0x53')][_0x47fd('0x4d')]);_0x5395fa[_0x47fd('0x37')]=_[_0x47fd('0x38')](_0x1a816c[_0x47fd('0x37')]);_0x5395fa[_0x47fd('0x39')]=_[_0x47fd('0x3a')](_0x5395fa[_0x47fd('0x3b')],_0x5395fa[_0x47fd('0x37')]);_0x56087d[_0x47fd('0x3c')]=_['intersection'](_0x5395fa[_0x47fd('0x3b')],qs[_0x47fd('0x3d')](_0x1a816c[_0x47fd('0x37')]['fields']));_0x56087d[_0x47fd('0x3c')]=_0x56087d['attributes'][_0x47fd('0x3e')]?_0x56087d['attributes']:_0x5395fa[_0x47fd('0x3b')];_0x56087d[_0x47fd('0x54')]=qs[_0x47fd('0x41')](_0x1a816c[_0x47fd('0x37')][_0x47fd('0x41')]);_0x56087d['where']=qs[_0x47fd('0x39')](_['pick'](_0x1a816c['query'],_0x5395fa[_0x47fd('0x39')]));if(_0x1a816c[_0x47fd('0x37')]['filter']){_0x56087d[_0x47fd('0x42')]=_[_0x47fd('0x46')](_0x56087d[_0x47fd('0x42')],{'$or':_[_0x47fd('0x32')](_0x56087d['attributes'],function(_0x2bfaf1){var _0x1bc7ff={};_0x1bc7ff[_0x2bfaf1]={'$like':'%'+_0x1a816c[_0x47fd('0x37')][_0x47fd('0x44')]+'%'};return _0x1bc7ff;})});}_0x56087d=_['merge']({},_0x56087d,_0x1a816c[_0x47fd('0x47')]);return _0x4b6076[_0x47fd('0x57')](_0x56087d);}})['then'](function(_0x28b123){if(_0x28b123){_0x331647=_0x28b123['length'];if(!_0x1a816c[_0x47fd('0x37')][_0x47fd('0x3f')](_0x47fd('0x40'))){_0x56087d[_0x47fd('0x23')]=qs[_0x47fd('0x23')](_0x1a816c[_0x47fd('0x37')][_0x47fd('0x23')]);_0x56087d[_0x47fd('0x21')]=qs[_0x47fd('0x21')](_0x1a816c[_0x47fd('0x37')]['offset']);}return _0x4b6076[_0x47fd('0x57')](_0x56087d);}})['then'](function(_0x5b665f){if(_0x5b665f){return _0x5b665f?{'count':_0x331647,'rows':_0x5b665f}:null;}})['then'](respondWithResult(_0x122972,null))[_0x47fd('0x4b')](handleError(_0x122972,null));}; \ No newline at end of file +var _0xd337=['attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','params','fields','length','merge','find','create','body','SalesforceField','order','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model'];(function(_0x106538,_0x40771f){var _0x989d53=function(_0x3f8a56){while(--_0x3f8a56){_0x106538['push'](_0x106538['shift']());}};_0x989d53(++_0x40771f);}(_0xd337,0xc3));var _0x7d33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd337[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7d33('0x0'));var rimraf=require(_0x7d33('0x1'));var zipdir=require(_0x7d33('0x2'));var jsonpatch=require(_0x7d33('0x3'));var rp=require(_0x7d33('0x4'));var moment=require(_0x7d33('0x5'));var BPromise=require(_0x7d33('0x6'));var Mustache=require(_0x7d33('0x7'));var util=require('util');var path=require(_0x7d33('0x8'));var sox=require(_0x7d33('0x9'));var csv=require(_0x7d33('0xa'));var ejs=require(_0x7d33('0xb'));var fs=require('fs');var fs_extra=require(_0x7d33('0xc'));var _=require(_0x7d33('0xd'));var squel=require(_0x7d33('0xe'));var crypto=require(_0x7d33('0xf'));var jsforce=require(_0x7d33('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7d33('0xa'));var querystring=require(_0x7d33('0x11'));var Papa=require(_0x7d33('0x12'));var Redis=require(_0x7d33('0x13'));var authService=require(_0x7d33('0x14'));var qs=require(_0x7d33('0x15'));var as=require(_0x7d33('0x16'));var hardwareService=require(_0x7d33('0x17'));var logger=require(_0x7d33('0x18'))(_0x7d33('0x19'));var utils=require(_0x7d33('0x1a'));var config=require(_0x7d33('0x1b'));var licenseUtil=require(_0x7d33('0x1c'));var db=require(_0x7d33('0x1d'))['db'];function respondWithStatusCode(_0x3bb6f6,_0xcc037f){_0xcc037f=_0xcc037f||0xcc;return function(_0x1abe9b){if(_0x1abe9b){return _0x3bb6f6[_0x7d33('0x1e')](_0xcc037f);}return _0x3bb6f6['status'](_0xcc037f)[_0x7d33('0x1f')]();};}function respondWithResult(_0x5ddb1c,_0x1f3f5f){_0x1f3f5f=_0x1f3f5f||0xc8;return function(_0x37781d){if(_0x37781d){return _0x5ddb1c[_0x7d33('0x20')](_0x1f3f5f)['json'](_0x37781d);}};}function respondWithFilteredResult(_0x2fd489,_0xb35294){return function(_0x218175){if(_0x218175){var _0x3f43d8=typeof _0xb35294[_0x7d33('0x21')]==='undefined'&&typeof _0xb35294['limit']===_0x7d33('0x22');var _0x5dac9e=_0x218175[_0x7d33('0x23')];var _0x4d3cfb=_0x3f43d8?0x0:_0xb35294[_0x7d33('0x21')];var _0x30db52=_0x3f43d8?_0x218175[_0x7d33('0x23')]:_0xb35294['offset']+_0xb35294[_0x7d33('0x24')];var _0x217953;if(_0x30db52>=_0x5dac9e){_0x30db52=_0x5dac9e;_0x217953=0xc8;}else{_0x217953=0xce;}_0x2fd489[_0x7d33('0x20')](_0x217953);return _0x2fd489[_0x7d33('0x25')](_0x7d33('0x26'),_0x4d3cfb+'-'+_0x30db52+'/'+_0x5dac9e)['json'](_0x218175);}return null;};}function patchUpdates(_0x312f5a){return function(_0x20c132){try{jsonpatch[_0x7d33('0x27')](_0x20c132,_0x312f5a,!![]);}catch(_0x1af8c5){return BPromise[_0x7d33('0x28')](_0x1af8c5);}return _0x20c132[_0x7d33('0x29')]();};}function saveUpdates(_0x3d5b55,_0x5afb61){return function(_0x5a2565){if(_0x5a2565){return _0x5a2565[_0x7d33('0x2a')](_0x3d5b55)['then'](function(_0x468020){return _0x468020;});}return null;};}function removeEntity(_0x422e97,_0x56a0e3){return function(_0x56bfe7){if(_0x56bfe7){return _0x56bfe7[_0x7d33('0x2b')]()[_0x7d33('0x2c')](function(){_0x422e97[_0x7d33('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bc0bb,_0x70d7dd){return function(_0x5a7a3b){if(!_0x5a7a3b){_0x5bc0bb[_0x7d33('0x1e')](0x194);}return _0x5a7a3b;};}function handleError(_0x4e35b2,_0x43477d){_0x43477d=_0x43477d||0x1f4;return function(_0x5d6471){logger[_0x7d33('0x2d')](_0x5d6471[_0x7d33('0x2e')]);if(_0x5d6471[_0x7d33('0x2f')]){delete _0x5d6471[_0x7d33('0x2f')];}_0x4e35b2['status'](_0x43477d)[_0x7d33('0x30')](_0x5d6471);};}exports['index']=function(_0x4eb000,_0x19e0d0){var _0x4690dd={},_0x1f656c={},_0x4caad6={'count':0x0,'rows':[]};var _0x48db97=_[_0x7d33('0x31')](db[_0x7d33('0x32')][_0x7d33('0x33')],function(_0x45f578){return{'name':_0x45f578[_0x7d33('0x34')],'type':_0x45f578[_0x7d33('0x35')][_0x7d33('0x36')]};});_0x1f656c['model']=_[_0x7d33('0x31')](_0x48db97,_0x7d33('0x2f'));_0x1f656c[_0x7d33('0x37')]=_[_0x7d33('0x38')](_0x4eb000[_0x7d33('0x37')]);_0x1f656c[_0x7d33('0x39')]=_[_0x7d33('0x3a')](_0x1f656c[_0x7d33('0x3b')],_0x1f656c[_0x7d33('0x37')]);_0x4690dd['attributes']=_['intersection'](_0x1f656c[_0x7d33('0x3b')],qs['fields'](_0x4eb000[_0x7d33('0x37')]['fields']));_0x4690dd['attributes']=_0x4690dd['attributes']['length']?_0x4690dd[_0x7d33('0x3c')]:_0x1f656c[_0x7d33('0x3b')];if(!_0x4eb000['query'][_0x7d33('0x3d')](_0x7d33('0x3e'))){_0x4690dd[_0x7d33('0x24')]=qs[_0x7d33('0x24')](_0x4eb000[_0x7d33('0x37')][_0x7d33('0x24')]);_0x4690dd[_0x7d33('0x21')]=qs[_0x7d33('0x21')](_0x4eb000[_0x7d33('0x37')][_0x7d33('0x21')]);}_0x4690dd['order']=qs[_0x7d33('0x3f')](_0x4eb000[_0x7d33('0x37')]['sort']);_0x4690dd[_0x7d33('0x40')]=qs['filters'](_[_0x7d33('0x41')](_0x4eb000[_0x7d33('0x37')],_0x1f656c[_0x7d33('0x39')]),_0x48db97);if(_0x4eb000['query'][_0x7d33('0x42')]){_0x4690dd[_0x7d33('0x40')]=_['merge'](_0x4690dd['where'],{'$or':_[_0x7d33('0x31')](_0x48db97,function(_0xdfde26){if(_0xdfde26[_0x7d33('0x35')]!==_0x7d33('0x43')){var _0x48c98b={};_0x48c98b[_0xdfde26['name']]={'$like':'%'+_0x4eb000[_0x7d33('0x37')][_0x7d33('0x42')]+'%'};return _0x48c98b;}})});}_0x4690dd=_['merge']({},_0x4690dd,_0x4eb000[_0x7d33('0x44')]);var _0x37494f={'where':_0x4690dd[_0x7d33('0x40')]};return db[_0x7d33('0x32')][_0x7d33('0x23')](_0x37494f)['then'](function(_0x308b38){_0x4caad6[_0x7d33('0x23')]=_0x308b38;if(_0x4eb000['query'][_0x7d33('0x45')]){_0x4690dd[_0x7d33('0x46')]=[{'all':!![]}];}return db[_0x7d33('0x32')][_0x7d33('0x47')](_0x4690dd);})[_0x7d33('0x2c')](function(_0x421cca){_0x4caad6['rows']=_0x421cca;return _0x4caad6;})[_0x7d33('0x2c')](respondWithFilteredResult(_0x19e0d0,_0x4690dd))[_0x7d33('0x48')](handleError(_0x19e0d0,null));};exports['show']=function(_0x2e6e9e,_0x49de86){var _0x5ebaf1={'raw':![],'where':{'id':_0x2e6e9e[_0x7d33('0x49')]['id']}},_0x45aba0={};_0x45aba0[_0x7d33('0x3b')]=_[_0x7d33('0x38')](db[_0x7d33('0x32')][_0x7d33('0x33')]);_0x45aba0[_0x7d33('0x37')]=_['keys'](_0x2e6e9e[_0x7d33('0x37')]);_0x45aba0[_0x7d33('0x39')]=_[_0x7d33('0x3a')](_0x45aba0['model'],_0x45aba0[_0x7d33('0x37')]);_0x5ebaf1[_0x7d33('0x3c')]=_[_0x7d33('0x3a')](_0x45aba0[_0x7d33('0x3b')],qs[_0x7d33('0x4a')](_0x2e6e9e[_0x7d33('0x37')][_0x7d33('0x4a')]));_0x5ebaf1['attributes']=_0x5ebaf1[_0x7d33('0x3c')][_0x7d33('0x4b')]?_0x5ebaf1[_0x7d33('0x3c')]:_0x45aba0['model'];if(_0x2e6e9e['query'][_0x7d33('0x45')]){_0x5ebaf1['include']=[{'all':!![]}];}_0x5ebaf1=_[_0x7d33('0x4c')]({},_0x5ebaf1,_0x2e6e9e[_0x7d33('0x44')]);return db['SalesforceConfiguration'][_0x7d33('0x4d')](_0x5ebaf1)['then'](handleEntityNotFound(_0x49de86,null))[_0x7d33('0x2c')](respondWithResult(_0x49de86,null))[_0x7d33('0x48')](handleError(_0x49de86,null));};exports[_0x7d33('0x4e')]=function(_0xb785cd,_0x46c073){return db[_0x7d33('0x32')][_0x7d33('0x4e')](_0xb785cd[_0x7d33('0x4f')],{})[_0x7d33('0x2c')](respondWithResult(_0x46c073,0xc9))[_0x7d33('0x48')](handleError(_0x46c073,null));};exports[_0x7d33('0x2a')]=function(_0xdc3688,_0x17d082){if(_0xdc3688['body']['id']){delete _0xdc3688[_0x7d33('0x4f')]['id'];}return db['SalesforceConfiguration'][_0x7d33('0x4d')]({'where':{'id':_0xdc3688['params']['id']}})[_0x7d33('0x2c')](handleEntityNotFound(_0x17d082,null))[_0x7d33('0x2c')](saveUpdates(_0xdc3688['body'],null))[_0x7d33('0x2c')](respondWithResult(_0x17d082,null))[_0x7d33('0x48')](handleError(_0x17d082,null));};exports[_0x7d33('0x2b')]=function(_0x5f3570,_0x9fba07){return db[_0x7d33('0x32')][_0x7d33('0x4d')]({'where':{'id':_0x5f3570[_0x7d33('0x49')]['id']}})[_0x7d33('0x2c')](handleEntityNotFound(_0x9fba07,null))[_0x7d33('0x2c')](removeEntity(_0x9fba07,null))[_0x7d33('0x48')](handleError(_0x9fba07,null));};exports['getFields']=function(_0x280375,_0x259ae2,_0x12c13c){var _0x1eed17={};var _0x2f1016={};var _0x1b62af;var _0x3d31e6;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x280375[_0x7d33('0x49')]['id']}})[_0x7d33('0x2c')](handleEntityNotFound(_0x259ae2,null))[_0x7d33('0x2c')](function(_0x5408ca){if(_0x5408ca){_0x1b62af=_0x5408ca;_0x2f1016[_0x7d33('0x3b')]=_[_0x7d33('0x38')](db[_0x7d33('0x50')][_0x7d33('0x33')]);_0x2f1016[_0x7d33('0x37')]=_[_0x7d33('0x38')](_0x280375[_0x7d33('0x37')]);_0x2f1016[_0x7d33('0x39')]=_[_0x7d33('0x3a')](_0x2f1016[_0x7d33('0x3b')],_0x2f1016[_0x7d33('0x37')]);_0x1eed17['attributes']=_[_0x7d33('0x3a')](_0x2f1016['model'],qs[_0x7d33('0x4a')](_0x280375[_0x7d33('0x37')][_0x7d33('0x4a')]));_0x1eed17[_0x7d33('0x3c')]=_0x1eed17[_0x7d33('0x3c')][_0x7d33('0x4b')]?_0x1eed17[_0x7d33('0x3c')]:_0x2f1016[_0x7d33('0x3b')];_0x1eed17[_0x7d33('0x51')]=qs[_0x7d33('0x3f')](_0x280375[_0x7d33('0x37')][_0x7d33('0x3f')]);_0x1eed17[_0x7d33('0x40')]=qs[_0x7d33('0x39')](_[_0x7d33('0x41')](_0x280375[_0x7d33('0x37')],_0x2f1016[_0x7d33('0x39')]));if(_0x280375[_0x7d33('0x37')][_0x7d33('0x42')]){_0x1eed17['where']=_[_0x7d33('0x4c')](_0x1eed17['where'],{'$or':_[_0x7d33('0x31')](_0x1eed17[_0x7d33('0x3c')],function(_0x4836ac){var _0xdeaa50={};_0xdeaa50[_0x4836ac]={'$like':'%'+_0x280375[_0x7d33('0x37')]['filter']+'%'};return _0xdeaa50;})});}_0x1eed17=_['merge']({},_0x1eed17,_0x280375[_0x7d33('0x44')]);return _0x1b62af['getFields'](_0x1eed17);}})['then'](function(_0x425fb4){if(_0x425fb4){_0x3d31e6=_0x425fb4[_0x7d33('0x4b')];if(!_0x280375[_0x7d33('0x37')]['hasOwnProperty'](_0x7d33('0x3e'))){_0x1eed17['limit']=qs['limit'](_0x280375[_0x7d33('0x37')][_0x7d33('0x24')]);_0x1eed17[_0x7d33('0x21')]=qs['offset'](_0x280375['query'][_0x7d33('0x21')]);}return _0x1b62af['getFields'](_0x1eed17);}})[_0x7d33('0x2c')](function(_0x55338c){if(_0x55338c){return _0x55338c?{'count':_0x3d31e6,'rows':_0x55338c}:null;}})[_0x7d33('0x2c')](respondWithResult(_0x259ae2,null))[_0x7d33('0x48')](handleError(_0x259ae2,null));};exports[_0x7d33('0x52')]=function(_0x28b2c1,_0x3fb8a3,_0x502edf){var _0x3c23b9={};var _0x231cc0={};var _0x3c1500;var _0x3fec8d;return db['SalesforceConfiguration'][_0x7d33('0x53')]({'where':{'id':_0x28b2c1['params']['id']}})[_0x7d33('0x2c')](handleEntityNotFound(_0x3fb8a3,null))[_0x7d33('0x2c')](function(_0x4849dc){if(_0x4849dc){_0x3c1500=_0x4849dc;_0x231cc0[_0x7d33('0x3b')]=_['keys'](db['SalesforceField'][_0x7d33('0x33')]);_0x231cc0[_0x7d33('0x37')]=_[_0x7d33('0x38')](_0x28b2c1[_0x7d33('0x37')]);_0x231cc0['filters']=_[_0x7d33('0x3a')](_0x231cc0[_0x7d33('0x3b')],_0x231cc0[_0x7d33('0x37')]);_0x3c23b9['attributes']=_['intersection'](_0x231cc0[_0x7d33('0x3b')],qs[_0x7d33('0x4a')](_0x28b2c1[_0x7d33('0x37')]['fields']));_0x3c23b9[_0x7d33('0x3c')]=_0x3c23b9['attributes']['length']?_0x3c23b9[_0x7d33('0x3c')]:_0x231cc0[_0x7d33('0x3b')];_0x3c23b9['order']=qs[_0x7d33('0x3f')](_0x28b2c1['query'][_0x7d33('0x3f')]);_0x3c23b9['where']=qs[_0x7d33('0x39')](_[_0x7d33('0x41')](_0x28b2c1[_0x7d33('0x37')],_0x231cc0['filters']));if(_0x28b2c1['query'][_0x7d33('0x42')]){_0x3c23b9['where']=_['merge'](_0x3c23b9[_0x7d33('0x40')],{'$or':_['map'](_0x3c23b9[_0x7d33('0x3c')],function(_0x5b49bd){var _0x5457fc={};_0x5457fc[_0x5b49bd]={'$like':'%'+_0x28b2c1[_0x7d33('0x37')][_0x7d33('0x42')]+'%'};return _0x5457fc;})});}_0x3c23b9=_['merge']({},_0x3c23b9,_0x28b2c1['options']);return _0x3c1500[_0x7d33('0x52')](_0x3c23b9);}})[_0x7d33('0x2c')](function(_0x2fc9df){if(_0x2fc9df){_0x3fec8d=_0x2fc9df['length'];if(!_0x28b2c1[_0x7d33('0x37')]['hasOwnProperty']('nolimit')){_0x3c23b9[_0x7d33('0x24')]=qs[_0x7d33('0x24')](_0x28b2c1[_0x7d33('0x37')][_0x7d33('0x24')]);_0x3c23b9[_0x7d33('0x21')]=qs[_0x7d33('0x21')](_0x28b2c1[_0x7d33('0x37')][_0x7d33('0x21')]);}return _0x3c1500[_0x7d33('0x52')](_0x3c23b9);}})[_0x7d33('0x2c')](function(_0x314306){if(_0x314306){return _0x314306?{'count':_0x3fec8d,'rows':_0x314306}:null;}})[_0x7d33('0x2c')](respondWithResult(_0x3fb8a3,null))[_0x7d33('0x48')](handleError(_0x3fb8a3,null));};exports['getDescriptions']=function(_0x4dfc79,_0x307048,_0x2b1f11){var _0x2cd2cb={};var _0x1f194b={};var _0x1d48de;var _0x463486;return db[_0x7d33('0x32')][_0x7d33('0x53')]({'where':{'id':_0x4dfc79[_0x7d33('0x49')]['id']}})[_0x7d33('0x2c')](handleEntityNotFound(_0x307048,null))['then'](function(_0x3849d7){if(_0x3849d7){_0x1d48de=_0x3849d7;_0x1f194b[_0x7d33('0x3b')]=_['keys'](db[_0x7d33('0x50')]['rawAttributes']);_0x1f194b[_0x7d33('0x37')]=_[_0x7d33('0x38')](_0x4dfc79['query']);_0x1f194b['filters']=_[_0x7d33('0x3a')](_0x1f194b['model'],_0x1f194b[_0x7d33('0x37')]);_0x2cd2cb[_0x7d33('0x3c')]=_[_0x7d33('0x3a')](_0x1f194b[_0x7d33('0x3b')],qs[_0x7d33('0x4a')](_0x4dfc79[_0x7d33('0x37')]['fields']));_0x2cd2cb['attributes']=_0x2cd2cb['attributes'][_0x7d33('0x4b')]?_0x2cd2cb[_0x7d33('0x3c')]:_0x1f194b['model'];_0x2cd2cb[_0x7d33('0x51')]=qs[_0x7d33('0x3f')](_0x4dfc79[_0x7d33('0x37')][_0x7d33('0x3f')]);_0x2cd2cb[_0x7d33('0x40')]=qs[_0x7d33('0x39')](_[_0x7d33('0x41')](_0x4dfc79[_0x7d33('0x37')],_0x1f194b[_0x7d33('0x39')]));if(_0x4dfc79['query'][_0x7d33('0x42')]){_0x2cd2cb[_0x7d33('0x40')]=_[_0x7d33('0x4c')](_0x2cd2cb[_0x7d33('0x40')],{'$or':_[_0x7d33('0x31')](_0x2cd2cb[_0x7d33('0x3c')],function(_0x3f3538){var _0x48c31c={};_0x48c31c[_0x3f3538]={'$like':'%'+_0x4dfc79[_0x7d33('0x37')][_0x7d33('0x42')]+'%'};return _0x48c31c;})});}_0x2cd2cb=_['merge']({},_0x2cd2cb,_0x4dfc79[_0x7d33('0x44')]);return _0x1d48de[_0x7d33('0x54')](_0x2cd2cb);}})['then'](function(_0xcb6aff){if(_0xcb6aff){_0x463486=_0xcb6aff[_0x7d33('0x4b')];if(!_0x4dfc79[_0x7d33('0x37')]['hasOwnProperty']('nolimit')){_0x2cd2cb[_0x7d33('0x24')]=qs[_0x7d33('0x24')](_0x4dfc79[_0x7d33('0x37')]['limit']);_0x2cd2cb[_0x7d33('0x21')]=qs[_0x7d33('0x21')](_0x4dfc79[_0x7d33('0x37')][_0x7d33('0x21')]);}return _0x1d48de[_0x7d33('0x54')](_0x2cd2cb);}})[_0x7d33('0x2c')](function(_0x334d9c){if(_0x334d9c){return _0x334d9c?{'count':_0x463486,'rows':_0x334d9c}:null;}})['then'](respondWithResult(_0x307048,null))[_0x7d33('0x48')](handleError(_0x307048,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index c8d3db8..d0395af 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 _0x1895=['../../config/logger','moment','bluebird','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','util'];(function(_0x530198,_0xf18456){var _0x559702=function(_0x4dfa3a){while(--_0x4dfa3a){_0x530198['push'](_0x530198['shift']());}};_0x559702(++_0xf18456);}(_0x1895,0xf2));var _0x5189=function(_0x241b66,_0x312e8f){_0x241b66=_0x241b66-0x0;var _0x59b037=_0x1895[_0x241b66];return _0x59b037;};'use strict';var _=require('lodash');var util=require(_0x5189('0x0'));var logger=require(_0x5189('0x1'))('api');var moment=require(_0x5189('0x2'));var BPromise=require(_0x5189('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5189('0x4'));var rimraf=require(_0x5189('0x5'));var config=require('../../config/environment');var attributes=require(_0x5189('0x6'));module[_0x5189('0x7')]=function(_0x1e586e,_0x124192){return _0x1e586e[_0x5189('0x8')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x410d=['rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x181b07,_0x42fa2c){var _0x3a481a=function(_0xe39776){while(--_0xe39776){_0x181b07['push'](_0x181b07['shift']());}};_0x3a481a(++_0x42fa2c);}(_0x410d,0x66));var _0xd410=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0x410d[_0x1acc2d];return _0xabfa6d;};'use strict';var _=require(_0xd410('0x0'));var util=require(_0xd410('0x1'));var logger=require(_0xd410('0x2'))('api');var moment=require(_0xd410('0x3'));var BPromise=require('bluebird');var rp=require(_0xd410('0x4'));var fs=require('fs');var path=require(_0xd410('0x5'));var rimraf=require(_0xd410('0x6'));var config=require(_0xd410('0x7'));var attributes=require(_0xd410('0x8'));module['exports']=function(_0x3b1835,_0x212505){return _0x3b1835[_0xd410('0x9')](_0xd410('0xa'),attributes,{'tableName':_0xd410('0xb'),'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 7451498..289f9af 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 _0xcff1=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5adfa9,_0x4b835d){var _0x458f41=function(_0x504e46){while(--_0x504e46){_0x5adfa9['push'](_0x5adfa9['shift']());}};_0x458f41(++_0x4b835d);}(_0xcff1,0x7e));var _0x1cff=function(_0x29dda1,_0x508e13){_0x29dda1=_0x29dda1-0x0;var _0x21b0ef=_0xcff1[_0x29dda1];return _0x21b0ef;};'use strict';var _=require(_0x1cff('0x0'));var util=require(_0x1cff('0x1'));var moment=require(_0x1cff('0x2'));var BPromise=require(_0x1cff('0x3'));var rs=require(_0x1cff('0x4'));var fs=require('fs');var Redis=require(_0x1cff('0x5'));var db=require(_0x1cff('0x6'))['db'];var utils=require(_0x1cff('0x7'));var logger=require(_0x1cff('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1cff('0x9'));var client=jayson[_0x1cff('0xa')][_0x1cff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3644ed,_0x1cfb0a,_0x1cd6d3){return new BPromise(function(_0x2bce0d,_0xcf07e5){return client[_0x1cff('0xc')](_0x3644ed,_0x1cd6d3)[_0x1cff('0xd')](function(_0x1ab641){logger[_0x1cff('0xe')](_0x1cff('0xf'),_0x1cfb0a,_0x1cff('0x10'));logger[_0x1cff('0x11')](_0x1cff('0x12'),_0x1cfb0a,_0x1cff('0x10'),JSON[_0x1cff('0x13')](_0x1ab641));if(_0x1ab641[_0x1cff('0x14')]){if(_0x1ab641[_0x1cff('0x14')][_0x1cff('0x15')]===0x1f4){logger['error'](_0x1cff('0xf'),_0x1cfb0a,_0x1ab641['error'][_0x1cff('0x16')]);return _0xcf07e5(_0x1ab641[_0x1cff('0x14')]['message']);}logger['error'](_0x1cff('0xf'),_0x1cfb0a,_0x1ab641[_0x1cff('0x14')][_0x1cff('0x16')]);return _0x2bce0d(_0x1ab641[_0x1cff('0x14')]['message']);}else{logger[_0x1cff('0xe')](_0x1cff('0xf'),_0x1cfb0a,_0x1cff('0x10'));_0x2bce0d(_0x1ab641[_0x1cff('0x17')][_0x1cff('0x16')]);}})[_0x1cff('0x18')](function(_0x8353b9){logger[_0x1cff('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1cfb0a,_0x8353b9);_0xcf07e5(_0x8353b9);});});} \ No newline at end of file +var _0x56df=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x56df,0x1d3));var _0xf56d=function(_0x160b22,_0x2aef42){_0x160b22=_0x160b22-0x0;var _0x15789f=_0x56df[_0x160b22];return _0x15789f;};'use strict';var _=require(_0xf56d('0x0'));var util=require(_0xf56d('0x1'));var moment=require('moment');var BPromise=require(_0xf56d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf56d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf56d('0x4'));var logger=require(_0xf56d('0x5'))(_0xf56d('0x6'));var config=require(_0xf56d('0x7'));var jayson=require(_0xf56d('0x8'));var client=jayson[_0xf56d('0x9')][_0xf56d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x424240,_0x36f35b,_0x6fa31d){return new BPromise(function(_0x518e29,_0x166ac0){return client[_0xf56d('0xb')](_0x424240,_0x6fa31d)[_0xf56d('0xc')](function(_0xdedeb7){logger['info'](_0xf56d('0xd'),_0x36f35b,_0xf56d('0xe'));logger[_0xf56d('0xf')](_0xf56d('0x10'),_0x36f35b,_0xf56d('0xe'),JSON[_0xf56d('0x11')](_0xdedeb7));if(_0xdedeb7['error']){if(_0xdedeb7['error'][_0xf56d('0x12')]===0x1f4){logger[_0xf56d('0x13')](_0xf56d('0xd'),_0x36f35b,_0xdedeb7['error'][_0xf56d('0x14')]);return _0x166ac0(_0xdedeb7['error'][_0xf56d('0x14')]);}logger[_0xf56d('0x13')](_0xf56d('0xd'),_0x36f35b,_0xdedeb7[_0xf56d('0x13')][_0xf56d('0x14')]);return _0x518e29(_0xdedeb7[_0xf56d('0x13')][_0xf56d('0x14')]);}else{logger[_0xf56d('0x15')](_0xf56d('0xd'),_0x36f35b,'request\x20sent');_0x518e29(_0xdedeb7['result'][_0xf56d('0x14')]);}})[_0xf56d('0x16')](function(_0x5119ce){logger['error'](_0xf56d('0xd'),_0x36f35b,_0x5119ce);_0x166ac0(_0x5119ce);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 8413085..0776b4c 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 _0x402a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','post','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x402a,0xd3));var _0xa402=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x402a[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xa402('0x0'));var util=require('util');var path=require(_0xa402('0x1'));var timeout=require(_0xa402('0x2'));var express=require(_0xa402('0x3'));var router=express['Router']();var fs_extra=require(_0xa402('0x4'));var auth=require(_0xa402('0x5'));var interaction=require(_0xa402('0x6'));var config=require(_0xa402('0x7'));var controller=require(_0xa402('0x8'));router[_0xa402('0x9')]('/',auth[_0xa402('0xa')](),controller['index']);router[_0xa402('0x9')]('/:id',auth[_0xa402('0xa')](),controller['show']);router[_0xa402('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa402('0xc')]('/:id',auth[_0xa402('0xa')](),controller[_0xa402('0xd')]);router[_0xa402('0xe')](_0xa402('0xf'),auth['isAuthenticated'](),controller[_0xa402('0x10')]);module[_0xa402('0x11')]=router; \ No newline at end of file +var _0x137b=['./intSalesforceField.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x1ec65c,_0x354923){var _0x5249c2=function(_0x451341){while(--_0x451341){_0x1ec65c['push'](_0x1ec65c['shift']());}};_0x5249c2(++_0x354923);}(_0x137b,0xc9));var _0xb137=function(_0x12012d,_0x46e1f6){_0x12012d=_0x12012d-0x0;var _0x2ccaf1=_0x137b[_0x12012d];return _0x2ccaf1;};'use strict';var multer=require(_0xb137('0x0'));var util=require(_0xb137('0x1'));var path=require(_0xb137('0x2'));var timeout=require(_0xb137('0x3'));var express=require(_0xb137('0x4'));var router=express[_0xb137('0x5')]();var fs_extra=require(_0xb137('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb137('0x7'));var controller=require(_0xb137('0x8'));router['get']('/',auth[_0xb137('0x9')](),controller[_0xb137('0xa')]);router[_0xb137('0xb')](_0xb137('0xc'),auth[_0xb137('0x9')](),controller[_0xb137('0xd')]);router[_0xb137('0xe')]('/',auth[_0xb137('0x9')](),controller[_0xb137('0xf')]);router[_0xb137('0x10')](_0xb137('0xc'),auth[_0xb137('0x9')](),controller['update']);router[_0xb137('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb137('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 2b0faa4..b2c121e 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 _0xc132=['ENUM','string','variable','customVariable','picklist','STRING','exports'];(function(_0x1551bc,_0x334b59){var _0x228deb=function(_0x15551d){while(--_0x15551d){_0x1551bc['push'](_0x1551bc['shift']());}};_0x228deb(++_0x334b59);}(_0xc132,0x125));var _0x2c13=function(_0x1d94ae,_0x32b3fd){_0x1d94ae=_0x1d94ae-0x0;var _0x4a14d6=_0xc132[_0x1d94ae];return _0x4a14d6;};'use strict';var Sequelize=require('sequelize');module[_0x2c13('0x0')]={'type':{'type':Sequelize[_0x2c13('0x1')](_0x2c13('0x2'),_0x2c13('0x3'),_0x2c13('0x4'),'keyValue',_0x2c13('0x5')),'defaultValue':_0x2c13('0x2')},'content':{'type':Sequelize[_0x2c13('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2c13('0x1')](_0x2c13('0x2'),'variable',_0x2c13('0x4'))},'keyContent':{'type':Sequelize[_0x2c13('0x6')]},'idField':{'type':Sequelize[_0x2c13('0x6')]},'variableName':{'type':Sequelize[_0x2c13('0x6')]}}; \ No newline at end of file +var _0x11f9=['variable','customVariable','keyValue','picklist','STRING','sequelize','ENUM','string'];(function(_0x565569,_0x5c0375){var _0x1ac5da=function(_0x1f052b){while(--_0x1f052b){_0x565569['push'](_0x565569['shift']());}};_0x1ac5da(++_0x5c0375);}(_0x11f9,0x15d));var _0x911f=function(_0x254634,_0x171c94){_0x254634=_0x254634-0x0;var _0x1e1063=_0x11f9[_0x254634];return _0x1e1063;};'use strict';var Sequelize=require(_0x911f('0x0'));module['exports']={'type':{'type':Sequelize[_0x911f('0x1')](_0x911f('0x2'),_0x911f('0x3'),_0x911f('0x4'),_0x911f('0x5'),_0x911f('0x6')),'defaultValue':_0x911f('0x2')},'content':{'type':Sequelize[_0x911f('0x7')]},'key':{'type':Sequelize[_0x911f('0x7')]},'keyType':{'type':Sequelize[_0x911f('0x1')](_0x911f('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x911f('0x7')]},'idField':{'type':Sequelize[_0x911f('0x7')]},'variableName':{'type':Sequelize[_0x911f('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index fcf97a4..1f32b95 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 _0x8c60=['sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x8c60,0x17e));var _0x08c6=function(_0x395017,_0x28feca){_0x395017=_0x395017-0x0;var _0x2d8f2a=_0x8c60[_0x395017];return _0x2d8f2a;};'use strict';var emlformat=require(_0x08c6('0x0'));var rimraf=require(_0x08c6('0x1'));var zipdir=require(_0x08c6('0x2'));var jsonpatch=require(_0x08c6('0x3'));var rp=require(_0x08c6('0x4'));var moment=require('moment');var BPromise=require(_0x08c6('0x5'));var Mustache=require('mustache');var util=require(_0x08c6('0x6'));var path=require(_0x08c6('0x7'));var sox=require(_0x08c6('0x8'));var csv=require(_0x08c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x08c6('0xa'));var _=require('lodash');var squel=require(_0x08c6('0xb'));var crypto=require('crypto');var jsforce=require(_0x08c6('0xc'));var deskjs=require(_0x08c6('0xd'));var toCsv=require(_0x08c6('0x9'));var querystring=require('querystring');var Papa=require(_0x08c6('0xe'));var Redis=require(_0x08c6('0xf'));var authService=require(_0x08c6('0x10'));var qs=require(_0x08c6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x08c6('0x12'));var logger=require(_0x08c6('0x13'))(_0x08c6('0x14'));var utils=require(_0x08c6('0x15'));var config=require(_0x08c6('0x16'));var licenseUtil=require(_0x08c6('0x17'));var db=require(_0x08c6('0x18'))['db'];function respondWithStatusCode(_0x4d2f47,_0x11a40a){_0x11a40a=_0x11a40a||0xcc;return function(_0x1a5deb){if(_0x1a5deb){return _0x4d2f47[_0x08c6('0x19')](_0x11a40a);}return _0x4d2f47[_0x08c6('0x1a')](_0x11a40a)['end']();};}function respondWithResult(_0x2503f3,_0x4b6e7f){_0x4b6e7f=_0x4b6e7f||0xc8;return function(_0x517e90){if(_0x517e90){return _0x2503f3[_0x08c6('0x1a')](_0x4b6e7f)[_0x08c6('0x1b')](_0x517e90);}};}function respondWithFilteredResult(_0x104e65,_0x2b1bef){return function(_0x30909c){if(_0x30909c){var _0x3e059f=typeof _0x2b1bef[_0x08c6('0x1c')]===_0x08c6('0x1d')&&typeof _0x2b1bef[_0x08c6('0x1e')]===_0x08c6('0x1d');var _0x18cbd4=_0x30909c[_0x08c6('0x1f')];var _0x999bb0=_0x3e059f?0x0:_0x2b1bef[_0x08c6('0x1c')];var _0x37a6eb=_0x3e059f?_0x30909c[_0x08c6('0x1f')]:_0x2b1bef[_0x08c6('0x1c')]+_0x2b1bef[_0x08c6('0x1e')];var _0x3d5e94;if(_0x37a6eb>=_0x18cbd4){_0x37a6eb=_0x18cbd4;_0x3d5e94=0xc8;}else{_0x3d5e94=0xce;}_0x104e65[_0x08c6('0x1a')](_0x3d5e94);return _0x104e65[_0x08c6('0x20')](_0x08c6('0x21'),_0x999bb0+'-'+_0x37a6eb+'/'+_0x18cbd4)[_0x08c6('0x1b')](_0x30909c);}return null;};}function patchUpdates(_0x50a05a){return function(_0x21bbb6){try{jsonpatch[_0x08c6('0x22')](_0x21bbb6,_0x50a05a,!![]);}catch(_0x40c7d2){return BPromise[_0x08c6('0x23')](_0x40c7d2);}return _0x21bbb6[_0x08c6('0x24')]();};}function saveUpdates(_0x234014,_0xf1e58){return function(_0x504589){if(_0x504589){return _0x504589[_0x08c6('0x25')](_0x234014)[_0x08c6('0x26')](function(_0x2d7403){return _0x2d7403;});}return null;};}function removeEntity(_0x4e641d,_0x48a9ec){return function(_0x4179e4){if(_0x4179e4){return _0x4179e4[_0x08c6('0x27')]()[_0x08c6('0x26')](function(){_0x4e641d[_0x08c6('0x1a')](0xcc)[_0x08c6('0x28')]();});}};}function handleEntityNotFound(_0x4d2ded,_0x56e8e9){return function(_0x3b28ae){if(!_0x3b28ae){_0x4d2ded[_0x08c6('0x19')](0x194);}return _0x3b28ae;};}function handleError(_0xf6eee2,_0x239e64){_0x239e64=_0x239e64||0x1f4;return function(_0x50ef6f){logger[_0x08c6('0x29')](_0x50ef6f[_0x08c6('0x2a')]);if(_0x50ef6f['name']){delete _0x50ef6f[_0x08c6('0x2b')];}_0xf6eee2[_0x08c6('0x1a')](_0x239e64)[_0x08c6('0x2c')](_0x50ef6f);};}exports[_0x08c6('0x2d')]=function(_0x21d857,_0x506791){var _0x5560a5={},_0x49924a={},_0x234827={'count':0x0,'rows':[]};var _0x23f226=_[_0x08c6('0x2e')](db[_0x08c6('0x2f')][_0x08c6('0x30')],function(_0x58bf49){return{'name':_0x58bf49[_0x08c6('0x31')],'type':_0x58bf49[_0x08c6('0x32')][_0x08c6('0x33')]};});_0x49924a[_0x08c6('0x34')]=_['map'](_0x23f226,_0x08c6('0x2b'));_0x49924a[_0x08c6('0x35')]=_[_0x08c6('0x36')](_0x21d857[_0x08c6('0x35')]);_0x49924a[_0x08c6('0x37')]=_[_0x08c6('0x38')](_0x49924a[_0x08c6('0x34')],_0x49924a[_0x08c6('0x35')]);_0x5560a5[_0x08c6('0x39')]=_[_0x08c6('0x38')](_0x49924a[_0x08c6('0x34')],qs[_0x08c6('0x3a')](_0x21d857[_0x08c6('0x35')]['fields']));_0x5560a5[_0x08c6('0x39')]=_0x5560a5[_0x08c6('0x39')][_0x08c6('0x3b')]?_0x5560a5['attributes']:_0x49924a[_0x08c6('0x34')];if(!_0x21d857[_0x08c6('0x35')][_0x08c6('0x3c')](_0x08c6('0x3d'))){_0x5560a5[_0x08c6('0x1e')]=qs[_0x08c6('0x1e')](_0x21d857[_0x08c6('0x35')]['limit']);_0x5560a5[_0x08c6('0x1c')]=qs['offset'](_0x21d857['query']['offset']);}_0x5560a5['order']=qs[_0x08c6('0x3e')](_0x21d857['query'][_0x08c6('0x3e')]);_0x5560a5[_0x08c6('0x3f')]=qs['filters'](_[_0x08c6('0x40')](_0x21d857[_0x08c6('0x35')],_0x49924a['filters']),_0x23f226);if(_0x21d857[_0x08c6('0x35')][_0x08c6('0x41')]){_0x5560a5[_0x08c6('0x3f')]=_[_0x08c6('0x42')](_0x5560a5['where'],{'$or':_[_0x08c6('0x2e')](_0x23f226,function(_0x240468){if(_0x240468[_0x08c6('0x32')]!=='VIRTUAL'){var _0x54e362={};_0x54e362[_0x240468[_0x08c6('0x2b')]]={'$like':'%'+_0x21d857[_0x08c6('0x35')][_0x08c6('0x41')]+'%'};return _0x54e362;}})});}_0x5560a5=_[_0x08c6('0x42')]({},_0x5560a5,_0x21d857['options']);var _0x23a7dc={'where':_0x5560a5['where']};return db['SalesforceField'][_0x08c6('0x1f')](_0x23a7dc)['then'](function(_0x1d2c80){_0x234827[_0x08c6('0x1f')]=_0x1d2c80;if(_0x21d857[_0x08c6('0x35')][_0x08c6('0x43')]){_0x5560a5[_0x08c6('0x44')]=[{'all':!![]}];}return db['SalesforceField'][_0x08c6('0x45')](_0x5560a5);})[_0x08c6('0x26')](function(_0x444727){_0x234827[_0x08c6('0x46')]=_0x444727;return _0x234827;})[_0x08c6('0x26')](respondWithFilteredResult(_0x506791,_0x5560a5))[_0x08c6('0x47')](handleError(_0x506791,null));};exports[_0x08c6('0x48')]=function(_0x49bded,_0x3d5f1d){var _0xc81724={'raw':!![],'where':{'id':_0x49bded['params']['id']}},_0x20f16d={};_0x20f16d['model']=_[_0x08c6('0x36')](db[_0x08c6('0x2f')][_0x08c6('0x30')]);_0x20f16d['query']=_[_0x08c6('0x36')](_0x49bded[_0x08c6('0x35')]);_0x20f16d[_0x08c6('0x37')]=_[_0x08c6('0x38')](_0x20f16d[_0x08c6('0x34')],_0x20f16d[_0x08c6('0x35')]);_0xc81724['attributes']=_['intersection'](_0x20f16d[_0x08c6('0x34')],qs[_0x08c6('0x3a')](_0x49bded['query'][_0x08c6('0x3a')]));_0xc81724[_0x08c6('0x39')]=_0xc81724['attributes'][_0x08c6('0x3b')]?_0xc81724[_0x08c6('0x39')]:_0x20f16d['model'];if(_0x49bded[_0x08c6('0x35')][_0x08c6('0x43')]){_0xc81724['include']=[{'all':!![]}];}_0xc81724=_['merge']({},_0xc81724,_0x49bded[_0x08c6('0x49')]);return db[_0x08c6('0x2f')][_0x08c6('0x4a')](_0xc81724)[_0x08c6('0x26')](handleEntityNotFound(_0x3d5f1d,null))[_0x08c6('0x26')](respondWithResult(_0x3d5f1d,null))['catch'](handleError(_0x3d5f1d,null));};exports['create']=function(_0x541723,_0x4e8415){return db[_0x08c6('0x2f')][_0x08c6('0x4b')](_0x541723['body'],{})[_0x08c6('0x26')](respondWithResult(_0x4e8415,0xc9))[_0x08c6('0x47')](handleError(_0x4e8415,null));};exports[_0x08c6('0x25')]=function(_0x555d6e,_0x2729f9){if(_0x555d6e[_0x08c6('0x4c')]['id']){delete _0x555d6e[_0x08c6('0x4c')]['id'];}return db[_0x08c6('0x2f')][_0x08c6('0x4a')]({'where':{'id':_0x555d6e['params']['id']}})[_0x08c6('0x26')](handleEntityNotFound(_0x2729f9,null))[_0x08c6('0x26')](saveUpdates(_0x555d6e[_0x08c6('0x4c')],null))[_0x08c6('0x26')](respondWithResult(_0x2729f9,null))[_0x08c6('0x47')](handleError(_0x2729f9,null));};exports[_0x08c6('0x27')]=function(_0x25addc,_0x5c85a7){return db['SalesforceField']['find']({'where':{'id':_0x25addc[_0x08c6('0x4d')]['id']}})[_0x08c6('0x26')](handleEntityNotFound(_0x5c85a7,null))[_0x08c6('0x26')](removeEntity(_0x5c85a7,null))[_0x08c6('0x47')](handleError(_0x5c85a7,null));}; \ No newline at end of file +var _0xc1de=['../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','SalesforceField','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','find','create','body','params','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment'];(function(_0x51d894,_0x5dffe4){var _0x27ac80=function(_0x44de2e){while(--_0x44de2e){_0x51d894['push'](_0x51d894['shift']());}};_0x27ac80(++_0x5dffe4);}(_0xc1de,0x113));var _0xec1d=function(_0x4c7397,_0x3954b4){_0x4c7397=_0x4c7397-0x0;var _0xd0862a=_0xc1de[_0x4c7397];return _0xd0862a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xec1d('0x0'));var rp=require(_0xec1d('0x1'));var moment=require(_0xec1d('0x2'));var BPromise=require(_0xec1d('0x3'));var Mustache=require(_0xec1d('0x4'));var util=require(_0xec1d('0x5'));var path=require(_0xec1d('0x6'));var sox=require(_0xec1d('0x7'));var csv=require(_0xec1d('0x8'));var ejs=require(_0xec1d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec1d('0xa'));var squel=require('squel');var crypto=require(_0xec1d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xec1d('0xc'));var toCsv=require(_0xec1d('0x8'));var querystring=require(_0xec1d('0xd'));var Papa=require(_0xec1d('0xe'));var Redis=require(_0xec1d('0xf'));var authService=require(_0xec1d('0x10'));var qs=require(_0xec1d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec1d('0x12'));var logger=require('../../config/logger')(_0xec1d('0x13'));var utils=require('../../config/utils');var config=require(_0xec1d('0x14'));var licenseUtil=require(_0xec1d('0x15'));var db=require(_0xec1d('0x16'))['db'];function respondWithStatusCode(_0x34febd,_0x5ca1fa){_0x5ca1fa=_0x5ca1fa||0xcc;return function(_0x452400){if(_0x452400){return _0x34febd['sendStatus'](_0x5ca1fa);}return _0x34febd[_0xec1d('0x17')](_0x5ca1fa)[_0xec1d('0x18')]();};}function respondWithResult(_0x3e99ff,_0x2c3d9c){_0x2c3d9c=_0x2c3d9c||0xc8;return function(_0x2e6881){if(_0x2e6881){return _0x3e99ff[_0xec1d('0x17')](_0x2c3d9c)['json'](_0x2e6881);}};}function respondWithFilteredResult(_0x5a20d9,_0x2886bf){return function(_0xc863cb){if(_0xc863cb){var _0x374906=typeof _0x2886bf[_0xec1d('0x19')]===_0xec1d('0x1a')&&typeof _0x2886bf[_0xec1d('0x1b')]===_0xec1d('0x1a');var _0x10e202=_0xc863cb[_0xec1d('0x1c')];var _0x2f8c11=_0x374906?0x0:_0x2886bf[_0xec1d('0x19')];var _0x163747=_0x374906?_0xc863cb[_0xec1d('0x1c')]:_0x2886bf['offset']+_0x2886bf['limit'];var _0x27eeef;if(_0x163747>=_0x10e202){_0x163747=_0x10e202;_0x27eeef=0xc8;}else{_0x27eeef=0xce;}_0x5a20d9['status'](_0x27eeef);return _0x5a20d9[_0xec1d('0x1d')](_0xec1d('0x1e'),_0x2f8c11+'-'+_0x163747+'/'+_0x10e202)[_0xec1d('0x1f')](_0xc863cb);}return null;};}function patchUpdates(_0x36db2b){return function(_0x28e601){try{jsonpatch[_0xec1d('0x20')](_0x28e601,_0x36db2b,!![]);}catch(_0x5793e9){return BPromise['reject'](_0x5793e9);}return _0x28e601[_0xec1d('0x21')]();};}function saveUpdates(_0xbb7fd6,_0xb47a46){return function(_0x148c42){if(_0x148c42){return _0x148c42[_0xec1d('0x22')](_0xbb7fd6)[_0xec1d('0x23')](function(_0x5c073){return _0x5c073;});}return null;};}function removeEntity(_0x2cadae,_0x37f198){return function(_0x4dc184){if(_0x4dc184){return _0x4dc184[_0xec1d('0x24')]()[_0xec1d('0x23')](function(){_0x2cadae['status'](0xcc)[_0xec1d('0x18')]();});}};}function handleEntityNotFound(_0x3fe80d,_0x51839e){return function(_0x357b1d){if(!_0x357b1d){_0x3fe80d['sendStatus'](0x194);}return _0x357b1d;};}function handleError(_0x556080,_0x9d12c6){_0x9d12c6=_0x9d12c6||0x1f4;return function(_0x21457a){logger['error'](_0x21457a[_0xec1d('0x25')]);if(_0x21457a[_0xec1d('0x26')]){delete _0x21457a[_0xec1d('0x26')];}_0x556080[_0xec1d('0x17')](_0x9d12c6)[_0xec1d('0x27')](_0x21457a);};}exports[_0xec1d('0x28')]=function(_0x3de0e4,_0x188a62){var _0x4c8099={},_0x48eeac={},_0x5dfc95={'count':0x0,'rows':[]};var _0xe49b52=_['map'](db[_0xec1d('0x29')][_0xec1d('0x2a')],function(_0x3992f0){return{'name':_0x3992f0[_0xec1d('0x2b')],'type':_0x3992f0['type'][_0xec1d('0x2c')]};});_0x48eeac['model']=_[_0xec1d('0x2d')](_0xe49b52,'name');_0x48eeac[_0xec1d('0x2e')]=_[_0xec1d('0x2f')](_0x3de0e4[_0xec1d('0x2e')]);_0x48eeac[_0xec1d('0x30')]=_[_0xec1d('0x31')](_0x48eeac['model'],_0x48eeac[_0xec1d('0x2e')]);_0x4c8099[_0xec1d('0x32')]=_[_0xec1d('0x31')](_0x48eeac[_0xec1d('0x33')],qs[_0xec1d('0x34')](_0x3de0e4[_0xec1d('0x2e')]['fields']));_0x4c8099['attributes']=_0x4c8099[_0xec1d('0x32')][_0xec1d('0x35')]?_0x4c8099['attributes']:_0x48eeac[_0xec1d('0x33')];if(!_0x3de0e4['query'][_0xec1d('0x36')](_0xec1d('0x37'))){_0x4c8099[_0xec1d('0x1b')]=qs['limit'](_0x3de0e4[_0xec1d('0x2e')]['limit']);_0x4c8099['offset']=qs[_0xec1d('0x19')](_0x3de0e4['query'][_0xec1d('0x19')]);}_0x4c8099[_0xec1d('0x38')]=qs[_0xec1d('0x39')](_0x3de0e4['query'][_0xec1d('0x39')]);_0x4c8099[_0xec1d('0x3a')]=qs[_0xec1d('0x30')](_[_0xec1d('0x3b')](_0x3de0e4[_0xec1d('0x2e')],_0x48eeac[_0xec1d('0x30')]),_0xe49b52);if(_0x3de0e4[_0xec1d('0x2e')][_0xec1d('0x3c')]){_0x4c8099[_0xec1d('0x3a')]=_[_0xec1d('0x3d')](_0x4c8099[_0xec1d('0x3a')],{'$or':_[_0xec1d('0x2d')](_0xe49b52,function(_0xe867d){if(_0xe867d[_0xec1d('0x3e')]!==_0xec1d('0x3f')){var _0x2b09ed={};_0x2b09ed[_0xe867d[_0xec1d('0x26')]]={'$like':'%'+_0x3de0e4[_0xec1d('0x2e')][_0xec1d('0x3c')]+'%'};return _0x2b09ed;}})});}_0x4c8099=_['merge']({},_0x4c8099,_0x3de0e4[_0xec1d('0x40')]);var _0x5a627a={'where':_0x4c8099['where']};return db[_0xec1d('0x29')][_0xec1d('0x1c')](_0x5a627a)['then'](function(_0x48ebe6){_0x5dfc95[_0xec1d('0x1c')]=_0x48ebe6;if(_0x3de0e4[_0xec1d('0x2e')]['includeAll']){_0x4c8099[_0xec1d('0x41')]=[{'all':!![]}];}return db[_0xec1d('0x29')][_0xec1d('0x42')](_0x4c8099);})['then'](function(_0x459917){_0x5dfc95[_0xec1d('0x43')]=_0x459917;return _0x5dfc95;})[_0xec1d('0x23')](respondWithFilteredResult(_0x188a62,_0x4c8099))[_0xec1d('0x44')](handleError(_0x188a62,null));};exports[_0xec1d('0x45')]=function(_0x3edb65,_0x1b26f2){var _0x2f0f2a={'raw':!![],'where':{'id':_0x3edb65['params']['id']}},_0x1e2f8e={};_0x1e2f8e[_0xec1d('0x33')]=_[_0xec1d('0x2f')](db[_0xec1d('0x29')][_0xec1d('0x2a')]);_0x1e2f8e[_0xec1d('0x2e')]=_[_0xec1d('0x2f')](_0x3edb65[_0xec1d('0x2e')]);_0x1e2f8e[_0xec1d('0x30')]=_['intersection'](_0x1e2f8e[_0xec1d('0x33')],_0x1e2f8e[_0xec1d('0x2e')]);_0x2f0f2a[_0xec1d('0x32')]=_[_0xec1d('0x31')](_0x1e2f8e[_0xec1d('0x33')],qs[_0xec1d('0x34')](_0x3edb65[_0xec1d('0x2e')][_0xec1d('0x34')]));_0x2f0f2a['attributes']=_0x2f0f2a['attributes'][_0xec1d('0x35')]?_0x2f0f2a[_0xec1d('0x32')]:_0x1e2f8e[_0xec1d('0x33')];if(_0x3edb65[_0xec1d('0x2e')]['includeAll']){_0x2f0f2a[_0xec1d('0x41')]=[{'all':!![]}];}_0x2f0f2a=_[_0xec1d('0x3d')]({},_0x2f0f2a,_0x3edb65['options']);return db[_0xec1d('0x29')][_0xec1d('0x46')](_0x2f0f2a)[_0xec1d('0x23')](handleEntityNotFound(_0x1b26f2,null))[_0xec1d('0x23')](respondWithResult(_0x1b26f2,null))[_0xec1d('0x44')](handleError(_0x1b26f2,null));};exports[_0xec1d('0x47')]=function(_0x5273d2,_0x4a90fe){return db['SalesforceField'][_0xec1d('0x47')](_0x5273d2[_0xec1d('0x48')],{})[_0xec1d('0x23')](respondWithResult(_0x4a90fe,0xc9))['catch'](handleError(_0x4a90fe,null));};exports[_0xec1d('0x22')]=function(_0x491b75,_0x159bbd){if(_0x491b75['body']['id']){delete _0x491b75['body']['id'];}return db[_0xec1d('0x29')]['find']({'where':{'id':_0x491b75[_0xec1d('0x49')]['id']}})[_0xec1d('0x23')](handleEntityNotFound(_0x159bbd,null))['then'](saveUpdates(_0x491b75['body'],null))['then'](respondWithResult(_0x159bbd,null))['catch'](handleError(_0x159bbd,null));};exports[_0xec1d('0x24')]=function(_0x21a6e4,_0xdb6c0f){return db[_0xec1d('0x29')][_0xec1d('0x46')]({'where':{'id':_0x21a6e4['params']['id']}})[_0xec1d('0x23')](handleEntityNotFound(_0xdb6c0f,null))[_0xec1d('0x23')](removeEntity(_0xdb6c0f,null))[_0xec1d('0x44')](handleError(_0xdb6c0f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 19b985c..74e40d4 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 _0x649a=['exports','define','SalesforceField','int_salesforce_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x4cdbca,_0x3841bd){var _0x8b114f=function(_0x4e84f7){while(--_0x4e84f7){_0x4cdbca['push'](_0x4cdbca['shift']());}};_0x8b114f(++_0x3841bd);}(_0x649a,0x11d));var _0xa649=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x649a[_0x3fb030];return _0xd6899b;};'use strict';var _=require(_0xa649('0x0'));var util=require(_0xa649('0x1'));var logger=require(_0xa649('0x2'))(_0xa649('0x3'));var moment=require(_0xa649('0x4'));var BPromise=require(_0xa649('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa649('0x6'));var config=require(_0xa649('0x7'));var attributes=require(_0xa649('0x8'));module[_0xa649('0x9')]=function(_0x348c3c,_0x4b1d89){return _0x348c3c[_0xa649('0xa')](_0xa649('0xb'),attributes,{'tableName':_0xa649('0xc'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0xa649('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a14=['request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2b57dc,_0x2227b6){var _0x61a5eb=function(_0x492723){while(--_0x492723){_0x2b57dc['push'](_0x2b57dc['shift']());}};_0x61a5eb(++_0x2227b6);}(_0x1a14,0x10a));var _0x41a1=function(_0x418625,_0x5ee384){_0x418625=_0x418625-0x0;var _0x10f3a7=_0x1a14[_0x418625];return _0x10f3a7;};'use strict';var _=require(_0x41a1('0x0'));var util=require(_0x41a1('0x1'));var logger=require(_0x41a1('0x2'))(_0x41a1('0x3'));var moment=require(_0x41a1('0x4'));var BPromise=require(_0x41a1('0x5'));var rp=require(_0x41a1('0x6'));var fs=require('fs');var path=require(_0x41a1('0x7'));var rimraf=require('rimraf');var config=require(_0x41a1('0x8'));var attributes=require(_0x41a1('0x9'));module[_0x41a1('0xa')]=function(_0x1ebf8f,_0xcccb39){return _0x1ebf8f[_0x41a1('0xb')](_0x41a1('0xc'),attributes,{'tableName':_0x41a1('0xd'),'paranoid':![],'indexes':[{'name':_0x41a1('0xe'),'fields':[_0x41a1('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 13ddc90..4995f89 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 _0x8da9=['http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x48b885,_0x123869){var _0x21ffe2=function(_0x276230){while(--_0x276230){_0x48b885['push'](_0x48b885['shift']());}};_0x21ffe2(++_0x123869);}(_0x8da9,0xad));var _0x98da=function(_0x309b9e,_0x3a124d){_0x309b9e=_0x309b9e-0x0;var _0x201ea5=_0x8da9[_0x309b9e];return _0x201ea5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x98da('0x0'));var fs=require('fs');var Redis=require(_0x98da('0x1'));var db=require(_0x98da('0x2'))['db'];var utils=require(_0x98da('0x3'));var logger=require(_0x98da('0x4'))(_0x98da('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x98da('0x6')][_0x98da('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x22d5ee,_0x3b1066,_0x411578){return new BPromise(function(_0x40aa8c,_0xd950d7){return client[_0x98da('0x8')](_0x22d5ee,_0x411578)['then'](function(_0x357696){logger[_0x98da('0x9')](_0x98da('0xa'),_0x3b1066,_0x98da('0xb'));logger[_0x98da('0xc')](_0x98da('0xd'),_0x3b1066,_0x98da('0xb'),JSON[_0x98da('0xe')](_0x357696));if(_0x357696[_0x98da('0xf')]){if(_0x357696[_0x98da('0xf')][_0x98da('0x10')]===0x1f4){logger[_0x98da('0xf')](_0x98da('0xa'),_0x3b1066,_0x357696['error']['message']);return _0xd950d7(_0x357696[_0x98da('0xf')][_0x98da('0x11')]);}logger[_0x98da('0xf')]('SalesforceField,\x20%s,\x20%s',_0x3b1066,_0x357696[_0x98da('0xf')]['message']);return _0x40aa8c(_0x357696[_0x98da('0xf')][_0x98da('0x11')]);}else{logger['info'](_0x98da('0xa'),_0x3b1066,_0x98da('0xb'));_0x40aa8c(_0x357696[_0x98da('0x12')][_0x98da('0x11')]);}})[_0x98da('0x13')](function(_0x280da0){logger[_0x98da('0xf')](_0x98da('0xa'),_0x3b1066,_0x280da0);_0xd950d7(_0x280da0);});});} \ No newline at end of file +var _0xfc73=['debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc73,0xe8));var _0x3fc7=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xfc73[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x3fc7('0x0'));var util=require(_0x3fc7('0x1'));var moment=require(_0x3fc7('0x2'));var BPromise=require(_0x3fc7('0x3'));var rs=require(_0x3fc7('0x4'));var fs=require('fs');var Redis=require(_0x3fc7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fc7('0x6'));var logger=require(_0x3fc7('0x7'))(_0x3fc7('0x8'));var config=require(_0x3fc7('0x9'));var jayson=require(_0x3fc7('0xa'));var client=jayson[_0x3fc7('0xb')][_0x3fc7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b3d9d,_0x1a4cc5,_0x7158bd){return new BPromise(function(_0x41ccbc,_0x4ed433){return client[_0x3fc7('0xd')](_0x2b3d9d,_0x7158bd)[_0x3fc7('0xe')](function(_0x504863){logger[_0x3fc7('0xf')](_0x3fc7('0x10'),_0x1a4cc5,_0x3fc7('0x11'));logger[_0x3fc7('0x12')](_0x3fc7('0x13'),_0x1a4cc5,_0x3fc7('0x11'),JSON[_0x3fc7('0x14')](_0x504863));if(_0x504863['error']){if(_0x504863[_0x3fc7('0x15')][_0x3fc7('0x16')]===0x1f4){logger['error'](_0x3fc7('0x10'),_0x1a4cc5,_0x504863[_0x3fc7('0x15')][_0x3fc7('0x17')]);return _0x4ed433(_0x504863[_0x3fc7('0x15')][_0x3fc7('0x17')]);}logger['error'](_0x3fc7('0x10'),_0x1a4cc5,_0x504863[_0x3fc7('0x15')][_0x3fc7('0x17')]);return _0x41ccbc(_0x504863[_0x3fc7('0x15')]['message']);}else{logger[_0x3fc7('0xf')](_0x3fc7('0x10'),_0x1a4cc5,'request\x20sent');_0x41ccbc(_0x504863[_0x3fc7('0x18')][_0x3fc7('0x17')]);}})['catch'](function(_0x2eba9f){logger[_0x3fc7('0x15')](_0x3fc7('0x10'),_0x1a4cc5,_0x2eba9f);_0x4ed433(_0x2eba9f);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 051b0ae..7271a2c 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 _0x4a5b=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intServicenowAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy'];(function(_0x1ab76f,_0x21ee8a){var _0x9d9e27=function(_0x3fa489){while(--_0x3fa489){_0x1ab76f['push'](_0x1ab76f['shift']());}};_0x9d9e27(++_0x21ee8a);}(_0x4a5b,0xe8));var _0xb4a5=function(_0x2bcba6,_0x4b115e){_0x2bcba6=_0x2bcba6-0x0;var _0x55f655=_0x4a5b[_0x2bcba6];return _0x55f655;};'use strict';var multer=require('multer');var util=require(_0xb4a5('0x0'));var path=require(_0xb4a5('0x1'));var timeout=require(_0xb4a5('0x2'));var express=require(_0xb4a5('0x3'));var router=express['Router']();var fs_extra=require(_0xb4a5('0x4'));var auth=require(_0xb4a5('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb4a5('0x6'));router[_0xb4a5('0x7')]('/',auth[_0xb4a5('0x8')](),controller['index']);router[_0xb4a5('0x7')](_0xb4a5('0x9'),auth['isAuthenticated'](),controller[_0xb4a5('0xa')]);router[_0xb4a5('0x7')](_0xb4a5('0xb'),auth[_0xb4a5('0x8')](),controller['getConfigurations']);router[_0xb4a5('0x7')](_0xb4a5('0xc'),auth['isAuthenticated'](),controller[_0xb4a5('0xd')]);router[_0xb4a5('0xe')]('/',auth[_0xb4a5('0x8')](),controller[_0xb4a5('0xf')]);router[_0xb4a5('0xe')]('/:id/configurations',auth[_0xb4a5('0x8')](),controller[_0xb4a5('0x10')]);router['put'](_0xb4a5('0x9'),auth['isAuthenticated'](),controller[_0xb4a5('0x11')]);router[_0xb4a5('0x12')](_0xb4a5('0x9'),auth[_0xb4a5('0x8')](),controller[_0xb4a5('0x13')]);module[_0xb4a5('0x14')]=router; \ No newline at end of file +var _0x7d89=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','index','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','delete','destroy','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d89,0x158));var _0x97d8=function(_0x15f706,_0x13a547){_0x15f706=_0x15f706-0x0;var _0x52dcfd=_0x7d89[_0x15f706];return _0x52dcfd;};'use strict';var multer=require(_0x97d8('0x0'));var util=require(_0x97d8('0x1'));var path=require(_0x97d8('0x2'));var timeout=require(_0x97d8('0x3'));var express=require(_0x97d8('0x4'));var router=express[_0x97d8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x97d8('0x6'));var interaction=require(_0x97d8('0x7'));var config=require('../../config/environment');var controller=require(_0x97d8('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x97d8('0x9')]);router[_0x97d8('0xa')](_0x97d8('0xb'),auth[_0x97d8('0xc')](),controller[_0x97d8('0xd')]);router['get']('/:id/configurations',auth[_0x97d8('0xc')](),controller[_0x97d8('0xe')]);router[_0x97d8('0xa')](_0x97d8('0xf'),auth[_0x97d8('0xc')](),controller[_0x97d8('0x10')]);router[_0x97d8('0x11')]('/',auth[_0x97d8('0xc')](),controller[_0x97d8('0x12')]);router[_0x97d8('0x11')](_0x97d8('0x13'),auth[_0x97d8('0xc')](),controller[_0x97d8('0x14')]);router['put'](_0x97d8('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x97d8('0x15')](_0x97d8('0xb'),auth['isAuthenticated'](),controller[_0x97d8('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index aeff182..42dab3b 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 _0x7611=['remoteUri','sequelize','exports','STRING'];(function(_0x536d37,_0x4752f1){var _0x3c1e80=function(_0x441c48){while(--_0x441c48){_0x536d37['push'](_0x536d37['shift']());}};_0x3c1e80(++_0x4752f1);}(_0x7611,0x8d));var _0x1761=function(_0x3b198c,_0x5140c7){_0x3b198c=_0x3b198c-0x0;var _0x589e65=_0x7611[_0x3b198c];return _0x589e65;};'use strict';var Sequelize=require(_0x1761('0x0'));module[_0x1761('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1761('0x2')]},'username':{'type':Sequelize[_0x1761('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1761('0x2')]},'remoteUri':{'type':Sequelize[_0x1761('0x2')],'unique':_0x1761('0x3')},'serverUrl':{'type':Sequelize[_0x1761('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5469=['STRING','username','sequelize','exports'];(function(_0xdfe737,_0x15872b){var _0x5962da=function(_0x482813){while(--_0x482813){_0xdfe737['push'](_0xdfe737['shift']());}};_0x5962da(++_0x15872b);}(_0x5469,0x12e));var _0x9546=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x5469[_0x158f01];return _0x5ef74e;};'use strict';var Sequelize=require(_0x9546('0x0'));module[_0x9546('0x1')]={'name':{'type':Sequelize[_0x9546('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9546('0x2')],'unique':_0x9546('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9546('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x9546('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 989330d..585946f 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 _0xf52d=['keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','ServicenowConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','severity','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_domain','closed_at','cmdb_ci','delivery_plan','active','business_service','rfc','time_worked','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','company','reassignment_count','assigned_to','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','username','password','email','remoteUri','serverUrl','substring','format','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','statusCode','test','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','false','value','push','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','model'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf52d,0x83));var _0xdf52=function(_0x55daf1,_0x569895){_0x55daf1=_0x55daf1-0x0;var _0x599c8d=_0xf52d[_0x55daf1];return _0x599c8d;};'use strict';var emlformat=require(_0xdf52('0x0'));var rimraf=require(_0xdf52('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf52('0x2'));var rp=require(_0xdf52('0x3'));var moment=require(_0xdf52('0x4'));var BPromise=require(_0xdf52('0x5'));var Mustache=require('mustache');var util=require(_0xdf52('0x6'));var path=require(_0xdf52('0x7'));var sox=require(_0xdf52('0x8'));var csv=require(_0xdf52('0x9'));var ejs=require(_0xdf52('0xa'));var fs=require('fs');var fs_extra=require(_0xdf52('0xb'));var _=require(_0xdf52('0xc'));var squel=require(_0xdf52('0xd'));var crypto=require(_0xdf52('0xe'));var jsforce=require(_0xdf52('0xf'));var deskjs=require(_0xdf52('0x10'));var toCsv=require(_0xdf52('0x9'));var querystring=require(_0xdf52('0x11'));var Papa=require('papaparse');var Redis=require(_0xdf52('0x12'));var authService=require(_0xdf52('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdf52('0x14'));var hardwareService=require(_0xdf52('0x15'));var logger=require(_0xdf52('0x16'))(_0xdf52('0x17'));var utils=require(_0xdf52('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xdf52('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x302a8c,_0x505cc8){_0x505cc8=_0x505cc8||0xcc;return function(_0x55f5a0){if(_0x55f5a0){return _0x302a8c[_0xdf52('0x1a')](_0x505cc8);}return _0x302a8c[_0xdf52('0x1b')](_0x505cc8)[_0xdf52('0x1c')]();};}function respondWithResult(_0x575051,_0x40b21b){_0x40b21b=_0x40b21b||0xc8;return function(_0x1f6691){if(_0x1f6691){return _0x575051[_0xdf52('0x1b')](_0x40b21b)[_0xdf52('0x1d')](_0x1f6691);}};}function respondWithFilteredResult(_0x4da67f,_0x8020a3){return function(_0x418199){if(_0x418199){var _0x8ad85d=typeof _0x8020a3['offset']===_0xdf52('0x1e')&&typeof _0x8020a3[_0xdf52('0x1f')]===_0xdf52('0x1e');var _0x15efe4=_0x418199['count'];var _0xfbba2a=_0x8ad85d?0x0:_0x8020a3[_0xdf52('0x20')];var _0x3bd0bf=_0x8ad85d?_0x418199[_0xdf52('0x21')]:_0x8020a3['offset']+_0x8020a3[_0xdf52('0x1f')];var _0x5cf288;if(_0x3bd0bf>=_0x15efe4){_0x3bd0bf=_0x15efe4;_0x5cf288=0xc8;}else{_0x5cf288=0xce;}_0x4da67f[_0xdf52('0x1b')](_0x5cf288);return _0x4da67f['set'](_0xdf52('0x22'),_0xfbba2a+'-'+_0x3bd0bf+'/'+_0x15efe4)[_0xdf52('0x1d')](_0x418199);}return null;};}function patchUpdates(_0x4c6704){return function(_0x4a9861){try{jsonpatch['apply'](_0x4a9861,_0x4c6704,!![]);}catch(_0xa06b33){return BPromise[_0xdf52('0x23')](_0xa06b33);}return _0x4a9861[_0xdf52('0x24')]();};}function saveUpdates(_0x7b2d38,_0x538001){return function(_0xb31ac3){if(_0xb31ac3){return _0xb31ac3[_0xdf52('0x25')](_0x7b2d38)[_0xdf52('0x26')](function(_0x213601){return _0x213601;});}return null;};}function removeEntity(_0x56d4db,_0x37d2e3){return function(_0x39dcd3){if(_0x39dcd3){return _0x39dcd3[_0xdf52('0x27')]()['then'](function(){_0x56d4db[_0xdf52('0x1b')](0xcc)[_0xdf52('0x1c')]();});}};}function handleEntityNotFound(_0x56c930,_0x4ca1f7){return function(_0x453304){if(!_0x453304){_0x56c930[_0xdf52('0x1a')](0x194);}return _0x453304;};}function handleError(_0x500c8e,_0x18654c){_0x18654c=_0x18654c||0x1f4;return function(_0x360267){logger[_0xdf52('0x28')](_0x360267[_0xdf52('0x29')]);if(_0x360267[_0xdf52('0x2a')]){delete _0x360267[_0xdf52('0x2a')];}_0x500c8e[_0xdf52('0x1b')](_0x18654c)[_0xdf52('0x2b')](_0x360267);};}exports[_0xdf52('0x2c')]=function(_0x1f97e6,_0x3d9da3){var _0x4ff95a={},_0xf7776c={},_0x576df4={'count':0x0,'rows':[]};var _0x150d1b=_[_0xdf52('0x2d')](db[_0xdf52('0x2e')][_0xdf52('0x2f')],function(_0x1d50ef){return{'name':_0x1d50ef[_0xdf52('0x30')],'type':_0x1d50ef[_0xdf52('0x31')]['key']};});_0xf7776c[_0xdf52('0x32')]=_['map'](_0x150d1b,_0xdf52('0x2a'));_0xf7776c['query']=_[_0xdf52('0x33')](_0x1f97e6[_0xdf52('0x34')]);_0xf7776c[_0xdf52('0x35')]=_[_0xdf52('0x36')](_0xf7776c[_0xdf52('0x32')],_0xf7776c['query']);_0x4ff95a['attributes']=_['intersection'](_0xf7776c[_0xdf52('0x32')],qs[_0xdf52('0x37')](_0x1f97e6[_0xdf52('0x34')][_0xdf52('0x37')]));_0x4ff95a[_0xdf52('0x38')]=_0x4ff95a[_0xdf52('0x38')][_0xdf52('0x39')]?_0x4ff95a[_0xdf52('0x38')]:_0xf7776c[_0xdf52('0x32')];if(!_0x1f97e6[_0xdf52('0x34')][_0xdf52('0x3a')](_0xdf52('0x3b'))){_0x4ff95a[_0xdf52('0x1f')]=qs[_0xdf52('0x1f')](_0x1f97e6[_0xdf52('0x34')][_0xdf52('0x1f')]);_0x4ff95a[_0xdf52('0x20')]=qs['offset'](_0x1f97e6[_0xdf52('0x34')][_0xdf52('0x20')]);}_0x4ff95a[_0xdf52('0x3c')]=qs[_0xdf52('0x3d')](_0x1f97e6[_0xdf52('0x34')][_0xdf52('0x3d')]);_0x4ff95a[_0xdf52('0x3e')]=qs['filters'](_['pick'](_0x1f97e6['query'],_0xf7776c['filters']),_0x150d1b);if(_0x1f97e6[_0xdf52('0x34')][_0xdf52('0x3f')]){_0x4ff95a['where']=_[_0xdf52('0x40')](_0x4ff95a[_0xdf52('0x3e')],{'$or':_[_0xdf52('0x2d')](_0x150d1b,function(_0x5f4de6){if(_0x5f4de6[_0xdf52('0x31')]!=='VIRTUAL'){var _0x48351f={};_0x48351f[_0x5f4de6['name']]={'$like':'%'+_0x1f97e6[_0xdf52('0x34')][_0xdf52('0x3f')]+'%'};return _0x48351f;}})});}_0x4ff95a=_[_0xdf52('0x40')]({},_0x4ff95a,_0x1f97e6[_0xdf52('0x41')]);var _0x5c8849={'where':_0x4ff95a[_0xdf52('0x3e')]};return db[_0xdf52('0x2e')]['count'](_0x5c8849)[_0xdf52('0x26')](function(_0x5a7634){_0x576df4[_0xdf52('0x21')]=_0x5a7634;if(_0x1f97e6[_0xdf52('0x34')][_0xdf52('0x42')]){_0x4ff95a[_0xdf52('0x43')]=[{'all':!![]}];}return db[_0xdf52('0x2e')][_0xdf52('0x44')](_0x4ff95a);})[_0xdf52('0x26')](function(_0x28f7e9){_0x576df4[_0xdf52('0x45')]=_0x28f7e9;return _0x576df4;})[_0xdf52('0x26')](respondWithFilteredResult(_0x3d9da3,_0x4ff95a))[_0xdf52('0x46')](handleError(_0x3d9da3,null));};exports[_0xdf52('0x47')]=function(_0x373aa6,_0x4a7822){var _0x2ae76f={'raw':![],'where':{'id':_0x373aa6[_0xdf52('0x48')]['id']}},_0x4dd9b6={};_0x4dd9b6[_0xdf52('0x32')]=_[_0xdf52('0x33')](db['ServicenowAccount'][_0xdf52('0x2f')]);_0x4dd9b6[_0xdf52('0x34')]=_[_0xdf52('0x33')](_0x373aa6['query']);_0x4dd9b6['filters']=_[_0xdf52('0x36')](_0x4dd9b6['model'],_0x4dd9b6[_0xdf52('0x34')]);_0x2ae76f[_0xdf52('0x38')]=_[_0xdf52('0x36')](_0x4dd9b6['model'],qs['fields'](_0x373aa6['query'][_0xdf52('0x37')]));_0x2ae76f['attributes']=_0x2ae76f[_0xdf52('0x38')]['length']?_0x2ae76f[_0xdf52('0x38')]:_0x4dd9b6[_0xdf52('0x32')];if(_0x373aa6[_0xdf52('0x34')][_0xdf52('0x42')]){_0x2ae76f['include']=[{'all':!![]}];}_0x2ae76f=_[_0xdf52('0x40')]({},_0x2ae76f,_0x373aa6[_0xdf52('0x41')]);return db['ServicenowAccount']['find'](_0x2ae76f)[_0xdf52('0x26')](handleEntityNotFound(_0x4a7822,null))[_0xdf52('0x26')](respondWithResult(_0x4a7822,null))['catch'](handleError(_0x4a7822,null));};exports[_0xdf52('0x49')]=function(_0x18e670,_0xe98623){return db[_0xdf52('0x2e')][_0xdf52('0x49')](_0x18e670[_0xdf52('0x4a')],{})[_0xdf52('0x26')](respondWithResult(_0xe98623,0xc9))[_0xdf52('0x46')](handleError(_0xe98623,null));};exports[_0xdf52('0x25')]=function(_0x56afc3,_0x488753){if(_0x56afc3[_0xdf52('0x4a')]['id']){delete _0x56afc3[_0xdf52('0x4a')]['id'];}return db[_0xdf52('0x2e')][_0xdf52('0x4b')]({'where':{'id':_0x56afc3[_0xdf52('0x48')]['id']}})[_0xdf52('0x26')](handleEntityNotFound(_0x488753,null))[_0xdf52('0x26')](saveUpdates(_0x56afc3[_0xdf52('0x4a')],null))[_0xdf52('0x26')](respondWithResult(_0x488753,null))[_0xdf52('0x46')](handleError(_0x488753,null));};exports[_0xdf52('0x27')]=function(_0x4efe1f,_0x21f981){return db[_0xdf52('0x2e')][_0xdf52('0x4b')]({'where':{'id':_0x4efe1f[_0xdf52('0x48')]['id']}})[_0xdf52('0x26')](handleEntityNotFound(_0x21f981,null))[_0xdf52('0x26')](removeEntity(_0x21f981,null))[_0xdf52('0x46')](handleError(_0x21f981,null));};exports[_0xdf52('0x4c')]=function(_0x872f22,_0x478adc,_0x2fe1d9){var _0x1fcf29={};var _0x2e1e67={};var _0x4fa10e;var _0x1cac79;return db[_0xdf52('0x2e')]['findOne']({'where':{'id':_0x872f22[_0xdf52('0x48')]['id']}})[_0xdf52('0x26')](handleEntityNotFound(_0x478adc,null))[_0xdf52('0x26')](function(_0x3c7c57){if(_0x3c7c57){_0x4fa10e=_0x3c7c57;_0x2e1e67['model']=_[_0xdf52('0x33')](db[_0xdf52('0x4d')][_0xdf52('0x2f')]);_0x2e1e67[_0xdf52('0x34')]=_['keys'](_0x872f22[_0xdf52('0x34')]);_0x2e1e67[_0xdf52('0x35')]=_[_0xdf52('0x36')](_0x2e1e67[_0xdf52('0x32')],_0x2e1e67[_0xdf52('0x34')]);_0x1fcf29['attributes']=_[_0xdf52('0x36')](_0x2e1e67['model'],qs[_0xdf52('0x37')](_0x872f22[_0xdf52('0x34')][_0xdf52('0x37')]));_0x1fcf29[_0xdf52('0x38')]=_0x1fcf29[_0xdf52('0x38')][_0xdf52('0x39')]?_0x1fcf29['attributes']:_0x2e1e67['model'];_0x1fcf29[_0xdf52('0x3c')]=qs[_0xdf52('0x3d')](_0x872f22['query'][_0xdf52('0x3d')]);_0x1fcf29[_0xdf52('0x3e')]=qs[_0xdf52('0x35')](_[_0xdf52('0x4e')](_0x872f22['query'],_0x2e1e67[_0xdf52('0x35')]));if(_0x872f22[_0xdf52('0x34')][_0xdf52('0x3f')]){_0x1fcf29[_0xdf52('0x3e')]=_[_0xdf52('0x40')](_0x1fcf29[_0xdf52('0x3e')],{'$or':_[_0xdf52('0x2d')](_0x1fcf29[_0xdf52('0x38')],function(_0x1ae268){var _0x4854c8={};_0x4854c8[_0x1ae268]={'$like':'%'+_0x872f22[_0xdf52('0x34')][_0xdf52('0x3f')]+'%'};return _0x4854c8;})});}_0x1fcf29=_[_0xdf52('0x40')]({},_0x1fcf29,_0x872f22['options']);return _0x4fa10e[_0xdf52('0x4c')](_0x1fcf29);}})['then'](function(_0x697b16){if(_0x697b16){_0x1cac79=_0x697b16[_0xdf52('0x39')];if(!_0x872f22['query']['hasOwnProperty']('nolimit')){_0x1fcf29[_0xdf52('0x1f')]=qs['limit'](_0x872f22['query']['limit']);_0x1fcf29[_0xdf52('0x20')]=qs[_0xdf52('0x20')](_0x872f22[_0xdf52('0x34')][_0xdf52('0x20')]);}return _0x4fa10e[_0xdf52('0x4c')](_0x1fcf29);}})[_0xdf52('0x26')](function(_0x4157a1){if(_0x4157a1){return _0x4157a1?{'count':_0x1cac79,'rows':_0x4157a1}:null;}})['then'](respondWithResult(_0x478adc,null))[_0xdf52('0x46')](handleError(_0x478adc,null));};exports[_0xdf52('0x4f')]=function(_0x4767ec,_0x4deff4,_0x3041e5){if(_0x4767ec['body']['id']){delete _0x4767ec['body']['id'];}return db[_0xdf52('0x2e')]['findOne']({'where':{'id':_0x4767ec[_0xdf52('0x48')]['id']}})[_0xdf52('0x26')](handleEntityNotFound(_0x4deff4,null))[_0xdf52('0x26')](function(_0x57eb95){if(_0x57eb95){_0x4767ec[_0xdf52('0x4a')][_0xdf52('0x50')]=_0x57eb95['id'];_0x4767ec[_0xdf52('0x4a')][_0xdf52('0x51')]=integrations[_0xdf52('0x52')](_0x4767ec[_0xdf52('0x4a')][_0xdf52('0x53')],_0x4767ec[_0xdf52('0x4a')][_0xdf52('0x31')]);_0x4767ec[_0xdf52('0x4a')][_0xdf52('0x54')]=integrations[_0xdf52('0x55')](_0x4767ec[_0xdf52('0x4a')][_0xdf52('0x53')],_0x4767ec[_0xdf52('0x4a')]['type']);return db[_0xdf52('0x4d')][_0xdf52('0x49')](_0x4767ec['body'],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0xdf52('0x56')],'as':_0xdf52('0x54')}]});}return null;})[_0xdf52('0x26')](respondWithResult(_0x4deff4,null))['catch'](handleError(_0x4deff4,null));};exports[_0xdf52('0x57')]=function(_0x269ffe,_0x167835,_0x17c4aa){var _0x37e998=[_0xdf52('0x58'),_0xdf52('0x59'),_0xdf52('0x5a'),_0xdf52('0x5b'),_0xdf52('0x5c'),'notify','incident_state',_0xdf52('0x5d'),_0xdf52('0x5e')];var _0x237168=[_0xdf52('0x5f'),_0xdf52('0x58'),'caused_by',_0xdf52('0x60'),_0xdf52('0x61'),_0xdf52('0x62'),_0xdf52('0x63'),_0xdf52('0x59'),_0xdf52('0x64'),_0xdf52('0x65'),_0xdf52('0x66'),'sys_updated_by',_0xdf52('0x67'),_0xdf52('0x68'),'sys_created_on',_0xdf52('0x69'),'state','sys_created_by','knowledge',_0xdf52('0x3c'),'calendar_stc',_0xdf52('0x6a'),_0xdf52('0x6b'),_0xdf52('0x6c'),'impact',_0xdf52('0x6d'),'work_notes_list',_0xdf52('0x6e'),'priority','sys_domain_path',_0xdf52('0x6f'),_0xdf52('0x70'),'expected_start','opened_at','business_duration',_0xdf52('0x71'),_0xdf52('0x72'),_0xdf52('0x73'),_0xdf52('0x74'),_0xdf52('0x75'),_0xdf52('0x76'),_0xdf52('0x5b'),'work_notes',_0xdf52('0x77'),'close_code',_0xdf52('0x78'),_0xdf52('0x79'),'work_start',_0xdf52('0x7a'),_0xdf52('0x7b'),_0xdf52('0x7c'),_0xdf52('0x7d'),_0xdf52('0x7e'),'notify',_0xdf52('0x7f'),_0xdf52('0x80'),_0xdf52('0x81'),_0xdf52('0x82'),_0xdf52('0x83'),_0xdf52('0x84'),_0xdf52('0x85'),_0xdf52('0x86'),_0xdf52('0x87'),'urgency','problem_id',_0xdf52('0x88'),_0xdf52('0x89'),'activity_due',_0xdf52('0x8a'),_0xdf52('0x5d'),_0xdf52('0x8b'),'sla_due',_0xdf52('0x8c'),_0xdf52('0x8d'),_0xdf52('0x8e'),_0xdf52('0x8f'),_0xdf52('0x90'),_0xdf52('0x91'),_0xdf52('0x92'),_0xdf52('0x93'),'correlation_id',_0xdf52('0x94'),_0xdf52('0x5e')];var _0x11769f='';var _0x523db8='';var _0x15ba0f=[];var _0x42feb0='';var _0xaa7edb='';var _0x1e3fe8=[];var _0xded0ab='';var _0x19f13c='';var _0x3fa423={};var _0x587179='';return db[_0xdf52('0x2e')]['findOne']({'where':{'id':_0x269ffe[_0xdf52('0x48')]['id']},'attributes':['id',_0xdf52('0x95'),_0xdf52('0x96'),_0xdf52('0x97'),_0xdf52('0x98'),_0xdf52('0x99')]})[_0xdf52('0x26')](handleEntityNotFound(_0x167835,null))[_0xdf52('0x26')](function(_0x48a1de){if(_0x48a1de){_0x587179=_0x48a1de[_0xdf52('0x98')];var _0x39d63a=_0x587179['slice'](-0x1);if(_0x39d63a==='/'){_0x587179=_0x587179[_0xdf52('0x9a')](0x0,_0x587179['lastIndexOf'](_0x39d63a));}_0x19f13c=util[_0xdf52('0x9b')]('%s/api/now/doc/table/schema/',_0x587179);_0xded0ab=util[_0xdf52('0x9b')]('%s/api/now/table/',_0x587179);_0x3fa423={'user':_0x48a1de[_0xdf52('0x95')],'pass':_0x48a1de[_0xdf52('0x96')]};var _0x1a157f={'method':_0xdf52('0x9c'),'uri':_0x19f13c+_0xdf52('0x9d'),'auth':_0x3fa423,'json':!![]};return rp(_0x1a157f);}})[_0xdf52('0x26')](function(_0x42f67a){if(_0x42f67a[_0xdf52('0x9e')][_0xdf52('0x39')]>0x0){_0x11769f=_0x42f67a['result'];}console[_0xdf52('0x9f')](_0xdf52('0xa0'),_0x11769f);_0x1e3fe8=[];_0x523db8=Object[_0xdf52('0xa1')]([],_0x11769f);_[_0xdf52('0xa2')](_0x523db8,function(_0x30ebbf){return!_0x37e998[_0xdf52('0xa3')](_0x30ebbf[_0xdf52('0x2a')]);});_0x523db8[_0xdf52('0xa4')](function(_0x1b116f){var _0x26c02e=createFieldObject(_0xded0ab,_0x3fa423,_0x1b116f[_0xdf52('0xa5')],_0x1b116f[_0xdf52('0x2a')],_0x1b116f[_0xdf52('0xa6')],![]);_0x1e3fe8['push'](_0x26c02e);});return Promise[_0xdf52('0xa7')](_0x1e3fe8);})['then'](function(_0x2b4f57){_0x15ba0f=_0x2b4f57;_0x42feb0=Object['assign']([],_0x11769f);console[_0xdf52('0x9f')](_0xdf52('0xa8'),_0x11769f);_[_0xdf52('0xa2')](_0x42feb0,function(_0x11bb05){return _0x237168[_0xdf52('0xa3')](_0x11bb05[_0xdf52('0x2a')]);});console[_0xdf52('0x9f')](_0xdf52('0xa9'),_0x42feb0);_0x1e3fe8=[];_0x42feb0['forEach'](function(_0x409371){var _0x1fd7c9=createFieldObject(_0xded0ab,_0x3fa423,_0x409371[_0xdf52('0xa5')],_0x409371['name'],_0x409371[_0xdf52('0xa6')],!![]);_0x1e3fe8['push'](_0x1fd7c9);});return Promise[_0xdf52('0xa7')](_0x1e3fe8);})[_0xdf52('0x26')](function(_0x39e84d){_0xaa7edb=_0x39e84d;var _0x5b515c=_0x15ba0f[_0xdf52('0xaa')](_0xaa7edb);return{'count':_0x5b515c['length'],'rows':_0x5b515c};})['then'](respondWithResult(_0x167835,null))[_0xdf52('0x46')](function(_0x13ff40){console['log']('ServiceNow\x20error:\x20'+_0x13ff40);var _0x89a991=_0x269ffe[_0xdf52('0x34')]['test']?0x1f4:_0x13ff40[_0xdf52('0xab')]||0x1f4;logger['error'](_0x13ff40['stack']);delete _0x13ff40[_0xdf52('0x2a')];if(_0x89a991===0x191){_0x89a991=0x190;}_0x167835[_0xdf52('0x1b')](_0x89a991)[_0xdf52('0x2b')](_0x269ffe[_0xdf52('0x34')][_0xdf52('0xac')]?{'message':_0xdf52('0xad'),'statusCode':_0x13ff40[_0xdf52('0xab')]}:_0x13ff40);});};function createFieldObject(_0xe9307a,_0x12b86e,_0x69c96c,_0xd262b4,_0x5289e0,_0x5859de){return new Promise(function(_0x3faef8,_0x470c6f){var _0x2014d0={'id':_0xd262b4,'name':_0x5289e0,'custom':_0x5859de};if(_0x69c96c===_0xdf52('0xae')){_0x2014d0['options']=[{'name':_0xdf52('0xaf'),'value':_0xdf52('0xb0')},{'name':_0xdf52('0xb1'),'value':'false'}];_0x3faef8(_0x2014d0);}else{var _0x3e5f37={'method':_0xdf52('0x9c'),'uri':_0xe9307a+_0xdf52('0xb2')+_0xd262b4,'auth':_0x12b86e,'json':!![]};return rp(_0x3e5f37)[_0xdf52('0x26')](function(_0x3a896b){var _0x2786e6=[];if(_0x3a896b[_0xdf52('0x9e')]['length']>0x0){_0x3a896b[_0xdf52('0x9e')][_0xdf52('0xa4')](function(_0x4c208c){if(_0x4c208c['inactive']===_0xdf52('0xb3')){var _0x26cf8f={'name':_0x4c208c['label'],'value':_0x4c208c[_0xdf52('0xb4')]};_0x2786e6[_0xdf52('0xb5')](_0x26cf8f);}});}_0x2014d0[_0xdf52('0x41')]=_0x2786e6;if(_0x2014d0[_0xdf52('0x41')][_0xdf52('0x39')]>0x0){_0x3faef8(_0x2014d0);}else{if(_0x5859de==![]){_0x3faef8();}else{_0x3faef8(_0x2014d0);}}});}});} \ No newline at end of file +var _0x23a7=['upon_approval','correlation_id','username','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','forEach','label','push','all','log','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','ServiceNow\x20error:\x20','test','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','rows','catch','show','params','includeAll','include','options','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','channel','Descriptions','ServicenowConfiguration','ServicenowField','getFields','hold_reason','knowledge','subcategory','notify','incident_state','severity','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','active','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','reopened_time','resolved_at','caller_id','work_notes','close_code','correlation_display','work_start','assignment_group','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','company','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation'];(function(_0xb3933d,_0x4fc8be){var _0x278b7d=function(_0x1fd617){while(--_0x1fd617){_0xb3933d['push'](_0xb3933d['shift']());}};_0x278b7d(++_0x4fc8be);}(_0x23a7,0xdb));var _0x723a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x23a7[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x723a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x723a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x723a('0x2'));var moment=require(_0x723a('0x3'));var BPromise=require(_0x723a('0x4'));var Mustache=require(_0x723a('0x5'));var util=require(_0x723a('0x6'));var path=require(_0x723a('0x7'));var sox=require(_0x723a('0x8'));var csv=require(_0x723a('0x9'));var ejs=require(_0x723a('0xa'));var fs=require('fs');var fs_extra=require(_0x723a('0xb'));var _=require(_0x723a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x723a('0xd'));var deskjs=require(_0x723a('0xe'));var toCsv=require(_0x723a('0x9'));var querystring=require('querystring');var Papa=require(_0x723a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x723a('0x10'));var as=require(_0x723a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x723a('0x12'))('api');var utils=require(_0x723a('0x13'));var config=require(_0x723a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x723a('0x15'))['db'];var integrations=require(_0x723a('0x16'));function respondWithStatusCode(_0x2975b8,_0x4fbd25){_0x4fbd25=_0x4fbd25||0xcc;return function(_0x37f47b){if(_0x37f47b){return _0x2975b8[_0x723a('0x17')](_0x4fbd25);}return _0x2975b8[_0x723a('0x18')](_0x4fbd25)[_0x723a('0x19')]();};}function respondWithResult(_0x532929,_0x3ac0ba){_0x3ac0ba=_0x3ac0ba||0xc8;return function(_0x40e364){if(_0x40e364){return _0x532929['status'](_0x3ac0ba)[_0x723a('0x1a')](_0x40e364);}};}function respondWithFilteredResult(_0x34bc7f,_0x2c676a){return function(_0xf936f7){if(_0xf936f7){var _0x1ef1ff=typeof _0x2c676a[_0x723a('0x1b')]===_0x723a('0x1c')&&typeof _0x2c676a[_0x723a('0x1d')]===_0x723a('0x1c');var _0x409703=_0xf936f7['count'];var _0x2b0e2a=_0x1ef1ff?0x0:_0x2c676a[_0x723a('0x1b')];var _0x4d9d43=_0x1ef1ff?_0xf936f7[_0x723a('0x1e')]:_0x2c676a[_0x723a('0x1b')]+_0x2c676a['limit'];var _0x4cd215;if(_0x4d9d43>=_0x409703){_0x4d9d43=_0x409703;_0x4cd215=0xc8;}else{_0x4cd215=0xce;}_0x34bc7f['status'](_0x4cd215);return _0x34bc7f[_0x723a('0x1f')](_0x723a('0x20'),_0x2b0e2a+'-'+_0x4d9d43+'/'+_0x409703)[_0x723a('0x1a')](_0xf936f7);}return null;};}function patchUpdates(_0xf8b747){return function(_0x3a7c24){try{jsonpatch['apply'](_0x3a7c24,_0xf8b747,!![]);}catch(_0x47dbcf){return BPromise[_0x723a('0x21')](_0x47dbcf);}return _0x3a7c24[_0x723a('0x22')]();};}function saveUpdates(_0xee0112,_0x11d504){return function(_0x4c75af){if(_0x4c75af){return _0x4c75af[_0x723a('0x23')](_0xee0112)[_0x723a('0x24')](function(_0x3da3b0){return _0x3da3b0;});}return null;};}function removeEntity(_0x271032,_0x3a11dc){return function(_0x3f04f0){if(_0x3f04f0){return _0x3f04f0[_0x723a('0x25')]()[_0x723a('0x24')](function(){_0x271032[_0x723a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb5a422,_0x382bb1){return function(_0x37b15c){if(!_0x37b15c){_0xb5a422[_0x723a('0x17')](0x194);}return _0x37b15c;};}function handleError(_0x49234f,_0x29243c){_0x29243c=_0x29243c||0x1f4;return function(_0x41be00){logger[_0x723a('0x26')](_0x41be00[_0x723a('0x27')]);if(_0x41be00['name']){delete _0x41be00[_0x723a('0x28')];}_0x49234f['status'](_0x29243c)[_0x723a('0x29')](_0x41be00);};}exports[_0x723a('0x2a')]=function(_0x43c05c,_0x233012){var _0xfb02e4={},_0x372164={},_0x317dce={'count':0x0,'rows':[]};var _0x54a149=_['map'](db[_0x723a('0x2b')][_0x723a('0x2c')],function(_0x35a8be){return{'name':_0x35a8be[_0x723a('0x2d')],'type':_0x35a8be[_0x723a('0x2e')]['key']};});_0x372164[_0x723a('0x2f')]=_[_0x723a('0x30')](_0x54a149,'name');_0x372164[_0x723a('0x31')]=_[_0x723a('0x32')](_0x43c05c['query']);_0x372164[_0x723a('0x33')]=_[_0x723a('0x34')](_0x372164['model'],_0x372164['query']);_0xfb02e4[_0x723a('0x35')]=_[_0x723a('0x34')](_0x372164[_0x723a('0x2f')],qs[_0x723a('0x36')](_0x43c05c[_0x723a('0x31')][_0x723a('0x36')]));_0xfb02e4[_0x723a('0x35')]=_0xfb02e4['attributes'][_0x723a('0x37')]?_0xfb02e4['attributes']:_0x372164[_0x723a('0x2f')];if(!_0x43c05c['query'][_0x723a('0x38')](_0x723a('0x39'))){_0xfb02e4[_0x723a('0x1d')]=qs['limit'](_0x43c05c[_0x723a('0x31')][_0x723a('0x1d')]);_0xfb02e4['offset']=qs['offset'](_0x43c05c[_0x723a('0x31')][_0x723a('0x1b')]);}_0xfb02e4[_0x723a('0x3a')]=qs[_0x723a('0x3b')](_0x43c05c[_0x723a('0x31')][_0x723a('0x3b')]);_0xfb02e4[_0x723a('0x3c')]=qs[_0x723a('0x33')](_[_0x723a('0x3d')](_0x43c05c[_0x723a('0x31')],_0x372164[_0x723a('0x33')]),_0x54a149);if(_0x43c05c[_0x723a('0x31')]['filter']){_0xfb02e4[_0x723a('0x3c')]=_[_0x723a('0x3e')](_0xfb02e4[_0x723a('0x3c')],{'$or':_[_0x723a('0x30')](_0x54a149,function(_0x379c06){if(_0x379c06[_0x723a('0x2e')]!==_0x723a('0x3f')){var _0x3b6484={};_0x3b6484[_0x379c06[_0x723a('0x28')]]={'$like':'%'+_0x43c05c['query'][_0x723a('0x40')]+'%'};return _0x3b6484;}})});}_0xfb02e4=_[_0x723a('0x3e')]({},_0xfb02e4,_0x43c05c['options']);var _0x1b071b={'where':_0xfb02e4[_0x723a('0x3c')]};return db[_0x723a('0x2b')][_0x723a('0x1e')](_0x1b071b)[_0x723a('0x24')](function(_0x5e9c0a){_0x317dce[_0x723a('0x1e')]=_0x5e9c0a;if(_0x43c05c[_0x723a('0x31')]['includeAll']){_0xfb02e4['include']=[{'all':!![]}];}return db[_0x723a('0x2b')]['findAll'](_0xfb02e4);})[_0x723a('0x24')](function(_0x57eb44){_0x317dce[_0x723a('0x41')]=_0x57eb44;return _0x317dce;})[_0x723a('0x24')](respondWithFilteredResult(_0x233012,_0xfb02e4))[_0x723a('0x42')](handleError(_0x233012,null));};exports[_0x723a('0x43')]=function(_0x40fd28,_0x985501){var _0x1b6a23={'raw':![],'where':{'id':_0x40fd28[_0x723a('0x44')]['id']}},_0x46fc70={};_0x46fc70[_0x723a('0x2f')]=_[_0x723a('0x32')](db[_0x723a('0x2b')]['rawAttributes']);_0x46fc70['query']=_[_0x723a('0x32')](_0x40fd28[_0x723a('0x31')]);_0x46fc70[_0x723a('0x33')]=_[_0x723a('0x34')](_0x46fc70[_0x723a('0x2f')],_0x46fc70[_0x723a('0x31')]);_0x1b6a23[_0x723a('0x35')]=_[_0x723a('0x34')](_0x46fc70[_0x723a('0x2f')],qs[_0x723a('0x36')](_0x40fd28[_0x723a('0x31')][_0x723a('0x36')]));_0x1b6a23[_0x723a('0x35')]=_0x1b6a23[_0x723a('0x35')][_0x723a('0x37')]?_0x1b6a23['attributes']:_0x46fc70['model'];if(_0x40fd28['query'][_0x723a('0x45')]){_0x1b6a23[_0x723a('0x46')]=[{'all':!![]}];}_0x1b6a23=_[_0x723a('0x3e')]({},_0x1b6a23,_0x40fd28[_0x723a('0x47')]);return db[_0x723a('0x2b')][_0x723a('0x48')](_0x1b6a23)[_0x723a('0x24')](handleEntityNotFound(_0x985501,null))['then'](respondWithResult(_0x985501,null))['catch'](handleError(_0x985501,null));};exports[_0x723a('0x49')]=function(_0x24744a,_0x8cd85a){return db['ServicenowAccount'][_0x723a('0x49')](_0x24744a[_0x723a('0x4a')],{})['then'](respondWithResult(_0x8cd85a,0xc9))[_0x723a('0x42')](handleError(_0x8cd85a,null));};exports[_0x723a('0x23')]=function(_0x448213,_0x4c8184){if(_0x448213[_0x723a('0x4a')]['id']){delete _0x448213[_0x723a('0x4a')]['id'];}return db[_0x723a('0x2b')][_0x723a('0x48')]({'where':{'id':_0x448213['params']['id']}})[_0x723a('0x24')](handleEntityNotFound(_0x4c8184,null))[_0x723a('0x24')](saveUpdates(_0x448213['body'],null))[_0x723a('0x24')](respondWithResult(_0x4c8184,null))[_0x723a('0x42')](handleError(_0x4c8184,null));};exports[_0x723a('0x25')]=function(_0xd47e1,_0x4177c9){return db[_0x723a('0x2b')][_0x723a('0x48')]({'where':{'id':_0xd47e1[_0x723a('0x44')]['id']}})[_0x723a('0x24')](handleEntityNotFound(_0x4177c9,null))[_0x723a('0x24')](removeEntity(_0x4177c9,null))[_0x723a('0x42')](handleError(_0x4177c9,null));};exports[_0x723a('0x4b')]=function(_0xe97153,_0x192356,_0x3357b6){var _0x2be8ab={};var _0x2b93a0={};var _0x18f58f;var _0x2cf831;return db[_0x723a('0x2b')][_0x723a('0x4c')]({'where':{'id':_0xe97153[_0x723a('0x44')]['id']}})[_0x723a('0x24')](handleEntityNotFound(_0x192356,null))['then'](function(_0x5942a3){if(_0x5942a3){_0x18f58f=_0x5942a3;_0x2b93a0[_0x723a('0x2f')]=_[_0x723a('0x32')](db['ServicenowConfiguration'][_0x723a('0x2c')]);_0x2b93a0[_0x723a('0x31')]=_[_0x723a('0x32')](_0xe97153['query']);_0x2b93a0[_0x723a('0x33')]=_[_0x723a('0x34')](_0x2b93a0[_0x723a('0x2f')],_0x2b93a0[_0x723a('0x31')]);_0x2be8ab[_0x723a('0x35')]=_[_0x723a('0x34')](_0x2b93a0[_0x723a('0x2f')],qs[_0x723a('0x36')](_0xe97153[_0x723a('0x31')]['fields']));_0x2be8ab[_0x723a('0x35')]=_0x2be8ab[_0x723a('0x35')][_0x723a('0x37')]?_0x2be8ab[_0x723a('0x35')]:_0x2b93a0[_0x723a('0x2f')];_0x2be8ab['order']=qs['sort'](_0xe97153['query'][_0x723a('0x3b')]);_0x2be8ab[_0x723a('0x3c')]=qs[_0x723a('0x33')](_[_0x723a('0x3d')](_0xe97153['query'],_0x2b93a0[_0x723a('0x33')]));if(_0xe97153[_0x723a('0x31')][_0x723a('0x40')]){_0x2be8ab['where']=_['merge'](_0x2be8ab[_0x723a('0x3c')],{'$or':_['map'](_0x2be8ab['attributes'],function(_0x448394){var _0x5889df={};_0x5889df[_0x448394]={'$like':'%'+_0xe97153['query'][_0x723a('0x40')]+'%'};return _0x5889df;})});}_0x2be8ab=_[_0x723a('0x3e')]({},_0x2be8ab,_0xe97153[_0x723a('0x47')]);return _0x18f58f['getConfigurations'](_0x2be8ab);}})[_0x723a('0x24')](function(_0x22e62a){if(_0x22e62a){_0x2cf831=_0x22e62a[_0x723a('0x37')];if(!_0xe97153['query'][_0x723a('0x38')]('nolimit')){_0x2be8ab[_0x723a('0x1d')]=qs[_0x723a('0x1d')](_0xe97153[_0x723a('0x31')][_0x723a('0x1d')]);_0x2be8ab[_0x723a('0x1b')]=qs[_0x723a('0x1b')](_0xe97153[_0x723a('0x31')]['offset']);}return _0x18f58f[_0x723a('0x4b')](_0x2be8ab);}})[_0x723a('0x24')](function(_0x2cfd07){if(_0x2cfd07){return _0x2cfd07?{'count':_0x2cf831,'rows':_0x2cfd07}:null;}})[_0x723a('0x24')](respondWithResult(_0x192356,null))[_0x723a('0x42')](handleError(_0x192356,null));};exports[_0x723a('0x4d')]=function(_0xddc9dc,_0x3b15cd,_0x29075d){if(_0xddc9dc['body']['id']){delete _0xddc9dc[_0x723a('0x4a')]['id'];}return db[_0x723a('0x2b')][_0x723a('0x4c')]({'where':{'id':_0xddc9dc['params']['id']}})[_0x723a('0x24')](handleEntityNotFound(_0x3b15cd,null))[_0x723a('0x24')](function(_0x5544b1){if(_0x5544b1){_0xddc9dc[_0x723a('0x4a')][_0x723a('0x4e')]=_0x5544b1['id'];_0xddc9dc[_0x723a('0x4a')][_0x723a('0x4f')]=integrations['getSubjects'](_0xddc9dc[_0x723a('0x4a')][_0x723a('0x50')],_0xddc9dc[_0x723a('0x4a')][_0x723a('0x2e')]);_0xddc9dc[_0x723a('0x4a')][_0x723a('0x51')]=integrations['getDescriptions'](_0xddc9dc[_0x723a('0x4a')][_0x723a('0x50')],_0xddc9dc[_0x723a('0x4a')]['type']);return db[_0x723a('0x52')]['create'](_0xddc9dc[_0x723a('0x4a')],{'include':[{'model':db[_0x723a('0x53')],'as':'Subjects'},{'model':db[_0x723a('0x53')],'as':_0x723a('0x51')}]});}return null;})[_0x723a('0x24')](respondWithResult(_0x3b15cd,null))['catch'](handleError(_0x3b15cd,null));};exports[_0x723a('0x54')]=function(_0x27e3e7,_0x311213,_0x1c623b){var _0x1760ae=['made_sla',_0x723a('0x55'),_0x723a('0x56'),_0x723a('0x57'),'close_code',_0x723a('0x58'),_0x723a('0x59'),_0x723a('0x5a'),_0x723a('0x5b')];var _0x2206f5=[_0x723a('0x5c'),'made_sla','caused_by',_0x723a('0x5d'),_0x723a('0x5e'),_0x723a('0x5f'),_0x723a('0x60'),_0x723a('0x55'),_0x723a('0x61'),_0x723a('0x62'),'resolved_by',_0x723a('0x63'),_0x723a('0x64'),_0x723a('0x65'),'sys_created_on',_0x723a('0x66'),_0x723a('0x67'),_0x723a('0x68'),'knowledge',_0x723a('0x3a'),_0x723a('0x69'),'closed_at',_0x723a('0x6a'),_0x723a('0x6b'),_0x723a('0x6c'),_0x723a('0x6d'),'work_notes_list','business_service',_0x723a('0x6e'),_0x723a('0x6f'),_0x723a('0x70'),_0x723a('0x71'),_0x723a('0x72'),_0x723a('0x73'),'business_duration',_0x723a('0x74'),'work_end',_0x723a('0x75'),_0x723a('0x76'),_0x723a('0x77'),'approval_set','subcategory',_0x723a('0x78'),'short_description',_0x723a('0x79'),_0x723a('0x7a'),'delivery_task',_0x723a('0x7b'),_0x723a('0x7c'),'business_stc',_0x723a('0x7d'),'description',_0x723a('0x7e'),_0x723a('0x58'),_0x723a('0x7f'),_0x723a('0x80'),_0x723a('0x81'),_0x723a('0x82'),'parent_incident',_0x723a('0x83'),_0x723a('0x84'),_0x723a('0x85'),_0x723a('0x59'),_0x723a('0x86'),_0x723a('0x87'),_0x723a('0x88'),'reassignment_count','activity_due','assigned_to',_0x723a('0x5a'),_0x723a('0x89'),_0x723a('0x8a'),_0x723a('0x8b'),'comments_and_work_notes',_0x723a('0x8c'),_0x723a('0x8d'),_0x723a('0x8e'),_0x723a('0x8f'),_0x723a('0x90'),_0x723a('0x91'),_0x723a('0x92'),'location','category'];var _0x213509='';var _0x5cb69e='';var _0x596597=[];var _0x4107f0='';var _0x2e6ee4='';var _0x418754=[];var _0xb7877b='';var _0x2b3812='';var _0x160dfc={};var _0x2febd3='';return db[_0x723a('0x2b')]['findOne']({'where':{'id':_0x27e3e7[_0x723a('0x44')]['id']},'attributes':['id',_0x723a('0x93'),'password','email',_0x723a('0x94'),_0x723a('0x95')]})['then'](handleEntityNotFound(_0x311213,null))[_0x723a('0x24')](function(_0x4faa74){if(_0x4faa74){_0x2febd3=_0x4faa74[_0x723a('0x94')];var _0x21d8d7=_0x2febd3[_0x723a('0x96')](-0x1);if(_0x21d8d7==='/'){_0x2febd3=_0x2febd3[_0x723a('0x97')](0x0,_0x2febd3[_0x723a('0x98')](_0x21d8d7));}_0x2b3812=util[_0x723a('0x99')](_0x723a('0x9a'),_0x2febd3);_0xb7877b=util['format'](_0x723a('0x9b'),_0x2febd3);_0x160dfc={'user':_0x4faa74[_0x723a('0x93')],'pass':_0x4faa74[_0x723a('0x9c')]};var _0x1faf56={'method':'GET','uri':_0x2b3812+_0x723a('0x9d'),'auth':_0x160dfc,'json':!![]};return rp(_0x1faf56);}})[_0x723a('0x24')](function(_0x1211d4){if(_0x1211d4[_0x723a('0x9e')][_0x723a('0x37')]>0x0){_0x213509=_0x1211d4[_0x723a('0x9e')];}console['log'](_0x723a('0x9f'),_0x213509);_0x418754=[];_0x5cb69e=Object[_0x723a('0xa0')]([],_0x213509);_[_0x723a('0xa1')](_0x5cb69e,function(_0x5318e8){return!_0x1760ae['includes'](_0x5318e8['name']);});_0x5cb69e[_0x723a('0xa2')](function(_0x2622e9){var _0x568160=createFieldObject(_0xb7877b,_0x160dfc,_0x2622e9['internalType'],_0x2622e9[_0x723a('0x28')],_0x2622e9[_0x723a('0xa3')],![]);_0x418754[_0x723a('0xa4')](_0x568160);});return Promise[_0x723a('0xa5')](_0x418754);})[_0x723a('0x24')](function(_0x18204e){_0x596597=_0x18204e;_0x4107f0=Object[_0x723a('0xa0')]([],_0x213509);console[_0x723a('0xa6')](_0x723a('0xa7'),_0x213509);_[_0x723a('0xa1')](_0x4107f0,function(_0x175f97){return _0x2206f5[_0x723a('0xa8')](_0x175f97[_0x723a('0x28')]);});console[_0x723a('0xa6')](_0x723a('0xa9'),_0x4107f0);_0x418754=[];_0x4107f0[_0x723a('0xa2')](function(_0x40a1d2){var _0x205d5b=createFieldObject(_0xb7877b,_0x160dfc,_0x40a1d2[_0x723a('0xaa')],_0x40a1d2[_0x723a('0x28')],_0x40a1d2[_0x723a('0xa3')],!![]);_0x418754['push'](_0x205d5b);});return Promise[_0x723a('0xa5')](_0x418754);})['then'](function(_0x5df16a){_0x2e6ee4=_0x5df16a;var _0x3c92fa=_0x596597[_0x723a('0xab')](_0x2e6ee4);return{'count':_0x3c92fa[_0x723a('0x37')],'rows':_0x3c92fa};})[_0x723a('0x24')](respondWithResult(_0x311213,null))[_0x723a('0x42')](function(_0x4741b){console[_0x723a('0xa6')](_0x723a('0xac')+_0x4741b);var _0x4a8d1e=_0x27e3e7[_0x723a('0x31')][_0x723a('0xad')]?0x1f4:_0x4741b['statusCode']||0x1f4;logger[_0x723a('0x26')](_0x4741b['stack']);delete _0x4741b[_0x723a('0x28')];if(_0x4a8d1e===0x191){_0x4a8d1e=0x190;}_0x311213['status'](_0x4a8d1e)[_0x723a('0x29')](_0x27e3e7[_0x723a('0x31')][_0x723a('0xad')]?{'message':'Wrong\x20credentials','statusCode':_0x4741b['statusCode']}:_0x4741b);});};function createFieldObject(_0x2840bb,_0x2f5869,_0x387f53,_0x2b39cf,_0x57531e,_0x57bd9c){return new Promise(function(_0x221d36,_0x526aea){var _0xe904d1={'id':_0x2b39cf,'name':_0x57531e,'custom':_0x57bd9c};if(_0x387f53===_0x723a('0xae')){_0xe904d1[_0x723a('0x47')]=[{'name':_0x723a('0xaf'),'value':_0x723a('0xb0')},{'name':_0x723a('0xb1'),'value':_0x723a('0xb2')}];_0x221d36(_0xe904d1);}else{var _0xb1398d={'method':'GET','uri':_0x2840bb+_0x723a('0xb3')+_0x2b39cf,'auth':_0x2f5869,'json':!![]};return rp(_0xb1398d)[_0x723a('0x24')](function(_0x416c57){var _0xf865be=[];if(_0x416c57[_0x723a('0x9e')][_0x723a('0x37')]>0x0){_0x416c57[_0x723a('0x9e')][_0x723a('0xa2')](function(_0x43b1bc){if(_0x43b1bc[_0x723a('0xb4')]==='false'){var _0xbfd9cb={'name':_0x43b1bc['label'],'value':_0x43b1bc[_0x723a('0xb5')]};_0xf865be[_0x723a('0xa4')](_0xbfd9cb);}});}_0xe904d1['options']=_0xf865be;if(_0xe904d1[_0x723a('0x47')][_0x723a('0x37')]>0x0){_0x221d36(_0xe904d1);}else{if(_0x57bd9c==![]){_0x221d36();}else{_0x221d36(_0xe904d1);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index fbd5234..8b6b3c8 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 _0xba34=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x7d8d4,_0x188cad){var _0x4ce02a=function(_0x417d37){while(--_0x417d37){_0x7d8d4['push'](_0x7d8d4['shift']());}};_0x4ce02a(++_0x188cad);}(_0xba34,0x119));var _0x4ba3=function(_0x56c7df,_0x12caf1){_0x56c7df=_0x56c7df-0x0;var _0x48b6ce=_0xba34[_0x56c7df];return _0x48b6ce;};'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 _0x3eea=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','../../config/logger','api','moment'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x262d84,_0x137bc3){_0x262d84=_0x262d84-0x0;var _0x3fde9a=_0x3eea[_0x262d84];return _0x3fde9a;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var logger=require(_0xa3ee('0x1'))(_0xa3ee('0x2'));var moment=require(_0xa3ee('0x3'));var BPromise=require(_0xa3ee('0x4'));var rp=require(_0xa3ee('0x5'));var fs=require('fs');var path=require(_0xa3ee('0x6'));var rimraf=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var attributes=require(_0xa3ee('0x9'));var integrations=require(_0xa3ee('0xa'));module[_0xa3ee('0xb')]=function(_0x5776bb,_0x538bf9){return _0x5776bb[_0xa3ee('0xc')]('ServicenowAccount',attributes,{'tableName':_0xa3ee('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 4e4f83d..ef2a472 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 _0xd959=['raw','where','attributes','map','include','model','debug','stringify','ShowServicenowAccount','find','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','GetServicenowAccount','ServicenowAccount','options'];(function(_0x2af167,_0x26f7b8){var _0x447b98=function(_0x122690){while(--_0x122690){_0x2af167['push'](_0x2af167['shift']());}};_0x447b98(++_0x26f7b8);}(_0xd959,0x67));var _0x9d95=function(_0x1ca2cd,_0x1e232a){_0x1ca2cd=_0x1ca2cd-0x0;var _0x16c194=_0xd959[_0x1ca2cd];return _0x16c194;};'use strict';var _=require('lodash');var util=require(_0x9d95('0x0'));var moment=require(_0x9d95('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d95('0x2'))['db'];var utils=require(_0x9d95('0x3'));var logger=require(_0x9d95('0x4'))(_0x9d95('0x5'));var config=require(_0x9d95('0x6'));var jayson=require(_0x9d95('0x7'));var client=jayson[_0x9d95('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ea420,_0x46e06e,_0x5074a7){return new BPromise(function(_0x17893a,_0x4b7698){return client[_0x9d95('0x9')](_0x5ea420,_0x5074a7)[_0x9d95('0xa')](function(_0xb19d80){logger['info'](_0x9d95('0xb'),_0x46e06e,_0x9d95('0xc'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x46e06e,'request\x20sent',JSON['stringify'](_0xb19d80));if(_0xb19d80[_0x9d95('0xd')]){if(_0xb19d80[_0x9d95('0xd')]['code']===0x1f4){logger[_0x9d95('0xd')](_0x9d95('0xb'),_0x46e06e,_0xb19d80[_0x9d95('0xd')]['message']);return _0x4b7698(_0xb19d80[_0x9d95('0xd')][_0x9d95('0xe')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x46e06e,_0xb19d80[_0x9d95('0xd')]['message']);return _0x17893a(_0xb19d80[_0x9d95('0xd')][_0x9d95('0xe')]);}else{logger[_0x9d95('0xf')](_0x9d95('0xb'),_0x46e06e,_0x9d95('0xc'));_0x17893a(_0xb19d80[_0x9d95('0x10')][_0x9d95('0xe')]);}})[_0x9d95('0x11')](function(_0x1cd2ec){logger[_0x9d95('0xd')](_0x9d95('0xb'),_0x46e06e,_0x1cd2ec);_0x4b7698(_0x1cd2ec);});});}exports[_0x9d95('0x12')]=function(_0x5bd41a){var _0x15d47e=this;return new Promise(function(_0x5cbdbe,_0x5f31fb){return db[_0x9d95('0x13')]['findAll']({'raw':_0x5bd41a[_0x9d95('0x14')]?_0x5bd41a[_0x9d95('0x14')][_0x9d95('0x15')]===undefined?!![]:![]:!![],'where':_0x5bd41a['options']?_0x5bd41a[_0x9d95('0x14')][_0x9d95('0x16')]||null:null,'attributes':_0x5bd41a[_0x9d95('0x14')]?_0x5bd41a['options'][_0x9d95('0x17')]||null:null,'limit':_0x5bd41a['options']?_0x5bd41a[_0x9d95('0x14')]['limit']||null:null,'include':_0x5bd41a['options']?_0x5bd41a[_0x9d95('0x14')]['include']?_[_0x9d95('0x18')](_0x5bd41a[_0x9d95('0x14')][_0x9d95('0x19')],function(_0x13d57b){return{'model':db[_0x13d57b['model']],'as':_0x13d57b['as'],'attributes':_0x13d57b[_0x9d95('0x17')],'include':_0x13d57b[_0x9d95('0x19')]?_[_0x9d95('0x18')](_0x13d57b[_0x9d95('0x19')],function(_0x3d42c4){return{'model':db[_0x3d42c4[_0x9d95('0x1a')]],'as':_0x3d42c4['as'],'attributes':_0x3d42c4[_0x9d95('0x17')],'include':_0x3d42c4[_0x9d95('0x19')]?_['map'](_0x3d42c4[_0x9d95('0x19')],function(_0xdf0b23){return{'model':db[_0xdf0b23['model']],'as':_0xdf0b23['as'],'attributes':_0xdf0b23['attributes']};}):[]};}):[]};}):[]:[]})[_0x9d95('0xa')](function(_0x3178c7){logger[_0x9d95('0xf')](_0x9d95('0x12'),_0x5bd41a);logger[_0x9d95('0x1b')](_0x9d95('0x12'),_0x5bd41a,JSON[_0x9d95('0x1c')](_0x3178c7));_0x5cbdbe(_0x3178c7);})[_0x9d95('0x11')](function(_0x4869af){logger[_0x9d95('0xd')]('GetServicenowAccount',_0x4869af[_0x9d95('0xe')],_0x5bd41a);_0x5f31fb(_0x15d47e[_0x9d95('0xd')](0x1f4,_0x4869af[_0x9d95('0xe')]));});});};exports[_0x9d95('0x1d')]=function(_0x380303){var _0x2046f3=this;return new Promise(function(_0x5a5bb7,_0x2dc1fa){return db[_0x9d95('0x13')][_0x9d95('0x1e')]({'raw':_0x380303[_0x9d95('0x14')]?_0x380303[_0x9d95('0x14')][_0x9d95('0x15')]===undefined?!![]:![]:!![],'where':_0x380303[_0x9d95('0x14')]?_0x380303['options'][_0x9d95('0x16')]||null:null,'attributes':_0x380303[_0x9d95('0x14')]?_0x380303[_0x9d95('0x14')][_0x9d95('0x17')]||null:null,'include':_0x380303['options']?_0x380303[_0x9d95('0x14')][_0x9d95('0x19')]?_[_0x9d95('0x18')](_0x380303[_0x9d95('0x14')][_0x9d95('0x19')],function(_0x1a9f50){return{'model':db[_0x1a9f50[_0x9d95('0x1a')]],'as':_0x1a9f50['as'],'attributes':_0x1a9f50[_0x9d95('0x17')],'include':_0x1a9f50[_0x9d95('0x19')]?_['map'](_0x1a9f50['include'],function(_0x2da332){return{'model':db[_0x2da332[_0x9d95('0x1a')]],'as':_0x2da332['as'],'attributes':_0x2da332[_0x9d95('0x17')],'include':_0x2da332[_0x9d95('0x19')]?_[_0x9d95('0x18')](_0x2da332['include'],function(_0x2af49e){return{'model':db[_0x2af49e[_0x9d95('0x1a')]],'as':_0x2af49e['as'],'attributes':_0x2af49e['attributes']};}):[]};}):[]};}):[]:[]})[_0x9d95('0xa')](function(_0x4da23a){logger['info'](_0x9d95('0x1d'),_0x380303);logger[_0x9d95('0x1b')](_0x9d95('0x1d'),_0x380303,JSON[_0x9d95('0x1c')](_0x4da23a));_0x5a5bb7(_0x4da23a);})[_0x9d95('0x11')](function(_0x559f95){logger['error']('ShowServicenowAccount',_0x559f95['message'],_0x380303);_0x2dc1fa(_0x2046f3[_0x9d95('0xd')](0x1f4,_0x559f95[_0x9d95('0xe')]));});});}; \ No newline at end of file +var _0x2dc4=['ShowServicenowAccount','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','ServicenowAccount','findAll','options','raw','where','attributes','map','include','model','GetServicenowAccount','stringify','find','then'];(function(_0xb08574,_0x20512a){var _0x1832bb=function(_0x2307bd){while(--_0x2307bd){_0xb08574['push'](_0xb08574['shift']());}};_0x1832bb(++_0x20512a);}(_0x2dc4,0x199));var _0x42dc=function(_0xb525fd,_0x473332){_0xb525fd=_0xb525fd-0x0;var _0x5349e9=_0x2dc4[_0xb525fd];return _0x5349e9;};'use strict';var _=require('lodash');var util=require(_0x42dc('0x0'));var moment=require(_0x42dc('0x1'));var BPromise=require('bluebird');var rs=require(_0x42dc('0x2'));var fs=require('fs');var Redis=require(_0x42dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x42dc('0x4'));var logger=require(_0x42dc('0x5'))('rpc');var config=require(_0x42dc('0x6'));var jayson=require(_0x42dc('0x7'));var client=jayson[_0x42dc('0x8')][_0x42dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57a42a,_0x2ed73c,_0x7c9c28){return new BPromise(function(_0x5643a0,_0x23088b){return client[_0x42dc('0xa')](_0x57a42a,_0x7c9c28)['then'](function(_0x4dab58){logger['info'](_0x42dc('0xb'),_0x2ed73c,_0x42dc('0xc'));logger[_0x42dc('0xd')](_0x42dc('0xe'),_0x2ed73c,_0x42dc('0xc'),JSON['stringify'](_0x4dab58));if(_0x4dab58['error']){if(_0x4dab58[_0x42dc('0xf')]['code']===0x1f4){logger[_0x42dc('0xf')](_0x42dc('0xb'),_0x2ed73c,_0x4dab58['error'][_0x42dc('0x10')]);return _0x23088b(_0x4dab58[_0x42dc('0xf')]['message']);}logger['error'](_0x42dc('0xb'),_0x2ed73c,_0x4dab58['error'][_0x42dc('0x10')]);return _0x5643a0(_0x4dab58['error']['message']);}else{logger[_0x42dc('0x11')](_0x42dc('0xb'),_0x2ed73c,_0x42dc('0xc'));_0x5643a0(_0x4dab58[_0x42dc('0x12')]['message']);}})[_0x42dc('0x13')](function(_0x239cf5){logger[_0x42dc('0xf')](_0x42dc('0xb'),_0x2ed73c,_0x239cf5);_0x23088b(_0x239cf5);});});}exports['GetServicenowAccount']=function(_0x10130c){var _0x455ca6=this;return new Promise(function(_0x5f1ca3,_0x32681d){return db[_0x42dc('0x14')][_0x42dc('0x15')]({'raw':_0x10130c[_0x42dc('0x16')]?_0x10130c[_0x42dc('0x16')][_0x42dc('0x17')]===undefined?!![]:![]:!![],'where':_0x10130c['options']?_0x10130c[_0x42dc('0x16')][_0x42dc('0x18')]||null:null,'attributes':_0x10130c[_0x42dc('0x16')]?_0x10130c[_0x42dc('0x16')][_0x42dc('0x19')]||null:null,'limit':_0x10130c[_0x42dc('0x16')]?_0x10130c[_0x42dc('0x16')]['limit']||null:null,'include':_0x10130c['options']?_0x10130c['options']['include']?_[_0x42dc('0x1a')](_0x10130c[_0x42dc('0x16')][_0x42dc('0x1b')],function(_0x4a8330){return{'model':db[_0x4a8330[_0x42dc('0x1c')]],'as':_0x4a8330['as'],'attributes':_0x4a8330[_0x42dc('0x19')],'include':_0x4a8330[_0x42dc('0x1b')]?_[_0x42dc('0x1a')](_0x4a8330['include'],function(_0x332c9c){return{'model':db[_0x332c9c[_0x42dc('0x1c')]],'as':_0x332c9c['as'],'attributes':_0x332c9c[_0x42dc('0x19')],'include':_0x332c9c[_0x42dc('0x1b')]?_[_0x42dc('0x1a')](_0x332c9c['include'],function(_0x51fc5c){return{'model':db[_0x51fc5c[_0x42dc('0x1c')]],'as':_0x51fc5c['as'],'attributes':_0x51fc5c[_0x42dc('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ce5dc){logger[_0x42dc('0x11')](_0x42dc('0x1d'),_0x10130c);logger[_0x42dc('0xd')](_0x42dc('0x1d'),_0x10130c,JSON[_0x42dc('0x1e')](_0x5ce5dc));_0x5f1ca3(_0x5ce5dc);})['catch'](function(_0x5454b3){logger[_0x42dc('0xf')]('GetServicenowAccount',_0x5454b3[_0x42dc('0x10')],_0x10130c);_0x32681d(_0x455ca6[_0x42dc('0xf')](0x1f4,_0x5454b3[_0x42dc('0x10')]));});});};exports['ShowServicenowAccount']=function(_0x2878ad){var _0x371806=this;return new Promise(function(_0x344cfc,_0x4bc23a){return db[_0x42dc('0x14')][_0x42dc('0x1f')]({'raw':_0x2878ad[_0x42dc('0x16')]?_0x2878ad[_0x42dc('0x16')][_0x42dc('0x17')]===undefined?!![]:![]:!![],'where':_0x2878ad[_0x42dc('0x16')]?_0x2878ad[_0x42dc('0x16')][_0x42dc('0x18')]||null:null,'attributes':_0x2878ad[_0x42dc('0x16')]?_0x2878ad[_0x42dc('0x16')][_0x42dc('0x19')]||null:null,'include':_0x2878ad[_0x42dc('0x16')]?_0x2878ad['options'][_0x42dc('0x1b')]?_[_0x42dc('0x1a')](_0x2878ad['options'][_0x42dc('0x1b')],function(_0x53489a){return{'model':db[_0x53489a[_0x42dc('0x1c')]],'as':_0x53489a['as'],'attributes':_0x53489a[_0x42dc('0x19')],'include':_0x53489a['include']?_[_0x42dc('0x1a')](_0x53489a[_0x42dc('0x1b')],function(_0x481da2){return{'model':db[_0x481da2['model']],'as':_0x481da2['as'],'attributes':_0x481da2[_0x42dc('0x19')],'include':_0x481da2[_0x42dc('0x1b')]?_[_0x42dc('0x1a')](_0x481da2[_0x42dc('0x1b')],function(_0x40d276){return{'model':db[_0x40d276['model']],'as':_0x40d276['as'],'attributes':_0x40d276[_0x42dc('0x19')]};}):[]};}):[]};}):[]:[]})[_0x42dc('0x20')](function(_0x19c509){logger[_0x42dc('0x11')]('ShowServicenowAccount',_0x2878ad);logger['debug'](_0x42dc('0x21'),_0x2878ad,JSON[_0x42dc('0x1e')](_0x19c509));_0x344cfc(_0x19c509);})[_0x42dc('0x13')](function(_0x419c67){logger[_0x42dc('0xf')](_0x42dc('0x21'),_0x419c67['message'],_0x2878ad);_0x4bc23a(_0x371806['error'](0x1f4,_0x419c67[_0x42dc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 0854eae..2ea3aa9 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 _0x1e55=['index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','/:id','destroy','exports','multer','path','express','Router','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1e55,0x7c));var _0x51e5=function(_0x341e36,_0x2d40a7){_0x341e36=_0x341e36-0x0;var _0xec7b13=_0x1e55[_0x341e36];return _0xec7b13;};'use strict';var multer=require(_0x51e5('0x0'));var util=require('util');var path=require(_0x51e5('0x1'));var timeout=require('connect-timeout');var express=require(_0x51e5('0x2'));var router=express[_0x51e5('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x51e5('0x4'));var controller=require(_0x51e5('0x5'));router[_0x51e5('0x6')]('/',auth[_0x51e5('0x7')](),controller[_0x51e5('0x8')]);router[_0x51e5('0x6')]('/:id',auth[_0x51e5('0x7')](),controller[_0x51e5('0x9')]);router[_0x51e5('0x6')](_0x51e5('0xa'),auth['isAuthenticated'](),controller[_0x51e5('0xb')]);router[_0x51e5('0x6')](_0x51e5('0xc'),auth[_0x51e5('0x7')](),controller['getSubjects']);router[_0x51e5('0x6')](_0x51e5('0xd'),auth['isAuthenticated'](),controller[_0x51e5('0xe')]);router[_0x51e5('0xf')]('/',auth[_0x51e5('0x7')](),controller[_0x51e5('0x10')]);router[_0x51e5('0x11')]('/:id',auth[_0x51e5('0x7')](),controller[_0x51e5('0x12')]);router['delete'](_0x51e5('0x13'),auth['isAuthenticated'](),controller[_0x51e5('0x14')]);module[_0x51e5('0x15')]=router; \ No newline at end of file +var _0xc1a6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','/:id','update','exports','multer','util','path','connect-timeout','express'];(function(_0xbe6a06,_0x4c7c18){var _0x336792=function(_0x15ec96){while(--_0x15ec96){_0xbe6a06['push'](_0xbe6a06['shift']());}};_0x336792(++_0x4c7c18);}(_0xc1a6,0x1ef));var _0x6c1a=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xc1a6[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0x6c1a('0x0'));var util=require(_0x6c1a('0x1'));var path=require(_0x6c1a('0x2'));var timeout=require(_0x6c1a('0x3'));var express=require(_0x6c1a('0x4'));var router=express[_0x6c1a('0x5')]();var fs_extra=require(_0x6c1a('0x6'));var auth=require(_0x6c1a('0x7'));var interaction=require(_0x6c1a('0x8'));var config=require(_0x6c1a('0x9'));var controller=require(_0x6c1a('0xa'));router['get']('/',auth[_0x6c1a('0xb')](),controller[_0x6c1a('0xc')]);router[_0x6c1a('0xd')]('/:id',auth[_0x6c1a('0xb')](),controller[_0x6c1a('0xe')]);router[_0x6c1a('0xd')](_0x6c1a('0xf'),auth['isAuthenticated'](),controller[_0x6c1a('0x10')]);router['get'](_0x6c1a('0x11'),auth[_0x6c1a('0xb')](),controller[_0x6c1a('0x12')]);router['get'](_0x6c1a('0x13'),auth[_0x6c1a('0xb')](),controller['getDescriptions']);router[_0x6c1a('0x14')]('/',auth[_0x6c1a('0xb')](),controller[_0x6c1a('0x15')]);router['put'](_0x6c1a('0x16'),auth[_0x6c1a('0xb')](),controller[_0x6c1a('0x17')]);router['delete'](_0x6c1a('0x16'),auth['isAuthenticated'](),controller['destroy']);module[_0x6c1a('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 3037fd4..1d1717d 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 _0x7428=['sequelize','exports','STRING'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x7428,0x144));var _0x8742=function(_0xc526d9,_0x1a944c){_0xc526d9=_0xc526d9-0x0;var _0x101274=_0x7428[_0xc526d9];return _0x101274;};'use strict';var Sequelize=require(_0x8742('0x0'));module[_0x8742('0x1')]={'name':{'type':Sequelize[_0x8742('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa54e=['sequelize','exports'];(function(_0x384231,_0x50be41){var _0x2480bf=function(_0x1c4838){while(--_0x1c4838){_0x384231['push'](_0x384231['shift']());}};_0x2480bf(++_0x50be41);}(_0xa54e,0x1f0));var _0xea54=function(_0x2e41e2,_0x4e7250){_0x2e41e2=_0x2e41e2-0x0;var _0x2844d6=_0xa54e[_0x2e41e2];return _0x2844d6;};'use strict';var Sequelize=require(_0xea54('0x0'));module[_0xea54('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 56c1669..543ba35 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 _0x0108=['attributes','fields','hasOwnProperty','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','params','getFields','findOne','order','nolimit','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','apply','save','update','then','destroy','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','intersection'];(function(_0xb5fc3e,_0x234703){var _0x2efc3c=function(_0x4e4e44){while(--_0x4e4e44){_0xb5fc3e['push'](_0xb5fc3e['shift']());}};_0x2efc3c(++_0x234703);}(_0x0108,0x109));var _0x8010=function(_0x45bfbc,_0x1ff15e){_0x45bfbc=_0x45bfbc-0x0;var _0x407018=_0x0108[_0x45bfbc];return _0x407018;};'use strict';var emlformat=require(_0x8010('0x0'));var rimraf=require(_0x8010('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8010('0x2'));var rp=require('request-promise');var moment=require(_0x8010('0x3'));var BPromise=require(_0x8010('0x4'));var Mustache=require(_0x8010('0x5'));var util=require('util');var path=require(_0x8010('0x6'));var sox=require(_0x8010('0x7'));var csv=require(_0x8010('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8010('0x9'));var _=require(_0x8010('0xa'));var squel=require(_0x8010('0xb'));var crypto=require(_0x8010('0xc'));var jsforce=require(_0x8010('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8010('0x8'));var querystring=require('querystring');var Papa=require(_0x8010('0xe'));var Redis=require('ioredis');var authService=require(_0x8010('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8010('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8010('0x11'))(_0x8010('0x12'));var utils=require(_0x8010('0x13'));var config=require(_0x8010('0x14'));var licenseUtil=require(_0x8010('0x15'));var db=require(_0x8010('0x16'))['db'];function respondWithStatusCode(_0xf28762,_0x5e5a99){_0x5e5a99=_0x5e5a99||0xcc;return function(_0x4381d0){if(_0x4381d0){return _0xf28762['sendStatus'](_0x5e5a99);}return _0xf28762[_0x8010('0x17')](_0x5e5a99)[_0x8010('0x18')]();};}function respondWithResult(_0x5e7326,_0x756b73){_0x756b73=_0x756b73||0xc8;return function(_0x13962b){if(_0x13962b){return _0x5e7326[_0x8010('0x17')](_0x756b73)[_0x8010('0x19')](_0x13962b);}};}function respondWithFilteredResult(_0x2009f3,_0x211190){return function(_0x16096c){if(_0x16096c){var _0x449e9a=typeof _0x211190[_0x8010('0x1a')]===_0x8010('0x1b')&&typeof _0x211190['limit']===_0x8010('0x1b');var _0x580f1e=_0x16096c[_0x8010('0x1c')];var _0x5a8395=_0x449e9a?0x0:_0x211190[_0x8010('0x1a')];var _0x2c03e0=_0x449e9a?_0x16096c[_0x8010('0x1c')]:_0x211190[_0x8010('0x1a')]+_0x211190['limit'];var _0x321b85;if(_0x2c03e0>=_0x580f1e){_0x2c03e0=_0x580f1e;_0x321b85=0xc8;}else{_0x321b85=0xce;}_0x2009f3[_0x8010('0x17')](_0x321b85);return _0x2009f3['set']('Content-Range',_0x5a8395+'-'+_0x2c03e0+'/'+_0x580f1e)['json'](_0x16096c);}return null;};}function patchUpdates(_0x1294d5){return function(_0x32b3c2){try{jsonpatch[_0x8010('0x1d')](_0x32b3c2,_0x1294d5,!![]);}catch(_0x53d72c){return BPromise['reject'](_0x53d72c);}return _0x32b3c2[_0x8010('0x1e')]();};}function saveUpdates(_0x3e3df8,_0x36de40){return function(_0x48f8bf){if(_0x48f8bf){return _0x48f8bf[_0x8010('0x1f')](_0x3e3df8)[_0x8010('0x20')](function(_0x232c1a){return _0x232c1a;});}return null;};}function removeEntity(_0x52f4b2,_0x3022e0){return function(_0x34d68c){if(_0x34d68c){return _0x34d68c[_0x8010('0x21')]()['then'](function(){_0x52f4b2[_0x8010('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x311765,_0x29efc8){return function(_0x21d8b7){if(!_0x21d8b7){_0x311765['sendStatus'](0x194);}return _0x21d8b7;};}function handleError(_0xee62ec,_0x22da28){_0x22da28=_0x22da28||0x1f4;return function(_0x1c8e04){logger[_0x8010('0x22')](_0x1c8e04[_0x8010('0x23')]);if(_0x1c8e04[_0x8010('0x24')]){delete _0x1c8e04['name'];}_0xee62ec[_0x8010('0x17')](_0x22da28)['send'](_0x1c8e04);};}exports[_0x8010('0x25')]=function(_0x1c224d,_0x4a70ae){var _0x3c61d9={},_0x4fcef3={},_0xa4bedb={'count':0x0,'rows':[]};var _0x193cc3=_[_0x8010('0x26')](db[_0x8010('0x27')][_0x8010('0x28')],function(_0x436d36){return{'name':_0x436d36[_0x8010('0x29')],'type':_0x436d36[_0x8010('0x2a')][_0x8010('0x2b')]};});_0x4fcef3[_0x8010('0x2c')]=_[_0x8010('0x26')](_0x193cc3,_0x8010('0x24'));_0x4fcef3[_0x8010('0x2d')]=_['keys'](_0x1c224d[_0x8010('0x2d')]);_0x4fcef3['filters']=_[_0x8010('0x2e')](_0x4fcef3[_0x8010('0x2c')],_0x4fcef3[_0x8010('0x2d')]);_0x3c61d9[_0x8010('0x2f')]=_[_0x8010('0x2e')](_0x4fcef3[_0x8010('0x2c')],qs[_0x8010('0x30')](_0x1c224d[_0x8010('0x2d')][_0x8010('0x30')]));_0x3c61d9[_0x8010('0x2f')]=_0x3c61d9[_0x8010('0x2f')]['length']?_0x3c61d9[_0x8010('0x2f')]:_0x4fcef3['model'];if(!_0x1c224d[_0x8010('0x2d')][_0x8010('0x31')]('nolimit')){_0x3c61d9[_0x8010('0x32')]=qs[_0x8010('0x32')](_0x1c224d['query']['limit']);_0x3c61d9[_0x8010('0x1a')]=qs['offset'](_0x1c224d[_0x8010('0x2d')][_0x8010('0x1a')]);}_0x3c61d9['order']=qs[_0x8010('0x33')](_0x1c224d[_0x8010('0x2d')][_0x8010('0x33')]);_0x3c61d9[_0x8010('0x34')]=qs[_0x8010('0x35')](_[_0x8010('0x36')](_0x1c224d[_0x8010('0x2d')],_0x4fcef3['filters']),_0x193cc3);if(_0x1c224d[_0x8010('0x2d')][_0x8010('0x37')]){_0x3c61d9[_0x8010('0x34')]=_[_0x8010('0x38')](_0x3c61d9[_0x8010('0x34')],{'$or':_[_0x8010('0x26')](_0x193cc3,function(_0xf28ebc){if(_0xf28ebc['type']!==_0x8010('0x39')){var _0xa9b676={};_0xa9b676[_0xf28ebc[_0x8010('0x24')]]={'$like':'%'+_0x1c224d[_0x8010('0x2d')][_0x8010('0x37')]+'%'};return _0xa9b676;}})});}_0x3c61d9=_[_0x8010('0x38')]({},_0x3c61d9,_0x1c224d[_0x8010('0x3a')]);var _0x117ca2={'where':_0x3c61d9[_0x8010('0x34')]};return db[_0x8010('0x27')][_0x8010('0x1c')](_0x117ca2)['then'](function(_0x59da0d){_0xa4bedb['count']=_0x59da0d;if(_0x1c224d[_0x8010('0x2d')][_0x8010('0x3b')]){_0x3c61d9[_0x8010('0x3c')]=[{'all':!![]}];}return db[_0x8010('0x27')][_0x8010('0x3d')](_0x3c61d9);})[_0x8010('0x20')](function(_0x2e6726){_0xa4bedb[_0x8010('0x3e')]=_0x2e6726;return _0xa4bedb;})['then'](respondWithFilteredResult(_0x4a70ae,_0x3c61d9))[_0x8010('0x3f')](handleError(_0x4a70ae,null));};exports[_0x8010('0x40')]=function(_0xff3cc,_0x2d4cf0){var _0x1a37ba={'raw':![],'where':{'id':_0xff3cc['params']['id']}},_0x1573da={};_0x1573da[_0x8010('0x2c')]=_[_0x8010('0x41')](db[_0x8010('0x27')][_0x8010('0x28')]);_0x1573da['query']=_[_0x8010('0x41')](_0xff3cc[_0x8010('0x2d')]);_0x1573da[_0x8010('0x35')]=_['intersection'](_0x1573da[_0x8010('0x2c')],_0x1573da[_0x8010('0x2d')]);_0x1a37ba[_0x8010('0x2f')]=_[_0x8010('0x2e')](_0x1573da[_0x8010('0x2c')],qs[_0x8010('0x30')](_0xff3cc['query'][_0x8010('0x30')]));_0x1a37ba[_0x8010('0x2f')]=_0x1a37ba['attributes'][_0x8010('0x42')]?_0x1a37ba[_0x8010('0x2f')]:_0x1573da[_0x8010('0x2c')];if(_0xff3cc['query']['includeAll']){_0x1a37ba[_0x8010('0x3c')]=[{'all':!![]}];}_0x1a37ba=_[_0x8010('0x38')]({},_0x1a37ba,_0xff3cc[_0x8010('0x3a')]);return db[_0x8010('0x27')][_0x8010('0x43')](_0x1a37ba)[_0x8010('0x20')](handleEntityNotFound(_0x2d4cf0,null))['then'](respondWithResult(_0x2d4cf0,null))[_0x8010('0x3f')](handleError(_0x2d4cf0,null));};exports[_0x8010('0x44')]=function(_0x55d89f,_0x25c023){return db['ServicenowConfiguration']['create'](_0x55d89f[_0x8010('0x45')],{})[_0x8010('0x20')](respondWithResult(_0x25c023,0xc9))[_0x8010('0x3f')](handleError(_0x25c023,null));};exports[_0x8010('0x1f')]=function(_0x4eec8c,_0x2178cc){if(_0x4eec8c[_0x8010('0x45')]['id']){delete _0x4eec8c[_0x8010('0x45')]['id'];}return db[_0x8010('0x27')][_0x8010('0x43')]({'where':{'id':_0x4eec8c[_0x8010('0x46')]['id']}})[_0x8010('0x20')](handleEntityNotFound(_0x2178cc,null))[_0x8010('0x20')](saveUpdates(_0x4eec8c[_0x8010('0x45')],null))[_0x8010('0x20')](respondWithResult(_0x2178cc,null))[_0x8010('0x3f')](handleError(_0x2178cc,null));};exports['destroy']=function(_0x332998,_0x449fc2){return db[_0x8010('0x27')][_0x8010('0x43')]({'where':{'id':_0x332998[_0x8010('0x46')]['id']}})[_0x8010('0x20')](handleEntityNotFound(_0x449fc2,null))['then'](removeEntity(_0x449fc2,null))[_0x8010('0x3f')](handleError(_0x449fc2,null));};exports[_0x8010('0x47')]=function(_0x1dbcb1,_0x55a202,_0x7dffd5){var _0x1c35d1={};var _0x5ca24f={};var _0x130180;var _0x443f34;return db[_0x8010('0x27')][_0x8010('0x48')]({'where':{'id':_0x1dbcb1[_0x8010('0x46')]['id']}})[_0x8010('0x20')](handleEntityNotFound(_0x55a202,null))[_0x8010('0x20')](function(_0x515884){if(_0x515884){_0x130180=_0x515884;_0x5ca24f[_0x8010('0x2c')]=_[_0x8010('0x41')](db['ServicenowField'][_0x8010('0x28')]);_0x5ca24f[_0x8010('0x2d')]=_[_0x8010('0x41')](_0x1dbcb1[_0x8010('0x2d')]);_0x5ca24f[_0x8010('0x35')]=_[_0x8010('0x2e')](_0x5ca24f[_0x8010('0x2c')],_0x5ca24f['query']);_0x1c35d1[_0x8010('0x2f')]=_[_0x8010('0x2e')](_0x5ca24f[_0x8010('0x2c')],qs[_0x8010('0x30')](_0x1dbcb1[_0x8010('0x2d')]['fields']));_0x1c35d1['attributes']=_0x1c35d1['attributes'][_0x8010('0x42')]?_0x1c35d1[_0x8010('0x2f')]:_0x5ca24f[_0x8010('0x2c')];_0x1c35d1[_0x8010('0x49')]=qs[_0x8010('0x33')](_0x1dbcb1[_0x8010('0x2d')][_0x8010('0x33')]);_0x1c35d1[_0x8010('0x34')]=qs[_0x8010('0x35')](_['pick'](_0x1dbcb1[_0x8010('0x2d')],_0x5ca24f[_0x8010('0x35')]));if(_0x1dbcb1['query'][_0x8010('0x37')]){_0x1c35d1[_0x8010('0x34')]=_[_0x8010('0x38')](_0x1c35d1[_0x8010('0x34')],{'$or':_[_0x8010('0x26')](_0x1c35d1['attributes'],function(_0x180a9e){var _0x219288={};_0x219288[_0x180a9e]={'$like':'%'+_0x1dbcb1[_0x8010('0x2d')][_0x8010('0x37')]+'%'};return _0x219288;})});}_0x1c35d1=_[_0x8010('0x38')]({},_0x1c35d1,_0x1dbcb1['options']);return _0x130180['getFields'](_0x1c35d1);}})[_0x8010('0x20')](function(_0x5cdf3e){if(_0x5cdf3e){_0x443f34=_0x5cdf3e['length'];if(!_0x1dbcb1[_0x8010('0x2d')][_0x8010('0x31')](_0x8010('0x4a'))){_0x1c35d1[_0x8010('0x32')]=qs[_0x8010('0x32')](_0x1dbcb1[_0x8010('0x2d')][_0x8010('0x32')]);_0x1c35d1[_0x8010('0x1a')]=qs['offset'](_0x1dbcb1[_0x8010('0x2d')][_0x8010('0x1a')]);}return _0x130180['getFields'](_0x1c35d1);}})[_0x8010('0x20')](function(_0x217d1a){if(_0x217d1a){return _0x217d1a?{'count':_0x443f34,'rows':_0x217d1a}:null;}})[_0x8010('0x20')](respondWithResult(_0x55a202,null))[_0x8010('0x3f')](handleError(_0x55a202,null));};exports['getSubjects']=function(_0x502083,_0x5f4a6c,_0x18000d){var _0x42e011={};var _0x258d84={};var _0x8b1c1a;var _0x5bfed9;return db['ServicenowConfiguration'][_0x8010('0x48')]({'where':{'id':_0x502083[_0x8010('0x46')]['id']}})[_0x8010('0x20')](handleEntityNotFound(_0x5f4a6c,null))[_0x8010('0x20')](function(_0x5d777e){if(_0x5d777e){_0x8b1c1a=_0x5d777e;_0x258d84[_0x8010('0x2c')]=_['keys'](db[_0x8010('0x4b')][_0x8010('0x28')]);_0x258d84[_0x8010('0x2d')]=_[_0x8010('0x41')](_0x502083[_0x8010('0x2d')]);_0x258d84[_0x8010('0x35')]=_[_0x8010('0x2e')](_0x258d84[_0x8010('0x2c')],_0x258d84[_0x8010('0x2d')]);_0x42e011[_0x8010('0x2f')]=_[_0x8010('0x2e')](_0x258d84[_0x8010('0x2c')],qs['fields'](_0x502083[_0x8010('0x2d')]['fields']));_0x42e011[_0x8010('0x2f')]=_0x42e011[_0x8010('0x2f')][_0x8010('0x42')]?_0x42e011[_0x8010('0x2f')]:_0x258d84[_0x8010('0x2c')];_0x42e011[_0x8010('0x49')]=qs[_0x8010('0x33')](_0x502083[_0x8010('0x2d')][_0x8010('0x33')]);_0x42e011['where']=qs[_0x8010('0x35')](_[_0x8010('0x36')](_0x502083['query'],_0x258d84['filters']));if(_0x502083['query']['filter']){_0x42e011[_0x8010('0x34')]=_[_0x8010('0x38')](_0x42e011[_0x8010('0x34')],{'$or':_[_0x8010('0x26')](_0x42e011[_0x8010('0x2f')],function(_0x41cad1){var _0x2220a9={};_0x2220a9[_0x41cad1]={'$like':'%'+_0x502083[_0x8010('0x2d')]['filter']+'%'};return _0x2220a9;})});}_0x42e011=_[_0x8010('0x38')]({},_0x42e011,_0x502083['options']);return _0x8b1c1a[_0x8010('0x4c')](_0x42e011);}})[_0x8010('0x20')](function(_0x397c09){if(_0x397c09){_0x5bfed9=_0x397c09['length'];if(!_0x502083[_0x8010('0x2d')]['hasOwnProperty'](_0x8010('0x4a'))){_0x42e011[_0x8010('0x32')]=qs['limit'](_0x502083[_0x8010('0x2d')][_0x8010('0x32')]);_0x42e011[_0x8010('0x1a')]=qs[_0x8010('0x1a')](_0x502083[_0x8010('0x2d')][_0x8010('0x1a')]);}return _0x8b1c1a[_0x8010('0x4c')](_0x42e011);}})[_0x8010('0x20')](function(_0x235484){if(_0x235484){return _0x235484?{'count':_0x5bfed9,'rows':_0x235484}:null;}})['then'](respondWithResult(_0x5f4a6c,null))[_0x8010('0x3f')](handleError(_0x5f4a6c,null));};exports[_0x8010('0x4d')]=function(_0x4622de,_0x5ec600,_0x29e240){var _0x4b9373={};var _0x305088={};var _0x56c18e;var _0xcd6418;return db[_0x8010('0x27')]['findOne']({'where':{'id':_0x4622de[_0x8010('0x46')]['id']}})['then'](handleEntityNotFound(_0x5ec600,null))[_0x8010('0x20')](function(_0x193cfa){if(_0x193cfa){_0x56c18e=_0x193cfa;_0x305088[_0x8010('0x2c')]=_['keys'](db[_0x8010('0x4b')][_0x8010('0x28')]);_0x305088['query']=_[_0x8010('0x41')](_0x4622de[_0x8010('0x2d')]);_0x305088[_0x8010('0x35')]=_[_0x8010('0x2e')](_0x305088[_0x8010('0x2c')],_0x305088[_0x8010('0x2d')]);_0x4b9373['attributes']=_[_0x8010('0x2e')](_0x305088[_0x8010('0x2c')],qs['fields'](_0x4622de['query'][_0x8010('0x30')]));_0x4b9373[_0x8010('0x2f')]=_0x4b9373[_0x8010('0x2f')]['length']?_0x4b9373[_0x8010('0x2f')]:_0x305088[_0x8010('0x2c')];_0x4b9373[_0x8010('0x49')]=qs[_0x8010('0x33')](_0x4622de[_0x8010('0x2d')][_0x8010('0x33')]);_0x4b9373[_0x8010('0x34')]=qs[_0x8010('0x35')](_['pick'](_0x4622de[_0x8010('0x2d')],_0x305088[_0x8010('0x35')]));if(_0x4622de[_0x8010('0x2d')][_0x8010('0x37')]){_0x4b9373[_0x8010('0x34')]=_['merge'](_0x4b9373['where'],{'$or':_[_0x8010('0x26')](_0x4b9373[_0x8010('0x2f')],function(_0x10125a){var _0x20b511={};_0x20b511[_0x10125a]={'$like':'%'+_0x4622de['query'][_0x8010('0x37')]+'%'};return _0x20b511;})});}_0x4b9373=_[_0x8010('0x38')]({},_0x4b9373,_0x4622de[_0x8010('0x3a')]);return _0x56c18e[_0x8010('0x4d')](_0x4b9373);}})['then'](function(_0x34830e){if(_0x34830e){_0xcd6418=_0x34830e[_0x8010('0x42')];if(!_0x4622de[_0x8010('0x2d')][_0x8010('0x31')]('nolimit')){_0x4b9373[_0x8010('0x32')]=qs['limit'](_0x4622de[_0x8010('0x2d')][_0x8010('0x32')]);_0x4b9373[_0x8010('0x1a')]=qs['offset'](_0x4622de['query'][_0x8010('0x1a')]);}return _0x56c18e['getDescriptions'](_0x4b9373);}})[_0x8010('0x20')](function(_0x27aab8){if(_0x27aab8){return _0x27aab8?{'count':_0xcd6418,'rows':_0x27aab8}:null;}})['then'](respondWithResult(_0x5ec600,null))['catch'](handleError(_0x5ec600,null));}; \ No newline at end of file +var _0xa435=['destroy','getFields','findOne','ServicenowField','filter','hasOwnProperty','getSubjects','rawAttributes','order','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','ServicenowConfiguration','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body'];(function(_0x3e9509,_0x17853f){var _0x17dd1c=function(_0x42e5f7){while(--_0x42e5f7){_0x3e9509['push'](_0x3e9509['shift']());}};_0x17dd1c(++_0x17853f);}(_0xa435,0x1ae));var _0x5a43=function(_0x4c0380,_0x23b38f){_0x4c0380=_0x4c0380-0x0;var _0x589fdf=_0xa435[_0x4c0380];return _0x589fdf;};'use strict';var emlformat=require(_0x5a43('0x0'));var rimraf=require(_0x5a43('0x1'));var zipdir=require(_0x5a43('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a43('0x3'));var moment=require(_0x5a43('0x4'));var BPromise=require(_0x5a43('0x5'));var Mustache=require(_0x5a43('0x6'));var util=require(_0x5a43('0x7'));var path=require(_0x5a43('0x8'));var sox=require(_0x5a43('0x9'));var csv=require(_0x5a43('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a43('0xb'));var _=require(_0x5a43('0xc'));var squel=require(_0x5a43('0xd'));var crypto=require(_0x5a43('0xe'));var jsforce=require(_0x5a43('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5a43('0xa'));var querystring=require(_0x5a43('0x10'));var Papa=require(_0x5a43('0x11'));var Redis=require('ioredis');var authService=require(_0x5a43('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5a43('0x13'));var hardwareService=require(_0x5a43('0x14'));var logger=require(_0x5a43('0x15'))(_0x5a43('0x16'));var utils=require(_0x5a43('0x17'));var config=require(_0x5a43('0x18'));var licenseUtil=require(_0x5a43('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x777c3b,_0x44e29b){_0x44e29b=_0x44e29b||0xcc;return function(_0x56d57f){if(_0x56d57f){return _0x777c3b[_0x5a43('0x1a')](_0x44e29b);}return _0x777c3b[_0x5a43('0x1b')](_0x44e29b)[_0x5a43('0x1c')]();};}function respondWithResult(_0x3d2df4,_0x20a342){_0x20a342=_0x20a342||0xc8;return function(_0xe75a82){if(_0xe75a82){return _0x3d2df4[_0x5a43('0x1b')](_0x20a342)[_0x5a43('0x1d')](_0xe75a82);}};}function respondWithFilteredResult(_0xde9574,_0x445f48){return function(_0x29acc3){if(_0x29acc3){var _0x27b2cd=typeof _0x445f48['offset']===_0x5a43('0x1e')&&typeof _0x445f48[_0x5a43('0x1f')]===_0x5a43('0x1e');var _0x1fe606=_0x29acc3[_0x5a43('0x20')];var _0x54543d=_0x27b2cd?0x0:_0x445f48['offset'];var _0x205741=_0x27b2cd?_0x29acc3[_0x5a43('0x20')]:_0x445f48[_0x5a43('0x21')]+_0x445f48[_0x5a43('0x1f')];var _0xd73642;if(_0x205741>=_0x1fe606){_0x205741=_0x1fe606;_0xd73642=0xc8;}else{_0xd73642=0xce;}_0xde9574[_0x5a43('0x1b')](_0xd73642);return _0xde9574[_0x5a43('0x22')](_0x5a43('0x23'),_0x54543d+'-'+_0x205741+'/'+_0x1fe606)[_0x5a43('0x1d')](_0x29acc3);}return null;};}function patchUpdates(_0x78e14){return function(_0x25fdc7){try{jsonpatch['apply'](_0x25fdc7,_0x78e14,!![]);}catch(_0x4f1e90){return BPromise[_0x5a43('0x24')](_0x4f1e90);}return _0x25fdc7[_0x5a43('0x25')]();};}function saveUpdates(_0x4a4bc0,_0x3abee7){return function(_0xf2828e){if(_0xf2828e){return _0xf2828e[_0x5a43('0x26')](_0x4a4bc0)[_0x5a43('0x27')](function(_0x1c2552){return _0x1c2552;});}return null;};}function removeEntity(_0x473d3c,_0x3b9ef6){return function(_0x320ad6){if(_0x320ad6){return _0x320ad6['destroy']()[_0x5a43('0x27')](function(){_0x473d3c['status'](0xcc)[_0x5a43('0x1c')]();});}};}function handleEntityNotFound(_0x43e5a8,_0x1d0934){return function(_0x38aa98){if(!_0x38aa98){_0x43e5a8['sendStatus'](0x194);}return _0x38aa98;};}function handleError(_0x2bdeb3,_0x831710){_0x831710=_0x831710||0x1f4;return function(_0x2fd399){logger[_0x5a43('0x28')](_0x2fd399[_0x5a43('0x29')]);if(_0x2fd399[_0x5a43('0x2a')]){delete _0x2fd399['name'];}_0x2bdeb3[_0x5a43('0x1b')](_0x831710)[_0x5a43('0x2b')](_0x2fd399);};}exports[_0x5a43('0x2c')]=function(_0x57f301,_0x1963c6){var _0x838288={},_0x4dcbb8={},_0x530d7e={'count':0x0,'rows':[]};var _0x3a70f1=_[_0x5a43('0x2d')](db[_0x5a43('0x2e')]['rawAttributes'],function(_0x457a10){return{'name':_0x457a10[_0x5a43('0x2f')],'type':_0x457a10['type'][_0x5a43('0x30')]};});_0x4dcbb8['model']=_[_0x5a43('0x2d')](_0x3a70f1,_0x5a43('0x2a'));_0x4dcbb8[_0x5a43('0x31')]=_[_0x5a43('0x32')](_0x57f301['query']);_0x4dcbb8['filters']=_[_0x5a43('0x33')](_0x4dcbb8[_0x5a43('0x34')],_0x4dcbb8[_0x5a43('0x31')]);_0x838288[_0x5a43('0x35')]=_['intersection'](_0x4dcbb8[_0x5a43('0x34')],qs[_0x5a43('0x36')](_0x57f301[_0x5a43('0x31')][_0x5a43('0x36')]));_0x838288['attributes']=_0x838288[_0x5a43('0x35')][_0x5a43('0x37')]?_0x838288['attributes']:_0x4dcbb8[_0x5a43('0x34')];if(!_0x57f301[_0x5a43('0x31')]['hasOwnProperty'](_0x5a43('0x38'))){_0x838288['limit']=qs['limit'](_0x57f301[_0x5a43('0x31')][_0x5a43('0x1f')]);_0x838288['offset']=qs[_0x5a43('0x21')](_0x57f301[_0x5a43('0x31')][_0x5a43('0x21')]);}_0x838288['order']=qs[_0x5a43('0x39')](_0x57f301[_0x5a43('0x31')][_0x5a43('0x39')]);_0x838288[_0x5a43('0x3a')]=qs[_0x5a43('0x3b')](_[_0x5a43('0x3c')](_0x57f301[_0x5a43('0x31')],_0x4dcbb8['filters']),_0x3a70f1);if(_0x57f301['query']['filter']){_0x838288[_0x5a43('0x3a')]=_[_0x5a43('0x3d')](_0x838288['where'],{'$or':_[_0x5a43('0x2d')](_0x3a70f1,function(_0x2bdaef){if(_0x2bdaef[_0x5a43('0x3e')]!==_0x5a43('0x3f')){var _0x53d2f0={};_0x53d2f0[_0x2bdaef[_0x5a43('0x2a')]]={'$like':'%'+_0x57f301[_0x5a43('0x31')]['filter']+'%'};return _0x53d2f0;}})});}_0x838288=_[_0x5a43('0x3d')]({},_0x838288,_0x57f301[_0x5a43('0x40')]);var _0x3fdf2a={'where':_0x838288[_0x5a43('0x3a')]};return db[_0x5a43('0x2e')][_0x5a43('0x20')](_0x3fdf2a)['then'](function(_0x35a91a){_0x530d7e[_0x5a43('0x20')]=_0x35a91a;if(_0x57f301['query'][_0x5a43('0x41')]){_0x838288[_0x5a43('0x42')]=[{'all':!![]}];}return db[_0x5a43('0x2e')][_0x5a43('0x43')](_0x838288);})[_0x5a43('0x27')](function(_0x1ec1ec){_0x530d7e[_0x5a43('0x44')]=_0x1ec1ec;return _0x530d7e;})[_0x5a43('0x27')](respondWithFilteredResult(_0x1963c6,_0x838288))['catch'](handleError(_0x1963c6,null));};exports['show']=function(_0x24cdcd,_0x1b0351){var _0x3b8602={'raw':![],'where':{'id':_0x24cdcd[_0x5a43('0x45')]['id']}},_0xeb6ab8={};_0xeb6ab8[_0x5a43('0x34')]=_[_0x5a43('0x32')](db[_0x5a43('0x2e')]['rawAttributes']);_0xeb6ab8[_0x5a43('0x31')]=_['keys'](_0x24cdcd[_0x5a43('0x31')]);_0xeb6ab8[_0x5a43('0x3b')]=_['intersection'](_0xeb6ab8[_0x5a43('0x34')],_0xeb6ab8[_0x5a43('0x31')]);_0x3b8602[_0x5a43('0x35')]=_['intersection'](_0xeb6ab8[_0x5a43('0x34')],qs['fields'](_0x24cdcd['query'][_0x5a43('0x36')]));_0x3b8602['attributes']=_0x3b8602[_0x5a43('0x35')]['length']?_0x3b8602[_0x5a43('0x35')]:_0xeb6ab8[_0x5a43('0x34')];if(_0x24cdcd[_0x5a43('0x31')][_0x5a43('0x41')]){_0x3b8602[_0x5a43('0x42')]=[{'all':!![]}];}_0x3b8602=_[_0x5a43('0x3d')]({},_0x3b8602,_0x24cdcd[_0x5a43('0x40')]);return db[_0x5a43('0x2e')][_0x5a43('0x46')](_0x3b8602)[_0x5a43('0x27')](handleEntityNotFound(_0x1b0351,null))[_0x5a43('0x27')](respondWithResult(_0x1b0351,null))[_0x5a43('0x47')](handleError(_0x1b0351,null));};exports['create']=function(_0x2a2068,_0x3ce6e8){return db[_0x5a43('0x2e')][_0x5a43('0x48')](_0x2a2068[_0x5a43('0x49')],{})['then'](respondWithResult(_0x3ce6e8,0xc9))[_0x5a43('0x47')](handleError(_0x3ce6e8,null));};exports[_0x5a43('0x26')]=function(_0x2e608a,_0x3602d9){if(_0x2e608a[_0x5a43('0x49')]['id']){delete _0x2e608a['body']['id'];}return db[_0x5a43('0x2e')][_0x5a43('0x46')]({'where':{'id':_0x2e608a[_0x5a43('0x45')]['id']}})[_0x5a43('0x27')](handleEntityNotFound(_0x3602d9,null))['then'](saveUpdates(_0x2e608a['body'],null))['then'](respondWithResult(_0x3602d9,null))['catch'](handleError(_0x3602d9,null));};exports[_0x5a43('0x4a')]=function(_0x43c07f,_0x3495b4){return db[_0x5a43('0x2e')]['find']({'where':{'id':_0x43c07f['params']['id']}})[_0x5a43('0x27')](handleEntityNotFound(_0x3495b4,null))[_0x5a43('0x27')](removeEntity(_0x3495b4,null))['catch'](handleError(_0x3495b4,null));};exports[_0x5a43('0x4b')]=function(_0x34edb1,_0x290f81,_0x5df7f1){var _0x455eb8={};var _0x262cbc={};var _0x3816fc;var _0x5b2c40;return db[_0x5a43('0x2e')][_0x5a43('0x4c')]({'where':{'id':_0x34edb1[_0x5a43('0x45')]['id']}})[_0x5a43('0x27')](handleEntityNotFound(_0x290f81,null))['then'](function(_0x3001e9){if(_0x3001e9){_0x3816fc=_0x3001e9;_0x262cbc[_0x5a43('0x34')]=_[_0x5a43('0x32')](db[_0x5a43('0x4d')]['rawAttributes']);_0x262cbc[_0x5a43('0x31')]=_[_0x5a43('0x32')](_0x34edb1[_0x5a43('0x31')]);_0x262cbc['filters']=_[_0x5a43('0x33')](_0x262cbc[_0x5a43('0x34')],_0x262cbc[_0x5a43('0x31')]);_0x455eb8['attributes']=_[_0x5a43('0x33')](_0x262cbc[_0x5a43('0x34')],qs['fields'](_0x34edb1[_0x5a43('0x31')][_0x5a43('0x36')]));_0x455eb8[_0x5a43('0x35')]=_0x455eb8[_0x5a43('0x35')]['length']?_0x455eb8[_0x5a43('0x35')]:_0x262cbc['model'];_0x455eb8['order']=qs[_0x5a43('0x39')](_0x34edb1['query'][_0x5a43('0x39')]);_0x455eb8[_0x5a43('0x3a')]=qs['filters'](_['pick'](_0x34edb1[_0x5a43('0x31')],_0x262cbc[_0x5a43('0x3b')]));if(_0x34edb1[_0x5a43('0x31')]['filter']){_0x455eb8[_0x5a43('0x3a')]=_[_0x5a43('0x3d')](_0x455eb8[_0x5a43('0x3a')],{'$or':_[_0x5a43('0x2d')](_0x455eb8[_0x5a43('0x35')],function(_0x44d5fb){var _0x5cc349={};_0x5cc349[_0x44d5fb]={'$like':'%'+_0x34edb1[_0x5a43('0x31')][_0x5a43('0x4e')]+'%'};return _0x5cc349;})});}_0x455eb8=_[_0x5a43('0x3d')]({},_0x455eb8,_0x34edb1[_0x5a43('0x40')]);return _0x3816fc[_0x5a43('0x4b')](_0x455eb8);}})[_0x5a43('0x27')](function(_0x4d4e8d){if(_0x4d4e8d){_0x5b2c40=_0x4d4e8d[_0x5a43('0x37')];if(!_0x34edb1[_0x5a43('0x31')][_0x5a43('0x4f')](_0x5a43('0x38'))){_0x455eb8[_0x5a43('0x1f')]=qs[_0x5a43('0x1f')](_0x34edb1[_0x5a43('0x31')][_0x5a43('0x1f')]);_0x455eb8[_0x5a43('0x21')]=qs[_0x5a43('0x21')](_0x34edb1['query'][_0x5a43('0x21')]);}return _0x3816fc[_0x5a43('0x4b')](_0x455eb8);}})[_0x5a43('0x27')](function(_0x26ec63){if(_0x26ec63){return _0x26ec63?{'count':_0x5b2c40,'rows':_0x26ec63}:null;}})['then'](respondWithResult(_0x290f81,null))[_0x5a43('0x47')](handleError(_0x290f81,null));};exports[_0x5a43('0x50')]=function(_0x15e96a,_0x46efb1,_0x4d2a74){var _0x1f1e25={};var _0x4dd74b={};var _0x53c843;var _0x12af5d;return db['ServicenowConfiguration'][_0x5a43('0x4c')]({'where':{'id':_0x15e96a[_0x5a43('0x45')]['id']}})['then'](handleEntityNotFound(_0x46efb1,null))['then'](function(_0x4c61e2){if(_0x4c61e2){_0x53c843=_0x4c61e2;_0x4dd74b[_0x5a43('0x34')]=_[_0x5a43('0x32')](db[_0x5a43('0x4d')][_0x5a43('0x51')]);_0x4dd74b['query']=_['keys'](_0x15e96a[_0x5a43('0x31')]);_0x4dd74b[_0x5a43('0x3b')]=_['intersection'](_0x4dd74b[_0x5a43('0x34')],_0x4dd74b[_0x5a43('0x31')]);_0x1f1e25[_0x5a43('0x35')]=_[_0x5a43('0x33')](_0x4dd74b[_0x5a43('0x34')],qs[_0x5a43('0x36')](_0x15e96a[_0x5a43('0x31')]['fields']));_0x1f1e25[_0x5a43('0x35')]=_0x1f1e25[_0x5a43('0x35')][_0x5a43('0x37')]?_0x1f1e25['attributes']:_0x4dd74b[_0x5a43('0x34')];_0x1f1e25[_0x5a43('0x52')]=qs[_0x5a43('0x39')](_0x15e96a[_0x5a43('0x31')][_0x5a43('0x39')]);_0x1f1e25['where']=qs[_0x5a43('0x3b')](_['pick'](_0x15e96a[_0x5a43('0x31')],_0x4dd74b[_0x5a43('0x3b')]));if(_0x15e96a[_0x5a43('0x31')]['filter']){_0x1f1e25[_0x5a43('0x3a')]=_[_0x5a43('0x3d')](_0x1f1e25[_0x5a43('0x3a')],{'$or':_['map'](_0x1f1e25[_0x5a43('0x35')],function(_0x483dc5){var _0x3dd0ae={};_0x3dd0ae[_0x483dc5]={'$like':'%'+_0x15e96a[_0x5a43('0x31')]['filter']+'%'};return _0x3dd0ae;})});}_0x1f1e25=_['merge']({},_0x1f1e25,_0x15e96a[_0x5a43('0x40')]);return _0x53c843[_0x5a43('0x50')](_0x1f1e25);}})[_0x5a43('0x27')](function(_0x3d5293){if(_0x3d5293){_0x12af5d=_0x3d5293['length'];if(!_0x15e96a[_0x5a43('0x31')][_0x5a43('0x4f')](_0x5a43('0x38'))){_0x1f1e25[_0x5a43('0x1f')]=qs[_0x5a43('0x1f')](_0x15e96a[_0x5a43('0x31')][_0x5a43('0x1f')]);_0x1f1e25['offset']=qs[_0x5a43('0x21')](_0x15e96a[_0x5a43('0x31')][_0x5a43('0x21')]);}return _0x53c843[_0x5a43('0x50')](_0x1f1e25);}})['then'](function(_0x26d87a){if(_0x26d87a){return _0x26d87a?{'count':_0x12af5d,'rows':_0x26d87a}:null;}})[_0x5a43('0x27')](respondWithResult(_0x46efb1,null))['catch'](handleError(_0x46efb1,null));};exports[_0x5a43('0x53')]=function(_0x3120a4,_0x2ba2f1,_0x3979f6){var _0x563ab7={};var _0x5bfc03={};var _0x4c1a74;var _0x3c0980;return db['ServicenowConfiguration'][_0x5a43('0x4c')]({'where':{'id':_0x3120a4[_0x5a43('0x45')]['id']}})['then'](handleEntityNotFound(_0x2ba2f1,null))[_0x5a43('0x27')](function(_0x2ec1cf){if(_0x2ec1cf){_0x4c1a74=_0x2ec1cf;_0x5bfc03[_0x5a43('0x34')]=_[_0x5a43('0x32')](db[_0x5a43('0x4d')]['rawAttributes']);_0x5bfc03[_0x5a43('0x31')]=_[_0x5a43('0x32')](_0x3120a4[_0x5a43('0x31')]);_0x5bfc03[_0x5a43('0x3b')]=_[_0x5a43('0x33')](_0x5bfc03[_0x5a43('0x34')],_0x5bfc03[_0x5a43('0x31')]);_0x563ab7[_0x5a43('0x35')]=_[_0x5a43('0x33')](_0x5bfc03['model'],qs['fields'](_0x3120a4[_0x5a43('0x31')][_0x5a43('0x36')]));_0x563ab7[_0x5a43('0x35')]=_0x563ab7[_0x5a43('0x35')][_0x5a43('0x37')]?_0x563ab7[_0x5a43('0x35')]:_0x5bfc03[_0x5a43('0x34')];_0x563ab7[_0x5a43('0x52')]=qs['sort'](_0x3120a4['query'][_0x5a43('0x39')]);_0x563ab7[_0x5a43('0x3a')]=qs[_0x5a43('0x3b')](_['pick'](_0x3120a4['query'],_0x5bfc03['filters']));if(_0x3120a4[_0x5a43('0x31')]['filter']){_0x563ab7[_0x5a43('0x3a')]=_[_0x5a43('0x3d')](_0x563ab7[_0x5a43('0x3a')],{'$or':_[_0x5a43('0x2d')](_0x563ab7[_0x5a43('0x35')],function(_0x372cd5){var _0x36bf5a={};_0x36bf5a[_0x372cd5]={'$like':'%'+_0x3120a4[_0x5a43('0x31')][_0x5a43('0x4e')]+'%'};return _0x36bf5a;})});}_0x563ab7=_[_0x5a43('0x3d')]({},_0x563ab7,_0x3120a4[_0x5a43('0x40')]);return _0x4c1a74[_0x5a43('0x53')](_0x563ab7);}})[_0x5a43('0x27')](function(_0x5130dd){if(_0x5130dd){_0x3c0980=_0x5130dd[_0x5a43('0x37')];if(!_0x3120a4['query']['hasOwnProperty'](_0x5a43('0x38'))){_0x563ab7[_0x5a43('0x1f')]=qs[_0x5a43('0x1f')](_0x3120a4['query'][_0x5a43('0x1f')]);_0x563ab7[_0x5a43('0x21')]=qs[_0x5a43('0x21')](_0x3120a4['query'][_0x5a43('0x21')]);}return _0x4c1a74[_0x5a43('0x53')](_0x563ab7);}})[_0x5a43('0x27')](function(_0x1a952e){if(_0x1a952e){return _0x1a952e?{'count':_0x3c0980,'rows':_0x1a952e}:null;}})['then'](respondWithResult(_0x2ba2f1,null))['catch'](handleError(_0x2ba2f1,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 406b73f..3e32305 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 _0x2868=['path','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','lodash','../../config/logger','api','bluebird'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x2868,0x191));var _0x8286=function(_0x118626,_0x47f2b3){_0x118626=_0x118626-0x0;var _0x3521c1=_0x2868[_0x118626];return _0x3521c1;};'use strict';var _=require(_0x8286('0x0'));var util=require('util');var logger=require(_0x8286('0x1'))(_0x8286('0x2'));var moment=require('moment');var BPromise=require(_0x8286('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8286('0x4'));var rimraf=require('rimraf');var config=require(_0x8286('0x5'));var attributes=require(_0x8286('0x6'));module['exports']=function(_0xa1b0f9,_0x9a8dcd){return _0xa1b0f9[_0x8286('0x7')](_0x8286('0x8'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebcd=['lodash','../../config/logger','bluebird','path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations'];(function(_0x1c871e,_0x3d8a86){var _0x114cd8=function(_0x35c493){while(--_0x35c493){_0x1c871e['push'](_0x1c871e['shift']());}};_0x114cd8(++_0x3d8a86);}(_0xebcd,0x18c));var _0xdebc=function(_0x509273,_0x13fc9f){_0x509273=_0x509273-0x0;var _0x38ef40=_0xebcd[_0x509273];return _0x38ef40;};'use strict';var _=require(_0xdebc('0x0'));var util=require('util');var logger=require(_0xdebc('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdebc('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdebc('0x3'));var rimraf=require('rimraf');var config=require(_0xdebc('0x4'));var attributes=require(_0xdebc('0x5'));module[_0xdebc('0x6')]=function(_0xa8e1d3,_0x1e5295){return _0xa8e1d3[_0xdebc('0x7')]('ServicenowConfiguration',attributes,{'tableName':_0xdebc('0x8'),'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 c745206..f35409e 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 _0xef8c=['../../config/environment','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3eb671,_0x1f2c1d){var _0x41eac5=function(_0x39eb80){while(--_0x39eb80){_0x3eb671['push'](_0x3eb671['shift']());}};_0x41eac5(++_0x1f2c1d);}(_0xef8c,0x1a7));var _0xcef8=function(_0x57a6ce,_0x3d7316){_0x57a6ce=_0x57a6ce-0x0;var _0x38de7e=_0xef8c[_0x57a6ce];return _0x38de7e;};'use strict';var _=require(_0xcef8('0x0'));var util=require(_0xcef8('0x1'));var moment=require(_0xcef8('0x2'));var BPromise=require(_0xcef8('0x3'));var rs=require(_0xcef8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcef8('0x5'))['db'];var utils=require(_0xcef8('0x6'));var logger=require(_0xcef8('0x7'))(_0xcef8('0x8'));var config=require(_0xcef8('0x9'));var jayson=require(_0xcef8('0xa'));var client=jayson[_0xcef8('0xb')][_0xcef8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x811e5b,_0x1cb2af,_0x5f510b){return new BPromise(function(_0xe97bc8,_0x5e5300){return client['request'](_0x811e5b,_0x5f510b)[_0xcef8('0xd')](function(_0x2c8fd8){logger[_0xcef8('0xe')](_0xcef8('0xf'),_0x1cb2af,_0xcef8('0x10'));logger[_0xcef8('0x11')](_0xcef8('0x12'),_0x1cb2af,_0xcef8('0x10'),JSON[_0xcef8('0x13')](_0x2c8fd8));if(_0x2c8fd8['error']){if(_0x2c8fd8[_0xcef8('0x14')][_0xcef8('0x15')]===0x1f4){logger[_0xcef8('0x14')](_0xcef8('0xf'),_0x1cb2af,_0x2c8fd8['error'][_0xcef8('0x16')]);return _0x5e5300(_0x2c8fd8[_0xcef8('0x14')]['message']);}logger[_0xcef8('0x14')](_0xcef8('0xf'),_0x1cb2af,_0x2c8fd8[_0xcef8('0x14')][_0xcef8('0x16')]);return _0xe97bc8(_0x2c8fd8['error'][_0xcef8('0x16')]);}else{logger[_0xcef8('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1cb2af,'request\x20sent');_0xe97bc8(_0x2c8fd8[_0xcef8('0x17')][_0xcef8('0x16')]);}})['catch'](function(_0x227230){logger['error'](_0xcef8('0xf'),_0x1cb2af,_0x227230);_0x5e5300(_0x227230);});});} \ No newline at end of file +var _0x0880=['randomstring','../../config/logger','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0880,0x7c));var _0x0088=function(_0x91384,_0x545eef){_0x91384=_0x91384-0x0;var _0x44daa0=_0x0880[_0x91384];return _0x44daa0;};'use strict';var _=require(_0x0088('0x0'));var util=require('util');var moment=require(_0x0088('0x1'));var BPromise=require('bluebird');var rs=require(_0x0088('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0088('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf1bb1a,_0x2d22cb,_0xfb40d6){return new BPromise(function(_0x1de697,_0x202b92){return client['request'](_0xf1bb1a,_0xfb40d6)[_0x0088('0x4')](function(_0x30201b){logger['info'](_0x0088('0x5'),_0x2d22cb,_0x0088('0x6'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x2d22cb,_0x0088('0x6'),JSON[_0x0088('0x7')](_0x30201b));if(_0x30201b[_0x0088('0x8')]){if(_0x30201b[_0x0088('0x8')][_0x0088('0x9')]===0x1f4){logger[_0x0088('0x8')](_0x0088('0x5'),_0x2d22cb,_0x30201b[_0x0088('0x8')][_0x0088('0xa')]);return _0x202b92(_0x30201b[_0x0088('0x8')][_0x0088('0xa')]);}logger[_0x0088('0x8')](_0x0088('0x5'),_0x2d22cb,_0x30201b[_0x0088('0x8')][_0x0088('0xa')]);return _0x1de697(_0x30201b[_0x0088('0x8')][_0x0088('0xa')]);}else{logger[_0x0088('0xb')](_0x0088('0x5'),_0x2d22cb,'request\x20sent');_0x1de697(_0x30201b[_0x0088('0xc')]['message']);}})[_0x0088('0xd')](function(_0x5aed42){logger[_0x0088('0x8')](_0x0088('0x5'),_0x2d22cb,_0x5aed42);_0x202b92(_0x5aed42);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index fb847fa..45d9135 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 _0x6e91=['util','path','express','Router','../../config/environment','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer'];(function(_0x59b8ea,_0x311f9a){var _0x5c1c55=function(_0x5109ae){while(--_0x5109ae){_0x59b8ea['push'](_0x59b8ea['shift']());}};_0x5c1c55(++_0x311f9a);}(_0x6e91,0xff));var _0x16e9=function(_0x331f7e,_0xa66d77){_0x331f7e=_0x331f7e-0x0;var _0x2c82b7=_0x6e91[_0x331f7e];return _0x2c82b7;};'use strict';var multer=require(_0x16e9('0x0'));var util=require(_0x16e9('0x1'));var path=require(_0x16e9('0x2'));var timeout=require('connect-timeout');var express=require(_0x16e9('0x3'));var router=express[_0x16e9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x16e9('0x5'));var controller=require('./intServicenowField.controller');router[_0x16e9('0x6')]('/',auth[_0x16e9('0x7')](),controller[_0x16e9('0x8')]);router['get'](_0x16e9('0x9'),auth[_0x16e9('0x7')](),controller['show']);router['post']('/',auth[_0x16e9('0x7')](),controller[_0x16e9('0xa')]);router[_0x16e9('0xb')](_0x16e9('0x9'),auth[_0x16e9('0x7')](),controller[_0x16e9('0xc')]);router[_0x16e9('0xd')](_0x16e9('0x9'),auth[_0x16e9('0x7')](),controller[_0x16e9('0xe')]);module[_0x16e9('0xf')]=router; \ No newline at end of file +var _0x7d9c=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports'];(function(_0x1ab929,_0x2b1676){var _0x3424a9=function(_0x2212ab){while(--_0x2212ab){_0x1ab929['push'](_0x1ab929['shift']());}};_0x3424a9(++_0x2b1676);}(_0x7d9c,0xbd));var _0xc7d9=function(_0x42715a,_0x199185){_0x42715a=_0x42715a-0x0;var _0x3803db=_0x7d9c[_0x42715a];return _0x3803db;};'use strict';var multer=require(_0xc7d9('0x0'));var util=require(_0xc7d9('0x1'));var path=require(_0xc7d9('0x2'));var timeout=require(_0xc7d9('0x3'));var express=require(_0xc7d9('0x4'));var router=express['Router']();var fs_extra=require(_0xc7d9('0x5'));var auth=require(_0xc7d9('0x6'));var interaction=require(_0xc7d9('0x7'));var config=require(_0xc7d9('0x8'));var controller=require(_0xc7d9('0x9'));router[_0xc7d9('0xa')]('/',auth[_0xc7d9('0xb')](),controller[_0xc7d9('0xc')]);router[_0xc7d9('0xa')]('/:id',auth[_0xc7d9('0xb')](),controller[_0xc7d9('0xd')]);router[_0xc7d9('0xe')]('/',auth[_0xc7d9('0xb')](),controller[_0xc7d9('0xf')]);router['put'](_0xc7d9('0x10'),auth[_0xc7d9('0xb')](),controller[_0xc7d9('0x11')]);router[_0xc7d9('0x12')](_0xc7d9('0x10'),auth[_0xc7d9('0xb')](),controller[_0xc7d9('0x13')]);module[_0xc7d9('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index e577287..a9315cf 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 _0x1603=['exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1603,0x170));var _0x3160=function(_0x828160,_0x26d5be){_0x828160=_0x828160-0x0;var _0x296b5f=_0x1603[_0x828160];return _0x296b5f;};'use strict';var Sequelize=require('sequelize');module[_0x3160('0x0')]={'type':{'type':Sequelize[_0x3160('0x1')](_0x3160('0x2'),'variable',_0x3160('0x3'),_0x3160('0x4'),_0x3160('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3160('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3160('0x1')](_0x3160('0x2'),_0x3160('0x7'),_0x3160('0x3'))},'keyContent':{'type':Sequelize[_0x3160('0x6')]},'idField':{'type':Sequelize[_0x3160('0x6')]},'nameField':{'type':Sequelize[_0x3160('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x86cd=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x87fdd5,_0x3095fc){var _0x18c8e3=function(_0x3ee616){while(--_0x3ee616){_0x87fdd5['push'](_0x87fdd5['shift']());}};_0x18c8e3(++_0x3095fc);}(_0x86cd,0xf3));var _0xd86c=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x86cd[_0xabbd2f];return _0x34a040;};'use strict';var Sequelize=require(_0xd86c('0x0'));module[_0xd86c('0x1')]={'type':{'type':Sequelize[_0xd86c('0x2')]('string',_0xd86c('0x3'),_0xd86c('0x4'),_0xd86c('0x5'),_0xd86c('0x6')),'defaultValue':_0xd86c('0x7')},'content':{'type':Sequelize[_0xd86c('0x8')]},'key':{'type':Sequelize[_0xd86c('0x8')]},'keyType':{'type':Sequelize[_0xd86c('0x2')](_0xd86c('0x7'),_0xd86c('0x3'),_0xd86c('0x4'))},'keyContent':{'type':Sequelize[_0xd86c('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd86c('0x8')]},'customField':{'type':Sequelize[_0xd86c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd86c('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index a0552c3..ac81f51 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 _0xcd52=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','save','update','then','error','name','send','ServicenowField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','catch','params','rawAttributes','includeAll','include','options','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4f6f75,_0x5ea681){var _0x54b6f7=function(_0x45e009){while(--_0x45e009){_0x4f6f75['push'](_0x4f6f75['shift']());}};_0x54b6f7(++_0x5ea681);}(_0xcd52,0x16d));var _0x2cd5=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xcd52[_0x4a747d];return _0x3a5b5c;};'use strict';var emlformat=require(_0x2cd5('0x0'));var rimraf=require(_0x2cd5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2cd5('0x2'));var rp=require(_0x2cd5('0x3'));var moment=require(_0x2cd5('0x4'));var BPromise=require(_0x2cd5('0x5'));var Mustache=require(_0x2cd5('0x6'));var util=require(_0x2cd5('0x7'));var path=require(_0x2cd5('0x8'));var sox=require(_0x2cd5('0x9'));var csv=require(_0x2cd5('0xa'));var ejs=require(_0x2cd5('0xb'));var fs=require('fs');var fs_extra=require(_0x2cd5('0xc'));var _=require('lodash');var squel=require(_0x2cd5('0xd'));var crypto=require('crypto');var jsforce=require(_0x2cd5('0xe'));var deskjs=require(_0x2cd5('0xf'));var toCsv=require(_0x2cd5('0xa'));var querystring=require(_0x2cd5('0x10'));var Papa=require(_0x2cd5('0x11'));var Redis=require(_0x2cd5('0x12'));var authService=require(_0x2cd5('0x13'));var qs=require(_0x2cd5('0x14'));var as=require(_0x2cd5('0x15'));var hardwareService=require(_0x2cd5('0x16'));var logger=require(_0x2cd5('0x17'))(_0x2cd5('0x18'));var utils=require('../../config/utils');var config=require(_0x2cd5('0x19'));var licenseUtil=require(_0x2cd5('0x1a'));var db=require(_0x2cd5('0x1b'))['db'];function respondWithStatusCode(_0x11ecd0,_0x395de2){_0x395de2=_0x395de2||0xcc;return function(_0x259643){if(_0x259643){return _0x11ecd0[_0x2cd5('0x1c')](_0x395de2);}return _0x11ecd0['status'](_0x395de2)[_0x2cd5('0x1d')]();};}function respondWithResult(_0x3942cd,_0x5f5897){_0x5f5897=_0x5f5897||0xc8;return function(_0x1b6f04){if(_0x1b6f04){return _0x3942cd[_0x2cd5('0x1e')](_0x5f5897)['json'](_0x1b6f04);}};}function respondWithFilteredResult(_0x52f329,_0x39c21c){return function(_0x1f1bde){if(_0x1f1bde){var _0x44e7e7=typeof _0x39c21c[_0x2cd5('0x1f')]===_0x2cd5('0x20')&&typeof _0x39c21c[_0x2cd5('0x21')]==='undefined';var _0x358ada=_0x1f1bde[_0x2cd5('0x22')];var _0x8a0af9=_0x44e7e7?0x0:_0x39c21c[_0x2cd5('0x1f')];var _0x256656=_0x44e7e7?_0x1f1bde[_0x2cd5('0x22')]:_0x39c21c[_0x2cd5('0x1f')]+_0x39c21c[_0x2cd5('0x21')];var _0x94a701;if(_0x256656>=_0x358ada){_0x256656=_0x358ada;_0x94a701=0xc8;}else{_0x94a701=0xce;}_0x52f329[_0x2cd5('0x1e')](_0x94a701);return _0x52f329['set']('Content-Range',_0x8a0af9+'-'+_0x256656+'/'+_0x358ada)[_0x2cd5('0x23')](_0x1f1bde);}return null;};}function patchUpdates(_0x92a651){return function(_0x1dfcd0){try{jsonpatch[_0x2cd5('0x24')](_0x1dfcd0,_0x92a651,!![]);}catch(_0x31d1ed){return BPromise[_0x2cd5('0x25')](_0x31d1ed);}return _0x1dfcd0[_0x2cd5('0x26')]();};}function saveUpdates(_0x95780c,_0x57e161){return function(_0x2fafd8){if(_0x2fafd8){return _0x2fafd8[_0x2cd5('0x27')](_0x95780c)[_0x2cd5('0x28')](function(_0x37a4e4){return _0x37a4e4;});}return null;};}function removeEntity(_0x21ad19,_0x30c0b0){return function(_0xd81425){if(_0xd81425){return _0xd81425['destroy']()[_0x2cd5('0x28')](function(){_0x21ad19['status'](0xcc)[_0x2cd5('0x1d')]();});}};}function handleEntityNotFound(_0x3d2655,_0x47c0f0){return function(_0x21febd){if(!_0x21febd){_0x3d2655[_0x2cd5('0x1c')](0x194);}return _0x21febd;};}function handleError(_0x53e658,_0x4755c8){_0x4755c8=_0x4755c8||0x1f4;return function(_0x3846fb){logger[_0x2cd5('0x29')](_0x3846fb['stack']);if(_0x3846fb['name']){delete _0x3846fb[_0x2cd5('0x2a')];}_0x53e658[_0x2cd5('0x1e')](_0x4755c8)[_0x2cd5('0x2b')](_0x3846fb);};}exports['index']=function(_0x42fe78,_0x5cf906){var _0x37c539={},_0x10e33b={},_0x40cad2={'count':0x0,'rows':[]};var _0x467d3a=_['map'](db[_0x2cd5('0x2c')]['rawAttributes'],function(_0x59da82){return{'name':_0x59da82[_0x2cd5('0x2d')],'type':_0x59da82[_0x2cd5('0x2e')][_0x2cd5('0x2f')]};});_0x10e33b[_0x2cd5('0x30')]=_[_0x2cd5('0x31')](_0x467d3a,_0x2cd5('0x2a'));_0x10e33b[_0x2cd5('0x32')]=_[_0x2cd5('0x33')](_0x42fe78['query']);_0x10e33b[_0x2cd5('0x34')]=_[_0x2cd5('0x35')](_0x10e33b['model'],_0x10e33b[_0x2cd5('0x32')]);_0x37c539[_0x2cd5('0x36')]=_[_0x2cd5('0x35')](_0x10e33b[_0x2cd5('0x30')],qs[_0x2cd5('0x37')](_0x42fe78[_0x2cd5('0x32')][_0x2cd5('0x37')]));_0x37c539[_0x2cd5('0x36')]=_0x37c539['attributes'][_0x2cd5('0x38')]?_0x37c539[_0x2cd5('0x36')]:_0x10e33b['model'];if(!_0x42fe78[_0x2cd5('0x32')][_0x2cd5('0x39')](_0x2cd5('0x3a'))){_0x37c539[_0x2cd5('0x21')]=qs[_0x2cd5('0x21')](_0x42fe78['query'][_0x2cd5('0x21')]);_0x37c539[_0x2cd5('0x1f')]=qs['offset'](_0x42fe78['query'][_0x2cd5('0x1f')]);}_0x37c539[_0x2cd5('0x3b')]=qs['sort'](_0x42fe78['query'][_0x2cd5('0x3c')]);_0x37c539[_0x2cd5('0x3d')]=qs[_0x2cd5('0x34')](_[_0x2cd5('0x3e')](_0x42fe78[_0x2cd5('0x32')],_0x10e33b['filters']),_0x467d3a);if(_0x42fe78[_0x2cd5('0x32')][_0x2cd5('0x3f')]){_0x37c539[_0x2cd5('0x3d')]=_[_0x2cd5('0x40')](_0x37c539[_0x2cd5('0x3d')],{'$or':_[_0x2cd5('0x31')](_0x467d3a,function(_0x47329e){if(_0x47329e[_0x2cd5('0x2e')]!==_0x2cd5('0x41')){var _0x4767d0={};_0x4767d0[_0x47329e[_0x2cd5('0x2a')]]={'$like':'%'+_0x42fe78[_0x2cd5('0x32')]['filter']+'%'};return _0x4767d0;}})});}_0x37c539=_[_0x2cd5('0x40')]({},_0x37c539,_0x42fe78['options']);var _0xdfd4ef={'where':_0x37c539[_0x2cd5('0x3d')]};return db[_0x2cd5('0x2c')][_0x2cd5('0x22')](_0xdfd4ef)[_0x2cd5('0x28')](function(_0x1aaec2){_0x40cad2[_0x2cd5('0x22')]=_0x1aaec2;if(_0x42fe78[_0x2cd5('0x32')]['includeAll']){_0x37c539['include']=[{'all':!![]}];}return db[_0x2cd5('0x2c')][_0x2cd5('0x42')](_0x37c539);})['then'](function(_0xe7d37c){_0x40cad2['rows']=_0xe7d37c;return _0x40cad2;})[_0x2cd5('0x28')](respondWithFilteredResult(_0x5cf906,_0x37c539))[_0x2cd5('0x43')](handleError(_0x5cf906,null));};exports['show']=function(_0x5f4f73,_0x3d5240){var _0x516ee4={'raw':!![],'where':{'id':_0x5f4f73[_0x2cd5('0x44')]['id']}},_0x51c7d4={};_0x51c7d4[_0x2cd5('0x30')]=_[_0x2cd5('0x33')](db[_0x2cd5('0x2c')][_0x2cd5('0x45')]);_0x51c7d4[_0x2cd5('0x32')]=_['keys'](_0x5f4f73[_0x2cd5('0x32')]);_0x51c7d4[_0x2cd5('0x34')]=_[_0x2cd5('0x35')](_0x51c7d4[_0x2cd5('0x30')],_0x51c7d4[_0x2cd5('0x32')]);_0x516ee4['attributes']=_['intersection'](_0x51c7d4['model'],qs[_0x2cd5('0x37')](_0x5f4f73[_0x2cd5('0x32')][_0x2cd5('0x37')]));_0x516ee4[_0x2cd5('0x36')]=_0x516ee4[_0x2cd5('0x36')][_0x2cd5('0x38')]?_0x516ee4[_0x2cd5('0x36')]:_0x51c7d4[_0x2cd5('0x30')];if(_0x5f4f73[_0x2cd5('0x32')][_0x2cd5('0x46')]){_0x516ee4[_0x2cd5('0x47')]=[{'all':!![]}];}_0x516ee4=_[_0x2cd5('0x40')]({},_0x516ee4,_0x5f4f73[_0x2cd5('0x48')]);return db[_0x2cd5('0x2c')][_0x2cd5('0x49')](_0x516ee4)[_0x2cd5('0x28')](handleEntityNotFound(_0x3d5240,null))[_0x2cd5('0x28')](respondWithResult(_0x3d5240,null))['catch'](handleError(_0x3d5240,null));};exports[_0x2cd5('0x4a')]=function(_0x4db7b2,_0x2343ac){return db['ServicenowField']['create'](_0x4db7b2[_0x2cd5('0x4b')],{})[_0x2cd5('0x28')](respondWithResult(_0x2343ac,0xc9))[_0x2cd5('0x43')](handleError(_0x2343ac,null));};exports[_0x2cd5('0x27')]=function(_0x54c95a,_0x43a7e9){if(_0x54c95a[_0x2cd5('0x4b')]['id']){delete _0x54c95a[_0x2cd5('0x4b')]['id'];}return db[_0x2cd5('0x2c')]['find']({'where':{'id':_0x54c95a[_0x2cd5('0x44')]['id']}})[_0x2cd5('0x28')](handleEntityNotFound(_0x43a7e9,null))['then'](saveUpdates(_0x54c95a[_0x2cd5('0x4b')],null))[_0x2cd5('0x28')](respondWithResult(_0x43a7e9,null))[_0x2cd5('0x43')](handleError(_0x43a7e9,null));};exports[_0x2cd5('0x4c')]=function(_0x3be158,_0xaa7c3f){return db[_0x2cd5('0x2c')][_0x2cd5('0x49')]({'where':{'id':_0x3be158[_0x2cd5('0x44')]['id']}})['then'](handleEntityNotFound(_0xaa7c3f,null))[_0x2cd5('0x28')](removeEntity(_0xaa7c3f,null))[_0x2cd5('0x43')](handleError(_0xaa7c3f,null));}; \ No newline at end of file +var _0x3b4e=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','ServicenowField','fieldName','type','key','keys','filters','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','length','create','body','find','rimraf'];(function(_0x3898d5,_0x2ba7a5){var _0x44c865=function(_0xf7fdd2){while(--_0xf7fdd2){_0x3898d5['push'](_0x3898d5['shift']());}};_0x44c865(++_0x2ba7a5);}(_0x3b4e,0xe3));var _0xe3b4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b4e[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe3b4('0x0'));var zipdir=require(_0xe3b4('0x1'));var jsonpatch=require(_0xe3b4('0x2'));var rp=require(_0xe3b4('0x3'));var moment=require(_0xe3b4('0x4'));var BPromise=require(_0xe3b4('0x5'));var Mustache=require(_0xe3b4('0x6'));var util=require('util');var path=require(_0xe3b4('0x7'));var sox=require(_0xe3b4('0x8'));var csv=require(_0xe3b4('0x9'));var ejs=require(_0xe3b4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe3b4('0xb'));var squel=require(_0xe3b4('0xc'));var crypto=require(_0xe3b4('0xd'));var jsforce=require(_0xe3b4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe3b4('0x9'));var querystring=require(_0xe3b4('0xf'));var Papa=require(_0xe3b4('0x10'));var Redis=require(_0xe3b4('0x11'));var authService=require(_0xe3b4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe3b4('0x13'));var hardwareService=require(_0xe3b4('0x14'));var logger=require(_0xe3b4('0x15'))(_0xe3b4('0x16'));var utils=require(_0xe3b4('0x17'));var config=require(_0xe3b4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe3b4('0x19'))['db'];function respondWithStatusCode(_0x2e7024,_0x40bc8a){_0x40bc8a=_0x40bc8a||0xcc;return function(_0x29fa99){if(_0x29fa99){return _0x2e7024[_0xe3b4('0x1a')](_0x40bc8a);}return _0x2e7024[_0xe3b4('0x1b')](_0x40bc8a)[_0xe3b4('0x1c')]();};}function respondWithResult(_0xc443b8,_0x40d8a4){_0x40d8a4=_0x40d8a4||0xc8;return function(_0x3e1168){if(_0x3e1168){return _0xc443b8[_0xe3b4('0x1b')](_0x40d8a4)[_0xe3b4('0x1d')](_0x3e1168);}};}function respondWithFilteredResult(_0x3ace4d,_0x360722){return function(_0x3b4dce){if(_0x3b4dce){var _0x5883bc=typeof _0x360722[_0xe3b4('0x1e')]==='undefined'&&typeof _0x360722[_0xe3b4('0x1f')]===_0xe3b4('0x20');var _0x55a29b=_0x3b4dce[_0xe3b4('0x21')];var _0xcd48e4=_0x5883bc?0x0:_0x360722[_0xe3b4('0x1e')];var _0x1f155b=_0x5883bc?_0x3b4dce[_0xe3b4('0x21')]:_0x360722[_0xe3b4('0x1e')]+_0x360722['limit'];var _0x197ed3;if(_0x1f155b>=_0x55a29b){_0x1f155b=_0x55a29b;_0x197ed3=0xc8;}else{_0x197ed3=0xce;}_0x3ace4d[_0xe3b4('0x1b')](_0x197ed3);return _0x3ace4d[_0xe3b4('0x22')](_0xe3b4('0x23'),_0xcd48e4+'-'+_0x1f155b+'/'+_0x55a29b)['json'](_0x3b4dce);}return null;};}function patchUpdates(_0x4a1d30){return function(_0x58814c){try{jsonpatch[_0xe3b4('0x24')](_0x58814c,_0x4a1d30,!![]);}catch(_0x530f06){return BPromise[_0xe3b4('0x25')](_0x530f06);}return _0x58814c[_0xe3b4('0x26')]();};}function saveUpdates(_0x5653bb,_0x37cbc3){return function(_0x34e7f8){if(_0x34e7f8){return _0x34e7f8[_0xe3b4('0x27')](_0x5653bb)[_0xe3b4('0x28')](function(_0x554d10){return _0x554d10;});}return null;};}function removeEntity(_0xebde43,_0xb83b83){return function(_0x407a69){if(_0x407a69){return _0x407a69[_0xe3b4('0x29')]()[_0xe3b4('0x28')](function(){_0xebde43[_0xe3b4('0x1b')](0xcc)[_0xe3b4('0x1c')]();});}};}function handleEntityNotFound(_0x4fd415,_0x1be81f){return function(_0x49b2ae){if(!_0x49b2ae){_0x4fd415[_0xe3b4('0x1a')](0x194);}return _0x49b2ae;};}function handleError(_0x160d5d,_0x48f711){_0x48f711=_0x48f711||0x1f4;return function(_0xfefd69){logger['error'](_0xfefd69[_0xe3b4('0x2a')]);if(_0xfefd69[_0xe3b4('0x2b')]){delete _0xfefd69[_0xe3b4('0x2b')];}_0x160d5d[_0xe3b4('0x1b')](_0x48f711)[_0xe3b4('0x2c')](_0xfefd69);};}exports['index']=function(_0x5f5a08,_0x3959a0){var _0x762e39={},_0xb2a172={},_0x23f3cb={'count':0x0,'rows':[]};var _0x2034c7=_[_0xe3b4('0x2d')](db[_0xe3b4('0x2e')]['rawAttributes'],function(_0xe8dde8){return{'name':_0xe8dde8[_0xe3b4('0x2f')],'type':_0xe8dde8[_0xe3b4('0x30')][_0xe3b4('0x31')]};});_0xb2a172['model']=_[_0xe3b4('0x2d')](_0x2034c7,_0xe3b4('0x2b'));_0xb2a172['query']=_[_0xe3b4('0x32')](_0x5f5a08['query']);_0xb2a172[_0xe3b4('0x33')]=_[_0xe3b4('0x34')](_0xb2a172[_0xe3b4('0x35')],_0xb2a172['query']);_0x762e39['attributes']=_['intersection'](_0xb2a172[_0xe3b4('0x35')],qs['fields'](_0x5f5a08[_0xe3b4('0x36')][_0xe3b4('0x37')]));_0x762e39[_0xe3b4('0x38')]=_0x762e39[_0xe3b4('0x38')]['length']?_0x762e39['attributes']:_0xb2a172[_0xe3b4('0x35')];if(!_0x5f5a08[_0xe3b4('0x36')][_0xe3b4('0x39')](_0xe3b4('0x3a'))){_0x762e39[_0xe3b4('0x1f')]=qs['limit'](_0x5f5a08[_0xe3b4('0x36')][_0xe3b4('0x1f')]);_0x762e39[_0xe3b4('0x1e')]=qs[_0xe3b4('0x1e')](_0x5f5a08['query'][_0xe3b4('0x1e')]);}_0x762e39[_0xe3b4('0x3b')]=qs[_0xe3b4('0x3c')](_0x5f5a08[_0xe3b4('0x36')][_0xe3b4('0x3c')]);_0x762e39[_0xe3b4('0x3d')]=qs[_0xe3b4('0x33')](_[_0xe3b4('0x3e')](_0x5f5a08[_0xe3b4('0x36')],_0xb2a172['filters']),_0x2034c7);if(_0x5f5a08[_0xe3b4('0x36')]['filter']){_0x762e39['where']=_[_0xe3b4('0x3f')](_0x762e39[_0xe3b4('0x3d')],{'$or':_[_0xe3b4('0x2d')](_0x2034c7,function(_0x5ef58e){if(_0x5ef58e[_0xe3b4('0x30')]!==_0xe3b4('0x40')){var _0x2faf98={};_0x2faf98[_0x5ef58e[_0xe3b4('0x2b')]]={'$like':'%'+_0x5f5a08[_0xe3b4('0x36')][_0xe3b4('0x41')]+'%'};return _0x2faf98;}})});}_0x762e39=_[_0xe3b4('0x3f')]({},_0x762e39,_0x5f5a08[_0xe3b4('0x42')]);var _0x5ea111={'where':_0x762e39[_0xe3b4('0x3d')]};return db[_0xe3b4('0x2e')][_0xe3b4('0x21')](_0x5ea111)[_0xe3b4('0x28')](function(_0x121688){_0x23f3cb[_0xe3b4('0x21')]=_0x121688;if(_0x5f5a08[_0xe3b4('0x36')][_0xe3b4('0x43')]){_0x762e39[_0xe3b4('0x44')]=[{'all':!![]}];}return db[_0xe3b4('0x2e')]['findAll'](_0x762e39);})['then'](function(_0x2c6eac){_0x23f3cb['rows']=_0x2c6eac;return _0x23f3cb;})[_0xe3b4('0x28')](respondWithFilteredResult(_0x3959a0,_0x762e39))[_0xe3b4('0x45')](handleError(_0x3959a0,null));};exports[_0xe3b4('0x46')]=function(_0x548b55,_0x319670){var _0x277557={'raw':!![],'where':{'id':_0x548b55[_0xe3b4('0x47')]['id']}},_0x2a68a8={};_0x2a68a8[_0xe3b4('0x35')]=_['keys'](db[_0xe3b4('0x2e')]['rawAttributes']);_0x2a68a8[_0xe3b4('0x36')]=_[_0xe3b4('0x32')](_0x548b55['query']);_0x2a68a8[_0xe3b4('0x33')]=_['intersection'](_0x2a68a8['model'],_0x2a68a8[_0xe3b4('0x36')]);_0x277557[_0xe3b4('0x38')]=_['intersection'](_0x2a68a8[_0xe3b4('0x35')],qs[_0xe3b4('0x37')](_0x548b55[_0xe3b4('0x36')][_0xe3b4('0x37')]));_0x277557['attributes']=_0x277557['attributes'][_0xe3b4('0x48')]?_0x277557['attributes']:_0x2a68a8[_0xe3b4('0x35')];if(_0x548b55[_0xe3b4('0x36')]['includeAll']){_0x277557[_0xe3b4('0x44')]=[{'all':!![]}];}_0x277557=_[_0xe3b4('0x3f')]({},_0x277557,_0x548b55[_0xe3b4('0x42')]);return db[_0xe3b4('0x2e')]['find'](_0x277557)['then'](handleEntityNotFound(_0x319670,null))[_0xe3b4('0x28')](respondWithResult(_0x319670,null))[_0xe3b4('0x45')](handleError(_0x319670,null));};exports[_0xe3b4('0x49')]=function(_0xbf0f9e,_0x5dec78){return db[_0xe3b4('0x2e')][_0xe3b4('0x49')](_0xbf0f9e[_0xe3b4('0x4a')],{})['then'](respondWithResult(_0x5dec78,0xc9))[_0xe3b4('0x45')](handleError(_0x5dec78,null));};exports[_0xe3b4('0x27')]=function(_0x450bb8,_0x3d50ec){if(_0x450bb8[_0xe3b4('0x4a')]['id']){delete _0x450bb8[_0xe3b4('0x4a')]['id'];}return db[_0xe3b4('0x2e')][_0xe3b4('0x4b')]({'where':{'id':_0x450bb8['params']['id']}})[_0xe3b4('0x28')](handleEntityNotFound(_0x3d50ec,null))[_0xe3b4('0x28')](saveUpdates(_0x450bb8[_0xe3b4('0x4a')],null))[_0xe3b4('0x28')](respondWithResult(_0x3d50ec,null))[_0xe3b4('0x45')](handleError(_0x3d50ec,null));};exports[_0xe3b4('0x29')]=function(_0x4299fc,_0xbb775c){return db[_0xe3b4('0x2e')]['find']({'where':{'id':_0x4299fc[_0xe3b4('0x47')]['id']}})[_0xe3b4('0x28')](handleEntityNotFound(_0xbb775c,null))[_0xe3b4('0x28')](removeEntity(_0xbb775c,null))[_0xe3b4('0x45')](handleError(_0xbb775c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index a18899c..ba27ff8 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 _0xa40a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','lodash','../../config/logger','api'];(function(_0x38ef55,_0x305ddf){var _0x4e1935=function(_0x13441d){while(--_0x13441d){_0x38ef55['push'](_0x38ef55['shift']());}};_0x4e1935(++_0x305ddf);}(_0xa40a,0x107));var _0xaa40=function(_0x2f6e2a,_0x559421){_0x2f6e2a=_0x2f6e2a-0x0;var _0x3afca1=_0xa40a[_0x2f6e2a];return _0x3afca1;};'use strict';var _=require(_0xaa40('0x0'));var util=require('util');var logger=require(_0xaa40('0x1'))(_0xaa40('0x2'));var moment=require(_0xaa40('0x3'));var BPromise=require(_0xaa40('0x4'));var rp=require(_0xaa40('0x5'));var fs=require('fs');var path=require(_0xaa40('0x6'));var rimraf=require(_0xaa40('0x7'));var config=require(_0xaa40('0x8'));var attributes=require(_0xaa40('0x9'));module[_0xaa40('0xa')]=function(_0x2a195f,_0x220c73){return _0x2a195f['define'](_0xaa40('0xb'),attributes,{'tableName':_0xaa40('0xc'),'paranoid':![],'indexes':[{'name':_0xaa40('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb443=['ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define'];(function(_0x4491f4,_0xef8325){var _0xcc8c66=function(_0x5715c2){while(--_0x5715c2){_0x4491f4['push'](_0x4491f4['shift']());}};_0xcc8c66(++_0xef8325);}(_0xb443,0x82));var _0x3b44=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xb443[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require('lodash');var util=require(_0x3b44('0x0'));var logger=require(_0x3b44('0x1'))(_0x3b44('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3b44('0x3'));var fs=require('fs');var path=require(_0x3b44('0x4'));var rimraf=require(_0x3b44('0x5'));var config=require(_0x3b44('0x6'));var attributes=require(_0x3b44('0x7'));module[_0x3b44('0x8')]=function(_0x2e625d,_0x3c53be){return _0x2e625d[_0x3b44('0x9')](_0x3b44('0xa'),attributes,{'tableName':_0x3b44('0xb'),'paranoid':![],'indexes':[{'name':_0x3b44('0xc'),'fields':[_0x3b44('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 842491e..64dbc42 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 _0x9bde=['code','message','ServicenowField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x181891,_0xc447c1){var _0x578509=function(_0x1da876){while(--_0x1da876){_0x181891['push'](_0x181891['shift']());}};_0x578509(++_0xc447c1);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1df1db,_0x5ae62c){_0x1df1db=_0x1df1db-0x0;var _0x3fa02f=_0x9bde[_0x1df1db];return _0x3fa02f;};'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')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x8e5ee4,_0x349bf5){var _0x425f03=function(_0x523df8){while(--_0x523df8){_0x8e5ee4['push'](_0x8e5ee4['shift']());}};_0x425f03(++_0x349bf5);}(_0x70e0,0x17b));var _0x070e=function(_0x594876,_0x4a0bfa){_0x594876=_0x594876-0x0;var _0x1c8616=_0x70e0[_0x594876];return _0x1c8616;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 391ad44..d4acdb9 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1469c8,_0x5fab6a){var _0x39b2e8=function(_0x59b728){while(--_0x59b728){_0x1469c8['push'](_0x1469c8['shift']());}};_0x39b2e8(++_0x5fab6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x37a61a,_0x44bbca){var _0x46aec6=function(_0x4f2c95){while(--_0x4f2c95){_0x37a61a['push'](_0x37a61a['shift']());}};_0x46aec6(++_0x44bbca);}(_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 e1497d8..a528ac9 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(_0x1736f8,_0x5e150a){var _0x8a525c=function(_0x3fc90e){while(--_0x3fc90e){_0x1736f8['push'](_0x1736f8['shift']());}};_0x8a525c(++_0x5e150a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x55bd8f,_0x3cf66b){var _0x1c7d71=function(_0x3fd540){while(--_0x3fd540){_0x55bd8f['push'](_0x55bd8f['shift']());}};_0x1c7d71(++_0x3cf66b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 93cfec2..59f8f97 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 _0x4349=['../../components/integrations/configuration','sendStatus','json','undefined','count','offset','limit','status','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','length','catch','create','body','find','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','direction','remoteUri','slice','substring','lastIndexOf','format','/service/v4_1/rest.php','JSON','stringify','username','PLAIN','Invalid\x20Login','POST','%s%s','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x39a823,_0x100f92){var _0x5005bb=function(_0x94269b){while(--_0x94269b){_0x39a823['push'](_0x39a823['shift']());}};_0x5005bb(++_0x100f92);}(_0x4349,0xd5));var _0x9434=function(_0x20ae08,_0x5c74db){_0x20ae08=_0x20ae08-0x0;var _0x12fc8c=_0x4349[_0x20ae08];return _0x12fc8c;};'use strict';var emlformat=require(_0x9434('0x0'));var rimraf=require(_0x9434('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9434('0x2'));var moment=require(_0x9434('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9434('0x4'));var path=require(_0x9434('0x5'));var sox=require(_0x9434('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9434('0x7'));var squel=require(_0x9434('0x8'));var crypto=require('crypto');var jsforce=require(_0x9434('0x9'));var deskjs=require(_0x9434('0xa'));var toCsv=require(_0x9434('0xb'));var querystring=require(_0x9434('0xc'));var Papa=require(_0x9434('0xd'));var Redis=require('ioredis');var authService=require(_0x9434('0xe'));var qs=require(_0x9434('0xf'));var as=require(_0x9434('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9434('0x11'));var utils=require('../../config/utils');var config=require(_0x9434('0x12'));var licenseUtil=require(_0x9434('0x13'));var db=require(_0x9434('0x14'))['db'];var integrations=require(_0x9434('0x15'));function respondWithStatusCode(_0x10fbb6,_0x36a5bb){_0x36a5bb=_0x36a5bb||0xcc;return function(_0x1d2a4e){if(_0x1d2a4e){return _0x10fbb6[_0x9434('0x16')](_0x36a5bb);}return _0x10fbb6['status'](_0x36a5bb)['end']();};}function respondWithResult(_0x44a68e,_0x5a70ce){_0x5a70ce=_0x5a70ce||0xc8;return function(_0x42a371){if(_0x42a371){return _0x44a68e['status'](_0x5a70ce)[_0x9434('0x17')](_0x42a371);}};}function respondWithFilteredResult(_0x2db36c,_0x33562b){return function(_0x2975ee){if(_0x2975ee){var _0x184c4a=typeof _0x33562b['offset']===_0x9434('0x18')&&typeof _0x33562b['limit']===_0x9434('0x18');var _0x546b0d=_0x2975ee[_0x9434('0x19')];var _0x42f70d=_0x184c4a?0x0:_0x33562b[_0x9434('0x1a')];var _0x25401d=_0x184c4a?_0x2975ee[_0x9434('0x19')]:_0x33562b[_0x9434('0x1a')]+_0x33562b[_0x9434('0x1b')];var _0x671569;if(_0x25401d>=_0x546b0d){_0x25401d=_0x546b0d;_0x671569=0xc8;}else{_0x671569=0xce;}_0x2db36c[_0x9434('0x1c')](_0x671569);return _0x2db36c[_0x9434('0x1d')](_0x9434('0x1e'),_0x42f70d+'-'+_0x25401d+'/'+_0x546b0d)[_0x9434('0x17')](_0x2975ee);}return null;};}function patchUpdates(_0x6b7790){return function(_0x5f0603){try{jsonpatch[_0x9434('0x1f')](_0x5f0603,_0x6b7790,!![]);}catch(_0x4ac55e){return BPromise[_0x9434('0x20')](_0x4ac55e);}return _0x5f0603['save']();};}function saveUpdates(_0x3350d9,_0x178b1c){return function(_0x532478){if(_0x532478){return _0x532478['update'](_0x3350d9)[_0x9434('0x21')](function(_0x1e65df){return _0x1e65df;});}return null;};}function removeEntity(_0x457ded,_0x50b94c){return function(_0x24bc8e){if(_0x24bc8e){return _0x24bc8e[_0x9434('0x22')]()[_0x9434('0x21')](function(){_0x457ded[_0x9434('0x1c')](0xcc)[_0x9434('0x23')]();});}};}function handleEntityNotFound(_0x10f143,_0x21d4eb){return function(_0x51e1a4){if(!_0x51e1a4){_0x10f143[_0x9434('0x16')](0x194);}return _0x51e1a4;};}function handleError(_0x2d9767,_0x121f35){_0x121f35=_0x121f35||0x1f4;return function(_0x266df8){logger[_0x9434('0x24')](_0x266df8[_0x9434('0x25')]);if(_0x266df8[_0x9434('0x26')]){delete _0x266df8['name'];}_0x2d9767[_0x9434('0x1c')](_0x121f35)[_0x9434('0x27')](_0x266df8);};}exports[_0x9434('0x28')]=function(_0x2b76a9,_0x23a9c5){var _0x3abfe7={},_0x3e6905={},_0x2d5722={'count':0x0,'rows':[]};var _0x2d70f5=_[_0x9434('0x29')](db[_0x9434('0x2a')][_0x9434('0x2b')],function(_0x1d66bc){return{'name':_0x1d66bc[_0x9434('0x2c')],'type':_0x1d66bc['type']['key']};});_0x3e6905[_0x9434('0x2d')]=_[_0x9434('0x29')](_0x2d70f5,'name');_0x3e6905[_0x9434('0x2e')]=_[_0x9434('0x2f')](_0x2b76a9['query']);_0x3e6905[_0x9434('0x30')]=_[_0x9434('0x31')](_0x3e6905[_0x9434('0x2d')],_0x3e6905[_0x9434('0x2e')]);_0x3abfe7[_0x9434('0x32')]=_['intersection'](_0x3e6905[_0x9434('0x2d')],qs[_0x9434('0x33')](_0x2b76a9[_0x9434('0x2e')][_0x9434('0x33')]));_0x3abfe7['attributes']=_0x3abfe7[_0x9434('0x32')]['length']?_0x3abfe7[_0x9434('0x32')]:_0x3e6905['model'];if(!_0x2b76a9[_0x9434('0x2e')][_0x9434('0x34')](_0x9434('0x35'))){_0x3abfe7[_0x9434('0x1b')]=qs[_0x9434('0x1b')](_0x2b76a9[_0x9434('0x2e')][_0x9434('0x1b')]);_0x3abfe7[_0x9434('0x1a')]=qs[_0x9434('0x1a')](_0x2b76a9[_0x9434('0x2e')][_0x9434('0x1a')]);}_0x3abfe7[_0x9434('0x36')]=qs[_0x9434('0x37')](_0x2b76a9[_0x9434('0x2e')][_0x9434('0x37')]);_0x3abfe7['where']=qs[_0x9434('0x30')](_[_0x9434('0x38')](_0x2b76a9[_0x9434('0x2e')],_0x3e6905['filters']),_0x2d70f5);if(_0x2b76a9[_0x9434('0x2e')][_0x9434('0x39')]){_0x3abfe7[_0x9434('0x3a')]=_['merge'](_0x3abfe7[_0x9434('0x3a')],{'$or':_[_0x9434('0x29')](_0x2d70f5,function(_0x667797){if(_0x667797[_0x9434('0x3b')]!==_0x9434('0x3c')){var _0x14152a={};_0x14152a[_0x667797[_0x9434('0x26')]]={'$like':'%'+_0x2b76a9[_0x9434('0x2e')][_0x9434('0x39')]+'%'};return _0x14152a;}})});}_0x3abfe7=_[_0x9434('0x3d')]({},_0x3abfe7,_0x2b76a9[_0x9434('0x3e')]);var _0x2bb290={'where':_0x3abfe7['where']};return db[_0x9434('0x2a')][_0x9434('0x19')](_0x2bb290)[_0x9434('0x21')](function(_0x5e367a){_0x2d5722['count']=_0x5e367a;if(_0x2b76a9[_0x9434('0x2e')][_0x9434('0x3f')]){_0x3abfe7[_0x9434('0x40')]=[{'all':!![]}];}return db[_0x9434('0x2a')][_0x9434('0x41')](_0x3abfe7);})[_0x9434('0x21')](function(_0x4627a4){_0x2d5722[_0x9434('0x42')]=_0x4627a4;return _0x2d5722;})['then'](respondWithFilteredResult(_0x23a9c5,_0x3abfe7))['catch'](handleError(_0x23a9c5,null));};exports['show']=function(_0x5cfbef,_0x3bb624){var _0x3adad8={'raw':![],'where':{'id':_0x5cfbef[_0x9434('0x43')]['id']}},_0x1cd8fb={};_0x1cd8fb[_0x9434('0x2d')]=_[_0x9434('0x2f')](db[_0x9434('0x2a')][_0x9434('0x2b')]);_0x1cd8fb[_0x9434('0x2e')]=_[_0x9434('0x2f')](_0x5cfbef[_0x9434('0x2e')]);_0x1cd8fb[_0x9434('0x30')]=_[_0x9434('0x31')](_0x1cd8fb[_0x9434('0x2d')],_0x1cd8fb[_0x9434('0x2e')]);_0x3adad8[_0x9434('0x32')]=_['intersection'](_0x1cd8fb[_0x9434('0x2d')],qs[_0x9434('0x33')](_0x5cfbef['query'][_0x9434('0x33')]));_0x3adad8[_0x9434('0x32')]=_0x3adad8[_0x9434('0x32')][_0x9434('0x44')]?_0x3adad8['attributes']:_0x1cd8fb['model'];if(_0x5cfbef[_0x9434('0x2e')][_0x9434('0x3f')]){_0x3adad8[_0x9434('0x40')]=[{'all':!![]}];}_0x3adad8=_[_0x9434('0x3d')]({},_0x3adad8,_0x5cfbef['options']);return db['SugarcrmAccount']['find'](_0x3adad8)[_0x9434('0x21')](handleEntityNotFound(_0x3bb624,null))[_0x9434('0x21')](respondWithResult(_0x3bb624,null))[_0x9434('0x45')](handleError(_0x3bb624,null));};exports[_0x9434('0x46')]=function(_0x1856fa,_0x3835c5){return db[_0x9434('0x2a')][_0x9434('0x46')](_0x1856fa['body'],{})['then'](respondWithResult(_0x3835c5,0xc9))[_0x9434('0x45')](handleError(_0x3835c5,null));};exports['update']=function(_0x252fe7,_0x2a894b){if(_0x252fe7[_0x9434('0x47')]['id']){delete _0x252fe7[_0x9434('0x47')]['id'];}return db[_0x9434('0x2a')][_0x9434('0x48')]({'where':{'id':_0x252fe7[_0x9434('0x43')]['id']}})[_0x9434('0x21')](handleEntityNotFound(_0x2a894b,null))[_0x9434('0x21')](saveUpdates(_0x252fe7[_0x9434('0x47')],null))[_0x9434('0x21')](respondWithResult(_0x2a894b,null))[_0x9434('0x45')](handleError(_0x2a894b,null));};exports[_0x9434('0x22')]=function(_0x505dfc,_0xf67afe){return db[_0x9434('0x2a')][_0x9434('0x48')]({'where':{'id':_0x505dfc['params']['id']}})[_0x9434('0x21')](handleEntityNotFound(_0xf67afe,null))[_0x9434('0x21')](removeEntity(_0xf67afe,null))[_0x9434('0x45')](handleError(_0xf67afe,null));};exports[_0x9434('0x49')]=function(_0x178926,_0x4247c1,_0x263938){var _0x2834df={};var _0x5e2573={};var _0x377c50;var _0x44f53e;return db[_0x9434('0x2a')]['findOne']({'where':{'id':_0x178926[_0x9434('0x43')]['id']}})['then'](handleEntityNotFound(_0x4247c1,null))[_0x9434('0x21')](function(_0x3584c5){if(_0x3584c5){_0x377c50=_0x3584c5;_0x5e2573[_0x9434('0x2d')]=_[_0x9434('0x2f')](db['SugarcrmConfiguration'][_0x9434('0x2b')]);_0x5e2573[_0x9434('0x2e')]=_[_0x9434('0x2f')](_0x178926[_0x9434('0x2e')]);_0x5e2573[_0x9434('0x30')]=_[_0x9434('0x31')](_0x5e2573[_0x9434('0x2d')],_0x5e2573[_0x9434('0x2e')]);_0x2834df[_0x9434('0x32')]=_[_0x9434('0x31')](_0x5e2573[_0x9434('0x2d')],qs[_0x9434('0x33')](_0x178926[_0x9434('0x2e')]['fields']));_0x2834df['attributes']=_0x2834df[_0x9434('0x32')][_0x9434('0x44')]?_0x2834df['attributes']:_0x5e2573[_0x9434('0x2d')];_0x2834df[_0x9434('0x36')]=qs[_0x9434('0x37')](_0x178926[_0x9434('0x2e')][_0x9434('0x37')]);_0x2834df[_0x9434('0x3a')]=qs[_0x9434('0x30')](_[_0x9434('0x38')](_0x178926[_0x9434('0x2e')],_0x5e2573[_0x9434('0x30')]));if(_0x178926[_0x9434('0x2e')][_0x9434('0x39')]){_0x2834df['where']=_[_0x9434('0x3d')](_0x2834df[_0x9434('0x3a')],{'$or':_[_0x9434('0x29')](_0x2834df[_0x9434('0x32')],function(_0x14b473){var _0x199ce6={};_0x199ce6[_0x14b473]={'$like':'%'+_0x178926[_0x9434('0x2e')][_0x9434('0x39')]+'%'};return _0x199ce6;})});}_0x2834df=_[_0x9434('0x3d')]({},_0x2834df,_0x178926[_0x9434('0x3e')]);return _0x377c50[_0x9434('0x49')](_0x2834df);}})[_0x9434('0x21')](function(_0x204082){if(_0x204082){_0x44f53e=_0x204082['length'];if(!_0x178926['query'][_0x9434('0x34')](_0x9434('0x35'))){_0x2834df[_0x9434('0x1b')]=qs[_0x9434('0x1b')](_0x178926[_0x9434('0x2e')][_0x9434('0x1b')]);_0x2834df[_0x9434('0x1a')]=qs[_0x9434('0x1a')](_0x178926[_0x9434('0x2e')]['offset']);}return _0x377c50['getConfigurations'](_0x2834df);}})[_0x9434('0x21')](function(_0x512bd5){if(_0x512bd5){return _0x512bd5?{'count':_0x44f53e,'rows':_0x512bd5}:null;}})['then'](respondWithResult(_0x4247c1,null))[_0x9434('0x45')](handleError(_0x4247c1,null));};exports[_0x9434('0x4a')]=function(_0x7b0f88,_0x181362,_0x234df7){if(_0x7b0f88[_0x9434('0x47')]['id']){delete _0x7b0f88[_0x9434('0x47')]['id'];}return db[_0x9434('0x2a')][_0x9434('0x4b')]({'where':{'id':_0x7b0f88['params']['id']}})[_0x9434('0x21')](handleEntityNotFound(_0x181362,null))['then'](function(_0x201eaa){if(_0x201eaa){_0x7b0f88['body'][_0x9434('0x4c')]=_0x201eaa['id'];_0x7b0f88[_0x9434('0x47')][_0x9434('0x4d')]=integrations[_0x9434('0x4e')](_0x7b0f88[_0x9434('0x47')][_0x9434('0x4f')],_0x7b0f88[_0x9434('0x47')]['type']);_0x7b0f88['body']['Descriptions']=integrations[_0x9434('0x50')](_0x7b0f88[_0x9434('0x47')][_0x9434('0x4f')],_0x7b0f88[_0x9434('0x47')][_0x9434('0x3b')]);return db[_0x9434('0x51')][_0x9434('0x46')](_0x7b0f88[_0x9434('0x47')],{'include':[{'model':db['SugarcrmField'],'as':_0x9434('0x4d')},{'model':db[_0x9434('0x52')],'as':'Descriptions'}]});}return null;})[_0x9434('0x21')](respondWithResult(_0x181362,null))['catch'](handleError(_0x181362,null));};exports[_0x9434('0x53')]=function(_0x281049,_0x5b1e53,_0x57a04d){var _0x33e9cb='';var _0x67e452=['id',_0x9434('0x26'),_0x9434('0x54'),_0x9434('0x55'),_0x9434('0x56'),_0x9434('0x57'),_0x9434('0x58'),'duration_minutes',_0x9434('0x59'),'parent_type','parent_name',_0x9434('0x5a')];return db[_0x9434('0x2a')][_0x9434('0x4b')]({'where':{'id':_0x281049[_0x9434('0x43')]['id']},'attributes':['id','username','password',_0x9434('0x5b')]})[_0x9434('0x21')](handleEntityNotFound(_0x5b1e53,null))[_0x9434('0x21')](function(_0x5055c4){if(_0x5055c4){_0x33e9cb=_0x5055c4[_0x9434('0x5b')];var _0x3ca3e7=_0x33e9cb[_0x9434('0x5c')](-0x1);if(_0x3ca3e7==='/'){_0x33e9cb=_0x33e9cb[_0x9434('0x5d')](0x0,_0x33e9cb[_0x9434('0x5e')](_0x3ca3e7));}return rp({'method':'POST','uri':util[_0x9434('0x5f')]('%s%s',_0x33e9cb,_0x9434('0x60')),'json':!![],'form':{'method':'login','input_type':_0x9434('0x61'),'response_type':_0x9434('0x61'),'rest_data':JSON[_0x9434('0x62')]({'user_auth':{'user_name':_0x5055c4[_0x9434('0x63')],'password':_0x5055c4['password'],'encryption':_0x9434('0x64')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x9434('0x21')](function(_0xf909c2){if(_0xf909c2&&_0xf909c2[_0x9434('0x26')]!==_0x9434('0x65')&&_0xf909c2[_0x9434('0x26')]!=='Password\x20Expired'){return rp({'method':_0x9434('0x66'),'uri':util[_0x9434('0x5f')](_0x9434('0x67'),_0x33e9cb,_0x9434('0x60')),'json':!![],'form':{'method':_0x9434('0x68'),'input_type':'JSON','response_type':_0x9434('0x61'),'rest_data':JSON[_0x9434('0x62')]({'session':_0xf909c2['id'],'module_name':_0x9434('0x69')})}})[_0x9434('0x21')](function(_0x44f6b2){if(_0x44f6b2){var _0x3324e5=_[_0x9434('0x6a')](_0x44f6b2[_0x9434('0x6b')]);_[_0x9434('0x6c')](_0x3324e5,function(_0x5a08ef){return _0x67e452[_0x9434('0x6d')](_0x5a08ef[_0x9434('0x26')]);});return{'count':_0x3324e5['length'],'rows':_['map'](_0x3324e5,function(_0x338835){return{'id':_0x338835[_0x9434('0x26')],'name':_0x338835[_0x9434('0x6e')],'custom':_[_0x9434('0x6f')](_0x338835[_0x9434('0x26')],'_c')?!![]:![],'options':_0x338835[_0x9434('0x3e')]?_[_0x9434('0x29')](_[_0x9434('0x6a')](_0x338835[_0x9434('0x3e')]),function(_0x75c9ff){return{'name':_0x75c9ff[_0x9434('0x70')],'value':_0x75c9ff[_0x9434('0x26')]};}):[]};})};}})[_0x9434('0x21')](respondWithResult(_0x5b1e53,null))[_0x9434('0x45')](function(_0x4300c7){var _0x149100=_0x281049['query']['test']?0x1f4:_0x4300c7[_0x9434('0x71')]||0x1f4;logger[_0x9434('0x24')](_0x9434('0x72'),_0x9434('0x53'),_0x149100,JSON[_0x9434('0x62')](_0x4300c7));delete _0x4300c7[_0x9434('0x26')];if(_0x149100===0x191){_0x149100=0x190;}_0x5b1e53[_0x9434('0x1c')](_0x149100)[_0x9434('0x27')](_0x281049[_0x9434('0x2e')][_0x9434('0x73')]?{'message':_0x9434('0x74'),'statusCode':_0x4300c7[_0x9434('0x71')]}:_0x4300c7);});}else{var _0x4e99d2=0x1f4;_0x5b1e53[_0x9434('0x1c')](_0x4e99d2)[_0x9434('0x27')]({'message':_0x9434('0x74'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xd4a9=['includes','label','endsWith','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','length','create','body','find','params','getConfigurations','SugarcrmConfiguration','order','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','created_by','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd4a9,0x7c));var _0x9d4a=function(_0x372bd9,_0x2d5ef1){_0x372bd9=_0x372bd9-0x0;var _0x914906=_0xd4a9[_0x372bd9];return _0x914906;};'use strict';var emlformat=require(_0x9d4a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9d4a('0x1'));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(_0x9d4a('0x2'));var path=require(_0x9d4a('0x3'));var sox=require(_0x9d4a('0x4'));var csv=require(_0x9d4a('0x5'));var ejs=require(_0x9d4a('0x6'));var fs=require('fs');var fs_extra=require(_0x9d4a('0x7'));var _=require(_0x9d4a('0x8'));var squel=require('squel');var crypto=require(_0x9d4a('0x9'));var jsforce=require(_0x9d4a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x9d4a('0x5'));var querystring=require(_0x9d4a('0xb'));var Papa=require(_0x9d4a('0xc'));var Redis=require(_0x9d4a('0xd'));var authService=require(_0x9d4a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9d4a('0xf'));var hardwareService=require(_0x9d4a('0x10'));var logger=require(_0x9d4a('0x11'))(_0x9d4a('0x12'));var utils=require(_0x9d4a('0x13'));var config=require(_0x9d4a('0x14'));var licenseUtil=require(_0x9d4a('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9d4a('0x16'));function respondWithStatusCode(_0x163d89,_0x2f338c){_0x2f338c=_0x2f338c||0xcc;return function(_0x4ba9fc){if(_0x4ba9fc){return _0x163d89[_0x9d4a('0x17')](_0x2f338c);}return _0x163d89[_0x9d4a('0x18')](_0x2f338c)[_0x9d4a('0x19')]();};}function respondWithResult(_0x5539bb,_0x1ffe03){_0x1ffe03=_0x1ffe03||0xc8;return function(_0x55d4be){if(_0x55d4be){return _0x5539bb[_0x9d4a('0x18')](_0x1ffe03)['json'](_0x55d4be);}};}function respondWithFilteredResult(_0x345194,_0x47320b){return function(_0x2aa26e){if(_0x2aa26e){var _0x4a38cc=typeof _0x47320b[_0x9d4a('0x1a')]==='undefined'&&typeof _0x47320b[_0x9d4a('0x1b')]===_0x9d4a('0x1c');var _0xce3270=_0x2aa26e[_0x9d4a('0x1d')];var _0x260c7c=_0x4a38cc?0x0:_0x47320b[_0x9d4a('0x1a')];var _0xaff3f3=_0x4a38cc?_0x2aa26e[_0x9d4a('0x1d')]:_0x47320b[_0x9d4a('0x1a')]+_0x47320b[_0x9d4a('0x1b')];var _0x1ae542;if(_0xaff3f3>=_0xce3270){_0xaff3f3=_0xce3270;_0x1ae542=0xc8;}else{_0x1ae542=0xce;}_0x345194[_0x9d4a('0x18')](_0x1ae542);return _0x345194[_0x9d4a('0x1e')]('Content-Range',_0x260c7c+'-'+_0xaff3f3+'/'+_0xce3270)[_0x9d4a('0x1f')](_0x2aa26e);}return null;};}function patchUpdates(_0x430aba){return function(_0x382461){try{jsonpatch[_0x9d4a('0x20')](_0x382461,_0x430aba,!![]);}catch(_0x15fb01){return BPromise[_0x9d4a('0x21')](_0x15fb01);}return _0x382461[_0x9d4a('0x22')]();};}function saveUpdates(_0x13241a,_0x5ee922){return function(_0x4107a2){if(_0x4107a2){return _0x4107a2[_0x9d4a('0x23')](_0x13241a)[_0x9d4a('0x24')](function(_0xe1d934){return _0xe1d934;});}return null;};}function removeEntity(_0x25a789,_0x56a37c){return function(_0x11f540){if(_0x11f540){return _0x11f540[_0x9d4a('0x25')]()[_0x9d4a('0x24')](function(){_0x25a789[_0x9d4a('0x18')](0xcc)[_0x9d4a('0x19')]();});}};}function handleEntityNotFound(_0x207873,_0x50c863){return function(_0x535394){if(!_0x535394){_0x207873[_0x9d4a('0x17')](0x194);}return _0x535394;};}function handleError(_0xcbdee4,_0xfa29f7){_0xfa29f7=_0xfa29f7||0x1f4;return function(_0x1a1c85){logger['error'](_0x1a1c85['stack']);if(_0x1a1c85[_0x9d4a('0x26')]){delete _0x1a1c85['name'];}_0xcbdee4[_0x9d4a('0x18')](_0xfa29f7)[_0x9d4a('0x27')](_0x1a1c85);};}exports[_0x9d4a('0x28')]=function(_0x3fda9b,_0x90fcd4){var _0x4ade76={},_0x386a7b={},_0x58fbc9={'count':0x0,'rows':[]};var _0x6e6ad4=_[_0x9d4a('0x29')](db[_0x9d4a('0x2a')][_0x9d4a('0x2b')],function(_0x4df043){return{'name':_0x4df043[_0x9d4a('0x2c')],'type':_0x4df043[_0x9d4a('0x2d')][_0x9d4a('0x2e')]};});_0x386a7b[_0x9d4a('0x2f')]=_[_0x9d4a('0x29')](_0x6e6ad4,_0x9d4a('0x26'));_0x386a7b[_0x9d4a('0x30')]=_[_0x9d4a('0x31')](_0x3fda9b[_0x9d4a('0x30')]);_0x386a7b[_0x9d4a('0x32')]=_[_0x9d4a('0x33')](_0x386a7b['model'],_0x386a7b[_0x9d4a('0x30')]);_0x4ade76[_0x9d4a('0x34')]=_['intersection'](_0x386a7b[_0x9d4a('0x2f')],qs['fields'](_0x3fda9b['query'][_0x9d4a('0x35')]));_0x4ade76[_0x9d4a('0x34')]=_0x4ade76[_0x9d4a('0x34')]['length']?_0x4ade76['attributes']:_0x386a7b[_0x9d4a('0x2f')];if(!_0x3fda9b['query'][_0x9d4a('0x36')](_0x9d4a('0x37'))){_0x4ade76[_0x9d4a('0x1b')]=qs[_0x9d4a('0x1b')](_0x3fda9b[_0x9d4a('0x30')][_0x9d4a('0x1b')]);_0x4ade76[_0x9d4a('0x1a')]=qs[_0x9d4a('0x1a')](_0x3fda9b[_0x9d4a('0x30')][_0x9d4a('0x1a')]);}_0x4ade76['order']=qs[_0x9d4a('0x38')](_0x3fda9b[_0x9d4a('0x30')]['sort']);_0x4ade76[_0x9d4a('0x39')]=qs[_0x9d4a('0x32')](_['pick'](_0x3fda9b[_0x9d4a('0x30')],_0x386a7b[_0x9d4a('0x32')]),_0x6e6ad4);if(_0x3fda9b[_0x9d4a('0x30')][_0x9d4a('0x3a')]){_0x4ade76[_0x9d4a('0x39')]=_[_0x9d4a('0x3b')](_0x4ade76['where'],{'$or':_['map'](_0x6e6ad4,function(_0x493e61){if(_0x493e61[_0x9d4a('0x2d')]!==_0x9d4a('0x3c')){var _0x255ca4={};_0x255ca4[_0x493e61[_0x9d4a('0x26')]]={'$like':'%'+_0x3fda9b[_0x9d4a('0x30')][_0x9d4a('0x3a')]+'%'};return _0x255ca4;}})});}_0x4ade76=_[_0x9d4a('0x3b')]({},_0x4ade76,_0x3fda9b[_0x9d4a('0x3d')]);var _0xec1356={'where':_0x4ade76['where']};return db[_0x9d4a('0x2a')][_0x9d4a('0x1d')](_0xec1356)['then'](function(_0x5065d8){_0x58fbc9['count']=_0x5065d8;if(_0x3fda9b['query'][_0x9d4a('0x3e')]){_0x4ade76[_0x9d4a('0x3f')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x4ade76);})['then'](function(_0x4e1576){_0x58fbc9[_0x9d4a('0x40')]=_0x4e1576;return _0x58fbc9;})[_0x9d4a('0x24')](respondWithFilteredResult(_0x90fcd4,_0x4ade76))[_0x9d4a('0x41')](handleError(_0x90fcd4,null));};exports[_0x9d4a('0x42')]=function(_0x588b6a,_0x110d67){var _0x1d2d8f={'raw':![],'where':{'id':_0x588b6a['params']['id']}},_0x1df608={};_0x1df608[_0x9d4a('0x2f')]=_['keys'](db[_0x9d4a('0x2a')][_0x9d4a('0x2b')]);_0x1df608[_0x9d4a('0x30')]=_[_0x9d4a('0x31')](_0x588b6a[_0x9d4a('0x30')]);_0x1df608[_0x9d4a('0x32')]=_[_0x9d4a('0x33')](_0x1df608[_0x9d4a('0x2f')],_0x1df608[_0x9d4a('0x30')]);_0x1d2d8f['attributes']=_[_0x9d4a('0x33')](_0x1df608[_0x9d4a('0x2f')],qs[_0x9d4a('0x35')](_0x588b6a[_0x9d4a('0x30')][_0x9d4a('0x35')]));_0x1d2d8f['attributes']=_0x1d2d8f[_0x9d4a('0x34')][_0x9d4a('0x43')]?_0x1d2d8f[_0x9d4a('0x34')]:_0x1df608[_0x9d4a('0x2f')];if(_0x588b6a[_0x9d4a('0x30')]['includeAll']){_0x1d2d8f[_0x9d4a('0x3f')]=[{'all':!![]}];}_0x1d2d8f=_[_0x9d4a('0x3b')]({},_0x1d2d8f,_0x588b6a[_0x9d4a('0x3d')]);return db[_0x9d4a('0x2a')]['find'](_0x1d2d8f)['then'](handleEntityNotFound(_0x110d67,null))[_0x9d4a('0x24')](respondWithResult(_0x110d67,null))[_0x9d4a('0x41')](handleError(_0x110d67,null));};exports[_0x9d4a('0x44')]=function(_0x98aee,_0x5c0016){return db[_0x9d4a('0x2a')][_0x9d4a('0x44')](_0x98aee[_0x9d4a('0x45')],{})[_0x9d4a('0x24')](respondWithResult(_0x5c0016,0xc9))[_0x9d4a('0x41')](handleError(_0x5c0016,null));};exports[_0x9d4a('0x23')]=function(_0x1284a1,_0x1df797){if(_0x1284a1[_0x9d4a('0x45')]['id']){delete _0x1284a1[_0x9d4a('0x45')]['id'];}return db[_0x9d4a('0x2a')][_0x9d4a('0x46')]({'where':{'id':_0x1284a1[_0x9d4a('0x47')]['id']}})['then'](handleEntityNotFound(_0x1df797,null))[_0x9d4a('0x24')](saveUpdates(_0x1284a1['body'],null))[_0x9d4a('0x24')](respondWithResult(_0x1df797,null))[_0x9d4a('0x41')](handleError(_0x1df797,null));};exports[_0x9d4a('0x25')]=function(_0x16d64c,_0x173f52){return db[_0x9d4a('0x2a')][_0x9d4a('0x46')]({'where':{'id':_0x16d64c['params']['id']}})['then'](handleEntityNotFound(_0x173f52,null))[_0x9d4a('0x24')](removeEntity(_0x173f52,null))[_0x9d4a('0x41')](handleError(_0x173f52,null));};exports[_0x9d4a('0x48')]=function(_0x128436,_0x47ecf3,_0x304e24){var _0x2eced5={};var _0x23ac55={};var _0x2116b5;var _0x181039;return db[_0x9d4a('0x2a')]['findOne']({'where':{'id':_0x128436[_0x9d4a('0x47')]['id']}})[_0x9d4a('0x24')](handleEntityNotFound(_0x47ecf3,null))[_0x9d4a('0x24')](function(_0x7af01c){if(_0x7af01c){_0x2116b5=_0x7af01c;_0x23ac55[_0x9d4a('0x2f')]=_[_0x9d4a('0x31')](db[_0x9d4a('0x49')][_0x9d4a('0x2b')]);_0x23ac55['query']=_[_0x9d4a('0x31')](_0x128436[_0x9d4a('0x30')]);_0x23ac55[_0x9d4a('0x32')]=_[_0x9d4a('0x33')](_0x23ac55['model'],_0x23ac55[_0x9d4a('0x30')]);_0x2eced5[_0x9d4a('0x34')]=_[_0x9d4a('0x33')](_0x23ac55[_0x9d4a('0x2f')],qs['fields'](_0x128436[_0x9d4a('0x30')]['fields']));_0x2eced5[_0x9d4a('0x34')]=_0x2eced5[_0x9d4a('0x34')]['length']?_0x2eced5['attributes']:_0x23ac55['model'];_0x2eced5[_0x9d4a('0x4a')]=qs[_0x9d4a('0x38')](_0x128436[_0x9d4a('0x30')][_0x9d4a('0x38')]);_0x2eced5[_0x9d4a('0x39')]=qs[_0x9d4a('0x32')](_[_0x9d4a('0x4b')](_0x128436[_0x9d4a('0x30')],_0x23ac55[_0x9d4a('0x32')]));if(_0x128436[_0x9d4a('0x30')][_0x9d4a('0x3a')]){_0x2eced5[_0x9d4a('0x39')]=_[_0x9d4a('0x3b')](_0x2eced5[_0x9d4a('0x39')],{'$or':_[_0x9d4a('0x29')](_0x2eced5[_0x9d4a('0x34')],function(_0x7d148){var _0x456c91={};_0x456c91[_0x7d148]={'$like':'%'+_0x128436[_0x9d4a('0x30')][_0x9d4a('0x3a')]+'%'};return _0x456c91;})});}_0x2eced5=_['merge']({},_0x2eced5,_0x128436['options']);return _0x2116b5['getConfigurations'](_0x2eced5);}})[_0x9d4a('0x24')](function(_0x19f0c8){if(_0x19f0c8){_0x181039=_0x19f0c8[_0x9d4a('0x43')];if(!_0x128436[_0x9d4a('0x30')][_0x9d4a('0x36')]('nolimit')){_0x2eced5[_0x9d4a('0x1b')]=qs[_0x9d4a('0x1b')](_0x128436['query'][_0x9d4a('0x1b')]);_0x2eced5[_0x9d4a('0x1a')]=qs['offset'](_0x128436[_0x9d4a('0x30')]['offset']);}return _0x2116b5[_0x9d4a('0x48')](_0x2eced5);}})[_0x9d4a('0x24')](function(_0x272abf){if(_0x272abf){return _0x272abf?{'count':_0x181039,'rows':_0x272abf}:null;}})[_0x9d4a('0x24')](respondWithResult(_0x47ecf3,null))[_0x9d4a('0x41')](handleError(_0x47ecf3,null));};exports[_0x9d4a('0x4c')]=function(_0x1466c7,_0x51d246,_0x46e461){if(_0x1466c7[_0x9d4a('0x45')]['id']){delete _0x1466c7[_0x9d4a('0x45')]['id'];}return db[_0x9d4a('0x2a')]['findOne']({'where':{'id':_0x1466c7[_0x9d4a('0x47')]['id']}})[_0x9d4a('0x24')](handleEntityNotFound(_0x51d246,null))[_0x9d4a('0x24')](function(_0x30b748){if(_0x30b748){_0x1466c7[_0x9d4a('0x45')][_0x9d4a('0x4d')]=_0x30b748['id'];_0x1466c7[_0x9d4a('0x45')][_0x9d4a('0x4e')]=integrations[_0x9d4a('0x4f')](_0x1466c7[_0x9d4a('0x45')][_0x9d4a('0x50')],_0x1466c7['body'][_0x9d4a('0x2d')]);_0x1466c7['body'][_0x9d4a('0x51')]=integrations['getDescriptions'](_0x1466c7['body']['channel'],_0x1466c7['body']['type']);return db[_0x9d4a('0x49')][_0x9d4a('0x44')](_0x1466c7[_0x9d4a('0x45')],{'include':[{'model':db['SugarcrmField'],'as':_0x9d4a('0x4e')},{'model':db[_0x9d4a('0x52')],'as':_0x9d4a('0x51')}]});}return null;})['then'](respondWithResult(_0x51d246,null))['catch'](handleError(_0x51d246,null));};exports[_0x9d4a('0x53')]=function(_0x44cb62,_0xd5886c,_0x4992c5){var _0x23310c='';var _0x253326=['id',_0x9d4a('0x26'),'assigned_user_id',_0x9d4a('0x54'),_0x9d4a('0x55'),_0x9d4a('0x56'),_0x9d4a('0x57'),'duration_minutes',_0x9d4a('0x58'),_0x9d4a('0x59'),_0x9d4a('0x5a'),_0x9d4a('0x5b')];return db[_0x9d4a('0x2a')]['findOne']({'where':{'id':_0x44cb62[_0x9d4a('0x47')]['id']},'attributes':['id',_0x9d4a('0x5c'),_0x9d4a('0x5d'),'remoteUri']})[_0x9d4a('0x24')](handleEntityNotFound(_0xd5886c,null))[_0x9d4a('0x24')](function(_0x910a58){if(_0x910a58){_0x23310c=_0x910a58[_0x9d4a('0x5e')];var _0x1c2830=_0x23310c[_0x9d4a('0x5f')](-0x1);if(_0x1c2830==='/'){_0x23310c=_0x23310c[_0x9d4a('0x60')](0x0,_0x23310c[_0x9d4a('0x61')](_0x1c2830));}return rp({'method':_0x9d4a('0x62'),'uri':util[_0x9d4a('0x63')](_0x9d4a('0x64'),_0x23310c,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x9d4a('0x65'),'response_type':'JSON','rest_data':JSON[_0x9d4a('0x66')]({'user_auth':{'user_name':_0x910a58['username'],'password':_0x910a58[_0x9d4a('0x5d')],'encryption':'PLAIN'},'application':_0x9d4a('0x67')})}});}})[_0x9d4a('0x24')](function(_0x1ce249){if(_0x1ce249&&_0x1ce249[_0x9d4a('0x26')]!==_0x9d4a('0x68')&&_0x1ce249[_0x9d4a('0x26')]!==_0x9d4a('0x69')){return rp({'method':_0x9d4a('0x62'),'uri':util['format']('%s%s',_0x23310c,_0x9d4a('0x6a')),'json':!![],'form':{'method':_0x9d4a('0x6b'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x9d4a('0x66')]({'session':_0x1ce249['id'],'module_name':_0x9d4a('0x6c')})}})['then'](function(_0x2d1489){if(_0x2d1489){var _0x43b441=_[_0x9d4a('0x6d')](_0x2d1489[_0x9d4a('0x6e')]);_[_0x9d4a('0x6f')](_0x43b441,function(_0x10a8dd){return _0x253326[_0x9d4a('0x70')](_0x10a8dd[_0x9d4a('0x26')]);});return{'count':_0x43b441[_0x9d4a('0x43')],'rows':_['map'](_0x43b441,function(_0x4e131a){return{'id':_0x4e131a['name'],'name':_0x4e131a[_0x9d4a('0x71')],'custom':_[_0x9d4a('0x72')](_0x4e131a['name'],'_c')?!![]:![],'options':_0x4e131a[_0x9d4a('0x3d')]?_['map'](_['values'](_0x4e131a[_0x9d4a('0x3d')]),function(_0x265be5){return{'name':_0x265be5['value'],'value':_0x265be5['name']};}):[]};})};}})[_0x9d4a('0x24')](respondWithResult(_0xd5886c,null))[_0x9d4a('0x41')](function(_0xe39567){var _0x30bb0b=_0x44cb62[_0x9d4a('0x30')][_0x9d4a('0x73')]?0x1f4:_0xe39567['statusCode']||0x1f4;logger['error'](_0x9d4a('0x74'),'getFields',_0x30bb0b,JSON[_0x9d4a('0x66')](_0xe39567));delete _0xe39567[_0x9d4a('0x26')];if(_0x30bb0b===0x191){_0x30bb0b=0x190;}_0xd5886c['status'](_0x30bb0b)[_0x9d4a('0x27')](_0x44cb62[_0x9d4a('0x30')][_0x9d4a('0x73')]?{'message':_0x9d4a('0x75'),'statusCode':_0xe39567['statusCode']}:_0xe39567);});}else{var _0x41e5ed=0x1f4;_0xd5886c[_0x9d4a('0x18')](_0x41e5ed)[_0x9d4a('0x27')]({'message':'Wrong\x20credentials','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 e0e2cdc..c414dad 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 _0x3b43=['SugarcrmAccount','int_sugarcrm_accounts','lodash','api','moment','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define'];(function(_0x20ecc5,_0x109a93){var _0x4431e3=function(_0x17a105){while(--_0x17a105){_0x20ecc5['push'](_0x20ecc5['shift']());}};_0x4431e3(++_0x109a93);}(_0x3b43,0x115));var _0x33b4=function(_0x1ac5fb,_0x16e50e){_0x1ac5fb=_0x1ac5fb-0x0;var _0x44eff1=_0x3b43[_0x1ac5fb];return _0x44eff1;};'use strict';var _=require(_0x33b4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x33b4('0x1'));var moment=require(_0x33b4('0x2'));var BPromise=require('bluebird');var rp=require(_0x33b4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33b4('0x4'));var config=require(_0x33b4('0x5'));var attributes=require(_0x33b4('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x33b4('0x7')]=function(_0x3e8c59,_0x393058){return _0x3e8c59[_0x33b4('0x8')](_0x33b4('0x9'),attributes,{'tableName':_0x33b4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3f0=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x1270d4,_0x103355){var _0x1177f0=function(_0x13aa9c){while(--_0x13aa9c){_0x1270d4['push'](_0x1270d4['shift']());}};_0x1177f0(++_0x103355);}(_0xa3f0,0x1ad));var _0x0a3f=function(_0x562593,_0x53e7e9){_0x562593=_0x562593-0x0;var _0x2a4117=_0xa3f0[_0x562593];return _0x2a4117;};'use strict';var _=require(_0x0a3f('0x0'));var util=require('util');var logger=require(_0x0a3f('0x1'))('api');var moment=require(_0x0a3f('0x2'));var BPromise=require(_0x0a3f('0x3'));var rp=require(_0x0a3f('0x4'));var fs=require('fs');var path=require(_0x0a3f('0x5'));var rimraf=require(_0x0a3f('0x6'));var config=require(_0x0a3f('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x0a3f('0x8'));module[_0x0a3f('0x9')]=function(_0x1ad5d8,_0x1ab886){return _0x1ad5d8[_0x0a3f('0xa')](_0x0a3f('0xb'),attributes,{'tableName':_0x0a3f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index f44b72c..04098d6 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 _0xa866=['options','where','attributes','limit','include','map','info','GetSugarcrmAccount','ShowSugarcrmAccount','find','raw','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll'];(function(_0x3923c7,_0x4972b9){var _0x5d0f8a=function(_0x4f5234){while(--_0x4f5234){_0x3923c7['push'](_0x3923c7['shift']());}};_0x5d0f8a(++_0x4972b9);}(_0xa866,0x1bc));var _0x6a86=function(_0x542459,_0x3ce143){_0x542459=_0x542459-0x0;var _0xaec421=_0xa866[_0x542459];return _0xaec421;};'use strict';var _=require('lodash');var util=require(_0x6a86('0x0'));var moment=require(_0x6a86('0x1'));var BPromise=require(_0x6a86('0x2'));var rs=require(_0x6a86('0x3'));var fs=require('fs');var Redis=require(_0x6a86('0x4'));var db=require(_0x6a86('0x5'))['db'];var utils=require(_0x6a86('0x6'));var logger=require(_0x6a86('0x7'))(_0x6a86('0x8'));var config=require('../../config/environment');var jayson=require(_0x6a86('0x9'));var client=jayson[_0x6a86('0xa')][_0x6a86('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16d10e,_0x29a5be,_0x46759a){return new BPromise(function(_0x3aa102,_0x436745){return client[_0x6a86('0xc')](_0x16d10e,_0x46759a)[_0x6a86('0xd')](function(_0x4172f2){logger['info'](_0x6a86('0xe'),_0x29a5be,_0x6a86('0xf'));logger[_0x6a86('0x10')](_0x6a86('0x11'),_0x29a5be,_0x6a86('0xf'),JSON[_0x6a86('0x12')](_0x4172f2));if(_0x4172f2[_0x6a86('0x13')]){if(_0x4172f2['error']['code']===0x1f4){logger[_0x6a86('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x29a5be,_0x4172f2[_0x6a86('0x13')][_0x6a86('0x14')]);return _0x436745(_0x4172f2[_0x6a86('0x13')]['message']);}logger[_0x6a86('0x13')](_0x6a86('0xe'),_0x29a5be,_0x4172f2[_0x6a86('0x13')][_0x6a86('0x14')]);return _0x3aa102(_0x4172f2['error'][_0x6a86('0x14')]);}else{logger['info'](_0x6a86('0xe'),_0x29a5be,_0x6a86('0xf'));_0x3aa102(_0x4172f2[_0x6a86('0x15')][_0x6a86('0x14')]);}})[_0x6a86('0x16')](function(_0x1ca87d){logger[_0x6a86('0x13')](_0x6a86('0xe'),_0x29a5be,_0x1ca87d);_0x436745(_0x1ca87d);});});}exports['GetSugarcrmAccount']=function(_0xbf3f65){var _0x4d2b9c=this;return new Promise(function(_0x3e59ab,_0x2e363f){return db['SugarcrmAccount'][_0x6a86('0x17')]({'raw':_0xbf3f65[_0x6a86('0x18')]?_0xbf3f65[_0x6a86('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xbf3f65[_0x6a86('0x18')]?_0xbf3f65[_0x6a86('0x18')][_0x6a86('0x19')]||null:null,'attributes':_0xbf3f65['options']?_0xbf3f65[_0x6a86('0x18')][_0x6a86('0x1a')]||null:null,'limit':_0xbf3f65['options']?_0xbf3f65['options'][_0x6a86('0x1b')]||null:null,'include':_0xbf3f65[_0x6a86('0x18')]?_0xbf3f65[_0x6a86('0x18')][_0x6a86('0x1c')]?_[_0x6a86('0x1d')](_0xbf3f65[_0x6a86('0x18')][_0x6a86('0x1c')],function(_0x1e9683){return{'model':db[_0x1e9683['model']],'as':_0x1e9683['as'],'attributes':_0x1e9683[_0x6a86('0x1a')],'include':_0x1e9683[_0x6a86('0x1c')]?_[_0x6a86('0x1d')](_0x1e9683['include'],function(_0x206e07){return{'model':db[_0x206e07['model']],'as':_0x206e07['as'],'attributes':_0x206e07[_0x6a86('0x1a')],'include':_0x206e07[_0x6a86('0x1c')]?_['map'](_0x206e07['include'],function(_0x28ebf6){return{'model':db[_0x28ebf6['model']],'as':_0x28ebf6['as'],'attributes':_0x28ebf6[_0x6a86('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6a86('0xd')](function(_0x528d34){logger[_0x6a86('0x1e')](_0x6a86('0x1f'),_0xbf3f65);logger[_0x6a86('0x10')]('GetSugarcrmAccount',_0xbf3f65,JSON[_0x6a86('0x12')](_0x528d34));_0x3e59ab(_0x528d34);})[_0x6a86('0x16')](function(_0x1ce967){logger['error'](_0x6a86('0x1f'),_0x1ce967[_0x6a86('0x14')],_0xbf3f65);_0x2e363f(_0x4d2b9c['error'](0x1f4,_0x1ce967[_0x6a86('0x14')]));});});};exports[_0x6a86('0x20')]=function(_0x52da83){var _0x556dc3=this;return new Promise(function(_0x2308c0,_0xbe0f3e){return db['SugarcrmAccount'][_0x6a86('0x21')]({'raw':_0x52da83[_0x6a86('0x18')]?_0x52da83[_0x6a86('0x18')][_0x6a86('0x22')]===undefined?!![]:![]:!![],'where':_0x52da83['options']?_0x52da83[_0x6a86('0x18')][_0x6a86('0x19')]||null:null,'attributes':_0x52da83[_0x6a86('0x18')]?_0x52da83[_0x6a86('0x18')][_0x6a86('0x1a')]||null:null,'include':_0x52da83['options']?_0x52da83[_0x6a86('0x18')][_0x6a86('0x1c')]?_[_0x6a86('0x1d')](_0x52da83[_0x6a86('0x18')][_0x6a86('0x1c')],function(_0x3d2eb4){return{'model':db[_0x3d2eb4[_0x6a86('0x23')]],'as':_0x3d2eb4['as'],'attributes':_0x3d2eb4[_0x6a86('0x1a')],'include':_0x3d2eb4[_0x6a86('0x1c')]?_[_0x6a86('0x1d')](_0x3d2eb4[_0x6a86('0x1c')],function(_0x52f579){return{'model':db[_0x52f579[_0x6a86('0x23')]],'as':_0x52f579['as'],'attributes':_0x52f579['attributes'],'include':_0x52f579[_0x6a86('0x1c')]?_[_0x6a86('0x1d')](_0x52f579[_0x6a86('0x1c')],function(_0x1b99cd){return{'model':db[_0x1b99cd[_0x6a86('0x23')]],'as':_0x1b99cd['as'],'attributes':_0x1b99cd[_0x6a86('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6a86('0xd')](function(_0x54b5be){logger['info'](_0x6a86('0x20'),_0x52da83);logger['debug'](_0x6a86('0x20'),_0x52da83,JSON[_0x6a86('0x12')](_0x54b5be));_0x2308c0(_0x54b5be);})[_0x6a86('0x16')](function(_0x49b88a){logger[_0x6a86('0x13')](_0x6a86('0x20'),_0x49b88a['message'],_0x52da83);_0xbe0f3e(_0x556dc3[_0x6a86('0x13')](0x1f4,_0x49b88a['message']));});});}; \ No newline at end of file +var _0xe3cf=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','SugarcrmAccount','options','raw','where','attributes','include','map','model','GetSugarcrmAccount','debug','ShowSugarcrmAccount','stringify','util'];(function(_0x126f27,_0xf91068){var _0x4921d9=function(_0x1ef14d){while(--_0x1ef14d){_0x126f27['push'](_0x126f27['shift']());}};_0x4921d9(++_0xf91068);}(_0xe3cf,0xdf));var _0xfe3c=function(_0x3e5cda,_0x199500){_0x3e5cda=_0x3e5cda-0x0;var _0x196cab=_0xe3cf[_0x3e5cda];return _0x196cab;};'use strict';var _=require('lodash');var util=require(_0xfe3c('0x0'));var moment=require(_0xfe3c('0x1'));var BPromise=require(_0xfe3c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe3c('0x3'));var db=require(_0xfe3c('0x4'))['db'];var utils=require(_0xfe3c('0x5'));var logger=require('../../config/logger')(_0xfe3c('0x6'));var config=require(_0xfe3c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfe3c('0x8')][_0xfe3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb3e84e,_0x222cfc,_0x25472f){return new BPromise(function(_0x43c178,_0x85d5f0){return client[_0xfe3c('0xa')](_0xb3e84e,_0x25472f)[_0xfe3c('0xb')](function(_0x10cc21){logger[_0xfe3c('0xc')](_0xfe3c('0xd'),_0x222cfc,_0xfe3c('0xe'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x222cfc,_0xfe3c('0xe'),JSON['stringify'](_0x10cc21));if(_0x10cc21[_0xfe3c('0xf')]){if(_0x10cc21['error'][_0xfe3c('0x10')]===0x1f4){logger[_0xfe3c('0xf')](_0xfe3c('0xd'),_0x222cfc,_0x10cc21[_0xfe3c('0xf')][_0xfe3c('0x11')]);return _0x85d5f0(_0x10cc21[_0xfe3c('0xf')]['message']);}logger['error'](_0xfe3c('0xd'),_0x222cfc,_0x10cc21[_0xfe3c('0xf')][_0xfe3c('0x11')]);return _0x43c178(_0x10cc21[_0xfe3c('0xf')][_0xfe3c('0x11')]);}else{logger[_0xfe3c('0xc')](_0xfe3c('0xd'),_0x222cfc,_0xfe3c('0xe'));_0x43c178(_0x10cc21[_0xfe3c('0x12')][_0xfe3c('0x11')]);}})[_0xfe3c('0x13')](function(_0x4061f9){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x222cfc,_0x4061f9);_0x85d5f0(_0x4061f9);});});}exports['GetSugarcrmAccount']=function(_0x5ac99a){var _0x364ade=this;return new Promise(function(_0x306aa3,_0x3a211b){return db[_0xfe3c('0x14')]['findAll']({'raw':_0x5ac99a[_0xfe3c('0x15')]?_0x5ac99a[_0xfe3c('0x15')][_0xfe3c('0x16')]===undefined?!![]:![]:!![],'where':_0x5ac99a['options']?_0x5ac99a[_0xfe3c('0x15')][_0xfe3c('0x17')]||null:null,'attributes':_0x5ac99a[_0xfe3c('0x15')]?_0x5ac99a['options'][_0xfe3c('0x18')]||null:null,'limit':_0x5ac99a[_0xfe3c('0x15')]?_0x5ac99a['options']['limit']||null:null,'include':_0x5ac99a['options']?_0x5ac99a[_0xfe3c('0x15')][_0xfe3c('0x19')]?_[_0xfe3c('0x1a')](_0x5ac99a['options'][_0xfe3c('0x19')],function(_0x5240a3){return{'model':db[_0x5240a3[_0xfe3c('0x1b')]],'as':_0x5240a3['as'],'attributes':_0x5240a3[_0xfe3c('0x18')],'include':_0x5240a3[_0xfe3c('0x19')]?_[_0xfe3c('0x1a')](_0x5240a3[_0xfe3c('0x19')],function(_0x13e98e){return{'model':db[_0x13e98e[_0xfe3c('0x1b')]],'as':_0x13e98e['as'],'attributes':_0x13e98e['attributes'],'include':_0x13e98e[_0xfe3c('0x19')]?_[_0xfe3c('0x1a')](_0x13e98e[_0xfe3c('0x19')],function(_0x57494c){return{'model':db[_0x57494c[_0xfe3c('0x1b')]],'as':_0x57494c['as'],'attributes':_0x57494c[_0xfe3c('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfe3c('0xb')](function(_0x570015){logger['info'](_0xfe3c('0x1c'),_0x5ac99a);logger[_0xfe3c('0x1d')]('GetSugarcrmAccount',_0x5ac99a,JSON['stringify'](_0x570015));_0x306aa3(_0x570015);})[_0xfe3c('0x13')](function(_0x31395b){logger['error'](_0xfe3c('0x1c'),_0x31395b['message'],_0x5ac99a);_0x3a211b(_0x364ade['error'](0x1f4,_0x31395b[_0xfe3c('0x11')]));});});};exports[_0xfe3c('0x1e')]=function(_0x4d7292){var _0x432613=this;return new Promise(function(_0xf0d7b9,_0x57b458){return db[_0xfe3c('0x14')]['find']({'raw':_0x4d7292[_0xfe3c('0x15')]?_0x4d7292[_0xfe3c('0x15')][_0xfe3c('0x16')]===undefined?!![]:![]:!![],'where':_0x4d7292['options']?_0x4d7292[_0xfe3c('0x15')][_0xfe3c('0x17')]||null:null,'attributes':_0x4d7292[_0xfe3c('0x15')]?_0x4d7292[_0xfe3c('0x15')][_0xfe3c('0x18')]||null:null,'include':_0x4d7292[_0xfe3c('0x15')]?_0x4d7292[_0xfe3c('0x15')][_0xfe3c('0x19')]?_[_0xfe3c('0x1a')](_0x4d7292['options']['include'],function(_0x14b60c){return{'model':db[_0x14b60c[_0xfe3c('0x1b')]],'as':_0x14b60c['as'],'attributes':_0x14b60c[_0xfe3c('0x18')],'include':_0x14b60c[_0xfe3c('0x19')]?_[_0xfe3c('0x1a')](_0x14b60c[_0xfe3c('0x19')],function(_0x40d6fd){return{'model':db[_0x40d6fd[_0xfe3c('0x1b')]],'as':_0x40d6fd['as'],'attributes':_0x40d6fd[_0xfe3c('0x18')],'include':_0x40d6fd[_0xfe3c('0x19')]?_[_0xfe3c('0x1a')](_0x40d6fd[_0xfe3c('0x19')],function(_0xcdfdb8){return{'model':db[_0xcdfdb8[_0xfe3c('0x1b')]],'as':_0xcdfdb8['as'],'attributes':_0xcdfdb8['attributes']};}):[]};}):[]};}):[]:[]})[_0xfe3c('0xb')](function(_0x457b67){logger[_0xfe3c('0xc')](_0xfe3c('0x1e'),_0x4d7292);logger['debug']('ShowSugarcrmAccount',_0x4d7292,JSON[_0xfe3c('0x1f')](_0x457b67));_0xf0d7b9(_0x457b67);})['catch'](function(_0x18928d){logger[_0xfe3c('0xf')]('ShowSugarcrmAccount',_0x18928d[_0xfe3c('0x11')],_0x4d7292);_0x57b458(_0x432613[_0xfe3c('0xf')](0x1f4,_0x18928d[_0xfe3c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 1a7f043..990d47d 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 _0x97bb=['Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update','destroy','multer','path','connect-timeout'];(function(_0x372ee1,_0x45c637){var _0x31ea06=function(_0x3aba6a){while(--_0x3aba6a){_0x372ee1['push'](_0x372ee1['shift']());}};_0x31ea06(++_0x45c637);}(_0x97bb,0x1f1));var _0xb97b=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x97bb[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require(_0xb97b('0x0'));var util=require('util');var path=require(_0xb97b('0x1'));var timeout=require(_0xb97b('0x2'));var express=require('express');var router=express[_0xb97b('0x3')]();var fs_extra=require(_0xb97b('0x4'));var auth=require(_0xb97b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb97b('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0xb97b('0x7')](),controller['index']);router[_0xb97b('0x8')]('/:id',auth[_0xb97b('0x7')](),controller[_0xb97b('0x9')]);router[_0xb97b('0x8')](_0xb97b('0xa'),auth[_0xb97b('0x7')](),controller[_0xb97b('0xb')]);router['get']('/:id/subjects',auth[_0xb97b('0x7')](),controller[_0xb97b('0xc')]);router[_0xb97b('0x8')](_0xb97b('0xd'),auth[_0xb97b('0x7')](),controller[_0xb97b('0xe')]);router[_0xb97b('0xf')]('/',auth['isAuthenticated'](),controller[_0xb97b('0x10')]);router['put'](_0xb97b('0x11'),auth['isAuthenticated'](),controller[_0xb97b('0x12')]);router['delete'](_0xb97b('0x11'),auth['isAuthenticated'](),controller[_0xb97b('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1fde=['getDescriptions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x144b16,_0x528837){var _0x50369d=function(_0x589ed9){while(--_0x589ed9){_0x144b16['push'](_0x144b16['shift']());}};_0x50369d(++_0x528837);}(_0x1fde,0x1e8));var _0xe1fd=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x1fde[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xe1fd('0x0'));var util=require('util');var path=require(_0xe1fd('0x1'));var timeout=require(_0xe1fd('0x2'));var express=require(_0xe1fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe1fd('0x4'));var interaction=require(_0xe1fd('0x5'));var config=require('../../config/environment');var controller=require(_0xe1fd('0x6'));router[_0xe1fd('0x7')]('/',auth[_0xe1fd('0x8')](),controller[_0xe1fd('0x9')]);router[_0xe1fd('0x7')](_0xe1fd('0xa'),auth['isAuthenticated'](),controller[_0xe1fd('0xb')]);router[_0xe1fd('0x7')]('/:id/fields',auth[_0xe1fd('0x8')](),controller[_0xe1fd('0xc')]);router[_0xe1fd('0x7')](_0xe1fd('0xd'),auth[_0xe1fd('0x8')](),controller[_0xe1fd('0xe')]);router[_0xe1fd('0x7')](_0xe1fd('0xf'),auth[_0xe1fd('0x8')](),controller[_0xe1fd('0x10')]);router[_0xe1fd('0x11')]('/',auth['isAuthenticated'](),controller[_0xe1fd('0x12')]);router[_0xe1fd('0x13')](_0xe1fd('0xa'),auth[_0xe1fd('0x8')](),controller[_0xe1fd('0x14')]);router[_0xe1fd('0x15')](_0xe1fd('0xa'),auth[_0xe1fd('0x8')](),controller[_0xe1fd('0x16')]);module[_0xe1fd('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 26f056f..b7d28a7 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 _0x0c6c=['exports','STRING','sequelize'];(function(_0x4c2a33,_0x24d468){var _0x3d710d=function(_0x5866c1){while(--_0x5866c1){_0x4c2a33['push'](_0x4c2a33['shift']());}};_0x3d710d(++_0x24d468);}(_0x0c6c,0xf2));var _0xc0c6=function(_0x4d5d28,_0x26bd9b){_0x4d5d28=_0x4d5d28-0x0;var _0x2026b1=_0x0c6c[_0x4d5d28];return _0x2026b1;};'use strict';var Sequelize=require(_0xc0c6('0x0'));module[_0xc0c6('0x1')]={'name':{'type':Sequelize[_0xc0c6('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x949a=['exports','STRING','sequelize'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x949a,0x6b));var _0xa949=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x949a[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xa949('0x0'));module[_0xa949('0x1')]={'name':{'type':Sequelize[_0xa949('0x2')]},'description':{'type':Sequelize[_0xa949('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 797c4b5..e6ff74f 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 _0xeba8=['set','update','then','name','send','index','map','SugarcrmConfiguration','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','destroy','findOne','SugarcrmField','order','getFields','getSubjects','getDescriptions','eml-format','rimraf','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','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x2c0ab1,_0x3cbc37){var _0x3afae7=function(_0x4ccb6d){while(--_0x4ccb6d){_0x2c0ab1['push'](_0x2c0ab1['shift']());}};_0x3afae7(++_0x3cbc37);}(_0xeba8,0xd0));var _0x8eba=function(_0x1138c4,_0x841d33){_0x1138c4=_0x1138c4-0x0;var _0x200cc1=_0xeba8[_0x1138c4];return _0x200cc1;};'use strict';var emlformat=require(_0x8eba('0x0'));var rimraf=require(_0x8eba('0x1'));var zipdir=require(_0x8eba('0x2'));var jsonpatch=require(_0x8eba('0x3'));var rp=require(_0x8eba('0x4'));var moment=require('moment');var BPromise=require(_0x8eba('0x5'));var Mustache=require(_0x8eba('0x6'));var util=require('util');var path=require(_0x8eba('0x7'));var sox=require(_0x8eba('0x8'));var csv=require(_0x8eba('0x9'));var ejs=require(_0x8eba('0xa'));var fs=require('fs');var fs_extra=require(_0x8eba('0xb'));var _=require(_0x8eba('0xc'));var squel=require(_0x8eba('0xd'));var crypto=require(_0x8eba('0xe'));var jsforce=require(_0x8eba('0xf'));var deskjs=require(_0x8eba('0x10'));var toCsv=require(_0x8eba('0x9'));var querystring=require(_0x8eba('0x11'));var Papa=require(_0x8eba('0x12'));var Redis=require(_0x8eba('0x13'));var authService=require(_0x8eba('0x14'));var qs=require(_0x8eba('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8eba('0x16'));var logger=require('../../config/logger')(_0x8eba('0x17'));var utils=require(_0x8eba('0x18'));var config=require(_0x8eba('0x19'));var licenseUtil=require(_0x8eba('0x1a'));var db=require(_0x8eba('0x1b'))['db'];function respondWithStatusCode(_0x22c274,_0x3bf9bb){_0x3bf9bb=_0x3bf9bb||0xcc;return function(_0x40acca){if(_0x40acca){return _0x22c274[_0x8eba('0x1c')](_0x3bf9bb);}return _0x22c274[_0x8eba('0x1d')](_0x3bf9bb)[_0x8eba('0x1e')]();};}function respondWithResult(_0x14e008,_0x255ea5){_0x255ea5=_0x255ea5||0xc8;return function(_0x26d366){if(_0x26d366){return _0x14e008[_0x8eba('0x1d')](_0x255ea5)[_0x8eba('0x1f')](_0x26d366);}};}function respondWithFilteredResult(_0x550eb9,_0x374305){return function(_0x3611c5){if(_0x3611c5){var _0x29d128=typeof _0x374305[_0x8eba('0x20')]===_0x8eba('0x21')&&typeof _0x374305[_0x8eba('0x22')]===_0x8eba('0x21');var _0x3be34a=_0x3611c5['count'];var _0x32b7a8=_0x29d128?0x0:_0x374305[_0x8eba('0x20')];var _0x8b5453=_0x29d128?_0x3611c5['count']:_0x374305[_0x8eba('0x20')]+_0x374305['limit'];var _0x2950c2;if(_0x8b5453>=_0x3be34a){_0x8b5453=_0x3be34a;_0x2950c2=0xc8;}else{_0x2950c2=0xce;}_0x550eb9[_0x8eba('0x1d')](_0x2950c2);return _0x550eb9[_0x8eba('0x23')]('Content-Range',_0x32b7a8+'-'+_0x8b5453+'/'+_0x3be34a)[_0x8eba('0x1f')](_0x3611c5);}return null;};}function patchUpdates(_0x1bd32a){return function(_0x60bfd7){try{jsonpatch['apply'](_0x60bfd7,_0x1bd32a,!![]);}catch(_0x256da8){return BPromise['reject'](_0x256da8);}return _0x60bfd7['save']();};}function saveUpdates(_0x48b2ed,_0x48511b){return function(_0x192b13){if(_0x192b13){return _0x192b13[_0x8eba('0x24')](_0x48b2ed)[_0x8eba('0x25')](function(_0x1ae259){return _0x1ae259;});}return null;};}function removeEntity(_0x519cb3,_0x528e35){return function(_0x31b111){if(_0x31b111){return _0x31b111['destroy']()[_0x8eba('0x25')](function(){_0x519cb3[_0x8eba('0x1d')](0xcc)[_0x8eba('0x1e')]();});}};}function handleEntityNotFound(_0x6a8351,_0x914ecb){return function(_0x56f9dd){if(!_0x56f9dd){_0x6a8351['sendStatus'](0x194);}return _0x56f9dd;};}function handleError(_0x3b7b51,_0x4478df){_0x4478df=_0x4478df||0x1f4;return function(_0x5bd361){logger['error'](_0x5bd361['stack']);if(_0x5bd361['name']){delete _0x5bd361[_0x8eba('0x26')];}_0x3b7b51[_0x8eba('0x1d')](_0x4478df)[_0x8eba('0x27')](_0x5bd361);};}exports[_0x8eba('0x28')]=function(_0xf23958,_0xe8884d){var _0x1a59af={},_0x527bd3={},_0x5776d5={'count':0x0,'rows':[]};var _0x30607c=_[_0x8eba('0x29')](db[_0x8eba('0x2a')]['rawAttributes'],function(_0x574f32){return{'name':_0x574f32['fieldName'],'type':_0x574f32['type'][_0x8eba('0x2b')]};});_0x527bd3[_0x8eba('0x2c')]=_[_0x8eba('0x29')](_0x30607c,'name');_0x527bd3[_0x8eba('0x2d')]=_[_0x8eba('0x2e')](_0xf23958['query']);_0x527bd3[_0x8eba('0x2f')]=_[_0x8eba('0x30')](_0x527bd3['model'],_0x527bd3[_0x8eba('0x2d')]);_0x1a59af[_0x8eba('0x31')]=_[_0x8eba('0x30')](_0x527bd3[_0x8eba('0x2c')],qs['fields'](_0xf23958[_0x8eba('0x2d')][_0x8eba('0x32')]));_0x1a59af[_0x8eba('0x31')]=_0x1a59af[_0x8eba('0x31')]['length']?_0x1a59af[_0x8eba('0x31')]:_0x527bd3['model'];if(!_0xf23958[_0x8eba('0x2d')][_0x8eba('0x33')](_0x8eba('0x34'))){_0x1a59af[_0x8eba('0x22')]=qs[_0x8eba('0x22')](_0xf23958[_0x8eba('0x2d')][_0x8eba('0x22')]);_0x1a59af[_0x8eba('0x20')]=qs[_0x8eba('0x20')](_0xf23958[_0x8eba('0x2d')][_0x8eba('0x20')]);}_0x1a59af['order']=qs['sort'](_0xf23958[_0x8eba('0x2d')][_0x8eba('0x35')]);_0x1a59af[_0x8eba('0x36')]=qs[_0x8eba('0x2f')](_[_0x8eba('0x37')](_0xf23958[_0x8eba('0x2d')],_0x527bd3[_0x8eba('0x2f')]),_0x30607c);if(_0xf23958[_0x8eba('0x2d')][_0x8eba('0x38')]){_0x1a59af['where']=_[_0x8eba('0x39')](_0x1a59af[_0x8eba('0x36')],{'$or':_[_0x8eba('0x29')](_0x30607c,function(_0x44ee7d){if(_0x44ee7d[_0x8eba('0x3a')]!==_0x8eba('0x3b')){var _0x1362a5={};_0x1362a5[_0x44ee7d[_0x8eba('0x26')]]={'$like':'%'+_0xf23958[_0x8eba('0x2d')][_0x8eba('0x38')]+'%'};return _0x1362a5;}})});}_0x1a59af=_[_0x8eba('0x39')]({},_0x1a59af,_0xf23958[_0x8eba('0x3c')]);var _0x2a9554={'where':_0x1a59af['where']};return db[_0x8eba('0x2a')][_0x8eba('0x3d')](_0x2a9554)['then'](function(_0x5c3461){_0x5776d5[_0x8eba('0x3d')]=_0x5c3461;if(_0xf23958[_0x8eba('0x2d')][_0x8eba('0x3e')]){_0x1a59af[_0x8eba('0x3f')]=[{'all':!![]}];}return db[_0x8eba('0x2a')][_0x8eba('0x40')](_0x1a59af);})['then'](function(_0x4060d5){_0x5776d5[_0x8eba('0x41')]=_0x4060d5;return _0x5776d5;})['then'](respondWithFilteredResult(_0xe8884d,_0x1a59af))[_0x8eba('0x42')](handleError(_0xe8884d,null));};exports[_0x8eba('0x43')]=function(_0x588a96,_0x5dcf5a){var _0x454801={'raw':![],'where':{'id':_0x588a96[_0x8eba('0x44')]['id']}},_0x4e3102={};_0x4e3102['model']=_['keys'](db['SugarcrmConfiguration'][_0x8eba('0x45')]);_0x4e3102[_0x8eba('0x2d')]=_['keys'](_0x588a96['query']);_0x4e3102[_0x8eba('0x2f')]=_[_0x8eba('0x30')](_0x4e3102[_0x8eba('0x2c')],_0x4e3102[_0x8eba('0x2d')]);_0x454801[_0x8eba('0x31')]=_[_0x8eba('0x30')](_0x4e3102['model'],qs[_0x8eba('0x32')](_0x588a96[_0x8eba('0x2d')][_0x8eba('0x32')]));_0x454801[_0x8eba('0x31')]=_0x454801['attributes'][_0x8eba('0x46')]?_0x454801[_0x8eba('0x31')]:_0x4e3102[_0x8eba('0x2c')];if(_0x588a96[_0x8eba('0x2d')][_0x8eba('0x3e')]){_0x454801['include']=[{'all':!![]}];}_0x454801=_[_0x8eba('0x39')]({},_0x454801,_0x588a96[_0x8eba('0x3c')]);return db[_0x8eba('0x2a')][_0x8eba('0x47')](_0x454801)[_0x8eba('0x25')](handleEntityNotFound(_0x5dcf5a,null))[_0x8eba('0x25')](respondWithResult(_0x5dcf5a,null))[_0x8eba('0x42')](handleError(_0x5dcf5a,null));};exports[_0x8eba('0x48')]=function(_0x241f11,_0xcb50cc){return db[_0x8eba('0x2a')]['create'](_0x241f11['body'],{})[_0x8eba('0x25')](respondWithResult(_0xcb50cc,0xc9))[_0x8eba('0x42')](handleError(_0xcb50cc,null));};exports[_0x8eba('0x24')]=function(_0x4a7335,_0xb56c4){if(_0x4a7335['body']['id']){delete _0x4a7335[_0x8eba('0x49')]['id'];}return db[_0x8eba('0x2a')][_0x8eba('0x47')]({'where':{'id':_0x4a7335[_0x8eba('0x44')]['id']}})[_0x8eba('0x25')](handleEntityNotFound(_0xb56c4,null))[_0x8eba('0x25')](saveUpdates(_0x4a7335[_0x8eba('0x49')],null))[_0x8eba('0x25')](respondWithResult(_0xb56c4,null))[_0x8eba('0x42')](handleError(_0xb56c4,null));};exports[_0x8eba('0x4a')]=function(_0x286da8,_0x305454){return db['SugarcrmConfiguration'][_0x8eba('0x47')]({'where':{'id':_0x286da8[_0x8eba('0x44')]['id']}})['then'](handleEntityNotFound(_0x305454,null))[_0x8eba('0x25')](removeEntity(_0x305454,null))[_0x8eba('0x42')](handleError(_0x305454,null));};exports['getFields']=function(_0x277761,_0x4d47a7,_0x27ddb0){var _0x1b8700={};var _0x3a446a={};var _0xed155c;var _0xe442a3;return db['SugarcrmConfiguration'][_0x8eba('0x4b')]({'where':{'id':_0x277761[_0x8eba('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d47a7,null))[_0x8eba('0x25')](function(_0x401449){if(_0x401449){_0xed155c=_0x401449;_0x3a446a[_0x8eba('0x2c')]=_['keys'](db[_0x8eba('0x4c')]['rawAttributes']);_0x3a446a[_0x8eba('0x2d')]=_[_0x8eba('0x2e')](_0x277761[_0x8eba('0x2d')]);_0x3a446a[_0x8eba('0x2f')]=_[_0x8eba('0x30')](_0x3a446a[_0x8eba('0x2c')],_0x3a446a[_0x8eba('0x2d')]);_0x1b8700['attributes']=_[_0x8eba('0x30')](_0x3a446a[_0x8eba('0x2c')],qs[_0x8eba('0x32')](_0x277761[_0x8eba('0x2d')]['fields']));_0x1b8700[_0x8eba('0x31')]=_0x1b8700[_0x8eba('0x31')][_0x8eba('0x46')]?_0x1b8700[_0x8eba('0x31')]:_0x3a446a[_0x8eba('0x2c')];_0x1b8700[_0x8eba('0x4d')]=qs['sort'](_0x277761[_0x8eba('0x2d')][_0x8eba('0x35')]);_0x1b8700['where']=qs[_0x8eba('0x2f')](_[_0x8eba('0x37')](_0x277761[_0x8eba('0x2d')],_0x3a446a[_0x8eba('0x2f')]));if(_0x277761[_0x8eba('0x2d')][_0x8eba('0x38')]){_0x1b8700['where']=_[_0x8eba('0x39')](_0x1b8700[_0x8eba('0x36')],{'$or':_[_0x8eba('0x29')](_0x1b8700[_0x8eba('0x31')],function(_0x16b7e1){var _0x581b2f={};_0x581b2f[_0x16b7e1]={'$like':'%'+_0x277761[_0x8eba('0x2d')][_0x8eba('0x38')]+'%'};return _0x581b2f;})});}_0x1b8700=_['merge']({},_0x1b8700,_0x277761[_0x8eba('0x3c')]);return _0xed155c[_0x8eba('0x4e')](_0x1b8700);}})[_0x8eba('0x25')](function(_0x5481d1){if(_0x5481d1){_0xe442a3=_0x5481d1[_0x8eba('0x46')];if(!_0x277761[_0x8eba('0x2d')][_0x8eba('0x33')](_0x8eba('0x34'))){_0x1b8700[_0x8eba('0x22')]=qs[_0x8eba('0x22')](_0x277761[_0x8eba('0x2d')][_0x8eba('0x22')]);_0x1b8700['offset']=qs[_0x8eba('0x20')](_0x277761[_0x8eba('0x2d')]['offset']);}return _0xed155c[_0x8eba('0x4e')](_0x1b8700);}})[_0x8eba('0x25')](function(_0x394425){if(_0x394425){return _0x394425?{'count':_0xe442a3,'rows':_0x394425}:null;}})['then'](respondWithResult(_0x4d47a7,null))[_0x8eba('0x42')](handleError(_0x4d47a7,null));};exports[_0x8eba('0x4f')]=function(_0x7de4ef,_0x1e994e,_0x41bd0e){var _0x355c4f={};var _0x23e4ac={};var _0x263cc6;var _0x2f999c;return db['SugarcrmConfiguration'][_0x8eba('0x4b')]({'where':{'id':_0x7de4ef[_0x8eba('0x44')]['id']}})[_0x8eba('0x25')](handleEntityNotFound(_0x1e994e,null))['then'](function(_0x43788c){if(_0x43788c){_0x263cc6=_0x43788c;_0x23e4ac[_0x8eba('0x2c')]=_['keys'](db[_0x8eba('0x4c')]['rawAttributes']);_0x23e4ac['query']=_[_0x8eba('0x2e')](_0x7de4ef[_0x8eba('0x2d')]);_0x23e4ac[_0x8eba('0x2f')]=_[_0x8eba('0x30')](_0x23e4ac[_0x8eba('0x2c')],_0x23e4ac[_0x8eba('0x2d')]);_0x355c4f['attributes']=_['intersection'](_0x23e4ac[_0x8eba('0x2c')],qs['fields'](_0x7de4ef[_0x8eba('0x2d')][_0x8eba('0x32')]));_0x355c4f[_0x8eba('0x31')]=_0x355c4f['attributes']['length']?_0x355c4f[_0x8eba('0x31')]:_0x23e4ac[_0x8eba('0x2c')];_0x355c4f[_0x8eba('0x4d')]=qs[_0x8eba('0x35')](_0x7de4ef[_0x8eba('0x2d')][_0x8eba('0x35')]);_0x355c4f[_0x8eba('0x36')]=qs['filters'](_[_0x8eba('0x37')](_0x7de4ef[_0x8eba('0x2d')],_0x23e4ac[_0x8eba('0x2f')]));if(_0x7de4ef[_0x8eba('0x2d')]['filter']){_0x355c4f['where']=_[_0x8eba('0x39')](_0x355c4f[_0x8eba('0x36')],{'$or':_['map'](_0x355c4f[_0x8eba('0x31')],function(_0x19857f){var _0x33e098={};_0x33e098[_0x19857f]={'$like':'%'+_0x7de4ef[_0x8eba('0x2d')][_0x8eba('0x38')]+'%'};return _0x33e098;})});}_0x355c4f=_[_0x8eba('0x39')]({},_0x355c4f,_0x7de4ef[_0x8eba('0x3c')]);return _0x263cc6[_0x8eba('0x4f')](_0x355c4f);}})['then'](function(_0xfb513e){if(_0xfb513e){_0x2f999c=_0xfb513e[_0x8eba('0x46')];if(!_0x7de4ef[_0x8eba('0x2d')][_0x8eba('0x33')]('nolimit')){_0x355c4f[_0x8eba('0x22')]=qs[_0x8eba('0x22')](_0x7de4ef[_0x8eba('0x2d')][_0x8eba('0x22')]);_0x355c4f['offset']=qs['offset'](_0x7de4ef['query'][_0x8eba('0x20')]);}return _0x263cc6['getSubjects'](_0x355c4f);}})[_0x8eba('0x25')](function(_0x5160bd){if(_0x5160bd){return _0x5160bd?{'count':_0x2f999c,'rows':_0x5160bd}:null;}})[_0x8eba('0x25')](respondWithResult(_0x1e994e,null))[_0x8eba('0x42')](handleError(_0x1e994e,null));};exports[_0x8eba('0x50')]=function(_0x5e5796,_0x35c0d4,_0x302d93){var _0x5edc78={};var _0x269dae={};var _0x150ee4;var _0x5aae28;return db[_0x8eba('0x2a')][_0x8eba('0x4b')]({'where':{'id':_0x5e5796[_0x8eba('0x44')]['id']}})[_0x8eba('0x25')](handleEntityNotFound(_0x35c0d4,null))[_0x8eba('0x25')](function(_0x1bd740){if(_0x1bd740){_0x150ee4=_0x1bd740;_0x269dae[_0x8eba('0x2c')]=_[_0x8eba('0x2e')](db[_0x8eba('0x4c')][_0x8eba('0x45')]);_0x269dae[_0x8eba('0x2d')]=_['keys'](_0x5e5796[_0x8eba('0x2d')]);_0x269dae[_0x8eba('0x2f')]=_[_0x8eba('0x30')](_0x269dae['model'],_0x269dae[_0x8eba('0x2d')]);_0x5edc78[_0x8eba('0x31')]=_[_0x8eba('0x30')](_0x269dae[_0x8eba('0x2c')],qs[_0x8eba('0x32')](_0x5e5796[_0x8eba('0x2d')][_0x8eba('0x32')]));_0x5edc78['attributes']=_0x5edc78[_0x8eba('0x31')][_0x8eba('0x46')]?_0x5edc78[_0x8eba('0x31')]:_0x269dae[_0x8eba('0x2c')];_0x5edc78[_0x8eba('0x4d')]=qs['sort'](_0x5e5796[_0x8eba('0x2d')]['sort']);_0x5edc78[_0x8eba('0x36')]=qs[_0x8eba('0x2f')](_[_0x8eba('0x37')](_0x5e5796[_0x8eba('0x2d')],_0x269dae['filters']));if(_0x5e5796[_0x8eba('0x2d')][_0x8eba('0x38')]){_0x5edc78[_0x8eba('0x36')]=_[_0x8eba('0x39')](_0x5edc78[_0x8eba('0x36')],{'$or':_[_0x8eba('0x29')](_0x5edc78[_0x8eba('0x31')],function(_0x23e12a){var _0x3f2501={};_0x3f2501[_0x23e12a]={'$like':'%'+_0x5e5796[_0x8eba('0x2d')]['filter']+'%'};return _0x3f2501;})});}_0x5edc78=_[_0x8eba('0x39')]({},_0x5edc78,_0x5e5796[_0x8eba('0x3c')]);return _0x150ee4[_0x8eba('0x50')](_0x5edc78);}})[_0x8eba('0x25')](function(_0x1abded){if(_0x1abded){_0x5aae28=_0x1abded[_0x8eba('0x46')];if(!_0x5e5796[_0x8eba('0x2d')][_0x8eba('0x33')](_0x8eba('0x34'))){_0x5edc78[_0x8eba('0x22')]=qs[_0x8eba('0x22')](_0x5e5796[_0x8eba('0x2d')][_0x8eba('0x22')]);_0x5edc78[_0x8eba('0x20')]=qs[_0x8eba('0x20')](_0x5e5796[_0x8eba('0x2d')][_0x8eba('0x20')]);}return _0x150ee4[_0x8eba('0x50')](_0x5edc78);}})[_0x8eba('0x25')](function(_0x5b937a){if(_0x5b937a){return _0x5b937a?{'count':_0x5aae28,'rows':_0x5b937a}:null;}})[_0x8eba('0x25')](respondWithResult(_0x35c0d4,null))[_0x8eba('0x42')](handleError(_0x35c0d4,null));}; \ No newline at end of file +var _0xc2b3=['options','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','stack','name','index','map','SugarcrmConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','find','catch','create','body','params','getFields','findOne','SugarcrmField'];(function(_0x2648c3,_0xcc8452){var _0x5805bc=function(_0x4f6a8d){while(--_0x4f6a8d){_0x2648c3['push'](_0x2648c3['shift']());}};_0x5805bc(++_0xcc8452);}(_0xc2b3,0xa9));var _0x3c2b=function(_0x256b6f,_0xb810f){_0x256b6f=_0x256b6f-0x0;var _0x4aa0e8=_0xc2b3[_0x256b6f];return _0x4aa0e8;};'use strict';var emlformat=require(_0x3c2b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c2b('0x1'));var jsonpatch=require(_0x3c2b('0x2'));var rp=require(_0x3c2b('0x3'));var moment=require(_0x3c2b('0x4'));var BPromise=require(_0x3c2b('0x5'));var Mustache=require(_0x3c2b('0x6'));var util=require(_0x3c2b('0x7'));var path=require(_0x3c2b('0x8'));var sox=require(_0x3c2b('0x9'));var csv=require(_0x3c2b('0xa'));var ejs=require(_0x3c2b('0xb'));var fs=require('fs');var fs_extra=require(_0x3c2b('0xc'));var _=require(_0x3c2b('0xd'));var squel=require('squel');var crypto=require(_0x3c2b('0xe'));var jsforce=require(_0x3c2b('0xf'));var deskjs=require(_0x3c2b('0x10'));var toCsv=require(_0x3c2b('0xa'));var querystring=require(_0x3c2b('0x11'));var Papa=require(_0x3c2b('0x12'));var Redis=require(_0x3c2b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3c2b('0x14'));var as=require(_0x3c2b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c2b('0x16'))(_0x3c2b('0x17'));var utils=require(_0x3c2b('0x18'));var config=require(_0x3c2b('0x19'));var licenseUtil=require(_0x3c2b('0x1a'));var db=require(_0x3c2b('0x1b'))['db'];function respondWithStatusCode(_0x36316e,_0x5055a7){_0x5055a7=_0x5055a7||0xcc;return function(_0x5d92d4){if(_0x5d92d4){return _0x36316e[_0x3c2b('0x1c')](_0x5055a7);}return _0x36316e[_0x3c2b('0x1d')](_0x5055a7)[_0x3c2b('0x1e')]();};}function respondWithResult(_0x29e070,_0x406fa5){_0x406fa5=_0x406fa5||0xc8;return function(_0x215869){if(_0x215869){return _0x29e070['status'](_0x406fa5)[_0x3c2b('0x1f')](_0x215869);}};}function respondWithFilteredResult(_0x256dea,_0x46a1a4){return function(_0xe97a8d){if(_0xe97a8d){var _0x1802e3=typeof _0x46a1a4[_0x3c2b('0x20')]==='undefined'&&typeof _0x46a1a4[_0x3c2b('0x21')]===_0x3c2b('0x22');var _0x1d6b9c=_0xe97a8d[_0x3c2b('0x23')];var _0x4fd7f3=_0x1802e3?0x0:_0x46a1a4[_0x3c2b('0x20')];var _0x1afc1d=_0x1802e3?_0xe97a8d[_0x3c2b('0x23')]:_0x46a1a4[_0x3c2b('0x20')]+_0x46a1a4[_0x3c2b('0x21')];var _0x1305dc;if(_0x1afc1d>=_0x1d6b9c){_0x1afc1d=_0x1d6b9c;_0x1305dc=0xc8;}else{_0x1305dc=0xce;}_0x256dea[_0x3c2b('0x1d')](_0x1305dc);return _0x256dea[_0x3c2b('0x24')]('Content-Range',_0x4fd7f3+'-'+_0x1afc1d+'/'+_0x1d6b9c)[_0x3c2b('0x1f')](_0xe97a8d);}return null;};}function patchUpdates(_0x1abe5a){return function(_0x5d6a4a){try{jsonpatch[_0x3c2b('0x25')](_0x5d6a4a,_0x1abe5a,!![]);}catch(_0x2e215e){return BPromise[_0x3c2b('0x26')](_0x2e215e);}return _0x5d6a4a['save']();};}function saveUpdates(_0x2b3880,_0x5eb745){return function(_0x400d17){if(_0x400d17){return _0x400d17[_0x3c2b('0x27')](_0x2b3880)[_0x3c2b('0x28')](function(_0x33dcca){return _0x33dcca;});}return null;};}function removeEntity(_0xf90b4b,_0x57ec15){return function(_0x56dc20){if(_0x56dc20){return _0x56dc20[_0x3c2b('0x29')]()[_0x3c2b('0x28')](function(){_0xf90b4b['status'](0xcc)[_0x3c2b('0x1e')]();});}};}function handleEntityNotFound(_0x42f26c,_0x1f069b){return function(_0x48d31b){if(!_0x48d31b){_0x42f26c[_0x3c2b('0x1c')](0x194);}return _0x48d31b;};}function handleError(_0x5006f0,_0x212898){_0x212898=_0x212898||0x1f4;return function(_0x349917){logger['error'](_0x349917[_0x3c2b('0x2a')]);if(_0x349917[_0x3c2b('0x2b')]){delete _0x349917[_0x3c2b('0x2b')];}_0x5006f0[_0x3c2b('0x1d')](_0x212898)['send'](_0x349917);};}exports[_0x3c2b('0x2c')]=function(_0x54859f,_0x34e1b1){var _0xf5c3c2={},_0x457622={},_0x33d249={'count':0x0,'rows':[]};var _0x317ea1=_[_0x3c2b('0x2d')](db[_0x3c2b('0x2e')][_0x3c2b('0x2f')],function(_0x51e379){return{'name':_0x51e379['fieldName'],'type':_0x51e379[_0x3c2b('0x30')][_0x3c2b('0x31')]};});_0x457622[_0x3c2b('0x32')]=_[_0x3c2b('0x2d')](_0x317ea1,_0x3c2b('0x2b'));_0x457622[_0x3c2b('0x33')]=_[_0x3c2b('0x34')](_0x54859f[_0x3c2b('0x33')]);_0x457622[_0x3c2b('0x35')]=_[_0x3c2b('0x36')](_0x457622[_0x3c2b('0x32')],_0x457622[_0x3c2b('0x33')]);_0xf5c3c2['attributes']=_['intersection'](_0x457622[_0x3c2b('0x32')],qs['fields'](_0x54859f[_0x3c2b('0x33')][_0x3c2b('0x37')]));_0xf5c3c2['attributes']=_0xf5c3c2[_0x3c2b('0x38')][_0x3c2b('0x39')]?_0xf5c3c2['attributes']:_0x457622[_0x3c2b('0x32')];if(!_0x54859f['query'][_0x3c2b('0x3a')](_0x3c2b('0x3b'))){_0xf5c3c2[_0x3c2b('0x21')]=qs[_0x3c2b('0x21')](_0x54859f[_0x3c2b('0x33')][_0x3c2b('0x21')]);_0xf5c3c2[_0x3c2b('0x20')]=qs[_0x3c2b('0x20')](_0x54859f[_0x3c2b('0x33')]['offset']);}_0xf5c3c2[_0x3c2b('0x3c')]=qs[_0x3c2b('0x3d')](_0x54859f[_0x3c2b('0x33')][_0x3c2b('0x3d')]);_0xf5c3c2[_0x3c2b('0x3e')]=qs[_0x3c2b('0x35')](_[_0x3c2b('0x3f')](_0x54859f['query'],_0x457622[_0x3c2b('0x35')]),_0x317ea1);if(_0x54859f['query']['filter']){_0xf5c3c2[_0x3c2b('0x3e')]=_[_0x3c2b('0x40')](_0xf5c3c2[_0x3c2b('0x3e')],{'$or':_[_0x3c2b('0x2d')](_0x317ea1,function(_0x2348cd){if(_0x2348cd[_0x3c2b('0x30')]!==_0x3c2b('0x41')){var _0x2ae016={};_0x2ae016[_0x2348cd[_0x3c2b('0x2b')]]={'$like':'%'+_0x54859f[_0x3c2b('0x33')][_0x3c2b('0x42')]+'%'};return _0x2ae016;}})});}_0xf5c3c2=_['merge']({},_0xf5c3c2,_0x54859f['options']);var _0x633935={'where':_0xf5c3c2[_0x3c2b('0x3e')]};return db[_0x3c2b('0x2e')][_0x3c2b('0x23')](_0x633935)['then'](function(_0x36e84f){_0x33d249[_0x3c2b('0x23')]=_0x36e84f;if(_0x54859f[_0x3c2b('0x33')][_0x3c2b('0x43')]){_0xf5c3c2[_0x3c2b('0x44')]=[{'all':!![]}];}return db[_0x3c2b('0x2e')][_0x3c2b('0x45')](_0xf5c3c2);})[_0x3c2b('0x28')](function(_0x2f1a83){_0x33d249[_0x3c2b('0x46')]=_0x2f1a83;return _0x33d249;})[_0x3c2b('0x28')](respondWithFilteredResult(_0x34e1b1,_0xf5c3c2))['catch'](handleError(_0x34e1b1,null));};exports[_0x3c2b('0x47')]=function(_0xc9eccc,_0x13b934){var _0x1ffd31={'raw':![],'where':{'id':_0xc9eccc['params']['id']}},_0x53b634={};_0x53b634[_0x3c2b('0x32')]=_[_0x3c2b('0x34')](db[_0x3c2b('0x2e')][_0x3c2b('0x2f')]);_0x53b634[_0x3c2b('0x33')]=_[_0x3c2b('0x34')](_0xc9eccc[_0x3c2b('0x33')]);_0x53b634[_0x3c2b('0x35')]=_[_0x3c2b('0x36')](_0x53b634[_0x3c2b('0x32')],_0x53b634[_0x3c2b('0x33')]);_0x1ffd31[_0x3c2b('0x38')]=_[_0x3c2b('0x36')](_0x53b634['model'],qs['fields'](_0xc9eccc[_0x3c2b('0x33')][_0x3c2b('0x37')]));_0x1ffd31[_0x3c2b('0x38')]=_0x1ffd31[_0x3c2b('0x38')]['length']?_0x1ffd31[_0x3c2b('0x38')]:_0x53b634[_0x3c2b('0x32')];if(_0xc9eccc[_0x3c2b('0x33')][_0x3c2b('0x43')]){_0x1ffd31['include']=[{'all':!![]}];}_0x1ffd31=_[_0x3c2b('0x40')]({},_0x1ffd31,_0xc9eccc['options']);return db[_0x3c2b('0x2e')][_0x3c2b('0x48')](_0x1ffd31)['then'](handleEntityNotFound(_0x13b934,null))['then'](respondWithResult(_0x13b934,null))[_0x3c2b('0x49')](handleError(_0x13b934,null));};exports[_0x3c2b('0x4a')]=function(_0x59838d,_0x128441){return db[_0x3c2b('0x2e')][_0x3c2b('0x4a')](_0x59838d['body'],{})['then'](respondWithResult(_0x128441,0xc9))['catch'](handleError(_0x128441,null));};exports['update']=function(_0x177ae1,_0x78f629){if(_0x177ae1[_0x3c2b('0x4b')]['id']){delete _0x177ae1[_0x3c2b('0x4b')]['id'];}return db[_0x3c2b('0x2e')][_0x3c2b('0x48')]({'where':{'id':_0x177ae1[_0x3c2b('0x4c')]['id']}})[_0x3c2b('0x28')](handleEntityNotFound(_0x78f629,null))[_0x3c2b('0x28')](saveUpdates(_0x177ae1[_0x3c2b('0x4b')],null))[_0x3c2b('0x28')](respondWithResult(_0x78f629,null))[_0x3c2b('0x49')](handleError(_0x78f629,null));};exports[_0x3c2b('0x29')]=function(_0x5bfe6d,_0x19df58){return db[_0x3c2b('0x2e')]['find']({'where':{'id':_0x5bfe6d['params']['id']}})[_0x3c2b('0x28')](handleEntityNotFound(_0x19df58,null))[_0x3c2b('0x28')](removeEntity(_0x19df58,null))[_0x3c2b('0x49')](handleError(_0x19df58,null));};exports[_0x3c2b('0x4d')]=function(_0x43c85f,_0x302aef,_0x274f6d){var _0x17653c={};var _0x35d141={};var _0x192128;var _0x10f12e;return db[_0x3c2b('0x2e')][_0x3c2b('0x4e')]({'where':{'id':_0x43c85f[_0x3c2b('0x4c')]['id']}})[_0x3c2b('0x28')](handleEntityNotFound(_0x302aef,null))[_0x3c2b('0x28')](function(_0x5f3455){if(_0x5f3455){_0x192128=_0x5f3455;_0x35d141[_0x3c2b('0x32')]=_[_0x3c2b('0x34')](db[_0x3c2b('0x4f')]['rawAttributes']);_0x35d141[_0x3c2b('0x33')]=_[_0x3c2b('0x34')](_0x43c85f['query']);_0x35d141['filters']=_[_0x3c2b('0x36')](_0x35d141[_0x3c2b('0x32')],_0x35d141[_0x3c2b('0x33')]);_0x17653c[_0x3c2b('0x38')]=_[_0x3c2b('0x36')](_0x35d141[_0x3c2b('0x32')],qs[_0x3c2b('0x37')](_0x43c85f[_0x3c2b('0x33')][_0x3c2b('0x37')]));_0x17653c[_0x3c2b('0x38')]=_0x17653c[_0x3c2b('0x38')]['length']?_0x17653c[_0x3c2b('0x38')]:_0x35d141[_0x3c2b('0x32')];_0x17653c[_0x3c2b('0x3c')]=qs['sort'](_0x43c85f[_0x3c2b('0x33')][_0x3c2b('0x3d')]);_0x17653c[_0x3c2b('0x3e')]=qs[_0x3c2b('0x35')](_[_0x3c2b('0x3f')](_0x43c85f[_0x3c2b('0x33')],_0x35d141[_0x3c2b('0x35')]));if(_0x43c85f[_0x3c2b('0x33')][_0x3c2b('0x42')]){_0x17653c['where']=_[_0x3c2b('0x40')](_0x17653c[_0x3c2b('0x3e')],{'$or':_[_0x3c2b('0x2d')](_0x17653c[_0x3c2b('0x38')],function(_0x2a4809){var _0x546773={};_0x546773[_0x2a4809]={'$like':'%'+_0x43c85f[_0x3c2b('0x33')][_0x3c2b('0x42')]+'%'};return _0x546773;})});}_0x17653c=_[_0x3c2b('0x40')]({},_0x17653c,_0x43c85f[_0x3c2b('0x50')]);return _0x192128[_0x3c2b('0x4d')](_0x17653c);}})[_0x3c2b('0x28')](function(_0x288dea){if(_0x288dea){_0x10f12e=_0x288dea[_0x3c2b('0x39')];if(!_0x43c85f[_0x3c2b('0x33')][_0x3c2b('0x3a')](_0x3c2b('0x3b'))){_0x17653c[_0x3c2b('0x21')]=qs[_0x3c2b('0x21')](_0x43c85f[_0x3c2b('0x33')]['limit']);_0x17653c[_0x3c2b('0x20')]=qs[_0x3c2b('0x20')](_0x43c85f['query'][_0x3c2b('0x20')]);}return _0x192128[_0x3c2b('0x4d')](_0x17653c);}})['then'](function(_0x9ace44){if(_0x9ace44){return _0x9ace44?{'count':_0x10f12e,'rows':_0x9ace44}:null;}})[_0x3c2b('0x28')](respondWithResult(_0x302aef,null))[_0x3c2b('0x49')](handleError(_0x302aef,null));};exports['getSubjects']=function(_0x53395c,_0x5ebfa9,_0x1a3503){var _0x3afd95={};var _0x4dfe83={};var _0x33eef2;var _0x1669c5;return db[_0x3c2b('0x2e')][_0x3c2b('0x4e')]({'where':{'id':_0x53395c[_0x3c2b('0x4c')]['id']}})[_0x3c2b('0x28')](handleEntityNotFound(_0x5ebfa9,null))[_0x3c2b('0x28')](function(_0x423baf){if(_0x423baf){_0x33eef2=_0x423baf;_0x4dfe83[_0x3c2b('0x32')]=_['keys'](db[_0x3c2b('0x4f')][_0x3c2b('0x2f')]);_0x4dfe83[_0x3c2b('0x33')]=_[_0x3c2b('0x34')](_0x53395c['query']);_0x4dfe83[_0x3c2b('0x35')]=_[_0x3c2b('0x36')](_0x4dfe83[_0x3c2b('0x32')],_0x4dfe83[_0x3c2b('0x33')]);_0x3afd95['attributes']=_[_0x3c2b('0x36')](_0x4dfe83['model'],qs['fields'](_0x53395c[_0x3c2b('0x33')]['fields']));_0x3afd95['attributes']=_0x3afd95['attributes'][_0x3c2b('0x39')]?_0x3afd95[_0x3c2b('0x38')]:_0x4dfe83[_0x3c2b('0x32')];_0x3afd95[_0x3c2b('0x3c')]=qs[_0x3c2b('0x3d')](_0x53395c[_0x3c2b('0x33')][_0x3c2b('0x3d')]);_0x3afd95[_0x3c2b('0x3e')]=qs[_0x3c2b('0x35')](_[_0x3c2b('0x3f')](_0x53395c['query'],_0x4dfe83['filters']));if(_0x53395c[_0x3c2b('0x33')]['filter']){_0x3afd95[_0x3c2b('0x3e')]=_[_0x3c2b('0x40')](_0x3afd95[_0x3c2b('0x3e')],{'$or':_[_0x3c2b('0x2d')](_0x3afd95[_0x3c2b('0x38')],function(_0x128b27){var _0x28f0d5={};_0x28f0d5[_0x128b27]={'$like':'%'+_0x53395c[_0x3c2b('0x33')][_0x3c2b('0x42')]+'%'};return _0x28f0d5;})});}_0x3afd95=_[_0x3c2b('0x40')]({},_0x3afd95,_0x53395c[_0x3c2b('0x50')]);return _0x33eef2['getSubjects'](_0x3afd95);}})[_0x3c2b('0x28')](function(_0x2eb476){if(_0x2eb476){_0x1669c5=_0x2eb476[_0x3c2b('0x39')];if(!_0x53395c[_0x3c2b('0x33')]['hasOwnProperty'](_0x3c2b('0x3b'))){_0x3afd95[_0x3c2b('0x21')]=qs[_0x3c2b('0x21')](_0x53395c[_0x3c2b('0x33')][_0x3c2b('0x21')]);_0x3afd95[_0x3c2b('0x20')]=qs[_0x3c2b('0x20')](_0x53395c[_0x3c2b('0x33')][_0x3c2b('0x20')]);}return _0x33eef2[_0x3c2b('0x51')](_0x3afd95);}})[_0x3c2b('0x28')](function(_0x85db58){if(_0x85db58){return _0x85db58?{'count':_0x1669c5,'rows':_0x85db58}:null;}})[_0x3c2b('0x28')](respondWithResult(_0x5ebfa9,null))['catch'](handleError(_0x5ebfa9,null));};exports[_0x3c2b('0x52')]=function(_0x2f3040,_0x98b9ba,_0x2593ac){var _0x4b04ea={};var _0x35e7a2={};var _0x1c7549;var _0x52e45e;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x2f3040['params']['id']}})[_0x3c2b('0x28')](handleEntityNotFound(_0x98b9ba,null))[_0x3c2b('0x28')](function(_0x35bda5){if(_0x35bda5){_0x1c7549=_0x35bda5;_0x35e7a2[_0x3c2b('0x32')]=_[_0x3c2b('0x34')](db['SugarcrmField']['rawAttributes']);_0x35e7a2[_0x3c2b('0x33')]=_[_0x3c2b('0x34')](_0x2f3040[_0x3c2b('0x33')]);_0x35e7a2[_0x3c2b('0x35')]=_[_0x3c2b('0x36')](_0x35e7a2['model'],_0x35e7a2['query']);_0x4b04ea[_0x3c2b('0x38')]=_[_0x3c2b('0x36')](_0x35e7a2[_0x3c2b('0x32')],qs[_0x3c2b('0x37')](_0x2f3040[_0x3c2b('0x33')][_0x3c2b('0x37')]));_0x4b04ea[_0x3c2b('0x38')]=_0x4b04ea[_0x3c2b('0x38')][_0x3c2b('0x39')]?_0x4b04ea[_0x3c2b('0x38')]:_0x35e7a2['model'];_0x4b04ea['order']=qs['sort'](_0x2f3040[_0x3c2b('0x33')][_0x3c2b('0x3d')]);_0x4b04ea[_0x3c2b('0x3e')]=qs[_0x3c2b('0x35')](_['pick'](_0x2f3040[_0x3c2b('0x33')],_0x35e7a2[_0x3c2b('0x35')]));if(_0x2f3040[_0x3c2b('0x33')]['filter']){_0x4b04ea['where']=_['merge'](_0x4b04ea[_0x3c2b('0x3e')],{'$or':_[_0x3c2b('0x2d')](_0x4b04ea[_0x3c2b('0x38')],function(_0x24cc96){var _0x1fbc25={};_0x1fbc25[_0x24cc96]={'$like':'%'+_0x2f3040[_0x3c2b('0x33')][_0x3c2b('0x42')]+'%'};return _0x1fbc25;})});}_0x4b04ea=_[_0x3c2b('0x40')]({},_0x4b04ea,_0x2f3040[_0x3c2b('0x50')]);return _0x1c7549[_0x3c2b('0x52')](_0x4b04ea);}})['then'](function(_0x2d8519){if(_0x2d8519){_0x52e45e=_0x2d8519[_0x3c2b('0x39')];if(!_0x2f3040['query'][_0x3c2b('0x3a')](_0x3c2b('0x3b'))){_0x4b04ea[_0x3c2b('0x21')]=qs[_0x3c2b('0x21')](_0x2f3040[_0x3c2b('0x33')][_0x3c2b('0x21')]);_0x4b04ea['offset']=qs['offset'](_0x2f3040[_0x3c2b('0x33')][_0x3c2b('0x20')]);}return _0x1c7549['getDescriptions'](_0x4b04ea);}})['then'](function(_0x4e42e2){if(_0x4e42e2){return _0x4e42e2?{'count':_0x52e45e,'rows':_0x4e42e2}:null;}})[_0x3c2b('0x28')](respondWithResult(_0x98b9ba,null))['catch'](handleError(_0x98b9ba,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 388d008..ffa7a95 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 _0x0294=['lodash','api','moment','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','int_sugarcrm_configurations'];(function(_0x4dc63c,_0x4272f7){var _0x251482=function(_0x1f11a6){while(--_0x1f11a6){_0x4dc63c['push'](_0x4dc63c['shift']());}};_0x251482(++_0x4272f7);}(_0x0294,0x170));var _0x4029=function(_0x29adcf,_0x2ce6bc){_0x29adcf=_0x29adcf-0x0;var _0x2fc5f3=_0x0294[_0x29adcf];return _0x2fc5f3;};'use strict';var _=require(_0x4029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4029('0x1'));var moment=require(_0x4029('0x2'));var BPromise=require('bluebird');var rp=require(_0x4029('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4029('0x4'));var config=require(_0x4029('0x5'));var attributes=require(_0x4029('0x6'));module['exports']=function(_0x33667f,_0x20a031){return _0x33667f['define']('SugarcrmConfiguration',attributes,{'tableName':_0x4029('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f6d=['rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3bfb2b,_0xbf67b9){var _0x54072c=function(_0x1a93c3){while(--_0x1a93c3){_0x3bfb2b['push'](_0x3bfb2b['shift']());}};_0x54072c(++_0xbf67b9);}(_0x2f6d,0xc9));var _0xd2f6=function(_0x2232cf,_0x4fd5ae){_0x2232cf=_0x2232cf-0x0;var _0x524b5a=_0x2f6d[_0x2232cf];return _0x524b5a;};'use strict';var _=require(_0xd2f6('0x0'));var util=require(_0xd2f6('0x1'));var logger=require(_0xd2f6('0x2'))(_0xd2f6('0x3'));var moment=require(_0xd2f6('0x4'));var BPromise=require(_0xd2f6('0x5'));var rp=require(_0xd2f6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd2f6('0x7'));var config=require(_0xd2f6('0x8'));var attributes=require(_0xd2f6('0x9'));module['exports']=function(_0x37fd6c,_0x2bfeea){return _0x37fd6c[_0xd2f6('0xa')](_0xd2f6('0xb'),attributes,{'tableName':_0xd2f6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index d9d7804..196b6e0 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 _0x033e=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','request\x20sent','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','info','result','catch'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x033e,0xf0));var _0xe033=function(_0x4e7bca,_0xe89cc){_0x4e7bca=_0x4e7bca-0x0;var _0x4e65c8=_0x033e[_0x4e7bca];return _0x4e65c8;};'use strict';var _=require(_0xe033('0x0'));var util=require(_0xe033('0x1'));var moment=require(_0xe033('0x2'));var BPromise=require(_0xe033('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe033('0x4'));var db=require(_0xe033('0x5'))['db'];var utils=require(_0xe033('0x6'));var logger=require(_0xe033('0x7'))(_0xe033('0x8'));var config=require(_0xe033('0x9'));var jayson=require(_0xe033('0xa'));var client=jayson['client'][_0xe033('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e268c,_0x3d96a9,_0x74741f){return new BPromise(function(_0xfea645,_0x44bdb9){return client[_0xe033('0xc')](_0x2e268c,_0x74741f)[_0xe033('0xd')](function(_0x176c50){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x3d96a9,'request\x20sent');logger[_0xe033('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x3d96a9,_0xe033('0xf'),JSON[_0xe033('0x10')](_0x176c50));if(_0x176c50[_0xe033('0x11')]){if(_0x176c50['error'][_0xe033('0x12')]===0x1f4){logger['error'](_0xe033('0x13'),_0x3d96a9,_0x176c50['error'][_0xe033('0x14')]);return _0x44bdb9(_0x176c50[_0xe033('0x11')]['message']);}logger[_0xe033('0x11')](_0xe033('0x13'),_0x3d96a9,_0x176c50[_0xe033('0x11')][_0xe033('0x14')]);return _0xfea645(_0x176c50[_0xe033('0x11')]['message']);}else{logger[_0xe033('0x15')](_0xe033('0x13'),_0x3d96a9,_0xe033('0xf'));_0xfea645(_0x176c50[_0xe033('0x16')][_0xe033('0x14')]);}})[_0xe033('0x17')](function(_0x16035d){logger[_0xe033('0x11')](_0xe033('0x13'),_0x3d96a9,_0x16035d);_0x44bdb9(_0x16035d);});});} \ No newline at end of file +var _0x88a2=['../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','SugarcrmConfiguration,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x30057d,_0x5e45ff){var _0x3f9411=function(_0x1da614){while(--_0x1da614){_0x30057d['push'](_0x30057d['shift']());}};_0x3f9411(++_0x5e45ff);}(_0x88a2,0x1ea));var _0x288a=function(_0x2101a8,_0x4fdf0d){_0x2101a8=_0x2101a8-0x0;var _0x1f112d=_0x88a2[_0x2101a8];return _0x1f112d;};'use strict';var _=require(_0x288a('0x0'));var util=require(_0x288a('0x1'));var moment=require(_0x288a('0x2'));var BPromise=require(_0x288a('0x3'));var rs=require(_0x288a('0x4'));var fs=require('fs');var Redis=require(_0x288a('0x5'));var db=require(_0x288a('0x6'))['db'];var utils=require(_0x288a('0x7'));var logger=require(_0x288a('0x8'))(_0x288a('0x9'));var config=require(_0x288a('0xa'));var jayson=require(_0x288a('0xb'));var client=jayson[_0x288a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31bc60,_0x1b4ab2,_0x25af2d){return new BPromise(function(_0x1a5a3f,_0x4ecc80){return client[_0x288a('0xd')](_0x31bc60,_0x25af2d)['then'](function(_0x27cbeb){logger[_0x288a('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1b4ab2,_0x288a('0xf'));logger[_0x288a('0x10')](_0x288a('0x11'),_0x1b4ab2,_0x288a('0xf'),JSON[_0x288a('0x12')](_0x27cbeb));if(_0x27cbeb['error']){if(_0x27cbeb['error'][_0x288a('0x13')]===0x1f4){logger['error'](_0x288a('0x14'),_0x1b4ab2,_0x27cbeb[_0x288a('0x15')][_0x288a('0x16')]);return _0x4ecc80(_0x27cbeb[_0x288a('0x15')]['message']);}logger[_0x288a('0x15')](_0x288a('0x14'),_0x1b4ab2,_0x27cbeb['error'][_0x288a('0x16')]);return _0x1a5a3f(_0x27cbeb[_0x288a('0x15')][_0x288a('0x16')]);}else{logger[_0x288a('0xe')](_0x288a('0x14'),_0x1b4ab2,_0x288a('0xf'));_0x1a5a3f(_0x27cbeb[_0x288a('0x17')][_0x288a('0x16')]);}})[_0x288a('0x18')](function(_0x43a986){logger[_0x288a('0x15')](_0x288a('0x14'),_0x1b4ab2,_0x43a986);_0x4ecc80(_0x43a986);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 0bd5cf8..3f99cef 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 _0xc771=['get','isAuthenticated','index','/:id','post','create','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0xc771,0x1a1));var _0x1c77=function(_0x3e8222,_0x4fd92e){_0x3e8222=_0x3e8222-0x0;var _0x4da3a1=_0xc771[_0x3e8222];return _0x4da3a1;};'use strict';var multer=require(_0x1c77('0x0'));var util=require(_0x1c77('0x1'));var path=require(_0x1c77('0x2'));var timeout=require(_0x1c77('0x3'));var express=require('express');var router=express[_0x1c77('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1c77('0x5'));var interaction=require(_0x1c77('0x6'));var config=require('../../config/environment');var controller=require(_0x1c77('0x7'));router[_0x1c77('0x8')]('/',auth[_0x1c77('0x9')](),controller[_0x1c77('0xa')]);router[_0x1c77('0x8')](_0x1c77('0xb'),auth[_0x1c77('0x9')](),controller['show']);router[_0x1c77('0xc')]('/',auth['isAuthenticated'](),controller[_0x1c77('0xd')]);router['put']('/:id',auth[_0x1c77('0x9')](),controller[_0x1c77('0xe')]);router[_0x1c77('0xf')](_0x1c77('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1c77('0x10')]=router; \ No newline at end of file +var _0xe594=['Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','post','create','put','destroy','exports','util','path','connect-timeout','express'];(function(_0x1711a0,_0x20feff){var _0x42ecc6=function(_0x2202e5){while(--_0x2202e5){_0x1711a0['push'](_0x1711a0['shift']());}};_0x42ecc6(++_0x20feff);}(_0xe594,0x19a));var _0x4e59=function(_0x18d058,_0x5850ef){_0x18d058=_0x18d058-0x0;var _0x1c5870=_0xe594[_0x18d058];return _0x1c5870;};'use strict';var multer=require('multer');var util=require(_0x4e59('0x0'));var path=require(_0x4e59('0x1'));var timeout=require(_0x4e59('0x2'));var express=require(_0x4e59('0x3'));var router=express[_0x4e59('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4e59('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4e59('0x6'));var controller=require(_0x4e59('0x7'));router['get']('/',auth[_0x4e59('0x8')](),controller[_0x4e59('0x9')]);router[_0x4e59('0xa')](_0x4e59('0xb'),auth['isAuthenticated'](),controller[_0x4e59('0xc')]);router[_0x4e59('0xd')]('/',auth[_0x4e59('0x8')](),controller[_0x4e59('0xe')]);router[_0x4e59('0xf')]('/:id',auth[_0x4e59('0x8')](),controller['update']);router['delete'](_0x4e59('0xb'),auth['isAuthenticated'](),controller[_0x4e59('0x10')]);module[_0x4e59('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index d535940..a4d5561 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 _0x8820=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x179631,_0x5653bc){var _0x9d82ad=function(_0x5901d9){while(--_0x5901d9){_0x179631['push'](_0x179631['shift']());}};_0x9d82ad(++_0x5653bc);}(_0x8820,0x1a8));var _0x0882=function(_0x56f736,_0x521360){_0x56f736=_0x56f736-0x0;var _0x47b49e=_0x8820[_0x56f736];return _0x47b49e;};'use strict';var Sequelize=require('sequelize');module[_0x0882('0x0')]={'type':{'type':Sequelize[_0x0882('0x1')](_0x0882('0x2'),_0x0882('0x3'),_0x0882('0x4'),_0x0882('0x5'),_0x0882('0x6')),'defaultValue':_0x0882('0x2')},'content':{'type':Sequelize[_0x0882('0x7')]},'key':{'type':Sequelize[_0x0882('0x7')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x0882('0x4'))},'keyContent':{'type':Sequelize[_0x0882('0x7')]},'idField':{'type':Sequelize[_0x0882('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0882('0x7')]}}; \ No newline at end of file +var _0x82d4=['STRING','BOOLEAN','ENUM','string','customVariable','picklist'];(function(_0x4cbffd,_0x51f680){var _0x5922ca=function(_0x4a6d31){while(--_0x4a6d31){_0x4cbffd['push'](_0x4cbffd['shift']());}};_0x5922ca(++_0x51f680);}(_0x82d4,0x80));var _0x482d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x82d4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x482d('0x0')](_0x482d('0x1'),'variable',_0x482d('0x2'),'keyValue',_0x482d('0x3')),'defaultValue':_0x482d('0x1')},'content':{'type':Sequelize[_0x482d('0x4')]},'key':{'type':Sequelize[_0x482d('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x482d('0x1'),'variable',_0x482d('0x2'))},'keyContent':{'type':Sequelize[_0x482d('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x482d('0x4')]},'customField':{'type':Sequelize[_0x482d('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x482d('0x4')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index f1db972..730b12e 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 _0x286c=['include','catch','create','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','stack','name','send','SugarcrmField','rawAttributes','model','map','keys','query','filters','intersection','attributes','fields','order','sort','pick','filter','where','merge','type','VIRTUAL','options','findAll','rows','then','show','params','length'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x286c,0x1a9));var _0xc286=function(_0x2b8086,_0x22116a){_0x2b8086=_0x2b8086-0x0;var _0x5c3965=_0x286c[_0x2b8086];return _0x5c3965;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc286('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc286('0x1'));var rp=require(_0xc286('0x2'));var moment=require(_0xc286('0x3'));var BPromise=require(_0xc286('0x4'));var Mustache=require(_0xc286('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc286('0x6'));var csv=require('to-csv');var ejs=require(_0xc286('0x7'));var fs=require('fs');var fs_extra=require(_0xc286('0x8'));var _=require(_0xc286('0x9'));var squel=require('squel');var crypto=require(_0xc286('0xa'));var jsforce=require(_0xc286('0xb'));var deskjs=require(_0xc286('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc286('0xd'));var Redis=require(_0xc286('0xe'));var authService=require(_0xc286('0xf'));var qs=require(_0xc286('0x10'));var as=require(_0xc286('0x11'));var hardwareService=require(_0xc286('0x12'));var logger=require(_0xc286('0x13'))(_0xc286('0x14'));var utils=require(_0xc286('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc286('0x16'))['db'];function respondWithStatusCode(_0x34e389,_0x413f9e){_0x413f9e=_0x413f9e||0xcc;return function(_0x240748){if(_0x240748){return _0x34e389['sendStatus'](_0x413f9e);}return _0x34e389[_0xc286('0x17')](_0x413f9e)[_0xc286('0x18')]();};}function respondWithResult(_0x34fa2f,_0x4ab243){_0x4ab243=_0x4ab243||0xc8;return function(_0x34118e){if(_0x34118e){return _0x34fa2f[_0xc286('0x17')](_0x4ab243)[_0xc286('0x19')](_0x34118e);}};}function respondWithFilteredResult(_0x49c84b,_0x2b7c0e){return function(_0x50a972){if(_0x50a972){var _0x328f3b=typeof _0x2b7c0e[_0xc286('0x1a')]===_0xc286('0x1b')&&typeof _0x2b7c0e[_0xc286('0x1c')]===_0xc286('0x1b');var _0x5eb4e3=_0x50a972['count'];var _0x3f6b80=_0x328f3b?0x0:_0x2b7c0e[_0xc286('0x1a')];var _0x2cec4a=_0x328f3b?_0x50a972[_0xc286('0x1d')]:_0x2b7c0e['offset']+_0x2b7c0e[_0xc286('0x1c')];var _0x383656;if(_0x2cec4a>=_0x5eb4e3){_0x2cec4a=_0x5eb4e3;_0x383656=0xc8;}else{_0x383656=0xce;}_0x49c84b[_0xc286('0x17')](_0x383656);return _0x49c84b[_0xc286('0x1e')](_0xc286('0x1f'),_0x3f6b80+'-'+_0x2cec4a+'/'+_0x5eb4e3)['json'](_0x50a972);}return null;};}function patchUpdates(_0x5c8f85){return function(_0x36775b){try{jsonpatch['apply'](_0x36775b,_0x5c8f85,!![]);}catch(_0x301828){return BPromise[_0xc286('0x20')](_0x301828);}return _0x36775b[_0xc286('0x21')]();};}function saveUpdates(_0x5728f0,_0x20eee8){return function(_0x314cc8){if(_0x314cc8){return _0x314cc8[_0xc286('0x22')](_0x5728f0)['then'](function(_0xd5cd4f){return _0xd5cd4f;});}return null;};}function removeEntity(_0x592f51,_0x5668a0){return function(_0x11d3f7){if(_0x11d3f7){return _0x11d3f7[_0xc286('0x23')]()['then'](function(){_0x592f51[_0xc286('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x240866,_0x27434b){return function(_0x3fc79b){if(!_0x3fc79b){_0x240866['sendStatus'](0x194);}return _0x3fc79b;};}function handleError(_0x1beb04,_0x41f004){_0x41f004=_0x41f004||0x1f4;return function(_0x15b438){logger[_0xc286('0x24')](_0x15b438[_0xc286('0x25')]);if(_0x15b438['name']){delete _0x15b438[_0xc286('0x26')];}_0x1beb04['status'](_0x41f004)[_0xc286('0x27')](_0x15b438);};}exports['index']=function(_0x3a26ff,_0x578aac){var _0x3f91c7={},_0x38db7c={},_0x38bdf6={'count':0x0,'rows':[]};var _0x22f02e=_['map'](db[_0xc286('0x28')][_0xc286('0x29')],function(_0x849cff){return{'name':_0x849cff['fieldName'],'type':_0x849cff['type']['key']};});_0x38db7c[_0xc286('0x2a')]=_[_0xc286('0x2b')](_0x22f02e,_0xc286('0x26'));_0x38db7c['query']=_[_0xc286('0x2c')](_0x3a26ff[_0xc286('0x2d')]);_0x38db7c[_0xc286('0x2e')]=_[_0xc286('0x2f')](_0x38db7c[_0xc286('0x2a')],_0x38db7c[_0xc286('0x2d')]);_0x3f91c7[_0xc286('0x30')]=_[_0xc286('0x2f')](_0x38db7c['model'],qs[_0xc286('0x31')](_0x3a26ff[_0xc286('0x2d')][_0xc286('0x31')]));_0x3f91c7[_0xc286('0x30')]=_0x3f91c7[_0xc286('0x30')]['length']?_0x3f91c7[_0xc286('0x30')]:_0x38db7c[_0xc286('0x2a')];if(!_0x3a26ff[_0xc286('0x2d')]['hasOwnProperty']('nolimit')){_0x3f91c7[_0xc286('0x1c')]=qs[_0xc286('0x1c')](_0x3a26ff[_0xc286('0x2d')]['limit']);_0x3f91c7[_0xc286('0x1a')]=qs[_0xc286('0x1a')](_0x3a26ff[_0xc286('0x2d')]['offset']);}_0x3f91c7[_0xc286('0x32')]=qs[_0xc286('0x33')](_0x3a26ff[_0xc286('0x2d')][_0xc286('0x33')]);_0x3f91c7['where']=qs[_0xc286('0x2e')](_[_0xc286('0x34')](_0x3a26ff['query'],_0x38db7c[_0xc286('0x2e')]),_0x22f02e);if(_0x3a26ff[_0xc286('0x2d')][_0xc286('0x35')]){_0x3f91c7[_0xc286('0x36')]=_[_0xc286('0x37')](_0x3f91c7[_0xc286('0x36')],{'$or':_[_0xc286('0x2b')](_0x22f02e,function(_0x315277){if(_0x315277[_0xc286('0x38')]!==_0xc286('0x39')){var _0x48fcd8={};_0x48fcd8[_0x315277[_0xc286('0x26')]]={'$like':'%'+_0x3a26ff[_0xc286('0x2d')][_0xc286('0x35')]+'%'};return _0x48fcd8;}})});}_0x3f91c7=_['merge']({},_0x3f91c7,_0x3a26ff[_0xc286('0x3a')]);var _0xdf72b4={'where':_0x3f91c7[_0xc286('0x36')]};return db['SugarcrmField'][_0xc286('0x1d')](_0xdf72b4)['then'](function(_0x400d0f){_0x38bdf6[_0xc286('0x1d')]=_0x400d0f;if(_0x3a26ff[_0xc286('0x2d')]['includeAll']){_0x3f91c7['include']=[{'all':!![]}];}return db[_0xc286('0x28')][_0xc286('0x3b')](_0x3f91c7);})['then'](function(_0x49b144){_0x38bdf6[_0xc286('0x3c')]=_0x49b144;return _0x38bdf6;})[_0xc286('0x3d')](respondWithFilteredResult(_0x578aac,_0x3f91c7))['catch'](handleError(_0x578aac,null));};exports[_0xc286('0x3e')]=function(_0x4cc526,_0x5cdd3d){var _0x3c1567={'raw':!![],'where':{'id':_0x4cc526[_0xc286('0x3f')]['id']}},_0x7090b9={};_0x7090b9[_0xc286('0x2a')]=_[_0xc286('0x2c')](db[_0xc286('0x28')][_0xc286('0x29')]);_0x7090b9[_0xc286('0x2d')]=_[_0xc286('0x2c')](_0x4cc526['query']);_0x7090b9[_0xc286('0x2e')]=_[_0xc286('0x2f')](_0x7090b9[_0xc286('0x2a')],_0x7090b9['query']);_0x3c1567['attributes']=_[_0xc286('0x2f')](_0x7090b9[_0xc286('0x2a')],qs[_0xc286('0x31')](_0x4cc526[_0xc286('0x2d')]['fields']));_0x3c1567['attributes']=_0x3c1567[_0xc286('0x30')][_0xc286('0x40')]?_0x3c1567['attributes']:_0x7090b9[_0xc286('0x2a')];if(_0x4cc526[_0xc286('0x2d')]['includeAll']){_0x3c1567[_0xc286('0x41')]=[{'all':!![]}];}_0x3c1567=_[_0xc286('0x37')]({},_0x3c1567,_0x4cc526['options']);return db[_0xc286('0x28')]['find'](_0x3c1567)[_0xc286('0x3d')](handleEntityNotFound(_0x5cdd3d,null))[_0xc286('0x3d')](respondWithResult(_0x5cdd3d,null))[_0xc286('0x42')](handleError(_0x5cdd3d,null));};exports[_0xc286('0x43')]=function(_0x3dea06,_0x19baa7){return db[_0xc286('0x28')]['create'](_0x3dea06[_0xc286('0x44')],{})[_0xc286('0x3d')](respondWithResult(_0x19baa7,0xc9))[_0xc286('0x42')](handleError(_0x19baa7,null));};exports[_0xc286('0x22')]=function(_0x5b0b1d,_0x183b37){if(_0x5b0b1d[_0xc286('0x44')]['id']){delete _0x5b0b1d[_0xc286('0x44')]['id'];}return db[_0xc286('0x28')][_0xc286('0x45')]({'where':{'id':_0x5b0b1d[_0xc286('0x3f')]['id']}})['then'](handleEntityNotFound(_0x183b37,null))[_0xc286('0x3d')](saveUpdates(_0x5b0b1d[_0xc286('0x44')],null))[_0xc286('0x3d')](respondWithResult(_0x183b37,null))[_0xc286('0x42')](handleError(_0x183b37,null));};exports[_0xc286('0x23')]=function(_0x5164f7,_0x366838){return db[_0xc286('0x28')][_0xc286('0x45')]({'where':{'id':_0x5164f7[_0xc286('0x3f')]['id']}})[_0xc286('0x3d')](handleEntityNotFound(_0x366838,null))[_0xc286('0x3d')](removeEntity(_0x366838,null))[_0xc286('0x42')](handleError(_0x366838,null));}; \ No newline at end of file +var _0x0d09=['sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','name','index','SugarcrmField','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','find','zip-dir','request-promise','moment','bluebird','util','path'];(function(_0x14f5b8,_0x4f54d1){var _0x43b9a0=function(_0x3a7290){while(--_0x3a7290){_0x14f5b8['push'](_0x14f5b8['shift']());}};_0x43b9a0(++_0x4f54d1);}(_0x0d09,0x15d));var _0x90d0=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x0d09[_0x5b561d];return _0x431060;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x90d0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90d0('0x1'));var moment=require(_0x90d0('0x2'));var BPromise=require(_0x90d0('0x3'));var Mustache=require('mustache');var util=require(_0x90d0('0x4'));var path=require(_0x90d0('0x5'));var sox=require(_0x90d0('0x6'));var csv=require(_0x90d0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x90d0('0x8'));var _=require(_0x90d0('0x9'));var squel=require('squel');var crypto=require(_0x90d0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x90d0('0xb'));var toCsv=require(_0x90d0('0x7'));var querystring=require(_0x90d0('0xc'));var Papa=require(_0x90d0('0xd'));var Redis=require(_0x90d0('0xe'));var authService=require(_0x90d0('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90d0('0x10'));var logger=require(_0x90d0('0x11'))(_0x90d0('0x12'));var utils=require('../../config/utils');var config=require(_0x90d0('0x13'));var licenseUtil=require(_0x90d0('0x14'));var db=require(_0x90d0('0x15'))['db'];function respondWithStatusCode(_0x464fdc,_0x4666d6){_0x4666d6=_0x4666d6||0xcc;return function(_0x6938a6){if(_0x6938a6){return _0x464fdc[_0x90d0('0x16')](_0x4666d6);}return _0x464fdc['status'](_0x4666d6)[_0x90d0('0x17')]();};}function respondWithResult(_0xefc976,_0x20c810){_0x20c810=_0x20c810||0xc8;return function(_0x5d4dd5){if(_0x5d4dd5){return _0xefc976[_0x90d0('0x18')](_0x20c810)[_0x90d0('0x19')](_0x5d4dd5);}};}function respondWithFilteredResult(_0x56825e,_0x381ddc){return function(_0x464089){if(_0x464089){var _0x3968ea=typeof _0x381ddc[_0x90d0('0x1a')]==='undefined'&&typeof _0x381ddc[_0x90d0('0x1b')]===_0x90d0('0x1c');var _0x68b1e9=_0x464089[_0x90d0('0x1d')];var _0x4f9202=_0x3968ea?0x0:_0x381ddc[_0x90d0('0x1a')];var _0x3ec18d=_0x3968ea?_0x464089[_0x90d0('0x1d')]:_0x381ddc[_0x90d0('0x1a')]+_0x381ddc[_0x90d0('0x1b')];var _0x25249e;if(_0x3ec18d>=_0x68b1e9){_0x3ec18d=_0x68b1e9;_0x25249e=0xc8;}else{_0x25249e=0xce;}_0x56825e['status'](_0x25249e);return _0x56825e[_0x90d0('0x1e')](_0x90d0('0x1f'),_0x4f9202+'-'+_0x3ec18d+'/'+_0x68b1e9)[_0x90d0('0x19')](_0x464089);}return null;};}function patchUpdates(_0x11b276){return function(_0x388503){try{jsonpatch[_0x90d0('0x20')](_0x388503,_0x11b276,!![]);}catch(_0x5e13b9){return BPromise[_0x90d0('0x21')](_0x5e13b9);}return _0x388503[_0x90d0('0x22')]();};}function saveUpdates(_0x58ac45,_0x49a280){return function(_0x462818){if(_0x462818){return _0x462818[_0x90d0('0x23')](_0x58ac45)[_0x90d0('0x24')](function(_0x561448){return _0x561448;});}return null;};}function removeEntity(_0x4a068e,_0x412a26){return function(_0x5a9d2e){if(_0x5a9d2e){return _0x5a9d2e['destroy']()[_0x90d0('0x24')](function(){_0x4a068e[_0x90d0('0x18')](0xcc)[_0x90d0('0x17')]();});}};}function handleEntityNotFound(_0x421769,_0x3e0c00){return function(_0x8ed06a){if(!_0x8ed06a){_0x421769[_0x90d0('0x16')](0x194);}return _0x8ed06a;};}function handleError(_0x1e9f02,_0x395755){_0x395755=_0x395755||0x1f4;return function(_0x562fec){logger['error'](_0x562fec['stack']);if(_0x562fec[_0x90d0('0x25')]){delete _0x562fec[_0x90d0('0x25')];}_0x1e9f02['status'](_0x395755)['send'](_0x562fec);};}exports[_0x90d0('0x26')]=function(_0x1a0fa5,_0x499210){var _0x1df19a={},_0x58f638={},_0x38437d={'count':0x0,'rows':[]};var _0x4627e4=_['map'](db[_0x90d0('0x27')][_0x90d0('0x28')],function(_0x4eb169){return{'name':_0x4eb169[_0x90d0('0x29')],'type':_0x4eb169['type'][_0x90d0('0x2a')]};});_0x58f638[_0x90d0('0x2b')]=_['map'](_0x4627e4,_0x90d0('0x25'));_0x58f638['query']=_['keys'](_0x1a0fa5[_0x90d0('0x2c')]);_0x58f638['filters']=_['intersection'](_0x58f638['model'],_0x58f638['query']);_0x1df19a['attributes']=_[_0x90d0('0x2d')](_0x58f638['model'],qs['fields'](_0x1a0fa5[_0x90d0('0x2c')][_0x90d0('0x2e')]));_0x1df19a[_0x90d0('0x2f')]=_0x1df19a[_0x90d0('0x2f')][_0x90d0('0x30')]?_0x1df19a[_0x90d0('0x2f')]:_0x58f638[_0x90d0('0x2b')];if(!_0x1a0fa5[_0x90d0('0x2c')][_0x90d0('0x31')](_0x90d0('0x32'))){_0x1df19a['limit']=qs[_0x90d0('0x1b')](_0x1a0fa5[_0x90d0('0x2c')][_0x90d0('0x1b')]);_0x1df19a[_0x90d0('0x1a')]=qs['offset'](_0x1a0fa5[_0x90d0('0x2c')][_0x90d0('0x1a')]);}_0x1df19a[_0x90d0('0x33')]=qs[_0x90d0('0x34')](_0x1a0fa5[_0x90d0('0x2c')][_0x90d0('0x34')]);_0x1df19a['where']=qs['filters'](_[_0x90d0('0x35')](_0x1a0fa5[_0x90d0('0x2c')],_0x58f638[_0x90d0('0x36')]),_0x4627e4);if(_0x1a0fa5['query'][_0x90d0('0x37')]){_0x1df19a[_0x90d0('0x38')]=_[_0x90d0('0x39')](_0x1df19a[_0x90d0('0x38')],{'$or':_['map'](_0x4627e4,function(_0x369474){if(_0x369474['type']!==_0x90d0('0x3a')){var _0x37afdd={};_0x37afdd[_0x369474[_0x90d0('0x25')]]={'$like':'%'+_0x1a0fa5[_0x90d0('0x2c')][_0x90d0('0x37')]+'%'};return _0x37afdd;}})});}_0x1df19a=_['merge']({},_0x1df19a,_0x1a0fa5[_0x90d0('0x3b')]);var _0xe657da={'where':_0x1df19a[_0x90d0('0x38')]};return db[_0x90d0('0x27')][_0x90d0('0x1d')](_0xe657da)[_0x90d0('0x24')](function(_0xcaa546){_0x38437d[_0x90d0('0x1d')]=_0xcaa546;if(_0x1a0fa5[_0x90d0('0x2c')][_0x90d0('0x3c')]){_0x1df19a['include']=[{'all':!![]}];}return db[_0x90d0('0x27')][_0x90d0('0x3d')](_0x1df19a);})[_0x90d0('0x24')](function(_0x173352){_0x38437d[_0x90d0('0x3e')]=_0x173352;return _0x38437d;})[_0x90d0('0x24')](respondWithFilteredResult(_0x499210,_0x1df19a))[_0x90d0('0x3f')](handleError(_0x499210,null));};exports[_0x90d0('0x40')]=function(_0x1b54a3,_0x4ad1de){var _0x480b23={'raw':!![],'where':{'id':_0x1b54a3[_0x90d0('0x41')]['id']}},_0x3bdee9={};_0x3bdee9[_0x90d0('0x2b')]=_['keys'](db[_0x90d0('0x27')]['rawAttributes']);_0x3bdee9[_0x90d0('0x2c')]=_[_0x90d0('0x42')](_0x1b54a3[_0x90d0('0x2c')]);_0x3bdee9[_0x90d0('0x36')]=_['intersection'](_0x3bdee9[_0x90d0('0x2b')],_0x3bdee9[_0x90d0('0x2c')]);_0x480b23['attributes']=_[_0x90d0('0x2d')](_0x3bdee9['model'],qs['fields'](_0x1b54a3[_0x90d0('0x2c')][_0x90d0('0x2e')]));_0x480b23[_0x90d0('0x2f')]=_0x480b23[_0x90d0('0x2f')][_0x90d0('0x30')]?_0x480b23['attributes']:_0x3bdee9[_0x90d0('0x2b')];if(_0x1b54a3[_0x90d0('0x2c')][_0x90d0('0x3c')]){_0x480b23[_0x90d0('0x43')]=[{'all':!![]}];}_0x480b23=_[_0x90d0('0x39')]({},_0x480b23,_0x1b54a3[_0x90d0('0x3b')]);return db[_0x90d0('0x27')]['find'](_0x480b23)[_0x90d0('0x24')](handleEntityNotFound(_0x4ad1de,null))[_0x90d0('0x24')](respondWithResult(_0x4ad1de,null))[_0x90d0('0x3f')](handleError(_0x4ad1de,null));};exports[_0x90d0('0x44')]=function(_0x4af0cd,_0x4e9c26){return db[_0x90d0('0x27')][_0x90d0('0x44')](_0x4af0cd[_0x90d0('0x45')],{})[_0x90d0('0x24')](respondWithResult(_0x4e9c26,0xc9))[_0x90d0('0x3f')](handleError(_0x4e9c26,null));};exports['update']=function(_0x4ec34c,_0x220fad){if(_0x4ec34c[_0x90d0('0x45')]['id']){delete _0x4ec34c[_0x90d0('0x45')]['id'];}return db[_0x90d0('0x27')][_0x90d0('0x46')]({'where':{'id':_0x4ec34c[_0x90d0('0x41')]['id']}})[_0x90d0('0x24')](handleEntityNotFound(_0x220fad,null))[_0x90d0('0x24')](saveUpdates(_0x4ec34c[_0x90d0('0x45')],null))[_0x90d0('0x24')](respondWithResult(_0x220fad,null))[_0x90d0('0x3f')](handleError(_0x220fad,null));};exports['destroy']=function(_0x202af3,_0x589b3e){return db[_0x90d0('0x27')]['find']({'where':{'id':_0x202af3[_0x90d0('0x41')]['id']}})[_0x90d0('0x24')](handleEntityNotFound(_0x589b3e,null))[_0x90d0('0x24')](removeEntity(_0x589b3e,null))[_0x90d0('0x3f')](handleError(_0x589b3e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index a9cbfc6..b06b419 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 _0xefea=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','../../config/logger','api'];(function(_0x54d406,_0x1b9c9b){var _0xfa5154=function(_0x24376c){while(--_0x24376c){_0x54d406['push'](_0x54d406['shift']());}};_0xfa5154(++_0x1b9c9b);}(_0xefea,0x1ec));var _0xaefe=function(_0x5f349f,_0xff9242){_0x5f349f=_0x5f349f-0x0;var _0x52e5d0=_0xefea[_0x5f349f];return _0x52e5d0;};'use strict';var _=require(_0xaefe('0x0'));var util=require('util');var logger=require(_0xaefe('0x1'))(_0xaefe('0x2'));var moment=require(_0xaefe('0x3'));var BPromise=require(_0xaefe('0x4'));var rp=require(_0xaefe('0x5'));var fs=require('fs');var path=require(_0xaefe('0x6'));var rimraf=require(_0xaefe('0x7'));var config=require(_0xaefe('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0xaefe('0x9')]=function(_0x283c17,_0x56d1c3){return _0x283c17[_0xaefe('0xa')](_0xaefe('0xb'),attributes,{'tableName':_0xaefe('0xc'),'paranoid':![],'indexes':[{'name':_0xaefe('0xd'),'fields':[_0xaefe('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7cee=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x572156,_0xb11cdf){var _0x4c0640=function(_0x410e99){while(--_0x410e99){_0x572156['push'](_0x572156['shift']());}};_0x4c0640(++_0xb11cdf);}(_0x7cee,0x147));var _0xe7ce=function(_0x343090,_0x433a80){_0x343090=_0x343090-0x0;var _0x3ff3e8=_0x7cee[_0x343090];return _0x3ff3e8;};'use strict';var _=require(_0xe7ce('0x0'));var util=require(_0xe7ce('0x1'));var logger=require(_0xe7ce('0x2'))(_0xe7ce('0x3'));var moment=require(_0xe7ce('0x4'));var BPromise=require(_0xe7ce('0x5'));var rp=require(_0xe7ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7ce('0x7'));var config=require(_0xe7ce('0x8'));var attributes=require(_0xe7ce('0x9'));module[_0xe7ce('0xa')]=function(_0x36d0dc,_0xfc8ee9){return _0x36d0dc[_0xe7ce('0xb')](_0xe7ce('0xc'),attributes,{'tableName':_0xe7ce('0xd'),'paranoid':![],'indexes':[{'name':_0xe7ce('0xe'),'fields':[_0xe7ce('0xf'),_0xe7ce('0x10')],'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 234f6d9..7d3d28e 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 _0x9223=['SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','debug'];(function(_0x430d0c,_0x5c5994){var _0x1061a3=function(_0x167e43){while(--_0x167e43){_0x430d0c['push'](_0x430d0c['shift']());}};_0x1061a3(++_0x5c5994);}(_0x9223,0xee));var _0x3922=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0x9223[_0x17c483];return _0x112bdb;};'use strict';var _=require(_0x3922('0x0'));var util=require(_0x3922('0x1'));var moment=require(_0x3922('0x2'));var BPromise=require('bluebird');var rs=require(_0x3922('0x3'));var fs=require('fs');var Redis=require(_0x3922('0x4'));var db=require(_0x3922('0x5'))['db'];var utils=require(_0x3922('0x6'));var logger=require('../../config/logger')(_0x3922('0x7'));var config=require(_0x3922('0x8'));var jayson=require(_0x3922('0x9'));var client=jayson[_0x3922('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2daf4e,_0x21c786,_0x14f742){return new BPromise(function(_0x36c0a8,_0x1b6f65){return client[_0x3922('0xb')](_0x2daf4e,_0x14f742)[_0x3922('0xc')](function(_0x32f21f){logger[_0x3922('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x21c786,'request\x20sent');logger[_0x3922('0xe')](_0x3922('0xf'),_0x21c786,_0x3922('0x10'),JSON[_0x3922('0x11')](_0x32f21f));if(_0x32f21f[_0x3922('0x12')]){if(_0x32f21f[_0x3922('0x12')][_0x3922('0x13')]===0x1f4){logger[_0x3922('0x12')](_0x3922('0x14'),_0x21c786,_0x32f21f[_0x3922('0x12')][_0x3922('0x15')]);return _0x1b6f65(_0x32f21f[_0x3922('0x12')][_0x3922('0x15')]);}logger[_0x3922('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x21c786,_0x32f21f[_0x3922('0x12')][_0x3922('0x15')]);return _0x36c0a8(_0x32f21f[_0x3922('0x12')][_0x3922('0x15')]);}else{logger[_0x3922('0xd')](_0x3922('0x14'),_0x21c786,'request\x20sent');_0x36c0a8(_0x32f21f['result'][_0x3922('0x15')]);}})[_0x3922('0x16')](function(_0x389f8f){logger[_0x3922('0x12')](_0x3922('0x14'),_0x21c786,_0x389f8f);_0x1b6f65(_0x389f8f);});});} \ No newline at end of file +var _0xf475=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','request','info','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SugarcrmField,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x3844d6,_0x2bcfe3){var _0x27a020=function(_0x101286){while(--_0x101286){_0x3844d6['push'](_0x3844d6['shift']());}};_0x27a020(++_0x2bcfe3);}(_0xf475,0x12e));var _0x5f47=function(_0x57a785,_0x3e6c8f){_0x57a785=_0x57a785-0x0;var _0x36bad0=_0xf475[_0x57a785];return _0x36bad0;};'use strict';var _=require(_0x5f47('0x0'));var util=require(_0x5f47('0x1'));var moment=require(_0x5f47('0x2'));var BPromise=require(_0x5f47('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f47('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f47('0x5'));var logger=require(_0x5f47('0x6'))(_0x5f47('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5f47('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe911a9,_0x3d6547,_0x3440a7){return new BPromise(function(_0xb77488,_0x3ba720){return client[_0x5f47('0x9')](_0xe911a9,_0x3440a7)['then'](function(_0x43415f){logger[_0x5f47('0xa')]('SugarcrmField,\x20%s,\x20%s',_0x3d6547,'request\x20sent');logger[_0x5f47('0xb')](_0x5f47('0xc'),_0x3d6547,_0x5f47('0xd'),JSON[_0x5f47('0xe')](_0x43415f));if(_0x43415f['error']){if(_0x43415f[_0x5f47('0xf')]['code']===0x1f4){logger[_0x5f47('0xf')](_0x5f47('0x10'),_0x3d6547,_0x43415f[_0x5f47('0xf')]['message']);return _0x3ba720(_0x43415f[_0x5f47('0xf')][_0x5f47('0x11')]);}logger[_0x5f47('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x3d6547,_0x43415f['error'][_0x5f47('0x11')]);return _0xb77488(_0x43415f[_0x5f47('0xf')][_0x5f47('0x11')]);}else{logger['info'](_0x5f47('0x10'),_0x3d6547,'request\x20sent');_0xb77488(_0x43415f['result']['message']);}})[_0x5f47('0x12')](function(_0x458ed1){logger[_0x5f47('0xf')](_0x5f47('0x10'),_0x3d6547,_0x458ed1);_0x3ba720(_0x458ed1);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 3802ce2..a1b8a4a 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 _0xc73e=['getFields','create','post','addConfiguration','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','getConfigurations'];(function(_0x52682c,_0x20bcc5){var _0x3b6af4=function(_0x516dad){while(--_0x516dad){_0x52682c['push'](_0x52682c['shift']());}};_0x3b6af4(++_0x20bcc5);}(_0xc73e,0x1e9));var _0xec73=function(_0x424e17,_0x3df4e2){_0x424e17=_0x424e17-0x0;var _0x367c4e=_0xc73e[_0x424e17];return _0x367c4e;};'use strict';var multer=require(_0xec73('0x0'));var util=require(_0xec73('0x1'));var path=require('path');var timeout=require(_0xec73('0x2'));var express=require(_0xec73('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xec73('0x4'));var config=require(_0xec73('0x5'));var controller=require('./intVtigerAccount.controller');router[_0xec73('0x6')]('/',auth[_0xec73('0x7')](),controller[_0xec73('0x8')]);router[_0xec73('0x6')]('/:id',auth[_0xec73('0x7')](),controller['show']);router[_0xec73('0x6')](_0xec73('0x9'),auth[_0xec73('0x7')](),controller[_0xec73('0xa')]);router['get']('/:id/fields',auth[_0xec73('0x7')](),controller[_0xec73('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xec73('0xc')]);router[_0xec73('0xd')](_0xec73('0x9'),auth[_0xec73('0x7')](),controller[_0xec73('0xe')]);router[_0xec73('0xf')](_0xec73('0x10'),auth['isAuthenticated'](),controller[_0xec73('0x11')]);router['delete'](_0xec73('0x10'),auth['isAuthenticated'](),controller[_0xec73('0x12')]);module[_0xec73('0x13')]=router; \ No newline at end of file +var _0x7dc0=['./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x249b5b,_0xdd40ef){var _0x1bf6b8=function(_0x5150e9){while(--_0x5150e9){_0x249b5b['push'](_0x249b5b['shift']());}};_0x1bf6b8(++_0xdd40ef);}(_0x7dc0,0x18f));var _0x07dc=function(_0x441f7a,_0x576321){_0x441f7a=_0x441f7a-0x0;var _0x4821da=_0x7dc0[_0x441f7a];return _0x4821da;};'use strict';var multer=require(_0x07dc('0x0'));var util=require(_0x07dc('0x1'));var path=require(_0x07dc('0x2'));var timeout=require(_0x07dc('0x3'));var express=require(_0x07dc('0x4'));var router=express[_0x07dc('0x5')]();var fs_extra=require(_0x07dc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x07dc('0x7'));var config=require(_0x07dc('0x8'));var controller=require(_0x07dc('0x9'));router[_0x07dc('0xa')]('/',auth[_0x07dc('0xb')](),controller[_0x07dc('0xc')]);router['get'](_0x07dc('0xd'),auth[_0x07dc('0xb')](),controller[_0x07dc('0xe')]);router[_0x07dc('0xa')](_0x07dc('0xf'),auth['isAuthenticated'](),controller[_0x07dc('0x10')]);router['get'](_0x07dc('0x11'),auth['isAuthenticated'](),controller['getFields']);router[_0x07dc('0x12')]('/',auth[_0x07dc('0xb')](),controller[_0x07dc('0x13')]);router[_0x07dc('0x12')](_0x07dc('0xf'),auth['isAuthenticated'](),controller[_0x07dc('0x14')]);router[_0x07dc('0x15')](_0x07dc('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x07dc('0x16')](_0x07dc('0xd'),auth[_0x07dc('0xb')](),controller['destroy']);module[_0x07dc('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index d3cbf96..6b9c3c8 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 _0x76eb=['STRING','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x76eb,0x1b3));var _0xb76e=function(_0x11a422,_0x5907a5){_0x11a422=_0x11a422-0x0;var _0x547177=_0x76eb[_0x11a422];return _0x547177;};'use strict';var Sequelize=require(_0xb76e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb76e('0x1')]},'username':{'type':Sequelize[_0xb76e('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xb76e('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xb76e('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xb76e('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x652d=['sequelize','exports','STRING','HelpDesk'];(function(_0x3e21e7,_0x489c63){var _0x186983=function(_0x4d7879){while(--_0x4d7879){_0x3e21e7['push'](_0x3e21e7['shift']());}};_0x186983(++_0x489c63);}(_0x652d,0x80));var _0xd652=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x652d[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0xd652('0x0'));module[_0xd652('0x1')]={'name':{'type':Sequelize[_0xd652('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd652('0x2')]},'username':{'type':Sequelize[_0xd652('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xd652('0x2')],'allowNull':![],'defaultValue':_0xd652('0x3')},'remoteUri':{'type':Sequelize[_0xd652('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xd652('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xd652('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 13fd423..c178ec1 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 _0x593e=['format','GET','getchallenge','success','login','token','sessionName','autogenerated','reference','owner','remove','includes','false','result','label','startsWith','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','update','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','create','VtigerField','Subjects','getFields','description','moduleName','serverUrl','accessKey','username','remoteUri','substring','lastIndexOf'];(function(_0x4cdd9b,_0x129826){var _0x419f11=function(_0x28f646){while(--_0x28f646){_0x4cdd9b['push'](_0x4cdd9b['shift']());}};_0x419f11(++_0x129826);}(_0x593e,0x173));var _0xe593=function(_0x3e97cd,_0x2f6e3d){_0x3e97cd=_0x3e97cd-0x0;var _0x1f010d=_0x593e[_0x3e97cd];return _0x1f010d;};'use strict';var emlformat=require(_0xe593('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe593('0x1'));var jsonpatch=require(_0xe593('0x2'));var rp=require(_0xe593('0x3'));var moment=require(_0xe593('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe593('0x5'));var path=require('path');var sox=require(_0xe593('0x6'));var csv=require(_0xe593('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe593('0x8'));var _=require(_0xe593('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe593('0xa'));var deskjs=require(_0xe593('0xb'));var toCsv=require(_0xe593('0x7'));var querystring=require('querystring');var Papa=require(_0xe593('0xc'));var Redis=require(_0xe593('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xe593('0xe'));var as=require(_0xe593('0xf'));var hardwareService=require(_0xe593('0x10'));var logger=require(_0xe593('0x11'))(_0xe593('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe593('0x13'));var db=require(_0xe593('0x14'))['db'];var integrations=require(_0xe593('0x15'));function respondWithStatusCode(_0x449b7b,_0x222ede){_0x222ede=_0x222ede||0xcc;return function(_0x12508a){if(_0x12508a){return _0x449b7b[_0xe593('0x16')](_0x222ede);}return _0x449b7b[_0xe593('0x17')](_0x222ede)[_0xe593('0x18')]();};}function respondWithResult(_0x365b53,_0x2d332e){_0x2d332e=_0x2d332e||0xc8;return function(_0x2d0621){if(_0x2d0621){return _0x365b53[_0xe593('0x17')](_0x2d332e)[_0xe593('0x19')](_0x2d0621);}};}function respondWithFilteredResult(_0x36844d,_0x4c6f64){return function(_0x8399ae){if(_0x8399ae){var _0x169a12=typeof _0x4c6f64[_0xe593('0x1a')]===_0xe593('0x1b')&&typeof _0x4c6f64['limit']===_0xe593('0x1b');var _0x3d8e2f=_0x8399ae[_0xe593('0x1c')];var _0x24eb96=_0x169a12?0x0:_0x4c6f64[_0xe593('0x1a')];var _0x303a98=_0x169a12?_0x8399ae[_0xe593('0x1c')]:_0x4c6f64[_0xe593('0x1a')]+_0x4c6f64['limit'];var _0x450f1a;if(_0x303a98>=_0x3d8e2f){_0x303a98=_0x3d8e2f;_0x450f1a=0xc8;}else{_0x450f1a=0xce;}_0x36844d[_0xe593('0x17')](_0x450f1a);return _0x36844d[_0xe593('0x1d')](_0xe593('0x1e'),_0x24eb96+'-'+_0x303a98+'/'+_0x3d8e2f)[_0xe593('0x19')](_0x8399ae);}return null;};}function patchUpdates(_0x36bee1){return function(_0x2f38de){try{jsonpatch[_0xe593('0x1f')](_0x2f38de,_0x36bee1,!![]);}catch(_0x14d357){return BPromise[_0xe593('0x20')](_0x14d357);}return _0x2f38de['save']();};}function saveUpdates(_0x59fc98,_0x1459b4){return function(_0xee4a75){if(_0xee4a75){return _0xee4a75['update'](_0x59fc98)[_0xe593('0x21')](function(_0xd1ea37){return _0xd1ea37;});}return null;};}function removeEntity(_0x2e0fc8,_0x367e15){return function(_0x3fd13b){if(_0x3fd13b){return _0x3fd13b[_0xe593('0x22')]()[_0xe593('0x21')](function(){_0x2e0fc8[_0xe593('0x17')](0xcc)[_0xe593('0x18')]();});}};}function handleEntityNotFound(_0x6cb37c,_0x1ca03e){return function(_0x36977a){if(!_0x36977a){_0x6cb37c[_0xe593('0x16')](0x194);}return _0x36977a;};}function handleError(_0x2abb67,_0x1b857d){_0x1b857d=_0x1b857d||0x1f4;return function(_0x3e3163){logger[_0xe593('0x23')](_0x3e3163['stack']);if(_0x3e3163[_0xe593('0x24')]){delete _0x3e3163['name'];}_0x2abb67[_0xe593('0x17')](_0x1b857d)[_0xe593('0x25')](_0x3e3163);};}exports[_0xe593('0x26')]=function(_0x38d565,_0x15eacb){var _0x43f536={},_0x4d224d={},_0x3fa238={'count':0x0,'rows':[]};var _0x260667=_[_0xe593('0x27')](db[_0xe593('0x28')][_0xe593('0x29')],function(_0x57785a){return{'name':_0x57785a[_0xe593('0x2a')],'type':_0x57785a[_0xe593('0x2b')]['key']};});_0x4d224d['model']=_[_0xe593('0x27')](_0x260667,_0xe593('0x24'));_0x4d224d[_0xe593('0x2c')]=_[_0xe593('0x2d')](_0x38d565[_0xe593('0x2c')]);_0x4d224d[_0xe593('0x2e')]=_[_0xe593('0x2f')](_0x4d224d[_0xe593('0x30')],_0x4d224d[_0xe593('0x2c')]);_0x43f536[_0xe593('0x31')]=_[_0xe593('0x2f')](_0x4d224d[_0xe593('0x30')],qs[_0xe593('0x32')](_0x38d565['query'][_0xe593('0x32')]));_0x43f536['attributes']=_0x43f536[_0xe593('0x31')]['length']?_0x43f536['attributes']:_0x4d224d['model'];if(!_0x38d565['query'][_0xe593('0x33')]('nolimit')){_0x43f536['limit']=qs[_0xe593('0x34')](_0x38d565['query'][_0xe593('0x34')]);_0x43f536[_0xe593('0x1a')]=qs['offset'](_0x38d565[_0xe593('0x2c')]['offset']);}_0x43f536[_0xe593('0x35')]=qs[_0xe593('0x36')](_0x38d565[_0xe593('0x2c')][_0xe593('0x36')]);_0x43f536[_0xe593('0x37')]=qs[_0xe593('0x2e')](_[_0xe593('0x38')](_0x38d565[_0xe593('0x2c')],_0x4d224d['filters']),_0x260667);if(_0x38d565[_0xe593('0x2c')][_0xe593('0x39')]){_0x43f536[_0xe593('0x37')]=_[_0xe593('0x3a')](_0x43f536['where'],{'$or':_['map'](_0x260667,function(_0x4fc775){if(_0x4fc775['type']!==_0xe593('0x3b')){var _0x1ac77d={};_0x1ac77d[_0x4fc775[_0xe593('0x24')]]={'$like':'%'+_0x38d565['query'][_0xe593('0x39')]+'%'};return _0x1ac77d;}})});}_0x43f536=_[_0xe593('0x3a')]({},_0x43f536,_0x38d565[_0xe593('0x3c')]);var _0xaee828={'where':_0x43f536[_0xe593('0x37')]};return db[_0xe593('0x28')][_0xe593('0x1c')](_0xaee828)['then'](function(_0x539909){_0x3fa238[_0xe593('0x1c')]=_0x539909;if(_0x38d565[_0xe593('0x2c')][_0xe593('0x3d')]){_0x43f536[_0xe593('0x3e')]=[{'all':!![]}];}return db['VtigerAccount'][_0xe593('0x3f')](_0x43f536);})[_0xe593('0x21')](function(_0x6133ec){_0x3fa238[_0xe593('0x40')]=_0x6133ec;return _0x3fa238;})[_0xe593('0x21')](respondWithFilteredResult(_0x15eacb,_0x43f536))[_0xe593('0x41')](handleError(_0x15eacb,null));};exports[_0xe593('0x42')]=function(_0xb60641,_0x57d333){var _0x2bc6fa={'raw':![],'where':{'id':_0xb60641[_0xe593('0x43')]['id']}},_0x55ea62={};_0x55ea62[_0xe593('0x30')]=_['keys'](db[_0xe593('0x28')][_0xe593('0x29')]);_0x55ea62[_0xe593('0x2c')]=_[_0xe593('0x2d')](_0xb60641[_0xe593('0x2c')]);_0x55ea62['filters']=_['intersection'](_0x55ea62[_0xe593('0x30')],_0x55ea62[_0xe593('0x2c')]);_0x2bc6fa[_0xe593('0x31')]=_['intersection'](_0x55ea62[_0xe593('0x30')],qs[_0xe593('0x32')](_0xb60641['query'][_0xe593('0x32')]));_0x2bc6fa[_0xe593('0x31')]=_0x2bc6fa[_0xe593('0x31')][_0xe593('0x44')]?_0x2bc6fa[_0xe593('0x31')]:_0x55ea62['model'];if(_0xb60641[_0xe593('0x2c')][_0xe593('0x3d')]){_0x2bc6fa[_0xe593('0x3e')]=[{'all':!![]}];}_0x2bc6fa=_['merge']({},_0x2bc6fa,_0xb60641[_0xe593('0x3c')]);return db['VtigerAccount'][_0xe593('0x45')](_0x2bc6fa)[_0xe593('0x21')](handleEntityNotFound(_0x57d333,null))[_0xe593('0x21')](respondWithResult(_0x57d333,null))[_0xe593('0x41')](handleError(_0x57d333,null));};exports['create']=function(_0x5aacf2,_0x45084c){return db[_0xe593('0x28')]['create'](_0x5aacf2[_0xe593('0x46')],{})[_0xe593('0x21')](respondWithResult(_0x45084c,0xc9))[_0xe593('0x41')](handleError(_0x45084c,null));};exports[_0xe593('0x47')]=function(_0x575b56,_0x4fbbb4){if(_0x575b56['body']['id']){delete _0x575b56[_0xe593('0x46')]['id'];}return db[_0xe593('0x28')][_0xe593('0x45')]({'where':{'id':_0x575b56[_0xe593('0x43')]['id']}})[_0xe593('0x21')](handleEntityNotFound(_0x4fbbb4,null))['then'](saveUpdates(_0x575b56[_0xe593('0x46')],null))[_0xe593('0x21')](respondWithResult(_0x4fbbb4,null))['catch'](handleError(_0x4fbbb4,null));};exports[_0xe593('0x22')]=function(_0x35306d,_0x4d9c81){return db['VtigerAccount'][_0xe593('0x45')]({'where':{'id':_0x35306d['params']['id']}})['then'](handleEntityNotFound(_0x4d9c81,null))[_0xe593('0x21')](removeEntity(_0x4d9c81,null))[_0xe593('0x41')](handleError(_0x4d9c81,null));};exports[_0xe593('0x48')]=function(_0x11c2f9,_0x2fded9,_0xc84d8a){var _0x45f1d8={};var _0x352620={};var _0x12834f;var _0x43f661;return db[_0xe593('0x28')][_0xe593('0x49')]({'where':{'id':_0x11c2f9[_0xe593('0x43')]['id']}})[_0xe593('0x21')](handleEntityNotFound(_0x2fded9,null))['then'](function(_0x1c5b10){if(_0x1c5b10){_0x12834f=_0x1c5b10;_0x352620[_0xe593('0x30')]=_[_0xe593('0x2d')](db[_0xe593('0x4a')]['rawAttributes']);_0x352620[_0xe593('0x2c')]=_[_0xe593('0x2d')](_0x11c2f9['query']);_0x352620[_0xe593('0x2e')]=_[_0xe593('0x2f')](_0x352620[_0xe593('0x30')],_0x352620[_0xe593('0x2c')]);_0x45f1d8['attributes']=_['intersection'](_0x352620['model'],qs[_0xe593('0x32')](_0x11c2f9[_0xe593('0x2c')][_0xe593('0x32')]));_0x45f1d8[_0xe593('0x31')]=_0x45f1d8[_0xe593('0x31')]['length']?_0x45f1d8[_0xe593('0x31')]:_0x352620['model'];_0x45f1d8[_0xe593('0x35')]=qs[_0xe593('0x36')](_0x11c2f9[_0xe593('0x2c')][_0xe593('0x36')]);_0x45f1d8[_0xe593('0x37')]=qs[_0xe593('0x2e')](_['pick'](_0x11c2f9[_0xe593('0x2c')],_0x352620['filters']));if(_0x11c2f9[_0xe593('0x2c')]['filter']){_0x45f1d8['where']=_[_0xe593('0x3a')](_0x45f1d8[_0xe593('0x37')],{'$or':_[_0xe593('0x27')](_0x45f1d8[_0xe593('0x31')],function(_0x5dc773){var _0x4665a6={};_0x4665a6[_0x5dc773]={'$like':'%'+_0x11c2f9[_0xe593('0x2c')][_0xe593('0x39')]+'%'};return _0x4665a6;})});}_0x45f1d8=_['merge']({},_0x45f1d8,_0x11c2f9[_0xe593('0x3c')]);return _0x12834f[_0xe593('0x48')](_0x45f1d8);}})['then'](function(_0x472851){if(_0x472851){_0x43f661=_0x472851[_0xe593('0x44')];if(!_0x11c2f9[_0xe593('0x2c')][_0xe593('0x33')]('nolimit')){_0x45f1d8[_0xe593('0x34')]=qs[_0xe593('0x34')](_0x11c2f9[_0xe593('0x2c')][_0xe593('0x34')]);_0x45f1d8[_0xe593('0x1a')]=qs[_0xe593('0x1a')](_0x11c2f9[_0xe593('0x2c')]['offset']);}return _0x12834f[_0xe593('0x48')](_0x45f1d8);}})['then'](function(_0x6e306a){if(_0x6e306a){return _0x6e306a?{'count':_0x43f661,'rows':_0x6e306a}:null;}})[_0xe593('0x21')](respondWithResult(_0x2fded9,null))[_0xe593('0x41')](handleError(_0x2fded9,null));};exports[_0xe593('0x4b')]=function(_0x3d979c,_0x22c39b,_0x1b7445){if(_0x3d979c[_0xe593('0x46')]['id']){delete _0x3d979c[_0xe593('0x46')]['id'];}return db[_0xe593('0x28')][_0xe593('0x49')]({'where':{'id':_0x3d979c[_0xe593('0x43')]['id']}})['then'](handleEntityNotFound(_0x22c39b,null))[_0xe593('0x21')](function(_0x2a4089){if(_0x2a4089){_0x3d979c[_0xe593('0x46')][_0xe593('0x4c')]=_0x2a4089['id'];_0x3d979c[_0xe593('0x46')]['Subjects']=integrations[_0xe593('0x4d')](_0x3d979c[_0xe593('0x46')][_0xe593('0x4e')],_0x3d979c['body']['type']);_0x3d979c['body'][_0xe593('0x4f')]=integrations[_0xe593('0x50')](_0x3d979c[_0xe593('0x46')][_0xe593('0x4e')],_0x3d979c[_0xe593('0x46')][_0xe593('0x2b')]);return db[_0xe593('0x4a')][_0xe593('0x51')](_0x3d979c[_0xe593('0x46')],{'include':[{'model':db[_0xe593('0x52')],'as':_0xe593('0x53')},{'model':db[_0xe593('0x52')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x22c39b,null))[_0xe593('0x41')](handleError(_0x22c39b,null));};var md5=require('md5');exports[_0xe593('0x54')]=function(_0x4d0ef4,_0x727924,_0x5b937e){var _0x492bbe=null;var _0x38b34f=null;var _0xf4e730=null;var _0x2f9bfc=null;var _0x3ce4fd='';return db[_0xe593('0x28')][_0xe593('0x49')]({'where':{'id':_0x4d0ef4['params']['id']},'attributes':['id',_0xe593('0x24'),'username',_0xe593('0x55'),_0xe593('0x56'),'remoteUri',_0xe593('0x57'),_0xe593('0x58')]})[_0xe593('0x21')](handleEntityNotFound(_0x727924,null))['then'](function(_0x372d47){if(_0x372d47){_0x492bbe=_0x372d47[_0xe593('0x59')];_0x38b34f=_0x372d47[_0xe593('0x58')];_0xf4e730=_0x372d47['moduleName'];_0x3ce4fd=_0x372d47[_0xe593('0x5a')];var _0x5661a9=_0x3ce4fd['slice'](-0x1);if(_0x5661a9==='/'){_0x3ce4fd=_0x3ce4fd[_0xe593('0x5b')](0x0,_0x3ce4fd[_0xe593('0x5c')](_0x5661a9));}_0x2f9bfc=util[_0xe593('0x5d')]('%s/webservice.php',_0x3ce4fd);var _0x4abf09={'method':_0xe593('0x5e'),'uri':_0x2f9bfc,'qs':{'operation':_0xe593('0x5f'),'username':_0x372d47[_0xe593('0x59')]},'json':!![]};return rp(_0x4abf09);}})[_0xe593('0x21')](function(_0x2b4094){if(_0x2b4094[_0xe593('0x60')]){var _0x2dbb52={'method':'POST','uri':_0x2f9bfc,'form':{'operation':_0xe593('0x61'),'username':_0x492bbe,'accessKey':md5(_0x2b4094['result'][_0xe593('0x62')]+_0x38b34f)},'json':!![]};return rp(_0x2dbb52);}})[_0xe593('0x21')](function(_0x3d35dd){if(_0x3d35dd['success']){var _0x38961f={'method':_0xe593('0x5e'),'uri':_0x2f9bfc,'qs':{'operation':'describe','username':_0x492bbe,'sessionName':_0x3d35dd['result'][_0xe593('0x63')],'elementType':_0xf4e730},'json':!![]};return rp(_0x38961f);}})['then'](function(_0x51db54){if(_0x51db54[_0xe593('0x60')]){var _0x284bda=[_0xe593('0x64'),_0xe593('0x65'),_0xe593('0x66')];_[_0xe593('0x67')](_0x51db54['result'][_0xe593('0x32')],function(_0x27ecd1){return _0x284bda[_0xe593('0x68')](_0x27ecd1[_0xe593('0x2b')]['name']);});_[_0xe593('0x67')](_0x51db54['result']['fields'],function(_0x1ffb82){return _0x1ffb82['editable']===_0xe593('0x69');});return{'count':_0x51db54['result'][_0xe593('0x32')][_0xe593('0x44')],'rows':_[_0xe593('0x27')](_0x51db54[_0xe593('0x6a')][_0xe593('0x32')],function(_0x23aa9a){return{'id':_0x23aa9a['name'],'name':_0x23aa9a[_0xe593('0x6b')],'custom':_[_0xe593('0x6c')](_0x23aa9a[_0xe593('0x24')],'cf_')?!![]:![],'options':_0x23aa9a['type']['name']===_0xe593('0x6d')&&_0x23aa9a[_0xe593('0x2b')][_0xe593('0x6e')]['length']>0x0?_['map'](_0x23aa9a[_0xe593('0x2b')][_0xe593('0x6e')],function(_0x3382e2){return{'name':_0x3382e2[_0xe593('0x6b')],'value':_0x3382e2['value']};}):[]};})};}})[_0xe593('0x21')](respondWithResult(_0x727924,null))[_0xe593('0x41')](function(_0x14f770){console[_0xe593('0x6f')](_0xe593('0x70')+_0x14f770);var _0x5a0a38=_0x4d0ef4[_0xe593('0x2c')][_0xe593('0x71')]?0x1f4:_0x14f770[_0xe593('0x72')]||0x1f4;logger[_0xe593('0x23')](_0xe593('0x73'),_0xe593('0x54'),_0x5a0a38,JSON['stringify'](_0x14f770));delete _0x14f770['name'];if(_0x5a0a38===0x191){_0x5a0a38=0x190;}_0x727924[_0xe593('0x17')](_0x5a0a38)[_0xe593('0x25')](_0x4d0ef4[_0xe593('0x2c')][_0xe593('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x14f770['statusCode']}:_0x14f770);});}; \ No newline at end of file +var _0x257f=['show','params','find','catch','create','body','findOne','VtigerConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','description','remoteUri','serverUrl','username','moduleName','slice','substring','format','%s/webservice.php','GET','getchallenge','success','login','result','autogenerated','reference','owner','includes','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','name','index','map','VtigerAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x1ed021,_0x50956b){var _0x4243bc=function(_0x3d8617){while(--_0x3d8617){_0x1ed021['push'](_0x1ed021['shift']());}};_0x4243bc(++_0x50956b);}(_0x257f,0x191));var _0xf257=function(_0x2284a6,_0x3b2ba7){_0x2284a6=_0x2284a6-0x0;var _0x3754e4=_0x257f[_0x2284a6];return _0x3754e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf257('0x0'));var zipdir=require(_0xf257('0x1'));var jsonpatch=require(_0xf257('0x2'));var rp=require('request-promise');var moment=require(_0xf257('0x3'));var BPromise=require(_0xf257('0x4'));var Mustache=require(_0xf257('0x5'));var util=require(_0xf257('0x6'));var path=require(_0xf257('0x7'));var sox=require(_0xf257('0x8'));var csv=require(_0xf257('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf257('0xa'));var _=require(_0xf257('0xb'));var squel=require(_0xf257('0xc'));var crypto=require(_0xf257('0xd'));var jsforce=require(_0xf257('0xe'));var deskjs=require(_0xf257('0xf'));var toCsv=require(_0xf257('0x9'));var querystring=require(_0xf257('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf257('0x11'));var qs=require(_0xf257('0x12'));var as=require(_0xf257('0x13'));var hardwareService=require(_0xf257('0x14'));var logger=require('../../config/logger')(_0xf257('0x15'));var utils=require('../../config/utils');var config=require(_0xf257('0x16'));var licenseUtil=require(_0xf257('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x18031b,_0x1787b3){_0x1787b3=_0x1787b3||0xcc;return function(_0x5ddb21){if(_0x5ddb21){return _0x18031b[_0xf257('0x18')](_0x1787b3);}return _0x18031b[_0xf257('0x19')](_0x1787b3)['end']();};}function respondWithResult(_0xc0d010,_0xc9c60c){_0xc9c60c=_0xc9c60c||0xc8;return function(_0x36dc33){if(_0x36dc33){return _0xc0d010['status'](_0xc9c60c)[_0xf257('0x1a')](_0x36dc33);}};}function respondWithFilteredResult(_0xeda7a6,_0x3acd51){return function(_0x5a291a){if(_0x5a291a){var _0x4f1956=typeof _0x3acd51[_0xf257('0x1b')]===_0xf257('0x1c')&&typeof _0x3acd51[_0xf257('0x1d')]==='undefined';var _0x267f3d=_0x5a291a[_0xf257('0x1e')];var _0x3c28e0=_0x4f1956?0x0:_0x3acd51[_0xf257('0x1b')];var _0x58c086=_0x4f1956?_0x5a291a['count']:_0x3acd51[_0xf257('0x1b')]+_0x3acd51[_0xf257('0x1d')];var _0x10df98;if(_0x58c086>=_0x267f3d){_0x58c086=_0x267f3d;_0x10df98=0xc8;}else{_0x10df98=0xce;}_0xeda7a6[_0xf257('0x19')](_0x10df98);return _0xeda7a6[_0xf257('0x1f')]('Content-Range',_0x3c28e0+'-'+_0x58c086+'/'+_0x267f3d)['json'](_0x5a291a);}return null;};}function patchUpdates(_0x497b30){return function(_0xa654f){try{jsonpatch[_0xf257('0x20')](_0xa654f,_0x497b30,!![]);}catch(_0x380d89){return BPromise[_0xf257('0x21')](_0x380d89);}return _0xa654f[_0xf257('0x22')]();};}function saveUpdates(_0x2efaa3,_0x5f12a5){return function(_0x17b63c){if(_0x17b63c){return _0x17b63c[_0xf257('0x23')](_0x2efaa3)[_0xf257('0x24')](function(_0x28f244){return _0x28f244;});}return null;};}function removeEntity(_0x59cdd5,_0x30cdd4){return function(_0x21faa1){if(_0x21faa1){return _0x21faa1['destroy']()[_0xf257('0x24')](function(){_0x59cdd5['status'](0xcc)[_0xf257('0x25')]();});}};}function handleEntityNotFound(_0x20b1a4,_0x2410e7){return function(_0x486337){if(!_0x486337){_0x20b1a4[_0xf257('0x18')](0x194);}return _0x486337;};}function handleError(_0x5bdab3,_0x5aaf13){_0x5aaf13=_0x5aaf13||0x1f4;return function(_0x5f5235){logger[_0xf257('0x26')](_0x5f5235['stack']);if(_0x5f5235[_0xf257('0x27')]){delete _0x5f5235['name'];}_0x5bdab3[_0xf257('0x19')](_0x5aaf13)['send'](_0x5f5235);};}exports[_0xf257('0x28')]=function(_0x328635,_0x1d23a5){var _0x107166={},_0x4fc7c4={},_0x2641c8={'count':0x0,'rows':[]};var _0x686467=_[_0xf257('0x29')](db[_0xf257('0x2a')][_0xf257('0x2b')],function(_0xc944eb){return{'name':_0xc944eb['fieldName'],'type':_0xc944eb[_0xf257('0x2c')]['key']};});_0x4fc7c4[_0xf257('0x2d')]=_[_0xf257('0x29')](_0x686467,_0xf257('0x27'));_0x4fc7c4[_0xf257('0x2e')]=_[_0xf257('0x2f')](_0x328635[_0xf257('0x2e')]);_0x4fc7c4[_0xf257('0x30')]=_[_0xf257('0x31')](_0x4fc7c4['model'],_0x4fc7c4['query']);_0x107166[_0xf257('0x32')]=_[_0xf257('0x31')](_0x4fc7c4[_0xf257('0x2d')],qs[_0xf257('0x33')](_0x328635[_0xf257('0x2e')]['fields']));_0x107166[_0xf257('0x32')]=_0x107166[_0xf257('0x32')][_0xf257('0x34')]?_0x107166[_0xf257('0x32')]:_0x4fc7c4[_0xf257('0x2d')];if(!_0x328635[_0xf257('0x2e')][_0xf257('0x35')](_0xf257('0x36'))){_0x107166[_0xf257('0x1d')]=qs[_0xf257('0x1d')](_0x328635[_0xf257('0x2e')][_0xf257('0x1d')]);_0x107166[_0xf257('0x1b')]=qs[_0xf257('0x1b')](_0x328635['query']['offset']);}_0x107166[_0xf257('0x37')]=qs['sort'](_0x328635[_0xf257('0x2e')][_0xf257('0x38')]);_0x107166[_0xf257('0x39')]=qs['filters'](_[_0xf257('0x3a')](_0x328635[_0xf257('0x2e')],_0x4fc7c4[_0xf257('0x30')]),_0x686467);if(_0x328635[_0xf257('0x2e')][_0xf257('0x3b')]){_0x107166[_0xf257('0x39')]=_[_0xf257('0x3c')](_0x107166[_0xf257('0x39')],{'$or':_[_0xf257('0x29')](_0x686467,function(_0x19510d){if(_0x19510d[_0xf257('0x2c')]!==_0xf257('0x3d')){var _0x383229={};_0x383229[_0x19510d[_0xf257('0x27')]]={'$like':'%'+_0x328635[_0xf257('0x2e')]['filter']+'%'};return _0x383229;}})});}_0x107166=_[_0xf257('0x3c')]({},_0x107166,_0x328635[_0xf257('0x3e')]);var _0x48037e={'where':_0x107166[_0xf257('0x39')]};return db[_0xf257('0x2a')]['count'](_0x48037e)['then'](function(_0x2f1f8d){_0x2641c8[_0xf257('0x1e')]=_0x2f1f8d;if(_0x328635[_0xf257('0x2e')][_0xf257('0x3f')]){_0x107166[_0xf257('0x40')]=[{'all':!![]}];}return db[_0xf257('0x2a')][_0xf257('0x41')](_0x107166);})[_0xf257('0x24')](function(_0x2be6fe){_0x2641c8[_0xf257('0x42')]=_0x2be6fe;return _0x2641c8;})['then'](respondWithFilteredResult(_0x1d23a5,_0x107166))['catch'](handleError(_0x1d23a5,null));};exports[_0xf257('0x43')]=function(_0x3fea4b,_0xa35f84){var _0xaa3ca2={'raw':![],'where':{'id':_0x3fea4b[_0xf257('0x44')]['id']}},_0x2d9c8b={};_0x2d9c8b[_0xf257('0x2d')]=_[_0xf257('0x2f')](db[_0xf257('0x2a')]['rawAttributes']);_0x2d9c8b[_0xf257('0x2e')]=_[_0xf257('0x2f')](_0x3fea4b[_0xf257('0x2e')]);_0x2d9c8b[_0xf257('0x30')]=_['intersection'](_0x2d9c8b[_0xf257('0x2d')],_0x2d9c8b[_0xf257('0x2e')]);_0xaa3ca2[_0xf257('0x32')]=_[_0xf257('0x31')](_0x2d9c8b['model'],qs[_0xf257('0x33')](_0x3fea4b[_0xf257('0x2e')]['fields']));_0xaa3ca2[_0xf257('0x32')]=_0xaa3ca2[_0xf257('0x32')][_0xf257('0x34')]?_0xaa3ca2[_0xf257('0x32')]:_0x2d9c8b[_0xf257('0x2d')];if(_0x3fea4b[_0xf257('0x2e')]['includeAll']){_0xaa3ca2['include']=[{'all':!![]}];}_0xaa3ca2=_[_0xf257('0x3c')]({},_0xaa3ca2,_0x3fea4b[_0xf257('0x3e')]);return db[_0xf257('0x2a')][_0xf257('0x45')](_0xaa3ca2)[_0xf257('0x24')](handleEntityNotFound(_0xa35f84,null))[_0xf257('0x24')](respondWithResult(_0xa35f84,null))[_0xf257('0x46')](handleError(_0xa35f84,null));};exports['create']=function(_0x7ba2d8,_0x58cdf8){return db[_0xf257('0x2a')][_0xf257('0x47')](_0x7ba2d8[_0xf257('0x48')],{})[_0xf257('0x24')](respondWithResult(_0x58cdf8,0xc9))['catch'](handleError(_0x58cdf8,null));};exports[_0xf257('0x23')]=function(_0x1a91b9,_0x2c85b2){if(_0x1a91b9[_0xf257('0x48')]['id']){delete _0x1a91b9[_0xf257('0x48')]['id'];}return db[_0xf257('0x2a')][_0xf257('0x45')]({'where':{'id':_0x1a91b9[_0xf257('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c85b2,null))[_0xf257('0x24')](saveUpdates(_0x1a91b9[_0xf257('0x48')],null))[_0xf257('0x24')](respondWithResult(_0x2c85b2,null))[_0xf257('0x46')](handleError(_0x2c85b2,null));};exports['destroy']=function(_0x2bb9a9,_0xa7ff36){return db[_0xf257('0x2a')]['find']({'where':{'id':_0x2bb9a9[_0xf257('0x44')]['id']}})[_0xf257('0x24')](handleEntityNotFound(_0xa7ff36,null))[_0xf257('0x24')](removeEntity(_0xa7ff36,null))[_0xf257('0x46')](handleError(_0xa7ff36,null));};exports['getConfigurations']=function(_0x536940,_0x5dfa93,_0x1b428a){var _0x4a331a={};var _0x427cdd={};var _0x49bed6;var _0x45dd9f;return db[_0xf257('0x2a')][_0xf257('0x49')]({'where':{'id':_0x536940['params']['id']}})['then'](handleEntityNotFound(_0x5dfa93,null))[_0xf257('0x24')](function(_0x2b7b9d){if(_0x2b7b9d){_0x49bed6=_0x2b7b9d;_0x427cdd[_0xf257('0x2d')]=_[_0xf257('0x2f')](db[_0xf257('0x4a')]['rawAttributes']);_0x427cdd[_0xf257('0x2e')]=_['keys'](_0x536940[_0xf257('0x2e')]);_0x427cdd[_0xf257('0x30')]=_[_0xf257('0x31')](_0x427cdd[_0xf257('0x2d')],_0x427cdd[_0xf257('0x2e')]);_0x4a331a['attributes']=_[_0xf257('0x31')](_0x427cdd[_0xf257('0x2d')],qs[_0xf257('0x33')](_0x536940[_0xf257('0x2e')][_0xf257('0x33')]));_0x4a331a['attributes']=_0x4a331a['attributes'][_0xf257('0x34')]?_0x4a331a['attributes']:_0x427cdd[_0xf257('0x2d')];_0x4a331a[_0xf257('0x37')]=qs[_0xf257('0x38')](_0x536940['query']['sort']);_0x4a331a[_0xf257('0x39')]=qs[_0xf257('0x30')](_['pick'](_0x536940[_0xf257('0x2e')],_0x427cdd[_0xf257('0x30')]));if(_0x536940[_0xf257('0x2e')]['filter']){_0x4a331a[_0xf257('0x39')]=_[_0xf257('0x3c')](_0x4a331a[_0xf257('0x39')],{'$or':_['map'](_0x4a331a[_0xf257('0x32')],function(_0x2ea881){var _0x5389f1={};_0x5389f1[_0x2ea881]={'$like':'%'+_0x536940[_0xf257('0x2e')]['filter']+'%'};return _0x5389f1;})});}_0x4a331a=_[_0xf257('0x3c')]({},_0x4a331a,_0x536940[_0xf257('0x3e')]);return _0x49bed6[_0xf257('0x4b')](_0x4a331a);}})['then'](function(_0x3968b2){if(_0x3968b2){_0x45dd9f=_0x3968b2[_0xf257('0x34')];if(!_0x536940['query']['hasOwnProperty']('nolimit')){_0x4a331a[_0xf257('0x1d')]=qs[_0xf257('0x1d')](_0x536940[_0xf257('0x2e')][_0xf257('0x1d')]);_0x4a331a[_0xf257('0x1b')]=qs[_0xf257('0x1b')](_0x536940[_0xf257('0x2e')][_0xf257('0x1b')]);}return _0x49bed6[_0xf257('0x4b')](_0x4a331a);}})[_0xf257('0x24')](function(_0x523658){if(_0x523658){return _0x523658?{'count':_0x45dd9f,'rows':_0x523658}:null;}})[_0xf257('0x24')](respondWithResult(_0x5dfa93,null))[_0xf257('0x46')](handleError(_0x5dfa93,null));};exports[_0xf257('0x4c')]=function(_0x3f6af0,_0x498124,_0x205c73){if(_0x3f6af0[_0xf257('0x48')]['id']){delete _0x3f6af0[_0xf257('0x48')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x3f6af0[_0xf257('0x44')]['id']}})[_0xf257('0x24')](handleEntityNotFound(_0x498124,null))[_0xf257('0x24')](function(_0x1dde42){if(_0x1dde42){_0x3f6af0[_0xf257('0x48')]['AccountId']=_0x1dde42['id'];_0x3f6af0[_0xf257('0x48')][_0xf257('0x4d')]=integrations[_0xf257('0x4e')](_0x3f6af0['body'][_0xf257('0x4f')],_0x3f6af0[_0xf257('0x48')][_0xf257('0x2c')]);_0x3f6af0[_0xf257('0x48')][_0xf257('0x50')]=integrations[_0xf257('0x51')](_0x3f6af0[_0xf257('0x48')][_0xf257('0x4f')],_0x3f6af0[_0xf257('0x48')][_0xf257('0x2c')]);return db[_0xf257('0x4a')][_0xf257('0x47')](_0x3f6af0[_0xf257('0x48')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xf257('0x52')],'as':'Descriptions'}]});}return null;})[_0xf257('0x24')](respondWithResult(_0x498124,null))[_0xf257('0x46')](handleError(_0x498124,null));};var md5=require(_0xf257('0x53'));exports[_0xf257('0x54')]=function(_0x5357da,_0x578a92,_0x34a45a){var _0x92b410=null;var _0x5fe76d=null;var _0x388ee0=null;var _0x17eb27=null;var _0x3a7c3b='';return db[_0xf257('0x2a')][_0xf257('0x49')]({'where':{'id':_0x5357da[_0xf257('0x44')]['id']},'attributes':['id','name','username',_0xf257('0x55'),'moduleName',_0xf257('0x56'),_0xf257('0x57'),'accessKey']})['then'](handleEntityNotFound(_0x578a92,null))['then'](function(_0x5310c3){if(_0x5310c3){_0x92b410=_0x5310c3[_0xf257('0x58')];_0x5fe76d=_0x5310c3['accessKey'];_0x388ee0=_0x5310c3[_0xf257('0x59')];_0x3a7c3b=_0x5310c3[_0xf257('0x56')];var _0x37c5e1=_0x3a7c3b[_0xf257('0x5a')](-0x1);if(_0x37c5e1==='/'){_0x3a7c3b=_0x3a7c3b[_0xf257('0x5b')](0x0,_0x3a7c3b['lastIndexOf'](_0x37c5e1));}_0x17eb27=util[_0xf257('0x5c')](_0xf257('0x5d'),_0x3a7c3b);var _0x55e07b={'method':_0xf257('0x5e'),'uri':_0x17eb27,'qs':{'operation':_0xf257('0x5f'),'username':_0x5310c3[_0xf257('0x58')]},'json':!![]};return rp(_0x55e07b);}})[_0xf257('0x24')](function(_0x2cf134){if(_0x2cf134[_0xf257('0x60')]){var _0x4db047={'method':'POST','uri':_0x17eb27,'form':{'operation':_0xf257('0x61'),'username':_0x92b410,'accessKey':md5(_0x2cf134[_0xf257('0x62')]['token']+_0x5fe76d)},'json':!![]};return rp(_0x4db047);}})[_0xf257('0x24')](function(_0x14f2d2){if(_0x14f2d2['success']){var _0x37851f={'method':'GET','uri':_0x17eb27,'qs':{'operation':'describe','username':_0x92b410,'sessionName':_0x14f2d2[_0xf257('0x62')]['sessionName'],'elementType':_0x388ee0},'json':!![]};return rp(_0x37851f);}})[_0xf257('0x24')](function(_0x19d2e3){if(_0x19d2e3['success']){var _0x2d7fc0=[_0xf257('0x63'),_0xf257('0x64'),_0xf257('0x65')];_['remove'](_0x19d2e3['result'][_0xf257('0x33')],function(_0x250fa0){return _0x2d7fc0[_0xf257('0x66')](_0x250fa0['type'][_0xf257('0x27')]);});_[_0xf257('0x67')](_0x19d2e3['result'][_0xf257('0x33')],function(_0x136262){return _0x136262[_0xf257('0x68')]===_0xf257('0x69');});return{'count':_0x19d2e3[_0xf257('0x62')][_0xf257('0x33')][_0xf257('0x34')],'rows':_[_0xf257('0x29')](_0x19d2e3[_0xf257('0x62')][_0xf257('0x33')],function(_0x192b45){return{'id':_0x192b45[_0xf257('0x27')],'name':_0x192b45[_0xf257('0x6a')],'custom':_[_0xf257('0x6b')](_0x192b45[_0xf257('0x27')],_0xf257('0x6c'))?!![]:![],'options':_0x192b45[_0xf257('0x2c')]['name']===_0xf257('0x6d')&&_0x192b45[_0xf257('0x2c')][_0xf257('0x6e')]['length']>0x0?_[_0xf257('0x29')](_0x192b45[_0xf257('0x2c')][_0xf257('0x6e')],function(_0x18fa04){return{'name':_0x18fa04[_0xf257('0x6a')],'value':_0x18fa04[_0xf257('0x6f')]};}):[]};})};}})[_0xf257('0x24')](respondWithResult(_0x578a92,null))[_0xf257('0x46')](function(_0x59c8ae){console[_0xf257('0x70')](_0xf257('0x71')+_0x59c8ae);var _0x3e4c92=_0x5357da[_0xf257('0x2e')][_0xf257('0x72')]?0x1f4:_0x59c8ae[_0xf257('0x73')]||0x1f4;logger[_0xf257('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3e4c92,JSON['stringify'](_0x59c8ae));delete _0x59c8ae[_0xf257('0x27')];if(_0x3e4c92===0x191){_0x3e4c92=0x190;}_0x578a92[_0xf257('0x19')](_0x3e4c92)['send'](_0x5357da[_0xf257('0x2e')][_0xf257('0x72')]?{'message':_0xf257('0x74'),'statusCode':_0x59c8ae[_0xf257('0x73')]}:_0x59c8ae);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 6c22c3a..1f7a662 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 _0xa95a=['VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x36e0d6,_0x5cc38d){var _0x407665=function(_0x946f29){while(--_0x946f29){_0x36e0d6['push'](_0x36e0d6['shift']());}};_0x407665(++_0x5cc38d);}(_0xa95a,0x17b));var _0xaa95=function(_0x388501,_0x5901a0){_0x388501=_0x388501-0x0;var _0x17801c=_0xa95a[_0x388501];return _0x17801c;};'use strict';var _=require(_0xaa95('0x0'));var util=require('util');var logger=require(_0xaa95('0x1'))(_0xaa95('0x2'));var moment=require(_0xaa95('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa95('0x4'));var fs=require('fs');var path=require(_0xaa95('0x5'));var rimraf=require(_0xaa95('0x6'));var config=require('../../config/environment');var attributes=require(_0xaa95('0x7'));var integrations=require(_0xaa95('0x8'));module[_0xaa95('0x9')]=function(_0x4303dc,_0xa7a375){return _0x4303dc[_0xaa95('0xa')](_0xaa95('0xb'),attributes,{'tableName':_0xaa95('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28fb=['path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','int_vtiger_accounts','util','api','moment','bluebird','request-promise'];(function(_0x343913,_0x40fc09){var _0x33f889=function(_0x2a11bb){while(--_0x2a11bb){_0x343913['push'](_0x343913['shift']());}};_0x33f889(++_0x40fc09);}(_0x28fb,0xb6));var _0xb28f=function(_0x26efac,_0x21ab8a){_0x26efac=_0x26efac-0x0;var _0x8482e4=_0x28fb[_0x26efac];return _0x8482e4;};'use strict';var _=require('lodash');var util=require(_0xb28f('0x0'));var logger=require('../../config/logger')(_0xb28f('0x1'));var moment=require(_0xb28f('0x2'));var BPromise=require(_0xb28f('0x3'));var rp=require(_0xb28f('0x4'));var fs=require('fs');var path=require(_0xb28f('0x5'));var rimraf=require(_0xb28f('0x6'));var config=require(_0xb28f('0x7'));var attributes=require(_0xb28f('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xb28f('0x9')]=function(_0x17680d,_0x5dff82){return _0x17680d['define']('VtigerAccount',attributes,{'tableName':_0xb28f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index db48183..63f2ff3 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 _0x6e6c=['where','limit','include','map','attributes','model','GetVtigerAccount','ShowVtigerAccount','find','lodash','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','VtigerAccount','findAll','options','raw'];(function(_0x3a56ad,_0x3b9f60){var _0x502c5b=function(_0x20c651){while(--_0x20c651){_0x3a56ad['push'](_0x3a56ad['shift']());}};_0x502c5b(++_0x3b9f60);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var moment=require('moment');var BPromise=require(_0xc6e6('0x2'));var rs=require(_0xc6e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc6e6('0x4'));var logger=require('../../config/logger')(_0xc6e6('0x5'));var config=require('../../config/environment');var jayson=require(_0xc6e6('0x6'));var client=jayson[_0xc6e6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301f55,_0x30a10b,_0x4da7bd){return new BPromise(function(_0x324706,_0x15d268){return client['request'](_0x301f55,_0x4da7bd)[_0xc6e6('0x8')](function(_0x481799){logger[_0xc6e6('0x9')](_0xc6e6('0xa'),_0x30a10b,_0xc6e6('0xb'));logger[_0xc6e6('0xc')](_0xc6e6('0xd'),_0x30a10b,_0xc6e6('0xb'),JSON[_0xc6e6('0xe')](_0x481799));if(_0x481799[_0xc6e6('0xf')]){if(_0x481799[_0xc6e6('0xf')]['code']===0x1f4){logger[_0xc6e6('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x30a10b,_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);return _0x15d268(_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);}logger['error'](_0xc6e6('0xa'),_0x30a10b,_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);return _0x324706(_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);}else{logger['info'](_0xc6e6('0xa'),_0x30a10b,_0xc6e6('0xb'));_0x324706(_0x481799['result'][_0xc6e6('0x10')]);}})[_0xc6e6('0x11')](function(_0xedf127){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x30a10b,_0xedf127);_0x15d268(_0xedf127);});});}exports['GetVtigerAccount']=function(_0x3a1ccc){var _0x554262=this;return new Promise(function(_0x46e58f,_0x2069e4){return db[_0xc6e6('0x12')][_0xc6e6('0x13')]({'raw':_0x3a1ccc[_0xc6e6('0x14')]?_0x3a1ccc[_0xc6e6('0x14')][_0xc6e6('0x15')]===undefined?!![]:![]:!![],'where':_0x3a1ccc[_0xc6e6('0x14')]?_0x3a1ccc[_0xc6e6('0x14')][_0xc6e6('0x16')]||null:null,'attributes':_0x3a1ccc['options']?_0x3a1ccc[_0xc6e6('0x14')]['attributes']||null:null,'limit':_0x3a1ccc[_0xc6e6('0x14')]?_0x3a1ccc[_0xc6e6('0x14')][_0xc6e6('0x17')]||null:null,'include':_0x3a1ccc[_0xc6e6('0x14')]?_0x3a1ccc['options'][_0xc6e6('0x18')]?_[_0xc6e6('0x19')](_0x3a1ccc[_0xc6e6('0x14')][_0xc6e6('0x18')],function(_0x107561){return{'model':db[_0x107561['model']],'as':_0x107561['as'],'attributes':_0x107561[_0xc6e6('0x1a')],'include':_0x107561['include']?_[_0xc6e6('0x19')](_0x107561[_0xc6e6('0x18')],function(_0x2e5e0e){return{'model':db[_0x2e5e0e[_0xc6e6('0x1b')]],'as':_0x2e5e0e['as'],'attributes':_0x2e5e0e['attributes'],'include':_0x2e5e0e[_0xc6e6('0x18')]?_['map'](_0x2e5e0e[_0xc6e6('0x18')],function(_0x534745){return{'model':db[_0x534745[_0xc6e6('0x1b')]],'as':_0x534745['as'],'attributes':_0x534745[_0xc6e6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc6e6('0x8')](function(_0x41e7c2){logger[_0xc6e6('0x9')]('GetVtigerAccount',_0x3a1ccc);logger[_0xc6e6('0xc')](_0xc6e6('0x1c'),_0x3a1ccc,JSON[_0xc6e6('0xe')](_0x41e7c2));_0x46e58f(_0x41e7c2);})[_0xc6e6('0x11')](function(_0x4d1284){logger[_0xc6e6('0xf')]('GetVtigerAccount',_0x4d1284[_0xc6e6('0x10')],_0x3a1ccc);_0x2069e4(_0x554262[_0xc6e6('0xf')](0x1f4,_0x4d1284[_0xc6e6('0x10')]));});});};exports[_0xc6e6('0x1d')]=function(_0xd3b63){var _0x402598=this;return new Promise(function(_0x43ff9c,_0x337442){return db[_0xc6e6('0x12')][_0xc6e6('0x1e')]({'raw':_0xd3b63[_0xc6e6('0x14')]?_0xd3b63[_0xc6e6('0x14')][_0xc6e6('0x15')]===undefined?!![]:![]:!![],'where':_0xd3b63[_0xc6e6('0x14')]?_0xd3b63[_0xc6e6('0x14')][_0xc6e6('0x16')]||null:null,'attributes':_0xd3b63[_0xc6e6('0x14')]?_0xd3b63['options'][_0xc6e6('0x1a')]||null:null,'include':_0xd3b63[_0xc6e6('0x14')]?_0xd3b63['options']['include']?_[_0xc6e6('0x19')](_0xd3b63[_0xc6e6('0x14')][_0xc6e6('0x18')],function(_0x152e45){return{'model':db[_0x152e45[_0xc6e6('0x1b')]],'as':_0x152e45['as'],'attributes':_0x152e45[_0xc6e6('0x1a')],'include':_0x152e45['include']?_[_0xc6e6('0x19')](_0x152e45[_0xc6e6('0x18')],function(_0x1fff39){return{'model':db[_0x1fff39['model']],'as':_0x1fff39['as'],'attributes':_0x1fff39['attributes'],'include':_0x1fff39[_0xc6e6('0x18')]?_[_0xc6e6('0x19')](_0x1fff39[_0xc6e6('0x18')],function(_0x2db0a2){return{'model':db[_0x2db0a2['model']],'as':_0x2db0a2['as'],'attributes':_0x2db0a2['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6e6('0x8')](function(_0x4e94ea){logger[_0xc6e6('0x9')]('ShowVtigerAccount',_0xd3b63);logger[_0xc6e6('0xc')](_0xc6e6('0x1d'),_0xd3b63,JSON[_0xc6e6('0xe')](_0x4e94ea));_0x43ff9c(_0x4e94ea);})[_0xc6e6('0x11')](function(_0x58b972){logger['error'](_0xc6e6('0x1d'),_0x58b972[_0xc6e6('0x10')],_0xd3b63);_0x337442(_0x402598[_0xc6e6('0xf')](0x1f4,_0x58b972[_0xc6e6('0x10')]));});});}; \ No newline at end of file +var _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowVtigerAccount','VtigerAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../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','error','code','message','result','catch','GetVtigerAccount','findAll'];(function(_0x326927,_0x436402){var _0x3709cc=function(_0x2ac0d1){while(--_0x2ac0d1){_0x326927['push'](_0x326927['shift']());}};_0x3709cc(++_0x436402);}(_0xe706,0xa3));var _0x6e70=function(_0x16c1d9,_0x2a1270){_0x16c1d9=_0x16c1d9-0x0;var _0x85293b=_0xe706[_0x16c1d9];return _0x85293b;};'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']('VtigerAccount,\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']('VtigerAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['VtigerAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetVtigerAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 3794783..e4fac6c 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 _0xaddc=['../../config/environment','./intVtigerConfiguration.controller','get','index','show','/:id/fields','isAuthenticated','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0xaddc,0x182));var _0xcadd=function(_0x8a00c0,_0x3f918b){_0x8a00c0=_0x8a00c0-0x0;var _0x5bc5a9=_0xaddc[_0x8a00c0];return _0x5bc5a9;};'use strict';var multer=require(_0xcadd('0x0'));var util=require('util');var path=require(_0xcadd('0x1'));var timeout=require(_0xcadd('0x2'));var express=require(_0xcadd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcadd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcadd('0x5'));var controller=require(_0xcadd('0x6'));router[_0xcadd('0x7')]('/',auth['isAuthenticated'](),controller[_0xcadd('0x8')]);router[_0xcadd('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xcadd('0x9')]);router['get'](_0xcadd('0xa'),auth[_0xcadd('0xb')](),controller[_0xcadd('0xc')]);router[_0xcadd('0x7')]('/:id/subjects',auth[_0xcadd('0xb')](),controller[_0xcadd('0xd')]);router[_0xcadd('0x7')](_0xcadd('0xe'),auth['isAuthenticated'](),controller[_0xcadd('0xf')]);router[_0xcadd('0x10')]('/',auth['isAuthenticated'](),controller[_0xcadd('0x11')]);router[_0xcadd('0x12')](_0xcadd('0x13'),auth[_0xcadd('0xb')](),controller[_0xcadd('0x14')]);router[_0xcadd('0x15')](_0xcadd('0x13'),auth[_0xcadd('0xb')](),controller[_0xcadd('0x16')]);module['exports']=router; \ No newline at end of file +var _0x63ec=['delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','create','put','/:id','update'];(function(_0x2be5d1,_0x3a5830){var _0x2d1d41=function(_0x262162){while(--_0x262162){_0x2be5d1['push'](_0x2be5d1['shift']());}};_0x2d1d41(++_0x3a5830);}(_0x63ec,0x162));var _0xc63e=function(_0x4eca25,_0x1423e2){_0x4eca25=_0x4eca25-0x0;var _0x48fcf5=_0x63ec[_0x4eca25];return _0x48fcf5;};'use strict';var multer=require(_0xc63e('0x0'));var util=require('util');var path=require(_0xc63e('0x1'));var timeout=require('connect-timeout');var express=require(_0xc63e('0x2'));var router=express[_0xc63e('0x3')]();var fs_extra=require(_0xc63e('0x4'));var auth=require(_0xc63e('0x5'));var interaction=require(_0xc63e('0x6'));var config=require(_0xc63e('0x7'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0xc63e('0x8')](),controller[_0xc63e('0x9')]);router[_0xc63e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc63e('0xb')]);router[_0xc63e('0xa')](_0xc63e('0xc'),auth[_0xc63e('0x8')](),controller[_0xc63e('0xd')]);router['get'](_0xc63e('0xe'),auth[_0xc63e('0x8')](),controller['getSubjects']);router[_0xc63e('0xa')](_0xc63e('0xf'),auth[_0xc63e('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0xc63e('0x8')](),controller[_0xc63e('0x10')]);router[_0xc63e('0x11')](_0xc63e('0x12'),auth[_0xc63e('0x8')](),controller[_0xc63e('0x13')]);router[_0xc63e('0x14')](_0xc63e('0x12'),auth[_0xc63e('0x8')](),controller['destroy']);module[_0xc63e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index f2c6659..e95abcd 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 _0xc540=['exports','STRING','sequelize'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xc540,0xf5));var _0x0c54=function(_0x4a8ac2,_0xfecce1){_0x4a8ac2=_0x4a8ac2-0x0;var _0x471870=_0xc540[_0x4a8ac2];return _0x471870;};'use strict';var Sequelize=require(_0x0c54('0x0'));module[_0x0c54('0x1')]={'name':{'type':Sequelize[_0x0c54('0x2')]},'description':{'type':Sequelize[_0x0c54('0x2')]}}; \ No newline at end of file +var _0x909d=['exports','STRING','sequelize'];(function(_0x2ba054,_0x4cfa79){var _0x5d2153=function(_0xd698b4){while(--_0xd698b4){_0x2ba054['push'](_0x2ba054['shift']());}};_0x5d2153(++_0x4cfa79);}(_0x909d,0x14f));var _0xd909=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x909d[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require(_0xd909('0x0'));module[_0xd909('0x1')]={'name':{'type':Sequelize[_0xd909('0x2')]},'description':{'type':Sequelize[_0xd909('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 22697e7..01039ef 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 _0x5be0=['order','sort','pick','filter','where','VIRTUAL','merge','options','VtigerConfiguration','includeAll','include','findAll','rows','catch','params','length','create','body','find','getFields','VtigerField','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit'];(function(_0x53a570,_0x3ccb09){var _0x33bc35=function(_0x180f45){while(--_0x180f45){_0x53a570['push'](_0x53a570['shift']());}};_0x33bc35(++_0x3ccb09);}(_0x5be0,0x154));var _0x05be=function(_0x49ed52,_0x49f9b7){_0x49ed52=_0x49ed52-0x0;var _0xa6ec5d=_0x5be0[_0x49ed52];return _0xa6ec5d;};'use strict';var emlformat=require(_0x05be('0x0'));var rimraf=require(_0x05be('0x1'));var zipdir=require(_0x05be('0x2'));var jsonpatch=require(_0x05be('0x3'));var rp=require(_0x05be('0x4'));var moment=require('moment');var BPromise=require(_0x05be('0x5'));var Mustache=require(_0x05be('0x6'));var util=require('util');var path=require('path');var sox=require(_0x05be('0x7'));var csv=require('to-csv');var ejs=require(_0x05be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05be('0x9'));var squel=require(_0x05be('0xa'));var crypto=require('crypto');var jsforce=require(_0x05be('0xb'));var deskjs=require(_0x05be('0xc'));var toCsv=require(_0x05be('0xd'));var querystring=require(_0x05be('0xe'));var Papa=require(_0x05be('0xf'));var Redis=require(_0x05be('0x10'));var authService=require(_0x05be('0x11'));var qs=require(_0x05be('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05be('0x13'));var logger=require(_0x05be('0x14'))(_0x05be('0x15'));var utils=require(_0x05be('0x16'));var config=require(_0x05be('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x05be('0x18'))['db'];function respondWithStatusCode(_0x59d85f,_0x5489fa){_0x5489fa=_0x5489fa||0xcc;return function(_0x350d27){if(_0x350d27){return _0x59d85f[_0x05be('0x19')](_0x5489fa);}return _0x59d85f[_0x05be('0x1a')](_0x5489fa)[_0x05be('0x1b')]();};}function respondWithResult(_0x2d57f1,_0x5d348d){_0x5d348d=_0x5d348d||0xc8;return function(_0x472ad1){if(_0x472ad1){return _0x2d57f1[_0x05be('0x1a')](_0x5d348d)[_0x05be('0x1c')](_0x472ad1);}};}function respondWithFilteredResult(_0x565991,_0xf333ae){return function(_0x191c82){if(_0x191c82){var _0x21749e=typeof _0xf333ae['offset']===_0x05be('0x1d')&&typeof _0xf333ae[_0x05be('0x1e')]==='undefined';var _0x282203=_0x191c82['count'];var _0x1fc75b=_0x21749e?0x0:_0xf333ae[_0x05be('0x1f')];var _0x4c2628=_0x21749e?_0x191c82[_0x05be('0x20')]:_0xf333ae[_0x05be('0x1f')]+_0xf333ae[_0x05be('0x1e')];var _0x56b0da;if(_0x4c2628>=_0x282203){_0x4c2628=_0x282203;_0x56b0da=0xc8;}else{_0x56b0da=0xce;}_0x565991[_0x05be('0x1a')](_0x56b0da);return _0x565991['set']('Content-Range',_0x1fc75b+'-'+_0x4c2628+'/'+_0x282203)[_0x05be('0x1c')](_0x191c82);}return null;};}function patchUpdates(_0x83765f){return function(_0x49f3a7){try{jsonpatch['apply'](_0x49f3a7,_0x83765f,!![]);}catch(_0x27da62){return BPromise['reject'](_0x27da62);}return _0x49f3a7['save']();};}function saveUpdates(_0x4e2204,_0x2a99e8){return function(_0x467866){if(_0x467866){return _0x467866[_0x05be('0x21')](_0x4e2204)[_0x05be('0x22')](function(_0x4aa04d){return _0x4aa04d;});}return null;};}function removeEntity(_0x27478c,_0x57d497){return function(_0x20193f){if(_0x20193f){return _0x20193f[_0x05be('0x23')]()['then'](function(){_0x27478c[_0x05be('0x1a')](0xcc)[_0x05be('0x1b')]();});}};}function handleEntityNotFound(_0x2e5709,_0x3195e2){return function(_0x96d8d8){if(!_0x96d8d8){_0x2e5709[_0x05be('0x19')](0x194);}return _0x96d8d8;};}function handleError(_0x31056d,_0x82223b){_0x82223b=_0x82223b||0x1f4;return function(_0x467d40){logger[_0x05be('0x24')](_0x467d40[_0x05be('0x25')]);if(_0x467d40[_0x05be('0x26')]){delete _0x467d40[_0x05be('0x26')];}_0x31056d[_0x05be('0x1a')](_0x82223b)[_0x05be('0x27')](_0x467d40);};}exports[_0x05be('0x28')]=function(_0x19ded8,_0x3853d9){var _0x4a4725={},_0x10ecbf={},_0x281c3e={'count':0x0,'rows':[]};var _0x315d51=_[_0x05be('0x29')](db['VtigerConfiguration'][_0x05be('0x2a')],function(_0x5eb9f5){return{'name':_0x5eb9f5[_0x05be('0x2b')],'type':_0x5eb9f5[_0x05be('0x2c')][_0x05be('0x2d')]};});_0x10ecbf['model']=_[_0x05be('0x29')](_0x315d51,_0x05be('0x26'));_0x10ecbf[_0x05be('0x2e')]=_[_0x05be('0x2f')](_0x19ded8[_0x05be('0x2e')]);_0x10ecbf[_0x05be('0x30')]=_[_0x05be('0x31')](_0x10ecbf['model'],_0x10ecbf['query']);_0x4a4725[_0x05be('0x32')]=_[_0x05be('0x31')](_0x10ecbf[_0x05be('0x33')],qs['fields'](_0x19ded8[_0x05be('0x2e')][_0x05be('0x34')]));_0x4a4725[_0x05be('0x32')]=_0x4a4725[_0x05be('0x32')]['length']?_0x4a4725[_0x05be('0x32')]:_0x10ecbf['model'];if(!_0x19ded8['query'][_0x05be('0x35')](_0x05be('0x36'))){_0x4a4725['limit']=qs[_0x05be('0x1e')](_0x19ded8['query'][_0x05be('0x1e')]);_0x4a4725[_0x05be('0x1f')]=qs['offset'](_0x19ded8[_0x05be('0x2e')][_0x05be('0x1f')]);}_0x4a4725[_0x05be('0x37')]=qs[_0x05be('0x38')](_0x19ded8[_0x05be('0x2e')][_0x05be('0x38')]);_0x4a4725['where']=qs[_0x05be('0x30')](_[_0x05be('0x39')](_0x19ded8[_0x05be('0x2e')],_0x10ecbf['filters']),_0x315d51);if(_0x19ded8[_0x05be('0x2e')][_0x05be('0x3a')]){_0x4a4725[_0x05be('0x3b')]=_['merge'](_0x4a4725['where'],{'$or':_[_0x05be('0x29')](_0x315d51,function(_0x50f79b){if(_0x50f79b[_0x05be('0x2c')]!==_0x05be('0x3c')){var _0x30a37a={};_0x30a37a[_0x50f79b[_0x05be('0x26')]]={'$like':'%'+_0x19ded8[_0x05be('0x2e')][_0x05be('0x3a')]+'%'};return _0x30a37a;}})});}_0x4a4725=_[_0x05be('0x3d')]({},_0x4a4725,_0x19ded8[_0x05be('0x3e')]);var _0x23c102={'where':_0x4a4725['where']};return db[_0x05be('0x3f')][_0x05be('0x20')](_0x23c102)['then'](function(_0x12ce6c){_0x281c3e[_0x05be('0x20')]=_0x12ce6c;if(_0x19ded8[_0x05be('0x2e')][_0x05be('0x40')]){_0x4a4725[_0x05be('0x41')]=[{'all':!![]}];}return db[_0x05be('0x3f')][_0x05be('0x42')](_0x4a4725);})[_0x05be('0x22')](function(_0x190c40){_0x281c3e[_0x05be('0x43')]=_0x190c40;return _0x281c3e;})[_0x05be('0x22')](respondWithFilteredResult(_0x3853d9,_0x4a4725))[_0x05be('0x44')](handleError(_0x3853d9,null));};exports['show']=function(_0x245c92,_0x4f5fa2){var _0x2db4e6={'raw':![],'where':{'id':_0x245c92[_0x05be('0x45')]['id']}},_0x4e19ca={};_0x4e19ca[_0x05be('0x33')]=_[_0x05be('0x2f')](db[_0x05be('0x3f')][_0x05be('0x2a')]);_0x4e19ca['query']=_[_0x05be('0x2f')](_0x245c92[_0x05be('0x2e')]);_0x4e19ca[_0x05be('0x30')]=_['intersection'](_0x4e19ca['model'],_0x4e19ca[_0x05be('0x2e')]);_0x2db4e6[_0x05be('0x32')]=_[_0x05be('0x31')](_0x4e19ca['model'],qs['fields'](_0x245c92['query']['fields']));_0x2db4e6['attributes']=_0x2db4e6['attributes'][_0x05be('0x46')]?_0x2db4e6[_0x05be('0x32')]:_0x4e19ca[_0x05be('0x33')];if(_0x245c92[_0x05be('0x2e')][_0x05be('0x40')]){_0x2db4e6[_0x05be('0x41')]=[{'all':!![]}];}_0x2db4e6=_[_0x05be('0x3d')]({},_0x2db4e6,_0x245c92['options']);return db['VtigerConfiguration']['find'](_0x2db4e6)[_0x05be('0x22')](handleEntityNotFound(_0x4f5fa2,null))[_0x05be('0x22')](respondWithResult(_0x4f5fa2,null))[_0x05be('0x44')](handleError(_0x4f5fa2,null));};exports['create']=function(_0x1f58ab,_0x1efec5){return db['VtigerConfiguration'][_0x05be('0x47')](_0x1f58ab[_0x05be('0x48')],{})[_0x05be('0x22')](respondWithResult(_0x1efec5,0xc9))['catch'](handleError(_0x1efec5,null));};exports[_0x05be('0x21')]=function(_0x419311,_0x22c417){if(_0x419311[_0x05be('0x48')]['id']){delete _0x419311['body']['id'];}return db[_0x05be('0x3f')][_0x05be('0x49')]({'where':{'id':_0x419311['params']['id']}})[_0x05be('0x22')](handleEntityNotFound(_0x22c417,null))[_0x05be('0x22')](saveUpdates(_0x419311[_0x05be('0x48')],null))['then'](respondWithResult(_0x22c417,null))[_0x05be('0x44')](handleError(_0x22c417,null));};exports[_0x05be('0x23')]=function(_0x12eaaf,_0x36c1c5){return db['VtigerConfiguration']['find']({'where':{'id':_0x12eaaf['params']['id']}})[_0x05be('0x22')](handleEntityNotFound(_0x36c1c5,null))['then'](removeEntity(_0x36c1c5,null))['catch'](handleError(_0x36c1c5,null));};exports[_0x05be('0x4a')]=function(_0x11ebc1,_0x15dfa9,_0x35503a){var _0x444fe2={};var _0x3a2fbb={};var _0x27be62;var _0x180ec9;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x11ebc1[_0x05be('0x45')]['id']}})['then'](handleEntityNotFound(_0x15dfa9,null))[_0x05be('0x22')](function(_0x26bb60){if(_0x26bb60){_0x27be62=_0x26bb60;_0x3a2fbb['model']=_[_0x05be('0x2f')](db[_0x05be('0x4b')]['rawAttributes']);_0x3a2fbb[_0x05be('0x2e')]=_[_0x05be('0x2f')](_0x11ebc1['query']);_0x3a2fbb['filters']=_[_0x05be('0x31')](_0x3a2fbb['model'],_0x3a2fbb[_0x05be('0x2e')]);_0x444fe2[_0x05be('0x32')]=_[_0x05be('0x31')](_0x3a2fbb['model'],qs[_0x05be('0x34')](_0x11ebc1['query'][_0x05be('0x34')]));_0x444fe2[_0x05be('0x32')]=_0x444fe2[_0x05be('0x32')][_0x05be('0x46')]?_0x444fe2[_0x05be('0x32')]:_0x3a2fbb[_0x05be('0x33')];_0x444fe2[_0x05be('0x37')]=qs['sort'](_0x11ebc1[_0x05be('0x2e')][_0x05be('0x38')]);_0x444fe2[_0x05be('0x3b')]=qs['filters'](_['pick'](_0x11ebc1['query'],_0x3a2fbb['filters']));if(_0x11ebc1['query'][_0x05be('0x3a')]){_0x444fe2[_0x05be('0x3b')]=_[_0x05be('0x3d')](_0x444fe2[_0x05be('0x3b')],{'$or':_['map'](_0x444fe2['attributes'],function(_0x57c681){var _0x270a7b={};_0x270a7b[_0x57c681]={'$like':'%'+_0x11ebc1[_0x05be('0x2e')][_0x05be('0x3a')]+'%'};return _0x270a7b;})});}_0x444fe2=_[_0x05be('0x3d')]({},_0x444fe2,_0x11ebc1[_0x05be('0x3e')]);return _0x27be62[_0x05be('0x4a')](_0x444fe2);}})[_0x05be('0x22')](function(_0x861472){if(_0x861472){_0x180ec9=_0x861472[_0x05be('0x46')];if(!_0x11ebc1[_0x05be('0x2e')][_0x05be('0x35')](_0x05be('0x36'))){_0x444fe2[_0x05be('0x1e')]=qs[_0x05be('0x1e')](_0x11ebc1['query'][_0x05be('0x1e')]);_0x444fe2[_0x05be('0x1f')]=qs[_0x05be('0x1f')](_0x11ebc1[_0x05be('0x2e')]['offset']);}return _0x27be62[_0x05be('0x4a')](_0x444fe2);}})[_0x05be('0x22')](function(_0x13f60f){if(_0x13f60f){return _0x13f60f?{'count':_0x180ec9,'rows':_0x13f60f}:null;}})[_0x05be('0x22')](respondWithResult(_0x15dfa9,null))[_0x05be('0x44')](handleError(_0x15dfa9,null));};exports[_0x05be('0x4c')]=function(_0x49b16e,_0xe5bc8,_0x951479){var _0x373bae={};var _0x18037d={};var _0xf5ae75;var _0x19ef18;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x49b16e[_0x05be('0x45')]['id']}})[_0x05be('0x22')](handleEntityNotFound(_0xe5bc8,null))['then'](function(_0x373123){if(_0x373123){_0xf5ae75=_0x373123;_0x18037d[_0x05be('0x33')]=_[_0x05be('0x2f')](db['VtigerField'][_0x05be('0x2a')]);_0x18037d[_0x05be('0x2e')]=_[_0x05be('0x2f')](_0x49b16e[_0x05be('0x2e')]);_0x18037d['filters']=_[_0x05be('0x31')](_0x18037d[_0x05be('0x33')],_0x18037d['query']);_0x373bae[_0x05be('0x32')]=_[_0x05be('0x31')](_0x18037d[_0x05be('0x33')],qs[_0x05be('0x34')](_0x49b16e['query'][_0x05be('0x34')]));_0x373bae[_0x05be('0x32')]=_0x373bae[_0x05be('0x32')]['length']?_0x373bae[_0x05be('0x32')]:_0x18037d[_0x05be('0x33')];_0x373bae[_0x05be('0x37')]=qs[_0x05be('0x38')](_0x49b16e[_0x05be('0x2e')][_0x05be('0x38')]);_0x373bae['where']=qs['filters'](_[_0x05be('0x39')](_0x49b16e[_0x05be('0x2e')],_0x18037d['filters']));if(_0x49b16e[_0x05be('0x2e')][_0x05be('0x3a')]){_0x373bae[_0x05be('0x3b')]=_[_0x05be('0x3d')](_0x373bae[_0x05be('0x3b')],{'$or':_[_0x05be('0x29')](_0x373bae['attributes'],function(_0x22ca73){var _0x328786={};_0x328786[_0x22ca73]={'$like':'%'+_0x49b16e['query'][_0x05be('0x3a')]+'%'};return _0x328786;})});}_0x373bae=_[_0x05be('0x3d')]({},_0x373bae,_0x49b16e[_0x05be('0x3e')]);return _0xf5ae75[_0x05be('0x4c')](_0x373bae);}})[_0x05be('0x22')](function(_0x20080b){if(_0x20080b){_0x19ef18=_0x20080b[_0x05be('0x46')];if(!_0x49b16e[_0x05be('0x2e')]['hasOwnProperty'](_0x05be('0x36'))){_0x373bae[_0x05be('0x1e')]=qs[_0x05be('0x1e')](_0x49b16e[_0x05be('0x2e')][_0x05be('0x1e')]);_0x373bae[_0x05be('0x1f')]=qs[_0x05be('0x1f')](_0x49b16e[_0x05be('0x2e')][_0x05be('0x1f')]);}return _0xf5ae75[_0x05be('0x4c')](_0x373bae);}})['then'](function(_0x3a43fd){if(_0x3a43fd){return _0x3a43fd?{'count':_0x19ef18,'rows':_0x3a43fd}:null;}})[_0x05be('0x22')](respondWithResult(_0xe5bc8,null))['catch'](handleError(_0xe5bc8,null));};exports['getDescriptions']=function(_0xf9a8e4,_0x309a77,_0x520482){var _0x5e625c={};var _0x29dbea={};var _0x4c64e0;var _0xe8ecfc;return db[_0x05be('0x3f')][_0x05be('0x4d')]({'where':{'id':_0xf9a8e4[_0x05be('0x45')]['id']}})['then'](handleEntityNotFound(_0x309a77,null))[_0x05be('0x22')](function(_0x3f86f9){if(_0x3f86f9){_0x4c64e0=_0x3f86f9;_0x29dbea[_0x05be('0x33')]=_[_0x05be('0x2f')](db[_0x05be('0x4b')][_0x05be('0x2a')]);_0x29dbea[_0x05be('0x2e')]=_['keys'](_0xf9a8e4[_0x05be('0x2e')]);_0x29dbea['filters']=_[_0x05be('0x31')](_0x29dbea['model'],_0x29dbea[_0x05be('0x2e')]);_0x5e625c['attributes']=_['intersection'](_0x29dbea[_0x05be('0x33')],qs[_0x05be('0x34')](_0xf9a8e4[_0x05be('0x2e')][_0x05be('0x34')]));_0x5e625c[_0x05be('0x32')]=_0x5e625c[_0x05be('0x32')][_0x05be('0x46')]?_0x5e625c['attributes']:_0x29dbea[_0x05be('0x33')];_0x5e625c[_0x05be('0x37')]=qs['sort'](_0xf9a8e4[_0x05be('0x2e')][_0x05be('0x38')]);_0x5e625c[_0x05be('0x3b')]=qs['filters'](_[_0x05be('0x39')](_0xf9a8e4[_0x05be('0x2e')],_0x29dbea['filters']));if(_0xf9a8e4[_0x05be('0x2e')]['filter']){_0x5e625c[_0x05be('0x3b')]=_[_0x05be('0x3d')](_0x5e625c[_0x05be('0x3b')],{'$or':_['map'](_0x5e625c[_0x05be('0x32')],function(_0xc3b070){var _0x3f691f={};_0x3f691f[_0xc3b070]={'$like':'%'+_0xf9a8e4['query'][_0x05be('0x3a')]+'%'};return _0x3f691f;})});}_0x5e625c=_['merge']({},_0x5e625c,_0xf9a8e4[_0x05be('0x3e')]);return _0x4c64e0[_0x05be('0x4e')](_0x5e625c);}})[_0x05be('0x22')](function(_0x11f31c){if(_0x11f31c){_0xe8ecfc=_0x11f31c[_0x05be('0x46')];if(!_0xf9a8e4[_0x05be('0x2e')][_0x05be('0x35')]('nolimit')){_0x5e625c[_0x05be('0x1e')]=qs['limit'](_0xf9a8e4[_0x05be('0x2e')]['limit']);_0x5e625c[_0x05be('0x1f')]=qs[_0x05be('0x1f')](_0xf9a8e4[_0x05be('0x2e')][_0x05be('0x1f')]);}return _0x4c64e0[_0x05be('0x4e')](_0x5e625c);}})['then'](function(_0x4d861f){if(_0x4d861f){return _0x4d861f?{'count':_0xe8ecfc,'rows':_0x4d861f}:null;}})[_0x05be('0x22')](respondWithResult(_0x309a77,null))[_0x05be('0x44')](handleError(_0x309a77,null));}; \ No newline at end of file +var _0x13b4=['fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','VtigerConfiguration','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','find','catch','create','update','body','params','getFields','findOne','VtigerField','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs'];(function(_0x133275,_0x2d9c14){var _0x5f59ae=function(_0xb414d4){while(--_0xb414d4){_0x133275['push'](_0x133275['shift']());}};_0x5f59ae(++_0x2d9c14);}(_0x13b4,0x18f));var _0x413b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x13b4[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x413b('0x0'));var rimraf=require(_0x413b('0x1'));var zipdir=require(_0x413b('0x2'));var jsonpatch=require(_0x413b('0x3'));var rp=require(_0x413b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x413b('0x5'));var util=require(_0x413b('0x6'));var path=require(_0x413b('0x7'));var sox=require(_0x413b('0x8'));var csv=require(_0x413b('0x9'));var ejs=require(_0x413b('0xa'));var fs=require('fs');var fs_extra=require(_0x413b('0xb'));var _=require(_0x413b('0xc'));var squel=require('squel');var crypto=require(_0x413b('0xd'));var jsforce=require(_0x413b('0xe'));var deskjs=require(_0x413b('0xf'));var toCsv=require(_0x413b('0x9'));var querystring=require(_0x413b('0x10'));var Papa=require(_0x413b('0x11'));var Redis=require('ioredis');var authService=require(_0x413b('0x12'));var qs=require(_0x413b('0x13'));var as=require(_0x413b('0x14'));var hardwareService=require(_0x413b('0x15'));var logger=require(_0x413b('0x16'))(_0x413b('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x413b('0x18'));var db=require(_0x413b('0x19'))['db'];function respondWithStatusCode(_0x46accd,_0xaa818d){_0xaa818d=_0xaa818d||0xcc;return function(_0x21f7dd){if(_0x21f7dd){return _0x46accd[_0x413b('0x1a')](_0xaa818d);}return _0x46accd[_0x413b('0x1b')](_0xaa818d)['end']();};}function respondWithResult(_0x48e173,_0x44595f){_0x44595f=_0x44595f||0xc8;return function(_0x3c956f){if(_0x3c956f){return _0x48e173[_0x413b('0x1b')](_0x44595f)['json'](_0x3c956f);}};}function respondWithFilteredResult(_0x4ec6c9,_0x495833){return function(_0x5531f3){if(_0x5531f3){var _0x18ab62=typeof _0x495833[_0x413b('0x1c')]===_0x413b('0x1d')&&typeof _0x495833[_0x413b('0x1e')]===_0x413b('0x1d');var _0x1b6251=_0x5531f3['count'];var _0x3fee27=_0x18ab62?0x0:_0x495833[_0x413b('0x1c')];var _0x1302a5=_0x18ab62?_0x5531f3[_0x413b('0x1f')]:_0x495833[_0x413b('0x1c')]+_0x495833[_0x413b('0x1e')];var _0x13ccc1;if(_0x1302a5>=_0x1b6251){_0x1302a5=_0x1b6251;_0x13ccc1=0xc8;}else{_0x13ccc1=0xce;}_0x4ec6c9[_0x413b('0x1b')](_0x13ccc1);return _0x4ec6c9['set'](_0x413b('0x20'),_0x3fee27+'-'+_0x1302a5+'/'+_0x1b6251)['json'](_0x5531f3);}return null;};}function patchUpdates(_0x49a104){return function(_0xfca32f){try{jsonpatch[_0x413b('0x21')](_0xfca32f,_0x49a104,!![]);}catch(_0x48f9a8){return BPromise[_0x413b('0x22')](_0x48f9a8);}return _0xfca32f[_0x413b('0x23')]();};}function saveUpdates(_0x1afcb1,_0x3a09a1){return function(_0x509bc1){if(_0x509bc1){return _0x509bc1['update'](_0x1afcb1)[_0x413b('0x24')](function(_0x3022ef){return _0x3022ef;});}return null;};}function removeEntity(_0x2b5568,_0x430252){return function(_0x24d59c){if(_0x24d59c){return _0x24d59c[_0x413b('0x25')]()['then'](function(){_0x2b5568['status'](0xcc)[_0x413b('0x26')]();});}};}function handleEntityNotFound(_0x5da450,_0x468cfd){return function(_0x2e6d5e){if(!_0x2e6d5e){_0x5da450[_0x413b('0x1a')](0x194);}return _0x2e6d5e;};}function handleError(_0x427f8b,_0x2f4340){_0x2f4340=_0x2f4340||0x1f4;return function(_0x40ca8f){logger['error'](_0x40ca8f[_0x413b('0x27')]);if(_0x40ca8f[_0x413b('0x28')]){delete _0x40ca8f[_0x413b('0x28')];}_0x427f8b[_0x413b('0x1b')](_0x2f4340)[_0x413b('0x29')](_0x40ca8f);};}exports[_0x413b('0x2a')]=function(_0x2ccb9d,_0x1761d1){var _0x509fe2={},_0x1db766={},_0x4f4332={'count':0x0,'rows':[]};var _0x1f9def=_[_0x413b('0x2b')](db[_0x413b('0x2c')]['rawAttributes'],function(_0x1d376b){return{'name':_0x1d376b[_0x413b('0x2d')],'type':_0x1d376b[_0x413b('0x2e')][_0x413b('0x2f')]};});_0x1db766['model']=_[_0x413b('0x2b')](_0x1f9def,_0x413b('0x28'));_0x1db766[_0x413b('0x30')]=_[_0x413b('0x31')](_0x2ccb9d[_0x413b('0x30')]);_0x1db766['filters']=_[_0x413b('0x32')](_0x1db766[_0x413b('0x33')],_0x1db766['query']);_0x509fe2['attributes']=_[_0x413b('0x32')](_0x1db766[_0x413b('0x33')],qs[_0x413b('0x34')](_0x2ccb9d[_0x413b('0x30')][_0x413b('0x34')]));_0x509fe2[_0x413b('0x35')]=_0x509fe2['attributes'][_0x413b('0x36')]?_0x509fe2[_0x413b('0x35')]:_0x1db766['model'];if(!_0x2ccb9d[_0x413b('0x30')]['hasOwnProperty'](_0x413b('0x37'))){_0x509fe2[_0x413b('0x1e')]=qs[_0x413b('0x1e')](_0x2ccb9d[_0x413b('0x30')][_0x413b('0x1e')]);_0x509fe2[_0x413b('0x1c')]=qs[_0x413b('0x1c')](_0x2ccb9d[_0x413b('0x30')]['offset']);}_0x509fe2[_0x413b('0x38')]=qs[_0x413b('0x39')](_0x2ccb9d[_0x413b('0x30')][_0x413b('0x39')]);_0x509fe2[_0x413b('0x3a')]=qs[_0x413b('0x3b')](_[_0x413b('0x3c')](_0x2ccb9d[_0x413b('0x30')],_0x1db766[_0x413b('0x3b')]),_0x1f9def);if(_0x2ccb9d[_0x413b('0x30')][_0x413b('0x3d')]){_0x509fe2[_0x413b('0x3a')]=_[_0x413b('0x3e')](_0x509fe2[_0x413b('0x3a')],{'$or':_['map'](_0x1f9def,function(_0xb676c3){if(_0xb676c3[_0x413b('0x2e')]!==_0x413b('0x3f')){var _0x278f03={};_0x278f03[_0xb676c3[_0x413b('0x28')]]={'$like':'%'+_0x2ccb9d['query'][_0x413b('0x3d')]+'%'};return _0x278f03;}})});}_0x509fe2=_[_0x413b('0x3e')]({},_0x509fe2,_0x2ccb9d[_0x413b('0x40')]);var _0x2ccade={'where':_0x509fe2[_0x413b('0x3a')]};return db['VtigerConfiguration']['count'](_0x2ccade)[_0x413b('0x24')](function(_0xc53186){_0x4f4332[_0x413b('0x1f')]=_0xc53186;if(_0x2ccb9d['query'][_0x413b('0x41')]){_0x509fe2[_0x413b('0x42')]=[{'all':!![]}];}return db[_0x413b('0x2c')]['findAll'](_0x509fe2);})['then'](function(_0x17e577){_0x4f4332[_0x413b('0x43')]=_0x17e577;return _0x4f4332;})['then'](respondWithFilteredResult(_0x1761d1,_0x509fe2))['catch'](handleError(_0x1761d1,null));};exports[_0x413b('0x44')]=function(_0x2c1cc8,_0x3f0ed9){var _0x4586d1={'raw':![],'where':{'id':_0x2c1cc8['params']['id']}},_0x33b37c={};_0x33b37c['model']=_[_0x413b('0x31')](db[_0x413b('0x2c')][_0x413b('0x45')]);_0x33b37c[_0x413b('0x30')]=_['keys'](_0x2c1cc8['query']);_0x33b37c[_0x413b('0x3b')]=_[_0x413b('0x32')](_0x33b37c[_0x413b('0x33')],_0x33b37c[_0x413b('0x30')]);_0x4586d1[_0x413b('0x35')]=_[_0x413b('0x32')](_0x33b37c[_0x413b('0x33')],qs[_0x413b('0x34')](_0x2c1cc8[_0x413b('0x30')][_0x413b('0x34')]));_0x4586d1[_0x413b('0x35')]=_0x4586d1[_0x413b('0x35')][_0x413b('0x36')]?_0x4586d1[_0x413b('0x35')]:_0x33b37c[_0x413b('0x33')];if(_0x2c1cc8[_0x413b('0x30')][_0x413b('0x41')]){_0x4586d1[_0x413b('0x42')]=[{'all':!![]}];}_0x4586d1=_['merge']({},_0x4586d1,_0x2c1cc8['options']);return db[_0x413b('0x2c')][_0x413b('0x46')](_0x4586d1)[_0x413b('0x24')](handleEntityNotFound(_0x3f0ed9,null))['then'](respondWithResult(_0x3f0ed9,null))[_0x413b('0x47')](handleError(_0x3f0ed9,null));};exports[_0x413b('0x48')]=function(_0x1da775,_0x344fce){return db[_0x413b('0x2c')][_0x413b('0x48')](_0x1da775['body'],{})['then'](respondWithResult(_0x344fce,0xc9))[_0x413b('0x47')](handleError(_0x344fce,null));};exports[_0x413b('0x49')]=function(_0x47d8c5,_0x5965fc){if(_0x47d8c5[_0x413b('0x4a')]['id']){delete _0x47d8c5[_0x413b('0x4a')]['id'];}return db[_0x413b('0x2c')][_0x413b('0x46')]({'where':{'id':_0x47d8c5['params']['id']}})[_0x413b('0x24')](handleEntityNotFound(_0x5965fc,null))[_0x413b('0x24')](saveUpdates(_0x47d8c5[_0x413b('0x4a')],null))[_0x413b('0x24')](respondWithResult(_0x5965fc,null))[_0x413b('0x47')](handleError(_0x5965fc,null));};exports[_0x413b('0x25')]=function(_0x2fd790,_0x169be3){return db['VtigerConfiguration'][_0x413b('0x46')]({'where':{'id':_0x2fd790[_0x413b('0x4b')]['id']}})[_0x413b('0x24')](handleEntityNotFound(_0x169be3,null))[_0x413b('0x24')](removeEntity(_0x169be3,null))[_0x413b('0x47')](handleError(_0x169be3,null));};exports[_0x413b('0x4c')]=function(_0x1783f1,_0x110182,_0x3b404f){var _0x548995={};var _0x584c4a={};var _0x1b2295;var _0x65d76e;return db['VtigerConfiguration'][_0x413b('0x4d')]({'where':{'id':_0x1783f1['params']['id']}})['then'](handleEntityNotFound(_0x110182,null))[_0x413b('0x24')](function(_0x1175bd){if(_0x1175bd){_0x1b2295=_0x1175bd;_0x584c4a['model']=_[_0x413b('0x31')](db[_0x413b('0x4e')][_0x413b('0x45')]);_0x584c4a[_0x413b('0x30')]=_['keys'](_0x1783f1[_0x413b('0x30')]);_0x584c4a['filters']=_['intersection'](_0x584c4a[_0x413b('0x33')],_0x584c4a[_0x413b('0x30')]);_0x548995[_0x413b('0x35')]=_[_0x413b('0x32')](_0x584c4a[_0x413b('0x33')],qs['fields'](_0x1783f1[_0x413b('0x30')][_0x413b('0x34')]));_0x548995[_0x413b('0x35')]=_0x548995[_0x413b('0x35')][_0x413b('0x36')]?_0x548995[_0x413b('0x35')]:_0x584c4a[_0x413b('0x33')];_0x548995[_0x413b('0x38')]=qs[_0x413b('0x39')](_0x1783f1[_0x413b('0x30')][_0x413b('0x39')]);_0x548995[_0x413b('0x3a')]=qs[_0x413b('0x3b')](_[_0x413b('0x3c')](_0x1783f1[_0x413b('0x30')],_0x584c4a['filters']));if(_0x1783f1[_0x413b('0x30')]['filter']){_0x548995['where']=_[_0x413b('0x3e')](_0x548995[_0x413b('0x3a')],{'$or':_[_0x413b('0x2b')](_0x548995['attributes'],function(_0x16b77b){var _0x116bdc={};_0x116bdc[_0x16b77b]={'$like':'%'+_0x1783f1[_0x413b('0x30')]['filter']+'%'};return _0x116bdc;})});}_0x548995=_[_0x413b('0x3e')]({},_0x548995,_0x1783f1[_0x413b('0x40')]);return _0x1b2295[_0x413b('0x4c')](_0x548995);}})[_0x413b('0x24')](function(_0x4d523c){if(_0x4d523c){_0x65d76e=_0x4d523c[_0x413b('0x36')];if(!_0x1783f1['query']['hasOwnProperty']('nolimit')){_0x548995[_0x413b('0x1e')]=qs[_0x413b('0x1e')](_0x1783f1[_0x413b('0x30')][_0x413b('0x1e')]);_0x548995[_0x413b('0x1c')]=qs[_0x413b('0x1c')](_0x1783f1[_0x413b('0x30')][_0x413b('0x1c')]);}return _0x1b2295[_0x413b('0x4c')](_0x548995);}})[_0x413b('0x24')](function(_0x4a770b){if(_0x4a770b){return _0x4a770b?{'count':_0x65d76e,'rows':_0x4a770b}:null;}})[_0x413b('0x24')](respondWithResult(_0x110182,null))[_0x413b('0x47')](handleError(_0x110182,null));};exports[_0x413b('0x4f')]=function(_0x21abcb,_0x249ab3,_0xc3e3c3){var _0x19b6e6={};var _0xc0f4e1={};var _0x2f6bdf;var _0x2c3b46;return db[_0x413b('0x2c')]['findOne']({'where':{'id':_0x21abcb[_0x413b('0x4b')]['id']}})[_0x413b('0x24')](handleEntityNotFound(_0x249ab3,null))[_0x413b('0x24')](function(_0x1dabc1){if(_0x1dabc1){_0x2f6bdf=_0x1dabc1;_0xc0f4e1[_0x413b('0x33')]=_['keys'](db[_0x413b('0x4e')]['rawAttributes']);_0xc0f4e1['query']=_[_0x413b('0x31')](_0x21abcb[_0x413b('0x30')]);_0xc0f4e1[_0x413b('0x3b')]=_['intersection'](_0xc0f4e1[_0x413b('0x33')],_0xc0f4e1[_0x413b('0x30')]);_0x19b6e6[_0x413b('0x35')]=_[_0x413b('0x32')](_0xc0f4e1['model'],qs[_0x413b('0x34')](_0x21abcb[_0x413b('0x30')][_0x413b('0x34')]));_0x19b6e6[_0x413b('0x35')]=_0x19b6e6[_0x413b('0x35')][_0x413b('0x36')]?_0x19b6e6[_0x413b('0x35')]:_0xc0f4e1[_0x413b('0x33')];_0x19b6e6['order']=qs[_0x413b('0x39')](_0x21abcb['query']['sort']);_0x19b6e6[_0x413b('0x3a')]=qs['filters'](_[_0x413b('0x3c')](_0x21abcb[_0x413b('0x30')],_0xc0f4e1[_0x413b('0x3b')]));if(_0x21abcb[_0x413b('0x30')][_0x413b('0x3d')]){_0x19b6e6[_0x413b('0x3a')]=_[_0x413b('0x3e')](_0x19b6e6['where'],{'$or':_['map'](_0x19b6e6['attributes'],function(_0x5582ed){var _0x4412b9={};_0x4412b9[_0x5582ed]={'$like':'%'+_0x21abcb[_0x413b('0x30')][_0x413b('0x3d')]+'%'};return _0x4412b9;})});}_0x19b6e6=_[_0x413b('0x3e')]({},_0x19b6e6,_0x21abcb[_0x413b('0x40')]);return _0x2f6bdf['getSubjects'](_0x19b6e6);}})[_0x413b('0x24')](function(_0x47b2b2){if(_0x47b2b2){_0x2c3b46=_0x47b2b2['length'];if(!_0x21abcb[_0x413b('0x30')][_0x413b('0x50')](_0x413b('0x37'))){_0x19b6e6['limit']=qs[_0x413b('0x1e')](_0x21abcb[_0x413b('0x30')]['limit']);_0x19b6e6[_0x413b('0x1c')]=qs[_0x413b('0x1c')](_0x21abcb[_0x413b('0x30')][_0x413b('0x1c')]);}return _0x2f6bdf['getSubjects'](_0x19b6e6);}})[_0x413b('0x24')](function(_0x1e5c61){if(_0x1e5c61){return _0x1e5c61?{'count':_0x2c3b46,'rows':_0x1e5c61}:null;}})[_0x413b('0x24')](respondWithResult(_0x249ab3,null))[_0x413b('0x47')](handleError(_0x249ab3,null));};exports['getDescriptions']=function(_0x5ada76,_0x494ddc,_0x383197){var _0x426139={};var _0x590eff={};var _0x2cd61a;var _0x30db37;return db['VtigerConfiguration'][_0x413b('0x4d')]({'where':{'id':_0x5ada76['params']['id']}})['then'](handleEntityNotFound(_0x494ddc,null))[_0x413b('0x24')](function(_0x5f335f){if(_0x5f335f){_0x2cd61a=_0x5f335f;_0x590eff[_0x413b('0x33')]=_['keys'](db[_0x413b('0x4e')][_0x413b('0x45')]);_0x590eff[_0x413b('0x30')]=_['keys'](_0x5ada76['query']);_0x590eff[_0x413b('0x3b')]=_[_0x413b('0x32')](_0x590eff[_0x413b('0x33')],_0x590eff[_0x413b('0x30')]);_0x426139[_0x413b('0x35')]=_['intersection'](_0x590eff[_0x413b('0x33')],qs[_0x413b('0x34')](_0x5ada76[_0x413b('0x30')][_0x413b('0x34')]));_0x426139[_0x413b('0x35')]=_0x426139[_0x413b('0x35')]['length']?_0x426139[_0x413b('0x35')]:_0x590eff[_0x413b('0x33')];_0x426139['order']=qs[_0x413b('0x39')](_0x5ada76[_0x413b('0x30')][_0x413b('0x39')]);_0x426139['where']=qs[_0x413b('0x3b')](_[_0x413b('0x3c')](_0x5ada76[_0x413b('0x30')],_0x590eff[_0x413b('0x3b')]));if(_0x5ada76[_0x413b('0x30')][_0x413b('0x3d')]){_0x426139[_0x413b('0x3a')]=_['merge'](_0x426139[_0x413b('0x3a')],{'$or':_[_0x413b('0x2b')](_0x426139['attributes'],function(_0x625368){var _0x529187={};_0x529187[_0x625368]={'$like':'%'+_0x5ada76['query'][_0x413b('0x3d')]+'%'};return _0x529187;})});}_0x426139=_[_0x413b('0x3e')]({},_0x426139,_0x5ada76[_0x413b('0x40')]);return _0x2cd61a[_0x413b('0x51')](_0x426139);}})[_0x413b('0x24')](function(_0x33d166){if(_0x33d166){_0x30db37=_0x33d166[_0x413b('0x36')];if(!_0x5ada76[_0x413b('0x30')][_0x413b('0x50')](_0x413b('0x37'))){_0x426139[_0x413b('0x1e')]=qs['limit'](_0x5ada76[_0x413b('0x30')][_0x413b('0x1e')]);_0x426139[_0x413b('0x1c')]=qs[_0x413b('0x1c')](_0x5ada76['query'][_0x413b('0x1c')]);}return _0x2cd61a[_0x413b('0x51')](_0x426139);}})[_0x413b('0x24')](function(_0x52dbcb){if(_0x52dbcb){return _0x52dbcb?{'count':_0x30db37,'rows':_0x52dbcb}:null;}})[_0x413b('0x24')](respondWithResult(_0x494ddc,null))[_0x413b('0x47')](handleError(_0x494ddc,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 1ad9d89..55a0640 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 _0xc8b8=['rimraf','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5b2b1d,_0x48ccb9){var _0xfe09ec=function(_0x19b296){while(--_0x19b296){_0x5b2b1d['push'](_0x5b2b1d['shift']());}};_0xfe09ec(++_0x48ccb9);}(_0xc8b8,0x1e5));var _0x8c8b=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0xc8b8[_0x685346];return _0x52e15b;};'use strict';var _=require(_0x8c8b('0x0'));var util=require(_0x8c8b('0x1'));var logger=require(_0x8c8b('0x2'))(_0x8c8b('0x3'));var moment=require(_0x8c8b('0x4'));var BPromise=require(_0x8c8b('0x5'));var rp=require(_0x8c8b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c8b('0x7'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x8c8b('0x8')]=function(_0x53cbda,_0x57b2d5){return _0x53cbda[_0x8c8b('0x9')](_0x8c8b('0xa'),attributes,{'tableName':_0x8c8b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5c6=['path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','api','bluebird','request-promise'];(function(_0x549028,_0x555d55){var _0x27c544=function(_0x12f0aa){while(--_0x12f0aa){_0x549028['push'](_0x549028['shift']());}};_0x27c544(++_0x555d55);}(_0xa5c6,0x8a));var _0x6a5c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa5c6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6a5c('0x0'));var util=require(_0x6a5c('0x1'));var logger=require('../../config/logger')(_0x6a5c('0x2'));var moment=require('moment');var BPromise=require(_0x6a5c('0x3'));var rp=require(_0x6a5c('0x4'));var fs=require('fs');var path=require(_0x6a5c('0x5'));var rimraf=require(_0x6a5c('0x6'));var config=require(_0x6a5c('0x7'));var attributes=require(_0x6a5c('0x8'));module[_0x6a5c('0x9')]=function(_0x364e15,_0x8aac8e){return _0x364e15[_0x6a5c('0xa')](_0x6a5c('0xb'),attributes,{'tableName':_0x6a5c('0xc'),'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 5e824ea..97592a8 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 _0xaaa2=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x57831d,_0x39d417){var _0x588a3f=function(_0x27fd9c){while(--_0x27fd9c){_0x57831d['push'](_0x57831d['shift']());}};_0x588a3f(++_0x39d417);}(_0xaaa2,0x191));var _0x2aaa=function(_0x38fbc2,_0x2ebb94){_0x38fbc2=_0x38fbc2-0x0;var _0x40dd51=_0xaaa2[_0x38fbc2];return _0x40dd51;};'use strict';var _=require(_0x2aaa('0x0'));var util=require('util');var moment=require(_0x2aaa('0x1'));var BPromise=require(_0x2aaa('0x2'));var rs=require(_0x2aaa('0x3'));var fs=require('fs');var Redis=require(_0x2aaa('0x4'));var db=require(_0x2aaa('0x5'))['db'];var utils=require(_0x2aaa('0x6'));var logger=require(_0x2aaa('0x7'))('rpc');var config=require(_0x2aaa('0x8'));var jayson=require(_0x2aaa('0x9'));var client=jayson['client'][_0x2aaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b5306,_0x8b63d3,_0x23ff33){return new BPromise(function(_0x42e81a,_0x36ae69){return client[_0x2aaa('0xb')](_0x3b5306,_0x23ff33)[_0x2aaa('0xc')](function(_0x4de927){logger[_0x2aaa('0xd')](_0x2aaa('0xe'),_0x8b63d3,_0x2aaa('0xf'));logger[_0x2aaa('0x10')](_0x2aaa('0x11'),_0x8b63d3,_0x2aaa('0xf'),JSON[_0x2aaa('0x12')](_0x4de927));if(_0x4de927[_0x2aaa('0x13')]){if(_0x4de927[_0x2aaa('0x13')]['code']===0x1f4){logger[_0x2aaa('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x8b63d3,_0x4de927[_0x2aaa('0x13')]['message']);return _0x36ae69(_0x4de927['error'][_0x2aaa('0x14')]);}logger[_0x2aaa('0x13')](_0x2aaa('0xe'),_0x8b63d3,_0x4de927[_0x2aaa('0x13')][_0x2aaa('0x14')]);return _0x42e81a(_0x4de927[_0x2aaa('0x13')]['message']);}else{logger[_0x2aaa('0xd')](_0x2aaa('0xe'),_0x8b63d3,_0x2aaa('0xf'));_0x42e81a(_0x4de927[_0x2aaa('0x15')]['message']);}})['catch'](function(_0x2312b3){logger[_0x2aaa('0x13')](_0x2aaa('0xe'),_0x8b63d3,_0x2312b3);_0x36ae69(_0x2312b3);});});} \ No newline at end of file +var _0x58a0=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x35119e,_0x155757){var _0x439a6c=function(_0x23220d){while(--_0x23220d){_0x35119e['push'](_0x35119e['shift']());}};_0x439a6c(++_0x155757);}(_0x58a0,0x12a));var _0x058a=function(_0x16b994,_0x22872a){_0x16b994=_0x16b994-0x0;var _0xfc3e0f=_0x58a0[_0x16b994];return _0xfc3e0f;};'use strict';var _=require(_0x058a('0x0'));var util=require(_0x058a('0x1'));var moment=require(_0x058a('0x2'));var BPromise=require('bluebird');var rs=require(_0x058a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x058a('0x4'))['db'];var utils=require(_0x058a('0x5'));var logger=require(_0x058a('0x6'))(_0x058a('0x7'));var config=require(_0x058a('0x8'));var jayson=require(_0x058a('0x9'));var client=jayson[_0x058a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2da6b3,_0x25e60b,_0x27f61d){return new BPromise(function(_0xcf4301,_0x1b1371){return client[_0x058a('0xb')](_0x2da6b3,_0x27f61d)[_0x058a('0xc')](function(_0x341f6d){logger['info'](_0x058a('0xd'),_0x25e60b,'request\x20sent');logger[_0x058a('0xe')](_0x058a('0xf'),_0x25e60b,_0x058a('0x10'),JSON[_0x058a('0x11')](_0x341f6d));if(_0x341f6d[_0x058a('0x12')]){if(_0x341f6d['error'][_0x058a('0x13')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x25e60b,_0x341f6d[_0x058a('0x12')][_0x058a('0x14')]);return _0x1b1371(_0x341f6d['error'][_0x058a('0x14')]);}logger[_0x058a('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x25e60b,_0x341f6d['error'][_0x058a('0x14')]);return _0xcf4301(_0x341f6d['error']['message']);}else{logger[_0x058a('0x15')](_0x058a('0xd'),_0x25e60b,'request\x20sent');_0xcf4301(_0x341f6d[_0x058a('0x16')][_0x058a('0x14')]);}})[_0x058a('0x17')](function(_0x4f30c2){logger[_0x058a('0x12')](_0x058a('0xd'),_0x25e60b,_0x4f30c2);_0x1b1371(_0x4f30c2);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index d8f84d3..3f9ec9d 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 _0x6ac0=['exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0xf4944e,_0xad0121){var _0x5da886=function(_0x2c9752){while(--_0x2c9752){_0xf4944e['push'](_0xf4944e['shift']());}};_0x5da886(++_0xad0121);}(_0x6ac0,0x144));var _0x06ac=function(_0x4a9587,_0x4bc116){_0x4a9587=_0x4a9587-0x0;var _0x587ca4=_0x6ac0[_0x4a9587];return _0x587ca4;};'use strict';var multer=require('multer');var util=require(_0x06ac('0x0'));var path=require(_0x06ac('0x1'));var timeout=require('connect-timeout');var express=require(_0x06ac('0x2'));var router=express[_0x06ac('0x3')]();var fs_extra=require(_0x06ac('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x06ac('0x5'));var config=require(_0x06ac('0x6'));var controller=require(_0x06ac('0x7'));router[_0x06ac('0x8')]('/',auth[_0x06ac('0x9')](),controller[_0x06ac('0xa')]);router[_0x06ac('0x8')](_0x06ac('0xb'),auth[_0x06ac('0x9')](),controller[_0x06ac('0xc')]);router['post']('/',auth[_0x06ac('0x9')](),controller[_0x06ac('0xd')]);router[_0x06ac('0xe')]('/:id',auth[_0x06ac('0x9')](),controller[_0x06ac('0xf')]);router[_0x06ac('0x10')](_0x06ac('0xb'),auth[_0x06ac('0x9')](),controller[_0x06ac('0x11')]);module[_0x06ac('0x12')]=router; \ No newline at end of file +var _0x6492=['destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','post','create','put','/:id','update'];(function(_0x284028,_0x4d6510){var _0x296370=function(_0x4c3892){while(--_0x4c3892){_0x284028['push'](_0x284028['shift']());}};_0x296370(++_0x4d6510);}(_0x6492,0xdf));var _0x2649=function(_0x556346,_0xc56cc4){_0x556346=_0x556346-0x0;var _0x3ab62c=_0x6492[_0x556346];return _0x3ab62c;};'use strict';var multer=require('multer');var util=require(_0x2649('0x0'));var path=require(_0x2649('0x1'));var timeout=require('connect-timeout');var express=require(_0x2649('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2649('0x3'));var interaction=require(_0x2649('0x4'));var config=require(_0x2649('0x5'));var controller=require(_0x2649('0x6'));router[_0x2649('0x7')]('/',auth[_0x2649('0x8')](),controller[_0x2649('0x9')]);router[_0x2649('0x7')]('/:id',auth[_0x2649('0x8')](),controller['show']);router[_0x2649('0xa')]('/',auth['isAuthenticated'](),controller[_0x2649('0xb')]);router[_0x2649('0xc')](_0x2649('0xd'),auth[_0x2649('0x8')](),controller[_0x2649('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2649('0xf')]);module[_0x2649('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 99e12c5..c6d8dab 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 _0x4b6a=['ENUM','variable','picklist','string','STRING','customVariable','BOOLEAN','sequelize'];(function(_0x53b346,_0x556641){var _0x4aec77=function(_0x3be24e){while(--_0x3be24e){_0x53b346['push'](_0x53b346['shift']());}};_0x4aec77(++_0x556641);}(_0x4b6a,0xff));var _0xa4b6=function(_0x33a968,_0xcc43d4){_0x33a968=_0x33a968-0x0;var _0x5e2105=_0x4b6a[_0x33a968];return _0x5e2105;};'use strict';var Sequelize=require(_0xa4b6('0x0'));module['exports']={'type':{'type':Sequelize[_0xa4b6('0x1')]('string',_0xa4b6('0x2'),'customVariable','keyValue',_0xa4b6('0x3')),'defaultValue':_0xa4b6('0x4')},'content':{'type':Sequelize[_0xa4b6('0x5')]},'key':{'type':Sequelize[_0xa4b6('0x5')]},'keyType':{'type':Sequelize[_0xa4b6('0x1')](_0xa4b6('0x4'),'variable',_0xa4b6('0x6'))},'keyContent':{'type':Sequelize[_0xa4b6('0x5')]},'idField':{'type':Sequelize[_0xa4b6('0x5')]},'nameField':{'type':Sequelize[_0xa4b6('0x5')]},'customField':{'type':Sequelize[_0xa4b6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa4b6('0x5')]}}; \ No newline at end of file +var _0x1a2b=['keyValue','picklist','STRING','ENUM','sequelize','string','variable','customVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a2b,0x194));var _0xb1a2=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0x1a2b[_0x2181b1];return _0x530548;};'use strict';var Sequelize=require(_0xb1a2('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xb1a2('0x1'),_0xb1a2('0x2'),_0xb1a2('0x3'),_0xb1a2('0x4'),_0xb1a2('0x5')),'defaultValue':_0xb1a2('0x1')},'content':{'type':Sequelize[_0xb1a2('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb1a2('0x7')]('string',_0xb1a2('0x2'),_0xb1a2('0x3'))},'keyContent':{'type':Sequelize[_0xb1a2('0x6')]},'idField':{'type':Sequelize[_0xb1a2('0x6')]},'nameField':{'type':Sequelize[_0xb1a2('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb1a2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 6dfc8f8..2dc52e5 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 _0xd948=['include','then','rows','show','params','merge','options','find','create','body','catch','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','VIRTUAL','count','includeAll'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xd948,0xa4));var _0x8d94=function(_0x35e055,_0x3fad70){_0x35e055=_0x35e055-0x0;var _0x442743=_0xd948[_0x35e055];return _0x442743;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d94('0x0'));var zipdir=require(_0x8d94('0x1'));var jsonpatch=require(_0x8d94('0x2'));var rp=require(_0x8d94('0x3'));var moment=require(_0x8d94('0x4'));var BPromise=require(_0x8d94('0x5'));var Mustache=require(_0x8d94('0x6'));var util=require('util');var path=require(_0x8d94('0x7'));var sox=require(_0x8d94('0x8'));var csv=require(_0x8d94('0x9'));var ejs=require(_0x8d94('0xa'));var fs=require('fs');var fs_extra=require(_0x8d94('0xb'));var _=require(_0x8d94('0xc'));var squel=require(_0x8d94('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8d94('0xe'));var toCsv=require(_0x8d94('0x9'));var querystring=require('querystring');var Papa=require(_0x8d94('0xf'));var Redis=require(_0x8d94('0x10'));var authService=require(_0x8d94('0x11'));var qs=require(_0x8d94('0x12'));var as=require(_0x8d94('0x13'));var hardwareService=require(_0x8d94('0x14'));var logger=require(_0x8d94('0x15'))(_0x8d94('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8d94('0x17'));var db=require(_0x8d94('0x18'))['db'];function respondWithStatusCode(_0x58e5e8,_0x3e7f8b){_0x3e7f8b=_0x3e7f8b||0xcc;return function(_0x5e7623){if(_0x5e7623){return _0x58e5e8[_0x8d94('0x19')](_0x3e7f8b);}return _0x58e5e8[_0x8d94('0x1a')](_0x3e7f8b)[_0x8d94('0x1b')]();};}function respondWithResult(_0x3599db,_0x1e36db){_0x1e36db=_0x1e36db||0xc8;return function(_0x2e9d40){if(_0x2e9d40){return _0x3599db[_0x8d94('0x1a')](_0x1e36db)['json'](_0x2e9d40);}};}function respondWithFilteredResult(_0x788340,_0x3933d8){return function(_0x4d2d25){if(_0x4d2d25){var _0x56bc60=typeof _0x3933d8[_0x8d94('0x1c')]==='undefined'&&typeof _0x3933d8['limit']===_0x8d94('0x1d');var _0xc89521=_0x4d2d25['count'];var _0x2948d5=_0x56bc60?0x0:_0x3933d8[_0x8d94('0x1c')];var _0x448264=_0x56bc60?_0x4d2d25['count']:_0x3933d8['offset']+_0x3933d8[_0x8d94('0x1e')];var _0x495e82;if(_0x448264>=_0xc89521){_0x448264=_0xc89521;_0x495e82=0xc8;}else{_0x495e82=0xce;}_0x788340['status'](_0x495e82);return _0x788340[_0x8d94('0x1f')]('Content-Range',_0x2948d5+'-'+_0x448264+'/'+_0xc89521)[_0x8d94('0x20')](_0x4d2d25);}return null;};}function patchUpdates(_0x5e83a6){return function(_0x50456b){try{jsonpatch[_0x8d94('0x21')](_0x50456b,_0x5e83a6,!![]);}catch(_0x30f81b){return BPromise[_0x8d94('0x22')](_0x30f81b);}return _0x50456b[_0x8d94('0x23')]();};}function saveUpdates(_0x2375f4,_0x4d8c81){return function(_0x3b6a94){if(_0x3b6a94){return _0x3b6a94['update'](_0x2375f4)['then'](function(_0xfc7923){return _0xfc7923;});}return null;};}function removeEntity(_0x38f2f1,_0x186b39){return function(_0x2ab856){if(_0x2ab856){return _0x2ab856[_0x8d94('0x24')]()['then'](function(){_0x38f2f1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57b096,_0x3d8a0c){return function(_0x183407){if(!_0x183407){_0x57b096[_0x8d94('0x19')](0x194);}return _0x183407;};}function handleError(_0x40a613,_0x257b81){_0x257b81=_0x257b81||0x1f4;return function(_0x5a6240){logger[_0x8d94('0x25')](_0x5a6240[_0x8d94('0x26')]);if(_0x5a6240[_0x8d94('0x27')]){delete _0x5a6240['name'];}_0x40a613[_0x8d94('0x1a')](_0x257b81)[_0x8d94('0x28')](_0x5a6240);};}exports[_0x8d94('0x29')]=function(_0x2abc24,_0x1acdaa){var _0x5ae159={},_0x4f4985={},_0x390557={'count':0x0,'rows':[]};var _0x3c2778=_[_0x8d94('0x2a')](db[_0x8d94('0x2b')][_0x8d94('0x2c')],function(_0x401407){return{'name':_0x401407[_0x8d94('0x2d')],'type':_0x401407[_0x8d94('0x2e')][_0x8d94('0x2f')]};});_0x4f4985[_0x8d94('0x30')]=_['map'](_0x3c2778,_0x8d94('0x27'));_0x4f4985[_0x8d94('0x31')]=_[_0x8d94('0x32')](_0x2abc24['query']);_0x4f4985['filters']=_['intersection'](_0x4f4985[_0x8d94('0x30')],_0x4f4985[_0x8d94('0x31')]);_0x5ae159[_0x8d94('0x33')]=_[_0x8d94('0x34')](_0x4f4985[_0x8d94('0x30')],qs[_0x8d94('0x35')](_0x2abc24[_0x8d94('0x31')][_0x8d94('0x35')]));_0x5ae159[_0x8d94('0x33')]=_0x5ae159['attributes'][_0x8d94('0x36')]?_0x5ae159['attributes']:_0x4f4985['model'];if(!_0x2abc24[_0x8d94('0x31')][_0x8d94('0x37')](_0x8d94('0x38'))){_0x5ae159['limit']=qs[_0x8d94('0x1e')](_0x2abc24['query'][_0x8d94('0x1e')]);_0x5ae159[_0x8d94('0x1c')]=qs['offset'](_0x2abc24[_0x8d94('0x31')][_0x8d94('0x1c')]);}_0x5ae159['order']=qs['sort'](_0x2abc24[_0x8d94('0x31')][_0x8d94('0x39')]);_0x5ae159['where']=qs[_0x8d94('0x3a')](_['pick'](_0x2abc24[_0x8d94('0x31')],_0x4f4985['filters']),_0x3c2778);if(_0x2abc24[_0x8d94('0x31')][_0x8d94('0x3b')]){_0x5ae159[_0x8d94('0x3c')]=_['merge'](_0x5ae159[_0x8d94('0x3c')],{'$or':_[_0x8d94('0x2a')](_0x3c2778,function(_0x48aee7){if(_0x48aee7[_0x8d94('0x2e')]!==_0x8d94('0x3d')){var _0x46581c={};_0x46581c[_0x48aee7[_0x8d94('0x27')]]={'$like':'%'+_0x2abc24['query']['filter']+'%'};return _0x46581c;}})});}_0x5ae159=_['merge']({},_0x5ae159,_0x2abc24['options']);var _0x432723={'where':_0x5ae159['where']};return db[_0x8d94('0x2b')][_0x8d94('0x3e')](_0x432723)['then'](function(_0x361b9b){_0x390557[_0x8d94('0x3e')]=_0x361b9b;if(_0x2abc24[_0x8d94('0x31')][_0x8d94('0x3f')]){_0x5ae159[_0x8d94('0x40')]=[{'all':!![]}];}return db[_0x8d94('0x2b')]['findAll'](_0x5ae159);})[_0x8d94('0x41')](function(_0x543fa1){_0x390557[_0x8d94('0x42')]=_0x543fa1;return _0x390557;})[_0x8d94('0x41')](respondWithFilteredResult(_0x1acdaa,_0x5ae159))['catch'](handleError(_0x1acdaa,null));};exports[_0x8d94('0x43')]=function(_0x425c67,_0x1b2338){var _0x3096b4={'raw':!![],'where':{'id':_0x425c67[_0x8d94('0x44')]['id']}},_0x117920={};_0x117920[_0x8d94('0x30')]=_[_0x8d94('0x32')](db[_0x8d94('0x2b')][_0x8d94('0x2c')]);_0x117920[_0x8d94('0x31')]=_[_0x8d94('0x32')](_0x425c67[_0x8d94('0x31')]);_0x117920[_0x8d94('0x3a')]=_[_0x8d94('0x34')](_0x117920[_0x8d94('0x30')],_0x117920[_0x8d94('0x31')]);_0x3096b4['attributes']=_[_0x8d94('0x34')](_0x117920[_0x8d94('0x30')],qs[_0x8d94('0x35')](_0x425c67[_0x8d94('0x31')][_0x8d94('0x35')]));_0x3096b4[_0x8d94('0x33')]=_0x3096b4[_0x8d94('0x33')][_0x8d94('0x36')]?_0x3096b4['attributes']:_0x117920['model'];if(_0x425c67[_0x8d94('0x31')]['includeAll']){_0x3096b4['include']=[{'all':!![]}];}_0x3096b4=_[_0x8d94('0x45')]({},_0x3096b4,_0x425c67[_0x8d94('0x46')]);return db[_0x8d94('0x2b')][_0x8d94('0x47')](_0x3096b4)[_0x8d94('0x41')](handleEntityNotFound(_0x1b2338,null))['then'](respondWithResult(_0x1b2338,null))['catch'](handleError(_0x1b2338,null));};exports[_0x8d94('0x48')]=function(_0x5878a1,_0x4f30e3){return db[_0x8d94('0x2b')]['create'](_0x5878a1[_0x8d94('0x49')],{})['then'](respondWithResult(_0x4f30e3,0xc9))[_0x8d94('0x4a')](handleError(_0x4f30e3,null));};exports[_0x8d94('0x4b')]=function(_0x54a103,_0x2fbd88){if(_0x54a103['body']['id']){delete _0x54a103[_0x8d94('0x49')]['id'];}return db['VtigerField'][_0x8d94('0x47')]({'where':{'id':_0x54a103[_0x8d94('0x44')]['id']}})[_0x8d94('0x41')](handleEntityNotFound(_0x2fbd88,null))[_0x8d94('0x41')](saveUpdates(_0x54a103[_0x8d94('0x49')],null))[_0x8d94('0x41')](respondWithResult(_0x2fbd88,null))[_0x8d94('0x4a')](handleError(_0x2fbd88,null));};exports[_0x8d94('0x24')]=function(_0x4d328c,_0x50e1cf){return db['VtigerField'][_0x8d94('0x47')]({'where':{'id':_0x4d328c[_0x8d94('0x44')]['id']}})['then'](handleEntityNotFound(_0x50e1cf,null))[_0x8d94('0x41')](removeEntity(_0x50e1cf,null))[_0x8d94('0x4a')](handleError(_0x50e1cf,null));}; \ No newline at end of file +var _0xf01d=['show','fields','length','find','create','params','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','then','includeAll','include','catch'];(function(_0x58c4a2,_0x585d96){var _0x1ac7bf=function(_0x1702e2){while(--_0x1702e2){_0x58c4a2['push'](_0x58c4a2['shift']());}};_0x1ac7bf(++_0x585d96);}(_0xf01d,0x133));var _0xdf01=function(_0x5f20e4,_0x4be47f){_0x5f20e4=_0x5f20e4-0x0;var _0x482c5a=_0xf01d[_0x5f20e4];return _0x482c5a;};'use strict';var emlformat=require(_0xdf01('0x0'));var rimraf=require(_0xdf01('0x1'));var zipdir=require(_0xdf01('0x2'));var jsonpatch=require(_0xdf01('0x3'));var rp=require(_0xdf01('0x4'));var moment=require('moment');var BPromise=require(_0xdf01('0x5'));var Mustache=require(_0xdf01('0x6'));var util=require(_0xdf01('0x7'));var path=require('path');var sox=require(_0xdf01('0x8'));var csv=require(_0xdf01('0x9'));var ejs=require(_0xdf01('0xa'));var fs=require('fs');var fs_extra=require(_0xdf01('0xb'));var _=require(_0xdf01('0xc'));var squel=require(_0xdf01('0xd'));var crypto=require(_0xdf01('0xe'));var jsforce=require(_0xdf01('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdf01('0x9'));var querystring=require(_0xdf01('0x10'));var Papa=require(_0xdf01('0x11'));var Redis=require(_0xdf01('0x12'));var authService=require(_0xdf01('0x13'));var qs=require(_0xdf01('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf01('0x15'));var logger=require(_0xdf01('0x16'))(_0xdf01('0x17'));var utils=require('../../config/utils');var config=require(_0xdf01('0x18'));var licenseUtil=require(_0xdf01('0x19'));var db=require(_0xdf01('0x1a'))['db'];function respondWithStatusCode(_0x4d3081,_0x14a96f){_0x14a96f=_0x14a96f||0xcc;return function(_0xb13472){if(_0xb13472){return _0x4d3081[_0xdf01('0x1b')](_0x14a96f);}return _0x4d3081[_0xdf01('0x1c')](_0x14a96f)['end']();};}function respondWithResult(_0x16bcf8,_0x3a0ba0){_0x3a0ba0=_0x3a0ba0||0xc8;return function(_0x7c422c){if(_0x7c422c){return _0x16bcf8[_0xdf01('0x1c')](_0x3a0ba0)[_0xdf01('0x1d')](_0x7c422c);}};}function respondWithFilteredResult(_0x160111,_0x5f23ec){return function(_0x30d1a2){if(_0x30d1a2){var _0x324cc6=typeof _0x5f23ec[_0xdf01('0x1e')]===_0xdf01('0x1f')&&typeof _0x5f23ec['limit']===_0xdf01('0x1f');var _0x198c36=_0x30d1a2[_0xdf01('0x20')];var _0x8c8b36=_0x324cc6?0x0:_0x5f23ec['offset'];var _0x22fc28=_0x324cc6?_0x30d1a2[_0xdf01('0x20')]:_0x5f23ec[_0xdf01('0x1e')]+_0x5f23ec['limit'];var _0x3c11c0;if(_0x22fc28>=_0x198c36){_0x22fc28=_0x198c36;_0x3c11c0=0xc8;}else{_0x3c11c0=0xce;}_0x160111[_0xdf01('0x1c')](_0x3c11c0);return _0x160111[_0xdf01('0x21')](_0xdf01('0x22'),_0x8c8b36+'-'+_0x22fc28+'/'+_0x198c36)[_0xdf01('0x1d')](_0x30d1a2);}return null;};}function patchUpdates(_0x513528){return function(_0x2cb76f){try{jsonpatch[_0xdf01('0x23')](_0x2cb76f,_0x513528,!![]);}catch(_0x4e5440){return BPromise[_0xdf01('0x24')](_0x4e5440);}return _0x2cb76f[_0xdf01('0x25')]();};}function saveUpdates(_0x19a659,_0x48ae14){return function(_0x53dd04){if(_0x53dd04){return _0x53dd04[_0xdf01('0x26')](_0x19a659)['then'](function(_0xccdfea){return _0xccdfea;});}return null;};}function removeEntity(_0x59db46,_0x5a56cd){return function(_0x44279b){if(_0x44279b){return _0x44279b[_0xdf01('0x27')]()['then'](function(){_0x59db46[_0xdf01('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30f254,_0x1e4767){return function(_0x151c04){if(!_0x151c04){_0x30f254[_0xdf01('0x1b')](0x194);}return _0x151c04;};}function handleError(_0x348c23,_0x4596a8){_0x4596a8=_0x4596a8||0x1f4;return function(_0x26f6b8){logger[_0xdf01('0x28')](_0x26f6b8[_0xdf01('0x29')]);if(_0x26f6b8[_0xdf01('0x2a')]){delete _0x26f6b8[_0xdf01('0x2a')];}_0x348c23['status'](_0x4596a8)['send'](_0x26f6b8);};}exports[_0xdf01('0x2b')]=function(_0x404a3f,_0x12d75c){var _0x1265fb={},_0x46f730={},_0x17d415={'count':0x0,'rows':[]};var _0x53206e=_[_0xdf01('0x2c')](db[_0xdf01('0x2d')][_0xdf01('0x2e')],function(_0x368964){return{'name':_0x368964[_0xdf01('0x2f')],'type':_0x368964[_0xdf01('0x30')]['key']};});_0x46f730[_0xdf01('0x31')]=_['map'](_0x53206e,_0xdf01('0x2a'));_0x46f730[_0xdf01('0x32')]=_[_0xdf01('0x33')](_0x404a3f[_0xdf01('0x32')]);_0x46f730[_0xdf01('0x34')]=_['intersection'](_0x46f730[_0xdf01('0x31')],_0x46f730['query']);_0x1265fb[_0xdf01('0x35')]=_[_0xdf01('0x36')](_0x46f730[_0xdf01('0x31')],qs['fields'](_0x404a3f[_0xdf01('0x32')]['fields']));_0x1265fb[_0xdf01('0x35')]=_0x1265fb[_0xdf01('0x35')]['length']?_0x1265fb['attributes']:_0x46f730['model'];if(!_0x404a3f[_0xdf01('0x32')][_0xdf01('0x37')](_0xdf01('0x38'))){_0x1265fb[_0xdf01('0x39')]=qs[_0xdf01('0x39')](_0x404a3f[_0xdf01('0x32')]['limit']);_0x1265fb[_0xdf01('0x1e')]=qs['offset'](_0x404a3f['query']['offset']);}_0x1265fb[_0xdf01('0x3a')]=qs[_0xdf01('0x3b')](_0x404a3f[_0xdf01('0x32')][_0xdf01('0x3b')]);_0x1265fb[_0xdf01('0x3c')]=qs[_0xdf01('0x34')](_['pick'](_0x404a3f['query'],_0x46f730['filters']),_0x53206e);if(_0x404a3f[_0xdf01('0x32')][_0xdf01('0x3d')]){_0x1265fb[_0xdf01('0x3c')]=_[_0xdf01('0x3e')](_0x1265fb[_0xdf01('0x3c')],{'$or':_[_0xdf01('0x2c')](_0x53206e,function(_0x3aadab){if(_0x3aadab[_0xdf01('0x30')]!=='VIRTUAL'){var _0x1bd9d3={};_0x1bd9d3[_0x3aadab[_0xdf01('0x2a')]]={'$like':'%'+_0x404a3f[_0xdf01('0x32')][_0xdf01('0x3d')]+'%'};return _0x1bd9d3;}})});}_0x1265fb=_[_0xdf01('0x3e')]({},_0x1265fb,_0x404a3f[_0xdf01('0x3f')]);var _0x5a4378={'where':_0x1265fb[_0xdf01('0x3c')]};return db['VtigerField'][_0xdf01('0x20')](_0x5a4378)[_0xdf01('0x40')](function(_0x1642a7){_0x17d415[_0xdf01('0x20')]=_0x1642a7;if(_0x404a3f['query'][_0xdf01('0x41')]){_0x1265fb[_0xdf01('0x42')]=[{'all':!![]}];}return db[_0xdf01('0x2d')]['findAll'](_0x1265fb);})['then'](function(_0x3109e6){_0x17d415['rows']=_0x3109e6;return _0x17d415;})['then'](respondWithFilteredResult(_0x12d75c,_0x1265fb))[_0xdf01('0x43')](handleError(_0x12d75c,null));};exports[_0xdf01('0x44')]=function(_0x4721bb,_0x5e3e34){var _0x32fe45={'raw':!![],'where':{'id':_0x4721bb['params']['id']}},_0x5c5a54={};_0x5c5a54[_0xdf01('0x31')]=_[_0xdf01('0x33')](db['VtigerField'][_0xdf01('0x2e')]);_0x5c5a54[_0xdf01('0x32')]=_['keys'](_0x4721bb['query']);_0x5c5a54[_0xdf01('0x34')]=_[_0xdf01('0x36')](_0x5c5a54[_0xdf01('0x31')],_0x5c5a54[_0xdf01('0x32')]);_0x32fe45[_0xdf01('0x35')]=_['intersection'](_0x5c5a54[_0xdf01('0x31')],qs['fields'](_0x4721bb[_0xdf01('0x32')][_0xdf01('0x45')]));_0x32fe45[_0xdf01('0x35')]=_0x32fe45[_0xdf01('0x35')][_0xdf01('0x46')]?_0x32fe45[_0xdf01('0x35')]:_0x5c5a54[_0xdf01('0x31')];if(_0x4721bb[_0xdf01('0x32')][_0xdf01('0x41')]){_0x32fe45[_0xdf01('0x42')]=[{'all':!![]}];}_0x32fe45=_[_0xdf01('0x3e')]({},_0x32fe45,_0x4721bb['options']);return db['VtigerField'][_0xdf01('0x47')](_0x32fe45)[_0xdf01('0x40')](handleEntityNotFound(_0x5e3e34,null))[_0xdf01('0x40')](respondWithResult(_0x5e3e34,null))[_0xdf01('0x43')](handleError(_0x5e3e34,null));};exports['create']=function(_0x32898c,_0x4856a0){return db[_0xdf01('0x2d')][_0xdf01('0x48')](_0x32898c['body'],{})[_0xdf01('0x40')](respondWithResult(_0x4856a0,0xc9))[_0xdf01('0x43')](handleError(_0x4856a0,null));};exports[_0xdf01('0x26')]=function(_0x847819,_0x41782a){if(_0x847819['body']['id']){delete _0x847819['body']['id'];}return db[_0xdf01('0x2d')][_0xdf01('0x47')]({'where':{'id':_0x847819[_0xdf01('0x49')]['id']}})[_0xdf01('0x40')](handleEntityNotFound(_0x41782a,null))[_0xdf01('0x40')](saveUpdates(_0x847819[_0xdf01('0x4a')],null))[_0xdf01('0x40')](respondWithResult(_0x41782a,null))['catch'](handleError(_0x41782a,null));};exports[_0xdf01('0x27')]=function(_0x23f238,_0x30f476){return db[_0xdf01('0x2d')][_0xdf01('0x47')]({'where':{'id':_0x23f238[_0xdf01('0x49')]['id']}})[_0xdf01('0x40')](handleEntityNotFound(_0x30f476,null))[_0xdf01('0x40')](removeEntity(_0x30f476,null))[_0xdf01('0x43')](handleError(_0x30f476,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 849195d..33e13e6 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 _0xef11=['./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x36e3ba,_0x1912e8){var _0x7972c7=function(_0x52e712){while(--_0x52e712){_0x36e3ba['push'](_0x36e3ba['shift']());}};_0x7972c7(++_0x1912e8);}(_0xef11,0x172));var _0x1ef1=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0xef11[_0x2d9c6a];return _0xf3c918;};'use strict';var _=require('lodash');var util=require(_0x1ef1('0x0'));var logger=require(_0x1ef1('0x1'))(_0x1ef1('0x2'));var moment=require('moment');var BPromise=require(_0x1ef1('0x3'));var rp=require(_0x1ef1('0x4'));var fs=require('fs');var path=require(_0x1ef1('0x5'));var rimraf=require(_0x1ef1('0x6'));var config=require('../../config/environment');var attributes=require(_0x1ef1('0x7'));module['exports']=function(_0x59f012,_0x19a26a){return _0x59f012[_0x1ef1('0x8')](_0x1ef1('0x9'),attributes,{'tableName':_0x1ef1('0xa'),'paranoid':![],'indexes':[{'name':_0x1ef1('0xb'),'fields':['idField',_0x1ef1('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x646f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','idField','FieldId','lodash','util','../../config/logger'];(function(_0x46c64f,_0x357baa){var _0x137844=function(_0x2c5c41){while(--_0x2c5c41){_0x46c64f['push'](_0x46c64f['shift']());}};_0x137844(++_0x357baa);}(_0x646f,0x1c8));var _0xf646=function(_0x3782bf,_0x536759){_0x3782bf=_0x3782bf-0x0;var _0x472cdc=_0x646f[_0x3782bf];return _0x472cdc;};'use strict';var _=require(_0xf646('0x0'));var util=require(_0xf646('0x1'));var logger=require(_0xf646('0x2'))(_0xf646('0x3'));var moment=require(_0xf646('0x4'));var BPromise=require(_0xf646('0x5'));var rp=require(_0xf646('0x6'));var fs=require('fs');var path=require(_0xf646('0x7'));var rimraf=require(_0xf646('0x8'));var config=require(_0xf646('0x9'));var attributes=require(_0xf646('0xa'));module[_0xf646('0xb')]=function(_0x4dffd7,_0x3c112e){return _0x4dffd7[_0xf646('0xc')](_0xf646('0xd'),attributes,{'tableName':_0xf646('0xe'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xf646('0xf'),_0xf646('0x10')],'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 ab0c9e6..17ce1e8 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 _0xe2d7=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird'];(function(_0x165cc3,_0x1b2d7d){var _0x2d5eea=function(_0x48bc18){while(--_0x48bc18){_0x165cc3['push'](_0x165cc3['shift']());}};_0x2d5eea(++_0x1b2d7d);}(_0xe2d7,0xbc));var _0x7e2d=function(_0x6c05f9,_0x2aff24){_0x6c05f9=_0x6c05f9-0x0;var _0xd49c70=_0xe2d7[_0x6c05f9];return _0xd49c70;};'use strict';var _=require(_0x7e2d('0x0'));var util=require(_0x7e2d('0x1'));var moment=require(_0x7e2d('0x2'));var BPromise=require(_0x7e2d('0x3'));var rs=require(_0x7e2d('0x4'));var fs=require('fs');var Redis=require(_0x7e2d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e2d('0x6'));var logger=require(_0x7e2d('0x7'))(_0x7e2d('0x8'));var config=require(_0x7e2d('0x9'));var jayson=require(_0x7e2d('0xa'));var client=jayson['client'][_0x7e2d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13835e,_0xbcfe98,_0x3b3a91){return new BPromise(function(_0x579612,_0x5b4744){return client[_0x7e2d('0xc')](_0x13835e,_0x3b3a91)[_0x7e2d('0xd')](function(_0x2890ac){logger['info'](_0x7e2d('0xe'),_0xbcfe98,_0x7e2d('0xf'));logger[_0x7e2d('0x10')](_0x7e2d('0x11'),_0xbcfe98,_0x7e2d('0xf'),JSON[_0x7e2d('0x12')](_0x2890ac));if(_0x2890ac[_0x7e2d('0x13')]){if(_0x2890ac[_0x7e2d('0x13')][_0x7e2d('0x14')]===0x1f4){logger[_0x7e2d('0x13')](_0x7e2d('0xe'),_0xbcfe98,_0x2890ac[_0x7e2d('0x13')][_0x7e2d('0x15')]);return _0x5b4744(_0x2890ac[_0x7e2d('0x13')][_0x7e2d('0x15')]);}logger[_0x7e2d('0x13')](_0x7e2d('0xe'),_0xbcfe98,_0x2890ac[_0x7e2d('0x13')][_0x7e2d('0x15')]);return _0x579612(_0x2890ac[_0x7e2d('0x13')][_0x7e2d('0x15')]);}else{logger[_0x7e2d('0x16')](_0x7e2d('0xe'),_0xbcfe98,_0x7e2d('0xf'));_0x579612(_0x2890ac['result'][_0x7e2d('0x15')]);}})[_0x7e2d('0x17')](function(_0xe5e8de){logger[_0x7e2d('0x13')]('VtigerField,\x20%s,\x20%s',_0xbcfe98,_0xe5e8de);_0x5b4744(_0xe5e8de);});});} \ No newline at end of file +var _0x2b7a=['client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x409234,_0xc02060){var _0x2ce294=function(_0x200061){while(--_0x200061){_0x409234['push'](_0x409234['shift']());}};_0x2ce294(++_0xc02060);}(_0x2b7a,0x1d6));var _0xa2b7=function(_0x13772d,_0x3b9c0c){_0x13772d=_0x13772d-0x0;var _0x42b874=_0x2b7a[_0x13772d];return _0x42b874;};'use strict';var _=require(_0xa2b7('0x0'));var util=require(_0xa2b7('0x1'));var moment=require(_0xa2b7('0x2'));var BPromise=require('bluebird');var rs=require(_0xa2b7('0x3'));var fs=require('fs');var Redis=require(_0xa2b7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2b7('0x5'));var logger=require(_0xa2b7('0x6'))(_0xa2b7('0x7'));var config=require(_0xa2b7('0x8'));var jayson=require(_0xa2b7('0x9'));var client=jayson[_0xa2b7('0xa')][_0xa2b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cb889,_0xcc15c5,_0x160418){return new BPromise(function(_0x36cff8,_0x33e592){return client[_0xa2b7('0xc')](_0x1cb889,_0x160418)[_0xa2b7('0xd')](function(_0x50f8ec){logger[_0xa2b7('0xe')](_0xa2b7('0xf'),_0xcc15c5,_0xa2b7('0x10'));logger[_0xa2b7('0x11')](_0xa2b7('0x12'),_0xcc15c5,_0xa2b7('0x10'),JSON['stringify'](_0x50f8ec));if(_0x50f8ec[_0xa2b7('0x13')]){if(_0x50f8ec['error'][_0xa2b7('0x14')]===0x1f4){logger[_0xa2b7('0x13')](_0xa2b7('0xf'),_0xcc15c5,_0x50f8ec[_0xa2b7('0x13')][_0xa2b7('0x15')]);return _0x33e592(_0x50f8ec[_0xa2b7('0x13')][_0xa2b7('0x15')]);}logger[_0xa2b7('0x13')](_0xa2b7('0xf'),_0xcc15c5,_0x50f8ec[_0xa2b7('0x13')][_0xa2b7('0x15')]);return _0x36cff8(_0x50f8ec['error'][_0xa2b7('0x15')]);}else{logger['info'](_0xa2b7('0xf'),_0xcc15c5,_0xa2b7('0x10'));_0x36cff8(_0x50f8ec[_0xa2b7('0x16')]['message']);}})[_0xa2b7('0x17')](function(_0x3afaa7){logger[_0xa2b7('0x13')](_0xa2b7('0xf'),_0xcc15c5,_0x3afaa7);_0x33e592(_0x3afaa7);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 8290b86..644dbb6 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 _0x3f98=['isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get'];(function(_0x4c7df5,_0x10b614){var _0x3b5bdb=function(_0x82f583){while(--_0x82f583){_0x4c7df5['push'](_0x4c7df5['shift']());}};_0x3b5bdb(++_0x10b614);}(_0x3f98,0xfb));var _0x83f9=function(_0x429aed,_0x1e29fd){_0x429aed=_0x429aed-0x0;var _0x25c5c0=_0x3f98[_0x429aed];return _0x25c5c0;};'use strict';var multer=require(_0x83f9('0x0'));var util=require('util');var path=require(_0x83f9('0x1'));var timeout=require(_0x83f9('0x2'));var express=require('express');var router=express[_0x83f9('0x3')]();var fs_extra=require(_0x83f9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x83f9('0x5'));var config=require(_0x83f9('0x6'));var controller=require(_0x83f9('0x7'));router[_0x83f9('0x8')]('/',auth[_0x83f9('0x9')](),controller[_0x83f9('0xa')]);router[_0x83f9('0x8')](_0x83f9('0xb'),auth[_0x83f9('0x9')](),controller['show']);router[_0x83f9('0x8')](_0x83f9('0xc'),auth[_0x83f9('0x9')](),controller[_0x83f9('0xd')]);router[_0x83f9('0x8')](_0x83f9('0xe'),auth[_0x83f9('0x9')](),controller['getFields']);router[_0x83f9('0xf')]('/',auth[_0x83f9('0x9')](),controller['create']);router['post'](_0x83f9('0xc'),auth[_0x83f9('0x9')](),controller['addConfiguration']);router['put'](_0x83f9('0xb'),auth[_0x83f9('0x9')](),controller[_0x83f9('0x10')]);router[_0x83f9('0x11')](_0x83f9('0xb'),auth[_0x83f9('0x9')](),controller[_0x83f9('0x12')]);module[_0x83f9('0x13')]=router; \ No newline at end of file +var _0x235e=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get'];(function(_0xe79d9f,_0x15231d){var _0x5c77fa=function(_0x40a65a){while(--_0x40a65a){_0xe79d9f['push'](_0xe79d9f['shift']());}};_0x5c77fa(++_0x15231d);}(_0x235e,0xa5));var _0xe235=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x235e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe235('0x0'));var util=require('util');var path=require(_0xe235('0x1'));var timeout=require(_0xe235('0x2'));var express=require(_0xe235('0x3'));var router=express[_0xe235('0x4')]();var fs_extra=require(_0xe235('0x5'));var auth=require(_0xe235('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe235('0x7'));var controller=require(_0xe235('0x8'));router[_0xe235('0x9')]('/',auth[_0xe235('0xa')](),controller[_0xe235('0xb')]);router['get'](_0xe235('0xc'),auth[_0xe235('0xa')](),controller[_0xe235('0xd')]);router[_0xe235('0x9')](_0xe235('0xe'),auth[_0xe235('0xa')](),controller[_0xe235('0xf')]);router[_0xe235('0x9')](_0xe235('0x10'),auth['isAuthenticated'](),controller[_0xe235('0x11')]);router[_0xe235('0x12')]('/',auth[_0xe235('0xa')](),controller[_0xe235('0x13')]);router[_0xe235('0x12')](_0xe235('0xe'),auth[_0xe235('0xa')](),controller[_0xe235('0x14')]);router['put'](_0xe235('0xc'),auth[_0xe235('0xa')](),controller[_0xe235('0x15')]);router[_0xe235('0x16')](_0xe235('0xc'),auth['isAuthenticated'](),controller[_0xe235('0x17')]);module[_0xe235('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 578e208..f5980d6 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 _0x5b6e=['exports','STRING','username','ENUM','password','token','integrationTab','newTab','sequelize'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x5b6e,0x14c));var _0xe5b6=function(_0x240572,_0x59d371){_0x240572=_0x240572-0x0;var _0x27498c=_0x5b6e[_0x240572];return _0x27498c;};'use strict';var Sequelize=require(_0xe5b6('0x0'));module[_0xe5b6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe5b6('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xe5b6('0x3')},'password':{'type':Sequelize[_0xe5b6('0x2')]},'token':{'type':Sequelize[_0xe5b6('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xe5b6('0x4')](_0xe5b6('0x5'),_0xe5b6('0x6')),'defaultValue':_0xe5b6('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe5b6('0x4')](_0xe5b6('0x7'),_0xe5b6('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xafb9=['exports','STRING','username','password','integrationTab','newTab','sequelize'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0xafb9,0x68));var _0x9afb=function(_0x210a23,_0x95d51d){_0x210a23=_0x210a23-0x0;var _0xa447ef=_0xafb9[_0x210a23];return _0xa447ef;};'use strict';var Sequelize=require(_0x9afb('0x0'));module[_0x9afb('0x1')]={'name':{'type':Sequelize[_0x9afb('0x2')]},'description':{'type':Sequelize[_0x9afb('0x2')]},'username':{'type':Sequelize[_0x9afb('0x2')],'unique':_0x9afb('0x3')},'password':{'type':Sequelize[_0x9afb('0x2')]},'token':{'type':Sequelize[_0x9afb('0x2')]},'remoteUri':{'type':Sequelize[_0x9afb('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0x9afb('0x4'),'token'),'defaultValue':_0x9afb('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9afb('0x5'),_0x9afb('0x6')),'defaultValue':_0x9afb('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 4980ec4..6268032 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 _0x97c1=['crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','ZendeskAccount','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','findOne','params','ZendeskConfiguration','getConfigurations','addConfiguration','getSubjects','channel','getDescriptions','ZendeskField','Subjects','Descriptions','getFields','authType','remoteUri','slice','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','username','password','base64','token','%s/token:%s','toString','Sequelize','subject','description','group','assignee','remove','position','system_field_options','custom_field_options','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel'];(function(_0x3e0b2e,_0x546a44){var _0x45dcef=function(_0x4219c2){while(--_0x4219c2){_0x3e0b2e['push'](_0x3e0b2e['shift']());}};_0x45dcef(++_0x546a44);}(_0x97c1,0xdf));var _0x197c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x97c1[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x197c('0x0'));var rimraf=require(_0x197c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x197c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x197c('0x3'));var Mustache=require(_0x197c('0x4'));var util=require(_0x197c('0x5'));var path=require(_0x197c('0x6'));var sox=require(_0x197c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x197c('0x8'));var _=require(_0x197c('0x9'));var squel=require(_0x197c('0xa'));var crypto=require(_0x197c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197c('0xc'));var querystring=require('querystring');var Papa=require(_0x197c('0xd'));var Redis=require(_0x197c('0xe'));var authService=require(_0x197c('0xf'));var qs=require(_0x197c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197c('0x11'));var logger=require(_0x197c('0x12'))(_0x197c('0x13'));var utils=require(_0x197c('0x14'));var config=require(_0x197c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197c('0x16'))['db'];var integrations=require(_0x197c('0x17'));function respondWithStatusCode(_0x27e46f,_0x1adcfa){_0x1adcfa=_0x1adcfa||0xcc;return function(_0x567658){if(_0x567658){return _0x27e46f[_0x197c('0x18')](_0x1adcfa);}return _0x27e46f[_0x197c('0x19')](_0x1adcfa)[_0x197c('0x1a')]();};}function respondWithResult(_0xf735ce,_0x188ff2){_0x188ff2=_0x188ff2||0xc8;return function(_0x109af2){if(_0x109af2){return _0xf735ce['status'](_0x188ff2)['json'](_0x109af2);}};}function respondWithFilteredResult(_0x422dfa,_0x2bc612){return function(_0x2083d4){if(_0x2083d4){var _0x24901f=typeof _0x2bc612[_0x197c('0x1b')]===_0x197c('0x1c')&&typeof _0x2bc612[_0x197c('0x1d')]===_0x197c('0x1c');var _0x47f43b=_0x2083d4[_0x197c('0x1e')];var _0x47aaa9=_0x24901f?0x0:_0x2bc612['offset'];var _0x1725d9=_0x24901f?_0x2083d4[_0x197c('0x1e')]:_0x2bc612[_0x197c('0x1b')]+_0x2bc612[_0x197c('0x1d')];var _0x4a4994;if(_0x1725d9>=_0x47f43b){_0x1725d9=_0x47f43b;_0x4a4994=0xc8;}else{_0x4a4994=0xce;}_0x422dfa[_0x197c('0x19')](_0x4a4994);return _0x422dfa[_0x197c('0x1f')](_0x197c('0x20'),_0x47aaa9+'-'+_0x1725d9+'/'+_0x47f43b)['json'](_0x2083d4);}return null;};}function patchUpdates(_0x1adb43){return function(_0x27b3df){try{jsonpatch[_0x197c('0x21')](_0x27b3df,_0x1adb43,!![]);}catch(_0xf3aeda){return BPromise[_0x197c('0x22')](_0xf3aeda);}return _0x27b3df[_0x197c('0x23')]();};}function saveUpdates(_0x362bbf,_0x2092a0){return function(_0x8963fd){if(_0x8963fd){return _0x8963fd[_0x197c('0x24')](_0x362bbf)[_0x197c('0x25')](function(_0x177bc9){return _0x177bc9;});}return null;};}function removeEntity(_0x174942,_0x2a1310){return function(_0x37b040){if(_0x37b040){return _0x37b040[_0x197c('0x26')]()['then'](function(){_0x174942[_0x197c('0x19')](0xcc)[_0x197c('0x1a')]();});}};}function handleEntityNotFound(_0x2b6319,_0x499051){return function(_0x2c2952){if(!_0x2c2952){_0x2b6319[_0x197c('0x18')](0x194);}return _0x2c2952;};}function handleError(_0x4c3337,_0x5e7bc9){_0x5e7bc9=_0x5e7bc9||0x1f4;return function(_0x12b37b){logger['error'](_0x12b37b[_0x197c('0x27')]);if(_0x12b37b[_0x197c('0x28')]){delete _0x12b37b[_0x197c('0x28')];}_0x4c3337[_0x197c('0x19')](_0x5e7bc9)[_0x197c('0x29')](_0x12b37b);};}exports[_0x197c('0x2a')]=function(_0x2b6154,_0x215df1){var _0x4422d1={},_0x5df39e={},_0x50dea3={'count':0x0,'rows':[]};var _0x574274=_['map'](db[_0x197c('0x2b')]['rawAttributes'],function(_0x252cde){return{'name':_0x252cde[_0x197c('0x2c')],'type':_0x252cde['type'][_0x197c('0x2d')]};});_0x5df39e['model']=_[_0x197c('0x2e')](_0x574274,_0x197c('0x28'));_0x5df39e[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x2b6154[_0x197c('0x2f')]);_0x5df39e[_0x197c('0x31')]=_[_0x197c('0x32')](_0x5df39e[_0x197c('0x33')],_0x5df39e[_0x197c('0x2f')]);_0x4422d1['attributes']=_['intersection'](_0x5df39e[_0x197c('0x33')],qs[_0x197c('0x34')](_0x2b6154[_0x197c('0x2f')][_0x197c('0x34')]));_0x4422d1[_0x197c('0x35')]=_0x4422d1[_0x197c('0x35')][_0x197c('0x36')]?_0x4422d1['attributes']:_0x5df39e['model'];if(!_0x2b6154[_0x197c('0x2f')][_0x197c('0x37')]('nolimit')){_0x4422d1['limit']=qs[_0x197c('0x1d')](_0x2b6154[_0x197c('0x2f')][_0x197c('0x1d')]);_0x4422d1[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x2b6154[_0x197c('0x2f')][_0x197c('0x1b')]);}_0x4422d1[_0x197c('0x38')]=qs[_0x197c('0x39')](_0x2b6154['query'][_0x197c('0x39')]);_0x4422d1[_0x197c('0x3a')]=qs[_0x197c('0x31')](_[_0x197c('0x3b')](_0x2b6154[_0x197c('0x2f')],_0x5df39e[_0x197c('0x31')]),_0x574274);if(_0x2b6154['query'][_0x197c('0x3c')]){_0x4422d1[_0x197c('0x3a')]=_[_0x197c('0x3d')](_0x4422d1['where'],{'$or':_[_0x197c('0x2e')](_0x574274,function(_0x34dabc){if(_0x34dabc[_0x197c('0x3e')]!==_0x197c('0x3f')){var _0x2970b4={};_0x2970b4[_0x34dabc[_0x197c('0x28')]]={'$like':'%'+_0x2b6154[_0x197c('0x2f')][_0x197c('0x3c')]+'%'};return _0x2970b4;}})});}_0x4422d1=_[_0x197c('0x3d')]({},_0x4422d1,_0x2b6154[_0x197c('0x40')]);var _0x4a12fc={'where':_0x4422d1[_0x197c('0x3a')]};return db[_0x197c('0x2b')]['count'](_0x4a12fc)['then'](function(_0xa57083){_0x50dea3[_0x197c('0x1e')]=_0xa57083;if(_0x2b6154[_0x197c('0x2f')][_0x197c('0x41')]){_0x4422d1[_0x197c('0x42')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x197c('0x43')](_0x4422d1);})[_0x197c('0x25')](function(_0x7ed02b){_0x50dea3[_0x197c('0x44')]=_0x7ed02b;return _0x50dea3;})[_0x197c('0x25')](respondWithFilteredResult(_0x215df1,_0x4422d1))['catch'](handleError(_0x215df1,null));};exports[_0x197c('0x45')]=function(_0x37bb94,_0x6d7bda){var _0x197b27={'raw':![],'where':{'id':_0x37bb94['params']['id']}},_0x2f3c4b={};_0x2f3c4b[_0x197c('0x33')]=_[_0x197c('0x30')](db[_0x197c('0x2b')][_0x197c('0x46')]);_0x2f3c4b[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x37bb94[_0x197c('0x2f')]);_0x2f3c4b[_0x197c('0x31')]=_[_0x197c('0x32')](_0x2f3c4b[_0x197c('0x33')],_0x2f3c4b[_0x197c('0x2f')]);_0x197b27['attributes']=_['intersection'](_0x2f3c4b['model'],qs['fields'](_0x37bb94[_0x197c('0x2f')][_0x197c('0x34')]));_0x197b27['attributes']=_0x197b27[_0x197c('0x35')][_0x197c('0x36')]?_0x197b27['attributes']:_0x2f3c4b[_0x197c('0x33')];if(_0x37bb94[_0x197c('0x2f')]['includeAll']){_0x197b27[_0x197c('0x42')]=[{'all':!![]}];}_0x197b27=_[_0x197c('0x3d')]({},_0x197b27,_0x37bb94['options']);return db[_0x197c('0x2b')][_0x197c('0x47')](_0x197b27)[_0x197c('0x25')](handleEntityNotFound(_0x6d7bda,null))['then'](respondWithResult(_0x6d7bda,null))[_0x197c('0x48')](handleError(_0x6d7bda,null));};exports[_0x197c('0x49')]=function(_0x220909,_0x1a92d2){return db['ZendeskAccount'][_0x197c('0x49')](_0x220909[_0x197c('0x4a')],{})[_0x197c('0x25')](respondWithResult(_0x1a92d2,0xc9))['catch'](handleError(_0x1a92d2,null));};exports['update']=function(_0x3a5089,_0x332c75){if(_0x3a5089[_0x197c('0x4a')]['id']){delete _0x3a5089[_0x197c('0x4a')]['id'];}return db[_0x197c('0x2b')][_0x197c('0x47')]({'where':{'id':_0x3a5089['params']['id']}})[_0x197c('0x25')](handleEntityNotFound(_0x332c75,null))['then'](saveUpdates(_0x3a5089[_0x197c('0x4a')],null))[_0x197c('0x25')](respondWithResult(_0x332c75,null))[_0x197c('0x48')](handleError(_0x332c75,null));};exports[_0x197c('0x26')]=function(_0x34a211,_0x2ab21f){return db[_0x197c('0x2b')][_0x197c('0x47')]({'where':{'id':_0x34a211['params']['id']}})[_0x197c('0x25')](handleEntityNotFound(_0x2ab21f,null))[_0x197c('0x25')](removeEntity(_0x2ab21f,null))[_0x197c('0x48')](handleError(_0x2ab21f,null));};exports['getConfigurations']=function(_0x114ef5,_0x495c1d,_0x204592){var _0x1d2a5f={};var _0x1ec51a={};var _0x22a106;var _0x1d7cdd;return db[_0x197c('0x2b')][_0x197c('0x4b')]({'where':{'id':_0x114ef5[_0x197c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x495c1d,null))[_0x197c('0x25')](function(_0x3a9261){if(_0x3a9261){_0x22a106=_0x3a9261;_0x1ec51a[_0x197c('0x33')]=_['keys'](db[_0x197c('0x4d')][_0x197c('0x46')]);_0x1ec51a[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x114ef5[_0x197c('0x2f')]);_0x1ec51a['filters']=_['intersection'](_0x1ec51a[_0x197c('0x33')],_0x1ec51a[_0x197c('0x2f')]);_0x1d2a5f[_0x197c('0x35')]=_[_0x197c('0x32')](_0x1ec51a[_0x197c('0x33')],qs['fields'](_0x114ef5['query'][_0x197c('0x34')]));_0x1d2a5f[_0x197c('0x35')]=_0x1d2a5f['attributes'][_0x197c('0x36')]?_0x1d2a5f[_0x197c('0x35')]:_0x1ec51a[_0x197c('0x33')];_0x1d2a5f[_0x197c('0x38')]=qs[_0x197c('0x39')](_0x114ef5[_0x197c('0x2f')]['sort']);_0x1d2a5f[_0x197c('0x3a')]=qs[_0x197c('0x31')](_['pick'](_0x114ef5['query'],_0x1ec51a[_0x197c('0x31')]));if(_0x114ef5['query'][_0x197c('0x3c')]){_0x1d2a5f[_0x197c('0x3a')]=_[_0x197c('0x3d')](_0x1d2a5f['where'],{'$or':_[_0x197c('0x2e')](_0x1d2a5f[_0x197c('0x35')],function(_0x5585de){var _0x2dcbca={};_0x2dcbca[_0x5585de]={'$like':'%'+_0x114ef5[_0x197c('0x2f')][_0x197c('0x3c')]+'%'};return _0x2dcbca;})});}_0x1d2a5f=_['merge']({},_0x1d2a5f,_0x114ef5[_0x197c('0x40')]);return _0x22a106[_0x197c('0x4e')](_0x1d2a5f);}})['then'](function(_0x570d76){if(_0x570d76){_0x1d7cdd=_0x570d76[_0x197c('0x36')];if(!_0x114ef5[_0x197c('0x2f')][_0x197c('0x37')]('nolimit')){_0x1d2a5f[_0x197c('0x1d')]=qs[_0x197c('0x1d')](_0x114ef5[_0x197c('0x2f')]['limit']);_0x1d2a5f[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x114ef5[_0x197c('0x2f')][_0x197c('0x1b')]);}return _0x22a106[_0x197c('0x4e')](_0x1d2a5f);}})[_0x197c('0x25')](function(_0x8d1f3f){if(_0x8d1f3f){return _0x8d1f3f?{'count':_0x1d7cdd,'rows':_0x8d1f3f}:null;}})[_0x197c('0x25')](respondWithResult(_0x495c1d,null))[_0x197c('0x48')](handleError(_0x495c1d,null));};exports[_0x197c('0x4f')]=function(_0x5ef485,_0x1f7ad0,_0x572649){if(_0x5ef485['body']['id']){delete _0x5ef485['body']['id'];}return db['ZendeskAccount'][_0x197c('0x4b')]({'where':{'id':_0x5ef485[_0x197c('0x4c')]['id']}})[_0x197c('0x25')](handleEntityNotFound(_0x1f7ad0,null))[_0x197c('0x25')](function(_0x55b744){if(_0x55b744){_0x5ef485[_0x197c('0x4a')]['AccountId']=_0x55b744['id'];_0x5ef485[_0x197c('0x4a')]['Subjects']=integrations[_0x197c('0x50')](_0x5ef485['body'][_0x197c('0x51')],_0x5ef485[_0x197c('0x4a')][_0x197c('0x3e')]);_0x5ef485[_0x197c('0x4a')]['Descriptions']=integrations[_0x197c('0x52')](_0x5ef485[_0x197c('0x4a')][_0x197c('0x51')],_0x5ef485['body'][_0x197c('0x3e')]);return db[_0x197c('0x4d')][_0x197c('0x49')](_0x5ef485[_0x197c('0x4a')],{'include':[{'model':db[_0x197c('0x53')],'as':_0x197c('0x54')},{'model':db[_0x197c('0x53')],'as':_0x197c('0x55')}]});}return null;})[_0x197c('0x25')](respondWithResult(_0x1f7ad0,null))[_0x197c('0x48')](handleError(_0x1f7ad0,null));};exports[_0x197c('0x56')]=function(_0x25d3c1,_0x43c0b2,_0x395fce){var _0x2b1c78='';return db[_0x197c('0x2b')][_0x197c('0x4b')]({'where':{'id':_0x25d3c1[_0x197c('0x4c')]['id']},'attributes':['id','username','password','token',_0x197c('0x57'),'remoteUri']})[_0x197c('0x25')](handleEntityNotFound(_0x43c0b2,null))['then'](function(_0x5a601c){if(_0x5a601c){_0x2b1c78=_0x5a601c[_0x197c('0x58')];var _0x2c9746=_0x2b1c78[_0x197c('0x59')](-0x1);if(_0x2c9746==='/'){_0x2b1c78=_0x2b1c78['substring'](0x0,_0x2b1c78[_0x197c('0x5a')](_0x2c9746));}var _0x238092={'method':'GET','uri':util[_0x197c('0x5b')](_0x197c('0x5c'),_0x2b1c78,_0x197c('0x5d')),'json':!![]};switch(_0x5a601c[_0x197c('0x57')]){case'password':_0x238092[_0x197c('0x5e')]={'Authorization':util['format'](_0x197c('0x5f'),new Buffer(util['format'](_0x197c('0x60'),_0x5a601c[_0x197c('0x61')],_0x5a601c[_0x197c('0x62')]))['toString'](_0x197c('0x63')))};break;case _0x197c('0x64'):_0x238092[_0x197c('0x5e')]={'Authorization':util['format'](_0x197c('0x5f'),new Buffer(util[_0x197c('0x5b')](_0x197c('0x65'),_0x5a601c[_0x197c('0x61')],_0x5a601c[_0x197c('0x64')]))[_0x197c('0x66')]('base64'))};break;default:throw new db[(_0x197c('0x67'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x238092);}})[_0x197c('0x25')](function(_0x8c0d4a){if(_0x8c0d4a){var _0x58e708=[_0x197c('0x68'),_0x197c('0x69'),_0x197c('0x6a'),_0x197c('0x6b')];_[_0x197c('0x6c')](_0x8c0d4a['ticket_fields'],function(_0x5da64e){return _0x58e708['includes'](_0x5da64e['type']);});return{'count':_0x8c0d4a[_0x197c('0x5d')][_0x197c('0x36')],'rows':_['map'](_0x8c0d4a['ticket_fields'],function(_0x213e01){return{'id':_0x213e01['id'],'name':_0x213e01['position']>0x7?_0x213e01['title']:_0x213e01[_0x197c('0x3e')],'custom':_0x213e01[_0x197c('0x6d')]>0x7?!![]:![],'options':_0x213e01[_0x197c('0x6e')]?_0x213e01[_0x197c('0x6e')]:_0x213e01[_0x197c('0x6f')]?_0x213e01[_0x197c('0x6f')]:[]};})};}})['then'](respondWithResult(_0x43c0b2,null))[_0x197c('0x48')](function(_0x2321e1){var _0x43fc99=_0x25d3c1[_0x197c('0x2f')][_0x197c('0x70')]?0x1f4:_0x2321e1[_0x197c('0x71')]||0x1f4;logger[_0x197c('0x72')]('getFields,\x20%s,\x20%s,\x20%s',_0x197c('0x56'),_0x43fc99,JSON[_0x197c('0x73')](_0x2321e1));delete _0x2321e1[_0x197c('0x28')];if(_0x43fc99===0x191){_0x43fc99=0x190;}_0x43c0b2[_0x197c('0x19')](_0x43fc99)[_0x197c('0x29')](_0x25d3c1[_0x197c('0x2f')]['test']?{'message':_0x197c('0x74'),'statusCode':_0x2321e1[_0x197c('0x71')]}:_0x2321e1);});}; \ No newline at end of file +var _0x1d2d=['position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','error','stack','send','index','ZendeskAccount','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','filter','options','findAll','catch','includeAll','find','create','body','params','getConfigurations','ZendeskConfiguration','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','channel','ZendeskField','Descriptions','username','token','substring','lastIndexOf','GET','format','%s/%s','authType','password','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','Sequelize','subject','description','group','assignee','ticket_fields','includes'];(function(_0x46efcd,_0x5687ec){var _0x4c22b6=function(_0x40e18b){while(--_0x40e18b){_0x46efcd['push'](_0x46efcd['shift']());}};_0x4c22b6(++_0x5687ec);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x5a5345,_0x3db7c8){_0x5a5345=_0x5a5345-0x0;var _0x2787b5=_0x1d2d[_0x5a5345];return _0x2787b5;};'use strict';var emlformat=require(_0xd1d2('0x0'));var rimraf=require(_0xd1d2('0x1'));var zipdir=require(_0xd1d2('0x2'));var jsonpatch=require(_0xd1d2('0x3'));var rp=require(_0xd1d2('0x4'));var moment=require('moment');var BPromise=require(_0xd1d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1d2('0x6'));var sox=require(_0xd1d2('0x7'));var csv=require(_0xd1d2('0x8'));var ejs=require(_0xd1d2('0x9'));var fs=require('fs');var fs_extra=require(_0xd1d2('0xa'));var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x8'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var licenseUtil=require(_0xd1d2('0x19'));var db=require(_0xd1d2('0x1a'))['db'];var integrations=require(_0xd1d2('0x1b'));function respondWithStatusCode(_0x129d8f,_0xc3ee82){_0xc3ee82=_0xc3ee82||0xcc;return function(_0x2df8a5){if(_0x2df8a5){return _0x129d8f[_0xd1d2('0x1c')](_0xc3ee82);}return _0x129d8f[_0xd1d2('0x1d')](_0xc3ee82)[_0xd1d2('0x1e')]();};}function respondWithResult(_0x4cf702,_0x2e7fec){_0x2e7fec=_0x2e7fec||0xc8;return function(_0x3c0296){if(_0x3c0296){return _0x4cf702[_0xd1d2('0x1d')](_0x2e7fec)['json'](_0x3c0296);}};}function respondWithFilteredResult(_0x35381b,_0xc36ce){return function(_0x208425){if(_0x208425){var _0x2f4cf9=typeof _0xc36ce[_0xd1d2('0x1f')]===_0xd1d2('0x20')&&typeof _0xc36ce[_0xd1d2('0x21')]==='undefined';var _0x539d5a=_0x208425[_0xd1d2('0x22')];var _0x55320b=_0x2f4cf9?0x0:_0xc36ce[_0xd1d2('0x1f')];var _0x42565b=_0x2f4cf9?_0x208425[_0xd1d2('0x22')]:_0xc36ce[_0xd1d2('0x1f')]+_0xc36ce['limit'];var _0x4f1201;if(_0x42565b>=_0x539d5a){_0x42565b=_0x539d5a;_0x4f1201=0xc8;}else{_0x4f1201=0xce;}_0x35381b[_0xd1d2('0x1d')](_0x4f1201);return _0x35381b['set']('Content-Range',_0x55320b+'-'+_0x42565b+'/'+_0x539d5a)[_0xd1d2('0x23')](_0x208425);}return null;};}function patchUpdates(_0x27e26b){return function(_0x3414ce){try{jsonpatch[_0xd1d2('0x24')](_0x3414ce,_0x27e26b,!![]);}catch(_0x596cd8){return BPromise[_0xd1d2('0x25')](_0x596cd8);}return _0x3414ce[_0xd1d2('0x26')]();};}function saveUpdates(_0x24b8db,_0x4eb082){return function(_0x59e72c){if(_0x59e72c){return _0x59e72c[_0xd1d2('0x27')](_0x24b8db)[_0xd1d2('0x28')](function(_0x19d535){return _0x19d535;});}return null;};}function removeEntity(_0x2f92ee,_0x3f229c){return function(_0x33a171){if(_0x33a171){return _0x33a171[_0xd1d2('0x29')]()['then'](function(){_0x2f92ee[_0xd1d2('0x1d')](0xcc)[_0xd1d2('0x1e')]();});}};}function handleEntityNotFound(_0x41330f,_0x2e1709){return function(_0x5d3ee1){if(!_0x5d3ee1){_0x41330f[_0xd1d2('0x1c')](0x194);}return _0x5d3ee1;};}function handleError(_0x28b8be,_0x34faf7){_0x34faf7=_0x34faf7||0x1f4;return function(_0xe6ef3c){logger[_0xd1d2('0x2a')](_0xe6ef3c[_0xd1d2('0x2b')]);if(_0xe6ef3c['name']){delete _0xe6ef3c['name'];}_0x28b8be[_0xd1d2('0x1d')](_0x34faf7)[_0xd1d2('0x2c')](_0xe6ef3c);};}exports[_0xd1d2('0x2d')]=function(_0x2b4c1f,_0xc815ea){var _0x48ade1={},_0x39d694={},_0x41171c={'count':0x0,'rows':[]};var _0x383947=_['map'](db[_0xd1d2('0x2e')][_0xd1d2('0x2f')],function(_0xbd855a){return{'name':_0xbd855a['fieldName'],'type':_0xbd855a[_0xd1d2('0x30')][_0xd1d2('0x31')]};});_0x39d694[_0xd1d2('0x32')]=_[_0xd1d2('0x33')](_0x383947,_0xd1d2('0x34'));_0x39d694[_0xd1d2('0x35')]=_[_0xd1d2('0x36')](_0x2b4c1f[_0xd1d2('0x35')]);_0x39d694[_0xd1d2('0x37')]=_[_0xd1d2('0x38')](_0x39d694[_0xd1d2('0x32')],_0x39d694[_0xd1d2('0x35')]);_0x48ade1[_0xd1d2('0x39')]=_[_0xd1d2('0x38')](_0x39d694[_0xd1d2('0x32')],qs[_0xd1d2('0x3a')](_0x2b4c1f[_0xd1d2('0x35')][_0xd1d2('0x3a')]));_0x48ade1['attributes']=_0x48ade1[_0xd1d2('0x39')][_0xd1d2('0x3b')]?_0x48ade1[_0xd1d2('0x39')]:_0x39d694['model'];if(!_0x2b4c1f[_0xd1d2('0x35')]['hasOwnProperty']('nolimit')){_0x48ade1[_0xd1d2('0x21')]=qs[_0xd1d2('0x21')](_0x2b4c1f[_0xd1d2('0x35')][_0xd1d2('0x21')]);_0x48ade1[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x2b4c1f['query'][_0xd1d2('0x1f')]);}_0x48ade1[_0xd1d2('0x3c')]=qs['sort'](_0x2b4c1f[_0xd1d2('0x35')][_0xd1d2('0x3d')]);_0x48ade1[_0xd1d2('0x3e')]=qs[_0xd1d2('0x37')](_['pick'](_0x2b4c1f['query'],_0x39d694[_0xd1d2('0x37')]),_0x383947);if(_0x2b4c1f['query']['filter']){_0x48ade1['where']=_[_0xd1d2('0x3f')](_0x48ade1['where'],{'$or':_[_0xd1d2('0x33')](_0x383947,function(_0x4e7640){if(_0x4e7640['type']!=='VIRTUAL'){var _0x2dabfa={};_0x2dabfa[_0x4e7640[_0xd1d2('0x34')]]={'$like':'%'+_0x2b4c1f[_0xd1d2('0x35')][_0xd1d2('0x40')]+'%'};return _0x2dabfa;}})});}_0x48ade1=_[_0xd1d2('0x3f')]({},_0x48ade1,_0x2b4c1f[_0xd1d2('0x41')]);var _0x178f8b={'where':_0x48ade1[_0xd1d2('0x3e')]};return db[_0xd1d2('0x2e')][_0xd1d2('0x22')](_0x178f8b)[_0xd1d2('0x28')](function(_0x1fb5b5){_0x41171c[_0xd1d2('0x22')]=_0x1fb5b5;if(_0x2b4c1f[_0xd1d2('0x35')]['includeAll']){_0x48ade1['include']=[{'all':!![]}];}return db[_0xd1d2('0x2e')][_0xd1d2('0x42')](_0x48ade1);})[_0xd1d2('0x28')](function(_0x4d0fd9){_0x41171c['rows']=_0x4d0fd9;return _0x41171c;})[_0xd1d2('0x28')](respondWithFilteredResult(_0xc815ea,_0x48ade1))[_0xd1d2('0x43')](handleError(_0xc815ea,null));};exports['show']=function(_0x2fe92a,_0x4c5d49){var _0x5a3790={'raw':![],'where':{'id':_0x2fe92a['params']['id']}},_0x21eb24={};_0x21eb24['model']=_[_0xd1d2('0x36')](db[_0xd1d2('0x2e')][_0xd1d2('0x2f')]);_0x21eb24['query']=_[_0xd1d2('0x36')](_0x2fe92a[_0xd1d2('0x35')]);_0x21eb24[_0xd1d2('0x37')]=_[_0xd1d2('0x38')](_0x21eb24['model'],_0x21eb24[_0xd1d2('0x35')]);_0x5a3790[_0xd1d2('0x39')]=_['intersection'](_0x21eb24[_0xd1d2('0x32')],qs['fields'](_0x2fe92a[_0xd1d2('0x35')][_0xd1d2('0x3a')]));_0x5a3790[_0xd1d2('0x39')]=_0x5a3790[_0xd1d2('0x39')][_0xd1d2('0x3b')]?_0x5a3790['attributes']:_0x21eb24['model'];if(_0x2fe92a[_0xd1d2('0x35')][_0xd1d2('0x44')]){_0x5a3790['include']=[{'all':!![]}];}_0x5a3790=_[_0xd1d2('0x3f')]({},_0x5a3790,_0x2fe92a[_0xd1d2('0x41')]);return db[_0xd1d2('0x2e')][_0xd1d2('0x45')](_0x5a3790)[_0xd1d2('0x28')](handleEntityNotFound(_0x4c5d49,null))[_0xd1d2('0x28')](respondWithResult(_0x4c5d49,null))[_0xd1d2('0x43')](handleError(_0x4c5d49,null));};exports['create']=function(_0xed9e9,_0xc10c10){return db['ZendeskAccount'][_0xd1d2('0x46')](_0xed9e9[_0xd1d2('0x47')],{})['then'](respondWithResult(_0xc10c10,0xc9))['catch'](handleError(_0xc10c10,null));};exports[_0xd1d2('0x27')]=function(_0x182ea8,_0x4cb376){if(_0x182ea8[_0xd1d2('0x47')]['id']){delete _0x182ea8[_0xd1d2('0x47')]['id'];}return db[_0xd1d2('0x2e')][_0xd1d2('0x45')]({'where':{'id':_0x182ea8[_0xd1d2('0x48')]['id']}})['then'](handleEntityNotFound(_0x4cb376,null))['then'](saveUpdates(_0x182ea8[_0xd1d2('0x47')],null))['then'](respondWithResult(_0x4cb376,null))[_0xd1d2('0x43')](handleError(_0x4cb376,null));};exports[_0xd1d2('0x29')]=function(_0x4f4cb9,_0x389fcb){return db[_0xd1d2('0x2e')]['find']({'where':{'id':_0x4f4cb9['params']['id']}})[_0xd1d2('0x28')](handleEntityNotFound(_0x389fcb,null))[_0xd1d2('0x28')](removeEntity(_0x389fcb,null))[_0xd1d2('0x43')](handleError(_0x389fcb,null));};exports[_0xd1d2('0x49')]=function(_0xa013ce,_0x34a793,_0x1f6150){var _0x3411c8={};var _0x33e332={};var _0x5e15cb;var _0x1958f3;return db['ZendeskAccount']['findOne']({'where':{'id':_0xa013ce[_0xd1d2('0x48')]['id']}})[_0xd1d2('0x28')](handleEntityNotFound(_0x34a793,null))[_0xd1d2('0x28')](function(_0x47417f){if(_0x47417f){_0x5e15cb=_0x47417f;_0x33e332[_0xd1d2('0x32')]=_[_0xd1d2('0x36')](db[_0xd1d2('0x4a')][_0xd1d2('0x2f')]);_0x33e332[_0xd1d2('0x35')]=_[_0xd1d2('0x36')](_0xa013ce[_0xd1d2('0x35')]);_0x33e332[_0xd1d2('0x37')]=_[_0xd1d2('0x38')](_0x33e332['model'],_0x33e332['query']);_0x3411c8[_0xd1d2('0x39')]=_[_0xd1d2('0x38')](_0x33e332[_0xd1d2('0x32')],qs[_0xd1d2('0x3a')](_0xa013ce[_0xd1d2('0x35')][_0xd1d2('0x3a')]));_0x3411c8[_0xd1d2('0x39')]=_0x3411c8[_0xd1d2('0x39')][_0xd1d2('0x3b')]?_0x3411c8[_0xd1d2('0x39')]:_0x33e332[_0xd1d2('0x32')];_0x3411c8['order']=qs['sort'](_0xa013ce[_0xd1d2('0x35')][_0xd1d2('0x3d')]);_0x3411c8[_0xd1d2('0x3e')]=qs[_0xd1d2('0x37')](_['pick'](_0xa013ce[_0xd1d2('0x35')],_0x33e332[_0xd1d2('0x37')]));if(_0xa013ce[_0xd1d2('0x35')][_0xd1d2('0x40')]){_0x3411c8[_0xd1d2('0x3e')]=_[_0xd1d2('0x3f')](_0x3411c8[_0xd1d2('0x3e')],{'$or':_['map'](_0x3411c8[_0xd1d2('0x39')],function(_0x24d92c){var _0x1d8788={};_0x1d8788[_0x24d92c]={'$like':'%'+_0xa013ce['query']['filter']+'%'};return _0x1d8788;})});}_0x3411c8=_[_0xd1d2('0x3f')]({},_0x3411c8,_0xa013ce[_0xd1d2('0x41')]);return _0x5e15cb[_0xd1d2('0x49')](_0x3411c8);}})[_0xd1d2('0x28')](function(_0x598e6c){if(_0x598e6c){_0x1958f3=_0x598e6c[_0xd1d2('0x3b')];if(!_0xa013ce[_0xd1d2('0x35')][_0xd1d2('0x4b')]('nolimit')){_0x3411c8[_0xd1d2('0x21')]=qs[_0xd1d2('0x21')](_0xa013ce['query'][_0xd1d2('0x21')]);_0x3411c8[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0xa013ce[_0xd1d2('0x35')]['offset']);}return _0x5e15cb[_0xd1d2('0x49')](_0x3411c8);}})[_0xd1d2('0x28')](function(_0xd82d10){if(_0xd82d10){return _0xd82d10?{'count':_0x1958f3,'rows':_0xd82d10}:null;}})[_0xd1d2('0x28')](respondWithResult(_0x34a793,null))[_0xd1d2('0x43')](handleError(_0x34a793,null));};exports['addConfiguration']=function(_0x47aa13,_0x500465,_0x541676){if(_0x47aa13['body']['id']){delete _0x47aa13[_0xd1d2('0x47')]['id'];}return db[_0xd1d2('0x2e')][_0xd1d2('0x4c')]({'where':{'id':_0x47aa13['params']['id']}})[_0xd1d2('0x28')](handleEntityNotFound(_0x500465,null))[_0xd1d2('0x28')](function(_0x22d617){if(_0x22d617){_0x47aa13['body'][_0xd1d2('0x4d')]=_0x22d617['id'];_0x47aa13[_0xd1d2('0x47')][_0xd1d2('0x4e')]=integrations[_0xd1d2('0x4f')](_0x47aa13[_0xd1d2('0x47')][_0xd1d2('0x50')],_0x47aa13['body'][_0xd1d2('0x30')]);_0x47aa13[_0xd1d2('0x47')]['Descriptions']=integrations['getDescriptions'](_0x47aa13[_0xd1d2('0x47')][_0xd1d2('0x50')],_0x47aa13[_0xd1d2('0x47')][_0xd1d2('0x30')]);return db['ZendeskConfiguration'][_0xd1d2('0x46')](_0x47aa13[_0xd1d2('0x47')],{'include':[{'model':db[_0xd1d2('0x51')],'as':_0xd1d2('0x4e')},{'model':db['ZendeskField'],'as':_0xd1d2('0x52')}]});}return null;})[_0xd1d2('0x28')](respondWithResult(_0x500465,null))[_0xd1d2('0x43')](handleError(_0x500465,null));};exports['getFields']=function(_0x46ff4d,_0x1ae9af,_0x4c35cb){var _0x2175ab='';return db[_0xd1d2('0x2e')][_0xd1d2('0x4c')]({'where':{'id':_0x46ff4d[_0xd1d2('0x48')]['id']},'attributes':['id',_0xd1d2('0x53'),'password',_0xd1d2('0x54'),'authType','remoteUri']})['then'](handleEntityNotFound(_0x1ae9af,null))['then'](function(_0x89ec63){if(_0x89ec63){_0x2175ab=_0x89ec63['remoteUri'];var _0x37591f=_0x2175ab['slice'](-0x1);if(_0x37591f==='/'){_0x2175ab=_0x2175ab[_0xd1d2('0x55')](0x0,_0x2175ab[_0xd1d2('0x56')](_0x37591f));}var _0x16cc6c={'method':_0xd1d2('0x57'),'uri':util[_0xd1d2('0x58')](_0xd1d2('0x59'),_0x2175ab,'ticket_fields'),'json':!![]};switch(_0x89ec63[_0xd1d2('0x5a')]){case _0xd1d2('0x5b'):_0x16cc6c[_0xd1d2('0x5c')]={'Authorization':util[_0xd1d2('0x58')](_0xd1d2('0x5d'),new Buffer(util[_0xd1d2('0x58')](_0xd1d2('0x5e'),_0x89ec63[_0xd1d2('0x53')],_0x89ec63[_0xd1d2('0x5b')]))[_0xd1d2('0x5f')]('base64'))};break;case _0xd1d2('0x54'):_0x16cc6c[_0xd1d2('0x5c')]={'Authorization':util[_0xd1d2('0x58')](_0xd1d2('0x5d'),new Buffer(util['format'](_0xd1d2('0x60'),_0x89ec63[_0xd1d2('0x53')],_0x89ec63[_0xd1d2('0x54')]))['toString'](_0xd1d2('0x61')))};break;default:throw new db[(_0xd1d2('0x62'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x16cc6c);}})[_0xd1d2('0x28')](function(_0x268d6d){if(_0x268d6d){var _0x3fbd87=[_0xd1d2('0x63'),_0xd1d2('0x64'),_0xd1d2('0x65'),_0xd1d2('0x66')];_['remove'](_0x268d6d[_0xd1d2('0x67')],function(_0x9a98d4){return _0x3fbd87[_0xd1d2('0x68')](_0x9a98d4[_0xd1d2('0x30')]);});return{'count':_0x268d6d[_0xd1d2('0x67')][_0xd1d2('0x3b')],'rows':_[_0xd1d2('0x33')](_0x268d6d[_0xd1d2('0x67')],function(_0x44409e){return{'id':_0x44409e['id'],'name':_0x44409e[_0xd1d2('0x69')]>0x7?_0x44409e[_0xd1d2('0x6a')]:_0x44409e[_0xd1d2('0x30')],'custom':_0x44409e[_0xd1d2('0x69')]>0x7?!![]:![],'options':_0x44409e[_0xd1d2('0x6b')]?_0x44409e['system_field_options']:_0x44409e[_0xd1d2('0x6c')]?_0x44409e[_0xd1d2('0x6c')]:[]};})};}})[_0xd1d2('0x28')](respondWithResult(_0x1ae9af,null))[_0xd1d2('0x43')](function(_0x20a3f0){var _0x32c294=_0x46ff4d[_0xd1d2('0x35')][_0xd1d2('0x6d')]?0x1f4:_0x20a3f0[_0xd1d2('0x6e')]||0x1f4;logger[_0xd1d2('0x2a')](_0xd1d2('0x6f'),_0xd1d2('0x70'),_0x32c294,JSON[_0xd1d2('0x71')](_0x20a3f0));delete _0x20a3f0['name'];if(_0x32c294===0x191){_0x32c294=0x190;}_0x1ae9af[_0xd1d2('0x1d')](_0x32c294)[_0xd1d2('0x2c')](_0x46ff4d[_0xd1d2('0x35')][_0xd1d2('0x6d')]?{'message':_0xd1d2('0x72'),'statusCode':_0x20a3f0[_0xd1d2('0x6e')]}:_0x20a3f0);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 85192b7..05d2932 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 _0xc7b4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash'];(function(_0x2d3fdf,_0x1a10a2){var _0x4af931=function(_0x574094){while(--_0x574094){_0x2d3fdf['push'](_0x2d3fdf['shift']());}};_0x4af931(++_0x1a10a2);}(_0xc7b4,0x9b));var _0x4c7b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc7b4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4c7b('0x0'));var util=require(_0x4c7b('0x1'));var logger=require(_0x4c7b('0x2'))(_0x4c7b('0x3'));var moment=require(_0x4c7b('0x4'));var BPromise=require(_0x4c7b('0x5'));var rp=require(_0x4c7b('0x6'));var fs=require('fs');var path=require(_0x4c7b('0x7'));var rimraf=require(_0x4c7b('0x8'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x4c7b('0x9'));module[_0x4c7b('0xa')]=function(_0x185a15,_0x4807ad){return _0x185a15['define'](_0x4c7b('0xb'),attributes,{'tableName':_0x4c7b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e0a=['define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports'];(function(_0x21add9,_0x323ca9){var _0x16d218=function(_0x5e59eb){while(--_0x5e59eb){_0x21add9['push'](_0x21add9['shift']());}};_0x16d218(++_0x323ca9);}(_0x0e0a,0xff));var _0xa0e0=function(_0x5ca5b0,_0x8a4bee){_0x5ca5b0=_0x5ca5b0-0x0;var _0x3abdc0=_0x0e0a[_0x5ca5b0];return _0x3abdc0;};'use strict';var _=require(_0xa0e0('0x0'));var util=require('util');var logger=require(_0xa0e0('0x1'))(_0xa0e0('0x2'));var moment=require(_0xa0e0('0x3'));var BPromise=require(_0xa0e0('0x4'));var rp=require(_0xa0e0('0x5'));var fs=require('fs');var path=require(_0xa0e0('0x6'));var rimraf=require(_0xa0e0('0x7'));var config=require(_0xa0e0('0x8'));var attributes=require(_0xa0e0('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xa0e0('0xa')]=function(_0x5b1a6a,_0x2b4c98){return _0x5b1a6a[_0xa0e0('0xb')](_0xa0e0('0xc'),attributes,{'tableName':_0xa0e0('0xd'),'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 a787340..08cf113 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 _0x36b2=['raw','ShowZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ZendeskAccount','options','where','attributes','limit','include','model','map','info','GetZendeskAccount','find'];(function(_0x32f42c,_0x5e37ee){var _0x3e9962=function(_0x45c603){while(--_0x45c603){_0x32f42c['push'](_0x32f42c['shift']());}};_0x3e9962(++_0x5e37ee);}(_0x36b2,0x6b));var _0x236b=function(_0x570bf5,_0x19d1b6){_0x570bf5=_0x570bf5-0x0;var _0x1c16b4=_0x36b2[_0x570bf5];return _0x1c16b4;};'use strict';var _=require(_0x236b('0x0'));var util=require(_0x236b('0x1'));var moment=require(_0x236b('0x2'));var BPromise=require('bluebird');var rs=require(_0x236b('0x3'));var fs=require('fs');var Redis=require(_0x236b('0x4'));var db=require(_0x236b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x236b('0x6'))(_0x236b('0x7'));var config=require('../../config/environment');var jayson=require(_0x236b('0x8'));var client=jayson[_0x236b('0x9')][_0x236b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9e1345,_0x40b9ab,_0x2ff02e){return new BPromise(function(_0x52b043,_0x21ad4e){return client[_0x236b('0xb')](_0x9e1345,_0x2ff02e)[_0x236b('0xc')](function(_0x318581){logger['info'](_0x236b('0xd'),_0x40b9ab,_0x236b('0xe'));logger[_0x236b('0xf')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x40b9ab,_0x236b('0xe'),JSON[_0x236b('0x10')](_0x318581));if(_0x318581[_0x236b('0x11')]){if(_0x318581['error'][_0x236b('0x12')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x40b9ab,_0x318581[_0x236b('0x11')]['message']);return _0x21ad4e(_0x318581[_0x236b('0x11')][_0x236b('0x13')]);}logger[_0x236b('0x11')](_0x236b('0xd'),_0x40b9ab,_0x318581[_0x236b('0x11')][_0x236b('0x13')]);return _0x52b043(_0x318581[_0x236b('0x11')]['message']);}else{logger['info'](_0x236b('0xd'),_0x40b9ab,_0x236b('0xe'));_0x52b043(_0x318581[_0x236b('0x14')][_0x236b('0x13')]);}})[_0x236b('0x15')](function(_0x4f0152){logger['error'](_0x236b('0xd'),_0x40b9ab,_0x4f0152);_0x21ad4e(_0x4f0152);});});}exports['GetZendeskAccount']=function(_0x18878f){var _0x183191=this;return new Promise(function(_0x5a6c07,_0x4d5f86){return db[_0x236b('0x16')]['findAll']({'raw':_0x18878f[_0x236b('0x17')]?_0x18878f['options']['raw']===undefined?!![]:![]:!![],'where':_0x18878f[_0x236b('0x17')]?_0x18878f[_0x236b('0x17')][_0x236b('0x18')]||null:null,'attributes':_0x18878f[_0x236b('0x17')]?_0x18878f[_0x236b('0x17')][_0x236b('0x19')]||null:null,'limit':_0x18878f[_0x236b('0x17')]?_0x18878f[_0x236b('0x17')][_0x236b('0x1a')]||null:null,'include':_0x18878f[_0x236b('0x17')]?_0x18878f[_0x236b('0x17')][_0x236b('0x1b')]?_['map'](_0x18878f[_0x236b('0x17')][_0x236b('0x1b')],function(_0x5711a9){return{'model':db[_0x5711a9[_0x236b('0x1c')]],'as':_0x5711a9['as'],'attributes':_0x5711a9[_0x236b('0x19')],'include':_0x5711a9[_0x236b('0x1b')]?_['map'](_0x5711a9[_0x236b('0x1b')],function(_0x1617f8){return{'model':db[_0x1617f8[_0x236b('0x1c')]],'as':_0x1617f8['as'],'attributes':_0x1617f8[_0x236b('0x19')],'include':_0x1617f8[_0x236b('0x1b')]?_[_0x236b('0x1d')](_0x1617f8[_0x236b('0x1b')],function(_0x4d319e){return{'model':db[_0x4d319e[_0x236b('0x1c')]],'as':_0x4d319e['as'],'attributes':_0x4d319e[_0x236b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x236b('0xc')](function(_0x462eea){logger[_0x236b('0x1e')](_0x236b('0x1f'),_0x18878f);logger[_0x236b('0xf')](_0x236b('0x1f'),_0x18878f,JSON[_0x236b('0x10')](_0x462eea));_0x5a6c07(_0x462eea);})[_0x236b('0x15')](function(_0x15a520){logger[_0x236b('0x11')](_0x236b('0x1f'),_0x15a520[_0x236b('0x13')],_0x18878f);_0x4d5f86(_0x183191[_0x236b('0x11')](0x1f4,_0x15a520[_0x236b('0x13')]));});});};exports['ShowZendeskAccount']=function(_0x1795cc){var _0x24abb8=this;return new Promise(function(_0x3d18b7,_0x5581fd){return db[_0x236b('0x16')][_0x236b('0x20')]({'raw':_0x1795cc[_0x236b('0x17')]?_0x1795cc[_0x236b('0x17')][_0x236b('0x21')]===undefined?!![]:![]:!![],'where':_0x1795cc[_0x236b('0x17')]?_0x1795cc[_0x236b('0x17')][_0x236b('0x18')]||null:null,'attributes':_0x1795cc[_0x236b('0x17')]?_0x1795cc[_0x236b('0x17')][_0x236b('0x19')]||null:null,'include':_0x1795cc[_0x236b('0x17')]?_0x1795cc[_0x236b('0x17')][_0x236b('0x1b')]?_[_0x236b('0x1d')](_0x1795cc['options'][_0x236b('0x1b')],function(_0x547acf){return{'model':db[_0x547acf['model']],'as':_0x547acf['as'],'attributes':_0x547acf[_0x236b('0x19')],'include':_0x547acf[_0x236b('0x1b')]?_[_0x236b('0x1d')](_0x547acf[_0x236b('0x1b')],function(_0x6fb705){return{'model':db[_0x6fb705[_0x236b('0x1c')]],'as':_0x6fb705['as'],'attributes':_0x6fb705['attributes'],'include':_0x6fb705[_0x236b('0x1b')]?_['map'](_0x6fb705['include'],function(_0x32558a){return{'model':db[_0x32558a[_0x236b('0x1c')]],'as':_0x32558a['as'],'attributes':_0x32558a[_0x236b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x236b('0xc')](function(_0x2a019c){logger['info'](_0x236b('0x22'),_0x1795cc);logger[_0x236b('0xf')](_0x236b('0x22'),_0x1795cc,JSON[_0x236b('0x10')](_0x2a019c));_0x3d18b7(_0x2a019c);})[_0x236b('0x15')](function(_0x34ee17){logger[_0x236b('0x11')](_0x236b('0x22'),_0x34ee17[_0x236b('0x13')],_0x1795cc);_0x5581fd(_0x24abb8[_0x236b('0x11')](0x1f4,_0x34ee17[_0x236b('0x13')]));});});}; \ No newline at end of file +var _0x79e9=['findAll','raw','options','where','attributes','limit','include','map','model','GetZendeskAccount','find','ShowZendeskAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ZendeskAccount'];(function(_0x4f5327,_0x3f9e5d){var _0x37a5c7=function(_0x81bb58){while(--_0x81bb58){_0x4f5327['push'](_0x4f5327['shift']());}};_0x37a5c7(++_0x3f9e5d);}(_0x79e9,0x116));var _0x979e=function(_0x8905c0,_0x416579){_0x8905c0=_0x8905c0-0x0;var _0x8c8e64=_0x79e9[_0x8905c0];return _0x8c8e64;};'use strict';var _=require('lodash');var util=require(_0x979e('0x0'));var moment=require(_0x979e('0x1'));var BPromise=require(_0x979e('0x2'));var rs=require(_0x979e('0x3'));var fs=require('fs');var Redis=require(_0x979e('0x4'));var db=require(_0x979e('0x5'))['db'];var utils=require(_0x979e('0x6'));var logger=require(_0x979e('0x7'))(_0x979e('0x8'));var config=require(_0x979e('0x9'));var jayson=require(_0x979e('0xa'));var client=jayson[_0x979e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f83f8,_0x57d9d1,_0x3d85b3){return new BPromise(function(_0x3021b7,_0x4a2edc){return client[_0x979e('0xc')](_0x1f83f8,_0x3d85b3)[_0x979e('0xd')](function(_0x1e4c1e){logger[_0x979e('0xe')](_0x979e('0xf'),_0x57d9d1,_0x979e('0x10'));logger[_0x979e('0x11')](_0x979e('0x12'),_0x57d9d1,_0x979e('0x10'),JSON[_0x979e('0x13')](_0x1e4c1e));if(_0x1e4c1e[_0x979e('0x14')]){if(_0x1e4c1e[_0x979e('0x14')][_0x979e('0x15')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x57d9d1,_0x1e4c1e['error'][_0x979e('0x16')]);return _0x4a2edc(_0x1e4c1e['error']['message']);}logger['error'](_0x979e('0xf'),_0x57d9d1,_0x1e4c1e[_0x979e('0x14')][_0x979e('0x16')]);return _0x3021b7(_0x1e4c1e[_0x979e('0x14')][_0x979e('0x16')]);}else{logger[_0x979e('0xe')](_0x979e('0xf'),_0x57d9d1,_0x979e('0x10'));_0x3021b7(_0x1e4c1e[_0x979e('0x17')]['message']);}})[_0x979e('0x18')](function(_0x53b63e){logger[_0x979e('0x14')](_0x979e('0xf'),_0x57d9d1,_0x53b63e);_0x4a2edc(_0x53b63e);});});}exports['GetZendeskAccount']=function(_0x5d584a){var _0x2bce35=this;return new Promise(function(_0x1cddd0,_0x59afae){return db[_0x979e('0x19')][_0x979e('0x1a')]({'raw':_0x5d584a['options']?_0x5d584a['options'][_0x979e('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d584a['options']?_0x5d584a[_0x979e('0x1c')][_0x979e('0x1d')]||null:null,'attributes':_0x5d584a[_0x979e('0x1c')]?_0x5d584a['options'][_0x979e('0x1e')]||null:null,'limit':_0x5d584a[_0x979e('0x1c')]?_0x5d584a['options'][_0x979e('0x1f')]||null:null,'include':_0x5d584a[_0x979e('0x1c')]?_0x5d584a[_0x979e('0x1c')][_0x979e('0x20')]?_[_0x979e('0x21')](_0x5d584a['options'][_0x979e('0x20')],function(_0x1b2961){return{'model':db[_0x1b2961[_0x979e('0x22')]],'as':_0x1b2961['as'],'attributes':_0x1b2961[_0x979e('0x1e')],'include':_0x1b2961['include']?_[_0x979e('0x21')](_0x1b2961[_0x979e('0x20')],function(_0x1c49dd){return{'model':db[_0x1c49dd[_0x979e('0x22')]],'as':_0x1c49dd['as'],'attributes':_0x1c49dd[_0x979e('0x1e')],'include':_0x1c49dd[_0x979e('0x20')]?_['map'](_0x1c49dd['include'],function(_0x36d64a){return{'model':db[_0x36d64a['model']],'as':_0x36d64a['as'],'attributes':_0x36d64a[_0x979e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c1a93){logger[_0x979e('0xe')](_0x979e('0x23'),_0x5d584a);logger[_0x979e('0x11')](_0x979e('0x23'),_0x5d584a,JSON[_0x979e('0x13')](_0x3c1a93));_0x1cddd0(_0x3c1a93);})['catch'](function(_0x47ab42){logger[_0x979e('0x14')](_0x979e('0x23'),_0x47ab42[_0x979e('0x16')],_0x5d584a);_0x59afae(_0x2bce35[_0x979e('0x14')](0x1f4,_0x47ab42[_0x979e('0x16')]));});});};exports['ShowZendeskAccount']=function(_0x2178aa){var _0x52b5e7=this;return new Promise(function(_0x42a5f4,_0x56967d){return db[_0x979e('0x19')][_0x979e('0x24')]({'raw':_0x2178aa['options']?_0x2178aa['options'][_0x979e('0x1b')]===undefined?!![]:![]:!![],'where':_0x2178aa[_0x979e('0x1c')]?_0x2178aa[_0x979e('0x1c')][_0x979e('0x1d')]||null:null,'attributes':_0x2178aa[_0x979e('0x1c')]?_0x2178aa[_0x979e('0x1c')]['attributes']||null:null,'include':_0x2178aa['options']?_0x2178aa['options'][_0x979e('0x20')]?_[_0x979e('0x21')](_0x2178aa[_0x979e('0x1c')]['include'],function(_0x21d052){return{'model':db[_0x21d052[_0x979e('0x22')]],'as':_0x21d052['as'],'attributes':_0x21d052[_0x979e('0x1e')],'include':_0x21d052['include']?_[_0x979e('0x21')](_0x21d052[_0x979e('0x20')],function(_0x53408c){return{'model':db[_0x53408c['model']],'as':_0x53408c['as'],'attributes':_0x53408c['attributes'],'include':_0x53408c[_0x979e('0x20')]?_[_0x979e('0x21')](_0x53408c[_0x979e('0x20')],function(_0x2362c3){return{'model':db[_0x2362c3[_0x979e('0x22')]],'as':_0x2362c3['as'],'attributes':_0x2362c3['attributes']};}):[]};}):[]};}):[]:[]})[_0x979e('0xd')](function(_0x794be8){logger['info'](_0x979e('0x25'),_0x2178aa);logger[_0x979e('0x11')](_0x979e('0x25'),_0x2178aa,JSON[_0x979e('0x13')](_0x794be8));_0x42a5f4(_0x794be8);})['catch'](function(_0x32b271){logger['error']('ShowZendeskAccount',_0x32b271[_0x979e('0x16')],_0x2178aa);_0x56967d(_0x52b5e7['error'](0x1f4,_0x32b271[_0x979e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 1dba035..80b6c45 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 _0xcb91=['get','index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','create','post','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller'];(function(_0x173fd1,_0x28db53){var _0x36a3d1=function(_0x2f72a4){while(--_0x2f72a4){_0x173fd1['push'](_0x173fd1['shift']());}};_0x36a3d1(++_0x28db53);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0xcb91[_0x2bcb75];return _0x175345;};'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');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/:id',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x1cb9('0x7')](_0x1cb9('0xc'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0x7')]('/:id/descriptions',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0x7')](_0x1cb9('0xf'),auth[_0x1cb9('0x9')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x1cb9('0x10')]);router[_0x1cb9('0x11')](_0x1cb9('0xf'),auth[_0x1cb9('0x9')](),controller['setTags']);router[_0x1cb9('0x12')](_0x1cb9('0x13'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);router[_0x1cb9('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1cb9('0x16')]);module[_0x1cb9('0x17')]=router; \ No newline at end of file +var _0xa571=['util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','exports','multer'];(function(_0x5180d6,_0xe9b506){var _0x246f53=function(_0x48971f){while(--_0x48971f){_0x5180d6['push'](_0x5180d6['shift']());}};_0x246f53(++_0xe9b506);}(_0xa571,0x107));var _0x1a57=function(_0x21deb8,_0x181963){_0x21deb8=_0x21deb8-0x0;var _0x38a49c=_0xa571[_0x21deb8];return _0x38a49c;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getFields']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['get']('/:id/tags',auth[_0x1a57('0x8')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),controller['setTags']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x14')]);router['delete'](_0x1a57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a57('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index b3d8396..7470bac 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 _0x4a0f=['sequelize','exports'];(function(_0x109ffe,_0xb188b0){var _0x105667=function(_0x1a5e8d){while(--_0x1a5e8d){_0x109ffe['push'](_0x109ffe['shift']());}};_0x105667(++_0xb188b0);}(_0x4a0f,0x190));var _0xf4a0=function(_0x59e096,_0x5f2c7b){_0x59e096=_0x59e096-0x0;var _0x2fab13=_0x4a0f[_0x59e096];return _0x2fab13;};'use strict';var Sequelize=require(_0xf4a0('0x0'));module[_0xf4a0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2da5=['STRING','exports'];(function(_0x8c498e,_0x21989f){var _0x5d38ee=function(_0x1f915b){while(--_0x1f915b){_0x8c498e['push'](_0x8c498e['shift']());}};_0x5d38ee(++_0x21989f);}(_0x2da5,0x1c1));var _0x52da=function(_0x530524,_0x1a1eda){_0x530524=_0x530524-0x0;var _0x30f96f=_0x2da5[_0x530524];return _0x30f96f;};'use strict';var Sequelize=require('sequelize');module[_0x52da('0x0')]={'name':{'type':Sequelize[_0x52da('0x1')]},'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 5d39490..a19d74d 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 _0x87dd=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','name','send','map','ZendeskConfiguration','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','update','destroy','getFields','findOne','rawAttributes','getSubjects','ZendeskField','filter','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x2c1423,_0x3443d8){var _0x1df56e=function(_0x3b118c){while(--_0x3b118c){_0x2c1423['push'](_0x2c1423['shift']());}};_0x1df56e(++_0x3443d8);}(_0x87dd,0x136));var _0xd87d=function(_0x152fe3,_0x12b0c8){_0x152fe3=_0x152fe3-0x0;var _0xc5bb39=_0x87dd[_0x152fe3];return _0xc5bb39;};'use strict';var emlformat=require(_0xd87d('0x0'));var rimraf=require(_0xd87d('0x1'));var zipdir=require(_0xd87d('0x2'));var jsonpatch=require(_0xd87d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd87d('0x4'));var path=require(_0xd87d('0x5'));var sox=require(_0xd87d('0x6'));var csv=require(_0xd87d('0x7'));var ejs=require(_0xd87d('0x8'));var fs=require('fs');var fs_extra=require(_0xd87d('0x9'));var _=require(_0xd87d('0xa'));var squel=require(_0xd87d('0xb'));var crypto=require(_0xd87d('0xc'));var jsforce=require(_0xd87d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd87d('0x7'));var querystring=require(_0xd87d('0xe'));var Papa=require(_0xd87d('0xf'));var Redis=require('ioredis');var authService=require(_0xd87d('0x10'));var qs=require(_0xd87d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd87d('0x12'))(_0xd87d('0x13'));var utils=require(_0xd87d('0x14'));var config=require(_0xd87d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd87d('0x16'))['db'];function respondWithStatusCode(_0x363dbd,_0x232a1d){_0x232a1d=_0x232a1d||0xcc;return function(_0x130953){if(_0x130953){return _0x363dbd[_0xd87d('0x17')](_0x232a1d);}return _0x363dbd[_0xd87d('0x18')](_0x232a1d)[_0xd87d('0x19')]();};}function respondWithResult(_0x391d84,_0x32cc4b){_0x32cc4b=_0x32cc4b||0xc8;return function(_0x4cc7b3){if(_0x4cc7b3){return _0x391d84[_0xd87d('0x18')](_0x32cc4b)[_0xd87d('0x1a')](_0x4cc7b3);}};}function respondWithFilteredResult(_0x14025c,_0x39a2a8){return function(_0x4e6676){if(_0x4e6676){var _0x6c3caa=typeof _0x39a2a8['offset']===_0xd87d('0x1b')&&typeof _0x39a2a8[_0xd87d('0x1c')]==='undefined';var _0x2f630f=_0x4e6676[_0xd87d('0x1d')];var _0x3f1734=_0x6c3caa?0x0:_0x39a2a8[_0xd87d('0x1e')];var _0x36e5e3=_0x6c3caa?_0x4e6676[_0xd87d('0x1d')]:_0x39a2a8['offset']+_0x39a2a8[_0xd87d('0x1c')];var _0x290b01;if(_0x36e5e3>=_0x2f630f){_0x36e5e3=_0x2f630f;_0x290b01=0xc8;}else{_0x290b01=0xce;}_0x14025c[_0xd87d('0x18')](_0x290b01);return _0x14025c[_0xd87d('0x1f')]('Content-Range',_0x3f1734+'-'+_0x36e5e3+'/'+_0x2f630f)[_0xd87d('0x1a')](_0x4e6676);}return null;};}function patchUpdates(_0x481599){return function(_0xb21cb){try{jsonpatch[_0xd87d('0x20')](_0xb21cb,_0x481599,!![]);}catch(_0x1803ce){return BPromise[_0xd87d('0x21')](_0x1803ce);}return _0xb21cb[_0xd87d('0x22')]();};}function saveUpdates(_0x510d31,_0x5ca94b){return function(_0x24f4af){if(_0x24f4af){return _0x24f4af['update'](_0x510d31)[_0xd87d('0x23')](function(_0x32a8e3){return _0x32a8e3;});}return null;};}function removeEntity(_0x10a441,_0x553e76){return function(_0x2bb6b8){if(_0x2bb6b8){return _0x2bb6b8['destroy']()['then'](function(){_0x10a441[_0xd87d('0x18')](0xcc)[_0xd87d('0x19')]();});}};}function handleEntityNotFound(_0x565d0d,_0x41c1ee){return function(_0x1e0e0a){if(!_0x1e0e0a){_0x565d0d['sendStatus'](0x194);}return _0x1e0e0a;};}function handleError(_0x2138b9,_0x18791f){_0x18791f=_0x18791f||0x1f4;return function(_0x5e4a5d){logger['error'](_0x5e4a5d['stack']);if(_0x5e4a5d[_0xd87d('0x24')]){delete _0x5e4a5d[_0xd87d('0x24')];}_0x2138b9[_0xd87d('0x18')](_0x18791f)[_0xd87d('0x25')](_0x5e4a5d);};}exports['index']=function(_0x32a811,_0x3a2a32){var _0x504eb7={},_0x40667b={},_0x4e5dcf={'count':0x0,'rows':[]};var _0x2cf09b=_[_0xd87d('0x26')](db[_0xd87d('0x27')]['rawAttributes'],function(_0x55610f){return{'name':_0x55610f[_0xd87d('0x28')],'type':_0x55610f[_0xd87d('0x29')][_0xd87d('0x2a')]};});_0x40667b['model']=_[_0xd87d('0x26')](_0x2cf09b,'name');_0x40667b[_0xd87d('0x2b')]=_['keys'](_0x32a811['query']);_0x40667b[_0xd87d('0x2c')]=_['intersection'](_0x40667b['model'],_0x40667b['query']);_0x504eb7[_0xd87d('0x2d')]=_[_0xd87d('0x2e')](_0x40667b[_0xd87d('0x2f')],qs[_0xd87d('0x30')](_0x32a811[_0xd87d('0x2b')][_0xd87d('0x30')]));_0x504eb7[_0xd87d('0x2d')]=_0x504eb7['attributes'][_0xd87d('0x31')]?_0x504eb7[_0xd87d('0x2d')]:_0x40667b['model'];if(!_0x32a811[_0xd87d('0x2b')][_0xd87d('0x32')](_0xd87d('0x33'))){_0x504eb7[_0xd87d('0x1c')]=qs[_0xd87d('0x1c')](_0x32a811[_0xd87d('0x2b')][_0xd87d('0x1c')]);_0x504eb7[_0xd87d('0x1e')]=qs['offset'](_0x32a811[_0xd87d('0x2b')]['offset']);}_0x504eb7[_0xd87d('0x34')]=qs[_0xd87d('0x35')](_0x32a811['query'][_0xd87d('0x35')]);_0x504eb7[_0xd87d('0x36')]=qs[_0xd87d('0x2c')](_[_0xd87d('0x37')](_0x32a811[_0xd87d('0x2b')],_0x40667b[_0xd87d('0x2c')]),_0x2cf09b);if(_0x32a811['query']['filter']){_0x504eb7[_0xd87d('0x36')]=_[_0xd87d('0x38')](_0x504eb7[_0xd87d('0x36')],{'$or':_[_0xd87d('0x26')](_0x2cf09b,function(_0x5239de){if(_0x5239de[_0xd87d('0x29')]!=='VIRTUAL'){var _0x55e2f6={};_0x55e2f6[_0x5239de[_0xd87d('0x24')]]={'$like':'%'+_0x32a811[_0xd87d('0x2b')]['filter']+'%'};return _0x55e2f6;}})});}_0x504eb7=_[_0xd87d('0x38')]({},_0x504eb7,_0x32a811[_0xd87d('0x39')]);var _0x2810c5={'where':_0x504eb7[_0xd87d('0x36')]};return db[_0xd87d('0x27')][_0xd87d('0x1d')](_0x2810c5)[_0xd87d('0x23')](function(_0x3e3ad2){_0x4e5dcf[_0xd87d('0x1d')]=_0x3e3ad2;if(_0x32a811[_0xd87d('0x2b')][_0xd87d('0x3a')]){_0x504eb7[_0xd87d('0x3b')]=[{'all':!![]}];}return db[_0xd87d('0x27')][_0xd87d('0x3c')](_0x504eb7);})[_0xd87d('0x23')](function(_0x44f3a6){_0x4e5dcf[_0xd87d('0x3d')]=_0x44f3a6;return _0x4e5dcf;})[_0xd87d('0x23')](respondWithFilteredResult(_0x3a2a32,_0x504eb7))['catch'](handleError(_0x3a2a32,null));};exports[_0xd87d('0x3e')]=function(_0x473c05,_0x144dd6){var _0x1c7f9a={'raw':![],'where':{'id':_0x473c05[_0xd87d('0x3f')]['id']}},_0x2bb9a3={};_0x2bb9a3['model']=_[_0xd87d('0x40')](db[_0xd87d('0x27')]['rawAttributes']);_0x2bb9a3['query']=_[_0xd87d('0x40')](_0x473c05[_0xd87d('0x2b')]);_0x2bb9a3[_0xd87d('0x2c')]=_[_0xd87d('0x2e')](_0x2bb9a3[_0xd87d('0x2f')],_0x2bb9a3[_0xd87d('0x2b')]);_0x1c7f9a[_0xd87d('0x2d')]=_[_0xd87d('0x2e')](_0x2bb9a3['model'],qs[_0xd87d('0x30')](_0x473c05[_0xd87d('0x2b')]['fields']));_0x1c7f9a['attributes']=_0x1c7f9a[_0xd87d('0x2d')]['length']?_0x1c7f9a[_0xd87d('0x2d')]:_0x2bb9a3['model'];if(_0x473c05['query']['includeAll']){_0x1c7f9a[_0xd87d('0x3b')]=[{'all':!![]}];}_0x1c7f9a=_['merge']({},_0x1c7f9a,_0x473c05['options']);return db[_0xd87d('0x27')][_0xd87d('0x41')](_0x1c7f9a)['then'](handleEntityNotFound(_0x144dd6,null))[_0xd87d('0x23')](respondWithResult(_0x144dd6,null))[_0xd87d('0x42')](handleError(_0x144dd6,null));};exports[_0xd87d('0x43')]=function(_0x2c7cd0,_0x2ef3ce){return db[_0xd87d('0x27')][_0xd87d('0x43')](_0x2c7cd0[_0xd87d('0x44')],{})[_0xd87d('0x23')](respondWithResult(_0x2ef3ce,0xc9))[_0xd87d('0x42')](handleError(_0x2ef3ce,null));};exports[_0xd87d('0x45')]=function(_0x12200c,_0x21f00e){if(_0x12200c[_0xd87d('0x44')]['id']){delete _0x12200c[_0xd87d('0x44')]['id'];}return db[_0xd87d('0x27')][_0xd87d('0x41')]({'where':{'id':_0x12200c['params']['id']}})['then'](handleEntityNotFound(_0x21f00e,null))[_0xd87d('0x23')](saveUpdates(_0x12200c[_0xd87d('0x44')],null))[_0xd87d('0x23')](respondWithResult(_0x21f00e,null))[_0xd87d('0x42')](handleError(_0x21f00e,null));};exports[_0xd87d('0x46')]=function(_0x35025e,_0x4c6d87){return db['ZendeskConfiguration'][_0xd87d('0x41')]({'where':{'id':_0x35025e['params']['id']}})['then'](handleEntityNotFound(_0x4c6d87,null))[_0xd87d('0x23')](removeEntity(_0x4c6d87,null))[_0xd87d('0x42')](handleError(_0x4c6d87,null));};exports[_0xd87d('0x47')]=function(_0xcaeaed,_0x43e622,_0x4c102b){var _0x35dbe3={};var _0x2fac0f={};var _0x19b474;var _0x56d357;return db[_0xd87d('0x27')][_0xd87d('0x48')]({'where':{'id':_0xcaeaed[_0xd87d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x43e622,null))[_0xd87d('0x23')](function(_0x3f75b6){if(_0x3f75b6){_0x19b474=_0x3f75b6;_0x2fac0f[_0xd87d('0x2f')]=_[_0xd87d('0x40')](db['ZendeskField'][_0xd87d('0x49')]);_0x2fac0f[_0xd87d('0x2b')]=_['keys'](_0xcaeaed['query']);_0x2fac0f[_0xd87d('0x2c')]=_[_0xd87d('0x2e')](_0x2fac0f[_0xd87d('0x2f')],_0x2fac0f['query']);_0x35dbe3[_0xd87d('0x2d')]=_[_0xd87d('0x2e')](_0x2fac0f[_0xd87d('0x2f')],qs['fields'](_0xcaeaed[_0xd87d('0x2b')]['fields']));_0x35dbe3[_0xd87d('0x2d')]=_0x35dbe3[_0xd87d('0x2d')][_0xd87d('0x31')]?_0x35dbe3[_0xd87d('0x2d')]:_0x2fac0f[_0xd87d('0x2f')];_0x35dbe3[_0xd87d('0x34')]=qs[_0xd87d('0x35')](_0xcaeaed[_0xd87d('0x2b')][_0xd87d('0x35')]);_0x35dbe3[_0xd87d('0x36')]=qs[_0xd87d('0x2c')](_[_0xd87d('0x37')](_0xcaeaed['query'],_0x2fac0f['filters']));if(_0xcaeaed['query']['filter']){_0x35dbe3['where']=_[_0xd87d('0x38')](_0x35dbe3[_0xd87d('0x36')],{'$or':_[_0xd87d('0x26')](_0x35dbe3[_0xd87d('0x2d')],function(_0x1b8347){var _0x198c62={};_0x198c62[_0x1b8347]={'$like':'%'+_0xcaeaed[_0xd87d('0x2b')]['filter']+'%'};return _0x198c62;})});}_0x35dbe3=_[_0xd87d('0x38')]({},_0x35dbe3,_0xcaeaed[_0xd87d('0x39')]);return _0x19b474[_0xd87d('0x47')](_0x35dbe3);}})[_0xd87d('0x23')](function(_0x3241ac){if(_0x3241ac){_0x56d357=_0x3241ac[_0xd87d('0x31')];if(!_0xcaeaed[_0xd87d('0x2b')]['hasOwnProperty'](_0xd87d('0x33'))){_0x35dbe3['limit']=qs[_0xd87d('0x1c')](_0xcaeaed['query'][_0xd87d('0x1c')]);_0x35dbe3['offset']=qs[_0xd87d('0x1e')](_0xcaeaed[_0xd87d('0x2b')][_0xd87d('0x1e')]);}return _0x19b474[_0xd87d('0x47')](_0x35dbe3);}})['then'](function(_0x1f63ff){if(_0x1f63ff){return _0x1f63ff?{'count':_0x56d357,'rows':_0x1f63ff}:null;}})[_0xd87d('0x23')](respondWithResult(_0x43e622,null))[_0xd87d('0x42')](handleError(_0x43e622,null));};exports[_0xd87d('0x4a')]=function(_0x58bb5d,_0x4189cd,_0x10996e){var _0x2c1e88={};var _0x5aa9a1={};var _0x3237c0;var _0x52e3af;return db['ZendeskConfiguration'][_0xd87d('0x48')]({'where':{'id':_0x58bb5d[_0xd87d('0x3f')]['id']}})[_0xd87d('0x23')](handleEntityNotFound(_0x4189cd,null))[_0xd87d('0x23')](function(_0x2c5e16){if(_0x2c5e16){_0x3237c0=_0x2c5e16;_0x5aa9a1['model']=_[_0xd87d('0x40')](db[_0xd87d('0x4b')][_0xd87d('0x49')]);_0x5aa9a1[_0xd87d('0x2b')]=_[_0xd87d('0x40')](_0x58bb5d['query']);_0x5aa9a1[_0xd87d('0x2c')]=_['intersection'](_0x5aa9a1[_0xd87d('0x2f')],_0x5aa9a1[_0xd87d('0x2b')]);_0x2c1e88[_0xd87d('0x2d')]=_['intersection'](_0x5aa9a1[_0xd87d('0x2f')],qs[_0xd87d('0x30')](_0x58bb5d[_0xd87d('0x2b')][_0xd87d('0x30')]));_0x2c1e88[_0xd87d('0x2d')]=_0x2c1e88[_0xd87d('0x2d')][_0xd87d('0x31')]?_0x2c1e88['attributes']:_0x5aa9a1[_0xd87d('0x2f')];_0x2c1e88[_0xd87d('0x34')]=qs['sort'](_0x58bb5d[_0xd87d('0x2b')][_0xd87d('0x35')]);_0x2c1e88[_0xd87d('0x36')]=qs[_0xd87d('0x2c')](_[_0xd87d('0x37')](_0x58bb5d[_0xd87d('0x2b')],_0x5aa9a1['filters']));if(_0x58bb5d['query']['filter']){_0x2c1e88['where']=_['merge'](_0x2c1e88['where'],{'$or':_[_0xd87d('0x26')](_0x2c1e88[_0xd87d('0x2d')],function(_0x1a9a16){var _0x5f2952={};_0x5f2952[_0x1a9a16]={'$like':'%'+_0x58bb5d[_0xd87d('0x2b')][_0xd87d('0x4c')]+'%'};return _0x5f2952;})});}_0x2c1e88=_[_0xd87d('0x38')]({},_0x2c1e88,_0x58bb5d[_0xd87d('0x39')]);return _0x3237c0[_0xd87d('0x4a')](_0x2c1e88);}})['then'](function(_0x19e851){if(_0x19e851){_0x52e3af=_0x19e851['length'];if(!_0x58bb5d[_0xd87d('0x2b')][_0xd87d('0x32')](_0xd87d('0x33'))){_0x2c1e88[_0xd87d('0x1c')]=qs['limit'](_0x58bb5d[_0xd87d('0x2b')][_0xd87d('0x1c')]);_0x2c1e88[_0xd87d('0x1e')]=qs[_0xd87d('0x1e')](_0x58bb5d['query'][_0xd87d('0x1e')]);}return _0x3237c0[_0xd87d('0x4a')](_0x2c1e88);}})['then'](function(_0x4b9360){if(_0x4b9360){return _0x4b9360?{'count':_0x52e3af,'rows':_0x4b9360}:null;}})[_0xd87d('0x23')](respondWithResult(_0x4189cd,null))[_0xd87d('0x42')](handleError(_0x4189cd,null));};exports[_0xd87d('0x4d')]=function(_0x4859db,_0x40eebb,_0x33f832){var _0x1c23ff={};var _0x218168={};var _0x57f67b;var _0x2ee19c;return db[_0xd87d('0x27')][_0xd87d('0x48')]({'where':{'id':_0x4859db[_0xd87d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x40eebb,null))[_0xd87d('0x23')](function(_0x29495b){if(_0x29495b){_0x57f67b=_0x29495b;_0x218168['model']=_['keys'](db['ZendeskField'][_0xd87d('0x49')]);_0x218168['query']=_[_0xd87d('0x40')](_0x4859db[_0xd87d('0x2b')]);_0x218168['filters']=_[_0xd87d('0x2e')](_0x218168[_0xd87d('0x2f')],_0x218168['query']);_0x1c23ff['attributes']=_[_0xd87d('0x2e')](_0x218168[_0xd87d('0x2f')],qs[_0xd87d('0x30')](_0x4859db['query'][_0xd87d('0x30')]));_0x1c23ff[_0xd87d('0x2d')]=_0x1c23ff[_0xd87d('0x2d')][_0xd87d('0x31')]?_0x1c23ff[_0xd87d('0x2d')]:_0x218168[_0xd87d('0x2f')];_0x1c23ff['order']=qs['sort'](_0x4859db['query'][_0xd87d('0x35')]);_0x1c23ff[_0xd87d('0x36')]=qs[_0xd87d('0x2c')](_[_0xd87d('0x37')](_0x4859db['query'],_0x218168[_0xd87d('0x2c')]));if(_0x4859db[_0xd87d('0x2b')][_0xd87d('0x4c')]){_0x1c23ff[_0xd87d('0x36')]=_['merge'](_0x1c23ff[_0xd87d('0x36')],{'$or':_['map'](_0x1c23ff['attributes'],function(_0x12fb76){var _0x27d1c5={};_0x27d1c5[_0x12fb76]={'$like':'%'+_0x4859db[_0xd87d('0x2b')][_0xd87d('0x4c')]+'%'};return _0x27d1c5;})});}_0x1c23ff=_[_0xd87d('0x38')]({},_0x1c23ff,_0x4859db[_0xd87d('0x39')]);return _0x57f67b[_0xd87d('0x4d')](_0x1c23ff);}})['then'](function(_0x290d67){if(_0x290d67){_0x2ee19c=_0x290d67['length'];if(!_0x4859db[_0xd87d('0x2b')][_0xd87d('0x32')](_0xd87d('0x33'))){_0x1c23ff[_0xd87d('0x1c')]=qs[_0xd87d('0x1c')](_0x4859db['query']['limit']);_0x1c23ff[_0xd87d('0x1e')]=qs['offset'](_0x4859db[_0xd87d('0x2b')][_0xd87d('0x1e')]);}return _0x57f67b['getDescriptions'](_0x1c23ff);}})['then'](function(_0x3cd799){if(_0x3cd799){return _0x3cd799?{'count':_0x2ee19c,'rows':_0x3cd799}:null;}})['then'](respondWithResult(_0x40eebb,null))[_0xd87d('0x42')](handleError(_0x40eebb,null));};exports[_0xd87d('0x4e')]=function(_0x58ba4f,_0x68651c,_0x3ded47){var _0xa3bb30={};var _0x2bb422={};var _0x2633aa;var _0x556641;return db[_0xd87d('0x27')][_0xd87d('0x48')]({'where':{'id':_0x58ba4f[_0xd87d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x68651c,null))['then'](function(_0x1ce138){if(_0x1ce138){_0x2633aa=_0x1ce138;_0x2bb422[_0xd87d('0x2f')]=_['keys'](db[_0xd87d('0x4f')][_0xd87d('0x49')]);_0x2bb422[_0xd87d('0x2b')]=_[_0xd87d('0x40')](_0x58ba4f['query']);_0x2bb422[_0xd87d('0x2c')]=_[_0xd87d('0x2e')](_0x2bb422[_0xd87d('0x2f')],_0x2bb422['query']);_0xa3bb30['attributes']=_[_0xd87d('0x2e')](_0x2bb422[_0xd87d('0x2f')],qs[_0xd87d('0x30')](_0x58ba4f[_0xd87d('0x2b')][_0xd87d('0x30')]));_0xa3bb30['attributes']=_0xa3bb30[_0xd87d('0x2d')][_0xd87d('0x31')]?_0xa3bb30[_0xd87d('0x2d')]:_0x2bb422[_0xd87d('0x2f')];_0xa3bb30[_0xd87d('0x34')]=qs['sort'](_0x58ba4f[_0xd87d('0x2b')][_0xd87d('0x35')]);_0xa3bb30[_0xd87d('0x36')]=qs[_0xd87d('0x2c')](_[_0xd87d('0x37')](_0x58ba4f['query'],_0x2bb422['filters']));if(_0x58ba4f[_0xd87d('0x2b')]['filter']){_0xa3bb30['where']=_[_0xd87d('0x38')](_0xa3bb30[_0xd87d('0x36')],{'$or':_[_0xd87d('0x26')](_0xa3bb30['attributes'],function(_0x3b068c){var _0x520519={};_0x520519[_0x3b068c]={'$like':'%'+_0x58ba4f[_0xd87d('0x2b')]['filter']+'%'};return _0x520519;})});}_0xa3bb30=_[_0xd87d('0x38')]({},_0xa3bb30,_0x58ba4f['options']);return _0x2633aa[_0xd87d('0x4e')](_0xa3bb30);}})['then'](function(_0x2ef333){if(_0x2ef333){_0x556641=_0x2ef333[_0xd87d('0x31')];if(!_0x58ba4f[_0xd87d('0x2b')]['hasOwnProperty']('nolimit')){_0xa3bb30['limit']=qs[_0xd87d('0x1c')](_0x58ba4f['query'][_0xd87d('0x1c')]);_0xa3bb30[_0xd87d('0x1e')]=qs[_0xd87d('0x1e')](_0x58ba4f[_0xd87d('0x2b')][_0xd87d('0x1e')]);}return _0x2633aa['getTags'](_0xa3bb30);}})['then'](function(_0x5a5d10){if(_0x5a5d10){return _0x5a5d10?{'count':_0x556641,'rows':_0x5a5d10}:null;}})[_0xd87d('0x23')](respondWithResult(_0x68651c,null))[_0xd87d('0x42')](handleError(_0x68651c,null));};exports['setTags']=function(_0x4823ae,_0x2df713,_0x49f857){if(_0x4823ae[_0xd87d('0x44')]['id']){delete _0x4823ae['body']['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x4823ae[_0xd87d('0x3f')]['id']}})[_0xd87d('0x23')](handleEntityNotFound(_0x2df713,null))[_0xd87d('0x23')](function(_0x2aab6b){if(_0x2aab6b){return _0x2aab6b[_0xd87d('0x50')](_0x4823ae[_0xd87d('0x44')][_0xd87d('0x51')]||[]);}return null;})[_0xd87d('0x23')](respondWithResult(_0x2df713,null))[_0xd87d('0x42')](handleError(_0x2df713,null));}; \ No newline at end of file +var _0x7e56=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','error','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','ZendeskConfiguration','include','findAll','catch','params','rawAttributes','includeAll','find','create','body','findOne','ZendeskField','getFields','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0x7e56,0xde));var _0x67e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e56[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x67e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x67e5('0x1'));var rp=require(_0x67e5('0x2'));var moment=require(_0x67e5('0x3'));var BPromise=require(_0x67e5('0x4'));var Mustache=require(_0x67e5('0x5'));var util=require(_0x67e5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x67e5('0x7'));var ejs=require(_0x67e5('0x8'));var fs=require('fs');var fs_extra=require(_0x67e5('0x9'));var _=require(_0x67e5('0xa'));var squel=require('squel');var crypto=require(_0x67e5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x67e5('0xc'));var toCsv=require(_0x67e5('0x7'));var querystring=require(_0x67e5('0xd'));var Papa=require('papaparse');var Redis=require(_0x67e5('0xe'));var authService=require(_0x67e5('0xf'));var qs=require(_0x67e5('0x10'));var as=require(_0x67e5('0x11'));var hardwareService=require(_0x67e5('0x12'));var logger=require(_0x67e5('0x13'))(_0x67e5('0x14'));var utils=require(_0x67e5('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10aedd,_0x506dd0){_0x506dd0=_0x506dd0||0xcc;return function(_0x8ede62){if(_0x8ede62){return _0x10aedd[_0x67e5('0x16')](_0x506dd0);}return _0x10aedd[_0x67e5('0x17')](_0x506dd0)[_0x67e5('0x18')]();};}function respondWithResult(_0x4e96ef,_0xbf4427){_0xbf4427=_0xbf4427||0xc8;return function(_0x40ce6a){if(_0x40ce6a){return _0x4e96ef['status'](_0xbf4427)['json'](_0x40ce6a);}};}function respondWithFilteredResult(_0x4551ca,_0x59bbb4){return function(_0x4057ed){if(_0x4057ed){var _0x2e201e=typeof _0x59bbb4['offset']===_0x67e5('0x19')&&typeof _0x59bbb4[_0x67e5('0x1a')]===_0x67e5('0x19');var _0x382a86=_0x4057ed[_0x67e5('0x1b')];var _0x5b6dfc=_0x2e201e?0x0:_0x59bbb4[_0x67e5('0x1c')];var _0x29b44c=_0x2e201e?_0x4057ed['count']:_0x59bbb4[_0x67e5('0x1c')]+_0x59bbb4[_0x67e5('0x1a')];var _0x3e355b;if(_0x29b44c>=_0x382a86){_0x29b44c=_0x382a86;_0x3e355b=0xc8;}else{_0x3e355b=0xce;}_0x4551ca[_0x67e5('0x17')](_0x3e355b);return _0x4551ca[_0x67e5('0x1d')](_0x67e5('0x1e'),_0x5b6dfc+'-'+_0x29b44c+'/'+_0x382a86)[_0x67e5('0x1f')](_0x4057ed);}return null;};}function patchUpdates(_0x557cbe){return function(_0x4b573e){try{jsonpatch[_0x67e5('0x20')](_0x4b573e,_0x557cbe,!![]);}catch(_0xf57513){return BPromise[_0x67e5('0x21')](_0xf57513);}return _0x4b573e['save']();};}function saveUpdates(_0x1700b2,_0x358ca0){return function(_0x3da97a){if(_0x3da97a){return _0x3da97a[_0x67e5('0x22')](_0x1700b2)[_0x67e5('0x23')](function(_0x3020ee){return _0x3020ee;});}return null;};}function removeEntity(_0x24d9bc,_0x5ec616){return function(_0x537e51){if(_0x537e51){return _0x537e51['destroy']()[_0x67e5('0x23')](function(){_0x24d9bc[_0x67e5('0x17')](0xcc)[_0x67e5('0x18')]();});}};}function handleEntityNotFound(_0xb6ea84,_0x1762c3){return function(_0x26301a){if(!_0x26301a){_0xb6ea84[_0x67e5('0x16')](0x194);}return _0x26301a;};}function handleError(_0x22fc26,_0x26a18e){_0x26a18e=_0x26a18e||0x1f4;return function(_0x634656){logger[_0x67e5('0x24')](_0x634656['stack']);if(_0x634656[_0x67e5('0x25')]){delete _0x634656['name'];}_0x22fc26[_0x67e5('0x17')](_0x26a18e)[_0x67e5('0x26')](_0x634656);};}exports['index']=function(_0x4e3fe6,_0x1e435b){var _0x37885e={},_0x4eb475={},_0x358d93={'count':0x0,'rows':[]};var _0x5cfa17=_[_0x67e5('0x27')](db['ZendeskConfiguration']['rawAttributes'],function(_0x2a697b){return{'name':_0x2a697b[_0x67e5('0x28')],'type':_0x2a697b[_0x67e5('0x29')][_0x67e5('0x2a')]};});_0x4eb475[_0x67e5('0x2b')]=_[_0x67e5('0x27')](_0x5cfa17,_0x67e5('0x25'));_0x4eb475[_0x67e5('0x2c')]=_[_0x67e5('0x2d')](_0x4e3fe6[_0x67e5('0x2c')]);_0x4eb475[_0x67e5('0x2e')]=_[_0x67e5('0x2f')](_0x4eb475[_0x67e5('0x2b')],_0x4eb475[_0x67e5('0x2c')]);_0x37885e[_0x67e5('0x30')]=_[_0x67e5('0x2f')](_0x4eb475['model'],qs[_0x67e5('0x31')](_0x4e3fe6[_0x67e5('0x2c')][_0x67e5('0x31')]));_0x37885e[_0x67e5('0x30')]=_0x37885e[_0x67e5('0x30')][_0x67e5('0x32')]?_0x37885e[_0x67e5('0x30')]:_0x4eb475[_0x67e5('0x2b')];if(!_0x4e3fe6[_0x67e5('0x2c')]['hasOwnProperty'](_0x67e5('0x33'))){_0x37885e[_0x67e5('0x1a')]=qs[_0x67e5('0x1a')](_0x4e3fe6['query'][_0x67e5('0x1a')]);_0x37885e['offset']=qs[_0x67e5('0x1c')](_0x4e3fe6[_0x67e5('0x2c')][_0x67e5('0x1c')]);}_0x37885e[_0x67e5('0x34')]=qs[_0x67e5('0x35')](_0x4e3fe6[_0x67e5('0x2c')][_0x67e5('0x35')]);_0x37885e[_0x67e5('0x36')]=qs[_0x67e5('0x2e')](_[_0x67e5('0x37')](_0x4e3fe6[_0x67e5('0x2c')],_0x4eb475['filters']),_0x5cfa17);if(_0x4e3fe6['query'][_0x67e5('0x38')]){_0x37885e[_0x67e5('0x36')]=_[_0x67e5('0x39')](_0x37885e[_0x67e5('0x36')],{'$or':_[_0x67e5('0x27')](_0x5cfa17,function(_0x5ca79e){if(_0x5ca79e['type']!=='VIRTUAL'){var _0x1ec338={};_0x1ec338[_0x5ca79e[_0x67e5('0x25')]]={'$like':'%'+_0x4e3fe6[_0x67e5('0x2c')][_0x67e5('0x38')]+'%'};return _0x1ec338;}})});}_0x37885e=_[_0x67e5('0x39')]({},_0x37885e,_0x4e3fe6[_0x67e5('0x3a')]);var _0xe364a4={'where':_0x37885e['where']};return db[_0x67e5('0x3b')][_0x67e5('0x1b')](_0xe364a4)['then'](function(_0x424a4e){_0x358d93[_0x67e5('0x1b')]=_0x424a4e;if(_0x4e3fe6['query']['includeAll']){_0x37885e[_0x67e5('0x3c')]=[{'all':!![]}];}return db[_0x67e5('0x3b')][_0x67e5('0x3d')](_0x37885e);})['then'](function(_0x3109f8){_0x358d93['rows']=_0x3109f8;return _0x358d93;})['then'](respondWithFilteredResult(_0x1e435b,_0x37885e))[_0x67e5('0x3e')](handleError(_0x1e435b,null));};exports['show']=function(_0x14dd93,_0x51ac1e){var _0x3aa5a8={'raw':![],'where':{'id':_0x14dd93[_0x67e5('0x3f')]['id']}},_0xf7c528={};_0xf7c528[_0x67e5('0x2b')]=_[_0x67e5('0x2d')](db[_0x67e5('0x3b')][_0x67e5('0x40')]);_0xf7c528['query']=_[_0x67e5('0x2d')](_0x14dd93[_0x67e5('0x2c')]);_0xf7c528[_0x67e5('0x2e')]=_[_0x67e5('0x2f')](_0xf7c528[_0x67e5('0x2b')],_0xf7c528['query']);_0x3aa5a8[_0x67e5('0x30')]=_[_0x67e5('0x2f')](_0xf7c528['model'],qs[_0x67e5('0x31')](_0x14dd93[_0x67e5('0x2c')][_0x67e5('0x31')]));_0x3aa5a8[_0x67e5('0x30')]=_0x3aa5a8[_0x67e5('0x30')][_0x67e5('0x32')]?_0x3aa5a8[_0x67e5('0x30')]:_0xf7c528[_0x67e5('0x2b')];if(_0x14dd93[_0x67e5('0x2c')][_0x67e5('0x41')]){_0x3aa5a8['include']=[{'all':!![]}];}_0x3aa5a8=_[_0x67e5('0x39')]({},_0x3aa5a8,_0x14dd93['options']);return db[_0x67e5('0x3b')][_0x67e5('0x42')](_0x3aa5a8)['then'](handleEntityNotFound(_0x51ac1e,null))['then'](respondWithResult(_0x51ac1e,null))['catch'](handleError(_0x51ac1e,null));};exports[_0x67e5('0x43')]=function(_0x526613,_0x2f303c){return db['ZendeskConfiguration']['create'](_0x526613[_0x67e5('0x44')],{})[_0x67e5('0x23')](respondWithResult(_0x2f303c,0xc9))[_0x67e5('0x3e')](handleError(_0x2f303c,null));};exports[_0x67e5('0x22')]=function(_0x398b4b,_0x44a532){if(_0x398b4b[_0x67e5('0x44')]['id']){delete _0x398b4b['body']['id'];}return db[_0x67e5('0x3b')]['find']({'where':{'id':_0x398b4b[_0x67e5('0x3f')]['id']}})[_0x67e5('0x23')](handleEntityNotFound(_0x44a532,null))['then'](saveUpdates(_0x398b4b['body'],null))[_0x67e5('0x23')](respondWithResult(_0x44a532,null))[_0x67e5('0x3e')](handleError(_0x44a532,null));};exports['destroy']=function(_0x17683c,_0x5e23fa){return db[_0x67e5('0x3b')]['find']({'where':{'id':_0x17683c[_0x67e5('0x3f')]['id']}})[_0x67e5('0x23')](handleEntityNotFound(_0x5e23fa,null))[_0x67e5('0x23')](removeEntity(_0x5e23fa,null))['catch'](handleError(_0x5e23fa,null));};exports['getFields']=function(_0x4d3feb,_0x536407,_0x338967){var _0x3beabe={};var _0x516b1b={};var _0x4d63e5;var _0x31daaa;return db[_0x67e5('0x3b')][_0x67e5('0x45')]({'where':{'id':_0x4d3feb[_0x67e5('0x3f')]['id']}})[_0x67e5('0x23')](handleEntityNotFound(_0x536407,null))[_0x67e5('0x23')](function(_0x4a8811){if(_0x4a8811){_0x4d63e5=_0x4a8811;_0x516b1b['model']=_['keys'](db[_0x67e5('0x46')][_0x67e5('0x40')]);_0x516b1b['query']=_[_0x67e5('0x2d')](_0x4d3feb['query']);_0x516b1b['filters']=_[_0x67e5('0x2f')](_0x516b1b[_0x67e5('0x2b')],_0x516b1b[_0x67e5('0x2c')]);_0x3beabe[_0x67e5('0x30')]=_[_0x67e5('0x2f')](_0x516b1b[_0x67e5('0x2b')],qs[_0x67e5('0x31')](_0x4d3feb[_0x67e5('0x2c')]['fields']));_0x3beabe[_0x67e5('0x30')]=_0x3beabe['attributes'][_0x67e5('0x32')]?_0x3beabe[_0x67e5('0x30')]:_0x516b1b[_0x67e5('0x2b')];_0x3beabe[_0x67e5('0x34')]=qs['sort'](_0x4d3feb[_0x67e5('0x2c')][_0x67e5('0x35')]);_0x3beabe['where']=qs[_0x67e5('0x2e')](_[_0x67e5('0x37')](_0x4d3feb[_0x67e5('0x2c')],_0x516b1b['filters']));if(_0x4d3feb[_0x67e5('0x2c')]['filter']){_0x3beabe[_0x67e5('0x36')]=_['merge'](_0x3beabe[_0x67e5('0x36')],{'$or':_[_0x67e5('0x27')](_0x3beabe[_0x67e5('0x30')],function(_0x3c8e5e){var _0x297c3a={};_0x297c3a[_0x3c8e5e]={'$like':'%'+_0x4d3feb[_0x67e5('0x2c')][_0x67e5('0x38')]+'%'};return _0x297c3a;})});}_0x3beabe=_['merge']({},_0x3beabe,_0x4d3feb[_0x67e5('0x3a')]);return _0x4d63e5[_0x67e5('0x47')](_0x3beabe);}})[_0x67e5('0x23')](function(_0x119d8f){if(_0x119d8f){_0x31daaa=_0x119d8f[_0x67e5('0x32')];if(!_0x4d3feb[_0x67e5('0x2c')][_0x67e5('0x48')]('nolimit')){_0x3beabe['limit']=qs[_0x67e5('0x1a')](_0x4d3feb[_0x67e5('0x2c')][_0x67e5('0x1a')]);_0x3beabe[_0x67e5('0x1c')]=qs[_0x67e5('0x1c')](_0x4d3feb[_0x67e5('0x2c')][_0x67e5('0x1c')]);}return _0x4d63e5[_0x67e5('0x47')](_0x3beabe);}})[_0x67e5('0x23')](function(_0x2e1cfb){if(_0x2e1cfb){return _0x2e1cfb?{'count':_0x31daaa,'rows':_0x2e1cfb}:null;}})[_0x67e5('0x23')](respondWithResult(_0x536407,null))[_0x67e5('0x3e')](handleError(_0x536407,null));};exports[_0x67e5('0x49')]=function(_0x4a4da8,_0x516a14,_0x36ccb9){var _0x1bc0cf={};var _0x4a9cc4={};var _0x285555;var _0x940d7a;return db['ZendeskConfiguration'][_0x67e5('0x45')]({'where':{'id':_0x4a4da8[_0x67e5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x516a14,null))['then'](function(_0x4ef8c9){if(_0x4ef8c9){_0x285555=_0x4ef8c9;_0x4a9cc4['model']=_[_0x67e5('0x2d')](db[_0x67e5('0x46')]['rawAttributes']);_0x4a9cc4[_0x67e5('0x2c')]=_[_0x67e5('0x2d')](_0x4a4da8[_0x67e5('0x2c')]);_0x4a9cc4[_0x67e5('0x2e')]=_[_0x67e5('0x2f')](_0x4a9cc4[_0x67e5('0x2b')],_0x4a9cc4[_0x67e5('0x2c')]);_0x1bc0cf[_0x67e5('0x30')]=_[_0x67e5('0x2f')](_0x4a9cc4['model'],qs[_0x67e5('0x31')](_0x4a4da8[_0x67e5('0x2c')][_0x67e5('0x31')]));_0x1bc0cf[_0x67e5('0x30')]=_0x1bc0cf['attributes'][_0x67e5('0x32')]?_0x1bc0cf[_0x67e5('0x30')]:_0x4a9cc4[_0x67e5('0x2b')];_0x1bc0cf[_0x67e5('0x34')]=qs[_0x67e5('0x35')](_0x4a4da8[_0x67e5('0x2c')][_0x67e5('0x35')]);_0x1bc0cf['where']=qs[_0x67e5('0x2e')](_[_0x67e5('0x37')](_0x4a4da8[_0x67e5('0x2c')],_0x4a9cc4[_0x67e5('0x2e')]));if(_0x4a4da8[_0x67e5('0x2c')][_0x67e5('0x38')]){_0x1bc0cf[_0x67e5('0x36')]=_['merge'](_0x1bc0cf['where'],{'$or':_['map'](_0x1bc0cf[_0x67e5('0x30')],function(_0xb169a1){var _0x241096={};_0x241096[_0xb169a1]={'$like':'%'+_0x4a4da8[_0x67e5('0x2c')][_0x67e5('0x38')]+'%'};return _0x241096;})});}_0x1bc0cf=_['merge']({},_0x1bc0cf,_0x4a4da8[_0x67e5('0x3a')]);return _0x285555[_0x67e5('0x49')](_0x1bc0cf);}})[_0x67e5('0x23')](function(_0x3e3552){if(_0x3e3552){_0x940d7a=_0x3e3552[_0x67e5('0x32')];if(!_0x4a4da8[_0x67e5('0x2c')][_0x67e5('0x48')](_0x67e5('0x33'))){_0x1bc0cf[_0x67e5('0x1a')]=qs[_0x67e5('0x1a')](_0x4a4da8['query']['limit']);_0x1bc0cf[_0x67e5('0x1c')]=qs[_0x67e5('0x1c')](_0x4a4da8[_0x67e5('0x2c')][_0x67e5('0x1c')]);}return _0x285555[_0x67e5('0x49')](_0x1bc0cf);}})[_0x67e5('0x23')](function(_0x620d10){if(_0x620d10){return _0x620d10?{'count':_0x940d7a,'rows':_0x620d10}:null;}})['then'](respondWithResult(_0x516a14,null))[_0x67e5('0x3e')](handleError(_0x516a14,null));};exports[_0x67e5('0x4a')]=function(_0x1a1f4d,_0x17c8a1,_0xbfde82){var _0x1cc9f3={};var _0x5d10da={};var _0x4314d0;var _0x3c9805;return db[_0x67e5('0x3b')][_0x67e5('0x45')]({'where':{'id':_0x1a1f4d[_0x67e5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x17c8a1,null))[_0x67e5('0x23')](function(_0x34b6ae){if(_0x34b6ae){_0x4314d0=_0x34b6ae;_0x5d10da['model']=_[_0x67e5('0x2d')](db['ZendeskField']['rawAttributes']);_0x5d10da[_0x67e5('0x2c')]=_[_0x67e5('0x2d')](_0x1a1f4d['query']);_0x5d10da['filters']=_['intersection'](_0x5d10da['model'],_0x5d10da[_0x67e5('0x2c')]);_0x1cc9f3[_0x67e5('0x30')]=_['intersection'](_0x5d10da[_0x67e5('0x2b')],qs[_0x67e5('0x31')](_0x1a1f4d[_0x67e5('0x2c')][_0x67e5('0x31')]));_0x1cc9f3[_0x67e5('0x30')]=_0x1cc9f3[_0x67e5('0x30')][_0x67e5('0x32')]?_0x1cc9f3[_0x67e5('0x30')]:_0x5d10da['model'];_0x1cc9f3[_0x67e5('0x34')]=qs[_0x67e5('0x35')](_0x1a1f4d['query'][_0x67e5('0x35')]);_0x1cc9f3[_0x67e5('0x36')]=qs[_0x67e5('0x2e')](_[_0x67e5('0x37')](_0x1a1f4d[_0x67e5('0x2c')],_0x5d10da[_0x67e5('0x2e')]));if(_0x1a1f4d[_0x67e5('0x2c')][_0x67e5('0x38')]){_0x1cc9f3[_0x67e5('0x36')]=_[_0x67e5('0x39')](_0x1cc9f3[_0x67e5('0x36')],{'$or':_[_0x67e5('0x27')](_0x1cc9f3[_0x67e5('0x30')],function(_0x18309c){var _0x2ca401={};_0x2ca401[_0x18309c]={'$like':'%'+_0x1a1f4d[_0x67e5('0x2c')]['filter']+'%'};return _0x2ca401;})});}_0x1cc9f3=_[_0x67e5('0x39')]({},_0x1cc9f3,_0x1a1f4d[_0x67e5('0x3a')]);return _0x4314d0[_0x67e5('0x4a')](_0x1cc9f3);}})[_0x67e5('0x23')](function(_0x17f8b0){if(_0x17f8b0){_0x3c9805=_0x17f8b0[_0x67e5('0x32')];if(!_0x1a1f4d['query']['hasOwnProperty'](_0x67e5('0x33'))){_0x1cc9f3[_0x67e5('0x1a')]=qs[_0x67e5('0x1a')](_0x1a1f4d[_0x67e5('0x2c')][_0x67e5('0x1a')]);_0x1cc9f3[_0x67e5('0x1c')]=qs[_0x67e5('0x1c')](_0x1a1f4d[_0x67e5('0x2c')][_0x67e5('0x1c')]);}return _0x4314d0[_0x67e5('0x4a')](_0x1cc9f3);}})[_0x67e5('0x23')](function(_0xb558f1){if(_0xb558f1){return _0xb558f1?{'count':_0x3c9805,'rows':_0xb558f1}:null;}})[_0x67e5('0x23')](respondWithResult(_0x17c8a1,null))[_0x67e5('0x3e')](handleError(_0x17c8a1,null));};exports['getTags']=function(_0x20480e,_0x1f077f,_0x1bd052){var _0x17c0fb={};var _0x292ec7={};var _0x3c2e6a;var _0x1fb7c3;return db[_0x67e5('0x3b')][_0x67e5('0x45')]({'where':{'id':_0x20480e[_0x67e5('0x3f')]['id']}})[_0x67e5('0x23')](handleEntityNotFound(_0x1f077f,null))['then'](function(_0x5bd141){if(_0x5bd141){_0x3c2e6a=_0x5bd141;_0x292ec7[_0x67e5('0x2b')]=_[_0x67e5('0x2d')](db[_0x67e5('0x4b')][_0x67e5('0x40')]);_0x292ec7['query']=_[_0x67e5('0x2d')](_0x20480e['query']);_0x292ec7[_0x67e5('0x2e')]=_[_0x67e5('0x2f')](_0x292ec7['model'],_0x292ec7[_0x67e5('0x2c')]);_0x17c0fb[_0x67e5('0x30')]=_[_0x67e5('0x2f')](_0x292ec7[_0x67e5('0x2b')],qs[_0x67e5('0x31')](_0x20480e[_0x67e5('0x2c')][_0x67e5('0x31')]));_0x17c0fb[_0x67e5('0x30')]=_0x17c0fb[_0x67e5('0x30')]['length']?_0x17c0fb[_0x67e5('0x30')]:_0x292ec7[_0x67e5('0x2b')];_0x17c0fb[_0x67e5('0x34')]=qs[_0x67e5('0x35')](_0x20480e[_0x67e5('0x2c')][_0x67e5('0x35')]);_0x17c0fb['where']=qs[_0x67e5('0x2e')](_[_0x67e5('0x37')](_0x20480e[_0x67e5('0x2c')],_0x292ec7[_0x67e5('0x2e')]));if(_0x20480e['query'][_0x67e5('0x38')]){_0x17c0fb[_0x67e5('0x36')]=_['merge'](_0x17c0fb[_0x67e5('0x36')],{'$or':_['map'](_0x17c0fb['attributes'],function(_0x2e01fe){var _0x44781b={};_0x44781b[_0x2e01fe]={'$like':'%'+_0x20480e[_0x67e5('0x2c')][_0x67e5('0x38')]+'%'};return _0x44781b;})});}_0x17c0fb=_[_0x67e5('0x39')]({},_0x17c0fb,_0x20480e['options']);return _0x3c2e6a[_0x67e5('0x4c')](_0x17c0fb);}})['then'](function(_0x379f52){if(_0x379f52){_0x1fb7c3=_0x379f52[_0x67e5('0x32')];if(!_0x20480e[_0x67e5('0x2c')][_0x67e5('0x48')](_0x67e5('0x33'))){_0x17c0fb[_0x67e5('0x1a')]=qs[_0x67e5('0x1a')](_0x20480e[_0x67e5('0x2c')]['limit']);_0x17c0fb[_0x67e5('0x1c')]=qs[_0x67e5('0x1c')](_0x20480e[_0x67e5('0x2c')][_0x67e5('0x1c')]);}return _0x3c2e6a['getTags'](_0x17c0fb);}})[_0x67e5('0x23')](function(_0x149acb){if(_0x149acb){return _0x149acb?{'count':_0x1fb7c3,'rows':_0x149acb}:null;}})[_0x67e5('0x23')](respondWithResult(_0x1f077f,null))[_0x67e5('0x3e')](handleError(_0x1f077f,null));};exports[_0x67e5('0x4d')]=function(_0x36962e,_0x4df7cd,_0x5ef7a7){if(_0x36962e[_0x67e5('0x44')]['id']){delete _0x36962e[_0x67e5('0x44')]['id'];}return db[_0x67e5('0x3b')][_0x67e5('0x45')]({'where':{'id':_0x36962e[_0x67e5('0x3f')]['id']}})[_0x67e5('0x23')](handleEntityNotFound(_0x4df7cd,null))[_0x67e5('0x23')](function(_0x56dd06){if(_0x56dd06){return _0x56dd06[_0x67e5('0x4d')](_0x36962e[_0x67e5('0x44')][_0x67e5('0x4e')]||[]);}return null;})[_0x67e5('0x23')](respondWithResult(_0x4df7cd,null))[_0x67e5('0x3e')](handleError(_0x4df7cd,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 5667e30..7855d72 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 _0xa571=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x16acae,_0x435057){var _0x332bc8=function(_0x249db5){while(--_0x249db5){_0x16acae['push'](_0x16acae['shift']());}};_0x332bc8(++_0x435057);}(_0xa571,0x107));var _0x1a57=function(_0x574308,_0x447878){_0x574308=_0x574308-0x0;var _0x233bb4=_0xa571[_0x574308];return _0x233bb4;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var logger=require(_0x1a57('0x2'))(_0x1a57('0x3'));var moment=require('moment');var BPromise=require(_0x1a57('0x4'));var rp=require(_0x1a57('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a57('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x1a57('0x7')]=function(_0xd97a33,_0x22ca20){return _0xd97a33[_0x1a57('0x8')](_0x1a57('0x9'),attributes,{'tableName':_0x1a57('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x896e=['request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x636182,_0x2a4a51){var _0x1ad511=function(_0x4a8767){while(--_0x4a8767){_0x636182['push'](_0x636182['shift']());}};_0x1ad511(++_0x2a4a51);}(_0x896e,0x1e9));var _0xe896=function(_0xcc731e,_0xf23f09){_0xcc731e=_0xcc731e-0x0;var _0x4c445d=_0x896e[_0xcc731e];return _0x4c445d;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var logger=require(_0xe896('0x2'))(_0xe896('0x3'));var moment=require(_0xe896('0x4'));var BPromise=require(_0xe896('0x5'));var rp=require(_0xe896('0x6'));var fs=require('fs');var path=require(_0xe896('0x7'));var rimraf=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var attributes=require(_0xe896('0xa'));module[_0xe896('0xb')]=function(_0x52ac80,_0x24c430){return _0x52ac80[_0xe896('0xc')](_0xe896('0xd'),attributes,{'tableName':_0xe896('0xe'),'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 673e076..cca5a1b 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 _0x905b=['request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http'];(function(_0x22377a,_0x3397cb){var _0x36f105=function(_0x2174cc){while(--_0x2174cc){_0x22377a['push'](_0x22377a['shift']());}};_0x36f105(++_0x3397cb);}(_0x905b,0xde));var _0xb905=function(_0x2c7755,_0x474ce2){_0x2c7755=_0x2c7755-0x0;var _0x3b1993=_0x905b[_0x2c7755];return _0x3b1993;};'use strict';var _=require('lodash');var util=require(_0xb905('0x0'));var moment=require(_0xb905('0x1'));var BPromise=require(_0xb905('0x2'));var rs=require(_0xb905('0x3'));var fs=require('fs');var Redis=require(_0xb905('0x4'));var db=require(_0xb905('0x5'))['db'];var utils=require(_0xb905('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb905('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb905('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x285dab,_0x5a5b98,_0x1969d9){return new BPromise(function(_0x42bd6b,_0x5a45e6){return client[_0xb905('0x9')](_0x285dab,_0x1969d9)[_0xb905('0xa')](function(_0x275169){logger[_0xb905('0xb')](_0xb905('0xc'),_0x5a5b98,_0xb905('0xd'));logger['debug'](_0xb905('0xe'),_0x5a5b98,_0xb905('0xd'),JSON[_0xb905('0xf')](_0x275169));if(_0x275169[_0xb905('0x10')]){if(_0x275169['error'][_0xb905('0x11')]===0x1f4){logger['error'](_0xb905('0xc'),_0x5a5b98,_0x275169['error'][_0xb905('0x12')]);return _0x5a45e6(_0x275169['error'][_0xb905('0x12')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x5a5b98,_0x275169['error'][_0xb905('0x12')]);return _0x42bd6b(_0x275169['error']['message']);}else{logger[_0xb905('0xb')](_0xb905('0xc'),_0x5a5b98,_0xb905('0xd'));_0x42bd6b(_0x275169[_0xb905('0x13')]['message']);}})[_0xb905('0x14')](function(_0x2e13fc){logger[_0xb905('0x10')](_0xb905('0xc'),_0x5a5b98,_0x2e13fc);_0x5a45e6(_0x2e13fc);});});} \ No newline at end of file +var _0x53e2=['request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x281cae,_0x4f41df){var _0x2b4273=function(_0x269cff){while(--_0x269cff){_0x281cae['push'](_0x281cae['shift']());}};_0x2b4273(++_0x4f41df);}(_0x53e2,0x1dc));var _0x253e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x53e2[_0x19950b];return _0x3c6b41;};'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(_0x253e('0x0'));var db=require(_0x253e('0x1'))['db'];var utils=require(_0x253e('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x253e('0x3'));var jayson=require(_0x253e('0x4'));var client=jayson['client'][_0x253e('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x4a4088,_0x2ede57,_0x30571c){return new BPromise(function(_0x363454,_0x6d24bd){return client[_0x253e('0x6')](_0x4a4088,_0x30571c)[_0x253e('0x7')](function(_0x37161b){logger[_0x253e('0x8')](_0x253e('0x9'),_0x2ede57,_0x253e('0xa'));logger[_0x253e('0xb')](_0x253e('0xc'),_0x2ede57,'request\x20sent',JSON[_0x253e('0xd')](_0x37161b));if(_0x37161b[_0x253e('0xe')]){if(_0x37161b['error']['code']===0x1f4){logger[_0x253e('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2ede57,_0x37161b[_0x253e('0xe')]['message']);return _0x6d24bd(_0x37161b['error'][_0x253e('0xf')]);}logger[_0x253e('0xe')](_0x253e('0x9'),_0x2ede57,_0x37161b['error'][_0x253e('0xf')]);return _0x363454(_0x37161b[_0x253e('0xe')][_0x253e('0xf')]);}else{logger[_0x253e('0x8')](_0x253e('0x9'),_0x2ede57,_0x253e('0xa'));_0x363454(_0x37161b[_0x253e('0x10')][_0x253e('0xf')]);}})[_0x253e('0x11')](function(_0x202e78){logger['error'](_0x253e('0x9'),_0x2ede57,_0x202e78);_0x6d24bd(_0x202e78);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index e488b18..7fa3835 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 _0xc482=['express','Router','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','connect-timeout'];(function(_0x3c9ee3,_0x503258){var _0x20cd89=function(_0x3a9c11){while(--_0x3a9c11){_0x3c9ee3['push'](_0x3c9ee3['shift']());}};_0x20cd89(++_0x503258);}(_0xc482,0x130));var _0x2c48=function(_0x34b9f0,_0x5768d8){_0x34b9f0=_0x34b9f0-0x0;var _0x395b22=_0xc482[_0x34b9f0];return _0x395b22;};'use strict';var multer=require(_0x2c48('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2c48('0x1'));var express=require(_0x2c48('0x2'));var router=express[_0x2c48('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2c48('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2c48('0x5'));var controller=require(_0x2c48('0x6'));router[_0x2c48('0x7')]('/',auth[_0x2c48('0x8')](),controller[_0x2c48('0x9')]);router[_0x2c48('0x7')](_0x2c48('0xa'),auth[_0x2c48('0x8')](),controller[_0x2c48('0xb')]);router[_0x2c48('0xc')]('/',auth[_0x2c48('0x8')](),controller[_0x2c48('0xd')]);router['put'](_0x2c48('0xa'),auth[_0x2c48('0x8')](),controller[_0x2c48('0xe')]);router['delete']('/:id',auth[_0x2c48('0x8')](),controller[_0x2c48('0xf')]);module[_0x2c48('0x10')]=router; \ No newline at end of file +var _0xdf15=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0xae4b08,_0x21101e){var _0x527e7d=function(_0x4e4579){while(--_0x4e4579){_0xae4b08['push'](_0xae4b08['shift']());}};_0x527e7d(++_0x21101e);}(_0xdf15,0xe4));var _0x5df1=function(_0x4006d1,_0x45903f){_0x4006d1=_0x4006d1-0x0;var _0x1d8115=_0xdf15[_0x4006d1];return _0x1d8115;};'use strict';var multer=require(_0x5df1('0x0'));var util=require(_0x5df1('0x1'));var path=require(_0x5df1('0x2'));var timeout=require(_0x5df1('0x3'));var express=require(_0x5df1('0x4'));var router=express[_0x5df1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5df1('0x6'));var interaction=require(_0x5df1('0x7'));var config=require('../../config/environment');var controller=require(_0x5df1('0x8'));router['get']('/',auth[_0x5df1('0x9')](),controller[_0x5df1('0xa')]);router[_0x5df1('0xb')](_0x5df1('0xc'),auth['isAuthenticated'](),controller[_0x5df1('0xd')]);router[_0x5df1('0xe')]('/',auth[_0x5df1('0x9')](),controller[_0x5df1('0xf')]);router[_0x5df1('0x10')](_0x5df1('0xc'),auth['isAuthenticated'](),controller[_0x5df1('0x11')]);router[_0x5df1('0x12')](_0x5df1('0xc'),auth[_0x5df1('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 157b212..acf8514 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 _0x59fd=['sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x2ab587,_0x2a800e){var _0x201242=function(_0x64a793){while(--_0x64a793){_0x2ab587['push'](_0x2ab587['shift']());}};_0x201242(++_0x2a800e);}(_0x59fd,0x1c8));var _0xd59f=function(_0x5b15e9,_0x287dae){_0x5b15e9=_0x5b15e9-0x0;var _0x3681c3=_0x59fd[_0x5b15e9];return _0x3681c3;};'use strict';var Sequelize=require(_0xd59f('0x0'));module[_0xd59f('0x1')]={'type':{'type':Sequelize[_0xd59f('0x2')](_0xd59f('0x3'),_0xd59f('0x4'),'customVariable',_0xd59f('0x5'),_0xd59f('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd59f('0x7')]},'key':{'type':Sequelize[_0xd59f('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xd59f('0x3'),_0xd59f('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xd59f('0x7')]},'idField':{'type':Sequelize[_0xd59f('0x7')]},'nameField':{'type':Sequelize[_0xd59f('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd59f('0x7')]}}; \ No newline at end of file +var _0xd37d=['keyValue','picklist','STRING','ENUM','customVariable','sequelize','exports','string','variable'];(function(_0x359e25,_0x1b276a){var _0x17a7ea=function(_0x4a49f9){while(--_0x4a49f9){_0x359e25['push'](_0x359e25['shift']());}};_0x17a7ea(++_0x1b276a);}(_0xd37d,0x19a));var _0xdd37=function(_0x5b89c7,_0x22994c){_0x5b89c7=_0x5b89c7-0x0;var _0x332b50=_0xd37d[_0x5b89c7];return _0x332b50;};'use strict';var Sequelize=require(_0xdd37('0x0'));module[_0xdd37('0x1')]={'type':{'type':Sequelize['ENUM'](_0xdd37('0x2'),_0xdd37('0x3'),'customVariable',_0xdd37('0x4'),_0xdd37('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xdd37('0x6')]},'key':{'type':Sequelize[_0xdd37('0x6')]},'keyType':{'type':Sequelize[_0xdd37('0x7')](_0xdd37('0x2'),_0xdd37('0x3'),_0xdd37('0x8'))},'keyContent':{'type':Sequelize[_0xdd37('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdd37('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 9ce6777..bd5f153 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 _0xd84c=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','name','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','findAll','catch','show','params','includeAll','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x432302,_0x53a719){var _0x20f183=function(_0x2adc6b){while(--_0x2adc6b){_0x432302['push'](_0x432302['shift']());}};_0x20f183(++_0x53a719);}(_0xd84c,0x102));var _0xcd84=function(_0x3ff598,_0x232ce4){_0x3ff598=_0x3ff598-0x0;var _0x1089cc=_0xd84c[_0x3ff598];return _0x1089cc;};'use strict';var emlformat=require(_0xcd84('0x0'));var rimraf=require(_0xcd84('0x1'));var zipdir=require(_0xcd84('0x2'));var jsonpatch=require(_0xcd84('0x3'));var rp=require(_0xcd84('0x4'));var moment=require(_0xcd84('0x5'));var BPromise=require(_0xcd84('0x6'));var Mustache=require(_0xcd84('0x7'));var util=require(_0xcd84('0x8'));var path=require('path');var sox=require(_0xcd84('0x9'));var csv=require(_0xcd84('0xa'));var ejs=require(_0xcd84('0xb'));var fs=require('fs');var fs_extra=require(_0xcd84('0xc'));var _=require('lodash');var squel=require(_0xcd84('0xd'));var crypto=require(_0xcd84('0xe'));var jsforce=require(_0xcd84('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xcd84('0xa'));var querystring=require(_0xcd84('0x10'));var Papa=require(_0xcd84('0x11'));var Redis=require(_0xcd84('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcd84('0x13'));var as=require(_0xcd84('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd84('0x15'))(_0xcd84('0x16'));var utils=require(_0xcd84('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcd84('0x18'));var db=require(_0xcd84('0x19'))['db'];function respondWithStatusCode(_0x6fcec,_0x116423){_0x116423=_0x116423||0xcc;return function(_0x4e1291){if(_0x4e1291){return _0x6fcec[_0xcd84('0x1a')](_0x116423);}return _0x6fcec[_0xcd84('0x1b')](_0x116423)[_0xcd84('0x1c')]();};}function respondWithResult(_0x3ccf60,_0x1271b4){_0x1271b4=_0x1271b4||0xc8;return function(_0x100a7b){if(_0x100a7b){return _0x3ccf60[_0xcd84('0x1b')](_0x1271b4)[_0xcd84('0x1d')](_0x100a7b);}};}function respondWithFilteredResult(_0xcc47a6,_0x45a92e){return function(_0x223127){if(_0x223127){var _0x23b116=typeof _0x45a92e[_0xcd84('0x1e')]===_0xcd84('0x1f')&&typeof _0x45a92e[_0xcd84('0x20')]===_0xcd84('0x1f');var _0x30d51c=_0x223127[_0xcd84('0x21')];var _0x4ff790=_0x23b116?0x0:_0x45a92e[_0xcd84('0x1e')];var _0x15099f=_0x23b116?_0x223127['count']:_0x45a92e[_0xcd84('0x1e')]+_0x45a92e[_0xcd84('0x20')];var _0x1ba160;if(_0x15099f>=_0x30d51c){_0x15099f=_0x30d51c;_0x1ba160=0xc8;}else{_0x1ba160=0xce;}_0xcc47a6[_0xcd84('0x1b')](_0x1ba160);return _0xcc47a6[_0xcd84('0x22')]('Content-Range',_0x4ff790+'-'+_0x15099f+'/'+_0x30d51c)[_0xcd84('0x1d')](_0x223127);}return null;};}function patchUpdates(_0x171813){return function(_0x225e15){try{jsonpatch['apply'](_0x225e15,_0x171813,!![]);}catch(_0x48a90e){return BPromise[_0xcd84('0x23')](_0x48a90e);}return _0x225e15['save']();};}function saveUpdates(_0x3a6f30,_0x20b0ce){return function(_0x5cb006){if(_0x5cb006){return _0x5cb006[_0xcd84('0x24')](_0x3a6f30)[_0xcd84('0x25')](function(_0x16b6ea){return _0x16b6ea;});}return null;};}function removeEntity(_0x13996e,_0x14cf35){return function(_0xfc2a17){if(_0xfc2a17){return _0xfc2a17['destroy']()[_0xcd84('0x25')](function(){_0x13996e[_0xcd84('0x1b')](0xcc)[_0xcd84('0x1c')]();});}};}function handleEntityNotFound(_0xbc0595,_0x243368){return function(_0x40d00a){if(!_0x40d00a){_0xbc0595[_0xcd84('0x1a')](0x194);}return _0x40d00a;};}function handleError(_0x5109b9,_0x5d610b){_0x5d610b=_0x5d610b||0x1f4;return function(_0x1967f6){logger['error'](_0x1967f6['stack']);if(_0x1967f6['name']){delete _0x1967f6[_0xcd84('0x26')];}_0x5109b9[_0xcd84('0x1b')](_0x5d610b)['send'](_0x1967f6);};}exports[_0xcd84('0x27')]=function(_0x3691a6,_0x1f75ac){var _0x5661a4={},_0x33fc4f={},_0x5d4bff={'count':0x0,'rows':[]};var _0x288cdd=_[_0xcd84('0x28')](db[_0xcd84('0x29')][_0xcd84('0x2a')],function(_0x42e649){return{'name':_0x42e649[_0xcd84('0x2b')],'type':_0x42e649[_0xcd84('0x2c')][_0xcd84('0x2d')]};});_0x33fc4f[_0xcd84('0x2e')]=_[_0xcd84('0x28')](_0x288cdd,_0xcd84('0x26'));_0x33fc4f[_0xcd84('0x2f')]=_['keys'](_0x3691a6[_0xcd84('0x2f')]);_0x33fc4f[_0xcd84('0x30')]=_[_0xcd84('0x31')](_0x33fc4f[_0xcd84('0x2e')],_0x33fc4f['query']);_0x5661a4[_0xcd84('0x32')]=_[_0xcd84('0x31')](_0x33fc4f[_0xcd84('0x2e')],qs[_0xcd84('0x33')](_0x3691a6[_0xcd84('0x2f')]['fields']));_0x5661a4[_0xcd84('0x32')]=_0x5661a4[_0xcd84('0x32')][_0xcd84('0x34')]?_0x5661a4[_0xcd84('0x32')]:_0x33fc4f[_0xcd84('0x2e')];if(!_0x3691a6[_0xcd84('0x2f')][_0xcd84('0x35')]('nolimit')){_0x5661a4[_0xcd84('0x20')]=qs[_0xcd84('0x20')](_0x3691a6['query'][_0xcd84('0x20')]);_0x5661a4['offset']=qs[_0xcd84('0x1e')](_0x3691a6[_0xcd84('0x2f')][_0xcd84('0x1e')]);}_0x5661a4[_0xcd84('0x36')]=qs[_0xcd84('0x37')](_0x3691a6[_0xcd84('0x2f')][_0xcd84('0x37')]);_0x5661a4[_0xcd84('0x38')]=qs[_0xcd84('0x30')](_[_0xcd84('0x39')](_0x3691a6[_0xcd84('0x2f')],_0x33fc4f[_0xcd84('0x30')]),_0x288cdd);if(_0x3691a6[_0xcd84('0x2f')][_0xcd84('0x3a')]){_0x5661a4[_0xcd84('0x38')]=_['merge'](_0x5661a4[_0xcd84('0x38')],{'$or':_['map'](_0x288cdd,function(_0x47f1c1){if(_0x47f1c1[_0xcd84('0x2c')]!==_0xcd84('0x3b')){var _0x1a8bbb={};_0x1a8bbb[_0x47f1c1[_0xcd84('0x26')]]={'$like':'%'+_0x3691a6['query']['filter']+'%'};return _0x1a8bbb;}})});}_0x5661a4=_[_0xcd84('0x3c')]({},_0x5661a4,_0x3691a6['options']);var _0x36628f={'where':_0x5661a4[_0xcd84('0x38')]};return db['ZendeskField'][_0xcd84('0x21')](_0x36628f)['then'](function(_0x34a6ee){_0x5d4bff[_0xcd84('0x21')]=_0x34a6ee;if(_0x3691a6[_0xcd84('0x2f')]['includeAll']){_0x5661a4['include']=[{'all':!![]}];}return db[_0xcd84('0x29')][_0xcd84('0x3d')](_0x5661a4);})[_0xcd84('0x25')](function(_0x449024){_0x5d4bff['rows']=_0x449024;return _0x5d4bff;})[_0xcd84('0x25')](respondWithFilteredResult(_0x1f75ac,_0x5661a4))[_0xcd84('0x3e')](handleError(_0x1f75ac,null));};exports[_0xcd84('0x3f')]=function(_0x1f8bdd,_0x3fc17d){var _0x1254cd={'raw':!![],'where':{'id':_0x1f8bdd[_0xcd84('0x40')]['id']}},_0x38d17d={};_0x38d17d[_0xcd84('0x2e')]=_['keys'](db[_0xcd84('0x29')]['rawAttributes']);_0x38d17d[_0xcd84('0x2f')]=_['keys'](_0x1f8bdd[_0xcd84('0x2f')]);_0x38d17d[_0xcd84('0x30')]=_['intersection'](_0x38d17d['model'],_0x38d17d[_0xcd84('0x2f')]);_0x1254cd[_0xcd84('0x32')]=_[_0xcd84('0x31')](_0x38d17d['model'],qs['fields'](_0x1f8bdd[_0xcd84('0x2f')]['fields']));_0x1254cd[_0xcd84('0x32')]=_0x1254cd[_0xcd84('0x32')]['length']?_0x1254cd[_0xcd84('0x32')]:_0x38d17d[_0xcd84('0x2e')];if(_0x1f8bdd['query'][_0xcd84('0x41')]){_0x1254cd[_0xcd84('0x42')]=[{'all':!![]}];}_0x1254cd=_[_0xcd84('0x3c')]({},_0x1254cd,_0x1f8bdd['options']);return db['ZendeskField']['find'](_0x1254cd)[_0xcd84('0x25')](handleEntityNotFound(_0x3fc17d,null))[_0xcd84('0x25')](respondWithResult(_0x3fc17d,null))[_0xcd84('0x3e')](handleError(_0x3fc17d,null));};exports[_0xcd84('0x43')]=function(_0x110019,_0x5d44ff){return db['ZendeskField'][_0xcd84('0x43')](_0x110019[_0xcd84('0x44')],{})['then'](respondWithResult(_0x5d44ff,0xc9))['catch'](handleError(_0x5d44ff,null));};exports[_0xcd84('0x24')]=function(_0x279af5,_0x1b3ee1){if(_0x279af5[_0xcd84('0x44')]['id']){delete _0x279af5[_0xcd84('0x44')]['id'];}return db[_0xcd84('0x29')][_0xcd84('0x45')]({'where':{'id':_0x279af5[_0xcd84('0x40')]['id']}})[_0xcd84('0x25')](handleEntityNotFound(_0x1b3ee1,null))[_0xcd84('0x25')](saveUpdates(_0x279af5[_0xcd84('0x44')],null))['then'](respondWithResult(_0x1b3ee1,null))[_0xcd84('0x3e')](handleError(_0x1b3ee1,null));};exports['destroy']=function(_0x20f25d,_0x4c50df){return db[_0xcd84('0x29')]['find']({'where':{'id':_0x20f25d[_0xcd84('0x40')]['id']}})['then'](handleEntityNotFound(_0x4c50df,null))[_0xcd84('0x25')](removeEntity(_0x4c50df,null))[_0xcd84('0x3e')](handleError(_0x4c50df,null));}; \ No newline at end of file +var _0x83aa=['send','index','map','ZendeskField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','stack','name'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x83aa,0x17f));var _0xa83a=function(_0x4be876,_0xd390b0){_0x4be876=_0x4be876-0x0;var _0x34dda2=_0x83aa[_0x4be876];return _0x34dda2;};'use strict';var emlformat=require(_0xa83a('0x0'));var rimraf=require(_0xa83a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa83a('0x2'));var rp=require(_0xa83a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa83a('0x4'));var sox=require(_0xa83a('0x5'));var csv=require(_0xa83a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa83a('0x7'));var squel=require(_0xa83a('0x8'));var crypto=require(_0xa83a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa83a('0xa'));var toCsv=require(_0xa83a('0x6'));var querystring=require(_0xa83a('0xb'));var Papa=require(_0xa83a('0xc'));var Redis=require(_0xa83a('0xd'));var authService=require(_0xa83a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xa83a('0xf'));var hardwareService=require(_0xa83a('0x10'));var logger=require('../../config/logger')(_0xa83a('0x11'));var utils=require(_0xa83a('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa83a('0x13'))['db'];function respondWithStatusCode(_0x2e1e7f,_0x5add37){_0x5add37=_0x5add37||0xcc;return function(_0x1c933c){if(_0x1c933c){return _0x2e1e7f[_0xa83a('0x14')](_0x5add37);}return _0x2e1e7f[_0xa83a('0x15')](_0x5add37)[_0xa83a('0x16')]();};}function respondWithResult(_0x2c7724,_0x3b78ba){_0x3b78ba=_0x3b78ba||0xc8;return function(_0x5500ad){if(_0x5500ad){return _0x2c7724[_0xa83a('0x15')](_0x3b78ba)[_0xa83a('0x17')](_0x5500ad);}};}function respondWithFilteredResult(_0xbef76,_0x2ab9dd){return function(_0x39b4d6){if(_0x39b4d6){var _0x2afb9c=typeof _0x2ab9dd['offset']===_0xa83a('0x18')&&typeof _0x2ab9dd['limit']===_0xa83a('0x18');var _0x19045e=_0x39b4d6[_0xa83a('0x19')];var _0x288ae8=_0x2afb9c?0x0:_0x2ab9dd[_0xa83a('0x1a')];var _0xe0070b=_0x2afb9c?_0x39b4d6[_0xa83a('0x19')]:_0x2ab9dd['offset']+_0x2ab9dd['limit'];var _0x3934fc;if(_0xe0070b>=_0x19045e){_0xe0070b=_0x19045e;_0x3934fc=0xc8;}else{_0x3934fc=0xce;}_0xbef76[_0xa83a('0x15')](_0x3934fc);return _0xbef76[_0xa83a('0x1b')](_0xa83a('0x1c'),_0x288ae8+'-'+_0xe0070b+'/'+_0x19045e)[_0xa83a('0x17')](_0x39b4d6);}return null;};}function patchUpdates(_0x114ac0){return function(_0x4eec67){try{jsonpatch[_0xa83a('0x1d')](_0x4eec67,_0x114ac0,!![]);}catch(_0x19539d){return BPromise[_0xa83a('0x1e')](_0x19539d);}return _0x4eec67[_0xa83a('0x1f')]();};}function saveUpdates(_0x43ef67,_0x524b5c){return function(_0x3716bd){if(_0x3716bd){return _0x3716bd[_0xa83a('0x20')](_0x43ef67)['then'](function(_0x56d2c3){return _0x56d2c3;});}return null;};}function removeEntity(_0x7df257,_0x45f821){return function(_0x1e709b){if(_0x1e709b){return _0x1e709b[_0xa83a('0x21')]()[_0xa83a('0x22')](function(){_0x7df257[_0xa83a('0x15')](0xcc)[_0xa83a('0x16')]();});}};}function handleEntityNotFound(_0x3b4e08,_0x1cf193){return function(_0x215092){if(!_0x215092){_0x3b4e08[_0xa83a('0x14')](0x194);}return _0x215092;};}function handleError(_0x5ba28e,_0xb478a6){_0xb478a6=_0xb478a6||0x1f4;return function(_0x4cf312){logger['error'](_0x4cf312[_0xa83a('0x23')]);if(_0x4cf312[_0xa83a('0x24')]){delete _0x4cf312['name'];}_0x5ba28e[_0xa83a('0x15')](_0xb478a6)[_0xa83a('0x25')](_0x4cf312);};}exports[_0xa83a('0x26')]=function(_0x2210a4,_0x66deba){var _0x33ca3c={},_0x5c012e={},_0x596468={'count':0x0,'rows':[]};var _0x56d939=_[_0xa83a('0x27')](db[_0xa83a('0x28')]['rawAttributes'],function(_0x12a79e){return{'name':_0x12a79e[_0xa83a('0x29')],'type':_0x12a79e[_0xa83a('0x2a')][_0xa83a('0x2b')]};});_0x5c012e[_0xa83a('0x2c')]=_[_0xa83a('0x27')](_0x56d939,'name');_0x5c012e[_0xa83a('0x2d')]=_[_0xa83a('0x2e')](_0x2210a4[_0xa83a('0x2d')]);_0x5c012e[_0xa83a('0x2f')]=_[_0xa83a('0x30')](_0x5c012e[_0xa83a('0x2c')],_0x5c012e['query']);_0x33ca3c['attributes']=_['intersection'](_0x5c012e['model'],qs[_0xa83a('0x31')](_0x2210a4['query'][_0xa83a('0x31')]));_0x33ca3c[_0xa83a('0x32')]=_0x33ca3c['attributes'][_0xa83a('0x33')]?_0x33ca3c[_0xa83a('0x32')]:_0x5c012e[_0xa83a('0x2c')];if(!_0x2210a4['query']['hasOwnProperty']('nolimit')){_0x33ca3c[_0xa83a('0x34')]=qs[_0xa83a('0x34')](_0x2210a4[_0xa83a('0x2d')][_0xa83a('0x34')]);_0x33ca3c[_0xa83a('0x1a')]=qs[_0xa83a('0x1a')](_0x2210a4['query']['offset']);}_0x33ca3c[_0xa83a('0x35')]=qs[_0xa83a('0x36')](_0x2210a4[_0xa83a('0x2d')]['sort']);_0x33ca3c[_0xa83a('0x37')]=qs['filters'](_[_0xa83a('0x38')](_0x2210a4[_0xa83a('0x2d')],_0x5c012e[_0xa83a('0x2f')]),_0x56d939);if(_0x2210a4[_0xa83a('0x2d')][_0xa83a('0x39')]){_0x33ca3c[_0xa83a('0x37')]=_[_0xa83a('0x3a')](_0x33ca3c[_0xa83a('0x37')],{'$or':_['map'](_0x56d939,function(_0x747260){if(_0x747260[_0xa83a('0x2a')]!==_0xa83a('0x3b')){var _0x16090e={};_0x16090e[_0x747260[_0xa83a('0x24')]]={'$like':'%'+_0x2210a4[_0xa83a('0x2d')]['filter']+'%'};return _0x16090e;}})});}_0x33ca3c=_['merge']({},_0x33ca3c,_0x2210a4['options']);var _0x4fce63={'where':_0x33ca3c['where']};return db[_0xa83a('0x28')]['count'](_0x4fce63)[_0xa83a('0x22')](function(_0x452e85){_0x596468[_0xa83a('0x19')]=_0x452e85;if(_0x2210a4['query'][_0xa83a('0x3c')]){_0x33ca3c['include']=[{'all':!![]}];}return db[_0xa83a('0x28')]['findAll'](_0x33ca3c);})[_0xa83a('0x22')](function(_0x1e95ee){_0x596468[_0xa83a('0x3d')]=_0x1e95ee;return _0x596468;})[_0xa83a('0x22')](respondWithFilteredResult(_0x66deba,_0x33ca3c))[_0xa83a('0x3e')](handleError(_0x66deba,null));};exports[_0xa83a('0x3f')]=function(_0x1fb980,_0x5ab44b){var _0x4d144a={'raw':!![],'where':{'id':_0x1fb980[_0xa83a('0x40')]['id']}},_0x5564d6={};_0x5564d6[_0xa83a('0x2c')]=_[_0xa83a('0x2e')](db[_0xa83a('0x28')]['rawAttributes']);_0x5564d6['query']=_[_0xa83a('0x2e')](_0x1fb980[_0xa83a('0x2d')]);_0x5564d6['filters']=_[_0xa83a('0x30')](_0x5564d6[_0xa83a('0x2c')],_0x5564d6[_0xa83a('0x2d')]);_0x4d144a[_0xa83a('0x32')]=_[_0xa83a('0x30')](_0x5564d6['model'],qs[_0xa83a('0x31')](_0x1fb980[_0xa83a('0x2d')]['fields']));_0x4d144a['attributes']=_0x4d144a[_0xa83a('0x32')]['length']?_0x4d144a[_0xa83a('0x32')]:_0x5564d6[_0xa83a('0x2c')];if(_0x1fb980[_0xa83a('0x2d')][_0xa83a('0x3c')]){_0x4d144a[_0xa83a('0x41')]=[{'all':!![]}];}_0x4d144a=_['merge']({},_0x4d144a,_0x1fb980[_0xa83a('0x42')]);return db[_0xa83a('0x28')][_0xa83a('0x43')](_0x4d144a)[_0xa83a('0x22')](handleEntityNotFound(_0x5ab44b,null))['then'](respondWithResult(_0x5ab44b,null))[_0xa83a('0x3e')](handleError(_0x5ab44b,null));};exports['create']=function(_0xc9b11d,_0x238663){return db[_0xa83a('0x28')][_0xa83a('0x44')](_0xc9b11d[_0xa83a('0x45')],{})[_0xa83a('0x22')](respondWithResult(_0x238663,0xc9))[_0xa83a('0x3e')](handleError(_0x238663,null));};exports[_0xa83a('0x20')]=function(_0x146ea1,_0x4d297c){if(_0x146ea1[_0xa83a('0x45')]['id']){delete _0x146ea1[_0xa83a('0x45')]['id'];}return db[_0xa83a('0x28')][_0xa83a('0x43')]({'where':{'id':_0x146ea1['params']['id']}})[_0xa83a('0x22')](handleEntityNotFound(_0x4d297c,null))[_0xa83a('0x22')](saveUpdates(_0x146ea1[_0xa83a('0x45')],null))[_0xa83a('0x22')](respondWithResult(_0x4d297c,null))[_0xa83a('0x3e')](handleError(_0x4d297c,null));};exports['destroy']=function(_0x162707,_0x439594){return db[_0xa83a('0x28')][_0xa83a('0x43')]({'where':{'id':_0x162707[_0xa83a('0x40')]['id']}})[_0xa83a('0x22')](handleEntityNotFound(_0x439594,null))[_0xa83a('0x22')](removeEntity(_0x439594,null))['catch'](handleError(_0x439594,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 03fe1ef..08dc6e9 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 _0x24c7=['path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x28c951,_0x1bc767){var _0x4afcba=function(_0x1484ea){while(--_0x1484ea){_0x28c951['push'](_0x28c951['shift']());}};_0x4afcba(++_0x1bc767);}(_0x24c7,0xfa));var _0x724c=function(_0x13fe91,_0x2171fa){_0x13fe91=_0x13fe91-0x0;var _0x1c119d=_0x24c7[_0x13fe91];return _0x1c119d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x724c('0x0'))(_0x724c('0x1'));var moment=require(_0x724c('0x2'));var BPromise=require(_0x724c('0x3'));var rp=require(_0x724c('0x4'));var fs=require('fs');var path=require(_0x724c('0x5'));var rimraf=require(_0x724c('0x6'));var config=require(_0x724c('0x7'));var attributes=require(_0x724c('0x8'));module[_0x724c('0x9')]=function(_0x36cd9c,_0x4c391e){return _0x36cd9c[_0x724c('0xa')](_0x724c('0xb'),attributes,{'tableName':_0x724c('0xc'),'paranoid':![],'indexes':[{'name':_0x724c('0xd'),'fields':['idField',_0x724c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0714=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','zendesk_unique_index','lodash','../../config/logger'];(function(_0x1eede2,_0x2e784a){var _0x5efce9=function(_0x3b813c){while(--_0x3b813c){_0x1eede2['push'](_0x1eede2['shift']());}};_0x5efce9(++_0x2e784a);}(_0x0714,0x82));var _0x4071=function(_0x67758f,_0x8fc682){_0x67758f=_0x67758f-0x0;var _0x40265d=_0x0714[_0x67758f];return _0x40265d;};'use strict';var _=require(_0x4071('0x0'));var util=require('util');var logger=require(_0x4071('0x1'))(_0x4071('0x2'));var moment=require(_0x4071('0x3'));var BPromise=require(_0x4071('0x4'));var rp=require(_0x4071('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4071('0x6'));var config=require(_0x4071('0x7'));var attributes=require(_0x4071('0x8'));module['exports']=function(_0x58962b,_0x2b5e2c){return _0x58962b[_0x4071('0x9')](_0x4071('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x4071('0xb'),'fields':['idField','FieldId'],'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 5f2dd8e..6753952 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 _0xc39c=['ZendeskField,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','info','request\x20sent','debug','stringify','code','error'];(function(_0x3a1431,_0x38212c){var _0x4856b9=function(_0x3386c7){while(--_0x3386c7){_0x3a1431['push'](_0x3a1431['shift']());}};_0x4856b9(++_0x38212c);}(_0xc39c,0x147));var _0xcc39=function(_0x5e019e,_0x221332){_0x5e019e=_0x5e019e-0x0;var _0x1115a2=_0xc39c[_0x5e019e];return _0x1115a2;};'use strict';var _=require('lodash');var util=require(_0xcc39('0x0'));var moment=require('moment');var BPromise=require(_0xcc39('0x1'));var rs=require(_0xcc39('0x2'));var fs=require('fs');var Redis=require(_0xcc39('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc39('0x4'));var logger=require('../../config/logger')(_0xcc39('0x5'));var config=require(_0xcc39('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcc39('0x7')][_0xcc39('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x392aad,_0x2028d3,_0x5776ab){return new BPromise(function(_0x473452,_0x1b0404){return client['request'](_0x392aad,_0x5776ab)['then'](function(_0x273d17){logger[_0xcc39('0x9')]('ZendeskField,\x20%s,\x20%s',_0x2028d3,_0xcc39('0xa'));logger[_0xcc39('0xb')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x2028d3,_0xcc39('0xa'),JSON[_0xcc39('0xc')](_0x273d17));if(_0x273d17['error']){if(_0x273d17['error'][_0xcc39('0xd')]===0x1f4){logger[_0xcc39('0xe')](_0xcc39('0xf'),_0x2028d3,_0x273d17[_0xcc39('0xe')]['message']);return _0x1b0404(_0x273d17[_0xcc39('0xe')]['message']);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x2028d3,_0x273d17[_0xcc39('0xe')][_0xcc39('0x10')]);return _0x473452(_0x273d17[_0xcc39('0xe')][_0xcc39('0x10')]);}else{logger[_0xcc39('0x9')](_0xcc39('0xf'),_0x2028d3,_0xcc39('0xa'));_0x473452(_0x273d17[_0xcc39('0x11')][_0xcc39('0x10')]);}})[_0xcc39('0x12')](function(_0x4ea5df){logger[_0xcc39('0xe')]('ZendeskField,\x20%s,\x20%s',_0x2028d3,_0x4ea5df);_0x1b0404(_0x4ea5df);});});} \ No newline at end of file +var _0xae60=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s'];(function(_0xffad61,_0x5f0282){var _0x33ef10=function(_0x54fde3){while(--_0x54fde3){_0xffad61['push'](_0xffad61['shift']());}};_0x33ef10(++_0x5f0282);}(_0xae60,0x11a));var _0x0ae6=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xae60[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var moment=require(_0x0ae6('0x2'));var BPromise=require(_0x0ae6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ae6('0x4'));var db=require(_0x0ae6('0x5'))['db'];var utils=require(_0x0ae6('0x6'));var logger=require('../../config/logger')(_0x0ae6('0x7'));var config=require(_0x0ae6('0x8'));var jayson=require(_0x0ae6('0x9'));var client=jayson['client'][_0x0ae6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2aec98,_0x3b0c8d,_0x5f1a55){return new BPromise(function(_0x41b08c,_0x392d04){return client['request'](_0x2aec98,_0x5f1a55)[_0x0ae6('0xb')](function(_0xb5d600){logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0x3b0c8d,_0x0ae6('0xe'));logger[_0x0ae6('0xf')](_0x0ae6('0x10'),_0x3b0c8d,_0x0ae6('0xe'),JSON[_0x0ae6('0x11')](_0xb5d600));if(_0xb5d600['error']){if(_0xb5d600[_0x0ae6('0x12')][_0x0ae6('0x13')]===0x1f4){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0x3b0c8d,_0xb5d600[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x392d04(_0xb5d600[_0x0ae6('0x12')][_0x0ae6('0x14')]);}logger[_0x0ae6('0x12')]('ZendeskField,\x20%s,\x20%s',_0x3b0c8d,_0xb5d600[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x41b08c(_0xb5d600[_0x0ae6('0x12')]['message']);}else{logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0x3b0c8d,'request\x20sent');_0x41b08c(_0xb5d600[_0x0ae6('0x15')][_0x0ae6('0x14')]);}})[_0x0ae6('0x16')](function(_0x3481a9){logger[_0x0ae6('0x12')]('ZendeskField,\x20%s,\x20%s',_0x3b0c8d,_0x3481a9);_0x392d04(_0x3481a9);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 12d9e70..720d30b 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 _0xef83=['get','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x5890df,_0xd00cd9){var _0x22177f=function(_0x577fc4){while(--_0x577fc4){_0x5890df['push'](_0x5890df['shift']());}};_0x22177f(++_0xd00cd9);}(_0xef83,0x165));var _0x3ef8=function(_0x10fd92,_0x3ee81f){_0x10fd92=_0x10fd92-0x0;var _0x13ed3b=_0xef83[_0x10fd92];return _0x13ed3b;};'use strict';var multer=require(_0x3ef8('0x0'));var util=require(_0x3ef8('0x1'));var path=require('path');var timeout=require(_0x3ef8('0x2'));var express=require(_0x3ef8('0x3'));var router=express[_0x3ef8('0x4')]();var fs_extra=require(_0x3ef8('0x5'));var auth=require(_0x3ef8('0x6'));var interaction=require(_0x3ef8('0x7'));var config=require(_0x3ef8('0x8'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0x3ef8('0x9')](),controller[_0x3ef8('0xa')]);router[_0x3ef8('0xb')]('/:id',auth[_0x3ef8('0x9')](),controller[_0x3ef8('0xc')]);router['get'](_0x3ef8('0xd'),auth['isAuthenticated'](),controller[_0x3ef8('0xe')]);router[_0x3ef8('0xb')]('/:id/fields',auth[_0x3ef8('0x9')](),controller[_0x3ef8('0xf')]);router[_0x3ef8('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3ef8('0x10')](_0x3ef8('0xd'),auth[_0x3ef8('0x9')](),controller[_0x3ef8('0x11')]);router[_0x3ef8('0x12')](_0x3ef8('0x13'),auth[_0x3ef8('0x9')](),controller[_0x3ef8('0x14')]);router['delete']('/:id',auth[_0x3ef8('0x9')](),controller[_0x3ef8('0x15')]);module[_0x3ef8('0x16')]=router; \ No newline at end of file +var _0x0f66=['put','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0x0f66,0x142));var _0x60f6=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x0f66[_0xbf8ebe];return _0x1e25e8;};'use strict';var multer=require(_0x60f6('0x0'));var util=require(_0x60f6('0x1'));var path=require('path');var timeout=require(_0x60f6('0x2'));var express=require(_0x60f6('0x3'));var router=express[_0x60f6('0x4')]();var fs_extra=require(_0x60f6('0x5'));var auth=require(_0x60f6('0x6'));var interaction=require(_0x60f6('0x7'));var config=require(_0x60f6('0x8'));var controller=require('./intZohoAccount.controller');router[_0x60f6('0x9')]('/',auth['isAuthenticated'](),controller[_0x60f6('0xa')]);router[_0x60f6('0x9')](_0x60f6('0xb'),auth[_0x60f6('0xc')](),controller[_0x60f6('0xd')]);router[_0x60f6('0x9')](_0x60f6('0xe'),auth['isAuthenticated'](),controller[_0x60f6('0xf')]);router[_0x60f6('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x60f6('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x60f6('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x60f6('0x12')](_0x60f6('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x60f6('0x13')]('/:id',auth[_0x60f6('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 549ba68..a977814 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 _0x4522=['STRING'];(function(_0x4cc0bc,_0x5679b5){var _0x2d45f4=function(_0x5398e7){while(--_0x5398e7){_0x4cc0bc['push'](_0x4cc0bc['shift']());}};_0x2d45f4(++_0x5679b5);}(_0x4522,0x1a0));var _0x2452=function(_0x5c5d03,_0x4c5c60){_0x5c5d03=_0x5c5d03-0x0;var _0x5df0aa=_0x4522[_0x5c5d03];return _0x5df0aa;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2452('0x0')]},'description':{'type':Sequelize[_0x2452('0x0')]},'host':{'type':Sequelize[_0x2452('0x0')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2452('0x0')]},'clientSecret':{'type':Sequelize[_0x2452('0x0')]},'serverUrl':{'type':Sequelize[_0x2452('0x0')],'allowNull':![]},'code':{'type':Sequelize[_0x2452('0x0')]},'refreshToken':{'type':Sequelize[_0x2452('0x0')]}}; \ No newline at end of file +var _0x00bb=['STRING','sequelize','exports'];(function(_0x3d7fee,_0x25a0fd){var _0x921cf2=function(_0x1a733a){while(--_0x1a733a){_0x3d7fee['push'](_0x3d7fee['shift']());}};_0x921cf2(++_0x25a0fd);}(_0x00bb,0x1d8));var _0xb00b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x00bb[_0x501510];return _0x1e6ee5;};'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 223262d..4e63629 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 _0x1e01=['json','offset','limit','undefined','count','set','Content-Range','apply','reject','end','stack','name','send','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','ZohoAccount','findAll','rows','catch','params','keys','include','find','create','update','body','getConfigurations','findOne','addConfiguration','AccountId','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientId','clientSecret','serverUrl','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status'];(function(_0x518e56,_0x34adc0){var _0x893e09=function(_0x56f2d7){while(--_0x56f2d7){_0x518e56['push'](_0x518e56['shift']());}};_0x893e09(++_0x34adc0);}(_0x1e01,0xde));var _0x11e0=function(_0x242603,_0x5c8851){_0x242603=_0x242603-0x0;var _0x1a36a6=_0x1e01[_0x242603];return _0x1a36a6;};'use strict';var emlformat=require(_0x11e0('0x0'));var rimraf=require(_0x11e0('0x1'));var zipdir=require(_0x11e0('0x2'));var jsonpatch=require(_0x11e0('0x3'));var rp=require(_0x11e0('0x4'));var moment=require(_0x11e0('0x5'));var BPromise=require(_0x11e0('0x6'));var Mustache=require('mustache');var util=require(_0x11e0('0x7'));var path=require(_0x11e0('0x8'));var sox=require(_0x11e0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x11e0('0xa'));var _=require(_0x11e0('0xb'));var squel=require(_0x11e0('0xc'));var crypto=require(_0x11e0('0xd'));var jsforce=require(_0x11e0('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x11e0('0xf'));var Papa=require(_0x11e0('0x10'));var Redis=require(_0x11e0('0x11'));var authService=require(_0x11e0('0x12'));var qs=require(_0x11e0('0x13'));var as=require(_0x11e0('0x14'));var hardwareService=require(_0x11e0('0x15'));var logger=require(_0x11e0('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x11e0('0x17'));var licenseUtil=require(_0x11e0('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x11e0('0x19'));function respondWithStatusCode(_0x2b978a,_0x4e08be){_0x4e08be=_0x4e08be||0xcc;return function(_0x271455){if(_0x271455){return _0x2b978a[_0x11e0('0x1a')](_0x4e08be);}return _0x2b978a[_0x11e0('0x1b')](_0x4e08be)['end']();};}function respondWithResult(_0x400cbf,_0x3f385e){_0x3f385e=_0x3f385e||0xc8;return function(_0x200e3d){if(_0x200e3d){return _0x400cbf['status'](_0x3f385e)[_0x11e0('0x1c')](_0x200e3d);}};}function respondWithFilteredResult(_0x39bfd5,_0xcf0b67){return function(_0x400b39){if(_0x400b39){var _0x4cb247=typeof _0xcf0b67[_0x11e0('0x1d')]==='undefined'&&typeof _0xcf0b67[_0x11e0('0x1e')]===_0x11e0('0x1f');var _0xe710c1=_0x400b39[_0x11e0('0x20')];var _0x389e91=_0x4cb247?0x0:_0xcf0b67[_0x11e0('0x1d')];var _0x312fbe=_0x4cb247?_0x400b39['count']:_0xcf0b67['offset']+_0xcf0b67[_0x11e0('0x1e')];var _0x18247d;if(_0x312fbe>=_0xe710c1){_0x312fbe=_0xe710c1;_0x18247d=0xc8;}else{_0x18247d=0xce;}_0x39bfd5[_0x11e0('0x1b')](_0x18247d);return _0x39bfd5[_0x11e0('0x21')](_0x11e0('0x22'),_0x389e91+'-'+_0x312fbe+'/'+_0xe710c1)[_0x11e0('0x1c')](_0x400b39);}return null;};}function patchUpdates(_0x58cb57){return function(_0x4ac0d2){try{jsonpatch[_0x11e0('0x23')](_0x4ac0d2,_0x58cb57,!![]);}catch(_0x288911){return BPromise[_0x11e0('0x24')](_0x288911);}return _0x4ac0d2['save']();};}function saveUpdates(_0x9f82e0,_0x2c303c){return function(_0x1f01f1){if(_0x1f01f1){return _0x1f01f1['update'](_0x9f82e0)['then'](function(_0x26084b){return _0x26084b;});}return null;};}function removeEntity(_0x33bd1d,_0x190851){return function(_0x361444){if(_0x361444){return _0x361444['destroy']()['then'](function(){_0x33bd1d[_0x11e0('0x1b')](0xcc)[_0x11e0('0x25')]();});}};}function handleEntityNotFound(_0x2219bb,_0x246c94){return function(_0x3fbc76){if(!_0x3fbc76){_0x2219bb['sendStatus'](0x194);}return _0x3fbc76;};}function handleError(_0x9a273a,_0x36b87e){_0x36b87e=_0x36b87e||0x1f4;return function(_0x4f0ca4){logger['error'](_0x4f0ca4[_0x11e0('0x26')]);if(_0x4f0ca4[_0x11e0('0x27')]){delete _0x4f0ca4[_0x11e0('0x27')];}_0x9a273a['status'](_0x36b87e)[_0x11e0('0x28')](_0x4f0ca4);};}exports['index']=function(_0x34c873,_0x433550){var _0xb857e1={},_0x5cc78e={},_0x4927da={'count':0x0,'rows':[]};var _0x589113=_['map'](db['ZohoAccount'][_0x11e0('0x29')],function(_0x22ceed){return{'name':_0x22ceed[_0x11e0('0x2a')],'type':_0x22ceed[_0x11e0('0x2b')][_0x11e0('0x2c')]};});_0x5cc78e['model']=_[_0x11e0('0x2d')](_0x589113,_0x11e0('0x27'));_0x5cc78e[_0x11e0('0x2e')]=_['keys'](_0x34c873[_0x11e0('0x2e')]);_0x5cc78e[_0x11e0('0x2f')]=_[_0x11e0('0x30')](_0x5cc78e['model'],_0x5cc78e[_0x11e0('0x2e')]);_0xb857e1['attributes']=_['intersection'](_0x5cc78e[_0x11e0('0x31')],qs[_0x11e0('0x32')](_0x34c873[_0x11e0('0x2e')][_0x11e0('0x32')]));_0xb857e1['attributes']=_0xb857e1[_0x11e0('0x33')][_0x11e0('0x34')]?_0xb857e1['attributes']:_0x5cc78e[_0x11e0('0x31')];if(!_0x34c873[_0x11e0('0x2e')][_0x11e0('0x35')](_0x11e0('0x36'))){_0xb857e1[_0x11e0('0x1e')]=qs[_0x11e0('0x1e')](_0x34c873[_0x11e0('0x2e')][_0x11e0('0x1e')]);_0xb857e1[_0x11e0('0x1d')]=qs[_0x11e0('0x1d')](_0x34c873[_0x11e0('0x2e')][_0x11e0('0x1d')]);}_0xb857e1[_0x11e0('0x37')]=qs['sort'](_0x34c873[_0x11e0('0x2e')][_0x11e0('0x38')]);_0xb857e1[_0x11e0('0x39')]=qs[_0x11e0('0x2f')](_[_0x11e0('0x3a')](_0x34c873[_0x11e0('0x2e')],_0x5cc78e[_0x11e0('0x2f')]),_0x589113);if(_0x34c873[_0x11e0('0x2e')][_0x11e0('0x3b')]){_0xb857e1[_0x11e0('0x39')]=_[_0x11e0('0x3c')](_0xb857e1[_0x11e0('0x39')],{'$or':_[_0x11e0('0x2d')](_0x589113,function(_0x3b4dc8){if(_0x3b4dc8['type']!==_0x11e0('0x3d')){var _0x25e48c={};_0x25e48c[_0x3b4dc8['name']]={'$like':'%'+_0x34c873[_0x11e0('0x2e')][_0x11e0('0x3b')]+'%'};return _0x25e48c;}})});}_0xb857e1=_['merge']({},_0xb857e1,_0x34c873[_0x11e0('0x3e')]);var _0x322d84={'where':_0xb857e1[_0x11e0('0x39')]};return db['ZohoAccount'][_0x11e0('0x20')](_0x322d84)[_0x11e0('0x3f')](function(_0x35a754){_0x4927da[_0x11e0('0x20')]=_0x35a754;if(_0x34c873[_0x11e0('0x2e')][_0x11e0('0x40')]){_0xb857e1['include']=[{'all':!![]}];}return db[_0x11e0('0x41')][_0x11e0('0x42')](_0xb857e1);})[_0x11e0('0x3f')](function(_0x341730){_0x4927da[_0x11e0('0x43')]=_0x341730;return _0x4927da;})[_0x11e0('0x3f')](respondWithFilteredResult(_0x433550,_0xb857e1))[_0x11e0('0x44')](handleError(_0x433550,null));};exports['show']=function(_0xe45578,_0x306060){var _0x4131de={'raw':![],'where':{'id':_0xe45578[_0x11e0('0x45')]['id']}},_0x54319b={};_0x54319b['model']=_[_0x11e0('0x46')](db[_0x11e0('0x41')][_0x11e0('0x29')]);_0x54319b['query']=_[_0x11e0('0x46')](_0xe45578[_0x11e0('0x2e')]);_0x54319b[_0x11e0('0x2f')]=_['intersection'](_0x54319b[_0x11e0('0x31')],_0x54319b[_0x11e0('0x2e')]);_0x4131de[_0x11e0('0x33')]=_[_0x11e0('0x30')](_0x54319b[_0x11e0('0x31')],qs['fields'](_0xe45578['query']['fields']));_0x4131de[_0x11e0('0x33')]=_0x4131de['attributes']['length']?_0x4131de[_0x11e0('0x33')]:_0x54319b[_0x11e0('0x31')];if(_0xe45578[_0x11e0('0x2e')][_0x11e0('0x40')]){_0x4131de[_0x11e0('0x47')]=[{'all':!![]}];}_0x4131de=_[_0x11e0('0x3c')]({},_0x4131de,_0xe45578[_0x11e0('0x3e')]);return db['ZohoAccount'][_0x11e0('0x48')](_0x4131de)[_0x11e0('0x3f')](handleEntityNotFound(_0x306060,null))['then'](respondWithResult(_0x306060,null))[_0x11e0('0x44')](handleError(_0x306060,null));};exports[_0x11e0('0x49')]=function(_0x2b8524,_0x576676){return db[_0x11e0('0x41')][_0x11e0('0x49')](_0x2b8524['body'],{})[_0x11e0('0x3f')](respondWithResult(_0x576676,0xc9))[_0x11e0('0x44')](handleError(_0x576676,null));};exports[_0x11e0('0x4a')]=function(_0x535a76,_0x242220){if(_0x535a76[_0x11e0('0x4b')]['id']){delete _0x535a76[_0x11e0('0x4b')]['id'];}return db[_0x11e0('0x41')][_0x11e0('0x48')]({'where':{'id':_0x535a76['params']['id']}})[_0x11e0('0x3f')](handleEntityNotFound(_0x242220,null))['then'](saveUpdates(_0x535a76[_0x11e0('0x4b')],null))[_0x11e0('0x3f')](respondWithResult(_0x242220,null))['catch'](handleError(_0x242220,null));};exports['destroy']=function(_0x2289b0,_0x2ffead){return db[_0x11e0('0x41')][_0x11e0('0x48')]({'where':{'id':_0x2289b0['params']['id']}})[_0x11e0('0x3f')](handleEntityNotFound(_0x2ffead,null))[_0x11e0('0x3f')](removeEntity(_0x2ffead,null))['catch'](handleError(_0x2ffead,null));};exports[_0x11e0('0x4c')]=function(_0x49dd59,_0x4f6e0c,_0x4f656b){var _0x171340={};var _0x8e7323={};var _0x233975;var _0x35da09;return db['ZohoAccount'][_0x11e0('0x4d')]({'where':{'id':_0x49dd59[_0x11e0('0x45')]['id']}})[_0x11e0('0x3f')](handleEntityNotFound(_0x4f6e0c,null))[_0x11e0('0x3f')](function(_0x5b8428){if(_0x5b8428){_0x233975=_0x5b8428;_0x8e7323[_0x11e0('0x31')]=_[_0x11e0('0x46')](db['ZohoConfiguration'][_0x11e0('0x29')]);_0x8e7323[_0x11e0('0x2e')]=_[_0x11e0('0x46')](_0x49dd59['query']);_0x8e7323[_0x11e0('0x2f')]=_[_0x11e0('0x30')](_0x8e7323[_0x11e0('0x31')],_0x8e7323[_0x11e0('0x2e')]);_0x171340[_0x11e0('0x33')]=_[_0x11e0('0x30')](_0x8e7323[_0x11e0('0x31')],qs[_0x11e0('0x32')](_0x49dd59['query']['fields']));_0x171340['attributes']=_0x171340[_0x11e0('0x33')][_0x11e0('0x34')]?_0x171340[_0x11e0('0x33')]:_0x8e7323[_0x11e0('0x31')];_0x171340[_0x11e0('0x37')]=qs[_0x11e0('0x38')](_0x49dd59[_0x11e0('0x2e')][_0x11e0('0x38')]);_0x171340[_0x11e0('0x39')]=qs[_0x11e0('0x2f')](_[_0x11e0('0x3a')](_0x49dd59[_0x11e0('0x2e')],_0x8e7323['filters']));if(_0x49dd59[_0x11e0('0x2e')][_0x11e0('0x3b')]){_0x171340[_0x11e0('0x39')]=_['merge'](_0x171340[_0x11e0('0x39')],{'$or':_[_0x11e0('0x2d')](_0x171340[_0x11e0('0x33')],function(_0x3d6565){var _0x4c2e6a={};_0x4c2e6a[_0x3d6565]={'$like':'%'+_0x49dd59['query'][_0x11e0('0x3b')]+'%'};return _0x4c2e6a;})});}_0x171340=_[_0x11e0('0x3c')]({},_0x171340,_0x49dd59[_0x11e0('0x3e')]);return _0x233975['getConfigurations'](_0x171340);}})['then'](function(_0x134f02){if(_0x134f02){_0x35da09=_0x134f02[_0x11e0('0x34')];if(!_0x49dd59[_0x11e0('0x2e')][_0x11e0('0x35')](_0x11e0('0x36'))){_0x171340[_0x11e0('0x1e')]=qs['limit'](_0x49dd59['query'][_0x11e0('0x1e')]);_0x171340['offset']=qs[_0x11e0('0x1d')](_0x49dd59[_0x11e0('0x2e')][_0x11e0('0x1d')]);}return _0x233975['getConfigurations'](_0x171340);}})[_0x11e0('0x3f')](function(_0x48afff){if(_0x48afff){return _0x48afff?{'count':_0x35da09,'rows':_0x48afff}:null;}})[_0x11e0('0x3f')](respondWithResult(_0x4f6e0c,null))[_0x11e0('0x44')](handleError(_0x4f6e0c,null));};exports[_0x11e0('0x4e')]=function(_0x4d6a46,_0x499f77,_0x484996){if(_0x4d6a46['body']['id']){delete _0x4d6a46[_0x11e0('0x4b')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x4d6a46[_0x11e0('0x45')]['id']}})[_0x11e0('0x3f')](handleEntityNotFound(_0x499f77,null))[_0x11e0('0x3f')](function(_0x3c87a7){if(_0x3c87a7){_0x4d6a46[_0x11e0('0x4b')][_0x11e0('0x4f')]=_0x3c87a7['id'];_0x4d6a46['body']['Subjects']=integrations['getSubjects'](_0x4d6a46['body'][_0x11e0('0x50')],_0x4d6a46[_0x11e0('0x4b')][_0x11e0('0x2b')]);_0x4d6a46[_0x11e0('0x4b')]['Descriptions']=integrations['getDescriptions'](_0x4d6a46[_0x11e0('0x4b')][_0x11e0('0x50')],_0x4d6a46[_0x11e0('0x4b')][_0x11e0('0x2b')]);return db['ZohoConfiguration']['create'](_0x4d6a46[_0x11e0('0x4b')],{'include':[{'model':db[_0x11e0('0x51')],'as':'Subjects'},{'model':db[_0x11e0('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x499f77,null))[_0x11e0('0x44')](handleError(_0x499f77,null));};function getAccessToken(_0x9084da){return new Promise(function(_0x23522f,_0x3ccce4){var _0x1e2b00;switch(_0x9084da[_0x11e0('0x52')]){case'US':_0x1e2b00=_0x11e0('0x53');break;case'AU':_0x1e2b00=_0x11e0('0x54');break;case'EU':_0x1e2b00=_0x11e0('0x55');break;case'IN':_0x1e2b00=_0x11e0('0x56');break;case'CN':_0x1e2b00='https://accounts.zoho.com.cn';break;default:_0x1e2b00=_0x11e0('0x55');break;}var _0x3a840f={'method':'POST','uri':_0x1e2b00+_0x11e0('0x57'),'qs':{'refresh_token':_0x9084da[_0x11e0('0x58')],'client_id':_0x9084da['clientId'],'client_secret':_0x9084da['clientSecret'],'grant_type':_0x11e0('0x59')},'json':!![]};return rp(_0x3a840f)['then'](function(_0x3e707a){if(_0x3e707a[_0x11e0('0x5a')]){_0x23522f(_0x3e707a[_0x11e0('0x5a')]);}else{_0x3ccce4(_0x11e0('0x5b'));}})[_0x11e0('0x44')](function(_0x48f9e8){_0x3ccce4(_0x48f9e8);});});}exports['getFields']=function(_0x19a8ec,_0x5d14a4,_0x14d6aa){var _0x2bc7d7,_0x48d1ee,_0x5043b0,_0x3c63ff,_0x115950;return db[_0x11e0('0x41')][_0x11e0('0x4d')]({'where':{'id':_0x19a8ec[_0x11e0('0x45')]['id']},'attributes':['id',_0x11e0('0x5c'),'zone',_0x11e0('0x5d'),_0x11e0('0x5e'),_0x11e0('0x5f'),'code',_0x11e0('0x58')]})[_0x11e0('0x3f')](handleEntityNotFound(_0x5d14a4,null))[_0x11e0('0x3f')](function(_0x400256){_0x115950=_0x400256;_0x2bc7d7=_0x115950[_0x11e0('0x5c')];_0x48d1ee=_0x2bc7d7===_0x11e0('0x60')?'eu':_0x11e0('0x61');_0x5043b0=_0x115950[_0x11e0('0x5f')];var _0x5b9c94=_0x5043b0[_0x11e0('0x62')](-0x1);if(_0x5b9c94==='/'||_0x5b9c94==='\x5c'||_0x5b9c94===':'){_0x5043b0=_0x5043b0['substring'](0x0,_0x5043b0[_0x11e0('0x63')](_0x5b9c94));}if(!_0x115950[_0x11e0('0x58')]){throw new Error(_0x11e0('0x64'));}return getAccessToken(_0x115950);})['then'](function(_0x5de3f9){if(_0x5de3f9){return rp({'method':'GET','uri':util[_0x11e0('0x65')](_0x11e0('0x66'),_0x48d1ee),'qs':{'module':_0x11e0('0x67')},'headers':{'Authorization':_0x11e0('0x68')+_0x5de3f9},'json':!![]});}})[_0x11e0('0x3f')](function(_0x2454b0){if(_0x2454b0){if(_0x2454b0['response']&&_0x2454b0[_0x11e0('0x69')][_0x11e0('0x6a')]){throw new Error(_0x2454b0[_0x11e0('0x69')]['error'][_0x11e0('0x6b')]);}var _0xf90f12=[];var _0x54fed2=[];var _0x37e7f2=[_0x11e0('0x6c'),_0x11e0('0x6d'),'Description',_0x11e0('0x6e'),_0x11e0('0x6f'),_0x11e0('0x70'),'Call_Start_Time',_0x11e0('0x71')];_0x54fed2=_[_0x11e0('0x72')](_0x2454b0[_0x11e0('0x32')],function(_0x63881b){return _0x37e7f2[_0x11e0('0x73')](_0x63881b[_0x11e0('0x74')]);});for(var _0xf7835b=0x0;_0xf7835b<_0x54fed2[_0x11e0('0x34')];_0xf7835b++){if(_0x54fed2[_0xf7835b]['system_mandatory']===![]){_0xf90f12['push']({'id':_0x54fed2[_0xf7835b]['id'],'name':_0x54fed2[_0xf7835b]['display_label'],'custom':_0x54fed2[_0xf7835b][_0x11e0('0x75')],'options':_0x54fed2[_0xf7835b][_0x11e0('0x76')]==='picklist'&&_0x54fed2[_0xf7835b][_0x11e0('0x77')]['length']>-0x1?_[_0x11e0('0x2d')](_0x54fed2[_0xf7835b][_0x11e0('0x77')],function(_0x26c748){return{'name':_0x26c748,'value':_0x26c748};}):[]});}}return{'count':_0xf90f12[_0x11e0('0x34')],'rows':_0xf90f12};}else{return{'count':0x0,'rows':[]};}})[_0x11e0('0x3f')](respondWithResult(_0x5d14a4,null))[_0x11e0('0x44')](function(_0x434b82){var _0x10ad7d=_0x19a8ec[_0x11e0('0x2e')]['test']?0x1f4:_0x434b82[_0x11e0('0x78')]||0x1f4;logger[_0x11e0('0x6a')](_0x11e0('0x79'),_0x11e0('0x7a'),_0x10ad7d,JSON[_0x11e0('0x7b')](_0x434b82));delete _0x434b82[_0x11e0('0x27')];if(_0x10ad7d===0x191){_0x10ad7d=0x190;}_0x5d14a4[_0x11e0('0x1b')](_0x10ad7d)[_0x11e0('0x28')](_0x19a8ec[_0x11e0('0x2e')]['test']?{'message':_0x11e0('0x7c'),'statusCode':_0x434b82[_0x11e0('0x78')]}:_0x434b82);});}; \ No newline at end of file +var _0x4a7d=['where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZohoConfiguration','order','nolimit','addConfiguration','AccountId','getSubjects','Descriptions','channel','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','Zoho-oauthtoken\x20','response','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort'];(function(_0x2bf65f,_0x43c732){var _0x1e75d1=function(_0x20e623){while(--_0x20e623){_0x2bf65f['push'](_0x2bf65f['shift']());}};_0x1e75d1(++_0x43c732);}(_0x4a7d,0xc3));var _0xd4a7=function(_0x2ebc11,_0x17af35){_0x2ebc11=_0x2ebc11-0x0;var _0x3c7728=_0x4a7d[_0x2ebc11];return _0x3c7728;};'use strict';var emlformat=require(_0xd4a7('0x0'));var rimraf=require(_0xd4a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd4a7('0x2'));var moment=require(_0xd4a7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd4a7('0x4'));var util=require('util');var path=require(_0xd4a7('0x5'));var sox=require('sox');var csv=require(_0xd4a7('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4a7('0x7'));var _=require(_0xd4a7('0x8'));var squel=require(_0xd4a7('0x9'));var crypto=require(_0xd4a7('0xa'));var jsforce=require(_0xd4a7('0xb'));var deskjs=require(_0xd4a7('0xc'));var toCsv=require(_0xd4a7('0x6'));var querystring=require(_0xd4a7('0xd'));var Papa=require(_0xd4a7('0xe'));var Redis=require(_0xd4a7('0xf'));var authService=require(_0xd4a7('0x10'));var qs=require(_0xd4a7('0x11'));var as=require(_0xd4a7('0x12'));var hardwareService=require(_0xd4a7('0x13'));var logger=require(_0xd4a7('0x14'))(_0xd4a7('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd4a7('0x16'));var db=require(_0xd4a7('0x17'))['db'];var integrations=require(_0xd4a7('0x18'));function respondWithStatusCode(_0x5ccc23,_0x20de40){_0x20de40=_0x20de40||0xcc;return function(_0x2efa25){if(_0x2efa25){return _0x5ccc23[_0xd4a7('0x19')](_0x20de40);}return _0x5ccc23[_0xd4a7('0x1a')](_0x20de40)[_0xd4a7('0x1b')]();};}function respondWithResult(_0x1c9470,_0x260652){_0x260652=_0x260652||0xc8;return function(_0x4502d6){if(_0x4502d6){return _0x1c9470[_0xd4a7('0x1a')](_0x260652)['json'](_0x4502d6);}};}function respondWithFilteredResult(_0x4f4f9b,_0x5373a4){return function(_0x3e492f){if(_0x3e492f){var _0x2126c0=typeof _0x5373a4[_0xd4a7('0x1c')]===_0xd4a7('0x1d')&&typeof _0x5373a4[_0xd4a7('0x1e')]===_0xd4a7('0x1d');var _0x1a7495=_0x3e492f[_0xd4a7('0x1f')];var _0x27f366=_0x2126c0?0x0:_0x5373a4[_0xd4a7('0x1c')];var _0x1cd10c=_0x2126c0?_0x3e492f[_0xd4a7('0x1f')]:_0x5373a4[_0xd4a7('0x1c')]+_0x5373a4[_0xd4a7('0x1e')];var _0xb1947;if(_0x1cd10c>=_0x1a7495){_0x1cd10c=_0x1a7495;_0xb1947=0xc8;}else{_0xb1947=0xce;}_0x4f4f9b[_0xd4a7('0x1a')](_0xb1947);return _0x4f4f9b['set']('Content-Range',_0x27f366+'-'+_0x1cd10c+'/'+_0x1a7495)[_0xd4a7('0x20')](_0x3e492f);}return null;};}function patchUpdates(_0x5d308d){return function(_0x1468b7){try{jsonpatch[_0xd4a7('0x21')](_0x1468b7,_0x5d308d,!![]);}catch(_0x4f8866){return BPromise[_0xd4a7('0x22')](_0x4f8866);}return _0x1468b7[_0xd4a7('0x23')]();};}function saveUpdates(_0x5dbb13,_0x56eb27){return function(_0x127489){if(_0x127489){return _0x127489[_0xd4a7('0x24')](_0x5dbb13)[_0xd4a7('0x25')](function(_0x31c673){return _0x31c673;});}return null;};}function removeEntity(_0x1f0cd5,_0x535729){return function(_0x559a98){if(_0x559a98){return _0x559a98[_0xd4a7('0x26')]()[_0xd4a7('0x25')](function(){_0x1f0cd5[_0xd4a7('0x1a')](0xcc)[_0xd4a7('0x1b')]();});}};}function handleEntityNotFound(_0x5944b0,_0x453f6f){return function(_0x3bdb1f){if(!_0x3bdb1f){_0x5944b0[_0xd4a7('0x19')](0x194);}return _0x3bdb1f;};}function handleError(_0x5b47ca,_0x1f22c7){_0x1f22c7=_0x1f22c7||0x1f4;return function(_0x477fdc){logger[_0xd4a7('0x27')](_0x477fdc[_0xd4a7('0x28')]);if(_0x477fdc[_0xd4a7('0x29')]){delete _0x477fdc[_0xd4a7('0x29')];}_0x5b47ca['status'](_0x1f22c7)[_0xd4a7('0x2a')](_0x477fdc);};}exports['index']=function(_0x6f1490,_0x2065b9){var _0x3aaefa={},_0x1a8e96={},_0x54856b={'count':0x0,'rows':[]};var _0xdc94cc=_[_0xd4a7('0x2b')](db[_0xd4a7('0x2c')][_0xd4a7('0x2d')],function(_0xf3360f){return{'name':_0xf3360f[_0xd4a7('0x2e')],'type':_0xf3360f[_0xd4a7('0x2f')][_0xd4a7('0x30')]};});_0x1a8e96[_0xd4a7('0x31')]=_['map'](_0xdc94cc,_0xd4a7('0x29'));_0x1a8e96[_0xd4a7('0x32')]=_[_0xd4a7('0x33')](_0x6f1490[_0xd4a7('0x32')]);_0x1a8e96[_0xd4a7('0x34')]=_[_0xd4a7('0x35')](_0x1a8e96[_0xd4a7('0x31')],_0x1a8e96[_0xd4a7('0x32')]);_0x3aaefa[_0xd4a7('0x36')]=_['intersection'](_0x1a8e96['model'],qs[_0xd4a7('0x37')](_0x6f1490['query'][_0xd4a7('0x37')]));_0x3aaefa[_0xd4a7('0x36')]=_0x3aaefa[_0xd4a7('0x36')][_0xd4a7('0x38')]?_0x3aaefa[_0xd4a7('0x36')]:_0x1a8e96[_0xd4a7('0x31')];if(!_0x6f1490['query'][_0xd4a7('0x39')]('nolimit')){_0x3aaefa[_0xd4a7('0x1e')]=qs[_0xd4a7('0x1e')](_0x6f1490['query'][_0xd4a7('0x1e')]);_0x3aaefa['offset']=qs['offset'](_0x6f1490[_0xd4a7('0x32')]['offset']);}_0x3aaefa['order']=qs[_0xd4a7('0x3a')](_0x6f1490[_0xd4a7('0x32')][_0xd4a7('0x3a')]);_0x3aaefa[_0xd4a7('0x3b')]=qs[_0xd4a7('0x34')](_[_0xd4a7('0x3c')](_0x6f1490[_0xd4a7('0x32')],_0x1a8e96[_0xd4a7('0x34')]),_0xdc94cc);if(_0x6f1490[_0xd4a7('0x32')]['filter']){_0x3aaefa[_0xd4a7('0x3b')]=_[_0xd4a7('0x3d')](_0x3aaefa[_0xd4a7('0x3b')],{'$or':_['map'](_0xdc94cc,function(_0x11a9da){if(_0x11a9da[_0xd4a7('0x2f')]!=='VIRTUAL'){var _0x39d900={};_0x39d900[_0x11a9da[_0xd4a7('0x29')]]={'$like':'%'+_0x6f1490[_0xd4a7('0x32')][_0xd4a7('0x3e')]+'%'};return _0x39d900;}})});}_0x3aaefa=_[_0xd4a7('0x3d')]({},_0x3aaefa,_0x6f1490[_0xd4a7('0x3f')]);var _0x3071b9={'where':_0x3aaefa[_0xd4a7('0x3b')]};return db['ZohoAccount'][_0xd4a7('0x1f')](_0x3071b9)[_0xd4a7('0x25')](function(_0x5a999d){_0x54856b[_0xd4a7('0x1f')]=_0x5a999d;if(_0x6f1490[_0xd4a7('0x32')][_0xd4a7('0x40')]){_0x3aaefa[_0xd4a7('0x41')]=[{'all':!![]}];}return db['ZohoAccount'][_0xd4a7('0x42')](_0x3aaefa);})[_0xd4a7('0x25')](function(_0x32a42d){_0x54856b[_0xd4a7('0x43')]=_0x32a42d;return _0x54856b;})[_0xd4a7('0x25')](respondWithFilteredResult(_0x2065b9,_0x3aaefa))[_0xd4a7('0x44')](handleError(_0x2065b9,null));};exports[_0xd4a7('0x45')]=function(_0x37db47,_0x13dbeb){var _0x4438bc={'raw':![],'where':{'id':_0x37db47[_0xd4a7('0x46')]['id']}},_0x1b970b={};_0x1b970b[_0xd4a7('0x31')]=_[_0xd4a7('0x33')](db[_0xd4a7('0x2c')]['rawAttributes']);_0x1b970b[_0xd4a7('0x32')]=_[_0xd4a7('0x33')](_0x37db47['query']);_0x1b970b['filters']=_[_0xd4a7('0x35')](_0x1b970b[_0xd4a7('0x31')],_0x1b970b[_0xd4a7('0x32')]);_0x4438bc[_0xd4a7('0x36')]=_[_0xd4a7('0x35')](_0x1b970b[_0xd4a7('0x31')],qs[_0xd4a7('0x37')](_0x37db47[_0xd4a7('0x32')][_0xd4a7('0x37')]));_0x4438bc['attributes']=_0x4438bc['attributes'][_0xd4a7('0x38')]?_0x4438bc[_0xd4a7('0x36')]:_0x1b970b[_0xd4a7('0x31')];if(_0x37db47[_0xd4a7('0x32')][_0xd4a7('0x40')]){_0x4438bc[_0xd4a7('0x41')]=[{'all':!![]}];}_0x4438bc=_[_0xd4a7('0x3d')]({},_0x4438bc,_0x37db47[_0xd4a7('0x3f')]);return db[_0xd4a7('0x2c')][_0xd4a7('0x47')](_0x4438bc)[_0xd4a7('0x25')](handleEntityNotFound(_0x13dbeb,null))['then'](respondWithResult(_0x13dbeb,null))['catch'](handleError(_0x13dbeb,null));};exports[_0xd4a7('0x48')]=function(_0x5bb73b,_0x19c762){return db['ZohoAccount'][_0xd4a7('0x48')](_0x5bb73b[_0xd4a7('0x49')],{})[_0xd4a7('0x25')](respondWithResult(_0x19c762,0xc9))[_0xd4a7('0x44')](handleError(_0x19c762,null));};exports[_0xd4a7('0x24')]=function(_0x4698c2,_0x37db40){if(_0x4698c2[_0xd4a7('0x49')]['id']){delete _0x4698c2[_0xd4a7('0x49')]['id'];}return db[_0xd4a7('0x2c')]['find']({'where':{'id':_0x4698c2['params']['id']}})['then'](handleEntityNotFound(_0x37db40,null))['then'](saveUpdates(_0x4698c2[_0xd4a7('0x49')],null))['then'](respondWithResult(_0x37db40,null))[_0xd4a7('0x44')](handleError(_0x37db40,null));};exports[_0xd4a7('0x26')]=function(_0x17f698,_0x299d27){return db[_0xd4a7('0x2c')][_0xd4a7('0x47')]({'where':{'id':_0x17f698['params']['id']}})[_0xd4a7('0x25')](handleEntityNotFound(_0x299d27,null))[_0xd4a7('0x25')](removeEntity(_0x299d27,null))[_0xd4a7('0x44')](handleError(_0x299d27,null));};exports[_0xd4a7('0x4a')]=function(_0x490d4f,_0x3f099b,_0x472f9c){var _0xfc87a={};var _0x391794={};var _0x4a06ad;var _0x1514d5;return db[_0xd4a7('0x2c')][_0xd4a7('0x4b')]({'where':{'id':_0x490d4f[_0xd4a7('0x46')]['id']}})[_0xd4a7('0x25')](handleEntityNotFound(_0x3f099b,null))[_0xd4a7('0x25')](function(_0xa6818e){if(_0xa6818e){_0x4a06ad=_0xa6818e;_0x391794[_0xd4a7('0x31')]=_['keys'](db[_0xd4a7('0x4c')][_0xd4a7('0x2d')]);_0x391794['query']=_[_0xd4a7('0x33')](_0x490d4f[_0xd4a7('0x32')]);_0x391794['filters']=_[_0xd4a7('0x35')](_0x391794[_0xd4a7('0x31')],_0x391794[_0xd4a7('0x32')]);_0xfc87a[_0xd4a7('0x36')]=_[_0xd4a7('0x35')](_0x391794[_0xd4a7('0x31')],qs[_0xd4a7('0x37')](_0x490d4f[_0xd4a7('0x32')][_0xd4a7('0x37')]));_0xfc87a['attributes']=_0xfc87a[_0xd4a7('0x36')][_0xd4a7('0x38')]?_0xfc87a[_0xd4a7('0x36')]:_0x391794[_0xd4a7('0x31')];_0xfc87a[_0xd4a7('0x4d')]=qs[_0xd4a7('0x3a')](_0x490d4f[_0xd4a7('0x32')]['sort']);_0xfc87a[_0xd4a7('0x3b')]=qs[_0xd4a7('0x34')](_[_0xd4a7('0x3c')](_0x490d4f[_0xd4a7('0x32')],_0x391794[_0xd4a7('0x34')]));if(_0x490d4f[_0xd4a7('0x32')][_0xd4a7('0x3e')]){_0xfc87a['where']=_[_0xd4a7('0x3d')](_0xfc87a[_0xd4a7('0x3b')],{'$or':_[_0xd4a7('0x2b')](_0xfc87a[_0xd4a7('0x36')],function(_0x4d82e3){var _0x2ff8a6={};_0x2ff8a6[_0x4d82e3]={'$like':'%'+_0x490d4f[_0xd4a7('0x32')]['filter']+'%'};return _0x2ff8a6;})});}_0xfc87a=_[_0xd4a7('0x3d')]({},_0xfc87a,_0x490d4f[_0xd4a7('0x3f')]);return _0x4a06ad[_0xd4a7('0x4a')](_0xfc87a);}})[_0xd4a7('0x25')](function(_0x48e4c7){if(_0x48e4c7){_0x1514d5=_0x48e4c7[_0xd4a7('0x38')];if(!_0x490d4f[_0xd4a7('0x32')][_0xd4a7('0x39')](_0xd4a7('0x4e'))){_0xfc87a[_0xd4a7('0x1e')]=qs[_0xd4a7('0x1e')](_0x490d4f['query'][_0xd4a7('0x1e')]);_0xfc87a[_0xd4a7('0x1c')]=qs['offset'](_0x490d4f[_0xd4a7('0x32')]['offset']);}return _0x4a06ad['getConfigurations'](_0xfc87a);}})[_0xd4a7('0x25')](function(_0x31b744){if(_0x31b744){return _0x31b744?{'count':_0x1514d5,'rows':_0x31b744}:null;}})[_0xd4a7('0x25')](respondWithResult(_0x3f099b,null))[_0xd4a7('0x44')](handleError(_0x3f099b,null));};exports[_0xd4a7('0x4f')]=function(_0x378d1a,_0x33ffab,_0x66e49){if(_0x378d1a[_0xd4a7('0x49')]['id']){delete _0x378d1a[_0xd4a7('0x49')]['id'];}return db['ZohoAccount'][_0xd4a7('0x4b')]({'where':{'id':_0x378d1a[_0xd4a7('0x46')]['id']}})[_0xd4a7('0x25')](handleEntityNotFound(_0x33ffab,null))[_0xd4a7('0x25')](function(_0x340ff0){if(_0x340ff0){_0x378d1a[_0xd4a7('0x49')][_0xd4a7('0x50')]=_0x340ff0['id'];_0x378d1a[_0xd4a7('0x49')]['Subjects']=integrations[_0xd4a7('0x51')](_0x378d1a[_0xd4a7('0x49')]['channel'],_0x378d1a[_0xd4a7('0x49')][_0xd4a7('0x2f')]);_0x378d1a[_0xd4a7('0x49')][_0xd4a7('0x52')]=integrations['getDescriptions'](_0x378d1a[_0xd4a7('0x49')][_0xd4a7('0x53')],_0x378d1a[_0xd4a7('0x49')][_0xd4a7('0x2f')]);return db[_0xd4a7('0x4c')][_0xd4a7('0x48')](_0x378d1a[_0xd4a7('0x49')],{'include':[{'model':db[_0xd4a7('0x54')],'as':_0xd4a7('0x55')},{'model':db['ZohoField'],'as':_0xd4a7('0x52')}]});}return null;})[_0xd4a7('0x25')](respondWithResult(_0x33ffab,null))[_0xd4a7('0x44')](handleError(_0x33ffab,null));};function getAccessToken(_0x40a4ae){return new Promise(function(_0x78a63b,_0x20e27f){var _0x54e54f;switch(_0x40a4ae[_0xd4a7('0x56')]){case'US':_0x54e54f=_0xd4a7('0x57');break;case'AU':_0x54e54f='https://accounts.zoho.com.au';break;case'EU':_0x54e54f=_0xd4a7('0x58');break;case'IN':_0x54e54f='https://accounts.zoho.in';break;case'CN':_0x54e54f=_0xd4a7('0x59');break;default:_0x54e54f=_0xd4a7('0x58');break;}var _0x270ae3={'method':_0xd4a7('0x5a'),'uri':_0x54e54f+_0xd4a7('0x5b'),'qs':{'refresh_token':_0x40a4ae[_0xd4a7('0x5c')],'client_id':_0x40a4ae[_0xd4a7('0x5d')],'client_secret':_0x40a4ae[_0xd4a7('0x5e')],'grant_type':_0xd4a7('0x5f')},'json':!![]};return rp(_0x270ae3)[_0xd4a7('0x25')](function(_0x1cc2fc){if(_0x1cc2fc[_0xd4a7('0x60')]){_0x78a63b(_0x1cc2fc['access_token']);}else{_0x20e27f(_0xd4a7('0x61'));}})[_0xd4a7('0x44')](function(_0x124735){_0x20e27f(_0x124735);});});}exports[_0xd4a7('0x62')]=function(_0x1700a1,_0x489d71,_0x43ebd4){var _0x42e528,_0x3cc6ac,_0x1df9b2,_0x45d202,_0xfcd640;return db[_0xd4a7('0x2c')][_0xd4a7('0x4b')]({'where':{'id':_0x1700a1[_0xd4a7('0x46')]['id']},'attributes':['id',_0xd4a7('0x63'),_0xd4a7('0x56'),_0xd4a7('0x5d'),'clientSecret',_0xd4a7('0x64'),_0xd4a7('0x65'),_0xd4a7('0x5c')]})['then'](handleEntityNotFound(_0x489d71,null))[_0xd4a7('0x25')](function(_0x2e05d7){_0xfcd640=_0x2e05d7;_0x42e528=_0xfcd640[_0xd4a7('0x63')];_0x3cc6ac=_0x42e528==='zoho.eu'?'eu':'com';_0x1df9b2=_0xfcd640['serverUrl'];var _0x427d74=_0x1df9b2[_0xd4a7('0x66')](-0x1);if(_0x427d74==='/'||_0x427d74==='\x5c'||_0x427d74===':'){_0x1df9b2=_0x1df9b2[_0xd4a7('0x67')](0x0,_0x1df9b2[_0xd4a7('0x68')](_0x427d74));}if(!_0xfcd640['refreshToken']){throw new Error(_0xd4a7('0x69'));}return getAccessToken(_0xfcd640);})[_0xd4a7('0x25')](function(_0x1c02cc){if(_0x1c02cc){return rp({'method':_0xd4a7('0x6a'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3cc6ac),'qs':{'module':_0xd4a7('0x6b')},'headers':{'Authorization':_0xd4a7('0x6c')+_0x1c02cc},'json':!![]});}})[_0xd4a7('0x25')](function(_0x3e0754){if(_0x3e0754){if(_0x3e0754[_0xd4a7('0x6d')]&&_0x3e0754[_0xd4a7('0x6d')][_0xd4a7('0x27')]){throw new Error(_0x3e0754[_0xd4a7('0x6d')][_0xd4a7('0x27')]['message']);}var _0x34ba55=[];var _0x46152a=[];var _0xb19a=['Owner','Subject','Description',_0xd4a7('0x6e'),'Call_Duration',_0xd4a7('0x6f'),_0xd4a7('0x70'),_0xd4a7('0x71')];_0x46152a=_[_0xd4a7('0x72')](_0x3e0754['fields'],function(_0x16c3af){return _0xb19a['includes'](_0x16c3af[_0xd4a7('0x73')]);});for(var _0x168957=0x0;_0x168957<_0x46152a[_0xd4a7('0x38')];_0x168957++){if(_0x46152a[_0x168957][_0xd4a7('0x74')]===![]){_0x34ba55[_0xd4a7('0x75')]({'id':_0x46152a[_0x168957]['id'],'name':_0x46152a[_0x168957][_0xd4a7('0x76')],'custom':_0x46152a[_0x168957]['custom_field'],'options':_0x46152a[_0x168957][_0xd4a7('0x77')]===_0xd4a7('0x78')&&_0x46152a[_0x168957][_0xd4a7('0x79')][_0xd4a7('0x38')]>-0x1?_[_0xd4a7('0x2b')](_0x46152a[_0x168957][_0xd4a7('0x79')],function(_0x32d807){return{'name':_0x32d807,'value':_0x32d807};}):[]});}}return{'count':_0x34ba55[_0xd4a7('0x38')],'rows':_0x34ba55};}else{return{'count':0x0,'rows':[]};}})[_0xd4a7('0x25')](respondWithResult(_0x489d71,null))[_0xd4a7('0x44')](function(_0x414fa2){var _0x368797=_0x1700a1[_0xd4a7('0x32')][_0xd4a7('0x7a')]?0x1f4:_0x414fa2[_0xd4a7('0x7b')]||0x1f4;logger[_0xd4a7('0x27')](_0xd4a7('0x7c'),'getFields',_0x368797,JSON[_0xd4a7('0x7d')](_0x414fa2));delete _0x414fa2['name'];if(_0x368797===0x191){_0x368797=0x190;}_0x489d71[_0xd4a7('0x1a')](_0x368797)[_0xd4a7('0x2a')](_0x1700a1[_0xd4a7('0x32')][_0xd4a7('0x7a')]?{'message':_0xd4a7('0x7e'),'statusCode':_0x414fa2[_0xd4a7('0x7b')]}:_0x414fa2);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index b822d26..89342b7 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 _0x9f62=['https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','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','format','https://accounts.zoho.com.cn','/oauth/v2/token','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret','code','slice','substring','lastIndexOf'];(function(_0x53ed0b,_0x25e205){var _0x453628=function(_0x2b0c51){while(--_0x2b0c51){_0x53ed0b['push'](_0x53ed0b['shift']());}};_0x453628(++_0x25e205);}(_0x9f62,0xc2));var _0x29f6=function(_0xb1ef99,_0xc0c02a){_0xb1ef99=_0xb1ef99-0x0;var _0xaefabb=_0x9f62[_0xb1ef99];return _0xaefabb;};'use strict';var _=require(_0x29f6('0x0'));var util=require(_0x29f6('0x1'));var logger=require(_0x29f6('0x2'))(_0x29f6('0x3'));var moment=require(_0x29f6('0x4'));var BPromise=require('bluebird');var rp=require(_0x29f6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x29f6('0x6'));var attributes=require(_0x29f6('0x7'));var integrations=require(_0x29f6('0x8'));module[_0x29f6('0x9')]=function(_0x5db047,_0x23eb42){return _0x5db047[_0x29f6('0xa')](_0x29f6('0xb'),attributes,{'tableName':_0x29f6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x243fdb,_0x53aa04,_0x43af0b){if(_0x243fdb[_0x29f6('0xd')](_0x29f6('0xe'))||_0x243fdb[_0x29f6('0xd')](_0x29f6('0xf'))||_0x243fdb[_0x29f6('0xd')]('clientId')||_0x243fdb[_0x29f6('0xd')](_0x29f6('0x10'))||_0x243fdb['changed'](_0x29f6('0x11'))||_0x243fdb[_0x29f6('0xd')]('host')){var _0xbab840,_0x1d88df;_0xbab840=_0x243fdb[_0x29f6('0xf')];var _0x32c042=_0xbab840[_0x29f6('0x12')](-0x1);if(_0x32c042==='/'||_0x32c042==='\x5c'||_0x32c042===':'){_0xbab840=_0xbab840[_0x29f6('0x13')](0x0,_0xbab840[_0x29f6('0x14')](_0x32c042));}switch(_0x243fdb['zone']){case'US':_0x1d88df=_0x29f6('0x15');break;case'AU':_0x1d88df=_0x29f6('0x16');break;case'IN':_0x1d88df=_0x29f6('0x17');break;case'CN':_0x1d88df='https://accounts.zoho.com.cn';break;default:_0x1d88df=_0x29f6('0x18');break;}var _0x4900ef={'method':_0x29f6('0x19'),'uri':_0x1d88df+'/oauth/v2/token','form':{'grant_type':_0x29f6('0x1a'),'client_id':_0x243fdb[_0x29f6('0x1b')],'client_secret':_0x243fdb[_0x29f6('0x10')],'redirect_uri':_0x243fdb[_0x29f6('0xf')],'code':_0x243fdb[_0x29f6('0x11')]},'headers':{'Content-Type':_0x29f6('0x1c')}};return rp(_0x4900ef)[_0x29f6('0x1d')](function(_0x2912d1){var _0x258b52=JSON[_0x29f6('0x1e')](_0x2912d1);if(_0x258b52['refresh_token']){_0x243fdb[_0x29f6('0x1f')]=_0x258b52[_0x29f6('0x20')];logger[_0x29f6('0x21')](util['format'](_0x29f6('0x22'),_0x243fdb[_0x29f6('0x23')],_0x243fdb['id']));}else{logger[_0x29f6('0x24')](util['format'](_0x29f6('0x25'),_0x243fdb[_0x29f6('0x23')],_0x243fdb['id']),util[_0x29f6('0x26')](_0x258b52,{'showHidden':![],'depth':null}));}return _0x43af0b(null,_0x53aa04);})[_0x29f6('0x27')](function(_0x125db3){logger['error'](util[_0x29f6('0x28')](_0x29f6('0x25'),_0x243fdb['name'],_0x243fdb['id']),util[_0x29f6('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x43af0b(_0x125db3);});}else{return _0x43af0b(null,_0x53aa04);}},'beforeUpdate':function(_0x5ebc77,_0x34abe5,_0x180ff1){if(_0x5ebc77[_0x29f6('0xd')](_0x29f6('0xe'))||_0x5ebc77[_0x29f6('0xd')](_0x29f6('0xf'))||_0x5ebc77[_0x29f6('0xd')](_0x29f6('0x1b'))||_0x5ebc77[_0x29f6('0xd')](_0x29f6('0x10'))||_0x5ebc77[_0x29f6('0xd')](_0x29f6('0x11'))||_0x5ebc77[_0x29f6('0xd')]('host')){var _0x1256e1,_0x470168;_0x1256e1=_0x5ebc77['serverUrl'];var _0x49dee8=_0x1256e1[_0x29f6('0x12')](-0x1);if(_0x49dee8==='/'||_0x49dee8==='\x5c'||_0x49dee8===':'){_0x1256e1=_0x1256e1[_0x29f6('0x13')](0x0,_0x1256e1[_0x29f6('0x14')](_0x49dee8));}switch(_0x5ebc77['zone']){case'US':_0x470168='https://accounts.zoho.com';break;case'AU':_0x470168='https://accounts.zoho.com.au';break;case'IN':_0x470168=_0x29f6('0x17');break;case'CN':_0x470168=_0x29f6('0x29');break;default:_0x470168=_0x29f6('0x18');break;}var _0x215ae8={'method':_0x29f6('0x19'),'uri':_0x470168+_0x29f6('0x2a'),'form':{'grant_type':_0x29f6('0x1a'),'client_id':_0x5ebc77[_0x29f6('0x1b')],'client_secret':_0x5ebc77['clientSecret'],'redirect_uri':_0x5ebc77[_0x29f6('0xf')],'code':_0x5ebc77[_0x29f6('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x215ae8)['then'](function(_0x54cc77){var _0x40a5de=JSON[_0x29f6('0x1e')](_0x54cc77);if(_0x40a5de[_0x29f6('0x20')]){_0x5ebc77[_0x29f6('0x1f')]=_0x40a5de[_0x29f6('0x20')];logger[_0x29f6('0x21')](util[_0x29f6('0x28')](_0x29f6('0x22'),_0x5ebc77[_0x29f6('0x23')],_0x5ebc77['id']));}else{logger[_0x29f6('0x24')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5ebc77[_0x29f6('0x23')],_0x5ebc77['id']),util[_0x29f6('0x26')](_0x40a5de,{'showHidden':![],'depth':null}));}return _0x180ff1(null,_0x34abe5);})['catch'](function(_0x11ee3d){logger[_0x29f6('0x24')](util['format'](_0x29f6('0x25'),_0x5ebc77[_0x29f6('0x23')],_0x5ebc77['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x180ff1(_0x11ee3d);});}else{return _0x180ff1(null,_0x34abe5);}}}});}; \ No newline at end of file +var _0x525b=['refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','name','slice','substring','https://accounts.zoho.com','/oauth/v2/token','application/x-www-form-urlencoded','info','lodash','../../config/logger','moment','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','authorization_code','then','parse'];(function(_0x1b6617,_0x312ff5){var _0x5d02d1=function(_0x5be3e5){while(--_0x5be3e5){_0x1b6617['push'](_0x1b6617['shift']());}};_0x5d02d1(++_0x312ff5);}(_0x525b,0x19e));var _0xb525=function(_0x266422,_0x4d3153){_0x266422=_0x266422-0x0;var _0x29cdb3=_0x525b[_0x266422];return _0x29cdb3;};'use strict';var _=require(_0xb525('0x0'));var util=require('util');var logger=require(_0xb525('0x1'))('api');var moment=require(_0xb525('0x2'));var BPromise=require('bluebird');var rp=require(_0xb525('0x3'));var fs=require('fs');var path=require(_0xb525('0x4'));var rimraf=require('rimraf');var config=require(_0xb525('0x5'));var attributes=require(_0xb525('0x6'));var integrations=require(_0xb525('0x7'));module[_0xb525('0x8')]=function(_0x83ab2f,_0x40df9d){return _0x83ab2f[_0xb525('0x9')](_0xb525('0xa'),attributes,{'tableName':_0xb525('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3328d5,_0x59a16c,_0x5967ea){if(_0x3328d5[_0xb525('0xc')](_0xb525('0xd'))||_0x3328d5[_0xb525('0xc')](_0xb525('0xe'))||_0x3328d5[_0xb525('0xc')](_0xb525('0xf'))||_0x3328d5[_0xb525('0xc')](_0xb525('0x10'))||_0x3328d5[_0xb525('0xc')](_0xb525('0x11'))||_0x3328d5[_0xb525('0xc')](_0xb525('0x12'))){var _0x19a0ce,_0x126def;_0x19a0ce=_0x3328d5[_0xb525('0xe')];var _0x5cb10e=_0x19a0ce['slice'](-0x1);if(_0x5cb10e==='/'||_0x5cb10e==='\x5c'||_0x5cb10e===':'){_0x19a0ce=_0x19a0ce['substring'](0x0,_0x19a0ce[_0xb525('0x13')](_0x5cb10e));}switch(_0x3328d5[_0xb525('0xd')]){case'US':_0x126def='https://accounts.zoho.com';break;case'AU':_0x126def=_0xb525('0x14');break;case'IN':_0x126def=_0xb525('0x15');break;case'CN':_0x126def='https://accounts.zoho.com.cn';break;default:_0x126def='https://accounts.zoho.eu';break;}var _0x57abed={'method':_0xb525('0x16'),'uri':_0x126def+'/oauth/v2/token','form':{'grant_type':_0xb525('0x17'),'client_id':_0x3328d5['clientId'],'client_secret':_0x3328d5[_0xb525('0x10')],'redirect_uri':_0x3328d5[_0xb525('0xe')],'code':_0x3328d5[_0xb525('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x57abed)[_0xb525('0x18')](function(_0x265796){var _0x57cd7c=JSON[_0xb525('0x19')](_0x265796);if(_0x57cd7c[_0xb525('0x1a')]){_0x3328d5['refreshToken']=_0x57cd7c[_0xb525('0x1a')];logger['info'](util[_0xb525('0x1b')](_0xb525('0x1c'),_0x3328d5['name'],_0x3328d5['id']));}else{logger[_0xb525('0x1d')](util[_0xb525('0x1b')](_0xb525('0x1e'),_0x3328d5['name'],_0x3328d5['id']),util[_0xb525('0x1f')](_0x57cd7c,{'showHidden':![],'depth':null}));}return _0x5967ea(null,_0x59a16c);})[_0xb525('0x20')](function(_0x22e173){logger[_0xb525('0x1d')](util[_0xb525('0x1b')](_0xb525('0x1e'),_0x3328d5[_0xb525('0x21')],_0x3328d5['id']),util[_0xb525('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x5967ea(_0x22e173);});}else{return _0x5967ea(null,_0x59a16c);}},'beforeUpdate':function(_0x3d6633,_0x53bd4d,_0x52e1c1){if(_0x3d6633[_0xb525('0xc')](_0xb525('0xd'))||_0x3d6633[_0xb525('0xc')](_0xb525('0xe'))||_0x3d6633[_0xb525('0xc')](_0xb525('0xf'))||_0x3d6633[_0xb525('0xc')]('clientSecret')||_0x3d6633[_0xb525('0xc')]('code')||_0x3d6633[_0xb525('0xc')](_0xb525('0x12'))){var _0x5ed7c3,_0x5aafca;_0x5ed7c3=_0x3d6633[_0xb525('0xe')];var _0x28a799=_0x5ed7c3[_0xb525('0x22')](-0x1);if(_0x28a799==='/'||_0x28a799==='\x5c'||_0x28a799===':'){_0x5ed7c3=_0x5ed7c3[_0xb525('0x23')](0x0,_0x5ed7c3['lastIndexOf'](_0x28a799));}switch(_0x3d6633[_0xb525('0xd')]){case'US':_0x5aafca=_0xb525('0x24');break;case'AU':_0x5aafca='https://accounts.zoho.com.au';break;case'IN':_0x5aafca=_0xb525('0x15');break;case'CN':_0x5aafca='https://accounts.zoho.com.cn';break;default:_0x5aafca='https://accounts.zoho.eu';break;}var _0x345f1e={'method':_0xb525('0x16'),'uri':_0x5aafca+_0xb525('0x25'),'form':{'grant_type':'authorization_code','client_id':_0x3d6633[_0xb525('0xf')],'client_secret':_0x3d6633[_0xb525('0x10')],'redirect_uri':_0x3d6633[_0xb525('0xe')],'code':_0x3d6633[_0xb525('0x11')]},'headers':{'Content-Type':_0xb525('0x26')}};return rp(_0x345f1e)['then'](function(_0xeeb100){var _0x20dab6=JSON[_0xb525('0x19')](_0xeeb100);if(_0x20dab6[_0xb525('0x1a')]){_0x3d6633['refreshToken']=_0x20dab6[_0xb525('0x1a')];logger[_0xb525('0x27')](util[_0xb525('0x1b')](_0xb525('0x1c'),_0x3d6633['name'],_0x3d6633['id']));}else{logger[_0xb525('0x1d')](util['format'](_0xb525('0x1e'),_0x3d6633['name'],_0x3d6633['id']),util[_0xb525('0x1f')](_0x20dab6,{'showHidden':![],'depth':null}));}return _0x52e1c1(null,_0x53bd4d);})[_0xb525('0x20')](function(_0x52e429){logger[_0xb525('0x1d')](util['format'](_0xb525('0x1e'),_0x3d6633[_0xb525('0x21')],_0x3d6633['id']),util[_0xb525('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x52e1c1(_0x52e429);});}else{return _0x52e1c1(null,_0x53bd4d);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 06a818a..68c10bc 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 _0x110f=['options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','ZohoAccount','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetZohoAccount','findAll'];(function(_0x1b0e77,_0x57de32){var _0x3b3f1c=function(_0x37f0be){while(--_0x37f0be){_0x1b0e77['push'](_0x1b0e77['shift']());}};_0x3b3f1c(++_0x57de32);}(_0x110f,0x1e6));var _0xf110=function(_0x39963b,_0x46a1a2){_0x39963b=_0x39963b-0x0;var _0x5d89b9=_0x110f[_0x39963b];return _0x5d89b9;};'use strict';var _=require(_0xf110('0x0'));var util=require(_0xf110('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf110('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf110('0x3'));var logger=require(_0xf110('0x4'))(_0xf110('0x5'));var config=require('../../config/environment');var jayson=require(_0xf110('0x6'));var client=jayson[_0xf110('0x7')][_0xf110('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dcb19,_0x1a1a3b,_0xadc2a3){return new BPromise(function(_0x194a16,_0x57593b){return client[_0xf110('0x9')](_0x4dcb19,_0xadc2a3)[_0xf110('0xa')](function(_0x11c28f){logger['info'](_0xf110('0xb'),_0x1a1a3b,_0xf110('0xc'));logger[_0xf110('0xd')](_0xf110('0xe'),_0x1a1a3b,'request\x20sent',JSON[_0xf110('0xf')](_0x11c28f));if(_0x11c28f[_0xf110('0x10')]){if(_0x11c28f['error'][_0xf110('0x11')]===0x1f4){logger[_0xf110('0x10')](_0xf110('0xb'),_0x1a1a3b,_0x11c28f[_0xf110('0x10')]['message']);return _0x57593b(_0x11c28f[_0xf110('0x10')][_0xf110('0x12')]);}logger[_0xf110('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x1a1a3b,_0x11c28f[_0xf110('0x10')][_0xf110('0x12')]);return _0x194a16(_0x11c28f['error'][_0xf110('0x12')]);}else{logger[_0xf110('0x13')](_0xf110('0xb'),_0x1a1a3b,_0xf110('0xc'));_0x194a16(_0x11c28f[_0xf110('0x14')][_0xf110('0x12')]);}})[_0xf110('0x15')](function(_0x44ba58){logger[_0xf110('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x1a1a3b,_0x44ba58);_0x57593b(_0x44ba58);});});}exports[_0xf110('0x16')]=function(_0x2d0bb9){var _0x3ab2cc=this;return new Promise(function(_0x4ce8c3,_0x3eacf9){return db['ZohoAccount'][_0xf110('0x17')]({'raw':_0x2d0bb9[_0xf110('0x18')]?_0x2d0bb9[_0xf110('0x18')][_0xf110('0x19')]===undefined?!![]:![]:!![],'where':_0x2d0bb9[_0xf110('0x18')]?_0x2d0bb9['options'][_0xf110('0x1a')]||null:null,'attributes':_0x2d0bb9[_0xf110('0x18')]?_0x2d0bb9['options'][_0xf110('0x1b')]||null:null,'limit':_0x2d0bb9[_0xf110('0x18')]?_0x2d0bb9[_0xf110('0x18')][_0xf110('0x1c')]||null:null,'include':_0x2d0bb9[_0xf110('0x18')]?_0x2d0bb9['options'][_0xf110('0x1d')]?_[_0xf110('0x1e')](_0x2d0bb9['options'][_0xf110('0x1d')],function(_0xc52064){return{'model':db[_0xc52064[_0xf110('0x1f')]],'as':_0xc52064['as'],'attributes':_0xc52064[_0xf110('0x1b')],'include':_0xc52064[_0xf110('0x1d')]?_[_0xf110('0x1e')](_0xc52064[_0xf110('0x1d')],function(_0x5c9a15){return{'model':db[_0x5c9a15[_0xf110('0x1f')]],'as':_0x5c9a15['as'],'attributes':_0x5c9a15['attributes'],'include':_0x5c9a15[_0xf110('0x1d')]?_['map'](_0x5c9a15['include'],function(_0x4cac86){return{'model':db[_0x4cac86['model']],'as':_0x4cac86['as'],'attributes':_0x4cac86[_0xf110('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf110('0xa')](function(_0x585616){logger[_0xf110('0x13')](_0xf110('0x16'),_0x2d0bb9);logger[_0xf110('0xd')]('GetZohoAccount',_0x2d0bb9,JSON[_0xf110('0xf')](_0x585616));_0x4ce8c3(_0x585616);})[_0xf110('0x15')](function(_0x56f9fd){logger[_0xf110('0x10')](_0xf110('0x16'),_0x56f9fd[_0xf110('0x12')],_0x2d0bb9);_0x3eacf9(_0x3ab2cc[_0xf110('0x10')](0x1f4,_0x56f9fd[_0xf110('0x12')]));});});};exports[_0xf110('0x20')]=function(_0x1ca73f){var _0xe9f387=this;return new Promise(function(_0x5143b0,_0x509036){return db[_0xf110('0x21')]['find']({'raw':_0x1ca73f[_0xf110('0x18')]?_0x1ca73f[_0xf110('0x18')][_0xf110('0x19')]===undefined?!![]:![]:!![],'where':_0x1ca73f[_0xf110('0x18')]?_0x1ca73f[_0xf110('0x18')][_0xf110('0x1a')]||null:null,'attributes':_0x1ca73f[_0xf110('0x18')]?_0x1ca73f[_0xf110('0x18')][_0xf110('0x1b')]||null:null,'include':_0x1ca73f['options']?_0x1ca73f[_0xf110('0x18')][_0xf110('0x1d')]?_[_0xf110('0x1e')](_0x1ca73f[_0xf110('0x18')][_0xf110('0x1d')],function(_0x31f485){return{'model':db[_0x31f485[_0xf110('0x1f')]],'as':_0x31f485['as'],'attributes':_0x31f485[_0xf110('0x1b')],'include':_0x31f485[_0xf110('0x1d')]?_[_0xf110('0x1e')](_0x31f485[_0xf110('0x1d')],function(_0x2a5a19){return{'model':db[_0x2a5a19[_0xf110('0x1f')]],'as':_0x2a5a19['as'],'attributes':_0x2a5a19[_0xf110('0x1b')],'include':_0x2a5a19['include']?_[_0xf110('0x1e')](_0x2a5a19[_0xf110('0x1d')],function(_0xd305a8){return{'model':db[_0xd305a8[_0xf110('0x1f')]],'as':_0xd305a8['as'],'attributes':_0xd305a8[_0xf110('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf110('0xa')](function(_0x2af6f8){logger[_0xf110('0x13')](_0xf110('0x20'),_0x1ca73f);logger[_0xf110('0xd')]('ShowZohoAccount',_0x1ca73f,JSON[_0xf110('0xf')](_0x2af6f8));_0x5143b0(_0x2af6f8);})[_0xf110('0x15')](function(_0x318d93){logger[_0xf110('0x10')](_0xf110('0x20'),_0x318d93[_0xf110('0x12')],_0x1ca73f);_0x509036(_0xe9f387[_0xf110('0x10')](0x1f4,_0x318d93[_0xf110('0x12')]));});});}; \ No newline at end of file +var _0x18c9=['raw','map','model','attributes','include','then','catch','ShowZohoAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','GetZohoAccount','ZohoAccount','findAll','options'];(function(_0x5be8a5,_0x493949){var _0x4f2fff=function(_0x146bcc){while(--_0x146bcc){_0x5be8a5['push'](_0x5be8a5['shift']());}};_0x4f2fff(++_0x493949);}(_0x18c9,0x13c));var _0x918c=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x18c9[_0x59befa];return _0x1dd63d;};'use strict';var _=require(_0x918c('0x0'));var util=require(_0x918c('0x1'));var moment=require(_0x918c('0x2'));var BPromise=require(_0x918c('0x3'));var rs=require(_0x918c('0x4'));var fs=require('fs');var Redis=require(_0x918c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x918c('0x6'));var logger=require(_0x918c('0x7'))('rpc');var config=require(_0x918c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x918c('0x9')][_0x918c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x467d0b,_0x2aa435,_0x2a8add){return new BPromise(function(_0x4ad426,_0x2845d2){return client['request'](_0x467d0b,_0x2a8add)['then'](function(_0xc0b338){logger[_0x918c('0xb')](_0x918c('0xc'),_0x2aa435,_0x918c('0xd'));logger[_0x918c('0xe')](_0x918c('0xf'),_0x2aa435,_0x918c('0xd'),JSON[_0x918c('0x10')](_0xc0b338));if(_0xc0b338['error']){if(_0xc0b338['error'][_0x918c('0x11')]===0x1f4){logger[_0x918c('0x12')](_0x918c('0xc'),_0x2aa435,_0xc0b338[_0x918c('0x12')][_0x918c('0x13')]);return _0x2845d2(_0xc0b338['error'][_0x918c('0x13')]);}logger[_0x918c('0x12')](_0x918c('0xc'),_0x2aa435,_0xc0b338[_0x918c('0x12')][_0x918c('0x13')]);return _0x4ad426(_0xc0b338[_0x918c('0x12')][_0x918c('0x13')]);}else{logger[_0x918c('0xb')](_0x918c('0xc'),_0x2aa435,'request\x20sent');_0x4ad426(_0xc0b338['result']['message']);}})['catch'](function(_0x4fa363){logger[_0x918c('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x2aa435,_0x4fa363);_0x2845d2(_0x4fa363);});});}exports[_0x918c('0x14')]=function(_0x1cad82){var _0x215eb8=this;return new Promise(function(_0x53ac3c,_0x4832c3){return db[_0x918c('0x15')][_0x918c('0x16')]({'raw':_0x1cad82['options']?_0x1cad82[_0x918c('0x17')][_0x918c('0x18')]===undefined?!![]:![]:!![],'where':_0x1cad82[_0x918c('0x17')]?_0x1cad82[_0x918c('0x17')]['where']||null:null,'attributes':_0x1cad82[_0x918c('0x17')]?_0x1cad82[_0x918c('0x17')]['attributes']||null:null,'limit':_0x1cad82['options']?_0x1cad82[_0x918c('0x17')]['limit']||null:null,'include':_0x1cad82['options']?_0x1cad82[_0x918c('0x17')]['include']?_[_0x918c('0x19')](_0x1cad82[_0x918c('0x17')]['include'],function(_0x3780db){return{'model':db[_0x3780db[_0x918c('0x1a')]],'as':_0x3780db['as'],'attributes':_0x3780db[_0x918c('0x1b')],'include':_0x3780db[_0x918c('0x1c')]?_['map'](_0x3780db[_0x918c('0x1c')],function(_0x8577fe){return{'model':db[_0x8577fe[_0x918c('0x1a')]],'as':_0x8577fe['as'],'attributes':_0x8577fe[_0x918c('0x1b')],'include':_0x8577fe[_0x918c('0x1c')]?_[_0x918c('0x19')](_0x8577fe['include'],function(_0xed8db9){return{'model':db[_0xed8db9[_0x918c('0x1a')]],'as':_0xed8db9['as'],'attributes':_0xed8db9[_0x918c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x918c('0x1d')](function(_0x481fd7){logger[_0x918c('0xb')](_0x918c('0x14'),_0x1cad82);logger['debug'](_0x918c('0x14'),_0x1cad82,JSON[_0x918c('0x10')](_0x481fd7));_0x53ac3c(_0x481fd7);})[_0x918c('0x1e')](function(_0x146579){logger[_0x918c('0x12')](_0x918c('0x14'),_0x146579[_0x918c('0x13')],_0x1cad82);_0x4832c3(_0x215eb8[_0x918c('0x12')](0x1f4,_0x146579[_0x918c('0x13')]));});});};exports[_0x918c('0x1f')]=function(_0x48d5da){var _0x183d31=this;return new Promise(function(_0x38c253,_0x4e7981){return db['ZohoAccount'][_0x918c('0x20')]({'raw':_0x48d5da[_0x918c('0x17')]?_0x48d5da[_0x918c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x48d5da[_0x918c('0x17')]?_0x48d5da['options'][_0x918c('0x21')]||null:null,'attributes':_0x48d5da[_0x918c('0x17')]?_0x48d5da[_0x918c('0x17')][_0x918c('0x1b')]||null:null,'include':_0x48d5da[_0x918c('0x17')]?_0x48d5da['options'][_0x918c('0x1c')]?_[_0x918c('0x19')](_0x48d5da[_0x918c('0x17')][_0x918c('0x1c')],function(_0x90222e){return{'model':db[_0x90222e[_0x918c('0x1a')]],'as':_0x90222e['as'],'attributes':_0x90222e['attributes'],'include':_0x90222e['include']?_[_0x918c('0x19')](_0x90222e['include'],function(_0x12fb8d){return{'model':db[_0x12fb8d['model']],'as':_0x12fb8d['as'],'attributes':_0x12fb8d['attributes'],'include':_0x12fb8d[_0x918c('0x1c')]?_[_0x918c('0x19')](_0x12fb8d[_0x918c('0x1c')],function(_0x4b549f){return{'model':db[_0x4b549f['model']],'as':_0x4b549f['as'],'attributes':_0x4b549f[_0x918c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x918c('0x1d')](function(_0x52b30b){logger[_0x918c('0xb')](_0x918c('0x1f'),_0x48d5da);logger[_0x918c('0xe')](_0x918c('0x1f'),_0x48d5da,JSON[_0x918c('0x10')](_0x52b30b));_0x38c253(_0x52b30b);})['catch'](function(_0x270b4d){logger[_0x918c('0x12')]('ShowZohoAccount',_0x270b4d[_0x918c('0x13')],_0x48d5da);_0x4e7981(_0x183d31['error'](0x1f4,_0x270b4d[_0x918c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 49943ac..9f39d2b 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 _0x7777=['getSubjects','/:id/descriptions','post','create','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects'];(function(_0x10c1a4,_0x5e9594){var _0x6ed8cb=function(_0x1aac74){while(--_0x1aac74){_0x10c1a4['push'](_0x10c1a4['shift']());}};_0x6ed8cb(++_0x5e9594);}(_0x7777,0x188));var _0x7777=function(_0x44c801,_0x5ad314){_0x44c801=_0x44c801-0x0;var _0x3f3468=_0x7777[_0x44c801];return _0x3f3468;};'use strict';var multer=require(_0x7777('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7777('0x1'));var express=require(_0x7777('0x2'));var router=express[_0x7777('0x3')]();var fs_extra=require(_0x7777('0x4'));var auth=require(_0x7777('0x5'));var interaction=require(_0x7777('0x6'));var config=require(_0x7777('0x7'));var controller=require(_0x7777('0x8'));router[_0x7777('0x9')]('/',auth[_0x7777('0xa')](),controller[_0x7777('0xb')]);router[_0x7777('0x9')](_0x7777('0xc'),auth[_0x7777('0xa')](),controller[_0x7777('0xd')]);router[_0x7777('0x9')](_0x7777('0xe'),auth[_0x7777('0xa')](),controller['getFields']);router['get'](_0x7777('0xf'),auth[_0x7777('0xa')](),controller[_0x7777('0x10')]);router[_0x7777('0x9')](_0x7777('0x11'),auth[_0x7777('0xa')](),controller['getDescriptions']);router[_0x7777('0x12')]('/',auth['isAuthenticated'](),controller[_0x7777('0x13')]);router[_0x7777('0x14')](_0x7777('0xc'),auth[_0x7777('0xa')](),controller[_0x7777('0x15')]);router['delete'](_0x7777('0xc'),auth[_0x7777('0xa')](),controller[_0x7777('0x16')]);module[_0x7777('0x17')]=router; \ No newline at end of file +var _0x7c68=['./intZohoConfiguration.controller','isAuthenticated','index','/:id','show','getFields','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','update','delete','destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x27843d,_0x386cd2){var _0x387d7d=function(_0x3f6105){while(--_0x3f6105){_0x27843d['push'](_0x27843d['shift']());}};_0x387d7d(++_0x386cd2);}(_0x7c68,0x175));var _0x87c6=function(_0x55fe04,_0x2ae793){_0x55fe04=_0x55fe04-0x0;var _0x216010=_0x7c68[_0x55fe04];return _0x216010;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x87c6('0x0'));var router=express[_0x87c6('0x1')]();var fs_extra=require(_0x87c6('0x2'));var auth=require(_0x87c6('0x3'));var interaction=require(_0x87c6('0x4'));var config=require('../../config/environment');var controller=require(_0x87c6('0x5'));router['get']('/',auth[_0x87c6('0x6')](),controller[_0x87c6('0x7')]);router['get'](_0x87c6('0x8'),auth[_0x87c6('0x6')](),controller[_0x87c6('0x9')]);router['get']('/:id/fields',auth[_0x87c6('0x6')](),controller[_0x87c6('0xa')]);router[_0x87c6('0xb')](_0x87c6('0xc'),auth[_0x87c6('0x6')](),controller[_0x87c6('0xd')]);router[_0x87c6('0xb')](_0x87c6('0xe'),auth[_0x87c6('0x6')](),controller[_0x87c6('0xf')]);router['post']('/',auth[_0x87c6('0x6')](),controller[_0x87c6('0x10')]);router['put'](_0x87c6('0x8'),auth[_0x87c6('0x6')](),controller[_0x87c6('0x11')]);router[_0x87c6('0x12')](_0x87c6('0x8'),auth['isAuthenticated'](),controller[_0x87c6('0x13')]);module[_0x87c6('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index ecdd452..54107f8 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 _0xbf16=['ENUM','contact_lead','contact','sequelize','exports','STRING','lead','nothing'];(function(_0x35bd6c,_0x585087){var _0x2f421d=function(_0x42ae70){while(--_0x42ae70){_0x35bd6c['push'](_0x35bd6c['shift']());}};_0x2f421d(++_0x585087);}(_0xbf16,0x73));var _0x6bf1=function(_0x1db686,_0x17b875){_0x1db686=_0x1db686-0x0;var _0x2f945a=_0xbf16[_0x1db686];return _0x2f945a;};'use strict';var Sequelize=require(_0x6bf1('0x0'));module[_0x6bf1('0x1')]={'name':{'type':Sequelize[_0x6bf1('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x6bf1('0x3'),'contact',_0x6bf1('0x4')),'defaultValue':_0x6bf1('0x3')},'moduleSearch':{'type':Sequelize[_0x6bf1('0x5')](_0x6bf1('0x6'),_0x6bf1('0x7'),'lead'),'defaultValue':_0x6bf1('0x6')},'description':{'type':Sequelize[_0x6bf1('0x2')]}}; \ No newline at end of file +var _0x25d5=['lead','contact','nothing','ENUM','contact_lead','sequelize','STRING'];(function(_0x3376d0,_0x56c93f){var _0x1bdc61=function(_0x28531d){while(--_0x28531d){_0x3376d0['push'](_0x3376d0['shift']());}};_0x1bdc61(++_0x56c93f);}(_0x25d5,0x91));var _0x525d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x525d('0x0'));module['exports']={'name':{'type':Sequelize[_0x525d('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x525d('0x2'),_0x525d('0x3'),_0x525d('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x525d('0x5')](_0x525d('0x6'),_0x525d('0x3'),_0x525d('0x2')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x525d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index c2c1e4b..52e4dc5 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 _0xa11f=['filter','merge','options','includeAll','findAll','catch','show','keys','find','create','body','getFields','findOne','ZohoField','order','length','getSubjects','pick','getDescriptions','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','sox','ejs','fs-extra','lodash','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/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','destroy','then','error','stack','name','map','ZohoConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where'];(function(_0x2be265,_0x3f4067){var _0x450ed1=function(_0x2557de){while(--_0x2557de){_0x2be265['push'](_0x2be265['shift']());}};_0x450ed1(++_0x3f4067);}(_0xa11f,0xfb));var _0xfa11=function(_0x52a6e3,_0x4a73b4){_0x52a6e3=_0x52a6e3-0x0;var _0x8910d0=_0xa11f[_0x52a6e3];return _0x8910d0;};'use strict';var emlformat=require(_0xfa11('0x0'));var rimraf=require(_0xfa11('0x1'));var zipdir=require(_0xfa11('0x2'));var jsonpatch=require(_0xfa11('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfa11('0x4'));var util=require('util');var path=require('path');var sox=require(_0xfa11('0x5'));var csv=require('to-csv');var ejs=require(_0xfa11('0x6'));var fs=require('fs');var fs_extra=require(_0xfa11('0x7'));var _=require(_0xfa11('0x8'));var squel=require(_0xfa11('0x9'));var crypto=require(_0xfa11('0xa'));var jsforce=require(_0xfa11('0xb'));var deskjs=require(_0xfa11('0xc'));var toCsv=require(_0xfa11('0xd'));var querystring=require(_0xfa11('0xe'));var Papa=require('papaparse');var Redis=require(_0xfa11('0xf'));var authService=require(_0xfa11('0x10'));var qs=require(_0xfa11('0x11'));var as=require(_0xfa11('0x12'));var hardwareService=require(_0xfa11('0x13'));var logger=require(_0xfa11('0x14'))(_0xfa11('0x15'));var utils=require(_0xfa11('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfa11('0x17'));var db=require(_0xfa11('0x18'))['db'];function respondWithStatusCode(_0x153f23,_0x42fed4){_0x42fed4=_0x42fed4||0xcc;return function(_0x21bd37){if(_0x21bd37){return _0x153f23[_0xfa11('0x19')](_0x42fed4);}return _0x153f23[_0xfa11('0x1a')](_0x42fed4)[_0xfa11('0x1b')]();};}function respondWithResult(_0x1b8ea9,_0x359902){_0x359902=_0x359902||0xc8;return function(_0x189109){if(_0x189109){return _0x1b8ea9[_0xfa11('0x1a')](_0x359902)[_0xfa11('0x1c')](_0x189109);}};}function respondWithFilteredResult(_0x42bee3,_0x25a490){return function(_0x39956e){if(_0x39956e){var _0x59b437=typeof _0x25a490['offset']===_0xfa11('0x1d')&&typeof _0x25a490[_0xfa11('0x1e')]==='undefined';var _0x4fda50=_0x39956e[_0xfa11('0x1f')];var _0x3a181a=_0x59b437?0x0:_0x25a490[_0xfa11('0x20')];var _0x426d6e=_0x59b437?_0x39956e['count']:_0x25a490[_0xfa11('0x20')]+_0x25a490[_0xfa11('0x1e')];var _0x4a5a95;if(_0x426d6e>=_0x4fda50){_0x426d6e=_0x4fda50;_0x4a5a95=0xc8;}else{_0x4a5a95=0xce;}_0x42bee3[_0xfa11('0x1a')](_0x4a5a95);return _0x42bee3['set'](_0xfa11('0x21'),_0x3a181a+'-'+_0x426d6e+'/'+_0x4fda50)[_0xfa11('0x1c')](_0x39956e);}return null;};}function patchUpdates(_0x482f5d){return function(_0x1752c9){try{jsonpatch['apply'](_0x1752c9,_0x482f5d,!![]);}catch(_0x43a9e7){return BPromise[_0xfa11('0x22')](_0x43a9e7);}return _0x1752c9[_0xfa11('0x23')]();};}function saveUpdates(_0x199c13,_0x783781){return function(_0x5f1f03){if(_0x5f1f03){return _0x5f1f03[_0xfa11('0x24')](_0x199c13)['then'](function(_0x23d397){return _0x23d397;});}return null;};}function removeEntity(_0x22dc66,_0x42b518){return function(_0x44885c){if(_0x44885c){return _0x44885c[_0xfa11('0x25')]()[_0xfa11('0x26')](function(){_0x22dc66[_0xfa11('0x1a')](0xcc)[_0xfa11('0x1b')]();});}};}function handleEntityNotFound(_0xb440ba,_0x412904){return function(_0x4ae55a){if(!_0x4ae55a){_0xb440ba[_0xfa11('0x19')](0x194);}return _0x4ae55a;};}function handleError(_0x571fef,_0x487622){_0x487622=_0x487622||0x1f4;return function(_0x442d2b){logger[_0xfa11('0x27')](_0x442d2b[_0xfa11('0x28')]);if(_0x442d2b[_0xfa11('0x29')]){delete _0x442d2b[_0xfa11('0x29')];}_0x571fef[_0xfa11('0x1a')](_0x487622)['send'](_0x442d2b);};}exports['index']=function(_0x4180e1,_0x3534ae){var _0x18a175={},_0x43ea94={},_0x45790e={'count':0x0,'rows':[]};var _0x45219a=_[_0xfa11('0x2a')](db[_0xfa11('0x2b')][_0xfa11('0x2c')],function(_0x587b82){return{'name':_0x587b82[_0xfa11('0x2d')],'type':_0x587b82['type'][_0xfa11('0x2e')]};});_0x43ea94[_0xfa11('0x2f')]=_[_0xfa11('0x2a')](_0x45219a,_0xfa11('0x29'));_0x43ea94[_0xfa11('0x30')]=_['keys'](_0x4180e1[_0xfa11('0x30')]);_0x43ea94[_0xfa11('0x31')]=_[_0xfa11('0x32')](_0x43ea94['model'],_0x43ea94['query']);_0x18a175[_0xfa11('0x33')]=_['intersection'](_0x43ea94[_0xfa11('0x2f')],qs['fields'](_0x4180e1[_0xfa11('0x30')][_0xfa11('0x34')]));_0x18a175[_0xfa11('0x33')]=_0x18a175[_0xfa11('0x33')]['length']?_0x18a175[_0xfa11('0x33')]:_0x43ea94[_0xfa11('0x2f')];if(!_0x4180e1[_0xfa11('0x30')][_0xfa11('0x35')](_0xfa11('0x36'))){_0x18a175[_0xfa11('0x1e')]=qs[_0xfa11('0x1e')](_0x4180e1[_0xfa11('0x30')][_0xfa11('0x1e')]);_0x18a175[_0xfa11('0x20')]=qs[_0xfa11('0x20')](_0x4180e1['query'][_0xfa11('0x20')]);}_0x18a175['order']=qs['sort'](_0x4180e1[_0xfa11('0x30')][_0xfa11('0x37')]);_0x18a175[_0xfa11('0x38')]=qs[_0xfa11('0x31')](_['pick'](_0x4180e1['query'],_0x43ea94[_0xfa11('0x31')]),_0x45219a);if(_0x4180e1['query'][_0xfa11('0x39')]){_0x18a175[_0xfa11('0x38')]=_[_0xfa11('0x3a')](_0x18a175['where'],{'$or':_[_0xfa11('0x2a')](_0x45219a,function(_0x3c232e){if(_0x3c232e['type']!=='VIRTUAL'){var _0xf3c537={};_0xf3c537[_0x3c232e[_0xfa11('0x29')]]={'$like':'%'+_0x4180e1[_0xfa11('0x30')][_0xfa11('0x39')]+'%'};return _0xf3c537;}})});}_0x18a175=_[_0xfa11('0x3a')]({},_0x18a175,_0x4180e1[_0xfa11('0x3b')]);var _0x59ad9a={'where':_0x18a175[_0xfa11('0x38')]};return db[_0xfa11('0x2b')][_0xfa11('0x1f')](_0x59ad9a)['then'](function(_0x5ceca6){_0x45790e[_0xfa11('0x1f')]=_0x5ceca6;if(_0x4180e1[_0xfa11('0x30')][_0xfa11('0x3c')]){_0x18a175['include']=[{'all':!![]}];}return db[_0xfa11('0x2b')][_0xfa11('0x3d')](_0x18a175);})[_0xfa11('0x26')](function(_0xebdd58){_0x45790e['rows']=_0xebdd58;return _0x45790e;})[_0xfa11('0x26')](respondWithFilteredResult(_0x3534ae,_0x18a175))[_0xfa11('0x3e')](handleError(_0x3534ae,null));};exports[_0xfa11('0x3f')]=function(_0x2c7f40,_0x59bd98){var _0x2ea592={'raw':![],'where':{'id':_0x2c7f40['params']['id']}},_0x4a6a70={};_0x4a6a70['model']=_[_0xfa11('0x40')](db['ZohoConfiguration'][_0xfa11('0x2c')]);_0x4a6a70[_0xfa11('0x30')]=_[_0xfa11('0x40')](_0x2c7f40[_0xfa11('0x30')]);_0x4a6a70[_0xfa11('0x31')]=_[_0xfa11('0x32')](_0x4a6a70[_0xfa11('0x2f')],_0x4a6a70[_0xfa11('0x30')]);_0x2ea592[_0xfa11('0x33')]=_['intersection'](_0x4a6a70[_0xfa11('0x2f')],qs[_0xfa11('0x34')](_0x2c7f40[_0xfa11('0x30')][_0xfa11('0x34')]));_0x2ea592['attributes']=_0x2ea592[_0xfa11('0x33')]['length']?_0x2ea592['attributes']:_0x4a6a70[_0xfa11('0x2f')];if(_0x2c7f40[_0xfa11('0x30')][_0xfa11('0x3c')]){_0x2ea592['include']=[{'all':!![]}];}_0x2ea592=_[_0xfa11('0x3a')]({},_0x2ea592,_0x2c7f40[_0xfa11('0x3b')]);return db['ZohoConfiguration'][_0xfa11('0x41')](_0x2ea592)[_0xfa11('0x26')](handleEntityNotFound(_0x59bd98,null))[_0xfa11('0x26')](respondWithResult(_0x59bd98,null))[_0xfa11('0x3e')](handleError(_0x59bd98,null));};exports[_0xfa11('0x42')]=function(_0x7bb115,_0x28ac1a){return db[_0xfa11('0x2b')]['create'](_0x7bb115[_0xfa11('0x43')],{})[_0xfa11('0x26')](respondWithResult(_0x28ac1a,0xc9))[_0xfa11('0x3e')](handleError(_0x28ac1a,null));};exports[_0xfa11('0x24')]=function(_0x5e9753,_0x44944f){if(_0x5e9753[_0xfa11('0x43')]['id']){delete _0x5e9753[_0xfa11('0x43')]['id'];}return db[_0xfa11('0x2b')][_0xfa11('0x41')]({'where':{'id':_0x5e9753['params']['id']}})[_0xfa11('0x26')](handleEntityNotFound(_0x44944f,null))[_0xfa11('0x26')](saveUpdates(_0x5e9753['body'],null))[_0xfa11('0x26')](respondWithResult(_0x44944f,null))[_0xfa11('0x3e')](handleError(_0x44944f,null));};exports[_0xfa11('0x25')]=function(_0x13763c,_0x5f5c5f){return db['ZohoConfiguration'][_0xfa11('0x41')]({'where':{'id':_0x13763c['params']['id']}})[_0xfa11('0x26')](handleEntityNotFound(_0x5f5c5f,null))['then'](removeEntity(_0x5f5c5f,null))[_0xfa11('0x3e')](handleError(_0x5f5c5f,null));};exports[_0xfa11('0x44')]=function(_0x5451ce,_0x47a71c,_0x107644){var _0x5a9290={};var _0x23d0d0={};var _0x2d0578;var _0x1fba04;return db[_0xfa11('0x2b')][_0xfa11('0x45')]({'where':{'id':_0x5451ce['params']['id']}})['then'](handleEntityNotFound(_0x47a71c,null))[_0xfa11('0x26')](function(_0x3823a3){if(_0x3823a3){_0x2d0578=_0x3823a3;_0x23d0d0[_0xfa11('0x2f')]=_[_0xfa11('0x40')](db[_0xfa11('0x46')][_0xfa11('0x2c')]);_0x23d0d0['query']=_[_0xfa11('0x40')](_0x5451ce[_0xfa11('0x30')]);_0x23d0d0[_0xfa11('0x31')]=_[_0xfa11('0x32')](_0x23d0d0[_0xfa11('0x2f')],_0x23d0d0[_0xfa11('0x30')]);_0x5a9290[_0xfa11('0x33')]=_['intersection'](_0x23d0d0[_0xfa11('0x2f')],qs['fields'](_0x5451ce['query'][_0xfa11('0x34')]));_0x5a9290[_0xfa11('0x33')]=_0x5a9290[_0xfa11('0x33')]['length']?_0x5a9290[_0xfa11('0x33')]:_0x23d0d0[_0xfa11('0x2f')];_0x5a9290[_0xfa11('0x47')]=qs[_0xfa11('0x37')](_0x5451ce['query'][_0xfa11('0x37')]);_0x5a9290['where']=qs[_0xfa11('0x31')](_['pick'](_0x5451ce[_0xfa11('0x30')],_0x23d0d0['filters']));if(_0x5451ce['query'][_0xfa11('0x39')]){_0x5a9290[_0xfa11('0x38')]=_[_0xfa11('0x3a')](_0x5a9290[_0xfa11('0x38')],{'$or':_['map'](_0x5a9290[_0xfa11('0x33')],function(_0x421ae7){var _0x62d81d={};_0x62d81d[_0x421ae7]={'$like':'%'+_0x5451ce[_0xfa11('0x30')][_0xfa11('0x39')]+'%'};return _0x62d81d;})});}_0x5a9290=_[_0xfa11('0x3a')]({},_0x5a9290,_0x5451ce[_0xfa11('0x3b')]);return _0x2d0578[_0xfa11('0x44')](_0x5a9290);}})[_0xfa11('0x26')](function(_0x4036ba){if(_0x4036ba){_0x1fba04=_0x4036ba[_0xfa11('0x48')];if(!_0x5451ce[_0xfa11('0x30')][_0xfa11('0x35')](_0xfa11('0x36'))){_0x5a9290[_0xfa11('0x1e')]=qs[_0xfa11('0x1e')](_0x5451ce['query'][_0xfa11('0x1e')]);_0x5a9290[_0xfa11('0x20')]=qs[_0xfa11('0x20')](_0x5451ce[_0xfa11('0x30')][_0xfa11('0x20')]);}return _0x2d0578['getFields'](_0x5a9290);}})[_0xfa11('0x26')](function(_0x303e42){if(_0x303e42){return _0x303e42?{'count':_0x1fba04,'rows':_0x303e42}:null;}})[_0xfa11('0x26')](respondWithResult(_0x47a71c,null))[_0xfa11('0x3e')](handleError(_0x47a71c,null));};exports[_0xfa11('0x49')]=function(_0x107806,_0x3bee87,_0xccf42e){var _0x35047b={};var _0x67ac9c={};var _0x5b0e61;var _0x3bf043;return db[_0xfa11('0x2b')]['findOne']({'where':{'id':_0x107806['params']['id']}})[_0xfa11('0x26')](handleEntityNotFound(_0x3bee87,null))[_0xfa11('0x26')](function(_0x3876f3){if(_0x3876f3){_0x5b0e61=_0x3876f3;_0x67ac9c['model']=_[_0xfa11('0x40')](db[_0xfa11('0x46')]['rawAttributes']);_0x67ac9c['query']=_[_0xfa11('0x40')](_0x107806[_0xfa11('0x30')]);_0x67ac9c[_0xfa11('0x31')]=_[_0xfa11('0x32')](_0x67ac9c[_0xfa11('0x2f')],_0x67ac9c[_0xfa11('0x30')]);_0x35047b[_0xfa11('0x33')]=_[_0xfa11('0x32')](_0x67ac9c['model'],qs[_0xfa11('0x34')](_0x107806[_0xfa11('0x30')][_0xfa11('0x34')]));_0x35047b[_0xfa11('0x33')]=_0x35047b['attributes'][_0xfa11('0x48')]?_0x35047b[_0xfa11('0x33')]:_0x67ac9c['model'];_0x35047b[_0xfa11('0x47')]=qs[_0xfa11('0x37')](_0x107806['query'][_0xfa11('0x37')]);_0x35047b[_0xfa11('0x38')]=qs[_0xfa11('0x31')](_[_0xfa11('0x4a')](_0x107806[_0xfa11('0x30')],_0x67ac9c[_0xfa11('0x31')]));if(_0x107806[_0xfa11('0x30')][_0xfa11('0x39')]){_0x35047b['where']=_[_0xfa11('0x3a')](_0x35047b[_0xfa11('0x38')],{'$or':_['map'](_0x35047b[_0xfa11('0x33')],function(_0x285188){var _0x31bbad={};_0x31bbad[_0x285188]={'$like':'%'+_0x107806[_0xfa11('0x30')][_0xfa11('0x39')]+'%'};return _0x31bbad;})});}_0x35047b=_[_0xfa11('0x3a')]({},_0x35047b,_0x107806[_0xfa11('0x3b')]);return _0x5b0e61['getSubjects'](_0x35047b);}})[_0xfa11('0x26')](function(_0x592f4e){if(_0x592f4e){_0x3bf043=_0x592f4e['length'];if(!_0x107806['query'][_0xfa11('0x35')](_0xfa11('0x36'))){_0x35047b[_0xfa11('0x1e')]=qs[_0xfa11('0x1e')](_0x107806[_0xfa11('0x30')][_0xfa11('0x1e')]);_0x35047b[_0xfa11('0x20')]=qs[_0xfa11('0x20')](_0x107806[_0xfa11('0x30')][_0xfa11('0x20')]);}return _0x5b0e61[_0xfa11('0x49')](_0x35047b);}})[_0xfa11('0x26')](function(_0x6232bf){if(_0x6232bf){return _0x6232bf?{'count':_0x3bf043,'rows':_0x6232bf}:null;}})[_0xfa11('0x26')](respondWithResult(_0x3bee87,null))[_0xfa11('0x3e')](handleError(_0x3bee87,null));};exports[_0xfa11('0x4b')]=function(_0x44ad0b,_0x31ec96,_0x4196b6){var _0x3035cc={};var _0x1512fa={};var _0x5de741;var _0x384d35;return db[_0xfa11('0x2b')][_0xfa11('0x45')]({'where':{'id':_0x44ad0b[_0xfa11('0x4c')]['id']}})[_0xfa11('0x26')](handleEntityNotFound(_0x31ec96,null))[_0xfa11('0x26')](function(_0x503f12){if(_0x503f12){_0x5de741=_0x503f12;_0x1512fa['model']=_[_0xfa11('0x40')](db['ZohoField'][_0xfa11('0x2c')]);_0x1512fa[_0xfa11('0x30')]=_[_0xfa11('0x40')](_0x44ad0b[_0xfa11('0x30')]);_0x1512fa[_0xfa11('0x31')]=_[_0xfa11('0x32')](_0x1512fa[_0xfa11('0x2f')],_0x1512fa[_0xfa11('0x30')]);_0x3035cc['attributes']=_[_0xfa11('0x32')](_0x1512fa[_0xfa11('0x2f')],qs[_0xfa11('0x34')](_0x44ad0b['query'][_0xfa11('0x34')]));_0x3035cc['attributes']=_0x3035cc[_0xfa11('0x33')][_0xfa11('0x48')]?_0x3035cc[_0xfa11('0x33')]:_0x1512fa[_0xfa11('0x2f')];_0x3035cc['order']=qs[_0xfa11('0x37')](_0x44ad0b[_0xfa11('0x30')][_0xfa11('0x37')]);_0x3035cc[_0xfa11('0x38')]=qs[_0xfa11('0x31')](_[_0xfa11('0x4a')](_0x44ad0b[_0xfa11('0x30')],_0x1512fa[_0xfa11('0x31')]));if(_0x44ad0b[_0xfa11('0x30')][_0xfa11('0x39')]){_0x3035cc[_0xfa11('0x38')]=_[_0xfa11('0x3a')](_0x3035cc['where'],{'$or':_[_0xfa11('0x2a')](_0x3035cc[_0xfa11('0x33')],function(_0xe9d9ba){var _0x4c217d={};_0x4c217d[_0xe9d9ba]={'$like':'%'+_0x44ad0b[_0xfa11('0x30')]['filter']+'%'};return _0x4c217d;})});}_0x3035cc=_[_0xfa11('0x3a')]({},_0x3035cc,_0x44ad0b[_0xfa11('0x3b')]);return _0x5de741[_0xfa11('0x4b')](_0x3035cc);}})[_0xfa11('0x26')](function(_0x2e9a8f){if(_0x2e9a8f){_0x384d35=_0x2e9a8f[_0xfa11('0x48')];if(!_0x44ad0b[_0xfa11('0x30')][_0xfa11('0x35')](_0xfa11('0x36'))){_0x3035cc[_0xfa11('0x1e')]=qs[_0xfa11('0x1e')](_0x44ad0b[_0xfa11('0x30')][_0xfa11('0x1e')]);_0x3035cc[_0xfa11('0x20')]=qs[_0xfa11('0x20')](_0x44ad0b[_0xfa11('0x30')]['offset']);}return _0x5de741['getDescriptions'](_0x3035cc);}})[_0xfa11('0x26')](function(_0x8bd35b){if(_0x8bd35b){return _0x8bd35b?{'count':_0x384d35,'rows':_0x8bd35b}:null;}})[_0xfa11('0x26')](respondWithResult(_0x31ec96,null))[_0xfa11('0x3e')](handleError(_0x31ec96,null));}; \ No newline at end of file +var _0xc268=['destroy','getFields','order','pick','nolimit','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','end','name','send','index','ZohoConfiguration','type','key','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body'];(function(_0x58a021,_0x17bc70){var _0x194761=function(_0x32db18){while(--_0x32db18){_0x58a021['push'](_0x58a021['shift']());}};_0x194761(++_0x17bc70);}(_0xc268,0x13d));var _0x8c26=function(_0x3d68cd,_0x466ce4){_0x3d68cd=_0x3d68cd-0x0;var _0x4ee014=_0xc268[_0x3d68cd];return _0x4ee014;};'use strict';var emlformat=require(_0x8c26('0x0'));var rimraf=require(_0x8c26('0x1'));var zipdir=require(_0x8c26('0x2'));var jsonpatch=require(_0x8c26('0x3'));var rp=require(_0x8c26('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8c26('0x5'));var sox=require(_0x8c26('0x6'));var csv=require(_0x8c26('0x7'));var ejs=require(_0x8c26('0x8'));var fs=require('fs');var fs_extra=require(_0x8c26('0x9'));var _=require(_0x8c26('0xa'));var squel=require(_0x8c26('0xb'));var crypto=require('crypto');var jsforce=require(_0x8c26('0xc'));var deskjs=require(_0x8c26('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8c26('0xe'));var Redis=require(_0x8c26('0xf'));var authService=require(_0x8c26('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8c26('0x11'));var hardwareService=require(_0x8c26('0x12'));var logger=require(_0x8c26('0x13'))(_0x8c26('0x14'));var utils=require(_0x8c26('0x15'));var config=require(_0x8c26('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x520638,_0x46cb2d){_0x46cb2d=_0x46cb2d||0xcc;return function(_0x589dbf){if(_0x589dbf){return _0x520638['sendStatus'](_0x46cb2d);}return _0x520638[_0x8c26('0x17')](_0x46cb2d)['end']();};}function respondWithResult(_0x1fc4e4,_0x3d63cb){_0x3d63cb=_0x3d63cb||0xc8;return function(_0x547327){if(_0x547327){return _0x1fc4e4[_0x8c26('0x17')](_0x3d63cb)[_0x8c26('0x18')](_0x547327);}};}function respondWithFilteredResult(_0xc103a7,_0x33c1a0){return function(_0x4b79b0){if(_0x4b79b0){var _0x5283fb=typeof _0x33c1a0[_0x8c26('0x19')]===_0x8c26('0x1a')&&typeof _0x33c1a0[_0x8c26('0x1b')]===_0x8c26('0x1a');var _0x42db2c=_0x4b79b0[_0x8c26('0x1c')];var _0x5f3a02=_0x5283fb?0x0:_0x33c1a0['offset'];var _0x1a7b76=_0x5283fb?_0x4b79b0[_0x8c26('0x1c')]:_0x33c1a0[_0x8c26('0x19')]+_0x33c1a0[_0x8c26('0x1b')];var _0x4cdda2;if(_0x1a7b76>=_0x42db2c){_0x1a7b76=_0x42db2c;_0x4cdda2=0xc8;}else{_0x4cdda2=0xce;}_0xc103a7['status'](_0x4cdda2);return _0xc103a7['set'](_0x8c26('0x1d'),_0x5f3a02+'-'+_0x1a7b76+'/'+_0x42db2c)['json'](_0x4b79b0);}return null;};}function patchUpdates(_0x5e422e){return function(_0x21b217){try{jsonpatch[_0x8c26('0x1e')](_0x21b217,_0x5e422e,!![]);}catch(_0x14431f){return BPromise[_0x8c26('0x1f')](_0x14431f);}return _0x21b217['save']();};}function saveUpdates(_0x225f18,_0x4e1e7e){return function(_0x10d2c1){if(_0x10d2c1){return _0x10d2c1[_0x8c26('0x20')](_0x225f18)[_0x8c26('0x21')](function(_0x508b5e){return _0x508b5e;});}return null;};}function removeEntity(_0x56668a,_0x3928bc){return function(_0x53c9a3){if(_0x53c9a3){return _0x53c9a3['destroy']()[_0x8c26('0x21')](function(){_0x56668a[_0x8c26('0x17')](0xcc)[_0x8c26('0x22')]();});}};}function handleEntityNotFound(_0x527380,_0x2039af){return function(_0x13660b){if(!_0x13660b){_0x527380['sendStatus'](0x194);}return _0x13660b;};}function handleError(_0x285647,_0x30712d){_0x30712d=_0x30712d||0x1f4;return function(_0x345aca){logger['error'](_0x345aca['stack']);if(_0x345aca['name']){delete _0x345aca[_0x8c26('0x23')];}_0x285647['status'](_0x30712d)[_0x8c26('0x24')](_0x345aca);};}exports[_0x8c26('0x25')]=function(_0x287987,_0x359fc4){var _0x5a5840={},_0x5a9900={},_0x178706={'count':0x0,'rows':[]};var _0x4ab6a1=_['map'](db[_0x8c26('0x26')]['rawAttributes'],function(_0x279d1b){return{'name':_0x279d1b['fieldName'],'type':_0x279d1b[_0x8c26('0x27')][_0x8c26('0x28')]};});_0x5a9900['model']=_[_0x8c26('0x29')](_0x4ab6a1,_0x8c26('0x23'));_0x5a9900['query']=_[_0x8c26('0x2a')](_0x287987[_0x8c26('0x2b')]);_0x5a9900[_0x8c26('0x2c')]=_[_0x8c26('0x2d')](_0x5a9900[_0x8c26('0x2e')],_0x5a9900[_0x8c26('0x2b')]);_0x5a5840['attributes']=_['intersection'](_0x5a9900[_0x8c26('0x2e')],qs[_0x8c26('0x2f')](_0x287987[_0x8c26('0x2b')]['fields']));_0x5a5840['attributes']=_0x5a5840[_0x8c26('0x30')][_0x8c26('0x31')]?_0x5a5840['attributes']:_0x5a9900[_0x8c26('0x2e')];if(!_0x287987['query'][_0x8c26('0x32')]('nolimit')){_0x5a5840['limit']=qs[_0x8c26('0x1b')](_0x287987['query'][_0x8c26('0x1b')]);_0x5a5840[_0x8c26('0x19')]=qs[_0x8c26('0x19')](_0x287987[_0x8c26('0x2b')][_0x8c26('0x19')]);}_0x5a5840['order']=qs['sort'](_0x287987['query'][_0x8c26('0x33')]);_0x5a5840[_0x8c26('0x34')]=qs['filters'](_['pick'](_0x287987[_0x8c26('0x2b')],_0x5a9900[_0x8c26('0x2c')]),_0x4ab6a1);if(_0x287987['query'][_0x8c26('0x35')]){_0x5a5840['where']=_['merge'](_0x5a5840['where'],{'$or':_[_0x8c26('0x29')](_0x4ab6a1,function(_0x3e221c){if(_0x3e221c['type']!==_0x8c26('0x36')){var _0x535485={};_0x535485[_0x3e221c[_0x8c26('0x23')]]={'$like':'%'+_0x287987[_0x8c26('0x2b')][_0x8c26('0x35')]+'%'};return _0x535485;}})});}_0x5a5840=_[_0x8c26('0x37')]({},_0x5a5840,_0x287987[_0x8c26('0x38')]);var _0x1af73b={'where':_0x5a5840[_0x8c26('0x34')]};return db[_0x8c26('0x26')][_0x8c26('0x1c')](_0x1af73b)[_0x8c26('0x21')](function(_0x2bbac8){_0x178706[_0x8c26('0x1c')]=_0x2bbac8;if(_0x287987['query'][_0x8c26('0x39')]){_0x5a5840[_0x8c26('0x3a')]=[{'all':!![]}];}return db[_0x8c26('0x26')][_0x8c26('0x3b')](_0x5a5840);})[_0x8c26('0x21')](function(_0x3e8184){_0x178706[_0x8c26('0x3c')]=_0x3e8184;return _0x178706;})[_0x8c26('0x21')](respondWithFilteredResult(_0x359fc4,_0x5a5840))[_0x8c26('0x3d')](handleError(_0x359fc4,null));};exports[_0x8c26('0x3e')]=function(_0x4f17af,_0x326763){var _0xf82f1={'raw':![],'where':{'id':_0x4f17af[_0x8c26('0x3f')]['id']}},_0x32e93c={};_0x32e93c[_0x8c26('0x2e')]=_['keys'](db[_0x8c26('0x26')][_0x8c26('0x40')]);_0x32e93c[_0x8c26('0x2b')]=_[_0x8c26('0x2a')](_0x4f17af['query']);_0x32e93c[_0x8c26('0x2c')]=_[_0x8c26('0x2d')](_0x32e93c[_0x8c26('0x2e')],_0x32e93c['query']);_0xf82f1[_0x8c26('0x30')]=_[_0x8c26('0x2d')](_0x32e93c[_0x8c26('0x2e')],qs[_0x8c26('0x2f')](_0x4f17af[_0x8c26('0x2b')][_0x8c26('0x2f')]));_0xf82f1[_0x8c26('0x30')]=_0xf82f1[_0x8c26('0x30')]['length']?_0xf82f1[_0x8c26('0x30')]:_0x32e93c[_0x8c26('0x2e')];if(_0x4f17af[_0x8c26('0x2b')][_0x8c26('0x39')]){_0xf82f1[_0x8c26('0x3a')]=[{'all':!![]}];}_0xf82f1=_[_0x8c26('0x37')]({},_0xf82f1,_0x4f17af[_0x8c26('0x38')]);return db[_0x8c26('0x26')][_0x8c26('0x41')](_0xf82f1)[_0x8c26('0x21')](handleEntityNotFound(_0x326763,null))[_0x8c26('0x21')](respondWithResult(_0x326763,null))[_0x8c26('0x3d')](handleError(_0x326763,null));};exports[_0x8c26('0x42')]=function(_0x220b69,_0x427d9a){return db[_0x8c26('0x26')][_0x8c26('0x42')](_0x220b69['body'],{})[_0x8c26('0x21')](respondWithResult(_0x427d9a,0xc9))[_0x8c26('0x3d')](handleError(_0x427d9a,null));};exports[_0x8c26('0x20')]=function(_0x15ab98,_0x241a3a){if(_0x15ab98[_0x8c26('0x43')]['id']){delete _0x15ab98[_0x8c26('0x43')]['id'];}return db[_0x8c26('0x26')][_0x8c26('0x41')]({'where':{'id':_0x15ab98[_0x8c26('0x3f')]['id']}})[_0x8c26('0x21')](handleEntityNotFound(_0x241a3a,null))[_0x8c26('0x21')](saveUpdates(_0x15ab98[_0x8c26('0x43')],null))['then'](respondWithResult(_0x241a3a,null))[_0x8c26('0x3d')](handleError(_0x241a3a,null));};exports[_0x8c26('0x44')]=function(_0x548146,_0x1e0996){return db[_0x8c26('0x26')]['find']({'where':{'id':_0x548146[_0x8c26('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1e0996,null))['then'](removeEntity(_0x1e0996,null))[_0x8c26('0x3d')](handleError(_0x1e0996,null));};exports[_0x8c26('0x45')]=function(_0x1f144b,_0x5e6009,_0x350e35){var _0x2515ce={};var _0x120622={};var _0x3f1037;var _0x4177f8;return db[_0x8c26('0x26')]['findOne']({'where':{'id':_0x1f144b[_0x8c26('0x3f')]['id']}})[_0x8c26('0x21')](handleEntityNotFound(_0x5e6009,null))[_0x8c26('0x21')](function(_0x488f1b){if(_0x488f1b){_0x3f1037=_0x488f1b;_0x120622[_0x8c26('0x2e')]=_[_0x8c26('0x2a')](db['ZohoField']['rawAttributes']);_0x120622[_0x8c26('0x2b')]=_[_0x8c26('0x2a')](_0x1f144b[_0x8c26('0x2b')]);_0x120622[_0x8c26('0x2c')]=_[_0x8c26('0x2d')](_0x120622[_0x8c26('0x2e')],_0x120622[_0x8c26('0x2b')]);_0x2515ce['attributes']=_[_0x8c26('0x2d')](_0x120622[_0x8c26('0x2e')],qs['fields'](_0x1f144b[_0x8c26('0x2b')]['fields']));_0x2515ce[_0x8c26('0x30')]=_0x2515ce['attributes'][_0x8c26('0x31')]?_0x2515ce[_0x8c26('0x30')]:_0x120622[_0x8c26('0x2e')];_0x2515ce[_0x8c26('0x46')]=qs['sort'](_0x1f144b[_0x8c26('0x2b')][_0x8c26('0x33')]);_0x2515ce['where']=qs[_0x8c26('0x2c')](_[_0x8c26('0x47')](_0x1f144b[_0x8c26('0x2b')],_0x120622[_0x8c26('0x2c')]));if(_0x1f144b[_0x8c26('0x2b')][_0x8c26('0x35')]){_0x2515ce['where']=_[_0x8c26('0x37')](_0x2515ce[_0x8c26('0x34')],{'$or':_['map'](_0x2515ce[_0x8c26('0x30')],function(_0x442a45){var _0x41e585={};_0x41e585[_0x442a45]={'$like':'%'+_0x1f144b[_0x8c26('0x2b')][_0x8c26('0x35')]+'%'};return _0x41e585;})});}_0x2515ce=_[_0x8c26('0x37')]({},_0x2515ce,_0x1f144b[_0x8c26('0x38')]);return _0x3f1037[_0x8c26('0x45')](_0x2515ce);}})['then'](function(_0x2cf4d5){if(_0x2cf4d5){_0x4177f8=_0x2cf4d5[_0x8c26('0x31')];if(!_0x1f144b['query'][_0x8c26('0x32')](_0x8c26('0x48'))){_0x2515ce[_0x8c26('0x1b')]=qs[_0x8c26('0x1b')](_0x1f144b['query']['limit']);_0x2515ce[_0x8c26('0x19')]=qs[_0x8c26('0x19')](_0x1f144b[_0x8c26('0x2b')][_0x8c26('0x19')]);}return _0x3f1037[_0x8c26('0x45')](_0x2515ce);}})[_0x8c26('0x21')](function(_0x53b913){if(_0x53b913){return _0x53b913?{'count':_0x4177f8,'rows':_0x53b913}:null;}})[_0x8c26('0x21')](respondWithResult(_0x5e6009,null))[_0x8c26('0x3d')](handleError(_0x5e6009,null));};exports['getSubjects']=function(_0xe340f7,_0x1e2825,_0x7dbf05){var _0x53868f={};var _0xaf7a7c={};var _0x49558b;var _0x2d9edc;return db[_0x8c26('0x26')][_0x8c26('0x49')]({'where':{'id':_0xe340f7[_0x8c26('0x3f')]['id']}})[_0x8c26('0x21')](handleEntityNotFound(_0x1e2825,null))['then'](function(_0x2a4b09){if(_0x2a4b09){_0x49558b=_0x2a4b09;_0xaf7a7c['model']=_[_0x8c26('0x2a')](db[_0x8c26('0x4a')][_0x8c26('0x40')]);_0xaf7a7c[_0x8c26('0x2b')]=_[_0x8c26('0x2a')](_0xe340f7[_0x8c26('0x2b')]);_0xaf7a7c[_0x8c26('0x2c')]=_[_0x8c26('0x2d')](_0xaf7a7c[_0x8c26('0x2e')],_0xaf7a7c[_0x8c26('0x2b')]);_0x53868f[_0x8c26('0x30')]=_[_0x8c26('0x2d')](_0xaf7a7c[_0x8c26('0x2e')],qs[_0x8c26('0x2f')](_0xe340f7[_0x8c26('0x2b')]['fields']));_0x53868f['attributes']=_0x53868f[_0x8c26('0x30')][_0x8c26('0x31')]?_0x53868f[_0x8c26('0x30')]:_0xaf7a7c['model'];_0x53868f[_0x8c26('0x46')]=qs[_0x8c26('0x33')](_0xe340f7[_0x8c26('0x2b')][_0x8c26('0x33')]);_0x53868f['where']=qs[_0x8c26('0x2c')](_[_0x8c26('0x47')](_0xe340f7[_0x8c26('0x2b')],_0xaf7a7c[_0x8c26('0x2c')]));if(_0xe340f7[_0x8c26('0x2b')][_0x8c26('0x35')]){_0x53868f[_0x8c26('0x34')]=_[_0x8c26('0x37')](_0x53868f['where'],{'$or':_['map'](_0x53868f['attributes'],function(_0x47e346){var _0x538e3a={};_0x538e3a[_0x47e346]={'$like':'%'+_0xe340f7['query']['filter']+'%'};return _0x538e3a;})});}_0x53868f=_[_0x8c26('0x37')]({},_0x53868f,_0xe340f7[_0x8c26('0x38')]);return _0x49558b[_0x8c26('0x4b')](_0x53868f);}})[_0x8c26('0x21')](function(_0x5c9488){if(_0x5c9488){_0x2d9edc=_0x5c9488[_0x8c26('0x31')];if(!_0xe340f7['query'][_0x8c26('0x32')]('nolimit')){_0x53868f[_0x8c26('0x1b')]=qs[_0x8c26('0x1b')](_0xe340f7['query']['limit']);_0x53868f['offset']=qs[_0x8c26('0x19')](_0xe340f7[_0x8c26('0x2b')]['offset']);}return _0x49558b[_0x8c26('0x4b')](_0x53868f);}})['then'](function(_0x1d557b){if(_0x1d557b){return _0x1d557b?{'count':_0x2d9edc,'rows':_0x1d557b}:null;}})[_0x8c26('0x21')](respondWithResult(_0x1e2825,null))[_0x8c26('0x3d')](handleError(_0x1e2825,null));};exports[_0x8c26('0x4c')]=function(_0x21c658,_0x4edd7a,_0x1181a0){var _0x35a72e={};var _0x2687b1={};var _0x2e334e;var _0x23b5c9;return db['ZohoConfiguration'][_0x8c26('0x49')]({'where':{'id':_0x21c658[_0x8c26('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4edd7a,null))['then'](function(_0x24b9d6){if(_0x24b9d6){_0x2e334e=_0x24b9d6;_0x2687b1['model']=_['keys'](db[_0x8c26('0x4a')][_0x8c26('0x40')]);_0x2687b1['query']=_['keys'](_0x21c658['query']);_0x2687b1['filters']=_['intersection'](_0x2687b1[_0x8c26('0x2e')],_0x2687b1[_0x8c26('0x2b')]);_0x35a72e['attributes']=_['intersection'](_0x2687b1['model'],qs[_0x8c26('0x2f')](_0x21c658[_0x8c26('0x2b')]['fields']));_0x35a72e[_0x8c26('0x30')]=_0x35a72e['attributes'][_0x8c26('0x31')]?_0x35a72e[_0x8c26('0x30')]:_0x2687b1[_0x8c26('0x2e')];_0x35a72e['order']=qs['sort'](_0x21c658[_0x8c26('0x2b')]['sort']);_0x35a72e[_0x8c26('0x34')]=qs['filters'](_[_0x8c26('0x47')](_0x21c658[_0x8c26('0x2b')],_0x2687b1[_0x8c26('0x2c')]));if(_0x21c658[_0x8c26('0x2b')][_0x8c26('0x35')]){_0x35a72e[_0x8c26('0x34')]=_[_0x8c26('0x37')](_0x35a72e[_0x8c26('0x34')],{'$or':_[_0x8c26('0x29')](_0x35a72e['attributes'],function(_0xeb4904){var _0xb13221={};_0xb13221[_0xeb4904]={'$like':'%'+_0x21c658[_0x8c26('0x2b')]['filter']+'%'};return _0xb13221;})});}_0x35a72e=_[_0x8c26('0x37')]({},_0x35a72e,_0x21c658['options']);return _0x2e334e[_0x8c26('0x4c')](_0x35a72e);}})[_0x8c26('0x21')](function(_0x3927ea){if(_0x3927ea){_0x23b5c9=_0x3927ea[_0x8c26('0x31')];if(!_0x21c658[_0x8c26('0x2b')][_0x8c26('0x32')](_0x8c26('0x48'))){_0x35a72e[_0x8c26('0x1b')]=qs[_0x8c26('0x1b')](_0x21c658[_0x8c26('0x2b')][_0x8c26('0x1b')]);_0x35a72e['offset']=qs[_0x8c26('0x19')](_0x21c658[_0x8c26('0x2b')]['offset']);}return _0x2e334e[_0x8c26('0x4c')](_0x35a72e);}})[_0x8c26('0x21')](function(_0x2ac9af){if(_0x2ac9af){return _0x2ac9af?{'count':_0x23b5c9,'rows':_0x2ac9af}:null;}})[_0x8c26('0x21')](respondWithResult(_0x4edd7a,null))['catch'](handleError(_0x4edd7a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index e064fd3..2d6b965 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 _0xb9b4=['bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x48ca83,_0x2e4099){var _0x2b1fab=function(_0x24dd42){while(--_0x24dd42){_0x48ca83['push'](_0x48ca83['shift']());}};_0x2b1fab(++_0x2e4099);}(_0xb9b4,0x133));var _0x4b9b=function(_0xfd5592,_0x48c851){_0xfd5592=_0xfd5592-0x0;var _0xeac3b9=_0xb9b4[_0xfd5592];return _0xeac3b9;};'use strict';var _=require(_0x4b9b('0x0'));var util=require(_0x4b9b('0x1'));var logger=require(_0x4b9b('0x2'))(_0x4b9b('0x3'));var moment=require(_0x4b9b('0x4'));var BPromise=require(_0x4b9b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b9b('0x6'));var rimraf=require(_0x4b9b('0x7'));var config=require(_0x4b9b('0x8'));var attributes=require(_0x4b9b('0x9'));module[_0x4b9b('0xa')]=function(_0x5d106b,_0x1eff06){return _0x5d106b[_0x4b9b('0xb')]('ZohoConfiguration',attributes,{'tableName':_0x4b9b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72eb=['../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x217ff6,_0x36f75d){var _0x417c93=function(_0x4787d2){while(--_0x4787d2){_0x217ff6['push'](_0x217ff6['shift']());}};_0x417c93(++_0x36f75d);}(_0x72eb,0x147));var _0xb72e=function(_0x5dc6fc,_0x4ef33a){_0x5dc6fc=_0x5dc6fc-0x0;var _0x53b560=_0x72eb[_0x5dc6fc];return _0x53b560;};'use strict';var _=require(_0xb72e('0x0'));var util=require(_0xb72e('0x1'));var logger=require(_0xb72e('0x2'))(_0xb72e('0x3'));var moment=require(_0xb72e('0x4'));var BPromise=require(_0xb72e('0x5'));var rp=require(_0xb72e('0x6'));var fs=require('fs');var path=require(_0xb72e('0x7'));var rimraf=require(_0xb72e('0x8'));var config=require(_0xb72e('0x9'));var attributes=require(_0xb72e('0xa'));module[_0xb72e('0xb')]=function(_0xd81d1a,_0x4808cc){return _0xd81d1a[_0xb72e('0xc')]('ZohoConfiguration',attributes,{'tableName':_0xb72e('0xd'),'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 f53bb9d..7bd53c0 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 _0xf5c0=['stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2a2b36,_0x489d44){var _0x5ef75f=function(_0x3ade9e){while(--_0x3ade9e){_0x2a2b36['push'](_0x2a2b36['shift']());}};_0x5ef75f(++_0x489d44);}(_0xf5c0,0xbe));var _0x0f5c=function(_0xdd9a5f,_0x3ced93){_0xdd9a5f=_0xdd9a5f-0x0;var _0x3464b7=_0xf5c0[_0xdd9a5f];return _0x3464b7;};'use strict';var _=require(_0x0f5c('0x0'));var util=require(_0x0f5c('0x1'));var moment=require('moment');var BPromise=require(_0x0f5c('0x2'));var rs=require(_0x0f5c('0x3'));var fs=require('fs');var Redis=require(_0x0f5c('0x4'));var db=require(_0x0f5c('0x5'))['db'];var utils=require(_0x0f5c('0x6'));var logger=require(_0x0f5c('0x7'))('rpc');var config=require(_0x0f5c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0f5c('0x9')][_0x0f5c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539209,_0x252d87,_0x2ee91e){return new BPromise(function(_0x4080fc,_0x45717c){return client[_0x0f5c('0xb')](_0x539209,_0x2ee91e)[_0x0f5c('0xc')](function(_0x33fe12){logger['info'](_0x0f5c('0xd'),_0x252d87,_0x0f5c('0xe'));logger[_0x0f5c('0xf')](_0x0f5c('0x10'),_0x252d87,_0x0f5c('0xe'),JSON[_0x0f5c('0x11')](_0x33fe12));if(_0x33fe12[_0x0f5c('0x12')]){if(_0x33fe12['error'][_0x0f5c('0x13')]===0x1f4){logger['error'](_0x0f5c('0xd'),_0x252d87,_0x33fe12[_0x0f5c('0x12')][_0x0f5c('0x14')]);return _0x45717c(_0x33fe12[_0x0f5c('0x12')][_0x0f5c('0x14')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x252d87,_0x33fe12[_0x0f5c('0x12')]['message']);return _0x4080fc(_0x33fe12[_0x0f5c('0x12')][_0x0f5c('0x14')]);}else{logger[_0x0f5c('0x15')]('ZohoConfiguration,\x20%s,\x20%s',_0x252d87,_0x0f5c('0xe'));_0x4080fc(_0x33fe12['result']['message']);}})[_0x0f5c('0x16')](function(_0x1bc7c9){logger[_0x0f5c('0x12')](_0x0f5c('0xd'),_0x252d87,_0x1bc7c9);_0x45717c(_0x1bc7c9);});});} \ No newline at end of file +var _0x8528=['client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x54a5ae,_0x56b963){var _0x298fb8=function(_0x42e730){while(--_0x42e730){_0x54a5ae['push'](_0x54a5ae['shift']());}};_0x298fb8(++_0x56b963);}(_0x8528,0x188));var _0x8852=function(_0xaabd91,_0x2eaf19){_0xaabd91=_0xaabd91-0x0;var _0x2501c9=_0x8528[_0xaabd91];return _0x2501c9;};'use strict';var _=require('lodash');var util=require(_0x8852('0x0'));var moment=require('moment');var BPromise=require(_0x8852('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8852('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8852('0x3'))(_0x8852('0x4'));var config=require(_0x8852('0x5'));var jayson=require(_0x8852('0x6'));var client=jayson[_0x8852('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a4887,_0x4001dd,_0x293ca5){return new BPromise(function(_0x4917b2,_0x3689cf){return client[_0x8852('0x8')](_0x2a4887,_0x293ca5)[_0x8852('0x9')](function(_0x54b3aa){logger[_0x8852('0xa')](_0x8852('0xb'),_0x4001dd,_0x8852('0xc'));logger[_0x8852('0xd')](_0x8852('0xe'),_0x4001dd,_0x8852('0xc'),JSON[_0x8852('0xf')](_0x54b3aa));if(_0x54b3aa[_0x8852('0x10')]){if(_0x54b3aa[_0x8852('0x10')][_0x8852('0x11')]===0x1f4){logger[_0x8852('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x4001dd,_0x54b3aa['error'][_0x8852('0x12')]);return _0x3689cf(_0x54b3aa[_0x8852('0x10')]['message']);}logger[_0x8852('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x4001dd,_0x54b3aa[_0x8852('0x10')][_0x8852('0x12')]);return _0x4917b2(_0x54b3aa[_0x8852('0x10')]['message']);}else{logger[_0x8852('0xa')](_0x8852('0xb'),_0x4001dd,_0x8852('0xc'));_0x4917b2(_0x54b3aa[_0x8852('0x13')][_0x8852('0x12')]);}})[_0x8852('0x14')](function(_0x2d7bea){logger['error'](_0x8852('0xb'),_0x4001dd,_0x2d7bea);_0x3689cf(_0x2d7bea);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 0c42f40..08cb33c 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 _0x2001=['post','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2001,0xf3));var _0x1200=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x2001[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x1200('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1200('0x1'));var express=require(_0x1200('0x2'));var router=express[_0x1200('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1200('0x4'));var interaction=require(_0x1200('0x5'));var config=require(_0x1200('0x6'));var controller=require(_0x1200('0x7'));router[_0x1200('0x8')]('/',auth[_0x1200('0x9')](),controller[_0x1200('0xa')]);router[_0x1200('0x8')](_0x1200('0xb'),auth[_0x1200('0x9')](),controller['show']);router[_0x1200('0xc')]('/',auth[_0x1200('0x9')](),controller['create']);router['put'](_0x1200('0xb'),auth['isAuthenticated'](),controller[_0x1200('0xd')]);router[_0x1200('0xe')](_0x1200('0xb'),auth[_0x1200('0x9')](),controller[_0x1200('0xf')]);module[_0x1200('0x10')]=router; \ No newline at end of file +var _0xc338=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./intZohoField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x59d9d1,_0x27117e){var _0x1d07c9=function(_0x5ea285){while(--_0x5ea285){_0x59d9d1['push'](_0x59d9d1['shift']());}};_0x1d07c9(++_0x27117e);}(_0xc338,0x17e));var _0x8c33=function(_0x336bb8,_0x5355b2){_0x336bb8=_0x336bb8-0x0;var _0x2cbb69=_0xc338[_0x336bb8];return _0x2cbb69;};'use strict';var multer=require(_0x8c33('0x0'));var util=require(_0x8c33('0x1'));var path=require(_0x8c33('0x2'));var timeout=require(_0x8c33('0x3'));var express=require('express');var router=express[_0x8c33('0x4')]();var fs_extra=require(_0x8c33('0x5'));var auth=require(_0x8c33('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8c33('0x7'));router[_0x8c33('0x8')]('/',auth[_0x8c33('0x9')](),controller[_0x8c33('0xa')]);router[_0x8c33('0x8')](_0x8c33('0xb'),auth[_0x8c33('0x9')](),controller['show']);router[_0x8c33('0xc')]('/',auth[_0x8c33('0x9')](),controller[_0x8c33('0xd')]);router[_0x8c33('0xe')](_0x8c33('0xb'),auth[_0x8c33('0x9')](),controller[_0x8c33('0xf')]);router[_0x8c33('0x10')](_0x8c33('0xb'),auth[_0x8c33('0x9')](),controller[_0x8c33('0x11')]);module[_0x8c33('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 0117fb9..a3ae7a9 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 _0x7c27=['keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x403e05,_0x4683c9){var _0x27e9e3=function(_0x5ea220){while(--_0x5ea220){_0x403e05['push'](_0x403e05['shift']());}};_0x27e9e3(++_0x4683c9);}(_0x7c27,0x100));var _0x77c2=function(_0x4fb34f,_0x1a95cf){_0x4fb34f=_0x4fb34f-0x0;var _0x1d4726=_0x7c27[_0x4fb34f];return _0x1d4726;};'use strict';var Sequelize=require(_0x77c2('0x0'));module['exports']={'type':{'type':Sequelize[_0x77c2('0x1')](_0x77c2('0x2'),_0x77c2('0x3'),_0x77c2('0x4'),_0x77c2('0x5'),_0x77c2('0x6')),'defaultValue':_0x77c2('0x2')},'content':{'type':Sequelize[_0x77c2('0x7')]},'key':{'type':Sequelize[_0x77c2('0x7')]},'keyType':{'type':Sequelize[_0x77c2('0x1')]('string',_0x77c2('0x3'),_0x77c2('0x4'))},'keyContent':{'type':Sequelize[_0x77c2('0x7')]},'idField':{'type':Sequelize[_0x77c2('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x77c2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbec9=['sequelize','exports','ENUM','string','keyValue','picklist','STRING','variable','BOOLEAN'];(function(_0x3ffd5d,_0x159469){var _0x246111=function(_0x1447bc){while(--_0x1447bc){_0x3ffd5d['push'](_0x3ffd5d['shift']());}};_0x246111(++_0x159469);}(_0xbec9,0xea));var _0x9bec=function(_0x209e41,_0x81ea45){_0x209e41=_0x209e41-0x0;var _0x11a5b0=_0xbec9[_0x209e41];return _0x11a5b0;};'use strict';var Sequelize=require(_0x9bec('0x0'));module[_0x9bec('0x1')]={'type':{'type':Sequelize[_0x9bec('0x2')](_0x9bec('0x3'),'variable','customVariable',_0x9bec('0x4'),_0x9bec('0x5')),'defaultValue':_0x9bec('0x3')},'content':{'type':Sequelize[_0x9bec('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x9bec('0x3'),_0x9bec('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x9bec('0x6')]},'idField':{'type':Sequelize[_0x9bec('0x6')]},'nameField':{'type':Sequelize[_0x9bec('0x6')]},'customField':{'type':Sequelize[_0x9bec('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9bec('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index f230fd3..99ef898 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 _0xb4f4=['papaparse','../../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','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','ZohoField','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring'];(function(_0x1be84e,_0x38e4da){var _0xf6dd15=function(_0x223613){while(--_0x223613){_0x1be84e['push'](_0x1be84e['shift']());}};_0xf6dd15(++_0x38e4da);}(_0xb4f4,0xda));var _0x4b4f=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xb4f4[_0x7e2eb0];return _0xd92de4;};'use strict';var emlformat=require(_0x4b4f('0x0'));var rimraf=require(_0x4b4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b4f('0x2'));var rp=require(_0x4b4f('0x3'));var moment=require(_0x4b4f('0x4'));var BPromise=require(_0x4b4f('0x5'));var Mustache=require('mustache');var util=require(_0x4b4f('0x6'));var path=require(_0x4b4f('0x7'));var sox=require(_0x4b4f('0x8'));var csv=require(_0x4b4f('0x9'));var ejs=require(_0x4b4f('0xa'));var fs=require('fs');var fs_extra=require(_0x4b4f('0xb'));var _=require(_0x4b4f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4b4f('0xd'));var deskjs=require(_0x4b4f('0xe'));var toCsv=require(_0x4b4f('0x9'));var querystring=require(_0x4b4f('0xf'));var Papa=require(_0x4b4f('0x10'));var Redis=require('ioredis');var authService=require(_0x4b4f('0x11'));var qs=require(_0x4b4f('0x12'));var as=require(_0x4b4f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b4f('0x14'))(_0x4b4f('0x15'));var utils=require('../../config/utils');var config=require(_0x4b4f('0x16'));var licenseUtil=require(_0x4b4f('0x17'));var db=require(_0x4b4f('0x18'))['db'];function respondWithStatusCode(_0x154b05,_0x42973f){_0x42973f=_0x42973f||0xcc;return function(_0x3ca456){if(_0x3ca456){return _0x154b05[_0x4b4f('0x19')](_0x42973f);}return _0x154b05[_0x4b4f('0x1a')](_0x42973f)['end']();};}function respondWithResult(_0x4791ba,_0x3c7d07){_0x3c7d07=_0x3c7d07||0xc8;return function(_0x12f125){if(_0x12f125){return _0x4791ba['status'](_0x3c7d07)[_0x4b4f('0x1b')](_0x12f125);}};}function respondWithFilteredResult(_0x315960,_0xe83964){return function(_0x4e372c){if(_0x4e372c){var _0x1c74d4=typeof _0xe83964[_0x4b4f('0x1c')]===_0x4b4f('0x1d')&&typeof _0xe83964['limit']===_0x4b4f('0x1d');var _0x2a6f66=_0x4e372c[_0x4b4f('0x1e')];var _0x3a0ae3=_0x1c74d4?0x0:_0xe83964[_0x4b4f('0x1c')];var _0x406e5b=_0x1c74d4?_0x4e372c[_0x4b4f('0x1e')]:_0xe83964[_0x4b4f('0x1c')]+_0xe83964[_0x4b4f('0x1f')];var _0x4be517;if(_0x406e5b>=_0x2a6f66){_0x406e5b=_0x2a6f66;_0x4be517=0xc8;}else{_0x4be517=0xce;}_0x315960[_0x4b4f('0x1a')](_0x4be517);return _0x315960[_0x4b4f('0x20')](_0x4b4f('0x21'),_0x3a0ae3+'-'+_0x406e5b+'/'+_0x2a6f66)[_0x4b4f('0x1b')](_0x4e372c);}return null;};}function patchUpdates(_0x3ae9f2){return function(_0x269cb9){try{jsonpatch[_0x4b4f('0x22')](_0x269cb9,_0x3ae9f2,!![]);}catch(_0x34b915){return BPromise[_0x4b4f('0x23')](_0x34b915);}return _0x269cb9[_0x4b4f('0x24')]();};}function saveUpdates(_0x445605,_0x48c58d){return function(_0x3b5fab){if(_0x3b5fab){return _0x3b5fab[_0x4b4f('0x25')](_0x445605)[_0x4b4f('0x26')](function(_0x51e07e){return _0x51e07e;});}return null;};}function removeEntity(_0x2c99bf,_0x5664f2){return function(_0x2c6405){if(_0x2c6405){return _0x2c6405['destroy']()[_0x4b4f('0x26')](function(){_0x2c99bf['status'](0xcc)[_0x4b4f('0x27')]();});}};}function handleEntityNotFound(_0x403b0e,_0x556791){return function(_0x291d6a){if(!_0x291d6a){_0x403b0e[_0x4b4f('0x19')](0x194);}return _0x291d6a;};}function handleError(_0x104dda,_0x396a9a){_0x396a9a=_0x396a9a||0x1f4;return function(_0x8e600e){logger[_0x4b4f('0x28')](_0x8e600e[_0x4b4f('0x29')]);if(_0x8e600e[_0x4b4f('0x2a')]){delete _0x8e600e['name'];}_0x104dda['status'](_0x396a9a)[_0x4b4f('0x2b')](_0x8e600e);};}exports[_0x4b4f('0x2c')]=function(_0x422e1a,_0x2726c9){var _0x25ab73={},_0x201047={},_0x1f2f10={'count':0x0,'rows':[]};var _0x277a8b=_[_0x4b4f('0x2d')](db[_0x4b4f('0x2e')][_0x4b4f('0x2f')],function(_0x4b404e){return{'name':_0x4b404e['fieldName'],'type':_0x4b404e[_0x4b4f('0x30')][_0x4b4f('0x31')]};});_0x201047[_0x4b4f('0x32')]=_[_0x4b4f('0x2d')](_0x277a8b,_0x4b4f('0x2a'));_0x201047[_0x4b4f('0x33')]=_['keys'](_0x422e1a[_0x4b4f('0x33')]);_0x201047[_0x4b4f('0x34')]=_[_0x4b4f('0x35')](_0x201047['model'],_0x201047[_0x4b4f('0x33')]);_0x25ab73['attributes']=_[_0x4b4f('0x35')](_0x201047['model'],qs[_0x4b4f('0x36')](_0x422e1a[_0x4b4f('0x33')][_0x4b4f('0x36')]));_0x25ab73['attributes']=_0x25ab73[_0x4b4f('0x37')][_0x4b4f('0x38')]?_0x25ab73[_0x4b4f('0x37')]:_0x201047[_0x4b4f('0x32')];if(!_0x422e1a[_0x4b4f('0x33')][_0x4b4f('0x39')](_0x4b4f('0x3a'))){_0x25ab73[_0x4b4f('0x1f')]=qs[_0x4b4f('0x1f')](_0x422e1a[_0x4b4f('0x33')][_0x4b4f('0x1f')]);_0x25ab73[_0x4b4f('0x1c')]=qs[_0x4b4f('0x1c')](_0x422e1a[_0x4b4f('0x33')]['offset']);}_0x25ab73[_0x4b4f('0x3b')]=qs[_0x4b4f('0x3c')](_0x422e1a['query'][_0x4b4f('0x3c')]);_0x25ab73[_0x4b4f('0x3d')]=qs['filters'](_[_0x4b4f('0x3e')](_0x422e1a[_0x4b4f('0x33')],_0x201047[_0x4b4f('0x34')]),_0x277a8b);if(_0x422e1a[_0x4b4f('0x33')][_0x4b4f('0x3f')]){_0x25ab73[_0x4b4f('0x3d')]=_[_0x4b4f('0x40')](_0x25ab73[_0x4b4f('0x3d')],{'$or':_['map'](_0x277a8b,function(_0x369f15){if(_0x369f15[_0x4b4f('0x30')]!==_0x4b4f('0x41')){var _0x821505={};_0x821505[_0x369f15[_0x4b4f('0x2a')]]={'$like':'%'+_0x422e1a[_0x4b4f('0x33')][_0x4b4f('0x3f')]+'%'};return _0x821505;}})});}_0x25ab73=_[_0x4b4f('0x40')]({},_0x25ab73,_0x422e1a[_0x4b4f('0x42')]);var _0x3c06fe={'where':_0x25ab73[_0x4b4f('0x3d')]};return db[_0x4b4f('0x2e')][_0x4b4f('0x1e')](_0x3c06fe)[_0x4b4f('0x26')](function(_0x5616c1){_0x1f2f10[_0x4b4f('0x1e')]=_0x5616c1;if(_0x422e1a[_0x4b4f('0x33')][_0x4b4f('0x43')]){_0x25ab73[_0x4b4f('0x44')]=[{'all':!![]}];}return db[_0x4b4f('0x2e')][_0x4b4f('0x45')](_0x25ab73);})[_0x4b4f('0x26')](function(_0x12ba8e){_0x1f2f10['rows']=_0x12ba8e;return _0x1f2f10;})[_0x4b4f('0x26')](respondWithFilteredResult(_0x2726c9,_0x25ab73))['catch'](handleError(_0x2726c9,null));};exports[_0x4b4f('0x46')]=function(_0x438a1f,_0x2cdf51){var _0x25f800={'raw':!![],'where':{'id':_0x438a1f[_0x4b4f('0x47')]['id']}},_0xd0f0d5={};_0xd0f0d5[_0x4b4f('0x32')]=_['keys'](db[_0x4b4f('0x2e')][_0x4b4f('0x2f')]);_0xd0f0d5['query']=_[_0x4b4f('0x48')](_0x438a1f[_0x4b4f('0x33')]);_0xd0f0d5[_0x4b4f('0x34')]=_['intersection'](_0xd0f0d5[_0x4b4f('0x32')],_0xd0f0d5[_0x4b4f('0x33')]);_0x25f800['attributes']=_[_0x4b4f('0x35')](_0xd0f0d5[_0x4b4f('0x32')],qs[_0x4b4f('0x36')](_0x438a1f[_0x4b4f('0x33')][_0x4b4f('0x36')]));_0x25f800['attributes']=_0x25f800[_0x4b4f('0x37')]['length']?_0x25f800[_0x4b4f('0x37')]:_0xd0f0d5[_0x4b4f('0x32')];if(_0x438a1f['query'][_0x4b4f('0x43')]){_0x25f800['include']=[{'all':!![]}];}_0x25f800=_['merge']({},_0x25f800,_0x438a1f[_0x4b4f('0x42')]);return db[_0x4b4f('0x2e')][_0x4b4f('0x49')](_0x25f800)[_0x4b4f('0x26')](handleEntityNotFound(_0x2cdf51,null))[_0x4b4f('0x26')](respondWithResult(_0x2cdf51,null))[_0x4b4f('0x4a')](handleError(_0x2cdf51,null));};exports[_0x4b4f('0x4b')]=function(_0x4480b9,_0x34369b){return db[_0x4b4f('0x2e')]['create'](_0x4480b9[_0x4b4f('0x4c')],{})[_0x4b4f('0x26')](respondWithResult(_0x34369b,0xc9))[_0x4b4f('0x4a')](handleError(_0x34369b,null));};exports[_0x4b4f('0x25')]=function(_0xe6decf,_0x4cf80f){if(_0xe6decf[_0x4b4f('0x4c')]['id']){delete _0xe6decf[_0x4b4f('0x4c')]['id'];}return db[_0x4b4f('0x2e')][_0x4b4f('0x49')]({'where':{'id':_0xe6decf[_0x4b4f('0x47')]['id']}})['then'](handleEntityNotFound(_0x4cf80f,null))['then'](saveUpdates(_0xe6decf[_0x4b4f('0x4c')],null))[_0x4b4f('0x26')](respondWithResult(_0x4cf80f,null))[_0x4b4f('0x4a')](handleError(_0x4cf80f,null));};exports[_0x4b4f('0x4d')]=function(_0x2917d7,_0x5e1998){return db[_0x4b4f('0x2e')][_0x4b4f('0x49')]({'where':{'id':_0x2917d7[_0x4b4f('0x47')]['id']}})[_0x4b4f('0x26')](handleEntityNotFound(_0x5e1998,null))['then'](removeEntity(_0x5e1998,null))[_0x4b4f('0x4a')](handleError(_0x5e1998,null));}; \ No newline at end of file +var _0xb8e3=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','type','count','includeAll','include','then','rows','catch','show','params','options','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','sendStatus','error','name','send','ZohoField','rawAttributes','key','model'];(function(_0xd4c598,_0x3400fb){var _0x2241e3=function(_0x5eb01b){while(--_0x5eb01b){_0xd4c598['push'](_0xd4c598['shift']());}};_0x2241e3(++_0x3400fb);}(_0xb8e3,0xa2));var _0x3b8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb8e3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3b8e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3b8e('0x1'));var jsonpatch=require(_0x3b8e('0x2'));var rp=require(_0x3b8e('0x3'));var moment=require(_0x3b8e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3b8e('0x5'));var util=require(_0x3b8e('0x6'));var path=require(_0x3b8e('0x7'));var sox=require(_0x3b8e('0x8'));var csv=require(_0x3b8e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b8e('0xa'));var _=require('lodash');var squel=require(_0x3b8e('0xb'));var crypto=require(_0x3b8e('0xc'));var jsforce=require(_0x3b8e('0xd'));var deskjs=require(_0x3b8e('0xe'));var toCsv=require(_0x3b8e('0x9'));var querystring=require(_0x3b8e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3b8e('0x10'));var as=require(_0x3b8e('0x11'));var hardwareService=require(_0x3b8e('0x12'));var logger=require('../../config/logger')(_0x3b8e('0x13'));var utils=require(_0x3b8e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3b8e('0x15'));var db=require(_0x3b8e('0x16'))['db'];function respondWithStatusCode(_0x5182f4,_0x1852f2){_0x1852f2=_0x1852f2||0xcc;return function(_0x41b090){if(_0x41b090){return _0x5182f4['sendStatus'](_0x1852f2);}return _0x5182f4[_0x3b8e('0x17')](_0x1852f2)[_0x3b8e('0x18')]();};}function respondWithResult(_0x4d348d,_0xab4fcd){_0xab4fcd=_0xab4fcd||0xc8;return function(_0x1f6248){if(_0x1f6248){return _0x4d348d['status'](_0xab4fcd)[_0x3b8e('0x19')](_0x1f6248);}};}function respondWithFilteredResult(_0x1a5bc6,_0x491531){return function(_0x46ded8){if(_0x46ded8){var _0x563dc8=typeof _0x491531[_0x3b8e('0x1a')]===_0x3b8e('0x1b')&&typeof _0x491531[_0x3b8e('0x1c')]===_0x3b8e('0x1b');var _0x2bfe0e=_0x46ded8['count'];var _0x22c655=_0x563dc8?0x0:_0x491531['offset'];var _0x5f1464=_0x563dc8?_0x46ded8['count']:_0x491531[_0x3b8e('0x1a')]+_0x491531['limit'];var _0x2be322;if(_0x5f1464>=_0x2bfe0e){_0x5f1464=_0x2bfe0e;_0x2be322=0xc8;}else{_0x2be322=0xce;}_0x1a5bc6[_0x3b8e('0x17')](_0x2be322);return _0x1a5bc6[_0x3b8e('0x1d')](_0x3b8e('0x1e'),_0x22c655+'-'+_0x5f1464+'/'+_0x2bfe0e)['json'](_0x46ded8);}return null;};}function patchUpdates(_0x23df9c){return function(_0x3b781d){try{jsonpatch['apply'](_0x3b781d,_0x23df9c,!![]);}catch(_0x5c2ebc){return BPromise['reject'](_0x5c2ebc);}return _0x3b781d['save']();};}function saveUpdates(_0xd7e012,_0x428037){return function(_0x5dc5e8){if(_0x5dc5e8){return _0x5dc5e8['update'](_0xd7e012)['then'](function(_0x3623fd){return _0x3623fd;});}return null;};}function removeEntity(_0x1555c0,_0x469075){return function(_0x7ca2ec){if(_0x7ca2ec){return _0x7ca2ec['destroy']()['then'](function(){_0x1555c0[_0x3b8e('0x17')](0xcc)[_0x3b8e('0x18')]();});}};}function handleEntityNotFound(_0x705c23,_0xcfa076){return function(_0x4b62af){if(!_0x4b62af){_0x705c23[_0x3b8e('0x1f')](0x194);}return _0x4b62af;};}function handleError(_0x5a29ab,_0x255806){_0x255806=_0x255806||0x1f4;return function(_0x484cad){logger[_0x3b8e('0x20')](_0x484cad['stack']);if(_0x484cad[_0x3b8e('0x21')]){delete _0x484cad[_0x3b8e('0x21')];}_0x5a29ab['status'](_0x255806)[_0x3b8e('0x22')](_0x484cad);};}exports['index']=function(_0x4ebb6f,_0x4e69a2){var _0xf90f64={},_0x40c43d={},_0x527042={'count':0x0,'rows':[]};var _0x370a32=_['map'](db[_0x3b8e('0x23')][_0x3b8e('0x24')],function(_0xe7c74e){return{'name':_0xe7c74e['fieldName'],'type':_0xe7c74e['type'][_0x3b8e('0x25')]};});_0x40c43d[_0x3b8e('0x26')]=_['map'](_0x370a32,_0x3b8e('0x21'));_0x40c43d[_0x3b8e('0x27')]=_[_0x3b8e('0x28')](_0x4ebb6f[_0x3b8e('0x27')]);_0x40c43d[_0x3b8e('0x29')]=_[_0x3b8e('0x2a')](_0x40c43d[_0x3b8e('0x26')],_0x40c43d['query']);_0xf90f64[_0x3b8e('0x2b')]=_[_0x3b8e('0x2a')](_0x40c43d[_0x3b8e('0x26')],qs['fields'](_0x4ebb6f[_0x3b8e('0x27')][_0x3b8e('0x2c')]));_0xf90f64[_0x3b8e('0x2b')]=_0xf90f64[_0x3b8e('0x2b')][_0x3b8e('0x2d')]?_0xf90f64['attributes']:_0x40c43d[_0x3b8e('0x26')];if(!_0x4ebb6f[_0x3b8e('0x27')][_0x3b8e('0x2e')](_0x3b8e('0x2f'))){_0xf90f64['limit']=qs[_0x3b8e('0x1c')](_0x4ebb6f[_0x3b8e('0x27')][_0x3b8e('0x1c')]);_0xf90f64['offset']=qs['offset'](_0x4ebb6f[_0x3b8e('0x27')][_0x3b8e('0x1a')]);}_0xf90f64['order']=qs[_0x3b8e('0x30')](_0x4ebb6f[_0x3b8e('0x27')][_0x3b8e('0x30')]);_0xf90f64[_0x3b8e('0x31')]=qs[_0x3b8e('0x29')](_['pick'](_0x4ebb6f[_0x3b8e('0x27')],_0x40c43d[_0x3b8e('0x29')]),_0x370a32);if(_0x4ebb6f[_0x3b8e('0x27')][_0x3b8e('0x32')]){_0xf90f64['where']=_[_0x3b8e('0x33')](_0xf90f64[_0x3b8e('0x31')],{'$or':_[_0x3b8e('0x34')](_0x370a32,function(_0x48477d){if(_0x48477d[_0x3b8e('0x35')]!=='VIRTUAL'){var _0x29f519={};_0x29f519[_0x48477d[_0x3b8e('0x21')]]={'$like':'%'+_0x4ebb6f[_0x3b8e('0x27')][_0x3b8e('0x32')]+'%'};return _0x29f519;}})});}_0xf90f64=_[_0x3b8e('0x33')]({},_0xf90f64,_0x4ebb6f['options']);var _0x3cdbb2={'where':_0xf90f64[_0x3b8e('0x31')]};return db[_0x3b8e('0x23')][_0x3b8e('0x36')](_0x3cdbb2)['then'](function(_0x85a938){_0x527042[_0x3b8e('0x36')]=_0x85a938;if(_0x4ebb6f['query'][_0x3b8e('0x37')]){_0xf90f64[_0x3b8e('0x38')]=[{'all':!![]}];}return db[_0x3b8e('0x23')]['findAll'](_0xf90f64);})[_0x3b8e('0x39')](function(_0x1feff6){_0x527042[_0x3b8e('0x3a')]=_0x1feff6;return _0x527042;})[_0x3b8e('0x39')](respondWithFilteredResult(_0x4e69a2,_0xf90f64))[_0x3b8e('0x3b')](handleError(_0x4e69a2,null));};exports[_0x3b8e('0x3c')]=function(_0x2f9c72,_0x831f4e){var _0x39ae45={'raw':!![],'where':{'id':_0x2f9c72[_0x3b8e('0x3d')]['id']}},_0x182eaa={};_0x182eaa['model']=_[_0x3b8e('0x28')](db[_0x3b8e('0x23')]['rawAttributes']);_0x182eaa[_0x3b8e('0x27')]=_[_0x3b8e('0x28')](_0x2f9c72[_0x3b8e('0x27')]);_0x182eaa['filters']=_['intersection'](_0x182eaa[_0x3b8e('0x26')],_0x182eaa['query']);_0x39ae45['attributes']=_['intersection'](_0x182eaa['model'],qs[_0x3b8e('0x2c')](_0x2f9c72[_0x3b8e('0x27')][_0x3b8e('0x2c')]));_0x39ae45['attributes']=_0x39ae45[_0x3b8e('0x2b')]['length']?_0x39ae45[_0x3b8e('0x2b')]:_0x182eaa[_0x3b8e('0x26')];if(_0x2f9c72['query'][_0x3b8e('0x37')]){_0x39ae45[_0x3b8e('0x38')]=[{'all':!![]}];}_0x39ae45=_[_0x3b8e('0x33')]({},_0x39ae45,_0x2f9c72[_0x3b8e('0x3e')]);return db[_0x3b8e('0x23')][_0x3b8e('0x3f')](_0x39ae45)[_0x3b8e('0x39')](handleEntityNotFound(_0x831f4e,null))[_0x3b8e('0x39')](respondWithResult(_0x831f4e,null))[_0x3b8e('0x3b')](handleError(_0x831f4e,null));};exports[_0x3b8e('0x40')]=function(_0x22f3f0,_0x2b42bb){return db[_0x3b8e('0x23')][_0x3b8e('0x40')](_0x22f3f0[_0x3b8e('0x41')],{})[_0x3b8e('0x39')](respondWithResult(_0x2b42bb,0xc9))[_0x3b8e('0x3b')](handleError(_0x2b42bb,null));};exports['update']=function(_0x26db8e,_0x303dde){if(_0x26db8e[_0x3b8e('0x41')]['id']){delete _0x26db8e[_0x3b8e('0x41')]['id'];}return db[_0x3b8e('0x23')][_0x3b8e('0x3f')]({'where':{'id':_0x26db8e['params']['id']}})[_0x3b8e('0x39')](handleEntityNotFound(_0x303dde,null))[_0x3b8e('0x39')](saveUpdates(_0x26db8e[_0x3b8e('0x41')],null))[_0x3b8e('0x39')](respondWithResult(_0x303dde,null))[_0x3b8e('0x3b')](handleError(_0x303dde,null));};exports[_0x3b8e('0x42')]=function(_0x566aad,_0x376202){return db['ZohoField'][_0x3b8e('0x3f')]({'where':{'id':_0x566aad[_0x3b8e('0x3d')]['id']}})[_0x3b8e('0x39')](handleEntityNotFound(_0x376202,null))[_0x3b8e('0x39')](removeEntity(_0x376202,null))[_0x3b8e('0x3b')](handleError(_0x376202,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 7fa0dbf..d77291f 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 _0xf2e3=['request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xf2e3[_0x45783c];return _0x1161da;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var logger=require(_0x3f2e('0x1'))(_0x3f2e('0x2'));var moment=require(_0x3f2e('0x3'));var BPromise=require(_0x3f2e('0x4'));var rp=require(_0x3f2e('0x5'));var fs=require('fs');var path=require(_0x3f2e('0x6'));var rimraf=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var attributes=require(_0x3f2e('0x9'));module['exports']=function(_0x33a3b7,_0xdd6b3e){return _0x33a3b7[_0x3f2e('0xa')](_0x3f2e('0xb'),attributes,{'tableName':_0x3f2e('0xc'),'paranoid':![],'indexes':[{'name':_0x3f2e('0xd'),'fields':[_0x3f2e('0xe'),_0x3f2e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4bd3=['lodash','../../config/logger','api','path','rimraf','../../config/environment','exports','define','ZohoField','zoho_unique_index','idField','FieldId'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4bd3,0x174));var _0x34bd=function(_0x157a86,_0x1a22d2){_0x157a86=_0x157a86-0x0;var _0x58092d=_0x4bd3[_0x157a86];return _0x58092d;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./intZohoField.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x34bd('0x9'),'fields':[_0x34bd('0xa'),_0x34bd('0xb')],'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 0081415..9fe30fb 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 _0x8273=['request\x20sent','stringify','error','ZohoField,\x20%s,\x20%s','message','result','catch','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x46f55c,_0x2411b3){var _0xc26ef3=function(_0x3e68e7){while(--_0x3e68e7){_0x46f55c['push'](_0x46f55c['shift']());}};_0xc26ef3(++_0x2411b3);}(_0x8273,0x1cf));var _0x3827=function(_0x63a056,_0x1a16bf){_0x63a056=_0x63a056-0x0;var _0x29dca7=_0x8273[_0x63a056];return _0x29dca7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3827('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3827('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3827('0x2'))(_0x3827('0x3'));var config=require('../../config/environment');var jayson=require(_0x3827('0x4'));var client=jayson[_0x3827('0x5')][_0x3827('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x341011,_0x558c19,_0x18a51b){return new BPromise(function(_0x3681f6,_0x23792e){return client[_0x3827('0x7')](_0x341011,_0x18a51b)[_0x3827('0x8')](function(_0x5a2c2f){logger[_0x3827('0x9')]('ZohoField,\x20%s,\x20%s',_0x558c19,'request\x20sent');logger[_0x3827('0xa')](_0x3827('0xb'),_0x558c19,_0x3827('0xc'),JSON[_0x3827('0xd')](_0x5a2c2f));if(_0x5a2c2f[_0x3827('0xe')]){if(_0x5a2c2f[_0x3827('0xe')]['code']===0x1f4){logger[_0x3827('0xe')](_0x3827('0xf'),_0x558c19,_0x5a2c2f[_0x3827('0xe')][_0x3827('0x10')]);return _0x23792e(_0x5a2c2f[_0x3827('0xe')]['message']);}logger[_0x3827('0xe')](_0x3827('0xf'),_0x558c19,_0x5a2c2f[_0x3827('0xe')][_0x3827('0x10')]);return _0x3681f6(_0x5a2c2f[_0x3827('0xe')][_0x3827('0x10')]);}else{logger['info'](_0x3827('0xf'),_0x558c19,_0x3827('0xc'));_0x3681f6(_0x5a2c2f[_0x3827('0x11')]['message']);}})[_0x3827('0x12')](function(_0x2c9127){logger['error'](_0x3827('0xf'),_0x558c19,_0x2c9127);_0x23792e(_0x2c9127);});});} \ No newline at end of file +var _0x3638=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird'];(function(_0x4f12a7,_0x458e8a){var _0x225a7e=function(_0x1703fc){while(--_0x1703fc){_0x4f12a7['push'](_0x4f12a7['shift']());}};_0x225a7e(++_0x458e8a);}(_0x3638,0xf9));var _0x8363=function(_0x2048bb,_0xca3684){_0x2048bb=_0x2048bb-0x0;var _0x2ca067=_0x3638[_0x2048bb];return _0x2ca067;};'use strict';var _=require(_0x8363('0x0'));var util=require(_0x8363('0x1'));var moment=require(_0x8363('0x2'));var BPromise=require(_0x8363('0x3'));var rs=require(_0x8363('0x4'));var fs=require('fs');var Redis=require(_0x8363('0x5'));var db=require(_0x8363('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8363('0x7'))(_0x8363('0x8'));var config=require('../../config/environment');var jayson=require(_0x8363('0x9'));var client=jayson[_0x8363('0xa')][_0x8363('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x452a80,_0x4135e2,_0x5afc3c){return new BPromise(function(_0x2c5486,_0x21ef0c){return client[_0x8363('0xc')](_0x452a80,_0x5afc3c)[_0x8363('0xd')](function(_0x626f36){logger[_0x8363('0xe')](_0x8363('0xf'),_0x4135e2,_0x8363('0x10'));logger[_0x8363('0x11')](_0x8363('0x12'),_0x4135e2,_0x8363('0x10'),JSON[_0x8363('0x13')](_0x626f36));if(_0x626f36[_0x8363('0x14')]){if(_0x626f36['error']['code']===0x1f4){logger[_0x8363('0x14')](_0x8363('0xf'),_0x4135e2,_0x626f36['error']['message']);return _0x21ef0c(_0x626f36[_0x8363('0x14')]['message']);}logger[_0x8363('0x14')](_0x8363('0xf'),_0x4135e2,_0x626f36[_0x8363('0x14')]['message']);return _0x2c5486(_0x626f36[_0x8363('0x14')][_0x8363('0x15')]);}else{logger[_0x8363('0xe')](_0x8363('0xf'),_0x4135e2,_0x8363('0x10'));_0x2c5486(_0x626f36[_0x8363('0x16')][_0x8363('0x15')]);}})['catch'](function(_0x24275f){logger[_0x8363('0x14')](_0x8363('0xf'),_0x4135e2,_0x24275f);_0x21ef0c(_0x24275f);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index f584e82..30fbfed 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(_0x76170c,_0x1e46a4){var _0x37ec50=function(_0xddfad9){while(--_0xddfad9){_0x76170c['push'](_0x76170c['shift']());}};_0x37ec50(++_0x1e46a4);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xe08a18,_0x4917ce){var _0x361a79=function(_0x1b4851){while(--_0x1b4851){_0xe08a18['push'](_0xe08a18['shift']());}};_0x361a79(++_0x4917ce);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 658148a..6f49fd4 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 _0x4731=['INTEGER','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x100c7f,_0x18cf52){var _0x1f72eb=function(_0x3537ba){while(--_0x3537ba){_0x100c7f['push'](_0x100c7f['shift']());}};_0x1f72eb(++_0x18cf52);}(_0x4731,0xce));var _0x1473=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x4731[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0x1473('0x0'));module[_0x1473('0x1')]={'name':{'type':Sequelize[_0x1473('0x2')],'allowNull':![],'unique':_0x1473('0x3')},'version':{'type':Sequelize[_0x1473('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x1473('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x1473('0x2')]},'type':{'type':Sequelize[_0x1473('0x2')]},'size':{'type':Sequelize[_0x1473('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x1473('0x2')]},'logo':{'type':Sequelize[_0x1473('0x2')]},'state':{'type':Sequelize[_0x1473('0x2')],'unique':_0x1473('0x5')},'description':{'type':Sequelize[_0x1473('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1473('0x2')]},'link':{'type':Sequelize[_0x1473('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xf67d=['BOOLEAN','state','unique_name_and_version','STRING','app.js','INTEGER'];(function(_0xbc1a4b,_0x4dfbe4){var _0x108b87=function(_0x409062){while(--_0x409062){_0xbc1a4b['push'](_0xbc1a4b['shift']());}};_0x108b87(++_0x4dfbe4);}(_0xf67d,0x182));var _0xdf67=function(_0x19571b,_0x415456){_0x19571b=_0x19571b-0x0;var _0x355089=_0xf67d[_0x19571b];return _0x355089;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdf67('0x0')},'main':{'type':Sequelize[_0xdf67('0x1')],'defaultValue':_0xdf67('0x2')},'filename':{'type':Sequelize[_0xdf67('0x1')]},'path':{'type':Sequelize[_0xdf67('0x1')]},'type':{'type':Sequelize[_0xdf67('0x1')]},'size':{'type':Sequelize[_0xdf67('0x3')]},'active':{'type':Sequelize[_0xdf67('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xdf67('0x1')],'unique':_0xdf67('0x5')},'description':{'type':Sequelize[_0xdf67('0x1')]},'title':{'type':Sequelize[_0xdf67('0x1')]},'remoteUri':{'type':Sequelize[_0xdf67('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 7b9fbba..449bbf1 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 _0xb016=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','Integration','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body'];(function(_0xd99365,_0x3830dc){var _0x25b50a=function(_0x3a3b2b){while(--_0x3a3b2b){_0xd99365['push'](_0xd99365['shift']());}};_0x25b50a(++_0x3830dc);}(_0xb016,0x159));var _0x6b01=function(_0x3ec052,_0xef91b8){_0x3ec052=_0x3ec052-0x0;var _0x36a8ff=_0xb016[_0x3ec052];return _0x36a8ff;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['Integration'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));}; \ No newline at end of file +var _0xf61e=['intersection','fields','attributes','length','hasOwnProperty','order','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','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','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','Integration','rawAttributes','key','model','query','keys','filters'];(function(_0x24697b,_0x2eb072){var _0x585b99=function(_0x261980){while(--_0x261980){_0x24697b['push'](_0x24697b['shift']());}};_0x585b99(++_0x2eb072);}(_0xf61e,0x191));var _0xef61=function(_0x5146c2,_0x3e7041){_0x5146c2=_0x5146c2-0x0;var _0x321c7b=_0xf61e[_0x5146c2];return _0x321c7b;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['Integration']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')](_0x5e614b['body'],{})[_0xef61('0x28')](respondWithResult(_0x47b09d,0xc9))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x2904e0,_0x13bb20){if(_0x2904e0[_0xef61('0x4a')]['id']){delete _0x2904e0[_0xef61('0x4a')]['id'];}return db['Integration'][_0xef61('0x47')]({'where':{'id':_0x2904e0['params']['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x13bb20,null))[_0xef61('0x28')](saveUpdates(_0x2904e0[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x13bb20,null))[_0xef61('0x45')](handleError(_0x13bb20,null));};exports[_0xef61('0x27')]=function(_0x3e23eb,_0x1565c7){return db[_0xef61('0x30')]['find']({'where':{'id':_0x3e23eb[_0xef61('0x4b')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x1565c7,null))['then'](removeEntity(_0x1565c7,null))['catch'](handleError(_0x1565c7,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 2d1cfbc..d438bf7 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 _0xa88f=['request-promise','rimraf','../../config/environment','./integration.attributes','exports','define','util','../../config/logger','moment'];(function(_0x3f5368,_0x678fa0){var _0x21c491=function(_0x94c78b){while(--_0x94c78b){_0x3f5368['push'](_0x3f5368['shift']());}};_0x21c491(++_0x678fa0);}(_0xa88f,0x141));var _0xfa88=function(_0x571352,_0x44b8e2){_0x571352=_0x571352-0x0;var _0x3ca715=_0xa88f[_0x571352];return _0x3ca715;};'use strict';var _=require('lodash');var util=require(_0xfa88('0x0'));var logger=require(_0xfa88('0x1'))('api');var moment=require(_0xfa88('0x2'));var BPromise=require('bluebird');var rp=require(_0xfa88('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa88('0x4'));var config=require(_0xfa88('0x5'));var attributes=require(_0xfa88('0x6'));module[_0xfa88('0x7')]=function(_0x857261,_0x41add0){return _0x857261[_0xfa88('0x8')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34d7=['rimraf','../../config/environment','./integration.attributes','exports','define','Integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xbee8be,_0x1a1dfc){var _0x3cb6a9=function(_0x1d3217){while(--_0x1d3217){_0xbee8be['push'](_0xbee8be['shift']());}};_0x3cb6a9(++_0x1a1dfc);}(_0x34d7,0x95));var _0x734d=function(_0x3bd710,_0x541b35){_0x3bd710=_0x3bd710-0x0;var _0x5efba4=_0x34d7[_0x3bd710];return _0x5efba4;};'use strict';var _=require(_0x734d('0x0'));var util=require(_0x734d('0x1'));var logger=require(_0x734d('0x2'))(_0x734d('0x3'));var moment=require(_0x734d('0x4'));var BPromise=require(_0x734d('0x5'));var rp=require(_0x734d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x734d('0x7'));var config=require(_0x734d('0x8'));var attributes=require(_0x734d('0x9'));module[_0x734d('0xa')]=function(_0x264e32,_0x38d54d){return _0x264e32[_0x734d('0xb')](_0x734d('0xc'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index e8585c3..05aafc7 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 _0x9f0e=['../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x414cec,_0x3b0bd8){var _0x457fca=function(_0x58c0a5){while(--_0x58c0a5){_0x414cec['push'](_0x414cec['shift']());}};_0x457fca(++_0x3b0bd8);}(_0x9f0e,0x116));var _0xe9f0=function(_0x571821,_0x13272c){_0x571821=_0x571821-0x0;var _0x5bb89b=_0x9f0e[_0x571821];return _0x5bb89b;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('Integration,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0xd59e1f,_0x4d5c2a){var _0x4c2e07=function(_0x36cd59){while(--_0x36cd59){_0xd59e1f['push'](_0xd59e1f['shift']());}};_0x4c2e07(++_0x4d5c2a);}(_0xdb28,0x106));var _0x8db2=function(_0x447e10,_0x45f481){_0x447e10=_0x447e10-0x0;var _0x1c7bab=_0xdb28[_0x447e10];return _0x1c7bab;};'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')]('Integration,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index cef0744..e9b222a 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 _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x3d9c78,_0x1890ad){var _0x5de9e7=function(_0x23bcfe){while(--_0x23bcfe){_0x3d9c78['push'](_0x3d9c78['shift']());}};_0x5de9e7(++_0x1890ad);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1b5a24,_0x5ac6db){_0x1b5a24=_0x1b5a24-0x0;var _0x59d20b=_0x9f0e[_0x1b5a24];return _0x59d20b;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x362877,_0x467e94){var _0x3adf4=function(_0x1ecbf3){while(--_0x1ecbf3){_0x362877['push'](_0x362877['shift']());}};_0x3adf4(++_0x467e94);}(_0x5fab,0x177));var _0xb5fa=function(_0x21c3ac,_0x2a46bb){_0x21c3ac=_0x21c3ac-0x0;var _0x3c45ad=_0x5fab[_0x21c3ac];return _0x3c45ad;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);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 f3ecae0..e31e9e3 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 _0x3f00=['BOOLEAN','INTEGER','TEXT','ENUM','SENDING','exports','STRING','DATE'];(function(_0x29c9bd,_0x5ea664){var _0x49bdd5=function(_0x5ae8ee){while(--_0x5ae8ee){_0x29c9bd['push'](_0x29c9bd['shift']());}};_0x49bdd5(++_0x5ea664);}(_0x3f00,0x13d));var _0x03f0=function(_0x3e8ad8,_0x25b42b){_0x3e8ad8=_0x3e8ad8-0x0;var _0x557c2a=_0x3f00[_0x3e8ad8];return _0x557c2a;};'use strict';var Sequelize=require('sequelize');module[_0x03f0('0x0')]={'integration':{'type':Sequelize[_0x03f0('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x03f0('0x1')]},'uniqueid':{'type':Sequelize[_0x03f0('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x03f0('0x1')]},'interface':{'type':Sequelize[_0x03f0('0x1')]},'membername':{'type':Sequelize[_0x03f0('0x1')]},'agentcalledAt':{'type':Sequelize[_0x03f0('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x03f0('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x03f0('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x03f0('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x03f0('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x03f0('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x03f0('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x03f0('0x2')]},'lastevent':{'type':Sequelize[_0x03f0('0x1')]},'channel':{'type':Sequelize[_0x03f0('0x1')]},'channelstate':{'type':Sequelize[_0x03f0('0x4')]},'channelstatedesc':{'type':Sequelize[_0x03f0('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x03f0('0x1')]},'language':{'type':Sequelize[_0x03f0('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x03f0('0x1')]},'priority':{'type':Sequelize[_0x03f0('0x1')]},'destchannel':{'type':Sequelize[_0x03f0('0x1')]},'destchannelstate':{'type':Sequelize[_0x03f0('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x03f0('0x1')]},'destcalleridname':{'type':Sequelize[_0x03f0('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x03f0('0x1')]},'destlanguage':{'type':Sequelize[_0x03f0('0x1')]},'destaccountcode':{'type':Sequelize[_0x03f0('0x1')]},'destcontext':{'type':Sequelize[_0x03f0('0x1')]},'destexten':{'type':Sequelize[_0x03f0('0x1')]},'destpriority':{'type':Sequelize[_0x03f0('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x03f0('0x1')]},'inReplyTo':{'type':Sequelize[_0x03f0('0x1')]},'subject':{'type':Sequelize[_0x03f0('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x03f0('0x1')]},'cc':{'type':Sequelize[_0x03f0('0x1')]},'attachment':{'type':Sequelize[_0x03f0('0x5')]},'html':{'type':Sequelize[_0x03f0('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x03f0('0x6')]('SENT',_0x03f0('0x7'),'RECEIVED','FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x03f0('0x1')]},'projectId':{'type':Sequelize[_0x03f0('0x4')]}}; \ No newline at end of file +var _0x27fc=['TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x535596,_0x15c174){var _0x5751dd=function(_0x2b3a50){while(--_0x2b3a50){_0x535596['push'](_0x535596['shift']());}};_0x5751dd(++_0x15c174);}(_0x27fc,0x7e));var _0xc27f=function(_0x16d523,_0x21b346){_0x16d523=_0x16d523-0x0;var _0x511b64=_0x27fc[_0x16d523];return _0x511b64;};'use strict';var Sequelize=require(_0xc27f('0x0'));module[_0xc27f('0x1')]={'integration':{'type':Sequelize[_0xc27f('0x2')]},'eventChannel':{'type':Sequelize[_0xc27f('0x2')]},'exitStatus':{'type':Sequelize[_0xc27f('0x2')]},'ticketId':{'type':Sequelize[_0xc27f('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xc27f('0x2')]},'uniqueid':{'type':Sequelize[_0xc27f('0x2')]},'calleridnum':{'type':Sequelize[_0xc27f('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xc27f('0x2')]},'membername':{'type':Sequelize[_0xc27f('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc27f('0x3')]},'agentconnectAt':{'type':Sequelize[_0xc27f('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xc27f('0x4')]},'agentacw':{'type':Sequelize[_0xc27f('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc27f('0x4')]},'reason':{'type':Sequelize[_0xc27f('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc27f('0x3')]},'lastevent':{'type':Sequelize[_0xc27f('0x2')]},'channel':{'type':Sequelize[_0xc27f('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xc27f('0x2')]},'language':{'type':Sequelize[_0xc27f('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc27f('0x2')]},'exten':{'type':Sequelize[_0xc27f('0x2')]},'priority':{'type':Sequelize[_0xc27f('0x2')]},'destchannel':{'type':Sequelize[_0xc27f('0x2')]},'destchannelstate':{'type':Sequelize[_0xc27f('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xc27f('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc27f('0x2')]},'destcalleridname':{'type':Sequelize[_0xc27f('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc27f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc27f('0x2')]},'destlanguage':{'type':Sequelize[_0xc27f('0x2')]},'destaccountcode':{'type':Sequelize[_0xc27f('0x2')]},'destcontext':{'type':Sequelize[_0xc27f('0x2')]},'destexten':{'type':Sequelize[_0xc27f('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xc27f('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xc27f('0x2')]},'subject':{'type':Sequelize[_0xc27f('0x2')]},'from':{'type':Sequelize[_0xc27f('0x2')]},'to':{'type':Sequelize[_0xc27f('0x2')]},'cc':{'type':Sequelize[_0xc27f('0x2')]},'attachment':{'type':Sequelize[_0xc27f('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xc27f('0x6')]},'status':{'type':Sequelize[_0xc27f('0x7')](_0xc27f('0x8'),'SENDING',_0xc27f('0x9'),_0xc27f('0xa'))},'url':{'type':Sequelize[_0xc27f('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xc27f('0x2')]},'projectId':{'type':Sequelize[_0xc27f('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index dd9e2b1..7f2bc57 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 _0xca20=['path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','name','send','map','rawAttributes','type','key','model','query','filters','fields','attributes','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','IntegrationReport','findAll','rows','show','params','keys','intersection','length','create','catch','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util'];(function(_0x46249d,_0x14bab4){var _0x3db381=function(_0x7101b){while(--_0x7101b){_0x46249d['push'](_0x46249d['shift']());}};_0x3db381(++_0x14bab4);}(_0xca20,0x15d));var _0x0ca2=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0xca20[_0x1afabf];return _0x497ff1;};'use strict';var emlformat=require(_0x0ca2('0x0'));var rimraf=require(_0x0ca2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ca2('0x2'));var rp=require(_0x0ca2('0x3'));var moment=require('moment');var BPromise=require(_0x0ca2('0x4'));var Mustache=require('mustache');var util=require(_0x0ca2('0x5'));var path=require(_0x0ca2('0x6'));var sox=require(_0x0ca2('0x7'));var csv=require('to-csv');var ejs=require(_0x0ca2('0x8'));var fs=require('fs');var fs_extra=require(_0x0ca2('0x9'));var _=require('lodash');var squel=require(_0x0ca2('0xa'));var crypto=require(_0x0ca2('0xb'));var jsforce=require(_0x0ca2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0ca2('0xd'));var querystring=require('querystring');var Papa=require(_0x0ca2('0xe'));var Redis=require(_0x0ca2('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0ca2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ca2('0x11'))(_0x0ca2('0x12'));var utils=require(_0x0ca2('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0ca2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xed6718,_0x1a5a40){_0x1a5a40=_0x1a5a40||0xcc;return function(_0x1576eb){if(_0x1576eb){return _0xed6718[_0x0ca2('0x15')](_0x1a5a40);}return _0xed6718[_0x0ca2('0x16')](_0x1a5a40)[_0x0ca2('0x17')]();};}function respondWithResult(_0x4f4c6f,_0x1370a3){_0x1370a3=_0x1370a3||0xc8;return function(_0x5c3afe){if(_0x5c3afe){return _0x4f4c6f[_0x0ca2('0x16')](_0x1370a3)[_0x0ca2('0x18')](_0x5c3afe);}};}function respondWithFilteredResult(_0x47ce2c,_0x299dbf){return function(_0x5df1cc){if(_0x5df1cc){var _0x3ed575=typeof _0x299dbf['offset']==='undefined'&&typeof _0x299dbf[_0x0ca2('0x19')]===_0x0ca2('0x1a');var _0x494d1a=_0x5df1cc[_0x0ca2('0x1b')];var _0x3fb314=_0x3ed575?0x0:_0x299dbf['offset'];var _0x59035c=_0x3ed575?_0x5df1cc[_0x0ca2('0x1b')]:_0x299dbf['offset']+_0x299dbf['limit'];var _0x3d8f51;if(_0x59035c>=_0x494d1a){_0x59035c=_0x494d1a;_0x3d8f51=0xc8;}else{_0x3d8f51=0xce;}_0x47ce2c[_0x0ca2('0x16')](_0x3d8f51);return _0x47ce2c[_0x0ca2('0x1c')](_0x0ca2('0x1d'),_0x3fb314+'-'+_0x59035c+'/'+_0x494d1a)[_0x0ca2('0x18')](_0x5df1cc);}return null;};}function patchUpdates(_0x542cfc){return function(_0x454ff8){try{jsonpatch[_0x0ca2('0x1e')](_0x454ff8,_0x542cfc,!![]);}catch(_0x97611d){return BPromise[_0x0ca2('0x1f')](_0x97611d);}return _0x454ff8['save']();};}function saveUpdates(_0x3a52e0,_0x542704){return function(_0x1f183c){if(_0x1f183c){return _0x1f183c[_0x0ca2('0x20')](_0x3a52e0)[_0x0ca2('0x21')](function(_0x6de216){return _0x6de216;});}return null;};}function removeEntity(_0x34e508,_0x4cdd87){return function(_0x520ccf){if(_0x520ccf){return _0x520ccf[_0x0ca2('0x22')]()[_0x0ca2('0x21')](function(){_0x34e508[_0x0ca2('0x16')](0xcc)[_0x0ca2('0x17')]();});}};}function handleEntityNotFound(_0x1af0a5,_0x4e4b58){return function(_0x2e3ae1){if(!_0x2e3ae1){_0x1af0a5[_0x0ca2('0x15')](0x194);}return _0x2e3ae1;};}function handleError(_0x216917,_0x276e56){_0x276e56=_0x276e56||0x1f4;return function(_0x5e71f6){logger['error'](_0x5e71f6['stack']);if(_0x5e71f6[_0x0ca2('0x23')]){delete _0x5e71f6['name'];}_0x216917['status'](_0x276e56)[_0x0ca2('0x24')](_0x5e71f6);};}exports['index']=function(_0x28212b,_0x33ef70){var _0x111f48={},_0x576d2d={},_0x2c3442={'count':0x0,'rows':[]};var _0x4b5e08=_[_0x0ca2('0x25')](db['IntegrationReport'][_0x0ca2('0x26')],function(_0x1f9d37){return{'name':_0x1f9d37['fieldName'],'type':_0x1f9d37[_0x0ca2('0x27')][_0x0ca2('0x28')]};});_0x576d2d[_0x0ca2('0x29')]=_['map'](_0x4b5e08,_0x0ca2('0x23'));_0x576d2d['query']=_['keys'](_0x28212b[_0x0ca2('0x2a')]);_0x576d2d[_0x0ca2('0x2b')]=_['intersection'](_0x576d2d[_0x0ca2('0x29')],_0x576d2d[_0x0ca2('0x2a')]);_0x111f48['attributes']=_['intersection'](_0x576d2d[_0x0ca2('0x29')],qs[_0x0ca2('0x2c')](_0x28212b[_0x0ca2('0x2a')][_0x0ca2('0x2c')]));_0x111f48[_0x0ca2('0x2d')]=_0x111f48[_0x0ca2('0x2d')]['length']?_0x111f48['attributes']:_0x576d2d[_0x0ca2('0x29')];if(!_0x28212b[_0x0ca2('0x2a')][_0x0ca2('0x2e')](_0x0ca2('0x2f'))){_0x111f48[_0x0ca2('0x19')]=qs[_0x0ca2('0x19')](_0x28212b[_0x0ca2('0x2a')][_0x0ca2('0x19')]);_0x111f48[_0x0ca2('0x30')]=qs['offset'](_0x28212b['query'][_0x0ca2('0x30')]);}_0x111f48['order']=qs[_0x0ca2('0x31')](_0x28212b[_0x0ca2('0x2a')][_0x0ca2('0x31')]);_0x111f48[_0x0ca2('0x32')]=qs[_0x0ca2('0x2b')](_[_0x0ca2('0x33')](_0x28212b['query'],_0x576d2d[_0x0ca2('0x2b')]),_0x4b5e08);if(_0x28212b[_0x0ca2('0x2a')][_0x0ca2('0x34')]){_0x111f48[_0x0ca2('0x32')]=_[_0x0ca2('0x35')](_0x111f48[_0x0ca2('0x32')],{'$or':_[_0x0ca2('0x25')](_0x4b5e08,function(_0x3b1499){if(_0x3b1499['type']!==_0x0ca2('0x36')){var _0x3fe506={};_0x3fe506[_0x3b1499[_0x0ca2('0x23')]]={'$like':'%'+_0x28212b[_0x0ca2('0x2a')][_0x0ca2('0x34')]+'%'};return _0x3fe506;}})});}_0x111f48=_['merge']({},_0x111f48,_0x28212b[_0x0ca2('0x37')]);var _0x43e113={'where':_0x111f48[_0x0ca2('0x32')]};return db['IntegrationReport']['count'](_0x43e113)['then'](function(_0x4cc674){_0x2c3442[_0x0ca2('0x1b')]=_0x4cc674;if(_0x28212b['query'][_0x0ca2('0x38')]){_0x111f48[_0x0ca2('0x39')]=[{'all':!![]}];}return db[_0x0ca2('0x3a')][_0x0ca2('0x3b')](_0x111f48);})[_0x0ca2('0x21')](function(_0x29ea4b){_0x2c3442[_0x0ca2('0x3c')]=_0x29ea4b;return _0x2c3442;})['then'](respondWithFilteredResult(_0x33ef70,_0x111f48))['catch'](handleError(_0x33ef70,null));};exports[_0x0ca2('0x3d')]=function(_0x3be83b,_0x38f7f0){var _0x5d7034={'raw':![],'where':{'id':_0x3be83b[_0x0ca2('0x3e')]['id']}},_0x226bc8={};_0x226bc8['model']=_[_0x0ca2('0x3f')](db[_0x0ca2('0x3a')][_0x0ca2('0x26')]);_0x226bc8[_0x0ca2('0x2a')]=_[_0x0ca2('0x3f')](_0x3be83b['query']);_0x226bc8[_0x0ca2('0x2b')]=_[_0x0ca2('0x40')](_0x226bc8[_0x0ca2('0x29')],_0x226bc8['query']);_0x5d7034['attributes']=_[_0x0ca2('0x40')](_0x226bc8[_0x0ca2('0x29')],qs[_0x0ca2('0x2c')](_0x3be83b[_0x0ca2('0x2a')][_0x0ca2('0x2c')]));_0x5d7034[_0x0ca2('0x2d')]=_0x5d7034[_0x0ca2('0x2d')][_0x0ca2('0x41')]?_0x5d7034['attributes']:_0x226bc8[_0x0ca2('0x29')];if(_0x3be83b['query'][_0x0ca2('0x38')]){_0x5d7034['include']=[{'all':!![]}];}_0x5d7034=_[_0x0ca2('0x35')]({},_0x5d7034,_0x3be83b['options']);return db[_0x0ca2('0x3a')]['find'](_0x5d7034)[_0x0ca2('0x21')](handleEntityNotFound(_0x38f7f0,null))[_0x0ca2('0x21')](respondWithResult(_0x38f7f0,null))['catch'](handleError(_0x38f7f0,null));};exports[_0x0ca2('0x42')]=function(_0x3eaa21,_0x1ccf99){return db[_0x0ca2('0x3a')][_0x0ca2('0x42')](_0x3eaa21['body'],{})[_0x0ca2('0x21')](respondWithResult(_0x1ccf99,0xc9))[_0x0ca2('0x43')](handleError(_0x1ccf99,null));};exports[_0x0ca2('0x20')]=function(_0x296fd0,_0x4b6697){if(_0x296fd0[_0x0ca2('0x44')]['id']){delete _0x296fd0['body']['id'];}return db['IntegrationReport'][_0x0ca2('0x45')]({'where':{'id':_0x296fd0['params']['id']}})[_0x0ca2('0x21')](handleEntityNotFound(_0x4b6697,null))[_0x0ca2('0x21')](saveUpdates(_0x296fd0[_0x0ca2('0x44')],null))[_0x0ca2('0x21')](respondWithResult(_0x4b6697,null))[_0x0ca2('0x43')](handleError(_0x4b6697,null));};exports[_0x0ca2('0x22')]=function(_0x2c740a,_0x215fad){return db['IntegrationReport'][_0x0ca2('0x45')]({'where':{'id':_0x2c740a[_0x0ca2('0x3e')]['id']}})[_0x0ca2('0x21')](handleEntityNotFound(_0x215fad,null))[_0x0ca2('0x21')](removeEntity(_0x215fad,null))['catch'](handleError(_0x215fad,null));};exports[_0x0ca2('0x46')]=function(_0x2465c7,_0x167573){return db['IntegrationReport'][_0x0ca2('0x46')]()['then'](respondWithResult(_0x167573,null))['catch'](handleError(_0x167573,null));}; \ No newline at end of file +var _0x7d8e=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','sendStatus','error','stack','name','send','index','map','IntegrationReport','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','findAll','rows','catch','show','rawAttributes','length','includeAll','include','find','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x6bd01a,_0x5272c6){var _0x595aca=function(_0x565da6){while(--_0x565da6){_0x6bd01a['push'](_0x6bd01a['shift']());}};_0x595aca(++_0x5272c6);}(_0x7d8e,0xd7));var _0xe7d8=function(_0x5a8aa3,_0x2294d5){_0x5a8aa3=_0x5a8aa3-0x0;var _0x5d0458=_0x7d8e[_0x5a8aa3];return _0x5d0458;};'use strict';var emlformat=require(_0xe7d8('0x0'));var rimraf=require(_0xe7d8('0x1'));var zipdir=require(_0xe7d8('0x2'));var jsonpatch=require(_0xe7d8('0x3'));var rp=require('request-promise');var moment=require(_0xe7d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe7d8('0x5'));var util=require(_0xe7d8('0x6'));var path=require('path');var sox=require(_0xe7d8('0x7'));var csv=require('to-csv');var ejs=require(_0xe7d8('0x8'));var fs=require('fs');var fs_extra=require(_0xe7d8('0x9'));var _=require(_0xe7d8('0xa'));var squel=require(_0xe7d8('0xb'));var crypto=require(_0xe7d8('0xc'));var jsforce=require(_0xe7d8('0xd'));var deskjs=require(_0xe7d8('0xe'));var toCsv=require(_0xe7d8('0xf'));var querystring=require(_0xe7d8('0x10'));var Papa=require(_0xe7d8('0x11'));var Redis=require(_0xe7d8('0x12'));var authService=require(_0xe7d8('0x13'));var qs=require(_0xe7d8('0x14'));var as=require(_0xe7d8('0x15'));var hardwareService=require(_0xe7d8('0x16'));var logger=require(_0xe7d8('0x17'))('api');var utils=require(_0xe7d8('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe7d8('0x19'))['db'];function respondWithStatusCode(_0x21de26,_0x3ac4c0){_0x3ac4c0=_0x3ac4c0||0xcc;return function(_0x36f8db){if(_0x36f8db){return _0x21de26['sendStatus'](_0x3ac4c0);}return _0x21de26[_0xe7d8('0x1a')](_0x3ac4c0)[_0xe7d8('0x1b')]();};}function respondWithResult(_0x5297aa,_0x24afdb){_0x24afdb=_0x24afdb||0xc8;return function(_0x4003c7){if(_0x4003c7){return _0x5297aa[_0xe7d8('0x1a')](_0x24afdb)[_0xe7d8('0x1c')](_0x4003c7);}};}function respondWithFilteredResult(_0x32bf16,_0x43b354){return function(_0x2cf03f){if(_0x2cf03f){var _0x1c0dcb=typeof _0x43b354[_0xe7d8('0x1d')]===_0xe7d8('0x1e')&&typeof _0x43b354[_0xe7d8('0x1f')]===_0xe7d8('0x1e');var _0x3ee490=_0x2cf03f[_0xe7d8('0x20')];var _0x39b1ee=_0x1c0dcb?0x0:_0x43b354[_0xe7d8('0x1d')];var _0x2a141e=_0x1c0dcb?_0x2cf03f[_0xe7d8('0x20')]:_0x43b354[_0xe7d8('0x1d')]+_0x43b354[_0xe7d8('0x1f')];var _0x452d33;if(_0x2a141e>=_0x3ee490){_0x2a141e=_0x3ee490;_0x452d33=0xc8;}else{_0x452d33=0xce;}_0x32bf16['status'](_0x452d33);return _0x32bf16[_0xe7d8('0x21')](_0xe7d8('0x22'),_0x39b1ee+'-'+_0x2a141e+'/'+_0x3ee490)[_0xe7d8('0x1c')](_0x2cf03f);}return null;};}function patchUpdates(_0x3f1075){return function(_0x1ee184){try{jsonpatch['apply'](_0x1ee184,_0x3f1075,!![]);}catch(_0x20c261){return BPromise['reject'](_0x20c261);}return _0x1ee184[_0xe7d8('0x23')]();};}function saveUpdates(_0x516903,_0x1dd4e9){return function(_0x1be188){if(_0x1be188){return _0x1be188['update'](_0x516903)[_0xe7d8('0x24')](function(_0x8c309e){return _0x8c309e;});}return null;};}function removeEntity(_0x98ec99,_0x28655c){return function(_0x59b96c){if(_0x59b96c){return _0x59b96c[_0xe7d8('0x25')]()[_0xe7d8('0x24')](function(){_0x98ec99[_0xe7d8('0x1a')](0xcc)[_0xe7d8('0x1b')]();});}};}function handleEntityNotFound(_0x394bcd,_0x4cdc9c){return function(_0x3011cf){if(!_0x3011cf){_0x394bcd[_0xe7d8('0x26')](0x194);}return _0x3011cf;};}function handleError(_0x454dbc,_0x3beec2){_0x3beec2=_0x3beec2||0x1f4;return function(_0x441a4a){logger[_0xe7d8('0x27')](_0x441a4a[_0xe7d8('0x28')]);if(_0x441a4a[_0xe7d8('0x29')]){delete _0x441a4a[_0xe7d8('0x29')];}_0x454dbc['status'](_0x3beec2)[_0xe7d8('0x2a')](_0x441a4a);};}exports[_0xe7d8('0x2b')]=function(_0x5c3193,_0x19b587){var _0x247f27={},_0x85c77b={},_0x12d68e={'count':0x0,'rows':[]};var _0x209624=_[_0xe7d8('0x2c')](db[_0xe7d8('0x2d')]['rawAttributes'],function(_0x5b6a67){return{'name':_0x5b6a67['fieldName'],'type':_0x5b6a67[_0xe7d8('0x2e')][_0xe7d8('0x2f')]};});_0x85c77b['model']=_[_0xe7d8('0x2c')](_0x209624,'name');_0x85c77b[_0xe7d8('0x30')]=_[_0xe7d8('0x31')](_0x5c3193[_0xe7d8('0x30')]);_0x85c77b[_0xe7d8('0x32')]=_[_0xe7d8('0x33')](_0x85c77b[_0xe7d8('0x34')],_0x85c77b[_0xe7d8('0x30')]);_0x247f27[_0xe7d8('0x35')]=_['intersection'](_0x85c77b[_0xe7d8('0x34')],qs[_0xe7d8('0x36')](_0x5c3193[_0xe7d8('0x30')][_0xe7d8('0x36')]));_0x247f27[_0xe7d8('0x35')]=_0x247f27['attributes']['length']?_0x247f27[_0xe7d8('0x35')]:_0x85c77b[_0xe7d8('0x34')];if(!_0x5c3193[_0xe7d8('0x30')][_0xe7d8('0x37')](_0xe7d8('0x38'))){_0x247f27[_0xe7d8('0x1f')]=qs['limit'](_0x5c3193[_0xe7d8('0x30')][_0xe7d8('0x1f')]);_0x247f27[_0xe7d8('0x1d')]=qs['offset'](_0x5c3193[_0xe7d8('0x30')]['offset']);}_0x247f27['order']=qs[_0xe7d8('0x39')](_0x5c3193[_0xe7d8('0x30')][_0xe7d8('0x39')]);_0x247f27[_0xe7d8('0x3a')]=qs[_0xe7d8('0x32')](_[_0xe7d8('0x3b')](_0x5c3193[_0xe7d8('0x30')],_0x85c77b[_0xe7d8('0x32')]),_0x209624);if(_0x5c3193[_0xe7d8('0x30')]['filter']){_0x247f27[_0xe7d8('0x3a')]=_['merge'](_0x247f27[_0xe7d8('0x3a')],{'$or':_[_0xe7d8('0x2c')](_0x209624,function(_0x16b226){if(_0x16b226[_0xe7d8('0x2e')]!==_0xe7d8('0x3c')){var _0xb333f1={};_0xb333f1[_0x16b226[_0xe7d8('0x29')]]={'$like':'%'+_0x5c3193[_0xe7d8('0x30')][_0xe7d8('0x3d')]+'%'};return _0xb333f1;}})});}_0x247f27=_[_0xe7d8('0x3e')]({},_0x247f27,_0x5c3193[_0xe7d8('0x3f')]);var _0x2f27eb={'where':_0x247f27[_0xe7d8('0x3a')]};return db[_0xe7d8('0x2d')][_0xe7d8('0x20')](_0x2f27eb)[_0xe7d8('0x24')](function(_0x270077){_0x12d68e[_0xe7d8('0x20')]=_0x270077;if(_0x5c3193[_0xe7d8('0x30')]['includeAll']){_0x247f27['include']=[{'all':!![]}];}return db['IntegrationReport'][_0xe7d8('0x40')](_0x247f27);})['then'](function(_0x47a3d5){_0x12d68e[_0xe7d8('0x41')]=_0x47a3d5;return _0x12d68e;})[_0xe7d8('0x24')](respondWithFilteredResult(_0x19b587,_0x247f27))[_0xe7d8('0x42')](handleError(_0x19b587,null));};exports[_0xe7d8('0x43')]=function(_0x2eae57,_0x52977e){var _0x2b9e13={'raw':![],'where':{'id':_0x2eae57['params']['id']}},_0x29994f={};_0x29994f[_0xe7d8('0x34')]=_['keys'](db[_0xe7d8('0x2d')][_0xe7d8('0x44')]);_0x29994f[_0xe7d8('0x30')]=_[_0xe7d8('0x31')](_0x2eae57['query']);_0x29994f[_0xe7d8('0x32')]=_[_0xe7d8('0x33')](_0x29994f['model'],_0x29994f[_0xe7d8('0x30')]);_0x2b9e13[_0xe7d8('0x35')]=_[_0xe7d8('0x33')](_0x29994f[_0xe7d8('0x34')],qs[_0xe7d8('0x36')](_0x2eae57[_0xe7d8('0x30')][_0xe7d8('0x36')]));_0x2b9e13[_0xe7d8('0x35')]=_0x2b9e13[_0xe7d8('0x35')][_0xe7d8('0x45')]?_0x2b9e13[_0xe7d8('0x35')]:_0x29994f[_0xe7d8('0x34')];if(_0x2eae57[_0xe7d8('0x30')][_0xe7d8('0x46')]){_0x2b9e13[_0xe7d8('0x47')]=[{'all':!![]}];}_0x2b9e13=_[_0xe7d8('0x3e')]({},_0x2b9e13,_0x2eae57[_0xe7d8('0x3f')]);return db[_0xe7d8('0x2d')][_0xe7d8('0x48')](_0x2b9e13)[_0xe7d8('0x24')](handleEntityNotFound(_0x52977e,null))[_0xe7d8('0x24')](respondWithResult(_0x52977e,null))['catch'](handleError(_0x52977e,null));};exports['create']=function(_0x414f9f,_0x5f35b4){return db['IntegrationReport']['create'](_0x414f9f[_0xe7d8('0x49')],{})[_0xe7d8('0x24')](respondWithResult(_0x5f35b4,0xc9))[_0xe7d8('0x42')](handleError(_0x5f35b4,null));};exports[_0xe7d8('0x4a')]=function(_0x12694e,_0x4c5aad){if(_0x12694e[_0xe7d8('0x49')]['id']){delete _0x12694e['body']['id'];}return db['IntegrationReport'][_0xe7d8('0x48')]({'where':{'id':_0x12694e[_0xe7d8('0x4b')]['id']}})[_0xe7d8('0x24')](handleEntityNotFound(_0x4c5aad,null))[_0xe7d8('0x24')](saveUpdates(_0x12694e[_0xe7d8('0x49')],null))['then'](respondWithResult(_0x4c5aad,null))['catch'](handleError(_0x4c5aad,null));};exports['destroy']=function(_0x16ccca,_0x22ab80){return db[_0xe7d8('0x2d')]['find']({'where':{'id':_0x16ccca[_0xe7d8('0x4b')]['id']}})[_0xe7d8('0x24')](handleEntityNotFound(_0x22ab80,null))[_0xe7d8('0x24')](removeEntity(_0x22ab80,null))[_0xe7d8('0x42')](handleError(_0x22ab80,null));};exports[_0xe7d8('0x4c')]=function(_0x135592,_0xd7bda7){return db[_0xe7d8('0x2d')]['describe']()[_0xe7d8('0x24')](respondWithResult(_0xd7bda7,null))[_0xe7d8('0x42')](handleError(_0xd7bda7,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 411487b..03fe012 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 _0x4c99=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration'];(function(_0x25998b,_0x33c218){var _0x537b03=function(_0x2d9e30){while(--_0x2d9e30){_0x25998b['push'](_0x25998b['shift']());}};_0x537b03(++_0x33c218);}(_0x4c99,0x198));var _0x94c9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4c99[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x94c9('0x0'));var util=require(_0x94c9('0x1'));var logger=require(_0x94c9('0x2'))('api');var moment=require(_0x94c9('0x3'));var BPromise=require(_0x94c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94c9('0x5'));var rimraf=require(_0x94c9('0x6'));var config=require(_0x94c9('0x7'));var attributes=require(_0x94c9('0x8'));module['exports']=function(_0xf9990,_0x2a0c87){return _0xf9990[_0x94c9('0x9')](_0x94c9('0xa'),attributes,{'tableName':_0x94c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafad=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','util'];(function(_0xa8bc5b,_0x40e4c5){var _0x4e7235=function(_0x4fbc49){while(--_0x4fbc49){_0xa8bc5b['push'](_0xa8bc5b['shift']());}};_0x4e7235(++_0x40e4c5);}(_0xafad,0xe9));var _0xdafa=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0xafad[_0x1d50f2];return _0x3769b8;};'use strict';var _=require('lodash');var util=require(_0xdafa('0x0'));var logger=require(_0xdafa('0x1'))(_0xdafa('0x2'));var moment=require(_0xdafa('0x3'));var BPromise=require(_0xdafa('0x4'));var rp=require(_0xdafa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdafa('0x6'));var config=require(_0xdafa('0x7'));var attributes=require(_0xdafa('0x8'));module[_0xdafa('0x9')]=function(_0x58047a,_0x56279d){return _0x58047a[_0xdafa('0xa')](_0xdafa('0xb'),attributes,{'tableName':_0xdafa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index aa8656e..7d62398 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 _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2fa8a2,_0x304e0c){var _0x23e2b1=function(_0x3d9fd8){while(--_0x3d9fd8){_0x2fa8a2['push'](_0x2fa8a2['shift']());}};_0x23e2b1(++_0x304e0c);}(_0xda19,0xd5));var _0x9da1=function(_0xb1d302,_0x3e438f){_0xb1d302=_0xb1d302-0x0;var _0x19e2fd=_0xda19[_0xb1d302];return _0x19e2fd;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file +var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x57ee1d,_0x54111b){var _0x12a933=function(_0x5c9d92){while(--_0x5c9d92){_0x57ee1d['push'](_0x57ee1d['shift']());}};_0x12a933(++_0x54111b);}(_0x524e,0x15e));var _0xe524=function(_0xf1a496,_0xabfd30){_0xf1a496=_0xf1a496-0x0;var _0x24c7e3=_0x524e[_0xf1a496];return _0x24c7e3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 7d809aa..99b4567 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 _0x30bc=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','post','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','put','update','delete','multer'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x30bc,0x149));var _0xc30b=function(_0x56fbaa,_0x3bc5a6){_0x56fbaa=_0x56fbaa-0x0;var _0x49fbc1=_0x30bc[_0x56fbaa];return _0x49fbc1;};'use strict';var multer=require(_0xc30b('0x0'));var util=require(_0xc30b('0x1'));var path=require(_0xc30b('0x2'));var timeout=require('connect-timeout');var express=require(_0xc30b('0x3'));var router=express[_0xc30b('0x4')]();var fs_extra=require(_0xc30b('0x5'));var auth=require(_0xc30b('0x6'));var interaction=require(_0xc30b('0x7'));var config=require(_0xc30b('0x8'));var controller=require(_0xc30b('0x9'));router[_0xc30b('0xa')]('/',auth[_0xc30b('0xb')](),controller[_0xc30b('0xc')]);router['get'](_0xc30b('0xd'),auth[_0xc30b('0xb')](),controller[_0xc30b('0xe')]);router[_0xc30b('0xa')]('/:id/sub_intervals',auth[_0xc30b('0xb')](),controller['getIntervals']);router[_0xc30b('0xf')]('/',auth[_0xc30b('0xb')](),controller['create']);router['post'](_0xc30b('0x10'),auth[_0xc30b('0xb')](),controller[_0xc30b('0x11')]);router[_0xc30b('0xf')](_0xc30b('0x12'),auth[_0xc30b('0xb')](),controller['addIntervals']);router[_0xc30b('0x13')](_0xc30b('0xd'),auth['isAuthenticated'](),controller[_0xc30b('0x14')]);router[_0xc30b('0x15')]('/:id',auth[_0xc30b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x700c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x457884,_0x4e1ffd){var _0x3f3d99=function(_0x601344){while(--_0x601344){_0x457884['push'](_0x457884['shift']());}};_0x3f3d99(++_0x4e1ffd);}(_0x700c,0x127));var _0xc700=function(_0x1749ec,_0x3830fe){_0x1749ec=_0x1749ec-0x0;var _0x3628a9=_0x700c[_0x1749ec];return _0x3628a9;};'use strict';var multer=require('multer');var util=require(_0xc700('0x0'));var path=require(_0xc700('0x1'));var timeout=require(_0xc700('0x2'));var express=require(_0xc700('0x3'));var router=express[_0xc700('0x4')]();var fs_extra=require(_0xc700('0x5'));var auth=require(_0xc700('0x6'));var interaction=require(_0xc700('0x7'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0xc700('0x8')]('/',auth['isAuthenticated'](),controller[_0xc700('0x9')]);router[_0xc700('0x8')](_0xc700('0xa'),auth[_0xc700('0xb')](),controller[_0xc700('0xc')]);router['get'](_0xc700('0xd'),auth[_0xc700('0xb')](),controller['getIntervals']);router[_0xc700('0xe')]('/',auth[_0xc700('0xb')](),controller[_0xc700('0xf')]);router['post'](_0xc700('0xd'),auth[_0xc700('0xb')](),controller[_0xc700('0x10')]);router[_0xc700('0xe')](_0xc700('0x11'),auth[_0xc700('0xb')](),controller[_0xc700('0x12')]);router[_0xc700('0x13')]('/:id',auth[_0xc700('0xb')](),controller[_0xc700('0x14')]);router['delete'](_0xc700('0xa'),auth[_0xc700('0xb')](),controller[_0xc700('0x15')]);module[_0xc700('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index a1a741f..15e7704 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 _0x87ab=['exports','STRING'];(function(_0x2b20ed,_0x29f801){var _0x41364f=function(_0xfc1eb9){while(--_0xfc1eb9){_0x2b20ed['push'](_0x2b20ed['shift']());}};_0x41364f(++_0x29f801);}(_0x87ab,0x132));var _0xb87a=function(_0x72013,_0x5b1717){_0x72013=_0x72013-0x0;var _0x370f83=_0x87ab[_0x72013];return _0x370f83;};'use strict';var Sequelize=require('sequelize');module[_0xb87a('0x0')]={'name':{'type':Sequelize[_0xb87a('0x1')]},'description':{'type':Sequelize[_0xb87a('0x1')]},'interval':{'type':Sequelize[_0xb87a('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x6543=['exports','STRING','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6543,0x1ca));var _0x3654=function(_0x34793b,_0x561287){_0x34793b=_0x34793b-0x0;var _0x1628a7=_0x6543[_0x34793b];return _0x1628a7;};'use strict';var Sequelize=require(_0x3654('0x0'));module[_0x3654('0x1')]={'name':{'type':Sequelize[_0x3654('0x2')]},'description':{'type':Sequelize[_0x3654('0x2')]},'interval':{'type':Sequelize[_0x3654('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 06dbfda..36a83e8 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 _0x199b=['count','set','Content-Range','apply','reject','save','update','destroy','then','get','Intervals','UserProfileResource','end','error','name','send','map','Interval','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','getIntervals','findOne','transaction','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit'];(function(_0xfeebc9,_0x270149){var _0x36b714=function(_0xfefbc0){while(--_0xfefbc0){_0xfeebc9['push'](_0xfeebc9['shift']());}};_0x36b714(++_0x270149);}(_0x199b,0x95));var _0xb199=function(_0x2f9839,_0x37aaf0){_0x2f9839=_0x2f9839-0x0;var _0x51326d=_0x199b[_0x2f9839];return _0x51326d;};'use strict';var emlformat=require(_0xb199('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb199('0x1'));var jsonpatch=require(_0xb199('0x2'));var rp=require(_0xb199('0x3'));var moment=require('moment');var BPromise=require(_0xb199('0x4'));var Mustache=require(_0xb199('0x5'));var util=require(_0xb199('0x6'));var path=require(_0xb199('0x7'));var sox=require(_0xb199('0x8'));var csv=require(_0xb199('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb199('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb199('0xb'));var jsforce=require(_0xb199('0xc'));var deskjs=require(_0xb199('0xd'));var toCsv=require(_0xb199('0x9'));var querystring=require('querystring');var Papa=require(_0xb199('0xe'));var Redis=require('ioredis');var authService=require(_0xb199('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb199('0x10'));var hardwareService=require(_0xb199('0x11'));var logger=require(_0xb199('0x12'))(_0xb199('0x13'));var utils=require(_0xb199('0x14'));var config=require(_0xb199('0x15'));var licenseUtil=require(_0xb199('0x16'));var db=require(_0xb199('0x17'))['db'];var extensions=require(_0xb199('0x18'));function respondWithStatusCode(_0x301a22,_0x5cc255){_0x5cc255=_0x5cc255||0xcc;return function(_0x4148be){if(_0x4148be){return _0x301a22[_0xb199('0x19')](_0x5cc255);}return _0x301a22[_0xb199('0x1a')](_0x5cc255)['end']();};}function respondWithResult(_0x20439e,_0x3ea0a1){_0x3ea0a1=_0x3ea0a1||0xc8;return function(_0x255e57){if(_0x255e57){return _0x20439e['status'](_0x3ea0a1)[_0xb199('0x1b')](_0x255e57);}};}function respondWithFilteredResult(_0x2629c4,_0xd329ca){return function(_0x2df0d5){if(_0x2df0d5){var _0x2ec994=typeof _0xd329ca[_0xb199('0x1c')]===_0xb199('0x1d')&&typeof _0xd329ca[_0xb199('0x1e')]==='undefined';var _0x291910=_0x2df0d5[_0xb199('0x1f')];var _0x5abe68=_0x2ec994?0x0:_0xd329ca['offset'];var _0x215ac5=_0x2ec994?_0x2df0d5['count']:_0xd329ca[_0xb199('0x1c')]+_0xd329ca['limit'];var _0x16d7d6;if(_0x215ac5>=_0x291910){_0x215ac5=_0x291910;_0x16d7d6=0xc8;}else{_0x16d7d6=0xce;}_0x2629c4[_0xb199('0x1a')](_0x16d7d6);return _0x2629c4[_0xb199('0x20')](_0xb199('0x21'),_0x5abe68+'-'+_0x215ac5+'/'+_0x291910)['json'](_0x2df0d5);}return null;};}function patchUpdates(_0x16acc0){return function(_0x18eecb){try{jsonpatch[_0xb199('0x22')](_0x18eecb,_0x16acc0,!![]);}catch(_0x251188){return BPromise[_0xb199('0x23')](_0x251188);}return _0x18eecb[_0xb199('0x24')]();};}function saveUpdates(_0x46197e,_0x1d3412){return function(_0x33b874){if(_0x33b874){return _0x33b874[_0xb199('0x25')](_0x46197e)['then'](function(_0xd6fd36){return _0xd6fd36;});}return null;};}function removeEntity(_0x3259a1,_0x1f892a){return function(_0x46b8b9){if(_0x46b8b9){return _0x46b8b9[_0xb199('0x26')]()[_0xb199('0x27')](function(){var _0xc0ed4b=_0x46b8b9[_0xb199('0x28')]({'plain':!![]});var _0x3328cd=_0xb199('0x29');return db[_0xb199('0x2a')][_0xb199('0x26')]({'where':{'type':_0x3328cd,'resourceId':_0xc0ed4b['id']}})[_0xb199('0x27')](function(){return _0x46b8b9;});})[_0xb199('0x27')](function(){_0x3259a1[_0xb199('0x1a')](0xcc)[_0xb199('0x2b')]();});}};}function handleEntityNotFound(_0x3c9c91,_0x340eb2){return function(_0x2a0f74){if(!_0x2a0f74){_0x3c9c91[_0xb199('0x19')](0x194);}return _0x2a0f74;};}function handleError(_0x5357e0,_0x3b708b){_0x3b708b=_0x3b708b||0x1f4;return function(_0xd2ecf2){logger[_0xb199('0x2c')](_0xd2ecf2['stack']);if(_0xd2ecf2['name']){delete _0xd2ecf2[_0xb199('0x2d')];}_0x5357e0[_0xb199('0x1a')](_0x3b708b)[_0xb199('0x2e')](_0xd2ecf2);};}exports['index']=function(_0x27a88d,_0x181855){var _0x3c0174={},_0x505c69={},_0x47675c={'count':0x0,'rows':[]};var _0x21a21b=_[_0xb199('0x2f')](db[_0xb199('0x30')][_0xb199('0x31')],function(_0x41b52f){return{'name':_0x41b52f[_0xb199('0x32')],'type':_0x41b52f[_0xb199('0x33')]['key']};});_0x505c69[_0xb199('0x34')]=_[_0xb199('0x2f')](_0x21a21b,_0xb199('0x2d'));_0x505c69['query']=_[_0xb199('0x35')](_0x27a88d['query']);_0x505c69[_0xb199('0x36')]=_[_0xb199('0x37')](_0x505c69[_0xb199('0x34')],_0x505c69[_0xb199('0x38')]);_0x3c0174[_0xb199('0x39')]=_[_0xb199('0x37')](_0x505c69[_0xb199('0x34')],qs[_0xb199('0x3a')](_0x27a88d[_0xb199('0x38')][_0xb199('0x3a')]));_0x3c0174[_0xb199('0x39')]=_0x3c0174[_0xb199('0x39')][_0xb199('0x3b')]?_0x3c0174[_0xb199('0x39')]:_0x505c69[_0xb199('0x34')];if(!_0x27a88d[_0xb199('0x38')][_0xb199('0x3c')](_0xb199('0x3d'))){_0x3c0174[_0xb199('0x1e')]=qs[_0xb199('0x1e')](_0x27a88d[_0xb199('0x38')][_0xb199('0x1e')]);_0x3c0174['offset']=qs['offset'](_0x27a88d[_0xb199('0x38')][_0xb199('0x1c')]);}_0x3c0174['order']=qs['sort'](_0x27a88d[_0xb199('0x38')][_0xb199('0x3e')]);_0x3c0174[_0xb199('0x3f')]=qs[_0xb199('0x36')](_[_0xb199('0x40')](_0x27a88d[_0xb199('0x38')],_0x505c69[_0xb199('0x36')]),_0x21a21b);if(_0x27a88d[_0xb199('0x38')][_0xb199('0x41')]){_0x3c0174['where']=_[_0xb199('0x42')](_0x3c0174[_0xb199('0x3f')],{'$or':_[_0xb199('0x2f')](_0x21a21b,function(_0x276c5c){if(_0x276c5c[_0xb199('0x33')]!==_0xb199('0x43')){var _0xaaa05f={};_0xaaa05f[_0x276c5c[_0xb199('0x2d')]]={'$like':'%'+_0x27a88d['query'][_0xb199('0x41')]+'%'};return _0xaaa05f;}})});}_0x3c0174=_['merge']({},_0x3c0174,_0x27a88d[_0xb199('0x44')]);var _0x223837={'where':_0x3c0174[_0xb199('0x3f')]};return db[_0xb199('0x30')][_0xb199('0x1f')](_0x223837)[_0xb199('0x27')](function(_0x17df29){_0x47675c[_0xb199('0x1f')]=_0x17df29;if(_0x27a88d[_0xb199('0x38')][_0xb199('0x45')]){_0x3c0174[_0xb199('0x46')]=[{'all':!![]}];}return db[_0xb199('0x30')][_0xb199('0x47')](_0x3c0174);})[_0xb199('0x27')](function(_0x17d80b){_0x47675c['rows']=_0x17d80b;return _0x47675c;})[_0xb199('0x27')](respondWithFilteredResult(_0x181855,_0x3c0174))[_0xb199('0x48')](handleError(_0x181855,null));};exports[_0xb199('0x49')]=function(_0x19fe01,_0x24e1c0){var _0x38abfa={'raw':!![],'where':{'id':_0x19fe01['params']['id']}},_0x4eab76={};_0x4eab76[_0xb199('0x34')]=_[_0xb199('0x35')](db[_0xb199('0x30')]['rawAttributes']);_0x4eab76[_0xb199('0x38')]=_[_0xb199('0x35')](_0x19fe01[_0xb199('0x38')]);_0x4eab76[_0xb199('0x36')]=_[_0xb199('0x37')](_0x4eab76['model'],_0x4eab76[_0xb199('0x38')]);_0x38abfa[_0xb199('0x39')]=_['intersection'](_0x4eab76[_0xb199('0x34')],qs[_0xb199('0x3a')](_0x19fe01[_0xb199('0x38')][_0xb199('0x3a')]));_0x38abfa[_0xb199('0x39')]=_0x38abfa[_0xb199('0x39')][_0xb199('0x3b')]?_0x38abfa[_0xb199('0x39')]:_0x4eab76[_0xb199('0x34')];if(_0x19fe01[_0xb199('0x38')][_0xb199('0x45')]){_0x38abfa['include']=[{'all':!![]}];}_0x38abfa=_[_0xb199('0x42')]({},_0x38abfa,_0x19fe01[_0xb199('0x44')]);return db[_0xb199('0x30')][_0xb199('0x4a')](_0x38abfa)[_0xb199('0x27')](handleEntityNotFound(_0x24e1c0,null))[_0xb199('0x27')](respondWithResult(_0x24e1c0,null))[_0xb199('0x48')](handleError(_0x24e1c0,null));};exports['create']=function(_0x7de812,_0x458631){return db[_0xb199('0x30')][_0xb199('0x4b')](_0x7de812[_0xb199('0x4c')],{})[_0xb199('0x27')](function(_0x2cdd86){var _0x46d39e=_0x7de812[_0xb199('0x4d')][_0xb199('0x28')]({'plain':!![]});if(!_0x46d39e)throw new Error(_0xb199('0x4e'));if(_0x46d39e[_0xb199('0x4f')]===_0xb199('0x4d')){var _0x29976d=_0x2cdd86[_0xb199('0x28')]({'plain':!![]});var _0x3db366=_0xb199('0x29');return db[_0xb199('0x50')]['find']({'where':{'name':_0x3db366,'userProfileId':_0x46d39e[_0xb199('0x51')]},'raw':!![]})[_0xb199('0x27')](function(_0x5c9626){if(_0x5c9626&&_0x5c9626[_0xb199('0x52')]===0x0){return db[_0xb199('0x2a')]['create']({'name':_0x29976d[_0xb199('0x2d')],'resourceId':_0x29976d['id'],'type':_0x5c9626['name'],'sectionId':_0x5c9626['id']},{})[_0xb199('0x27')](function(){return _0x2cdd86;});}else{return _0x2cdd86;}})['catch'](function(_0x4b09fe){logger[_0xb199('0x2c')](_0xb199('0x53'),_0x4b09fe);throw _0x4b09fe;});}return _0x2cdd86;})['then'](respondWithResult(_0x458631,0xc9))[_0xb199('0x48')](handleError(_0x458631,null));};exports[_0xb199('0x25')]=function(_0x12eac9,_0x5146ac){if(_0x12eac9[_0xb199('0x4c')]['id']){delete _0x12eac9[_0xb199('0x4c')]['id'];}return db['Interval'][_0xb199('0x4a')]({'where':{'id':_0x12eac9[_0xb199('0x54')]['id']}})[_0xb199('0x27')](handleEntityNotFound(_0x5146ac,null))['then'](saveUpdates(_0x12eac9[_0xb199('0x4c')],null))[_0xb199('0x27')](respondWithResult(_0x5146ac,null))[_0xb199('0x48')](handleError(_0x5146ac,null));};exports[_0xb199('0x26')]=function(_0x382409,_0x5ac318){return db['Interval'][_0xb199('0x4a')]({'where':{'id':_0x382409[_0xb199('0x54')]['id']}})[_0xb199('0x27')](handleEntityNotFound(_0x5ac318,null))[_0xb199('0x27')](removeEntity(_0x5ac318,null))[_0xb199('0x48')](handleError(_0x5ac318,null));};exports[_0xb199('0x55')]=function(_0x189f8c,_0x373bf2,_0x19fc31){if(_0x189f8c['body']['id']){delete _0x189f8c[_0xb199('0x4c')]['id'];}return db['Interval'][_0xb199('0x4a')]({'where':{'id':_0x189f8c[_0xb199('0x54')]['id']}})['then'](handleEntityNotFound(_0x373bf2,null))[_0xb199('0x27')](function(_0x13fe60){if(_0x13fe60){_0x189f8c[_0xb199('0x4c')][_0xb199('0x56')]=_0x13fe60['id'];return db['Interval']['create'](_0x189f8c['body']);}})[_0xb199('0x27')](respondWithResult(_0x373bf2,null))[_0xb199('0x48')](handleError(_0x373bf2,null));};exports[_0xb199('0x57')]=function(_0x2a2c66,_0x47d185,_0x26aaef){var _0x3f99e2={};var _0x50205b={};var _0x308b92;var _0x4d206b;return db[_0xb199('0x30')]['findOne']({'where':{'id':_0x2a2c66['params']['id']}})[_0xb199('0x27')](handleEntityNotFound(_0x47d185,null))[_0xb199('0x27')](function(_0x2a1fd7){if(_0x2a1fd7){_0x308b92=_0x2a1fd7;_0x50205b[_0xb199('0x34')]=_[_0xb199('0x35')](db['Interval']['rawAttributes']);_0x50205b[_0xb199('0x38')]=_[_0xb199('0x35')](_0x2a2c66[_0xb199('0x38')]);_0x50205b[_0xb199('0x36')]=_['intersection'](_0x50205b[_0xb199('0x34')],_0x50205b[_0xb199('0x38')]);_0x3f99e2[_0xb199('0x39')]=_[_0xb199('0x37')](_0x50205b[_0xb199('0x34')],qs['fields'](_0x2a2c66[_0xb199('0x38')][_0xb199('0x3a')]));_0x3f99e2[_0xb199('0x39')]=_0x3f99e2[_0xb199('0x39')][_0xb199('0x3b')]?_0x3f99e2[_0xb199('0x39')]:_0x50205b[_0xb199('0x34')];_0x3f99e2['order']=qs['sort'](_0x2a2c66[_0xb199('0x38')]['sort']);_0x3f99e2['where']=qs['filters'](_[_0xb199('0x40')](_0x2a2c66['query'],_0x50205b[_0xb199('0x36')]));if(_0x2a2c66['query'][_0xb199('0x41')]){_0x3f99e2[_0xb199('0x3f')]=_[_0xb199('0x42')](_0x3f99e2[_0xb199('0x3f')],{'$or':_[_0xb199('0x2f')](_0x3f99e2[_0xb199('0x39')],function(_0x1d4008){var _0x47991f={};_0x47991f[_0x1d4008]={'$like':'%'+_0x2a2c66[_0xb199('0x38')][_0xb199('0x41')]+'%'};return _0x47991f;})});}_0x3f99e2=_['merge']({},_0x3f99e2,_0x2a2c66[_0xb199('0x44')]);return _0x308b92['getIntervals'](_0x3f99e2);}})[_0xb199('0x27')](function(_0x22b57c){if(_0x22b57c){_0x4d206b=_0x22b57c['length'];if(!_0x2a2c66[_0xb199('0x38')]['hasOwnProperty'](_0xb199('0x3d'))){_0x3f99e2[_0xb199('0x1e')]=qs[_0xb199('0x1e')](_0x2a2c66[_0xb199('0x38')][_0xb199('0x1e')]);_0x3f99e2[_0xb199('0x1c')]=qs['offset'](_0x2a2c66[_0xb199('0x38')][_0xb199('0x1c')]);}return _0x308b92[_0xb199('0x57')](_0x3f99e2);}})[_0xb199('0x27')](function(_0x26fab3){if(_0x26fab3){return _0x26fab3?{'count':_0x4d206b,'rows':_0x26fab3}:null;}})[_0xb199('0x27')](respondWithResult(_0x47d185,null))[_0xb199('0x48')](handleError(_0x47d185,null));};exports['addIntervals']=function(_0x1c7649,_0x3a7e2d,_0xeea5ec){return db[_0xb199('0x30')][_0xb199('0x58')]({'where':{'id':_0x1c7649['params']['id']}})[_0xb199('0x27')](handleEntityNotFound(_0x3a7e2d,null))['then'](function(_0xcbcb1e){if(_0xcbcb1e){return db['sequelize'][_0xb199('0x59')](function(_0x26c7b3){return db[_0xb199('0x30')]['destroy']({'where':{'IntervalId':_0x1c7649[_0xb199('0x54')]['id']},'transaction':_0x26c7b3})['then'](function(_0x16b27b){var _0x3bfe6c=_['map'](_0x1c7649[_0xb199('0x4c')],function(_0x35300d){delete _0x35300d['id'];_0x35300d[_0xb199('0x56')]=_0x1c7649[_0xb199('0x54')]['id'];return _0x35300d;});return db[_0xb199('0x30')]['bulkCreate'](_0x3bfe6c,{'transaction':_0x26c7b3});});})[_0xb199('0x27')](function(){return db[_0xb199('0x30')][_0xb199('0x47')]({'where':{'IntervalId':_0x1c7649[_0xb199('0x54')]['id']}});});}})[_0xb199('0x27')](respondWithResult(_0x3a7e2d,null))[_0xb199('0x48')](handleError(_0x3a7e2d,null));}; \ No newline at end of file +var _0x7e26=['sort','options','getIntervals','addIntervals','findOne','sequelize','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','moment','mustache','util','to-csv','ejs','fs-extra','squel','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','then','Intervals','UserProfileResource','destroy','end','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','Interval','include','findAll','catch','show','keys','includeAll','find','create','body','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','params','order'];(function(_0x234677,_0x243b62){var _0x5bbfda=function(_0x479074){while(--_0x479074){_0x234677['push'](_0x234677['shift']());}};_0x5bbfda(++_0x243b62);}(_0x7e26,0x164));var _0x67e2=function(_0x468230,_0x1bf3f5){_0x468230=_0x468230-0x0;var _0x59e9c6=_0x7e26[_0x468230];return _0x59e9c6;};'use strict';var emlformat=require(_0x67e2('0x0'));var rimraf=require(_0x67e2('0x1'));var zipdir=require(_0x67e2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x67e2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x67e2('0x4'));var util=require(_0x67e2('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x67e2('0x6'));var ejs=require(_0x67e2('0x7'));var fs=require('fs');var fs_extra=require(_0x67e2('0x8'));var _=require('lodash');var squel=require(_0x67e2('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x67e2('0xa'));var toCsv=require(_0x67e2('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x67e2('0xb'));var qs=require(_0x67e2('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x67e2('0xd'));var logger=require(_0x67e2('0xe'))(_0x67e2('0xf'));var utils=require(_0x67e2('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x67e2('0x11'));var db=require(_0x67e2('0x12'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x3ef955,_0x19ae89){_0x19ae89=_0x19ae89||0xcc;return function(_0x5a2a11){if(_0x5a2a11){return _0x3ef955[_0x67e2('0x13')](_0x19ae89);}return _0x3ef955[_0x67e2('0x14')](_0x19ae89)['end']();};}function respondWithResult(_0x262a7a,_0x5e6fbc){_0x5e6fbc=_0x5e6fbc||0xc8;return function(_0x34d94f){if(_0x34d94f){return _0x262a7a['status'](_0x5e6fbc)[_0x67e2('0x15')](_0x34d94f);}};}function respondWithFilteredResult(_0x20e543,_0x175c05){return function(_0x4c6508){if(_0x4c6508){var _0x151475=typeof _0x175c05['offset']==='undefined'&&typeof _0x175c05[_0x67e2('0x16')]===_0x67e2('0x17');var _0xa3c517=_0x4c6508['count'];var _0x58323b=_0x151475?0x0:_0x175c05[_0x67e2('0x18')];var _0x47b8e3=_0x151475?_0x4c6508[_0x67e2('0x19')]:_0x175c05[_0x67e2('0x18')]+_0x175c05['limit'];var _0x54d4ed;if(_0x47b8e3>=_0xa3c517){_0x47b8e3=_0xa3c517;_0x54d4ed=0xc8;}else{_0x54d4ed=0xce;}_0x20e543[_0x67e2('0x14')](_0x54d4ed);return _0x20e543[_0x67e2('0x1a')](_0x67e2('0x1b'),_0x58323b+'-'+_0x47b8e3+'/'+_0xa3c517)['json'](_0x4c6508);}return null;};}function patchUpdates(_0x1e6343){return function(_0x2f879b){try{jsonpatch[_0x67e2('0x1c')](_0x2f879b,_0x1e6343,!![]);}catch(_0x21c0cd){return BPromise[_0x67e2('0x1d')](_0x21c0cd);}return _0x2f879b[_0x67e2('0x1e')]();};}function saveUpdates(_0x5f3856,_0xc2f99){return function(_0x19885c){if(_0x19885c){return _0x19885c['update'](_0x5f3856)[_0x67e2('0x1f')](function(_0x36b95a){return _0x36b95a;});}return null;};}function removeEntity(_0x1a974d,_0x4eedc5){return function(_0x17eb73){if(_0x17eb73){return _0x17eb73['destroy']()[_0x67e2('0x1f')](function(){var _0x2653ad=_0x17eb73['get']({'plain':!![]});var _0x44642a=_0x67e2('0x20');return db[_0x67e2('0x21')][_0x67e2('0x22')]({'where':{'type':_0x44642a,'resourceId':_0x2653ad['id']}})['then'](function(){return _0x17eb73;});})['then'](function(){_0x1a974d['status'](0xcc)[_0x67e2('0x23')]();});}};}function handleEntityNotFound(_0x41067c,_0x4b5bd0){return function(_0x2a454d){if(!_0x2a454d){_0x41067c[_0x67e2('0x13')](0x194);}return _0x2a454d;};}function handleError(_0x412684,_0x29f6cc){_0x29f6cc=_0x29f6cc||0x1f4;return function(_0x12da50){logger['error'](_0x12da50[_0x67e2('0x24')]);if(_0x12da50['name']){delete _0x12da50[_0x67e2('0x25')];}_0x412684['status'](_0x29f6cc)[_0x67e2('0x26')](_0x12da50);};}exports['index']=function(_0xc6222d,_0x2f99e9){var _0xb1754c={},_0x561f7a={},_0x5a9a4a={'count':0x0,'rows':[]};var _0x581ad9=_[_0x67e2('0x27')](db['Interval'][_0x67e2('0x28')],function(_0x50511f){return{'name':_0x50511f[_0x67e2('0x29')],'type':_0x50511f[_0x67e2('0x2a')][_0x67e2('0x2b')]};});_0x561f7a[_0x67e2('0x2c')]=_[_0x67e2('0x27')](_0x581ad9,_0x67e2('0x25'));_0x561f7a[_0x67e2('0x2d')]=_['keys'](_0xc6222d['query']);_0x561f7a[_0x67e2('0x2e')]=_[_0x67e2('0x2f')](_0x561f7a[_0x67e2('0x2c')],_0x561f7a['query']);_0xb1754c[_0x67e2('0x30')]=_[_0x67e2('0x2f')](_0x561f7a[_0x67e2('0x2c')],qs[_0x67e2('0x31')](_0xc6222d[_0x67e2('0x2d')][_0x67e2('0x31')]));_0xb1754c['attributes']=_0xb1754c[_0x67e2('0x30')][_0x67e2('0x32')]?_0xb1754c[_0x67e2('0x30')]:_0x561f7a['model'];if(!_0xc6222d['query'][_0x67e2('0x33')](_0x67e2('0x34'))){_0xb1754c[_0x67e2('0x16')]=qs[_0x67e2('0x16')](_0xc6222d[_0x67e2('0x2d')][_0x67e2('0x16')]);_0xb1754c[_0x67e2('0x18')]=qs[_0x67e2('0x18')](_0xc6222d[_0x67e2('0x2d')][_0x67e2('0x18')]);}_0xb1754c['order']=qs['sort'](_0xc6222d[_0x67e2('0x2d')]['sort']);_0xb1754c[_0x67e2('0x35')]=qs[_0x67e2('0x2e')](_[_0x67e2('0x36')](_0xc6222d[_0x67e2('0x2d')],_0x561f7a['filters']),_0x581ad9);if(_0xc6222d[_0x67e2('0x2d')][_0x67e2('0x37')]){_0xb1754c[_0x67e2('0x35')]=_[_0x67e2('0x38')](_0xb1754c[_0x67e2('0x35')],{'$or':_[_0x67e2('0x27')](_0x581ad9,function(_0x2a486d){if(_0x2a486d[_0x67e2('0x2a')]!==_0x67e2('0x39')){var _0x320bcb={};_0x320bcb[_0x2a486d[_0x67e2('0x25')]]={'$like':'%'+_0xc6222d['query'][_0x67e2('0x37')]+'%'};return _0x320bcb;}})});}_0xb1754c=_['merge']({},_0xb1754c,_0xc6222d['options']);var _0xa8033c={'where':_0xb1754c[_0x67e2('0x35')]};return db[_0x67e2('0x3a')]['count'](_0xa8033c)['then'](function(_0x33c581){_0x5a9a4a['count']=_0x33c581;if(_0xc6222d[_0x67e2('0x2d')]['includeAll']){_0xb1754c[_0x67e2('0x3b')]=[{'all':!![]}];}return db[_0x67e2('0x3a')][_0x67e2('0x3c')](_0xb1754c);})[_0x67e2('0x1f')](function(_0x2e1a62){_0x5a9a4a['rows']=_0x2e1a62;return _0x5a9a4a;})[_0x67e2('0x1f')](respondWithFilteredResult(_0x2f99e9,_0xb1754c))[_0x67e2('0x3d')](handleError(_0x2f99e9,null));};exports[_0x67e2('0x3e')]=function(_0x1bd59a,_0x1a5fe8){var _0xf965c6={'raw':!![],'where':{'id':_0x1bd59a['params']['id']}},_0x7098a4={};_0x7098a4[_0x67e2('0x2c')]=_[_0x67e2('0x3f')](db[_0x67e2('0x3a')]['rawAttributes']);_0x7098a4['query']=_['keys'](_0x1bd59a[_0x67e2('0x2d')]);_0x7098a4['filters']=_[_0x67e2('0x2f')](_0x7098a4[_0x67e2('0x2c')],_0x7098a4[_0x67e2('0x2d')]);_0xf965c6['attributes']=_[_0x67e2('0x2f')](_0x7098a4[_0x67e2('0x2c')],qs['fields'](_0x1bd59a['query']['fields']));_0xf965c6['attributes']=_0xf965c6[_0x67e2('0x30')]['length']?_0xf965c6['attributes']:_0x7098a4[_0x67e2('0x2c')];if(_0x1bd59a['query'][_0x67e2('0x40')]){_0xf965c6['include']=[{'all':!![]}];}_0xf965c6=_[_0x67e2('0x38')]({},_0xf965c6,_0x1bd59a['options']);return db['Interval'][_0x67e2('0x41')](_0xf965c6)[_0x67e2('0x1f')](handleEntityNotFound(_0x1a5fe8,null))['then'](respondWithResult(_0x1a5fe8,null))['catch'](handleError(_0x1a5fe8,null));};exports[_0x67e2('0x42')]=function(_0x43929a,_0x4f4b8e){return db[_0x67e2('0x3a')][_0x67e2('0x42')](_0x43929a[_0x67e2('0x43')],{})['then'](function(_0x31ff86){var _0x1cd437=_0x43929a['user'][_0x67e2('0x44')]({'plain':!![]});if(!_0x1cd437)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cd437[_0x67e2('0x45')]==='user'){var _0x56ce0a=_0x31ff86[_0x67e2('0x44')]({'plain':!![]});var _0x1adccf=_0x67e2('0x20');return db[_0x67e2('0x46')][_0x67e2('0x41')]({'where':{'name':_0x1adccf,'userProfileId':_0x1cd437[_0x67e2('0x47')]},'raw':!![]})['then'](function(_0x3fd06c){if(_0x3fd06c&&_0x3fd06c[_0x67e2('0x48')]===0x0){return db[_0x67e2('0x21')][_0x67e2('0x42')]({'name':_0x56ce0a['name'],'resourceId':_0x56ce0a['id'],'type':_0x3fd06c[_0x67e2('0x25')],'sectionId':_0x3fd06c['id']},{})['then'](function(){return _0x31ff86;});}else{return _0x31ff86;}})[_0x67e2('0x3d')](function(_0x46fcb8){logger[_0x67e2('0x49')](_0x67e2('0x4a'),_0x46fcb8);throw _0x46fcb8;});}return _0x31ff86;})[_0x67e2('0x1f')](respondWithResult(_0x4f4b8e,0xc9))['catch'](handleError(_0x4f4b8e,null));};exports[_0x67e2('0x4b')]=function(_0x4972ba,_0x56b1f8){if(_0x4972ba[_0x67e2('0x43')]['id']){delete _0x4972ba[_0x67e2('0x43')]['id'];}return db['Interval'][_0x67e2('0x41')]({'where':{'id':_0x4972ba['params']['id']}})[_0x67e2('0x1f')](handleEntityNotFound(_0x56b1f8,null))['then'](saveUpdates(_0x4972ba[_0x67e2('0x43')],null))[_0x67e2('0x1f')](respondWithResult(_0x56b1f8,null))['catch'](handleError(_0x56b1f8,null));};exports[_0x67e2('0x22')]=function(_0x216454,_0x52f5ff){return db['Interval'][_0x67e2('0x41')]({'where':{'id':_0x216454['params']['id']}})['then'](handleEntityNotFound(_0x52f5ff,null))[_0x67e2('0x1f')](removeEntity(_0x52f5ff,null))[_0x67e2('0x3d')](handleError(_0x52f5ff,null));};exports[_0x67e2('0x4c')]=function(_0x2bea24,_0x1c5414,_0x54ac98){if(_0x2bea24[_0x67e2('0x43')]['id']){delete _0x2bea24[_0x67e2('0x43')]['id'];}return db[_0x67e2('0x3a')][_0x67e2('0x41')]({'where':{'id':_0x2bea24['params']['id']}})[_0x67e2('0x1f')](handleEntityNotFound(_0x1c5414,null))[_0x67e2('0x1f')](function(_0x1e5275){if(_0x1e5275){_0x2bea24['body']['IntervalId']=_0x1e5275['id'];return db[_0x67e2('0x3a')][_0x67e2('0x42')](_0x2bea24[_0x67e2('0x43')]);}})['then'](respondWithResult(_0x1c5414,null))[_0x67e2('0x3d')](handleError(_0x1c5414,null));};exports['getIntervals']=function(_0x3e4a60,_0x2bb46c,_0x2bcae8){var _0x1d8fd1={};var _0x23199a={};var _0x3c2b89;var _0x4401ff;return db[_0x67e2('0x3a')]['findOne']({'where':{'id':_0x3e4a60[_0x67e2('0x4d')]['id']}})[_0x67e2('0x1f')](handleEntityNotFound(_0x2bb46c,null))[_0x67e2('0x1f')](function(_0x40f87d){if(_0x40f87d){_0x3c2b89=_0x40f87d;_0x23199a[_0x67e2('0x2c')]=_['keys'](db[_0x67e2('0x3a')]['rawAttributes']);_0x23199a[_0x67e2('0x2d')]=_[_0x67e2('0x3f')](_0x3e4a60['query']);_0x23199a[_0x67e2('0x2e')]=_[_0x67e2('0x2f')](_0x23199a['model'],_0x23199a[_0x67e2('0x2d')]);_0x1d8fd1[_0x67e2('0x30')]=_['intersection'](_0x23199a[_0x67e2('0x2c')],qs[_0x67e2('0x31')](_0x3e4a60[_0x67e2('0x2d')][_0x67e2('0x31')]));_0x1d8fd1[_0x67e2('0x30')]=_0x1d8fd1[_0x67e2('0x30')][_0x67e2('0x32')]?_0x1d8fd1[_0x67e2('0x30')]:_0x23199a[_0x67e2('0x2c')];_0x1d8fd1[_0x67e2('0x4e')]=qs[_0x67e2('0x4f')](_0x3e4a60['query'][_0x67e2('0x4f')]);_0x1d8fd1[_0x67e2('0x35')]=qs[_0x67e2('0x2e')](_[_0x67e2('0x36')](_0x3e4a60['query'],_0x23199a[_0x67e2('0x2e')]));if(_0x3e4a60['query'][_0x67e2('0x37')]){_0x1d8fd1[_0x67e2('0x35')]=_[_0x67e2('0x38')](_0x1d8fd1['where'],{'$or':_[_0x67e2('0x27')](_0x1d8fd1[_0x67e2('0x30')],function(_0x4341fe){var _0x1037ab={};_0x1037ab[_0x4341fe]={'$like':'%'+_0x3e4a60[_0x67e2('0x2d')][_0x67e2('0x37')]+'%'};return _0x1037ab;})});}_0x1d8fd1=_[_0x67e2('0x38')]({},_0x1d8fd1,_0x3e4a60[_0x67e2('0x50')]);return _0x3c2b89['getIntervals'](_0x1d8fd1);}})[_0x67e2('0x1f')](function(_0x4c9013){if(_0x4c9013){_0x4401ff=_0x4c9013['length'];if(!_0x3e4a60[_0x67e2('0x2d')]['hasOwnProperty']('nolimit')){_0x1d8fd1['limit']=qs[_0x67e2('0x16')](_0x3e4a60[_0x67e2('0x2d')][_0x67e2('0x16')]);_0x1d8fd1[_0x67e2('0x18')]=qs[_0x67e2('0x18')](_0x3e4a60['query']['offset']);}return _0x3c2b89[_0x67e2('0x51')](_0x1d8fd1);}})[_0x67e2('0x1f')](function(_0x106b38){if(_0x106b38){return _0x106b38?{'count':_0x4401ff,'rows':_0x106b38}:null;}})[_0x67e2('0x1f')](respondWithResult(_0x2bb46c,null))[_0x67e2('0x3d')](handleError(_0x2bb46c,null));};exports[_0x67e2('0x52')]=function(_0x327321,_0x492de9,_0x5d55fd){return db[_0x67e2('0x3a')][_0x67e2('0x53')]({'where':{'id':_0x327321['params']['id']}})[_0x67e2('0x1f')](handleEntityNotFound(_0x492de9,null))[_0x67e2('0x1f')](function(_0x41d160){if(_0x41d160){return db[_0x67e2('0x54')]['transaction'](function(_0x9356f6){return db[_0x67e2('0x3a')]['destroy']({'where':{'IntervalId':_0x327321['params']['id']},'transaction':_0x9356f6})[_0x67e2('0x1f')](function(_0x47547a){var _0x232b8a=_[_0x67e2('0x27')](_0x327321[_0x67e2('0x43')],function(_0x4bab33){delete _0x4bab33['id'];_0x4bab33[_0x67e2('0x55')]=_0x327321[_0x67e2('0x4d')]['id'];return _0x4bab33;});return db[_0x67e2('0x3a')][_0x67e2('0x56')](_0x232b8a,{'transaction':_0x9356f6});});})[_0x67e2('0x1f')](function(){return db[_0x67e2('0x3a')][_0x67e2('0x3c')]({'where':{'IntervalId':_0x327321[_0x67e2('0x4d')]['id']}});});}})[_0x67e2('0x1f')](respondWithResult(_0x492de9,null))['catch'](handleError(_0x492de9,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 2187f4e..77b13d2 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 _0x5d95=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','rewrite','lodash'];(function(_0x4b08d5,_0x370935){var _0x512b00=function(_0x125ca1){while(--_0x125ca1){_0x4b08d5['push'](_0x4b08d5['shift']());}};_0x512b00(++_0x370935);}(_0x5d95,0x77));var _0x55d9=function(_0xbffd1a,_0x52dfe1){_0xbffd1a=_0xbffd1a-0x0;var _0x404215=_0x5d95[_0xbffd1a];return _0x404215;};'use strict';var _=require(_0x55d9('0x0'));var util=require(_0x55d9('0x1'));var logger=require('../../config/logger')(_0x55d9('0x2'));var moment=require(_0x55d9('0x3'));var BPromise=require(_0x55d9('0x4'));var rp=require(_0x55d9('0x5'));var fs=require('fs');var path=require(_0x55d9('0x6'));var rimraf=require('rimraf');var config=require(_0x55d9('0x7'));var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');module[_0x55d9('0x8')]=function(_0x4244b4,_0x5b4471){return _0x4244b4['define']('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e27cc,_0x2cece4){extensions['rewrite'](_0x4244b4,_0x4e27cc);},'afterBulkCreate':function(_0x4d52fa,_0x77a04f,_0x373788){_0x373788();extensions[_0x55d9('0x9')](_0x4244b4,_0x4d52fa[0x0]);},'afterUpdate':function(_0xfd0f08,_0x38cde2){extensions[_0x55d9('0x9')](_0x4244b4,_0xfd0f08);},'afterDestroy':function(_0x5bd496,_0x552cb8){extensions[_0x55d9('0x9')](_0x4244b4,_0x5bd496);}}});}; \ No newline at end of file +var _0x8563=['rewrite','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite'];(function(_0x24a711,_0x2c44e7){var _0x24dad5=function(_0x530840){while(--_0x530840){_0x24a711['push'](_0x24a711['shift']());}};_0x24dad5(++_0x2c44e7);}(_0x8563,0x1b9));var _0x3856=function(_0x37989d,_0x12d7d3){_0x37989d=_0x37989d-0x0;var _0x3cc8b0=_0x8563[_0x37989d];return _0x3cc8b0;};'use strict';var _=require(_0x3856('0x0'));var util=require(_0x3856('0x1'));var logger=require(_0x3856('0x2'))(_0x3856('0x3'));var moment=require(_0x3856('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3856('0x5'));var config=require(_0x3856('0x6'));var attributes=require(_0x3856('0x7'));var extensions=require(_0x3856('0x8'));module['exports']=function(_0xe89a99,_0x5e023b){return _0xe89a99['define']('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e1665,_0xeac3a3){extensions['rewrite'](_0xe89a99,_0x2e1665);},'afterBulkCreate':function(_0x3e3cba,_0x452076,_0x2ab959){_0x2ab959();extensions[_0x3856('0x9')](_0xe89a99,_0x3e3cba[0x0]);},'afterUpdate':function(_0x3a56ec,_0x38a375){extensions['rewrite'](_0xe89a99,_0x3a56ec);},'afterDestroy':function(_0xab4673,_0x35359f){extensions[_0x3856('0x9')](_0xe89a99,_0xab4673);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index bf49004..135effd 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(_0x5d3903,_0x3d6c3e){var _0x4b8bc9=function(_0x92b297){while(--_0x92b297){_0x5d3903['push'](_0x5d3903['shift']());}};_0x4b8bc9(++_0x3d6c3e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 3e3c4d9..65ab1a6 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x5e2613,_0x5d7a19){var _0x45d076=function(_0x103e5c){while(--_0x103e5c){_0x5e2613['push'](_0x5e2613['shift']());}};_0x45d076(++_0x5d7a19);}(_0x5f2f,0x73));var _0xf5f2=function(_0x128851,_0x220ae2){_0x128851=_0x128851-0x0;var _0xfba095=_0x5f2f[_0x128851];return _0xfba095;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 2a86248..c535b69 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 _0x6f0b=['application/json','toString','base64','utf8','data','end','status','statusCode','json','parse','error','api.jira','openIssue','send','headers','connection','socket','remoteAddress','bluebird','https','api','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6f0b,0x90));var _0xb6f0=function(_0xc82596,_0x34994b){_0xc82596=_0xc82596-0x0;var _0x465e84=_0x6f0b[_0xc82596];return _0x465e84;};'use strict';var BPromise=require(_0xb6f0('0x0'));var https=require(_0xb6f0('0x1'));var logger=require('../../config/logger')(_0xb6f0('0x2'));var USERNAME=_0xb6f0('0x3');var PASSWORD=_0xb6f0('0x4');function openIssue(_0x4ca789,_0x594e4b){var _0x331540={'fields':{'project':{'key':_0x4ca789['key']||_0xb6f0('0x5')},'summary':(_0x4ca789[_0xb6f0('0x6')]||'Report')+_0xb6f0('0x7')+_0x4ca789['ip'],'description':_0x4ca789[_0xb6f0('0x8')]||JSON[_0xb6f0('0x9')](_0x4ca789),'issuetype':{'name':_0x4ca789[_0xb6f0('0xa')]||'Bug'}}};_0x331540['fields'][_0xb6f0('0xb')]=_0x4ca789[_0xb6f0('0xc')];_0x331540[_0xb6f0('0xd')][_0xb6f0('0xe')]=_0x4ca789[_0xb6f0('0xf')];_0x331540[_0xb6f0('0xd')][_0xb6f0('0x10')]=_0x4ca789[_0xb6f0('0x11')];_0x331540[_0xb6f0('0xd')]['customfield_11503']=_0x4ca789[_0xb6f0('0x12')];_0x331540['fields'][_0xb6f0('0x13')]=_0x4ca789[_0xb6f0('0x14')];_0x331540[_0xb6f0('0xd')][_0xb6f0('0x15')]=_0x4ca789['ip'];var _0x52cecb={'host':_0xb6f0('0x16'),'port':0x1bb,'path':_0xb6f0('0x17'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xb6f0('0x18'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xb6f0('0x19')](_0xb6f0('0x1a'))}};var _0x14d763=JSON['stringify'](_0x331540);var _0x10a99e=https['request'](_0x52cecb,function(_0x19cb5f){_0x19cb5f['setEncoding'](_0xb6f0('0x1b'));var _0x4bfd78='';_0x19cb5f['on'](_0xb6f0('0x1c'),function(_0x4a599e){_0x4bfd78+=_0x4a599e;});_0x19cb5f['on'](_0xb6f0('0x1d'),function(){if(_0x594e4b){return _0x594e4b[_0xb6f0('0x1e')](_0x19cb5f[_0xb6f0('0x1f')])[_0xb6f0('0x20')](JSON[_0xb6f0('0x21')](_0x4bfd78));}});});_0x10a99e['on'](_0xb6f0('0x22'),function(_0x2a5fe3){if(_0x594e4b){return _0x594e4b[_0xb6f0('0x1e')](0x1f4)[_0xb6f0('0x20')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xb6f0('0x23')}]});}});_0x10a99e['write'](_0x14d763);_0x10a99e['end']();}exports[_0xb6f0('0x24')]=openIssue;exports[_0xb6f0('0x25')]=function(_0x2c1576,_0x1ba80f){_0x2c1576['body']['ip']=_0x2c1576[_0xb6f0('0x26')]['x-forwarded-for']||_0x2c1576[_0xb6f0('0x27')]['remoteAddress']||_0x2c1576[_0xb6f0('0x28')][_0xb6f0('0x29')]||_0x2c1576[_0xb6f0('0x27')][_0xb6f0('0x28')][_0xb6f0('0x29')];return openIssue(_0x2c1576['body'],_0x1ba80f);}; \ No newline at end of file +var _0xed92=['end','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','Report','description','stringify','issuetype','Bug','fields','customfield_11500','email','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','application/json','Basic\x20','request','setEncoding','utf8','data'];(function(_0x114da0,_0x19188f){var _0x5f1d8a=function(_0x154c3d){while(--_0x154c3d){_0x114da0['push'](_0x114da0['shift']());}};_0x5f1d8a(++_0x19188f);}(_0xed92,0x12b));var _0x2ed9=function(_0x4469a9,_0x53ce4e){_0x4469a9=_0x4469a9-0x0;var _0x1c9663=_0xed92[_0x4469a9];return _0x1c9663;};'use strict';var BPromise=require(_0x2ed9('0x0'));var https=require(_0x2ed9('0x1'));var logger=require(_0x2ed9('0x2'))(_0x2ed9('0x3'));var USERNAME='support';var PASSWORD=_0x2ed9('0x4');function openIssue(_0x2079d3,_0x1b1bb7){var _0x3c18c0={'fields':{'project':{'key':_0x2079d3[_0x2ed9('0x5')]||'MOTGUI'},'summary':(_0x2079d3['summary']||_0x2ed9('0x6'))+'\x20from\x20'+_0x2079d3['ip'],'description':_0x2079d3[_0x2ed9('0x7')]||JSON[_0x2ed9('0x8')](_0x2079d3),'issuetype':{'name':_0x2079d3[_0x2ed9('0x9')]||_0x2ed9('0xa')}}};_0x3c18c0[_0x2ed9('0xb')][_0x2ed9('0xc')]=_0x2079d3[_0x2ed9('0xd')];_0x3c18c0[_0x2ed9('0xb')]['customfield_11501']=_0x2079d3[_0x2ed9('0xe')];_0x3c18c0[_0x2ed9('0xb')][_0x2ed9('0xf')]=_0x2079d3[_0x2ed9('0x10')];_0x3c18c0[_0x2ed9('0xb')][_0x2ed9('0x11')]=_0x2079d3[_0x2ed9('0x12')];_0x3c18c0['fields'][_0x2ed9('0x13')]=_0x2079d3[_0x2ed9('0x14')];_0x3c18c0['fields'][_0x2ed9('0x15')]=_0x2079d3['ip'];var _0x4a9849={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x2ed9('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x2ed9('0x17'),'Authorization':_0x2ed9('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x3aee08=JSON[_0x2ed9('0x8')](_0x3c18c0);var _0x280082=https[_0x2ed9('0x19')](_0x4a9849,function(_0x49f54b){_0x49f54b[_0x2ed9('0x1a')](_0x2ed9('0x1b'));var _0xb67a30='';_0x49f54b['on'](_0x2ed9('0x1c'),function(_0x2f13b5){_0xb67a30+=_0x2f13b5;});_0x49f54b['on'](_0x2ed9('0x1d'),function(){if(_0x1b1bb7){return _0x1b1bb7['status'](_0x49f54b['statusCode'])['json'](JSON['parse'](_0xb67a30));}});});_0x280082['on'](_0x2ed9('0x1e'),function(_0x4268f9){if(_0x1b1bb7){return _0x1b1bb7['status'](0x1f4)['json']({'errors':[{'message':_0x2ed9('0x1f'),'type':_0x2ed9('0x20')}]});}});_0x280082[_0x2ed9('0x21')](_0x3aee08);_0x280082[_0x2ed9('0x1d')]();}exports[_0x2ed9('0x22')]=openIssue;exports[_0x2ed9('0x23')]=function(_0x5408e1,_0x13b528){_0x5408e1['body']['ip']=_0x5408e1[_0x2ed9('0x24')][_0x2ed9('0x25')]||_0x5408e1[_0x2ed9('0x26')][_0x2ed9('0x27')]||_0x5408e1[_0x2ed9('0x28')][_0x2ed9('0x27')]||_0x5408e1[_0x2ed9('0x26')][_0x2ed9('0x28')][_0x2ed9('0x27')];return openIssue(_0x5408e1['body'],_0x13b528);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index e63656b..1143114 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 _0x17ba=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x17ba,0xab));var _0xa17b=function(_0x59c3b9,_0x482969){_0x59c3b9=_0x59c3b9-0x0;var _0x1c8116=_0x17ba[_0x59c3b9];return _0x1c8116;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router; \ No newline at end of file +var _0xdace=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x466210,_0x348b48){var _0xa24d7a=function(_0x41c3a5){while(--_0x41c3a5){_0x466210['push'](_0x466210['shift']());}};_0xa24d7a(++_0x348b48);}(_0xdace,0xc5));var _0xedac=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xdace[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var fs_extra=require(_0xedac('0x4'));var auth=require(_0xedac('0x5'));var interaction=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),auth[_0xedac('0x9')](),controller[_0xedac('0xc')]);router['get'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xedac('0xf')]);router[_0xedac('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xedac('0x11')]);router[_0xedac('0x12')]('/:id',auth[_0xedac('0x9')](),controller['destroy']);module[_0xedac('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 4262b0d..bf4542a 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(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7a54,0x106));var _0x47a5=function(_0xacc4b1,_0x4dc9b2){_0xacc4b1=_0xacc4b1-0x0;var _0x3612a4=_0x7a54[_0xacc4b1];return _0x3612a4;};'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(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7a54,0x106));var _0x47a5=function(_0x2beea8,_0x5b03b3){_0x2beea8=_0x2beea8-0x0;var _0x12b12d=_0x7a54[_0x2beea8];return _0x12b12d;};'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 7a33689..5237350 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 _0x7c1f=['hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','JscriptyAnswerReport','findAll','rows','params','keys','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','destroy','then','status','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','length','attributes'];(function(_0x125000,_0xcdd9c3){var _0x579627=function(_0x1fb364){while(--_0x1fb364){_0x125000['push'](_0x125000['shift']());}};_0x579627(++_0xcdd9c3);}(_0x7c1f,0x194));var _0xf7c1=function(_0x17bf7d,_0x3361f5){_0x17bf7d=_0x17bf7d-0x0;var _0x5d87e0=_0x7c1f[_0x17bf7d];return _0x5d87e0;};'use strict';var emlformat=require(_0xf7c1('0x0'));var rimraf=require(_0xf7c1('0x1'));var zipdir=require(_0xf7c1('0x2'));var jsonpatch=require(_0xf7c1('0x3'));var rp=require(_0xf7c1('0x4'));var moment=require('moment');var BPromise=require(_0xf7c1('0x5'));var Mustache=require(_0xf7c1('0x6'));var util=require(_0xf7c1('0x7'));var path=require('path');var sox=require(_0xf7c1('0x8'));var csv=require(_0xf7c1('0x9'));var ejs=require(_0xf7c1('0xa'));var fs=require('fs');var fs_extra=require(_0xf7c1('0xb'));var _=require('lodash');var squel=require(_0xf7c1('0xc'));var crypto=require(_0xf7c1('0xd'));var jsforce=require(_0xf7c1('0xe'));var deskjs=require(_0xf7c1('0xf'));var toCsv=require(_0xf7c1('0x9'));var querystring=require(_0xf7c1('0x10'));var Papa=require(_0xf7c1('0x11'));var Redis=require(_0xf7c1('0x12'));var authService=require(_0xf7c1('0x13'));var qs=require(_0xf7c1('0x14'));var as=require(_0xf7c1('0x15'));var hardwareService=require(_0xf7c1('0x16'));var logger=require('../../config/logger')(_0xf7c1('0x17'));var utils=require(_0xf7c1('0x18'));var config=require(_0xf7c1('0x19'));var licenseUtil=require(_0xf7c1('0x1a'));var db=require(_0xf7c1('0x1b'))['db'];function respondWithStatusCode(_0x377ca4,_0x4ffd9a){_0x4ffd9a=_0x4ffd9a||0xcc;return function(_0x5f579c){if(_0x5f579c){return _0x377ca4[_0xf7c1('0x1c')](_0x4ffd9a);}return _0x377ca4['status'](_0x4ffd9a)[_0xf7c1('0x1d')]();};}function respondWithResult(_0x212791,_0x5b553f){_0x5b553f=_0x5b553f||0xc8;return function(_0x396f8b){if(_0x396f8b){return _0x212791['status'](_0x5b553f)[_0xf7c1('0x1e')](_0x396f8b);}};}function respondWithFilteredResult(_0x3fc40e,_0x315424){return function(_0x12ccde){if(_0x12ccde){var _0xb567e7=typeof _0x315424['offset']===_0xf7c1('0x1f')&&typeof _0x315424['limit']===_0xf7c1('0x1f');var _0x4f0a0a=_0x12ccde[_0xf7c1('0x20')];var _0x20e3f8=_0xb567e7?0x0:_0x315424[_0xf7c1('0x21')];var _0x15dd26=_0xb567e7?_0x12ccde[_0xf7c1('0x20')]:_0x315424[_0xf7c1('0x21')]+_0x315424[_0xf7c1('0x22')];var _0x43eee9;if(_0x15dd26>=_0x4f0a0a){_0x15dd26=_0x4f0a0a;_0x43eee9=0xc8;}else{_0x43eee9=0xce;}_0x3fc40e['status'](_0x43eee9);return _0x3fc40e['set'](_0xf7c1('0x23'),_0x20e3f8+'-'+_0x15dd26+'/'+_0x4f0a0a)[_0xf7c1('0x1e')](_0x12ccde);}return null;};}function patchUpdates(_0x4ee91e){return function(_0x16d8a1){try{jsonpatch[_0xf7c1('0x24')](_0x16d8a1,_0x4ee91e,!![]);}catch(_0x51aba8){return BPromise[_0xf7c1('0x25')](_0x51aba8);}return _0x16d8a1['save']();};}function saveUpdates(_0x4b202d,_0x59e25f){return function(_0x4333f0){if(_0x4333f0){return _0x4333f0[_0xf7c1('0x26')](_0x4b202d)['then'](function(_0x2932e2){return _0x2932e2;});}return null;};}function removeEntity(_0x18e2b4,_0x4eff1a){return function(_0x33c874){if(_0x33c874){return _0x33c874[_0xf7c1('0x27')]()[_0xf7c1('0x28')](function(){_0x18e2b4[_0xf7c1('0x29')](0xcc)[_0xf7c1('0x1d')]();});}};}function handleEntityNotFound(_0x54f3f3,_0x502f57){return function(_0x5bd8ba){if(!_0x5bd8ba){_0x54f3f3[_0xf7c1('0x1c')](0x194);}return _0x5bd8ba;};}function handleError(_0x2802bf,_0x14ecef){_0x14ecef=_0x14ecef||0x1f4;return function(_0x374efc){logger[_0xf7c1('0x2a')](_0x374efc[_0xf7c1('0x2b')]);if(_0x374efc[_0xf7c1('0x2c')]){delete _0x374efc[_0xf7c1('0x2c')];}_0x2802bf[_0xf7c1('0x29')](_0x14ecef)['send'](_0x374efc);};}exports[_0xf7c1('0x2d')]=function(_0x37c472,_0x4f68c6){var _0x43c7b4={},_0x1f486d={},_0x410544={'count':0x0,'rows':[]};var _0x636a01=_[_0xf7c1('0x2e')](db['JscriptyAnswerReport'][_0xf7c1('0x2f')],function(_0x5b01b4){return{'name':_0x5b01b4[_0xf7c1('0x30')],'type':_0x5b01b4[_0xf7c1('0x31')][_0xf7c1('0x32')]};});_0x1f486d['model']=_[_0xf7c1('0x2e')](_0x636a01,_0xf7c1('0x2c'));_0x1f486d['query']=_['keys'](_0x37c472[_0xf7c1('0x33')]);_0x1f486d[_0xf7c1('0x34')]=_[_0xf7c1('0x35')](_0x1f486d[_0xf7c1('0x36')],_0x1f486d[_0xf7c1('0x33')]);_0x43c7b4['attributes']=_[_0xf7c1('0x35')](_0x1f486d[_0xf7c1('0x36')],qs[_0xf7c1('0x37')](_0x37c472[_0xf7c1('0x33')][_0xf7c1('0x37')]));_0x43c7b4['attributes']=_0x43c7b4['attributes'][_0xf7c1('0x38')]?_0x43c7b4[_0xf7c1('0x39')]:_0x1f486d[_0xf7c1('0x36')];if(!_0x37c472[_0xf7c1('0x33')][_0xf7c1('0x3a')]('nolimit')){_0x43c7b4['limit']=qs[_0xf7c1('0x22')](_0x37c472[_0xf7c1('0x33')][_0xf7c1('0x22')]);_0x43c7b4[_0xf7c1('0x21')]=qs['offset'](_0x37c472[_0xf7c1('0x33')]['offset']);}_0x43c7b4[_0xf7c1('0x3b')]=qs[_0xf7c1('0x3c')](_0x37c472[_0xf7c1('0x33')][_0xf7c1('0x3c')]);_0x43c7b4[_0xf7c1('0x3d')]=qs[_0xf7c1('0x34')](_[_0xf7c1('0x3e')](_0x37c472['query'],_0x1f486d['filters']),_0x636a01);if(_0x37c472[_0xf7c1('0x33')]['filter']){_0x43c7b4[_0xf7c1('0x3d')]=_[_0xf7c1('0x3f')](_0x43c7b4['where'],{'$or':_[_0xf7c1('0x2e')](_0x636a01,function(_0x53a2c5){if(_0x53a2c5['type']!==_0xf7c1('0x40')){var _0x2a9a03={};_0x2a9a03[_0x53a2c5[_0xf7c1('0x2c')]]={'$like':'%'+_0x37c472[_0xf7c1('0x33')]['filter']+'%'};return _0x2a9a03;}})});}_0x43c7b4=_['merge']({},_0x43c7b4,_0x37c472[_0xf7c1('0x41')]);var _0x335606={'where':_0x43c7b4[_0xf7c1('0x3d')]};return db[_0xf7c1('0x42')][_0xf7c1('0x20')](_0x335606)[_0xf7c1('0x28')](function(_0x5bad53){_0x410544[_0xf7c1('0x20')]=_0x5bad53;if(_0x37c472[_0xf7c1('0x33')]['includeAll']){_0x43c7b4['include']=[{'all':!![]}];}return db[_0xf7c1('0x42')][_0xf7c1('0x43')](_0x43c7b4);})[_0xf7c1('0x28')](function(_0x1b7f4e){_0x410544[_0xf7c1('0x44')]=_0x1b7f4e;return _0x410544;})['then'](respondWithFilteredResult(_0x4f68c6,_0x43c7b4))['catch'](handleError(_0x4f68c6,null));};exports['show']=function(_0x3f2204,_0x5da1e1){var _0x3169ad={'raw':!![],'where':{'id':_0x3f2204[_0xf7c1('0x45')]['id']}},_0x3e4868={};_0x3e4868[_0xf7c1('0x36')]=_[_0xf7c1('0x46')](db['JscriptyAnswerReport'][_0xf7c1('0x2f')]);_0x3e4868['query']=_['keys'](_0x3f2204[_0xf7c1('0x33')]);_0x3e4868['filters']=_['intersection'](_0x3e4868[_0xf7c1('0x36')],_0x3e4868[_0xf7c1('0x33')]);_0x3169ad[_0xf7c1('0x39')]=_[_0xf7c1('0x35')](_0x3e4868[_0xf7c1('0x36')],qs['fields'](_0x3f2204[_0xf7c1('0x33')][_0xf7c1('0x37')]));_0x3169ad[_0xf7c1('0x39')]=_0x3169ad['attributes'][_0xf7c1('0x38')]?_0x3169ad[_0xf7c1('0x39')]:_0x3e4868[_0xf7c1('0x36')];if(_0x3f2204[_0xf7c1('0x33')][_0xf7c1('0x47')]){_0x3169ad['include']=[{'all':!![]}];}_0x3169ad=_[_0xf7c1('0x3f')]({},_0x3169ad,_0x3f2204[_0xf7c1('0x41')]);return db[_0xf7c1('0x42')][_0xf7c1('0x48')](_0x3169ad)['then'](handleEntityNotFound(_0x5da1e1,null))[_0xf7c1('0x28')](respondWithResult(_0x5da1e1,null))[_0xf7c1('0x49')](handleError(_0x5da1e1,null));};exports[_0xf7c1('0x4a')]=function(_0x51e048,_0x2c107a){return db[_0xf7c1('0x42')][_0xf7c1('0x4a')](_0x51e048['body'],{})[_0xf7c1('0x28')](respondWithResult(_0x2c107a,0xc9))[_0xf7c1('0x49')](handleError(_0x2c107a,null));};exports[_0xf7c1('0x26')]=function(_0x5eb40a,_0xd08daa){if(_0x5eb40a['body']['id']){delete _0x5eb40a[_0xf7c1('0x4b')]['id'];}return db[_0xf7c1('0x42')]['find']({'where':{'id':_0x5eb40a['params']['id']}})[_0xf7c1('0x28')](handleEntityNotFound(_0xd08daa,null))['then'](saveUpdates(_0x5eb40a['body'],null))[_0xf7c1('0x28')](respondWithResult(_0xd08daa,null))['catch'](handleError(_0xd08daa,null));};exports[_0xf7c1('0x27')]=function(_0x1ced1f,_0x283c23){return db[_0xf7c1('0x42')][_0xf7c1('0x48')]({'where':{'id':_0x1ced1f['params']['id']}})[_0xf7c1('0x28')](handleEntityNotFound(_0x283c23,null))['then'](removeEntity(_0x283c23,null))[_0xf7c1('0x49')](handleError(_0x283c23,null));};exports['describe']=function(_0x1d8e3c,_0xc04a12){return db[_0xf7c1('0x42')][_0xf7c1('0x4c')]()[_0xf7c1('0x28')](respondWithResult(_0xc04a12,null))['catch'](handleError(_0xc04a12,null));}; \ No newline at end of file +var _0xc7a3=['Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set'];(function(_0x5a3c7e,_0x51f096){var _0x592227=function(_0x1a8a85){while(--_0x1a8a85){_0x5a3c7e['push'](_0x5a3c7e['shift']());}};_0x592227(++_0x51f096);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x1ea2fe,_0x13b97c){_0x1ea2fe=_0x1ea2fe-0x0;var _0x1bd220=_0xc7a3[_0x1ea2fe];return _0x1bd220;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c7a('0x0'));var zipdir=require(_0x3c7a('0x1'));var jsonpatch=require(_0x3c7a('0x2'));var rp=require(_0x3c7a('0x3'));var moment=require(_0x3c7a('0x4'));var BPromise=require(_0x3c7a('0x5'));var Mustache=require('mustache');var util=require(_0x3c7a('0x6'));var path=require(_0x3c7a('0x7'));var sox=require('sox');var csv=require(_0x3c7a('0x8'));var ejs=require(_0x3c7a('0x9'));var fs=require('fs');var fs_extra=require(_0x3c7a('0xa'));var _=require('lodash');var squel=require(_0x3c7a('0xb'));var crypto=require('crypto');var jsforce=require(_0x3c7a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3c7a('0x8'));var querystring=require(_0x3c7a('0xd'));var Papa=require(_0x3c7a('0xe'));var Redis=require('ioredis');var authService=require(_0x3c7a('0xf'));var qs=require(_0x3c7a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c7a('0x11'));var logger=require('../../config/logger')(_0x3c7a('0x12'));var utils=require('../../config/utils');var config=require(_0x3c7a('0x13'));var licenseUtil=require(_0x3c7a('0x14'));var db=require(_0x3c7a('0x15'))['db'];function respondWithStatusCode(_0x16ea63,_0x3d47c3){_0x3d47c3=_0x3d47c3||0xcc;return function(_0x53e5d7){if(_0x53e5d7){return _0x16ea63[_0x3c7a('0x16')](_0x3d47c3);}return _0x16ea63[_0x3c7a('0x17')](_0x3d47c3)[_0x3c7a('0x18')]();};}function respondWithResult(_0x36185c,_0x24d188){_0x24d188=_0x24d188||0xc8;return function(_0x4e6ca5){if(_0x4e6ca5){return _0x36185c[_0x3c7a('0x17')](_0x24d188)[_0x3c7a('0x19')](_0x4e6ca5);}};}function respondWithFilteredResult(_0x5af0a6,_0x539270){return function(_0x3044e6){if(_0x3044e6){var _0xb9201c=typeof _0x539270[_0x3c7a('0x1a')]==='undefined'&&typeof _0x539270[_0x3c7a('0x1b')]==='undefined';var _0x74fd1e=_0x3044e6[_0x3c7a('0x1c')];var _0x36e8c2=_0xb9201c?0x0:_0x539270[_0x3c7a('0x1a')];var _0x3cb5bf=_0xb9201c?_0x3044e6[_0x3c7a('0x1c')]:_0x539270['offset']+_0x539270[_0x3c7a('0x1b')];var _0x2db9df;if(_0x3cb5bf>=_0x74fd1e){_0x3cb5bf=_0x74fd1e;_0x2db9df=0xc8;}else{_0x2db9df=0xce;}_0x5af0a6[_0x3c7a('0x17')](_0x2db9df);return _0x5af0a6[_0x3c7a('0x1d')](_0x3c7a('0x1e'),_0x36e8c2+'-'+_0x3cb5bf+'/'+_0x74fd1e)[_0x3c7a('0x19')](_0x3044e6);}return null;};}function patchUpdates(_0x11a06b){return function(_0x34f4a6){try{jsonpatch[_0x3c7a('0x1f')](_0x34f4a6,_0x11a06b,!![]);}catch(_0x544742){return BPromise[_0x3c7a('0x20')](_0x544742);}return _0x34f4a6['save']();};}function saveUpdates(_0x3c75ff,_0x557518){return function(_0x40d24e){if(_0x40d24e){return _0x40d24e[_0x3c7a('0x21')](_0x3c75ff)[_0x3c7a('0x22')](function(_0x7dbe38){return _0x7dbe38;});}return null;};}function removeEntity(_0x283568,_0x245dde){return function(_0x8251d4){if(_0x8251d4){return _0x8251d4[_0x3c7a('0x23')]()[_0x3c7a('0x22')](function(){_0x283568[_0x3c7a('0x17')](0xcc)[_0x3c7a('0x18')]();});}};}function handleEntityNotFound(_0x317fbd,_0x56539f){return function(_0x3984a1){if(!_0x3984a1){_0x317fbd[_0x3c7a('0x16')](0x194);}return _0x3984a1;};}function handleError(_0x37cc40,_0x3829de){_0x3829de=_0x3829de||0x1f4;return function(_0x9b910c){logger[_0x3c7a('0x24')](_0x9b910c[_0x3c7a('0x25')]);if(_0x9b910c[_0x3c7a('0x26')]){delete _0x9b910c['name'];}_0x37cc40[_0x3c7a('0x17')](_0x3829de)[_0x3c7a('0x27')](_0x9b910c);};}exports[_0x3c7a('0x28')]=function(_0x197012,_0x33065b){var _0x1a96a0={},_0xccf304={},_0x1ff595={'count':0x0,'rows':[]};var _0x508d2e=_[_0x3c7a('0x29')](db[_0x3c7a('0x2a')][_0x3c7a('0x2b')],function(_0x18a346){return{'name':_0x18a346[_0x3c7a('0x2c')],'type':_0x18a346[_0x3c7a('0x2d')][_0x3c7a('0x2e')]};});_0xccf304[_0x3c7a('0x2f')]=_[_0x3c7a('0x29')](_0x508d2e,_0x3c7a('0x26'));_0xccf304[_0x3c7a('0x30')]=_[_0x3c7a('0x31')](_0x197012[_0x3c7a('0x30')]);_0xccf304['filters']=_['intersection'](_0xccf304['model'],_0xccf304['query']);_0x1a96a0[_0x3c7a('0x32')]=_[_0x3c7a('0x33')](_0xccf304[_0x3c7a('0x2f')],qs[_0x3c7a('0x34')](_0x197012[_0x3c7a('0x30')][_0x3c7a('0x34')]));_0x1a96a0[_0x3c7a('0x32')]=_0x1a96a0[_0x3c7a('0x32')][_0x3c7a('0x35')]?_0x1a96a0[_0x3c7a('0x32')]:_0xccf304[_0x3c7a('0x2f')];if(!_0x197012[_0x3c7a('0x30')][_0x3c7a('0x36')](_0x3c7a('0x37'))){_0x1a96a0['limit']=qs[_0x3c7a('0x1b')](_0x197012[_0x3c7a('0x30')]['limit']);_0x1a96a0[_0x3c7a('0x1a')]=qs['offset'](_0x197012[_0x3c7a('0x30')][_0x3c7a('0x1a')]);}_0x1a96a0['order']=qs[_0x3c7a('0x38')](_0x197012[_0x3c7a('0x30')][_0x3c7a('0x38')]);_0x1a96a0[_0x3c7a('0x39')]=qs[_0x3c7a('0x3a')](_[_0x3c7a('0x3b')](_0x197012[_0x3c7a('0x30')],_0xccf304[_0x3c7a('0x3a')]),_0x508d2e);if(_0x197012[_0x3c7a('0x30')][_0x3c7a('0x3c')]){_0x1a96a0['where']=_[_0x3c7a('0x3d')](_0x1a96a0[_0x3c7a('0x39')],{'$or':_[_0x3c7a('0x29')](_0x508d2e,function(_0x43c236){if(_0x43c236[_0x3c7a('0x2d')]!==_0x3c7a('0x3e')){var _0x101e5d={};_0x101e5d[_0x43c236[_0x3c7a('0x26')]]={'$like':'%'+_0x197012['query'][_0x3c7a('0x3c')]+'%'};return _0x101e5d;}})});}_0x1a96a0=_[_0x3c7a('0x3d')]({},_0x1a96a0,_0x197012['options']);var _0x442087={'where':_0x1a96a0['where']};return db['JscriptyAnswerReport']['count'](_0x442087)['then'](function(_0x44e935){_0x1ff595[_0x3c7a('0x1c')]=_0x44e935;if(_0x197012[_0x3c7a('0x30')]['includeAll']){_0x1a96a0[_0x3c7a('0x3f')]=[{'all':!![]}];}return db[_0x3c7a('0x2a')]['findAll'](_0x1a96a0);})['then'](function(_0x491335){_0x1ff595[_0x3c7a('0x40')]=_0x491335;return _0x1ff595;})[_0x3c7a('0x22')](respondWithFilteredResult(_0x33065b,_0x1a96a0))[_0x3c7a('0x41')](handleError(_0x33065b,null));};exports[_0x3c7a('0x42')]=function(_0x8d805a,_0x3e6a70){var _0x3f6060={'raw':!![],'where':{'id':_0x8d805a[_0x3c7a('0x43')]['id']}},_0x302556={};_0x302556[_0x3c7a('0x2f')]=_[_0x3c7a('0x31')](db[_0x3c7a('0x2a')][_0x3c7a('0x2b')]);_0x302556[_0x3c7a('0x30')]=_[_0x3c7a('0x31')](_0x8d805a['query']);_0x302556[_0x3c7a('0x3a')]=_[_0x3c7a('0x33')](_0x302556['model'],_0x302556['query']);_0x3f6060['attributes']=_[_0x3c7a('0x33')](_0x302556[_0x3c7a('0x2f')],qs[_0x3c7a('0x34')](_0x8d805a[_0x3c7a('0x30')][_0x3c7a('0x34')]));_0x3f6060[_0x3c7a('0x32')]=_0x3f6060[_0x3c7a('0x32')][_0x3c7a('0x35')]?_0x3f6060[_0x3c7a('0x32')]:_0x302556[_0x3c7a('0x2f')];if(_0x8d805a[_0x3c7a('0x30')]['includeAll']){_0x3f6060['include']=[{'all':!![]}];}_0x3f6060=_['merge']({},_0x3f6060,_0x8d805a[_0x3c7a('0x44')]);return db[_0x3c7a('0x2a')][_0x3c7a('0x45')](_0x3f6060)[_0x3c7a('0x22')](handleEntityNotFound(_0x3e6a70,null))[_0x3c7a('0x22')](respondWithResult(_0x3e6a70,null))['catch'](handleError(_0x3e6a70,null));};exports[_0x3c7a('0x46')]=function(_0x12b69a,_0x2eb9e2){return db[_0x3c7a('0x2a')][_0x3c7a('0x46')](_0x12b69a[_0x3c7a('0x47')],{})[_0x3c7a('0x22')](respondWithResult(_0x2eb9e2,0xc9))['catch'](handleError(_0x2eb9e2,null));};exports['update']=function(_0x420fa7,_0x350ea7){if(_0x420fa7[_0x3c7a('0x47')]['id']){delete _0x420fa7[_0x3c7a('0x47')]['id'];}return db[_0x3c7a('0x2a')][_0x3c7a('0x45')]({'where':{'id':_0x420fa7['params']['id']}})[_0x3c7a('0x22')](handleEntityNotFound(_0x350ea7,null))['then'](saveUpdates(_0x420fa7['body'],null))[_0x3c7a('0x22')](respondWithResult(_0x350ea7,null))[_0x3c7a('0x41')](handleError(_0x350ea7,null));};exports[_0x3c7a('0x23')]=function(_0x50b5e4,_0x5759a0){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x50b5e4[_0x3c7a('0x43')]['id']}})[_0x3c7a('0x22')](handleEntityNotFound(_0x5759a0,null))[_0x3c7a('0x22')](removeEntity(_0x5759a0,null))[_0x3c7a('0x41')](handleError(_0x5759a0,null));};exports[_0x3c7a('0x48')]=function(_0x11f7ee,_0x124411){return db[_0x3c7a('0x2a')][_0x3c7a('0x48')]()[_0x3c7a('0x22')](respondWithResult(_0x124411,null))[_0x3c7a('0x41')](handleError(_0x124411,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 0a5afc2..496b8ae 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 _0x5d01=['path','./jscriptyAnswerReport.attributes','exports','define','util','../../config/logger','api','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5d01,0xac));var _0x15d0=function(_0x35bcda,_0x44b482){_0x35bcda=_0x35bcda-0x0;var _0x2bf98d=_0x5d01[_0x35bcda];return _0x2bf98d;};'use strict';var _=require('lodash');var util=require(_0x15d0('0x0'));var logger=require(_0x15d0('0x1'))(_0x15d0('0x2'));var moment=require(_0x15d0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15d0('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x15d0('0x5'));module[_0x15d0('0x6')]=function(_0x16b4ac,_0xefd368){return _0x16b4ac[_0x15d0('0x7')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb2e=['JscriptyAnswerReport','report_jscripty_answers','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x57badd,_0x33bf97){var _0x440464=function(_0x1d302c){while(--_0x1d302c){_0x57badd['push'](_0x57badd['shift']());}};_0x440464(++_0x33bf97);}(_0xdb2e,0x9c));var _0xedb2=function(_0xa601a2,_0x47718e){_0xa601a2=_0xa601a2-0x0;var _0x54af8a=_0xdb2e[_0xa601a2];return _0x54af8a;};'use strict';var _=require('lodash');var util=require(_0xedb2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xedb2('0x1'));var BPromise=require(_0xedb2('0x2'));var rp=require(_0xedb2('0x3'));var fs=require('fs');var path=require(_0xedb2('0x4'));var rimraf=require(_0xedb2('0x5'));var config=require(_0xedb2('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xedb2('0x7')]=function(_0x567a2c,_0x1ec77f){return _0x567a2c[_0xedb2('0x8')](_0xedb2('0x9'),attributes,{'tableName':_0xedb2('0xa'),'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 7f69e4c..6e5965d 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 _0x0b68=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x402918,_0x54a4cc){var _0x3981a0=function(_0x10d4ff){while(--_0x10d4ff){_0x402918['push'](_0x402918['shift']());}};_0x3981a0(++_0x54a4cc);}(_0x0b68,0x11e));var _0x80b6=function(_0x22c6ad,_0x4684cf){_0x22c6ad=_0x22c6ad-0x0;var _0x1bbea6=_0x0b68[_0x22c6ad];return _0x1bbea6;};'use strict';var _=require(_0x80b6('0x0'));var util=require('util');var moment=require(_0x80b6('0x1'));var BPromise=require(_0x80b6('0x2'));var rs=require(_0x80b6('0x3'));var fs=require('fs');var Redis=require(_0x80b6('0x4'));var db=require(_0x80b6('0x5'))['db'];var utils=require(_0x80b6('0x6'));var logger=require(_0x80b6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x80b6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f15b0,_0x2f3f52,_0x516408){return new BPromise(function(_0x575ce3,_0x52f8ad){return client[_0x80b6('0x9')](_0x3f15b0,_0x516408)[_0x80b6('0xa')](function(_0xeec20d){logger[_0x80b6('0xb')](_0x80b6('0xc'),_0x2f3f52,_0x80b6('0xd'));logger[_0x80b6('0xe')](_0x80b6('0xf'),_0x2f3f52,_0x80b6('0xd'),JSON[_0x80b6('0x10')](_0xeec20d));if(_0xeec20d['error']){if(_0xeec20d['error'][_0x80b6('0x11')]===0x1f4){logger[_0x80b6('0x12')](_0x80b6('0xc'),_0x2f3f52,_0xeec20d[_0x80b6('0x12')]['message']);return _0x52f8ad(_0xeec20d[_0x80b6('0x12')][_0x80b6('0x13')]);}logger[_0x80b6('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2f3f52,_0xeec20d['error']['message']);return _0x575ce3(_0xeec20d['error'][_0x80b6('0x13')]);}else{logger[_0x80b6('0xb')](_0x80b6('0xc'),_0x2f3f52,_0x80b6('0xd'));_0x575ce3(_0xeec20d[_0x80b6('0x14')][_0x80b6('0x13')]);}})[_0x80b6('0x15')](function(_0x5440ff){logger[_0x80b6('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2f3f52,_0x5440ff);_0x52f8ad(_0x5440ff);});});} \ No newline at end of file +var _0x22f4=['request','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1b7d4c,_0x3ef822){var _0xaf9bc6=function(_0xb3ea5d){while(--_0xb3ea5d){_0x1b7d4c['push'](_0x1b7d4c['shift']());}};_0xaf9bc6(++_0x3ef822);}(_0x22f4,0x12c));var _0x422f=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0x22f4[_0x389832];return _0x59429e;};'use strict';var _=require(_0x422f('0x0'));var util=require(_0x422f('0x1'));var moment=require(_0x422f('0x2'));var BPromise=require(_0x422f('0x3'));var rs=require(_0x422f('0x4'));var fs=require('fs');var Redis=require(_0x422f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x422f('0x6'));var logger=require('../../config/logger')(_0x422f('0x7'));var config=require(_0x422f('0x8'));var jayson=require(_0x422f('0x9'));var client=jayson[_0x422f('0xa')][_0x422f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2031c8,_0x841fa,_0x149973){return new BPromise(function(_0x4bd343,_0x3ae4ad){return client[_0x422f('0xc')](_0x2031c8,_0x149973)[_0x422f('0xd')](function(_0x1621f2){logger[_0x422f('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x841fa,_0x422f('0xf'));logger[_0x422f('0x10')](_0x422f('0x11'),_0x841fa,_0x422f('0xf'),JSON[_0x422f('0x12')](_0x1621f2));if(_0x1621f2[_0x422f('0x13')]){if(_0x1621f2[_0x422f('0x13')]['code']===0x1f4){logger[_0x422f('0x13')](_0x422f('0x14'),_0x841fa,_0x1621f2['error'][_0x422f('0x15')]);return _0x3ae4ad(_0x1621f2['error'][_0x422f('0x15')]);}logger[_0x422f('0x13')](_0x422f('0x14'),_0x841fa,_0x1621f2[_0x422f('0x13')][_0x422f('0x15')]);return _0x4bd343(_0x1621f2[_0x422f('0x13')][_0x422f('0x15')]);}else{logger['info'](_0x422f('0x14'),_0x841fa,_0x422f('0xf'));_0x4bd343(_0x1621f2[_0x422f('0x16')][_0x422f('0x15')]);}})[_0x422f('0x17')](function(_0x4bf603){logger['error'](_0x422f('0x14'),_0x841fa,_0x4bf603);_0x3ae4ad(_0x4bf603);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 8d89840..5529650 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 _0x7887=['destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/answers','getAnswers','30s','getSummary','post','/:id/clone','put','update','delete'];(function(_0x3f2a5d,_0x5cb200){var _0x3e29e0=function(_0x465038){while(--_0x465038){_0x3f2a5d['push'](_0x3f2a5d['shift']());}};_0x3e29e0(++_0x5cb200);}(_0x7887,0x116));var _0x7788=function(_0xd8ea6e,_0x37edaa){_0xd8ea6e=_0xd8ea6e-0x0;var _0x2f946c=_0x7887[_0xd8ea6e];return _0x2f946c;};'use strict';var multer=require(_0x7788('0x0'));var util=require(_0x7788('0x1'));var path=require(_0x7788('0x2'));var timeout=require('connect-timeout');var express=require(_0x7788('0x3'));var router=express['Router']();var fs_extra=require(_0x7788('0x4'));var auth=require(_0x7788('0x5'));var interaction=require(_0x7788('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router[_0x7788('0x7')]('/',auth[_0x7788('0x8')](),controller[_0x7788('0x9')]);router[_0x7788('0x7')](_0x7788('0xa'),auth[_0x7788('0x8')](),controller[_0x7788('0xb')]);router['get']('/:id/sessions',auth[_0x7788('0x8')](),controller['getSessions']);router[_0x7788('0x7')](_0x7788('0xc'),auth[_0x7788('0x8')](),controller[_0x7788('0xd')]);router[_0x7788('0x7')]('/:id/summary',auth[_0x7788('0x8')](),timeout(_0x7788('0xe')),controller[_0x7788('0xf')]);router[_0x7788('0x10')]('/',auth[_0x7788('0x8')](),controller['create']);router[_0x7788('0x10')](_0x7788('0x11'),auth[_0x7788('0x8')](),controller['clone']);router[_0x7788('0x12')](_0x7788('0xa'),auth[_0x7788('0x8')](),controller[_0x7788('0x13')]);router[_0x7788('0x14')](_0x7788('0xa'),auth[_0x7788('0x8')](),controller[_0x7788('0x15')]);module[_0x7788('0x16')]=router; \ No newline at end of file +var _0x242b=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x4c14a3,_0x1e0a7f){var _0x1e0eae=function(_0x476c3b){while(--_0x476c3b){_0x4c14a3['push'](_0x4c14a3['shift']());}};_0x1e0eae(++_0x1e0a7f);}(_0x242b,0x159));var _0xb242=function(_0x5a9247,_0x59f465){_0x5a9247=_0x5a9247-0x0;var _0x335ada=_0x242b[_0x5a9247];return _0x335ada;};'use strict';var multer=require(_0xb242('0x0'));var util=require(_0xb242('0x1'));var path=require(_0xb242('0x2'));var timeout=require(_0xb242('0x3'));var express=require(_0xb242('0x4'));var router=express[_0xb242('0x5')]();var fs_extra=require(_0xb242('0x6'));var auth=require(_0xb242('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb242('0x8'));var controller=require('./jscriptyProject.controller');router[_0xb242('0x9')]('/',auth[_0xb242('0xa')](),controller['index']);router[_0xb242('0x9')]('/:id',auth[_0xb242('0xa')](),controller[_0xb242('0xb')]);router[_0xb242('0x9')](_0xb242('0xc'),auth[_0xb242('0xa')](),controller[_0xb242('0xd')]);router['get'](_0xb242('0xe'),auth[_0xb242('0xa')](),controller[_0xb242('0xf')]);router[_0xb242('0x9')](_0xb242('0x10'),auth[_0xb242('0xa')](),timeout(_0xb242('0x11')),controller[_0xb242('0x12')]);router[_0xb242('0x13')]('/',auth[_0xb242('0xa')](),controller[_0xb242('0x14')]);router['post'](_0xb242('0x15'),auth[_0xb242('0xa')](),controller[_0xb242('0x16')]);router['put']('/:id',auth[_0xb242('0xa')](),controller[_0xb242('0x17')]);router[_0xb242('0x18')](_0xb242('0x19'),auth[_0xb242('0xa')](),controller[_0xb242('0x1a')]);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 2df793f..8d2dc4a 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 _0x539c=['getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x447d04,_0x17d2ce){var _0x36a9e7=function(_0x49aa85){while(--_0x49aa85){_0x447d04['push'](_0x447d04['shift']());}};_0x36a9e7(++_0x17d2ce);}(_0x539c,0x1f0));var _0xc539=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x539c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc539('0x0'));var _=require(_0xc539('0x1'));var util=require(_0xc539('0x2'));module[_0xc539('0x3')]={'name':{'type':Sequelize[_0xc539('0x4')],'unique':_0xc539('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xc539('0x6')),'set':function(_0x5e1c19){if(_[_0xc539('0x7')](_0x5e1c19)){this[_0xc539('0x8')](_0xc539('0x9'),JSON[_0xc539('0xa')](_0x5e1c19));}else if(_[_0xc539('0xb')](_0x5e1c19)){this[_0xc539('0x8')]('formData',_0x5e1c19);}else{this[_0xc539('0x8')]('formData',util[_0xc539('0xc')](_0xc539('0xd'),this['getDataValue'](_0xc539('0x5'))||'',this[_0xc539('0xe')](_0xc539('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xc539('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xc539('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x8d99=['formData','stringify','isString','format','getDataValue','name','description','BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','long','isObjectLike','setDataValue'];(function(_0x3df777,_0x5b2469){var _0x2b9842=function(_0x24b60a){while(--_0x24b60a){_0x3df777['push'](_0x3df777['shift']());}};_0x2b9842(++_0x5b2469);}(_0x8d99,0x1b1));var _0x98d9=function(_0xb4f4f3,_0x387dad){_0xb4f4f3=_0xb4f4f3-0x0;var _0x58e501=_0x8d99[_0xb4f4f3];return _0x58e501;};'use strict';var Sequelize=require(_0x98d9('0x0'));var _=require(_0x98d9('0x1'));var util=require(_0x98d9('0x2'));module[_0x98d9('0x3')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x98d9('0x4')]},'formData':{'type':Sequelize[_0x98d9('0x5')](_0x98d9('0x6')),'set':function(_0x417a1d){if(_[_0x98d9('0x7')](_0x417a1d)){this[_0x98d9('0x8')](_0x98d9('0x9'),JSON[_0x98d9('0xa')](_0x417a1d));}else if(_[_0x98d9('0xb')](_0x417a1d)){this[_0x98d9('0x8')](_0x98d9('0x9'),_0x417a1d);}else{this[_0x98d9('0x8')](_0x98d9('0x9'),util[_0x98d9('0xc')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x98d9('0xd')](_0x98d9('0xe'))||'',this[_0x98d9('0xd')](_0x98d9('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x98d9('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x98d9('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index e4f6af5..8a820cb 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 _0x0833=['fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','get','role','user','Projects','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','autoAssociation','getSessions','findOne','pick','ProjectId','JscriptySessionReport','JscriptyAnswerReport','rows','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','text/csv','download','eml-format','rimraf','zip-dir'];(function(_0x20d123,_0x3a3b28){var _0x55daa6=function(_0x3e69d1){while(--_0x3e69d1){_0x20d123['push'](_0x20d123['shift']());}};_0x55daa6(++_0x3a3b28);}(_0x0833,0x1bd));var _0x3083=function(_0x52a6aa,_0x58ee13){_0x52a6aa=_0x52a6aa-0x0;var _0x5aead2=_0x0833[_0x52a6aa];return _0x5aead2;};'use strict';var emlformat=require(_0x3083('0x0'));var rimraf=require(_0x3083('0x1'));var zipdir=require(_0x3083('0x2'));var jsonpatch=require(_0x3083('0x3'));var rp=require(_0x3083('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3083('0x5'));var path=require('path');var sox=require(_0x3083('0x6'));var csv=require(_0x3083('0x7'));var ejs=require(_0x3083('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3083('0x9'));var squel=require(_0x3083('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3083('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3083('0xb'));var authService=require(_0x3083('0xc'));var qs=require(_0x3083('0xd'));var as=require(_0x3083('0xe'));var hardwareService=require(_0x3083('0xf'));var logger=require(_0x3083('0x10'))(_0x3083('0x11'));var utils=require(_0x3083('0x12'));var config=require(_0x3083('0x13'));var licenseUtil=require(_0x3083('0x14'));var db=require(_0x3083('0x15'))['db'];function respondWithStatusCode(_0x4960f9,_0x126765){_0x126765=_0x126765||0xcc;return function(_0x2dc6ab){if(_0x2dc6ab){return _0x4960f9[_0x3083('0x16')](_0x126765);}return _0x4960f9['status'](_0x126765)[_0x3083('0x17')]();};}function respondWithResult(_0x2a8cd0,_0x5f39e3){_0x5f39e3=_0x5f39e3||0xc8;return function(_0x203aad){if(_0x203aad){return _0x2a8cd0[_0x3083('0x18')](_0x5f39e3)['json'](_0x203aad);}};}function respondWithFilteredResult(_0x293ca0,_0x20cc31){return function(_0x1b6955){if(_0x1b6955){var _0x143cac=typeof _0x20cc31[_0x3083('0x19')]===_0x3083('0x1a')&&typeof _0x20cc31[_0x3083('0x1b')]==='undefined';var _0x5c23ea=_0x1b6955['count'];var _0x424c59=_0x143cac?0x0:_0x20cc31['offset'];var _0x3bbfe3=_0x143cac?_0x1b6955[_0x3083('0x1c')]:_0x20cc31[_0x3083('0x19')]+_0x20cc31[_0x3083('0x1b')];var _0x3bc7f0;if(_0x3bbfe3>=_0x5c23ea){_0x3bbfe3=_0x5c23ea;_0x3bc7f0=0xc8;}else{_0x3bc7f0=0xce;}_0x293ca0[_0x3083('0x18')](_0x3bc7f0);return _0x293ca0[_0x3083('0x1d')](_0x3083('0x1e'),_0x424c59+'-'+_0x3bbfe3+'/'+_0x5c23ea)[_0x3083('0x1f')](_0x1b6955);}return null;};}function patchUpdates(_0x164988){return function(_0x3d9d42){try{jsonpatch[_0x3083('0x20')](_0x3d9d42,_0x164988,!![]);}catch(_0x9a4aed){return BPromise[_0x3083('0x21')](_0x9a4aed);}return _0x3d9d42['save']();};}function saveUpdates(_0x4c2a0b,_0x4dc9ad){return function(_0x4dbe6b){if(_0x4dbe6b){return _0x4dbe6b[_0x3083('0x22')](_0x4c2a0b)[_0x3083('0x23')](function(_0x3e4f5a){return _0x3e4f5a;});}return null;};}function removeEntity(_0x3187f3,_0x1767d4){return function(_0x4170ab){if(_0x4170ab){return _0x4170ab[_0x3083('0x24')]()[_0x3083('0x23')](function(){var _0x4501b2=_0x4170ab['get']({'plain':!![]});var _0x3b11d1='Projects';return db['UserProfileResource'][_0x3083('0x24')]({'where':{'type':_0x3b11d1,'resourceId':_0x4501b2['id']}})[_0x3083('0x23')](function(){return _0x4170ab;});})[_0x3083('0x23')](function(){_0x3187f3[_0x3083('0x18')](0xcc)[_0x3083('0x17')]();});}};}function handleEntityNotFound(_0x27eb38,_0x5369f4){return function(_0xd38b35){if(!_0xd38b35){_0x27eb38[_0x3083('0x16')](0x194);}return _0xd38b35;};}function handleError(_0x1d8600,_0xe59325){_0xe59325=_0xe59325||0x1f4;return function(_0x52d4c7){logger[_0x3083('0x25')](_0x52d4c7['stack']);if(_0x52d4c7['name']){delete _0x52d4c7[_0x3083('0x26')];}_0x1d8600[_0x3083('0x18')](_0xe59325)[_0x3083('0x27')](_0x52d4c7);};}exports['index']=function(_0x1a8b75,_0x235c09){var _0x153aac={},_0x470805={},_0x3e9150={'count':0x0,'rows':[]};var _0x29146b=_[_0x3083('0x28')](db[_0x3083('0x29')][_0x3083('0x2a')],function(_0x328d8f){return{'name':_0x328d8f[_0x3083('0x2b')],'type':_0x328d8f[_0x3083('0x2c')][_0x3083('0x2d')]};});_0x470805[_0x3083('0x2e')]=_[_0x3083('0x28')](_0x29146b,_0x3083('0x26'));_0x470805[_0x3083('0x2f')]=_[_0x3083('0x30')](_0x1a8b75[_0x3083('0x2f')]);_0x470805[_0x3083('0x31')]=_['intersection'](_0x470805[_0x3083('0x2e')],_0x470805[_0x3083('0x2f')]);_0x153aac['attributes']=_[_0x3083('0x32')](_0x470805[_0x3083('0x2e')],qs['fields'](_0x1a8b75['query'][_0x3083('0x33')]));_0x153aac[_0x3083('0x34')]=_0x153aac[_0x3083('0x34')][_0x3083('0x35')]?_0x153aac['attributes']:_0x470805['model'];if(!_0x1a8b75[_0x3083('0x2f')][_0x3083('0x36')](_0x3083('0x37'))){_0x153aac['limit']=qs[_0x3083('0x1b')](_0x1a8b75[_0x3083('0x2f')][_0x3083('0x1b')]);_0x153aac[_0x3083('0x19')]=qs[_0x3083('0x19')](_0x1a8b75['query']['offset']);}_0x153aac[_0x3083('0x38')]=qs['sort'](_0x1a8b75[_0x3083('0x2f')][_0x3083('0x39')]);_0x153aac[_0x3083('0x3a')]=qs[_0x3083('0x31')](_['pick'](_0x1a8b75[_0x3083('0x2f')],_0x470805[_0x3083('0x31')]),_0x29146b);if(_0x1a8b75[_0x3083('0x2f')]['filter']){_0x153aac[_0x3083('0x3a')]=_['merge'](_0x153aac[_0x3083('0x3a')],{'$or':_[_0x3083('0x28')](_0x29146b,function(_0x357d73){if(_0x357d73[_0x3083('0x2c')]!=='VIRTUAL'){var _0x10380f={};_0x10380f[_0x357d73['name']]={'$like':'%'+_0x1a8b75[_0x3083('0x2f')][_0x3083('0x3b')]+'%'};return _0x10380f;}})});}_0x153aac=_[_0x3083('0x3c')]({},_0x153aac,_0x1a8b75[_0x3083('0x3d')]);var _0x4597e5={'where':_0x153aac['where']};return db[_0x3083('0x29')][_0x3083('0x1c')](_0x4597e5)[_0x3083('0x23')](function(_0x460604){_0x3e9150[_0x3083('0x1c')]=_0x460604;if(_0x1a8b75[_0x3083('0x2f')][_0x3083('0x3e')]){_0x153aac[_0x3083('0x3f')]=[{'all':!![]}];}return db[_0x3083('0x29')][_0x3083('0x40')](_0x153aac);})['then'](function(_0x406d89){_0x3e9150['rows']=_0x406d89;return _0x3e9150;})['then'](respondWithFilteredResult(_0x235c09,_0x153aac))[_0x3083('0x41')](handleError(_0x235c09,null));};exports[_0x3083('0x42')]=function(_0x19b17a,_0x56da70){var _0x318c0b={'raw':![],'where':{'id':_0x19b17a[_0x3083('0x43')]['id']}},_0xa4d89a={};_0xa4d89a['model']=_[_0x3083('0x30')](db['JscriptyProject'][_0x3083('0x2a')]);_0xa4d89a['query']=_[_0x3083('0x30')](_0x19b17a['query']);_0xa4d89a['filters']=_['intersection'](_0xa4d89a['model'],_0xa4d89a[_0x3083('0x2f')]);_0x318c0b[_0x3083('0x34')]=_[_0x3083('0x32')](_0xa4d89a[_0x3083('0x2e')],qs[_0x3083('0x33')](_0x19b17a[_0x3083('0x2f')][_0x3083('0x33')]));_0x318c0b[_0x3083('0x34')]=_0x318c0b[_0x3083('0x34')][_0x3083('0x35')]?_0x318c0b['attributes']:_0xa4d89a[_0x3083('0x2e')];if(_0x19b17a[_0x3083('0x2f')][_0x3083('0x3e')]){_0x318c0b[_0x3083('0x3f')]=[{'all':!![]}];}_0x318c0b=_['merge']({},_0x318c0b,_0x19b17a[_0x3083('0x3d')]);return db[_0x3083('0x29')][_0x3083('0x44')](_0x318c0b)[_0x3083('0x23')](handleEntityNotFound(_0x56da70,null))[_0x3083('0x23')](respondWithResult(_0x56da70,null))[_0x3083('0x41')](handleError(_0x56da70,null));};exports[_0x3083('0x45')]=function(_0x5cf5cd,_0x3af432){return db[_0x3083('0x29')][_0x3083('0x45')](_0x5cf5cd[_0x3083('0x46')],{})[_0x3083('0x23')](function(_0x340a86){var _0x5dbfd2=_0x5cf5cd['user'][_0x3083('0x47')]({'plain':!![]});if(!_0x5dbfd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5dbfd2[_0x3083('0x48')]===_0x3083('0x49')){var _0x1c4135=_0x340a86[_0x3083('0x47')]({'plain':!![]});var _0xbf78cf=_0x3083('0x4a');return db[_0x3083('0x4b')]['find']({'where':{'name':_0xbf78cf,'userProfileId':_0x5dbfd2[_0x3083('0x4c')]},'raw':!![]})[_0x3083('0x23')](function(_0x28e8e1){if(_0x28e8e1&&_0x28e8e1['autoAssociation']===0x0){return db[_0x3083('0x4d')]['create']({'name':_0x1c4135[_0x3083('0x26')],'resourceId':_0x1c4135['id'],'type':_0x28e8e1[_0x3083('0x26')],'sectionId':_0x28e8e1['id']},{})['then'](function(){return _0x340a86;});}else{return _0x340a86;}})[_0x3083('0x41')](function(_0x2182ef){logger[_0x3083('0x25')](_0x3083('0x4e'),_0x2182ef);throw _0x2182ef;});}return _0x340a86;})['then'](respondWithResult(_0x3af432,0xc9))['catch'](handleError(_0x3af432,null));};exports[_0x3083('0x4f')]=function(_0x70eaef,_0x22a51c){var _0x12b014={'where':{'id':_0x70eaef[_0x3083('0x43')]['id']}},_0x15e33e={};_0x15e33e[_0x3083('0x2e')]=_['keys'](db['JscriptyProject'][_0x3083('0x2a')]);_0x12b014[_0x3083('0x34')]=_['intersection'](_0x15e33e[_0x3083('0x2e')],qs[_0x3083('0x33')](_0x70eaef[_0x3083('0x2f')][_0x3083('0x33')]));_0x12b014[_0x3083('0x34')]=_0x12b014[_0x3083('0x34')]['length']?_0x12b014[_0x3083('0x34')]:_0x15e33e[_0x3083('0x2e')];if(_0x70eaef['query'][_0x3083('0x3e')]){_0x12b014['include']=[{'all':!![]}];}_0x12b014=_[_0x3083('0x3c')]({},_0x12b014,_0x70eaef['options']);return db['JscriptyProject']['find'](_0x12b014)[_0x3083('0x23')](handleEntityNotFound(_0x22a51c,null))[_0x3083('0x23')](function(_0x30fb2b){if(_0x30fb2b){var _0x953e2f=_0x30fb2b[_0x3083('0x47')]({'plain':!![]});_0x953e2f=qs[_0x3083('0x50')](_0x953e2f,['id','createdAt','updatedAt']);_0x70eaef[_0x3083('0x46')]=_['omit'](_0x70eaef[_0x3083('0x46')],['id',_0x3083('0x51'),_0x3083('0x52')]);return db[_0x3083('0x29')][_0x3083('0x45')](_[_0x3083('0x3c')](_0x953e2f,_0x70eaef[_0x3083('0x46')]),{'include':_0x70eaef['query']['includeAll']?[{'all':!![]}]:undefined})[_0x3083('0x23')](function(_0x10a5be){var _0x377406=_0x70eaef[_0x3083('0x49')][_0x3083('0x47')]({'plain':!![]});if(!_0x377406)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x377406[_0x3083('0x48')]===_0x3083('0x49')){var _0x4fb5cb=_0x10a5be[_0x3083('0x47')]({'plain':!![]});var _0x2c2bec=_0x3083('0x4a');return db[_0x3083('0x4b')][_0x3083('0x44')]({'where':{'name':_0x2c2bec,'userProfileId':_0x377406[_0x3083('0x4c')]},'raw':!![]})[_0x3083('0x23')](function(_0x21c832){if(_0x21c832&&_0x21c832[_0x3083('0x53')]===0x0){return db['UserProfileResource'][_0x3083('0x45')]({'name':_0x4fb5cb[_0x3083('0x26')],'resourceId':_0x4fb5cb['id'],'type':_0x21c832[_0x3083('0x26')],'sectionId':_0x21c832['id']},{})[_0x3083('0x23')](function(){return _0x10a5be;});}else{return _0x10a5be;}})[_0x3083('0x41')](function(_0x1615e8){logger[_0x3083('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1615e8);throw _0x1615e8;});}return _0x10a5be;});}})[_0x3083('0x23')](respondWithResult(_0x22a51c,0xc9))['catch'](handleError(_0x22a51c,null));};exports[_0x3083('0x22')]=function(_0x45e3ed,_0x3f4ca9){if(_0x45e3ed[_0x3083('0x46')]['id']){delete _0x45e3ed[_0x3083('0x46')]['id'];}return db['JscriptyProject'][_0x3083('0x44')]({'where':{'id':_0x45e3ed[_0x3083('0x43')]['id']}})[_0x3083('0x23')](handleEntityNotFound(_0x3f4ca9,null))['then'](saveUpdates(_0x45e3ed[_0x3083('0x46')],null))[_0x3083('0x23')](respondWithResult(_0x3f4ca9,null))[_0x3083('0x41')](handleError(_0x3f4ca9,null));};exports[_0x3083('0x24')]=function(_0x2af73d,_0x194d61){return db['JscriptyProject'][_0x3083('0x44')]({'where':{'id':_0x2af73d[_0x3083('0x43')]['id']}})[_0x3083('0x23')](handleEntityNotFound(_0x194d61,null))[_0x3083('0x23')](removeEntity(_0x194d61,null))['catch'](handleError(_0x194d61,null));};exports[_0x3083('0x54')]=function(_0x98e85d,_0xe8293a,_0x17f3f0){var _0x18c61e={'raw':!![],'where':{}};var _0x27cd38={};var _0x3b3d9b={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x3083('0x55')]({'where':{'id':_0x98e85d[_0x3083('0x43')]['id']}})['then'](handleEntityNotFound(_0xe8293a,null))[_0x3083('0x23')](function(_0x531124){if(_0x531124){_0x27cd38['model']=_[_0x3083('0x30')](db['JscriptySessionReport'][_0x3083('0x2a')]);_0x27cd38[_0x3083('0x2f')]=_[_0x3083('0x30')](_0x98e85d['query']);_0x27cd38['filters']=_[_0x3083('0x32')](_0x27cd38[_0x3083('0x2e')],_0x27cd38[_0x3083('0x2f')]);_0x18c61e[_0x3083('0x34')]=_['intersection'](_0x27cd38[_0x3083('0x2e')],qs[_0x3083('0x33')](_0x98e85d[_0x3083('0x2f')][_0x3083('0x33')]));_0x18c61e[_0x3083('0x34')]=_0x18c61e[_0x3083('0x34')][_0x3083('0x35')]?_0x18c61e[_0x3083('0x34')]:_0x27cd38['model'];if(!_0x98e85d[_0x3083('0x2f')][_0x3083('0x36')](_0x3083('0x37'))){_0x18c61e['limit']=qs[_0x3083('0x1b')](_0x98e85d[_0x3083('0x2f')]['limit']);_0x18c61e['offset']=qs[_0x3083('0x19')](_0x98e85d[_0x3083('0x2f')][_0x3083('0x19')]);}_0x18c61e['order']=qs[_0x3083('0x39')](_0x98e85d[_0x3083('0x2f')][_0x3083('0x39')]);_0x18c61e[_0x3083('0x3a')]=qs[_0x3083('0x31')](_[_0x3083('0x56')](_0x98e85d[_0x3083('0x2f')],_0x27cd38['filters']));_0x18c61e[_0x3083('0x3a')][_0x3083('0x57')]=_0x531124['id'];if(_0x98e85d[_0x3083('0x2f')][_0x3083('0x3b')]){_0x18c61e[_0x3083('0x3a')]=_[_0x3083('0x3c')](_0x18c61e['where'],{'$or':_[_0x3083('0x28')](_0x18c61e[_0x3083('0x34')],function(_0x41f8d2){var _0x68705d={};_0x68705d[_0x41f8d2]={'$like':'%'+_0x98e85d[_0x3083('0x2f')][_0x3083('0x3b')]+'%'};return _0x68705d;})});}_0x18c61e=_[_0x3083('0x3c')]({},_0x18c61e,_0x98e85d['options']);return db[_0x3083('0x58')][_0x3083('0x1c')]({'where':_0x18c61e[_0x3083('0x3a')]})[_0x3083('0x23')](function(_0x2406b0){_0x3b3d9b[_0x3083('0x1c')]=_0x2406b0;if(_0x98e85d[_0x3083('0x2f')]['includeAll']){_0x18c61e[_0x3083('0x3f')]=[{'all':!![]}];}return db[_0x3083('0x58')]['findAll'](_0x18c61e);})[_0x3083('0x23')](function(_0x5759bd){_0x3b3d9b['rows']=_0x5759bd;return _0x3b3d9b;});}})[_0x3083('0x23')](respondWithFilteredResult(_0xe8293a,_0x18c61e))['catch'](handleError(_0xe8293a,null));};exports['getAnswers']=function(_0x1472b2,_0x3c2d05,_0x47f9a4){var _0x5b56c5={'raw':!![],'where':{}};var _0x357db9={};var _0x3ec0f7={'count':0x0,'rows':[]};return db[_0x3083('0x29')]['findOne']({'where':{'id':_0x1472b2['params']['id']}})[_0x3083('0x23')](handleEntityNotFound(_0x3c2d05,null))[_0x3083('0x23')](function(_0x236267){if(_0x236267){_0x357db9[_0x3083('0x2e')]=_['keys'](db['JscriptyAnswerReport'][_0x3083('0x2a')]);_0x357db9[_0x3083('0x2f')]=_[_0x3083('0x30')](_0x1472b2[_0x3083('0x2f')]);_0x357db9['filters']=_[_0x3083('0x32')](_0x357db9[_0x3083('0x2e')],_0x357db9['query']);_0x5b56c5[_0x3083('0x34')]=_['intersection'](_0x357db9['model'],qs['fields'](_0x1472b2['query'][_0x3083('0x33')]));_0x5b56c5[_0x3083('0x34')]=_0x5b56c5[_0x3083('0x34')][_0x3083('0x35')]?_0x5b56c5[_0x3083('0x34')]:_0x357db9[_0x3083('0x2e')];if(!_0x1472b2[_0x3083('0x2f')]['hasOwnProperty'](_0x3083('0x37'))){_0x5b56c5[_0x3083('0x1b')]=qs[_0x3083('0x1b')](_0x1472b2[_0x3083('0x2f')][_0x3083('0x1b')]);_0x5b56c5[_0x3083('0x19')]=qs[_0x3083('0x19')](_0x1472b2[_0x3083('0x2f')][_0x3083('0x19')]);}_0x5b56c5[_0x3083('0x38')]=qs[_0x3083('0x39')](_0x1472b2[_0x3083('0x2f')]['sort']);_0x5b56c5[_0x3083('0x3a')]=qs[_0x3083('0x31')](_[_0x3083('0x56')](_0x1472b2[_0x3083('0x2f')],_0x357db9[_0x3083('0x31')]));_0x5b56c5[_0x3083('0x3a')][_0x3083('0x57')]=_0x236267['id'];if(_0x1472b2[_0x3083('0x2f')]['filter']){_0x5b56c5['where']=_[_0x3083('0x3c')](_0x5b56c5[_0x3083('0x3a')],{'$or':_[_0x3083('0x28')](_0x5b56c5['attributes'],function(_0x198544){var _0x4a4fe6={};_0x4a4fe6[_0x198544]={'$like':'%'+_0x1472b2[_0x3083('0x2f')][_0x3083('0x3b')]+'%'};return _0x4a4fe6;})});}_0x5b56c5=_[_0x3083('0x3c')]({},_0x5b56c5,_0x1472b2['options']);return db[_0x3083('0x59')]['count']({'where':_0x5b56c5[_0x3083('0x3a')]})['then'](function(_0x4a96db){_0x3ec0f7[_0x3083('0x1c')]=_0x4a96db;if(_0x1472b2[_0x3083('0x2f')]['includeAll']){_0x5b56c5[_0x3083('0x3f')]=[{'all':!![]}];}return db[_0x3083('0x59')]['findAll'](_0x5b56c5);})[_0x3083('0x23')](function(_0x1685bf){_0x3ec0f7[_0x3083('0x5a')]=_0x1685bf;return _0x3ec0f7;});}})['then'](respondWithFilteredResult(_0x3c2d05,_0x5b56c5))['catch'](handleError(_0x3c2d05,null));};function char(_0x157b6e){return _0x3083('0x5b')===typeof _0x157b6e?String[_0x3083('0x5c')][_0x3083('0x20')](null,arguments):_0x157b6e;}function needsEncapsulation(_0x14fb60){return!!_0x14fb60&&(_0x14fb60[_0x3083('0x5d')]()['indexOf'](char(0xd))>=0x0||_0x14fb60[_0x3083('0x5d')]()[_0x3083('0x5e')](char(0xa))>=0x0||_0x14fb60[_0x3083('0x5d')]()[_0x3083('0x5e')](char(0x2c))>=0x0||_0x14fb60['toString']()[_0x3083('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x259fa2){var _0x17478b=char(0x22),_0x279c12='\x5c'+char(0x22),_0x57e57d=_0x259fa2['toString']()[_0x3083('0x5f')](new RegExp(_0x17478b,'g'),_0x279c12);return _0x17478b+_0x57e57d+_0x17478b;}exports[_0x3083('0x60')]=function(_0x31664d,_0x4b359a,_0x59aa98){var _0x58ca6c,_0x14e089;var _0x2b77f5={'where':{'ProjectId':_0x31664d[_0x3083('0x43')]['id']}};if(_0x31664d[_0x3083('0x2f')][_0x3083('0x61')]){_0x2b77f5[_0x3083('0x3a')][_0x3083('0x62')]=JSON[_0x3083('0x63')](_0x31664d[_0x3083('0x2f')][_0x3083('0x61')]);}return db[_0x3083('0x58')][_0x3083('0x40')](_0x2b77f5)[_0x3083('0x23')](handleEntityNotFound(_0x4b359a,null))[_0x3083('0x23')](function(_0x7a139){if(_0x7a139){_0x58ca6c=_0x7a139;return db[_0x3083('0x64')][_0x3083('0x40')]({'where':{'SessionId':{'$in':_['map'](_0x58ca6c,'id')},'ProjectId':_0x31664d['params']['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x4b359a,null))['then'](function(_0x58c6a2){if(_0x58c6a2){_0x14e089=_0x58c6a2;var _0x471140={};for(var _0x26de07=0x0,_0xee0500=_0x14e089['length'];_0x26de07<_0xee0500;_0x26de07++){if(!_0x471140[_0x3083('0x36')](_0x14e089[_0x26de07][_0x3083('0x65')])){_0x471140[_0x14e089[_0x26de07][_0x3083('0x65')]]=needsEncapsulation(_0x14e089[_0x26de07][_0x3083('0x66')])?encapsulate(_0x14e089[_0x26de07]['question']):_0x14e089[_0x26de07][_0x3083('0x66')];}}var _0x48aa1f=[],_0x578ac4={};for(var _0x37644a=0x0,_0x44234d=_0x58ca6c[_0x3083('0x35')];_0x37644a<_0x44234d;_0x37644a++){_0x578ac4={'ProjectId':_0x31664d[_0x3083('0x43')]['id'],'SessionId':_0x58ca6c[_0x37644a]['id'],'StartTime':moment(_0x58ca6c[_0x37644a][_0x3083('0x62')])[_0x3083('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x1ff7ad=0x0,_0x3be762=_0x14e089[_0x3083('0x35')];_0x1ff7ad<_0x3be762;_0x1ff7ad++){if(_0x14e089[_0x1ff7ad]['SessionId']==_0x58ca6c[_0x37644a]['id']&&_0x471140['hasOwnProperty'](_0x14e089[_0x1ff7ad][_0x3083('0x65')])){_0x578ac4[_0x471140[_0x14e089[_0x1ff7ad][_0x3083('0x65')]]]=_0x14e089[_0x1ff7ad]['answer'];}}for(var _0x1a620c in _0x471140){if(!_0x578ac4[_0x3083('0x36')](_0x471140[_0x1a620c])){_0x578ac4[_0x471140[_0x1a620c]]=null;}}_0x48aa1f[_0x3083('0x68')](_0x578ac4);}return _0x48aa1f;}})[_0x3083('0x23')](function(_0x2ec99d){if(!_[_0x3083('0x69')](_0x2ec99d)){var _0x48d8a9=toCsv(_0x2ec99d);var _0x21489e=Date[_0x3083('0x6a')]();fs['writeFileSync'](util[_0x3083('0x67')](_0x3083('0x6b'),_0x31664d[_0x3083('0x43')]['id'],_0x21489e),_0x48d8a9);_0x4b359a[_0x3083('0x6c')]('Content-disposition',_0x3083('0x6d')+util[_0x3083('0x67')]('Jscripty_Project_%d_Summary_%s.csv',_0x31664d[_0x3083('0x43')]['id'],_0x21489e));_0x4b359a[_0x3083('0x6c')]('Content-type',_0x3083('0x6e'));return _0x4b359a[_0x3083('0x6f')](util[_0x3083('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x31664d[_0x3083('0x43')]['id'],_0x21489e));}else{return _0x4b359a[_0x3083('0x16')](0xcc);}})['catch'](handleError(_0x4b359a,null));}; \ No newline at end of file +var _0x99e7=['apply','reject','save','update','then','get','Projects','UserProfileResource','destroy','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','role','user','userProfileId','clone','createdAt','updatedAt','omit','body','UserProfileSection','autoAssociation','getSessions','JscriptySessionReport','getAnswers','findOne','JscriptyAnswerReport','ProjectId','number','toString','indexOf','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','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','limit','undefined','count','Content-Range'];(function(_0x366f5e,_0x563ea3){var _0x7755b=function(_0x140c88){while(--_0x140c88){_0x366f5e['push'](_0x366f5e['shift']());}};_0x7755b(++_0x563ea3);}(_0x99e7,0x1b5));var _0x799e=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0x99e7[_0x2307fa];return _0x496486;};'use strict';var emlformat=require(_0x799e('0x0'));var rimraf=require(_0x799e('0x1'));var zipdir=require(_0x799e('0x2'));var jsonpatch=require(_0x799e('0x3'));var rp=require(_0x799e('0x4'));var moment=require(_0x799e('0x5'));var BPromise=require(_0x799e('0x6'));var Mustache=require(_0x799e('0x7'));var util=require(_0x799e('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x799e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x799e('0xa'));var _=require('lodash');var squel=require(_0x799e('0xb'));var crypto=require(_0x799e('0xc'));var jsforce=require(_0x799e('0xd'));var deskjs=require(_0x799e('0xe'));var toCsv=require(_0x799e('0x9'));var querystring=require('querystring');var Papa=require(_0x799e('0xf'));var Redis=require(_0x799e('0x10'));var authService=require(_0x799e('0x11'));var qs=require(_0x799e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x799e('0x13'));var logger=require(_0x799e('0x14'))(_0x799e('0x15'));var utils=require(_0x799e('0x16'));var config=require(_0x799e('0x17'));var licenseUtil=require(_0x799e('0x18'));var db=require(_0x799e('0x19'))['db'];function respondWithStatusCode(_0x5238b8,_0x132d57){_0x132d57=_0x132d57||0xcc;return function(_0x1df95c){if(_0x1df95c){return _0x5238b8[_0x799e('0x1a')](_0x132d57);}return _0x5238b8[_0x799e('0x1b')](_0x132d57)[_0x799e('0x1c')]();};}function respondWithResult(_0x1ce347,_0x264b55){_0x264b55=_0x264b55||0xc8;return function(_0x2765e1){if(_0x2765e1){return _0x1ce347[_0x799e('0x1b')](_0x264b55)[_0x799e('0x1d')](_0x2765e1);}};}function respondWithFilteredResult(_0x5a2b6a,_0x5299a8){return function(_0x4267bc){if(_0x4267bc){var _0x41e5a5=typeof _0x5299a8[_0x799e('0x1e')]==='undefined'&&typeof _0x5299a8[_0x799e('0x1f')]===_0x799e('0x20');var _0x340fc6=_0x4267bc[_0x799e('0x21')];var _0x2a1692=_0x41e5a5?0x0:_0x5299a8['offset'];var _0x23cf81=_0x41e5a5?_0x4267bc[_0x799e('0x21')]:_0x5299a8[_0x799e('0x1e')]+_0x5299a8[_0x799e('0x1f')];var _0x4c41b8;if(_0x23cf81>=_0x340fc6){_0x23cf81=_0x340fc6;_0x4c41b8=0xc8;}else{_0x4c41b8=0xce;}_0x5a2b6a[_0x799e('0x1b')](_0x4c41b8);return _0x5a2b6a['set'](_0x799e('0x22'),_0x2a1692+'-'+_0x23cf81+'/'+_0x340fc6)[_0x799e('0x1d')](_0x4267bc);}return null;};}function patchUpdates(_0x42e195){return function(_0x2236aa){try{jsonpatch[_0x799e('0x23')](_0x2236aa,_0x42e195,!![]);}catch(_0x1b3b79){return BPromise[_0x799e('0x24')](_0x1b3b79);}return _0x2236aa[_0x799e('0x25')]();};}function saveUpdates(_0xdeb0ab,_0x11cc93){return function(_0x46375b){if(_0x46375b){return _0x46375b[_0x799e('0x26')](_0xdeb0ab)[_0x799e('0x27')](function(_0x5739e2){return _0x5739e2;});}return null;};}function removeEntity(_0x2c9820,_0x44b3ad){return function(_0x12b64e){if(_0x12b64e){return _0x12b64e['destroy']()['then'](function(){var _0x1255aa=_0x12b64e[_0x799e('0x28')]({'plain':!![]});var _0x441eb2=_0x799e('0x29');return db[_0x799e('0x2a')][_0x799e('0x2b')]({'where':{'type':_0x441eb2,'resourceId':_0x1255aa['id']}})[_0x799e('0x27')](function(){return _0x12b64e;});})[_0x799e('0x27')](function(){_0x2c9820[_0x799e('0x1b')](0xcc)[_0x799e('0x1c')]();});}};}function handleEntityNotFound(_0xde9d3c,_0x367be1){return function(_0x5eb10e){if(!_0x5eb10e){_0xde9d3c[_0x799e('0x1a')](0x194);}return _0x5eb10e;};}function handleError(_0x4b31d5,_0x159c41){_0x159c41=_0x159c41||0x1f4;return function(_0x2a5cf0){logger[_0x799e('0x2c')](_0x2a5cf0['stack']);if(_0x2a5cf0[_0x799e('0x2d')]){delete _0x2a5cf0[_0x799e('0x2d')];}_0x4b31d5[_0x799e('0x1b')](_0x159c41)[_0x799e('0x2e')](_0x2a5cf0);};}exports[_0x799e('0x2f')]=function(_0x2561ce,_0x12ee13){var _0x28ae7e={},_0x87d384={},_0x2ef906={'count':0x0,'rows':[]};var _0x20da53=_[_0x799e('0x30')](db[_0x799e('0x31')][_0x799e('0x32')],function(_0x292027){return{'name':_0x292027[_0x799e('0x33')],'type':_0x292027['type'][_0x799e('0x34')]};});_0x87d384[_0x799e('0x35')]=_[_0x799e('0x30')](_0x20da53,_0x799e('0x2d'));_0x87d384[_0x799e('0x36')]=_[_0x799e('0x37')](_0x2561ce[_0x799e('0x36')]);_0x87d384[_0x799e('0x38')]=_[_0x799e('0x39')](_0x87d384[_0x799e('0x35')],_0x87d384['query']);_0x28ae7e[_0x799e('0x3a')]=_['intersection'](_0x87d384[_0x799e('0x35')],qs[_0x799e('0x3b')](_0x2561ce[_0x799e('0x36')]['fields']));_0x28ae7e[_0x799e('0x3a')]=_0x28ae7e['attributes'][_0x799e('0x3c')]?_0x28ae7e['attributes']:_0x87d384[_0x799e('0x35')];if(!_0x2561ce['query'][_0x799e('0x3d')](_0x799e('0x3e'))){_0x28ae7e[_0x799e('0x1f')]=qs[_0x799e('0x1f')](_0x2561ce['query'][_0x799e('0x1f')]);_0x28ae7e[_0x799e('0x1e')]=qs[_0x799e('0x1e')](_0x2561ce[_0x799e('0x36')]['offset']);}_0x28ae7e[_0x799e('0x3f')]=qs['sort'](_0x2561ce['query'][_0x799e('0x40')]);_0x28ae7e[_0x799e('0x41')]=qs[_0x799e('0x38')](_[_0x799e('0x42')](_0x2561ce[_0x799e('0x36')],_0x87d384[_0x799e('0x38')]),_0x20da53);if(_0x2561ce[_0x799e('0x36')][_0x799e('0x43')]){_0x28ae7e['where']=_[_0x799e('0x44')](_0x28ae7e[_0x799e('0x41')],{'$or':_[_0x799e('0x30')](_0x20da53,function(_0x17fba7){if(_0x17fba7['type']!==_0x799e('0x45')){var _0x4cfb00={};_0x4cfb00[_0x17fba7['name']]={'$like':'%'+_0x2561ce[_0x799e('0x36')]['filter']+'%'};return _0x4cfb00;}})});}_0x28ae7e=_['merge']({},_0x28ae7e,_0x2561ce[_0x799e('0x46')]);var _0x4f5806={'where':_0x28ae7e[_0x799e('0x41')]};return db[_0x799e('0x31')][_0x799e('0x21')](_0x4f5806)['then'](function(_0x4c8d60){_0x2ef906['count']=_0x4c8d60;if(_0x2561ce[_0x799e('0x36')][_0x799e('0x47')]){_0x28ae7e[_0x799e('0x48')]=[{'all':!![]}];}return db[_0x799e('0x31')][_0x799e('0x49')](_0x28ae7e);})[_0x799e('0x27')](function(_0x29920d){_0x2ef906[_0x799e('0x4a')]=_0x29920d;return _0x2ef906;})[_0x799e('0x27')](respondWithFilteredResult(_0x12ee13,_0x28ae7e))[_0x799e('0x4b')](handleError(_0x12ee13,null));};exports[_0x799e('0x4c')]=function(_0xbb5e6d,_0x59dc7c){var _0x53c475={'raw':![],'where':{'id':_0xbb5e6d[_0x799e('0x4d')]['id']}},_0x56bee3={};_0x56bee3['model']=_[_0x799e('0x37')](db['JscriptyProject']['rawAttributes']);_0x56bee3[_0x799e('0x36')]=_[_0x799e('0x37')](_0xbb5e6d[_0x799e('0x36')]);_0x56bee3[_0x799e('0x38')]=_[_0x799e('0x39')](_0x56bee3[_0x799e('0x35')],_0x56bee3[_0x799e('0x36')]);_0x53c475[_0x799e('0x3a')]=_['intersection'](_0x56bee3[_0x799e('0x35')],qs[_0x799e('0x3b')](_0xbb5e6d[_0x799e('0x36')][_0x799e('0x3b')]));_0x53c475[_0x799e('0x3a')]=_0x53c475[_0x799e('0x3a')][_0x799e('0x3c')]?_0x53c475['attributes']:_0x56bee3[_0x799e('0x35')];if(_0xbb5e6d['query'][_0x799e('0x47')]){_0x53c475[_0x799e('0x48')]=[{'all':!![]}];}_0x53c475=_[_0x799e('0x44')]({},_0x53c475,_0xbb5e6d[_0x799e('0x46')]);return db[_0x799e('0x31')][_0x799e('0x4e')](_0x53c475)['then'](handleEntityNotFound(_0x59dc7c,null))[_0x799e('0x27')](respondWithResult(_0x59dc7c,null))[_0x799e('0x4b')](handleError(_0x59dc7c,null));};exports[_0x799e('0x4f')]=function(_0x4ce1a8,_0x4eea8c){return db[_0x799e('0x31')][_0x799e('0x4f')](_0x4ce1a8['body'],{})[_0x799e('0x27')](function(_0x31feec){var _0x46b368=_0x4ce1a8['user']['get']({'plain':!![]});if(!_0x46b368)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46b368[_0x799e('0x50')]===_0x799e('0x51')){var _0x134f6d=_0x31feec['get']({'plain':!![]});var _0x580f3c=_0x799e('0x29');return db['UserProfileSection'][_0x799e('0x4e')]({'where':{'name':_0x580f3c,'userProfileId':_0x46b368[_0x799e('0x52')]},'raw':!![]})[_0x799e('0x27')](function(_0x12be45){if(_0x12be45&&_0x12be45['autoAssociation']===0x0){return db[_0x799e('0x2a')]['create']({'name':_0x134f6d['name'],'resourceId':_0x134f6d['id'],'type':_0x12be45[_0x799e('0x2d')],'sectionId':_0x12be45['id']},{})['then'](function(){return _0x31feec;});}else{return _0x31feec;}})[_0x799e('0x4b')](function(_0x41fb99){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41fb99);throw _0x41fb99;});}return _0x31feec;})[_0x799e('0x27')](respondWithResult(_0x4eea8c,0xc9))[_0x799e('0x4b')](handleError(_0x4eea8c,null));};exports[_0x799e('0x53')]=function(_0xd09d38,_0x3d66b4){var _0x289823={'where':{'id':_0xd09d38[_0x799e('0x4d')]['id']}},_0x51870f={};_0x51870f[_0x799e('0x35')]=_['keys'](db[_0x799e('0x31')]['rawAttributes']);_0x289823[_0x799e('0x3a')]=_[_0x799e('0x39')](_0x51870f['model'],qs[_0x799e('0x3b')](_0xd09d38[_0x799e('0x36')][_0x799e('0x3b')]));_0x289823[_0x799e('0x3a')]=_0x289823[_0x799e('0x3a')][_0x799e('0x3c')]?_0x289823[_0x799e('0x3a')]:_0x51870f[_0x799e('0x35')];if(_0xd09d38[_0x799e('0x36')][_0x799e('0x47')]){_0x289823[_0x799e('0x48')]=[{'all':!![]}];}_0x289823=_[_0x799e('0x44')]({},_0x289823,_0xd09d38[_0x799e('0x46')]);return db[_0x799e('0x31')]['find'](_0x289823)['then'](handleEntityNotFound(_0x3d66b4,null))[_0x799e('0x27')](function(_0x27b9e9){if(_0x27b9e9){var _0x2ca0fe=_0x27b9e9[_0x799e('0x28')]({'plain':!![]});_0x2ca0fe=qs['omit'](_0x2ca0fe,['id',_0x799e('0x54'),_0x799e('0x55')]);_0xd09d38['body']=_[_0x799e('0x56')](_0xd09d38['body'],['id',_0x799e('0x54'),_0x799e('0x55')]);return db[_0x799e('0x31')]['create'](_[_0x799e('0x44')](_0x2ca0fe,_0xd09d38[_0x799e('0x57')]),{'include':_0xd09d38[_0x799e('0x36')][_0x799e('0x47')]?[{'all':!![]}]:undefined})[_0x799e('0x27')](function(_0x1b8c7c){var _0x90f3dd=_0xd09d38['user'][_0x799e('0x28')]({'plain':!![]});if(!_0x90f3dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x90f3dd['role']===_0x799e('0x51')){var _0x2be7c0=_0x1b8c7c[_0x799e('0x28')]({'plain':!![]});var _0x1b394c='Projects';return db[_0x799e('0x58')][_0x799e('0x4e')]({'where':{'name':_0x1b394c,'userProfileId':_0x90f3dd['userProfileId']},'raw':!![]})[_0x799e('0x27')](function(_0x588331){if(_0x588331&&_0x588331[_0x799e('0x59')]===0x0){return db[_0x799e('0x2a')][_0x799e('0x4f')]({'name':_0x2be7c0['name'],'resourceId':_0x2be7c0['id'],'type':_0x588331['name'],'sectionId':_0x588331['id']},{})[_0x799e('0x27')](function(){return _0x1b8c7c;});}else{return _0x1b8c7c;}})['catch'](function(_0x2cc1fc){logger[_0x799e('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cc1fc);throw _0x2cc1fc;});}return _0x1b8c7c;});}})['then'](respondWithResult(_0x3d66b4,0xc9))[_0x799e('0x4b')](handleError(_0x3d66b4,null));};exports[_0x799e('0x26')]=function(_0x26dc1f,_0x419a84){if(_0x26dc1f[_0x799e('0x57')]['id']){delete _0x26dc1f['body']['id'];}return db[_0x799e('0x31')][_0x799e('0x4e')]({'where':{'id':_0x26dc1f[_0x799e('0x4d')]['id']}})[_0x799e('0x27')](handleEntityNotFound(_0x419a84,null))[_0x799e('0x27')](saveUpdates(_0x26dc1f[_0x799e('0x57')],null))[_0x799e('0x27')](respondWithResult(_0x419a84,null))[_0x799e('0x4b')](handleError(_0x419a84,null));};exports[_0x799e('0x2b')]=function(_0x2f85c9,_0x302369){return db[_0x799e('0x31')][_0x799e('0x4e')]({'where':{'id':_0x2f85c9['params']['id']}})[_0x799e('0x27')](handleEntityNotFound(_0x302369,null))['then'](removeEntity(_0x302369,null))[_0x799e('0x4b')](handleError(_0x302369,null));};exports[_0x799e('0x5a')]=function(_0x428884,_0x4f2332,_0x502bde){var _0x1d4e7e={'raw':!![],'where':{}};var _0x2ee759={};var _0x5df793={'count':0x0,'rows':[]};return db[_0x799e('0x31')]['findOne']({'where':{'id':_0x428884[_0x799e('0x4d')]['id']}})[_0x799e('0x27')](handleEntityNotFound(_0x4f2332,null))[_0x799e('0x27')](function(_0x47ded8){if(_0x47ded8){_0x2ee759[_0x799e('0x35')]=_[_0x799e('0x37')](db[_0x799e('0x5b')][_0x799e('0x32')]);_0x2ee759[_0x799e('0x36')]=_['keys'](_0x428884['query']);_0x2ee759[_0x799e('0x38')]=_['intersection'](_0x2ee759[_0x799e('0x35')],_0x2ee759[_0x799e('0x36')]);_0x1d4e7e['attributes']=_[_0x799e('0x39')](_0x2ee759[_0x799e('0x35')],qs[_0x799e('0x3b')](_0x428884[_0x799e('0x36')][_0x799e('0x3b')]));_0x1d4e7e[_0x799e('0x3a')]=_0x1d4e7e[_0x799e('0x3a')][_0x799e('0x3c')]?_0x1d4e7e['attributes']:_0x2ee759[_0x799e('0x35')];if(!_0x428884['query'][_0x799e('0x3d')](_0x799e('0x3e'))){_0x1d4e7e[_0x799e('0x1f')]=qs['limit'](_0x428884[_0x799e('0x36')]['limit']);_0x1d4e7e[_0x799e('0x1e')]=qs[_0x799e('0x1e')](_0x428884[_0x799e('0x36')][_0x799e('0x1e')]);}_0x1d4e7e[_0x799e('0x3f')]=qs[_0x799e('0x40')](_0x428884['query'][_0x799e('0x40')]);_0x1d4e7e[_0x799e('0x41')]=qs[_0x799e('0x38')](_[_0x799e('0x42')](_0x428884[_0x799e('0x36')],_0x2ee759[_0x799e('0x38')]));_0x1d4e7e[_0x799e('0x41')]['ProjectId']=_0x47ded8['id'];if(_0x428884['query'][_0x799e('0x43')]){_0x1d4e7e[_0x799e('0x41')]=_[_0x799e('0x44')](_0x1d4e7e['where'],{'$or':_[_0x799e('0x30')](_0x1d4e7e[_0x799e('0x3a')],function(_0x8729f8){var _0x3fc860={};_0x3fc860[_0x8729f8]={'$like':'%'+_0x428884[_0x799e('0x36')]['filter']+'%'};return _0x3fc860;})});}_0x1d4e7e=_[_0x799e('0x44')]({},_0x1d4e7e,_0x428884[_0x799e('0x46')]);return db[_0x799e('0x5b')][_0x799e('0x21')]({'where':_0x1d4e7e[_0x799e('0x41')]})[_0x799e('0x27')](function(_0x208fea){_0x5df793[_0x799e('0x21')]=_0x208fea;if(_0x428884[_0x799e('0x36')][_0x799e('0x47')]){_0x1d4e7e[_0x799e('0x48')]=[{'all':!![]}];}return db[_0x799e('0x5b')][_0x799e('0x49')](_0x1d4e7e);})[_0x799e('0x27')](function(_0x2ad4da){_0x5df793[_0x799e('0x4a')]=_0x2ad4da;return _0x5df793;});}})['then'](respondWithFilteredResult(_0x4f2332,_0x1d4e7e))[_0x799e('0x4b')](handleError(_0x4f2332,null));};exports[_0x799e('0x5c')]=function(_0x14cf71,_0x50ce71,_0x26b9bd){var _0x3cba86={'raw':!![],'where':{}};var _0x4ae4f2={};var _0x23149f={'count':0x0,'rows':[]};return db[_0x799e('0x31')][_0x799e('0x5d')]({'where':{'id':_0x14cf71[_0x799e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x50ce71,null))['then'](function(_0x17c901){if(_0x17c901){_0x4ae4f2[_0x799e('0x35')]=_[_0x799e('0x37')](db[_0x799e('0x5e')]['rawAttributes']);_0x4ae4f2[_0x799e('0x36')]=_[_0x799e('0x37')](_0x14cf71[_0x799e('0x36')]);_0x4ae4f2['filters']=_[_0x799e('0x39')](_0x4ae4f2[_0x799e('0x35')],_0x4ae4f2['query']);_0x3cba86[_0x799e('0x3a')]=_[_0x799e('0x39')](_0x4ae4f2['model'],qs[_0x799e('0x3b')](_0x14cf71[_0x799e('0x36')][_0x799e('0x3b')]));_0x3cba86['attributes']=_0x3cba86['attributes']['length']?_0x3cba86[_0x799e('0x3a')]:_0x4ae4f2[_0x799e('0x35')];if(!_0x14cf71[_0x799e('0x36')]['hasOwnProperty']('nolimit')){_0x3cba86['limit']=qs[_0x799e('0x1f')](_0x14cf71[_0x799e('0x36')][_0x799e('0x1f')]);_0x3cba86['offset']=qs['offset'](_0x14cf71[_0x799e('0x36')]['offset']);}_0x3cba86['order']=qs['sort'](_0x14cf71['query'][_0x799e('0x40')]);_0x3cba86[_0x799e('0x41')]=qs[_0x799e('0x38')](_['pick'](_0x14cf71[_0x799e('0x36')],_0x4ae4f2['filters']));_0x3cba86[_0x799e('0x41')][_0x799e('0x5f')]=_0x17c901['id'];if(_0x14cf71[_0x799e('0x36')][_0x799e('0x43')]){_0x3cba86[_0x799e('0x41')]=_[_0x799e('0x44')](_0x3cba86[_0x799e('0x41')],{'$or':_[_0x799e('0x30')](_0x3cba86['attributes'],function(_0x2f3e59){var _0x5d43e3={};_0x5d43e3[_0x2f3e59]={'$like':'%'+_0x14cf71[_0x799e('0x36')][_0x799e('0x43')]+'%'};return _0x5d43e3;})});}_0x3cba86=_[_0x799e('0x44')]({},_0x3cba86,_0x14cf71[_0x799e('0x46')]);return db[_0x799e('0x5e')][_0x799e('0x21')]({'where':_0x3cba86[_0x799e('0x41')]})['then'](function(_0x3b9ddb){_0x23149f[_0x799e('0x21')]=_0x3b9ddb;if(_0x14cf71[_0x799e('0x36')][_0x799e('0x47')]){_0x3cba86[_0x799e('0x48')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x799e('0x49')](_0x3cba86);})['then'](function(_0x3f446c){_0x23149f[_0x799e('0x4a')]=_0x3f446c;return _0x23149f;});}})[_0x799e('0x27')](respondWithFilteredResult(_0x50ce71,_0x3cba86))['catch'](handleError(_0x50ce71,null));};function char(_0x34d4a8){return _0x799e('0x60')===typeof _0x34d4a8?String['fromCharCode'][_0x799e('0x23')](null,arguments):_0x34d4a8;}function needsEncapsulation(_0x7c7616){return!!_0x7c7616&&(_0x7c7616[_0x799e('0x61')]()[_0x799e('0x62')](char(0xd))>=0x0||_0x7c7616[_0x799e('0x61')]()[_0x799e('0x62')](char(0xa))>=0x0||_0x7c7616['toString']()[_0x799e('0x62')](char(0x2c))>=0x0||_0x7c7616[_0x799e('0x61')]()[_0x799e('0x62')](char(0x22))>=0x0);}function encapsulate(_0x269867){var _0x57fd80=char(0x22),_0xe78fbb='\x5c'+char(0x22),_0x431565=_0x269867[_0x799e('0x61')]()['replace'](new RegExp(_0x57fd80,'g'),_0xe78fbb);return _0x57fd80+_0x431565+_0x57fd80;}exports[_0x799e('0x63')]=function(_0x5cb5dc,_0x4aa3a0,_0x3cc40f){var _0x5966ed,_0x47af7f;var _0x19ab84={'where':{'ProjectId':_0x5cb5dc[_0x799e('0x4d')]['id']}};if(_0x5cb5dc['query']['startTime']){_0x19ab84['where'][_0x799e('0x64')]=JSON[_0x799e('0x65')](_0x5cb5dc[_0x799e('0x36')][_0x799e('0x66')]);}return db['JscriptySessionReport'][_0x799e('0x49')](_0x19ab84)[_0x799e('0x27')](handleEntityNotFound(_0x4aa3a0,null))[_0x799e('0x27')](function(_0x58487b){if(_0x58487b){_0x5966ed=_0x58487b;return db[_0x799e('0x67')]['findAll']({'where':{'SessionId':{'$in':_[_0x799e('0x30')](_0x5966ed,'id')},'ProjectId':_0x5cb5dc['params']['id']},'order':_0x799e('0x68')});}})[_0x799e('0x27')](handleEntityNotFound(_0x4aa3a0,null))[_0x799e('0x27')](function(_0x4d36d4){if(_0x4d36d4){_0x47af7f=_0x4d36d4;var _0x43f987={};for(var _0x5d1d99=0x0,_0x32dc86=_0x47af7f[_0x799e('0x3c')];_0x5d1d99<_0x32dc86;_0x5d1d99++){if(!_0x43f987[_0x799e('0x3d')](_0x47af7f[_0x5d1d99][_0x799e('0x69')])){_0x43f987[_0x47af7f[_0x5d1d99]['questionId']]=needsEncapsulation(_0x47af7f[_0x5d1d99][_0x799e('0x6a')])?encapsulate(_0x47af7f[_0x5d1d99][_0x799e('0x6a')]):_0x47af7f[_0x5d1d99][_0x799e('0x6a')];}}var _0xc0fe76=[],_0x584b6e={};for(var _0xef733d=0x0,_0x51b390=_0x5966ed[_0x799e('0x3c')];_0xef733d<_0x51b390;_0xef733d++){_0x584b6e={'ProjectId':_0x5cb5dc['params']['id'],'SessionId':_0x5966ed[_0xef733d]['id'],'StartTime':moment(_0x5966ed[_0xef733d]['starttime'])[_0x799e('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3f68a4=0x0,_0x16a8a2=_0x47af7f[_0x799e('0x3c')];_0x3f68a4<_0x16a8a2;_0x3f68a4++){if(_0x47af7f[_0x3f68a4][_0x799e('0x6c')]==_0x5966ed[_0xef733d]['id']&&_0x43f987[_0x799e('0x3d')](_0x47af7f[_0x3f68a4][_0x799e('0x69')])){_0x584b6e[_0x43f987[_0x47af7f[_0x3f68a4][_0x799e('0x69')]]]=_0x47af7f[_0x3f68a4][_0x799e('0x6d')];}}for(var _0x586e2f in _0x43f987){if(!_0x584b6e[_0x799e('0x3d')](_0x43f987[_0x586e2f])){_0x584b6e[_0x43f987[_0x586e2f]]=null;}}_0xc0fe76[_0x799e('0x6e')](_0x584b6e);}return _0xc0fe76;}})['then'](function(_0x3a465f){if(!_['isEmpty'](_0x3a465f)){var _0xb472ac=toCsv(_0x3a465f);var _0xabfd35=Date[_0x799e('0x6f')]();fs['writeFileSync'](util['format'](_0x799e('0x70'),_0x5cb5dc[_0x799e('0x4d')]['id'],_0xabfd35),_0xb472ac);_0x4aa3a0['setHeader'](_0x799e('0x71'),_0x799e('0x72')+util[_0x799e('0x6b')](_0x799e('0x73'),_0x5cb5dc[_0x799e('0x4d')]['id'],_0xabfd35));_0x4aa3a0['setHeader'](_0x799e('0x74'),'text/csv');return _0x4aa3a0[_0x799e('0x75')](util['format'](_0x799e('0x70'),_0x5cb5dc[_0x799e('0x4d')]['id'],_0xabfd35));}else{return _0x4aa3a0[_0x799e('0x1a')](0xcc);}})[_0x799e('0x4b')](handleError(_0x4aa3a0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index ebd9452..2fe6885 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 _0x7250=['rimraf','./jscriptyProject.attributes','JscriptyProject','jscripty_projects','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7250,0x1b1));var _0x0725=function(_0x34fd8a,_0x3a5514){_0x34fd8a=_0x34fd8a-0x0;var _0x375f8a=_0x7250[_0x34fd8a];return _0x375f8a;};'use strict';var _=require(_0x0725('0x0'));var util=require(_0x0725('0x1'));var logger=require('../../config/logger')(_0x0725('0x2'));var moment=require(_0x0725('0x3'));var BPromise=require(_0x0725('0x4'));var rp=require(_0x0725('0x5'));var fs=require('fs');var path=require(_0x0725('0x6'));var rimraf=require(_0x0725('0x7'));var config=require('../../config/environment');var attributes=require(_0x0725('0x8'));module['exports']=function(_0x4e8c6c,_0xa32c3f){return _0x4e8c6c['define'](_0x0725('0x9'),attributes,{'tableName':_0x0725('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6379=['exports','define','lodash','util','../../config/logger','api','moment','request-promise','path','./jscriptyProject.attributes'];(function(_0x140eea,_0x42bfd9){var _0x55470f=function(_0x57d124){while(--_0x57d124){_0x140eea['push'](_0x140eea['shift']());}};_0x55470f(++_0x42bfd9);}(_0x6379,0x84));var _0x9637=function(_0x3d0743,_0x2a211b){_0x3d0743=_0x3d0743-0x0;var _0x4d0697=_0x6379[_0x3d0743];return _0x4d0697;};'use strict';var _=require(_0x9637('0x0'));var util=require(_0x9637('0x1'));var logger=require(_0x9637('0x2'))(_0x9637('0x3'));var moment=require(_0x9637('0x4'));var BPromise=require('bluebird');var rp=require(_0x9637('0x5'));var fs=require('fs');var path=require(_0x9637('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9637('0x7'));module[_0x9637('0x8')]=function(_0x19f7d0,_0x25087c){return _0x19f7d0[_0x9637('0x9')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','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 5adbc9f..f8605f7 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x1737fb,_0x355cff){var _0x4150af=function(_0x7ea450){while(--_0x7ea450){_0x1737fb['push'](_0x1737fb['shift']());}};_0x4150af(++_0x355cff);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2b6b92,_0x57303d){var _0x2233dc=function(_0x310e88){while(--_0x310e88){_0x2b6b92['push'](_0x2b6b92['shift']());}};_0x2233dc(++_0x57303d);}(_0xaa88,0x137));var _0x8aa8=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0xaa88[_0x277fa3];return _0x2e4520;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index ab790d6..def1529 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 _0xdada=['show','post','create','put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x7f26b,_0x95495a){var _0x2ad131=function(_0x3e2be2){while(--_0x3e2be2){_0x7f26b['push'](_0x7f26b['shift']());}};_0x2ad131(++_0x95495a);}(_0xdada,0x93));var _0xadad=function(_0x3cdc5c,_0x44e0b0){_0x3cdc5c=_0x3cdc5c-0x0;var _0xb87b20=_0xdada[_0x3cdc5c];return _0xb87b20;};'use strict';var multer=require(_0xadad('0x0'));var util=require(_0xadad('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xadad('0x2'));var router=express[_0xadad('0x3')]();var fs_extra=require(_0xadad('0x4'));var auth=require(_0xadad('0x5'));var interaction=require(_0xadad('0x6'));var config=require('../../config/environment');var controller=require(_0xadad('0x7'));router['get']('/',auth[_0xadad('0x8')](),controller[_0xadad('0x9')]);router[_0xadad('0xa')]('/describe',auth[_0xadad('0x8')](),controller[_0xadad('0xb')]);router[_0xadad('0xa')](_0xadad('0xc'),auth['isAuthenticated'](),controller[_0xadad('0xd')]);router[_0xadad('0xe')]('/',auth[_0xadad('0x8')](),controller[_0xadad('0xf')]);router[_0xadad('0x10')](_0xadad('0xc'),auth[_0xadad('0x8')](),controller[_0xadad('0x11')]);router['delete'](_0xadad('0xc'),auth[_0xadad('0x8')](),controller[_0xadad('0x12')]);module[_0xadad('0x13')]=router; \ No newline at end of file +var _0xb185=['/:id','create','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x1a383f,_0x4cbb1b){var _0x2a5afd=function(_0x4be02d){while(--_0x4be02d){_0x1a383f['push'](_0x1a383f['shift']());}};_0x2a5afd(++_0x4cbb1b);}(_0xb185,0x8d));var _0x5b18=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xb185[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0x5b18('0x0'));var util=require(_0x5b18('0x1'));var path=require('path');var timeout=require(_0x5b18('0x2'));var express=require(_0x5b18('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5b18('0x4'));var interaction=require(_0x5b18('0x5'));var config=require(_0x5b18('0x6'));var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x5b18('0x7')](),controller[_0x5b18('0x8')]);router[_0x5b18('0x9')](_0x5b18('0xa'),auth['isAuthenticated'](),controller[_0x5b18('0xb')]);router[_0x5b18('0x9')](_0x5b18('0xc'),auth[_0x5b18('0x7')](),controller['show']);router['post']('/',auth[_0x5b18('0x7')](),controller[_0x5b18('0xd')]);router['put'](_0x5b18('0xc'),auth[_0x5b18('0x7')](),controller[_0x5b18('0xe')]);router[_0x5b18('0xf')](_0x5b18('0xc'),auth['isAuthenticated'](),controller[_0x5b18('0x10')]);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 02f7a6b..61fb6de 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(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7a54,0x106));var _0x47a5=function(_0x3a312d,_0x3b23d0){_0x3a312d=_0x3a312d-0x0;var _0x511feb=_0x7a54[_0x3a312d];return _0x511feb;};'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(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x7a54,0x106));var _0x47a5=function(_0x10b2e7,_0x382517){_0x10b2e7=_0x10b2e7-0x0;var _0x2281a8=_0x7a54[_0x10b2e7];return _0x2281a8;};'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 27c4e7a..d926157 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 _0x0ad2=['fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x1aee6e,_0x44c549){var _0x1941fe=function(_0x2dd2de){while(--_0x2dd2de){_0x1aee6e['push'](_0x1aee6e['shift']());}};_0x1941fe(++_0x44c549);}(_0x0ad2,0x131));var _0x20ad=function(_0x5856ba,_0x3ceebb){_0x5856ba=_0x5856ba-0x0;var _0x170028=_0x0ad2[_0x5856ba];return _0x170028;};'use strict';var emlformat=require(_0x20ad('0x0'));var rimraf=require(_0x20ad('0x1'));var zipdir=require(_0x20ad('0x2'));var jsonpatch=require(_0x20ad('0x3'));var rp=require(_0x20ad('0x4'));var moment=require(_0x20ad('0x5'));var BPromise=require(_0x20ad('0x6'));var Mustache=require('mustache');var util=require(_0x20ad('0x7'));var path=require(_0x20ad('0x8'));var sox=require(_0x20ad('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x20ad('0xa'));var _=require(_0x20ad('0xb'));var squel=require(_0x20ad('0xc'));var crypto=require(_0x20ad('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x20ad('0xe'));var querystring=require(_0x20ad('0xf'));var Papa=require(_0x20ad('0x10'));var Redis=require(_0x20ad('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x20ad('0x12'));var hardwareService=require(_0x20ad('0x13'));var logger=require('../../config/logger')(_0x20ad('0x14'));var utils=require(_0x20ad('0x15'));var config=require(_0x20ad('0x16'));var licenseUtil=require(_0x20ad('0x17'));var db=require(_0x20ad('0x18'))['db'];function respondWithStatusCode(_0xe909f2,_0xaaaac8){_0xaaaac8=_0xaaaac8||0xcc;return function(_0x441f3d){if(_0x441f3d){return _0xe909f2[_0x20ad('0x19')](_0xaaaac8);}return _0xe909f2[_0x20ad('0x1a')](_0xaaaac8)[_0x20ad('0x1b')]();};}function respondWithResult(_0x14ac03,_0x321447){_0x321447=_0x321447||0xc8;return function(_0x3f5ff0){if(_0x3f5ff0){return _0x14ac03[_0x20ad('0x1a')](_0x321447)[_0x20ad('0x1c')](_0x3f5ff0);}};}function respondWithFilteredResult(_0x483e4c,_0x13bb8b){return function(_0x1bbcc8){if(_0x1bbcc8){var _0x5394c9=typeof _0x13bb8b[_0x20ad('0x1d')]===_0x20ad('0x1e')&&typeof _0x13bb8b['limit']==='undefined';var _0x3c8543=_0x1bbcc8[_0x20ad('0x1f')];var _0x4d593a=_0x5394c9?0x0:_0x13bb8b[_0x20ad('0x1d')];var _0x3746d2=_0x5394c9?_0x1bbcc8['count']:_0x13bb8b[_0x20ad('0x1d')]+_0x13bb8b[_0x20ad('0x20')];var _0x320b3a;if(_0x3746d2>=_0x3c8543){_0x3746d2=_0x3c8543;_0x320b3a=0xc8;}else{_0x320b3a=0xce;}_0x483e4c[_0x20ad('0x1a')](_0x320b3a);return _0x483e4c[_0x20ad('0x21')](_0x20ad('0x22'),_0x4d593a+'-'+_0x3746d2+'/'+_0x3c8543)[_0x20ad('0x1c')](_0x1bbcc8);}return null;};}function patchUpdates(_0x4bf7cf){return function(_0x44585c){try{jsonpatch['apply'](_0x44585c,_0x4bf7cf,!![]);}catch(_0x41fdf4){return BPromise[_0x20ad('0x23')](_0x41fdf4);}return _0x44585c[_0x20ad('0x24')]();};}function saveUpdates(_0x5c3fb7,_0x2b2db1){return function(_0x228fef){if(_0x228fef){return _0x228fef[_0x20ad('0x25')](_0x5c3fb7)[_0x20ad('0x26')](function(_0x14caa6){return _0x14caa6;});}return null;};}function removeEntity(_0x5d14ed,_0x37f117){return function(_0x336583){if(_0x336583){return _0x336583['destroy']()['then'](function(){_0x5d14ed[_0x20ad('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a14ff,_0x51bd7f){return function(_0x2ec65e){if(!_0x2ec65e){_0x3a14ff[_0x20ad('0x19')](0x194);}return _0x2ec65e;};}function handleError(_0x20395f,_0x4681d7){_0x4681d7=_0x4681d7||0x1f4;return function(_0x2a29ef){logger[_0x20ad('0x27')](_0x2a29ef[_0x20ad('0x28')]);if(_0x2a29ef[_0x20ad('0x29')]){delete _0x2a29ef[_0x20ad('0x29')];}_0x20395f[_0x20ad('0x1a')](_0x4681d7)['send'](_0x2a29ef);};}exports[_0x20ad('0x2a')]=function(_0x26c150,_0x1405c9){var _0x12e6e6={},_0x328ae2={},_0x4a6567={'count':0x0,'rows':[]};var _0x197aeb=_[_0x20ad('0x2b')](db[_0x20ad('0x2c')][_0x20ad('0x2d')],function(_0x519c8c){return{'name':_0x519c8c[_0x20ad('0x2e')],'type':_0x519c8c[_0x20ad('0x2f')][_0x20ad('0x30')]};});_0x328ae2[_0x20ad('0x31')]=_[_0x20ad('0x2b')](_0x197aeb,_0x20ad('0x29'));_0x328ae2[_0x20ad('0x32')]=_[_0x20ad('0x33')](_0x26c150['query']);_0x328ae2[_0x20ad('0x34')]=_[_0x20ad('0x35')](_0x328ae2[_0x20ad('0x31')],_0x328ae2[_0x20ad('0x32')]);_0x12e6e6[_0x20ad('0x36')]=_[_0x20ad('0x35')](_0x328ae2[_0x20ad('0x31')],qs[_0x20ad('0x37')](_0x26c150[_0x20ad('0x32')][_0x20ad('0x37')]));_0x12e6e6[_0x20ad('0x36')]=_0x12e6e6[_0x20ad('0x36')][_0x20ad('0x38')]?_0x12e6e6[_0x20ad('0x36')]:_0x328ae2[_0x20ad('0x31')];if(!_0x26c150[_0x20ad('0x32')][_0x20ad('0x39')]('nolimit')){_0x12e6e6['limit']=qs[_0x20ad('0x20')](_0x26c150['query']['limit']);_0x12e6e6['offset']=qs['offset'](_0x26c150[_0x20ad('0x32')][_0x20ad('0x1d')]);}_0x12e6e6[_0x20ad('0x3a')]=qs[_0x20ad('0x3b')](_0x26c150[_0x20ad('0x32')][_0x20ad('0x3b')]);_0x12e6e6[_0x20ad('0x3c')]=qs[_0x20ad('0x34')](_['pick'](_0x26c150[_0x20ad('0x32')],_0x328ae2['filters']),_0x197aeb);if(_0x26c150[_0x20ad('0x32')]['filter']){_0x12e6e6[_0x20ad('0x3c')]=_[_0x20ad('0x3d')](_0x12e6e6[_0x20ad('0x3c')],{'$or':_[_0x20ad('0x2b')](_0x197aeb,function(_0x3ffaa4){if(_0x3ffaa4[_0x20ad('0x2f')]!==_0x20ad('0x3e')){var _0x1b760b={};_0x1b760b[_0x3ffaa4[_0x20ad('0x29')]]={'$like':'%'+_0x26c150[_0x20ad('0x32')][_0x20ad('0x3f')]+'%'};return _0x1b760b;}})});}_0x12e6e6=_[_0x20ad('0x3d')]({},_0x12e6e6,_0x26c150['options']);var _0x37a181={'where':_0x12e6e6[_0x20ad('0x3c')]};return db[_0x20ad('0x2c')]['count'](_0x37a181)[_0x20ad('0x26')](function(_0x53fd29){_0x4a6567[_0x20ad('0x1f')]=_0x53fd29;if(_0x26c150[_0x20ad('0x32')][_0x20ad('0x40')]){_0x12e6e6[_0x20ad('0x41')]=[{'all':!![]}];}return db[_0x20ad('0x2c')][_0x20ad('0x42')](_0x12e6e6);})[_0x20ad('0x26')](function(_0xeffaa3){_0x4a6567[_0x20ad('0x43')]=_0xeffaa3;return _0x4a6567;})['then'](respondWithFilteredResult(_0x1405c9,_0x12e6e6))['catch'](handleError(_0x1405c9,null));};exports[_0x20ad('0x44')]=function(_0x45e2a3,_0xbe5d89){var _0x4a89e1={'raw':!![],'where':{'id':_0x45e2a3[_0x20ad('0x45')]['id']}},_0x30ce4d={};_0x30ce4d[_0x20ad('0x31')]=_[_0x20ad('0x33')](db[_0x20ad('0x2c')]['rawAttributes']);_0x30ce4d[_0x20ad('0x32')]=_['keys'](_0x45e2a3['query']);_0x30ce4d['filters']=_[_0x20ad('0x35')](_0x30ce4d[_0x20ad('0x31')],_0x30ce4d['query']);_0x4a89e1[_0x20ad('0x36')]=_['intersection'](_0x30ce4d[_0x20ad('0x31')],qs[_0x20ad('0x37')](_0x45e2a3[_0x20ad('0x32')][_0x20ad('0x37')]));_0x4a89e1[_0x20ad('0x36')]=_0x4a89e1['attributes'][_0x20ad('0x38')]?_0x4a89e1[_0x20ad('0x36')]:_0x30ce4d[_0x20ad('0x31')];if(_0x45e2a3['query'][_0x20ad('0x40')]){_0x4a89e1['include']=[{'all':!![]}];}_0x4a89e1=_[_0x20ad('0x3d')]({},_0x4a89e1,_0x45e2a3[_0x20ad('0x46')]);return db[_0x20ad('0x2c')][_0x20ad('0x47')](_0x4a89e1)[_0x20ad('0x26')](handleEntityNotFound(_0xbe5d89,null))[_0x20ad('0x26')](respondWithResult(_0xbe5d89,null))[_0x20ad('0x48')](handleError(_0xbe5d89,null));};exports[_0x20ad('0x49')]=function(_0x567b2f,_0x34f782){return db['JscriptyQuestionReport'][_0x20ad('0x49')](_0x567b2f[_0x20ad('0x4a')],{})[_0x20ad('0x26')](respondWithResult(_0x34f782,0xc9))[_0x20ad('0x48')](handleError(_0x34f782,null));};exports['update']=function(_0x58bf20,_0x3746e9){if(_0x58bf20['body']['id']){delete _0x58bf20[_0x20ad('0x4a')]['id'];}return db[_0x20ad('0x2c')][_0x20ad('0x47')]({'where':{'id':_0x58bf20['params']['id']}})[_0x20ad('0x26')](handleEntityNotFound(_0x3746e9,null))['then'](saveUpdates(_0x58bf20['body'],null))[_0x20ad('0x26')](respondWithResult(_0x3746e9,null))[_0x20ad('0x48')](handleError(_0x3746e9,null));};exports[_0x20ad('0x4b')]=function(_0x233068,_0x386c61){return db['JscriptyQuestionReport'][_0x20ad('0x47')]({'where':{'id':_0x233068[_0x20ad('0x45')]['id']}})[_0x20ad('0x26')](handleEntityNotFound(_0x386c61,null))[_0x20ad('0x26')](removeEntity(_0x386c61,null))[_0x20ad('0x48')](handleError(_0x386c61,null));};exports[_0x20ad('0x4c')]=function(_0x4e3449,_0x28deca){return db[_0x20ad('0x2c')]['describe']()['then'](respondWithResult(_0x28deca,null))[_0x20ad('0x48')](handleError(_0x28deca,null));}; \ No newline at end of file +var _0x0dc4=['request-promise','moment','bluebird','mustache','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','model','map','query','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','type','VIRTUAL','options','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','fast-json-patch'];(function(_0x406251,_0x3bbf4d){var _0x53514e=function(_0x14ef4e){while(--_0x14ef4e){_0x406251['push'](_0x406251['shift']());}};_0x53514e(++_0x3bbf4d);}(_0x0dc4,0x148));var _0x40dc=function(_0x569998,_0x361b8d){_0x569998=_0x569998-0x0;var _0x2f8256=_0x0dc4[_0x569998];return _0x2f8256;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40dc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40dc('0x1'));var rp=require(_0x40dc('0x2'));var moment=require(_0x40dc('0x3'));var BPromise=require(_0x40dc('0x4'));var Mustache=require(_0x40dc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x40dc('0x6'));var ejs=require(_0x40dc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x40dc('0x8'));var crypto=require('crypto');var jsforce=require(_0x40dc('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x40dc('0x6'));var querystring=require(_0x40dc('0xa'));var Papa=require(_0x40dc('0xb'));var Redis=require(_0x40dc('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x40dc('0xd'));var hardwareService=require(_0x40dc('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x40dc('0xf'));var licenseUtil=require(_0x40dc('0x10'));var db=require(_0x40dc('0x11'))['db'];function respondWithStatusCode(_0x2bafbd,_0x48266f){_0x48266f=_0x48266f||0xcc;return function(_0x2b0087){if(_0x2b0087){return _0x2bafbd['sendStatus'](_0x48266f);}return _0x2bafbd[_0x40dc('0x12')](_0x48266f)[_0x40dc('0x13')]();};}function respondWithResult(_0x5e1fb5,_0x3c6ba3){_0x3c6ba3=_0x3c6ba3||0xc8;return function(_0xd4243a){if(_0xd4243a){return _0x5e1fb5[_0x40dc('0x12')](_0x3c6ba3)['json'](_0xd4243a);}};}function respondWithFilteredResult(_0x2dd2dc,_0x3872d6){return function(_0x99fbf2){if(_0x99fbf2){var _0x4013c5=typeof _0x3872d6[_0x40dc('0x14')]===_0x40dc('0x15')&&typeof _0x3872d6[_0x40dc('0x16')]===_0x40dc('0x15');var _0x2cb39f=_0x99fbf2['count'];var _0x1d933b=_0x4013c5?0x0:_0x3872d6[_0x40dc('0x14')];var _0x3fc873=_0x4013c5?_0x99fbf2[_0x40dc('0x17')]:_0x3872d6[_0x40dc('0x14')]+_0x3872d6[_0x40dc('0x16')];var _0x3c1aea;if(_0x3fc873>=_0x2cb39f){_0x3fc873=_0x2cb39f;_0x3c1aea=0xc8;}else{_0x3c1aea=0xce;}_0x2dd2dc[_0x40dc('0x12')](_0x3c1aea);return _0x2dd2dc[_0x40dc('0x18')](_0x40dc('0x19'),_0x1d933b+'-'+_0x3fc873+'/'+_0x2cb39f)[_0x40dc('0x1a')](_0x99fbf2);}return null;};}function patchUpdates(_0x3f12a9){return function(_0x1beb31){try{jsonpatch['apply'](_0x1beb31,_0x3f12a9,!![]);}catch(_0x4e97be){return BPromise['reject'](_0x4e97be);}return _0x1beb31[_0x40dc('0x1b')]();};}function saveUpdates(_0x1ad55e,_0x3fbaab){return function(_0x3aedda){if(_0x3aedda){return _0x3aedda[_0x40dc('0x1c')](_0x1ad55e)[_0x40dc('0x1d')](function(_0x2075e2){return _0x2075e2;});}return null;};}function removeEntity(_0x2cb05b,_0x32e2eb){return function(_0x323612){if(_0x323612){return _0x323612[_0x40dc('0x1e')]()[_0x40dc('0x1d')](function(){_0x2cb05b['status'](0xcc)[_0x40dc('0x13')]();});}};}function handleEntityNotFound(_0xb334b9,_0x1596a7){return function(_0x571db1){if(!_0x571db1){_0xb334b9['sendStatus'](0x194);}return _0x571db1;};}function handleError(_0x161315,_0x32044f){_0x32044f=_0x32044f||0x1f4;return function(_0x4adf2b){logger[_0x40dc('0x1f')](_0x4adf2b[_0x40dc('0x20')]);if(_0x4adf2b[_0x40dc('0x21')]){delete _0x4adf2b[_0x40dc('0x21')];}_0x161315[_0x40dc('0x12')](_0x32044f)[_0x40dc('0x22')](_0x4adf2b);};}exports['index']=function(_0x3ebad8,_0x534a15){var _0x4c2a6c={},_0x4addbb={},_0x30cce7={'count':0x0,'rows':[]};var _0x11262d=_['map'](db['JscriptyQuestionReport'][_0x40dc('0x23')],function(_0x4d3224){return{'name':_0x4d3224[_0x40dc('0x24')],'type':_0x4d3224['type']['key']};});_0x4addbb[_0x40dc('0x25')]=_[_0x40dc('0x26')](_0x11262d,_0x40dc('0x21'));_0x4addbb[_0x40dc('0x27')]=_['keys'](_0x3ebad8[_0x40dc('0x27')]);_0x4addbb[_0x40dc('0x28')]=_[_0x40dc('0x29')](_0x4addbb[_0x40dc('0x25')],_0x4addbb[_0x40dc('0x27')]);_0x4c2a6c['attributes']=_[_0x40dc('0x29')](_0x4addbb[_0x40dc('0x25')],qs[_0x40dc('0x2a')](_0x3ebad8[_0x40dc('0x27')]['fields']));_0x4c2a6c[_0x40dc('0x2b')]=_0x4c2a6c[_0x40dc('0x2b')][_0x40dc('0x2c')]?_0x4c2a6c[_0x40dc('0x2b')]:_0x4addbb['model'];if(!_0x3ebad8[_0x40dc('0x27')]['hasOwnProperty']('nolimit')){_0x4c2a6c[_0x40dc('0x16')]=qs['limit'](_0x3ebad8['query']['limit']);_0x4c2a6c[_0x40dc('0x14')]=qs[_0x40dc('0x14')](_0x3ebad8[_0x40dc('0x27')][_0x40dc('0x14')]);}_0x4c2a6c[_0x40dc('0x2d')]=qs[_0x40dc('0x2e')](_0x3ebad8['query'][_0x40dc('0x2e')]);_0x4c2a6c[_0x40dc('0x2f')]=qs[_0x40dc('0x28')](_['pick'](_0x3ebad8[_0x40dc('0x27')],_0x4addbb['filters']),_0x11262d);if(_0x3ebad8[_0x40dc('0x27')][_0x40dc('0x30')]){_0x4c2a6c[_0x40dc('0x2f')]=_[_0x40dc('0x31')](_0x4c2a6c[_0x40dc('0x2f')],{'$or':_[_0x40dc('0x26')](_0x11262d,function(_0x34c0d6){if(_0x34c0d6[_0x40dc('0x32')]!==_0x40dc('0x33')){var _0x415836={};_0x415836[_0x34c0d6['name']]={'$like':'%'+_0x3ebad8['query']['filter']+'%'};return _0x415836;}})});}_0x4c2a6c=_[_0x40dc('0x31')]({},_0x4c2a6c,_0x3ebad8[_0x40dc('0x34')]);var _0x54fbba={'where':_0x4c2a6c[_0x40dc('0x2f')]};return db[_0x40dc('0x35')][_0x40dc('0x17')](_0x54fbba)[_0x40dc('0x1d')](function(_0x724840){_0x30cce7['count']=_0x724840;if(_0x3ebad8[_0x40dc('0x27')][_0x40dc('0x36')]){_0x4c2a6c[_0x40dc('0x37')]=[{'all':!![]}];}return db[_0x40dc('0x35')][_0x40dc('0x38')](_0x4c2a6c);})[_0x40dc('0x1d')](function(_0x4d67dc){_0x30cce7[_0x40dc('0x39')]=_0x4d67dc;return _0x30cce7;})['then'](respondWithFilteredResult(_0x534a15,_0x4c2a6c))[_0x40dc('0x3a')](handleError(_0x534a15,null));};exports[_0x40dc('0x3b')]=function(_0x1c7e7f,_0x5289e1){var _0x58c78b={'raw':!![],'where':{'id':_0x1c7e7f[_0x40dc('0x3c')]['id']}},_0x198e9a={};_0x198e9a[_0x40dc('0x25')]=_[_0x40dc('0x3d')](db['JscriptyQuestionReport'][_0x40dc('0x23')]);_0x198e9a[_0x40dc('0x27')]=_[_0x40dc('0x3d')](_0x1c7e7f['query']);_0x198e9a[_0x40dc('0x28')]=_[_0x40dc('0x29')](_0x198e9a['model'],_0x198e9a[_0x40dc('0x27')]);_0x58c78b[_0x40dc('0x2b')]=_['intersection'](_0x198e9a['model'],qs['fields'](_0x1c7e7f['query'][_0x40dc('0x2a')]));_0x58c78b['attributes']=_0x58c78b[_0x40dc('0x2b')][_0x40dc('0x2c')]?_0x58c78b[_0x40dc('0x2b')]:_0x198e9a[_0x40dc('0x25')];if(_0x1c7e7f[_0x40dc('0x27')][_0x40dc('0x36')]){_0x58c78b['include']=[{'all':!![]}];}_0x58c78b=_[_0x40dc('0x31')]({},_0x58c78b,_0x1c7e7f['options']);return db[_0x40dc('0x35')][_0x40dc('0x3e')](_0x58c78b)[_0x40dc('0x1d')](handleEntityNotFound(_0x5289e1,null))[_0x40dc('0x1d')](respondWithResult(_0x5289e1,null))[_0x40dc('0x3a')](handleError(_0x5289e1,null));};exports[_0x40dc('0x3f')]=function(_0x9f7f6d,_0x5b0544){return db[_0x40dc('0x35')][_0x40dc('0x3f')](_0x9f7f6d[_0x40dc('0x40')],{})['then'](respondWithResult(_0x5b0544,0xc9))[_0x40dc('0x3a')](handleError(_0x5b0544,null));};exports['update']=function(_0x378ccd,_0x1bbc53){if(_0x378ccd[_0x40dc('0x40')]['id']){delete _0x378ccd['body']['id'];}return db['JscriptyQuestionReport'][_0x40dc('0x3e')]({'where':{'id':_0x378ccd[_0x40dc('0x3c')]['id']}})[_0x40dc('0x1d')](handleEntityNotFound(_0x1bbc53,null))[_0x40dc('0x1d')](saveUpdates(_0x378ccd[_0x40dc('0x40')],null))[_0x40dc('0x1d')](respondWithResult(_0x1bbc53,null))['catch'](handleError(_0x1bbc53,null));};exports[_0x40dc('0x1e')]=function(_0x320f89,_0x26d798){return db[_0x40dc('0x35')]['find']({'where':{'id':_0x320f89['params']['id']}})[_0x40dc('0x1d')](handleEntityNotFound(_0x26d798,null))[_0x40dc('0x1d')](removeEntity(_0x26d798,null))[_0x40dc('0x3a')](handleError(_0x26d798,null));};exports[_0x40dc('0x41')]=function(_0xd85875,_0x127911){return db[_0x40dc('0x35')]['describe']()[_0x40dc('0x1d')](respondWithResult(_0x127911,null))['catch'](handleError(_0x127911,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 9a61606..3cdc825 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 _0xfc96=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x25764f,_0x1db05e){var _0x217e84=function(_0x4f2975){while(--_0x4f2975){_0x25764f['push'](_0x25764f['shift']());}};_0x217e84(++_0x1db05e);}(_0xfc96,0xc2));var _0x6fc9=function(_0x4664c5,_0x13b4e3){_0x4664c5=_0x4664c5-0x0;var _0x111e11=_0xfc96[_0x4664c5];return _0x111e11;};'use strict';var _=require(_0x6fc9('0x0'));var util=require(_0x6fc9('0x1'));var logger=require(_0x6fc9('0x2'))(_0x6fc9('0x3'));var moment=require('moment');var BPromise=require(_0x6fc9('0x4'));var rp=require(_0x6fc9('0x5'));var fs=require('fs');var path=require(_0x6fc9('0x6'));var rimraf=require(_0x6fc9('0x7'));var config=require(_0x6fc9('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x4a2d82,_0x481e7d){return _0x4a2d82[_0x6fc9('0x9')](_0x6fc9('0xa'),attributes,{'tableName':_0x6fc9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fb3=['request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','api','bluebird'];(function(_0x3e4241,_0x46a190){var _0x1d0a9e=function(_0x4be115){while(--_0x4be115){_0x3e4241['push'](_0x3e4241['shift']());}};_0x1d0a9e(++_0x46a190);}(_0x1fb3,0xd5));var _0x31fb=function(_0x4c62af,_0x234da8){_0x4c62af=_0x4c62af-0x0;var _0x3d8c6d=_0x1fb3[_0x4c62af];return _0x3d8c6d;};'use strict';var _=require(_0x31fb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x31fb('0x1'));var moment=require('moment');var BPromise=require(_0x31fb('0x2'));var rp=require(_0x31fb('0x3'));var fs=require('fs');var path=require(_0x31fb('0x4'));var rimraf=require(_0x31fb('0x5'));var config=require(_0x31fb('0x6'));var attributes=require(_0x31fb('0x7'));module[_0x31fb('0x8')]=function(_0x3227ec,_0x575ce8){return _0x3227ec[_0x31fb('0x9')](_0x31fb('0xa'),attributes,{'tableName':_0x31fb('0xb'),'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 7d2cc67..8bba8b8 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 _0x729a=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x562201,_0x22ff6f){var _0x1ea884=function(_0x45d174){while(--_0x45d174){_0x562201['push'](_0x562201['shift']());}};_0x1ea884(++_0x22ff6f);}(_0x729a,0x1a6));var _0xa729=function(_0x32f947,_0x4170cb){_0x32f947=_0x32f947-0x0;var _0x1275ce=_0x729a[_0x32f947];return _0x1275ce;};'use strict';var _=require(_0xa729('0x0'));var util=require(_0xa729('0x1'));var moment=require('moment');var BPromise=require(_0xa729('0x2'));var rs=require(_0xa729('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa729('0x4'));var logger=require('../../config/logger')(_0xa729('0x5'));var config=require(_0xa729('0x6'));var jayson=require(_0xa729('0x7'));var client=jayson[_0xa729('0x8')][_0xa729('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x112e8e,_0x3a0a2e,_0x2aaf22){return new BPromise(function(_0x27d8a9,_0x11fbe3){return client[_0xa729('0xa')](_0x112e8e,_0x2aaf22)[_0xa729('0xb')](function(_0x2bb381){logger[_0xa729('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3a0a2e,_0xa729('0xd'));logger[_0xa729('0xe')](_0xa729('0xf'),_0x3a0a2e,_0xa729('0xd'),JSON[_0xa729('0x10')](_0x2bb381));if(_0x2bb381[_0xa729('0x11')]){if(_0x2bb381[_0xa729('0x11')][_0xa729('0x12')]===0x1f4){logger[_0xa729('0x11')](_0xa729('0x13'),_0x3a0a2e,_0x2bb381['error'][_0xa729('0x14')]);return _0x11fbe3(_0x2bb381[_0xa729('0x11')]['message']);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3a0a2e,_0x2bb381['error']['message']);return _0x27d8a9(_0x2bb381[_0xa729('0x11')][_0xa729('0x14')]);}else{logger[_0xa729('0xc')](_0xa729('0x13'),_0x3a0a2e,_0xa729('0xd'));_0x27d8a9(_0x2bb381[_0xa729('0x15')]['message']);}})[_0xa729('0x16')](function(_0x1bc854){logger[_0xa729('0x11')](_0xa729('0x13'),_0x3a0a2e,_0x1bc854);_0x11fbe3(_0x1bc854);});});} \ No newline at end of file +var _0x1865=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x1865,0x156));var _0x5186=function(_0x4f5d1a,_0x1696fa){_0x4f5d1a=_0x4f5d1a-0x0;var _0x3a2759=_0x1865[_0x4f5d1a];return _0x3a2759;};'use strict';var _=require('lodash');var util=require(_0x5186('0x0'));var moment=require('moment');var BPromise=require(_0x5186('0x1'));var rs=require(_0x5186('0x2'));var fs=require('fs');var Redis=require(_0x5186('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5186('0x4'));var logger=require(_0x5186('0x5'))(_0x5186('0x6'));var config=require(_0x5186('0x7'));var jayson=require(_0x5186('0x8'));var client=jayson[_0x5186('0x9')][_0x5186('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x145eae,_0x5f264a,_0x1773e9){return new BPromise(function(_0x2d1c34,_0x41eb3f){return client[_0x5186('0xb')](_0x145eae,_0x1773e9)[_0x5186('0xc')](function(_0x4773a4){logger[_0x5186('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5f264a,_0x5186('0xe'));logger[_0x5186('0xf')](_0x5186('0x10'),_0x5f264a,_0x5186('0xe'),JSON['stringify'](_0x4773a4));if(_0x4773a4[_0x5186('0x11')]){if(_0x4773a4[_0x5186('0x11')][_0x5186('0x12')]===0x1f4){logger[_0x5186('0x11')](_0x5186('0x13'),_0x5f264a,_0x4773a4[_0x5186('0x11')]['message']);return _0x41eb3f(_0x4773a4[_0x5186('0x11')][_0x5186('0x14')]);}logger[_0x5186('0x11')](_0x5186('0x13'),_0x5f264a,_0x4773a4[_0x5186('0x11')][_0x5186('0x14')]);return _0x2d1c34(_0x4773a4[_0x5186('0x11')]['message']);}else{logger[_0x5186('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5f264a,'request\x20sent');_0x2d1c34(_0x4773a4[_0x5186('0x15')]['message']);}})[_0x5186('0x16')](function(_0x4c86bd){logger[_0x5186('0x11')](_0x5186('0x13'),_0x5f264a,_0x4c86bd);_0x41eb3f(_0x4c86bd);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index bfacabb..4bc47b6 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 _0x17a2=['/:id','/:id/questions','getQuestions','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x5c48ea,_0x2191a2){var _0x1262dc=function(_0x394829){while(--_0x394829){_0x5c48ea['push'](_0x5c48ea['shift']());}};_0x1262dc(++_0x2191a2);}(_0x17a2,0x1ab));var _0x217a=function(_0x701d99,_0x281aea){_0x701d99=_0x701d99-0x0;var _0x3dac2b=_0x17a2[_0x701d99];return _0x3dac2b;};'use strict';var multer=require(_0x217a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x217a('0x1'));var express=require(_0x217a('0x2'));var router=express[_0x217a('0x3')]();var fs_extra=require(_0x217a('0x4'));var auth=require(_0x217a('0x5'));var interaction=require(_0x217a('0x6'));var config=require(_0x217a('0x7'));var controller=require(_0x217a('0x8'));router[_0x217a('0x9')]('/',auth[_0x217a('0xa')](),controller['index']);router[_0x217a('0x9')](_0x217a('0xb'),auth[_0x217a('0xa')](),controller[_0x217a('0xc')]);router[_0x217a('0x9')](_0x217a('0xd'),auth[_0x217a('0xa')](),controller['show']);router[_0x217a('0x9')](_0x217a('0xe'),auth[_0x217a('0xa')](),controller[_0x217a('0xf')]);router['post']('/',auth[_0x217a('0xa')](),controller[_0x217a('0x10')]);router[_0x217a('0x11')](_0x217a('0xd'),auth[_0x217a('0xa')](),controller[_0x217a('0x12')]);router[_0x217a('0x13')](_0x217a('0xd'),auth[_0x217a('0xa')](),controller[_0x217a('0x14')]);module[_0x217a('0x15')]=router; \ No newline at end of file +var _0xa6c7=['fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/questions','getQuestions','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x582514,_0x4667aa){var _0x369266=function(_0x13b986){while(--_0x13b986){_0x582514['push'](_0x582514['shift']());}};_0x369266(++_0x4667aa);}(_0xa6c7,0x171));var _0x7a6c=function(_0x3b0da2,_0x306d66){_0x3b0da2=_0x3b0da2-0x0;var _0x45a240=_0xa6c7[_0x3b0da2];return _0x45a240;};'use strict';var multer=require('multer');var util=require(_0x7a6c('0x0'));var path=require(_0x7a6c('0x1'));var timeout=require(_0x7a6c('0x2'));var express=require(_0x7a6c('0x3'));var router=express[_0x7a6c('0x4')]();var fs_extra=require(_0x7a6c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7a6c('0x6'));var config=require(_0x7a6c('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x7a6c('0x8')]('/',auth['isAuthenticated'](),controller[_0x7a6c('0x9')]);router[_0x7a6c('0x8')](_0x7a6c('0xa'),auth['isAuthenticated'](),controller[_0x7a6c('0xb')]);router[_0x7a6c('0x8')](_0x7a6c('0xc'),auth[_0x7a6c('0xd')](),controller[_0x7a6c('0xe')]);router[_0x7a6c('0x8')](_0x7a6c('0xf'),auth[_0x7a6c('0xd')](),controller[_0x7a6c('0x10')]);router['post']('/',auth[_0x7a6c('0xd')](),controller[_0x7a6c('0x11')]);router['put'](_0x7a6c('0xc'),auth[_0x7a6c('0xd')](),controller[_0x7a6c('0x12')]);router[_0x7a6c('0x13')](_0x7a6c('0xc'),auth[_0x7a6c('0xd')](),controller[_0x7a6c('0x14')]);module[_0x7a6c('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 51d1db4..57e3261 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 _0x6f2c=['moment','sequelize','DATE','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x5aee34,_0x2a0b42){var _0x53b0c7=function(_0x4c31b6){while(--_0x4c31b6){_0x5aee34['push'](_0x5aee34['shift']());}};_0x53b0c7(++_0x2a0b42);}(_0x6f2c,0x13b));var _0xc6f2=function(_0x584852,_0xc77cce){_0x584852=_0x584852-0x0;var _0x288b5f=_0x6f2c[_0x584852];return _0x288b5f;};'use strict';var moment=require(_0xc6f2('0x0'));var Sequelize=require(_0xc6f2('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xc6f2('0x2')],'set':function(_0x2e231b){this[_0xc6f2('0x3')](_0xc6f2('0x4'),_0x2e231b);this[_0xc6f2('0x3')]('endtime',moment()[_0xc6f2('0x5')](_0xc6f2('0x6')));}},'endtime':{'type':Sequelize[_0xc6f2('0x2')]},'membername':{'type':Sequelize[_0xc6f2('0x7')]},'projectname':{'type':Sequelize[_0xc6f2('0x7')]},'queue':{'type':Sequelize[_0xc6f2('0x7')]},'uniqueid':{'type':Sequelize[_0xc6f2('0x7')]},'calleridname':{'type':Sequelize[_0xc6f2('0x7')]},'calleridnum':{'type':Sequelize[_0xc6f2('0x7')]},'completed':{'type':Sequelize[_0xc6f2('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x7abe=['DATE','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','exports'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x7abe,0xa0));var _0xe7ab=function(_0x2ce498,_0x1f0736){_0x2ce498=_0x2ce498-0x0;var _0x253951=_0x7abe[_0x2ce498];return _0x253951;};'use strict';var moment=require('moment');var Sequelize=require(_0xe7ab('0x0'));module[_0xe7ab('0x1')]={'starttime':{'type':Sequelize[_0xe7ab('0x2')],'set':function(_0x178042){this[_0xe7ab('0x3')](_0xe7ab('0x4'),_0x178042);this['setDataValue']('endtime',moment()[_0xe7ab('0x5')](_0xe7ab('0x6')));}},'endtime':{'type':Sequelize[_0xe7ab('0x2')]},'membername':{'type':Sequelize[_0xe7ab('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xe7ab('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe7ab('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xe7ab('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index b196a43..68e5747 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 _0xd9a7=['intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','includeAll','include','findAll','show','options','find','catch','create','body','params','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','rows','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/qs','../../config/license/hardware','../../config/logger','../../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','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','model','attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd9a7,0x114));var _0x7d9a=function(_0x5eeedb,_0x3618cf){_0x5eeedb=_0x5eeedb-0x0;var _0xfacee6=_0xd9a7[_0x5eeedb];return _0xfacee6;};'use strict';var emlformat=require(_0x7d9a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d9a('0x1'));var jsonpatch=require(_0x7d9a('0x2'));var rp=require(_0x7d9a('0x3'));var moment=require(_0x7d9a('0x4'));var BPromise=require(_0x7d9a('0x5'));var Mustache=require(_0x7d9a('0x6'));var util=require(_0x7d9a('0x7'));var path=require(_0x7d9a('0x8'));var sox=require(_0x7d9a('0x9'));var csv=require(_0x7d9a('0xa'));var ejs=require(_0x7d9a('0xb'));var fs=require('fs');var fs_extra=require(_0x7d9a('0xc'));var _=require(_0x7d9a('0xd'));var squel=require(_0x7d9a('0xe'));var crypto=require(_0x7d9a('0xf'));var jsforce=require(_0x7d9a('0x10'));var deskjs=require(_0x7d9a('0x11'));var toCsv=require(_0x7d9a('0xa'));var querystring=require(_0x7d9a('0x12'));var Papa=require(_0x7d9a('0x13'));var Redis=require(_0x7d9a('0x14'));var authService=require(_0x7d9a('0x15'));var qs=require(_0x7d9a('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d9a('0x17'));var logger=require(_0x7d9a('0x18'))('api');var utils=require(_0x7d9a('0x19'));var config=require(_0x7d9a('0x1a'));var licenseUtil=require(_0x7d9a('0x1b'));var db=require(_0x7d9a('0x1c'))['db'];function respondWithStatusCode(_0x5489ac,_0x5d7e54){_0x5d7e54=_0x5d7e54||0xcc;return function(_0xa9ca3a){if(_0xa9ca3a){return _0x5489ac[_0x7d9a('0x1d')](_0x5d7e54);}return _0x5489ac[_0x7d9a('0x1e')](_0x5d7e54)['end']();};}function respondWithResult(_0x4e8b72,_0x2d999b){_0x2d999b=_0x2d999b||0xc8;return function(_0x11df19){if(_0x11df19){return _0x4e8b72[_0x7d9a('0x1e')](_0x2d999b)[_0x7d9a('0x1f')](_0x11df19);}};}function respondWithFilteredResult(_0x111522,_0x7a59bd){return function(_0x354137){if(_0x354137){var _0x10987c=typeof _0x7a59bd[_0x7d9a('0x20')]===_0x7d9a('0x21')&&typeof _0x7a59bd[_0x7d9a('0x22')]==='undefined';var _0x58f44b=_0x354137['count'];var _0x2011bc=_0x10987c?0x0:_0x7a59bd[_0x7d9a('0x20')];var _0xb64771=_0x10987c?_0x354137[_0x7d9a('0x23')]:_0x7a59bd[_0x7d9a('0x20')]+_0x7a59bd['limit'];var _0x194651;if(_0xb64771>=_0x58f44b){_0xb64771=_0x58f44b;_0x194651=0xc8;}else{_0x194651=0xce;}_0x111522[_0x7d9a('0x1e')](_0x194651);return _0x111522['set'](_0x7d9a('0x24'),_0x2011bc+'-'+_0xb64771+'/'+_0x58f44b)[_0x7d9a('0x1f')](_0x354137);}return null;};}function patchUpdates(_0x470078){return function(_0xbba250){try{jsonpatch[_0x7d9a('0x25')](_0xbba250,_0x470078,!![]);}catch(_0x50c623){return BPromise[_0x7d9a('0x26')](_0x50c623);}return _0xbba250['save']();};}function saveUpdates(_0x50fd96,_0x2f1cfa){return function(_0x1052d8){if(_0x1052d8){return _0x1052d8[_0x7d9a('0x27')](_0x50fd96)[_0x7d9a('0x28')](function(_0x1b2167){return _0x1b2167;});}return null;};}function removeEntity(_0x4eab7c,_0x2ae449){return function(_0x1d8fe7){if(_0x1d8fe7){return _0x1d8fe7[_0x7d9a('0x29')]()['then'](function(){_0x4eab7c['status'](0xcc)[_0x7d9a('0x2a')]();});}};}function handleEntityNotFound(_0x8e6712,_0x351f5a){return function(_0x49bfef){if(!_0x49bfef){_0x8e6712[_0x7d9a('0x1d')](0x194);}return _0x49bfef;};}function handleError(_0x9c244a,_0x2a19db){_0x2a19db=_0x2a19db||0x1f4;return function(_0x23659b){logger['error'](_0x23659b[_0x7d9a('0x2b')]);if(_0x23659b[_0x7d9a('0x2c')]){delete _0x23659b['name'];}_0x9c244a['status'](_0x2a19db)['send'](_0x23659b);};}exports[_0x7d9a('0x2d')]=function(_0x1aad31,_0x19e1b4){var _0x1d6a7f={},_0x520182={},_0x57b658={'count':0x0,'rows':[]};var _0x35f0d7=_[_0x7d9a('0x2e')](db[_0x7d9a('0x2f')][_0x7d9a('0x30')],function(_0x276912){return{'name':_0x276912[_0x7d9a('0x31')],'type':_0x276912[_0x7d9a('0x32')][_0x7d9a('0x33')]};});_0x520182['model']=_[_0x7d9a('0x2e')](_0x35f0d7,'name');_0x520182[_0x7d9a('0x34')]=_[_0x7d9a('0x35')](_0x1aad31[_0x7d9a('0x34')]);_0x520182['filters']=_['intersection'](_0x520182[_0x7d9a('0x36')],_0x520182[_0x7d9a('0x34')]);_0x1d6a7f[_0x7d9a('0x37')]=_[_0x7d9a('0x38')](_0x520182[_0x7d9a('0x36')],qs['fields'](_0x1aad31[_0x7d9a('0x34')][_0x7d9a('0x39')]));_0x1d6a7f[_0x7d9a('0x37')]=_0x1d6a7f[_0x7d9a('0x37')][_0x7d9a('0x3a')]?_0x1d6a7f[_0x7d9a('0x37')]:_0x520182[_0x7d9a('0x36')];if(!_0x1aad31[_0x7d9a('0x34')][_0x7d9a('0x3b')]('nolimit')){_0x1d6a7f['limit']=qs[_0x7d9a('0x22')](_0x1aad31[_0x7d9a('0x34')][_0x7d9a('0x22')]);_0x1d6a7f[_0x7d9a('0x20')]=qs[_0x7d9a('0x20')](_0x1aad31[_0x7d9a('0x34')]['offset']);}_0x1d6a7f[_0x7d9a('0x3c')]=qs[_0x7d9a('0x3d')](_0x1aad31[_0x7d9a('0x34')][_0x7d9a('0x3d')]);_0x1d6a7f['where']=qs[_0x7d9a('0x3e')](_[_0x7d9a('0x3f')](_0x1aad31[_0x7d9a('0x34')],_0x520182['filters']),_0x35f0d7);if(_0x1aad31['query'][_0x7d9a('0x40')]){_0x1d6a7f[_0x7d9a('0x41')]=_[_0x7d9a('0x42')](_0x1d6a7f[_0x7d9a('0x41')],{'$or':_['map'](_0x35f0d7,function(_0x2e9033){if(_0x2e9033[_0x7d9a('0x32')]!=='VIRTUAL'){var _0x55eb29={};_0x55eb29[_0x2e9033[_0x7d9a('0x2c')]]={'$like':'%'+_0x1aad31[_0x7d9a('0x34')][_0x7d9a('0x40')]+'%'};return _0x55eb29;}})});}_0x1d6a7f=_[_0x7d9a('0x42')]({},_0x1d6a7f,_0x1aad31['options']);var _0xbabb67={'where':_0x1d6a7f[_0x7d9a('0x41')]};return db[_0x7d9a('0x2f')][_0x7d9a('0x23')](_0xbabb67)[_0x7d9a('0x28')](function(_0x598d63){_0x57b658[_0x7d9a('0x23')]=_0x598d63;if(_0x1aad31[_0x7d9a('0x34')][_0x7d9a('0x43')]){_0x1d6a7f[_0x7d9a('0x44')]=[{'all':!![]}];}return db[_0x7d9a('0x2f')][_0x7d9a('0x45')](_0x1d6a7f);})[_0x7d9a('0x28')](function(_0x2a6b1c){_0x57b658['rows']=_0x2a6b1c;return _0x57b658;})[_0x7d9a('0x28')](respondWithFilteredResult(_0x19e1b4,_0x1d6a7f))['catch'](handleError(_0x19e1b4,null));};exports[_0x7d9a('0x46')]=function(_0x442eb8,_0x2cee47){var _0x467662={'raw':!![],'where':{'id':_0x442eb8['params']['id']}},_0x19abc0={};_0x19abc0[_0x7d9a('0x36')]=_[_0x7d9a('0x35')](db['JscriptySessionReport'][_0x7d9a('0x30')]);_0x19abc0['query']=_[_0x7d9a('0x35')](_0x442eb8[_0x7d9a('0x34')]);_0x19abc0[_0x7d9a('0x3e')]=_[_0x7d9a('0x38')](_0x19abc0[_0x7d9a('0x36')],_0x19abc0['query']);_0x467662[_0x7d9a('0x37')]=_[_0x7d9a('0x38')](_0x19abc0[_0x7d9a('0x36')],qs[_0x7d9a('0x39')](_0x442eb8['query'][_0x7d9a('0x39')]));_0x467662[_0x7d9a('0x37')]=_0x467662['attributes']['length']?_0x467662[_0x7d9a('0x37')]:_0x19abc0[_0x7d9a('0x36')];if(_0x442eb8[_0x7d9a('0x34')][_0x7d9a('0x43')]){_0x467662[_0x7d9a('0x44')]=[{'all':!![]}];}_0x467662=_[_0x7d9a('0x42')]({},_0x467662,_0x442eb8[_0x7d9a('0x47')]);return db[_0x7d9a('0x2f')][_0x7d9a('0x48')](_0x467662)[_0x7d9a('0x28')](handleEntityNotFound(_0x2cee47,null))[_0x7d9a('0x28')](respondWithResult(_0x2cee47,null))[_0x7d9a('0x49')](handleError(_0x2cee47,null));};exports[_0x7d9a('0x4a')]=function(_0x1621f8,_0x5d62d3){return db['JscriptySessionReport'][_0x7d9a('0x4a')](_0x1621f8[_0x7d9a('0x4b')],{})[_0x7d9a('0x28')](respondWithResult(_0x5d62d3,0xc9))[_0x7d9a('0x49')](handleError(_0x5d62d3,null));};exports[_0x7d9a('0x27')]=function(_0x1b2a61,_0x2bd2c6){if(_0x1b2a61['body']['id']){delete _0x1b2a61[_0x7d9a('0x4b')]['id'];}return db[_0x7d9a('0x2f')]['find']({'where':{'id':_0x1b2a61[_0x7d9a('0x4c')]['id']}})[_0x7d9a('0x28')](handleEntityNotFound(_0x2bd2c6,null))[_0x7d9a('0x28')](saveUpdates(_0x1b2a61[_0x7d9a('0x4b')],null))[_0x7d9a('0x28')](respondWithResult(_0x2bd2c6,null))['catch'](handleError(_0x2bd2c6,null));};exports[_0x7d9a('0x29')]=function(_0x407b16,_0xa567c4){return db[_0x7d9a('0x2f')][_0x7d9a('0x48')]({'where':{'id':_0x407b16['params']['id']}})['then'](handleEntityNotFound(_0xa567c4,null))[_0x7d9a('0x28')](removeEntity(_0xa567c4,null))['catch'](handleError(_0xa567c4,null));};exports[_0x7d9a('0x4d')]=function(_0x1e4ef4,_0x432239){return db[_0x7d9a('0x2f')][_0x7d9a('0x4d')]()[_0x7d9a('0x28')](respondWithResult(_0x432239,null))[_0x7d9a('0x49')](handleError(_0x432239,null));};exports[_0x7d9a('0x4e')]=function(_0x51c2ff,_0x448e56,_0x32bbc2){var _0x18d0da={'raw':!![],'where':{}};var _0x2a7271={};var _0x451489={'count':0x0,'rows':[]};return db[_0x7d9a('0x2f')][_0x7d9a('0x4f')]({'where':{'id':_0x51c2ff['params']['id']}})['then'](handleEntityNotFound(_0x448e56,null))[_0x7d9a('0x28')](function(_0x5e1508){if(_0x5e1508){_0x2a7271[_0x7d9a('0x36')]=_[_0x7d9a('0x35')](db[_0x7d9a('0x50')]['rawAttributes']);_0x2a7271[_0x7d9a('0x34')]=_[_0x7d9a('0x35')](_0x51c2ff[_0x7d9a('0x34')]);_0x2a7271[_0x7d9a('0x3e')]=_['intersection'](_0x2a7271[_0x7d9a('0x36')],_0x2a7271[_0x7d9a('0x34')]);_0x18d0da[_0x7d9a('0x37')]=_[_0x7d9a('0x38')](_0x2a7271['model'],qs[_0x7d9a('0x39')](_0x51c2ff[_0x7d9a('0x34')]['fields']));_0x18d0da[_0x7d9a('0x37')]=_0x18d0da[_0x7d9a('0x37')][_0x7d9a('0x3a')]?_0x18d0da[_0x7d9a('0x37')]:_0x2a7271[_0x7d9a('0x36')];if(!_0x51c2ff[_0x7d9a('0x34')][_0x7d9a('0x3b')](_0x7d9a('0x51'))){_0x18d0da['limit']=qs['limit'](_0x51c2ff[_0x7d9a('0x34')][_0x7d9a('0x22')]);_0x18d0da[_0x7d9a('0x20')]=qs['offset'](_0x51c2ff['query'][_0x7d9a('0x20')]);}_0x18d0da[_0x7d9a('0x3c')]=qs[_0x7d9a('0x3d')](_0x51c2ff[_0x7d9a('0x34')][_0x7d9a('0x3d')]);_0x18d0da['where']=qs[_0x7d9a('0x3e')](_[_0x7d9a('0x3f')](_0x51c2ff[_0x7d9a('0x34')],_0x2a7271[_0x7d9a('0x3e')]));_0x18d0da[_0x7d9a('0x41')]['SessionId']=_0x5e1508['id'];if(_0x51c2ff[_0x7d9a('0x34')][_0x7d9a('0x40')]){_0x18d0da[_0x7d9a('0x41')]=_[_0x7d9a('0x42')](_0x18d0da[_0x7d9a('0x41')],{'$or':_[_0x7d9a('0x2e')](_0x18d0da[_0x7d9a('0x37')],function(_0x2c94f4){var _0x419950={};_0x419950[_0x2c94f4]={'$like':'%'+_0x51c2ff['query']['filter']+'%'};return _0x419950;})});}_0x18d0da=_[_0x7d9a('0x42')]({},_0x18d0da,_0x51c2ff[_0x7d9a('0x47')]);return db[_0x7d9a('0x50')][_0x7d9a('0x23')]({'where':_0x18d0da[_0x7d9a('0x41')]})[_0x7d9a('0x28')](function(_0x546a48){_0x451489[_0x7d9a('0x23')]=_0x546a48;if(_0x51c2ff['query']['includeAll']){_0x18d0da[_0x7d9a('0x44')]=[{'all':!![]}];}return db[_0x7d9a('0x50')][_0x7d9a('0x45')](_0x18d0da);})[_0x7d9a('0x28')](function(_0x25d6f7){_0x451489[_0x7d9a('0x52')]=_0x25d6f7;return _0x451489;});}})['then'](respondWithFilteredResult(_0x448e56,_0x18d0da))[_0x7d9a('0x49')](handleError(_0x448e56,null));}; \ No newline at end of file +var _0xd29c=['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','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','map','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','where','merge','type','VIRTUAL','filter','options','JscriptySessionReport','includeAll','include','findAll','rows','show','params','keys','find','create','catch','update','body','describe','findOne','JscriptyQuestionReport','rawAttributes','order','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd29c,0x1d8));var _0xcd29=function(_0x4ba9d1,_0xcb7f2c){_0x4ba9d1=_0x4ba9d1-0x0;var _0x441a24=_0xd29c[_0x4ba9d1];return _0x441a24;};'use strict';var emlformat=require(_0xcd29('0x0'));var rimraf=require(_0xcd29('0x1'));var zipdir=require(_0xcd29('0x2'));var jsonpatch=require(_0xcd29('0x3'));var rp=require(_0xcd29('0x4'));var moment=require(_0xcd29('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcd29('0x6'));var util=require(_0xcd29('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xcd29('0x8'));var ejs=require(_0xcd29('0x9'));var fs=require('fs');var fs_extra=require(_0xcd29('0xa'));var _=require(_0xcd29('0xb'));var squel=require(_0xcd29('0xc'));var crypto=require('crypto');var jsforce=require(_0xcd29('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcd29('0x8'));var querystring=require(_0xcd29('0xe'));var Papa=require(_0xcd29('0xf'));var Redis=require(_0xcd29('0x10'));var authService=require(_0xcd29('0x11'));var qs=require(_0xcd29('0x12'));var as=require(_0xcd29('0x13'));var hardwareService=require(_0xcd29('0x14'));var logger=require(_0xcd29('0x15'))(_0xcd29('0x16'));var utils=require(_0xcd29('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcd29('0x18'))['db'];function respondWithStatusCode(_0x322805,_0x47a302){_0x47a302=_0x47a302||0xcc;return function(_0x9762f1){if(_0x9762f1){return _0x322805[_0xcd29('0x19')](_0x47a302);}return _0x322805[_0xcd29('0x1a')](_0x47a302)['end']();};}function respondWithResult(_0x42190e,_0x46c0c3){_0x46c0c3=_0x46c0c3||0xc8;return function(_0x153fca){if(_0x153fca){return _0x42190e[_0xcd29('0x1a')](_0x46c0c3)[_0xcd29('0x1b')](_0x153fca);}};}function respondWithFilteredResult(_0x5dc2c8,_0x402c16){return function(_0x121ecc){if(_0x121ecc){var _0x526504=typeof _0x402c16[_0xcd29('0x1c')]===_0xcd29('0x1d')&&typeof _0x402c16[_0xcd29('0x1e')]===_0xcd29('0x1d');var _0x991d22=_0x121ecc[_0xcd29('0x1f')];var _0xf0266a=_0x526504?0x0:_0x402c16['offset'];var _0x5803d7=_0x526504?_0x121ecc[_0xcd29('0x1f')]:_0x402c16['offset']+_0x402c16[_0xcd29('0x1e')];var _0x521174;if(_0x5803d7>=_0x991d22){_0x5803d7=_0x991d22;_0x521174=0xc8;}else{_0x521174=0xce;}_0x5dc2c8[_0xcd29('0x1a')](_0x521174);return _0x5dc2c8[_0xcd29('0x20')](_0xcd29('0x21'),_0xf0266a+'-'+_0x5803d7+'/'+_0x991d22)[_0xcd29('0x1b')](_0x121ecc);}return null;};}function patchUpdates(_0x4a375b){return function(_0x4b2ad1){try{jsonpatch[_0xcd29('0x22')](_0x4b2ad1,_0x4a375b,!![]);}catch(_0x2568a4){return BPromise[_0xcd29('0x23')](_0x2568a4);}return _0x4b2ad1[_0xcd29('0x24')]();};}function saveUpdates(_0x4f0dcc,_0xec0e43){return function(_0x5ab74c){if(_0x5ab74c){return _0x5ab74c['update'](_0x4f0dcc)[_0xcd29('0x25')](function(_0x54eb69){return _0x54eb69;});}return null;};}function removeEntity(_0x4774e8,_0x46ef41){return function(_0x41caf3){if(_0x41caf3){return _0x41caf3[_0xcd29('0x26')]()['then'](function(){_0x4774e8[_0xcd29('0x1a')](0xcc)[_0xcd29('0x27')]();});}};}function handleEntityNotFound(_0x188fba,_0x4513e2){return function(_0x16a4f9){if(!_0x16a4f9){_0x188fba[_0xcd29('0x19')](0x194);}return _0x16a4f9;};}function handleError(_0x3a62eb,_0x25da67){_0x25da67=_0x25da67||0x1f4;return function(_0x10c950){logger[_0xcd29('0x28')](_0x10c950[_0xcd29('0x29')]);if(_0x10c950[_0xcd29('0x2a')]){delete _0x10c950[_0xcd29('0x2a')];}_0x3a62eb[_0xcd29('0x1a')](_0x25da67)['send'](_0x10c950);};}exports['index']=function(_0x4817aa,_0x4c35d3){var _0x5bf805={},_0x5a4264={},_0x5adb95={'count':0x0,'rows':[]};var _0xa8c3ea=_[_0xcd29('0x2b')](db['JscriptySessionReport']['rawAttributes'],function(_0x4e880c){return{'name':_0x4e880c['fieldName'],'type':_0x4e880c['type'][_0xcd29('0x2c')]};});_0x5a4264[_0xcd29('0x2d')]=_[_0xcd29('0x2b')](_0xa8c3ea,_0xcd29('0x2a'));_0x5a4264[_0xcd29('0x2e')]=_['keys'](_0x4817aa[_0xcd29('0x2e')]);_0x5a4264['filters']=_['intersection'](_0x5a4264[_0xcd29('0x2d')],_0x5a4264[_0xcd29('0x2e')]);_0x5bf805['attributes']=_[_0xcd29('0x2f')](_0x5a4264['model'],qs[_0xcd29('0x30')](_0x4817aa['query'][_0xcd29('0x30')]));_0x5bf805[_0xcd29('0x31')]=_0x5bf805[_0xcd29('0x31')][_0xcd29('0x32')]?_0x5bf805[_0xcd29('0x31')]:_0x5a4264[_0xcd29('0x2d')];if(!_0x4817aa['query'][_0xcd29('0x33')](_0xcd29('0x34'))){_0x5bf805[_0xcd29('0x1e')]=qs['limit'](_0x4817aa[_0xcd29('0x2e')]['limit']);_0x5bf805[_0xcd29('0x1c')]=qs[_0xcd29('0x1c')](_0x4817aa['query'][_0xcd29('0x1c')]);}_0x5bf805['order']=qs[_0xcd29('0x35')](_0x4817aa['query'][_0xcd29('0x35')]);_0x5bf805['where']=qs[_0xcd29('0x36')](_['pick'](_0x4817aa[_0xcd29('0x2e')],_0x5a4264[_0xcd29('0x36')]),_0xa8c3ea);if(_0x4817aa[_0xcd29('0x2e')]['filter']){_0x5bf805[_0xcd29('0x37')]=_[_0xcd29('0x38')](_0x5bf805['where'],{'$or':_[_0xcd29('0x2b')](_0xa8c3ea,function(_0x42bc62){if(_0x42bc62[_0xcd29('0x39')]!==_0xcd29('0x3a')){var _0x265e7e={};_0x265e7e[_0x42bc62[_0xcd29('0x2a')]]={'$like':'%'+_0x4817aa[_0xcd29('0x2e')][_0xcd29('0x3b')]+'%'};return _0x265e7e;}})});}_0x5bf805=_[_0xcd29('0x38')]({},_0x5bf805,_0x4817aa[_0xcd29('0x3c')]);var _0x3af16e={'where':_0x5bf805[_0xcd29('0x37')]};return db[_0xcd29('0x3d')]['count'](_0x3af16e)[_0xcd29('0x25')](function(_0x579f61){_0x5adb95[_0xcd29('0x1f')]=_0x579f61;if(_0x4817aa[_0xcd29('0x2e')][_0xcd29('0x3e')]){_0x5bf805[_0xcd29('0x3f')]=[{'all':!![]}];}return db[_0xcd29('0x3d')][_0xcd29('0x40')](_0x5bf805);})[_0xcd29('0x25')](function(_0xe28bc4){_0x5adb95[_0xcd29('0x41')]=_0xe28bc4;return _0x5adb95;})[_0xcd29('0x25')](respondWithFilteredResult(_0x4c35d3,_0x5bf805))['catch'](handleError(_0x4c35d3,null));};exports[_0xcd29('0x42')]=function(_0x17457d,_0x1ed936){var _0xa0039f={'raw':!![],'where':{'id':_0x17457d[_0xcd29('0x43')]['id']}},_0x2acde4={};_0x2acde4[_0xcd29('0x2d')]=_[_0xcd29('0x44')](db[_0xcd29('0x3d')]['rawAttributes']);_0x2acde4[_0xcd29('0x2e')]=_[_0xcd29('0x44')](_0x17457d[_0xcd29('0x2e')]);_0x2acde4[_0xcd29('0x36')]=_[_0xcd29('0x2f')](_0x2acde4[_0xcd29('0x2d')],_0x2acde4[_0xcd29('0x2e')]);_0xa0039f['attributes']=_[_0xcd29('0x2f')](_0x2acde4[_0xcd29('0x2d')],qs[_0xcd29('0x30')](_0x17457d[_0xcd29('0x2e')]['fields']));_0xa0039f[_0xcd29('0x31')]=_0xa0039f[_0xcd29('0x31')][_0xcd29('0x32')]?_0xa0039f[_0xcd29('0x31')]:_0x2acde4['model'];if(_0x17457d[_0xcd29('0x2e')][_0xcd29('0x3e')]){_0xa0039f[_0xcd29('0x3f')]=[{'all':!![]}];}_0xa0039f=_[_0xcd29('0x38')]({},_0xa0039f,_0x17457d[_0xcd29('0x3c')]);return db[_0xcd29('0x3d')][_0xcd29('0x45')](_0xa0039f)[_0xcd29('0x25')](handleEntityNotFound(_0x1ed936,null))['then'](respondWithResult(_0x1ed936,null))['catch'](handleError(_0x1ed936,null));};exports['create']=function(_0x59c163,_0x3f6444){return db['JscriptySessionReport'][_0xcd29('0x46')](_0x59c163['body'],{})[_0xcd29('0x25')](respondWithResult(_0x3f6444,0xc9))[_0xcd29('0x47')](handleError(_0x3f6444,null));};exports[_0xcd29('0x48')]=function(_0x687d9,_0x4f7746){if(_0x687d9[_0xcd29('0x49')]['id']){delete _0x687d9[_0xcd29('0x49')]['id'];}return db[_0xcd29('0x3d')][_0xcd29('0x45')]({'where':{'id':_0x687d9[_0xcd29('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f7746,null))[_0xcd29('0x25')](saveUpdates(_0x687d9[_0xcd29('0x49')],null))[_0xcd29('0x25')](respondWithResult(_0x4f7746,null))[_0xcd29('0x47')](handleError(_0x4f7746,null));};exports[_0xcd29('0x26')]=function(_0x5a13f3,_0x36d82d){return db['JscriptySessionReport'][_0xcd29('0x45')]({'where':{'id':_0x5a13f3[_0xcd29('0x43')]['id']}})[_0xcd29('0x25')](handleEntityNotFound(_0x36d82d,null))['then'](removeEntity(_0x36d82d,null))[_0xcd29('0x47')](handleError(_0x36d82d,null));};exports[_0xcd29('0x4a')]=function(_0x38f845,_0x425973){return db[_0xcd29('0x3d')][_0xcd29('0x4a')]()[_0xcd29('0x25')](respondWithResult(_0x425973,null))[_0xcd29('0x47')](handleError(_0x425973,null));};exports['getQuestions']=function(_0x5604ed,_0x35b09d,_0x1a6f3b){var _0x5e4557={'raw':!![],'where':{}};var _0x1b9b43={};var _0x57c228={'count':0x0,'rows':[]};return db[_0xcd29('0x3d')][_0xcd29('0x4b')]({'where':{'id':_0x5604ed[_0xcd29('0x43')]['id']}})[_0xcd29('0x25')](handleEntityNotFound(_0x35b09d,null))[_0xcd29('0x25')](function(_0x356265){if(_0x356265){_0x1b9b43[_0xcd29('0x2d')]=_[_0xcd29('0x44')](db[_0xcd29('0x4c')][_0xcd29('0x4d')]);_0x1b9b43['query']=_['keys'](_0x5604ed['query']);_0x1b9b43[_0xcd29('0x36')]=_[_0xcd29('0x2f')](_0x1b9b43[_0xcd29('0x2d')],_0x1b9b43[_0xcd29('0x2e')]);_0x5e4557[_0xcd29('0x31')]=_[_0xcd29('0x2f')](_0x1b9b43[_0xcd29('0x2d')],qs[_0xcd29('0x30')](_0x5604ed[_0xcd29('0x2e')][_0xcd29('0x30')]));_0x5e4557[_0xcd29('0x31')]=_0x5e4557[_0xcd29('0x31')][_0xcd29('0x32')]?_0x5e4557[_0xcd29('0x31')]:_0x1b9b43['model'];if(!_0x5604ed[_0xcd29('0x2e')][_0xcd29('0x33')](_0xcd29('0x34'))){_0x5e4557[_0xcd29('0x1e')]=qs[_0xcd29('0x1e')](_0x5604ed['query'][_0xcd29('0x1e')]);_0x5e4557[_0xcd29('0x1c')]=qs[_0xcd29('0x1c')](_0x5604ed[_0xcd29('0x2e')][_0xcd29('0x1c')]);}_0x5e4557[_0xcd29('0x4e')]=qs[_0xcd29('0x35')](_0x5604ed[_0xcd29('0x2e')]['sort']);_0x5e4557[_0xcd29('0x37')]=qs['filters'](_['pick'](_0x5604ed[_0xcd29('0x2e')],_0x1b9b43[_0xcd29('0x36')]));_0x5e4557['where'][_0xcd29('0x4f')]=_0x356265['id'];if(_0x5604ed[_0xcd29('0x2e')][_0xcd29('0x3b')]){_0x5e4557[_0xcd29('0x37')]=_[_0xcd29('0x38')](_0x5e4557['where'],{'$or':_['map'](_0x5e4557[_0xcd29('0x31')],function(_0x44e99c){var _0x27f796={};_0x27f796[_0x44e99c]={'$like':'%'+_0x5604ed[_0xcd29('0x2e')][_0xcd29('0x3b')]+'%'};return _0x27f796;})});}_0x5e4557=_['merge']({},_0x5e4557,_0x5604ed[_0xcd29('0x3c')]);return db[_0xcd29('0x4c')][_0xcd29('0x1f')]({'where':_0x5e4557['where']})[_0xcd29('0x25')](function(_0x57047d){_0x57c228[_0xcd29('0x1f')]=_0x57047d;if(_0x5604ed['query'][_0xcd29('0x3e')]){_0x5e4557[_0xcd29('0x3f')]=[{'all':!![]}];}return db[_0xcd29('0x4c')][_0xcd29('0x40')](_0x5e4557);})['then'](function(_0x5d9177){_0x57c228[_0xcd29('0x41')]=_0x5d9177;return _0x57c228;});}})[_0xcd29('0x25')](respondWithFilteredResult(_0x35b09d,_0x5e4557))['catch'](handleError(_0x35b09d,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 56f65a0..abd8309 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 _0x3baf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x3baf,0xf7));var _0xf3ba=function(_0x1119c8,_0x87303e){_0x1119c8=_0x1119c8-0x0;var _0x3f3071=_0x3baf[_0x1119c8];return _0x3f3071;};'use strict';var _=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var logger=require(_0xf3ba('0x2'))(_0xf3ba('0x3'));var moment=require(_0xf3ba('0x4'));var BPromise=require(_0xf3ba('0x5'));var rp=require(_0xf3ba('0x6'));var fs=require('fs');var path=require(_0xf3ba('0x7'));var rimraf=require(_0xf3ba('0x8'));var config=require(_0xf3ba('0x9'));var attributes=require(_0xf3ba('0xa'));module[_0xf3ba('0xb')]=function(_0x475268,_0x2e6df2){return _0x475268[_0xf3ba('0xc')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f4d=['api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x343a48,_0x3cae0d){_0x343a48=_0x343a48-0x0;var _0x466aba=_0x0f4d[_0x343a48];return _0x466aba;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd0f4('0x0'));var moment=require('moment');var BPromise=require(_0xd0f4('0x1'));var rp=require(_0xd0f4('0x2'));var fs=require('fs');var path=require(_0xd0f4('0x3'));var rimraf=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var attributes=require(_0xd0f4('0x6'));module[_0xd0f4('0x7')]=function(_0x1d9a9d,_0x531f85){return _0x1d9a9d[_0xd0f4('0x8')](_0xd0f4('0x9'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 6c74223..f8b150c 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 _0x6d38=['request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x8074b4,_0x55a036){var _0x2f15f5=function(_0x4113eb){while(--_0x4113eb){_0x8074b4['push'](_0x8074b4['shift']());}};_0x2f15f5(++_0x55a036);}(_0x6d38,0x1ef));var _0x86d3=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x6d38[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file +var _0x81c6=['stringify','code','error','message','info','result','catch','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x81c6,0x1d5));var _0x681c=function(_0x384fc4,_0x1740d6){_0x384fc4=_0x384fc4-0x0;var _0x292817=_0x81c6[_0x384fc4];return _0x292817;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45331,_0xdc57a5,_0x5624d7){return new BPromise(function(_0x5b5f22,_0x1750e2){return client[_0x681c('0x8')](_0x45331,_0x5624d7)[_0x681c('0x9')](function(_0x5de78e){logger['info'](_0x681c('0xa'),_0xdc57a5,'request\x20sent');logger[_0x681c('0xb')](_0x681c('0xc'),_0xdc57a5,_0x681c('0xd'),JSON[_0x681c('0xe')](_0x5de78e));if(_0x5de78e['error']){if(_0x5de78e['error'][_0x681c('0xf')]===0x1f4){logger[_0x681c('0x10')](_0x681c('0xa'),_0xdc57a5,_0x5de78e['error'][_0x681c('0x11')]);return _0x1750e2(_0x5de78e['error'][_0x681c('0x11')]);}logger['error'](_0x681c('0xa'),_0xdc57a5,_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);return _0x5b5f22(_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);}else{logger[_0x681c('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0xdc57a5,_0x681c('0xd'));_0x5b5f22(_0x5de78e[_0x681c('0x13')][_0x681c('0x11')]);}})[_0x681c('0x14')](function(_0x2fce11){logger[_0x681c('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0xdc57a5,_0x2fce11);_0x1750e2(_0x2fce11);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 342009e..30356c5 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 _0xdeff=['exports','multer','util','path','express','Router','fs-extra','../../config/environment','./license.controller','get','index','put','/:id','update','/download_log_file','isAuthenticated','downloadLogFile'];(function(_0x4132d1,_0x41fbbd){var _0x27d9cb=function(_0x121a69){while(--_0x121a69){_0x4132d1['push'](_0x4132d1['shift']());}};_0x27d9cb(++_0x41fbbd);}(_0xdeff,0xcd));var _0xfdef=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0xdeff[_0x256e32];return _0x464070;};'use strict';var multer=require(_0xfdef('0x0'));var util=require(_0xfdef('0x1'));var path=require(_0xfdef('0x2'));var timeout=require('connect-timeout');var express=require(_0xfdef('0x3'));var router=express[_0xfdef('0x4')]();var fs_extra=require(_0xfdef('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfdef('0x6'));var controller=require(_0xfdef('0x7'));router[_0xfdef('0x8')]('/',controller[_0xfdef('0x9')]);router[_0xfdef('0xa')](_0xfdef('0xb'),auth['isAuthenticated'](),controller[_0xfdef('0xc')]);router[_0xfdef('0x8')](_0xfdef('0xd'),auth[_0xfdef('0xe')](),controller[_0xfdef('0xf')]);module[_0xfdef('0x10')]=router; \ No newline at end of file +var _0xe6b4=['./license.controller','get','index','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x317732,_0x1cdb14){var _0x3bb06a=function(_0x20a943){while(--_0x20a943){_0x317732['push'](_0x317732['shift']());}};_0x3bb06a(++_0x1cdb14);}(_0xe6b4,0x188));var _0x4e6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6b4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4e6b('0x0'));var util=require(_0x4e6b('0x1'));var path=require(_0x4e6b('0x2'));var timeout=require(_0x4e6b('0x3'));var express=require(_0x4e6b('0x4'));var router=express[_0x4e6b('0x5')]();var fs_extra=require(_0x4e6b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4e6b('0x7'));var config=require('../../config/environment');var controller=require(_0x4e6b('0x8'));router[_0x4e6b('0x9')]('/',controller[_0x4e6b('0xa')]);router['put'](_0x4e6b('0xb'),auth[_0x4e6b('0xc')](),controller[_0x4e6b('0xd')]);router[_0x4e6b('0x9')](_0x4e6b('0xe'),auth[_0x4e6b('0xc')](),controller[_0x4e6b('0xf')]);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 3f3cfb0..4f705cd 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 _0x5857=['STRING','INTEGER','sequelize','TEXT'];(function(_0x57dade,_0x3de752){var _0x4379b3=function(_0x1dccf2){while(--_0x1dccf2){_0x57dade['push'](_0x57dade['shift']());}};_0x4379b3(++_0x3de752);}(_0x5857,0xb2));var _0x7585=function(_0xb032c6,_0x3509aa){_0xb032c6=_0xb032c6-0x0;var _0x4a182d=_0x5857[_0xb032c6];return _0x4a182d;};'use strict';var Sequelize=require(_0x7585('0x0'));module['exports']={'license':{'type':Sequelize[_0x7585('0x1')]},'data1':{'type':Sequelize[_0x7585('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x7585('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa28a=['exports','STRING','INTEGER','sequelize'];(function(_0x54b892,_0x2a3009){var _0x1256e1=function(_0x32278b){while(--_0x32278b){_0x54b892['push'](_0x54b892['shift']());}};_0x1256e1(++_0x2a3009);}(_0xa28a,0x197));var _0xaa28=function(_0x870bd,_0xaf1c4b){_0x870bd=_0x870bd-0x0;var _0x5ba5e5=_0xa28a[_0x870bd];return _0x5ba5e5;};'use strict';var Sequelize=require(_0xaa28('0x0'));module[_0xaa28('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xaa28('0x2')]},'data2':{'type':Sequelize[_0xaa28('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xaa28('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 732a814..f17f763 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 _0x58e9=['attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','key','demo','downloadLogFile','license-info.log','/var','log','xcally','setHeader','Content-disposition','Content-Type','text/plain','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','License','rawAttributes','filters','intersection','model','query'];(function(_0x114ae4,_0x14bdc9){var _0x32f566=function(_0x4f3fd1){while(--_0x4f3fd1){_0x114ae4['push'](_0x114ae4['shift']());}};_0x32f566(++_0x14bdc9);}(_0x58e9,0x13b));var _0x958e=function(_0x3816a7,_0x3db222){_0x3816a7=_0x3816a7-0x0;var _0x4670ab=_0x58e9[_0x3816a7];return _0x4670ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x958e('0x0'));var zipdir=require(_0x958e('0x1'));var jsonpatch=require(_0x958e('0x2'));var rp=require(_0x958e('0x3'));var moment=require(_0x958e('0x4'));var BPromise=require(_0x958e('0x5'));var Mustache=require(_0x958e('0x6'));var util=require('util');var path=require(_0x958e('0x7'));var sox=require(_0x958e('0x8'));var csv=require(_0x958e('0x9'));var ejs=require(_0x958e('0xa'));var fs=require('fs');var fs_extra=require(_0x958e('0xb'));var _=require('lodash');var squel=require(_0x958e('0xc'));var crypto=require(_0x958e('0xd'));var jsforce=require(_0x958e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x958e('0x9'));var querystring=require(_0x958e('0xf'));var Papa=require(_0x958e('0x10'));var Redis=require(_0x958e('0x11'));var authService=require(_0x958e('0x12'));var qs=require(_0x958e('0x13'));var as=require(_0x958e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x958e('0x15'))(_0x958e('0x16'));var utils=require('../../config/utils');var config=require(_0x958e('0x17'));var licenseUtil=require(_0x958e('0x18'));var db=require(_0x958e('0x19'))['db'];function respondWithStatusCode(_0x50b784,_0x3ec445){_0x3ec445=_0x3ec445||0xcc;return function(_0x32d10a){if(_0x32d10a){return _0x50b784[_0x958e('0x1a')](_0x3ec445);}return _0x50b784[_0x958e('0x1b')](_0x3ec445)[_0x958e('0x1c')]();};}function respondWithResult(_0x113631,_0x6e8d2a){_0x6e8d2a=_0x6e8d2a||0xc8;return function(_0x3ec566){if(_0x3ec566){return _0x113631[_0x958e('0x1b')](_0x6e8d2a)['json'](_0x3ec566);}};}function respondWithFilteredResult(_0x58591d,_0xe65703){return function(_0xd1e600){if(_0xd1e600){var _0x5ba179=typeof _0xe65703[_0x958e('0x1d')]==='undefined'&&typeof _0xe65703[_0x958e('0x1e')]===_0x958e('0x1f');var _0x241c18=_0xd1e600['count'];var _0x2e86b5=_0x5ba179?0x0:_0xe65703['offset'];var _0x14c9bc=_0x5ba179?_0xd1e600[_0x958e('0x20')]:_0xe65703[_0x958e('0x1d')]+_0xe65703[_0x958e('0x1e')];var _0x3d2d1c;if(_0x14c9bc>=_0x241c18){_0x14c9bc=_0x241c18;_0x3d2d1c=0xc8;}else{_0x3d2d1c=0xce;}_0x58591d['status'](_0x3d2d1c);return _0x58591d[_0x958e('0x21')](_0x958e('0x22'),_0x2e86b5+'-'+_0x14c9bc+'/'+_0x241c18)['json'](_0xd1e600);}return null;};}function patchUpdates(_0x46a544){return function(_0x9da0b6){try{jsonpatch['apply'](_0x9da0b6,_0x46a544,!![]);}catch(_0x26b4be){return BPromise[_0x958e('0x23')](_0x26b4be);}return _0x9da0b6[_0x958e('0x24')]();};}function saveUpdates(_0xd932d8,_0x355f15){return function(_0x7a53c3){if(_0x7a53c3){return _0x7a53c3[_0x958e('0x25')](_0xd932d8)[_0x958e('0x26')](function(_0x528cdf){return _0x528cdf;});}return null;};}function removeEntity(_0x19ad1b,_0x54b75b){return function(_0x540bfa){if(_0x540bfa){return _0x540bfa['destroy']()['then'](function(){_0x19ad1b[_0x958e('0x1b')](0xcc)[_0x958e('0x1c')]();});}};}function handleEntityNotFound(_0x3cd966,_0x2fe423){return function(_0x381155){if(!_0x381155){_0x3cd966[_0x958e('0x1a')](0x194);}return _0x381155;};}function handleError(_0xc09e6e,_0x12087d){_0x12087d=_0x12087d||0x1f4;return function(_0x34318c){logger[_0x958e('0x27')](_0x34318c[_0x958e('0x28')]);if(_0x34318c['name']){delete _0x34318c[_0x958e('0x29')];}_0xc09e6e[_0x958e('0x1b')](_0x12087d)[_0x958e('0x2a')](_0x34318c);};}var utilLicense=require(_0x958e('0x18'));exports[_0x958e('0x2b')]=function(_0x4691e9,_0x2bc1fc){var _0x35e67e={'raw':!![],'where':{'id':0x1}},_0x669af={};_0x669af['model']=_['keys'](db[_0x958e('0x2c')][_0x958e('0x2d')]);_0x669af['query']=_['keys'](_0x4691e9['query']);_0x669af[_0x958e('0x2e')]=_[_0x958e('0x2f')](_0x669af[_0x958e('0x30')],_0x669af[_0x958e('0x31')]);_0x35e67e[_0x958e('0x32')]=_['intersection'](_0x669af['model'],qs[_0x958e('0x33')](_0x4691e9[_0x958e('0x31')][_0x958e('0x33')]));_0x35e67e[_0x958e('0x32')]=_0x35e67e[_0x958e('0x32')][_0x958e('0x34')]?_0x35e67e[_0x958e('0x32')]:_0x669af['model'];_0x35e67e=_[_0x958e('0x35')]({},_0x35e67e,_0x4691e9[_0x958e('0x36')]);return utilLicense[_0x958e('0x37')](_0x35e67e)[_0x958e('0x26')](respondWithResult(_0x2bc1fc,null))[_0x958e('0x38')](handleError(_0x2bc1fc,null));};exports[_0x958e('0x25')]=function(_0x1db652,_0xb9c3cc){if(_0x1db652[_0x958e('0x39')]['id']){delete _0x1db652[_0x958e('0x39')]['id'];}return db[_0x958e('0x2c')][_0x958e('0x3a')]({'where':{'id':_0x1db652[_0x958e('0x3b')]['id']}})[_0x958e('0x26')](handleEntityNotFound(_0xb9c3cc,null))[_0x958e('0x26')](function(_0x54a12f){var _0x206ebc=_0x54a12f[_0x958e('0x3c')]({'plain':!![]});return utilLicense['checkLicense'](_0x206ebc,_0x1db652[_0x958e('0x39')][_0x958e('0x3d')]);})[_0x958e('0x26')](function(_0xf7fb95){if(!_0xf7fb95[_0x958e('0x3e')]){return saveUpdates(_0x1db652[_0x958e('0x39')],null);}return _0xf7fb95;})[_0x958e('0x26')](respondWithResult(_0xb9c3cc,null))[_0x958e('0x38')](handleError(_0xb9c3cc,null));};exports[_0x958e('0x3f')]=function(_0x5c8505,_0xc361de){var _0x586c6d=_0x958e('0x40');var _0x454949=path['join'](_0x958e('0x41'),_0x958e('0x42'),_0x958e('0x43'),_0x586c6d);_0xc361de[_0x958e('0x44')](_0x958e('0x45'),'attachment;\x20filename='+_0x586c6d);_0xc361de[_0x958e('0x21')](_0x958e('0x46'),_0x958e('0x47'));_0xc361de[_0x958e('0x48')](_0x454949);}; \ No newline at end of file +var _0x4fca=['attributes','fields','length','options','catch','update','body','find','params','checkLicense','key','demo','downloadLogFile','license-info.log','join','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','name','send','index','model','keys','License','rawAttributes','query','filters','intersection'];(function(_0x316e12,_0x572f52){var _0x3879f7=function(_0xef57b){while(--_0xef57b){_0x316e12['push'](_0x316e12['shift']());}};_0x3879f7(++_0x572f52);}(_0x4fca,0xe1));var _0xa4fc=function(_0x5a5751,_0x4d60c4){_0x5a5751=_0x5a5751-0x0;var _0x318493=_0x4fca[_0x5a5751];return _0x318493;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa4fc('0x0'));var zipdir=require(_0xa4fc('0x1'));var jsonpatch=require(_0xa4fc('0x2'));var rp=require('request-promise');var moment=require(_0xa4fc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa4fc('0x4'));var util=require('util');var path=require(_0xa4fc('0x5'));var sox=require(_0xa4fc('0x6'));var csv=require(_0xa4fc('0x7'));var ejs=require(_0xa4fc('0x8'));var fs=require('fs');var fs_extra=require(_0xa4fc('0x9'));var _=require(_0xa4fc('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa4fc('0xb'));var deskjs=require(_0xa4fc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa4fc('0xd'));var Papa=require(_0xa4fc('0xe'));var Redis=require('ioredis');var authService=require(_0xa4fc('0xf'));var qs=require(_0xa4fc('0x10'));var as=require(_0xa4fc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4fc('0x12'))(_0xa4fc('0x13'));var utils=require(_0xa4fc('0x14'));var config=require(_0xa4fc('0x15'));var licenseUtil=require(_0xa4fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x336f94,_0x32f247){_0x32f247=_0x32f247||0xcc;return function(_0x487861){if(_0x487861){return _0x336f94[_0xa4fc('0x17')](_0x32f247);}return _0x336f94['status'](_0x32f247)[_0xa4fc('0x18')]();};}function respondWithResult(_0x11dd6b,_0x2757dc){_0x2757dc=_0x2757dc||0xc8;return function(_0x5ae6bc){if(_0x5ae6bc){return _0x11dd6b[_0xa4fc('0x19')](_0x2757dc)[_0xa4fc('0x1a')](_0x5ae6bc);}};}function respondWithFilteredResult(_0x1713af,_0xa100c1){return function(_0x98610b){if(_0x98610b){var _0x25a502=typeof _0xa100c1['offset']===_0xa4fc('0x1b')&&typeof _0xa100c1[_0xa4fc('0x1c')]===_0xa4fc('0x1b');var _0x361c8b=_0x98610b[_0xa4fc('0x1d')];var _0x1bd4bf=_0x25a502?0x0:_0xa100c1[_0xa4fc('0x1e')];var _0x1bdfc1=_0x25a502?_0x98610b['count']:_0xa100c1['offset']+_0xa100c1[_0xa4fc('0x1c')];var _0x301668;if(_0x1bdfc1>=_0x361c8b){_0x1bdfc1=_0x361c8b;_0x301668=0xc8;}else{_0x301668=0xce;}_0x1713af[_0xa4fc('0x19')](_0x301668);return _0x1713af[_0xa4fc('0x1f')](_0xa4fc('0x20'),_0x1bd4bf+'-'+_0x1bdfc1+'/'+_0x361c8b)['json'](_0x98610b);}return null;};}function patchUpdates(_0x1e41b4){return function(_0x1398ad){try{jsonpatch['apply'](_0x1398ad,_0x1e41b4,!![]);}catch(_0x1d7478){return BPromise[_0xa4fc('0x21')](_0x1d7478);}return _0x1398ad[_0xa4fc('0x22')]();};}function saveUpdates(_0xb31145,_0x538e17){return function(_0x4a788b){if(_0x4a788b){return _0x4a788b['update'](_0xb31145)[_0xa4fc('0x23')](function(_0x2d2573){return _0x2d2573;});}return null;};}function removeEntity(_0x1ddef3,_0x182d70){return function(_0x138617){if(_0x138617){return _0x138617[_0xa4fc('0x24')]()['then'](function(){_0x1ddef3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f6c31,_0x350826){return function(_0x2bf34c){if(!_0x2bf34c){_0x1f6c31[_0xa4fc('0x17')](0x194);}return _0x2bf34c;};}function handleError(_0x269434,_0x3cadff){_0x3cadff=_0x3cadff||0x1f4;return function(_0x17564c){logger['error'](_0x17564c['stack']);if(_0x17564c[_0xa4fc('0x25')]){delete _0x17564c['name'];}_0x269434[_0xa4fc('0x19')](_0x3cadff)[_0xa4fc('0x26')](_0x17564c);};}var utilLicense=require(_0xa4fc('0x16'));exports[_0xa4fc('0x27')]=function(_0xaef42f,_0x1d131a){var _0x145d66={'raw':!![],'where':{'id':0x1}},_0x348e42={};_0x348e42[_0xa4fc('0x28')]=_[_0xa4fc('0x29')](db[_0xa4fc('0x2a')][_0xa4fc('0x2b')]);_0x348e42[_0xa4fc('0x2c')]=_[_0xa4fc('0x29')](_0xaef42f[_0xa4fc('0x2c')]);_0x348e42[_0xa4fc('0x2d')]=_[_0xa4fc('0x2e')](_0x348e42[_0xa4fc('0x28')],_0x348e42['query']);_0x145d66[_0xa4fc('0x2f')]=_['intersection'](_0x348e42[_0xa4fc('0x28')],qs[_0xa4fc('0x30')](_0xaef42f[_0xa4fc('0x2c')][_0xa4fc('0x30')]));_0x145d66['attributes']=_0x145d66['attributes'][_0xa4fc('0x31')]?_0x145d66[_0xa4fc('0x2f')]:_0x348e42[_0xa4fc('0x28')];_0x145d66=_['merge']({},_0x145d66,_0xaef42f[_0xa4fc('0x32')]);return utilLicense['getLicense'](_0x145d66)['then'](respondWithResult(_0x1d131a,null))[_0xa4fc('0x33')](handleError(_0x1d131a,null));};exports[_0xa4fc('0x34')]=function(_0x2e9647,_0x263918){if(_0x2e9647[_0xa4fc('0x35')]['id']){delete _0x2e9647['body']['id'];}return db[_0xa4fc('0x2a')][_0xa4fc('0x36')]({'where':{'id':_0x2e9647[_0xa4fc('0x37')]['id']}})[_0xa4fc('0x23')](handleEntityNotFound(_0x263918,null))[_0xa4fc('0x23')](function(_0x5daedb){var _0x275f49=_0x5daedb['get']({'plain':!![]});return utilLicense[_0xa4fc('0x38')](_0x275f49,_0x2e9647[_0xa4fc('0x35')][_0xa4fc('0x39')]);})[_0xa4fc('0x23')](function(_0x49b873){if(!_0x49b873[_0xa4fc('0x3a')]){return saveUpdates(_0x2e9647['body'],null);}return _0x49b873;})[_0xa4fc('0x23')](respondWithResult(_0x263918,null))['catch'](handleError(_0x263918,null));};exports[_0xa4fc('0x3b')]=function(_0x5353ab,_0x427472){var _0x5ecf92=_0xa4fc('0x3c');var _0x676e5e=path[_0xa4fc('0x3d')]('/var','log',_0xa4fc('0x3e'),_0x5ecf92);_0x427472[_0xa4fc('0x3f')](_0xa4fc('0x40'),_0xa4fc('0x41')+_0x5ecf92);_0x427472[_0xa4fc('0x1f')](_0xa4fc('0x42'),_0xa4fc('0x43'));_0x427472['download'](_0x676e5e);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 8798b7f..10df969 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 _0xd9d2=['./license.attributes','exports','define','License','license','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x32182e,_0x49452a){var _0x599a7e=function(_0x47ce9c){while(--_0x47ce9c){_0x32182e['push'](_0x32182e['shift']());}};_0x599a7e(++_0x49452a);}(_0xd9d2,0x1b2));var _0x2d9d=function(_0x2210df,_0x35e48c){_0x2210df=_0x2210df-0x0;var _0x52292b=_0xd9d2[_0x2210df];return _0x52292b;};'use strict';var _=require('lodash');var util=require(_0x2d9d('0x0'));var logger=require(_0x2d9d('0x1'))(_0x2d9d('0x2'));var moment=require(_0x2d9d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d9d('0x4'));var rimraf=require('rimraf');var config=require(_0x2d9d('0x5'));var attributes=require(_0x2d9d('0x6'));module[_0x2d9d('0x7')]=function(_0x4a9422,_0x127c24){return _0x4a9422[_0x2d9d('0x8')](_0x2d9d('0x9'),attributes,{'tableName':_0x2d9d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90b3=['exports','define','license','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./license.attributes'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x90b3,0x123));var _0x390b=function(_0x271a79,_0x2e2752){_0x271a79=_0x271a79-0x0;var _0x239a3e=_0x90b3[_0x271a79];return _0x239a3e;};'use strict';var _=require(_0x390b('0x0'));var util=require(_0x390b('0x1'));var logger=require(_0x390b('0x2'))(_0x390b('0x3'));var moment=require(_0x390b('0x4'));var BPromise=require('bluebird');var rp=require(_0x390b('0x5'));var fs=require('fs');var path=require(_0x390b('0x6'));var rimraf=require(_0x390b('0x7'));var config=require('../../config/environment');var attributes=require(_0x390b('0x8'));module[_0x390b('0x9')]=function(_0xe452ef,_0x449ef0){return _0xe452ef[_0x390b('0xa')]('License',attributes,{'tableName':_0x390b('0xb'),'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 cb3f5b9..c8058a2 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 _0x656a=['../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','License,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x656a,0x10d));var _0xa656=function(_0x135704,_0x539aee){_0x135704=_0x135704-0x0;var _0x24e9fd=_0x656a[_0x135704];return _0x24e9fd;};'use strict';var _=require('lodash');var util=require(_0xa656('0x0'));var moment=require(_0xa656('0x1'));var BPromise=require('bluebird');var rs=require(_0xa656('0x2'));var fs=require('fs');var Redis=require(_0xa656('0x3'));var db=require(_0xa656('0x4'))['db'];var utils=require(_0xa656('0x5'));var logger=require(_0xa656('0x6'))(_0xa656('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa656('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d8b61,_0x7c3b46,_0x2006b3){return new BPromise(function(_0x55358b,_0x4f0979){return client[_0xa656('0x9')](_0x1d8b61,_0x2006b3)[_0xa656('0xa')](function(_0x492d39){logger[_0xa656('0xb')]('License,\x20%s,\x20%s',_0x7c3b46,'request\x20sent');logger[_0xa656('0xc')](_0xa656('0xd'),_0x7c3b46,_0xa656('0xe'),JSON['stringify'](_0x492d39));if(_0x492d39['error']){if(_0x492d39[_0xa656('0xf')][_0xa656('0x10')]===0x1f4){logger[_0xa656('0xf')](_0xa656('0x11'),_0x7c3b46,_0x492d39[_0xa656('0xf')][_0xa656('0x12')]);return _0x4f0979(_0x492d39[_0xa656('0xf')][_0xa656('0x12')]);}logger[_0xa656('0xf')](_0xa656('0x11'),_0x7c3b46,_0x492d39[_0xa656('0xf')][_0xa656('0x12')]);return _0x55358b(_0x492d39[_0xa656('0xf')][_0xa656('0x12')]);}else{logger['info'](_0xa656('0x11'),_0x7c3b46,_0xa656('0xe'));_0x55358b(_0x492d39[_0xa656('0x13')][_0xa656('0x12')]);}})[_0xa656('0x14')](function(_0xcfda9c){logger[_0xa656('0xf')](_0xa656('0x11'),_0x7c3b46,_0xcfda9c);_0x4f0979(_0xcfda9c);});});} \ No newline at end of file +var _0xd910=['License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug'];(function(_0x3861ac,_0x2fe1c5){var _0x1e7aba=function(_0x48a53e){while(--_0x48a53e){_0x3861ac['push'](_0x3861ac['shift']());}};_0x1e7aba(++_0x2fe1c5);}(_0xd910,0x14a));var _0x0d91=function(_0x1d43bd,_0x2e07d3){_0x1d43bd=_0x1d43bd-0x0;var _0x4f67e3=_0xd910[_0x1d43bd];return _0x4f67e3;};'use strict';var _=require(_0x0d91('0x0'));var util=require(_0x0d91('0x1'));var moment=require(_0x0d91('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d91('0x3'));var fs=require('fs');var Redis=require(_0x0d91('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d91('0x5'));var logger=require(_0x0d91('0x6'))(_0x0d91('0x7'));var config=require(_0x0d91('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0d91('0x9')][_0x0d91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52530c,_0x5e99d4,_0x237bf8){return new BPromise(function(_0x358629,_0x58b4b5){return client[_0x0d91('0xb')](_0x52530c,_0x237bf8)['then'](function(_0xa000b3){logger[_0x0d91('0xc')]('License,\x20%s,\x20%s',_0x5e99d4,_0x0d91('0xd'));logger[_0x0d91('0xe')](_0x0d91('0xf'),_0x5e99d4,_0x0d91('0xd'),JSON[_0x0d91('0x10')](_0xa000b3));if(_0xa000b3[_0x0d91('0x11')]){if(_0xa000b3[_0x0d91('0x11')][_0x0d91('0x12')]===0x1f4){logger[_0x0d91('0x11')](_0x0d91('0x13'),_0x5e99d4,_0xa000b3[_0x0d91('0x11')][_0x0d91('0x14')]);return _0x58b4b5(_0xa000b3[_0x0d91('0x11')][_0x0d91('0x14')]);}logger[_0x0d91('0x11')]('License,\x20%s,\x20%s',_0x5e99d4,_0xa000b3['error']['message']);return _0x358629(_0xa000b3['error'][_0x0d91('0x14')]);}else{logger[_0x0d91('0xc')]('License,\x20%s,\x20%s',_0x5e99d4,_0x0d91('0xd'));_0x358629(_0xa000b3[_0x0d91('0x15')][_0x0d91('0x14')]);}})[_0x0d91('0x16')](function(_0x53d7c6){logger['error'](_0x0d91('0x13'),_0x5e99d4,_0x53d7c6);_0x58b4b5(_0x53d7c6);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 1df430f..132459c 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 _0x9077=['/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addImap','/:id/out_servers','/:id/interactions','addInteraction','addApplications','/:id/send','addAgents','put','delete','removeDispositions','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/:id','show','/:id/dispositions','getDispositions','/:id/in_servers','getSmtp','getInteractions','/:id/applications','getApplications'];(function(_0x513ecf,_0x1b556a){var _0x395e99=function(_0x5a4de7){while(--_0x5a4de7){_0x513ecf['push'](_0x513ecf['shift']());}};_0x395e99(++_0x1b556a);}(_0x9077,0xd1));var _0x7907=function(_0x23774a,_0x4a5bed){_0x23774a=_0x23774a-0x0;var _0x29c41c=_0x9077[_0x23774a];return _0x29c41c;};'use strict';var multer=require(_0x7907('0x0'));var util=require(_0x7907('0x1'));var path=require(_0x7907('0x2'));var timeout=require('connect-timeout');var express=require(_0x7907('0x3'));var router=express[_0x7907('0x4')]();var fs_extra=require(_0x7907('0x5'));var auth=require(_0x7907('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7907('0x7'));var controller=require(_0x7907('0x8'));router['get']('/',auth[_0x7907('0x9')](),controller[_0x7907('0xa')]);router[_0x7907('0xb')]('/describe',auth[_0x7907('0x9')](),controller['describe']);router[_0x7907('0xb')](_0x7907('0xc'),auth['isAuthenticated'](),controller[_0x7907('0xd')]);router[_0x7907('0xb')](_0x7907('0xe'),auth[_0x7907('0x9')](),controller[_0x7907('0xf')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0x7907('0xb')](_0x7907('0x10'),auth[_0x7907('0x9')](),controller['getImap']);router['get']('/:id/out_servers',auth[_0x7907('0x9')](),controller[_0x7907('0x11')]);router[_0x7907('0xb')]('/:id/interactions',auth[_0x7907('0x9')](),controller[_0x7907('0x12')]);router['get'](_0x7907('0x13'),auth['isAuthenticated'](),controller[_0x7907('0x14')]);router['get'](_0x7907('0x15'),auth[_0x7907('0x9')](),controller['getMessages']);router['get'](_0x7907('0x16'),auth[_0x7907('0x9')](),controller[_0x7907('0x17')]);router['get'](_0x7907('0x18'),auth[_0x7907('0x9')](),controller[_0x7907('0x19')]);router[_0x7907('0x1a')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x7907('0x1b')]);router[_0x7907('0x1a')](_0x7907('0x1c'),auth['isAuthenticated'](),controller[_0x7907('0x1d')]);router[_0x7907('0x1a')]('/',auth[_0x7907('0x9')](),controller[_0x7907('0x1e')]);router[_0x7907('0x1a')]('/:id/in_servers',auth[_0x7907('0x9')](),controller[_0x7907('0x1f')]);router[_0x7907('0x1a')](_0x7907('0x20'),auth[_0x7907('0x9')](),controller['addSmtp']);router['post'](_0x7907('0x21'),auth['isAuthenticated'](),controller[_0x7907('0x22')]);router[_0x7907('0x1a')](_0x7907('0x13'),auth['isAuthenticated'](),controller[_0x7907('0x23')]);router[_0x7907('0x1a')](_0x7907('0x24'),auth['isAuthenticated'](),controller['send']);router[_0x7907('0x1a')](_0x7907('0x18'),auth['isAuthenticated'](),controller[_0x7907('0x25')]);router[_0x7907('0x26')](_0x7907('0xc'),auth[_0x7907('0x9')](),controller['update']);router[_0x7907('0x27')](_0x7907('0xe'),auth['isAuthenticated'](),controller[_0x7907('0x28')]);router[_0x7907('0x27')]('/:id/canned_answers',auth[_0x7907('0x9')](),controller['removeAnswers']);router[_0x7907('0x27')](_0x7907('0x10'),auth[_0x7907('0x9')](),controller[_0x7907('0x29')]);router[_0x7907('0x27')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x7907('0x2a')]);router[_0x7907('0x27')](_0x7907('0xc'),auth[_0x7907('0x9')](),controller[_0x7907('0x2b')]);router[_0x7907('0x27')](_0x7907('0x18'),auth[_0x7907('0x9')](),controller[_0x7907('0x2c')]);module[_0x7907('0x2d')]=router; \ No newline at end of file +var _0x2d14=['addAgents','update','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeSmtp','destroy','removeAgents','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction'];(function(_0x4a1ca6,_0x53db81){var _0x5a0ae6=function(_0x5b60b6){while(--_0x5b60b6){_0x4a1ca6['push'](_0x4a1ca6['shift']());}};_0x5a0ae6(++_0x53db81);}(_0x2d14,0x1f4));var _0x42d1=function(_0x328cd4,_0x39eb2b){_0x328cd4=_0x328cd4-0x0;var _0x1e7c1a=_0x2d14[_0x328cd4];return _0x1e7c1a;};'use strict';var multer=require(_0x42d1('0x0'));var util=require('util');var path=require(_0x42d1('0x1'));var timeout=require('connect-timeout');var express=require(_0x42d1('0x2'));var router=express['Router']();var fs_extra=require(_0x42d1('0x3'));var auth=require(_0x42d1('0x4'));var interaction=require(_0x42d1('0x5'));var config=require(_0x42d1('0x6'));var controller=require(_0x42d1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x42d1('0x8')]);router[_0x42d1('0x9')](_0x42d1('0xa'),auth[_0x42d1('0xb')](),controller[_0x42d1('0xc')]);router[_0x42d1('0x9')](_0x42d1('0xd'),auth[_0x42d1('0xb')](),controller[_0x42d1('0xe')]);router[_0x42d1('0x9')](_0x42d1('0xf'),auth[_0x42d1('0xb')](),controller[_0x42d1('0x10')]);router[_0x42d1('0x9')]('/:id/canned_answers',auth[_0x42d1('0xb')](),controller[_0x42d1('0x11')]);router[_0x42d1('0x9')](_0x42d1('0x12'),auth[_0x42d1('0xb')](),controller[_0x42d1('0x13')]);router[_0x42d1('0x9')](_0x42d1('0x14'),auth[_0x42d1('0xb')](),controller[_0x42d1('0x15')]);router[_0x42d1('0x9')](_0x42d1('0x16'),auth[_0x42d1('0xb')](),controller[_0x42d1('0x17')]);router[_0x42d1('0x9')](_0x42d1('0x18'),auth[_0x42d1('0xb')](),controller[_0x42d1('0x19')]);router['get'](_0x42d1('0x1a'),auth[_0x42d1('0xb')](),controller[_0x42d1('0x1b')]);router[_0x42d1('0x9')](_0x42d1('0x1c'),auth[_0x42d1('0xb')](),controller[_0x42d1('0x1d')]);router[_0x42d1('0x9')](_0x42d1('0x1e'),auth[_0x42d1('0xb')](),controller[_0x42d1('0x1f')]);router[_0x42d1('0x20')](_0x42d1('0xf'),auth['isAuthenticated'](),controller[_0x42d1('0x21')]);router['post']('/:id/canned_answers',auth[_0x42d1('0xb')](),controller[_0x42d1('0x22')]);router[_0x42d1('0x20')]('/',auth[_0x42d1('0xb')](),controller[_0x42d1('0x23')]);router[_0x42d1('0x20')](_0x42d1('0x12'),auth['isAuthenticated'](),controller[_0x42d1('0x24')]);router[_0x42d1('0x20')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x42d1('0x25')]);router[_0x42d1('0x20')](_0x42d1('0x16'),auth['isAuthenticated'](),controller[_0x42d1('0x26')]);router[_0x42d1('0x20')](_0x42d1('0x18'),auth[_0x42d1('0xb')](),controller['addApplications']);router[_0x42d1('0x20')]('/:id/send',auth[_0x42d1('0xb')](),controller['send']);router['post'](_0x42d1('0x1e'),auth[_0x42d1('0xb')](),controller[_0x42d1('0x27')]);router['put'](_0x42d1('0xd'),auth[_0x42d1('0xb')](),controller[_0x42d1('0x28')]);router[_0x42d1('0x29')]('/:id/dispositions',auth[_0x42d1('0xb')](),controller[_0x42d1('0x2a')]);router[_0x42d1('0x29')](_0x42d1('0x2b'),auth[_0x42d1('0xb')](),controller[_0x42d1('0x2c')]);router['delete'](_0x42d1('0x12'),auth[_0x42d1('0xb')](),controller['removeImap']);router['delete']('/:id/out_servers',auth[_0x42d1('0xb')](),controller[_0x42d1('0x2d')]);router[_0x42d1('0x29')]('/:id',auth[_0x42d1('0xb')](),controller[_0x42d1('0x2e')]);router[_0x42d1('0x29')](_0x42d1('0x1e'),auth[_0x42d1('0xb')](),controller[_0x42d1('0x2f')]);module[_0x42d1('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 72bebcb..f375c35 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 _0x45df=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom','STRING','BOOLEAN','TEXT','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x144cf1,_0x10dda6){var _0x13cfa6=function(_0x48adb1){while(--_0x48adb1){_0x144cf1['push'](_0x144cf1['shift']());}};_0x13cfa6(++_0x10dda6);}(_0x45df,0xb4));var _0xf45d=function(_0x214547,_0x5041f1){_0x214547=_0x214547-0x0;var _0x59405a=_0x45df[_0x214547];return _0x59405a;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xf45d('0x0')]},'name':{'type':Sequelize[_0xf45d('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0xf45d('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xf45d('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xf45d('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0xf45d('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0xf45d('0x2')]},'markAsUnread':{'type':Sequelize[_0xf45d('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xf45d('0x0')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xf45d('0x3')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf45d('0x4');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf45d('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf45d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf45d('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf45d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf45d('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf45d('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf45d('0x1')],'defaultValue':![],'comment':_0xf45d('0x6'),'set':function(_0x7077ff){if(!_0x7077ff)this[_0xf45d('0x7')](_0xf45d('0x8'),null);this[_0xf45d('0x7')](_0xf45d('0x9'),_0x7077ff);}},'provider':{'type':Sequelize[_0xf45d('0xa')](_0xf45d('0xb'),_0xf45d('0xc'),_0xf45d('0xd'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0xf45d('0xe')](_0xf45d('0xf')))return'custom';return this[_0xf45d('0xe')](_0xf45d('0xf'));},'set':function(_0x449f90){if(_0x449f90===_0xf45d('0x10'))_0x449f90=null;return this[_0xf45d('0x7')](_0xf45d('0xf'),_0x449f90);}}}; \ No newline at end of file +var _0x8330=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','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'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8330,0x129));var _0x0833=function(_0x4f37a4,_0x30cd53){_0x4f37a4=_0x4f37a4-0x0;var _0xe21f56=_0x8330[_0x4f37a4];return _0xe21f56;};'use strict';var Sequelize=require(_0x0833('0x0'));module[_0x0833('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x0833('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x0833('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x0833('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x0833('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x0833('0x4')]},'markAsUnread':{'type':Sequelize[_0x0833('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x0833('0x2')],'allowNull':![],'defaultValue':_0x0833('0x5')},'fontSize':{'type':Sequelize[_0x0833('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0833('0x7');}},'notificationSound':{'type':Sequelize[_0x0833('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0833('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0833('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0833('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0833('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0833('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x0833('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x0833('0x3')],'defaultValue':![],'comment':_0x0833('0x9'),'set':function(_0x209d35){if(!_0x209d35)this['setDataValue'](_0x0833('0xa'),null);this[_0x0833('0xb')](_0x0833('0xc'),_0x209d35);}},'provider':{'type':Sequelize['ENUM']('gmail','hotmail',_0x0833('0xd'),_0x0833('0xe')),'defaultValue':null,'get':function(){if(!this[_0x0833('0xf')](_0x0833('0x10')))return _0x0833('0x11');return this[_0x0833('0xf')](_0x0833('0x10'));},'set':function(_0x10f673){if(_0x10f673===_0x0833('0x11'))_0x10f673=null;return this['setDataValue']('provider',_0x10f673);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 3b10b6d..5c734ed 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 _0xa65a=['json','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','rawAttributes','key','keys','filters','intersection','attributes','fields','query','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','type','VIRTUAL','options','MailAccount','include','findAll','show','params','length','includeAll','merge','find','body','CloudProviderId','modernAuthentication','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','rows','removeDispositions','ids','CannedAnswer','removeAnswers','provider','custom','ListId','isNil','active','user','password','pass','service','host','port','authentication','username','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','MailInteraction','addInteraction','omit','Contact','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','CmList','List','Contacts','DESC','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','secure','auth','SendMail','sendMail','List\x20not\x20found','CmContact','attach','out','messageId','Interaction','Messages','verifySmtp','CloudProvider','OAuth2','data5','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','User','util','lodash','juice','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x44885e,_0x143a6e){var _0x5a3b75=function(_0x3e6f81){while(--_0x3e6f81){_0x44885e['push'](_0x44885e['shift']());}};_0x5a3b75(++_0x143a6e);}(_0xa65a,0x99));var _0xaa65=function(_0x5bef96,_0x1b5bfd){_0x5bef96=_0x5bef96-0x0;var _0x3ac79d=_0xa65a[_0x5bef96];return _0x3ac79d;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xaa65('0x0'));var path=require('path');var _=require(_0xaa65('0x1'));var juice=require(_0xaa65('0x2'));var Redis=require(_0xaa65('0x3'));var qs=require(_0xaa65('0x4'));var logger=require('../../config/logger')('api');var config=require(_0xaa65('0x5'));var db=require(_0xaa65('0x6'))['db'];config[_0xaa65('0x7')]=_[_0xaa65('0x8')](config['redis'],{'host':_0xaa65('0x9'),'port':0x18eb});var socket=require(_0xaa65('0xa'))(new Redis(config[_0xaa65('0x7')]));require(_0xaa65('0xb'))[_0xaa65('0xc')](socket);var jayson=require(_0xaa65('0xd'));var client=jayson[_0xaa65('0xe')][_0xaa65('0xf')]({'port':0x232b});function respondWithRpcPromise(_0xf9c9df,_0x37b497,_0x16f3f6,_0x255cd3){return new BPromise(function(_0x98404e,_0x8c7c64){var _0x4370fd=_0x255cd3||client;return _0x4370fd[_0xaa65('0x10')](_0xf9c9df,_0x16f3f6)[_0xaa65('0x11')](function(_0x565b64){logger[_0xaa65('0x12')](_0xaa65('0x13'),_0x37b497,'request\x20sent');logger[_0xaa65('0x14')](_0xaa65('0x15'),_0x37b497,_0xaa65('0x16'),JSON[_0xaa65('0x17')](_0x565b64));if(_0x565b64[_0xaa65('0x18')]){if(_0x565b64[_0xaa65('0x18')]['code']===0x1f4){logger['error'](_0xaa65('0x13'),_0x37b497,_0x565b64[_0xaa65('0x18')][_0xaa65('0x19')]);return _0x8c7c64(_0x565b64[_0xaa65('0x18')][_0xaa65('0x19')]);}logger['error'](_0xaa65('0x13'),_0x37b497,_0x565b64[_0xaa65('0x18')]['message']);return _0x98404e(_0x565b64[_0xaa65('0x18')][_0xaa65('0x19')]);}else{logger[_0xaa65('0x12')](_0xaa65('0x13'),_0x37b497,'request\x20sent');_0x98404e(_0x565b64['result'][_0xaa65('0x19')]);}})[_0xaa65('0x1a')](function(_0x5b4539){logger[_0xaa65('0x18')]('MailAccount,\x20%s,\x20%s',_0x37b497,_0x5b4539);_0x8c7c64(_0x5b4539);});});}function respondWithStatusCode(_0x432c21,_0x44c54f){_0x44c54f=_0x44c54f||0xcc;return function(_0x1d6843){if(_0x1d6843){return _0x432c21[_0xaa65('0x1b')](_0x44c54f);}return _0x432c21[_0xaa65('0x1c')](_0x44c54f)[_0xaa65('0x1d')]();};}function respondWithResult(_0x53474b,_0x22fabd){_0x22fabd=_0x22fabd||0xc8;return function(_0x3cff21){if(_0x3cff21){return _0x53474b[_0xaa65('0x1c')](_0x22fabd)['json'](_0x3cff21);}};}function respondWithFilteredResult(_0x569c0d,_0x15d220){return function(_0x1bd380){if(_0x1bd380){var _0x24ca1c=typeof _0x15d220[_0xaa65('0x1e')]===_0xaa65('0x1f')&&typeof _0x15d220[_0xaa65('0x20')]==='undefined';var _0x555623=_0x1bd380[_0xaa65('0x21')];var _0x32578b=_0x24ca1c?0x0:_0x15d220['offset'];var _0x5d3958=_0x24ca1c?_0x1bd380[_0xaa65('0x21')]:_0x15d220[_0xaa65('0x1e')]+_0x15d220[_0xaa65('0x20')];var _0x4920da;if(_0x5d3958>=_0x555623){_0x5d3958=_0x555623;_0x4920da=0xc8;}else{_0x4920da=0xce;}_0x569c0d[_0xaa65('0x1c')](_0x4920da);return _0x569c0d[_0xaa65('0x22')](_0xaa65('0x23'),_0x32578b+'-'+_0x5d3958+'/'+_0x555623)[_0xaa65('0x24')](_0x1bd380);}return null;};}function saveUpdates(_0x77b529){return function(_0x58c3d1){if(_0x58c3d1){return _0x58c3d1[_0xaa65('0x25')](_0x77b529)[_0xaa65('0x11')](function(_0x5e8c6e){return _0x5e8c6e;});}return null;};}function removeEntity(_0x7fcd8d){return function(_0x57d458){if(_0x57d458){return _0x57d458[_0xaa65('0x26')]()[_0xaa65('0x11')](function(){var _0x37a6ed=_0x57d458[_0xaa65('0x27')]({'plain':!![]});var _0x15143b=_0xaa65('0x28');return db[_0xaa65('0x29')][_0xaa65('0x26')]({'where':{'type':_0x15143b,'resourceId':_0x37a6ed['id']}})[_0xaa65('0x11')](function(){return _0x57d458;});})[_0xaa65('0x11')](function(){_0x7fcd8d[_0xaa65('0x1c')](0xcc)[_0xaa65('0x1d')]();});}};}function handleEntityNotFound(_0x37a874){return function(_0x12511c){if(!_0x12511c){_0x37a874[_0xaa65('0x1b')](0x194);}return _0x12511c;};}function handleError(_0x393395,_0x287a46){_0x287a46=_0x287a46||0x1f4;return function(_0x4d3c0e){logger['error'](_0x4d3c0e[_0xaa65('0x2a')]);if(_0x4d3c0e[_0xaa65('0x2b')]){delete _0x4d3c0e['name'];}_0x393395[_0xaa65('0x1c')](_0x287a46)[_0xaa65('0x2c')](_0x4d3c0e);};}exports[_0xaa65('0x2d')]=function(_0x463770,_0x24d97b){var _0x26f794={'include':[{'model':db[_0xaa65('0x2e')],'as':_0xaa65('0x2f')},{'model':db[_0xaa65('0x30')],'as':_0xaa65('0x31')},{'model':db[_0xaa65('0x32')],'as':_0xaa65('0x33')}]},_0x556887={},_0x38bea0={'count':0x0,'rows':[]};var _0x5ea814=_['map'](db['MailAccount'][_0xaa65('0x34')],function(_0x4e39e3){return{'name':_0x4e39e3['fieldName'],'type':_0x4e39e3['type'][_0xaa65('0x35')]};});_0x556887['model']=_['map'](_0x5ea814,'name');_0x556887['query']=_[_0xaa65('0x36')](_0x463770['query']);_0x556887[_0xaa65('0x37')]=_[_0xaa65('0x38')](_0x556887['model'],_0x556887['query']);_0x26f794[_0xaa65('0x39')]=_[_0xaa65('0x38')](_0x556887['model'],qs[_0xaa65('0x3a')](_0x463770[_0xaa65('0x3b')][_0xaa65('0x3a')]));_0x26f794[_0xaa65('0x39')]=_0x26f794['attributes']['length']?_0x26f794[_0xaa65('0x39')]:_0x556887[_0xaa65('0x3c')];if(!_0x463770[_0xaa65('0x3b')][_0xaa65('0x3d')](_0xaa65('0x3e'))){_0x26f794[_0xaa65('0x20')]=qs[_0xaa65('0x20')](_0x463770[_0xaa65('0x3b')][_0xaa65('0x20')]);_0x26f794[_0xaa65('0x1e')]=qs[_0xaa65('0x1e')](_0x463770[_0xaa65('0x3b')]['offset']);}_0x26f794[_0xaa65('0x3f')]=qs[_0xaa65('0x40')](_0x463770[_0xaa65('0x3b')][_0xaa65('0x40')]);_0x26f794['where']=qs['filters'](_[_0xaa65('0x41')](_0x463770[_0xaa65('0x3b')],_0x556887[_0xaa65('0x37')]),_0x5ea814);if(_0x463770[_0xaa65('0x3b')][_0xaa65('0x42')]){_0x26f794[_0xaa65('0x43')]=_['merge'](_0x26f794[_0xaa65('0x43')],{'$or':_[_0xaa65('0x44')](_0x5ea814,function(_0x52a1fb){if(_0x52a1fb[_0xaa65('0x45')]!==_0xaa65('0x46')){var _0x3a697d={};_0x3a697d[_0x52a1fb[_0xaa65('0x2b')]]={'$like':'%'+_0x463770['query'][_0xaa65('0x42')]+'%'};return _0x3a697d;}})});}_0x26f794=_['merge']({},_0x26f794,_0x463770[_0xaa65('0x47')]);var _0x4d019e={'where':_0x26f794['where']};return db[_0xaa65('0x48')][_0xaa65('0x21')](_0x4d019e)[_0xaa65('0x11')](function(_0x327c6b){_0x38bea0[_0xaa65('0x21')]=_0x327c6b;if(_0x463770[_0xaa65('0x3b')]['includeAll']){_0x26f794[_0xaa65('0x49')]=[{'all':!![]}];}return db[_0xaa65('0x48')][_0xaa65('0x4a')](_0x26f794);})['then'](function(_0x59c850){_0x38bea0['rows']=_0x59c850;return _0x38bea0;})['then'](respondWithFilteredResult(_0x24d97b,_0x26f794))['catch'](handleError(_0x24d97b,null));};exports[_0xaa65('0x4b')]=function(_0x15b1af,_0x5f0ae6){var _0x2114a4={'raw':![],'where':{'id':_0x15b1af[_0xaa65('0x4c')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xaa65('0x2f')},{'model':db[_0xaa65('0x30')],'as':_0xaa65('0x31')},{'model':db[_0xaa65('0x32')],'as':'mandatoryDispositionPause'}]},_0x46c3a8={};_0x46c3a8[_0xaa65('0x3c')]=_[_0xaa65('0x36')](db[_0xaa65('0x48')][_0xaa65('0x34')]);_0x46c3a8[_0xaa65('0x3b')]=_[_0xaa65('0x36')](_0x15b1af['query']);_0x46c3a8['filters']=_[_0xaa65('0x38')](_0x46c3a8[_0xaa65('0x3c')],_0x46c3a8['query']);_0x2114a4[_0xaa65('0x39')]=_[_0xaa65('0x38')](_0x46c3a8[_0xaa65('0x3c')],qs[_0xaa65('0x3a')](_0x15b1af[_0xaa65('0x3b')][_0xaa65('0x3a')]));_0x2114a4['attributes']=_0x2114a4[_0xaa65('0x39')][_0xaa65('0x4d')]?_0x2114a4['attributes']:_0x46c3a8[_0xaa65('0x3c')];if(_0x15b1af[_0xaa65('0x3b')][_0xaa65('0x4e')]){_0x2114a4[_0xaa65('0x49')]=[{'all':!![]}];}_0x2114a4=_[_0xaa65('0x4f')]({},_0x2114a4,_0x15b1af[_0xaa65('0x47')]);return db['MailAccount'][_0xaa65('0x50')](_0x2114a4)['then'](handleEntityNotFound(_0x5f0ae6,null))[_0xaa65('0x11')](respondWithResult(_0x5f0ae6,null))[_0xaa65('0x1a')](handleError(_0x5f0ae6,null));};exports[_0xaa65('0x25')]=function(_0x47c7a3,_0x2d349f){if(_0x47c7a3['body']['id']){delete _0x47c7a3['body']['id'];}if(_0x47c7a3[_0xaa65('0x51')][_0xaa65('0x2f')]){if(!_0x47c7a3[_0xaa65('0x51')]['Imap']['modernAuthentication']){_0x47c7a3[_0xaa65('0x51')][_0xaa65('0x2f')][_0xaa65('0x52')]=null;}}if(_0x47c7a3[_0xaa65('0x51')][_0xaa65('0x31')]){if(!_0x47c7a3[_0xaa65('0x51')][_0xaa65('0x31')][_0xaa65('0x53')]){_0x47c7a3[_0xaa65('0x51')][_0xaa65('0x31')]['CloudProviderId']=null;}}return db[_0xaa65('0x48')]['find']({'where':{'id':_0x47c7a3[_0xaa65('0x4c')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xaa65('0x2f')},{'model':db['MailServerOut'],'as':_0xaa65('0x31')},{'model':db[_0xaa65('0x32')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2d349f,null))[_0xaa65('0x11')](saveUpdates(_0x47c7a3['body'],null))[_0xaa65('0x11')](function(_0xf717c6){if(_0xf717c6&&_0x47c7a3[_0xaa65('0x51')][_0xaa65('0x2f')]){return db[_0xaa65('0x2e')][_0xaa65('0x25')](_0x47c7a3['body'][_0xaa65('0x2f')],{'where':{'MailAccountId':_0xf717c6['id']}})[_0xaa65('0x11')](function(){return _0xf717c6;});}return _0xf717c6;})['then'](function(_0x2e1997){if(_0x2e1997&&_0x47c7a3['body'][_0xaa65('0x31')]){return db[_0xaa65('0x30')][_0xaa65('0x25')](_0x47c7a3[_0xaa65('0x51')][_0xaa65('0x31')],{'where':{'MailAccountId':_0x2e1997['id']}})['then'](function(){return _0x2e1997;});}return _0x2e1997;})[_0xaa65('0x11')](respondWithResult(_0x2d349f,null))[_0xaa65('0x1a')](handleError(_0x2d349f,null));};exports[_0xaa65('0x54')]=function(_0x209567,_0x489303){return db[_0xaa65('0x48')][_0xaa65('0x54')]()['then'](respondWithResult(_0x489303,null))[_0xaa65('0x1a')](handleError(_0x489303,null));};exports[_0xaa65('0x55')]=function(_0x108330,_0x2e5fc5){if(_0x108330[_0xaa65('0x51')]['id']){delete _0x108330[_0xaa65('0x51')]['id'];}return db[_0xaa65('0x48')][_0xaa65('0x50')]({'where':{'id':_0x108330[_0xaa65('0x4c')]['id']}})[_0xaa65('0x11')](handleEntityNotFound(_0x2e5fc5,null))[_0xaa65('0x11')](function(_0x54e129){if(_0x54e129){_0x108330[_0xaa65('0x51')][_0xaa65('0x56')]=_0x54e129['id'];return db[_0xaa65('0x57')][_0xaa65('0x58')](_0x108330[_0xaa65('0x51')]);}})[_0xaa65('0x11')](respondWithResult(_0x2e5fc5,null))['catch'](handleError(_0x2e5fc5,null));};exports[_0xaa65('0x59')]=function(_0x3129be,_0x39ce54){var _0x4632de={'raw':![],'where':{}};var _0x477249={};var _0x39b52a={'count':0x0,'rows':[]};return db[_0xaa65('0x48')][_0xaa65('0x5a')]({'where':{'id':_0x3129be[_0xaa65('0x4c')]['id']}})[_0xaa65('0x11')](handleEntityNotFound(_0x39ce54,null))[_0xaa65('0x11')](function(_0x1bcbfb){if(_0x1bcbfb){_0x477249[_0xaa65('0x3c')]=_[_0xaa65('0x36')](db[_0xaa65('0x57')][_0xaa65('0x34')]);_0x477249[_0xaa65('0x3b')]=_['keys'](_0x3129be[_0xaa65('0x3b')]);_0x477249[_0xaa65('0x37')]=_[_0xaa65('0x38')](_0x477249[_0xaa65('0x3c')],_0x477249[_0xaa65('0x3b')]);_0x4632de[_0xaa65('0x39')]=_[_0xaa65('0x38')](_0x477249['model'],qs[_0xaa65('0x3a')](_0x3129be[_0xaa65('0x3b')]['fields']));_0x4632de[_0xaa65('0x39')]=_0x4632de['attributes']['length']?_0x4632de['attributes']:_0x477249['model'];if(!_0x3129be[_0xaa65('0x3b')][_0xaa65('0x3d')]('nolimit')){_0x4632de[_0xaa65('0x20')]=qs[_0xaa65('0x20')](_0x3129be[_0xaa65('0x3b')][_0xaa65('0x20')]);_0x4632de['offset']=qs[_0xaa65('0x1e')](_0x3129be[_0xaa65('0x3b')]['offset']);}_0x4632de[_0xaa65('0x3f')]=qs['sort'](_0x3129be[_0xaa65('0x3b')][_0xaa65('0x40')]);_0x4632de[_0xaa65('0x43')]=qs[_0xaa65('0x37')](_[_0xaa65('0x41')](_0x3129be[_0xaa65('0x3b')],_0x477249[_0xaa65('0x37')]));_0x4632de[_0xaa65('0x43')][_0xaa65('0x56')]=_0x1bcbfb['id'];if(_0x3129be[_0xaa65('0x3b')][_0xaa65('0x42')]){_0x4632de[_0xaa65('0x43')]=_[_0xaa65('0x4f')](_0x4632de['where'],{'$or':_[_0xaa65('0x44')](_0x4632de[_0xaa65('0x39')],function(_0x163d1d){var _0x2427cb={};_0x2427cb[_0x163d1d]={'$like':'%'+_0x3129be['query'][_0xaa65('0x42')]+'%'};return _0x2427cb;})});}_0x4632de=_['merge']({},_0x4632de,_0x3129be[_0xaa65('0x47')]);return db[_0xaa65('0x57')][_0xaa65('0x21')]({'where':_0x4632de[_0xaa65('0x43')]})[_0xaa65('0x11')](function(_0x32a0ee){_0x39b52a[_0xaa65('0x21')]=_0x32a0ee;if(_0x3129be[_0xaa65('0x3b')][_0xaa65('0x4e')]){_0x4632de[_0xaa65('0x49')]=[{'all':!![]}];}return db[_0xaa65('0x57')][_0xaa65('0x4a')](_0x4632de);})[_0xaa65('0x11')](function(_0x1a95d5){_0x39b52a[_0xaa65('0x5b')]=_0x1a95d5;return _0x39b52a;});}})[_0xaa65('0x11')](respondWithFilteredResult(_0x39ce54,_0x4632de))[_0xaa65('0x1a')](handleError(_0x39ce54,null));};exports[_0xaa65('0x5c')]=function(_0x2b8ec1,_0x7bc370){return db[_0xaa65('0x48')][_0xaa65('0x50')]({'where':{'id':_0x2b8ec1['params']['id']}})['then'](handleEntityNotFound(_0x7bc370,null))[_0xaa65('0x11')](function(_0x38125b){if(_0x38125b){return _0x38125b[_0xaa65('0x5c')](_0x2b8ec1[_0xaa65('0x3b')][_0xaa65('0x5d')]);}})['then'](respondWithStatusCode(_0x7bc370,null))['catch'](handleError(_0x7bc370,null));};exports['addAnswer']=function(_0x24c11e,_0x5560b6){if(_0x24c11e['body']['id']){delete _0x24c11e[_0xaa65('0x51')]['id'];}return db[_0xaa65('0x48')][_0xaa65('0x50')]({'where':{'id':_0x24c11e[_0xaa65('0x4c')]['id']}})[_0xaa65('0x11')](handleEntityNotFound(_0x5560b6,null))['then'](function(_0xa7be86){if(_0xa7be86){_0x24c11e[_0xaa65('0x51')]['MailAccountId']=_0xa7be86['id'];return db[_0xaa65('0x5e')]['create'](_0x24c11e[_0xaa65('0x51')]);}})[_0xaa65('0x11')](respondWithResult(_0x5560b6,null))[_0xaa65('0x1a')](handleError(_0x5560b6,null));};exports['getAnswers']=function(_0x862f4c,_0x5a8630){var _0x391a5e={'raw':![],'where':{}};var _0x8ec8d={};var _0x468c45={'count':0x0,'rows':[]};return db['MailAccount'][_0xaa65('0x5a')]({'where':{'id':_0x862f4c[_0xaa65('0x4c')]['id']}})[_0xaa65('0x11')](handleEntityNotFound(_0x5a8630,null))[_0xaa65('0x11')](function(_0xf7aaeb){if(_0xf7aaeb){_0x8ec8d[_0xaa65('0x3c')]=_[_0xaa65('0x36')](db[_0xaa65('0x5e')]['rawAttributes']);_0x8ec8d[_0xaa65('0x3b')]=_['keys'](_0x862f4c[_0xaa65('0x3b')]);_0x8ec8d['filters']=_['intersection'](_0x8ec8d[_0xaa65('0x3c')],_0x8ec8d[_0xaa65('0x3b')]);_0x391a5e['attributes']=_[_0xaa65('0x38')](_0x8ec8d[_0xaa65('0x3c')],qs[_0xaa65('0x3a')](_0x862f4c['query'][_0xaa65('0x3a')]));_0x391a5e[_0xaa65('0x39')]=_0x391a5e['attributes']['length']?_0x391a5e[_0xaa65('0x39')]:_0x8ec8d[_0xaa65('0x3c')];if(!_0x862f4c[_0xaa65('0x3b')][_0xaa65('0x3d')](_0xaa65('0x3e'))){_0x391a5e[_0xaa65('0x20')]=qs[_0xaa65('0x20')](_0x862f4c['query'][_0xaa65('0x20')]);_0x391a5e['offset']=qs[_0xaa65('0x1e')](_0x862f4c['query'][_0xaa65('0x1e')]);}_0x391a5e[_0xaa65('0x3f')]=qs[_0xaa65('0x40')](_0x862f4c[_0xaa65('0x3b')][_0xaa65('0x40')]);_0x391a5e[_0xaa65('0x43')]=qs[_0xaa65('0x37')](_[_0xaa65('0x41')](_0x862f4c[_0xaa65('0x3b')],_0x8ec8d[_0xaa65('0x37')]));_0x391a5e['where'][_0xaa65('0x56')]=_0xf7aaeb['id'];if(_0x862f4c[_0xaa65('0x3b')][_0xaa65('0x42')]){_0x391a5e[_0xaa65('0x43')]=_[_0xaa65('0x4f')](_0x391a5e['where'],{'$or':_[_0xaa65('0x44')](_0x391a5e[_0xaa65('0x39')],function(_0x54511a){var _0x1665a7={};_0x1665a7[_0x54511a]={'$like':'%'+_0x862f4c[_0xaa65('0x3b')][_0xaa65('0x42')]+'%'};return _0x1665a7;})});}_0x391a5e=_[_0xaa65('0x4f')]({},_0x391a5e,_0x862f4c[_0xaa65('0x47')]);return db[_0xaa65('0x5e')][_0xaa65('0x21')]({'where':_0x391a5e[_0xaa65('0x43')]})[_0xaa65('0x11')](function(_0x9a0b7e){_0x468c45['count']=_0x9a0b7e;if(_0x862f4c['query'][_0xaa65('0x4e')]){_0x391a5e['include']=[{'all':!![]}];}return db[_0xaa65('0x5e')][_0xaa65('0x4a')](_0x391a5e);})[_0xaa65('0x11')](function(_0x3822a2){_0x468c45[_0xaa65('0x5b')]=_0x3822a2;return _0x468c45;});}})[_0xaa65('0x11')](respondWithFilteredResult(_0x5a8630,_0x391a5e))[_0xaa65('0x1a')](handleError(_0x5a8630,null));};exports[_0xaa65('0x5f')]=function(_0x2911fe,_0x2afc1d){return db[_0xaa65('0x48')][_0xaa65('0x50')]({'where':{'id':_0x2911fe[_0xaa65('0x4c')]['id']}})[_0xaa65('0x11')](handleEntityNotFound(_0x2afc1d,null))['then'](function(_0x902751){if(_0x902751){return _0x902751[_0xaa65('0x5f')](_0x2911fe[_0xaa65('0x3b')][_0xaa65('0x5d')]);}})[_0xaa65('0x11')](respondWithStatusCode(_0x2afc1d,null))[_0xaa65('0x1a')](handleError(_0x2afc1d,null));};exports[_0xaa65('0x58')]=function(_0x2ff65e,_0x913985){var _0xdabf8e={'name':_0x2ff65e[_0xaa65('0x51')]['name'],'key':_0x2ff65e[_0xaa65('0x51')][_0xaa65('0x35')],'provider':_0x2ff65e[_0xaa65('0x51')][_0xaa65('0x60')]===_0xaa65('0x61')?null:_0x2ff65e[_0xaa65('0x51')][_0xaa65('0x60')],'email':_0x2ff65e[_0xaa65('0x51')]['email'],'ListId':_0x2ff65e[_0xaa65('0x51')][_0xaa65('0x62')],'active':!_[_0xaa65('0x63')](_0x2ff65e[_0xaa65('0x51')]['active'])?_0x2ff65e[_0xaa65('0x51')][_0xaa65('0x64')]:!![],'description':_0x2ff65e[_0xaa65('0x51')]['description']||null,'Imap':{},'Smtp':{}};if(_0xdabf8e[_0xaa65('0x60')]){_0xdabf8e[_0xaa65('0x2f')]['user']=_0xdabf8e[_0xaa65('0x31')][_0xaa65('0x65')]=_0x2ff65e['body']['username'];_0xdabf8e[_0xaa65('0x2f')][_0xaa65('0x66')]=_0xdabf8e[_0xaa65('0x31')]['pass']=_0x2ff65e[_0xaa65('0x51')][_0xaa65('0x66')];if(_0x2ff65e[_0xaa65('0x51')][_0xaa65('0x53')]){_0xdabf8e[_0xaa65('0x2f')][_0xaa65('0x53')]=_0xdabf8e['Smtp'][_0xaa65('0x53')]=!![];_0xdabf8e[_0xaa65('0x2f')][_0xaa65('0x52')]=_0xdabf8e['Smtp'][_0xaa65('0x52')]=_0x2ff65e['body']['CloudProviderId'];_0xdabf8e[_0xaa65('0x2f')][_0xaa65('0x66')]=_0xdabf8e[_0xaa65('0x31')][_0xaa65('0x67')]=null;}else{_0xdabf8e['Imap']['CloudProviderId']=_0xdabf8e[_0xaa65('0x31')]['CloudProviderId']=null;}_0xdabf8e[_0xaa65('0x2f')]['service']=_0xdabf8e[_0xaa65('0x31')][_0xaa65('0x68')]=null;_0xdabf8e['Imap'][_0xaa65('0x69')]=_0xdabf8e[_0xaa65('0x31')][_0xaa65('0x69')]=null;_0xdabf8e[_0xaa65('0x2f')][_0xaa65('0x6a')]=_0xdabf8e[_0xaa65('0x31')][_0xaa65('0x6a')]=null;}else{if(_0x2ff65e[_0xaa65('0x51')][_0xaa65('0x6b')]){_0xdabf8e[_0xaa65('0x2f')][_0xaa65('0x65')]=_0xdabf8e['Smtp'][_0xaa65('0x65')]=_0x2ff65e[_0xaa65('0x51')][_0xaa65('0x6c')];_0xdabf8e['Imap'][_0xaa65('0x66')]=_0xdabf8e['Smtp'][_0xaa65('0x67')]=_0x2ff65e[_0xaa65('0x51')][_0xaa65('0x66')];}else{_0xdabf8e[_0xaa65('0x2f')][_0xaa65('0x6b')]=_0xdabf8e[_0xaa65('0x31')]['authentication']=![];_0xdabf8e[_0xaa65('0x2f')]['user']=_0xdabf8e['Smtp']['user']=null;_0xdabf8e[_0xaa65('0x2f')][_0xaa65('0x66')]=_0xdabf8e[_0xaa65('0x31')][_0xaa65('0x67')]=null;}_0xdabf8e[_0xaa65('0x2f')][_0xaa65('0x69')]=_0x2ff65e[_0xaa65('0x51')][_0xaa65('0x2f')][_0xaa65('0x69')];_0xdabf8e[_0xaa65('0x2f')][_0xaa65('0x6a')]=_0x2ff65e[_0xaa65('0x51')][_0xaa65('0x2f')][_0xaa65('0x6a')];_0xdabf8e['Smtp'][_0xaa65('0x69')]=_0x2ff65e[_0xaa65('0x51')]['Smtp']['host'];_0xdabf8e[_0xaa65('0x31')][_0xaa65('0x6a')]=_0x2ff65e[_0xaa65('0x51')][_0xaa65('0x31')][_0xaa65('0x6a')];}return db[_0xaa65('0x48')][_0xaa65('0x58')](_0xdabf8e,{'include':[{'model':db[_0xaa65('0x30')],'as':'Smtp'},{'model':db[_0xaa65('0x2e')],'as':_0xaa65('0x2f')}]})[_0xaa65('0x11')](function(_0x29420a){var _0x98f8bf=_0x2ff65e[_0xaa65('0x65')]['get']({'plain':!![]});if(!_0x98f8bf)throw new Error(_0xaa65('0x6d'));if(_0x98f8bf[_0xaa65('0x6e')]===_0xaa65('0x65')){var _0x122894=_0x29420a[_0xaa65('0x27')]({'plain':!![]});return db[_0xaa65('0x6f')][_0xaa65('0x50')]({'where':{'name':_0xaa65('0x28'),'userProfileId':_0x98f8bf[_0xaa65('0x70')]},'raw':!![]})[_0xaa65('0x11')](function(_0x22ee19){if(_0x22ee19&&_0x22ee19[_0xaa65('0x71')]===0x0){return db['UserProfileResource']['create']({'name':_0x122894[_0xaa65('0x2b')],'resourceId':_0x122894['id'],'type':_0x22ee19[_0xaa65('0x2b')],'sectionId':_0x22ee19['id']},{})[_0xaa65('0x11')](function(){return _0x29420a;});}else{return _0x29420a;}})[_0xaa65('0x1a')](function(_0xe3d658){logger[_0xaa65('0x18')](_0xaa65('0x72'),_0xe3d658);throw _0xe3d658;});}return _0x29420a;})[_0xaa65('0x11')](respondWithResult(_0x913985,0xc9))['catch'](handleError(_0x913985,null));};exports[_0xaa65('0x73')]=function(_0x12ead3,_0x22c278){return db['MailAccount'][_0xaa65('0x5a')]({'where':{'id':_0x12ead3['params']['id']}})[_0xaa65('0x11')](handleEntityNotFound(_0x22c278,null))[_0xaa65('0x11')](function(_0x370c19){if(_0x370c19){return _0x370c19[_0xaa65('0x73')]();}return null;})[_0xaa65('0x11')](respondWithResult(_0x22c278,null))[_0xaa65('0x1a')](handleError(_0x22c278,null));};exports[_0xaa65('0x74')]=function(_0x21deb7,_0x30da77){if(_0x21deb7[_0xaa65('0x51')]['id']){delete _0x21deb7[_0xaa65('0x51')]['id'];}return db[_0xaa65('0x48')][_0xaa65('0x50')]({'where':{'id':_0x21deb7['params']['id']}})['then'](handleEntityNotFound(_0x30da77,null))['then'](function(_0x35ad24){if(_0x35ad24){_0x21deb7[_0xaa65('0x51')][_0xaa65('0x56')]=_0x35ad24['id'];return db[_0xaa65('0x2e')]['create'](_0x21deb7['body']);}})[_0xaa65('0x11')](respondWithResult(_0x30da77,null))['catch'](handleError(_0x30da77,null));};exports[_0xaa65('0x75')]=function(_0x2afa3c,_0x377f27){return db['MailAccount'][_0xaa65('0x5a')]({'where':{'id':_0x2afa3c['params']['id']}})[_0xaa65('0x11')](handleEntityNotFound(_0x377f27,null))['then'](function(_0xea1268){if(_0xea1268){return _0xea1268[_0xaa65('0x76')](null);}return null;})['then'](respondWithStatusCode(_0x377f27,null))[_0xaa65('0x1a')](handleError(_0x377f27,null));};exports[_0xaa65('0x77')]=function(_0x3a17eb,_0x2aeacb){return db['MailAccount'][_0xaa65('0x5a')]({'where':{'id':_0x3a17eb[_0xaa65('0x4c')]['id']}})[_0xaa65('0x11')](handleEntityNotFound(_0x2aeacb,null))['then'](function(_0x5f4071){if(_0x5f4071){return _0x5f4071[_0xaa65('0x77')]();}return null;})['then'](respondWithResult(_0x2aeacb,null))[_0xaa65('0x1a')](handleError(_0x2aeacb,null));};exports['addSmtp']=function(_0x274738,_0x1f5123){if(_0x274738[_0xaa65('0x51')]['id']){delete _0x274738[_0xaa65('0x51')]['id'];}return db[_0xaa65('0x48')][_0xaa65('0x50')]({'where':{'id':_0x274738['params']['id']}})['then'](handleEntityNotFound(_0x1f5123,null))['then'](function(_0x357ee0){if(_0x357ee0){_0x274738['body'][_0xaa65('0x56')]=_0x357ee0['id'];return db[_0xaa65('0x30')][_0xaa65('0x58')](_0x274738[_0xaa65('0x51')]);}})['then'](respondWithResult(_0x1f5123,null))['catch'](handleError(_0x1f5123,null));};exports[_0xaa65('0x78')]=function(_0x17ebd5,_0x4a23ac){return db[_0xaa65('0x48')]['findOne']({'where':{'id':_0x17ebd5['params']['id']}})[_0xaa65('0x11')](handleEntityNotFound(_0x4a23ac,null))[_0xaa65('0x11')](function(_0xe16de7){if(_0xe16de7){return _0xe16de7['setSmtp'](null);}return null;})[_0xaa65('0x11')](respondWithStatusCode(_0x4a23ac,null))[_0xaa65('0x1a')](handleError(_0x4a23ac,null));};exports['addInteraction']=function(_0x2cfa46,_0x39755f){return db[_0xaa65('0x79')][_0xaa65('0x50')]({'where':{'id':_0x2cfa46[_0xaa65('0x4c')]['id']}})['then'](handleEntityNotFound(_0x39755f,null))[_0xaa65('0x11')](function(_0xb07a62){if(_0xb07a62){return _0xb07a62[_0xaa65('0x7a')](_0x2cfa46[_0xaa65('0x51')][_0xaa65('0x5d')],_[_0xaa65('0x7b')](_0x2cfa46['body'],[_0xaa65('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x39755f,null))[_0xaa65('0x1a')](handleError(_0x39755f,null));};exports['getInteractions']=function(_0x4615aa,_0x19d420){var _0x319a4f={'raw':![],'where':{}};var _0x43d5fb={};var _0x21a8c2={'count':0x0,'rows':[]};return db[_0xaa65('0x48')][_0xaa65('0x5a')]({'where':{'id':_0x4615aa[_0xaa65('0x4c')]['id']}})[_0xaa65('0x11')](handleEntityNotFound(_0x19d420,null))[_0xaa65('0x11')](function(_0x54306b){if(_0x54306b){_0x43d5fb[_0xaa65('0x3c')]=_[_0xaa65('0x36')](db['MailInteraction']['rawAttributes']);_0x43d5fb['query']=_['keys'](_0x4615aa[_0xaa65('0x3b')]);_0x43d5fb[_0xaa65('0x37')]=_[_0xaa65('0x38')](_0x43d5fb[_0xaa65('0x3c')],_0x43d5fb[_0xaa65('0x3b')]);_0x319a4f[_0xaa65('0x39')]=_['intersection'](_0x43d5fb[_0xaa65('0x3c')],qs[_0xaa65('0x3a')](_0x4615aa[_0xaa65('0x3b')]['fields']));_0x319a4f[_0xaa65('0x39')]=_0x319a4f['attributes']['length']?_0x319a4f[_0xaa65('0x39')]:_0x43d5fb[_0xaa65('0x3c')];if(!_0x4615aa[_0xaa65('0x3b')][_0xaa65('0x3d')](_0xaa65('0x3e'))){_0x319a4f['limit']=qs[_0xaa65('0x20')](_0x4615aa[_0xaa65('0x3b')][_0xaa65('0x20')]);_0x319a4f[_0xaa65('0x1e')]=qs[_0xaa65('0x1e')](_0x4615aa[_0xaa65('0x3b')][_0xaa65('0x1e')]);}_0x319a4f['order']=qs[_0xaa65('0x40')](_0x4615aa[_0xaa65('0x3b')][_0xaa65('0x40')]);_0x319a4f[_0xaa65('0x43')]=qs[_0xaa65('0x37')](_['pick'](_0x4615aa[_0xaa65('0x3b')],_0x43d5fb[_0xaa65('0x37')]));_0x319a4f[_0xaa65('0x43')][_0xaa65('0x56')]=_0x54306b['id'];if(_0x4615aa[_0xaa65('0x3b')]['filter']){_0x319a4f['where']=_[_0xaa65('0x4f')](_0x319a4f[_0xaa65('0x43')],{'$or':_['map'](_0x319a4f['attributes'],function(_0x4335db){var _0x25dfaa={};_0x25dfaa[_0x4335db]={'$like':'%'+_0x4615aa[_0xaa65('0x3b')]['filter']+'%'};return _0x25dfaa;})});}_0x319a4f=_[_0xaa65('0x4f')]({},_0x319a4f,_0x4615aa[_0xaa65('0x47')]);return db[_0xaa65('0x79')][_0xaa65('0x21')]({'where':_0x319a4f[_0xaa65('0x43')]})[_0xaa65('0x11')](function(_0x2e80a7){_0x21a8c2[_0xaa65('0x21')]=_0x2e80a7;if(_0x4615aa[_0xaa65('0x3b')][_0xaa65('0x4e')]){_0x319a4f[_0xaa65('0x49')]=[{'model':db['CmContact'],'as':_0xaa65('0x7c'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0xaa65('0x7d'),_0xaa65('0x7e')],'required':![]},{'model':db[_0xaa65('0x7f')],'as':_0xaa65('0x80'),'attributes':['id',_0xaa65('0x2b'),_0xaa65('0x81')],'where':_0x4615aa['query']['tag']?{'id':_0x4615aa['query'][_0xaa65('0x82')]}:undefined,'required':_0x4615aa['query']['tag']?!![]:![]}];}return db[_0xaa65('0x79')][_0xaa65('0x4a')](_0x319a4f);})['then'](function(_0x18c646){_0x21a8c2['rows']=_0x18c646;return _0x21a8c2;});}})[_0xaa65('0x11')](respondWithFilteredResult(_0x19d420,_0x319a4f))['catch'](handleError(_0x19d420,null));};exports[_0xaa65('0x83')]=function addApplications(_0x388a2f,_0x5274ee){var _0x4ea1aa=_0x388a2f[_0xaa65('0x4c')]['id'];var _0x2d8840=_0x388a2f['body'];var _0x2920eb=0xc8;var _0x26685f=null;return db[_0xaa65('0x84')][_0xaa65('0x85')]({'isolationLevel':db['sequelize'][_0xaa65('0x86')][_0xaa65('0x87')][_0xaa65('0x88')]},function(_0x797488){return db[_0xaa65('0x48')][_0xaa65('0x5a')]({'where':{'id':_0x4ea1aa},'transaction':_0x797488})[_0xaa65('0x11')](function(_0x103c6d){if(_0x103c6d){return db[_0xaa65('0x89')]['destroy']({'where':{'MailAccountId':_0x4ea1aa},'transaction':_0x797488})[_0xaa65('0x11')](function(){var _0x1db2e5=_[_0xaa65('0x44')](_0x2d8840,function(_0x23bd90){_0x23bd90['MailAccountId']=_0x4ea1aa;return _0x23bd90;});return db[_0xaa65('0x89')][_0xaa65('0x8a')](_0x1db2e5,{'transaction':_0x797488});});}else{_0x2920eb=0x194;_0x26685f=[];}});})[_0xaa65('0x11')](function(){if(_0x2920eb!==0x194){return db[_0xaa65('0x89')][_0xaa65('0x8b')]({'where':{'MailAccountId':_0x4ea1aa},'order':_0xaa65('0x8c')})[_0xaa65('0x11')](function(_0x38cc24){_0x26685f=_0x38cc24;});}})[_0xaa65('0x1a')](function(_0x10b61c){_0x2920eb=0x1f4;logger[_0xaa65('0x18')](_0x10b61c[_0xaa65('0x2a')]);if(_0x10b61c[_0xaa65('0x2b')]){delete _0x10b61c[_0xaa65('0x2b')];}_0x26685f=_0x10b61c;})[_0xaa65('0x8d')](function(){if(_0x26685f===null){_0x5274ee[_0xaa65('0x1b')](_0x2920eb);}else{if(_0x2920eb===0x1f4){_0x5274ee[_0xaa65('0x1c')](_0x2920eb)[_0xaa65('0x2c')](_0x26685f);}else{_0x5274ee['status'](_0x2920eb)[_0xaa65('0x24')](_0x26685f);}}});};exports[_0xaa65('0x8e')]=function(_0x1b88c4,_0x282828){var _0x4dbdb1={};var _0x5dfe5b={};var _0x28a4b5;var _0x176a25;return db[_0xaa65('0x48')][_0xaa65('0x5a')]({'where':{'id':_0x1b88c4[_0xaa65('0x4c')]['id']}})[_0xaa65('0x11')](handleEntityNotFound(_0x282828,null))['then'](function(_0x3a21d5){if(_0x3a21d5){_0x28a4b5=_0x3a21d5;_0x5dfe5b[_0xaa65('0x3c')]=_['keys'](db[_0xaa65('0x89')][_0xaa65('0x34')]);_0x5dfe5b['query']=_[_0xaa65('0x36')](_0x1b88c4[_0xaa65('0x3b')]);_0x5dfe5b[_0xaa65('0x37')]=_[_0xaa65('0x38')](_0x5dfe5b[_0xaa65('0x3c')],_0x5dfe5b[_0xaa65('0x3b')]);_0x4dbdb1[_0xaa65('0x39')]=_[_0xaa65('0x38')](_0x5dfe5b[_0xaa65('0x3c')],qs[_0xaa65('0x3a')](_0x1b88c4[_0xaa65('0x3b')][_0xaa65('0x3a')]));_0x4dbdb1[_0xaa65('0x39')]=_0x4dbdb1['attributes']['length']?_0x4dbdb1['attributes']:_0x5dfe5b['model'];_0x4dbdb1[_0xaa65('0x3f')]=qs['sort'](_0x1b88c4[_0xaa65('0x3b')][_0xaa65('0x40')]);_0x4dbdb1['where']=qs[_0xaa65('0x37')](_[_0xaa65('0x41')](_0x1b88c4[_0xaa65('0x3b')],_0x5dfe5b['filters']));if(_0x1b88c4[_0xaa65('0x3b')]['filter']){_0x4dbdb1[_0xaa65('0x43')]=_[_0xaa65('0x4f')](_0x4dbdb1['where'],{'$or':_[_0xaa65('0x44')](_0x4dbdb1[_0xaa65('0x39')],function(_0x3fb28f){var _0x411dab={};_0x411dab[_0x3fb28f]={'$like':'%'+_0x1b88c4[_0xaa65('0x3b')][_0xaa65('0x42')]+'%'};return _0x411dab;})});}_0x4dbdb1=_[_0xaa65('0x4f')]({},_0x4dbdb1,_0x1b88c4[_0xaa65('0x47')]);return _0x28a4b5['getApplications'](_0x4dbdb1);}})['then'](function(_0x1a067a){if(_0x1a067a){_0x176a25=_0x1a067a[_0xaa65('0x4d')];if(!_0x1b88c4[_0xaa65('0x3b')][_0xaa65('0x3d')](_0xaa65('0x3e'))){_0x4dbdb1[_0xaa65('0x20')]=qs['limit'](_0x1b88c4[_0xaa65('0x3b')]['limit']);_0x4dbdb1[_0xaa65('0x1e')]=qs['offset'](_0x1b88c4[_0xaa65('0x3b')][_0xaa65('0x1e')]);}return _0x28a4b5['getApplications'](_0x4dbdb1);}})[_0xaa65('0x11')](function(_0x100461){if(_0x100461){return _0x100461?{'count':_0x176a25,'rows':_0x100461}:null;}})[_0xaa65('0x11')](respondWithResult(_0x282828,null))[_0xaa65('0x1a')](handleError(_0x282828,null));};exports[_0xaa65('0x8f')]=function(_0x4937ec,_0x4159d2){var _0xe253c2={'raw':!![],'where':{}};var _0x26af21={};var _0x48cc4a={'count':0x0,'rows':[]};return db['MailAccount'][_0xaa65('0x5a')]({'where':{'id':_0x4937ec[_0xaa65('0x4c')]['id']}})[_0xaa65('0x11')](handleEntityNotFound(_0x4159d2,null))[_0xaa65('0x11')](function(_0x18d415){if(_0x18d415){_0x26af21[_0xaa65('0x3c')]=_[_0xaa65('0x36')](db['MailMessage'][_0xaa65('0x34')]);_0x26af21[_0xaa65('0x3b')]=_[_0xaa65('0x36')](_0x4937ec[_0xaa65('0x3b')]);_0x26af21[_0xaa65('0x37')]=_[_0xaa65('0x38')](_0x26af21[_0xaa65('0x3c')],_0x26af21[_0xaa65('0x3b')]);_0xe253c2[_0xaa65('0x39')]=_['intersection'](_0x26af21['model'],qs[_0xaa65('0x3a')](_0x4937ec[_0xaa65('0x3b')][_0xaa65('0x3a')]));_0xe253c2[_0xaa65('0x39')]=_0xe253c2[_0xaa65('0x39')][_0xaa65('0x4d')]?_0xe253c2[_0xaa65('0x39')]:_0x26af21[_0xaa65('0x3c')];if(!_0x4937ec[_0xaa65('0x3b')][_0xaa65('0x3d')](_0xaa65('0x3e'))){_0xe253c2[_0xaa65('0x20')]=qs[_0xaa65('0x20')](_0x4937ec[_0xaa65('0x3b')][_0xaa65('0x20')]);_0xe253c2[_0xaa65('0x1e')]=qs[_0xaa65('0x1e')](_0x4937ec[_0xaa65('0x3b')][_0xaa65('0x1e')]);}_0xe253c2[_0xaa65('0x3f')]=qs[_0xaa65('0x40')](_0x4937ec[_0xaa65('0x3b')][_0xaa65('0x40')]);_0xe253c2[_0xaa65('0x43')]=qs[_0xaa65('0x37')](_['pick'](_0x4937ec[_0xaa65('0x3b')],_0x26af21['filters']));_0xe253c2[_0xaa65('0x43')][_0xaa65('0x56')]=_0x18d415['id'];if(_0x4937ec['query'][_0xaa65('0x42')]){_0xe253c2[_0xaa65('0x43')]=_['merge'](_0xe253c2[_0xaa65('0x43')],{'$or':_['map'](_0xe253c2['attributes'],function(_0x455287){var _0x1c7c2d={};_0x1c7c2d[_0x455287]={'$like':'%'+_0x4937ec[_0xaa65('0x3b')][_0xaa65('0x42')]+'%'};return _0x1c7c2d;})});}if(_0x4937ec['query'][_0xaa65('0x90')]){var _0x71a85a=_0x4937ec[_0xaa65('0x3b')]['$gte'][_0xaa65('0x91')](',');var _0x4f49ae={};_0x4f49ae[_0x71a85a[0x0]]={'$gte':moment(_0x71a85a[0x1])[_0xaa65('0x92')](_0xaa65('0x93'))};_0xe253c2[_0xaa65('0x43')]=_[_0xaa65('0x4f')](_0xe253c2[_0xaa65('0x43')],_0x4f49ae);}_0xe253c2=_[_0xaa65('0x4f')]({},_0xe253c2,_0x4937ec[_0xaa65('0x47')]);return db[_0xaa65('0x94')][_0xaa65('0x21')]({'where':_0xe253c2[_0xaa65('0x43')]})['then'](function(_0x35d9a7){_0x48cc4a[_0xaa65('0x21')]=_0x35d9a7;if(_0x4937ec[_0xaa65('0x3b')]['includeAll']){_0xe253c2[_0xaa65('0x49')]=[{'all':!![]}];}return db[_0xaa65('0x94')][_0xaa65('0x4a')](_0xe253c2);})[_0xaa65('0x11')](function(_0x50fb9c){if(_0x4937ec[_0xaa65('0x3b')]['inlineCss']===_0xaa65('0x95')){for(var _0x38346a=0x0;_0x38346a<_0x50fb9c[_0xaa65('0x4d')];_0x38346a++){_0x50fb9c[_0x38346a]['body']=juice(_0x50fb9c[_0x38346a]['body']);}}_0x48cc4a[_0xaa65('0x5b')]=_0x50fb9c;return _0x48cc4a;});}})[_0xaa65('0x11')](respondWithFilteredResult(_0x4159d2,_0xe253c2))[_0xaa65('0x1a')](handleError(_0x4159d2,null));};exports[_0xaa65('0x2c')]=function(_0xed60a7,_0x2ef4e0){var _0x381a34,_0x248060={},_0x372330;if(_0xed60a7['body']['to']){_0x372330=_0xed60a7['body']['to'][_0xaa65('0x91')](',')[0x0];}return db[_0xaa65('0x48')][_0xaa65('0x50')]({'where':{'id':_0xed60a7[_0xaa65('0x4c')]['id']},'include':[{'model':db[_0xaa65('0x96')],'as':_0xaa65('0x97'),'include':[{'model':db['CmContact'],'as':_0xaa65('0x98'),'where':{'email':_0x372330},'limit':0x1,'order':[['updatedAt',_0xaa65('0x99')]]}]},{'model':db[_0xaa65('0x30')],'as':_0xaa65('0x31'),'raw':!![]}]})[_0xaa65('0x11')](handleEntityNotFound(_0x2ef4e0,null))['then'](function(_0x20334d){if(_0x20334d){_0x381a34=_0x20334d;if(_0x20334d[_0xaa65('0x31')]){if(_[_0xaa65('0x63')](_0xed60a7[_0xaa65('0x51')][_0xaa65('0x9a')])){_0xed60a7[_0xaa65('0x51')][_0xaa65('0x9a')]=util[_0xaa65('0x92')](_0xaa65('0x9b'),_0x20334d['name'],_0x20334d[_0xaa65('0x9c')]||_0x20334d[_0xaa65('0x31')][_0xaa65('0x65')]);}if(_0xed60a7[_0xaa65('0x51')][_0xaa65('0x9d')]&&_0xed60a7[_0xaa65('0x51')][_0xaa65('0x9d')][_0xaa65('0x4d')]){for(var _0x230df7=0x0;_0x230df7<_0xed60a7['body'][_0xaa65('0x9d')][_0xaa65('0x4d')];_0x230df7+=0x1){_0xed60a7[_0xaa65('0x51')][_0xaa65('0x9d')][_0x230df7]={'filename':_0xed60a7[_0xaa65('0x51')][_0xaa65('0x9d')][_0x230df7][_0xaa65('0x2b')],'path':path[_0xaa65('0x9e')](config[_0xaa65('0x9f')],_0xaa65('0xa0'),_0xed60a7['body'][_0xaa65('0x9d')][_0x230df7][_0xaa65('0xa1')])};}}var _0x67e391={'tls':{'rejectUnauthorized':![]}};if(_[_0xaa65('0x63')](_0x20334d['Smtp'][_0xaa65('0x68')])){if(_0x20334d[_0xaa65('0x31')]['authentication']){_0x67e391['auth']={'user':_0x20334d['Smtp'][_0xaa65('0x65')],'pass':_0x20334d[_0xaa65('0x31')]['pass']};}_0x67e391[_0xaa65('0x69')]=_0x20334d[_0xaa65('0x31')][_0xaa65('0x69')];_0x67e391[_0xaa65('0x6a')]=_0x20334d['Smtp'][_0xaa65('0x6a')];_0x67e391[_0xaa65('0xa2')]=_0x20334d[_0xaa65('0x31')][_0xaa65('0xa2')];}else{_0x67e391[_0xaa65('0x68')]=_0x20334d[_0xaa65('0x31')][_0xaa65('0x68')];_0x67e391[_0xaa65('0xa3')]={'user':_0x20334d['Smtp']['user'],'pass':_0x20334d[_0xaa65('0x31')][_0xaa65('0x67')]};}return respondWithRpcPromise(_0xaa65('0xa4'),_0xaa65('0xa5'),{'account':_0x67e391,'message':_0xed60a7[_0xaa65('0x51')]});}else{throw new Error(_0xaa65('0xa6'));}}})[_0xaa65('0x11')](function(_0x52c02f){if(_0x52c02f){_0x248060=_0x52c02f;if(_0x381a34[_0xaa65('0x97')]){if(_0x381a34['List'][_0xaa65('0x98')][_0xaa65('0x4d')]){return _0x381a34['List'][_0xaa65('0x98')][0x0];}else{return db[_0xaa65('0xa7')][_0xaa65('0x58')](_[_0xaa65('0x8')](_0xed60a7[_0xaa65('0x51')],{'firstName':_0xed60a7['body']['to'],'email':_0xed60a7['body']['to'],'phone':_0xed60a7[_0xaa65('0x51')]['to'],'ListId':_0x381a34[_0xaa65('0x62')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0xaa65('0x11')](function(_0x5508a6){if(_0x5508a6){var _0x1b46a7={'UserId':_0xed60a7[_0xaa65('0x65')]['id'],'ContactId':_0x5508a6['id'],'MailAccountId':_0x381a34['id'],'inReplyTo':_0x248060['messageId'],'to':_0xed60a7[_0xaa65('0x51')][_0xaa65('0x9a')],'cc':_0xed60a7[_0xaa65('0x51')]['cc'],'subject':_0xed60a7['body']['subject'],'attach':_0xed60a7['body'][_0xaa65('0xa8')],'firstMsgDirection':_0xaa65('0xa9'),'lastMsgAt':moment()[_0xaa65('0x92')](_0xaa65('0x93')),'lastMsgDirection':_0xaa65('0xa9'),'Messages':[_[_0xaa65('0x4f')](_0xed60a7[_0xaa65('0x51')],{'messageId':_0x248060[_0xaa65('0xaa')],'sentAt':moment()[_0xaa65('0x92')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x381a34['id'],'UserId':_0xed60a7[_0xaa65('0x65')]['id'],'ContactId':_0x5508a6['id']})]};if(_0xed60a7[_0xaa65('0x51')][_0xaa65('0xab')]){_0x1b46a7=_[_0xaa65('0x4f')](_0x1b46a7,_0xed60a7['body'][_0xaa65('0xab')]);}return db[_0xaa65('0x79')]['create'](_0x1b46a7,{'include':[{'model':db[_0xaa65('0x94')],'as':_0xaa65('0xac')}]});}})[_0xaa65('0x11')](respondWithResult(_0x2ef4e0,null))[_0xaa65('0x1a')](handleError(_0x2ef4e0,null));};exports[_0xaa65('0xad')]=function(_0x5d8444,_0x9f360){return db[_0xaa65('0x48')][_0xaa65('0x50')]({'where':{'id':_0x5d8444[_0xaa65('0x4c')]['id']},'include':[{'model':db[_0xaa65('0x30')],'as':_0xaa65('0x31'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xaa65('0xae'),'raw':!![]}]}]})[_0xaa65('0x11')](handleEntityNotFound(_0x9f360,null))[_0xaa65('0x11')](function(_0x23868e){if(!_0x23868e[_0xaa65('0x31')])return;var _0x4fbc0c={'id':_0x23868e['id'],'tls':{'rejectUnauthorized':![]}};if(_0x23868e[_0xaa65('0x60')]!==_0xaa65('0x61')){_0x4fbc0c['service']=_0x23868e['provider'];}else{_0x4fbc0c[_0xaa65('0x69')]=_0x23868e[_0xaa65('0x31')]['host'];_0x4fbc0c[_0xaa65('0x6a')]=_0x23868e[_0xaa65('0x31')]['port'];_0x4fbc0c[_0xaa65('0xa2')]=_0x23868e[_0xaa65('0x31')][_0xaa65('0xa2')];}if(_0x23868e['Smtp'][_0xaa65('0x6b')]){if(_0x23868e[_0xaa65('0x31')][_0xaa65('0x53')]){_0x4fbc0c[_0xaa65('0xa3')]={'type':_0xaa65('0xaf'),'user':_0x23868e[_0xaa65('0x31')][_0xaa65('0x65')],'accessToken':_0x23868e[_0xaa65('0x31')][_0xaa65('0xae')][_0xaa65('0xb0')]};}else{_0x4fbc0c[_0xaa65('0xa3')]={'user':_0x23868e[_0xaa65('0x31')][_0xaa65('0x65')],'pass':_0x23868e[_0xaa65('0x31')]['pass']};}}return respondWithRpcPromise(_0xaa65('0xb1'),_0xaa65('0xad'),{'account':_0x4fbc0c});})[_0xaa65('0x11')](respondWithResult(_0x9f360,null))[_0xaa65('0x1a')](handleError(_0x9f360,null));};exports[_0xaa65('0x26')]=function(_0x4f5c4e,_0x14bc7a){return db[_0xaa65('0x48')][_0xaa65('0x50')]({'where':{'id':_0x4f5c4e[_0xaa65('0x4c')]['id']}})['then'](handleEntityNotFound(_0x14bc7a,null))[_0xaa65('0x11')](function(_0x1ca739){if(_0x1ca739&&_0x1ca739[_0xaa65('0x68')]){throw new db[(_0xaa65('0xb2'))][(_0xaa65('0xb3'))](_0xaa65('0xb4'));}return _0x1ca739;})[_0xaa65('0x11')](removeEntity(_0x14bc7a,null))[_0xaa65('0x1a')](handleError(_0x14bc7a,null));};exports['addAgents']=function(_0x3bc8ca,_0x9b1b41){return db['MailAccount'][_0xaa65('0x50')]({'where':{'id':_0x3bc8ca[_0xaa65('0x4c')]['id']}})[_0xaa65('0x11')](handleEntityNotFound(_0x9b1b41,null))[_0xaa65('0x11')](function(_0x294c51){if(_0x294c51){return _0x294c51[_0xaa65('0xb5')](_0x3bc8ca[_0xaa65('0x51')][_0xaa65('0x5d')],_['omit'](_0x3bc8ca[_0xaa65('0x51')],[_0xaa65('0x5d'),'id'])||{})['spread'](function(_0x376898){for(var _0x434dbb=0x0;_0x434dbb<_0x3bc8ca[_0xaa65('0x51')][_0xaa65('0x5d')][_0xaa65('0x4d')];_0x434dbb+=0x1){socket['emit'](_0xaa65('0xb6'),{'UserId':Number(_0x3bc8ca[_0xaa65('0x51')][_0xaa65('0x5d')][_0x434dbb]),'MailAccountId':Number(_0x3bc8ca[_0xaa65('0x4c')]['id'])});}return _0x376898;});}})[_0xaa65('0x11')](respondWithResult(_0x9b1b41,null))['catch'](handleError(_0x9b1b41,null));};exports[_0xaa65('0xb7')]=function(_0x4a0d57,_0x466b36){return db[_0xaa65('0x48')][_0xaa65('0x50')]({'where':{'id':_0x4a0d57[_0xaa65('0x4c')]['id']}})[_0xaa65('0x11')](handleEntityNotFound(_0x466b36,null))[_0xaa65('0x11')](function(_0x304058){if(_0x304058){return _0x304058[_0xaa65('0xb7')](_0x4a0d57['query'][_0xaa65('0x5d')])['then'](function(){if(_[_0xaa65('0xb8')](_0x4a0d57[_0xaa65('0x3b')][_0xaa65('0x5d')])){for(var _0x3f21de=0x0;_0x3f21de<_0x4a0d57['query'][_0xaa65('0x5d')][_0xaa65('0x4d')];_0x3f21de+=0x1){socket[_0xaa65('0xb9')](_0xaa65('0xba'),{'UserId':Number(_0x4a0d57[_0xaa65('0x3b')][_0xaa65('0x5d')][_0x3f21de]),'MailAccountId':Number(_0x4a0d57[_0xaa65('0x4c')]['id'])});}}else{socket[_0xaa65('0xb9')]('userMailAccount:remove',{'UserId':Number(_0x4a0d57['query']['ids']),'MailAccountId':Number(_0x4a0d57[_0xaa65('0x4c')]['id'])});}});}})[_0xaa65('0x11')](respondWithStatusCode(_0x466b36,null))['catch'](handleError(_0x466b36,null));};exports[_0xaa65('0xbb')]=function(_0x252188,_0x23b2ca){var _0x480553={};var _0x362431={};var _0x115240;var _0x2034ac;return db[_0xaa65('0x48')][_0xaa65('0x5a')]({'where':{'id':_0x252188[_0xaa65('0x4c')]['id']}})[_0xaa65('0x11')](handleEntityNotFound(_0x23b2ca,null))[_0xaa65('0x11')](function(_0x28fd51){if(_0x28fd51){_0x115240=_0x28fd51;_0x362431['model']=_['keys'](db[_0xaa65('0xbc')][_0xaa65('0x34')]);_0x362431['query']=_['keys'](_0x252188[_0xaa65('0x3b')]);_0x362431['filters']=_[_0xaa65('0x38')](_0x362431[_0xaa65('0x3c')],_0x362431[_0xaa65('0x3b')]);_0x480553['attributes']=_['intersection'](_0x362431[_0xaa65('0x3c')],qs[_0xaa65('0x3a')](_0x252188[_0xaa65('0x3b')][_0xaa65('0x3a')]));_0x480553[_0xaa65('0x39')]=_0x480553['attributes'][_0xaa65('0x4d')]?_0x480553[_0xaa65('0x39')]:_0x362431[_0xaa65('0x3c')];_0x480553['order']=qs[_0xaa65('0x40')](_0x252188[_0xaa65('0x3b')][_0xaa65('0x40')]);_0x480553[_0xaa65('0x43')]=qs['filters'](_[_0xaa65('0x41')](_0x252188[_0xaa65('0x3b')],_0x362431[_0xaa65('0x37')]));if(_0x252188['query']['filter']){_0x480553[_0xaa65('0x43')]=_['merge'](_0x480553[_0xaa65('0x43')],{'$or':_['map'](_0x480553[_0xaa65('0x39')],function(_0x30c590){var _0x1dd854={};_0x1dd854[_0x30c590]={'$like':'%'+_0x252188[_0xaa65('0x3b')][_0xaa65('0x42')]+'%'};return _0x1dd854;})});}_0x480553=_[_0xaa65('0x4f')]({},_0x480553,_0x252188[_0xaa65('0x47')]);return _0x115240[_0xaa65('0xbb')](_0x480553);}})[_0xaa65('0x11')](function(_0x3ce7b8){if(_0x3ce7b8){_0x2034ac=_0x3ce7b8[_0xaa65('0x4d')];if(!_0x252188[_0xaa65('0x3b')][_0xaa65('0x3d')](_0xaa65('0x3e'))){_0x480553[_0xaa65('0x20')]=qs[_0xaa65('0x20')](_0x252188[_0xaa65('0x3b')][_0xaa65('0x20')]);_0x480553['offset']=qs[_0xaa65('0x1e')](_0x252188['query']['offset']);}return _0x115240[_0xaa65('0xbb')](_0x480553);}})[_0xaa65('0x11')](function(_0x8e4376){if(_0x8e4376){return _0x8e4376?{'count':_0x2034ac,'rows':_0x8e4376}:null;}})[_0xaa65('0x11')](respondWithResult(_0x23b2ca,null))[_0xaa65('0x1a')](handleError(_0x23b2ca,null));}; \ No newline at end of file +var _0x2701=['addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','MailAccountId','CannedAnswer','create','getAnswers','findAll','removeAnswers','key','provider','custom','email','ListId','isNil','active','description','user','username','password','pass','service','host','port','authentication','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','ISOLATION_LEVELS','MailApplication','send','getApplications','getMessages','MailMessage','split','format','inlineCss','true','List','CmContact','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','basename','auth','sendMail','List\x20not\x20found','messageId','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','CloudProvider','secure','OAuth2','data5','VerifySmtp','verifySmtp','Sequelize','addAgents','spread','userMailAccount:save','removeAgents','userMailAccount:remove','emit','getAgents','User','moment','bluebird','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','get','MailAccounts','UserProfileResource','destroy','end','sendStatus','stack','name','Imap','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','rows','show','params','MailServerIn','MailServerOut','rawAttributes','includeAll','include','find','body','CloudProviderId','modernAuthentication','describe'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x2701,0x1ce));var _0x1270=function(_0x4a3570,_0x169197){_0x4a3570=_0x4a3570-0x0;var _0x235ca8=_0x2701[_0x4a3570];return _0x235ca8;};'use strict';var moment=require(_0x1270('0x0'));var BPromise=require(_0x1270('0x1'));var util=require(_0x1270('0x2'));var path=require(_0x1270('0x3'));var _=require('lodash');var juice=require(_0x1270('0x4'));var Redis=require(_0x1270('0x5'));var qs=require(_0x1270('0x6'));var logger=require(_0x1270('0x7'))(_0x1270('0x8'));var config=require('../../config/environment');var db=require(_0x1270('0x9'))['db'];config[_0x1270('0xa')]=_[_0x1270('0xb')](config[_0x1270('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1270('0xc'))(new Redis(config[_0x1270('0xa')]));require(_0x1270('0xd'))[_0x1270('0xe')](socket);var jayson=require(_0x1270('0xf'));var client=jayson[_0x1270('0x10')][_0x1270('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x72597e,_0x23975f,_0x398617,_0x24e713){return new BPromise(function(_0x51616e,_0x527efd){var _0x3be5cd=_0x24e713||client;return _0x3be5cd[_0x1270('0x12')](_0x72597e,_0x398617)[_0x1270('0x13')](function(_0x3430b3){logger['info'](_0x1270('0x14'),_0x23975f,_0x1270('0x15'));logger[_0x1270('0x16')](_0x1270('0x17'),_0x23975f,_0x1270('0x15'),JSON['stringify'](_0x3430b3));if(_0x3430b3['error']){if(_0x3430b3[_0x1270('0x18')][_0x1270('0x19')]===0x1f4){logger[_0x1270('0x18')](_0x1270('0x14'),_0x23975f,_0x3430b3[_0x1270('0x18')][_0x1270('0x1a')]);return _0x527efd(_0x3430b3[_0x1270('0x18')][_0x1270('0x1a')]);}logger[_0x1270('0x18')]('MailAccount,\x20%s,\x20%s',_0x23975f,_0x3430b3[_0x1270('0x18')][_0x1270('0x1a')]);return _0x51616e(_0x3430b3['error'][_0x1270('0x1a')]);}else{logger[_0x1270('0x1b')](_0x1270('0x14'),_0x23975f,_0x1270('0x15'));_0x51616e(_0x3430b3['result']['message']);}})[_0x1270('0x1c')](function(_0x34cfb8){logger[_0x1270('0x18')]('MailAccount,\x20%s,\x20%s',_0x23975f,_0x34cfb8);_0x527efd(_0x34cfb8);});});}function respondWithStatusCode(_0x18d64a,_0xe7d9f9){_0xe7d9f9=_0xe7d9f9||0xcc;return function(_0x627843){if(_0x627843){return _0x18d64a['sendStatus'](_0xe7d9f9);}return _0x18d64a[_0x1270('0x1d')](_0xe7d9f9)['end']();};}function respondWithResult(_0x37a893,_0x5e7c08){_0x5e7c08=_0x5e7c08||0xc8;return function(_0x4c698b){if(_0x4c698b){return _0x37a893['status'](_0x5e7c08)[_0x1270('0x1e')](_0x4c698b);}};}function respondWithFilteredResult(_0x6b45cc,_0x4e398d){return function(_0x3fa4c5){if(_0x3fa4c5){var _0x36c64b=typeof _0x4e398d[_0x1270('0x1f')]===_0x1270('0x20')&&typeof _0x4e398d['limit']===_0x1270('0x20');var _0x47a3e7=_0x3fa4c5[_0x1270('0x21')];var _0x3649b7=_0x36c64b?0x0:_0x4e398d[_0x1270('0x1f')];var _0x2e6e4f=_0x36c64b?_0x3fa4c5[_0x1270('0x21')]:_0x4e398d[_0x1270('0x1f')]+_0x4e398d[_0x1270('0x22')];var _0x5098bb;if(_0x2e6e4f>=_0x47a3e7){_0x2e6e4f=_0x47a3e7;_0x5098bb=0xc8;}else{_0x5098bb=0xce;}_0x6b45cc[_0x1270('0x1d')](_0x5098bb);return _0x6b45cc[_0x1270('0x23')](_0x1270('0x24'),_0x3649b7+'-'+_0x2e6e4f+'/'+_0x47a3e7)['json'](_0x3fa4c5);}return null;};}function saveUpdates(_0x4259cb){return function(_0x246286){if(_0x246286){return _0x246286[_0x1270('0x25')](_0x4259cb)[_0x1270('0x13')](function(_0x31b13f){return _0x31b13f;});}return null;};}function removeEntity(_0x584804){return function(_0x2c2192){if(_0x2c2192){return _0x2c2192['destroy']()[_0x1270('0x13')](function(){var _0x1b4dc8=_0x2c2192[_0x1270('0x26')]({'plain':!![]});var _0x4caa8c=_0x1270('0x27');return db[_0x1270('0x28')][_0x1270('0x29')]({'where':{'type':_0x4caa8c,'resourceId':_0x1b4dc8['id']}})[_0x1270('0x13')](function(){return _0x2c2192;});})['then'](function(){_0x584804['status'](0xcc)[_0x1270('0x2a')]();});}};}function handleEntityNotFound(_0x3e2d2e){return function(_0x1d6837){if(!_0x1d6837){_0x3e2d2e[_0x1270('0x2b')](0x194);}return _0x1d6837;};}function handleError(_0x4f15b7,_0x33091c){_0x33091c=_0x33091c||0x1f4;return function(_0x50c356){logger[_0x1270('0x18')](_0x50c356[_0x1270('0x2c')]);if(_0x50c356[_0x1270('0x2d')]){delete _0x50c356[_0x1270('0x2d')];}_0x4f15b7[_0x1270('0x1d')](_0x33091c)['send'](_0x50c356);};}exports['index']=function(_0x58d99d,_0x4b440d){var _0x4c6e07={'include':[{'model':db['MailServerIn'],'as':_0x1270('0x2e')},{'model':db['MailServerOut'],'as':_0x1270('0x2f')},{'model':db[_0x1270('0x30')],'as':_0x1270('0x31')}]},_0xd622f6={},_0x2e8642={'count':0x0,'rows':[]};var _0x4a40d9=_[_0x1270('0x32')](db[_0x1270('0x33')]['rawAttributes'],function(_0x24396b){return{'name':_0x24396b[_0x1270('0x34')],'type':_0x24396b['type']['key']};});_0xd622f6[_0x1270('0x35')]=_[_0x1270('0x32')](_0x4a40d9,_0x1270('0x2d'));_0xd622f6[_0x1270('0x36')]=_[_0x1270('0x37')](_0x58d99d[_0x1270('0x36')]);_0xd622f6[_0x1270('0x38')]=_['intersection'](_0xd622f6[_0x1270('0x35')],_0xd622f6['query']);_0x4c6e07[_0x1270('0x39')]=_[_0x1270('0x3a')](_0xd622f6[_0x1270('0x35')],qs[_0x1270('0x3b')](_0x58d99d[_0x1270('0x36')][_0x1270('0x3b')]));_0x4c6e07[_0x1270('0x39')]=_0x4c6e07[_0x1270('0x39')][_0x1270('0x3c')]?_0x4c6e07[_0x1270('0x39')]:_0xd622f6[_0x1270('0x35')];if(!_0x58d99d[_0x1270('0x36')]['hasOwnProperty'](_0x1270('0x3d'))){_0x4c6e07[_0x1270('0x22')]=qs[_0x1270('0x22')](_0x58d99d['query'][_0x1270('0x22')]);_0x4c6e07[_0x1270('0x1f')]=qs[_0x1270('0x1f')](_0x58d99d[_0x1270('0x36')][_0x1270('0x1f')]);}_0x4c6e07[_0x1270('0x3e')]=qs[_0x1270('0x3f')](_0x58d99d[_0x1270('0x36')][_0x1270('0x3f')]);_0x4c6e07[_0x1270('0x40')]=qs['filters'](_[_0x1270('0x41')](_0x58d99d[_0x1270('0x36')],_0xd622f6['filters']),_0x4a40d9);if(_0x58d99d[_0x1270('0x36')]['filter']){_0x4c6e07['where']=_[_0x1270('0x42')](_0x4c6e07[_0x1270('0x40')],{'$or':_[_0x1270('0x32')](_0x4a40d9,function(_0x5a9c1d){if(_0x5a9c1d[_0x1270('0x43')]!==_0x1270('0x44')){var _0x4c59b4={};_0x4c59b4[_0x5a9c1d[_0x1270('0x2d')]]={'$like':'%'+_0x58d99d[_0x1270('0x36')][_0x1270('0x45')]+'%'};return _0x4c59b4;}})});}_0x4c6e07=_['merge']({},_0x4c6e07,_0x58d99d[_0x1270('0x46')]);var _0x2e86a7={'where':_0x4c6e07[_0x1270('0x40')]};return db[_0x1270('0x33')][_0x1270('0x21')](_0x2e86a7)['then'](function(_0x287463){_0x2e8642[_0x1270('0x21')]=_0x287463;if(_0x58d99d[_0x1270('0x36')]['includeAll']){_0x4c6e07['include']=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x4c6e07);})[_0x1270('0x13')](function(_0x3db146){_0x2e8642[_0x1270('0x47')]=_0x3db146;return _0x2e8642;})[_0x1270('0x13')](respondWithFilteredResult(_0x4b440d,_0x4c6e07))['catch'](handleError(_0x4b440d,null));};exports[_0x1270('0x48')]=function(_0x191ffa,_0xc10984){var _0x54ae66={'raw':![],'where':{'id':_0x191ffa[_0x1270('0x49')]['id']},'include':[{'model':db[_0x1270('0x4a')],'as':_0x1270('0x2e')},{'model':db[_0x1270('0x4b')],'as':_0x1270('0x2f')},{'model':db[_0x1270('0x30')],'as':_0x1270('0x31')}]},_0x535f06={};_0x535f06[_0x1270('0x35')]=_['keys'](db[_0x1270('0x33')][_0x1270('0x4c')]);_0x535f06[_0x1270('0x36')]=_[_0x1270('0x37')](_0x191ffa[_0x1270('0x36')]);_0x535f06[_0x1270('0x38')]=_[_0x1270('0x3a')](_0x535f06[_0x1270('0x35')],_0x535f06[_0x1270('0x36')]);_0x54ae66['attributes']=_[_0x1270('0x3a')](_0x535f06[_0x1270('0x35')],qs[_0x1270('0x3b')](_0x191ffa[_0x1270('0x36')]['fields']));_0x54ae66[_0x1270('0x39')]=_0x54ae66[_0x1270('0x39')][_0x1270('0x3c')]?_0x54ae66[_0x1270('0x39')]:_0x535f06['model'];if(_0x191ffa[_0x1270('0x36')][_0x1270('0x4d')]){_0x54ae66[_0x1270('0x4e')]=[{'all':!![]}];}_0x54ae66=_[_0x1270('0x42')]({},_0x54ae66,_0x191ffa[_0x1270('0x46')]);return db['MailAccount'][_0x1270('0x4f')](_0x54ae66)[_0x1270('0x13')](handleEntityNotFound(_0xc10984,null))[_0x1270('0x13')](respondWithResult(_0xc10984,null))[_0x1270('0x1c')](handleError(_0xc10984,null));};exports[_0x1270('0x25')]=function(_0x402041,_0x16a7be){if(_0x402041['body']['id']){delete _0x402041[_0x1270('0x50')]['id'];}if(_0x402041[_0x1270('0x50')]['Imap']){if(!_0x402041[_0x1270('0x50')][_0x1270('0x2e')]['modernAuthentication']){_0x402041[_0x1270('0x50')][_0x1270('0x2e')][_0x1270('0x51')]=null;}}if(_0x402041['body'][_0x1270('0x2f')]){if(!_0x402041[_0x1270('0x50')]['Smtp'][_0x1270('0x52')]){_0x402041[_0x1270('0x50')][_0x1270('0x2f')][_0x1270('0x51')]=null;}}return db['MailAccount'][_0x1270('0x4f')]({'where':{'id':_0x402041[_0x1270('0x49')]['id']},'include':[{'model':db[_0x1270('0x4a')],'as':_0x1270('0x2e')},{'model':db[_0x1270('0x4b')],'as':_0x1270('0x2f')},{'model':db['Pause'],'as':_0x1270('0x31')}]})['then'](handleEntityNotFound(_0x16a7be,null))[_0x1270('0x13')](saveUpdates(_0x402041[_0x1270('0x50')],null))[_0x1270('0x13')](function(_0x3b958e){if(_0x3b958e&&_0x402041[_0x1270('0x50')][_0x1270('0x2e')]){return db[_0x1270('0x4a')][_0x1270('0x25')](_0x402041[_0x1270('0x50')][_0x1270('0x2e')],{'where':{'MailAccountId':_0x3b958e['id']}})[_0x1270('0x13')](function(){return _0x3b958e;});}return _0x3b958e;})[_0x1270('0x13')](function(_0x3303b1){if(_0x3303b1&&_0x402041['body']['Smtp']){return db['MailServerOut'][_0x1270('0x25')](_0x402041[_0x1270('0x50')][_0x1270('0x2f')],{'where':{'MailAccountId':_0x3303b1['id']}})[_0x1270('0x13')](function(){return _0x3303b1;});}return _0x3303b1;})['then'](respondWithResult(_0x16a7be,null))[_0x1270('0x1c')](handleError(_0x16a7be,null));};exports['describe']=function(_0x56d0e7,_0x5cf379){return db[_0x1270('0x33')][_0x1270('0x53')]()[_0x1270('0x13')](respondWithResult(_0x5cf379,null))[_0x1270('0x1c')](handleError(_0x5cf379,null));};exports[_0x1270('0x54')]=function(_0x6fac6f,_0x1e015a){if(_0x6fac6f[_0x1270('0x50')]['id']){delete _0x6fac6f[_0x1270('0x50')]['id'];}return db['MailAccount'][_0x1270('0x4f')]({'where':{'id':_0x6fac6f[_0x1270('0x49')]['id']}})[_0x1270('0x13')](handleEntityNotFound(_0x1e015a,null))[_0x1270('0x13')](function(_0x867499){if(_0x867499){_0x6fac6f[_0x1270('0x50')]['MailAccountId']=_0x867499['id'];return db[_0x1270('0x55')]['create'](_0x6fac6f['body']);}})['then'](respondWithResult(_0x1e015a,null))[_0x1270('0x1c')](handleError(_0x1e015a,null));};exports[_0x1270('0x56')]=function(_0x26c5cd,_0x615894){var _0x51f015={'raw':![],'where':{}};var _0x5ec023={};var _0x50bd2b={'count':0x0,'rows':[]};return db[_0x1270('0x33')][_0x1270('0x57')]({'where':{'id':_0x26c5cd[_0x1270('0x49')]['id']}})['then'](handleEntityNotFound(_0x615894,null))[_0x1270('0x13')](function(_0x4f74cd){if(_0x4f74cd){_0x5ec023[_0x1270('0x35')]=_[_0x1270('0x37')](db['Disposition'][_0x1270('0x4c')]);_0x5ec023[_0x1270('0x36')]=_['keys'](_0x26c5cd['query']);_0x5ec023[_0x1270('0x38')]=_['intersection'](_0x5ec023[_0x1270('0x35')],_0x5ec023[_0x1270('0x36')]);_0x51f015[_0x1270('0x39')]=_[_0x1270('0x3a')](_0x5ec023[_0x1270('0x35')],qs['fields'](_0x26c5cd[_0x1270('0x36')]['fields']));_0x51f015[_0x1270('0x39')]=_0x51f015[_0x1270('0x39')]['length']?_0x51f015[_0x1270('0x39')]:_0x5ec023[_0x1270('0x35')];if(!_0x26c5cd['query'][_0x1270('0x58')](_0x1270('0x3d'))){_0x51f015['limit']=qs[_0x1270('0x22')](_0x26c5cd[_0x1270('0x36')]['limit']);_0x51f015[_0x1270('0x1f')]=qs[_0x1270('0x1f')](_0x26c5cd[_0x1270('0x36')][_0x1270('0x1f')]);}_0x51f015[_0x1270('0x3e')]=qs[_0x1270('0x3f')](_0x26c5cd[_0x1270('0x36')][_0x1270('0x3f')]);_0x51f015['where']=qs[_0x1270('0x38')](_[_0x1270('0x41')](_0x26c5cd[_0x1270('0x36')],_0x5ec023[_0x1270('0x38')]));_0x51f015[_0x1270('0x40')]['MailAccountId']=_0x4f74cd['id'];if(_0x26c5cd[_0x1270('0x36')][_0x1270('0x45')]){_0x51f015[_0x1270('0x40')]=_[_0x1270('0x42')](_0x51f015[_0x1270('0x40')],{'$or':_[_0x1270('0x32')](_0x51f015[_0x1270('0x39')],function(_0x4be1e0){var _0x4c316b={};_0x4c316b[_0x4be1e0]={'$like':'%'+_0x26c5cd[_0x1270('0x36')][_0x1270('0x45')]+'%'};return _0x4c316b;})});}_0x51f015=_[_0x1270('0x42')]({},_0x51f015,_0x26c5cd[_0x1270('0x46')]);return db[_0x1270('0x55')][_0x1270('0x21')]({'where':_0x51f015['where']})[_0x1270('0x13')](function(_0x5ae86a){_0x50bd2b[_0x1270('0x21')]=_0x5ae86a;if(_0x26c5cd[_0x1270('0x36')]['includeAll']){_0x51f015['include']=[{'all':!![]}];}return db[_0x1270('0x55')]['findAll'](_0x51f015);})[_0x1270('0x13')](function(_0x345164){_0x50bd2b[_0x1270('0x47')]=_0x345164;return _0x50bd2b;});}})[_0x1270('0x13')](respondWithFilteredResult(_0x615894,_0x51f015))[_0x1270('0x1c')](handleError(_0x615894,null));};exports[_0x1270('0x59')]=function(_0xf5eac1,_0x35b7ef){return db[_0x1270('0x33')]['find']({'where':{'id':_0xf5eac1[_0x1270('0x49')]['id']}})['then'](handleEntityNotFound(_0x35b7ef,null))[_0x1270('0x13')](function(_0x4e25d7){if(_0x4e25d7){return _0x4e25d7['removeDispositions'](_0xf5eac1[_0x1270('0x36')][_0x1270('0x5a')]);}})['then'](respondWithStatusCode(_0x35b7ef,null))[_0x1270('0x1c')](handleError(_0x35b7ef,null));};exports[_0x1270('0x5b')]=function(_0x1abe54,_0x5d8fcd){if(_0x1abe54['body']['id']){delete _0x1abe54[_0x1270('0x50')]['id'];}return db[_0x1270('0x33')]['find']({'where':{'id':_0x1abe54[_0x1270('0x49')]['id']}})[_0x1270('0x13')](handleEntityNotFound(_0x5d8fcd,null))[_0x1270('0x13')](function(_0x25358d){if(_0x25358d){_0x1abe54['body'][_0x1270('0x5c')]=_0x25358d['id'];return db[_0x1270('0x5d')][_0x1270('0x5e')](_0x1abe54[_0x1270('0x50')]);}})['then'](respondWithResult(_0x5d8fcd,null))[_0x1270('0x1c')](handleError(_0x5d8fcd,null));};exports[_0x1270('0x5f')]=function(_0x510dcb,_0x5353f2){var _0x5a5751={'raw':![],'where':{}};var _0x491207={};var _0x21f3b9={'count':0x0,'rows':[]};return db[_0x1270('0x33')][_0x1270('0x57')]({'where':{'id':_0x510dcb['params']['id']}})[_0x1270('0x13')](handleEntityNotFound(_0x5353f2,null))[_0x1270('0x13')](function(_0x4ed6fa){if(_0x4ed6fa){_0x491207[_0x1270('0x35')]=_[_0x1270('0x37')](db[_0x1270('0x5d')][_0x1270('0x4c')]);_0x491207[_0x1270('0x36')]=_['keys'](_0x510dcb['query']);_0x491207[_0x1270('0x38')]=_[_0x1270('0x3a')](_0x491207['model'],_0x491207[_0x1270('0x36')]);_0x5a5751[_0x1270('0x39')]=_[_0x1270('0x3a')](_0x491207['model'],qs[_0x1270('0x3b')](_0x510dcb[_0x1270('0x36')][_0x1270('0x3b')]));_0x5a5751[_0x1270('0x39')]=_0x5a5751[_0x1270('0x39')][_0x1270('0x3c')]?_0x5a5751[_0x1270('0x39')]:_0x491207[_0x1270('0x35')];if(!_0x510dcb[_0x1270('0x36')][_0x1270('0x58')](_0x1270('0x3d'))){_0x5a5751[_0x1270('0x22')]=qs[_0x1270('0x22')](_0x510dcb['query'][_0x1270('0x22')]);_0x5a5751[_0x1270('0x1f')]=qs[_0x1270('0x1f')](_0x510dcb[_0x1270('0x36')][_0x1270('0x1f')]);}_0x5a5751['order']=qs[_0x1270('0x3f')](_0x510dcb[_0x1270('0x36')][_0x1270('0x3f')]);_0x5a5751[_0x1270('0x40')]=qs[_0x1270('0x38')](_[_0x1270('0x41')](_0x510dcb['query'],_0x491207['filters']));_0x5a5751[_0x1270('0x40')]['MailAccountId']=_0x4ed6fa['id'];if(_0x510dcb[_0x1270('0x36')]['filter']){_0x5a5751[_0x1270('0x40')]=_[_0x1270('0x42')](_0x5a5751[_0x1270('0x40')],{'$or':_[_0x1270('0x32')](_0x5a5751[_0x1270('0x39')],function(_0xe9f091){var _0x43ebc7={};_0x43ebc7[_0xe9f091]={'$like':'%'+_0x510dcb['query'][_0x1270('0x45')]+'%'};return _0x43ebc7;})});}_0x5a5751=_[_0x1270('0x42')]({},_0x5a5751,_0x510dcb[_0x1270('0x46')]);return db['CannedAnswer'][_0x1270('0x21')]({'where':_0x5a5751[_0x1270('0x40')]})['then'](function(_0x240860){_0x21f3b9[_0x1270('0x21')]=_0x240860;if(_0x510dcb[_0x1270('0x36')][_0x1270('0x4d')]){_0x5a5751[_0x1270('0x4e')]=[{'all':!![]}];}return db['CannedAnswer'][_0x1270('0x60')](_0x5a5751);})[_0x1270('0x13')](function(_0x482e3a){_0x21f3b9[_0x1270('0x47')]=_0x482e3a;return _0x21f3b9;});}})[_0x1270('0x13')](respondWithFilteredResult(_0x5353f2,_0x5a5751))[_0x1270('0x1c')](handleError(_0x5353f2,null));};exports['removeAnswers']=function(_0x5a2394,_0x4e78fe){return db[_0x1270('0x33')]['find']({'where':{'id':_0x5a2394[_0x1270('0x49')]['id']}})[_0x1270('0x13')](handleEntityNotFound(_0x4e78fe,null))[_0x1270('0x13')](function(_0x18f546){if(_0x18f546){return _0x18f546[_0x1270('0x61')](_0x5a2394['query'][_0x1270('0x5a')]);}})[_0x1270('0x13')](respondWithStatusCode(_0x4e78fe,null))[_0x1270('0x1c')](handleError(_0x4e78fe,null));};exports[_0x1270('0x5e')]=function(_0x4a200f,_0x9e1799){var _0x549884={'name':_0x4a200f[_0x1270('0x50')][_0x1270('0x2d')],'key':_0x4a200f[_0x1270('0x50')][_0x1270('0x62')],'provider':_0x4a200f[_0x1270('0x50')][_0x1270('0x63')]===_0x1270('0x64')?null:_0x4a200f['body'][_0x1270('0x63')],'email':_0x4a200f[_0x1270('0x50')][_0x1270('0x65')],'ListId':_0x4a200f[_0x1270('0x50')][_0x1270('0x66')],'active':!_[_0x1270('0x67')](_0x4a200f[_0x1270('0x50')][_0x1270('0x68')])?_0x4a200f[_0x1270('0x50')][_0x1270('0x68')]:!![],'description':_0x4a200f[_0x1270('0x50')][_0x1270('0x69')]||null,'Imap':{},'Smtp':{}};if(_0x549884[_0x1270('0x63')]){_0x549884['Imap'][_0x1270('0x6a')]=_0x549884[_0x1270('0x2f')][_0x1270('0x6a')]=_0x4a200f[_0x1270('0x50')][_0x1270('0x6b')];_0x549884['Imap'][_0x1270('0x6c')]=_0x549884['Smtp'][_0x1270('0x6d')]=_0x4a200f[_0x1270('0x50')][_0x1270('0x6c')];if(_0x4a200f[_0x1270('0x50')][_0x1270('0x52')]){_0x549884[_0x1270('0x2e')][_0x1270('0x52')]=_0x549884[_0x1270('0x2f')][_0x1270('0x52')]=!![];_0x549884[_0x1270('0x2e')]['CloudProviderId']=_0x549884['Smtp'][_0x1270('0x51')]=_0x4a200f[_0x1270('0x50')][_0x1270('0x51')];_0x549884[_0x1270('0x2e')][_0x1270('0x6c')]=_0x549884[_0x1270('0x2f')][_0x1270('0x6d')]=null;}else{_0x549884[_0x1270('0x2e')][_0x1270('0x51')]=_0x549884[_0x1270('0x2f')][_0x1270('0x51')]=null;}_0x549884[_0x1270('0x2e')][_0x1270('0x6e')]=_0x549884[_0x1270('0x2f')][_0x1270('0x6e')]=null;_0x549884[_0x1270('0x2e')][_0x1270('0x6f')]=_0x549884[_0x1270('0x2f')]['host']=null;_0x549884[_0x1270('0x2e')][_0x1270('0x70')]=_0x549884[_0x1270('0x2f')][_0x1270('0x70')]=null;}else{if(_0x4a200f[_0x1270('0x50')]['authentication']){_0x549884['Imap'][_0x1270('0x6a')]=_0x549884[_0x1270('0x2f')]['user']=_0x4a200f[_0x1270('0x50')][_0x1270('0x6b')];_0x549884[_0x1270('0x2e')][_0x1270('0x6c')]=_0x549884['Smtp'][_0x1270('0x6d')]=_0x4a200f[_0x1270('0x50')][_0x1270('0x6c')];}else{_0x549884['Imap'][_0x1270('0x71')]=_0x549884[_0x1270('0x2f')]['authentication']=![];_0x549884['Imap'][_0x1270('0x6a')]=_0x549884['Smtp'][_0x1270('0x6a')]=null;_0x549884[_0x1270('0x2e')]['password']=_0x549884['Smtp']['pass']=null;}_0x549884[_0x1270('0x2e')][_0x1270('0x6f')]=_0x4a200f[_0x1270('0x50')]['Imap']['host'];_0x549884[_0x1270('0x2e')][_0x1270('0x70')]=_0x4a200f[_0x1270('0x50')][_0x1270('0x2e')]['port'];_0x549884['Smtp'][_0x1270('0x6f')]=_0x4a200f[_0x1270('0x50')]['Smtp'][_0x1270('0x6f')];_0x549884[_0x1270('0x2f')][_0x1270('0x70')]=_0x4a200f[_0x1270('0x50')][_0x1270('0x2f')][_0x1270('0x70')];}return db[_0x1270('0x33')][_0x1270('0x5e')](_0x549884,{'include':[{'model':db[_0x1270('0x4b')],'as':'Smtp'},{'model':db[_0x1270('0x4a')],'as':_0x1270('0x2e')}]})[_0x1270('0x13')](function(_0x5c3245){var _0x26db4c=_0x4a200f[_0x1270('0x6a')][_0x1270('0x26')]({'plain':!![]});if(!_0x26db4c)throw new Error(_0x1270('0x72'));if(_0x26db4c[_0x1270('0x73')]==='user'){var _0x5a4a39=_0x5c3245['get']({'plain':!![]});return db['UserProfileSection'][_0x1270('0x4f')]({'where':{'name':'MailAccounts','userProfileId':_0x26db4c[_0x1270('0x74')]},'raw':!![]})[_0x1270('0x13')](function(_0x561130){if(_0x561130&&_0x561130[_0x1270('0x75')]===0x0){return db[_0x1270('0x28')][_0x1270('0x5e')]({'name':_0x5a4a39['name'],'resourceId':_0x5a4a39['id'],'type':_0x561130[_0x1270('0x2d')],'sectionId':_0x561130['id']},{})[_0x1270('0x13')](function(){return _0x5c3245;});}else{return _0x5c3245;}})[_0x1270('0x1c')](function(_0x5ee2c1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ee2c1);throw _0x5ee2c1;});}return _0x5c3245;})[_0x1270('0x13')](respondWithResult(_0x9e1799,0xc9))['catch'](handleError(_0x9e1799,null));};exports['getImap']=function(_0x3c5abc,_0x2af456){return db[_0x1270('0x33')][_0x1270('0x57')]({'where':{'id':_0x3c5abc['params']['id']}})[_0x1270('0x13')](handleEntityNotFound(_0x2af456,null))[_0x1270('0x13')](function(_0x1a08ed){if(_0x1a08ed){return _0x1a08ed[_0x1270('0x76')]();}return null;})[_0x1270('0x13')](respondWithResult(_0x2af456,null))[_0x1270('0x1c')](handleError(_0x2af456,null));};exports[_0x1270('0x77')]=function(_0x2dc23b,_0x3d09eb){if(_0x2dc23b[_0x1270('0x50')]['id']){delete _0x2dc23b['body']['id'];}return db[_0x1270('0x33')][_0x1270('0x4f')]({'where':{'id':_0x2dc23b[_0x1270('0x49')]['id']}})[_0x1270('0x13')](handleEntityNotFound(_0x3d09eb,null))[_0x1270('0x13')](function(_0xa709c9){if(_0xa709c9){_0x2dc23b[_0x1270('0x50')][_0x1270('0x5c')]=_0xa709c9['id'];return db[_0x1270('0x4a')][_0x1270('0x5e')](_0x2dc23b['body']);}})['then'](respondWithResult(_0x3d09eb,null))[_0x1270('0x1c')](handleError(_0x3d09eb,null));};exports[_0x1270('0x78')]=function(_0x3243a1,_0x5c812f){return db[_0x1270('0x33')][_0x1270('0x57')]({'where':{'id':_0x3243a1[_0x1270('0x49')]['id']}})['then'](handleEntityNotFound(_0x5c812f,null))[_0x1270('0x13')](function(_0x4c4597){if(_0x4c4597){return _0x4c4597[_0x1270('0x79')](null);}return null;})[_0x1270('0x13')](respondWithStatusCode(_0x5c812f,null))['catch'](handleError(_0x5c812f,null));};exports['getSmtp']=function(_0x61bd72,_0x3ed210){return db['MailAccount'][_0x1270('0x57')]({'where':{'id':_0x61bd72['params']['id']}})[_0x1270('0x13')](handleEntityNotFound(_0x3ed210,null))[_0x1270('0x13')](function(_0x16306d){if(_0x16306d){return _0x16306d['getSmtp']();}return null;})[_0x1270('0x13')](respondWithResult(_0x3ed210,null))['catch'](handleError(_0x3ed210,null));};exports[_0x1270('0x7a')]=function(_0x2a0a7a,_0x350e8f){if(_0x2a0a7a[_0x1270('0x50')]['id']){delete _0x2a0a7a['body']['id'];}return db[_0x1270('0x33')][_0x1270('0x4f')]({'where':{'id':_0x2a0a7a[_0x1270('0x49')]['id']}})[_0x1270('0x13')](handleEntityNotFound(_0x350e8f,null))[_0x1270('0x13')](function(_0x5e08f3){if(_0x5e08f3){_0x2a0a7a[_0x1270('0x50')][_0x1270('0x5c')]=_0x5e08f3['id'];return db[_0x1270('0x4b')]['create'](_0x2a0a7a[_0x1270('0x50')]);}})['then'](respondWithResult(_0x350e8f,null))[_0x1270('0x1c')](handleError(_0x350e8f,null));};exports[_0x1270('0x7b')]=function(_0x247740,_0x4672d0){return db['MailAccount']['findOne']({'where':{'id':_0x247740[_0x1270('0x49')]['id']}})[_0x1270('0x13')](handleEntityNotFound(_0x4672d0,null))[_0x1270('0x13')](function(_0x4bc608){if(_0x4bc608){return _0x4bc608[_0x1270('0x7c')](null);}return null;})[_0x1270('0x13')](respondWithStatusCode(_0x4672d0,null))[_0x1270('0x1c')](handleError(_0x4672d0,null));};exports[_0x1270('0x7d')]=function(_0x76b0f3,_0x3e6648){return db[_0x1270('0x7e')][_0x1270('0x4f')]({'where':{'id':_0x76b0f3[_0x1270('0x49')]['id']}})['then'](handleEntityNotFound(_0x3e6648,null))[_0x1270('0x13')](function(_0x80b8eb){if(_0x80b8eb){return _0x80b8eb[_0x1270('0x7d')](_0x76b0f3[_0x1270('0x50')][_0x1270('0x5a')],_[_0x1270('0x7f')](_0x76b0f3[_0x1270('0x50')],[_0x1270('0x5a'),'id'])||{});}})[_0x1270('0x13')](respondWithResult(_0x3e6648,null))[_0x1270('0x1c')](handleError(_0x3e6648,null));};exports[_0x1270('0x80')]=function(_0x429333,_0x5419ef){var _0x18042f={'raw':![],'where':{}};var _0x3012f5={};var _0x5e9bfd={'count':0x0,'rows':[]};return db['MailAccount'][_0x1270('0x57')]({'where':{'id':_0x429333[_0x1270('0x49')]['id']}})[_0x1270('0x13')](handleEntityNotFound(_0x5419ef,null))[_0x1270('0x13')](function(_0x56ec70){if(_0x56ec70){_0x3012f5[_0x1270('0x35')]=_[_0x1270('0x37')](db[_0x1270('0x7e')][_0x1270('0x4c')]);_0x3012f5[_0x1270('0x36')]=_['keys'](_0x429333[_0x1270('0x36')]);_0x3012f5[_0x1270('0x38')]=_[_0x1270('0x3a')](_0x3012f5[_0x1270('0x35')],_0x3012f5[_0x1270('0x36')]);_0x18042f[_0x1270('0x39')]=_['intersection'](_0x3012f5[_0x1270('0x35')],qs['fields'](_0x429333[_0x1270('0x36')][_0x1270('0x3b')]));_0x18042f[_0x1270('0x39')]=_0x18042f[_0x1270('0x39')][_0x1270('0x3c')]?_0x18042f[_0x1270('0x39')]:_0x3012f5[_0x1270('0x35')];if(!_0x429333[_0x1270('0x36')][_0x1270('0x58')](_0x1270('0x3d'))){_0x18042f[_0x1270('0x22')]=qs['limit'](_0x429333['query'][_0x1270('0x22')]);_0x18042f['offset']=qs[_0x1270('0x1f')](_0x429333['query']['offset']);}_0x18042f['order']=qs[_0x1270('0x3f')](_0x429333[_0x1270('0x36')][_0x1270('0x3f')]);_0x18042f[_0x1270('0x40')]=qs['filters'](_[_0x1270('0x41')](_0x429333[_0x1270('0x36')],_0x3012f5[_0x1270('0x38')]));_0x18042f[_0x1270('0x40')][_0x1270('0x5c')]=_0x56ec70['id'];if(_0x429333[_0x1270('0x36')][_0x1270('0x45')]){_0x18042f[_0x1270('0x40')]=_[_0x1270('0x42')](_0x18042f[_0x1270('0x40')],{'$or':_[_0x1270('0x32')](_0x18042f[_0x1270('0x39')],function(_0x27ba31){var _0x5f0b4d={};_0x5f0b4d[_0x27ba31]={'$like':'%'+_0x429333[_0x1270('0x36')][_0x1270('0x45')]+'%'};return _0x5f0b4d;})});}_0x18042f=_[_0x1270('0x42')]({},_0x18042f,_0x429333[_0x1270('0x46')]);return db[_0x1270('0x7e')][_0x1270('0x21')]({'where':_0x18042f[_0x1270('0x40')]})[_0x1270('0x13')](function(_0x3ef53d){_0x5e9bfd[_0x1270('0x21')]=_0x3ef53d;if(_0x429333[_0x1270('0x36')]['includeAll']){_0x18042f[_0x1270('0x4e')]=[{'model':db['CmContact'],'as':_0x1270('0x81'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x1270('0x2d'),'fullname',_0x1270('0x82')],'required':![]},{'model':db[_0x1270('0x83')],'as':_0x1270('0x84'),'attributes':['id',_0x1270('0x2d'),_0x1270('0x85')],'where':_0x429333[_0x1270('0x36')][_0x1270('0x86')]?{'id':_0x429333[_0x1270('0x36')][_0x1270('0x86')]}:undefined,'required':_0x429333[_0x1270('0x36')]['tag']?!![]:![]}];}return db[_0x1270('0x7e')][_0x1270('0x60')](_0x18042f);})[_0x1270('0x13')](function(_0x3ec8cb){_0x5e9bfd['rows']=_0x3ec8cb;return _0x5e9bfd;});}})[_0x1270('0x13')](respondWithFilteredResult(_0x5419ef,_0x18042f))[_0x1270('0x1c')](handleError(_0x5419ef,null));};exports[_0x1270('0x87')]=function addApplications(_0x1cf1d7,_0x3f76c3){var _0x2ab022=_0x1cf1d7[_0x1270('0x49')]['id'];var _0x1d8288=_0x1cf1d7[_0x1270('0x50')];var _0x35c41e=0xc8;var _0x2eb5a2=null;return db['sequelize'][_0x1270('0x88')]({'isolationLevel':db[_0x1270('0x89')]['Transaction'][_0x1270('0x8a')]['READ_COMMITTED']},function(_0xd3cba4){return db[_0x1270('0x33')][_0x1270('0x57')]({'where':{'id':_0x2ab022},'transaction':_0xd3cba4})[_0x1270('0x13')](function(_0x3db7c4){if(_0x3db7c4){return db['MailApplication'][_0x1270('0x29')]({'where':{'MailAccountId':_0x2ab022},'transaction':_0xd3cba4})[_0x1270('0x13')](function(){var _0x47b590=_[_0x1270('0x32')](_0x1d8288,function(_0x5682f2){_0x5682f2['MailAccountId']=_0x2ab022;return _0x5682f2;});return db[_0x1270('0x8b')]['bulkCreate'](_0x47b590,{'transaction':_0xd3cba4});});}else{_0x35c41e=0x194;_0x2eb5a2=[];}});})[_0x1270('0x13')](function(){if(_0x35c41e!==0x194){return db[_0x1270('0x8b')]['findAndCountAll']({'where':{'MailAccountId':_0x2ab022},'order':'priority'})[_0x1270('0x13')](function(_0x2deb16){_0x2eb5a2=_0x2deb16;});}})['catch'](function(_0x581971){_0x35c41e=0x1f4;logger[_0x1270('0x18')](_0x581971[_0x1270('0x2c')]);if(_0x581971[_0x1270('0x2d')]){delete _0x581971['name'];}_0x2eb5a2=_0x581971;})['finally'](function(){if(_0x2eb5a2===null){_0x3f76c3[_0x1270('0x2b')](_0x35c41e);}else{if(_0x35c41e===0x1f4){_0x3f76c3[_0x1270('0x1d')](_0x35c41e)[_0x1270('0x8c')](_0x2eb5a2);}else{_0x3f76c3[_0x1270('0x1d')](_0x35c41e)[_0x1270('0x1e')](_0x2eb5a2);}}});};exports[_0x1270('0x8d')]=function(_0x53b10b,_0x11ce3e){var _0x27a8f8={};var _0x67d687={};var _0x3097b0;var _0x2aae8a;return db[_0x1270('0x33')][_0x1270('0x57')]({'where':{'id':_0x53b10b[_0x1270('0x49')]['id']}})[_0x1270('0x13')](handleEntityNotFound(_0x11ce3e,null))['then'](function(_0xb40049){if(_0xb40049){_0x3097b0=_0xb40049;_0x67d687[_0x1270('0x35')]=_['keys'](db['MailApplication'][_0x1270('0x4c')]);_0x67d687['query']=_[_0x1270('0x37')](_0x53b10b[_0x1270('0x36')]);_0x67d687[_0x1270('0x38')]=_['intersection'](_0x67d687[_0x1270('0x35')],_0x67d687[_0x1270('0x36')]);_0x27a8f8[_0x1270('0x39')]=_['intersection'](_0x67d687['model'],qs[_0x1270('0x3b')](_0x53b10b['query'][_0x1270('0x3b')]));_0x27a8f8['attributes']=_0x27a8f8['attributes'][_0x1270('0x3c')]?_0x27a8f8[_0x1270('0x39')]:_0x67d687['model'];_0x27a8f8['order']=qs[_0x1270('0x3f')](_0x53b10b[_0x1270('0x36')][_0x1270('0x3f')]);_0x27a8f8[_0x1270('0x40')]=qs[_0x1270('0x38')](_['pick'](_0x53b10b['query'],_0x67d687[_0x1270('0x38')]));if(_0x53b10b[_0x1270('0x36')]['filter']){_0x27a8f8[_0x1270('0x40')]=_['merge'](_0x27a8f8[_0x1270('0x40')],{'$or':_[_0x1270('0x32')](_0x27a8f8[_0x1270('0x39')],function(_0x12ae24){var _0x594590={};_0x594590[_0x12ae24]={'$like':'%'+_0x53b10b['query'][_0x1270('0x45')]+'%'};return _0x594590;})});}_0x27a8f8=_['merge']({},_0x27a8f8,_0x53b10b[_0x1270('0x46')]);return _0x3097b0['getApplications'](_0x27a8f8);}})[_0x1270('0x13')](function(_0x4fe429){if(_0x4fe429){_0x2aae8a=_0x4fe429[_0x1270('0x3c')];if(!_0x53b10b[_0x1270('0x36')][_0x1270('0x58')](_0x1270('0x3d'))){_0x27a8f8['limit']=qs[_0x1270('0x22')](_0x53b10b[_0x1270('0x36')][_0x1270('0x22')]);_0x27a8f8[_0x1270('0x1f')]=qs[_0x1270('0x1f')](_0x53b10b[_0x1270('0x36')][_0x1270('0x1f')]);}return _0x3097b0[_0x1270('0x8d')](_0x27a8f8);}})[_0x1270('0x13')](function(_0x1ce04f){if(_0x1ce04f){return _0x1ce04f?{'count':_0x2aae8a,'rows':_0x1ce04f}:null;}})['then'](respondWithResult(_0x11ce3e,null))[_0x1270('0x1c')](handleError(_0x11ce3e,null));};exports[_0x1270('0x8e')]=function(_0x344ae2,_0x437a8d){var _0x12619b={'raw':!![],'where':{}};var _0x20f258={};var _0x4e02f7={'count':0x0,'rows':[]};return db[_0x1270('0x33')][_0x1270('0x57')]({'where':{'id':_0x344ae2['params']['id']}})[_0x1270('0x13')](handleEntityNotFound(_0x437a8d,null))[_0x1270('0x13')](function(_0x172c15){if(_0x172c15){_0x20f258[_0x1270('0x35')]=_[_0x1270('0x37')](db[_0x1270('0x8f')]['rawAttributes']);_0x20f258['query']=_[_0x1270('0x37')](_0x344ae2[_0x1270('0x36')]);_0x20f258[_0x1270('0x38')]=_['intersection'](_0x20f258[_0x1270('0x35')],_0x20f258['query']);_0x12619b[_0x1270('0x39')]=_[_0x1270('0x3a')](_0x20f258['model'],qs[_0x1270('0x3b')](_0x344ae2[_0x1270('0x36')][_0x1270('0x3b')]));_0x12619b['attributes']=_0x12619b[_0x1270('0x39')][_0x1270('0x3c')]?_0x12619b[_0x1270('0x39')]:_0x20f258[_0x1270('0x35')];if(!_0x344ae2[_0x1270('0x36')]['hasOwnProperty'](_0x1270('0x3d'))){_0x12619b[_0x1270('0x22')]=qs['limit'](_0x344ae2[_0x1270('0x36')][_0x1270('0x22')]);_0x12619b['offset']=qs[_0x1270('0x1f')](_0x344ae2['query']['offset']);}_0x12619b[_0x1270('0x3e')]=qs[_0x1270('0x3f')](_0x344ae2[_0x1270('0x36')][_0x1270('0x3f')]);_0x12619b['where']=qs[_0x1270('0x38')](_[_0x1270('0x41')](_0x344ae2[_0x1270('0x36')],_0x20f258[_0x1270('0x38')]));_0x12619b[_0x1270('0x40')][_0x1270('0x5c')]=_0x172c15['id'];if(_0x344ae2[_0x1270('0x36')][_0x1270('0x45')]){_0x12619b['where']=_[_0x1270('0x42')](_0x12619b[_0x1270('0x40')],{'$or':_[_0x1270('0x32')](_0x12619b['attributes'],function(_0x5d4811){var _0x57ff7e={};_0x57ff7e[_0x5d4811]={'$like':'%'+_0x344ae2[_0x1270('0x36')][_0x1270('0x45')]+'%'};return _0x57ff7e;})});}if(_0x344ae2[_0x1270('0x36')]['$gte']){var _0x4c51b0=_0x344ae2[_0x1270('0x36')]['$gte'][_0x1270('0x90')](',');var _0x5dba40={};_0x5dba40[_0x4c51b0[0x0]]={'$gte':moment(_0x4c51b0[0x1])[_0x1270('0x91')]('YYYY-MM-DD\x20HH:mm:ss')};_0x12619b[_0x1270('0x40')]=_[_0x1270('0x42')](_0x12619b['where'],_0x5dba40);}_0x12619b=_[_0x1270('0x42')]({},_0x12619b,_0x344ae2[_0x1270('0x46')]);return db[_0x1270('0x8f')]['count']({'where':_0x12619b['where']})[_0x1270('0x13')](function(_0x3f4c6f){_0x4e02f7[_0x1270('0x21')]=_0x3f4c6f;if(_0x344ae2['query'][_0x1270('0x4d')]){_0x12619b[_0x1270('0x4e')]=[{'all':!![]}];}return db[_0x1270('0x8f')][_0x1270('0x60')](_0x12619b);})[_0x1270('0x13')](function(_0x5beea3){if(_0x344ae2[_0x1270('0x36')][_0x1270('0x92')]===_0x1270('0x93')){for(var _0x2e8f2e=0x0;_0x2e8f2e<_0x5beea3[_0x1270('0x3c')];_0x2e8f2e++){_0x5beea3[_0x2e8f2e][_0x1270('0x50')]=juice(_0x5beea3[_0x2e8f2e][_0x1270('0x50')]);}}_0x4e02f7[_0x1270('0x47')]=_0x5beea3;return _0x4e02f7;});}})[_0x1270('0x13')](respondWithFilteredResult(_0x437a8d,_0x12619b))[_0x1270('0x1c')](handleError(_0x437a8d,null));};exports['send']=function(_0x45e135,_0x59927a){var _0x28f5b2,_0x5950de={},_0x1bed1d;if(_0x45e135['body']['to']){_0x1bed1d=_0x45e135[_0x1270('0x50')]['to'][_0x1270('0x90')](',')[0x0];}return db[_0x1270('0x33')]['find']({'where':{'id':_0x45e135[_0x1270('0x49')]['id']},'include':[{'model':db['CmList'],'as':_0x1270('0x94'),'include':[{'model':db[_0x1270('0x95')],'as':_0x1270('0x96'),'where':{'email':_0x1bed1d},'limit':0x1,'order':[[_0x1270('0x97'),_0x1270('0x98')]]}]},{'model':db[_0x1270('0x4b')],'as':_0x1270('0x2f'),'raw':!![]}]})[_0x1270('0x13')](handleEntityNotFound(_0x59927a,null))[_0x1270('0x13')](function(_0xc82a04){if(_0xc82a04){_0x28f5b2=_0xc82a04;if(_0xc82a04[_0x1270('0x2f')]){if(_[_0x1270('0x67')](_0x45e135[_0x1270('0x50')][_0x1270('0x99')])){_0x45e135['body']['from']=util[_0x1270('0x91')](_0x1270('0x9a'),_0xc82a04[_0x1270('0x2d')],_0xc82a04['email']||_0xc82a04[_0x1270('0x2f')][_0x1270('0x6a')]);}if(_0x45e135[_0x1270('0x50')]['attachments']&&_0x45e135['body'][_0x1270('0x9b')][_0x1270('0x3c')]){for(var _0x243c0e=0x0;_0x243c0e<_0x45e135[_0x1270('0x50')][_0x1270('0x9b')][_0x1270('0x3c')];_0x243c0e+=0x1){_0x45e135[_0x1270('0x50')][_0x1270('0x9b')][_0x243c0e]={'filename':_0x45e135[_0x1270('0x50')]['attachments'][_0x243c0e][_0x1270('0x2d')],'path':path[_0x1270('0x9c')](config[_0x1270('0x9d')],'server/files/attachments',_0x45e135[_0x1270('0x50')][_0x1270('0x9b')][_0x243c0e][_0x1270('0x9e')])};}}var _0x10d1b0={'tls':{'rejectUnauthorized':![]}};if(_[_0x1270('0x67')](_0xc82a04[_0x1270('0x2f')][_0x1270('0x6e')])){if(_0xc82a04['Smtp']['authentication']){_0x10d1b0['auth']={'user':_0xc82a04[_0x1270('0x2f')]['user'],'pass':_0xc82a04[_0x1270('0x2f')][_0x1270('0x6d')]};}_0x10d1b0[_0x1270('0x6f')]=_0xc82a04[_0x1270('0x2f')][_0x1270('0x6f')];_0x10d1b0[_0x1270('0x70')]=_0xc82a04[_0x1270('0x2f')]['port'];_0x10d1b0['secure']=_0xc82a04[_0x1270('0x2f')]['secure'];}else{_0x10d1b0[_0x1270('0x6e')]=_0xc82a04[_0x1270('0x2f')][_0x1270('0x6e')];_0x10d1b0[_0x1270('0x9f')]={'user':_0xc82a04['Smtp'][_0x1270('0x6a')],'pass':_0xc82a04[_0x1270('0x2f')][_0x1270('0x6d')]};}return respondWithRpcPromise('SendMail',_0x1270('0xa0'),{'account':_0x10d1b0,'message':_0x45e135[_0x1270('0x50')]});}else{throw new Error(_0x1270('0xa1'));}}})[_0x1270('0x13')](function(_0x3543d6){if(_0x3543d6){_0x5950de=_0x3543d6;if(_0x28f5b2['List']){if(_0x28f5b2[_0x1270('0x94')]['Contacts'][_0x1270('0x3c')]){return _0x28f5b2['List'][_0x1270('0x96')][0x0];}else{return db[_0x1270('0x95')][_0x1270('0x5e')](_[_0x1270('0xb')](_0x45e135[_0x1270('0x50')],{'firstName':_0x45e135[_0x1270('0x50')]['to'],'email':_0x45e135[_0x1270('0x50')]['to'],'phone':_0x45e135['body']['to'],'ListId':_0x28f5b2[_0x1270('0x66')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x1270('0x13')](function(_0x38e6d9){if(_0x38e6d9){var _0x27de58={'UserId':_0x45e135['user']['id'],'ContactId':_0x38e6d9['id'],'MailAccountId':_0x28f5b2['id'],'inReplyTo':_0x5950de[_0x1270('0xa2')],'to':_0x45e135[_0x1270('0x50')][_0x1270('0x99')],'cc':_0x45e135[_0x1270('0x50')]['cc'],'subject':_0x45e135[_0x1270('0x50')]['subject'],'attach':_0x45e135[_0x1270('0x50')][_0x1270('0xa3')],'firstMsgDirection':_0x1270('0xa4'),'lastMsgAt':moment()[_0x1270('0x91')](_0x1270('0xa5')),'lastMsgDirection':_0x1270('0xa4'),'Messages':[_[_0x1270('0x42')](_0x45e135[_0x1270('0x50')],{'messageId':_0x5950de[_0x1270('0xa2')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x28f5b2['id'],'UserId':_0x45e135['user']['id'],'ContactId':_0x38e6d9['id']})]};if(_0x45e135[_0x1270('0x50')][_0x1270('0xa6')]){_0x27de58=_[_0x1270('0x42')](_0x27de58,_0x45e135['body'][_0x1270('0xa6')]);}return db[_0x1270('0x7e')]['create'](_0x27de58,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});}})['then'](respondWithResult(_0x59927a,null))[_0x1270('0x1c')](handleError(_0x59927a,null));};exports['verifySmtp']=function(_0x4bdf14,_0x554790){return db[_0x1270('0x33')]['find']({'where':{'id':_0x4bdf14['params']['id']},'include':[{'model':db[_0x1270('0x4b')],'as':_0x1270('0x2f'),'raw':!![],'include':[{'model':db[_0x1270('0xa7')],'as':_0x1270('0xa7'),'raw':!![]}]}]})[_0x1270('0x13')](handleEntityNotFound(_0x554790,null))[_0x1270('0x13')](function(_0x288d9c){if(!_0x288d9c[_0x1270('0x2f')])return;var _0xfdfc34={'id':_0x288d9c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x288d9c[_0x1270('0x63')]!==_0x1270('0x64')){_0xfdfc34[_0x1270('0x6e')]=_0x288d9c['provider'];}else{_0xfdfc34[_0x1270('0x6f')]=_0x288d9c[_0x1270('0x2f')][_0x1270('0x6f')];_0xfdfc34['port']=_0x288d9c[_0x1270('0x2f')][_0x1270('0x70')];_0xfdfc34[_0x1270('0xa8')]=_0x288d9c[_0x1270('0x2f')]['secure'];}if(_0x288d9c['Smtp'][_0x1270('0x71')]){if(_0x288d9c[_0x1270('0x2f')][_0x1270('0x52')]){_0xfdfc34[_0x1270('0x9f')]={'type':_0x1270('0xa9'),'user':_0x288d9c['Smtp'][_0x1270('0x6a')],'accessToken':_0x288d9c[_0x1270('0x2f')]['CloudProvider'][_0x1270('0xaa')]};}else{_0xfdfc34[_0x1270('0x9f')]={'user':_0x288d9c['Smtp']['user'],'pass':_0x288d9c[_0x1270('0x2f')][_0x1270('0x6d')]};}}return respondWithRpcPromise(_0x1270('0xab'),_0x1270('0xac'),{'account':_0xfdfc34});})[_0x1270('0x13')](respondWithResult(_0x554790,null))[_0x1270('0x1c')](handleError(_0x554790,null));};exports[_0x1270('0x29')]=function(_0x18d090,_0x3886e1){return db[_0x1270('0x33')][_0x1270('0x4f')]({'where':{'id':_0x18d090[_0x1270('0x49')]['id']}})[_0x1270('0x13')](handleEntityNotFound(_0x3886e1,null))[_0x1270('0x13')](function(_0x4d69df){if(_0x4d69df&&_0x4d69df['service']){throw new db[(_0x1270('0xad'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x4d69df;})[_0x1270('0x13')](removeEntity(_0x3886e1,null))[_0x1270('0x1c')](handleError(_0x3886e1,null));};exports[_0x1270('0xae')]=function(_0x1df692,_0x525abe){return db[_0x1270('0x33')][_0x1270('0x4f')]({'where':{'id':_0x1df692[_0x1270('0x49')]['id']}})[_0x1270('0x13')](handleEntityNotFound(_0x525abe,null))['then'](function(_0x3f80f9){if(_0x3f80f9){return _0x3f80f9[_0x1270('0xae')](_0x1df692[_0x1270('0x50')][_0x1270('0x5a')],_[_0x1270('0x7f')](_0x1df692[_0x1270('0x50')],[_0x1270('0x5a'),'id'])||{})[_0x1270('0xaf')](function(_0x5da5b8){for(var _0x1b614f=0x0;_0x1b614f<_0x1df692[_0x1270('0x50')][_0x1270('0x5a')][_0x1270('0x3c')];_0x1b614f+=0x1){socket['emit'](_0x1270('0xb0'),{'UserId':Number(_0x1df692['body'][_0x1270('0x5a')][_0x1b614f]),'MailAccountId':Number(_0x1df692[_0x1270('0x49')]['id'])});}return _0x5da5b8;});}})['then'](respondWithResult(_0x525abe,null))[_0x1270('0x1c')](handleError(_0x525abe,null));};exports[_0x1270('0xb1')]=function(_0xec6709,_0x489754){return db['MailAccount'][_0x1270('0x4f')]({'where':{'id':_0xec6709['params']['id']}})[_0x1270('0x13')](handleEntityNotFound(_0x489754,null))['then'](function(_0x3001dc){if(_0x3001dc){return _0x3001dc[_0x1270('0xb1')](_0xec6709[_0x1270('0x36')][_0x1270('0x5a')])['then'](function(){if(_['isArray'](_0xec6709[_0x1270('0x36')][_0x1270('0x5a')])){for(var _0x215f59=0x0;_0x215f59<_0xec6709[_0x1270('0x36')][_0x1270('0x5a')]['length'];_0x215f59+=0x1){socket['emit'](_0x1270('0xb2'),{'UserId':Number(_0xec6709[_0x1270('0x36')][_0x1270('0x5a')][_0x215f59]),'MailAccountId':Number(_0xec6709['params']['id'])});}}else{socket[_0x1270('0xb3')](_0x1270('0xb2'),{'UserId':Number(_0xec6709[_0x1270('0x36')][_0x1270('0x5a')]),'MailAccountId':Number(_0xec6709[_0x1270('0x49')]['id'])});}});}})[_0x1270('0x13')](respondWithStatusCode(_0x489754,null))[_0x1270('0x1c')](handleError(_0x489754,null));};exports[_0x1270('0xb4')]=function(_0x7e3611,_0x9068d0){var _0x5ba7e6={};var _0x5089b6={};var _0x17290a;var _0x4e8150;return db['MailAccount'][_0x1270('0x57')]({'where':{'id':_0x7e3611[_0x1270('0x49')]['id']}})[_0x1270('0x13')](handleEntityNotFound(_0x9068d0,null))[_0x1270('0x13')](function(_0x301084){if(_0x301084){_0x17290a=_0x301084;_0x5089b6[_0x1270('0x35')]=_['keys'](db[_0x1270('0xb5')][_0x1270('0x4c')]);_0x5089b6[_0x1270('0x36')]=_[_0x1270('0x37')](_0x7e3611[_0x1270('0x36')]);_0x5089b6[_0x1270('0x38')]=_[_0x1270('0x3a')](_0x5089b6['model'],_0x5089b6['query']);_0x5ba7e6[_0x1270('0x39')]=_[_0x1270('0x3a')](_0x5089b6['model'],qs[_0x1270('0x3b')](_0x7e3611[_0x1270('0x36')][_0x1270('0x3b')]));_0x5ba7e6[_0x1270('0x39')]=_0x5ba7e6[_0x1270('0x39')][_0x1270('0x3c')]?_0x5ba7e6[_0x1270('0x39')]:_0x5089b6[_0x1270('0x35')];_0x5ba7e6[_0x1270('0x3e')]=qs[_0x1270('0x3f')](_0x7e3611[_0x1270('0x36')]['sort']);_0x5ba7e6['where']=qs['filters'](_[_0x1270('0x41')](_0x7e3611[_0x1270('0x36')],_0x5089b6['filters']));if(_0x7e3611[_0x1270('0x36')]['filter']){_0x5ba7e6[_0x1270('0x40')]=_[_0x1270('0x42')](_0x5ba7e6[_0x1270('0x40')],{'$or':_[_0x1270('0x32')](_0x5ba7e6['attributes'],function(_0x142fd1){var _0x3767bf={};_0x3767bf[_0x142fd1]={'$like':'%'+_0x7e3611[_0x1270('0x36')][_0x1270('0x45')]+'%'};return _0x3767bf;})});}_0x5ba7e6=_[_0x1270('0x42')]({},_0x5ba7e6,_0x7e3611[_0x1270('0x46')]);return _0x17290a[_0x1270('0xb4')](_0x5ba7e6);}})[_0x1270('0x13')](function(_0x10051d){if(_0x10051d){_0x4e8150=_0x10051d[_0x1270('0x3c')];if(!_0x7e3611[_0x1270('0x36')][_0x1270('0x58')]('nolimit')){_0x5ba7e6[_0x1270('0x22')]=qs[_0x1270('0x22')](_0x7e3611[_0x1270('0x36')][_0x1270('0x22')]);_0x5ba7e6[_0x1270('0x1f')]=qs[_0x1270('0x1f')](_0x7e3611[_0x1270('0x36')][_0x1270('0x1f')]);}return _0x17290a[_0x1270('0xb4')](_0x5ba7e6);}})['then'](function(_0xc12c74){if(_0xc12c74){return _0xc12c74?{'count':_0x4e8150,'rows':_0xc12c74}:null;}})['then'](respondWithResult(_0x9068d0,null))[_0x1270('0x1c')](handleError(_0x9068d0,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 9cac5a3..55e62a0 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 _0xc359=['save','update','emit','../../mysqldb','setMaxListeners'];(function(_0x370460,_0x3a7cb7){var _0x490353=function(_0x554fab){while(--_0x554fab){_0x370460['push'](_0x370460['shift']());}};_0x490353(++_0x3a7cb7);}(_0xc359,0x1d9));var _0x9c35=function(_0x1b1a3b,_0x52a88a){_0x1b1a3b=_0x1b1a3b-0x0;var _0x385347=_0xc359[_0x1b1a3b];return _0x385347;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x9c35('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9c35('0x1')](0x0);var events={'afterCreate':_0x9c35('0x2'),'afterUpdate':_0x9c35('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3cfffd){return function(_0x53a490,_0x1540b4,_0x5d4ee8){MailAccountEvents[_0x9c35('0x4')](_0x3cfffd+':'+_0x53a490['id'],_0x53a490);MailAccountEvents['emit'](_0x3cfffd,_0x53a490);_0x5d4ee8(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 +var _0x7804=['hasOwnProperty','hook','exports','events','MailAccount','setMaxListeners','save','remove'];(function(_0x4c02cb,_0x24735a){var _0x450542=function(_0x17f421){while(--_0x17f421){_0x4c02cb['push'](_0x4c02cb['shift']());}};_0x450542(++_0x24735a);}(_0x7804,0xc3));var _0x4780=function(_0x472f51,_0x40d5ca){_0x472f51=_0x472f51-0x0;var _0x20af2e=_0x7804[_0x472f51];return _0x20af2e;};'use strict';var EventEmitter=require(_0x4780('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x4780('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4780('0x2')](0x0);var events={'afterCreate':_0x4780('0x3'),'afterUpdate':'update','afterDestroy':_0x4780('0x4')};function emitEvent(_0xf88f45){return function(_0x5bf1d7,_0x50f186,_0x20f86d){MailAccountEvents['emit'](_0xf88f45+':'+_0x5bf1d7['id'],_0x5bf1d7);MailAccountEvents['emit'](_0xf88f45,_0x5bf1d7);_0x20f86d(null);};}for(var e in events){if(events[_0x4780('0x5')](e)){var event=events[e];MailAccount[_0x4780('0x6')](e,emitEvent(event));}}module[_0x4780('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index e6a42bc..f266777 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 _0xac61=['../../config/environment','exports','define','mail_accounts','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xe26ee,_0x283f2a){var _0x3e1d7d=function(_0xcce0e){while(--_0xcce0e){_0xe26ee['push'](_0xe26ee['shift']());}};_0x3e1d7d(++_0x283f2a);}(_0xac61,0x88));var _0x1ac6=function(_0x2bab48,_0x390d33){_0x2bab48=_0x2bab48-0x0;var _0x4df5a0=_0xac61[_0x2bab48];return _0x4df5a0;};'use strict';var _=require('lodash');var util=require(_0x1ac6('0x0'));var logger=require('../../config/logger')(_0x1ac6('0x1'));var moment=require(_0x1ac6('0x2'));var BPromise=require(_0x1ac6('0x3'));var rp=require(_0x1ac6('0x4'));var fs=require('fs');var path=require(_0x1ac6('0x5'));var rimraf=require(_0x1ac6('0x6'));var config=require(_0x1ac6('0x7'));var attributes=require('./mailAccount.attributes');module[_0x1ac6('0x8')]=function(_0x2f3ed5,_0x289c0e){return _0x2f3ed5[_0x1ac6('0x9')]('MailAccount',attributes,{'tableName':_0x1ac6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24b0=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','./mailAccount.attributes','exports','MailAccount','mail_accounts'];(function(_0x246f92,_0xcf7bd4){var _0x2b8e7d=function(_0x9e8650){while(--_0x9e8650){_0x246f92['push'](_0x246f92['shift']());}};_0x2b8e7d(++_0xcf7bd4);}(_0x24b0,0xdc));var _0x024b=function(_0x42aa68,_0x4581c4){_0x42aa68=_0x42aa68-0x0;var _0x357dbb=_0x24b0[_0x42aa68];return _0x357dbb;};'use strict';var _=require(_0x024b('0x0'));var util=require('util');var logger=require(_0x024b('0x1'))(_0x024b('0x2'));var moment=require(_0x024b('0x3'));var BPromise=require(_0x024b('0x4'));var rp=require(_0x024b('0x5'));var fs=require('fs');var path=require(_0x024b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x024b('0x7'));module[_0x024b('0x8')]=function(_0x51c40c,_0x26d3e0){return _0x51c40c['define'](_0x024b('0x9'),attributes,{'tableName':_0x024b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index a81633e..283e98b 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 _0x4b92=['from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','account','CmList','Contacts','DESC','MailApplication','MailServerOut','Smtp','List','get','Applications','applications','list','priority','asc','autoclose','push','length','*,*,*,*','ListId','create','List\x20not\x20found','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','subject','created','contact','attachments','originTo','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetMailAccount','findAll','options','raw','attributes','limit','map','include','model','stringify','catch','ShowMailAccount','find','debug','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','from'];(function(_0x3f3719,_0x325e57){var _0x5de540=function(_0x19d6f5){while(--_0x19d6f5){_0x3f3719['push'](_0x3f3719['shift']());}};_0x5de540(++_0x325e57);}(_0x4b92,0x170));var _0x24b9=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x4b92[_0x5447fd];return _0x15b28a;};'use strict';var _=require('lodash');var util=require(_0x24b9('0x0'));var moment=require(_0x24b9('0x1'));var BPromise=require(_0x24b9('0x2'));var rs=require(_0x24b9('0x3'));var fs=require('fs');var Redis=require(_0x24b9('0x4'));var db=require(_0x24b9('0x5'))['db'];var utils=require(_0x24b9('0x6'));var logger=require(_0x24b9('0x7'))(_0x24b9('0x8'));var config=require(_0x24b9('0x9'));var jayson=require(_0x24b9('0xa'));var client=jayson[_0x24b9('0xb')]['http']({'port':0x232c});config[_0x24b9('0xc')]=_[_0x24b9('0xd')](config[_0x24b9('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x24b9('0xc')]));require(_0x24b9('0xe'))['register'](socket);function respondWithRpcPromise(_0xc4f42c,_0x5f2220,_0xc89eeb){return new BPromise(function(_0x5b081e,_0x4bcaca){return client[_0x24b9('0xf')](_0xc4f42c,_0xc89eeb)[_0x24b9('0x10')](function(_0x49015e){logger[_0x24b9('0x11')](_0x24b9('0x12'),_0x5f2220,'request\x20sent');logger['debug'](_0x24b9('0x13'),_0x5f2220,_0x24b9('0x14'),JSON['stringify'](_0x49015e));if(_0x49015e['error']){if(_0x49015e[_0x24b9('0x15')][_0x24b9('0x16')]===0x1f4){logger[_0x24b9('0x15')]('MailAccount,\x20%s,\x20%s',_0x5f2220,_0x49015e[_0x24b9('0x15')][_0x24b9('0x17')]);return _0x4bcaca(_0x49015e['error'][_0x24b9('0x17')]);}logger[_0x24b9('0x15')]('MailAccount,\x20%s,\x20%s',_0x5f2220,_0x49015e[_0x24b9('0x15')][_0x24b9('0x17')]);return _0x5b081e(_0x49015e[_0x24b9('0x15')]['message']);}else{logger[_0x24b9('0x11')](_0x24b9('0x12'),_0x5f2220,'request\x20sent');_0x5b081e(_0x49015e['result'][_0x24b9('0x17')]);}})['catch'](function(_0x341dc8){logger[_0x24b9('0x15')]('MailAccount,\x20%s,\x20%s',_0x5f2220,_0x341dc8);_0x4bcaca(_0x341dc8);});});}exports[_0x24b9('0x18')]=function(_0x378ee3){var _0x159ad2=this;return new Promise(function(_0x198343,_0x114698){return db['MailAccount'][_0x24b9('0x19')]({'raw':_0x378ee3[_0x24b9('0x1a')]?_0x378ee3[_0x24b9('0x1a')][_0x24b9('0x1b')]===undefined?!![]:![]:!![],'where':_0x378ee3[_0x24b9('0x1a')]?_0x378ee3[_0x24b9('0x1a')]['where']||null:null,'attributes':_0x378ee3[_0x24b9('0x1a')]?_0x378ee3[_0x24b9('0x1a')][_0x24b9('0x1c')]||null:null,'limit':_0x378ee3['options']?_0x378ee3[_0x24b9('0x1a')][_0x24b9('0x1d')]||null:null,'include':_0x378ee3[_0x24b9('0x1a')]?_0x378ee3['options']['include']?_[_0x24b9('0x1e')](_0x378ee3['options'][_0x24b9('0x1f')],function(_0x704cd5){return{'model':db[_0x704cd5[_0x24b9('0x20')]],'as':_0x704cd5['as'],'attributes':_0x704cd5[_0x24b9('0x1c')],'include':_0x704cd5[_0x24b9('0x1f')]?_[_0x24b9('0x1e')](_0x704cd5[_0x24b9('0x1f')],function(_0x21a942){return{'model':db[_0x21a942['model']],'as':_0x21a942['as'],'attributes':_0x21a942[_0x24b9('0x1c')],'include':_0x21a942[_0x24b9('0x1f')]?_[_0x24b9('0x1e')](_0x21a942[_0x24b9('0x1f')],function(_0x32b76b){return{'model':db[_0x32b76b[_0x24b9('0x20')]],'as':_0x32b76b['as'],'attributes':_0x32b76b[_0x24b9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x24b9('0x10')](function(_0x33e677){logger[_0x24b9('0x11')]('GetMailAccount',_0x378ee3);logger['debug'](_0x24b9('0x18'),_0x378ee3,JSON[_0x24b9('0x21')](_0x33e677));_0x198343(_0x33e677);})[_0x24b9('0x22')](function(_0x2a8a08){logger['error']('GetMailAccount',_0x2a8a08[_0x24b9('0x17')],_0x378ee3);_0x114698(_0x159ad2['error'](0x1f4,_0x2a8a08[_0x24b9('0x17')]));});});};exports[_0x24b9('0x23')]=function(_0x453d91){var _0xb26c77=this;return new Promise(function(_0x31bc4c,_0x3cbfcb){return db['MailAccount'][_0x24b9('0x24')]({'raw':_0x453d91['options']?_0x453d91[_0x24b9('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x453d91[_0x24b9('0x1a')]?_0x453d91['options']['where']||null:null,'attributes':_0x453d91[_0x24b9('0x1a')]?_0x453d91[_0x24b9('0x1a')][_0x24b9('0x1c')]||null:null,'include':_0x453d91['options']?_0x453d91[_0x24b9('0x1a')]['include']?_[_0x24b9('0x1e')](_0x453d91[_0x24b9('0x1a')][_0x24b9('0x1f')],function(_0x3a593b){return{'model':db[_0x3a593b['model']],'as':_0x3a593b['as'],'attributes':_0x3a593b[_0x24b9('0x1c')],'include':_0x3a593b['include']?_[_0x24b9('0x1e')](_0x3a593b[_0x24b9('0x1f')],function(_0x49f120){return{'model':db[_0x49f120[_0x24b9('0x20')]],'as':_0x49f120['as'],'attributes':_0x49f120[_0x24b9('0x1c')],'include':_0x49f120['include']?_[_0x24b9('0x1e')](_0x49f120[_0x24b9('0x1f')],function(_0x45faba){return{'model':db[_0x45faba[_0x24b9('0x20')]],'as':_0x45faba['as'],'attributes':_0x45faba[_0x24b9('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2287ef){logger[_0x24b9('0x11')]('ShowMailAccount',_0x453d91);logger[_0x24b9('0x25')](_0x24b9('0x23'),_0x453d91,JSON[_0x24b9('0x21')](_0x2287ef));_0x31bc4c(_0x2287ef);})[_0x24b9('0x22')](function(_0x10812d){logger[_0x24b9('0x15')](_0x24b9('0x23'),_0x10812d[_0x24b9('0x17')],_0x453d91);_0x3cbfcb(_0xb26c77[_0x24b9('0x15')](0x1f4,_0x10812d[_0x24b9('0x17')]));});});};exports['NotifyMailAccount']=function(_0x3b40c7){var _0x46caf8=this;return new Promise(function(_0x3ff034,_0x10f9d7){var _0x149a9e={'body':_0x3b40c7[_0x24b9('0x26')],'channel':_0x24b9('0x27')};var _0x21d932=_[_0x24b9('0x28')](_[_0x24b9('0x29')](db[_0x24b9('0x2a')][_0x24b9('0x2b')]),[_0x24b9('0x2c'),_0x24b9('0x2d'),_0x24b9('0x2e'),'ListId']);var _0x2759c7=![];if(_0x3b40c7['body']['id']){delete _0x3b40c7['body']['id'];}if(_['isNil'](_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x2f')])){return _0x10f9d7(_0x46caf8[_0x24b9('0x15')](0x1f4,_0x24b9('0x30')));}if(_[_0x24b9('0x31')](_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x26')])||_0x3b40c7['body'][_0x24b9('0x26')]===''){return _0x10f9d7(_0x46caf8[_0x24b9('0x15')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x32')])){return _0x10f9d7(_0x46caf8['error'](0x1f4,_0x24b9('0x33')+_0x21d932));}if(!_['includes'](_0x21d932,_0x3b40c7[_0x24b9('0x26')]['mapKey'])){return _0x10f9d7(_0x46caf8[_0x24b9('0x15')](0x1f4,_0x24b9('0x34')+_0x21d932));}var _0x46a268={};_0x46a268[_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x32')]]=_0x3b40c7['body'][_0x24b9('0x2f')];return db[_0x24b9('0x35')][_0x24b9('0x24')]({'where':{'id':_0x3b40c7[_0x24b9('0x36')]['id']},'include':[{'model':db[_0x24b9('0x37')],'as':'List','include':[{'model':db[_0x24b9('0x2a')],'as':_0x24b9('0x38'),'where':_0x46a268,'limit':0x1,'order':[[_0x24b9('0x2d'),_0x24b9('0x39')]]}]},{'model':db[_0x24b9('0x3a')],'as':'Applications'},{'model':db[_0x24b9('0x3b')],'as':_0x24b9('0x3c')}]})[_0x24b9('0x10')](function(_0x24334b){if(_0x24334b&&_0x24334b[_0x24b9('0x3d')]){var _0x2c5734=_0x24334b[_0x24b9('0x3e')]({'plain':!![]});_0x149a9e[_0x24b9('0x36')]=_['omit'](_0x2c5734,[_0x24b9('0x3f'),_0x24b9('0x3d')]);_0x149a9e[_0x24b9('0x40')]=_0x2c5734[_0x24b9('0x3f')];_0x149a9e[_0x24b9('0x41')]=_0x2c5734['List'];_0x149a9e[_0x24b9('0x40')]=_['orderBy'](_0x149a9e[_0x24b9('0x40')],[_0x24b9('0x42')],[_0x24b9('0x43')]);if(_0x149a9e[_0x24b9('0x36')]&&_0x149a9e[_0x24b9('0x36')][_0x24b9('0x44')]){_0x149a9e['applications'][_0x24b9('0x45')]({'id':0x0,'priority':_0x149a9e[_0x24b9('0x40')][_0x24b9('0x46')]+0x1,'app':'close','appdata':_0x24b9('0x44'),'interval':_0x24b9('0x47')});}if(_0x149a9e[_0x24b9('0x36')][_0x24b9('0x3f')]){delete _0x149a9e[_0x24b9('0x36')][_0x24b9('0x3f')];}if(_0x149a9e[_0x24b9('0x36')][_0x24b9('0x3d')]){delete _0x149a9e['account']['List'];}if(_0x2c5734[_0x24b9('0x3d')][_0x24b9('0x38')]['length']){return _0x2c5734[_0x24b9('0x3d')][_0x24b9('0x38')][0x0];}var _0x3583b5=_['defaults'](_0x3b40c7[_0x24b9('0x26')],{'firstName':_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x2f')],'ListId':_0x2c5734[_0x24b9('0x48')]});_0x3583b5[_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x32')]]=_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x2f')];return db['CmContact'][_0x24b9('0x49')](_0x3583b5);}else{throw new Error(_0x24b9('0x4a'));}})['then'](function(_0x201f76){_0x149a9e['contact']=_0x201f76;if(_0x201f76){if(!_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x17')]['messageId']){_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x17')][_0x24b9('0x4b')]=rs[_0x24b9('0x4c')]()+'\x20'+_0x3b40c7['body'][_0x24b9('0x17')][_0x24b9('0x2f')];}var _0xeb6677={'ContactId':_0x201f76['id'],'MailAccountId':_0x3b40c7[_0x24b9('0x36')]['id'],'inReplyTo':_0x3b40c7[_0x24b9('0x26')]['message'][_0x24b9('0x4b')],'to':_0x3b40c7[_0x24b9('0x26')]['message']['from'],'cc':_0x3b40c7['body'][_0x24b9('0x17')]['cc'],'subject':_0x3b40c7['body'][_0x24b9('0x17')]['subject'],'attach':_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x17')][_0x24b9('0x4d')],'lastMsgAt':moment()[_0x24b9('0x4e')](_0x24b9('0x4f')),'lastMsgDirection':'in'};return db[_0x24b9('0x50')][_0x24b9('0x24')]({'where':{'closed':![],'MailAccountId':_0x3b40c7[_0x24b9('0x36')]['id']},'include':[{'model':db[_0x24b9('0x51')],'as':_0x24b9('0x52'),'attributes':['messageId'],'where':{'messageId':_0x3b40c7[_0x24b9('0x26')]['message'][_0x24b9('0x53')]}}]})[_0x24b9('0x10')](function(_0x49cf26){if(_0x49cf26){return[_0x49cf26,![]];}return db['MailInteraction'][_0x24b9('0x49')](_0xeb6677)[_0x24b9('0x10')](function(_0x4289ed){return[_0x4289ed,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x24b9('0x54')](function(_0x2fe89d,_0x54e496){if(_0x2fe89d){_0x2759c7=_0x54e496;if(!_0x54e496){return _0x2fe89d['update']({'inReplyTo':_0x3b40c7[_0x24b9('0x26')]['message']['messageId'],'to':_0x3b40c7['body'][_0x24b9('0x17')][_0x24b9('0x2f')],'cc':_0x3b40c7['body'][_0x24b9('0x17')]['cc'],'subject':_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x17')][_0x24b9('0x55')],'attach':_0x2fe89d[_0x24b9('0x4d')]?_0x2fe89d[_0x24b9('0x4d')]:_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x17')]['attach'],'substatus':null,'substatusAt':moment()[_0x24b9('0x4e')](_0x24b9('0x4f')),'lastMsgAt':moment()[_0x24b9('0x4e')](_0x24b9('0x4f')),'lastMsgDirection':'in'});}else{return _0x2fe89d;}}})['then'](function(_0x3491c9){_0x149a9e['interaction']=_0x3491c9['get']({'plain':!![]});_0x149a9e['interaction'][_0x24b9('0x56')]=_0x2759c7;return db[_0x24b9('0x51')][_0x24b9('0x49')]({'body':_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x26')],'MailAccountId':_0x3b40c7[_0x24b9('0x36')]['id'],'MailInteractionId':_0x3491c9['id'],'direction':'in','ContactId':_0x149a9e[_0x24b9('0x57')]['id'],'messageId':_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x17')][_0x24b9('0x4b')],'from':_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x17')][_0x24b9('0x2f')],'to':_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x17')]['to'],'cc':_0x3b40c7['body'][_0x24b9('0x17')]['cc'],'subject':_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x17')]['subject'],'attach':_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x17')][_0x24b9('0x4d')],'Attachments':_0x3b40c7[_0x24b9('0x26')]['message'][_0x24b9('0x58')],'originTo':_0x3b40c7['body'][_0x24b9('0x17')][_0x24b9('0x59')],'originCc':_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x17')]['originCc'],'bcc':_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x17')]['bcc'],'ChatWebsiteId':_0x3b40c7['body']['message'][_0x24b9('0x5a')]||null,'originChannel':_0x3b40c7[_0x24b9('0x26')]['message'][_0x24b9('0x5b')]||'Email','ChatOfflineMessageId':_0x3b40c7[_0x24b9('0x26')][_0x24b9('0x17')][_0x24b9('0x5c')]||null},{'include':[{'model':db[_0x24b9('0x5d')],'as':_0x24b9('0x5e')}]});})['then'](function(_0x3265bf){_0x149a9e['message']=_0x3265bf;if(_0x149a9e[_0x24b9('0x5f')][_0x24b9('0x60')]){return db[_0x24b9('0x61')][_0x24b9('0x24')]({'attributes':['id',_0x24b9('0x62')],'where':{'id':_0x149a9e['interaction'][_0x24b9('0x60')]}})[_0x24b9('0x10')](function(_0x581729){if(_0x581729){_0x149a9e['applications'][_0x24b9('0x63')]({'id':0x0,'priority':0x0,'app':_0x24b9('0x64'),'appdata':_0x581729[_0x24b9('0x62')]+','+(_0x149a9e[_0x24b9('0x36')][_0x24b9('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x24b9('0x66'),_0x24b9('0x67'),_0x149a9e);});}return respondWithRpcPromise(_0x24b9('0x66'),_0x24b9('0x67'),_0x149a9e);})['then'](function(_0x1f7398){_0x3ff034(_0x1f7398);})[_0x24b9('0x22')](function(_0x308794){_0x10f9d7(_0x46caf8[_0x24b9('0x15')](0x1f4,_0x308794[_0x24b9('0x17')]));});});}; \ No newline at end of file +var _0x13c9=['result','GetMailAccount','MailAccount','findAll','options','attributes','limit','include','map','model','find','raw','where','ShowMailAccount','catch','NotifyMailAccount','body','mail','difference','CmContact','rawAttributes','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','orderBy','priority','asc','account','autoclose','push','length','*,*,*,*','Contacts','create','List\x20not\x20found','contact','messageId','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','update','subject','attach','interaction','created','attachments','originCc','bcc','Attachment','Attachments','User','name','UserId','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0x13c9,0x1ea));var _0x913c=function(_0x351a0b,_0x49f41b){_0x351a0b=_0x351a0b-0x0;var _0x40cbce=_0x13c9[_0x351a0b];return _0x40cbce;};'use strict';var _=require(_0x913c('0x0'));var util=require(_0x913c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x913c('0x2'));var db=require(_0x913c('0x3'))['db'];var utils=require(_0x913c('0x4'));var logger=require(_0x913c('0x5'))('rpc');var config=require(_0x913c('0x6'));var jayson=require(_0x913c('0x7'));var client=jayson['client']['http']({'port':0x232c});config[_0x913c('0x8')]=_[_0x913c('0x9')](config[_0x913c('0x8')],{'host':_0x913c('0xa'),'port':0x18eb});var socket=require(_0x913c('0xb'))(new Redis(config[_0x913c('0x8')]));require(_0x913c('0xc'))[_0x913c('0xd')](socket);function respondWithRpcPromise(_0x3ea9b9,_0x51a810,_0x5d6270){return new BPromise(function(_0x408463,_0xfb2bc1){return client[_0x913c('0xe')](_0x3ea9b9,_0x5d6270)[_0x913c('0xf')](function(_0x5ab6c1){logger[_0x913c('0x10')](_0x913c('0x11'),_0x51a810,'request\x20sent');logger[_0x913c('0x12')](_0x913c('0x13'),_0x51a810,_0x913c('0x14'),JSON[_0x913c('0x15')](_0x5ab6c1));if(_0x5ab6c1[_0x913c('0x16')]){if(_0x5ab6c1[_0x913c('0x16')][_0x913c('0x17')]===0x1f4){logger[_0x913c('0x16')](_0x913c('0x11'),_0x51a810,_0x5ab6c1[_0x913c('0x16')][_0x913c('0x18')]);return _0xfb2bc1(_0x5ab6c1['error'][_0x913c('0x18')]);}logger[_0x913c('0x16')](_0x913c('0x11'),_0x51a810,_0x5ab6c1['error'][_0x913c('0x18')]);return _0x408463(_0x5ab6c1[_0x913c('0x16')]['message']);}else{logger['info'](_0x913c('0x11'),_0x51a810,'request\x20sent');_0x408463(_0x5ab6c1[_0x913c('0x19')]['message']);}})['catch'](function(_0x513ffe){logger['error'](_0x913c('0x11'),_0x51a810,_0x513ffe);_0xfb2bc1(_0x513ffe);});});}exports[_0x913c('0x1a')]=function(_0x3c7a88){var _0x3986a3=this;return new Promise(function(_0x54db64,_0xaa6520){return db[_0x913c('0x1b')][_0x913c('0x1c')]({'raw':_0x3c7a88[_0x913c('0x1d')]?_0x3c7a88[_0x913c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3c7a88[_0x913c('0x1d')]?_0x3c7a88[_0x913c('0x1d')]['where']||null:null,'attributes':_0x3c7a88[_0x913c('0x1d')]?_0x3c7a88[_0x913c('0x1d')][_0x913c('0x1e')]||null:null,'limit':_0x3c7a88[_0x913c('0x1d')]?_0x3c7a88['options'][_0x913c('0x1f')]||null:null,'include':_0x3c7a88['options']?_0x3c7a88[_0x913c('0x1d')][_0x913c('0x20')]?_[_0x913c('0x21')](_0x3c7a88[_0x913c('0x1d')][_0x913c('0x20')],function(_0x57d546){return{'model':db[_0x57d546[_0x913c('0x22')]],'as':_0x57d546['as'],'attributes':_0x57d546[_0x913c('0x1e')],'include':_0x57d546[_0x913c('0x20')]?_[_0x913c('0x21')](_0x57d546[_0x913c('0x20')],function(_0x2216d6){return{'model':db[_0x2216d6['model']],'as':_0x2216d6['as'],'attributes':_0x2216d6[_0x913c('0x1e')],'include':_0x2216d6[_0x913c('0x20')]?_[_0x913c('0x21')](_0x2216d6[_0x913c('0x20')],function(_0x342f43){return{'model':db[_0x342f43[_0x913c('0x22')]],'as':_0x342f43['as'],'attributes':_0x342f43[_0x913c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x913c('0xf')](function(_0x3a51df){logger[_0x913c('0x10')](_0x913c('0x1a'),_0x3c7a88);logger['debug'](_0x913c('0x1a'),_0x3c7a88,JSON[_0x913c('0x15')](_0x3a51df));_0x54db64(_0x3a51df);})['catch'](function(_0x441a35){logger['error']('GetMailAccount',_0x441a35[_0x913c('0x18')],_0x3c7a88);_0xaa6520(_0x3986a3[_0x913c('0x16')](0x1f4,_0x441a35['message']));});});};exports['ShowMailAccount']=function(_0x308b5c){var _0x517934=this;return new Promise(function(_0x1466c1,_0x37b859){return db[_0x913c('0x1b')][_0x913c('0x23')]({'raw':_0x308b5c['options']?_0x308b5c[_0x913c('0x1d')][_0x913c('0x24')]===undefined?!![]:![]:!![],'where':_0x308b5c['options']?_0x308b5c['options'][_0x913c('0x25')]||null:null,'attributes':_0x308b5c[_0x913c('0x1d')]?_0x308b5c[_0x913c('0x1d')]['attributes']||null:null,'include':_0x308b5c[_0x913c('0x1d')]?_0x308b5c[_0x913c('0x1d')][_0x913c('0x20')]?_[_0x913c('0x21')](_0x308b5c[_0x913c('0x1d')][_0x913c('0x20')],function(_0x82c0d4){return{'model':db[_0x82c0d4[_0x913c('0x22')]],'as':_0x82c0d4['as'],'attributes':_0x82c0d4[_0x913c('0x1e')],'include':_0x82c0d4[_0x913c('0x20')]?_['map'](_0x82c0d4[_0x913c('0x20')],function(_0x4cd1db){return{'model':db[_0x4cd1db[_0x913c('0x22')]],'as':_0x4cd1db['as'],'attributes':_0x4cd1db[_0x913c('0x1e')],'include':_0x4cd1db[_0x913c('0x20')]?_[_0x913c('0x21')](_0x4cd1db[_0x913c('0x20')],function(_0x446320){return{'model':db[_0x446320[_0x913c('0x22')]],'as':_0x446320['as'],'attributes':_0x446320[_0x913c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x913c('0xf')](function(_0x4d4d40){logger[_0x913c('0x10')](_0x913c('0x26'),_0x308b5c);logger[_0x913c('0x12')](_0x913c('0x26'),_0x308b5c,JSON[_0x913c('0x15')](_0x4d4d40));_0x1466c1(_0x4d4d40);})[_0x913c('0x27')](function(_0x171d89){logger['error'](_0x913c('0x26'),_0x171d89[_0x913c('0x18')],_0x308b5c);_0x37b859(_0x517934[_0x913c('0x16')](0x1f4,_0x171d89[_0x913c('0x18')]));});});};exports[_0x913c('0x28')]=function(_0x32533e){var _0x237a28=this;return new Promise(function(_0xa21e71,_0x57b7af){var _0x539c88={'body':_0x32533e[_0x913c('0x29')],'channel':_0x913c('0x2a')};var _0x599efe=_[_0x913c('0x2b')](_['keys'](db[_0x913c('0x2c')][_0x913c('0x2d')]),[_0x913c('0x2e'),'updatedAt',_0x913c('0x2f'),_0x913c('0x30')]);var _0x5477f1=![];if(_0x32533e[_0x913c('0x29')]['id']){delete _0x32533e[_0x913c('0x29')]['id'];}if(_[_0x913c('0x31')](_0x32533e[_0x913c('0x29')][_0x913c('0x32')])){return _0x57b7af(_0x237a28[_0x913c('0x16')](0x1f4,_0x913c('0x33')));}if(_[_0x913c('0x31')](_0x32533e['body'][_0x913c('0x29')])||_0x32533e[_0x913c('0x29')][_0x913c('0x29')]===''){return _0x57b7af(_0x237a28['error'](0x1f4,_0x913c('0x34')));}if(_[_0x913c('0x31')](_0x32533e[_0x913c('0x29')][_0x913c('0x35')])){return _0x57b7af(_0x237a28[_0x913c('0x16')](0x1f4,_0x913c('0x36')+_0x599efe));}if(!_[_0x913c('0x37')](_0x599efe,_0x32533e[_0x913c('0x29')]['mapKey'])){return _0x57b7af(_0x237a28[_0x913c('0x16')](0x1f4,_0x913c('0x38')+_0x599efe));}var _0x3cea45={};_0x3cea45[_0x32533e[_0x913c('0x29')][_0x913c('0x35')]]=_0x32533e[_0x913c('0x29')][_0x913c('0x32')];return db[_0x913c('0x1b')]['find']({'where':{'id':_0x32533e['account']['id']},'include':[{'model':db[_0x913c('0x39')],'as':_0x913c('0x3a'),'include':[{'model':db[_0x913c('0x2c')],'as':'Contacts','where':_0x3cea45,'limit':0x1,'order':[['updatedAt',_0x913c('0x3b')]]}]},{'model':db[_0x913c('0x3c')],'as':_0x913c('0x3d')},{'model':db[_0x913c('0x3e')],'as':_0x913c('0x3f')}]})[_0x913c('0xf')](function(_0x2b8b4f){if(_0x2b8b4f&&_0x2b8b4f['List']){var _0x37889e=_0x2b8b4f[_0x913c('0x40')]({'plain':!![]});_0x539c88['account']=_[_0x913c('0x41')](_0x37889e,[_0x913c('0x3d'),'List']);_0x539c88[_0x913c('0x42')]=_0x37889e[_0x913c('0x3d')];_0x539c88['list']=_0x37889e[_0x913c('0x3a')];_0x539c88[_0x913c('0x42')]=_[_0x913c('0x43')](_0x539c88['applications'],[_0x913c('0x44')],[_0x913c('0x45')]);if(_0x539c88[_0x913c('0x46')]&&_0x539c88[_0x913c('0x46')][_0x913c('0x47')]){_0x539c88[_0x913c('0x42')][_0x913c('0x48')]({'id':0x0,'priority':_0x539c88['applications'][_0x913c('0x49')]+0x1,'app':'close','appdata':_0x913c('0x47'),'interval':_0x913c('0x4a')});}if(_0x539c88[_0x913c('0x46')]['Applications']){delete _0x539c88['account'][_0x913c('0x3d')];}if(_0x539c88[_0x913c('0x46')][_0x913c('0x3a')]){delete _0x539c88['account']['List'];}if(_0x37889e[_0x913c('0x3a')][_0x913c('0x4b')][_0x913c('0x49')]){return _0x37889e[_0x913c('0x3a')][_0x913c('0x4b')][0x0];}var _0x5235b0=_[_0x913c('0x9')](_0x32533e[_0x913c('0x29')],{'firstName':_0x32533e['body']['from'],'ListId':_0x37889e[_0x913c('0x30')]});_0x5235b0[_0x32533e[_0x913c('0x29')][_0x913c('0x35')]]=_0x32533e['body'][_0x913c('0x32')];return db[_0x913c('0x2c')][_0x913c('0x4c')](_0x5235b0);}else{throw new Error(_0x913c('0x4d'));}})[_0x913c('0xf')](function(_0x2598d7){_0x539c88[_0x913c('0x4e')]=_0x2598d7;if(_0x2598d7){if(!_0x32533e[_0x913c('0x29')][_0x913c('0x18')][_0x913c('0x4f')]){_0x32533e[_0x913c('0x29')][_0x913c('0x18')][_0x913c('0x4f')]=rs['generate']()+'\x20'+_0x32533e['body'][_0x913c('0x18')]['from'];}var _0x2b580f={'ContactId':_0x2598d7['id'],'MailAccountId':_0x32533e['account']['id'],'inReplyTo':_0x32533e['body'][_0x913c('0x18')]['messageId'],'to':_0x32533e[_0x913c('0x29')][_0x913c('0x18')][_0x913c('0x32')],'cc':_0x32533e['body']['message']['cc'],'subject':_0x32533e[_0x913c('0x29')][_0x913c('0x18')]['subject'],'attach':_0x32533e[_0x913c('0x29')][_0x913c('0x18')]['attach'],'lastMsgAt':moment()[_0x913c('0x50')](_0x913c('0x51')),'lastMsgDirection':'in'};return db[_0x913c('0x52')][_0x913c('0x23')]({'where':{'closed':![],'MailAccountId':_0x32533e[_0x913c('0x46')]['id']},'include':[{'model':db[_0x913c('0x53')],'as':_0x913c('0x54'),'attributes':[_0x913c('0x4f')],'where':{'messageId':_0x32533e[_0x913c('0x29')][_0x913c('0x18')]['inReplyTo']}}]})[_0x913c('0xf')](function(_0x588cc5){if(_0x588cc5){return[_0x588cc5,![]];}return db[_0x913c('0x52')][_0x913c('0x4c')](_0x2b580f)[_0x913c('0xf')](function(_0xd795a6){return[_0xd795a6,!![]];});});}else{throw new Error(_0x913c('0x55'));}})['spread'](function(_0xcb02,_0x54d67c){if(_0xcb02){_0x5477f1=_0x54d67c;if(!_0x54d67c){return _0xcb02[_0x913c('0x56')]({'inReplyTo':_0x32533e[_0x913c('0x29')]['message']['messageId'],'to':_0x32533e[_0x913c('0x29')]['message'][_0x913c('0x32')],'cc':_0x32533e[_0x913c('0x29')]['message']['cc'],'subject':_0x32533e[_0x913c('0x29')]['message'][_0x913c('0x57')],'attach':_0xcb02[_0x913c('0x58')]?_0xcb02[_0x913c('0x58')]:_0x32533e['body'][_0x913c('0x18')][_0x913c('0x58')],'substatus':null,'substatusAt':moment()['format'](_0x913c('0x51')),'lastMsgAt':moment()[_0x913c('0x50')](_0x913c('0x51')),'lastMsgDirection':'in'});}else{return _0xcb02;}}})[_0x913c('0xf')](function(_0x4753c2){_0x539c88[_0x913c('0x59')]=_0x4753c2[_0x913c('0x40')]({'plain':!![]});_0x539c88[_0x913c('0x59')][_0x913c('0x5a')]=_0x5477f1;return db[_0x913c('0x53')]['create']({'body':_0x32533e[_0x913c('0x29')][_0x913c('0x29')],'MailAccountId':_0x32533e['account']['id'],'MailInteractionId':_0x4753c2['id'],'direction':'in','ContactId':_0x539c88[_0x913c('0x4e')]['id'],'messageId':_0x32533e[_0x913c('0x29')][_0x913c('0x18')][_0x913c('0x4f')],'from':_0x32533e['body'][_0x913c('0x18')][_0x913c('0x32')],'to':_0x32533e['body'][_0x913c('0x18')]['to'],'cc':_0x32533e[_0x913c('0x29')][_0x913c('0x18')]['cc'],'subject':_0x32533e[_0x913c('0x29')][_0x913c('0x18')][_0x913c('0x57')],'attach':_0x32533e[_0x913c('0x29')][_0x913c('0x18')]['attach'],'Attachments':_0x32533e['body'][_0x913c('0x18')][_0x913c('0x5b')],'originTo':_0x32533e[_0x913c('0x29')][_0x913c('0x18')]['originTo'],'originCc':_0x32533e[_0x913c('0x29')][_0x913c('0x18')][_0x913c('0x5c')],'bcc':_0x32533e[_0x913c('0x29')][_0x913c('0x18')][_0x913c('0x5d')],'ChatWebsiteId':_0x32533e[_0x913c('0x29')][_0x913c('0x18')]['ChatWebsiteId']||null,'originChannel':_0x32533e['body'][_0x913c('0x18')]['originChannel']||'Email','ChatOfflineMessageId':_0x32533e[_0x913c('0x29')][_0x913c('0x18')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x913c('0x5e')],'as':_0x913c('0x5f')}]});})['then'](function(_0x1fd273){_0x539c88[_0x913c('0x18')]=_0x1fd273;if(_0x539c88['interaction']['UserId']){return db[_0x913c('0x60')][_0x913c('0x23')]({'attributes':['id',_0x913c('0x61')],'where':{'id':_0x539c88['interaction'][_0x913c('0x62')]}})['then'](function(_0x41f8db){if(_0x41f8db){_0x539c88[_0x913c('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':_0x913c('0x63'),'appdata':_0x41f8db[_0x913c('0x61')]+','+(_0x539c88[_0x913c('0x46')][_0x913c('0x64')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x913c('0x65'),_0x913c('0x66'),_0x539c88);});}return respondWithRpcPromise('Start','startRouting',_0x539c88);})['then'](function(_0x8cceb1){_0xa21e71(_0x8cceb1);})[_0x913c('0x27')](function(_0x3994db){_0x57b7af(_0x237a28[_0x913c('0x16')](0x1f4,_0x3994db[_0x913c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 9a1ef01..20b989e 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 _0xa164=['save','remove','update','removeListener','register','length'];(function(_0x5d8f8a,_0x5543b7){var _0x189713=function(_0x11c4d5){while(--_0x11c4d5){_0x5d8f8a['push'](_0x5d8f8a['shift']());}};_0x189713(++_0x5543b7);}(_0xa164,0x19e));var _0x4a16=function(_0x471c7e,_0x3b98a9){_0x471c7e=_0x471c7e-0x0;var _0x2ff35b=_0xa164[_0x471c7e];return _0x2ff35b;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x4a16('0x0'),_0x4a16('0x1'),_0x4a16('0x2')];function createListener(_0x7ec4c8,_0x242a37){return function(_0x58757a){_0x242a37['emit'](_0x7ec4c8,_0x58757a);};}function removeListener(_0x133771,_0x9045af){return function(){MailAccountEvents[_0x4a16('0x3')](_0x133771,_0x9045af);};}exports[_0x4a16('0x4')]=function(_0x207d5b){for(var _0x1cc4f1=0x0,_0x55a3e0=events[_0x4a16('0x5')];_0x1cc4f1<_0x55a3e0;_0x1cc4f1++){var _0x35681f=events[_0x1cc4f1];var _0x158f4e=createListener('mailAccount:'+_0x35681f,_0x207d5b);MailAccountEvents['on'](_0x35681f,_0x158f4e);}}; \ No newline at end of file +var _0x2fcb=['length','mailAccount:','remove','removeListener','register'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2fcb,0x98));var _0xb2fc=function(_0x32e547,_0x537da5){_0x32e547=_0x32e547-0x0;var _0x540f61=_0x2fcb[_0x32e547];return _0x540f61;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0xb2fc('0x0'),'update'];function createListener(_0x595a58,_0x2f8dab){return function(_0x3d775f){_0x2f8dab['emit'](_0x595a58,_0x3d775f);};}function removeListener(_0x4086da,_0x537208){return function(){MailAccountEvents[_0xb2fc('0x1')](_0x4086da,_0x537208);};}exports[_0xb2fc('0x2')]=function(_0x475c56){for(var _0x26db8a=0x0,_0x36e952=events[_0xb2fc('0x3')];_0x26db8a<_0x36e952;_0x26db8a++){var _0x11aeb6=events[_0x26db8a];var _0x20280f=createListener(_0xb2fc('0x4')+_0x11aeb6,_0x475c56);MailAccountEvents['on'](_0x11aeb6,_0x20280f);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index cecf9ce..bd050a6 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 _0x63d2=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','show','isAuthenticated'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0x63d2,0xc3));var _0x263d=function(_0x1b7ae2,_0x3f9275){_0x1b7ae2=_0x1b7ae2-0x0;var _0x1f483d=_0x63d2[_0x1b7ae2];return _0x1f483d;};'use strict';var multer=require(_0x263d('0x0'));var util=require(_0x263d('0x1'));var path=require(_0x263d('0x2'));var timeout=require(_0x263d('0x3'));var express=require('express');var router=express[_0x263d('0x4')]();var fs_extra=require(_0x263d('0x5'));var auth=require(_0x263d('0x6'));var interaction=require(_0x263d('0x7'));var config=require(_0x263d('0x8'));var controller=require(_0x263d('0x9'));router['get'](_0x263d('0xa'),auth['isAuthenticated'](),controller[_0x263d('0xb')]);router['put']('/:id',auth[_0x263d('0xc')](),controller['update']);router[_0x263d('0xd')](_0x263d('0xa'),auth[_0x263d('0xc')](),controller[_0x263d('0xe')]);module[_0x263d('0xf')]=router; \ No newline at end of file +var _0xa311=['./mailApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3f4450,_0xfaf1a8){var _0x492655=function(_0x355887){while(--_0x355887){_0x3f4450['push'](_0x3f4450['shift']());}};_0x492655(++_0xfaf1a8);}(_0xa311,0xe9));var _0x1a31=function(_0x56b138,_0x2396d6){_0x56b138=_0x56b138-0x0;var _0x3df878=_0xa311[_0x56b138];return _0x3df878;};'use strict';var multer=require(_0x1a31('0x0'));var util=require(_0x1a31('0x1'));var path=require('path');var timeout=require(_0x1a31('0x2'));var express=require(_0x1a31('0x3'));var router=express['Router']();var fs_extra=require(_0x1a31('0x4'));var auth=require(_0x1a31('0x5'));var interaction=require(_0x1a31('0x6'));var config=require('../../config/environment');var controller=require(_0x1a31('0x7'));router[_0x1a31('0x8')](_0x1a31('0x9'),auth[_0x1a31('0xa')](),controller[_0x1a31('0xb')]);router[_0x1a31('0xc')](_0x1a31('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x1a31('0xd')](_0x1a31('0x9'),auth['isAuthenticated'](),controller[_0x1a31('0xe')]);module[_0x1a31('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index e2037db..a6aee92 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 _0xfb94=['noop','TEXT','STRING'];(function(_0x5a4672,_0x57c214){var _0x49bef6=function(_0x295032){while(--_0x295032){_0x5a4672['push'](_0x5a4672['shift']());}};_0x49bef6(++_0x57c214);}(_0xfb94,0x7a));var _0x4fb9=function(_0x550c43,_0x599118){_0x550c43=_0x550c43-0x0;var _0x32caf6=_0xfb94[_0x550c43];return _0x32caf6;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x4fb9('0x0')],'allowNull':![],'defaultValue':_0x4fb9('0x1')},'appdata':{'type':Sequelize[_0x4fb9('0x2')]()},'description':{'type':Sequelize[_0x4fb9('0x0')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2a46=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x961467,_0x339b3b){var _0x5f1efb=function(_0x384fad){while(--_0x384fad){_0x961467['push'](_0x961467['shift']());}};_0x5f1efb(++_0x339b3b);}(_0x2a46,0x1a4));var _0x62a4=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0x2a46[_0x1793de];return _0x4f0309;};'use strict';var Sequelize=require('sequelize');module[_0x62a4('0x0')]={'priority':{'type':Sequelize[_0x62a4('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x62a4('0x2')},'appdata':{'type':Sequelize[_0x62a4('0x3')]()},'description':{'type':Sequelize[_0x62a4('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x62a4('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index fe6cabf..41ea1bf 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 _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x1505e5,_0x5cc291){_0x1505e5=_0x1505e5-0x0;var _0x5b1dcd=_0xaa88[_0x1505e5];return _0x5b1dcd;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,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(_0x406cf7,_0xe378a5){var _0x325d00=function(_0x80872f){while(--_0x80872f){_0x406cf7['push'](_0x406cf7['shift']());}};_0x325d00(++_0xe378a5);}(_0x54ef,0x112));var _0xf54e=function(_0x2d4908,_0x302b6c){_0x2d4908=_0x2d4908-0x0;var _0x2ba39e=_0x54ef[_0x2d4908];return _0x2ba39e;};'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 2c26aa6..1a962d0 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 _0xcdbe=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications'];(function(_0x4be78f,_0x403e3e){var _0x579a45=function(_0x918f46){while(--_0x918f46){_0x4be78f['push'](_0x4be78f['shift']());}};_0x579a45(++_0x403e3e);}(_0xcdbe,0x1c2));var _0xecdb=function(_0x18f6ee,_0x241f93){_0x18f6ee=_0x18f6ee-0x0;var _0x42ac3f=_0xcdbe[_0x18f6ee];return _0x42ac3f;};'use strict';var _=require(_0xecdb('0x0'));var util=require('util');var logger=require(_0xecdb('0x1'))('api');var moment=require(_0xecdb('0x2'));var BPromise=require(_0xecdb('0x3'));var rp=require(_0xecdb('0x4'));var fs=require('fs');var path=require(_0xecdb('0x5'));var rimraf=require(_0xecdb('0x6'));var config=require(_0xecdb('0x7'));var attributes=require(_0xecdb('0x8'));module['exports']=function(_0x36e595,_0x29beec){return _0x36e595[_0xecdb('0x9')](_0xecdb('0xa'),attributes,{'tableName':_0xecdb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xecdb('0xc'),'collate':_0xecdb('0xd')});}; \ No newline at end of file +var _0xabc2=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4'];(function(_0x2c029e,_0x285998){var _0x582973=function(_0x443fe2){while(--_0x443fe2){_0x2c029e['push'](_0x2c029e['shift']());}};_0x582973(++_0x285998);}(_0xabc2,0x6a));var _0x2abc=function(_0x354b62,_0x4d0e89){_0x354b62=_0x354b62-0x0;var _0x5448bd=_0xabc2[_0x354b62];return _0x5448bd;};'use strict';var _=require(_0x2abc('0x0'));var util=require(_0x2abc('0x1'));var logger=require(_0x2abc('0x2'))('api');var moment=require(_0x2abc('0x3'));var BPromise=require(_0x2abc('0x4'));var rp=require(_0x2abc('0x5'));var fs=require('fs');var path=require(_0x2abc('0x6'));var rimraf=require(_0x2abc('0x7'));var config=require(_0x2abc('0x8'));var attributes=require(_0x2abc('0x9'));module['exports']=function(_0x540cd8,_0x483f42){return _0x540cd8[_0x2abc('0xa')](_0x2abc('0xb'),attributes,{'tableName':_0x2abc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2abc('0xd'),'collate':_0x2abc('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index e931d22..c04b3c1 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 _0x6461=['lodash','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateMailApplication','MailApplication','body','options','raw','where','stringify'];(function(_0x34c0c7,_0x446d48){var _0x42cff3=function(_0x250cc9){while(--_0x250cc9){_0x34c0c7['push'](_0x34c0c7['shift']());}};_0x42cff3(++_0x446d48);}(_0x6461,0x190));var _0x1646=function(_0x106f5e,_0x24c17d){_0x106f5e=_0x106f5e-0x0;var _0x3f3f32=_0x6461[_0x106f5e];return _0x3f3f32;};'use strict';var _=require(_0x1646('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1646('0x1'));var fs=require('fs');var Redis=require(_0x1646('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1646('0x3'))(_0x1646('0x4'));var config=require(_0x1646('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1646('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x34e911,_0x4692ce,_0xdeddba){return new BPromise(function(_0x58e156,_0x4b1015){return client[_0x1646('0x7')](_0x34e911,_0xdeddba)[_0x1646('0x8')](function(_0x545310){logger[_0x1646('0x9')](_0x1646('0xa'),_0x4692ce,_0x1646('0xb'));logger[_0x1646('0xc')](_0x1646('0xd'),_0x4692ce,_0x1646('0xb'),JSON['stringify'](_0x545310));if(_0x545310[_0x1646('0xe')]){if(_0x545310[_0x1646('0xe')][_0x1646('0xf')]===0x1f4){logger['error'](_0x1646('0xa'),_0x4692ce,_0x545310[_0x1646('0xe')]['message']);return _0x4b1015(_0x545310[_0x1646('0xe')][_0x1646('0x10')]);}logger[_0x1646('0xe')](_0x1646('0xa'),_0x4692ce,_0x545310[_0x1646('0xe')][_0x1646('0x10')]);return _0x58e156(_0x545310['error'][_0x1646('0x10')]);}else{logger[_0x1646('0x9')](_0x1646('0xa'),_0x4692ce,_0x1646('0xb'));_0x58e156(_0x545310[_0x1646('0x11')][_0x1646('0x10')]);}})['catch'](function(_0x2fee76){logger[_0x1646('0xe')]('MailApplication,\x20%s,\x20%s',_0x4692ce,_0x2fee76);_0x4b1015(_0x2fee76);});});}exports[_0x1646('0x12')]=function(_0x4eadfc){var _0x25cd2a=this;return new Promise(function(_0x3dcc69,_0x4fe0c5){return db[_0x1646('0x13')]['update'](_0x4eadfc[_0x1646('0x14')],{'raw':_0x4eadfc[_0x1646('0x15')]?_0x4eadfc[_0x1646('0x15')][_0x1646('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4eadfc['options']?_0x4eadfc[_0x1646('0x15')][_0x1646('0x17')]||null:null,'attributes':_0x4eadfc['options']?_0x4eadfc['options']['attributes']||null:null,'limit':_0x4eadfc[_0x1646('0x15')]?_0x4eadfc[_0x1646('0x15')]['limit']||null:null})[_0x1646('0x8')](function(_0x39955b){logger[_0x1646('0x9')](_0x1646('0x12'),_0x4eadfc);logger[_0x1646('0xc')]('UpdateMailApplication',_0x4eadfc,JSON[_0x1646('0x18')](_0x39955b));_0x3dcc69(_0x39955b);})['catch'](function(_0x5ce8da){logger['error'](_0x1646('0x12'),_0x5ce8da['message'],_0x4eadfc);_0x4fe0c5(_0x25cd2a['error'](0x1f4,_0x5ce8da['message']));});});}; \ No newline at end of file +var _0x1fd0=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','request\x20sent','result','UpdateMailApplication','MailApplication','update','body','options','raw','attributes','limit','lodash','util','moment','bluebird','ioredis'];(function(_0x699200,_0x39c101){var _0x266fd1=function(_0x1a9368){while(--_0x1a9368){_0x699200['push'](_0x699200['shift']());}};_0x266fd1(++_0x39c101);}(_0x1fd0,0x1bd));var _0x01fd=function(_0x35bde9,_0x5b257b){_0x35bde9=_0x35bde9-0x0;var _0x3aa900=_0x1fd0[_0x35bde9];return _0x3aa900;};'use strict';var _=require(_0x01fd('0x0'));var util=require(_0x01fd('0x1'));var moment=require(_0x01fd('0x2'));var BPromise=require(_0x01fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01fd('0x4'));var db=require(_0x01fd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x01fd('0x6'))(_0x01fd('0x7'));var config=require('../../config/environment');var jayson=require(_0x01fd('0x8'));var client=jayson[_0x01fd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x188ace,_0x40ec14,_0x4a8927){return new BPromise(function(_0x2555d0,_0x54b990){return client[_0x01fd('0xa')](_0x188ace,_0x4a8927)[_0x01fd('0xb')](function(_0x596a14){logger[_0x01fd('0xc')]('MailApplication,\x20%s,\x20%s',_0x40ec14,'request\x20sent');logger[_0x01fd('0xd')](_0x01fd('0xe'),_0x40ec14,'request\x20sent',JSON[_0x01fd('0xf')](_0x596a14));if(_0x596a14[_0x01fd('0x10')]){if(_0x596a14[_0x01fd('0x10')][_0x01fd('0x11')]===0x1f4){logger[_0x01fd('0x10')](_0x01fd('0x12'),_0x40ec14,_0x596a14[_0x01fd('0x10')]['message']);return _0x54b990(_0x596a14['error'][_0x01fd('0x13')]);}logger[_0x01fd('0x10')](_0x01fd('0x12'),_0x40ec14,_0x596a14[_0x01fd('0x10')]['message']);return _0x2555d0(_0x596a14['error']['message']);}else{logger[_0x01fd('0xc')](_0x01fd('0x12'),_0x40ec14,_0x01fd('0x14'));_0x2555d0(_0x596a14[_0x01fd('0x15')]['message']);}})['catch'](function(_0x1d41c7){logger[_0x01fd('0x10')](_0x01fd('0x12'),_0x40ec14,_0x1d41c7);_0x54b990(_0x1d41c7);});});}exports[_0x01fd('0x16')]=function(_0x14202b){var _0x3756d9=this;return new Promise(function(_0x46546f,_0x25b36f){return db[_0x01fd('0x17')][_0x01fd('0x18')](_0x14202b[_0x01fd('0x19')],{'raw':_0x14202b[_0x01fd('0x1a')]?_0x14202b[_0x01fd('0x1a')][_0x01fd('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14202b[_0x01fd('0x1a')]?_0x14202b['options']['where']||null:null,'attributes':_0x14202b[_0x01fd('0x1a')]?_0x14202b[_0x01fd('0x1a')][_0x01fd('0x1c')]||null:null,'limit':_0x14202b[_0x01fd('0x1a')]?_0x14202b[_0x01fd('0x1a')][_0x01fd('0x1d')]||null:null})['then'](function(_0x52b83b){logger[_0x01fd('0xc')](_0x01fd('0x16'),_0x14202b);logger['debug'](_0x01fd('0x16'),_0x14202b,JSON[_0x01fd('0xf')](_0x52b83b));_0x46546f(_0x52b83b);})['catch'](function(_0x578594){logger[_0x01fd('0x10')]('UpdateMailApplication',_0x578594[_0x01fd('0x13')],_0x14202b);_0x25b36f(_0x3756d9[_0x01fd('0x10')](0x1f4,_0x578594['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index d785ff4..d5f8eae 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 _0x17b1=['/:id/tags','tracked','mail','addTags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','show','getMessages','post','create','/:id/messages','addMessage'];(function(_0x3c2407,_0x3c9a47){var _0x5d2eac=function(_0xb33bf8){while(--_0xb33bf8){_0x3c2407['push'](_0x3c2407['shift']());}};_0x5d2eac(++_0x3c9a47);}(_0x17b1,0x1e0));var _0x117b=function(_0x4abc8f,_0xef597d){_0x4abc8f=_0x4abc8f-0x0;var _0x5d7939=_0x17b1[_0x4abc8f];return _0x5d7939;};'use strict';var express=require(_0x117b('0x0'));var router=express[_0x117b('0x1')]();var auth=require(_0x117b('0x2'));var interaction=require(_0x117b('0x3'));var controller=require('./mailInteraction.controller');router[_0x117b('0x4')]('/',auth['isAuthenticated'](),controller[_0x117b('0x5')]);router[_0x117b('0x4')](_0x117b('0x6'),auth[_0x117b('0x7')](),controller['describe']);router[_0x117b('0x4')]('/:id',auth[_0x117b('0x7')](),controller[_0x117b('0x8')]);router[_0x117b('0x4')]('/:id/messages',auth[_0x117b('0x7')](),controller[_0x117b('0x9')]);router[_0x117b('0x4')]('/:id/download',auth[_0x117b('0x7')](),controller['download']);router[_0x117b('0xa')]('/',auth[_0x117b('0x7')](),controller[_0x117b('0xb')]);router[_0x117b('0xa')](_0x117b('0xc'),auth[_0x117b('0x7')](),controller[_0x117b('0xd')]);router[_0x117b('0xa')](_0x117b('0xe'),auth[_0x117b('0x7')](),interaction[_0x117b('0xf')](_0x117b('0x10'),'mailinteraction:addtags'),controller[_0x117b('0x11')]);router[_0x117b('0x12')](_0x117b('0x13'),auth[_0x117b('0x7')](),interaction[_0x117b('0xf')](_0x117b('0x10'),_0x117b('0x14')),controller[_0x117b('0x15')]);router[_0x117b('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x117b('0xf')]('mail',_0x117b('0x17')),controller[_0x117b('0x18')]);router['delete'](_0x117b('0xe'),auth[_0x117b('0x7')](),controller[_0x117b('0x19')]);module['exports']=router; \ No newline at end of file +var _0x7862=['delete','mailinteraction:destroy','destroy','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','/:id/download','post','create','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update'];(function(_0x268b23,_0x1a9a24){var _0x27b775=function(_0x565507){while(--_0x565507){_0x268b23['push'](_0x268b23['shift']());}};_0x27b775(++_0x1a9a24);}(_0x7862,0x1f2));var _0x2786=function(_0x1cd182,_0x3ff09e){_0x1cd182=_0x1cd182-0x0;var _0x332e7b=_0x7862[_0x1cd182];return _0x332e7b;};'use strict';var express=require(_0x2786('0x0'));var router=express[_0x2786('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x2786('0x2'));var controller=require(_0x2786('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0x2786('0x4')]);router[_0x2786('0x5')](_0x2786('0x6'),auth['isAuthenticated'](),controller[_0x2786('0x7')]);router[_0x2786('0x5')](_0x2786('0x8'),auth[_0x2786('0x9')](),controller[_0x2786('0xa')]);router[_0x2786('0x5')](_0x2786('0xb'),auth[_0x2786('0x9')](),controller['getMessages']);router[_0x2786('0x5')](_0x2786('0xc'),auth[_0x2786('0x9')](),controller['download']);router[_0x2786('0xd')]('/',auth[_0x2786('0x9')](),controller[_0x2786('0xe')]);router[_0x2786('0xd')]('/:id/messages',auth[_0x2786('0x9')](),controller['addMessage']);router[_0x2786('0xd')](_0x2786('0xf'),auth[_0x2786('0x9')](),interaction[_0x2786('0x10')](_0x2786('0x11'),_0x2786('0x12')),controller['addTags']);router[_0x2786('0x13')](_0x2786('0x8'),auth[_0x2786('0x9')](),interaction[_0x2786('0x10')](_0x2786('0x11'),_0x2786('0x14')),controller[_0x2786('0x15')]);router[_0x2786('0x16')](_0x2786('0x8'),auth[_0x2786('0x9')](),interaction['tracked']('mail',_0x2786('0x17')),controller[_0x2786('0x18')]);router[_0x2786('0x16')](_0x2786('0xf'),auth['isAuthenticated'](),controller['removeTags']);module[_0x2786('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 5ed20da..e5e3930 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 _0xed11=['TEXT','long','BOOLEAN','ENUM','out','sequelize','exports','DATE','STRING'];(function(_0x534c8f,_0x500079){var _0x5a57f5=function(_0x38ec0a){while(--_0x38ec0a){_0x534c8f['push'](_0x534c8f['shift']());}};_0x5a57f5(++_0x500079);}(_0xed11,0x1eb));var _0x1ed1=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xed11[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require(_0x1ed1('0x0'));var iconv=require('iconv');module[_0x1ed1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1ed1('0x2')]},'disposition':{'type':Sequelize[_0x1ed1('0x3')]},'secondDisposition':{'type':Sequelize[_0x1ed1('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1ed1('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x1ed1('0x3')](0x1fe)},'to':{'type':Sequelize[_0x1ed1('0x3')]},'cc':{'type':Sequelize[_0x1ed1('0x4')](_0x1ed1('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x1ed1('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x1ed1('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x1ed1('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1ed1('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x1ed1('0x7')]('in',_0x1ed1('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1ed1('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xbbd5=['DATE','STRING','long','TEXT','ENUM','out','sequelize','iconv','BOOLEAN'];(function(_0x32358b,_0x5c7c35){var _0x58c21d=function(_0x238a63){while(--_0x238a63){_0x32358b['push'](_0x32358b['shift']());}};_0x58c21d(++_0x5c7c35);}(_0xbbd5,0x84));var _0x5bbd=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbbd5[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x5bbd('0x0'));var iconv=require(_0x5bbd('0x1'));module['exports']={'closed':{'type':Sequelize[_0x5bbd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5bbd('0x3')]},'disposition':{'type':Sequelize[_0x5bbd('0x4')]},'secondDisposition':{'type':Sequelize[_0x5bbd('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5bbd('0x4')]},'inReplyTo':{'type':Sequelize[_0x5bbd('0x4')](0x1fe)},'to':{'type':Sequelize[_0x5bbd('0x4')]},'cc':{'type':Sequelize['TEXT'](_0x5bbd('0x5'))},'subject':{'type':Sequelize[_0x5bbd('0x6')]()},'attach':{'type':Sequelize[_0x5bbd('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x5bbd('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x5bbd('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x5bbd('0x7')]('in',_0x5bbd('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5bbd('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5bbd('0x7')]('in',_0x5bbd('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5bbd('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index cc403cd..0e9ef2f 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 _0x13c5=['$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','role','toString','sequelize','keyBy','MailInteraction','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','contactName','i.closedAt','i.attach','i.lastMsgAt','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','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','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','params','includeAll','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','true','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','files','tmp','server','Attachment','subject','createdAt','Messages','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','Attachments','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','lodash','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','update','then','destroy','error','name','Users','map','fullname','TagIds','Tags','forEach','push','findOne','out','plainBody','lastMsgText','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','left_join','users','select','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\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','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','end','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','i.MailAccountId\x20IN\x20?','concat','parse'];(function(_0x371b73,_0x6013d2){var _0x1b2797=function(_0x41c982){while(--_0x41c982){_0x371b73['push'](_0x371b73['shift']());}};_0x1b2797(++_0x6013d2);}(_0x13c5,0x7a));var _0x513c=function(_0x54cd4e,_0x204373){_0x54cd4e=_0x54cd4e-0x0;var _0x7aae02=_0x13c5[_0x54cd4e];return _0x7aae02;};'use strict';var emlformat=require(_0x513c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x513c('0x1'));var squel=require('squel');var juice=require('juice');var Redis=require(_0x513c('0x2'));var qs=require(_0x513c('0x3'));var as=require(_0x513c('0x4'));var logger=require(_0x513c('0x5'))('api');var config=require('../../config/environment');var db=require(_0x513c('0x6'))['db'];var htmlEntities=require(_0x513c('0x7'));config[_0x513c('0x8')]=_[_0x513c('0x9')](config[_0x513c('0x8')],{'host':_0x513c('0xa'),'port':0x18eb});var socket=require(_0x513c('0xb'))(new Redis(config[_0x513c('0x8')]));require('./mailInteraction.socket')[_0x513c('0xc')](socket);function respondWithStatusCode(_0x224eb2,_0x49fad9){_0x49fad9=_0x49fad9||0xcc;return function(_0x5a091e){if(_0x5a091e){return _0x224eb2[_0x513c('0xd')](_0x49fad9);}return _0x224eb2[_0x513c('0xe')](_0x49fad9)['end']();};}function respondWithResult(_0x5b8585,_0x4d8274){_0x4d8274=_0x4d8274||0xc8;return function(_0xae7c0d){if(_0xae7c0d){return _0x5b8585['status'](_0x4d8274)[_0x513c('0xf')](_0xae7c0d);}};}function respondWithFilteredResult(_0xde9a6e,_0x526911){return function(_0x1f7f70){if(_0x1f7f70){var _0xe3bae8=typeof _0x526911[_0x513c('0x10')]===_0x513c('0x11')&&typeof _0x526911[_0x513c('0x12')]==='undefined';var _0x31cad0=_0x1f7f70['count'];var _0x242311=_0xe3bae8?0x0:_0x526911[_0x513c('0x10')];var _0x3d0a3f=_0xe3bae8?_0x1f7f70[_0x513c('0x13')]:_0x526911['offset']+_0x526911['limit'];var _0x4c2247;if(_0x3d0a3f>=_0x31cad0){_0x3d0a3f=_0x31cad0;_0x4c2247=0xc8;}else{_0x4c2247=0xce;}_0xde9a6e[_0x513c('0xe')](_0x4c2247);return _0xde9a6e[_0x513c('0x14')]('Content-Range',_0x242311+'-'+_0x3d0a3f+'/'+_0x31cad0)['json'](_0x1f7f70);}return null;};}function saveUpdates(_0x217e7a){return function(_0xaa7657){if(_0xaa7657){return _0xaa7657[_0x513c('0x15')](_0x217e7a)[_0x513c('0x16')](function(_0x4e5a78){return _0x4e5a78;});}return null;};}function removeEntity(_0x2039be){return function(_0xddf5d9){if(_0xddf5d9){return _0xddf5d9[_0x513c('0x17')]()[_0x513c('0x16')](function(){_0x2039be[_0x513c('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x153132){return function(_0x47a67c){if(!_0x47a67c){_0x153132[_0x513c('0xd')](0x194);}return _0x47a67c;};}function handleError(_0x13cfe1,_0x9dc7ba){_0x9dc7ba=_0x9dc7ba||0x1f4;return function(_0xcd8a3b){logger[_0x513c('0x18')](_0xcd8a3b['stack']);if(_0xcd8a3b['name']){delete _0xcd8a3b[_0x513c('0x19')];}_0x13cfe1[_0x513c('0xe')](_0x9dc7ba)['send'](_0xcd8a3b);};}function getInteractionUsers(_0x435b57,_0x28c0ee){return new BPromise(function(_0x4bc5f5,_0x206e5b){try{if(_0x28c0ee[_0x435b57['id']]){_0x435b57[_0x513c('0x1a')]=_[_0x513c('0x1b')](_0x28c0ee[_0x435b57['id']],function(_0x24cfa7){return{'id':_0x24cfa7['id'],'fullname':_0x24cfa7[_0x513c('0x1c')]};});}}catch(_0x168854){_0x206e5b(_0x168854);}_0x4bc5f5(_0x435b57);});}function getInteractionTags(_0x4574e2,_0x4de42d){return new BPromise(function(_0x398b01,_0x100181){try{if(_0x4574e2[_0x513c('0x1d')]){_0x4574e2[_0x513c('0x1e')]=[];_0x4574e2[_0x513c('0x1d')]['split'](',')[_0x513c('0x1f')](function(_0x28de12){_0x4574e2[_0x513c('0x1e')][_0x513c('0x20')](_0x4de42d[_0x28de12]);});}delete _0x4574e2[_0x513c('0x1d')];}catch(_0x19a47e){_0x100181(_0x19a47e);}_0x398b01(_0x4574e2);});}function getLastMessageText(_0x5c850f){return new BPromise(function(_0x564ef8,_0x3e642b){return db['MailMessage'][_0x513c('0x21')]({'where':{'$and':[{'MailInteractionId':_0x5c850f['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x513c('0x22')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x513c('0x23')],'order':'-id','raw':!![]})[_0x513c('0x16')](function(_0x24d971){if(_0x24d971&&_0x24d971[_0x513c('0x23')]){_0x5c850f[_0x513c('0x24')]=_['trimStart'](_0x24d971[_0x513c('0x23')]);}_0x564ef8(_0x5c850f);})[_0x513c('0x25')](function(_0x4cc1b6){_0x3e642b(_0x4cc1b6);});});}function updateMailInteraction(_0xddb4b8,_0x7c8306,_0x590263,_0xee35c1){return new BPromise(function(_0x38fe47,_0x418311){return getInteractionUsers(_0xddb4b8,_0x590263)[_0x513c('0x16')](function(_0x2ddc08){return getInteractionTags(_0x2ddc08,_0x7c8306);})['then'](function(_0x526384){return getStateInteraction(_0x526384);})[_0x513c('0x16')](function(_0x529d7f){if(_0xee35c1){_0x38fe47(getLastMessageText(_0x529d7f));}else{_0x38fe47(_0x529d7f);}})[_0x513c('0x25')](function(_0x164829){_0x418311(_0x164829);});});}function getStateInteraction(_0x3d2990){return new BPromise(function(_0x2a5472){_0x3d2990[_0x513c('0x26')]=0x0;_0x3d2990[_0x513c('0x27')]=0x0;_0x3d2990[_0x513c('0x28')]=0x0;_0x3d2990['unmanaged']=0x0;_0x3d2990[_0x513c('0x29')]=0x0;if(!_0x3d2990[_0x513c('0x2a')]&&!_0x3d2990[_0x513c('0x2b')]){_0x3d2990[_0x513c('0x26')]+=0x1;}if(!_0x3d2990['closed']&&_0x3d2990[_0x513c('0x2b')]){_0x3d2990['talking']+=0x1;if(_0x3d2990[_0x513c('0x26')]){_0x3d2990[_0x513c('0x26')]-=0x1;}}if(_0x3d2990['closed']&&_0x3d2990['UserId']){_0x3d2990[_0x513c('0x28')]+=0x1;if(_0x3d2990['talking']){_0x3d2990['talking']-=0x1;}}if(_0x3d2990[_0x513c('0x2a')]&&!_0x3d2990['UserId']){_0x3d2990[_0x513c('0x2c')]+=0x1;if(_0x3d2990['waiting']){_0x3d2990['waiting']-=0x1;}}_0x3d2990[_0x513c('0x29')]+=0x1;_0x2a5472(_0x3d2990);});}exports[_0x513c('0x2d')]=function(_0x3aee99,_0x54237b){var _0x131d12={},_0x4bc902={},_0x5da485={'count':0x0,'rows':[]};var _0x1b77f7=_[_0x513c('0x1b')](db['MailInteraction'][_0x513c('0x2e')],function(_0x44a1a3){return{'name':_0x44a1a3[_0x513c('0x2f')],'type':_0x44a1a3['type'][_0x513c('0x30')]};});_0x4bc902[_0x513c('0x31')]=_[_0x513c('0x1b')](_0x1b77f7,_0x513c('0x19'));_0x4bc902[_0x513c('0x32')]=_[_0x513c('0x33')](_0x3aee99['query']);_0x4bc902[_0x513c('0x34')]=_[_0x513c('0x35')](_0x4bc902[_0x513c('0x31')],_0x4bc902['query']);_0x131d12[_0x513c('0x36')]=_[_0x513c('0x35')](_0x4bc902[_0x513c('0x31')],qs[_0x513c('0x37')](_0x3aee99[_0x513c('0x32')][_0x513c('0x37')]));_0x131d12['attributes']=_0x131d12[_0x513c('0x36')][_0x513c('0x38')]?_0x131d12[_0x513c('0x36')]:_0x4bc902['model'];if(!_0x3aee99[_0x513c('0x32')][_0x513c('0x39')](_0x513c('0x3a'))){_0x131d12[_0x513c('0x12')]=qs[_0x513c('0x12')](_0x3aee99[_0x513c('0x32')]['limit']);_0x131d12[_0x513c('0x10')]=qs[_0x513c('0x10')](_0x3aee99[_0x513c('0x32')][_0x513c('0x10')]);}_0x131d12[_0x513c('0x3b')]=qs[_0x513c('0x3c')](_0x3aee99[_0x513c('0x32')][_0x513c('0x3c')]);_0x131d12[_0x513c('0x3d')]=qs['filters'](_['pick'](_0x3aee99['query'],_0x4bc902[_0x513c('0x34')]),_0x1b77f7);var _0x324723=[];var _0x456374=squel['select']()[_0x513c('0x3e')]('id')[_0x513c('0x3e')](_0x513c('0x19'))[_0x513c('0x3e')](_0x513c('0x3f'))[_0x513c('0x40')](_0x513c('0x41'));var _0x50ed97=squel['select']()[_0x513c('0x3e')](_0x513c('0x42'))[_0x513c('0x3e')](_0x513c('0x43'))[_0x513c('0x3e')](_0x513c('0x44'))[_0x513c('0x40')]('user_has_mail_interactions','ui')[_0x513c('0x45')](_0x513c('0x46'),'u','u.id\x20=\x20ui.UserId');var _0x538f54=squel[_0x513c('0x47')]()[_0x513c('0x40')](_0x513c('0x48'),'i')[_0x513c('0x45')](_0x513c('0x49'),'c',_0x513c('0x4a'))[_0x513c('0x45')](_0x513c('0x46'),'o',_0x513c('0x4b'))[_0x513c('0x45')]('mail_accounts','a',_0x513c('0x4c'))[_0x513c('0x45')](_0x513c('0x4d'),'me','me.MailInteractionId\x20=\x20i.id')['left_join'](_0x513c('0x4e'),'it',_0x513c('0x4f'))['left_join'](_0x513c('0x41'),'t','t.id\x20=\x20it.TagId');var _0x1a1242=squel[_0x513c('0x50')]();var _0x39bbd4=[];var _0x4fa387=squel[_0x513c('0x50')]();var _0x363f56;if(_0x3aee99[_0x513c('0x32')][_0x513c('0x51')]){_0x363f56=as['parseSearch'](_0x3aee99[_0x513c('0x32')]['search']);var _0xc78a68=_0x363f56[_0x513c('0x52')];for(var _0x4cb016=0x0;_0x4cb016<_0x363f56[_0x513c('0x53')][_0x513c('0x38')];_0x4cb016++){var _0x5b1205=_0x363f56[_0x513c('0x53')][_0x4cb016];var _0x658e24='i';var _0x38aa3a=_[_0x513c('0x54')](_0x1b77f7,[_0x513c('0x19'),_0x5b1205[_0x513c('0x3e')]]);if(!_0x38aa3a){switch(_0x5b1205[_0x513c('0x3e')]){case _0x513c('0x55'):if(_0x5b1205[_0x513c('0x56')]==0x1){_0x538f54['having']('`'+_0x5b1205[_0x513c('0x3e')]+_0x513c('0x57'));}else{_0x538f54[_0x513c('0x58')]('`'+_0x5b1205[_0x513c('0x3e')]+_0x513c('0x59'));}break;case _0x513c('0x5a'):if(_0x5b1205[_0x513c('0x5b')]===_0x513c('0x5c')){if(_0x5b1205['value'][_0x513c('0x5d')]('\x20')['length']>0x1){_0x1a1242[_0xc78a68](_0x513c('0x5e'),qs[_0x513c('0x5f')](_0x5b1205['value']),null);}else{var _0x231667='%'+_0x5b1205['value']+'%';_0x1a1242[_0xc78a68](_0x513c('0x60'),_0x231667,_0x231667,_0x231667);}}else{_0x38aa3a=_[_0x513c('0x54')](_0x1b77f7,[_0x513c('0x19'),'ContactId']);_0x5b1205[_0x513c('0x3e')]=_0x513c('0x61');_0x1078f7=as['buildExpression'](_0x658e24,_0x38aa3a[_0x513c('0x62')],_0x5b1205);_0x1a1242[_0xc78a68](_0x1078f7[_0x513c('0x63')],_0x1078f7[_0x513c('0x56')][_0x513c('0x64')],_0x1078f7['value'][_0x513c('0x65')]);}break;case _0x513c('0x66'):var _0x3abc92=_0x5b1205['value']['split'](',')[_0x513c('0x1b')](function(_0x170cc9){return Number(_0x170cc9);});_0x3abc92['forEach'](function(_0x2fee11){_0x4fa387['or'](_0x513c('0x67'),'%,'+_0x2fee11+',%');});_0x39bbd4=_[_0x513c('0x68')](_0x39bbd4,_0x3abc92);break;case'User':if(_0x5b1205[_0x513c('0x5b')]===_0x513c('0x5c')){_0x1a1242[_0xc78a68](_0x513c('0x69'),'%'+_0x5b1205[_0x513c('0x56')]+'%',null);}else{_0x38aa3a=_[_0x513c('0x54')](_0x1b77f7,[_0x513c('0x19'),'UserId']);_0x5b1205[_0x513c('0x3e')]=_0x513c('0x2b');_0x1078f7=as[_0x513c('0x6a')](_0x658e24,_0x38aa3a['type'],_0x5b1205);_0x1a1242[_0xc78a68](_0x1078f7[_0x513c('0x63')],_0x1078f7[_0x513c('0x56')][_0x513c('0x64')],_0x1078f7[_0x513c('0x56')]['end']);}break;case'plainBody':_0x1078f7=as[_0x513c('0x6a')]('me',null,_0x5b1205);_0x1a1242[_0xc78a68](_0x1078f7[_0x513c('0x63')],_0x1078f7[_0x513c('0x56')]['start'],_0x1078f7[_0x513c('0x56')][_0x513c('0x65')]);break;}}else{var _0x1078f7=as[_0x513c('0x6a')](_0x658e24,_0x38aa3a['type'],_0x5b1205);_0x1a1242[_0xc78a68](_0x1078f7[_0x513c('0x63')],_0x1078f7[_0x513c('0x56')][_0x513c('0x64')],_0x1078f7[_0x513c('0x56')][_0x513c('0x65')]);}}}else{var _0x58f44d=_(_0x3aee99[_0x513c('0x32')])[_0x513c('0x33')]()[_0x513c('0x1b')](function(_0x3e0a24){return _[_0x513c('0x6b')](_0x1b77f7,[_0x513c('0x19'),_0x3e0a24])?_0x3e0a24:undefined;})[_0x513c('0x6c')]()[_0x513c('0x56')]();if(!_['isEmpty'](_0x58f44d)){_0x58f44d[_0x513c('0x1f')](function(_0x4c605e){if(_0x4c605e==='MailAccountId'){_0x538f54[_0x513c('0x3d')](_0x513c('0x6d'),[][_0x513c('0x6e')](_0x3aee99[_0x513c('0x32')][_0x4c605e]));}else if(_0x4c605e==='createdAt'){var _0x377a71=JSON[_0x513c('0x6f')](_0x3aee99['query'][_0x4c605e])['$gte'];var _0x51e12a=JSON[_0x513c('0x6f')](_0x3aee99[_0x513c('0x32')][_0x4c605e])[_0x513c('0x70')];_0x538f54['where'](_0x513c('0x71'),_0x377a71,_0x51e12a);}else{if(_0x3aee99[_0x513c('0x32')][_0x4c605e]===_0x513c('0x72')){_0x538f54['where']('i.'+_0x4c605e+_0x513c('0x73'));}else{_0x538f54[_0x513c('0x3d')]('i.'+_0x4c605e+_0x513c('0x74'),_0x3aee99[_0x513c('0x32')][_0x4c605e]);}}});}if(_0x3aee99[_0x513c('0x32')][_0x513c('0x75')]){if(_0x3aee99[_0x513c('0x32')][_0x513c('0x75')]==0x1){_0x538f54['having'](_0x513c('0x76'));}else{_0x538f54[_0x513c('0x58')](_0x513c('0x77'));}}if(_0x3aee99[_0x513c('0x32')]['tag']){_0x39bbd4=_[_0x513c('0x78')](_0x3aee99[_0x513c('0x32')][_0x513c('0x79')])?_0x3aee99[_0x513c('0x32')][_0x513c('0x79')]:new Array(_0x3aee99['query'][_0x513c('0x79')]);_0x39bbd4['forEach'](function(_0x49e39f){_0x4fa387['or'](_0x513c('0x67'),'%,'+_0x49e39f+',%');});}if(_0x3aee99[_0x513c('0x32')][_0x513c('0x7a')]){var _0x5cc49b=_0x3aee99['query'][_0x513c('0x7a')][_0x513c('0x7b')]('\x5c','\x5c\x5c')[_0x513c('0x7b')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5cc49b)){_0x1a1242['or']('i.id\x20LIKE\x20?',_0x5cc49b+'%');}else if(qs[_0x513c('0x7c')](_0x5cc49b)){_0x1a1242['or'](_0x513c('0x7d'),_0x5cc49b+'%');}else{_0x1a1242['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5cc49b))['or'](_0x513c('0x7e'),qs['getFullTextValue'](_0x5cc49b));}}}_0x538f54[_0x513c('0x3d')](_0x1a1242);_0x538f54[_0x513c('0x7f')](_0x513c('0x80'));var _0x30a1c5={'type':db['Sequelize'][_0x513c('0x81')][_0x513c('0x82')],'raw':!![]};var _0x4c2bf5=_0x538f54[_0x513c('0x83')]();_0x4c2bf5[_0x513c('0x3e')]('i.id');_0x4c2bf5[_0x513c('0x3e')](_0x513c('0x84'),_0x513c('0x55'));if(_0x131d12[_0x513c('0x3b')]){_0x131d12[_0x513c('0x3b')]['forEach'](function(_0xb68f8d){var _0x41ac37=_0xb68f8d[0x0]==='contactName'?_0xb68f8d[0x0]:'i.'+_0xb68f8d[0x0];_0x538f54[_0x513c('0x3b')](_0x41ac37,_0xb68f8d[0x1]===_0x513c('0x85')?![]:!![]);});}if(!_[_0x513c('0x86')](_0x39bbd4)){_0x538f54['having'](_0x4fa387);_0x4c2bf5[_0x513c('0x3d')]('t.id\x20IN\x20?',_0x39bbd4);}BPromise[_0x513c('0x87')]()[_0x513c('0x16')](function(){if(!_0x363f56){if(_0x3aee99[_0x513c('0x32')][_0x513c('0x88')])return;_0x4c2bf5['where'](_0x513c('0x89'));_0x538f54['where'](_0x513c('0x89'));return;}if(_0x3aee99[_0x513c('0x8a')]['role']!==_0x513c('0x8b'))return;return _0x3aee99[_0x513c('0x8a')][_0x513c('0x8c')]({'attributes':['id'],'raw':!![]})[_0x513c('0x16')](function(_0x3abd8d){if(_[_0x513c('0x86')](_0x3abd8d)){_0x4c2bf5[_0x513c('0x3d')]('i.MailAccountId\x20IS\x20NULL');_0x538f54[_0x513c('0x3d')](_0x513c('0x8d'));}else{_0x4c2bf5[_0x513c('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0x513c('0x1b')](_0x3abd8d,'id'));_0x538f54[_0x513c('0x3d')](_0x513c('0x6d'),_['map'](_0x3abd8d,'id'));}});})[_0x513c('0x16')](function(){if(_0x3aee99['user'][_0x513c('0x8e')]===_0x513c('0x8b')&&!_0x363f56&&!_0x3aee99['query'][_0x513c('0x88')])return[];return db['sequelize'][_0x513c('0x32')](_0x4c2bf5[_0x513c('0x8f')](),_0x30a1c5);})[_0x513c('0x16')](function(_0x7c2804){_0x5da485[_0x513c('0x13')]=_0x7c2804[_0x513c('0x38')];if(_0x5da485[_0x513c('0x13')]===0x0)return[];return db[_0x513c('0x90')][_0x513c('0x32')](_0x456374[_0x513c('0x8f')](),_0x30a1c5)[_0x513c('0x16')](function(_0xd913aa){_0x324723=_[_0x513c('0x91')](_0xd913aa,'id');_0x30a1c5=_['merge'](_0x30a1c5,{'model':db[_0x513c('0x92')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3aee99['query'][_0x513c('0x37')]){_0x131d12['attributes']['forEach'](function(_0x59cc92){_0x538f54[_0x513c('0x3e')]('i.'+_0x59cc92);});}else{_0x538f54[_0x513c('0x3e')](_0x513c('0x84'),_0x513c('0x55'));_0x538f54[_0x513c('0x3e')]('a.key',_0x513c('0x93'));_0x538f54[_0x513c('0x3e')](_0x513c('0x94'),_0x513c('0x95'));_0x538f54[_0x513c('0x3e')](_0x513c('0x96'),_0x513c('0x97'));_0x538f54[_0x513c('0x3e')](_0x513c('0x80'));_0x538f54[_0x513c('0x3e')]('i.createdAt');_0x538f54['field']('i.updatedAt');_0x538f54[_0x513c('0x3e')]('i.closed');_0x538f54[_0x513c('0x3e')](_0x513c('0x98'));_0x538f54[_0x513c('0x3e')](_0x513c('0x99'));_0x538f54[_0x513c('0x3e')](_0x513c('0x9a'));_0x538f54[_0x513c('0x3e')]('i.lastMsgDirection');_0x538f54[_0x513c('0x3e')]('i.subject');_0x538f54['field']('i.disposition');_0x538f54[_0x513c('0x3e')](_0x513c('0x9b'));_0x538f54[_0x513c('0x3e')](_0x513c('0x9c'));_0x538f54['field'](_0x513c('0x9d'));_0x538f54[_0x513c('0x3e')](_0x513c('0x9e'));_0x538f54[_0x513c('0x3e')](_0x513c('0x9f'));_0x538f54[_0x513c('0x3e')](_0x513c('0xa0'));_0x538f54[_0x513c('0x3e')]('i.UserId');_0x538f54[_0x513c('0x3e')](_0x513c('0xa1'),_0x513c('0xa2'));_0x538f54[_0x513c('0x3e')](_0x513c('0xa3'),_0x513c('0xa4'));_0x538f54[_0x513c('0x3e')](_0x513c('0xa5'),_0x513c('0xa6'));_0x538f54[_0x513c('0x3e')](_0x513c('0xa7'),_0x513c('0xa8'));_0x538f54['field'](_0x513c('0xa9'),_0x513c('0xaa'));_0x538f54[_0x513c('0x3e')](_0x513c('0xab'),_0x513c('0xac'));_0x538f54[_0x513c('0x3e')](_0x513c('0xad'),'Owner.fullname');_0x538f54[_0x513c('0x3e')](_0x513c('0xae'),_0x513c('0xaf'));_0x538f54[_0x513c('0x3e')](_0x513c('0xb0'),_0x513c('0x1d'));}if(_0x131d12[_0x513c('0x12')])_0x538f54[_0x513c('0x12')](_0x131d12[_0x513c('0x12')]);if(_0x131d12[_0x513c('0x10')])_0x538f54[_0x513c('0x10')](_0x131d12[_0x513c('0x10')]);return db[_0x513c('0x90')][_0x513c('0x32')](_0x538f54[_0x513c('0x8f')](),_0x30a1c5);})[_0x513c('0x16')](function(_0x470249){if(_0x470249['length']>0x0)_0x50ed97[_0x513c('0x3d')](_0x513c('0xb1'),_[_0x513c('0x1b')](_0x470249,'id'));return db[_0x513c('0x90')][_0x513c('0x32')](_0x50ed97[_0x513c('0x8f')](),_0x30a1c5)[_0x513c('0x16')](function(_0x476283){var _0x2dc663=_[_0x513c('0xb2')](_0x476283,_0x513c('0xb3'));var _0x5efbd6=[];return db[_0x513c('0xb4')][_0x513c('0x21')]({'attributes':[_0x513c('0xb5')],'raw':!![]})[_0x513c('0x16')](function(_0x4a6eab){var _0x4a50cd=_0x4a6eab[_0x513c('0xb5')];_0x470249[_0x513c('0x1f')](function(_0x2b6f61){_0x5efbd6[_0x513c('0x20')](updateMailInteraction(_0x2b6f61,_0x324723,_0x2dc663,_0x4a50cd));});return BPromise[_0x513c('0xb6')](_0x5efbd6);});});});})['then'](function(_0x1a735d){_0x5da485[_0x513c('0xb7')]=_0x1a735d;return _0x5da485;})[_0x513c('0x16')](respondWithFilteredResult(_0x54237b,_0x131d12))[_0x513c('0x25')](handleError(_0x54237b,null));};exports['show']=function(_0x23c5a0,_0x1af64c){var _0xb30f23={'raw':![],'where':{'id':_0x23c5a0[_0x513c('0xb8')]['id']}},_0x1829d3={};_0x1829d3['model']=_[_0x513c('0x33')](db[_0x513c('0x92')]['rawAttributes']);_0x1829d3[_0x513c('0x32')]=_[_0x513c('0x33')](_0x23c5a0['query']);_0x1829d3['filters']=_['intersection'](_0x1829d3[_0x513c('0x31')],_0x1829d3[_0x513c('0x32')]);_0xb30f23[_0x513c('0x36')]=_[_0x513c('0x35')](_0x1829d3[_0x513c('0x31')],qs[_0x513c('0x37')](_0x23c5a0['query'][_0x513c('0x37')]));_0xb30f23[_0x513c('0x36')]=_0xb30f23[_0x513c('0x36')][_0x513c('0x38')]?_0xb30f23[_0x513c('0x36')]:_0x1829d3[_0x513c('0x31')];if(_0x23c5a0[_0x513c('0x32')][_0x513c('0xb9')]){_0xb30f23[_0x513c('0xba')]=[{'all':!![]}];}_0xb30f23=_[_0x513c('0xbb')]({},_0xb30f23,_0x23c5a0[_0x513c('0xbc')]);return db[_0x513c('0x92')][_0x513c('0x54')](_0xb30f23)[_0x513c('0x16')](handleEntityNotFound(_0x1af64c,null))[_0x513c('0x16')](respondWithResult(_0x1af64c,null))[_0x513c('0x25')](handleError(_0x1af64c,null));};exports[_0x513c('0xbd')]=function(_0x2467c5,_0x3a17c8){return db[_0x513c('0x92')]['create'](_0x2467c5['body'],{})[_0x513c('0x16')](respondWithResult(_0x3a17c8,0xc9))[_0x513c('0x25')](handleError(_0x3a17c8,null));};exports['update']=function(_0x5cb839,_0x5a63d7){if(_0x5cb839[_0x513c('0xbe')]['id']){delete _0x5cb839['body']['id'];}return db['MailInteraction']['find']({'where':{'id':_0x5cb839[_0x513c('0xb8')]['id']}})[_0x513c('0x16')](handleEntityNotFound(_0x5a63d7,null))['then'](saveUpdates(_0x5cb839[_0x513c('0xbe')],null))['then'](respondWithResult(_0x5a63d7,null))[_0x513c('0x25')](handleError(_0x5a63d7,null));};exports[_0x513c('0x17')]=function(_0x53108a,_0x281228){return db['MailInteraction'][_0x513c('0x54')]({'where':{'id':_0x53108a[_0x513c('0xb8')]['id']}})[_0x513c('0x16')](handleEntityNotFound(_0x281228,null))[_0x513c('0x16')](removeEntity(_0x281228,null))[_0x513c('0x25')](handleError(_0x281228,null));};exports[_0x513c('0xbf')]=function(_0x26a6c7,_0x2369bc){return db[_0x513c('0x92')]['describe']()[_0x513c('0x16')](respondWithResult(_0x2369bc,null))[_0x513c('0x25')](handleError(_0x2369bc,null));};exports[_0x513c('0xc0')]=function(_0x5cf298,_0x392385){return db[_0x513c('0xc1')][_0x513c('0x54')]({'where':{'id':_0x5cf298['params']['id']}})[_0x513c('0x16')](handleEntityNotFound(_0x392385,null))[_0x513c('0x16')](function(_0x1ac2a8){if(_0x1ac2a8){return _0x1ac2a8['addMessage'](_0x5cf298[_0x513c('0xbe')][_0x513c('0xc2')],_[_0x513c('0xc3')](_0x5cf298[_0x513c('0xbe')],[_0x513c('0xc2'),'id'])||{});}})[_0x513c('0x16')](respondWithResult(_0x392385,null))[_0x513c('0x25')](handleError(_0x392385,null));};exports[_0x513c('0xc4')]=function(_0x2a57ae,_0x208b58){var _0x4ed73b={'raw':![],'where':{}};var _0xb7d88b={};var _0x613aa8={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x2a57ae[_0x513c('0xb8')]['id']}})[_0x513c('0x16')](handleEntityNotFound(_0x208b58,null))[_0x513c('0x16')](function(_0x13daa2){if(_0x13daa2){_0xb7d88b[_0x513c('0x31')]=_['keys'](db[_0x513c('0xc1')]['rawAttributes']);_0xb7d88b['query']=_[_0x513c('0x33')](_0x2a57ae['query']);_0xb7d88b[_0x513c('0x34')]=_[_0x513c('0x35')](_0xb7d88b[_0x513c('0x31')],_0xb7d88b[_0x513c('0x32')]);_0x4ed73b[_0x513c('0x36')]=_['intersection'](_0xb7d88b['model'],qs[_0x513c('0x37')](_0x2a57ae[_0x513c('0x32')]['fields']));_0x4ed73b[_0x513c('0x36')]=_0x4ed73b['attributes'][_0x513c('0x38')]?_0x4ed73b[_0x513c('0x36')]:_0xb7d88b[_0x513c('0x31')];if(!_0x2a57ae['query']['hasOwnProperty'](_0x513c('0x3a'))){_0x4ed73b[_0x513c('0x12')]=qs[_0x513c('0x12')](_0x2a57ae[_0x513c('0x32')][_0x513c('0x12')]);_0x4ed73b[_0x513c('0x10')]=qs[_0x513c('0x10')](_0x2a57ae[_0x513c('0x32')]['offset']);}_0x4ed73b[_0x513c('0x3b')]=qs[_0x513c('0x3c')](_0x2a57ae[_0x513c('0x32')][_0x513c('0x3c')]);_0x4ed73b['where']=qs[_0x513c('0x34')](_[_0x513c('0xc5')](_0x2a57ae['query'],_0xb7d88b[_0x513c('0x34')]));_0x4ed73b[_0x513c('0x3d')][_0x513c('0xb3')]=_0x13daa2['id'];if(_0x2a57ae[_0x513c('0x32')][_0x513c('0x7a')]){_0x4ed73b['where']=_[_0x513c('0xbb')](_0x4ed73b['where'],{'$or':_[_0x513c('0x1b')](_0x4ed73b[_0x513c('0x36')],function(_0x4cc0b5){var _0x576908={};_0x576908[_0x4cc0b5]={'$like':'%'+_0x2a57ae[_0x513c('0x32')][_0x513c('0x7a')]+'%'};return _0x576908;})});}if(_0x2a57ae[_0x513c('0x32')][_0x513c('0xc6')]){var _0x44f6e9=_0x2a57ae[_0x513c('0x32')]['$gte']['split'](',');var _0x5bec08={};_0x5bec08[_0x44f6e9[0x0]]={'$gte':moment(_0x44f6e9[0x1])[_0x513c('0xc7')](_0x513c('0xc8'))};_0x4ed73b[_0x513c('0x3d')]=_[_0x513c('0xbb')](_0x4ed73b[_0x513c('0x3d')],_0x5bec08);}_0x4ed73b=_['merge']({},_0x4ed73b,_0x2a57ae[_0x513c('0xbc')]);return db[_0x513c('0xc1')][_0x513c('0x13')]({'where':_0x4ed73b['where']})[_0x513c('0x16')](function(_0x21439f){_0x613aa8[_0x513c('0x13')]=_0x21439f;if(_0x2a57ae[_0x513c('0x32')][_0x513c('0xb9')]){_0x4ed73b[_0x513c('0xba')]=[{'all':!![]}];}return db['MailMessage'][_0x513c('0xc9')](_0x4ed73b);})['then'](function(_0x510480){if(_0x2a57ae[_0x513c('0x32')]['inlineCss']===_0x513c('0xca')){for(var _0x3b6413=0x0;_0x3b6413<_0x510480[_0x513c('0x38')];_0x3b6413++){_0x510480[_0x3b6413]['body']=juice(_0x510480[_0x3b6413]['body']);}}_0x613aa8[_0x513c('0xb7')]=_0x510480;return _0x613aa8;});}})[_0x513c('0x16')](respondWithFilteredResult(_0x208b58,_0x4ed73b))[_0x513c('0x25')](handleError(_0x208b58,null));};exports[_0x513c('0xcb')]=function(_0x35f7fa,_0x36f8e4){return db['MailInteraction'][_0x513c('0x54')]({'where':{'id':_0x35f7fa['params']['id']}})[_0x513c('0x16')](handleEntityNotFound(_0x36f8e4,null))['then'](function(_0x29da69){if(_0x29da69){return _0x29da69[_0x513c('0xcc')](_0x35f7fa['body'][_0x513c('0xc2')],_['omit'](_0x35f7fa[_0x513c('0xbe')],[_0x513c('0xc2'),'id'])||{})[_0x513c('0xcd')](function(){return db[_0x513c('0x66')]['findAll']({'attributes':['id',_0x513c('0x19'),_0x513c('0x3f')],'where':{'id':_0x35f7fa[_0x513c('0xbe')][_0x513c('0xc2')]}});})['then'](function(_0x2847c4){socket[_0x513c('0xce')](_0x513c('0xcf'),{'id':Number(_0x35f7fa[_0x513c('0xb8')]['id']),'tags':_0x2847c4||[]});return{'id':Number(_0x35f7fa['params']['id']),'tags':_0x2847c4||[]};});}})[_0x513c('0x16')](respondWithResult(_0x36f8e4,null))[_0x513c('0x25')](handleError(_0x36f8e4,null));};exports[_0x513c('0xd0')]=function(_0x22e9cc,_0x25ca7d){return db[_0x513c('0x92')][_0x513c('0x54')]({'where':{'id':_0x22e9cc[_0x513c('0xb8')]['id']}})[_0x513c('0x16')](handleEntityNotFound(_0x25ca7d,null))[_0x513c('0x16')](function(_0x3f31f7){if(_0x3f31f7){return _0x3f31f7[_0x513c('0xd0')](_0x22e9cc[_0x513c('0x32')][_0x513c('0xc2')]);}})[_0x513c('0x16')](respondWithStatusCode(_0x25ca7d,null))[_0x513c('0x25')](handleError(_0x25ca7d,null));};exports[_0x513c('0xd1')]=function(_0x1cf3cc,_0x33f78e){var _0x264146=moment()[_0x513c('0xd2')]()[_0x513c('0x8f')]();var _0x47dced=path[_0x513c('0xd3')](config['root'],'server',_0x513c('0xd4'),_0x513c('0xd5'));var _0x510019=path[_0x513c('0xd3')](config['root'],_0x513c('0xd6'),'files','attachments');var _0x2d9b21=path['join'](_0x47dced,_0x264146);var _0xff7c49=util[_0x513c('0xc7')]('transcript-%d-%s.zip',_0x1cf3cc[_0x513c('0xb8')]['id'],_0x264146);var _0x5e6b6d=path['join'](_0x47dced,_0xff7c49);var _0x5628ae=[];if(_0x1cf3cc['query']['attachments']){_0x5628ae[_0x513c('0x20')]({'model':db[_0x513c('0xd7')],'as':'Attachments','raw':!![]});}var _0x106c77=[{'model':db[_0x513c('0xc1')],'as':'Messages','attributes':['id',_0x513c('0xbe'),'from','to','cc','bcc',_0x513c('0xd8'),_0x513c('0xd9')],'where':{'secret':![]},'order':qs[_0x513c('0x3c')]('id'),'include':_0x5628ae}];return db[_0x513c('0x92')][_0x513c('0x54')]({'where':{'id':_0x1cf3cc[_0x513c('0xb8')]['id']},'include':_0x106c77})[_0x513c('0x16')](handleEntityNotFound(_0x33f78e,null))[_0x513c('0x16')](function(_0xae8a20){if(_0xae8a20&&_0xae8a20[_0x513c('0xda')]){var _0x2e3e5e=_0xae8a20[_0x513c('0xdb')]({'plain':!![]});fs[_0x513c('0xdc')](_0x2d9b21);return BPromise[_0x513c('0xdd')](_0x2e3e5e['Messages'],function(_0x7865b7,_0x9bd77b){var _0x3d062a={'from':_0x7865b7[_0x513c('0x40')],'to':_0x7865b7['to'],'subject':_0x7865b7[_0x513c('0xd8')],'html':htmlEntities[_0x513c('0xde')](_0x7865b7[_0x513c('0xbe')]),'headers':{'Date':moment(_0x7865b7[_0x513c('0xd9')])['format'](_0x513c('0xdf'))},'attachments':[]};if(_0x7865b7['cc']){_0x3d062a[_0x513c('0xe0')]['Cc']=_0x7865b7['cc'];}if(_0x7865b7[_0x513c('0xe1')]){_0x3d062a[_0x513c('0xe0')][_0x513c('0xe2')]=_0x7865b7[_0x513c('0xe1')];}return new BPromise(function(_0x4fd3c3,_0x31cac3){if(_0x7865b7[_0x513c('0xe3')]){for(var _0x394080=0x0;_0x394080<_0x7865b7['Attachments'][_0x513c('0x38')];_0x394080++){var _0x1db06a=_0x7865b7['Attachments'][_0x394080];var _0x5c0408=path['join'](_0x510019,_0x1db06a['basename']);if(fs[_0x513c('0xe4')](_0x5c0408)){_0x3d062a['attachments'][_0x513c('0x20')]({'name':_0x1db06a[_0x513c('0x19')],'contentType':_0x1db06a[_0x513c('0x62')],'data':fs[_0x513c('0xe5')](_0x5c0408)});}}}emlformat[_0x513c('0xe6')](_0x3d062a,function(_0x45b0dc,_0x132e3c){if(_0x45b0dc)return _0x31cac3(_0x45b0dc);fs[_0x513c('0xe7')](path[_0x513c('0xd3')](_0x2d9b21,util[_0x513c('0xc7')](_0x513c('0xe8'),_0x9bd77b)),_0x132e3c);return _0x4fd3c3(_0x132e3c);});});})[_0x513c('0x16')](function(){return new BPromise(function(_0x1e26a7,_0x1341d3){zipdir(_0x2d9b21,{'saveTo':_0x5e6b6d},function(_0x396c1e,_0x22f50b){if(_0x396c1e)return _0x1341d3(_0x396c1e);return _0x1e26a7(_0x22f50b);});})[_0x513c('0x16')](function(){return new BPromise(function(_0x5da8b6,_0x2a9992){rimraf(_0x2d9b21,function(_0x1cc516){if(_0x1cc516)_0x2a9992(_0x1cc516);return _0x5da8b6();});});})[_0x513c('0x16')](function(){return _0x33f78e[_0x513c('0xd1')](_0x5e6b6d,_0xff7c49,function(_0x1c79f0){if(!_0x1c79f0)fs[_0x513c('0xe9')](_0x5e6b6d);});});});}else{return _0x33f78e[_0x513c('0xd')](0xc8);}})[_0x513c('0x25')](handleError(_0x33f78e,null));}; \ No newline at end of file +var _0xd117=['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','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','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?','ContactId','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','text','isEmpty','i.MailAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','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','SELECT','clone','order','contactName','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','user','sequelize','toString','keyBy','merge','MailInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.substatus','i.to','i.ContactId','i.UserId','Contact.firstName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','all','rows','catch','show','include','create','body','params','describe','addMessage','ids','omit','getMessages','nolimit','format','options','findAll','true','setTags','spread','emit','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','bcc','subject','createdAt','Messages','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','html-entities','redis','defaults','localhost','socket.io-emitter','register','end','json','offset','undefined','limit','count','status','set','update','destroy','then','sendStatus','error','stack','name','send','fullname','TagIds','Tags','forEach','push','MailMessage','findOne','out','lastMsgText','trimStart','plainBody','waiting','unmanaged','UserId','closed','talking','answered','total','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','pick','select','field','color','from','tools_tags','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts'];(function(_0x2c9ed9,_0x18b79b){var _0xd89ac6=function(_0x45dd74){while(--_0x45dd74){_0x2c9ed9['push'](_0x2c9ed9['shift']());}};_0xd89ac6(++_0x18b79b);}(_0xd117,0x182));var _0x7d11=function(_0x28b4cd,_0x573ff1){_0x28b4cd=_0x28b4cd-0x0;var _0x4229cc=_0xd117[_0x28b4cd];return _0x4229cc;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var moment=require(_0x7d11('0x3'));var BPromise=require(_0x7d11('0x4'));var util=require(_0x7d11('0x5'));var path=require(_0x7d11('0x6'));var fs=require('fs');var _=require(_0x7d11('0x7'));var squel=require(_0x7d11('0x8'));var juice=require(_0x7d11('0x9'));var Redis=require(_0x7d11('0xa'));var qs=require(_0x7d11('0xb'));var as=require(_0x7d11('0xc'));var logger=require(_0x7d11('0xd'))(_0x7d11('0xe'));var config=require(_0x7d11('0xf'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x7d11('0x10'));config[_0x7d11('0x11')]=_[_0x7d11('0x12')](config['redis'],{'host':_0x7d11('0x13'),'port':0x18eb});var socket=require(_0x7d11('0x14'))(new Redis(config[_0x7d11('0x11')]));require('./mailInteraction.socket')[_0x7d11('0x15')](socket);function respondWithStatusCode(_0x48b0f1,_0x58a6fd){_0x58a6fd=_0x58a6fd||0xcc;return function(_0xb15984){if(_0xb15984){return _0x48b0f1['sendStatus'](_0x58a6fd);}return _0x48b0f1['status'](_0x58a6fd)[_0x7d11('0x16')]();};}function respondWithResult(_0x48f576,_0x4767d5){_0x4767d5=_0x4767d5||0xc8;return function(_0x471f46){if(_0x471f46){return _0x48f576['status'](_0x4767d5)[_0x7d11('0x17')](_0x471f46);}};}function respondWithFilteredResult(_0x20f519,_0x4cda5d){return function(_0x324de5){if(_0x324de5){var _0x16949d=typeof _0x4cda5d[_0x7d11('0x18')]===_0x7d11('0x19')&&typeof _0x4cda5d[_0x7d11('0x1a')]===_0x7d11('0x19');var _0x2a269e=_0x324de5[_0x7d11('0x1b')];var _0x4aa795=_0x16949d?0x0:_0x4cda5d[_0x7d11('0x18')];var _0x12c2ff=_0x16949d?_0x324de5[_0x7d11('0x1b')]:_0x4cda5d[_0x7d11('0x18')]+_0x4cda5d[_0x7d11('0x1a')];var _0x528fdc;if(_0x12c2ff>=_0x2a269e){_0x12c2ff=_0x2a269e;_0x528fdc=0xc8;}else{_0x528fdc=0xce;}_0x20f519[_0x7d11('0x1c')](_0x528fdc);return _0x20f519[_0x7d11('0x1d')]('Content-Range',_0x4aa795+'-'+_0x12c2ff+'/'+_0x2a269e)['json'](_0x324de5);}return null;};}function saveUpdates(_0x2ca3a2){return function(_0x52a6ae){if(_0x52a6ae){return _0x52a6ae[_0x7d11('0x1e')](_0x2ca3a2)['then'](function(_0xbe0a79){return _0xbe0a79;});}return null;};}function removeEntity(_0x17e539){return function(_0x328f8e){if(_0x328f8e){return _0x328f8e[_0x7d11('0x1f')]()[_0x7d11('0x20')](function(){_0x17e539[_0x7d11('0x1c')](0xcc)[_0x7d11('0x16')]();});}};}function handleEntityNotFound(_0x3d2574){return function(_0x5680cb){if(!_0x5680cb){_0x3d2574[_0x7d11('0x21')](0x194);}return _0x5680cb;};}function handleError(_0x4a34f4,_0x58455b){_0x58455b=_0x58455b||0x1f4;return function(_0x5c3898){logger[_0x7d11('0x22')](_0x5c3898[_0x7d11('0x23')]);if(_0x5c3898[_0x7d11('0x24')]){delete _0x5c3898[_0x7d11('0x24')];}_0x4a34f4[_0x7d11('0x1c')](_0x58455b)[_0x7d11('0x25')](_0x5c3898);};}function getInteractionUsers(_0x282e5c,_0x1c1edd){return new BPromise(function(_0x5e2f2f,_0x36c2b4){try{if(_0x1c1edd[_0x282e5c['id']]){_0x282e5c['Users']=_['map'](_0x1c1edd[_0x282e5c['id']],function(_0x5126cf){return{'id':_0x5126cf['id'],'fullname':_0x5126cf[_0x7d11('0x26')]};});}}catch(_0x59cdba){_0x36c2b4(_0x59cdba);}_0x5e2f2f(_0x282e5c);});}function getInteractionTags(_0x180e1e,_0x30e4c6){return new BPromise(function(_0x328ab7,_0x47c794){try{if(_0x180e1e[_0x7d11('0x27')]){_0x180e1e[_0x7d11('0x28')]=[];_0x180e1e[_0x7d11('0x27')]['split'](',')[_0x7d11('0x29')](function(_0x35a789){_0x180e1e[_0x7d11('0x28')][_0x7d11('0x2a')](_0x30e4c6[_0x35a789]);});}delete _0x180e1e['TagIds'];}catch(_0x1a7745){_0x47c794(_0x1a7745);}_0x328ab7(_0x180e1e);});}function getLastMessageText(_0x512f7f){return new BPromise(function(_0x1bc218,_0x509164){return db[_0x7d11('0x2b')][_0x7d11('0x2c')]({'where':{'$and':[{'MailInteractionId':_0x512f7f['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x7d11('0x2d')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})[_0x7d11('0x20')](function(_0x1ed210){if(_0x1ed210&&_0x1ed210['plainBody']){_0x512f7f[_0x7d11('0x2e')]=_[_0x7d11('0x2f')](_0x1ed210[_0x7d11('0x30')]);}_0x1bc218(_0x512f7f);})['catch'](function(_0x9c6609){_0x509164(_0x9c6609);});});}function updateMailInteraction(_0x553117,_0x507465,_0x3a88c9,_0x56637d){return new BPromise(function(_0x1d5d4e,_0x38fbd3){return getInteractionUsers(_0x553117,_0x3a88c9)[_0x7d11('0x20')](function(_0x35b997){return getInteractionTags(_0x35b997,_0x507465);})['then'](function(_0x11d9e2){return getStateInteraction(_0x11d9e2);})[_0x7d11('0x20')](function(_0x55a029){if(_0x56637d){_0x1d5d4e(getLastMessageText(_0x55a029));}else{_0x1d5d4e(_0x55a029);}})['catch'](function(_0x10ac2a){_0x38fbd3(_0x10ac2a);});});}function getStateInteraction(_0x21bac1){return new BPromise(function(_0x5b7d3a){_0x21bac1[_0x7d11('0x31')]=0x0;_0x21bac1['talking']=0x0;_0x21bac1['answered']=0x0;_0x21bac1[_0x7d11('0x32')]=0x0;_0x21bac1['total']=0x0;if(!_0x21bac1['closed']&&!_0x21bac1[_0x7d11('0x33')]){_0x21bac1[_0x7d11('0x31')]+=0x1;}if(!_0x21bac1[_0x7d11('0x34')]&&_0x21bac1[_0x7d11('0x33')]){_0x21bac1[_0x7d11('0x35')]+=0x1;if(_0x21bac1[_0x7d11('0x31')]){_0x21bac1[_0x7d11('0x31')]-=0x1;}}if(_0x21bac1[_0x7d11('0x34')]&&_0x21bac1[_0x7d11('0x33')]){_0x21bac1[_0x7d11('0x36')]+=0x1;if(_0x21bac1[_0x7d11('0x35')]){_0x21bac1[_0x7d11('0x35')]-=0x1;}}if(_0x21bac1['closed']&&!_0x21bac1[_0x7d11('0x33')]){_0x21bac1['unmanaged']+=0x1;if(_0x21bac1[_0x7d11('0x31')]){_0x21bac1[_0x7d11('0x31')]-=0x1;}}_0x21bac1[_0x7d11('0x37')]+=0x1;_0x5b7d3a(_0x21bac1);});}exports[_0x7d11('0x38')]=function(_0x4f8fd2,_0xd36cd3){var _0x1eb372={},_0x19284={},_0xa900fc={'count':0x0,'rows':[]};var _0x597071=_[_0x7d11('0x39')](db['MailInteraction'][_0x7d11('0x3a')],function(_0x4d89c3){return{'name':_0x4d89c3[_0x7d11('0x3b')],'type':_0x4d89c3[_0x7d11('0x3c')][_0x7d11('0x3d')]};});_0x19284[_0x7d11('0x3e')]=_['map'](_0x597071,'name');_0x19284[_0x7d11('0x3f')]=_[_0x7d11('0x40')](_0x4f8fd2['query']);_0x19284[_0x7d11('0x41')]=_[_0x7d11('0x42')](_0x19284[_0x7d11('0x3e')],_0x19284[_0x7d11('0x3f')]);_0x1eb372[_0x7d11('0x43')]=_[_0x7d11('0x42')](_0x19284['model'],qs[_0x7d11('0x44')](_0x4f8fd2['query'][_0x7d11('0x44')]));_0x1eb372[_0x7d11('0x43')]=_0x1eb372[_0x7d11('0x43')][_0x7d11('0x45')]?_0x1eb372[_0x7d11('0x43')]:_0x19284[_0x7d11('0x3e')];if(!_0x4f8fd2['query']['hasOwnProperty']('nolimit')){_0x1eb372[_0x7d11('0x1a')]=qs[_0x7d11('0x1a')](_0x4f8fd2[_0x7d11('0x3f')][_0x7d11('0x1a')]);_0x1eb372[_0x7d11('0x18')]=qs['offset'](_0x4f8fd2[_0x7d11('0x3f')][_0x7d11('0x18')]);}_0x1eb372['order']=qs[_0x7d11('0x46')](_0x4f8fd2[_0x7d11('0x3f')][_0x7d11('0x46')]);_0x1eb372['where']=qs[_0x7d11('0x41')](_[_0x7d11('0x47')](_0x4f8fd2[_0x7d11('0x3f')],_0x19284['filters']),_0x597071);var _0x38de7f=[];var _0x4972e7=squel[_0x7d11('0x48')]()[_0x7d11('0x49')]('id')[_0x7d11('0x49')](_0x7d11('0x24'))[_0x7d11('0x49')](_0x7d11('0x4a'))[_0x7d11('0x4b')](_0x7d11('0x4c'));var _0x1da7a4=squel['select']()['field']('u.id')[_0x7d11('0x49')](_0x7d11('0x4d'))[_0x7d11('0x49')](_0x7d11('0x4e'))[_0x7d11('0x4b')](_0x7d11('0x4f'),'ui')[_0x7d11('0x50')](_0x7d11('0x51'),'u',_0x7d11('0x52'));var _0x347567=squel[_0x7d11('0x48')]()[_0x7d11('0x4b')]('mail_interactions','i')[_0x7d11('0x50')](_0x7d11('0x53'),'c',_0x7d11('0x54'))['left_join']('users','o',_0x7d11('0x55'))[_0x7d11('0x50')](_0x7d11('0x56'),'a','a.id\x20=\x20i.MailAccountId')['left_join'](_0x7d11('0x57'),'me',_0x7d11('0x58'))['left_join'](_0x7d11('0x59'),'it',_0x7d11('0x5a'))[_0x7d11('0x50')](_0x7d11('0x4c'),'t','t.id\x20=\x20it.TagId');var _0x46e721=squel[_0x7d11('0x5b')]();var _0x4203df=[];var _0x503cef=squel['expr']();var _0x35dd29;if(_0x4f8fd2[_0x7d11('0x3f')][_0x7d11('0x5c')]){_0x35dd29=as[_0x7d11('0x5d')](_0x4f8fd2[_0x7d11('0x3f')]['search']);var _0x46a8e1=_0x35dd29[_0x7d11('0x5e')];for(var _0x2f5d5a=0x0;_0x2f5d5a<_0x35dd29[_0x7d11('0x5f')]['length'];_0x2f5d5a++){var _0x4f1ea3=_0x35dd29[_0x7d11('0x5f')][_0x2f5d5a];var _0x1958a8='i';var _0x44928d=_[_0x7d11('0x60')](_0x597071,[_0x7d11('0x24'),_0x4f1ea3[_0x7d11('0x49')]]);if(!_0x44928d){switch(_0x4f1ea3[_0x7d11('0x49')]){case _0x7d11('0x61'):if(_0x4f1ea3[_0x7d11('0x62')]==0x1){_0x347567[_0x7d11('0x63')]('`'+_0x4f1ea3['field']+'`\x20=\x200');}else{_0x347567['having']('`'+_0x4f1ea3[_0x7d11('0x49')]+_0x7d11('0x64'));}break;case _0x7d11('0x65'):if(_0x4f1ea3['operator']===_0x7d11('0x66')){if(_0x4f1ea3[_0x7d11('0x62')][_0x7d11('0x67')]('\x20')[_0x7d11('0x45')]>0x1){_0x46e721[_0x46a8e1](_0x7d11('0x68'),qs[_0x7d11('0x69')](_0x4f1ea3['value']),null);}else{var _0xef9bbc='%'+_0x4f1ea3[_0x7d11('0x62')]+'%';_0x46e721[_0x46a8e1](_0x7d11('0x6a'),_0xef9bbc,_0xef9bbc,_0xef9bbc);}}else{_0x44928d=_['find'](_0x597071,['name','ContactId']);_0x4f1ea3['field']=_0x7d11('0x6b');_0xc8402c=as['buildExpression'](_0x1958a8,_0x44928d['type'],_0x4f1ea3);_0x46e721[_0x46a8e1](_0xc8402c['text'],_0xc8402c[_0x7d11('0x62')][_0x7d11('0x6c')],_0xc8402c[_0x7d11('0x62')][_0x7d11('0x16')]);}break;case _0x7d11('0x6d'):var _0x36ba80=_0x4f1ea3['value'][_0x7d11('0x67')](',')['map'](function(_0x34aab4){return Number(_0x34aab4);});_0x36ba80['forEach'](function(_0x14c336){_0x503cef['or'](_0x7d11('0x6e'),'%,'+_0x14c336+',%');});_0x4203df=_['union'](_0x4203df,_0x36ba80);break;case _0x7d11('0x6f'):if(_0x4f1ea3[_0x7d11('0x70')]===_0x7d11('0x66')){_0x46e721[_0x46a8e1](_0x7d11('0x71'),'%'+_0x4f1ea3['value']+'%',null);}else{_0x44928d=_['find'](_0x597071,[_0x7d11('0x24'),_0x7d11('0x33')]);_0x4f1ea3[_0x7d11('0x49')]=_0x7d11('0x33');_0xc8402c=as[_0x7d11('0x72')](_0x1958a8,_0x44928d['type'],_0x4f1ea3);_0x46e721[_0x46a8e1](_0xc8402c[_0x7d11('0x73')],_0xc8402c['value'][_0x7d11('0x6c')],_0xc8402c[_0x7d11('0x62')][_0x7d11('0x16')]);}break;case _0x7d11('0x30'):_0xc8402c=as['buildExpression']('me',null,_0x4f1ea3);_0x46e721[_0x46a8e1](_0xc8402c[_0x7d11('0x73')],_0xc8402c['value'][_0x7d11('0x6c')],_0xc8402c[_0x7d11('0x62')][_0x7d11('0x16')]);break;}}else{var _0xc8402c=as[_0x7d11('0x72')](_0x1958a8,_0x44928d[_0x7d11('0x3c')],_0x4f1ea3);_0x46e721[_0x46a8e1](_0xc8402c[_0x7d11('0x73')],_0xc8402c[_0x7d11('0x62')][_0x7d11('0x6c')],_0xc8402c[_0x7d11('0x62')][_0x7d11('0x16')]);}}}else{var _0x850e26=_(_0x4f8fd2[_0x7d11('0x3f')])[_0x7d11('0x40')]()['map'](function(_0x36895a){return _['some'](_0x597071,[_0x7d11('0x24'),_0x36895a])?_0x36895a:undefined;})['compact']()[_0x7d11('0x62')]();if(!_[_0x7d11('0x74')](_0x850e26)){_0x850e26[_0x7d11('0x29')](function(_0x1d54f7){if(_0x1d54f7==='MailAccountId'){_0x347567['where'](_0x7d11('0x75'),[][_0x7d11('0x76')](_0x4f8fd2[_0x7d11('0x3f')][_0x1d54f7]));}else if(_0x1d54f7==='createdAt'){var _0x2e552c=JSON[_0x7d11('0x77')](_0x4f8fd2[_0x7d11('0x3f')][_0x1d54f7])[_0x7d11('0x78')];var _0x328a36=JSON[_0x7d11('0x77')](_0x4f8fd2['query'][_0x1d54f7])[_0x7d11('0x79')];_0x347567['where'](_0x7d11('0x7a'),_0x2e552c,_0x328a36);}else{if(_0x4f8fd2['query'][_0x1d54f7]==='null'){_0x347567[_0x7d11('0x7b')]('i.'+_0x1d54f7+_0x7d11('0x7c'));}else{_0x347567[_0x7d11('0x7b')]('i.'+_0x1d54f7+_0x7d11('0x7d'),_0x4f8fd2[_0x7d11('0x3f')][_0x1d54f7]);}}});}if(_0x4f8fd2[_0x7d11('0x3f')][_0x7d11('0x7e')]){if(_0x4f8fd2[_0x7d11('0x3f')][_0x7d11('0x7e')]==0x1){_0x347567[_0x7d11('0x63')](_0x7d11('0x7f'));}else{_0x347567['having'](_0x7d11('0x80'));}}if(_0x4f8fd2['query'][_0x7d11('0x81')]){_0x4203df=_[_0x7d11('0x82')](_0x4f8fd2[_0x7d11('0x3f')][_0x7d11('0x81')])?_0x4f8fd2[_0x7d11('0x3f')][_0x7d11('0x81')]:new Array(_0x4f8fd2[_0x7d11('0x3f')]['tag']);_0x4203df['forEach'](function(_0x325665){_0x503cef['or'](_0x7d11('0x6e'),'%,'+_0x325665+',%');});}if(_0x4f8fd2[_0x7d11('0x3f')][_0x7d11('0x83')]){var _0x7edc36=_0x4f8fd2['query'][_0x7d11('0x83')]['replace']('\x5c','\x5c\x5c')[_0x7d11('0x84')](/'/g,'\x27\x27');if(qs[_0x7d11('0x85')](_0x7edc36)){_0x46e721['or'](_0x7d11('0x86'),_0x7edc36+'%');}else if(qs[_0x7d11('0x87')](_0x7edc36)){_0x46e721['or'](_0x7d11('0x88'),_0x7edc36+'%');}else{_0x46e721['or'](_0x7d11('0x89'),qs[_0x7d11('0x69')](_0x7edc36))['or'](_0x7d11('0x8a'),qs['getFullTextValue'](_0x7edc36));}}}_0x347567['where'](_0x46e721);_0x347567[_0x7d11('0x8b')](_0x7d11('0x8c'));var _0x195e2a={'type':db['Sequelize']['QueryTypes'][_0x7d11('0x8d')],'raw':!![]};var _0x5d0f47=_0x347567[_0x7d11('0x8e')]();_0x5d0f47[_0x7d11('0x49')](_0x7d11('0x8c'));_0x5d0f47[_0x7d11('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7d11('0x61'));if(_0x1eb372[_0x7d11('0x8f')]){_0x1eb372[_0x7d11('0x8f')][_0x7d11('0x29')](function(_0x3a693e){var _0xb9099d=_0x3a693e[0x0]===_0x7d11('0x90')?_0x3a693e[0x0]:'i.'+_0x3a693e[0x0];_0x347567[_0x7d11('0x8f')](_0xb9099d,_0x3a693e[0x1]==='DESC'?![]:!![]);});}if(!_[_0x7d11('0x74')](_0x4203df)){_0x347567[_0x7d11('0x63')](_0x503cef);_0x5d0f47[_0x7d11('0x7b')](_0x7d11('0x91'),_0x4203df);}BPromise[_0x7d11('0x92')]()['then'](function(){if(!_0x35dd29){if(_0x4f8fd2[_0x7d11('0x3f')][_0x7d11('0x93')])return;_0x5d0f47[_0x7d11('0x7b')](_0x7d11('0x94'));_0x347567[_0x7d11('0x7b')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4f8fd2['user']['role']!==_0x7d11('0x95'))return;return _0x4f8fd2['user'][_0x7d11('0x96')]({'attributes':['id'],'raw':!![]})['then'](function(_0x51824d){if(_[_0x7d11('0x74')](_0x51824d)){_0x5d0f47[_0x7d11('0x7b')](_0x7d11('0x97'));_0x347567[_0x7d11('0x7b')](_0x7d11('0x97'));}else{_0x5d0f47[_0x7d11('0x7b')](_0x7d11('0x75'),_[_0x7d11('0x39')](_0x51824d,'id'));_0x347567[_0x7d11('0x7b')](_0x7d11('0x75'),_['map'](_0x51824d,'id'));}});})[_0x7d11('0x20')](function(){if(_0x4f8fd2[_0x7d11('0x98')]['role']===_0x7d11('0x95')&&!_0x35dd29&&!_0x4f8fd2[_0x7d11('0x3f')][_0x7d11('0x93')])return[];return db[_0x7d11('0x99')]['query'](_0x5d0f47['toString'](),_0x195e2a);})[_0x7d11('0x20')](function(_0x55b723){_0xa900fc[_0x7d11('0x1b')]=_0x55b723[_0x7d11('0x45')];if(_0xa900fc[_0x7d11('0x1b')]===0x0)return[];return db[_0x7d11('0x99')][_0x7d11('0x3f')](_0x4972e7[_0x7d11('0x9a')](),_0x195e2a)[_0x7d11('0x20')](function(_0x596228){_0x38de7f=_[_0x7d11('0x9b')](_0x596228,'id');_0x195e2a=_[_0x7d11('0x9c')](_0x195e2a,{'model':db[_0x7d11('0x9d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4f8fd2[_0x7d11('0x3f')]['fields']){_0x1eb372[_0x7d11('0x43')][_0x7d11('0x29')](function(_0x498714){_0x347567[_0x7d11('0x49')]('i.'+_0x498714);});}else{_0x347567[_0x7d11('0x49')](_0x7d11('0x9e'),'unreadMessages');_0x347567[_0x7d11('0x49')](_0x7d11('0x9f'),'Account.key');_0x347567[_0x7d11('0x49')](_0x7d11('0xa0'),'Account.mandatoryDisposition');_0x347567[_0x7d11('0x49')]('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','contactName');_0x347567['field']('i.id');_0x347567[_0x7d11('0x49')](_0x7d11('0xa1'));_0x347567[_0x7d11('0x49')](_0x7d11('0xa2'));_0x347567[_0x7d11('0x49')](_0x7d11('0xa3'));_0x347567[_0x7d11('0x49')](_0x7d11('0xa4'));_0x347567[_0x7d11('0x49')](_0x7d11('0xa5'));_0x347567['field']('i.lastMsgAt');_0x347567[_0x7d11('0x49')](_0x7d11('0xa6'));_0x347567['field']('i.subject');_0x347567[_0x7d11('0x49')](_0x7d11('0xa7'));_0x347567[_0x7d11('0x49')](_0x7d11('0xa8'));_0x347567['field']('i.thirdDisposition');_0x347567['field'](_0x7d11('0xa9'));_0x347567[_0x7d11('0x49')](_0x7d11('0xaa'));_0x347567['field'](_0x7d11('0xab'));_0x347567[_0x7d11('0x49')]('i.MailAccountId');_0x347567[_0x7d11('0x49')](_0x7d11('0xac'));_0x347567['field']('c.firstName',_0x7d11('0xad'));_0x347567[_0x7d11('0x49')]('c.lastName','Contact.lastName');_0x347567[_0x7d11('0x49')](_0x7d11('0xae'),_0x7d11('0xaf'));_0x347567[_0x7d11('0x49')]('c.phone',_0x7d11('0xb0'));_0x347567[_0x7d11('0x49')](_0x7d11('0xb1'),_0x7d11('0xb2'));_0x347567['field'](_0x7d11('0xb3'),_0x7d11('0xb4'));_0x347567[_0x7d11('0x49')]('o.fullname',_0x7d11('0xb5'));_0x347567['field'](_0x7d11('0xb6'),'Owner.internal');_0x347567[_0x7d11('0x49')](_0x7d11('0xb7'),_0x7d11('0x27'));}if(_0x1eb372[_0x7d11('0x1a')])_0x347567[_0x7d11('0x1a')](_0x1eb372[_0x7d11('0x1a')]);if(_0x1eb372['offset'])_0x347567['offset'](_0x1eb372[_0x7d11('0x18')]);return db[_0x7d11('0x99')][_0x7d11('0x3f')](_0x347567[_0x7d11('0x9a')](),_0x195e2a);})['then'](function(_0x410a54){if(_0x410a54[_0x7d11('0x45')]>0x0)_0x1da7a4[_0x7d11('0x7b')](_0x7d11('0xb8'),_['map'](_0x410a54,'id'));return db[_0x7d11('0x99')][_0x7d11('0x3f')](_0x1da7a4[_0x7d11('0x9a')](),_0x195e2a)[_0x7d11('0x20')](function(_0x2e97e){var _0x21e965=_['groupBy'](_0x2e97e,_0x7d11('0xb9'));var _0x4e67bc=[];return db[_0x7d11('0xba')]['findOne']({'attributes':[_0x7d11('0xbb')],'raw':!![]})[_0x7d11('0x20')](function(_0x42755e){var _0x45f67f=_0x42755e[_0x7d11('0xbb')];_0x410a54[_0x7d11('0x29')](function(_0x444b65){_0x4e67bc[_0x7d11('0x2a')](updateMailInteraction(_0x444b65,_0x38de7f,_0x21e965,_0x45f67f));});return BPromise[_0x7d11('0xbc')](_0x4e67bc);});});});})[_0x7d11('0x20')](function(_0x4d1483){_0xa900fc[_0x7d11('0xbd')]=_0x4d1483;return _0xa900fc;})['then'](respondWithFilteredResult(_0xd36cd3,_0x1eb372))[_0x7d11('0xbe')](handleError(_0xd36cd3,null));};exports[_0x7d11('0xbf')]=function(_0x34267a,_0x4367a5){var _0x19c0dd={'raw':![],'where':{'id':_0x34267a['params']['id']}},_0x596685={};_0x596685[_0x7d11('0x3e')]=_[_0x7d11('0x40')](db['MailInteraction'][_0x7d11('0x3a')]);_0x596685[_0x7d11('0x3f')]=_[_0x7d11('0x40')](_0x34267a[_0x7d11('0x3f')]);_0x596685[_0x7d11('0x41')]=_['intersection'](_0x596685['model'],_0x596685['query']);_0x19c0dd['attributes']=_[_0x7d11('0x42')](_0x596685[_0x7d11('0x3e')],qs['fields'](_0x34267a[_0x7d11('0x3f')][_0x7d11('0x44')]));_0x19c0dd[_0x7d11('0x43')]=_0x19c0dd[_0x7d11('0x43')][_0x7d11('0x45')]?_0x19c0dd[_0x7d11('0x43')]:_0x596685[_0x7d11('0x3e')];if(_0x34267a[_0x7d11('0x3f')]['includeAll']){_0x19c0dd[_0x7d11('0xc0')]=[{'all':!![]}];}_0x19c0dd=_[_0x7d11('0x9c')]({},_0x19c0dd,_0x34267a['options']);return db[_0x7d11('0x9d')][_0x7d11('0x60')](_0x19c0dd)[_0x7d11('0x20')](handleEntityNotFound(_0x4367a5,null))[_0x7d11('0x20')](respondWithResult(_0x4367a5,null))[_0x7d11('0xbe')](handleError(_0x4367a5,null));};exports[_0x7d11('0xc1')]=function(_0x1b8ad6,_0x3d3d61){return db[_0x7d11('0x9d')][_0x7d11('0xc1')](_0x1b8ad6[_0x7d11('0xc2')],{})[_0x7d11('0x20')](respondWithResult(_0x3d3d61,0xc9))['catch'](handleError(_0x3d3d61,null));};exports['update']=function(_0x3b838e,_0x5edf87){if(_0x3b838e[_0x7d11('0xc2')]['id']){delete _0x3b838e['body']['id'];}return db[_0x7d11('0x9d')]['find']({'where':{'id':_0x3b838e[_0x7d11('0xc3')]['id']}})[_0x7d11('0x20')](handleEntityNotFound(_0x5edf87,null))[_0x7d11('0x20')](saveUpdates(_0x3b838e[_0x7d11('0xc2')],null))[_0x7d11('0x20')](respondWithResult(_0x5edf87,null))[_0x7d11('0xbe')](handleError(_0x5edf87,null));};exports[_0x7d11('0x1f')]=function(_0x2995a0,_0x10cf33){return db[_0x7d11('0x9d')][_0x7d11('0x60')]({'where':{'id':_0x2995a0[_0x7d11('0xc3')]['id']}})[_0x7d11('0x20')](handleEntityNotFound(_0x10cf33,null))[_0x7d11('0x20')](removeEntity(_0x10cf33,null))[_0x7d11('0xbe')](handleError(_0x10cf33,null));};exports[_0x7d11('0xc4')]=function(_0x185bba,_0xc7288b){return db['MailInteraction']['describe']()[_0x7d11('0x20')](respondWithResult(_0xc7288b,null))[_0x7d11('0xbe')](handleError(_0xc7288b,null));};exports[_0x7d11('0xc5')]=function(_0xd0d642,_0xf8724){return db['MailMessage'][_0x7d11('0x60')]({'where':{'id':_0xd0d642['params']['id']}})['then'](handleEntityNotFound(_0xf8724,null))['then'](function(_0x591d98){if(_0x591d98){return _0x591d98[_0x7d11('0xc5')](_0xd0d642[_0x7d11('0xc2')][_0x7d11('0xc6')],_[_0x7d11('0xc7')](_0xd0d642[_0x7d11('0xc2')],[_0x7d11('0xc6'),'id'])||{});}})[_0x7d11('0x20')](respondWithResult(_0xf8724,null))[_0x7d11('0xbe')](handleError(_0xf8724,null));};exports[_0x7d11('0xc8')]=function(_0x1570be,_0x4135f7){var _0x109184={'raw':![],'where':{}};var _0x4575d0={};var _0x57c8d6={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x1570be['params']['id']}})['then'](handleEntityNotFound(_0x4135f7,null))[_0x7d11('0x20')](function(_0x34d168){if(_0x34d168){_0x4575d0[_0x7d11('0x3e')]=_[_0x7d11('0x40')](db[_0x7d11('0x2b')][_0x7d11('0x3a')]);_0x4575d0[_0x7d11('0x3f')]=_[_0x7d11('0x40')](_0x1570be[_0x7d11('0x3f')]);_0x4575d0[_0x7d11('0x41')]=_['intersection'](_0x4575d0[_0x7d11('0x3e')],_0x4575d0[_0x7d11('0x3f')]);_0x109184[_0x7d11('0x43')]=_[_0x7d11('0x42')](_0x4575d0[_0x7d11('0x3e')],qs[_0x7d11('0x44')](_0x1570be['query'][_0x7d11('0x44')]));_0x109184[_0x7d11('0x43')]=_0x109184[_0x7d11('0x43')][_0x7d11('0x45')]?_0x109184['attributes']:_0x4575d0[_0x7d11('0x3e')];if(!_0x1570be[_0x7d11('0x3f')]['hasOwnProperty'](_0x7d11('0xc9'))){_0x109184[_0x7d11('0x1a')]=qs[_0x7d11('0x1a')](_0x1570be['query'][_0x7d11('0x1a')]);_0x109184[_0x7d11('0x18')]=qs['offset'](_0x1570be[_0x7d11('0x3f')][_0x7d11('0x18')]);}_0x109184[_0x7d11('0x8f')]=qs[_0x7d11('0x46')](_0x1570be['query']['sort']);_0x109184[_0x7d11('0x7b')]=qs[_0x7d11('0x41')](_[_0x7d11('0x47')](_0x1570be[_0x7d11('0x3f')],_0x4575d0[_0x7d11('0x41')]));_0x109184['where'][_0x7d11('0xb9')]=_0x34d168['id'];if(_0x1570be[_0x7d11('0x3f')][_0x7d11('0x83')]){_0x109184[_0x7d11('0x7b')]=_['merge'](_0x109184[_0x7d11('0x7b')],{'$or':_[_0x7d11('0x39')](_0x109184[_0x7d11('0x43')],function(_0x5504fe){var _0x288282={};_0x288282[_0x5504fe]={'$like':'%'+_0x1570be[_0x7d11('0x3f')][_0x7d11('0x83')]+'%'};return _0x288282;})});}if(_0x1570be['query'][_0x7d11('0x78')]){var _0x1fa62c=_0x1570be[_0x7d11('0x3f')][_0x7d11('0x78')][_0x7d11('0x67')](',');var _0x3950ad={};_0x3950ad[_0x1fa62c[0x0]]={'$gte':moment(_0x1fa62c[0x1])[_0x7d11('0xca')]('YYYY-MM-DD\x20HH:mm:ss')};_0x109184[_0x7d11('0x7b')]=_['merge'](_0x109184[_0x7d11('0x7b')],_0x3950ad);}_0x109184=_[_0x7d11('0x9c')]({},_0x109184,_0x1570be[_0x7d11('0xcb')]);return db[_0x7d11('0x2b')]['count']({'where':_0x109184[_0x7d11('0x7b')]})['then'](function(_0x56203e){_0x57c8d6[_0x7d11('0x1b')]=_0x56203e;if(_0x1570be[_0x7d11('0x3f')]['includeAll']){_0x109184[_0x7d11('0xc0')]=[{'all':!![]}];}return db['MailMessage'][_0x7d11('0xcc')](_0x109184);})['then'](function(_0x5375fa){if(_0x1570be[_0x7d11('0x3f')]['inlineCss']===_0x7d11('0xcd')){for(var _0x7ba4ae=0x0;_0x7ba4ae<_0x5375fa['length'];_0x7ba4ae++){_0x5375fa[_0x7ba4ae][_0x7d11('0xc2')]=juice(_0x5375fa[_0x7ba4ae]['body']);}}_0x57c8d6['rows']=_0x5375fa;return _0x57c8d6;});}})[_0x7d11('0x20')](respondWithFilteredResult(_0x4135f7,_0x109184))['catch'](handleError(_0x4135f7,null));};exports['addTags']=function(_0x5db7ef,_0x15be30){return db[_0x7d11('0x9d')][_0x7d11('0x60')]({'where':{'id':_0x5db7ef[_0x7d11('0xc3')]['id']}})[_0x7d11('0x20')](handleEntityNotFound(_0x15be30,null))['then'](function(_0x46e678){if(_0x46e678){return _0x46e678[_0x7d11('0xce')](_0x5db7ef[_0x7d11('0xc2')][_0x7d11('0xc6')],_[_0x7d11('0xc7')](_0x5db7ef[_0x7d11('0xc2')],['ids','id'])||{})[_0x7d11('0xcf')](function(){return db[_0x7d11('0x6d')][_0x7d11('0xcc')]({'attributes':['id',_0x7d11('0x24'),_0x7d11('0x4a')],'where':{'id':_0x5db7ef[_0x7d11('0xc2')]['ids']}});})[_0x7d11('0x20')](function(_0x5f9a9f){socket[_0x7d11('0xd0')]('mailInteractionTags:save',{'id':Number(_0x5db7ef[_0x7d11('0xc3')]['id']),'tags':_0x5f9a9f||[]});return{'id':Number(_0x5db7ef[_0x7d11('0xc3')]['id']),'tags':_0x5f9a9f||[]};});}})[_0x7d11('0x20')](respondWithResult(_0x15be30,null))['catch'](handleError(_0x15be30,null));};exports[_0x7d11('0xd1')]=function(_0x150fea,_0x945c35){return db[_0x7d11('0x9d')][_0x7d11('0x60')]({'where':{'id':_0x150fea['params']['id']}})[_0x7d11('0x20')](handleEntityNotFound(_0x945c35,null))[_0x7d11('0x20')](function(_0x2f835a){if(_0x2f835a){return _0x2f835a[_0x7d11('0xd1')](_0x150fea[_0x7d11('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x945c35,null))[_0x7d11('0xbe')](handleError(_0x945c35,null));};exports[_0x7d11('0xd2')]=function(_0xcf9cdb,_0x409fac){var _0x388028=moment()[_0x7d11('0xd3')]()[_0x7d11('0x9a')]();var _0x14f0f1=path[_0x7d11('0xd4')](config[_0x7d11('0xd5')],_0x7d11('0xd6'),_0x7d11('0xd7'),'tmp');var _0x55cca6=path['join'](config[_0x7d11('0xd5')],_0x7d11('0xd6'),_0x7d11('0xd7'),_0x7d11('0xd8'));var _0x332a08=path[_0x7d11('0xd4')](_0x14f0f1,_0x388028);var _0x135931=util[_0x7d11('0xca')](_0x7d11('0xd9'),_0xcf9cdb['params']['id'],_0x388028);var _0x29e378=path[_0x7d11('0xd4')](_0x14f0f1,_0x135931);var _0x1e1da3=[];if(_0xcf9cdb['query'][_0x7d11('0xd8')]){_0x1e1da3[_0x7d11('0x2a')]({'model':db[_0x7d11('0xda')],'as':_0x7d11('0xdb'),'raw':!![]});}var _0x39c200=[{'model':db[_0x7d11('0x2b')],'as':'Messages','attributes':['id',_0x7d11('0xc2'),'from','to','cc',_0x7d11('0xdc'),_0x7d11('0xdd'),_0x7d11('0xde')],'where':{'secret':![]},'order':qs[_0x7d11('0x46')]('id'),'include':_0x1e1da3}];return db[_0x7d11('0x9d')]['find']({'where':{'id':_0xcf9cdb['params']['id']},'include':_0x39c200})['then'](handleEntityNotFound(_0x409fac,null))[_0x7d11('0x20')](function(_0x152cf9){if(_0x152cf9&&_0x152cf9[_0x7d11('0xdf')]){var _0x24cc17=_0x152cf9[_0x7d11('0xe0')]({'plain':!![]});fs['mkdirSync'](_0x332a08);return BPromise[_0x7d11('0xe1')](_0x24cc17[_0x7d11('0xdf')],function(_0x51a9f9,_0x29634c){var _0x384fce={'from':_0x51a9f9[_0x7d11('0x4b')],'to':_0x51a9f9['to'],'subject':_0x51a9f9[_0x7d11('0xdd')],'html':htmlEntities['decode'](_0x51a9f9['body']),'headers':{'Date':moment(_0x51a9f9[_0x7d11('0xde')])['format'](_0x7d11('0xe2'))},'attachments':[]};if(_0x51a9f9['cc']){_0x384fce['headers']['Cc']=_0x51a9f9['cc'];}if(_0x51a9f9[_0x7d11('0xdc')]){_0x384fce[_0x7d11('0xe3')][_0x7d11('0xe4')]=_0x51a9f9[_0x7d11('0xdc')];}return new BPromise(function(_0x3ed539,_0x24f7b9){if(_0x51a9f9['Attachments']){for(var _0x276a40=0x0;_0x276a40<_0x51a9f9[_0x7d11('0xdb')][_0x7d11('0x45')];_0x276a40++){var _0x5e8237=_0x51a9f9[_0x7d11('0xdb')][_0x276a40];var _0x412016=path[_0x7d11('0xd4')](_0x55cca6,_0x5e8237['basename']);if(fs[_0x7d11('0xe5')](_0x412016)){_0x384fce[_0x7d11('0xd8')][_0x7d11('0x2a')]({'name':_0x5e8237['name'],'contentType':_0x5e8237[_0x7d11('0x3c')],'data':fs[_0x7d11('0xe6')](_0x412016)});}}}emlformat[_0x7d11('0xe7')](_0x384fce,function(_0x23867c,_0x270c17){if(_0x23867c)return _0x24f7b9(_0x23867c);fs[_0x7d11('0xe8')](path[_0x7d11('0xd4')](_0x332a08,util[_0x7d11('0xca')](_0x7d11('0xe9'),_0x29634c)),_0x270c17);return _0x3ed539(_0x270c17);});});})[_0x7d11('0x20')](function(){return new BPromise(function(_0x325fdc,_0x5cd96b){zipdir(_0x332a08,{'saveTo':_0x29e378},function(_0x1e4588,_0x15d350){if(_0x1e4588)return _0x5cd96b(_0x1e4588);return _0x325fdc(_0x15d350);});})[_0x7d11('0x20')](function(){return new BPromise(function(_0x4e5409,_0x12b307){rimraf(_0x332a08,function(_0x3f2372){if(_0x3f2372)_0x12b307(_0x3f2372);return _0x4e5409();});});})[_0x7d11('0x20')](function(){return _0x409fac[_0x7d11('0xd2')](_0x29e378,_0x135931,function(_0x4cb3e5){if(!_0x4cb3e5)fs[_0x7d11('0xea')](_0x29e378);});});});}else{return _0x409fac[_0x7d11('0x21')](0xc8);}})[_0x7d11('0xbe')](handleError(_0x409fac,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index d6d8201..3e6109c 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 _0xbdf6=['exports','events','../../mysqldb','MailInteraction','MailMessage','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xbdf6,0x17d));var _0x6bdf=function(_0x264c8b,_0x4335c6){_0x264c8b=_0x264c8b-0x0;var _0x23942c=_0xbdf6[_0x264c8b];return _0x23942c;};'use strict';var EventEmitter=require(_0x6bdf('0x0'));var MailInteraction=require(_0x6bdf('0x1'))['db'][_0x6bdf('0x2')];var MailMessage=require(_0x6bdf('0x1'))['db'][_0x6bdf('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6bdf('0x4'),'afterUpdate':_0x6bdf('0x5'),'afterDestroy':_0x6bdf('0x6')};function emitEvent(_0x15e17e){return function(_0x10736e,_0x16cb7c,_0x58bd9a){_0x10736e[_0x6bdf('0x7')]({'attributes':['id'],'raw':!![]})[_0x6bdf('0x8')](function(_0x541d55){_0x10736e[_0x6bdf('0x9')](_0x6bdf('0xa'),_0x541d55[_0x6bdf('0xb')](function(_0x37680a){return{'id':_0x37680a['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x10736e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1b028a){_0x10736e['setDataValue'](_0x6bdf('0xc'),_0x1b028a[_0x6bdf('0xd')]);MailInteractionEvents[_0x6bdf('0xe')](_0x15e17e+':'+_0x10736e['id'],_0x10736e);MailInteractionEvents[_0x6bdf('0xe')](_0x15e17e,_0x10736e);_0x58bd9a(null);})[_0x6bdf('0xf')](_0x58bd9a(null));};}for(var e in events){if(events[_0x6bdf('0x10')](e)){var event=events[e];MailInteraction[_0x6bdf('0x11')](e,emitEvent(event));}}module[_0x6bdf('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0x16fc=['map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x16fc,0xbc));var _0xc16f=function(_0x533caa,_0x5e55cf){_0x533caa=_0x533caa-0x0;var _0x545800=_0x16fc[_0x533caa];return _0x545800;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0xc16f('0x0')];var MailMessage=require(_0xc16f('0x1'))['db'][_0xc16f('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xc16f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc16f('0x4'),'afterDestroy':_0xc16f('0x5')};function emitEvent(_0x423b45){return function(_0x4154ee,_0x303ab2,_0x1941b3){_0x4154ee[_0xc16f('0x6')]({'attributes':['id'],'raw':!![]})[_0xc16f('0x7')](function(_0x48ff34){_0x4154ee[_0xc16f('0x8')](_0xc16f('0x9'),_0x48ff34[_0xc16f('0xa')](function(_0x3ea587){return{'id':_0x3ea587['id']};}));return MailMessage[_0xc16f('0xb')]({'where':{'MailInteractionId':_0x4154ee['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x48c1fd){_0x4154ee[_0xc16f('0x8')](_0xc16f('0xc'),_0x48c1fd[_0xc16f('0xd')]);MailInteractionEvents[_0xc16f('0xe')](_0x423b45+':'+_0x4154ee['id'],_0x4154ee);MailInteractionEvents[_0xc16f('0xe')](_0x423b45,_0x4154ee);_0x1941b3(null);})['catch'](_0x1941b3(null));};}for(var e in events){if(events[_0xc16f('0xf')](e)){var event=events[e];MailInteraction[_0xc16f('0x10')](e,emitEvent(event));}}module[_0xc16f('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 8b7fee7..97fdd2f 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 _0x5e00=['util','../../config/logger','moment','request-promise','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','get','MailMessage','update','then','catch','utf8mb4','lodash'];(function(_0x4e04aa,_0xff9c1f){var _0x18834f=function(_0x3641fc){while(--_0x3641fc){_0x4e04aa['push'](_0x4e04aa['shift']());}};_0x18834f(++_0xff9c1f);}(_0x5e00,0x176));var _0x05e0=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5e00[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x05e0('0x0'));var util=require(_0x05e0('0x1'));var logger=require(_0x05e0('0x2'))('api');var moment=require(_0x05e0('0x3'));var BPromise=require('bluebird');var rp=require(_0x05e0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x05e0('0x5'));var attributes=require(_0x05e0('0x6'));module[_0x05e0('0x7')]=function(_0x2b5fb4,_0x4f9c1f){return _0x2b5fb4['define'](_0x05e0('0x8'),attributes,{'tableName':_0x05e0('0x9'),'paranoid':![],'indexes':[{'name':_0x05e0('0xa'),'fields':[_0x05e0('0xb'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1162c9,_0x3ed6b2,_0xdeba11){if(_0x1162c9[_0x05e0('0xc')]){_0x1162c9[_0x05e0('0xd')]=moment()[_0x05e0('0xe')](_0x05e0('0xf'));}if(_0x1162c9[_0x05e0('0x10')]){_0x1162c9[_0x05e0('0x11')]=moment()[_0x05e0('0xe')](_0x05e0('0xf'));}_0xdeba11(null,_0x3ed6b2);},'beforeUpdate':function(_0x202b7f,_0x215ebd,_0x85008e){if(_0x202b7f[_0x05e0('0x12')](_0x05e0('0xc'))){_0x202b7f[_0x05e0('0xd')]=_0x202b7f[_0x05e0('0xc')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x202b7f[_0x05e0('0x12')](_0x05e0('0x10'))){_0x202b7f[_0x05e0('0x11')]=moment()[_0x05e0('0xe')](_0x05e0('0xf'));_0x202b7f[_0x05e0('0xc')]=null;_0x202b7f['substatusAt']=null;}_0x85008e(null,_0x202b7f);},'afterUpdate':function(_0x416361,_0x21538e,_0x254b8c){var _0x11f076=_0x2b5fb4['models'];var _0x3fdbc9=_0x416361[_0x05e0('0x13')]({'plain':!![]});if(_0x3fdbc9[_0x05e0('0x10')]){return _0x11f076[_0x05e0('0x14')][_0x05e0('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x3fdbc9['id']}})[_0x05e0('0x16')](function(){_0x254b8c();})[_0x05e0('0x17')](function(_0x7ce7a4){_0x254b8c(_0x7ce7a4);});}else{_0x254b8c();}}},'charset':_0x05e0('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7ace=['MailInteraction','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define'];(function(_0x4b2ef8,_0x1b3f56){var _0x10a8eb=function(_0x231e53){while(--_0x231e53){_0x4b2ef8['push'](_0x4b2ef8['shift']());}};_0x10a8eb(++_0x1b3f56);}(_0x7ace,0xa5));var _0xe7ac=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7ace[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xe7ac('0x0'));var util=require('util');var logger=require(_0xe7ac('0x1'))(_0xe7ac('0x2'));var moment=require(_0xe7ac('0x3'));var BPromise=require('bluebird');var rp=require(_0xe7ac('0x4'));var fs=require('fs');var path=require(_0xe7ac('0x5'));var rimraf=require(_0xe7ac('0x6'));var config=require(_0xe7ac('0x7'));var attributes=require(_0xe7ac('0x8'));module['exports']=function(_0xb8a54f,_0x4dd43a){return _0xb8a54f[_0xe7ac('0x9')](_0xe7ac('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2e7c7e,_0x17611e,_0x569034){if(_0x2e7c7e['substatus']){_0x2e7c7e[_0xe7ac('0xb')]=moment()[_0xe7ac('0xc')](_0xe7ac('0xd'));}if(_0x2e7c7e[_0xe7ac('0xe')]){_0x2e7c7e[_0xe7ac('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x569034(null,_0x17611e);},'beforeUpdate':function(_0x1179ea,_0x40dcea,_0x524418){if(_0x1179ea[_0xe7ac('0x10')](_0xe7ac('0x11'))){_0x1179ea[_0xe7ac('0xb')]=_0x1179ea[_0xe7ac('0x11')]?moment()['format'](_0xe7ac('0xd')):null;}if(_0x1179ea[_0xe7ac('0x10')]('closed')){_0x1179ea[_0xe7ac('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1179ea[_0xe7ac('0x11')]=null;_0x1179ea[_0xe7ac('0xb')]=null;}_0x524418(null,_0x1179ea);},'afterUpdate':function(_0x330a1e,_0x5189e3,_0x4a156e){var _0x2ad14a=_0xb8a54f['models'];var _0x1979b9=_0x330a1e[_0xe7ac('0x12')]({'plain':!![]});if(_0x1979b9['closed']){return _0x2ad14a[_0xe7ac('0x13')][_0xe7ac('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x1979b9['id']}})[_0xe7ac('0x15')](function(){_0x4a156e();})[_0xe7ac('0x16')](function(_0x440510){_0x4a156e(_0x440510);});}else{_0x4a156e();}}},'charset':_0xe7ac('0x17'),'collate':_0xe7ac('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 6fd50f9..3117cde 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 _0xcafb=['MailInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','update','body','options','raw','where','attributes','UpdateMailInteraction','stringify','AddTagsToMailInteraction','MailInteraction','find','then','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./mailInteraction.socket','register','request','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcafb,0x188));var _0xbcaf=function(_0x31839b,_0x18d5e3){_0x31839b=_0x31839b-0x0;var _0x560e75=_0xcafb[_0x31839b];return _0x560e75;};'use strict';var _=require('lodash');var util=require(_0xbcaf('0x0'));var moment=require(_0xbcaf('0x1'));var BPromise=require(_0xbcaf('0x2'));var rs=require(_0xbcaf('0x3'));var fs=require('fs');var Redis=require(_0xbcaf('0x4'));var db=require(_0xbcaf('0x5'))['db'];var utils=require(_0xbcaf('0x6'));var logger=require('../../config/logger')(_0xbcaf('0x7'));var config=require(_0xbcaf('0x8'));var jayson=require(_0xbcaf('0x9'));var client=jayson[_0xbcaf('0xa')][_0xbcaf('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xbcaf('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xbcaf('0xd'))(new Redis(config[_0xbcaf('0xc')]));require(_0xbcaf('0xe'))[_0xbcaf('0xf')](socket);function respondWithRpcPromise(_0x132c44,_0x24a276,_0x501283){return new BPromise(function(_0x191e8f,_0x43bd6c){return client[_0xbcaf('0x10')](_0x132c44,_0x501283)['then'](function(_0x411eab){logger[_0xbcaf('0x11')](_0xbcaf('0x12'),_0x24a276,_0xbcaf('0x13'));logger[_0xbcaf('0x14')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x24a276,_0xbcaf('0x13'),JSON['stringify'](_0x411eab));if(_0x411eab[_0xbcaf('0x15')]){if(_0x411eab['error']['code']===0x1f4){logger[_0xbcaf('0x15')](_0xbcaf('0x12'),_0x24a276,_0x411eab[_0xbcaf('0x15')]['message']);return _0x43bd6c(_0x411eab['error'][_0xbcaf('0x16')]);}logger[_0xbcaf('0x15')]('MailInteraction,\x20%s,\x20%s',_0x24a276,_0x411eab[_0xbcaf('0x15')]['message']);return _0x191e8f(_0x411eab['error'][_0xbcaf('0x16')]);}else{logger[_0xbcaf('0x11')](_0xbcaf('0x12'),_0x24a276,_0xbcaf('0x13'));_0x191e8f(_0x411eab[_0xbcaf('0x17')]['message']);}})[_0xbcaf('0x18')](function(_0x5acd08){logger[_0xbcaf('0x15')]('MailInteraction,\x20%s,\x20%s',_0x24a276,_0x5acd08);_0x43bd6c(_0x5acd08);});});}exports['UpdateMailInteraction']=function(_0x2bd274){var _0x45e820=this;return new Promise(function(_0x24ac25,_0x3772b3){return db['MailInteraction'][_0xbcaf('0x19')](_0x2bd274[_0xbcaf('0x1a')],{'raw':_0x2bd274[_0xbcaf('0x1b')]?_0x2bd274['options'][_0xbcaf('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bd274[_0xbcaf('0x1b')]?_0x2bd274[_0xbcaf('0x1b')][_0xbcaf('0x1d')]||null:null,'attributes':_0x2bd274[_0xbcaf('0x1b')]?_0x2bd274[_0xbcaf('0x1b')][_0xbcaf('0x1e')]||null:null,'limit':_0x2bd274[_0xbcaf('0x1b')]?_0x2bd274[_0xbcaf('0x1b')]['limit']||null:null})['then'](function(_0x41f397){logger[_0xbcaf('0x11')](_0xbcaf('0x1f'),_0x2bd274);logger[_0xbcaf('0x14')]('UpdateMailInteraction',_0x2bd274,JSON[_0xbcaf('0x20')](_0x41f397));_0x24ac25(_0x41f397);})[_0xbcaf('0x18')](function(_0x126bb1){logger[_0xbcaf('0x15')](_0xbcaf('0x1f'),_0x126bb1['message'],_0x2bd274);_0x3772b3(_0x45e820['error'](0x1f4,_0x126bb1[_0xbcaf('0x16')]));});});};exports[_0xbcaf('0x21')]=function(_0x1a8db4){return new Promise(function(_0x37b6fe,_0xefc6f5){return db[_0xbcaf('0x22')][_0xbcaf('0x23')]({'where':_0x1a8db4[_0xbcaf('0x1b')]?_0x1a8db4[_0xbcaf('0x1b')][_0xbcaf('0x1d')]||null:null})[_0xbcaf('0x24')](function(_0x169615){if(_0x169615){return _0x169615['addTags'](_0x1a8db4[_0xbcaf('0x1a')][_0xbcaf('0x25')],_[_0xbcaf('0x26')](_0x1a8db4[_0xbcaf('0x1a')],[_0xbcaf('0x25'),'id'])||{});}})[_0xbcaf('0x27')](function(_0x3dbc84){logger[_0xbcaf('0x11')](_0xbcaf('0x28'),_0x1a8db4);logger[_0xbcaf('0x14')](_0xbcaf('0x28'),_0x1a8db4,JSON[_0xbcaf('0x20')](_0x3dbc84));_0x37b6fe(_0x3dbc84);})[_0xbcaf('0x18')](function(_0x1afb11){logger[_0xbcaf('0x15')](_0xbcaf('0x28'),_0x1afb11[_0xbcaf('0x16')],_0x1a8db4);_0xefc6f5(_this[_0xbcaf('0x15')](0x1f4,_0x1afb11[_0xbcaf('0x16')]));});});}; \ No newline at end of file +var _0xe056=['options','raw','where','attributes','stringify','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','result','UpdateMailInteraction','MailInteraction','update','body'];(function(_0x27f2b9,_0x144e11){var _0x440385=function(_0x72436d){while(--_0x72436d){_0x27f2b9['push'](_0x27f2b9['shift']());}};_0x440385(++_0x144e11);}(_0xe056,0xab));var _0x6e05=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0xe056[_0x4c7935];return _0x30651d;};'use strict';var _=require(_0x6e05('0x0'));var util=require(_0x6e05('0x1'));var moment=require('moment');var BPromise=require(_0x6e05('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e05('0x3'));var db=require(_0x6e05('0x4'))['db'];var utils=require(_0x6e05('0x5'));var logger=require(_0x6e05('0x6'))('rpc');var config=require(_0x6e05('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6e05('0x8')][_0x6e05('0x9')]({'port':0x232a});config[_0x6e05('0xa')]=_['defaults'](config[_0x6e05('0xa')],{'host':_0x6e05('0xb'),'port':0x18eb});var socket=require(_0x6e05('0xc'))(new Redis(config[_0x6e05('0xa')]));require(_0x6e05('0xd'))['register'](socket);function respondWithRpcPromise(_0x409985,_0x49dc28,_0x43494a){return new BPromise(function(_0x3e4581,_0x5c4bb0){return client[_0x6e05('0xe')](_0x409985,_0x43494a)[_0x6e05('0xf')](function(_0x1028fe){logger[_0x6e05('0x10')]('MailInteraction,\x20%s,\x20%s',_0x49dc28,_0x6e05('0x11'));logger[_0x6e05('0x12')](_0x6e05('0x13'),_0x49dc28,_0x6e05('0x11'),JSON['stringify'](_0x1028fe));if(_0x1028fe[_0x6e05('0x14')]){if(_0x1028fe[_0x6e05('0x14')][_0x6e05('0x15')]===0x1f4){logger[_0x6e05('0x14')](_0x6e05('0x16'),_0x49dc28,_0x1028fe['error'][_0x6e05('0x17')]);return _0x5c4bb0(_0x1028fe[_0x6e05('0x14')][_0x6e05('0x17')]);}logger[_0x6e05('0x14')](_0x6e05('0x16'),_0x49dc28,_0x1028fe['error']['message']);return _0x3e4581(_0x1028fe['error']['message']);}else{logger[_0x6e05('0x10')](_0x6e05('0x16'),_0x49dc28,'request\x20sent');_0x3e4581(_0x1028fe[_0x6e05('0x18')][_0x6e05('0x17')]);}})['catch'](function(_0x592ddc){logger[_0x6e05('0x14')]('MailInteraction,\x20%s,\x20%s',_0x49dc28,_0x592ddc);_0x5c4bb0(_0x592ddc);});});}exports[_0x6e05('0x19')]=function(_0x5f432b){var _0x297ba9=this;return new Promise(function(_0x70338b,_0x3730f8){return db[_0x6e05('0x1a')][_0x6e05('0x1b')](_0x5f432b[_0x6e05('0x1c')],{'raw':_0x5f432b[_0x6e05('0x1d')]?_0x5f432b[_0x6e05('0x1d')][_0x6e05('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f432b['options']?_0x5f432b[_0x6e05('0x1d')][_0x6e05('0x1f')]||null:null,'attributes':_0x5f432b[_0x6e05('0x1d')]?_0x5f432b[_0x6e05('0x1d')][_0x6e05('0x20')]||null:null,'limit':_0x5f432b[_0x6e05('0x1d')]?_0x5f432b[_0x6e05('0x1d')]['limit']||null:null})[_0x6e05('0xf')](function(_0x28ded4){logger[_0x6e05('0x10')](_0x6e05('0x19'),_0x5f432b);logger['debug']('UpdateMailInteraction',_0x5f432b,JSON[_0x6e05('0x21')](_0x28ded4));_0x70338b(_0x28ded4);})['catch'](function(_0x1026fd){logger[_0x6e05('0x14')](_0x6e05('0x19'),_0x1026fd[_0x6e05('0x17')],_0x5f432b);_0x3730f8(_0x297ba9[_0x6e05('0x14')](0x1f4,_0x1026fd[_0x6e05('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0x17c083){return new Promise(function(_0x365024,_0x19c798){return db[_0x6e05('0x1a')][_0x6e05('0x22')]({'where':_0x17c083[_0x6e05('0x1d')]?_0x17c083[_0x6e05('0x1d')][_0x6e05('0x1f')]||null:null})['then'](function(_0x3953af){if(_0x3953af){return _0x3953af[_0x6e05('0x23')](_0x17c083[_0x6e05('0x1c')][_0x6e05('0x24')],_[_0x6e05('0x25')](_0x17c083[_0x6e05('0x1c')],[_0x6e05('0x24'),'id'])||{});}})[_0x6e05('0x26')](function(_0x3125c1){logger[_0x6e05('0x10')]('AddTags',_0x17c083);logger[_0x6e05('0x12')](_0x6e05('0x27'),_0x17c083,JSON[_0x6e05('0x21')](_0x3125c1));_0x365024(_0x3125c1);})['catch'](function(_0x53d99f){logger[_0x6e05('0x14')]('AddTags',_0x53d99f['message'],_0x17c083);_0x19c798(_this[_0x6e05('0x14')](0x1f4,_0x53d99f[_0x6e05('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 17236ce..6dabd3d 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 _0x5054=['mailInteraction:','./mailInteraction.events','save','update','removeListener','length'];(function(_0x855034,_0x425850){var _0x5e4c5f=function(_0x206db1){while(--_0x206db1){_0x855034['push'](_0x855034['shift']());}};_0x5e4c5f(++_0x425850);}(_0x5054,0x12d));var _0x4505=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5054[_0x20a584];return _0x4b41a8;};'use strict';var MailInteractionEvents=require(_0x4505('0x0'));var events=[_0x4505('0x1'),'remove',_0x4505('0x2')];function createListener(_0x3d90e3,_0x4318b0){return function(_0xa0a1e2){_0x4318b0['emit'](_0x3d90e3,_0xa0a1e2);};}function removeListener(_0x1374be,_0x1857bf){return function(){MailInteractionEvents[_0x4505('0x3')](_0x1374be,_0x1857bf);};}exports['register']=function(_0x322789){for(var _0x1b1ef2=0x0,_0x2294d6=events[_0x4505('0x4')];_0x1b1ef2<_0x2294d6;_0x1b1ef2++){var _0x9ab0e2=events[_0x1b1ef2];var _0x27fe89=createListener(_0x4505('0x5')+_0x9ab0e2,_0x322789);MailInteractionEvents['on'](_0x9ab0e2,_0x27fe89);}}; \ No newline at end of file +var _0xbd7c=['register','./mailInteraction.events','save','remove','emit','removeListener'];(function(_0x143d43,_0x5880a4){var _0x30dc8f=function(_0xf92d73){while(--_0xf92d73){_0x143d43['push'](_0x143d43['shift']());}};_0x30dc8f(++_0x5880a4);}(_0xbd7c,0xbb));var _0xcbd7=function(_0x595f8f,_0x3824b1){_0x595f8f=_0x595f8f-0x0;var _0x5a2e20=_0xbd7c[_0x595f8f];return _0x5a2e20;};'use strict';var MailInteractionEvents=require(_0xcbd7('0x0'));var events=[_0xcbd7('0x1'),_0xcbd7('0x2'),'update'];function createListener(_0x5ef7af,_0x30ccc6){return function(_0x3c0bac){_0x30ccc6[_0xcbd7('0x3')](_0x5ef7af,_0x3c0bac);};}function removeListener(_0x2cc080,_0x1e150b){return function(){MailInteractionEvents[_0xcbd7('0x4')](_0x2cc080,_0x1e150b);};}exports[_0xcbd7('0x5')]=function(_0x3185ab){for(var _0x1336e8=0x0,_0x21a90d=events['length'];_0x1336e8<_0x21a90d;_0x1336e8++){var _0x342ece=events[_0x1336e8];var _0x2a9cbf=createListener('mailInteraction:'+_0x342ece,_0x3185ab);MailInteractionEvents['on'](_0x342ece,_0x2a9cbf);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index b3dc618..bad00b8 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 _0xbee0=['/describe','describe','/:id','/:id/download','download','post','tracked','mailmessage:create','put','update','/:id/accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x54c050,_0x1fccab){var _0x4494d7=function(_0xfa98fd){while(--_0xfa98fd){_0x54c050['push'](_0x54c050['shift']());}};_0x4494d7(++_0x1fccab);}(_0xbee0,0x147));var _0x0bee=function(_0x10bb73,_0x3940a2){_0x10bb73=_0x10bb73-0x0;var _0x2a4b39=_0xbee0[_0x10bb73];return _0x2a4b39;};'use strict';var multer=require('multer');var util=require(_0x0bee('0x0'));var path=require(_0x0bee('0x1'));var timeout=require(_0x0bee('0x2'));var express=require(_0x0bee('0x3'));var router=express[_0x0bee('0x4')]();var fs_extra=require(_0x0bee('0x5'));var auth=require(_0x0bee('0x6'));var interaction=require(_0x0bee('0x7'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router['get']('/',auth[_0x0bee('0x8')](),controller[_0x0bee('0x9')]);router[_0x0bee('0xa')](_0x0bee('0xb'),auth['isAuthenticated'](),controller[_0x0bee('0xc')]);router[_0x0bee('0xa')](_0x0bee('0xd'),auth[_0x0bee('0x8')](),controller['show']);router[_0x0bee('0xa')](_0x0bee('0xe'),auth[_0x0bee('0x8')](),controller[_0x0bee('0xf')]);router[_0x0bee('0x10')]('/',auth[_0x0bee('0x8')](),interaction[_0x0bee('0x11')]('mail',_0x0bee('0x12')),controller['create']);router[_0x0bee('0x13')](_0x0bee('0xd'),auth[_0x0bee('0x8')](),controller[_0x0bee('0x14')]);router[_0x0bee('0x13')](_0x0bee('0x15'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x0bee('0x16'),auth[_0x0bee('0x8')](),controller[_0x0bee('0x17')]);router[_0x0bee('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0bee('0x19')]=router; \ No newline at end of file +var _0xeffd=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','show','download','post','tracked','mail','mailmessage:create','create','/:id','put','accept','/:id/reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3423a2,_0x2fa78e){var _0x472145=function(_0x2b0940){while(--_0x2b0940){_0x3423a2['push'](_0x3423a2['shift']());}};_0x472145(++_0x2fa78e);}(_0xeffd,0x6b));var _0xdeff=function(_0x4f20b6,_0x2d350d){_0x4f20b6=_0x4f20b6-0x0;var _0x1e02d1=_0xeffd[_0x4f20b6];return _0x1e02d1;};'use strict';var multer=require(_0xdeff('0x0'));var util=require('util');var path=require(_0xdeff('0x1'));var timeout=require(_0xdeff('0x2'));var express=require(_0xdeff('0x3'));var router=express[_0xdeff('0x4')]();var fs_extra=require(_0xdeff('0x5'));var auth=require(_0xdeff('0x6'));var interaction=require(_0xdeff('0x7'));var config=require(_0xdeff('0x8'));var controller=require(_0xdeff('0x9'));router[_0xdeff('0xa')]('/',auth[_0xdeff('0xb')](),controller[_0xdeff('0xc')]);router[_0xdeff('0xa')](_0xdeff('0xd'),auth[_0xdeff('0xb')](),controller[_0xdeff('0xe')]);router[_0xdeff('0xa')]('/:id',auth[_0xdeff('0xb')](),controller[_0xdeff('0xf')]);router[_0xdeff('0xa')]('/:id/download',auth[_0xdeff('0xb')](),controller[_0xdeff('0x10')]);router[_0xdeff('0x11')]('/',auth[_0xdeff('0xb')](),interaction[_0xdeff('0x12')](_0xdeff('0x13'),_0xdeff('0x14')),controller[_0xdeff('0x15')]);router['put'](_0xdeff('0x16'),auth[_0xdeff('0xb')](),controller['update']);router[_0xdeff('0x17')]('/:id/accept',auth['isAuthenticated'](),controller[_0xdeff('0x18')]);router[_0xdeff('0x17')](_0xdeff('0x19'),auth[_0xdeff('0xb')](),controller['reject']);router[_0xdeff('0x1a')](_0xdeff('0x16'),auth[_0xdeff('0xb')](),controller[_0xdeff('0x1b')]);module[_0xdeff('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index b26d916..4580c54 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 _0xc2fd=['Email','Chat','sequelize','lodash','exports','TEXT','long','ENUM','out','STRING','DATE','BOOLEAN'];(function(_0x28bf35,_0x26803e){var _0x5cbf0a=function(_0x460444){while(--_0x460444){_0x28bf35['push'](_0x28bf35['shift']());}};_0x5cbf0a(++_0x26803e);}(_0xc2fd,0x12e));var _0xdc2f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc2fd[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xdc2f('0x0'));var _=require(_0xdc2f('0x1'));module[_0xdc2f('0x2')]={'body':{'type':Sequelize[_0xdc2f('0x3')](_0xdc2f('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xdc2f('0x5')]('in',_0xdc2f('0x6')),'defaultValue':_0xdc2f('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xdc2f('0x7')]},'to':{'type':Sequelize[_0xdc2f('0x3')](_0xdc2f('0x4'))},'cc':{'type':Sequelize[_0xdc2f('0x3')](_0xdc2f('0x4'))},'bcc':{'type':Sequelize[_0xdc2f('0x3')](_0xdc2f('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xdc2f('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xdc2f('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xdc2f('0x8')]},'originTo':{'type':Sequelize[_0xdc2f('0x3')](_0xdc2f('0x4'))},'originCc':{'type':Sequelize[_0xdc2f('0x3')]('long')},'originChannel':{'type':Sequelize[_0xdc2f('0x5')](_0xdc2f('0xa'),_0xdc2f('0xb')),'defaultValue':_0xdc2f('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x31d9=['exports','TEXT','long','medium','ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize','lodash'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x31d9,0x1ab));var _0x931d=function(_0x3cd1ec,_0x40b049){_0x3cd1ec=_0x3cd1ec-0x0;var _0x50f1be=_0x31d9[_0x3cd1ec];return _0x50f1be;};'use strict';var Sequelize=require(_0x931d('0x0'));var _=require(_0x931d('0x1'));module[_0x931d('0x2')]={'body':{'type':Sequelize[_0x931d('0x3')](_0x931d('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x931d('0x3')](_0x931d('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x931d('0x6')]('in','out'),'defaultValue':_0x931d('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x931d('0x8')]},'to':{'type':Sequelize[_0x931d('0x3')]('long')},'cc':{'type':Sequelize[_0x931d('0x3')](_0x931d('0x4'))},'bcc':{'type':Sequelize[_0x931d('0x3')](_0x931d('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x931d('0x9')]},'attach':{'type':Sequelize[_0x931d('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x931d('0x9')]},'originTo':{'type':Sequelize[_0x931d('0x3')]('long')},'originCc':{'type':Sequelize[_0x931d('0x3')]('long')},'originChannel':{'type':Sequelize[_0x931d('0x6')](_0x931d('0xb'),_0x931d('0xc')),'defaultValue':_0x931d('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 62f463f..e685509 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 _0x1706=['filters','query','fields','attributes','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','includeAll','include','show','params','keys','intersection','options','update','body','find','describe','create','direction','secret','MailAccount','findOne','CmList','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','server/files/attachments','basename','List','ListId','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','agent','MailInteraction','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','interface','SIP/%s','channel','fromString','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','event','EventManager','unix','toString','root','server','files','tmp','from','bcc','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','build','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','offset','undefined','limit','count','set','json','destroy','then','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model'];(function(_0x1a0d18,_0x1e9a9b){var _0x1bbc33=function(_0x49e262){while(--_0x49e262){_0x1a0d18['push'](_0x1a0d18['shift']());}};_0x1bbc33(++_0x1e9a9b);}(_0x1706,0x107));var _0x6170=function(_0x5f4ad5,_0x5b9082){_0x5f4ad5=_0x5f4ad5-0x0;var _0x4241e2=_0x1706[_0x5f4ad5];return _0x4241e2;};'use strict';var emlformat=require(_0x6170('0x0'));var moment=require(_0x6170('0x1'));var BPromise=require(_0x6170('0x2'));var util=require(_0x6170('0x3'));var path=require(_0x6170('0x4'));var fs=require('fs');var _=require(_0x6170('0x5'));var Redis=require(_0x6170('0x6'));var htmlToText=require('html-to-text');var qs=require(_0x6170('0x7'));var logger=require(_0x6170('0x8'))('api');var interaction_log=require(_0x6170('0x8'))(_0x6170('0x9'));var config=require(_0x6170('0xa'));var db=require(_0x6170('0xb'))['db'];config[_0x6170('0xc')]=_['defaults'](config[_0x6170('0xc')],{'host':_0x6170('0xd'),'port':0x18eb});var socket=require(_0x6170('0xe'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0x6170('0xf')](socket);var jayson=require(_0x6170('0x10'));var client=jayson['client'][_0x6170('0x11')]({'port':0x232c});var client9003=jayson[_0x6170('0x12')][_0x6170('0x11')]({'port':0x232b});var client9002=jayson[_0x6170('0x12')][_0x6170('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x4f1101,_0x128dcd,_0x3e1683,_0x2ba78e){return new BPromise(function(_0x44f926,_0x682a0b){var _0x4d430c=_0x2ba78e||client;return _0x4d430c[_0x6170('0x13')](_0x4f1101,_0x3e1683)['then'](function(_0x4445ee){logger[_0x6170('0x14')](_0x6170('0x15'),_0x128dcd,_0x6170('0x16'));logger[_0x6170('0x17')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x128dcd,_0x6170('0x16'),JSON[_0x6170('0x18')](_0x4445ee));if(_0x4445ee[_0x6170('0x19')]){if(_0x4445ee[_0x6170('0x19')]['code']===0x1f4){logger[_0x6170('0x19')](_0x6170('0x15'),_0x128dcd,_0x4445ee[_0x6170('0x19')]['message']);return _0x682a0b(_0x4445ee[_0x6170('0x19')][_0x6170('0x1a')]);}logger[_0x6170('0x19')](_0x6170('0x15'),_0x128dcd,_0x4445ee[_0x6170('0x19')][_0x6170('0x1a')]);return _0x44f926(_0x4445ee[_0x6170('0x19')]['message']);}else{logger[_0x6170('0x14')](_0x6170('0x15'),_0x128dcd,_0x6170('0x16'));_0x44f926(_0x4445ee[_0x6170('0x1b')][_0x6170('0x1a')]);}})[_0x6170('0x1c')](function(_0x11bb33){logger[_0x6170('0x19')](_0x6170('0x15'),_0x128dcd,_0x11bb33);_0x682a0b(_0x11bb33);});});}function respondWithResult(_0x26ae3a,_0x25acd9){_0x25acd9=_0x25acd9||0xc8;return function(_0x7b37d0){if(_0x7b37d0){return _0x26ae3a[_0x6170('0x1d')](_0x25acd9)['json'](_0x7b37d0);}};}function respondWithFilteredResult(_0x27170f,_0x1dc3a3){return function(_0x136a54){if(_0x136a54){var _0x1ddade=typeof _0x1dc3a3[_0x6170('0x1e')]===_0x6170('0x1f')&&typeof _0x1dc3a3[_0x6170('0x20')]===_0x6170('0x1f');var _0x1b871e=_0x136a54[_0x6170('0x21')];var _0x12c418=_0x1ddade?0x0:_0x1dc3a3[_0x6170('0x1e')];var _0x3c9945=_0x1ddade?_0x136a54[_0x6170('0x21')]:_0x1dc3a3['offset']+_0x1dc3a3[_0x6170('0x20')];var _0x3c093b;if(_0x3c9945>=_0x1b871e){_0x3c9945=_0x1b871e;_0x3c093b=0xc8;}else{_0x3c093b=0xce;}_0x27170f[_0x6170('0x1d')](_0x3c093b);return _0x27170f[_0x6170('0x22')]('Content-Range',_0x12c418+'-'+_0x3c9945+'/'+_0x1b871e)[_0x6170('0x23')](_0x136a54);}return null;};}function saveUpdates(_0x1feeaa){return function(_0x21029a){if(_0x21029a){return _0x21029a['update'](_0x1feeaa)['then'](function(_0x1bdd09){return _0x1bdd09;});}return null;};}function removeEntity(_0x4c903c){return function(_0x5ede1d){if(_0x5ede1d){return _0x5ede1d[_0x6170('0x24')]()[_0x6170('0x25')](function(){_0x4c903c[_0x6170('0x1d')](0xcc)[_0x6170('0x26')]();});}};}function handleEntityNotFound(_0x1df37d){return function(_0x34a9be){if(!_0x34a9be){_0x1df37d[_0x6170('0x27')](0x194);}return _0x34a9be;};}function handleError(_0x5c99b6,_0x2b178d){_0x2b178d=_0x2b178d||0x1f4;return function(_0x5c2359){logger['error'](_0x5c2359[_0x6170('0x28')]);if(_0x5c2359[_0x6170('0x29')]){delete _0x5c2359[_0x6170('0x29')];}_0x5c99b6['status'](_0x2b178d)[_0x6170('0x2a')](_0x5c2359);};}exports[_0x6170('0x2b')]=function(_0x10dfa0,_0x50af7a){var _0x2286e0={},_0x26ae67={},_0x76141c={'count':0x0,'rows':[]};var _0x325502=_[_0x6170('0x2c')](db[_0x6170('0x2d')][_0x6170('0x2e')],function(_0x42fbe9){return{'name':_0x42fbe9[_0x6170('0x2f')],'type':_0x42fbe9[_0x6170('0x30')][_0x6170('0x31')]};});_0x26ae67[_0x6170('0x32')]=_['map'](_0x325502,_0x6170('0x29'));_0x26ae67['query']=_['keys'](_0x10dfa0['query']);_0x26ae67[_0x6170('0x33')]=_['intersection'](_0x26ae67['model'],_0x26ae67[_0x6170('0x34')]);_0x2286e0['attributes']=_['intersection'](_0x26ae67[_0x6170('0x32')],qs[_0x6170('0x35')](_0x10dfa0['query'][_0x6170('0x35')]));_0x2286e0[_0x6170('0x36')]=_0x2286e0[_0x6170('0x36')][_0x6170('0x37')]?_0x2286e0[_0x6170('0x36')]:_0x26ae67['model'];if(!_0x10dfa0[_0x6170('0x34')][_0x6170('0x38')]('nolimit')){_0x2286e0['limit']=qs[_0x6170('0x20')](_0x10dfa0[_0x6170('0x34')][_0x6170('0x20')]);_0x2286e0['offset']=qs[_0x6170('0x1e')](_0x10dfa0[_0x6170('0x34')][_0x6170('0x1e')]);}_0x2286e0[_0x6170('0x39')]=qs[_0x6170('0x3a')](_0x10dfa0[_0x6170('0x34')]['sort']);_0x2286e0['where']=qs[_0x6170('0x33')](_['pick'](_0x10dfa0[_0x6170('0x34')],_0x26ae67['filters']),_0x325502);if(_0x10dfa0[_0x6170('0x34')][_0x6170('0x3b')]){_0x2286e0['where']=_[_0x6170('0x3c')](_0x2286e0[_0x6170('0x3d')],{'$or':_[_0x6170('0x2c')](_0x325502,function(_0x539ed8){if(_0x539ed8[_0x6170('0x30')]!==_0x6170('0x3e')){var _0x5c58ed={};_0x5c58ed[_0x539ed8[_0x6170('0x29')]]={'$like':'%'+_0x10dfa0[_0x6170('0x34')][_0x6170('0x3b')]+'%'};return _0x5c58ed;}})});}_0x2286e0=_[_0x6170('0x3c')]({},_0x2286e0,_0x10dfa0['options']);var _0x4f9d3d={'where':_0x2286e0[_0x6170('0x3d')]};return db['MailMessage']['count'](_0x4f9d3d)[_0x6170('0x25')](function(_0x1bdb24){_0x76141c['count']=_0x1bdb24;if(_0x10dfa0[_0x6170('0x34')][_0x6170('0x3f')]){_0x2286e0[_0x6170('0x40')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x2286e0);})[_0x6170('0x25')](function(_0x52dfef){_0x76141c['rows']=_0x52dfef;return _0x76141c;})[_0x6170('0x25')](respondWithFilteredResult(_0x50af7a,_0x2286e0))[_0x6170('0x1c')](handleError(_0x50af7a,null));};exports[_0x6170('0x41')]=function(_0x298356,_0x2bd3ca){var _0x2b89e1={'raw':!![],'where':{'id':_0x298356[_0x6170('0x42')]['id']}},_0x37eb24={};_0x37eb24[_0x6170('0x32')]=_[_0x6170('0x43')](db[_0x6170('0x2d')]['rawAttributes']);_0x37eb24['query']=_[_0x6170('0x43')](_0x298356['query']);_0x37eb24[_0x6170('0x33')]=_[_0x6170('0x44')](_0x37eb24['model'],_0x37eb24['query']);_0x2b89e1[_0x6170('0x36')]=_[_0x6170('0x44')](_0x37eb24[_0x6170('0x32')],qs[_0x6170('0x35')](_0x298356['query'][_0x6170('0x35')]));_0x2b89e1[_0x6170('0x36')]=_0x2b89e1[_0x6170('0x36')][_0x6170('0x37')]?_0x2b89e1['attributes']:_0x37eb24['model'];if(_0x298356['query']['includeAll']){_0x2b89e1[_0x6170('0x40')]=[{'all':!![]}];}_0x2b89e1=_[_0x6170('0x3c')]({},_0x2b89e1,_0x298356[_0x6170('0x45')]);return db[_0x6170('0x2d')]['find'](_0x2b89e1)['then'](handleEntityNotFound(_0x2bd3ca,null))['then'](respondWithResult(_0x2bd3ca,null))['catch'](handleError(_0x2bd3ca,null));};exports[_0x6170('0x46')]=function(_0x1a8958,_0x10599a){if(_0x1a8958[_0x6170('0x47')]['id']){delete _0x1a8958[_0x6170('0x47')]['id'];}return db['MailMessage'][_0x6170('0x48')]({'where':{'id':_0x1a8958[_0x6170('0x42')]['id']}})[_0x6170('0x25')](handleEntityNotFound(_0x10599a,null))[_0x6170('0x25')](saveUpdates(_0x1a8958[_0x6170('0x47')],null))['then'](respondWithResult(_0x10599a,null))[_0x6170('0x1c')](handleError(_0x10599a,null));};exports[_0x6170('0x24')]=function(_0x460116,_0x5ade34){return db[_0x6170('0x2d')][_0x6170('0x48')]({'where':{'id':_0x460116[_0x6170('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ade34,null))['then'](removeEntity(_0x5ade34,null))['catch'](handleError(_0x5ade34,null));};exports[_0x6170('0x49')]=function(_0x85dc57,_0x650adc){return db[_0x6170('0x2d')][_0x6170('0x49')]()[_0x6170('0x25')](respondWithResult(_0x650adc,null))[_0x6170('0x1c')](handleError(_0x650adc,null));};exports[_0x6170('0x4a')]=function(_0x5baa1e,_0x4737d3){return db[_0x6170('0x2d')][_0x6170('0x4a')](_0x5baa1e[_0x6170('0x47')])[_0x6170('0x25')](function(_0x5ed1a1){if(_0x5ed1a1){if(_0x5ed1a1[_0x6170('0x4b')]==='out'&&!_0x5ed1a1[_0x6170('0x4c')]){var _0x56f2a6,_0x5e64d8,_0x585dd8;if(_0x5baa1e['body']['to']){_0x5e64d8=_0x5baa1e[_0x6170('0x47')]['to']['split'](',')[0x0];}return db[_0x6170('0x4d')][_0x6170('0x4e')]({'where':{'id':_0x5ed1a1['MailAccountId']},'include':[{'model':db[_0x6170('0x4f')],'as':'List','include':[{'model':db['CmContact'],'as':_0x6170('0x50'),'where':{'email':_0x5e64d8},'limit':0x1,'order':[['updatedAt',_0x6170('0x51')]]}]},{'model':db[_0x6170('0x52')],'as':_0x6170('0x53'),'raw':!![]}]})[_0x6170('0x25')](function(_0x2e12b5){_0x56f2a6=_0x2e12b5;if(_0x56f2a6&&_0x56f2a6[_0x6170('0x53')]){var _0x1deac6={'tls':{'rejectUnauthorized':![]}};if(_[_0x6170('0x54')](_0x56f2a6[_0x6170('0x53')][_0x6170('0x55')])){_0x1deac6[_0x6170('0x56')]=_0x56f2a6['Smtp'][_0x6170('0x56')];_0x1deac6[_0x6170('0x57')]=_0x56f2a6[_0x6170('0x53')][_0x6170('0x57')];_0x1deac6[_0x6170('0x58')]=_0x56f2a6[_0x6170('0x53')][_0x6170('0x58')];if(_0x56f2a6[_0x6170('0x53')][_0x6170('0x59')]){_0x1deac6[_0x6170('0x5a')]={'user':_0x56f2a6[_0x6170('0x53')][_0x6170('0x5b')],'pass':_0x56f2a6[_0x6170('0x53')][_0x6170('0x5c')]};}}else{_0x1deac6[_0x6170('0x55')]=_0x56f2a6[_0x6170('0x53')]['service'];_0x1deac6[_0x6170('0x5a')]={'user':_0x56f2a6[_0x6170('0x53')][_0x6170('0x5b')],'pass':_0x56f2a6[_0x6170('0x53')][_0x6170('0x5c')]};_0x1deac6['secure']=_0x56f2a6[_0x6170('0x53')]['secure'];}if(_0x5baa1e[_0x6170('0x47')][_0x6170('0x5d')]&&_0x5baa1e[_0x6170('0x47')][_0x6170('0x5d')][_0x6170('0x37')]){for(var _0x2df03b=0x0;_0x2df03b<_0x5baa1e[_0x6170('0x47')][_0x6170('0x5d')][_0x6170('0x37')];_0x2df03b+=0x1){_0x5baa1e[_0x6170('0x47')]['attachments'][_0x2df03b]={'filename':_0x5baa1e[_0x6170('0x47')]['attachments'][_0x2df03b][_0x6170('0x29')],'path':path[_0x6170('0x5e')](config['root'],_0x6170('0x5f'),_0x5baa1e[_0x6170('0x47')][_0x6170('0x5d')][_0x2df03b][_0x6170('0x60')])};}}_0x585dd8={'account':_0x1deac6,'message':_0x5baa1e[_0x6170('0x47')]};return;}})[_0x6170('0x25')](function(){if(_0x56f2a6[_0x6170('0x61')]){if(_0x56f2a6['List'][_0x6170('0x50')]['length']){return _0x56f2a6[_0x6170('0x61')][_0x6170('0x50')][0x0];}else{return db['CmContact'][_0x6170('0x4a')](_['defaults'](_0x5baa1e[_0x6170('0x47')],{'firstName':_0x5baa1e[_0x6170('0x47')]['to'],'email':_0x5baa1e[_0x6170('0x47')]['to'],'phone':_0x5baa1e[_0x6170('0x47')]['to'],'ListId':_0x56f2a6[_0x6170('0x62')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x6170('0x25')](function(){if(_0x585dd8){return respondWithRpcPromise(_0x6170('0x63'),_0x6170('0x64'),_0x585dd8,client9003)['then'](function(_0x30472b){return _0x5ed1a1[_0x6170('0x46')]({'read':!![],'messageId':_0x30472b['messageId'],'sentAt':moment()[_0x6170('0x65')](_0x6170('0x66'))});})[_0x6170('0x1c')](function(_0x4c7057){logger[_0x6170('0x19')]('%s',JSON['stringify'](_0x4c7057));return _0x5ed1a1;});}return _0x5ed1a1;});}return _0x5ed1a1;}})[_0x6170('0x25')](respondWithResult(_0x4737d3,0xc9))[_0x6170('0x1c')](handleError(_0x4737d3,null));};exports[_0x6170('0x67')]=function(_0x5ea0e6,_0x4a4e9d){var _0x40aa62={'agent':{},'channel':_0x6170('0x68')};if(_0x5ea0e6[_0x6170('0x47')]['id']){delete _0x5ea0e6['body']['id'];}_0x5ea0e6[_0x6170('0x47')][_0x6170('0x69')]=!![];_0x5ea0e6[_0x6170('0x47')]['readAt']=moment()[_0x6170('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x5ea0e6[_0x6170('0x47')][_0x6170('0x6a')]=_0x5ea0e6[_0x6170('0x47')]['UserId']||_0x5ea0e6['user']['id'];_0x40aa62[_0x6170('0x6b')]['id']=_0x5ea0e6[_0x6170('0x47')][_0x6170('0x6a')];return db['MailMessage'][_0x6170('0x48')]({'where':{'id':_0x5ea0e6[_0x6170('0x42')]['id'],'UserId':null}})[_0x6170('0x25')](handleEntityNotFound(_0x4a4e9d,null))[_0x6170('0x25')](saveUpdates(_0x5ea0e6[_0x6170('0x47')],null))[_0x6170('0x25')](function(_0x430889){if(_0x430889){_0x40aa62[_0x6170('0x1a')]=_0x430889['get']({'plain':!![]});return db[_0x6170('0x6c')]['find']({'where':{'id':_0x430889['MailInteractionId']}});}return null;})[_0x6170('0x25')](handleEntityNotFound(_0x4a4e9d,null))[_0x6170('0x25')](function(_0x551ca2){if(_0x551ca2){return _0x551ca2[_0x6170('0x46')]({'UserId':_0x5ea0e6[_0x6170('0x47')][_0x6170('0x6a')],'read1stAt':_[_0x6170('0x54')](_0x551ca2[_0x6170('0x6d')])?moment()[_0x6170('0x65')](_0x6170('0x66')):undefined});}return null;})[_0x6170('0x25')](function(_0x394afb){if(_0x394afb){_0x40aa62[_0x6170('0x6e')]=_0x394afb[_0x6170('0x6f')]({'plain':!![]});interaction_log[_0x6170('0x14')](_0x6170('0x70'),_0x5ea0e6[_0x6170('0x5b')]['id'],_0x5ea0e6[_0x6170('0x5b')][_0x6170('0x29')],_0x5ea0e6[_0x6170('0x5b')][_0x6170('0x71')],_0x40aa62[_0x6170('0x6e')]['id'],_0x5ea0e6[_0x6170('0x47')]?JSON[_0x6170('0x18')](_0x5ea0e6[_0x6170('0x47')]):_0x6170('0x72'));return respondWithRpcPromise(_0x6170('0x73'),_0x6170('0x74'),_0x40aa62);}return null;})[_0x6170('0x25')](function(_0x3b41b3){var _0xf2c7a7=_0x6170('0x75')+_0x3b41b3[_0x6170('0x1a')][_0x6170('0x76')];return db[_0x6170('0x77')][_0x6170('0x34')](_0xf2c7a7,{'type':db[_0x6170('0x78')][_0x6170('0x79')][_0x6170('0x7a')],'raw':!![]})[_0x6170('0x25')](function(_0x30dee1){return _0x30dee1;});})['then'](function(_0xd8d2a7){if(_0xd8d2a7){_0x40aa62['message'][_0x6170('0x7b')]=_0xd8d2a7[0x0];if(!_0x5ea0e6[_0x6170('0x47')][_0x6170('0x6a')])return;return db[_0x6170('0x7c')][_0x6170('0x48')]({'where':{'id':_0x5ea0e6['body'][_0x6170('0x6a')],'role':_0x6170('0x6b')},'attributes':['id',_0x6170('0x29'),'fullname',_0x6170('0x7d'),_0x6170('0x7e')],'raw':!![]});}return null;})[_0x6170('0x25')](function(_0x254de2){if(!_0x254de2)return null;_0x40aa62[_0x6170('0x1a')][_0x6170('0x6b')]=_0x254de2;return _0x40aa62;})[_0x6170('0x25')](function(_0x527c4b){if(_0x527c4b){if(_0x5ea0e6['body']['manual']){_0x40aa62[_0x6170('0x1a')][_0x6170('0x7f')]=util[_0x6170('0x65')](_0x6170('0x80'),_0x5ea0e6[_0x6170('0x5b')][_0x6170('0x29')]);_0x40aa62[_0x6170('0x1a')][_0x6170('0x81')]=_0x40aa62[_0x6170('0x81')];_0x40aa62['message']['motionChannel']=_0x40aa62[_0x6170('0x81')];_0x40aa62[_0x6170('0x1a')]['event']=_0x6170('0x67');_0x40aa62[_0x6170('0x1a')][_0x6170('0x47')]=htmlToText[_0x6170('0x82')](_0x40aa62['message'][_0x6170('0x47')]);return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x40aa62[_0x6170('0x1a')]},client9002)[_0x6170('0x25')](function(){return _0x40aa62;});}return _0x40aa62;}return null;})[_0x6170('0x25')](respondWithResult(_0x4a4e9d,null))[_0x6170('0x1c')](handleError(_0x4a4e9d,null));};exports[_0x6170('0x83')]=function(_0x477dae,_0x4d62d9){var _0x5a4eae={'agent':{},'channel':'mail'};if(_0x477dae['body']['id']){delete _0x477dae['body']['id'];}_0x477dae[_0x6170('0x47')]['UserId']=_0x477dae[_0x6170('0x47')][_0x6170('0x6a')]||_0x477dae['user']['id'];_0x5a4eae['agent']['id']=_0x477dae[_0x6170('0x47')][_0x6170('0x6a')];return db[_0x6170('0x2d')][_0x6170('0x48')]({'where':{'id':_0x477dae[_0x6170('0x42')]['id'],'UserId':null}})[_0x6170('0x25')](handleEntityNotFound(_0x4d62d9,null))[_0x6170('0x25')](function(_0x5c6fe1){if(_0x5c6fe1){_0x5a4eae['message']=_0x5c6fe1[_0x6170('0x6f')]({'plain':!![]});return db[_0x6170('0x6c')]['find']({'where':{'id':_0x5c6fe1[_0x6170('0x84')]}});}return null;})[_0x6170('0x25')](handleEntityNotFound(_0x4d62d9,null))[_0x6170('0x25')](function(_0x501b0e){if(_0x501b0e){_0x5a4eae[_0x6170('0x6e')]=_0x501b0e['get']({'plain':!![]});interaction_log[_0x6170('0x14')](_0x6170('0x85'),_0x477dae['user']['id'],_0x477dae[_0x6170('0x5b')][_0x6170('0x29')],_0x477dae['user'][_0x6170('0x71')],_0x5a4eae['interaction']['id'],_0x477dae[_0x6170('0x47')]?JSON[_0x6170('0x18')](_0x477dae['body']):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x5a4eae);}return null;})[_0x6170('0x25')](function(_0x6165eb){var _0x1ee96b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x6165eb[_0x6170('0x1a')][_0x6170('0x76')];return db[_0x6170('0x77')]['query'](_0x1ee96b,{'type':db[_0x6170('0x78')][_0x6170('0x79')][_0x6170('0x7a')],'raw':!![]})['then'](function(_0x222220){return _0x222220;});})[_0x6170('0x25')](function(_0x453369){if(_0x453369){_0x5a4eae[_0x6170('0x1a')][_0x6170('0x7b')]=_0x453369[0x0];if(!_0x477dae[_0x6170('0x47')][_0x6170('0x6a')])return;return db['User']['find']({'where':{'id':_0x477dae['body'][_0x6170('0x6a')],'role':'agent'},'attributes':['id',_0x6170('0x29'),'fullname','email',_0x6170('0x7e')],'raw':!![]});}return null;})[_0x6170('0x25')](function(_0x420a96){if(!_0x420a96)return null;_0x5a4eae[_0x6170('0x1a')][_0x6170('0x6b')]=_0x420a96;return _0x5a4eae;})[_0x6170('0x25')](function(_0x142d93){if(_0x142d93){_0x142d93[_0x6170('0x1a')][_0x6170('0x7f')]=util[_0x6170('0x65')](_0x6170('0x80'),_0x477dae[_0x6170('0x5b')]['name']);_0x142d93['message'][_0x6170('0x81')]=_0x5a4eae[_0x6170('0x81')];_0x142d93[_0x6170('0x1a')]['motionChannel']=_0x5a4eae[_0x6170('0x81')];_0x142d93[_0x6170('0x1a')][_0x6170('0x86')]=_0x6170('0x83');_0x142d93[_0x6170('0x1a')][_0x6170('0x47')]=htmlToText[_0x6170('0x82')](_0x5a4eae['message']['body']);respondWithRpcPromise(_0x6170('0x87'),_0x6170('0x87'),{'event':'rejectmessage','message':_0x142d93['message']},client9002);return _0x5a4eae;}return null;})['then'](respondWithResult(_0x4d62d9,null))['catch'](handleError(_0x4d62d9,null));};exports['download']=function(_0x385b85,_0x1564cd){var _0x256b2c=moment()[_0x6170('0x88')]()[_0x6170('0x89')]();var _0x1e7b24=path[_0x6170('0x5e')](config[_0x6170('0x8a')],_0x6170('0x8b'),_0x6170('0x8c'),_0x6170('0x8d'));var _0x4fbd73=path[_0x6170('0x5e')](config[_0x6170('0x8a')],'server',_0x6170('0x8c'),_0x6170('0x5d'));var _0x342316=util[_0x6170('0x65')]('message-%s.eml',_0x256b2c);return db[_0x6170('0x2d')][_0x6170('0x48')]({'where':{'id':_0x385b85[_0x6170('0x42')]['id']},'attributes':['id','body',_0x6170('0x8e'),'to','cc',_0x6170('0x8f'),_0x6170('0x90'),_0x6170('0x91')],'include':_0x385b85[_0x6170('0x34')][_0x6170('0x5d')]?[{'model':db['Attachment'],'as':_0x6170('0x92')}]:undefined})[_0x6170('0x25')](handleEntityNotFound(_0x1564cd,null))[_0x6170('0x25')](function(_0xd91773){if(_0xd91773){var _0x571c9e=_0xd91773;var _0x2adf22={'from':_0x571c9e[_0x6170('0x8e')],'to':_0x571c9e['to'],'subject':_0x571c9e[_0x6170('0x90')],'html':htmlEntities[_0x6170('0x93')](_0x571c9e[_0x6170('0x47')]),'headers':{'Date':moment(_0x571c9e[_0x6170('0x91')])[_0x6170('0x65')](_0x6170('0x94'))},'attachments':[]};if(_0xd91773['cc']){_0x2adf22[_0x6170('0x95')]['Cc']=_0xd91773['cc'];}if(_0xd91773['bcc']){_0x2adf22[_0x6170('0x95')][_0x6170('0x96')]=_0xd91773[_0x6170('0x8f')];}return new BPromise(function(_0x349be2,_0x42f9a9){if(_0xd91773['Attachments']){for(var _0x3893a6=0x0;_0x3893a6<_0xd91773[_0x6170('0x92')][_0x6170('0x37')];_0x3893a6++){var _0x4e9daf=_0xd91773['Attachments'][_0x3893a6];var _0x591b41=path[_0x6170('0x5e')](_0x4fbd73,_0x4e9daf['basename']);if(fs[_0x6170('0x97')](_0x591b41)){_0x2adf22[_0x6170('0x5d')][_0x6170('0x98')]({'name':_0x4e9daf['name'],'contentType':_0x4e9daf[_0x6170('0x30')],'data':fs['readFileSync'](_0x591b41)});}}}emlformat[_0x6170('0x99')](_0x2adf22,function(_0x592910,_0x4f93cc){if(_0x592910)return _0x42f9a9(_0x592910);fs[_0x6170('0x9a')](path[_0x6170('0x5e')](_0x1e7b24,_0x342316),_0x4f93cc);return _0x349be2(_0x4f93cc);});});}})['then'](function(_0x491d8f){if(_0x491d8f){return _0x1564cd[_0x6170('0x9b')](path[_0x6170('0x5e')](_0x1e7b24,_0x342316),_0x342316,function(_0x14e0d1){if(!_0x14e0d1)fs[_0x6170('0x9c')](path[_0x6170('0x5e')](_0x1e7b24,_0x342316));});}})['catch'](handleError(_0x1564cd,null));}; \ No newline at end of file +var _0xaab4=['bcc','Bcc','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','api','mail-interactions','../../mysqldb','redis','defaults','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','find','body','describe','create','direction','out','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','host','port','secure','authentication','auth','user','pass','service','attachments','root','server/files/attachments','basename','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','agent','UserId','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','channel','event','accept','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','interface','SIP/%s','motionChannel','rejectmessage','download','unix','toString','join','server','files','tmp','message-%s.eml','from','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers'];(function(_0x49e1cc,_0x2c37da){var _0x5c4393=function(_0x2b4423){while(--_0x2b4423){_0x49e1cc['push'](_0x49e1cc['shift']());}};_0x5c4393(++_0x2c37da);}(_0xaab4,0xad));var _0x4aab=function(_0x3855b4,_0x48f303){_0x3855b4=_0x3855b4-0x0;var _0x2e3fe7=_0xaab4[_0x3855b4];return _0x2e3fe7;};'use strict';var emlformat=require(_0x4aab('0x0'));var moment=require(_0x4aab('0x1'));var BPromise=require('bluebird');var util=require(_0x4aab('0x2'));var path=require(_0x4aab('0x3'));var fs=require('fs');var _=require(_0x4aab('0x4'));var Redis=require(_0x4aab('0x5'));var htmlToText=require(_0x4aab('0x6'));var qs=require(_0x4aab('0x7'));var logger=require('../../config/logger')(_0x4aab('0x8'));var interaction_log=require('../../config/logger')(_0x4aab('0x9'));var config=require('../../config/environment');var db=require(_0x4aab('0xa'))['db'];config[_0x4aab('0xb')]=_[_0x4aab('0xc')](config['redis'],{'host':_0x4aab('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require(_0x4aab('0xe'));require(_0x4aab('0xf'))[_0x4aab('0x10')](socket);var jayson=require(_0x4aab('0x11'));var client=jayson[_0x4aab('0x12')][_0x4aab('0x13')]({'port':0x232c});var client9003=jayson[_0x4aab('0x12')][_0x4aab('0x13')]({'port':0x232b});var client9002=jayson[_0x4aab('0x12')][_0x4aab('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x241245,_0x10f984,_0xcce632,_0x46d56c){return new BPromise(function(_0x206eaa,_0xe3904d){var _0x140f1d=_0x46d56c||client;return _0x140f1d[_0x4aab('0x14')](_0x241245,_0xcce632)[_0x4aab('0x15')](function(_0xe66862){logger[_0x4aab('0x16')]('MailMessage,\x20%s,\x20%s',_0x10f984,'request\x20sent');logger[_0x4aab('0x17')](_0x4aab('0x18'),_0x10f984,'request\x20sent',JSON[_0x4aab('0x19')](_0xe66862));if(_0xe66862[_0x4aab('0x1a')]){if(_0xe66862['error']['code']===0x1f4){logger['error'](_0x4aab('0x1b'),_0x10f984,_0xe66862['error']['message']);return _0xe3904d(_0xe66862[_0x4aab('0x1a')]['message']);}logger['error'](_0x4aab('0x1b'),_0x10f984,_0xe66862[_0x4aab('0x1a')][_0x4aab('0x1c')]);return _0x206eaa(_0xe66862['error']['message']);}else{logger[_0x4aab('0x16')]('MailMessage,\x20%s,\x20%s',_0x10f984,_0x4aab('0x1d'));_0x206eaa(_0xe66862[_0x4aab('0x1e')][_0x4aab('0x1c')]);}})[_0x4aab('0x1f')](function(_0x471e4d){logger[_0x4aab('0x1a')](_0x4aab('0x1b'),_0x10f984,_0x471e4d);_0xe3904d(_0x471e4d);});});}function respondWithResult(_0x5e4212,_0x128dc8){_0x128dc8=_0x128dc8||0xc8;return function(_0x2a6658){if(_0x2a6658){return _0x5e4212['status'](_0x128dc8)[_0x4aab('0x20')](_0x2a6658);}};}function respondWithFilteredResult(_0xbe6b6c,_0x22510c){return function(_0x5571eb){if(_0x5571eb){var _0x7850d4=typeof _0x22510c[_0x4aab('0x21')]===_0x4aab('0x22')&&typeof _0x22510c[_0x4aab('0x23')]===_0x4aab('0x22');var _0x323995=_0x5571eb[_0x4aab('0x24')];var _0x413dd9=_0x7850d4?0x0:_0x22510c[_0x4aab('0x21')];var _0xfe3077=_0x7850d4?_0x5571eb[_0x4aab('0x24')]:_0x22510c[_0x4aab('0x21')]+_0x22510c[_0x4aab('0x23')];var _0x3a6133;if(_0xfe3077>=_0x323995){_0xfe3077=_0x323995;_0x3a6133=0xc8;}else{_0x3a6133=0xce;}_0xbe6b6c[_0x4aab('0x25')](_0x3a6133);return _0xbe6b6c[_0x4aab('0x26')](_0x4aab('0x27'),_0x413dd9+'-'+_0xfe3077+'/'+_0x323995)[_0x4aab('0x20')](_0x5571eb);}return null;};}function saveUpdates(_0x4b033c){return function(_0x235079){if(_0x235079){return _0x235079[_0x4aab('0x28')](_0x4b033c)[_0x4aab('0x15')](function(_0x3d94a2){return _0x3d94a2;});}return null;};}function removeEntity(_0x37ccaf){return function(_0x755080){if(_0x755080){return _0x755080[_0x4aab('0x29')]()[_0x4aab('0x15')](function(){_0x37ccaf[_0x4aab('0x25')](0xcc)[_0x4aab('0x2a')]();});}};}function handleEntityNotFound(_0xb76ad9){return function(_0x1d47cb){if(!_0x1d47cb){_0xb76ad9[_0x4aab('0x2b')](0x194);}return _0x1d47cb;};}function handleError(_0x32637b,_0x51041a){_0x51041a=_0x51041a||0x1f4;return function(_0x3f495e){logger[_0x4aab('0x1a')](_0x3f495e[_0x4aab('0x2c')]);if(_0x3f495e['name']){delete _0x3f495e[_0x4aab('0x2d')];}_0x32637b[_0x4aab('0x25')](_0x51041a)[_0x4aab('0x2e')](_0x3f495e);};}exports[_0x4aab('0x2f')]=function(_0x463705,_0x3d3655){var _0x1c0157={},_0x3a22d1={},_0x4e0023={'count':0x0,'rows':[]};var _0x579c96=_[_0x4aab('0x30')](db[_0x4aab('0x31')]['rawAttributes'],function(_0x414a81){return{'name':_0x414a81[_0x4aab('0x32')],'type':_0x414a81[_0x4aab('0x33')][_0x4aab('0x34')]};});_0x3a22d1[_0x4aab('0x35')]=_[_0x4aab('0x30')](_0x579c96,'name');_0x3a22d1[_0x4aab('0x36')]=_[_0x4aab('0x37')](_0x463705[_0x4aab('0x36')]);_0x3a22d1[_0x4aab('0x38')]=_[_0x4aab('0x39')](_0x3a22d1[_0x4aab('0x35')],_0x3a22d1['query']);_0x1c0157[_0x4aab('0x3a')]=_[_0x4aab('0x39')](_0x3a22d1[_0x4aab('0x35')],qs[_0x4aab('0x3b')](_0x463705[_0x4aab('0x36')][_0x4aab('0x3b')]));_0x1c0157['attributes']=_0x1c0157[_0x4aab('0x3a')][_0x4aab('0x3c')]?_0x1c0157[_0x4aab('0x3a')]:_0x3a22d1[_0x4aab('0x35')];if(!_0x463705[_0x4aab('0x36')][_0x4aab('0x3d')]('nolimit')){_0x1c0157[_0x4aab('0x23')]=qs[_0x4aab('0x23')](_0x463705[_0x4aab('0x36')][_0x4aab('0x23')]);_0x1c0157['offset']=qs['offset'](_0x463705[_0x4aab('0x36')][_0x4aab('0x21')]);}_0x1c0157['order']=qs[_0x4aab('0x3e')](_0x463705[_0x4aab('0x36')][_0x4aab('0x3e')]);_0x1c0157[_0x4aab('0x3f')]=qs[_0x4aab('0x38')](_[_0x4aab('0x40')](_0x463705[_0x4aab('0x36')],_0x3a22d1[_0x4aab('0x38')]),_0x579c96);if(_0x463705[_0x4aab('0x36')][_0x4aab('0x41')]){_0x1c0157[_0x4aab('0x3f')]=_[_0x4aab('0x42')](_0x1c0157[_0x4aab('0x3f')],{'$or':_[_0x4aab('0x30')](_0x579c96,function(_0x4fc36b){if(_0x4fc36b[_0x4aab('0x33')]!=='VIRTUAL'){var _0x25d809={};_0x25d809[_0x4fc36b['name']]={'$like':'%'+_0x463705[_0x4aab('0x36')]['filter']+'%'};return _0x25d809;}})});}_0x1c0157=_[_0x4aab('0x42')]({},_0x1c0157,_0x463705[_0x4aab('0x43')]);var _0x5bd33d={'where':_0x1c0157[_0x4aab('0x3f')]};return db[_0x4aab('0x31')][_0x4aab('0x24')](_0x5bd33d)[_0x4aab('0x15')](function(_0x284143){_0x4e0023[_0x4aab('0x24')]=_0x284143;if(_0x463705['query'][_0x4aab('0x44')]){_0x1c0157[_0x4aab('0x45')]=[{'all':!![]}];}return db[_0x4aab('0x31')][_0x4aab('0x46')](_0x1c0157);})[_0x4aab('0x15')](function(_0x3d30b1){_0x4e0023['rows']=_0x3d30b1;return _0x4e0023;})['then'](respondWithFilteredResult(_0x3d3655,_0x1c0157))[_0x4aab('0x1f')](handleError(_0x3d3655,null));};exports[_0x4aab('0x47')]=function(_0x3c2656,_0x9e93ba){var _0x3ae2d6={'raw':!![],'where':{'id':_0x3c2656[_0x4aab('0x48')]['id']}},_0x5a6eae={};_0x5a6eae['model']=_[_0x4aab('0x37')](db[_0x4aab('0x31')]['rawAttributes']);_0x5a6eae[_0x4aab('0x36')]=_[_0x4aab('0x37')](_0x3c2656['query']);_0x5a6eae[_0x4aab('0x38')]=_['intersection'](_0x5a6eae[_0x4aab('0x35')],_0x5a6eae[_0x4aab('0x36')]);_0x3ae2d6[_0x4aab('0x3a')]=_['intersection'](_0x5a6eae['model'],qs[_0x4aab('0x3b')](_0x3c2656[_0x4aab('0x36')][_0x4aab('0x3b')]));_0x3ae2d6[_0x4aab('0x3a')]=_0x3ae2d6['attributes']['length']?_0x3ae2d6['attributes']:_0x5a6eae['model'];if(_0x3c2656[_0x4aab('0x36')][_0x4aab('0x44')]){_0x3ae2d6['include']=[{'all':!![]}];}_0x3ae2d6=_['merge']({},_0x3ae2d6,_0x3c2656[_0x4aab('0x43')]);return db[_0x4aab('0x31')][_0x4aab('0x49')](_0x3ae2d6)[_0x4aab('0x15')](handleEntityNotFound(_0x9e93ba,null))[_0x4aab('0x15')](respondWithResult(_0x9e93ba,null))['catch'](handleError(_0x9e93ba,null));};exports[_0x4aab('0x28')]=function(_0x156391,_0x55d024){if(_0x156391[_0x4aab('0x4a')]['id']){delete _0x156391['body']['id'];}return db[_0x4aab('0x31')]['find']({'where':{'id':_0x156391[_0x4aab('0x48')]['id']}})[_0x4aab('0x15')](handleEntityNotFound(_0x55d024,null))[_0x4aab('0x15')](saveUpdates(_0x156391[_0x4aab('0x4a')],null))[_0x4aab('0x15')](respondWithResult(_0x55d024,null))[_0x4aab('0x1f')](handleError(_0x55d024,null));};exports['destroy']=function(_0x32f3ed,_0x40deb9){return db[_0x4aab('0x31')][_0x4aab('0x49')]({'where':{'id':_0x32f3ed[_0x4aab('0x48')]['id']}})[_0x4aab('0x15')](handleEntityNotFound(_0x40deb9,null))[_0x4aab('0x15')](removeEntity(_0x40deb9,null))[_0x4aab('0x1f')](handleError(_0x40deb9,null));};exports[_0x4aab('0x4b')]=function(_0x2884ce,_0x48b860){return db[_0x4aab('0x31')][_0x4aab('0x4b')]()[_0x4aab('0x15')](respondWithResult(_0x48b860,null))[_0x4aab('0x1f')](handleError(_0x48b860,null));};exports['create']=function(_0x4f03fc,_0x2b0a29){return db[_0x4aab('0x31')][_0x4aab('0x4c')](_0x4f03fc[_0x4aab('0x4a')])['then'](function(_0x393307){if(_0x393307){if(_0x393307[_0x4aab('0x4d')]===_0x4aab('0x4e')&&!_0x393307['secret']){var _0x15f9e5,_0x3f658c,_0x4985b8;if(_0x4f03fc[_0x4aab('0x4a')]['to']){_0x3f658c=_0x4f03fc[_0x4aab('0x4a')]['to']['split'](',')[0x0];}return db[_0x4aab('0x4f')][_0x4aab('0x50')]({'where':{'id':_0x393307[_0x4aab('0x51')]},'include':[{'model':db['CmList'],'as':_0x4aab('0x52'),'include':[{'model':db[_0x4aab('0x53')],'as':_0x4aab('0x54'),'where':{'email':_0x3f658c},'limit':0x1,'order':[[_0x4aab('0x55'),_0x4aab('0x56')]]}]},{'model':db[_0x4aab('0x57')],'as':_0x4aab('0x58'),'raw':!![]}]})[_0x4aab('0x15')](function(_0xdc7db2){_0x15f9e5=_0xdc7db2;if(_0x15f9e5&&_0x15f9e5[_0x4aab('0x58')]){var _0x1a31b0={'tls':{'rejectUnauthorized':![]}};if(_[_0x4aab('0x59')](_0x15f9e5[_0x4aab('0x58')]['service'])){_0x1a31b0[_0x4aab('0x5a')]=_0x15f9e5[_0x4aab('0x58')][_0x4aab('0x5a')];_0x1a31b0[_0x4aab('0x5b')]=_0x15f9e5[_0x4aab('0x58')][_0x4aab('0x5b')];_0x1a31b0[_0x4aab('0x5c')]=_0x15f9e5[_0x4aab('0x58')][_0x4aab('0x5c')];if(_0x15f9e5[_0x4aab('0x58')][_0x4aab('0x5d')]){_0x1a31b0[_0x4aab('0x5e')]={'user':_0x15f9e5[_0x4aab('0x58')][_0x4aab('0x5f')],'pass':_0x15f9e5[_0x4aab('0x58')][_0x4aab('0x60')]};}}else{_0x1a31b0[_0x4aab('0x61')]=_0x15f9e5[_0x4aab('0x58')][_0x4aab('0x61')];_0x1a31b0[_0x4aab('0x5e')]={'user':_0x15f9e5[_0x4aab('0x58')]['user'],'pass':_0x15f9e5[_0x4aab('0x58')][_0x4aab('0x60')]};_0x1a31b0['secure']=_0x15f9e5[_0x4aab('0x58')]['secure'];}if(_0x4f03fc[_0x4aab('0x4a')]['attachments']&&_0x4f03fc['body']['attachments']['length']){for(var _0x58c827=0x0;_0x58c827<_0x4f03fc['body'][_0x4aab('0x62')][_0x4aab('0x3c')];_0x58c827+=0x1){_0x4f03fc[_0x4aab('0x4a')]['attachments'][_0x58c827]={'filename':_0x4f03fc[_0x4aab('0x4a')][_0x4aab('0x62')][_0x58c827][_0x4aab('0x2d')],'path':path['join'](config[_0x4aab('0x63')],_0x4aab('0x64'),_0x4f03fc['body']['attachments'][_0x58c827][_0x4aab('0x65')])};}}_0x4985b8={'account':_0x1a31b0,'message':_0x4f03fc[_0x4aab('0x4a')]};return;}})[_0x4aab('0x15')](function(){if(_0x15f9e5[_0x4aab('0x52')]){if(_0x15f9e5[_0x4aab('0x52')]['Contacts'][_0x4aab('0x3c')]){return _0x15f9e5[_0x4aab('0x52')][_0x4aab('0x54')][0x0];}else{return db[_0x4aab('0x53')][_0x4aab('0x4c')](_[_0x4aab('0xc')](_0x4f03fc[_0x4aab('0x4a')],{'firstName':_0x4f03fc[_0x4aab('0x4a')]['to'],'email':_0x4f03fc[_0x4aab('0x4a')]['to'],'phone':_0x4f03fc['body']['to'],'ListId':_0x15f9e5['ListId']}));}}else{throw new Error('List\x20not\x20found');}})[_0x4aab('0x15')](function(){if(_0x4985b8){return respondWithRpcPromise(_0x4aab('0x66'),_0x4aab('0x67'),_0x4985b8,client9003)[_0x4aab('0x15')](function(_0x34423d){return _0x393307[_0x4aab('0x28')]({'read':!![],'messageId':_0x34423d['messageId'],'sentAt':moment()[_0x4aab('0x68')](_0x4aab('0x69'))});})[_0x4aab('0x1f')](function(_0x294d91){logger[_0x4aab('0x1a')]('%s',JSON[_0x4aab('0x19')](_0x294d91));return _0x393307;});}return _0x393307;});}return _0x393307;}})[_0x4aab('0x15')](respondWithResult(_0x2b0a29,0xc9))['catch'](handleError(_0x2b0a29,null));};exports['accept']=function(_0x31e7ff,_0x1bef35){var _0x13632f={'agent':{},'channel':_0x4aab('0x6a')};if(_0x31e7ff[_0x4aab('0x4a')]['id']){delete _0x31e7ff[_0x4aab('0x4a')]['id'];}_0x31e7ff[_0x4aab('0x4a')][_0x4aab('0x6b')]=!![];_0x31e7ff[_0x4aab('0x4a')][_0x4aab('0x6c')]=moment()[_0x4aab('0x68')](_0x4aab('0x69'));_0x31e7ff[_0x4aab('0x4a')]['UserId']=_0x31e7ff[_0x4aab('0x4a')]['UserId']||_0x31e7ff[_0x4aab('0x5f')]['id'];_0x13632f[_0x4aab('0x6d')]['id']=_0x31e7ff[_0x4aab('0x4a')][_0x4aab('0x6e')];return db[_0x4aab('0x31')][_0x4aab('0x49')]({'where':{'id':_0x31e7ff[_0x4aab('0x48')]['id'],'UserId':null}})[_0x4aab('0x15')](handleEntityNotFound(_0x1bef35,null))['then'](saveUpdates(_0x31e7ff[_0x4aab('0x4a')],null))[_0x4aab('0x15')](function(_0x21fe22){if(_0x21fe22){_0x13632f['message']=_0x21fe22[_0x4aab('0x6f')]({'plain':!![]});return db[_0x4aab('0x70')][_0x4aab('0x49')]({'where':{'id':_0x21fe22[_0x4aab('0x71')]}});}return null;})[_0x4aab('0x15')](handleEntityNotFound(_0x1bef35,null))[_0x4aab('0x15')](function(_0x29e5ed){if(_0x29e5ed){return _0x29e5ed[_0x4aab('0x28')]({'UserId':_0x31e7ff[_0x4aab('0x4a')][_0x4aab('0x6e')],'read1stAt':_['isNil'](_0x29e5ed[_0x4aab('0x72')])?moment()[_0x4aab('0x68')](_0x4aab('0x69')):undefined});}return null;})['then'](function(_0x491adf){if(_0x491adf){_0x13632f[_0x4aab('0x73')]=_0x491adf[_0x4aab('0x6f')]({'plain':!![]});interaction_log[_0x4aab('0x16')](_0x4aab('0x74'),_0x31e7ff[_0x4aab('0x5f')]['id'],_0x31e7ff[_0x4aab('0x5f')][_0x4aab('0x2d')],_0x31e7ff[_0x4aab('0x5f')][_0x4aab('0x75')],_0x13632f[_0x4aab('0x73')]['id'],_0x31e7ff[_0x4aab('0x4a')]?JSON[_0x4aab('0x19')](_0x31e7ff[_0x4aab('0x4a')]):'null');return respondWithRpcPromise(_0x4aab('0x76'),'acceptMessage',_0x13632f);}return null;})['then'](function(_0x422632){var _0x39e980='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x422632[_0x4aab('0x1c')]['ContactId'];return db[_0x4aab('0x77')][_0x4aab('0x36')](_0x39e980,{'type':db[_0x4aab('0x78')][_0x4aab('0x79')][_0x4aab('0x7a')],'raw':!![]})[_0x4aab('0x15')](function(_0x5915f0){return _0x5915f0;});})[_0x4aab('0x15')](function(_0x473481){if(_0x473481){_0x13632f[_0x4aab('0x1c')][_0x4aab('0x7b')]=_0x473481[0x0];if(!_0x31e7ff[_0x4aab('0x4a')][_0x4aab('0x6e')])return;return db[_0x4aab('0x7c')][_0x4aab('0x49')]({'where':{'id':_0x31e7ff[_0x4aab('0x4a')][_0x4aab('0x6e')],'role':'agent'},'attributes':['id','name',_0x4aab('0x7d'),_0x4aab('0x7e'),_0x4aab('0x7f')],'raw':!![]});}return null;})[_0x4aab('0x15')](function(_0x194a76){if(!_0x194a76)return null;_0x13632f[_0x4aab('0x1c')][_0x4aab('0x6d')]=_0x194a76;return _0x13632f;})[_0x4aab('0x15')](function(_0x33161e){if(_0x33161e){if(_0x31e7ff[_0x4aab('0x4a')][_0x4aab('0x80')]){_0x13632f[_0x4aab('0x1c')]['interface']=util[_0x4aab('0x68')]('SIP/%s',_0x31e7ff['user'][_0x4aab('0x2d')]);_0x13632f[_0x4aab('0x1c')][_0x4aab('0x81')]=_0x13632f[_0x4aab('0x81')];_0x13632f[_0x4aab('0x1c')]['motionChannel']=_0x13632f[_0x4aab('0x81')];_0x13632f['message'][_0x4aab('0x82')]=_0x4aab('0x83');_0x13632f[_0x4aab('0x1c')]['body']=htmlToText[_0x4aab('0x84')](_0x13632f[_0x4aab('0x1c')][_0x4aab('0x4a')]);return respondWithRpcPromise(_0x4aab('0x85'),'EventManager',{'event':_0x4aab('0x86'),'message':_0x13632f[_0x4aab('0x1c')]},client9002)[_0x4aab('0x15')](function(){return _0x13632f;});}return _0x13632f;}return null;})[_0x4aab('0x15')](respondWithResult(_0x1bef35,null))[_0x4aab('0x1f')](handleError(_0x1bef35,null));};exports[_0x4aab('0x87')]=function(_0x8be771,_0x469ede){var _0x37bfbe={'agent':{},'channel':_0x4aab('0x6a')};if(_0x8be771[_0x4aab('0x4a')]['id']){delete _0x8be771['body']['id'];}_0x8be771[_0x4aab('0x4a')][_0x4aab('0x6e')]=_0x8be771[_0x4aab('0x4a')][_0x4aab('0x6e')]||_0x8be771['user']['id'];_0x37bfbe[_0x4aab('0x6d')]['id']=_0x8be771[_0x4aab('0x4a')][_0x4aab('0x6e')];return db['MailMessage'][_0x4aab('0x49')]({'where':{'id':_0x8be771[_0x4aab('0x48')]['id'],'UserId':null}})[_0x4aab('0x15')](handleEntityNotFound(_0x469ede,null))[_0x4aab('0x15')](function(_0x33700c){if(_0x33700c){_0x37bfbe['message']=_0x33700c[_0x4aab('0x6f')]({'plain':!![]});return db['MailInteraction'][_0x4aab('0x49')]({'where':{'id':_0x33700c[_0x4aab('0x71')]}});}return null;})[_0x4aab('0x15')](handleEntityNotFound(_0x469ede,null))['then'](function(_0x163bf5){if(_0x163bf5){_0x37bfbe[_0x4aab('0x73')]=_0x163bf5[_0x4aab('0x6f')]({'plain':!![]});interaction_log[_0x4aab('0x16')](_0x4aab('0x88'),_0x8be771[_0x4aab('0x5f')]['id'],_0x8be771[_0x4aab('0x5f')][_0x4aab('0x2d')],_0x8be771[_0x4aab('0x5f')][_0x4aab('0x75')],_0x37bfbe['interaction']['id'],_0x8be771[_0x4aab('0x4a')]?JSON['stringify'](_0x8be771['body']):_0x4aab('0x89'));return respondWithRpcPromise(_0x4aab('0x8a'),_0x4aab('0x8b'),_0x37bfbe);}return null;})['then'](function(_0x2eaae8){var _0x55cb72='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2eaae8[_0x4aab('0x1c')][_0x4aab('0x8c')];return db[_0x4aab('0x77')]['query'](_0x55cb72,{'type':db[_0x4aab('0x78')][_0x4aab('0x79')][_0x4aab('0x7a')],'raw':!![]})[_0x4aab('0x15')](function(_0x297b23){return _0x297b23;});})[_0x4aab('0x15')](function(_0x4e4c28){if(_0x4e4c28){_0x37bfbe[_0x4aab('0x1c')][_0x4aab('0x7b')]=_0x4e4c28[0x0];if(!_0x8be771['body']['UserId'])return;return db[_0x4aab('0x7c')][_0x4aab('0x49')]({'where':{'id':_0x8be771[_0x4aab('0x4a')][_0x4aab('0x6e')],'role':_0x4aab('0x6d')},'attributes':['id','name',_0x4aab('0x7d'),_0x4aab('0x7e'),_0x4aab('0x7f')],'raw':!![]});}return null;})[_0x4aab('0x15')](function(_0x1f26ce){if(!_0x1f26ce)return null;_0x37bfbe[_0x4aab('0x1c')]['agent']=_0x1f26ce;return _0x37bfbe;})[_0x4aab('0x15')](function(_0x3f084e){if(_0x3f084e){_0x3f084e[_0x4aab('0x1c')][_0x4aab('0x8d')]=util[_0x4aab('0x68')](_0x4aab('0x8e'),_0x8be771[_0x4aab('0x5f')]['name']);_0x3f084e['message']['channel']=_0x37bfbe[_0x4aab('0x81')];_0x3f084e[_0x4aab('0x1c')][_0x4aab('0x8f')]=_0x37bfbe[_0x4aab('0x81')];_0x3f084e['message'][_0x4aab('0x82')]=_0x4aab('0x87');_0x3f084e['message']['body']=htmlToText[_0x4aab('0x84')](_0x37bfbe[_0x4aab('0x1c')][_0x4aab('0x4a')]);respondWithRpcPromise(_0x4aab('0x85'),_0x4aab('0x85'),{'event':_0x4aab('0x90'),'message':_0x3f084e[_0x4aab('0x1c')]},client9002);return _0x37bfbe;}return null;})[_0x4aab('0x15')](respondWithResult(_0x469ede,null))['catch'](handleError(_0x469ede,null));};exports[_0x4aab('0x91')]=function(_0x15aff9,_0x43ca53){var _0x238451=moment()[_0x4aab('0x92')]()[_0x4aab('0x93')]();var _0x327c4c=path[_0x4aab('0x94')](config[_0x4aab('0x63')],_0x4aab('0x95'),_0x4aab('0x96'),_0x4aab('0x97'));var _0x2215da=path[_0x4aab('0x94')](config[_0x4aab('0x63')],_0x4aab('0x95'),_0x4aab('0x96'),'attachments');var _0x31c022=util[_0x4aab('0x68')](_0x4aab('0x98'),_0x238451);return db[_0x4aab('0x31')]['find']({'where':{'id':_0x15aff9[_0x4aab('0x48')]['id']},'attributes':['id','body',_0x4aab('0x99'),'to','cc','bcc',_0x4aab('0x9a'),_0x4aab('0x9b')],'include':_0x15aff9['query'][_0x4aab('0x62')]?[{'model':db[_0x4aab('0x9c')],'as':_0x4aab('0x9d')}]:undefined})[_0x4aab('0x15')](handleEntityNotFound(_0x43ca53,null))[_0x4aab('0x15')](function(_0x3e736f){if(_0x3e736f){var _0x269aff=_0x3e736f;var _0x5bd8c1={'from':_0x269aff[_0x4aab('0x99')],'to':_0x269aff['to'],'subject':_0x269aff[_0x4aab('0x9a')],'html':htmlEntities[_0x4aab('0x9e')](_0x269aff['body']),'headers':{'Date':moment(_0x269aff['createdAt'])['format'](_0x4aab('0x9f'))},'attachments':[]};if(_0x3e736f['cc']){_0x5bd8c1[_0x4aab('0xa0')]['Cc']=_0x3e736f['cc'];}if(_0x3e736f[_0x4aab('0xa1')]){_0x5bd8c1[_0x4aab('0xa0')][_0x4aab('0xa2')]=_0x3e736f['bcc'];}return new BPromise(function(_0x544f50,_0x392e43){if(_0x3e736f[_0x4aab('0x9d')]){for(var _0x6926af=0x0;_0x6926af<_0x3e736f[_0x4aab('0x9d')][_0x4aab('0x3c')];_0x6926af++){var _0xaa4637=_0x3e736f[_0x4aab('0x9d')][_0x6926af];var _0x2e2a0a=path[_0x4aab('0x94')](_0x2215da,_0xaa4637[_0x4aab('0x65')]);if(fs['existsSync'](_0x2e2a0a)){_0x5bd8c1[_0x4aab('0x62')]['push']({'name':_0xaa4637[_0x4aab('0x2d')],'contentType':_0xaa4637[_0x4aab('0x33')],'data':fs[_0x4aab('0xa3')](_0x2e2a0a)});}}}emlformat[_0x4aab('0xa4')](_0x5bd8c1,function(_0x5cba5c,_0x184d03){if(_0x5cba5c)return _0x392e43(_0x5cba5c);fs[_0x4aab('0xa5')](path['join'](_0x327c4c,_0x31c022),_0x184d03);return _0x544f50(_0x184d03);});});}})[_0x4aab('0x15')](function(_0xd21824){if(_0xd21824){return _0x43ca53['download'](path['join'](_0x327c4c,_0x31c022),_0x31c022,function(_0x4b1c05){if(!_0x4b1c05)fs[_0x4aab('0xa6')](path['join'](_0x327c4c,_0x31c022));});}})[_0x4aab('0x1f')](handleError(_0x43ca53,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index f23870b..4ff3397 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 _0xb530=['events','../../mysqldb','MailMessage','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb530,0xab));var _0x0b53=function(_0x3f5eff,_0x549733){_0x3f5eff=_0x3f5eff-0x0;var _0x41e6a8=_0xb530[_0x3f5eff];return _0x41e6a8;};'use strict';var EventEmitter=require(_0x0b53('0x0'));var MailMessage=require(_0x0b53('0x1'))['db'][_0x0b53('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0b53('0x3'),'afterUpdate':_0x0b53('0x4'),'afterDestroy':_0x0b53('0x5')};function emitEvent(_0x149b91){return function(_0x4e6bb2,_0x148f9a,_0x9c6fd9){MailMessageEvents[_0x0b53('0x6')](_0x149b91+':'+_0x4e6bb2['id'],_0x4e6bb2);MailMessageEvents[_0x0b53('0x6')](_0x149b91,_0x4e6bb2);_0x9c6fd9(null);};}for(var e in events){if(events[_0x0b53('0x7')](e)){var event=events[e];MailMessage[_0x0b53('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x9d98=['save','update','emit','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x56ea05,_0x286a75){var _0x31734d=function(_0x233cda){while(--_0x233cda){_0x56ea05['push'](_0x56ea05['shift']());}};_0x31734d(++_0x286a75);}(_0x9d98,0x194));var _0x89d9=function(_0x13aaf8,_0xb4319e){_0x13aaf8=_0x13aaf8-0x0;var _0x8420ce=_0x9d98[_0x13aaf8];return _0x8420ce;};'use strict';var EventEmitter=require(_0x89d9('0x0'));var MailMessage=require(_0x89d9('0x1'))['db'][_0x89d9('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x89d9('0x3')](0x0);var events={'afterCreate':_0x89d9('0x4'),'afterUpdate':_0x89d9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2d2f77){return function(_0x4b39b6,_0x3a235f,_0x17780d){MailMessageEvents[_0x89d9('0x6')](_0x2d2f77+':'+_0x4b39b6['id'],_0x4b39b6);MailMessageEvents[_0x89d9('0x6')](_0x2d2f77,_0x4b39b6);_0x17780d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x89d9('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 103e9ea..c146245 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 _0xfe17=['secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','../../config/environment','exports','define','MailMessage','mail_messages','messageId','plainBody','body','fromString','get','direction','toLowerCase'];(function(_0x583f3f,_0x3c209d){var _0x3fcc0a=function(_0x566b77){while(--_0x566b77){_0x583f3f['push'](_0x583f3f['shift']());}};_0x3fcc0a(++_0x3c209d);}(_0xfe17,0xe4));var _0x7fe1=function(_0x3793c5,_0x4d3878){_0x3793c5=_0x3793c5-0x0;var _0x32b0d3=_0xfe17[_0x3793c5];return _0x32b0d3;};'use strict';var _=require(_0x7fe1('0x0'));var util=require(_0x7fe1('0x1'));var logger=require(_0x7fe1('0x2'))(_0x7fe1('0x3'));var moment=require(_0x7fe1('0x4'));var BPromise=require(_0x7fe1('0x5'));var rp=require(_0x7fe1('0x6'));var htmlToText=require(_0x7fe1('0x7'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7fe1('0x8'));var attributes=require('./mailMessage.attributes');module[_0x7fe1('0x9')]=function(_0x2f1f62,_0x277125){return _0x2f1f62[_0x7fe1('0xa')](_0x7fe1('0xb'),attributes,{'tableName':_0x7fe1('0xc'),'paranoid':![],'indexes':[{'name':_0x7fe1('0xd'),'fields':[_0x7fe1('0xd')]},{'name':'fti_mail_messages','fields':[_0x7fe1('0xe'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4ea06a,_0x2293fe,_0x20f0be){if(_0x4ea06a[_0x7fe1('0xf')]){_0x4ea06a[_0x7fe1('0xe')]=htmlToText[_0x7fe1('0x10')](_0x4ea06a[_0x7fe1('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x20f0be(null,_0x2293fe);},'afterCreate':function(_0x43a297,_0x4148dd,_0x2bb4da){var _0x494262=_0x2f1f62['models'];var _0x3d8345=_0x43a297[_0x7fe1('0x11')]({'plain':!![]});if(_0x3d8345[_0x7fe1('0x12')]['toLowerCase']()==='in'||_0x3d8345[_0x7fe1('0x12')][_0x7fe1('0x13')]()==='out'&&!_0x3d8345[_0x7fe1('0x14')]&&!_[_0x7fe1('0x15')](_0x3d8345[_0x7fe1('0x16')])){_0x494262[_0x7fe1('0x17')]['findOne']({'where':{'id':_0x3d8345[_0x7fe1('0x18')]}})[_0x7fe1('0x19')](function(_0x383d61){if(_0x383d61){_0x383d61[_0x7fe1('0x1a')]({'lastMsgAt':_0x3d8345[_0x7fe1('0x1b')],'lastMsgDirection':_0x3d8345[_0x7fe1('0x12')][_0x7fe1('0x13')]()});}})[_0x7fe1('0x1c')](function(_0x4e553a){console[_0x7fe1('0x1d')](_0x4e553a);});}_0x2bb4da();}},'charset':'utf8mb4','collate':_0x7fe1('0x1e')});}; \ No newline at end of file +var _0xf224=['define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','get','direction','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','toLowerCase','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xf224,0x88));var _0x4f22=function(_0xfd05,_0x4e865f){_0xfd05=_0xfd05-0x0;var _0x5e34b6=_0xf224[_0xfd05];return _0x5e34b6;};'use strict';var _=require(_0x4f22('0x0'));var util=require(_0x4f22('0x1'));var logger=require(_0x4f22('0x2'))(_0x4f22('0x3'));var moment=require(_0x4f22('0x4'));var BPromise=require(_0x4f22('0x5'));var rp=require(_0x4f22('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x4f22('0x7'));var rimraf=require(_0x4f22('0x8'));var config=require(_0x4f22('0x9'));var attributes=require(_0x4f22('0xa'));module[_0x4f22('0xb')]=function(_0x3b6ba3,_0x3f989f){return _0x3b6ba3[_0x4f22('0xc')]('MailMessage',attributes,{'tableName':_0x4f22('0xd'),'paranoid':![],'indexes':[{'name':_0x4f22('0xe'),'fields':[_0x4f22('0xe')]},{'name':_0x4f22('0xf'),'fields':[_0x4f22('0x10'),_0x4f22('0x11')],'type':_0x4f22('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2d79bc,_0x295c81,_0x495fce){if(_0x2d79bc[_0x4f22('0x13')]){_0x2d79bc[_0x4f22('0x10')]=htmlToText[_0x4f22('0x14')](_0x2d79bc[_0x4f22('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x495fce(null,_0x295c81);},'afterCreate':function(_0x16b5ab,_0x1d7a0c,_0x26df98){var _0x42f661=_0x3b6ba3['models'];var _0x5e4926=_0x16b5ab[_0x4f22('0x15')]({'plain':!![]});if(_0x5e4926[_0x4f22('0x16')]['toLowerCase']()==='in'||_0x5e4926[_0x4f22('0x16')]['toLowerCase']()===_0x4f22('0x17')&&!_0x5e4926[_0x4f22('0x18')]&&!_[_0x4f22('0x19')](_0x5e4926[_0x4f22('0x1a')])){_0x42f661[_0x4f22('0x1b')][_0x4f22('0x1c')]({'where':{'id':_0x5e4926[_0x4f22('0x1d')]}})[_0x4f22('0x1e')](function(_0x4e5cf5){if(_0x4e5cf5){_0x4e5cf5[_0x4f22('0x1f')]({'lastMsgAt':_0x5e4926[_0x4f22('0x20')],'lastMsgDirection':_0x5e4926[_0x4f22('0x16')][_0x4f22('0x21')]()});}})[_0x4f22('0x22')](function(_0x582dc4){console[_0x4f22('0x23')](_0x582dc4);});}_0x26df98();}},'charset':_0x4f22('0x24'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index a00c7a6..cb52aa8 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 _0x2da6=['defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','MailMessage','create','body','options','info','CreateMailMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x1d3ea7,_0x2283f8){var _0x454e52=function(_0x48db32){while(--_0x48db32){_0x1d3ea7['push'](_0x1d3ea7['shift']());}};_0x454e52(++_0x2283f8);}(_0x2da6,0x1dd));var _0x62da=function(_0x230646,_0x48ad8f){_0x230646=_0x230646-0x0;var _0xfef79c=_0x2da6[_0x230646];return _0xfef79c;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});config[_0x62da('0xc')]=_[_0x62da('0xd')](config[_0x62da('0xc')],{'host':_0x62da('0xe'),'port':0x18eb});var socket=require(_0x62da('0xf'))(new Redis(config['redis']));require(_0x62da('0x10'))[_0x62da('0x11')](socket);function respondWithRpcPromise(_0x2a3d7c,_0x1b68f8,_0x4cd5a2){return new BPromise(function(_0x241090,_0x3afe3b){return client[_0x62da('0x12')](_0x2a3d7c,_0x4cd5a2)[_0x62da('0x13')](function(_0x23be32){logger['info'](_0x62da('0x14'),_0x1b68f8,_0x62da('0x15'));logger[_0x62da('0x16')](_0x62da('0x17'),_0x1b68f8,_0x62da('0x15'),JSON['stringify'](_0x23be32));if(_0x23be32['error']){if(_0x23be32[_0x62da('0x18')][_0x62da('0x19')]===0x1f4){logger[_0x62da('0x18')](_0x62da('0x14'),_0x1b68f8,_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);return _0x3afe3b(_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);}logger[_0x62da('0x18')](_0x62da('0x14'),_0x1b68f8,_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);return _0x241090(_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x1b68f8,_0x62da('0x15'));_0x241090(_0x23be32['result'][_0x62da('0x1a')]);}})[_0x62da('0x1b')](function(_0x15b8d0){logger['error'](_0x62da('0x14'),_0x1b68f8,_0x15b8d0);_0x3afe3b(_0x15b8d0);});});}exports['CreateMailMessage']=function(_0x2e6b7e){var _0x37c15d=this;return new Promise(function(_0x3b90c8,_0x2f7b01){return db[_0x62da('0x1c')][_0x62da('0x1d')](_0x2e6b7e[_0x62da('0x1e')],{'raw':_0x2e6b7e[_0x62da('0x1f')]?_0x2e6b7e[_0x62da('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x62da('0x13')](function(_0x866a76){logger[_0x62da('0x20')](_0x62da('0x21'),_0x2e6b7e);logger[_0x62da('0x16')](_0x62da('0x21'),_0x2e6b7e,JSON[_0x62da('0x22')](_0x866a76));_0x3b90c8(_0x866a76);})['catch'](function(_0x55fd3b){logger['error'](_0x62da('0x21'),_0x55fd3b[_0x62da('0x1a')],_0x2e6b7e);_0x2f7b01(_0x37c15d[_0x62da('0x18')](0x1f4,_0x55fd3b[_0x62da('0x1a')]));});});}; \ No newline at end of file +var _0x63a5=['error','message','result','catch','body','options','raw','CreateMailMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x578c34,_0x384979){var _0x146f27=function(_0x425d57){while(--_0x425d57){_0x578c34['push'](_0x578c34['shift']());}};_0x146f27(++_0x384979);}(_0x63a5,0x18e));var _0x563a=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x63a5[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var moment=require(_0x563a('0x2'));var BPromise=require('bluebird');var rs=require(_0x563a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x563a('0x4'))['db'];var utils=require(_0x563a('0x5'));var logger=require(_0x563a('0x6'))(_0x563a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x563a('0x8')]['http']({'port':0x232a});config[_0x563a('0x9')]=_[_0x563a('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x563a('0xb'))(new Redis(config[_0x563a('0x9')]));require(_0x563a('0xc'))[_0x563a('0xd')](socket);function respondWithRpcPromise(_0x255922,_0xa61ffa,_0xd1b480){return new BPromise(function(_0x381fab,_0x3e97a8){return client[_0x563a('0xe')](_0x255922,_0xd1b480)[_0x563a('0xf')](function(_0x2361dd){logger[_0x563a('0x10')](_0x563a('0x11'),_0xa61ffa,'request\x20sent');logger[_0x563a('0x12')](_0x563a('0x13'),_0xa61ffa,_0x563a('0x14'),JSON[_0x563a('0x15')](_0x2361dd));if(_0x2361dd[_0x563a('0x16')]){if(_0x2361dd[_0x563a('0x16')]['code']===0x1f4){logger[_0x563a('0x16')](_0x563a('0x11'),_0xa61ffa,_0x2361dd[_0x563a('0x16')][_0x563a('0x17')]);return _0x3e97a8(_0x2361dd['error']['message']);}logger[_0x563a('0x16')](_0x563a('0x11'),_0xa61ffa,_0x2361dd['error'][_0x563a('0x17')]);return _0x381fab(_0x2361dd[_0x563a('0x16')][_0x563a('0x17')]);}else{logger[_0x563a('0x10')]('MailMessage,\x20%s,\x20%s',_0xa61ffa,'request\x20sent');_0x381fab(_0x2361dd[_0x563a('0x18')][_0x563a('0x17')]);}})[_0x563a('0x19')](function(_0x526a51){logger['error']('MailMessage,\x20%s,\x20%s',_0xa61ffa,_0x526a51);_0x3e97a8(_0x526a51);});});}exports['CreateMailMessage']=function(_0x40916a){var _0x300956=this;return new Promise(function(_0x26061f,_0x43b7a8){return db['MailMessage']['create'](_0x40916a[_0x563a('0x1a')],{'raw':_0x40916a[_0x563a('0x1b')]?_0x40916a[_0x563a('0x1b')][_0x563a('0x1c')]===undefined?!![]:![]:!![]})[_0x563a('0xf')](function(_0x2dc7e2){logger[_0x563a('0x10')](_0x563a('0x1d'),_0x40916a);logger['debug'](_0x563a('0x1d'),_0x40916a,JSON['stringify'](_0x2dc7e2));_0x26061f(_0x2dc7e2);})[_0x563a('0x19')](function(_0xd3e0ae){logger[_0x563a('0x16')](_0x563a('0x1d'),_0xd3e0ae[_0x563a('0x17')],_0x40916a);_0x43b7a8(_0x300956[_0x563a('0x16')](0x1f4,_0xd3e0ae[_0x563a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 081cb78..9210e69 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 _0x45e4=['remove','emit','removeListener','register','length','mailMessage:','./mailMessage.events','save'];(function(_0x242027,_0x13f270){var _0xc00b6f=function(_0x5b5fcd){while(--_0x5b5fcd){_0x242027['push'](_0x242027['shift']());}};_0xc00b6f(++_0x13f270);}(_0x45e4,0x18e));var _0x445e=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0x45e4[_0x233cb1];return _0x29ee7e;};'use strict';var MailMessageEvents=require(_0x445e('0x0'));var events=[_0x445e('0x1'),_0x445e('0x2'),'update'];function createListener(_0x2c50bc,_0x44ebd6){return function(_0x5301ca){_0x44ebd6[_0x445e('0x3')](_0x2c50bc,_0x5301ca);};}function removeListener(_0x50e99d,_0x343510){return function(){MailMessageEvents[_0x445e('0x4')](_0x50e99d,_0x343510);};}exports[_0x445e('0x5')]=function(_0x45d74a){for(var _0x348bd1=0x0,_0x5ba14c=events[_0x445e('0x6')];_0x348bd1<_0x5ba14c;_0x348bd1++){var _0x527416=events[_0x348bd1];var _0x3ce189=createListener(_0x445e('0x7')+_0x527416,_0x45d74a);MailMessageEvents['on'](_0x527416,_0x3ce189);}}; \ No newline at end of file +var _0x5d7b=['length','mailMessage:','./mailMessage.events','save','remove','update','emit','register'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x5d7b,0x1e2));var _0xb5d7=function(_0x38e191,_0x8d5355){_0x38e191=_0x38e191-0x0;var _0x4af767=_0x5d7b[_0x38e191];return _0x4af767;};'use strict';var MailMessageEvents=require(_0xb5d7('0x0'));var events=[_0xb5d7('0x1'),_0xb5d7('0x2'),_0xb5d7('0x3')];function createListener(_0x496f84,_0x360c9e){return function(_0x2b3f62){_0x360c9e[_0xb5d7('0x4')](_0x496f84,_0x2b3f62);};}function removeListener(_0x48b4af,_0x3486ed){return function(){MailMessageEvents['removeListener'](_0x48b4af,_0x3486ed);};}exports[_0xb5d7('0x5')]=function(_0x370bcb){for(var _0x234565=0x0,_0x294033=events[_0xb5d7('0x6')];_0x234565<_0x294033;_0x234565++){var _0x5e8a9e=events[_0x234565];var _0x4f0157=createListener(_0xb5d7('0x7')+_0x5e8a9e,_0x370bcb);MailMessageEvents['on'](_0x5e8a9e,_0x4f0157);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 48aa456..f01d733 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 _0x0376=['destroy','removeTeams','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0376,0x1e4));var _0x6037=function(_0x1d4e08,_0x129d55){_0x1d4e08=_0x1d4e08-0x0;var _0x4b0398=_0x0376[_0x1d4e08];return _0x4b0398;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6037('0x0'));var timeout=require(_0x6037('0x1'));var express=require(_0x6037('0x2'));var router=express[_0x6037('0x3')]();var fs_extra=require(_0x6037('0x4'));var auth=require(_0x6037('0x5'));var interaction=require(_0x6037('0x6'));var config=require(_0x6037('0x7'));var controller=require(_0x6037('0x8'));router[_0x6037('0x9')]('/',auth[_0x6037('0xa')](),controller[_0x6037('0xb')]);router[_0x6037('0x9')]('/describe',auth[_0x6037('0xa')](),controller[_0x6037('0xc')]);router[_0x6037('0x9')](_0x6037('0xd'),auth['isAuthenticated'](),controller[_0x6037('0xe')]);router[_0x6037('0x9')](_0x6037('0xf'),auth['isAuthenticated'](),controller[_0x6037('0x10')]);router[_0x6037('0x9')](_0x6037('0x11'),auth[_0x6037('0xa')](),controller['getTeams']);router[_0x6037('0x9')](_0x6037('0x12'),auth[_0x6037('0xa')](),controller[_0x6037('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6037('0x14')](_0x6037('0x11'),auth[_0x6037('0xa')](),controller[_0x6037('0x15')]);router['post'](_0x6037('0x12'),auth['isAuthenticated'](),controller[_0x6037('0x16')]);router[_0x6037('0x17')](_0x6037('0xd'),auth[_0x6037('0xa')](),controller[_0x6037('0x18')]);router[_0x6037('0x19')](_0x6037('0xd'),auth['isAuthenticated'](),controller[_0x6037('0x1a')]);router[_0x6037('0x19')](_0x6037('0x11'),auth[_0x6037('0xa')](),controller[_0x6037('0x1b')]);router['delete'](_0x6037('0x12'),auth[_0x6037('0xa')](),controller[_0x6037('0x1c')]);module[_0x6037('0x1d')]=router; \ No newline at end of file +var _0x844c=['addAgents','delete','removeTeams','removeAgents','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getTeams','/:id/users','getAgents','create','/:id/teams','addTeams','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x844c,0x81));var _0xc844=function(_0x233dc0,_0x2866ad){_0x233dc0=_0x233dc0-0x0;var _0x1fc160=_0x844c[_0x233dc0];return _0x1fc160;};'use strict';var multer=require(_0xc844('0x0'));var util=require(_0xc844('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc844('0x2'));var router=express['Router']();var fs_extra=require(_0xc844('0x3'));var auth=require(_0xc844('0x4'));var interaction=require(_0xc844('0x5'));var config=require(_0xc844('0x6'));var controller=require('./mailQueue.controller');router[_0xc844('0x7')]('/',auth[_0xc844('0x8')](),controller[_0xc844('0x9')]);router['get'](_0xc844('0xa'),auth[_0xc844('0x8')](),controller['describe']);router[_0xc844('0x7')](_0xc844('0xb'),auth['isAuthenticated'](),controller[_0xc844('0xc')]);router[_0xc844('0x7')](_0xc844('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0xc844('0x7')]('/:id/teams',auth[_0xc844('0x8')](),controller[_0xc844('0xe')]);router[_0xc844('0x7')](_0xc844('0xf'),auth[_0xc844('0x8')](),controller[_0xc844('0x10')]);router['post']('/',auth[_0xc844('0x8')](),controller[_0xc844('0x11')]);router['post'](_0xc844('0x12'),auth[_0xc844('0x8')](),controller[_0xc844('0x13')]);router[_0xc844('0x14')](_0xc844('0xf'),auth[_0xc844('0x8')](),controller[_0xc844('0x15')]);router['put']('/:id',auth[_0xc844('0x8')](),controller['update']);router[_0xc844('0x16')]('/:id',auth[_0xc844('0x8')](),controller['destroy']);router[_0xc844('0x16')](_0xc844('0x12'),auth[_0xc844('0x8')](),controller[_0xc844('0x17')]);router[_0xc844('0x16')](_0xc844('0xf'),auth[_0xc844('0x8')](),controller[_0xc844('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index f15e1e7..205d258 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 _0x99a3=['rrmemory','beepall','sequelize','exports','STRING','name','ENUM'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x99a3,0x11a));var _0x399a=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0x99a3[_0x1ff2ec];return _0x405683;};'use strict';var Sequelize=require(_0x399a('0x0'));module[_0x399a('0x1')]={'name':{'type':Sequelize[_0x399a('0x2')],'unique':_0x399a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x399a('0x4')](_0x399a('0x5'),_0x399a('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x34fc=['sequelize','exports','STRING','INTEGER','rrmemory','beepall'];(function(_0x14cb63,_0x5ac86f){var _0x576db6=function(_0x34fe6d){while(--_0x34fe6d){_0x14cb63['push'](_0x14cb63['shift']());}};_0x576db6(++_0x5ac86f);}(_0x34fc,0x1b0));var _0xc34f=function(_0x2fffbc,_0x46d504){_0x2fffbc=_0x2fffbc-0x0;var _0x2cb7cc=_0x34fc[_0x2fffbc];return _0x2cb7cc;};'use strict';var Sequelize=require(_0xc34f('0x0'));module[_0xc34f('0x1')]={'name':{'type':Sequelize[_0xc34f('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc34f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc34f('0x4'),_0xc34f('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 5500699..2c9cd8c 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 _0xb49d=['userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','MailQueueId','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','mailPause','getTeams','Team','addTeams','ids','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues','join','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','emit','userMailQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','rawAttributes','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','MailQueues','UserProfileResource','stack','name','send','index','map','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','MailQueue','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','get','role','UserProfileSection','find'];(function(_0x13ff53,_0x5e1424){var _0x290228=function(_0x3e3133){while(--_0x3e3133){_0x13ff53['push'](_0x13ff53['shift']());}};_0x290228(++_0x5e1424);}(_0xb49d,0x1f1));var _0xdb49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb49d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb49('0x0'));var zipdir=require(_0xdb49('0x1'));var jsonpatch=require(_0xdb49('0x2'));var rp=require(_0xdb49('0x3'));var moment=require(_0xdb49('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdb49('0x5'));var util=require(_0xdb49('0x6'));var path=require(_0xdb49('0x7'));var sox=require(_0xdb49('0x8'));var csv=require(_0xdb49('0x9'));var ejs=require(_0xdb49('0xa'));var fs=require('fs');var fs_extra=require(_0xdb49('0xb'));var _=require(_0xdb49('0xc'));var squel=require(_0xdb49('0xd'));var crypto=require(_0xdb49('0xe'));var jsforce=require(_0xdb49('0xf'));var deskjs=require(_0xdb49('0x10'));var toCsv=require(_0xdb49('0x9'));var querystring=require(_0xdb49('0x11'));var Papa=require(_0xdb49('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdb49('0x13'));var as=require(_0xdb49('0x14'));var hardwareService=require(_0xdb49('0x15'));var logger=require(_0xdb49('0x16'))(_0xdb49('0x17'));var utils=require(_0xdb49('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xdb49('0x19'));var db=require(_0xdb49('0x1a'))['db'];config['redis']=_['defaults'](config[_0xdb49('0x1b')],{'host':_0xdb49('0x1c'),'port':0x18eb});var socket=require(_0xdb49('0x1d'))(new Redis(config[_0xdb49('0x1b')]));require(_0xdb49('0x1e'))[_0xdb49('0x1f')](socket);function respondWithStatusCode(_0x477dda,_0x2b5c1f){_0x2b5c1f=_0x2b5c1f||0xcc;return function(_0x11ac72){if(_0x11ac72){return _0x477dda['sendStatus'](_0x2b5c1f);}return _0x477dda[_0xdb49('0x20')](_0x2b5c1f)[_0xdb49('0x21')]();};}function respondWithResult(_0x5200e5,_0x170e49){_0x170e49=_0x170e49||0xc8;return function(_0x541c1f){if(_0x541c1f){return _0x5200e5[_0xdb49('0x20')](_0x170e49)[_0xdb49('0x22')](_0x541c1f);}};}function respondWithFilteredResult(_0x29124a,_0x118b0b){return function(_0x2562e3){if(_0x2562e3){var _0x42e4ac=typeof _0x118b0b[_0xdb49('0x23')]===_0xdb49('0x24')&&typeof _0x118b0b[_0xdb49('0x25')]==='undefined';var _0x33cf0f=_0x2562e3['count'];var _0x920af0=_0x42e4ac?0x0:_0x118b0b['offset'];var _0x84d79e=_0x42e4ac?_0x2562e3[_0xdb49('0x26')]:_0x118b0b[_0xdb49('0x23')]+_0x118b0b[_0xdb49('0x25')];var _0x410333;if(_0x84d79e>=_0x33cf0f){_0x84d79e=_0x33cf0f;_0x410333=0xc8;}else{_0x410333=0xce;}_0x29124a[_0xdb49('0x20')](_0x410333);return _0x29124a[_0xdb49('0x27')]('Content-Range',_0x920af0+'-'+_0x84d79e+'/'+_0x33cf0f)[_0xdb49('0x22')](_0x2562e3);}return null;};}function patchUpdates(_0x52b3aa){return function(_0x5e1752){try{jsonpatch[_0xdb49('0x28')](_0x5e1752,_0x52b3aa,!![]);}catch(_0x2c822a){return BPromise[_0xdb49('0x29')](_0x2c822a);}return _0x5e1752[_0xdb49('0x2a')]();};}function saveUpdates(_0x2f2ad1,_0x4d911f){return function(_0x23b563){if(_0x23b563){return _0x23b563[_0xdb49('0x2b')](_0x2f2ad1)[_0xdb49('0x2c')](function(_0x2d2dc0){return _0x2d2dc0;});}return null;};}function removeEntity(_0x31bc1f,_0x530134){return function(_0x3906e0){if(_0x3906e0){return _0x3906e0[_0xdb49('0x2d')]()['then'](function(){var _0x1013e2=_0x3906e0['get']({'plain':!![]});var _0x996040=_0xdb49('0x2e');return db[_0xdb49('0x2f')][_0xdb49('0x2d')]({'where':{'type':_0x996040,'resourceId':_0x1013e2['id']}})['then'](function(){return _0x3906e0;});})['then'](function(){_0x31bc1f['status'](0xcc)[_0xdb49('0x21')]();});}};}function handleEntityNotFound(_0x58f7c9,_0x1806c7){return function(_0x49e42c){if(!_0x49e42c){_0x58f7c9['sendStatus'](0x194);}return _0x49e42c;};}function handleError(_0x849a15,_0x251259){_0x251259=_0x251259||0x1f4;return function(_0xdd8877){logger['error'](_0xdd8877[_0xdb49('0x30')]);if(_0xdd8877['name']){delete _0xdd8877[_0xdb49('0x31')];}_0x849a15[_0xdb49('0x20')](_0x251259)[_0xdb49('0x32')](_0xdd8877);};}exports[_0xdb49('0x33')]=function(_0x3d693e,_0x594996){var _0x324905={},_0x1f122c={},_0x36d1f2={'count':0x0,'rows':[]};var _0x57194d=_[_0xdb49('0x34')](db['MailQueue']['rawAttributes'],function(_0x248396){return{'name':_0x248396['fieldName'],'type':_0x248396['type']['key']};});_0x1f122c[_0xdb49('0x35')]=_[_0xdb49('0x34')](_0x57194d,_0xdb49('0x31'));_0x1f122c[_0xdb49('0x36')]=_['keys'](_0x3d693e[_0xdb49('0x36')]);_0x1f122c[_0xdb49('0x37')]=_[_0xdb49('0x38')](_0x1f122c[_0xdb49('0x35')],_0x1f122c[_0xdb49('0x36')]);_0x324905[_0xdb49('0x39')]=_['intersection'](_0x1f122c['model'],qs[_0xdb49('0x3a')](_0x3d693e[_0xdb49('0x36')][_0xdb49('0x3a')]));_0x324905['attributes']=_0x324905[_0xdb49('0x39')][_0xdb49('0x3b')]?_0x324905[_0xdb49('0x39')]:_0x1f122c[_0xdb49('0x35')];if(!_0x3d693e[_0xdb49('0x36')][_0xdb49('0x3c')](_0xdb49('0x3d'))){_0x324905['limit']=qs[_0xdb49('0x25')](_0x3d693e['query']['limit']);_0x324905[_0xdb49('0x23')]=qs['offset'](_0x3d693e[_0xdb49('0x36')][_0xdb49('0x23')]);}_0x324905[_0xdb49('0x3e')]=qs[_0xdb49('0x3f')](_0x3d693e[_0xdb49('0x36')][_0xdb49('0x3f')]);_0x324905['where']=qs[_0xdb49('0x37')](_[_0xdb49('0x40')](_0x3d693e[_0xdb49('0x36')],_0x1f122c[_0xdb49('0x37')]),_0x57194d);if(_0x3d693e[_0xdb49('0x36')][_0xdb49('0x41')]){_0x324905[_0xdb49('0x42')]=_[_0xdb49('0x43')](_0x324905[_0xdb49('0x42')],{'$or':_[_0xdb49('0x34')](_0x57194d,function(_0x1e11cd){if(_0x1e11cd[_0xdb49('0x44')]!==_0xdb49('0x45')){var _0x5d26b2={};_0x5d26b2[_0x1e11cd[_0xdb49('0x31')]]={'$like':'%'+_0x3d693e[_0xdb49('0x36')][_0xdb49('0x41')]+'%'};return _0x5d26b2;}})});}_0x324905=_['merge']({},_0x324905,_0x3d693e[_0xdb49('0x46')]);var _0x3409aa={'where':_0x324905['where']};return db[_0xdb49('0x47')][_0xdb49('0x26')](_0x3409aa)[_0xdb49('0x2c')](function(_0x35c633){_0x36d1f2[_0xdb49('0x26')]=_0x35c633;if(_0x3d693e['query'][_0xdb49('0x48')]){_0x324905[_0xdb49('0x49')]=[{'all':!![]}];}return db['MailQueue'][_0xdb49('0x4a')](_0x324905);})[_0xdb49('0x2c')](function(_0x322323){_0x36d1f2[_0xdb49('0x4b')]=_0x322323;return _0x36d1f2;})['then'](respondWithFilteredResult(_0x594996,_0x324905))[_0xdb49('0x4c')](handleError(_0x594996,null));};exports[_0xdb49('0x4d')]=function(_0x51e3c4,_0x32f298){var _0x534c0b={'raw':!![],'where':{'id':_0x51e3c4[_0xdb49('0x4e')]['id']}},_0x55d80e={};_0x55d80e[_0xdb49('0x35')]=_[_0xdb49('0x4f')](db[_0xdb49('0x47')]['rawAttributes']);_0x55d80e['query']=_['keys'](_0x51e3c4['query']);_0x55d80e['filters']=_['intersection'](_0x55d80e[_0xdb49('0x35')],_0x55d80e['query']);_0x534c0b[_0xdb49('0x39')]=_[_0xdb49('0x38')](_0x55d80e[_0xdb49('0x35')],qs[_0xdb49('0x3a')](_0x51e3c4[_0xdb49('0x36')]['fields']));_0x534c0b[_0xdb49('0x39')]=_0x534c0b[_0xdb49('0x39')]['length']?_0x534c0b[_0xdb49('0x39')]:_0x55d80e[_0xdb49('0x35')];if(_0x51e3c4[_0xdb49('0x36')]['includeAll']){_0x534c0b['include']=[{'all':!![]}];}_0x534c0b=_[_0xdb49('0x43')]({},_0x534c0b,_0x51e3c4[_0xdb49('0x46')]);return db[_0xdb49('0x47')]['find'](_0x534c0b)[_0xdb49('0x2c')](handleEntityNotFound(_0x32f298,null))[_0xdb49('0x2c')](respondWithResult(_0x32f298,null))[_0xdb49('0x4c')](handleError(_0x32f298,null));};exports[_0xdb49('0x50')]=function(_0x411280,_0x46189d){return db['MailQueue'][_0xdb49('0x50')](_0x411280[_0xdb49('0x51')],{})[_0xdb49('0x2c')](function(_0x26642b){var _0x46d14d=_0x411280[_0xdb49('0x52')][_0xdb49('0x53')]({'plain':!![]});if(!_0x46d14d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46d14d[_0xdb49('0x54')]===_0xdb49('0x52')){var _0x1cdf24=_0x26642b[_0xdb49('0x53')]({'plain':!![]});var _0x777796='MailQueues';return db[_0xdb49('0x55')][_0xdb49('0x56')]({'where':{'name':_0x777796,'userProfileId':_0x46d14d[_0xdb49('0x57')]},'raw':!![]})['then'](function(_0x49f404){if(_0x49f404&&_0x49f404[_0xdb49('0x58')]===0x0){return db[_0xdb49('0x2f')][_0xdb49('0x50')]({'name':_0x1cdf24[_0xdb49('0x31')],'resourceId':_0x1cdf24['id'],'type':_0x49f404[_0xdb49('0x31')],'sectionId':_0x49f404['id']},{})[_0xdb49('0x2c')](function(){return _0x26642b;});}else{return _0x26642b;}})['catch'](function(_0xb6469){logger[_0xdb49('0x59')](_0xdb49('0x5a'),_0xb6469);throw _0xb6469;});}return _0x26642b;})['then'](respondWithResult(_0x46189d,0xc9))['catch'](handleError(_0x46189d,null));};exports['update']=function(_0xddb1ef,_0x4e1c3f){if(_0xddb1ef[_0xdb49('0x51')]['id']){delete _0xddb1ef[_0xdb49('0x51')]['id'];}return db[_0xdb49('0x47')]['find']({'where':{'id':_0xddb1ef[_0xdb49('0x4e')]['id']}})[_0xdb49('0x2c')](handleEntityNotFound(_0x4e1c3f,null))[_0xdb49('0x2c')](saveUpdates(_0xddb1ef['body'],null))[_0xdb49('0x2c')](respondWithResult(_0x4e1c3f,null))['catch'](handleError(_0x4e1c3f,null));};exports[_0xdb49('0x2d')]=function(_0x9fb0bb,_0x55f539){return db[_0xdb49('0x47')]['find']({'where':{'id':_0x9fb0bb[_0xdb49('0x4e')]['id']}})[_0xdb49('0x2c')](handleEntityNotFound(_0x55f539,null))[_0xdb49('0x2c')](removeEntity(_0x55f539,null))[_0xdb49('0x4c')](handleError(_0x55f539,null));};exports[_0xdb49('0x5b')]=function(_0x78b53d,_0x26908a){return db[_0xdb49('0x47')][_0xdb49('0x5b')]()['then'](respondWithResult(_0x26908a,null))['catch'](handleError(_0x26908a,null));};exports[_0xdb49('0x5c')]=function(_0x3038df,_0x5c5852,_0x2fb241){var _0x117575={'raw':!![],'where':{}},_0x3b2503={},_0x4012c1;return db['MailQueue'][_0xdb49('0x5d')]({'where':{'id':_0x3038df[_0xdb49('0x4e')]['id']}})[_0xdb49('0x2c')](handleEntityNotFound(_0x5c5852,null))[_0xdb49('0x2c')](function(_0x5b1cf3){if(_0x5b1cf3){_0x4012c1=_0x5b1cf3[_0xdb49('0x53')]({'plain':!![]});_0x3b2503[_0xdb49('0x35')]=_[_0xdb49('0x4f')](db[_0xdb49('0x5e')]['rawAttributes']);_0x3b2503[_0xdb49('0x36')]=_[_0xdb49('0x4f')](_0x3038df['query']);_0x3b2503[_0xdb49('0x37')]=_[_0xdb49('0x38')](_0x3b2503[_0xdb49('0x35')],_0x3b2503[_0xdb49('0x36')]);_0x117575['attributes']=_[_0xdb49('0x38')](_0x3b2503[_0xdb49('0x35')],qs[_0xdb49('0x3a')](_0x3038df[_0xdb49('0x36')][_0xdb49('0x3a')]));_0x117575[_0xdb49('0x39')]=_0x117575[_0xdb49('0x39')]['length']?_0x117575[_0xdb49('0x39')]:_0x3b2503[_0xdb49('0x35')];if(!_0x3038df[_0xdb49('0x36')][_0xdb49('0x3c')](_0xdb49('0x3d'))){_0x117575['limit']=qs[_0xdb49('0x25')](_0x3038df[_0xdb49('0x36')]['limit']);_0x117575['offset']=qs[_0xdb49('0x23')](_0x3038df[_0xdb49('0x36')]['offset']);}_0x117575[_0xdb49('0x3e')]=qs[_0xdb49('0x3f')](_0x3038df['query'][_0xdb49('0x3f')]);_0x117575[_0xdb49('0x42')]=qs[_0xdb49('0x37')](_['pick'](_0x3038df[_0xdb49('0x36')],_0x3b2503[_0xdb49('0x37')]));_0x117575[_0xdb49('0x42')][_0xdb49('0x5f')]=_0x5b1cf3['id'];if(_0x3038df[_0xdb49('0x36')]['filter']){_0x117575['where']=_[_0xdb49('0x43')](_0x117575[_0xdb49('0x42')],{'$or':_[_0xdb49('0x34')](_0x117575[_0xdb49('0x39')],function(_0x486b4e){var _0x41b2a6={};_0x41b2a6[_0x486b4e]={'$like':'%'+_0x3038df['query'][_0xdb49('0x41')]+'%'};return _0x41b2a6;})});}_0x117575=_['merge']({},_0x117575,_0x3038df[_0xdb49('0x46')]);return db[_0xdb49('0x5e')][_0xdb49('0x4a')](_0x117575);}})[_0xdb49('0x2c')](function(_0xf10f0f){if(_0xf10f0f){return db['User']['findAndCountAll']({'where':{'id':_[_0xdb49('0x34')](_0xf10f0f,_0xdb49('0x60')),'role':_0xdb49('0x61')},'attributes':['id','name','mailPause',_0xdb49('0x62'),_0xdb49('0x63')]});}})[_0xdb49('0x2c')](function(_0x509d43){if(_0x509d43){return{'count':_0x509d43[_0xdb49('0x26')],'rows':_[_0xdb49('0x34')](_0x509d43['rows'],function(_0x211093){return{'membername':_0x211093['name'],'UserId':_0x211093['id'],'queue_name':_0x4012c1[_0xdb49('0x31')],'MailQueueId':_0x4012c1['id'],'interface':util[_0xdb49('0x64')](_0xdb49('0x65'),_0xdb49('0x66'),_0x211093[_0xdb49('0x31')]),'penalty':0x0,'paused':_0x211093[_0xdb49('0x67')],'createdAt':_0x211093[_0xdb49('0x63')],'updatedAt':_0x211093[_0xdb49('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5c5852,_0x117575))[_0xdb49('0x4c')](handleError(_0x5c5852,null));};exports[_0xdb49('0x68')]=function(_0x5bb324,_0x3d3821,_0x36e8d2){var _0x3a7f46={};var _0x43a002={};var _0x558eaa;var _0x423c91;return db[_0xdb49('0x47')]['findOne']({'where':{'id':_0x5bb324[_0xdb49('0x4e')]['id']}})[_0xdb49('0x2c')](handleEntityNotFound(_0x3d3821,null))[_0xdb49('0x2c')](function(_0xa535af){if(_0xa535af){_0x558eaa=_0xa535af;_0x43a002['model']=_[_0xdb49('0x4f')](db[_0xdb49('0x69')]['rawAttributes']);_0x43a002['query']=_[_0xdb49('0x4f')](_0x5bb324[_0xdb49('0x36')]);_0x43a002[_0xdb49('0x37')]=_[_0xdb49('0x38')](_0x43a002[_0xdb49('0x35')],_0x43a002[_0xdb49('0x36')]);_0x3a7f46[_0xdb49('0x39')]=_['intersection'](_0x43a002[_0xdb49('0x35')],qs[_0xdb49('0x3a')](_0x5bb324[_0xdb49('0x36')]['fields']));_0x3a7f46[_0xdb49('0x39')]=_0x3a7f46[_0xdb49('0x39')][_0xdb49('0x3b')]?_0x3a7f46[_0xdb49('0x39')]:_0x43a002[_0xdb49('0x35')];_0x3a7f46[_0xdb49('0x3e')]=qs[_0xdb49('0x3f')](_0x5bb324[_0xdb49('0x36')][_0xdb49('0x3f')]);_0x3a7f46[_0xdb49('0x42')]=qs[_0xdb49('0x37')](_['pick'](_0x5bb324[_0xdb49('0x36')],_0x43a002['filters']));if(_0x5bb324[_0xdb49('0x36')]['filter']){_0x3a7f46[_0xdb49('0x42')]=_[_0xdb49('0x43')](_0x3a7f46[_0xdb49('0x42')],{'$or':_['map'](_0x3a7f46[_0xdb49('0x39')],function(_0x44d476){var _0x493e3e={};_0x493e3e[_0x44d476]={'$like':'%'+_0x5bb324[_0xdb49('0x36')][_0xdb49('0x41')]+'%'};return _0x493e3e;})});}_0x3a7f46=_['merge']({},_0x3a7f46,_0x5bb324['options']);return _0x558eaa['getTeams'](_0x3a7f46);}})[_0xdb49('0x2c')](function(_0xaeb5fe){if(_0xaeb5fe){_0x423c91=_0xaeb5fe[_0xdb49('0x3b')];if(!_0x5bb324[_0xdb49('0x36')][_0xdb49('0x3c')](_0xdb49('0x3d'))){_0x3a7f46['limit']=qs['limit'](_0x5bb324[_0xdb49('0x36')][_0xdb49('0x25')]);_0x3a7f46[_0xdb49('0x23')]=qs[_0xdb49('0x23')](_0x5bb324['query']['offset']);}return _0x558eaa[_0xdb49('0x68')](_0x3a7f46);}})['then'](function(_0x5a7780){if(_0x5a7780){return _0x5a7780?{'count':_0x423c91,'rows':_0x5a7780}:null;}})[_0xdb49('0x2c')](respondWithResult(_0x3d3821,null))[_0xdb49('0x4c')](handleError(_0x3d3821,null));};exports[_0xdb49('0x6a')]=function(_0x5182ed,_0x486788,_0x3567bb){var _0x14df7c=_0x5182ed[_0xdb49('0x51')][_0xdb49('0x6b')];return db['Team'][_0xdb49('0x4a')]({'where':{'id':_0x14df7c},'attributes':['id'],'include':[{'model':db[_0xdb49('0x6c')],'as':_0xdb49('0x6d'),'attributes':['id','name','online',_0xdb49('0x6e'),_0xdb49('0x6f')],'raw':!![]}]})[_0xdb49('0x2c')](function(_0x502005){if(_0x502005){var _0x3b7f59=_[_0xdb49('0x70')](_0x502005,function(_0x2d66d5){var _0x3d2df6=_0x2d66d5['get']({'plain':!![]});return _0x3d2df6[_0xdb49('0x6d')];});return db[_0xdb49('0x47')][_0xdb49('0x56')]({'where':{'id':_0x5182ed[_0xdb49('0x4e')]['id']}})[_0xdb49('0x2c')](function(_0x58b1bd){return db[_0xdb49('0x71')][_0xdb49('0x72')](function(_0x215f05){return _0x58b1bd[_0xdb49('0x6a')](_0x14df7c,{'transaction':_0x215f05})[_0xdb49('0x2c')](function(){return BPromise[_0xdb49('0x73')](_0x3b7f59,function(_0x115353){return db[_0xdb49('0x5e')][_0xdb49('0x74')]({'where':{'UserId':_0x115353['id'],'MailQueueId':_0x5182ed[_0xdb49('0x4e')]['id']},'transaction':_0x215f05});});})[_0xdb49('0x2c')](function(){_0x3b7f59[_0xdb49('0x75')](function(_0x429448){socket['emit'](_0xdb49('0x76'),{'UserId':_0x429448['id'],'MailQueueId':_0x58b1bd['id']});});});});});}})['then'](respondWithStatusCode(_0x486788,null))[_0xdb49('0x4c')](handleError(_0x486788,null));};exports['removeTeams']=function(_0x1493b8,_0x373e55,_0x518344){return db[_0xdb49('0x69')][_0xdb49('0x4a')]({'where':{'id':_0x1493b8['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xdb49('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xdb49('0x2c')](handleEntityNotFound(_0x373e55,null))['then'](function(_0x22f90d){var _0x251c33=_[_0xdb49('0x34')](_0x22f90d,'id');var _0x52aaa6=[];var _0x5b3956=[];var _0x7fe869=squel[_0xdb49('0x77')]();_0x7fe869[_0xdb49('0x78')](_0xdb49('0x79'))[_0xdb49('0x7a')](_0xdb49('0x7b'),'tq')[_0xdb49('0x7c')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xdb49('0x42')](_0xdb49('0x7d'),_0x1493b8[_0xdb49('0x4e')]['id']);for(var _0x130cb5=0x0;_0x130cb5<_0x22f90d[_0xdb49('0x3b')];_0x130cb5+=0x1){let _0x643678=_0x22f90d[_0x130cb5];for(var _0x4a3314=0x0;_0x4a3314<_0x643678[_0xdb49('0x6d')][_0xdb49('0x3b')];_0x4a3314+=0x1){let _0x3d925d=_0x643678[_0xdb49('0x6d')][_0x4a3314];var _0x2a492d=_0x7fe869[_0xdb49('0x7e')]();_0x2a492d['where'](_0xdb49('0x7f'),_0x3d925d['id']);_0x5b3956['push'](db['sequelize'][_0xdb49('0x36')](_0x2a492d[_0xdb49('0x80')](),{'type':db[_0xdb49('0x71')]['QueryTypes'][_0xdb49('0x81')]})[_0xdb49('0x2c')](function(_0x282161){if(_0x282161[_0xdb49('0x3b')]===0x1){return _0x3d925d['id'];}else{var _0x57b8ae=_['every'](_['map'](_0x282161,_0xdb49('0x82')),function(_0x256d3e){return _[_0xdb49('0x83')](_0x251c33,_0x256d3e);});if(_0x57b8ae){return _0x3d925d['id'];}}}));}}return BPromise[_0xdb49('0x84')](_0x5b3956)[_0xdb49('0x2c')](function(_0x16c451){_0x52aaa6=_(_0x52aaa6)[_0xdb49('0x85')](_0x16c451)[_0xdb49('0x86')]()[_0xdb49('0x87')]();return db[_0xdb49('0x47')][_0xdb49('0x56')]({'where':{'id':_0x1493b8[_0xdb49('0x4e')]['id']}})[_0xdb49('0x2c')](function(_0x3f8e8c){return db['sequelize'][_0xdb49('0x72')](function(_0x20c899){return _0x3f8e8c[_0xdb49('0x88')](_0x1493b8['query'][_0xdb49('0x6b')],{'transaction':_0x20c899})['then'](function(){if(!_[_0xdb49('0x89')](_0x52aaa6)){return _0x3f8e8c['removeAgents'](_0x52aaa6,{'transaction':_0x20c899});}})[_0xdb49('0x2c')](function(){_0x52aaa6[_0xdb49('0x75')](function(_0x19fcdc){socket[_0xdb49('0x8a')](_0xdb49('0x8b'),{'UserId':_0x19fcdc,'MailQueueId':_0x3f8e8c['id']});});});});});});})[_0xdb49('0x2c')](respondWithStatusCode(_0x373e55,null))['catch'](handleError(_0x373e55,null));};exports[_0xdb49('0x8c')]=function(_0x19d376,_0x15aedd,_0x3b6b39){return db[_0xdb49('0x47')][_0xdb49('0x56')]({'where':{'id':_0x19d376[_0xdb49('0x4e')]['id']}})[_0xdb49('0x2c')](handleEntityNotFound(_0x15aedd,null))[_0xdb49('0x2c')](function(_0x506cf1){if(_0x506cf1){return _0x506cf1['addAgents'](_0x19d376[_0xdb49('0x51')][_0xdb49('0x6b')],_['omit'](_0x19d376[_0xdb49('0x51')],[_0xdb49('0x6b'),'id'])||{})[_0xdb49('0x8d')](function(_0x143656){for(var _0x97c941=0x0;_0x97c941<_0x19d376[_0xdb49('0x51')][_0xdb49('0x6b')][_0xdb49('0x3b')];_0x97c941+=0x1){socket['emit'](_0xdb49('0x76'),{'UserId':Number(_0x19d376[_0xdb49('0x51')]['ids'][_0x97c941]),'MailQueueId':Number(_0x19d376['params']['id'])});}return _0x143656;});}})[_0xdb49('0x2c')](respondWithResult(_0x15aedd,null))[_0xdb49('0x4c')](handleError(_0x15aedd,null));};exports[_0xdb49('0x8e')]=function(_0x4347f2,_0x58e819,_0x140832){return db[_0xdb49('0x47')][_0xdb49('0x56')]({'where':{'id':_0x4347f2[_0xdb49('0x4e')]['id']}})[_0xdb49('0x2c')](handleEntityNotFound(_0x58e819,null))[_0xdb49('0x2c')](function(_0x10ae44){if(_0x10ae44){return _0x10ae44[_0xdb49('0x8e')](_0x4347f2[_0xdb49('0x36')][_0xdb49('0x6b')])[_0xdb49('0x2c')](function(){if(_[_0xdb49('0x8f')](_0x4347f2[_0xdb49('0x36')]['ids'])){for(var _0x58a663=0x0;_0x58a663<_0x4347f2['query'][_0xdb49('0x6b')][_0xdb49('0x3b')];_0x58a663+=0x1){socket[_0xdb49('0x8a')](_0xdb49('0x8b'),{'UserId':Number(_0x4347f2[_0xdb49('0x36')][_0xdb49('0x6b')][_0x58a663]),'MailQueueId':Number(_0x4347f2[_0xdb49('0x4e')]['id'])});}}else{socket[_0xdb49('0x8a')](_0xdb49('0x8b'),{'UserId':Number(_0x4347f2[_0xdb49('0x36')][_0xdb49('0x6b')]),'MailQueueId':Number(_0x4347f2[_0xdb49('0x4e')]['id'])});}});}})[_0xdb49('0x2c')](respondWithStatusCode(_0x58e819,null))[_0xdb49('0x4c')](handleError(_0x58e819,null));};exports[_0xdb49('0x90')]=function(_0x18538d,_0x519d99,_0x4ac568){var _0x2d6858={};var _0x17ca14={};var _0x238026;var _0x4fa2c7;return db[_0xdb49('0x47')][_0xdb49('0x5d')]({'where':{'id':_0x18538d[_0xdb49('0x4e')]['id']}})[_0xdb49('0x2c')](handleEntityNotFound(_0x519d99,null))[_0xdb49('0x2c')](function(_0x100152){if(_0x100152){_0x238026=_0x100152;_0x17ca14['model']=_[_0xdb49('0x4f')](db[_0xdb49('0x6c')][_0xdb49('0x91')]);_0x17ca14[_0xdb49('0x36')]=_[_0xdb49('0x4f')](_0x18538d[_0xdb49('0x36')]);_0x17ca14[_0xdb49('0x37')]=_['intersection'](_0x17ca14['model'],_0x17ca14['query']);_0x2d6858[_0xdb49('0x39')]=_['intersection'](_0x17ca14[_0xdb49('0x35')],qs[_0xdb49('0x3a')](_0x18538d[_0xdb49('0x36')][_0xdb49('0x3a')]));_0x2d6858[_0xdb49('0x39')]=_0x2d6858[_0xdb49('0x39')][_0xdb49('0x3b')]?_0x2d6858[_0xdb49('0x39')]:_0x17ca14[_0xdb49('0x35')];_0x2d6858[_0xdb49('0x3e')]=qs[_0xdb49('0x3f')](_0x18538d[_0xdb49('0x36')][_0xdb49('0x3f')]);_0x2d6858['where']=qs['filters'](_[_0xdb49('0x40')](_0x18538d[_0xdb49('0x36')],_0x17ca14[_0xdb49('0x37')]));if(_0x18538d['query']['filter']){_0x2d6858['where']=_['merge'](_0x2d6858['where'],{'$or':_['map'](_0x2d6858['attributes'],function(_0x59d01e){var _0x19ed87={};_0x19ed87[_0x59d01e]={'$like':'%'+_0x18538d[_0xdb49('0x36')][_0xdb49('0x41')]+'%'};return _0x19ed87;})});}_0x2d6858=_[_0xdb49('0x43')]({},_0x2d6858,_0x18538d['options']);return _0x238026['getAgents'](_0x2d6858);}})[_0xdb49('0x2c')](function(_0x311e42){if(_0x311e42){_0x4fa2c7=_0x311e42['length'];if(!_0x18538d[_0xdb49('0x36')][_0xdb49('0x3c')]('nolimit')){_0x2d6858['limit']=qs[_0xdb49('0x25')](_0x18538d[_0xdb49('0x36')][_0xdb49('0x25')]);_0x2d6858[_0xdb49('0x23')]=qs[_0xdb49('0x23')](_0x18538d[_0xdb49('0x36')][_0xdb49('0x23')]);}return _0x238026['getAgents'](_0x2d6858);}})[_0xdb49('0x2c')](function(_0x5ba3b6){if(_0x5ba3b6){return _0x5ba3b6?{'count':_0x4fa2c7,'rows':_0x5ba3b6}:null;}})[_0xdb49('0x2c')](respondWithResult(_0x519d99,null))[_0xdb49('0x4c')](handleError(_0x519d99,null));}; \ No newline at end of file +var _0xa9dc=['limit','undefined','count','set','json','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','end','sendStatus','error','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','MailQueueId','filter','merge','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','findOne','Team','nolimit','ids','Agents','online','voicePause','interface','sequelize','transaction','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','union','compact','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','status','offset'];(function(_0x3fe796,_0x175c5a){var _0x220119=function(_0x579c84){while(--_0x579c84){_0x3fe796['push'](_0x3fe796['shift']());}};_0x220119(++_0x175c5a);}(_0xa9dc,0x71));var _0xca9d=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0xa9dc[_0x2bbc07];return _0x6879e4;};'use strict';var emlformat=require(_0xca9d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca9d('0x1'));var jsonpatch=require(_0xca9d('0x2'));var rp=require(_0xca9d('0x3'));var moment=require(_0xca9d('0x4'));var BPromise=require(_0xca9d('0x5'));var Mustache=require(_0xca9d('0x6'));var util=require(_0xca9d('0x7'));var path=require(_0xca9d('0x8'));var sox=require(_0xca9d('0x9'));var csv=require(_0xca9d('0xa'));var ejs=require(_0xca9d('0xb'));var fs=require('fs');var fs_extra=require(_0xca9d('0xc'));var _=require(_0xca9d('0xd'));var squel=require(_0xca9d('0xe'));var crypto=require(_0xca9d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xca9d('0x10'));var toCsv=require(_0xca9d('0xa'));var querystring=require(_0xca9d('0x11'));var Papa=require(_0xca9d('0x12'));var Redis=require(_0xca9d('0x13'));var authService=require(_0xca9d('0x14'));var qs=require(_0xca9d('0x15'));var as=require(_0xca9d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca9d('0x17'))(_0xca9d('0x18'));var utils=require('../../config/utils');var config=require(_0xca9d('0x19'));var licenseUtil=require(_0xca9d('0x1a'));var db=require(_0xca9d('0x1b'))['db'];config[_0xca9d('0x1c')]=_[_0xca9d('0x1d')](config[_0xca9d('0x1c')],{'host':_0xca9d('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca9d('0x1c')]));require(_0xca9d('0x1f'))['register'](socket);function respondWithStatusCode(_0x165a14,_0x5a5c2c){_0x5a5c2c=_0x5a5c2c||0xcc;return function(_0x1f4dc6){if(_0x1f4dc6){return _0x165a14['sendStatus'](_0x5a5c2c);}return _0x165a14[_0xca9d('0x20')](_0x5a5c2c)['end']();};}function respondWithResult(_0x145964,_0x5ac7cc){_0x5ac7cc=_0x5ac7cc||0xc8;return function(_0x5a331b){if(_0x5a331b){return _0x145964[_0xca9d('0x20')](_0x5ac7cc)['json'](_0x5a331b);}};}function respondWithFilteredResult(_0x3ec247,_0x2248d1){return function(_0x4ee5cf){if(_0x4ee5cf){var _0x27fe15=typeof _0x2248d1[_0xca9d('0x21')]==='undefined'&&typeof _0x2248d1[_0xca9d('0x22')]===_0xca9d('0x23');var _0x3b0035=_0x4ee5cf[_0xca9d('0x24')];var _0x3d9cbb=_0x27fe15?0x0:_0x2248d1['offset'];var _0x2d6120=_0x27fe15?_0x4ee5cf[_0xca9d('0x24')]:_0x2248d1[_0xca9d('0x21')]+_0x2248d1[_0xca9d('0x22')];var _0x51a65f;if(_0x2d6120>=_0x3b0035){_0x2d6120=_0x3b0035;_0x51a65f=0xc8;}else{_0x51a65f=0xce;}_0x3ec247['status'](_0x51a65f);return _0x3ec247[_0xca9d('0x25')]('Content-Range',_0x3d9cbb+'-'+_0x2d6120+'/'+_0x3b0035)[_0xca9d('0x26')](_0x4ee5cf);}return null;};}function patchUpdates(_0x35ff7d){return function(_0x2d1b9b){try{jsonpatch[_0xca9d('0x27')](_0x2d1b9b,_0x35ff7d,!![]);}catch(_0x4a16cb){return BPromise[_0xca9d('0x28')](_0x4a16cb);}return _0x2d1b9b[_0xca9d('0x29')]();};}function saveUpdates(_0x59d821,_0x27cb95){return function(_0x3e6f80){if(_0x3e6f80){return _0x3e6f80[_0xca9d('0x2a')](_0x59d821)[_0xca9d('0x2b')](function(_0x59a06b){return _0x59a06b;});}return null;};}function removeEntity(_0x3de20d,_0x47d36f){return function(_0x5b0af2){if(_0x5b0af2){return _0x5b0af2[_0xca9d('0x2c')]()['then'](function(){var _0x446e0d=_0x5b0af2[_0xca9d('0x2d')]({'plain':!![]});var _0x584a45=_0xca9d('0x2e');return db[_0xca9d('0x2f')][_0xca9d('0x2c')]({'where':{'type':_0x584a45,'resourceId':_0x446e0d['id']}})[_0xca9d('0x2b')](function(){return _0x5b0af2;});})['then'](function(){_0x3de20d[_0xca9d('0x20')](0xcc)[_0xca9d('0x30')]();});}};}function handleEntityNotFound(_0x860885,_0x41c304){return function(_0x1cdd73){if(!_0x1cdd73){_0x860885[_0xca9d('0x31')](0x194);}return _0x1cdd73;};}function handleError(_0x274d75,_0x3248b7){_0x3248b7=_0x3248b7||0x1f4;return function(_0x5adfbb){logger[_0xca9d('0x32')](_0x5adfbb['stack']);if(_0x5adfbb[_0xca9d('0x33')]){delete _0x5adfbb[_0xca9d('0x33')];}_0x274d75['status'](_0x3248b7)[_0xca9d('0x34')](_0x5adfbb);};}exports[_0xca9d('0x35')]=function(_0x18b1f5,_0xbbbd8f){var _0x840d68={},_0x5423de={},_0x11c34d={'count':0x0,'rows':[]};var _0x20d3f6=_[_0xca9d('0x36')](db[_0xca9d('0x37')][_0xca9d('0x38')],function(_0x22d0ec){return{'name':_0x22d0ec[_0xca9d('0x39')],'type':_0x22d0ec[_0xca9d('0x3a')][_0xca9d('0x3b')]};});_0x5423de['model']=_['map'](_0x20d3f6,'name');_0x5423de[_0xca9d('0x3c')]=_[_0xca9d('0x3d')](_0x18b1f5[_0xca9d('0x3c')]);_0x5423de[_0xca9d('0x3e')]=_[_0xca9d('0x3f')](_0x5423de[_0xca9d('0x40')],_0x5423de[_0xca9d('0x3c')]);_0x840d68[_0xca9d('0x41')]=_[_0xca9d('0x3f')](_0x5423de[_0xca9d('0x40')],qs['fields'](_0x18b1f5[_0xca9d('0x3c')][_0xca9d('0x42')]));_0x840d68[_0xca9d('0x41')]=_0x840d68[_0xca9d('0x41')][_0xca9d('0x43')]?_0x840d68[_0xca9d('0x41')]:_0x5423de['model'];if(!_0x18b1f5[_0xca9d('0x3c')][_0xca9d('0x44')]('nolimit')){_0x840d68[_0xca9d('0x22')]=qs[_0xca9d('0x22')](_0x18b1f5[_0xca9d('0x3c')]['limit']);_0x840d68['offset']=qs['offset'](_0x18b1f5[_0xca9d('0x3c')]['offset']);}_0x840d68[_0xca9d('0x45')]=qs[_0xca9d('0x46')](_0x18b1f5[_0xca9d('0x3c')]['sort']);_0x840d68['where']=qs[_0xca9d('0x3e')](_[_0xca9d('0x47')](_0x18b1f5['query'],_0x5423de[_0xca9d('0x3e')]),_0x20d3f6);if(_0x18b1f5['query']['filter']){_0x840d68[_0xca9d('0x48')]=_['merge'](_0x840d68[_0xca9d('0x48')],{'$or':_[_0xca9d('0x36')](_0x20d3f6,function(_0x5add22){if(_0x5add22['type']!==_0xca9d('0x49')){var _0x44690b={};_0x44690b[_0x5add22[_0xca9d('0x33')]]={'$like':'%'+_0x18b1f5['query']['filter']+'%'};return _0x44690b;}})});}_0x840d68=_['merge']({},_0x840d68,_0x18b1f5['options']);var _0x38e3c3={'where':_0x840d68[_0xca9d('0x48')]};return db[_0xca9d('0x37')][_0xca9d('0x24')](_0x38e3c3)[_0xca9d('0x2b')](function(_0xbf74e1){_0x11c34d[_0xca9d('0x24')]=_0xbf74e1;if(_0x18b1f5[_0xca9d('0x3c')][_0xca9d('0x4a')]){_0x840d68[_0xca9d('0x4b')]=[{'all':!![]}];}return db[_0xca9d('0x37')][_0xca9d('0x4c')](_0x840d68);})[_0xca9d('0x2b')](function(_0x25f2ae){_0x11c34d[_0xca9d('0x4d')]=_0x25f2ae;return _0x11c34d;})[_0xca9d('0x2b')](respondWithFilteredResult(_0xbbbd8f,_0x840d68))[_0xca9d('0x4e')](handleError(_0xbbbd8f,null));};exports[_0xca9d('0x4f')]=function(_0x5e0f2d,_0x307944){var _0x2505e6={'raw':!![],'where':{'id':_0x5e0f2d['params']['id']}},_0x5b5dc6={};_0x5b5dc6[_0xca9d('0x40')]=_[_0xca9d('0x3d')](db['MailQueue']['rawAttributes']);_0x5b5dc6[_0xca9d('0x3c')]=_[_0xca9d('0x3d')](_0x5e0f2d[_0xca9d('0x3c')]);_0x5b5dc6[_0xca9d('0x3e')]=_['intersection'](_0x5b5dc6[_0xca9d('0x40')],_0x5b5dc6['query']);_0x2505e6['attributes']=_['intersection'](_0x5b5dc6[_0xca9d('0x40')],qs[_0xca9d('0x42')](_0x5e0f2d['query']['fields']));_0x2505e6['attributes']=_0x2505e6[_0xca9d('0x41')]['length']?_0x2505e6[_0xca9d('0x41')]:_0x5b5dc6[_0xca9d('0x40')];if(_0x5e0f2d[_0xca9d('0x3c')][_0xca9d('0x4a')]){_0x2505e6[_0xca9d('0x4b')]=[{'all':!![]}];}_0x2505e6=_['merge']({},_0x2505e6,_0x5e0f2d[_0xca9d('0x50')]);return db['MailQueue'][_0xca9d('0x51')](_0x2505e6)[_0xca9d('0x2b')](handleEntityNotFound(_0x307944,null))[_0xca9d('0x2b')](respondWithResult(_0x307944,null))[_0xca9d('0x4e')](handleError(_0x307944,null));};exports[_0xca9d('0x52')]=function(_0x1037d0,_0x346e01){return db[_0xca9d('0x37')][_0xca9d('0x52')](_0x1037d0[_0xca9d('0x53')],{})['then'](function(_0x3e19b9){var _0x42461a=_0x1037d0[_0xca9d('0x54')]['get']({'plain':!![]});if(!_0x42461a)throw new Error(_0xca9d('0x55'));if(_0x42461a[_0xca9d('0x56')]===_0xca9d('0x54')){var _0x34a9e8=_0x3e19b9[_0xca9d('0x2d')]({'plain':!![]});var _0xc666c3=_0xca9d('0x2e');return db[_0xca9d('0x57')][_0xca9d('0x51')]({'where':{'name':_0xc666c3,'userProfileId':_0x42461a[_0xca9d('0x58')]},'raw':!![]})[_0xca9d('0x2b')](function(_0x295d93){if(_0x295d93&&_0x295d93[_0xca9d('0x59')]===0x0){return db[_0xca9d('0x2f')][_0xca9d('0x52')]({'name':_0x34a9e8[_0xca9d('0x33')],'resourceId':_0x34a9e8['id'],'type':_0x295d93[_0xca9d('0x33')],'sectionId':_0x295d93['id']},{})[_0xca9d('0x2b')](function(){return _0x3e19b9;});}else{return _0x3e19b9;}})[_0xca9d('0x4e')](function(_0x16b076){logger[_0xca9d('0x32')](_0xca9d('0x5a'),_0x16b076);throw _0x16b076;});}return _0x3e19b9;})['then'](respondWithResult(_0x346e01,0xc9))[_0xca9d('0x4e')](handleError(_0x346e01,null));};exports[_0xca9d('0x2a')]=function(_0x2110e9,_0x2a9e6b){if(_0x2110e9[_0xca9d('0x53')]['id']){delete _0x2110e9[_0xca9d('0x53')]['id'];}return db[_0xca9d('0x37')][_0xca9d('0x51')]({'where':{'id':_0x2110e9[_0xca9d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2a9e6b,null))[_0xca9d('0x2b')](saveUpdates(_0x2110e9[_0xca9d('0x53')],null))[_0xca9d('0x2b')](respondWithResult(_0x2a9e6b,null))['catch'](handleError(_0x2a9e6b,null));};exports[_0xca9d('0x2c')]=function(_0x635168,_0x43da05){return db['MailQueue'][_0xca9d('0x51')]({'where':{'id':_0x635168[_0xca9d('0x5b')]['id']}})[_0xca9d('0x2b')](handleEntityNotFound(_0x43da05,null))[_0xca9d('0x2b')](removeEntity(_0x43da05,null))[_0xca9d('0x4e')](handleError(_0x43da05,null));};exports[_0xca9d('0x5c')]=function(_0x129526,_0x5f5a63){return db[_0xca9d('0x37')][_0xca9d('0x5c')]()[_0xca9d('0x2b')](respondWithResult(_0x5f5a63,null))[_0xca9d('0x4e')](handleError(_0x5f5a63,null));};exports[_0xca9d('0x5d')]=function(_0x1d1cfc,_0x5f385f,_0xf4a747){var _0x1e9b87={'raw':!![],'where':{}},_0x4cfe66={},_0x386a94;return db[_0xca9d('0x37')]['findOne']({'where':{'id':_0x1d1cfc['params']['id']}})[_0xca9d('0x2b')](handleEntityNotFound(_0x5f385f,null))['then'](function(_0xaa24a9){if(_0xaa24a9){_0x386a94=_0xaa24a9[_0xca9d('0x2d')]({'plain':!![]});_0x4cfe66[_0xca9d('0x40')]=_[_0xca9d('0x3d')](db['UserMailQueue'][_0xca9d('0x38')]);_0x4cfe66[_0xca9d('0x3c')]=_[_0xca9d('0x3d')](_0x1d1cfc[_0xca9d('0x3c')]);_0x4cfe66[_0xca9d('0x3e')]=_[_0xca9d('0x3f')](_0x4cfe66[_0xca9d('0x40')],_0x4cfe66[_0xca9d('0x3c')]);_0x1e9b87['attributes']=_[_0xca9d('0x3f')](_0x4cfe66[_0xca9d('0x40')],qs[_0xca9d('0x42')](_0x1d1cfc[_0xca9d('0x3c')]['fields']));_0x1e9b87[_0xca9d('0x41')]=_0x1e9b87[_0xca9d('0x41')]['length']?_0x1e9b87['attributes']:_0x4cfe66['model'];if(!_0x1d1cfc['query'][_0xca9d('0x44')]('nolimit')){_0x1e9b87['limit']=qs[_0xca9d('0x22')](_0x1d1cfc['query'][_0xca9d('0x22')]);_0x1e9b87[_0xca9d('0x21')]=qs['offset'](_0x1d1cfc[_0xca9d('0x3c')][_0xca9d('0x21')]);}_0x1e9b87[_0xca9d('0x45')]=qs[_0xca9d('0x46')](_0x1d1cfc[_0xca9d('0x3c')][_0xca9d('0x46')]);_0x1e9b87[_0xca9d('0x48')]=qs[_0xca9d('0x3e')](_['pick'](_0x1d1cfc['query'],_0x4cfe66['filters']));_0x1e9b87['where'][_0xca9d('0x5e')]=_0xaa24a9['id'];if(_0x1d1cfc[_0xca9d('0x3c')][_0xca9d('0x5f')]){_0x1e9b87[_0xca9d('0x48')]=_[_0xca9d('0x60')](_0x1e9b87[_0xca9d('0x48')],{'$or':_[_0xca9d('0x36')](_0x1e9b87[_0xca9d('0x41')],function(_0x46a5e3){var _0x57c687={};_0x57c687[_0x46a5e3]={'$like':'%'+_0x1d1cfc[_0xca9d('0x3c')][_0xca9d('0x5f')]+'%'};return _0x57c687;})});}_0x1e9b87=_[_0xca9d('0x60')]({},_0x1e9b87,_0x1d1cfc[_0xca9d('0x50')]);return db[_0xca9d('0x61')][_0xca9d('0x4c')](_0x1e9b87);}})[_0xca9d('0x2b')](function(_0x3f9f0c){if(_0x3f9f0c){return db[_0xca9d('0x62')][_0xca9d('0x63')]({'where':{'id':_[_0xca9d('0x36')](_0x3f9f0c,_0xca9d('0x64')),'role':_0xca9d('0x65')},'attributes':['id',_0xca9d('0x33'),_0xca9d('0x66'),'updatedAt','createdAt']});}})[_0xca9d('0x2b')](function(_0x2f50bd){if(_0x2f50bd){return{'count':_0x2f50bd[_0xca9d('0x24')],'rows':_[_0xca9d('0x36')](_0x2f50bd[_0xca9d('0x4d')],function(_0x97226){return{'membername':_0x97226[_0xca9d('0x33')],'UserId':_0x97226['id'],'queue_name':_0x386a94[_0xca9d('0x33')],'MailQueueId':_0x386a94['id'],'interface':util[_0xca9d('0x67')](_0xca9d('0x68'),_0xca9d('0x69'),_0x97226['name']),'penalty':0x0,'paused':_0x97226[_0xca9d('0x66')],'createdAt':_0x97226[_0xca9d('0x6a')],'updatedAt':_0x97226[_0xca9d('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xca9d('0x2b')](respondWithFilteredResult(_0x5f385f,_0x1e9b87))[_0xca9d('0x4e')](handleError(_0x5f385f,null));};exports[_0xca9d('0x6c')]=function(_0xa20184,_0x439206,_0x4ec105){var _0x195b99={};var _0x1f35ea={};var _0x528233;var _0x28d9b9;return db[_0xca9d('0x37')][_0xca9d('0x6d')]({'where':{'id':_0xa20184[_0xca9d('0x5b')]['id']}})[_0xca9d('0x2b')](handleEntityNotFound(_0x439206,null))[_0xca9d('0x2b')](function(_0x168652){if(_0x168652){_0x528233=_0x168652;_0x1f35ea['model']=_[_0xca9d('0x3d')](db[_0xca9d('0x6e')][_0xca9d('0x38')]);_0x1f35ea[_0xca9d('0x3c')]=_[_0xca9d('0x3d')](_0xa20184['query']);_0x1f35ea[_0xca9d('0x3e')]=_[_0xca9d('0x3f')](_0x1f35ea[_0xca9d('0x40')],_0x1f35ea[_0xca9d('0x3c')]);_0x195b99[_0xca9d('0x41')]=_['intersection'](_0x1f35ea[_0xca9d('0x40')],qs[_0xca9d('0x42')](_0xa20184[_0xca9d('0x3c')][_0xca9d('0x42')]));_0x195b99[_0xca9d('0x41')]=_0x195b99[_0xca9d('0x41')][_0xca9d('0x43')]?_0x195b99[_0xca9d('0x41')]:_0x1f35ea[_0xca9d('0x40')];_0x195b99['order']=qs[_0xca9d('0x46')](_0xa20184[_0xca9d('0x3c')][_0xca9d('0x46')]);_0x195b99[_0xca9d('0x48')]=qs[_0xca9d('0x3e')](_['pick'](_0xa20184[_0xca9d('0x3c')],_0x1f35ea[_0xca9d('0x3e')]));if(_0xa20184['query'][_0xca9d('0x5f')]){_0x195b99['where']=_[_0xca9d('0x60')](_0x195b99[_0xca9d('0x48')],{'$or':_['map'](_0x195b99['attributes'],function(_0x2058a9){var _0x56912d={};_0x56912d[_0x2058a9]={'$like':'%'+_0xa20184['query'][_0xca9d('0x5f')]+'%'};return _0x56912d;})});}_0x195b99=_['merge']({},_0x195b99,_0xa20184[_0xca9d('0x50')]);return _0x528233[_0xca9d('0x6c')](_0x195b99);}})[_0xca9d('0x2b')](function(_0x4d9ca4){if(_0x4d9ca4){_0x28d9b9=_0x4d9ca4[_0xca9d('0x43')];if(!_0xa20184['query'][_0xca9d('0x44')](_0xca9d('0x6f'))){_0x195b99[_0xca9d('0x22')]=qs[_0xca9d('0x22')](_0xa20184[_0xca9d('0x3c')][_0xca9d('0x22')]);_0x195b99[_0xca9d('0x21')]=qs[_0xca9d('0x21')](_0xa20184['query'][_0xca9d('0x21')]);}return _0x528233[_0xca9d('0x6c')](_0x195b99);}})['then'](function(_0x32d8d7){if(_0x32d8d7){return _0x32d8d7?{'count':_0x28d9b9,'rows':_0x32d8d7}:null;}})['then'](respondWithResult(_0x439206,null))[_0xca9d('0x4e')](handleError(_0x439206,null));};exports['addTeams']=function(_0x24f22f,_0x1de3ea,_0x5f0d8e){var _0x315505=_0x24f22f[_0xca9d('0x53')][_0xca9d('0x70')];return db[_0xca9d('0x6e')]['findAll']({'where':{'id':_0x315505},'attributes':['id'],'include':[{'model':db[_0xca9d('0x62')],'as':_0xca9d('0x71'),'attributes':['id',_0xca9d('0x33'),_0xca9d('0x72'),_0xca9d('0x73'),_0xca9d('0x74')],'raw':!![]}]})[_0xca9d('0x2b')](function(_0x3779e8){if(_0x3779e8){var _0x33650b=_['flatMap'](_0x3779e8,function(_0x45c1d5){var _0x430e2f=_0x45c1d5[_0xca9d('0x2d')]({'plain':!![]});return _0x430e2f[_0xca9d('0x71')];});return db[_0xca9d('0x37')][_0xca9d('0x51')]({'where':{'id':_0x24f22f[_0xca9d('0x5b')]['id']}})[_0xca9d('0x2b')](function(_0x2b0e08){return db[_0xca9d('0x75')][_0xca9d('0x76')](function(_0x3c1798){return _0x2b0e08['addTeams'](_0x315505,{'transaction':_0x3c1798})['then'](function(){return BPromise['each'](_0x33650b,function(_0xc34ab3){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0xc34ab3['id'],'MailQueueId':_0x24f22f['params']['id']},'transaction':_0x3c1798});});})['then'](function(){_0x33650b[_0xca9d('0x77')](function(_0x415463){socket['emit'](_0xca9d('0x78'),{'UserId':_0x415463['id'],'MailQueueId':_0x2b0e08['id']});});});});});}})[_0xca9d('0x2b')](respondWithStatusCode(_0x1de3ea,null))[_0xca9d('0x4e')](handleError(_0x1de3ea,null));};exports[_0xca9d('0x79')]=function(_0x3c7c58,_0x17cd3e,_0x29532b){return db['Team'][_0xca9d('0x4c')]({'where':{'id':_0x3c7c58['query'][_0xca9d('0x70')]},'attributes':['id'],'include':[{'model':db[_0xca9d('0x62')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xca9d('0x2b')](handleEntityNotFound(_0x17cd3e,null))['then'](function(_0x403b60){var _0x5a0d70=_[_0xca9d('0x36')](_0x403b60,'id');var _0x5f5cf4=[];var _0x3699ce=[];var _0x199b7e=squel[_0xca9d('0x7a')]();_0x199b7e[_0xca9d('0x7b')](_0xca9d('0x7c'))[_0xca9d('0x7d')]('team_has_mail_queues','tq')[_0xca9d('0x7e')](_0xca9d('0x7f'),'ut',_0xca9d('0x80'))[_0xca9d('0x48')]('MailQueueId\x20=\x20?',_0x3c7c58[_0xca9d('0x5b')]['id']);for(var _0x18dc9c=0x0;_0x18dc9c<_0x403b60[_0xca9d('0x43')];_0x18dc9c+=0x1){let _0x2df179=_0x403b60[_0x18dc9c];for(var _0x7b4190=0x0;_0x7b4190<_0x2df179['Agents'][_0xca9d('0x43')];_0x7b4190+=0x1){let _0x7906a8=_0x2df179[_0xca9d('0x71')][_0x7b4190];var _0x1422c8=_0x199b7e[_0xca9d('0x81')]();_0x1422c8[_0xca9d('0x48')]('ut.UserId\x20=\x20?',_0x7906a8['id']);_0x3699ce[_0xca9d('0x82')](db[_0xca9d('0x75')][_0xca9d('0x3c')](_0x1422c8[_0xca9d('0x83')](),{'type':db[_0xca9d('0x75')][_0xca9d('0x84')][_0xca9d('0x85')]})[_0xca9d('0x2b')](function(_0x40b96f){if(_0x40b96f[_0xca9d('0x43')]===0x1){return _0x7906a8['id'];}else{var _0x58cef7=_[_0xca9d('0x86')](_[_0xca9d('0x36')](_0x40b96f,_0xca9d('0x87')),function(_0x34822b){return _['includes'](_0x5a0d70,_0x34822b);});if(_0x58cef7){return _0x7906a8['id'];}}}));}}return BPromise['all'](_0x3699ce)[_0xca9d('0x2b')](function(_0x7980d7){_0x5f5cf4=_(_0x5f5cf4)[_0xca9d('0x88')](_0x7980d7)[_0xca9d('0x89')]()['value']();return db[_0xca9d('0x37')][_0xca9d('0x51')]({'where':{'id':_0x3c7c58[_0xca9d('0x5b')]['id']}})['then'](function(_0x11931d){return db[_0xca9d('0x75')]['transaction'](function(_0x306481){return _0x11931d[_0xca9d('0x79')](_0x3c7c58[_0xca9d('0x3c')][_0xca9d('0x70')],{'transaction':_0x306481})[_0xca9d('0x2b')](function(){if(!_[_0xca9d('0x8a')](_0x5f5cf4)){return _0x11931d[_0xca9d('0x8b')](_0x5f5cf4,{'transaction':_0x306481});}})['then'](function(){_0x5f5cf4[_0xca9d('0x77')](function(_0x3fdc13){socket[_0xca9d('0x8c')](_0xca9d('0x8d'),{'UserId':_0x3fdc13,'MailQueueId':_0x11931d['id']});});});});});});})[_0xca9d('0x2b')](respondWithStatusCode(_0x17cd3e,null))[_0xca9d('0x4e')](handleError(_0x17cd3e,null));};exports[_0xca9d('0x8e')]=function(_0x5122ea,_0x221181,_0x1fd4d7){return db[_0xca9d('0x37')][_0xca9d('0x51')]({'where':{'id':_0x5122ea[_0xca9d('0x5b')]['id']}})[_0xca9d('0x2b')](handleEntityNotFound(_0x221181,null))[_0xca9d('0x2b')](function(_0x5cc166){if(_0x5cc166){return _0x5cc166[_0xca9d('0x8e')](_0x5122ea['body'][_0xca9d('0x70')],_[_0xca9d('0x8f')](_0x5122ea[_0xca9d('0x53')],[_0xca9d('0x70'),'id'])||{})[_0xca9d('0x90')](function(_0x5c4daa){for(var _0x324961=0x0;_0x324961<_0x5122ea['body']['ids']['length'];_0x324961+=0x1){socket[_0xca9d('0x8c')](_0xca9d('0x78'),{'UserId':Number(_0x5122ea[_0xca9d('0x53')]['ids'][_0x324961]),'MailQueueId':Number(_0x5122ea['params']['id'])});}return _0x5c4daa;});}})[_0xca9d('0x2b')](respondWithResult(_0x221181,null))[_0xca9d('0x4e')](handleError(_0x221181,null));};exports[_0xca9d('0x8b')]=function(_0xbc33b8,_0xbd9237,_0x169e2f){return db[_0xca9d('0x37')][_0xca9d('0x51')]({'where':{'id':_0xbc33b8[_0xca9d('0x5b')]['id']}})[_0xca9d('0x2b')](handleEntityNotFound(_0xbd9237,null))['then'](function(_0x560abd){if(_0x560abd){return _0x560abd[_0xca9d('0x8b')](_0xbc33b8[_0xca9d('0x3c')][_0xca9d('0x70')])['then'](function(){if(_[_0xca9d('0x91')](_0xbc33b8[_0xca9d('0x3c')][_0xca9d('0x70')])){for(var _0x337e8e=0x0;_0x337e8e<_0xbc33b8[_0xca9d('0x3c')][_0xca9d('0x70')][_0xca9d('0x43')];_0x337e8e+=0x1){socket['emit'](_0xca9d('0x8d'),{'UserId':Number(_0xbc33b8[_0xca9d('0x3c')]['ids'][_0x337e8e]),'MailQueueId':Number(_0xbc33b8[_0xca9d('0x5b')]['id'])});}}else{socket[_0xca9d('0x8c')]('userMailQueue:remove',{'UserId':Number(_0xbc33b8[_0xca9d('0x3c')][_0xca9d('0x70')]),'MailQueueId':Number(_0xbc33b8['params']['id'])});}});}})['then'](respondWithStatusCode(_0xbd9237,null))[_0xca9d('0x4e')](handleError(_0xbd9237,null));};exports[_0xca9d('0x92')]=function(_0x1115e3,_0x2a3983,_0x2115c3){var _0x448fe9={};var _0x30cfe3={};var _0x21e17c;var _0x4a8c72;return db['MailQueue'][_0xca9d('0x6d')]({'where':{'id':_0x1115e3['params']['id']}})[_0xca9d('0x2b')](handleEntityNotFound(_0x2a3983,null))[_0xca9d('0x2b')](function(_0x3f520f){if(_0x3f520f){_0x21e17c=_0x3f520f;_0x30cfe3[_0xca9d('0x40')]=_[_0xca9d('0x3d')](db[_0xca9d('0x62')][_0xca9d('0x38')]);_0x30cfe3[_0xca9d('0x3c')]=_[_0xca9d('0x3d')](_0x1115e3[_0xca9d('0x3c')]);_0x30cfe3['filters']=_[_0xca9d('0x3f')](_0x30cfe3[_0xca9d('0x40')],_0x30cfe3[_0xca9d('0x3c')]);_0x448fe9[_0xca9d('0x41')]=_[_0xca9d('0x3f')](_0x30cfe3[_0xca9d('0x40')],qs[_0xca9d('0x42')](_0x1115e3[_0xca9d('0x3c')]['fields']));_0x448fe9[_0xca9d('0x41')]=_0x448fe9[_0xca9d('0x41')]['length']?_0x448fe9[_0xca9d('0x41')]:_0x30cfe3[_0xca9d('0x40')];_0x448fe9[_0xca9d('0x45')]=qs['sort'](_0x1115e3[_0xca9d('0x3c')]['sort']);_0x448fe9[_0xca9d('0x48')]=qs['filters'](_[_0xca9d('0x47')](_0x1115e3[_0xca9d('0x3c')],_0x30cfe3[_0xca9d('0x3e')]));if(_0x1115e3[_0xca9d('0x3c')][_0xca9d('0x5f')]){_0x448fe9[_0xca9d('0x48')]=_[_0xca9d('0x60')](_0x448fe9[_0xca9d('0x48')],{'$or':_[_0xca9d('0x36')](_0x448fe9[_0xca9d('0x41')],function(_0x2938ce){var _0xbef74d={};_0xbef74d[_0x2938ce]={'$like':'%'+_0x1115e3[_0xca9d('0x3c')][_0xca9d('0x5f')]+'%'};return _0xbef74d;})});}_0x448fe9=_['merge']({},_0x448fe9,_0x1115e3[_0xca9d('0x50')]);return _0x21e17c['getAgents'](_0x448fe9);}})[_0xca9d('0x2b')](function(_0x55886f){if(_0x55886f){_0x4a8c72=_0x55886f[_0xca9d('0x43')];if(!_0x1115e3[_0xca9d('0x3c')][_0xca9d('0x44')](_0xca9d('0x6f'))){_0x448fe9[_0xca9d('0x22')]=qs[_0xca9d('0x22')](_0x1115e3[_0xca9d('0x3c')][_0xca9d('0x22')]);_0x448fe9[_0xca9d('0x21')]=qs[_0xca9d('0x21')](_0x1115e3[_0xca9d('0x3c')][_0xca9d('0x21')]);}return _0x21e17c[_0xca9d('0x92')](_0x448fe9);}})[_0xca9d('0x2b')](function(_0x308cd5){if(_0x308cd5){return _0x308cd5?{'count':_0x4a8c72,'rows':_0x308cd5}:null;}})['then'](respondWithResult(_0x2a3983,null))[_0xca9d('0x4e')](handleError(_0x2a3983,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 593cdc1..f795bdb 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 _0x4047=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x4047,0xa7));var _0x7404=function(_0xd80edc,_0x894687){_0xd80edc=_0xd80edc-0x0;var _0x4b22bf=_0x4047[_0xd80edc];return _0x4b22bf;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x7404('0x0'))['db'][_0x7404('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7404('0x2')](0x0);var events={'afterCreate':_0x7404('0x3'),'afterUpdate':_0x7404('0x4'),'afterDestroy':_0x7404('0x5')};function emitEvent(_0x2a1616){return function(_0x2eabad,_0x6d8270,_0x4981fa){MailQueueEvents[_0x7404('0x6')](_0x2a1616+':'+_0x2eabad['id'],_0x2eabad);MailQueueEvents[_0x7404('0x6')](_0x2a1616,_0x2eabad);_0x4981fa(null);};}for(var e in events){if(events[_0x7404('0x7')](e)){var event=events[e];MailQueue[_0x7404('0x8')](e,emitEvent(event));}}module[_0x7404('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x6124=['MailQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x4fcbf6,_0x376fa2){var _0x1af58a=function(_0x2b0861){while(--_0x2b0861){_0x4fcbf6['push'](_0x4fcbf6['shift']());}};_0x1af58a(++_0x376fa2);}(_0x6124,0x7d));var _0x4612=function(_0x4421df,_0x22aa74){_0x4421df=_0x4421df-0x0;var _0x5ed108=_0x6124[_0x4421df];return _0x5ed108;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x4612('0x0'))['db'][_0x4612('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x4612('0x2')](0x0);var events={'afterCreate':_0x4612('0x3'),'afterUpdate':_0x4612('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3cd083){return function(_0x69aa5d,_0x28e33d,_0x547845){MailQueueEvents['emit'](_0x3cd083+':'+_0x69aa5d['id'],_0x69aa5d);MailQueueEvents[_0x4612('0x5')](_0x3cd083,_0x69aa5d);_0x547845(null);};}for(var e in events){if(events[_0x4612('0x6')](e)){var event=events[e];MailQueue[_0x4612('0x7')](e,emitEvent(event));}}module[_0x4612('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index bb2ff48..cd5a4f2 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 _0xbf3f=['exports','define','MailQueue','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0xbf3f,0x137));var _0xfbf3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf3f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfbf3('0x0'));var util=require(_0xfbf3('0x1'));var logger=require(_0xfbf3('0x2'))('api');var moment=require(_0xfbf3('0x3'));var BPromise=require(_0xfbf3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfbf3('0x5'));var config=require(_0xfbf3('0x6'));var attributes=require(_0xfbf3('0x7'));module[_0xfbf3('0x8')]=function(_0x216666,_0x5d3894){return _0x216666[_0xfbf3('0x9')](_0xfbf3('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd08=['../../config/environment','exports','define','MailQueue','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4e0b8c,_0x443f31){var _0x633ecc=function(_0x1f1f36){while(--_0x1f1f36){_0x4e0b8c['push'](_0x4e0b8c['shift']());}};_0x633ecc(++_0x443f31);}(_0xcd08,0x1f3));var _0x8cd0=function(_0x2fdef0,_0x2bb034){_0x2fdef0=_0x2fdef0-0x0;var _0x44cbd1=_0xcd08[_0x2fdef0];return _0x44cbd1;};'use strict';var _=require('lodash');var util=require(_0x8cd0('0x0'));var logger=require(_0x8cd0('0x1'))(_0x8cd0('0x2'));var moment=require(_0x8cd0('0x3'));var BPromise=require(_0x8cd0('0x4'));var rp=require(_0x8cd0('0x5'));var fs=require('fs');var path=require(_0x8cd0('0x6'));var rimraf=require('rimraf');var config=require(_0x8cd0('0x7'));var attributes=require('./mailQueue.attributes');module[_0x8cd0('0x8')]=function(_0xf7b28d,_0x42257b){return _0xf7b28d[_0x8cd0('0x9')](_0x8cd0('0xa'),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 fae6043..e97789d 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 _0xb5a3=['defaults','socket.io-emitter','redis','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','where','limit','include','map','attributes','model','then','find','ShowMailQueue','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x52f0d0,_0x23aa44){var _0x1babf8=function(_0x102dbe){while(--_0x102dbe){_0x52f0d0['push'](_0x52f0d0['shift']());}};_0x1babf8(++_0x23aa44);}(_0xb5a3,0x182));var _0x3b5a=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xb5a3[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3b5a('0x0'));var BPromise=require(_0x3b5a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b5a('0x2'));var db=require(_0x3b5a('0x3'))['db'];var utils=require(_0x3b5a('0x4'));var logger=require(_0x3b5a('0x5'))(_0x3b5a('0x6'));var config=require(_0x3b5a('0x7'));var jayson=require(_0x3b5a('0x8'));var client=jayson[_0x3b5a('0x9')]['http']({'port':0x232a});config['redis']=_[_0x3b5a('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3b5a('0xb'))(new Redis(config[_0x3b5a('0xc')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2f4826,_0xb240b0,_0x40c148){return new BPromise(function(_0xb08ff1,_0x1309de){return client[_0x3b5a('0xd')](_0x2f4826,_0x40c148)['then'](function(_0x214588){logger[_0x3b5a('0xe')](_0x3b5a('0xf'),_0xb240b0,_0x3b5a('0x10'));logger[_0x3b5a('0x11')]('MailQueue,\x20%s,\x20%s,\x20%s',_0xb240b0,_0x3b5a('0x10'),JSON[_0x3b5a('0x12')](_0x214588));if(_0x214588[_0x3b5a('0x13')]){if(_0x214588['error'][_0x3b5a('0x14')]===0x1f4){logger[_0x3b5a('0x13')](_0x3b5a('0xf'),_0xb240b0,_0x214588[_0x3b5a('0x13')][_0x3b5a('0x15')]);return _0x1309de(_0x214588['error']['message']);}logger[_0x3b5a('0x13')]('MailQueue,\x20%s,\x20%s',_0xb240b0,_0x214588['error'][_0x3b5a('0x15')]);return _0xb08ff1(_0x214588[_0x3b5a('0x13')]['message']);}else{logger[_0x3b5a('0xe')](_0x3b5a('0xf'),_0xb240b0,'request\x20sent');_0xb08ff1(_0x214588['result'][_0x3b5a('0x15')]);}})[_0x3b5a('0x16')](function(_0x181536){logger[_0x3b5a('0x13')](_0x3b5a('0xf'),_0xb240b0,_0x181536);_0x1309de(_0x181536);});});}exports[_0x3b5a('0x17')]=function(_0x140522){var _0x1738ae=this;return new Promise(function(_0x327319,_0x315ec2){return db[_0x3b5a('0x18')][_0x3b5a('0x19')]({'raw':_0x140522[_0x3b5a('0x1a')]?_0x140522['options']['raw']===undefined?!![]:![]:!![],'where':_0x140522[_0x3b5a('0x1a')]?_0x140522[_0x3b5a('0x1a')][_0x3b5a('0x1b')]||null:null,'attributes':_0x140522[_0x3b5a('0x1a')]?_0x140522['options']['attributes']||null:null,'limit':_0x140522[_0x3b5a('0x1a')]?_0x140522[_0x3b5a('0x1a')][_0x3b5a('0x1c')]||null:null,'include':_0x140522['options']?_0x140522['options'][_0x3b5a('0x1d')]?_[_0x3b5a('0x1e')](_0x140522[_0x3b5a('0x1a')][_0x3b5a('0x1d')],function(_0x26154b){return{'model':db[_0x26154b['model']],'as':_0x26154b['as'],'attributes':_0x26154b[_0x3b5a('0x1f')],'include':_0x26154b[_0x3b5a('0x1d')]?_['map'](_0x26154b[_0x3b5a('0x1d')],function(_0x59c37a){return{'model':db[_0x59c37a['model']],'as':_0x59c37a['as'],'attributes':_0x59c37a['attributes'],'include':_0x59c37a[_0x3b5a('0x1d')]?_[_0x3b5a('0x1e')](_0x59c37a[_0x3b5a('0x1d')],function(_0x42a186){return{'model':db[_0x42a186[_0x3b5a('0x20')]],'as':_0x42a186['as'],'attributes':_0x42a186[_0x3b5a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3b5a('0x21')](function(_0x5c19e1){logger[_0x3b5a('0xe')](_0x3b5a('0x17'),_0x140522);logger['debug'](_0x3b5a('0x17'),_0x140522,JSON[_0x3b5a('0x12')](_0x5c19e1));_0x327319(_0x5c19e1);})[_0x3b5a('0x16')](function(_0x376ec2){logger[_0x3b5a('0x13')](_0x3b5a('0x17'),_0x376ec2[_0x3b5a('0x15')],_0x140522);_0x315ec2(_0x1738ae[_0x3b5a('0x13')](0x1f4,_0x376ec2[_0x3b5a('0x15')]));});});};exports['ShowMailQueue']=function(_0x93e022){var _0x5e2106=this;return new Promise(function(_0x317c21,_0x2387ed){return db[_0x3b5a('0x18')][_0x3b5a('0x22')]({'raw':_0x93e022[_0x3b5a('0x1a')]?_0x93e022[_0x3b5a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x93e022['options']?_0x93e022['options'][_0x3b5a('0x1b')]||null:null,'attributes':_0x93e022[_0x3b5a('0x1a')]?_0x93e022['options'][_0x3b5a('0x1f')]||null:null,'include':_0x93e022[_0x3b5a('0x1a')]?_0x93e022[_0x3b5a('0x1a')][_0x3b5a('0x1d')]?_[_0x3b5a('0x1e')](_0x93e022[_0x3b5a('0x1a')][_0x3b5a('0x1d')],function(_0x1ada67){return{'model':db[_0x1ada67['model']],'as':_0x1ada67['as'],'attributes':_0x1ada67[_0x3b5a('0x1f')],'include':_0x1ada67[_0x3b5a('0x1d')]?_['map'](_0x1ada67['include'],function(_0x4d8ccb){return{'model':db[_0x4d8ccb[_0x3b5a('0x20')]],'as':_0x4d8ccb['as'],'attributes':_0x4d8ccb[_0x3b5a('0x1f')],'include':_0x4d8ccb[_0x3b5a('0x1d')]?_['map'](_0x4d8ccb[_0x3b5a('0x1d')],function(_0x2cea21){return{'model':db[_0x2cea21[_0x3b5a('0x20')]],'as':_0x2cea21['as'],'attributes':_0x2cea21[_0x3b5a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3b5a('0x21')](function(_0x1cd332){logger[_0x3b5a('0xe')]('ShowMailQueue',_0x93e022);logger['debug'](_0x3b5a('0x23'),_0x93e022,JSON[_0x3b5a('0x12')](_0x1cd332));_0x317c21(_0x1cd332);})[_0x3b5a('0x16')](function(_0x466bb2){logger['error']('ShowMailQueue',_0x466bb2['message'],_0x93e022);_0x2387ed(_0x5e2106[_0x3b5a('0x13')](0x1f4,_0x466bb2[_0x3b5a('0x15')]));});});}; \ No newline at end of file +var _0x3df4=['map','model','stringify','ShowMailQueue','find','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','request\x20sent','debug','error','message','MailQueue,\x20%s,\x20%s','result','catch','GetMailQueue','MailQueue','options','raw','attributes','include'];(function(_0x248703,_0xa58c07){var _0x12daa9=function(_0x53250b){while(--_0x53250b){_0x248703['push'](_0x248703['shift']());}};_0x12daa9(++_0xa58c07);}(_0x3df4,0x102));var _0x43df=function(_0x1a6e4e,_0x3674c4){_0x1a6e4e=_0x1a6e4e-0x0;var _0x7199cb=_0x3df4[_0x1a6e4e];return _0x7199cb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x43df('0x0'));var BPromise=require(_0x43df('0x1'));var rs=require(_0x43df('0x2'));var fs=require('fs');var Redis=require(_0x43df('0x3'));var db=require(_0x43df('0x4'))['db'];var utils=require(_0x43df('0x5'));var logger=require(_0x43df('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x43df('0x7'));var client=jayson[_0x43df('0x8')][_0x43df('0x9')]({'port':0x232a});config[_0x43df('0xa')]=_['defaults'](config['redis'],{'host':_0x43df('0xb'),'port':0x18eb});var socket=require(_0x43df('0xc'))(new Redis(config[_0x43df('0xa')]));require(_0x43df('0xd'))['register'](socket);function respondWithRpcPromise(_0x1ed094,_0x4c5eaf,_0x15f2b0){return new BPromise(function(_0x694bb9,_0xc90b79){return client[_0x43df('0xe')](_0x1ed094,_0x15f2b0)[_0x43df('0xf')](function(_0x28c326){logger[_0x43df('0x10')]('MailQueue,\x20%s,\x20%s',_0x4c5eaf,_0x43df('0x11'));logger[_0x43df('0x12')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x4c5eaf,_0x43df('0x11'),JSON['stringify'](_0x28c326));if(_0x28c326[_0x43df('0x13')]){if(_0x28c326[_0x43df('0x13')]['code']===0x1f4){logger[_0x43df('0x13')]('MailQueue,\x20%s,\x20%s',_0x4c5eaf,_0x28c326['error'][_0x43df('0x14')]);return _0xc90b79(_0x28c326[_0x43df('0x13')]['message']);}logger[_0x43df('0x13')]('MailQueue,\x20%s,\x20%s',_0x4c5eaf,_0x28c326[_0x43df('0x13')][_0x43df('0x14')]);return _0x694bb9(_0x28c326[_0x43df('0x13')][_0x43df('0x14')]);}else{logger[_0x43df('0x10')](_0x43df('0x15'),_0x4c5eaf,'request\x20sent');_0x694bb9(_0x28c326[_0x43df('0x16')][_0x43df('0x14')]);}})[_0x43df('0x17')](function(_0x45f137){logger['error'](_0x43df('0x15'),_0x4c5eaf,_0x45f137);_0xc90b79(_0x45f137);});});}exports[_0x43df('0x18')]=function(_0x121786){var _0x4ab87c=this;return new Promise(function(_0x560a39,_0x4303c5){return db[_0x43df('0x19')]['findAll']({'raw':_0x121786[_0x43df('0x1a')]?_0x121786[_0x43df('0x1a')][_0x43df('0x1b')]===undefined?!![]:![]:!![],'where':_0x121786['options']?_0x121786[_0x43df('0x1a')]['where']||null:null,'attributes':_0x121786[_0x43df('0x1a')]?_0x121786['options'][_0x43df('0x1c')]||null:null,'limit':_0x121786[_0x43df('0x1a')]?_0x121786[_0x43df('0x1a')]['limit']||null:null,'include':_0x121786[_0x43df('0x1a')]?_0x121786['options'][_0x43df('0x1d')]?_[_0x43df('0x1e')](_0x121786[_0x43df('0x1a')][_0x43df('0x1d')],function(_0x84521){return{'model':db[_0x84521[_0x43df('0x1f')]],'as':_0x84521['as'],'attributes':_0x84521[_0x43df('0x1c')],'include':_0x84521[_0x43df('0x1d')]?_[_0x43df('0x1e')](_0x84521[_0x43df('0x1d')],function(_0x2aa723){return{'model':db[_0x2aa723['model']],'as':_0x2aa723['as'],'attributes':_0x2aa723[_0x43df('0x1c')],'include':_0x2aa723[_0x43df('0x1d')]?_[_0x43df('0x1e')](_0x2aa723[_0x43df('0x1d')],function(_0x250fda){return{'model':db[_0x250fda[_0x43df('0x1f')]],'as':_0x250fda['as'],'attributes':_0x250fda[_0x43df('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x43df('0xf')](function(_0x1eed39){logger['info']('GetMailQueue',_0x121786);logger[_0x43df('0x12')](_0x43df('0x18'),_0x121786,JSON[_0x43df('0x20')](_0x1eed39));_0x560a39(_0x1eed39);})[_0x43df('0x17')](function(_0x2c6b4d){logger['error'](_0x43df('0x18'),_0x2c6b4d[_0x43df('0x14')],_0x121786);_0x4303c5(_0x4ab87c[_0x43df('0x13')](0x1f4,_0x2c6b4d[_0x43df('0x14')]));});});};exports[_0x43df('0x21')]=function(_0x228a27){var _0x2fe4f5=this;return new Promise(function(_0x2b72ef,_0x1a6ece){return db[_0x43df('0x19')][_0x43df('0x22')]({'raw':_0x228a27[_0x43df('0x1a')]?_0x228a27[_0x43df('0x1a')][_0x43df('0x1b')]===undefined?!![]:![]:!![],'where':_0x228a27['options']?_0x228a27['options'][_0x43df('0x23')]||null:null,'attributes':_0x228a27['options']?_0x228a27[_0x43df('0x1a')][_0x43df('0x1c')]||null:null,'include':_0x228a27[_0x43df('0x1a')]?_0x228a27[_0x43df('0x1a')]['include']?_[_0x43df('0x1e')](_0x228a27[_0x43df('0x1a')][_0x43df('0x1d')],function(_0x5071a4){return{'model':db[_0x5071a4[_0x43df('0x1f')]],'as':_0x5071a4['as'],'attributes':_0x5071a4[_0x43df('0x1c')],'include':_0x5071a4[_0x43df('0x1d')]?_[_0x43df('0x1e')](_0x5071a4['include'],function(_0xb5876b){return{'model':db[_0xb5876b[_0x43df('0x1f')]],'as':_0xb5876b['as'],'attributes':_0xb5876b[_0x43df('0x1c')],'include':_0xb5876b[_0x43df('0x1d')]?_[_0x43df('0x1e')](_0xb5876b[_0x43df('0x1d')],function(_0x5ed6f0){return{'model':db[_0x5ed6f0['model']],'as':_0x5ed6f0['as'],'attributes':_0x5ed6f0[_0x43df('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e7b51){logger['info']('ShowMailQueue',_0x228a27);logger[_0x43df('0x12')](_0x43df('0x21'),_0x228a27,JSON[_0x43df('0x20')](_0x4e7b51));_0x2b72ef(_0x4e7b51);})[_0x43df('0x17')](function(_0x48dd3c){logger[_0x43df('0x13')](_0x43df('0x21'),_0x48dd3c['message'],_0x228a27);_0x1a6ece(_0x2fe4f5[_0x43df('0x13')](0x1f4,_0x48dd3c[_0x43df('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index e515eed..4c6fa2a 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 _0xecd8=['length','mailQueue:','./mailQueue.events','remove','update','emit'];(function(_0x588c75,_0x3e28dc){var _0x527cf5=function(_0x538d6c){while(--_0x538d6c){_0x588c75['push'](_0x588c75['shift']());}};_0x527cf5(++_0x3e28dc);}(_0xecd8,0x6e));var _0x8ecd=function(_0x53653e,_0x5f456b){_0x53653e=_0x53653e-0x0;var _0x37a04f=_0xecd8[_0x53653e];return _0x37a04f;};'use strict';var MailQueueEvents=require(_0x8ecd('0x0'));var events=['save',_0x8ecd('0x1'),_0x8ecd('0x2')];function createListener(_0x2a051e,_0x3ad184){return function(_0x451a33){_0x3ad184[_0x8ecd('0x3')](_0x2a051e,_0x451a33);};}function removeListener(_0x530906,_0x4ee7e4){return function(){MailQueueEvents['removeListener'](_0x530906,_0x4ee7e4);};}exports['register']=function(_0x2f993e){for(var _0x4a866e=0x0,_0x23cb9b=events[_0x8ecd('0x4')];_0x4a866e<_0x23cb9b;_0x4a866e++){var _0x5bf5cc=events[_0x4a866e];var _0x2c7e69=createListener(_0x8ecd('0x5')+_0x5bf5cc,_0x2f993e);MailQueueEvents['on'](_0x5bf5cc,_0x2c7e69);}}; \ No newline at end of file +var _0xce9e=['./mailQueue.events','save','remove','emit','removeListener','register','length','mailQueue:'];(function(_0x28f64d,_0x322ea5){var _0x2410d0=function(_0x4100b){while(--_0x4100b){_0x28f64d['push'](_0x28f64d['shift']());}};_0x2410d0(++_0x322ea5);}(_0xce9e,0x1c8));var _0xece9=function(_0x3cb465,_0x36d920){_0x3cb465=_0x3cb465-0x0;var _0x4e197b=_0xce9e[_0x3cb465];return _0x4e197b;};'use strict';var MailQueueEvents=require(_0xece9('0x0'));var events=[_0xece9('0x1'),_0xece9('0x2'),'update'];function createListener(_0x1ca816,_0x47890d){return function(_0x4e0fba){_0x47890d[_0xece9('0x3')](_0x1ca816,_0x4e0fba);};}function removeListener(_0x5e6185,_0x1eeff6){return function(){MailQueueEvents[_0xece9('0x4')](_0x5e6185,_0x1eeff6);};}exports[_0xece9('0x5')]=function(_0x27c0c0){for(var _0x139aaf=0x0,_0xa03386=events[_0xece9('0x6')];_0x139aaf<_0xa03386;_0x139aaf++){var _0x4a6553=events[_0x139aaf];var _0x5c2d59=createListener(_0xece9('0x7')+_0x4a6553,_0x27c0c0);MailQueueEvents['on'](_0x4a6553,_0x5c2d59);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 02d36f8..a6be638 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 _0xdc73=['show','post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','describe'];(function(_0x904d44,_0x4347dc){var _0x45d207=function(_0x5b44dd){while(--_0x5b44dd){_0x904d44['push'](_0x904d44['shift']());}};_0x45d207(++_0x4347dc);}(_0xdc73,0x1c0));var _0x3dc7=function(_0x1ea759,_0x1db696){_0x1ea759=_0x1ea759-0x0;var _0x4c546a=_0xdc73[_0x1ea759];return _0x4c546a;};'use strict';var multer=require(_0x3dc7('0x0'));var util=require(_0x3dc7('0x1'));var path=require(_0x3dc7('0x2'));var timeout=require(_0x3dc7('0x3'));var express=require(_0x3dc7('0x4'));var router=express[_0x3dc7('0x5')]();var fs_extra=require(_0x3dc7('0x6'));var auth=require(_0x3dc7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3dc7('0x8'));var controller=require(_0x3dc7('0x9'));router['get']('/',auth[_0x3dc7('0xa')](),controller[_0x3dc7('0xb')]);router[_0x3dc7('0xc')]('/describe',auth[_0x3dc7('0xa')](),controller[_0x3dc7('0xd')]);router[_0x3dc7('0xc')]('/:id',auth[_0x3dc7('0xa')](),controller[_0x3dc7('0xe')]);router[_0x3dc7('0xf')]('/',auth[_0x3dc7('0xa')](),controller[_0x3dc7('0x10')]);router['put']('/:id',auth[_0x3dc7('0xa')](),controller[_0x3dc7('0x11')]);router[_0x3dc7('0x12')](_0x3dc7('0x13'),auth[_0x3dc7('0xa')](),controller[_0x3dc7('0x14')]);module[_0x3dc7('0x15')]=router; \ No newline at end of file +var _0x23fd=['/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get'];(function(_0x58de16,_0x4fffd7){var _0x54eaa0=function(_0x4d74c1){while(--_0x4d74c1){_0x58de16['push'](_0x58de16['shift']());}};_0x54eaa0(++_0x4fffd7);}(_0x23fd,0x153));var _0xd23f=function(_0x558c26,_0x5aa06f){_0x558c26=_0x558c26-0x0;var _0x2e6289=_0x23fd[_0x558c26];return _0x2e6289;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd23f('0x0'));var express=require(_0xd23f('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd23f('0x2'));var config=require(_0xd23f('0x3'));var controller=require(_0xd23f('0x4'));router[_0xd23f('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd23f('0x5')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xd23f('0x5')](_0xd23f('0x6'),auth[_0xd23f('0x7')](),controller['show']);router[_0xd23f('0x8')]('/',auth[_0xd23f('0x7')](),controller[_0xd23f('0x9')]);router[_0xd23f('0xa')](_0xd23f('0x6'),auth['isAuthenticated'](),controller[_0xd23f('0xb')]);router[_0xd23f('0xc')](_0xd23f('0x6'),auth[_0xd23f('0x7')](),controller[_0xd23f('0xd')]);module[_0xd23f('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 6628f92..24190b1 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 _0x4350=['moment','sequelize','STRING','DATE'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0x4350,0x1d0));var _0x0435=function(_0x59586b,_0x6cdd37){_0x59586b=_0x59586b-0x0;var _0x2f03ec=_0x4350[_0x59586b];return _0x2f03ec;};'use strict';var moment=require(_0x0435('0x0'));var Sequelize=require(_0x0435('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x0435('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0435('0x3')]},'leaveAt':{'type':Sequelize[_0x0435('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x0435('0x3')]},'reason':{'type':Sequelize[_0x0435('0x2')]}}; \ No newline at end of file +var _0x4ab0=['DATE','sequelize','exports','STRING'];(function(_0x320415,_0x1c3ced){var _0x3b0628=function(_0x4c9bca){while(--_0x4c9bca){_0x320415['push'](_0x320415['shift']());}};_0x3b0628(++_0x1c3ced);}(_0x4ab0,0xd5));var _0x04ab=function(_0x10d392,_0xefb140){_0x10d392=_0x10d392-0x0;var _0x4f91e8=_0x4ab0[_0x10d392];return _0x4f91e8;};'use strict';var moment=require('moment');var Sequelize=require(_0x04ab('0x0'));module[_0x04ab('0x1')]={'uniqueid':{'type':Sequelize[_0x04ab('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x04ab('0x2')]},'joinAt':{'type':Sequelize[_0x04ab('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x04ab('0x3')]},'reason':{'type':Sequelize[_0x04ab('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 921a873..0b53877 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 _0x1893=['query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','map','VIRTUAL','filter','includeAll','include','catch','keys','merge','find','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','send','index','MailQueueReport','rawAttributes','type','key','model','name'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1893,0xa2));var _0x3189=function(_0x17479d,_0x593129){_0x17479d=_0x17479d-0x0;var _0x2d461c=_0x1893[_0x17479d];return _0x2d461c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3189('0x0'));var jsonpatch=require(_0x3189('0x1'));var rp=require(_0x3189('0x2'));var moment=require(_0x3189('0x3'));var BPromise=require(_0x3189('0x4'));var Mustache=require(_0x3189('0x5'));var util=require(_0x3189('0x6'));var path=require('path');var sox=require(_0x3189('0x7'));var csv=require(_0x3189('0x8'));var ejs=require(_0x3189('0x9'));var fs=require('fs');var fs_extra=require(_0x3189('0xa'));var _=require(_0x3189('0xb'));var squel=require(_0x3189('0xc'));var crypto=require(_0x3189('0xd'));var jsforce=require(_0x3189('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3189('0x8'));var querystring=require('querystring');var Papa=require(_0x3189('0xf'));var Redis=require('ioredis');var authService=require(_0x3189('0x10'));var qs=require(_0x3189('0x11'));var as=require(_0x3189('0x12'));var hardwareService=require(_0x3189('0x13'));var logger=require('../../config/logger')(_0x3189('0x14'));var utils=require(_0x3189('0x15'));var config=require(_0x3189('0x16'));var licenseUtil=require(_0x3189('0x17'));var db=require(_0x3189('0x18'))['db'];function respondWithStatusCode(_0x5d9fff,_0x22b11e){_0x22b11e=_0x22b11e||0xcc;return function(_0x353b17){if(_0x353b17){return _0x5d9fff[_0x3189('0x19')](_0x22b11e);}return _0x5d9fff[_0x3189('0x1a')](_0x22b11e)[_0x3189('0x1b')]();};}function respondWithResult(_0x20dcc2,_0xef438){_0xef438=_0xef438||0xc8;return function(_0x25a917){if(_0x25a917){return _0x20dcc2['status'](_0xef438)[_0x3189('0x1c')](_0x25a917);}};}function respondWithFilteredResult(_0xb3e4c2,_0x1c209b){return function(_0x2fb62b){if(_0x2fb62b){var _0x486dd2=typeof _0x1c209b[_0x3189('0x1d')]==='undefined'&&typeof _0x1c209b['limit']===_0x3189('0x1e');var _0x49b1bc=_0x2fb62b[_0x3189('0x1f')];var _0xf8aed7=_0x486dd2?0x0:_0x1c209b[_0x3189('0x1d')];var _0x9905c4=_0x486dd2?_0x2fb62b['count']:_0x1c209b[_0x3189('0x1d')]+_0x1c209b[_0x3189('0x20')];var _0x16edd7;if(_0x9905c4>=_0x49b1bc){_0x9905c4=_0x49b1bc;_0x16edd7=0xc8;}else{_0x16edd7=0xce;}_0xb3e4c2['status'](_0x16edd7);return _0xb3e4c2[_0x3189('0x21')](_0x3189('0x22'),_0xf8aed7+'-'+_0x9905c4+'/'+_0x49b1bc)[_0x3189('0x1c')](_0x2fb62b);}return null;};}function patchUpdates(_0x2c1e59){return function(_0x29b275){try{jsonpatch['apply'](_0x29b275,_0x2c1e59,!![]);}catch(_0x1771a8){return BPromise[_0x3189('0x23')](_0x1771a8);}return _0x29b275[_0x3189('0x24')]();};}function saveUpdates(_0x539e12,_0x309c6e){return function(_0x47abb4){if(_0x47abb4){return _0x47abb4[_0x3189('0x25')](_0x539e12)[_0x3189('0x26')](function(_0x200f16){return _0x200f16;});}return null;};}function removeEntity(_0x38e56a,_0x1cbe33){return function(_0x393fcb){if(_0x393fcb){return _0x393fcb['destroy']()['then'](function(){_0x38e56a[_0x3189('0x1a')](0xcc)[_0x3189('0x1b')]();});}};}function handleEntityNotFound(_0x1dc1c8,_0x3cc1e5){return function(_0x103de4){if(!_0x103de4){_0x1dc1c8[_0x3189('0x19')](0x194);}return _0x103de4;};}function handleError(_0xdda38b,_0x379a48){_0x379a48=_0x379a48||0x1f4;return function(_0x17b540){logger[_0x3189('0x27')](_0x17b540['stack']);if(_0x17b540['name']){delete _0x17b540['name'];}_0xdda38b[_0x3189('0x1a')](_0x379a48)[_0x3189('0x28')](_0x17b540);};}exports[_0x3189('0x29')]=function(_0x90c31,_0x36b258){var _0x2f7504={},_0x4d453a={},_0x1ab94b={'count':0x0,'rows':[]};var _0x37b9ec=_['map'](db[_0x3189('0x2a')][_0x3189('0x2b')],function(_0x39c5e4){return{'name':_0x39c5e4['fieldName'],'type':_0x39c5e4[_0x3189('0x2c')][_0x3189('0x2d')]};});_0x4d453a[_0x3189('0x2e')]=_['map'](_0x37b9ec,_0x3189('0x2f'));_0x4d453a[_0x3189('0x30')]=_['keys'](_0x90c31[_0x3189('0x30')]);_0x4d453a[_0x3189('0x31')]=_[_0x3189('0x32')](_0x4d453a[_0x3189('0x2e')],_0x4d453a[_0x3189('0x30')]);_0x2f7504['attributes']=_['intersection'](_0x4d453a[_0x3189('0x2e')],qs['fields'](_0x90c31[_0x3189('0x30')][_0x3189('0x33')]));_0x2f7504[_0x3189('0x34')]=_0x2f7504[_0x3189('0x34')][_0x3189('0x35')]?_0x2f7504[_0x3189('0x34')]:_0x4d453a[_0x3189('0x2e')];if(!_0x90c31[_0x3189('0x30')][_0x3189('0x36')]('nolimit')){_0x2f7504[_0x3189('0x20')]=qs[_0x3189('0x20')](_0x90c31[_0x3189('0x30')][_0x3189('0x20')]);_0x2f7504[_0x3189('0x1d')]=qs[_0x3189('0x1d')](_0x90c31[_0x3189('0x30')]['offset']);}_0x2f7504['order']=qs[_0x3189('0x37')](_0x90c31['query'][_0x3189('0x37')]);_0x2f7504[_0x3189('0x38')]=qs['filters'](_[_0x3189('0x39')](_0x90c31[_0x3189('0x30')],_0x4d453a[_0x3189('0x31')]),_0x37b9ec);if(_0x90c31[_0x3189('0x30')]['filter']){_0x2f7504[_0x3189('0x38')]=_['merge'](_0x2f7504['where'],{'$or':_[_0x3189('0x3a')](_0x37b9ec,function(_0xed3041){if(_0xed3041[_0x3189('0x2c')]!==_0x3189('0x3b')){var _0x12dee0={};_0x12dee0[_0xed3041[_0x3189('0x2f')]]={'$like':'%'+_0x90c31[_0x3189('0x30')][_0x3189('0x3c')]+'%'};return _0x12dee0;}})});}_0x2f7504=_['merge']({},_0x2f7504,_0x90c31['options']);var _0x407e0a={'where':_0x2f7504[_0x3189('0x38')]};return db[_0x3189('0x2a')][_0x3189('0x1f')](_0x407e0a)[_0x3189('0x26')](function(_0xb52c70){_0x1ab94b['count']=_0xb52c70;if(_0x90c31[_0x3189('0x30')][_0x3189('0x3d')]){_0x2f7504[_0x3189('0x3e')]=[{'all':!![]}];}return db[_0x3189('0x2a')]['findAll'](_0x2f7504);})[_0x3189('0x26')](function(_0x2f0d49){_0x1ab94b['rows']=_0x2f0d49;return _0x1ab94b;})['then'](respondWithFilteredResult(_0x36b258,_0x2f7504))[_0x3189('0x3f')](handleError(_0x36b258,null));};exports['show']=function(_0x376787,_0x3074b9){var _0x38bf83={'raw':!![],'where':{'id':_0x376787['params']['id']}},_0x9593f3={};_0x9593f3[_0x3189('0x2e')]=_[_0x3189('0x40')](db['MailQueueReport'][_0x3189('0x2b')]);_0x9593f3[_0x3189('0x30')]=_[_0x3189('0x40')](_0x376787[_0x3189('0x30')]);_0x9593f3[_0x3189('0x31')]=_['intersection'](_0x9593f3['model'],_0x9593f3[_0x3189('0x30')]);_0x38bf83['attributes']=_[_0x3189('0x32')](_0x9593f3[_0x3189('0x2e')],qs[_0x3189('0x33')](_0x376787['query'][_0x3189('0x33')]));_0x38bf83[_0x3189('0x34')]=_0x38bf83[_0x3189('0x34')]['length']?_0x38bf83[_0x3189('0x34')]:_0x9593f3[_0x3189('0x2e')];if(_0x376787[_0x3189('0x30')][_0x3189('0x3d')]){_0x38bf83[_0x3189('0x3e')]=[{'all':!![]}];}_0x38bf83=_[_0x3189('0x41')]({},_0x38bf83,_0x376787['options']);return db['MailQueueReport'][_0x3189('0x42')](_0x38bf83)['then'](handleEntityNotFound(_0x3074b9,null))['then'](respondWithResult(_0x3074b9,null))[_0x3189('0x3f')](handleError(_0x3074b9,null));};exports['create']=function(_0x2d58fd,_0x1b6f09){return db[_0x3189('0x2a')]['create'](_0x2d58fd[_0x3189('0x43')],{})['then'](respondWithResult(_0x1b6f09,0xc9))[_0x3189('0x3f')](handleError(_0x1b6f09,null));};exports['update']=function(_0x49c4a8,_0x244166){if(_0x49c4a8['body']['id']){delete _0x49c4a8[_0x3189('0x43')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x49c4a8[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x244166,null))[_0x3189('0x26')](saveUpdates(_0x49c4a8[_0x3189('0x43')],null))[_0x3189('0x26')](respondWithResult(_0x244166,null))[_0x3189('0x3f')](handleError(_0x244166,null));};exports['destroy']=function(_0x21d446,_0x549bc7){return db['MailQueueReport'][_0x3189('0x42')]({'where':{'id':_0x21d446[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x549bc7,null))[_0x3189('0x26')](removeEntity(_0x549bc7,null))[_0x3189('0x3f')](handleError(_0x549bc7,null));};exports[_0x3189('0x45')]=function(_0x556ee5,_0x5117fb){return db['MailQueueReport'][_0x3189('0x45')]()[_0x3189('0x26')](respondWithResult(_0x5117fb,null))[_0x3189('0x3f')](handleError(_0x5117fb,null));}; \ No newline at end of file +var _0x6050=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','name','send','index','map','MailQueueReport','rawAttributes','type','key','model','query','keys'];(function(_0x4902bf,_0x448506){var _0x298591=function(_0x4b366e){while(--_0x4b366e){_0x4902bf['push'](_0x4902bf['shift']());}};_0x298591(++_0x448506);}(_0x6050,0x196));var _0x0605=function(_0x68f60,_0x2daa2d){_0x68f60=_0x68f60-0x0;var _0x525658=_0x6050[_0x68f60];return _0x525658;};'use strict';var emlformat=require(_0x0605('0x0'));var rimraf=require(_0x0605('0x1'));var zipdir=require(_0x0605('0x2'));var jsonpatch=require(_0x0605('0x3'));var rp=require(_0x0605('0x4'));var moment=require(_0x0605('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0605('0x6'));var util=require(_0x0605('0x7'));var path=require(_0x0605('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0605('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var licenseUtil=require(_0x0605('0x17'));var db=require(_0x0605('0x18'))['db'];function respondWithStatusCode(_0xd22e35,_0x39e288){_0x39e288=_0x39e288||0xcc;return function(_0x34c9e6){if(_0x34c9e6){return _0xd22e35[_0x0605('0x19')](_0x39e288);}return _0xd22e35[_0x0605('0x1a')](_0x39e288)[_0x0605('0x1b')]();};}function respondWithResult(_0x169a70,_0x65a20b){_0x65a20b=_0x65a20b||0xc8;return function(_0x1b944f){if(_0x1b944f){return _0x169a70['status'](_0x65a20b)[_0x0605('0x1c')](_0x1b944f);}};}function respondWithFilteredResult(_0x1a802b,_0x4993ab){return function(_0x5ce56a){if(_0x5ce56a){var _0x4eefe9=typeof _0x4993ab[_0x0605('0x1d')]===_0x0605('0x1e')&&typeof _0x4993ab[_0x0605('0x1f')]===_0x0605('0x1e');var _0xefc557=_0x5ce56a[_0x0605('0x20')];var _0x2b7b5a=_0x4eefe9?0x0:_0x4993ab[_0x0605('0x1d')];var _0x193520=_0x4eefe9?_0x5ce56a[_0x0605('0x20')]:_0x4993ab[_0x0605('0x1d')]+_0x4993ab[_0x0605('0x1f')];var _0x2e2204;if(_0x193520>=_0xefc557){_0x193520=_0xefc557;_0x2e2204=0xc8;}else{_0x2e2204=0xce;}_0x1a802b[_0x0605('0x1a')](_0x2e2204);return _0x1a802b['set'](_0x0605('0x21'),_0x2b7b5a+'-'+_0x193520+'/'+_0xefc557)[_0x0605('0x1c')](_0x5ce56a);}return null;};}function patchUpdates(_0x430f28){return function(_0x443326){try{jsonpatch[_0x0605('0x22')](_0x443326,_0x430f28,!![]);}catch(_0x90b2e1){return BPromise[_0x0605('0x23')](_0x90b2e1);}return _0x443326[_0x0605('0x24')]();};}function saveUpdates(_0x226ef5,_0x5b0d44){return function(_0xc334b8){if(_0xc334b8){return _0xc334b8['update'](_0x226ef5)[_0x0605('0x25')](function(_0x118e9c){return _0x118e9c;});}return null;};}function removeEntity(_0x110098,_0xf182c4){return function(_0x10c575){if(_0x10c575){return _0x10c575[_0x0605('0x26')]()[_0x0605('0x25')](function(){_0x110098[_0x0605('0x1a')](0xcc)[_0x0605('0x1b')]();});}};}function handleEntityNotFound(_0x2896d7,_0x9f2833){return function(_0x1c3722){if(!_0x1c3722){_0x2896d7['sendStatus'](0x194);}return _0x1c3722;};}function handleError(_0x6bc204,_0x3c8e36){_0x3c8e36=_0x3c8e36||0x1f4;return function(_0x4b1e0c){logger['error'](_0x4b1e0c['stack']);if(_0x4b1e0c[_0x0605('0x27')]){delete _0x4b1e0c[_0x0605('0x27')];}_0x6bc204[_0x0605('0x1a')](_0x3c8e36)[_0x0605('0x28')](_0x4b1e0c);};}exports[_0x0605('0x29')]=function(_0x4554df,_0x4e32ef){var _0x34f25d={},_0x5daef6={},_0xa836f2={'count':0x0,'rows':[]};var _0x3640b9=_[_0x0605('0x2a')](db[_0x0605('0x2b')][_0x0605('0x2c')],function(_0x352dd6){return{'name':_0x352dd6['fieldName'],'type':_0x352dd6[_0x0605('0x2d')][_0x0605('0x2e')]};});_0x5daef6[_0x0605('0x2f')]=_[_0x0605('0x2a')](_0x3640b9,_0x0605('0x27'));_0x5daef6[_0x0605('0x30')]=_[_0x0605('0x31')](_0x4554df[_0x0605('0x30')]);_0x5daef6[_0x0605('0x32')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],_0x5daef6[_0x0605('0x30')]);_0x34f25d[_0x0605('0x34')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x4554df[_0x0605('0x30')][_0x0605('0x35')]));_0x34f25d[_0x0605('0x34')]=_0x34f25d[_0x0605('0x34')][_0x0605('0x36')]?_0x34f25d[_0x0605('0x34')]:_0x5daef6[_0x0605('0x2f')];if(!_0x4554df[_0x0605('0x30')][_0x0605('0x37')](_0x0605('0x38'))){_0x34f25d[_0x0605('0x1f')]=qs['limit'](_0x4554df[_0x0605('0x30')][_0x0605('0x1f')]);_0x34f25d['offset']=qs[_0x0605('0x1d')](_0x4554df[_0x0605('0x30')]['offset']);}_0x34f25d[_0x0605('0x39')]=qs[_0x0605('0x3a')](_0x4554df[_0x0605('0x30')][_0x0605('0x3a')]);_0x34f25d[_0x0605('0x3b')]=qs[_0x0605('0x32')](_['pick'](_0x4554df['query'],_0x5daef6[_0x0605('0x32')]),_0x3640b9);if(_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]){_0x34f25d['where']=_[_0x0605('0x3d')](_0x34f25d['where'],{'$or':_[_0x0605('0x2a')](_0x3640b9,function(_0x1e98f6){if(_0x1e98f6[_0x0605('0x2d')]!==_0x0605('0x3e')){var _0x42f7ce={};_0x42f7ce[_0x1e98f6[_0x0605('0x27')]]={'$like':'%'+_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]+'%'};return _0x42f7ce;}})});}_0x34f25d=_[_0x0605('0x3d')]({},_0x34f25d,_0x4554df[_0x0605('0x3f')]);var _0x57aa15={'where':_0x34f25d[_0x0605('0x3b')]};return db['MailQueueReport'][_0x0605('0x20')](_0x57aa15)[_0x0605('0x25')](function(_0x45787e){_0xa836f2['count']=_0x45787e;if(_0x4554df['query'][_0x0605('0x40')]){_0x34f25d['include']=[{'all':!![]}];}return db[_0x0605('0x2b')][_0x0605('0x41')](_0x34f25d);})[_0x0605('0x25')](function(_0x3de34a){_0xa836f2[_0x0605('0x42')]=_0x3de34a;return _0xa836f2;})[_0x0605('0x25')](respondWithFilteredResult(_0x4e32ef,_0x34f25d))[_0x0605('0x43')](handleError(_0x4e32ef,null));};exports[_0x0605('0x44')]=function(_0x3fa553,_0x10bb36){var _0x18d3ce={'raw':!![],'where':{'id':_0x3fa553[_0x0605('0x45')]['id']}},_0x3616a3={};_0x3616a3['model']=_['keys'](db[_0x0605('0x2b')]['rawAttributes']);_0x3616a3[_0x0605('0x30')]=_[_0x0605('0x31')](_0x3fa553['query']);_0x3616a3[_0x0605('0x32')]=_[_0x0605('0x33')](_0x3616a3['model'],_0x3616a3[_0x0605('0x30')]);_0x18d3ce[_0x0605('0x34')]=_['intersection'](_0x3616a3[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x3fa553['query'][_0x0605('0x35')]));_0x18d3ce['attributes']=_0x18d3ce['attributes'][_0x0605('0x36')]?_0x18d3ce[_0x0605('0x34')]:_0x3616a3[_0x0605('0x2f')];if(_0x3fa553[_0x0605('0x30')][_0x0605('0x40')]){_0x18d3ce[_0x0605('0x46')]=[{'all':!![]}];}_0x18d3ce=_[_0x0605('0x3d')]({},_0x18d3ce,_0x3fa553[_0x0605('0x3f')]);return db['MailQueueReport'][_0x0605('0x47')](_0x18d3ce)[_0x0605('0x25')](handleEntityNotFound(_0x10bb36,null))[_0x0605('0x25')](respondWithResult(_0x10bb36,null))['catch'](handleError(_0x10bb36,null));};exports[_0x0605('0x48')]=function(_0x1fb70b,_0x45cc1a){return db[_0x0605('0x2b')][_0x0605('0x48')](_0x1fb70b[_0x0605('0x49')],{})[_0x0605('0x25')](respondWithResult(_0x45cc1a,0xc9))[_0x0605('0x43')](handleError(_0x45cc1a,null));};exports[_0x0605('0x4a')]=function(_0x4bc55e,_0x3c597c){if(_0x4bc55e[_0x0605('0x49')]['id']){delete _0x4bc55e[_0x0605('0x49')]['id'];}return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4bc55e[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x3c597c,null))[_0x0605('0x25')](saveUpdates(_0x4bc55e[_0x0605('0x49')],null))[_0x0605('0x25')](respondWithResult(_0x3c597c,null))['catch'](handleError(_0x3c597c,null));};exports['destroy']=function(_0x4876c7,_0x2687a8){return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4876c7[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x2687a8,null))[_0x0605('0x25')](removeEntity(_0x2687a8,null))['catch'](handleError(_0x2687a8,null));};exports[_0x0605('0x4b')]=function(_0x286485,_0x184232){return db[_0x0605('0x2b')]['describe']()[_0x0605('0x25')](respondWithResult(_0x184232,null))[_0x0605('0x43')](handleError(_0x184232,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index bd699c5..6cf973c 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 _0xb0ac=['lodash','util','api','bluebird','request-promise','path','define','uniqueid'];(function(_0x42c069,_0xdfa0f9){var _0x4f0740=function(_0x4c9fd9){while(--_0x4c9fd9){_0x42c069['push'](_0x42c069['shift']());}};_0x4f0740(++_0xdfa0f9);}(_0xb0ac,0x110));var _0xcb0a=function(_0x788130,_0x5e0c8c){_0x788130=_0x788130-0x0;var _0x2d564c=_0xb0ac[_0x788130];return _0x2d564c;};'use strict';var _=require(_0xcb0a('0x0'));var util=require(_0xcb0a('0x1'));var logger=require('../../config/logger')(_0xcb0a('0x2'));var moment=require('moment');var BPromise=require(_0xcb0a('0x3'));var rp=require(_0xcb0a('0x4'));var fs=require('fs');var path=require(_0xcb0a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x5703e0,_0x543bce){return _0x5703e0[_0xcb0a('0x6')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xcb0a('0x7'),'fields':[_0xcb0a('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x668d=['report_mail_queue','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x668d,0x1b9));var _0xd668=function(_0x5a7446,_0x58c954){_0x5a7446=_0x5a7446-0x0;var _0x2a164a=_0x668d[_0x5a7446];return _0x2a164a;};'use strict';var _=require('lodash');var util=require(_0xd668('0x0'));var logger=require(_0xd668('0x1'))('api');var moment=require(_0xd668('0x2'));var BPromise=require(_0xd668('0x3'));var rp=require(_0xd668('0x4'));var fs=require('fs');var path=require(_0xd668('0x5'));var rimraf=require('rimraf');var config=require(_0xd668('0x6'));var attributes=require(_0xd668('0x7'));module[_0xd668('0x8')]=function(_0x2c00ed,_0x3ca3f4){return _0x2c00ed['define']('MailQueueReport',attributes,{'tableName':_0xd668('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index d6f63c3..9f77eb4 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x68c4e3,_0x5b18b0){var _0xaca048=function(_0x485160){while(--_0x485160){_0x68c4e3['push'](_0x68c4e3['shift']());}};_0xaca048(++_0x5b18b0);}(_0x2ef3,0xba));var _0x32ef=function(_0x4bc179,_0x119068){_0x4bc179=_0x4bc179-0x0;var _0x11a11a=_0x2ef3[_0x4bc179];return _0x11a11a;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x3cd092,_0x2f5862){var _0x335be6=function(_0x400028){while(--_0x400028){_0x3cd092['push'](_0x3cd092['shift']());}};_0x335be6(++_0x2f5862);}(_0x7a54,0x106));var _0x47a5=function(_0x1f19db,_0x4627da){_0x1f19db=_0x1f19db-0x0;var _0x2c6fe3=_0x7a54[_0x1f19db];return _0x2c6fe3;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=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')]('CreateMailQueueReport',_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')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 924575a..f847617 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4bd4da,_0x5621f8){var _0x517ef0=function(_0x39d45f){while(--_0x39d45f){_0x4bd4da['push'](_0x4bd4da['shift']());}};_0x517ef0(++_0x5621f8);}(_0xe706,0xa3));var _0x6e70=function(_0x4e1991,_0xeb727c){_0x4e1991=_0x4e1991-0x0;var _0x318050=_0xe706[_0x4e1991];return _0x318050;};'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(_0x3913a4,_0x337cc6){var _0x5a8369=function(_0x310e3a){while(--_0x310e3a){_0x3913a4['push'](_0x3913a4['shift']());}};_0x5a8369(++_0x337cc6);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index d09913b..e36c7a1 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 _0x14da=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x2a01af,_0x214b6b){var _0x28363f=function(_0x412a82){while(--_0x412a82){_0x2a01af['push'](_0x2a01af['shift']());}};_0x28363f(++_0x214b6b);}(_0x14da,0x6c));var _0xa14d=function(_0x15d4d8,_0x447edc){_0x15d4d8=_0x15d4d8-0x0;var _0x1ca21f=_0x14da[_0x15d4d8];return _0x1ca21f;};'use strict';var Sequelize=require(_0xa14d('0x0'));module[_0xa14d('0x1')]={'description':{'type':Sequelize[_0xa14d('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xa14d('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xa14d('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xa14d('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xa14d('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xa14d('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xa14d('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xa14d('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9f4d=['INBOX','INTEGER','exports','STRING','BOOLEAN'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9f4d,0x7f));var _0xd9f4=function(_0x17b90c,_0x46ba51){_0x17b90c=_0x17b90c-0x0;var _0x4100d2=_0x9f4d[_0x17b90c];return _0x4100d2;};'use strict';var Sequelize=require('sequelize');module[_0xd9f4('0x0')]={'description':{'type':Sequelize[_0xd9f4('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xd9f4('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xd9f4('0x1')]},'password':{'type':Sequelize[_0xd9f4('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xd9f4('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd9f4('0x1')],'defaultValue':_0xd9f4('0x3')},'connTimeout':{'type':Sequelize[_0xd9f4('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xd9f4('0x1')]},'modernAuthentication':{'type':Sequelize[_0xd9f4('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 764c46c..fcd23ec 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 _0xd05b=['define','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./mailServerIn.attributes'];(function(_0x56f72c,_0x5747bb){var _0x54fdb5=function(_0x1fb0a6){while(--_0x1fb0a6){_0x56f72c['push'](_0x56f72c['shift']());}};_0x54fdb5(++_0x5747bb);}(_0xd05b,0x139));var _0xbd05=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xd05b[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0xbd05('0x0'));var util=require(_0xbd05('0x1'));var logger=require(_0xbd05('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbd05('0x3'));var rp=require(_0xbd05('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd05('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd05('0x6'));module['exports']=function(_0x5c6cab,_0x14d377){return _0x5c6cab[_0xbd05('0x7')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb633=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','MailServerIn','lodash'];(function(_0x2b1fd0,_0x50039e){var _0x99d875=function(_0xbe9cdc){while(--_0xbe9cdc){_0x2b1fd0['push'](_0x2b1fd0['shift']());}};_0x99d875(++_0x50039e);}(_0xb633,0x15f));var _0x3b63=function(_0x38aa6f,_0x3f4a2d){_0x38aa6f=_0x38aa6f-0x0;var _0x521ef5=_0xb633[_0x38aa6f];return _0x521ef5;};'use strict';var _=require(_0x3b63('0x0'));var util=require('util');var logger=require(_0x3b63('0x1'))(_0x3b63('0x2'));var moment=require(_0x3b63('0x3'));var BPromise=require(_0x3b63('0x4'));var rp=require(_0x3b63('0x5'));var fs=require('fs');var path=require(_0x3b63('0x6'));var rimraf=require(_0x3b63('0x7'));var config=require(_0x3b63('0x8'));var attributes=require('./mailServerIn.attributes');module[_0x3b63('0x9')]=function(_0x51e62c,_0x776325){return _0x51e62c['define'](_0x3b63('0xa'),attributes,{'tableName':'mail_servers_in','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 2291645..db72c52 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 _0xb071=['client','http','request\x20sent','stringify','error','MailServerIn,\x20%s,\x20%s','message','info','GetMailServerIn','MailServerIn','findAll','raw','options','attributes','include','map','model','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4d9214,_0x582ec1){var _0x26fbc6=function(_0x560cbf){while(--_0x560cbf){_0x4d9214['push'](_0x4d9214['shift']());}};_0x26fbc6(++_0x582ec1);}(_0xb071,0xa3));var _0x1b07=function(_0x28a180,_0x5bb5b0){_0x28a180=_0x28a180-0x0;var _0x1161d3=_0xb071[_0x28a180];return _0x1161d3;};'use strict';var _=require('lodash');var util=require(_0x1b07('0x0'));var moment=require(_0x1b07('0x1'));var BPromise=require(_0x1b07('0x2'));var rs=require(_0x1b07('0x3'));var fs=require('fs');var Redis=require(_0x1b07('0x4'));var db=require(_0x1b07('0x5'))['db'];var utils=require(_0x1b07('0x6'));var logger=require(_0x1b07('0x7'))(_0x1b07('0x8'));var config=require(_0x1b07('0x9'));var jayson=require(_0x1b07('0xa'));var client=jayson[_0x1b07('0xb')][_0x1b07('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12852d,_0x4ea1cd,_0x22526c){return new BPromise(function(_0x33acd0,_0x58bf66){return client['request'](_0x12852d,_0x22526c)['then'](function(_0x26833a){logger['info']('MailServerIn,\x20%s,\x20%s',_0x4ea1cd,_0x1b07('0xd'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x4ea1cd,_0x1b07('0xd'),JSON[_0x1b07('0xe')](_0x26833a));if(_0x26833a[_0x1b07('0xf')]){if(_0x26833a[_0x1b07('0xf')]['code']===0x1f4){logger[_0x1b07('0xf')](_0x1b07('0x10'),_0x4ea1cd,_0x26833a[_0x1b07('0xf')][_0x1b07('0x11')]);return _0x58bf66(_0x26833a['error']['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x4ea1cd,_0x26833a[_0x1b07('0xf')][_0x1b07('0x11')]);return _0x33acd0(_0x26833a[_0x1b07('0xf')][_0x1b07('0x11')]);}else{logger[_0x1b07('0x12')](_0x1b07('0x10'),_0x4ea1cd,_0x1b07('0xd'));_0x33acd0(_0x26833a['result'][_0x1b07('0x11')]);}})['catch'](function(_0x4fd506){logger[_0x1b07('0xf')](_0x1b07('0x10'),_0x4ea1cd,_0x4fd506);_0x58bf66(_0x4fd506);});});}exports[_0x1b07('0x13')]=function(_0x17955c){var _0xbbf839=this;return new Promise(function(_0x208a85,_0x13f25d){return db[_0x1b07('0x14')][_0x1b07('0x15')]({'raw':_0x17955c['options']?_0x17955c['options'][_0x1b07('0x16')]===undefined?!![]:![]:!![],'where':_0x17955c[_0x1b07('0x17')]?_0x17955c['options']['where']||null:null,'attributes':_0x17955c[_0x1b07('0x17')]?_0x17955c['options'][_0x1b07('0x18')]||null:null,'limit':_0x17955c[_0x1b07('0x17')]?_0x17955c[_0x1b07('0x17')]['limit']||null:null,'include':_0x17955c[_0x1b07('0x17')]?_0x17955c[_0x1b07('0x17')][_0x1b07('0x19')]?_[_0x1b07('0x1a')](_0x17955c[_0x1b07('0x17')][_0x1b07('0x19')],function(_0x48892f){return{'model':db[_0x48892f['model']],'as':_0x48892f['as'],'attributes':_0x48892f['attributes'],'include':_0x48892f[_0x1b07('0x19')]?_[_0x1b07('0x1a')](_0x48892f[_0x1b07('0x19')],function(_0x394510){return{'model':db[_0x394510[_0x1b07('0x1b')]],'as':_0x394510['as'],'attributes':_0x394510[_0x1b07('0x18')],'include':_0x394510[_0x1b07('0x19')]?_[_0x1b07('0x1a')](_0x394510['include'],function(_0x21114a){return{'model':db[_0x21114a[_0x1b07('0x1b')]],'as':_0x21114a['as'],'attributes':_0x21114a[_0x1b07('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1b07('0x1c')](function(_0x3c2973){logger[_0x1b07('0x12')](_0x1b07('0x13'),_0x17955c);logger['debug'](_0x1b07('0x13'),_0x17955c,JSON[_0x1b07('0xe')](_0x3c2973));_0x208a85(_0x3c2973);})['catch'](function(_0x53596b){logger[_0x1b07('0xf')]('GetMailServerIn',_0x53596b[_0x1b07('0x11')],_0x17955c);_0x13f25d(_0xbbf839[_0x1b07('0xf')](0x1f4,_0x53596b[_0x1b07('0x11')]));});});}; \ No newline at end of file +var _0xc686=['request\x20sent','debug','error','message','MailServerIn,\x20%s,\x20%s','catch','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','GetMailServerIn','stringify','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xc0965d,_0x2c40dc){var _0x2b3ab0=function(_0x2d8caf){while(--_0x2d8caf){_0xc0965d['push'](_0xc0965d['shift']());}};_0x2b3ab0(++_0x2c40dc);}(_0xc686,0x148));var _0x6c68=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xc686[_0x13ea00];return _0x1f7347;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6c68('0x0'));var BPromise=require('bluebird');var rs=require(_0x6c68('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c68('0x2'))['db'];var utils=require(_0x6c68('0x3'));var logger=require(_0x6c68('0x4'))(_0x6c68('0x5'));var config=require(_0x6c68('0x6'));var jayson=require(_0x6c68('0x7'));var client=jayson[_0x6c68('0x8')][_0x6c68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3dc035,_0x1e88b0,_0x12e935){return new BPromise(function(_0x394644,_0x5634c4){return client[_0x6c68('0xa')](_0x3dc035,_0x12e935)[_0x6c68('0xb')](function(_0x4ff2ce){logger[_0x6c68('0xc')]('MailServerIn,\x20%s,\x20%s',_0x1e88b0,_0x6c68('0xd'));logger[_0x6c68('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x1e88b0,_0x6c68('0xd'),JSON['stringify'](_0x4ff2ce));if(_0x4ff2ce[_0x6c68('0xf')]){if(_0x4ff2ce[_0x6c68('0xf')]['code']===0x1f4){logger[_0x6c68('0xf')]('MailServerIn,\x20%s,\x20%s',_0x1e88b0,_0x4ff2ce['error'][_0x6c68('0x10')]);return _0x5634c4(_0x4ff2ce['error'][_0x6c68('0x10')]);}logger[_0x6c68('0xf')](_0x6c68('0x11'),_0x1e88b0,_0x4ff2ce['error'][_0x6c68('0x10')]);return _0x394644(_0x4ff2ce[_0x6c68('0xf')][_0x6c68('0x10')]);}else{logger[_0x6c68('0xc')](_0x6c68('0x11'),_0x1e88b0,'request\x20sent');_0x394644(_0x4ff2ce['result']['message']);}})[_0x6c68('0x12')](function(_0x32cfd2){logger[_0x6c68('0xf')](_0x6c68('0x11'),_0x1e88b0,_0x32cfd2);_0x5634c4(_0x32cfd2);});});}exports['GetMailServerIn']=function(_0x2cd5f6){var _0x16a4a0=this;return new Promise(function(_0x5045e3,_0x54a792){return db[_0x6c68('0x13')][_0x6c68('0x14')]({'raw':_0x2cd5f6[_0x6c68('0x15')]?_0x2cd5f6['options'][_0x6c68('0x16')]===undefined?!![]:![]:!![],'where':_0x2cd5f6[_0x6c68('0x15')]?_0x2cd5f6[_0x6c68('0x15')][_0x6c68('0x17')]||null:null,'attributes':_0x2cd5f6[_0x6c68('0x15')]?_0x2cd5f6[_0x6c68('0x15')][_0x6c68('0x18')]||null:null,'limit':_0x2cd5f6[_0x6c68('0x15')]?_0x2cd5f6[_0x6c68('0x15')][_0x6c68('0x19')]||null:null,'include':_0x2cd5f6['options']?_0x2cd5f6[_0x6c68('0x15')][_0x6c68('0x1a')]?_[_0x6c68('0x1b')](_0x2cd5f6[_0x6c68('0x15')][_0x6c68('0x1a')],function(_0x2a4aba){return{'model':db[_0x2a4aba[_0x6c68('0x1c')]],'as':_0x2a4aba['as'],'attributes':_0x2a4aba[_0x6c68('0x18')],'include':_0x2a4aba[_0x6c68('0x1a')]?_[_0x6c68('0x1b')](_0x2a4aba[_0x6c68('0x1a')],function(_0x2f4fd5){return{'model':db[_0x2f4fd5[_0x6c68('0x1c')]],'as':_0x2f4fd5['as'],'attributes':_0x2f4fd5[_0x6c68('0x18')],'include':_0x2f4fd5[_0x6c68('0x1a')]?_[_0x6c68('0x1b')](_0x2f4fd5[_0x6c68('0x1a')],function(_0x5c9c19){return{'model':db[_0x5c9c19[_0x6c68('0x1c')]],'as':_0x5c9c19['as'],'attributes':_0x5c9c19[_0x6c68('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6c68('0xb')](function(_0x3bf62a){logger[_0x6c68('0xc')](_0x6c68('0x1d'),_0x2cd5f6);logger[_0x6c68('0xe')](_0x6c68('0x1d'),_0x2cd5f6,JSON[_0x6c68('0x1e')](_0x3bf62a));_0x5045e3(_0x3bf62a);})['catch'](function(_0x1321d1){logger[_0x6c68('0xf')]('GetMailServerIn',_0x1321d1[_0x6c68('0x10')],_0x2cd5f6);_0x54a792(_0x16a4a0[_0x6c68('0xf')](0x1f4,_0x1321d1[_0x6c68('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index cd06fac..f3d53fa 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(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_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('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(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x7a54,0x106));var _0x47a5=function(_0x1dee30,_0x56101b){_0x1dee30=_0x1dee30-0x0;var _0x5e0032=_0x7a54[_0x1dee30];return _0x5e0032;};'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 4a08730..59d4a4f 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 _0xeffd=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x58f2e5,_0x3fb9e4){var _0x3a4dfc=function(_0x418fb0){while(--_0x418fb0){_0x58f2e5['push'](_0x58f2e5['shift']());}};_0x3a4dfc(++_0x3fb9e4);}(_0xeffd,0x6b));var _0xdeff=function(_0x5206f6,_0x32f325){_0x5206f6=_0x5206f6-0x0;var _0x34c182=_0xeffd[_0x5206f6];return _0x34c182;};'use strict';var Sequelize=require(_0xdeff('0x0'));module['exports']={'description':{'type':Sequelize[_0xdeff('0x1')]},'host':{'type':Sequelize[_0xdeff('0x1')]},'user':{'type':Sequelize[_0xdeff('0x1')]},'pass':{'type':Sequelize[_0xdeff('0x1')]},'port':{'type':Sequelize[_0xdeff('0x2')]},'secure':{'type':Sequelize[_0xdeff('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xdeff('0x1')]},'authentication':{'type':Sequelize[_0xdeff('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xdeff('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd4f4=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0xd7684c,_0x28e527){var _0x364b5f=function(_0x3d0c9){while(--_0x3d0c9){_0xd7684c['push'](_0xd7684c['shift']());}};_0x364b5f(++_0x28e527);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x4cd645,_0x3be1e7){_0x4cd645=_0x4cd645-0x0;var _0x36c5c2=_0xd4f4[_0x4cd645];return _0x36c5c2;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'description':{'type':Sequelize[_0x4d4f('0x2')]},'host':{'type':Sequelize[_0x4d4f('0x2')]},'user':{'type':Sequelize[_0x4d4f('0x2')]},'pass':{'type':Sequelize[_0x4d4f('0x2')]},'port':{'type':Sequelize[_0x4d4f('0x3')]},'secure':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x4d4f('0x2')]},'authentication':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 285f730..eb2bdcb 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 _0x5587=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','MailServerOut','then','include','catch','show','params','includeAll','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1a635e,_0x241651){var _0x5b3345=function(_0x5d94d8){while(--_0x5d94d8){_0x1a635e['push'](_0x1a635e['shift']());}};_0x5b3345(++_0x241651);}(_0x5587,0x1c2));var _0x7558=function(_0x266dbb,_0x534248){_0x266dbb=_0x266dbb-0x0;var _0x5104c9=_0x5587[_0x266dbb];return _0x5104c9;};'use strict';var emlformat=require(_0x7558('0x0'));var rimraf=require(_0x7558('0x1'));var zipdir=require(_0x7558('0x2'));var jsonpatch=require(_0x7558('0x3'));var rp=require('request-promise');var moment=require(_0x7558('0x4'));var BPromise=require(_0x7558('0x5'));var Mustache=require(_0x7558('0x6'));var util=require(_0x7558('0x7'));var path=require('path');var sox=require(_0x7558('0x8'));var csv=require(_0x7558('0x9'));var ejs=require(_0x7558('0xa'));var fs=require('fs');var fs_extra=require(_0x7558('0xb'));var _=require(_0x7558('0xc'));var squel=require(_0x7558('0xd'));var crypto=require(_0x7558('0xe'));var jsforce=require(_0x7558('0xf'));var deskjs=require(_0x7558('0x10'));var toCsv=require(_0x7558('0x9'));var querystring=require(_0x7558('0x11'));var Papa=require('papaparse');var Redis=require(_0x7558('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7558('0x13'));var as=require(_0x7558('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7558('0x15'))(_0x7558('0x16'));var utils=require(_0x7558('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7558('0x18'));var db=require(_0x7558('0x19'))['db'];function respondWithStatusCode(_0x41f105,_0x2903ae){_0x2903ae=_0x2903ae||0xcc;return function(_0x119e58){if(_0x119e58){return _0x41f105[_0x7558('0x1a')](_0x2903ae);}return _0x41f105[_0x7558('0x1b')](_0x2903ae)['end']();};}function respondWithResult(_0x1d7f6c,_0x55ddba){_0x55ddba=_0x55ddba||0xc8;return function(_0x5d9031){if(_0x5d9031){return _0x1d7f6c[_0x7558('0x1b')](_0x55ddba)[_0x7558('0x1c')](_0x5d9031);}};}function respondWithFilteredResult(_0x118b69,_0x26ace6){return function(_0x5cf233){if(_0x5cf233){var _0xacde0f=typeof _0x26ace6[_0x7558('0x1d')]==='undefined'&&typeof _0x26ace6[_0x7558('0x1e')]===_0x7558('0x1f');var _0x28324f=_0x5cf233[_0x7558('0x20')];var _0x584945=_0xacde0f?0x0:_0x26ace6[_0x7558('0x1d')];var _0x554fab=_0xacde0f?_0x5cf233[_0x7558('0x20')]:_0x26ace6[_0x7558('0x1d')]+_0x26ace6[_0x7558('0x1e')];var _0x113f23;if(_0x554fab>=_0x28324f){_0x554fab=_0x28324f;_0x113f23=0xc8;}else{_0x113f23=0xce;}_0x118b69[_0x7558('0x1b')](_0x113f23);return _0x118b69[_0x7558('0x21')](_0x7558('0x22'),_0x584945+'-'+_0x554fab+'/'+_0x28324f)['json'](_0x5cf233);}return null;};}function patchUpdates(_0x31675f){return function(_0x5b5a65){try{jsonpatch[_0x7558('0x23')](_0x5b5a65,_0x31675f,!![]);}catch(_0x254a86){return BPromise[_0x7558('0x24')](_0x254a86);}return _0x5b5a65[_0x7558('0x25')]();};}function saveUpdates(_0x657811,_0x4806f2){return function(_0x511c53){if(_0x511c53){return _0x511c53[_0x7558('0x26')](_0x657811)['then'](function(_0x502b35){return _0x502b35;});}return null;};}function removeEntity(_0x5e4651,_0x2d6d06){return function(_0x517d09){if(_0x517d09){return _0x517d09['destroy']()['then'](function(){_0x5e4651[_0x7558('0x1b')](0xcc)[_0x7558('0x27')]();});}};}function handleEntityNotFound(_0x338e14,_0xb931b5){return function(_0x5c381a){if(!_0x5c381a){_0x338e14[_0x7558('0x1a')](0x194);}return _0x5c381a;};}function handleError(_0x23dd04,_0xc8e27c){_0xc8e27c=_0xc8e27c||0x1f4;return function(_0x3346ae){logger[_0x7558('0x28')](_0x3346ae[_0x7558('0x29')]);if(_0x3346ae['name']){delete _0x3346ae[_0x7558('0x2a')];}_0x23dd04[_0x7558('0x1b')](_0xc8e27c)[_0x7558('0x2b')](_0x3346ae);};}exports[_0x7558('0x2c')]=function(_0x2bbe28,_0x4e93b6){var _0x5f10e4={},_0x546281={},_0x508543={'count':0x0,'rows':[]};var _0x3b0842=_[_0x7558('0x2d')](db['MailServerOut'][_0x7558('0x2e')],function(_0x500eda){return{'name':_0x500eda[_0x7558('0x2f')],'type':_0x500eda[_0x7558('0x30')][_0x7558('0x31')]};});_0x546281[_0x7558('0x32')]=_[_0x7558('0x2d')](_0x3b0842,_0x7558('0x2a'));_0x546281[_0x7558('0x33')]=_[_0x7558('0x34')](_0x2bbe28[_0x7558('0x33')]);_0x546281[_0x7558('0x35')]=_[_0x7558('0x36')](_0x546281[_0x7558('0x32')],_0x546281['query']);_0x5f10e4[_0x7558('0x37')]=_[_0x7558('0x36')](_0x546281['model'],qs['fields'](_0x2bbe28[_0x7558('0x33')][_0x7558('0x38')]));_0x5f10e4['attributes']=_0x5f10e4[_0x7558('0x37')]['length']?_0x5f10e4[_0x7558('0x37')]:_0x546281[_0x7558('0x32')];if(!_0x2bbe28[_0x7558('0x33')][_0x7558('0x39')](_0x7558('0x3a'))){_0x5f10e4['limit']=qs[_0x7558('0x1e')](_0x2bbe28[_0x7558('0x33')][_0x7558('0x1e')]);_0x5f10e4[_0x7558('0x1d')]=qs['offset'](_0x2bbe28[_0x7558('0x33')][_0x7558('0x1d')]);}_0x5f10e4[_0x7558('0x3b')]=qs[_0x7558('0x3c')](_0x2bbe28['query'][_0x7558('0x3c')]);_0x5f10e4[_0x7558('0x3d')]=qs[_0x7558('0x35')](_[_0x7558('0x3e')](_0x2bbe28[_0x7558('0x33')],_0x546281[_0x7558('0x35')]),_0x3b0842);if(_0x2bbe28['query'][_0x7558('0x3f')]){_0x5f10e4[_0x7558('0x3d')]=_[_0x7558('0x40')](_0x5f10e4[_0x7558('0x3d')],{'$or':_[_0x7558('0x2d')](_0x3b0842,function(_0x399b45){if(_0x399b45[_0x7558('0x30')]!==_0x7558('0x41')){var _0x12e09f={};_0x12e09f[_0x399b45[_0x7558('0x2a')]]={'$like':'%'+_0x2bbe28[_0x7558('0x33')]['filter']+'%'};return _0x12e09f;}})});}_0x5f10e4=_[_0x7558('0x40')]({},_0x5f10e4,_0x2bbe28['options']);var _0x3ddd09={'where':_0x5f10e4[_0x7558('0x3d')]};return db[_0x7558('0x42')]['count'](_0x3ddd09)[_0x7558('0x43')](function(_0x22df30){_0x508543[_0x7558('0x20')]=_0x22df30;if(_0x2bbe28[_0x7558('0x33')]['includeAll']){_0x5f10e4[_0x7558('0x44')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x5f10e4);})[_0x7558('0x43')](function(_0x299e85){_0x508543['rows']=_0x299e85;return _0x508543;})[_0x7558('0x43')](respondWithFilteredResult(_0x4e93b6,_0x5f10e4))[_0x7558('0x45')](handleError(_0x4e93b6,null));};exports[_0x7558('0x46')]=function(_0x279a5a,_0x1092a5){var _0x29d604={'raw':!![],'where':{'id':_0x279a5a[_0x7558('0x47')]['id']}},_0x2d9fd7={};_0x2d9fd7[_0x7558('0x32')]=_[_0x7558('0x34')](db[_0x7558('0x42')][_0x7558('0x2e')]);_0x2d9fd7[_0x7558('0x33')]=_[_0x7558('0x34')](_0x279a5a[_0x7558('0x33')]);_0x2d9fd7['filters']=_[_0x7558('0x36')](_0x2d9fd7[_0x7558('0x32')],_0x2d9fd7[_0x7558('0x33')]);_0x29d604[_0x7558('0x37')]=_[_0x7558('0x36')](_0x2d9fd7[_0x7558('0x32')],qs[_0x7558('0x38')](_0x279a5a[_0x7558('0x33')][_0x7558('0x38')]));_0x29d604['attributes']=_0x29d604[_0x7558('0x37')]['length']?_0x29d604[_0x7558('0x37')]:_0x2d9fd7[_0x7558('0x32')];if(_0x279a5a[_0x7558('0x33')][_0x7558('0x48')]){_0x29d604[_0x7558('0x44')]=[{'all':!![]}];}_0x29d604=_[_0x7558('0x40')]({},_0x29d604,_0x279a5a[_0x7558('0x49')]);return db[_0x7558('0x42')][_0x7558('0x4a')](_0x29d604)[_0x7558('0x43')](handleEntityNotFound(_0x1092a5,null))[_0x7558('0x43')](respondWithResult(_0x1092a5,null))['catch'](handleError(_0x1092a5,null));};exports[_0x7558('0x4b')]=function(_0x3e491e,_0x53ccdd){return db[_0x7558('0x42')][_0x7558('0x4b')](_0x3e491e[_0x7558('0x4c')],{})[_0x7558('0x43')](respondWithResult(_0x53ccdd,0xc9))[_0x7558('0x45')](handleError(_0x53ccdd,null));};exports[_0x7558('0x26')]=function(_0x2283a3,_0x8bee25){if(_0x2283a3[_0x7558('0x4c')]['id']){delete _0x2283a3[_0x7558('0x4c')]['id'];}return db[_0x7558('0x42')]['find']({'where':{'id':_0x2283a3[_0x7558('0x47')]['id']}})[_0x7558('0x43')](handleEntityNotFound(_0x8bee25,null))[_0x7558('0x43')](saveUpdates(_0x2283a3[_0x7558('0x4c')],null))['then'](respondWithResult(_0x8bee25,null))['catch'](handleError(_0x8bee25,null));};exports[_0x7558('0x4d')]=function(_0x34db1d,_0x166ae0){return db[_0x7558('0x42')][_0x7558('0x4a')]({'where':{'id':_0x34db1d['params']['id']}})[_0x7558('0x43')](handleEntityNotFound(_0x166ae0,null))[_0x7558('0x43')](removeEntity(_0x166ae0,null))[_0x7558('0x45')](handleError(_0x166ae0,null));}; \ No newline at end of file +var _0x6ea6=['Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','MailServerOut','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','count','set'];(function(_0x485eb2,_0x309eae){var _0x4ee062=function(_0xc9dfa7){while(--_0xc9dfa7){_0x485eb2['push'](_0x485eb2['shift']());}};_0x4ee062(++_0x309eae);}(_0x6ea6,0xca));var _0x66ea=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0x6ea6[_0x231a47];return _0x48d7c9;};'use strict';var emlformat=require(_0x66ea('0x0'));var rimraf=require(_0x66ea('0x1'));var zipdir=require(_0x66ea('0x2'));var jsonpatch=require(_0x66ea('0x3'));var rp=require(_0x66ea('0x4'));var moment=require(_0x66ea('0x5'));var BPromise=require(_0x66ea('0x6'));var Mustache=require(_0x66ea('0x7'));var util=require(_0x66ea('0x8'));var path=require(_0x66ea('0x9'));var sox=require(_0x66ea('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x66ea('0xb'));var _=require(_0x66ea('0xc'));var squel=require(_0x66ea('0xd'));var crypto=require(_0x66ea('0xe'));var jsforce=require(_0x66ea('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x66ea('0x10'));var Papa=require(_0x66ea('0x11'));var Redis=require(_0x66ea('0x12'));var authService=require(_0x66ea('0x13'));var qs=require(_0x66ea('0x14'));var as=require(_0x66ea('0x15'));var hardwareService=require(_0x66ea('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x66ea('0x17'));var config=require(_0x66ea('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x66ea('0x19'))['db'];function respondWithStatusCode(_0x3c2653,_0x46a14a){_0x46a14a=_0x46a14a||0xcc;return function(_0x25d3c0){if(_0x25d3c0){return _0x3c2653['sendStatus'](_0x46a14a);}return _0x3c2653[_0x66ea('0x1a')](_0x46a14a)['end']();};}function respondWithResult(_0x28a091,_0x53acf0){_0x53acf0=_0x53acf0||0xc8;return function(_0x45548d){if(_0x45548d){return _0x28a091[_0x66ea('0x1a')](_0x53acf0)[_0x66ea('0x1b')](_0x45548d);}};}function respondWithFilteredResult(_0x261605,_0x5ed60f){return function(_0x243540){if(_0x243540){var _0x3d3b59=typeof _0x5ed60f[_0x66ea('0x1c')]==='undefined'&&typeof _0x5ed60f[_0x66ea('0x1d')]==='undefined';var _0x2ffbab=_0x243540['count'];var _0x27b879=_0x3d3b59?0x0:_0x5ed60f[_0x66ea('0x1c')];var _0x12aa2c=_0x3d3b59?_0x243540[_0x66ea('0x1e')]:_0x5ed60f['offset']+_0x5ed60f[_0x66ea('0x1d')];var _0x3056f7;if(_0x12aa2c>=_0x2ffbab){_0x12aa2c=_0x2ffbab;_0x3056f7=0xc8;}else{_0x3056f7=0xce;}_0x261605[_0x66ea('0x1a')](_0x3056f7);return _0x261605[_0x66ea('0x1f')](_0x66ea('0x20'),_0x27b879+'-'+_0x12aa2c+'/'+_0x2ffbab)['json'](_0x243540);}return null;};}function patchUpdates(_0x401c73){return function(_0x272e82){try{jsonpatch['apply'](_0x272e82,_0x401c73,!![]);}catch(_0x5128ed){return BPromise[_0x66ea('0x21')](_0x5128ed);}return _0x272e82[_0x66ea('0x22')]();};}function saveUpdates(_0x1cb40b,_0x2c8e3f){return function(_0x56a34c){if(_0x56a34c){return _0x56a34c[_0x66ea('0x23')](_0x1cb40b)[_0x66ea('0x24')](function(_0x5e8c3b){return _0x5e8c3b;});}return null;};}function removeEntity(_0x5f1b0c,_0x1cdcfd){return function(_0x283a74){if(_0x283a74){return _0x283a74[_0x66ea('0x25')]()[_0x66ea('0x24')](function(){_0x5f1b0c['status'](0xcc)[_0x66ea('0x26')]();});}};}function handleEntityNotFound(_0x2cfabe,_0x20858b){return function(_0x265ac7){if(!_0x265ac7){_0x2cfabe[_0x66ea('0x27')](0x194);}return _0x265ac7;};}function handleError(_0x428a67,_0x31dd1d){_0x31dd1d=_0x31dd1d||0x1f4;return function(_0x1eb911){logger[_0x66ea('0x28')](_0x1eb911[_0x66ea('0x29')]);if(_0x1eb911['name']){delete _0x1eb911[_0x66ea('0x2a')];}_0x428a67[_0x66ea('0x1a')](_0x31dd1d)['send'](_0x1eb911);};}exports[_0x66ea('0x2b')]=function(_0x11f7a3,_0x151872){var _0x1e3866={},_0x4598f8={},_0x59d84a={'count':0x0,'rows':[]};var _0x1a9d43=_[_0x66ea('0x2c')](db[_0x66ea('0x2d')]['rawAttributes'],function(_0x3f0412){return{'name':_0x3f0412[_0x66ea('0x2e')],'type':_0x3f0412[_0x66ea('0x2f')][_0x66ea('0x30')]};});_0x4598f8[_0x66ea('0x31')]=_[_0x66ea('0x2c')](_0x1a9d43,'name');_0x4598f8[_0x66ea('0x32')]=_[_0x66ea('0x33')](_0x11f7a3[_0x66ea('0x32')]);_0x4598f8['filters']=_[_0x66ea('0x34')](_0x4598f8[_0x66ea('0x31')],_0x4598f8['query']);_0x1e3866[_0x66ea('0x35')]=_[_0x66ea('0x34')](_0x4598f8['model'],qs[_0x66ea('0x36')](_0x11f7a3[_0x66ea('0x32')][_0x66ea('0x36')]));_0x1e3866['attributes']=_0x1e3866[_0x66ea('0x35')][_0x66ea('0x37')]?_0x1e3866[_0x66ea('0x35')]:_0x4598f8[_0x66ea('0x31')];if(!_0x11f7a3['query'][_0x66ea('0x38')](_0x66ea('0x39'))){_0x1e3866[_0x66ea('0x1d')]=qs['limit'](_0x11f7a3[_0x66ea('0x32')][_0x66ea('0x1d')]);_0x1e3866[_0x66ea('0x1c')]=qs[_0x66ea('0x1c')](_0x11f7a3[_0x66ea('0x32')][_0x66ea('0x1c')]);}_0x1e3866[_0x66ea('0x3a')]=qs[_0x66ea('0x3b')](_0x11f7a3['query'][_0x66ea('0x3b')]);_0x1e3866[_0x66ea('0x3c')]=qs['filters'](_[_0x66ea('0x3d')](_0x11f7a3[_0x66ea('0x32')],_0x4598f8[_0x66ea('0x3e')]),_0x1a9d43);if(_0x11f7a3[_0x66ea('0x32')][_0x66ea('0x3f')]){_0x1e3866[_0x66ea('0x3c')]=_['merge'](_0x1e3866[_0x66ea('0x3c')],{'$or':_['map'](_0x1a9d43,function(_0x57102d){if(_0x57102d[_0x66ea('0x2f')]!==_0x66ea('0x40')){var _0x4575fe={};_0x4575fe[_0x57102d[_0x66ea('0x2a')]]={'$like':'%'+_0x11f7a3[_0x66ea('0x32')][_0x66ea('0x3f')]+'%'};return _0x4575fe;}})});}_0x1e3866=_[_0x66ea('0x41')]({},_0x1e3866,_0x11f7a3[_0x66ea('0x42')]);var _0x42b433={'where':_0x1e3866[_0x66ea('0x3c')]};return db[_0x66ea('0x2d')][_0x66ea('0x1e')](_0x42b433)[_0x66ea('0x24')](function(_0x303572){_0x59d84a['count']=_0x303572;if(_0x11f7a3[_0x66ea('0x32')]['includeAll']){_0x1e3866['include']=[{'all':!![]}];}return db[_0x66ea('0x2d')][_0x66ea('0x43')](_0x1e3866);})['then'](function(_0x51e26d){_0x59d84a[_0x66ea('0x44')]=_0x51e26d;return _0x59d84a;})[_0x66ea('0x24')](respondWithFilteredResult(_0x151872,_0x1e3866))[_0x66ea('0x45')](handleError(_0x151872,null));};exports[_0x66ea('0x46')]=function(_0x2383bf,_0x5b505b){var _0x1e0317={'raw':!![],'where':{'id':_0x2383bf[_0x66ea('0x47')]['id']}},_0x393deb={};_0x393deb['model']=_[_0x66ea('0x33')](db[_0x66ea('0x2d')][_0x66ea('0x48')]);_0x393deb['query']=_[_0x66ea('0x33')](_0x2383bf[_0x66ea('0x32')]);_0x393deb[_0x66ea('0x3e')]=_[_0x66ea('0x34')](_0x393deb[_0x66ea('0x31')],_0x393deb[_0x66ea('0x32')]);_0x1e0317[_0x66ea('0x35')]=_[_0x66ea('0x34')](_0x393deb[_0x66ea('0x31')],qs[_0x66ea('0x36')](_0x2383bf['query']['fields']));_0x1e0317[_0x66ea('0x35')]=_0x1e0317[_0x66ea('0x35')][_0x66ea('0x37')]?_0x1e0317['attributes']:_0x393deb[_0x66ea('0x31')];if(_0x2383bf['query'][_0x66ea('0x49')]){_0x1e0317[_0x66ea('0x4a')]=[{'all':!![]}];}_0x1e0317=_[_0x66ea('0x41')]({},_0x1e0317,_0x2383bf[_0x66ea('0x42')]);return db[_0x66ea('0x2d')][_0x66ea('0x4b')](_0x1e0317)[_0x66ea('0x24')](handleEntityNotFound(_0x5b505b,null))['then'](respondWithResult(_0x5b505b,null))[_0x66ea('0x45')](handleError(_0x5b505b,null));};exports[_0x66ea('0x4c')]=function(_0xd53859,_0x5e500f){return db[_0x66ea('0x2d')][_0x66ea('0x4c')](_0xd53859[_0x66ea('0x4d')],{})['then'](respondWithResult(_0x5e500f,0xc9))[_0x66ea('0x45')](handleError(_0x5e500f,null));};exports[_0x66ea('0x23')]=function(_0x17d834,_0x6edfcb){if(_0x17d834[_0x66ea('0x4d')]['id']){delete _0x17d834[_0x66ea('0x4d')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x17d834[_0x66ea('0x47')]['id']}})['then'](handleEntityNotFound(_0x6edfcb,null))[_0x66ea('0x24')](saveUpdates(_0x17d834[_0x66ea('0x4d')],null))[_0x66ea('0x24')](respondWithResult(_0x6edfcb,null))[_0x66ea('0x45')](handleError(_0x6edfcb,null));};exports['destroy']=function(_0x240b97,_0x14efd1){return db[_0x66ea('0x2d')][_0x66ea('0x4b')]({'where':{'id':_0x240b97[_0x66ea('0x47')]['id']}})[_0x66ea('0x24')](handleEntityNotFound(_0x14efd1,null))[_0x66ea('0x24')](removeEntity(_0x14efd1,null))['catch'](handleError(_0x14efd1,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4bbe7d1..cd5a3ec 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 _0x1b03=['define','MailServerOut','mail_servers_out','lodash','util','api','moment','bluebird','request-promise','./mailServerOut.attributes'];(function(_0x49fe3e,_0x4cba22){var _0x52adae=function(_0x4ee32c){while(--_0x4ee32c){_0x49fe3e['push'](_0x49fe3e['shift']());}};_0x52adae(++_0x4cba22);}(_0x1b03,0x175));var _0x31b0=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x1b03[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x31b0('0x0'));var util=require(_0x31b0('0x1'));var logger=require('../../config/logger')(_0x31b0('0x2'));var moment=require(_0x31b0('0x3'));var BPromise=require(_0x31b0('0x4'));var rp=require(_0x31b0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x31b0('0x6'));module['exports']=function(_0x185358,_0x4e5c95){return _0x185358[_0x31b0('0x7')](_0x31b0('0x8'),attributes,{'tableName':_0x31b0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb23=['define','MailServerOut','mail_servers_out','util','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerOut.attributes'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xcb23,0x19a));var _0x3cb2=function(_0x462dbc,_0x35ec2e){_0x462dbc=_0x462dbc-0x0;var _0x1eaebc=_0xcb23[_0x462dbc];return _0x1eaebc;};'use strict';var _=require('lodash');var util=require(_0x3cb2('0x0'));var logger=require('../../config/logger')(_0x3cb2('0x1'));var moment=require(_0x3cb2('0x2'));var BPromise=require(_0x3cb2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cb2('0x4'));var rimraf=require(_0x3cb2('0x5'));var config=require(_0x3cb2('0x6'));var attributes=require(_0x3cb2('0x7'));module['exports']=function(_0x2d21cf,_0x42b39d){return _0x2d21cf[_0x3cb2('0x8')](_0x3cb2('0x9'),attributes,{'tableName':_0x3cb2('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 131b145..20b914c 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x40e5e7,_0x5de9fb){var _0x305d7b=function(_0x1f10cd){while(--_0x1f10cd){_0x40e5e7['push'](_0x40e5e7['shift']());}};_0x305d7b(++_0x5de9fb);}(_0xadb5,0xad));var _0x5adb=function(_0x1f7cfd,_0x17144a){_0x1f7cfd=_0x1f7cfd-0x0;var _0xf5b233=_0xadb5[_0x1f7cfd];return _0xf5b233;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x5e2c5d,_0x34e759){_0x5e2c5d=_0x5e2c5d-0x0;var _0x4af431=_0x7a54[_0x5e2c5d];return _0x4af431;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 2a8816d..da9858f 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 _0x605e=['util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','post','update','delete','destroy','exports','multer'];(function(_0x4b76c4,_0x32c6fd){var _0x5b98c9=function(_0x1d9521){while(--_0x1d9521){_0x4b76c4['push'](_0x4b76c4['shift']());}};_0x5b98c9(++_0x32c6fd);}(_0x605e,0x1c1));var _0xe605=function(_0x168362,_0x3addc4){_0x168362=_0x168362-0x0;var _0x582c86=_0x605e[_0x168362];return _0x582c86;};'use strict';var multer=require(_0xe605('0x0'));var util=require(_0xe605('0x1'));var path=require('path');var timeout=require(_0xe605('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe605('0x3'));var auth=require(_0xe605('0x4'));var interaction=require(_0xe605('0x5'));var config=require(_0xe605('0x6'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0xe605('0x7')](),controller[_0xe605('0x8')]);router[_0xe605('0x9')](_0xe605('0xa'),auth[_0xe605('0x7')](),controller[_0xe605('0xb')]);router[_0xe605('0x9')](_0xe605('0xc'),auth[_0xe605('0x7')](),controller['show']);router[_0xe605('0xd')]('/',auth[_0xe605('0x7')](),controller['create']);router['put'](_0xe605('0xc'),auth[_0xe605('0x7')](),controller[_0xe605('0xe')]);router[_0xe605('0xf')](_0xe605('0xc'),auth[_0xe605('0x7')](),controller[_0xe605('0x10')]);module[_0xe605('0x11')]=router; \ No newline at end of file +var _0x6778=['show','post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x6778,0x94));var _0x8677=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x6778[_0x3f5dca];return _0x5b833a;};'use strict';var multer=require(_0x8677('0x0'));var util=require('util');var path=require(_0x8677('0x1'));var timeout=require(_0x8677('0x2'));var express=require(_0x8677('0x3'));var router=express[_0x8677('0x4')]();var fs_extra=require(_0x8677('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8677('0x6'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x8677('0x7')]('/',auth[_0x8677('0x8')](),controller[_0x8677('0x9')]);router[_0x8677('0x7')](_0x8677('0xa'),auth[_0x8677('0x8')](),controller[_0x8677('0xb')]);router[_0x8677('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x8677('0xc')]);router[_0x8677('0xd')]('/',auth[_0x8677('0x8')](),controller[_0x8677('0xe')]);router['put'](_0x8677('0xf'),auth[_0x8677('0x8')](),controller[_0x8677('0x10')]);router[_0x8677('0x11')](_0x8677('0xf'),auth[_0x8677('0x8')](),controller[_0x8677('0x12')]);module[_0x8677('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 4a35887..41ab72e 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 _0x9206=['STRING','name','sequelize','exports'];(function(_0x54b719,_0x39ade5){var _0x31edd9=function(_0x3f2514){while(--_0x3f2514){_0x54b719['push'](_0x54b719['shift']());}};_0x31edd9(++_0x39ade5);}(_0x9206,0x176));var _0x6920=function(_0x58316a,_0x16111e){_0x58316a=_0x58316a-0x0;var _0x13501c=_0x9206[_0x58316a];return _0x13501c;};'use strict';var Sequelize=require(_0x6920('0x0'));module[_0x6920('0x1')]={'name':{'type':Sequelize[_0x6920('0x2')],'unique':_0x6920('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6920('0x2')]}}; \ No newline at end of file +var _0x01d9=['sequelize','exports','STRING','name'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x901d('0x0'));module[_0x901d('0x1')]={'name':{'type':Sequelize[_0x901d('0x2')],'unique':_0x901d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 8fe5a1c..dd1e541 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 _0xf2db=['include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','key','query','keys','filters','model','intersection','fields','attributes','length','order','sort','where','filter','merge','options','includeAll'];(function(_0x516f13,_0x2190ff){var _0x391085=function(_0x4bbda5){while(--_0x4bbda5){_0x516f13['push'](_0x516f13['shift']());}};_0x391085(++_0x2190ff);}(_0xf2db,0x13e));var _0xbf2d=function(_0x2ba1b5,_0x4d5feb){_0x2ba1b5=_0x2ba1b5-0x0;var _0x28629e=_0xf2db[_0x2ba1b5];return _0x28629e;};'use strict';var emlformat=require(_0xbf2d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf2d('0x1'));var jsonpatch=require(_0xbf2d('0x2'));var rp=require('request-promise');var moment=require(_0xbf2d('0x3'));var BPromise=require(_0xbf2d('0x4'));var Mustache=require(_0xbf2d('0x5'));var util=require(_0xbf2d('0x6'));var path=require(_0xbf2d('0x7'));var sox=require('sox');var csv=require(_0xbf2d('0x8'));var ejs=require(_0xbf2d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf2d('0xa'));var squel=require(_0xbf2d('0xb'));var crypto=require(_0xbf2d('0xc'));var jsforce=require(_0xbf2d('0xd'));var deskjs=require(_0xbf2d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbf2d('0xf'));var Papa=require(_0xbf2d('0x10'));var Redis=require('ioredis');var authService=require(_0xbf2d('0x11'));var qs=require(_0xbf2d('0x12'));var as=require(_0xbf2d('0x13'));var hardwareService=require(_0xbf2d('0x14'));var logger=require(_0xbf2d('0x15'))(_0xbf2d('0x16'));var utils=require(_0xbf2d('0x17'));var config=require(_0xbf2d('0x18'));var licenseUtil=require(_0xbf2d('0x19'));var db=require(_0xbf2d('0x1a'))['db'];function respondWithStatusCode(_0x2d0a81,_0x62196){_0x62196=_0x62196||0xcc;return function(_0x4ff471){if(_0x4ff471){return _0x2d0a81[_0xbf2d('0x1b')](_0x62196);}return _0x2d0a81['status'](_0x62196)['end']();};}function respondWithResult(_0x5422ed,_0x44e4cd){_0x44e4cd=_0x44e4cd||0xc8;return function(_0x548c67){if(_0x548c67){return _0x5422ed[_0xbf2d('0x1c')](_0x44e4cd)[_0xbf2d('0x1d')](_0x548c67);}};}function respondWithFilteredResult(_0x52a0e0,_0x31aff2){return function(_0x2b9fbd){if(_0x2b9fbd){var _0xa0fb27=typeof _0x31aff2[_0xbf2d('0x1e')]===_0xbf2d('0x1f')&&typeof _0x31aff2[_0xbf2d('0x20')]==='undefined';var _0x1dd6dc=_0x2b9fbd[_0xbf2d('0x21')];var _0x5413b0=_0xa0fb27?0x0:_0x31aff2['offset'];var _0x301d15=_0xa0fb27?_0x2b9fbd['count']:_0x31aff2[_0xbf2d('0x1e')]+_0x31aff2['limit'];var _0x97c1e4;if(_0x301d15>=_0x1dd6dc){_0x301d15=_0x1dd6dc;_0x97c1e4=0xc8;}else{_0x97c1e4=0xce;}_0x52a0e0['status'](_0x97c1e4);return _0x52a0e0[_0xbf2d('0x22')](_0xbf2d('0x23'),_0x5413b0+'-'+_0x301d15+'/'+_0x1dd6dc)[_0xbf2d('0x1d')](_0x2b9fbd);}return null;};}function patchUpdates(_0x44ae70){return function(_0x45a596){try{jsonpatch[_0xbf2d('0x24')](_0x45a596,_0x44ae70,!![]);}catch(_0x583231){return BPromise[_0xbf2d('0x25')](_0x583231);}return _0x45a596[_0xbf2d('0x26')]();};}function saveUpdates(_0x61055f,_0x1c8535){return function(_0x46dc70){if(_0x46dc70){return _0x46dc70[_0xbf2d('0x27')](_0x61055f)[_0xbf2d('0x28')](function(_0x415168){return _0x415168;});}return null;};}function removeEntity(_0x495628,_0x5a54f2){return function(_0xeae73d){if(_0xeae73d){return _0xeae73d[_0xbf2d('0x29')]()[_0xbf2d('0x28')](function(){_0x495628['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x297c29,_0xe49870){return function(_0x1c3d2e){if(!_0x1c3d2e){_0x297c29[_0xbf2d('0x1b')](0x194);}return _0x1c3d2e;};}function handleError(_0x4fd565,_0x10cb5d){_0x10cb5d=_0x10cb5d||0x1f4;return function(_0x440016){logger[_0xbf2d('0x2a')](_0x440016[_0xbf2d('0x2b')]);if(_0x440016[_0xbf2d('0x2c')]){delete _0x440016[_0xbf2d('0x2c')];}_0x4fd565[_0xbf2d('0x1c')](_0x10cb5d)[_0xbf2d('0x2d')](_0x440016);};}exports[_0xbf2d('0x2e')]=function(_0x46bea5,_0x1ed053){var _0xab094f={},_0x433057={},_0x3f7563={'count':0x0,'rows':[]};var _0xb297c1=_[_0xbf2d('0x2f')](db[_0xbf2d('0x30')][_0xbf2d('0x31')],function(_0x144e7b){return{'name':_0x144e7b['fieldName'],'type':_0x144e7b[_0xbf2d('0x32')][_0xbf2d('0x33')]};});_0x433057['model']=_[_0xbf2d('0x2f')](_0xb297c1,_0xbf2d('0x2c'));_0x433057[_0xbf2d('0x34')]=_[_0xbf2d('0x35')](_0x46bea5['query']);_0x433057[_0xbf2d('0x36')]=_['intersection'](_0x433057[_0xbf2d('0x37')],_0x433057[_0xbf2d('0x34')]);_0xab094f['attributes']=_[_0xbf2d('0x38')](_0x433057[_0xbf2d('0x37')],qs[_0xbf2d('0x39')](_0x46bea5[_0xbf2d('0x34')][_0xbf2d('0x39')]));_0xab094f[_0xbf2d('0x3a')]=_0xab094f[_0xbf2d('0x3a')][_0xbf2d('0x3b')]?_0xab094f[_0xbf2d('0x3a')]:_0x433057[_0xbf2d('0x37')];if(!_0x46bea5[_0xbf2d('0x34')]['hasOwnProperty']('nolimit')){_0xab094f[_0xbf2d('0x20')]=qs[_0xbf2d('0x20')](_0x46bea5[_0xbf2d('0x34')][_0xbf2d('0x20')]);_0xab094f[_0xbf2d('0x1e')]=qs[_0xbf2d('0x1e')](_0x46bea5[_0xbf2d('0x34')][_0xbf2d('0x1e')]);}_0xab094f[_0xbf2d('0x3c')]=qs['sort'](_0x46bea5['query'][_0xbf2d('0x3d')]);_0xab094f[_0xbf2d('0x3e')]=qs[_0xbf2d('0x36')](_['pick'](_0x46bea5[_0xbf2d('0x34')],_0x433057[_0xbf2d('0x36')]),_0xb297c1);if(_0x46bea5[_0xbf2d('0x34')][_0xbf2d('0x3f')]){_0xab094f[_0xbf2d('0x3e')]=_[_0xbf2d('0x40')](_0xab094f[_0xbf2d('0x3e')],{'$or':_['map'](_0xb297c1,function(_0x21caa0){if(_0x21caa0[_0xbf2d('0x32')]!=='VIRTUAL'){var _0x5443c5={};_0x5443c5[_0x21caa0[_0xbf2d('0x2c')]]={'$like':'%'+_0x46bea5[_0xbf2d('0x34')][_0xbf2d('0x3f')]+'%'};return _0x5443c5;}})});}_0xab094f=_[_0xbf2d('0x40')]({},_0xab094f,_0x46bea5[_0xbf2d('0x41')]);var _0x8789d8={'where':_0xab094f[_0xbf2d('0x3e')]};return db[_0xbf2d('0x30')][_0xbf2d('0x21')](_0x8789d8)[_0xbf2d('0x28')](function(_0x57be44){_0x3f7563[_0xbf2d('0x21')]=_0x57be44;if(_0x46bea5['query'][_0xbf2d('0x42')]){_0xab094f[_0xbf2d('0x43')]=[{'all':!![]}];}return db[_0xbf2d('0x30')][_0xbf2d('0x44')](_0xab094f);})[_0xbf2d('0x28')](function(_0xfeb9cf){_0x3f7563[_0xbf2d('0x45')]=_0xfeb9cf;return _0x3f7563;})[_0xbf2d('0x28')](respondWithFilteredResult(_0x1ed053,_0xab094f))[_0xbf2d('0x46')](handleError(_0x1ed053,null));};exports[_0xbf2d('0x47')]=function(_0x161319,_0x18795e){var _0x3f35b5={'raw':!![],'where':{'id':_0x161319[_0xbf2d('0x48')]['id']}},_0x179158={};_0x179158[_0xbf2d('0x37')]=_[_0xbf2d('0x35')](db[_0xbf2d('0x30')]['rawAttributes']);_0x179158[_0xbf2d('0x34')]=_[_0xbf2d('0x35')](_0x161319[_0xbf2d('0x34')]);_0x179158['filters']=_[_0xbf2d('0x38')](_0x179158[_0xbf2d('0x37')],_0x179158[_0xbf2d('0x34')]);_0x3f35b5['attributes']=_[_0xbf2d('0x38')](_0x179158[_0xbf2d('0x37')],qs['fields'](_0x161319[_0xbf2d('0x34')]['fields']));_0x3f35b5['attributes']=_0x3f35b5[_0xbf2d('0x3a')][_0xbf2d('0x3b')]?_0x3f35b5[_0xbf2d('0x3a')]:_0x179158['model'];if(_0x161319[_0xbf2d('0x34')][_0xbf2d('0x42')]){_0x3f35b5['include']=[{'all':!![]}];}_0x3f35b5=_[_0xbf2d('0x40')]({},_0x3f35b5,_0x161319['options']);return db['MailSubstatus'][_0xbf2d('0x49')](_0x3f35b5)[_0xbf2d('0x28')](handleEntityNotFound(_0x18795e,null))['then'](respondWithResult(_0x18795e,null))[_0xbf2d('0x46')](handleError(_0x18795e,null));};exports[_0xbf2d('0x4a')]=function(_0x1b1cff,_0x9622f6){return db[_0xbf2d('0x30')]['create'](_0x1b1cff[_0xbf2d('0x4b')],{})['then'](respondWithResult(_0x9622f6,0xc9))['catch'](handleError(_0x9622f6,null));};exports[_0xbf2d('0x27')]=function(_0x258177,_0xd4fc64){if(_0x258177['body']['id']){delete _0x258177[_0xbf2d('0x4b')]['id'];}return db[_0xbf2d('0x30')][_0xbf2d('0x49')]({'where':{'id':_0x258177['params']['id']}})[_0xbf2d('0x28')](handleEntityNotFound(_0xd4fc64,null))[_0xbf2d('0x28')](saveUpdates(_0x258177[_0xbf2d('0x4b')],null))[_0xbf2d('0x28')](respondWithResult(_0xd4fc64,null))[_0xbf2d('0x46')](handleError(_0xd4fc64,null));};exports[_0xbf2d('0x29')]=function(_0x4fc0bd,_0x397240){return db['MailSubstatus'][_0xbf2d('0x49')]({'where':{'id':_0x4fc0bd[_0xbf2d('0x48')]['id']}})[_0xbf2d('0x28')](handleEntityNotFound(_0x397240,null))[_0xbf2d('0x28')](removeEntity(_0x397240,null))[_0xbf2d('0x46')](handleError(_0x397240,null));};exports[_0xbf2d('0x4c')]=function(_0x43dcd5,_0x27186b){return db[_0xbf2d('0x30')][_0xbf2d('0x4c')]()[_0xbf2d('0x28')](respondWithResult(_0x27186b,null))[_0xbf2d('0x46')](handleError(_0x27186b,null));}; \ No newline at end of file +var _0x129c=['offset','limit','undefined','count','set','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json'];(function(_0x4fd607,_0x4d74fe){var _0x4d29fc=function(_0x408ce1){while(--_0x408ce1){_0x4fd607['push'](_0x4fd607['shift']());}};_0x4d29fc(++_0x4d74fe);}(_0x129c,0x1ec));var _0xc129=function(_0x1dab8f,_0x1b3cbc){_0x1dab8f=_0x1dab8f-0x0;var _0x44f9ef=_0x129c[_0x1dab8f];return _0x44f9ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc129('0x0'));var rp=require('request-promise');var moment=require(_0xc129('0x1'));var BPromise=require(_0xc129('0x2'));var Mustache=require(_0xc129('0x3'));var util=require(_0xc129('0x4'));var path=require(_0xc129('0x5'));var sox=require(_0xc129('0x6'));var csv=require(_0xc129('0x7'));var ejs=require(_0xc129('0x8'));var fs=require('fs');var fs_extra=require(_0xc129('0x9'));var _=require('lodash');var squel=require(_0xc129('0xa'));var crypto=require(_0xc129('0xb'));var jsforce=require(_0xc129('0xc'));var deskjs=require(_0xc129('0xd'));var toCsv=require(_0xc129('0x7'));var querystring=require(_0xc129('0xe'));var Papa=require('papaparse');var Redis=require(_0xc129('0xf'));var authService=require(_0xc129('0x10'));var qs=require(_0xc129('0x11'));var as=require(_0xc129('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc129('0x13'))(_0xc129('0x14'));var utils=require('../../config/utils');var config=require(_0xc129('0x15'));var licenseUtil=require(_0xc129('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f3c3d,_0xaa7b92){_0xaa7b92=_0xaa7b92||0xcc;return function(_0x3b0851){if(_0x3b0851){return _0x4f3c3d[_0xc129('0x17')](_0xaa7b92);}return _0x4f3c3d[_0xc129('0x18')](_0xaa7b92)['end']();};}function respondWithResult(_0x3d1277,_0x1876d0){_0x1876d0=_0x1876d0||0xc8;return function(_0x57069c){if(_0x57069c){return _0x3d1277[_0xc129('0x18')](_0x1876d0)[_0xc129('0x19')](_0x57069c);}};}function respondWithFilteredResult(_0x572c63,_0x1293c5){return function(_0x5c0f52){if(_0x5c0f52){var _0x536020=typeof _0x1293c5[_0xc129('0x1a')]==='undefined'&&typeof _0x1293c5[_0xc129('0x1b')]===_0xc129('0x1c');var _0x444efa=_0x5c0f52[_0xc129('0x1d')];var _0xc2efc0=_0x536020?0x0:_0x1293c5[_0xc129('0x1a')];var _0x32a51e=_0x536020?_0x5c0f52[_0xc129('0x1d')]:_0x1293c5[_0xc129('0x1a')]+_0x1293c5[_0xc129('0x1b')];var _0xcd775b;if(_0x32a51e>=_0x444efa){_0x32a51e=_0x444efa;_0xcd775b=0xc8;}else{_0xcd775b=0xce;}_0x572c63['status'](_0xcd775b);return _0x572c63[_0xc129('0x1e')]('Content-Range',_0xc2efc0+'-'+_0x32a51e+'/'+_0x444efa)[_0xc129('0x19')](_0x5c0f52);}return null;};}function patchUpdates(_0x3aae6e){return function(_0x4b1dfc){try{jsonpatch['apply'](_0x4b1dfc,_0x3aae6e,!![]);}catch(_0x1d99ea){return BPromise[_0xc129('0x1f')](_0x1d99ea);}return _0x4b1dfc[_0xc129('0x20')]();};}function saveUpdates(_0x4b3fee,_0x1ab846){return function(_0x52bf87){if(_0x52bf87){return _0x52bf87[_0xc129('0x21')](_0x4b3fee)[_0xc129('0x22')](function(_0x1ad364){return _0x1ad364;});}return null;};}function removeEntity(_0x54520f,_0xd94554){return function(_0x2e871e){if(_0x2e871e){return _0x2e871e[_0xc129('0x23')]()[_0xc129('0x22')](function(){_0x54520f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x112430,_0x3e57e8){return function(_0x5e5c5c){if(!_0x5e5c5c){_0x112430[_0xc129('0x17')](0x194);}return _0x5e5c5c;};}function handleError(_0x1cf611,_0x2b79b1){_0x2b79b1=_0x2b79b1||0x1f4;return function(_0x12b489){logger[_0xc129('0x24')](_0x12b489[_0xc129('0x25')]);if(_0x12b489['name']){delete _0x12b489[_0xc129('0x26')];}_0x1cf611[_0xc129('0x18')](_0x2b79b1)[_0xc129('0x27')](_0x12b489);};}exports[_0xc129('0x28')]=function(_0x59ee7f,_0x316ee3){var _0xf84cdc={},_0x240034={},_0x1ea818={'count':0x0,'rows':[]};var _0x337de6=_[_0xc129('0x29')](db[_0xc129('0x2a')][_0xc129('0x2b')],function(_0x1da74f){return{'name':_0x1da74f[_0xc129('0x2c')],'type':_0x1da74f[_0xc129('0x2d')][_0xc129('0x2e')]};});_0x240034[_0xc129('0x2f')]=_[_0xc129('0x29')](_0x337de6,_0xc129('0x26'));_0x240034[_0xc129('0x30')]=_[_0xc129('0x31')](_0x59ee7f[_0xc129('0x30')]);_0x240034[_0xc129('0x32')]=_['intersection'](_0x240034[_0xc129('0x2f')],_0x240034[_0xc129('0x30')]);_0xf84cdc[_0xc129('0x33')]=_[_0xc129('0x34')](_0x240034[_0xc129('0x2f')],qs[_0xc129('0x35')](_0x59ee7f[_0xc129('0x30')][_0xc129('0x35')]));_0xf84cdc['attributes']=_0xf84cdc[_0xc129('0x33')][_0xc129('0x36')]?_0xf84cdc[_0xc129('0x33')]:_0x240034[_0xc129('0x2f')];if(!_0x59ee7f[_0xc129('0x30')][_0xc129('0x37')](_0xc129('0x38'))){_0xf84cdc[_0xc129('0x1b')]=qs[_0xc129('0x1b')](_0x59ee7f['query'][_0xc129('0x1b')]);_0xf84cdc[_0xc129('0x1a')]=qs[_0xc129('0x1a')](_0x59ee7f[_0xc129('0x30')]['offset']);}_0xf84cdc['order']=qs['sort'](_0x59ee7f['query'][_0xc129('0x39')]);_0xf84cdc[_0xc129('0x3a')]=qs[_0xc129('0x32')](_[_0xc129('0x3b')](_0x59ee7f[_0xc129('0x30')],_0x240034[_0xc129('0x32')]),_0x337de6);if(_0x59ee7f[_0xc129('0x30')]['filter']){_0xf84cdc['where']=_[_0xc129('0x3c')](_0xf84cdc['where'],{'$or':_[_0xc129('0x29')](_0x337de6,function(_0x125b4f){if(_0x125b4f[_0xc129('0x2d')]!==_0xc129('0x3d')){var _0x517521={};_0x517521[_0x125b4f[_0xc129('0x26')]]={'$like':'%'+_0x59ee7f[_0xc129('0x30')][_0xc129('0x3e')]+'%'};return _0x517521;}})});}_0xf84cdc=_[_0xc129('0x3c')]({},_0xf84cdc,_0x59ee7f['options']);var _0x10fd1d={'where':_0xf84cdc[_0xc129('0x3a')]};return db[_0xc129('0x2a')]['count'](_0x10fd1d)[_0xc129('0x22')](function(_0x2e7a9a){_0x1ea818[_0xc129('0x1d')]=_0x2e7a9a;if(_0x59ee7f[_0xc129('0x30')]['includeAll']){_0xf84cdc[_0xc129('0x3f')]=[{'all':!![]}];}return db[_0xc129('0x2a')][_0xc129('0x40')](_0xf84cdc);})['then'](function(_0x4a1d8c){_0x1ea818[_0xc129('0x41')]=_0x4a1d8c;return _0x1ea818;})[_0xc129('0x22')](respondWithFilteredResult(_0x316ee3,_0xf84cdc))[_0xc129('0x42')](handleError(_0x316ee3,null));};exports[_0xc129('0x43')]=function(_0x1d6acc,_0x4044f7){var _0x54eca6={'raw':!![],'where':{'id':_0x1d6acc[_0xc129('0x44')]['id']}},_0x3b96da={};_0x3b96da[_0xc129('0x2f')]=_[_0xc129('0x31')](db['MailSubstatus'][_0xc129('0x2b')]);_0x3b96da[_0xc129('0x30')]=_[_0xc129('0x31')](_0x1d6acc[_0xc129('0x30')]);_0x3b96da[_0xc129('0x32')]=_[_0xc129('0x34')](_0x3b96da[_0xc129('0x2f')],_0x3b96da[_0xc129('0x30')]);_0x54eca6[_0xc129('0x33')]=_[_0xc129('0x34')](_0x3b96da[_0xc129('0x2f')],qs[_0xc129('0x35')](_0x1d6acc['query'][_0xc129('0x35')]));_0x54eca6[_0xc129('0x33')]=_0x54eca6[_0xc129('0x33')][_0xc129('0x36')]?_0x54eca6[_0xc129('0x33')]:_0x3b96da[_0xc129('0x2f')];if(_0x1d6acc[_0xc129('0x30')][_0xc129('0x45')]){_0x54eca6[_0xc129('0x3f')]=[{'all':!![]}];}_0x54eca6=_['merge']({},_0x54eca6,_0x1d6acc['options']);return db[_0xc129('0x2a')][_0xc129('0x46')](_0x54eca6)[_0xc129('0x22')](handleEntityNotFound(_0x4044f7,null))['then'](respondWithResult(_0x4044f7,null))[_0xc129('0x42')](handleError(_0x4044f7,null));};exports[_0xc129('0x47')]=function(_0x278541,_0x3aff5){return db[_0xc129('0x2a')][_0xc129('0x47')](_0x278541[_0xc129('0x48')],{})['then'](respondWithResult(_0x3aff5,0xc9))['catch'](handleError(_0x3aff5,null));};exports[_0xc129('0x21')]=function(_0x52dbe5,_0x481c51){if(_0x52dbe5['body']['id']){delete _0x52dbe5[_0xc129('0x48')]['id'];}return db[_0xc129('0x2a')][_0xc129('0x46')]({'where':{'id':_0x52dbe5[_0xc129('0x44')]['id']}})[_0xc129('0x22')](handleEntityNotFound(_0x481c51,null))[_0xc129('0x22')](saveUpdates(_0x52dbe5[_0xc129('0x48')],null))[_0xc129('0x22')](respondWithResult(_0x481c51,null))[_0xc129('0x42')](handleError(_0x481c51,null));};exports[_0xc129('0x23')]=function(_0x264f24,_0x16b02c){return db[_0xc129('0x2a')][_0xc129('0x46')]({'where':{'id':_0x264f24[_0xc129('0x44')]['id']}})['then'](handleEntityNotFound(_0x16b02c,null))[_0xc129('0x22')](removeEntity(_0x16b02c,null))[_0xc129('0x42')](handleError(_0x16b02c,null));};exports[_0xc129('0x49')]=function(_0x4a9987,_0x2acb11){return db[_0xc129('0x2a')][_0xc129('0x49')]()[_0xc129('0x22')](respondWithResult(_0x2acb11,null))[_0xc129('0x42')](handleError(_0x2acb11,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 586a6c8..a7004d0 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 _0xaeb2=['emit','events','setMaxListeners','update'];(function(_0x3a0585,_0x12062b){var _0xbdc3fc=function(_0x38fba7){while(--_0x38fba7){_0x3a0585['push'](_0x3a0585['shift']());}};_0xbdc3fc(++_0x12062b);}(_0xaeb2,0x111));var _0x2aeb=function(_0x7e219b,_0x42a533){_0x7e219b=_0x7e219b-0x0;var _0x436bc8=_0xaeb2[_0x7e219b];return _0x436bc8;};'use strict';var EventEmitter=require(_0x2aeb('0x0'));var MailSubstatus=require('../../mysqldb')['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x2aeb('0x1')](0x0);var events={'afterUpdate':_0x2aeb('0x2')};function emitEvent(_0x5855c0){return function(_0x48edf7,_0x7e64c6,_0x5c576b){MailSubstatusEvents['emit'](_0x5855c0+':'+_0x48edf7['id'],_0x48edf7);MailSubstatusEvents[_0x2aeb('0x3')](_0x5855c0,_0x48edf7);_0x5c576b(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 +var _0x87bf=['hook','exports','../../mysqldb','setMaxListeners','emit','hasOwnProperty'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x87bf,0x1b8));var _0xf87b=function(_0x2616de,_0x56dab8){_0x2616de=_0x2616de-0x0;var _0x19f21a=_0x87bf[_0x2616de];return _0x19f21a;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xf87b('0x0'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xf87b('0x1')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x43029b){return function(_0xc275ce,_0x3902b2,_0x4f710f){MailSubstatusEvents[_0xf87b('0x2')](_0x43029b+':'+_0xc275ce['id'],_0xc275ce);MailSubstatusEvents[_0xf87b('0x2')](_0x43029b,_0xc275ce);_0x4f710f(null);};}for(var e in events){if(events[_0xf87b('0x3')](e)){var event=events[e];MailSubstatus[_0xf87b('0x4')](e,emitEvent(event));}}module[_0xf87b('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 096ec78..6715d48 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 _0xf382=['MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','catch','exports','define'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf382,0x94));var _0x2f38=function(_0x1fd336,_0x4d812c){_0x1fd336=_0x1fd336-0x0;var _0x56ca14=_0xf382[_0x1fd336];return _0x56ca14;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x2f38('0x0')]=function(_0x4b494f){var _0x43ae4b=_0x4b494f['models'];return _0x4b494f[_0x2f38('0x1')](_0x2f38('0x2'),attributes,{'tableName':_0x2f38('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x16fcf1,_0x32b022,_0xe32818){return _0x43ae4b[_0x2f38('0x4')][_0x2f38('0x5')]({'value':_0x16fcf1[_0x2f38('0x6')]},{'where':{'field':_0x2f38('0x7'),'value':_0x16fcf1[_0x2f38('0x8')][_0x2f38('0x6')]}})['then'](function(){_0xe32818();})[_0x2f38('0x9')](function(_0x353d5b){_0xe32818(_0x353d5b);});}}});}; \ No newline at end of file +var _0xa778=['mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','models','define','MailSubstatus'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xa778,0x1f4));var _0x8a77=function(_0x1445e4,_0x315af8){_0x1445e4=_0x1445e4-0x0;var _0x621eca=_0xa778[_0x1445e4];return _0x621eca;};'use strict';var attributes=require(_0x8a77('0x0'));module['exports']=function(_0x2a966f){var _0x21370b=_0x2a966f[_0x8a77('0x1')];return _0x2a966f[_0x8a77('0x2')](_0x8a77('0x3'),attributes,{'tableName':_0x8a77('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5d2384,_0x59e095,_0x782fff){return _0x21370b[_0x8a77('0x5')][_0x8a77('0x6')]({'value':_0x5d2384[_0x8a77('0x7')]},{'where':{'field':_0x8a77('0x8'),'value':_0x5d2384[_0x8a77('0x9')][_0x8a77('0x7')]}})[_0x8a77('0xa')](function(){_0x782fff();})[_0x8a77('0xb')](function(_0x5aa81d){_0x782fff(_0x5aa81d);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 726bd95..84b3c31 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 _0xf2f7=['debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailSubstatus,\x20%s,\x20%s','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent'];(function(_0x56e64f,_0x4b7c63){var _0x88e7d0=function(_0x4c58bc){while(--_0x4c58bc){_0x56e64f['push'](_0x56e64f['shift']());}};_0x88e7d0(++_0x4b7c63);}(_0xf2f7,0xa3));var _0x7f2f=function(_0x180791,_0x555aee){_0x180791=_0x180791-0x0;var _0x242dbd=_0xf2f7[_0x180791];return _0x242dbd;};'use strict';var _=require(_0x7f2f('0x0'));var util=require('util');var moment=require(_0x7f2f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f2f('0x2'));var db=require(_0x7f2f('0x3'))['db'];var utils=require(_0x7f2f('0x4'));var logger=require(_0x7f2f('0x5'))(_0x7f2f('0x6'));var config=require(_0x7f2f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7f2f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x67ec96,_0x955275,_0x51fbd8){return new BPromise(function(_0x1758f9,_0x3efa71){return client[_0x7f2f('0x9')](_0x67ec96,_0x51fbd8)[_0x7f2f('0xa')](function(_0x57aa99){logger[_0x7f2f('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x955275,_0x7f2f('0xc'));logger[_0x7f2f('0xd')](_0x7f2f('0xe'),_0x955275,'request\x20sent',JSON[_0x7f2f('0xf')](_0x57aa99));if(_0x57aa99[_0x7f2f('0x10')]){if(_0x57aa99['error'][_0x7f2f('0x11')]===0x1f4){logger[_0x7f2f('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x955275,_0x57aa99[_0x7f2f('0x10')]['message']);return _0x3efa71(_0x57aa99[_0x7f2f('0x10')][_0x7f2f('0x12')]);}logger[_0x7f2f('0x10')](_0x7f2f('0x13'),_0x955275,_0x57aa99[_0x7f2f('0x10')][_0x7f2f('0x12')]);return _0x1758f9(_0x57aa99[_0x7f2f('0x10')][_0x7f2f('0x12')]);}else{logger[_0x7f2f('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x955275,'request\x20sent');_0x1758f9(_0x57aa99[_0x7f2f('0x14')][_0x7f2f('0x12')]);}})[_0x7f2f('0x15')](function(_0x1a9fff){logger['error'](_0x7f2f('0x13'),_0x955275,_0x1a9fff);_0x3efa71(_0x1a9fff);});});} \ No newline at end of file +var _0xdc3d=['request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0xddafa,_0xcb91d){var _0x335e2d=function(_0x24b48f){while(--_0x24b48f){_0xddafa['push'](_0xddafa['shift']());}};_0x335e2d(++_0xcb91d);}(_0xdc3d,0x1a4));var _0xddc3=function(_0x3e2237,_0x98866b){_0x3e2237=_0x3e2237-0x0;var _0x48a135=_0xdc3d[_0x3e2237];return _0x48a135;};'use strict';var _=require(_0xddc3('0x0'));var util=require(_0xddc3('0x1'));var moment=require(_0xddc3('0x2'));var BPromise=require(_0xddc3('0x3'));var rs=require(_0xddc3('0x4'));var fs=require('fs');var Redis=require(_0xddc3('0x5'));var db=require(_0xddc3('0x6'))['db'];var utils=require(_0xddc3('0x7'));var logger=require(_0xddc3('0x8'))(_0xddc3('0x9'));var config=require('../../config/environment');var jayson=require(_0xddc3('0xa'));var client=jayson[_0xddc3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x100cd1,_0x476668,_0x4a7039){return new BPromise(function(_0x1e7383,_0x5724da){return client[_0xddc3('0xc')](_0x100cd1,_0x4a7039)[_0xddc3('0xd')](function(_0x9bf3f){logger['info'](_0xddc3('0xe'),_0x476668,_0xddc3('0xf'));logger[_0xddc3('0x10')](_0xddc3('0x11'),_0x476668,_0xddc3('0xf'),JSON[_0xddc3('0x12')](_0x9bf3f));if(_0x9bf3f[_0xddc3('0x13')]){if(_0x9bf3f[_0xddc3('0x13')][_0xddc3('0x14')]===0x1f4){logger[_0xddc3('0x13')](_0xddc3('0xe'),_0x476668,_0x9bf3f[_0xddc3('0x13')][_0xddc3('0x15')]);return _0x5724da(_0x9bf3f[_0xddc3('0x13')][_0xddc3('0x15')]);}logger[_0xddc3('0x13')](_0xddc3('0xe'),_0x476668,_0x9bf3f[_0xddc3('0x13')][_0xddc3('0x15')]);return _0x1e7383(_0x9bf3f[_0xddc3('0x13')][_0xddc3('0x15')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x476668,_0xddc3('0xf'));_0x1e7383(_0x9bf3f[_0xddc3('0x16')]['message']);}})[_0xddc3('0x17')](function(_0x2ade67){logger[_0xddc3('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x476668,_0x2ade67);_0x5724da(_0x2ade67);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 473e500..eaf8f8d 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 _0x4e38=['post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4e38,0xd5));var _0x84e3=function(_0x3a042a,_0x592c17){_0x3a042a=_0x3a042a-0x0;var _0x1d5293=_0x4e38[_0x3a042a];return _0x1d5293;};'use strict';var multer=require('multer');var util=require(_0x84e3('0x0'));var path=require(_0x84e3('0x1'));var timeout=require(_0x84e3('0x2'));var express=require(_0x84e3('0x3'));var router=express[_0x84e3('0x4')]();var fs_extra=require(_0x84e3('0x5'));var auth=require(_0x84e3('0x6'));var interaction=require(_0x84e3('0x7'));var config=require(_0x84e3('0x8'));var controller=require(_0x84e3('0x9'));router[_0x84e3('0xa')]('/',auth['isAuthenticated'](),controller[_0x84e3('0xb')]);router[_0x84e3('0xa')](_0x84e3('0xc'),auth[_0x84e3('0xd')](),controller[_0x84e3('0xe')]);router[_0x84e3('0xa')](_0x84e3('0xf'),auth[_0x84e3('0xd')](),controller[_0x84e3('0x10')]);router[_0x84e3('0x11')]('/',auth[_0x84e3('0xd')](),controller[_0x84e3('0x12')]);router[_0x84e3('0x13')]('/:id',auth[_0x84e3('0xd')](),controller[_0x84e3('0x14')]);router[_0x84e3('0x15')](_0x84e3('0xf'),auth['isAuthenticated'](),controller[_0x84e3('0x16')]);module['exports']=router; \ No newline at end of file +var _0x2e0c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe','describe','post','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x45bd95,_0x16c7d9){var _0x1e47e8=function(_0x19fa45){while(--_0x19fa45){_0x45bd95['push'](_0x45bd95['shift']());}};_0x1e47e8(++_0x16c7d9);}(_0x2e0c,0xd7));var _0xc2e0=function(_0x11eecd,_0x2c4530){_0x11eecd=_0x11eecd-0x0;var _0x4e9856=_0x2e0c[_0x11eecd];return _0x4e9856;};'use strict';var multer=require(_0xc2e0('0x0'));var util=require('util');var path=require(_0xc2e0('0x1'));var timeout=require(_0xc2e0('0x2'));var express=require(_0xc2e0('0x3'));var router=express[_0xc2e0('0x4')]();var fs_extra=require(_0xc2e0('0x5'));var auth=require(_0xc2e0('0x6'));var interaction=require(_0xc2e0('0x7'));var config=require(_0xc2e0('0x8'));var controller=require(_0xc2e0('0x9'));router[_0xc2e0('0xa')]('/',auth[_0xc2e0('0xb')](),controller['index']);router[_0xc2e0('0xa')](_0xc2e0('0xc'),auth[_0xc2e0('0xb')](),controller[_0xc2e0('0xd')]);router[_0xc2e0('0xa')]('/:id',auth[_0xc2e0('0xb')](),controller['show']);router[_0xc2e0('0xe')]('/',auth[_0xc2e0('0xb')](),controller['create']);router[_0xc2e0('0xf')](_0xc2e0('0x10'),auth[_0xc2e0('0xb')](),controller[_0xc2e0('0x11')]);router[_0xc2e0('0x12')](_0xc2e0('0x10'),auth[_0xc2e0('0xb')](),controller['destroy']);module[_0xc2e0('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 e63f892..1d88be5 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xb43b,0x1b2));var _0xbb43=function(_0x215a2d,_0x32f369){_0x215a2d=_0x215a2d-0x0;var _0x2d9576=_0xb43b[_0x215a2d];return _0x2d9576;};'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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0xf2c129,_0x20b04c){var _0x1e4046=function(_0x260475){while(--_0x260475){_0xf2c129['push'](_0xf2c129['shift']());}};_0x1e4046(++_0x20b04c);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x00bb[_0x2dafbe];return _0x58a45a;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 1113728..7a077d2 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 _0x130f=['keys','filters','intersection','fields','attributes','nolimit','sort','pick','filter','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','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/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x318653,_0x333435){var _0x4ba57d=function(_0x8a60d1){while(--_0x8a60d1){_0x318653['push'](_0x318653['shift']());}};_0x4ba57d(++_0x333435);}(_0x130f,0x65));var _0xf130=function(_0x1a0a2e,_0x1a770e){_0x1a0a2e=_0x1a0a2e-0x0;var _0x1ffeb5=_0x130f[_0x1a0a2e];return _0x1ffeb5;};'use strict';var emlformat=require(_0xf130('0x0'));var rimraf=require(_0xf130('0x1'));var zipdir=require(_0xf130('0x2'));var jsonpatch=require(_0xf130('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf130('0x4'));var Mustache=require(_0xf130('0x5'));var util=require(_0xf130('0x6'));var path=require(_0xf130('0x7'));var sox=require(_0xf130('0x8'));var csv=require(_0xf130('0x9'));var ejs=require(_0xf130('0xa'));var fs=require('fs');var fs_extra=require(_0xf130('0xb'));var _=require(_0xf130('0xc'));var squel=require(_0xf130('0xd'));var crypto=require(_0xf130('0xe'));var jsforce=require(_0xf130('0xf'));var deskjs=require(_0xf130('0x10'));var toCsv=require(_0xf130('0x9'));var querystring=require(_0xf130('0x11'));var Papa=require('papaparse');var Redis=require(_0xf130('0x12'));var authService=require(_0xf130('0x13'));var qs=require(_0xf130('0x14'));var as=require(_0xf130('0x15'));var hardwareService=require(_0xf130('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf130('0x17'));var licenseUtil=require(_0xf130('0x18'));var db=require(_0xf130('0x19'))['db'];function respondWithStatusCode(_0x20957b,_0x2acd77){_0x2acd77=_0x2acd77||0xcc;return function(_0x4950ad){if(_0x4950ad){return _0x20957b['sendStatus'](_0x2acd77);}return _0x20957b[_0xf130('0x1a')](_0x2acd77)['end']();};}function respondWithResult(_0x3c0dd0,_0x102649){_0x102649=_0x102649||0xc8;return function(_0x3f1925){if(_0x3f1925){return _0x3c0dd0[_0xf130('0x1a')](_0x102649)[_0xf130('0x1b')](_0x3f1925);}};}function respondWithFilteredResult(_0x204866,_0x2aff00){return function(_0x18d7a6){if(_0x18d7a6){var _0x470a4c=typeof _0x2aff00[_0xf130('0x1c')]==='undefined'&&typeof _0x2aff00[_0xf130('0x1d')]===_0xf130('0x1e');var _0xb1a6e3=_0x18d7a6[_0xf130('0x1f')];var _0x55fe64=_0x470a4c?0x0:_0x2aff00['offset'];var _0x4a86fc=_0x470a4c?_0x18d7a6[_0xf130('0x1f')]:_0x2aff00[_0xf130('0x1c')]+_0x2aff00[_0xf130('0x1d')];var _0x3f15ce;if(_0x4a86fc>=_0xb1a6e3){_0x4a86fc=_0xb1a6e3;_0x3f15ce=0xc8;}else{_0x3f15ce=0xce;}_0x204866['status'](_0x3f15ce);return _0x204866[_0xf130('0x20')](_0xf130('0x21'),_0x55fe64+'-'+_0x4a86fc+'/'+_0xb1a6e3)[_0xf130('0x1b')](_0x18d7a6);}return null;};}function patchUpdates(_0x59d824){return function(_0xe7342d){try{jsonpatch[_0xf130('0x22')](_0xe7342d,_0x59d824,!![]);}catch(_0x54dd15){return BPromise[_0xf130('0x23')](_0x54dd15);}return _0xe7342d[_0xf130('0x24')]();};}function saveUpdates(_0x49b31f,_0xab145a){return function(_0x3cc16d){if(_0x3cc16d){return _0x3cc16d[_0xf130('0x25')](_0x49b31f)[_0xf130('0x26')](function(_0x460cd3){return _0x460cd3;});}return null;};}function removeEntity(_0x4f48d6,_0x46eb80){return function(_0x417410){if(_0x417410){return _0x417410[_0xf130('0x27')]()[_0xf130('0x26')](function(){_0x4f48d6[_0xf130('0x1a')](0xcc)[_0xf130('0x28')]();});}};}function handleEntityNotFound(_0x56b03b,_0x3bbc94){return function(_0x51da8b){if(!_0x51da8b){_0x56b03b[_0xf130('0x29')](0x194);}return _0x51da8b;};}function handleError(_0x617991,_0xb94288){_0xb94288=_0xb94288||0x1f4;return function(_0x54f11a){logger[_0xf130('0x2a')](_0x54f11a['stack']);if(_0x54f11a[_0xf130('0x2b')]){delete _0x54f11a[_0xf130('0x2b')];}_0x617991[_0xf130('0x1a')](_0xb94288)['send'](_0x54f11a);};}exports[_0xf130('0x2c')]=function(_0x20a966,_0x1db5a9){var _0x15944a={},_0x3f7255={},_0x3ca153={'count':0x0,'rows':[]};var _0x3e34c5=_[_0xf130('0x2d')](db[_0xf130('0x2e')][_0xf130('0x2f')],function(_0x14c3f4){return{'name':_0x14c3f4[_0xf130('0x30')],'type':_0x14c3f4[_0xf130('0x31')][_0xf130('0x32')]};});_0x3f7255[_0xf130('0x33')]=_[_0xf130('0x2d')](_0x3e34c5,'name');_0x3f7255[_0xf130('0x34')]=_[_0xf130('0x35')](_0x20a966[_0xf130('0x34')]);_0x3f7255[_0xf130('0x36')]=_[_0xf130('0x37')](_0x3f7255[_0xf130('0x33')],_0x3f7255[_0xf130('0x34')]);_0x15944a['attributes']=_[_0xf130('0x37')](_0x3f7255['model'],qs[_0xf130('0x38')](_0x20a966[_0xf130('0x34')][_0xf130('0x38')]));_0x15944a[_0xf130('0x39')]=_0x15944a[_0xf130('0x39')]['length']?_0x15944a['attributes']:_0x3f7255[_0xf130('0x33')];if(!_0x20a966[_0xf130('0x34')]['hasOwnProperty'](_0xf130('0x3a'))){_0x15944a[_0xf130('0x1d')]=qs['limit'](_0x20a966[_0xf130('0x34')][_0xf130('0x1d')]);_0x15944a[_0xf130('0x1c')]=qs[_0xf130('0x1c')](_0x20a966[_0xf130('0x34')][_0xf130('0x1c')]);}_0x15944a['order']=qs[_0xf130('0x3b')](_0x20a966[_0xf130('0x34')]['sort']);_0x15944a['where']=qs[_0xf130('0x36')](_[_0xf130('0x3c')](_0x20a966[_0xf130('0x34')],_0x3f7255[_0xf130('0x36')]),_0x3e34c5);if(_0x20a966[_0xf130('0x34')][_0xf130('0x3d')]){_0x15944a[_0xf130('0x3e')]=_['merge'](_0x15944a[_0xf130('0x3e')],{'$or':_[_0xf130('0x2d')](_0x3e34c5,function(_0x336d6e){if(_0x336d6e[_0xf130('0x31')]!==_0xf130('0x3f')){var _0x101d9f={};_0x101d9f[_0x336d6e[_0xf130('0x2b')]]={'$like':'%'+_0x20a966[_0xf130('0x34')][_0xf130('0x3d')]+'%'};return _0x101d9f;}})});}_0x15944a=_['merge']({},_0x15944a,_0x20a966[_0xf130('0x40')]);var _0x1c950a={'where':_0x15944a[_0xf130('0x3e')]};return db[_0xf130('0x2e')][_0xf130('0x1f')](_0x1c950a)[_0xf130('0x26')](function(_0x50dab2){_0x3ca153[_0xf130('0x1f')]=_0x50dab2;if(_0x20a966['query'][_0xf130('0x41')]){_0x15944a['include']=[{'all':!![]}];}return db[_0xf130('0x2e')][_0xf130('0x42')](_0x15944a);})[_0xf130('0x26')](function(_0x4bcc8e){_0x3ca153[_0xf130('0x43')]=_0x4bcc8e;return _0x3ca153;})['then'](respondWithFilteredResult(_0x1db5a9,_0x15944a))[_0xf130('0x44')](handleError(_0x1db5a9,null));};exports[_0xf130('0x45')]=function(_0x281973,_0x12aaf2){var _0x2cf9e5={'raw':!![],'where':{'id':_0x281973[_0xf130('0x46')]['id']}},_0x2c5182={};_0x2c5182[_0xf130('0x33')]=_['keys'](db[_0xf130('0x2e')][_0xf130('0x2f')]);_0x2c5182['query']=_[_0xf130('0x35')](_0x281973['query']);_0x2c5182[_0xf130('0x36')]=_[_0xf130('0x37')](_0x2c5182[_0xf130('0x33')],_0x2c5182['query']);_0x2cf9e5['attributes']=_['intersection'](_0x2c5182['model'],qs[_0xf130('0x38')](_0x281973['query'][_0xf130('0x38')]));_0x2cf9e5['attributes']=_0x2cf9e5['attributes'][_0xf130('0x47')]?_0x2cf9e5[_0xf130('0x39')]:_0x2c5182[_0xf130('0x33')];if(_0x281973['query'][_0xf130('0x41')]){_0x2cf9e5['include']=[{'all':!![]}];}_0x2cf9e5=_[_0xf130('0x48')]({},_0x2cf9e5,_0x281973[_0xf130('0x40')]);return db[_0xf130('0x2e')][_0xf130('0x49')](_0x2cf9e5)['then'](handleEntityNotFound(_0x12aaf2,null))[_0xf130('0x26')](respondWithResult(_0x12aaf2,null))[_0xf130('0x44')](handleError(_0x12aaf2,null));};exports[_0xf130('0x4a')]=function(_0xe57f34,_0x4021ad){return db['MailTransferReport']['create'](_0xe57f34[_0xf130('0x4b')],{})[_0xf130('0x26')](respondWithResult(_0x4021ad,0xc9))[_0xf130('0x44')](handleError(_0x4021ad,null));};exports[_0xf130('0x25')]=function(_0x1b4cf6,_0x5276be){if(_0x1b4cf6['body']['id']){delete _0x1b4cf6[_0xf130('0x4b')]['id'];}return db[_0xf130('0x2e')][_0xf130('0x49')]({'where':{'id':_0x1b4cf6[_0xf130('0x46')]['id']}})[_0xf130('0x26')](handleEntityNotFound(_0x5276be,null))[_0xf130('0x26')](saveUpdates(_0x1b4cf6[_0xf130('0x4b')],null))[_0xf130('0x26')](respondWithResult(_0x5276be,null))[_0xf130('0x44')](handleError(_0x5276be,null));};exports[_0xf130('0x27')]=function(_0x47e76f,_0x567c7c){return db[_0xf130('0x2e')][_0xf130('0x49')]({'where':{'id':_0x47e76f[_0xf130('0x46')]['id']}})['then'](handleEntityNotFound(_0x567c7c,null))[_0xf130('0x26')](removeEntity(_0x567c7c,null))['catch'](handleError(_0x567c7c,null));};exports[_0xf130('0x4c')]=function(_0x43c73c,_0x79c48f){return db['MailTransferReport'][_0xf130('0x4c')]()[_0xf130('0x26')](respondWithResult(_0x79c48f,null))[_0xf130('0x44')](handleError(_0x79c48f,null));}; \ No newline at end of file +var _0xf9fa=['fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','catch','create','body','update','find','describe','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','../../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','undefined','count','offset','set','Content-Range','reject','then','destroy','error','name','send','index','map','MailTransferReport','rawAttributes','fieldName','query','keys','intersection','model','attributes'];(function(_0x16abf7,_0x2c36e1){var _0x2abb12=function(_0x2b5ed5){while(--_0x2b5ed5){_0x16abf7['push'](_0x16abf7['shift']());}};_0x2abb12(++_0x2c36e1);}(_0xf9fa,0x15a));var _0xaf9f=function(_0x29d52b,_0xe4cc42){_0x29d52b=_0x29d52b-0x0;var _0x59c50b=_0xf9fa[_0x29d52b];return _0x59c50b;};'use strict';var emlformat=require(_0xaf9f('0x0'));var rimraf=require(_0xaf9f('0x1'));var zipdir=require(_0xaf9f('0x2'));var jsonpatch=require(_0xaf9f('0x3'));var rp=require('request-promise');var moment=require(_0xaf9f('0x4'));var BPromise=require(_0xaf9f('0x5'));var Mustache=require(_0xaf9f('0x6'));var util=require(_0xaf9f('0x7'));var path=require(_0xaf9f('0x8'));var sox=require(_0xaf9f('0x9'));var csv=require(_0xaf9f('0xa'));var ejs=require(_0xaf9f('0xb'));var fs=require('fs');var fs_extra=require(_0xaf9f('0xc'));var _=require(_0xaf9f('0xd'));var squel=require(_0xaf9f('0xe'));var crypto=require(_0xaf9f('0xf'));var jsforce=require(_0xaf9f('0x10'));var deskjs=require(_0xaf9f('0x11'));var toCsv=require(_0xaf9f('0xa'));var querystring=require(_0xaf9f('0x12'));var Papa=require(_0xaf9f('0x13'));var Redis=require('ioredis');var authService=require(_0xaf9f('0x14'));var qs=require(_0xaf9f('0x15'));var as=require(_0xaf9f('0x16'));var hardwareService=require(_0xaf9f('0x17'));var logger=require('../../config/logger')(_0xaf9f('0x18'));var utils=require(_0xaf9f('0x19'));var config=require(_0xaf9f('0x1a'));var licenseUtil=require(_0xaf9f('0x1b'));var db=require(_0xaf9f('0x1c'))['db'];function respondWithStatusCode(_0x51330b,_0x452213){_0x452213=_0x452213||0xcc;return function(_0x95178b){if(_0x95178b){return _0x51330b[_0xaf9f('0x1d')](_0x452213);}return _0x51330b[_0xaf9f('0x1e')](_0x452213)[_0xaf9f('0x1f')]();};}function respondWithResult(_0x1f4129,_0x40ae79){_0x40ae79=_0x40ae79||0xc8;return function(_0x40a117){if(_0x40a117){return _0x1f4129[_0xaf9f('0x1e')](_0x40ae79)[_0xaf9f('0x20')](_0x40a117);}};}function respondWithFilteredResult(_0x258081,_0x1fca4a){return function(_0x29a0b0){if(_0x29a0b0){var _0x2744b3=typeof _0x1fca4a['offset']===_0xaf9f('0x21')&&typeof _0x1fca4a['limit']===_0xaf9f('0x21');var _0x3a8600=_0x29a0b0[_0xaf9f('0x22')];var _0x1333e2=_0x2744b3?0x0:_0x1fca4a[_0xaf9f('0x23')];var _0x539b6d=_0x2744b3?_0x29a0b0[_0xaf9f('0x22')]:_0x1fca4a['offset']+_0x1fca4a['limit'];var _0x285e18;if(_0x539b6d>=_0x3a8600){_0x539b6d=_0x3a8600;_0x285e18=0xc8;}else{_0x285e18=0xce;}_0x258081[_0xaf9f('0x1e')](_0x285e18);return _0x258081[_0xaf9f('0x24')](_0xaf9f('0x25'),_0x1333e2+'-'+_0x539b6d+'/'+_0x3a8600)[_0xaf9f('0x20')](_0x29a0b0);}return null;};}function patchUpdates(_0x5eedd9){return function(_0x487234){try{jsonpatch['apply'](_0x487234,_0x5eedd9,!![]);}catch(_0x131076){return BPromise[_0xaf9f('0x26')](_0x131076);}return _0x487234['save']();};}function saveUpdates(_0x877cf3,_0x6c3101){return function(_0x5b5961){if(_0x5b5961){return _0x5b5961['update'](_0x877cf3)[_0xaf9f('0x27')](function(_0x10c0a9){return _0x10c0a9;});}return null;};}function removeEntity(_0x5b301f,_0x1d442c){return function(_0x20fd18){if(_0x20fd18){return _0x20fd18[_0xaf9f('0x28')]()[_0xaf9f('0x27')](function(){_0x5b301f[_0xaf9f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fd345,_0x3f54dd){return function(_0x2a30e7){if(!_0x2a30e7){_0x4fd345[_0xaf9f('0x1d')](0x194);}return _0x2a30e7;};}function handleError(_0x5eeaf1,_0x59802e){_0x59802e=_0x59802e||0x1f4;return function(_0x444ced){logger[_0xaf9f('0x29')](_0x444ced['stack']);if(_0x444ced['name']){delete _0x444ced[_0xaf9f('0x2a')];}_0x5eeaf1[_0xaf9f('0x1e')](_0x59802e)[_0xaf9f('0x2b')](_0x444ced);};}exports[_0xaf9f('0x2c')]=function(_0x3ebaa2,_0x18e2a5){var _0x1cd4a7={},_0x1883df={},_0x188494={'count':0x0,'rows':[]};var _0xfbb010=_[_0xaf9f('0x2d')](db[_0xaf9f('0x2e')][_0xaf9f('0x2f')],function(_0x2b8d94){return{'name':_0x2b8d94[_0xaf9f('0x30')],'type':_0x2b8d94['type']['key']};});_0x1883df['model']=_['map'](_0xfbb010,_0xaf9f('0x2a'));_0x1883df[_0xaf9f('0x31')]=_[_0xaf9f('0x32')](_0x3ebaa2[_0xaf9f('0x31')]);_0x1883df['filters']=_[_0xaf9f('0x33')](_0x1883df[_0xaf9f('0x34')],_0x1883df['query']);_0x1cd4a7[_0xaf9f('0x35')]=_[_0xaf9f('0x33')](_0x1883df[_0xaf9f('0x34')],qs['fields'](_0x3ebaa2[_0xaf9f('0x31')][_0xaf9f('0x36')]));_0x1cd4a7[_0xaf9f('0x35')]=_0x1cd4a7[_0xaf9f('0x35')][_0xaf9f('0x37')]?_0x1cd4a7[_0xaf9f('0x35')]:_0x1883df['model'];if(!_0x3ebaa2[_0xaf9f('0x31')][_0xaf9f('0x38')](_0xaf9f('0x39'))){_0x1cd4a7[_0xaf9f('0x3a')]=qs[_0xaf9f('0x3a')](_0x3ebaa2[_0xaf9f('0x31')][_0xaf9f('0x3a')]);_0x1cd4a7[_0xaf9f('0x23')]=qs[_0xaf9f('0x23')](_0x3ebaa2[_0xaf9f('0x31')]['offset']);}_0x1cd4a7['order']=qs[_0xaf9f('0x3b')](_0x3ebaa2[_0xaf9f('0x31')][_0xaf9f('0x3b')]);_0x1cd4a7[_0xaf9f('0x3c')]=qs[_0xaf9f('0x3d')](_[_0xaf9f('0x3e')](_0x3ebaa2['query'],_0x1883df[_0xaf9f('0x3d')]),_0xfbb010);if(_0x3ebaa2[_0xaf9f('0x31')][_0xaf9f('0x3f')]){_0x1cd4a7[_0xaf9f('0x3c')]=_['merge'](_0x1cd4a7['where'],{'$or':_[_0xaf9f('0x2d')](_0xfbb010,function(_0x472ce4){if(_0x472ce4[_0xaf9f('0x40')]!==_0xaf9f('0x41')){var _0x6cc8de={};_0x6cc8de[_0x472ce4['name']]={'$like':'%'+_0x3ebaa2[_0xaf9f('0x31')][_0xaf9f('0x3f')]+'%'};return _0x6cc8de;}})});}_0x1cd4a7=_[_0xaf9f('0x42')]({},_0x1cd4a7,_0x3ebaa2[_0xaf9f('0x43')]);var _0x5cfe49={'where':_0x1cd4a7[_0xaf9f('0x3c')]};return db[_0xaf9f('0x2e')][_0xaf9f('0x22')](_0x5cfe49)[_0xaf9f('0x27')](function(_0x227770){_0x188494[_0xaf9f('0x22')]=_0x227770;if(_0x3ebaa2[_0xaf9f('0x31')][_0xaf9f('0x44')]){_0x1cd4a7[_0xaf9f('0x45')]=[{'all':!![]}];}return db['MailTransferReport'][_0xaf9f('0x46')](_0x1cd4a7);})[_0xaf9f('0x27')](function(_0x4040a9){_0x188494[_0xaf9f('0x47')]=_0x4040a9;return _0x188494;})[_0xaf9f('0x27')](respondWithFilteredResult(_0x18e2a5,_0x1cd4a7))['catch'](handleError(_0x18e2a5,null));};exports[_0xaf9f('0x48')]=function(_0x55e9bb,_0x1b4972){var _0x16951f={'raw':!![],'where':{'id':_0x55e9bb[_0xaf9f('0x49')]['id']}},_0x58e46b={};_0x58e46b[_0xaf9f('0x34')]=_[_0xaf9f('0x32')](db['MailTransferReport'][_0xaf9f('0x2f')]);_0x58e46b['query']=_[_0xaf9f('0x32')](_0x55e9bb[_0xaf9f('0x31')]);_0x58e46b[_0xaf9f('0x3d')]=_[_0xaf9f('0x33')](_0x58e46b[_0xaf9f('0x34')],_0x58e46b['query']);_0x16951f[_0xaf9f('0x35')]=_[_0xaf9f('0x33')](_0x58e46b['model'],qs[_0xaf9f('0x36')](_0x55e9bb[_0xaf9f('0x31')][_0xaf9f('0x36')]));_0x16951f[_0xaf9f('0x35')]=_0x16951f[_0xaf9f('0x35')][_0xaf9f('0x37')]?_0x16951f[_0xaf9f('0x35')]:_0x58e46b[_0xaf9f('0x34')];if(_0x55e9bb[_0xaf9f('0x31')]['includeAll']){_0x16951f['include']=[{'all':!![]}];}_0x16951f=_[_0xaf9f('0x42')]({},_0x16951f,_0x55e9bb['options']);return db[_0xaf9f('0x2e')]['find'](_0x16951f)[_0xaf9f('0x27')](handleEntityNotFound(_0x1b4972,null))[_0xaf9f('0x27')](respondWithResult(_0x1b4972,null))[_0xaf9f('0x4a')](handleError(_0x1b4972,null));};exports[_0xaf9f('0x4b')]=function(_0x3ae69c,_0x838136){return db[_0xaf9f('0x2e')][_0xaf9f('0x4b')](_0x3ae69c[_0xaf9f('0x4c')],{})[_0xaf9f('0x27')](respondWithResult(_0x838136,0xc9))[_0xaf9f('0x4a')](handleError(_0x838136,null));};exports[_0xaf9f('0x4d')]=function(_0x55064f,_0xd9bde4){if(_0x55064f['body']['id']){delete _0x55064f[_0xaf9f('0x4c')]['id'];}return db[_0xaf9f('0x2e')][_0xaf9f('0x4e')]({'where':{'id':_0x55064f[_0xaf9f('0x49')]['id']}})[_0xaf9f('0x27')](handleEntityNotFound(_0xd9bde4,null))[_0xaf9f('0x27')](saveUpdates(_0x55064f[_0xaf9f('0x4c')],null))[_0xaf9f('0x27')](respondWithResult(_0xd9bde4,null))[_0xaf9f('0x4a')](handleError(_0xd9bde4,null));};exports['destroy']=function(_0xfb4616,_0x124304){return db[_0xaf9f('0x2e')][_0xaf9f('0x4e')]({'where':{'id':_0xfb4616['params']['id']}})[_0xaf9f('0x27')](handleEntityNotFound(_0x124304,null))['then'](removeEntity(_0x124304,null))[_0xaf9f('0x4a')](handleError(_0x124304,null));};exports[_0xaf9f('0x4f')]=function(_0x1717ff,_0x3930e5){return db[_0xaf9f('0x2e')][_0xaf9f('0x4f')]()['then'](respondWithResult(_0x3930e5,null))[_0xaf9f('0x4a')](handleError(_0x3930e5,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index d29cdce..9c72ae7 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 _0x2cd0=['./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','moment','path','rimraf','../../config/environment'];(function(_0x7cce8d,_0x8d7c9c){var _0x381b50=function(_0x4ab2d4){while(--_0x4ab2d4){_0x7cce8d['push'](_0x7cce8d['shift']());}};_0x381b50(++_0x8d7c9c);}(_0x2cd0,0x8a));var _0x02cd=function(_0x2dc81d,_0x2e2c29){_0x2dc81d=_0x2dc81d-0x0;var _0x24a539=_0x2cd0[_0x2dc81d];return _0x24a539;};'use strict';var _=require(_0x02cd('0x0'));var util=require(_0x02cd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x02cd('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x02cd('0x3'));var rimraf=require(_0x02cd('0x4'));var config=require(_0x02cd('0x5'));var attributes=require(_0x02cd('0x6'));module[_0x02cd('0x7')]=function(_0x35144b,_0x222904){return _0x35144b[_0x02cd('0x8')](_0x02cd('0x9'),attributes,{'tableName':_0x02cd('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x02cd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4508=['uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer'];(function(_0x4cce8,_0x22d1fe){var _0x458440=function(_0x3d15e4){while(--_0x3d15e4){_0x4cce8['push'](_0x4cce8['shift']());}};_0x458440(++_0x22d1fe);}(_0x4508,0x1ef));var _0x8450=function(_0x4fd4fc,_0x4524fe){_0x4fd4fc=_0x4fd4fc-0x0;var _0x33a56e=_0x4508[_0x4fd4fc];return _0x33a56e;};'use strict';var _=require('lodash');var util=require(_0x8450('0x0'));var logger=require(_0x8450('0x1'))(_0x8450('0x2'));var moment=require('moment');var BPromise=require(_0x8450('0x3'));var rp=require(_0x8450('0x4'));var fs=require('fs');var path=require(_0x8450('0x5'));var rimraf=require(_0x8450('0x6'));var config=require(_0x8450('0x7'));var attributes=require(_0x8450('0x8'));module[_0x8450('0x9')]=function(_0x3d8b00,_0x48279b){return _0x3d8b00[_0x8450('0xa')]('MailTransferReport',attributes,{'tableName':_0x8450('0xb'),'paranoid':![],'indexes':[{'name':_0x8450('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 02ddc53..9fb7d1b 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 _0x1568=['code','MailTransferReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2d88d6,_0x5bb9b9){var _0x33b200=function(_0xf3a4df){while(--_0xf3a4df){_0x2d88d6['push'](_0x2d88d6['shift']());}};_0x33b200(++_0x5bb9b9);}(_0x1568,0x1e7));var _0x8156=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1568[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8156('0x0'));var moment=require(_0x8156('0x1'));var BPromise=require(_0x8156('0x2'));var rs=require(_0x8156('0x3'));var fs=require('fs');var Redis=require(_0x8156('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8156('0x5'));var logger=require(_0x8156('0x6'))('rpc');var config=require(_0x8156('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8156('0x8')][_0x8156('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41f5e6,_0x5e87fa,_0xda3538){return new BPromise(function(_0x389a78,_0x40f9d1){return client[_0x8156('0xa')](_0x41f5e6,_0xda3538)['then'](function(_0x3f619){logger[_0x8156('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x5e87fa,_0x8156('0xc'));logger[_0x8156('0xd')](_0x8156('0xe'),_0x5e87fa,_0x8156('0xc'),JSON[_0x8156('0xf')](_0x3f619));if(_0x3f619[_0x8156('0x10')]){if(_0x3f619['error'][_0x8156('0x11')]===0x1f4){logger[_0x8156('0x10')](_0x8156('0x12'),_0x5e87fa,_0x3f619['error'][_0x8156('0x13')]);return _0x40f9d1(_0x3f619[_0x8156('0x10')][_0x8156('0x13')]);}logger['error'](_0x8156('0x12'),_0x5e87fa,_0x3f619['error']['message']);return _0x389a78(_0x3f619[_0x8156('0x10')]['message']);}else{logger[_0x8156('0xb')](_0x8156('0x12'),_0x5e87fa,_0x8156('0xc'));_0x389a78(_0x3f619['result'][_0x8156('0x13')]);}})[_0x8156('0x14')](function(_0x7ae8b4){logger[_0x8156('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x5e87fa,_0x7ae8b4);_0x40f9d1(_0x7ae8b4);});});} \ No newline at end of file +var _0x5b20=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','message','info','catch','util','moment'];(function(_0x3abd39,_0x8b97f1){var _0x282596=function(_0x51be2b){while(--_0x51be2b){_0x3abd39['push'](_0x3abd39['shift']());}};_0x282596(++_0x8b97f1);}(_0x5b20,0xd6));var _0x05b2=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5b20[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0x05b2('0x0'));var moment=require(_0x05b2('0x1'));var BPromise=require(_0x05b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x05b2('0x3'));var db=require(_0x05b2('0x4'))['db'];var utils=require(_0x05b2('0x5'));var logger=require('../../config/logger')(_0x05b2('0x6'));var config=require(_0x05b2('0x7'));var jayson=require(_0x05b2('0x8'));var client=jayson['client'][_0x05b2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ad3fd,_0x36d1fd,_0x4fa6f1){return new BPromise(function(_0xb4c414,_0x22c315){return client[_0x05b2('0xa')](_0x1ad3fd,_0x4fa6f1)['then'](function(_0x3dd089){logger['info'](_0x05b2('0xb'),_0x36d1fd,_0x05b2('0xc'));logger[_0x05b2('0xd')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x36d1fd,_0x05b2('0xc'),JSON['stringify'](_0x3dd089));if(_0x3dd089['error']){if(_0x3dd089['error']['code']===0x1f4){logger[_0x05b2('0xe')](_0x05b2('0xb'),_0x36d1fd,_0x3dd089[_0x05b2('0xe')][_0x05b2('0xf')]);return _0x22c315(_0x3dd089[_0x05b2('0xe')][_0x05b2('0xf')]);}logger['error'](_0x05b2('0xb'),_0x36d1fd,_0x3dd089[_0x05b2('0xe')]['message']);return _0xb4c414(_0x3dd089[_0x05b2('0xe')][_0x05b2('0xf')]);}else{logger[_0x05b2('0x10')](_0x05b2('0xb'),_0x36d1fd,_0x05b2('0xc'));_0xb4c414(_0x3dd089['result']['message']);}})[_0x05b2('0x11')](function(_0x462bac){logger[_0x05b2('0xe')](_0x05b2('0xb'),_0x36d1fd,_0x462bac);_0x22c315(_0x462bac);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0eaa93d..5740709 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 _0x115d=['create','put','delete','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x342e86,_0x3bc2a6){var _0x448fd3=function(_0x3af8d4){while(--_0x3af8d4){_0x342e86['push'](_0x342e86['shift']());}};_0x448fd3(++_0x3bc2a6);}(_0x115d,0xf2));var _0xd115=function(_0x48645a,_0x24f23e){_0x48645a=_0x48645a-0x0;var _0xcae99c=_0x115d[_0x48645a];return _0xcae99c;};'use strict';var multer=require(_0xd115('0x0'));var util=require(_0xd115('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd115('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd115('0x3'));var interaction=require(_0xd115('0x4'));var config=require(_0xd115('0x5'));var controller=require('./memberReport.controller');router[_0xd115('0x6')]('/',auth[_0xd115('0x7')](),controller[_0xd115('0x8')]);router['get'](_0xd115('0x9'),auth[_0xd115('0x7')](),controller['describe']);router[_0xd115('0x6')](_0xd115('0xa'),auth[_0xd115('0x7')](),controller[_0xd115('0xb')]);router[_0xd115('0xc')]('/',auth[_0xd115('0x7')](),controller[_0xd115('0xd')]);router[_0xd115('0xe')](_0xd115('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xd115('0xf')](_0xd115('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xd115('0x10')]=router; \ No newline at end of file +var _0x7036=['../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','describe','/:id','isAuthenticated','post','create','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x1a3cc8,_0x242296){var _0x56a503=function(_0x3eb4b4){while(--_0x3eb4b4){_0x1a3cc8['push'](_0x1a3cc8['shift']());}};_0x56a503(++_0x242296);}(_0x7036,0x1c6));var _0x6703=function(_0x31d03c,_0x158cef){_0x31d03c=_0x31d03c-0x0;var _0x420e61=_0x7036[_0x31d03c];return _0x420e61;};'use strict';var multer=require(_0x6703('0x0'));var util=require(_0x6703('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6703('0x2'));var router=express[_0x6703('0x3')]();var fs_extra=require(_0x6703('0x4'));var auth=require(_0x6703('0x5'));var interaction=require(_0x6703('0x6'));var config=require(_0x6703('0x7'));var controller=require(_0x6703('0x8'));router[_0x6703('0x9')]('/',auth['isAuthenticated'](),controller[_0x6703('0xa')]);router[_0x6703('0x9')](_0x6703('0xb'),auth['isAuthenticated'](),controller[_0x6703('0xc')]);router[_0x6703('0x9')](_0x6703('0xd'),auth[_0x6703('0xe')](),controller['show']);router[_0x6703('0xf')]('/',auth[_0x6703('0xe')](),controller[_0x6703('0x10')]);router['put'](_0x6703('0xd'),auth[_0x6703('0xe')](),controller[_0x6703('0x11')]);router[_0x6703('0x12')](_0x6703('0xd'),auth['isAuthenticated'](),controller[_0x6703('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 5b59931..6f7bfbf 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 _0xc29b=['setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','diff','seconds'];(function(_0x403b55,_0x413d8c){var _0x1d0cb0=function(_0x305833){while(--_0x305833){_0x403b55['push'](_0x403b55['shift']());}};_0x1d0cb0(++_0x413d8c);}(_0xc29b,0x157));var _0xbc29=function(_0x25d522,_0x5ede25){_0x25d522=_0x25d522-0x0;var _0x182152=_0xc29b[_0x25d522];return _0x182152;};'use strict';var Sequelize=require(_0xbc29('0x0'));var moment=require(_0xbc29('0x1'));module['exports']={'channel':{'type':Sequelize[_0xbc29('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0xbc29('0x3'),'comment':_0xbc29('0x4')},'duration':{'type':Sequelize[_0xbc29('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xbc29('0x6')],'set':function(_0x2f84cf){var _0x5d64f5=moment(_0x2f84cf);var _0x41fcef=moment(this['getDataValue']('enterAt'));var _0x4fd093=_0x5d64f5[_0xbc29('0x7')](_0x41fcef,_0xbc29('0x8'));this[_0xbc29('0x9')]('exitAt',_0x2f84cf);this[_0xbc29('0x9')](_0xbc29('0xa'),_0x4fd093>=0x0?_0x4fd093:null);}},'data1':{'type':Sequelize[_0xbc29('0x2')],'comment':_0xbc29('0xb')},'data2':{'type':Sequelize[_0xbc29('0x2')],'comment':_0xbc29('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0xbc29('0xd')},'data4':{'type':Sequelize[_0xbc29('0x2')],'comment':_0xbc29('0xe')},'data5':{'type':Sequelize[_0xbc29('0x2')],'comment':_0xbc29('0xf')},'role':{'type':Sequelize[_0xbc29('0x2')]},'internal':{'type':Sequelize[_0xbc29('0x5')]},'uniqueid':{'type':Sequelize[_0xbc29('0x2')]}}; \ No newline at end of file +var _0x2c9e=['setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff'];(function(_0x48789e,_0x2695b0){var _0x3624fc=function(_0xe2178){while(--_0xe2178){_0x48789e['push'](_0x48789e['shift']());}};_0x3624fc(++_0x2695b0);}(_0x2c9e,0x118));var _0xe2c9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2c9e[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xe2c9('0x0')]={'channel':{'type':Sequelize[_0xe2c9('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xe2c9('0x1')]},'type':{'type':Sequelize[_0xe2c9('0x1')],'defaultValue':_0xe2c9('0x2'),'comment':_0xe2c9('0x3')},'duration':{'type':Sequelize[_0xe2c9('0x4')]},'enterAt':{'type':Sequelize[_0xe2c9('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x29e1b9){var _0x59fc7b=moment(_0x29e1b9);var _0x47fc81=moment(this['getDataValue'](_0xe2c9('0x6')));var _0x9d21fd=_0x59fc7b[_0xe2c9('0x7')](_0x47fc81,'seconds');this[_0xe2c9('0x8')](_0xe2c9('0x9'),_0x29e1b9);this[_0xe2c9('0x8')](_0xe2c9('0xa'),_0x9d21fd>=0x0?_0x9d21fd:null);}},'data1':{'type':Sequelize[_0xe2c9('0x1')],'comment':_0xe2c9('0xb')},'data2':{'type':Sequelize[_0xe2c9('0x1')],'comment':_0xe2c9('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0xe2c9('0xd')},'data4':{'type':Sequelize['STRING'],'comment':_0xe2c9('0xe')},'data5':{'type':Sequelize[_0xe2c9('0x1')],'comment':_0xe2c9('0xf')},'role':{'type':Sequelize[_0xe2c9('0x1')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xe2c9('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 94b8e04..0798726 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 _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','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','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x2a37f7,_0x5701a7){var _0x242995=function(_0x1919f4){while(--_0x1919f4){_0x2a37f7['push'](_0x2a37f7['shift']());}};_0x242995(++_0x5701a7);}(_0x7217,0x19e));var _0x7721=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x7217[_0x2576d7];return _0x16a08c;};'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(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x3117ee,_0x1ca036){var _0x1bb4b5=function(_0x1df8c5){while(--_0x1df8c5){_0x3117ee['push'](_0x3117ee['shift']());}};_0x1bb4b5(++_0x1ca036);}(_0x3e74,0x175));var _0x43e7=function(_0x4a4ab4,_0x4c44ef){_0x4a4ab4=_0x4a4ab4-0x0;var _0xf47195=_0x3e74[_0x4a4ab4];return _0xf47195;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 9681ad3..c40b3be 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 _0x8cd4=['bluebird','request-promise','../../config/environment','./memberReport.attributes','exports','define','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment'];(function(_0x5080b3,_0x114445){var _0x257b6a=function(_0x5915fe){while(--_0x5915fe){_0x5080b3['push'](_0x5080b3['shift']());}};_0x257b6a(++_0x114445);}(_0x8cd4,0x175));var _0x48cd=function(_0x56fcdd,_0xd2662f){_0x56fcdd=_0x56fcdd-0x0;var _0xf5674=_0x8cd4[_0x56fcdd];return _0xf5674;};'use strict';var _=require(_0x48cd('0x0'));var util=require(_0x48cd('0x1'));var logger=require(_0x48cd('0x2'))(_0x48cd('0x3'));var moment=require(_0x48cd('0x4'));var BPromise=require(_0x48cd('0x5'));var rp=require(_0x48cd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x48cd('0x7'));var attributes=require(_0x48cd('0x8'));module[_0x48cd('0x9')]=function(_0x4b622f,_0x1aaf8e){return _0x4b622f[_0x48cd('0xa')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x48cd('0xb'),'fields':[_0x48cd('0xc'),_0x48cd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3832=['api','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','define','MemberReport','membername_interface','membername','interface','lodash','util','../../config/logger'];(function(_0x19f38f,_0x10c3a0){var _0x1f4e4e=function(_0xd5de68){while(--_0xd5de68){_0x19f38f['push'](_0x19f38f['shift']());}};_0x1f4e4e(++_0x10c3a0);}(_0x3832,0x9d));var _0x2383=function(_0xea3feb,_0x29a19d){_0xea3feb=_0xea3feb-0x0;var _0x4871c2=_0x3832[_0xea3feb];return _0x4871c2;};'use strict';var _=require(_0x2383('0x0'));var util=require(_0x2383('0x1'));var logger=require(_0x2383('0x2'))(_0x2383('0x3'));var moment=require(_0x2383('0x4'));var BPromise=require(_0x2383('0x5'));var rp=require(_0x2383('0x6'));var fs=require('fs');var path=require(_0x2383('0x7'));var rimraf=require('rimraf');var config=require(_0x2383('0x8'));var attributes=require(_0x2383('0x9'));module[_0x2383('0xa')]=function(_0x51001c,_0xb1dc6c){return _0x51001c[_0x2383('0xb')](_0x2383('0xc'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x2383('0xd'),'fields':[_0x2383('0xe'),_0x2383('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index a8d51b2..ecb7536 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 _0xbd36=['error','code','MemberReport,\x20%s,\x20%s','message','result','catch','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','GetMemberReport','create','then','CreateMemberReport','UpdateMemberReport','update','body','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbd36,0x65));var _0x6bd3=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xbd36[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x6bd3('0x0'));var util=require(_0x6bd3('0x1'));var moment=require(_0x6bd3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bd3('0x3'));var db=require(_0x6bd3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bd3('0x5'))(_0x6bd3('0x6'));var config=require(_0x6bd3('0x7'));var jayson=require(_0x6bd3('0x8'));var client=jayson['client'][_0x6bd3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x173035,_0x221ec0,_0x1b4148){return new BPromise(function(_0x1b2946,_0x3db900){return client[_0x6bd3('0xa')](_0x173035,_0x1b4148)['then'](function(_0x516c47){logger[_0x6bd3('0xb')]('MemberReport,\x20%s,\x20%s',_0x221ec0,_0x6bd3('0xc'));logger[_0x6bd3('0xd')](_0x6bd3('0xe'),_0x221ec0,_0x6bd3('0xc'),JSON[_0x6bd3('0xf')](_0x516c47));if(_0x516c47['error']){if(_0x516c47[_0x6bd3('0x10')][_0x6bd3('0x11')]===0x1f4){logger['error'](_0x6bd3('0x12'),_0x221ec0,_0x516c47[_0x6bd3('0x10')][_0x6bd3('0x13')]);return _0x3db900(_0x516c47[_0x6bd3('0x10')][_0x6bd3('0x13')]);}logger[_0x6bd3('0x10')](_0x6bd3('0x12'),_0x221ec0,_0x516c47[_0x6bd3('0x10')]['message']);return _0x1b2946(_0x516c47[_0x6bd3('0x10')][_0x6bd3('0x13')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x221ec0,'request\x20sent');_0x1b2946(_0x516c47[_0x6bd3('0x14')]['message']);}})[_0x6bd3('0x15')](function(_0x3aa000){logger[_0x6bd3('0x10')](_0x6bd3('0x12'),_0x221ec0,_0x3aa000);_0x3db900(_0x3aa000);});});}exports['GetMemberReport']=function(_0x573656){var _0xa72c2d=this;return new Promise(function(_0x769de8,_0xf0f85a){return db[_0x6bd3('0x16')][_0x6bd3('0x17')]({'raw':_0x573656[_0x6bd3('0x18')]?_0x573656[_0x6bd3('0x18')][_0x6bd3('0x19')]===undefined?!![]:![]:!![],'where':_0x573656[_0x6bd3('0x18')]?_0x573656[_0x6bd3('0x18')][_0x6bd3('0x1a')]||null:null,'attributes':_0x573656[_0x6bd3('0x18')]?_0x573656[_0x6bd3('0x18')][_0x6bd3('0x1b')]||null:null,'limit':_0x573656[_0x6bd3('0x18')]?_0x573656[_0x6bd3('0x18')][_0x6bd3('0x1c')]||null:null,'include':_0x573656[_0x6bd3('0x18')]?_0x573656[_0x6bd3('0x18')][_0x6bd3('0x1d')]?_['map'](_0x573656[_0x6bd3('0x18')][_0x6bd3('0x1d')],function(_0x28b9a9){return{'model':db[_0x28b9a9['model']],'as':_0x28b9a9['as'],'attributes':_0x28b9a9[_0x6bd3('0x1b')],'include':_0x28b9a9[_0x6bd3('0x1d')]?_[_0x6bd3('0x1e')](_0x28b9a9[_0x6bd3('0x1d')],function(_0xa8c894){return{'model':db[_0xa8c894[_0x6bd3('0x1f')]],'as':_0xa8c894['as'],'attributes':_0xa8c894[_0x6bd3('0x1b')],'include':_0xa8c894[_0x6bd3('0x1d')]?_['map'](_0xa8c894[_0x6bd3('0x1d')],function(_0x585f4e){return{'model':db[_0x585f4e[_0x6bd3('0x1f')]],'as':_0x585f4e['as'],'attributes':_0x585f4e[_0x6bd3('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26ffc5){logger[_0x6bd3('0xb')](_0x6bd3('0x20'),_0x573656);logger[_0x6bd3('0xd')](_0x6bd3('0x20'),_0x573656,JSON[_0x6bd3('0xf')](_0x26ffc5));_0x769de8(_0x26ffc5);})[_0x6bd3('0x15')](function(_0x552628){logger[_0x6bd3('0x10')](_0x6bd3('0x20'),_0x552628[_0x6bd3('0x13')],_0x573656);_0xf0f85a(_0xa72c2d[_0x6bd3('0x10')](0x1f4,_0x552628['message']));});});};exports['CreateMemberReport']=function(_0x5e65b7){var _0x418281=this;return new Promise(function(_0xf10a80,_0x5f0883){return db[_0x6bd3('0x16')][_0x6bd3('0x21')](_0x5e65b7['body'],{'raw':_0x5e65b7[_0x6bd3('0x18')]?_0x5e65b7[_0x6bd3('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x6bd3('0x22')](function(_0x283cb4){logger[_0x6bd3('0xb')]('CreateMemberReport',_0x5e65b7);logger[_0x6bd3('0xd')](_0x6bd3('0x23'),_0x5e65b7,JSON['stringify'](_0x283cb4));_0xf10a80(_0x283cb4);})[_0x6bd3('0x15')](function(_0x4fc175){logger[_0x6bd3('0x10')](_0x6bd3('0x23'),_0x4fc175[_0x6bd3('0x13')],_0x5e65b7);_0x5f0883(_0x418281[_0x6bd3('0x10')](0x1f4,_0x4fc175[_0x6bd3('0x13')]));});});};exports[_0x6bd3('0x24')]=function(_0x1ea2ef){var _0x5cffdb=this;return new Promise(function(_0x1261a7,_0x32b844){return db[_0x6bd3('0x16')][_0x6bd3('0x25')](_0x1ea2ef[_0x6bd3('0x26')],{'raw':_0x1ea2ef[_0x6bd3('0x18')]?_0x1ea2ef[_0x6bd3('0x18')][_0x6bd3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ea2ef[_0x6bd3('0x18')]?_0x1ea2ef[_0x6bd3('0x18')][_0x6bd3('0x1a')]||null:null,'attributes':_0x1ea2ef['options']?_0x1ea2ef['options'][_0x6bd3('0x1b')]||null:null,'limit':_0x1ea2ef[_0x6bd3('0x18')]?_0x1ea2ef[_0x6bd3('0x18')][_0x6bd3('0x1c')]||null:null})['then'](function(_0x30c3bb){logger['info'](_0x6bd3('0x24'),_0x1ea2ef);logger[_0x6bd3('0xd')]('UpdateMemberReport',_0x1ea2ef,JSON[_0x6bd3('0xf')](_0x30c3bb));_0x1261a7(_0x30c3bb);})[_0x6bd3('0x15')](function(_0x30d29a){logger[_0x6bd3('0x10')](_0x6bd3('0x24'),_0x30d29a['message'],_0x1ea2ef);_0x32b844(_0x5cffdb[_0x6bd3('0x10')](0x1f4,_0x30d29a[_0x6bd3('0x13')]));});});}; \ No newline at end of file +var _0x7046=['where','attributes','include','map','model','then','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','findAll','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7046,0x144));var _0x6704=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7046[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var moment=require(_0x6704('0x2'));var BPromise=require(_0x6704('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6704('0x4'));var db=require(_0x6704('0x5'))['db'];var utils=require(_0x6704('0x6'));var logger=require('../../config/logger')(_0x6704('0x7'));var config=require(_0x6704('0x8'));var jayson=require(_0x6704('0x9'));var client=jayson[_0x6704('0xa')][_0x6704('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4badf8,_0x5ced8,_0x49b8b6){return new BPromise(function(_0x56b1ff,_0x390ace){return client['request'](_0x4badf8,_0x49b8b6)['then'](function(_0x3ca599){logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,_0x6704('0xe'));logger[_0x6704('0xf')](_0x6704('0x10'),_0x5ced8,_0x6704('0xe'),JSON[_0x6704('0x11')](_0x3ca599));if(_0x3ca599['error']){if(_0x3ca599[_0x6704('0x12')][_0x6704('0x13')]===0x1f4){logger['error'](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x390ace(_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);}logger[_0x6704('0x12')](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x56b1ff(_0x3ca599['error'][_0x6704('0x14')]);}else{logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,'request\x20sent');_0x56b1ff(_0x3ca599[_0x6704('0x15')][_0x6704('0x14')]);}})[_0x6704('0x16')](function(_0x29fa46){logger[_0x6704('0x12')]('MemberReport,\x20%s,\x20%s',_0x5ced8,_0x29fa46);_0x390ace(_0x29fa46);});});}exports[_0x6704('0x17')]=function(_0x31d732){var _0x135f4b=this;return new Promise(function(_0xe49450,_0x344ed9){return db['MemberReport'][_0x6704('0x18')]({'raw':_0x31d732[_0x6704('0x19')]?_0x31d732[_0x6704('0x19')][_0x6704('0x1a')]===undefined?!![]:![]:!![],'where':_0x31d732[_0x6704('0x19')]?_0x31d732[_0x6704('0x19')][_0x6704('0x1b')]||null:null,'attributes':_0x31d732['options']?_0x31d732[_0x6704('0x19')][_0x6704('0x1c')]||null:null,'limit':_0x31d732[_0x6704('0x19')]?_0x31d732['options']['limit']||null:null,'include':_0x31d732[_0x6704('0x19')]?_0x31d732[_0x6704('0x19')][_0x6704('0x1d')]?_[_0x6704('0x1e')](_0x31d732[_0x6704('0x19')]['include'],function(_0xf2c459){return{'model':db[_0xf2c459[_0x6704('0x1f')]],'as':_0xf2c459['as'],'attributes':_0xf2c459[_0x6704('0x1c')],'include':_0xf2c459[_0x6704('0x1d')]?_[_0x6704('0x1e')](_0xf2c459[_0x6704('0x1d')],function(_0x2acafd){return{'model':db[_0x2acafd[_0x6704('0x1f')]],'as':_0x2acafd['as'],'attributes':_0x2acafd[_0x6704('0x1c')],'include':_0x2acafd[_0x6704('0x1d')]?_[_0x6704('0x1e')](_0x2acafd[_0x6704('0x1d')],function(_0x118d93){return{'model':db[_0x118d93['model']],'as':_0x118d93['as'],'attributes':_0x118d93['attributes']};}):[]};}):[]};}):[]:[]})[_0x6704('0x20')](function(_0xf875dc){logger[_0x6704('0xc')](_0x6704('0x17'),_0x31d732);logger['debug'](_0x6704('0x17'),_0x31d732,JSON[_0x6704('0x11')](_0xf875dc));_0xe49450(_0xf875dc);})['catch'](function(_0x588814){logger[_0x6704('0x12')]('GetMemberReport',_0x588814[_0x6704('0x14')],_0x31d732);_0x344ed9(_0x135f4b['error'](0x1f4,_0x588814['message']));});});};exports[_0x6704('0x21')]=function(_0x115514){var _0x45a286=this;return new Promise(function(_0x4ffa53,_0x1c7132){return db[_0x6704('0x22')][_0x6704('0x23')](_0x115514[_0x6704('0x24')],{'raw':_0x115514[_0x6704('0x19')]?_0x115514[_0x6704('0x19')][_0x6704('0x1a')]===undefined?!![]:![]:!![]})[_0x6704('0x20')](function(_0x1197e0){logger[_0x6704('0xc')](_0x6704('0x21'),_0x115514);logger[_0x6704('0xf')](_0x6704('0x21'),_0x115514,JSON[_0x6704('0x11')](_0x1197e0));_0x4ffa53(_0x1197e0);})[_0x6704('0x16')](function(_0x839300){logger[_0x6704('0x12')](_0x6704('0x21'),_0x839300[_0x6704('0x14')],_0x115514);_0x1c7132(_0x45a286[_0x6704('0x12')](0x1f4,_0x839300[_0x6704('0x14')]));});});};exports[_0x6704('0x25')]=function(_0x12ba0d){var _0x12a3b2=this;return new Promise(function(_0x30b914,_0x4bdb7c){return db['MemberReport']['update'](_0x12ba0d[_0x6704('0x24')],{'raw':_0x12ba0d[_0x6704('0x19')]?_0x12ba0d[_0x6704('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12ba0d[_0x6704('0x19')]?_0x12ba0d['options'][_0x6704('0x1b')]||null:null,'attributes':_0x12ba0d[_0x6704('0x19')]?_0x12ba0d[_0x6704('0x19')][_0x6704('0x1c')]||null:null,'limit':_0x12ba0d[_0x6704('0x19')]?_0x12ba0d[_0x6704('0x19')][_0x6704('0x26')]||null:null})[_0x6704('0x20')](function(_0x590ada){logger['info'](_0x6704('0x25'),_0x12ba0d);logger[_0x6704('0xf')]('UpdateMemberReport',_0x12ba0d,JSON['stringify'](_0x590ada));_0x30b914(_0x590ada);})[_0x6704('0x16')](function(_0x58d888){logger[_0x6704('0x12')](_0x6704('0x25'),_0x58d888[_0x6704('0x14')],_0x12ba0d);_0x4bdb7c(_0x12a3b2[_0x6704('0x12')](0x1f4,_0x58d888['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 27be4b9..e8916da 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 _0x34e7=['fs-extra','../../components/auth/service','../../config/environment','./migration.controller','index','exports','util','connect-timeout','express','Router'];(function(_0x58be19,_0x1212a1){var _0x8fe5c=function(_0x16c075){while(--_0x16c075){_0x58be19['push'](_0x58be19['shift']());}};_0x8fe5c(++_0x1212a1);}(_0x34e7,0x1be));var _0x734e=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0x34e7[_0x5180c3];return _0x55c975;};'use strict';var multer=require('multer');var util=require(_0x734e('0x0'));var path=require('path');var timeout=require(_0x734e('0x1'));var express=require(_0x734e('0x2'));var router=express[_0x734e('0x3')]();var fs_extra=require(_0x734e('0x4'));var auth=require(_0x734e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x734e('0x6'));var controller=require(_0x734e('0x7'));router['get']('/',controller[_0x734e('0x8')]);module[_0x734e('0x9')]=router; \ No newline at end of file +var _0x70e2=['../../components/interaction/service','../../config/environment','./migration.controller','get','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2a25ea,_0x54b174){var _0x2ac630=function(_0x31bd16){while(--_0x31bd16){_0x2a25ea['push'](_0x2a25ea['shift']());}};_0x2ac630(++_0x54b174);}(_0x70e2,0x119));var _0x270e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x70e2[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x270e('0x0'));var util=require(_0x270e('0x1'));var path=require(_0x270e('0x2'));var timeout=require(_0x270e('0x3'));var express=require(_0x270e('0x4'));var router=express[_0x270e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x270e('0x6'));var interaction=require(_0x270e('0x7'));var config=require(_0x270e('0x8'));var controller=require(_0x270e('0x9'));router[_0x270e('0xa')]('/',controller['index']);module[_0x270e('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 330eb6b..e5462ec 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 _0xea3d=['exports','STRING','version'];(function(_0x256900,_0x4b2a01){var _0x2da024=function(_0x482a70){while(--_0x482a70){_0x256900['push'](_0x256900['shift']());}};_0x2da024(++_0x4b2a01);}(_0xea3d,0x1ef));var _0xdea3=function(_0x2b984a,_0x5c91c1){_0x2b984a=_0x2b984a-0x0;var _0x3df994=_0xea3d[_0x2b984a];return _0x3df994;};'use strict';var Sequelize=require('sequelize');module[_0xdea3('0x0')]={'version':{'type':Sequelize[_0xdea3('0x1')],'unique':_0xdea3('0x2')}}; \ No newline at end of file +var _0xfbc6=['exports','version','sequelize'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xfbc6,0xb9));var _0x6fbc=function(_0x2b57fc,_0x4b3658){_0x2b57fc=_0x2b57fc-0x0;var _0x5bf238=_0xfbc6[_0x2b57fc];return _0x5bf238;};'use strict';var Sequelize=require(_0x6fbc('0x0'));module[_0x6fbc('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x6fbc('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 852bb7f..a29dd8a 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 _0x4c58=['error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','options','rows','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then'];(function(_0x5e838c,_0x3e7ada){var _0x2efd28=function(_0x14920a){while(--_0x14920a){_0x5e838c['push'](_0x5e838c['shift']());}};_0x2efd28(++_0x3e7ada);}(_0x4c58,0x18f));var _0x84c5=function(_0x2af49f,_0x1b8fce){_0x2af49f=_0x2af49f-0x0;var _0xd0bed0=_0x4c58[_0x2af49f];return _0xd0bed0;};'use strict';var emlformat=require(_0x84c5('0x0'));var rimraf=require(_0x84c5('0x1'));var zipdir=require(_0x84c5('0x2'));var jsonpatch=require(_0x84c5('0x3'));var rp=require('request-promise');var moment=require(_0x84c5('0x4'));var BPromise=require(_0x84c5('0x5'));var Mustache=require(_0x84c5('0x6'));var util=require(_0x84c5('0x7'));var path=require(_0x84c5('0x8'));var sox=require(_0x84c5('0x9'));var csv=require(_0x84c5('0xa'));var ejs=require(_0x84c5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x84c5('0xc'));var crypto=require(_0x84c5('0xd'));var jsforce=require(_0x84c5('0xe'));var deskjs=require(_0x84c5('0xf'));var toCsv=require(_0x84c5('0xa'));var querystring=require(_0x84c5('0x10'));var Papa=require('papaparse');var Redis=require(_0x84c5('0x11'));var authService=require(_0x84c5('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x84c5('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84c5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35e1d5,_0x5173df){_0x5173df=_0x5173df||0xcc;return function(_0x2ef936){if(_0x2ef936){return _0x35e1d5[_0x84c5('0x15')](_0x5173df);}return _0x35e1d5['status'](_0x5173df)[_0x84c5('0x16')]();};}function respondWithResult(_0x4d3b9d,_0x13bc92){_0x13bc92=_0x13bc92||0xc8;return function(_0x3852a9){if(_0x3852a9){return _0x4d3b9d[_0x84c5('0x17')](_0x13bc92)[_0x84c5('0x18')](_0x3852a9);}};}function respondWithFilteredResult(_0x38bd92,_0x5c01a3){return function(_0x45e0ff){if(_0x45e0ff){var _0x413696=typeof _0x5c01a3[_0x84c5('0x19')]==='undefined'&&typeof _0x5c01a3['limit']===_0x84c5('0x1a');var _0x5add5=_0x45e0ff[_0x84c5('0x1b')];var _0x21480a=_0x413696?0x0:_0x5c01a3[_0x84c5('0x19')];var _0x41c5e9=_0x413696?_0x45e0ff['count']:_0x5c01a3[_0x84c5('0x19')]+_0x5c01a3[_0x84c5('0x1c')];var _0x150bc1;if(_0x41c5e9>=_0x5add5){_0x41c5e9=_0x5add5;_0x150bc1=0xc8;}else{_0x150bc1=0xce;}_0x38bd92[_0x84c5('0x17')](_0x150bc1);return _0x38bd92[_0x84c5('0x1d')]('Content-Range',_0x21480a+'-'+_0x41c5e9+'/'+_0x5add5)[_0x84c5('0x18')](_0x45e0ff);}return null;};}function patchUpdates(_0x1492a4){return function(_0x2632b5){try{jsonpatch[_0x84c5('0x1e')](_0x2632b5,_0x1492a4,!![]);}catch(_0x38d5c9){return BPromise[_0x84c5('0x1f')](_0x38d5c9);}return _0x2632b5[_0x84c5('0x20')]();};}function saveUpdates(_0x17770b,_0x55320a){return function(_0x51b8e2){if(_0x51b8e2){return _0x51b8e2[_0x84c5('0x21')](_0x17770b)[_0x84c5('0x22')](function(_0x24d753){return _0x24d753;});}return null;};}function removeEntity(_0x43803c,_0x31c2e2){return function(_0x4cc7ef){if(_0x4cc7ef){return _0x4cc7ef['destroy']()['then'](function(){_0x43803c[_0x84c5('0x17')](0xcc)[_0x84c5('0x16')]();});}};}function handleEntityNotFound(_0x37f1f6,_0x5172bb){return function(_0x4ad894){if(!_0x4ad894){_0x37f1f6['sendStatus'](0x194);}return _0x4ad894;};}function handleError(_0xeab366,_0x2fefac){_0x2fefac=_0x2fefac||0x1f4;return function(_0x556d37){logger[_0x84c5('0x23')](_0x556d37[_0x84c5('0x24')]);if(_0x556d37[_0x84c5('0x25')]){delete _0x556d37[_0x84c5('0x25')];}_0xeab366[_0x84c5('0x17')](_0x2fefac)[_0x84c5('0x26')](_0x556d37);};}exports[_0x84c5('0x27')]=function(_0x414239,_0x256034){var _0x453647={},_0x4a206e={},_0x140c33={'count':0x0,'rows':[]};var _0x2582be=_[_0x84c5('0x28')](db[_0x84c5('0x29')][_0x84c5('0x2a')],function(_0x5d6f3e){return{'name':_0x5d6f3e[_0x84c5('0x2b')],'type':_0x5d6f3e[_0x84c5('0x2c')][_0x84c5('0x2d')]};});_0x4a206e[_0x84c5('0x2e')]=_[_0x84c5('0x28')](_0x2582be,_0x84c5('0x25'));_0x4a206e['query']=_[_0x84c5('0x2f')](_0x414239[_0x84c5('0x30')]);_0x4a206e['filters']=_[_0x84c5('0x31')](_0x4a206e['model'],_0x4a206e[_0x84c5('0x30')]);_0x453647[_0x84c5('0x32')]=_[_0x84c5('0x31')](_0x4a206e[_0x84c5('0x2e')],qs[_0x84c5('0x33')](_0x414239[_0x84c5('0x30')]['fields']));_0x453647[_0x84c5('0x32')]=_0x453647[_0x84c5('0x32')][_0x84c5('0x34')]?_0x453647[_0x84c5('0x32')]:_0x4a206e[_0x84c5('0x2e')];if(!_0x414239['query'][_0x84c5('0x35')](_0x84c5('0x36'))){_0x453647['limit']=qs[_0x84c5('0x1c')](_0x414239[_0x84c5('0x30')][_0x84c5('0x1c')]);_0x453647[_0x84c5('0x19')]=qs[_0x84c5('0x19')](_0x414239[_0x84c5('0x30')][_0x84c5('0x19')]);}_0x453647[_0x84c5('0x37')]=qs['sort'](_0x414239[_0x84c5('0x30')][_0x84c5('0x38')]);_0x453647[_0x84c5('0x39')]=qs[_0x84c5('0x3a')](_['pick'](_0x414239[_0x84c5('0x30')],_0x4a206e[_0x84c5('0x3a')]),_0x2582be);if(_0x414239[_0x84c5('0x30')]['filter']){_0x453647[_0x84c5('0x39')]=_[_0x84c5('0x3b')](_0x453647['where'],{'$or':_[_0x84c5('0x28')](_0x2582be,function(_0x35bc72){if(_0x35bc72[_0x84c5('0x2c')]!=='VIRTUAL'){var _0xc14e25={};_0xc14e25[_0x35bc72[_0x84c5('0x25')]]={'$like':'%'+_0x414239['query']['filter']+'%'};return _0xc14e25;}})});}_0x453647=_[_0x84c5('0x3b')]({},_0x453647,_0x414239[_0x84c5('0x3c')]);var _0x2bdfc6={'where':_0x453647[_0x84c5('0x39')]};return db['Migration'][_0x84c5('0x1b')](_0x2bdfc6)[_0x84c5('0x22')](function(_0x3f897f){_0x140c33[_0x84c5('0x1b')]=_0x3f897f;if(_0x414239[_0x84c5('0x30')]['includeAll']){_0x453647['include']=[{'all':!![]}];}return db[_0x84c5('0x29')]['findAll'](_0x453647);})[_0x84c5('0x22')](function(_0x1cda3e){_0x140c33[_0x84c5('0x3d')]=_0x1cda3e;return _0x140c33;})['then'](respondWithFilteredResult(_0x256034,_0x453647))['catch'](handleError(_0x256034,null));}; \ No newline at end of file +var _0xf795=['nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','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','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','Migration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x555aa4,_0x6d3e2e){var _0x278c16=function(_0x16a5c3){while(--_0x16a5c3){_0x555aa4['push'](_0x555aa4['shift']());}};_0x278c16(++_0x6d3e2e);}(_0xf795,0x166));var _0x5f79=function(_0x3bb7df,_0x1b5d3a){_0x3bb7df=_0x3bb7df-0x0;var _0xb10d46=_0xf795[_0x3bb7df];return _0xb10d46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f79('0x0'));var zipdir=require(_0x5f79('0x1'));var jsonpatch=require(_0x5f79('0x2'));var rp=require(_0x5f79('0x3'));var moment=require(_0x5f79('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5f79('0x5'));var util=require('util');var path=require(_0x5f79('0x6'));var sox=require(_0x5f79('0x7'));var csv=require(_0x5f79('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f79('0x9'));var _=require(_0x5f79('0xa'));var squel=require(_0x5f79('0xb'));var crypto=require(_0x5f79('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5f79('0x8'));var querystring=require(_0x5f79('0xd'));var Papa=require('papaparse');var Redis=require(_0x5f79('0xe'));var authService=require(_0x5f79('0xf'));var qs=require(_0x5f79('0x10'));var as=require(_0x5f79('0x11'));var hardwareService=require(_0x5f79('0x12'));var logger=require(_0x5f79('0x13'))(_0x5f79('0x14'));var utils=require(_0x5f79('0x15'));var config=require(_0x5f79('0x16'));var licenseUtil=require(_0x5f79('0x17'));var db=require(_0x5f79('0x18'))['db'];function respondWithStatusCode(_0x4a2af2,_0x773cf0){_0x773cf0=_0x773cf0||0xcc;return function(_0x434e56){if(_0x434e56){return _0x4a2af2[_0x5f79('0x19')](_0x773cf0);}return _0x4a2af2[_0x5f79('0x1a')](_0x773cf0)[_0x5f79('0x1b')]();};}function respondWithResult(_0x1a59d7,_0x2252a4){_0x2252a4=_0x2252a4||0xc8;return function(_0x322957){if(_0x322957){return _0x1a59d7[_0x5f79('0x1a')](_0x2252a4)[_0x5f79('0x1c')](_0x322957);}};}function respondWithFilteredResult(_0x763f1c,_0x1645f2){return function(_0x41a587){if(_0x41a587){var _0x337555=typeof _0x1645f2[_0x5f79('0x1d')]===_0x5f79('0x1e')&&typeof _0x1645f2['limit']===_0x5f79('0x1e');var _0x2333d6=_0x41a587[_0x5f79('0x1f')];var _0x38df58=_0x337555?0x0:_0x1645f2[_0x5f79('0x1d')];var _0x555358=_0x337555?_0x41a587[_0x5f79('0x1f')]:_0x1645f2[_0x5f79('0x1d')]+_0x1645f2[_0x5f79('0x20')];var _0x2fd981;if(_0x555358>=_0x2333d6){_0x555358=_0x2333d6;_0x2fd981=0xc8;}else{_0x2fd981=0xce;}_0x763f1c[_0x5f79('0x1a')](_0x2fd981);return _0x763f1c['set'](_0x5f79('0x21'),_0x38df58+'-'+_0x555358+'/'+_0x2333d6)[_0x5f79('0x1c')](_0x41a587);}return null;};}function patchUpdates(_0x7d6c67){return function(_0x2eec7a){try{jsonpatch[_0x5f79('0x22')](_0x2eec7a,_0x7d6c67,!![]);}catch(_0x1e2609){return BPromise[_0x5f79('0x23')](_0x1e2609);}return _0x2eec7a[_0x5f79('0x24')]();};}function saveUpdates(_0x23588d,_0xad7019){return function(_0x83362e){if(_0x83362e){return _0x83362e[_0x5f79('0x25')](_0x23588d)['then'](function(_0xfbf3a0){return _0xfbf3a0;});}return null;};}function removeEntity(_0x1cb87a,_0x654d03){return function(_0x576ef0){if(_0x576ef0){return _0x576ef0[_0x5f79('0x26')]()[_0x5f79('0x27')](function(){_0x1cb87a[_0x5f79('0x1a')](0xcc)[_0x5f79('0x1b')]();});}};}function handleEntityNotFound(_0x24e899,_0x516028){return function(_0x2d2347){if(!_0x2d2347){_0x24e899['sendStatus'](0x194);}return _0x2d2347;};}function handleError(_0x5c1360,_0x4f1e27){_0x4f1e27=_0x4f1e27||0x1f4;return function(_0x94af11){logger['error'](_0x94af11[_0x5f79('0x28')]);if(_0x94af11[_0x5f79('0x29')]){delete _0x94af11['name'];}_0x5c1360[_0x5f79('0x1a')](_0x4f1e27)[_0x5f79('0x2a')](_0x94af11);};}exports[_0x5f79('0x2b')]=function(_0x3bc916,_0x19153a){var _0x389ea7={},_0x428398={},_0x5c5d8f={'count':0x0,'rows':[]};var _0x58e065=_[_0x5f79('0x2c')](db[_0x5f79('0x2d')][_0x5f79('0x2e')],function(_0x12fc23){return{'name':_0x12fc23['fieldName'],'type':_0x12fc23[_0x5f79('0x2f')]['key']};});_0x428398[_0x5f79('0x30')]=_[_0x5f79('0x2c')](_0x58e065,_0x5f79('0x29'));_0x428398[_0x5f79('0x31')]=_[_0x5f79('0x32')](_0x3bc916[_0x5f79('0x31')]);_0x428398[_0x5f79('0x33')]=_[_0x5f79('0x34')](_0x428398[_0x5f79('0x30')],_0x428398[_0x5f79('0x31')]);_0x389ea7[_0x5f79('0x35')]=_['intersection'](_0x428398[_0x5f79('0x30')],qs[_0x5f79('0x36')](_0x3bc916[_0x5f79('0x31')][_0x5f79('0x36')]));_0x389ea7[_0x5f79('0x35')]=_0x389ea7[_0x5f79('0x35')][_0x5f79('0x37')]?_0x389ea7[_0x5f79('0x35')]:_0x428398['model'];if(!_0x3bc916[_0x5f79('0x31')]['hasOwnProperty'](_0x5f79('0x38'))){_0x389ea7['limit']=qs[_0x5f79('0x20')](_0x3bc916['query']['limit']);_0x389ea7[_0x5f79('0x1d')]=qs[_0x5f79('0x1d')](_0x3bc916[_0x5f79('0x31')][_0x5f79('0x1d')]);}_0x389ea7['order']=qs[_0x5f79('0x39')](_0x3bc916[_0x5f79('0x31')][_0x5f79('0x39')]);_0x389ea7[_0x5f79('0x3a')]=qs[_0x5f79('0x33')](_[_0x5f79('0x3b')](_0x3bc916[_0x5f79('0x31')],_0x428398[_0x5f79('0x33')]),_0x58e065);if(_0x3bc916[_0x5f79('0x31')][_0x5f79('0x3c')]){_0x389ea7[_0x5f79('0x3a')]=_[_0x5f79('0x3d')](_0x389ea7[_0x5f79('0x3a')],{'$or':_[_0x5f79('0x2c')](_0x58e065,function(_0x19be24){if(_0x19be24[_0x5f79('0x2f')]!==_0x5f79('0x3e')){var _0x5962b6={};_0x5962b6[_0x19be24[_0x5f79('0x29')]]={'$like':'%'+_0x3bc916[_0x5f79('0x31')][_0x5f79('0x3c')]+'%'};return _0x5962b6;}})});}_0x389ea7=_[_0x5f79('0x3d')]({},_0x389ea7,_0x3bc916[_0x5f79('0x3f')]);var _0x4a7135={'where':_0x389ea7['where']};return db[_0x5f79('0x2d')]['count'](_0x4a7135)[_0x5f79('0x27')](function(_0x29c435){_0x5c5d8f[_0x5f79('0x1f')]=_0x29c435;if(_0x3bc916['query'][_0x5f79('0x40')]){_0x389ea7[_0x5f79('0x41')]=[{'all':!![]}];}return db[_0x5f79('0x2d')][_0x5f79('0x42')](_0x389ea7);})[_0x5f79('0x27')](function(_0x3ccdfa){_0x5c5d8f[_0x5f79('0x43')]=_0x3ccdfa;return _0x5c5d8f;})[_0x5f79('0x27')](respondWithFilteredResult(_0x19153a,_0x389ea7))[_0x5f79('0x44')](handleError(_0x19153a,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index dfdc7bd..f00a537 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 _0xbb5d=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','Migration','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb5d,0x16a));var _0xdbb5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbb5d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xdbb5('0x0'));var util=require(_0xdbb5('0x1'));var logger=require(_0xdbb5('0x2'))('api');var moment=require(_0xdbb5('0x3'));var BPromise=require(_0xdbb5('0x4'));var rp=require(_0xdbb5('0x5'));var fs=require('fs');var path=require(_0xdbb5('0x6'));var rimraf=require(_0xdbb5('0x7'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0xdbb5('0x8')]=function(_0x3405bc,_0x42957b){return _0x3405bc[_0xdbb5('0x9')](_0xdbb5('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dfc=['migrations','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','Migration'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0x1dfc,0x1b9));var _0xc1df=function(_0x434f1a,_0x4bc8a6){_0x434f1a=_0x434f1a-0x0;var _0x39a1c9=_0x1dfc[_0x434f1a];return _0x39a1c9;};'use strict';var _=require(_0xc1df('0x0'));var util=require(_0xc1df('0x1'));var logger=require(_0xc1df('0x2'))(_0xc1df('0x3'));var moment=require(_0xc1df('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc1df('0x5'));var rimraf=require(_0xc1df('0x6'));var config=require(_0xc1df('0x7'));var attributes=require('./migration.attributes');module[_0xc1df('0x8')]=function(_0x16c633,_0x5351b8){return _0x16c633['define'](_0xc1df('0x9'),attributes,{'tableName':_0xc1df('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index d46389b..43c8c59 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 _0x57f8=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x9fe868,_0x3a4be6){var _0xec0c6e=function(_0x4da506){while(--_0x4da506){_0x9fe868['push'](_0x9fe868['shift']());}};_0xec0c6e(++_0x3a4be6);}(_0x57f8,0x198));var _0x857f=function(_0x5a001d,_0x591f45){_0x5a001d=_0x5a001d-0x0;var _0x3d0a81=_0x57f8[_0x5a001d];return _0x3d0a81;};'use strict';var _=require('lodash');var util=require(_0x857f('0x0'));var moment=require(_0x857f('0x1'));var BPromise=require(_0x857f('0x2'));var rs=require(_0x857f('0x3'));var fs=require('fs');var Redis=require(_0x857f('0x4'));var db=require(_0x857f('0x5'))['db'];var utils=require(_0x857f('0x6'));var logger=require(_0x857f('0x7'))(_0x857f('0x8'));var config=require(_0x857f('0x9'));var jayson=require(_0x857f('0xa'));var client=jayson[_0x857f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8380e8,_0x197098,_0x1aaeea){return new BPromise(function(_0x577fc3,_0x5f6a66){return client[_0x857f('0xc')](_0x8380e8,_0x1aaeea)[_0x857f('0xd')](function(_0x4f2b09){logger[_0x857f('0xe')](_0x857f('0xf'),_0x197098,_0x857f('0x10'));logger['debug'](_0x857f('0x11'),_0x197098,_0x857f('0x10'),JSON[_0x857f('0x12')](_0x4f2b09));if(_0x4f2b09[_0x857f('0x13')]){if(_0x4f2b09[_0x857f('0x13')][_0x857f('0x14')]===0x1f4){logger[_0x857f('0x13')]('Migration,\x20%s,\x20%s',_0x197098,_0x4f2b09[_0x857f('0x13')][_0x857f('0x15')]);return _0x5f6a66(_0x4f2b09[_0x857f('0x13')][_0x857f('0x15')]);}logger[_0x857f('0x13')]('Migration,\x20%s,\x20%s',_0x197098,_0x4f2b09['error'][_0x857f('0x15')]);return _0x577fc3(_0x4f2b09['error'][_0x857f('0x15')]);}else{logger['info'](_0x857f('0xf'),_0x197098,_0x857f('0x10'));_0x577fc3(_0x4f2b09['result'][_0x857f('0x15')]);}})[_0x857f('0x16')](function(_0xdf14fe){logger[_0x857f('0x13')](_0x857f('0xf'),_0x197098,_0xdf14fe);_0x5f6a66(_0xdf14fe);});});} \ No newline at end of file +var _0x05b0=['client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05b0,0x188));var _0x005b=function(_0x156e96,_0x25a4e1){_0x156e96=_0x156e96-0x0;var _0x264184=_0x05b0[_0x156e96];return _0x264184;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x005b('0x0'));var BPromise=require(_0x005b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x005b('0x2'));var db=require(_0x005b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x005b('0x4'))(_0x005b('0x5'));var config=require('../../config/environment');var jayson=require(_0x005b('0x6'));var client=jayson[_0x005b('0x7')][_0x005b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x98e71c,_0x224c8d,_0x35998d){return new BPromise(function(_0x263bc9,_0x5cff7f){return client[_0x005b('0x9')](_0x98e71c,_0x35998d)[_0x005b('0xa')](function(_0x4c5552){logger['info'](_0x005b('0xb'),_0x224c8d,'request\x20sent');logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x224c8d,_0x005b('0xc'),JSON[_0x005b('0xd')](_0x4c5552));if(_0x4c5552['error']){if(_0x4c5552[_0x005b('0xe')][_0x005b('0xf')]===0x1f4){logger[_0x005b('0xe')](_0x005b('0xb'),_0x224c8d,_0x4c5552[_0x005b('0xe')][_0x005b('0x10')]);return _0x5cff7f(_0x4c5552[_0x005b('0xe')]['message']);}logger['error']('Migration,\x20%s,\x20%s',_0x224c8d,_0x4c5552[_0x005b('0xe')]['message']);return _0x263bc9(_0x4c5552[_0x005b('0xe')]['message']);}else{logger[_0x005b('0x11')](_0x005b('0xb'),_0x224c8d,_0x005b('0xc'));_0x263bc9(_0x4c5552[_0x005b('0x12')][_0x005b('0x10')]);}})['catch'](function(_0xa3c3fb){logger[_0x005b('0xe')](_0x005b('0xb'),_0x224c8d,_0xa3c3fb);_0x5cff7f(_0xa3c3fb);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 4a54289..93bb14b 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 _0x02d4=['isAuthenticated','show','post','create','put','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x02d4,0x111));var _0x402d=function(_0x4b54e7,_0x5d7be7){_0x4b54e7=_0x4b54e7-0x0;var _0x426c4a=_0x02d4[_0x4b54e7];return _0x426c4a;};'use strict';var multer=require(_0x402d('0x0'));var util=require('util');var path=require(_0x402d('0x1'));var timeout=require('connect-timeout');var express=require(_0x402d('0x2'));var router=express[_0x402d('0x3')]();var fs_extra=require(_0x402d('0x4'));var auth=require(_0x402d('0x5'));var interaction=require(_0x402d('0x6'));var config=require(_0x402d('0x7'));var controller=require(_0x402d('0x8'));router[_0x402d('0x9')]('/',auth['isAuthenticated'](),controller[_0x402d('0xa')]);router[_0x402d('0x9')](_0x402d('0xb'),auth[_0x402d('0xc')](),controller[_0x402d('0xd')]);router[_0x402d('0xe')]('/',auth[_0x402d('0xc')](),controller[_0x402d('0xf')]);router[_0x402d('0x10')](_0x402d('0xb'),auth['isAuthenticated'](),controller[_0x402d('0x11')]);router['delete']('/:id',auth[_0x402d('0xc')](),controller['destroy']);module[_0x402d('0x12')]=router; \ No newline at end of file +var _0x582b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','post','update','delete','destroy','exports','util','path'];(function(_0x264332,_0x2ab6ca){var _0x57efbe=function(_0x23c6f8){while(--_0x23c6f8){_0x264332['push'](_0x264332['shift']());}};_0x57efbe(++_0x2ab6ca);}(_0x582b,0x185));var _0xb582=function(_0x541817,_0x42ce68){_0x541817=_0x541817-0x0;var _0x46a287=_0x582b[_0x541817];return _0x46a287;};'use strict';var multer=require('multer');var util=require(_0xb582('0x0'));var path=require(_0xb582('0x1'));var timeout=require('connect-timeout');var express=require(_0xb582('0x2'));var router=express['Router']();var fs_extra=require(_0xb582('0x3'));var auth=require(_0xb582('0x4'));var interaction=require(_0xb582('0x5'));var config=require(_0xb582('0x6'));var controller=require(_0xb582('0x7'));router[_0xb582('0x8')]('/',auth[_0xb582('0x9')](),controller[_0xb582('0xa')]);router['get'](_0xb582('0xb'),auth[_0xb582('0x9')](),controller['show']);router[_0xb582('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb582('0xb'),auth[_0xb582('0x9')](),controller[_0xb582('0xd')]);router[_0xb582('0xe')](_0xb582('0xb'),auth[_0xb582('0x9')](),controller[_0xb582('0xf')]);module[_0xb582('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index f861736..a05a9e6 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 _0x1016=['localnet','stun','STRING','sequelize','exports','ENUM'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x1016,0xcf));var _0x6101=function(_0x42ec63,_0xc1c3f8){_0x42ec63=_0x42ec63-0x0;var _0x489dec=_0x1016[_0x42ec63];return _0x489dec;};'use strict';var Sequelize=require(_0x6101('0x0'));module[_0x6101('0x1')]={'type':{'type':Sequelize[_0x6101('0x2')](_0x6101('0x3'),'externip',_0x6101('0x4'),'turn')},'value':{'type':Sequelize[_0x6101('0x5')]},'username':{'type':Sequelize[_0x6101('0x5')]},'password':{'type':Sequelize[_0x6101('0x5')]}}; \ No newline at end of file +var _0xa919=['turn','STRING','sequelize','ENUM','externip','stun'];(function(_0x14309b,_0x31003c){var _0x279563=function(_0x33b543){while(--_0x33b543){_0x14309b['push'](_0x14309b['shift']());}};_0x279563(++_0x31003c);}(_0xa919,0x92));var _0x9a91=function(_0x95cf3f,_0x25e260){_0x95cf3f=_0x95cf3f-0x0;var _0x305d5f=_0xa919[_0x95cf3f];return _0x305d5f;};'use strict';var Sequelize=require(_0x9a91('0x0'));module['exports']={'type':{'type':Sequelize[_0x9a91('0x1')]('localnet',_0x9a91('0x2'),_0x9a91('0x3'),_0x9a91('0x4'))},'value':{'type':Sequelize[_0x9a91('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9a91('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 889d859..02da200 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 _0x7d28=['fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','show','params','length','find','create','sequelize','transaction','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','Reload','server/files/templates/network.ejs','utf8','format','toLowerCase','chan_sip.so','update','STUN','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','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/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','Network,\x20%s,\x20%s','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7d28,0x112));var _0x87d2=function(_0x5a3ef6,_0x4ce6ad){_0x5a3ef6=_0x5a3ef6-0x0;var _0x1d25b2=_0x7d28[_0x5a3ef6];return _0x1d25b2;};'use strict';var emlformat=require(_0x87d2('0x0'));var rimraf=require(_0x87d2('0x1'));var zipdir=require(_0x87d2('0x2'));var jsonpatch=require(_0x87d2('0x3'));var rp=require(_0x87d2('0x4'));var moment=require(_0x87d2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x87d2('0x6'));var util=require('util');var path=require('path');var sox=require(_0x87d2('0x7'));var csv=require('to-csv');var ejs=require(_0x87d2('0x8'));var fs=require('fs');var fs_extra=require(_0x87d2('0x9'));var _=require(_0x87d2('0xa'));var squel=require(_0x87d2('0xb'));var crypto=require(_0x87d2('0xc'));var jsforce=require(_0x87d2('0xd'));var deskjs=require(_0x87d2('0xe'));var toCsv=require(_0x87d2('0xf'));var querystring=require(_0x87d2('0x10'));var Papa=require('papaparse');var Redis=require(_0x87d2('0x11'));var authService=require(_0x87d2('0x12'));var qs=require(_0x87d2('0x13'));var as=require(_0x87d2('0x14'));var hardwareService=require(_0x87d2('0x15'));var logger=require(_0x87d2('0x16'))(_0x87d2('0x17'));var utils=require(_0x87d2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x87d2('0x19'));var db=require(_0x87d2('0x1a'))['db'];var jayson=require(_0x87d2('0x1b'));var client=jayson[_0x87d2('0x1c')][_0x87d2('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x57ec73,_0x1fb66b,_0x1180ed,_0x527090){return new BPromise(function(_0x1cb94f,_0x2ba3c4){var _0x39f1ed=_0x527090||client;return _0x39f1ed['request'](_0x57ec73,_0x1180ed)[_0x87d2('0x1e')](function(_0x4bb56e){logger[_0x87d2('0x1f')]('Network,\x20%s,\x20%s',_0x1fb66b,_0x87d2('0x20'));logger[_0x87d2('0x21')]('Network,\x20%s,\x20%s,\x20%s',_0x1fb66b,_0x87d2('0x20'),JSON[_0x87d2('0x22')](_0x4bb56e));if(_0x4bb56e['error']){if(_0x4bb56e[_0x87d2('0x23')][_0x87d2('0x24')]===0x1f4){logger[_0x87d2('0x23')]('Network,\x20%s,\x20%s',_0x1fb66b,_0x4bb56e['error'][_0x87d2('0x25')]);return _0x2ba3c4(_0x4bb56e[_0x87d2('0x23')][_0x87d2('0x25')]);}logger[_0x87d2('0x23')](_0x87d2('0x26'),_0x1fb66b,_0x4bb56e[_0x87d2('0x23')][_0x87d2('0x25')]);return _0x1cb94f(_0x4bb56e[_0x87d2('0x23')][_0x87d2('0x25')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x1fb66b,_0x87d2('0x20'));_0x1cb94f(_0x4bb56e['result'][_0x87d2('0x25')]);}})['catch'](function(_0x3ad5eb){logger['error'](_0x87d2('0x26'),_0x1fb66b,_0x3ad5eb);_0x2ba3c4(_0x3ad5eb);});});}function respondWithStatusCode(_0x13524c,_0x2e1842){_0x2e1842=_0x2e1842||0xcc;return function(_0x4c2816){if(_0x4c2816){return _0x13524c['sendStatus'](_0x2e1842);}return _0x13524c['status'](_0x2e1842)['end']();};}function respondWithResult(_0x1189e1,_0x25c18f){_0x25c18f=_0x25c18f||0xc8;return function(_0xff83c0){if(_0xff83c0){return _0x1189e1[_0x87d2('0x27')](_0x25c18f)[_0x87d2('0x28')](_0xff83c0);}};}function respondWithFilteredResult(_0x2fd268,_0x23e95d){return function(_0x38da34){if(_0x38da34){var _0x42347e=typeof _0x23e95d[_0x87d2('0x29')]==='undefined'&&typeof _0x23e95d[_0x87d2('0x2a')]===_0x87d2('0x2b');var _0x15ad34=_0x38da34[_0x87d2('0x2c')];var _0x3ced2a=_0x42347e?0x0:_0x23e95d[_0x87d2('0x29')];var _0x539cc0=_0x42347e?_0x38da34['count']:_0x23e95d[_0x87d2('0x29')]+_0x23e95d[_0x87d2('0x2a')];var _0x528dfe;if(_0x539cc0>=_0x15ad34){_0x539cc0=_0x15ad34;_0x528dfe=0xc8;}else{_0x528dfe=0xce;}_0x2fd268[_0x87d2('0x27')](_0x528dfe);return _0x2fd268[_0x87d2('0x2d')](_0x87d2('0x2e'),_0x3ced2a+'-'+_0x539cc0+'/'+_0x15ad34)[_0x87d2('0x28')](_0x38da34);}return null;};}function patchUpdates(_0x5089fe){return function(_0x5ebcbc){try{jsonpatch[_0x87d2('0x2f')](_0x5ebcbc,_0x5089fe,!![]);}catch(_0x1e0234){return BPromise['reject'](_0x1e0234);}return _0x5ebcbc[_0x87d2('0x30')]();};}function saveUpdates(_0x143b6e,_0x207113){return function(_0x28b6ae){if(_0x28b6ae){return _0x28b6ae['update'](_0x143b6e)[_0x87d2('0x1e')](function(_0x212c03){return _0x212c03;});}return null;};}function removeEntity(_0x152aa8,_0x341f90){return function(_0x38e99b){if(_0x38e99b){return _0x38e99b[_0x87d2('0x31')]()[_0x87d2('0x1e')](function(){_0x152aa8['status'](0xcc)[_0x87d2('0x32')]();});}};}function handleEntityNotFound(_0x30d646,_0x8ba6c6){return function(_0x48126f){if(!_0x48126f){_0x30d646[_0x87d2('0x33')](0x194);}return _0x48126f;};}function handleError(_0x2394ac,_0xfe90eb){_0xfe90eb=_0xfe90eb||0x1f4;return function(_0x58ef3d){logger[_0x87d2('0x23')](_0x58ef3d[_0x87d2('0x34')]);if(_0x58ef3d['name']){delete _0x58ef3d[_0x87d2('0x35')];}_0x2394ac[_0x87d2('0x27')](_0xfe90eb)[_0x87d2('0x36')](_0x58ef3d);};}exports[_0x87d2('0x37')]=function(_0x5f2ac5,_0x30d728){var _0x3343aa={},_0x4f3c29={},_0x17eb07={'count':0x0,'rows':[]};var _0x5473bb=_[_0x87d2('0x38')](db[_0x87d2('0x39')][_0x87d2('0x3a')],function(_0x164b3a){return{'name':_0x164b3a[_0x87d2('0x3b')],'type':_0x164b3a[_0x87d2('0x3c')][_0x87d2('0x3d')]};});_0x4f3c29['model']=_[_0x87d2('0x38')](_0x5473bb,_0x87d2('0x35'));_0x4f3c29[_0x87d2('0x3e')]=_[_0x87d2('0x3f')](_0x5f2ac5[_0x87d2('0x3e')]);_0x4f3c29[_0x87d2('0x40')]=_[_0x87d2('0x41')](_0x4f3c29[_0x87d2('0x42')],_0x4f3c29['query']);_0x3343aa['attributes']=_[_0x87d2('0x41')](_0x4f3c29[_0x87d2('0x42')],qs['fields'](_0x5f2ac5[_0x87d2('0x3e')][_0x87d2('0x43')]));_0x3343aa[_0x87d2('0x44')]=_0x3343aa[_0x87d2('0x44')]['length']?_0x3343aa[_0x87d2('0x44')]:_0x4f3c29['model'];if(!_0x5f2ac5['query'][_0x87d2('0x45')](_0x87d2('0x46'))){_0x3343aa['limit']=qs[_0x87d2('0x2a')](_0x5f2ac5[_0x87d2('0x3e')][_0x87d2('0x2a')]);_0x3343aa['offset']=qs[_0x87d2('0x29')](_0x5f2ac5['query'][_0x87d2('0x29')]);}_0x3343aa[_0x87d2('0x47')]=qs[_0x87d2('0x48')](_0x5f2ac5[_0x87d2('0x3e')][_0x87d2('0x48')]);_0x3343aa['where']=qs['filters'](_['pick'](_0x5f2ac5[_0x87d2('0x3e')],_0x4f3c29[_0x87d2('0x40')]),_0x5473bb);if(_0x5f2ac5[_0x87d2('0x3e')][_0x87d2('0x49')]){_0x3343aa['where']=_['merge'](_0x3343aa[_0x87d2('0x4a')],{'$or':_['map'](_0x5473bb,function(_0x10ff31){if(_0x10ff31['type']!==_0x87d2('0x4b')){var _0x15918c={};_0x15918c[_0x10ff31['name']]={'$like':'%'+_0x5f2ac5['query'][_0x87d2('0x49')]+'%'};return _0x15918c;}})});}_0x3343aa=_[_0x87d2('0x4c')]({},_0x3343aa,_0x5f2ac5[_0x87d2('0x4d')]);var _0x35a6cb={'where':_0x3343aa[_0x87d2('0x4a')]};return db[_0x87d2('0x39')][_0x87d2('0x2c')](_0x35a6cb)[_0x87d2('0x1e')](function(_0x43b6c1){_0x17eb07[_0x87d2('0x2c')]=_0x43b6c1;if(_0x5f2ac5[_0x87d2('0x3e')][_0x87d2('0x4e')]){_0x3343aa[_0x87d2('0x4f')]=[{'all':!![]}];}return db[_0x87d2('0x39')][_0x87d2('0x50')](_0x3343aa);})['then'](function(_0x2af80d){_0x17eb07['rows']=_0x2af80d;return _0x17eb07;})[_0x87d2('0x1e')](respondWithFilteredResult(_0x30d728,_0x3343aa))['catch'](handleError(_0x30d728,null));};exports[_0x87d2('0x51')]=function(_0x269df0,_0x239113){var _0x1928df={'raw':!![],'where':{'id':_0x269df0[_0x87d2('0x52')]['id']}},_0x5a9df8={};_0x5a9df8[_0x87d2('0x42')]=_[_0x87d2('0x3f')](db[_0x87d2('0x39')]['rawAttributes']);_0x5a9df8[_0x87d2('0x3e')]=_[_0x87d2('0x3f')](_0x269df0[_0x87d2('0x3e')]);_0x5a9df8['filters']=_[_0x87d2('0x41')](_0x5a9df8[_0x87d2('0x42')],_0x5a9df8['query']);_0x1928df[_0x87d2('0x44')]=_['intersection'](_0x5a9df8['model'],qs[_0x87d2('0x43')](_0x269df0[_0x87d2('0x3e')][_0x87d2('0x43')]));_0x1928df[_0x87d2('0x44')]=_0x1928df['attributes'][_0x87d2('0x53')]?_0x1928df[_0x87d2('0x44')]:_0x5a9df8['model'];if(_0x269df0[_0x87d2('0x3e')][_0x87d2('0x4e')]){_0x1928df['include']=[{'all':!![]}];}_0x1928df=_[_0x87d2('0x4c')]({},_0x1928df,_0x269df0[_0x87d2('0x4d')]);return db[_0x87d2('0x39')][_0x87d2('0x54')](_0x1928df)['then'](handleEntityNotFound(_0x239113,null))['then'](respondWithResult(_0x239113,null))['catch'](handleError(_0x239113,null));};exports[_0x87d2('0x55')]=function(_0x34fdc9,_0x437cfb,_0x57fad9){var _0xb9aed5;return db[_0x87d2('0x56')][_0x87d2('0x57')](function(_0x52b278){return db[_0x87d2('0x39')][_0x87d2('0x55')](_0x34fdc9[_0x87d2('0x58')],{'raw':!![]})[_0x87d2('0x1e')](function(_0x4ae584){_0xb9aed5=_0x4ae584;return db[_0x87d2('0x39')][_0x87d2('0x50')]({'where':{'type':_0x34fdc9[_0x87d2('0x58')][_0x87d2('0x3c')]},'raw':!![]});})['then'](function(_0x2ed639){if(_0xb9aed5['type'][_0x87d2('0x59')]()=='STUN'){var _0x5b73eb=fs[_0x87d2('0x5a')](path[_0x87d2('0x5b')](config[_0x87d2('0x5c')],_0x87d2('0x5d')),'utf8');var _0x5cb281=ejs[_0x87d2('0x5e')](_0x5b73eb,{'networks':_0x2ed639||[]});fs[_0x87d2('0x5f')](_0x87d2('0x60'),_0x5cb281);return respondWithRpcPromise('Reload','create',{'module':_0x87d2('0x61')});}else if(_0xb9aed5[_0x87d2('0x3c')]['toUpperCase']()==_0x87d2('0x62')){var _0x2c6429=fs['readFileSync'](path[_0x87d2('0x5b')](config['root'],_0x87d2('0x63')),'utf8');var _0xef7101=ejs[_0x87d2('0x5e')](_0x2c6429,{'networks':_0x2ed639||[]});fs[_0x87d2('0x5f')]('/etc/asterisk/turn_xcally.conf',_0xef7101);return respondWithRpcPromise(_0x87d2('0x64'),_0x87d2('0x55'),{'module':_0x87d2('0x61')});}else{var _0x467908=fs[_0x87d2('0x5a')](path[_0x87d2('0x5b')](config[_0x87d2('0x5c')],_0x87d2('0x65')),_0x87d2('0x66'));var _0x5a2d73=ejs['render'](_0x467908,{'networks':_0x2ed639||[]});fs['writeFileSync'](util[_0x87d2('0x67')]('/etc/asterisk/sip_xcally_%s.conf',_0x34fdc9['body'][_0x87d2('0x3c')][_0x87d2('0x68')]()),_0x5a2d73);return respondWithRpcPromise(_0x87d2('0x64'),_0x87d2('0x55'),{'module':_0x87d2('0x69')});}return null;})[_0x87d2('0x1e')](function(){return _0xb9aed5;});})[_0x87d2('0x1e')](respondWithResult(_0x437cfb,0xc9))['catch'](handleError(_0x437cfb,null));};exports[_0x87d2('0x6a')]=function(_0x39bc75,_0xe8ade3,_0x792783){var _0x53513e;return db[_0x87d2('0x56')][_0x87d2('0x57')](function(_0x2d8961){return db[_0x87d2('0x39')][_0x87d2('0x54')]({'where':{'id':_0x39bc75['params']['id']}})[_0x87d2('0x1e')](handleEntityNotFound(_0xe8ade3,null))['then'](saveUpdates(_0x39bc75['body'],null))[_0x87d2('0x1e')](function(_0x4ab73c){if(_0x4ab73c){_0x53513e=_0x4ab73c;return db[_0x87d2('0x39')][_0x87d2('0x50')]({'where':{'type':_0x53513e[_0x87d2('0x3c')]},'raw':!![]});}return null;})[_0x87d2('0x1e')](function(_0x5edfe6){if(_0x53513e[_0x87d2('0x3c')][_0x87d2('0x59')]()==_0x87d2('0x6b')){var _0x4177b8=fs[_0x87d2('0x5a')](path['join'](config[_0x87d2('0x5c')],_0x87d2('0x5d')),_0x87d2('0x66'));var _0x97a003=ejs[_0x87d2('0x5e')](_0x4177b8,{'networks':_0x5edfe6||[]});fs[_0x87d2('0x5f')](_0x87d2('0x60'),_0x97a003);return respondWithRpcPromise(_0x87d2('0x64'),_0x87d2('0x6a'),{'module':_0x87d2('0x61')});}else if(_0x53513e[_0x87d2('0x3c')]['toUpperCase']()==_0x87d2('0x62')){var _0xc204c6=fs['readFileSync'](path[_0x87d2('0x5b')](config[_0x87d2('0x5c')],'server/files/templates/turn_multiple.ejs'),_0x87d2('0x66'));var _0x329ea6=ejs[_0x87d2('0x5e')](_0xc204c6,{'networks':_0x5edfe6||[]});fs[_0x87d2('0x5f')](_0x87d2('0x6c'),_0x329ea6);return respondWithRpcPromise(_0x87d2('0x64'),'update',{'module':_0x87d2('0x61')});}else{var _0x3a8f8a=fs[_0x87d2('0x5a')](path[_0x87d2('0x5b')](config['root'],_0x87d2('0x65')),_0x87d2('0x66'));var _0xf75172=ejs[_0x87d2('0x5e')](_0x3a8f8a,{'networks':_0x5edfe6||[]});fs[_0x87d2('0x5f')](util[_0x87d2('0x67')](_0x87d2('0x6d'),_0x39bc75['body'][_0x87d2('0x3c')]['toLowerCase']()),_0xf75172);return respondWithRpcPromise('Reload',_0x87d2('0x6a'),{'module':_0x87d2('0x69')});}return null;})[_0x87d2('0x1e')](function(_0x2bc3fb){if(_0x2bc3fb){return _0x53513e;}return null;});})['then'](respondWithResult(_0xe8ade3,null))[_0x87d2('0x6e')](handleError(_0xe8ade3,null));};exports[_0x87d2('0x31')]=function(_0x68c2b2,_0x35eee8,_0x14d7fd){var _0x4ae464;return db[_0x87d2('0x39')][_0x87d2('0x54')]({'where':{'id':_0x68c2b2[_0x87d2('0x52')]['id']}})[_0x87d2('0x1e')](function(_0x9d40cf){_0x4ae464=_0x9d40cf;return _0x9d40cf;})[_0x87d2('0x1e')](handleEntityNotFound(_0x35eee8,null))['then'](removeEntity(_0x35eee8,null))[_0x87d2('0x1e')](function(){if(_0x4ae464){return db[_0x87d2('0x39')][_0x87d2('0x50')]({'where':{'type':_0x4ae464[_0x87d2('0x3c')]},'raw':!![]});}})[_0x87d2('0x1e')](function(_0x271f48){if(_0x4ae464[_0x87d2('0x3c')][_0x87d2('0x59')]()=='STUN'){var _0x314b4d=fs['readFileSync'](path[_0x87d2('0x5b')](config[_0x87d2('0x5c')],_0x87d2('0x5d')),'utf8');var _0x442e4c=ejs[_0x87d2('0x5e')](_0x314b4d,{'networks':_0x271f48||[]});fs[_0x87d2('0x5f')](_0x87d2('0x60'),_0x442e4c);return respondWithRpcPromise(_0x87d2('0x64'),_0x87d2('0x31'),{'module':_0x87d2('0x61')});}else if(_0x4ae464['type'][_0x87d2('0x59')]()==_0x87d2('0x62')){var _0x1c3389=fs[_0x87d2('0x5a')](path[_0x87d2('0x5b')](config[_0x87d2('0x5c')],_0x87d2('0x63')),_0x87d2('0x66'));var _0x4dbdec=ejs[_0x87d2('0x5e')](_0x1c3389,{'networks':_0x271f48||[]});fs[_0x87d2('0x5f')](_0x87d2('0x6c'),_0x4dbdec);return respondWithRpcPromise(_0x87d2('0x64'),'destroy',{'module':_0x87d2('0x61')});}else{var _0x187930=fs['readFileSync'](path[_0x87d2('0x5b')](config[_0x87d2('0x5c')],_0x87d2('0x65')),_0x87d2('0x66'));var _0x519e52=ejs[_0x87d2('0x5e')](_0x187930,{'networks':_0x271f48||[]});fs[_0x87d2('0x5f')](util['format'](_0x87d2('0x6d'),_0x68c2b2[_0x87d2('0x58')][_0x87d2('0x3c')][_0x87d2('0x68')]()),_0x519e52);return respondWithRpcPromise('Reload',_0x87d2('0x31'),{'module':_0x87d2('0x69')});}return null;})[_0x87d2('0x6e')](handleError(_0x35eee8,null));}; \ No newline at end of file +var _0x1427=['utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','params','server/files/templates/stun_multiple.ejs','server/files/templates/turn_multiple.ejs','format','chan_sip.so','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','stack','name','index','map','Network','rawAttributes','fieldName','model','query','filters','attributes','fields','length','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','intersection','find','create','transaction','body','STUN','readFileSync','join','root'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x1427,0x7b));var _0x7142=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1427[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7142('0x0'));var zipdir=require(_0x7142('0x1'));var jsonpatch=require(_0x7142('0x2'));var rp=require(_0x7142('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7142('0x4'));var util=require('util');var path=require(_0x7142('0x5'));var sox=require(_0x7142('0x6'));var csv=require(_0x7142('0x7'));var ejs=require(_0x7142('0x8'));var fs=require('fs');var fs_extra=require(_0x7142('0x9'));var _=require(_0x7142('0xa'));var squel=require(_0x7142('0xb'));var crypto=require(_0x7142('0xc'));var jsforce=require(_0x7142('0xd'));var deskjs=require(_0x7142('0xe'));var toCsv=require(_0x7142('0x7'));var querystring=require(_0x7142('0xf'));var Papa=require(_0x7142('0x10'));var Redis=require('ioredis');var authService=require(_0x7142('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7142('0x12'));var hardwareService=require(_0x7142('0x13'));var logger=require(_0x7142('0x14'))(_0x7142('0x15'));var utils=require('../../config/utils');var config=require(_0x7142('0x16'));var licenseUtil=require(_0x7142('0x17'));var db=require(_0x7142('0x18'))['db'];var jayson=require(_0x7142('0x19'));var client=jayson['client'][_0x7142('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1e97da,_0x14fe93,_0x319724,_0x18cbe9){return new BPromise(function(_0x2841c5,_0x40f29d){var _0x4cf24e=_0x18cbe9||client;return _0x4cf24e[_0x7142('0x1b')](_0x1e97da,_0x319724)['then'](function(_0x4ada16){logger['info']('Network,\x20%s,\x20%s',_0x14fe93,_0x7142('0x1c'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x14fe93,'request\x20sent',JSON[_0x7142('0x1d')](_0x4ada16));if(_0x4ada16[_0x7142('0x1e')]){if(_0x4ada16['error'][_0x7142('0x1f')]===0x1f4){logger[_0x7142('0x1e')](_0x7142('0x20'),_0x14fe93,_0x4ada16[_0x7142('0x1e')]['message']);return _0x40f29d(_0x4ada16[_0x7142('0x1e')][_0x7142('0x21')]);}logger[_0x7142('0x1e')](_0x7142('0x20'),_0x14fe93,_0x4ada16[_0x7142('0x1e')][_0x7142('0x21')]);return _0x2841c5(_0x4ada16[_0x7142('0x1e')][_0x7142('0x21')]);}else{logger[_0x7142('0x22')]('Network,\x20%s,\x20%s',_0x14fe93,_0x7142('0x1c'));_0x2841c5(_0x4ada16[_0x7142('0x23')]['message']);}})[_0x7142('0x24')](function(_0x31898e){logger['error'](_0x7142('0x20'),_0x14fe93,_0x31898e);_0x40f29d(_0x31898e);});});}function respondWithStatusCode(_0x3dd1cc,_0x382e06){_0x382e06=_0x382e06||0xcc;return function(_0x4ef7bc){if(_0x4ef7bc){return _0x3dd1cc[_0x7142('0x25')](_0x382e06);}return _0x3dd1cc[_0x7142('0x26')](_0x382e06)[_0x7142('0x27')]();};}function respondWithResult(_0x56c30c,_0x18c449){_0x18c449=_0x18c449||0xc8;return function(_0x4d224d){if(_0x4d224d){return _0x56c30c[_0x7142('0x26')](_0x18c449)[_0x7142('0x28')](_0x4d224d);}};}function respondWithFilteredResult(_0x2f0a31,_0xe5de1d){return function(_0x29a2e2){if(_0x29a2e2){var _0xd27565=typeof _0xe5de1d[_0x7142('0x29')]===_0x7142('0x2a')&&typeof _0xe5de1d['limit']===_0x7142('0x2a');var _0x5c45fb=_0x29a2e2[_0x7142('0x2b')];var _0x4a0f7f=_0xd27565?0x0:_0xe5de1d[_0x7142('0x29')];var _0x134fdb=_0xd27565?_0x29a2e2['count']:_0xe5de1d[_0x7142('0x29')]+_0xe5de1d[_0x7142('0x2c')];var _0xed4399;if(_0x134fdb>=_0x5c45fb){_0x134fdb=_0x5c45fb;_0xed4399=0xc8;}else{_0xed4399=0xce;}_0x2f0a31[_0x7142('0x26')](_0xed4399);return _0x2f0a31[_0x7142('0x2d')]('Content-Range',_0x4a0f7f+'-'+_0x134fdb+'/'+_0x5c45fb)[_0x7142('0x28')](_0x29a2e2);}return null;};}function patchUpdates(_0x593fd0){return function(_0x518665){try{jsonpatch[_0x7142('0x2e')](_0x518665,_0x593fd0,!![]);}catch(_0x2f208c){return BPromise[_0x7142('0x2f')](_0x2f208c);}return _0x518665[_0x7142('0x30')]();};}function saveUpdates(_0x25f894,_0x1d5c4d){return function(_0x2956dc){if(_0x2956dc){return _0x2956dc[_0x7142('0x31')](_0x25f894)[_0x7142('0x32')](function(_0x2dbec0){return _0x2dbec0;});}return null;};}function removeEntity(_0x118f7e,_0x2b45d6){return function(_0x5298e6){if(_0x5298e6){return _0x5298e6[_0x7142('0x33')]()[_0x7142('0x32')](function(){_0x118f7e[_0x7142('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e1dff,_0x53fa51){return function(_0x2f2779){if(!_0x2f2779){_0x1e1dff[_0x7142('0x25')](0x194);}return _0x2f2779;};}function handleError(_0x36cccd,_0x31de3c){_0x31de3c=_0x31de3c||0x1f4;return function(_0x43b97c){logger[_0x7142('0x1e')](_0x43b97c[_0x7142('0x34')]);if(_0x43b97c[_0x7142('0x35')]){delete _0x43b97c[_0x7142('0x35')];}_0x36cccd[_0x7142('0x26')](_0x31de3c)['send'](_0x43b97c);};}exports[_0x7142('0x36')]=function(_0x38aef4,_0x5aae72){var _0x4a79b7={},_0x2d0cac={},_0x2485dc={'count':0x0,'rows':[]};var _0x3b420c=_[_0x7142('0x37')](db[_0x7142('0x38')][_0x7142('0x39')],function(_0x5155ac){return{'name':_0x5155ac[_0x7142('0x3a')],'type':_0x5155ac['type']['key']};});_0x2d0cac[_0x7142('0x3b')]=_[_0x7142('0x37')](_0x3b420c,_0x7142('0x35'));_0x2d0cac['query']=_['keys'](_0x38aef4[_0x7142('0x3c')]);_0x2d0cac[_0x7142('0x3d')]=_['intersection'](_0x2d0cac['model'],_0x2d0cac['query']);_0x4a79b7[_0x7142('0x3e')]=_['intersection'](_0x2d0cac['model'],qs['fields'](_0x38aef4[_0x7142('0x3c')][_0x7142('0x3f')]));_0x4a79b7[_0x7142('0x3e')]=_0x4a79b7['attributes'][_0x7142('0x40')]?_0x4a79b7[_0x7142('0x3e')]:_0x2d0cac[_0x7142('0x3b')];if(!_0x38aef4[_0x7142('0x3c')]['hasOwnProperty']('nolimit')){_0x4a79b7[_0x7142('0x2c')]=qs['limit'](_0x38aef4[_0x7142('0x3c')][_0x7142('0x2c')]);_0x4a79b7['offset']=qs[_0x7142('0x29')](_0x38aef4[_0x7142('0x3c')][_0x7142('0x29')]);}_0x4a79b7[_0x7142('0x41')]=qs[_0x7142('0x42')](_0x38aef4['query'][_0x7142('0x42')]);_0x4a79b7['where']=qs[_0x7142('0x3d')](_[_0x7142('0x43')](_0x38aef4[_0x7142('0x3c')],_0x2d0cac['filters']),_0x3b420c);if(_0x38aef4[_0x7142('0x3c')][_0x7142('0x44')]){_0x4a79b7[_0x7142('0x45')]=_[_0x7142('0x46')](_0x4a79b7[_0x7142('0x45')],{'$or':_[_0x7142('0x37')](_0x3b420c,function(_0x3044e0){if(_0x3044e0[_0x7142('0x47')]!==_0x7142('0x48')){var _0x53be56={};_0x53be56[_0x3044e0['name']]={'$like':'%'+_0x38aef4[_0x7142('0x3c')]['filter']+'%'};return _0x53be56;}})});}_0x4a79b7=_[_0x7142('0x46')]({},_0x4a79b7,_0x38aef4[_0x7142('0x49')]);var _0x42afc0={'where':_0x4a79b7[_0x7142('0x45')]};return db[_0x7142('0x38')][_0x7142('0x2b')](_0x42afc0)['then'](function(_0x24ba66){_0x2485dc[_0x7142('0x2b')]=_0x24ba66;if(_0x38aef4[_0x7142('0x3c')][_0x7142('0x4a')]){_0x4a79b7[_0x7142('0x4b')]=[{'all':!![]}];}return db['Network'][_0x7142('0x4c')](_0x4a79b7);})[_0x7142('0x32')](function(_0x64e388){_0x2485dc[_0x7142('0x4d')]=_0x64e388;return _0x2485dc;})['then'](respondWithFilteredResult(_0x5aae72,_0x4a79b7))[_0x7142('0x24')](handleError(_0x5aae72,null));};exports[_0x7142('0x4e')]=function(_0x1b736b,_0x1b214d){var _0x4e96da={'raw':!![],'where':{'id':_0x1b736b['params']['id']}},_0x507814={};_0x507814[_0x7142('0x3b')]=_[_0x7142('0x4f')](db[_0x7142('0x38')][_0x7142('0x39')]);_0x507814[_0x7142('0x3c')]=_[_0x7142('0x4f')](_0x1b736b[_0x7142('0x3c')]);_0x507814['filters']=_['intersection'](_0x507814[_0x7142('0x3b')],_0x507814['query']);_0x4e96da[_0x7142('0x3e')]=_[_0x7142('0x50')](_0x507814[_0x7142('0x3b')],qs[_0x7142('0x3f')](_0x1b736b['query']['fields']));_0x4e96da[_0x7142('0x3e')]=_0x4e96da[_0x7142('0x3e')][_0x7142('0x40')]?_0x4e96da[_0x7142('0x3e')]:_0x507814[_0x7142('0x3b')];if(_0x1b736b['query'][_0x7142('0x4a')]){_0x4e96da['include']=[{'all':!![]}];}_0x4e96da=_[_0x7142('0x46')]({},_0x4e96da,_0x1b736b['options']);return db[_0x7142('0x38')][_0x7142('0x51')](_0x4e96da)[_0x7142('0x32')](handleEntityNotFound(_0x1b214d,null))[_0x7142('0x32')](respondWithResult(_0x1b214d,null))[_0x7142('0x24')](handleError(_0x1b214d,null));};exports[_0x7142('0x52')]=function(_0x4d395e,_0x2f9767,_0x5a3238){var _0x4dc321;return db['sequelize'][_0x7142('0x53')](function(_0x3e0372){return db['Network'][_0x7142('0x52')](_0x4d395e[_0x7142('0x54')],{'raw':!![]})['then'](function(_0x3bff39){_0x4dc321=_0x3bff39;return db[_0x7142('0x38')][_0x7142('0x4c')]({'where':{'type':_0x4d395e[_0x7142('0x54')][_0x7142('0x47')]},'raw':!![]});})[_0x7142('0x32')](function(_0x47422a){if(_0x4dc321['type']['toUpperCase']()==_0x7142('0x55')){var _0x3a7865=fs[_0x7142('0x56')](path[_0x7142('0x57')](config[_0x7142('0x58')],'server/files/templates/stun_multiple.ejs'),_0x7142('0x59'));var _0x208fb6=ejs['render'](_0x3a7865,{'networks':_0x47422a||[]});fs[_0x7142('0x5a')](_0x7142('0x5b'),_0x208fb6);return respondWithRpcPromise(_0x7142('0x5c'),_0x7142('0x52'),{'module':_0x7142('0x5d')});}else if(_0x4dc321['type'][_0x7142('0x5e')]()==_0x7142('0x5f')){var _0x3ec765=fs[_0x7142('0x56')](path[_0x7142('0x57')](config[_0x7142('0x58')],'server/files/templates/turn_multiple.ejs'),_0x7142('0x59'));var _0x25e581=ejs[_0x7142('0x60')](_0x3ec765,{'networks':_0x47422a||[]});fs['writeFileSync'](_0x7142('0x61'),_0x25e581);return respondWithRpcPromise(_0x7142('0x5c'),_0x7142('0x52'),{'module':_0x7142('0x5d')});}else{var _0x49dcc9=fs[_0x7142('0x56')](path[_0x7142('0x57')](config[_0x7142('0x58')],_0x7142('0x62')),_0x7142('0x59'));var _0x1b2e08=ejs[_0x7142('0x60')](_0x49dcc9,{'networks':_0x47422a||[]});fs[_0x7142('0x5a')](util['format'](_0x7142('0x63'),_0x4d395e[_0x7142('0x54')][_0x7142('0x47')][_0x7142('0x64')]()),_0x1b2e08);return respondWithRpcPromise(_0x7142('0x5c'),'create',{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x4dc321;});})[_0x7142('0x32')](respondWithResult(_0x2f9767,0xc9))[_0x7142('0x24')](handleError(_0x2f9767,null));};exports[_0x7142('0x31')]=function(_0x4b9384,_0x13ceb2,_0x54c18d){var _0x12542f;return db['sequelize'][_0x7142('0x53')](function(_0x1a1816){return db['Network']['find']({'where':{'id':_0x4b9384[_0x7142('0x65')]['id']}})['then'](handleEntityNotFound(_0x13ceb2,null))[_0x7142('0x32')](saveUpdates(_0x4b9384[_0x7142('0x54')],null))[_0x7142('0x32')](function(_0x158131){if(_0x158131){_0x12542f=_0x158131;return db[_0x7142('0x38')]['findAll']({'where':{'type':_0x12542f[_0x7142('0x47')]},'raw':!![]});}return null;})[_0x7142('0x32')](function(_0x4b2516){if(_0x12542f[_0x7142('0x47')][_0x7142('0x5e')]()==_0x7142('0x55')){var _0x44923d=fs[_0x7142('0x56')](path['join'](config['root'],_0x7142('0x66')),'utf8');var _0x3856eb=ejs['render'](_0x44923d,{'networks':_0x4b2516||[]});fs[_0x7142('0x5a')](_0x7142('0x5b'),_0x3856eb);return respondWithRpcPromise(_0x7142('0x5c'),_0x7142('0x31'),{'module':_0x7142('0x5d')});}else if(_0x12542f[_0x7142('0x47')]['toUpperCase']()==_0x7142('0x5f')){var _0x5ceb5b=fs[_0x7142('0x56')](path['join'](config[_0x7142('0x58')],_0x7142('0x67')),'utf8');var _0x55bf68=ejs[_0x7142('0x60')](_0x5ceb5b,{'networks':_0x4b2516||[]});fs['writeFileSync'](_0x7142('0x61'),_0x55bf68);return respondWithRpcPromise(_0x7142('0x5c'),_0x7142('0x31'),{'module':_0x7142('0x5d')});}else{var _0x4e46b2=fs['readFileSync'](path['join'](config[_0x7142('0x58')],'server/files/templates/network.ejs'),_0x7142('0x59'));var _0x288eab=ejs[_0x7142('0x60')](_0x4e46b2,{'networks':_0x4b2516||[]});fs['writeFileSync'](util[_0x7142('0x68')]('/etc/asterisk/sip_xcally_%s.conf',_0x4b9384['body'][_0x7142('0x47')][_0x7142('0x64')]()),_0x288eab);return respondWithRpcPromise(_0x7142('0x5c'),_0x7142('0x31'),{'module':_0x7142('0x69')});}return null;})[_0x7142('0x32')](function(_0x3f6fa4){if(_0x3f6fa4){return _0x12542f;}return null;});})[_0x7142('0x32')](respondWithResult(_0x13ceb2,null))[_0x7142('0x24')](handleError(_0x13ceb2,null));};exports[_0x7142('0x33')]=function(_0x453446,_0x2c488d,_0x156b88){var _0xe7a4f4;return db[_0x7142('0x38')][_0x7142('0x51')]({'where':{'id':_0x453446[_0x7142('0x65')]['id']}})['then'](function(_0x2f93be){_0xe7a4f4=_0x2f93be;return _0x2f93be;})[_0x7142('0x32')](handleEntityNotFound(_0x2c488d,null))[_0x7142('0x32')](removeEntity(_0x2c488d,null))[_0x7142('0x32')](function(){if(_0xe7a4f4){return db[_0x7142('0x38')]['findAll']({'where':{'type':_0xe7a4f4[_0x7142('0x47')]},'raw':!![]});}})['then'](function(_0x5d6ccc){if(_0xe7a4f4['type'][_0x7142('0x5e')]()=='STUN'){var _0x483bcf=fs['readFileSync'](path[_0x7142('0x57')](config[_0x7142('0x58')],_0x7142('0x66')),_0x7142('0x59'));var _0x6169b4=ejs[_0x7142('0x60')](_0x483bcf,{'networks':_0x5d6ccc||[]});fs['writeFileSync'](_0x7142('0x5b'),_0x6169b4);return respondWithRpcPromise(_0x7142('0x5c'),_0x7142('0x33'),{'module':'res_stun_monitor.so'});}else if(_0xe7a4f4[_0x7142('0x47')][_0x7142('0x5e')]()=='TURN'){var _0x3cf5ed=fs[_0x7142('0x56')](path[_0x7142('0x57')](config[_0x7142('0x58')],_0x7142('0x67')),_0x7142('0x59'));var _0x1c911b=ejs[_0x7142('0x60')](_0x3cf5ed,{'networks':_0x5d6ccc||[]});fs[_0x7142('0x5a')](_0x7142('0x61'),_0x1c911b);return respondWithRpcPromise('Reload',_0x7142('0x33'),{'module':_0x7142('0x5d')});}else{var _0x2e7055=fs[_0x7142('0x56')](path[_0x7142('0x57')](config['root'],_0x7142('0x62')),'utf8');var _0x59bc78=ejs[_0x7142('0x60')](_0x2e7055,{'networks':_0x5d6ccc||[]});fs[_0x7142('0x5a')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x453446[_0x7142('0x54')]['type'][_0x7142('0x64')]()),_0x59bc78);return respondWithRpcPromise('Reload',_0x7142('0x33'),{'module':_0x7142('0x69')});}return null;})[_0x7142('0x24')](handleError(_0x2c488d,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 4553415..6f77fc0 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 _0x1ba2=['./network.attributes','exports','Network','network','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x361871,_0x54eb7a){var _0x46bb6e=function(_0x5b78be){while(--_0x5b78be){_0x361871['push'](_0x361871['shift']());}};_0x46bb6e(++_0x54eb7a);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x21ba('0x0'));var util=require('util');var logger=require(_0x21ba('0x1'))('api');var moment=require(_0x21ba('0x2'));var BPromise=require(_0x21ba('0x3'));var rp=require(_0x21ba('0x4'));var fs=require('fs');var path=require(_0x21ba('0x5'));var rimraf=require(_0x21ba('0x6'));var config=require('../../config/environment');var attributes=require(_0x21ba('0x7'));module[_0x21ba('0x8')]=function(_0x4a07e8,_0x10dae1){return _0x4a07e8['define'](_0x21ba('0x9'),attributes,{'tableName':_0x21ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01fe=['../../config/environment','exports','define','Network','network','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x5a5ffb,_0x3aaf44){var _0x12d821=function(_0x56d1ac){while(--_0x56d1ac){_0x5a5ffb['push'](_0x5a5ffb['shift']());}};_0x12d821(++_0x3aaf44);}(_0x01fe,0x102));var _0xe01f=function(_0x1ac169,_0x4c8531){_0x1ac169=_0x1ac169-0x0;var _0x2ea40f=_0x01fe[_0x1ac169];return _0x2ea40f;};'use strict';var _=require(_0xe01f('0x0'));var util=require('util');var logger=require(_0xe01f('0x1'))(_0xe01f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe01f('0x3'));var fs=require('fs');var path=require(_0xe01f('0x4'));var rimraf=require(_0xe01f('0x5'));var config=require(_0xe01f('0x6'));var attributes=require('./network.attributes');module[_0xe01f('0x7')]=function(_0x574969,_0x3effc4){return _0x574969[_0xe01f('0x8')](_0xe01f('0x9'),attributes,{'tableName':_0xe01f('0xa'),'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 119bb46..8cb0df3 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5b7c14,_0x2b44d3){var _0xa948f1=function(_0x3f92a2){while(--_0x3f92a2){_0x5b7c14['push'](_0x5b7c14['shift']());}};_0xa948f1(++_0x2b44d3);}(_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 moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x5d4f45,_0x2e94ea){_0x5d4f45=_0x5d4f45-0x0;var _0x5ee8bb=_0x7a54[_0x5d4f45];return _0x5ee8bb;};'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 ad38ada..b4189d2 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 _0x82ec=['addDisposition','/:id/notify','notify','addApplications','addAgents','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','fs-extra','./openchannelAccount.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','/:id/interactions','/:id/users','getAgents','post'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x82ec,0x161));var _0xc82e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x82ec[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xc82e('0x0'));var util=require(_0xc82e('0x1'));var path=require(_0xc82e('0x2'));var timeout=require(_0xc82e('0x3'));var express=require(_0xc82e('0x4'));var router=express['Router']();var fs_extra=require(_0xc82e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc82e('0x6'));router['get']('/',auth[_0xc82e('0x7')](),controller[_0xc82e('0x8')]);router[_0xc82e('0x9')](_0xc82e('0xa'),auth[_0xc82e('0x7')](),controller['describe']);router[_0xc82e('0x9')](_0xc82e('0xb'),auth['isAuthenticated'](),controller[_0xc82e('0xc')]);router['get'](_0xc82e('0xd'),auth['isAuthenticated'](),controller[_0xc82e('0xe')]);router[_0xc82e('0x9')](_0xc82e('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xc82e('0x9')](_0xc82e('0x10'),auth[_0xc82e('0x7')](),controller['getApplications']);router[_0xc82e('0x9')](_0xc82e('0x11'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0xc82e('0x12'),auth[_0xc82e('0x7')](),controller[_0xc82e('0x13')]);router[_0xc82e('0x14')]('/',auth[_0xc82e('0x7')](),controller['create']);router['post']('/:id/dispositions',auth[_0xc82e('0x7')](),controller[_0xc82e('0x15')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0xc82e('0x14')](_0xc82e('0x16'),controller[_0xc82e('0x17')]);router[_0xc82e('0x14')](_0xc82e('0x10'),auth['isAuthenticated'](),controller[_0xc82e('0x18')]);router[_0xc82e('0x14')](_0xc82e('0x12'),auth[_0xc82e('0x7')](),controller[_0xc82e('0x19')]);router['post']('/:id/send',auth[_0xc82e('0x7')](),controller[_0xc82e('0x1a')]);router[_0xc82e('0x1b')]('/:id',auth[_0xc82e('0x7')](),controller[_0xc82e('0x1c')]);router[_0xc82e('0x1d')](_0xc82e('0xb'),auth[_0xc82e('0x7')](),controller[_0xc82e('0x1e')]);router[_0xc82e('0x1d')](_0xc82e('0xd'),auth[_0xc82e('0x7')](),controller[_0xc82e('0x1f')]);router[_0xc82e('0x1d')]('/:id/canned_answers',auth[_0xc82e('0x7')](),controller[_0xc82e('0x20')]);router[_0xc82e('0x1d')](_0xc82e('0x12'),auth[_0xc82e('0x7')](),controller['removeAgents']);module[_0xc82e('0x21')]=router; \ No newline at end of file +var _0xf2c2=['describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','addApplications','/:id/send','put','update','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x110c54,_0xa3cfcb){var _0x58a348=function(_0x2ddb40){while(--_0x2ddb40){_0x110c54['push'](_0x110c54['shift']());}};_0x58a348(++_0xa3cfcb);}(_0xf2c2,0x153));var _0x2f2c=function(_0x222a68,_0x47613c){_0x222a68=_0x222a68-0x0;var _0x150c96=_0xf2c2[_0x222a68];return _0x150c96;};'use strict';var multer=require(_0x2f2c('0x0'));var util=require(_0x2f2c('0x1'));var path=require(_0x2f2c('0x2'));var timeout=require(_0x2f2c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2f2c('0x4'));var auth=require(_0x2f2c('0x5'));var interaction=require(_0x2f2c('0x6'));var config=require(_0x2f2c('0x7'));var controller=require('./openchannelAccount.controller');router[_0x2f2c('0x8')]('/',auth[_0x2f2c('0x9')](),controller['index']);router[_0x2f2c('0x8')](_0x2f2c('0xa'),auth['isAuthenticated'](),controller[_0x2f2c('0xb')]);router[_0x2f2c('0x8')](_0x2f2c('0xc'),auth['isAuthenticated'](),controller[_0x2f2c('0xd')]);router['get'](_0x2f2c('0xe'),auth[_0x2f2c('0x9')](),controller['getDispositions']);router[_0x2f2c('0x8')](_0x2f2c('0xf'),auth['isAuthenticated'](),controller[_0x2f2c('0x10')]);router[_0x2f2c('0x8')](_0x2f2c('0x11'),auth[_0x2f2c('0x9')](),controller[_0x2f2c('0x12')]);router[_0x2f2c('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x2f2c('0x13')]);router[_0x2f2c('0x8')](_0x2f2c('0x14'),auth[_0x2f2c('0x9')](),controller[_0x2f2c('0x15')]);router[_0x2f2c('0x16')]('/',auth[_0x2f2c('0x9')](),controller[_0x2f2c('0x17')]);router['post']('/:id/dispositions',auth[_0x2f2c('0x9')](),controller[_0x2f2c('0x18')]);router[_0x2f2c('0x16')](_0x2f2c('0xf'),auth[_0x2f2c('0x9')](),controller[_0x2f2c('0x19')]);router[_0x2f2c('0x16')](_0x2f2c('0x1a'),controller['notify']);router[_0x2f2c('0x16')](_0x2f2c('0x11'),auth[_0x2f2c('0x9')](),controller[_0x2f2c('0x1b')]);router[_0x2f2c('0x16')](_0x2f2c('0x14'),auth[_0x2f2c('0x9')](),controller['addAgents']);router['post'](_0x2f2c('0x1c'),auth[_0x2f2c('0x9')](),controller['send']);router[_0x2f2c('0x1d')](_0x2f2c('0xc'),auth[_0x2f2c('0x9')](),controller[_0x2f2c('0x1e')]);router[_0x2f2c('0x1f')](_0x2f2c('0xc'),auth[_0x2f2c('0x9')](),controller['destroy']);router['delete'](_0x2f2c('0xe'),auth[_0x2f2c('0x9')](),controller[_0x2f2c('0x20')]);router[_0x2f2c('0x1f')]('/:id/canned_answers',auth[_0x2f2c('0x9')](),controller[_0x2f2c('0x21')]);router[_0x2f2c('0x1f')](_0x2f2c('0x14'),auth['isAuthenticated'](),controller[_0x2f2c('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index ae7effd..ce5b0ed 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 _0x427e=['sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x427e,0x138));var _0xe427=function(_0x56c8ac,_0x8abad1){_0x56c8ac=_0x56c8ac-0x0;var _0x4a1f4b=_0x427e[_0x56c8ac];return _0x4a1f4b;};'use strict';var Sequelize=require(_0xe427('0x0'));var rs=require(_0xe427('0x1'));module[_0xe427('0x2')]={'name':{'type':Sequelize[_0xe427('0x3')],'unique':_0xe427('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xe427('0x3')]},'token':{'type':Sequelize[_0xe427('0x3')],'defaultValue':function(){return rs[_0xe427('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe427('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe427('0x6')],'defaultValue':function(){return _0xe427('0x7');}},'notificationSound':{'type':Sequelize[_0xe427('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe427('0x3')]},'queueTransfer':{'type':Sequelize[_0xe427('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe427('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe427('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe427('0x9')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe427('0x8')],'defaultValue':![],'comment':_0xe427('0xa'),'set':function(_0xbd62e8){if(!_0xbd62e8)this['setDataValue'](_0xe427('0xb'),null);this['setDataValue'](_0xe427('0xc'),_0xbd62e8);}}}; \ No newline at end of file +var _0x6f05=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','generate','TEXT'];(function(_0x55054d,_0x35adc6){var _0x5324fa=function(_0x348b0c){while(--_0x348b0c){_0x55054d['push'](_0x55054d['shift']());}};_0x5324fa(++_0x35adc6);}(_0x6f05,0x1a8));var _0x56f0=function(_0xdc3b16,_0x4a8a42){_0xdc3b16=_0xdc3b16-0x0;var _0x518576=_0x6f05[_0xdc3b16];return _0x518576;};'use strict';var Sequelize=require(_0x56f0('0x0'));var rs=require(_0x56f0('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x56f0('0x2')]},'token':{'type':Sequelize[_0x56f0('0x2')],'defaultValue':function(){return rs[_0x56f0('0x3')]();}},'replyUri':{'type':Sequelize[_0x56f0('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x56f0('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x56f0('0x4')],'defaultValue':function(){return _0x56f0('0x5');}},'notificationSound':{'type':Sequelize[_0x56f0('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x56f0('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x56f0('0x2')]},'queueTransfer':{'type':Sequelize[_0x56f0('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x56f0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x56f0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x56f0('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x56f0('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x56f0('0x6')],'defaultValue':![],'comment':_0x56f0('0x9'),'set':function(_0x3e03b6){if(!_0x3e03b6)this[_0x56f0('0xa')](_0x56f0('0xb'),null);this['setDataValue'](_0x56f0('0xc'),_0x3e03b6);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 3e57df0..4beffa6 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 _0x2030=['socket.io-emitter','redis','./openchannelAccount.socket','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','show','keys','merge','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','rawAttributes','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','List','Contacts','Applications','account','list','applications','orderBy','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','unmanaged','OpenchannelMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','priority','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','DESC','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x2030,0x161));var _0x0203=function(_0x301f7c,_0x462f8b){_0x301f7c=_0x301f7c-0x0;var _0xc05c41=_0x2030[_0x301f7c];return _0xc05c41;};'use strict';var emlformat=require(_0x0203('0x0'));var rimraf=require(_0x0203('0x1'));var zipdir=require(_0x0203('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0203('0x3'));var moment=require(_0x0203('0x4'));var BPromise=require(_0x0203('0x5'));var Mustache=require(_0x0203('0x6'));var util=require(_0x0203('0x7'));var path=require(_0x0203('0x8'));var sox=require(_0x0203('0x9'));var csv=require(_0x0203('0xa'));var ejs=require(_0x0203('0xb'));var fs=require('fs');var fs_extra=require(_0x0203('0xc'));var _=require(_0x0203('0xd'));var squel=require(_0x0203('0xe'));var crypto=require(_0x0203('0xf'));var jsforce=require(_0x0203('0x10'));var deskjs=require(_0x0203('0x11'));var toCsv=require(_0x0203('0xa'));var querystring=require(_0x0203('0x12'));var Papa=require(_0x0203('0x13'));var Redis=require('ioredis');var authService=require(_0x0203('0x14'));var qs=require(_0x0203('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0203('0x16'));var logger=require(_0x0203('0x17'))(_0x0203('0x18'));var utils=require(_0x0203('0x19'));var config=require(_0x0203('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x0203('0x1b'))['db'];config['redis']=_[_0x0203('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0203('0x1d'))(new Redis(config[_0x0203('0x1e')]));require(_0x0203('0x1f'))[_0x0203('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0203('0x21')][_0x0203('0x22')]({'port':0x232c});var client9002=jayson[_0x0203('0x21')][_0x0203('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2a4731,_0x3390b5,_0x1f9ee9,_0x174d6f){return new BPromise(function(_0x3a1aed,_0x59bad3){var _0x30be28=_0x174d6f||client;return _0x30be28[_0x0203('0x23')](_0x2a4731,_0x1f9ee9)[_0x0203('0x24')](function(_0x1d6e80){logger[_0x0203('0x25')](_0x0203('0x26'),_0x3390b5,'request\x20sent');logger[_0x0203('0x27')](_0x0203('0x28'),_0x3390b5,_0x0203('0x29'),JSON[_0x0203('0x2a')](_0x1d6e80));if(_0x1d6e80[_0x0203('0x2b')]){if(_0x1d6e80['error'][_0x0203('0x2c')]===0x1f4){logger[_0x0203('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x3390b5,_0x1d6e80[_0x0203('0x2b')]['message']);return _0x59bad3(_0x1d6e80[_0x0203('0x2b')][_0x0203('0x2d')]);}logger[_0x0203('0x2b')](_0x0203('0x26'),_0x3390b5,_0x1d6e80[_0x0203('0x2b')][_0x0203('0x2d')]);return _0x3a1aed(_0x1d6e80['error'][_0x0203('0x2d')]);}else{logger[_0x0203('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x3390b5,_0x0203('0x29'));_0x3a1aed(_0x1d6e80[_0x0203('0x2e')][_0x0203('0x2d')]);}})[_0x0203('0x2f')](function(_0x39c34c){logger[_0x0203('0x2b')](_0x0203('0x26'),_0x3390b5,_0x39c34c);_0x59bad3(_0x39c34c);});});}function respondWithStatusCode(_0x3a4dd5,_0x43a604){_0x43a604=_0x43a604||0xcc;return function(_0x2ff126){if(_0x2ff126){return _0x3a4dd5[_0x0203('0x30')](_0x43a604);}return _0x3a4dd5[_0x0203('0x31')](_0x43a604)['end']();};}function respondWithResult(_0x457d9b,_0xa1d4d7){_0xa1d4d7=_0xa1d4d7||0xc8;return function(_0x1ca1e5){if(_0x1ca1e5){return _0x457d9b[_0x0203('0x31')](_0xa1d4d7)[_0x0203('0x32')](_0x1ca1e5);}};}function respondWithFilteredResult(_0x1ea337,_0x2d0785){return function(_0x5b9c3c){if(_0x5b9c3c){var _0x35ea42=typeof _0x2d0785[_0x0203('0x33')]===_0x0203('0x34')&&typeof _0x2d0785[_0x0203('0x35')]==='undefined';var _0x4c0f3f=_0x5b9c3c[_0x0203('0x36')];var _0x17e1fb=_0x35ea42?0x0:_0x2d0785['offset'];var _0x26a68e=_0x35ea42?_0x5b9c3c['count']:_0x2d0785[_0x0203('0x33')]+_0x2d0785[_0x0203('0x35')];var _0x565aa8;if(_0x26a68e>=_0x4c0f3f){_0x26a68e=_0x4c0f3f;_0x565aa8=0xc8;}else{_0x565aa8=0xce;}_0x1ea337['status'](_0x565aa8);return _0x1ea337['set'](_0x0203('0x37'),_0x17e1fb+'-'+_0x26a68e+'/'+_0x4c0f3f)[_0x0203('0x32')](_0x5b9c3c);}return null;};}function patchUpdates(_0x56aef0){return function(_0x2354dd){try{jsonpatch['apply'](_0x2354dd,_0x56aef0,!![]);}catch(_0x1c0fd4){return BPromise[_0x0203('0x38')](_0x1c0fd4);}return _0x2354dd[_0x0203('0x39')]();};}function saveUpdates(_0x115149,_0x4e36fb){return function(_0x17f627){if(_0x17f627){return _0x17f627[_0x0203('0x3a')](_0x115149)[_0x0203('0x24')](function(_0x53af49){return _0x53af49;});}return null;};}function removeEntity(_0x3a290a,_0x270c0c){return function(_0x621c23){if(_0x621c23){return _0x621c23['destroy']()[_0x0203('0x24')](function(){var _0x2153d4=_0x621c23[_0x0203('0x3b')]({'plain':!![]});var _0x14b6f3=_0x0203('0x3c');return db[_0x0203('0x3d')][_0x0203('0x3e')]({'where':{'type':_0x14b6f3,'resourceId':_0x2153d4['id']}})[_0x0203('0x24')](function(){return _0x621c23;});})[_0x0203('0x24')](function(){_0x3a290a[_0x0203('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c0ef4,_0x7d8077){return function(_0x25fc05){if(!_0x25fc05){_0x4c0ef4['sendStatus'](0x194);}return _0x25fc05;};}function handleError(_0x1f2541,_0x5ef574){_0x5ef574=_0x5ef574||0x1f4;return function(_0x368451){logger['error'](_0x368451[_0x0203('0x3f')]);if(_0x368451[_0x0203('0x40')]){delete _0x368451[_0x0203('0x40')];}_0x1f2541[_0x0203('0x31')](_0x5ef574)[_0x0203('0x41')](_0x368451);};}exports['index']=function(_0x180f51,_0x553272){var _0x15daea={'include':[{'model':db[_0x0203('0x42')],'as':_0x0203('0x43')}]},_0x364f30={},_0xd151be={'count':0x0,'rows':[]};var _0x108e3e=_[_0x0203('0x44')](db[_0x0203('0x45')]['rawAttributes'],function(_0x2b9f20){return{'name':_0x2b9f20[_0x0203('0x46')],'type':_0x2b9f20[_0x0203('0x47')]['key']};});_0x364f30[_0x0203('0x48')]=_['map'](_0x108e3e,_0x0203('0x40'));_0x364f30[_0x0203('0x49')]=_['keys'](_0x180f51['query']);_0x364f30[_0x0203('0x4a')]=_['intersection'](_0x364f30[_0x0203('0x48')],_0x364f30[_0x0203('0x49')]);_0x15daea[_0x0203('0x4b')]=_[_0x0203('0x4c')](_0x364f30[_0x0203('0x48')],qs[_0x0203('0x4d')](_0x180f51[_0x0203('0x49')][_0x0203('0x4d')]));_0x15daea[_0x0203('0x4b')]=_0x15daea[_0x0203('0x4b')][_0x0203('0x4e')]?_0x15daea[_0x0203('0x4b')]:_0x364f30['model'];if(!_0x180f51[_0x0203('0x49')][_0x0203('0x4f')](_0x0203('0x50'))){_0x15daea[_0x0203('0x35')]=qs['limit'](_0x180f51['query']['limit']);_0x15daea['offset']=qs[_0x0203('0x33')](_0x180f51[_0x0203('0x49')][_0x0203('0x33')]);}_0x15daea[_0x0203('0x51')]=qs[_0x0203('0x52')](_0x180f51[_0x0203('0x49')][_0x0203('0x52')]);_0x15daea['where']=qs['filters'](_[_0x0203('0x53')](_0x180f51[_0x0203('0x49')],_0x364f30[_0x0203('0x4a')]),_0x108e3e);if(_0x180f51[_0x0203('0x49')][_0x0203('0x54')]){_0x15daea[_0x0203('0x55')]=_['merge'](_0x15daea[_0x0203('0x55')],{'$or':_['map'](_0x108e3e,function(_0x20819f){if(_0x20819f[_0x0203('0x47')]!==_0x0203('0x56')){var _0x59077f={};_0x59077f[_0x20819f[_0x0203('0x40')]]={'$like':'%'+_0x180f51[_0x0203('0x49')][_0x0203('0x54')]+'%'};return _0x59077f;}})});}_0x15daea=_['merge']({},_0x15daea,_0x180f51[_0x0203('0x57')]);var _0x4e5995={'where':_0x15daea[_0x0203('0x55')]};return db[_0x0203('0x45')][_0x0203('0x36')](_0x4e5995)['then'](function(_0x4c51d3){_0xd151be[_0x0203('0x36')]=_0x4c51d3;if(_0x180f51[_0x0203('0x49')][_0x0203('0x58')]){_0x15daea[_0x0203('0x59')]=[{'all':!![]}];}return db[_0x0203('0x45')][_0x0203('0x5a')](_0x15daea);})[_0x0203('0x24')](function(_0x2949d7){_0xd151be['rows']=_0x2949d7;return _0xd151be;})[_0x0203('0x24')](respondWithFilteredResult(_0x553272,_0x15daea))['catch'](handleError(_0x553272,null));};exports[_0x0203('0x5b')]=function(_0x5e46a4,_0x5a4792){var _0x41153a={'raw':![],'where':{'id':_0x5e46a4['params']['id']},'include':[{'model':db[_0x0203('0x42')],'as':'mandatoryDispositionPause'}]},_0x34ed42={};_0x34ed42['model']=_[_0x0203('0x5c')](db[_0x0203('0x45')]['rawAttributes']);_0x34ed42[_0x0203('0x49')]=_['keys'](_0x5e46a4[_0x0203('0x49')]);_0x34ed42['filters']=_[_0x0203('0x4c')](_0x34ed42['model'],_0x34ed42[_0x0203('0x49')]);_0x41153a[_0x0203('0x4b')]=_[_0x0203('0x4c')](_0x34ed42[_0x0203('0x48')],qs[_0x0203('0x4d')](_0x5e46a4[_0x0203('0x49')][_0x0203('0x4d')]));_0x41153a[_0x0203('0x4b')]=_0x41153a[_0x0203('0x4b')][_0x0203('0x4e')]?_0x41153a['attributes']:_0x34ed42[_0x0203('0x48')];if(_0x5e46a4['query']['includeAll']){_0x41153a[_0x0203('0x59')]=[{'all':!![]}];}_0x41153a=_[_0x0203('0x5d')]({},_0x41153a,_0x5e46a4[_0x0203('0x57')]);return db[_0x0203('0x45')]['find'](_0x41153a)[_0x0203('0x24')](handleEntityNotFound(_0x5a4792,null))['then'](respondWithResult(_0x5a4792,null))['catch'](handleError(_0x5a4792,null));};exports['create']=function(_0x4826f7,_0x2974a4){return db[_0x0203('0x45')][_0x0203('0x5e')](_0x4826f7[_0x0203('0x5f')],{})[_0x0203('0x24')](function(_0x40e0c1){var _0x485ef7=_0x4826f7['user'][_0x0203('0x3b')]({'plain':!![]});if(!_0x485ef7)throw new Error(_0x0203('0x60'));if(_0x485ef7[_0x0203('0x61')]===_0x0203('0x62')){var _0x4dfd83=_0x40e0c1[_0x0203('0x3b')]({'plain':!![]});var _0xfd42a='OpenchannelAccounts';return db[_0x0203('0x63')][_0x0203('0x64')]({'where':{'name':_0xfd42a,'userProfileId':_0x485ef7['userProfileId']},'raw':!![]})['then'](function(_0x121d4a){if(_0x121d4a&&_0x121d4a['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4dfd83['name'],'resourceId':_0x4dfd83['id'],'type':_0x121d4a['name'],'sectionId':_0x121d4a['id']},{})[_0x0203('0x24')](function(){return _0x40e0c1;});}else{return _0x40e0c1;}})[_0x0203('0x2f')](function(_0x5c6f65){logger[_0x0203('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c6f65);throw _0x5c6f65;});}return _0x40e0c1;})[_0x0203('0x24')](respondWithResult(_0x2974a4,0xc9))[_0x0203('0x2f')](handleError(_0x2974a4,null));};exports['update']=function(_0x158f43,_0x2f4948){if(_0x158f43[_0x0203('0x5f')]['id']){delete _0x158f43[_0x0203('0x5f')]['id'];}return db[_0x0203('0x45')]['find']({'where':{'id':_0x158f43[_0x0203('0x65')]['id']},'include':[{'model':db['Pause'],'as':_0x0203('0x43')}]})[_0x0203('0x24')](handleEntityNotFound(_0x2f4948,null))[_0x0203('0x24')](saveUpdates(_0x158f43['body'],null))[_0x0203('0x24')](respondWithResult(_0x2f4948,null))[_0x0203('0x2f')](handleError(_0x2f4948,null));};exports[_0x0203('0x3e')]=function(_0x1077da,_0x524f55){return db[_0x0203('0x45')][_0x0203('0x64')]({'where':{'id':_0x1077da['params']['id']}})['then'](handleEntityNotFound(_0x524f55,null))['then'](removeEntity(_0x524f55,null))[_0x0203('0x2f')](handleError(_0x524f55,null));};exports[_0x0203('0x66')]=function(_0x381210,_0x591381){return db['OpenchannelAccount'][_0x0203('0x66')]()['then'](respondWithResult(_0x591381,null))['catch'](handleError(_0x591381,null));};exports[_0x0203('0x67')]=function(_0x58b773,_0x404d1b,_0x59568a){if(_0x58b773['body']['id']){delete _0x58b773[_0x0203('0x5f')]['id'];}return db[_0x0203('0x45')][_0x0203('0x64')]({'where':{'id':_0x58b773[_0x0203('0x65')]['id']}})['then'](handleEntityNotFound(_0x404d1b,null))[_0x0203('0x24')](function(_0x1b81cb){if(_0x1b81cb){_0x58b773['body'][_0x0203('0x68')]=_0x1b81cb['id'];return db[_0x0203('0x69')][_0x0203('0x5e')](_0x58b773[_0x0203('0x5f')]);}})[_0x0203('0x24')](respondWithResult(_0x404d1b,null))[_0x0203('0x2f')](handleError(_0x404d1b,null));};exports[_0x0203('0x6a')]=function(_0x138294,_0x8f3d26,_0x235dfc){var _0x157fa3={'raw':![],'where':{}};var _0x132db6={};var _0x3922ed={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0203('0x6b')]({'where':{'id':_0x138294[_0x0203('0x65')]['id']}})[_0x0203('0x24')](handleEntityNotFound(_0x8f3d26,null))[_0x0203('0x24')](function(_0x3cf13e){if(_0x3cf13e){_0x132db6[_0x0203('0x48')]=_[_0x0203('0x5c')](db[_0x0203('0x69')][_0x0203('0x6c')]);_0x132db6['query']=_[_0x0203('0x5c')](_0x138294[_0x0203('0x49')]);_0x132db6[_0x0203('0x4a')]=_[_0x0203('0x4c')](_0x132db6[_0x0203('0x48')],_0x132db6[_0x0203('0x49')]);_0x157fa3[_0x0203('0x4b')]=_[_0x0203('0x4c')](_0x132db6[_0x0203('0x48')],qs[_0x0203('0x4d')](_0x138294[_0x0203('0x49')][_0x0203('0x4d')]));_0x157fa3[_0x0203('0x4b')]=_0x157fa3['attributes'][_0x0203('0x4e')]?_0x157fa3[_0x0203('0x4b')]:_0x132db6[_0x0203('0x48')];if(!_0x138294[_0x0203('0x49')][_0x0203('0x4f')]('nolimit')){_0x157fa3[_0x0203('0x35')]=qs[_0x0203('0x35')](_0x138294[_0x0203('0x49')][_0x0203('0x35')]);_0x157fa3[_0x0203('0x33')]=qs['offset'](_0x138294[_0x0203('0x49')]['offset']);}_0x157fa3[_0x0203('0x51')]=qs[_0x0203('0x52')](_0x138294[_0x0203('0x49')][_0x0203('0x52')]);_0x157fa3['where']=qs[_0x0203('0x4a')](_['pick'](_0x138294['query'],_0x132db6['filters']));_0x157fa3['where'][_0x0203('0x68')]=_0x3cf13e['id'];if(_0x138294['query']['filter']){_0x157fa3[_0x0203('0x55')]=_['merge'](_0x157fa3[_0x0203('0x55')],{'$or':_['map'](_0x157fa3[_0x0203('0x4b')],function(_0x196611){var _0x4b158a={};_0x4b158a[_0x196611]={'$like':'%'+_0x138294[_0x0203('0x49')][_0x0203('0x54')]+'%'};return _0x4b158a;})});}_0x157fa3=_[_0x0203('0x5d')]({},_0x157fa3,_0x138294[_0x0203('0x57')]);return db[_0x0203('0x69')][_0x0203('0x36')]({'where':_0x157fa3[_0x0203('0x55')]})[_0x0203('0x24')](function(_0x2abdbc){_0x3922ed['count']=_0x2abdbc;if(_0x138294['query'][_0x0203('0x58')]){_0x157fa3[_0x0203('0x59')]=[{'all':!![]}];}return db[_0x0203('0x69')]['findAll'](_0x157fa3);})[_0x0203('0x24')](function(_0x3facb7){_0x3922ed[_0x0203('0x6d')]=_0x3facb7;return _0x3922ed;});}})['then'](respondWithFilteredResult(_0x8f3d26,_0x157fa3))[_0x0203('0x2f')](handleError(_0x8f3d26,null));};exports[_0x0203('0x6e')]=function(_0x1b07b2,_0x3cc498,_0x2ce6dd){return db[_0x0203('0x45')][_0x0203('0x64')]({'where':{'id':_0x1b07b2[_0x0203('0x65')]['id']}})['then'](handleEntityNotFound(_0x3cc498,null))['then'](function(_0x807fd6){if(_0x807fd6){return _0x807fd6[_0x0203('0x6e')](_0x1b07b2[_0x0203('0x49')][_0x0203('0x6f')]);}})[_0x0203('0x24')](respondWithStatusCode(_0x3cc498,null))[_0x0203('0x2f')](handleError(_0x3cc498,null));};exports[_0x0203('0x70')]=function(_0x3c25cd,_0xb98942,_0x2dc346){if(_0x3c25cd[_0x0203('0x5f')]['id']){delete _0x3c25cd['body']['id'];}return db[_0x0203('0x45')]['find']({'where':{'id':_0x3c25cd[_0x0203('0x65')]['id']}})[_0x0203('0x24')](handleEntityNotFound(_0xb98942,null))[_0x0203('0x24')](function(_0x4bc62d){if(_0x4bc62d){_0x3c25cd[_0x0203('0x5f')][_0x0203('0x68')]=_0x4bc62d['id'];return db[_0x0203('0x71')][_0x0203('0x5e')](_0x3c25cd[_0x0203('0x5f')]);}})['then'](respondWithResult(_0xb98942,null))[_0x0203('0x2f')](handleError(_0xb98942,null));};exports[_0x0203('0x72')]=function(_0x3fc449,_0x3e416c,_0x157a6c){var _0x37d2d3={'raw':![],'where':{}};var _0x31152d={};var _0x3b6f9b={'count':0x0,'rows':[]};return db[_0x0203('0x45')][_0x0203('0x6b')]({'where':{'id':_0x3fc449[_0x0203('0x65')]['id']}})[_0x0203('0x24')](handleEntityNotFound(_0x3e416c,null))[_0x0203('0x24')](function(_0x2c54bd){if(_0x2c54bd){_0x31152d[_0x0203('0x48')]=_[_0x0203('0x5c')](db['CannedAnswer']['rawAttributes']);_0x31152d[_0x0203('0x49')]=_[_0x0203('0x5c')](_0x3fc449['query']);_0x31152d['filters']=_[_0x0203('0x4c')](_0x31152d['model'],_0x31152d['query']);_0x37d2d3[_0x0203('0x4b')]=_[_0x0203('0x4c')](_0x31152d[_0x0203('0x48')],qs[_0x0203('0x4d')](_0x3fc449[_0x0203('0x49')][_0x0203('0x4d')]));_0x37d2d3['attributes']=_0x37d2d3[_0x0203('0x4b')]['length']?_0x37d2d3[_0x0203('0x4b')]:_0x31152d[_0x0203('0x48')];if(!_0x3fc449[_0x0203('0x49')]['hasOwnProperty'](_0x0203('0x50'))){_0x37d2d3[_0x0203('0x35')]=qs[_0x0203('0x35')](_0x3fc449[_0x0203('0x49')]['limit']);_0x37d2d3['offset']=qs[_0x0203('0x33')](_0x3fc449['query']['offset']);}_0x37d2d3['order']=qs[_0x0203('0x52')](_0x3fc449['query'][_0x0203('0x52')]);_0x37d2d3[_0x0203('0x55')]=qs[_0x0203('0x4a')](_[_0x0203('0x53')](_0x3fc449[_0x0203('0x49')],_0x31152d[_0x0203('0x4a')]));_0x37d2d3['where'][_0x0203('0x68')]=_0x2c54bd['id'];if(_0x3fc449[_0x0203('0x49')][_0x0203('0x54')]){_0x37d2d3[_0x0203('0x55')]=_['merge'](_0x37d2d3[_0x0203('0x55')],{'$or':_[_0x0203('0x44')](_0x37d2d3[_0x0203('0x4b')],function(_0x217974){var _0x535165={};_0x535165[_0x217974]={'$like':'%'+_0x3fc449[_0x0203('0x49')][_0x0203('0x54')]+'%'};return _0x535165;})});}_0x37d2d3=_[_0x0203('0x5d')]({},_0x37d2d3,_0x3fc449[_0x0203('0x57')]);return db[_0x0203('0x71')][_0x0203('0x36')]({'where':_0x37d2d3[_0x0203('0x55')]})[_0x0203('0x24')](function(_0x1775b1){_0x3b6f9b['count']=_0x1775b1;if(_0x3fc449[_0x0203('0x49')][_0x0203('0x58')]){_0x37d2d3[_0x0203('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0203('0x5a')](_0x37d2d3);})[_0x0203('0x24')](function(_0x2b0600){_0x3b6f9b[_0x0203('0x6d')]=_0x2b0600;return _0x3b6f9b;});}})[_0x0203('0x24')](respondWithFilteredResult(_0x3e416c,_0x37d2d3))[_0x0203('0x2f')](handleError(_0x3e416c,null));};exports[_0x0203('0x73')]=function(_0x54c9c1,_0x4c70de,_0x295841){return db[_0x0203('0x45')]['find']({'where':{'id':_0x54c9c1[_0x0203('0x65')]['id']}})[_0x0203('0x24')](handleEntityNotFound(_0x4c70de,null))[_0x0203('0x24')](function(_0x360d5e){if(_0x360d5e){return _0x360d5e[_0x0203('0x73')](_0x54c9c1[_0x0203('0x49')][_0x0203('0x6f')]);}})['then'](respondWithStatusCode(_0x4c70de,null))['catch'](handleError(_0x4c70de,null));};exports[_0x0203('0x74')]=function(_0x26ef4a,_0x3c4dac,_0x4df95b){var _0x3ca06b={'body':_0x26ef4a[_0x0203('0x5f')],'channel':'openchannel'};var _0x14af35=[];var _0x3dbe9a=[];var _0x12fbf9={};var _0x1dabd9=![];return db[_0x0203('0x75')][_0x0203('0x66')]()['then'](function(_0x2b8d61){if(!_0x2b8d61){throw new db[(_0x0203('0x76'))][(_0x0203('0x77'))](_0x0203('0x78'));}_0x14af35=_['difference'](_[_0x0203('0x5c')](_0x2b8d61),[_0x0203('0x79'),_0x0203('0x7a')]);_0x3dbe9a=_[_0x0203('0x7b')](_[_0x0203('0x5c')](_0x2b8d61),[_0x0203('0x79'),'updatedAt',_0x0203('0x7c'),_0x0203('0x7d')]);if(_0x26ef4a['body']['id']){delete _0x26ef4a[_0x0203('0x5f')]['id'];}if(_[_0x0203('0x7e')](_0x26ef4a[_0x0203('0x5f')]['from'])){throw new db['Sequelize']['ValidationError'](_0x0203('0x7f'));}if(_[_0x0203('0x7e')](_0x26ef4a['body'][_0x0203('0x5f')])||_0x26ef4a[_0x0203('0x5f')][_0x0203('0x5f')]===''){throw new db[(_0x0203('0x76'))][(_0x0203('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0203('0x7e')](_0x26ef4a[_0x0203('0x5f')][_0x0203('0x80')])){throw new db[(_0x0203('0x76'))]['ValidationError'](_0x0203('0x81')+_0x3dbe9a);}if(!_[_0x0203('0x82')](_0x3dbe9a,_0x26ef4a[_0x0203('0x5f')]['mapKey'])){throw new db[(_0x0203('0x76'))][(_0x0203('0x77'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3dbe9a);}_0x12fbf9[_0x26ef4a[_0x0203('0x5f')][_0x0203('0x80')]]=_0x26ef4a['body'][_0x0203('0x83')];})[_0x0203('0x24')](function(){return db[_0x0203('0x45')][_0x0203('0x64')]({'where':{'id':_0x26ef4a[_0x0203('0x65')]['id']},'include':[{'model':db[_0x0203('0x84')],'as':_0x0203('0x85'),'include':[{'model':db['CmContact'],'as':_0x0203('0x86'),'where':_0x12fbf9,'limit':0x1,'order':[[_0x0203('0x7a'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x0203('0x87')}]});})[_0x0203('0x24')](handleEntityNotFound(_0x3c4dac,null))[_0x0203('0x24')](function(_0x41086d){if(_0x41086d&&_0x41086d[_0x0203('0x85')]){_0x3ca06b[_0x0203('0x88')]=_0x41086d;_0x3ca06b['applications']=_0x41086d['Applications'];_0x3ca06b[_0x0203('0x89')]=_0x41086d[_0x0203('0x85')];_0x3ca06b[_0x0203('0x8a')]=_[_0x0203('0x8b')](_0x3ca06b[_0x0203('0x8a')],['priority'],['asc']);if(_0x3ca06b[_0x0203('0x88')]['Applications']){delete _0x3ca06b[_0x0203('0x88')][_0x0203('0x87')];}if(_0x3ca06b['account'][_0x0203('0x85')]&&_0x3ca06b[_0x0203('0x88')]['List']['Contacts']['length']){return _0x3ca06b[_0x0203('0x88')][_0x0203('0x85')][_0x0203('0x86')][0x0];}var _0x3fdd2d=_[_0x0203('0x1c')](_0x26ef4a['body'],{'firstName':_0x26ef4a[_0x0203('0x5f')][_0x0203('0x83')],'ListId':_0x41086d[_0x0203('0x7d')]});_0x3fdd2d[_0x26ef4a[_0x0203('0x5f')][_0x0203('0x80')]]=_0x26ef4a[_0x0203('0x5f')]['from'];return db[_0x0203('0x75')][_0x0203('0x5e')](_0x3fdd2d,{'fields':_0x14af35,'raw':!![]});}})['then'](handleEntityNotFound(_0x3c4dac,null))[_0x0203('0x24')](function(_0x8d7d41){_0x3ca06b[_0x0203('0x8c')]=_0x8d7d41;if(_0x8d7d41){var _0x4219bc={'ContactId':_0x8d7d41['id'],'OpenchannelAccountId':_0x26ef4a['params']['id'],'from':(_0x8d7d41[_0x0203('0x8d')]||'')+'\x20'+(_0x8d7d41[_0x0203('0x8e')]||'')};var _0x51330e={'OpenchannelAccountId':_0x26ef4a['params']['id'],'closed':![]};if(_0x26ef4a[_0x0203('0x5f')]['threadId']){_0x51330e[_0x0203('0x8f')]=_0x26ef4a[_0x0203('0x5f')]['threadId'];return db[_0x0203('0x90')][_0x0203('0x64')]({'where':_0x51330e})[_0x0203('0x24')](function(_0x218f4d){if(_0x218f4d){return[_0x218f4d,![]];}_0x4219bc['threadId']=_0x26ef4a[_0x0203('0x5f')][_0x0203('0x8f')];_0x4219bc[_0x0203('0x91')]=_0x26ef4a[_0x0203('0x5f')]['externalUrl'];return db[_0x0203('0x90')]['create'](_0x4219bc)[_0x0203('0x24')](function(_0x40d3cc){return[_0x40d3cc,!![]];});});}else{_0x51330e[_0x0203('0x8f')]=null;}_0x51330e['ContactId']=_0x8d7d41['id'];return db[_0x0203('0x90')][_0x0203('0x64')]({'where':_0x51330e})['then'](function(_0x58cd62){if(_0x58cd62){return[_0x58cd62,![]];}return db['OpenchannelInteraction']['create'](_0x4219bc)[_0x0203('0x24')](function(_0x45278b){return[_0x45278b,!![]];});});}})[_0x0203('0x92')](function(_0x3c24ce,_0x187f20){if(_0x3c24ce){_0x1dabd9=_0x187f20;if(!_0x187f20){var _0x56220a={'from':(_0x3ca06b['contact'][_0x0203('0x8d')]||'')+'\x20'+(_0x3ca06b[_0x0203('0x8c')][_0x0203('0x8e')]||'')};if(_0x26ef4a['body'][_0x0203('0x8f')]&&_0x26ef4a[_0x0203('0x5f')][_0x0203('0x93')]&&_0x26ef4a[_0x0203('0x5f')][_0x0203('0x8f')]!=_0x26ef4a[_0x0203('0x5f')]['messageId']){_0x56220a[_0x0203('0x8f')]=_0x26ef4a[_0x0203('0x5f')][_0x0203('0x93')];}return _0x3c24ce[_0x0203('0x3a')](_0x56220a);}else{return _0x3c24ce;}}})[_0x0203('0x24')](function(_0x51aabd){_0x3ca06b[_0x0203('0x94')]=_0x51aabd[_0x0203('0x3b')]({'plain':!![]});_0x3ca06b['interaction'][_0x0203('0x95')]=_0x1dabd9;if(_0x3ca06b[_0x0203('0x94')][_0x0203('0x95')]){if(_0x3ca06b[_0x0203('0x88')][_0x0203('0x96')]){_0x3ca06b['applications']['push']({'id':0x0,'priority':_0x3ca06b['applications'][_0x0203('0x4e')]+0x1,'app':'close','appdata':_0x0203('0x97'),'interval':'*,*,*,*'});}}return db[_0x0203('0x98')][_0x0203('0x5e')]({'body':_0x26ef4a['body'][_0x0203('0x5f')],'OpenchannelAccountId':_0x26ef4a[_0x0203('0x65')]['id'],'OpenchannelInteractionId':_0x51aabd['id'],'direction':'in','ContactId':_0x3ca06b[_0x0203('0x8c')]['id'],'AttachmentId':_0x26ef4a[_0x0203('0x5f')][_0x0203('0x99')]});})[_0x0203('0x24')](function(_0x43d2a3){_0x3ca06b[_0x0203('0x2d')]=_0x43d2a3;if(_0x3ca06b[_0x0203('0x94')]['UserId']){return db['User'][_0x0203('0x64')]({'attributes':['id',_0x0203('0x40')],'where':{'id':_0x3ca06b[_0x0203('0x94')][_0x0203('0x9a')]}})[_0x0203('0x24')](function(_0x3f7cd2){if(_0x3f7cd2){_0x3ca06b[_0x0203('0x8a')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0203('0x9b'),'appdata':_0x3f7cd2[_0x0203('0x40')]+','+(_0x3ca06b[_0x0203('0x88')][_0x0203('0x9c')]||0xa),'interval':'*,*,*,*'});_0x3ca06b[_0x0203('0x9d')]=![];}return respondWithRpcPromise('Start',_0x0203('0x9e'),_0x3ca06b);});}return respondWithRpcPromise(_0x0203('0x9f'),_0x0203('0x9e'),_0x3ca06b);})['then'](function(_0x46d43c){respondWithRpcPromise(_0x0203('0xa0'),_0x0203('0xa0'),{'event':_0x0203('0x74'),'message':_0x46d43c},client9002);return _0x46d43c;})[_0x0203('0x24')](respondWithResult(_0x3c4dac,null))[_0x0203('0x2f')](handleError(_0x3c4dac,null));};exports['addApplications']=function(_0x71806f,_0x1668e6){var _0xb7c6c2=_0x71806f[_0x0203('0x65')]['id'];var _0x24e676=_0x71806f[_0x0203('0x5f')];var _0x2cef5c=0xc8;var _0xd53c75=null;return db[_0x0203('0xa1')]['transaction']({'isolationLevel':db[_0x0203('0xa1')][_0x0203('0xa2')][_0x0203('0xa3')][_0x0203('0xa4')]},function(_0x57e026){return db[_0x0203('0x45')]['findOne']({'where':{'id':_0xb7c6c2},'transaction':_0x57e026})[_0x0203('0x24')](function(_0x4f05f9){if(_0x4f05f9){return db[_0x0203('0xa5')][_0x0203('0x3e')]({'where':{'OpenchannelAccountId':_0xb7c6c2},'transaction':_0x57e026})[_0x0203('0x24')](function(){var _0x82a1f4=_['map'](_0x24e676,function(_0x1048fe){_0x1048fe[_0x0203('0x68')]=_0xb7c6c2;return _0x1048fe;});return db[_0x0203('0xa5')][_0x0203('0xa6')](_0x82a1f4,{'transaction':_0x57e026});});}else{_0x2cef5c=0x194;_0xd53c75=[];}});})[_0x0203('0x24')](function(){if(_0x2cef5c!==0x194){return db[_0x0203('0xa5')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0xb7c6c2},'order':_0x0203('0xa7')})[_0x0203('0x24')](function(_0x31d79c){_0xd53c75=_0x31d79c;});}})['catch'](function(_0x35371c){_0x2cef5c=0x1f4;logger[_0x0203('0x2b')](_0x35371c[_0x0203('0x3f')]);if(_0x35371c[_0x0203('0x40')]){delete _0x35371c[_0x0203('0x40')];}_0xd53c75=_0x35371c;})[_0x0203('0xa8')](function(){if(_0xd53c75===null){_0x1668e6[_0x0203('0x30')](_0x2cef5c);}else{if(_0x2cef5c===0x1f4){_0x1668e6['status'](_0x2cef5c)[_0x0203('0x41')](_0xd53c75);}else{_0x1668e6['status'](_0x2cef5c)[_0x0203('0x32')](_0xd53c75);}}});};exports[_0x0203('0xa9')]=function(_0x2a2ab5,_0x39163a,_0x5aa93e){var _0x4afa33={};var _0x4ee123={};var _0x3aca44;var _0x521afe;return db[_0x0203('0x45')]['findOne']({'where':{'id':_0x2a2ab5[_0x0203('0x65')]['id']}})['then'](handleEntityNotFound(_0x39163a,null))['then'](function(_0x2c8e80){if(_0x2c8e80){_0x3aca44=_0x2c8e80;_0x4ee123[_0x0203('0x48')]=_[_0x0203('0x5c')](db['OpenchannelApplication'][_0x0203('0x6c')]);_0x4ee123[_0x0203('0x49')]=_['keys'](_0x2a2ab5[_0x0203('0x49')]);_0x4ee123[_0x0203('0x4a')]=_[_0x0203('0x4c')](_0x4ee123[_0x0203('0x48')],_0x4ee123[_0x0203('0x49')]);_0x4afa33['attributes']=_['intersection'](_0x4ee123[_0x0203('0x48')],qs[_0x0203('0x4d')](_0x2a2ab5[_0x0203('0x49')][_0x0203('0x4d')]));_0x4afa33[_0x0203('0x4b')]=_0x4afa33['attributes']['length']?_0x4afa33['attributes']:_0x4ee123[_0x0203('0x48')];_0x4afa33[_0x0203('0x51')]=qs['sort'](_0x2a2ab5[_0x0203('0x49')][_0x0203('0x52')]);_0x4afa33[_0x0203('0x55')]=qs[_0x0203('0x4a')](_['pick'](_0x2a2ab5[_0x0203('0x49')],_0x4ee123[_0x0203('0x4a')]));if(_0x2a2ab5[_0x0203('0x49')][_0x0203('0x54')]){_0x4afa33[_0x0203('0x55')]=_[_0x0203('0x5d')](_0x4afa33[_0x0203('0x55')],{'$or':_[_0x0203('0x44')](_0x4afa33[_0x0203('0x4b')],function(_0x4a7250){var _0x29c6d2={};_0x29c6d2[_0x4a7250]={'$like':'%'+_0x2a2ab5[_0x0203('0x49')][_0x0203('0x54')]+'%'};return _0x29c6d2;})});}_0x4afa33=_['merge']({},_0x4afa33,_0x2a2ab5[_0x0203('0x57')]);return _0x3aca44[_0x0203('0xa9')](_0x4afa33);}})[_0x0203('0x24')](function(_0x37cf09){if(_0x37cf09){_0x521afe=_0x37cf09[_0x0203('0x4e')];if(!_0x2a2ab5['query'][_0x0203('0x4f')](_0x0203('0x50'))){_0x4afa33[_0x0203('0x35')]=qs['limit'](_0x2a2ab5[_0x0203('0x49')]['limit']);_0x4afa33['offset']=qs[_0x0203('0x33')](_0x2a2ab5['query'][_0x0203('0x33')]);}return _0x3aca44['getApplications'](_0x4afa33);}})['then'](function(_0x1268c9){if(_0x1268c9){return _0x1268c9?{'count':_0x521afe,'rows':_0x1268c9}:null;}})[_0x0203('0x24')](respondWithResult(_0x39163a,null))[_0x0203('0x2f')](handleError(_0x39163a,null));};exports[_0x0203('0xaa')]=function(_0x386d6f,_0x513c30,_0x3383bc){var _0x309cd5={'raw':![],'where':{}};var _0x5dbe7c={};var _0x5bad1e={'count':0x0,'rows':[]};return db[_0x0203('0x45')][_0x0203('0x6b')]({'where':{'id':_0x386d6f[_0x0203('0x65')]['id']}})[_0x0203('0x24')](handleEntityNotFound(_0x513c30,null))[_0x0203('0x24')](function(_0x1d8040){if(_0x1d8040){_0x5dbe7c[_0x0203('0x48')]=_['keys'](db[_0x0203('0x90')][_0x0203('0x6c')]);_0x5dbe7c[_0x0203('0x49')]=_['keys'](_0x386d6f['query']);_0x5dbe7c['filters']=_['intersection'](_0x5dbe7c[_0x0203('0x48')],_0x5dbe7c['query']);_0x309cd5[_0x0203('0x4b')]=_[_0x0203('0x4c')](_0x5dbe7c[_0x0203('0x48')],qs[_0x0203('0x4d')](_0x386d6f[_0x0203('0x49')]['fields']));_0x309cd5[_0x0203('0x4b')]=_0x309cd5[_0x0203('0x4b')]['length']?_0x309cd5['attributes']:_0x5dbe7c['model'];if(!_0x386d6f[_0x0203('0x49')]['hasOwnProperty'](_0x0203('0x50'))){_0x309cd5[_0x0203('0x35')]=qs['limit'](_0x386d6f[_0x0203('0x49')][_0x0203('0x35')]);_0x309cd5['offset']=qs[_0x0203('0x33')](_0x386d6f[_0x0203('0x49')][_0x0203('0x33')]);}_0x309cd5[_0x0203('0x51')]=qs[_0x0203('0x52')](_0x386d6f[_0x0203('0x49')]['sort']);_0x309cd5[_0x0203('0x55')]=qs['filters'](_[_0x0203('0x53')](_0x386d6f[_0x0203('0x49')],_0x5dbe7c[_0x0203('0x4a')]));_0x309cd5['where']['OpenchannelAccountId']=_0x1d8040['id'];if(_0x386d6f[_0x0203('0x49')][_0x0203('0x54')]){_0x309cd5['where']=_['merge'](_0x309cd5[_0x0203('0x55')],{'$or':_[_0x0203('0x44')](_0x309cd5[_0x0203('0x4b')],function(_0x402105){var _0x5dac66={};_0x5dac66[_0x402105]={'$like':'%'+_0x386d6f[_0x0203('0x49')]['filter']+'%'};return _0x5dac66;})});}_0x309cd5=_[_0x0203('0x5d')]({},_0x309cd5,_0x386d6f[_0x0203('0x57')]);return db[_0x0203('0x90')][_0x0203('0x36')]({'where':_0x309cd5['where']})[_0x0203('0x24')](function(_0x35076f){_0x5bad1e[_0x0203('0x36')]=_0x35076f;if(_0x386d6f[_0x0203('0x49')][_0x0203('0x58')]){_0x309cd5[_0x0203('0x59')]=[{'model':db['CmContact'],'as':_0x0203('0xab'),'required':![]},{'model':db['User'],'as':_0x0203('0xac'),'attributes':[_0x0203('0x40'),'fullname',_0x0203('0xad')],'required':![]},{'model':db[_0x0203('0xae')],'as':'Tags','attributes':['id',_0x0203('0x40'),_0x0203('0xaf')],'where':_0x386d6f[_0x0203('0x49')][_0x0203('0xb0')]?{'id':_0x386d6f['query']['tag']}:undefined,'required':_0x386d6f['query']['tag']?!![]:![]}];}return db[_0x0203('0x90')][_0x0203('0x5a')](_0x309cd5);})[_0x0203('0x24')](function(_0x346239){_0x5bad1e[_0x0203('0x6d')]=_0x346239;return _0x5bad1e;});}})['then'](respondWithFilteredResult(_0x513c30,_0x309cd5))[_0x0203('0x2f')](handleError(_0x513c30,null));};exports[_0x0203('0xb1')]=function(_0x3fb831,_0x4d07a9,_0x4afa85){return db[_0x0203('0x45')]['find']({'where':{'id':_0x3fb831[_0x0203('0x65')]['id']}})[_0x0203('0x24')](handleEntityNotFound(_0x4d07a9,null))[_0x0203('0x24')](function(_0x156de6){if(_0x156de6){return _0x156de6[_0x0203('0xb1')](_0x3fb831[_0x0203('0x5f')]['ids'],_[_0x0203('0xb2')](_0x3fb831[_0x0203('0x5f')],[_0x0203('0x6f'),'id'])||{})[_0x0203('0x92')](function(_0x1df34f){for(var _0x2a35fb=0x0;_0x2a35fb<_0x3fb831[_0x0203('0x5f')][_0x0203('0x6f')][_0x0203('0x4e')];_0x2a35fb+=0x1){socket[_0x0203('0xb3')](_0x0203('0xb4'),{'UserId':Number(_0x3fb831[_0x0203('0x5f')][_0x0203('0x6f')][_0x2a35fb]),'OpenchannelAccountId':Number(_0x3fb831[_0x0203('0x65')]['id'])});}return _0x1df34f;});}})[_0x0203('0x24')](respondWithResult(_0x4d07a9,null))['catch'](handleError(_0x4d07a9,null));};exports[_0x0203('0xb5')]=function(_0x17f176,_0x2b19b0,_0x374708){return db['OpenchannelAccount'][_0x0203('0x64')]({'where':{'id':_0x17f176[_0x0203('0x65')]['id']}})[_0x0203('0x24')](handleEntityNotFound(_0x2b19b0,null))['then'](function(_0x52387d){if(_0x52387d){return _0x52387d[_0x0203('0xb5')](_0x17f176[_0x0203('0x49')][_0x0203('0x6f')])[_0x0203('0x24')](function(){if(_[_0x0203('0xb6')](_0x17f176['query']['ids'])){for(var _0x50d169=0x0;_0x50d169<_0x17f176[_0x0203('0x49')][_0x0203('0x6f')][_0x0203('0x4e')];_0x50d169+=0x1){socket[_0x0203('0xb3')](_0x0203('0xb7'),{'UserId':Number(_0x17f176[_0x0203('0x49')][_0x0203('0x6f')][_0x50d169]),'OpenchannelAccountId':Number(_0x17f176['params']['id'])});}}else{socket[_0x0203('0xb3')]('userOpenchannelAccount:remove',{'UserId':Number(_0x17f176[_0x0203('0x49')][_0x0203('0x6f')]),'OpenchannelAccountId':Number(_0x17f176['params']['id'])});}});}})[_0x0203('0x24')](respondWithStatusCode(_0x2b19b0,null))[_0x0203('0x2f')](handleError(_0x2b19b0,null));};exports[_0x0203('0xb8')]=function(_0x49b17e,_0x3328a0,_0x1db659){var _0x260b05={};var _0x20f2b7={};var _0x15b580;var _0x36b4fd;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x49b17e[_0x0203('0x65')]['id']}})[_0x0203('0x24')](handleEntityNotFound(_0x3328a0,null))[_0x0203('0x24')](function(_0x533620){if(_0x533620){_0x15b580=_0x533620;_0x20f2b7[_0x0203('0x48')]=_[_0x0203('0x5c')](db[_0x0203('0xb9')][_0x0203('0x6c')]);_0x20f2b7[_0x0203('0x49')]=_[_0x0203('0x5c')](_0x49b17e['query']);_0x20f2b7[_0x0203('0x4a')]=_[_0x0203('0x4c')](_0x20f2b7[_0x0203('0x48')],_0x20f2b7['query']);_0x260b05[_0x0203('0x4b')]=_[_0x0203('0x4c')](_0x20f2b7['model'],qs[_0x0203('0x4d')](_0x49b17e['query']['fields']));_0x260b05[_0x0203('0x4b')]=_0x260b05[_0x0203('0x4b')][_0x0203('0x4e')]?_0x260b05['attributes']:_0x20f2b7['model'];_0x260b05[_0x0203('0x51')]=qs[_0x0203('0x52')](_0x49b17e[_0x0203('0x49')][_0x0203('0x52')]);_0x260b05[_0x0203('0x55')]=qs['filters'](_[_0x0203('0x53')](_0x49b17e[_0x0203('0x49')],_0x20f2b7[_0x0203('0x4a')]));if(_0x49b17e[_0x0203('0x49')]['filter']){_0x260b05['where']=_[_0x0203('0x5d')](_0x260b05[_0x0203('0x55')],{'$or':_[_0x0203('0x44')](_0x260b05[_0x0203('0x4b')],function(_0x49c9e1){var _0x24d571={};_0x24d571[_0x49c9e1]={'$like':'%'+_0x49b17e[_0x0203('0x49')]['filter']+'%'};return _0x24d571;})});}_0x260b05=_[_0x0203('0x5d')]({},_0x260b05,_0x49b17e['options']);return _0x15b580['getAgents'](_0x260b05);}})[_0x0203('0x24')](function(_0x45c93b){if(_0x45c93b){_0x36b4fd=_0x45c93b['length'];if(!_0x49b17e['query'][_0x0203('0x4f')](_0x0203('0x50'))){_0x260b05['limit']=qs[_0x0203('0x35')](_0x49b17e['query']['limit']);_0x260b05[_0x0203('0x33')]=qs[_0x0203('0x33')](_0x49b17e[_0x0203('0x49')][_0x0203('0x33')]);}return _0x15b580['getAgents'](_0x260b05);}})[_0x0203('0x24')](function(_0x24a315){if(_0x24a315){return _0x24a315?{'count':_0x36b4fd,'rows':_0x24a315}:null;}})[_0x0203('0x24')](respondWithResult(_0x3328a0,null))[_0x0203('0x2f')](handleError(_0x3328a0,null));};exports[_0x0203('0x41')]=function(_0x232493,_0x2ed093,_0x8b7c06){var _0xf1d275,_0x4da322,_0x54bbd6;if(_[_0x0203('0x7e')](_0x232493['body'][_0x0203('0x5f')])||_0x232493[_0x0203('0x5f')][_0x0203('0x5f')]===''){throw new db[(_0x0203('0x76'))][(_0x0203('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0203('0x7e')](_0x232493['body']['to'])){}_0xf1d275=_0x232493[_0x0203('0x5f')]['to'];return db['OpenchannelAccount'][_0x0203('0x6b')]({'where':{'id':_0x232493['params']['id']}})['then'](handleEntityNotFound(_0x2ed093,null))[_0x0203('0x24')](function(_0x51edf3){if(_0x51edf3){return db['OpenchannelAccount'][_0x0203('0x64')]({'where':{'id':_0x51edf3['id']},'include':[{'model':db[_0x0203('0x84')],'as':'List','include':[{'model':db[_0x0203('0x75')],'as':_0x0203('0x86'),'where':{[_0x51edf3[_0x0203('0x80')]]:_0xf1d275},'limit':0x1,'order':[[_0x0203('0x7a'),_0x0203('0xba')]]}]}]})['then'](handleEntityNotFound(_0x2ed093,null))[_0x0203('0x24')](function(_0x15169c){if(_0x15169c&&_0x15169c[_0x0203('0x85')]){_0x4da322=_0x15169c[_0x0203('0x3b')]({'plain':!![]});if(_0x4da322[_0x0203('0x85')]&&_0x4da322[_0x0203('0x85')][_0x0203('0x86')][_0x0203('0x4e')]){return _0x4da322['List'][_0x0203('0x86')][0x0];}return db[_0x0203('0x75')][_0x0203('0x5e')](_[_0x0203('0x1c')](_0x232493['body'],{'firstName':_0xf1d275,[_0x15169c[_0x0203('0x80')]]:_0xf1d275,'phone':_0xf1d275,'ListId':_0x4da322[_0x0203('0x7d')]}));}})[_0x0203('0x24')](handleEntityNotFound(_0x2ed093,null))['then'](function(_0x4de6d7){if(_0x4de6d7){_0x54bbd6=_0x4de6d7;return db['OpenchannelInteraction'][_0x0203('0x64')]({'where':{'ContactId':_0x54bbd6['id'],'closed':![],'OpenchannelAccountId':_0x4da322['id']}})[_0x0203('0x24')](function(_0x2607b3){if(_0x2607b3){return[_0x2607b3,![]];}return db[_0x0203('0x90')][_0x0203('0x5e')]({'UserId':_0x232493[_0x0203('0x62')]['id'],'ContactId':_0x54bbd6['id'],'OpenchannelAccountId':_0x4da322['id'],'lastMsgDirection':_0x0203('0xbb'),'Messages':[_[_0x0203('0x5d')](_0x232493[_0x0203('0x5f')],{'read':![],'body':_0x232493[_0x0203('0x5f')][_0x0203('0x5f')],'OpenchannelAccountId':_0x4da322['id'],'UserId':_0x232493[_0x0203('0x62')]['id'],'ContactId':_0x54bbd6['id']})]},{'include':[{'model':db[_0x0203('0x98')],'as':_0x0203('0xbc')}]})[_0x0203('0x24')](function(_0x2c33e3){return[_0x2c33e3,!![]];});});}})[_0x0203('0x92')](function(_0x1b6308,_0x8eee64){if(_0x8eee64){return _0x1b6308;}return db['OpenchannelMessage'][_0x0203('0x5e')](_[_0x0203('0x5d')](_0x232493[_0x0203('0x5f')],{'read':![],'body':_0x232493[_0x0203('0x5f')][_0x0203('0x5f')],'OpenchannelAccountId':_0x4da322['id'],'OpenchannelInteractionId':_0x1b6308['id'],'UserId':_0x232493[_0x0203('0x62')]['id'],'ContactId':_0x54bbd6['id']}))['then'](function(_0x123243){_0x1b6308[_0x0203('0xbd')][_0x0203('0xbc')]=[];_0x1b6308[_0x0203('0xbd')][_0x0203('0xbc')][_0x0203('0xbe')](_0x123243[_0x0203('0xbd')]);return _0x1b6308;});});}})['then'](respondWithResult(_0x2ed093,null))[_0x0203('0x2f')](handleError(_0x2ed093,null));}; \ No newline at end of file +var _0x3bac=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','status','end','json','offset','limit','count','Content-Range','apply','save','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','fieldName','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','merge','where','OpenchannelAccount','includeAll','include','rows','catch','show','params','Pause','rawAttributes','keys','intersection','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','update','body','describe','addDisposition','Disposition','getDispositions','findOne','OpenchannelAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','Applications','account','applications','list','priority','asc','Contacts','CmContact','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','firstName','messageId','interaction','created','autoclose','push','close','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','sendStatus','send','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','spread','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','user','out','OpenchannelMessage','dataValues','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x4024bd,_0x164def){var _0x5cbe79=function(_0x495981){while(--_0x495981){_0x4024bd['push'](_0x4024bd['shift']());}};_0x5cbe79(++_0x164def);}(_0x3bac,0x16a));var _0xc3ba=function(_0x69752e,_0x2579f6){_0x69752e=_0x69752e-0x0;var _0x506a36=_0x3bac[_0x69752e];return _0x506a36;};'use strict';var emlformat=require(_0xc3ba('0x0'));var rimraf=require(_0xc3ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc3ba('0x2'));var moment=require(_0xc3ba('0x3'));var BPromise=require(_0xc3ba('0x4'));var Mustache=require(_0xc3ba('0x5'));var util=require(_0xc3ba('0x6'));var path=require(_0xc3ba('0x7'));var sox=require(_0xc3ba('0x8'));var csv=require(_0xc3ba('0x9'));var ejs=require(_0xc3ba('0xa'));var fs=require('fs');var fs_extra=require(_0xc3ba('0xb'));var _=require(_0xc3ba('0xc'));var squel=require(_0xc3ba('0xd'));var crypto=require(_0xc3ba('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc3ba('0xf'));var toCsv=require(_0xc3ba('0x9'));var querystring=require(_0xc3ba('0x10'));var Papa=require(_0xc3ba('0x11'));var Redis=require(_0xc3ba('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc3ba('0x13'));var as=require(_0xc3ba('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3ba('0x15'))(_0xc3ba('0x16'));var utils=require(_0xc3ba('0x17'));var config=require(_0xc3ba('0x18'));var licenseUtil=require(_0xc3ba('0x19'));var db=require(_0xc3ba('0x1a'))['db'];config[_0xc3ba('0x1b')]=_[_0xc3ba('0x1c')](config[_0xc3ba('0x1b')],{'host':_0xc3ba('0x1d'),'port':0x18eb});var socket=require(_0xc3ba('0x1e'))(new Redis(config['redis']));require(_0xc3ba('0x1f'))['register'](socket);var jayson=require(_0xc3ba('0x20'));var client=jayson[_0xc3ba('0x21')]['http']({'port':0x232c});var client9002=jayson[_0xc3ba('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c0647,_0x4abfa3,_0x401107,_0x4fa32b){return new BPromise(function(_0x1033d0,_0x59895c){var _0x7921e5=_0x4fa32b||client;return _0x7921e5[_0xc3ba('0x22')](_0x5c0647,_0x401107)[_0xc3ba('0x23')](function(_0x5d3e2d){logger[_0xc3ba('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x4abfa3,_0xc3ba('0x25'));logger[_0xc3ba('0x26')](_0xc3ba('0x27'),_0x4abfa3,'request\x20sent',JSON[_0xc3ba('0x28')](_0x5d3e2d));if(_0x5d3e2d[_0xc3ba('0x29')]){if(_0x5d3e2d[_0xc3ba('0x29')][_0xc3ba('0x2a')]===0x1f4){logger[_0xc3ba('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x4abfa3,_0x5d3e2d[_0xc3ba('0x29')]['message']);return _0x59895c(_0x5d3e2d[_0xc3ba('0x29')][_0xc3ba('0x2b')]);}logger[_0xc3ba('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x4abfa3,_0x5d3e2d[_0xc3ba('0x29')][_0xc3ba('0x2b')]);return _0x1033d0(_0x5d3e2d['error']['message']);}else{logger[_0xc3ba('0x24')](_0xc3ba('0x2c'),_0x4abfa3,'request\x20sent');_0x1033d0(_0x5d3e2d['result'][_0xc3ba('0x2b')]);}})['catch'](function(_0x8f2da5){logger[_0xc3ba('0x29')](_0xc3ba('0x2c'),_0x4abfa3,_0x8f2da5);_0x59895c(_0x8f2da5);});});}function respondWithStatusCode(_0x2dddee,_0x50771b){_0x50771b=_0x50771b||0xcc;return function(_0x444f57){if(_0x444f57){return _0x2dddee['sendStatus'](_0x50771b);}return _0x2dddee[_0xc3ba('0x2d')](_0x50771b)[_0xc3ba('0x2e')]();};}function respondWithResult(_0x4b1254,_0x5bd9b0){_0x5bd9b0=_0x5bd9b0||0xc8;return function(_0x4d9dee){if(_0x4d9dee){return _0x4b1254[_0xc3ba('0x2d')](_0x5bd9b0)[_0xc3ba('0x2f')](_0x4d9dee);}};}function respondWithFilteredResult(_0x3b41c4,_0x43406c){return function(_0x2df30d){if(_0x2df30d){var _0x5efde0=typeof _0x43406c[_0xc3ba('0x30')]==='undefined'&&typeof _0x43406c[_0xc3ba('0x31')]==='undefined';var _0x2c33ca=_0x2df30d['count'];var _0x3361aa=_0x5efde0?0x0:_0x43406c[_0xc3ba('0x30')];var _0x5671ab=_0x5efde0?_0x2df30d[_0xc3ba('0x32')]:_0x43406c['offset']+_0x43406c[_0xc3ba('0x31')];var _0x5246d1;if(_0x5671ab>=_0x2c33ca){_0x5671ab=_0x2c33ca;_0x5246d1=0xc8;}else{_0x5246d1=0xce;}_0x3b41c4[_0xc3ba('0x2d')](_0x5246d1);return _0x3b41c4['set'](_0xc3ba('0x33'),_0x3361aa+'-'+_0x5671ab+'/'+_0x2c33ca)[_0xc3ba('0x2f')](_0x2df30d);}return null;};}function patchUpdates(_0x5ec80b){return function(_0x50e0fd){try{jsonpatch[_0xc3ba('0x34')](_0x50e0fd,_0x5ec80b,!![]);}catch(_0x15d131){return BPromise['reject'](_0x15d131);}return _0x50e0fd[_0xc3ba('0x35')]();};}function saveUpdates(_0x3af162,_0x329e99){return function(_0x1a6557){if(_0x1a6557){return _0x1a6557['update'](_0x3af162)[_0xc3ba('0x23')](function(_0x19c7ae){return _0x19c7ae;});}return null;};}function removeEntity(_0xde7f8c,_0x27db6b){return function(_0x45e9a0){if(_0x45e9a0){return _0x45e9a0[_0xc3ba('0x36')]()[_0xc3ba('0x23')](function(){var _0x1c8f35=_0x45e9a0[_0xc3ba('0x37')]({'plain':!![]});var _0x132548=_0xc3ba('0x38');return db[_0xc3ba('0x39')][_0xc3ba('0x36')]({'where':{'type':_0x132548,'resourceId':_0x1c8f35['id']}})[_0xc3ba('0x23')](function(){return _0x45e9a0;});})['then'](function(){_0xde7f8c[_0xc3ba('0x2d')](0xcc)[_0xc3ba('0x2e')]();});}};}function handleEntityNotFound(_0x29e7ab,_0x5c4aff){return function(_0x3d4da7){if(!_0x3d4da7){_0x29e7ab['sendStatus'](0x194);}return _0x3d4da7;};}function handleError(_0x26b9ab,_0x4c98a6){_0x4c98a6=_0x4c98a6||0x1f4;return function(_0x2633ae){logger[_0xc3ba('0x29')](_0x2633ae[_0xc3ba('0x3a')]);if(_0x2633ae[_0xc3ba('0x3b')]){delete _0x2633ae[_0xc3ba('0x3b')];}_0x26b9ab['status'](_0x4c98a6)['send'](_0x2633ae);};}exports[_0xc3ba('0x3c')]=function(_0x3f14e6,_0x2b507a){var _0x3fcc6f={'include':[{'model':db['Pause'],'as':_0xc3ba('0x3d')}]},_0xb7e274={},_0x19c6c8={'count':0x0,'rows':[]};var _0x2626ba=_[_0xc3ba('0x3e')](db['OpenchannelAccount']['rawAttributes'],function(_0x16e04e){return{'name':_0x16e04e[_0xc3ba('0x3f')],'type':_0x16e04e['type'][_0xc3ba('0x40')]};});_0xb7e274[_0xc3ba('0x41')]=_['map'](_0x2626ba,_0xc3ba('0x3b'));_0xb7e274[_0xc3ba('0x42')]=_['keys'](_0x3f14e6[_0xc3ba('0x42')]);_0xb7e274[_0xc3ba('0x43')]=_['intersection'](_0xb7e274['model'],_0xb7e274[_0xc3ba('0x42')]);_0x3fcc6f['attributes']=_['intersection'](_0xb7e274[_0xc3ba('0x41')],qs[_0xc3ba('0x44')](_0x3f14e6[_0xc3ba('0x42')]['fields']));_0x3fcc6f[_0xc3ba('0x45')]=_0x3fcc6f[_0xc3ba('0x45')][_0xc3ba('0x46')]?_0x3fcc6f[_0xc3ba('0x45')]:_0xb7e274[_0xc3ba('0x41')];if(!_0x3f14e6['query'][_0xc3ba('0x47')](_0xc3ba('0x48'))){_0x3fcc6f[_0xc3ba('0x31')]=qs[_0xc3ba('0x31')](_0x3f14e6[_0xc3ba('0x42')]['limit']);_0x3fcc6f[_0xc3ba('0x30')]=qs[_0xc3ba('0x30')](_0x3f14e6['query'][_0xc3ba('0x30')]);}_0x3fcc6f[_0xc3ba('0x49')]=qs['sort'](_0x3f14e6['query'][_0xc3ba('0x4a')]);_0x3fcc6f['where']=qs[_0xc3ba('0x43')](_[_0xc3ba('0x4b')](_0x3f14e6[_0xc3ba('0x42')],_0xb7e274[_0xc3ba('0x43')]),_0x2626ba);if(_0x3f14e6[_0xc3ba('0x42')][_0xc3ba('0x4c')]){_0x3fcc6f['where']=_['merge'](_0x3fcc6f['where'],{'$or':_[_0xc3ba('0x3e')](_0x2626ba,function(_0x16dbec){if(_0x16dbec['type']!==_0xc3ba('0x4d')){var _0x51d23a={};_0x51d23a[_0x16dbec[_0xc3ba('0x3b')]]={'$like':'%'+_0x3f14e6[_0xc3ba('0x42')][_0xc3ba('0x4c')]+'%'};return _0x51d23a;}})});}_0x3fcc6f=_[_0xc3ba('0x4e')]({},_0x3fcc6f,_0x3f14e6['options']);var _0x30db89={'where':_0x3fcc6f[_0xc3ba('0x4f')]};return db[_0xc3ba('0x50')][_0xc3ba('0x32')](_0x30db89)['then'](function(_0x5f052c){_0x19c6c8[_0xc3ba('0x32')]=_0x5f052c;if(_0x3f14e6[_0xc3ba('0x42')][_0xc3ba('0x51')]){_0x3fcc6f[_0xc3ba('0x52')]=[{'all':!![]}];}return db[_0xc3ba('0x50')]['findAll'](_0x3fcc6f);})[_0xc3ba('0x23')](function(_0x54f146){_0x19c6c8[_0xc3ba('0x53')]=_0x54f146;return _0x19c6c8;})[_0xc3ba('0x23')](respondWithFilteredResult(_0x2b507a,_0x3fcc6f))[_0xc3ba('0x54')](handleError(_0x2b507a,null));};exports[_0xc3ba('0x55')]=function(_0x2613eb,_0x179194){var _0x3a3e8d={'raw':![],'where':{'id':_0x2613eb[_0xc3ba('0x56')]['id']},'include':[{'model':db[_0xc3ba('0x57')],'as':_0xc3ba('0x3d')}]},_0xf4868f={};_0xf4868f[_0xc3ba('0x41')]=_['keys'](db[_0xc3ba('0x50')][_0xc3ba('0x58')]);_0xf4868f[_0xc3ba('0x42')]=_[_0xc3ba('0x59')](_0x2613eb[_0xc3ba('0x42')]);_0xf4868f['filters']=_['intersection'](_0xf4868f[_0xc3ba('0x41')],_0xf4868f[_0xc3ba('0x42')]);_0x3a3e8d['attributes']=_[_0xc3ba('0x5a')](_0xf4868f['model'],qs[_0xc3ba('0x44')](_0x2613eb['query'][_0xc3ba('0x44')]));_0x3a3e8d[_0xc3ba('0x45')]=_0x3a3e8d['attributes'][_0xc3ba('0x46')]?_0x3a3e8d[_0xc3ba('0x45')]:_0xf4868f[_0xc3ba('0x41')];if(_0x2613eb[_0xc3ba('0x42')][_0xc3ba('0x51')]){_0x3a3e8d[_0xc3ba('0x52')]=[{'all':!![]}];}_0x3a3e8d=_[_0xc3ba('0x4e')]({},_0x3a3e8d,_0x2613eb[_0xc3ba('0x5b')]);return db[_0xc3ba('0x50')][_0xc3ba('0x5c')](_0x3a3e8d)['then'](handleEntityNotFound(_0x179194,null))[_0xc3ba('0x23')](respondWithResult(_0x179194,null))[_0xc3ba('0x54')](handleError(_0x179194,null));};exports[_0xc3ba('0x5d')]=function(_0x397a88,_0x4a536c){return db[_0xc3ba('0x50')][_0xc3ba('0x5d')](_0x397a88['body'],{})[_0xc3ba('0x23')](function(_0x29d753){var _0x538aef=_0x397a88['user'][_0xc3ba('0x37')]({'plain':!![]});if(!_0x538aef)throw new Error(_0xc3ba('0x5e'));if(_0x538aef[_0xc3ba('0x5f')]==='user'){var _0xf4ed0d=_0x29d753[_0xc3ba('0x37')]({'plain':!![]});var _0x535469=_0xc3ba('0x38');return db['UserProfileSection'][_0xc3ba('0x5c')]({'where':{'name':_0x535469,'userProfileId':_0x538aef[_0xc3ba('0x60')]},'raw':!![]})['then'](function(_0x14c002){if(_0x14c002&&_0x14c002['autoAssociation']===0x0){return db['UserProfileResource'][_0xc3ba('0x5d')]({'name':_0xf4ed0d[_0xc3ba('0x3b')],'resourceId':_0xf4ed0d['id'],'type':_0x14c002[_0xc3ba('0x3b')],'sectionId':_0x14c002['id']},{})[_0xc3ba('0x23')](function(){return _0x29d753;});}else{return _0x29d753;}})[_0xc3ba('0x54')](function(_0x13915c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13915c);throw _0x13915c;});}return _0x29d753;})[_0xc3ba('0x23')](respondWithResult(_0x4a536c,0xc9))[_0xc3ba('0x54')](handleError(_0x4a536c,null));};exports[_0xc3ba('0x61')]=function(_0x40104f,_0x271c69){if(_0x40104f[_0xc3ba('0x62')]['id']){delete _0x40104f[_0xc3ba('0x62')]['id'];}return db[_0xc3ba('0x50')][_0xc3ba('0x5c')]({'where':{'id':_0x40104f[_0xc3ba('0x56')]['id']},'include':[{'model':db[_0xc3ba('0x57')],'as':_0xc3ba('0x3d')}]})[_0xc3ba('0x23')](handleEntityNotFound(_0x271c69,null))[_0xc3ba('0x23')](saveUpdates(_0x40104f['body'],null))[_0xc3ba('0x23')](respondWithResult(_0x271c69,null))[_0xc3ba('0x54')](handleError(_0x271c69,null));};exports[_0xc3ba('0x36')]=function(_0x1e7f5c,_0x9e1c6f){return db[_0xc3ba('0x50')]['find']({'where':{'id':_0x1e7f5c[_0xc3ba('0x56')]['id']}})[_0xc3ba('0x23')](handleEntityNotFound(_0x9e1c6f,null))[_0xc3ba('0x23')](removeEntity(_0x9e1c6f,null))['catch'](handleError(_0x9e1c6f,null));};exports[_0xc3ba('0x63')]=function(_0x7dc736,_0x18f295){return db['OpenchannelAccount']['describe']()[_0xc3ba('0x23')](respondWithResult(_0x18f295,null))[_0xc3ba('0x54')](handleError(_0x18f295,null));};exports[_0xc3ba('0x64')]=function(_0x4bf9b5,_0x25cf99,_0x30334d){if(_0x4bf9b5['body']['id']){delete _0x4bf9b5[_0xc3ba('0x62')]['id'];}return db[_0xc3ba('0x50')][_0xc3ba('0x5c')]({'where':{'id':_0x4bf9b5[_0xc3ba('0x56')]['id']}})[_0xc3ba('0x23')](handleEntityNotFound(_0x25cf99,null))[_0xc3ba('0x23')](function(_0x39b596){if(_0x39b596){_0x4bf9b5[_0xc3ba('0x62')]['OpenchannelAccountId']=_0x39b596['id'];return db[_0xc3ba('0x65')][_0xc3ba('0x5d')](_0x4bf9b5[_0xc3ba('0x62')]);}})[_0xc3ba('0x23')](respondWithResult(_0x25cf99,null))[_0xc3ba('0x54')](handleError(_0x25cf99,null));};exports[_0xc3ba('0x66')]=function(_0x32e731,_0x4031cd,_0x2f8adf){var _0x75fa15={'raw':![],'where':{}};var _0x5ed4a3={};var _0x7dcc8d={'count':0x0,'rows':[]};return db[_0xc3ba('0x50')][_0xc3ba('0x67')]({'where':{'id':_0x32e731[_0xc3ba('0x56')]['id']}})[_0xc3ba('0x23')](handleEntityNotFound(_0x4031cd,null))[_0xc3ba('0x23')](function(_0x5a352e){if(_0x5a352e){_0x5ed4a3[_0xc3ba('0x41')]=_['keys'](db[_0xc3ba('0x65')]['rawAttributes']);_0x5ed4a3['query']=_[_0xc3ba('0x59')](_0x32e731[_0xc3ba('0x42')]);_0x5ed4a3[_0xc3ba('0x43')]=_[_0xc3ba('0x5a')](_0x5ed4a3[_0xc3ba('0x41')],_0x5ed4a3[_0xc3ba('0x42')]);_0x75fa15['attributes']=_[_0xc3ba('0x5a')](_0x5ed4a3['model'],qs[_0xc3ba('0x44')](_0x32e731[_0xc3ba('0x42')]['fields']));_0x75fa15[_0xc3ba('0x45')]=_0x75fa15[_0xc3ba('0x45')][_0xc3ba('0x46')]?_0x75fa15['attributes']:_0x5ed4a3[_0xc3ba('0x41')];if(!_0x32e731['query'][_0xc3ba('0x47')]('nolimit')){_0x75fa15[_0xc3ba('0x31')]=qs[_0xc3ba('0x31')](_0x32e731[_0xc3ba('0x42')][_0xc3ba('0x31')]);_0x75fa15[_0xc3ba('0x30')]=qs[_0xc3ba('0x30')](_0x32e731['query'][_0xc3ba('0x30')]);}_0x75fa15['order']=qs['sort'](_0x32e731[_0xc3ba('0x42')]['sort']);_0x75fa15['where']=qs[_0xc3ba('0x43')](_['pick'](_0x32e731[_0xc3ba('0x42')],_0x5ed4a3['filters']));_0x75fa15[_0xc3ba('0x4f')][_0xc3ba('0x68')]=_0x5a352e['id'];if(_0x32e731['query'][_0xc3ba('0x4c')]){_0x75fa15[_0xc3ba('0x4f')]=_[_0xc3ba('0x4e')](_0x75fa15[_0xc3ba('0x4f')],{'$or':_[_0xc3ba('0x3e')](_0x75fa15[_0xc3ba('0x45')],function(_0x3343e6){var _0x11020a={};_0x11020a[_0x3343e6]={'$like':'%'+_0x32e731[_0xc3ba('0x42')][_0xc3ba('0x4c')]+'%'};return _0x11020a;})});}_0x75fa15=_[_0xc3ba('0x4e')]({},_0x75fa15,_0x32e731[_0xc3ba('0x5b')]);return db['Disposition']['count']({'where':_0x75fa15[_0xc3ba('0x4f')]})['then'](function(_0xb6795e){_0x7dcc8d['count']=_0xb6795e;if(_0x32e731[_0xc3ba('0x42')][_0xc3ba('0x51')]){_0x75fa15[_0xc3ba('0x52')]=[{'all':!![]}];}return db['Disposition'][_0xc3ba('0x69')](_0x75fa15);})[_0xc3ba('0x23')](function(_0x581501){_0x7dcc8d[_0xc3ba('0x53')]=_0x581501;return _0x7dcc8d;});}})['then'](respondWithFilteredResult(_0x4031cd,_0x75fa15))['catch'](handleError(_0x4031cd,null));};exports[_0xc3ba('0x6a')]=function(_0x4f5188,_0x537088,_0x264ff8){return db[_0xc3ba('0x50')][_0xc3ba('0x5c')]({'where':{'id':_0x4f5188[_0xc3ba('0x56')]['id']}})[_0xc3ba('0x23')](handleEntityNotFound(_0x537088,null))['then'](function(_0x30bcb5){if(_0x30bcb5){return _0x30bcb5['removeDispositions'](_0x4f5188['query'][_0xc3ba('0x6b')]);}})[_0xc3ba('0x23')](respondWithStatusCode(_0x537088,null))[_0xc3ba('0x54')](handleError(_0x537088,null));};exports[_0xc3ba('0x6c')]=function(_0x4bdfa6,_0x5b6942,_0x103eef){if(_0x4bdfa6['body']['id']){delete _0x4bdfa6[_0xc3ba('0x62')]['id'];}return db['OpenchannelAccount'][_0xc3ba('0x5c')]({'where':{'id':_0x4bdfa6['params']['id']}})[_0xc3ba('0x23')](handleEntityNotFound(_0x5b6942,null))[_0xc3ba('0x23')](function(_0x14135e){if(_0x14135e){_0x4bdfa6[_0xc3ba('0x62')][_0xc3ba('0x68')]=_0x14135e['id'];return db[_0xc3ba('0x6d')][_0xc3ba('0x5d')](_0x4bdfa6['body']);}})[_0xc3ba('0x23')](respondWithResult(_0x5b6942,null))['catch'](handleError(_0x5b6942,null));};exports[_0xc3ba('0x6e')]=function(_0x5aff7e,_0x1b3407,_0x2b178a){var _0x165811={'raw':![],'where':{}};var _0x3c177d={};var _0x280470={'count':0x0,'rows':[]};return db[_0xc3ba('0x50')]['findOne']({'where':{'id':_0x5aff7e[_0xc3ba('0x56')]['id']}})[_0xc3ba('0x23')](handleEntityNotFound(_0x1b3407,null))[_0xc3ba('0x23')](function(_0x4c1be4){if(_0x4c1be4){_0x3c177d[_0xc3ba('0x41')]=_['keys'](db[_0xc3ba('0x6d')]['rawAttributes']);_0x3c177d[_0xc3ba('0x42')]=_['keys'](_0x5aff7e[_0xc3ba('0x42')]);_0x3c177d['filters']=_[_0xc3ba('0x5a')](_0x3c177d[_0xc3ba('0x41')],_0x3c177d[_0xc3ba('0x42')]);_0x165811[_0xc3ba('0x45')]=_[_0xc3ba('0x5a')](_0x3c177d[_0xc3ba('0x41')],qs['fields'](_0x5aff7e[_0xc3ba('0x42')][_0xc3ba('0x44')]));_0x165811[_0xc3ba('0x45')]=_0x165811[_0xc3ba('0x45')][_0xc3ba('0x46')]?_0x165811['attributes']:_0x3c177d[_0xc3ba('0x41')];if(!_0x5aff7e[_0xc3ba('0x42')][_0xc3ba('0x47')](_0xc3ba('0x48'))){_0x165811[_0xc3ba('0x31')]=qs[_0xc3ba('0x31')](_0x5aff7e[_0xc3ba('0x42')][_0xc3ba('0x31')]);_0x165811[_0xc3ba('0x30')]=qs['offset'](_0x5aff7e['query'][_0xc3ba('0x30')]);}_0x165811[_0xc3ba('0x49')]=qs['sort'](_0x5aff7e[_0xc3ba('0x42')]['sort']);_0x165811[_0xc3ba('0x4f')]=qs[_0xc3ba('0x43')](_[_0xc3ba('0x4b')](_0x5aff7e['query'],_0x3c177d[_0xc3ba('0x43')]));_0x165811[_0xc3ba('0x4f')][_0xc3ba('0x68')]=_0x4c1be4['id'];if(_0x5aff7e[_0xc3ba('0x42')][_0xc3ba('0x4c')]){_0x165811[_0xc3ba('0x4f')]=_[_0xc3ba('0x4e')](_0x165811['where'],{'$or':_[_0xc3ba('0x3e')](_0x165811[_0xc3ba('0x45')],function(_0xa49cf2){var _0xb5fe42={};_0xb5fe42[_0xa49cf2]={'$like':'%'+_0x5aff7e['query'][_0xc3ba('0x4c')]+'%'};return _0xb5fe42;})});}_0x165811=_[_0xc3ba('0x4e')]({},_0x165811,_0x5aff7e['options']);return db['CannedAnswer']['count']({'where':_0x165811['where']})[_0xc3ba('0x23')](function(_0x7f66f8){_0x280470[_0xc3ba('0x32')]=_0x7f66f8;if(_0x5aff7e[_0xc3ba('0x42')][_0xc3ba('0x51')]){_0x165811['include']=[{'all':!![]}];}return db[_0xc3ba('0x6d')][_0xc3ba('0x69')](_0x165811);})[_0xc3ba('0x23')](function(_0x42a8d0){_0x280470['rows']=_0x42a8d0;return _0x280470;});}})[_0xc3ba('0x23')](respondWithFilteredResult(_0x1b3407,_0x165811))['catch'](handleError(_0x1b3407,null));};exports[_0xc3ba('0x6f')]=function(_0x5cf49d,_0x25c054,_0x374084){return db['OpenchannelAccount'][_0xc3ba('0x5c')]({'where':{'id':_0x5cf49d[_0xc3ba('0x56')]['id']}})['then'](handleEntityNotFound(_0x25c054,null))[_0xc3ba('0x23')](function(_0x2fdcd9){if(_0x2fdcd9){return _0x2fdcd9[_0xc3ba('0x6f')](_0x5cf49d['query'][_0xc3ba('0x6b')]);}})[_0xc3ba('0x23')](respondWithStatusCode(_0x25c054,null))[_0xc3ba('0x54')](handleError(_0x25c054,null));};exports[_0xc3ba('0x70')]=function(_0x56d9ed,_0x47b85f,_0x4437c0){var _0x26e699={'body':_0x56d9ed[_0xc3ba('0x62')],'channel':_0xc3ba('0x71')};var _0xfcf673=[];var _0x2b9fff=[];var _0x215054={};var _0x53f136=![];return db['CmContact'][_0xc3ba('0x63')]()[_0xc3ba('0x23')](function(_0x1dcabe){if(!_0x1dcabe){throw new db['Sequelize']['ValidationError'](_0xc3ba('0x72'));}_0xfcf673=_[_0xc3ba('0x73')](_[_0xc3ba('0x59')](_0x1dcabe),['createdAt',_0xc3ba('0x74')]);_0x2b9fff=_['difference'](_[_0xc3ba('0x59')](_0x1dcabe),[_0xc3ba('0x75'),_0xc3ba('0x74'),_0xc3ba('0x76'),_0xc3ba('0x77')]);if(_0x56d9ed[_0xc3ba('0x62')]['id']){delete _0x56d9ed[_0xc3ba('0x62')]['id'];}if(_[_0xc3ba('0x78')](_0x56d9ed[_0xc3ba('0x62')][_0xc3ba('0x79')])){throw new db[(_0xc3ba('0x7a'))][(_0xc3ba('0x7b'))](_0xc3ba('0x7c'));}if(_[_0xc3ba('0x78')](_0x56d9ed['body']['body'])||_0x56d9ed['body'][_0xc3ba('0x62')]===''){throw new db[(_0xc3ba('0x7a'))][(_0xc3ba('0x7b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc3ba('0x78')](_0x56d9ed[_0xc3ba('0x62')][_0xc3ba('0x7d')])){throw new db[(_0xc3ba('0x7a'))][(_0xc3ba('0x7b'))](_0xc3ba('0x7e')+_0x2b9fff);}if(!_[_0xc3ba('0x7f')](_0x2b9fff,_0x56d9ed[_0xc3ba('0x62')][_0xc3ba('0x7d')])){throw new db[(_0xc3ba('0x7a'))][(_0xc3ba('0x7b'))](_0xc3ba('0x80')+_0x2b9fff);}_0x215054[_0x56d9ed['body'][_0xc3ba('0x7d')]]=_0x56d9ed[_0xc3ba('0x62')][_0xc3ba('0x79')];})['then'](function(){return db[_0xc3ba('0x50')][_0xc3ba('0x5c')]({'where':{'id':_0x56d9ed[_0xc3ba('0x56')]['id']},'include':[{'model':db[_0xc3ba('0x81')],'as':_0xc3ba('0x82'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x215054,'limit':0x1,'order':[['updatedAt',_0xc3ba('0x83')]]}]},{'model':db['OpenchannelApplication'],'as':_0xc3ba('0x84')}]});})['then'](handleEntityNotFound(_0x47b85f,null))[_0xc3ba('0x23')](function(_0x35d28d){if(_0x35d28d&&_0x35d28d[_0xc3ba('0x82')]){_0x26e699[_0xc3ba('0x85')]=_0x35d28d;_0x26e699[_0xc3ba('0x86')]=_0x35d28d[_0xc3ba('0x84')];_0x26e699[_0xc3ba('0x87')]=_0x35d28d[_0xc3ba('0x82')];_0x26e699[_0xc3ba('0x86')]=_['orderBy'](_0x26e699[_0xc3ba('0x86')],[_0xc3ba('0x88')],[_0xc3ba('0x89')]);if(_0x26e699['account'][_0xc3ba('0x84')]){delete _0x26e699['account'][_0xc3ba('0x84')];}if(_0x26e699[_0xc3ba('0x85')][_0xc3ba('0x82')]&&_0x26e699[_0xc3ba('0x85')][_0xc3ba('0x82')][_0xc3ba('0x8a')][_0xc3ba('0x46')]){return _0x26e699['account'][_0xc3ba('0x82')][_0xc3ba('0x8a')][0x0];}var _0x212243=_[_0xc3ba('0x1c')](_0x56d9ed['body'],{'firstName':_0x56d9ed['body']['from'],'ListId':_0x35d28d[_0xc3ba('0x77')]});_0x212243[_0x56d9ed[_0xc3ba('0x62')]['mapKey']]=_0x56d9ed['body'][_0xc3ba('0x79')];return db[_0xc3ba('0x8b')][_0xc3ba('0x5d')](_0x212243,{'fields':_0xfcf673,'raw':!![]});}})[_0xc3ba('0x23')](handleEntityNotFound(_0x47b85f,null))[_0xc3ba('0x23')](function(_0x44acc4){_0x26e699[_0xc3ba('0x8c')]=_0x44acc4;if(_0x44acc4){var _0x960cbe={'ContactId':_0x44acc4['id'],'OpenchannelAccountId':_0x56d9ed[_0xc3ba('0x56')]['id'],'from':(_0x44acc4['firstName']||'')+'\x20'+(_0x44acc4[_0xc3ba('0x8d')]||'')};var _0x265750={'OpenchannelAccountId':_0x56d9ed[_0xc3ba('0x56')]['id'],'closed':![]};if(_0x56d9ed[_0xc3ba('0x62')][_0xc3ba('0x8e')]){_0x265750['threadId']=_0x56d9ed['body'][_0xc3ba('0x8e')];return db[_0xc3ba('0x8f')][_0xc3ba('0x5c')]({'where':_0x265750})[_0xc3ba('0x23')](function(_0x255413){if(_0x255413){return[_0x255413,![]];}_0x960cbe[_0xc3ba('0x8e')]=_0x56d9ed[_0xc3ba('0x62')][_0xc3ba('0x8e')];_0x960cbe[_0xc3ba('0x90')]=_0x56d9ed[_0xc3ba('0x62')]['externalUrl'];return db['OpenchannelInteraction'][_0xc3ba('0x5d')](_0x960cbe)[_0xc3ba('0x23')](function(_0x411453){return[_0x411453,!![]];});});}else{_0x265750[_0xc3ba('0x8e')]=null;}_0x265750[_0xc3ba('0x91')]=_0x44acc4['id'];return db[_0xc3ba('0x8f')][_0xc3ba('0x5c')]({'where':_0x265750})['then'](function(_0x16c8ed){if(_0x16c8ed){return[_0x16c8ed,![]];}return db[_0xc3ba('0x8f')][_0xc3ba('0x5d')](_0x960cbe)[_0xc3ba('0x23')](function(_0x1482e5){return[_0x1482e5,!![]];});});}})['spread'](function(_0x51338e,_0x573c6d){if(_0x51338e){_0x53f136=_0x573c6d;if(!_0x573c6d){var _0x352339={'from':(_0x26e699[_0xc3ba('0x8c')][_0xc3ba('0x92')]||'')+'\x20'+(_0x26e699['contact']['lastName']||'')};if(_0x56d9ed['body']['threadId']&&_0x56d9ed[_0xc3ba('0x62')][_0xc3ba('0x93')]&&_0x56d9ed['body'][_0xc3ba('0x8e')]!=_0x56d9ed[_0xc3ba('0x62')][_0xc3ba('0x93')]){_0x352339[_0xc3ba('0x8e')]=_0x56d9ed[_0xc3ba('0x62')][_0xc3ba('0x93')];}return _0x51338e['update'](_0x352339);}else{return _0x51338e;}}})[_0xc3ba('0x23')](function(_0x5ba75a){_0x26e699[_0xc3ba('0x94')]=_0x5ba75a['get']({'plain':!![]});_0x26e699[_0xc3ba('0x94')]['created']=_0x53f136;if(_0x26e699[_0xc3ba('0x94')][_0xc3ba('0x95')]){if(_0x26e699[_0xc3ba('0x85')][_0xc3ba('0x96')]){_0x26e699['applications'][_0xc3ba('0x97')]({'id':0x0,'priority':_0x26e699[_0xc3ba('0x86')][_0xc3ba('0x46')]+0x1,'app':_0xc3ba('0x98'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0xc3ba('0x5d')]({'body':_0x56d9ed['body'][_0xc3ba('0x62')],'OpenchannelAccountId':_0x56d9ed[_0xc3ba('0x56')]['id'],'OpenchannelInteractionId':_0x5ba75a['id'],'direction':'in','ContactId':_0x26e699[_0xc3ba('0x8c')]['id'],'AttachmentId':_0x56d9ed[_0xc3ba('0x62')]['AttachmentId']});})[_0xc3ba('0x23')](function(_0x32b836){_0x26e699[_0xc3ba('0x2b')]=_0x32b836;if(_0x26e699[_0xc3ba('0x94')][_0xc3ba('0x99')]){return db[_0xc3ba('0x9a')]['find']({'attributes':['id','name'],'where':{'id':_0x26e699['interaction'][_0xc3ba('0x99')]}})[_0xc3ba('0x23')](function(_0x34f416){if(_0x34f416){_0x26e699[_0xc3ba('0x86')][_0xc3ba('0x9b')]({'id':0x0,'priority':0x0,'app':_0xc3ba('0x9c'),'appdata':_0x34f416[_0xc3ba('0x3b')]+','+(_0x26e699['account'][_0xc3ba('0x9d')]||0xa),'interval':_0xc3ba('0x9e')});_0x26e699[_0xc3ba('0x9f')]=![];}return respondWithRpcPromise(_0xc3ba('0xa0'),_0xc3ba('0xa1'),_0x26e699);});}return respondWithRpcPromise(_0xc3ba('0xa0'),_0xc3ba('0xa1'),_0x26e699);})[_0xc3ba('0x23')](function(_0x2e4602){respondWithRpcPromise(_0xc3ba('0xa2'),'EventManager',{'event':_0xc3ba('0x70'),'message':_0x2e4602},client9002);return _0x2e4602;})[_0xc3ba('0x23')](respondWithResult(_0x47b85f,null))[_0xc3ba('0x54')](handleError(_0x47b85f,null));};exports[_0xc3ba('0xa3')]=function(_0x58f79e,_0x5af75b){var _0x3c12f0=_0x58f79e[_0xc3ba('0x56')]['id'];var _0x518397=_0x58f79e[_0xc3ba('0x62')];var _0x2467af=0xc8;var _0x177d93=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0xc3ba('0xa4')][_0xc3ba('0xa5')][_0xc3ba('0xa6')]},function(_0x1ad9e9){return db['OpenchannelAccount'][_0xc3ba('0x67')]({'where':{'id':_0x3c12f0},'transaction':_0x1ad9e9})[_0xc3ba('0x23')](function(_0x103de6){if(_0x103de6){return db[_0xc3ba('0xa7')][_0xc3ba('0x36')]({'where':{'OpenchannelAccountId':_0x3c12f0},'transaction':_0x1ad9e9})[_0xc3ba('0x23')](function(){var _0x264ddf=_[_0xc3ba('0x3e')](_0x518397,function(_0x487323){_0x487323['OpenchannelAccountId']=_0x3c12f0;return _0x487323;});return db[_0xc3ba('0xa7')][_0xc3ba('0xa8')](_0x264ddf,{'transaction':_0x1ad9e9});});}else{_0x2467af=0x194;_0x177d93=[];}});})[_0xc3ba('0x23')](function(){if(_0x2467af!==0x194){return db[_0xc3ba('0xa7')][_0xc3ba('0xa9')]({'where':{'OpenchannelAccountId':_0x3c12f0},'order':_0xc3ba('0x88')})['then'](function(_0x3570da){_0x177d93=_0x3570da;});}})[_0xc3ba('0x54')](function(_0x5a6616){_0x2467af=0x1f4;logger[_0xc3ba('0x29')](_0x5a6616[_0xc3ba('0x3a')]);if(_0x5a6616[_0xc3ba('0x3b')]){delete _0x5a6616[_0xc3ba('0x3b')];}_0x177d93=_0x5a6616;})['finally'](function(){if(_0x177d93===null){_0x5af75b[_0xc3ba('0xaa')](_0x2467af);}else{if(_0x2467af===0x1f4){_0x5af75b[_0xc3ba('0x2d')](_0x2467af)[_0xc3ba('0xab')](_0x177d93);}else{_0x5af75b[_0xc3ba('0x2d')](_0x2467af)[_0xc3ba('0x2f')](_0x177d93);}}});};exports[_0xc3ba('0xac')]=function(_0x2bc551,_0x3d65d9,_0x32a962){var _0x5d7c65={};var _0x30ec00={};var _0x507af8;var _0x567f13;return db[_0xc3ba('0x50')]['findOne']({'where':{'id':_0x2bc551[_0xc3ba('0x56')]['id']}})[_0xc3ba('0x23')](handleEntityNotFound(_0x3d65d9,null))[_0xc3ba('0x23')](function(_0x4704d0){if(_0x4704d0){_0x507af8=_0x4704d0;_0x30ec00[_0xc3ba('0x41')]=_[_0xc3ba('0x59')](db['OpenchannelApplication'][_0xc3ba('0x58')]);_0x30ec00[_0xc3ba('0x42')]=_[_0xc3ba('0x59')](_0x2bc551['query']);_0x30ec00[_0xc3ba('0x43')]=_['intersection'](_0x30ec00['model'],_0x30ec00['query']);_0x5d7c65['attributes']=_[_0xc3ba('0x5a')](_0x30ec00['model'],qs[_0xc3ba('0x44')](_0x2bc551[_0xc3ba('0x42')][_0xc3ba('0x44')]));_0x5d7c65[_0xc3ba('0x45')]=_0x5d7c65['attributes'][_0xc3ba('0x46')]?_0x5d7c65[_0xc3ba('0x45')]:_0x30ec00['model'];_0x5d7c65[_0xc3ba('0x49')]=qs['sort'](_0x2bc551['query']['sort']);_0x5d7c65[_0xc3ba('0x4f')]=qs[_0xc3ba('0x43')](_[_0xc3ba('0x4b')](_0x2bc551['query'],_0x30ec00['filters']));if(_0x2bc551[_0xc3ba('0x42')][_0xc3ba('0x4c')]){_0x5d7c65[_0xc3ba('0x4f')]=_[_0xc3ba('0x4e')](_0x5d7c65[_0xc3ba('0x4f')],{'$or':_['map'](_0x5d7c65['attributes'],function(_0x17b584){var _0x80de72={};_0x80de72[_0x17b584]={'$like':'%'+_0x2bc551['query'][_0xc3ba('0x4c')]+'%'};return _0x80de72;})});}_0x5d7c65=_[_0xc3ba('0x4e')]({},_0x5d7c65,_0x2bc551[_0xc3ba('0x5b')]);return _0x507af8[_0xc3ba('0xac')](_0x5d7c65);}})['then'](function(_0x1b9e1f){if(_0x1b9e1f){_0x567f13=_0x1b9e1f[_0xc3ba('0x46')];if(!_0x2bc551[_0xc3ba('0x42')]['hasOwnProperty'](_0xc3ba('0x48'))){_0x5d7c65[_0xc3ba('0x31')]=qs[_0xc3ba('0x31')](_0x2bc551[_0xc3ba('0x42')]['limit']);_0x5d7c65[_0xc3ba('0x30')]=qs[_0xc3ba('0x30')](_0x2bc551['query'][_0xc3ba('0x30')]);}return _0x507af8[_0xc3ba('0xac')](_0x5d7c65);}})[_0xc3ba('0x23')](function(_0x36d358){if(_0x36d358){return _0x36d358?{'count':_0x567f13,'rows':_0x36d358}:null;}})[_0xc3ba('0x23')](respondWithResult(_0x3d65d9,null))[_0xc3ba('0x54')](handleError(_0x3d65d9,null));};exports[_0xc3ba('0xad')]=function(_0x471a2a,_0x5ae8f1,_0x38bd93){var _0x204de3={'raw':![],'where':{}};var _0x45ce3d={};var _0xfee989={'count':0x0,'rows':[]};return db[_0xc3ba('0x50')][_0xc3ba('0x67')]({'where':{'id':_0x471a2a['params']['id']}})['then'](handleEntityNotFound(_0x5ae8f1,null))[_0xc3ba('0x23')](function(_0x4426fe){if(_0x4426fe){_0x45ce3d[_0xc3ba('0x41')]=_['keys'](db['OpenchannelInteraction'][_0xc3ba('0x58')]);_0x45ce3d['query']=_[_0xc3ba('0x59')](_0x471a2a[_0xc3ba('0x42')]);_0x45ce3d[_0xc3ba('0x43')]=_[_0xc3ba('0x5a')](_0x45ce3d[_0xc3ba('0x41')],_0x45ce3d[_0xc3ba('0x42')]);_0x204de3[_0xc3ba('0x45')]=_[_0xc3ba('0x5a')](_0x45ce3d[_0xc3ba('0x41')],qs[_0xc3ba('0x44')](_0x471a2a[_0xc3ba('0x42')][_0xc3ba('0x44')]));_0x204de3['attributes']=_0x204de3[_0xc3ba('0x45')][_0xc3ba('0x46')]?_0x204de3[_0xc3ba('0x45')]:_0x45ce3d[_0xc3ba('0x41')];if(!_0x471a2a[_0xc3ba('0x42')]['hasOwnProperty'](_0xc3ba('0x48'))){_0x204de3[_0xc3ba('0x31')]=qs[_0xc3ba('0x31')](_0x471a2a[_0xc3ba('0x42')]['limit']);_0x204de3[_0xc3ba('0x30')]=qs[_0xc3ba('0x30')](_0x471a2a[_0xc3ba('0x42')][_0xc3ba('0x30')]);}_0x204de3[_0xc3ba('0x49')]=qs[_0xc3ba('0x4a')](_0x471a2a[_0xc3ba('0x42')][_0xc3ba('0x4a')]);_0x204de3[_0xc3ba('0x4f')]=qs[_0xc3ba('0x43')](_[_0xc3ba('0x4b')](_0x471a2a[_0xc3ba('0x42')],_0x45ce3d['filters']));_0x204de3[_0xc3ba('0x4f')][_0xc3ba('0x68')]=_0x4426fe['id'];if(_0x471a2a[_0xc3ba('0x42')]['filter']){_0x204de3['where']=_[_0xc3ba('0x4e')](_0x204de3[_0xc3ba('0x4f')],{'$or':_[_0xc3ba('0x3e')](_0x204de3['attributes'],function(_0x8d89ad){var _0x59a79a={};_0x59a79a[_0x8d89ad]={'$like':'%'+_0x471a2a[_0xc3ba('0x42')][_0xc3ba('0x4c')]+'%'};return _0x59a79a;})});}_0x204de3=_[_0xc3ba('0x4e')]({},_0x204de3,_0x471a2a[_0xc3ba('0x5b')]);return db['OpenchannelInteraction'][_0xc3ba('0x32')]({'where':_0x204de3['where']})[_0xc3ba('0x23')](function(_0x533337){_0xfee989[_0xc3ba('0x32')]=_0x533337;if(_0x471a2a['query'][_0xc3ba('0x51')]){_0x204de3['include']=[{'model':db[_0xc3ba('0x8b')],'as':'Contact','required':![]},{'model':db[_0xc3ba('0x9a')],'as':_0xc3ba('0xae'),'attributes':[_0xc3ba('0x3b'),_0xc3ba('0xaf'),_0xc3ba('0xb0')],'required':![]},{'model':db[_0xc3ba('0xb1')],'as':_0xc3ba('0xb2'),'attributes':['id',_0xc3ba('0x3b'),_0xc3ba('0xb3')],'where':_0x471a2a[_0xc3ba('0x42')][_0xc3ba('0xb4')]?{'id':_0x471a2a[_0xc3ba('0x42')]['tag']}:undefined,'required':_0x471a2a[_0xc3ba('0x42')][_0xc3ba('0xb4')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x204de3);})[_0xc3ba('0x23')](function(_0x584b84){_0xfee989['rows']=_0x584b84;return _0xfee989;});}})[_0xc3ba('0x23')](respondWithFilteredResult(_0x5ae8f1,_0x204de3))['catch'](handleError(_0x5ae8f1,null));};exports[_0xc3ba('0xb5')]=function(_0x3e9769,_0x3396e0,_0x364d01){return db[_0xc3ba('0x50')][_0xc3ba('0x5c')]({'where':{'id':_0x3e9769[_0xc3ba('0x56')]['id']}})[_0xc3ba('0x23')](handleEntityNotFound(_0x3396e0,null))[_0xc3ba('0x23')](function(_0x37de0e){if(_0x37de0e){return _0x37de0e['addAgents'](_0x3e9769[_0xc3ba('0x62')][_0xc3ba('0x6b')],_['omit'](_0x3e9769[_0xc3ba('0x62')],[_0xc3ba('0x6b'),'id'])||{})[_0xc3ba('0xb6')](function(_0x380a5){for(var _0x39c45c=0x0;_0x39c45c<_0x3e9769['body'][_0xc3ba('0x6b')][_0xc3ba('0x46')];_0x39c45c+=0x1){socket[_0xc3ba('0xb7')](_0xc3ba('0xb8'),{'UserId':Number(_0x3e9769[_0xc3ba('0x62')][_0xc3ba('0x6b')][_0x39c45c]),'OpenchannelAccountId':Number(_0x3e9769[_0xc3ba('0x56')]['id'])});}return _0x380a5;});}})[_0xc3ba('0x23')](respondWithResult(_0x3396e0,null))['catch'](handleError(_0x3396e0,null));};exports[_0xc3ba('0xb9')]=function(_0x1ee154,_0x2fbf1e,_0x47b02a){return db[_0xc3ba('0x50')][_0xc3ba('0x5c')]({'where':{'id':_0x1ee154['params']['id']}})[_0xc3ba('0x23')](handleEntityNotFound(_0x2fbf1e,null))[_0xc3ba('0x23')](function(_0x306efe){if(_0x306efe){return _0x306efe[_0xc3ba('0xb9')](_0x1ee154[_0xc3ba('0x42')][_0xc3ba('0x6b')])['then'](function(){if(_['isArray'](_0x1ee154[_0xc3ba('0x42')]['ids'])){for(var _0xf94748=0x0;_0xf94748<_0x1ee154[_0xc3ba('0x42')][_0xc3ba('0x6b')][_0xc3ba('0x46')];_0xf94748+=0x1){socket[_0xc3ba('0xb7')](_0xc3ba('0xba'),{'UserId':Number(_0x1ee154[_0xc3ba('0x42')][_0xc3ba('0x6b')][_0xf94748]),'OpenchannelAccountId':Number(_0x1ee154[_0xc3ba('0x56')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x1ee154['query'][_0xc3ba('0x6b')]),'OpenchannelAccountId':Number(_0x1ee154['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2fbf1e,null))[_0xc3ba('0x54')](handleError(_0x2fbf1e,null));};exports[_0xc3ba('0xbb')]=function(_0x5c9195,_0x3788db,_0x15895b){var _0x923eec={};var _0x4731cf={};var _0x386b8b;var _0x175661;return db[_0xc3ba('0x50')][_0xc3ba('0x67')]({'where':{'id':_0x5c9195[_0xc3ba('0x56')]['id']}})[_0xc3ba('0x23')](handleEntityNotFound(_0x3788db,null))[_0xc3ba('0x23')](function(_0x52997a){if(_0x52997a){_0x386b8b=_0x52997a;_0x4731cf[_0xc3ba('0x41')]=_[_0xc3ba('0x59')](db[_0xc3ba('0x9a')][_0xc3ba('0x58')]);_0x4731cf[_0xc3ba('0x42')]=_[_0xc3ba('0x59')](_0x5c9195['query']);_0x4731cf[_0xc3ba('0x43')]=_['intersection'](_0x4731cf[_0xc3ba('0x41')],_0x4731cf['query']);_0x923eec['attributes']=_[_0xc3ba('0x5a')](_0x4731cf['model'],qs[_0xc3ba('0x44')](_0x5c9195[_0xc3ba('0x42')][_0xc3ba('0x44')]));_0x923eec['attributes']=_0x923eec[_0xc3ba('0x45')]['length']?_0x923eec['attributes']:_0x4731cf[_0xc3ba('0x41')];_0x923eec[_0xc3ba('0x49')]=qs[_0xc3ba('0x4a')](_0x5c9195['query']['sort']);_0x923eec[_0xc3ba('0x4f')]=qs['filters'](_[_0xc3ba('0x4b')](_0x5c9195[_0xc3ba('0x42')],_0x4731cf['filters']));if(_0x5c9195['query'][_0xc3ba('0x4c')]){_0x923eec[_0xc3ba('0x4f')]=_['merge'](_0x923eec['where'],{'$or':_[_0xc3ba('0x3e')](_0x923eec[_0xc3ba('0x45')],function(_0x28a6c8){var _0xd8f671={};_0xd8f671[_0x28a6c8]={'$like':'%'+_0x5c9195['query']['filter']+'%'};return _0xd8f671;})});}_0x923eec=_[_0xc3ba('0x4e')]({},_0x923eec,_0x5c9195[_0xc3ba('0x5b')]);return _0x386b8b[_0xc3ba('0xbb')](_0x923eec);}})['then'](function(_0x1743b9){if(_0x1743b9){_0x175661=_0x1743b9[_0xc3ba('0x46')];if(!_0x5c9195[_0xc3ba('0x42')][_0xc3ba('0x47')](_0xc3ba('0x48'))){_0x923eec[_0xc3ba('0x31')]=qs[_0xc3ba('0x31')](_0x5c9195[_0xc3ba('0x42')][_0xc3ba('0x31')]);_0x923eec[_0xc3ba('0x30')]=qs['offset'](_0x5c9195['query'][_0xc3ba('0x30')]);}return _0x386b8b[_0xc3ba('0xbb')](_0x923eec);}})[_0xc3ba('0x23')](function(_0x59515a){if(_0x59515a){return _0x59515a?{'count':_0x175661,'rows':_0x59515a}:null;}})['then'](respondWithResult(_0x3788db,null))[_0xc3ba('0x54')](handleError(_0x3788db,null));};exports['send']=function(_0x57db6b,_0x116db4,_0x15f322){var _0x38b672,_0x5babc2,_0x5a6adb;if(_[_0xc3ba('0x78')](_0x57db6b[_0xc3ba('0x62')][_0xc3ba('0x62')])||_0x57db6b['body'][_0xc3ba('0x62')]===''){throw new db[(_0xc3ba('0x7a'))]['ValidationError'](_0xc3ba('0xbc'));}if(_[_0xc3ba('0x78')](_0x57db6b[_0xc3ba('0x62')]['to'])){}_0x38b672=_0x57db6b[_0xc3ba('0x62')]['to'];return db['OpenchannelAccount'][_0xc3ba('0x67')]({'where':{'id':_0x57db6b[_0xc3ba('0x56')]['id']}})[_0xc3ba('0x23')](handleEntityNotFound(_0x116db4,null))[_0xc3ba('0x23')](function(_0x1a5fd8){if(_0x1a5fd8){return db['OpenchannelAccount']['find']({'where':{'id':_0x1a5fd8['id']},'include':[{'model':db['CmList'],'as':_0xc3ba('0x82'),'include':[{'model':db[_0xc3ba('0x8b')],'as':_0xc3ba('0x8a'),'where':{[_0x1a5fd8[_0xc3ba('0x7d')]]:_0x38b672},'limit':0x1,'order':[['updatedAt',_0xc3ba('0x83')]]}]}]})[_0xc3ba('0x23')](handleEntityNotFound(_0x116db4,null))[_0xc3ba('0x23')](function(_0x31f269){if(_0x31f269&&_0x31f269[_0xc3ba('0x82')]){_0x5babc2=_0x31f269[_0xc3ba('0x37')]({'plain':!![]});if(_0x5babc2[_0xc3ba('0x82')]&&_0x5babc2[_0xc3ba('0x82')][_0xc3ba('0x8a')][_0xc3ba('0x46')]){return _0x5babc2[_0xc3ba('0x82')]['Contacts'][0x0];}return db[_0xc3ba('0x8b')]['create'](_['defaults'](_0x57db6b[_0xc3ba('0x62')],{'firstName':_0x38b672,[_0x31f269[_0xc3ba('0x7d')]]:_0x38b672,'phone':_0x38b672,'ListId':_0x5babc2['ListId']}));}})[_0xc3ba('0x23')](handleEntityNotFound(_0x116db4,null))[_0xc3ba('0x23')](function(_0x41629a){if(_0x41629a){_0x5a6adb=_0x41629a;return db[_0xc3ba('0x8f')][_0xc3ba('0x5c')]({'where':{'ContactId':_0x5a6adb['id'],'closed':![],'OpenchannelAccountId':_0x5babc2['id']}})[_0xc3ba('0x23')](function(_0x4e4643){if(_0x4e4643){return[_0x4e4643,![]];}return db[_0xc3ba('0x8f')][_0xc3ba('0x5d')]({'UserId':_0x57db6b[_0xc3ba('0xbd')]['id'],'ContactId':_0x5a6adb['id'],'OpenchannelAccountId':_0x5babc2['id'],'lastMsgDirection':_0xc3ba('0xbe'),'Messages':[_[_0xc3ba('0x4e')](_0x57db6b[_0xc3ba('0x62')],{'read':![],'body':_0x57db6b[_0xc3ba('0x62')]['body'],'OpenchannelAccountId':_0x5babc2['id'],'UserId':_0x57db6b['user']['id'],'ContactId':_0x5a6adb['id']})]},{'include':[{'model':db[_0xc3ba('0xbf')],'as':'Messages'}]})[_0xc3ba('0x23')](function(_0x585f50){return[_0x585f50,!![]];});});}})[_0xc3ba('0xb6')](function(_0x1f6c06,_0x5a1abb){if(_0x5a1abb){return _0x1f6c06;}return db[_0xc3ba('0xbf')]['create'](_[_0xc3ba('0x4e')](_0x57db6b['body'],{'read':![],'body':_0x57db6b[_0xc3ba('0x62')][_0xc3ba('0x62')],'OpenchannelAccountId':_0x5babc2['id'],'OpenchannelInteractionId':_0x1f6c06['id'],'UserId':_0x57db6b[_0xc3ba('0xbd')]['id'],'ContactId':_0x5a6adb['id']}))[_0xc3ba('0x23')](function(_0x343d43){_0x1f6c06[_0xc3ba('0xc0')]['Messages']=[];_0x1f6c06[_0xc3ba('0xc0')]['Messages'][_0xc3ba('0x97')](_0x343d43[_0xc3ba('0xc0')]);return _0x1f6c06;});});}})[_0xc3ba('0x23')](respondWithResult(_0x116db4,null))[_0xc3ba('0x54')](handleError(_0x116db4,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 6f7c23d..ed627a9 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 _0xd8b0=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x83acb5,_0x271d37){var _0x3a7212=function(_0x23ca21){while(--_0x23ca21){_0x83acb5['push'](_0x83acb5['shift']());}};_0x3a7212(++_0x271d37);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x0d8b('0x0'));var OpenchannelAccount=require(_0x0d8b('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d8b('0x2'),'afterDestroy':_0x0d8b('0x3')};function emitEvent(_0x43bca1){return function(_0x364286,_0x8196ed,_0x577834){OpenchannelAccountEvents['emit'](_0x43bca1+':'+_0x364286['id'],_0x364286);OpenchannelAccountEvents[_0x0d8b('0x4')](_0x43bca1,_0x364286);_0x577834(null);};}for(var e in events){if(events[_0x0d8b('0x5')](e)){var event=events[e];OpenchannelAccount[_0x0d8b('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x2750=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelAccount','setMaxListeners','save','update'];(function(_0x32c036,_0x25c184){var _0x505b28=function(_0x435ad3){while(--_0x435ad3){_0x32c036['push'](_0x32c036['shift']());}};_0x505b28(++_0x25c184);}(_0x2750,0x13b));var _0x0275=function(_0x4fea0a,_0x29cb82){_0x4fea0a=_0x4fea0a-0x0;var _0x1a7b81=_0x2750[_0x4fea0a];return _0x1a7b81;};'use strict';var EventEmitter=require(_0x0275('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x0275('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x0275('0x2')](0x0);var events={'afterCreate':_0x0275('0x3'),'afterUpdate':_0x0275('0x4'),'afterDestroy':_0x0275('0x5')};function emitEvent(_0x41ec06){return function(_0x20273d,_0x4960,_0x3d0c9c){OpenchannelAccountEvents[_0x0275('0x6')](_0x41ec06+':'+_0x20273d['id'],_0x20273d);OpenchannelAccountEvents['emit'](_0x41ec06,_0x20273d);_0x3d0c9c(null);};}for(var e in events){if(events[_0x0275('0x7')](e)){var event=events[e];OpenchannelAccount[_0x0275('0x8')](e,emitEvent(event));}}module[_0x0275('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index aba5f03..29861af 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(_0x2d2a4c,_0x3220b3){var _0x2e37ad=function(_0x40b6e9){while(--_0x40b6e9){_0x2d2a4c['push'](_0x2d2a4c['shift']());}};_0x2e37ad(++_0x3220b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x574318,_0x3a4be1){var _0x3e2662=function(_0x2b15e7){while(--_0x2b15e7){_0x574318['push'](_0x574318['shift']());}};_0x3e2662(++_0x3a4be1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 e921a55..874a6a4 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 _0x4fc2=['rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4fc2,0x111));var _0x24fc=function(_0x2d2b63,_0x277d0a){_0x2d2b63=_0x2d2b63-0x0;var _0x5d18f8=_0x4fc2[_0x2d2b63];return _0x5d18f8;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});config['redis']=_[_0x24fc('0xb')](config[_0x24fc('0xc')],{'host':_0x24fc('0xd'),'port':0x18eb});var socket=require(_0x24fc('0xe'))(new Redis(config[_0x24fc('0xc')]));require(_0x24fc('0xf'))['register'](socket);function respondWithRpcPromise(_0x44caca,_0x1819a5,_0x1a4462){return new BPromise(function(_0x133438,_0x24998d){return client[_0x24fc('0x10')](_0x44caca,_0x1a4462)[_0x24fc('0x11')](function(_0x9a1673){logger['info'](_0x24fc('0x12'),_0x1819a5,_0x24fc('0x13'));logger['debug'](_0x24fc('0x14'),_0x1819a5,_0x24fc('0x13'),JSON[_0x24fc('0x15')](_0x9a1673));if(_0x9a1673[_0x24fc('0x16')]){if(_0x9a1673[_0x24fc('0x16')][_0x24fc('0x17')]===0x1f4){logger['error'](_0x24fc('0x12'),_0x1819a5,_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);return _0x24998d(_0x9a1673[_0x24fc('0x16')]['message']);}logger[_0x24fc('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x1819a5,_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);return _0x133438(_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);}else{logger[_0x24fc('0x19')]('OpenchannelAccount,\x20%s,\x20%s',_0x1819a5,_0x24fc('0x13'));_0x133438(_0x9a1673[_0x24fc('0x1a')][_0x24fc('0x18')]);}})[_0x24fc('0x1b')](function(_0x4c5a43){logger[_0x24fc('0x16')](_0x24fc('0x12'),_0x1819a5,_0x4c5a43);_0x24998d(_0x4c5a43);});});} \ No newline at end of file +var _0x49f8=['result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x53edee,_0x456643){var _0x2d59a7=function(_0x375ae6){while(--_0x375ae6){_0x53edee['push'](_0x53edee['shift']());}};_0x2d59a7(++_0x456643);}(_0x49f8,0xff));var _0x849f=function(_0xa72e3a,_0x4d3bd1){_0xa72e3a=_0xa72e3a-0x0;var _0x41cff3=_0x49f8[_0xa72e3a];return _0x41cff3;};'use strict';var _=require(_0x849f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x849f('0x1'));var rs=require(_0x849f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x849f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x849f('0x4'))('rpc');var config=require(_0x849f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x849f('0x6')][_0x849f('0x7')]({'port':0x232a});config[_0x849f('0x8')]=_[_0x849f('0x9')](config[_0x849f('0x8')],{'host':_0x849f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x849f('0xb')](socket);function respondWithRpcPromise(_0x1a902c,_0x3b094c,_0x51cf64){return new BPromise(function(_0x1de72f,_0x28de6e){return client[_0x849f('0xc')](_0x1a902c,_0x51cf64)['then'](function(_0x14976e){logger['info'](_0x849f('0xd'),_0x3b094c,_0x849f('0xe'));logger[_0x849f('0xf')](_0x849f('0x10'),_0x3b094c,'request\x20sent',JSON[_0x849f('0x11')](_0x14976e));if(_0x14976e[_0x849f('0x12')]){if(_0x14976e[_0x849f('0x12')][_0x849f('0x13')]===0x1f4){logger[_0x849f('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x3b094c,_0x14976e['error'][_0x849f('0x14')]);return _0x28de6e(_0x14976e['error'][_0x849f('0x14')]);}logger[_0x849f('0x12')](_0x849f('0xd'),_0x3b094c,_0x14976e[_0x849f('0x12')][_0x849f('0x14')]);return _0x1de72f(_0x14976e[_0x849f('0x12')][_0x849f('0x14')]);}else{logger['info'](_0x849f('0xd'),_0x3b094c,_0x849f('0xe'));_0x1de72f(_0x14976e[_0x849f('0x15')]['message']);}})[_0x849f('0x16')](function(_0x364c9b){logger['error'](_0x849f('0xd'),_0x3b094c,_0x364c9b);_0x28de6e(_0x364c9b);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index f000c95..04843ce 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 _0xa74f=['emit','removeListener','length','openchannelAccount:','remove'];(function(_0x2068c5,_0xad40d9){var _0x5397c7=function(_0x31a7b0){while(--_0x31a7b0){_0x2068c5['push'](_0x2068c5['shift']());}};_0x5397c7(++_0xad40d9);}(_0xa74f,0x9a));var _0xfa74=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xa74f[_0x403c20];return _0x2b271a;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0xfa74('0x0'),'update'];function createListener(_0x4b5765,_0x29e4c8){return function(_0x110824){_0x29e4c8[_0xfa74('0x1')](_0x4b5765,_0x110824);};}function removeListener(_0x25a9b7,_0x5b367b){return function(){OpenchannelAccountEvents[_0xfa74('0x2')](_0x25a9b7,_0x5b367b);};}exports['register']=function(_0x543cfe){for(var _0x43dd2f=0x0,_0x9ddbd2=events[_0xfa74('0x3')];_0x43dd2f<_0x9ddbd2;_0x43dd2f++){var _0x2d9fa9=events[_0x43dd2f];var _0x287921=createListener(_0xfa74('0x4')+_0x2d9fa9,_0x543cfe);OpenchannelAccountEvents['on'](_0x2d9fa9,_0x287921);}}; \ No newline at end of file +var _0x2083=['save','update','emit','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x2b53a2,_0x88642d){var _0x43e443=function(_0x1cdab8){while(--_0x1cdab8){_0x2b53a2['push'](_0x2b53a2['shift']());}};_0x43e443(++_0x88642d);}(_0x2083,0x137));var _0x3208=function(_0x5f98f0,_0x529b18){_0x5f98f0=_0x5f98f0-0x0;var _0x40d907=_0x2083[_0x5f98f0];return _0x40d907;};'use strict';var OpenchannelAccountEvents=require(_0x3208('0x0'));var events=[_0x3208('0x1'),'remove',_0x3208('0x2')];function createListener(_0x3c185a,_0x8e8849){return function(_0x9f4a1){_0x8e8849[_0x3208('0x3')](_0x3c185a,_0x9f4a1);};}function removeListener(_0x3ba273,_0x1535fb){return function(){OpenchannelAccountEvents['removeListener'](_0x3ba273,_0x1535fb);};}exports['register']=function(_0x5c8d7f){for(var _0x152b81=0x0,_0x3d837d=events[_0x3208('0x4')];_0x152b81<_0x3d837d;_0x152b81++){var _0x17972f=events[_0x152b81];var _0x564ff6=createListener(_0x3208('0x5')+_0x17972f,_0x5c8d7f);OpenchannelAccountEvents['on'](_0x17972f,_0x564ff6);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 382af76..79d9e7a 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 _0xd7ef=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','create','update','delete','destroy','multer','util'];(function(_0x2a753e,_0x481487){var _0x51249c=function(_0x51a2a4){while(--_0x51a2a4){_0x2a753e['push'](_0x2a753e['shift']());}};_0x51249c(++_0x481487);}(_0xd7ef,0x139));var _0xfd7e=function(_0xf4acfb,_0x48b23a){_0xf4acfb=_0xf4acfb-0x0;var _0x3246e2=_0xd7ef[_0xf4acfb];return _0x3246e2;};'use strict';var multer=require(_0xfd7e('0x0'));var util=require(_0xfd7e('0x1'));var path=require('path');var timeout=require(_0xfd7e('0x2'));var express=require('express');var router=express[_0xfd7e('0x3')]();var fs_extra=require(_0xfd7e('0x4'));var auth=require(_0xfd7e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfd7e('0x6'));var controller=require('./openchannelApplication.controller');router[_0xfd7e('0x7')]('/',auth[_0xfd7e('0x8')](),controller[_0xfd7e('0x9')]);router['get'](_0xfd7e('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xfd7e('0x8')](),controller[_0xfd7e('0xb')]);router['put'](_0xfd7e('0xa'),auth[_0xfd7e('0x8')](),controller[_0xfd7e('0xc')]);router[_0xfd7e('0xd')](_0xfd7e('0xa'),auth['isAuthenticated'](),controller[_0xfd7e('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd43d=['exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x5ea8b8,_0x20a79b){var _0x53739d=function(_0x51afa1){while(--_0x51afa1){_0x5ea8b8['push'](_0x5ea8b8['shift']());}};_0x53739d(++_0x20a79b);}(_0xd43d,0x1b4));var _0xdd43=function(_0x298cd6,_0x54c792){_0x298cd6=_0x298cd6-0x0;var _0x4bfb7e=_0xd43d[_0x298cd6];return _0x4bfb7e;};'use strict';var multer=require('multer');var util=require(_0xdd43('0x0'));var path=require('path');var timeout=require(_0xdd43('0x1'));var express=require(_0xdd43('0x2'));var router=express['Router']();var fs_extra=require(_0xdd43('0x3'));var auth=require(_0xdd43('0x4'));var interaction=require(_0xdd43('0x5'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0xdd43('0x6')]('/',auth[_0xdd43('0x7')](),controller[_0xdd43('0x8')]);router[_0xdd43('0x6')]('/:id',auth[_0xdd43('0x7')](),controller[_0xdd43('0x9')]);router[_0xdd43('0xa')]('/',auth[_0xdd43('0x7')](),controller[_0xdd43('0xb')]);router[_0xdd43('0xc')](_0xdd43('0xd'),auth[_0xdd43('0x7')](),controller['update']);router['delete'](_0xdd43('0xd'),auth[_0xdd43('0x7')](),controller['destroy']);module[_0xdd43('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index cc9b5e9..6878860 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 _0xb643=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0xe356a5,_0x1ddb4d){var _0x5d1829=function(_0x4104a2){while(--_0x4104a2){_0xe356a5['push'](_0xe356a5['shift']());}};_0x5d1829(++_0x1ddb4d);}(_0xb643,0xc5));var _0x3b64=function(_0x240039,_0x30397b){_0x240039=_0x240039-0x0;var _0x55458=_0xb643[_0x240039];return _0x55458;};'use strict';var Sequelize=require(_0x3b64('0x0'));module[_0x3b64('0x1')]={'priority':{'type':Sequelize[_0x3b64('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3b64('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3b64('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x3b64('0x5')}}; \ No newline at end of file +var _0xa02d=['exports','INTEGER','STRING','TEXT'];(function(_0x371e95,_0x300473){var _0x2e3d7b=function(_0x5375ea){while(--_0x5375ea){_0x371e95['push'](_0x371e95['shift']());}};_0x2e3d7b(++_0x300473);}(_0xa02d,0x178));var _0xda02=function(_0x3871d7,_0x3cfcc5){_0x3871d7=_0x3871d7-0x0;var _0x28ec09=_0xa02d[_0x3871d7];return _0x28ec09;};'use strict';var Sequelize=require('sequelize');module[_0xda02('0x0')]={'priority':{'type':Sequelize[_0xda02('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xda02('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xda02('0x3')]()},'description':{'type':Sequelize[_0xda02('0x2')]},'interval':{'type':Sequelize[_0xda02('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 8676a9d..8b969a6 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 _0xfc34=['count','status','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','OpenchannelApplication','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','filters','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','undefined','limit','offset'];(function(_0x27a0f8,_0x316150){var _0x4f96ad=function(_0x5d0357){while(--_0x5d0357){_0x27a0f8['push'](_0x27a0f8['shift']());}};_0x4f96ad(++_0x316150);}(_0xfc34,0x7a));var _0x4fc3=function(_0x1e45ec,_0x2e11eb){_0x1e45ec=_0x1e45ec-0x0;var _0x42f22d=_0xfc34[_0x1e45ec];return _0x42f22d;};'use strict';var emlformat=require(_0x4fc3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4fc3('0x1'));var jsonpatch=require(_0x4fc3('0x2'));var rp=require(_0x4fc3('0x3'));var moment=require(_0x4fc3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4fc3('0x5'));var util=require(_0x4fc3('0x6'));var path=require(_0x4fc3('0x7'));var sox=require(_0x4fc3('0x8'));var csv=require(_0x4fc3('0x9'));var ejs=require(_0x4fc3('0xa'));var fs=require('fs');var fs_extra=require(_0x4fc3('0xb'));var _=require(_0x4fc3('0xc'));var squel=require(_0x4fc3('0xd'));var crypto=require('crypto');var jsforce=require(_0x4fc3('0xe'));var deskjs=require(_0x4fc3('0xf'));var toCsv=require(_0x4fc3('0x9'));var querystring=require(_0x4fc3('0x10'));var Papa=require(_0x4fc3('0x11'));var Redis=require(_0x4fc3('0x12'));var authService=require(_0x4fc3('0x13'));var qs=require(_0x4fc3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4fc3('0x15'));var logger=require(_0x4fc3('0x16'))(_0x4fc3('0x17'));var utils=require(_0x4fc3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4fc3('0x19'));var db=require(_0x4fc3('0x1a'))['db'];function respondWithStatusCode(_0x17d19e,_0xd35a93){_0xd35a93=_0xd35a93||0xcc;return function(_0xc1d66c){if(_0xc1d66c){return _0x17d19e[_0x4fc3('0x1b')](_0xd35a93);}return _0x17d19e['status'](_0xd35a93)[_0x4fc3('0x1c')]();};}function respondWithResult(_0x2de19f,_0x1f83e7){_0x1f83e7=_0x1f83e7||0xc8;return function(_0x17a603){if(_0x17a603){return _0x2de19f['status'](_0x1f83e7)['json'](_0x17a603);}};}function respondWithFilteredResult(_0x1b7b5a,_0x1f3335){return function(_0x1de22b){if(_0x1de22b){var _0x3e6331=typeof _0x1f3335['offset']===_0x4fc3('0x1d')&&typeof _0x1f3335[_0x4fc3('0x1e')]===_0x4fc3('0x1d');var _0x15b9d5=_0x1de22b['count'];var _0x4bb682=_0x3e6331?0x0:_0x1f3335[_0x4fc3('0x1f')];var _0x5aa6f5=_0x3e6331?_0x1de22b[_0x4fc3('0x20')]:_0x1f3335[_0x4fc3('0x1f')]+_0x1f3335[_0x4fc3('0x1e')];var _0x5cdbf3;if(_0x5aa6f5>=_0x15b9d5){_0x5aa6f5=_0x15b9d5;_0x5cdbf3=0xc8;}else{_0x5cdbf3=0xce;}_0x1b7b5a[_0x4fc3('0x21')](_0x5cdbf3);return _0x1b7b5a['set'](_0x4fc3('0x22'),_0x4bb682+'-'+_0x5aa6f5+'/'+_0x15b9d5)[_0x4fc3('0x23')](_0x1de22b);}return null;};}function patchUpdates(_0x532458){return function(_0x3ed84b){try{jsonpatch[_0x4fc3('0x24')](_0x3ed84b,_0x532458,!![]);}catch(_0x187d5e){return BPromise[_0x4fc3('0x25')](_0x187d5e);}return _0x3ed84b['save']();};}function saveUpdates(_0x996a7b,_0x4baf7b){return function(_0x21463c){if(_0x21463c){return _0x21463c[_0x4fc3('0x26')](_0x996a7b)['then'](function(_0xb22cc){return _0xb22cc;});}return null;};}function removeEntity(_0x4ebbfe,_0x28d1f2){return function(_0x56a87a){if(_0x56a87a){return _0x56a87a[_0x4fc3('0x27')]()[_0x4fc3('0x28')](function(){_0x4ebbfe['status'](0xcc)[_0x4fc3('0x1c')]();});}};}function handleEntityNotFound(_0x16a50e,_0x13d890){return function(_0x2e2678){if(!_0x2e2678){_0x16a50e['sendStatus'](0x194);}return _0x2e2678;};}function handleError(_0x154ec9,_0x167c1a){_0x167c1a=_0x167c1a||0x1f4;return function(_0x2b4bb2){logger[_0x4fc3('0x29')](_0x2b4bb2[_0x4fc3('0x2a')]);if(_0x2b4bb2['name']){delete _0x2b4bb2[_0x4fc3('0x2b')];}_0x154ec9[_0x4fc3('0x21')](_0x167c1a)[_0x4fc3('0x2c')](_0x2b4bb2);};}exports[_0x4fc3('0x2d')]=function(_0x2df232,_0x3a1b52){var _0x53f6e5={},_0x364625={},_0x312962={'count':0x0,'rows':[]};var _0x302d29=_[_0x4fc3('0x2e')](db[_0x4fc3('0x2f')]['rawAttributes'],function(_0x485d81){return{'name':_0x485d81['fieldName'],'type':_0x485d81[_0x4fc3('0x30')][_0x4fc3('0x31')]};});_0x364625['model']=_[_0x4fc3('0x2e')](_0x302d29,_0x4fc3('0x2b'));_0x364625['query']=_[_0x4fc3('0x32')](_0x2df232[_0x4fc3('0x33')]);_0x364625['filters']=_[_0x4fc3('0x34')](_0x364625[_0x4fc3('0x35')],_0x364625[_0x4fc3('0x33')]);_0x53f6e5[_0x4fc3('0x36')]=_[_0x4fc3('0x34')](_0x364625[_0x4fc3('0x35')],qs['fields'](_0x2df232[_0x4fc3('0x33')][_0x4fc3('0x37')]));_0x53f6e5[_0x4fc3('0x36')]=_0x53f6e5['attributes'][_0x4fc3('0x38')]?_0x53f6e5[_0x4fc3('0x36')]:_0x364625[_0x4fc3('0x35')];if(!_0x2df232['query'][_0x4fc3('0x39')](_0x4fc3('0x3a'))){_0x53f6e5[_0x4fc3('0x1e')]=qs[_0x4fc3('0x1e')](_0x2df232[_0x4fc3('0x33')][_0x4fc3('0x1e')]);_0x53f6e5[_0x4fc3('0x1f')]=qs[_0x4fc3('0x1f')](_0x2df232['query'][_0x4fc3('0x1f')]);}_0x53f6e5[_0x4fc3('0x3b')]=qs['sort'](_0x2df232[_0x4fc3('0x33')][_0x4fc3('0x3c')]);_0x53f6e5[_0x4fc3('0x3d')]=qs['filters'](_['pick'](_0x2df232[_0x4fc3('0x33')],_0x364625['filters']),_0x302d29);if(_0x2df232[_0x4fc3('0x33')][_0x4fc3('0x3e')]){_0x53f6e5[_0x4fc3('0x3d')]=_[_0x4fc3('0x3f')](_0x53f6e5[_0x4fc3('0x3d')],{'$or':_[_0x4fc3('0x2e')](_0x302d29,function(_0x13a6af){if(_0x13a6af[_0x4fc3('0x30')]!==_0x4fc3('0x40')){var _0x27a307={};_0x27a307[_0x13a6af[_0x4fc3('0x2b')]]={'$like':'%'+_0x2df232[_0x4fc3('0x33')]['filter']+'%'};return _0x27a307;}})});}_0x53f6e5=_[_0x4fc3('0x3f')]({},_0x53f6e5,_0x2df232[_0x4fc3('0x41')]);var _0x593aed={'where':_0x53f6e5[_0x4fc3('0x3d')]};return db[_0x4fc3('0x2f')][_0x4fc3('0x20')](_0x593aed)[_0x4fc3('0x28')](function(_0x5013a1){_0x312962[_0x4fc3('0x20')]=_0x5013a1;if(_0x2df232['query'][_0x4fc3('0x42')]){_0x53f6e5['include']=[{'all':!![]}];}return db[_0x4fc3('0x2f')][_0x4fc3('0x43')](_0x53f6e5);})[_0x4fc3('0x28')](function(_0x102b4e){_0x312962['rows']=_0x102b4e;return _0x312962;})[_0x4fc3('0x28')](respondWithFilteredResult(_0x3a1b52,_0x53f6e5))[_0x4fc3('0x44')](handleError(_0x3a1b52,null));};exports[_0x4fc3('0x45')]=function(_0x58a4f8,_0x301a77){var _0x11294c={'raw':!![],'where':{'id':_0x58a4f8[_0x4fc3('0x46')]['id']}},_0x196d8f={};_0x196d8f[_0x4fc3('0x35')]=_['keys'](db[_0x4fc3('0x2f')][_0x4fc3('0x47')]);_0x196d8f['query']=_['keys'](_0x58a4f8[_0x4fc3('0x33')]);_0x196d8f[_0x4fc3('0x48')]=_[_0x4fc3('0x34')](_0x196d8f['model'],_0x196d8f[_0x4fc3('0x33')]);_0x11294c['attributes']=_[_0x4fc3('0x34')](_0x196d8f[_0x4fc3('0x35')],qs['fields'](_0x58a4f8[_0x4fc3('0x33')][_0x4fc3('0x37')]));_0x11294c['attributes']=_0x11294c[_0x4fc3('0x36')][_0x4fc3('0x38')]?_0x11294c['attributes']:_0x196d8f[_0x4fc3('0x35')];if(_0x58a4f8['query'][_0x4fc3('0x42')]){_0x11294c[_0x4fc3('0x49')]=[{'all':!![]}];}_0x11294c=_[_0x4fc3('0x3f')]({},_0x11294c,_0x58a4f8[_0x4fc3('0x41')]);return db[_0x4fc3('0x2f')][_0x4fc3('0x4a')](_0x11294c)[_0x4fc3('0x28')](handleEntityNotFound(_0x301a77,null))['then'](respondWithResult(_0x301a77,null))[_0x4fc3('0x44')](handleError(_0x301a77,null));};exports['create']=function(_0x13e3b6,_0x27e72c){return db['OpenchannelApplication'][_0x4fc3('0x4b')](_0x13e3b6[_0x4fc3('0x4c')],{})[_0x4fc3('0x28')](respondWithResult(_0x27e72c,0xc9))['catch'](handleError(_0x27e72c,null));};exports['update']=function(_0xa4e31f,_0x288297){if(_0xa4e31f[_0x4fc3('0x4c')]['id']){delete _0xa4e31f['body']['id'];}return db['OpenchannelApplication'][_0x4fc3('0x4a')]({'where':{'id':_0xa4e31f[_0x4fc3('0x46')]['id']}})[_0x4fc3('0x28')](handleEntityNotFound(_0x288297,null))[_0x4fc3('0x28')](saveUpdates(_0xa4e31f[_0x4fc3('0x4c')],null))[_0x4fc3('0x28')](respondWithResult(_0x288297,null))[_0x4fc3('0x44')](handleError(_0x288297,null));};exports[_0x4fc3('0x27')]=function(_0x3269cf,_0x27e06d){return db['OpenchannelApplication'][_0x4fc3('0x4a')]({'where':{'id':_0x3269cf[_0x4fc3('0x46')]['id']}})['then'](handleEntityNotFound(_0x27e06d,null))[_0x4fc3('0x28')](removeEntity(_0x27e06d,null))[_0x4fc3('0x44')](handleError(_0x27e06d,null));}; \ No newline at end of file +var _0x2e8a=['jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','OpenchannelApplication','findAll','catch','show','keys','rawAttributes','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x46020e,_0x15949d){var _0x5af5c1=function(_0x514d6c){while(--_0x514d6c){_0x46020e['push'](_0x46020e['shift']());}};_0x5af5c1(++_0x15949d);}(_0x2e8a,0x1bf));var _0xa2e8=function(_0x32be7d,_0x1e1fd6){_0x32be7d=_0x32be7d-0x0;var _0x3ddf=_0x2e8a[_0x32be7d];return _0x3ddf;};'use strict';var emlformat=require(_0xa2e8('0x0'));var rimraf=require(_0xa2e8('0x1'));var zipdir=require(_0xa2e8('0x2'));var jsonpatch=require(_0xa2e8('0x3'));var rp=require(_0xa2e8('0x4'));var moment=require(_0xa2e8('0x5'));var BPromise=require(_0xa2e8('0x6'));var Mustache=require(_0xa2e8('0x7'));var util=require('util');var path=require(_0xa2e8('0x8'));var sox=require(_0xa2e8('0x9'));var csv=require(_0xa2e8('0xa'));var ejs=require(_0xa2e8('0xb'));var fs=require('fs');var fs_extra=require(_0xa2e8('0xc'));var _=require('lodash');var squel=require(_0xa2e8('0xd'));var crypto=require(_0xa2e8('0xe'));var jsforce=require(_0xa2e8('0xf'));var deskjs=require(_0xa2e8('0x10'));var toCsv=require(_0xa2e8('0xa'));var querystring=require('querystring');var Papa=require(_0xa2e8('0x11'));var Redis=require('ioredis');var authService=require(_0xa2e8('0x12'));var qs=require(_0xa2e8('0x13'));var as=require(_0xa2e8('0x14'));var hardwareService=require(_0xa2e8('0x15'));var logger=require(_0xa2e8('0x16'))(_0xa2e8('0x17'));var utils=require(_0xa2e8('0x18'));var config=require(_0xa2e8('0x19'));var licenseUtil=require(_0xa2e8('0x1a'));var db=require(_0xa2e8('0x1b'))['db'];function respondWithStatusCode(_0x38360e,_0x54530e){_0x54530e=_0x54530e||0xcc;return function(_0x195dec){if(_0x195dec){return _0x38360e[_0xa2e8('0x1c')](_0x54530e);}return _0x38360e[_0xa2e8('0x1d')](_0x54530e)[_0xa2e8('0x1e')]();};}function respondWithResult(_0x554650,_0x4e633c){_0x4e633c=_0x4e633c||0xc8;return function(_0x4bcb9c){if(_0x4bcb9c){return _0x554650[_0xa2e8('0x1d')](_0x4e633c)[_0xa2e8('0x1f')](_0x4bcb9c);}};}function respondWithFilteredResult(_0x814139,_0x3ed325){return function(_0x2d8eea){if(_0x2d8eea){var _0xf7ebaf=typeof _0x3ed325['offset']===_0xa2e8('0x20')&&typeof _0x3ed325['limit']===_0xa2e8('0x20');var _0x14a1a1=_0x2d8eea[_0xa2e8('0x21')];var _0x1f4246=_0xf7ebaf?0x0:_0x3ed325[_0xa2e8('0x22')];var _0x19117d=_0xf7ebaf?_0x2d8eea[_0xa2e8('0x21')]:_0x3ed325[_0xa2e8('0x22')]+_0x3ed325['limit'];var _0xeea6ed;if(_0x19117d>=_0x14a1a1){_0x19117d=_0x14a1a1;_0xeea6ed=0xc8;}else{_0xeea6ed=0xce;}_0x814139['status'](_0xeea6ed);return _0x814139[_0xa2e8('0x23')](_0xa2e8('0x24'),_0x1f4246+'-'+_0x19117d+'/'+_0x14a1a1)[_0xa2e8('0x1f')](_0x2d8eea);}return null;};}function patchUpdates(_0x32afe3){return function(_0xc5d8f4){try{jsonpatch[_0xa2e8('0x25')](_0xc5d8f4,_0x32afe3,!![]);}catch(_0x4db4fd){return BPromise['reject'](_0x4db4fd);}return _0xc5d8f4[_0xa2e8('0x26')]();};}function saveUpdates(_0x589d24,_0x43cbd9){return function(_0x367d8d){if(_0x367d8d){return _0x367d8d['update'](_0x589d24)[_0xa2e8('0x27')](function(_0x49cc89){return _0x49cc89;});}return null;};}function removeEntity(_0x220c53,_0xe7af4){return function(_0x515a0f){if(_0x515a0f){return _0x515a0f[_0xa2e8('0x28')]()[_0xa2e8('0x27')](function(){_0x220c53[_0xa2e8('0x1d')](0xcc)[_0xa2e8('0x1e')]();});}};}function handleEntityNotFound(_0x4663e9,_0x41bef2){return function(_0x386c05){if(!_0x386c05){_0x4663e9[_0xa2e8('0x1c')](0x194);}return _0x386c05;};}function handleError(_0x29c1c0,_0x32f117){_0x32f117=_0x32f117||0x1f4;return function(_0x2c6627){logger[_0xa2e8('0x29')](_0x2c6627[_0xa2e8('0x2a')]);if(_0x2c6627[_0xa2e8('0x2b')]){delete _0x2c6627['name'];}_0x29c1c0['status'](_0x32f117)[_0xa2e8('0x2c')](_0x2c6627);};}exports[_0xa2e8('0x2d')]=function(_0x1078af,_0x287a6b){var _0x33772d={},_0x2db5f1={},_0x46add1={'count':0x0,'rows':[]};var _0x48902d=_[_0xa2e8('0x2e')](db['OpenchannelApplication']['rawAttributes'],function(_0x298c1c){return{'name':_0x298c1c['fieldName'],'type':_0x298c1c[_0xa2e8('0x2f')][_0xa2e8('0x30')]};});_0x2db5f1['model']=_[_0xa2e8('0x2e')](_0x48902d,_0xa2e8('0x2b'));_0x2db5f1[_0xa2e8('0x31')]=_['keys'](_0x1078af[_0xa2e8('0x31')]);_0x2db5f1[_0xa2e8('0x32')]=_[_0xa2e8('0x33')](_0x2db5f1[_0xa2e8('0x34')],_0x2db5f1['query']);_0x33772d['attributes']=_[_0xa2e8('0x33')](_0x2db5f1[_0xa2e8('0x34')],qs[_0xa2e8('0x35')](_0x1078af[_0xa2e8('0x31')][_0xa2e8('0x35')]));_0x33772d[_0xa2e8('0x36')]=_0x33772d['attributes'][_0xa2e8('0x37')]?_0x33772d['attributes']:_0x2db5f1['model'];if(!_0x1078af[_0xa2e8('0x31')][_0xa2e8('0x38')](_0xa2e8('0x39'))){_0x33772d['limit']=qs[_0xa2e8('0x3a')](_0x1078af[_0xa2e8('0x31')][_0xa2e8('0x3a')]);_0x33772d[_0xa2e8('0x22')]=qs[_0xa2e8('0x22')](_0x1078af[_0xa2e8('0x31')]['offset']);}_0x33772d[_0xa2e8('0x3b')]=qs[_0xa2e8('0x3c')](_0x1078af['query'][_0xa2e8('0x3c')]);_0x33772d[_0xa2e8('0x3d')]=qs[_0xa2e8('0x32')](_[_0xa2e8('0x3e')](_0x1078af[_0xa2e8('0x31')],_0x2db5f1[_0xa2e8('0x32')]),_0x48902d);if(_0x1078af[_0xa2e8('0x31')]['filter']){_0x33772d[_0xa2e8('0x3d')]=_[_0xa2e8('0x3f')](_0x33772d['where'],{'$or':_[_0xa2e8('0x2e')](_0x48902d,function(_0x270167){if(_0x270167['type']!==_0xa2e8('0x40')){var _0x2bc9ea={};_0x2bc9ea[_0x270167[_0xa2e8('0x2b')]]={'$like':'%'+_0x1078af[_0xa2e8('0x31')][_0xa2e8('0x41')]+'%'};return _0x2bc9ea;}})});}_0x33772d=_[_0xa2e8('0x3f')]({},_0x33772d,_0x1078af['options']);var _0x438121={'where':_0x33772d[_0xa2e8('0x3d')]};return db['OpenchannelApplication'][_0xa2e8('0x21')](_0x438121)['then'](function(_0x49127d){_0x46add1[_0xa2e8('0x21')]=_0x49127d;if(_0x1078af[_0xa2e8('0x31')]['includeAll']){_0x33772d['include']=[{'all':!![]}];}return db[_0xa2e8('0x42')][_0xa2e8('0x43')](_0x33772d);})[_0xa2e8('0x27')](function(_0x424bd8){_0x46add1['rows']=_0x424bd8;return _0x46add1;})[_0xa2e8('0x27')](respondWithFilteredResult(_0x287a6b,_0x33772d))[_0xa2e8('0x44')](handleError(_0x287a6b,null));};exports[_0xa2e8('0x45')]=function(_0x26e7c4,_0x5b43a4){var _0x251582={'raw':!![],'where':{'id':_0x26e7c4['params']['id']}},_0x4081d0={};_0x4081d0[_0xa2e8('0x34')]=_[_0xa2e8('0x46')](db[_0xa2e8('0x42')][_0xa2e8('0x47')]);_0x4081d0['query']=_[_0xa2e8('0x46')](_0x26e7c4['query']);_0x4081d0['filters']=_[_0xa2e8('0x33')](_0x4081d0['model'],_0x4081d0[_0xa2e8('0x31')]);_0x251582[_0xa2e8('0x36')]=_['intersection'](_0x4081d0[_0xa2e8('0x34')],qs['fields'](_0x26e7c4[_0xa2e8('0x31')][_0xa2e8('0x35')]));_0x251582[_0xa2e8('0x36')]=_0x251582[_0xa2e8('0x36')][_0xa2e8('0x37')]?_0x251582[_0xa2e8('0x36')]:_0x4081d0[_0xa2e8('0x34')];if(_0x26e7c4['query']['includeAll']){_0x251582[_0xa2e8('0x48')]=[{'all':!![]}];}_0x251582=_['merge']({},_0x251582,_0x26e7c4['options']);return db['OpenchannelApplication'][_0xa2e8('0x49')](_0x251582)[_0xa2e8('0x27')](handleEntityNotFound(_0x5b43a4,null))[_0xa2e8('0x27')](respondWithResult(_0x5b43a4,null))['catch'](handleError(_0x5b43a4,null));};exports[_0xa2e8('0x4a')]=function(_0x440ece,_0x116ee6){return db[_0xa2e8('0x42')][_0xa2e8('0x4a')](_0x440ece['body'],{})[_0xa2e8('0x27')](respondWithResult(_0x116ee6,0xc9))[_0xa2e8('0x44')](handleError(_0x116ee6,null));};exports['update']=function(_0x16b531,_0x2a52ca){if(_0x16b531[_0xa2e8('0x4b')]['id']){delete _0x16b531[_0xa2e8('0x4b')]['id'];}return db[_0xa2e8('0x42')][_0xa2e8('0x49')]({'where':{'id':_0x16b531[_0xa2e8('0x4c')]['id']}})[_0xa2e8('0x27')](handleEntityNotFound(_0x2a52ca,null))[_0xa2e8('0x27')](saveUpdates(_0x16b531[_0xa2e8('0x4b')],null))[_0xa2e8('0x27')](respondWithResult(_0x2a52ca,null))['catch'](handleError(_0x2a52ca,null));};exports[_0xa2e8('0x28')]=function(_0x1a32a0,_0x1a6c1e){return db[_0xa2e8('0x42')][_0xa2e8('0x49')]({'where':{'id':_0x1a32a0[_0xa2e8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1a6c1e,null))[_0xa2e8('0x27')](removeEntity(_0x1a6c1e,null))[_0xa2e8('0x44')](handleError(_0x1a6c1e,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 1eb21a5..82314d5 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 _0xd1f6=['utf8mb4_unicode_ci','lodash','util','api','bluebird','path','rimraf','exports','OpenchannelApplication','openchannel_applications'];(function(_0x4c2623,_0x4838bb){var _0x2be431=function(_0x55829d){while(--_0x55829d){_0x4c2623['push'](_0x4c2623['shift']());}};_0x2be431(++_0x4838bb);}(_0xd1f6,0x155));var _0x6d1f=function(_0x465110,_0x187e0d){_0x465110=_0x465110-0x0;var _0x2a8098=_0xd1f6[_0x465110];return _0x2a8098;};'use strict';var _=require(_0x6d1f('0x0'));var util=require(_0x6d1f('0x1'));var logger=require('../../config/logger')(_0x6d1f('0x2'));var moment=require('moment');var BPromise=require(_0x6d1f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d1f('0x4'));var rimraf=require(_0x6d1f('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0x6d1f('0x6')]=function(_0x5f14b4,_0x23982e){return _0x5f14b4['define'](_0x6d1f('0x7'),attributes,{'tableName':_0x6d1f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6d1f('0x9')});}; \ No newline at end of file +var _0x8c8e=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','./openchannelApplication.attributes','exports','OpenchannelApplication'];(function(_0x5b3ce1,_0xedd65b){var _0x38b358=function(_0x154aa6){while(--_0x154aa6){_0x5b3ce1['push'](_0x5b3ce1['shift']());}};_0x38b358(++_0xedd65b);}(_0x8c8e,0x12f));var _0xe8c8=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x8c8e[_0x2d89ce];return _0x3fad10;};'use strict';var _=require(_0xe8c8('0x0'));var util=require(_0xe8c8('0x1'));var logger=require(_0xe8c8('0x2'))(_0xe8c8('0x3'));var moment=require(_0xe8c8('0x4'));var BPromise=require(_0xe8c8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe8c8('0x6'));module[_0xe8c8('0x7')]=function(_0x287d3a,_0x5af3e9){return _0x287d3a['define'](_0xe8c8('0x8'),attributes,{'tableName':_0xe8c8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe8c8('0xa'),'collate':_0xe8c8('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index d262009..9558f8f 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 _0xd541=['stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','limit','lodash','util','moment','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s'];(function(_0x4ef8cc,_0x47232c){var _0x5e8ba5=function(_0x3795f4){while(--_0x3795f4){_0x4ef8cc['push'](_0x4ef8cc['shift']());}};_0x5e8ba5(++_0x47232c);}(_0xd541,0x11d));var _0x1d54=function(_0x24d61f,_0x38cebb){_0x24d61f=_0x24d61f-0x0;var _0x29ae79=_0xd541[_0x24d61f];return _0x29ae79;};'use strict';var _=require(_0x1d54('0x0'));var util=require(_0x1d54('0x1'));var moment=require(_0x1d54('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d54('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1d54('0x4'));var config=require(_0x1d54('0x5'));var jayson=require(_0x1d54('0x6'));var client=jayson[_0x1d54('0x7')][_0x1d54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x432fd4,_0x48850c,_0x34a9d1){return new BPromise(function(_0x1ca9c7,_0x3f77f5){return client[_0x1d54('0x9')](_0x432fd4,_0x34a9d1)[_0x1d54('0xa')](function(_0x377d61){logger[_0x1d54('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x48850c,_0x1d54('0xc'));logger[_0x1d54('0xd')](_0x1d54('0xe'),_0x48850c,_0x1d54('0xc'),JSON[_0x1d54('0xf')](_0x377d61));if(_0x377d61[_0x1d54('0x10')]){if(_0x377d61[_0x1d54('0x10')][_0x1d54('0x11')]===0x1f4){logger[_0x1d54('0x10')](_0x1d54('0x12'),_0x48850c,_0x377d61[_0x1d54('0x10')][_0x1d54('0x13')]);return _0x3f77f5(_0x377d61['error']['message']);}logger[_0x1d54('0x10')](_0x1d54('0x12'),_0x48850c,_0x377d61['error'][_0x1d54('0x13')]);return _0x1ca9c7(_0x377d61['error']['message']);}else{logger[_0x1d54('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x48850c,_0x1d54('0xc'));_0x1ca9c7(_0x377d61[_0x1d54('0x14')]['message']);}})[_0x1d54('0x15')](function(_0x486e7e){logger[_0x1d54('0x10')](_0x1d54('0x12'),_0x48850c,_0x486e7e);_0x3f77f5(_0x486e7e);});});}exports[_0x1d54('0x16')]=function(_0x1a2e8a){var _0x5c896a=this;return new Promise(function(_0x1c0afb,_0x25b0fc){return db[_0x1d54('0x17')][_0x1d54('0x18')](_0x1a2e8a[_0x1d54('0x19')],{'raw':_0x1a2e8a[_0x1d54('0x1a')]?_0x1a2e8a[_0x1d54('0x1a')][_0x1d54('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a2e8a[_0x1d54('0x1a')]?_0x1a2e8a[_0x1d54('0x1a')][_0x1d54('0x1c')]||null:null,'attributes':_0x1a2e8a[_0x1d54('0x1a')]?_0x1a2e8a['options']['attributes']||null:null,'limit':_0x1a2e8a['options']?_0x1a2e8a['options'][_0x1d54('0x1d')]||null:null})['then'](function(_0x3677f7){logger[_0x1d54('0xb')](_0x1d54('0x16'),_0x1a2e8a);logger[_0x1d54('0xd')](_0x1d54('0x16'),_0x1a2e8a,JSON['stringify'](_0x3677f7));_0x1c0afb(_0x3677f7);})[_0x1d54('0x15')](function(_0x5e7903){logger[_0x1d54('0x10')](_0x1d54('0x16'),_0x5e7903[_0x1d54('0x13')],_0x1a2e8a);_0x25b0fc(_0x5c896a[_0x1d54('0x10')](0x1f4,_0x5e7903['message']));});});}; \ No newline at end of file +var _0x8aba=['request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','OpenchannelApplication','update','options','raw','where','attributes','limit','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','OpenchannelApplication,\x20%s,\x20%s'];(function(_0x58fe86,_0x19655f){var _0x3f0732=function(_0x1d0b4a){while(--_0x1d0b4a){_0x58fe86['push'](_0x58fe86['shift']());}};_0x3f0732(++_0x19655f);}(_0x8aba,0x184));var _0xa8ab=function(_0x3bb51f,_0x54bea4){_0x3bb51f=_0x3bb51f-0x0;var _0x32932e=_0x8aba[_0x3bb51f];return _0x32932e;};'use strict';var _=require(_0xa8ab('0x0'));var util=require(_0xa8ab('0x1'));var moment=require(_0xa8ab('0x2'));var BPromise=require(_0xa8ab('0x3'));var rs=require(_0xa8ab('0x4'));var fs=require('fs');var Redis=require(_0xa8ab('0x5'));var db=require(_0xa8ab('0x6'))['db'];var utils=require(_0xa8ab('0x7'));var logger=require(_0xa8ab('0x8'))(_0xa8ab('0x9'));var config=require(_0xa8ab('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa8ab('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x695b12,_0xeaa21a,_0x169ab3){return new BPromise(function(_0x5a65cc,_0x3380bc){return client[_0xa8ab('0xc')](_0x695b12,_0x169ab3)[_0xa8ab('0xd')](function(_0x5ed0ee){logger['info'](_0xa8ab('0xe'),_0xeaa21a,_0xa8ab('0xf'));logger[_0xa8ab('0x10')](_0xa8ab('0x11'),_0xeaa21a,_0xa8ab('0xf'),JSON[_0xa8ab('0x12')](_0x5ed0ee));if(_0x5ed0ee[_0xa8ab('0x13')]){if(_0x5ed0ee[_0xa8ab('0x13')]['code']===0x1f4){logger[_0xa8ab('0x13')](_0xa8ab('0xe'),_0xeaa21a,_0x5ed0ee['error'][_0xa8ab('0x14')]);return _0x3380bc(_0x5ed0ee[_0xa8ab('0x13')]['message']);}logger['error'](_0xa8ab('0xe'),_0xeaa21a,_0x5ed0ee['error'][_0xa8ab('0x14')]);return _0x5a65cc(_0x5ed0ee[_0xa8ab('0x13')][_0xa8ab('0x14')]);}else{logger[_0xa8ab('0x15')](_0xa8ab('0xe'),_0xeaa21a,_0xa8ab('0xf'));_0x5a65cc(_0x5ed0ee['result']['message']);}})[_0xa8ab('0x16')](function(_0x21e474){logger[_0xa8ab('0x13')](_0xa8ab('0xe'),_0xeaa21a,_0x21e474);_0x3380bc(_0x21e474);});});}exports['UpdateOpenchannelApplication']=function(_0x3aabe0){var _0x396fc3=this;return new Promise(function(_0x58cf0f,_0x4eacae){return db[_0xa8ab('0x17')][_0xa8ab('0x18')](_0x3aabe0['body'],{'raw':_0x3aabe0[_0xa8ab('0x19')]?_0x3aabe0[_0xa8ab('0x19')][_0xa8ab('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aabe0[_0xa8ab('0x19')]?_0x3aabe0[_0xa8ab('0x19')][_0xa8ab('0x1b')]||null:null,'attributes':_0x3aabe0[_0xa8ab('0x19')]?_0x3aabe0['options'][_0xa8ab('0x1c')]||null:null,'limit':_0x3aabe0[_0xa8ab('0x19')]?_0x3aabe0[_0xa8ab('0x19')][_0xa8ab('0x1d')]||null:null})[_0xa8ab('0xd')](function(_0x124105){logger['info']('UpdateOpenchannelApplication',_0x3aabe0);logger[_0xa8ab('0x10')](_0xa8ab('0x1e'),_0x3aabe0,JSON[_0xa8ab('0x12')](_0x124105));_0x58cf0f(_0x124105);})[_0xa8ab('0x16')](function(_0x3425c1){logger[_0xa8ab('0x13')]('UpdateOpenchannelApplication',_0x3425c1[_0xa8ab('0x14')],_0x3aabe0);_0x4eacae(_0x396fc3[_0xa8ab('0x13')](0x1f4,_0x3425c1[_0xa8ab('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 12de717..c69ef09 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 _0x4ba6=['delete','openchannel','openchannelinteraction:destroy','removeTags','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','download','post','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update'];(function(_0x54f8fc,_0x215578){var _0x3ed3fd=function(_0x1350ee){while(--_0x1350ee){_0x54f8fc['push'](_0x54f8fc['shift']());}};_0x3ed3fd(++_0x215578);}(_0x4ba6,0x148));var _0x64ba=function(_0x1809c5,_0x46cabc){_0x1809c5=_0x1809c5-0x0;var _0x5254a4=_0x4ba6[_0x1809c5];return _0x5254a4;};'use strict';var multer=require(_0x64ba('0x0'));var util=require(_0x64ba('0x1'));var path=require(_0x64ba('0x2'));var timeout=require(_0x64ba('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x64ba('0x4'));var config=require(_0x64ba('0x5'));var controller=require(_0x64ba('0x6'));router[_0x64ba('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x64ba('0x7')](_0x64ba('0x8'),auth['isAuthenticated'](),controller[_0x64ba('0x9')]);router[_0x64ba('0x7')](_0x64ba('0xa'),auth[_0x64ba('0xb')](),controller[_0x64ba('0xc')]);router[_0x64ba('0x7')](_0x64ba('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0x64ba('0x7')]('/:id/download',auth[_0x64ba('0xb')](),controller[_0x64ba('0xe')]);router['post']('/',auth[_0x64ba('0xb')](),controller['create']);router[_0x64ba('0xf')](_0x64ba('0xd'),auth[_0x64ba('0xb')](),controller['addMessage']);router[_0x64ba('0xf')](_0x64ba('0x10'),auth[_0x64ba('0xb')](),interaction[_0x64ba('0x11')]('openchannel',_0x64ba('0x12')),controller[_0x64ba('0x13')]);router[_0x64ba('0x14')](_0x64ba('0xa'),auth[_0x64ba('0xb')](),interaction[_0x64ba('0x11')]('openchannel',_0x64ba('0x15')),controller[_0x64ba('0x16')]);router[_0x64ba('0x17')](_0x64ba('0xa'),auth[_0x64ba('0xb')](),interaction[_0x64ba('0x11')](_0x64ba('0x18'),_0x64ba('0x19')),controller['destroy']);router[_0x64ba('0x17')](_0x64ba('0x10'),auth['isAuthenticated'](),controller[_0x64ba('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x6127=['tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','post','/:id/messages','addMessage','/:id/tags'];(function(_0x451402,_0x561cb8){var _0x4ffb7f=function(_0x1c263a){while(--_0x1c263a){_0x451402['push'](_0x451402['shift']());}};_0x4ffb7f(++_0x561cb8);}(_0x6127,0x83));var _0x7612=function(_0x9daaa1,_0x2bb365){_0x9daaa1=_0x9daaa1-0x0;var _0x326549=_0x6127[_0x9daaa1];return _0x326549;};'use strict';var multer=require(_0x7612('0x0'));var util=require('util');var path=require(_0x7612('0x1'));var timeout=require('connect-timeout');var express=require(_0x7612('0x2'));var router=express[_0x7612('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7612('0x4'));var config=require(_0x7612('0x5'));var controller=require(_0x7612('0x6'));router[_0x7612('0x7')]('/',auth['isAuthenticated'](),controller[_0x7612('0x8')]);router['get'](_0x7612('0x9'),auth[_0x7612('0xa')](),controller[_0x7612('0xb')]);router[_0x7612('0x7')](_0x7612('0xc'),auth[_0x7612('0xa')](),controller[_0x7612('0xd')]);router[_0x7612('0x7')]('/:id/messages',auth[_0x7612('0xa')](),controller['getMessages']);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x7612('0xe')]);router[_0x7612('0xf')](_0x7612('0x10'),auth[_0x7612('0xa')](),controller[_0x7612('0x11')]);router[_0x7612('0xf')](_0x7612('0x12'),auth['isAuthenticated'](),interaction[_0x7612('0x13')](_0x7612('0x14'),_0x7612('0x15')),controller[_0x7612('0x16')]);router[_0x7612('0x17')](_0x7612('0xc'),auth[_0x7612('0xa')](),interaction[_0x7612('0x13')]('openchannel',_0x7612('0x18')),controller[_0x7612('0x19')]);router['delete'](_0x7612('0xc'),auth[_0x7612('0xa')](),interaction['tracked'](_0x7612('0x14'),_0x7612('0x1a')),controller[_0x7612('0x1b')]);router[_0x7612('0x1c')](_0x7612('0x12'),auth[_0x7612('0xa')](),controller['removeTags']);module[_0x7612('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 1653f07..a300526 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 _0xf3be=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xf3be,0x178));var _0xef3b=function(_0x3ac4f8,_0xd8862){_0x3ac4f8=_0x3ac4f8-0x0;var _0x1e6c82=_0xf3be[_0x3ac4f8];return _0x1e6c82;};'use strict';var Sequelize=require(_0xef3b('0x0'));module[_0xef3b('0x1')]={'closed':{'type':Sequelize[_0xef3b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xef3b('0x3')]},'disposition':{'type':Sequelize[_0xef3b('0x4')]},'secondDisposition':{'type':Sequelize[_0xef3b('0x4')]},'thirdDisposition':{'type':Sequelize[_0xef3b('0x4')]},'note':{'type':Sequelize[_0xef3b('0x4')]},'read1stAt':{'type':Sequelize[_0xef3b('0x3')]},'threadId':{'type':Sequelize[_0xef3b('0x4')]},'externalUrl':{'type':Sequelize[_0xef3b('0x4')]},'lastMsgAt':{'type':Sequelize[_0xef3b('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xef3b('0x5')]('in',_0xef3b('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xef3b('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xef3b('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xf131=['DATE','STRING','ENUM','sequelize','exports','BOOLEAN'];(function(_0x46066f,_0x23105c){var _0x411977=function(_0x5743ff){while(--_0x5743ff){_0x46066f['push'](_0x46066f['shift']());}};_0x411977(++_0x23105c);}(_0xf131,0x1a1));var _0x1f13=function(_0x238546,_0x33e8be){_0x238546=_0x238546-0x0;var _0x43a35d=_0xf131[_0x238546];return _0x43a35d;};'use strict';var Sequelize=require(_0x1f13('0x0'));module[_0x1f13('0x1')]={'closed':{'type':Sequelize[_0x1f13('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1f13('0x3')]},'disposition':{'type':Sequelize[_0x1f13('0x4')]},'secondDisposition':{'type':Sequelize[_0x1f13('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1f13('0x4')]},'note':{'type':Sequelize[_0x1f13('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x1f13('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x1f13('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x1f13('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x1f13('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x1f13('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 68bb36d..634479c 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 _0x6aaa=['update','then','destroy','stack','name','send','Users','fullname','Tags','forEach','push','TagIds','catch','talking','total','UserId','waiting','closed','answered','unmanaged','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','field','color','from','tools_tags','select','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','openchannel_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','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?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','$substring','end','body','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','agent','sequelize','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','toString','groupBy','OpenchannelInteractionId','rows','show','params','OpenchannelInteraction','options','create','describe','addMessage','OpenchannelMessage','ids','omit','findOne','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','addTags','setTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','closedAt','disposition','threadId','Public','Private','basename','createReadStream','pipe','createWriteStream','System','renderFile','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','eml-format','zip-dir','fast-json-patch','moment','mustache','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save'];(function(_0xdd2add,_0x533d58){var _0x276c54=function(_0x285bb0){while(--_0x285bb0){_0xdd2add['push'](_0xdd2add['shift']());}};_0x276c54(++_0x533d58);}(_0x6aaa,0xcc));var _0xa6aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aaa[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa6aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa6aa('0x1'));var jsonpatch=require(_0xa6aa('0x2'));var rp=require('request-promise');var moment=require(_0xa6aa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa6aa('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa6aa('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa6aa('0x6'));var _=require(_0xa6aa('0x7'));var squel=require(_0xa6aa('0x8'));var crypto=require(_0xa6aa('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa6aa('0xa'));var toCsv=require(_0xa6aa('0xb'));var querystring=require(_0xa6aa('0xc'));var Papa=require(_0xa6aa('0xd'));var Redis=require(_0xa6aa('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6aa('0xf'));var pdf=require(_0xa6aa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa6aa('0x11'))(_0xa6aa('0x12'));var utils=require(_0xa6aa('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa6aa('0x14'));var db=require(_0xa6aa('0x15'))['db'];config[_0xa6aa('0x16')]=_[_0xa6aa('0x17')](config['redis'],{'host':_0xa6aa('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa6aa('0x16')]));require(_0xa6aa('0x19'))[_0xa6aa('0x1a')](socket);function respondWithStatusCode(_0x26fbbe,_0x12697e){_0x12697e=_0x12697e||0xcc;return function(_0xfc3235){if(_0xfc3235){return _0x26fbbe[_0xa6aa('0x1b')](_0x12697e);}return _0x26fbbe[_0xa6aa('0x1c')](_0x12697e)['end']();};}function respondWithResult(_0x297602,_0x2189a1){_0x2189a1=_0x2189a1||0xc8;return function(_0x4ef742){if(_0x4ef742){return _0x297602[_0xa6aa('0x1c')](_0x2189a1)['json'](_0x4ef742);}};}function respondWithFilteredResult(_0x234777,_0x914178){return function(_0xa5bab0){if(_0xa5bab0){var _0x20b2c3=typeof _0x914178[_0xa6aa('0x1d')]===_0xa6aa('0x1e')&&typeof _0x914178[_0xa6aa('0x1f')]===_0xa6aa('0x1e');var _0x353a97=_0xa5bab0[_0xa6aa('0x20')];var _0x48f071=_0x20b2c3?0x0:_0x914178['offset'];var _0x27ae15=_0x20b2c3?_0xa5bab0[_0xa6aa('0x20')]:_0x914178[_0xa6aa('0x1d')]+_0x914178[_0xa6aa('0x1f')];var _0x548463;if(_0x27ae15>=_0x353a97){_0x27ae15=_0x353a97;_0x548463=0xc8;}else{_0x548463=0xce;}_0x234777[_0xa6aa('0x1c')](_0x548463);return _0x234777[_0xa6aa('0x21')]('Content-Range',_0x48f071+'-'+_0x27ae15+'/'+_0x353a97)['json'](_0xa5bab0);}return null;};}function patchUpdates(_0x43ab1f){return function(_0x5a14dd){try{jsonpatch[_0xa6aa('0x22')](_0x5a14dd,_0x43ab1f,!![]);}catch(_0x2cb88f){return BPromise[_0xa6aa('0x23')](_0x2cb88f);}return _0x5a14dd[_0xa6aa('0x24')]();};}function saveUpdates(_0x29efe8,_0xed848d){return function(_0x3758f7){if(_0x3758f7){return _0x3758f7[_0xa6aa('0x25')](_0x29efe8)[_0xa6aa('0x26')](function(_0x68e19d){return _0x68e19d;});}return null;};}function removeEntity(_0x2087f5,_0x3f37c3){return function(_0x50914e){if(_0x50914e){return _0x50914e[_0xa6aa('0x27')]()[_0xa6aa('0x26')](function(){_0x2087f5[_0xa6aa('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26bd2f,_0x37437a){return function(_0x26048f){if(!_0x26048f){_0x26bd2f[_0xa6aa('0x1b')](0x194);}return _0x26048f;};}function handleError(_0x2503b9,_0x33a4a8){_0x33a4a8=_0x33a4a8||0x1f4;return function(_0x4a33ba){logger['error'](_0x4a33ba[_0xa6aa('0x28')]);if(_0x4a33ba[_0xa6aa('0x29')]){delete _0x4a33ba[_0xa6aa('0x29')];}_0x2503b9[_0xa6aa('0x1c')](_0x33a4a8)[_0xa6aa('0x2a')](_0x4a33ba);};}function getInteractionUsers(_0x9a9cdb,_0x525bf2){return new BPromise(function(_0x348588,_0x3a1fe9){try{if(_0x525bf2[_0x9a9cdb['id']]){_0x9a9cdb[_0xa6aa('0x2b')]=_['map'](_0x525bf2[_0x9a9cdb['id']],function(_0x1e8a9f){return{'id':_0x1e8a9f['id'],'fullname':_0x1e8a9f[_0xa6aa('0x2c')]};});}}catch(_0x270964){_0x3a1fe9(_0x270964);}_0x348588(_0x9a9cdb);});}function getInteractionTags(_0x447aa3,_0x20c62d){return new BPromise(function(_0x1be9f9,_0x18a69a){try{if(_0x447aa3['TagIds']){_0x447aa3[_0xa6aa('0x2d')]=[];_0x447aa3['TagIds']['split'](',')[_0xa6aa('0x2e')](function(_0x351b4c){_0x447aa3[_0xa6aa('0x2d')][_0xa6aa('0x2f')](_0x20c62d[_0x351b4c]);});}delete _0x447aa3[_0xa6aa('0x30')];}catch(_0x19120b){_0x18a69a(_0x19120b);}_0x1be9f9(_0x447aa3);});}function updateOpenchannelInteraction(_0xe3806a,_0x22aca3,_0x5e9067){return new BPromise(function(_0x29e6e0,_0x13bb83){return getInteractionUsers(_0xe3806a,_0x5e9067)['then'](function(_0x29d448){return getInteractionTags(_0x29d448,_0x22aca3);})[_0xa6aa('0x26')](function(_0x2c7f71){return getStateInteraction(_0x2c7f71);})['then'](function(_0x3e2331){_0x29e6e0(_0x3e2331);})[_0xa6aa('0x31')](function(_0x32933b){_0x13bb83(_0x32933b);});});}function getStateInteraction(_0x409e3e){return new BPromise(function(_0x1c5c66){_0x409e3e['waiting']=0x0;_0x409e3e[_0xa6aa('0x32')]=0x0;_0x409e3e['answered']=0x0;_0x409e3e['unmanaged']=0x0;_0x409e3e[_0xa6aa('0x33')]=0x0;if(!_0x409e3e['closed']&&!_0x409e3e[_0xa6aa('0x34')]){_0x409e3e[_0xa6aa('0x35')]+=0x1;}if(!_0x409e3e[_0xa6aa('0x36')]&&_0x409e3e['UserId']){_0x409e3e[_0xa6aa('0x32')]+=0x1;if(_0x409e3e[_0xa6aa('0x35')]){_0x409e3e[_0xa6aa('0x35')]-=0x1;}}if(_0x409e3e['closed']&&_0x409e3e[_0xa6aa('0x34')]){_0x409e3e[_0xa6aa('0x37')]+=0x1;if(_0x409e3e['talking']){_0x409e3e['talking']-=0x1;}}if(_0x409e3e[_0xa6aa('0x36')]&&!_0x409e3e[_0xa6aa('0x34')]){_0x409e3e[_0xa6aa('0x38')]+=0x1;if(_0x409e3e['waiting']){_0x409e3e[_0xa6aa('0x35')]-=0x1;}}_0x409e3e['total']+=0x1;_0x1c5c66(_0x409e3e);});}exports[_0xa6aa('0x39')]=function(_0x5e6b56,_0x3ffec5){var _0x25c0e8={},_0x2a7c04={},_0x4c82cc={'count':0x0,'rows':[]};var _0x2a7db5=_[_0xa6aa('0x3a')](db['OpenchannelInteraction'][_0xa6aa('0x3b')],function(_0x241124){return{'name':_0x241124[_0xa6aa('0x3c')],'type':_0x241124[_0xa6aa('0x3d')][_0xa6aa('0x3e')]};});_0x2a7c04[_0xa6aa('0x3f')]=_['map'](_0x2a7db5,_0xa6aa('0x29'));_0x2a7c04['query']=_[_0xa6aa('0x40')](_0x5e6b56[_0xa6aa('0x41')]);_0x2a7c04['filters']=_[_0xa6aa('0x42')](_0x2a7c04[_0xa6aa('0x3f')],_0x2a7c04['query']);_0x25c0e8[_0xa6aa('0x43')]=_[_0xa6aa('0x42')](_0x2a7c04[_0xa6aa('0x3f')],qs[_0xa6aa('0x44')](_0x5e6b56['query'][_0xa6aa('0x44')]));_0x25c0e8[_0xa6aa('0x43')]=_0x25c0e8['attributes'][_0xa6aa('0x45')]?_0x25c0e8[_0xa6aa('0x43')]:_0x2a7c04[_0xa6aa('0x3f')];if(!_0x5e6b56['query'][_0xa6aa('0x46')]('nolimit')){_0x25c0e8[_0xa6aa('0x1f')]=qs[_0xa6aa('0x1f')](_0x5e6b56['query'][_0xa6aa('0x1f')]);_0x25c0e8[_0xa6aa('0x1d')]=qs[_0xa6aa('0x1d')](_0x5e6b56['query']['offset']);}_0x25c0e8[_0xa6aa('0x47')]=qs[_0xa6aa('0x48')](_0x5e6b56[_0xa6aa('0x41')][_0xa6aa('0x48')]);_0x25c0e8[_0xa6aa('0x49')]=qs[_0xa6aa('0x4a')](_[_0xa6aa('0x4b')](_0x5e6b56[_0xa6aa('0x41')],_0x2a7c04[_0xa6aa('0x4a')]),_0x2a7db5);var _0x32f58f=[];var _0x2d4094=squel['select']()[_0xa6aa('0x4c')]('id')[_0xa6aa('0x4c')](_0xa6aa('0x29'))[_0xa6aa('0x4c')](_0xa6aa('0x4d'))[_0xa6aa('0x4e')](_0xa6aa('0x4f'));var _0x5513ad=squel[_0xa6aa('0x50')]()[_0xa6aa('0x4c')]('u.id')[_0xa6aa('0x4c')](_0xa6aa('0x51'))['field'](_0xa6aa('0x52'))[_0xa6aa('0x4e')](_0xa6aa('0x53'),'ui')['left_join'](_0xa6aa('0x54'),'u','u.id\x20=\x20ui.UserId');var _0x2a409d=squel['select']()[_0xa6aa('0x4e')](_0xa6aa('0x55'),'i')[_0xa6aa('0x56')]('cm_contacts','c',_0xa6aa('0x57'))['left_join'](_0xa6aa('0x54'),'o',_0xa6aa('0x58'))['left_join']('openchannel_accounts','a',_0xa6aa('0x59'))[_0xa6aa('0x56')](_0xa6aa('0x5a'),'me',_0xa6aa('0x5b'))[_0xa6aa('0x56')](_0xa6aa('0x5c'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xa6aa('0x56')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x2d7852=squel[_0xa6aa('0x5d')]();var _0xf52168=[];var _0x49c581=squel[_0xa6aa('0x5d')]();var _0x161498;if(_0x5e6b56[_0xa6aa('0x41')][_0xa6aa('0x5e')]){_0x161498=as[_0xa6aa('0x5f')](_0x5e6b56[_0xa6aa('0x41')][_0xa6aa('0x5e')]);var _0x5d638f=_0x161498[_0xa6aa('0x60')];for(var _0x54970e=0x0;_0x54970e<_0x161498[_0xa6aa('0x61')][_0xa6aa('0x45')];_0x54970e++){var _0x57f10b=_0x161498['conditions'][_0x54970e];var _0x4129b6='i';var _0x597923=_[_0xa6aa('0x62')](_0x2a7db5,[_0xa6aa('0x29'),_0x57f10b['field']]);if(!_0x597923){switch(_0x57f10b[_0xa6aa('0x4c')]){case _0xa6aa('0x63'):if(_0x57f10b[_0xa6aa('0x64')]==0x1){_0x2a409d[_0xa6aa('0x65')]('`'+_0x57f10b[_0xa6aa('0x4c')]+_0xa6aa('0x66'));}else{_0x2a409d[_0xa6aa('0x65')]('`'+_0x57f10b[_0xa6aa('0x4c')]+_0xa6aa('0x67'));}break;case'Contact':if(_0x57f10b['operator']==='$substring'){if(_0x57f10b[_0xa6aa('0x64')][_0xa6aa('0x68')]('\x20')[_0xa6aa('0x45')]>0x1){_0x2d7852[_0x5d638f](_0xa6aa('0x69'),qs[_0xa6aa('0x6a')](_0x57f10b[_0xa6aa('0x64')]),null);}else{var _0x1056da='%'+_0x57f10b[_0xa6aa('0x64')]+'%';_0x2d7852[_0x5d638f](_0xa6aa('0x6b'),_0x1056da,_0x1056da,_0x1056da);}}else{_0x597923=_[_0xa6aa('0x62')](_0x2a7db5,[_0xa6aa('0x29'),_0xa6aa('0x6c')]);_0x57f10b[_0xa6aa('0x4c')]=_0xa6aa('0x6c');_0x3214a0=as[_0xa6aa('0x6d')](_0x4129b6,_0x597923['type'],_0x57f10b);_0x2d7852[_0x5d638f](_0x3214a0[_0xa6aa('0x6e')],_0x3214a0[_0xa6aa('0x64')][_0xa6aa('0x6f')],_0x3214a0[_0xa6aa('0x64')]['end']);}break;case _0xa6aa('0x70'):var _0x10748a=_0x57f10b[_0xa6aa('0x64')][_0xa6aa('0x68')](',')[_0xa6aa('0x3a')](function(_0x1a5062){return Number(_0x1a5062);});_0x10748a[_0xa6aa('0x2e')](function(_0x5ea77c){_0x49c581['or'](_0xa6aa('0x71'),'%,'+_0x5ea77c+',%');});_0xf52168=_[_0xa6aa('0x72')](_0xf52168,_0x10748a);break;case _0xa6aa('0x73'):if(_0x57f10b[_0xa6aa('0x74')]===_0xa6aa('0x75')){_0x2d7852[_0x5d638f]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x57f10b[_0xa6aa('0x64')]+'%',null);}else{_0x597923=_[_0xa6aa('0x62')](_0x2a7db5,[_0xa6aa('0x29'),_0xa6aa('0x34')]);_0x57f10b[_0xa6aa('0x4c')]=_0xa6aa('0x34');_0x3214a0=as[_0xa6aa('0x6d')](_0x4129b6,_0x597923[_0xa6aa('0x3d')],_0x57f10b);_0x2d7852[_0x5d638f](_0x3214a0[_0xa6aa('0x6e')],_0x3214a0[_0xa6aa('0x64')][_0xa6aa('0x6f')],_0x3214a0['value'][_0xa6aa('0x76')]);}break;case _0xa6aa('0x77'):_0x3214a0=as[_0xa6aa('0x6d')]('me',null,_0x57f10b);_0x2d7852[_0x5d638f](_0x3214a0[_0xa6aa('0x6e')],_0x3214a0[_0xa6aa('0x64')]['start'],_0x3214a0[_0xa6aa('0x64')][_0xa6aa('0x76')]);break;}}else{var _0x3214a0=as[_0xa6aa('0x6d')](_0x4129b6,_0x597923['type'],_0x57f10b);_0x2d7852[_0x5d638f](_0x3214a0[_0xa6aa('0x6e')],_0x3214a0[_0xa6aa('0x64')][_0xa6aa('0x6f')],_0x3214a0[_0xa6aa('0x64')][_0xa6aa('0x76')]);}}}else{var _0x325fe7=_(_0x5e6b56[_0xa6aa('0x41')])[_0xa6aa('0x40')]()[_0xa6aa('0x3a')](function(_0x382114){return _[_0xa6aa('0x78')](_0x2a7db5,[_0xa6aa('0x29'),_0x382114])?_0x382114:undefined;})['compact']()['value']();if(!_[_0xa6aa('0x79')](_0x325fe7)){_0x325fe7['forEach'](function(_0x293e85){if(_0x293e85===_0xa6aa('0x7a')){_0x2a409d[_0xa6aa('0x49')](_0xa6aa('0x7b'),[][_0xa6aa('0x7c')](_0x5e6b56[_0xa6aa('0x41')][_0x293e85]));}else if(_0x293e85===_0xa6aa('0x7d')){var _0x1a27aa=JSON[_0xa6aa('0x7e')](_0x5e6b56['query'][_0x293e85])['$gte'];var _0x1c9461=JSON[_0xa6aa('0x7e')](_0x5e6b56[_0xa6aa('0x41')][_0x293e85])[_0xa6aa('0x7f')];_0x2a409d[_0xa6aa('0x49')](_0xa6aa('0x80'),_0x1a27aa,_0x1c9461);}else{if(_0x5e6b56[_0xa6aa('0x41')][_0x293e85]===_0xa6aa('0x81')){_0x2a409d['where']('i.'+_0x293e85+_0xa6aa('0x82'));}else{_0x2a409d[_0xa6aa('0x49')]('i.'+_0x293e85+_0xa6aa('0x83'),_0x5e6b56[_0xa6aa('0x41')][_0x293e85]);}}});}if(_0x5e6b56[_0xa6aa('0x41')][_0xa6aa('0x84')]){if(_0x5e6b56[_0xa6aa('0x41')]['read']==0x1){_0x2a409d[_0xa6aa('0x65')](_0xa6aa('0x85'));}else{_0x2a409d[_0xa6aa('0x65')](_0xa6aa('0x86'));}}if(_0x5e6b56[_0xa6aa('0x41')][_0xa6aa('0x87')]){_0xf52168=_['isArray'](_0x5e6b56[_0xa6aa('0x41')][_0xa6aa('0x87')])?_0x5e6b56[_0xa6aa('0x41')][_0xa6aa('0x87')]:new Array(_0x5e6b56[_0xa6aa('0x41')][_0xa6aa('0x87')]);_0xf52168[_0xa6aa('0x2e')](function(_0x2d19fa){_0x49c581['or'](_0xa6aa('0x71'),'%,'+_0x2d19fa+',%');});}if(_0x5e6b56['query']['filter']){var _0x1e33ba=_0x5e6b56[_0xa6aa('0x41')][_0xa6aa('0x88')]['replace']('\x5c','\x5c\x5c')[_0xa6aa('0x89')](/'/g,'\x27\x27');if(qs[_0xa6aa('0x8a')](_0x1e33ba)){_0x2d7852['or']('i.id\x20LIKE\x20?',_0x1e33ba+'%');}else{_0x2d7852['or'](_0xa6aa('0x8b'),qs[_0xa6aa('0x6a')](_0x1e33ba))['or'](_0xa6aa('0x8c'),_0x1e33ba+'%')['or'](_0xa6aa('0x8d'),_0x1e33ba+'%');}}}_0x2a409d[_0xa6aa('0x49')](_0x2d7852);_0x2a409d[_0xa6aa('0x8e')](_0xa6aa('0x8f'));var _0x25e629={'type':db[_0xa6aa('0x90')][_0xa6aa('0x91')][_0xa6aa('0x92')],'raw':!![]};var _0x460695=_0x2a409d[_0xa6aa('0x93')]();_0x460695['field'](_0xa6aa('0x8f'));_0x460695[_0xa6aa('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa6aa('0x63'));if(_0x25c0e8[_0xa6aa('0x47')]){_0x25c0e8[_0xa6aa('0x47')][_0xa6aa('0x2e')](function(_0x591879){var _0x16b127=_0x591879[0x0]===_0xa6aa('0x94')?_0x591879[0x0]:'i.'+_0x591879[0x0];_0x2a409d['order'](_0x16b127,_0x591879[0x1]===_0xa6aa('0x95')?![]:!![]);});}if(!_[_0xa6aa('0x79')](_0xf52168)){_0x2a409d[_0xa6aa('0x65')](_0x49c581);_0x460695[_0xa6aa('0x49')]('t.id\x20IN\x20?',_0xf52168);}BPromise[_0xa6aa('0x96')]()[_0xa6aa('0x26')](function(){if(!_0x161498){if(_0x5e6b56['query'][_0xa6aa('0x7a')])return;_0x460695[_0xa6aa('0x49')](_0xa6aa('0x97'));_0x2a409d[_0xa6aa('0x49')](_0xa6aa('0x97'));return;}if(_0x5e6b56[_0xa6aa('0x98')][_0xa6aa('0x99')]!=='agent')return;return _0x5e6b56[_0xa6aa('0x98')][_0xa6aa('0x9a')]({'attributes':['id'],'raw':!![]})[_0xa6aa('0x26')](function(_0x372589){if(_[_0xa6aa('0x79')](_0x372589)){_0x460695['where']('i.OpenchannelAccountId\x20IS\x20NULL');_0x2a409d[_0xa6aa('0x49')](_0xa6aa('0x9b'));}else{_0x460695['where'](_0xa6aa('0x7b'),_[_0xa6aa('0x3a')](_0x372589,'id'));_0x2a409d[_0xa6aa('0x49')](_0xa6aa('0x7b'),_[_0xa6aa('0x3a')](_0x372589,'id'));}});})['then'](function(){if(_0x5e6b56[_0xa6aa('0x98')]['role']===_0xa6aa('0x9c')&&!_0x161498&&!_0x5e6b56[_0xa6aa('0x41')][_0xa6aa('0x7a')])return[];return db[_0xa6aa('0x9d')][_0xa6aa('0x41')](_0x460695['toString'](),_0x25e629);})[_0xa6aa('0x26')](function(_0x50a73d){_0x4c82cc[_0xa6aa('0x20')]=_0x50a73d['length'];if(_0x4c82cc['count']===0x0)return[];return db[_0xa6aa('0x9d')][_0xa6aa('0x41')](_0x2d4094['toString'](),_0x25e629)[_0xa6aa('0x26')](function(_0x5b6a19){_0x32f58f=_[_0xa6aa('0x9e')](_0x5b6a19,'id');_0x25e629=_[_0xa6aa('0x9f')](_0x25e629,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5e6b56['query'][_0xa6aa('0x44')]){_0x25c0e8['attributes']['forEach'](function(_0x35d79f){_0x2a409d[_0xa6aa('0x4c')]('i.'+_0x35d79f);});}else{_0x2a409d[_0xa6aa('0x4c')](_0xa6aa('0xa0'),'unreadMessages');_0x2a409d[_0xa6aa('0x4c')](_0xa6aa('0xa1'),_0xa6aa('0xa2'));_0x2a409d[_0xa6aa('0x4c')](_0xa6aa('0xa3'),_0xa6aa('0xa4'));_0x2a409d[_0xa6aa('0x4c')]('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',_0xa6aa('0x94'));_0x2a409d['field'](_0xa6aa('0xa5'));_0x2a409d[_0xa6aa('0x4c')](_0xa6aa('0xa6'),_0xa6aa('0xa7'));_0x2a409d[_0xa6aa('0x4c')](_0xa6aa('0xa8'),_0xa6aa('0xa9'));_0x2a409d['field'](_0xa6aa('0xaa'),'Contact.email');_0x2a409d[_0xa6aa('0x4c')]('c.phone',_0xa6aa('0xab'));_0x2a409d['field'](_0xa6aa('0xac'),_0xa6aa('0xad'));_0x2a409d['field'](_0xa6aa('0xae'),'Contact.fax');_0x2a409d[_0xa6aa('0x4c')](_0xa6aa('0xaf'),'Owner.fullname');_0x2a409d[_0xa6aa('0x4c')](_0xa6aa('0xb0'),_0xa6aa('0xb1'));_0x2a409d[_0xa6aa('0x4c')](_0xa6aa('0xb2'),'TagIds');}if(_0x25c0e8[_0xa6aa('0x1f')])_0x2a409d[_0xa6aa('0x1f')](_0x25c0e8[_0xa6aa('0x1f')]);if(_0x25c0e8[_0xa6aa('0x1d')])_0x2a409d[_0xa6aa('0x1d')](_0x25c0e8['offset']);return db[_0xa6aa('0x9d')][_0xa6aa('0x41')](_0x2a409d['toString'](),_0x25e629);})[_0xa6aa('0x26')](function(_0x4c5df2){if(_0x4c5df2['length']>0x0)_0x5513ad[_0xa6aa('0x49')](_0xa6aa('0xb3'),_[_0xa6aa('0x3a')](_0x4c5df2,'id'));return db[_0xa6aa('0x9d')]['query'](_0x5513ad[_0xa6aa('0xb4')](),_0x25e629)[_0xa6aa('0x26')](function(_0x49ae3f){var _0x550f1f=_[_0xa6aa('0xb5')](_0x49ae3f,_0xa6aa('0xb6'));var _0x4d7b6d=[];_0x4c5df2[_0xa6aa('0x2e')](function(_0x482374){_0x4d7b6d[_0xa6aa('0x2f')](updateOpenchannelInteraction(_0x482374,_0x32f58f,_0x550f1f));});return BPromise['all'](_0x4d7b6d);});});})[_0xa6aa('0x26')](function(_0x3fb946){_0x4c82cc[_0xa6aa('0xb7')]=_0x3fb946;return _0x4c82cc;})[_0xa6aa('0x26')](respondWithFilteredResult(_0x3ffec5,_0x25c0e8))[_0xa6aa('0x31')](handleError(_0x3ffec5,null));};exports[_0xa6aa('0xb8')]=function(_0x289db5,_0x20f475){var _0x375d47={};if(_0x289db5[_0xa6aa('0x41')][_0xa6aa('0x3d')]&&_0x289db5[_0xa6aa('0x41')][_0xa6aa('0x3d')]==='from'){_0x375d47['from']=_0x289db5[_0xa6aa('0xb9')]['id'];}else{_0x375d47['id']=_0x289db5[_0xa6aa('0xb9')]['id'];}var _0xe3aa02={'raw':![],'where':_0x375d47},_0x4acef7={};_0x4acef7['model']=_[_0xa6aa('0x40')](db[_0xa6aa('0xba')][_0xa6aa('0x3b')]);_0x4acef7[_0xa6aa('0x41')]=_['keys'](_0x289db5['query']);_0x4acef7[_0xa6aa('0x4a')]=_[_0xa6aa('0x42')](_0x4acef7[_0xa6aa('0x3f')],_0x4acef7[_0xa6aa('0x41')]);_0xe3aa02['attributes']=_['intersection'](_0x4acef7[_0xa6aa('0x3f')],qs[_0xa6aa('0x44')](_0x289db5['query'][_0xa6aa('0x44')]));_0xe3aa02[_0xa6aa('0x43')]=_0xe3aa02[_0xa6aa('0x43')]['length']?_0xe3aa02[_0xa6aa('0x43')]:_0x4acef7['model'];if(_0x289db5[_0xa6aa('0x41')]['includeAll']){_0xe3aa02['include']=[{'all':!![]}];}_0xe3aa02=_[_0xa6aa('0x9f')]({},_0xe3aa02,_0x289db5[_0xa6aa('0xbb')]);return db[_0xa6aa('0xba')]['find'](_0xe3aa02)[_0xa6aa('0x26')](handleEntityNotFound(_0x20f475,null))[_0xa6aa('0x26')](respondWithResult(_0x20f475,null))[_0xa6aa('0x31')](handleError(_0x20f475,null));};exports[_0xa6aa('0xbc')]=function(_0xcb758b,_0x19053b){return db[_0xa6aa('0xba')][_0xa6aa('0xbc')](_0xcb758b[_0xa6aa('0x77')],{})[_0xa6aa('0x26')](respondWithResult(_0x19053b,0xc9))[_0xa6aa('0x31')](handleError(_0x19053b,null));};exports['update']=function(_0x52f538,_0x453f0c){if(_0x52f538[_0xa6aa('0x77')]['id']){delete _0x52f538[_0xa6aa('0x77')]['id'];}return db['OpenchannelInteraction'][_0xa6aa('0x62')]({'where':{'id':_0x52f538[_0xa6aa('0xb9')]['id']}})['then'](handleEntityNotFound(_0x453f0c,null))[_0xa6aa('0x26')](saveUpdates(_0x52f538[_0xa6aa('0x77')],null))[_0xa6aa('0x26')](respondWithResult(_0x453f0c,null))['catch'](handleError(_0x453f0c,null));};exports[_0xa6aa('0x27')]=function(_0x42571c,_0xe46e33){return db[_0xa6aa('0xba')]['find']({'where':{'id':_0x42571c[_0xa6aa('0xb9')]['id']}})[_0xa6aa('0x26')](handleEntityNotFound(_0xe46e33,null))[_0xa6aa('0x26')](removeEntity(_0xe46e33,null))[_0xa6aa('0x31')](handleError(_0xe46e33,null));};exports[_0xa6aa('0xbd')]=function(_0x4e6615,_0x502887){return db[_0xa6aa('0xba')][_0xa6aa('0xbd')]()[_0xa6aa('0x26')](respondWithResult(_0x502887,null))['catch'](handleError(_0x502887,null));};exports[_0xa6aa('0xbe')]=function(_0x5e079e,_0x5553d7,_0x4b8fee){return db[_0xa6aa('0xbf')][_0xa6aa('0x62')]({'where':{'id':_0x5e079e[_0xa6aa('0xb9')]['id']}})[_0xa6aa('0x26')](handleEntityNotFound(_0x5553d7,null))[_0xa6aa('0x26')](function(_0x5ce542){if(_0x5ce542){return _0x5ce542[_0xa6aa('0xbe')](_0x5e079e['body'][_0xa6aa('0xc0')],_[_0xa6aa('0xc1')](_0x5e079e[_0xa6aa('0x77')],[_0xa6aa('0xc0'),'id'])||{});}})['then'](respondWithResult(_0x5553d7,null))['catch'](handleError(_0x5553d7,null));};exports['getMessages']=function(_0x52125a,_0x69edd5,_0x17510b){var _0x2ed98f={'raw':![],'where':{}};var _0x3c25e7={};var _0x350fd4={'count':0x0,'rows':[]};return db[_0xa6aa('0xba')][_0xa6aa('0xc2')]({'where':{'id':_0x52125a[_0xa6aa('0xb9')]['id']}})[_0xa6aa('0x26')](handleEntityNotFound(_0x69edd5,null))[_0xa6aa('0x26')](function(_0x1a5d7c){if(_0x1a5d7c){_0x3c25e7[_0xa6aa('0x3f')]=_['keys'](db[_0xa6aa('0xbf')][_0xa6aa('0x3b')]);_0x3c25e7['query']=_[_0xa6aa('0x40')](_0x52125a['query']);_0x3c25e7['filters']=_[_0xa6aa('0x42')](_0x3c25e7[_0xa6aa('0x3f')],_0x3c25e7[_0xa6aa('0x41')]);_0x2ed98f[_0xa6aa('0x43')]=_[_0xa6aa('0x42')](_0x3c25e7[_0xa6aa('0x3f')],qs[_0xa6aa('0x44')](_0x52125a[_0xa6aa('0x41')]['fields']));_0x2ed98f['attributes']=_0x2ed98f[_0xa6aa('0x43')][_0xa6aa('0x45')]?_0x2ed98f[_0xa6aa('0x43')]:_0x3c25e7[_0xa6aa('0x3f')];if(!_0x52125a[_0xa6aa('0x41')][_0xa6aa('0x46')](_0xa6aa('0xc3'))){_0x2ed98f['limit']=qs[_0xa6aa('0x1f')](_0x52125a[_0xa6aa('0x41')][_0xa6aa('0x1f')]);_0x2ed98f['offset']=qs[_0xa6aa('0x1d')](_0x52125a[_0xa6aa('0x41')]['offset']);}_0x2ed98f['order']=qs[_0xa6aa('0x48')](_0x52125a[_0xa6aa('0x41')][_0xa6aa('0x48')]);_0x2ed98f[_0xa6aa('0x49')]=qs[_0xa6aa('0x4a')](_[_0xa6aa('0x4b')](_0x52125a[_0xa6aa('0x41')],_0x3c25e7[_0xa6aa('0x4a')]));_0x2ed98f[_0xa6aa('0x49')][_0xa6aa('0xb6')]=_0x1a5d7c['id'];if(_0x52125a[_0xa6aa('0x41')][_0xa6aa('0x88')]){_0x2ed98f[_0xa6aa('0x49')]=_['merge'](_0x2ed98f[_0xa6aa('0x49')],{'$or':_[_0xa6aa('0x3a')](_0x2ed98f[_0xa6aa('0x43')],function(_0x351f1f){var _0x5c6f22={};_0x5c6f22[_0x351f1f]={'$like':'%'+_0x52125a[_0xa6aa('0x41')][_0xa6aa('0x88')]+'%'};return _0x5c6f22;})});}if(_0x52125a[_0xa6aa('0x41')]['$gte']){var _0xd29c81=_0x52125a[_0xa6aa('0x41')][_0xa6aa('0xc4')][_0xa6aa('0x68')](',');var _0x521a0a={};_0x521a0a[_0xd29c81[0x0]]={'$gte':moment(_0xd29c81[0x1])[_0xa6aa('0xc5')](_0xa6aa('0xc6'))};_0x2ed98f[_0xa6aa('0x49')]=_[_0xa6aa('0x9f')](_0x2ed98f[_0xa6aa('0x49')],_0x521a0a);}_0x2ed98f=_[_0xa6aa('0x9f')]({},_0x2ed98f,_0x52125a[_0xa6aa('0xbb')]);return db[_0xa6aa('0xbf')][_0xa6aa('0x20')]({'where':_0x2ed98f['where']})['then'](function(_0x34ac58){_0x350fd4['count']=_0x34ac58;if(_0x52125a[_0xa6aa('0x41')][_0xa6aa('0xc7')]){_0x2ed98f[_0xa6aa('0xc8')]=[{'all':!![]}];}return db[_0xa6aa('0xbf')][_0xa6aa('0xc9')](_0x2ed98f);})[_0xa6aa('0x26')](function(_0x144871){_0x350fd4[_0xa6aa('0xb7')]=_0x144871;return _0x350fd4;});}})[_0xa6aa('0x26')](respondWithFilteredResult(_0x69edd5,_0x2ed98f))[_0xa6aa('0x31')](handleError(_0x69edd5,null));};exports[_0xa6aa('0xca')]=function(_0x2e6cef,_0xd82cd3,_0x2a085a){return db[_0xa6aa('0xba')]['find']({'where':{'id':_0x2e6cef[_0xa6aa('0xb9')]['id']}})[_0xa6aa('0x26')](handleEntityNotFound(_0xd82cd3,null))[_0xa6aa('0x26')](function(_0x68ab13){if(_0x68ab13){return _0x68ab13[_0xa6aa('0xcb')](_0x2e6cef[_0xa6aa('0x77')][_0xa6aa('0xc0')],_[_0xa6aa('0xc1')](_0x2e6cef[_0xa6aa('0x77')],[_0xa6aa('0xc0'),'id'])||{})['spread'](function(){return db[_0xa6aa('0x70')]['findAll']({'attributes':['id','name',_0xa6aa('0x4d')],'where':{'id':_0x2e6cef[_0xa6aa('0x77')][_0xa6aa('0xc0')]}});})[_0xa6aa('0x26')](function(_0x4a71c2){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x2e6cef[_0xa6aa('0xb9')]['id']),'tags':_0x4a71c2||[]});return{'id':Number(_0x2e6cef['params']['id']),'tags':_0x4a71c2||[]};});}})[_0xa6aa('0x26')](respondWithResult(_0xd82cd3,null))[_0xa6aa('0x31')](handleError(_0xd82cd3,null));};exports['removeTags']=function(_0x4b512b,_0x24e2c0,_0x33e0c8){return db[_0xa6aa('0xba')][_0xa6aa('0x62')]({'where':{'id':_0x4b512b[_0xa6aa('0xb9')]['id']}})[_0xa6aa('0x26')](handleEntityNotFound(_0x24e2c0,null))[_0xa6aa('0x26')](function(_0x3592fc){if(_0x3592fc){return _0x3592fc['removeTags'](_0x4b512b[_0xa6aa('0x41')][_0xa6aa('0xc0')]);}})[_0xa6aa('0x26')](respondWithStatusCode(_0x24e2c0,null))[_0xa6aa('0x31')](handleError(_0x24e2c0,null));};exports[_0xa6aa('0xcc')]=function(_0x31d097,_0x2ccc6d){var _0x4a3886=moment()[_0xa6aa('0xcd')]()[_0xa6aa('0xb4')]();var _0x1d6528=path[_0xa6aa('0xce')](config[_0xa6aa('0xcf')],_0xa6aa('0xd0'),_0xa6aa('0xd1'),_0xa6aa('0xd2'));var _0x6da01=path[_0xa6aa('0xce')](config[_0xa6aa('0xcf')],_0xa6aa('0xd0'),'files',_0xa6aa('0xd3'));var _0x35f6d4=path[_0xa6aa('0xce')](_0x1d6528,_0x4a3886);var _0x194aa1=util[_0xa6aa('0xc5')](_0xa6aa('0xd4'),_0x31d097[_0xa6aa('0xb9')]['id'],_0x4a3886);var _0x281994=path[_0xa6aa('0xce')](_0x1d6528,_0x194aa1);var _0x3c9674=[];_0x3c9674[_0xa6aa('0x2f')]({'model':db[_0xa6aa('0x73')],'as':_0xa6aa('0x73'),'attributes':['id',_0xa6aa('0x2c')],'raw':!![]});_0x3c9674['push']({'model':db['CmContact'],'as':_0xa6aa('0xd5'),'attributes':['id',_0xa6aa('0xd6'),_0xa6aa('0xd7')],'raw':!![]});if(_0x31d097[_0xa6aa('0x41')][_0xa6aa('0xd3')]){_0x3c9674[_0xa6aa('0x2f')]({'model':db['Attachment'],'as':_0xa6aa('0xd8'),'raw':!![]});}var _0x2032ab=[{'model':db[_0xa6aa('0xbf')],'as':_0xa6aa('0xd9'),'attributes':['id',_0xa6aa('0x77'),'createdAt',_0xa6aa('0xda'),_0xa6aa('0xdb'),_0xa6aa('0x84')],'include':_0x3c9674}];_0x2032ab[_0xa6aa('0x2f')]({'model':db[_0xa6aa('0xdc')],'as':_0xa6aa('0xdd'),'attributes':['id',_0xa6aa('0x29')]});_0x2032ab[_0xa6aa('0x2f')]({'model':db[_0xa6aa('0x73')],'as':_0xa6aa('0xde'),'attributes':['id',_0xa6aa('0x2c')]});return db[_0xa6aa('0xba')][_0xa6aa('0x62')]({'where':{'id':_0x31d097[_0xa6aa('0xb9')]['id']},'include':_0x2032ab})['then'](handleEntityNotFound(_0x2ccc6d,null))['then'](function(_0x196561){if(_0x196561){var _0x2fdf2a=_0x196561[_0xa6aa('0xdf')]({'plain':!![]});fs[_0xa6aa('0xe0')](_0x35f6d4);var _0x34c605={'channel':'Openchannel','account':_0x2fdf2a[_0xa6aa('0xdd')][_0xa6aa('0x29')],'agent':_0x2fdf2a[_0xa6aa('0xde')]?_0x2fdf2a['Owner']['fullname']:'N.A.','createdAt':moment(_0x2fdf2a[_0xa6aa('0x7d')])[_0xa6aa('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa6aa('0xb4')](),'closedAt':_0x2fdf2a[_0xa6aa('0x36')]?moment(_0x2fdf2a[_0xa6aa('0xe1')])[_0xa6aa('0xc5')](_0xa6aa('0xc6'))[_0xa6aa('0xb4')]():'','disposition':_0x2fdf2a[_0xa6aa('0xe2')],'visibility':_0x2fdf2a[_0xa6aa('0xe3')]?_0xa6aa('0xe4'):_0xa6aa('0xe5'),'messages':_(_0x2fdf2a['Messages'])[_0xa6aa('0x88')]({'secret':![]})[_0xa6aa('0x3a')](function(_0x443723){if(_0x443723[_0xa6aa('0xd8')]){var _0x3d268d=path['join'](_0x6da01,_0x443723[_0xa6aa('0xd8')][_0xa6aa('0xe6')]);if(fs['existsSync'](_0x3d268d)){fs[_0xa6aa('0xe7')](_0x3d268d)[_0xa6aa('0xe8')](fs[_0xa6aa('0xe9')](path[_0xa6aa('0xce')](_0x35f6d4,_0x443723[_0xa6aa('0xd8')][_0xa6aa('0xe6')])));}}return{'date':moment(_0x443723[_0xa6aa('0x7d')])[_0xa6aa('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa6aa('0xb4')](),'sender':_0x443723[_0xa6aa('0xda')]==='out'?_0x443723['User']?_0x443723[_0xa6aa('0x73')][_0xa6aa('0x2c')]:_0xa6aa('0xea'):_0x443723[_0xa6aa('0xd5')][_0xa6aa('0xd6')]+(_0x443723[_0xa6aa('0xd5')]['lastName']?'\x20'+_0x443723[_0xa6aa('0xd5')]['lastName']:''),'body':_0x443723[_0xa6aa('0xd8')]?_0x443723['Attachment'][_0xa6aa('0xe6')]:_0x443723['body'],'direction':_0x443723[_0xa6aa('0xda')]==='out'?'A':'C','secret':_0x443723['secret'],'read':_0x443723[_0xa6aa('0x84')],'attachment':_0x443723['Attachment']};})[_0xa6aa('0x64')]()};return ejs[_0xa6aa('0xeb')](path['join'](config[_0xa6aa('0xcf')],_0xa6aa('0xd0'),'views',_0xa6aa('0xec')),{'interaction':_0x34c605})['then'](function(_0x4c7104){var _0x4e4d0f=path[_0xa6aa('0xce')](_0x35f6d4,_0xa6aa('0xed')+_0x2fdf2a['id']+'-'+_0x4a3886+_0xa6aa('0xee'));var _0x2fb07e={'path':_0x4e4d0f,'channel':'Openchannel','interactionId':_0x2fdf2a['id']};return pdf['createPdfFromHTML'](_0x4c7104,_0x2fb07e);})[_0xa6aa('0x26')](function(){return new BPromise(function(_0xe77931,_0x2b2667){zipdir(_0x35f6d4,{'saveTo':_0x281994},function(_0x4f5efc,_0x4fcab7){if(_0x4f5efc)return _0x2b2667(_0x4f5efc);return _0xe77931(_0x4fcab7);});})[_0xa6aa('0x26')](function(){return new BPromise(function(_0x413ed8,_0x27e79f){rimraf(_0x35f6d4,function(_0x596651){if(_0x596651)_0x27e79f(_0x596651);return _0x413ed8();});});})[_0xa6aa('0x26')](function(){return _0x2ccc6d[_0xa6aa('0xcc')](_0x281994,_0x194aa1,function(_0x3621e9){if(_0x3621e9){console['log'](_0xa6aa('0xef'),_0x3621e9);}else{fs[_0xa6aa('0xf0')](_0x281994);}});});});}else{return _0x2ccc6d[_0xa6aa('0x1b')](0xc8);}})[_0xa6aa('0x31')](handleError(_0x2ccc6d,null));}; \ No newline at end of file +var _0xca93=['field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','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','ContactId','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','text','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','SELECT','clone','i.id','contactName','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','rows','catch','params','includeAll','options','create','body','describe','addMessage','OpenchannelMessage','ids','findOne','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','omit','Tag','color','emit','openchannelInteractionTags:save','removeTags','unix','root','server','files','tmp','attachments','join','format','transcript-%d-%s.zip','CmContact','Attachment','Messages','createdAt','secret','OpenchannelAccount','Account','Owner','mkdirSync','N.A.','closedAt','disposition','threadId','Private','basename','createReadStream','pipe','createWriteStream','direction','out','lastName','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','download','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../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','./openchannelInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','Tags','split','push','TagIds','waiting','talking','answered','unmanaged','closed','UserId','total','index','OpenchannelInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select'];(function(_0x439870,_0x903a44){var _0x207f6c=function(_0xa51995){while(--_0xa51995){_0x439870['push'](_0x439870['shift']());}};_0x207f6c(++_0x903a44);}(_0xca93,0x199));var _0x3ca9=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xca93[_0x220dbb];return _0x2b77de;};'use strict';var emlformat=require(_0x3ca9('0x0'));var rimraf=require(_0x3ca9('0x1'));var zipdir=require(_0x3ca9('0x2'));var jsonpatch=require(_0x3ca9('0x3'));var rp=require(_0x3ca9('0x4'));var moment=require(_0x3ca9('0x5'));var BPromise=require(_0x3ca9('0x6'));var Mustache=require(_0x3ca9('0x7'));var util=require(_0x3ca9('0x8'));var path=require(_0x3ca9('0x9'));var sox=require(_0x3ca9('0xa'));var csv=require(_0x3ca9('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ca9('0xc'));var _=require('lodash');var squel=require(_0x3ca9('0xd'));var crypto=require(_0x3ca9('0xe'));var jsforce=require(_0x3ca9('0xf'));var deskjs=require(_0x3ca9('0x10'));var toCsv=require(_0x3ca9('0xb'));var querystring=require(_0x3ca9('0x11'));var Papa=require(_0x3ca9('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3ca9('0x13'));var as=require(_0x3ca9('0x14'));var pdf=require(_0x3ca9('0x15'));var hardwareService=require(_0x3ca9('0x16'));var logger=require(_0x3ca9('0x17'))(_0x3ca9('0x18'));var utils=require(_0x3ca9('0x19'));var config=require(_0x3ca9('0x1a'));var licenseUtil=require(_0x3ca9('0x1b'));var db=require(_0x3ca9('0x1c'))['db'];config[_0x3ca9('0x1d')]=_[_0x3ca9('0x1e')](config[_0x3ca9('0x1d')],{'host':_0x3ca9('0x1f'),'port':0x18eb});var socket=require(_0x3ca9('0x20'))(new Redis(config['redis']));require(_0x3ca9('0x21'))[_0x3ca9('0x22')](socket);function respondWithStatusCode(_0x3f6626,_0x33ab43){_0x33ab43=_0x33ab43||0xcc;return function(_0x3c1b20){if(_0x3c1b20){return _0x3f6626['sendStatus'](_0x33ab43);}return _0x3f6626[_0x3ca9('0x23')](_0x33ab43)[_0x3ca9('0x24')]();};}function respondWithResult(_0x53e1e6,_0x3bb38c){_0x3bb38c=_0x3bb38c||0xc8;return function(_0x5c1a80){if(_0x5c1a80){return _0x53e1e6[_0x3ca9('0x23')](_0x3bb38c)[_0x3ca9('0x25')](_0x5c1a80);}};}function respondWithFilteredResult(_0xbc7954,_0x4ce89b){return function(_0x133fb4){if(_0x133fb4){var _0x3a4eaa=typeof _0x4ce89b[_0x3ca9('0x26')]===_0x3ca9('0x27')&&typeof _0x4ce89b[_0x3ca9('0x28')]===_0x3ca9('0x27');var _0x36e3cc=_0x133fb4[_0x3ca9('0x29')];var _0x1869df=_0x3a4eaa?0x0:_0x4ce89b[_0x3ca9('0x26')];var _0x228631=_0x3a4eaa?_0x133fb4[_0x3ca9('0x29')]:_0x4ce89b[_0x3ca9('0x26')]+_0x4ce89b[_0x3ca9('0x28')];var _0x3569fa;if(_0x228631>=_0x36e3cc){_0x228631=_0x36e3cc;_0x3569fa=0xc8;}else{_0x3569fa=0xce;}_0xbc7954[_0x3ca9('0x23')](_0x3569fa);return _0xbc7954[_0x3ca9('0x2a')]('Content-Range',_0x1869df+'-'+_0x228631+'/'+_0x36e3cc)[_0x3ca9('0x25')](_0x133fb4);}return null;};}function patchUpdates(_0x1711f8){return function(_0x50972b){try{jsonpatch[_0x3ca9('0x2b')](_0x50972b,_0x1711f8,!![]);}catch(_0x4621dd){return BPromise[_0x3ca9('0x2c')](_0x4621dd);}return _0x50972b[_0x3ca9('0x2d')]();};}function saveUpdates(_0x2b3a39,_0x487457){return function(_0x231f37){if(_0x231f37){return _0x231f37[_0x3ca9('0x2e')](_0x2b3a39)[_0x3ca9('0x2f')](function(_0x517845){return _0x517845;});}return null;};}function removeEntity(_0x277938,_0x1033c8){return function(_0x3f150b){if(_0x3f150b){return _0x3f150b[_0x3ca9('0x30')]()[_0x3ca9('0x2f')](function(){_0x277938['status'](0xcc)[_0x3ca9('0x24')]();});}};}function handleEntityNotFound(_0x16e592,_0x455ce1){return function(_0x232ff7){if(!_0x232ff7){_0x16e592[_0x3ca9('0x31')](0x194);}return _0x232ff7;};}function handleError(_0x4265bb,_0x534367){_0x534367=_0x534367||0x1f4;return function(_0x389639){logger[_0x3ca9('0x32')](_0x389639[_0x3ca9('0x33')]);if(_0x389639['name']){delete _0x389639[_0x3ca9('0x34')];}_0x4265bb[_0x3ca9('0x23')](_0x534367)[_0x3ca9('0x35')](_0x389639);};}function getInteractionUsers(_0x7840a5,_0x44224a){return new BPromise(function(_0x22dbf9,_0x23a4b6){try{if(_0x44224a[_0x7840a5['id']]){_0x7840a5[_0x3ca9('0x36')]=_[_0x3ca9('0x37')](_0x44224a[_0x7840a5['id']],function(_0x24cf35){return{'id':_0x24cf35['id'],'fullname':_0x24cf35[_0x3ca9('0x38')]};});}}catch(_0x3deff8){_0x23a4b6(_0x3deff8);}_0x22dbf9(_0x7840a5);});}function getInteractionTags(_0x347049,_0x1f65f4){return new BPromise(function(_0x142f47,_0x32fa12){try{if(_0x347049['TagIds']){_0x347049[_0x3ca9('0x39')]=[];_0x347049['TagIds'][_0x3ca9('0x3a')](',')['forEach'](function(_0x465c93){_0x347049[_0x3ca9('0x39')][_0x3ca9('0x3b')](_0x1f65f4[_0x465c93]);});}delete _0x347049[_0x3ca9('0x3c')];}catch(_0x37a35a){_0x32fa12(_0x37a35a);}_0x142f47(_0x347049);});}function updateOpenchannelInteraction(_0x341b67,_0x36cfda,_0x406884){return new BPromise(function(_0x25a5d6,_0x7288c2){return getInteractionUsers(_0x341b67,_0x406884)[_0x3ca9('0x2f')](function(_0x12bb02){return getInteractionTags(_0x12bb02,_0x36cfda);})['then'](function(_0x6da9cd){return getStateInteraction(_0x6da9cd);})[_0x3ca9('0x2f')](function(_0x6895fd){_0x25a5d6(_0x6895fd);})['catch'](function(_0x5be482){_0x7288c2(_0x5be482);});});}function getStateInteraction(_0x277522){return new BPromise(function(_0x11fe37){_0x277522[_0x3ca9('0x3d')]=0x0;_0x277522[_0x3ca9('0x3e')]=0x0;_0x277522[_0x3ca9('0x3f')]=0x0;_0x277522[_0x3ca9('0x40')]=0x0;_0x277522['total']=0x0;if(!_0x277522[_0x3ca9('0x41')]&&!_0x277522['UserId']){_0x277522[_0x3ca9('0x3d')]+=0x1;}if(!_0x277522[_0x3ca9('0x41')]&&_0x277522[_0x3ca9('0x42')]){_0x277522[_0x3ca9('0x3e')]+=0x1;if(_0x277522[_0x3ca9('0x3d')]){_0x277522[_0x3ca9('0x3d')]-=0x1;}}if(_0x277522[_0x3ca9('0x41')]&&_0x277522[_0x3ca9('0x42')]){_0x277522[_0x3ca9('0x3f')]+=0x1;if(_0x277522[_0x3ca9('0x3e')]){_0x277522[_0x3ca9('0x3e')]-=0x1;}}if(_0x277522[_0x3ca9('0x41')]&&!_0x277522['UserId']){_0x277522[_0x3ca9('0x40')]+=0x1;if(_0x277522[_0x3ca9('0x3d')]){_0x277522[_0x3ca9('0x3d')]-=0x1;}}_0x277522[_0x3ca9('0x43')]+=0x1;_0x11fe37(_0x277522);});}exports[_0x3ca9('0x44')]=function(_0x1d590b,_0x2a39b7){var _0x302106={},_0xbfbf58={},_0x2ea47b={'count':0x0,'rows':[]};var _0x8dc8ca=_[_0x3ca9('0x37')](db[_0x3ca9('0x45')][_0x3ca9('0x46')],function(_0x34e282){return{'name':_0x34e282['fieldName'],'type':_0x34e282[_0x3ca9('0x47')][_0x3ca9('0x48')]};});_0xbfbf58[_0x3ca9('0x49')]=_[_0x3ca9('0x37')](_0x8dc8ca,_0x3ca9('0x34'));_0xbfbf58[_0x3ca9('0x4a')]=_[_0x3ca9('0x4b')](_0x1d590b[_0x3ca9('0x4a')]);_0xbfbf58[_0x3ca9('0x4c')]=_[_0x3ca9('0x4d')](_0xbfbf58[_0x3ca9('0x49')],_0xbfbf58[_0x3ca9('0x4a')]);_0x302106[_0x3ca9('0x4e')]=_[_0x3ca9('0x4d')](_0xbfbf58[_0x3ca9('0x49')],qs[_0x3ca9('0x4f')](_0x1d590b[_0x3ca9('0x4a')][_0x3ca9('0x4f')]));_0x302106[_0x3ca9('0x4e')]=_0x302106[_0x3ca9('0x4e')][_0x3ca9('0x50')]?_0x302106[_0x3ca9('0x4e')]:_0xbfbf58[_0x3ca9('0x49')];if(!_0x1d590b['query'][_0x3ca9('0x51')](_0x3ca9('0x52'))){_0x302106[_0x3ca9('0x28')]=qs[_0x3ca9('0x28')](_0x1d590b[_0x3ca9('0x4a')][_0x3ca9('0x28')]);_0x302106[_0x3ca9('0x26')]=qs[_0x3ca9('0x26')](_0x1d590b['query']['offset']);}_0x302106[_0x3ca9('0x53')]=qs[_0x3ca9('0x54')](_0x1d590b[_0x3ca9('0x4a')][_0x3ca9('0x54')]);_0x302106['where']=qs[_0x3ca9('0x4c')](_[_0x3ca9('0x55')](_0x1d590b[_0x3ca9('0x4a')],_0xbfbf58[_0x3ca9('0x4c')]),_0x8dc8ca);var _0x22e4af=[];var _0x125189=squel[_0x3ca9('0x56')]()['field']('id')[_0x3ca9('0x57')](_0x3ca9('0x34'))[_0x3ca9('0x57')]('color')[_0x3ca9('0x58')](_0x3ca9('0x59'));var _0x3f0f9a=squel['select']()[_0x3ca9('0x57')](_0x3ca9('0x5a'))[_0x3ca9('0x57')](_0x3ca9('0x5b'))['field'](_0x3ca9('0x5c'))[_0x3ca9('0x58')](_0x3ca9('0x5d'),'ui')[_0x3ca9('0x5e')](_0x3ca9('0x5f'),'u',_0x3ca9('0x60'));var _0x26f997=squel[_0x3ca9('0x56')]()[_0x3ca9('0x58')]('openchannel_interactions','i')[_0x3ca9('0x5e')](_0x3ca9('0x61'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x3ca9('0x5e')](_0x3ca9('0x5f'),'o',_0x3ca9('0x62'))[_0x3ca9('0x5e')](_0x3ca9('0x63'),'a',_0x3ca9('0x64'))['left_join']('openchannel_messages','me',_0x3ca9('0x65'))['left_join'](_0x3ca9('0x66'),'it',_0x3ca9('0x67'))[_0x3ca9('0x5e')](_0x3ca9('0x59'),'t',_0x3ca9('0x68'));var _0x12f089=squel[_0x3ca9('0x69')]();var _0x4709df=[];var _0x40cf62=squel[_0x3ca9('0x69')]();var _0x1c662c;if(_0x1d590b['query']['search']){_0x1c662c=as[_0x3ca9('0x6a')](_0x1d590b['query'][_0x3ca9('0x6b')]);var _0x3bdcf0=_0x1c662c[_0x3ca9('0x6c')];for(var _0x2255c8=0x0;_0x2255c8<_0x1c662c['conditions'][_0x3ca9('0x50')];_0x2255c8++){var _0x3e9693=_0x1c662c[_0x3ca9('0x6d')][_0x2255c8];var _0x4ea9f2='i';var _0x564cfc=_[_0x3ca9('0x6e')](_0x8dc8ca,[_0x3ca9('0x34'),_0x3e9693['field']]);if(!_0x564cfc){switch(_0x3e9693[_0x3ca9('0x57')]){case _0x3ca9('0x6f'):if(_0x3e9693[_0x3ca9('0x70')]==0x1){_0x26f997[_0x3ca9('0x71')]('`'+_0x3e9693[_0x3ca9('0x57')]+_0x3ca9('0x72'));}else{_0x26f997[_0x3ca9('0x71')]('`'+_0x3e9693[_0x3ca9('0x57')]+_0x3ca9('0x73'));}break;case _0x3ca9('0x74'):if(_0x3e9693[_0x3ca9('0x75')]===_0x3ca9('0x76')){if(_0x3e9693[_0x3ca9('0x70')][_0x3ca9('0x3a')]('\x20')[_0x3ca9('0x50')]>0x1){_0x12f089[_0x3bdcf0](_0x3ca9('0x77'),qs[_0x3ca9('0x78')](_0x3e9693['value']),null);}else{var _0x3c2834='%'+_0x3e9693[_0x3ca9('0x70')]+'%';_0x12f089[_0x3bdcf0]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c2834,_0x3c2834,_0x3c2834);}}else{_0x564cfc=_[_0x3ca9('0x6e')](_0x8dc8ca,[_0x3ca9('0x34'),'ContactId']);_0x3e9693[_0x3ca9('0x57')]=_0x3ca9('0x79');_0x2415b3=as['buildExpression'](_0x4ea9f2,_0x564cfc[_0x3ca9('0x47')],_0x3e9693);_0x12f089[_0x3bdcf0](_0x2415b3['text'],_0x2415b3[_0x3ca9('0x70')][_0x3ca9('0x7a')],_0x2415b3[_0x3ca9('0x70')][_0x3ca9('0x24')]);}break;case'Tag':var _0x8bdb5a=_0x3e9693[_0x3ca9('0x70')]['split'](',')[_0x3ca9('0x37')](function(_0x2f13d7){return Number(_0x2f13d7);});_0x8bdb5a[_0x3ca9('0x7b')](function(_0x2e9ee8){_0x40cf62['or'](_0x3ca9('0x7c'),'%,'+_0x2e9ee8+',%');});_0x4709df=_[_0x3ca9('0x7d')](_0x4709df,_0x8bdb5a);break;case _0x3ca9('0x7e'):if(_0x3e9693[_0x3ca9('0x75')]===_0x3ca9('0x76')){_0x12f089[_0x3bdcf0](_0x3ca9('0x7f'),'%'+_0x3e9693[_0x3ca9('0x70')]+'%',null);}else{_0x564cfc=_['find'](_0x8dc8ca,[_0x3ca9('0x34'),_0x3ca9('0x42')]);_0x3e9693['field']=_0x3ca9('0x42');_0x2415b3=as[_0x3ca9('0x80')](_0x4ea9f2,_0x564cfc[_0x3ca9('0x47')],_0x3e9693);_0x12f089[_0x3bdcf0](_0x2415b3[_0x3ca9('0x81')],_0x2415b3[_0x3ca9('0x70')][_0x3ca9('0x7a')],_0x2415b3[_0x3ca9('0x70')][_0x3ca9('0x24')]);}break;case'body':_0x2415b3=as[_0x3ca9('0x80')]('me',null,_0x3e9693);_0x12f089[_0x3bdcf0](_0x2415b3['text'],_0x2415b3['value'][_0x3ca9('0x7a')],_0x2415b3[_0x3ca9('0x70')][_0x3ca9('0x24')]);break;}}else{var _0x2415b3=as[_0x3ca9('0x80')](_0x4ea9f2,_0x564cfc[_0x3ca9('0x47')],_0x3e9693);_0x12f089[_0x3bdcf0](_0x2415b3[_0x3ca9('0x81')],_0x2415b3[_0x3ca9('0x70')][_0x3ca9('0x7a')],_0x2415b3[_0x3ca9('0x70')]['end']);}}}else{var _0x2b33dd=_(_0x1d590b[_0x3ca9('0x4a')])[_0x3ca9('0x4b')]()[_0x3ca9('0x37')](function(_0x2950e7){return _[_0x3ca9('0x82')](_0x8dc8ca,['name',_0x2950e7])?_0x2950e7:undefined;})[_0x3ca9('0x83')]()[_0x3ca9('0x70')]();if(!_[_0x3ca9('0x84')](_0x2b33dd)){_0x2b33dd[_0x3ca9('0x7b')](function(_0x4efe95){if(_0x4efe95===_0x3ca9('0x85')){_0x26f997['where'](_0x3ca9('0x86'),[]['concat'](_0x1d590b[_0x3ca9('0x4a')][_0x4efe95]));}else if(_0x4efe95==='createdAt'){var _0x567a1c=JSON[_0x3ca9('0x87')](_0x1d590b[_0x3ca9('0x4a')][_0x4efe95])[_0x3ca9('0x88')];var _0x37a827=JSON['parse'](_0x1d590b[_0x3ca9('0x4a')][_0x4efe95])['$lte'];_0x26f997['where'](_0x3ca9('0x89'),_0x567a1c,_0x37a827);}else{if(_0x1d590b[_0x3ca9('0x4a')][_0x4efe95]==='null'){_0x26f997[_0x3ca9('0x8a')]('i.'+_0x4efe95+_0x3ca9('0x8b'));}else{_0x26f997[_0x3ca9('0x8a')]('i.'+_0x4efe95+_0x3ca9('0x8c'),_0x1d590b['query'][_0x4efe95]);}}});}if(_0x1d590b[_0x3ca9('0x4a')][_0x3ca9('0x8d')]){if(_0x1d590b[_0x3ca9('0x4a')][_0x3ca9('0x8d')]==0x1){_0x26f997[_0x3ca9('0x71')]('`unreadMessages`\x20=\x200');}else{_0x26f997[_0x3ca9('0x71')](_0x3ca9('0x8e'));}}if(_0x1d590b[_0x3ca9('0x4a')]['tag']){_0x4709df=_[_0x3ca9('0x8f')](_0x1d590b[_0x3ca9('0x4a')]['tag'])?_0x1d590b[_0x3ca9('0x4a')][_0x3ca9('0x90')]:new Array(_0x1d590b[_0x3ca9('0x4a')][_0x3ca9('0x90')]);_0x4709df[_0x3ca9('0x7b')](function(_0xd299e){_0x40cf62['or'](_0x3ca9('0x7c'),'%,'+_0xd299e+',%');});}if(_0x1d590b['query']['filter']){var _0x36657e=_0x1d590b[_0x3ca9('0x4a')][_0x3ca9('0x91')][_0x3ca9('0x92')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x36657e)){_0x12f089['or'](_0x3ca9('0x93'),_0x36657e+'%');}else{_0x12f089['or'](_0x3ca9('0x94'),qs['getFullTextValue'](_0x36657e))['or'](_0x3ca9('0x95'),_0x36657e+'%')['or'](_0x3ca9('0x96'),_0x36657e+'%');}}}_0x26f997[_0x3ca9('0x8a')](_0x12f089);_0x26f997['group']('i.id');var _0x1162e1={'type':db[_0x3ca9('0x97')]['QueryTypes'][_0x3ca9('0x98')],'raw':!![]};var _0x5ebece=_0x26f997[_0x3ca9('0x99')]();_0x5ebece[_0x3ca9('0x57')](_0x3ca9('0x9a'));_0x5ebece[_0x3ca9('0x57')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3ca9('0x6f'));if(_0x302106[_0x3ca9('0x53')]){_0x302106[_0x3ca9('0x53')][_0x3ca9('0x7b')](function(_0xfba7a5){var _0x446bdf=_0xfba7a5[0x0]===_0x3ca9('0x9b')?_0xfba7a5[0x0]:'i.'+_0xfba7a5[0x0];_0x26f997[_0x3ca9('0x53')](_0x446bdf,_0xfba7a5[0x1]==='DESC'?![]:!![]);});}if(!_[_0x3ca9('0x84')](_0x4709df)){_0x26f997[_0x3ca9('0x71')](_0x40cf62);_0x5ebece['where'](_0x3ca9('0x9c'),_0x4709df);}BPromise[_0x3ca9('0x9d')]()[_0x3ca9('0x2f')](function(){if(!_0x1c662c){if(_0x1d590b['query'][_0x3ca9('0x85')])return;_0x5ebece[_0x3ca9('0x8a')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x26f997['where'](_0x3ca9('0x9e'));return;}if(_0x1d590b[_0x3ca9('0x9f')]['role']!==_0x3ca9('0xa0'))return;return _0x1d590b[_0x3ca9('0x9f')][_0x3ca9('0xa1')]({'attributes':['id'],'raw':!![]})['then'](function(_0x223140){if(_['isEmpty'](_0x223140)){_0x5ebece[_0x3ca9('0x8a')](_0x3ca9('0xa2'));_0x26f997['where'](_0x3ca9('0xa2'));}else{_0x5ebece[_0x3ca9('0x8a')](_0x3ca9('0x86'),_[_0x3ca9('0x37')](_0x223140,'id'));_0x26f997[_0x3ca9('0x8a')](_0x3ca9('0x86'),_[_0x3ca9('0x37')](_0x223140,'id'));}});})[_0x3ca9('0x2f')](function(){if(_0x1d590b[_0x3ca9('0x9f')][_0x3ca9('0xa3')]==='agent'&&!_0x1c662c&&!_0x1d590b[_0x3ca9('0x4a')][_0x3ca9('0x85')])return[];return db[_0x3ca9('0xa4')][_0x3ca9('0x4a')](_0x5ebece[_0x3ca9('0xa5')](),_0x1162e1);})[_0x3ca9('0x2f')](function(_0x49e6ba){_0x2ea47b[_0x3ca9('0x29')]=_0x49e6ba[_0x3ca9('0x50')];if(_0x2ea47b[_0x3ca9('0x29')]===0x0)return[];return db[_0x3ca9('0xa4')][_0x3ca9('0x4a')](_0x125189['toString'](),_0x1162e1)[_0x3ca9('0x2f')](function(_0x514a30){_0x22e4af=_[_0x3ca9('0xa6')](_0x514a30,'id');_0x1162e1=_[_0x3ca9('0xa7')](_0x1162e1,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1d590b[_0x3ca9('0x4a')]['fields']){_0x302106['attributes'][_0x3ca9('0x7b')](function(_0x237e00){_0x26f997[_0x3ca9('0x57')]('i.'+_0x237e00);});}else{_0x26f997[_0x3ca9('0x57')](_0x3ca9('0xa8'),_0x3ca9('0x6f'));_0x26f997[_0x3ca9('0x57')](_0x3ca9('0xa9'),_0x3ca9('0xaa'));_0x26f997['field'](_0x3ca9('0xab'),'Account.mandatoryDisposition');_0x26f997['field'](_0x3ca9('0xac'),_0x3ca9('0x9b'));_0x26f997[_0x3ca9('0x57')](_0x3ca9('0xad'));_0x26f997['field']('c.firstName',_0x3ca9('0xae'));_0x26f997[_0x3ca9('0x57')](_0x3ca9('0xaf'),_0x3ca9('0xb0'));_0x26f997[_0x3ca9('0x57')]('c.email',_0x3ca9('0xb1'));_0x26f997['field'](_0x3ca9('0xb2'),'Contact.phone');_0x26f997[_0x3ca9('0x57')](_0x3ca9('0xb3'),_0x3ca9('0xb4'));_0x26f997[_0x3ca9('0x57')](_0x3ca9('0xb5'),'Contact.fax');_0x26f997[_0x3ca9('0x57')](_0x3ca9('0xb6'),_0x3ca9('0xb7'));_0x26f997[_0x3ca9('0x57')](_0x3ca9('0xb8'),'Owner.internal');_0x26f997['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3ca9('0x3c'));}if(_0x302106['limit'])_0x26f997[_0x3ca9('0x28')](_0x302106[_0x3ca9('0x28')]);if(_0x302106['offset'])_0x26f997[_0x3ca9('0x26')](_0x302106[_0x3ca9('0x26')]);return db[_0x3ca9('0xa4')][_0x3ca9('0x4a')](_0x26f997[_0x3ca9('0xa5')](),_0x1162e1);})[_0x3ca9('0x2f')](function(_0x154acb){if(_0x154acb[_0x3ca9('0x50')]>0x0)_0x3f0f9a[_0x3ca9('0x8a')](_0x3ca9('0xb9'),_['map'](_0x154acb,'id'));return db[_0x3ca9('0xa4')][_0x3ca9('0x4a')](_0x3f0f9a[_0x3ca9('0xa5')](),_0x1162e1)[_0x3ca9('0x2f')](function(_0x240dd8){var _0x399520=_['groupBy'](_0x240dd8,_0x3ca9('0xba'));var _0x274beb=[];_0x154acb[_0x3ca9('0x7b')](function(_0x70a1d4){_0x274beb[_0x3ca9('0x3b')](updateOpenchannelInteraction(_0x70a1d4,_0x22e4af,_0x399520));});return BPromise['all'](_0x274beb);});});})[_0x3ca9('0x2f')](function(_0x24d7c4){_0x2ea47b[_0x3ca9('0xbb')]=_0x24d7c4;return _0x2ea47b;})[_0x3ca9('0x2f')](respondWithFilteredResult(_0x2a39b7,_0x302106))[_0x3ca9('0xbc')](handleError(_0x2a39b7,null));};exports['show']=function(_0x4dc4a6,_0x3ad0e3){var _0x306ded={};if(_0x4dc4a6[_0x3ca9('0x4a')][_0x3ca9('0x47')]&&_0x4dc4a6[_0x3ca9('0x4a')][_0x3ca9('0x47')]===_0x3ca9('0x58')){_0x306ded[_0x3ca9('0x58')]=_0x4dc4a6[_0x3ca9('0xbd')]['id'];}else{_0x306ded['id']=_0x4dc4a6[_0x3ca9('0xbd')]['id'];}var _0x469158={'raw':![],'where':_0x306ded},_0x3e3d40={};_0x3e3d40['model']=_[_0x3ca9('0x4b')](db[_0x3ca9('0x45')]['rawAttributes']);_0x3e3d40['query']=_[_0x3ca9('0x4b')](_0x4dc4a6[_0x3ca9('0x4a')]);_0x3e3d40[_0x3ca9('0x4c')]=_[_0x3ca9('0x4d')](_0x3e3d40[_0x3ca9('0x49')],_0x3e3d40['query']);_0x469158[_0x3ca9('0x4e')]=_[_0x3ca9('0x4d')](_0x3e3d40[_0x3ca9('0x49')],qs[_0x3ca9('0x4f')](_0x4dc4a6[_0x3ca9('0x4a')][_0x3ca9('0x4f')]));_0x469158[_0x3ca9('0x4e')]=_0x469158[_0x3ca9('0x4e')][_0x3ca9('0x50')]?_0x469158[_0x3ca9('0x4e')]:_0x3e3d40[_0x3ca9('0x49')];if(_0x4dc4a6[_0x3ca9('0x4a')][_0x3ca9('0xbe')]){_0x469158['include']=[{'all':!![]}];}_0x469158=_['merge']({},_0x469158,_0x4dc4a6[_0x3ca9('0xbf')]);return db[_0x3ca9('0x45')]['find'](_0x469158)[_0x3ca9('0x2f')](handleEntityNotFound(_0x3ad0e3,null))['then'](respondWithResult(_0x3ad0e3,null))[_0x3ca9('0xbc')](handleError(_0x3ad0e3,null));};exports[_0x3ca9('0xc0')]=function(_0x27d377,_0x1db76f){return db[_0x3ca9('0x45')]['create'](_0x27d377[_0x3ca9('0xc1')],{})['then'](respondWithResult(_0x1db76f,0xc9))[_0x3ca9('0xbc')](handleError(_0x1db76f,null));};exports[_0x3ca9('0x2e')]=function(_0x5c6050,_0x24b2bd){if(_0x5c6050[_0x3ca9('0xc1')]['id']){delete _0x5c6050[_0x3ca9('0xc1')]['id'];}return db[_0x3ca9('0x45')][_0x3ca9('0x6e')]({'where':{'id':_0x5c6050[_0x3ca9('0xbd')]['id']}})[_0x3ca9('0x2f')](handleEntityNotFound(_0x24b2bd,null))[_0x3ca9('0x2f')](saveUpdates(_0x5c6050[_0x3ca9('0xc1')],null))['then'](respondWithResult(_0x24b2bd,null))[_0x3ca9('0xbc')](handleError(_0x24b2bd,null));};exports[_0x3ca9('0x30')]=function(_0x521fb4,_0x3c151e){return db['OpenchannelInteraction'][_0x3ca9('0x6e')]({'where':{'id':_0x521fb4[_0x3ca9('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3c151e,null))[_0x3ca9('0x2f')](removeEntity(_0x3c151e,null))[_0x3ca9('0xbc')](handleError(_0x3c151e,null));};exports[_0x3ca9('0xc2')]=function(_0xacf084,_0x2dd3aa){return db['OpenchannelInteraction'][_0x3ca9('0xc2')]()['then'](respondWithResult(_0x2dd3aa,null))[_0x3ca9('0xbc')](handleError(_0x2dd3aa,null));};exports[_0x3ca9('0xc3')]=function(_0x1c70c8,_0xfd8419,_0x40279f){return db[_0x3ca9('0xc4')]['find']({'where':{'id':_0x1c70c8[_0x3ca9('0xbd')]['id']}})[_0x3ca9('0x2f')](handleEntityNotFound(_0xfd8419,null))['then'](function(_0x33ff7c){if(_0x33ff7c){return _0x33ff7c['addMessage'](_0x1c70c8[_0x3ca9('0xc1')][_0x3ca9('0xc5')],_['omit'](_0x1c70c8['body'],['ids','id'])||{});}})['then'](respondWithResult(_0xfd8419,null))['catch'](handleError(_0xfd8419,null));};exports['getMessages']=function(_0x2f9027,_0x35b40b,_0x3715b7){var _0x31303a={'raw':![],'where':{}};var _0x2cfa0f={};var _0x295da0={'count':0x0,'rows':[]};return db[_0x3ca9('0x45')][_0x3ca9('0xc6')]({'where':{'id':_0x2f9027[_0x3ca9('0xbd')]['id']}})[_0x3ca9('0x2f')](handleEntityNotFound(_0x35b40b,null))[_0x3ca9('0x2f')](function(_0x241d26){if(_0x241d26){_0x2cfa0f[_0x3ca9('0x49')]=_[_0x3ca9('0x4b')](db[_0x3ca9('0xc4')][_0x3ca9('0x46')]);_0x2cfa0f['query']=_[_0x3ca9('0x4b')](_0x2f9027[_0x3ca9('0x4a')]);_0x2cfa0f[_0x3ca9('0x4c')]=_['intersection'](_0x2cfa0f['model'],_0x2cfa0f[_0x3ca9('0x4a')]);_0x31303a['attributes']=_[_0x3ca9('0x4d')](_0x2cfa0f[_0x3ca9('0x49')],qs[_0x3ca9('0x4f')](_0x2f9027[_0x3ca9('0x4a')][_0x3ca9('0x4f')]));_0x31303a[_0x3ca9('0x4e')]=_0x31303a[_0x3ca9('0x4e')][_0x3ca9('0x50')]?_0x31303a[_0x3ca9('0x4e')]:_0x2cfa0f['model'];if(!_0x2f9027[_0x3ca9('0x4a')][_0x3ca9('0x51')](_0x3ca9('0x52'))){_0x31303a['limit']=qs[_0x3ca9('0x28')](_0x2f9027[_0x3ca9('0x4a')][_0x3ca9('0x28')]);_0x31303a['offset']=qs[_0x3ca9('0x26')](_0x2f9027['query'][_0x3ca9('0x26')]);}_0x31303a['order']=qs[_0x3ca9('0x54')](_0x2f9027[_0x3ca9('0x4a')][_0x3ca9('0x54')]);_0x31303a[_0x3ca9('0x8a')]=qs['filters'](_[_0x3ca9('0x55')](_0x2f9027[_0x3ca9('0x4a')],_0x2cfa0f[_0x3ca9('0x4c')]));_0x31303a[_0x3ca9('0x8a')][_0x3ca9('0xba')]=_0x241d26['id'];if(_0x2f9027[_0x3ca9('0x4a')][_0x3ca9('0x91')]){_0x31303a[_0x3ca9('0x8a')]=_[_0x3ca9('0xa7')](_0x31303a[_0x3ca9('0x8a')],{'$or':_['map'](_0x31303a[_0x3ca9('0x4e')],function(_0x5d428e){var _0x5023d3={};_0x5023d3[_0x5d428e]={'$like':'%'+_0x2f9027[_0x3ca9('0x4a')][_0x3ca9('0x91')]+'%'};return _0x5023d3;})});}if(_0x2f9027[_0x3ca9('0x4a')]['$gte']){var _0x1cace6=_0x2f9027[_0x3ca9('0x4a')][_0x3ca9('0x88')][_0x3ca9('0x3a')](',');var _0x4088c8={};_0x4088c8[_0x1cace6[0x0]]={'$gte':moment(_0x1cace6[0x1])['format'](_0x3ca9('0xc7'))};_0x31303a[_0x3ca9('0x8a')]=_['merge'](_0x31303a[_0x3ca9('0x8a')],_0x4088c8);}_0x31303a=_[_0x3ca9('0xa7')]({},_0x31303a,_0x2f9027[_0x3ca9('0xbf')]);return db[_0x3ca9('0xc4')][_0x3ca9('0x29')]({'where':_0x31303a[_0x3ca9('0x8a')]})[_0x3ca9('0x2f')](function(_0xc6f388){_0x295da0[_0x3ca9('0x29')]=_0xc6f388;if(_0x2f9027[_0x3ca9('0x4a')][_0x3ca9('0xbe')]){_0x31303a[_0x3ca9('0xc8')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x3ca9('0xc9')](_0x31303a);})[_0x3ca9('0x2f')](function(_0x4f69fc){_0x295da0[_0x3ca9('0xbb')]=_0x4f69fc;return _0x295da0;});}})['then'](respondWithFilteredResult(_0x35b40b,_0x31303a))[_0x3ca9('0xbc')](handleError(_0x35b40b,null));};exports[_0x3ca9('0xca')]=function(_0x49bfc2,_0x2a9464,_0x29de26){return db[_0x3ca9('0x45')]['find']({'where':{'id':_0x49bfc2['params']['id']}})[_0x3ca9('0x2f')](handleEntityNotFound(_0x2a9464,null))[_0x3ca9('0x2f')](function(_0x387b43){if(_0x387b43){return _0x387b43[_0x3ca9('0xcb')](_0x49bfc2[_0x3ca9('0xc1')][_0x3ca9('0xc5')],_[_0x3ca9('0xcc')](_0x49bfc2['body'],[_0x3ca9('0xc5'),'id'])||{})['spread'](function(){return db[_0x3ca9('0xcd')][_0x3ca9('0xc9')]({'attributes':['id',_0x3ca9('0x34'),_0x3ca9('0xce')],'where':{'id':_0x49bfc2[_0x3ca9('0xc1')][_0x3ca9('0xc5')]}});})[_0x3ca9('0x2f')](function(_0xdcfbe4){socket[_0x3ca9('0xcf')](_0x3ca9('0xd0'),{'id':Number(_0x49bfc2[_0x3ca9('0xbd')]['id']),'tags':_0xdcfbe4||[]});return{'id':Number(_0x49bfc2['params']['id']),'tags':_0xdcfbe4||[]};});}})[_0x3ca9('0x2f')](respondWithResult(_0x2a9464,null))[_0x3ca9('0xbc')](handleError(_0x2a9464,null));};exports[_0x3ca9('0xd1')]=function(_0x19a792,_0xc3d445,_0x4044dd){return db['OpenchannelInteraction'][_0x3ca9('0x6e')]({'where':{'id':_0x19a792[_0x3ca9('0xbd')]['id']}})[_0x3ca9('0x2f')](handleEntityNotFound(_0xc3d445,null))[_0x3ca9('0x2f')](function(_0x45fdec){if(_0x45fdec){return _0x45fdec[_0x3ca9('0xd1')](_0x19a792[_0x3ca9('0x4a')][_0x3ca9('0xc5')]);}})[_0x3ca9('0x2f')](respondWithStatusCode(_0xc3d445,null))[_0x3ca9('0xbc')](handleError(_0xc3d445,null));};exports['download']=function(_0x2e0890,_0x4e8315){var _0xd3c977=moment()[_0x3ca9('0xd2')]()['toString']();var _0x5e0256=path['join'](config[_0x3ca9('0xd3')],_0x3ca9('0xd4'),_0x3ca9('0xd5'),_0x3ca9('0xd6'));var _0x2e0369=path['join'](config[_0x3ca9('0xd3')],_0x3ca9('0xd4'),_0x3ca9('0xd5'),_0x3ca9('0xd7'));var _0x376e6e=path[_0x3ca9('0xd8')](_0x5e0256,_0xd3c977);var _0x3d6ef7=util[_0x3ca9('0xd9')](_0x3ca9('0xda'),_0x2e0890[_0x3ca9('0xbd')]['id'],_0xd3c977);var _0x2ddd3e=path[_0x3ca9('0xd8')](_0x5e0256,_0x3d6ef7);var _0x5c2818=[];_0x5c2818[_0x3ca9('0x3b')]({'model':db['User'],'as':_0x3ca9('0x7e'),'attributes':['id',_0x3ca9('0x38')],'raw':!![]});_0x5c2818[_0x3ca9('0x3b')]({'model':db[_0x3ca9('0xdb')],'as':_0x3ca9('0x74'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x2e0890['query']['attachments']){_0x5c2818['push']({'model':db[_0x3ca9('0xdc')],'as':'Attachment','raw':!![]});}var _0x5324f1=[{'model':db[_0x3ca9('0xc4')],'as':_0x3ca9('0xdd'),'attributes':['id',_0x3ca9('0xc1'),_0x3ca9('0xde'),'direction',_0x3ca9('0xdf'),_0x3ca9('0x8d')],'include':_0x5c2818}];_0x5324f1[_0x3ca9('0x3b')]({'model':db[_0x3ca9('0xe0')],'as':_0x3ca9('0xe1'),'attributes':['id',_0x3ca9('0x34')]});_0x5324f1[_0x3ca9('0x3b')]({'model':db['User'],'as':_0x3ca9('0xe2'),'attributes':['id',_0x3ca9('0x38')]});return db[_0x3ca9('0x45')][_0x3ca9('0x6e')]({'where':{'id':_0x2e0890[_0x3ca9('0xbd')]['id']},'include':_0x5324f1})[_0x3ca9('0x2f')](handleEntityNotFound(_0x4e8315,null))[_0x3ca9('0x2f')](function(_0x1c789c){if(_0x1c789c){var _0x1714af=_0x1c789c['get']({'plain':!![]});fs[_0x3ca9('0xe3')](_0x376e6e);var _0x1e3dd8={'channel':'Openchannel','account':_0x1714af['Account'][_0x3ca9('0x34')],'agent':_0x1714af[_0x3ca9('0xe2')]?_0x1714af['Owner'][_0x3ca9('0x38')]:_0x3ca9('0xe4'),'createdAt':moment(_0x1714af[_0x3ca9('0xde')])[_0x3ca9('0xd9')](_0x3ca9('0xc7'))[_0x3ca9('0xa5')](),'closedAt':_0x1714af[_0x3ca9('0x41')]?moment(_0x1714af[_0x3ca9('0xe5')])[_0x3ca9('0xd9')](_0x3ca9('0xc7'))[_0x3ca9('0xa5')]():'','disposition':_0x1714af[_0x3ca9('0xe6')],'visibility':_0x1714af[_0x3ca9('0xe7')]?'Public':_0x3ca9('0xe8'),'messages':_(_0x1714af[_0x3ca9('0xdd')])[_0x3ca9('0x91')]({'secret':![]})[_0x3ca9('0x37')](function(_0x304525){if(_0x304525[_0x3ca9('0xdc')]){var _0xcf722e=path[_0x3ca9('0xd8')](_0x2e0369,_0x304525[_0x3ca9('0xdc')][_0x3ca9('0xe9')]);if(fs['existsSync'](_0xcf722e)){fs[_0x3ca9('0xea')](_0xcf722e)[_0x3ca9('0xeb')](fs[_0x3ca9('0xec')](path['join'](_0x376e6e,_0x304525[_0x3ca9('0xdc')][_0x3ca9('0xe9')])));}}return{'date':moment(_0x304525['createdAt'])[_0x3ca9('0xd9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3ca9('0xa5')](),'sender':_0x304525[_0x3ca9('0xed')]===_0x3ca9('0xee')?_0x304525[_0x3ca9('0x7e')]?_0x304525[_0x3ca9('0x7e')][_0x3ca9('0x38')]:'System':_0x304525[_0x3ca9('0x74')]['firstName']+(_0x304525[_0x3ca9('0x74')]['lastName']?'\x20'+_0x304525['Contact'][_0x3ca9('0xef')]:''),'body':_0x304525[_0x3ca9('0xdc')]?_0x304525['Attachment'][_0x3ca9('0xe9')]:_0x304525[_0x3ca9('0xc1')],'direction':_0x304525['direction']==='out'?'A':'C','secret':_0x304525[_0x3ca9('0xdf')],'read':_0x304525['read'],'attachment':_0x304525['Attachment']};})[_0x3ca9('0x70')]()};return ejs['renderFile'](path[_0x3ca9('0xd8')](config[_0x3ca9('0xd3')],_0x3ca9('0xd4'),'views',_0x3ca9('0xf0')),{'interaction':_0x1e3dd8})[_0x3ca9('0x2f')](function(_0x16dc1e){var _0x3be48a=path[_0x3ca9('0xd8')](_0x376e6e,_0x3ca9('0xf1')+_0x1714af['id']+'-'+_0xd3c977+_0x3ca9('0xf2'));var _0xce651c={'path':_0x3be48a,'channel':_0x3ca9('0xf3'),'interactionId':_0x1714af['id']};return pdf[_0x3ca9('0xf4')](_0x16dc1e,_0xce651c);})['then'](function(){return new BPromise(function(_0x2f44f5,_0x3f32a7){zipdir(_0x376e6e,{'saveTo':_0x2ddd3e},function(_0x5566d8,_0x4e0a9c){if(_0x5566d8)return _0x3f32a7(_0x5566d8);return _0x2f44f5(_0x4e0a9c);});})[_0x3ca9('0x2f')](function(){return new BPromise(function(_0x5cf92b,_0x5535b9){rimraf(_0x376e6e,function(_0x4a0d0b){if(_0x4a0d0b)_0x5535b9(_0x4a0d0b);return _0x5cf92b();});});})[_0x3ca9('0x2f')](function(){return _0x4e8315[_0x3ca9('0xf5')](_0x2ddd3e,_0x3d6ef7,function(_0x598232){if(_0x598232){console['log'](_0x3ca9('0xf6'),_0x598232);}else{fs[_0x3ca9('0xf7')](_0x2ddd3e);}});});});}else{return _0x4e8315[_0x3ca9('0x31')](0xc8);}})[_0x3ca9('0xbc')](handleError(_0x4e8315,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index bda50d1..36bae67 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 _0xb51b=['findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','remove','getUsers','Users'];(function(_0x5216e0,_0x4f8cb9){var _0x5b3f40=function(_0x30c832){while(--_0x30c832){_0x5216e0['push'](_0x5216e0['shift']());}};_0x5b3f40(++_0x4f8cb9);}(_0xb51b,0x16a));var _0xbb51=function(_0xe414fe,_0x411e3c){_0xe414fe=_0xe414fe-0x0;var _0xe34411=_0xb51b[_0xe414fe];return _0xe34411;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xbb51('0x0'))['db'][_0xbb51('0x1')];var OpenchannelMessage=require(_0xbb51('0x0'))['db'][_0xbb51('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbb51('0x3')};function emitEvent(_0x16f6b6){return function(_0x1d97b5,_0x4fcfb9,_0x1fe7fe){_0x1d97b5[_0xbb51('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3dc426){_0x1d97b5['setDataValue'](_0xbb51('0x5'),_0x3dc426['map'](function(_0x33e1eb){return{'id':_0x33e1eb['id']};}));return OpenchannelMessage[_0xbb51('0x6')]({'where':{'OpenchannelInteractionId':_0x1d97b5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbb51('0x7')](function(_0x157408){_0x1d97b5[_0xbb51('0x8')](_0xbb51('0x9'),_0x157408[_0xbb51('0xa')]);OpenchannelInteractionEvents[_0xbb51('0xb')](_0x16f6b6+':'+_0x1d97b5['id'],_0x1d97b5);OpenchannelInteractionEvents[_0xbb51('0xb')](_0x16f6b6,_0x1d97b5);_0x1fe7fe(null);})[_0xbb51('0xc')](_0x1fe7fe(null));};}for(var e in events){if(events[_0xbb51('0xd')](e)){var event=events[e];OpenchannelInteraction[_0xbb51('0xe')](e,emitEvent(event));}}module[_0xbb51('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x3f7c=['events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','remove','getUsers','then','setDataValue','Users','findAll','emit','catch','hook','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x3f7c,0x1e0));var _0xc3f7=function(_0x2f916a,_0x3a4d1d){_0x2f916a=_0x2f916a-0x0;var _0x328fd5=_0x3f7c[_0x2f916a];return _0x328fd5;};'use strict';var EventEmitter=require(_0xc3f7('0x0'));var OpenchannelInteraction=require(_0xc3f7('0x1'))['db'][_0xc3f7('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xc3f7('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc3f7('0x4'),'afterUpdate':'update','afterDestroy':_0xc3f7('0x5')};function emitEvent(_0x5436d3){return function(_0x463d86,_0x446cd7,_0x18f534){_0x463d86[_0xc3f7('0x6')]({'attributes':['id'],'raw':!![]})[_0xc3f7('0x7')](function(_0x31b367){_0x463d86[_0xc3f7('0x8')](_0xc3f7('0x9'),_0x31b367['map'](function(_0xbce10b){return{'id':_0xbce10b['id']};}));return OpenchannelMessage[_0xc3f7('0xa')]({'where':{'OpenchannelInteractionId':_0x463d86['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc3f7('0x7')](function(_0x1227cc){_0x463d86[_0xc3f7('0x8')]('unreadMessages',_0x1227cc['length']);OpenchannelInteractionEvents[_0xc3f7('0xb')](_0x5436d3+':'+_0x463d86['id'],_0x463d86);OpenchannelInteractionEvents[_0xc3f7('0xb')](_0x5436d3,_0x463d86);_0x18f534(null);})[_0xc3f7('0xc')](_0x18f534(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xc3f7('0xd')](e,emitEvent(event));}}module[_0xc3f7('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 56672be..4c2156e 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 _0xb83d=['request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird'];(function(_0x4b55e6,_0x2ba8d4){var _0x3f95ea=function(_0x40bf2b){while(--_0x40bf2b){_0x4b55e6['push'](_0x4b55e6['shift']());}};_0x3f95ea(++_0x2ba8d4);}(_0xb83d,0x1d0));var _0xdb83=function(_0x36aed9,_0x26f8e5){_0x36aed9=_0x36aed9-0x0;var _0x3d48e8=_0xb83d[_0x36aed9];return _0x3d48e8;};'use strict';var _=require(_0xdb83('0x0'));var util=require('util');var logger=require(_0xdb83('0x1'))(_0xdb83('0x2'));var moment=require('moment');var BPromise=require(_0xdb83('0x3'));var rp=require(_0xdb83('0x4'));var fs=require('fs');var path=require(_0xdb83('0x5'));var rimraf=require('rimraf');var config=require(_0xdb83('0x6'));var attributes=require(_0xdb83('0x7'));module[_0xdb83('0x8')]=function(_0x362668,_0x232f27){return _0x362668[_0xdb83('0x9')](_0xdb83('0xa'),attributes,{'tableName':_0xdb83('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdb83('0xc'),'collate':_0xdb83('0xd'),'hooks':{'beforeUpdate':function(_0x4f9882,_0x124b78,_0x6dcb90){if(_0x4f9882[_0xdb83('0xe')](_0xdb83('0xf'))){_0x4f9882['closedAt']=moment()[_0xdb83('0x10')](_0xdb83('0x11'));}_0x6dcb90(null,_0x4f9882);}}});}; \ No newline at end of file +var _0x9129=['./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise','../../config/environment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x9129,0xcc));var _0x9912=function(_0x1df473,_0x1a6931){_0x1df473=_0x1df473-0x0;var _0x1bdd49=_0x9129[_0x1df473];return _0x1bdd49;};'use strict';var _=require(_0x9912('0x0'));var util=require(_0x9912('0x1'));var logger=require('../../config/logger')(_0x9912('0x2'));var moment=require('moment');var BPromise=require(_0x9912('0x3'));var rp=require(_0x9912('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9912('0x5'));var attributes=require(_0x9912('0x6'));module[_0x9912('0x7')]=function(_0x2af74c,_0x17d0fb){return _0x2af74c['define'](_0x9912('0x8'),attributes,{'tableName':_0x9912('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9912('0xa'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x5dee48,_0x4ccfb0,_0x498a0c){if(_0x5dee48[_0x9912('0xb')]('closed')){_0x5dee48[_0x9912('0xc')]=moment()[_0x9912('0xd')](_0x9912('0xe'));}_0x498a0c(null,_0x5dee48);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index c61b6ac..d1d78e1 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 _0xc3c7=['omit','spread','AddTags','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','find','addTags','ids'];(function(_0x1fe8be,_0x5e7860){var _0x1449bb=function(_0x17b23e){while(--_0x17b23e){_0x1fe8be['push'](_0x1fe8be['shift']());}};_0x1449bb(++_0x5e7860);}(_0xc3c7,0x130));var _0x7c3c=function(_0x4a1e37,_0x2eef28){_0x4a1e37=_0x4a1e37-0x0;var _0xeb1f8b=_0xc3c7[_0x4a1e37];return _0xeb1f8b;};'use strict';var _=require(_0x7c3c('0x0'));var util=require(_0x7c3c('0x1'));var moment=require('moment');var BPromise=require(_0x7c3c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c3c('0x3'))['db'];var utils=require(_0x7c3c('0x4'));var logger=require(_0x7c3c('0x5'))(_0x7c3c('0x6'));var config=require(_0x7c3c('0x7'));var jayson=require(_0x7c3c('0x8'));var client=jayson[_0x7c3c('0x9')][_0x7c3c('0xa')]({'port':0x232a});config[_0x7c3c('0xb')]=_[_0x7c3c('0xc')](config[_0x7c3c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c3c('0xd'))(new Redis(config[_0x7c3c('0xb')]));require(_0x7c3c('0xe'))[_0x7c3c('0xf')](socket);function respondWithRpcPromise(_0x3bfdf0,_0x246f7c,_0x5b1bee){return new BPromise(function(_0xca2c97,_0x168f58){return client[_0x7c3c('0x10')](_0x3bfdf0,_0x5b1bee)[_0x7c3c('0x11')](function(_0xea7af0){logger[_0x7c3c('0x12')](_0x7c3c('0x13'),_0x246f7c,'request\x20sent');logger[_0x7c3c('0x14')](_0x7c3c('0x15'),_0x246f7c,'request\x20sent',JSON['stringify'](_0xea7af0));if(_0xea7af0[_0x7c3c('0x16')]){if(_0xea7af0[_0x7c3c('0x16')][_0x7c3c('0x17')]===0x1f4){logger['error'](_0x7c3c('0x13'),_0x246f7c,_0xea7af0[_0x7c3c('0x16')][_0x7c3c('0x18')]);return _0x168f58(_0xea7af0[_0x7c3c('0x16')][_0x7c3c('0x18')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x246f7c,_0xea7af0[_0x7c3c('0x16')][_0x7c3c('0x18')]);return _0xca2c97(_0xea7af0[_0x7c3c('0x16')][_0x7c3c('0x18')]);}else{logger[_0x7c3c('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x246f7c,'request\x20sent');_0xca2c97(_0xea7af0['result'][_0x7c3c('0x18')]);}})[_0x7c3c('0x19')](function(_0x5bab01){logger[_0x7c3c('0x16')](_0x7c3c('0x13'),_0x246f7c,_0x5bab01);_0x168f58(_0x5bab01);});});}exports[_0x7c3c('0x1a')]=function(_0x4d39ae){var _0x291256=this;return new Promise(function(_0x3432a7,_0x42803c){return db[_0x7c3c('0x1b')][_0x7c3c('0x1c')](_0x4d39ae[_0x7c3c('0x1d')],{'raw':_0x4d39ae[_0x7c3c('0x1e')]?_0x4d39ae[_0x7c3c('0x1e')][_0x7c3c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d39ae[_0x7c3c('0x1e')]?_0x4d39ae[_0x7c3c('0x1e')][_0x7c3c('0x20')]||null:null,'attributes':_0x4d39ae[_0x7c3c('0x1e')]?_0x4d39ae[_0x7c3c('0x1e')][_0x7c3c('0x21')]||null:null,'limit':_0x4d39ae[_0x7c3c('0x1e')]?_0x4d39ae[_0x7c3c('0x1e')][_0x7c3c('0x22')]||null:null})[_0x7c3c('0x11')](function(_0x3f2e6c){logger[_0x7c3c('0x12')](_0x7c3c('0x1a'),_0x4d39ae);logger[_0x7c3c('0x14')](_0x7c3c('0x1a'),_0x4d39ae,JSON[_0x7c3c('0x23')](_0x3f2e6c));_0x3432a7(_0x3f2e6c);})[_0x7c3c('0x19')](function(_0x37c4be){logger[_0x7c3c('0x16')](_0x7c3c('0x1a'),_0x37c4be['message'],_0x4d39ae);_0x42803c(_0x291256[_0x7c3c('0x16')](0x1f4,_0x37c4be['message']));});});};exports[_0x7c3c('0x24')]=function(_0x30f863){return new Promise(function(_0x3c096e,_0x13e0e2){return db[_0x7c3c('0x1b')][_0x7c3c('0x25')]({'where':_0x30f863[_0x7c3c('0x1e')]?_0x30f863[_0x7c3c('0x1e')][_0x7c3c('0x20')]||null:null})[_0x7c3c('0x11')](function(_0x5229f8){if(_0x5229f8){return _0x5229f8[_0x7c3c('0x26')](_0x30f863['body'][_0x7c3c('0x27')],_[_0x7c3c('0x28')](_0x30f863['body'],[_0x7c3c('0x27'),'id'])||{});}})[_0x7c3c('0x29')](function(_0x17947b){logger[_0x7c3c('0x12')](_0x7c3c('0x2a'),_0x30f863);logger['debug'](_0x7c3c('0x2a'),_0x30f863,JSON[_0x7c3c('0x23')](_0x17947b));_0x3c096e(_0x17947b);})['catch'](function(_0x2d6601){logger['error'](_0x7c3c('0x2a'),_0x2d6601[_0x7c3c('0x18')],_0x30f863);_0x13e0e2(_this[_0x7c3c('0x16')](0x1f4,_0x2d6601['message']));});});}; \ No newline at end of file +var _0x0ee1=['jayson/promise','http','redis','localhost','./openchannelInteraction.socket','register','request','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelInteraction,\x20%s,\x20%s','message','info','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','then','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4bb010,_0x1422e4){var _0x38f98e=function(_0x1884a3){while(--_0x1884a3){_0x4bb010['push'](_0x4bb010['shift']());}};_0x38f98e(++_0x1422e4);}(_0x0ee1,0x10e));var _0x10ee=function(_0x1c7137,_0x4c7c26){_0x1c7137=_0x1c7137-0x0;var _0xeb4432=_0x0ee1[_0x1c7137];return _0xeb4432;};'use strict';var _=require(_0x10ee('0x0'));var util=require(_0x10ee('0x1'));var moment=require(_0x10ee('0x2'));var BPromise=require(_0x10ee('0x3'));var rs=require(_0x10ee('0x4'));var fs=require('fs');var Redis=require(_0x10ee('0x5'));var db=require(_0x10ee('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x10ee('0x7'))(_0x10ee('0x8'));var config=require(_0x10ee('0x9'));var jayson=require(_0x10ee('0xa'));var client=jayson['client'][_0x10ee('0xb')]({'port':0x232a});config[_0x10ee('0xc')]=_['defaults'](config[_0x10ee('0xc')],{'host':_0x10ee('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x10ee('0xc')]));require(_0x10ee('0xe'))[_0x10ee('0xf')](socket);function respondWithRpcPromise(_0x3ddda7,_0xfd6486,_0x3a4da9){return new BPromise(function(_0x41ae19,_0xd01561){return client[_0x10ee('0x10')](_0x3ddda7,_0x3a4da9)['then'](function(_0x3fe844){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0xfd6486,_0x10ee('0x11'));logger[_0x10ee('0x12')](_0x10ee('0x13'),_0xfd6486,_0x10ee('0x11'),JSON[_0x10ee('0x14')](_0x3fe844));if(_0x3fe844[_0x10ee('0x15')]){if(_0x3fe844[_0x10ee('0x15')]['code']===0x1f4){logger[_0x10ee('0x15')](_0x10ee('0x16'),_0xfd6486,_0x3fe844[_0x10ee('0x15')][_0x10ee('0x17')]);return _0xd01561(_0x3fe844[_0x10ee('0x15')][_0x10ee('0x17')]);}logger['error'](_0x10ee('0x16'),_0xfd6486,_0x3fe844[_0x10ee('0x15')]['message']);return _0x41ae19(_0x3fe844['error'][_0x10ee('0x17')]);}else{logger[_0x10ee('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0xfd6486,'request\x20sent');_0x41ae19(_0x3fe844['result'][_0x10ee('0x17')]);}})[_0x10ee('0x19')](function(_0x2641aa){logger[_0x10ee('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0xfd6486,_0x2641aa);_0xd01561(_0x2641aa);});});}exports[_0x10ee('0x1a')]=function(_0x18609c){var _0x571fe5=this;return new Promise(function(_0x268459,_0x18d413){return db[_0x10ee('0x1b')][_0x10ee('0x1c')](_0x18609c[_0x10ee('0x1d')],{'raw':_0x18609c[_0x10ee('0x1e')]?_0x18609c[_0x10ee('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18609c['options']?_0x18609c[_0x10ee('0x1e')][_0x10ee('0x1f')]||null:null,'attributes':_0x18609c[_0x10ee('0x1e')]?_0x18609c[_0x10ee('0x1e')][_0x10ee('0x20')]||null:null,'limit':_0x18609c[_0x10ee('0x1e')]?_0x18609c['options'][_0x10ee('0x21')]||null:null})[_0x10ee('0x22')](function(_0x91fe30){logger[_0x10ee('0x18')](_0x10ee('0x1a'),_0x18609c);logger[_0x10ee('0x12')](_0x10ee('0x1a'),_0x18609c,JSON[_0x10ee('0x14')](_0x91fe30));_0x268459(_0x91fe30);})[_0x10ee('0x19')](function(_0x3fe900){logger[_0x10ee('0x15')]('UpdateOpenchannelInteraction',_0x3fe900[_0x10ee('0x17')],_0x18609c);_0x18d413(_0x571fe5[_0x10ee('0x15')](0x1f4,_0x3fe900[_0x10ee('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x5b7f82){return new Promise(function(_0x1ece6d,_0x1d8075){return db[_0x10ee('0x1b')][_0x10ee('0x23')]({'where':_0x5b7f82[_0x10ee('0x1e')]?_0x5b7f82[_0x10ee('0x1e')]['where']||null:null})[_0x10ee('0x22')](function(_0x54e0c3){if(_0x54e0c3){return _0x54e0c3[_0x10ee('0x24')](_0x5b7f82[_0x10ee('0x1d')]['ids'],_['omit'](_0x5b7f82[_0x10ee('0x1d')],[_0x10ee('0x25'),'id'])||{});}})[_0x10ee('0x26')](function(_0xe2ccfe){logger['info'](_0x10ee('0x27'),_0x5b7f82);logger[_0x10ee('0x12')](_0x10ee('0x27'),_0x5b7f82,JSON[_0x10ee('0x14')](_0xe2ccfe));_0x1ece6d(_0xe2ccfe);})[_0x10ee('0x19')](function(_0x3e3c13){logger['error'](_0x10ee('0x27'),_0x3e3c13['message'],_0x5b7f82);_0x1d8075(_this[_0x10ee('0x15')](0x1f4,_0x3e3c13[_0x10ee('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index acd2490..08a6833 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 _0x252c=['save','remove','emit','removeListener','register','length','openchannelInteraction:'];(function(_0x19fec1,_0x1cc62f){var _0x29cd35=function(_0x712a4f){while(--_0x712a4f){_0x19fec1['push'](_0x19fec1['shift']());}};_0x29cd35(++_0x1cc62f);}(_0x252c,0x1c7));var _0xc252=function(_0x544a3d,_0x3d1962){_0x544a3d=_0x544a3d-0x0;var _0x1ab7bb=_0x252c[_0x544a3d];return _0x1ab7bb;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xc252('0x0'),_0xc252('0x1'),'update'];function createListener(_0x1f3064,_0x2700db){return function(_0x3c2bb6){_0x2700db[_0xc252('0x2')](_0x1f3064,_0x3c2bb6);};}function removeListener(_0x2d5090,_0x362533){return function(){OpenchannelInteractionEvents[_0xc252('0x3')](_0x2d5090,_0x362533);};}exports[_0xc252('0x4')]=function(_0x32c4d4){for(var _0x1e14e5=0x0,_0x4e6d7c=events[_0xc252('0x5')];_0x1e14e5<_0x4e6d7c;_0x1e14e5++){var _0x13ad50=events[_0x1e14e5];var _0x466604=createListener(_0xc252('0x6')+_0x13ad50,_0x32c4d4);OpenchannelInteractionEvents['on'](_0x13ad50,_0x466604);}}; \ No newline at end of file +var _0x0c7e=['./openchannelInteraction.events','save','update','emit','removeListener','register','length','openchannelInteraction:'];(function(_0x506434,_0x2d29a1){var _0x18b6ae=function(_0x34fb3a){while(--_0x34fb3a){_0x506434['push'](_0x506434['shift']());}};_0x18b6ae(++_0x2d29a1);}(_0x0c7e,0x198));var _0xe0c7=function(_0x3205d0,_0x11c891){_0x3205d0=_0x3205d0-0x0;var _0x142377=_0x0c7e[_0x3205d0];return _0x142377;};'use strict';var OpenchannelInteractionEvents=require(_0xe0c7('0x0'));var events=[_0xe0c7('0x1'),'remove',_0xe0c7('0x2')];function createListener(_0x117a27,_0x573a3f){return function(_0xe801f4){_0x573a3f[_0xe0c7('0x3')](_0x117a27,_0xe801f4);};}function removeListener(_0x490b87,_0x5a64d8){return function(){OpenchannelInteractionEvents[_0xe0c7('0x4')](_0x490b87,_0x5a64d8);};}exports[_0xe0c7('0x5')]=function(_0xb9331e){for(var _0x4ee3c1=0x0,_0x109514=events[_0xe0c7('0x6')];_0x4ee3c1<_0x109514;_0x4ee3c1++){var _0x39d1d8=events[_0x4ee3c1];var _0x459e56=createListener(_0xe0c7('0x7')+_0x39d1d8,_0xb9331e);OpenchannelInteractionEvents['on'](_0x39d1d8,_0x459e56);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index b8f2583..92c9a55 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 _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x2465a4,_0x4d6afa){var _0xd1da10=function(_0x452eac){while(--_0x452eac){_0x2465a4['push'](_0x2465a4['shift']());}};_0xd1da10(++_0x4d6afa);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x3ddbcc,_0x54be6b){var _0x381b48=function(_0x467e7d){while(--_0x467e7d){_0x3ddbcc['push'](_0x3ddbcc['shift']());}};_0x381b48(++_0x54be6b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 901a522..bf4877c 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 _0x81cb=['DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x44029c,_0x426690){var _0x547fa1=function(_0x37b1f9){while(--_0x37b1f9){_0x44029c['push'](_0x44029c['shift']());}};_0x547fa1(++_0x426690);}(_0x81cb,0xaa));var _0xb81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81cb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb81c('0x0'));module[_0xb81c('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb81c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb81c('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb81c('0x4')]('in',_0xb81c('0x5')),'defaultValue':_0xb81c('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb81c('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb81c('0x7')]}}; \ No newline at end of file +var _0xd509=['STRING','TEXT','medium','BOOLEAN','out'];(function(_0xf89c3,_0x351bf1){var _0x274fc8=function(_0x5e0c91){while(--_0x5e0c91){_0xf89c3['push'](_0xf89c3['shift']());}};_0x274fc8(++_0x351bf1);}(_0xd509,0xc9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x9d50('0x0')](_0x9d50('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x9d50('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9d50('0x3')),'defaultValue':_0x9d50('0x3'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x9d50('0x4')]},'providerResponse':{'type':Sequelize[_0x9d50('0x0')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index fafc367..54d9e45 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 _0x77a5=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','reject','save','update','destroy','end','stack','send','index','OpenchannelMessage','rawAttributes','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','name','options','include','findAll','rows','show','keys','includeAll','merge','find','create','body','params','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','isNil','read1stAt','interaction','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','acceptmessage','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','EventManager','rejectmessage','eml-format','rimraf'];(function(_0x5104f5,_0x2908bd){var _0x2bb4f9=function(_0x431014){while(--_0x431014){_0x5104f5['push'](_0x5104f5['shift']());}};_0x2bb4f9(++_0x2908bd);}(_0x77a5,0x196));var _0x577a=function(_0x2f5de9,_0x2485be){_0x2f5de9=_0x2f5de9-0x0;var _0x890a7f=_0x77a5[_0x2f5de9];return _0x890a7f;};'use strict';var emlformat=require(_0x577a('0x0'));var rimraf=require(_0x577a('0x1'));var zipdir=require(_0x577a('0x2'));var jsonpatch=require(_0x577a('0x3'));var rp=require(_0x577a('0x4'));var moment=require(_0x577a('0x5'));var BPromise=require(_0x577a('0x6'));var Mustache=require(_0x577a('0x7'));var util=require(_0x577a('0x8'));var path=require(_0x577a('0x9'));var sox=require(_0x577a('0xa'));var csv=require(_0x577a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x577a('0xc'));var _=require(_0x577a('0xd'));var squel=require('squel');var crypto=require(_0x577a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x577a('0xf'));var toCsv=require(_0x577a('0xb'));var querystring=require('querystring');var Papa=require(_0x577a('0x10'));var Redis=require('ioredis');var authService=require(_0x577a('0x11'));var qs=require(_0x577a('0x12'));var as=require(_0x577a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x577a('0x14'))(_0x577a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x577a('0x16'));var db=require(_0x577a('0x17'))['db'];config[_0x577a('0x18')]=_[_0x577a('0x19')](config['redis'],{'host':_0x577a('0x1a'),'port':0x18eb});var socket=require(_0x577a('0x1b'))(new Redis(config[_0x577a('0x18')]));require(_0x577a('0x1c'))[_0x577a('0x1d')](socket);var jayson=require(_0x577a('0x1e'));var client=jayson[_0x577a('0x1f')][_0x577a('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x577a('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3a3beb,_0x5d51a8,_0x30cad0,_0x254a1d){return new BPromise(function(_0x3715ae,_0x5d82ea){var _0x54c794=_0x254a1d||client;return _0x54c794[_0x577a('0x21')](_0x3a3beb,_0x30cad0)[_0x577a('0x22')](function(_0x5d92d1){logger[_0x577a('0x23')](_0x577a('0x24'),_0x5d51a8,_0x577a('0x25'));logger[_0x577a('0x26')](_0x577a('0x27'),_0x5d51a8,_0x577a('0x25'),JSON[_0x577a('0x28')](_0x5d92d1));if(_0x5d92d1[_0x577a('0x29')]){if(_0x5d92d1['error'][_0x577a('0x2a')]===0x1f4){logger[_0x577a('0x29')](_0x577a('0x24'),_0x5d51a8,_0x5d92d1['error'][_0x577a('0x2b')]);return _0x5d82ea(_0x5d92d1[_0x577a('0x29')][_0x577a('0x2b')]);}logger[_0x577a('0x29')](_0x577a('0x24'),_0x5d51a8,_0x5d92d1[_0x577a('0x29')][_0x577a('0x2b')]);return _0x3715ae(_0x5d92d1['error']['message']);}else{logger[_0x577a('0x23')](_0x577a('0x24'),_0x5d51a8,_0x577a('0x25'));_0x3715ae(_0x5d92d1[_0x577a('0x2c')]['message']);}})[_0x577a('0x2d')](function(_0x4e5c13){logger[_0x577a('0x29')](_0x577a('0x24'),_0x5d51a8,_0x4e5c13);_0x5d82ea(_0x4e5c13);});});}function respondWithStatusCode(_0x1feed6,_0x1ddd43){_0x1ddd43=_0x1ddd43||0xcc;return function(_0x29d9ca){if(_0x29d9ca){return _0x1feed6[_0x577a('0x2e')](_0x1ddd43);}return _0x1feed6['status'](_0x1ddd43)['end']();};}function respondWithResult(_0x1ee4e6,_0x48ab3a){_0x48ab3a=_0x48ab3a||0xc8;return function(_0x1a5219){if(_0x1a5219){return _0x1ee4e6[_0x577a('0x2f')](_0x48ab3a)[_0x577a('0x30')](_0x1a5219);}};}function respondWithFilteredResult(_0x1cf84e,_0x19b84f){return function(_0x147ed2){if(_0x147ed2){var _0x586966=typeof _0x19b84f['offset']===_0x577a('0x31')&&typeof _0x19b84f[_0x577a('0x32')]===_0x577a('0x31');var _0x316a63=_0x147ed2[_0x577a('0x33')];var _0x1125bb=_0x586966?0x0:_0x19b84f['offset'];var _0x1710a0=_0x586966?_0x147ed2[_0x577a('0x33')]:_0x19b84f[_0x577a('0x34')]+_0x19b84f['limit'];var _0x205e53;if(_0x1710a0>=_0x316a63){_0x1710a0=_0x316a63;_0x205e53=0xc8;}else{_0x205e53=0xce;}_0x1cf84e[_0x577a('0x2f')](_0x205e53);return _0x1cf84e['set']('Content-Range',_0x1125bb+'-'+_0x1710a0+'/'+_0x316a63)[_0x577a('0x30')](_0x147ed2);}return null;};}function patchUpdates(_0x1d72dd){return function(_0x120b3d){try{jsonpatch['apply'](_0x120b3d,_0x1d72dd,!![]);}catch(_0x511cb6){return BPromise[_0x577a('0x35')](_0x511cb6);}return _0x120b3d[_0x577a('0x36')]();};}function saveUpdates(_0x1dec5c,_0x2208f9){return function(_0x28be3c){if(_0x28be3c){return _0x28be3c[_0x577a('0x37')](_0x1dec5c)[_0x577a('0x22')](function(_0x5c3d63){return _0x5c3d63;});}return null;};}function removeEntity(_0x1890fb,_0x1ce791){return function(_0x233a93){if(_0x233a93){return _0x233a93[_0x577a('0x38')]()[_0x577a('0x22')](function(){_0x1890fb[_0x577a('0x2f')](0xcc)[_0x577a('0x39')]();});}};}function handleEntityNotFound(_0x51d756,_0x2a5aae){return function(_0x3eceeb){if(!_0x3eceeb){_0x51d756[_0x577a('0x2e')](0x194);}return _0x3eceeb;};}function handleError(_0x35e659,_0x2f43e9){_0x2f43e9=_0x2f43e9||0x1f4;return function(_0x344104){logger[_0x577a('0x29')](_0x344104[_0x577a('0x3a')]);if(_0x344104['name']){delete _0x344104['name'];}_0x35e659[_0x577a('0x2f')](_0x2f43e9)[_0x577a('0x3b')](_0x344104);};}exports[_0x577a('0x3c')]=function(_0x27b3b7,_0x659534){var _0x16025a={},_0x32d86e={},_0x3aa5e3={'count':0x0,'rows':[]};var _0x356cea=_['map'](db[_0x577a('0x3d')][_0x577a('0x3e')],function(_0x18f81b){return{'name':_0x18f81b['fieldName'],'type':_0x18f81b[_0x577a('0x3f')][_0x577a('0x40')]};});_0x32d86e['model']=_[_0x577a('0x41')](_0x356cea,'name');_0x32d86e[_0x577a('0x42')]=_['keys'](_0x27b3b7[_0x577a('0x42')]);_0x32d86e[_0x577a('0x43')]=_[_0x577a('0x44')](_0x32d86e[_0x577a('0x45')],_0x32d86e['query']);_0x16025a[_0x577a('0x46')]=_[_0x577a('0x44')](_0x32d86e[_0x577a('0x45')],qs[_0x577a('0x47')](_0x27b3b7[_0x577a('0x42')][_0x577a('0x47')]));_0x16025a[_0x577a('0x46')]=_0x16025a[_0x577a('0x46')][_0x577a('0x48')]?_0x16025a['attributes']:_0x32d86e['model'];if(!_0x27b3b7[_0x577a('0x42')][_0x577a('0x49')](_0x577a('0x4a'))){_0x16025a[_0x577a('0x32')]=qs[_0x577a('0x32')](_0x27b3b7[_0x577a('0x42')][_0x577a('0x32')]);_0x16025a[_0x577a('0x34')]=qs[_0x577a('0x34')](_0x27b3b7['query'][_0x577a('0x34')]);}_0x16025a[_0x577a('0x4b')]=qs[_0x577a('0x4c')](_0x27b3b7[_0x577a('0x42')][_0x577a('0x4c')]);_0x16025a['where']=qs[_0x577a('0x43')](_[_0x577a('0x4d')](_0x27b3b7[_0x577a('0x42')],_0x32d86e[_0x577a('0x43')]),_0x356cea);if(_0x27b3b7['query'][_0x577a('0x4e')]){_0x16025a['where']=_['merge'](_0x16025a[_0x577a('0x4f')],{'$or':_[_0x577a('0x41')](_0x356cea,function(_0x90225c){if(_0x90225c[_0x577a('0x3f')]!==_0x577a('0x50')){var _0x28c3a8={};_0x28c3a8[_0x90225c[_0x577a('0x51')]]={'$like':'%'+_0x27b3b7[_0x577a('0x42')][_0x577a('0x4e')]+'%'};return _0x28c3a8;}})});}_0x16025a=_['merge']({},_0x16025a,_0x27b3b7[_0x577a('0x52')]);var _0x167478={'where':_0x16025a[_0x577a('0x4f')]};return db['OpenchannelMessage'][_0x577a('0x33')](_0x167478)[_0x577a('0x22')](function(_0x16034a){_0x3aa5e3['count']=_0x16034a;if(_0x27b3b7[_0x577a('0x42')]['includeAll']){_0x16025a[_0x577a('0x53')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x577a('0x54')](_0x16025a);})['then'](function(_0x946f4d){_0x3aa5e3[_0x577a('0x55')]=_0x946f4d;return _0x3aa5e3;})[_0x577a('0x22')](respondWithFilteredResult(_0x659534,_0x16025a))[_0x577a('0x2d')](handleError(_0x659534,null));};exports[_0x577a('0x56')]=function(_0x33aa82,_0x53250e){var _0x118376={'raw':!![],'where':{'id':_0x33aa82['params']['id']}},_0x4d80c7={};_0x4d80c7[_0x577a('0x45')]=_[_0x577a('0x57')](db['OpenchannelMessage']['rawAttributes']);_0x4d80c7[_0x577a('0x42')]=_[_0x577a('0x57')](_0x33aa82['query']);_0x4d80c7[_0x577a('0x43')]=_[_0x577a('0x44')](_0x4d80c7['model'],_0x4d80c7[_0x577a('0x42')]);_0x118376[_0x577a('0x46')]=_[_0x577a('0x44')](_0x4d80c7[_0x577a('0x45')],qs[_0x577a('0x47')](_0x33aa82[_0x577a('0x42')][_0x577a('0x47')]));_0x118376[_0x577a('0x46')]=_0x118376[_0x577a('0x46')][_0x577a('0x48')]?_0x118376[_0x577a('0x46')]:_0x4d80c7[_0x577a('0x45')];if(_0x33aa82[_0x577a('0x42')][_0x577a('0x58')]){_0x118376[_0x577a('0x53')]=[{'all':!![]}];}_0x118376=_[_0x577a('0x59')]({},_0x118376,_0x33aa82[_0x577a('0x52')]);return db[_0x577a('0x3d')][_0x577a('0x5a')](_0x118376)['then'](handleEntityNotFound(_0x53250e,null))[_0x577a('0x22')](respondWithResult(_0x53250e,null))[_0x577a('0x2d')](handleError(_0x53250e,null));};exports[_0x577a('0x5b')]=function(_0x4cdf65,_0x2803a1){return db[_0x577a('0x3d')][_0x577a('0x5b')](_0x4cdf65[_0x577a('0x5c')],{})['then'](respondWithResult(_0x2803a1,0xc9))[_0x577a('0x2d')](handleError(_0x2803a1,null));};exports[_0x577a('0x37')]=function(_0x29960c,_0x2e3a03){if(_0x29960c[_0x577a('0x5c')]['id']){delete _0x29960c[_0x577a('0x5c')]['id'];}return db[_0x577a('0x3d')][_0x577a('0x5a')]({'where':{'id':_0x29960c['params']['id']}})['then'](handleEntityNotFound(_0x2e3a03,null))[_0x577a('0x22')](saveUpdates(_0x29960c['body'],null))[_0x577a('0x22')](respondWithResult(_0x2e3a03,null))[_0x577a('0x2d')](handleError(_0x2e3a03,null));};exports['destroy']=function(_0x4e8f61,_0x563296){return db[_0x577a('0x3d')][_0x577a('0x5a')]({'where':{'id':_0x4e8f61[_0x577a('0x5d')]['id']}})[_0x577a('0x22')](handleEntityNotFound(_0x563296,null))[_0x577a('0x22')](removeEntity(_0x563296,null))[_0x577a('0x2d')](handleError(_0x563296,null));};exports[_0x577a('0x5e')]=function(_0x1cd278,_0x3c0db0){return db['OpenchannelMessage']['describe']()['then'](respondWithResult(_0x3c0db0,null))['catch'](handleError(_0x3c0db0,null));};var interaction_log=require(_0x577a('0x14'))(_0x577a('0x5f'));exports[_0x577a('0x60')]=function(_0x54bbdf,_0x2647f7,_0x81917d){var _0x5b0327={'agent':{},'channel':_0x577a('0x61')};if(_0x54bbdf[_0x577a('0x5c')]['id']){delete _0x54bbdf[_0x577a('0x5c')]['id'];}_0x54bbdf[_0x577a('0x5c')]['read']=!![];_0x54bbdf[_0x577a('0x5c')][_0x577a('0x62')]=moment()[_0x577a('0x63')](_0x577a('0x64'));_0x54bbdf[_0x577a('0x5c')][_0x577a('0x65')]=_0x54bbdf[_0x577a('0x5c')][_0x577a('0x65')]||_0x54bbdf['user']['id'];_0x5b0327[_0x577a('0x66')]['id']=_0x54bbdf[_0x577a('0x5c')][_0x577a('0x65')];return db['OpenchannelMessage'][_0x577a('0x5a')]({'where':{'id':_0x54bbdf[_0x577a('0x5d')]['id'],'UserId':null}})[_0x577a('0x22')](handleEntityNotFound(_0x2647f7,null))[_0x577a('0x22')](saveUpdates(_0x54bbdf[_0x577a('0x5c')],null))[_0x577a('0x22')](function(_0x126750){if(_0x126750){_0x5b0327['message']=_0x126750[_0x577a('0x67')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x126750['OpenchannelInteractionId']}});}return null;})[_0x577a('0x22')](handleEntityNotFound(_0x2647f7,null))['then'](function(_0xfe3cb2){if(_0xfe3cb2){return _0xfe3cb2['update']({'UserId':_0x54bbdf['body'][_0x577a('0x65')],'read1stAt':_[_0x577a('0x68')](_0xfe3cb2[_0x577a('0x69')])?moment()[_0x577a('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1749c4){if(_0x1749c4){_0x5b0327[_0x577a('0x6a')]=_0x1749c4[_0x577a('0x67')]({'plain':!![]});interaction_log[_0x577a('0x23')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x54bbdf[_0x577a('0x6b')]['id'],_0x54bbdf[_0x577a('0x6b')]['name'],_0x54bbdf['user'][_0x577a('0x6c')],_0x5b0327[_0x577a('0x6a')]['id'],_0x54bbdf[_0x577a('0x5c')]?JSON[_0x577a('0x28')](_0x54bbdf[_0x577a('0x5c')]):'null');return respondWithRpcPromise(_0x577a('0x6d'),_0x577a('0x6e'),_0x5b0327);}return null;})['then'](function(_0x51203c){var _0x4542ce=_0x577a('0x6f')+_0x51203c['message'][_0x577a('0x70')];return db[_0x577a('0x71')][_0x577a('0x42')](_0x4542ce,{'type':db[_0x577a('0x72')][_0x577a('0x73')][_0x577a('0x74')],'raw':!![]})[_0x577a('0x22')](function(_0x33c75d){return _0x33c75d;});})['then'](function(_0x849117){if(_0x849117){_0x5b0327['message'][_0x577a('0x75')]=_0x849117[0x0];if(!_0x54bbdf[_0x577a('0x5c')]['UserId'])return;return db[_0x577a('0x76')][_0x577a('0x5a')]({'where':{'id':_0x54bbdf[_0x577a('0x5c')][_0x577a('0x65')],'role':_0x577a('0x66')},'attributes':['id',_0x577a('0x51'),_0x577a('0x77'),_0x577a('0x78'),_0x577a('0x79')],'raw':!![]});}return null;})[_0x577a('0x22')](function(_0x178139){if(!_0x178139)return null;_0x5b0327[_0x577a('0x2b')][_0x577a('0x66')]=_0x178139;return _0x5b0327;})[_0x577a('0x22')](function(_0x4f4a88){if(_0x4f4a88){if(_0x54bbdf[_0x577a('0x5c')][_0x577a('0x7a')]){_0x5b0327['message'][_0x577a('0x7b')]=util[_0x577a('0x63')](_0x577a('0x7c'),_0x54bbdf[_0x577a('0x6b')][_0x577a('0x51')]);_0x5b0327['message']['channel']=_0x5b0327[_0x577a('0x7d')];_0x5b0327[_0x577a('0x2b')][_0x577a('0x7e')]=_0x5b0327[_0x577a('0x7d')];_0x5b0327[_0x577a('0x2b')][_0x577a('0x7f')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0x577a('0x80'),'message':_0x5b0327['message']},client9002)[_0x577a('0x22')](function(){return _0x5b0327;});}return _0x5b0327;}return null;})['then'](respondWithResult(_0x2647f7,null))['catch'](handleError(_0x2647f7,null));};var interaction_log=require(_0x577a('0x14'))(_0x577a('0x5f'));exports[_0x577a('0x35')]=function(_0x23ffd4,_0x122085,_0x24d8f7){var _0x378b8f={'agent':{},'channel':_0x577a('0x61')};if(_0x23ffd4[_0x577a('0x5c')]['id']){delete _0x23ffd4[_0x577a('0x5c')]['id'];}_0x23ffd4['body']['UserId']=_0x23ffd4[_0x577a('0x5c')][_0x577a('0x65')]||_0x23ffd4[_0x577a('0x6b')]['id'];_0x378b8f[_0x577a('0x66')]['id']=_0x23ffd4['body']['UserId'];return db['OpenchannelMessage'][_0x577a('0x5a')]({'where':{'id':_0x23ffd4['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x122085,null))[_0x577a('0x22')](function(_0x4502ad){if(_0x4502ad){_0x378b8f[_0x577a('0x2b')]=_0x4502ad[_0x577a('0x67')]({'plain':!![]});return db[_0x577a('0x81')][_0x577a('0x5a')]({'where':{'id':_0x4502ad[_0x577a('0x82')]}});}return null;})[_0x577a('0x22')](handleEntityNotFound(_0x122085,null))['then'](function(_0x2b5ac3){if(_0x2b5ac3){_0x378b8f['interaction']=_0x2b5ac3[_0x577a('0x67')]({'plain':!![]});interaction_log[_0x577a('0x23')](_0x577a('0x83'),_0x23ffd4['user']['id'],_0x23ffd4[_0x577a('0x6b')][_0x577a('0x51')],_0x23ffd4[_0x577a('0x6b')][_0x577a('0x6c')],_0x378b8f[_0x577a('0x6a')]['id'],_0x23ffd4[_0x577a('0x5c')]?JSON[_0x577a('0x28')](_0x23ffd4[_0x577a('0x5c')]):_0x577a('0x84'));return respondWithRpcPromise('RejectMessage',_0x577a('0x85'),_0x378b8f);}return null;})[_0x577a('0x22')](function(_0x4a46ec){var _0x623337=_0x577a('0x6f')+_0x4a46ec[_0x577a('0x2b')][_0x577a('0x70')];return db[_0x577a('0x71')][_0x577a('0x42')](_0x623337,{'type':db[_0x577a('0x72')][_0x577a('0x73')]['SELECT'],'raw':!![]})[_0x577a('0x22')](function(_0x5d71c3){return _0x5d71c3;});})[_0x577a('0x22')](function(_0x10fa09){if(_0x10fa09){_0x378b8f[_0x577a('0x2b')][_0x577a('0x75')]=_0x10fa09[0x0];if(!_0x23ffd4[_0x577a('0x5c')][_0x577a('0x65')])return;return db['User'][_0x577a('0x5a')]({'where':{'id':_0x23ffd4[_0x577a('0x5c')]['UserId'],'role':_0x577a('0x66')},'attributes':['id',_0x577a('0x51'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x577a('0x22')](function(_0x2556eb){if(!_0x2556eb)return null;_0x378b8f[_0x577a('0x2b')][_0x577a('0x66')]=_0x2556eb;return _0x378b8f;})[_0x577a('0x22')](function(_0x389181){if(_0x389181){_0x389181[_0x577a('0x2b')][_0x577a('0x7b')]=util[_0x577a('0x63')](_0x577a('0x7c'),_0x23ffd4[_0x577a('0x6b')][_0x577a('0x51')]);_0x389181['message'][_0x577a('0x7d')]=_0x378b8f[_0x577a('0x7d')];_0x389181[_0x577a('0x2b')]['motionChannel']=_0x378b8f[_0x577a('0x7d')];_0x389181['message'][_0x577a('0x7f')]=_0x577a('0x35');respondWithRpcPromise('EventManager',_0x577a('0x86'),{'event':_0x577a('0x87'),'message':_0x389181[_0x577a('0x2b')]},client9002);return _0x378b8f;}return null;})[_0x577a('0x22')](respondWithResult(_0x122085,null))[_0x577a('0x2d')](handleError(_0x122085,null));}; \ No newline at end of file +var _0x1059=['sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','save','update','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','OpenchannelMessage','includeAll','rows','params','create','body','find','destroy','describe','../../config/logger','openchannel-interactions','accept','openchannel','format','UserId','user','agent','get','OpenchannelInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','Sequelize','SELECT','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1059,0x176));var _0x9105=function(_0x50daa4,_0x3c336d){_0x50daa4=_0x50daa4-0x0;var _0x389935=_0x1059[_0x50daa4];return _0x389935;};'use strict';var emlformat=require(_0x9105('0x0'));var rimraf=require(_0x9105('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9105('0x2'));var rp=require(_0x9105('0x3'));var moment=require(_0x9105('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9105('0x5'));var util=require('util');var path=require(_0x9105('0x6'));var sox=require(_0x9105('0x7'));var csv=require('to-csv');var ejs=require(_0x9105('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9105('0x9'));var squel=require(_0x9105('0xa'));var crypto=require(_0x9105('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9105('0xc'));var toCsv=require(_0x9105('0xd'));var querystring=require(_0x9105('0xe'));var Papa=require(_0x9105('0xf'));var Redis=require('ioredis');var authService=require(_0x9105('0x10'));var qs=require(_0x9105('0x11'));var as=require(_0x9105('0x12'));var hardwareService=require(_0x9105('0x13'));var logger=require('../../config/logger')(_0x9105('0x14'));var utils=require('../../config/utils');var config=require(_0x9105('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9105('0x16')]=_[_0x9105('0x17')](config[_0x9105('0x16')],{'host':_0x9105('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9105('0x16')]));require('./openchannelMessage.socket')[_0x9105('0x19')](socket);var jayson=require(_0x9105('0x1a'));var client=jayson[_0x9105('0x1b')]['http']({'port':0x232c});var client9002=jayson['client'][_0x9105('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x7e4a1c,_0x3933d5,_0x40d98,_0x1a01dd){return new BPromise(function(_0x3a1324,_0xd91e57){var _0x13d241=_0x1a01dd||client;return _0x13d241[_0x9105('0x1d')](_0x7e4a1c,_0x40d98)[_0x9105('0x1e')](function(_0x17e769){logger[_0x9105('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x3933d5,'request\x20sent');logger[_0x9105('0x20')](_0x9105('0x21'),_0x3933d5,_0x9105('0x22'),JSON[_0x9105('0x23')](_0x17e769));if(_0x17e769['error']){if(_0x17e769[_0x9105('0x24')][_0x9105('0x25')]===0x1f4){logger['error'](_0x9105('0x26'),_0x3933d5,_0x17e769[_0x9105('0x24')][_0x9105('0x27')]);return _0xd91e57(_0x17e769[_0x9105('0x24')][_0x9105('0x27')]);}logger[_0x9105('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x3933d5,_0x17e769[_0x9105('0x24')][_0x9105('0x27')]);return _0x3a1324(_0x17e769[_0x9105('0x24')][_0x9105('0x27')]);}else{logger[_0x9105('0x1f')](_0x9105('0x26'),_0x3933d5,_0x9105('0x22'));_0x3a1324(_0x17e769[_0x9105('0x28')][_0x9105('0x27')]);}})[_0x9105('0x29')](function(_0x2d83e2){logger['error'](_0x9105('0x26'),_0x3933d5,_0x2d83e2);_0xd91e57(_0x2d83e2);});});}function respondWithStatusCode(_0x474069,_0x2cc932){_0x2cc932=_0x2cc932||0xcc;return function(_0x46d46c){if(_0x46d46c){return _0x474069[_0x9105('0x2a')](_0x2cc932);}return _0x474069[_0x9105('0x2b')](_0x2cc932)['end']();};}function respondWithResult(_0x3cc40f,_0x1340ba){_0x1340ba=_0x1340ba||0xc8;return function(_0x21ced3){if(_0x21ced3){return _0x3cc40f['status'](_0x1340ba)[_0x9105('0x2c')](_0x21ced3);}};}function respondWithFilteredResult(_0x148045,_0xb7e049){return function(_0x51e31f){if(_0x51e31f){var _0x3d22b2=typeof _0xb7e049[_0x9105('0x2d')]===_0x9105('0x2e')&&typeof _0xb7e049['limit']==='undefined';var _0x13fe5d=_0x51e31f[_0x9105('0x2f')];var _0x271501=_0x3d22b2?0x0:_0xb7e049['offset'];var _0x310434=_0x3d22b2?_0x51e31f[_0x9105('0x2f')]:_0xb7e049['offset']+_0xb7e049[_0x9105('0x30')];var _0x10ce21;if(_0x310434>=_0x13fe5d){_0x310434=_0x13fe5d;_0x10ce21=0xc8;}else{_0x10ce21=0xce;}_0x148045[_0x9105('0x2b')](_0x10ce21);return _0x148045['set']('Content-Range',_0x271501+'-'+_0x310434+'/'+_0x13fe5d)['json'](_0x51e31f);}return null;};}function patchUpdates(_0x5110d7){return function(_0x121d54){try{jsonpatch['apply'](_0x121d54,_0x5110d7,!![]);}catch(_0x3a49ba){return BPromise['reject'](_0x3a49ba);}return _0x121d54[_0x9105('0x31')]();};}function saveUpdates(_0x2f9fa6,_0xda0880){return function(_0x182078){if(_0x182078){return _0x182078[_0x9105('0x32')](_0x2f9fa6)['then'](function(_0x20043a){return _0x20043a;});}return null;};}function removeEntity(_0xcbd370,_0x458825){return function(_0x4c9b92){if(_0x4c9b92){return _0x4c9b92['destroy']()[_0x9105('0x1e')](function(){_0xcbd370[_0x9105('0x2b')](0xcc)[_0x9105('0x33')]();});}};}function handleEntityNotFound(_0x1e6aa9,_0x4880c9){return function(_0x13231d){if(!_0x13231d){_0x1e6aa9[_0x9105('0x2a')](0x194);}return _0x13231d;};}function handleError(_0xbcb439,_0x2bd198){_0x2bd198=_0x2bd198||0x1f4;return function(_0x1e65da){logger[_0x9105('0x24')](_0x1e65da[_0x9105('0x34')]);if(_0x1e65da[_0x9105('0x35')]){delete _0x1e65da['name'];}_0xbcb439[_0x9105('0x2b')](_0x2bd198)[_0x9105('0x36')](_0x1e65da);};}exports[_0x9105('0x37')]=function(_0x55c334,_0x35f3af){var _0x358d44={},_0x324986={},_0x374dd9={'count':0x0,'rows':[]};var _0x208d43=_[_0x9105('0x38')](db['OpenchannelMessage'][_0x9105('0x39')],function(_0x120ccc){return{'name':_0x120ccc[_0x9105('0x3a')],'type':_0x120ccc[_0x9105('0x3b')]['key']};});_0x324986[_0x9105('0x3c')]=_[_0x9105('0x38')](_0x208d43,'name');_0x324986[_0x9105('0x3d')]=_[_0x9105('0x3e')](_0x55c334[_0x9105('0x3d')]);_0x324986[_0x9105('0x3f')]=_[_0x9105('0x40')](_0x324986[_0x9105('0x3c')],_0x324986[_0x9105('0x3d')]);_0x358d44[_0x9105('0x41')]=_['intersection'](_0x324986[_0x9105('0x3c')],qs[_0x9105('0x42')](_0x55c334[_0x9105('0x3d')][_0x9105('0x42')]));_0x358d44['attributes']=_0x358d44['attributes']['length']?_0x358d44[_0x9105('0x41')]:_0x324986['model'];if(!_0x55c334[_0x9105('0x3d')][_0x9105('0x43')](_0x9105('0x44'))){_0x358d44['limit']=qs[_0x9105('0x30')](_0x55c334[_0x9105('0x3d')][_0x9105('0x30')]);_0x358d44[_0x9105('0x2d')]=qs[_0x9105('0x2d')](_0x55c334[_0x9105('0x3d')][_0x9105('0x2d')]);}_0x358d44[_0x9105('0x45')]=qs[_0x9105('0x46')](_0x55c334[_0x9105('0x3d')][_0x9105('0x46')]);_0x358d44[_0x9105('0x47')]=qs['filters'](_[_0x9105('0x48')](_0x55c334[_0x9105('0x3d')],_0x324986[_0x9105('0x3f')]),_0x208d43);if(_0x55c334[_0x9105('0x3d')][_0x9105('0x49')]){_0x358d44['where']=_['merge'](_0x358d44[_0x9105('0x47')],{'$or':_[_0x9105('0x38')](_0x208d43,function(_0x2f467b){if(_0x2f467b[_0x9105('0x3b')]!==_0x9105('0x4a')){var _0x52aa56={};_0x52aa56[_0x2f467b['name']]={'$like':'%'+_0x55c334[_0x9105('0x3d')][_0x9105('0x49')]+'%'};return _0x52aa56;}})});}_0x358d44=_[_0x9105('0x4b')]({},_0x358d44,_0x55c334[_0x9105('0x4c')]);var _0x4618d7={'where':_0x358d44[_0x9105('0x47')]};return db[_0x9105('0x4d')][_0x9105('0x2f')](_0x4618d7)[_0x9105('0x1e')](function(_0xa40b94){_0x374dd9[_0x9105('0x2f')]=_0xa40b94;if(_0x55c334[_0x9105('0x3d')][_0x9105('0x4e')]){_0x358d44['include']=[{'all':!![]}];}return db[_0x9105('0x4d')]['findAll'](_0x358d44);})[_0x9105('0x1e')](function(_0x5afe48){_0x374dd9[_0x9105('0x4f')]=_0x5afe48;return _0x374dd9;})[_0x9105('0x1e')](respondWithFilteredResult(_0x35f3af,_0x358d44))[_0x9105('0x29')](handleError(_0x35f3af,null));};exports['show']=function(_0x790a2a,_0x287711){var _0x56f2a3={'raw':!![],'where':{'id':_0x790a2a[_0x9105('0x50')]['id']}},_0x1f96a2={};_0x1f96a2[_0x9105('0x3c')]=_[_0x9105('0x3e')](db[_0x9105('0x4d')][_0x9105('0x39')]);_0x1f96a2['query']=_[_0x9105('0x3e')](_0x790a2a[_0x9105('0x3d')]);_0x1f96a2[_0x9105('0x3f')]=_[_0x9105('0x40')](_0x1f96a2[_0x9105('0x3c')],_0x1f96a2[_0x9105('0x3d')]);_0x56f2a3['attributes']=_[_0x9105('0x40')](_0x1f96a2[_0x9105('0x3c')],qs[_0x9105('0x42')](_0x790a2a['query'][_0x9105('0x42')]));_0x56f2a3['attributes']=_0x56f2a3[_0x9105('0x41')]['length']?_0x56f2a3[_0x9105('0x41')]:_0x1f96a2[_0x9105('0x3c')];if(_0x790a2a[_0x9105('0x3d')][_0x9105('0x4e')]){_0x56f2a3['include']=[{'all':!![]}];}_0x56f2a3=_[_0x9105('0x4b')]({},_0x56f2a3,_0x790a2a[_0x9105('0x4c')]);return db[_0x9105('0x4d')]['find'](_0x56f2a3)[_0x9105('0x1e')](handleEntityNotFound(_0x287711,null))[_0x9105('0x1e')](respondWithResult(_0x287711,null))['catch'](handleError(_0x287711,null));};exports[_0x9105('0x51')]=function(_0x4f4655,_0x2107b7){return db['OpenchannelMessage'][_0x9105('0x51')](_0x4f4655[_0x9105('0x52')],{})[_0x9105('0x1e')](respondWithResult(_0x2107b7,0xc9))[_0x9105('0x29')](handleError(_0x2107b7,null));};exports[_0x9105('0x32')]=function(_0x1a7aa0,_0x323f5c){if(_0x1a7aa0['body']['id']){delete _0x1a7aa0[_0x9105('0x52')]['id'];}return db['OpenchannelMessage'][_0x9105('0x53')]({'where':{'id':_0x1a7aa0[_0x9105('0x50')]['id']}})[_0x9105('0x1e')](handleEntityNotFound(_0x323f5c,null))[_0x9105('0x1e')](saveUpdates(_0x1a7aa0[_0x9105('0x52')],null))[_0x9105('0x1e')](respondWithResult(_0x323f5c,null))['catch'](handleError(_0x323f5c,null));};exports[_0x9105('0x54')]=function(_0x215e8b,_0x520ce5){return db[_0x9105('0x4d')][_0x9105('0x53')]({'where':{'id':_0x215e8b[_0x9105('0x50')]['id']}})[_0x9105('0x1e')](handleEntityNotFound(_0x520ce5,null))[_0x9105('0x1e')](removeEntity(_0x520ce5,null))[_0x9105('0x29')](handleError(_0x520ce5,null));};exports[_0x9105('0x55')]=function(_0x5e2735,_0xd4e012){return db['OpenchannelMessage'][_0x9105('0x55')]()['then'](respondWithResult(_0xd4e012,null))[_0x9105('0x29')](handleError(_0xd4e012,null));};var interaction_log=require(_0x9105('0x56'))(_0x9105('0x57'));exports[_0x9105('0x58')]=function(_0x51134d,_0x31ce53,_0x539cf0){var _0x4a719e={'agent':{},'channel':_0x9105('0x59')};if(_0x51134d[_0x9105('0x52')]['id']){delete _0x51134d[_0x9105('0x52')]['id'];}_0x51134d[_0x9105('0x52')]['read']=!![];_0x51134d[_0x9105('0x52')]['readAt']=moment()[_0x9105('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x51134d['body']['UserId']=_0x51134d['body'][_0x9105('0x5b')]||_0x51134d[_0x9105('0x5c')]['id'];_0x4a719e[_0x9105('0x5d')]['id']=_0x51134d[_0x9105('0x52')]['UserId'];return db[_0x9105('0x4d')][_0x9105('0x53')]({'where':{'id':_0x51134d[_0x9105('0x50')]['id'],'UserId':null}})[_0x9105('0x1e')](handleEntityNotFound(_0x31ce53,null))[_0x9105('0x1e')](saveUpdates(_0x51134d[_0x9105('0x52')],null))[_0x9105('0x1e')](function(_0x1fd1a5){if(_0x1fd1a5){_0x4a719e[_0x9105('0x27')]=_0x1fd1a5[_0x9105('0x5e')]({'plain':!![]});return db['OpenchannelInteraction'][_0x9105('0x53')]({'where':{'id':_0x1fd1a5[_0x9105('0x5f')]}});}return null;})[_0x9105('0x1e')](handleEntityNotFound(_0x31ce53,null))[_0x9105('0x1e')](function(_0x1a8187){if(_0x1a8187){return _0x1a8187['update']({'UserId':_0x51134d[_0x9105('0x52')][_0x9105('0x5b')],'read1stAt':_['isNil'](_0x1a8187[_0x9105('0x60')])?moment()[_0x9105('0x5a')](_0x9105('0x61')):undefined});}return null;})['then'](function(_0x2c428d){if(_0x2c428d){_0x4a719e[_0x9105('0x62')]=_0x2c428d[_0x9105('0x5e')]({'plain':!![]});interaction_log['info'](_0x9105('0x63'),_0x51134d[_0x9105('0x5c')]['id'],_0x51134d[_0x9105('0x5c')]['name'],_0x51134d['user'][_0x9105('0x64')],_0x4a719e['interaction']['id'],_0x51134d[_0x9105('0x52')]?JSON[_0x9105('0x23')](_0x51134d[_0x9105('0x52')]):_0x9105('0x65'));return respondWithRpcPromise(_0x9105('0x66'),_0x9105('0x67'),_0x4a719e);}return null;})[_0x9105('0x1e')](function(_0x4ae2ab){var _0x253f5b=_0x9105('0x68')+_0x4ae2ab[_0x9105('0x27')][_0x9105('0x69')];return db[_0x9105('0x6a')]['query'](_0x253f5b,{'type':db['Sequelize'][_0x9105('0x6b')]['SELECT'],'raw':!![]})[_0x9105('0x1e')](function(_0x15592a){return _0x15592a;});})[_0x9105('0x1e')](function(_0x31f894){if(_0x31f894){_0x4a719e[_0x9105('0x27')][_0x9105('0x6c')]=_0x31f894[0x0];if(!_0x51134d['body'][_0x9105('0x5b')])return;return db[_0x9105('0x6d')][_0x9105('0x53')]({'where':{'id':_0x51134d[_0x9105('0x52')][_0x9105('0x5b')],'role':_0x9105('0x5d')},'attributes':['id',_0x9105('0x35'),'fullname',_0x9105('0x6e'),_0x9105('0x6f')],'raw':!![]});}return null;})[_0x9105('0x1e')](function(_0x8d270e){if(!_0x8d270e)return null;_0x4a719e[_0x9105('0x27')][_0x9105('0x5d')]=_0x8d270e;return _0x4a719e;})[_0x9105('0x1e')](function(_0x2be5b9){if(_0x2be5b9){if(_0x51134d['body'][_0x9105('0x70')]){_0x4a719e[_0x9105('0x27')][_0x9105('0x71')]=util[_0x9105('0x5a')](_0x9105('0x72'),_0x51134d[_0x9105('0x5c')][_0x9105('0x35')]);_0x4a719e[_0x9105('0x27')][_0x9105('0x73')]=_0x4a719e[_0x9105('0x73')];_0x4a719e['message'][_0x9105('0x74')]=_0x4a719e[_0x9105('0x73')];_0x4a719e[_0x9105('0x27')][_0x9105('0x75')]=_0x9105('0x58');return respondWithRpcPromise('EventManager',_0x9105('0x76'),{'event':_0x9105('0x77'),'message':_0x4a719e['message']},client9002)[_0x9105('0x1e')](function(){return _0x4a719e;});}return _0x4a719e;}return null;})['then'](respondWithResult(_0x31ce53,null))[_0x9105('0x29')](handleError(_0x31ce53,null));};var interaction_log=require(_0x9105('0x56'))(_0x9105('0x57'));exports[_0x9105('0x78')]=function(_0x3e11e2,_0x1d7cc0,_0xa80beb){var _0x183249={'agent':{},'channel':_0x9105('0x59')};if(_0x3e11e2[_0x9105('0x52')]['id']){delete _0x3e11e2[_0x9105('0x52')]['id'];}_0x3e11e2[_0x9105('0x52')][_0x9105('0x5b')]=_0x3e11e2[_0x9105('0x52')][_0x9105('0x5b')]||_0x3e11e2[_0x9105('0x5c')]['id'];_0x183249[_0x9105('0x5d')]['id']=_0x3e11e2['body'][_0x9105('0x5b')];return db[_0x9105('0x4d')][_0x9105('0x53')]({'where':{'id':_0x3e11e2['params']['id'],'UserId':null}})[_0x9105('0x1e')](handleEntityNotFound(_0x1d7cc0,null))[_0x9105('0x1e')](function(_0x210f28){if(_0x210f28){_0x183249[_0x9105('0x27')]=_0x210f28['get']({'plain':!![]});return db[_0x9105('0x79')]['find']({'where':{'id':_0x210f28[_0x9105('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x1d7cc0,null))['then'](function(_0x7c16a5){if(_0x7c16a5){_0x183249[_0x9105('0x62')]=_0x7c16a5['get']({'plain':!![]});interaction_log['info'](_0x9105('0x7a'),_0x3e11e2[_0x9105('0x5c')]['id'],_0x3e11e2[_0x9105('0x5c')][_0x9105('0x35')],_0x3e11e2[_0x9105('0x5c')][_0x9105('0x64')],_0x183249[_0x9105('0x62')]['id'],_0x3e11e2[_0x9105('0x52')]?JSON[_0x9105('0x23')](_0x3e11e2['body']):_0x9105('0x65'));return respondWithRpcPromise('RejectMessage',_0x9105('0x7b'),_0x183249);}return null;})[_0x9105('0x1e')](function(_0x53c90d){var _0x19f6da=_0x9105('0x68')+_0x53c90d['message'][_0x9105('0x69')];return db[_0x9105('0x6a')][_0x9105('0x3d')](_0x19f6da,{'type':db[_0x9105('0x7c')][_0x9105('0x6b')][_0x9105('0x7d')],'raw':!![]})[_0x9105('0x1e')](function(_0x5a2cfd){return _0x5a2cfd;});})[_0x9105('0x1e')](function(_0x5713cf){if(_0x5713cf){_0x183249['message'][_0x9105('0x6c')]=_0x5713cf[0x0];if(!_0x3e11e2[_0x9105('0x52')][_0x9105('0x5b')])return;return db['User'][_0x9105('0x53')]({'where':{'id':_0x3e11e2[_0x9105('0x52')][_0x9105('0x5b')],'role':'agent'},'attributes':['id','name','fullname','email','internal'],'raw':!![]});}return null;})[_0x9105('0x1e')](function(_0x1c8c77){if(!_0x1c8c77)return null;_0x183249[_0x9105('0x27')][_0x9105('0x5d')]=_0x1c8c77;return _0x183249;})[_0x9105('0x1e')](function(_0x5e1ddd){if(_0x5e1ddd){_0x5e1ddd[_0x9105('0x27')][_0x9105('0x71')]=util[_0x9105('0x5a')](_0x9105('0x72'),_0x3e11e2['user'][_0x9105('0x35')]);_0x5e1ddd[_0x9105('0x27')][_0x9105('0x73')]=_0x183249[_0x9105('0x73')];_0x5e1ddd['message']['motionChannel']=_0x183249[_0x9105('0x73')];_0x5e1ddd[_0x9105('0x27')]['event']=_0x9105('0x78');respondWithRpcPromise(_0x9105('0x76'),_0x9105('0x76'),{'event':_0x9105('0x7e'),'message':_0x5e1ddd[_0x9105('0x27')]},client9002);return _0x183249;}return null;})[_0x9105('0x1e')](respondWithResult(_0x1d7cc0,null))[_0x9105('0x29')](handleError(_0x1d7cc0,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 050b328..5f66741 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 _0x9b8a=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','OpenchannelMessage'];(function(_0x2b55b5,_0x78505e){var _0x103d28=function(_0x5095a2){while(--_0x5095a2){_0x2b55b5['push'](_0x2b55b5['shift']());}};_0x103d28(++_0x78505e);}(_0x9b8a,0x68));var _0xa9b8=function(_0xcd2975,_0x27d718){_0xcd2975=_0xcd2975-0x0;var _0x284074=_0x9b8a[_0xcd2975];return _0x284074;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0xa9b8('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa9b8('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa9b8('0x2'),'afterDestroy':_0xa9b8('0x3')};function emitEvent(_0x25226c){return function(_0x41d259,_0x298850,_0x1d9ff3){OpenchannelMessageEvents[_0xa9b8('0x4')](_0x25226c+':'+_0x41d259['id'],_0x41d259);OpenchannelMessageEvents[_0xa9b8('0x4')](_0x25226c,_0x41d259);_0x1d9ff3(null);};}for(var e in events){if(events[_0xa9b8('0x5')](e)){var event=events[e];OpenchannelMessage[_0xa9b8('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xc838=['emit','hook','exports','../../mysqldb','OpenchannelMessage','save','update'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xc838,0x81));var _0x8c83=function(_0x2e8edf,_0x39fd67){_0x2e8edf=_0x2e8edf-0x0;var _0x2210ab=_0xc838[_0x2e8edf];return _0x2210ab;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x8c83('0x0'))['db'][_0x8c83('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8c83('0x2'),'afterUpdate':_0x8c83('0x3'),'afterDestroy':'remove'};function emitEvent(_0x40a615){return function(_0x234903,_0xc33330,_0x50658c){OpenchannelMessageEvents[_0x8c83('0x4')](_0x40a615+':'+_0x234903['id'],_0x234903);OpenchannelMessageEvents[_0x8c83('0x4')](_0x40a615,_0x234903);_0x50658c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x8c83('0x5')](e,emitEvent(event));}}module[_0x8c83('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 0d70348..6dbcc23 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 _0xefda=['request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','omit','POST','method','GET','format','threadId','inspect','finally','utf8mb4','lodash','api','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xefda,0x96));var _0xaefd=function(_0x27ba9b,_0x570bb6){_0x27ba9b=_0x27ba9b-0x0;var _0x32b62c=_0xefda[_0x27ba9b];return _0x32b62c;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xaefd('0xc')],'type':_0xaefd('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x463ce7,_0x4d44ed,_0x48a255){var _0x54a3b1=_0x497258[_0xaefd('0xe')];var _0x16b36e=_0x463ce7[_0xaefd('0xf')]({'plain':!![]});if(_0x16b36e[_0xaefd('0x10')][_0xaefd('0x11')]()==='in'||_0x16b36e[_0xaefd('0x10')][_0xaefd('0x11')]()===_0xaefd('0x12')&&!_0x16b36e[_0xaefd('0x13')]&&!_[_0xaefd('0x14')](_0x16b36e[_0xaefd('0x15')])){_0x54a3b1['OpenchannelInteraction'][_0xaefd('0x16')]({'where':{'id':_0x16b36e['OpenchannelInteractionId']}})[_0xaefd('0x17')](function(_0x1725af){if(_0x1725af){_0x1725af[_0xaefd('0x18')]({'lastMsgAt':_0x16b36e[_0xaefd('0x19')],'lastMsgDirection':_0x16b36e['direction'][_0xaefd('0x11')]()});}})[_0xaefd('0x1a')](function(_0x41f345){console[_0xaefd('0x1b')](_0x41f345);});}if(_0x16b36e[_0xaefd('0x10')]===_0xaefd('0x12')&&!_0x16b36e[_0xaefd('0x13')]){var _0x23d736;_0x54a3b1['CmContact'][_0xaefd('0x1c')]()[_0xaefd('0x17')](function(_0x9748f4){return _0x54a3b1[_0xaefd('0x1d')][_0xaefd('0x1e')]({'where':{'id':_0x16b36e[_0xaefd('0x1f')]},'include':[{'model':_0x54a3b1['OpenchannelInteraction'],'as':_0xaefd('0x20'),'where':{'id':_0x16b36e[_0xaefd('0x21')]},'limit':0x1,'include':[{'model':_0x54a3b1[_0xaefd('0x22')],'as':_0xaefd('0x23'),'attributes':_[_0xaefd('0x24')](_0x9748f4)}]}]});})[_0xaefd('0x17')](function(_0x5282ed){_0x23d736=_0x5282ed[_0xaefd('0xf')]({'plain':!![]});if(_0x23d736&&_0x23d736[_0xaefd('0x25')]){logger[_0xaefd('0x26')](_0xaefd('0x27'),_0xaefd('0x28'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x16b36e['id'],_0x23d736['replyUri']));if(_0x23d736[_0xaefd('0x20')]&&_0x23d736[_0xaefd('0x20')][_0xaefd('0x29')]){_0x16b36e['Interaction']=_[_0xaefd('0x2a')](_0x23d736['Interactions'][0x0],_0xaefd('0x23'));_0x16b36e[_0xaefd('0x23')]=_0x23d736[_0xaefd('0x20')][0x0]['Contact'];}var _0x4d44ed={'method':_0xaefd('0x2b'),'uri':encodeURI(_0x23d736[_0xaefd('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4d44ed[_0xaefd('0x2c')]){case _0xaefd('0x2d'):_0x4d44ed['qs']=_0x16b36e;break;case'POST':_0x4d44ed[_0xaefd('0xc')]=_0x16b36e;break;}return rp(_0x4d44ed)['then'](function(_0x810bf){logger[_0xaefd('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0xaefd('0x28'),util[_0xaefd('0x2e')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x16b36e['id'],_0x23d736[_0xaefd('0x25')]));if(_0x810bf[_0xaefd('0xc')][_0xaefd('0x2f')]&&_0x810bf['body'][_0xaefd('0x2f')]!=_0x16b36e['Interaction'][_0xaefd('0x2f')]){return _0x54a3b1['OpenchannelInteraction']['update']({'threadId':_0x810bf[_0xaefd('0xc')][_0xaefd('0x2f')]},{'logging':!![],'where':{'id':_0x16b36e['Interaction']['id']}});}else{return;}})['then'](function(){return _0x463ce7['update']({'read':!![]});})[_0xaefd('0x1a')](function(_0x280eab){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xaefd('0x28'),util[_0xaefd('0x30')](_0x280eab,{'showHidden':![],'depth':null}));_0x48a255();});}else{_0x48a255();}})[_0xaefd('0x31')](function(){_0x48a255();});}else{_0x48a255();}}},'charset':_0xaefd('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1eba=['format','Interaction','omit','POST','replyUri','method','GET','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','toLowerCase','direction','secret','isNil','OpenchannelInteraction','then','update','createdAt','catch','error','out','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','OpenchannelInteractionId','CmContact','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate'];(function(_0x159e72,_0x1802f3){var _0x5301c2=function(_0x52a256){while(--_0x52a256){_0x159e72['push'](_0x159e72['shift']());}};_0x5301c2(++_0x1802f3);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0x1eba[_0x4a6cf8];return _0x22205e;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var logger=require(_0xa1eb('0x2'))(_0xa1eb('0x3'));var moment=require(_0xa1eb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1eb('0x5'));var rimraf=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var attributes=require(_0xa1eb('0x8'));module[_0xa1eb('0x9')]=function(_0x2933d0,_0x1d0d67){return _0x2933d0[_0xa1eb('0xa')](_0xa1eb('0xb'),attributes,{'tableName':_0xa1eb('0xc'),'paranoid':![],'indexes':[{'name':_0xa1eb('0xd'),'fields':[_0xa1eb('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ecd20,_0x4d4aaf,_0x219802){var _0x54cdad=_0x2933d0[_0xa1eb('0xf')];var _0x5d7101=_0x1ecd20[_0xa1eb('0x10')]({'plain':!![]});if(_0x5d7101['direction'][_0xa1eb('0x11')]()==='in'||_0x5d7101[_0xa1eb('0x12')][_0xa1eb('0x11')]()==='out'&&!_0x5d7101[_0xa1eb('0x13')]&&!_[_0xa1eb('0x14')](_0x5d7101['UserId'])){_0x54cdad[_0xa1eb('0x15')]['findOne']({'where':{'id':_0x5d7101['OpenchannelInteractionId']}})[_0xa1eb('0x16')](function(_0x4c7983){if(_0x4c7983){_0x4c7983[_0xa1eb('0x17')]({'lastMsgAt':_0x5d7101[_0xa1eb('0x18')],'lastMsgDirection':_0x5d7101[_0xa1eb('0x12')][_0xa1eb('0x11')]()});}})[_0xa1eb('0x19')](function(_0x44f37d){console[_0xa1eb('0x1a')](_0x44f37d);});}if(_0x5d7101[_0xa1eb('0x12')]===_0xa1eb('0x1b')&&!_0x5d7101['secret']){var _0xbd6a6b;_0x54cdad['CmContact'][_0xa1eb('0x1c')]()[_0xa1eb('0x16')](function(_0x33c4e3){return _0x54cdad[_0xa1eb('0x1d')]['find']({'where':{'id':_0x5d7101[_0xa1eb('0x1e')]},'include':[{'model':_0x54cdad[_0xa1eb('0x15')],'as':_0xa1eb('0x1f'),'where':{'id':_0x5d7101[_0xa1eb('0x20')]},'limit':0x1,'include':[{'model':_0x54cdad[_0xa1eb('0x21')],'as':_0xa1eb('0x22'),'attributes':_[_0xa1eb('0x23')](_0x33c4e3)}]}]});})[_0xa1eb('0x16')](function(_0x4fc14a){_0xbd6a6b=_0x4fc14a[_0xa1eb('0x10')]({'plain':!![]});if(_0xbd6a6b&&_0xbd6a6b['replyUri']){logger[_0xa1eb('0x24')](_0xa1eb('0x25'),_0xa1eb('0x26'),util[_0xa1eb('0x27')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x5d7101['id'],_0xbd6a6b['replyUri']));if(_0xbd6a6b[_0xa1eb('0x1f')]&&_0xbd6a6b[_0xa1eb('0x1f')]['length']){_0x5d7101[_0xa1eb('0x28')]=_[_0xa1eb('0x29')](_0xbd6a6b[_0xa1eb('0x1f')][0x0],_0xa1eb('0x22'));_0x5d7101[_0xa1eb('0x22')]=_0xbd6a6b[_0xa1eb('0x1f')][0x0][_0xa1eb('0x22')];}var _0x4d4aaf={'method':_0xa1eb('0x2a'),'uri':encodeURI(_0xbd6a6b[_0xa1eb('0x2b')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4d4aaf[_0xa1eb('0x2c')]){case _0xa1eb('0x2d'):_0x4d4aaf['qs']=_0x5d7101;break;case'POST':_0x4d4aaf[_0xa1eb('0xe')]=_0x5d7101;break;}return rp(_0x4d4aaf)[_0xa1eb('0x16')](function(_0x491f37){logger[_0xa1eb('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0xa1eb('0x26'),util[_0xa1eb('0x27')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x5d7101['id'],_0xbd6a6b[_0xa1eb('0x2b')]));if(_0x491f37[_0xa1eb('0xe')][_0xa1eb('0x2e')]&&_0x491f37['body'][_0xa1eb('0x2e')]!=_0x5d7101[_0xa1eb('0x28')]['threadId']){return _0x54cdad[_0xa1eb('0x15')][_0xa1eb('0x17')]({'threadId':_0x491f37[_0xa1eb('0xe')][_0xa1eb('0x2e')]},{'logging':!![],'where':{'id':_0x5d7101[_0xa1eb('0x28')]['id']}});}else{return;}})['then'](function(){return _0x1ecd20[_0xa1eb('0x17')]({'read':!![]});})[_0xa1eb('0x19')](function(_0x198fdb){logger[_0xa1eb('0x1a')](_0xa1eb('0x25'),_0xa1eb('0x26'),util[_0xa1eb('0x2f')](_0x198fdb,{'showHidden':![],'depth':null}));_0x219802();});}else{_0x219802();}})[_0xa1eb('0x30')](function(){_0x219802();});}else{_0x219802();}}},'charset':_0xa1eb('0x31'),'collate':_0xa1eb('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 7b368bd..12672af 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 _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x574a4d,_0x3de766){var _0x4a7445=function(_0x2fafeb){while(--_0x2fafeb){_0x574a4d['push'](_0x574a4d['shift']());}};_0x4a7445(++_0x3de766);}(_0x5f2f,0x73));var _0xf5f2=function(_0x125c3a,_0x2d86ca){_0x125c3a=_0x125c3a-0x0;var _0x5dec85=_0x5f2f[_0x125c3a];return _0x5dec85;};'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});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x12c70f,_0x5d76d0){var _0x2af74f=function(_0x288fbf){while(--_0x288fbf){_0x12c70f['push'](_0x12c70f['shift']());}};_0x2af74f(++_0x5d76d0);}(_0xadb5,0xad));var _0x5adb=function(_0x417eb0,_0xe5b7de){_0x417eb0=_0x417eb0-0x0;var _0x31a615=_0xadb5[_0x417eb0];return _0x31a615;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index e3324d9..c9e1499 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 _0x416d=['update','emit','removeListener','register','length','./openchannelMessage.events','save'];(function(_0x4d7bbe,_0x216928){var _0x53c370=function(_0x5206cf){while(--_0x5206cf){_0x4d7bbe['push'](_0x4d7bbe['shift']());}};_0x53c370(++_0x216928);}(_0x416d,0x1b7));var _0xd416=function(_0x3f29b4,_0x6fc359){_0x3f29b4=_0x3f29b4-0x0;var _0xec4178=_0x416d[_0x3f29b4];return _0xec4178;};'use strict';var OpenchannelMessageEvents=require(_0xd416('0x0'));var events=[_0xd416('0x1'),'remove',_0xd416('0x2')];function createListener(_0x327e00,_0x14f397){return function(_0x2cd039){_0x14f397[_0xd416('0x3')](_0x327e00,_0x2cd039);};}function removeListener(_0x39eff2,_0x3983c9){return function(){OpenchannelMessageEvents[_0xd416('0x4')](_0x39eff2,_0x3983c9);};}exports[_0xd416('0x5')]=function(_0x21dce9){for(var _0x4d8bd7=0x0,_0x49801a=events[_0xd416('0x6')];_0x4d8bd7<_0x49801a;_0x4d8bd7++){var _0x1b960e=events[_0x4d8bd7];var _0x387fb7=createListener('openchannelMessage:'+_0x1b960e,_0x21dce9);OpenchannelMessageEvents['on'](_0x1b960e,_0x387fb7);}}; \ No newline at end of file +var _0x27a8=['removeListener','register','length','openchannelMessage:','remove','update','emit'];(function(_0x33af67,_0x167365){var _0x22389f=function(_0x4377a1){while(--_0x4377a1){_0x33af67['push'](_0x33af67['shift']());}};_0x22389f(++_0x167365);}(_0x27a8,0x170));var _0x827a=function(_0x35d3fb,_0xdce370){_0x35d3fb=_0x35d3fb-0x0;var _0x4ae83a=_0x27a8[_0x35d3fb];return _0x4ae83a;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x827a('0x0'),_0x827a('0x1')];function createListener(_0x7dc5a2,_0xbd0964){return function(_0x252d74){_0xbd0964[_0x827a('0x2')](_0x7dc5a2,_0x252d74);};}function removeListener(_0x18cf5e,_0x215b35){return function(){OpenchannelMessageEvents[_0x827a('0x3')](_0x18cf5e,_0x215b35);};}exports[_0x827a('0x4')]=function(_0x19d10d){for(var _0x61767e=0x0,_0xa0df3c=events[_0x827a('0x5')];_0x61767e<_0xa0df3c;_0x61767e++){var _0x2e20da=events[_0x61767e];var _0x2bd7f3=createListener(_0x827a('0x6')+_0x2e20da,_0x19d10d);OpenchannelMessageEvents['on'](_0x2e20da,_0x2bd7f3);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 57e0b8d..2f46fca 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 _0x506b=['create','addAgents','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x506b,0x13d));var _0xb506=function(_0x3c8d6c,_0x51ae3a){_0x3c8d6c=_0x3c8d6c-0x0;var _0x146521=_0x506b[_0x3c8d6c];return _0x146521;};'use strict';var multer=require(_0xb506('0x0'));var util=require(_0xb506('0x1'));var path=require(_0xb506('0x2'));var timeout=require(_0xb506('0x3'));var express=require(_0xb506('0x4'));var router=express[_0xb506('0x5')]();var fs_extra=require(_0xb506('0x6'));var auth=require(_0xb506('0x7'));var interaction=require(_0xb506('0x8'));var config=require(_0xb506('0x9'));var controller=require(_0xb506('0xa'));router['get']('/',auth[_0xb506('0xb')](),controller[_0xb506('0xc')]);router['get'](_0xb506('0xd'),auth[_0xb506('0xb')](),controller[_0xb506('0xe')]);router[_0xb506('0xf')](_0xb506('0x10'),auth['isAuthenticated'](),controller[_0xb506('0x11')]);router[_0xb506('0xf')](_0xb506('0x12'),auth['isAuthenticated'](),controller['getMembers']);router[_0xb506('0xf')](_0xb506('0x13'),auth[_0xb506('0xb')](),controller[_0xb506('0x14')]);router['get'](_0xb506('0x15'),auth['isAuthenticated'](),controller[_0xb506('0x16')]);router[_0xb506('0x17')]('/',auth[_0xb506('0xb')](),controller[_0xb506('0x18')]);router['post']('/:id/teams',auth[_0xb506('0xb')](),controller['addTeams']);router[_0xb506('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xb506('0x19')]);router['put'](_0xb506('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xb506('0x1a')](_0xb506('0x10'),auth[_0xb506('0xb')](),controller[_0xb506('0x1b')]);router[_0xb506('0x1a')](_0xb506('0x13'),auth[_0xb506('0xb')](),controller[_0xb506('0x1c')]);router[_0xb506('0x1a')](_0xb506('0x15'),auth[_0xb506('0xb')](),controller[_0xb506('0x1d')]);module[_0xb506('0x1e')]=router; \ No newline at end of file +var _0xb36c=['/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','delete','destroy','removeAgents','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','isAuthenticated','get','describe'];(function(_0x2d8332,_0x567dff){var _0x2af285=function(_0x31d56e){while(--_0x31d56e){_0x2d8332['push'](_0x2d8332['shift']());}};_0x2af285(++_0x567dff);}(_0xb36c,0x1ab));var _0xcb36=function(_0x1cf27d,_0x474320){_0x1cf27d=_0x1cf27d-0x0;var _0x4251e5=_0xb36c[_0x1cf27d];return _0x4251e5;};'use strict';var multer=require(_0xcb36('0x0'));var util=require(_0xcb36('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcb36('0x2'));var router=express['Router']();var fs_extra=require(_0xcb36('0x3'));var auth=require(_0xcb36('0x4'));var interaction=require(_0xcb36('0x5'));var config=require('../../config/environment');var controller=require(_0xcb36('0x6'));router['get']('/',auth[_0xcb36('0x7')](),controller['index']);router[_0xcb36('0x8')]('/describe',auth[_0xcb36('0x7')](),controller[_0xcb36('0x9')]);router[_0xcb36('0x8')](_0xcb36('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xcb36('0x8')](_0xcb36('0xb'),auth[_0xcb36('0x7')](),controller[_0xcb36('0xc')]);router['get'](_0xcb36('0xd'),auth['isAuthenticated'](),controller['getTeams']);router[_0xcb36('0x8')](_0xcb36('0xe'),auth[_0xcb36('0x7')](),controller[_0xcb36('0xf')]);router[_0xcb36('0x10')]('/',auth[_0xcb36('0x7')](),controller[_0xcb36('0x11')]);router['post']('/:id/teams',auth[_0xcb36('0x7')](),controller['addTeams']);router['post'](_0xcb36('0xe'),auth[_0xcb36('0x7')](),controller[_0xcb36('0x12')]);router[_0xcb36('0x13')](_0xcb36('0xa'),auth[_0xcb36('0x7')](),controller['update']);router[_0xcb36('0x14')](_0xcb36('0xa'),auth[_0xcb36('0x7')](),controller[_0xcb36('0x15')]);router[_0xcb36('0x14')](_0xcb36('0xd'),auth[_0xcb36('0x7')](),controller['removeTeams']);router[_0xcb36('0x14')](_0xcb36('0xe'),auth[_0xcb36('0x7')](),controller[_0xcb36('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index b444797..237871c 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 _0xcd8e=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xcd8e,0xa9));var _0xecd8=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xcd8e[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xecd8('0x0'));module[_0xecd8('0x1')]={'name':{'type':Sequelize[_0xecd8('0x2')],'unique':_0xecd8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xecd8('0x2')]},'timeout':{'type':Sequelize[_0xecd8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xecd8('0x5')](_0xecd8('0x6'),_0xecd8('0x7'),_0xecd8('0x8'))}}; \ No newline at end of file +var _0x6c8a=['sequelize','name','STRING','ENUM'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6c8a,0x138));var _0xa6c8=function(_0x30fe5e,_0x4c5477){_0x30fe5e=_0x30fe5e-0x0;var _0x4a3e87=_0x6c8a[_0x30fe5e];return _0x4a3e87;};'use strict';var Sequelize=require(_0xa6c8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa6c8('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa6c8('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa6c8('0x3')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 8b2289a..168f4d8 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 _0xaad5=['ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','TeamId','all','union','isEmpty','removeAgents','forEach','emit','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','rimraf','fast-json-patch','moment','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','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./openchannelQueue.socket','register','sendStatus','end','json','undefined','limit','count','offset','status','set','apply','update','destroy','then','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','filter','options','findAll','rows','catch','show','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','findOne','sort','OpenchannelQueueId','UserOpenchannelQueue','User','UserId','createdAt','%s/%s','openchannelPause','updatedAt','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams'];(function(_0x190ed3,_0x42001c){var _0x2c5dab=function(_0x1908f3){while(--_0x1908f3){_0x190ed3['push'](_0x190ed3['shift']());}};_0x2c5dab(++_0x42001c);}(_0xaad5,0x126));var _0x5aad=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xaad5[_0x58dc25];return _0x21b0a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5aad('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5aad('0x1'));var rp=require('request-promise');var moment=require(_0x5aad('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5aad('0x3'));var util=require(_0x5aad('0x4'));var path=require(_0x5aad('0x5'));var sox=require(_0x5aad('0x6'));var csv=require(_0x5aad('0x7'));var ejs=require(_0x5aad('0x8'));var fs=require('fs');var fs_extra=require(_0x5aad('0x9'));var _=require(_0x5aad('0xa'));var squel=require(_0x5aad('0xb'));var crypto=require('crypto');var jsforce=require(_0x5aad('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5aad('0x7'));var querystring=require(_0x5aad('0xd'));var Papa=require(_0x5aad('0xe'));var Redis=require('ioredis');var authService=require(_0x5aad('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5aad('0x10'));var hardwareService=require(_0x5aad('0x11'));var logger=require(_0x5aad('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x5aad('0x13'));var licenseUtil=require(_0x5aad('0x14'));var db=require(_0x5aad('0x15'))['db'];config['redis']=_[_0x5aad('0x16')](config[_0x5aad('0x17')],{'host':_0x5aad('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5aad('0x17')]));require(_0x5aad('0x19'))[_0x5aad('0x1a')](socket);function respondWithStatusCode(_0x43a5f8,_0x116c2a){_0x116c2a=_0x116c2a||0xcc;return function(_0x51d3e5){if(_0x51d3e5){return _0x43a5f8[_0x5aad('0x1b')](_0x116c2a);}return _0x43a5f8['status'](_0x116c2a)[_0x5aad('0x1c')]();};}function respondWithResult(_0x39bc39,_0x565c45){_0x565c45=_0x565c45||0xc8;return function(_0x5d94e7){if(_0x5d94e7){return _0x39bc39['status'](_0x565c45)[_0x5aad('0x1d')](_0x5d94e7);}};}function respondWithFilteredResult(_0x3dcd58,_0x4cad51){return function(_0x38afa1){if(_0x38afa1){var _0x306fd2=typeof _0x4cad51['offset']===_0x5aad('0x1e')&&typeof _0x4cad51[_0x5aad('0x1f')]===_0x5aad('0x1e');var _0x4457ac=_0x38afa1[_0x5aad('0x20')];var _0x5514ea=_0x306fd2?0x0:_0x4cad51['offset'];var _0x5d8b3e=_0x306fd2?_0x38afa1[_0x5aad('0x20')]:_0x4cad51[_0x5aad('0x21')]+_0x4cad51[_0x5aad('0x1f')];var _0x4f997a;if(_0x5d8b3e>=_0x4457ac){_0x5d8b3e=_0x4457ac;_0x4f997a=0xc8;}else{_0x4f997a=0xce;}_0x3dcd58[_0x5aad('0x22')](_0x4f997a);return _0x3dcd58[_0x5aad('0x23')]('Content-Range',_0x5514ea+'-'+_0x5d8b3e+'/'+_0x4457ac)[_0x5aad('0x1d')](_0x38afa1);}return null;};}function patchUpdates(_0x259457){return function(_0x249eb3){try{jsonpatch[_0x5aad('0x24')](_0x249eb3,_0x259457,!![]);}catch(_0x109df1){return BPromise['reject'](_0x109df1);}return _0x249eb3['save']();};}function saveUpdates(_0x1b30da,_0x42290d){return function(_0x278779){if(_0x278779){return _0x278779[_0x5aad('0x25')](_0x1b30da)['then'](function(_0xe34065){return _0xe34065;});}return null;};}function removeEntity(_0x4c4397,_0x205d55){return function(_0x2d30b3){if(_0x2d30b3){return _0x2d30b3[_0x5aad('0x26')]()[_0x5aad('0x27')](function(){var _0x19d983=_0x2d30b3[_0x5aad('0x28')]({'plain':!![]});var _0x53b78e=_0x5aad('0x29');return db[_0x5aad('0x2a')][_0x5aad('0x26')]({'where':{'type':_0x53b78e,'resourceId':_0x19d983['id']}})[_0x5aad('0x27')](function(){return _0x2d30b3;});})['then'](function(){_0x4c4397[_0x5aad('0x22')](0xcc)[_0x5aad('0x1c')]();});}};}function handleEntityNotFound(_0x20bec8,_0x5c5a9d){return function(_0x3247f1){if(!_0x3247f1){_0x20bec8['sendStatus'](0x194);}return _0x3247f1;};}function handleError(_0x3829ac,_0x2a3e03){_0x2a3e03=_0x2a3e03||0x1f4;return function(_0x2c2155){logger[_0x5aad('0x2b')](_0x2c2155[_0x5aad('0x2c')]);if(_0x2c2155[_0x5aad('0x2d')]){delete _0x2c2155[_0x5aad('0x2d')];}_0x3829ac[_0x5aad('0x22')](_0x2a3e03)[_0x5aad('0x2e')](_0x2c2155);};}exports[_0x5aad('0x2f')]=function(_0x1ffb86,_0xfb0666){var _0x1725fa={},_0x33c2e3={},_0x34e080={'count':0x0,'rows':[]};var _0x46a797=_[_0x5aad('0x30')](db[_0x5aad('0x31')]['rawAttributes'],function(_0x333c98){return{'name':_0x333c98[_0x5aad('0x32')],'type':_0x333c98[_0x5aad('0x33')][_0x5aad('0x34')]};});_0x33c2e3['model']=_[_0x5aad('0x30')](_0x46a797,_0x5aad('0x2d'));_0x33c2e3[_0x5aad('0x35')]=_[_0x5aad('0x36')](_0x1ffb86[_0x5aad('0x35')]);_0x33c2e3[_0x5aad('0x37')]=_[_0x5aad('0x38')](_0x33c2e3['model'],_0x33c2e3['query']);_0x1725fa[_0x5aad('0x39')]=_[_0x5aad('0x38')](_0x33c2e3[_0x5aad('0x3a')],qs['fields'](_0x1ffb86[_0x5aad('0x35')][_0x5aad('0x3b')]));_0x1725fa[_0x5aad('0x39')]=_0x1725fa[_0x5aad('0x39')][_0x5aad('0x3c')]?_0x1725fa['attributes']:_0x33c2e3['model'];if(!_0x1ffb86[_0x5aad('0x35')][_0x5aad('0x3d')](_0x5aad('0x3e'))){_0x1725fa[_0x5aad('0x1f')]=qs[_0x5aad('0x1f')](_0x1ffb86[_0x5aad('0x35')][_0x5aad('0x1f')]);_0x1725fa[_0x5aad('0x21')]=qs[_0x5aad('0x21')](_0x1ffb86[_0x5aad('0x35')][_0x5aad('0x21')]);}_0x1725fa[_0x5aad('0x3f')]=qs['sort'](_0x1ffb86['query']['sort']);_0x1725fa[_0x5aad('0x40')]=qs[_0x5aad('0x37')](_[_0x5aad('0x41')](_0x1ffb86['query'],_0x33c2e3[_0x5aad('0x37')]),_0x46a797);if(_0x1ffb86[_0x5aad('0x35')]['filter']){_0x1725fa['where']=_[_0x5aad('0x42')](_0x1725fa[_0x5aad('0x40')],{'$or':_['map'](_0x46a797,function(_0x3d5b12){if(_0x3d5b12['type']!=='VIRTUAL'){var _0x98e343={};_0x98e343[_0x3d5b12['name']]={'$like':'%'+_0x1ffb86[_0x5aad('0x35')][_0x5aad('0x43')]+'%'};return _0x98e343;}})});}_0x1725fa=_[_0x5aad('0x42')]({},_0x1725fa,_0x1ffb86[_0x5aad('0x44')]);var _0x4bf4e0={'where':_0x1725fa['where']};return db['OpenchannelQueue'][_0x5aad('0x20')](_0x4bf4e0)[_0x5aad('0x27')](function(_0x4db50e){_0x34e080[_0x5aad('0x20')]=_0x4db50e;if(_0x1ffb86[_0x5aad('0x35')]['includeAll']){_0x1725fa['include']=[{'all':!![]}];}return db[_0x5aad('0x31')][_0x5aad('0x45')](_0x1725fa);})[_0x5aad('0x27')](function(_0x593d06){_0x34e080[_0x5aad('0x46')]=_0x593d06;return _0x34e080;})[_0x5aad('0x27')](respondWithFilteredResult(_0xfb0666,_0x1725fa))[_0x5aad('0x47')](handleError(_0xfb0666,null));};exports[_0x5aad('0x48')]=function(_0x2f5d00,_0x11b03e){var _0x412fcf={'raw':!![],'where':{'id':_0x2f5d00['params']['id']}},_0x589a0a={};_0x589a0a[_0x5aad('0x3a')]=_['keys'](db[_0x5aad('0x31')][_0x5aad('0x49')]);_0x589a0a[_0x5aad('0x35')]=_['keys'](_0x2f5d00['query']);_0x589a0a[_0x5aad('0x37')]=_[_0x5aad('0x38')](_0x589a0a[_0x5aad('0x3a')],_0x589a0a[_0x5aad('0x35')]);_0x412fcf[_0x5aad('0x39')]=_[_0x5aad('0x38')](_0x589a0a[_0x5aad('0x3a')],qs['fields'](_0x2f5d00['query'][_0x5aad('0x3b')]));_0x412fcf[_0x5aad('0x39')]=_0x412fcf[_0x5aad('0x39')][_0x5aad('0x3c')]?_0x412fcf['attributes']:_0x589a0a[_0x5aad('0x3a')];if(_0x2f5d00[_0x5aad('0x35')]['includeAll']){_0x412fcf[_0x5aad('0x4a')]=[{'all':!![]}];}_0x412fcf=_['merge']({},_0x412fcf,_0x2f5d00[_0x5aad('0x44')]);return db[_0x5aad('0x31')][_0x5aad('0x4b')](_0x412fcf)[_0x5aad('0x27')](handleEntityNotFound(_0x11b03e,null))[_0x5aad('0x27')](respondWithResult(_0x11b03e,null))[_0x5aad('0x47')](handleError(_0x11b03e,null));};exports[_0x5aad('0x4c')]=function(_0x1cfffb,_0x6672b0){return db[_0x5aad('0x31')]['create'](_0x1cfffb['body'],{})[_0x5aad('0x27')](function(_0xe7590f){var _0x3e4b0e=_0x1cfffb[_0x5aad('0x4d')]['get']({'plain':!![]});if(!_0x3e4b0e)throw new Error(_0x5aad('0x4e'));if(_0x3e4b0e[_0x5aad('0x4f')]==='user'){var _0x2b9824=_0xe7590f[_0x5aad('0x28')]({'plain':!![]});var _0x562cee=_0x5aad('0x29');return db[_0x5aad('0x50')][_0x5aad('0x4b')]({'where':{'name':_0x562cee,'userProfileId':_0x3e4b0e[_0x5aad('0x51')]},'raw':!![]})[_0x5aad('0x27')](function(_0x267f03){if(_0x267f03&&_0x267f03[_0x5aad('0x52')]===0x0){return db[_0x5aad('0x2a')][_0x5aad('0x4c')]({'name':_0x2b9824[_0x5aad('0x2d')],'resourceId':_0x2b9824['id'],'type':_0x267f03[_0x5aad('0x2d')],'sectionId':_0x267f03['id']},{})['then'](function(){return _0xe7590f;});}else{return _0xe7590f;}})[_0x5aad('0x47')](function(_0x3a3961){logger[_0x5aad('0x2b')](_0x5aad('0x53'),_0x3a3961);throw _0x3a3961;});}return _0xe7590f;})[_0x5aad('0x27')](respondWithResult(_0x6672b0,0xc9))[_0x5aad('0x47')](handleError(_0x6672b0,null));};exports[_0x5aad('0x25')]=function(_0x4fe71e,_0x454949){if(_0x4fe71e['body']['id']){delete _0x4fe71e[_0x5aad('0x54')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x4fe71e[_0x5aad('0x55')]['id']}})[_0x5aad('0x27')](handleEntityNotFound(_0x454949,null))[_0x5aad('0x27')](saveUpdates(_0x4fe71e[_0x5aad('0x54')],null))[_0x5aad('0x27')](respondWithResult(_0x454949,null))['catch'](handleError(_0x454949,null));};exports[_0x5aad('0x26')]=function(_0x475b5e,_0x254476){return db[_0x5aad('0x31')][_0x5aad('0x4b')]({'where':{'id':_0x475b5e[_0x5aad('0x55')]['id']}})[_0x5aad('0x27')](handleEntityNotFound(_0x254476,null))[_0x5aad('0x27')](removeEntity(_0x254476,null))[_0x5aad('0x47')](handleError(_0x254476,null));};exports[_0x5aad('0x56')]=function(_0x5d2fdd,_0x12d368){return db[_0x5aad('0x31')]['describe']()[_0x5aad('0x27')](respondWithResult(_0x12d368,null))['catch'](handleError(_0x12d368,null));};exports['getMembers']=function(_0x9318da,_0x4815b3,_0x3813ad){var _0x6078b3={'raw':!![],'where':{}},_0x3ad873={},_0x14fe83;return db[_0x5aad('0x31')][_0x5aad('0x57')]({'where':{'id':_0x9318da[_0x5aad('0x55')]['id']}})[_0x5aad('0x27')](handleEntityNotFound(_0x4815b3,null))[_0x5aad('0x27')](function(_0x3a1f71){if(_0x3a1f71){_0x14fe83=_0x3a1f71['get']({'plain':!![]});_0x3ad873['model']=_[_0x5aad('0x36')](db['UserOpenchannelQueue'][_0x5aad('0x49')]);_0x3ad873[_0x5aad('0x35')]=_['keys'](_0x9318da['query']);_0x3ad873[_0x5aad('0x37')]=_['intersection'](_0x3ad873[_0x5aad('0x3a')],_0x3ad873[_0x5aad('0x35')]);_0x6078b3[_0x5aad('0x39')]=_[_0x5aad('0x38')](_0x3ad873['model'],qs[_0x5aad('0x3b')](_0x9318da[_0x5aad('0x35')]['fields']));_0x6078b3['attributes']=_0x6078b3[_0x5aad('0x39')][_0x5aad('0x3c')]?_0x6078b3['attributes']:_0x3ad873['model'];if(!_0x9318da[_0x5aad('0x35')]['hasOwnProperty'](_0x5aad('0x3e'))){_0x6078b3[_0x5aad('0x1f')]=qs[_0x5aad('0x1f')](_0x9318da[_0x5aad('0x35')]['limit']);_0x6078b3['offset']=qs[_0x5aad('0x21')](_0x9318da['query'][_0x5aad('0x21')]);}_0x6078b3[_0x5aad('0x3f')]=qs[_0x5aad('0x58')](_0x9318da['query'][_0x5aad('0x58')]);_0x6078b3['where']=qs['filters'](_[_0x5aad('0x41')](_0x9318da[_0x5aad('0x35')],_0x3ad873[_0x5aad('0x37')]));_0x6078b3[_0x5aad('0x40')][_0x5aad('0x59')]=_0x3a1f71['id'];if(_0x9318da[_0x5aad('0x35')]['filter']){_0x6078b3[_0x5aad('0x40')]=_[_0x5aad('0x42')](_0x6078b3['where'],{'$or':_[_0x5aad('0x30')](_0x6078b3[_0x5aad('0x39')],function(_0x1e80a1){var _0x35e0bb={};_0x35e0bb[_0x1e80a1]={'$like':'%'+_0x9318da[_0x5aad('0x35')][_0x5aad('0x43')]+'%'};return _0x35e0bb;})});}_0x6078b3=_[_0x5aad('0x42')]({},_0x6078b3,_0x9318da[_0x5aad('0x44')]);return db[_0x5aad('0x5a')][_0x5aad('0x45')](_0x6078b3);}})['then'](function(_0x487f4b){if(_0x487f4b){return db[_0x5aad('0x5b')]['findAndCountAll']({'where':{'id':_[_0x5aad('0x30')](_0x487f4b,_0x5aad('0x5c')),'role':'agent'},'attributes':['id',_0x5aad('0x2d'),'openchannelPause','updatedAt',_0x5aad('0x5d')]});}})[_0x5aad('0x27')](function(_0x5996ba){if(_0x5996ba){return{'count':_0x5996ba['count'],'rows':_['map'](_0x5996ba[_0x5aad('0x46')],function(_0x6c974b){return{'membername':_0x6c974b[_0x5aad('0x2d')],'UserId':_0x6c974b['id'],'queue_name':_0x14fe83[_0x5aad('0x2d')],'OpenchannelQueueId':_0x14fe83['id'],'interface':util['format'](_0x5aad('0x5e'),'SIP',_0x6c974b['name']),'penalty':0x0,'paused':_0x6c974b[_0x5aad('0x5f')],'createdAt':_0x6c974b[_0x5aad('0x5d')],'updatedAt':_0x6c974b[_0x5aad('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4815b3,_0x6078b3))[_0x5aad('0x47')](handleError(_0x4815b3,null));};exports[_0x5aad('0x61')]=function(_0x52a6ea,_0xd31adc,_0x35d5fc){var _0x4433a6={};var _0x5eb859={};var _0x2b7480;var _0x5834ef;return db[_0x5aad('0x31')]['findOne']({'where':{'id':_0x52a6ea[_0x5aad('0x55')]['id']}})[_0x5aad('0x27')](handleEntityNotFound(_0xd31adc,null))[_0x5aad('0x27')](function(_0x8c0958){if(_0x8c0958){_0x2b7480=_0x8c0958;_0x5eb859['model']=_[_0x5aad('0x36')](db[_0x5aad('0x62')][_0x5aad('0x49')]);_0x5eb859[_0x5aad('0x35')]=_[_0x5aad('0x36')](_0x52a6ea[_0x5aad('0x35')]);_0x5eb859[_0x5aad('0x37')]=_[_0x5aad('0x38')](_0x5eb859[_0x5aad('0x3a')],_0x5eb859['query']);_0x4433a6['attributes']=_[_0x5aad('0x38')](_0x5eb859[_0x5aad('0x3a')],qs['fields'](_0x52a6ea['query'][_0x5aad('0x3b')]));_0x4433a6[_0x5aad('0x39')]=_0x4433a6[_0x5aad('0x39')][_0x5aad('0x3c')]?_0x4433a6[_0x5aad('0x39')]:_0x5eb859[_0x5aad('0x3a')];_0x4433a6[_0x5aad('0x3f')]=qs['sort'](_0x52a6ea['query']['sort']);_0x4433a6[_0x5aad('0x40')]=qs[_0x5aad('0x37')](_[_0x5aad('0x41')](_0x52a6ea['query'],_0x5eb859['filters']));if(_0x52a6ea[_0x5aad('0x35')]['filter']){_0x4433a6['where']=_[_0x5aad('0x42')](_0x4433a6['where'],{'$or':_[_0x5aad('0x30')](_0x4433a6['attributes'],function(_0x1da458){var _0x4465f5={};_0x4465f5[_0x1da458]={'$like':'%'+_0x52a6ea[_0x5aad('0x35')][_0x5aad('0x43')]+'%'};return _0x4465f5;})});}_0x4433a6=_[_0x5aad('0x42')]({},_0x4433a6,_0x52a6ea['options']);return _0x2b7480[_0x5aad('0x61')](_0x4433a6);}})['then'](function(_0x107675){if(_0x107675){_0x5834ef=_0x107675[_0x5aad('0x3c')];if(!_0x52a6ea[_0x5aad('0x35')][_0x5aad('0x3d')](_0x5aad('0x3e'))){_0x4433a6[_0x5aad('0x1f')]=qs['limit'](_0x52a6ea[_0x5aad('0x35')][_0x5aad('0x1f')]);_0x4433a6[_0x5aad('0x21')]=qs[_0x5aad('0x21')](_0x52a6ea[_0x5aad('0x35')][_0x5aad('0x21')]);}return _0x2b7480['getTeams'](_0x4433a6);}})[_0x5aad('0x27')](function(_0x3dbcbb){if(_0x3dbcbb){return _0x3dbcbb?{'count':_0x5834ef,'rows':_0x3dbcbb}:null;}})[_0x5aad('0x27')](respondWithResult(_0xd31adc,null))[_0x5aad('0x47')](handleError(_0xd31adc,null));};exports[_0x5aad('0x63')]=function(_0x23211e,_0x2f1526,_0x4ef8de){var _0xb86ef4=_0x23211e[_0x5aad('0x54')][_0x5aad('0x64')];return db[_0x5aad('0x62')][_0x5aad('0x45')]({'where':{'id':_0xb86ef4},'attributes':['id'],'include':[{'model':db[_0x5aad('0x5b')],'as':_0x5aad('0x65'),'attributes':['id',_0x5aad('0x2d'),'online',_0x5aad('0x66'),_0x5aad('0x67')],'raw':!![]}]})['then'](function(_0x3e6935){if(_0x3e6935){var _0x4c89a7=_[_0x5aad('0x68')](_0x3e6935,function(_0x1ebcad){var _0x2d7f9f=_0x1ebcad[_0x5aad('0x28')]({'plain':!![]});return _0x2d7f9f[_0x5aad('0x65')];});return db['OpenchannelQueue'][_0x5aad('0x4b')]({'where':{'id':_0x23211e[_0x5aad('0x55')]['id']}})[_0x5aad('0x27')](function(_0x275f38){return db['sequelize'][_0x5aad('0x69')](function(_0x430edf){return _0x275f38[_0x5aad('0x63')](_0xb86ef4,{'transaction':_0x430edf})[_0x5aad('0x27')](function(){return BPromise[_0x5aad('0x6a')](_0x4c89a7,function(_0x53fd27){return db[_0x5aad('0x5a')][_0x5aad('0x6b')]({'where':{'UserId':_0x53fd27['id'],'OpenchannelQueueId':_0x23211e[_0x5aad('0x55')]['id']},'transaction':_0x430edf});});})[_0x5aad('0x27')](function(){_0x4c89a7['forEach'](function(_0x365648){socket['emit'](_0x5aad('0x6c'),{'UserId':_0x365648['id'],'OpenchannelQueueId':_0x275f38['id']});});});});});}})[_0x5aad('0x27')](respondWithStatusCode(_0x2f1526,null))[_0x5aad('0x47')](handleError(_0x2f1526,null));};exports[_0x5aad('0x6d')]=function(_0x241104,_0x12a378,_0x59b079){return db[_0x5aad('0x62')][_0x5aad('0x45')]({'where':{'id':_0x241104[_0x5aad('0x35')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5aad('0x65'),'attributes':['id'],'raw':!![]}]})[_0x5aad('0x27')](handleEntityNotFound(_0x12a378,null))[_0x5aad('0x27')](function(_0x52f2ef){var _0x3e5d3f=_[_0x5aad('0x30')](_0x52f2ef,'id');var _0x1103c7=[];var _0x24a306=[];var _0x25e605=squel[_0x5aad('0x6e')]();_0x25e605[_0x5aad('0x6f')](_0x5aad('0x70'))[_0x5aad('0x71')](_0x5aad('0x72'),'tq')[_0x5aad('0x73')](_0x5aad('0x74'),'ut',_0x5aad('0x75'))[_0x5aad('0x40')](_0x5aad('0x76'),_0x241104[_0x5aad('0x55')]['id']);for(var _0x2dfe71=0x0;_0x2dfe71<_0x52f2ef['length'];_0x2dfe71+=0x1){let _0x1b0f92=_0x52f2ef[_0x2dfe71];for(var _0x2644bc=0x0;_0x2644bc<_0x1b0f92[_0x5aad('0x65')]['length'];_0x2644bc+=0x1){let _0x1d5579=_0x1b0f92[_0x5aad('0x65')][_0x2644bc];var _0x5bd13d=_0x25e605[_0x5aad('0x77')]();_0x5bd13d[_0x5aad('0x40')](_0x5aad('0x78'),_0x1d5579['id']);_0x24a306[_0x5aad('0x79')](db[_0x5aad('0x7a')][_0x5aad('0x35')](_0x5bd13d['toString'](),{'type':db[_0x5aad('0x7a')]['QueryTypes'][_0x5aad('0x7b')]})[_0x5aad('0x27')](function(_0x5b0f4b){if(_0x5b0f4b[_0x5aad('0x3c')]===0x1){return _0x1d5579['id'];}else{var _0x3c0b2f=_[_0x5aad('0x7c')](_['map'](_0x5b0f4b,_0x5aad('0x7d')),function(_0x3413a6){return _['includes'](_0x3e5d3f,_0x3413a6);});if(_0x3c0b2f){return _0x1d5579['id'];}}}));}}return BPromise[_0x5aad('0x7e')](_0x24a306)[_0x5aad('0x27')](function(_0x1dbd62){_0x1103c7=_(_0x1103c7)[_0x5aad('0x7f')](_0x1dbd62)['compact']()['value']();return db[_0x5aad('0x31')][_0x5aad('0x4b')]({'where':{'id':_0x241104[_0x5aad('0x55')]['id']}})[_0x5aad('0x27')](function(_0x11836b){return db['sequelize'][_0x5aad('0x69')](function(_0x3d8d18){return _0x11836b['removeTeams'](_0x241104['query'][_0x5aad('0x64')],{'transaction':_0x3d8d18})[_0x5aad('0x27')](function(){if(!_[_0x5aad('0x80')](_0x1103c7)){return _0x11836b[_0x5aad('0x81')](_0x1103c7,{'transaction':_0x3d8d18});}})[_0x5aad('0x27')](function(){_0x1103c7[_0x5aad('0x82')](function(_0x1b9c6a){socket[_0x5aad('0x83')](_0x5aad('0x84'),{'UserId':_0x1b9c6a,'OpenchannelQueueId':_0x11836b['id']});});});});});});})['then'](respondWithStatusCode(_0x12a378,null))[_0x5aad('0x47')](handleError(_0x12a378,null));};exports[_0x5aad('0x85')]=function(_0x2f66f6,_0x1d4e77,_0x390a67){return db[_0x5aad('0x31')][_0x5aad('0x4b')]({'where':{'id':_0x2f66f6[_0x5aad('0x55')]['id']}})['then'](handleEntityNotFound(_0x1d4e77,null))[_0x5aad('0x27')](function(_0x3f8d1b){if(_0x3f8d1b){return _0x3f8d1b[_0x5aad('0x85')](_0x2f66f6['body']['ids'],_['omit'](_0x2f66f6[_0x5aad('0x54')],[_0x5aad('0x64'),'id'])||{})[_0x5aad('0x86')](function(_0x2f24f1){for(var _0x3e0b2c=0x0;_0x3e0b2c<_0x2f66f6['body'][_0x5aad('0x64')][_0x5aad('0x3c')];_0x3e0b2c+=0x1){socket['emit'](_0x5aad('0x6c'),{'UserId':Number(_0x2f66f6[_0x5aad('0x54')][_0x5aad('0x64')][_0x3e0b2c]),'OpenchannelQueueId':Number(_0x2f66f6['params']['id'])});}return _0x2f24f1;});}})[_0x5aad('0x27')](respondWithResult(_0x1d4e77,null))['catch'](handleError(_0x1d4e77,null));};exports['removeAgents']=function(_0x459afc,_0x165513,_0x459b29){return db[_0x5aad('0x31')][_0x5aad('0x4b')]({'where':{'id':_0x459afc[_0x5aad('0x55')]['id']}})[_0x5aad('0x27')](handleEntityNotFound(_0x165513,null))[_0x5aad('0x27')](function(_0x3d74e9){if(_0x3d74e9){return _0x3d74e9[_0x5aad('0x81')](_0x459afc[_0x5aad('0x35')][_0x5aad('0x64')])['then'](function(){if(_[_0x5aad('0x87')](_0x459afc[_0x5aad('0x35')][_0x5aad('0x64')])){for(var _0x2e0cea=0x0;_0x2e0cea<_0x459afc['query'][_0x5aad('0x64')][_0x5aad('0x3c')];_0x2e0cea+=0x1){socket[_0x5aad('0x83')](_0x5aad('0x84'),{'UserId':Number(_0x459afc['query'][_0x5aad('0x64')][_0x2e0cea]),'OpenchannelQueueId':Number(_0x459afc[_0x5aad('0x55')]['id'])});}}else{socket['emit'](_0x5aad('0x84'),{'UserId':Number(_0x459afc[_0x5aad('0x35')][_0x5aad('0x64')]),'OpenchannelQueueId':Number(_0x459afc[_0x5aad('0x55')]['id'])});}});}})[_0x5aad('0x27')](respondWithStatusCode(_0x165513,null))['catch'](handleError(_0x165513,null));};exports[_0x5aad('0x88')]=function(_0x3fd98c,_0x2ef686,_0x1ae28f){var _0x3c5e98={};var _0xe464f8={};var _0x4c1b12;var _0x3d1ba9;return db[_0x5aad('0x31')][_0x5aad('0x57')]({'where':{'id':_0x3fd98c[_0x5aad('0x55')]['id']}})[_0x5aad('0x27')](handleEntityNotFound(_0x2ef686,null))[_0x5aad('0x27')](function(_0x2b80f2){if(_0x2b80f2){_0x4c1b12=_0x2b80f2;_0xe464f8[_0x5aad('0x3a')]=_[_0x5aad('0x36')](db[_0x5aad('0x5b')][_0x5aad('0x49')]);_0xe464f8[_0x5aad('0x35')]=_[_0x5aad('0x36')](_0x3fd98c[_0x5aad('0x35')]);_0xe464f8[_0x5aad('0x37')]=_[_0x5aad('0x38')](_0xe464f8[_0x5aad('0x3a')],_0xe464f8[_0x5aad('0x35')]);_0x3c5e98['attributes']=_['intersection'](_0xe464f8[_0x5aad('0x3a')],qs['fields'](_0x3fd98c['query']['fields']));_0x3c5e98['attributes']=_0x3c5e98['attributes'][_0x5aad('0x3c')]?_0x3c5e98[_0x5aad('0x39')]:_0xe464f8['model'];_0x3c5e98[_0x5aad('0x3f')]=qs[_0x5aad('0x58')](_0x3fd98c[_0x5aad('0x35')][_0x5aad('0x58')]);_0x3c5e98[_0x5aad('0x40')]=qs[_0x5aad('0x37')](_['pick'](_0x3fd98c[_0x5aad('0x35')],_0xe464f8['filters']));if(_0x3fd98c[_0x5aad('0x35')]['filter']){_0x3c5e98[_0x5aad('0x40')]=_[_0x5aad('0x42')](_0x3c5e98[_0x5aad('0x40')],{'$or':_[_0x5aad('0x30')](_0x3c5e98['attributes'],function(_0xd9c51d){var _0x35971e={};_0x35971e[_0xd9c51d]={'$like':'%'+_0x3fd98c[_0x5aad('0x35')][_0x5aad('0x43')]+'%'};return _0x35971e;})});}_0x3c5e98=_[_0x5aad('0x42')]({},_0x3c5e98,_0x3fd98c['options']);return _0x4c1b12[_0x5aad('0x88')](_0x3c5e98);}})[_0x5aad('0x27')](function(_0x3145e1){if(_0x3145e1){_0x3d1ba9=_0x3145e1[_0x5aad('0x3c')];if(!_0x3fd98c[_0x5aad('0x35')][_0x5aad('0x3d')](_0x5aad('0x3e'))){_0x3c5e98[_0x5aad('0x1f')]=qs[_0x5aad('0x1f')](_0x3fd98c[_0x5aad('0x35')]['limit']);_0x3c5e98[_0x5aad('0x21')]=qs[_0x5aad('0x21')](_0x3fd98c[_0x5aad('0x35')][_0x5aad('0x21')]);}return _0x4c1b12['getAgents'](_0x3c5e98);}})[_0x5aad('0x27')](function(_0x278adb){if(_0x278adb){return _0x278adb?{'count':_0x3d1ba9,'rows':_0x278adb}:null;}})[_0x5aad('0x27')](respondWithResult(_0x2ef686,null))['catch'](handleError(_0x2ef686,null));}; \ No newline at end of file +var _0x521b=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','User','findAndCountAll','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','from','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','transaction','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','error','send','map','OpenchannelQueue','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','findAll','catch','show','params','includeAll','include','options','user'];(function(_0x49d251,_0x4ed86e){var _0x5c0509=function(_0x19dee3){while(--_0x19dee3){_0x49d251['push'](_0x49d251['shift']());}};_0x5c0509(++_0x4ed86e);}(_0x521b,0x15b));var _0xb521=function(_0x4973ff,_0x30abe4){_0x4973ff=_0x4973ff-0x0;var _0x4dd6b6=_0x521b[_0x4973ff];return _0x4dd6b6;};'use strict';var emlformat=require(_0xb521('0x0'));var rimraf=require(_0xb521('0x1'));var zipdir=require(_0xb521('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb521('0x3'));var moment=require(_0xb521('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb521('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb521('0x6'));var csv=require('to-csv');var ejs=require(_0xb521('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb521('0x8'));var squel=require(_0xb521('0x9'));var crypto=require(_0xb521('0xa'));var jsforce=require(_0xb521('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb521('0xc'));var querystring=require(_0xb521('0xd'));var Papa=require(_0xb521('0xe'));var Redis=require(_0xb521('0xf'));var authService=require(_0xb521('0x10'));var qs=require(_0xb521('0x11'));var as=require(_0xb521('0x12'));var hardwareService=require(_0xb521('0x13'));var logger=require(_0xb521('0x14'))(_0xb521('0x15'));var utils=require(_0xb521('0x16'));var config=require(_0xb521('0x17'));var licenseUtil=require(_0xb521('0x18'));var db=require(_0xb521('0x19'))['db'];config[_0xb521('0x1a')]=_[_0xb521('0x1b')](config[_0xb521('0x1a')],{'host':_0xb521('0x1c'),'port':0x18eb});var socket=require(_0xb521('0x1d'))(new Redis(config[_0xb521('0x1a')]));require(_0xb521('0x1e'))['register'](socket);function respondWithStatusCode(_0x48bc4c,_0x2c9205){_0x2c9205=_0x2c9205||0xcc;return function(_0x51c612){if(_0x51c612){return _0x48bc4c[_0xb521('0x1f')](_0x2c9205);}return _0x48bc4c[_0xb521('0x20')](_0x2c9205)[_0xb521('0x21')]();};}function respondWithResult(_0x54e547,_0x30983e){_0x30983e=_0x30983e||0xc8;return function(_0x12e0ee){if(_0x12e0ee){return _0x54e547['status'](_0x30983e)['json'](_0x12e0ee);}};}function respondWithFilteredResult(_0x5e4e2e,_0x1cb2e0){return function(_0x2d62ea){if(_0x2d62ea){var _0x540993=typeof _0x1cb2e0[_0xb521('0x22')]===_0xb521('0x23')&&typeof _0x1cb2e0[_0xb521('0x24')]===_0xb521('0x23');var _0xce4cbd=_0x2d62ea['count'];var _0xbbdc02=_0x540993?0x0:_0x1cb2e0[_0xb521('0x22')];var _0x2c6834=_0x540993?_0x2d62ea[_0xb521('0x25')]:_0x1cb2e0[_0xb521('0x22')]+_0x1cb2e0[_0xb521('0x24')];var _0x59f229;if(_0x2c6834>=_0xce4cbd){_0x2c6834=_0xce4cbd;_0x59f229=0xc8;}else{_0x59f229=0xce;}_0x5e4e2e[_0xb521('0x20')](_0x59f229);return _0x5e4e2e['set'](_0xb521('0x26'),_0xbbdc02+'-'+_0x2c6834+'/'+_0xce4cbd)['json'](_0x2d62ea);}return null;};}function patchUpdates(_0x5e39e3){return function(_0x4dc013){try{jsonpatch[_0xb521('0x27')](_0x4dc013,_0x5e39e3,!![]);}catch(_0x1a0ea4){return BPromise[_0xb521('0x28')](_0x1a0ea4);}return _0x4dc013[_0xb521('0x29')]();};}function saveUpdates(_0x1af982,_0x212b3e){return function(_0x103cab){if(_0x103cab){return _0x103cab[_0xb521('0x2a')](_0x1af982)[_0xb521('0x2b')](function(_0x4bfdcf){return _0x4bfdcf;});}return null;};}function removeEntity(_0x1e05bd,_0x2c8e1d){return function(_0x1306d6){if(_0x1306d6){return _0x1306d6[_0xb521('0x2c')]()['then'](function(){var _0x73b0bf=_0x1306d6[_0xb521('0x2d')]({'plain':!![]});var _0x4e2581=_0xb521('0x2e');return db['UserProfileResource'][_0xb521('0x2c')]({'where':{'type':_0x4e2581,'resourceId':_0x73b0bf['id']}})[_0xb521('0x2b')](function(){return _0x1306d6;});})[_0xb521('0x2b')](function(){_0x1e05bd['status'](0xcc)[_0xb521('0x21')]();});}};}function handleEntityNotFound(_0x590e20,_0xab2bcc){return function(_0x1925b2){if(!_0x1925b2){_0x590e20[_0xb521('0x1f')](0x194);}return _0x1925b2;};}function handleError(_0x575741,_0x553931){_0x553931=_0x553931||0x1f4;return function(_0x3fd934){logger[_0xb521('0x2f')](_0x3fd934['stack']);if(_0x3fd934['name']){delete _0x3fd934['name'];}_0x575741[_0xb521('0x20')](_0x553931)[_0xb521('0x30')](_0x3fd934);};}exports['index']=function(_0x47caf8,_0x27e7c5){var _0x4ffb9c={},_0x2c1438={},_0x5968b2={'count':0x0,'rows':[]};var _0x42a29e=_[_0xb521('0x31')](db[_0xb521('0x32')][_0xb521('0x33')],function(_0x14d208){return{'name':_0x14d208[_0xb521('0x34')],'type':_0x14d208[_0xb521('0x35')]['key']};});_0x2c1438[_0xb521('0x36')]=_['map'](_0x42a29e,_0xb521('0x37'));_0x2c1438[_0xb521('0x38')]=_[_0xb521('0x39')](_0x47caf8[_0xb521('0x38')]);_0x2c1438[_0xb521('0x3a')]=_[_0xb521('0x3b')](_0x2c1438[_0xb521('0x36')],_0x2c1438[_0xb521('0x38')]);_0x4ffb9c[_0xb521('0x3c')]=_['intersection'](_0x2c1438[_0xb521('0x36')],qs['fields'](_0x47caf8['query'][_0xb521('0x3d')]));_0x4ffb9c[_0xb521('0x3c')]=_0x4ffb9c[_0xb521('0x3c')][_0xb521('0x3e')]?_0x4ffb9c[_0xb521('0x3c')]:_0x2c1438[_0xb521('0x36')];if(!_0x47caf8['query'][_0xb521('0x3f')](_0xb521('0x40'))){_0x4ffb9c['limit']=qs[_0xb521('0x24')](_0x47caf8[_0xb521('0x38')][_0xb521('0x24')]);_0x4ffb9c[_0xb521('0x22')]=qs[_0xb521('0x22')](_0x47caf8[_0xb521('0x38')]['offset']);}_0x4ffb9c[_0xb521('0x41')]=qs['sort'](_0x47caf8[_0xb521('0x38')][_0xb521('0x42')]);_0x4ffb9c[_0xb521('0x43')]=qs['filters'](_['pick'](_0x47caf8[_0xb521('0x38')],_0x2c1438[_0xb521('0x3a')]),_0x42a29e);if(_0x47caf8[_0xb521('0x38')]['filter']){_0x4ffb9c[_0xb521('0x43')]=_[_0xb521('0x44')](_0x4ffb9c[_0xb521('0x43')],{'$or':_[_0xb521('0x31')](_0x42a29e,function(_0x3f9ff7){if(_0x3f9ff7[_0xb521('0x35')]!==_0xb521('0x45')){var _0xfda4c0={};_0xfda4c0[_0x3f9ff7[_0xb521('0x37')]]={'$like':'%'+_0x47caf8['query'][_0xb521('0x46')]+'%'};return _0xfda4c0;}})});}_0x4ffb9c=_[_0xb521('0x44')]({},_0x4ffb9c,_0x47caf8['options']);var _0x572d09={'where':_0x4ffb9c['where']};return db[_0xb521('0x32')][_0xb521('0x25')](_0x572d09)[_0xb521('0x2b')](function(_0x25cce5){_0x5968b2['count']=_0x25cce5;if(_0x47caf8[_0xb521('0x38')]['includeAll']){_0x4ffb9c['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0xb521('0x47')](_0x4ffb9c);})[_0xb521('0x2b')](function(_0x49b30e){_0x5968b2['rows']=_0x49b30e;return _0x5968b2;})[_0xb521('0x2b')](respondWithFilteredResult(_0x27e7c5,_0x4ffb9c))[_0xb521('0x48')](handleError(_0x27e7c5,null));};exports[_0xb521('0x49')]=function(_0x4b83e0,_0x50dd1c){var _0x37e49b={'raw':!![],'where':{'id':_0x4b83e0[_0xb521('0x4a')]['id']}},_0x598ec0={};_0x598ec0[_0xb521('0x36')]=_[_0xb521('0x39')](db[_0xb521('0x32')][_0xb521('0x33')]);_0x598ec0[_0xb521('0x38')]=_['keys'](_0x4b83e0[_0xb521('0x38')]);_0x598ec0[_0xb521('0x3a')]=_['intersection'](_0x598ec0['model'],_0x598ec0[_0xb521('0x38')]);_0x37e49b['attributes']=_['intersection'](_0x598ec0[_0xb521('0x36')],qs[_0xb521('0x3d')](_0x4b83e0[_0xb521('0x38')]['fields']));_0x37e49b[_0xb521('0x3c')]=_0x37e49b[_0xb521('0x3c')][_0xb521('0x3e')]?_0x37e49b['attributes']:_0x598ec0[_0xb521('0x36')];if(_0x4b83e0[_0xb521('0x38')][_0xb521('0x4b')]){_0x37e49b[_0xb521('0x4c')]=[{'all':!![]}];}_0x37e49b=_[_0xb521('0x44')]({},_0x37e49b,_0x4b83e0[_0xb521('0x4d')]);return db[_0xb521('0x32')]['find'](_0x37e49b)['then'](handleEntityNotFound(_0x50dd1c,null))['then'](respondWithResult(_0x50dd1c,null))['catch'](handleError(_0x50dd1c,null));};exports['create']=function(_0x1b298a,_0x50f0af){return db[_0xb521('0x32')]['create'](_0x1b298a['body'],{})[_0xb521('0x2b')](function(_0x379627){var _0x1055a8=_0x1b298a[_0xb521('0x4e')]['get']({'plain':!![]});if(!_0x1055a8)throw new Error(_0xb521('0x4f'));if(_0x1055a8[_0xb521('0x50')]===_0xb521('0x4e')){var _0x1c5ee2=_0x379627[_0xb521('0x2d')]({'plain':!![]});var _0x4609fc='OpenchannelQueues';return db[_0xb521('0x51')][_0xb521('0x52')]({'where':{'name':_0x4609fc,'userProfileId':_0x1055a8[_0xb521('0x53')]},'raw':!![]})['then'](function(_0x25e8f9){if(_0x25e8f9&&_0x25e8f9[_0xb521('0x54')]===0x0){return db[_0xb521('0x55')]['create']({'name':_0x1c5ee2[_0xb521('0x37')],'resourceId':_0x1c5ee2['id'],'type':_0x25e8f9[_0xb521('0x37')],'sectionId':_0x25e8f9['id']},{})[_0xb521('0x2b')](function(){return _0x379627;});}else{return _0x379627;}})['catch'](function(_0xe6ad05){logger[_0xb521('0x2f')](_0xb521('0x56'),_0xe6ad05);throw _0xe6ad05;});}return _0x379627;})[_0xb521('0x2b')](respondWithResult(_0x50f0af,0xc9))[_0xb521('0x48')](handleError(_0x50f0af,null));};exports[_0xb521('0x2a')]=function(_0x41ae53,_0x2cfeee){if(_0x41ae53[_0xb521('0x57')]['id']){delete _0x41ae53[_0xb521('0x57')]['id'];}return db[_0xb521('0x32')]['find']({'where':{'id':_0x41ae53[_0xb521('0x4a')]['id']}})[_0xb521('0x2b')](handleEntityNotFound(_0x2cfeee,null))[_0xb521('0x2b')](saveUpdates(_0x41ae53[_0xb521('0x57')],null))[_0xb521('0x2b')](respondWithResult(_0x2cfeee,null))[_0xb521('0x48')](handleError(_0x2cfeee,null));};exports[_0xb521('0x2c')]=function(_0x31a12d,_0x50b7ba){return db['OpenchannelQueue'][_0xb521('0x52')]({'where':{'id':_0x31a12d[_0xb521('0x4a')]['id']}})[_0xb521('0x2b')](handleEntityNotFound(_0x50b7ba,null))[_0xb521('0x2b')](removeEntity(_0x50b7ba,null))[_0xb521('0x48')](handleError(_0x50b7ba,null));};exports[_0xb521('0x58')]=function(_0x3c349b,_0x2ca5ff){return db['OpenchannelQueue']['describe']()['then'](respondWithResult(_0x2ca5ff,null))[_0xb521('0x48')](handleError(_0x2ca5ff,null));};exports['getMembers']=function(_0x269812,_0x5995cd,_0x838b84){var _0x33cb72={'raw':!![],'where':{}},_0x3a41db={},_0x5bdd9a;return db['OpenchannelQueue'][_0xb521('0x59')]({'where':{'id':_0x269812[_0xb521('0x4a')]['id']}})[_0xb521('0x2b')](handleEntityNotFound(_0x5995cd,null))[_0xb521('0x2b')](function(_0x4ee018){if(_0x4ee018){_0x5bdd9a=_0x4ee018[_0xb521('0x2d')]({'plain':!![]});_0x3a41db[_0xb521('0x36')]=_[_0xb521('0x39')](db[_0xb521('0x5a')][_0xb521('0x33')]);_0x3a41db[_0xb521('0x38')]=_[_0xb521('0x39')](_0x269812[_0xb521('0x38')]);_0x3a41db[_0xb521('0x3a')]=_[_0xb521('0x3b')](_0x3a41db['model'],_0x3a41db[_0xb521('0x38')]);_0x33cb72[_0xb521('0x3c')]=_[_0xb521('0x3b')](_0x3a41db[_0xb521('0x36')],qs[_0xb521('0x3d')](_0x269812[_0xb521('0x38')][_0xb521('0x3d')]));_0x33cb72[_0xb521('0x3c')]=_0x33cb72[_0xb521('0x3c')][_0xb521('0x3e')]?_0x33cb72[_0xb521('0x3c')]:_0x3a41db[_0xb521('0x36')];if(!_0x269812['query'][_0xb521('0x3f')](_0xb521('0x40'))){_0x33cb72[_0xb521('0x24')]=qs[_0xb521('0x24')](_0x269812[_0xb521('0x38')]['limit']);_0x33cb72[_0xb521('0x22')]=qs[_0xb521('0x22')](_0x269812[_0xb521('0x38')][_0xb521('0x22')]);}_0x33cb72['order']=qs[_0xb521('0x42')](_0x269812[_0xb521('0x38')][_0xb521('0x42')]);_0x33cb72[_0xb521('0x43')]=qs[_0xb521('0x3a')](_[_0xb521('0x5b')](_0x269812[_0xb521('0x38')],_0x3a41db[_0xb521('0x3a')]));_0x33cb72[_0xb521('0x43')][_0xb521('0x5c')]=_0x4ee018['id'];if(_0x269812['query'][_0xb521('0x46')]){_0x33cb72[_0xb521('0x43')]=_[_0xb521('0x44')](_0x33cb72['where'],{'$or':_[_0xb521('0x31')](_0x33cb72['attributes'],function(_0x185df2){var _0x1f937e={};_0x1f937e[_0x185df2]={'$like':'%'+_0x269812[_0xb521('0x38')]['filter']+'%'};return _0x1f937e;})});}_0x33cb72=_[_0xb521('0x44')]({},_0x33cb72,_0x269812['options']);return db[_0xb521('0x5a')][_0xb521('0x47')](_0x33cb72);}})[_0xb521('0x2b')](function(_0x299048){if(_0x299048){return db[_0xb521('0x5d')][_0xb521('0x5e')]({'where':{'id':_['map'](_0x299048,'UserId'),'role':'agent'},'attributes':['id',_0xb521('0x37'),_0xb521('0x5f'),_0xb521('0x60'),_0xb521('0x61')]});}})['then'](function(_0x23daa9){if(_0x23daa9){return{'count':_0x23daa9[_0xb521('0x25')],'rows':_['map'](_0x23daa9[_0xb521('0x62')],function(_0x4908a6){return{'membername':_0x4908a6[_0xb521('0x37')],'UserId':_0x4908a6['id'],'queue_name':_0x5bdd9a[_0xb521('0x37')],'OpenchannelQueueId':_0x5bdd9a['id'],'interface':util[_0xb521('0x63')](_0xb521('0x64'),_0xb521('0x65'),_0x4908a6[_0xb521('0x37')]),'penalty':0x0,'paused':_0x4908a6['openchannelPause'],'createdAt':_0x4908a6[_0xb521('0x61')],'updatedAt':_0x4908a6[_0xb521('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb521('0x2b')](respondWithFilteredResult(_0x5995cd,_0x33cb72))[_0xb521('0x48')](handleError(_0x5995cd,null));};exports[_0xb521('0x66')]=function(_0x15232e,_0x20f533,_0x2cfa11){var _0x2ae2a0={};var _0x376eea={};var _0x2751fe;var _0x1ed862;return db[_0xb521('0x32')][_0xb521('0x59')]({'where':{'id':_0x15232e[_0xb521('0x4a')]['id']}})[_0xb521('0x2b')](handleEntityNotFound(_0x20f533,null))[_0xb521('0x2b')](function(_0x2ef447){if(_0x2ef447){_0x2751fe=_0x2ef447;_0x376eea[_0xb521('0x36')]=_[_0xb521('0x39')](db[_0xb521('0x67')]['rawAttributes']);_0x376eea[_0xb521('0x38')]=_[_0xb521('0x39')](_0x15232e[_0xb521('0x38')]);_0x376eea[_0xb521('0x3a')]=_[_0xb521('0x3b')](_0x376eea[_0xb521('0x36')],_0x376eea['query']);_0x2ae2a0['attributes']=_[_0xb521('0x3b')](_0x376eea[_0xb521('0x36')],qs['fields'](_0x15232e[_0xb521('0x38')][_0xb521('0x3d')]));_0x2ae2a0['attributes']=_0x2ae2a0[_0xb521('0x3c')]['length']?_0x2ae2a0[_0xb521('0x3c')]:_0x376eea[_0xb521('0x36')];_0x2ae2a0[_0xb521('0x41')]=qs[_0xb521('0x42')](_0x15232e['query'][_0xb521('0x42')]);_0x2ae2a0['where']=qs['filters'](_['pick'](_0x15232e[_0xb521('0x38')],_0x376eea[_0xb521('0x3a')]));if(_0x15232e[_0xb521('0x38')][_0xb521('0x46')]){_0x2ae2a0[_0xb521('0x43')]=_[_0xb521('0x44')](_0x2ae2a0[_0xb521('0x43')],{'$or':_[_0xb521('0x31')](_0x2ae2a0['attributes'],function(_0x2b5a77){var _0x5a0d1b={};_0x5a0d1b[_0x2b5a77]={'$like':'%'+_0x15232e[_0xb521('0x38')]['filter']+'%'};return _0x5a0d1b;})});}_0x2ae2a0=_[_0xb521('0x44')]({},_0x2ae2a0,_0x15232e[_0xb521('0x4d')]);return _0x2751fe['getTeams'](_0x2ae2a0);}})[_0xb521('0x2b')](function(_0x1c71ff){if(_0x1c71ff){_0x1ed862=_0x1c71ff[_0xb521('0x3e')];if(!_0x15232e[_0xb521('0x38')][_0xb521('0x3f')](_0xb521('0x40'))){_0x2ae2a0[_0xb521('0x24')]=qs['limit'](_0x15232e[_0xb521('0x38')][_0xb521('0x24')]);_0x2ae2a0['offset']=qs['offset'](_0x15232e[_0xb521('0x38')][_0xb521('0x22')]);}return _0x2751fe[_0xb521('0x66')](_0x2ae2a0);}})[_0xb521('0x2b')](function(_0x1e5657){if(_0x1e5657){return _0x1e5657?{'count':_0x1ed862,'rows':_0x1e5657}:null;}})[_0xb521('0x2b')](respondWithResult(_0x20f533,null))['catch'](handleError(_0x20f533,null));};exports['addTeams']=function(_0x427787,_0x542ca5,_0x5531e7){var _0xb53073=_0x427787[_0xb521('0x57')][_0xb521('0x68')];return db[_0xb521('0x67')][_0xb521('0x47')]({'where':{'id':_0xb53073},'attributes':['id'],'include':[{'model':db[_0xb521('0x5d')],'as':_0xb521('0x69'),'attributes':['id',_0xb521('0x37'),_0xb521('0x6a'),_0xb521('0x6b'),_0xb521('0x6c')],'raw':!![]}]})[_0xb521('0x2b')](function(_0x292bea){if(_0x292bea){var _0x23b5fe=_[_0xb521('0x6d')](_0x292bea,function(_0xe8f683){var _0x1ddd42=_0xe8f683['get']({'plain':!![]});return _0x1ddd42[_0xb521('0x69')];});return db[_0xb521('0x32')]['find']({'where':{'id':_0x427787['params']['id']}})[_0xb521('0x2b')](function(_0x59c182){return db['sequelize']['transaction'](function(_0x53d76f){return _0x59c182[_0xb521('0x6e')](_0xb53073,{'transaction':_0x53d76f})['then'](function(){return BPromise[_0xb521('0x6f')](_0x23b5fe,function(_0x1abd8a){return db[_0xb521('0x5a')][_0xb521('0x70')]({'where':{'UserId':_0x1abd8a['id'],'OpenchannelQueueId':_0x427787[_0xb521('0x4a')]['id']},'transaction':_0x53d76f});});})['then'](function(){_0x23b5fe[_0xb521('0x71')](function(_0x41479c){socket[_0xb521('0x72')](_0xb521('0x73'),{'UserId':_0x41479c['id'],'OpenchannelQueueId':_0x59c182['id']});});});});});}})['then'](respondWithStatusCode(_0x542ca5,null))['catch'](handleError(_0x542ca5,null));};exports['removeTeams']=function(_0xb07a6e,_0x1603f4,_0x2093b8){return db['Team'][_0xb521('0x47')]({'where':{'id':_0xb07a6e[_0xb521('0x38')][_0xb521('0x68')]},'attributes':['id'],'include':[{'model':db[_0xb521('0x5d')],'as':_0xb521('0x69'),'attributes':['id'],'raw':!![]}]})[_0xb521('0x2b')](handleEntityNotFound(_0x1603f4,null))[_0xb521('0x2b')](function(_0x2508ea){var _0x19fd79=_[_0xb521('0x31')](_0x2508ea,'id');var _0x199063=[];var _0x370909=[];var _0x29486d=squel[_0xb521('0x74')]();_0x29486d[_0xb521('0x75')](_0xb521('0x76'))[_0xb521('0x77')](_0xb521('0x78'),'tq')['join']('user_has_teams','ut',_0xb521('0x79'))[_0xb521('0x43')](_0xb521('0x7a'),_0xb07a6e[_0xb521('0x4a')]['id']);for(var _0x1bc2c8=0x0;_0x1bc2c8<_0x2508ea['length'];_0x1bc2c8+=0x1){let _0xaf7629=_0x2508ea[_0x1bc2c8];for(var _0x36921d=0x0;_0x36921d<_0xaf7629['Agents'][_0xb521('0x3e')];_0x36921d+=0x1){let _0x3a195a=_0xaf7629[_0xb521('0x69')][_0x36921d];var _0x498245=_0x29486d['clone']();_0x498245[_0xb521('0x43')]('ut.UserId\x20=\x20?',_0x3a195a['id']);_0x370909['push'](db[_0xb521('0x7b')]['query'](_0x498245[_0xb521('0x7c')](),{'type':db['sequelize'][_0xb521('0x7d')][_0xb521('0x7e')]})['then'](function(_0xc3ad21){if(_0xc3ad21['length']===0x1){return _0x3a195a['id'];}else{var _0x51690b=_[_0xb521('0x7f')](_[_0xb521('0x31')](_0xc3ad21,_0xb521('0x80')),function(_0x4bcee4){return _[_0xb521('0x81')](_0x19fd79,_0x4bcee4);});if(_0x51690b){return _0x3a195a['id'];}}}));}}return BPromise[_0xb521('0x82')](_0x370909)[_0xb521('0x2b')](function(_0x339b2d){_0x199063=_(_0x199063)[_0xb521('0x83')](_0x339b2d)[_0xb521('0x84')]()['value']();return db['OpenchannelQueue'][_0xb521('0x52')]({'where':{'id':_0xb07a6e[_0xb521('0x4a')]['id']}})['then'](function(_0x2eb032){return db['sequelize'][_0xb521('0x85')](function(_0x2b0e40){return _0x2eb032[_0xb521('0x86')](_0xb07a6e[_0xb521('0x38')][_0xb521('0x68')],{'transaction':_0x2b0e40})[_0xb521('0x2b')](function(){if(!_[_0xb521('0x87')](_0x199063)){return _0x2eb032[_0xb521('0x88')](_0x199063,{'transaction':_0x2b0e40});}})[_0xb521('0x2b')](function(){_0x199063[_0xb521('0x71')](function(_0x5cb0fd){socket[_0xb521('0x72')](_0xb521('0x89'),{'UserId':_0x5cb0fd,'OpenchannelQueueId':_0x2eb032['id']});});});});});});})[_0xb521('0x2b')](respondWithStatusCode(_0x1603f4,null))[_0xb521('0x48')](handleError(_0x1603f4,null));};exports['addAgents']=function(_0x19912a,_0x57f162,_0x289eab){return db[_0xb521('0x32')][_0xb521('0x52')]({'where':{'id':_0x19912a[_0xb521('0x4a')]['id']}})[_0xb521('0x2b')](handleEntityNotFound(_0x57f162,null))[_0xb521('0x2b')](function(_0x695c45){if(_0x695c45){return _0x695c45[_0xb521('0x8a')](_0x19912a['body'][_0xb521('0x68')],_['omit'](_0x19912a[_0xb521('0x57')],[_0xb521('0x68'),'id'])||{})[_0xb521('0x8b')](function(_0x3e9ae4){for(var _0x47a656=0x0;_0x47a656<_0x19912a[_0xb521('0x57')]['ids'][_0xb521('0x3e')];_0x47a656+=0x1){socket[_0xb521('0x72')](_0xb521('0x73'),{'UserId':Number(_0x19912a[_0xb521('0x57')][_0xb521('0x68')][_0x47a656]),'OpenchannelQueueId':Number(_0x19912a[_0xb521('0x4a')]['id'])});}return _0x3e9ae4;});}})['then'](respondWithResult(_0x57f162,null))[_0xb521('0x48')](handleError(_0x57f162,null));};exports['removeAgents']=function(_0x4aa1b8,_0x44660d,_0x124e4d){return db[_0xb521('0x32')][_0xb521('0x52')]({'where':{'id':_0x4aa1b8[_0xb521('0x4a')]['id']}})[_0xb521('0x2b')](handleEntityNotFound(_0x44660d,null))[_0xb521('0x2b')](function(_0x30dc8d){if(_0x30dc8d){return _0x30dc8d['removeAgents'](_0x4aa1b8[_0xb521('0x38')][_0xb521('0x68')])[_0xb521('0x2b')](function(){if(_[_0xb521('0x8c')](_0x4aa1b8[_0xb521('0x38')]['ids'])){for(var _0x1b2381=0x0;_0x1b2381<_0x4aa1b8[_0xb521('0x38')][_0xb521('0x68')][_0xb521('0x3e')];_0x1b2381+=0x1){socket[_0xb521('0x72')](_0xb521('0x89'),{'UserId':Number(_0x4aa1b8[_0xb521('0x38')][_0xb521('0x68')][_0x1b2381]),'OpenchannelQueueId':Number(_0x4aa1b8[_0xb521('0x4a')]['id'])});}}else{socket[_0xb521('0x72')](_0xb521('0x89'),{'UserId':Number(_0x4aa1b8[_0xb521('0x38')][_0xb521('0x68')]),'OpenchannelQueueId':Number(_0x4aa1b8[_0xb521('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x44660d,null))['catch'](handleError(_0x44660d,null));};exports[_0xb521('0x8d')]=function(_0x4e08c8,_0x31e1b0,_0x279660){var _0x794965={};var _0x5ec1e8={};var _0x5e19e3;var _0x5a7f15;return db[_0xb521('0x32')][_0xb521('0x59')]({'where':{'id':_0x4e08c8[_0xb521('0x4a')]['id']}})[_0xb521('0x2b')](handleEntityNotFound(_0x31e1b0,null))[_0xb521('0x2b')](function(_0x48bc61){if(_0x48bc61){_0x5e19e3=_0x48bc61;_0x5ec1e8[_0xb521('0x36')]=_[_0xb521('0x39')](db['User'][_0xb521('0x33')]);_0x5ec1e8[_0xb521('0x38')]=_[_0xb521('0x39')](_0x4e08c8[_0xb521('0x38')]);_0x5ec1e8[_0xb521('0x3a')]=_['intersection'](_0x5ec1e8[_0xb521('0x36')],_0x5ec1e8[_0xb521('0x38')]);_0x794965['attributes']=_[_0xb521('0x3b')](_0x5ec1e8[_0xb521('0x36')],qs['fields'](_0x4e08c8[_0xb521('0x38')][_0xb521('0x3d')]));_0x794965[_0xb521('0x3c')]=_0x794965[_0xb521('0x3c')][_0xb521('0x3e')]?_0x794965[_0xb521('0x3c')]:_0x5ec1e8[_0xb521('0x36')];_0x794965[_0xb521('0x41')]=qs['sort'](_0x4e08c8['query']['sort']);_0x794965[_0xb521('0x43')]=qs[_0xb521('0x3a')](_[_0xb521('0x5b')](_0x4e08c8[_0xb521('0x38')],_0x5ec1e8[_0xb521('0x3a')]));if(_0x4e08c8['query'][_0xb521('0x46')]){_0x794965['where']=_['merge'](_0x794965['where'],{'$or':_['map'](_0x794965['attributes'],function(_0x372164){var _0x3af668={};_0x3af668[_0x372164]={'$like':'%'+_0x4e08c8[_0xb521('0x38')][_0xb521('0x46')]+'%'};return _0x3af668;})});}_0x794965=_[_0xb521('0x44')]({},_0x794965,_0x4e08c8[_0xb521('0x4d')]);return _0x5e19e3[_0xb521('0x8d')](_0x794965);}})['then'](function(_0x4cfe78){if(_0x4cfe78){_0x5a7f15=_0x4cfe78[_0xb521('0x3e')];if(!_0x4e08c8[_0xb521('0x38')]['hasOwnProperty'](_0xb521('0x40'))){_0x794965[_0xb521('0x24')]=qs[_0xb521('0x24')](_0x4e08c8[_0xb521('0x38')][_0xb521('0x24')]);_0x794965[_0xb521('0x22')]=qs[_0xb521('0x22')](_0x4e08c8['query'][_0xb521('0x22')]);}return _0x5e19e3[_0xb521('0x8d')](_0x794965);}})[_0xb521('0x2b')](function(_0x30bb0e){if(_0x30bb0e){return _0x30bb0e?{'count':_0x5a7f15,'rows':_0x30bb0e}:null;}})['then'](respondWithResult(_0x31e1b0,null))[_0xb521('0x48')](handleError(_0x31e1b0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 86785e4..8d5a6aa 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 _0x8885=['OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x11bf71,_0x372160){var _0x4ea198=function(_0xb00044){while(--_0xb00044){_0x11bf71['push'](_0x11bf71['shift']());}};_0x4ea198(++_0x372160);}(_0x8885,0xd7));var _0x5888=function(_0x1bd7a3,_0x430724){_0x1bd7a3=_0x1bd7a3-0x0;var _0x596725=_0x8885[_0x1bd7a3];return _0x596725;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x5888('0x0'))['db'][_0x5888('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5888('0x2')](0x0);var events={'afterCreate':_0x5888('0x3'),'afterUpdate':_0x5888('0x4'),'afterDestroy':_0x5888('0x5')};function emitEvent(_0x104109){return function(_0x2a77e7,_0x4e761f,_0x3394bc){OpenchannelQueueEvents[_0x5888('0x6')](_0x104109+':'+_0x2a77e7['id'],_0x2a77e7);OpenchannelQueueEvents[_0x5888('0x6')](_0x104109,_0x2a77e7);_0x3394bc(null);};}for(var e in events){if(events[_0x5888('0x7')](e)){var event=events[e];OpenchannelQueue[_0x5888('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x6d10=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x6d10,0x10d));var _0x06d1=function(_0x15722b,_0x4cf961){_0x15722b=_0x15722b-0x0;var _0x29b1d0=_0x6d10[_0x15722b];return _0x29b1d0;};'use strict';var EventEmitter=require(_0x06d1('0x0'));var OpenchannelQueue=require(_0x06d1('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x06d1('0x2'),'afterUpdate':_0x06d1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3d61ef){return function(_0x590c57,_0x2b6c47,_0x354d36){OpenchannelQueueEvents['emit'](_0x3d61ef+':'+_0x590c57['id'],_0x590c57);OpenchannelQueueEvents[_0x06d1('0x4')](_0x3d61ef,_0x590c57);_0x354d36(null);};}for(var e in events){if(events[_0x06d1('0x5')](e)){var event=events[e];OpenchannelQueue[_0x06d1('0x6')](e,emitEvent(event));}}module[_0x06d1('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 abc1c9c..5226b9b 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 _0xdb80=['api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','define','openchannel_queues','util','../../config/logger'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xdb80,0x8d));var _0x0db8=function(_0x1786b7,_0x25bfc1){_0x1786b7=_0x1786b7-0x0;var _0x415e7c=_0xdb80[_0x1786b7];return _0x415e7c;};'use strict';var _=require('lodash');var util=require(_0x0db8('0x0'));var logger=require(_0x0db8('0x1'))(_0x0db8('0x2'));var moment=require('moment');var BPromise=require(_0x0db8('0x3'));var rp=require(_0x0db8('0x4'));var fs=require('fs');var path=require(_0x0db8('0x5'));var rimraf=require(_0x0db8('0x6'));var config=require(_0x0db8('0x7'));var attributes=require(_0x0db8('0x8'));module['exports']=function(_0x555659,_0x544ca3){return _0x555659[_0x0db8('0x9')]('OpenchannelQueue',attributes,{'tableName':_0x0db8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed38=['openchannel_queues','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x1c80ec,_0x2f32e4){var _0x5bd47e=function(_0x40ac12){while(--_0x40ac12){_0x1c80ec['push'](_0x1c80ec['shift']());}};_0x5bd47e(++_0x2f32e4);}(_0xed38,0x121));var _0x8ed3=function(_0x215b6f,_0x2af70a){_0x215b6f=_0x215b6f-0x0;var _0x731d2e=_0xed38[_0x215b6f];return _0x731d2e;};'use strict';var _=require(_0x8ed3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8ed3('0x1'));var moment=require('moment');var BPromise=require(_0x8ed3('0x2'));var rp=require(_0x8ed3('0x3'));var fs=require('fs');var path=require(_0x8ed3('0x4'));var rimraf=require(_0x8ed3('0x5'));var config=require(_0x8ed3('0x6'));var attributes=require(_0x8ed3('0x7'));module[_0x8ed3('0x8')]=function(_0x981f60,_0x394a90){return _0x981f60[_0x8ed3('0x9')](_0x8ed3('0xa'),attributes,{'tableName':_0x8ed3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 9b8ec1f..8d47c1f 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 _0x29c4=['result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue','find','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x5e13fe,_0x339218){var _0x26f143=function(_0x2990d7){while(--_0x2990d7){_0x5e13fe['push'](_0x5e13fe['shift']());}};_0x26f143(++_0x339218);}(_0x29c4,0x19c));var _0x429c=function(_0x218cb7,_0x57059b){_0x218cb7=_0x218cb7-0x0;var _0xe8f765=_0x29c4[_0x218cb7];return _0xe8f765;};'use strict';var _=require(_0x429c('0x0'));var util=require(_0x429c('0x1'));var moment=require('moment');var BPromise=require(_0x429c('0x2'));var rs=require(_0x429c('0x3'));var fs=require('fs');var Redis=require(_0x429c('0x4'));var db=require(_0x429c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x429c('0x6'))(_0x429c('0x7'));var config=require(_0x429c('0x8'));var jayson=require(_0x429c('0x9'));var client=jayson[_0x429c('0xa')][_0x429c('0xb')]({'port':0x232a});config['redis']=_[_0x429c('0xc')](config[_0x429c('0xd')],{'host':_0x429c('0xe'),'port':0x18eb});var socket=require(_0x429c('0xf'))(new Redis(config[_0x429c('0xd')]));require(_0x429c('0x10'))[_0x429c('0x11')](socket);function respondWithRpcPromise(_0x2d991a,_0x8ac722,_0x2881e9){return new BPromise(function(_0x425dd8,_0x1cbdcb){return client[_0x429c('0x12')](_0x2d991a,_0x2881e9)[_0x429c('0x13')](function(_0x398a4f){logger['info'](_0x429c('0x14'),_0x8ac722,'request\x20sent');logger[_0x429c('0x15')](_0x429c('0x16'),_0x8ac722,'request\x20sent',JSON[_0x429c('0x17')](_0x398a4f));if(_0x398a4f['error']){if(_0x398a4f[_0x429c('0x18')][_0x429c('0x19')]===0x1f4){logger[_0x429c('0x18')](_0x429c('0x14'),_0x8ac722,_0x398a4f[_0x429c('0x18')][_0x429c('0x1a')]);return _0x1cbdcb(_0x398a4f[_0x429c('0x18')][_0x429c('0x1a')]);}logger['error'](_0x429c('0x14'),_0x8ac722,_0x398a4f[_0x429c('0x18')]['message']);return _0x425dd8(_0x398a4f[_0x429c('0x18')][_0x429c('0x1a')]);}else{logger['info'](_0x429c('0x14'),_0x8ac722,_0x429c('0x1b'));_0x425dd8(_0x398a4f[_0x429c('0x1c')][_0x429c('0x1a')]);}})[_0x429c('0x1d')](function(_0x157b05){logger[_0x429c('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x8ac722,_0x157b05);_0x1cbdcb(_0x157b05);});});}exports[_0x429c('0x1e')]=function(_0x4465f8){var _0x238058=this;return new Promise(function(_0x2fc148,_0x51ec0c){return db[_0x429c('0x1f')][_0x429c('0x20')]({'raw':_0x4465f8[_0x429c('0x21')]?_0x4465f8[_0x429c('0x21')][_0x429c('0x22')]===undefined?!![]:![]:!![],'where':_0x4465f8[_0x429c('0x21')]?_0x4465f8[_0x429c('0x21')][_0x429c('0x23')]||null:null,'attributes':_0x4465f8['options']?_0x4465f8['options'][_0x429c('0x24')]||null:null,'limit':_0x4465f8[_0x429c('0x21')]?_0x4465f8[_0x429c('0x21')][_0x429c('0x25')]||null:null,'include':_0x4465f8[_0x429c('0x21')]?_0x4465f8[_0x429c('0x21')][_0x429c('0x26')]?_[_0x429c('0x27')](_0x4465f8[_0x429c('0x21')][_0x429c('0x26')],function(_0x5b73d7){return{'model':db[_0x5b73d7['model']],'as':_0x5b73d7['as'],'attributes':_0x5b73d7[_0x429c('0x24')],'include':_0x5b73d7[_0x429c('0x26')]?_['map'](_0x5b73d7[_0x429c('0x26')],function(_0x536e31){return{'model':db[_0x536e31[_0x429c('0x28')]],'as':_0x536e31['as'],'attributes':_0x536e31['attributes'],'include':_0x536e31['include']?_['map'](_0x536e31[_0x429c('0x26')],function(_0x18f191){return{'model':db[_0x18f191[_0x429c('0x28')]],'as':_0x18f191['as'],'attributes':_0x18f191[_0x429c('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d2eb2){logger['info']('GetOpenchannelQueue',_0x4465f8);logger[_0x429c('0x15')](_0x429c('0x1e'),_0x4465f8,JSON['stringify'](_0x3d2eb2));_0x2fc148(_0x3d2eb2);})[_0x429c('0x1d')](function(_0x99f6b9){logger[_0x429c('0x18')](_0x429c('0x1e'),_0x99f6b9[_0x429c('0x1a')],_0x4465f8);_0x51ec0c(_0x238058[_0x429c('0x18')](0x1f4,_0x99f6b9['message']));});});};exports[_0x429c('0x29')]=function(_0x3d48a3){var _0x1b5e5f=this;return new Promise(function(_0x25f58b,_0x5c6d7b){return db[_0x429c('0x1f')][_0x429c('0x2a')]({'raw':_0x3d48a3['options']?_0x3d48a3['options']['raw']===undefined?!![]:![]:!![],'where':_0x3d48a3[_0x429c('0x21')]?_0x3d48a3[_0x429c('0x21')][_0x429c('0x23')]||null:null,'attributes':_0x3d48a3['options']?_0x3d48a3[_0x429c('0x21')][_0x429c('0x24')]||null:null,'include':_0x3d48a3[_0x429c('0x21')]?_0x3d48a3['options']['include']?_[_0x429c('0x27')](_0x3d48a3['options'][_0x429c('0x26')],function(_0x45a8bf){return{'model':db[_0x45a8bf[_0x429c('0x28')]],'as':_0x45a8bf['as'],'attributes':_0x45a8bf[_0x429c('0x24')],'include':_0x45a8bf['include']?_['map'](_0x45a8bf[_0x429c('0x26')],function(_0x5a9182){return{'model':db[_0x5a9182[_0x429c('0x28')]],'as':_0x5a9182['as'],'attributes':_0x5a9182[_0x429c('0x24')],'include':_0x5a9182[_0x429c('0x26')]?_[_0x429c('0x27')](_0x5a9182[_0x429c('0x26')],function(_0x4a9f3d){return{'model':db[_0x4a9f3d['model']],'as':_0x4a9f3d['as'],'attributes':_0x4a9f3d[_0x429c('0x24')]};}):[]};}):[]};}):[]:[]})[_0x429c('0x13')](function(_0x5a0005){logger[_0x429c('0x2b')](_0x429c('0x29'),_0x3d48a3);logger[_0x429c('0x15')](_0x429c('0x29'),_0x3d48a3,JSON[_0x429c('0x17')](_0x5a0005));_0x25f58b(_0x5a0005);})[_0x429c('0x1d')](function(_0x51a2eb){logger['error'](_0x429c('0x29'),_0x51a2eb[_0x429c('0x1a')],_0x3d48a3);_0x5c6d7b(_0x1b5e5f[_0x429c('0x18')](0x1f4,_0x51a2eb[_0x429c('0x1a')]));});});}; \ No newline at end of file +var _0xfe2a=['message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','ShowOpenchannelQueue','OpenchannelQueue','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0xfe2a,0x1bf));var _0xafe2=function(_0xbbfe59,_0x46067f){_0xbbfe59=_0xbbfe59-0x0;var _0x28a2a4=_0xfe2a[_0xbbfe59];return _0x28a2a4;};'use strict';var _=require('lodash');var util=require(_0xafe2('0x0'));var moment=require(_0xafe2('0x1'));var BPromise=require(_0xafe2('0x2'));var rs=require(_0xafe2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xafe2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xafe2('0x5'));var jayson=require(_0xafe2('0x6'));var client=jayson[_0xafe2('0x7')][_0xafe2('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xafe2('0x9')],{'host':_0xafe2('0xa'),'port':0x18eb});var socket=require(_0xafe2('0xb'))(new Redis(config[_0xafe2('0x9')]));require('./openchannelQueue.socket')[_0xafe2('0xc')](socket);function respondWithRpcPromise(_0x5101e3,_0x2bb3a9,_0x92e159){return new BPromise(function(_0x22c904,_0x19f61a){return client[_0xafe2('0xd')](_0x5101e3,_0x92e159)['then'](function(_0x54df1b){logger[_0xafe2('0xe')](_0xafe2('0xf'),_0x2bb3a9,_0xafe2('0x10'));logger['debug'](_0xafe2('0x11'),_0x2bb3a9,'request\x20sent',JSON[_0xafe2('0x12')](_0x54df1b));if(_0x54df1b[_0xafe2('0x13')]){if(_0x54df1b[_0xafe2('0x13')][_0xafe2('0x14')]===0x1f4){logger[_0xafe2('0x13')](_0xafe2('0xf'),_0x2bb3a9,_0x54df1b[_0xafe2('0x13')][_0xafe2('0x15')]);return _0x19f61a(_0x54df1b[_0xafe2('0x13')][_0xafe2('0x15')]);}logger[_0xafe2('0x13')](_0xafe2('0xf'),_0x2bb3a9,_0x54df1b['error'][_0xafe2('0x15')]);return _0x22c904(_0x54df1b['error'][_0xafe2('0x15')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x2bb3a9,_0xafe2('0x10'));_0x22c904(_0x54df1b[_0xafe2('0x16')][_0xafe2('0x15')]);}})[_0xafe2('0x17')](function(_0x585da2){logger['error'](_0xafe2('0xf'),_0x2bb3a9,_0x585da2);_0x19f61a(_0x585da2);});});}exports[_0xafe2('0x18')]=function(_0x5136bc){var _0x784842=this;return new Promise(function(_0x3bf1e7,_0x61aa15){return db['OpenchannelQueue'][_0xafe2('0x19')]({'raw':_0x5136bc[_0xafe2('0x1a')]?_0x5136bc[_0xafe2('0x1a')][_0xafe2('0x1b')]===undefined?!![]:![]:!![],'where':_0x5136bc[_0xafe2('0x1a')]?_0x5136bc[_0xafe2('0x1a')][_0xafe2('0x1c')]||null:null,'attributes':_0x5136bc['options']?_0x5136bc[_0xafe2('0x1a')][_0xafe2('0x1d')]||null:null,'limit':_0x5136bc[_0xafe2('0x1a')]?_0x5136bc[_0xafe2('0x1a')][_0xafe2('0x1e')]||null:null,'include':_0x5136bc[_0xafe2('0x1a')]?_0x5136bc[_0xafe2('0x1a')][_0xafe2('0x1f')]?_[_0xafe2('0x20')](_0x5136bc[_0xafe2('0x1a')][_0xafe2('0x1f')],function(_0x563014){return{'model':db[_0x563014[_0xafe2('0x21')]],'as':_0x563014['as'],'attributes':_0x563014[_0xafe2('0x1d')],'include':_0x563014[_0xafe2('0x1f')]?_['map'](_0x563014['include'],function(_0x52121f){return{'model':db[_0x52121f[_0xafe2('0x21')]],'as':_0x52121f['as'],'attributes':_0x52121f[_0xafe2('0x1d')],'include':_0x52121f[_0xafe2('0x1f')]?_[_0xafe2('0x20')](_0x52121f[_0xafe2('0x1f')],function(_0x1ecf55){return{'model':db[_0x1ecf55[_0xafe2('0x21')]],'as':_0x1ecf55['as'],'attributes':_0x1ecf55[_0xafe2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xafe2('0x22')](function(_0x4e6c49){logger[_0xafe2('0xe')](_0xafe2('0x18'),_0x5136bc);logger[_0xafe2('0x23')]('GetOpenchannelQueue',_0x5136bc,JSON[_0xafe2('0x12')](_0x4e6c49));_0x3bf1e7(_0x4e6c49);})[_0xafe2('0x17')](function(_0xe34828){logger[_0xafe2('0x13')](_0xafe2('0x18'),_0xe34828['message'],_0x5136bc);_0x61aa15(_0x784842['error'](0x1f4,_0xe34828['message']));});});};exports[_0xafe2('0x24')]=function(_0x21d7c2){var _0x2cdbf4=this;return new Promise(function(_0x3920e7,_0x3721e9){return db[_0xafe2('0x25')][_0xafe2('0x26')]({'raw':_0x21d7c2[_0xafe2('0x1a')]?_0x21d7c2[_0xafe2('0x1a')][_0xafe2('0x1b')]===undefined?!![]:![]:!![],'where':_0x21d7c2[_0xafe2('0x1a')]?_0x21d7c2['options'][_0xafe2('0x1c')]||null:null,'attributes':_0x21d7c2['options']?_0x21d7c2['options']['attributes']||null:null,'include':_0x21d7c2[_0xafe2('0x1a')]?_0x21d7c2[_0xafe2('0x1a')]['include']?_[_0xafe2('0x20')](_0x21d7c2['options'][_0xafe2('0x1f')],function(_0x107edd){return{'model':db[_0x107edd[_0xafe2('0x21')]],'as':_0x107edd['as'],'attributes':_0x107edd[_0xafe2('0x1d')],'include':_0x107edd[_0xafe2('0x1f')]?_[_0xafe2('0x20')](_0x107edd[_0xafe2('0x1f')],function(_0x5b8739){return{'model':db[_0x5b8739['model']],'as':_0x5b8739['as'],'attributes':_0x5b8739[_0xafe2('0x1d')],'include':_0x5b8739[_0xafe2('0x1f')]?_[_0xafe2('0x20')](_0x5b8739[_0xafe2('0x1f')],function(_0x2981bc){return{'model':db[_0x2981bc['model']],'as':_0x2981bc['as'],'attributes':_0x2981bc[_0xafe2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xafe2('0x22')](function(_0x18c239){logger[_0xafe2('0xe')](_0xafe2('0x24'),_0x21d7c2);logger[_0xafe2('0x23')](_0xafe2('0x24'),_0x21d7c2,JSON[_0xafe2('0x12')](_0x18c239));_0x3920e7(_0x18c239);})['catch'](function(_0x140610){logger['error'](_0xafe2('0x24'),_0x140610[_0xafe2('0x15')],_0x21d7c2);_0x3721e9(_0x2cdbf4[_0xafe2('0x13')](0x1f4,_0x140610[_0xafe2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 6f02fde..1575be2 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 _0xd5ee=['./openchannelQueue.events','remove','update','removeListener','register','length','openchannelQueue:'];(function(_0x2b637f,_0x36cf91){var _0x398b37=function(_0x6372c3){while(--_0x6372c3){_0x2b637f['push'](_0x2b637f['shift']());}};_0x398b37(++_0x36cf91);}(_0xd5ee,0x93));var _0xed5e=function(_0x5ca5d1,_0x2c27f1){_0x5ca5d1=_0x5ca5d1-0x0;var _0x89feb8=_0xd5ee[_0x5ca5d1];return _0x89feb8;};'use strict';var OpenchannelQueueEvents=require(_0xed5e('0x0'));var events=['save',_0xed5e('0x1'),_0xed5e('0x2')];function createListener(_0x3d4b66,_0x4c9096){return function(_0x3180a2){_0x4c9096['emit'](_0x3d4b66,_0x3180a2);};}function removeListener(_0x175a58,_0x45be67){return function(){OpenchannelQueueEvents[_0xed5e('0x3')](_0x175a58,_0x45be67);};}exports[_0xed5e('0x4')]=function(_0x5d73e){for(var _0x465b37=0x0,_0x1f2ea7=events[_0xed5e('0x5')];_0x465b37<_0x1f2ea7;_0x465b37++){var _0x25e6c4=events[_0x465b37];var _0x7553ba=createListener(_0xed5e('0x6')+_0x25e6c4,_0x5d73e);OpenchannelQueueEvents['on'](_0x25e6c4,_0x7553ba);}}; \ No newline at end of file +var _0x3e6e=['remove','update','emit','removeListener','register','openchannelQueue:','save'];(function(_0xc144be,_0x385142){var _0x4ffd89=function(_0x4d5ca1){while(--_0x4d5ca1){_0xc144be['push'](_0xc144be['shift']());}};_0x4ffd89(++_0x385142);}(_0x3e6e,0x76));var _0xe3e6=function(_0x58cd72,_0xe6bdc6){_0x58cd72=_0x58cd72-0x0;var _0x54bfa8=_0x3e6e[_0x58cd72];return _0x54bfa8;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xe3e6('0x0'),_0xe3e6('0x1'),_0xe3e6('0x2')];function createListener(_0x2fcc06,_0x1d0789){return function(_0x333512){_0x1d0789[_0xe3e6('0x3')](_0x2fcc06,_0x333512);};}function removeListener(_0x66399d,_0x2dac9e){return function(){OpenchannelQueueEvents[_0xe3e6('0x4')](_0x66399d,_0x2dac9e);};}exports[_0xe3e6('0x5')]=function(_0x4652cd){for(var _0x51b64f=0x0,_0x42a072=events['length'];_0x51b64f<_0x42a072;_0x51b64f++){var _0x542462=events[_0x51b64f];var _0x4c5f0e=createListener(_0xe3e6('0x6')+_0x542462,_0x4652cd);OpenchannelQueueEvents['on'](_0x542462,_0x4c5f0e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 8c947a7..7c42383 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 _0x7693=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put'];(function(_0x525790,_0x1064af){var _0x3e82db=function(_0x214308){while(--_0x214308){_0x525790['push'](_0x525790['shift']());}};_0x3e82db(++_0x1064af);}(_0x7693,0xab));var _0x3769=function(_0x1e6cde,_0x80275){_0x1e6cde=_0x1e6cde-0x0;var _0x10a7c5=_0x7693[_0x1e6cde];return _0x10a7c5;};'use strict';var multer=require(_0x3769('0x0'));var util=require(_0x3769('0x1'));var path=require(_0x3769('0x2'));var timeout=require(_0x3769('0x3'));var express=require(_0x3769('0x4'));var router=express[_0x3769('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3769('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3769('0x7'));var controller=require(_0x3769('0x8'));router[_0x3769('0x9')]('/',auth[_0x3769('0xa')](),controller[_0x3769('0xb')]);router[_0x3769('0x9')](_0x3769('0xc'),auth['isAuthenticated'](),controller[_0x3769('0xd')]);router['get'](_0x3769('0xe'),auth[_0x3769('0xa')](),controller[_0x3769('0xf')]);router[_0x3769('0x10')]('/',auth[_0x3769('0xa')](),controller['create']);router[_0x3769('0x11')](_0x3769('0xe'),auth['isAuthenticated'](),controller[_0x3769('0x12')]);router[_0x3769('0x13')]('/:id',auth[_0x3769('0xa')](),controller[_0x3769('0x14')]);module['exports']=router; \ No newline at end of file +var _0x74ed=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','util'];(function(_0xbfa61c,_0x4d9a1d){var _0x45cd82=function(_0x4d87c1){while(--_0x4d87c1){_0xbfa61c['push'](_0xbfa61c['shift']());}};_0x45cd82(++_0x4d9a1d);}(_0x74ed,0x1db));var _0xd74e=function(_0x524c6f,_0x5df963){_0x524c6f=_0x524c6f-0x0;var _0x2fe6d3=_0x74ed[_0x524c6f];return _0x2fe6d3;};'use strict';var multer=require('multer');var util=require(_0xd74e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd74e('0x1'));var interaction=require(_0xd74e('0x2'));var config=require(_0xd74e('0x3'));var controller=require(_0xd74e('0x4'));router['get']('/',auth[_0xd74e('0x5')](),controller[_0xd74e('0x6')]);router[_0xd74e('0x7')](_0xd74e('0x8'),auth[_0xd74e('0x5')](),controller[_0xd74e('0x9')]);router[_0xd74e('0x7')](_0xd74e('0xa'),auth[_0xd74e('0x5')](),controller[_0xd74e('0xb')]);router[_0xd74e('0xc')]('/',auth[_0xd74e('0x5')](),controller[_0xd74e('0xd')]);router[_0xd74e('0xe')](_0xd74e('0xa'),auth[_0xd74e('0x5')](),controller[_0xd74e('0xf')]);router[_0xd74e('0x10')]('/:id',auth[_0xd74e('0x5')](),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 0b86fb0..da2f720 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 _0xc639=['moment','exports','STRING','DATE'];(function(_0x26371f,_0x3529d6){var _0x7bf77f=function(_0xaaf7ec){while(--_0xaaf7ec){_0x26371f['push'](_0x26371f['shift']());}};_0x7bf77f(++_0x3529d6);}(_0xc639,0x184));var _0x9c63=function(_0xd13a1e,_0x383e2e){_0xd13a1e=_0xd13a1e-0x0;var _0x29e8ad=_0xc639[_0xd13a1e];return _0x29e8ad;};'use strict';var moment=require(_0x9c63('0x0'));var Sequelize=require('sequelize');module[_0x9c63('0x1')]={'uniqueid':{'type':Sequelize[_0x9c63('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9c63('0x2')]},'joinAt':{'type':Sequelize[_0x9c63('0x3')]},'leaveAt':{'type':Sequelize[_0x9c63('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9c63('0x3')]},'reason':{'type':Sequelize[_0x9c63('0x2')]}}; \ No newline at end of file +var _0x3705=['exports','STRING','DATE','moment','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3705,0xe9));var _0x5370=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x3705[_0x4e676e];return _0x336a3c;};'use strict';var moment=require(_0x5370('0x0'));var Sequelize=require(_0x5370('0x1'));module[_0x5370('0x2')]={'uniqueid':{'type':Sequelize[_0x5370('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5370('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5370('0x4')]},'acceptAt':{'type':Sequelize[_0x5370('0x4')]},'exitAt':{'type':Sequelize[_0x5370('0x4')]},'reason':{'type':Sequelize[_0x5370('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 13cdcf2..cabf1a2 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 _0x0a79=['util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','keys','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','mustache'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x0a79,0xcd));var _0x90a7=function(_0x10c9c0,_0x3398e3){_0x10c9c0=_0x10c9c0-0x0;var _0x425a6e=_0x0a79[_0x10c9c0];return _0x425a6e;};'use strict';var emlformat=require(_0x90a7('0x0'));var rimraf=require(_0x90a7('0x1'));var zipdir=require(_0x90a7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90a7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x90a7('0x4'));var util=require(_0x90a7('0x5'));var path=require(_0x90a7('0x6'));var sox=require(_0x90a7('0x7'));var csv=require(_0x90a7('0x8'));var ejs=require(_0x90a7('0x9'));var fs=require('fs');var fs_extra=require(_0x90a7('0xa'));var _=require(_0x90a7('0xb'));var squel=require('squel');var crypto=require(_0x90a7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x90a7('0x8'));var querystring=require(_0x90a7('0xd'));var Papa=require(_0x90a7('0xe'));var Redis=require(_0x90a7('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x90a7('0x10'));var hardwareService=require(_0x90a7('0x11'));var logger=require(_0x90a7('0x12'))(_0x90a7('0x13'));var utils=require('../../config/utils');var config=require(_0x90a7('0x14'));var licenseUtil=require(_0x90a7('0x15'));var db=require(_0x90a7('0x16'))['db'];function respondWithStatusCode(_0x38e202,_0x1dce4e){_0x1dce4e=_0x1dce4e||0xcc;return function(_0x2b15c5){if(_0x2b15c5){return _0x38e202['sendStatus'](_0x1dce4e);}return _0x38e202[_0x90a7('0x17')](_0x1dce4e)['end']();};}function respondWithResult(_0x575771,_0xc9a787){_0xc9a787=_0xc9a787||0xc8;return function(_0x49ddc2){if(_0x49ddc2){return _0x575771['status'](_0xc9a787)[_0x90a7('0x18')](_0x49ddc2);}};}function respondWithFilteredResult(_0xe6f864,_0x229ca3){return function(_0xcf54a){if(_0xcf54a){var _0x4735b6=typeof _0x229ca3[_0x90a7('0x19')]===_0x90a7('0x1a')&&typeof _0x229ca3[_0x90a7('0x1b')]===_0x90a7('0x1a');var _0x50c525=_0xcf54a['count'];var _0x15491c=_0x4735b6?0x0:_0x229ca3[_0x90a7('0x19')];var _0x2464f9=_0x4735b6?_0xcf54a[_0x90a7('0x1c')]:_0x229ca3[_0x90a7('0x19')]+_0x229ca3['limit'];var _0x21452e;if(_0x2464f9>=_0x50c525){_0x2464f9=_0x50c525;_0x21452e=0xc8;}else{_0x21452e=0xce;}_0xe6f864[_0x90a7('0x17')](_0x21452e);return _0xe6f864[_0x90a7('0x1d')](_0x90a7('0x1e'),_0x15491c+'-'+_0x2464f9+'/'+_0x50c525)['json'](_0xcf54a);}return null;};}function patchUpdates(_0x15a8c0){return function(_0x7b9e9a){try{jsonpatch['apply'](_0x7b9e9a,_0x15a8c0,!![]);}catch(_0x2800d3){return BPromise['reject'](_0x2800d3);}return _0x7b9e9a['save']();};}function saveUpdates(_0x55e114,_0x4270bb){return function(_0x35b711){if(_0x35b711){return _0x35b711[_0x90a7('0x1f')](_0x55e114)[_0x90a7('0x20')](function(_0x188e3d){return _0x188e3d;});}return null;};}function removeEntity(_0x17d18f,_0x1099e9){return function(_0xd62205){if(_0xd62205){return _0xd62205['destroy']()[_0x90a7('0x20')](function(){_0x17d18f[_0x90a7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39aa99,_0x22491e){return function(_0x25621e){if(!_0x25621e){_0x39aa99[_0x90a7('0x21')](0x194);}return _0x25621e;};}function handleError(_0x52ac37,_0x2d484e){_0x2d484e=_0x2d484e||0x1f4;return function(_0x1ad4ed){logger[_0x90a7('0x22')](_0x1ad4ed['stack']);if(_0x1ad4ed['name']){delete _0x1ad4ed[_0x90a7('0x23')];}_0x52ac37[_0x90a7('0x17')](_0x2d484e)['send'](_0x1ad4ed);};}exports[_0x90a7('0x24')]=function(_0x5509c3,_0xfc1d9a){var _0x32d1ce={},_0x2aac38={},_0x46d8f7={'count':0x0,'rows':[]};var _0x346a29=_[_0x90a7('0x25')](db[_0x90a7('0x26')][_0x90a7('0x27')],function(_0x3cfba7){return{'name':_0x3cfba7[_0x90a7('0x28')],'type':_0x3cfba7[_0x90a7('0x29')]['key']};});_0x2aac38[_0x90a7('0x2a')]=_[_0x90a7('0x25')](_0x346a29,_0x90a7('0x23'));_0x2aac38[_0x90a7('0x2b')]=_['keys'](_0x5509c3[_0x90a7('0x2b')]);_0x2aac38[_0x90a7('0x2c')]=_[_0x90a7('0x2d')](_0x2aac38[_0x90a7('0x2a')],_0x2aac38['query']);_0x32d1ce[_0x90a7('0x2e')]=_['intersection'](_0x2aac38[_0x90a7('0x2a')],qs[_0x90a7('0x2f')](_0x5509c3[_0x90a7('0x2b')]['fields']));_0x32d1ce[_0x90a7('0x2e')]=_0x32d1ce['attributes'][_0x90a7('0x30')]?_0x32d1ce[_0x90a7('0x2e')]:_0x2aac38['model'];if(!_0x5509c3['query'][_0x90a7('0x31')](_0x90a7('0x32'))){_0x32d1ce[_0x90a7('0x1b')]=qs['limit'](_0x5509c3[_0x90a7('0x2b')][_0x90a7('0x1b')]);_0x32d1ce[_0x90a7('0x19')]=qs[_0x90a7('0x19')](_0x5509c3['query'][_0x90a7('0x19')]);}_0x32d1ce[_0x90a7('0x33')]=qs[_0x90a7('0x34')](_0x5509c3[_0x90a7('0x2b')][_0x90a7('0x34')]);_0x32d1ce[_0x90a7('0x35')]=qs[_0x90a7('0x2c')](_[_0x90a7('0x36')](_0x5509c3[_0x90a7('0x2b')],_0x2aac38['filters']),_0x346a29);if(_0x5509c3[_0x90a7('0x2b')][_0x90a7('0x37')]){_0x32d1ce['where']=_[_0x90a7('0x38')](_0x32d1ce['where'],{'$or':_[_0x90a7('0x25')](_0x346a29,function(_0x91b542){if(_0x91b542[_0x90a7('0x29')]!==_0x90a7('0x39')){var _0x5068c3={};_0x5068c3[_0x91b542[_0x90a7('0x23')]]={'$like':'%'+_0x5509c3['query'][_0x90a7('0x37')]+'%'};return _0x5068c3;}})});}_0x32d1ce=_[_0x90a7('0x38')]({},_0x32d1ce,_0x5509c3[_0x90a7('0x3a')]);var _0x108397={'where':_0x32d1ce['where']};return db[_0x90a7('0x26')][_0x90a7('0x1c')](_0x108397)[_0x90a7('0x20')](function(_0x2b00b9){_0x46d8f7[_0x90a7('0x1c')]=_0x2b00b9;if(_0x5509c3[_0x90a7('0x2b')][_0x90a7('0x3b')]){_0x32d1ce[_0x90a7('0x3c')]=[{'all':!![]}];}return db[_0x90a7('0x26')][_0x90a7('0x3d')](_0x32d1ce);})[_0x90a7('0x20')](function(_0x240232){_0x46d8f7['rows']=_0x240232;return _0x46d8f7;})['then'](respondWithFilteredResult(_0xfc1d9a,_0x32d1ce))['catch'](handleError(_0xfc1d9a,null));};exports['show']=function(_0x11a271,_0x57bae6){var _0x5db745={'raw':!![],'where':{'id':_0x11a271[_0x90a7('0x3e')]['id']}},_0x20d370={};_0x20d370['model']=_['keys'](db[_0x90a7('0x26')]['rawAttributes']);_0x20d370[_0x90a7('0x2b')]=_[_0x90a7('0x3f')](_0x11a271[_0x90a7('0x2b')]);_0x20d370['filters']=_['intersection'](_0x20d370[_0x90a7('0x2a')],_0x20d370['query']);_0x5db745[_0x90a7('0x2e')]=_[_0x90a7('0x2d')](_0x20d370['model'],qs[_0x90a7('0x2f')](_0x11a271[_0x90a7('0x2b')][_0x90a7('0x2f')]));_0x5db745[_0x90a7('0x2e')]=_0x5db745[_0x90a7('0x2e')][_0x90a7('0x30')]?_0x5db745['attributes']:_0x20d370['model'];if(_0x11a271[_0x90a7('0x2b')][_0x90a7('0x3b')]){_0x5db745[_0x90a7('0x3c')]=[{'all':!![]}];}_0x5db745=_[_0x90a7('0x38')]({},_0x5db745,_0x11a271[_0x90a7('0x3a')]);return db['OpenchannelQueueReport']['find'](_0x5db745)['then'](handleEntityNotFound(_0x57bae6,null))['then'](respondWithResult(_0x57bae6,null))[_0x90a7('0x40')](handleError(_0x57bae6,null));};exports[_0x90a7('0x41')]=function(_0x150814,_0x32bfea){return db['OpenchannelQueueReport'][_0x90a7('0x41')](_0x150814['body'],{})[_0x90a7('0x20')](respondWithResult(_0x32bfea,0xc9))[_0x90a7('0x40')](handleError(_0x32bfea,null));};exports[_0x90a7('0x1f')]=function(_0xf5f7d6,_0x1ffb9f){if(_0xf5f7d6[_0x90a7('0x42')]['id']){delete _0xf5f7d6[_0x90a7('0x42')]['id'];}return db[_0x90a7('0x26')][_0x90a7('0x43')]({'where':{'id':_0xf5f7d6[_0x90a7('0x3e')]['id']}})[_0x90a7('0x20')](handleEntityNotFound(_0x1ffb9f,null))[_0x90a7('0x20')](saveUpdates(_0xf5f7d6[_0x90a7('0x42')],null))[_0x90a7('0x20')](respondWithResult(_0x1ffb9f,null))[_0x90a7('0x40')](handleError(_0x1ffb9f,null));};exports[_0x90a7('0x44')]=function(_0x13e883,_0x293024){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x13e883['params']['id']}})[_0x90a7('0x20')](handleEntityNotFound(_0x293024,null))[_0x90a7('0x20')](removeEntity(_0x293024,null))['catch'](handleError(_0x293024,null));};exports['describe']=function(_0x41a02c,_0x1e25b6){return db[_0x90a7('0x26')][_0x90a7('0x45')]()[_0x90a7('0x20')](respondWithResult(_0x1e25b6,null))['catch'](handleError(_0x1e25b6,null));}; \ No newline at end of file +var _0xd26f=['status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','catch','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus'];(function(_0x12939d,_0x24971d){var _0x38f9ab=function(_0x23a8d5){while(--_0x23a8d5){_0x12939d['push'](_0x12939d['shift']());}};_0x38f9ab(++_0x24971d);}(_0xd26f,0x85));var _0xfd26=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xd26f[_0x18ab2a];return _0x16dcee;};'use strict';var emlformat=require(_0xfd26('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd26('0x1'));var jsonpatch=require(_0xfd26('0x2'));var rp=require(_0xfd26('0x3'));var moment=require(_0xfd26('0x4'));var BPromise=require(_0xfd26('0x5'));var Mustache=require(_0xfd26('0x6'));var util=require(_0xfd26('0x7'));var path=require(_0xfd26('0x8'));var sox=require(_0xfd26('0x9'));var csv=require(_0xfd26('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfd26('0xb'));var _=require(_0xfd26('0xc'));var squel=require(_0xfd26('0xd'));var crypto=require(_0xfd26('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfd26('0xf'));var toCsv=require(_0xfd26('0xa'));var querystring=require(_0xfd26('0x10'));var Papa=require(_0xfd26('0x11'));var Redis=require(_0xfd26('0x12'));var authService=require(_0xfd26('0x13'));var qs=require(_0xfd26('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd26('0x15'));var logger=require(_0xfd26('0x16'))(_0xfd26('0x17'));var utils=require(_0xfd26('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xfd26('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b025c,_0x2cbafe){_0x2cbafe=_0x2cbafe||0xcc;return function(_0x49f1d1){if(_0x49f1d1){return _0x1b025c[_0xfd26('0x1a')](_0x2cbafe);}return _0x1b025c[_0xfd26('0x1b')](_0x2cbafe)[_0xfd26('0x1c')]();};}function respondWithResult(_0x36d803,_0x2541f4){_0x2541f4=_0x2541f4||0xc8;return function(_0x4943fd){if(_0x4943fd){return _0x36d803[_0xfd26('0x1b')](_0x2541f4)[_0xfd26('0x1d')](_0x4943fd);}};}function respondWithFilteredResult(_0x3752df,_0x5e58d4){return function(_0x2411a6){if(_0x2411a6){var _0x35bd6b=typeof _0x5e58d4[_0xfd26('0x1e')]==='undefined'&&typeof _0x5e58d4[_0xfd26('0x1f')]===_0xfd26('0x20');var _0xa29d4b=_0x2411a6[_0xfd26('0x21')];var _0x56b5ba=_0x35bd6b?0x0:_0x5e58d4[_0xfd26('0x1e')];var _0x33c3cd=_0x35bd6b?_0x2411a6[_0xfd26('0x21')]:_0x5e58d4[_0xfd26('0x1e')]+_0x5e58d4[_0xfd26('0x1f')];var _0x1861e2;if(_0x33c3cd>=_0xa29d4b){_0x33c3cd=_0xa29d4b;_0x1861e2=0xc8;}else{_0x1861e2=0xce;}_0x3752df[_0xfd26('0x1b')](_0x1861e2);return _0x3752df[_0xfd26('0x22')](_0xfd26('0x23'),_0x56b5ba+'-'+_0x33c3cd+'/'+_0xa29d4b)[_0xfd26('0x1d')](_0x2411a6);}return null;};}function patchUpdates(_0x49422f){return function(_0x604b84){try{jsonpatch[_0xfd26('0x24')](_0x604b84,_0x49422f,!![]);}catch(_0x4d44aa){return BPromise[_0xfd26('0x25')](_0x4d44aa);}return _0x604b84[_0xfd26('0x26')]();};}function saveUpdates(_0x3f722e,_0xa01220){return function(_0x4eecd2){if(_0x4eecd2){return _0x4eecd2[_0xfd26('0x27')](_0x3f722e)[_0xfd26('0x28')](function(_0x33f0b4){return _0x33f0b4;});}return null;};}function removeEntity(_0x58ecb1,_0x37947e){return function(_0x51c204){if(_0x51c204){return _0x51c204[_0xfd26('0x29')]()[_0xfd26('0x28')](function(){_0x58ecb1[_0xfd26('0x1b')](0xcc)[_0xfd26('0x1c')]();});}};}function handleEntityNotFound(_0x458e6a,_0x26b9ae){return function(_0x186acf){if(!_0x186acf){_0x458e6a[_0xfd26('0x1a')](0x194);}return _0x186acf;};}function handleError(_0x2ccf84,_0x2f54a4){_0x2f54a4=_0x2f54a4||0x1f4;return function(_0x3d2fd1){logger[_0xfd26('0x2a')](_0x3d2fd1[_0xfd26('0x2b')]);if(_0x3d2fd1['name']){delete _0x3d2fd1[_0xfd26('0x2c')];}_0x2ccf84['status'](_0x2f54a4)[_0xfd26('0x2d')](_0x3d2fd1);};}exports[_0xfd26('0x2e')]=function(_0x3c1785,_0x2e4902){var _0x1413ef={},_0x3d668a={},_0x3f216d={'count':0x0,'rows':[]};var _0x50c28a=_[_0xfd26('0x2f')](db[_0xfd26('0x30')][_0xfd26('0x31')],function(_0x20cf7d){return{'name':_0x20cf7d[_0xfd26('0x32')],'type':_0x20cf7d[_0xfd26('0x33')]['key']};});_0x3d668a['model']=_['map'](_0x50c28a,_0xfd26('0x2c'));_0x3d668a[_0xfd26('0x34')]=_[_0xfd26('0x35')](_0x3c1785[_0xfd26('0x34')]);_0x3d668a[_0xfd26('0x36')]=_[_0xfd26('0x37')](_0x3d668a[_0xfd26('0x38')],_0x3d668a[_0xfd26('0x34')]);_0x1413ef[_0xfd26('0x39')]=_[_0xfd26('0x37')](_0x3d668a['model'],qs[_0xfd26('0x3a')](_0x3c1785[_0xfd26('0x34')][_0xfd26('0x3a')]));_0x1413ef[_0xfd26('0x39')]=_0x1413ef[_0xfd26('0x39')][_0xfd26('0x3b')]?_0x1413ef[_0xfd26('0x39')]:_0x3d668a['model'];if(!_0x3c1785[_0xfd26('0x34')][_0xfd26('0x3c')](_0xfd26('0x3d'))){_0x1413ef[_0xfd26('0x1f')]=qs[_0xfd26('0x1f')](_0x3c1785[_0xfd26('0x34')][_0xfd26('0x1f')]);_0x1413ef[_0xfd26('0x1e')]=qs['offset'](_0x3c1785['query'][_0xfd26('0x1e')]);}_0x1413ef['order']=qs[_0xfd26('0x3e')](_0x3c1785[_0xfd26('0x34')][_0xfd26('0x3e')]);_0x1413ef[_0xfd26('0x3f')]=qs[_0xfd26('0x36')](_[_0xfd26('0x40')](_0x3c1785[_0xfd26('0x34')],_0x3d668a[_0xfd26('0x36')]),_0x50c28a);if(_0x3c1785[_0xfd26('0x34')][_0xfd26('0x41')]){_0x1413ef['where']=_[_0xfd26('0x42')](_0x1413ef[_0xfd26('0x3f')],{'$or':_[_0xfd26('0x2f')](_0x50c28a,function(_0x1f5635){if(_0x1f5635[_0xfd26('0x33')]!==_0xfd26('0x43')){var _0x28f0d8={};_0x28f0d8[_0x1f5635['name']]={'$like':'%'+_0x3c1785[_0xfd26('0x34')][_0xfd26('0x41')]+'%'};return _0x28f0d8;}})});}_0x1413ef=_[_0xfd26('0x42')]({},_0x1413ef,_0x3c1785[_0xfd26('0x44')]);var _0x191725={'where':_0x1413ef[_0xfd26('0x3f')]};return db[_0xfd26('0x30')]['count'](_0x191725)[_0xfd26('0x28')](function(_0x33079b){_0x3f216d[_0xfd26('0x21')]=_0x33079b;if(_0x3c1785['query'][_0xfd26('0x45')]){_0x1413ef[_0xfd26('0x46')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xfd26('0x47')](_0x1413ef);})[_0xfd26('0x28')](function(_0x1ea437){_0x3f216d[_0xfd26('0x48')]=_0x1ea437;return _0x3f216d;})[_0xfd26('0x28')](respondWithFilteredResult(_0x2e4902,_0x1413ef))['catch'](handleError(_0x2e4902,null));};exports[_0xfd26('0x49')]=function(_0x2341ac,_0x201b98){var _0x41e45d={'raw':!![],'where':{'id':_0x2341ac['params']['id']}},_0x4be98f={};_0x4be98f[_0xfd26('0x38')]=_[_0xfd26('0x35')](db[_0xfd26('0x30')]['rawAttributes']);_0x4be98f['query']=_[_0xfd26('0x35')](_0x2341ac[_0xfd26('0x34')]);_0x4be98f[_0xfd26('0x36')]=_[_0xfd26('0x37')](_0x4be98f['model'],_0x4be98f[_0xfd26('0x34')]);_0x41e45d[_0xfd26('0x39')]=_[_0xfd26('0x37')](_0x4be98f[_0xfd26('0x38')],qs[_0xfd26('0x3a')](_0x2341ac['query']['fields']));_0x41e45d[_0xfd26('0x39')]=_0x41e45d[_0xfd26('0x39')]['length']?_0x41e45d[_0xfd26('0x39')]:_0x4be98f['model'];if(_0x2341ac[_0xfd26('0x34')][_0xfd26('0x45')]){_0x41e45d['include']=[{'all':!![]}];}_0x41e45d=_[_0xfd26('0x42')]({},_0x41e45d,_0x2341ac[_0xfd26('0x44')]);return db[_0xfd26('0x30')][_0xfd26('0x4a')](_0x41e45d)['then'](handleEntityNotFound(_0x201b98,null))[_0xfd26('0x28')](respondWithResult(_0x201b98,null))['catch'](handleError(_0x201b98,null));};exports[_0xfd26('0x4b')]=function(_0x5838d4,_0x556773){return db[_0xfd26('0x30')]['create'](_0x5838d4['body'],{})['then'](respondWithResult(_0x556773,0xc9))[_0xfd26('0x4c')](handleError(_0x556773,null));};exports[_0xfd26('0x27')]=function(_0x86b293,_0x314fb4){if(_0x86b293[_0xfd26('0x4d')]['id']){delete _0x86b293[_0xfd26('0x4d')]['id'];}return db[_0xfd26('0x30')][_0xfd26('0x4a')]({'where':{'id':_0x86b293[_0xfd26('0x4e')]['id']}})[_0xfd26('0x28')](handleEntityNotFound(_0x314fb4,null))[_0xfd26('0x28')](saveUpdates(_0x86b293[_0xfd26('0x4d')],null))[_0xfd26('0x28')](respondWithResult(_0x314fb4,null))[_0xfd26('0x4c')](handleError(_0x314fb4,null));};exports[_0xfd26('0x29')]=function(_0x39d051,_0xfb66a6){return db[_0xfd26('0x30')][_0xfd26('0x4a')]({'where':{'id':_0x39d051[_0xfd26('0x4e')]['id']}})[_0xfd26('0x28')](handleEntityNotFound(_0xfb66a6,null))[_0xfd26('0x28')](removeEntity(_0xfb66a6,null))['catch'](handleError(_0xfb66a6,null));};exports[_0xfd26('0x4f')]=function(_0x229ef8,_0x343004){return db[_0xfd26('0x30')][_0xfd26('0x4f')]()[_0xfd26('0x28')](respondWithResult(_0x343004,null))[_0xfd26('0x4c')](handleError(_0x343004,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 07590b4..8025165 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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x47aa40,_0xc8dd82){var _0x233863=function(_0x32ed8e){while(--_0x32ed8e){_0x47aa40['push'](_0x47aa40['shift']());}};_0x233863(++_0xc8dd82);}(_0x7a54,0x106));var _0x47a5=function(_0x2b9362,_0x44899a){_0x2b9362=_0x2b9362-0x0;var _0x47b845=_0x7a54[_0x2b9362];return _0x47b845;};'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':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x1b990c,_0x1cd7fe){var _0x24e644=function(_0x4cb7a3){while(--_0x4cb7a3){_0x1b990c['push'](_0x1b990c['shift']());}};_0x24e644(++_0x1cd7fe);}(_0x1261,0x144));var _0x1126=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x1261[_0x21353c];return _0xa99120;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 61f5181..4624d90 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 _0x0b0e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','create','options','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','raw','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1856de,_0x2ddafd){var _0x5d19c9=function(_0x2f4ab0){while(--_0x2f4ab0){_0x1856de['push'](_0x1856de['shift']());}};_0x5d19c9(++_0x2ddafd);}(_0x0b0e,0x187));var _0xe0b0=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0x0b0e[_0x316c42];return _0x2b38f7;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});}exports['CreateOpenchannelQueueReport']=function(_0x54a3eb){var _0x46bb44=this;return new Promise(function(_0x50a441,_0x4df8da){return db['OpenchannelQueueReport'][_0xe0b0('0x18')](_0x54a3eb['body'],{'raw':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xe0b0('0xd')](function(_0x5dba2f){logger[_0xe0b0('0xe')](_0xe0b0('0x1a'),_0x54a3eb);logger[_0xe0b0('0x10')](_0xe0b0('0x1a'),_0x54a3eb,JSON[_0xe0b0('0x12')](_0x5dba2f));_0x50a441(_0x5dba2f);})['catch'](function(_0x4cae54){logger[_0xe0b0('0x13')]('CreateOpenchannelQueueReport',_0x4cae54[_0xe0b0('0x14')],_0x54a3eb);_0x4df8da(_0x46bb44[_0xe0b0('0x13')](0x1f4,_0x4cae54['message']));});});};exports[_0xe0b0('0x1b')]=function(_0x503883){var _0x2208d0=this;return new Promise(function(_0x49a727,_0x28586d){return db['OpenchannelQueueReport'][_0xe0b0('0x1c')](_0x503883['body'],{'raw':_0x503883[_0xe0b0('0x19')]?_0x503883['options'][_0xe0b0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x503883['options']?_0x503883[_0xe0b0('0x19')][_0xe0b0('0x1e')]||null:null,'attributes':_0x503883[_0xe0b0('0x19')]?_0x503883[_0xe0b0('0x19')][_0xe0b0('0x1f')]||null:null,'limit':_0x503883[_0xe0b0('0x19')]?_0x503883['options'][_0xe0b0('0x20')]||null:null})[_0xe0b0('0xd')](function(_0x5b7a64){logger[_0xe0b0('0xe')](_0xe0b0('0x1b'),_0x503883);logger[_0xe0b0('0x10')](_0xe0b0('0x1b'),_0x503883,JSON[_0xe0b0('0x12')](_0x5b7a64));_0x49a727(_0x5b7a64);})[_0xe0b0('0x17')](function(_0x136bd4){logger['error'](_0xe0b0('0x1b'),_0x136bd4[_0xe0b0('0x14')],_0x503883);_0x28586d(_0x2208d0['error'](0x1f4,_0x136bd4['message']));});});}; \ No newline at end of file +var _0xa9fc=['body','options','raw','CreateOpenchannelQueueReport','stringify','catch','UpdateOpenchannelQueueReport','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','OpenchannelQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9fc,0x19f));var _0xca9f=function(_0x163742,_0x467e36){_0x163742=_0x163742-0x0;var _0x1152ac=_0xa9fc[_0x163742];return _0x1152ac;};'use strict';var _=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var moment=require(_0xca9f('0x2'));var BPromise=require(_0xca9f('0x3'));var rs=require(_0xca9f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca9f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xca9f('0x6'))(_0xca9f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xca9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48f9ca,_0x39963d,_0x61b1b6){return new BPromise(function(_0x400980,_0xf7ebb1){return client[_0xca9f('0x9')](_0x48f9ca,_0x61b1b6)[_0xca9f('0xa')](function(_0x4713f0){logger[_0xca9f('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x39963d,_0xca9f('0xc'));logger[_0xca9f('0xd')](_0xca9f('0xe'),_0x39963d,_0xca9f('0xc'),JSON['stringify'](_0x4713f0));if(_0x4713f0[_0xca9f('0xf')]){if(_0x4713f0[_0xca9f('0xf')]['code']===0x1f4){logger[_0xca9f('0xf')](_0xca9f('0x10'),_0x39963d,_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);return _0xf7ebb1(_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);}logger[_0xca9f('0xf')](_0xca9f('0x10'),_0x39963d,_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);return _0x400980(_0x4713f0['error']['message']);}else{logger[_0xca9f('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x39963d,'request\x20sent');_0x400980(_0x4713f0[_0xca9f('0x12')][_0xca9f('0x11')]);}})['catch'](function(_0x4afedf){logger['error'](_0xca9f('0x10'),_0x39963d,_0x4afedf);_0xf7ebb1(_0x4afedf);});});}exports['CreateOpenchannelQueueReport']=function(_0x22c161){var _0x2b3cfc=this;return new Promise(function(_0x1543aa,_0x83aa2b){return db[_0xca9f('0x13')]['create'](_0x22c161[_0xca9f('0x14')],{'raw':_0x22c161['options']?_0x22c161[_0xca9f('0x15')][_0xca9f('0x16')]===undefined?!![]:![]:!![]})[_0xca9f('0xa')](function(_0x2799e8){logger[_0xca9f('0xb')]('CreateOpenchannelQueueReport',_0x22c161);logger[_0xca9f('0xd')](_0xca9f('0x17'),_0x22c161,JSON[_0xca9f('0x18')](_0x2799e8));_0x1543aa(_0x2799e8);})[_0xca9f('0x19')](function(_0x239b30){logger['error']('CreateOpenchannelQueueReport',_0x239b30[_0xca9f('0x11')],_0x22c161);_0x83aa2b(_0x2b3cfc[_0xca9f('0xf')](0x1f4,_0x239b30[_0xca9f('0x11')]));});});};exports[_0xca9f('0x1a')]=function(_0x319b3b){var _0x558ecd=this;return new Promise(function(_0x40ef71,_0x1f7939){return db[_0xca9f('0x13')]['update'](_0x319b3b[_0xca9f('0x14')],{'raw':_0x319b3b[_0xca9f('0x15')]?_0x319b3b[_0xca9f('0x15')][_0xca9f('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x319b3b[_0xca9f('0x15')]?_0x319b3b['options'][_0xca9f('0x1b')]||null:null,'attributes':_0x319b3b[_0xca9f('0x15')]?_0x319b3b[_0xca9f('0x15')][_0xca9f('0x1c')]||null:null,'limit':_0x319b3b[_0xca9f('0x15')]?_0x319b3b['options']['limit']||null:null})[_0xca9f('0xa')](function(_0x5dfa6f){logger[_0xca9f('0xb')](_0xca9f('0x1a'),_0x319b3b);logger[_0xca9f('0xd')](_0xca9f('0x1a'),_0x319b3b,JSON['stringify'](_0x5dfa6f));_0x40ef71(_0x5dfa6f);})['catch'](function(_0xf153c8){logger['error'](_0xca9f('0x1a'),_0xf153c8['message'],_0x319b3b);_0x1f7939(_0x558ecd[_0xca9f('0xf')](0x1f4,_0xf153c8[_0xca9f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 9589df5..7a1a394 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 _0x4805=['get','isAuthenticated','index','/describe','/:id','post','put','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./openchannelTransferReport.controller'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4805,0x69));var _0x5480=function(_0xca468e,_0x1e615d){_0xca468e=_0xca468e-0x0;var _0xc9faf3=_0x4805[_0xca468e];return _0xc9faf3;};'use strict';var multer=require(_0x5480('0x0'));var util=require('util');var path=require(_0x5480('0x1'));var timeout=require(_0x5480('0x2'));var express=require(_0x5480('0x3'));var router=express['Router']();var fs_extra=require(_0x5480('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5480('0x5'));var config=require('../../config/environment');var controller=require(_0x5480('0x6'));router[_0x5480('0x7')]('/',auth[_0x5480('0x8')](),controller[_0x5480('0x9')]);router[_0x5480('0x7')](_0x5480('0xa'),auth[_0x5480('0x8')](),controller['describe']);router[_0x5480('0x7')](_0x5480('0xb'),auth[_0x5480('0x8')](),controller['show']);router[_0x5480('0xc')]('/',auth[_0x5480('0x8')](),controller['create']);router[_0x5480('0xd')](_0x5480('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x5480('0xe')](_0x5480('0xb'),auth['isAuthenticated'](),controller[_0x5480('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe353=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update'];(function(_0x10b9ef,_0xa4240){var _0x52041c=function(_0x5e7402){while(--_0x5e7402){_0x10b9ef['push'](_0x10b9ef['shift']());}};_0x52041c(++_0xa4240);}(_0xe353,0x1d1));var _0x3e35=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xe353[_0x4b7895];return _0x264180;};'use strict';var multer=require(_0x3e35('0x0'));var util=require(_0x3e35('0x1'));var path=require(_0x3e35('0x2'));var timeout=require(_0x3e35('0x3'));var express=require(_0x3e35('0x4'));var router=express[_0x3e35('0x5')]();var fs_extra=require(_0x3e35('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3e35('0x7'));var controller=require(_0x3e35('0x8'));router[_0x3e35('0x9')]('/',auth['isAuthenticated'](),controller[_0x3e35('0xa')]);router['get'](_0x3e35('0xb'),auth[_0x3e35('0xc')](),controller[_0x3e35('0xd')]);router[_0x3e35('0x9')](_0x3e35('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x3e35('0xf')]('/',auth['isAuthenticated'](),controller[_0x3e35('0x10')]);router[_0x3e35('0x11')]('/:id',auth[_0x3e35('0xc')](),controller[_0x3e35('0x12')]);router[_0x3e35('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x3e35('0x14')]);module[_0x3e35('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 5562aee..a382460 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x3fcf30,_0xe3a49e){var _0x2ed4b0=function(_0x306e68){while(--_0x306e68){_0x3fcf30['push'](_0x3fcf30['shift']());}};_0x2ed4b0(++_0xe3a49e);}(_0x54ef,0x112));var _0xf54e=function(_0x2010e2,_0xa6bec){_0x2010e2=_0x2010e2-0x0;var _0x68a235=_0x54ef[_0x2010e2];return _0x68a235;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x1ed034,_0x5d495d){var _0x4a82b7=function(_0x348231){while(--_0x348231){_0x1ed034['push'](_0x1ed034['shift']());}};_0x4a82b7(++_0x5d495d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 844dc48..980260c 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 _0x80b5=['limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','model','query','attributes','intersection','fields','length','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x80b5,0x70));var _0x580b=function(_0x561049,_0x330926){_0x561049=_0x561049-0x0;var _0x52f109=_0x80b5[_0x561049];return _0x52f109;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x580b('0x0'));var zipdir=require(_0x580b('0x1'));var jsonpatch=require(_0x580b('0x2'));var rp=require(_0x580b('0x3'));var moment=require(_0x580b('0x4'));var BPromise=require(_0x580b('0x5'));var Mustache=require(_0x580b('0x6'));var util=require('util');var path=require(_0x580b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x580b('0x8'));var _=require(_0x580b('0x9'));var squel=require(_0x580b('0xa'));var crypto=require(_0x580b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x580b('0xc'));var toCsv=require(_0x580b('0xd'));var querystring=require(_0x580b('0xe'));var Papa=require(_0x580b('0xf'));var Redis=require(_0x580b('0x10'));var authService=require(_0x580b('0x11'));var qs=require(_0x580b('0x12'));var as=require(_0x580b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x580b('0x14'))('api');var utils=require(_0x580b('0x15'));var config=require(_0x580b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x580b('0x17'))['db'];function respondWithStatusCode(_0x1b57b5,_0x31e256){_0x31e256=_0x31e256||0xcc;return function(_0x1b493e){if(_0x1b493e){return _0x1b57b5[_0x580b('0x18')](_0x31e256);}return _0x1b57b5[_0x580b('0x19')](_0x31e256)['end']();};}function respondWithResult(_0x3ab0bc,_0x30d9fa){_0x30d9fa=_0x30d9fa||0xc8;return function(_0x295b17){if(_0x295b17){return _0x3ab0bc[_0x580b('0x19')](_0x30d9fa)[_0x580b('0x1a')](_0x295b17);}};}function respondWithFilteredResult(_0x705df4,_0x49d1f3){return function(_0x3c4616){if(_0x3c4616){var _0x1cca90=typeof _0x49d1f3[_0x580b('0x1b')]==='undefined'&&typeof _0x49d1f3[_0x580b('0x1c')]===_0x580b('0x1d');var _0x2dda2c=_0x3c4616['count'];var _0x48ea5f=_0x1cca90?0x0:_0x49d1f3['offset'];var _0x2edc4f=_0x1cca90?_0x3c4616[_0x580b('0x1e')]:_0x49d1f3['offset']+_0x49d1f3[_0x580b('0x1c')];var _0x661dd9;if(_0x2edc4f>=_0x2dda2c){_0x2edc4f=_0x2dda2c;_0x661dd9=0xc8;}else{_0x661dd9=0xce;}_0x705df4[_0x580b('0x19')](_0x661dd9);return _0x705df4[_0x580b('0x1f')]('Content-Range',_0x48ea5f+'-'+_0x2edc4f+'/'+_0x2dda2c)['json'](_0x3c4616);}return null;};}function patchUpdates(_0x312866){return function(_0x470874){try{jsonpatch[_0x580b('0x20')](_0x470874,_0x312866,!![]);}catch(_0x4f205d){return BPromise[_0x580b('0x21')](_0x4f205d);}return _0x470874['save']();};}function saveUpdates(_0x3a16cf,_0x9c245f){return function(_0x2d1516){if(_0x2d1516){return _0x2d1516[_0x580b('0x22')](_0x3a16cf)[_0x580b('0x23')](function(_0x33c836){return _0x33c836;});}return null;};}function removeEntity(_0x5afc43,_0xf63347){return function(_0x51a016){if(_0x51a016){return _0x51a016[_0x580b('0x24')]()[_0x580b('0x23')](function(){_0x5afc43[_0x580b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x257ee0,_0x42b2a3){return function(_0x560478){if(!_0x560478){_0x257ee0[_0x580b('0x18')](0x194);}return _0x560478;};}function handleError(_0x138952,_0x1265f3){_0x1265f3=_0x1265f3||0x1f4;return function(_0x50dbd2){logger[_0x580b('0x25')](_0x50dbd2[_0x580b('0x26')]);if(_0x50dbd2[_0x580b('0x27')]){delete _0x50dbd2[_0x580b('0x27')];}_0x138952[_0x580b('0x19')](_0x1265f3)['send'](_0x50dbd2);};}exports[_0x580b('0x28')]=function(_0x32b778,_0x559014){var _0x19eceb={},_0x532c9e={},_0xfc6e55={'count':0x0,'rows':[]};var _0x347f5c=_[_0x580b('0x29')](db[_0x580b('0x2a')][_0x580b('0x2b')],function(_0x318dc7){return{'name':_0x318dc7['fieldName'],'type':_0x318dc7['type']['key']};});_0x532c9e[_0x580b('0x2c')]=_[_0x580b('0x29')](_0x347f5c,_0x580b('0x27'));_0x532c9e[_0x580b('0x2d')]=_['keys'](_0x32b778[_0x580b('0x2d')]);_0x532c9e['filters']=_['intersection'](_0x532c9e[_0x580b('0x2c')],_0x532c9e['query']);_0x19eceb[_0x580b('0x2e')]=_[_0x580b('0x2f')](_0x532c9e[_0x580b('0x2c')],qs[_0x580b('0x30')](_0x32b778[_0x580b('0x2d')]['fields']));_0x19eceb[_0x580b('0x2e')]=_0x19eceb[_0x580b('0x2e')][_0x580b('0x31')]?_0x19eceb[_0x580b('0x2e')]:_0x532c9e['model'];if(!_0x32b778[_0x580b('0x2d')]['hasOwnProperty'](_0x580b('0x32'))){_0x19eceb[_0x580b('0x1c')]=qs['limit'](_0x32b778['query'][_0x580b('0x1c')]);_0x19eceb[_0x580b('0x1b')]=qs[_0x580b('0x1b')](_0x32b778['query'][_0x580b('0x1b')]);}_0x19eceb['order']=qs[_0x580b('0x33')](_0x32b778[_0x580b('0x2d')]['sort']);_0x19eceb[_0x580b('0x34')]=qs[_0x580b('0x35')](_['pick'](_0x32b778[_0x580b('0x2d')],_0x532c9e['filters']),_0x347f5c);if(_0x32b778['query'][_0x580b('0x36')]){_0x19eceb[_0x580b('0x34')]=_[_0x580b('0x37')](_0x19eceb['where'],{'$or':_[_0x580b('0x29')](_0x347f5c,function(_0x2f7924){if(_0x2f7924[_0x580b('0x38')]!==_0x580b('0x39')){var _0x36720f={};_0x36720f[_0x2f7924['name']]={'$like':'%'+_0x32b778[_0x580b('0x2d')][_0x580b('0x36')]+'%'};return _0x36720f;}})});}_0x19eceb=_[_0x580b('0x37')]({},_0x19eceb,_0x32b778[_0x580b('0x3a')]);var _0x21dfda={'where':_0x19eceb[_0x580b('0x34')]};return db[_0x580b('0x2a')][_0x580b('0x1e')](_0x21dfda)[_0x580b('0x23')](function(_0x4048fe){_0xfc6e55[_0x580b('0x1e')]=_0x4048fe;if(_0x32b778['query'][_0x580b('0x3b')]){_0x19eceb['include']=[{'all':!![]}];}return db[_0x580b('0x2a')][_0x580b('0x3c')](_0x19eceb);})[_0x580b('0x23')](function(_0x2d6997){_0xfc6e55[_0x580b('0x3d')]=_0x2d6997;return _0xfc6e55;})[_0x580b('0x23')](respondWithFilteredResult(_0x559014,_0x19eceb))[_0x580b('0x3e')](handleError(_0x559014,null));};exports[_0x580b('0x3f')]=function(_0x571d25,_0x54868e){var _0x16aebf={'raw':!![],'where':{'id':_0x571d25[_0x580b('0x40')]['id']}},_0x39da1d={};_0x39da1d[_0x580b('0x2c')]=_[_0x580b('0x41')](db[_0x580b('0x2a')]['rawAttributes']);_0x39da1d[_0x580b('0x2d')]=_[_0x580b('0x41')](_0x571d25[_0x580b('0x2d')]);_0x39da1d['filters']=_['intersection'](_0x39da1d[_0x580b('0x2c')],_0x39da1d[_0x580b('0x2d')]);_0x16aebf['attributes']=_[_0x580b('0x2f')](_0x39da1d[_0x580b('0x2c')],qs[_0x580b('0x30')](_0x571d25[_0x580b('0x2d')]['fields']));_0x16aebf['attributes']=_0x16aebf['attributes'][_0x580b('0x31')]?_0x16aebf['attributes']:_0x39da1d[_0x580b('0x2c')];if(_0x571d25['query']['includeAll']){_0x16aebf[_0x580b('0x42')]=[{'all':!![]}];}_0x16aebf=_[_0x580b('0x37')]({},_0x16aebf,_0x571d25['options']);return db['OpenchannelTransferReport'][_0x580b('0x43')](_0x16aebf)[_0x580b('0x23')](handleEntityNotFound(_0x54868e,null))['then'](respondWithResult(_0x54868e,null))['catch'](handleError(_0x54868e,null));};exports[_0x580b('0x44')]=function(_0x4a4b4a,_0x59c20a){return db['OpenchannelTransferReport'][_0x580b('0x44')](_0x4a4b4a[_0x580b('0x45')],{})['then'](respondWithResult(_0x59c20a,0xc9))[_0x580b('0x3e')](handleError(_0x59c20a,null));};exports[_0x580b('0x22')]=function(_0x12ecd8,_0x34cb6e){if(_0x12ecd8['body']['id']){delete _0x12ecd8[_0x580b('0x45')]['id'];}return db[_0x580b('0x2a')][_0x580b('0x43')]({'where':{'id':_0x12ecd8[_0x580b('0x40')]['id']}})['then'](handleEntityNotFound(_0x34cb6e,null))[_0x580b('0x23')](saveUpdates(_0x12ecd8[_0x580b('0x45')],null))[_0x580b('0x23')](respondWithResult(_0x34cb6e,null))[_0x580b('0x3e')](handleError(_0x34cb6e,null));};exports['destroy']=function(_0x54afe5,_0x472ecc){return db['OpenchannelTransferReport'][_0x580b('0x43')]({'where':{'id':_0x54afe5['params']['id']}})[_0x580b('0x23')](handleEntityNotFound(_0x472ecc,null))['then'](removeEntity(_0x472ecc,null))['catch'](handleError(_0x472ecc,null));};exports['describe']=function(_0x43ec14,_0x53c403){return db[_0x580b('0x2a')]['describe']()[_0x580b('0x23')](respondWithResult(_0x53c403,null))['catch'](handleError(_0x53c403,null));}; \ No newline at end of file +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(_0x83990b,_0x353ce4){var _0x1821f0=function(_0x357f22){while(--_0x357f22){_0x83990b['push'](_0x83990b['shift']());}};_0x1821f0(++_0x353ce4);}(_0x4124,0x128));var _0x4412=function(_0x519de0,_0x2768cf){_0x519de0=_0x519de0-0x0;var _0x47e063=_0x4124[_0x519de0];return _0x47e063;};'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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index b4c4273..af9aef2 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 _0xd3fa=['lodash','util','../../config/logger','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x5cc9ae,_0x116739){var _0xef9aa1=function(_0x403b0c){while(--_0x403b0c){_0x5cc9ae['push'](_0x5cc9ae['shift']());}};_0xef9aa1(++_0x116739);}(_0xd3fa,0x79));var _0xad3f=function(_0x2765a6,_0x321e3a){_0x2765a6=_0x2765a6-0x0;var _0x361ea1=_0xd3fa[_0x2765a6];return _0x361ea1;};'use strict';var _=require(_0xad3f('0x0'));var util=require(_0xad3f('0x1'));var logger=require(_0xad3f('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xad3f('0x3'));var config=require(_0xad3f('0x4'));var attributes=require(_0xad3f('0x5'));module[_0xad3f('0x6')]=function(_0x2d5ca9,_0x44c9cf){return _0x2d5ca9[_0xad3f('0x7')](_0xad3f('0x8'),attributes,{'tableName':_0xad3f('0x9'),'paranoid':![],'indexes':[{'name':_0xad3f('0xa'),'fields':[_0xad3f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb6f5=['rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','path'];(function(_0x22eb96,_0x3c2d8d){var _0x5e1adf=function(_0x22e392){while(--_0x22e392){_0x22eb96['push'](_0x22eb96['shift']());}};_0x5e1adf(++_0x3c2d8d);}(_0xb6f5,0x6f));var _0x5b6f=function(_0x834bb6,_0x1c5e35){_0x834bb6=_0x834bb6-0x0;var _0xa35d00=_0xb6f5[_0x834bb6];return _0xa35d00;};'use strict';var _=require(_0x5b6f('0x0'));var util=require(_0x5b6f('0x1'));var logger=require(_0x5b6f('0x2'))(_0x5b6f('0x3'));var moment=require(_0x5b6f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b6f('0x5'));var rimraf=require(_0x5b6f('0x6'));var config=require(_0x5b6f('0x7'));var attributes=require(_0x5b6f('0x8'));module[_0x5b6f('0x9')]=function(_0x897b46,_0x5cdbb7){return _0x897b46[_0x5b6f('0xa')](_0x5b6f('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x5b6f('0xc'),'fields':[_0x5b6f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 68727aa..4561b53 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 _0x7a08=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0x7a08,0x11e));var _0x87a0=function(_0x12a7a3,_0x3a2bbb){_0x12a7a3=_0x12a7a3-0x0;var _0x335ac1=_0x7a08[_0x12a7a3];return _0x335ac1;};'use strict';var _=require(_0x87a0('0x0'));var util=require(_0x87a0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x87a0('0x2'));var fs=require('fs');var Redis=require(_0x87a0('0x3'));var db=require(_0x87a0('0x4'))['db'];var utils=require(_0x87a0('0x5'));var logger=require(_0x87a0('0x6'))(_0x87a0('0x7'));var config=require(_0x87a0('0x8'));var jayson=require(_0x87a0('0x9'));var client=jayson[_0x87a0('0xa')][_0x87a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xde806e,_0x584442,_0x27736f){return new BPromise(function(_0x1bb04b,_0x18185c){return client[_0x87a0('0xc')](_0xde806e,_0x27736f)[_0x87a0('0xd')](function(_0x515301){logger['info'](_0x87a0('0xe'),_0x584442,_0x87a0('0xf'));logger[_0x87a0('0x10')](_0x87a0('0x11'),_0x584442,_0x87a0('0xf'),JSON['stringify'](_0x515301));if(_0x515301[_0x87a0('0x12')]){if(_0x515301[_0x87a0('0x12')][_0x87a0('0x13')]===0x1f4){logger['error'](_0x87a0('0xe'),_0x584442,_0x515301[_0x87a0('0x12')][_0x87a0('0x14')]);return _0x18185c(_0x515301[_0x87a0('0x12')]['message']);}logger[_0x87a0('0x12')](_0x87a0('0xe'),_0x584442,_0x515301[_0x87a0('0x12')]['message']);return _0x1bb04b(_0x515301[_0x87a0('0x12')][_0x87a0('0x14')]);}else{logger[_0x87a0('0x15')](_0x87a0('0xe'),_0x584442,'request\x20sent');_0x1bb04b(_0x515301[_0x87a0('0x16')]['message']);}})[_0x87a0('0x17')](function(_0x410490){logger[_0x87a0('0x12')](_0x87a0('0xe'),_0x584442,_0x410490);_0x18185c(_0x410490);});});} \ No newline at end of file +var _0x5162=['jayson/promise','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x5162,0x103));var _0x2516=function(_0x2b0b61,_0x170827){_0x2b0b61=_0x2b0b61-0x0;var _0x2ae144=_0x5162[_0x2b0b61];return _0x2ae144;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2516('0x1'));var db=require(_0x2516('0x2'))['db'];var utils=require(_0x2516('0x3'));var logger=require(_0x2516('0x4'))(_0x2516('0x5'));var config=require(_0x2516('0x6'));var jayson=require(_0x2516('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5beeb3,_0x20a4a4,_0xba4b36){return new BPromise(function(_0xa1557,_0x3a8834){return client[_0x2516('0x8')](_0x5beeb3,_0xba4b36)[_0x2516('0x9')](function(_0x1cb817){logger['info'](_0x2516('0xa'),_0x20a4a4,_0x2516('0xb'));logger[_0x2516('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x20a4a4,'request\x20sent',JSON['stringify'](_0x1cb817));if(_0x1cb817['error']){if(_0x1cb817[_0x2516('0xd')][_0x2516('0xe')]===0x1f4){logger[_0x2516('0xd')](_0x2516('0xa'),_0x20a4a4,_0x1cb817['error'][_0x2516('0xf')]);return _0x3a8834(_0x1cb817[_0x2516('0xd')][_0x2516('0xf')]);}logger[_0x2516('0xd')](_0x2516('0xa'),_0x20a4a4,_0x1cb817[_0x2516('0xd')][_0x2516('0xf')]);return _0xa1557(_0x1cb817[_0x2516('0xd')][_0x2516('0xf')]);}else{logger[_0x2516('0x10')](_0x2516('0xa'),_0x20a4a4,_0x2516('0xb'));_0xa1557(_0x1cb817[_0x2516('0x11')][_0x2516('0xf')]);}})[_0x2516('0x12')](function(_0x5623be){logger[_0x2516('0xd')](_0x2516('0xa'),_0x20a4a4,_0x5623be);_0x3a8834(_0x5623be);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 3571ddd..52dddbd 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 _0x4191=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x6d163e,_0x2f2107){var _0x3e37af=function(_0xd970ab){while(--_0xd970ab){_0x6d163e['push'](_0x6d163e['shift']());}};_0x3e37af(++_0x2f2107);}(_0x4191,0x6a));var _0x1419=function(_0x51069d,_0x51ce9d){_0x51069d=_0x51069d-0x0;var _0x3d9440=_0x4191[_0x51069d];return _0x3d9440;};'use strict';var multer=require(_0x1419('0x0'));var util=require(_0x1419('0x1'));var path=require(_0x1419('0x2'));var timeout=require(_0x1419('0x3'));var express=require(_0x1419('0x4'));var router=express[_0x1419('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1419('0x6'));var interaction=require(_0x1419('0x7'));var config=require(_0x1419('0x8'));var controller=require(_0x1419('0x9'));router[_0x1419('0xa')]('/',auth[_0x1419('0xb')](),controller['index']);router['get'](_0x1419('0xc'),auth[_0x1419('0xb')](),controller[_0x1419('0xd')]);router[_0x1419('0xe')]('/',auth[_0x1419('0xb')](),controller[_0x1419('0xf')]);router[_0x1419('0x10')](_0x1419('0xc'),auth[_0x1419('0xb')](),controller[_0x1419('0x11')]);router[_0x1419('0x12')]('/:id',auth[_0x1419('0xb')](),controller[_0x1419('0x13')]);module[_0x1419('0x14')]=router; \ No newline at end of file +var _0xc8be=['../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1be994,_0x267018){var _0x365952=function(_0x4869ed){while(--_0x4869ed){_0x1be994['push'](_0x1be994['shift']());}};_0x365952(++_0x267018);}(_0xc8be,0x15d));var _0xec8b=function(_0x174d31,_0x544793){_0x174d31=_0x174d31-0x0;var _0x559996=_0xc8be[_0x174d31];return _0x559996;};'use strict';var multer=require(_0xec8b('0x0'));var util=require(_0xec8b('0x1'));var path=require(_0xec8b('0x2'));var timeout=require(_0xec8b('0x3'));var express=require(_0xec8b('0x4'));var router=express[_0xec8b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xec8b('0x6'));var interaction=require(_0xec8b('0x7'));var config=require(_0xec8b('0x8'));var controller=require(_0xec8b('0x9'));router[_0xec8b('0xa')]('/',auth[_0xec8b('0xb')](),controller[_0xec8b('0xc')]);router['get'](_0xec8b('0xd'),auth['isAuthenticated'](),controller[_0xec8b('0xe')]);router[_0xec8b('0xf')]('/',auth[_0xec8b('0xb')](),controller[_0xec8b('0x10')]);router[_0xec8b('0x11')]('/:id',auth[_0xec8b('0xb')](),controller[_0xec8b('0x12')]);router['delete']('/:id',auth[_0xec8b('0xb')](),controller[_0xec8b('0x13')]);module[_0xec8b('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index a4afc2c..b6f3fbf 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 _0x9a5a=['STRING','name','sequelize','exports'];(function(_0x4b0980,_0x2037b0){var _0x869c15=function(_0x419126){while(--_0x419126){_0x4b0980['push'](_0x4b0980['shift']());}};_0x869c15(++_0x2037b0);}(_0x9a5a,0xda));var _0xa9a5=function(_0x49d114,_0x5874a2){_0x49d114=_0x49d114-0x0;var _0x1ffb19=_0x9a5a[_0x49d114];return _0x1ffb19;};'use strict';var Sequelize=require(_0xa9a5('0x0'));module[_0xa9a5('0x1')]={'name':{'type':Sequelize[_0xa9a5('0x2')],'unique':_0xa9a5('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xa9a5('0x2')]}}; \ No newline at end of file +var _0x4169=['sequelize','STRING'];(function(_0x2b3c06,_0xc96806){var _0x3c5dca=function(_0x83bf6f){while(--_0x83bf6f){_0x2b3c06['push'](_0x2b3c06['shift']());}};_0x3c5dca(++_0xc96806);}(_0x4169,0x102));var _0x9416=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4169[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x9416('0x0'));module['exports']={'name':{'type':Sequelize[_0x9416('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x9416('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index c9b446d..98867c3 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 _0xccc4=['then','destroy','Pauses','UserProfileResource','stack','send','index','map','Pause','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x5a7cb7,_0x156a2a){var _0x3a28a8=function(_0x53c0d8){while(--_0x53c0d8){_0x5a7cb7['push'](_0x5a7cb7['shift']());}};_0x3a28a8(++_0x156a2a);}(_0xccc4,0x1dc));var _0x4ccc=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xccc4[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x4ccc('0x0'));var rimraf=require(_0x4ccc('0x1'));var zipdir=require(_0x4ccc('0x2'));var jsonpatch=require(_0x4ccc('0x3'));var rp=require('request-promise');var moment=require(_0x4ccc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ccc('0x5'));var path=require(_0x4ccc('0x6'));var sox=require(_0x4ccc('0x7'));var csv=require('to-csv');var ejs=require(_0x4ccc('0x8'));var fs=require('fs');var fs_extra=require(_0x4ccc('0x9'));var _=require(_0x4ccc('0xa'));var squel=require(_0x4ccc('0xb'));var crypto=require(_0x4ccc('0xc'));var jsforce=require(_0x4ccc('0xd'));var deskjs=require(_0x4ccc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4ccc('0xf'));var Papa=require(_0x4ccc('0x10'));var Redis=require('ioredis');var authService=require(_0x4ccc('0x11'));var qs=require(_0x4ccc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ccc('0x13'));var logger=require(_0x4ccc('0x14'))(_0x4ccc('0x15'));var utils=require(_0x4ccc('0x16'));var config=require(_0x4ccc('0x17'));var licenseUtil=require(_0x4ccc('0x18'));var db=require(_0x4ccc('0x19'))['db'];function respondWithStatusCode(_0x4d5df6,_0x410e85){_0x410e85=_0x410e85||0xcc;return function(_0x4ba144){if(_0x4ba144){return _0x4d5df6[_0x4ccc('0x1a')](_0x410e85);}return _0x4d5df6[_0x4ccc('0x1b')](_0x410e85)[_0x4ccc('0x1c')]();};}function respondWithResult(_0x37e5f3,_0x43997d){_0x43997d=_0x43997d||0xc8;return function(_0xff9633){if(_0xff9633){return _0x37e5f3[_0x4ccc('0x1b')](_0x43997d)[_0x4ccc('0x1d')](_0xff9633);}};}function respondWithFilteredResult(_0x43c1c1,_0x2510d8){return function(_0x4f4bad){if(_0x4f4bad){var _0x37d779=typeof _0x2510d8[_0x4ccc('0x1e')]===_0x4ccc('0x1f')&&typeof _0x2510d8[_0x4ccc('0x20')]===_0x4ccc('0x1f');var _0x19b187=_0x4f4bad[_0x4ccc('0x21')];var _0x54d64a=_0x37d779?0x0:_0x2510d8['offset'];var _0x5a648f=_0x37d779?_0x4f4bad[_0x4ccc('0x21')]:_0x2510d8[_0x4ccc('0x1e')]+_0x2510d8[_0x4ccc('0x20')];var _0x2b45b5;if(_0x5a648f>=_0x19b187){_0x5a648f=_0x19b187;_0x2b45b5=0xc8;}else{_0x2b45b5=0xce;}_0x43c1c1['status'](_0x2b45b5);return _0x43c1c1[_0x4ccc('0x22')](_0x4ccc('0x23'),_0x54d64a+'-'+_0x5a648f+'/'+_0x19b187)['json'](_0x4f4bad);}return null;};}function patchUpdates(_0x305ae0){return function(_0x2d992a){try{jsonpatch[_0x4ccc('0x24')](_0x2d992a,_0x305ae0,!![]);}catch(_0x415f29){return BPromise[_0x4ccc('0x25')](_0x415f29);}return _0x2d992a[_0x4ccc('0x26')]();};}function saveUpdates(_0x1b80d8,_0x48d64c){return function(_0x3259dc){if(_0x3259dc){return _0x3259dc[_0x4ccc('0x27')](_0x1b80d8)[_0x4ccc('0x28')](function(_0x156ff1){return _0x156ff1;});}return null;};}function removeEntity(_0x16c677,_0x524a1b){return function(_0x39673c){if(_0x39673c){return _0x39673c[_0x4ccc('0x29')]()['then'](function(){var _0x4d2ff0=_0x39673c['get']({'plain':!![]});var _0x31bc86=_0x4ccc('0x2a');return db[_0x4ccc('0x2b')][_0x4ccc('0x29')]({'where':{'type':_0x31bc86,'resourceId':_0x4d2ff0['id']}})['then'](function(){return _0x39673c;});})[_0x4ccc('0x28')](function(){_0x16c677['status'](0xcc)[_0x4ccc('0x1c')]();});}};}function handleEntityNotFound(_0x34274a,_0x87aa){return function(_0x3ccafa){if(!_0x3ccafa){_0x34274a[_0x4ccc('0x1a')](0x194);}return _0x3ccafa;};}function handleError(_0x3f3b75,_0x367235){_0x367235=_0x367235||0x1f4;return function(_0x3e8480){logger['error'](_0x3e8480[_0x4ccc('0x2c')]);if(_0x3e8480['name']){delete _0x3e8480['name'];}_0x3f3b75[_0x4ccc('0x1b')](_0x367235)[_0x4ccc('0x2d')](_0x3e8480);};}exports[_0x4ccc('0x2e')]=function(_0x5ac313,_0x3fee5c){var _0x3650d1={},_0x33393d={},_0x4142b4={'count':0x0,'rows':[]};var _0x252bd4=_[_0x4ccc('0x2f')](db[_0x4ccc('0x30')][_0x4ccc('0x31')],function(_0x174310){return{'name':_0x174310[_0x4ccc('0x32')],'type':_0x174310[_0x4ccc('0x33')][_0x4ccc('0x34')]};});_0x33393d[_0x4ccc('0x35')]=_[_0x4ccc('0x2f')](_0x252bd4,_0x4ccc('0x36'));_0x33393d[_0x4ccc('0x37')]=_[_0x4ccc('0x38')](_0x5ac313[_0x4ccc('0x37')]);_0x33393d[_0x4ccc('0x39')]=_[_0x4ccc('0x3a')](_0x33393d['model'],_0x33393d[_0x4ccc('0x37')]);_0x3650d1[_0x4ccc('0x3b')]=_[_0x4ccc('0x3a')](_0x33393d[_0x4ccc('0x35')],qs[_0x4ccc('0x3c')](_0x5ac313['query'][_0x4ccc('0x3c')]));_0x3650d1['attributes']=_0x3650d1['attributes'][_0x4ccc('0x3d')]?_0x3650d1['attributes']:_0x33393d[_0x4ccc('0x35')];if(!_0x5ac313[_0x4ccc('0x37')]['hasOwnProperty'](_0x4ccc('0x3e'))){_0x3650d1['limit']=qs[_0x4ccc('0x20')](_0x5ac313[_0x4ccc('0x37')]['limit']);_0x3650d1['offset']=qs[_0x4ccc('0x1e')](_0x5ac313[_0x4ccc('0x37')]['offset']);}_0x3650d1[_0x4ccc('0x3f')]=qs[_0x4ccc('0x40')](_0x5ac313[_0x4ccc('0x37')]['sort']);_0x3650d1[_0x4ccc('0x41')]=qs['filters'](_[_0x4ccc('0x42')](_0x5ac313['query'],_0x33393d[_0x4ccc('0x39')]),_0x252bd4);if(_0x5ac313['query'][_0x4ccc('0x43')]){_0x3650d1[_0x4ccc('0x41')]=_[_0x4ccc('0x44')](_0x3650d1[_0x4ccc('0x41')],{'$or':_[_0x4ccc('0x2f')](_0x252bd4,function(_0x1fb9d7){if(_0x1fb9d7[_0x4ccc('0x33')]!==_0x4ccc('0x45')){var _0x2ecf60={};_0x2ecf60[_0x1fb9d7['name']]={'$like':'%'+_0x5ac313[_0x4ccc('0x37')][_0x4ccc('0x43')]+'%'};return _0x2ecf60;}})});}_0x3650d1=_[_0x4ccc('0x44')]({},_0x3650d1,_0x5ac313[_0x4ccc('0x46')]);var _0x53e69d={'where':_0x3650d1['where']};return db['Pause'][_0x4ccc('0x21')](_0x53e69d)['then'](function(_0x24e3a4){_0x4142b4[_0x4ccc('0x21')]=_0x24e3a4;if(_0x5ac313[_0x4ccc('0x37')][_0x4ccc('0x47')]){_0x3650d1['include']=[{'all':!![]}];}return db['Pause'][_0x4ccc('0x48')](_0x3650d1);})['then'](function(_0x3b521a){_0x4142b4[_0x4ccc('0x49')]=_0x3b521a;return _0x4142b4;})[_0x4ccc('0x28')](respondWithFilteredResult(_0x3fee5c,_0x3650d1))['catch'](handleError(_0x3fee5c,null));};exports[_0x4ccc('0x4a')]=function(_0xaab65c,_0x59689c){var _0xd67b38={'raw':!![],'where':{'id':_0xaab65c[_0x4ccc('0x4b')]['id']}},_0x268f8e={};_0x268f8e['model']=_[_0x4ccc('0x38')](db[_0x4ccc('0x30')][_0x4ccc('0x31')]);_0x268f8e[_0x4ccc('0x37')]=_['keys'](_0xaab65c[_0x4ccc('0x37')]);_0x268f8e['filters']=_[_0x4ccc('0x3a')](_0x268f8e['model'],_0x268f8e['query']);_0xd67b38[_0x4ccc('0x3b')]=_[_0x4ccc('0x3a')](_0x268f8e[_0x4ccc('0x35')],qs['fields'](_0xaab65c[_0x4ccc('0x37')][_0x4ccc('0x3c')]));_0xd67b38[_0x4ccc('0x3b')]=_0xd67b38[_0x4ccc('0x3b')]['length']?_0xd67b38[_0x4ccc('0x3b')]:_0x268f8e[_0x4ccc('0x35')];if(_0xaab65c[_0x4ccc('0x37')][_0x4ccc('0x47')]){_0xd67b38[_0x4ccc('0x4c')]=[{'all':!![]}];}_0xd67b38=_[_0x4ccc('0x44')]({},_0xd67b38,_0xaab65c[_0x4ccc('0x46')]);return db[_0x4ccc('0x30')][_0x4ccc('0x4d')](_0xd67b38)['then'](handleEntityNotFound(_0x59689c,null))['then'](respondWithResult(_0x59689c,null))['catch'](handleError(_0x59689c,null));};exports[_0x4ccc('0x4e')]=function(_0x4dde56,_0x33461d){return db[_0x4ccc('0x30')][_0x4ccc('0x4e')](_0x4dde56['body'],{})[_0x4ccc('0x28')](function(_0x1b9ba5){var _0x44d5ce=_0x4dde56[_0x4ccc('0x4f')][_0x4ccc('0x50')]({'plain':!![]});if(!_0x44d5ce)throw new Error(_0x4ccc('0x51'));if(_0x44d5ce['role']==='user'){var _0x395f35=_0x1b9ba5[_0x4ccc('0x50')]({'plain':!![]});var _0x21c706=_0x4ccc('0x2a');return db[_0x4ccc('0x52')][_0x4ccc('0x4d')]({'where':{'name':_0x21c706,'userProfileId':_0x44d5ce['userProfileId']},'raw':!![]})[_0x4ccc('0x28')](function(_0x4aae66){if(_0x4aae66&&_0x4aae66[_0x4ccc('0x53')]===0x0){return db[_0x4ccc('0x2b')][_0x4ccc('0x4e')]({'name':_0x395f35[_0x4ccc('0x36')],'resourceId':_0x395f35['id'],'type':_0x4aae66['name'],'sectionId':_0x4aae66['id']},{})['then'](function(){return _0x1b9ba5;});}else{return _0x1b9ba5;}})[_0x4ccc('0x54')](function(_0x3eac12){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3eac12);throw _0x3eac12;});}return _0x1b9ba5;})[_0x4ccc('0x28')](respondWithResult(_0x33461d,0xc9))[_0x4ccc('0x54')](handleError(_0x33461d,null));};exports[_0x4ccc('0x27')]=function(_0x104fa7,_0x1bef8e){if(_0x104fa7[_0x4ccc('0x55')]['id']){delete _0x104fa7[_0x4ccc('0x55')]['id'];}return db[_0x4ccc('0x30')][_0x4ccc('0x4d')]({'where':{'id':_0x104fa7['params']['id']}})['then'](handleEntityNotFound(_0x1bef8e,null))['then'](saveUpdates(_0x104fa7['body'],null))[_0x4ccc('0x28')](respondWithResult(_0x1bef8e,null))[_0x4ccc('0x54')](handleError(_0x1bef8e,null));};exports[_0x4ccc('0x29')]=function(_0x254600,_0x14c459){return db[_0x4ccc('0x30')][_0x4ccc('0x4d')]({'where':{'id':_0x254600['params']['id']}})[_0x4ccc('0x28')](handleEntityNotFound(_0x14c459,null))[_0x4ccc('0x28')](removeEntity(_0x14c459,null))['catch'](handleError(_0x14c459,null));}; \ No newline at end of file +var _0xa131=['pick','filter','VIRTUAL','merge','options','includeAll','catch','show','params','keys','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','userProfileId','autoAssociation','update','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','Pauses','UserProfileResource','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x29e6b3,_0x2552ad){var _0x3151ae=function(_0x524123){while(--_0x524123){_0x29e6b3['push'](_0x29e6b3['shift']());}};_0x3151ae(++_0x2552ad);}(_0xa131,0x117));var _0x1a13=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa131[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a13('0x0'));var zipdir=require(_0x1a13('0x1'));var jsonpatch=require(_0x1a13('0x2'));var rp=require('request-promise');var moment=require(_0x1a13('0x3'));var BPromise=require(_0x1a13('0x4'));var Mustache=require(_0x1a13('0x5'));var util=require(_0x1a13('0x6'));var path=require(_0x1a13('0x7'));var sox=require(_0x1a13('0x8'));var csv=require(_0x1a13('0x9'));var ejs=require(_0x1a13('0xa'));var fs=require('fs');var fs_extra=require(_0x1a13('0xb'));var _=require('lodash');var squel=require(_0x1a13('0xc'));var crypto=require(_0x1a13('0xd'));var jsforce=require(_0x1a13('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1a13('0xf'));var Papa=require(_0x1a13('0x10'));var Redis=require('ioredis');var authService=require(_0x1a13('0x11'));var qs=require(_0x1a13('0x12'));var as=require(_0x1a13('0x13'));var hardwareService=require(_0x1a13('0x14'));var logger=require(_0x1a13('0x15'))(_0x1a13('0x16'));var utils=require('../../config/utils');var config=require(_0x1a13('0x17'));var licenseUtil=require(_0x1a13('0x18'));var db=require(_0x1a13('0x19'))['db'];function respondWithStatusCode(_0x4b05b5,_0x2b4266){_0x2b4266=_0x2b4266||0xcc;return function(_0x3635f0){if(_0x3635f0){return _0x4b05b5[_0x1a13('0x1a')](_0x2b4266);}return _0x4b05b5['status'](_0x2b4266)[_0x1a13('0x1b')]();};}function respondWithResult(_0x54642e,_0x47ab13){_0x47ab13=_0x47ab13||0xc8;return function(_0x567091){if(_0x567091){return _0x54642e[_0x1a13('0x1c')](_0x47ab13)[_0x1a13('0x1d')](_0x567091);}};}function respondWithFilteredResult(_0x166847,_0x14c4b5){return function(_0x3dd504){if(_0x3dd504){var _0x5be815=typeof _0x14c4b5['offset']==='undefined'&&typeof _0x14c4b5[_0x1a13('0x1e')]===_0x1a13('0x1f');var _0x3c2a6d=_0x3dd504['count'];var _0x18a960=_0x5be815?0x0:_0x14c4b5['offset'];var _0x4ca8db=_0x5be815?_0x3dd504[_0x1a13('0x20')]:_0x14c4b5[_0x1a13('0x21')]+_0x14c4b5[_0x1a13('0x1e')];var _0x55967b;if(_0x4ca8db>=_0x3c2a6d){_0x4ca8db=_0x3c2a6d;_0x55967b=0xc8;}else{_0x55967b=0xce;}_0x166847['status'](_0x55967b);return _0x166847[_0x1a13('0x22')](_0x1a13('0x23'),_0x18a960+'-'+_0x4ca8db+'/'+_0x3c2a6d)['json'](_0x3dd504);}return null;};}function patchUpdates(_0x1e3332){return function(_0x38a88a){try{jsonpatch[_0x1a13('0x24')](_0x38a88a,_0x1e3332,!![]);}catch(_0x4d0c0b){return BPromise[_0x1a13('0x25')](_0x4d0c0b);}return _0x38a88a[_0x1a13('0x26')]();};}function saveUpdates(_0xdd2868,_0x1e2972){return function(_0xffa66f){if(_0xffa66f){return _0xffa66f['update'](_0xdd2868)[_0x1a13('0x27')](function(_0x1c6013){return _0x1c6013;});}return null;};}function removeEntity(_0x1703bf,_0x1eaa52){return function(_0xd8f9ee){if(_0xd8f9ee){return _0xd8f9ee[_0x1a13('0x28')]()[_0x1a13('0x27')](function(){var _0x4903ca=_0xd8f9ee['get']({'plain':!![]});var _0x17dcb4=_0x1a13('0x29');return db[_0x1a13('0x2a')][_0x1a13('0x28')]({'where':{'type':_0x17dcb4,'resourceId':_0x4903ca['id']}})[_0x1a13('0x27')](function(){return _0xd8f9ee;});})[_0x1a13('0x27')](function(){_0x1703bf['status'](0xcc)[_0x1a13('0x1b')]();});}};}function handleEntityNotFound(_0x45f728,_0xe55fd8){return function(_0x12e99d){if(!_0x12e99d){_0x45f728[_0x1a13('0x1a')](0x194);}return _0x12e99d;};}function handleError(_0x24d487,_0x33f7b9){_0x33f7b9=_0x33f7b9||0x1f4;return function(_0x12c7dd){logger['error'](_0x12c7dd[_0x1a13('0x2b')]);if(_0x12c7dd[_0x1a13('0x2c')]){delete _0x12c7dd[_0x1a13('0x2c')];}_0x24d487[_0x1a13('0x1c')](_0x33f7b9)[_0x1a13('0x2d')](_0x12c7dd);};}exports[_0x1a13('0x2e')]=function(_0x9a3ed4,_0x1acd36){var _0x21665e={},_0x1e13d3={},_0x584338={'count':0x0,'rows':[]};var _0x284891=_[_0x1a13('0x2f')](db[_0x1a13('0x30')][_0x1a13('0x31')],function(_0x2d47a3){return{'name':_0x2d47a3[_0x1a13('0x32')],'type':_0x2d47a3[_0x1a13('0x33')][_0x1a13('0x34')]};});_0x1e13d3[_0x1a13('0x35')]=_['map'](_0x284891,'name');_0x1e13d3[_0x1a13('0x36')]=_['keys'](_0x9a3ed4['query']);_0x1e13d3[_0x1a13('0x37')]=_[_0x1a13('0x38')](_0x1e13d3[_0x1a13('0x35')],_0x1e13d3[_0x1a13('0x36')]);_0x21665e[_0x1a13('0x39')]=_[_0x1a13('0x38')](_0x1e13d3['model'],qs['fields'](_0x9a3ed4[_0x1a13('0x36')][_0x1a13('0x3a')]));_0x21665e[_0x1a13('0x39')]=_0x21665e['attributes'][_0x1a13('0x3b')]?_0x21665e[_0x1a13('0x39')]:_0x1e13d3[_0x1a13('0x35')];if(!_0x9a3ed4['query'][_0x1a13('0x3c')](_0x1a13('0x3d'))){_0x21665e[_0x1a13('0x1e')]=qs['limit'](_0x9a3ed4[_0x1a13('0x36')][_0x1a13('0x1e')]);_0x21665e[_0x1a13('0x21')]=qs[_0x1a13('0x21')](_0x9a3ed4['query'][_0x1a13('0x21')]);}_0x21665e[_0x1a13('0x3e')]=qs[_0x1a13('0x3f')](_0x9a3ed4[_0x1a13('0x36')][_0x1a13('0x3f')]);_0x21665e[_0x1a13('0x40')]=qs[_0x1a13('0x37')](_[_0x1a13('0x41')](_0x9a3ed4[_0x1a13('0x36')],_0x1e13d3['filters']),_0x284891);if(_0x9a3ed4['query'][_0x1a13('0x42')]){_0x21665e[_0x1a13('0x40')]=_['merge'](_0x21665e[_0x1a13('0x40')],{'$or':_[_0x1a13('0x2f')](_0x284891,function(_0xca6fbe){if(_0xca6fbe['type']!==_0x1a13('0x43')){var _0x257f3e={};_0x257f3e[_0xca6fbe[_0x1a13('0x2c')]]={'$like':'%'+_0x9a3ed4[_0x1a13('0x36')][_0x1a13('0x42')]+'%'};return _0x257f3e;}})});}_0x21665e=_[_0x1a13('0x44')]({},_0x21665e,_0x9a3ed4[_0x1a13('0x45')]);var _0x13b112={'where':_0x21665e[_0x1a13('0x40')]};return db['Pause'][_0x1a13('0x20')](_0x13b112)[_0x1a13('0x27')](function(_0x4d0354){_0x584338['count']=_0x4d0354;if(_0x9a3ed4[_0x1a13('0x36')][_0x1a13('0x46')]){_0x21665e['include']=[{'all':!![]}];}return db[_0x1a13('0x30')]['findAll'](_0x21665e);})[_0x1a13('0x27')](function(_0x106976){_0x584338['rows']=_0x106976;return _0x584338;})['then'](respondWithFilteredResult(_0x1acd36,_0x21665e))[_0x1a13('0x47')](handleError(_0x1acd36,null));};exports[_0x1a13('0x48')]=function(_0x1e4b55,_0x5704e5){var _0x5c5275={'raw':!![],'where':{'id':_0x1e4b55[_0x1a13('0x49')]['id']}},_0x11f62f={};_0x11f62f[_0x1a13('0x35')]=_[_0x1a13('0x4a')](db['Pause'][_0x1a13('0x31')]);_0x11f62f['query']=_[_0x1a13('0x4a')](_0x1e4b55['query']);_0x11f62f[_0x1a13('0x37')]=_[_0x1a13('0x38')](_0x11f62f['model'],_0x11f62f[_0x1a13('0x36')]);_0x5c5275[_0x1a13('0x39')]=_['intersection'](_0x11f62f[_0x1a13('0x35')],qs[_0x1a13('0x3a')](_0x1e4b55[_0x1a13('0x36')][_0x1a13('0x3a')]));_0x5c5275[_0x1a13('0x39')]=_0x5c5275[_0x1a13('0x39')][_0x1a13('0x3b')]?_0x5c5275[_0x1a13('0x39')]:_0x11f62f[_0x1a13('0x35')];if(_0x1e4b55['query'][_0x1a13('0x46')]){_0x5c5275[_0x1a13('0x4b')]=[{'all':!![]}];}_0x5c5275=_[_0x1a13('0x44')]({},_0x5c5275,_0x1e4b55[_0x1a13('0x45')]);return db['Pause'][_0x1a13('0x4c')](_0x5c5275)[_0x1a13('0x27')](handleEntityNotFound(_0x5704e5,null))[_0x1a13('0x27')](respondWithResult(_0x5704e5,null))['catch'](handleError(_0x5704e5,null));};exports[_0x1a13('0x4d')]=function(_0x1f2938,_0x5b420b){return db['Pause'][_0x1a13('0x4d')](_0x1f2938[_0x1a13('0x4e')],{})['then'](function(_0x281abc){var _0x2ade1b=_0x1f2938['user']['get']({'plain':!![]});if(!_0x2ade1b)throw new Error(_0x1a13('0x4f'));if(_0x2ade1b[_0x1a13('0x50')]===_0x1a13('0x51')){var _0x13e4e3=_0x281abc[_0x1a13('0x52')]({'plain':!![]});var _0x3210cf=_0x1a13('0x29');return db['UserProfileSection'][_0x1a13('0x4c')]({'where':{'name':_0x3210cf,'userProfileId':_0x2ade1b[_0x1a13('0x53')]},'raw':!![]})[_0x1a13('0x27')](function(_0x24e9fb){if(_0x24e9fb&&_0x24e9fb[_0x1a13('0x54')]===0x0){return db[_0x1a13('0x2a')][_0x1a13('0x4d')]({'name':_0x13e4e3['name'],'resourceId':_0x13e4e3['id'],'type':_0x24e9fb[_0x1a13('0x2c')],'sectionId':_0x24e9fb['id']},{})[_0x1a13('0x27')](function(){return _0x281abc;});}else{return _0x281abc;}})[_0x1a13('0x47')](function(_0xf01e77){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf01e77);throw _0xf01e77;});}return _0x281abc;})['then'](respondWithResult(_0x5b420b,0xc9))['catch'](handleError(_0x5b420b,null));};exports[_0x1a13('0x55')]=function(_0x4dcf4f,_0x59ab74){if(_0x4dcf4f['body']['id']){delete _0x4dcf4f['body']['id'];}return db[_0x1a13('0x30')][_0x1a13('0x4c')]({'where':{'id':_0x4dcf4f['params']['id']}})[_0x1a13('0x27')](handleEntityNotFound(_0x59ab74,null))['then'](saveUpdates(_0x4dcf4f[_0x1a13('0x4e')],null))['then'](respondWithResult(_0x59ab74,null))[_0x1a13('0x47')](handleError(_0x59ab74,null));};exports[_0x1a13('0x28')]=function(_0x2b7d3f,_0x4a6f43){return db[_0x1a13('0x30')]['find']({'where':{'id':_0x2b7d3f[_0x1a13('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a6f43,null))[_0x1a13('0x27')](removeEntity(_0x4a6f43,null))[_0x1a13('0x47')](handleError(_0x4a6f43,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index e82d5d3..b82741b 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0xe9ed87,_0x870d8a){var _0x275d4a=function(_0x4e0c61){while(--_0x4e0c61){_0xe9ed87['push'](_0xe9ed87['shift']());}};_0x275d4a(++_0x870d8a);}(_0x53ec,0x192));var _0xc53e=function(_0x323fca,_0x369c53){_0x323fca=_0x323fca-0x0;var _0x2f4122=_0x53ec[_0x323fca];return _0x2f4122;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3eb4a9,_0x359d73){var _0x48dbad=function(_0x3a3ca6){while(--_0x3a3ca6){_0x3eb4a9['push'](_0x3eb4a9['shift']());}};_0x48dbad(++_0x359d73);}(_0x7217,0x19e));var _0x7721=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x7217[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index c7aa11f..4f512fc 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(_0x3aa657,_0x210cc7){var _0x4e5ed8=function(_0x2ba421){while(--_0x2ba421){_0x3aa657['push'](_0x3aa657['shift']());}};_0x4e5ed8(++_0x210cc7);}(_0xb10b,0x12a));var _0xbb10=function(_0x39914e,_0x1ec745){_0x39914e=_0x39914e-0x0;var _0x56350b=_0xb10b[_0x39914e];return _0x56350b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x2af2af,_0x130026){var _0x15981b=function(_0x5d41d5){while(--_0x5d41d5){_0x2af2af['push'](_0x2af2af['shift']());}};_0x15981b(++_0x130026);}(_0xb10b,0x12a));var _0xbb10=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0xb10b[_0x23b655];return _0x364b32;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 5faab26..289e180 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 _0xfd28=['webhookPost','put','update','delete','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/:id','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','/webhook'];(function(_0x38d9e1,_0x200191){var _0xdf938f=function(_0xb005f3){while(--_0xb005f3){_0x38d9e1['push'](_0x38d9e1['shift']());}};_0xdf938f(++_0x200191);}(_0xfd28,0x148));var _0x8fd2=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0xfd28[_0x100e36];return _0x1df0c9;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var fs_extra=require(_0x8fd2('0x3'));var auth=require(_0x8fd2('0x4'));var interaction=require(_0x8fd2('0x5'));var config=require('../../config/environment');var controller=require(_0x8fd2('0x6'));router[_0x8fd2('0x7')]('/',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x9')]);router[_0x8fd2('0x7')]('/webhook',controller['webhookGet']);router[_0x8fd2('0x7')](_0x8fd2('0xa'),auth[_0x8fd2('0x8')](),controller['show']);router[_0x8fd2('0x7')]('/:id/download',auth[_0x8fd2('0x8')](),controller['download']);var upload=multer({'storage':multer[_0x8fd2('0xb')]({'destination':function(_0x4fdf0b,_0x1ca2a1,_0x5244ed){_0x5244ed(null,path[_0x8fd2('0xc')](config['root'],_0x8fd2('0xd')));},'filename':function(_0x207298,_0xfd78d,_0xa6d7ca){_0xfd78d[_0x8fd2('0xe')]=_0xfd78d[_0x8fd2('0xe')][_0x8fd2('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xa6d7ca(null,util[_0x8fd2('0x10')](_0x8fd2('0x11'),path[_0x8fd2('0x12')](_0xfd78d[_0x8fd2('0xe')],path[_0x8fd2('0x13')](_0xfd78d[_0x8fd2('0xe')])),Date[_0x8fd2('0x14')](),path[_0x8fd2('0x13')](_0xfd78d['originalname'])));}})});router[_0x8fd2('0x15')]('/',upload['single']('file'),controller['upload']);router[_0x8fd2('0x15')](_0x8fd2('0x16'),controller[_0x8fd2('0x17')]);router[_0x8fd2('0x18')]('/:id',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x19')]);router[_0x8fd2('0x1a')](_0x8fd2('0xa'),auth[_0x8fd2('0x8')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0xbb53=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/webhook','webhookGet','show','/:id/download','download','root','originalname','replace','%s-%s%s','basename','extname','post','single','upload','webhookPost','/:id','update','delete'];(function(_0x3f3c46,_0x33e972){var _0x7d1132=function(_0x2c7b56){while(--_0x2c7b56){_0x3f3c46['push'](_0x3f3c46['shift']());}};_0x7d1132(++_0x33e972);}(_0xbb53,0x121));var _0x3bb5=function(_0x2ee71f,_0x35b42e){_0x2ee71f=_0x2ee71f-0x0;var _0xf95c54=_0xbb53[_0x2ee71f];return _0xf95c54;};'use strict';var multer=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var path=require(_0x3bb5('0x2'));var timeout=require(_0x3bb5('0x3'));var express=require(_0x3bb5('0x4'));var router=express[_0x3bb5('0x5')]();var fs_extra=require(_0x3bb5('0x6'));var auth=require(_0x3bb5('0x7'));var interaction=require(_0x3bb5('0x8'));var config=require(_0x3bb5('0x9'));var controller=require('./plugin.controller');router['get']('/',auth[_0x3bb5('0xa')](),controller[_0x3bb5('0xb')]);router[_0x3bb5('0xc')](_0x3bb5('0xd'),controller[_0x3bb5('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3bb5('0xf')]);router[_0x3bb5('0xc')](_0x3bb5('0x10'),auth['isAuthenticated'](),controller[_0x3bb5('0x11')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53af18,_0xd8d9bf,_0x2b915a){_0x2b915a(null,path['join'](config[_0x3bb5('0x12')],'server/files/plugins'));},'filename':function(_0x69f59a,_0x511bd8,_0x526bf0){_0x511bd8[_0x3bb5('0x13')]=_0x511bd8[_0x3bb5('0x13')][_0x3bb5('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x526bf0(null,util['format'](_0x3bb5('0x15'),path[_0x3bb5('0x16')](_0x511bd8['originalname'],path[_0x3bb5('0x17')](_0x511bd8[_0x3bb5('0x13')])),Date['now'](),path['extname'](_0x511bd8['originalname'])));}})});router[_0x3bb5('0x18')]('/',upload[_0x3bb5('0x19')]('file'),controller[_0x3bb5('0x1a')]);router[_0x3bb5('0x18')](_0x3bb5('0xd'),controller[_0x3bb5('0x1b')]);router['put'](_0x3bb5('0x1c'),auth[_0x3bb5('0xa')](),controller[_0x3bb5('0x1d')]);router['delete']('/:id',auth[_0x3bb5('0xa')](),controller[_0x3bb5('0x1e')]);module[_0x3bb5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 8592d56..6c1c105 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 _0x3a3d=['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','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','script','TEXT'];(function(_0x34933a,_0x327378){var _0x36abb4=function(_0x2d6814){while(--_0x2d6814){_0x34933a['push'](_0x34933a['shift']());}};_0x36abb4(++_0x327378);}(_0x3a3d,0xbd));var _0xd3a3=function(_0xb2ab17,_0x46161f){_0xb2ab17=_0xb2ab17-0x0;var _0x501bf6=_0x3a3d[_0xb2ab17];return _0x501bf6;};'use strict';var Sequelize=require(_0xd3a3('0x0'));module[_0xd3a3('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd3a3('0x2')](_0xd3a3('0x3'),_0xd3a3('0x4'))},'description':{'type':Sequelize[_0xd3a3('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xd3a3('0x6')],'comment':_0xd3a3('0x7')},'active':{'type':Sequelize[_0xd3a3('0x8')],'defaultValue':0x0,'comment':_0xd3a3('0x9')},'sidebar':{'type':Sequelize['ENUM'](_0xd3a3('0xa'),_0xd3a3('0xb'),_0xd3a3('0xc'),_0xd3a3('0xd')),'defaultValue':_0xd3a3('0xc'),'comment':_0xd3a3('0xe')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xd3a3('0x6')]},'agentUrl':{'type':Sequelize[_0xd3a3('0x6')]},'scriptName':{'type':Sequelize[_0xd3a3('0x6')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x90fc=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never','exports','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x41a146,_0x560346){var _0x55d624=function(_0x369734){while(--_0x369734){_0x41a146['push'](_0x41a146['shift']());}};_0x55d624(++_0x560346);}(_0x90fc,0x186));var _0xc90f=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x90fc[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require('sequelize');module[_0xc90f('0x0')]={'name':{'type':Sequelize[_0xc90f('0x1')]},'type':{'type':Sequelize[_0xc90f('0x2')]('html',_0xc90f('0x3'))},'description':{'type':Sequelize[_0xc90f('0x4')]},'version':{'type':Sequelize[_0xc90f('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0xc90f('0x5')},'active':{'type':Sequelize[_0xc90f('0x6')],'defaultValue':0x0,'comment':_0xc90f('0x7')},'sidebar':{'type':Sequelize[_0xc90f('0x2')](_0xc90f('0x8'),'agentOnly',_0xc90f('0x9'),_0xc90f('0xa')),'defaultValue':_0xc90f('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xc90f('0x1')]},'adminUrl':{'type':Sequelize[_0xc90f('0x1')]},'agentUrl':{'type':Sequelize[_0xc90f('0x1')]},'scriptName':{'type':Sequelize[_0xc90f('0x1')]},'scriptPath':{'type':Sequelize[_0xc90f('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 166d1b4..5681505 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 _0x607a=['create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','autoAssociation','unlinkSync','Zip\x20archive\x20removed','update','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','sendStatus','send','resolve','eml-format','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','get','UserProfileResource','end','error','name','index','map','Plugin','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','merge','where','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','download','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','isFile','Invalid\x20plugin\x20structure','isDirectory','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','icon-apps','version','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','Warning:\x20agent\x20view\x20not\x20specified'];(function(_0xee3c05,_0x5c27c6){var _0x2b2f62=function(_0x1b0591){while(--_0x1b0591){_0xee3c05['push'](_0xee3c05['shift']());}};_0x2b2f62(++_0x5c27c6);}(_0x607a,0xc9));var _0xa607=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x607a[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xa607('0x0'));var rimraf=require(_0xa607('0x1'));var zipdir=require(_0xa607('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa607('0x3'));var BPromise=require(_0xa607('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa607('0x5'));var sox=require(_0xa607('0x6'));var csv=require(_0xa607('0x7'));var ejs=require(_0xa607('0x8'));var fs=require('fs');var fs_extra=require(_0xa607('0x9'));var _=require(_0xa607('0xa'));var squel=require(_0xa607('0xb'));var crypto=require(_0xa607('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa607('0xd'));var toCsv=require(_0xa607('0x7'));var querystring=require(_0xa607('0xe'));var Papa=require(_0xa607('0xf'));var extract=require(_0xa607('0x10'));var rimraf=require(_0xa607('0x1'));var archiver=require('archiver');var Redis=require(_0xa607('0x11'));var authService=require(_0xa607('0x12'));var qs=require(_0xa607('0x13'));var as=require(_0xa607('0x14'));var hardwareService=require(_0xa607('0x15'));var logger=require(_0xa607('0x16'))(_0xa607('0x17'));var utils=require('../../config/utils');var config=require(_0xa607('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa607('0x19'))['db'];config[_0xa607('0x1a')]=_[_0xa607('0x1b')](config['redis'],{'host':_0xa607('0x1c'),'port':0x18eb});var socket=require(_0xa607('0x1d'))(new Redis(config[_0xa607('0x1a')]));require(_0xa607('0x1e'))[_0xa607('0x1f')](socket);function respondWithStatusCode(_0x2cd75f,_0x239dee){_0x239dee=_0x239dee||0xcc;return function(_0x57abb3){if(_0x57abb3){return _0x2cd75f['sendStatus'](_0x239dee);}return _0x2cd75f[_0xa607('0x20')](_0x239dee)['end']();};}function respondWithResult(_0x24a022,_0xa43e31){_0xa43e31=_0xa43e31||0xc8;return function(_0x1a18a1){if(_0x1a18a1){return _0x24a022[_0xa607('0x20')](_0xa43e31)['json'](_0x1a18a1);}};}function respondWithFilteredResult(_0x4355c5,_0x1d769b){return function(_0x2391d9){if(_0x2391d9){var _0x268303=typeof _0x1d769b[_0xa607('0x21')]==='undefined'&&typeof _0x1d769b[_0xa607('0x22')]===_0xa607('0x23');var _0x46982f=_0x2391d9[_0xa607('0x24')];var _0xd62e86=_0x268303?0x0:_0x1d769b[_0xa607('0x21')];var _0x51992c=_0x268303?_0x2391d9['count']:_0x1d769b['offset']+_0x1d769b[_0xa607('0x22')];var _0x3c3513;if(_0x51992c>=_0x46982f){_0x51992c=_0x46982f;_0x3c3513=0xc8;}else{_0x3c3513=0xce;}_0x4355c5[_0xa607('0x20')](_0x3c3513);return _0x4355c5[_0xa607('0x25')](_0xa607('0x26'),_0xd62e86+'-'+_0x51992c+'/'+_0x46982f)[_0xa607('0x27')](_0x2391d9);}return null;};}function patchUpdates(_0x1d383b){return function(_0xbcc268){try{jsonpatch[_0xa607('0x28')](_0xbcc268,_0x1d383b,!![]);}catch(_0x58e167){return BPromise[_0xa607('0x29')](_0x58e167);}return _0xbcc268[_0xa607('0x2a')]();};}function saveUpdates(_0x191bea,_0x5584c4){return function(_0x2aca9c){if(_0x2aca9c){return _0x2aca9c['update'](_0x191bea)[_0xa607('0x2b')](function(_0x1ff215){return _0x1ff215;});}return null;};}function removeEntity(_0x5efcba,_0x15a4d7){return function(_0x5330fe){if(_0x5330fe){return _0x5330fe[_0xa607('0x2c')]()[_0xa607('0x2b')](function(){var _0x5de84b=_0x5330fe[_0xa607('0x2d')]({'plain':!![]});var _0x435a9c='Plugins';return db[_0xa607('0x2e')][_0xa607('0x2c')]({'where':{'type':_0x435a9c,'resourceId':_0x5de84b['id']}})[_0xa607('0x2b')](function(){return _0x5330fe;});})[_0xa607('0x2b')](function(){_0x5efcba['status'](0xcc)[_0xa607('0x2f')]();});}};}function handleEntityNotFound(_0x493802,_0x4b6742){return function(_0x54769a){if(!_0x54769a){_0x493802['sendStatus'](0x194);}return _0x54769a;};}function handleError(_0x104ba8,_0x4cb665){_0x4cb665=_0x4cb665||0x1f4;return function(_0x4e607c){logger[_0xa607('0x30')](_0x4e607c['stack']);if(_0x4e607c[_0xa607('0x31')]){delete _0x4e607c['name'];}_0x104ba8['status'](_0x4cb665)['send'](_0x4e607c);};}exports[_0xa607('0x32')]=function(_0x3a97dc,_0x2a3d60){var _0x44dfb0={},_0x37e73b={},_0x449c23={'count':0x0,'rows':[]};var _0x437c08=_[_0xa607('0x33')](db[_0xa607('0x34')]['rawAttributes'],function(_0x4cf907){return{'name':_0x4cf907['fieldName'],'type':_0x4cf907[_0xa607('0x35')][_0xa607('0x36')]};});_0x37e73b[_0xa607('0x37')]=_['map'](_0x437c08,_0xa607('0x31'));_0x37e73b[_0xa607('0x38')]=_[_0xa607('0x39')](_0x3a97dc['query']);_0x37e73b[_0xa607('0x3a')]=_[_0xa607('0x3b')](_0x37e73b[_0xa607('0x37')],_0x37e73b[_0xa607('0x38')]);_0x44dfb0[_0xa607('0x3c')]=_[_0xa607('0x3b')](_0x37e73b[_0xa607('0x37')],qs[_0xa607('0x3d')](_0x3a97dc[_0xa607('0x38')][_0xa607('0x3d')]));_0x44dfb0[_0xa607('0x3c')]=_0x44dfb0['attributes'][_0xa607('0x3e')]?_0x44dfb0[_0xa607('0x3c')]:_0x37e73b[_0xa607('0x37')];if(!_0x3a97dc[_0xa607('0x38')][_0xa607('0x3f')]('nolimit')){_0x44dfb0[_0xa607('0x22')]=qs['limit'](_0x3a97dc[_0xa607('0x38')][_0xa607('0x22')]);_0x44dfb0[_0xa607('0x21')]=qs[_0xa607('0x21')](_0x3a97dc[_0xa607('0x38')][_0xa607('0x21')]);}_0x44dfb0['order']=qs['sort'](_0x3a97dc['query'][_0xa607('0x40')]);_0x44dfb0['where']=qs[_0xa607('0x3a')](_[_0xa607('0x41')](_0x3a97dc[_0xa607('0x38')],_0x37e73b[_0xa607('0x3a')]),_0x437c08);if(_0x3a97dc[_0xa607('0x38')]['filter']){_0x44dfb0['where']=_[_0xa607('0x42')](_0x44dfb0[_0xa607('0x43')],{'$or':_[_0xa607('0x33')](_0x437c08,function(_0x10615c){if(_0x10615c['type']!=='VIRTUAL'){var _0x410c11={};_0x410c11[_0x10615c['name']]={'$like':'%'+_0x3a97dc[_0xa607('0x38')][_0xa607('0x44')]+'%'};return _0x410c11;}})});}_0x44dfb0=_[_0xa607('0x42')]({},_0x44dfb0,_0x3a97dc[_0xa607('0x45')]);var _0x4c8eb1={'where':_0x44dfb0[_0xa607('0x43')]};return db[_0xa607('0x34')][_0xa607('0x24')](_0x4c8eb1)[_0xa607('0x2b')](function(_0x55dc4c){_0x449c23[_0xa607('0x24')]=_0x55dc4c;if(_0x3a97dc[_0xa607('0x38')][_0xa607('0x46')]){_0x44dfb0[_0xa607('0x47')]=[{'all':!![]}];}return db[_0xa607('0x34')][_0xa607('0x48')](_0x44dfb0);})[_0xa607('0x2b')](function(_0x4ceecb){_0x449c23[_0xa607('0x49')]=_0x4ceecb;return _0x449c23;})['then'](respondWithFilteredResult(_0x2a3d60,_0x44dfb0))[_0xa607('0x4a')](handleError(_0x2a3d60,null));};exports['show']=function(_0x398131,_0x1b957b){var _0x8eec7c={'raw':!![],'where':{'id':_0x398131[_0xa607('0x4b')]['id']}},_0x4abab7={};_0x4abab7[_0xa607('0x37')]=_[_0xa607('0x39')](db[_0xa607('0x34')][_0xa607('0x4c')]);_0x4abab7[_0xa607('0x38')]=_[_0xa607('0x39')](_0x398131['query']);_0x4abab7[_0xa607('0x3a')]=_['intersection'](_0x4abab7[_0xa607('0x37')],_0x4abab7[_0xa607('0x38')]);_0x8eec7c[_0xa607('0x3c')]=_[_0xa607('0x3b')](_0x4abab7[_0xa607('0x37')],qs[_0xa607('0x3d')](_0x398131['query'][_0xa607('0x3d')]));_0x8eec7c[_0xa607('0x3c')]=_0x8eec7c[_0xa607('0x3c')][_0xa607('0x3e')]?_0x8eec7c[_0xa607('0x3c')]:_0x4abab7[_0xa607('0x37')];if(_0x398131[_0xa607('0x38')][_0xa607('0x46')]){_0x8eec7c[_0xa607('0x47')]=[{'all':!![]}];}_0x8eec7c=_['merge']({},_0x8eec7c,_0x398131[_0xa607('0x45')]);return db['Plugin'][_0xa607('0x4d')](_0x8eec7c)[_0xa607('0x2b')](handleEntityNotFound(_0x1b957b,null))[_0xa607('0x2b')](respondWithResult(_0x1b957b,null))[_0xa607('0x4a')](handleError(_0x1b957b,null));};exports['download']=function(_0x43d395,_0x445e28,_0x520208){return db[_0xa607('0x34')][_0xa607('0x4d')]({'where':{'id':_0x43d395['params']['id']},'attributes':[_0xa607('0x31'),'path'],'raw':!![]})[_0xa607('0x2b')](handleEntityNotFound(_0x445e28,null))[_0xa607('0x2b')](function(_0x1c6e22){if(_0x1c6e22){var _0x42dc63=path[_0xa607('0x4e')](config[_0xa607('0x4f')],_0xa607('0x50'),util[_0xa607('0x51')](_0xa607('0x52'),path[_0xa607('0x53')](_0x1c6e22[_0xa607('0x5')])));var _0x177040=fs[_0xa607('0x54')](_0x42dc63);var _0x2eda23=archiver(_0xa607('0x55'),{'zlib':{'level':0x9}});_0x2eda23['on'](_0xa607('0x56'),function(_0x1d1bcc){if(_0x1d1bcc[_0xa607('0x57')]===_0xa607('0x58')){logger[_0xa607('0x30')](_0x1d1bcc);}else{throw new db[(_0xa607('0x59'))]['Error'](_0xa607('0x5a'));}});_0x2eda23['on'](_0xa607('0x30'),function(_0x3c0c7d){throw new db[(_0xa607('0x59'))][(_0xa607('0x5b'))](_0xa607('0x5a'));});_0x2eda23[_0xa607('0x5c')](_0x177040);_0x2eda23[_0xa607('0x5d')](_0xa607('0x5e'),{'cwd':path[_0xa607('0x4e')](config[_0xa607('0x4f')],_0xa607('0x50'),path[_0xa607('0x5f')](_0x1c6e22[_0xa607('0x5')])),'ignore':[path[_0xa607('0x4e')](path[_0xa607('0x53')](_0x1c6e22['path']),_0xa607('0x60')),path[_0xa607('0x4e')](path[_0xa607('0x53')](_0x1c6e22['path']),_0xa607('0x61'))],'nodir':!![]})[_0xa607('0x62')]();_0x177040['on'](_0xa607('0x63'),function(){if(!fs[_0xa607('0x64')](_0x42dc63)){throw new db[(_0xa607('0x59'))][(_0xa607('0x5b'))]('Plugin\x20not\x20found');}return _0x445e28[_0xa607('0x65')](_0x42dc63,util[_0xa607('0x51')](_0xa607('0x52'),path[_0xa607('0x53')](_0x1c6e22[_0xa607('0x5')])),function(_0x5518e5){if(_0x5518e5){throw new db['Sequelize']['Error'](_0xa607('0x66'));}fs['unlinkSync'](_0x42dc63);logger[_0xa607('0x67')](_0xa607('0x68'));logger[_0xa607('0x67')](_0xa607('0x69'));});});}return null;})[_0xa607('0x4a')](handleError(_0x445e28,null));};exports[_0xa607('0x6a')]=function(_0x30585f,_0x51b500,_0x17b750){var _0x3e050e=path[_0xa607('0x53')](_0x30585f[_0xa607('0x6b')][_0xa607('0x6c')],path[_0xa607('0x6d')](_0x30585f[_0xa607('0x6b')][_0xa607('0x6c')]));var _0x2ae265=path['join'](config['root'],_0xa607('0x50'),_0x30585f[_0xa607('0x6b')][_0xa607('0x6c')]);var _0x83330=path[_0xa607('0x4e')](config[_0xa607('0x4f')],_0xa607('0x50'),_0x3e050e);logger[_0xa607('0x67')](_0xa607('0x6e'),_0x2ae265);logger[_0xa607('0x67')](_0xa607('0x6f'),_0x83330);try{fs[_0xa607('0x70')](_0x2ae265,parseInt(_0xa607('0x71'),0x8));extract(_0x2ae265,{'dir':_0x83330},function(_0x2b115a){if(_0x2b115a){logger[_0xa607('0x30')](_0x2b115a);handleError(_0x2b115a,!![]);};var _0x65e3fc=fs[_0xa607('0x72')](_0x83330);if(_0x65e3fc[_0xa607('0x3e')]>0x1){removeReferences(_0x2ae265,_0x83330);logger['error']('Invalid\x20plugin\x20structure');return _0x17b750(new Error('Invalid\x20plugin\x20structure'));}var _0x35d0b6=fs['lstatSync'](path[_0xa607('0x4e')](_0x83330,_0x65e3fc[0x0]));if(_0x35d0b6[_0xa607('0x73')]()){removeReferences(_0x2ae265,_0x83330);logger[_0xa607('0x30')](_0xa607('0x74'));return _0x17b750(new Error(_0xa607('0x74')));}if(_0x35d0b6[_0xa607('0x75')]()){var _0x1c406a=fs[_0xa607('0x72')](path['join'](_0x83330,_0x65e3fc[0x0]));if(_0x1c406a[_0xa607('0x3e')]===0x0){removeReferences(_0x2ae265,_0x83330);logger[_0xa607('0x30')](_0xa607('0x74'));return _0x17b750(new Error('Invalid\x20plugin\x20structure'));}var _0x4edb89=_0x1c406a['some'](function(_0xfb669e){return _0xfb669e==='manifest.json';});if(!_0x4edb89){return _0x17b750(new Error(_0xa607('0x76')));}var _0x355288=fs['readFileSync'](path[_0xa607('0x4e')](_0x83330,_0x65e3fc[0x0],_0xa607('0x77')));var _0x166235=JSON[_0xa607('0x78')](_0x355288);if('undefined'==typeof _0x166235['name']){return _0x17b750(new Error(_0xa607('0x79')));}if(_0xa607('0x23')==typeof _0x166235[_0xa607('0x35')]){return _0x17b750(new Error(_0xa607('0x7a')));}if(_0xa607('0x23')==typeof _0x166235['version']){return _0x17b750(new Error(_0xa607('0x7b')));}if(_0xa607('0x23')==typeof _0x166235[_0xa607('0x7c')]){return _0x17b750(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x166235[_0xa607('0x35')]===_0xa607('0x7d')){if(_0xa607('0x23')==typeof _0x166235[_0xa607('0x7c')][_0xa607('0x7e')]){return _0x17b750(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xa607('0x23')==typeof _0x166235[_0xa607('0x7c')][_0xa607('0x7e')][_0xa607('0x7f')]&&'undefined'==typeof _0x166235['parameters']['views'][_0xa607('0x80')]){return _0x17b750(new Error(_0xa607('0x81')));}}else if(_0x166235[_0xa607('0x35')]===_0xa607('0x82')){if(_0xa607('0x23')==typeof _0x166235[_0xa607('0x7c')]['scriptName']){return _0x17b750(new Error(_0xa607('0x83')));}if(_0xa607('0x23')==typeof _0x166235[_0xa607('0x7c')][_0xa607('0x84')]){return _0x17b750(new Error(_0xa607('0x85')));}}else{return _0x17b750(new Error(_0xa607('0x86')));}var _0x2d2a37=_0x166235[_0xa607('0x31')];var _0x3669cb=_0x166235['description'];var _0x221b97=_0x166235[_0xa607('0x35')];var _0x32e874=_0x166235[_0xa607('0x87')]?_0x166235[_0xa607('0x87')]:'always';var _0x2fe8ca=_0x166235[_0xa607('0x88')]?_0x166235[_0xa607('0x88')]:_0xa607('0x89');var _0x922a4f='';var _0x158a41='';var _0x56f4b5='';var _0x22b9b3='';var _0x3fd558=_0x166235[_0xa607('0x8a')];if(_0x221b97===_0xa607('0x7d')){if(_0xa607('0x23')!=typeof _0x166235['parameters'][_0xa607('0x7e')][_0xa607('0x7f')]){var _0x401a57=_0x166235[_0xa607('0x7c')][_0xa607('0x7e')][_0xa607('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x401a57)){_0x922a4f=path['join']('plugins',_0x3e050e,_0x65e3fc[0x0],_0x401a57);}else{_0x922a4f=_0x401a57;}}else{logger['info'](_0xa607('0x8b'));}if(_0xa607('0x23')!=typeof _0x166235[_0xa607('0x7c')][_0xa607('0x7e')]['agent']){var _0x24fb11=_0x166235[_0xa607('0x7c')][_0xa607('0x7e')][_0xa607('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xa607('0x8c')](_0x24fb11)){_0x158a41=path['join'](_0xa607('0x8d'),_0x3e050e,_0x65e3fc[0x0],_0x24fb11);}else{_0x158a41=_0x24fb11;}}else{logger[_0xa607('0x67')](_0xa607('0x8e'));}}else if(_0x221b97==='script'){_0x56f4b5=_0x166235[_0xa607('0x7c')]['scriptName'];_0x22b9b3=_0x166235[_0xa607('0x7c')][_0xa607('0x84')];if('undefined'!=typeof _0x166235[_0xa607('0x7c')][_0xa607('0x7e')]){if(_0xa607('0x23')!=typeof _0x166235[_0xa607('0x7c')][_0xa607('0x7e')][_0xa607('0x7f')]){var _0x401a57=_0x166235[_0xa607('0x7c')][_0xa607('0x7e')][_0xa607('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xa607('0x8c')](_0x401a57)){_0x922a4f=path[_0xa607('0x4e')](_0xa607('0x8d'),_0x3e050e,_0x65e3fc[0x0],_0x401a57);}else{_0x922a4f=_0x401a57;}}if(_0xa607('0x23')!=typeof _0x166235[_0xa607('0x7c')][_0xa607('0x7e')][_0xa607('0x80')]){var _0x24fb11=_0x166235['parameters'][_0xa607('0x7e')][_0xa607('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xa607('0x8c')](_0x24fb11)){_0x158a41=path[_0xa607('0x4e')]('plugins',_0x3e050e,_0x65e3fc[0x0],_0x24fb11);}else{_0x158a41=_0x24fb11;}}}}var _0x2671bc={'name':_0x2d2a37,'description':_0x3669cb,'path':path[_0xa607('0x4e')](_0x3e050e,_0x65e3fc[0x0]),'type':_0x221b97,'sidebar':_0x32e874,'icon':_0x2fe8ca,'adminUrl':_0x922a4f,'agentUrl':_0x158a41,'scriptName':_0x56f4b5,'scriptPath':_0x22b9b3,'version':_0x3fd558};removeReferences(_0x2ae265,null);return db[_0xa607('0x34')][_0xa607('0x8f')](_0x2671bc)['then'](function(_0x22f60b){var _0x1d2f95={'role':_0x30585f['body'][_0xa607('0x90')],'userProfileId':_0x30585f[_0xa607('0x91')][_0xa607('0x92')]};if(!_0x1d2f95)throw new Error(_0xa607('0x93'));if(_0x1d2f95[_0xa607('0x90')]===_0xa607('0x94')){var _0x51f186=_0x22f60b[_0xa607('0x2d')]({'plain':!![]});return db[_0xa607('0x95')][_0xa607('0x4d')]({'where':{'name':_0xa607('0x96'),'userProfileId':_0x1d2f95[_0xa607('0x92')]},'raw':!![]})['then'](function(_0x51a8f4){if(_0x51a8f4&&_0x51a8f4[_0xa607('0x97')]===0x0){return db[_0xa607('0x2e')]['create']({'name':_0x51f186[_0xa607('0x31')],'resourceId':_0x51f186['id'],'type':_0x51a8f4['name'],'sectionId':_0x51a8f4['id']},{})[_0xa607('0x2b')](function(){return _0x22f60b;});}else{return _0x22f60b;}})[_0xa607('0x4a')](function(_0x892537){logger[_0xa607('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x892537);throw _0x892537;});}return _0x22f60b;})[_0xa607('0x2b')](respondWithResult(_0x51b500,null))[_0xa607('0x4a')](handleError(_0x51b500,null));}});}catch(_0x52dae2){_0x51b500[_0xa607('0x20')](0x1f4)['send'](_0x52dae2);}};function removeReferences(_0x5daa15,_0x3f1a53){try{if(_0x5daa15){fs[_0xa607('0x98')](_0x5daa15);logger[_0xa607('0x67')](_0xa607('0x99'));}if(_0x3f1a53){rimraf(_0x3f1a53,function(){});logger[_0xa607('0x67')]('Extracted\x20folder\x20removed');}}catch(_0x4a2fb4){logger['error'](_0x4a2fb4);}}exports[_0xa607('0x9a')]=function(_0x2e046d,_0x4eaae5,_0x3ee0ba){return db[_0xa607('0x34')][_0xa607('0x4d')]({'where':{'id':_0x2e046d[_0xa607('0x4b')]['id']}})[_0xa607('0x2b')](handleEntityNotFound(_0x4eaae5,null))['then'](saveUpdates(_0x2e046d[_0xa607('0x91')],null))[_0xa607('0x2b')](respondWithResult(_0x4eaae5,null))[_0xa607('0x4a')](handleError(_0x4eaae5,null));};exports['delete']=function(_0x434cb5,_0x57c078,_0x379639){return db['Plugin'][_0xa607('0x4d')]({'where':{'id':_0x434cb5['params']['id']}})['then'](function(_0x3c7149){if(_0x3c7149){return _0x3c7149[_0xa607('0x2c')]();}})[_0xa607('0x2b')](function(_0x19ef75){rimraf(path[_0xa607('0x4e')](config[_0xa607('0x4f')],_0xa607('0x50'),path['dirname'](_0x19ef75['path'])),function(){});return _0x19ef75;})[_0xa607('0x2b')](handleEntityNotFound(_0x57c078,null))[_0xa607('0x2b')](respondWithStatusCode(_0x57c078,null))[_0xa607('0x4a')](handleError(_0x57c078,null));};exports[_0xa607('0x9b')]=function(_0x254177,_0x3c59db,_0x2fdfb4){return BPromise['resolve']()[_0xa607('0x2b')](function(){if(!_0x254177[_0xa607('0x38')]['path']){throw new Error(_0xa607('0x9c'));}if(!_0x254177['query'][_0xa607('0x9d')]){throw new Error(_0xa607('0x9e'));}var _0x4e6289=_0x254177[_0xa607('0x38')][_0xa607('0x9f')]?_0x254177[_0xa607('0x38')][_0xa607('0x9f')]+':'+_0x254177[_0xa607('0x38')][_0xa607('0x9d')]:_0xa607('0xa0')+_0x254177[_0xa607('0x38')][_0xa607('0x9d')];var _0x1c831d=_0x254177[_0xa607('0x38')][_0xa607('0x27')]?_0x254177[_0xa607('0x38')][_0xa607('0x27')]:!![];var _0xfd3c95=_0x254177[_0xa607('0x38')]['encoding']?_0x254177[_0xa607('0x38')][_0xa607('0xa1')]:null;var _0x5cd0c5={'method':_0x254177[_0xa607('0xa2')],'uri':util[_0xa607('0x51')](_0xa607('0xa3'),_0x4e6289,_0x254177['query']['path']),'json':_0x1c831d,'resolveWithFullResponse':!![],'encoding':_0xfd3c95,'qs':_0x254177[_0xa607('0x38')]};if(_0x254177[_0xa607('0xa4')]){_0x5cd0c5[_0xa607('0xa4')]=_0x254177[_0xa607('0xa4')];if(_0x5cd0c5[_0xa607('0xa4')][_0xa607('0xa5')]){delete _0x5cd0c5[_0xa607('0xa4')][_0xa607('0xa5')];}}if(_0x5cd0c5[_0xa607('0xa4')][_0xa607('0xa6')]){delete _0x5cd0c5[_0xa607('0xa4')][_0xa607('0xa6')];}return rp(_0x5cd0c5);})[_0xa607('0x2b')](function(_0x1d99d4){if(_0x1d99d4){_0x3c59db['set'](_0x1d99d4[_0xa607('0xa4')]);logger[_0xa607('0x67')](_0x1d99d4[_0xa607('0x91')]);if(_[_0xa607('0xa7')](_0x254177[_0xa607('0x38')][_0xa607('0x5')],_0xa607('0x65'))&&_0x1d99d4[_0xa607('0xa8')]==0x1f4){return _0x3c59db[_0xa607('0xa9')](_0x1d99d4[_0xa607('0xa8')]);}else{return _0x3c59db[_0xa607('0x20')](_0x1d99d4[_0xa607('0xa8')])[_0xa607('0xaa')](_0x1d99d4[_0xa607('0x91')]);}}else{return _0x3c59db[_0xa607('0xa9')](0xc8);}})['catch'](handleError(_0x3c59db,null));};exports['webhookPost']=function(_0x16ceeb,_0x581710,_0x258963){return BPromise[_0xa607('0xab')]()[_0xa607('0x2b')](function(){if(!_0x16ceeb[_0xa607('0x38')][_0xa607('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x16ceeb[_0xa607('0x38')][_0xa607('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x878350=_0x16ceeb[_0xa607('0x38')][_0xa607('0x9f')]?_0x16ceeb['query'][_0xa607('0x9f')]+':'+_0x16ceeb['query'][_0xa607('0x9d')]:_0xa607('0xa0')+_0x16ceeb[_0xa607('0x38')][_0xa607('0x9d')];var _0x3e9f75=_0x16ceeb[_0xa607('0x38')][_0xa607('0x27')]?_0x16ceeb[_0xa607('0x38')][_0xa607('0x27')]:!![];var _0x48dac0=_0x16ceeb[_0xa607('0x38')][_0xa607('0xa1')]?_0x16ceeb[_0xa607('0x38')][_0xa607('0xa1')]:null;var _0x27b2e6={'method':_0x16ceeb[_0xa607('0xa2')],'uri':util[_0xa607('0x51')]('%s%s',_0x878350,_0x16ceeb[_0xa607('0x38')][_0xa607('0x5')]),'json':_0x3e9f75,'resolveWithFullResponse':!![],'encoding':_0x48dac0,'body':_0x16ceeb['body']};if(_0x16ceeb['headers']){_0x27b2e6['headers']=_0x16ceeb[_0xa607('0xa4')];if(_0x27b2e6[_0xa607('0xa4')][_0xa607('0xa5')]){delete _0x27b2e6[_0xa607('0xa4')]['content-length'];}}if(_0x27b2e6[_0xa607('0xa4')][_0xa607('0xa6')]){delete _0x27b2e6[_0xa607('0xa4')][_0xa607('0xa6')];}return rp(_0x27b2e6);})[_0xa607('0x2b')](function(_0x373693){if(_0x373693){_0x581710[_0xa607('0x25')](_0x373693[_0xa607('0xa4')]);logger[_0xa607('0x67')](_0x373693[_0xa607('0x91')]);return _0x581710[_0xa607('0x20')](_0x373693[_0xa607('0xa8')])['send'](_0x373693[_0xa607('0x91')]);}else{return _0x581710[_0xa607('0xa9')](0xc8);}})[_0xa607('0x4a')](handleError(_0x581710,null));}; \ No newline at end of file +var _0xbad0=['set','Content-Range','apply','reject','save','Plugins','destroy','then','stack','send','index','map','Plugin','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','name','filter','options','includeAll','findAll','rows','catch','show','include','find','download','params','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','dirname','path','node_modules/**/*','finalize','close','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','get','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','resolve','hostname','port','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x58aa25,_0x5d5cd9){var _0x199279=function(_0x3433b8){while(--_0x3433b8){_0x58aa25['push'](_0x58aa25['shift']());}};_0x199279(++_0x5d5cd9);}(_0xbad0,0x82));var _0x0bad=function(_0x4b4b47,_0x1088bb){_0x4b4b47=_0x4b4b47-0x0;var _0x26006b=_0xbad0[_0x4b4b47];return _0x26006b;};'use strict';var emlformat=require(_0x0bad('0x0'));var rimraf=require(_0x0bad('0x1'));var zipdir=require(_0x0bad('0x2'));var jsonpatch=require(_0x0bad('0x3'));var rp=require(_0x0bad('0x4'));var moment=require('moment');var BPromise=require(_0x0bad('0x5'));var Mustache=require('mustache');var util=require(_0x0bad('0x6'));var path=require('path');var sox=require(_0x0bad('0x7'));var csv=require('to-csv');var ejs=require(_0x0bad('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0bad('0x9'));var crypto=require('crypto');var jsforce=require(_0x0bad('0xa'));var deskjs=require(_0x0bad('0xb'));var toCsv=require(_0x0bad('0xc'));var querystring=require('querystring');var Papa=require(_0x0bad('0xd'));var extract=require('extract-zip');var rimraf=require(_0x0bad('0x1'));var archiver=require('archiver');var Redis=require(_0x0bad('0xe'));var authService=require(_0x0bad('0xf'));var qs=require(_0x0bad('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0bad('0x11'))(_0x0bad('0x12'));var utils=require(_0x0bad('0x13'));var config=require(_0x0bad('0x14'));var licenseUtil=require(_0x0bad('0x15'));var db=require(_0x0bad('0x16'))['db'];config[_0x0bad('0x17')]=_[_0x0bad('0x18')](config[_0x0bad('0x17')],{'host':_0x0bad('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')[_0x0bad('0x1a')](socket);function respondWithStatusCode(_0x47cb10,_0x15177a){_0x15177a=_0x15177a||0xcc;return function(_0x95f0af){if(_0x95f0af){return _0x47cb10[_0x0bad('0x1b')](_0x15177a);}return _0x47cb10[_0x0bad('0x1c')](_0x15177a)[_0x0bad('0x1d')]();};}function respondWithResult(_0x533fb8,_0x20e6cc){_0x20e6cc=_0x20e6cc||0xc8;return function(_0x39d6c3){if(_0x39d6c3){return _0x533fb8[_0x0bad('0x1c')](_0x20e6cc)[_0x0bad('0x1e')](_0x39d6c3);}};}function respondWithFilteredResult(_0x351945,_0x267242){return function(_0x135890){if(_0x135890){var _0x106aea=typeof _0x267242[_0x0bad('0x1f')]===_0x0bad('0x20')&&typeof _0x267242[_0x0bad('0x21')]===_0x0bad('0x20');var _0x20e35a=_0x135890['count'];var _0x18214f=_0x106aea?0x0:_0x267242['offset'];var _0x41cc60=_0x106aea?_0x135890[_0x0bad('0x22')]:_0x267242[_0x0bad('0x1f')]+_0x267242[_0x0bad('0x21')];var _0xfb75e7;if(_0x41cc60>=_0x20e35a){_0x41cc60=_0x20e35a;_0xfb75e7=0xc8;}else{_0xfb75e7=0xce;}_0x351945[_0x0bad('0x1c')](_0xfb75e7);return _0x351945[_0x0bad('0x23')](_0x0bad('0x24'),_0x18214f+'-'+_0x41cc60+'/'+_0x20e35a)[_0x0bad('0x1e')](_0x135890);}return null;};}function patchUpdates(_0x30d45c){return function(_0x296679){try{jsonpatch[_0x0bad('0x25')](_0x296679,_0x30d45c,!![]);}catch(_0x2e33ab){return BPromise[_0x0bad('0x26')](_0x2e33ab);}return _0x296679[_0x0bad('0x27')]();};}function saveUpdates(_0x326cab,_0x215e73){return function(_0x3f88fd){if(_0x3f88fd){return _0x3f88fd['update'](_0x326cab)['then'](function(_0x124e27){return _0x124e27;});}return null;};}function removeEntity(_0x2293f5,_0x4412cf){return function(_0x59228a){if(_0x59228a){return _0x59228a['destroy']()['then'](function(){var _0x13a1fc=_0x59228a['get']({'plain':!![]});var _0x1e14cd=_0x0bad('0x28');return db['UserProfileResource'][_0x0bad('0x29')]({'where':{'type':_0x1e14cd,'resourceId':_0x13a1fc['id']}})['then'](function(){return _0x59228a;});})[_0x0bad('0x2a')](function(){_0x2293f5[_0x0bad('0x1c')](0xcc)[_0x0bad('0x1d')]();});}};}function handleEntityNotFound(_0x18b60f,_0x46a2b9){return function(_0x1c173e){if(!_0x1c173e){_0x18b60f[_0x0bad('0x1b')](0x194);}return _0x1c173e;};}function handleError(_0x349de4,_0x3bc0c7){_0x3bc0c7=_0x3bc0c7||0x1f4;return function(_0x1b3305){logger['error'](_0x1b3305[_0x0bad('0x2b')]);if(_0x1b3305['name']){delete _0x1b3305['name'];}_0x349de4[_0x0bad('0x1c')](_0x3bc0c7)[_0x0bad('0x2c')](_0x1b3305);};}exports[_0x0bad('0x2d')]=function(_0x483571,_0x61f8b){var _0x25f4a3={},_0x36989e={},_0xc9ee01={'count':0x0,'rows':[]};var _0x50279e=_[_0x0bad('0x2e')](db[_0x0bad('0x2f')][_0x0bad('0x30')],function(_0x55aa4c){return{'name':_0x55aa4c[_0x0bad('0x31')],'type':_0x55aa4c['type'][_0x0bad('0x32')]};});_0x36989e[_0x0bad('0x33')]=_[_0x0bad('0x2e')](_0x50279e,'name');_0x36989e[_0x0bad('0x34')]=_[_0x0bad('0x35')](_0x483571[_0x0bad('0x34')]);_0x36989e[_0x0bad('0x36')]=_[_0x0bad('0x37')](_0x36989e[_0x0bad('0x33')],_0x36989e[_0x0bad('0x34')]);_0x25f4a3[_0x0bad('0x38')]=_[_0x0bad('0x37')](_0x36989e[_0x0bad('0x33')],qs[_0x0bad('0x39')](_0x483571['query'][_0x0bad('0x39')]));_0x25f4a3[_0x0bad('0x38')]=_0x25f4a3[_0x0bad('0x38')][_0x0bad('0x3a')]?_0x25f4a3[_0x0bad('0x38')]:_0x36989e[_0x0bad('0x33')];if(!_0x483571[_0x0bad('0x34')]['hasOwnProperty'](_0x0bad('0x3b'))){_0x25f4a3['limit']=qs['limit'](_0x483571[_0x0bad('0x34')]['limit']);_0x25f4a3[_0x0bad('0x1f')]=qs[_0x0bad('0x1f')](_0x483571[_0x0bad('0x34')][_0x0bad('0x1f')]);}_0x25f4a3[_0x0bad('0x3c')]=qs[_0x0bad('0x3d')](_0x483571['query'][_0x0bad('0x3d')]);_0x25f4a3[_0x0bad('0x3e')]=qs['filters'](_['pick'](_0x483571[_0x0bad('0x34')],_0x36989e[_0x0bad('0x36')]),_0x50279e);if(_0x483571[_0x0bad('0x34')]['filter']){_0x25f4a3['where']=_[_0x0bad('0x3f')](_0x25f4a3[_0x0bad('0x3e')],{'$or':_[_0x0bad('0x2e')](_0x50279e,function(_0xe772e8){if(_0xe772e8[_0x0bad('0x40')]!==_0x0bad('0x41')){var _0x490d09={};_0x490d09[_0xe772e8[_0x0bad('0x42')]]={'$like':'%'+_0x483571[_0x0bad('0x34')][_0x0bad('0x43')]+'%'};return _0x490d09;}})});}_0x25f4a3=_[_0x0bad('0x3f')]({},_0x25f4a3,_0x483571[_0x0bad('0x44')]);var _0x137cc2={'where':_0x25f4a3['where']};return db[_0x0bad('0x2f')][_0x0bad('0x22')](_0x137cc2)['then'](function(_0x2299b9){_0xc9ee01[_0x0bad('0x22')]=_0x2299b9;if(_0x483571[_0x0bad('0x34')][_0x0bad('0x45')]){_0x25f4a3['include']=[{'all':!![]}];}return db['Plugin'][_0x0bad('0x46')](_0x25f4a3);})[_0x0bad('0x2a')](function(_0x4a3dd7){_0xc9ee01[_0x0bad('0x47')]=_0x4a3dd7;return _0xc9ee01;})[_0x0bad('0x2a')](respondWithFilteredResult(_0x61f8b,_0x25f4a3))[_0x0bad('0x48')](handleError(_0x61f8b,null));};exports[_0x0bad('0x49')]=function(_0x33090d,_0xda6bb2){var _0x461f77={'raw':!![],'where':{'id':_0x33090d['params']['id']}},_0x1450dc={};_0x1450dc['model']=_[_0x0bad('0x35')](db[_0x0bad('0x2f')]['rawAttributes']);_0x1450dc[_0x0bad('0x34')]=_[_0x0bad('0x35')](_0x33090d[_0x0bad('0x34')]);_0x1450dc[_0x0bad('0x36')]=_[_0x0bad('0x37')](_0x1450dc[_0x0bad('0x33')],_0x1450dc[_0x0bad('0x34')]);_0x461f77[_0x0bad('0x38')]=_[_0x0bad('0x37')](_0x1450dc[_0x0bad('0x33')],qs[_0x0bad('0x39')](_0x33090d[_0x0bad('0x34')]['fields']));_0x461f77[_0x0bad('0x38')]=_0x461f77['attributes'][_0x0bad('0x3a')]?_0x461f77[_0x0bad('0x38')]:_0x1450dc[_0x0bad('0x33')];if(_0x33090d['query'][_0x0bad('0x45')]){_0x461f77[_0x0bad('0x4a')]=[{'all':!![]}];}_0x461f77=_[_0x0bad('0x3f')]({},_0x461f77,_0x33090d[_0x0bad('0x44')]);return db[_0x0bad('0x2f')][_0x0bad('0x4b')](_0x461f77)[_0x0bad('0x2a')](handleEntityNotFound(_0xda6bb2,null))['then'](respondWithResult(_0xda6bb2,null))[_0x0bad('0x48')](handleError(_0xda6bb2,null));};exports[_0x0bad('0x4c')]=function(_0x4f7f42,_0xd02424,_0x181a2d){return db[_0x0bad('0x2f')][_0x0bad('0x4b')]({'where':{'id':_0x4f7f42[_0x0bad('0x4d')]['id']},'attributes':['name','path'],'raw':!![]})[_0x0bad('0x2a')](handleEntityNotFound(_0xd02424,null))[_0x0bad('0x2a')](function(_0x2ca228){if(_0x2ca228){var _0x352f22=path[_0x0bad('0x4e')](config[_0x0bad('0x4f')],_0x0bad('0x50'),util[_0x0bad('0x51')](_0x0bad('0x52'),path[_0x0bad('0x53')](_0x2ca228['path'])));var _0x33cece=fs[_0x0bad('0x54')](_0x352f22);var _0x1c60e9=archiver(_0x0bad('0x55'),{'zlib':{'level':0x9}});_0x1c60e9['on']('warning',function(_0x566bfb){if(_0x566bfb[_0x0bad('0x56')]===_0x0bad('0x57')){logger[_0x0bad('0x58')](_0x566bfb);}else{throw new db[(_0x0bad('0x59'))][(_0x0bad('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x1c60e9['on'](_0x0bad('0x58'),function(_0x176d19){throw new db[(_0x0bad('0x59'))][(_0x0bad('0x5a'))](_0x0bad('0x5b'));});_0x1c60e9[_0x0bad('0x5c')](_0x33cece);_0x1c60e9['glob'](_0x0bad('0x5d'),{'cwd':path[_0x0bad('0x4e')](config[_0x0bad('0x4f')],_0x0bad('0x50'),path[_0x0bad('0x5e')](_0x2ca228[_0x0bad('0x5f')])),'ignore':[path[_0x0bad('0x4e')](path[_0x0bad('0x53')](_0x2ca228['path']),_0x0bad('0x60')),path[_0x0bad('0x4e')](path[_0x0bad('0x53')](_0x2ca228['path']),'attachments/**/*')],'nodir':!![]})[_0x0bad('0x61')]();_0x33cece['on'](_0x0bad('0x62'),function(){if(!fs['existsSync'](_0x352f22)){throw new db[(_0x0bad('0x59'))]['Error']('Plugin\x20not\x20found');}return _0xd02424[_0x0bad('0x4c')](_0x352f22,util[_0x0bad('0x51')]('%s.zip',path[_0x0bad('0x53')](_0x2ca228[_0x0bad('0x5f')])),function(_0x417154){if(_0x417154){throw new db[(_0x0bad('0x59'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x0bad('0x63')](_0x352f22);logger[_0x0bad('0x64')](_0x0bad('0x65'));logger[_0x0bad('0x64')](_0x0bad('0x66'));});});}return null;})[_0x0bad('0x48')](handleError(_0xd02424,null));};exports[_0x0bad('0x67')]=function(_0x553459,_0x5a0eac,_0x148592){var _0x6bf6fa=path[_0x0bad('0x53')](_0x553459[_0x0bad('0x68')]['filename'],path[_0x0bad('0x69')](_0x553459['file'][_0x0bad('0x6a')]));var _0xb3f0d8=path['join'](config[_0x0bad('0x4f')],_0x0bad('0x50'),_0x553459[_0x0bad('0x68')][_0x0bad('0x6a')]);var _0x485cda=path[_0x0bad('0x4e')](config['root'],_0x0bad('0x50'),_0x6bf6fa);logger[_0x0bad('0x64')](_0x0bad('0x6b'),_0xb3f0d8);logger['info'](_0x0bad('0x6c'),_0x485cda);try{fs[_0x0bad('0x6d')](_0xb3f0d8,parseInt('0777',0x8));extract(_0xb3f0d8,{'dir':_0x485cda},function(_0x6a2a27){if(_0x6a2a27){logger[_0x0bad('0x58')](_0x6a2a27);handleError(_0x6a2a27,!![]);};var _0x38fda5=fs[_0x0bad('0x6e')](_0x485cda);if(_0x38fda5['length']>0x1){removeReferences(_0xb3f0d8,_0x485cda);logger[_0x0bad('0x58')](_0x0bad('0x6f'));return _0x148592(new Error(_0x0bad('0x6f')));}var _0x240008=fs['lstatSync'](path['join'](_0x485cda,_0x38fda5[0x0]));if(_0x240008[_0x0bad('0x70')]()){removeReferences(_0xb3f0d8,_0x485cda);logger[_0x0bad('0x58')](_0x0bad('0x6f'));return _0x148592(new Error(_0x0bad('0x6f')));}if(_0x240008['isDirectory']()){var _0x5bbeeb=fs['readdirSync'](path[_0x0bad('0x4e')](_0x485cda,_0x38fda5[0x0]));if(_0x5bbeeb['length']===0x0){removeReferences(_0xb3f0d8,_0x485cda);logger[_0x0bad('0x58')](_0x0bad('0x6f'));return _0x148592(new Error(_0x0bad('0x6f')));}var _0x1db237=_0x5bbeeb[_0x0bad('0x71')](function(_0x526439){return _0x526439===_0x0bad('0x72');});if(!_0x1db237){return _0x148592(new Error(_0x0bad('0x73')));}var _0x531c8b=fs[_0x0bad('0x74')](path[_0x0bad('0x4e')](_0x485cda,_0x38fda5[0x0],_0x0bad('0x72')));var _0x40d2cf=JSON[_0x0bad('0x75')](_0x531c8b);if(_0x0bad('0x20')==typeof _0x40d2cf[_0x0bad('0x42')]){return _0x148592(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x40d2cf[_0x0bad('0x40')]){return _0x148592(new Error(_0x0bad('0x76')));}if(_0x0bad('0x20')==typeof _0x40d2cf[_0x0bad('0x77')]){return _0x148592(new Error(_0x0bad('0x78')));}if(_0x0bad('0x20')==typeof _0x40d2cf[_0x0bad('0x79')]){return _0x148592(new Error(_0x0bad('0x7a')));}if(_0x40d2cf['type']===_0x0bad('0x7b')){if(_0x0bad('0x20')==typeof _0x40d2cf[_0x0bad('0x79')]['views']){return _0x148592(new Error(_0x0bad('0x7c')));}if(_0x0bad('0x20')==typeof _0x40d2cf[_0x0bad('0x79')][_0x0bad('0x7d')][_0x0bad('0x7e')]&&_0x0bad('0x20')==typeof _0x40d2cf[_0x0bad('0x79')][_0x0bad('0x7d')][_0x0bad('0x7f')]){return _0x148592(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x40d2cf[_0x0bad('0x40')]===_0x0bad('0x80')){if(_0x0bad('0x20')==typeof _0x40d2cf['parameters'][_0x0bad('0x81')]){return _0x148592(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x0bad('0x20')==typeof _0x40d2cf[_0x0bad('0x79')]['scriptPath']){return _0x148592(new Error(_0x0bad('0x82')));}}else{return _0x148592(new Error(_0x0bad('0x83')));}var _0x1b28e8=_0x40d2cf['name'];var _0x4eb1d6=_0x40d2cf[_0x0bad('0x84')];var _0x534648=_0x40d2cf[_0x0bad('0x40')];var _0x3e8f5a=_0x40d2cf[_0x0bad('0x85')]?_0x40d2cf['sidebar']:_0x0bad('0x86');var _0x2065b9=_0x40d2cf[_0x0bad('0x87')]?_0x40d2cf[_0x0bad('0x87')]:_0x0bad('0x88');var _0x58e990='';var _0x648076='';var _0x29204b='';var _0x67087e='';var _0x1a94c2=_0x40d2cf['version'];if(_0x534648===_0x0bad('0x7b')){if(_0x0bad('0x20')!=typeof _0x40d2cf[_0x0bad('0x79')][_0x0bad('0x7d')]['admin']){var _0x267d86=_0x40d2cf['parameters'][_0x0bad('0x7d')][_0x0bad('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x0bad('0x89')](_0x267d86)){_0x58e990=path[_0x0bad('0x4e')](_0x0bad('0x8a'),_0x6bf6fa,_0x38fda5[0x0],_0x267d86);}else{_0x58e990=_0x267d86;}}else{logger[_0x0bad('0x64')](_0x0bad('0x8b'));}if('undefined'!=typeof _0x40d2cf[_0x0bad('0x79')][_0x0bad('0x7d')]['agent']){var _0xec9c4e=_0x40d2cf[_0x0bad('0x79')][_0x0bad('0x7d')][_0x0bad('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0xec9c4e)){_0x648076=path[_0x0bad('0x4e')](_0x0bad('0x8a'),_0x6bf6fa,_0x38fda5[0x0],_0xec9c4e);}else{_0x648076=_0xec9c4e;}}else{logger[_0x0bad('0x64')](_0x0bad('0x8c'));}}else if(_0x534648===_0x0bad('0x80')){_0x29204b=_0x40d2cf[_0x0bad('0x79')][_0x0bad('0x81')];_0x67087e=_0x40d2cf[_0x0bad('0x79')]['scriptPath'];if(_0x0bad('0x20')!=typeof _0x40d2cf[_0x0bad('0x79')]['views']){if(_0x0bad('0x20')!=typeof _0x40d2cf['parameters'][_0x0bad('0x7d')]['admin']){var _0x267d86=_0x40d2cf[_0x0bad('0x79')][_0x0bad('0x7d')][_0x0bad('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x0bad('0x89')](_0x267d86)){_0x58e990=path[_0x0bad('0x4e')](_0x0bad('0x8a'),_0x6bf6fa,_0x38fda5[0x0],_0x267d86);}else{_0x58e990=_0x267d86;}}if(_0x0bad('0x20')!=typeof _0x40d2cf['parameters'][_0x0bad('0x7d')]['agent']){var _0xec9c4e=_0x40d2cf[_0x0bad('0x79')][_0x0bad('0x7d')][_0x0bad('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x0bad('0x89')](_0xec9c4e)){_0x648076=path[_0x0bad('0x4e')](_0x0bad('0x8a'),_0x6bf6fa,_0x38fda5[0x0],_0xec9c4e);}else{_0x648076=_0xec9c4e;}}}}var _0x82b0c4={'name':_0x1b28e8,'description':_0x4eb1d6,'path':path['join'](_0x6bf6fa,_0x38fda5[0x0]),'type':_0x534648,'sidebar':_0x3e8f5a,'icon':_0x2065b9,'adminUrl':_0x58e990,'agentUrl':_0x648076,'scriptName':_0x29204b,'scriptPath':_0x67087e,'version':_0x1a94c2};removeReferences(_0xb3f0d8,null);return db[_0x0bad('0x2f')][_0x0bad('0x8d')](_0x82b0c4)['then'](function(_0x2e271e){var _0x8aa843={'role':_0x553459['body'][_0x0bad('0x8e')],'userProfileId':_0x553459[_0x0bad('0x8f')]['userProfileId']};if(!_0x8aa843)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8aa843[_0x0bad('0x8e')]==='user'){var _0xa4c4fc=_0x2e271e[_0x0bad('0x90')]({'plain':!![]});return db['UserProfileSection'][_0x0bad('0x4b')]({'where':{'name':_0x0bad('0x28'),'userProfileId':_0x8aa843[_0x0bad('0x91')]},'raw':!![]})[_0x0bad('0x2a')](function(_0x24f29b){if(_0x24f29b&&_0x24f29b['autoAssociation']===0x0){return db[_0x0bad('0x92')][_0x0bad('0x8d')]({'name':_0xa4c4fc[_0x0bad('0x42')],'resourceId':_0xa4c4fc['id'],'type':_0x24f29b[_0x0bad('0x42')],'sectionId':_0x24f29b['id']},{})['then'](function(){return _0x2e271e;});}else{return _0x2e271e;}})['catch'](function(_0x9118b4){logger[_0x0bad('0x58')](_0x0bad('0x93'),_0x9118b4);throw _0x9118b4;});}return _0x2e271e;})[_0x0bad('0x2a')](respondWithResult(_0x5a0eac,null))[_0x0bad('0x48')](handleError(_0x5a0eac,null));}});}catch(_0x1abbec){_0x5a0eac[_0x0bad('0x1c')](0x1f4)[_0x0bad('0x2c')](_0x1abbec);}};function removeReferences(_0x16c7fe,_0x1be63d){try{if(_0x16c7fe){fs[_0x0bad('0x63')](_0x16c7fe);logger[_0x0bad('0x64')](_0x0bad('0x94'));}if(_0x1be63d){rimraf(_0x1be63d,function(){});logger['info'](_0x0bad('0x95'));}}catch(_0x454f52){logger[_0x0bad('0x58')](_0x454f52);}}exports[_0x0bad('0x96')]=function(_0x84e5ec,_0x54d369,_0x1e655f){return db[_0x0bad('0x2f')][_0x0bad('0x4b')]({'where':{'id':_0x84e5ec[_0x0bad('0x4d')]['id']}})['then'](handleEntityNotFound(_0x54d369,null))[_0x0bad('0x2a')](saveUpdates(_0x84e5ec[_0x0bad('0x8f')],null))[_0x0bad('0x2a')](respondWithResult(_0x54d369,null))[_0x0bad('0x48')](handleError(_0x54d369,null));};exports[_0x0bad('0x97')]=function(_0xc8440c,_0x597d01,_0x3f1491){return db[_0x0bad('0x2f')][_0x0bad('0x4b')]({'where':{'id':_0xc8440c[_0x0bad('0x4d')]['id']}})[_0x0bad('0x2a')](function(_0x40459b){if(_0x40459b){return _0x40459b[_0x0bad('0x29')]();}})['then'](function(_0x1a32bf){rimraf(path['join'](config[_0x0bad('0x4f')],_0x0bad('0x50'),path[_0x0bad('0x5e')](_0x1a32bf[_0x0bad('0x5f')])),function(){});return _0x1a32bf;})[_0x0bad('0x2a')](handleEntityNotFound(_0x597d01,null))['then'](respondWithStatusCode(_0x597d01,null))[_0x0bad('0x48')](handleError(_0x597d01,null));};exports['webhookGet']=function(_0xfee99a,_0xb58c12,_0xd2d9dc){return BPromise[_0x0bad('0x98')]()[_0x0bad('0x2a')](function(){if(!_0xfee99a[_0x0bad('0x34')][_0x0bad('0x5f')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xfee99a[_0x0bad('0x34')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5c7737=_0xfee99a[_0x0bad('0x34')][_0x0bad('0x99')]?_0xfee99a[_0x0bad('0x34')][_0x0bad('0x99')]+':'+_0xfee99a['query'][_0x0bad('0x9a')]:_0x0bad('0x9b')+_0xfee99a[_0x0bad('0x34')][_0x0bad('0x9a')];var _0xe3c1a2=_0xfee99a['query']['json']?_0xfee99a[_0x0bad('0x34')]['json']:!![];var _0x163245=_0xfee99a[_0x0bad('0x34')][_0x0bad('0x9c')]?_0xfee99a['query']['encoding']:null;var _0x355b8f={'method':_0xfee99a['method'],'uri':util[_0x0bad('0x51')](_0x0bad('0x9d'),_0x5c7737,_0xfee99a[_0x0bad('0x34')][_0x0bad('0x5f')]),'json':_0xe3c1a2,'resolveWithFullResponse':!![],'encoding':_0x163245,'qs':_0xfee99a['query']};if(_0xfee99a[_0x0bad('0x9e')]){_0x355b8f[_0x0bad('0x9e')]=_0xfee99a[_0x0bad('0x9e')];if(_0x355b8f['headers'][_0x0bad('0x9f')]){delete _0x355b8f[_0x0bad('0x9e')]['content-length'];}}if(_0x355b8f[_0x0bad('0x9e')][_0x0bad('0xa0')]){delete _0x355b8f['headers']['content-type'];}return rp(_0x355b8f);})[_0x0bad('0x2a')](function(_0x49cfd4){if(_0x49cfd4){_0xb58c12[_0x0bad('0x23')](_0x49cfd4['headers']);logger[_0x0bad('0x64')](_0x49cfd4[_0x0bad('0x8f')]);if(_[_0x0bad('0xa1')](_0xfee99a[_0x0bad('0x34')]['path'],_0x0bad('0x4c'))&&_0x49cfd4[_0x0bad('0xa2')]==0x1f4){return _0xb58c12['sendStatus'](_0x49cfd4['statusCode']);}else{return _0xb58c12['status'](_0x49cfd4[_0x0bad('0xa2')])[_0x0bad('0x2c')](_0x49cfd4[_0x0bad('0x8f')]);}}else{return _0xb58c12[_0x0bad('0x1b')](0xc8);}})[_0x0bad('0x48')](handleError(_0xb58c12,null));};exports[_0x0bad('0xa3')]=function(_0x1151d1,_0x3c994c,_0x37855e){return BPromise[_0x0bad('0x98')]()[_0x0bad('0x2a')](function(){if(!_0x1151d1[_0x0bad('0x34')][_0x0bad('0x5f')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1151d1[_0x0bad('0x34')][_0x0bad('0x9a')]){throw new Error(_0x0bad('0xa4'));}var _0x5a0f66=_0x1151d1[_0x0bad('0x34')][_0x0bad('0x99')]?_0x1151d1[_0x0bad('0x34')][_0x0bad('0x99')]+':'+_0x1151d1[_0x0bad('0x34')][_0x0bad('0x9a')]:_0x0bad('0x9b')+_0x1151d1[_0x0bad('0x34')][_0x0bad('0x9a')];var _0x2e1455=_0x1151d1[_0x0bad('0x34')][_0x0bad('0x1e')]?_0x1151d1[_0x0bad('0x34')][_0x0bad('0x1e')]:!![];var _0x34b067=_0x1151d1[_0x0bad('0x34')][_0x0bad('0x9c')]?_0x1151d1[_0x0bad('0x34')][_0x0bad('0x9c')]:null;var _0x538e45={'method':_0x1151d1['method'],'uri':util['format']('%s%s',_0x5a0f66,_0x1151d1[_0x0bad('0x34')][_0x0bad('0x5f')]),'json':_0x2e1455,'resolveWithFullResponse':!![],'encoding':_0x34b067,'body':_0x1151d1[_0x0bad('0x8f')]};if(_0x1151d1[_0x0bad('0x9e')]){_0x538e45[_0x0bad('0x9e')]=_0x1151d1[_0x0bad('0x9e')];if(_0x538e45['headers'][_0x0bad('0x9f')]){delete _0x538e45['headers'][_0x0bad('0x9f')];}}if(_0x538e45[_0x0bad('0x9e')][_0x0bad('0xa0')]){delete _0x538e45[_0x0bad('0x9e')][_0x0bad('0xa0')];}return rp(_0x538e45);})['then'](function(_0x13f799){if(_0x13f799){_0x3c994c[_0x0bad('0x23')](_0x13f799[_0x0bad('0x9e')]);logger['info'](_0x13f799[_0x0bad('0x8f')]);return _0x3c994c['status'](_0x13f799['statusCode'])[_0x0bad('0x2c')](_0x13f799[_0x0bad('0x8f')]);}else{return _0x3c994c[_0x0bad('0x1b')](0xc8);}})[_0x0bad('0x48')](handleError(_0x3c994c,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 1d87262..f21f49d 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 _0x16a6=['save','update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1915e2,_0x51f382){var _0x550ab2=function(_0x42bc80){while(--_0x42bc80){_0x1915e2['push'](_0x1915e2['shift']());}};_0x550ab2(++_0x51f382);}(_0x16a6,0x15c));var _0x616a=function(_0x4d40dd,_0x39592b){_0x4d40dd=_0x4d40dd-0x0;var _0x1c51f2=_0x16a6[_0x4d40dd];return _0x1c51f2;};'use strict';var EventEmitter=require(_0x616a('0x0'));var Plugin=require(_0x616a('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x616a('0x2')](0x0);var events={'afterCreate':_0x616a('0x3'),'afterUpdate':_0x616a('0x4'),'afterDestroy':_0x616a('0x5')};function emitEvent(_0x43e20b){return function(_0x13cbc6,_0x59fc7e,_0x41fbfa){PluginEvents[_0x616a('0x6')](_0x43e20b+':'+_0x13cbc6['id'],_0x13cbc6);PluginEvents['emit'](_0x43e20b,_0x13cbc6);_0x41fbfa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x616a('0x7')](e,emitEvent(event));}}module[_0x616a('0x8')]=PluginEvents; \ No newline at end of file +var _0x870d=['save','update','remove','emit','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x870d,0xde));var _0xd870=function(_0x562f87,_0x333533){_0x562f87=_0x562f87-0x0;var _0x54d651=_0x870d[_0x562f87];return _0x54d651;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xd870('0x0'))['db'][_0xd870('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xd870('0x2')](0x0);var events={'afterCreate':_0xd870('0x3'),'afterUpdate':_0xd870('0x4'),'afterDestroy':_0xd870('0x5')};function emitEvent(_0x54e456){return function(_0x78293f,_0x2a0582,_0x3fb08f){PluginEvents[_0xd870('0x6')](_0x54e456+':'+_0x78293f['id'],_0x78293f);PluginEvents[_0xd870('0x6')](_0x54e456,_0x78293f);_0x3fb08f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xd870('0x7')](e,emitEvent(event));}}module[_0xd870('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index a59f56d..e13b21d 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 _0x23ba=['path','rimraf','../../config/environment','./plugin.attributes','exports','define','plugins','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4a5f6c,_0x4f532e){var _0x281ffd=function(_0x4c68e3){while(--_0x4c68e3){_0x4a5f6c['push'](_0x4a5f6c['shift']());}};_0x281ffd(++_0x4f532e);}(_0x23ba,0x96));var _0xa23b=function(_0x3de37c,_0x3f8bfd){_0x3de37c=_0x3de37c-0x0;var _0x2dcd2e=_0x23ba[_0x3de37c];return _0x2dcd2e;};'use strict';var _=require('lodash');var util=require(_0xa23b('0x0'));var logger=require(_0xa23b('0x1'))(_0xa23b('0x2'));var moment=require(_0xa23b('0x3'));var BPromise=require(_0xa23b('0x4'));var rp=require(_0xa23b('0x5'));var fs=require('fs');var path=require(_0xa23b('0x6'));var rimraf=require(_0xa23b('0x7'));var config=require(_0xa23b('0x8'));var attributes=require(_0xa23b('0x9'));module[_0xa23b('0xa')]=function(_0x5d3d15,_0x4ad288){return _0x5d3d15[_0xa23b('0xb')]('Plugin',attributes,{'tableName':_0xa23b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa24d=['api','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger'];(function(_0x20a78d,_0x3bdc38){var _0x21cbae=function(_0x8dcd4f){while(--_0x8dcd4f){_0x20a78d['push'](_0x20a78d['shift']());}};_0x21cbae(++_0x3bdc38);}(_0xa24d,0x1a1));var _0xda24=function(_0x1a6e19,_0x3d67f0){_0x1a6e19=_0x1a6e19-0x0;var _0x122bc2=_0xa24d[_0x1a6e19];return _0x122bc2;};'use strict';var _=require(_0xda24('0x0'));var util=require(_0xda24('0x1'));var logger=require(_0xda24('0x2'))(_0xda24('0x3'));var moment=require('moment');var BPromise=require(_0xda24('0x4'));var rp=require(_0xda24('0x5'));var fs=require('fs');var path=require(_0xda24('0x6'));var rimraf=require(_0xda24('0x7'));var config=require(_0xda24('0x8'));var attributes=require(_0xda24('0x9'));module[_0xda24('0xa')]=function(_0x5cf240,_0x2c97bb){return _0x5cf240[_0xda24('0xb')](_0xda24('0xc'),attributes,{'tableName':_0xda24('0xd'),'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 4cbee25..ffefdb1 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 _0x3f40=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./plugin.socket','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','CreatePlugin','body','options','lodash','util'];(function(_0x13a7e2,_0x39e8c6){var _0x348148=function(_0x218130){while(--_0x218130){_0x13a7e2['push'](_0x13a7e2['shift']());}};_0x348148(++_0x39e8c6);}(_0x3f40,0xbb));var _0x03f4=function(_0x2bf4a6,_0x375037){_0x2bf4a6=_0x2bf4a6-0x0;var _0x2a975a=_0x3f40[_0x2bf4a6];return _0x2a975a;};'use strict';var _=require(_0x03f4('0x0'));var util=require(_0x03f4('0x1'));var moment=require(_0x03f4('0x2'));var BPromise=require('bluebird');var rs=require(_0x03f4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x03f4('0x4'))['db'];var utils=require(_0x03f4('0x5'));var logger=require(_0x03f4('0x6'))(_0x03f4('0x7'));var config=require('../../config/environment');var jayson=require(_0x03f4('0x8'));var client=jayson[_0x03f4('0x9')][_0x03f4('0xa')]({'port':0x232a});config[_0x03f4('0xb')]=_[_0x03f4('0xc')](config[_0x03f4('0xb')],{'host':_0x03f4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x03f4('0xb')]));require(_0x03f4('0xe'))['register'](socket);function respondWithRpcPromise(_0x50abe8,_0x2fc430,_0xec6a57){return new BPromise(function(_0x85c455,_0x2ba53b){return client[_0x03f4('0xf')](_0x50abe8,_0xec6a57)[_0x03f4('0x10')](function(_0x3f1383){logger['info'](_0x03f4('0x11'),_0x2fc430,_0x03f4('0x12'));logger[_0x03f4('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x2fc430,_0x03f4('0x12'),JSON[_0x03f4('0x14')](_0x3f1383));if(_0x3f1383[_0x03f4('0x15')]){if(_0x3f1383[_0x03f4('0x15')]['code']===0x1f4){logger['error'](_0x03f4('0x11'),_0x2fc430,_0x3f1383[_0x03f4('0x15')][_0x03f4('0x16')]);return _0x2ba53b(_0x3f1383[_0x03f4('0x15')][_0x03f4('0x16')]);}logger[_0x03f4('0x15')](_0x03f4('0x11'),_0x2fc430,_0x3f1383[_0x03f4('0x15')][_0x03f4('0x16')]);return _0x85c455(_0x3f1383[_0x03f4('0x15')][_0x03f4('0x16')]);}else{logger[_0x03f4('0x17')](_0x03f4('0x11'),_0x2fc430,'request\x20sent');_0x85c455(_0x3f1383['result']['message']);}})['catch'](function(_0x518788){logger['error']('Plugin,\x20%s,\x20%s',_0x2fc430,_0x518788);_0x2ba53b(_0x518788);});});}exports[_0x03f4('0x18')]=function(_0x2cd840){var _0xdec795=this;return new Promise(function(_0x1c9aad,_0x4b9502){return db['Plugin']['create'](_0x2cd840[_0x03f4('0x19')],{'raw':_0x2cd840['options']?_0x2cd840[_0x03f4('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x03f4('0x10')](function(_0x435993){logger[_0x03f4('0x17')](_0x03f4('0x18'),_0x2cd840);logger[_0x03f4('0x13')](_0x03f4('0x18'),_0x2cd840,JSON[_0x03f4('0x14')](_0x435993));_0x1c9aad(_0x435993);})['catch'](function(_0x2a9539){logger[_0x03f4('0x15')](_0x03f4('0x18'),_0x2a9539[_0x03f4('0x16')],_0x2cd840);_0x4b9502(_0xdec795[_0x03f4('0x15')](0x1f4,_0x2a9539[_0x03f4('0x16')]));});});}; \ No newline at end of file +var _0xd643=['stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','catch','create','body','options','raw','info','CreatePlugin'];(function(_0x5db080,_0x5e2af6){var _0x583dfd=function(_0x37bccc){while(--_0x37bccc){_0x5db080['push'](_0x5db080['shift']());}};_0x583dfd(++_0x5e2af6);}(_0xd643,0x1ae));var _0x3d64=function(_0x135636,_0x103811){_0x135636=_0x135636-0x0;var _0x2f1410=_0xd643[_0x135636];return _0x2f1410;};'use strict';var _=require(_0x3d64('0x0'));var util=require('util');var moment=require(_0x3d64('0x1'));var BPromise=require(_0x3d64('0x2'));var rs=require(_0x3d64('0x3'));var fs=require('fs');var Redis=require(_0x3d64('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3d64('0x5'))(_0x3d64('0x6'));var config=require(_0x3d64('0x7'));var jayson=require(_0x3d64('0x8'));var client=jayson[_0x3d64('0x9')][_0x3d64('0xa')]({'port':0x232a});config[_0x3d64('0xb')]=_[_0x3d64('0xc')](config['redis'],{'host':_0x3d64('0xd'),'port':0x18eb});var socket=require(_0x3d64('0xe'))(new Redis(config[_0x3d64('0xb')]));require(_0x3d64('0xf'))[_0x3d64('0x10')](socket);function respondWithRpcPromise(_0x3c08bc,_0x38c05e,_0x15293d){return new BPromise(function(_0xab7337,_0x46bb84){return client[_0x3d64('0x11')](_0x3c08bc,_0x15293d)['then'](function(_0x297bd1){logger['info'](_0x3d64('0x12'),_0x38c05e,_0x3d64('0x13'));logger[_0x3d64('0x14')](_0x3d64('0x15'),_0x38c05e,_0x3d64('0x13'),JSON['stringify'](_0x297bd1));if(_0x297bd1[_0x3d64('0x16')]){if(_0x297bd1['error'][_0x3d64('0x17')]===0x1f4){logger[_0x3d64('0x16')](_0x3d64('0x12'),_0x38c05e,_0x297bd1[_0x3d64('0x16')][_0x3d64('0x18')]);return _0x46bb84(_0x297bd1[_0x3d64('0x16')][_0x3d64('0x18')]);}logger['error'](_0x3d64('0x12'),_0x38c05e,_0x297bd1[_0x3d64('0x16')]['message']);return _0xab7337(_0x297bd1[_0x3d64('0x16')][_0x3d64('0x18')]);}else{logger['info'](_0x3d64('0x12'),_0x38c05e,_0x3d64('0x13'));_0xab7337(_0x297bd1['result']['message']);}})[_0x3d64('0x19')](function(_0x328aea){logger[_0x3d64('0x16')](_0x3d64('0x12'),_0x38c05e,_0x328aea);_0x46bb84(_0x328aea);});});}exports['CreatePlugin']=function(_0x4971de){var _0x275df7=this;return new Promise(function(_0x48affc,_0x2d8397){return db['Plugin'][_0x3d64('0x1a')](_0x4971de[_0x3d64('0x1b')],{'raw':_0x4971de[_0x3d64('0x1c')]?_0x4971de[_0x3d64('0x1c')][_0x3d64('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5790c5){logger[_0x3d64('0x1e')]('CreatePlugin',_0x4971de);logger[_0x3d64('0x14')](_0x3d64('0x1f'),_0x4971de,JSON[_0x3d64('0x20')](_0x5790c5));_0x48affc(_0x5790c5);})[_0x3d64('0x19')](function(_0x4d07ae){logger[_0x3d64('0x16')](_0x3d64('0x1f'),_0x4d07ae[_0x3d64('0x18')],_0x4971de);_0x2d8397(_0x275df7['error'](0x1f4,_0x4d07ae[_0x3d64('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index c1f7604..0642863 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 _0x99a7=['update','register','save','remove'];(function(_0x57a694,_0x20fcc6){var _0x5bee4b=function(_0x552359){while(--_0x552359){_0x57a694['push'](_0x57a694['shift']());}};_0x5bee4b(++_0x20fcc6);}(_0x99a7,0x16e));var _0x799a=function(_0xef3ae2,_0x4c63b8){_0xef3ae2=_0xef3ae2-0x0;var _0x1cc22b=_0x99a7[_0xef3ae2];return _0x1cc22b;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x799a('0x0'),_0x799a('0x1'),_0x799a('0x2')];function createListener(_0x3a5da5,_0xad11be){return function(_0x3d9d4c){_0xad11be['emit'](_0x3a5da5,_0x3d9d4c);};}function removeListener(_0x469fd9,_0x4bb817){return function(){PluginEvents['removeListener'](_0x469fd9,_0x4bb817);};}exports[_0x799a('0x3')]=function(_0x424c6a){for(var _0x487f32=0x0,_0x2f1765=events['length'];_0x487f32<_0x2f1765;_0x487f32++){var _0x1e11e8=events[_0x487f32];var _0x3e285e=createListener('plugin:'+_0x1e11e8,_0x424c6a);PluginEvents['on'](_0x1e11e8,_0x3e285e);}}; \ No newline at end of file +var _0x0bac=['./plugin.events','save','remove','update','emit','removeListener','register','length','plugin:'];(function(_0x423934,_0x23acd5){var _0x15bc7b=function(_0x4b88f6){while(--_0x4b88f6){_0x423934['push'](_0x423934['shift']());}};_0x15bc7b(++_0x23acd5);}(_0x0bac,0x18c));var _0xc0ba=function(_0x2fff26,_0x575c3d){_0x2fff26=_0x2fff26-0x0;var _0xa57f5d=_0x0bac[_0x2fff26];return _0xa57f5d;};'use strict';var PluginEvents=require(_0xc0ba('0x0'));var events=[_0xc0ba('0x1'),_0xc0ba('0x2'),_0xc0ba('0x3')];function createListener(_0x4e7a52,_0x585bce){return function(_0x4445c6){_0x585bce[_0xc0ba('0x4')](_0x4e7a52,_0x4445c6);};}function removeListener(_0x54a6b5,_0x3f689a){return function(){PluginEvents[_0xc0ba('0x5')](_0x54a6b5,_0x3f689a);};}exports[_0xc0ba('0x6')]=function(_0xd83820){for(var _0x34e5a3=0x0,_0x1221fc=events[_0xc0ba('0x7')];_0x34e5a3<_0x1221fc;_0x34e5a3++){var _0x946577=events[_0x34e5a3];var _0x32bfff=createListener(_0xc0ba('0x8')+_0x946577,_0xd83820);PluginEvents['on'](_0x946577,_0x32bfff);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index e7cb998..f4b7e51 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(_0x58d435,_0x50b0f6){var _0x2ef1b7=function(_0x1d7409){while(--_0x1d7409){_0x58d435['push'](_0x58d435['shift']());}};_0x2ef1b7(++_0x50b0f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x50e51a,_0x39e949){var _0xe02402=function(_0xbc177a){while(--_0xbc177a){_0x50e51a['push'](_0x50e51a['shift']());}};_0xe02402(++_0x39e949);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 92907d6..6d6a850 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 _0x1be1=['stop','hasOwnProperty','status','destroy','delete','Unknown\x20id','../../config/logger','api','child_process','exec','bluebird','sendStatus','json','error','name','send','npm\x20install','info','index','express','motion2','length','then','catch','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','restart'];(function(_0x583768,_0x134267){var _0x4fc372=function(_0x450ba6){while(--_0x450ba6){_0x583768['push'](_0x583768['shift']());}};_0x4fc372(++_0x134267);}(_0x1be1,0x192));var _0x11be=function(_0x1d1e60,_0x5657ce){_0x1d1e60=_0x1d1e60-0x0;var _0x25d20c=_0x1be1[_0x1d1e60];return _0x25d20c;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x11be('0x0'))(_0x11be('0x1'));var path=require('path');var exec=require(_0x11be('0x2'))[_0x11be('0x3')];var BPromise=require(_0x11be('0x4'));function handleEntityNotFound(_0x318d41,_0x504d3a){return function(_0x3ce56d){if(!_0x3ce56d){_0x318d41[_0x11be('0x5')](0x194);;}return _0x3ce56d;};}function respondWithResult(_0x11f793,_0x479719){_0x479719=_0x479719||0xc8;return function(_0xfe8c62){if(_0xfe8c62){return _0x11f793['status'](_0x479719)[_0x11be('0x6')](_0xfe8c62);}return null;};}function handleError(_0x11fc15,_0x246772){_0x246772=_0x246772||0x1f4;return function(_0x461e17){logger[_0x11be('0x7')](_0x461e17['stack']);if(_0x461e17[_0x11be('0x8')]){delete _0x461e17[_0x11be('0x8')];}_0x11fc15['status'](_0x246772)[_0x11be('0x9')](_0x461e17);};}function execChildProcess(){return new BPromise(function(_0x2cd786,_0x40f0d1){exec(_0x11be('0xa'),function(_0x4e013c,_0x447e88,_0xcb8120){logger[_0x11be('0xb')](_0x447e88);logger['info'](_0xcb8120);if(_0x4e013c){logger[_0x11be('0x7')](_0x4e013c);return _0x40f0d1(_0x4e013c);}return _0x2cd786(_0x447e88);});});}exports[_0x11be('0xc')]=function(_0x4ce3ae,_0x44eff2){return pm2['list']()['then'](function(_0x569842){if(_0x569842){var _0x4b6e7e=_['reject'](_0x569842,function(_0x5aa444){return _0x5aa444['name']===_0x11be('0xd')||_0x5aa444['name']===_0x11be('0xe');});return{'rows':_0x4b6e7e,'count':_0x4b6e7e[_0x11be('0xf')]};}return null;})[_0x11be('0x10')](respondWithResult(_0x44eff2,null))[_0x11be('0x11')](handleError(_0x44eff2,null));};exports['show']=function(_0x2ed725,_0x403d7a){return pm2['describe'](_0x2ed725[_0x11be('0x12')]['id'])[_0x11be('0x10')](respondWithResult(_0x403d7a,null))[_0x11be('0x10')](handleEntityNotFound(_0x403d7a,null))['catch'](handleError(_0x403d7a,null));};exports['create']=function(_0x141391,_0x976e51){if(_0x141391[_0x11be('0x13')][_0x11be('0x8')]&&_0x141391['body'][_0x11be('0x14')]){var _0x45136f=path[_0x11be('0x15')](__dirname,_0x11be('0x16'),_0x141391[_0x11be('0x13')][_0x11be('0x14')]);var _0xa944ac=process[_0x11be('0x17')]();process[_0x11be('0x18')](path[_0x11be('0x19')](_0x45136f));return execChildProcess()['then'](function(_0xfe3737){process[_0x11be('0x18')](_0xa944ac);return pm2[_0x11be('0x1a')]({'name':_0x141391['body']['name'],'script':_0x45136f});})[_0x11be('0x10')](function(_0x10ce04){pm2[_0x11be('0x1b')]();return _0x10ce04[0x0];})['then'](respondWithResult(_0x976e51,0xc9))[_0x11be('0x11')](handleError(_0x976e51,null));}else{return _0x976e51['status'](0x1f4)[_0x11be('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x11be('0x1c')]=function(_0xb11f3d,_0x5002d7){if(_0xb11f3d[_0x11be('0x13')]['id']){delete _0xb11f3d[_0x11be('0x13')]['id'];}var _0x1d3b5c={'online':_0x11be('0x1d'),'stopped':_0x11be('0x1e')};if(_0x1d3b5c[_0x11be('0x1f')](_0xb11f3d[_0x11be('0x13')][_0x11be('0x20')])){return pm2[_0x1d3b5c[_0xb11f3d[_0x11be('0x13')]['status']]](_0xb11f3d[_0x11be('0x12')]['id'])['then'](respondWithResult(_0x5002d7,0xc8))[_0x11be('0x11')](handleError(_0x5002d7,null));}else{return _0x5002d7[_0x11be('0x20')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0x11be('0x21')]=function(_0x265fc9,_0x5e8f9a){if(_0x265fc9[_0x11be('0x13')]['id']){delete _0x265fc9[_0x11be('0x13')]['id'];}if(_0x265fc9[_0x11be('0x12')]['id']){return pm2[_0x11be('0x22')](_0x265fc9[_0x11be('0x12')]['id'])[_0x11be('0x10')](function(_0x4b527e){pm2[_0x11be('0x1b')]();return _0x4b527e[0x0];})[_0x11be('0x10')](respondWithResult(_0x5e8f9a,null))[_0x11be('0x11')](handleError(_0x5e8f9a,null));}else{return _0x5e8f9a[_0x11be('0x20')](0x1f4)[_0x11be('0x9')]({'message':_0x11be('0x23')});}}; \ No newline at end of file +var _0x579c=['express','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','status','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','exec','sendStatus','json','error','stack','name','send','npm\x20install','info','index','then'];(function(_0x1b2117,_0x40c913){var _0x34ea80=function(_0x40b79c){while(--_0x40b79c){_0x1b2117['push'](_0x1b2117['shift']());}};_0x34ea80(++_0x40c913);}(_0x579c,0xda));var _0xc579=function(_0x34424a,_0x5d07d5){_0x34424a=_0x34424a-0x0;var _0x5a1b87=_0x579c[_0x34424a];return _0x5a1b87;};'use strict';var _=require(_0xc579('0x0'));var pm2=require(_0xc579('0x1'));var logger=require(_0xc579('0x2'))(_0xc579('0x3'));var path=require(_0xc579('0x4'));var exec=require('child_process')[_0xc579('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x21a0a2,_0x3b913c){return function(_0x1ce62b){if(!_0x1ce62b){_0x21a0a2[_0xc579('0x6')](0x194);;}return _0x1ce62b;};}function respondWithResult(_0x124ee5,_0x1bd276){_0x1bd276=_0x1bd276||0xc8;return function(_0x2e451b){if(_0x2e451b){return _0x124ee5['status'](_0x1bd276)[_0xc579('0x7')](_0x2e451b);}return null;};}function handleError(_0x293c4a,_0x2ce949){_0x2ce949=_0x2ce949||0x1f4;return function(_0x2361fc){logger[_0xc579('0x8')](_0x2361fc[_0xc579('0x9')]);if(_0x2361fc[_0xc579('0xa')]){delete _0x2361fc[_0xc579('0xa')];}_0x293c4a['status'](_0x2ce949)[_0xc579('0xb')](_0x2361fc);};}function execChildProcess(){return new BPromise(function(_0x2048bc,_0x17e37f){exec(_0xc579('0xc'),function(_0x9e3fd3,_0x4577a2,_0x2a8e70){logger[_0xc579('0xd')](_0x4577a2);logger[_0xc579('0xd')](_0x2a8e70);if(_0x9e3fd3){logger[_0xc579('0x8')](_0x9e3fd3);return _0x17e37f(_0x9e3fd3);}return _0x2048bc(_0x4577a2);});});}exports[_0xc579('0xe')]=function(_0x4ac675,_0x177314){return pm2['list']()[_0xc579('0xf')](function(_0x59243e){if(_0x59243e){var _0x424e15=_['reject'](_0x59243e,function(_0x44cd32){return _0x44cd32['name']===_0xc579('0x10')||_0x44cd32[_0xc579('0xa')]==='motion2';});return{'rows':_0x424e15,'count':_0x424e15['length']};}return null;})[_0xc579('0xf')](respondWithResult(_0x177314,null))[_0xc579('0x11')](handleError(_0x177314,null));};exports[_0xc579('0x12')]=function(_0x414ee7,_0x7d5865){return pm2[_0xc579('0x13')](_0x414ee7[_0xc579('0x14')]['id'])[_0xc579('0xf')](respondWithResult(_0x7d5865,null))[_0xc579('0xf')](handleEntityNotFound(_0x7d5865,null))[_0xc579('0x11')](handleError(_0x7d5865,null));};exports['create']=function(_0x463f5e,_0x2b7d74){if(_0x463f5e['body'][_0xc579('0xa')]&&_0x463f5e[_0xc579('0x15')][_0xc579('0x16')]){var _0x6501bc=path[_0xc579('0x17')](__dirname,_0xc579('0x18'),_0x463f5e[_0xc579('0x15')][_0xc579('0x16')]);var _0x55781e=process[_0xc579('0x19')]();process[_0xc579('0x1a')](path[_0xc579('0x1b')](_0x6501bc));return execChildProcess()[_0xc579('0xf')](function(_0x1da86e){process['chdir'](_0x55781e);return pm2[_0xc579('0x1c')]({'name':_0x463f5e[_0xc579('0x15')][_0xc579('0xa')],'script':_0x6501bc});})['then'](function(_0x45e1ac){pm2['dump']();return _0x45e1ac[0x0];})[_0xc579('0xf')](respondWithResult(_0x2b7d74,0xc9))[_0xc579('0x11')](handleError(_0x2b7d74,null));}else{return _0x2b7d74[_0xc579('0x1d')](0x1f4)['send']({'message':_0xc579('0x1e')});}};exports['update']=function(_0x532b33,_0x56439a){if(_0x532b33[_0xc579('0x15')]['id']){delete _0x532b33[_0xc579('0x15')]['id'];}var _0xfdbb73={'online':_0xc579('0x1f'),'stopped':_0xc579('0x20')};if(_0xfdbb73[_0xc579('0x21')](_0x532b33[_0xc579('0x15')]['status'])){return pm2[_0xfdbb73[_0x532b33['body'][_0xc579('0x1d')]]](_0x532b33['params']['id'])[_0xc579('0xf')](respondWithResult(_0x56439a,0xc8))[_0xc579('0x11')](handleError(_0x56439a,null));}else{return _0x56439a[_0xc579('0x1d')](0x1f4)[_0xc579('0xb')]({'message':_0xc579('0x22')});}};exports[_0xc579('0x23')]=function(_0x45e6a3,_0x133d08){if(_0x45e6a3['body']['id']){delete _0x45e6a3[_0xc579('0x15')]['id'];}if(_0x45e6a3[_0xc579('0x14')]['id']){return pm2[_0xc579('0x24')](_0x45e6a3[_0xc579('0x14')]['id'])['then'](function(_0x57299e){pm2[_0xc579('0x25')]();return _0x57299e[0x0];})['then'](respondWithResult(_0x133d08,null))[_0xc579('0x11')](handleError(_0x133d08,null));}else{return _0x133d08[_0xc579('0x1d')](0x1f4)[_0xc579('0xb')]({'message':_0xc579('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index e235a1a..07e77dc 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 _0x43ee=['getAgents','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents'];(function(_0x448d1f,_0x55b37b){var _0x66a1e5=function(_0x49d1e2){while(--_0x49d1e2){_0x448d1f['push'](_0x448d1f['shift']());}};_0x66a1e5(++_0x55b37b);}(_0x43ee,0xb8));var _0xe43e=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x43ee[_0x4914e2];return _0x2dcd07;};'use strict';var express=require(_0xe43e('0x0'));var router=express[_0xe43e('0x1')]();var auth=require(_0xe43e('0x2'));var controller=require(_0xe43e('0x3'));router[_0xe43e('0x4')](_0xe43e('0x5'),auth['isAuthenticated'](),controller[_0xe43e('0x6')]);router[_0xe43e('0x4')](_0xe43e('0x7'),auth['isAuthenticated'](),controller[_0xe43e('0x8')]);module[_0xe43e('0x9')]=router; \ No newline at end of file +var _0x39e7=['isAuthenticated','getAgents','/queues','exports','express','get','/agents'];(function(_0x401052,_0x261f76){var _0x42dd39=function(_0x5cad04){while(--_0x5cad04){_0x401052['push'](_0x401052['shift']());}};_0x42dd39(++_0x261f76);}(_0x39e7,0x82));var _0x739e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x39e7[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x739e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router[_0x739e('0x1')](_0x739e('0x2'),auth[_0x739e('0x3')](),controller[_0x739e('0x4')]);router['get'](_0x739e('0x5'),auth[_0x739e('0x3')](),controller['getQueues']);module[_0x739e('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index addb287..948888d 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 _0x1261=['rawAttributes','fieldName','type','key','query','user','agent','nolimit','sort','UserProfile','getResources','findAndCountAll','rows','merge','omit','globalStatus','pauseTypeFilter','getQueues','chat','sms','openchannel','fax','whatsapp','channel','includes','toLowerCase','Invalid\x20channel','getOptions','role','userProfileId','QueueCampaigns','all','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','undefined','limit','count','offset','set','json','error','stack','name','status','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','talking','paused','outbound','pTalking','message','dialMethod','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','map','agents','loggedInDb','voice','busy','find','pick','filter','queue','length','some','internal','toString','getMembers','UserId','accountcode','online','voiceStatus','User','Queue','Pause','findAll','idle','unavailable','ringing','chatPause','faxPause','mailPause','smsPause','voicePause','whatsappPause','every','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','unknown','getAgents','userpic','lastPauseAt','pauseType','address','openchannelPause','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','resolve'];(function(_0x7148a3,_0x1c6652){var _0x52f31d=function(_0x31c8a7){while(--_0x31c8a7){_0x7148a3['push'](_0x7148a3['shift']());}};_0x52f31d(++_0x1c6652);}(_0x1261,0x144));var _0x1126=function(_0x41d552,_0x1e59db){_0x41d552=_0x41d552-0x0;var _0x45d056=_0x1261[_0x41d552];return _0x45d056;};'use strict';var util=require('util');var _=require(_0x1126('0x0'));var jayson=require(_0x1126('0x1'));var qs=require(_0x1126('0x2'));var logger=require(_0x1126('0x3'))(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var amiClient=jayson[_0x1126('0x6')][_0x1126('0x7')]({'port':0x232a});var routingClient=jayson[_0x1126('0x6')][_0x1126('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x5a2189,_0x5c68c8){return function(_0x40ba58){if(_0x40ba58){var _0x907180=typeof _0x5c68c8['offset']===_0x1126('0x8')&&typeof _0x5c68c8[_0x1126('0x9')]===_0x1126('0x8');var _0x3abb0b=_0x40ba58[_0x1126('0xa')];var _0x59cfa1=_0x907180?0x0:_0x5c68c8[_0x1126('0xb')];var _0x18dbe6=_0x907180?_0x40ba58[_0x1126('0xa')]:_0x5c68c8['offset']+_0x5c68c8[_0x1126('0x9')];var _0x5d581b;if(_0x18dbe6>=_0x3abb0b){_0x18dbe6=_0x3abb0b;_0x5d581b=0xc8;}else{_0x5d581b=0xce;}_0x5a2189['status'](_0x5d581b);return _0x5a2189[_0x1126('0xc')]('Content-Range',_0x59cfa1+'-'+_0x18dbe6+'/'+_0x3abb0b)[_0x1126('0xd')](_0x40ba58);}return null;};}function handleError(_0x1b364a,_0xd26a32){_0xd26a32=_0xd26a32||0x1f4;return function(_0x273896){logger[_0x1126('0xe')](_0x273896[_0x1126('0xf')]);if(_0x273896[_0x1126('0x10')]){delete _0x273896[_0x1126('0x10')];}_0x1b364a[_0x1126('0x11')](_0xd26a32)['send'](_0x273896);};}function getRealtimeAgents(){return new Promise(function(_0x5de9a7,_0x1af673){return amiClient[_0x1126('0x12')](_0x1126('0x13'),{})['then'](function(_0x45149c){if(_0x45149c['error'])throw new Error(_0x1126('0x14'));var _0x42f379=_0x45149c[_0x1126('0x15')];return routingClient['request'](_0x1126('0x13'),{})[_0x1126('0x16')](function(_0x4a7b49){if(_0x4a7b49['error'])throw new Error(_0x1126('0x17'));var _0x2b2487=_0x4a7b49['result'];return _0x5de9a7(_['merge']({},_0x42f379,_0x2b2487));});})[_0x1126('0x18')](function(_0x58b109){_0x1af673(_0x58b109);});});}function getRealtimeQueues(_0x22ed37,_0x1d6d19){return new Promise(function(_0x2f70ac,_0x54400a){var _0x2a08ba=_0x1d6d19==='voice'?amiClient:routingClient;return _0x2a08ba['request'](_[_0x1126('0x19')](_0x1d6d19)+_0x1126('0x1a'),_0x22ed37)[_0x1126('0x16')](function(_0x36d254){if(_0x36d254['error'])throw new Error(util[_0x1126('0x1b')](_0x1126('0x1c'),_0x1d6d19));return _0x2f70ac(_0x36d254['result']);})[_0x1126('0x18')](function(_0x59cd8e){_0x54400a(_0x59cd8e);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x529dd9,_0x4b57ab){return amiClient[_0x1126('0x12')](_0x1126('0x1d'),{})[_0x1126('0x16')](function(_0x34bcf1){if(_0x34bcf1[_0x1126('0xe')])throw new Error(_0x1126('0x1e'));return _0x529dd9(_0x34bcf1[_0x1126('0x15')]);})[_0x1126('0x18')](function(_0x589725){_0x4b57ab(_0x589725);});});}function initializeQueues(_0x35eec3,_0x375e59,_0xa293f4,_0x5ddf63){var _0x541bc9=[_0x1126('0x1f'),_0x1126('0x20'),'waiting',_0x1126('0x21'),_0x1126('0x22')];if(_0xa293f4==='voice'&&_0x5ddf63===_0x1126('0x23')){_0x541bc9['push'](_0x1126('0x24'),'originated',_0x1126('0x25'),'dialActive',_0x1126('0x26'),'Trunk','startPredictive','startProgressive',_0x1126('0x27'),_0x1126('0x28'),_0x1126('0x29'),'erlangBusyFactor',_0x1126('0x2a'),_0x1126('0x2b'),'dialPredictiveIntervalMinThreshold',_0x1126('0x2c'),_0x1126('0x2d'),_0x1126('0x2e'),_0x1126('0x2f'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime',_0x1126('0x30'));}return _0x35eec3[_0x1126('0x31')](function(_0x2d9bd2){var _0x2c67eb=_0x2d9bd2['get']({'plain':!![]});_0x2c67eb[_0x1126('0x32')]=[];_0x2c67eb[_0x1126('0x22')]=0x0;_0x2c67eb[_0x1126('0x33')]=0x0;_0x2c67eb[_0x1126('0x1f')]=0x0;_0x2c67eb[_0x1126('0x20')]=0x0;_0x2c67eb['waiting']=0x0;if(_0xa293f4===_0x1126('0x34')){_0x2c67eb[_0x1126('0x21')]=0x0;_0x2c67eb[_0x1126('0x35')]=0x0;if(_0x5ddf63===_0x1126('0x23')){_0x2c67eb['pTalking']=0x0;_0x2c67eb['originated']=0x0;}}var _0x22827a=_[_0x1126('0x36')](_0x375e59,['id',_0x2c67eb['id']]);if(_0x22827a)_['merge'](_0x2c67eb,_[_0x1126('0x37')](_0x22827a,_0x541bc9));return _0x2c67eb;});}function updateAgentVoiceStatus(_0xf3c21b,_0x11b0f6,_0x5c08b9){var _0x4b3859=_[_0x1126('0x38')](_0x5c08b9,[_0x1126('0x39'),_0x11b0f6[_0x1126('0x10')]]);if(_0x4b3859[_0x1126('0x3a')]===0x0)return _0xf3c21b['busy']=!![];if(_[_0x1126('0x3b')](_0x4b3859,['connectedlinenum',_0xf3c21b[_0x1126('0x3c')][_0x1126('0x3d')]()]))return _0xf3c21b[_0x1126('0x21')]=!![];if(!_0xf3c21b[_0x1126('0x21')])return _0xf3c21b[_0x1126('0x35')]=!![];}function getVoiceQueueAgents(_0x5746f6,_0x1da59f,_0x3ea9de,_0x2939a9){var _0x397e3b=_[_0x1126('0x36')](_0x1da59f,['id',_0x5746f6['id']]);if(!_0x397e3b)return _0x5746f6;return _0x397e3b[_0x1126('0x3e')]({'raw':!![]})[_0x1126('0x16')](function(_0x4faaa3){for(var _0x1c8d8a=0x0;_0x1c8d8a<_0x4faaa3[_0x1126('0x3a')];_0x1c8d8a++){var _0x227a6b=_[_0x1126('0x36')](_0x3ea9de,['id',_0x4faaa3[_0x1c8d8a][_0x1126('0x3f')]]);if(!_0x227a6b){_0x227a6b={'id':_0x4faaa3[_0x1c8d8a]['UserId'],'name':_0x4faaa3[_0x1c8d8a]['UserId'],'accountcode':'','online':![]};}var _0x1c4f06={'id':_0x227a6b['id'],'name':_0x227a6b[_0x1126('0x10')],'internal':_0x227a6b[_0x1126('0x40')],'online':Boolean(_0x227a6b[_0x1126('0x41')]),'paused':Boolean(_0x4faaa3[_0x1c8d8a][_0x1126('0x22')])};if(_0x227a6b[_0x1126('0x42')]==='talking')updateAgentVoiceStatus(_0x1c4f06,_0x5746f6,_0x2939a9);if(_0x1c4f06['online'])_0x5746f6['loggedInDb']++;if(_0x1c4f06[_0x1126('0x35')])_0x5746f6['busy']++;if(_0x1c4f06[_0x1126('0x22')]&&!_0x1c4f06[_0x1126('0x35')]&&!_0x1c4f06[_0x1126('0x21')])_0x5746f6[_0x1126('0x22')]++;_0x5746f6['agents']['push'](_0x1c4f06);}return _0x5746f6;});}function getQueueAgents(_0x353042,_0xa93167,_0x1d63b9){var _0x5f5d3a=_0x1126('0x43')+_['startCase'](_0x1d63b9)+_0x1126('0x44');var _0x51a5be=_0x1d63b9+_0x1126('0x45');return db[_0x5f5d3a][_0x1126('0x46')]({'where':{[_[_0x1126('0x19')](_0x1d63b9)+'QueueId']:_0x353042['id']},'raw':!![]})[_0x1126('0x16')](function(_0x2ffccc){for(var _0xf8ec5f=0x0;_0xf8ec5f<_0x2ffccc['length'];_0xf8ec5f++){var _0x58ff3a=_['find'](_0xa93167,['id',_0x2ffccc[_0xf8ec5f][_0x1126('0x3f')]]);if(!_0x58ff3a){_0x58ff3a={'id':_0x2ffccc[_0xf8ec5f]['UserId'],'name':_0x2ffccc[_0xf8ec5f][_0x1126('0x3f')],'online':![],['pauseField']:![]};}var _0x507568={'id':_0x58ff3a['id'],'name':_0x58ff3a[_0x1126('0x10')],'online':Boolean(_0x58ff3a[_0x1126('0x41')]),'paused':Boolean(_0x58ff3a[_0x51a5be])};if(_0x507568[_0x1126('0x41')])_0x353042[_0x1126('0x33')]++;_0x353042[_0x1126('0x32')]['push'](_0x507568);}return _0x353042;});}function isIdle(_0x198173){return _0x198173===_0x1126('0x47')||_0x198173==='unknown'||_0x198173===_0x1126('0x48')||_0x198173===_0x1126('0x49')||_['isNil'](_0x198173);}function isAgentPaused(_0x5f6d73,_0x1ffa2b){var _0x518e0a=[_0x5f6d73[_0x1126('0x4a')],_0x5f6d73[_0x1126('0x4b')],_0x5f6d73[_0x1126('0x4c')],_0x5f6d73['openchannelPause'],_0x5f6d73[_0x1126('0x4d')],_0x5f6d73[_0x1126('0x4e')],_0x5f6d73[_0x1126('0x4f')]];if(!_0x1ffa2b)return _[_0x1126('0x50')](_0x518e0a);var _0x224456=_[_0x1126('0x38')](_0x518e0a);return _0x224456[_0x1126('0x3a')]>0x0&&_0x224456[_0x1126('0x3a')]<_0x518e0a['length']?!![]:![];}function isAgentIdle(_0x1b8b83){if(_0x1b8b83['voiceStatus']!==_0x1126('0x47')&&_0x1b8b83[_0x1126('0x4e')]){_0x1b8b83['voiceStatus']='pause';return![];}return _[_0x1126('0x50')]([_0x1b8b83[_0x1126('0x51')],_0x1b8b83[_0x1126('0x52')],_0x1b8b83['mailStatus'],_0x1b8b83[_0x1126('0x53')],_0x1b8b83[_0x1126('0x54')],_0x1b8b83[_0x1126('0x42')],_0x1b8b83[_0x1126('0x55')]],isIdle);}function getAgentStatus(_0x533e25){var _0x30d1b3=_0x1126('0x56');if(isAgentPaused(_0x533e25))_0x30d1b3='pause';else if(isAgentPaused(_0x533e25,!![]))_0x30d1b3='*pause';else if(isAgentIdle(_0x533e25))_0x30d1b3='idle';else _0x30d1b3='busy';return _0x30d1b3;}exports[_0x1126('0x57')]=function(_0x3bf090,_0x4dc8cd){var _0x16552b={'count':0x0,'rows':[]},_0x1c7a2b={},_0x38093e,_0x38f521,_0x29bc7d=[_0x1126('0x58'),_0x1126('0x41'),'lastLoginAt',_0x1126('0x59'),_0x1126('0x5a'),_0x1126('0x59'),_0x1126('0x3c'),_0x1126('0x5b'),'chatPause',_0x1126('0x5c'),'mailPause',_0x1126('0x4d'),_0x1126('0x4f'),_0x1126('0x4b'),'voicePause',_0x1126('0x5d'),_0x1126('0x5e'),'mailCapacity',_0x1126('0x5f'),_0x1126('0x60'),_0x1126('0x61'),'chatCurrentCapacity',_0x1126('0x62'),_0x1126('0x63'),_0x1126('0x64'),_0x1126('0x65'),_0x1126('0x66'),_0x1126('0x51'),_0x1126('0x53'),_0x1126('0x67'),'smsStatus',_0x1126('0x55'),_0x1126('0x52'),_0x1126('0x42'),_0x1126('0x68'),_0x1126('0x69'),'mailStatusTime',_0x1126('0x6a'),_0x1126('0x6b'),'faxStatusTime',_0x1126('0x6c'),'queue',_0x1126('0x6d'),_0x1126('0x6e'),'phoneBarEnableScreenRecordingByAgent',_0x1126('0x6f'),_0x1126('0x70')],_0x4e4d49=[_0x1126('0x4a'),'openchannelPause',_0x1126('0x4c'),'smsPause','whatsappPause',_0x1126('0x4b'),_0x1126('0x4e'),_0x1126('0x41')];Promise[_0x1126('0x71')]()[_0x1126('0x16')](function(){var _0x1b4ebf=_[_0x1126('0x31')](db['User'][_0x1126('0x72')],function(_0x43ec00){return{'name':_0x43ec00[_0x1126('0x73')],'type':_0x43ec00[_0x1126('0x74')][_0x1126('0x75')]};});_0x3bf090[_0x1126('0x76')]['role']='agent';_0x3bf090[_0x1126('0x76')][_0x1126('0x41')]=!![];_0x1c7a2b=qs['getOptions'](_0x1b4ebf,_0x3bf090);_0x1c7a2b['raw']=!![];if(_0x3bf090['user']['role']===_0x1126('0x77')){var _0x37b1ab={'params':{'id':_0x3bf090[_0x1126('0x77')]['userProfileId']},'query':{'section':_0x1126('0x13'),'role':_0x1126('0x78'),'online':!![],'nolimit':_0x3bf090[_0x1126('0x76')][_0x1126('0x79')],'sort':_0x3bf090[_0x1126('0x76')][_0x1126('0x7a')],'filter':_0x3bf090[_0x1126('0x76')]['filter'],'raw':!![]}};return db[_0x1126('0x7b')][_0x1126('0x7c')](_0x37b1ab);}return db[_0x1126('0x43')][_0x1126('0x7d')](_0x1c7a2b);})[_0x1126('0x16')](function(_0x56c003){_0x16552b['count']=_0x56c003[_0x1126('0xa')];_0x38093e=_0x56c003[_0x1126('0x7e')];return getRealtimeAgents();})['then'](function(_0x3bf25d){_0x38f521=_0x3bf25d[_0x1126('0x7e')];return _0x38093e[_0x1126('0x31')](function(_0x6a41c0){var _0x2828d4=_[_0x1126('0x36')](_0x38f521,['id',_0x6a41c0['id']]);if(_0x2828d4)_[_0x1126('0x7f')](_0x6a41c0,_[_0x1126('0x37')](_[_0x1126('0x80')](_0x2828d4,_0x4e4d49),_0x29bc7d));_0x6a41c0[_0x1126('0x81')]=getAgentStatus(_0x6a41c0);return _0x6a41c0;});})[_0x1126('0x16')](function(_0x1228cf){if(_0x3bf090[_0x1126('0x76')]['globalStatusFilter']){var _0x111f49=_[_0x1126('0x38')](_0x1228cf,[_0x1126('0x81'),_0x3bf090['query']['globalStatusFilter']]);if(_0x3bf090[_0x1126('0x76')][_0x1126('0x82')]){_0x111f49=_[_0x1126('0x38')](_0x111f49,[_0x1126('0x5a'),_0x3bf090['query']['pauseTypeFilter']]);}}_0x16552b['rows']=_0x111f49||_0x1228cf;return _0x16552b;})[_0x1126('0x16')](respondWithFilteredResult(_0x4dc8cd,_0x1c7a2b))[_0x1126('0x18')](handleError(_0x4dc8cd,null));};exports[_0x1126('0x83')]=function(_0xdedb8f,_0x54a72e){var _0x1870ed=['mail',_0x1126('0x84'),_0x1126('0x85'),_0x1126('0x86'),_0x1126('0x87'),_0x1126('0x88'),_0x1126('0x34')];var _0x9a61b1={'count':0x0,'rows':[]},_0x5f5a36={},_0xfd2d9,_0x57ece2,_0x3c1dda,_0x906531,_0x4dd275;Promise[_0x1126('0x71')]()[_0x1126('0x16')](function(){if(_0xdedb8f['query'][_0x1126('0x89')]){if(!_[_0x1126('0x8a')](_0x1870ed,_0xdedb8f['query']['channel'][_0x1126('0x8b')]()))throw new Error(_0x1126('0x8c'));_0xfd2d9=_0xdedb8f[_0x1126('0x76')]['channel']['toLowerCase']();}var _0x4b0fab=_[_0x1126('0x19')](_0xfd2d9)+'Queue';var _0x4cfbed=_[_0x1126('0x31')](db[_0x4b0fab]['rawAttributes'],function(_0x1f320e){return{'name':_0x1f320e[_0x1126('0x73')],'type':_0x1f320e['type'][_0x1126('0x75')]};});_0x5f5a36=qs[_0x1126('0x8d')](_0x4cfbed,_0xdedb8f);if(_0xdedb8f[_0x1126('0x77')][_0x1126('0x8e')]===_0x1126('0x77')){var _0x5e9872={'params':{'id':_0xdedb8f[_0x1126('0x77')][_0x1126('0x8f')]},'query':{'section':_0xfd2d9==='voice'&&_0xdedb8f[_0x1126('0x76')][_0x1126('0x74')]===_0x1126('0x23')?_0x1126('0x90'):_[_0x1126('0x19')](_0xfd2d9)+_0x1126('0x1a'),'type':_0xdedb8f[_0x1126('0x76')][_0x1126('0x74')],'nolimit':!![],'sort':_0x1126('0x10'),'filter':_0xdedb8f[_0x1126('0x76')][_0x1126('0x38')]}};return db[_0x1126('0x7b')][_0x1126('0x7c')](_0x5e9872);}return db[_0x4b0fab][_0x1126('0x7d')](_0x5f5a36);})[_0x1126('0x16')](function(_0x171210){_0x9a61b1['count']=_0x171210[_0x1126('0xa')];_0x57ece2=_0x171210[_0x1126('0x7e')];return getRealtimeQueues(_0xdedb8f,_0xfd2d9);})[_0x1126('0x16')](function(_0x1483f4){_0x906531=_0x1483f4[_0x1126('0x7e')];return getRealtimeAgents();})['then'](function(_0xd11e1f){_0x3c1dda=_0xd11e1f['rows'];if(_0xfd2d9!='voice')return;return getRealtimeVoiceQueueChannels();})[_0x1126('0x16')](function(_0x2b1884){_0x4dd275=_0x2b1884?_0x2b1884['rows']:[];return initializeQueues(_0x57ece2,_0x906531,_0xfd2d9,_0xdedb8f['query'][_0x1126('0x74')]);})[_0x1126('0x16')](function(_0x228552){var _0x1ee970=_0x228552[_0x1126('0x31')](function(_0x37c7ee){if(_0xfd2d9===_0x1126('0x34'))return getVoiceQueueAgents(_0x37c7ee,_0x57ece2,_0x3c1dda,_0x4dd275);else return getQueueAgents(_0x37c7ee,_0x3c1dda,_0xfd2d9);});return Promise[_0x1126('0x91')](_0x1ee970);})[_0x1126('0x16')](function(_0x5644ea){_0x9a61b1[_0x1126('0x7e')]=_0x5644ea;return _0x9a61b1;})[_0x1126('0x16')](respondWithFilteredResult(_0x54a72e,_0x5f5a36))[_0x1126('0x18')](handleError(_0x54a72e,null));}; \ No newline at end of file +var _0x5fab=['pause','every','faxStatus','mailStatus','whatsappStatus','*pause','getAgents','lastLoginAt','lastPauseAt','pauseType','internal','address','mailPause','faxPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','smsPause','resolve','fieldName','type','role','agent','query','getOptions','raw','user','userProfileId','nolimit','sort','UserProfile','getResources','findAndCountAll','rows','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','mail','sms','openchannel','fax','channel','includes','toLowerCase','rawAttributes','key','QueueCampaigns','all','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','json','error','name','send','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','voice','startCase','Queues','format','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAvgHoldtime','map','get','agents','busy','pick','filter','queue','toString','find','UserId','accountcode','online','voiceStatus','User','Queue','QueueId','length','loggedInDb','idle','unknown','unavailable','ringing','isNil','chatPause','openchannelPause','voicePause','whatsappPause'];(function(_0x338bc2,_0x1be2e3){var _0x336630=function(_0x27ff61){while(--_0x27ff61){_0x338bc2['push'](_0x338bc2['shift']());}};_0x336630(++_0x1be2e3);}(_0x5fab,0x177));var _0xb5fa=function(_0x3a73bc,_0x550aef){_0x3a73bc=_0x3a73bc-0x0;var _0x32891b=_0x5fab[_0x3a73bc];return _0x32891b;};'use strict';var util=require(_0xb5fa('0x0'));var _=require(_0xb5fa('0x1'));var jayson=require('jayson/promise');var qs=require(_0xb5fa('0x2'));var logger=require(_0xb5fa('0x3'))(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var amiClient=jayson[_0xb5fa('0x6')][_0xb5fa('0x7')]({'port':0x232a});var routingClient=jayson[_0xb5fa('0x6')][_0xb5fa('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x10361d,_0x44df89){return function(_0x4a0249){if(_0x4a0249){var _0x5d70f6=typeof _0x44df89[_0xb5fa('0x8')]===_0xb5fa('0x9')&&typeof _0x44df89[_0xb5fa('0xa')]==='undefined';var _0x410eff=_0x4a0249[_0xb5fa('0xb')];var _0x2cf4a5=_0x5d70f6?0x0:_0x44df89['offset'];var _0x5b5ea8=_0x5d70f6?_0x4a0249[_0xb5fa('0xb')]:_0x44df89[_0xb5fa('0x8')]+_0x44df89[_0xb5fa('0xa')];var _0x44e6c8;if(_0x5b5ea8>=_0x410eff){_0x5b5ea8=_0x410eff;_0x44e6c8=0xc8;}else{_0x44e6c8=0xce;}_0x10361d[_0xb5fa('0xc')](_0x44e6c8);return _0x10361d[_0xb5fa('0xd')](_0xb5fa('0xe'),_0x2cf4a5+'-'+_0x5b5ea8+'/'+_0x410eff)[_0xb5fa('0xf')](_0x4a0249);}return null;};}function handleError(_0x309740,_0x4d3576){_0x4d3576=_0x4d3576||0x1f4;return function(_0x2ad830){logger[_0xb5fa('0x10')](_0x2ad830['stack']);if(_0x2ad830[_0xb5fa('0x11')]){delete _0x2ad830['name'];}_0x309740[_0xb5fa('0xc')](_0x4d3576)[_0xb5fa('0x12')](_0x2ad830);};}function getRealtimeAgents(){return new Promise(function(_0x40c914,_0xca8d82){return amiClient[_0xb5fa('0x13')]('Agents',{})['then'](function(_0x38e964){if(_0x38e964[_0xb5fa('0x10')])throw new Error(_0xb5fa('0x14'));var _0x27c8f7=_0x38e964['result'];return routingClient['request'](_0xb5fa('0x15'),{})[_0xb5fa('0x16')](function(_0x32e9e5){if(_0x32e9e5[_0xb5fa('0x10')])throw new Error(_0xb5fa('0x17'));var _0x13e82b=_0x32e9e5[_0xb5fa('0x18')];return _0x40c914(_[_0xb5fa('0x19')]({},_0x27c8f7,_0x13e82b));});})[_0xb5fa('0x1a')](function(_0x368cb1){_0xca8d82(_0x368cb1);});});}function getRealtimeQueues(_0x3c8d53,_0x1f5064){return new Promise(function(_0x5cd822,_0x432bfa){var _0x519e20=_0x1f5064===_0xb5fa('0x1b')?amiClient:routingClient;return _0x519e20['request'](_[_0xb5fa('0x1c')](_0x1f5064)+_0xb5fa('0x1d'),_0x3c8d53)['then'](function(_0x40dfdf){if(_0x40dfdf[_0xb5fa('0x10')])throw new Error(util[_0xb5fa('0x1e')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x1f5064));return _0x5cd822(_0x40dfdf[_0xb5fa('0x18')]);})[_0xb5fa('0x1a')](function(_0x444237){_0x432bfa(_0x444237);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x542348,_0x224ec8){return amiClient['request'](_0xb5fa('0x1f'),{})[_0xb5fa('0x16')](function(_0x11053a){if(_0x11053a[_0xb5fa('0x10')])throw new Error(_0xb5fa('0x20'));return _0x542348(_0x11053a[_0xb5fa('0x18')]);})[_0xb5fa('0x1a')](function(_0x20d649){_0x224ec8(_0x20d649);});});}function initializeQueues(_0x568870,_0x4ec294,_0x5bdf11,_0x5a1c39){var _0x28a350=[_0xb5fa('0x21'),_0xb5fa('0x22'),_0xb5fa('0x23'),_0xb5fa('0x24'),_0xb5fa('0x25')];if(_0x5bdf11===_0xb5fa('0x1b')&&_0x5a1c39===_0xb5fa('0x26')){_0x28a350[_0xb5fa('0x27')](_0xb5fa('0x28'),_0xb5fa('0x29'),_0xb5fa('0x2a'),_0xb5fa('0x2b'),_0xb5fa('0x2c'),_0xb5fa('0x2d'),_0xb5fa('0x2e'),_0xb5fa('0x2f'),_0xb5fa('0x30'),_0xb5fa('0x31'),_0xb5fa('0x32'),_0xb5fa('0x33'),_0xb5fa('0x34'),_0xb5fa('0x35'),_0xb5fa('0x36'),'predictiveIntervalAvailable',_0xb5fa('0x37'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0xb5fa('0x38'),'predictiveIntervalAvgTalktime');}return _0x568870[_0xb5fa('0x39')](function(_0x5876f1){var _0x5518b1=_0x5876f1[_0xb5fa('0x3a')]({'plain':!![]});_0x5518b1[_0xb5fa('0x3b')]=[];_0x5518b1['paused']=0x0;_0x5518b1['loggedInDb']=0x0;_0x5518b1[_0xb5fa('0x21')]=0x0;_0x5518b1[_0xb5fa('0x22')]=0x0;_0x5518b1[_0xb5fa('0x23')]=0x0;if(_0x5bdf11==='voice'){_0x5518b1[_0xb5fa('0x24')]=0x0;_0x5518b1[_0xb5fa('0x3c')]=0x0;if(_0x5a1c39==='outbound'){_0x5518b1[_0xb5fa('0x28')]=0x0;_0x5518b1[_0xb5fa('0x29')]=0x0;}}var _0x204d6b=_['find'](_0x4ec294,['id',_0x5518b1['id']]);if(_0x204d6b)_[_0xb5fa('0x19')](_0x5518b1,_[_0xb5fa('0x3d')](_0x204d6b,_0x28a350));return _0x5518b1;});}function updateAgentVoiceStatus(_0x24ef11,_0x55bdb7,_0x117694){var _0x1c818f=_[_0xb5fa('0x3e')](_0x117694,[_0xb5fa('0x3f'),_0x55bdb7['name']]);if(_0x1c818f['length']===0x0)return _0x24ef11['busy']=!![];if(_['some'](_0x1c818f,['connectedlinenum',_0x24ef11['internal'][_0xb5fa('0x40')]()]))return _0x24ef11['talking']=!![];if(!_0x24ef11[_0xb5fa('0x24')])return _0x24ef11[_0xb5fa('0x3c')]=!![];}function getVoiceQueueAgents(_0x36db1a,_0x30b288,_0x40c1c0,_0x269d21){var _0x4b4c4c=_['find'](_0x30b288,['id',_0x36db1a['id']]);if(!_0x4b4c4c)return _0x36db1a;return _0x4b4c4c['getMembers']({'raw':!![]})[_0xb5fa('0x16')](function(_0x4d23f1){for(var _0x73d425=0x0;_0x73d425<_0x4d23f1['length'];_0x73d425++){var _0x58aa97=_[_0xb5fa('0x41')](_0x40c1c0,['id',_0x4d23f1[_0x73d425][_0xb5fa('0x42')]]);if(!_0x58aa97){_0x58aa97={'id':_0x4d23f1[_0x73d425][_0xb5fa('0x42')],'name':_0x4d23f1[_0x73d425][_0xb5fa('0x42')],'accountcode':'','online':![]};}var _0x5bc93f={'id':_0x58aa97['id'],'name':_0x58aa97[_0xb5fa('0x11')],'internal':_0x58aa97[_0xb5fa('0x43')],'online':Boolean(_0x58aa97[_0xb5fa('0x44')]),'paused':Boolean(_0x4d23f1[_0x73d425][_0xb5fa('0x25')])};if(_0x58aa97[_0xb5fa('0x45')]==='talking')updateAgentVoiceStatus(_0x5bc93f,_0x36db1a,_0x269d21);if(_0x5bc93f[_0xb5fa('0x44')])_0x36db1a['loggedInDb']++;if(_0x5bc93f[_0xb5fa('0x3c')])_0x36db1a[_0xb5fa('0x3c')]++;if(_0x5bc93f[_0xb5fa('0x25')]&&!_0x5bc93f[_0xb5fa('0x3c')]&&!_0x5bc93f[_0xb5fa('0x24')])_0x36db1a[_0xb5fa('0x25')]++;_0x36db1a[_0xb5fa('0x3b')][_0xb5fa('0x27')](_0x5bc93f);}return _0x36db1a;});}function getQueueAgents(_0x4da448,_0x1c3c2c,_0xc03e44){var _0x59ae64=_0xb5fa('0x46')+_['startCase'](_0xc03e44)+_0xb5fa('0x47');var _0x5ae45a=_0xc03e44+'Pause';return db[_0x59ae64]['findAll']({'where':{[_[_0xb5fa('0x1c')](_0xc03e44)+_0xb5fa('0x48')]:_0x4da448['id']},'raw':!![]})[_0xb5fa('0x16')](function(_0x19e662){for(var _0x430f46=0x0;_0x430f46<_0x19e662[_0xb5fa('0x49')];_0x430f46++){var _0x10f354=_[_0xb5fa('0x41')](_0x1c3c2c,['id',_0x19e662[_0x430f46]['UserId']]);if(!_0x10f354){_0x10f354={'id':_0x19e662[_0x430f46][_0xb5fa('0x42')],'name':_0x19e662[_0x430f46][_0xb5fa('0x42')],'online':![],['pauseField']:![]};}var _0x4e0fe7={'id':_0x10f354['id'],'name':_0x10f354[_0xb5fa('0x11')],'online':Boolean(_0x10f354[_0xb5fa('0x44')]),'paused':Boolean(_0x10f354[_0x5ae45a])};if(_0x4e0fe7[_0xb5fa('0x44')])_0x4da448[_0xb5fa('0x4a')]++;_0x4da448[_0xb5fa('0x3b')][_0xb5fa('0x27')](_0x4e0fe7);}return _0x4da448;});}function isIdle(_0x1e1c2){return _0x1e1c2===_0xb5fa('0x4b')||_0x1e1c2===_0xb5fa('0x4c')||_0x1e1c2===_0xb5fa('0x4d')||_0x1e1c2===_0xb5fa('0x4e')||_[_0xb5fa('0x4f')](_0x1e1c2);}function isAgentPaused(_0x6ae261,_0x23be4c){var _0x42a359=[_0x6ae261[_0xb5fa('0x50')],_0x6ae261['faxPause'],_0x6ae261['mailPause'],_0x6ae261[_0xb5fa('0x51')],_0x6ae261['smsPause'],_0x6ae261[_0xb5fa('0x52')],_0x6ae261[_0xb5fa('0x53')]];if(!_0x23be4c)return _['every'](_0x42a359);var _0x4ef1d0=_[_0xb5fa('0x3e')](_0x42a359);return _0x4ef1d0[_0xb5fa('0x49')]>0x0&&_0x4ef1d0[_0xb5fa('0x49')]<_0x42a359[_0xb5fa('0x49')]?!![]:![];}function isAgentIdle(_0x3ffee0){if(_0x3ffee0['voiceStatus']!==_0xb5fa('0x4b')&&_0x3ffee0['voicePause']){_0x3ffee0[_0xb5fa('0x45')]=_0xb5fa('0x54');return![];}return _[_0xb5fa('0x55')]([_0x3ffee0['chatStatus'],_0x3ffee0[_0xb5fa('0x56')],_0x3ffee0[_0xb5fa('0x57')],_0x3ffee0['openchannelStatus'],_0x3ffee0['smsStatus'],_0x3ffee0[_0xb5fa('0x45')],_0x3ffee0[_0xb5fa('0x58')]],isIdle);}function getAgentStatus(_0x320745){var _0x3ffdb5=_0xb5fa('0x4c');if(isAgentPaused(_0x320745))_0x3ffdb5=_0xb5fa('0x54');else if(isAgentPaused(_0x320745,!![]))_0x3ffdb5=_0xb5fa('0x59');else if(isAgentIdle(_0x320745))_0x3ffdb5=_0xb5fa('0x4b');else _0x3ffdb5=_0xb5fa('0x3c');return _0x3ffdb5;}exports[_0xb5fa('0x5a')]=function(_0x25de19,_0x35cf5a){var _0x3ccfd1={'count':0x0,'rows':[]},_0x2799e7={},_0x23f235,_0x42c34f,_0x10830a=['userpic',_0xb5fa('0x44'),_0xb5fa('0x5b'),_0xb5fa('0x5c'),_0xb5fa('0x5d'),_0xb5fa('0x5c'),_0xb5fa('0x5e'),_0xb5fa('0x5f'),_0xb5fa('0x50'),_0xb5fa('0x51'),_0xb5fa('0x60'),'smsPause','whatsappPause',_0xb5fa('0x61'),_0xb5fa('0x52'),_0xb5fa('0x62'),'openchannelCapacity',_0xb5fa('0x63'),_0xb5fa('0x64'),_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68'),_0xb5fa('0x69'),'smsCurrentCapacity',_0xb5fa('0x6a'),_0xb5fa('0x6b'),'chatStatus',_0xb5fa('0x6c'),_0xb5fa('0x57'),'smsStatus',_0xb5fa('0x58'),_0xb5fa('0x56'),_0xb5fa('0x45'),_0xb5fa('0x6d'),_0xb5fa('0x6e'),_0xb5fa('0x6f'),_0xb5fa('0x70'),_0xb5fa('0x71'),_0xb5fa('0x72'),_0xb5fa('0x73'),_0xb5fa('0x3f'),_0xb5fa('0x74'),_0xb5fa('0x75'),_0xb5fa('0x76'),_0xb5fa('0x77'),_0xb5fa('0x78')],_0x24acea=[_0xb5fa('0x50'),_0xb5fa('0x51'),_0xb5fa('0x60'),_0xb5fa('0x79'),_0xb5fa('0x53'),_0xb5fa('0x61'),'voicePause',_0xb5fa('0x44')];Promise[_0xb5fa('0x7a')]()[_0xb5fa('0x16')](function(){var _0x580d1a=_[_0xb5fa('0x39')](db[_0xb5fa('0x46')]['rawAttributes'],function(_0x44fd4a){return{'name':_0x44fd4a[_0xb5fa('0x7b')],'type':_0x44fd4a[_0xb5fa('0x7c')]['key']};});_0x25de19['query'][_0xb5fa('0x7d')]=_0xb5fa('0x7e');_0x25de19[_0xb5fa('0x7f')]['online']=!![];_0x2799e7=qs[_0xb5fa('0x80')](_0x580d1a,_0x25de19);_0x2799e7[_0xb5fa('0x81')]=!![];if(_0x25de19[_0xb5fa('0x82')][_0xb5fa('0x7d')]==='user'){var _0x55000b={'params':{'id':_0x25de19['user'][_0xb5fa('0x83')]},'query':{'section':_0xb5fa('0x15'),'role':_0xb5fa('0x7e'),'online':!![],'nolimit':_0x25de19['query'][_0xb5fa('0x84')],'sort':_0x25de19[_0xb5fa('0x7f')][_0xb5fa('0x85')],'filter':_0x25de19[_0xb5fa('0x7f')][_0xb5fa('0x3e')],'raw':!![]}};return db[_0xb5fa('0x86')][_0xb5fa('0x87')](_0x55000b);}return db[_0xb5fa('0x46')][_0xb5fa('0x88')](_0x2799e7);})[_0xb5fa('0x16')](function(_0x3a1db9){_0x3ccfd1[_0xb5fa('0xb')]=_0x3a1db9[_0xb5fa('0xb')];_0x23f235=_0x3a1db9[_0xb5fa('0x89')];return getRealtimeAgents();})[_0xb5fa('0x16')](function(_0x5eeaa1){_0x42c34f=_0x5eeaa1[_0xb5fa('0x89')];return _0x23f235['map'](function(_0x47193c){var _0x209213=_[_0xb5fa('0x41')](_0x42c34f,['id',_0x47193c['id']]);if(_0x209213)_[_0xb5fa('0x19')](_0x47193c,_[_0xb5fa('0x3d')](_['omit'](_0x209213,_0x24acea),_0x10830a));_0x47193c[_0xb5fa('0x8a')]=getAgentStatus(_0x47193c);return _0x47193c;});})['then'](function(_0x77a831){if(_0x25de19[_0xb5fa('0x7f')][_0xb5fa('0x8b')]){var _0x394386=_['filter'](_0x77a831,['globalStatus',_0x25de19['query'][_0xb5fa('0x8b')]]);if(_0x25de19[_0xb5fa('0x7f')][_0xb5fa('0x8c')]){_0x394386=_[_0xb5fa('0x3e')](_0x394386,[_0xb5fa('0x5d'),_0x25de19[_0xb5fa('0x7f')]['pauseTypeFilter']]);}}_0x3ccfd1[_0xb5fa('0x89')]=_0x394386||_0x77a831;return _0x3ccfd1;})['then'](respondWithFilteredResult(_0x35cf5a,_0x2799e7))['catch'](handleError(_0x35cf5a,null));};exports[_0xb5fa('0x8d')]=function(_0x4cba86,_0x5d11bb){var _0x4e2253=[_0xb5fa('0x8e'),'chat',_0xb5fa('0x8f'),_0xb5fa('0x90'),_0xb5fa('0x91'),'whatsapp','voice'];var _0xb1fcac={'count':0x0,'rows':[]},_0x2abe24={},_0x4c70d1,_0x2d0c95,_0x3c7cb4,_0x244892,_0x2aaa2c;Promise['resolve']()[_0xb5fa('0x16')](function(){if(_0x4cba86[_0xb5fa('0x7f')][_0xb5fa('0x92')]){if(!_[_0xb5fa('0x93')](_0x4e2253,_0x4cba86[_0xb5fa('0x7f')][_0xb5fa('0x92')][_0xb5fa('0x94')]()))throw new Error('Invalid\x20channel');_0x4c70d1=_0x4cba86[_0xb5fa('0x7f')]['channel'][_0xb5fa('0x94')]();}var _0x45790c=_['startCase'](_0x4c70d1)+_0xb5fa('0x47');var _0x212d4e=_[_0xb5fa('0x39')](db[_0x45790c][_0xb5fa('0x95')],function(_0x3034b0){return{'name':_0x3034b0[_0xb5fa('0x7b')],'type':_0x3034b0[_0xb5fa('0x7c')][_0xb5fa('0x96')]};});_0x2abe24=qs['getOptions'](_0x212d4e,_0x4cba86);if(_0x4cba86[_0xb5fa('0x82')][_0xb5fa('0x7d')]===_0xb5fa('0x82')){var _0x20ffa1={'params':{'id':_0x4cba86['user']['userProfileId']},'query':{'section':_0x4c70d1==='voice'&&_0x4cba86['query'][_0xb5fa('0x7c')]===_0xb5fa('0x26')?_0xb5fa('0x97'):_[_0xb5fa('0x1c')](_0x4c70d1)+'Queues','type':_0x4cba86['query'][_0xb5fa('0x7c')],'nolimit':!![],'sort':'name','filter':_0x4cba86[_0xb5fa('0x7f')][_0xb5fa('0x3e')]}};return db[_0xb5fa('0x86')][_0xb5fa('0x87')](_0x20ffa1);}return db[_0x45790c]['findAndCountAll'](_0x2abe24);})[_0xb5fa('0x16')](function(_0x5c6b09){_0xb1fcac[_0xb5fa('0xb')]=_0x5c6b09[_0xb5fa('0xb')];_0x2d0c95=_0x5c6b09['rows'];return getRealtimeQueues(_0x4cba86,_0x4c70d1);})['then'](function(_0x391412){_0x244892=_0x391412[_0xb5fa('0x89')];return getRealtimeAgents();})[_0xb5fa('0x16')](function(_0x1bcca7){_0x3c7cb4=_0x1bcca7[_0xb5fa('0x89')];if(_0x4c70d1!=_0xb5fa('0x1b'))return;return getRealtimeVoiceQueueChannels();})[_0xb5fa('0x16')](function(_0x25b278){_0x2aaa2c=_0x25b278?_0x25b278[_0xb5fa('0x89')]:[];return initializeQueues(_0x2d0c95,_0x244892,_0x4c70d1,_0x4cba86[_0xb5fa('0x7f')][_0xb5fa('0x7c')]);})[_0xb5fa('0x16')](function(_0x86dfe9){var _0x53c7b5=_0x86dfe9['map'](function(_0x3dd9ab){if(_0x4c70d1==='voice')return getVoiceQueueAgents(_0x3dd9ab,_0x2d0c95,_0x3c7cb4,_0x2aaa2c);else return getQueueAgents(_0x3dd9ab,_0x3c7cb4,_0x4c70d1);});return Promise[_0xb5fa('0x98')](_0x53c7b5);})[_0xb5fa('0x16')](function(_0x502946){_0xb1fcac[_0xb5fa('0x89')]=_0x502946;return _0xb1fcac;})[_0xb5fa('0x16')](respondWithFilteredResult(_0x5d11bb,_0x2abe24))['catch'](handleError(_0x5d11bb,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index f073ddc..f9f32be 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xd685e,_0x360045){var _0x5ef5e0=function(_0x37f4b3){while(--_0x37f4b3){_0xd685e['push'](_0xd685e['shift']());}};_0x5ef5e0(++_0x360045);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x28ee9c,_0x1ae563){var _0x36f796=function(_0x4b9d9a){while(--_0x4b9d9a){_0x28ee9c['push'](_0x28ee9c['shift']());}};_0x36f796(++_0x1ae563);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index daf4c58..a682f82 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 _0x22da=['STRING','DATE','INTEGER'];(function(_0x219fa8,_0x56885f){var _0x30b978=function(_0x1c3e66){while(--_0x1c3e66){_0x219fa8['push'](_0x219fa8['shift']());}};_0x30b978(++_0x56885f);}(_0x22da,0x80));var _0xa22d=function(_0x4c0f1a,_0x259332){_0x4c0f1a=_0x4c0f1a-0x0;var _0x54cc74=_0x22da[_0x4c0f1a];return _0x54cc74;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xa22d('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xa22d('0x1')]},'scheduledat':{'type':Sequelize[_0xa22d('0x2')]},'uniqueid':{'type':Sequelize[_0xa22d('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xa22d('0x2')]},'ringtime':{'type':Sequelize[_0xa22d('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xa22d('0x1')]},'campaigntype':{'type':Sequelize[_0xa22d('0x1')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5d58=['INTEGER','STRING','DATE'];(function(_0x6874f,_0x32d393){var _0x4c840b=function(_0x77e68){while(--_0x77e68){_0x6874f['push'](_0x6874f['shift']());}};_0x4c840b(++_0x32d393);}(_0x5d58,0x187));var _0x85d5=function(_0x51b6d4,_0x53db90){_0x51b6d4=_0x51b6d4-0x0;var _0x715c74=_0x5d58[_0x51b6d4];return _0x715c74;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x85d5('0x0')]},'starttime':{'type':Sequelize[_0x85d5('0x1')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x85d5('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x85d5('0x0')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x85d5('0x0')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 475690b..ddfaabe 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 _0x2798=['ReportAgentPreview','report_agent_preview','util','api','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define'];(function(_0x4139b8,_0x554564){var _0x40c6d6=function(_0x4a743b){while(--_0x4a743b){_0x4139b8['push'](_0x4139b8['shift']());}};_0x40c6d6(++_0x554564);}(_0x2798,0xe9));var _0x8279=function(_0x1b3f23,_0xa1dee4){_0x1b3f23=_0x1b3f23-0x0;var _0x56a6b9=_0x2798[_0x1b3f23];return _0x56a6b9;};'use strict';var _=require('lodash');var util=require(_0x8279('0x0'));var logger=require('../../config/logger')(_0x8279('0x1'));var moment=require('moment');var BPromise=require(_0x8279('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8279('0x3'));var rimraf=require(_0x8279('0x4'));var config=require(_0x8279('0x5'));var attributes=require(_0x8279('0x6'));module[_0x8279('0x7')]=function(_0x321dc0,_0x100e41){return _0x321dc0[_0x8279('0x8')](_0x8279('0x9'),attributes,{'tableName':_0x8279('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd840=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash'];(function(_0x380510,_0x2ad26b){var _0x2717c1=function(_0x122ee7){while(--_0x122ee7){_0x380510['push'](_0x380510['shift']());}};_0x2717c1(++_0x2ad26b);}(_0xd840,0x185));var _0x0d84=function(_0x2fcf21,_0x33c27d){_0x2fcf21=_0x2fcf21-0x0;var _0x31706f=_0xd840[_0x2fcf21];return _0x31706f;};'use strict';var _=require(_0x0d84('0x0'));var util=require('util');var logger=require(_0x0d84('0x1'))('api');var moment=require(_0x0d84('0x2'));var BPromise=require('bluebird');var rp=require(_0x0d84('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0d84('0x4'));var config=require(_0x0d84('0x5'));var attributes=require(_0x0d84('0x6'));module['exports']=function(_0x481d7a,_0x2998a1){return _0x481d7a[_0x0d84('0x7')](_0x0d84('0x8'),attributes,{'tableName':_0x0d84('0x9'),'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 dab1b9f..f81316d 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 _0x6262=['debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','body','options'];(function(_0x4f525c,_0x5a428e){var _0x49ede8=function(_0x1d1089){while(--_0x1d1089){_0x4f525c['push'](_0x4f525c['shift']());}};_0x49ede8(++_0x5a428e);}(_0x6262,0x139));var _0x2626=function(_0x555552,_0x576279){_0x555552=_0x555552-0x0;var _0x5b280d=_0x6262[_0x555552];return _0x5b280d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2626('0x0'));var BPromise=require(_0x2626('0x1'));var rs=require(_0x2626('0x2'));var fs=require('fs');var Redis=require(_0x2626('0x3'));var db=require(_0x2626('0x4'))['db'];var utils=require(_0x2626('0x5'));var logger=require('../../config/logger')(_0x2626('0x6'));var config=require(_0x2626('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2626('0x8')][_0x2626('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c7d45,_0x2aa5ad,_0x145cfd){return new BPromise(function(_0x273b8e,_0x5cd322){return client[_0x2626('0xa')](_0x3c7d45,_0x145cfd)[_0x2626('0xb')](function(_0x188d9f){logger[_0x2626('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x2aa5ad,_0x2626('0xd'));logger['debug'](_0x2626('0xe'),_0x2aa5ad,_0x2626('0xd'),JSON[_0x2626('0xf')](_0x188d9f));if(_0x188d9f[_0x2626('0x10')]){if(_0x188d9f[_0x2626('0x10')][_0x2626('0x11')]===0x1f4){logger[_0x2626('0x10')](_0x2626('0x12'),_0x2aa5ad,_0x188d9f[_0x2626('0x10')][_0x2626('0x13')]);return _0x5cd322(_0x188d9f[_0x2626('0x10')][_0x2626('0x13')]);}logger[_0x2626('0x10')](_0x2626('0x12'),_0x2aa5ad,_0x188d9f['error'][_0x2626('0x13')]);return _0x273b8e(_0x188d9f[_0x2626('0x10')][_0x2626('0x13')]);}else{logger[_0x2626('0xc')](_0x2626('0x12'),_0x2aa5ad,_0x2626('0xd'));_0x273b8e(_0x188d9f[_0x2626('0x14')]['message']);}})[_0x2626('0x15')](function(_0x25174f){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x2aa5ad,_0x25174f);_0x5cd322(_0x25174f);});});}exports[_0x2626('0x16')]=function(_0x36df6b){var _0x189487=this;return new Promise(function(_0x2d3f93,_0xc4821){return db['ReportAgentPreview']['create'](_0x36df6b[_0x2626('0x17')],{'raw':_0x36df6b[_0x2626('0x18')]?_0x36df6b[_0x2626('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x2626('0xb')](function(_0x2cd960){logger[_0x2626('0xc')]('CreateReportAgentPreview',_0x36df6b);logger[_0x2626('0x19')](_0x2626('0x16'),_0x36df6b,JSON['stringify'](_0x2cd960));_0x2d3f93(_0x2cd960);})[_0x2626('0x15')](function(_0x5d8da0){logger[_0x2626('0x10')](_0x2626('0x16'),_0x5d8da0[_0x2626('0x13')],_0x36df6b);_0xc4821(_0x189487[_0x2626('0x10')](0x1f4,_0x5d8da0[_0x2626('0x13')]));});});}; \ No newline at end of file +var _0x3d4f=['info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateReportAgentPreview','options','raw','then','debug','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x267409,_0x5b32b9){var _0x408f1b=function(_0xada26f){while(--_0xada26f){_0x267409['push'](_0x267409['shift']());}};_0x408f1b(++_0x5b32b9);}(_0x3d4f,0xef));var _0xf3d4=function(_0x43a251,_0x2ca1b8){_0x43a251=_0x43a251-0x0;var _0x15f782=_0x3d4f[_0x43a251];return _0x15f782;};'use strict';var _=require('lodash');var util=require(_0xf3d4('0x0'));var moment=require(_0xf3d4('0x1'));var BPromise=require('bluebird');var rs=require(_0xf3d4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3d4('0x3'))['db'];var utils=require(_0xf3d4('0x4'));var logger=require('../../config/logger')(_0xf3d4('0x5'));var config=require(_0xf3d4('0x6'));var jayson=require(_0xf3d4('0x7'));var client=jayson[_0xf3d4('0x8')][_0xf3d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40e3b2,_0x1c5b00,_0x28c5c6){return new BPromise(function(_0x3af901,_0x10859d){return client[_0xf3d4('0xa')](_0x40e3b2,_0x28c5c6)['then'](function(_0x4a0faf){logger[_0xf3d4('0xb')](_0xf3d4('0xc'),_0x1c5b00,'request\x20sent');logger['debug'](_0xf3d4('0xd'),_0x1c5b00,_0xf3d4('0xe'),JSON[_0xf3d4('0xf')](_0x4a0faf));if(_0x4a0faf['error']){if(_0x4a0faf[_0xf3d4('0x10')][_0xf3d4('0x11')]===0x1f4){logger[_0xf3d4('0x10')](_0xf3d4('0xc'),_0x1c5b00,_0x4a0faf[_0xf3d4('0x10')]['message']);return _0x10859d(_0x4a0faf[_0xf3d4('0x10')][_0xf3d4('0x12')]);}logger[_0xf3d4('0x10')](_0xf3d4('0xc'),_0x1c5b00,_0x4a0faf['error'][_0xf3d4('0x12')]);return _0x3af901(_0x4a0faf[_0xf3d4('0x10')][_0xf3d4('0x12')]);}else{logger[_0xf3d4('0xb')](_0xf3d4('0xc'),_0x1c5b00,_0xf3d4('0xe'));_0x3af901(_0x4a0faf[_0xf3d4('0x13')]['message']);}})['catch'](function(_0x264b21){logger[_0xf3d4('0x10')](_0xf3d4('0xc'),_0x1c5b00,_0x264b21);_0x10859d(_0x264b21);});});}exports[_0xf3d4('0x14')]=function(_0x20bd1b){var _0x27691d=this;return new Promise(function(_0x10f51e,_0x3e4e51){return db['ReportAgentPreview']['create'](_0x20bd1b['body'],{'raw':_0x20bd1b[_0xf3d4('0x15')]?_0x20bd1b[_0xf3d4('0x15')][_0xf3d4('0x16')]===undefined?!![]:![]:!![]})[_0xf3d4('0x17')](function(_0x2fdea7){logger[_0xf3d4('0xb')]('CreateReportAgentPreview',_0x20bd1b);logger[_0xf3d4('0x18')](_0xf3d4('0x14'),_0x20bd1b,JSON[_0xf3d4('0xf')](_0x2fdea7));_0x10f51e(_0x2fdea7);})['catch'](function(_0x524c44){logger[_0xf3d4('0x10')]('CreateReportAgentPreview',_0x524c44['message'],_0x20bd1b);_0x3e4e51(_0x27691d[_0xf3d4('0x10')](0x1f4,_0x524c44['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 3d1bbf2..f5f0a7d 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 _0xbd81=['voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','chat','/fax/queues/:id/notify','queueNotify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','multer','express','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup'];(function(_0xa0770a,_0x41e62d){var _0xf982c4=function(_0x4a5c43){while(--_0x4a5c43){_0xa0770a['push'](_0xa0770a['shift']());}};_0xf982c4(++_0x41e62d);}(_0xbd81,0x16a));var _0x1bd8=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xbd81[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require(_0x1bd8('0x0'));var util=require('util');var path=require('path');var express=require(_0x1bd8('0x1'));var router=express['Router']();var auth=require(_0x1bd8('0x2'));var controller=require('./rpc.controller');router[_0x1bd8('0x3')](_0x1bd8('0x4'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x6')]);router[_0x1bd8('0x3')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x1bd8('0x7')]);router[_0x1bd8('0x3')](_0x1bd8('0x8'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x9')]);router[_0x1bd8('0x3')](_0x1bd8('0xa'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0xb')]);router[_0x1bd8('0x3')](_0x1bd8('0xc'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0xd')]);router[_0x1bd8('0x3')](_0x1bd8('0xe'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0xf')]);router[_0x1bd8('0x3')](_0x1bd8('0x10'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x11')]);router['get'](_0x1bd8('0x12'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x13')]);router['get'](_0x1bd8('0x14'),auth[_0x1bd8('0x5')](),controller['smsQueues']);router['get'](_0x1bd8('0x15'),auth[_0x1bd8('0x5')](),controller['whatsappQueues']);router[_0x1bd8('0x3')](_0x1bd8('0x16'),auth[_0x1bd8('0x5')](),controller['faxQueues']);router[_0x1bd8('0x3')](_0x1bd8('0x17'),auth['isAuthenticated'](),controller[_0x1bd8('0x18')]);router[_0x1bd8('0x3')]('/voice/queues/channels',auth[_0x1bd8('0x5')](),controller['voiceQueuesChannels']);router[_0x1bd8('0x3')](_0x1bd8('0x19'),auth[_0x1bd8('0x5')](),controller['voiceQueuesChannel']);router[_0x1bd8('0x3')](_0x1bd8('0x1a'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x1b')]);router[_0x1bd8('0x3')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x1c')]);router['get'](_0x1bd8('0x1d'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x1e')]);router[_0x1bd8('0x1f')](_0x1bd8('0x1d'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x20')]);router[_0x1bd8('0x3')](_0x1bd8('0x21'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x22')]);router['get']('/outbound/channels',auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x23')]);router[_0x1bd8('0x3')](_0x1bd8('0x24'),auth['isAuthenticated'](),controller[_0x1bd8('0x25')]);router['put'](_0x1bd8('0x26'),auth[_0x1bd8('0x5')](),controller['agentCapacity']);router[_0x1bd8('0x3')](_0x1bd8('0x27'),auth['isAuthenticated'](),controller[_0x1bd8('0x28')]);router[_0x1bd8('0x3')](_0x1bd8('0x29'),auth['isAuthenticated'](),controller[_0x1bd8('0x2a')]);router[_0x1bd8('0x3')]('/campaigns',auth['isAuthenticated'](),controller[_0x1bd8('0x2b')]);router[_0x1bd8('0x3')](_0x1bd8('0x2c'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x2d')]);router['get'](_0x1bd8('0x2e'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x2f')]);router[_0x1bd8('0x3')](_0x1bd8('0x30'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x31')]);router[_0x1bd8('0x3')](_0x1bd8('0x32'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x33')]);router['get'](_0x1bd8('0x34'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x1bd8('0x3')](_0x1bd8('0x35'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x36')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x37')]);router[_0x1bd8('0x3')](_0x1bd8('0x38'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x39')]);router[_0x1bd8('0x3a')](_0x1bd8('0x3b'),auth[_0x1bd8('0x5')](),controller['queueNotify'](_0x1bd8('0x3c')));router[_0x1bd8('0x3')]('/mail/queues/:id',auth[_0x1bd8('0x5')](),controller['showMailQueues']);router[_0x1bd8('0x3a')]('/chat/queues/:id/notify',auth[_0x1bd8('0x5')](),controller['queueNotify'](_0x1bd8('0x3d')));router[_0x1bd8('0x3')]('/chat/queues/:id',auth[_0x1bd8('0x5')](),controller['showChatQueues']);router[_0x1bd8('0x3a')](_0x1bd8('0x3e'),auth['isAuthenticated'](),controller[_0x1bd8('0x3f')](_0x1bd8('0x40')));router[_0x1bd8('0x3')](_0x1bd8('0x41'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x42')]);router['post'](_0x1bd8('0x43'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x3f')](_0x1bd8('0x44')));router[_0x1bd8('0x3')](_0x1bd8('0x45'),auth[_0x1bd8('0x5')](),controller['showOpenchannelQueues']);router['post'](_0x1bd8('0x46'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x3f')](_0x1bd8('0x47')));router[_0x1bd8('0x3a')](_0x1bd8('0x48'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x3f')]('whatsapp'));router['get'](_0x1bd8('0x49'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x4a')]);router['get'](_0x1bd8('0x4b'),auth[_0x1bd8('0x5')](),controller[_0x1bd8('0x4c')]);router[_0x1bd8('0x3a')](_0x1bd8('0x4d'),auth[_0x1bd8('0x5')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0x47b1=['chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outboundChannels','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify'];(function(_0x366d80,_0xe95520){var _0x488698=function(_0x28f7cf){while(--_0x28f7cf){_0x366d80['push'](_0x366d80['shift']());}};_0x488698(++_0xe95520);}(_0x47b1,0x143));var _0x147b=function(_0x2d7f81,_0xe7bca){_0x2d7f81=_0x2d7f81-0x0;var _0x1b4db3=_0x47b1[_0x2d7f81];return _0x1b4db3;};'use strict';var multer=require('multer');var util=require(_0x147b('0x0'));var path=require(_0x147b('0x1'));var express=require(_0x147b('0x2'));var router=express[_0x147b('0x3')]();var auth=require(_0x147b('0x4'));var controller=require('./rpc.controller');router[_0x147b('0x5')](_0x147b('0x6'),auth[_0x147b('0x7')](),controller[_0x147b('0x8')]);router[_0x147b('0x5')](_0x147b('0x9'),auth[_0x147b('0x7')](),controller[_0x147b('0xa')]);router[_0x147b('0x5')](_0x147b('0xb'),auth['isAuthenticated'](),controller[_0x147b('0xc')]);router[_0x147b('0x5')](_0x147b('0xd'),auth[_0x147b('0x7')](),controller[_0x147b('0xe')]);router['get'](_0x147b('0xf'),auth[_0x147b('0x7')](),controller['chatQueues']);router[_0x147b('0x5')]('/mail/queues',auth[_0x147b('0x7')](),controller[_0x147b('0x10')]);router[_0x147b('0x5')](_0x147b('0x11'),auth[_0x147b('0x7')](),controller['mailAccounts']);router['get'](_0x147b('0x12'),auth[_0x147b('0x7')](),controller[_0x147b('0x13')]);router[_0x147b('0x5')](_0x147b('0x14'),auth[_0x147b('0x7')](),controller['smsQueues']);router['get'](_0x147b('0x15'),auth[_0x147b('0x7')](),controller['whatsappQueues']);router[_0x147b('0x5')](_0x147b('0x16'),auth[_0x147b('0x7')](),controller['faxQueues']);router[_0x147b('0x5')](_0x147b('0x17'),auth[_0x147b('0x7')](),controller[_0x147b('0x18')]);router['get'](_0x147b('0x19'),auth[_0x147b('0x7')](),controller['voiceQueuesChannels']);router[_0x147b('0x5')](_0x147b('0x1a'),auth[_0x147b('0x7')](),controller[_0x147b('0x1b')]);router['get'](_0x147b('0x1c'),auth[_0x147b('0x7')](),controller[_0x147b('0x1d')]);router[_0x147b('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x147b('0x7')](),controller[_0x147b('0x1e')]);router[_0x147b('0x5')](_0x147b('0x1f'),auth[_0x147b('0x7')](),controller[_0x147b('0x20')]);router[_0x147b('0x21')](_0x147b('0x1f'),auth['isAuthenticated'](),controller[_0x147b('0x22')]);router['get'](_0x147b('0x23'),auth['isAuthenticated'](),controller['outbound']);router[_0x147b('0x5')]('/outbound/channels',auth[_0x147b('0x7')](),controller[_0x147b('0x24')]);router['get']('/agents',auth['isAuthenticated'](),controller['agents']);router[_0x147b('0x21')](_0x147b('0x25'),auth[_0x147b('0x7')](),controller[_0x147b('0x26')]);router['get'](_0x147b('0x27'),auth[_0x147b('0x7')](),controller[_0x147b('0x28')]);router[_0x147b('0x5')](_0x147b('0x29'),auth[_0x147b('0x7')](),controller[_0x147b('0x2a')]);router[_0x147b('0x5')](_0x147b('0x2b'),auth[_0x147b('0x7')](),controller[_0x147b('0x2c')]);router[_0x147b('0x5')](_0x147b('0x2d'),auth['isAuthenticated'](),controller['faxAccounts']);router['get']('/chat/queues/waitinginteractions',auth[_0x147b('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0x147b('0x5')](_0x147b('0x2e'),auth[_0x147b('0x7')](),controller[_0x147b('0x2f')]);router['get']('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x147b('0x30')]);router[_0x147b('0x5')](_0x147b('0x31'),auth[_0x147b('0x7')](),controller[_0x147b('0x32')]);router[_0x147b('0x5')](_0x147b('0x33'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x147b('0x7')](),controller[_0x147b('0x34')]);router[_0x147b('0x5')](_0x147b('0x35'),auth[_0x147b('0x7')](),controller[_0x147b('0x36')]);router[_0x147b('0x37')](_0x147b('0x38'),auth[_0x147b('0x7')](),controller['queueNotify'](_0x147b('0x39')));router['get'](_0x147b('0x3a'),auth['isAuthenticated'](),controller[_0x147b('0x3b')]);router[_0x147b('0x37')](_0x147b('0x3c'),auth[_0x147b('0x7')](),controller[_0x147b('0x3d')](_0x147b('0x3e')));router[_0x147b('0x5')](_0x147b('0x3f'),auth[_0x147b('0x7')](),controller[_0x147b('0x40')]);router[_0x147b('0x37')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x147b('0x41')));router[_0x147b('0x5')](_0x147b('0x42'),auth[_0x147b('0x7')](),controller[_0x147b('0x43')]);router[_0x147b('0x37')]('/openchannel/queues/:id/notify',auth[_0x147b('0x7')](),controller['queueNotify']('openchannel'));router['get']('/openchannel/queues/:id',auth[_0x147b('0x7')](),controller[_0x147b('0x44')]);router[_0x147b('0x37')](_0x147b('0x45'),auth['isAuthenticated'](),controller['queueNotify'](_0x147b('0x46')));router[_0x147b('0x37')](_0x147b('0x47'),auth[_0x147b('0x7')](),controller[_0x147b('0x3d')]('whatsapp'));router[_0x147b('0x5')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x147b('0x48')]);router[_0x147b('0x5')](_0x147b('0x49'),auth['isAuthenticated'](),controller[_0x147b('0x4a')]);router[_0x147b('0x37')]('/agents/:id/notify',auth[_0x147b('0x7')](),controller[_0x147b('0x4b')]);module[_0x147b('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 42050ca..e785a67 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 _0xa630=['user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','agent','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','MailQueues','showMailQueues','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','Account','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','update','agentTransferTimeout','bluebird','moment','../../mysqldb','api','client','http','then','error','code','message','result','json','stack','name','status','isNil','rows','find','voiceChannels','VoiceChannels','catch','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','agentCapacity'];(function(_0x1d6a12,_0x49b3d3){var _0x3a79ca=function(_0x59b147){while(--_0x59b147){_0x1d6a12['push'](_0x1d6a12['shift']());}};_0x3a79ca(++_0x49b3d3);}(_0xa630,0xbe));var _0x0a63=function(_0x18430c,_0x2fd417){_0x18430c=_0x18430c-0x0;var _0x28be77=_0xa630[_0x18430c];return _0x28be77;};'use strict';var BPromise=require(_0x0a63('0x0'));var moment=require(_0x0a63('0x1'));var _=require('lodash');var util=require('util');var db=require(_0x0a63('0x2'))['db'];var logger=require('../../config/logger')(_0x0a63('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0a63('0x4')][_0x0a63('0x5')]({'port':0x232a});var mailClient=jayson[_0x0a63('0x4')][_0x0a63('0x5')]({'port':0x232b});var routingClient=jayson[_0x0a63('0x4')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2760b0,_0x3d5f0b,_0xc2dcd7){return new BPromise(function(_0x41d21d,_0x12a7df){var _0x2a1bd7=_0xc2dcd7?_0xc2dcd7:amiClient;return _0x2a1bd7['request'](_0x2760b0,_0x3d5f0b)[_0x0a63('0x6')](function(_0xb714c7){if(_0xb714c7[_0x0a63('0x7')]){if(_0xb714c7[_0x0a63('0x7')][_0x0a63('0x8')]===0x1f4){return _0x12a7df(_0xb714c7[_0x0a63('0x7')][_0x0a63('0x9')]);}return _0x41d21d(_0xb714c7[_0x0a63('0x7')][_0x0a63('0x9')]);}else{_0x41d21d(_0xb714c7[_0x0a63('0xa')]);}})['catch'](function(_0x345f56){_0x12a7df(_0x345f56);});});}function respondWithResult(_0x420043,_0x2fce86){_0x2fce86=_0x2fce86||0xc8;return function(_0x3d6323){if(_0x3d6323){return _0x420043['status'](_0x2fce86)[_0x0a63('0xb')](_0x3d6323);}return _0x420043['sendStatus'](0x194);};}function handleError(_0x331e99,_0x19e922){_0x19e922=_0x19e922||0x1f4;return function(_0x26b2bc){logger[_0x0a63('0x7')](_0x26b2bc[_0x0a63('0xc')]);if(_0x26b2bc[_0x0a63('0xd')]){delete _0x26b2bc[_0x0a63('0xd')];}_0x331e99[_0x0a63('0xe')](_0x19e922)['send'](_0x26b2bc);};}function findById(_0x47788e){return function(_0x56b314){if(!_[_0x0a63('0xf')](_0x47788e)&&!_[_0x0a63('0xf')](_0x56b314)&&!_[_0x0a63('0xf')](_0x56b314[_0x0a63('0x10')])){return _[_0x0a63('0x11')](_0x56b314[_0x0a63('0x10')],function(_0x30f292){return _0x30f292['id']==_0x47788e;});}return null;};}exports[_0x0a63('0x12')]=function(_0x2fd06c,_0x3cc74d){return respondWithRpcPromise(_0x0a63('0x13'),_0x2fd06c['query'])['then'](respondWithResult(_0x3cc74d,null))[_0x0a63('0x14')](handleError(_0x3cc74d,null));};exports['voiceChannelMixMonitor']=function(_0x2fc87c,_0x5937df){return respondWithRpcPromise(_0x0a63('0x15'),_[_0x0a63('0x16')](_0x2fc87c[_0x0a63('0x17')],_0x2fc87c[_0x0a63('0x18')]))['then'](respondWithResult(_0x5937df,null))[_0x0a63('0x14')](handleError(_0x5937df,null));};exports['voiceChannelStopMixMonitor']=function(_0x3a7f9d,_0x11fe64){return respondWithRpcPromise(_0x0a63('0x19'),_[_0x0a63('0x16')](_0x3a7f9d[_0x0a63('0x17')],_0x3a7f9d[_0x0a63('0x18')]))[_0x0a63('0x6')](respondWithResult(_0x11fe64,null))[_0x0a63('0x14')](handleError(_0x11fe64,null));};exports['voiceQueues']=function(_0x5e5987,_0x55fb70){return respondWithRpcPromise('VoiceQueues',_0x5e5987[_0x0a63('0x17')])['then'](respondWithResult(_0x55fb70,null))['catch'](handleError(_0x55fb70,null));};exports[_0x0a63('0x1a')]=function(_0x1d5448,_0x362d6a){return respondWithRpcPromise(_0x0a63('0x1b'),_0x1d5448['query'])[_0x0a63('0x6')](findById(_0x1d5448[_0x0a63('0x18')]['id']))[_0x0a63('0x6')](respondWithResult(_0x362d6a,null))['catch'](handleError(_0x362d6a,null));};exports[_0x0a63('0x1c')]=function(_0xcf409,_0x1b7bdb){return respondWithRpcPromise(_0x0a63('0x1d'),_[_0x0a63('0x16')](_0xcf409[_0x0a63('0x1e')],_0xcf409[_0x0a63('0x18')]))[_0x0a63('0x6')](respondWithResult(_0x1b7bdb,null))['catch'](handleError(_0x1b7bdb,null));};exports[_0x0a63('0x1f')]=function(_0x574c06,_0x151cb6){return respondWithRpcPromise(_0x0a63('0x20'),_[_0x0a63('0x16')](_0x574c06[_0x0a63('0x17')],_0x574c06[_0x0a63('0x18')]))['then'](respondWithResult(_0x151cb6,null))[_0x0a63('0x14')](handleError(_0x151cb6,null));};exports[_0x0a63('0x21')]=function(_0x33a717,_0x46fb40){return respondWithRpcPromise('VoiceQueuesChannels',_0x33a717[_0x0a63('0x17')])[_0x0a63('0x6')](respondWithResult(_0x46fb40,null))['catch'](handleError(_0x46fb40,null));};exports['voiceQueuesChannel']=function(_0x34a170,_0x51d959){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0a63('0x16')](_0x34a170[_0x0a63('0x17')],_0x34a170['params']))[_0x0a63('0x6')](respondWithResult(_0x51d959,null))[_0x0a63('0x14')](handleError(_0x51d959,null));};exports[_0x0a63('0x22')]=function(_0x333130,_0x395cce){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x333130[_0x0a63('0x17')],_0x333130[_0x0a63('0x18')]))[_0x0a63('0x6')](respondWithResult(_0x395cce,null))[_0x0a63('0x14')](handleError(_0x395cce,null));};exports[_0x0a63('0x23')]=function(_0x273bcf,_0x59912d){return respondWithRpcPromise(_0x0a63('0x24'),_[_0x0a63('0x16')](_0x273bcf['query'],_0x273bcf[_0x0a63('0x18')]))['then'](respondWithResult(_0x59912d,null))['catch'](handleError(_0x59912d,null));};exports[_0x0a63('0x25')]=function(_0x232388,_0xdc602c){return respondWithRpcPromise('Outbound',_0x232388[_0x0a63('0x17')])[_0x0a63('0x6')](respondWithResult(_0xdc602c,null))[_0x0a63('0x14')](handleError(_0xdc602c,null));};exports[_0x0a63('0x26')]=function(_0x3f88a1,_0x876bc6){return respondWithRpcPromise(_0x0a63('0x27'),_0x3f88a1['query'])[_0x0a63('0x6')](respondWithResult(_0x876bc6,null))[_0x0a63('0x14')](handleError(_0x876bc6,null));};exports[_0x0a63('0x28')]=function(_0x53d034,_0x5d9952){var _0x28f904;return respondWithRpcPromise('Agents',_0x53d034[_0x0a63('0x17')])[_0x0a63('0x6')](function(_0x128e9e){_0x28f904=_0x128e9e;return respondWithRpcPromise('Agents',_0x53d034[_0x0a63('0x17')],routingClient);})[_0x0a63('0x6')](function(_0x46b6ee){return _[_0x0a63('0x16')]({},_0x46b6ee,_0x28f904);})['then'](respondWithResult(_0x5d9952,null))[_0x0a63('0x14')](handleError(_0x5d9952,null));};exports[_0x0a63('0x29')]=function(_0x4234cd,_0x2ccd99){if(_0x4234cd[_0x0a63('0x1e')]&&_0x4234cd[_0x0a63('0x1e')]['interaction']&&_0x4234cd[_0x0a63('0x2a')]&&_0x4234cd[_0x0a63('0x2a')][_0x0a63('0xd')]){for(var _0x793502 in _0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')]){if(_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')][_0x0a63('0x2c')](_0x793502)){db[_0x0a63('0x2d')][_0x0a63('0x2e')]({'where':{'channel':_0x793502,'membername':_0x4234cd[_0x0a63('0x2a')][_0x0a63('0xd')],'type':_0x0a63('0x2f'),'exitAt':null,'uniqueid':_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')][_0x793502]&&_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')][_0x793502]['length']?{'$notIn':_0x4234cd[_0x0a63('0x1e')]['interaction'][_0x793502]}:{'$ne':null}}})['then'](function(_0xd9eddc){var _0x223ecf=moment()[_0x0a63('0x30')](_0x0a63('0x31'));for(var _0xd9149d=0x0,_0x9c89ed=_0xd9eddc[_0x0a63('0x32')];_0xd9149d<_0x9c89ed;_0xd9149d+=0x1){_0xd9eddc[_0xd9149d][_0x0a63('0x33')]({'exitAt':_0x223ecf});}});for(var _0x3d0667=0x0;_0x3d0667<_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')][_0x793502][_0x0a63('0x32')];_0x3d0667+=0x1){db[_0x0a63('0x2d')][_0x0a63('0x34')]({'where':{'channel':_0x793502,'membername':_0x4234cd[_0x0a63('0x2a')][_0x0a63('0xd')],'type':_0x0a63('0x2f'),'uniqueid':_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x2b')][_0x793502][_0x3d0667],'exitAt':null},'defaults':{'channel':_0x793502,'membername':_0x4234cd[_0x0a63('0x2a')]['name'],'interface':_[_0x0a63('0xf')](_0x4234cd[_0x0a63('0x2a')]['interface'])?util['format']('SIP/%s',_0x4234cd['user'][_0x0a63('0xd')]):_0x4234cd[_0x0a63('0x2a')]['interface'],'type':_0x0a63('0x2f'),'enterAt':moment()['format'](_0x0a63('0x31')),'role':_0x0a63('0x35'),'internal':_0x4234cd['user']['internal'],'uniqueid':_0x4234cd['body'][_0x0a63('0x2b')][_0x793502][_0x3d0667]}});}}}}return respondWithRpcPromise(_0x0a63('0x36'),{'id':_0x4234cd[_0x0a63('0x18')]['id'],'capacity':_0x4234cd[_0x0a63('0x1e')][_0x0a63('0x37')]},routingClient)['then'](respondWithResult(_0x2ccd99,null))[_0x0a63('0x14')](handleError(_0x2ccd99,null));};exports[_0x0a63('0x38')]=function(_0x22b3ea,_0x10adf1){return respondWithRpcPromise(_0x0a63('0x39'),_0x22b3ea['query'])[_0x0a63('0x6')](respondWithResult(_0x10adf1,null))[_0x0a63('0x14')](handleError(_0x10adf1,null));};exports[_0x0a63('0x3a')]=function(_0x1fbd2b,_0x4f3414){return respondWithRpcPromise(_0x0a63('0x3b'),_0x1fbd2b[_0x0a63('0x17')])[_0x0a63('0x6')](respondWithResult(_0x4f3414,null))[_0x0a63('0x14')](handleError(_0x4f3414,null));};exports[_0x0a63('0x3c')]=function(_0x258ed3,_0x4d4e20){return respondWithRpcPromise(_0x0a63('0x3d'),_0x258ed3[_0x0a63('0x17')])[_0x0a63('0x6')](respondWithResult(_0x4d4e20,null))[_0x0a63('0x14')](handleError(_0x4d4e20,null));};exports['chatQueues']=function(_0x4c1e34,_0x2ac98b){return respondWithRpcPromise(_0x0a63('0x3e'),_0x4c1e34[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](respondWithResult(_0x2ac98b,null))[_0x0a63('0x14')](handleError(_0x2ac98b,null));};exports['showChatQueues']=function(_0x5e6aae,_0x58b3a8){return respondWithRpcPromise(_0x0a63('0x3e'),_0x5e6aae['query'],routingClient)[_0x0a63('0x6')](findById(_0x5e6aae[_0x0a63('0x18')]['id']))[_0x0a63('0x6')](respondWithResult(_0x58b3a8,null))['catch'](handleError(_0x58b3a8,null));};exports['mailQueues']=function(_0x2d63c6,_0x226279){return respondWithRpcPromise(_0x0a63('0x3f'),_0x2d63c6[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](respondWithResult(_0x226279,null))[_0x0a63('0x14')](handleError(_0x226279,null));};exports[_0x0a63('0x40')]=function(_0xc3415c,_0xe454ef){return respondWithRpcPromise(_0x0a63('0x3f'),_0xc3415c[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](findById(_0xc3415c[_0x0a63('0x18')]['id']))[_0x0a63('0x6')](respondWithResult(_0xe454ef,null))['catch'](handleError(_0xe454ef,null));};exports['mailAccounts']=function(_0x1adea6,_0x24c9e0){return respondWithRpcPromise('MailAccounts',_0x1adea6[_0x0a63('0x17')],mailClient)[_0x0a63('0x6')](respondWithResult(_0x24c9e0,null))['catch'](handleError(_0x24c9e0,null));};exports[_0x0a63('0x41')]=function(_0x3053e4,_0x5e5495){return respondWithRpcPromise('OpenchannelQueues',_0x3053e4[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](respondWithResult(_0x5e5495,null))[_0x0a63('0x14')](handleError(_0x5e5495,null));};exports['showOpenchannelQueues']=function(_0x116e05,_0x375acd){return respondWithRpcPromise(_0x0a63('0x42'),_0x116e05[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](findById(_0x116e05['params']['id']))[_0x0a63('0x6')](respondWithResult(_0x375acd,null))[_0x0a63('0x14')](handleError(_0x375acd,null));};exports[_0x0a63('0x43')]=function(_0x1fa9cd,_0x295c06){return respondWithRpcPromise(_0x0a63('0x44'),_0x1fa9cd[_0x0a63('0x17')],routingClient)['then'](respondWithResult(_0x295c06,null))[_0x0a63('0x14')](handleError(_0x295c06,null));};exports[_0x0a63('0x45')]=function(_0x252f70,_0x1155f1){return respondWithRpcPromise(_0x0a63('0x44'),_0x252f70[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](findById(_0x252f70[_0x0a63('0x18')]['id']))['then'](respondWithResult(_0x1155f1,null))['catch'](handleError(_0x1155f1,null));};exports[_0x0a63('0x46')]=function(_0x30e5f0,_0x4137bc){return respondWithRpcPromise(_0x0a63('0x47'),_0x30e5f0[_0x0a63('0x17')],routingClient)['then'](respondWithResult(_0x4137bc,null))[_0x0a63('0x14')](handleError(_0x4137bc,null));};exports[_0x0a63('0x48')]=function(_0x1aefc4,_0x2a2f1b){return respondWithRpcPromise(_0x0a63('0x47'),_0x1aefc4[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](findById(_0x1aefc4[_0x0a63('0x18')]['id']))[_0x0a63('0x6')](respondWithResult(_0x2a2f1b,null))[_0x0a63('0x14')](handleError(_0x2a2f1b,null));};exports[_0x0a63('0x49')]=function(_0x485969,_0x25276f){return respondWithRpcPromise('FaxQueues',_0x485969[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](respondWithResult(_0x25276f,null))['catch'](handleError(_0x25276f,null));};exports['showFaxQueues']=function(_0x480acb,_0x31481f){return respondWithRpcPromise(_0x0a63('0x4a'),_0x480acb[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](findById(_0x480acb[_0x0a63('0x18')]['id']))[_0x0a63('0x6')](respondWithResult(_0x31481f,null))['catch'](handleError(_0x31481f,null));};exports['faxAccounts']=function(_0x5cb325,_0x1213a5){return respondWithRpcPromise(_0x0a63('0x4b'),_0x5cb325[_0x0a63('0x17')])[_0x0a63('0x6')](respondWithResult(_0x1213a5,null))['catch'](handleError(_0x1213a5,null));};exports[_0x0a63('0x4c')]=function(_0x5ed2db,_0x5de3de){return respondWithRpcPromise(_0x0a63('0x4d'),_0x5ed2db['query'],routingClient)[_0x0a63('0x6')](respondWithResult(_0x5de3de,null))[_0x0a63('0x14')](handleError(_0x5de3de,null));};exports['mailQueuesWaitingInteractions']=function(_0x267583,_0x4d1e35){return respondWithRpcPromise(_0x0a63('0x4e'),_0x267583['query'],routingClient)[_0x0a63('0x6')](respondWithResult(_0x4d1e35,null))[_0x0a63('0x14')](handleError(_0x4d1e35,null));};exports[_0x0a63('0x4f')]=function(_0x4fba49,_0x3b8442){return respondWithRpcPromise(_0x0a63('0x50'),_0x4fba49[_0x0a63('0x17')],routingClient)[_0x0a63('0x6')](respondWithResult(_0x3b8442,null))[_0x0a63('0x14')](handleError(_0x3b8442,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x55174c,_0x550dbb){return respondWithRpcPromise(_0x0a63('0x50'),_0x55174c['query'],routingClient)[_0x0a63('0x6')](function(_0xa27da4){if(_0x55174c[_0x0a63('0x17')][_0x0a63('0x51')]!==undefined){var _0x5540c6=_(_0xa27da4[_0x0a63('0x10')])[_0x0a63('0x52')]([_0x55174c['query'][_0x0a63('0x51')],_0x55174c[_0x0a63('0x18')]['id']])[_0x0a63('0x53')](_0x0a63('0x54'))[_0x0a63('0x55')]()['value']();return _0xa27da4[_0x0a63('0x10')][_0x0a63('0x52')](function(_0x3941f6){return _0x5540c6['indexOf'](_0x3941f6['queue_id'])>-0x1;});}else{return _0xa27da4['rows'][_0x0a63('0x52')](function(_0x3b94ae){return _0x3b94ae[_0x0a63('0x54')]===parseInt(_0x55174c[_0x0a63('0x18')]['id']);});}})[_0x0a63('0x6')](respondWithResult(_0x550dbb,null))[_0x0a63('0x14')](handleError(_0x550dbb,null));};exports[_0x0a63('0x56')]=function(_0x37255d,_0x1dc593){return respondWithRpcPromise(_0x0a63('0x57'),_0x37255d['query'],routingClient)[_0x0a63('0x6')](respondWithResult(_0x1dc593,null))[_0x0a63('0x14')](handleError(_0x1dc593,null));};exports[_0x0a63('0x58')]=function(_0x229954,_0x3d62ca){return respondWithRpcPromise(_0x0a63('0x59'),_0x229954['query'],routingClient)['then'](respondWithResult(_0x3d62ca,null))[_0x0a63('0x14')](handleError(_0x3d62ca,null));};exports[_0x0a63('0x5a')]=function(_0x425c8c,_0x3caea6){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x425c8c[_0x0a63('0x17')],routingClient)['then'](respondWithResult(_0x3caea6,null))[_0x0a63('0x14')](handleError(_0x3caea6,null));};exports[_0x0a63('0x5b')]=function(_0x1e256e){return function(_0xee586,_0x486ffc){var _0x3710fa,_0x2173ee;var _0x430065=_[_0x0a63('0x5c')](_0x1e256e);var _0x540953=_0x1e256e==='chat'?_0x0a63('0x5d'):'Account';return db[_0x430065+_0x0a63('0x5e')][_0x0a63('0x5f')]({'raw':!![],'where':{'id':_0xee586[_0x0a63('0x18')]['id']}})[_0x0a63('0x6')](function(_0x65a390){if(_['isNil'](_0x65a390)){throw new Error(_0x430065+_0x0a63('0x60'));}_0x3710fa=_0x65a390;return db[_0x430065+_0x0a63('0x61')][_0x0a63('0x5f')]({'where':{'id':_0xee586[_0x0a63('0x1e')][_0x0a63('0x62')]},'include':[{'model':db[_0x430065+_0x0a63('0x63')],'as':_0x0a63('0x63')},{'model':db[_0x430065+_0x540953],'as':'Account'}]});})[_0x0a63('0x6')](function(_0x1a329c){if(_[_0x0a63('0xf')](_0x1a329c)){throw new Error(_0x430065+_0x0a63('0x64'));}_0x2173ee=_0x1a329c;return _0x1a329c['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x0a63('0x6')](function(){var _0x148bbd={'uniqueid':_0x1e256e+'.'+_0x2173ee['id']+'.'+_0x2173ee[_0x0a63('0x63')]['id'],'FromUserId':_0xee586['user']['id'],'type':_0x0a63('0x65')};_0x148bbd[_0x430065+_0x0a63('0x66')]=_0x2173ee['id'];_0x148bbd[_0x430065+_0x0a63('0x67')]=_0x2173ee['Interaction']['id'];_0x148bbd[_0x0a63('0x68')+_0x430065+_0x540953+'Id']=_0x2173ee[_0x0a63('0x69')]['id'];_0x148bbd['To'+_0x430065+_0x0a63('0x6a')]=_0x3710fa['id'];return db[_0x430065+_0x0a63('0x6b')][_0x0a63('0x6c')](_0x148bbd);})[_0x0a63('0x6')](function(){return respondWithRpcPromise(_0x0a63('0x6d'),{'channel':_0x1e256e,'interaction':_0x2173ee[_0x0a63('0x63')],'message':_0x2173ee,'account':_0x2173ee[_0x0a63('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a63('0x65'),'appdata':_0x3710fa[_0x0a63('0xd')]+','+(_0x2173ee[_0x0a63('0x69')][_0x0a63('0x6e')]||0x12c),'interval':_0x0a63('0x6f')}]},routingClient);})[_0x0a63('0x6')](respondWithResult(_0x486ffc,null))[_0x0a63('0x14')](handleError(_0x486ffc,null));};};exports['agentNotify']=function(_0x3ddf5e,_0x5f0510){var _0x19a46f,_0x36fd48;if(_['isNil'](_0x3ddf5e[_0x0a63('0x1e')][_0x0a63('0x70')])){throw new Error(_0x0a63('0x71'));}var _0x2e1dc6=_0x3ddf5e[_0x0a63('0x1e')][_0x0a63('0x70')];var _0x1030f7=_[_0x0a63('0x5c')](_0x2e1dc6);var _0x393399=_0x2e1dc6==='chat'?_0x0a63('0x5d'):'Account';return db['User'][_0x0a63('0x5f')]({'raw':!![],'where':{'id':_0x3ddf5e[_0x0a63('0x18')]['id'],'role':_0x0a63('0x35')}})[_0x0a63('0x6')](function(_0x5e1f76){if(_[_0x0a63('0xf')](_0x5e1f76)){throw new Error('Agent\x20not\x20found');}_0x19a46f=_0x5e1f76;return db[_0x1030f7+'Message'][_0x0a63('0x5f')]({'where':{'id':_0x3ddf5e['body']['messageId']},'include':[{'model':db[_0x1030f7+_0x0a63('0x63')],'as':_0x0a63('0x63')},{'model':db[_0x1030f7+_0x393399],'as':_0x0a63('0x69')}]});})[_0x0a63('0x6')](function(_0x52488a){if(_[_0x0a63('0xf')](_0x52488a)){throw new Error(_0x1030f7+'\x20Message\x20not\x20found');}_0x36fd48=_0x52488a;return _0x52488a[_0x0a63('0x72')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x11dd21={'uniqueid':_0x2e1dc6+'.'+_0x36fd48['id']+'.'+_0x36fd48['Interaction']['id'],'FromUserId':_0x3ddf5e[_0x0a63('0x2a')]['id'],'type':_0x0a63('0x65'),'ToUserId':_0x19a46f['id']};_0x11dd21[_0x1030f7+_0x0a63('0x66')]=_0x36fd48['id'];_0x11dd21[_0x1030f7+_0x0a63('0x67')]=_0x36fd48[_0x0a63('0x63')]['id'];_0x11dd21[_0x0a63('0x68')+_0x1030f7+_0x393399+'Id']=_0x36fd48[_0x0a63('0x69')]['id'];return db[_0x1030f7+_0x0a63('0x6b')][_0x0a63('0x6c')](_0x11dd21);})['then'](function(){return respondWithRpcPromise(_0x0a63('0x6d'),{'channel':_0x2e1dc6,'interaction':_0x36fd48['Interaction'],'message':_0x36fd48,'account':_0x36fd48[_0x0a63('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a63('0x35'),'appdata':_0x19a46f[_0x0a63('0xd')]+','+(_0x36fd48[_0x0a63('0x69')][_0x0a63('0x73')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x0a63('0x6')](respondWithResult(_0x5f0510,null))[_0x0a63('0x14')](handleError(_0x5f0510,null));}; \ No newline at end of file +var _0xdbf5=['SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','Account','QueueId','TransferReport','create','agentNotify','Website','Agent\x20not\x20found','MessageId','Start','moment','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','catch','status','json','stack','name','send','isNil','rows','find','voiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','query','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','interaction','user','MemberReport','findAll','INTERACTION','length','findOrCreate','SIP/%s','format','YYYY-MM-DD\x20HH:mm:ss','agent','internal','capacity','telephones','Telephones','trunks','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2f4af1,_0x5d7421){_0x2f4af1=_0x2f4af1-0x0;var _0x5bf122=_0xdbf5[_0x2f4af1];return _0x5bf122;};'use strict';var BPromise=require('bluebird');var moment=require(_0x5dbf('0x0'));var _=require('lodash');var util=require('util');var db=require(_0x5dbf('0x1'))['db'];var logger=require(_0x5dbf('0x2'))(_0x5dbf('0x3'));var jayson=require(_0x5dbf('0x4'));var amiClient=jayson[_0x5dbf('0x5')][_0x5dbf('0x6')]({'port':0x232a});var mailClient=jayson[_0x5dbf('0x5')][_0x5dbf('0x6')]({'port':0x232b});var routingClient=jayson[_0x5dbf('0x5')][_0x5dbf('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x209b7d,_0x88128e,_0x93e657){return new BPromise(function(_0x52b039,_0x134810){var _0x501cb1=_0x93e657?_0x93e657:amiClient;return _0x501cb1[_0x5dbf('0x7')](_0x209b7d,_0x88128e)[_0x5dbf('0x8')](function(_0x264007){if(_0x264007[_0x5dbf('0x9')]){if(_0x264007['error'][_0x5dbf('0xa')]===0x1f4){return _0x134810(_0x264007['error']['message']);}return _0x52b039(_0x264007[_0x5dbf('0x9')]['message']);}else{_0x52b039(_0x264007['result']);}})[_0x5dbf('0xb')](function(_0x490b38){_0x134810(_0x490b38);});});}function respondWithResult(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xc8;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0xc')](_0x2bb7ed)[_0x5dbf('0xd')](_0x1453a9);}return _0x182cec['sendStatus'](0x194);};}function handleError(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0x1f4;return function(_0x3480c8){logger['error'](_0x3480c8[_0x5dbf('0xe')]);if(_0x3480c8[_0x5dbf('0xf')]){delete _0x3480c8[_0x5dbf('0xf')];}_0x4803ca[_0x5dbf('0xc')](_0x2b4e1c)[_0x5dbf('0x10')](_0x3480c8);};}function findById(_0x472eb9){return function(_0x2d32cc){if(!_['isNil'](_0x472eb9)&&!_['isNil'](_0x2d32cc)&&!_[_0x5dbf('0x11')](_0x2d32cc[_0x5dbf('0x12')])){return _[_0x5dbf('0x13')](_0x2d32cc[_0x5dbf('0x12')],function(_0x20c2b0){return _0x20c2b0['id']==_0x472eb9;});}return null;};}exports['voiceChannels']=function(_0x11cd00,_0x4dd03c){return respondWithRpcPromise('VoiceChannels',_0x11cd00['query'])[_0x5dbf('0x8')](respondWithResult(_0x4dd03c,null))[_0x5dbf('0xb')](handleError(_0x4dd03c,null));};exports[_0x5dbf('0x14')]=function(_0x2ab57c,_0x1e3cce){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x5dbf('0x15')](_0x2ab57c['query'],_0x2ab57c[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x1e3cce,null))[_0x5dbf('0xb')](handleError(_0x1e3cce,null));};exports[_0x5dbf('0x17')]=function(_0x3b763c,_0x2f154e){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x5dbf('0x15')](_0x3b763c[_0x5dbf('0x18')],_0x3b763c[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x2f154e,null))[_0x5dbf('0xb')](handleError(_0x2f154e,null));};exports[_0x5dbf('0x19')]=function(_0x290456,_0x20ab1b){return respondWithRpcPromise(_0x5dbf('0x1a'),_0x290456[_0x5dbf('0x18')])[_0x5dbf('0x8')](respondWithResult(_0x20ab1b,null))[_0x5dbf('0xb')](handleError(_0x20ab1b,null));};exports[_0x5dbf('0x1b')]=function(_0x407741,_0x729d8f){return respondWithRpcPromise(_0x5dbf('0x1a'),_0x407741[_0x5dbf('0x18')])[_0x5dbf('0x8')](findById(_0x407741[_0x5dbf('0x16')]['id']))[_0x5dbf('0x8')](respondWithResult(_0x729d8f,null))[_0x5dbf('0xb')](handleError(_0x729d8f,null));};exports[_0x5dbf('0x1c')]=function(_0x21cd00,_0x5768b7){return respondWithRpcPromise(_0x5dbf('0x1d'),_[_0x5dbf('0x15')](_0x21cd00[_0x5dbf('0x1e')],_0x21cd00[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x5768b7,null))[_0x5dbf('0xb')](handleError(_0x5768b7,null));};exports[_0x5dbf('0x1f')]=function(_0x31d57a,_0x406ce6){return respondWithRpcPromise(_0x5dbf('0x20'),_[_0x5dbf('0x15')](_0x31d57a['query'],_0x31d57a['params']))[_0x5dbf('0x8')](respondWithResult(_0x406ce6,null))[_0x5dbf('0xb')](handleError(_0x406ce6,null));};exports[_0x5dbf('0x21')]=function(_0x3b73ad,_0x37cf25){return respondWithRpcPromise('VoiceQueuesChannels',_0x3b73ad['query'])[_0x5dbf('0x8')](respondWithResult(_0x37cf25,null))[_0x5dbf('0xb')](handleError(_0x37cf25,null));};exports['voiceQueuesChannel']=function(_0x3531a2,_0x2a0491){return respondWithRpcPromise(_0x5dbf('0x22'),_[_0x5dbf('0x15')](_0x3531a2[_0x5dbf('0x18')],_0x3531a2['params']))[_0x5dbf('0x8')](respondWithResult(_0x2a0491,null))[_0x5dbf('0xb')](handleError(_0x2a0491,null));};exports[_0x5dbf('0x23')]=function(_0x273577,_0x3a8196){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x5dbf('0x15')](_0x273577[_0x5dbf('0x18')],_0x273577[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x3a8196,null))['catch'](handleError(_0x3a8196,null));};exports[_0x5dbf('0x24')]=function(_0x1e9a4e,_0x302dda){return respondWithRpcPromise(_0x5dbf('0x25'),_[_0x5dbf('0x15')](_0x1e9a4e[_0x5dbf('0x18')],_0x1e9a4e[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x302dda,null))[_0x5dbf('0xb')](handleError(_0x302dda,null));};exports[_0x5dbf('0x26')]=function(_0x1ba835,_0x51c667){return respondWithRpcPromise(_0x5dbf('0x27'),_0x1ba835[_0x5dbf('0x18')])[_0x5dbf('0x8')](respondWithResult(_0x51c667,null))['catch'](handleError(_0x51c667,null));};exports[_0x5dbf('0x28')]=function(_0x43954b,_0x2e4e67){return respondWithRpcPromise('OutboundChannels',_0x43954b[_0x5dbf('0x18')])[_0x5dbf('0x8')](respondWithResult(_0x2e4e67,null))[_0x5dbf('0xb')](handleError(_0x2e4e67,null));};exports['agents']=function(_0x4527fb,_0x29a62d){var _0x2ac162;return respondWithRpcPromise(_0x5dbf('0x29'),_0x4527fb[_0x5dbf('0x18')])[_0x5dbf('0x8')](function(_0x321ae3){_0x2ac162=_0x321ae3;return respondWithRpcPromise(_0x5dbf('0x29'),_0x4527fb['query'],routingClient);})['then'](function(_0x57ee72){return _['merge']({},_0x57ee72,_0x2ac162);})[_0x5dbf('0x8')](respondWithResult(_0x29a62d,null))[_0x5dbf('0xb')](handleError(_0x29a62d,null));};exports['agentCapacity']=function(_0x3ef0eb,_0x229abf){if(_0x3ef0eb['body']&&_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')]&&_0x3ef0eb[_0x5dbf('0x2b')]&&_0x3ef0eb[_0x5dbf('0x2b')][_0x5dbf('0xf')]){for(var _0x7c390d in _0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')]){if(_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')]['hasOwnProperty'](_0x7c390d)){db[_0x5dbf('0x2c')][_0x5dbf('0x2d')]({'where':{'channel':_0x7c390d,'membername':_0x3ef0eb[_0x5dbf('0x2b')]['name'],'type':_0x5dbf('0x2e'),'exitAt':null,'uniqueid':_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')][_0x7c390d]&&_0x3ef0eb[_0x5dbf('0x1e')]['interaction'][_0x7c390d][_0x5dbf('0x2f')]?{'$notIn':_0x3ef0eb['body'][_0x5dbf('0x2a')][_0x7c390d]}:{'$ne':null}}})[_0x5dbf('0x8')](function(_0x2d046b){var _0xcc1815=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x118ae6=0x0,_0x43f5e8=_0x2d046b[_0x5dbf('0x2f')];_0x118ae6<_0x43f5e8;_0x118ae6+=0x1){_0x2d046b[_0x118ae6]['updateAttributes']({'exitAt':_0xcc1815});}});for(var _0x2e241d=0x0;_0x2e241d<_0x3ef0eb['body']['interaction'][_0x7c390d]['length'];_0x2e241d+=0x1){db['MemberReport'][_0x5dbf('0x30')]({'where':{'channel':_0x7c390d,'membername':_0x3ef0eb[_0x5dbf('0x2b')]['name'],'type':_0x5dbf('0x2e'),'uniqueid':_0x3ef0eb[_0x5dbf('0x1e')]['interaction'][_0x7c390d][_0x2e241d],'exitAt':null},'defaults':{'channel':_0x7c390d,'membername':_0x3ef0eb[_0x5dbf('0x2b')][_0x5dbf('0xf')],'interface':_['isNil'](_0x3ef0eb[_0x5dbf('0x2b')]['interface'])?util['format'](_0x5dbf('0x31'),_0x3ef0eb[_0x5dbf('0x2b')][_0x5dbf('0xf')]):_0x3ef0eb['user']['interface'],'type':_0x5dbf('0x2e'),'enterAt':moment()[_0x5dbf('0x32')](_0x5dbf('0x33')),'role':_0x5dbf('0x34'),'internal':_0x3ef0eb[_0x5dbf('0x2b')][_0x5dbf('0x35')],'uniqueid':_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')][_0x7c390d][_0x2e241d]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3ef0eb[_0x5dbf('0x16')]['id'],'capacity':_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x36')]},routingClient)[_0x5dbf('0x8')](respondWithResult(_0x229abf,null))[_0x5dbf('0xb')](handleError(_0x229abf,null));};exports[_0x5dbf('0x37')]=function(_0x328dc5,_0x59f825){return respondWithRpcPromise(_0x5dbf('0x38'),_0x328dc5['query'])[_0x5dbf('0x8')](respondWithResult(_0x59f825,null))[_0x5dbf('0xb')](handleError(_0x59f825,null));};exports[_0x5dbf('0x39')]=function(_0x770c54,_0x78ab84){return respondWithRpcPromise(_0x5dbf('0x3a'),_0x770c54[_0x5dbf('0x18')])['then'](respondWithResult(_0x78ab84,null))['catch'](handleError(_0x78ab84,null));};exports['campaigns']=function(_0x1e1876,_0xfdacc7){return respondWithRpcPromise(_0x5dbf('0x3b'),_0x1e1876['query'])['then'](respondWithResult(_0xfdacc7,null))[_0x5dbf('0xb')](handleError(_0xfdacc7,null));};exports[_0x5dbf('0x3c')]=function(_0x344df5,_0x5d70cc){return respondWithRpcPromise(_0x5dbf('0x3d'),_0x344df5['query'],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x5d70cc,null))[_0x5dbf('0xb')](handleError(_0x5d70cc,null));};exports[_0x5dbf('0x3e')]=function(_0x5da14b,_0x55fd51){return respondWithRpcPromise(_0x5dbf('0x3d'),_0x5da14b[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](findById(_0x5da14b[_0x5dbf('0x16')]['id']))['then'](respondWithResult(_0x55fd51,null))[_0x5dbf('0xb')](handleError(_0x55fd51,null));};exports[_0x5dbf('0x3f')]=function(_0x478cc1,_0x5485f3){return respondWithRpcPromise(_0x5dbf('0x40'),_0x478cc1[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x5485f3,null))[_0x5dbf('0xb')](handleError(_0x5485f3,null));};exports[_0x5dbf('0x41')]=function(_0x4711d5,_0x50a029){return respondWithRpcPromise(_0x5dbf('0x40'),_0x4711d5['query'],routingClient)['then'](findById(_0x4711d5['params']['id']))[_0x5dbf('0x8')](respondWithResult(_0x50a029,null))['catch'](handleError(_0x50a029,null));};exports[_0x5dbf('0x42')]=function(_0x275c1d,_0x1c60ac){return respondWithRpcPromise(_0x5dbf('0x43'),_0x275c1d[_0x5dbf('0x18')],mailClient)[_0x5dbf('0x8')](respondWithResult(_0x1c60ac,null))[_0x5dbf('0xb')](handleError(_0x1c60ac,null));};exports[_0x5dbf('0x44')]=function(_0x2c84d6,_0x1d91de){return respondWithRpcPromise(_0x5dbf('0x45'),_0x2c84d6[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x1d91de,null))[_0x5dbf('0xb')](handleError(_0x1d91de,null));};exports[_0x5dbf('0x46')]=function(_0x53ab1a,_0x3fbc3d){return respondWithRpcPromise('OpenchannelQueues',_0x53ab1a[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](findById(_0x53ab1a[_0x5dbf('0x16')]['id']))[_0x5dbf('0x8')](respondWithResult(_0x3fbc3d,null))['catch'](handleError(_0x3fbc3d,null));};exports[_0x5dbf('0x47')]=function(_0x1ade34,_0x4362c6){return respondWithRpcPromise(_0x5dbf('0x48'),_0x1ade34[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x4362c6,null))['catch'](handleError(_0x4362c6,null));};exports[_0x5dbf('0x49')]=function(_0x3e5a96,_0x3b0465){return respondWithRpcPromise(_0x5dbf('0x48'),_0x3e5a96[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](findById(_0x3e5a96[_0x5dbf('0x16')]['id']))[_0x5dbf('0x8')](respondWithResult(_0x3b0465,null))[_0x5dbf('0xb')](handleError(_0x3b0465,null));};exports[_0x5dbf('0x4a')]=function(_0x13c8ab,_0x2997a8){return respondWithRpcPromise('WhatsappQueues',_0x13c8ab['query'],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x2997a8,null))[_0x5dbf('0xb')](handleError(_0x2997a8,null));};exports[_0x5dbf('0x4b')]=function(_0x110713,_0xc000ee){return respondWithRpcPromise(_0x5dbf('0x4c'),_0x110713[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](findById(_0x110713[_0x5dbf('0x16')]['id']))['then'](respondWithResult(_0xc000ee,null))['catch'](handleError(_0xc000ee,null));};exports['faxQueues']=function(_0x4f4aa3,_0x408b51){return respondWithRpcPromise(_0x5dbf('0x4d'),_0x4f4aa3[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x408b51,null))[_0x5dbf('0xb')](handleError(_0x408b51,null));};exports[_0x5dbf('0x4e')]=function(_0x5331ff,_0x5bb990){return respondWithRpcPromise(_0x5dbf('0x4d'),_0x5331ff[_0x5dbf('0x18')],routingClient)['then'](findById(_0x5331ff[_0x5dbf('0x16')]['id']))[_0x5dbf('0x8')](respondWithResult(_0x5bb990,null))[_0x5dbf('0xb')](handleError(_0x5bb990,null));};exports[_0x5dbf('0x4f')]=function(_0x569d9c,_0x431f08){return respondWithRpcPromise(_0x5dbf('0x50'),_0x569d9c[_0x5dbf('0x18')])[_0x5dbf('0x8')](respondWithResult(_0x431f08,null))[_0x5dbf('0xb')](handleError(_0x431f08,null));};exports['chatQueuesWaitingInteractions']=function(_0x42478c,_0x3fce29){return respondWithRpcPromise(_0x5dbf('0x51'),_0x42478c[_0x5dbf('0x18')],routingClient)['then'](respondWithResult(_0x3fce29,null))[_0x5dbf('0xb')](handleError(_0x3fce29,null));};exports['mailQueuesWaitingInteractions']=function(_0x2ba37f,_0x118e56){return respondWithRpcPromise(_0x5dbf('0x52'),_0x2ba37f['query'],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x118e56,null))[_0x5dbf('0xb')](handleError(_0x118e56,null));};exports[_0x5dbf('0x53')]=function(_0x1270f3,_0x50db0b){return respondWithRpcPromise(_0x5dbf('0x54'),_0x1270f3[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x50db0b,null))[_0x5dbf('0xb')](handleError(_0x50db0b,null));};exports[_0x5dbf('0x55')]=function(_0xf84095,_0x560d62){return respondWithRpcPromise(_0x5dbf('0x54'),_0xf84095[_0x5dbf('0x18')],routingClient)['then'](function(_0x30469c){if(_0xf84095[_0x5dbf('0x18')][_0x5dbf('0x56')]!==undefined){var _0x3457de=_(_0x30469c[_0x5dbf('0x12')])[_0x5dbf('0x57')]([_0xf84095[_0x5dbf('0x18')][_0x5dbf('0x56')],_0xf84095[_0x5dbf('0x16')]['id']])[_0x5dbf('0x58')](_0x5dbf('0x59'))[_0x5dbf('0x5a')]()[_0x5dbf('0x5b')]();return _0x30469c[_0x5dbf('0x12')][_0x5dbf('0x57')](function(_0x37c1a3){return _0x3457de['indexOf'](_0x37c1a3[_0x5dbf('0x59')])>-0x1;});}else{return _0x30469c[_0x5dbf('0x12')][_0x5dbf('0x57')](function(_0x2e7115){return _0x2e7115['queue_id']===parseInt(_0xf84095[_0x5dbf('0x16')]['id']);});}})[_0x5dbf('0x8')](respondWithResult(_0x560d62,null))[_0x5dbf('0xb')](handleError(_0x560d62,null));};exports[_0x5dbf('0x5c')]=function(_0x1ccdae,_0x525930){return respondWithRpcPromise(_0x5dbf('0x5d'),_0x1ccdae[_0x5dbf('0x18')],routingClient)['then'](respondWithResult(_0x525930,null))['catch'](handleError(_0x525930,null));};exports[_0x5dbf('0x5e')]=function(_0x39c0a7,_0x1efe3f){return respondWithRpcPromise(_0x5dbf('0x5f'),_0x39c0a7[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x1efe3f,null))[_0x5dbf('0xb')](handleError(_0x1efe3f,null));};exports['faxQueuesWaitingInteractions']=function(_0x310078,_0x3b01c0){return respondWithRpcPromise(_0x5dbf('0x60'),_0x310078[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x3b01c0,null))[_0x5dbf('0xb')](handleError(_0x3b01c0,null));};exports['queueNotify']=function(_0x625875){return function(_0x2a0c11,_0x43ca42){var _0x2c5a6e,_0x255ab0;var _0x5a27d2=_[_0x5dbf('0x61')](_0x625875);var _0x550bd1=_0x625875==='chat'?'Website':'Account';return db[_0x5a27d2+_0x5dbf('0x62')][_0x5dbf('0x63')]({'raw':!![],'where':{'id':_0x2a0c11[_0x5dbf('0x16')]['id']}})[_0x5dbf('0x8')](function(_0x4333db){if(_['isNil'](_0x4333db)){throw new Error(_0x5a27d2+'\x20Queue\x20not\x20found');}_0x2c5a6e=_0x4333db;return db[_0x5a27d2+_0x5dbf('0x64')]['findOne']({'where':{'id':_0x2a0c11[_0x5dbf('0x1e')][_0x5dbf('0x65')]},'include':[{'model':db[_0x5a27d2+'Interaction'],'as':_0x5dbf('0x66')},{'model':db[_0x5a27d2+_0x550bd1],'as':'Account'}]});})[_0x5dbf('0x8')](function(_0x24d90a){if(_[_0x5dbf('0x11')](_0x24d90a)){throw new Error(_0x5a27d2+_0x5dbf('0x67'));}_0x255ab0=_0x24d90a;return _0x24d90a[_0x5dbf('0x68')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x22b520={'uniqueid':_0x625875+'.'+_0x255ab0['id']+'.'+_0x255ab0[_0x5dbf('0x66')]['id'],'FromUserId':_0x2a0c11[_0x5dbf('0x2b')]['id'],'type':_0x5dbf('0x69')};_0x22b520[_0x5a27d2+'MessageId']=_0x255ab0['id'];_0x22b520[_0x5a27d2+_0x5dbf('0x6a')]=_0x255ab0[_0x5dbf('0x66')]['id'];_0x22b520[_0x5dbf('0x6b')+_0x5a27d2+_0x550bd1+'Id']=_0x255ab0[_0x5dbf('0x6c')]['id'];_0x22b520['To'+_0x5a27d2+_0x5dbf('0x6d')]=_0x2c5a6e['id'];return db[_0x5a27d2+_0x5dbf('0x6e')][_0x5dbf('0x6f')](_0x22b520);})[_0x5dbf('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x625875,'interaction':_0x255ab0['Interaction'],'message':_0x255ab0,'account':_0x255ab0[_0x5dbf('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5dbf('0x69'),'appdata':_0x2c5a6e[_0x5dbf('0xf')]+','+(_0x255ab0['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x5dbf('0x8')](respondWithResult(_0x43ca42,null))[_0x5dbf('0xb')](handleError(_0x43ca42,null));};};exports[_0x5dbf('0x70')]=function(_0x4713b4,_0x12757d){var _0x13fcf5,_0x5ba5bb;if(_[_0x5dbf('0x11')](_0x4713b4[_0x5dbf('0x1e')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x289cc1=_0x4713b4['body']['channel'];var _0x3a27c4=_[_0x5dbf('0x61')](_0x289cc1);var _0x3722b9=_0x289cc1==='chat'?_0x5dbf('0x71'):_0x5dbf('0x6c');return db['User'][_0x5dbf('0x63')]({'raw':!![],'where':{'id':_0x4713b4[_0x5dbf('0x16')]['id'],'role':_0x5dbf('0x34')}})[_0x5dbf('0x8')](function(_0x7957cb){if(_[_0x5dbf('0x11')](_0x7957cb)){throw new Error(_0x5dbf('0x72'));}_0x13fcf5=_0x7957cb;return db[_0x3a27c4+_0x5dbf('0x64')]['findOne']({'where':{'id':_0x4713b4['body']['messageId']},'include':[{'model':db[_0x3a27c4+_0x5dbf('0x66')],'as':_0x5dbf('0x66')},{'model':db[_0x3a27c4+_0x3722b9],'as':_0x5dbf('0x6c')}]});})[_0x5dbf('0x8')](function(_0x400d98){if(_[_0x5dbf('0x11')](_0x400d98)){throw new Error(_0x3a27c4+_0x5dbf('0x67'));}_0x5ba5bb=_0x400d98;return _0x400d98[_0x5dbf('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x5dbf('0x8')](function(){var _0x990814={'uniqueid':_0x289cc1+'.'+_0x5ba5bb['id']+'.'+_0x5ba5bb['Interaction']['id'],'FromUserId':_0x4713b4[_0x5dbf('0x2b')]['id'],'type':_0x5dbf('0x69'),'ToUserId':_0x13fcf5['id']};_0x990814[_0x3a27c4+_0x5dbf('0x73')]=_0x5ba5bb['id'];_0x990814[_0x3a27c4+_0x5dbf('0x6a')]=_0x5ba5bb[_0x5dbf('0x66')]['id'];_0x990814[_0x5dbf('0x6b')+_0x3a27c4+_0x3722b9+'Id']=_0x5ba5bb[_0x5dbf('0x6c')]['id'];return db[_0x3a27c4+_0x5dbf('0x6e')]['create'](_0x990814);})['then'](function(){return respondWithRpcPromise(_0x5dbf('0x74'),{'channel':_0x289cc1,'interaction':_0x5ba5bb['Interaction'],'message':_0x5ba5bb,'account':_0x5ba5bb['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x5dbf('0x34'),'appdata':_0x13fcf5['name']+','+(_0x5ba5bb['Account']['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x5dbf('0x8')](respondWithResult(_0x12757d,null))['catch'](handleError(_0x12757d,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 9da37e7..6e0682b 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 _0xf268=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer'];(function(_0x44706b,_0x4ac533){var _0x1fd34b=function(_0x2042a8){while(--_0x2042a8){_0x44706b['push'](_0x44706b['shift']());}};_0x1fd34b(++_0x4ac533);}(_0xf268,0x71));var _0x8f26=function(_0x294726,_0x5db9e9){_0x294726=_0x294726-0x0;var _0x39e2e3=_0xf268[_0x294726];return _0x39e2e3;};'use strict';var multer=require(_0x8f26('0x0'));var util=require(_0x8f26('0x1'));var path=require(_0x8f26('0x2'));var timeout=require('connect-timeout');var express=require(_0x8f26('0x3'));var router=express[_0x8f26('0x4')]();var fs_extra=require(_0x8f26('0x5'));var auth=require(_0x8f26('0x6'));var interaction=require(_0x8f26('0x7'));var config=require(_0x8f26('0x8'));var controller=require('./schedule.controller');router[_0x8f26('0x9')]('/',auth[_0x8f26('0xa')](),controller[_0x8f26('0xb')]);router[_0x8f26('0x9')](_0x8f26('0xc'),auth['isAuthenticated'](),controller[_0x8f26('0xd')]);router[_0x8f26('0x9')]('/:id/run',auth['isAuthenticated'](),controller['run']);router[_0x8f26('0xe')]('/',auth[_0x8f26('0xa')](),controller[_0x8f26('0xf')]);router[_0x8f26('0x10')]('/:id',auth[_0x8f26('0xa')](),controller['update']);router[_0x8f26('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8f26('0x12')]=router; \ No newline at end of file +var _0x6c65=['exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id/run','create','put','/:id','update','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c65,0xab));var _0x56c6=function(_0xc3f3bd,_0x20b7f5){_0xc3f3bd=_0xc3f3bd-0x0;var _0x27d0bd=_0x6c65[_0xc3f3bd];return _0x27d0bd;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56c6('0x0'));var router=express[_0x56c6('0x1')]();var fs_extra=require(_0x56c6('0x2'));var auth=require(_0x56c6('0x3'));var interaction=require(_0x56c6('0x4'));var config=require(_0x56c6('0x5'));var controller=require(_0x56c6('0x6'));router['get']('/',auth[_0x56c6('0x7')](),controller[_0x56c6('0x8')]);router[_0x56c6('0x9')]('/:id',auth[_0x56c6('0x7')](),controller['show']);router[_0x56c6('0x9')](_0x56c6('0xa'),auth[_0x56c6('0x7')](),controller['run']);router['post']('/',auth[_0x56c6('0x7')](),controller[_0x56c6('0xb')]);router[_0x56c6('0xc')](_0x56c6('0xd'),auth['isAuthenticated'](),controller[_0x56c6('0xe')]);router['delete'](_0x56c6('0xd'),auth[_0x56c6('0x7')](),controller[_0x56c6('0xf')]);module[_0x56c6('0x10')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 46e8c8c..e86d96c 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 _0x3c69=['days','xlsx','csv','custom','default','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x3c69,0xb5));var _0x93c6=function(_0x59820d,_0xc8e6ba){_0x59820d=_0x59820d-0x0;var _0x3c72b1=_0x3c69[_0x59820d];return _0x3c72b1;};'use strict';var Sequelize=require('sequelize');module[_0x93c6('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x93c6('0x1')]},'active':{'type':Sequelize[_0x93c6('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x93c6('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x93c6('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x93c6('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x93c6('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x93c6('0x5')](_0x93c6('0x6'),_0x93c6('0x7'),_0x93c6('0x8'),_0x93c6('0x9'),'days',_0x93c6('0xa'),'minutes'),'allowNull':![],'defaultValue':_0x93c6('0xb')},'output':{'type':Sequelize[_0x93c6('0x5')]('csv','pdf',_0x93c6('0xc')),'allowNull':![],'defaultValue':_0x93c6('0xd')},'type':{'type':Sequelize['ENUM'](_0x93c6('0xe'),_0x93c6('0xf')),'allowNull':![],'defaultValue':_0x93c6('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x93c6('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x93c6('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x64a5=['weeks','days','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','months'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0x64a5,0xd2));var _0x564a=function(_0x506970,_0x2cd1c3){_0x506970=_0x506970-0x0;var _0x1d95b=_0x64a5[_0x506970];return _0x1d95b;};'use strict';var Sequelize=require(_0x564a('0x0'));module[_0x564a('0x1')]={'name':{'type':Sequelize[_0x564a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x564a('0x2')]},'active':{'type':Sequelize[_0x564a('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x564a('0x2')],'allowNull':![],'defaultValue':_0x564a('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x564a('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x564a('0x6')](_0x564a('0x7'),_0x564a('0x8'),_0x564a('0x9'),_0x564a('0xa'),_0x564a('0xb'),_0x564a('0xc'),_0x564a('0xd')),'allowNull':![],'defaultValue':_0x564a('0xb')},'output':{'type':Sequelize['ENUM'](_0x564a('0xe'),_0x564a('0xf'),_0x564a('0x10')),'allowNull':![],'defaultValue':_0x564a('0xe')},'type':{'type':Sequelize[_0x564a('0x6')](_0x564a('0x11'),_0x564a('0x12')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x564a('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x564a('0x2')]},'cc':{'type':Sequelize[_0x564a('0x13')]},'bcc':{'type':Sequelize[_0x564a('0x13')]},'sendIfEmpty':{'type':Sequelize[_0x564a('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 cc929cf..c42425b 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 _0xb02d=['Scheduler','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','undefined','count','set','apply','save','then','destroy','UserProfileResource','sendStatus','name','map','Schedule','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x582bd5,_0x1c99ac){var _0x14ce83=function(_0x45d580){while(--_0x45d580){_0x582bd5['push'](_0x582bd5['shift']());}};_0x14ce83(++_0x1c99ac);}(_0xb02d,0x157));var _0xdb02=function(_0x11ab59,_0x24f9ca){_0x11ab59=_0x11ab59-0x0;var _0x5b0db7=_0xb02d[_0x11ab59];return _0x5b0db7;};'use strict';var emlformat=require(_0xdb02('0x0'));var rimraf=require(_0xdb02('0x1'));var zipdir=require(_0xdb02('0x2'));var jsonpatch=require(_0xdb02('0x3'));var rp=require(_0xdb02('0x4'));var moment=require(_0xdb02('0x5'));var BPromise=require(_0xdb02('0x6'));var Mustache=require(_0xdb02('0x7'));var util=require('util');var path=require('path');var sox=require(_0xdb02('0x8'));var csv=require(_0xdb02('0x9'));var ejs=require(_0xdb02('0xa'));var fs=require('fs');var fs_extra=require(_0xdb02('0xb'));var _=require('lodash');var squel=require(_0xdb02('0xc'));var crypto=require(_0xdb02('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdb02('0xe'));var toCsv=require(_0xdb02('0x9'));var querystring=require('querystring');var Papa=require(_0xdb02('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdb02('0x10'));var as=require(_0xdb02('0x11'));var hardwareService=require(_0xdb02('0x12'));var logger=require('../../config/logger')(_0xdb02('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdb02('0x14'));var db=require(_0xdb02('0x15'))['db'];function respondWithStatusCode(_0x347d02,_0x378eba){_0x378eba=_0x378eba||0xcc;return function(_0x345172){if(_0x345172){return _0x347d02['sendStatus'](_0x378eba);}return _0x347d02[_0xdb02('0x16')](_0x378eba)[_0xdb02('0x17')]();};}function respondWithResult(_0x3d5590,_0x42b003){_0x42b003=_0x42b003||0xc8;return function(_0x5a266c){if(_0x5a266c){return _0x3d5590[_0xdb02('0x16')](_0x42b003)[_0xdb02('0x18')](_0x5a266c);}};}function respondWithFilteredResult(_0x5bf1ff,_0x5d6c34){return function(_0x26a7ae){if(_0x26a7ae){var _0x217d1d=typeof _0x5d6c34['offset']===_0xdb02('0x19')&&typeof _0x5d6c34['limit']===_0xdb02('0x19');var _0x4ad54f=_0x26a7ae[_0xdb02('0x1a')];var _0xcad100=_0x217d1d?0x0:_0x5d6c34['offset'];var _0x28c5f7=_0x217d1d?_0x26a7ae[_0xdb02('0x1a')]:_0x5d6c34['offset']+_0x5d6c34['limit'];var _0x357cae;if(_0x28c5f7>=_0x4ad54f){_0x28c5f7=_0x4ad54f;_0x357cae=0xc8;}else{_0x357cae=0xce;}_0x5bf1ff[_0xdb02('0x16')](_0x357cae);return _0x5bf1ff[_0xdb02('0x1b')]('Content-Range',_0xcad100+'-'+_0x28c5f7+'/'+_0x4ad54f)[_0xdb02('0x18')](_0x26a7ae);}return null;};}function patchUpdates(_0x379084){return function(_0x2c3912){try{jsonpatch[_0xdb02('0x1c')](_0x2c3912,_0x379084,!![]);}catch(_0x169bf7){return BPromise['reject'](_0x169bf7);}return _0x2c3912[_0xdb02('0x1d')]();};}function saveUpdates(_0x9a3b8b,_0x4bb48f){return function(_0x26d728){if(_0x26d728){return _0x26d728['update'](_0x9a3b8b)[_0xdb02('0x1e')](function(_0x5f46ef){return _0x5f46ef;});}return null;};}function removeEntity(_0x473a56,_0x308e43){return function(_0x269c8d){if(_0x269c8d){return _0x269c8d[_0xdb02('0x1f')]()[_0xdb02('0x1e')](function(){var _0x54b633=_0x269c8d['get']({'plain':!![]});var _0x3e7287='Scheduler';return db[_0xdb02('0x20')]['destroy']({'where':{'type':_0x3e7287,'resourceId':_0x54b633['id']}})[_0xdb02('0x1e')](function(){return _0x269c8d;});})['then'](function(){_0x473a56[_0xdb02('0x16')](0xcc)[_0xdb02('0x17')]();});}};}function handleEntityNotFound(_0x3f00e2,_0x3091d8){return function(_0x309730){if(!_0x309730){_0x3f00e2[_0xdb02('0x21')](0x194);}return _0x309730;};}function handleError(_0x235955,_0x2c5e61){_0x2c5e61=_0x2c5e61||0x1f4;return function(_0x496892){logger['error'](_0x496892['stack']);if(_0x496892[_0xdb02('0x22')]){delete _0x496892[_0xdb02('0x22')];}_0x235955['status'](_0x2c5e61)['send'](_0x496892);};}exports['index']=function(_0x40b19b,_0x2cb533){var _0x11e366={},_0x32ad3a={},_0x3e4cb7={'count':0x0,'rows':[]};var _0x130d1a=_[_0xdb02('0x23')](db[_0xdb02('0x24')][_0xdb02('0x25')],function(_0xf8d4df){return{'name':_0xf8d4df[_0xdb02('0x26')],'type':_0xf8d4df['type'][_0xdb02('0x27')]};});_0x32ad3a[_0xdb02('0x28')]=_[_0xdb02('0x23')](_0x130d1a,_0xdb02('0x22'));_0x32ad3a[_0xdb02('0x29')]=_[_0xdb02('0x2a')](_0x40b19b[_0xdb02('0x29')]);_0x32ad3a[_0xdb02('0x2b')]=_[_0xdb02('0x2c')](_0x32ad3a['model'],_0x32ad3a['query']);_0x11e366[_0xdb02('0x2d')]=_[_0xdb02('0x2c')](_0x32ad3a['model'],qs[_0xdb02('0x2e')](_0x40b19b['query'][_0xdb02('0x2e')]));_0x11e366[_0xdb02('0x2d')]=_0x11e366['attributes'][_0xdb02('0x2f')]?_0x11e366[_0xdb02('0x2d')]:_0x32ad3a[_0xdb02('0x28')];if(!_0x40b19b[_0xdb02('0x29')][_0xdb02('0x30')]('nolimit')){_0x11e366[_0xdb02('0x31')]=qs['limit'](_0x40b19b['query']['limit']);_0x11e366[_0xdb02('0x32')]=qs['offset'](_0x40b19b['query'][_0xdb02('0x32')]);}_0x11e366[_0xdb02('0x33')]=qs['sort'](_0x40b19b[_0xdb02('0x29')][_0xdb02('0x34')]);_0x11e366['where']=qs[_0xdb02('0x2b')](_[_0xdb02('0x35')](_0x40b19b['query'],_0x32ad3a[_0xdb02('0x2b')]),_0x130d1a);if(_0x40b19b[_0xdb02('0x29')]['filter']){_0x11e366[_0xdb02('0x36')]=_[_0xdb02('0x37')](_0x11e366[_0xdb02('0x36')],{'$or':_[_0xdb02('0x23')](_0x130d1a,function(_0x52b34a){if(_0x52b34a[_0xdb02('0x38')]!==_0xdb02('0x39')){var _0x5ab0b0={};_0x5ab0b0[_0x52b34a[_0xdb02('0x22')]]={'$like':'%'+_0x40b19b[_0xdb02('0x29')][_0xdb02('0x3a')]+'%'};return _0x5ab0b0;}})});}_0x11e366=_['merge']({},_0x11e366,_0x40b19b[_0xdb02('0x3b')]);var _0x12f2ae={'where':_0x11e366[_0xdb02('0x36')]};return db[_0xdb02('0x24')]['count'](_0x12f2ae)['then'](function(_0x263675){_0x3e4cb7[_0xdb02('0x1a')]=_0x263675;if(_0x40b19b[_0xdb02('0x29')][_0xdb02('0x3c')]){_0x11e366[_0xdb02('0x3d')]=[{'all':!![]}];}return db['Schedule'][_0xdb02('0x3e')](_0x11e366);})[_0xdb02('0x1e')](function(_0x21370d){_0x3e4cb7[_0xdb02('0x3f')]=_0x21370d;return _0x3e4cb7;})[_0xdb02('0x1e')](respondWithFilteredResult(_0x2cb533,_0x11e366))[_0xdb02('0x40')](handleError(_0x2cb533,null));};exports[_0xdb02('0x41')]=function(_0x4c90d2,_0x375875){var _0x52cb6b={'raw':![],'where':{'id':_0x4c90d2['params']['id']}},_0x499c40={};_0x499c40[_0xdb02('0x28')]=_[_0xdb02('0x2a')](db[_0xdb02('0x24')][_0xdb02('0x25')]);_0x499c40[_0xdb02('0x29')]=_['keys'](_0x4c90d2[_0xdb02('0x29')]);_0x499c40[_0xdb02('0x2b')]=_[_0xdb02('0x2c')](_0x499c40[_0xdb02('0x28')],_0x499c40['query']);_0x52cb6b['attributes']=_['intersection'](_0x499c40['model'],qs[_0xdb02('0x2e')](_0x4c90d2['query']['fields']));_0x52cb6b[_0xdb02('0x2d')]=_0x52cb6b['attributes'][_0xdb02('0x2f')]?_0x52cb6b[_0xdb02('0x2d')]:_0x499c40[_0xdb02('0x28')];if(_0x4c90d2[_0xdb02('0x29')][_0xdb02('0x3c')]){_0x52cb6b[_0xdb02('0x3d')]=[{'all':!![]}];}_0x52cb6b=_['merge']({},_0x52cb6b,_0x4c90d2[_0xdb02('0x3b')]);return db['Schedule']['find'](_0x52cb6b)['then'](handleEntityNotFound(_0x375875,null))[_0xdb02('0x1e')](respondWithResult(_0x375875,null))['catch'](handleError(_0x375875,null));};exports[_0xdb02('0x42')]=function(_0x5d272f,_0x5f2e8b){return db[_0xdb02('0x24')]['create'](_0x5d272f[_0xdb02('0x43')],{})['then'](function(_0x495839){var _0x3d0ae9=_0x5d272f[_0xdb02('0x44')][_0xdb02('0x45')]({'plain':!![]});if(!_0x3d0ae9)throw new Error(_0xdb02('0x46'));if(_0x3d0ae9[_0xdb02('0x47')]===_0xdb02('0x44')){var _0x171753=_0x495839[_0xdb02('0x45')]({'plain':!![]});var _0x541093=_0xdb02('0x48');return db[_0xdb02('0x49')][_0xdb02('0x4a')]({'where':{'name':_0x541093,'userProfileId':_0x3d0ae9[_0xdb02('0x4b')]},'raw':!![]})[_0xdb02('0x1e')](function(_0x33d00d){if(_0x33d00d&&_0x33d00d[_0xdb02('0x4c')]===0x0){return db[_0xdb02('0x20')][_0xdb02('0x42')]({'name':_0x171753['name'],'resourceId':_0x171753['id'],'type':_0x33d00d['name'],'sectionId':_0x33d00d['id']},{})[_0xdb02('0x1e')](function(){return _0x495839;});}else{return _0x495839;}})['catch'](function(_0x37d48){logger[_0xdb02('0x4d')](_0xdb02('0x4e'),_0x37d48);throw _0x37d48;});}return _0x495839;})[_0xdb02('0x1e')](respondWithResult(_0x5f2e8b,0xc9))[_0xdb02('0x40')](handleError(_0x5f2e8b,null));};exports[_0xdb02('0x4f')]=function(_0x1156e3,_0x47b03b){if(_0x1156e3['body']['id']){delete _0x1156e3['body']['id'];}return db[_0xdb02('0x24')][_0xdb02('0x4a')]({'where':{'id':_0x1156e3[_0xdb02('0x50')]['id']}})[_0xdb02('0x1e')](handleEntityNotFound(_0x47b03b,null))[_0xdb02('0x1e')](saveUpdates(_0x1156e3[_0xdb02('0x43')],null))['then'](respondWithResult(_0x47b03b,null))[_0xdb02('0x40')](handleError(_0x47b03b,null));};exports[_0xdb02('0x1f')]=function(_0x5553f0,_0x53c520){return db['Schedule'][_0xdb02('0x4a')]({'where':{'id':_0x5553f0['params']['id']}})['then'](handleEntityNotFound(_0x53c520,null))[_0xdb02('0x1e')](removeEntity(_0x53c520,null))[_0xdb02('0x40')](handleError(_0x53c520,null));};exports['run']=function(_0x383387,_0x48e950,_0x476402){var _0x3dcab5=require(_0xdb02('0x51'));return db[_0xdb02('0x24')][_0xdb02('0x4a')]({'where':{'id':_0x383387[_0xdb02('0x50')]['id']},'raw':!![]})[_0xdb02('0x1e')](handleEntityNotFound(_0x48e950,null))[_0xdb02('0x1e')](function(){_0x3dcab5[_0xdb02('0x52')](_0x383387[_0xdb02('0x50')]['id']);})[_0xdb02('0x1e')](respondWithStatusCode(_0x48e950,null))['catch'](handleError(_0x48e950,null));}; \ No newline at end of file +var _0x1a75=['fields','nolimit','limit','order','sort','where','pick','filters','filter','merge','options','includeAll','findAll','rows','catch','show','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','params','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','then','destroy','get','Scheduler','error','name','send','index','map','Schedule','rawAttributes','fieldName','type','keys','query','model','attributes','intersection'];(function(_0x2864ee,_0x39c7e7){var _0x5c7c51=function(_0x2a1a80){while(--_0x2a1a80){_0x2864ee['push'](_0x2864ee['shift']());}};_0x5c7c51(++_0x39c7e7);}(_0x1a75,0x116));var _0x51a7=function(_0x3e3483,_0x3347c6){_0x3e3483=_0x3e3483-0x0;var _0xa2ec22=_0x1a75[_0x3e3483];return _0xa2ec22;};'use strict';var emlformat=require(_0x51a7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x51a7('0x1'));var rp=require(_0x51a7('0x2'));var moment=require(_0x51a7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x51a7('0x4'));var util=require(_0x51a7('0x5'));var path=require('path');var sox=require(_0x51a7('0x6'));var csv=require('to-csv');var ejs=require(_0x51a7('0x7'));var fs=require('fs');var fs_extra=require(_0x51a7('0x8'));var _=require(_0x51a7('0x9'));var squel=require(_0x51a7('0xa'));var crypto=require(_0x51a7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x51a7('0xc'));var querystring=require('querystring');var Papa=require(_0x51a7('0xd'));var Redis=require(_0x51a7('0xe'));var authService=require(_0x51a7('0xf'));var qs=require(_0x51a7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x51a7('0x11'));var logger=require(_0x51a7('0x12'))('api');var utils=require(_0x51a7('0x13'));var config=require(_0x51a7('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x753214,_0x58c3c2){_0x58c3c2=_0x58c3c2||0xcc;return function(_0x464ee0){if(_0x464ee0){return _0x753214[_0x51a7('0x15')](_0x58c3c2);}return _0x753214[_0x51a7('0x16')](_0x58c3c2)[_0x51a7('0x17')]();};}function respondWithResult(_0x13e85a,_0x26f56e){_0x26f56e=_0x26f56e||0xc8;return function(_0x340da5){if(_0x340da5){return _0x13e85a[_0x51a7('0x16')](_0x26f56e)['json'](_0x340da5);}};}function respondWithFilteredResult(_0x195dd1,_0x32f0ed){return function(_0x2d20b1){if(_0x2d20b1){var _0x28bada=typeof _0x32f0ed[_0x51a7('0x18')]===_0x51a7('0x19')&&typeof _0x32f0ed['limit']==='undefined';var _0x2e1b04=_0x2d20b1[_0x51a7('0x1a')];var _0x370457=_0x28bada?0x0:_0x32f0ed['offset'];var _0x3fe39b=_0x28bada?_0x2d20b1['count']:_0x32f0ed[_0x51a7('0x18')]+_0x32f0ed['limit'];var _0xb6d2be;if(_0x3fe39b>=_0x2e1b04){_0x3fe39b=_0x2e1b04;_0xb6d2be=0xc8;}else{_0xb6d2be=0xce;}_0x195dd1[_0x51a7('0x16')](_0xb6d2be);return _0x195dd1['set'](_0x51a7('0x1b'),_0x370457+'-'+_0x3fe39b+'/'+_0x2e1b04)[_0x51a7('0x1c')](_0x2d20b1);}return null;};}function patchUpdates(_0x5ac624){return function(_0x3ca332){try{jsonpatch[_0x51a7('0x1d')](_0x3ca332,_0x5ac624,!![]);}catch(_0x10c27f){return BPromise[_0x51a7('0x1e')](_0x10c27f);}return _0x3ca332[_0x51a7('0x1f')]();};}function saveUpdates(_0x19fc73,_0x53435b){return function(_0x2a32d1){if(_0x2a32d1){return _0x2a32d1['update'](_0x19fc73)[_0x51a7('0x20')](function(_0x4b809f){return _0x4b809f;});}return null;};}function removeEntity(_0x258b19,_0x1cabbc){return function(_0x8cf50e){if(_0x8cf50e){return _0x8cf50e[_0x51a7('0x21')]()[_0x51a7('0x20')](function(){var _0x45ea99=_0x8cf50e[_0x51a7('0x22')]({'plain':!![]});var _0xb94403=_0x51a7('0x23');return db['UserProfileResource'][_0x51a7('0x21')]({'where':{'type':_0xb94403,'resourceId':_0x45ea99['id']}})[_0x51a7('0x20')](function(){return _0x8cf50e;});})['then'](function(){_0x258b19['status'](0xcc)[_0x51a7('0x17')]();});}};}function handleEntityNotFound(_0x3d2573,_0x48b936){return function(_0x540845){if(!_0x540845){_0x3d2573[_0x51a7('0x15')](0x194);}return _0x540845;};}function handleError(_0x521a0b,_0x13f3aa){_0x13f3aa=_0x13f3aa||0x1f4;return function(_0x1a80e){logger[_0x51a7('0x24')](_0x1a80e['stack']);if(_0x1a80e[_0x51a7('0x25')]){delete _0x1a80e[_0x51a7('0x25')];}_0x521a0b['status'](_0x13f3aa)[_0x51a7('0x26')](_0x1a80e);};}exports[_0x51a7('0x27')]=function(_0x480b3c,_0x3c94bd){var _0x5e3f4e={},_0x476a36={},_0x2282cd={'count':0x0,'rows':[]};var _0x5ee728=_[_0x51a7('0x28')](db[_0x51a7('0x29')][_0x51a7('0x2a')],function(_0x56bdd5){return{'name':_0x56bdd5[_0x51a7('0x2b')],'type':_0x56bdd5[_0x51a7('0x2c')]['key']};});_0x476a36['model']=_[_0x51a7('0x28')](_0x5ee728,_0x51a7('0x25'));_0x476a36['query']=_[_0x51a7('0x2d')](_0x480b3c[_0x51a7('0x2e')]);_0x476a36['filters']=_['intersection'](_0x476a36[_0x51a7('0x2f')],_0x476a36['query']);_0x5e3f4e[_0x51a7('0x30')]=_[_0x51a7('0x31')](_0x476a36[_0x51a7('0x2f')],qs[_0x51a7('0x32')](_0x480b3c[_0x51a7('0x2e')][_0x51a7('0x32')]));_0x5e3f4e[_0x51a7('0x30')]=_0x5e3f4e[_0x51a7('0x30')]['length']?_0x5e3f4e[_0x51a7('0x30')]:_0x476a36[_0x51a7('0x2f')];if(!_0x480b3c[_0x51a7('0x2e')]['hasOwnProperty'](_0x51a7('0x33'))){_0x5e3f4e[_0x51a7('0x34')]=qs['limit'](_0x480b3c['query'][_0x51a7('0x34')]);_0x5e3f4e[_0x51a7('0x18')]=qs['offset'](_0x480b3c[_0x51a7('0x2e')][_0x51a7('0x18')]);}_0x5e3f4e[_0x51a7('0x35')]=qs[_0x51a7('0x36')](_0x480b3c[_0x51a7('0x2e')][_0x51a7('0x36')]);_0x5e3f4e[_0x51a7('0x37')]=qs['filters'](_[_0x51a7('0x38')](_0x480b3c[_0x51a7('0x2e')],_0x476a36[_0x51a7('0x39')]),_0x5ee728);if(_0x480b3c['query']['filter']){_0x5e3f4e[_0x51a7('0x37')]=_['merge'](_0x5e3f4e[_0x51a7('0x37')],{'$or':_[_0x51a7('0x28')](_0x5ee728,function(_0x542fe4){if(_0x542fe4[_0x51a7('0x2c')]!=='VIRTUAL'){var _0x3552d3={};_0x3552d3[_0x542fe4['name']]={'$like':'%'+_0x480b3c['query'][_0x51a7('0x3a')]+'%'};return _0x3552d3;}})});}_0x5e3f4e=_[_0x51a7('0x3b')]({},_0x5e3f4e,_0x480b3c[_0x51a7('0x3c')]);var _0x862795={'where':_0x5e3f4e[_0x51a7('0x37')]};return db['Schedule'][_0x51a7('0x1a')](_0x862795)[_0x51a7('0x20')](function(_0x2e8565){_0x2282cd[_0x51a7('0x1a')]=_0x2e8565;if(_0x480b3c[_0x51a7('0x2e')][_0x51a7('0x3d')]){_0x5e3f4e['include']=[{'all':!![]}];}return db[_0x51a7('0x29')][_0x51a7('0x3e')](_0x5e3f4e);})[_0x51a7('0x20')](function(_0x1b4492){_0x2282cd[_0x51a7('0x3f')]=_0x1b4492;return _0x2282cd;})[_0x51a7('0x20')](respondWithFilteredResult(_0x3c94bd,_0x5e3f4e))[_0x51a7('0x40')](handleError(_0x3c94bd,null));};exports[_0x51a7('0x41')]=function(_0x369965,_0x5623f9){var _0x11e9ad={'raw':![],'where':{'id':_0x369965['params']['id']}},_0x3981f2={};_0x3981f2['model']=_['keys'](db[_0x51a7('0x29')]['rawAttributes']);_0x3981f2[_0x51a7('0x2e')]=_[_0x51a7('0x2d')](_0x369965['query']);_0x3981f2[_0x51a7('0x39')]=_['intersection'](_0x3981f2[_0x51a7('0x2f')],_0x3981f2[_0x51a7('0x2e')]);_0x11e9ad[_0x51a7('0x30')]=_[_0x51a7('0x31')](_0x3981f2[_0x51a7('0x2f')],qs[_0x51a7('0x32')](_0x369965['query'][_0x51a7('0x32')]));_0x11e9ad['attributes']=_0x11e9ad[_0x51a7('0x30')][_0x51a7('0x42')]?_0x11e9ad[_0x51a7('0x30')]:_0x3981f2[_0x51a7('0x2f')];if(_0x369965[_0x51a7('0x2e')][_0x51a7('0x3d')]){_0x11e9ad[_0x51a7('0x43')]=[{'all':!![]}];}_0x11e9ad=_['merge']({},_0x11e9ad,_0x369965[_0x51a7('0x3c')]);return db[_0x51a7('0x29')]['find'](_0x11e9ad)[_0x51a7('0x20')](handleEntityNotFound(_0x5623f9,null))[_0x51a7('0x20')](respondWithResult(_0x5623f9,null))[_0x51a7('0x40')](handleError(_0x5623f9,null));};exports[_0x51a7('0x44')]=function(_0x344623,_0x538466){return db[_0x51a7('0x29')][_0x51a7('0x44')](_0x344623[_0x51a7('0x45')],{})[_0x51a7('0x20')](function(_0x385ca5){var _0x56165e=_0x344623[_0x51a7('0x46')]['get']({'plain':!![]});if(!_0x56165e)throw new Error(_0x51a7('0x47'));if(_0x56165e['role']==='user'){var _0x42afff=_0x385ca5[_0x51a7('0x22')]({'plain':!![]});var _0x329425='Scheduler';return db[_0x51a7('0x48')][_0x51a7('0x49')]({'where':{'name':_0x329425,'userProfileId':_0x56165e[_0x51a7('0x4a')]},'raw':!![]})[_0x51a7('0x20')](function(_0x43842f){if(_0x43842f&&_0x43842f[_0x51a7('0x4b')]===0x0){return db[_0x51a7('0x4c')][_0x51a7('0x44')]({'name':_0x42afff[_0x51a7('0x25')],'resourceId':_0x42afff['id'],'type':_0x43842f[_0x51a7('0x25')],'sectionId':_0x43842f['id']},{})[_0x51a7('0x20')](function(){return _0x385ca5;});}else{return _0x385ca5;}})[_0x51a7('0x40')](function(_0x4129f4){logger['error'](_0x51a7('0x4d'),_0x4129f4);throw _0x4129f4;});}return _0x385ca5;})[_0x51a7('0x20')](respondWithResult(_0x538466,0xc9))[_0x51a7('0x40')](handleError(_0x538466,null));};exports[_0x51a7('0x4e')]=function(_0x35e640,_0x1f5d88){if(_0x35e640[_0x51a7('0x45')]['id']){delete _0x35e640[_0x51a7('0x45')]['id'];}return db[_0x51a7('0x29')][_0x51a7('0x49')]({'where':{'id':_0x35e640['params']['id']}})[_0x51a7('0x20')](handleEntityNotFound(_0x1f5d88,null))[_0x51a7('0x20')](saveUpdates(_0x35e640['body'],null))[_0x51a7('0x20')](respondWithResult(_0x1f5d88,null))[_0x51a7('0x40')](handleError(_0x1f5d88,null));};exports[_0x51a7('0x21')]=function(_0x48e8ee,_0x426917){return db[_0x51a7('0x29')]['find']({'where':{'id':_0x48e8ee['params']['id']}})['then'](handleEntityNotFound(_0x426917,null))['then'](removeEntity(_0x426917,null))['catch'](handleError(_0x426917,null));};exports[_0x51a7('0x4f')]=function(_0x327f86,_0x8dfc03,_0x46a815){var _0x51fcbb=require(_0x51a7('0x50'));return db['Schedule'][_0x51a7('0x49')]({'where':{'id':_0x327f86['params']['id']},'raw':!![]})[_0x51a7('0x20')](handleEntityNotFound(_0x8dfc03,null))[_0x51a7('0x20')](function(){_0x51fcbb[_0x51a7('0x4f')](_0x327f86[_0x51a7('0x51')]['id']);})['then'](respondWithStatusCode(_0x8dfc03,null))[_0x51a7('0x40')](handleError(_0x8dfc03,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 639c2a1..a7f5944 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 _0x0594=['tools_schedules','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule'];(function(_0x57c248,_0x32de39){var _0x21ce47=function(_0x51d3bd){while(--_0x51d3bd){_0x57c248['push'](_0x57c248['shift']());}};_0x21ce47(++_0x32de39);}(_0x0594,0x17a));var _0x4059=function(_0x307a49,_0x29a7aa){_0x307a49=_0x307a49-0x0;var _0x287b20=_0x0594[_0x307a49];return _0x287b20;};'use strict';var _=require('lodash');var util=require(_0x4059('0x0'));var logger=require(_0x4059('0x1'))(_0x4059('0x2'));var moment=require(_0x4059('0x3'));var BPromise=require(_0x4059('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4059('0x5'));var rimraf=require(_0x4059('0x6'));var config=require(_0x4059('0x7'));var attributes=require(_0x4059('0x8'));module[_0x4059('0x9')]=function(_0xf3478f,_0x1ef173){return _0xf3478f[_0x4059('0xa')](_0x4059('0xb'),attributes,{'tableName':_0x4059('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd36c=['path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','../../config/logger','bluebird','request-promise'];(function(_0x1846b8,_0x5e9fd2){var _0x5d29ea=function(_0x26ffc3){while(--_0x26ffc3){_0x1846b8['push'](_0x1846b8['shift']());}};_0x5d29ea(++_0x5e9fd2);}(_0xd36c,0x74));var _0xcd36=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0xd36c[_0x179e11];return _0x549f04;};'use strict';var _=require(_0xcd36('0x0'));var util=require('util');var logger=require(_0xcd36('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcd36('0x2'));var rp=require(_0xcd36('0x3'));var fs=require('fs');var path=require(_0xcd36('0x4'));var rimraf=require(_0xcd36('0x5'));var config=require(_0xcd36('0x6'));var attributes=require(_0xcd36('0x7'));module[_0xcd36('0x8')]=function(_0x5c59e5,_0x12f76f){return _0x5c59e5[_0xcd36('0x9')](_0xcd36('0xa'),attributes,{'tableName':_0xcd36('0xb'),'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 49b2863..4f7bb46 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 _0x3595=['catch','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x32ce33,_0x621e48){var _0x5e1b10=function(_0x5e97b6){while(--_0x5e97b6){_0x32ce33['push'](_0x32ce33['shift']());}};_0x5e1b10(++_0x621e48);}(_0x3595,0xc7));var _0x5359=function(_0x4665eb,_0x4e65bd){_0x4665eb=_0x4665eb-0x0;var _0x50f5db=_0x3595[_0x4665eb];return _0x50f5db;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5359('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5359('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x5359('0x2'))(_0x5359('0x3'));var config=require(_0x5359('0x4'));var jayson=require(_0x5359('0x5'));var client=jayson['client'][_0x5359('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3cd29d,_0x1d25cd,_0x226709){return new BPromise(function(_0x291881,_0x4f7630){return client[_0x5359('0x7')](_0x3cd29d,_0x226709)[_0x5359('0x8')](function(_0x288aa4){logger[_0x5359('0x9')](_0x5359('0xa'),_0x1d25cd,_0x5359('0xb'));logger['debug'](_0x5359('0xc'),_0x1d25cd,_0x5359('0xb'),JSON[_0x5359('0xd')](_0x288aa4));if(_0x288aa4[_0x5359('0xe')]){if(_0x288aa4[_0x5359('0xe')]['code']===0x1f4){logger['error'](_0x5359('0xa'),_0x1d25cd,_0x288aa4[_0x5359('0xe')][_0x5359('0xf')]);return _0x4f7630(_0x288aa4[_0x5359('0xe')]['message']);}logger[_0x5359('0xe')](_0x5359('0xa'),_0x1d25cd,_0x288aa4[_0x5359('0xe')][_0x5359('0xf')]);return _0x291881(_0x288aa4['error'][_0x5359('0xf')]);}else{logger[_0x5359('0x9')]('Schedule,\x20%s,\x20%s',_0x1d25cd,_0x5359('0xb'));_0x291881(_0x288aa4[_0x5359('0x10')][_0x5359('0xf')]);}})[_0x5359('0x11')](function(_0xafc264){logger[_0x5359('0xe')]('Schedule,\x20%s,\x20%s',_0x1d25cd,_0xafc264);_0x4f7630(_0xafc264);});});} \ No newline at end of file +var _0x2d41=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x362a9c,_0x434fd5){var _0x159079=function(_0x4e5a3c){while(--_0x4e5a3c){_0x362a9c['push'](_0x362a9c['shift']());}};_0x159079(++_0x434fd5);}(_0x2d41,0x142));var _0x12d4=function(_0x1e97b5,_0x183786){_0x1e97b5=_0x1e97b5-0x0;var _0x3116be=_0x2d41[_0x1e97b5];return _0x3116be;};'use strict';var _=require(_0x12d4('0x0'));var util=require(_0x12d4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x12d4('0x2'));var fs=require('fs');var Redis=require(_0x12d4('0x3'));var db=require(_0x12d4('0x4'))['db'];var utils=require(_0x12d4('0x5'));var logger=require('../../config/logger')(_0x12d4('0x6'));var config=require(_0x12d4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x12d4('0x8')][_0x12d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43e0cc,_0x23682d,_0x6f8d0d){return new BPromise(function(_0x144c8f,_0x1495f1){return client[_0x12d4('0xa')](_0x43e0cc,_0x6f8d0d)[_0x12d4('0xb')](function(_0x195caa){logger[_0x12d4('0xc')](_0x12d4('0xd'),_0x23682d,_0x12d4('0xe'));logger[_0x12d4('0xf')](_0x12d4('0x10'),_0x23682d,_0x12d4('0xe'),JSON[_0x12d4('0x11')](_0x195caa));if(_0x195caa[_0x12d4('0x12')]){if(_0x195caa[_0x12d4('0x12')][_0x12d4('0x13')]===0x1f4){logger[_0x12d4('0x12')]('Schedule,\x20%s,\x20%s',_0x23682d,_0x195caa[_0x12d4('0x12')][_0x12d4('0x14')]);return _0x1495f1(_0x195caa[_0x12d4('0x12')]['message']);}logger[_0x12d4('0x12')]('Schedule,\x20%s,\x20%s',_0x23682d,_0x195caa['error']['message']);return _0x144c8f(_0x195caa[_0x12d4('0x12')]['message']);}else{logger['info'](_0x12d4('0xd'),_0x23682d,_0x12d4('0xe'));_0x144c8f(_0x195caa[_0x12d4('0x15')]['message']);}})[_0x12d4('0x16')](function(_0x3d9f82){logger[_0x12d4('0x12')](_0x12d4('0xd'),_0x23682d,_0x3d9f82);_0x1495f1(_0x3d9f82);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 53e07be..2d19597 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 _0x8725=['/describe','describe','/:id','show','/:id/download','post','create','put','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8725,0x15e));var _0x5872=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0x8725[_0x413727];return _0x5f46d7;};'use strict';var multer=require(_0x5872('0x0'));var util=require(_0x5872('0x1'));var path=require('path');var timeout=require(_0x5872('0x2'));var express=require(_0x5872('0x3'));var router=express['Router']();var fs_extra=require(_0x5872('0x4'));var auth=require(_0x5872('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5872('0x6'));var controller=require('./screenRecording.controller');router[_0x5872('0x7')]('/',auth[_0x5872('0x8')](),controller[_0x5872('0x9')]);router[_0x5872('0x7')](_0x5872('0xa'),auth[_0x5872('0x8')](),controller[_0x5872('0xb')]);router['get'](_0x5872('0xc'),auth['isAuthenticated'](),controller[_0x5872('0xd')]);router[_0x5872('0x7')](_0x5872('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x5872('0xf')]('/',auth['isAuthenticated'](),controller[_0x5872('0x10')]);router[_0x5872('0x11')]('/:id',auth[_0x5872('0x8')](),controller['update']);router[_0x5872('0x12')](_0x5872('0xc'),auth[_0x5872('0x8')](),controller[_0x5872('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc513=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','post','create','update','delete','destroy','exports','multer','path','express'];(function(_0x134d2f,_0x302b2e){var _0x590077=function(_0x2f22e8){while(--_0x2f22e8){_0x134d2f['push'](_0x134d2f['shift']());}};_0x590077(++_0x302b2e);}(_0xc513,0x123));var _0x3c51=function(_0x11aeb3,_0x433117){_0x11aeb3=_0x11aeb3-0x0;var _0x20801a=_0xc513[_0x11aeb3];return _0x20801a;};'use strict';var multer=require(_0x3c51('0x0'));var util=require('util');var path=require(_0x3c51('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c51('0x2'));var router=express[_0x3c51('0x3')]();var fs_extra=require(_0x3c51('0x4'));var auth=require(_0x3c51('0x5'));var interaction=require(_0x3c51('0x6'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0x3c51('0x7')]('/',auth[_0x3c51('0x8')](),controller[_0x3c51('0x9')]);router[_0x3c51('0x7')](_0x3c51('0xa'),auth[_0x3c51('0x8')](),controller['describe']);router[_0x3c51('0x7')](_0x3c51('0xb'),auth[_0x3c51('0x8')](),controller[_0x3c51('0xc')]);router[_0x3c51('0x7')](_0x3c51('0xd'),auth[_0x3c51('0x8')](),controller[_0x3c51('0xe')]);router[_0x3c51('0xf')]('/',auth[_0x3c51('0x8')](),controller[_0x3c51('0x10')]);router['put'](_0x3c51('0xb'),auth[_0x3c51('0x8')](),controller[_0x3c51('0x11')]);router[_0x3c51('0x12')](_0x3c51('0xb'),auth[_0x3c51('0x8')](),controller[_0x3c51('0x13')]);module[_0x3c51('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 3d01d80..2c0efdd 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 _0x2b29=['value','extname','STRING','replace','INTEGER','startedAt','subtract','setDataValue','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','path','../../config/environment','exports','getDataValue'];(function(_0x1e972d,_0x281d23){var _0x37d0d1=function(_0x319715){while(--_0x319715){_0x1e972d['push'](_0x1e972d['shift']());}};_0x37d0d1(++_0x281d23);}(_0x2b29,0x163));var _0x92b2=function(_0xe07082,_0x3508ef){_0xe07082=_0xe07082-0x0;var _0x1f642b=_0x2b29[_0xe07082];return _0x1f642b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x92b2('0x0'));var path=require(_0x92b2('0x1'));var config=require(_0x92b2('0x2'));module[_0x92b2('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x92b2('0x4')](_0x92b2('0x5'))?path[_0x92b2('0x6')](this[_0x92b2('0x4')](_0x92b2('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x92b2('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x92b2('0x7')],'set':function(_0x536e21){var _0x29f183=_0x536e21[_0x92b2('0x8')](/\\/g,'/');this['setDataValue'](_0x92b2('0x5'),_0x29f183);}},'rating':{'type':Sequelize[_0x92b2('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x92b2('0x9')],'set':function(_0x465011){this['setDataValue'](_0x92b2('0xa'),moment()[_0x92b2('0xb')](_0x465011,'ms'));this[_0x92b2('0xc')](_0x92b2('0xd'),moment());this[_0x92b2('0xc')](_0x92b2('0xe'),_0x465011);}},'startedAt':{'type':Sequelize[_0x92b2('0xf')],'get':function(){return moment(this['getDataValue'](_0x92b2('0xa')))[_0x92b2('0x10')](_0x92b2('0x11'))['toString']();}},'closedAt':{'type':Sequelize[_0x92b2('0xf')],'get':function(){return moment(this[_0x92b2('0x4')](_0x92b2('0xd')))[_0x92b2('0x10')](_0x92b2('0x11'))[_0x92b2('0x12')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x92b2('0x4')]('createdAt'))[_0x92b2('0x10')](_0x92b2('0x11'))[_0x92b2('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x92b2('0x13')))['format'](_0x92b2('0x11'))['toString']();}}}; \ No newline at end of file +var _0xa5c9=['moment','path','../../config/environment','getDataValue','value','STRING','replace','INTEGER','setDataValue','startedAt','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize'];(function(_0x2541c1,_0xf84bd0){var _0x30771c=function(_0x213721){while(--_0x213721){_0x2541c1['push'](_0x2541c1['shift']());}};_0x30771c(++_0xf84bd0);}(_0xa5c9,0x143));var _0x9a5c=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0xa5c9[_0x4ed4d2];return _0x15ae2e;};'use strict';var Sequelize=require(_0x9a5c('0x0'));var moment=require(_0x9a5c('0x1'));var path=require(_0x9a5c('0x2'));var config=require(_0x9a5c('0x3'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9a5c('0x4')](_0x9a5c('0x5'))?path['extname'](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0x9a5c('0x6')]},'channel':{'type':Sequelize[_0x9a5c('0x6')]},'value':{'type':Sequelize[_0x9a5c('0x6')],'set':function(_0x3bb6f2){var _0x594e67=_0x3bb6f2[_0x9a5c('0x7')](/\\/g,'/');this['setDataValue'](_0x9a5c('0x5'),_0x594e67);}},'rating':{'type':Sequelize[_0x9a5c('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x127932){this[_0x9a5c('0x9')](_0x9a5c('0xa'),moment()['subtract'](_0x127932,'ms'));this['setDataValue'](_0x9a5c('0xb'),moment());this[_0x9a5c('0x9')](_0x9a5c('0xc'),_0x127932);}},'startedAt':{'type':Sequelize[_0x9a5c('0xd')],'get':function(){return moment(this[_0x9a5c('0x4')](_0x9a5c('0xa')))[_0x9a5c('0xe')](_0x9a5c('0xf'))[_0x9a5c('0x10')]();}},'closedAt':{'type':Sequelize[_0x9a5c('0xd')],'get':function(){return moment(this[_0x9a5c('0x4')](_0x9a5c('0xb')))['format'](_0x9a5c('0xf'))[_0x9a5c('0x10')]();}},'createdAt':{'type':Sequelize[_0x9a5c('0xd')],'get':function(){return moment(this['getDataValue'](_0x9a5c('0x11')))[_0x9a5c('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x9a5c('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x9a5c('0x4')]('updatedAt'))[_0x9a5c('0xe')](_0x9a5c('0xf'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index fc700c7..2fe178f 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 _0x038b=['offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','root','%s.cypher','decryptFile','secrets','recording','join','server/files/screen_recordings','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','download','unlink','message','send','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x1fc5cf,_0x26aa34){var _0x426f91=function(_0x3e5bea){while(--_0x3e5bea){_0x1fc5cf['push'](_0x1fc5cf['shift']());}};_0x426f91(++_0x26aa34);}(_0x038b,0x114));var _0xb038=function(_0x3d0058,_0x7985d5){_0x3d0058=_0x3d0058-0x0;var _0x183bbd=_0x038b[_0x3d0058];return _0x183bbd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb038('0x0'));var zipdir=require(_0xb038('0x1'));var jsonpatch=require(_0xb038('0x2'));var rp=require('request-promise');var moment=require(_0xb038('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb038('0x4'));var util=require(_0xb038('0x5'));var path=require('path');var sox=require(_0xb038('0x6'));var csv=require(_0xb038('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb038('0x8'));var squel=require(_0xb038('0x9'));var crypto=require(_0xb038('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb038('0x7'));var querystring=require(_0xb038('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb038('0xc'));var qs=require(_0xb038('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb038('0xe'));var logger=require(_0xb038('0xf'))(_0xb038('0x10'));var utils=require(_0xb038('0x11'));var config=require(_0xb038('0x12'));var licenseUtil=require(_0xb038('0x13'));var db=require(_0xb038('0x14'))['db'];function respondWithStatusCode(_0x439751,_0x16e4a3){_0x16e4a3=_0x16e4a3||0xcc;return function(_0x57acd8){if(_0x57acd8){return _0x439751[_0xb038('0x15')](_0x16e4a3);}return _0x439751[_0xb038('0x16')](_0x16e4a3)[_0xb038('0x17')]();};}function respondWithResult(_0x3cc717,_0x3a71a6){_0x3a71a6=_0x3a71a6||0xc8;return function(_0x13acc7){if(_0x13acc7){return _0x3cc717[_0xb038('0x16')](_0x3a71a6)['json'](_0x13acc7);}};}function respondWithFilteredResult(_0xe8aa7c,_0x26e4f2){return function(_0x183141){if(_0x183141){var _0x39323e=typeof _0x26e4f2[_0xb038('0x18')]===_0xb038('0x19')&&typeof _0x26e4f2['limit']===_0xb038('0x19');var _0x3039b0=_0x183141[_0xb038('0x1a')];var _0x3b095a=_0x39323e?0x0:_0x26e4f2['offset'];var _0x49b237=_0x39323e?_0x183141[_0xb038('0x1a')]:_0x26e4f2[_0xb038('0x18')]+_0x26e4f2[_0xb038('0x1b')];var _0x31c348;if(_0x49b237>=_0x3039b0){_0x49b237=_0x3039b0;_0x31c348=0xc8;}else{_0x31c348=0xce;}_0xe8aa7c['status'](_0x31c348);return _0xe8aa7c[_0xb038('0x1c')](_0xb038('0x1d'),_0x3b095a+'-'+_0x49b237+'/'+_0x3039b0)[_0xb038('0x1e')](_0x183141);}return null;};}function patchUpdates(_0x33a377){return function(_0xc6cd61){try{jsonpatch['apply'](_0xc6cd61,_0x33a377,!![]);}catch(_0x2e0369){return BPromise[_0xb038('0x1f')](_0x2e0369);}return _0xc6cd61[_0xb038('0x20')]();};}function saveUpdates(_0x87b899,_0x5f123d){return function(_0x2812c9){if(_0x2812c9){return _0x2812c9[_0xb038('0x21')](_0x87b899)['then'](function(_0x1eb9cd){return _0x1eb9cd;});}return null;};}function removeEntity(_0x43d403,_0x573f93){return function(_0x241329){if(_0x241329){return _0x241329['destroy']()[_0xb038('0x22')](function(){_0x43d403[_0xb038('0x16')](0xcc)[_0xb038('0x17')]();});}};}function handleEntityNotFound(_0x1df7c4,_0x5d4343){return function(_0xe4ceda){if(!_0xe4ceda){_0x1df7c4[_0xb038('0x15')](0x194);}return _0xe4ceda;};}function handleError(_0x576be5,_0xb6d93f){_0xb6d93f=_0xb6d93f||0x1f4;return function(_0x33cf3c){logger[_0xb038('0x23')](_0x33cf3c['stack']);if(_0x33cf3c[_0xb038('0x24')]){delete _0x33cf3c[_0xb038('0x24')];}_0x576be5[_0xb038('0x16')](_0xb6d93f)['send'](_0x33cf3c);};}exports[_0xb038('0x25')]=function(_0x2855a6,_0x28a6a9){var _0x12b3b6={},_0xc387d={},_0x551b55={'count':0x0,'rows':[]};var _0x1783d4=_[_0xb038('0x26')](db[_0xb038('0x27')][_0xb038('0x28')],function(_0x1abe23){return{'name':_0x1abe23[_0xb038('0x29')],'type':_0x1abe23[_0xb038('0x2a')][_0xb038('0x2b')]};});_0xc387d[_0xb038('0x2c')]=_[_0xb038('0x2d')](_[_0xb038('0x26')](_0x1783d4,_0xb038('0x24')),[_0xb038('0x2e')]);_0xc387d['query']=_[_0xb038('0x2f')](_0x2855a6['query']);_0xc387d[_0xb038('0x30')]=_[_0xb038('0x31')](_0xc387d[_0xb038('0x2c')],_0xc387d[_0xb038('0x32')]);_0x12b3b6[_0xb038('0x33')]=_[_0xb038('0x31')](_0xc387d[_0xb038('0x2c')],qs[_0xb038('0x34')](_0x2855a6[_0xb038('0x32')][_0xb038('0x34')]));_0x12b3b6['attributes']=_0x12b3b6[_0xb038('0x33')][_0xb038('0x35')]?_0x12b3b6[_0xb038('0x33')]:_0xc387d['model'];if(!_0x2855a6['query']['hasOwnProperty'](_0xb038('0x36'))){_0x12b3b6[_0xb038('0x1b')]=qs[_0xb038('0x1b')](_0x2855a6[_0xb038('0x32')][_0xb038('0x1b')]);_0x12b3b6[_0xb038('0x18')]=qs['offset'](_0x2855a6[_0xb038('0x32')][_0xb038('0x18')]);}_0x12b3b6[_0xb038('0x37')]=qs[_0xb038('0x38')](_0x2855a6['query'][_0xb038('0x38')]);_0x12b3b6[_0xb038('0x39')]=qs['filters'](_['pick'](_0x2855a6[_0xb038('0x32')],_0xc387d[_0xb038('0x30')]),_0x1783d4);if(_0x2855a6[_0xb038('0x32')][_0xb038('0x3a')]){_0x12b3b6[_0xb038('0x39')]=_['merge'](_0x12b3b6[_0xb038('0x39')],{'$or':_[_0xb038('0x26')](_0x1783d4,function(_0x26d48c){if(_0x26d48c[_0xb038('0x2a')]!=='VIRTUAL'){var _0x793da9={};_0x793da9[_0x26d48c[_0xb038('0x24')]]={'$like':'%'+_0x2855a6[_0xb038('0x32')]['filter']+'%'};return _0x793da9;}})});}_0x12b3b6=_[_0xb038('0x3b')]({},_0x12b3b6,_0x2855a6['options']);var _0x36f281={'where':_0x12b3b6[_0xb038('0x39')]};return db[_0xb038('0x27')]['count'](_0x36f281)[_0xb038('0x22')](function(_0x357c78){_0x551b55[_0xb038('0x1a')]=_0x357c78;if(_0x2855a6['query'][_0xb038('0x3c')]){_0x12b3b6[_0xb038('0x3d')]=[{'all':!![]}];}return db[_0xb038('0x27')][_0xb038('0x3e')](_0x12b3b6);})['then'](function(_0x28b922){_0x551b55[_0xb038('0x3f')]=_0x28b922;return _0x551b55;})[_0xb038('0x22')](respondWithFilteredResult(_0x28a6a9,_0x12b3b6))[_0xb038('0x40')](handleError(_0x28a6a9,null));};exports['show']=function(_0x19dc7b,_0x269c7d){var _0x57816c={'raw':![],'where':{'id':_0x19dc7b[_0xb038('0x41')]['id']}},_0x207fb5={};_0x207fb5[_0xb038('0x2c')]=_['keys'](db[_0xb038('0x27')][_0xb038('0x28')]);_0x207fb5['query']=_['keys'](_0x19dc7b[_0xb038('0x32')]);_0x207fb5[_0xb038('0x30')]=_[_0xb038('0x31')](_0x207fb5[_0xb038('0x2c')],_0x207fb5[_0xb038('0x32')]);_0x57816c[_0xb038('0x33')]=_[_0xb038('0x31')](_0x207fb5[_0xb038('0x2c')],qs['fields'](_0x19dc7b['query']['fields']));_0x57816c[_0xb038('0x33')]=_0x57816c[_0xb038('0x33')]['length']?_0x57816c[_0xb038('0x33')]:_0x207fb5[_0xb038('0x2c')];if(_0x19dc7b[_0xb038('0x32')]['includeAll']){_0x57816c[_0xb038('0x3d')]=[{'all':!![]}];}_0x57816c=_['merge']({},_0x57816c,_0x19dc7b['options']);return db[_0xb038('0x27')][_0xb038('0x42')](_0x57816c)[_0xb038('0x22')](handleEntityNotFound(_0x269c7d,null))[_0xb038('0x22')](respondWithResult(_0x269c7d,null))[_0xb038('0x40')](handleError(_0x269c7d,null));};exports[_0xb038('0x43')]=function(_0x2f053a,_0x473aae){return db[_0xb038('0x27')][_0xb038('0x43')](_0x2f053a['body'],{})[_0xb038('0x22')](respondWithResult(_0x473aae,0xc9))[_0xb038('0x40')](handleError(_0x473aae,null));};exports['update']=function(_0x906c9c,_0x19ab72){if(_0x906c9c['body']['id']){delete _0x906c9c[_0xb038('0x44')]['id'];}delete _0x906c9c[_0xb038('0x44')][_0xb038('0x45')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x46')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x47')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x48')];return db['ScreenRecording'][_0xb038('0x42')]({'where':{'id':_0x906c9c[_0xb038('0x41')]['id']}})[_0xb038('0x22')](handleEntityNotFound(_0x19ab72,null))[_0xb038('0x22')](saveUpdates(_0x906c9c[_0xb038('0x44')],null))[_0xb038('0x22')](respondWithResult(_0x19ab72,null))['catch'](handleError(_0x19ab72,null));};exports[_0xb038('0x49')]=function(_0x2f3622,_0x2b2b4d){return db[_0xb038('0x27')][_0xb038('0x49')]()[_0xb038('0x22')](respondWithResult(_0x2b2b4d,null))[_0xb038('0x40')](handleError(_0x2b2b4d,null));};exports['download']=function(_0x3abe7a,_0x5c4a79,_0x77f211){var _0x1ea8ad=require(_0xb038('0x4a'));var _0x998fe3=![];var _0x1518c4={};if(_0x3abe7a['query']['type']&&_0x3abe7a['query'][_0xb038('0x2a')]===_0xb038('0x4b')){_0x1518c4[_0xb038('0x4b')]=_0x3abe7a[_0xb038('0x41')]['id'];}else{_0x1518c4['id']=_0x3abe7a[_0xb038('0x41')]['id'];}return db[_0xb038('0x27')]['find']({'where':_0x1518c4,'attributes':['id',_0xb038('0x48')],'raw':!![]})[_0xb038('0x22')](handleEntityNotFound(_0x5c4a79,null))['then'](function(_0x5b27d3){if(_0x5b27d3){var _0xf2907b=path['join'](config[_0xb038('0x4c')],'server/files/screen_recordings',_0x5b27d3[_0xb038('0x48')]);var _0x4677b8=util[_0xb038('0x2e')](_0xb038('0x4d'),_0xf2907b);if(fs['existsSync'](_0x4677b8)){_0x998fe3=!![];return _0x1ea8ad[_0xb038('0x4e')](_0x4677b8,_0xf2907b,config[_0xb038('0x4f')][_0xb038('0x50')])[_0xb038('0x22')](function(){return _0x5b27d3;});}return _0x5b27d3;}})[_0xb038('0x22')](function(_0x1246c8){if(_0x1246c8){var _0x14a553=path[_0xb038('0x51')](config[_0xb038('0x4c')],_0xb038('0x52'),_0x1246c8[_0xb038('0x48')]);if(!fs[_0xb038('0x53')](_0x14a553)){throw new db['Sequelize'][(_0xb038('0x54'))](_0xb038('0x55'));}if(_0x1246c8[_0xb038('0x56')]){return _0x5c4a79[_0xb038('0x57')](_0x14a553,_0x1246c8[_0xb038('0x56')]+path['extname'](_0x14a553),function(){if(_0x998fe3){fs[_0xb038('0x58')](_0x14a553);}});}else{return _0x5c4a79['download'](_0x14a553,function(_0xfb3ce6){if(_0x998fe3){fs[_0xb038('0x58')](_0x14a553);}});}}})['catch'](function(_0x15d61c){if(_0x15d61c[_0xb038('0x59')]===_0xb038('0x55')){_0x5c4a79[_0xb038('0x16')](0x194)[_0xb038('0x5a')](_0xb038('0x5b'));}else{return handleError(_0x5c4a79,null);}});};exports[_0xb038('0x5c')]=function(_0xe275b8,_0x769f1e){return db[_0xb038('0x27')]['find']({'where':{'id':_0xe275b8[_0xb038('0x41')]['id']}})['then'](function(_0x189894){if(_[_0xb038('0x5d')](_0x189894)){throw new ReferenceError(_0xb038('0x5e'));}return _0x189894;})[_0xb038('0x22')](function(_0x1f5f3f){var _0x23fb92=path[_0xb038('0x51')](config['root'],'server/files/screen_recordings',_0x1f5f3f[_0xb038('0x48')]);logger[_0xb038('0x5f')](_0xb038('0x60'),_0x23fb92);if(!_['isNil'](_0x1f5f3f['value'])&&fs[_0xb038('0x53')](_0x23fb92)){logger['info'](_0xb038('0x61')+_0x23fb92+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb038('0x62')](_0x23fb92);}_0x23fb92=_0x23fb92+'.cypher';if(!_[_0xb038('0x5d')](_0x1f5f3f[_0xb038('0x48')])&&fs[_0xb038('0x53')](_0x23fb92)){logger[_0xb038('0x5f')](_0xb038('0x61')+_0x23fb92+_0xb038('0x63'));fs['unlinkSync'](_0x23fb92);}return _0x1f5f3f;})['then'](function(_0x45e628){if(!_0x45e628)throw new InternalError();return _0x45e628['destroy']();})[_0xb038('0x22')](function(){_0x769f1e[_0xb038('0x16')](0xcc)[_0xb038('0x17')]();})['catch'](handleError(_0x769f1e,null));}; \ No newline at end of file +var _0xd0bb=['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','ScreenRecording','fieldName','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x33ac6b,_0x1ed895){_0x33ac6b=_0x33ac6b-0x0;var _0x34cffe=_0xd0bb[_0x33ac6b];return _0x34cffe;};'use strict';var emlformat=require(_0xbd0b('0x0'));var rimraf=require(_0xbd0b('0x1'));var zipdir=require(_0xbd0b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd0b('0x3'));var moment=require('moment');var BPromise=require(_0xbd0b('0x4'));var Mustache=require(_0xbd0b('0x5'));var util=require('util');var path=require(_0xbd0b('0x6'));var sox=require('sox');var csv=require(_0xbd0b('0x7'));var ejs=require(_0xbd0b('0x8'));var fs=require('fs');var fs_extra=require(_0xbd0b('0x9'));var _=require(_0xbd0b('0xa'));var squel=require(_0xbd0b('0xb'));var crypto=require('crypto');var jsforce=require(_0xbd0b('0xc'));var deskjs=require(_0xbd0b('0xd'));var toCsv=require(_0xbd0b('0x7'));var querystring=require(_0xbd0b('0xe'));var Papa=require(_0xbd0b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd0b('0x10'));var as=require(_0xbd0b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd0b('0x12'))(_0xbd0b('0x13'));var utils=require('../../config/utils');var config=require(_0xbd0b('0x14'));var licenseUtil=require(_0xbd0b('0x15'));var db=require(_0xbd0b('0x16'))['db'];function respondWithStatusCode(_0x315ed9,_0x2621bf){_0x2621bf=_0x2621bf||0xcc;return function(_0x42a96b){if(_0x42a96b){return _0x315ed9[_0xbd0b('0x17')](_0x2621bf);}return _0x315ed9[_0xbd0b('0x18')](_0x2621bf)[_0xbd0b('0x19')]();};}function respondWithResult(_0x1c10c1,_0x2d4664){_0x2d4664=_0x2d4664||0xc8;return function(_0x57077a){if(_0x57077a){return _0x1c10c1[_0xbd0b('0x18')](_0x2d4664)['json'](_0x57077a);}};}function respondWithFilteredResult(_0x4a8014,_0x36d1ca){return function(_0x4c0e52){if(_0x4c0e52){var _0x3183cf=typeof _0x36d1ca[_0xbd0b('0x1a')]===_0xbd0b('0x1b')&&typeof _0x36d1ca['limit']==='undefined';var _0x2136ef=_0x4c0e52[_0xbd0b('0x1c')];var _0x1f2a6e=_0x3183cf?0x0:_0x36d1ca[_0xbd0b('0x1a')];var _0x1c0a7c=_0x3183cf?_0x4c0e52[_0xbd0b('0x1c')]:_0x36d1ca['offset']+_0x36d1ca[_0xbd0b('0x1d')];var _0x49499f;if(_0x1c0a7c>=_0x2136ef){_0x1c0a7c=_0x2136ef;_0x49499f=0xc8;}else{_0x49499f=0xce;}_0x4a8014[_0xbd0b('0x18')](_0x49499f);return _0x4a8014[_0xbd0b('0x1e')](_0xbd0b('0x1f'),_0x1f2a6e+'-'+_0x1c0a7c+'/'+_0x2136ef)[_0xbd0b('0x20')](_0x4c0e52);}return null;};}function patchUpdates(_0x4b312d){return function(_0x403c91){try{jsonpatch[_0xbd0b('0x21')](_0x403c91,_0x4b312d,!![]);}catch(_0x40b021){return BPromise['reject'](_0x40b021);}return _0x403c91[_0xbd0b('0x22')]();};}function saveUpdates(_0x560db4,_0xc66b8){return function(_0x3c4938){if(_0x3c4938){return _0x3c4938[_0xbd0b('0x23')](_0x560db4)[_0xbd0b('0x24')](function(_0x297c85){return _0x297c85;});}return null;};}function removeEntity(_0x539359,_0x75909f){return function(_0x58a721){if(_0x58a721){return _0x58a721[_0xbd0b('0x25')]()[_0xbd0b('0x24')](function(){_0x539359[_0xbd0b('0x18')](0xcc)[_0xbd0b('0x19')]();});}};}function handleEntityNotFound(_0xfd9f82,_0xb06342){return function(_0x4fe9ed){if(!_0x4fe9ed){_0xfd9f82[_0xbd0b('0x17')](0x194);}return _0x4fe9ed;};}function handleError(_0x1b46a3,_0x33b752){_0x33b752=_0x33b752||0x1f4;return function(_0x1b5a00){logger[_0xbd0b('0x26')](_0x1b5a00[_0xbd0b('0x27')]);if(_0x1b5a00['name']){delete _0x1b5a00[_0xbd0b('0x28')];}_0x1b46a3[_0xbd0b('0x18')](_0x33b752)[_0xbd0b('0x29')](_0x1b5a00);};}exports['index']=function(_0x4dfe76,_0x2187a5){var _0x684b09={},_0x14e5a3={},_0xf4ba04={'count':0x0,'rows':[]};var _0x4e2149=_[_0xbd0b('0x2a')](db[_0xbd0b('0x2b')]['rawAttributes'],function(_0x45f7d6){return{'name':_0x45f7d6[_0xbd0b('0x2c')],'type':_0x45f7d6['type']['key']};});_0x14e5a3[_0xbd0b('0x2d')]=_[_0xbd0b('0x2e')](_['map'](_0x4e2149,_0xbd0b('0x28')),[_0xbd0b('0x2f')]);_0x14e5a3[_0xbd0b('0x30')]=_[_0xbd0b('0x31')](_0x4dfe76[_0xbd0b('0x30')]);_0x14e5a3[_0xbd0b('0x32')]=_['intersection'](_0x14e5a3[_0xbd0b('0x2d')],_0x14e5a3[_0xbd0b('0x30')]);_0x684b09[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0x14e5a3[_0xbd0b('0x2d')],qs[_0xbd0b('0x35')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x35')]));_0x684b09[_0xbd0b('0x33')]=_0x684b09[_0xbd0b('0x33')][_0xbd0b('0x36')]?_0x684b09[_0xbd0b('0x33')]:_0x14e5a3[_0xbd0b('0x2d')];if(!_0x4dfe76[_0xbd0b('0x30')]['hasOwnProperty'](_0xbd0b('0x37'))){_0x684b09[_0xbd0b('0x1d')]=qs['limit'](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x1d')]);_0x684b09[_0xbd0b('0x1a')]=qs[_0xbd0b('0x1a')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x1a')]);}_0x684b09['order']=qs[_0xbd0b('0x38')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x38')]);_0x684b09[_0xbd0b('0x39')]=qs[_0xbd0b('0x32')](_['pick'](_0x4dfe76['query'],_0x14e5a3[_0xbd0b('0x32')]),_0x4e2149);if(_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3a')]){_0x684b09[_0xbd0b('0x39')]=_['merge'](_0x684b09['where'],{'$or':_[_0xbd0b('0x2a')](_0x4e2149,function(_0x4d8237){if(_0x4d8237[_0xbd0b('0x3b')]!==_0xbd0b('0x3c')){var _0x3f34dc={};_0x3f34dc[_0x4d8237[_0xbd0b('0x28')]]={'$like':'%'+_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3a')]+'%'};return _0x3f34dc;}})});}_0x684b09=_[_0xbd0b('0x3d')]({},_0x684b09,_0x4dfe76[_0xbd0b('0x3e')]);var _0x2acc9f={'where':_0x684b09[_0xbd0b('0x39')]};return db[_0xbd0b('0x2b')][_0xbd0b('0x1c')](_0x2acc9f)[_0xbd0b('0x24')](function(_0x425c8a){_0xf4ba04[_0xbd0b('0x1c')]=_0x425c8a;if(_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3f')]){_0x684b09[_0xbd0b('0x40')]=[{'all':!![]}];}return db['ScreenRecording'][_0xbd0b('0x41')](_0x684b09);})[_0xbd0b('0x24')](function(_0x89b5ea){_0xf4ba04[_0xbd0b('0x42')]=_0x89b5ea;return _0xf4ba04;})[_0xbd0b('0x24')](respondWithFilteredResult(_0x2187a5,_0x684b09))[_0xbd0b('0x43')](handleError(_0x2187a5,null));};exports[_0xbd0b('0x44')]=function(_0x1b4497,_0x2a1a1d){var _0x4d72f={'raw':![],'where':{'id':_0x1b4497[_0xbd0b('0x45')]['id']}},_0xa252a2={};_0xa252a2['model']=_[_0xbd0b('0x31')](db['ScreenRecording']['rawAttributes']);_0xa252a2[_0xbd0b('0x30')]=_[_0xbd0b('0x31')](_0x1b4497[_0xbd0b('0x30')]);_0xa252a2['filters']=_[_0xbd0b('0x34')](_0xa252a2[_0xbd0b('0x2d')],_0xa252a2[_0xbd0b('0x30')]);_0x4d72f[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0xa252a2['model'],qs[_0xbd0b('0x35')](_0x1b4497[_0xbd0b('0x30')][_0xbd0b('0x35')]));_0x4d72f[_0xbd0b('0x33')]=_0x4d72f[_0xbd0b('0x33')][_0xbd0b('0x36')]?_0x4d72f['attributes']:_0xa252a2[_0xbd0b('0x2d')];if(_0x1b4497[_0xbd0b('0x30')][_0xbd0b('0x3f')]){_0x4d72f[_0xbd0b('0x40')]=[{'all':!![]}];}_0x4d72f=_[_0xbd0b('0x3d')]({},_0x4d72f,_0x1b4497[_0xbd0b('0x3e')]);return db[_0xbd0b('0x2b')][_0xbd0b('0x46')](_0x4d72f)[_0xbd0b('0x24')](handleEntityNotFound(_0x2a1a1d,null))[_0xbd0b('0x24')](respondWithResult(_0x2a1a1d,null))[_0xbd0b('0x43')](handleError(_0x2a1a1d,null));};exports[_0xbd0b('0x47')]=function(_0x222ee1,_0x30f77e){return db[_0xbd0b('0x2b')][_0xbd0b('0x47')](_0x222ee1[_0xbd0b('0x48')],{})[_0xbd0b('0x24')](respondWithResult(_0x30f77e,0xc9))[_0xbd0b('0x43')](handleError(_0x30f77e,null));};exports[_0xbd0b('0x23')]=function(_0x3cfb52,_0xbd64e2){if(_0x3cfb52[_0xbd0b('0x48')]['id']){delete _0x3cfb52['body']['id'];}delete _0x3cfb52[_0xbd0b('0x48')][_0xbd0b('0x49')];delete _0x3cfb52['body']['createdAt'];delete _0x3cfb52['body'][_0xbd0b('0x4a')];delete _0x3cfb52['body'][_0xbd0b('0x4b')];return db[_0xbd0b('0x2b')][_0xbd0b('0x46')]({'where':{'id':_0x3cfb52[_0xbd0b('0x45')]['id']}})['then'](handleEntityNotFound(_0xbd64e2,null))[_0xbd0b('0x24')](saveUpdates(_0x3cfb52['body'],null))[_0xbd0b('0x24')](respondWithResult(_0xbd64e2,null))['catch'](handleError(_0xbd64e2,null));};exports['describe']=function(_0x80d89a,_0x22f741){return db[_0xbd0b('0x2b')][_0xbd0b('0x4c')]()[_0xbd0b('0x24')](respondWithResult(_0x22f741,null))[_0xbd0b('0x43')](handleError(_0x22f741,null));};exports[_0xbd0b('0x4d')]=function(_0x2a7252,_0x4cc013,_0x48a78c){var _0x2d13fd=require(_0xbd0b('0x4e'));var _0x5094bd=![];var _0x514985={};if(_0x2a7252[_0xbd0b('0x30')][_0xbd0b('0x3b')]&&_0x2a7252[_0xbd0b('0x30')][_0xbd0b('0x3b')]==='uniqueid'){_0x514985[_0xbd0b('0x4f')]=_0x2a7252[_0xbd0b('0x45')]['id'];}else{_0x514985['id']=_0x2a7252[_0xbd0b('0x45')]['id'];}return db[_0xbd0b('0x2b')]['find']({'where':_0x514985,'attributes':['id',_0xbd0b('0x4b')],'raw':!![]})[_0xbd0b('0x24')](handleEntityNotFound(_0x4cc013,null))['then'](function(_0x122a19){if(_0x122a19){var _0x1ea443=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],_0xbd0b('0x52'),_0x122a19[_0xbd0b('0x4b')]);var _0x3a526a=util[_0xbd0b('0x2f')]('%s.cypher',_0x1ea443);if(fs[_0xbd0b('0x53')](_0x3a526a)){_0x5094bd=!![];return _0x2d13fd[_0xbd0b('0x54')](_0x3a526a,_0x1ea443,config[_0xbd0b('0x55')][_0xbd0b('0x56')])[_0xbd0b('0x24')](function(){return _0x122a19;});}return _0x122a19;}})[_0xbd0b('0x24')](function(_0x49b7a6){if(_0x49b7a6){var _0x570648=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],'server/files/screen_recordings',_0x49b7a6[_0xbd0b('0x4b')]);if(!fs[_0xbd0b('0x53')](_0x570648)){throw new db[(_0xbd0b('0x57'))][(_0xbd0b('0x58'))](_0xbd0b('0x59'));}if(_0x49b7a6['filename']){return _0x4cc013[_0xbd0b('0x4d')](_0x570648,_0x49b7a6[_0xbd0b('0x5a')]+path[_0xbd0b('0x5b')](_0x570648),function(){if(_0x5094bd){fs[_0xbd0b('0x5c')](_0x570648);}});}else{return _0x4cc013[_0xbd0b('0x4d')](_0x570648,function(_0xa08f72){if(_0x5094bd){fs[_0xbd0b('0x5c')](_0x570648);}});}}})[_0xbd0b('0x43')](function(_0x429534){if(_0x429534[_0xbd0b('0x5d')]===_0xbd0b('0x59')){_0x4cc013[_0xbd0b('0x18')](0x194)[_0xbd0b('0x29')](_0xbd0b('0x5e'));}else{return handleError(_0x4cc013,null);}});};exports[_0xbd0b('0x25')]=function(_0x1fefd5,_0x1e0beb){return db['ScreenRecording'][_0xbd0b('0x46')]({'where':{'id':_0x1fefd5[_0xbd0b('0x45')]['id']}})[_0xbd0b('0x24')](function(_0x2c935c){if(_['isNil'](_0x2c935c)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2c935c;})[_0xbd0b('0x24')](function(_0x45c6b5){var _0x4317f0=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],'server/files/screen_recordings',_0x45c6b5[_0xbd0b('0x4b')]);logger['info'](_0xbd0b('0x5f'),_0x4317f0);if(!_[_0xbd0b('0x60')](_0x45c6b5[_0xbd0b('0x4b')])&&fs[_0xbd0b('0x53')](_0x4317f0)){logger[_0xbd0b('0x61')](_0xbd0b('0x62')+_0x4317f0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbd0b('0x63')](_0x4317f0);}_0x4317f0=_0x4317f0+_0xbd0b('0x64');if(!_[_0xbd0b('0x60')](_0x45c6b5[_0xbd0b('0x4b')])&&fs['existsSync'](_0x4317f0)){logger[_0xbd0b('0x61')](_0xbd0b('0x62')+_0x4317f0+_0xbd0b('0x65'));fs[_0xbd0b('0x63')](_0x4317f0);}return _0x45c6b5;})[_0xbd0b('0x24')](function(_0x4df3df){if(!_0x4df3df)throw new InternalError();return _0x4df3df['destroy']();})[_0xbd0b('0x24')](function(){_0x1e0beb['status'](0xcc)[_0xbd0b('0x19')]();})[_0xbd0b('0x43')](handleError(_0x1e0beb,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 20ec352..c65f836 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 _0x9fdd=['./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x179c0c,_0x20fe42){var _0x2ab663=function(_0x3b9c1f){while(--_0x3b9c1f){_0x179c0c['push'](_0x179c0c['shift']());}};_0x2ab663(++_0x20fe42);}(_0x9fdd,0xe5));var _0xd9fd=function(_0x5f1900,_0x29e841){_0x5f1900=_0x5f1900-0x0;var _0x3320a7=_0x9fdd[_0x5f1900];return _0x3320a7;};'use strict';var _=require(_0xd9fd('0x0'));var util=require(_0xd9fd('0x1'));var logger=require(_0xd9fd('0x2'))(_0xd9fd('0x3'));var moment=require(_0xd9fd('0x4'));var BPromise=require(_0xd9fd('0x5'));var rp=require(_0xd9fd('0x6'));var fs=require('fs');var path=require(_0xd9fd('0x7'));var rimraf=require('rimraf');var config=require(_0xd9fd('0x8'));var attributes=require(_0xd9fd('0x9'));module[_0xd9fd('0xa')]=function(_0x1c863a,_0x4946ca){return _0x1c863a[_0xd9fd('0xb')]('ScreenRecording',attributes,{'tableName':_0xd9fd('0xc'),'paranoid':![],'indexes':[{'name':_0xd9fd('0xd'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x07d1=['define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports'];(function(_0xbce67,_0x3a4a58){var _0x827363=function(_0x5f47f4){while(--_0x5f47f4){_0xbce67['push'](_0xbce67['shift']());}};_0x827363(++_0x3a4a58);}(_0x07d1,0x12f));var _0x107d=function(_0x4e808c,_0x3ebb84){_0x4e808c=_0x4e808c-0x0;var _0x1db4c6=_0x07d1[_0x4e808c];return _0x1db4c6;};'use strict';var _=require('lodash');var util=require(_0x107d('0x0'));var logger=require(_0x107d('0x1'))(_0x107d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x107d('0x3'));var fs=require('fs');var path=require(_0x107d('0x4'));var rimraf=require(_0x107d('0x5'));var config=require(_0x107d('0x6'));var attributes=require(_0x107d('0x7'));module[_0x107d('0x8')]=function(_0x579b8b,_0x2978f9){return _0x579b8b[_0x107d('0x9')](_0x107d('0xa'),attributes,{'tableName':_0x107d('0xb'),'paranoid':![],'indexes':[{'name':_0x107d('0xc'),'fields':[_0x107d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index b5bf677..242a81f 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 _0xb55a=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment'];(function(_0x1f6e71,_0x19360b){var _0x2271aa=function(_0x2f0431){while(--_0x2f0431){_0x1f6e71['push'](_0x1f6e71['shift']());}};_0x2271aa(++_0x19360b);}(_0xb55a,0x14e));var _0xab55=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xb55a[_0x39e283];return _0x7de89f;};'use strict';var _=require('lodash');var util=require(_0xab55('0x0'));var moment=require(_0xab55('0x1'));var BPromise=require(_0xab55('0x2'));var rs=require(_0xab55('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab55('0x4'));var logger=require(_0xab55('0x5'))(_0xab55('0x6'));var config=require(_0xab55('0x7'));var jayson=require(_0xab55('0x8'));var client=jayson[_0xab55('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ea9ce,_0x49565e,_0x387f73){return new BPromise(function(_0x1fe6c1,_0x31ffd8){return client[_0xab55('0xa')](_0x2ea9ce,_0x387f73)[_0xab55('0xb')](function(_0x3a1e84){logger[_0xab55('0xc')](_0xab55('0xd'),_0x49565e,_0xab55('0xe'));logger[_0xab55('0xf')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x49565e,'request\x20sent',JSON[_0xab55('0x10')](_0x3a1e84));if(_0x3a1e84[_0xab55('0x11')]){if(_0x3a1e84[_0xab55('0x11')]['code']===0x1f4){logger[_0xab55('0x11')](_0xab55('0xd'),_0x49565e,_0x3a1e84[_0xab55('0x11')][_0xab55('0x12')]);return _0x31ffd8(_0x3a1e84['error'][_0xab55('0x12')]);}logger['error'](_0xab55('0xd'),_0x49565e,_0x3a1e84[_0xab55('0x11')][_0xab55('0x12')]);return _0x1fe6c1(_0x3a1e84['error'][_0xab55('0x12')]);}else{logger[_0xab55('0xc')](_0xab55('0xd'),_0x49565e,_0xab55('0xe'));_0x1fe6c1(_0x3a1e84[_0xab55('0x13')]['message']);}})[_0xab55('0x14')](function(_0x2bed4d){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x49565e,_0x2bed4d);_0x31ffd8(_0x2bed4d);});});} \ No newline at end of file +var _0xe02a=['ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0xe02a,0x172));var _0xae02=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe02a[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xae02('0x0'));var util=require(_0xae02('0x1'));var moment=require(_0xae02('0x2'));var BPromise=require(_0xae02('0x3'));var rs=require(_0xae02('0x4'));var fs=require('fs');var Redis=require(_0xae02('0x5'));var db=require(_0xae02('0x6'))['db'];var utils=require(_0xae02('0x7'));var logger=require(_0xae02('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xae02('0x9'));var client=jayson['client'][_0xae02('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c92f0,_0x1ddc3b,_0x54c2e1){return new BPromise(function(_0x6cebb1,_0x59aa12){return client[_0xae02('0xb')](_0x3c92f0,_0x54c2e1)[_0xae02('0xc')](function(_0x2a5917){logger[_0xae02('0xd')](_0xae02('0xe'),_0x1ddc3b,_0xae02('0xf'));logger[_0xae02('0x10')](_0xae02('0x11'),_0x1ddc3b,_0xae02('0xf'),JSON[_0xae02('0x12')](_0x2a5917));if(_0x2a5917['error']){if(_0x2a5917['error'][_0xae02('0x13')]===0x1f4){logger[_0xae02('0x14')](_0xae02('0xe'),_0x1ddc3b,_0x2a5917[_0xae02('0x14')][_0xae02('0x15')]);return _0x59aa12(_0x2a5917[_0xae02('0x14')][_0xae02('0x15')]);}logger['error'](_0xae02('0xe'),_0x1ddc3b,_0x2a5917[_0xae02('0x14')][_0xae02('0x15')]);return _0x6cebb1(_0x2a5917[_0xae02('0x14')][_0xae02('0x15')]);}else{logger[_0xae02('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x1ddc3b,'request\x20sent');_0x6cebb1(_0x2a5917[_0xae02('0x16')][_0xae02('0x15')]);}})[_0xae02('0x17')](function(_0x578943){logger[_0xae02('0x14')](_0xae02('0xe'),_0x1ddc3b,_0x578943);_0x59aa12(_0x578943);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index cf29780..0112716 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 _0xa205=['%s%s','logo','extname','originalname','/:id/logo','single','file','addLogo','server/files/images/logos/','logologin','post','addLogoLogin','/:id/preferred','addPreferred','addFavicon','put','/:id','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','getDate','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','format'];(function(_0x5951ed,_0x5e1c85){var _0x12212b=function(_0x4c3e76){while(--_0x4c3e76){_0x5951ed['push'](_0x5951ed['shift']());}};_0x12212b(++_0x5e1c85);}(_0xa205,0x1df));var _0x5a20=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0xa205[_0x4e6eb2];return _0x4e0c1c;};'use strict';var multer=require(_0x5a20('0x0'));var util=require(_0x5a20('0x1'));var path=require('path');var timeout=require(_0x5a20('0x2'));var express=require(_0x5a20('0x3'));var router=express[_0x5a20('0x4')]();var fs_extra=require(_0x5a20('0x5'));var auth=require(_0x5a20('0x6'));var interaction=require(_0x5a20('0x7'));var config=require(_0x5a20('0x8'));var controller=require('./setting.controller');router[_0x5a20('0x9')]('/',auth[_0x5a20('0xa')](),controller[_0x5a20('0xb')]);router[_0x5a20('0x9')](_0x5a20('0xc'),controller[_0x5a20('0xd')]);router[_0x5a20('0x9')]('/:id',controller[_0x5a20('0xe')]);router[_0x5a20('0x9')]('/:id/logo',controller[_0x5a20('0xf')]);router[_0x5a20('0x9')](_0x5a20('0x10'),controller[_0x5a20('0x11')]);router[_0x5a20('0x9')](_0x5a20('0x12'),controller[_0x5a20('0x13')]);router[_0x5a20('0x9')]('/:id/preferred',controller[_0x5a20('0x14')]);router[_0x5a20('0x9')](_0x5a20('0x15'),controller[_0x5a20('0x16')]);var upload=multer({'storage':multer[_0x5a20('0x17')]({'destination':function(_0x142edd,_0x1632b6,_0x4a5490){_0x4a5490(null,path[_0x5a20('0x18')](config[_0x5a20('0x19')],'server/files/images/logos/'));},'filename':function(_0x44d04f,_0x6c6805,_0x5c5145){_0x5c5145(null,util[_0x5a20('0x1a')](_0x5a20('0x1b'),_0x5a20('0x1c'),path[_0x5a20('0x1d')](_0x6c6805[_0x5a20('0x1e')])));}})});router['post'](_0x5a20('0x1f'),upload[_0x5a20('0x20')](_0x5a20('0x21')),controller[_0x5a20('0x22')]);var upload=multer({'storage':multer[_0x5a20('0x17')]({'destination':function(_0x2b6085,_0x308d28,_0xbaacd4){_0xbaacd4(null,path[_0x5a20('0x18')](config[_0x5a20('0x19')],_0x5a20('0x23')));},'filename':function(_0x2415b8,_0x37562c,_0x1536cd){_0x1536cd(null,util[_0x5a20('0x1a')]('%s%s',_0x5a20('0x24'),path[_0x5a20('0x1d')](_0x37562c['originalname'])));}})});router[_0x5a20('0x25')](_0x5a20('0x10'),upload['single'](_0x5a20('0x21')),controller[_0x5a20('0x26')]);var upload=multer({'storage':multer[_0x5a20('0x17')]({'destination':function(_0x1ad471,_0x13aaf6,_0x4a98eb){_0x4a98eb(null,path[_0x5a20('0x18')](config[_0x5a20('0x19')],_0x5a20('0x23')));},'filename':function(_0x3a18ab,_0xb51fa7,_0x5c3fd2){_0x5c3fd2(null,util[_0x5a20('0x1a')](_0x5a20('0x1b'),'preferred',path[_0x5a20('0x1d')](_0xb51fa7[_0x5a20('0x1e')])));}})});router['post'](_0x5a20('0x27'),upload['single'](_0x5a20('0x21')),controller[_0x5a20('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2a585a,_0x1aa213,_0x9e1d45){_0x9e1d45(null,path['join'](config[_0x5a20('0x19')],_0x5a20('0x23')));},'filename':function(_0xdb8858,_0xdd633f,_0x3b5607){_0x3b5607(null,util[_0x5a20('0x1a')]('%s%s','favicon',path['extname'](_0xdd633f['originalname'])));}})});router[_0x5a20('0x25')]('/:id/favicon',upload[_0x5a20('0x20')](_0x5a20('0x21')),controller[_0x5a20('0x29')]);router[_0x5a20('0x2a')](_0x5a20('0x2b'),auth['isAuthenticated'](),controller[_0x5a20('0x2c')]);module[_0x5a20('0x2d')]=router; \ No newline at end of file +var _0x7018=['getPreferred','/:id/favicon','diskStorage','join','root','%s%s','logo','extname','originalname','post','file','server/files/images/logos/','format','logologin','single','preferred','favicon','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','getDate','/:id','show','/:id/logo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred'];(function(_0x2409ab,_0x27fc96){var _0x317599=function(_0x44b6d0){while(--_0x44b6d0){_0x2409ab['push'](_0x2409ab['shift']());}};_0x317599(++_0x27fc96);}(_0x7018,0xb7));var _0x8701=function(_0x37d048,_0x153af7){_0x37d048=_0x37d048-0x0;var _0x5f0c42=_0x7018[_0x37d048];return _0x5f0c42;};'use strict';var multer=require(_0x8701('0x0'));var util=require(_0x8701('0x1'));var path=require(_0x8701('0x2'));var timeout=require(_0x8701('0x3'));var express=require(_0x8701('0x4'));var router=express[_0x8701('0x5')]();var fs_extra=require(_0x8701('0x6'));var auth=require(_0x8701('0x7'));var interaction=require(_0x8701('0x8'));var config=require(_0x8701('0x9'));var controller=require(_0x8701('0xa'));router[_0x8701('0xb')]('/',auth[_0x8701('0xc')](),controller[_0x8701('0xd')]);router['get']('/now',controller[_0x8701('0xe')]);router[_0x8701('0xb')](_0x8701('0xf'),controller[_0x8701('0x10')]);router[_0x8701('0xb')](_0x8701('0x11'),controller['getLogo']);router['get'](_0x8701('0x12'),controller['getLogoLogin']);router[_0x8701('0xb')](_0x8701('0x13'),controller[_0x8701('0x14')]);router[_0x8701('0xb')](_0x8701('0x15'),controller[_0x8701('0x16')]);router[_0x8701('0xb')](_0x8701('0x17'),controller['getFavicon']);var upload=multer({'storage':multer[_0x8701('0x18')]({'destination':function(_0x5648b7,_0x5aab59,_0x16e735){_0x16e735(null,path[_0x8701('0x19')](config[_0x8701('0x1a')],'server/files/images/logos/'));},'filename':function(_0x46478c,_0x35764a,_0x3d7d73){_0x3d7d73(null,util['format'](_0x8701('0x1b'),_0x8701('0x1c'),path[_0x8701('0x1d')](_0x35764a[_0x8701('0x1e')])));}})});router[_0x8701('0x1f')]('/:id/logo',upload['single'](_0x8701('0x20')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x48e92b,_0x1f469f,_0x13ed35){_0x13ed35(null,path['join'](config[_0x8701('0x1a')],_0x8701('0x21')));},'filename':function(_0x49919d,_0x478663,_0x61abcc){_0x61abcc(null,util[_0x8701('0x22')](_0x8701('0x1b'),_0x8701('0x23'),path['extname'](_0x478663[_0x8701('0x1e')])));}})});router['post'](_0x8701('0x12'),upload[_0x8701('0x24')](_0x8701('0x20')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x8901c,_0x3f14b9,_0x28b524){_0x28b524(null,path[_0x8701('0x19')](config['root'],'server/files/images/logos/'));},'filename':function(_0xce30aa,_0x17b60f,_0x4f7cbd){_0x4f7cbd(null,util['format'](_0x8701('0x1b'),_0x8701('0x25'),path[_0x8701('0x1d')](_0x17b60f[_0x8701('0x1e')])));}})});router[_0x8701('0x1f')](_0x8701('0x15'),upload['single'](_0x8701('0x20')),controller['addPreferred']);var upload=multer({'storage':multer[_0x8701('0x18')]({'destination':function(_0x473afe,_0x4a7ec2,_0x2a49ec){_0x2a49ec(null,path[_0x8701('0x19')](config[_0x8701('0x1a')],_0x8701('0x21')));},'filename':function(_0xb77808,_0xf834f7,_0x4133e3){_0x4133e3(null,util[_0x8701('0x22')](_0x8701('0x1b'),_0x8701('0x26'),path[_0x8701('0x1d')](_0xf834f7['originalname'])));}})});router['post']('/:id/favicon',upload[_0x8701('0x24')](_0x8701('0x20')),controller['addFavicon']);router[_0x8701('0x27')](_0x8701('0xf'),auth[_0x8701('0xc')](),controller[_0x8701('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index ab3fd04..d623937 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 _0x1c52=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x30f26e,_0x413bee){var _0x399295=function(_0x59dea8){while(--_0x59dea8){_0x30f26e['push'](_0x30f26e['shift']());}};_0x399295(++_0x413bee);}(_0x1c52,0x7c));var _0x21c5=function(_0x40825a,_0x4c80ec){_0x40825a=_0x40825a-0x0;var _0x2efeb0=_0x1c52[_0x40825a];return _0x2efeb0;};'use strict';var Sequelize=require(_0x21c5('0x0'));module[_0x21c5('0x1')]={'min_internal':{'type':Sequelize[_0x21c5('0x2')](0xb),'unique':_0x21c5('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x21c5('0x4')],'defaultValue':_0x21c5('0x5')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x21c5('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x21c5('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x21c5('0x4')]},'turnusername':{'type':Sequelize[_0x21c5('0x4')]},'turnpassword':{'type':Sequelize[_0x21c5('0x4')]},'pageTitle':{'type':Sequelize[_0x21c5('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x21c5('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x21c5('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x21c5('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x21c5('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x21c5('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x21c5('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x21c5('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x21c5('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x21c5('0x4')]},'defaultFavicon':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x21c5('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x21c5('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x21c5('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x21c5('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x21c5('0x2')](0x2)[_0x21c5('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x21c5('0x2')](0x2)[_0x21c5('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x21c5('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x21c5('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x21c5('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x21c5('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x21c5('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x21c5('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14}}; \ No newline at end of file +var _0x286a=['UNSIGNED','sequelize','exports','INTEGER','min_internal','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x38da19,_0x9666ff){var _0x40be37=function(_0x412d3d){while(--_0x412d3d){_0x38da19['push'](_0x38da19['shift']());}};_0x40be37(++_0x9666ff);}(_0x286a,0x76));var _0xa286=function(_0x453785,_0x21cc43){_0x453785=_0x453785-0x0;var _0x2b824c=_0x286a[_0x453785];return _0x2b824c;};'use strict';var Sequelize=require(_0xa286('0x0'));module[_0xa286('0x1')]={'min_internal':{'type':Sequelize[_0xa286('0x2')](0xb),'unique':_0xa286('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xa286('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xa286('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xa286('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xa286('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xa286('0x4')]},'turnpassword':{'type':Sequelize[_0xa286('0x4')]},'pageTitle':{'type':Sequelize[_0xa286('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xa286('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xa286('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xa286('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xa286('0x4')],'defaultValue':_0xa286('0x6')},'enableEmailPreview':{'type':Sequelize[_0xa286('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xa286('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xa286('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xa286('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xa286('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xa286('0x4')],'defaultValue':_0xa286('0x7')},'chatTimeout':{'type':Sequelize[_0xa286('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xa286('0x4')]},'defaultPreferred':{'type':Sequelize[_0xa286('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xa286('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xa286('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xa286('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xa286('0x4')]},'defaultFavicon':{'type':Sequelize[_0xa286('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xa286('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xa286('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xa286('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xa286('0x2')]},'transcribeRegion':{'type':Sequelize[_0xa286('0x4')]},'sentiment':{'type':Sequelize[_0xa286('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xa286('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xa286('0x2')]},'sentimentRegion':{'type':Sequelize[_0xa286('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xa286('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xa286('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xa286('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xa286('0x2')](0x2)[_0xa286('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xa286('0x2')](0x2)[_0xa286('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xa286('0x2')](0x2)[_0xa286('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xa286('0x2')](0x2)[_0xa286('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xa286('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xa286('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xa286('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xa286('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xa286('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xa286('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xa286('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xa286('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xa286('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xa286('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xa286('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 9c8743d..4214498 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 _0xa7dc=['find','body','file','logo','loginLogo','filename','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','defaultPreferred','default_loginLogo.svg','default','ValidationError','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','favicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','Setting','fieldName','type','key','map','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','order','sort','merge','options','include','findAll','rows','show','params','rawAttributes','includeAll'];(function(_0x20c2c3,_0x2d00f5){var _0x4e8b71=function(_0xad2859){while(--_0xad2859){_0x20c2c3['push'](_0x20c2c3['shift']());}};_0x4e8b71(++_0x2d00f5);}(_0xa7dc,0x11d));var _0xca7d=function(_0x118da2,_0x2d424d){_0x118da2=_0x118da2-0x0;var _0xdd1a16=_0xa7dc[_0x118da2];return _0xdd1a16;};'use strict';var emlformat=require(_0xca7d('0x0'));var rimraf=require(_0xca7d('0x1'));var zipdir=require(_0xca7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca7d('0x3'));var moment=require('moment');var BPromise=require(_0xca7d('0x4'));var Mustache=require(_0xca7d('0x5'));var util=require(_0xca7d('0x6'));var path=require(_0xca7d('0x7'));var sox=require(_0xca7d('0x8'));var csv=require(_0xca7d('0x9'));var ejs=require(_0xca7d('0xa'));var fs=require('fs');var fs_extra=require(_0xca7d('0xb'));var _=require('lodash');var squel=require(_0xca7d('0xc'));var crypto=require(_0xca7d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xca7d('0xe'));var toCsv=require(_0xca7d('0x9'));var querystring=require(_0xca7d('0xf'));var Papa=require('papaparse');var Redis=require(_0xca7d('0x10'));var authService=require(_0xca7d('0x11'));var qs=require(_0xca7d('0x12'));var as=require(_0xca7d('0x13'));var hardwareService=require(_0xca7d('0x14'));var logger=require('../../config/logger')(_0xca7d('0x15'));var utils=require('../../config/utils');var config=require(_0xca7d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xca7d('0x17'))['db'];var jayson=require(_0xca7d('0x18'));var client=jayson[_0xca7d('0x19')][_0xca7d('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4c1618,_0x5b5cdd,_0x5c045e,_0x3ed8ec){return new BPromise(function(_0x36f922,_0x3d8e7b){var _0x39caec=_0x3ed8ec||client;return _0x39caec[_0xca7d('0x1b')](_0x4c1618,_0x5c045e)[_0xca7d('0x1c')](function(_0x369923){logger[_0xca7d('0x1d')](_0xca7d('0x1e'),_0x5b5cdd,_0xca7d('0x1f'));logger[_0xca7d('0x20')](_0xca7d('0x21'),_0x5b5cdd,'request\x20sent',JSON['stringify'](_0x369923));if(_0x369923[_0xca7d('0x22')]){if(_0x369923[_0xca7d('0x22')][_0xca7d('0x23')]===0x1f4){logger[_0xca7d('0x22')](_0xca7d('0x1e'),_0x5b5cdd,_0x369923['error']['message']);return _0x3d8e7b(_0x369923[_0xca7d('0x22')]['message']);}logger[_0xca7d('0x22')](_0xca7d('0x1e'),_0x5b5cdd,_0x369923['error'][_0xca7d('0x24')]);return _0x36f922(_0x369923['error']['message']);}else{logger[_0xca7d('0x1d')](_0xca7d('0x1e'),_0x5b5cdd,_0xca7d('0x1f'));_0x36f922(_0x369923[_0xca7d('0x25')]['message']);}})[_0xca7d('0x26')](function(_0x1cca8a){logger[_0xca7d('0x22')](_0xca7d('0x1e'),_0x5b5cdd,_0x1cca8a);_0x3d8e7b(_0x1cca8a);});});}function respondWithStatusCode(_0x79fc7d,_0x351c87){_0x351c87=_0x351c87||0xcc;return function(_0xf4b873){if(_0xf4b873){return _0x79fc7d[_0xca7d('0x27')](_0x351c87);}return _0x79fc7d[_0xca7d('0x28')](_0x351c87)[_0xca7d('0x29')]();};}function respondWithResult(_0x59c71a,_0x24153){_0x24153=_0x24153||0xc8;return function(_0x41938b){if(_0x41938b){return _0x59c71a[_0xca7d('0x28')](_0x24153)[_0xca7d('0x2a')](_0x41938b);}};}function respondWithFilteredResult(_0x24cc8d,_0xc2048d){return function(_0x38ee14){if(_0x38ee14){var _0x162bf8=typeof _0xc2048d[_0xca7d('0x2b')]===_0xca7d('0x2c')&&typeof _0xc2048d['limit']===_0xca7d('0x2c');var _0x36e725=_0x38ee14['count'];var _0x3a1082=_0x162bf8?0x0:_0xc2048d['offset'];var _0x50c290=_0x162bf8?_0x38ee14[_0xca7d('0x2d')]:_0xc2048d['offset']+_0xc2048d[_0xca7d('0x2e')];var _0x1c4e7d;if(_0x50c290>=_0x36e725){_0x50c290=_0x36e725;_0x1c4e7d=0xc8;}else{_0x1c4e7d=0xce;}_0x24cc8d[_0xca7d('0x28')](_0x1c4e7d);return _0x24cc8d[_0xca7d('0x2f')](_0xca7d('0x30'),_0x3a1082+'-'+_0x50c290+'/'+_0x36e725)[_0xca7d('0x2a')](_0x38ee14);}return null;};}function patchUpdates(_0x496f57){return function(_0x86cfac){try{jsonpatch[_0xca7d('0x31')](_0x86cfac,_0x496f57,!![]);}catch(_0x28eeff){return BPromise['reject'](_0x28eeff);}return _0x86cfac[_0xca7d('0x32')]();};}function saveUpdates(_0x3d9356,_0x4487bd){return function(_0x401948){if(_0x401948){return _0x401948[_0xca7d('0x33')](_0x3d9356)[_0xca7d('0x1c')](function(_0x2b5449){return _0x2b5449;});}return null;};}function removeEntity(_0x35f717,_0x5bba0f){return function(_0x508f4b){if(_0x508f4b){return _0x508f4b[_0xca7d('0x34')]()[_0xca7d('0x1c')](function(){_0x35f717[_0xca7d('0x28')](0xcc)[_0xca7d('0x29')]();});}};}function handleEntityNotFound(_0x488fcb,_0x4924db){return function(_0x38f3a0){if(!_0x38f3a0){_0x488fcb['sendStatus'](0x194);}return _0x38f3a0;};}function handleError(_0x509f3a,_0x5b6695){_0x5b6695=_0x5b6695||0x1f4;return function(_0x187135){logger['error'](_0x187135[_0xca7d('0x35')]);if(_0x187135[_0xca7d('0x36')]){delete _0x187135[_0xca7d('0x36')];}_0x509f3a['status'](_0x5b6695)[_0xca7d('0x37')](_0x187135);};}exports[_0xca7d('0x38')]=function(_0x3dc00f,_0x5e3e9d){var _0x3da961={},_0x3950c3={},_0x5037da={'count':0x0,'rows':[]};var _0x1f1de2=_['map'](db[_0xca7d('0x39')]['rawAttributes'],function(_0x4d2d29){return{'name':_0x4d2d29[_0xca7d('0x3a')],'type':_0x4d2d29[_0xca7d('0x3b')][_0xca7d('0x3c')]};});_0x3950c3['model']=_[_0xca7d('0x3d')](_0x1f1de2,_0xca7d('0x36'));_0x3950c3[_0xca7d('0x3e')]=_[_0xca7d('0x3f')](_0x3dc00f[_0xca7d('0x3e')]);_0x3950c3[_0xca7d('0x40')]=_[_0xca7d('0x41')](_0x3950c3['model'],_0x3950c3['query']);_0x3da961['attributes']=_[_0xca7d('0x41')](_0x3950c3['model'],qs[_0xca7d('0x42')](_0x3dc00f['query'][_0xca7d('0x42')]));_0x3da961['attributes']=_0x3da961[_0xca7d('0x43')]['length']?_0x3da961[_0xca7d('0x43')]:_0x3950c3[_0xca7d('0x44')];if(!_0x3dc00f[_0xca7d('0x3e')][_0xca7d('0x45')]('nolimit')){_0x3da961['limit']=qs[_0xca7d('0x2e')](_0x3dc00f['query'][_0xca7d('0x2e')]);_0x3da961[_0xca7d('0x2b')]=qs[_0xca7d('0x2b')](_0x3dc00f[_0xca7d('0x3e')][_0xca7d('0x2b')]);}_0x3da961[_0xca7d('0x46')]=qs[_0xca7d('0x47')](_0x3dc00f['query'][_0xca7d('0x47')]);_0x3da961['where']=qs[_0xca7d('0x40')](_['pick'](_0x3dc00f[_0xca7d('0x3e')],_0x3950c3['filters']),_0x1f1de2);if(_0x3dc00f[_0xca7d('0x3e')]['filter']){_0x3da961['where']=_[_0xca7d('0x48')](_0x3da961['where'],{'$or':_[_0xca7d('0x3d')](_0x1f1de2,function(_0x5922c4){if(_0x5922c4[_0xca7d('0x3b')]!=='VIRTUAL'){var _0x492145={};_0x492145[_0x5922c4[_0xca7d('0x36')]]={'$like':'%'+_0x3dc00f[_0xca7d('0x3e')]['filter']+'%'};return _0x492145;}})});}_0x3da961=_['merge']({},_0x3da961,_0x3dc00f[_0xca7d('0x49')]);var _0x40a998={'where':_0x3da961['where']};return db['Setting']['count'](_0x40a998)[_0xca7d('0x1c')](function(_0x4c2ec1){_0x5037da[_0xca7d('0x2d')]=_0x4c2ec1;if(_0x3dc00f[_0xca7d('0x3e')]['includeAll']){_0x3da961[_0xca7d('0x4a')]=[{'all':!![]}];}return db[_0xca7d('0x39')][_0xca7d('0x4b')](_0x3da961);})['then'](function(_0x420693){_0x5037da[_0xca7d('0x4c')]=_0x420693;return _0x5037da;})[_0xca7d('0x1c')](respondWithFilteredResult(_0x5e3e9d,_0x3da961))[_0xca7d('0x26')](handleError(_0x5e3e9d,null));};exports[_0xca7d('0x4d')]=function(_0x179c80,_0x26c7ba){var _0x2d7a0d={'raw':![],'where':{'id':_0x179c80[_0xca7d('0x4e')]['id']}},_0xc19132={};_0xc19132[_0xca7d('0x44')]=_['keys'](db['Setting'][_0xca7d('0x4f')]);_0xc19132[_0xca7d('0x3e')]=_['keys'](_0x179c80[_0xca7d('0x3e')]);_0xc19132[_0xca7d('0x40')]=_['intersection'](_0xc19132[_0xca7d('0x44')],_0xc19132[_0xca7d('0x3e')]);_0x2d7a0d['attributes']=_[_0xca7d('0x41')](_0xc19132['model'],qs['fields'](_0x179c80[_0xca7d('0x3e')][_0xca7d('0x42')]));_0x2d7a0d['attributes']=_0x2d7a0d[_0xca7d('0x43')]['length']?_0x2d7a0d['attributes']:_0xc19132[_0xca7d('0x44')];if(_0x179c80[_0xca7d('0x3e')][_0xca7d('0x50')]){_0x2d7a0d[_0xca7d('0x4a')]=[{'all':!![]}];}_0x2d7a0d=_[_0xca7d('0x48')]({},_0x2d7a0d,_0x179c80[_0xca7d('0x49')]);return db[_0xca7d('0x39')][_0xca7d('0x51')](_0x2d7a0d)[_0xca7d('0x1c')](handleEntityNotFound(_0x26c7ba,null))['then'](respondWithResult(_0x26c7ba,null))['catch'](handleError(_0x26c7ba,null));};exports['update']=function(_0x5da783,_0x429b0a){if(_0x5da783[_0xca7d('0x52')]['id']){delete _0x5da783[_0xca7d('0x52')]['id'];}return db[_0xca7d('0x39')]['find']({'where':{'id':_0x5da783[_0xca7d('0x4e')]['id']}})[_0xca7d('0x1c')](handleEntityNotFound(_0x429b0a,null))[_0xca7d('0x1c')](saveUpdates(_0x5da783[_0xca7d('0x52')],null))[_0xca7d('0x1c')](respondWithResult(_0x429b0a,null))[_0xca7d('0x26')](handleError(_0x429b0a,null));};exports['addLogo']=function(_0x41f098,_0x55e672,_0x4ca647){if(_0x41f098[_0xca7d('0x53')]&&_0x41f098[_0xca7d('0x53')]['filename']){_0x41f098['body'][_0xca7d('0x54')]=_0x41f098[_0xca7d('0x53')]['filename'];}return db[_0xca7d('0x39')][_0xca7d('0x51')]({'where':{'id':_0x41f098[_0xca7d('0x4e')]['id']}})[_0xca7d('0x1c')](handleEntityNotFound(_0x55e672,null))[_0xca7d('0x1c')](saveUpdates(_0x41f098['body'],null))[_0xca7d('0x1c')](respondWithResult(_0x55e672,null))['catch'](handleError(_0x55e672,null));};exports['addLogoLogin']=function(_0xa9375f,_0x55e0c1,_0x52a671){if(_0xa9375f[_0xca7d('0x53')]&&_0xa9375f['file']['filename']){_0xa9375f['body'][_0xca7d('0x55')]=_0xa9375f['file'][_0xca7d('0x56')];}return db['Setting']['find']({'where':{'id':_0xa9375f[_0xca7d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x55e0c1,null))[_0xca7d('0x1c')](saveUpdates(_0xa9375f[_0xca7d('0x52')],null))['then'](respondWithResult(_0x55e0c1,null))[_0xca7d('0x26')](handleError(_0x55e0c1,null));};var utilLicense=require(_0xca7d('0x57'));exports[_0xca7d('0x58')]=function(_0x33d240,_0x2f8f2c,_0x122eab){var _0x1931f6=_0xca7d('0x59');var _0x33da82={'custom':![]};return utilLicense[_0xca7d('0x5a')]()[_0xca7d('0x1c')](function(_0x4ea55f){if(_0x4ea55f){_0x33da82=_0x4ea55f;}return db[_0xca7d('0x39')][_0xca7d('0x51')]({'where':{'id':_0x33d240[_0xca7d('0x4e')]['id']},'attributes':['logo',_0xca7d('0x55'),_0xca7d('0x5b'),'favicon',_0xca7d('0x5c'),_0xca7d('0x5d'),'defaultPreferred',_0xca7d('0x5e')],'raw':!![]});})[_0xca7d('0x1c')](handleEntityNotFound(_0x2f8f2c,null))[_0xca7d('0x1c')](function(_0x4cef5b){if(_0x4cef5b){var _0xc59fcd=_0x4cef5b[_0xca7d('0x54')]&&fs[_0xca7d('0x5f')](path[_0xca7d('0x60')](config[_0xca7d('0x61')],_0x1931f6,_[_0xca7d('0x62')](_0x4cef5b[_0xca7d('0x54')])))?path[_0xca7d('0x60')](config['root'],_0x1931f6,_[_0xca7d('0x62')](_0x4cef5b[_0xca7d('0x54')])):path[_0xca7d('0x60')](config[_0xca7d('0x61')],_0x1931f6,_[_0xca7d('0x62')](_0xca7d('0x63')));var _0x53c840='default'+_[_0xca7d('0x64')](_0xca7d('0x54'));if(_0x4cef5b[_0x53c840]||!_0x33da82[_0xca7d('0x65')]){_0xc59fcd=path['join'](config[_0xca7d('0x61')],_0x1931f6,_['toLower']('default_logo.svg'));}if(!fs[_0xca7d('0x5f')](_0xc59fcd)){throw new db[(_0xca7d('0x66'))]['ValidationError'](_['upperFirst']('logo')+_0xca7d('0x67'));}return _0x2f8f2c[_0xca7d('0x68')](_0xc59fcd);}})[_0xca7d('0x26')](handleError(_0x2f8f2c,null));};var utilLicense=require(_0xca7d('0x57'));exports[_0xca7d('0x69')]=function(_0x2bfab1,_0x2f7a9c,_0x58f9c7){var _0x4bda07='server/files/images/logos';var _0x55ce2e={'custom':![]};return utilLicense['getLicense']()[_0xca7d('0x1c')](function(_0x24ab4d){if(_0x24ab4d){_0x55ce2e=_0x24ab4d;}return db['Setting']['find']({'where':{'id':_0x2bfab1[_0xca7d('0x4e')]['id']},'attributes':[_0xca7d('0x54'),'loginLogo',_0xca7d('0x5b'),'favicon',_0xca7d('0x5c'),'defaultLoginLogo',_0xca7d('0x6a'),_0xca7d('0x5e')],'raw':!![]});})[_0xca7d('0x1c')](handleEntityNotFound(_0x2f7a9c,null))['then'](function(_0x55aafb){if(_0x55aafb){var _0x2da935=_0x55aafb[_0xca7d('0x55')]&&fs[_0xca7d('0x5f')](path[_0xca7d('0x60')](config['root'],_0x4bda07,_[_0xca7d('0x62')](_0x55aafb['loginLogo'])))?path['join'](config['root'],_0x4bda07,_['toLower'](_0x55aafb['loginLogo'])):path['join'](config[_0xca7d('0x61')],_0x4bda07,_['toLower'](_0xca7d('0x6b')));var _0xdd909f=_0xca7d('0x6c')+_[_0xca7d('0x64')](_0xca7d('0x55'));if(_0x55aafb[_0xdd909f]||!_0x55ce2e[_0xca7d('0x65')]){_0x2da935=path[_0xca7d('0x60')](config['root'],_0x4bda07,_['toLower'](_0xca7d('0x6b')));}if(!fs[_0xca7d('0x5f')](_0x2da935)){throw new db[(_0xca7d('0x66'))][(_0xca7d('0x6d'))](_[_0xca7d('0x64')](_0xca7d('0x55'))+_0xca7d('0x67'));}return _0x2f7a9c[_0xca7d('0x68')](_0x2da935);}})['catch'](handleError(_0x2f7a9c,null));};exports[_0xca7d('0x6e')]=function(_0x3d8d17,_0x46e9d5){return db[_0xca7d('0x39')][_0xca7d('0x51')]({'where':{'id':_0x3d8d17['params']['id']},'attributes':[_0xca7d('0x6f')]})[_0xca7d('0x1c')](respondWithResult(_0x46e9d5,null))[_0xca7d('0x26')](handleError(_0x46e9d5,null));};exports['addPreferred']=function(_0x1ca87a,_0x7a223,_0x348a05){if(_0x1ca87a['file']&&_0x1ca87a[_0xca7d('0x53')][_0xca7d('0x56')]){_0x1ca87a[_0xca7d('0x52')]['preferred']=_0x1ca87a[_0xca7d('0x53')][_0xca7d('0x56')];}return db[_0xca7d('0x39')][_0xca7d('0x51')]({'where':{'id':_0x1ca87a[_0xca7d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x7a223,null))[_0xca7d('0x1c')](saveUpdates(_0x1ca87a[_0xca7d('0x52')],null))[_0xca7d('0x1c')](respondWithResult(_0x7a223,null))[_0xca7d('0x26')](handleError(_0x7a223,null));};var utilLicense=require('../../config/license/util');exports[_0xca7d('0x70')]=function(_0x56cc98,_0x22549c,_0x42f6ec){var _0x5a5dfa=_0xca7d('0x59');var _0xd77d5c={'custom':![]};return utilLicense[_0xca7d('0x5a')]()[_0xca7d('0x1c')](function(_0x213641){if(_0x213641){_0xd77d5c=_0x213641;}return db[_0xca7d('0x39')]['find']({'where':{'id':_0x56cc98[_0xca7d('0x4e')]['id']},'attributes':[_0xca7d('0x54'),'loginLogo',_0xca7d('0x5b'),'favicon','defaultLogo','defaultLoginLogo','defaultPreferred',_0xca7d('0x5e')],'raw':!![]});})[_0xca7d('0x1c')](handleEntityNotFound(_0x22549c,null))['then'](function(_0x5d1eb9){if(_0x5d1eb9){var _0x5ed25c=_0x5d1eb9['preferred']&&fs[_0xca7d('0x5f')](path[_0xca7d('0x60')](config[_0xca7d('0x61')],_0x5a5dfa,_[_0xca7d('0x62')](_0x5d1eb9[_0xca7d('0x5b')])))?path[_0xca7d('0x60')](config[_0xca7d('0x61')],_0x5a5dfa,_[_0xca7d('0x62')](_0x5d1eb9[_0xca7d('0x5b')])):path[_0xca7d('0x60')](config['root'],_0x5a5dfa,_['toLower']('default_preferred.png'));var _0x5d32e2=_0xca7d('0x6c')+_[_0xca7d('0x64')](_0xca7d('0x5b'));if(_0x5d1eb9[_0x5d32e2]||!_0xd77d5c[_0xca7d('0x65')]||!_0xd77d5c[_0xca7d('0x5b')]){_0x5ed25c=path[_0xca7d('0x60')](config[_0xca7d('0x61')],_0x5a5dfa,_['toLower'](_0xca7d('0x71')));}if(!fs['existsSync'](_0x5ed25c)){throw new db[(_0xca7d('0x66'))][(_0xca7d('0x6d'))](_[_0xca7d('0x64')](_0xca7d('0x5b'))+_0xca7d('0x67'));}return _0x22549c[_0xca7d('0x68')](_0x5ed25c);}})[_0xca7d('0x26')](handleError(_0x22549c,null));};exports[_0xca7d('0x72')]=function(_0x114e17,_0x5c3121,_0xaef01f){if(_0x114e17[_0xca7d('0x53')]&&_0x114e17[_0xca7d('0x53')]['filename']){_0x114e17[_0xca7d('0x52')][_0xca7d('0x73')]=_0x114e17['file'][_0xca7d('0x56')];}return db[_0xca7d('0x39')][_0xca7d('0x51')]({'where':{'id':_0x114e17['params']['id']}})['then'](handleEntityNotFound(_0x5c3121,null))[_0xca7d('0x1c')](saveUpdates(_0x114e17[_0xca7d('0x52')],null))['then'](respondWithResult(_0x5c3121,null))[_0xca7d('0x26')](handleError(_0x5c3121,null));};var utilLicense=require(_0xca7d('0x57'));exports[_0xca7d('0x74')]=function(_0x8d244e,_0x3a06f7,_0x355349){var _0x151290=_0xca7d('0x59');var _0x1dd355={'custom':![]};return utilLicense['getLicense']()[_0xca7d('0x1c')](function(_0x2b2090){if(_0x2b2090){_0x1dd355=_0x2b2090;}return db[_0xca7d('0x39')][_0xca7d('0x51')]({'where':{'id':_0x8d244e[_0xca7d('0x4e')]['id']},'attributes':[_0xca7d('0x54'),_0xca7d('0x55'),'preferred',_0xca7d('0x73'),_0xca7d('0x5c'),'defaultLoginLogo',_0xca7d('0x6a'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x3a06f7,null))[_0xca7d('0x1c')](function(_0x4bf73f){if(_0x4bf73f){var _0x1698aa=_0x4bf73f[_0xca7d('0x73')]&&fs['existsSync'](path[_0xca7d('0x60')](config[_0xca7d('0x61')],_0x151290,_[_0xca7d('0x62')](_0x4bf73f[_0xca7d('0x73')])))?path[_0xca7d('0x60')](config['root'],_0x151290,_['toLower'](_0x4bf73f['favicon'])):path[_0xca7d('0x60')](config['root'],_0x151290,_[_0xca7d('0x62')](_0xca7d('0x75')));var _0x233b50='default'+_[_0xca7d('0x64')](_0xca7d('0x73'));if(_0x4bf73f[_0x233b50]||!_0x1dd355[_0xca7d('0x65')]){_0x1698aa=path[_0xca7d('0x60')](config['root'],_0x151290,_['toLower'](_0xca7d('0x75')));}if(!fs[_0xca7d('0x5f')](_0x1698aa)){throw new db[(_0xca7d('0x66'))][(_0xca7d('0x6d'))](_['upperFirst'](_0xca7d('0x73'))+_0xca7d('0x67'));}return _0x3a06f7[_0xca7d('0x68')](_0x1698aa);}})[_0xca7d('0x26')](handleError(_0x3a06f7,null));};exports[_0xca7d('0x76')]=function(_0x48af40,_0x2bddfa){var _0x503b3f={'offset':moment()['utcOffset']()};_0x503b3f['now']=moment()[_0xca7d('0x77')](_0x503b3f[_0xca7d('0x2b')])[_0xca7d('0x78')](_0xca7d('0x79'));return _0x2bddfa[_0xca7d('0x28')](0xc8)['send'](_0x503b3f);}; \ No newline at end of file +var _0x36f4=['where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','rawAttributes','length','includeAll','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','Sequelize','gdpr','addPreferred','getPreferred','preferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','Setting','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x36f4,0xb3));var _0x436f=function(_0x8395d2,_0xbd07a2){_0x8395d2=_0x8395d2-0x0;var _0x594233=_0x36f4[_0x8395d2];return _0x594233;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x436f('0x0'));var zipdir=require(_0x436f('0x1'));var jsonpatch=require(_0x436f('0x2'));var rp=require(_0x436f('0x3'));var moment=require(_0x436f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x436f('0x5'));var path=require(_0x436f('0x6'));var sox=require(_0x436f('0x7'));var csv=require(_0x436f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x436f('0x9'));var squel=require('squel');var crypto=require(_0x436f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x436f('0xb'));var toCsv=require(_0x436f('0x8'));var querystring=require(_0x436f('0xc'));var Papa=require(_0x436f('0xd'));var Redis=require(_0x436f('0xe'));var authService=require(_0x436f('0xf'));var qs=require(_0x436f('0x10'));var as=require(_0x436f('0x11'));var hardwareService=require(_0x436f('0x12'));var logger=require(_0x436f('0x13'))('api');var utils=require(_0x436f('0x14'));var config=require(_0x436f('0x15'));var licenseUtil=require(_0x436f('0x16'));var db=require(_0x436f('0x17'))['db'];var jayson=require(_0x436f('0x18'));var client=jayson[_0x436f('0x19')][_0x436f('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2fa42f,_0x2aa641,_0x5ec3f1,_0x5d6ea4){return new BPromise(function(_0x4d9508,_0x7fdfc5){var _0x355fa5=_0x5d6ea4||client;return _0x355fa5[_0x436f('0x1b')](_0x2fa42f,_0x5ec3f1)[_0x436f('0x1c')](function(_0x496b96){logger['info'](_0x436f('0x1d'),_0x2aa641,'request\x20sent');logger[_0x436f('0x1e')]('Setting,\x20%s,\x20%s,\x20%s',_0x2aa641,_0x436f('0x1f'),JSON[_0x436f('0x20')](_0x496b96));if(_0x496b96[_0x436f('0x21')]){if(_0x496b96[_0x436f('0x21')][_0x436f('0x22')]===0x1f4){logger[_0x436f('0x21')](_0x436f('0x1d'),_0x2aa641,_0x496b96[_0x436f('0x21')]['message']);return _0x7fdfc5(_0x496b96[_0x436f('0x21')][_0x436f('0x23')]);}logger[_0x436f('0x21')](_0x436f('0x1d'),_0x2aa641,_0x496b96[_0x436f('0x21')][_0x436f('0x23')]);return _0x4d9508(_0x496b96[_0x436f('0x21')]['message']);}else{logger[_0x436f('0x24')](_0x436f('0x1d'),_0x2aa641,_0x436f('0x1f'));_0x4d9508(_0x496b96[_0x436f('0x25')][_0x436f('0x23')]);}})[_0x436f('0x26')](function(_0x8166e5){logger[_0x436f('0x21')]('Setting,\x20%s,\x20%s',_0x2aa641,_0x8166e5);_0x7fdfc5(_0x8166e5);});});}function respondWithStatusCode(_0x30e64a,_0x48b8fd){_0x48b8fd=_0x48b8fd||0xcc;return function(_0x392705){if(_0x392705){return _0x30e64a[_0x436f('0x27')](_0x48b8fd);}return _0x30e64a[_0x436f('0x28')](_0x48b8fd)[_0x436f('0x29')]();};}function respondWithResult(_0x3acaee,_0x3db4c3){_0x3db4c3=_0x3db4c3||0xc8;return function(_0x380de8){if(_0x380de8){return _0x3acaee[_0x436f('0x28')](_0x3db4c3)[_0x436f('0x2a')](_0x380de8);}};}function respondWithFilteredResult(_0x41faf6,_0x463539){return function(_0x5aadb9){if(_0x5aadb9){var _0x14710a=typeof _0x463539['offset']===_0x436f('0x2b')&&typeof _0x463539[_0x436f('0x2c')]===_0x436f('0x2b');var _0x2b856e=_0x5aadb9[_0x436f('0x2d')];var _0x11cc89=_0x14710a?0x0:_0x463539[_0x436f('0x2e')];var _0x5a04a3=_0x14710a?_0x5aadb9['count']:_0x463539[_0x436f('0x2e')]+_0x463539[_0x436f('0x2c')];var _0x482260;if(_0x5a04a3>=_0x2b856e){_0x5a04a3=_0x2b856e;_0x482260=0xc8;}else{_0x482260=0xce;}_0x41faf6['status'](_0x482260);return _0x41faf6[_0x436f('0x2f')](_0x436f('0x30'),_0x11cc89+'-'+_0x5a04a3+'/'+_0x2b856e)[_0x436f('0x2a')](_0x5aadb9);}return null;};}function patchUpdates(_0x23384c){return function(_0x8c73af){try{jsonpatch[_0x436f('0x31')](_0x8c73af,_0x23384c,!![]);}catch(_0x156f8c){return BPromise[_0x436f('0x32')](_0x156f8c);}return _0x8c73af[_0x436f('0x33')]();};}function saveUpdates(_0x24598b,_0x3f57e4){return function(_0x2f05dc){if(_0x2f05dc){return _0x2f05dc[_0x436f('0x34')](_0x24598b)[_0x436f('0x1c')](function(_0x45ce79){return _0x45ce79;});}return null;};}function removeEntity(_0x4aa2a7,_0x577c3f){return function(_0x3aa31d){if(_0x3aa31d){return _0x3aa31d[_0x436f('0x35')]()[_0x436f('0x1c')](function(){_0x4aa2a7['status'](0xcc)[_0x436f('0x29')]();});}};}function handleEntityNotFound(_0x1330b2,_0x2bef05){return function(_0x24a7a2){if(!_0x24a7a2){_0x1330b2[_0x436f('0x27')](0x194);}return _0x24a7a2;};}function handleError(_0x59daa2,_0x12679b){_0x12679b=_0x12679b||0x1f4;return function(_0x1cf406){logger[_0x436f('0x21')](_0x1cf406[_0x436f('0x36')]);if(_0x1cf406[_0x436f('0x37')]){delete _0x1cf406[_0x436f('0x37')];}_0x59daa2['status'](_0x12679b)['send'](_0x1cf406);};}exports[_0x436f('0x38')]=function(_0x1c4d85,_0xda033b){var _0x61228d={},_0x113c52={},_0x5dd271={'count':0x0,'rows':[]};var _0x3df8d8=_[_0x436f('0x39')](db[_0x436f('0x3a')]['rawAttributes'],function(_0x5b7639){return{'name':_0x5b7639[_0x436f('0x3b')],'type':_0x5b7639[_0x436f('0x3c')][_0x436f('0x3d')]};});_0x113c52[_0x436f('0x3e')]=_[_0x436f('0x39')](_0x3df8d8,'name');_0x113c52[_0x436f('0x3f')]=_[_0x436f('0x40')](_0x1c4d85[_0x436f('0x3f')]);_0x113c52[_0x436f('0x41')]=_[_0x436f('0x42')](_0x113c52[_0x436f('0x3e')],_0x113c52['query']);_0x61228d[_0x436f('0x43')]=_['intersection'](_0x113c52[_0x436f('0x3e')],qs[_0x436f('0x44')](_0x1c4d85[_0x436f('0x3f')]['fields']));_0x61228d[_0x436f('0x43')]=_0x61228d[_0x436f('0x43')]['length']?_0x61228d['attributes']:_0x113c52[_0x436f('0x3e')];if(!_0x1c4d85[_0x436f('0x3f')][_0x436f('0x45')](_0x436f('0x46'))){_0x61228d[_0x436f('0x2c')]=qs[_0x436f('0x2c')](_0x1c4d85[_0x436f('0x3f')][_0x436f('0x2c')]);_0x61228d[_0x436f('0x2e')]=qs[_0x436f('0x2e')](_0x1c4d85[_0x436f('0x3f')][_0x436f('0x2e')]);}_0x61228d[_0x436f('0x47')]=qs[_0x436f('0x48')](_0x1c4d85[_0x436f('0x3f')]['sort']);_0x61228d[_0x436f('0x49')]=qs[_0x436f('0x41')](_[_0x436f('0x4a')](_0x1c4d85[_0x436f('0x3f')],_0x113c52['filters']),_0x3df8d8);if(_0x1c4d85[_0x436f('0x3f')][_0x436f('0x4b')]){_0x61228d[_0x436f('0x49')]=_[_0x436f('0x4c')](_0x61228d[_0x436f('0x49')],{'$or':_[_0x436f('0x39')](_0x3df8d8,function(_0x5745a6){if(_0x5745a6['type']!==_0x436f('0x4d')){var _0x2ecd39={};_0x2ecd39[_0x5745a6[_0x436f('0x37')]]={'$like':'%'+_0x1c4d85['query'][_0x436f('0x4b')]+'%'};return _0x2ecd39;}})});}_0x61228d=_[_0x436f('0x4c')]({},_0x61228d,_0x1c4d85[_0x436f('0x4e')]);var _0x4b5d89={'where':_0x61228d[_0x436f('0x49')]};return db[_0x436f('0x3a')][_0x436f('0x2d')](_0x4b5d89)['then'](function(_0x5527fd){_0x5dd271['count']=_0x5527fd;if(_0x1c4d85['query']['includeAll']){_0x61228d[_0x436f('0x4f')]=[{'all':!![]}];}return db['Setting'][_0x436f('0x50')](_0x61228d);})[_0x436f('0x1c')](function(_0x2c31c1){_0x5dd271[_0x436f('0x51')]=_0x2c31c1;return _0x5dd271;})['then'](respondWithFilteredResult(_0xda033b,_0x61228d))[_0x436f('0x26')](handleError(_0xda033b,null));};exports['show']=function(_0x582ccc,_0x1bcf6b){var _0x5033a8={'raw':![],'where':{'id':_0x582ccc[_0x436f('0x52')]['id']}},_0x4c681a={};_0x4c681a[_0x436f('0x3e')]=_[_0x436f('0x40')](db[_0x436f('0x3a')][_0x436f('0x53')]);_0x4c681a[_0x436f('0x3f')]=_[_0x436f('0x40')](_0x582ccc[_0x436f('0x3f')]);_0x4c681a['filters']=_[_0x436f('0x42')](_0x4c681a['model'],_0x4c681a['query']);_0x5033a8[_0x436f('0x43')]=_['intersection'](_0x4c681a[_0x436f('0x3e')],qs[_0x436f('0x44')](_0x582ccc[_0x436f('0x3f')][_0x436f('0x44')]));_0x5033a8[_0x436f('0x43')]=_0x5033a8[_0x436f('0x43')][_0x436f('0x54')]?_0x5033a8[_0x436f('0x43')]:_0x4c681a[_0x436f('0x3e')];if(_0x582ccc[_0x436f('0x3f')][_0x436f('0x55')]){_0x5033a8['include']=[{'all':!![]}];}_0x5033a8=_[_0x436f('0x4c')]({},_0x5033a8,_0x582ccc['options']);return db[_0x436f('0x3a')][_0x436f('0x56')](_0x5033a8)['then'](handleEntityNotFound(_0x1bcf6b,null))[_0x436f('0x1c')](respondWithResult(_0x1bcf6b,null))[_0x436f('0x26')](handleError(_0x1bcf6b,null));};exports[_0x436f('0x34')]=function(_0x5f428b,_0x19fc64){if(_0x5f428b[_0x436f('0x57')]['id']){delete _0x5f428b[_0x436f('0x57')]['id'];}return db['Setting'][_0x436f('0x56')]({'where':{'id':_0x5f428b[_0x436f('0x52')]['id']}})[_0x436f('0x1c')](handleEntityNotFound(_0x19fc64,null))[_0x436f('0x1c')](saveUpdates(_0x5f428b['body'],null))[_0x436f('0x1c')](respondWithResult(_0x19fc64,null))[_0x436f('0x26')](handleError(_0x19fc64,null));};exports[_0x436f('0x58')]=function(_0xaf6812,_0x5249b5,_0xc9852){if(_0xaf6812['file']&&_0xaf6812[_0x436f('0x59')][_0x436f('0x5a')]){_0xaf6812[_0x436f('0x57')][_0x436f('0x5b')]=_0xaf6812[_0x436f('0x59')][_0x436f('0x5a')];}return db[_0x436f('0x3a')][_0x436f('0x56')]({'where':{'id':_0xaf6812[_0x436f('0x52')]['id']}})[_0x436f('0x1c')](handleEntityNotFound(_0x5249b5,null))[_0x436f('0x1c')](saveUpdates(_0xaf6812[_0x436f('0x57')],null))['then'](respondWithResult(_0x5249b5,null))[_0x436f('0x26')](handleError(_0x5249b5,null));};exports[_0x436f('0x5c')]=function(_0x3cc204,_0x113874,_0x1e297e){if(_0x3cc204[_0x436f('0x59')]&&_0x3cc204[_0x436f('0x59')]['filename']){_0x3cc204[_0x436f('0x57')][_0x436f('0x5d')]=_0x3cc204[_0x436f('0x59')]['filename'];}return db['Setting'][_0x436f('0x56')]({'where':{'id':_0x3cc204[_0x436f('0x52')]['id']}})['then'](handleEntityNotFound(_0x113874,null))['then'](saveUpdates(_0x3cc204[_0x436f('0x57')],null))[_0x436f('0x1c')](respondWithResult(_0x113874,null))[_0x436f('0x26')](handleError(_0x113874,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x8a8063,_0x190520,_0x37b103){var _0x5a2c0a=_0x436f('0x5e');var _0x39bd6a={'custom':![]};return utilLicense[_0x436f('0x5f')]()['then'](function(_0x2df5ec){if(_0x2df5ec){_0x39bd6a=_0x2df5ec;}return db[_0x436f('0x3a')][_0x436f('0x56')]({'where':{'id':_0x8a8063[_0x436f('0x52')]['id']},'attributes':[_0x436f('0x5b'),_0x436f('0x5d'),'preferred',_0x436f('0x60'),_0x436f('0x61'),_0x436f('0x62'),_0x436f('0x63'),_0x436f('0x64')],'raw':!![]});})[_0x436f('0x1c')](handleEntityNotFound(_0x190520,null))[_0x436f('0x1c')](function(_0x2de628){if(_0x2de628){var _0x557e47=_0x2de628[_0x436f('0x5b')]&&fs[_0x436f('0x65')](path[_0x436f('0x66')](config['root'],_0x5a2c0a,_[_0x436f('0x67')](_0x2de628[_0x436f('0x5b')])))?path[_0x436f('0x66')](config[_0x436f('0x68')],_0x5a2c0a,_[_0x436f('0x67')](_0x2de628['logo'])):path[_0x436f('0x66')](config['root'],_0x5a2c0a,_['toLower'](_0x436f('0x69')));var _0x315ccd=_0x436f('0x6a')+_[_0x436f('0x6b')](_0x436f('0x5b'));if(_0x2de628[_0x315ccd]||!_0x39bd6a[_0x436f('0x6c')]){_0x557e47=path[_0x436f('0x66')](config['root'],_0x5a2c0a,_[_0x436f('0x67')](_0x436f('0x69')));}if(!fs[_0x436f('0x65')](_0x557e47)){throw new db['Sequelize'][(_0x436f('0x6d'))](_[_0x436f('0x6b')]('logo')+_0x436f('0x6e'));}return _0x190520[_0x436f('0x6f')](_0x557e47);}})[_0x436f('0x26')](handleError(_0x190520,null));};var utilLicense=require(_0x436f('0x16'));exports[_0x436f('0x70')]=function(_0x334e3c,_0x4460cc,_0x43953d){var _0x2ae567='server/files/images/logos';var _0x225672={'custom':![]};return utilLicense[_0x436f('0x5f')]()[_0x436f('0x1c')](function(_0x1d976a){if(_0x1d976a){_0x225672=_0x1d976a;}return db[_0x436f('0x3a')][_0x436f('0x56')]({'where':{'id':_0x334e3c[_0x436f('0x52')]['id']},'attributes':['logo',_0x436f('0x5d'),'preferred',_0x436f('0x60'),_0x436f('0x61'),_0x436f('0x62'),_0x436f('0x63'),_0x436f('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x4460cc,null))[_0x436f('0x1c')](function(_0x2c3463){if(_0x2c3463){var _0xef114c=_0x2c3463[_0x436f('0x5d')]&&fs['existsSync'](path['join'](config[_0x436f('0x68')],_0x2ae567,_['toLower'](_0x2c3463['loginLogo'])))?path[_0x436f('0x66')](config[_0x436f('0x68')],_0x2ae567,_[_0x436f('0x67')](_0x2c3463[_0x436f('0x5d')])):path[_0x436f('0x66')](config[_0x436f('0x68')],_0x2ae567,_[_0x436f('0x67')]('default_loginLogo.svg'));var _0x53b852=_0x436f('0x6a')+_[_0x436f('0x6b')](_0x436f('0x5d'));if(_0x2c3463[_0x53b852]||!_0x225672[_0x436f('0x6c')]){_0xef114c=path[_0x436f('0x66')](config[_0x436f('0x68')],_0x2ae567,_[_0x436f('0x67')](_0x436f('0x71')));}if(!fs[_0x436f('0x65')](_0xef114c)){throw new db[(_0x436f('0x72'))][(_0x436f('0x6d'))](_[_0x436f('0x6b')](_0x436f('0x5d'))+_0x436f('0x6e'));}return _0x4460cc[_0x436f('0x6f')](_0xef114c);}})[_0x436f('0x26')](handleError(_0x4460cc,null));};exports[_0x436f('0x73')]=function(_0x12a48b,_0x138917){return db[_0x436f('0x3a')]['find']({'where':{'id':_0x12a48b[_0x436f('0x52')]['id']},'attributes':['securePassword']})[_0x436f('0x1c')](respondWithResult(_0x138917,null))[_0x436f('0x26')](handleError(_0x138917,null));};exports[_0x436f('0x74')]=function(_0x40dba1,_0x28cc99,_0x4fec5b){if(_0x40dba1[_0x436f('0x59')]&&_0x40dba1[_0x436f('0x59')][_0x436f('0x5a')]){_0x40dba1['body']['preferred']=_0x40dba1['file']['filename'];}return db['Setting'][_0x436f('0x56')]({'where':{'id':_0x40dba1[_0x436f('0x52')]['id']}})[_0x436f('0x1c')](handleEntityNotFound(_0x28cc99,null))[_0x436f('0x1c')](saveUpdates(_0x40dba1[_0x436f('0x57')],null))[_0x436f('0x1c')](respondWithResult(_0x28cc99,null))['catch'](handleError(_0x28cc99,null));};var utilLicense=require(_0x436f('0x16'));exports[_0x436f('0x75')]=function(_0x4902a5,_0x5a00fd,_0x46ea4e){var _0x3bca01=_0x436f('0x5e');var _0x3f21d5={'custom':![]};return utilLicense[_0x436f('0x5f')]()[_0x436f('0x1c')](function(_0x284106){if(_0x284106){_0x3f21d5=_0x284106;}return db[_0x436f('0x3a')][_0x436f('0x56')]({'where':{'id':_0x4902a5[_0x436f('0x52')]['id']},'attributes':[_0x436f('0x5b'),'loginLogo',_0x436f('0x76'),_0x436f('0x60'),_0x436f('0x61'),_0x436f('0x62'),_0x436f('0x63'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x5a00fd,null))[_0x436f('0x1c')](function(_0x5c979b){if(_0x5c979b){var _0x9b0f34=_0x5c979b[_0x436f('0x76')]&&fs[_0x436f('0x65')](path[_0x436f('0x66')](config[_0x436f('0x68')],_0x3bca01,_[_0x436f('0x67')](_0x5c979b[_0x436f('0x76')])))?path[_0x436f('0x66')](config[_0x436f('0x68')],_0x3bca01,_['toLower'](_0x5c979b[_0x436f('0x76')])):path[_0x436f('0x66')](config[_0x436f('0x68')],_0x3bca01,_[_0x436f('0x67')](_0x436f('0x77')));var _0x47fce9=_0x436f('0x6a')+_[_0x436f('0x6b')](_0x436f('0x76'));if(_0x5c979b[_0x47fce9]||!_0x3f21d5[_0x436f('0x6c')]||!_0x3f21d5['preferred']){_0x9b0f34=path[_0x436f('0x66')](config[_0x436f('0x68')],_0x3bca01,_['toLower'](_0x436f('0x77')));}if(!fs[_0x436f('0x65')](_0x9b0f34)){throw new db[(_0x436f('0x72'))][(_0x436f('0x6d'))](_['upperFirst'](_0x436f('0x76'))+_0x436f('0x6e'));}return _0x5a00fd[_0x436f('0x6f')](_0x9b0f34);}})['catch'](handleError(_0x5a00fd,null));};exports[_0x436f('0x78')]=function(_0x485380,_0x3577cb,_0x4cc93b){if(_0x485380[_0x436f('0x59')]&&_0x485380[_0x436f('0x59')][_0x436f('0x5a')]){_0x485380[_0x436f('0x57')][_0x436f('0x60')]=_0x485380['file'][_0x436f('0x5a')];}return db[_0x436f('0x3a')][_0x436f('0x56')]({'where':{'id':_0x485380['params']['id']}})[_0x436f('0x1c')](handleEntityNotFound(_0x3577cb,null))[_0x436f('0x1c')](saveUpdates(_0x485380[_0x436f('0x57')],null))[_0x436f('0x1c')](respondWithResult(_0x3577cb,null))[_0x436f('0x26')](handleError(_0x3577cb,null));};var utilLicense=require('../../config/license/util');exports[_0x436f('0x79')]=function(_0x213683,_0x39b31,_0x96d7b5){var _0x27d8de=_0x436f('0x5e');var _0x47b714={'custom':![]};return utilLicense[_0x436f('0x5f')]()[_0x436f('0x1c')](function(_0x2caa43){if(_0x2caa43){_0x47b714=_0x2caa43;}return db['Setting'][_0x436f('0x56')]({'where':{'id':_0x213683[_0x436f('0x52')]['id']},'attributes':[_0x436f('0x5b'),_0x436f('0x5d'),'preferred',_0x436f('0x60'),_0x436f('0x61'),'defaultLoginLogo',_0x436f('0x63'),_0x436f('0x64')],'raw':!![]});})[_0x436f('0x1c')](handleEntityNotFound(_0x39b31,null))[_0x436f('0x1c')](function(_0x303e72){if(_0x303e72){var _0x5c4511=_0x303e72[_0x436f('0x60')]&&fs[_0x436f('0x65')](path[_0x436f('0x66')](config[_0x436f('0x68')],_0x27d8de,_[_0x436f('0x67')](_0x303e72[_0x436f('0x60')])))?path[_0x436f('0x66')](config[_0x436f('0x68')],_0x27d8de,_['toLower'](_0x303e72[_0x436f('0x60')])):path[_0x436f('0x66')](config[_0x436f('0x68')],_0x27d8de,_[_0x436f('0x67')]('default_favicon.ico'));var _0x5a40ee=_0x436f('0x6a')+_[_0x436f('0x6b')](_0x436f('0x60'));if(_0x303e72[_0x5a40ee]||!_0x47b714[_0x436f('0x6c')]){_0x5c4511=path[_0x436f('0x66')](config[_0x436f('0x68')],_0x27d8de,_['toLower'](_0x436f('0x7a')));}if(!fs[_0x436f('0x65')](_0x5c4511)){throw new db[(_0x436f('0x72'))]['ValidationError'](_['upperFirst'](_0x436f('0x60'))+_0x436f('0x6e'));}return _0x39b31[_0x436f('0x6f')](_0x5c4511);}})['catch'](handleError(_0x39b31,null));};exports[_0x436f('0x7b')]=function(_0x1614e9,_0x968334){var _0x5b5a52={'offset':moment()[_0x436f('0x7c')]()};_0x5b5a52['now']=moment()[_0x436f('0x7c')](_0x5b5a52[_0x436f('0x2e')])['format'](_0x436f('0x7d'));return _0x968334[_0x436f('0x28')](0xc8)['send'](_0x5b5a52);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 6b3e1d1..edcb790 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 _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x20f084,_0x241dc2){var _0x2917ba=function(_0x1618a2){while(--_0x1618a2){_0x20f084['push'](_0x20f084['shift']());}};_0x2917ba(++_0x241dc2);}(_0x34e8,0x12c));var _0x834e=function(_0x25349f,_0x526aaa){_0x25349f=_0x25349f-0x0;var _0x1e7a00=_0x34e8[_0x25349f];return _0x1e7a00;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x54a7f7,_0x2411e3){var _0x2af2a=function(_0x4ca01a){while(--_0x4ca01a){_0x54a7f7['push'](_0x54a7f7['shift']());}};_0x2af2a(++_0x2411e3);}(_0xedd9,0xfc));var _0x9edd=function(_0x261d17,_0x115fe1){_0x261d17=_0x261d17-0x0;var _0x5a50da=_0xedd9[_0x261d17];return _0x5a50da;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','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 60f6f50..17db52b 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 _0x6b46=['rpc','../../config/environment','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','map','include','model','info','debug','stringify','lodash','util','moment','bluebird','../../config/logger'];(function(_0x6f078f,_0x460c2b){var _0x5f5375=function(_0x58247e){while(--_0x58247e){_0x6f078f['push'](_0x6f078f['shift']());}};_0x5f5375(++_0x460c2b);}(_0x6b46,0x1db));var _0x66b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b46[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x66b4('0x0'));var util=require(_0x66b4('0x1'));var moment=require(_0x66b4('0x2'));var BPromise=require(_0x66b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66b4('0x4'))(_0x66b4('0x5'));var config=require(_0x66b4('0x6'));var jayson=require(_0x66b4('0x7'));var client=jayson[_0x66b4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x321f72,_0xb93a53,_0x1912d9){return new BPromise(function(_0x10adcc,_0x5b4d4b){return client[_0x66b4('0x9')](_0x321f72,_0x1912d9)[_0x66b4('0xa')](function(_0x51ffe8){logger['info'](_0x66b4('0xb'),_0xb93a53,_0x66b4('0xc'));logger['debug'](_0x66b4('0xd'),_0xb93a53,'request\x20sent',JSON['stringify'](_0x51ffe8));if(_0x51ffe8['error']){if(_0x51ffe8[_0x66b4('0xe')][_0x66b4('0xf')]===0x1f4){logger[_0x66b4('0xe')]('Setting,\x20%s,\x20%s',_0xb93a53,_0x51ffe8[_0x66b4('0xe')][_0x66b4('0x10')]);return _0x5b4d4b(_0x51ffe8['error'][_0x66b4('0x10')]);}logger['error'](_0x66b4('0xb'),_0xb93a53,_0x51ffe8[_0x66b4('0xe')]['message']);return _0x10adcc(_0x51ffe8[_0x66b4('0xe')]['message']);}else{logger['info'](_0x66b4('0xb'),_0xb93a53,_0x66b4('0xc'));_0x10adcc(_0x51ffe8[_0x66b4('0x11')][_0x66b4('0x10')]);}})[_0x66b4('0x12')](function(_0x505d4f){logger['error'](_0x66b4('0xb'),_0xb93a53,_0x505d4f);_0x5b4d4b(_0x505d4f);});});}exports[_0x66b4('0x13')]=function(_0x27a040){var _0x2f749f=this;return new Promise(function(_0x440c8b,_0x5b2822){return db[_0x66b4('0x14')][_0x66b4('0x15')]({'raw':_0x27a040[_0x66b4('0x16')]?_0x27a040['options'][_0x66b4('0x17')]===undefined?!![]:![]:!![],'where':_0x27a040[_0x66b4('0x16')]?_0x27a040[_0x66b4('0x16')][_0x66b4('0x18')]||null:null,'attributes':_0x27a040[_0x66b4('0x16')]?_0x27a040['options'][_0x66b4('0x19')]||null:null,'include':_0x27a040['options']?_0x27a040[_0x66b4('0x16')]['include']?_[_0x66b4('0x1a')](_0x27a040['options'][_0x66b4('0x1b')],function(_0xe52a68){return{'model':db[_0xe52a68[_0x66b4('0x1c')]],'as':_0xe52a68['as'],'attributes':_0xe52a68[_0x66b4('0x19')],'include':_0xe52a68[_0x66b4('0x1b')]?_[_0x66b4('0x1a')](_0xe52a68[_0x66b4('0x1b')],function(_0x35ea43){return{'model':db[_0x35ea43[_0x66b4('0x1c')]],'as':_0x35ea43['as'],'attributes':_0x35ea43[_0x66b4('0x19')],'include':_0x35ea43[_0x66b4('0x1b')]?_[_0x66b4('0x1a')](_0x35ea43[_0x66b4('0x1b')],function(_0x3ce04d){return{'model':db[_0x3ce04d[_0x66b4('0x1c')]],'as':_0x3ce04d['as'],'attributes':_0x3ce04d[_0x66b4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c81bc){logger[_0x66b4('0x1d')](_0x66b4('0x13'),_0x27a040);logger[_0x66b4('0x1e')](_0x66b4('0x13'),_0x27a040,JSON[_0x66b4('0x1f')](_0x2c81bc));_0x440c8b(_0x2c81bc);})['catch'](function(_0xd6a09f){logger[_0x66b4('0xe')](_0x66b4('0x13'),_0xd6a09f[_0x66b4('0x10')],_0x27a040);_0x5b2822(_0x2f749f[_0x66b4('0xe')](0x1f4,_0xd6a09f[_0x66b4('0x10')]));});});}; \ No newline at end of file +var _0xa823=['then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','Setting','find','options','raw','where','attributes','map','model','include','ShowSetting','lodash','util','../../mysqldb','rpc','../../config/environment','http','request'];(function(_0x3805a1,_0x479147){var _0x2f6f7a=function(_0x1bc059){while(--_0x1bc059){_0x3805a1['push'](_0x3805a1['shift']());}};_0x2f6f7a(++_0x479147);}(_0xa823,0x1df));var _0x3a82=function(_0x52e023,_0x2ad7fa){_0x52e023=_0x52e023-0x0;var _0x375823=_0xa823[_0x52e023];return _0x375823;};'use strict';var _=require(_0x3a82('0x0'));var util=require(_0x3a82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a82('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3a82('0x3'));var config=require(_0x3a82('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3a82('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2a8ff9,_0x3da506,_0x54d72a){return new BPromise(function(_0x49e248,_0x905c86){return client[_0x3a82('0x6')](_0x2a8ff9,_0x54d72a)[_0x3a82('0x7')](function(_0x21e2b5){logger[_0x3a82('0x8')](_0x3a82('0x9'),_0x3da506,_0x3a82('0xa'));logger[_0x3a82('0xb')](_0x3a82('0xc'),_0x3da506,_0x3a82('0xa'),JSON['stringify'](_0x21e2b5));if(_0x21e2b5[_0x3a82('0xd')]){if(_0x21e2b5[_0x3a82('0xd')]['code']===0x1f4){logger['error'](_0x3a82('0x9'),_0x3da506,_0x21e2b5[_0x3a82('0xd')][_0x3a82('0xe')]);return _0x905c86(_0x21e2b5['error'][_0x3a82('0xe')]);}logger[_0x3a82('0xd')](_0x3a82('0x9'),_0x3da506,_0x21e2b5[_0x3a82('0xd')][_0x3a82('0xe')]);return _0x49e248(_0x21e2b5[_0x3a82('0xd')][_0x3a82('0xe')]);}else{logger['info'](_0x3a82('0x9'),_0x3da506,_0x3a82('0xa'));_0x49e248(_0x21e2b5[_0x3a82('0xf')][_0x3a82('0xe')]);}})[_0x3a82('0x10')](function(_0x367bf5){logger[_0x3a82('0xd')](_0x3a82('0x9'),_0x3da506,_0x367bf5);_0x905c86(_0x367bf5);});});}exports['ShowSetting']=function(_0x1c70c3){var _0xf54838=this;return new Promise(function(_0x1f48d7,_0x4ff0bf){return db[_0x3a82('0x11')][_0x3a82('0x12')]({'raw':_0x1c70c3[_0x3a82('0x13')]?_0x1c70c3[_0x3a82('0x13')][_0x3a82('0x14')]===undefined?!![]:![]:!![],'where':_0x1c70c3[_0x3a82('0x13')]?_0x1c70c3[_0x3a82('0x13')][_0x3a82('0x15')]||null:null,'attributes':_0x1c70c3[_0x3a82('0x13')]?_0x1c70c3['options'][_0x3a82('0x16')]||null:null,'include':_0x1c70c3[_0x3a82('0x13')]?_0x1c70c3[_0x3a82('0x13')]['include']?_[_0x3a82('0x17')](_0x1c70c3[_0x3a82('0x13')]['include'],function(_0x277974){return{'model':db[_0x277974[_0x3a82('0x18')]],'as':_0x277974['as'],'attributes':_0x277974[_0x3a82('0x16')],'include':_0x277974[_0x3a82('0x19')]?_[_0x3a82('0x17')](_0x277974[_0x3a82('0x19')],function(_0x262dc7){return{'model':db[_0x262dc7[_0x3a82('0x18')]],'as':_0x262dc7['as'],'attributes':_0x262dc7[_0x3a82('0x16')],'include':_0x262dc7['include']?_[_0x3a82('0x17')](_0x262dc7[_0x3a82('0x19')],function(_0x3d1974){return{'model':db[_0x3d1974[_0x3a82('0x18')]],'as':_0x3d1974['as'],'attributes':_0x3d1974[_0x3a82('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12ccd7){logger['info'](_0x3a82('0x1a'),_0x1c70c3);logger[_0x3a82('0xb')]('ShowSetting',_0x1c70c3,JSON['stringify'](_0x12ccd7));_0x1f48d7(_0x12ccd7);})[_0x3a82('0x10')](function(_0x4349cc){logger[_0x3a82('0xd')](_0x3a82('0x1a'),_0x4349cc[_0x3a82('0xe')],_0x1c70c3);_0x4ff0bf(_0xf54838[_0x3a82('0xd')](0x1f4,_0x4349cc[_0x3a82('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 078f6e9..7af0dd1 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 _0x53ec=['send','status','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send'];(function(_0x389f7f,_0x367c41){var _0x48e731=function(_0xef13d1){while(--_0xef13d1){_0x389f7f['push'](_0x389f7f['shift']());}};_0x48e731(++_0x367c41);}(_0x53ec,0x192));var _0xc53e=function(_0x34ad4f,_0x3b9428){_0x34ad4f=_0x34ad4f-0x0;var _0x1a868f=_0x53ec[_0x34ad4f];return _0x1a868f;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),controller[_0xc53e('0x15')]);router[_0xc53e('0xa')](_0xc53e('0x16'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0x18')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x19')]);router[_0xc53e('0x18')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router[_0xc53e('0x18')]('/:id/notify',controller['notify']);router[_0xc53e('0x18')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);router[_0xc53e('0x18')](_0xc53e('0x1d'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x18')](_0xc53e('0x14'),controller[_0xc53e('0x1f')]);router[_0xc53e('0x18')](_0xc53e('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc53e('0x21')]('/:id/dispositions',auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router[_0xc53e('0x21')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc53e('0x23')]=router; \ No newline at end of file +var _0x8ef6=['addApplications','/:id/send','send','status','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify'];(function(_0x5ee2f1,_0x361461){var _0x430714=function(_0x3d07f3){while(--_0x3d07f3){_0x5ee2f1['push'](_0x5ee2f1['shift']());}};_0x430714(++_0x361461);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2ab711,_0x1d8bbd){_0x2ab711=_0x2ab711-0x0;var _0x25e17a=_0x8ef6[_0x2ab711];return _0x25e17a;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xa')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0xa')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router['get'](_0x68ef('0x13'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);router[_0x68ef('0xa')](_0x68ef('0x15'),auth[_0x68ef('0xc')](),controller['getInteractions']);router[_0x68ef('0xa')](_0x68ef('0x16'),controller[_0x68ef('0x17')]);router['get'](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x19')]);router['post']('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xf'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);router['post']('/:id/canned_answers',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1d')]);router['post']('/:id/notify',controller[_0x68ef('0x1e')]);router[_0x68ef('0x1b')](_0x68ef('0x13'),auth['isAuthenticated'](),controller[_0x68ef('0x1f')]);router[_0x68ef('0x1b')](_0x68ef('0x20'),auth['isAuthenticated'](),controller[_0x68ef('0x21')]);router[_0x68ef('0x1b')]('/:id/status',controller[_0x68ef('0x22')]);router[_0x68ef('0x1b')](_0x68ef('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x23')]);router[_0x68ef('0x24')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x25')]);router[_0x68ef('0x24')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller['removeDispositions']);router[_0x68ef('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x68ef('0x24')](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x26')]);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 2ff8ffa..ead2498 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 _0x2535=['twilio','connectel','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','randomstring','exports','name','STRING','generate','ENUM'];(function(_0x3f427e,_0x1f16af){var _0x2edf3b=function(_0x13e468){while(--_0x13e468){_0x3f427e['push'](_0x3f427e['shift']());}};_0x2edf3b(++_0x1f16af);}(_0x2535,0xd6));var _0x5253=function(_0x2d3736,_0x1af464){_0x2d3736=_0x2d3736-0x0;var _0xb8ebc5=_0x2535[_0x2d3736];return _0xb8ebc5;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x5253('0x0'));module[_0x5253('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5253('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x5253('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5253('0x4')]();}},'phone':{'type':Sequelize[_0x5253('0x3')]},'type':{'type':Sequelize[_0x5253('0x5')](_0x5253('0x6'),'skebby',_0x5253('0x7'),_0x5253('0x8'),_0x5253('0x9'),_0x5253('0xa'),_0x5253('0xb'),'csc',_0x5253('0xc'),_0x5253('0xd'))},'accountSid':{'type':Sequelize[_0x5253('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x5253('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x5253('0x3')]},'password':{'type':Sequelize[_0x5253('0x3')]},'apiKey':{'type':Sequelize[_0x5253('0x3')]},'applicationId':{'type':Sequelize[_0x5253('0x3')]},'accountId':{'type':Sequelize[_0x5253('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x5253('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x5253('0x3')]},'notificationTemplate':{'type':Sequelize[_0x5253('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[_0x5253('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5253('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5253('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5253('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x5253('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5253('0x10')],'comment':_0x5253('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x5253('0xe')],'defaultValue':![],'comment':_0x5253('0x12'),'set':function(_0x5beee2){if(!_0x5beee2)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x5253('0x13'),_0x5beee2);}}}; \ No newline at end of file +var _0x1736=['plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','STRING','generate','ENUM','skebby','connectel'];(function(_0x5aa794,_0x42cb11){var _0x5ccfb1=function(_0xd1da97){while(--_0xd1da97){_0x5aa794['push'](_0x5aa794['shift']());}};_0x5ccfb1(++_0x42cb11);}(_0x1736,0x162));var _0x6173=function(_0x115f1e,_0x1eb981){_0x115f1e=_0x115f1e-0x0;var _0x258a95=_0x1736[_0x115f1e];return _0x258a95;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6173('0x0'));module['exports']={'name':{'type':Sequelize[_0x6173('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x6173('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x6173('0x1')],'defaultValue':function(){return rs[_0x6173('0x2')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6173('0x3')]('twilio',_0x6173('0x4'),_0x6173('0x5'),'clicksend',_0x6173('0x6'),_0x6173('0x7'),_0x6173('0x8'),_0x6173('0x9'),'infobip',_0x6173('0xa'))},'accountSid':{'type':Sequelize[_0x6173('0x1')]},'authId':{'type':Sequelize[_0x6173('0x1')]},'authToken':{'type':Sequelize[_0x6173('0x1')]},'smsMethod':{'type':Sequelize[_0x6173('0x3')]('SI','TI','GP')},'username':{'type':Sequelize[_0x6173('0x1')]},'password':{'type':Sequelize[_0x6173('0x1')]},'apiKey':{'type':Sequelize[_0x6173('0x1')]},'applicationId':{'type':Sequelize[_0x6173('0x1')]},'accountId':{'type':Sequelize[_0x6173('0x1')]},'senderString':{'type':Sequelize[_0x6173('0x1')]},'deliveryReport':{'type':Sequelize[_0x6173('0xb')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6173('0xc');}},'notificationSound':{'type':Sequelize[_0x6173('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6173('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6173('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6173('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6173('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6173('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6173('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x6173('0xe')},'mandatoryDisposition':{'type':Sequelize[_0x6173('0xb')],'defaultValue':![],'comment':_0x6173('0xf'),'set':function(_0x53748e){if(!_0x53748e)this[_0x6173('0x10')]('mandatoryDispositionPauseId',null);this[_0x6173('0x10')](_0x6173('0x11'),_0x53748e);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 9c3fca2..0e04cf3 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 _0x41eb=['reject','destroy','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','index','map','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','SmsAccount','includeAll','include','findAll','rows','show','Pause','rawAttributes','keys','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','mandatoryDispositionPause','params','describe','SmsAccountId','Disposition','getDispositions','order','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','twilio','from','From','Body','MessageSid','skebby','text','connectel','clicksend','messageId','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','replyMessageId','bandwidth','intelepeer','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','CmList','DESC','list','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','User','UserId','agent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','SmsApplication','bulkCreate','getApplications','getInteractions','Contact','fullname','internal','Tags','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','skebby_dispatch_id','requestid','status_code','message_id','DELIVERED','groupName','redif','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','state','message-id','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','end','status','offset','undefined','limit','count','set','Content-Range','json','apply'];(function(_0x20715a,_0x1a636c){var _0x3dcc4b=function(_0x425752){while(--_0x425752){_0x20715a['push'](_0x20715a['shift']());}};_0x3dcc4b(++_0x1a636c);}(_0x41eb,0x189));var _0xb41e=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0x41eb[_0x23a79e];return _0x3dab57;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb41e('0x0'));var zipdir=require(_0xb41e('0x1'));var jsonpatch=require(_0xb41e('0x2'));var rp=require(_0xb41e('0x3'));var moment=require(_0xb41e('0x4'));var BPromise=require(_0xb41e('0x5'));var Mustache=require(_0xb41e('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb41e('0x7'));var csv=require('to-csv');var ejs=require(_0xb41e('0x8'));var fs=require('fs');var fs_extra=require(_0xb41e('0x9'));var _=require(_0xb41e('0xa'));var squel=require('squel');var crypto=require(_0xb41e('0xb'));var jsforce=require(_0xb41e('0xc'));var deskjs=require(_0xb41e('0xd'));var toCsv=require(_0xb41e('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb41e('0xf'));var authService=require(_0xb41e('0x10'));var qs=require(_0xb41e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb41e('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xb41e('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb41e('0x14'))['db'];config[_0xb41e('0x15')]=_[_0xb41e('0x16')](config[_0xb41e('0x15')],{'host':_0xb41e('0x17'),'port':0x18eb});var socket=require(_0xb41e('0x18'))(new Redis(config[_0xb41e('0x15')]));require(_0xb41e('0x19'))[_0xb41e('0x1a')](socket);var jayson=require(_0xb41e('0x1b'));var client=jayson[_0xb41e('0x1c')][_0xb41e('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x414ed9,_0x4ed766,_0x32cb45,_0x7dba5d){return new BPromise(function(_0x3b550b,_0x6a68ab){var _0x5f8998=_0x7dba5d||client;return _0x5f8998[_0xb41e('0x1e')](_0x414ed9,_0x32cb45)[_0xb41e('0x1f')](function(_0x271006){logger[_0xb41e('0x20')](_0xb41e('0x21'),_0x4ed766,_0xb41e('0x22'));logger[_0xb41e('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4ed766,_0xb41e('0x22'),JSON[_0xb41e('0x24')](_0x271006));if(_0x271006['error']){if(_0x271006[_0xb41e('0x25')]['code']===0x1f4){logger['error'](_0xb41e('0x21'),_0x4ed766,_0x271006['error'][_0xb41e('0x26')]);return _0x6a68ab(_0x271006[_0xb41e('0x25')][_0xb41e('0x26')]);}logger[_0xb41e('0x25')](_0xb41e('0x21'),_0x4ed766,_0x271006[_0xb41e('0x25')][_0xb41e('0x26')]);return _0x3b550b(_0x271006[_0xb41e('0x25')][_0xb41e('0x26')]);}else{logger[_0xb41e('0x20')](_0xb41e('0x21'),_0x4ed766,'request\x20sent');_0x3b550b(_0x271006[_0xb41e('0x27')][_0xb41e('0x26')]);}})[_0xb41e('0x28')](function(_0xb98fb4){logger[_0xb41e('0x25')](_0xb41e('0x21'),_0x4ed766,_0xb98fb4);_0x6a68ab(_0xb98fb4);});});}function respondWithStatusCode(_0x3ebed6,_0x23ef87){_0x23ef87=_0x23ef87||0xcc;return function(_0x331d68){if(_0x331d68){return _0x3ebed6['sendStatus'](_0x23ef87);}return _0x3ebed6['status'](_0x23ef87)[_0xb41e('0x29')]();};}function respondWithResult(_0x120b4f,_0x581556){_0x581556=_0x581556||0xc8;return function(_0x3b74e1){if(_0x3b74e1){return _0x120b4f[_0xb41e('0x2a')](_0x581556)['json'](_0x3b74e1);}};}function respondWithFilteredResult(_0x55f0ec,_0x3ff6bd){return function(_0x35cf61){if(_0x35cf61){var _0x3a3a2d=typeof _0x3ff6bd[_0xb41e('0x2b')]===_0xb41e('0x2c')&&typeof _0x3ff6bd[_0xb41e('0x2d')]===_0xb41e('0x2c');var _0x54fa9a=_0x35cf61['count'];var _0x2bd7ba=_0x3a3a2d?0x0:_0x3ff6bd[_0xb41e('0x2b')];var _0x3965c6=_0x3a3a2d?_0x35cf61[_0xb41e('0x2e')]:_0x3ff6bd[_0xb41e('0x2b')]+_0x3ff6bd[_0xb41e('0x2d')];var _0x22a7cd;if(_0x3965c6>=_0x54fa9a){_0x3965c6=_0x54fa9a;_0x22a7cd=0xc8;}else{_0x22a7cd=0xce;}_0x55f0ec[_0xb41e('0x2a')](_0x22a7cd);return _0x55f0ec[_0xb41e('0x2f')](_0xb41e('0x30'),_0x2bd7ba+'-'+_0x3965c6+'/'+_0x54fa9a)[_0xb41e('0x31')](_0x35cf61);}return null;};}function patchUpdates(_0x42fbee){return function(_0x35de33){try{jsonpatch[_0xb41e('0x32')](_0x35de33,_0x42fbee,!![]);}catch(_0xff8b43){return BPromise[_0xb41e('0x33')](_0xff8b43);}return _0x35de33['save']();};}function saveUpdates(_0x2cde06,_0x1f1697){return function(_0x46f492){if(_0x46f492){return _0x46f492['update'](_0x2cde06)[_0xb41e('0x1f')](function(_0x5c4eb0){return _0x5c4eb0;});}return null;};}function removeEntity(_0x153fd9,_0x376ed0){return function(_0x5d4cab){if(_0x5d4cab){return _0x5d4cab[_0xb41e('0x34')]()[_0xb41e('0x1f')](function(){var _0x1efe7c=_0x5d4cab['get']({'plain':!![]});var _0x108417=_0xb41e('0x35');return db[_0xb41e('0x36')][_0xb41e('0x34')]({'where':{'type':_0x108417,'resourceId':_0x1efe7c['id']}})[_0xb41e('0x1f')](function(){return _0x5d4cab;});})[_0xb41e('0x1f')](function(){_0x153fd9[_0xb41e('0x2a')](0xcc)[_0xb41e('0x29')]();});}};}function handleEntityNotFound(_0x5f0a30,_0x4061f1){return function(_0x281b68){if(!_0x281b68){_0x5f0a30[_0xb41e('0x37')](0x194);}return _0x281b68;};}function handleError(_0x1fd881,_0x1f7549){_0x1f7549=_0x1f7549||0x1f4;return function(_0xf640f9){logger[_0xb41e('0x25')](_0xf640f9[_0xb41e('0x38')]);if(_0xf640f9[_0xb41e('0x39')]){delete _0xf640f9['name'];}_0x1fd881[_0xb41e('0x2a')](_0x1f7549)[_0xb41e('0x3a')](_0xf640f9);};}exports[_0xb41e('0x3b')]=function(_0x1a592b,_0x5818bb){var _0x15e6ae={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5ce532={},_0x27fd71={'count':0x0,'rows':[]};var _0x4eaa02=_[_0xb41e('0x3c')](db['SmsAccount']['rawAttributes'],function(_0x139f62){return{'name':_0x139f62['fieldName'],'type':_0x139f62[_0xb41e('0x3d')][_0xb41e('0x3e')]};});_0x5ce532['model']=_[_0xb41e('0x3c')](_0x4eaa02,_0xb41e('0x39'));_0x5ce532[_0xb41e('0x3f')]=_['keys'](_0x1a592b[_0xb41e('0x3f')]);_0x5ce532[_0xb41e('0x40')]=_[_0xb41e('0x41')](_0x5ce532['model'],_0x5ce532['query']);_0x15e6ae['attributes']=_[_0xb41e('0x41')](_0x5ce532[_0xb41e('0x42')],qs[_0xb41e('0x43')](_0x1a592b[_0xb41e('0x3f')][_0xb41e('0x43')]));_0x15e6ae[_0xb41e('0x44')]=_0x15e6ae[_0xb41e('0x44')][_0xb41e('0x45')]?_0x15e6ae[_0xb41e('0x44')]:_0x5ce532[_0xb41e('0x42')];if(!_0x1a592b[_0xb41e('0x3f')][_0xb41e('0x46')](_0xb41e('0x47'))){_0x15e6ae['limit']=qs[_0xb41e('0x2d')](_0x1a592b[_0xb41e('0x3f')][_0xb41e('0x2d')]);_0x15e6ae[_0xb41e('0x2b')]=qs[_0xb41e('0x2b')](_0x1a592b['query'][_0xb41e('0x2b')]);}_0x15e6ae['order']=qs[_0xb41e('0x48')](_0x1a592b[_0xb41e('0x3f')][_0xb41e('0x48')]);_0x15e6ae[_0xb41e('0x49')]=qs[_0xb41e('0x40')](_['pick'](_0x1a592b[_0xb41e('0x3f')],_0x5ce532[_0xb41e('0x40')]),_0x4eaa02);if(_0x1a592b[_0xb41e('0x3f')][_0xb41e('0x4a')]){_0x15e6ae[_0xb41e('0x49')]=_[_0xb41e('0x4b')](_0x15e6ae['where'],{'$or':_[_0xb41e('0x3c')](_0x4eaa02,function(_0x3a64ed){if(_0x3a64ed[_0xb41e('0x3d')]!=='VIRTUAL'){var _0x545a77={};_0x545a77[_0x3a64ed[_0xb41e('0x39')]]={'$like':'%'+_0x1a592b[_0xb41e('0x3f')][_0xb41e('0x4a')]+'%'};return _0x545a77;}})});}_0x15e6ae=_[_0xb41e('0x4b')]({},_0x15e6ae,_0x1a592b['options']);var _0xdb7be6={'where':_0x15e6ae[_0xb41e('0x49')]};return db[_0xb41e('0x4c')]['count'](_0xdb7be6)[_0xb41e('0x1f')](function(_0x24e913){_0x27fd71[_0xb41e('0x2e')]=_0x24e913;if(_0x1a592b[_0xb41e('0x3f')][_0xb41e('0x4d')]){_0x15e6ae[_0xb41e('0x4e')]=[{'all':!![]}];}return db[_0xb41e('0x4c')][_0xb41e('0x4f')](_0x15e6ae);})[_0xb41e('0x1f')](function(_0x19f77a){_0x27fd71[_0xb41e('0x50')]=_0x19f77a;return _0x27fd71;})[_0xb41e('0x1f')](respondWithFilteredResult(_0x5818bb,_0x15e6ae))[_0xb41e('0x28')](handleError(_0x5818bb,null));};exports[_0xb41e('0x51')]=function(_0x17aeb8,_0x1bb03f){var _0x14aa11={'raw':![],'where':{'id':_0x17aeb8['params']['id']},'include':[{'model':db[_0xb41e('0x52')],'as':'mandatoryDispositionPause'}]},_0x4c46ef={};_0x4c46ef['model']=_['keys'](db[_0xb41e('0x4c')][_0xb41e('0x53')]);_0x4c46ef[_0xb41e('0x3f')]=_[_0xb41e('0x54')](_0x17aeb8[_0xb41e('0x3f')]);_0x4c46ef[_0xb41e('0x40')]=_[_0xb41e('0x41')](_0x4c46ef[_0xb41e('0x42')],_0x4c46ef[_0xb41e('0x3f')]);_0x14aa11[_0xb41e('0x44')]=_[_0xb41e('0x41')](_0x4c46ef[_0xb41e('0x42')],qs[_0xb41e('0x43')](_0x17aeb8[_0xb41e('0x3f')][_0xb41e('0x43')]));_0x14aa11[_0xb41e('0x44')]=_0x14aa11[_0xb41e('0x44')][_0xb41e('0x45')]?_0x14aa11[_0xb41e('0x44')]:_0x4c46ef['model'];if(_0x17aeb8[_0xb41e('0x3f')][_0xb41e('0x4d')]){_0x14aa11[_0xb41e('0x4e')]=[{'all':!![]}];}_0x14aa11=_[_0xb41e('0x4b')]({},_0x14aa11,_0x17aeb8[_0xb41e('0x55')]);return db[_0xb41e('0x4c')][_0xb41e('0x56')](_0x14aa11)[_0xb41e('0x1f')](handleEntityNotFound(_0x1bb03f,null))[_0xb41e('0x1f')](respondWithResult(_0x1bb03f,null))[_0xb41e('0x28')](handleError(_0x1bb03f,null));};exports[_0xb41e('0x57')]=function(_0x432dc1,_0x155161){return db[_0xb41e('0x4c')]['create'](_0x432dc1[_0xb41e('0x58')],{})[_0xb41e('0x1f')](function(_0x569282){var _0x430675=_0x432dc1[_0xb41e('0x59')][_0xb41e('0x5a')]({'plain':!![]});if(!_0x430675)throw new Error(_0xb41e('0x5b'));if(_0x430675[_0xb41e('0x5c')]==='user'){var _0x114f8f=_0x569282[_0xb41e('0x5a')]({'plain':!![]});var _0x30f333=_0xb41e('0x35');return db[_0xb41e('0x5d')]['find']({'where':{'name':_0x30f333,'userProfileId':_0x430675['userProfileId']},'raw':!![]})['then'](function(_0x5c90a6){if(_0x5c90a6&&_0x5c90a6[_0xb41e('0x5e')]===0x0){return db[_0xb41e('0x36')][_0xb41e('0x57')]({'name':_0x114f8f[_0xb41e('0x39')],'resourceId':_0x114f8f['id'],'type':_0x5c90a6[_0xb41e('0x39')],'sectionId':_0x5c90a6['id']},{})[_0xb41e('0x1f')](function(){return _0x569282;});}else{return _0x569282;}})[_0xb41e('0x28')](function(_0x14114b){logger[_0xb41e('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14114b);throw _0x14114b;});}return _0x569282;})[_0xb41e('0x1f')](respondWithResult(_0x155161,0xc9))[_0xb41e('0x28')](handleError(_0x155161,null));};exports[_0xb41e('0x5f')]=function(_0x4dda11,_0x4ad806){if(_0x4dda11['body']['id']){delete _0x4dda11[_0xb41e('0x58')]['id'];}return db[_0xb41e('0x4c')][_0xb41e('0x56')]({'where':{'id':_0x4dda11['params']['id']},'include':[{'model':db[_0xb41e('0x52')],'as':_0xb41e('0x60')}]})[_0xb41e('0x1f')](handleEntityNotFound(_0x4ad806,null))[_0xb41e('0x1f')](saveUpdates(_0x4dda11[_0xb41e('0x58')],null))[_0xb41e('0x1f')](respondWithResult(_0x4ad806,null))[_0xb41e('0x28')](handleError(_0x4ad806,null));};exports[_0xb41e('0x34')]=function(_0x4ed5d0,_0x3441e5){return db[_0xb41e('0x4c')][_0xb41e('0x56')]({'where':{'id':_0x4ed5d0[_0xb41e('0x61')]['id']}})[_0xb41e('0x1f')](handleEntityNotFound(_0x3441e5,null))[_0xb41e('0x1f')](removeEntity(_0x3441e5,null))['catch'](handleError(_0x3441e5,null));};exports[_0xb41e('0x62')]=function(_0xf2b3d9,_0x353bd3){return db['SmsAccount'][_0xb41e('0x62')]()[_0xb41e('0x1f')](respondWithResult(_0x353bd3,null))[_0xb41e('0x28')](handleError(_0x353bd3,null));};exports['addDisposition']=function(_0x7c02db,_0x2e835b,_0x1b7989){if(_0x7c02db[_0xb41e('0x58')]['id']){delete _0x7c02db[_0xb41e('0x58')]['id'];}return db[_0xb41e('0x4c')][_0xb41e('0x56')]({'where':{'id':_0x7c02db['params']['id']}})[_0xb41e('0x1f')](handleEntityNotFound(_0x2e835b,null))[_0xb41e('0x1f')](function(_0x5934c6){if(_0x5934c6){_0x7c02db[_0xb41e('0x58')][_0xb41e('0x63')]=_0x5934c6['id'];return db[_0xb41e('0x64')][_0xb41e('0x57')](_0x7c02db['body']);}})[_0xb41e('0x1f')](respondWithResult(_0x2e835b,null))[_0xb41e('0x28')](handleError(_0x2e835b,null));};exports[_0xb41e('0x65')]=function(_0x19bdb7,_0xb8b3ab,_0x2ee10e){var _0x4683bb={'raw':![],'where':{}};var _0x648b1a={};var _0x4c8999={'count':0x0,'rows':[]};return db[_0xb41e('0x4c')]['findOne']({'where':{'id':_0x19bdb7['params']['id']}})[_0xb41e('0x1f')](handleEntityNotFound(_0xb8b3ab,null))['then'](function(_0x2cebd8){if(_0x2cebd8){_0x648b1a['model']=_[_0xb41e('0x54')](db[_0xb41e('0x64')][_0xb41e('0x53')]);_0x648b1a[_0xb41e('0x3f')]=_[_0xb41e('0x54')](_0x19bdb7[_0xb41e('0x3f')]);_0x648b1a[_0xb41e('0x40')]=_[_0xb41e('0x41')](_0x648b1a[_0xb41e('0x42')],_0x648b1a[_0xb41e('0x3f')]);_0x4683bb[_0xb41e('0x44')]=_[_0xb41e('0x41')](_0x648b1a[_0xb41e('0x42')],qs[_0xb41e('0x43')](_0x19bdb7['query'][_0xb41e('0x43')]));_0x4683bb[_0xb41e('0x44')]=_0x4683bb['attributes'][_0xb41e('0x45')]?_0x4683bb[_0xb41e('0x44')]:_0x648b1a[_0xb41e('0x42')];if(!_0x19bdb7['query']['hasOwnProperty'](_0xb41e('0x47'))){_0x4683bb['limit']=qs[_0xb41e('0x2d')](_0x19bdb7[_0xb41e('0x3f')][_0xb41e('0x2d')]);_0x4683bb[_0xb41e('0x2b')]=qs[_0xb41e('0x2b')](_0x19bdb7['query'][_0xb41e('0x2b')]);}_0x4683bb[_0xb41e('0x66')]=qs['sort'](_0x19bdb7['query'][_0xb41e('0x48')]);_0x4683bb[_0xb41e('0x49')]=qs[_0xb41e('0x40')](_[_0xb41e('0x67')](_0x19bdb7[_0xb41e('0x3f')],_0x648b1a[_0xb41e('0x40')]));_0x4683bb['where'][_0xb41e('0x63')]=_0x2cebd8['id'];if(_0x19bdb7[_0xb41e('0x3f')][_0xb41e('0x4a')]){_0x4683bb[_0xb41e('0x49')]=_[_0xb41e('0x4b')](_0x4683bb[_0xb41e('0x49')],{'$or':_['map'](_0x4683bb[_0xb41e('0x44')],function(_0x13db57){var _0x110cf1={};_0x110cf1[_0x13db57]={'$like':'%'+_0x19bdb7['query'][_0xb41e('0x4a')]+'%'};return _0x110cf1;})});}_0x4683bb=_[_0xb41e('0x4b')]({},_0x4683bb,_0x19bdb7[_0xb41e('0x55')]);return db['Disposition'][_0xb41e('0x2e')]({'where':_0x4683bb['where']})[_0xb41e('0x1f')](function(_0x27bced){_0x4c8999[_0xb41e('0x2e')]=_0x27bced;if(_0x19bdb7[_0xb41e('0x3f')]['includeAll']){_0x4683bb[_0xb41e('0x4e')]=[{'all':!![]}];}return db[_0xb41e('0x64')]['findAll'](_0x4683bb);})[_0xb41e('0x1f')](function(_0xb747f1){_0x4c8999['rows']=_0xb747f1;return _0x4c8999;});}})[_0xb41e('0x1f')](respondWithFilteredResult(_0xb8b3ab,_0x4683bb))[_0xb41e('0x28')](handleError(_0xb8b3ab,null));};exports[_0xb41e('0x68')]=function(_0x25263a,_0x186900,_0x305cd5){return db[_0xb41e('0x4c')][_0xb41e('0x56')]({'where':{'id':_0x25263a[_0xb41e('0x61')]['id']}})[_0xb41e('0x1f')](handleEntityNotFound(_0x186900,null))[_0xb41e('0x1f')](function(_0x32915d){if(_0x32915d){return _0x32915d[_0xb41e('0x68')](_0x25263a[_0xb41e('0x3f')][_0xb41e('0x69')]);}})[_0xb41e('0x1f')](respondWithStatusCode(_0x186900,null))[_0xb41e('0x28')](handleError(_0x186900,null));};exports[_0xb41e('0x6a')]=function(_0x1d95da,_0x3e852c,_0x539d48){if(_0x1d95da[_0xb41e('0x58')]['id']){delete _0x1d95da[_0xb41e('0x58')]['id'];}return db[_0xb41e('0x4c')][_0xb41e('0x56')]({'where':{'id':_0x1d95da[_0xb41e('0x61')]['id']}})[_0xb41e('0x1f')](handleEntityNotFound(_0x3e852c,null))[_0xb41e('0x1f')](function(_0x57d3b6){if(_0x57d3b6){_0x1d95da[_0xb41e('0x58')][_0xb41e('0x63')]=_0x57d3b6['id'];return db[_0xb41e('0x6b')][_0xb41e('0x57')](_0x1d95da[_0xb41e('0x58')]);}})['then'](respondWithResult(_0x3e852c,null))[_0xb41e('0x28')](handleError(_0x3e852c,null));};exports[_0xb41e('0x6c')]=function(_0x1184fd,_0x51aee1,_0x5c9f74){var _0x325096={'raw':![],'where':{}};var _0x1ac93f={};var _0x52e10e={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x1184fd['params']['id']}})[_0xb41e('0x1f')](handleEntityNotFound(_0x51aee1,null))[_0xb41e('0x1f')](function(_0x24b484){if(_0x24b484){_0x1ac93f['model']=_[_0xb41e('0x54')](db[_0xb41e('0x6b')][_0xb41e('0x53')]);_0x1ac93f[_0xb41e('0x3f')]=_['keys'](_0x1184fd[_0xb41e('0x3f')]);_0x1ac93f[_0xb41e('0x40')]=_[_0xb41e('0x41')](_0x1ac93f[_0xb41e('0x42')],_0x1ac93f[_0xb41e('0x3f')]);_0x325096[_0xb41e('0x44')]=_[_0xb41e('0x41')](_0x1ac93f['model'],qs[_0xb41e('0x43')](_0x1184fd[_0xb41e('0x3f')]['fields']));_0x325096['attributes']=_0x325096['attributes'][_0xb41e('0x45')]?_0x325096['attributes']:_0x1ac93f[_0xb41e('0x42')];if(!_0x1184fd[_0xb41e('0x3f')]['hasOwnProperty'](_0xb41e('0x47'))){_0x325096['limit']=qs[_0xb41e('0x2d')](_0x1184fd['query'][_0xb41e('0x2d')]);_0x325096['offset']=qs['offset'](_0x1184fd[_0xb41e('0x3f')][_0xb41e('0x2b')]);}_0x325096['order']=qs['sort'](_0x1184fd[_0xb41e('0x3f')][_0xb41e('0x48')]);_0x325096[_0xb41e('0x49')]=qs['filters'](_[_0xb41e('0x67')](_0x1184fd[_0xb41e('0x3f')],_0x1ac93f[_0xb41e('0x40')]));_0x325096[_0xb41e('0x49')]['SmsAccountId']=_0x24b484['id'];if(_0x1184fd[_0xb41e('0x3f')]['filter']){_0x325096['where']=_[_0xb41e('0x4b')](_0x325096[_0xb41e('0x49')],{'$or':_[_0xb41e('0x3c')](_0x325096[_0xb41e('0x44')],function(_0x68d16){var _0x23c5e6={};_0x23c5e6[_0x68d16]={'$like':'%'+_0x1184fd[_0xb41e('0x3f')][_0xb41e('0x4a')]+'%'};return _0x23c5e6;})});}_0x325096=_[_0xb41e('0x4b')]({},_0x325096,_0x1184fd[_0xb41e('0x55')]);return db[_0xb41e('0x6b')]['count']({'where':_0x325096[_0xb41e('0x49')]})['then'](function(_0x20e7b6){_0x52e10e[_0xb41e('0x2e')]=_0x20e7b6;if(_0x1184fd[_0xb41e('0x3f')][_0xb41e('0x4d')]){_0x325096[_0xb41e('0x4e')]=[{'all':!![]}];}return db[_0xb41e('0x6b')][_0xb41e('0x4f')](_0x325096);})[_0xb41e('0x1f')](function(_0x5dd9cd){_0x52e10e['rows']=_0x5dd9cd;return _0x52e10e;});}})[_0xb41e('0x1f')](respondWithFilteredResult(_0x51aee1,_0x325096))[_0xb41e('0x28')](handleError(_0x51aee1,null));};exports['removeAnswers']=function(_0x48c58a,_0x4d37a9,_0xccafed){return db[_0xb41e('0x4c')][_0xb41e('0x56')]({'where':{'id':_0x48c58a[_0xb41e('0x61')]['id']}})['then'](handleEntityNotFound(_0x4d37a9,null))[_0xb41e('0x1f')](function(_0x725cde){if(_0x725cde){return _0x725cde[_0xb41e('0x6d')](_0x48c58a[_0xb41e('0x3f')][_0xb41e('0x69')]);}})[_0xb41e('0x1f')](respondWithStatusCode(_0x4d37a9,null))[_0xb41e('0x28')](handleError(_0x4d37a9,null));};exports[_0xb41e('0x6e')]=function(_0x1e3323,_0x2b3c73,_0x248391){var _0x27f84d={'channel':_0xb41e('0x6f')};var _0xfb076a=[];var _0x401dfe=[];var _0x52ec11={};return db['SmsAccount'][_0xb41e('0x56')]({'where':{'id':_0x1e3323[_0xb41e('0x61')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xb41e('0x70')}]})[_0xb41e('0x1f')](handleEntityNotFound(_0x2b3c73,null))[_0xb41e('0x1f')](function(_0x2d3f4f){_0x27f84d[_0xb41e('0x71')]=_0x2d3f4f;_0x27f84d[_0xb41e('0x72')]=_[_0xb41e('0x73')](_0x2d3f4f[_0xb41e('0x70')],[_0xb41e('0x74')],[_0xb41e('0x75')]);if(_0x27f84d['account'][_0xb41e('0x70')]){delete _0x27f84d['account']['Applications'];}return db[_0xb41e('0x76')][_0xb41e('0x62')]();})[_0xb41e('0x1f')](function(_0xef563e){if(!_0xef563e){throw new db['Sequelize'][(_0xb41e('0x77'))](_0xb41e('0x78'));}_0xfb076a=_['difference'](_[_0xb41e('0x54')](_0xef563e),[_0xb41e('0x79'),_0xb41e('0x7a')]);_0x401dfe=_[_0xb41e('0x7b')](_[_0xb41e('0x54')](_0xef563e),[_0xb41e('0x79'),_0xb41e('0x7a'),_0xb41e('0x7c'),'ListId']);_0x27f84d[_0xb41e('0x58')]={'mapKey':_0xb41e('0x7d')};if(_0x27f84d[_0xb41e('0x71')][_0xb41e('0x3d')]){switch(_0x27f84d[_0xb41e('0x71')][_0xb41e('0x3d')]){case _0xb41e('0x7e'):_0x27f84d['body'][_0xb41e('0x7f')]=_0x1e3323['body'][_0xb41e('0x80')];_0x27f84d['body'][_0xb41e('0x58')]=_0x1e3323[_0xb41e('0x58')][_0xb41e('0x81')];_0x27f84d[_0xb41e('0x58')]['messageId']=_0x1e3323[_0xb41e('0x58')][_0xb41e('0x82')];break;case _0xb41e('0x83'):_0x27f84d['body'][_0xb41e('0x7f')]='+'+_0x1e3323[_0xb41e('0x58')]['sender'];_0x27f84d[_0xb41e('0x58')][_0xb41e('0x58')]=_0x1e3323['body'][_0xb41e('0x84')];break;case _0xb41e('0x85'):_0x27f84d[_0xb41e('0x58')][_0xb41e('0x7f')]=_0x1e3323[_0xb41e('0x58')]['from'];_0x27f84d['body']['body']=_0x1e3323['body'][_0xb41e('0x26')];break;case _0xb41e('0x86'):_0x27f84d[_0xb41e('0x58')]['from']=_0x1e3323[_0xb41e('0x58')][_0xb41e('0x7f')];_0x27f84d['body']['body']=_0x1e3323[_0xb41e('0x58')][_0xb41e('0x58')];_0x27f84d[_0xb41e('0x58')][_0xb41e('0x87')]=_0x1e3323[_0xb41e('0x58')]['message_id'];break;case'plivo':_0x27f84d['body'][_0xb41e('0x7f')]=_0x1e3323[_0xb41e('0x58')][_0xb41e('0x80')];_0x27f84d['body'][_0xb41e('0x58')]=_0x1e3323[_0xb41e('0x58')][_0xb41e('0x88')];_0x27f84d[_0xb41e('0x58')][_0xb41e('0x87')]=_0x1e3323[_0xb41e('0x58')][_0xb41e('0x89')];break;case _0xb41e('0x8a'):_0x27f84d[_0xb41e('0x58')][_0xb41e('0x7f')]='+'+_0x1e3323[_0xb41e('0x58')]['results'][0x0]['from'];_0x27f84d['body']['body']=_0x1e3323[_0xb41e('0x58')][_0xb41e('0x8b')][0x0][_0xb41e('0x84')];_0x27f84d[_0xb41e('0x58')][_0xb41e('0x87')]=_0x1e3323['body']['results'][0x0]['messageId'];break;case _0xb41e('0x8c'):_0x27f84d[_0xb41e('0x58')][_0xb41e('0x7f')]=_0x1e3323['body']['originatingAddress'];_0x27f84d[_0xb41e('0x58')][_0xb41e('0x58')]=_0x1e3323[_0xb41e('0x58')][_0xb41e('0x8d')]['message'];break;case _0xb41e('0x8e'):_0x27f84d['body']['from']=_0x1e3323[_0xb41e('0x58')]['fromNumber'];_0x27f84d['body'][_0xb41e('0x58')]=_0x1e3323['body'][_0xb41e('0x84')];_0x27f84d[_0xb41e('0x58')][_0xb41e('0x87')]=_0x1e3323['body'][_0xb41e('0x8f')];break;case _0xb41e('0x90'):_0x27f84d[_0xb41e('0x58')][_0xb41e('0x87')]=_0x1e3323[_0xb41e('0x58')][0x0]['message']['id'];_0x27f84d[_0xb41e('0x58')][_0xb41e('0x7f')]=_0x1e3323[_0xb41e('0x58')][0x0]['message']['from'];_0x27f84d[_0xb41e('0x58')][_0xb41e('0x58')]=_0x1e3323[_0xb41e('0x58')][0x0][_0xb41e('0x26')][_0xb41e('0x84')];break;case _0xb41e('0x91'):_0x27f84d['body'][_0xb41e('0x7f')]=_0x1e3323[_0xb41e('0x58')][_0xb41e('0x7f')];_0x27f84d[_0xb41e('0x58')][_0xb41e('0x58')]=_0x1e3323[_0xb41e('0x58')][_0xb41e('0x26')];_0x27f84d['body'][_0xb41e('0x87')]=_0x1e3323['body']['refid'];break;}}if(_0x27f84d[_0xb41e('0x58')]['id']){delete _0x27f84d[_0xb41e('0x58')]['id'];}if(_[_0xb41e('0x92')](_0x27f84d[_0xb41e('0x58')][_0xb41e('0x7f')])){throw new db[(_0xb41e('0x93'))][(_0xb41e('0x77'))](_0xb41e('0x94'));}if(_[_0xb41e('0x92')](_0x27f84d[_0xb41e('0x58')]['body'])||_0x27f84d['body'][_0xb41e('0x58')]===''){throw new db[(_0xb41e('0x93'))][(_0xb41e('0x77'))](_0xb41e('0x95'));}if(_[_0xb41e('0x92')](_0x27f84d[_0xb41e('0x58')][_0xb41e('0x96')])){throw new db[(_0xb41e('0x93'))][(_0xb41e('0x77'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x401dfe);}if(!_['includes'](_0x401dfe,_0x27f84d['body'][_0xb41e('0x96')])){throw new db[(_0xb41e('0x93'))][(_0xb41e('0x77'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x401dfe);}_0x52ec11[_0x27f84d[_0xb41e('0x58')]['mapKey']]=_0x27f84d[_0xb41e('0x58')][_0xb41e('0x7f')];return db[_0xb41e('0x97')][_0xb41e('0x56')]({'where':{'id':_0x27f84d['account']['ListId']},'include':[{'model':db[_0xb41e('0x76')],'as':'Contacts','where':_0x52ec11,'limit':0x1,'order':[[_0xb41e('0x7a'),_0xb41e('0x98')]]}]});})['then'](handleEntityNotFound(_0x2b3c73,null))[_0xb41e('0x1f')](function(_0xee21af){if(_0xee21af){_0x27f84d[_0xb41e('0x99')]=_['omit'](_0xee21af,[_0xb41e('0x9a')]);if(_0xee21af[_0xb41e('0x9a')][_0xb41e('0x45')]){return _0xee21af[_0xb41e('0x9a')][0x0];}var _0x2d69c8=_[_0xb41e('0x16')](_0x27f84d['body'],{'firstName':_0x27f84d['body'][_0xb41e('0x7f')],'ListId':_0xee21af['id']});_0x2d69c8[_0x27f84d[_0xb41e('0x58')]['mapKey']]=_0x27f84d[_0xb41e('0x58')][_0xb41e('0x7f')];return db[_0xb41e('0x76')][_0xb41e('0x57')](_0x2d69c8,{'fields':_0xfb076a,'raw':!![]});}})[_0xb41e('0x1f')](handleEntityNotFound(_0x2b3c73,null))[_0xb41e('0x1f')](function(_0x3a68d9){if(_0x3a68d9){_0x27f84d[_0xb41e('0x9b')]=_0x3a68d9;var _0x54faa2={'ContactId':_0x3a68d9['id'],'phone':_0x27f84d['body'][_0xb41e('0x7f')],'SmsAccountId':_0x1e3323['params']['id']};var _0x2e2a76={'ContactId':_0x3a68d9['id'],'SmsAccountId':_0x1e3323[_0xb41e('0x61')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x2e2a76})[_0xb41e('0x1f')](function(_0xfe415a){if(_0xfe415a){return[_0xfe415a,![]];}return db[_0xb41e('0x9c')]['create'](_0x54faa2)[_0xb41e('0x1f')](function(_0x21ca36){return[_0x21ca36,!![]];});});}})[_0xb41e('0x9d')](function(_0x2e7ee3,_0x5f20f8){_0x27f84d[_0xb41e('0x9e')]=_0x2e7ee3[_0xb41e('0x5a')]({'plain':!![]});_0x27f84d[_0xb41e('0x9e')][_0xb41e('0x9f')]=![];if(_0x5f20f8){if(_0x27f84d[_0xb41e('0x71')][_0xb41e('0xa0')]){_0x27f84d['applications'][_0xb41e('0xa1')]({'id':0x0,'priority':_0x27f84d['applications'][_0xb41e('0x45')]+0x1,'app':'close','appdata':_0xb41e('0xa2'),'interval':_0xb41e('0xa3')});}_0x27f84d[_0xb41e('0x9e')]['created']=!![];}return db[_0xb41e('0xa4')][_0xb41e('0x57')]({'phone':_0x27f84d['body'][_0xb41e('0x7f')],'messageId':_0x27f84d[_0xb41e('0x58')]['messageId'],'body':_0x27f84d[_0xb41e('0x58')][_0xb41e('0x58')],'SmsAccountId':_0x1e3323[_0xb41e('0x61')]['id'],'SmsInteractionId':_0x2e7ee3['id'],'direction':'in','ContactId':_0x2e7ee3[_0xb41e('0xa5')],'AttachmentId':_0x27f84d[_0xb41e('0x58')][_0xb41e('0xa6')]});})[_0xb41e('0x1f')](function(_0x529fa2){_0x27f84d[_0xb41e('0x26')]=_0x529fa2;if(_0x27f84d['interaction']['UserId']){return db[_0xb41e('0xa7')][_0xb41e('0x56')]({'attributes':['id','name'],'where':{'id':_0x27f84d[_0xb41e('0x9e')][_0xb41e('0xa8')]}})['then'](function(_0x3d8d29){if(_0x3d8d29){_0x27f84d[_0xb41e('0x72')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb41e('0xa9'),'appdata':_0x3d8d29['name']+','+(_0x27f84d[_0xb41e('0x71')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb41e('0xaa'),_0xb41e('0xab'),_0x27f84d);});}return respondWithRpcPromise(_0xb41e('0xaa'),_0xb41e('0xab'),_0x27f84d);})['then'](function(_0x315473){if(_0x315473){var _0x34d78e=0xc8;var _0x195a74=_0xb41e('0xac');logger[_0xb41e('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x195a74,_0x34d78e,_0xb41e('0xad'));logger[_0xb41e('0x23')](_0xb41e('0xae'),_0x195a74,_0x34d78e,_0xb41e('0xad'),JSON[_0xb41e('0x24')](_0x315473));if(_0x27f84d[_0xb41e('0x71')][_0xb41e('0x3d')]===_0xb41e('0x7e')){return _0x2b3c73[_0xb41e('0x2a')](_0x34d78e)[_0xb41e('0x2f')](_0xb41e('0xaf'),_0xb41e('0xb0'))[_0xb41e('0x3a')](_0xb41e('0xb1'));}else{return _0x2b3c73[_0xb41e('0x2a')](_0x34d78e)[_0xb41e('0x31')](_0x315473);}}})['catch'](handleError(_0x2b3c73,null));};exports[_0xb41e('0xb2')]=function(_0x18335e,_0x10dccf){var _0x3dbc09=_0x18335e[_0xb41e('0x61')]['id'];var _0x19967f=_0x18335e[_0xb41e('0x58')];var _0xf69144=0xc8;var _0x3edf26=null;return db[_0xb41e('0xb3')][_0xb41e('0xb4')]({'isolationLevel':db['sequelize'][_0xb41e('0xb5')][_0xb41e('0xb6')]['READ_COMMITTED']},function(_0x36f8c7){return db[_0xb41e('0x4c')][_0xb41e('0xb7')]({'where':{'id':_0x3dbc09},'transaction':_0x36f8c7})[_0xb41e('0x1f')](function(_0xc48bd2){if(_0xc48bd2){return db[_0xb41e('0xb8')][_0xb41e('0x34')]({'where':{'SmsAccountId':_0x3dbc09},'transaction':_0x36f8c7})[_0xb41e('0x1f')](function(){var _0xeb3f4a=_[_0xb41e('0x3c')](_0x19967f,function(_0x1e1406){_0x1e1406[_0xb41e('0x63')]=_0x3dbc09;return _0x1e1406;});return db[_0xb41e('0xb8')][_0xb41e('0xb9')](_0xeb3f4a,{'transaction':_0x36f8c7});});}else{_0xf69144=0x194;_0x3edf26=[];}});})[_0xb41e('0x1f')](function(){if(_0xf69144!==0x194){return db[_0xb41e('0xb8')]['findAndCountAll']({'where':{'SmsAccountId':_0x3dbc09},'order':_0xb41e('0x74')})['then'](function(_0x5aa5cf){_0x3edf26=_0x5aa5cf;});}})['catch'](function(_0x16a25e){_0xf69144=0x1f4;logger['error'](_0x16a25e['stack']);if(_0x16a25e[_0xb41e('0x39')]){delete _0x16a25e['name'];}_0x3edf26=_0x16a25e;})['finally'](function(){if(_0x3edf26===null){_0x10dccf['sendStatus'](_0xf69144);}else{if(_0xf69144===0x1f4){_0x10dccf[_0xb41e('0x2a')](_0xf69144)[_0xb41e('0x3a')](_0x3edf26);}else{_0x10dccf[_0xb41e('0x2a')](_0xf69144)[_0xb41e('0x31')](_0x3edf26);}}});};exports['getApplications']=function(_0x306eb8,_0x4aac65,_0x4a2e26){var _0x408f65={};var _0x3fcc3a={};var _0x13af66;var _0x2b1bfb;return db[_0xb41e('0x4c')][_0xb41e('0xb7')]({'where':{'id':_0x306eb8[_0xb41e('0x61')]['id']}})[_0xb41e('0x1f')](handleEntityNotFound(_0x4aac65,null))[_0xb41e('0x1f')](function(_0x312b54){if(_0x312b54){_0x13af66=_0x312b54;_0x3fcc3a[_0xb41e('0x42')]=_[_0xb41e('0x54')](db[_0xb41e('0xb8')][_0xb41e('0x53')]);_0x3fcc3a[_0xb41e('0x3f')]=_[_0xb41e('0x54')](_0x306eb8[_0xb41e('0x3f')]);_0x3fcc3a[_0xb41e('0x40')]=_['intersection'](_0x3fcc3a[_0xb41e('0x42')],_0x3fcc3a[_0xb41e('0x3f')]);_0x408f65['attributes']=_[_0xb41e('0x41')](_0x3fcc3a[_0xb41e('0x42')],qs[_0xb41e('0x43')](_0x306eb8['query'][_0xb41e('0x43')]));_0x408f65[_0xb41e('0x44')]=_0x408f65['attributes'][_0xb41e('0x45')]?_0x408f65['attributes']:_0x3fcc3a[_0xb41e('0x42')];_0x408f65[_0xb41e('0x66')]=qs[_0xb41e('0x48')](_0x306eb8[_0xb41e('0x3f')][_0xb41e('0x48')]);_0x408f65[_0xb41e('0x49')]=qs[_0xb41e('0x40')](_['pick'](_0x306eb8[_0xb41e('0x3f')],_0x3fcc3a[_0xb41e('0x40')]));if(_0x306eb8[_0xb41e('0x3f')][_0xb41e('0x4a')]){_0x408f65['where']=_[_0xb41e('0x4b')](_0x408f65[_0xb41e('0x49')],{'$or':_[_0xb41e('0x3c')](_0x408f65['attributes'],function(_0x548629){var _0x32cafc={};_0x32cafc[_0x548629]={'$like':'%'+_0x306eb8['query'][_0xb41e('0x4a')]+'%'};return _0x32cafc;})});}_0x408f65=_[_0xb41e('0x4b')]({},_0x408f65,_0x306eb8[_0xb41e('0x55')]);return _0x13af66['getApplications'](_0x408f65);}})['then'](function(_0x4d0b26){if(_0x4d0b26){_0x2b1bfb=_0x4d0b26[_0xb41e('0x45')];if(!_0x306eb8[_0xb41e('0x3f')][_0xb41e('0x46')](_0xb41e('0x47'))){_0x408f65[_0xb41e('0x2d')]=qs[_0xb41e('0x2d')](_0x306eb8[_0xb41e('0x3f')][_0xb41e('0x2d')]);_0x408f65['offset']=qs[_0xb41e('0x2b')](_0x306eb8[_0xb41e('0x3f')][_0xb41e('0x2b')]);}return _0x13af66[_0xb41e('0xba')](_0x408f65);}})[_0xb41e('0x1f')](function(_0x499c3c){if(_0x499c3c){return _0x499c3c?{'count':_0x2b1bfb,'rows':_0x499c3c}:null;}})[_0xb41e('0x1f')](respondWithResult(_0x4aac65,null))[_0xb41e('0x28')](handleError(_0x4aac65,null));};exports[_0xb41e('0xbb')]=function(_0x5b32f1,_0x54f15e,_0xbd8906){var _0x4d0502={'raw':![],'where':{}};var _0x1ddc97={};var _0x1d3a9e={'count':0x0,'rows':[]};return db[_0xb41e('0x4c')][_0xb41e('0xb7')]({'where':{'id':_0x5b32f1[_0xb41e('0x61')]['id']}})[_0xb41e('0x1f')](handleEntityNotFound(_0x54f15e,null))[_0xb41e('0x1f')](function(_0x44abab){if(_0x44abab){_0x1ddc97[_0xb41e('0x42')]=_[_0xb41e('0x54')](db[_0xb41e('0x9c')][_0xb41e('0x53')]);_0x1ddc97[_0xb41e('0x3f')]=_[_0xb41e('0x54')](_0x5b32f1[_0xb41e('0x3f')]);_0x1ddc97[_0xb41e('0x40')]=_['intersection'](_0x1ddc97['model'],_0x1ddc97[_0xb41e('0x3f')]);_0x4d0502[_0xb41e('0x44')]=_[_0xb41e('0x41')](_0x1ddc97[_0xb41e('0x42')],qs[_0xb41e('0x43')](_0x5b32f1['query'][_0xb41e('0x43')]));_0x4d0502[_0xb41e('0x44')]=_0x4d0502[_0xb41e('0x44')][_0xb41e('0x45')]?_0x4d0502['attributes']:_0x1ddc97[_0xb41e('0x42')];if(!_0x5b32f1[_0xb41e('0x3f')][_0xb41e('0x46')](_0xb41e('0x47'))){_0x4d0502['limit']=qs[_0xb41e('0x2d')](_0x5b32f1[_0xb41e('0x3f')]['limit']);_0x4d0502[_0xb41e('0x2b')]=qs['offset'](_0x5b32f1['query'][_0xb41e('0x2b')]);}_0x4d0502[_0xb41e('0x66')]=qs[_0xb41e('0x48')](_0x5b32f1['query'][_0xb41e('0x48')]);_0x4d0502['where']=qs[_0xb41e('0x40')](_[_0xb41e('0x67')](_0x5b32f1[_0xb41e('0x3f')],_0x1ddc97[_0xb41e('0x40')]));_0x4d0502[_0xb41e('0x49')][_0xb41e('0x63')]=_0x44abab['id'];if(_0x5b32f1[_0xb41e('0x3f')][_0xb41e('0x4a')]){_0x4d0502[_0xb41e('0x49')]=_[_0xb41e('0x4b')](_0x4d0502[_0xb41e('0x49')],{'$or':_[_0xb41e('0x3c')](_0x4d0502[_0xb41e('0x44')],function(_0xa9b22b){var _0x94140d={};_0x94140d[_0xa9b22b]={'$like':'%'+_0x5b32f1[_0xb41e('0x3f')][_0xb41e('0x4a')]+'%'};return _0x94140d;})});}_0x4d0502=_[_0xb41e('0x4b')]({},_0x4d0502,_0x5b32f1[_0xb41e('0x55')]);return db[_0xb41e('0x9c')][_0xb41e('0x2e')]({'where':_0x4d0502[_0xb41e('0x49')]})['then'](function(_0x104a19){_0x1d3a9e[_0xb41e('0x2e')]=_0x104a19;if(_0x5b32f1[_0xb41e('0x3f')]['includeAll']){_0x4d0502['include']=[{'model':db['CmContact'],'as':_0xb41e('0xbc'),'required':![]},{'model':db[_0xb41e('0xa7')],'as':'Owner','attributes':[_0xb41e('0x39'),_0xb41e('0xbd'),_0xb41e('0xbe')],'required':![]},{'model':db['Tag'],'as':_0xb41e('0xbf'),'attributes':['id',_0xb41e('0x39'),'color'],'where':_0x5b32f1[_0xb41e('0x3f')][_0xb41e('0xc0')]?{'id':_0x5b32f1[_0xb41e('0x3f')][_0xb41e('0xc0')]}:undefined,'required':_0x5b32f1[_0xb41e('0x3f')][_0xb41e('0xc0')]?!![]:![]}];}return db[_0xb41e('0x9c')][_0xb41e('0x4f')](_0x4d0502);})[_0xb41e('0x1f')](function(_0x26caa9){_0x1d3a9e[_0xb41e('0x50')]=_0x26caa9;return _0x1d3a9e;});}})[_0xb41e('0x1f')](respondWithFilteredResult(_0x54f15e,_0x4d0502))[_0xb41e('0x28')](handleError(_0x54f15e,null));};exports[_0xb41e('0x3a')]=function(_0x41e48b,_0x2b76cd,_0x3ceb4a){var _0x1cd3b7,_0x5f3b8c,_0x57a39e;if(_['isNil'](_0x41e48b[_0xb41e('0x58')][_0xb41e('0x58')])||_0x41e48b['body'][_0xb41e('0x58')]===''){throw new db[(_0xb41e('0x93'))][(_0xb41e('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x41e48b[_0xb41e('0x58')]['to'])){throw new db[(_0xb41e('0x93'))][(_0xb41e('0x77'))](_0xb41e('0xc1'));}_0x1cd3b7=_0x41e48b[_0xb41e('0x58')]['to'];return db[_0xb41e('0x4c')][_0xb41e('0x56')]({'where':{'id':_0x41e48b[_0xb41e('0x61')]['id']},'include':[{'model':db[_0xb41e('0x97')],'as':_0xb41e('0xc2'),'include':[{'model':db[_0xb41e('0x76')],'as':'Contacts','where':{'mobile':_0x1cd3b7},'limit':0x1,'order':[[_0xb41e('0x7a'),'DESC']]}]}]})[_0xb41e('0x1f')](handleEntityNotFound(_0x2b76cd,null))['then'](function(_0x1b6116){if(_0x1b6116&&_0x1b6116[_0xb41e('0xc2')]){_0x5f3b8c=_0x1b6116[_0xb41e('0x5a')]({'plain':!![]});if(_0x5f3b8c[_0xb41e('0xc2')]&&_0x5f3b8c[_0xb41e('0xc2')][_0xb41e('0x9a')]['length']){return _0x5f3b8c[_0xb41e('0xc2')][_0xb41e('0x9a')][0x0];}return db[_0xb41e('0x76')][_0xb41e('0x57')](_[_0xb41e('0x16')](_0x41e48b[_0xb41e('0x58')],{'firstName':_0x1cd3b7,'mobile':_0x1cd3b7,'phone':_0x1cd3b7,'ListId':_0x5f3b8c['ListId']}));}})[_0xb41e('0x1f')](handleEntityNotFound(_0x2b76cd,null))[_0xb41e('0x1f')](function(_0x1921b3){if(_0x1921b3){_0x57a39e=_0x1921b3;return db[_0xb41e('0x9c')][_0xb41e('0x56')]({'where':{'ContactId':_0x57a39e['id'],'closed':![],'SmsAccountId':_0x5f3b8c['id']}})[_0xb41e('0x1f')](function(_0x8fc378){if(_0x8fc378){return[_0x8fc378,![]];}return db['SmsInteraction'][_0xb41e('0x57')]({'UserId':_0x41e48b['user']['id'],'ContactId':_0x57a39e['id'],'SmsAccountId':_0x5f3b8c['id'],'phone':_0x1cd3b7,'firstMsgDirection':_0xb41e('0xc3'),'Messages':[_[_0xb41e('0x4b')](_0x41e48b['body'],{'read':![],'body':_0x41e48b[_0xb41e('0x58')]['body'],'phone':_0x1cd3b7,'SmsAccountId':_0x5f3b8c['id'],'UserId':_0x41e48b[_0xb41e('0x59')]['id'],'ContactId':_0x57a39e['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0xb41e('0x1f')](function(_0x354d75){return[_0x354d75,!![]];});});}})[_0xb41e('0x9d')](function(_0x2e47f8,_0x460482){if(_0x460482){return _0x2e47f8;}return db[_0xb41e('0xa4')]['create'](_[_0xb41e('0x4b')](_0x41e48b['body'],{'read':![],'body':_0x41e48b[_0xb41e('0x58')]['body'],'phone':_0x1cd3b7,'SmsAccountId':_0x5f3b8c['id'],'SmsInteractionId':_0x2e47f8['id'],'UserId':_0x41e48b[_0xb41e('0x59')]['id'],'ContactId':_0x57a39e['id']}))[_0xb41e('0x1f')](function(_0x50052b){_0x2e47f8['dataValues'][_0xb41e('0xc4')]=[];_0x2e47f8[_0xb41e('0xc5')]['Messages'][_0xb41e('0xa1')](_0x50052b[_0xb41e('0xc5')]);return _0x2e47f8;});})[_0xb41e('0x1f')](respondWithResult(_0x2b76cd,null))[_0xb41e('0x28')](handleError(_0x2b76cd,null));};exports[_0xb41e('0x2a')]=function(_0x2bcd64,_0x4d950a,_0x1ad4ec){if(_0x2bcd64[_0xb41e('0x58')]['id']){delete _0x2bcd64[_0xb41e('0x58')]['id'];}var _0x2a8892,_0x159b02,_0x2ab1f5;return db['SmsAccount'][_0xb41e('0x56')]({'where':{'id':_0x2bcd64[_0xb41e('0x61')]['id']}})['then'](handleEntityNotFound(_0x4d950a,null))['then'](function(_0x2c9ad1){if(_0x2c9ad1){_0x2ab1f5=_0x2c9ad1;logger['debug'](_0xb41e('0xc6'),_0xb41e('0x2a'),'received\x20delivery\x20report\x20from',_0x2c9ad1[_0xb41e('0x3d')],util[_0xb41e('0xc7')](_0x2bcd64[_0xb41e('0x58')],{'showHidden':![],'depth':null}));switch(_0x2c9ad1[_0xb41e('0x3d')]){case'skebby':if(_0x2bcd64['body'][_0xb41e('0xc8')]&&_0x2bcd64[_0xb41e('0x58')][_0xb41e('0x2a')]){_0x159b02=_0x2bcd64[_0xb41e('0x58')][_0xb41e('0x2a')];return db[_0xb41e('0xa4')][_0xb41e('0x56')]({'where':{'messageId':_0x2bcd64[_0xb41e('0x58')]['skebby_dispatch_id']}});}break;case _0xb41e('0x85'):if(_0x2bcd64[_0xb41e('0x58')][_0xb41e('0xc9')]&&_0x2bcd64[_0xb41e('0x58')]['statusInt']){_0x159b02=_0x2bcd64[_0xb41e('0x58')]['statusInt'];return db[_0xb41e('0xa4')][_0xb41e('0x56')]({'where':{'messageId':_0x2bcd64['body'][_0xb41e('0xc9')]}});}break;case _0xb41e('0x86'):if(_0x2bcd64[_0xb41e('0x58')]['message_id']&&_0x2bcd64[_0xb41e('0x58')][_0xb41e('0xca')]){_0x159b02=_0x2bcd64['body'][_0xb41e('0xca')];return db[_0xb41e('0xa4')][_0xb41e('0x56')]({'where':{'messageId':_0x2bcd64[_0xb41e('0x58')][_0xb41e('0xcb')]}});}break;case _0xb41e('0x8a'):var _0x12dad9=_0x2bcd64[_0xb41e('0x58')][_0xb41e('0x8b')][0x0];if(_0x12dad9['messageId']&&_0x12dad9[_0xb41e('0x2a')]['groupName']===_0xb41e('0xcc')){_0x159b02=_0x12dad9[_0xb41e('0x2a')][_0xb41e('0xcd')];return db['SmsMessage'][_0xb41e('0x56')]({'where':{'messageId':_0x12dad9[_0xb41e('0x87')]}});}break;case'clickatell':if(_0x2bcd64[_0xb41e('0x58')][_0xb41e('0x87')]&&_0x2bcd64[_0xb41e('0x58')][_0xb41e('0x2a')]){_0x159b02=_0x2bcd64[_0xb41e('0x58')][_0xb41e('0x2a')];return db[_0xb41e('0xa4')][_0xb41e('0x56')]({'where':{'messageId':_0x2bcd64[_0xb41e('0x58')][_0xb41e('0x87')]}});}break;case _0xb41e('0x90'):if(_0x2bcd64[_0xb41e('0x58')][0x0]['message']['id']){_0x159b02=_0x2bcd64[_0xb41e('0x58')][0x0]['type'];return db[_0xb41e('0xa4')][_0xb41e('0x56')]({'where':{'messageId':_0x2bcd64[_0xb41e('0x58')][0x0]['message']['id']}});}break;case _0xb41e('0x91'):if(_0x2bcd64[_0xb41e('0x58')][_0xb41e('0xce')]&&_0x2bcd64[_0xb41e('0x58')][_0xb41e('0x2a')]){_0x159b02=_0x2bcd64[_0xb41e('0x58')]['status'];return db[_0xb41e('0xa4')][_0xb41e('0x56')]({'where':{'messageId':_0x2bcd64['body'][_0xb41e('0xce')]}});}break;}}})[_0xb41e('0x1f')](handleEntityNotFound(_0x4d950a,null))[_0xb41e('0x1f')](function(_0x474a96){if(_0x474a96){_0x2a8892=_0x474a96;switch(_0x2ab1f5['type']){case _0xb41e('0x83'):if(_0x159b02===_0xb41e('0xcc')){return _0x2a8892['update']({'read':!![]});}else{logger['error'](_0xb41e('0xc6'),'status',_0xb41e('0x83'),util[_0xb41e('0xc7')](_0x2bcd64[_0xb41e('0x58')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x159b02==='1'){return _0x2a8892['update']({'read':!![]});}else{logger[_0xb41e('0x25')](_0xb41e('0xc6'),_0xb41e('0x2a'),_0xb41e('0x83'),util[_0xb41e('0xc7')](_0x2bcd64['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x2bcd64[_0xb41e('0x58')]['error_code']&&_0x159b02>=0xc8&&_0x159b02<=0xce){return _0x2a8892[_0xb41e('0x5f')]({'read':!![]});}else{logger[_0xb41e('0x25')](_0xb41e('0xc6'),_0xb41e('0x2a'),_0xb41e('0x86'),util[_0xb41e('0xc7')](_0x2bcd64['body'],{'showHidden':![],'depth':null}));}break;case _0xb41e('0x8a'):var _0x4b3803=_0x2bcd64[_0xb41e('0x58')][_0xb41e('0x8b')][0x0];if(_0x4b3803['status']['groupName']===_0xb41e('0xcc')){return _0x2a8892[_0xb41e('0x5f')]({'read':!![]});}else{logger[_0xb41e('0x25')](_0xb41e('0xc6'),'status',_0xb41e('0x8a'),util['inspect'](_0x2bcd64[_0xb41e('0x58')],{'showHidden':![],'depth':null}));}break;case _0xb41e('0x8e'):if(_0x159b02=='DELIVERED_TO_GATEWAY'||_0x159b02==_0xb41e('0xcf')){return _0x2a8892[_0xb41e('0x5f')]({'read':!![]});}else{logger[_0xb41e('0x25')](_0xb41e('0xc6'),_0xb41e('0x2a'),_0xb41e('0x8e'),util[_0xb41e('0xc7')](_0x2bcd64[_0xb41e('0x58')],{'showHidden':![],'depth':null}));}break;case _0xb41e('0x90'):if(_0x159b02==_0xb41e('0xd0')){return _0x2a8892[_0xb41e('0x5f')]({'read':!![]});}else{logger[_0xb41e('0x25')](_0xb41e('0xc6'),_0xb41e('0x2a'),_0xb41e('0x90'),util[_0xb41e('0xc7')](_0x2bcd64['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x159b02===_0xb41e('0xd1')||_0x159b02===_0xb41e('0xd2')){return _0x2a8892[_0xb41e('0x5f')]({'read':!![]});}else{logger[_0xb41e('0x25')](_0xb41e('0xc6'),'status',_0xb41e('0x91'),util[_0xb41e('0xc7')](_0x2bcd64[_0xb41e('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x2a8892;}})[_0xb41e('0x1f')](respondWithResult(_0x4d950a,null))[_0xb41e('0x28')](handleError(_0x4d950a,null));};exports[_0xb41e('0xd3')]=function(_0x5bb52b,_0x2ece0b,_0x5089de){var _0x43dfdd,_0x423833,_0x459e33;return db['SmsAccount'][_0xb41e('0x56')]({'where':{'id':_0x5bb52b[_0xb41e('0x61')]['id']}})[_0xb41e('0x1f')](handleEntityNotFound(_0x2ece0b,null))[_0xb41e('0x1f')](function(_0x44582e){if(_0x44582e){_0x459e33=_0x44582e;logger[_0xb41e('0x23')](_0xb41e('0xc6'),'status',_0xb41e('0xd4'),_0x44582e[_0xb41e('0x3d')],util[_0xb41e('0xc7')](_0x5bb52b[_0xb41e('0x3f')],{'showHidden':![],'depth':null}));switch(_0x44582e[_0xb41e('0x3d')]){case _0xb41e('0x8c'):if(_0x5bb52b[_0xb41e('0x3f')]['message-id']&&_0x5bb52b[_0xb41e('0x3f')][_0xb41e('0xd5')]){_0x423833=_0x5bb52b['query'][_0xb41e('0xd5')];return db[_0xb41e('0xa4')][_0xb41e('0x56')]({'where':{'messageId':_0x5bb52b[_0xb41e('0x3f')][_0xb41e('0xd6')]}});}break;}}})[_0xb41e('0x1f')](handleEntityNotFound(_0x2ece0b,null))[_0xb41e('0x1f')](function(_0x4a6656){if(_0x4a6656){_0x43dfdd=_0x4a6656;switch(_0x459e33[_0xb41e('0x3d')]){case _0xb41e('0x8c'):if(_0x423833==='2'||_0x423833==='6'){return _0x43dfdd[_0xb41e('0x5f')]({'read':!![]});}else{logger[_0xb41e('0x25')](_0xb41e('0xc6'),_0xb41e('0x2a'),_0xb41e('0x8c'),util[_0xb41e('0xc7')](_0x5bb52b[_0xb41e('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x43dfdd;}})[_0xb41e('0x1f')](respondWithResult(_0x2ece0b,null))[_0xb41e('0x28')](handleError(_0x2ece0b,null));};exports['addAgents']=function(_0x186de7,_0x39b288,_0x1e8c1c){return db[_0xb41e('0x4c')][_0xb41e('0x56')]({'where':{'id':_0x186de7[_0xb41e('0x61')]['id']}})['then'](handleEntityNotFound(_0x39b288,null))[_0xb41e('0x1f')](function(_0x1b9fbf){if(_0x1b9fbf){return _0x1b9fbf[_0xb41e('0xd7')](_0x186de7['body']['ids'],_[_0xb41e('0xd8')](_0x186de7[_0xb41e('0x58')],[_0xb41e('0x69'),'id'])||{})[_0xb41e('0x9d')](function(_0x5d92f3){for(var _0xe86775=0x0;_0xe86775<_0x186de7[_0xb41e('0x58')]['ids'][_0xb41e('0x45')];_0xe86775+=0x1){socket[_0xb41e('0xd9')](_0xb41e('0xda'),{'UserId':Number(_0x186de7[_0xb41e('0x58')][_0xb41e('0x69')][_0xe86775]),'SmsAccountId':Number(_0x186de7[_0xb41e('0x61')]['id'])});}return _0x5d92f3;});}})[_0xb41e('0x1f')](respondWithResult(_0x39b288,null))[_0xb41e('0x28')](handleError(_0x39b288,null));};exports[_0xb41e('0xdb')]=function(_0x47d113,_0x3189f5,_0x32d5a9){return db[_0xb41e('0x4c')]['find']({'where':{'id':_0x47d113[_0xb41e('0x61')]['id']}})['then'](handleEntityNotFound(_0x3189f5,null))[_0xb41e('0x1f')](function(_0x51c732){if(_0x51c732){return _0x51c732[_0xb41e('0xdb')](_0x47d113[_0xb41e('0x3f')]['ids'])[_0xb41e('0x1f')](function(){if(_[_0xb41e('0xdc')](_0x47d113[_0xb41e('0x3f')]['ids'])){for(var _0x3622c8=0x0;_0x3622c8<_0x47d113['query'][_0xb41e('0x69')][_0xb41e('0x45')];_0x3622c8+=0x1){socket[_0xb41e('0xd9')]('userSmsAccount:remove',{'UserId':Number(_0x47d113[_0xb41e('0x3f')][_0xb41e('0x69')][_0x3622c8]),'SmsAccountId':Number(_0x47d113['params']['id'])});}}else{socket[_0xb41e('0xd9')]('userSmsAccount:remove',{'UserId':Number(_0x47d113[_0xb41e('0x3f')][_0xb41e('0x69')]),'SmsAccountId':Number(_0x47d113[_0xb41e('0x61')]['id'])});}});}})['then'](respondWithStatusCode(_0x3189f5,null))[_0xb41e('0x28')](handleError(_0x3189f5,null));};exports[_0xb41e('0xdd')]=function(_0x5cc958,_0x185a07,_0x3119f9){var _0x86fa18={};var _0x3677eb={};var _0x18e606;var _0x38bffa;return db[_0xb41e('0x4c')]['findOne']({'where':{'id':_0x5cc958[_0xb41e('0x61')]['id']}})[_0xb41e('0x1f')](handleEntityNotFound(_0x185a07,null))[_0xb41e('0x1f')](function(_0x1616f2){if(_0x1616f2){_0x18e606=_0x1616f2;_0x3677eb['model']=_[_0xb41e('0x54')](db[_0xb41e('0xa7')][_0xb41e('0x53')]);_0x3677eb[_0xb41e('0x3f')]=_[_0xb41e('0x54')](_0x5cc958[_0xb41e('0x3f')]);_0x3677eb[_0xb41e('0x40')]=_['intersection'](_0x3677eb[_0xb41e('0x42')],_0x3677eb[_0xb41e('0x3f')]);_0x86fa18[_0xb41e('0x44')]=_[_0xb41e('0x41')](_0x3677eb[_0xb41e('0x42')],qs[_0xb41e('0x43')](_0x5cc958['query'][_0xb41e('0x43')]));_0x86fa18[_0xb41e('0x44')]=_0x86fa18[_0xb41e('0x44')][_0xb41e('0x45')]?_0x86fa18[_0xb41e('0x44')]:_0x3677eb[_0xb41e('0x42')];_0x86fa18[_0xb41e('0x66')]=qs[_0xb41e('0x48')](_0x5cc958[_0xb41e('0x3f')][_0xb41e('0x48')]);_0x86fa18['where']=qs[_0xb41e('0x40')](_[_0xb41e('0x67')](_0x5cc958['query'],_0x3677eb[_0xb41e('0x40')]));if(_0x5cc958[_0xb41e('0x3f')]['filter']){_0x86fa18[_0xb41e('0x49')]=_['merge'](_0x86fa18['where'],{'$or':_[_0xb41e('0x3c')](_0x86fa18[_0xb41e('0x44')],function(_0x41ba73){var _0x31d63f={};_0x31d63f[_0x41ba73]={'$like':'%'+_0x5cc958['query'][_0xb41e('0x4a')]+'%'};return _0x31d63f;})});}_0x86fa18=_[_0xb41e('0x4b')]({},_0x86fa18,_0x5cc958['options']);return _0x18e606['getAgents'](_0x86fa18);}})[_0xb41e('0x1f')](function(_0x45a1e8){if(_0x45a1e8){_0x38bffa=_0x45a1e8[_0xb41e('0x45')];if(!_0x5cc958[_0xb41e('0x3f')]['hasOwnProperty']('nolimit')){_0x86fa18[_0xb41e('0x2d')]=qs[_0xb41e('0x2d')](_0x5cc958[_0xb41e('0x3f')][_0xb41e('0x2d')]);_0x86fa18['offset']=qs[_0xb41e('0x2b')](_0x5cc958[_0xb41e('0x3f')][_0xb41e('0x2b')]);}return _0x18e606['getAgents'](_0x86fa18);}})[_0xb41e('0x1f')](function(_0x4737f8){if(_0x4737f8){return _0x4737f8?{'count':_0x38bffa,'rows':_0x4737f8}:null;}})[_0xb41e('0x1f')](respondWithResult(_0x185a07,null))[_0xb41e('0x28')](handleError(_0x185a07,null));}; \ No newline at end of file +var _0xc81c=['catch','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','destroy','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','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','mandatoryDispositionPause','describe','SmsAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','SmsApplication','account','applications','orderBy','priority','asc','Applications','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','message_id','MessageUUID','infobip','results','text','csc','clickatell','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','defaults','CmContact','contact','SmsInteraction','spread','interaction','created','autoclose','push','*,*,*,*','SmsMessage','UserId','User','agent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','sendStatus','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','List','Messages','dataValues','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','redif','clicksend','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','register','jayson/promise','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x449029,_0xa1b94){var _0x5709c2=function(_0x4b3d85){while(--_0x4b3d85){_0x449029['push'](_0x449029['shift']());}};_0x5709c2(++_0xa1b94);}(_0xc81c,0x1a4));var _0xcc81=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xc81c[_0x55e08b];return _0xd1a7ff;};'use strict';var emlformat=require(_0xcc81('0x0'));var rimraf=require(_0xcc81('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc81('0x2'));var rp=require(_0xcc81('0x3'));var moment=require(_0xcc81('0x4'));var BPromise=require(_0xcc81('0x5'));var Mustache=require(_0xcc81('0x6'));var util=require(_0xcc81('0x7'));var path=require('path');var sox=require(_0xcc81('0x8'));var csv=require(_0xcc81('0x9'));var ejs=require(_0xcc81('0xa'));var fs=require('fs');var fs_extra=require(_0xcc81('0xb'));var _=require(_0xcc81('0xc'));var squel=require(_0xcc81('0xd'));var crypto=require(_0xcc81('0xe'));var jsforce=require(_0xcc81('0xf'));var deskjs=require(_0xcc81('0x10'));var toCsv=require(_0xcc81('0x9'));var querystring=require('querystring');var Papa=require(_0xcc81('0x11'));var Redis=require(_0xcc81('0x12'));var authService=require(_0xcc81('0x13'));var qs=require(_0xcc81('0x14'));var as=require(_0xcc81('0x15'));var hardwareService=require(_0xcc81('0x16'));var logger=require(_0xcc81('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xcc81('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xcc81('0x19')]=_['defaults'](config[_0xcc81('0x19')],{'host':_0xcc81('0x1a'),'port':0x18eb});var socket=require(_0xcc81('0x1b'))(new Redis(config[_0xcc81('0x19')]));require('./smsAccount.socket')[_0xcc81('0x1c')](socket);var jayson=require(_0xcc81('0x1d'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x50f185,_0x511909,_0x56e0d1,_0x258cef){return new BPromise(function(_0x45e208,_0x3190a8){var _0x356bee=_0x258cef||client;return _0x356bee[_0xcc81('0x1e')](_0x50f185,_0x56e0d1)[_0xcc81('0x1f')](function(_0x24f6cd){logger[_0xcc81('0x20')](_0xcc81('0x21'),_0x511909,_0xcc81('0x22'));logger[_0xcc81('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x511909,_0xcc81('0x22'),JSON[_0xcc81('0x24')](_0x24f6cd));if(_0x24f6cd['error']){if(_0x24f6cd[_0xcc81('0x25')][_0xcc81('0x26')]===0x1f4){logger[_0xcc81('0x25')](_0xcc81('0x21'),_0x511909,_0x24f6cd[_0xcc81('0x25')]['message']);return _0x3190a8(_0x24f6cd[_0xcc81('0x25')][_0xcc81('0x27')]);}logger[_0xcc81('0x25')](_0xcc81('0x21'),_0x511909,_0x24f6cd[_0xcc81('0x25')][_0xcc81('0x27')]);return _0x45e208(_0x24f6cd[_0xcc81('0x25')]['message']);}else{logger['info'](_0xcc81('0x21'),_0x511909,_0xcc81('0x22'));_0x45e208(_0x24f6cd['result'][_0xcc81('0x27')]);}})[_0xcc81('0x28')](function(_0xdc104e){logger[_0xcc81('0x25')](_0xcc81('0x21'),_0x511909,_0xdc104e);_0x3190a8(_0xdc104e);});});}function respondWithStatusCode(_0x46bb6a,_0x23b67e){_0x23b67e=_0x23b67e||0xcc;return function(_0x4dc338){if(_0x4dc338){return _0x46bb6a['sendStatus'](_0x23b67e);}return _0x46bb6a['status'](_0x23b67e)[_0xcc81('0x29')]();};}function respondWithResult(_0x250b50,_0x3b5dab){_0x3b5dab=_0x3b5dab||0xc8;return function(_0x381b3d){if(_0x381b3d){return _0x250b50['status'](_0x3b5dab)[_0xcc81('0x2a')](_0x381b3d);}};}function respondWithFilteredResult(_0x205088,_0x5a65f9){return function(_0x5f0307){if(_0x5f0307){var _0x39b5ce=typeof _0x5a65f9[_0xcc81('0x2b')]==='undefined'&&typeof _0x5a65f9[_0xcc81('0x2c')]===_0xcc81('0x2d');var _0x229909=_0x5f0307['count'];var _0x3d4717=_0x39b5ce?0x0:_0x5a65f9['offset'];var _0xcdfcab=_0x39b5ce?_0x5f0307[_0xcc81('0x2e')]:_0x5a65f9[_0xcc81('0x2b')]+_0x5a65f9[_0xcc81('0x2c')];var _0x13cd81;if(_0xcdfcab>=_0x229909){_0xcdfcab=_0x229909;_0x13cd81=0xc8;}else{_0x13cd81=0xce;}_0x205088[_0xcc81('0x2f')](_0x13cd81);return _0x205088[_0xcc81('0x30')](_0xcc81('0x31'),_0x3d4717+'-'+_0xcdfcab+'/'+_0x229909)['json'](_0x5f0307);}return null;};}function patchUpdates(_0x270b77){return function(_0x3f7631){try{jsonpatch[_0xcc81('0x32')](_0x3f7631,_0x270b77,!![]);}catch(_0x3ae4e9){return BPromise[_0xcc81('0x33')](_0x3ae4e9);}return _0x3f7631[_0xcc81('0x34')]();};}function saveUpdates(_0x149bc0,_0x55486a){return function(_0xb199b9){if(_0xb199b9){return _0xb199b9[_0xcc81('0x35')](_0x149bc0)[_0xcc81('0x1f')](function(_0x2672f5){return _0x2672f5;});}return null;};}function removeEntity(_0x1c286e,_0x102a50){return function(_0x359b4d){if(_0x359b4d){return _0x359b4d[_0xcc81('0x36')]()[_0xcc81('0x1f')](function(){var _0x30be2b=_0x359b4d['get']({'plain':!![]});var _0x9fc40b=_0xcc81('0x37');return db[_0xcc81('0x38')][_0xcc81('0x36')]({'where':{'type':_0x9fc40b,'resourceId':_0x30be2b['id']}})[_0xcc81('0x1f')](function(){return _0x359b4d;});})[_0xcc81('0x1f')](function(){_0x1c286e[_0xcc81('0x2f')](0xcc)[_0xcc81('0x29')]();});}};}function handleEntityNotFound(_0x46f550,_0x2d4fc5){return function(_0x5465d9){if(!_0x5465d9){_0x46f550['sendStatus'](0x194);}return _0x5465d9;};}function handleError(_0x236875,_0x5c282d){_0x5c282d=_0x5c282d||0x1f4;return function(_0x113b3a){logger[_0xcc81('0x25')](_0x113b3a[_0xcc81('0x39')]);if(_0x113b3a[_0xcc81('0x3a')]){delete _0x113b3a[_0xcc81('0x3a')];}_0x236875[_0xcc81('0x2f')](_0x5c282d)[_0xcc81('0x3b')](_0x113b3a);};}exports[_0xcc81('0x3c')]=function(_0x38f587,_0x396da2){var _0x495749={'include':[{'model':db[_0xcc81('0x3d')],'as':'mandatoryDispositionPause'}]},_0x2c3e6b={},_0x50fb94={'count':0x0,'rows':[]};var _0x2318c7=_[_0xcc81('0x3e')](db[_0xcc81('0x3f')][_0xcc81('0x40')],function(_0x3926bf){return{'name':_0x3926bf[_0xcc81('0x41')],'type':_0x3926bf[_0xcc81('0x42')][_0xcc81('0x43')]};});_0x2c3e6b[_0xcc81('0x44')]=_[_0xcc81('0x3e')](_0x2318c7,_0xcc81('0x3a'));_0x2c3e6b[_0xcc81('0x45')]=_[_0xcc81('0x46')](_0x38f587[_0xcc81('0x45')]);_0x2c3e6b[_0xcc81('0x47')]=_[_0xcc81('0x48')](_0x2c3e6b[_0xcc81('0x44')],_0x2c3e6b[_0xcc81('0x45')]);_0x495749['attributes']=_['intersection'](_0x2c3e6b[_0xcc81('0x44')],qs['fields'](_0x38f587[_0xcc81('0x45')][_0xcc81('0x49')]));_0x495749['attributes']=_0x495749[_0xcc81('0x4a')][_0xcc81('0x4b')]?_0x495749['attributes']:_0x2c3e6b[_0xcc81('0x44')];if(!_0x38f587[_0xcc81('0x45')][_0xcc81('0x4c')](_0xcc81('0x4d'))){_0x495749['limit']=qs[_0xcc81('0x2c')](_0x38f587[_0xcc81('0x45')][_0xcc81('0x2c')]);_0x495749[_0xcc81('0x2b')]=qs['offset'](_0x38f587['query'][_0xcc81('0x2b')]);}_0x495749[_0xcc81('0x4e')]=qs[_0xcc81('0x4f')](_0x38f587[_0xcc81('0x45')][_0xcc81('0x4f')]);_0x495749['where']=qs[_0xcc81('0x47')](_[_0xcc81('0x50')](_0x38f587[_0xcc81('0x45')],_0x2c3e6b[_0xcc81('0x47')]),_0x2318c7);if(_0x38f587[_0xcc81('0x45')][_0xcc81('0x51')]){_0x495749[_0xcc81('0x52')]=_[_0xcc81('0x53')](_0x495749[_0xcc81('0x52')],{'$or':_[_0xcc81('0x3e')](_0x2318c7,function(_0x4c3d92){if(_0x4c3d92[_0xcc81('0x42')]!==_0xcc81('0x54')){var _0x48b8a6={};_0x48b8a6[_0x4c3d92['name']]={'$like':'%'+_0x38f587['query'][_0xcc81('0x51')]+'%'};return _0x48b8a6;}})});}_0x495749=_[_0xcc81('0x53')]({},_0x495749,_0x38f587[_0xcc81('0x55')]);var _0x321001={'where':_0x495749[_0xcc81('0x52')]};return db[_0xcc81('0x3f')][_0xcc81('0x2e')](_0x321001)['then'](function(_0x5a3c73){_0x50fb94['count']=_0x5a3c73;if(_0x38f587[_0xcc81('0x45')][_0xcc81('0x56')]){_0x495749['include']=[{'all':!![]}];}return db[_0xcc81('0x3f')][_0xcc81('0x57')](_0x495749);})['then'](function(_0x3ec607){_0x50fb94[_0xcc81('0x58')]=_0x3ec607;return _0x50fb94;})[_0xcc81('0x1f')](respondWithFilteredResult(_0x396da2,_0x495749))['catch'](handleError(_0x396da2,null));};exports[_0xcc81('0x59')]=function(_0x5c2fb3,_0x2a4cf4){var _0x506870={'raw':![],'where':{'id':_0x5c2fb3[_0xcc81('0x5a')]['id']},'include':[{'model':db[_0xcc81('0x3d')],'as':'mandatoryDispositionPause'}]},_0x1e9afa={};_0x1e9afa[_0xcc81('0x44')]=_[_0xcc81('0x46')](db['SmsAccount'][_0xcc81('0x40')]);_0x1e9afa['query']=_[_0xcc81('0x46')](_0x5c2fb3['query']);_0x1e9afa[_0xcc81('0x47')]=_[_0xcc81('0x48')](_0x1e9afa[_0xcc81('0x44')],_0x1e9afa['query']);_0x506870[_0xcc81('0x4a')]=_[_0xcc81('0x48')](_0x1e9afa[_0xcc81('0x44')],qs[_0xcc81('0x49')](_0x5c2fb3['query'][_0xcc81('0x49')]));_0x506870['attributes']=_0x506870[_0xcc81('0x4a')][_0xcc81('0x4b')]?_0x506870['attributes']:_0x1e9afa[_0xcc81('0x44')];if(_0x5c2fb3[_0xcc81('0x45')][_0xcc81('0x56')]){_0x506870[_0xcc81('0x5b')]=[{'all':!![]}];}_0x506870=_[_0xcc81('0x53')]({},_0x506870,_0x5c2fb3['options']);return db[_0xcc81('0x3f')]['find'](_0x506870)[_0xcc81('0x1f')](handleEntityNotFound(_0x2a4cf4,null))['then'](respondWithResult(_0x2a4cf4,null))[_0xcc81('0x28')](handleError(_0x2a4cf4,null));};exports[_0xcc81('0x5c')]=function(_0x4fe6f2,_0xb19062){return db[_0xcc81('0x3f')][_0xcc81('0x5c')](_0x4fe6f2[_0xcc81('0x5d')],{})['then'](function(_0x23ca1c){var _0x426386=_0x4fe6f2['user'][_0xcc81('0x5e')]({'plain':!![]});if(!_0x426386)throw new Error(_0xcc81('0x5f'));if(_0x426386[_0xcc81('0x60')]===_0xcc81('0x61')){var _0x5e300a=_0x23ca1c[_0xcc81('0x5e')]({'plain':!![]});var _0x4e5162=_0xcc81('0x37');return db[_0xcc81('0x62')][_0xcc81('0x63')]({'where':{'name':_0x4e5162,'userProfileId':_0x426386[_0xcc81('0x64')]},'raw':!![]})[_0xcc81('0x1f')](function(_0x135c1c){if(_0x135c1c&&_0x135c1c[_0xcc81('0x65')]===0x0){return db[_0xcc81('0x38')][_0xcc81('0x5c')]({'name':_0x5e300a[_0xcc81('0x3a')],'resourceId':_0x5e300a['id'],'type':_0x135c1c['name'],'sectionId':_0x135c1c['id']},{})[_0xcc81('0x1f')](function(){return _0x23ca1c;});}else{return _0x23ca1c;}})[_0xcc81('0x28')](function(_0x55fe84){logger[_0xcc81('0x25')](_0xcc81('0x66'),_0x55fe84);throw _0x55fe84;});}return _0x23ca1c;})[_0xcc81('0x1f')](respondWithResult(_0xb19062,0xc9))['catch'](handleError(_0xb19062,null));};exports[_0xcc81('0x35')]=function(_0x3b424a,_0x380fc2){if(_0x3b424a[_0xcc81('0x5d')]['id']){delete _0x3b424a[_0xcc81('0x5d')]['id'];}return db[_0xcc81('0x3f')]['find']({'where':{'id':_0x3b424a[_0xcc81('0x5a')]['id']},'include':[{'model':db[_0xcc81('0x3d')],'as':_0xcc81('0x67')}]})[_0xcc81('0x1f')](handleEntityNotFound(_0x380fc2,null))['then'](saveUpdates(_0x3b424a[_0xcc81('0x5d')],null))[_0xcc81('0x1f')](respondWithResult(_0x380fc2,null))['catch'](handleError(_0x380fc2,null));};exports[_0xcc81('0x36')]=function(_0x453979,_0x216bbf){return db['SmsAccount']['find']({'where':{'id':_0x453979['params']['id']}})[_0xcc81('0x1f')](handleEntityNotFound(_0x216bbf,null))[_0xcc81('0x1f')](removeEntity(_0x216bbf,null))[_0xcc81('0x28')](handleError(_0x216bbf,null));};exports[_0xcc81('0x68')]=function(_0x3223fe,_0x121986){return db[_0xcc81('0x3f')][_0xcc81('0x68')]()[_0xcc81('0x1f')](respondWithResult(_0x121986,null))[_0xcc81('0x28')](handleError(_0x121986,null));};exports['addDisposition']=function(_0x312f58,_0x36cee8,_0x7712e2){if(_0x312f58[_0xcc81('0x5d')]['id']){delete _0x312f58[_0xcc81('0x5d')]['id'];}return db[_0xcc81('0x3f')][_0xcc81('0x63')]({'where':{'id':_0x312f58[_0xcc81('0x5a')]['id']}})[_0xcc81('0x1f')](handleEntityNotFound(_0x36cee8,null))['then'](function(_0x3ff2c3){if(_0x3ff2c3){_0x312f58[_0xcc81('0x5d')][_0xcc81('0x69')]=_0x3ff2c3['id'];return db['Disposition']['create'](_0x312f58['body']);}})['then'](respondWithResult(_0x36cee8,null))[_0xcc81('0x28')](handleError(_0x36cee8,null));};exports[_0xcc81('0x6a')]=function(_0xe0cc9b,_0x58cc86,_0x18a0ca){var _0x510e7b={'raw':![],'where':{}};var _0x140a3c={};var _0x5d0708={'count':0x0,'rows':[]};return db[_0xcc81('0x3f')][_0xcc81('0x6b')]({'where':{'id':_0xe0cc9b[_0xcc81('0x5a')]['id']}})[_0xcc81('0x1f')](handleEntityNotFound(_0x58cc86,null))[_0xcc81('0x1f')](function(_0x1f9d53){if(_0x1f9d53){_0x140a3c[_0xcc81('0x44')]=_[_0xcc81('0x46')](db['Disposition'][_0xcc81('0x40')]);_0x140a3c[_0xcc81('0x45')]=_[_0xcc81('0x46')](_0xe0cc9b[_0xcc81('0x45')]);_0x140a3c[_0xcc81('0x47')]=_[_0xcc81('0x48')](_0x140a3c[_0xcc81('0x44')],_0x140a3c['query']);_0x510e7b[_0xcc81('0x4a')]=_['intersection'](_0x140a3c[_0xcc81('0x44')],qs['fields'](_0xe0cc9b[_0xcc81('0x45')][_0xcc81('0x49')]));_0x510e7b['attributes']=_0x510e7b[_0xcc81('0x4a')]['length']?_0x510e7b[_0xcc81('0x4a')]:_0x140a3c[_0xcc81('0x44')];if(!_0xe0cc9b[_0xcc81('0x45')][_0xcc81('0x4c')]('nolimit')){_0x510e7b[_0xcc81('0x2c')]=qs[_0xcc81('0x2c')](_0xe0cc9b[_0xcc81('0x45')]['limit']);_0x510e7b[_0xcc81('0x2b')]=qs[_0xcc81('0x2b')](_0xe0cc9b[_0xcc81('0x45')][_0xcc81('0x2b')]);}_0x510e7b[_0xcc81('0x4e')]=qs['sort'](_0xe0cc9b['query']['sort']);_0x510e7b[_0xcc81('0x52')]=qs[_0xcc81('0x47')](_[_0xcc81('0x50')](_0xe0cc9b[_0xcc81('0x45')],_0x140a3c[_0xcc81('0x47')]));_0x510e7b[_0xcc81('0x52')][_0xcc81('0x69')]=_0x1f9d53['id'];if(_0xe0cc9b[_0xcc81('0x45')][_0xcc81('0x51')]){_0x510e7b[_0xcc81('0x52')]=_['merge'](_0x510e7b[_0xcc81('0x52')],{'$or':_['map'](_0x510e7b[_0xcc81('0x4a')],function(_0x4a22bb){var _0x2b270c={};_0x2b270c[_0x4a22bb]={'$like':'%'+_0xe0cc9b[_0xcc81('0x45')][_0xcc81('0x51')]+'%'};return _0x2b270c;})});}_0x510e7b=_[_0xcc81('0x53')]({},_0x510e7b,_0xe0cc9b['options']);return db['Disposition'][_0xcc81('0x2e')]({'where':_0x510e7b[_0xcc81('0x52')]})[_0xcc81('0x1f')](function(_0x4125f7){_0x5d0708[_0xcc81('0x2e')]=_0x4125f7;if(_0xe0cc9b['query'][_0xcc81('0x56')]){_0x510e7b[_0xcc81('0x5b')]=[{'all':!![]}];}return db[_0xcc81('0x6c')][_0xcc81('0x57')](_0x510e7b);})[_0xcc81('0x1f')](function(_0x55ea4a){_0x5d0708[_0xcc81('0x58')]=_0x55ea4a;return _0x5d0708;});}})[_0xcc81('0x1f')](respondWithFilteredResult(_0x58cc86,_0x510e7b))[_0xcc81('0x28')](handleError(_0x58cc86,null));};exports['removeDispositions']=function(_0x970566,_0x5c33ab,_0x217d41){return db[_0xcc81('0x3f')][_0xcc81('0x63')]({'where':{'id':_0x970566[_0xcc81('0x5a')]['id']}})[_0xcc81('0x1f')](handleEntityNotFound(_0x5c33ab,null))[_0xcc81('0x1f')](function(_0x33298d){if(_0x33298d){return _0x33298d[_0xcc81('0x6d')](_0x970566[_0xcc81('0x45')][_0xcc81('0x6e')]);}})[_0xcc81('0x1f')](respondWithStatusCode(_0x5c33ab,null))[_0xcc81('0x28')](handleError(_0x5c33ab,null));};exports[_0xcc81('0x6f')]=function(_0x4733b6,_0xb68d53,_0x34d95){if(_0x4733b6[_0xcc81('0x5d')]['id']){delete _0x4733b6[_0xcc81('0x5d')]['id'];}return db[_0xcc81('0x3f')]['find']({'where':{'id':_0x4733b6[_0xcc81('0x5a')]['id']}})[_0xcc81('0x1f')](handleEntityNotFound(_0xb68d53,null))['then'](function(_0x3f6e79){if(_0x3f6e79){_0x4733b6[_0xcc81('0x5d')][_0xcc81('0x69')]=_0x3f6e79['id'];return db[_0xcc81('0x70')][_0xcc81('0x5c')](_0x4733b6[_0xcc81('0x5d')]);}})[_0xcc81('0x1f')](respondWithResult(_0xb68d53,null))[_0xcc81('0x28')](handleError(_0xb68d53,null));};exports['getAnswers']=function(_0x5c1849,_0x1ccd92,_0x15883b){var _0x13e326={'raw':![],'where':{}};var _0x242ede={};var _0xbc4961={'count':0x0,'rows':[]};return db['SmsAccount'][_0xcc81('0x6b')]({'where':{'id':_0x5c1849[_0xcc81('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1ccd92,null))[_0xcc81('0x1f')](function(_0x4db36a){if(_0x4db36a){_0x242ede[_0xcc81('0x44')]=_[_0xcc81('0x46')](db[_0xcc81('0x70')][_0xcc81('0x40')]);_0x242ede[_0xcc81('0x45')]=_[_0xcc81('0x46')](_0x5c1849[_0xcc81('0x45')]);_0x242ede['filters']=_[_0xcc81('0x48')](_0x242ede['model'],_0x242ede[_0xcc81('0x45')]);_0x13e326[_0xcc81('0x4a')]=_[_0xcc81('0x48')](_0x242ede[_0xcc81('0x44')],qs[_0xcc81('0x49')](_0x5c1849[_0xcc81('0x45')][_0xcc81('0x49')]));_0x13e326[_0xcc81('0x4a')]=_0x13e326['attributes'][_0xcc81('0x4b')]?_0x13e326[_0xcc81('0x4a')]:_0x242ede[_0xcc81('0x44')];if(!_0x5c1849[_0xcc81('0x45')][_0xcc81('0x4c')](_0xcc81('0x4d'))){_0x13e326[_0xcc81('0x2c')]=qs['limit'](_0x5c1849[_0xcc81('0x45')][_0xcc81('0x2c')]);_0x13e326[_0xcc81('0x2b')]=qs['offset'](_0x5c1849['query'][_0xcc81('0x2b')]);}_0x13e326[_0xcc81('0x4e')]=qs[_0xcc81('0x4f')](_0x5c1849[_0xcc81('0x45')][_0xcc81('0x4f')]);_0x13e326['where']=qs[_0xcc81('0x47')](_[_0xcc81('0x50')](_0x5c1849[_0xcc81('0x45')],_0x242ede[_0xcc81('0x47')]));_0x13e326['where'][_0xcc81('0x69')]=_0x4db36a['id'];if(_0x5c1849[_0xcc81('0x45')]['filter']){_0x13e326[_0xcc81('0x52')]=_['merge'](_0x13e326[_0xcc81('0x52')],{'$or':_['map'](_0x13e326['attributes'],function(_0x516d9d){var _0x1c5fe4={};_0x1c5fe4[_0x516d9d]={'$like':'%'+_0x5c1849[_0xcc81('0x45')][_0xcc81('0x51')]+'%'};return _0x1c5fe4;})});}_0x13e326=_[_0xcc81('0x53')]({},_0x13e326,_0x5c1849[_0xcc81('0x55')]);return db['CannedAnswer'][_0xcc81('0x2e')]({'where':_0x13e326[_0xcc81('0x52')]})['then'](function(_0x2d3b65){_0xbc4961[_0xcc81('0x2e')]=_0x2d3b65;if(_0x5c1849[_0xcc81('0x45')][_0xcc81('0x56')]){_0x13e326[_0xcc81('0x5b')]=[{'all':!![]}];}return db[_0xcc81('0x70')][_0xcc81('0x57')](_0x13e326);})['then'](function(_0x55becf){_0xbc4961['rows']=_0x55becf;return _0xbc4961;});}})[_0xcc81('0x1f')](respondWithFilteredResult(_0x1ccd92,_0x13e326))['catch'](handleError(_0x1ccd92,null));};exports[_0xcc81('0x71')]=function(_0x366867,_0x101449,_0x5dce8f){return db[_0xcc81('0x3f')]['find']({'where':{'id':_0x366867[_0xcc81('0x5a')]['id']}})[_0xcc81('0x1f')](handleEntityNotFound(_0x101449,null))[_0xcc81('0x1f')](function(_0x2cc14e){if(_0x2cc14e){return _0x2cc14e[_0xcc81('0x71')](_0x366867['query'][_0xcc81('0x6e')]);}})[_0xcc81('0x1f')](respondWithStatusCode(_0x101449,null))[_0xcc81('0x28')](handleError(_0x101449,null));};exports[_0xcc81('0x72')]=function(_0xd6cae8,_0x588acf,_0x4da4ed){var _0x133cac={'channel':'sms'};var _0x209e3a=[];var _0x28db30=[];var _0x52af86={};return db[_0xcc81('0x3f')][_0xcc81('0x63')]({'where':{'id':_0xd6cae8[_0xcc81('0x5a')]['id']},'include':[{'model':db[_0xcc81('0x73')],'as':'Applications'}]})[_0xcc81('0x1f')](handleEntityNotFound(_0x588acf,null))[_0xcc81('0x1f')](function(_0x33db81){_0x133cac[_0xcc81('0x74')]=_0x33db81;_0x133cac[_0xcc81('0x75')]=_[_0xcc81('0x76')](_0x33db81['Applications'],[_0xcc81('0x77')],[_0xcc81('0x78')]);if(_0x133cac['account'][_0xcc81('0x79')]){delete _0x133cac[_0xcc81('0x74')][_0xcc81('0x79')];}return db['CmContact'][_0xcc81('0x68')]();})['then'](function(_0x17023a){if(!_0x17023a){throw new db[(_0xcc81('0x7a'))]['ValidationError'](_0xcc81('0x7b'));}_0x209e3a=_[_0xcc81('0x7c')](_[_0xcc81('0x46')](_0x17023a),[_0xcc81('0x7d'),'updatedAt']);_0x28db30=_[_0xcc81('0x7c')](_[_0xcc81('0x46')](_0x17023a),[_0xcc81('0x7d'),_0xcc81('0x7e'),_0xcc81('0x7f'),'ListId']);_0x133cac[_0xcc81('0x5d')]={'mapKey':_0xcc81('0x80')};if(_0x133cac['account'][_0xcc81('0x42')]){switch(_0x133cac[_0xcc81('0x74')][_0xcc81('0x42')]){case _0xcc81('0x81'):_0x133cac[_0xcc81('0x5d')][_0xcc81('0x82')]=_0xd6cae8['body'][_0xcc81('0x83')];_0x133cac[_0xcc81('0x5d')][_0xcc81('0x5d')]=_0xd6cae8[_0xcc81('0x5d')][_0xcc81('0x84')];_0x133cac['body'][_0xcc81('0x85')]=_0xd6cae8[_0xcc81('0x5d')][_0xcc81('0x86')];break;case _0xcc81('0x87'):_0x133cac[_0xcc81('0x5d')][_0xcc81('0x82')]='+'+_0xd6cae8[_0xcc81('0x5d')][_0xcc81('0x88')];_0x133cac[_0xcc81('0x5d')]['body']=_0xd6cae8[_0xcc81('0x5d')]['text'];break;case'connectel':_0x133cac[_0xcc81('0x5d')][_0xcc81('0x82')]=_0xd6cae8[_0xcc81('0x5d')][_0xcc81('0x82')];_0x133cac[_0xcc81('0x5d')]['body']=_0xd6cae8['body'][_0xcc81('0x27')];break;case'clicksend':_0x133cac[_0xcc81('0x5d')][_0xcc81('0x82')]=_0xd6cae8[_0xcc81('0x5d')]['from'];_0x133cac[_0xcc81('0x5d')][_0xcc81('0x5d')]=_0xd6cae8[_0xcc81('0x5d')][_0xcc81('0x5d')];_0x133cac[_0xcc81('0x5d')][_0xcc81('0x85')]=_0xd6cae8['body'][_0xcc81('0x89')];break;case'plivo':_0x133cac['body'][_0xcc81('0x82')]=_0xd6cae8[_0xcc81('0x5d')]['From'];_0x133cac[_0xcc81('0x5d')][_0xcc81('0x5d')]=_0xd6cae8['body']['Text'];_0x133cac[_0xcc81('0x5d')]['messageId']=_0xd6cae8['body'][_0xcc81('0x8a')];break;case _0xcc81('0x8b'):_0x133cac['body'][_0xcc81('0x82')]='+'+_0xd6cae8['body']['results'][0x0][_0xcc81('0x82')];_0x133cac[_0xcc81('0x5d')]['body']=_0xd6cae8[_0xcc81('0x5d')][_0xcc81('0x8c')][0x0][_0xcc81('0x8d')];_0x133cac[_0xcc81('0x5d')]['messageId']=_0xd6cae8['body'][_0xcc81('0x8c')][0x0]['messageId'];break;case _0xcc81('0x8e'):_0x133cac['body'][_0xcc81('0x82')]=_0xd6cae8[_0xcc81('0x5d')]['originatingAddress'];_0x133cac[_0xcc81('0x5d')]['body']=_0xd6cae8[_0xcc81('0x5d')]['segmentedMessage'][_0xcc81('0x27')];break;case _0xcc81('0x8f'):_0x133cac[_0xcc81('0x5d')][_0xcc81('0x82')]=_0xd6cae8[_0xcc81('0x5d')]['fromNumber'];_0x133cac[_0xcc81('0x5d')][_0xcc81('0x5d')]=_0xd6cae8['body'][_0xcc81('0x8d')];_0x133cac[_0xcc81('0x5d')]['messageId']=_0xd6cae8[_0xcc81('0x5d')][_0xcc81('0x90')];break;case _0xcc81('0x91'):_0x133cac[_0xcc81('0x5d')]['messageId']=_0xd6cae8[_0xcc81('0x5d')][0x0][_0xcc81('0x27')]['id'];_0x133cac[_0xcc81('0x5d')][_0xcc81('0x82')]=_0xd6cae8[_0xcc81('0x5d')][0x0][_0xcc81('0x27')][_0xcc81('0x82')];_0x133cac[_0xcc81('0x5d')]['body']=_0xd6cae8[_0xcc81('0x5d')][0x0][_0xcc81('0x27')][_0xcc81('0x8d')];break;case _0xcc81('0x92'):_0x133cac['body']['from']=_0xd6cae8['body']['from'];_0x133cac[_0xcc81('0x5d')]['body']=_0xd6cae8[_0xcc81('0x5d')][_0xcc81('0x27')];_0x133cac[_0xcc81('0x5d')][_0xcc81('0x85')]=_0xd6cae8[_0xcc81('0x5d')][_0xcc81('0x93')];break;}}if(_0x133cac[_0xcc81('0x5d')]['id']){delete _0x133cac[_0xcc81('0x5d')]['id'];}if(_[_0xcc81('0x94')](_0x133cac[_0xcc81('0x5d')][_0xcc81('0x82')])){throw new db[(_0xcc81('0x7a'))][(_0xcc81('0x95'))](_0xcc81('0x96'));}if(_[_0xcc81('0x94')](_0x133cac[_0xcc81('0x5d')]['body'])||_0x133cac[_0xcc81('0x5d')][_0xcc81('0x5d')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x133cac[_0xcc81('0x5d')][_0xcc81('0x97')])){throw new db[(_0xcc81('0x7a'))]['ValidationError'](_0xcc81('0x98')+_0x28db30);}if(!_[_0xcc81('0x99')](_0x28db30,_0x133cac['body'][_0xcc81('0x97')])){throw new db[(_0xcc81('0x7a'))][(_0xcc81('0x95'))](_0xcc81('0x9a')+_0x28db30);}_0x52af86[_0x133cac[_0xcc81('0x5d')][_0xcc81('0x97')]]=_0x133cac[_0xcc81('0x5d')][_0xcc81('0x82')];return db[_0xcc81('0x9b')][_0xcc81('0x63')]({'where':{'id':_0x133cac['account'][_0xcc81('0x9c')]},'include':[{'model':db['CmContact'],'as':_0xcc81('0x9d'),'where':_0x52af86,'limit':0x1,'order':[['updatedAt',_0xcc81('0x9e')]]}]});})['then'](handleEntityNotFound(_0x588acf,null))[_0xcc81('0x1f')](function(_0x1b3fc4){if(_0x1b3fc4){_0x133cac[_0xcc81('0x9f')]=_['omit'](_0x1b3fc4,[_0xcc81('0x9d')]);if(_0x1b3fc4['Contacts'][_0xcc81('0x4b')]){return _0x1b3fc4[_0xcc81('0x9d')][0x0];}var _0x2614f0=_[_0xcc81('0xa0')](_0x133cac['body'],{'firstName':_0x133cac[_0xcc81('0x5d')][_0xcc81('0x82')],'ListId':_0x1b3fc4['id']});_0x2614f0[_0x133cac[_0xcc81('0x5d')][_0xcc81('0x97')]]=_0x133cac[_0xcc81('0x5d')]['from'];return db[_0xcc81('0xa1')][_0xcc81('0x5c')](_0x2614f0,{'fields':_0x209e3a,'raw':!![]});}})['then'](handleEntityNotFound(_0x588acf,null))[_0xcc81('0x1f')](function(_0xa8cb8e){if(_0xa8cb8e){_0x133cac[_0xcc81('0xa2')]=_0xa8cb8e;var _0x1bcd29={'ContactId':_0xa8cb8e['id'],'phone':_0x133cac[_0xcc81('0x5d')][_0xcc81('0x82')],'SmsAccountId':_0xd6cae8[_0xcc81('0x5a')]['id']};var _0x58e0f5={'ContactId':_0xa8cb8e['id'],'SmsAccountId':_0xd6cae8[_0xcc81('0x5a')]['id'],'closed':![]};return db[_0xcc81('0xa3')][_0xcc81('0x63')]({'where':_0x58e0f5})['then'](function(_0x5dc14b){if(_0x5dc14b){return[_0x5dc14b,![]];}return db[_0xcc81('0xa3')][_0xcc81('0x5c')](_0x1bcd29)['then'](function(_0xf8b38b){return[_0xf8b38b,!![]];});});}})[_0xcc81('0xa4')](function(_0x16cc9e,_0x2a894e){_0x133cac[_0xcc81('0xa5')]=_0x16cc9e['get']({'plain':!![]});_0x133cac['interaction'][_0xcc81('0xa6')]=![];if(_0x2a894e){if(_0x133cac[_0xcc81('0x74')][_0xcc81('0xa7')]){_0x133cac['applications'][_0xcc81('0xa8')]({'id':0x0,'priority':_0x133cac[_0xcc81('0x75')][_0xcc81('0x4b')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xcc81('0xa9')});}_0x133cac['interaction'][_0xcc81('0xa6')]=!![];}return db[_0xcc81('0xaa')][_0xcc81('0x5c')]({'phone':_0x133cac[_0xcc81('0x5d')][_0xcc81('0x82')],'messageId':_0x133cac['body'][_0xcc81('0x85')],'body':_0x133cac[_0xcc81('0x5d')][_0xcc81('0x5d')],'SmsAccountId':_0xd6cae8[_0xcc81('0x5a')]['id'],'SmsInteractionId':_0x16cc9e['id'],'direction':'in','ContactId':_0x16cc9e['ContactId'],'AttachmentId':_0x133cac[_0xcc81('0x5d')]['AttachmentId']});})['then'](function(_0x2e9b82){_0x133cac['message']=_0x2e9b82;if(_0x133cac[_0xcc81('0xa5')][_0xcc81('0xab')]){return db[_0xcc81('0xac')][_0xcc81('0x63')]({'attributes':['id',_0xcc81('0x3a')],'where':{'id':_0x133cac[_0xcc81('0xa5')][_0xcc81('0xab')]}})[_0xcc81('0x1f')](function(_0x1af375){if(_0x1af375){_0x133cac[_0xcc81('0x75')]['unshift']({'id':0x0,'priority':0x0,'app':_0xcc81('0xad'),'appdata':_0x1af375[_0xcc81('0x3a')]+','+(_0x133cac[_0xcc81('0x74')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xcc81('0xae'),'startRouting',_0x133cac);});}return respondWithRpcPromise('Start',_0xcc81('0xaf'),_0x133cac);})[_0xcc81('0x1f')](function(_0x3ab6f5){if(_0x3ab6f5){var _0x1ede69=0xc8;var _0x5b05df=_0xcc81('0xb0');logger[_0xcc81('0x20')](_0xcc81('0xb1'),_0x5b05df,_0x1ede69,_0xcc81('0xb2'));logger['debug'](_0xcc81('0xb3'),_0x5b05df,_0x1ede69,'entity\x20found',JSON['stringify'](_0x3ab6f5));if(_0x133cac[_0xcc81('0x74')]['type']===_0xcc81('0x81')){return _0x588acf['status'](_0x1ede69)[_0xcc81('0x30')]('Content-Type','text/xml')[_0xcc81('0x3b')](_0xcc81('0xb4'));}else{return _0x588acf[_0xcc81('0x2f')](_0x1ede69)[_0xcc81('0x2a')](_0x3ab6f5);}}})['catch'](handleError(_0x588acf,null));};exports[_0xcc81('0xb5')]=function(_0x3f97a8,_0x12d895){var _0x409740=_0x3f97a8[_0xcc81('0x5a')]['id'];var _0x5dcbc0=_0x3f97a8[_0xcc81('0x5d')];var _0x10c8d1=0xc8;var _0x23fcce=null;return db[_0xcc81('0xb6')][_0xcc81('0xb7')]({'isolationLevel':db[_0xcc81('0xb6')][_0xcc81('0xb8')][_0xcc81('0xb9')][_0xcc81('0xba')]},function(_0x5cbc08){return db[_0xcc81('0x3f')][_0xcc81('0x6b')]({'where':{'id':_0x409740},'transaction':_0x5cbc08})['then'](function(_0x3b424c){if(_0x3b424c){return db['SmsApplication'][_0xcc81('0x36')]({'where':{'SmsAccountId':_0x409740},'transaction':_0x5cbc08})[_0xcc81('0x1f')](function(){var _0x13c63f=_[_0xcc81('0x3e')](_0x5dcbc0,function(_0x50ed85){_0x50ed85[_0xcc81('0x69')]=_0x409740;return _0x50ed85;});return db[_0xcc81('0x73')][_0xcc81('0xbb')](_0x13c63f,{'transaction':_0x5cbc08});});}else{_0x10c8d1=0x194;_0x23fcce=[];}});})[_0xcc81('0x1f')](function(){if(_0x10c8d1!==0x194){return db[_0xcc81('0x73')][_0xcc81('0xbc')]({'where':{'SmsAccountId':_0x409740},'order':'priority'})['then'](function(_0x49d6d6){_0x23fcce=_0x49d6d6;});}})[_0xcc81('0x28')](function(_0x42e615){_0x10c8d1=0x1f4;logger[_0xcc81('0x25')](_0x42e615['stack']);if(_0x42e615[_0xcc81('0x3a')]){delete _0x42e615[_0xcc81('0x3a')];}_0x23fcce=_0x42e615;})[_0xcc81('0xbd')](function(){if(_0x23fcce===null){_0x12d895[_0xcc81('0xbe')](_0x10c8d1);}else{if(_0x10c8d1===0x1f4){_0x12d895[_0xcc81('0x2f')](_0x10c8d1)[_0xcc81('0x3b')](_0x23fcce);}else{_0x12d895[_0xcc81('0x2f')](_0x10c8d1)[_0xcc81('0x2a')](_0x23fcce);}}});};exports[_0xcc81('0xbf')]=function(_0x1c937b,_0x43552d,_0x3d335d){var _0x55203c={};var _0x7e389e={};var _0x5d9142;var _0x88a67c;return db['SmsAccount'][_0xcc81('0x6b')]({'where':{'id':_0x1c937b[_0xcc81('0x5a')]['id']}})[_0xcc81('0x1f')](handleEntityNotFound(_0x43552d,null))['then'](function(_0x4fbc07){if(_0x4fbc07){_0x5d9142=_0x4fbc07;_0x7e389e[_0xcc81('0x44')]=_['keys'](db['SmsApplication'][_0xcc81('0x40')]);_0x7e389e[_0xcc81('0x45')]=_[_0xcc81('0x46')](_0x1c937b[_0xcc81('0x45')]);_0x7e389e[_0xcc81('0x47')]=_[_0xcc81('0x48')](_0x7e389e[_0xcc81('0x44')],_0x7e389e['query']);_0x55203c[_0xcc81('0x4a')]=_[_0xcc81('0x48')](_0x7e389e[_0xcc81('0x44')],qs[_0xcc81('0x49')](_0x1c937b['query'][_0xcc81('0x49')]));_0x55203c[_0xcc81('0x4a')]=_0x55203c[_0xcc81('0x4a')][_0xcc81('0x4b')]?_0x55203c[_0xcc81('0x4a')]:_0x7e389e['model'];_0x55203c['order']=qs[_0xcc81('0x4f')](_0x1c937b['query'][_0xcc81('0x4f')]);_0x55203c['where']=qs['filters'](_[_0xcc81('0x50')](_0x1c937b['query'],_0x7e389e[_0xcc81('0x47')]));if(_0x1c937b[_0xcc81('0x45')][_0xcc81('0x51')]){_0x55203c[_0xcc81('0x52')]=_[_0xcc81('0x53')](_0x55203c[_0xcc81('0x52')],{'$or':_[_0xcc81('0x3e')](_0x55203c[_0xcc81('0x4a')],function(_0xd335cf){var _0xb44f93={};_0xb44f93[_0xd335cf]={'$like':'%'+_0x1c937b[_0xcc81('0x45')][_0xcc81('0x51')]+'%'};return _0xb44f93;})});}_0x55203c=_[_0xcc81('0x53')]({},_0x55203c,_0x1c937b[_0xcc81('0x55')]);return _0x5d9142['getApplications'](_0x55203c);}})[_0xcc81('0x1f')](function(_0x375c88){if(_0x375c88){_0x88a67c=_0x375c88['length'];if(!_0x1c937b[_0xcc81('0x45')][_0xcc81('0x4c')]('nolimit')){_0x55203c[_0xcc81('0x2c')]=qs[_0xcc81('0x2c')](_0x1c937b['query'][_0xcc81('0x2c')]);_0x55203c['offset']=qs[_0xcc81('0x2b')](_0x1c937b[_0xcc81('0x45')]['offset']);}return _0x5d9142[_0xcc81('0xbf')](_0x55203c);}})['then'](function(_0x43b124){if(_0x43b124){return _0x43b124?{'count':_0x88a67c,'rows':_0x43b124}:null;}})[_0xcc81('0x1f')](respondWithResult(_0x43552d,null))[_0xcc81('0x28')](handleError(_0x43552d,null));};exports[_0xcc81('0xc0')]=function(_0x14050f,_0x710127,_0x58fce1){var _0x2b1fd8={'raw':![],'where':{}};var _0x7bee14={};var _0x3216ce={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x14050f[_0xcc81('0x5a')]['id']}})[_0xcc81('0x1f')](handleEntityNotFound(_0x710127,null))[_0xcc81('0x1f')](function(_0x4370e8){if(_0x4370e8){_0x7bee14['model']=_[_0xcc81('0x46')](db[_0xcc81('0xa3')][_0xcc81('0x40')]);_0x7bee14['query']=_[_0xcc81('0x46')](_0x14050f[_0xcc81('0x45')]);_0x7bee14['filters']=_[_0xcc81('0x48')](_0x7bee14[_0xcc81('0x44')],_0x7bee14[_0xcc81('0x45')]);_0x2b1fd8[_0xcc81('0x4a')]=_['intersection'](_0x7bee14[_0xcc81('0x44')],qs[_0xcc81('0x49')](_0x14050f['query'][_0xcc81('0x49')]));_0x2b1fd8[_0xcc81('0x4a')]=_0x2b1fd8[_0xcc81('0x4a')][_0xcc81('0x4b')]?_0x2b1fd8[_0xcc81('0x4a')]:_0x7bee14['model'];if(!_0x14050f['query'][_0xcc81('0x4c')](_0xcc81('0x4d'))){_0x2b1fd8[_0xcc81('0x2c')]=qs[_0xcc81('0x2c')](_0x14050f[_0xcc81('0x45')][_0xcc81('0x2c')]);_0x2b1fd8[_0xcc81('0x2b')]=qs['offset'](_0x14050f[_0xcc81('0x45')]['offset']);}_0x2b1fd8[_0xcc81('0x4e')]=qs[_0xcc81('0x4f')](_0x14050f[_0xcc81('0x45')][_0xcc81('0x4f')]);_0x2b1fd8[_0xcc81('0x52')]=qs[_0xcc81('0x47')](_[_0xcc81('0x50')](_0x14050f[_0xcc81('0x45')],_0x7bee14[_0xcc81('0x47')]));_0x2b1fd8[_0xcc81('0x52')][_0xcc81('0x69')]=_0x4370e8['id'];if(_0x14050f[_0xcc81('0x45')][_0xcc81('0x51')]){_0x2b1fd8['where']=_[_0xcc81('0x53')](_0x2b1fd8[_0xcc81('0x52')],{'$or':_[_0xcc81('0x3e')](_0x2b1fd8[_0xcc81('0x4a')],function(_0x43f790){var _0x37b065={};_0x37b065[_0x43f790]={'$like':'%'+_0x14050f['query']['filter']+'%'};return _0x37b065;})});}_0x2b1fd8=_[_0xcc81('0x53')]({},_0x2b1fd8,_0x14050f[_0xcc81('0x55')]);return db[_0xcc81('0xa3')][_0xcc81('0x2e')]({'where':_0x2b1fd8[_0xcc81('0x52')]})['then'](function(_0x188fb7){_0x3216ce[_0xcc81('0x2e')]=_0x188fb7;if(_0x14050f[_0xcc81('0x45')]['includeAll']){_0x2b1fd8[_0xcc81('0x5b')]=[{'model':db[_0xcc81('0xa1')],'as':_0xcc81('0xc1'),'required':![]},{'model':db[_0xcc81('0xac')],'as':_0xcc81('0xc2'),'attributes':[_0xcc81('0x3a'),_0xcc81('0xc3'),_0xcc81('0xc4')],'required':![]},{'model':db['Tag'],'as':_0xcc81('0xc5'),'attributes':['id','name',_0xcc81('0xc6')],'where':_0x14050f[_0xcc81('0x45')]['tag']?{'id':_0x14050f['query'][_0xcc81('0xc7')]}:undefined,'required':_0x14050f[_0xcc81('0x45')][_0xcc81('0xc7')]?!![]:![]}];}return db[_0xcc81('0xa3')][_0xcc81('0x57')](_0x2b1fd8);})[_0xcc81('0x1f')](function(_0x341275){_0x3216ce[_0xcc81('0x58')]=_0x341275;return _0x3216ce;});}})[_0xcc81('0x1f')](respondWithFilteredResult(_0x710127,_0x2b1fd8))['catch'](handleError(_0x710127,null));};exports[_0xcc81('0x3b')]=function(_0x5d5c96,_0x17c382,_0x21a028){var _0x2ea20e,_0x790f97,_0x32c0ab;if(_['isNil'](_0x5d5c96['body'][_0xcc81('0x5d')])||_0x5d5c96[_0xcc81('0x5d')][_0xcc81('0x5d')]===''){throw new db[(_0xcc81('0x7a'))][(_0xcc81('0x95'))](_0xcc81('0xc8'));}if(_[_0xcc81('0x94')](_0x5d5c96[_0xcc81('0x5d')]['to'])){throw new db[(_0xcc81('0x7a'))][(_0xcc81('0x95'))]('to\x20is\x20mandatory');}_0x2ea20e=_0x5d5c96['body']['to'];return db[_0xcc81('0x3f')][_0xcc81('0x63')]({'where':{'id':_0x5d5c96[_0xcc81('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0xcc81('0xc9'),'include':[{'model':db[_0xcc81('0xa1')],'as':_0xcc81('0x9d'),'where':{'mobile':_0x2ea20e},'limit':0x1,'order':[[_0xcc81('0x7e'),_0xcc81('0x9e')]]}]}]})[_0xcc81('0x1f')](handleEntityNotFound(_0x17c382,null))[_0xcc81('0x1f')](function(_0x92690d){if(_0x92690d&&_0x92690d[_0xcc81('0xc9')]){_0x790f97=_0x92690d[_0xcc81('0x5e')]({'plain':!![]});if(_0x790f97[_0xcc81('0xc9')]&&_0x790f97[_0xcc81('0xc9')][_0xcc81('0x9d')][_0xcc81('0x4b')]){return _0x790f97[_0xcc81('0xc9')]['Contacts'][0x0];}return db[_0xcc81('0xa1')][_0xcc81('0x5c')](_[_0xcc81('0xa0')](_0x5d5c96['body'],{'firstName':_0x2ea20e,'mobile':_0x2ea20e,'phone':_0x2ea20e,'ListId':_0x790f97[_0xcc81('0x9c')]}));}})['then'](handleEntityNotFound(_0x17c382,null))[_0xcc81('0x1f')](function(_0x36db9e){if(_0x36db9e){_0x32c0ab=_0x36db9e;return db[_0xcc81('0xa3')][_0xcc81('0x63')]({'where':{'ContactId':_0x32c0ab['id'],'closed':![],'SmsAccountId':_0x790f97['id']}})[_0xcc81('0x1f')](function(_0x60c724){if(_0x60c724){return[_0x60c724,![]];}return db[_0xcc81('0xa3')][_0xcc81('0x5c')]({'UserId':_0x5d5c96[_0xcc81('0x61')]['id'],'ContactId':_0x32c0ab['id'],'SmsAccountId':_0x790f97['id'],'phone':_0x2ea20e,'firstMsgDirection':'out','Messages':[_[_0xcc81('0x53')](_0x5d5c96[_0xcc81('0x5d')],{'read':![],'body':_0x5d5c96[_0xcc81('0x5d')][_0xcc81('0x5d')],'phone':_0x2ea20e,'SmsAccountId':_0x790f97['id'],'UserId':_0x5d5c96[_0xcc81('0x61')]['id'],'ContactId':_0x32c0ab['id']})]},{'include':[{'model':db[_0xcc81('0xaa')],'as':_0xcc81('0xca')}]})[_0xcc81('0x1f')](function(_0x4a88a5){return[_0x4a88a5,!![]];});});}})[_0xcc81('0xa4')](function(_0x2b7976,_0x227259){if(_0x227259){return _0x2b7976;}return db[_0xcc81('0xaa')][_0xcc81('0x5c')](_['merge'](_0x5d5c96[_0xcc81('0x5d')],{'read':![],'body':_0x5d5c96[_0xcc81('0x5d')][_0xcc81('0x5d')],'phone':_0x2ea20e,'SmsAccountId':_0x790f97['id'],'SmsInteractionId':_0x2b7976['id'],'UserId':_0x5d5c96[_0xcc81('0x61')]['id'],'ContactId':_0x32c0ab['id']}))[_0xcc81('0x1f')](function(_0x23f462){_0x2b7976['dataValues'][_0xcc81('0xca')]=[];_0x2b7976[_0xcc81('0xcb')]['Messages'][_0xcc81('0xa8')](_0x23f462['dataValues']);return _0x2b7976;});})[_0xcc81('0x1f')](respondWithResult(_0x17c382,null))['catch'](handleError(_0x17c382,null));};exports['status']=function(_0x14585b,_0x5c2d8c,_0x12a906){if(_0x14585b[_0xcc81('0x5d')]['id']){delete _0x14585b['body']['id'];}var _0x5213c7,_0x4b383a,_0x20f4c7;return db[_0xcc81('0x3f')][_0xcc81('0x63')]({'where':{'id':_0x14585b[_0xcc81('0x5a')]['id']}})[_0xcc81('0x1f')](handleEntityNotFound(_0x5c2d8c,null))['then'](function(_0x30cbed){if(_0x30cbed){_0x20f4c7=_0x30cbed;logger[_0xcc81('0x23')](_0xcc81('0xb1'),_0xcc81('0x2f'),'received\x20delivery\x20report\x20from',_0x30cbed[_0xcc81('0x42')],util[_0xcc81('0xcc')](_0x14585b['body'],{'showHidden':![],'depth':null}));switch(_0x30cbed[_0xcc81('0x42')]){case _0xcc81('0x87'):if(_0x14585b[_0xcc81('0x5d')][_0xcc81('0xcd')]&&_0x14585b[_0xcc81('0x5d')]['status']){_0x4b383a=_0x14585b[_0xcc81('0x5d')][_0xcc81('0x2f')];return db['SmsMessage'][_0xcc81('0x63')]({'where':{'messageId':_0x14585b['body']['skebby_dispatch_id']}});}break;case _0xcc81('0xce'):if(_0x14585b[_0xcc81('0x5d')][_0xcc81('0xcf')]&&_0x14585b['body']['statusInt']){_0x4b383a=_0x14585b[_0xcc81('0x5d')][_0xcc81('0xd0')];return db[_0xcc81('0xaa')][_0xcc81('0x63')]({'where':{'messageId':_0x14585b[_0xcc81('0x5d')][_0xcc81('0xcf')]}});}break;case'clicksend':if(_0x14585b[_0xcc81('0x5d')][_0xcc81('0x89')]&&_0x14585b[_0xcc81('0x5d')]['status_code']){_0x4b383a=_0x14585b[_0xcc81('0x5d')][_0xcc81('0xd1')];return db['SmsMessage'][_0xcc81('0x63')]({'where':{'messageId':_0x14585b[_0xcc81('0x5d')]['message_id']}});}break;case _0xcc81('0x8b'):var _0x595629=_0x14585b['body']['results'][0x0];if(_0x595629[_0xcc81('0x85')]&&_0x595629[_0xcc81('0x2f')][_0xcc81('0xd2')]===_0xcc81('0xd3')){_0x4b383a=_0x595629[_0xcc81('0x2f')][_0xcc81('0xd2')];return db['SmsMessage'][_0xcc81('0x63')]({'where':{'messageId':_0x595629[_0xcc81('0x85')]}});}break;case _0xcc81('0x8f'):if(_0x14585b[_0xcc81('0x5d')][_0xcc81('0x85')]&&_0x14585b[_0xcc81('0x5d')][_0xcc81('0x2f')]){_0x4b383a=_0x14585b[_0xcc81('0x5d')][_0xcc81('0x2f')];return db['SmsMessage'][_0xcc81('0x63')]({'where':{'messageId':_0x14585b[_0xcc81('0x5d')][_0xcc81('0x85')]}});}break;case _0xcc81('0x91'):if(_0x14585b[_0xcc81('0x5d')][0x0][_0xcc81('0x27')]['id']){_0x4b383a=_0x14585b['body'][0x0][_0xcc81('0x42')];return db[_0xcc81('0xaa')]['find']({'where':{'messageId':_0x14585b[_0xcc81('0x5d')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x14585b[_0xcc81('0x5d')][_0xcc81('0xd4')]&&_0x14585b['body'][_0xcc81('0x2f')]){_0x4b383a=_0x14585b[_0xcc81('0x5d')][_0xcc81('0x2f')];return db[_0xcc81('0xaa')][_0xcc81('0x63')]({'where':{'messageId':_0x14585b['body'][_0xcc81('0xd4')]}});}break;}}})[_0xcc81('0x1f')](handleEntityNotFound(_0x5c2d8c,null))[_0xcc81('0x1f')](function(_0xee4edb){if(_0xee4edb){_0x5213c7=_0xee4edb;switch(_0x20f4c7[_0xcc81('0x42')]){case _0xcc81('0x87'):if(_0x4b383a===_0xcc81('0xd3')){return _0x5213c7[_0xcc81('0x35')]({'read':!![]});}else{logger[_0xcc81('0x25')](_0xcc81('0xb1'),_0xcc81('0x2f'),'skebby',util[_0xcc81('0xcc')](_0x14585b[_0xcc81('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xcc81('0xce'):if(_0x4b383a==='1'){return _0x5213c7[_0xcc81('0x35')]({'read':!![]});}else{logger[_0xcc81('0x25')](_0xcc81('0xb1'),'status',_0xcc81('0x87'),util['inspect'](_0x14585b[_0xcc81('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xcc81('0xd5'):if(!_0x14585b[_0xcc81('0x5d')][_0xcc81('0xd6')]&&_0x4b383a>=0xc8&&_0x4b383a<=0xce){return _0x5213c7[_0xcc81('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcc81('0x2f'),_0xcc81('0xd5'),util[_0xcc81('0xcc')](_0x14585b[_0xcc81('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xcc81('0x8b'):var _0x5d4525=_0x14585b[_0xcc81('0x5d')][_0xcc81('0x8c')][0x0];if(_0x5d4525[_0xcc81('0x2f')][_0xcc81('0xd2')]==='DELIVERED'){return _0x5213c7[_0xcc81('0x35')]({'read':!![]});}else{logger[_0xcc81('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcc81('0x2f'),'infobip',util[_0xcc81('0xcc')](_0x14585b[_0xcc81('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xcc81('0x8f'):if(_0x4b383a==_0xcc81('0xd7')||_0x4b383a==_0xcc81('0xd8')){return _0x5213c7[_0xcc81('0x35')]({'read':!![]});}else{logger['error'](_0xcc81('0xb1'),_0xcc81('0x2f'),_0xcc81('0x8f'),util[_0xcc81('0xcc')](_0x14585b[_0xcc81('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xcc81('0x91'):if(_0x4b383a==_0xcc81('0xd9')){return _0x5213c7[_0xcc81('0x35')]({'read':!![]});}else{logger['error'](_0xcc81('0xb1'),'status',_0xcc81('0x91'),util[_0xcc81('0xcc')](_0x14585b[_0xcc81('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xcc81('0x92'):if(_0x4b383a===_0xcc81('0xda')||_0x4b383a==='ACCEPTD'){return _0x5213c7['update']({'read':!![]});}else{logger['error'](_0xcc81('0xb1'),_0xcc81('0x2f'),_0xcc81('0x92'),util[_0xcc81('0xcc')](_0x14585b[_0xcc81('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x5213c7;}})[_0xcc81('0x1f')](respondWithResult(_0x5c2d8c,null))['catch'](handleError(_0x5c2d8c,null));};exports['statusGet']=function(_0x1030b3,_0x18d9b2,_0x5790b1){var _0x1f8c67,_0x1cc374,_0x198cfe;return db[_0xcc81('0x3f')][_0xcc81('0x63')]({'where':{'id':_0x1030b3[_0xcc81('0x5a')]['id']}})[_0xcc81('0x1f')](handleEntityNotFound(_0x18d9b2,null))[_0xcc81('0x1f')](function(_0x19e0d0){if(_0x19e0d0){_0x198cfe=_0x19e0d0;logger[_0xcc81('0x23')](_0xcc81('0xb1'),_0xcc81('0x2f'),_0xcc81('0xdb'),_0x19e0d0['type'],util['inspect'](_0x1030b3[_0xcc81('0x45')],{'showHidden':![],'depth':null}));switch(_0x19e0d0[_0xcc81('0x42')]){case _0xcc81('0x8e'):if(_0x1030b3[_0xcc81('0x45')][_0xcc81('0xdc')]&&_0x1030b3[_0xcc81('0x45')][_0xcc81('0xdd')]){_0x1cc374=_0x1030b3[_0xcc81('0x45')][_0xcc81('0xdd')];return db[_0xcc81('0xaa')][_0xcc81('0x63')]({'where':{'messageId':_0x1030b3[_0xcc81('0x45')]['message-id']}});}break;}}})[_0xcc81('0x1f')](handleEntityNotFound(_0x18d9b2,null))[_0xcc81('0x1f')](function(_0xd71c52){if(_0xd71c52){_0x1f8c67=_0xd71c52;switch(_0x198cfe['type']){case _0xcc81('0x8e'):if(_0x1cc374==='2'||_0x1cc374==='6'){return _0x1f8c67['update']({'read':!![]});}else{logger[_0xcc81('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcc81('0x2f'),_0xcc81('0x8e'),util[_0xcc81('0xcc')](_0x1030b3[_0xcc81('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x1f8c67;}})[_0xcc81('0x1f')](respondWithResult(_0x18d9b2,null))[_0xcc81('0x28')](handleError(_0x18d9b2,null));};exports['addAgents']=function(_0x3491bf,_0x15fa7c,_0x4d7313){return db[_0xcc81('0x3f')][_0xcc81('0x63')]({'where':{'id':_0x3491bf[_0xcc81('0x5a')]['id']}})[_0xcc81('0x1f')](handleEntityNotFound(_0x15fa7c,null))[_0xcc81('0x1f')](function(_0x4bea9a){if(_0x4bea9a){return _0x4bea9a[_0xcc81('0xde')](_0x3491bf[_0xcc81('0x5d')][_0xcc81('0x6e')],_[_0xcc81('0xdf')](_0x3491bf[_0xcc81('0x5d')],[_0xcc81('0x6e'),'id'])||{})[_0xcc81('0xa4')](function(_0x540138){for(var _0xbeb9e3=0x0;_0xbeb9e3<_0x3491bf[_0xcc81('0x5d')][_0xcc81('0x6e')]['length'];_0xbeb9e3+=0x1){socket[_0xcc81('0xe0')](_0xcc81('0xe1'),{'UserId':Number(_0x3491bf[_0xcc81('0x5d')]['ids'][_0xbeb9e3]),'SmsAccountId':Number(_0x3491bf['params']['id'])});}return _0x540138;});}})['then'](respondWithResult(_0x15fa7c,null))[_0xcc81('0x28')](handleError(_0x15fa7c,null));};exports[_0xcc81('0xe2')]=function(_0x2f1f26,_0x335f0b,_0x42f109){return db[_0xcc81('0x3f')][_0xcc81('0x63')]({'where':{'id':_0x2f1f26[_0xcc81('0x5a')]['id']}})['then'](handleEntityNotFound(_0x335f0b,null))[_0xcc81('0x1f')](function(_0x57b7ee){if(_0x57b7ee){return _0x57b7ee[_0xcc81('0xe2')](_0x2f1f26[_0xcc81('0x45')][_0xcc81('0x6e')])[_0xcc81('0x1f')](function(){if(_[_0xcc81('0xe3')](_0x2f1f26['query'][_0xcc81('0x6e')])){for(var _0x5a491c=0x0;_0x5a491c<_0x2f1f26[_0xcc81('0x45')]['ids'][_0xcc81('0x4b')];_0x5a491c+=0x1){socket[_0xcc81('0xe0')](_0xcc81('0xe4'),{'UserId':Number(_0x2f1f26['query']['ids'][_0x5a491c]),'SmsAccountId':Number(_0x2f1f26[_0xcc81('0x5a')]['id'])});}}else{socket[_0xcc81('0xe0')](_0xcc81('0xe4'),{'UserId':Number(_0x2f1f26['query'][_0xcc81('0x6e')]),'SmsAccountId':Number(_0x2f1f26[_0xcc81('0x5a')]['id'])});}});}})[_0xcc81('0x1f')](respondWithStatusCode(_0x335f0b,null))[_0xcc81('0x28')](handleError(_0x335f0b,null));};exports['getAgents']=function(_0x10b291,_0x529f08,_0x262e7b){var _0x5c422f={};var _0x247a59={};var _0x300308;var _0x1791b1;return db['SmsAccount'][_0xcc81('0x6b')]({'where':{'id':_0x10b291['params']['id']}})[_0xcc81('0x1f')](handleEntityNotFound(_0x529f08,null))[_0xcc81('0x1f')](function(_0x558c31){if(_0x558c31){_0x300308=_0x558c31;_0x247a59[_0xcc81('0x44')]=_[_0xcc81('0x46')](db[_0xcc81('0xac')][_0xcc81('0x40')]);_0x247a59[_0xcc81('0x45')]=_[_0xcc81('0x46')](_0x10b291[_0xcc81('0x45')]);_0x247a59[_0xcc81('0x47')]=_[_0xcc81('0x48')](_0x247a59[_0xcc81('0x44')],_0x247a59[_0xcc81('0x45')]);_0x5c422f[_0xcc81('0x4a')]=_['intersection'](_0x247a59[_0xcc81('0x44')],qs[_0xcc81('0x49')](_0x10b291[_0xcc81('0x45')][_0xcc81('0x49')]));_0x5c422f[_0xcc81('0x4a')]=_0x5c422f[_0xcc81('0x4a')][_0xcc81('0x4b')]?_0x5c422f[_0xcc81('0x4a')]:_0x247a59[_0xcc81('0x44')];_0x5c422f[_0xcc81('0x4e')]=qs[_0xcc81('0x4f')](_0x10b291[_0xcc81('0x45')][_0xcc81('0x4f')]);_0x5c422f[_0xcc81('0x52')]=qs['filters'](_['pick'](_0x10b291['query'],_0x247a59[_0xcc81('0x47')]));if(_0x10b291[_0xcc81('0x45')][_0xcc81('0x51')]){_0x5c422f[_0xcc81('0x52')]=_[_0xcc81('0x53')](_0x5c422f[_0xcc81('0x52')],{'$or':_[_0xcc81('0x3e')](_0x5c422f[_0xcc81('0x4a')],function(_0x5c16f0){var _0xa7aaa9={};_0xa7aaa9[_0x5c16f0]={'$like':'%'+_0x10b291['query'][_0xcc81('0x51')]+'%'};return _0xa7aaa9;})});}_0x5c422f=_['merge']({},_0x5c422f,_0x10b291['options']);return _0x300308[_0xcc81('0xe5')](_0x5c422f);}})['then'](function(_0x1013f6){if(_0x1013f6){_0x1791b1=_0x1013f6[_0xcc81('0x4b')];if(!_0x10b291[_0xcc81('0x45')][_0xcc81('0x4c')](_0xcc81('0x4d'))){_0x5c422f[_0xcc81('0x2c')]=qs[_0xcc81('0x2c')](_0x10b291[_0xcc81('0x45')][_0xcc81('0x2c')]);_0x5c422f[_0xcc81('0x2b')]=qs[_0xcc81('0x2b')](_0x10b291[_0xcc81('0x45')][_0xcc81('0x2b')]);}return _0x300308[_0xcc81('0xe5')](_0x5c422f);}})[_0xcc81('0x1f')](function(_0x5b4db4){if(_0x5b4db4){return _0x5b4db4?{'count':_0x1791b1,'rows':_0x5b4db4}:null;}})[_0xcc81('0x1f')](respondWithResult(_0x529f08,null))[_0xcc81('0x28')](handleError(_0x529f08,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index a242ae5..3b8c02c 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 _0x5861=['hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xeff451,_0x36c6c4){var _0x2802b3=function(_0x18de75){while(--_0x18de75){_0xeff451['push'](_0xeff451['shift']());}};_0x2802b3(++_0x36c6c4);}(_0x5861,0x1f1));var _0x1586=function(_0x537266,_0x42d8a0){_0x537266=_0x537266-0x0;var _0x4013be=_0x5861[_0x537266];return _0x4013be;};'use strict';var EventEmitter=require(_0x1586('0x0'));var SmsAccount=require(_0x1586('0x1'))['db'][_0x1586('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x1586('0x3')](0x0);var events={'afterCreate':_0x1586('0x4'),'afterUpdate':_0x1586('0x5'),'afterDestroy':_0x1586('0x6')};function emitEvent(_0x20dc64){return function(_0x27fbf2,_0x23d4ab,_0x4a1d74){SmsAccountEvents[_0x1586('0x7')](_0x20dc64+':'+_0x27fbf2['id'],_0x27fbf2);SmsAccountEvents[_0x1586('0x7')](_0x20dc64,_0x27fbf2);_0x4a1d74(null);};}for(var e in events){if(events[_0x1586('0x8')](e)){var event=events[e];SmsAccount[_0x1586('0x9')](e,emitEvent(event));}}module[_0x1586('0xa')]=SmsAccountEvents; \ No newline at end of file +var _0x1f99=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x53834b,_0x964d84){var _0x2e3005=function(_0x118650){while(--_0x118650){_0x53834b['push'](_0x53834b['shift']());}};_0x2e3005(++_0x964d84);}(_0x1f99,0x1c7));var _0x91f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1f99[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x91f9('0x0'));var SmsAccount=require(_0x91f9('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x91f9('0x2'),'afterUpdate':_0x91f9('0x3'),'afterDestroy':_0x91f9('0x4')};function emitEvent(_0xc40018){return function(_0x272cd2,_0x10c274,_0x1cfff8){SmsAccountEvents['emit'](_0xc40018+':'+_0x272cd2['id'],_0x272cd2);SmsAccountEvents[_0x91f9('0x5')](_0xc40018,_0x272cd2);_0x1cfff8(null);};}for(var e in events){if(events[_0x91f9('0x6')](e)){var event=events[e];SmsAccount[_0x91f9('0x7')](e,emitEvent(event));}}module[_0x91f9('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 72aaa09..a5bcdc8 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 _0x20c2=['rimraf','../../config/environment','exports','sms_accounts','lodash','util','api','moment','request-promise','path'];(function(_0xdb53da,_0x48d843){var _0x20a278=function(_0x7825fc){while(--_0x7825fc){_0xdb53da['push'](_0xdb53da['shift']());}};_0x20a278(++_0x48d843);}(_0x20c2,0x14e));var _0x220c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x20c2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x220c('0x0'));var util=require(_0x220c('0x1'));var logger=require('../../config/logger')(_0x220c('0x2'));var moment=require(_0x220c('0x3'));var BPromise=require('bluebird');var rp=require(_0x220c('0x4'));var fs=require('fs');var path=require(_0x220c('0x5'));var rimraf=require(_0x220c('0x6'));var config=require(_0x220c('0x7'));var attributes=require('./smsAccount.attributes');module[_0x220c('0x8')]=function(_0x21ac4,_0x1dc5d2){return _0x21ac4['define']('SmsAccount',attributes,{'tableName':_0x220c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6c3=['rimraf','./smsAccount.attributes','sms_accounts','util','api','moment','bluebird','request-promise'];(function(_0x2d25b5,_0xb124fd){var _0x5547f0=function(_0x114775){while(--_0x114775){_0x2d25b5['push'](_0x2d25b5['shift']());}};_0x5547f0(++_0xb124fd);}(_0xe6c3,0x8b));var _0x3e6c=function(_0x3fc636,_0x80427b){_0x3fc636=_0x3fc636-0x0;var _0x18e0e7=_0xe6c3[_0x3fc636];return _0x18e0e7;};'use strict';var _=require('lodash');var util=require(_0x3e6c('0x0'));var logger=require('../../config/logger')(_0x3e6c('0x1'));var moment=require(_0x3e6c('0x2'));var BPromise=require(_0x3e6c('0x3'));var rp=require(_0x3e6c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e6c('0x5'));var config=require('../../config/environment');var attributes=require(_0x3e6c('0x6'));module['exports']=function(_0x5e7f18,_0x192196){return _0x5e7f18['define']('SmsAccount',attributes,{'tableName':_0x3e6c('0x7'),'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 aa9c61b..946e93f 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 _0xae6d=['./smsAccount.socket','register','info','request\x20sent','debug','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter'];(function(_0x28a6ad,_0x351697){var _0xbb804=function(_0x165d37){while(--_0x165d37){_0x28a6ad['push'](_0x28a6ad['shift']());}};_0xbb804(++_0x351697);}(_0xae6d,0x10b));var _0xdae6=function(_0x5f2a50,_0x4700e0){_0x5f2a50=_0x5f2a50-0x0;var _0x7577ca=_0xae6d[_0x5f2a50];return _0x7577ca;};'use strict';var _=require(_0xdae6('0x0'));var util=require(_0xdae6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdae6('0x2'));var fs=require('fs');var Redis=require(_0xdae6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdae6('0x4'));var logger=require(_0xdae6('0x5'))(_0xdae6('0x6'));var config=require(_0xdae6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdae6('0x8')][_0xdae6('0x9')]({'port':0x232a});config[_0xdae6('0xa')]=_['defaults'](config[_0xdae6('0xa')],{'host':_0xdae6('0xb'),'port':0x18eb});var socket=require(_0xdae6('0xc'))(new Redis(config['redis']));require(_0xdae6('0xd'))[_0xdae6('0xe')](socket);function respondWithRpcPromise(_0x2a697c,_0x3366e9,_0x4f561f){return new BPromise(function(_0x4a1006,_0x55424d){return client['request'](_0x2a697c,_0x4f561f)['then'](function(_0x24204d){logger[_0xdae6('0xf')]('SmsAccount,\x20%s,\x20%s',_0x3366e9,_0xdae6('0x10'));logger[_0xdae6('0x11')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3366e9,_0xdae6('0x10'),JSON['stringify'](_0x24204d));if(_0x24204d[_0xdae6('0x12')]){if(_0x24204d['error'][_0xdae6('0x13')]===0x1f4){logger[_0xdae6('0x12')](_0xdae6('0x14'),_0x3366e9,_0x24204d[_0xdae6('0x12')][_0xdae6('0x15')]);return _0x55424d(_0x24204d[_0xdae6('0x12')]['message']);}logger[_0xdae6('0x12')](_0xdae6('0x14'),_0x3366e9,_0x24204d[_0xdae6('0x12')][_0xdae6('0x15')]);return _0x4a1006(_0x24204d[_0xdae6('0x12')]['message']);}else{logger[_0xdae6('0xf')](_0xdae6('0x14'),_0x3366e9,_0xdae6('0x10'));_0x4a1006(_0x24204d[_0xdae6('0x16')][_0xdae6('0x15')]);}})[_0xdae6('0x17')](function(_0x531e0b){logger[_0xdae6('0x12')](_0xdae6('0x14'),_0x3366e9,_0x531e0b);_0x55424d(_0x531e0b);});});}exports[_0xdae6('0x18')]=function(_0x4f320c){var _0x2613d4=this;return new Promise(function(_0x28ec70,_0x18be0b){return db[_0xdae6('0x19')][_0xdae6('0x1a')]({'raw':_0x4f320c['options']?_0x4f320c[_0xdae6('0x1b')][_0xdae6('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f320c[_0xdae6('0x1b')]?_0x4f320c[_0xdae6('0x1b')][_0xdae6('0x1d')]||null:null,'attributes':_0x4f320c[_0xdae6('0x1b')]?_0x4f320c[_0xdae6('0x1b')][_0xdae6('0x1e')]||null:null,'include':_0x4f320c['options']?_0x4f320c[_0xdae6('0x1b')][_0xdae6('0x1f')]?_[_0xdae6('0x20')](_0x4f320c[_0xdae6('0x1b')][_0xdae6('0x1f')],function(_0x2eb24e){return{'model':db[_0x2eb24e[_0xdae6('0x21')]],'as':_0x2eb24e['as'],'attributes':_0x2eb24e[_0xdae6('0x1e')],'include':_0x2eb24e[_0xdae6('0x1f')]?_[_0xdae6('0x20')](_0x2eb24e[_0xdae6('0x1f')],function(_0x345222){return{'model':db[_0x345222[_0xdae6('0x21')]],'as':_0x345222['as'],'attributes':_0x345222['attributes'],'include':_0x345222[_0xdae6('0x1f')]?_['map'](_0x345222[_0xdae6('0x1f')],function(_0x37d080){return{'model':db[_0x37d080['model']],'as':_0x37d080['as'],'attributes':_0x37d080[_0xdae6('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7330f1){logger[_0xdae6('0xf')]('ShowSmsAccount',_0x4f320c);logger[_0xdae6('0x11')](_0xdae6('0x18'),_0x4f320c,JSON[_0xdae6('0x22')](_0x7330f1));_0x28ec70(_0x7330f1);})[_0xdae6('0x17')](function(_0x2cbbb5){logger[_0xdae6('0x12')](_0xdae6('0x18'),_0x2cbbb5[_0xdae6('0x15')],_0x4f320c);_0x18be0b(_0x2613d4['error'](0x1f4,_0x2cbbb5['message']));});});}; \ No newline at end of file +var _0x4a8b=['then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','map','model','debug','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request'];(function(_0xda6ad1,_0x5f09e3){var _0xedc3a5=function(_0x5459d7){while(--_0x5459d7){_0xda6ad1['push'](_0xda6ad1['shift']());}};_0xedc3a5(++_0x5f09e3);}(_0x4a8b,0xc9));var _0xb4a8=function(_0x50dccd,_0xf65d4c){_0x50dccd=_0x50dccd-0x0;var _0x52a204=_0x4a8b[_0x50dccd];return _0x52a204;};'use strict';var _=require(_0xb4a8('0x0'));var util=require(_0xb4a8('0x1'));var moment=require(_0xb4a8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4a8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4a8('0x4'))(_0xb4a8('0x5'));var config=require(_0xb4a8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb4a8('0x7')]['http']({'port':0x232a});config[_0xb4a8('0x8')]=_[_0xb4a8('0x9')](config[_0xb4a8('0x8')],{'host':_0xb4a8('0xa'),'port':0x18eb});var socket=require(_0xb4a8('0xb'))(new Redis(config[_0xb4a8('0x8')]));require(_0xb4a8('0xc'))[_0xb4a8('0xd')](socket);function respondWithRpcPromise(_0x354704,_0x344361,_0x12ae72){return new BPromise(function(_0x2d6930,_0x1e9492){return client[_0xb4a8('0xe')](_0x354704,_0x12ae72)[_0xb4a8('0xf')](function(_0x1e4ac6){logger[_0xb4a8('0x10')](_0xb4a8('0x11'),_0x344361,_0xb4a8('0x12'));logger['debug'](_0xb4a8('0x13'),_0x344361,_0xb4a8('0x12'),JSON[_0xb4a8('0x14')](_0x1e4ac6));if(_0x1e4ac6[_0xb4a8('0x15')]){if(_0x1e4ac6[_0xb4a8('0x15')][_0xb4a8('0x16')]===0x1f4){logger[_0xb4a8('0x15')](_0xb4a8('0x11'),_0x344361,_0x1e4ac6['error'][_0xb4a8('0x17')]);return _0x1e9492(_0x1e4ac6['error'][_0xb4a8('0x17')]);}logger['error'](_0xb4a8('0x11'),_0x344361,_0x1e4ac6[_0xb4a8('0x15')][_0xb4a8('0x17')]);return _0x2d6930(_0x1e4ac6['error'][_0xb4a8('0x17')]);}else{logger[_0xb4a8('0x10')](_0xb4a8('0x11'),_0x344361,_0xb4a8('0x12'));_0x2d6930(_0x1e4ac6[_0xb4a8('0x18')][_0xb4a8('0x17')]);}})[_0xb4a8('0x19')](function(_0x3e5bc4){logger[_0xb4a8('0x15')](_0xb4a8('0x11'),_0x344361,_0x3e5bc4);_0x1e9492(_0x3e5bc4);});});}exports[_0xb4a8('0x1a')]=function(_0x29b7d9){var _0x1de0df=this;return new Promise(function(_0x20b729,_0x594dc7){return db[_0xb4a8('0x1b')][_0xb4a8('0x1c')]({'raw':_0x29b7d9['options']?_0x29b7d9[_0xb4a8('0x1d')][_0xb4a8('0x1e')]===undefined?!![]:![]:!![],'where':_0x29b7d9[_0xb4a8('0x1d')]?_0x29b7d9[_0xb4a8('0x1d')]['where']||null:null,'attributes':_0x29b7d9[_0xb4a8('0x1d')]?_0x29b7d9['options'][_0xb4a8('0x1f')]||null:null,'include':_0x29b7d9[_0xb4a8('0x1d')]?_0x29b7d9[_0xb4a8('0x1d')][_0xb4a8('0x20')]?_['map'](_0x29b7d9[_0xb4a8('0x1d')][_0xb4a8('0x20')],function(_0x229d25){return{'model':db[_0x229d25['model']],'as':_0x229d25['as'],'attributes':_0x229d25[_0xb4a8('0x1f')],'include':_0x229d25['include']?_[_0xb4a8('0x21')](_0x229d25[_0xb4a8('0x20')],function(_0x492a8b){return{'model':db[_0x492a8b[_0xb4a8('0x22')]],'as':_0x492a8b['as'],'attributes':_0x492a8b[_0xb4a8('0x1f')],'include':_0x492a8b[_0xb4a8('0x20')]?_[_0xb4a8('0x21')](_0x492a8b[_0xb4a8('0x20')],function(_0x78136c){return{'model':db[_0x78136c[_0xb4a8('0x22')]],'as':_0x78136c['as'],'attributes':_0x78136c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ccdd2){logger['info'](_0xb4a8('0x1a'),_0x29b7d9);logger[_0xb4a8('0x23')]('ShowSmsAccount',_0x29b7d9,JSON[_0xb4a8('0x14')](_0x2ccdd2));_0x20b729(_0x2ccdd2);})[_0xb4a8('0x19')](function(_0x29da4f){logger[_0xb4a8('0x15')](_0xb4a8('0x1a'),_0x29da4f[_0xb4a8('0x17')],_0x29b7d9);_0x594dc7(_0x1de0df[_0xb4a8('0x15')](0x1f4,_0x29da4f[_0xb4a8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index d2871cd..767c444 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 91c7ecd..1a73624 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 _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x4f309f,_0x389aae){var _0x680bb7=function(_0x428242){while(--_0x428242){_0x4f309f['push'](_0x4f309f['shift']());}};_0x680bb7(++_0x389aae);}(_0x7217,0x19e));var _0x7721=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x7217[_0x34bf97];return _0x292719;};'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('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6c61836..250742a 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 _0x4631=['exports','INTEGER','STRING','*,*,*,*','sequelize'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4631,0x18a));var _0x1463=function(_0x8a30cf,_0x40f19b){_0x8a30cf=_0x8a30cf-0x0;var _0x20f439=_0x4631[_0x8a30cf];return _0x20f439;};'use strict';var Sequelize=require(_0x1463('0x0'));module[_0x1463('0x1')]={'priority':{'type':Sequelize[_0x1463('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1463('0x3')]},'interval':{'type':Sequelize[_0x1463('0x3')],'defaultValue':_0x1463('0x4')}}; \ No newline at end of file +var _0xe302=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x2daf5b,_0x12eec4){var _0x1c85f8=function(_0x50b823){while(--_0x50b823){_0x2daf5b['push'](_0x2daf5b['shift']());}};_0x1c85f8(++_0x12eec4);}(_0xe302,0x108));var _0x2e30=function(_0x5be4b7,_0x78b880){_0x5be4b7=_0x5be4b7-0x0;var _0x5f0c55=_0xe302[_0x5be4b7];return _0x5f0c55;};'use strict';var Sequelize=require(_0x2e30('0x0'));module[_0x2e30('0x1')]={'priority':{'type':Sequelize[_0x2e30('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2e30('0x3')],'allowNull':![],'defaultValue':_0x2e30('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x2e30('0x3')]},'interval':{'type':Sequelize[_0x2e30('0x3')],'defaultValue':_0x2e30('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 763add6..dc29474 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 _0x1805=['util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','VIRTUAL','merge','SmsApplication','include','findAll','rows','params','rawAttributes','includeAll','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x193a1f,_0x440888){var _0x3868d1=function(_0x163d9f){while(--_0x163d9f){_0x193a1f['push'](_0x193a1f['shift']());}};_0x3868d1(++_0x440888);}(_0x1805,0x121));var _0x5180=function(_0x52b81c,_0x5490aa){_0x52b81c=_0x52b81c-0x0;var _0xa843f1=_0x1805[_0x52b81c];return _0xa843f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5180('0x0'));var zipdir=require(_0x5180('0x1'));var jsonpatch=require(_0x5180('0x2'));var rp=require(_0x5180('0x3'));var moment=require(_0x5180('0x4'));var BPromise=require(_0x5180('0x5'));var Mustache=require(_0x5180('0x6'));var util=require(_0x5180('0x7'));var path=require(_0x5180('0x8'));var sox=require(_0x5180('0x9'));var csv=require(_0x5180('0xa'));var ejs=require(_0x5180('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5180('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5180('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5180('0xe'));var Redis=require(_0x5180('0xf'));var authService=require(_0x5180('0x10'));var qs=require(_0x5180('0x11'));var as=require(_0x5180('0x12'));var hardwareService=require(_0x5180('0x13'));var logger=require(_0x5180('0x14'))(_0x5180('0x15'));var utils=require(_0x5180('0x16'));var config=require(_0x5180('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5180('0x18'))['db'];function respondWithStatusCode(_0x267fd5,_0x1de2b2){_0x1de2b2=_0x1de2b2||0xcc;return function(_0x5f1e2b){if(_0x5f1e2b){return _0x267fd5['sendStatus'](_0x1de2b2);}return _0x267fd5[_0x5180('0x19')](_0x1de2b2)[_0x5180('0x1a')]();};}function respondWithResult(_0x3481d0,_0x5b19b7){_0x5b19b7=_0x5b19b7||0xc8;return function(_0x43bbb4){if(_0x43bbb4){return _0x3481d0[_0x5180('0x19')](_0x5b19b7)['json'](_0x43bbb4);}};}function respondWithFilteredResult(_0x3f8724,_0x30d1c6){return function(_0x33673a){if(_0x33673a){var _0x3b96bd=typeof _0x30d1c6[_0x5180('0x1b')]===_0x5180('0x1c')&&typeof _0x30d1c6['limit']==='undefined';var _0x57a5d6=_0x33673a[_0x5180('0x1d')];var _0x140653=_0x3b96bd?0x0:_0x30d1c6[_0x5180('0x1b')];var _0x328b79=_0x3b96bd?_0x33673a[_0x5180('0x1d')]:_0x30d1c6[_0x5180('0x1b')]+_0x30d1c6[_0x5180('0x1e')];var _0x2287d2;if(_0x328b79>=_0x57a5d6){_0x328b79=_0x57a5d6;_0x2287d2=0xc8;}else{_0x2287d2=0xce;}_0x3f8724[_0x5180('0x19')](_0x2287d2);return _0x3f8724[_0x5180('0x1f')]('Content-Range',_0x140653+'-'+_0x328b79+'/'+_0x57a5d6)[_0x5180('0x20')](_0x33673a);}return null;};}function patchUpdates(_0x547e91){return function(_0x1a951e){try{jsonpatch[_0x5180('0x21')](_0x1a951e,_0x547e91,!![]);}catch(_0x28c656){return BPromise[_0x5180('0x22')](_0x28c656);}return _0x1a951e[_0x5180('0x23')]();};}function saveUpdates(_0x40aa5a,_0x34a2c6){return function(_0x557500){if(_0x557500){return _0x557500[_0x5180('0x24')](_0x40aa5a)[_0x5180('0x25')](function(_0x215939){return _0x215939;});}return null;};}function removeEntity(_0x12a259,_0x2715f4){return function(_0xe33f4a){if(_0xe33f4a){return _0xe33f4a[_0x5180('0x26')]()[_0x5180('0x25')](function(){_0x12a259[_0x5180('0x19')](0xcc)[_0x5180('0x1a')]();});}};}function handleEntityNotFound(_0x31a160,_0x1e1c9c){return function(_0x20aec8){if(!_0x20aec8){_0x31a160[_0x5180('0x27')](0x194);}return _0x20aec8;};}function handleError(_0x2fceef,_0x3e090c){_0x3e090c=_0x3e090c||0x1f4;return function(_0x391249){logger['error'](_0x391249[_0x5180('0x28')]);if(_0x391249['name']){delete _0x391249[_0x5180('0x29')];}_0x2fceef['status'](_0x3e090c)[_0x5180('0x2a')](_0x391249);};}exports[_0x5180('0x2b')]=function(_0x2331c0,_0x1d2797){var _0x2147bb={},_0x34d92f={},_0x4e89eb={'count':0x0,'rows':[]};var _0x3f6cc5=_[_0x5180('0x2c')](db['SmsApplication']['rawAttributes'],function(_0x18b9d2){return{'name':_0x18b9d2[_0x5180('0x2d')],'type':_0x18b9d2[_0x5180('0x2e')][_0x5180('0x2f')]};});_0x34d92f[_0x5180('0x30')]=_[_0x5180('0x2c')](_0x3f6cc5,_0x5180('0x29'));_0x34d92f[_0x5180('0x31')]=_[_0x5180('0x32')](_0x2331c0[_0x5180('0x31')]);_0x34d92f['filters']=_['intersection'](_0x34d92f[_0x5180('0x30')],_0x34d92f['query']);_0x2147bb[_0x5180('0x33')]=_[_0x5180('0x34')](_0x34d92f[_0x5180('0x30')],qs['fields'](_0x2331c0[_0x5180('0x31')][_0x5180('0x35')]));_0x2147bb[_0x5180('0x33')]=_0x2147bb[_0x5180('0x33')][_0x5180('0x36')]?_0x2147bb[_0x5180('0x33')]:_0x34d92f[_0x5180('0x30')];if(!_0x2331c0[_0x5180('0x31')]['hasOwnProperty'](_0x5180('0x37'))){_0x2147bb[_0x5180('0x1e')]=qs[_0x5180('0x1e')](_0x2331c0[_0x5180('0x31')]['limit']);_0x2147bb[_0x5180('0x1b')]=qs[_0x5180('0x1b')](_0x2331c0[_0x5180('0x31')][_0x5180('0x1b')]);}_0x2147bb[_0x5180('0x38')]=qs['sort'](_0x2331c0[_0x5180('0x31')][_0x5180('0x39')]);_0x2147bb['where']=qs[_0x5180('0x3a')](_[_0x5180('0x3b')](_0x2331c0[_0x5180('0x31')],_0x34d92f[_0x5180('0x3a')]),_0x3f6cc5);if(_0x2331c0['query'][_0x5180('0x3c')]){_0x2147bb['where']=_['merge'](_0x2147bb['where'],{'$or':_[_0x5180('0x2c')](_0x3f6cc5,function(_0x32e894){if(_0x32e894['type']!==_0x5180('0x3d')){var _0x2561de={};_0x2561de[_0x32e894[_0x5180('0x29')]]={'$like':'%'+_0x2331c0[_0x5180('0x31')][_0x5180('0x3c')]+'%'};return _0x2561de;}})});}_0x2147bb=_[_0x5180('0x3e')]({},_0x2147bb,_0x2331c0['options']);var _0xa13dda={'where':_0x2147bb['where']};return db[_0x5180('0x3f')][_0x5180('0x1d')](_0xa13dda)[_0x5180('0x25')](function(_0x3d7e56){_0x4e89eb[_0x5180('0x1d')]=_0x3d7e56;if(_0x2331c0[_0x5180('0x31')]['includeAll']){_0x2147bb[_0x5180('0x40')]=[{'all':!![]}];}return db[_0x5180('0x3f')][_0x5180('0x41')](_0x2147bb);})[_0x5180('0x25')](function(_0x1b0d6d){_0x4e89eb[_0x5180('0x42')]=_0x1b0d6d;return _0x4e89eb;})[_0x5180('0x25')](respondWithFilteredResult(_0x1d2797,_0x2147bb))['catch'](handleError(_0x1d2797,null));};exports['show']=function(_0x31b3d4,_0x4f67de){var _0x334570={'raw':!![],'where':{'id':_0x31b3d4[_0x5180('0x43')]['id']}},_0x1daa65={};_0x1daa65[_0x5180('0x30')]=_[_0x5180('0x32')](db['SmsApplication'][_0x5180('0x44')]);_0x1daa65['query']=_[_0x5180('0x32')](_0x31b3d4[_0x5180('0x31')]);_0x1daa65[_0x5180('0x3a')]=_['intersection'](_0x1daa65[_0x5180('0x30')],_0x1daa65[_0x5180('0x31')]);_0x334570['attributes']=_[_0x5180('0x34')](_0x1daa65[_0x5180('0x30')],qs['fields'](_0x31b3d4['query'][_0x5180('0x35')]));_0x334570[_0x5180('0x33')]=_0x334570['attributes'][_0x5180('0x36')]?_0x334570[_0x5180('0x33')]:_0x1daa65[_0x5180('0x30')];if(_0x31b3d4[_0x5180('0x31')][_0x5180('0x45')]){_0x334570['include']=[{'all':!![]}];}_0x334570=_[_0x5180('0x3e')]({},_0x334570,_0x31b3d4['options']);return db['SmsApplication'][_0x5180('0x46')](_0x334570)[_0x5180('0x25')](handleEntityNotFound(_0x4f67de,null))[_0x5180('0x25')](respondWithResult(_0x4f67de,null))[_0x5180('0x47')](handleError(_0x4f67de,null));};exports[_0x5180('0x48')]=function(_0x58d8b2,_0x2d92ea){return db[_0x5180('0x3f')]['create'](_0x58d8b2[_0x5180('0x49')],{})[_0x5180('0x25')](respondWithResult(_0x2d92ea,0xc9))[_0x5180('0x47')](handleError(_0x2d92ea,null));};exports['update']=function(_0x5b14cb,_0x3a7339){if(_0x5b14cb[_0x5180('0x49')]['id']){delete _0x5b14cb[_0x5180('0x49')]['id'];}return db[_0x5180('0x3f')][_0x5180('0x46')]({'where':{'id':_0x5b14cb[_0x5180('0x43')]['id']}})[_0x5180('0x25')](handleEntityNotFound(_0x3a7339,null))[_0x5180('0x25')](saveUpdates(_0x5b14cb[_0x5180('0x49')],null))['then'](respondWithResult(_0x3a7339,null))[_0x5180('0x47')](handleError(_0x3a7339,null));};exports[_0x5180('0x26')]=function(_0x57f837,_0xde10f6){return db[_0x5180('0x3f')][_0x5180('0x46')]({'where':{'id':_0x57f837[_0x5180('0x43')]['id']}})[_0x5180('0x25')](handleEntityNotFound(_0xde10f6,null))['then'](removeEntity(_0xde10f6,null))[_0x5180('0x47')](handleError(_0xde10f6,null));}; \ No newline at end of file +var _0x2422=['where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','ejs','fs-extra','squel','crypto','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','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','send','SmsApplication','rawAttributes','key','model','map','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x2422,0x1c7));var _0x2242=function(_0x215c0f,_0x53b60b){_0x215c0f=_0x215c0f-0x0;var _0x2faf1f=_0x2422[_0x215c0f];return _0x2faf1f;};'use strict';var emlformat=require(_0x2242('0x0'));var rimraf=require(_0x2242('0x1'));var zipdir=require(_0x2242('0x2'));var jsonpatch=require(_0x2242('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2242('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2242('0x5'));var sox=require(_0x2242('0x6'));var csv=require('to-csv');var ejs=require(_0x2242('0x7'));var fs=require('fs');var fs_extra=require(_0x2242('0x8'));var _=require('lodash');var squel=require(_0x2242('0x9'));var crypto=require(_0x2242('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2242('0xb'));var toCsv=require(_0x2242('0xc'));var querystring=require(_0x2242('0xd'));var Papa=require(_0x2242('0xe'));var Redis=require(_0x2242('0xf'));var authService=require(_0x2242('0x10'));var qs=require(_0x2242('0x11'));var as=require(_0x2242('0x12'));var hardwareService=require(_0x2242('0x13'));var logger=require(_0x2242('0x14'))(_0x2242('0x15'));var utils=require(_0x2242('0x16'));var config=require(_0x2242('0x17'));var licenseUtil=require(_0x2242('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50a2e4,_0x46fa2c){_0x46fa2c=_0x46fa2c||0xcc;return function(_0x491eaa){if(_0x491eaa){return _0x50a2e4[_0x2242('0x19')](_0x46fa2c);}return _0x50a2e4[_0x2242('0x1a')](_0x46fa2c)[_0x2242('0x1b')]();};}function respondWithResult(_0x15c211,_0x51b652){_0x51b652=_0x51b652||0xc8;return function(_0x1253de){if(_0x1253de){return _0x15c211[_0x2242('0x1a')](_0x51b652)[_0x2242('0x1c')](_0x1253de);}};}function respondWithFilteredResult(_0x179e5e,_0x5c4eee){return function(_0x296ab6){if(_0x296ab6){var _0x1ea7e8=typeof _0x5c4eee[_0x2242('0x1d')]==='undefined'&&typeof _0x5c4eee[_0x2242('0x1e')]===_0x2242('0x1f');var _0x43350d=_0x296ab6['count'];var _0x42e638=_0x1ea7e8?0x0:_0x5c4eee[_0x2242('0x1d')];var _0x3e2177=_0x1ea7e8?_0x296ab6[_0x2242('0x20')]:_0x5c4eee[_0x2242('0x1d')]+_0x5c4eee[_0x2242('0x1e')];var _0x2a7ce8;if(_0x3e2177>=_0x43350d){_0x3e2177=_0x43350d;_0x2a7ce8=0xc8;}else{_0x2a7ce8=0xce;}_0x179e5e['status'](_0x2a7ce8);return _0x179e5e[_0x2242('0x21')](_0x2242('0x22'),_0x42e638+'-'+_0x3e2177+'/'+_0x43350d)['json'](_0x296ab6);}return null;};}function patchUpdates(_0x3bec30){return function(_0x2cac5c){try{jsonpatch[_0x2242('0x23')](_0x2cac5c,_0x3bec30,!![]);}catch(_0x2bf582){return BPromise['reject'](_0x2bf582);}return _0x2cac5c['save']();};}function saveUpdates(_0x5378ad,_0x255000){return function(_0x300589){if(_0x300589){return _0x300589[_0x2242('0x24')](_0x5378ad)[_0x2242('0x25')](function(_0x4b1337){return _0x4b1337;});}return null;};}function removeEntity(_0x202de7,_0x4689f4){return function(_0x2360e2){if(_0x2360e2){return _0x2360e2[_0x2242('0x26')]()[_0x2242('0x25')](function(){_0x202de7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c15f6,_0x16d006){return function(_0x531575){if(!_0x531575){_0x5c15f6[_0x2242('0x19')](0x194);}return _0x531575;};}function handleError(_0x839e1a,_0x404bed){_0x404bed=_0x404bed||0x1f4;return function(_0x599f27){logger['error'](_0x599f27['stack']);if(_0x599f27['name']){delete _0x599f27['name'];}_0x839e1a[_0x2242('0x1a')](_0x404bed)[_0x2242('0x27')](_0x599f27);};}exports['index']=function(_0x29091d,_0x416e54){var _0xcad68d={},_0x35a86c={},_0x2bf2d0={'count':0x0,'rows':[]};var _0x1b712a=_['map'](db[_0x2242('0x28')][_0x2242('0x29')],function(_0x5d0313){return{'name':_0x5d0313['fieldName'],'type':_0x5d0313['type'][_0x2242('0x2a')]};});_0x35a86c[_0x2242('0x2b')]=_[_0x2242('0x2c')](_0x1b712a,_0x2242('0x2d'));_0x35a86c[_0x2242('0x2e')]=_[_0x2242('0x2f')](_0x29091d[_0x2242('0x2e')]);_0x35a86c[_0x2242('0x30')]=_['intersection'](_0x35a86c[_0x2242('0x2b')],_0x35a86c[_0x2242('0x2e')]);_0xcad68d[_0x2242('0x31')]=_[_0x2242('0x32')](_0x35a86c[_0x2242('0x2b')],qs['fields'](_0x29091d[_0x2242('0x2e')][_0x2242('0x33')]));_0xcad68d[_0x2242('0x31')]=_0xcad68d[_0x2242('0x31')][_0x2242('0x34')]?_0xcad68d['attributes']:_0x35a86c[_0x2242('0x2b')];if(!_0x29091d[_0x2242('0x2e')][_0x2242('0x35')](_0x2242('0x36'))){_0xcad68d[_0x2242('0x1e')]=qs['limit'](_0x29091d[_0x2242('0x2e')][_0x2242('0x1e')]);_0xcad68d[_0x2242('0x1d')]=qs[_0x2242('0x1d')](_0x29091d['query'][_0x2242('0x1d')]);}_0xcad68d['order']=qs[_0x2242('0x37')](_0x29091d[_0x2242('0x2e')][_0x2242('0x37')]);_0xcad68d[_0x2242('0x38')]=qs['filters'](_[_0x2242('0x39')](_0x29091d[_0x2242('0x2e')],_0x35a86c[_0x2242('0x30')]),_0x1b712a);if(_0x29091d[_0x2242('0x2e')][_0x2242('0x3a')]){_0xcad68d['where']=_['merge'](_0xcad68d[_0x2242('0x38')],{'$or':_[_0x2242('0x2c')](_0x1b712a,function(_0x48c4ff){if(_0x48c4ff[_0x2242('0x3b')]!==_0x2242('0x3c')){var _0x2e9ea6={};_0x2e9ea6[_0x48c4ff[_0x2242('0x2d')]]={'$like':'%'+_0x29091d[_0x2242('0x2e')][_0x2242('0x3a')]+'%'};return _0x2e9ea6;}})});}_0xcad68d=_[_0x2242('0x3d')]({},_0xcad68d,_0x29091d[_0x2242('0x3e')]);var _0x4209f8={'where':_0xcad68d['where']};return db[_0x2242('0x28')][_0x2242('0x20')](_0x4209f8)[_0x2242('0x25')](function(_0x168c1c){_0x2bf2d0['count']=_0x168c1c;if(_0x29091d[_0x2242('0x2e')][_0x2242('0x3f')]){_0xcad68d[_0x2242('0x40')]=[{'all':!![]}];}return db[_0x2242('0x28')][_0x2242('0x41')](_0xcad68d);})[_0x2242('0x25')](function(_0x6abee8){_0x2bf2d0[_0x2242('0x42')]=_0x6abee8;return _0x2bf2d0;})['then'](respondWithFilteredResult(_0x416e54,_0xcad68d))[_0x2242('0x43')](handleError(_0x416e54,null));};exports[_0x2242('0x44')]=function(_0xec9def,_0x4a3cb7){var _0x1ac070={'raw':!![],'where':{'id':_0xec9def[_0x2242('0x45')]['id']}},_0xa595b7={};_0xa595b7[_0x2242('0x2b')]=_[_0x2242('0x2f')](db[_0x2242('0x28')]['rawAttributes']);_0xa595b7[_0x2242('0x2e')]=_[_0x2242('0x2f')](_0xec9def[_0x2242('0x2e')]);_0xa595b7[_0x2242('0x30')]=_[_0x2242('0x32')](_0xa595b7[_0x2242('0x2b')],_0xa595b7[_0x2242('0x2e')]);_0x1ac070['attributes']=_[_0x2242('0x32')](_0xa595b7[_0x2242('0x2b')],qs['fields'](_0xec9def[_0x2242('0x2e')][_0x2242('0x33')]));_0x1ac070[_0x2242('0x31')]=_0x1ac070[_0x2242('0x31')][_0x2242('0x34')]?_0x1ac070[_0x2242('0x31')]:_0xa595b7['model'];if(_0xec9def[_0x2242('0x2e')][_0x2242('0x3f')]){_0x1ac070['include']=[{'all':!![]}];}_0x1ac070=_[_0x2242('0x3d')]({},_0x1ac070,_0xec9def[_0x2242('0x3e')]);return db['SmsApplication']['find'](_0x1ac070)[_0x2242('0x25')](handleEntityNotFound(_0x4a3cb7,null))[_0x2242('0x25')](respondWithResult(_0x4a3cb7,null))['catch'](handleError(_0x4a3cb7,null));};exports[_0x2242('0x46')]=function(_0x39bde3,_0x4783bf){return db[_0x2242('0x28')][_0x2242('0x46')](_0x39bde3[_0x2242('0x47')],{})['then'](respondWithResult(_0x4783bf,0xc9))[_0x2242('0x43')](handleError(_0x4783bf,null));};exports[_0x2242('0x24')]=function(_0x562fe0,_0x319f8f){if(_0x562fe0[_0x2242('0x47')]['id']){delete _0x562fe0[_0x2242('0x47')]['id'];}return db[_0x2242('0x28')][_0x2242('0x48')]({'where':{'id':_0x562fe0[_0x2242('0x45')]['id']}})[_0x2242('0x25')](handleEntityNotFound(_0x319f8f,null))['then'](saveUpdates(_0x562fe0[_0x2242('0x47')],null))[_0x2242('0x25')](respondWithResult(_0x319f8f,null))[_0x2242('0x43')](handleError(_0x319f8f,null));};exports[_0x2242('0x26')]=function(_0x166245,_0x59c3b4){return db['SmsApplication'][_0x2242('0x48')]({'where':{'id':_0x166245[_0x2242('0x45')]['id']}})[_0x2242('0x25')](handleEntityNotFound(_0x59c3b4,null))[_0x2242('0x25')](removeEntity(_0x59c3b4,null))[_0x2242('0x43')](handleError(_0x59c3b4,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 54d32e7..d20b96b 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 _0xf23e=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1c0955,_0x542f2f){var _0x243dce=function(_0x5dd65c){while(--_0x5dd65c){_0x1c0955['push'](_0x1c0955['shift']());}};_0x243dce(++_0x542f2f);}(_0xf23e,0x15f));var _0xef23=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf23e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xef23('0x0'));var util=require('util');var logger=require(_0xef23('0x1'))(_0xef23('0x2'));var moment=require(_0xef23('0x3'));var BPromise=require('bluebird');var rp=require(_0xef23('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef23('0x5'));var config=require(_0xef23('0x6'));var attributes=require(_0xef23('0x7'));module[_0xef23('0x8')]=function(_0x46fc58,_0x428e3a){return _0x46fc58[_0xef23('0x9')](_0xef23('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xef23('0xb'),'collate':_0xef23('0xc')});}; \ No newline at end of file +var _0x2c36=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0xe3b54b,_0x4afc6a){var _0x328ec0=function(_0x3396d8){while(--_0x3396d8){_0xe3b54b['push'](_0xe3b54b['shift']());}};_0x328ec0(++_0x4afc6a);}(_0x2c36,0x177));var _0x62c3=function(_0x401d67,_0xeb1592){_0x401d67=_0x401d67-0x0;var _0x25076b=_0x2c36[_0x401d67];return _0x25076b;};'use strict';var _=require(_0x62c3('0x0'));var util=require('util');var logger=require(_0x62c3('0x1'))(_0x62c3('0x2'));var moment=require('moment');var BPromise=require(_0x62c3('0x3'));var rp=require(_0x62c3('0x4'));var fs=require('fs');var path=require(_0x62c3('0x5'));var rimraf=require(_0x62c3('0x6'));var config=require(_0x62c3('0x7'));var attributes=require('./smsApplication.attributes');module[_0x62c3('0x8')]=function(_0x34fccd,_0x40cd59){return _0x34fccd[_0x62c3('0x9')](_0x62c3('0xa'),attributes,{'tableName':_0x62c3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x62c3('0xc'),'collate':_0x62c3('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index fba8887..cf5762a 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 _0xf811=['SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x1c9e35,_0x1b4377){var _0xb40f16=function(_0x3f4cc7){while(--_0x3f4cc7){_0x1c9e35['push'](_0x1c9e35['shift']());}};_0xb40f16(++_0x1b4377);}(_0xf811,0x6f));var _0x1f81=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xf811[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0x1f81('0x0'));var util=require(_0x1f81('0x1'));var moment=require(_0x1f81('0x2'));var BPromise=require(_0x1f81('0x3'));var rs=require(_0x1f81('0x4'));var fs=require('fs');var Redis=require(_0x1f81('0x5'));var db=require(_0x1f81('0x6'))['db'];var utils=require(_0x1f81('0x7'));var logger=require(_0x1f81('0x8'))(_0x1f81('0x9'));var config=require(_0x1f81('0xa'));var jayson=require(_0x1f81('0xb'));var client=jayson[_0x1f81('0xc')][_0x1f81('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x57c512,_0x2238b2,_0x42b31b){return new BPromise(function(_0x3635bf,_0x5e6256){return client[_0x1f81('0xe')](_0x57c512,_0x42b31b)[_0x1f81('0xf')](function(_0x4af394){logger[_0x1f81('0x10')]('SmsApplication,\x20%s,\x20%s',_0x2238b2,_0x1f81('0x11'));logger[_0x1f81('0x12')](_0x1f81('0x13'),_0x2238b2,_0x1f81('0x11'),JSON[_0x1f81('0x14')](_0x4af394));if(_0x4af394[_0x1f81('0x15')]){if(_0x4af394[_0x1f81('0x15')][_0x1f81('0x16')]===0x1f4){logger[_0x1f81('0x15')](_0x1f81('0x17'),_0x2238b2,_0x4af394[_0x1f81('0x15')][_0x1f81('0x18')]);return _0x5e6256(_0x4af394[_0x1f81('0x15')][_0x1f81('0x18')]);}logger[_0x1f81('0x15')](_0x1f81('0x17'),_0x2238b2,_0x4af394['error'][_0x1f81('0x18')]);return _0x3635bf(_0x4af394[_0x1f81('0x15')]['message']);}else{logger['info'](_0x1f81('0x17'),_0x2238b2,_0x1f81('0x11'));_0x3635bf(_0x4af394['result'][_0x1f81('0x18')]);}})[_0x1f81('0x19')](function(_0x37434a){logger[_0x1f81('0x15')]('SmsApplication,\x20%s,\x20%s',_0x2238b2,_0x37434a);_0x5e6256(_0x37434a);});});} \ No newline at end of file +var _0xce04=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','code','error','message'];(function(_0x4fd155,_0x35c774){var _0x3dce22=function(_0x5abe10){while(--_0x5abe10){_0x4fd155['push'](_0x4fd155['shift']());}};_0x3dce22(++_0x35c774);}(_0xce04,0xc0));var _0x4ce0=function(_0x11e26c,_0x493c1){_0x11e26c=_0x11e26c-0x0;var _0x1ddb17=_0xce04[_0x11e26c];return _0x1ddb17;};'use strict';var _=require(_0x4ce0('0x0'));var util=require('util');var moment=require(_0x4ce0('0x1'));var BPromise=require(_0x4ce0('0x2'));var rs=require(_0x4ce0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ce0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4ce0('0x5'));var jayson=require(_0x4ce0('0x6'));var client=jayson['client'][_0x4ce0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x462871,_0x5377ab,_0x3a0dca){return new BPromise(function(_0x3b7238,_0x709a46){return client['request'](_0x462871,_0x3a0dca)[_0x4ce0('0x8')](function(_0x29c627){logger[_0x4ce0('0x9')](_0x4ce0('0xa'),_0x5377ab,_0x4ce0('0xb'));logger[_0x4ce0('0xc')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x5377ab,_0x4ce0('0xb'),JSON['stringify'](_0x29c627));if(_0x29c627['error']){if(_0x29c627['error'][_0x4ce0('0xd')]===0x1f4){logger[_0x4ce0('0xe')](_0x4ce0('0xa'),_0x5377ab,_0x29c627['error'][_0x4ce0('0xf')]);return _0x709a46(_0x29c627[_0x4ce0('0xe')]['message']);}logger[_0x4ce0('0xe')]('SmsApplication,\x20%s,\x20%s',_0x5377ab,_0x29c627[_0x4ce0('0xe')][_0x4ce0('0xf')]);return _0x3b7238(_0x29c627[_0x4ce0('0xe')]['message']);}else{logger[_0x4ce0('0x9')](_0x4ce0('0xa'),_0x5377ab,_0x4ce0('0xb'));_0x3b7238(_0x29c627['result'][_0x4ce0('0xf')]);}})['catch'](function(_0x4d1fd2){logger[_0x4ce0('0xe')](_0x4ce0('0xa'),_0x5377ab,_0x4d1fd2);_0x709a46(_0x4d1fd2);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 36f8c0c..849f8be 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 _0xd8b0=['util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x27c292,_0x5036c9){var _0x2e8b4b=function(_0x5d35be){while(--_0x5d35be){_0x27c292['push'](_0x27c292['shift']());}};_0x2e8b4b(++_0x5036c9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./smsInteraction.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('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x9')]('/:id/download',auth[_0x0d8b('0x7')](),controller['download']);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0xf')](_0x0d8b('0x12'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x15')),controller[_0x0d8b('0x16')]);router['put'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x17')),controller['update']);router[_0x0d8b('0x18')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x19')),controller[_0x0d8b('0x1a')]);router[_0x0d8b('0x18')]('/:id/tags',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x1b')]);module[_0x0d8b('0x1c')]=router; \ No newline at end of file +var _0x9354=['/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x18ae72,_0x1d05d9){var _0x34f4ef=function(_0x4fce13){while(--_0x4fce13){_0x18ae72['push'](_0x18ae72['shift']());}};_0x34f4ef(++_0x1d05d9);}(_0x9354,0x96));var _0x4935=function(_0x3cd91d,_0x163516){_0x3cd91d=_0x3cd91d-0x0;var _0x3b4fab=_0x9354[_0x3cd91d];return _0x3b4fab;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['get'](_0x4935('0xd'),auth['isAuthenticated'](),controller[_0x4935('0xe')]);router[_0x4935('0x8')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x10')]);router[_0x4935('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x4935('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4935('0x12')]);router[_0x4935('0x13')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x14')]);router[_0x4935('0x13')](_0x4935('0x15'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')](_0x4935('0x17'),_0x4935('0x18')),controller[_0x4935('0x19')]);router[_0x4935('0x1a')](_0x4935('0xd'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')]('sms',_0x4935('0x1b')),controller[_0x4935('0x1c')]);router[_0x4935('0x1d')](_0x4935('0xd'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')]('sms',_0x4935('0x1e')),controller[_0x4935('0x1f')]);router['delete'](_0x4935('0x15'),auth[_0x4935('0x9')](),controller[_0x4935('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 2c1ae0e..f423938 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 _0x7e4b=['moment','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x45277b,_0x4ebfce){var _0x5ca9c2=function(_0x2ddffc){while(--_0x2ddffc){_0x45277b['push'](_0x45277b['shift']());}};_0x5ca9c2(++_0x4ebfce);}(_0x7e4b,0x84));var _0xb7e4=function(_0xc4eabd,_0x197eaf){_0xc4eabd=_0xc4eabd-0x0;var _0x8b8cdd=_0x7e4b[_0xc4eabd];return _0x8b8cdd;};'use strict';var Sequelize=require(_0xb7e4('0x0'));var moment=require(_0xb7e4('0x1'));module['exports']={'closed':{'type':Sequelize[_0xb7e4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb7e4('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb7e4('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb7e4('0x4')]},'note':{'type':Sequelize[_0xb7e4('0x4')]},'phone':{'type':Sequelize[_0xb7e4('0x4')]},'read1stAt':{'type':Sequelize[_0xb7e4('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb7e4('0x5')]('in',_0xb7e4('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb7e4('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb7e4('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb7e4('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x0eb2=['DATE','STRING','out','ENUM','sequelize','exports','BOOLEAN'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x0eb2,0x11c));var _0x20eb=function(_0x2b2c11,_0x124be9){_0x2b2c11=_0x2b2c11-0x0;var _0x4a44dc=_0x0eb2[_0x2b2c11];return _0x4a44dc;};'use strict';var Sequelize=require(_0x20eb('0x0'));var moment=require('moment');module[_0x20eb('0x1')]={'closed':{'type':Sequelize[_0x20eb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x20eb('0x3')]},'disposition':{'type':Sequelize[_0x20eb('0x4')]},'secondDisposition':{'type':Sequelize[_0x20eb('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x20eb('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x20eb('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x20eb('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x20eb('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x20eb('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index bde4f16..0195715 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 _0xb9ad=['../../config/license/util','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','error','stack','send','Users','map','fullname','TagIds','Tags','split','forEach','then','catch','talking','answered','unmanaged','total','closed','UserId','waiting','index','SmsInteraction','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','select','field','name','color','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','`\x20=\x200','having','Contact','$substring','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','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','body','buildExpression','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','concat','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','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','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','agent','user','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','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','c.firstName','Contact.firstName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','show','params','includeAll','include','options','create','addMessage','ids','omit','getMessages','findOne','SmsMessage','format','findAll','addTags','setTags','smsInteractionTags:save','removeTags','root','server','files','join','attachments','transcript-%d-%s.zip','lastName','Messages','createdAt','direction','secret','Account','Owner','get','mkdirSync','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','out','System','firstName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','download','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x3df822,_0x299495){var _0x4e457d=function(_0x68a45f){while(--_0x68a45f){_0x3df822['push'](_0x3df822['shift']());}};_0x4e457d(++_0x299495);}(_0xb9ad,0x1b1));var _0xdb9a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb9ad[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xdb9a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb9a('0x1'));var jsonpatch=require(_0xdb9a('0x2'));var rp=require(_0xdb9a('0x3'));var moment=require(_0xdb9a('0x4'));var BPromise=require(_0xdb9a('0x5'));var Mustache=require(_0xdb9a('0x6'));var util=require(_0xdb9a('0x7'));var path=require(_0xdb9a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdb9a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdb9a('0xa'));var squel=require(_0xdb9a('0xb'));var crypto=require('crypto');var jsforce=require(_0xdb9a('0xc'));var deskjs=require(_0xdb9a('0xd'));var toCsv=require(_0xdb9a('0xe'));var querystring=require(_0xdb9a('0xf'));var Papa=require(_0xdb9a('0x10'));var Redis=require('ioredis');var authService=require(_0xdb9a('0x11'));var qs=require(_0xdb9a('0x12'));var as=require(_0xdb9a('0x13'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xdb9a('0x14'));var logger=require('../../config/logger')(_0xdb9a('0x15'));var utils=require('../../config/utils');var config=require(_0xdb9a('0x16'));var licenseUtil=require(_0xdb9a('0x17'));var db=require('../../mysqldb')['db'];config[_0xdb9a('0x18')]=_[_0xdb9a('0x19')](config[_0xdb9a('0x18')],{'host':_0xdb9a('0x1a'),'port':0x18eb});var socket=require(_0xdb9a('0x1b'))(new Redis(config[_0xdb9a('0x18')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3498c8,_0x429fab){_0x429fab=_0x429fab||0xcc;return function(_0x37c94c){if(_0x37c94c){return _0x3498c8[_0xdb9a('0x1c')](_0x429fab);}return _0x3498c8[_0xdb9a('0x1d')](_0x429fab)[_0xdb9a('0x1e')]();};}function respondWithResult(_0x334d49,_0x44e188){_0x44e188=_0x44e188||0xc8;return function(_0x5486ac){if(_0x5486ac){return _0x334d49[_0xdb9a('0x1d')](_0x44e188)[_0xdb9a('0x1f')](_0x5486ac);}};}function respondWithFilteredResult(_0x15376c,_0xe707f2){return function(_0x422a8b){if(_0x422a8b){var _0xa49736=typeof _0xe707f2[_0xdb9a('0x20')]===_0xdb9a('0x21')&&typeof _0xe707f2[_0xdb9a('0x22')]==='undefined';var _0x456b2f=_0x422a8b[_0xdb9a('0x23')];var _0x116f8b=_0xa49736?0x0:_0xe707f2[_0xdb9a('0x20')];var _0x373617=_0xa49736?_0x422a8b[_0xdb9a('0x23')]:_0xe707f2['offset']+_0xe707f2['limit'];var _0x5ecafe;if(_0x373617>=_0x456b2f){_0x373617=_0x456b2f;_0x5ecafe=0xc8;}else{_0x5ecafe=0xce;}_0x15376c[_0xdb9a('0x1d')](_0x5ecafe);return _0x15376c[_0xdb9a('0x24')](_0xdb9a('0x25'),_0x116f8b+'-'+_0x373617+'/'+_0x456b2f)[_0xdb9a('0x1f')](_0x422a8b);}return null;};}function patchUpdates(_0x398f1e){return function(_0x44150e){try{jsonpatch['apply'](_0x44150e,_0x398f1e,!![]);}catch(_0x11baa8){return BPromise[_0xdb9a('0x26')](_0x11baa8);}return _0x44150e['save']();};}function saveUpdates(_0x379b5f,_0x570562){return function(_0x350015){if(_0x350015){return _0x350015[_0xdb9a('0x27')](_0x379b5f)['then'](function(_0x1fdeef){return _0x1fdeef;});}return null;};}function removeEntity(_0x82cd02,_0x5bef56){return function(_0x56cf3d){if(_0x56cf3d){return _0x56cf3d[_0xdb9a('0x28')]()['then'](function(){_0x82cd02[_0xdb9a('0x1d')](0xcc)[_0xdb9a('0x1e')]();});}};}function handleEntityNotFound(_0x142864,_0x4239b4){return function(_0x58c498){if(!_0x58c498){_0x142864['sendStatus'](0x194);}return _0x58c498;};}function handleError(_0x51c2ed,_0x47538d){_0x47538d=_0x47538d||0x1f4;return function(_0x5e60b9){logger[_0xdb9a('0x29')](_0x5e60b9[_0xdb9a('0x2a')]);if(_0x5e60b9['name']){delete _0x5e60b9['name'];}_0x51c2ed[_0xdb9a('0x1d')](_0x47538d)[_0xdb9a('0x2b')](_0x5e60b9);};}function getInteractionUsers(_0x45892a,_0x3c561b){return new BPromise(function(_0x276e3d,_0x41c062){try{if(_0x3c561b[_0x45892a['id']]){_0x45892a[_0xdb9a('0x2c')]=_[_0xdb9a('0x2d')](_0x3c561b[_0x45892a['id']],function(_0x5cca30){return{'id':_0x5cca30['id'],'fullname':_0x5cca30[_0xdb9a('0x2e')]};});}}catch(_0x43493b){_0x41c062(_0x43493b);}_0x276e3d(_0x45892a);});}function getInteractionTags(_0x135ef1,_0x5a9638){return new BPromise(function(_0x3bb55a,_0x1460c2){try{if(_0x135ef1[_0xdb9a('0x2f')]){_0x135ef1[_0xdb9a('0x30')]=[];_0x135ef1[_0xdb9a('0x2f')][_0xdb9a('0x31')](',')[_0xdb9a('0x32')](function(_0x36b574){_0x135ef1[_0xdb9a('0x30')]['push'](_0x5a9638[_0x36b574]);});}delete _0x135ef1['TagIds'];}catch(_0x2ce002){_0x1460c2(_0x2ce002);}_0x3bb55a(_0x135ef1);});}function updateSmsInteraction(_0x33dca5,_0x6d416c,_0x172301){return new BPromise(function(_0x94c19a,_0x45e3eb){return getInteractionUsers(_0x33dca5,_0x172301)[_0xdb9a('0x33')](function(_0x20b56d){return getInteractionTags(_0x20b56d,_0x6d416c);})[_0xdb9a('0x33')](function(_0x4d2626){return getStateInteraction(_0x4d2626);})[_0xdb9a('0x33')](function(_0x190885){_0x94c19a(_0x190885);})[_0xdb9a('0x34')](function(_0x36c073){_0x45e3eb(_0x36c073);});});}function getStateInteraction(_0x6cec7e){return new BPromise(function(_0x1de2d8){_0x6cec7e['waiting']=0x0;_0x6cec7e[_0xdb9a('0x35')]=0x0;_0x6cec7e[_0xdb9a('0x36')]=0x0;_0x6cec7e[_0xdb9a('0x37')]=0x0;_0x6cec7e[_0xdb9a('0x38')]=0x0;if(!_0x6cec7e[_0xdb9a('0x39')]&&!_0x6cec7e[_0xdb9a('0x3a')]){_0x6cec7e[_0xdb9a('0x3b')]+=0x1;}if(!_0x6cec7e[_0xdb9a('0x39')]&&_0x6cec7e[_0xdb9a('0x3a')]){_0x6cec7e['talking']+=0x1;if(_0x6cec7e['waiting']){_0x6cec7e[_0xdb9a('0x3b')]-=0x1;}}if(_0x6cec7e[_0xdb9a('0x39')]&&_0x6cec7e[_0xdb9a('0x3a')]){_0x6cec7e[_0xdb9a('0x36')]+=0x1;if(_0x6cec7e['talking']){_0x6cec7e[_0xdb9a('0x35')]-=0x1;}}if(_0x6cec7e[_0xdb9a('0x39')]&&!_0x6cec7e[_0xdb9a('0x3a')]){_0x6cec7e[_0xdb9a('0x37')]+=0x1;if(_0x6cec7e[_0xdb9a('0x3b')]){_0x6cec7e[_0xdb9a('0x3b')]-=0x1;}}_0x6cec7e[_0xdb9a('0x38')]+=0x1;_0x1de2d8(_0x6cec7e);});}exports[_0xdb9a('0x3c')]=function(_0x5f08d1,_0x2b93bb){var _0x7edfe5={},_0x18e150={},_0x50938d={'count':0x0,'rows':[]};var _0x36b160=_[_0xdb9a('0x2d')](db[_0xdb9a('0x3d')][_0xdb9a('0x3e')],function(_0x1a01a9){return{'name':_0x1a01a9[_0xdb9a('0x3f')],'type':_0x1a01a9['type'][_0xdb9a('0x40')]};});_0x18e150['model']=_[_0xdb9a('0x2d')](_0x36b160,'name');_0x18e150[_0xdb9a('0x41')]=_[_0xdb9a('0x42')](_0x5f08d1[_0xdb9a('0x41')]);_0x18e150[_0xdb9a('0x43')]=_['intersection'](_0x18e150[_0xdb9a('0x44')],_0x18e150[_0xdb9a('0x41')]);_0x7edfe5['attributes']=_[_0xdb9a('0x45')](_0x18e150[_0xdb9a('0x44')],qs[_0xdb9a('0x46')](_0x5f08d1[_0xdb9a('0x41')][_0xdb9a('0x46')]));_0x7edfe5[_0xdb9a('0x47')]=_0x7edfe5[_0xdb9a('0x47')]['length']?_0x7edfe5[_0xdb9a('0x47')]:_0x18e150[_0xdb9a('0x44')];if(!_0x5f08d1[_0xdb9a('0x41')][_0xdb9a('0x48')](_0xdb9a('0x49'))){_0x7edfe5['limit']=qs[_0xdb9a('0x22')](_0x5f08d1[_0xdb9a('0x41')][_0xdb9a('0x22')]);_0x7edfe5[_0xdb9a('0x20')]=qs[_0xdb9a('0x20')](_0x5f08d1[_0xdb9a('0x41')]['offset']);}_0x7edfe5[_0xdb9a('0x4a')]=qs[_0xdb9a('0x4b')](_0x5f08d1['query'][_0xdb9a('0x4b')]);_0x7edfe5[_0xdb9a('0x4c')]=qs[_0xdb9a('0x43')](_[_0xdb9a('0x4d')](_0x5f08d1[_0xdb9a('0x41')],_0x18e150[_0xdb9a('0x43')]),_0x36b160);var _0x3fea27=[];var _0x56538d=squel[_0xdb9a('0x4e')]()[_0xdb9a('0x4f')]('id')['field'](_0xdb9a('0x50'))[_0xdb9a('0x4f')](_0xdb9a('0x51'))['from'](_0xdb9a('0x52'));var _0x3d22d4=squel[_0xdb9a('0x4e')]()[_0xdb9a('0x4f')](_0xdb9a('0x53'))['field']('u.fullname')['field'](_0xdb9a('0x54'))['from'](_0xdb9a('0x55'),'ui')[_0xdb9a('0x56')](_0xdb9a('0x57'),'u',_0xdb9a('0x58'));var _0x29ff41=squel[_0xdb9a('0x4e')]()['from'](_0xdb9a('0x59'),'i')[_0xdb9a('0x56')](_0xdb9a('0x5a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xdb9a('0x56')]('users','o',_0xdb9a('0x5b'))[_0xdb9a('0x56')]('sms_accounts','a',_0xdb9a('0x5c'))['left_join'](_0xdb9a('0x5d'),'me','me.SmsInteractionId\x20=\x20i.id')[_0xdb9a('0x56')]('sms_interaction_has_tags','it',_0xdb9a('0x5e'))[_0xdb9a('0x56')](_0xdb9a('0x52'),'t','t.id\x20=\x20it.TagId');var _0x2549c1=squel[_0xdb9a('0x5f')]();var _0x38dcf8=[];var _0x38f718=squel[_0xdb9a('0x5f')]();var _0x587b70;if(_0x5f08d1['query'][_0xdb9a('0x60')]){_0x587b70=as[_0xdb9a('0x61')](_0x5f08d1[_0xdb9a('0x41')]['search']);var _0x112442=_0x587b70[_0xdb9a('0x62')];for(var _0x2785fe=0x0;_0x2785fe<_0x587b70[_0xdb9a('0x63')][_0xdb9a('0x64')];_0x2785fe++){var _0x451afd=_0x587b70[_0xdb9a('0x63')][_0x2785fe];var _0x451b64='i';var _0x2e1fdf=_[_0xdb9a('0x65')](_0x36b160,[_0xdb9a('0x50'),_0x451afd[_0xdb9a('0x4f')]]);if(!_0x2e1fdf){switch(_0x451afd[_0xdb9a('0x4f')]){case _0xdb9a('0x66'):if(_0x451afd['value']==0x1){_0x29ff41['having']('`'+_0x451afd['field']+_0xdb9a('0x67'));}else{_0x29ff41[_0xdb9a('0x68')]('`'+_0x451afd[_0xdb9a('0x4f')]+'`\x20>\x200');}break;case _0xdb9a('0x69'):if(_0x451afd['operator']===_0xdb9a('0x6a')){if(_0x451afd[_0xdb9a('0x6b')][_0xdb9a('0x31')]('\x20')['length']>0x1){_0x2549c1[_0x112442](_0xdb9a('0x6c'),qs[_0xdb9a('0x6d')](_0x451afd[_0xdb9a('0x6b')]),null);}else{var _0x2dc53d='%'+_0x451afd[_0xdb9a('0x6b')]+'%';_0x2549c1[_0x112442](_0xdb9a('0x6e'),_0x2dc53d,_0x2dc53d,_0x2dc53d);}}else{_0x2e1fdf=_[_0xdb9a('0x65')](_0x36b160,[_0xdb9a('0x50'),'ContactId']);_0x451afd[_0xdb9a('0x4f')]=_0xdb9a('0x6f');_0x4d1125=as['buildExpression'](_0x451b64,_0x2e1fdf[_0xdb9a('0x70')],_0x451afd);_0x2549c1[_0x112442](_0x4d1125[_0xdb9a('0x71')],_0x4d1125[_0xdb9a('0x6b')][_0xdb9a('0x72')],_0x4d1125[_0xdb9a('0x6b')][_0xdb9a('0x1e')]);}break;case _0xdb9a('0x73'):var _0x14bb39=_0x451afd['value'][_0xdb9a('0x31')](',')[_0xdb9a('0x2d')](function(_0x22b3f4){return Number(_0x22b3f4);});_0x14bb39['forEach'](function(_0x20e378){_0x38f718['or'](_0xdb9a('0x74'),'%,'+_0x20e378+',%');});_0x38dcf8=_['union'](_0x38dcf8,_0x14bb39);break;case _0xdb9a('0x75'):if(_0x451afd[_0xdb9a('0x76')]===_0xdb9a('0x6a')){_0x2549c1[_0x112442]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x451afd[_0xdb9a('0x6b')]+'%',null);}else{_0x2e1fdf=_[_0xdb9a('0x65')](_0x36b160,[_0xdb9a('0x50'),_0xdb9a('0x3a')]);_0x451afd['field']=_0xdb9a('0x3a');_0x4d1125=as['buildExpression'](_0x451b64,_0x2e1fdf[_0xdb9a('0x70')],_0x451afd);_0x2549c1[_0x112442](_0x4d1125[_0xdb9a('0x71')],_0x4d1125[_0xdb9a('0x6b')][_0xdb9a('0x72')],_0x4d1125['value'][_0xdb9a('0x1e')]);}break;case _0xdb9a('0x77'):_0x4d1125=as[_0xdb9a('0x78')]('me',null,_0x451afd);_0x2549c1[_0x112442](_0x4d1125[_0xdb9a('0x71')],_0x4d1125[_0xdb9a('0x6b')][_0xdb9a('0x72')],_0x4d1125[_0xdb9a('0x6b')][_0xdb9a('0x1e')]);break;}}else{var _0x4d1125=as[_0xdb9a('0x78')](_0x451b64,_0x2e1fdf[_0xdb9a('0x70')],_0x451afd);_0x2549c1[_0x112442](_0x4d1125['text'],_0x4d1125[_0xdb9a('0x6b')][_0xdb9a('0x72')],_0x4d1125['value'][_0xdb9a('0x1e')]);}}}else{var _0x584b17=_(_0x5f08d1[_0xdb9a('0x41')])[_0xdb9a('0x42')]()[_0xdb9a('0x2d')](function(_0x3490ad){return _[_0xdb9a('0x79')](_0x36b160,[_0xdb9a('0x50'),_0x3490ad])?_0x3490ad:undefined;})[_0xdb9a('0x7a')]()['value']();if(!_[_0xdb9a('0x7b')](_0x584b17)){_0x584b17[_0xdb9a('0x32')](function(_0x273849){if(_0x273849==='SmsAccountId'){_0x29ff41[_0xdb9a('0x4c')](_0xdb9a('0x7c'),[][_0xdb9a('0x7d')](_0x5f08d1['query'][_0x273849]));}else if(_0x273849==='createdAt'){var _0x560b05=JSON['parse'](_0x5f08d1[_0xdb9a('0x41')][_0x273849])[_0xdb9a('0x7e')];var _0x5c34d6=JSON[_0xdb9a('0x7f')](_0x5f08d1['query'][_0x273849])['$lte'];_0x29ff41[_0xdb9a('0x4c')](_0xdb9a('0x80'),_0x560b05,_0x5c34d6);}else{if(_0x5f08d1[_0xdb9a('0x41')][_0x273849]===_0xdb9a('0x81')){_0x29ff41[_0xdb9a('0x4c')]('i.'+_0x273849+_0xdb9a('0x82'));}else{_0x29ff41[_0xdb9a('0x4c')]('i.'+_0x273849+_0xdb9a('0x83'),_0x5f08d1[_0xdb9a('0x41')][_0x273849]);}}});}if(_0x5f08d1[_0xdb9a('0x41')][_0xdb9a('0x84')]){if(_0x5f08d1[_0xdb9a('0x41')][_0xdb9a('0x84')]==0x1){_0x29ff41[_0xdb9a('0x68')](_0xdb9a('0x85'));}else{_0x29ff41[_0xdb9a('0x68')]('`unreadMessages`\x20>\x200');}}if(_0x5f08d1['query'][_0xdb9a('0x86')]){_0x38dcf8=_['isArray'](_0x5f08d1['query'][_0xdb9a('0x86')])?_0x5f08d1[_0xdb9a('0x41')][_0xdb9a('0x86')]:new Array(_0x5f08d1['query']['tag']);_0x38dcf8['forEach'](function(_0xbaa44b){_0x38f718['or'](_0xdb9a('0x74'),'%,'+_0xbaa44b+',%');});}if(_0x5f08d1[_0xdb9a('0x41')]['filter']){var _0xbaf4c7=_0x5f08d1['query'][_0xdb9a('0x87')][_0xdb9a('0x88')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xdb9a('0x89')](_0xbaf4c7)){_0x2549c1['or'](_0xdb9a('0x8a'),_0xbaf4c7+'%')['or'](_0xdb9a('0x8b'),_0xbaf4c7+'%');}else{_0x2549c1['or'](_0xdb9a('0x8c'),qs[_0xdb9a('0x6d')](_0xbaf4c7))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xbaf4c7+'%');}}}_0x29ff41['where'](_0x2549c1);_0x29ff41[_0xdb9a('0x8d')](_0xdb9a('0x8e'));var _0x145977={'type':db[_0xdb9a('0x8f')][_0xdb9a('0x90')][_0xdb9a('0x91')],'raw':!![]};var _0xc33870=_0x29ff41['clone']();_0xc33870[_0xdb9a('0x4f')](_0xdb9a('0x8e'));_0xc33870['field'](_0xdb9a('0x92'),_0xdb9a('0x66'));if(_0x7edfe5[_0xdb9a('0x4a')]){_0x7edfe5[_0xdb9a('0x4a')]['forEach'](function(_0x191393){var _0x3af544=_0x191393[0x0]===_0xdb9a('0x93')?_0x191393[0x0]:'i.'+_0x191393[0x0];_0x29ff41[_0xdb9a('0x4a')](_0x3af544,_0x191393[0x1]==='DESC'?![]:!![]);});}if(!_[_0xdb9a('0x7b')](_0x38dcf8)){_0x29ff41[_0xdb9a('0x68')](_0x38f718);_0xc33870[_0xdb9a('0x4c')](_0xdb9a('0x94'),_0x38dcf8);}BPromise[_0xdb9a('0x95')]()['then'](function(){if(!_0x587b70){if(_0x5f08d1['query'][_0xdb9a('0x96')])return;_0xc33870[_0xdb9a('0x4c')](_0xdb9a('0x97'));_0x29ff41[_0xdb9a('0x4c')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5f08d1['user']['role']!==_0xdb9a('0x98'))return;return _0x5f08d1[_0xdb9a('0x99')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0xdb9a('0x33')](function(_0x3103bc){if(_[_0xdb9a('0x7b')](_0x3103bc)){_0xc33870[_0xdb9a('0x4c')](_0xdb9a('0x9a'));_0x29ff41[_0xdb9a('0x4c')](_0xdb9a('0x9a'));}else{_0xc33870[_0xdb9a('0x4c')]('i.SmsAccountId\x20IN\x20?',_[_0xdb9a('0x2d')](_0x3103bc,'id'));_0x29ff41[_0xdb9a('0x4c')](_0xdb9a('0x7c'),_[_0xdb9a('0x2d')](_0x3103bc,'id'));}});})[_0xdb9a('0x33')](function(){if(_0x5f08d1[_0xdb9a('0x99')]['role']===_0xdb9a('0x98')&&!_0x587b70&&!_0x5f08d1['query'][_0xdb9a('0x96')])return[];return db[_0xdb9a('0x9b')][_0xdb9a('0x41')](_0xc33870[_0xdb9a('0x9c')](),_0x145977);})['then'](function(_0x38693a){_0x50938d[_0xdb9a('0x23')]=_0x38693a[_0xdb9a('0x64')];if(_0x50938d['count']===0x0)return[];return db[_0xdb9a('0x9b')][_0xdb9a('0x41')](_0x56538d['toString'](),_0x145977)[_0xdb9a('0x33')](function(_0x18bbcc){_0x3fea27=_['keyBy'](_0x18bbcc,'id');_0x145977=_[_0xdb9a('0x9d')](_0x145977,{'model':db[_0xdb9a('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5f08d1['query']['fields']){_0x7edfe5[_0xdb9a('0x47')][_0xdb9a('0x32')](function(_0x38f036){_0x29ff41[_0xdb9a('0x4f')]('i.'+_0x38f036);});}else{_0x29ff41['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xdb9a('0x66'));_0x29ff41[_0xdb9a('0x4f')](_0xdb9a('0x9e'),_0xdb9a('0x9f'));_0x29ff41[_0xdb9a('0x4f')](_0xdb9a('0xa0'),'Account.mandatoryDisposition');_0x29ff41[_0xdb9a('0x4f')](_0xdb9a('0xa1'),'contactName');_0x29ff41['field']('i.*');_0x29ff41['field'](_0xdb9a('0xa2'),_0xdb9a('0xa3'));_0x29ff41['field']('c.lastName','Contact.lastName');_0x29ff41[_0xdb9a('0x4f')]('c.email',_0xdb9a('0xa4'));_0x29ff41[_0xdb9a('0x4f')](_0xdb9a('0xa5'),'Contact.phone');_0x29ff41[_0xdb9a('0x4f')](_0xdb9a('0xa6'),_0xdb9a('0xa7'));_0x29ff41[_0xdb9a('0x4f')](_0xdb9a('0xa8'),_0xdb9a('0xa9'));_0x29ff41['field'](_0xdb9a('0xaa'),_0xdb9a('0xab'));_0x29ff41[_0xdb9a('0x4f')](_0xdb9a('0xac'),_0xdb9a('0xad'));_0x29ff41[_0xdb9a('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xdb9a('0x2f'));}if(_0x7edfe5[_0xdb9a('0x22')])_0x29ff41[_0xdb9a('0x22')](_0x7edfe5[_0xdb9a('0x22')]);if(_0x7edfe5['offset'])_0x29ff41['offset'](_0x7edfe5[_0xdb9a('0x20')]);return db[_0xdb9a('0x9b')]['query'](_0x29ff41[_0xdb9a('0x9c')](),_0x145977);})[_0xdb9a('0x33')](function(_0x5918a8){if(_0x5918a8['length']>0x0)_0x3d22d4[_0xdb9a('0x4c')](_0xdb9a('0xae'),_[_0xdb9a('0x2d')](_0x5918a8,'id'));return db['sequelize']['query'](_0x3d22d4[_0xdb9a('0x9c')](),_0x145977)[_0xdb9a('0x33')](function(_0x2d082e){var _0x652482=_[_0xdb9a('0xaf')](_0x2d082e,_0xdb9a('0xb0'));var _0x5292a0=[];_0x5918a8['forEach'](function(_0xa8c0ba){_0x5292a0[_0xdb9a('0xb1')](updateSmsInteraction(_0xa8c0ba,_0x3fea27,_0x652482));});return BPromise[_0xdb9a('0xb2')](_0x5292a0);});});})[_0xdb9a('0x33')](function(_0x8779e){_0x50938d[_0xdb9a('0xb3')]=_0x8779e;return _0x50938d;})[_0xdb9a('0x33')](respondWithFilteredResult(_0x2b93bb,_0x7edfe5))[_0xdb9a('0x34')](handleError(_0x2b93bb,null));};exports[_0xdb9a('0xb4')]=function(_0x108f63,_0xf3704a){var _0x31ad26={'raw':![],'where':{'id':_0x108f63[_0xdb9a('0xb5')]['id']}},_0x366fdc={};_0x366fdc['model']=_[_0xdb9a('0x42')](db[_0xdb9a('0x3d')]['rawAttributes']);_0x366fdc[_0xdb9a('0x41')]=_['keys'](_0x108f63['query']);_0x366fdc[_0xdb9a('0x43')]=_[_0xdb9a('0x45')](_0x366fdc[_0xdb9a('0x44')],_0x366fdc[_0xdb9a('0x41')]);_0x31ad26['attributes']=_[_0xdb9a('0x45')](_0x366fdc[_0xdb9a('0x44')],qs[_0xdb9a('0x46')](_0x108f63['query']['fields']));_0x31ad26[_0xdb9a('0x47')]=_0x31ad26[_0xdb9a('0x47')][_0xdb9a('0x64')]?_0x31ad26[_0xdb9a('0x47')]:_0x366fdc[_0xdb9a('0x44')];if(_0x108f63['query'][_0xdb9a('0xb6')]){_0x31ad26[_0xdb9a('0xb7')]=[{'all':!![]}];}_0x31ad26=_[_0xdb9a('0x9d')]({},_0x31ad26,_0x108f63[_0xdb9a('0xb8')]);return db[_0xdb9a('0x3d')][_0xdb9a('0x65')](_0x31ad26)[_0xdb9a('0x33')](handleEntityNotFound(_0xf3704a,null))[_0xdb9a('0x33')](respondWithResult(_0xf3704a,null))['catch'](handleError(_0xf3704a,null));};exports['create']=function(_0x540a87,_0x65e602){return db[_0xdb9a('0x3d')][_0xdb9a('0xb9')](_0x540a87[_0xdb9a('0x77')],{})[_0xdb9a('0x33')](respondWithResult(_0x65e602,0xc9))[_0xdb9a('0x34')](handleError(_0x65e602,null));};exports[_0xdb9a('0x27')]=function(_0x17058a,_0x4baca6){if(_0x17058a['body']['id']){delete _0x17058a['body']['id'];}return db['SmsInteraction'][_0xdb9a('0x65')]({'where':{'id':_0x17058a[_0xdb9a('0xb5')]['id']}})[_0xdb9a('0x33')](handleEntityNotFound(_0x4baca6,null))[_0xdb9a('0x33')](saveUpdates(_0x17058a[_0xdb9a('0x77')],null))['then'](respondWithResult(_0x4baca6,null))[_0xdb9a('0x34')](handleError(_0x4baca6,null));};exports[_0xdb9a('0x28')]=function(_0x4f6069,_0x27cf5a){return db[_0xdb9a('0x3d')][_0xdb9a('0x65')]({'where':{'id':_0x4f6069[_0xdb9a('0xb5')]['id']}})[_0xdb9a('0x33')](handleEntityNotFound(_0x27cf5a,null))[_0xdb9a('0x33')](removeEntity(_0x27cf5a,null))[_0xdb9a('0x34')](handleError(_0x27cf5a,null));};exports['describe']=function(_0x251b9e,_0x13451b){return db[_0xdb9a('0x3d')]['describe']()[_0xdb9a('0x33')](respondWithResult(_0x13451b,null))['catch'](handleError(_0x13451b,null));};exports[_0xdb9a('0xba')]=function(_0x4433ed,_0x4239fb,_0x3a3865){return db['SmsMessage'][_0xdb9a('0x65')]({'where':{'id':_0x4433ed['params']['id']}})[_0xdb9a('0x33')](handleEntityNotFound(_0x4239fb,null))[_0xdb9a('0x33')](function(_0x196d02){if(_0x196d02){return _0x196d02[_0xdb9a('0xba')](_0x4433ed[_0xdb9a('0x77')][_0xdb9a('0xbb')],_[_0xdb9a('0xbc')](_0x4433ed[_0xdb9a('0x77')],[_0xdb9a('0xbb'),'id'])||{});}})[_0xdb9a('0x33')](respondWithResult(_0x4239fb,null))['catch'](handleError(_0x4239fb,null));};exports[_0xdb9a('0xbd')]=function(_0x45c4c4,_0x4e7226,_0x59e9ae){var _0x1a80c0={'raw':![],'where':{}};var _0x15f088={};var _0x436e7c={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xdb9a('0xbe')]({'where':{'id':_0x45c4c4[_0xdb9a('0xb5')]['id']}})[_0xdb9a('0x33')](handleEntityNotFound(_0x4e7226,null))[_0xdb9a('0x33')](function(_0x23c837){if(_0x23c837){_0x15f088['model']=_[_0xdb9a('0x42')](db[_0xdb9a('0xbf')][_0xdb9a('0x3e')]);_0x15f088[_0xdb9a('0x41')]=_[_0xdb9a('0x42')](_0x45c4c4['query']);_0x15f088[_0xdb9a('0x43')]=_[_0xdb9a('0x45')](_0x15f088[_0xdb9a('0x44')],_0x15f088['query']);_0x1a80c0[_0xdb9a('0x47')]=_[_0xdb9a('0x45')](_0x15f088[_0xdb9a('0x44')],qs[_0xdb9a('0x46')](_0x45c4c4['query'][_0xdb9a('0x46')]));_0x1a80c0['attributes']=_0x1a80c0[_0xdb9a('0x47')][_0xdb9a('0x64')]?_0x1a80c0[_0xdb9a('0x47')]:_0x15f088[_0xdb9a('0x44')];if(!_0x45c4c4['query'][_0xdb9a('0x48')](_0xdb9a('0x49'))){_0x1a80c0[_0xdb9a('0x22')]=qs['limit'](_0x45c4c4[_0xdb9a('0x41')]['limit']);_0x1a80c0[_0xdb9a('0x20')]=qs[_0xdb9a('0x20')](_0x45c4c4[_0xdb9a('0x41')][_0xdb9a('0x20')]);}_0x1a80c0[_0xdb9a('0x4a')]=qs[_0xdb9a('0x4b')](_0x45c4c4['query'][_0xdb9a('0x4b')]);_0x1a80c0[_0xdb9a('0x4c')]=qs['filters'](_[_0xdb9a('0x4d')](_0x45c4c4[_0xdb9a('0x41')],_0x15f088['filters']));_0x1a80c0[_0xdb9a('0x4c')]['SmsInteractionId']=_0x23c837['id'];if(_0x45c4c4[_0xdb9a('0x41')][_0xdb9a('0x87')]){_0x1a80c0[_0xdb9a('0x4c')]=_['merge'](_0x1a80c0[_0xdb9a('0x4c')],{'$or':_[_0xdb9a('0x2d')](_0x1a80c0['attributes'],function(_0x459c16){var _0x724233={};_0x724233[_0x459c16]={'$like':'%'+_0x45c4c4[_0xdb9a('0x41')]['filter']+'%'};return _0x724233;})});}if(_0x45c4c4[_0xdb9a('0x41')][_0xdb9a('0x7e')]){var _0xa16d82=_0x45c4c4['query']['$gte']['split'](',');var _0x1cb9df={};_0x1cb9df[_0xa16d82[0x0]]={'$gte':moment(_0xa16d82[0x1])[_0xdb9a('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1a80c0['where']=_['merge'](_0x1a80c0['where'],_0x1cb9df);}_0x1a80c0=_[_0xdb9a('0x9d')]({},_0x1a80c0,_0x45c4c4[_0xdb9a('0xb8')]);return db['SmsMessage'][_0xdb9a('0x23')]({'where':_0x1a80c0[_0xdb9a('0x4c')]})[_0xdb9a('0x33')](function(_0x4d84c1){_0x436e7c[_0xdb9a('0x23')]=_0x4d84c1;if(_0x45c4c4[_0xdb9a('0x41')][_0xdb9a('0xb6')]){_0x1a80c0[_0xdb9a('0xb7')]=[{'all':!![]}];}return db[_0xdb9a('0xbf')][_0xdb9a('0xc1')](_0x1a80c0);})[_0xdb9a('0x33')](function(_0x14a739){_0x436e7c[_0xdb9a('0xb3')]=_0x14a739;return _0x436e7c;});}})[_0xdb9a('0x33')](respondWithFilteredResult(_0x4e7226,_0x1a80c0))[_0xdb9a('0x34')](handleError(_0x4e7226,null));};exports[_0xdb9a('0xc2')]=function(_0x3af669,_0x26b9e4,_0xe8c9cf){return db[_0xdb9a('0x3d')][_0xdb9a('0x65')]({'where':{'id':_0x3af669['params']['id']}})['then'](handleEntityNotFound(_0x26b9e4,null))['then'](function(_0x3f3449){if(_0x3f3449){return _0x3f3449[_0xdb9a('0xc3')](_0x3af669[_0xdb9a('0x77')][_0xdb9a('0xbb')],_[_0xdb9a('0xbc')](_0x3af669['body'],[_0xdb9a('0xbb'),'id'])||{})['spread'](function(){return db['Tag'][_0xdb9a('0xc1')]({'attributes':['id','name',_0xdb9a('0x51')],'where':{'id':_0x3af669[_0xdb9a('0x77')][_0xdb9a('0xbb')]}});})[_0xdb9a('0x33')](function(_0x3828c0){socket['emit'](_0xdb9a('0xc4'),{'id':Number(_0x3af669['params']['id']),'tags':_0x3828c0||[]});return{'id':Number(_0x3af669['params']['id']),'tags':_0x3828c0||[]};});}})[_0xdb9a('0x33')](respondWithResult(_0x26b9e4,null))[_0xdb9a('0x34')](handleError(_0x26b9e4,null));};exports[_0xdb9a('0xc5')]=function(_0x4525d6,_0x3bf40d,_0x360b56){return db[_0xdb9a('0x3d')][_0xdb9a('0x65')]({'where':{'id':_0x4525d6[_0xdb9a('0xb5')]['id']}})[_0xdb9a('0x33')](handleEntityNotFound(_0x3bf40d,null))[_0xdb9a('0x33')](function(_0x3a5bb6){if(_0x3a5bb6){return _0x3a5bb6['removeTags'](_0x4525d6['query'][_0xdb9a('0xbb')]);}})['then'](respondWithStatusCode(_0x3bf40d,null))[_0xdb9a('0x34')](handleError(_0x3bf40d,null));};exports['download']=function(_0x44ee84,_0x25fe11){var _0x493481=moment()['unix']()[_0xdb9a('0x9c')]();var _0x80ad4=path['join'](config[_0xdb9a('0xc6')],_0xdb9a('0xc7'),_0xdb9a('0xc8'),'tmp');var _0x40f1bd=path[_0xdb9a('0xc9')](config[_0xdb9a('0xc6')],_0xdb9a('0xc7'),'files',_0xdb9a('0xca'));var _0x258351=path['join'](_0x80ad4,_0x493481);var _0x5426a0=util[_0xdb9a('0xc0')](_0xdb9a('0xcb'),_0x44ee84[_0xdb9a('0xb5')]['id'],_0x493481);var _0x43e0b7=path[_0xdb9a('0xc9')](_0x80ad4,_0x5426a0);var _0xbec53=[];_0xbec53['push']({'model':db[_0xdb9a('0x75')],'as':_0xdb9a('0x75'),'attributes':['id','fullname'],'raw':!![]});_0xbec53[_0xdb9a('0xb1')]({'model':db['CmContact'],'as':_0xdb9a('0x69'),'attributes':['id','firstName',_0xdb9a('0xcc')],'raw':!![]});var _0x589eba=[{'model':db[_0xdb9a('0xbf')],'as':_0xdb9a('0xcd'),'attributes':['id',_0xdb9a('0x77'),_0xdb9a('0xce'),_0xdb9a('0xcf'),_0xdb9a('0xd0'),_0xdb9a('0x84')],'include':_0xbec53}];_0x589eba['push']({'model':db['SmsAccount'],'as':_0xdb9a('0xd1'),'attributes':['id',_0xdb9a('0x50')]});_0x589eba[_0xdb9a('0xb1')]({'model':db[_0xdb9a('0x75')],'as':_0xdb9a('0xd2'),'attributes':['id',_0xdb9a('0x2e')]});return db[_0xdb9a('0x3d')][_0xdb9a('0x65')]({'where':{'id':_0x44ee84[_0xdb9a('0xb5')]['id']},'include':_0x589eba})[_0xdb9a('0x33')](handleEntityNotFound(_0x25fe11,null))['then'](function(_0x564056){if(_0x564056){var _0x4e9dd8=_0x564056[_0xdb9a('0xd3')]({'plain':!![]});fs[_0xdb9a('0xd4')](_0x258351);var _0x5e0487={'channel':_0xdb9a('0xd5'),'account':_0x4e9dd8['Account'][_0xdb9a('0x50')],'agent':_0x4e9dd8[_0xdb9a('0xd2')]?_0x4e9dd8[_0xdb9a('0xd2')][_0xdb9a('0x2e')]:_0xdb9a('0xd6'),'createdAt':moment(_0x4e9dd8[_0xdb9a('0xce')])[_0xdb9a('0xc0')](_0xdb9a('0xd7'))[_0xdb9a('0x9c')](),'closedAt':_0x4e9dd8[_0xdb9a('0x39')]?moment(_0x4e9dd8['closedAt'])[_0xdb9a('0xc0')](_0xdb9a('0xd7'))[_0xdb9a('0x9c')]():'','disposition':_0x4e9dd8['disposition'],'messages':_(_0x4e9dd8[_0xdb9a('0xcd')])[_0xdb9a('0x87')]({'secret':![]})[_0xdb9a('0x2d')](function(_0x118240){return{'date':moment(_0x118240['createdAt'])[_0xdb9a('0xc0')](_0xdb9a('0xd7'))[_0xdb9a('0x9c')](),'sender':_0x118240['direction']===_0xdb9a('0xd8')?_0x118240[_0xdb9a('0x75')]?_0x118240[_0xdb9a('0x75')][_0xdb9a('0x2e')]:_0xdb9a('0xd9'):_0x118240[_0xdb9a('0x69')][_0xdb9a('0xda')]+(_0x118240['Contact']['lastName']?'\x20'+_0x118240[_0xdb9a('0x69')]['lastName']:''),'body':_0x118240[_0xdb9a('0x77')],'direction':_0x118240[_0xdb9a('0xcf')]===_0xdb9a('0xd8')?'A':'C','secret':_0x118240['secret'],'read':_0x118240[_0xdb9a('0x84')]};})[_0xdb9a('0x6b')]()};return ejs[_0xdb9a('0xdb')](path[_0xdb9a('0xc9')](config['root'],_0xdb9a('0xc7'),_0xdb9a('0xdc'),_0xdb9a('0xdd')),{'interaction':_0x5e0487})['then'](function(_0x582e12){var _0xbae535=path[_0xdb9a('0xc9')](_0x258351,_0xdb9a('0xde')+_0x4e9dd8['id']+'-'+_0x493481+_0xdb9a('0xdf'));var _0x4ab323={'path':_0xbae535,'channel':_0xdb9a('0xd5'),'interactionId':_0x4e9dd8['id']};return pdf['createPdfFromHTML'](_0x582e12,_0x4ab323);})['then'](function(){return new BPromise(function(_0x3453d7,_0x5b1a59){zipdir(_0x258351,{'saveTo':_0x43e0b7},function(_0x1c88b3,_0x59e794){if(_0x1c88b3)return _0x5b1a59(_0x1c88b3);return _0x3453d7(_0x59e794);});})[_0xdb9a('0x33')](function(){return new BPromise(function(_0x235e4a,_0xbc3063){rimraf(_0x258351,function(_0x260d01){if(_0x260d01)_0xbc3063(_0x260d01);return _0x235e4a();});});})['then'](function(){return _0x25fe11[_0xdb9a('0xe0')](_0x43e0b7,_0x5426a0,function(_0x5953bc){if(_0x5953bc){console[_0xdb9a('0xe1')](_0xdb9a('0xe2'),_0x5953bc);}else{fs[_0xdb9a('0xe3')](_0x43e0b7);}});});});}else{return _0x25fe11[_0xdb9a('0x1c')](0xc8);}})[_0xdb9a('0x34')](handleError(_0x25fe11,null));}; \ No newline at end of file +var _0x720f=['rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','localhost','redis','./smsInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','talking','answered','unmanaged','total','UserId','waiting','closed','index','SmsInteraction','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','field','color','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','sms_interactions','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','operator','$substring','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','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','text','body','start','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','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?','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','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','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','show','params','include','create','describe','addMessage','SmsMessage','ids','omit','findOne','sort','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','unix','root','files','join','server','attachments','transcript-%d-%s.zip','lastName','Messages','direction','secret','SmsAccount','Account','Sms','Owner','N.A.','closedAt','out','System','Contact','firstName','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','log','eml-format'];(function(_0x1d53cb,_0x4cf3f1){var _0x1de5fe=function(_0x438bbf){while(--_0x438bbf){_0x1d53cb['push'](_0x1d53cb['shift']());}};_0x1de5fe(++_0x4cf3f1);}(_0x720f,0xee));var _0xf720=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x720f[_0x4c7fb5];return _0x2e10ac;};'use strict';var emlformat=require(_0xf720('0x0'));var rimraf=require(_0xf720('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf720('0x2'));var rp=require(_0xf720('0x3'));var moment=require('moment');var BPromise=require(_0xf720('0x4'));var Mustache=require(_0xf720('0x5'));var util=require(_0xf720('0x6'));var path=require(_0xf720('0x7'));var sox=require(_0xf720('0x8'));var csv=require('to-csv');var ejs=require(_0xf720('0x9'));var fs=require('fs');var fs_extra=require(_0xf720('0xa'));var _=require(_0xf720('0xb'));var squel=require(_0xf720('0xc'));var crypto=require(_0xf720('0xd'));var jsforce=require(_0xf720('0xe'));var deskjs=require(_0xf720('0xf'));var toCsv=require(_0xf720('0x10'));var querystring=require(_0xf720('0x11'));var Papa=require('papaparse');var Redis=require(_0xf720('0x12'));var authService=require(_0xf720('0x13'));var qs=require(_0xf720('0x14'));var as=require(_0xf720('0x15'));var pdf=require(_0xf720('0x16'));var hardwareService=require(_0xf720('0x17'));var logger=require(_0xf720('0x18'))('api');var utils=require(_0xf720('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xf720('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf720('0x1b')]));require(_0xf720('0x1c'))[_0xf720('0x1d')](socket);function respondWithStatusCode(_0x36ad68,_0x60e005){_0x60e005=_0x60e005||0xcc;return function(_0x330a32){if(_0x330a32){return _0x36ad68[_0xf720('0x1e')](_0x60e005);}return _0x36ad68[_0xf720('0x1f')](_0x60e005)[_0xf720('0x20')]();};}function respondWithResult(_0x1b2e8b,_0x2a04da){_0x2a04da=_0x2a04da||0xc8;return function(_0x32d7ca){if(_0x32d7ca){return _0x1b2e8b[_0xf720('0x1f')](_0x2a04da)[_0xf720('0x21')](_0x32d7ca);}};}function respondWithFilteredResult(_0x26a54e,_0x4d1e42){return function(_0x1197be){if(_0x1197be){var _0x99c3bc=typeof _0x4d1e42[_0xf720('0x22')]==='undefined'&&typeof _0x4d1e42[_0xf720('0x23')]===_0xf720('0x24');var _0x37b6d2=_0x1197be[_0xf720('0x25')];var _0x381fd1=_0x99c3bc?0x0:_0x4d1e42[_0xf720('0x22')];var _0x5f1337=_0x99c3bc?_0x1197be['count']:_0x4d1e42[_0xf720('0x22')]+_0x4d1e42[_0xf720('0x23')];var _0x199c37;if(_0x5f1337>=_0x37b6d2){_0x5f1337=_0x37b6d2;_0x199c37=0xc8;}else{_0x199c37=0xce;}_0x26a54e[_0xf720('0x1f')](_0x199c37);return _0x26a54e['set'](_0xf720('0x26'),_0x381fd1+'-'+_0x5f1337+'/'+_0x37b6d2)[_0xf720('0x21')](_0x1197be);}return null;};}function patchUpdates(_0x5c714d){return function(_0x14ecfe){try{jsonpatch[_0xf720('0x27')](_0x14ecfe,_0x5c714d,!![]);}catch(_0x5bdf61){return BPromise['reject'](_0x5bdf61);}return _0x14ecfe['save']();};}function saveUpdates(_0x8b05bf,_0x425154){return function(_0x26dbac){if(_0x26dbac){return _0x26dbac[_0xf720('0x28')](_0x8b05bf)['then'](function(_0xdff07f){return _0xdff07f;});}return null;};}function removeEntity(_0x50dc69,_0xeb15e7){return function(_0x36f225){if(_0x36f225){return _0x36f225[_0xf720('0x29')]()[_0xf720('0x2a')](function(){_0x50dc69[_0xf720('0x1f')](0xcc)[_0xf720('0x20')]();});}};}function handleEntityNotFound(_0xf703e4,_0x13d07f){return function(_0x2dd57e){if(!_0x2dd57e){_0xf703e4[_0xf720('0x1e')](0x194);}return _0x2dd57e;};}function handleError(_0x5d46d6,_0x267e84){_0x267e84=_0x267e84||0x1f4;return function(_0x2d2572){logger[_0xf720('0x2b')](_0x2d2572[_0xf720('0x2c')]);if(_0x2d2572[_0xf720('0x2d')]){delete _0x2d2572['name'];}_0x5d46d6[_0xf720('0x1f')](_0x267e84)[_0xf720('0x2e')](_0x2d2572);};}function getInteractionUsers(_0x4a15e9,_0xef3879){return new BPromise(function(_0x3216c5,_0x3524bd){try{if(_0xef3879[_0x4a15e9['id']]){_0x4a15e9[_0xf720('0x2f')]=_[_0xf720('0x30')](_0xef3879[_0x4a15e9['id']],function(_0x37eccc){return{'id':_0x37eccc['id'],'fullname':_0x37eccc[_0xf720('0x31')]};});}}catch(_0x59b02d){_0x3524bd(_0x59b02d);}_0x3216c5(_0x4a15e9);});}function getInteractionTags(_0x158771,_0x219ccd){return new BPromise(function(_0x4c1b36,_0x5de892){try{if(_0x158771[_0xf720('0x32')]){_0x158771[_0xf720('0x33')]=[];_0x158771[_0xf720('0x32')][_0xf720('0x34')](',')[_0xf720('0x35')](function(_0x2f6cfd){_0x158771[_0xf720('0x33')]['push'](_0x219ccd[_0x2f6cfd]);});}delete _0x158771['TagIds'];}catch(_0x3a2899){_0x5de892(_0x3a2899);}_0x4c1b36(_0x158771);});}function updateSmsInteraction(_0x1cbb3c,_0x156327,_0xfb33d0){return new BPromise(function(_0x1ed2e6,_0x5cf1ee){return getInteractionUsers(_0x1cbb3c,_0xfb33d0)[_0xf720('0x2a')](function(_0x38e8ac){return getInteractionTags(_0x38e8ac,_0x156327);})[_0xf720('0x2a')](function(_0xc1ed8){return getStateInteraction(_0xc1ed8);})[_0xf720('0x2a')](function(_0x3d7bc4){_0x1ed2e6(_0x3d7bc4);})[_0xf720('0x36')](function(_0x1db4e3){_0x5cf1ee(_0x1db4e3);});});}function getStateInteraction(_0x17ba2f){return new BPromise(function(_0x16c039){_0x17ba2f['waiting']=0x0;_0x17ba2f[_0xf720('0x37')]=0x0;_0x17ba2f[_0xf720('0x38')]=0x0;_0x17ba2f[_0xf720('0x39')]=0x0;_0x17ba2f[_0xf720('0x3a')]=0x0;if(!_0x17ba2f['closed']&&!_0x17ba2f[_0xf720('0x3b')]){_0x17ba2f['waiting']+=0x1;}if(!_0x17ba2f['closed']&&_0x17ba2f[_0xf720('0x3b')]){_0x17ba2f[_0xf720('0x37')]+=0x1;if(_0x17ba2f['waiting']){_0x17ba2f[_0xf720('0x3c')]-=0x1;}}if(_0x17ba2f[_0xf720('0x3d')]&&_0x17ba2f[_0xf720('0x3b')]){_0x17ba2f[_0xf720('0x38')]+=0x1;if(_0x17ba2f[_0xf720('0x37')]){_0x17ba2f['talking']-=0x1;}}if(_0x17ba2f[_0xf720('0x3d')]&&!_0x17ba2f[_0xf720('0x3b')]){_0x17ba2f[_0xf720('0x39')]+=0x1;if(_0x17ba2f[_0xf720('0x3c')]){_0x17ba2f[_0xf720('0x3c')]-=0x1;}}_0x17ba2f[_0xf720('0x3a')]+=0x1;_0x16c039(_0x17ba2f);});}exports[_0xf720('0x3e')]=function(_0x429f75,_0x59b485){var _0x256786={},_0x233e02={},_0xb61de2={'count':0x0,'rows':[]};var _0x5a661e=_['map'](db[_0xf720('0x3f')][_0xf720('0x40')],function(_0x1a440a){return{'name':_0x1a440a['fieldName'],'type':_0x1a440a[_0xf720('0x41')][_0xf720('0x42')]};});_0x233e02[_0xf720('0x43')]=_[_0xf720('0x30')](_0x5a661e,_0xf720('0x2d'));_0x233e02['query']=_[_0xf720('0x44')](_0x429f75[_0xf720('0x45')]);_0x233e02[_0xf720('0x46')]=_[_0xf720('0x47')](_0x233e02['model'],_0x233e02[_0xf720('0x45')]);_0x256786[_0xf720('0x48')]=_[_0xf720('0x47')](_0x233e02[_0xf720('0x43')],qs['fields'](_0x429f75['query'][_0xf720('0x49')]));_0x256786[_0xf720('0x48')]=_0x256786[_0xf720('0x48')]['length']?_0x256786[_0xf720('0x48')]:_0x233e02['model'];if(!_0x429f75[_0xf720('0x45')][_0xf720('0x4a')](_0xf720('0x4b'))){_0x256786[_0xf720('0x23')]=qs['limit'](_0x429f75[_0xf720('0x45')]['limit']);_0x256786[_0xf720('0x22')]=qs[_0xf720('0x22')](_0x429f75[_0xf720('0x45')]['offset']);}_0x256786[_0xf720('0x4c')]=qs['sort'](_0x429f75[_0xf720('0x45')]['sort']);_0x256786[_0xf720('0x4d')]=qs['filters'](_['pick'](_0x429f75['query'],_0x233e02[_0xf720('0x46')]),_0x5a661e);var _0x703813=[];var _0x3fc97d=squel['select']()['field']('id')['field']('name')[_0xf720('0x4e')](_0xf720('0x4f'))[_0xf720('0x50')](_0xf720('0x51'));var _0x58df53=squel['select']()['field'](_0xf720('0x52'))[_0xf720('0x4e')](_0xf720('0x53'))[_0xf720('0x4e')]('ui.SmsInteractionId')[_0xf720('0x50')](_0xf720('0x54'),'ui')[_0xf720('0x55')](_0xf720('0x56'),'u',_0xf720('0x57'));var _0x4c3576=squel[_0xf720('0x58')]()[_0xf720('0x50')](_0xf720('0x59'),'i')['left_join'](_0xf720('0x5a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf720('0x55')](_0xf720('0x56'),'o',_0xf720('0x5b'))[_0xf720('0x55')]('sms_accounts','a',_0xf720('0x5c'))[_0xf720('0x55')](_0xf720('0x5d'),'me','me.SmsInteractionId\x20=\x20i.id')[_0xf720('0x55')](_0xf720('0x5e'),'it',_0xf720('0x5f'))[_0xf720('0x55')](_0xf720('0x51'),'t',_0xf720('0x60'));var _0x39ee74=squel[_0xf720('0x61')]();var _0x32adf1=[];var _0x55053d=squel[_0xf720('0x61')]();var _0x219bc3;if(_0x429f75[_0xf720('0x45')][_0xf720('0x62')]){_0x219bc3=as[_0xf720('0x63')](_0x429f75[_0xf720('0x45')][_0xf720('0x62')]);var _0x5ffd87=_0x219bc3[_0xf720('0x64')];for(var _0x1b8bfb=0x0;_0x1b8bfb<_0x219bc3[_0xf720('0x65')][_0xf720('0x66')];_0x1b8bfb++){var _0x3ca69d=_0x219bc3[_0xf720('0x65')][_0x1b8bfb];var _0x261d7a='i';var _0x3eb270=_[_0xf720('0x67')](_0x5a661e,['name',_0x3ca69d[_0xf720('0x4e')]]);if(!_0x3eb270){switch(_0x3ca69d[_0xf720('0x4e')]){case _0xf720('0x68'):if(_0x3ca69d['value']==0x1){_0x4c3576[_0xf720('0x69')]('`'+_0x3ca69d[_0xf720('0x4e')]+_0xf720('0x6a'));}else{_0x4c3576[_0xf720('0x69')]('`'+_0x3ca69d[_0xf720('0x4e')]+_0xf720('0x6b'));}break;case'Contact':if(_0x3ca69d[_0xf720('0x6c')]===_0xf720('0x6d')){if(_0x3ca69d['value'][_0xf720('0x34')]('\x20')['length']>0x1){_0x39ee74[_0x5ffd87](_0xf720('0x6e'),qs[_0xf720('0x6f')](_0x3ca69d[_0xf720('0x70')]),null);}else{var _0x4b72ab='%'+_0x3ca69d[_0xf720('0x70')]+'%';_0x39ee74[_0x5ffd87](_0xf720('0x71'),_0x4b72ab,_0x4b72ab,_0x4b72ab);}}else{_0x3eb270=_[_0xf720('0x67')](_0x5a661e,[_0xf720('0x2d'),'ContactId']);_0x3ca69d[_0xf720('0x4e')]=_0xf720('0x72');_0x1ac771=as[_0xf720('0x73')](_0x261d7a,_0x3eb270[_0xf720('0x41')],_0x3ca69d);_0x39ee74[_0x5ffd87](_0x1ac771['text'],_0x1ac771[_0xf720('0x70')]['start'],_0x1ac771[_0xf720('0x70')][_0xf720('0x20')]);}break;case _0xf720('0x74'):var _0x1f0496=_0x3ca69d[_0xf720('0x70')][_0xf720('0x34')](',')['map'](function(_0x33b035){return Number(_0x33b035);});_0x1f0496['forEach'](function(_0x241279){_0x55053d['or'](_0xf720('0x75'),'%,'+_0x241279+',%');});_0x32adf1=_['union'](_0x32adf1,_0x1f0496);break;case _0xf720('0x76'):if(_0x3ca69d[_0xf720('0x6c')]==='$substring'){_0x39ee74[_0x5ffd87]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3ca69d[_0xf720('0x70')]+'%',null);}else{_0x3eb270=_[_0xf720('0x67')](_0x5a661e,['name',_0xf720('0x3b')]);_0x3ca69d['field']=_0xf720('0x3b');_0x1ac771=as[_0xf720('0x73')](_0x261d7a,_0x3eb270[_0xf720('0x41')],_0x3ca69d);_0x39ee74[_0x5ffd87](_0x1ac771[_0xf720('0x77')],_0x1ac771[_0xf720('0x70')]['start'],_0x1ac771[_0xf720('0x70')][_0xf720('0x20')]);}break;case _0xf720('0x78'):_0x1ac771=as[_0xf720('0x73')]('me',null,_0x3ca69d);_0x39ee74[_0x5ffd87](_0x1ac771[_0xf720('0x77')],_0x1ac771[_0xf720('0x70')][_0xf720('0x79')],_0x1ac771[_0xf720('0x70')][_0xf720('0x20')]);break;}}else{var _0x1ac771=as[_0xf720('0x73')](_0x261d7a,_0x3eb270[_0xf720('0x41')],_0x3ca69d);_0x39ee74[_0x5ffd87](_0x1ac771[_0xf720('0x77')],_0x1ac771[_0xf720('0x70')][_0xf720('0x79')],_0x1ac771[_0xf720('0x70')][_0xf720('0x20')]);}}}else{var _0x2de7e9=_(_0x429f75[_0xf720('0x45')])[_0xf720('0x44')]()[_0xf720('0x30')](function(_0x265c1a){return _[_0xf720('0x7a')](_0x5a661e,[_0xf720('0x2d'),_0x265c1a])?_0x265c1a:undefined;})[_0xf720('0x7b')]()['value']();if(!_[_0xf720('0x7c')](_0x2de7e9)){_0x2de7e9['forEach'](function(_0x5dd0e2){if(_0x5dd0e2===_0xf720('0x7d')){_0x4c3576[_0xf720('0x4d')](_0xf720('0x7e'),[][_0xf720('0x7f')](_0x429f75[_0xf720('0x45')][_0x5dd0e2]));}else if(_0x5dd0e2===_0xf720('0x80')){var _0x222ece=JSON[_0xf720('0x81')](_0x429f75[_0xf720('0x45')][_0x5dd0e2])[_0xf720('0x82')];var _0xbc19a=JSON[_0xf720('0x81')](_0x429f75[_0xf720('0x45')][_0x5dd0e2])[_0xf720('0x83')];_0x4c3576[_0xf720('0x4d')](_0xf720('0x84'),_0x222ece,_0xbc19a);}else{if(_0x429f75[_0xf720('0x45')][_0x5dd0e2]===_0xf720('0x85')){_0x4c3576[_0xf720('0x4d')]('i.'+_0x5dd0e2+'\x20IS\x20NULL');}else{_0x4c3576[_0xf720('0x4d')]('i.'+_0x5dd0e2+_0xf720('0x86'),_0x429f75[_0xf720('0x45')][_0x5dd0e2]);}}});}if(_0x429f75[_0xf720('0x45')][_0xf720('0x87')]){if(_0x429f75[_0xf720('0x45')][_0xf720('0x87')]==0x1){_0x4c3576[_0xf720('0x69')](_0xf720('0x88'));}else{_0x4c3576[_0xf720('0x69')](_0xf720('0x89'));}}if(_0x429f75[_0xf720('0x45')][_0xf720('0x8a')]){_0x32adf1=_[_0xf720('0x8b')](_0x429f75['query'][_0xf720('0x8a')])?_0x429f75[_0xf720('0x45')][_0xf720('0x8a')]:new Array(_0x429f75['query'][_0xf720('0x8a')]);_0x32adf1['forEach'](function(_0x576303){_0x55053d['or'](_0xf720('0x75'),'%,'+_0x576303+',%');});}if(_0x429f75[_0xf720('0x45')][_0xf720('0x8c')]){var _0x3fecb9=_0x429f75['query'][_0xf720('0x8c')][_0xf720('0x8d')]('\x5c','\x5c\x5c')[_0xf720('0x8d')](/'/g,'\x27\x27');if(qs[_0xf720('0x8e')](_0x3fecb9)){_0x39ee74['or']('i.id\x20LIKE\x20?',_0x3fecb9+'%')['or'](_0xf720('0x8f'),_0x3fecb9+'%');}else{_0x39ee74['or'](_0xf720('0x90'),qs[_0xf720('0x6f')](_0x3fecb9))['or'](_0xf720('0x91'),_0x3fecb9+'%');}}}_0x4c3576[_0xf720('0x4d')](_0x39ee74);_0x4c3576['group'](_0xf720('0x92'));var _0x42f924={'type':db[_0xf720('0x93')][_0xf720('0x94')][_0xf720('0x95')],'raw':!![]};var _0x79af0c=_0x4c3576[_0xf720('0x96')]();_0x79af0c[_0xf720('0x4e')](_0xf720('0x92'));_0x79af0c[_0xf720('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf720('0x68'));if(_0x256786[_0xf720('0x4c')]){_0x256786[_0xf720('0x4c')][_0xf720('0x35')](function(_0x1928b7){var _0x5e12bb=_0x1928b7[0x0]===_0xf720('0x97')?_0x1928b7[0x0]:'i.'+_0x1928b7[0x0];_0x4c3576['order'](_0x5e12bb,_0x1928b7[0x1]===_0xf720('0x98')?![]:!![]);});}if(!_[_0xf720('0x7c')](_0x32adf1)){_0x4c3576[_0xf720('0x69')](_0x55053d);_0x79af0c[_0xf720('0x4d')](_0xf720('0x99'),_0x32adf1);}BPromise[_0xf720('0x9a')]()[_0xf720('0x2a')](function(){if(!_0x219bc3){if(_0x429f75[_0xf720('0x45')]['SmsAccountId'])return;_0x79af0c['where'](_0xf720('0x9b'));_0x4c3576[_0xf720('0x4d')](_0xf720('0x9b'));return;}if(_0x429f75[_0xf720('0x9c')][_0xf720('0x9d')]!==_0xf720('0x9e'))return;return _0x429f75[_0xf720('0x9c')][_0xf720('0x9f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x590473){if(_['isEmpty'](_0x590473)){_0x79af0c[_0xf720('0x4d')](_0xf720('0xa0'));_0x4c3576[_0xf720('0x4d')](_0xf720('0xa0'));}else{_0x79af0c[_0xf720('0x4d')](_0xf720('0x7e'),_[_0xf720('0x30')](_0x590473,'id'));_0x4c3576[_0xf720('0x4d')](_0xf720('0x7e'),_[_0xf720('0x30')](_0x590473,'id'));}});})[_0xf720('0x2a')](function(){if(_0x429f75['user'][_0xf720('0x9d')]===_0xf720('0x9e')&&!_0x219bc3&&!_0x429f75['query'][_0xf720('0x7d')])return[];return db[_0xf720('0xa1')][_0xf720('0x45')](_0x79af0c[_0xf720('0xa2')](),_0x42f924);})[_0xf720('0x2a')](function(_0x39ebd8){_0xb61de2['count']=_0x39ebd8['length'];if(_0xb61de2[_0xf720('0x25')]===0x0)return[];return db[_0xf720('0xa1')][_0xf720('0x45')](_0x3fc97d['toString'](),_0x42f924)[_0xf720('0x2a')](function(_0x348b0d){_0x703813=_[_0xf720('0xa3')](_0x348b0d,'id');_0x42f924=_[_0xf720('0xa4')](_0x42f924,{'model':db[_0xf720('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x429f75[_0xf720('0x45')][_0xf720('0x49')]){_0x256786[_0xf720('0x48')][_0xf720('0x35')](function(_0x1a3865){_0x4c3576[_0xf720('0x4e')]('i.'+_0x1a3865);});}else{_0x4c3576[_0xf720('0x4e')](_0xf720('0xa5'),'unreadMessages');_0x4c3576[_0xf720('0x4e')](_0xf720('0xa6'),_0xf720('0xa7'));_0x4c3576[_0xf720('0x4e')]('a.mandatoryDisposition',_0xf720('0xa8'));_0x4c3576[_0xf720('0x4e')]('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',_0xf720('0x97'));_0x4c3576[_0xf720('0x4e')]('i.*');_0x4c3576[_0xf720('0x4e')](_0xf720('0xa9'),'Contact.firstName');_0x4c3576[_0xf720('0x4e')](_0xf720('0xaa'),_0xf720('0xab'));_0x4c3576[_0xf720('0x4e')](_0xf720('0xac'),_0xf720('0xad'));_0x4c3576['field'](_0xf720('0xae'),_0xf720('0xaf'));_0x4c3576[_0xf720('0x4e')](_0xf720('0xb0'),_0xf720('0xb1'));_0x4c3576[_0xf720('0x4e')](_0xf720('0xb2'),_0xf720('0xb3'));_0x4c3576[_0xf720('0x4e')](_0xf720('0xb4'),'Owner.fullname');_0x4c3576[_0xf720('0x4e')](_0xf720('0xb5'),_0xf720('0xb6'));_0x4c3576['field'](_0xf720('0xb7'),_0xf720('0x32'));}if(_0x256786[_0xf720('0x23')])_0x4c3576[_0xf720('0x23')](_0x256786[_0xf720('0x23')]);if(_0x256786[_0xf720('0x22')])_0x4c3576[_0xf720('0x22')](_0x256786[_0xf720('0x22')]);return db[_0xf720('0xa1')][_0xf720('0x45')](_0x4c3576[_0xf720('0xa2')](),_0x42f924);})[_0xf720('0x2a')](function(_0x1a3026){if(_0x1a3026[_0xf720('0x66')]>0x0)_0x58df53[_0xf720('0x4d')](_0xf720('0xb8'),_[_0xf720('0x30')](_0x1a3026,'id'));return db[_0xf720('0xa1')]['query'](_0x58df53[_0xf720('0xa2')](),_0x42f924)[_0xf720('0x2a')](function(_0x294c6b){var _0x220659=_[_0xf720('0xb9')](_0x294c6b,_0xf720('0xba'));var _0x429b1b=[];_0x1a3026[_0xf720('0x35')](function(_0x42929f){_0x429b1b[_0xf720('0xbb')](updateSmsInteraction(_0x42929f,_0x703813,_0x220659));});return BPromise[_0xf720('0xbc')](_0x429b1b);});});})[_0xf720('0x2a')](function(_0x1e38ac){_0xb61de2[_0xf720('0xbd')]=_0x1e38ac;return _0xb61de2;})['then'](respondWithFilteredResult(_0x59b485,_0x256786))['catch'](handleError(_0x59b485,null));};exports[_0xf720('0xbe')]=function(_0x173485,_0x118142){var _0x411827={'raw':![],'where':{'id':_0x173485[_0xf720('0xbf')]['id']}},_0x134127={};_0x134127[_0xf720('0x43')]=_[_0xf720('0x44')](db[_0xf720('0x3f')][_0xf720('0x40')]);_0x134127[_0xf720('0x45')]=_[_0xf720('0x44')](_0x173485[_0xf720('0x45')]);_0x134127[_0xf720('0x46')]=_[_0xf720('0x47')](_0x134127['model'],_0x134127[_0xf720('0x45')]);_0x411827[_0xf720('0x48')]=_[_0xf720('0x47')](_0x134127['model'],qs[_0xf720('0x49')](_0x173485[_0xf720('0x45')][_0xf720('0x49')]));_0x411827[_0xf720('0x48')]=_0x411827[_0xf720('0x48')][_0xf720('0x66')]?_0x411827['attributes']:_0x134127[_0xf720('0x43')];if(_0x173485[_0xf720('0x45')]['includeAll']){_0x411827[_0xf720('0xc0')]=[{'all':!![]}];}_0x411827=_[_0xf720('0xa4')]({},_0x411827,_0x173485['options']);return db[_0xf720('0x3f')]['find'](_0x411827)[_0xf720('0x2a')](handleEntityNotFound(_0x118142,null))[_0xf720('0x2a')](respondWithResult(_0x118142,null))['catch'](handleError(_0x118142,null));};exports[_0xf720('0xc1')]=function(_0x5e9bf2,_0x29c9d5){return db[_0xf720('0x3f')][_0xf720('0xc1')](_0x5e9bf2['body'],{})[_0xf720('0x2a')](respondWithResult(_0x29c9d5,0xc9))[_0xf720('0x36')](handleError(_0x29c9d5,null));};exports['update']=function(_0x360f5d,_0x4e3a84){if(_0x360f5d[_0xf720('0x78')]['id']){delete _0x360f5d[_0xf720('0x78')]['id'];}return db[_0xf720('0x3f')][_0xf720('0x67')]({'where':{'id':_0x360f5d[_0xf720('0xbf')]['id']}})[_0xf720('0x2a')](handleEntityNotFound(_0x4e3a84,null))[_0xf720('0x2a')](saveUpdates(_0x360f5d[_0xf720('0x78')],null))[_0xf720('0x2a')](respondWithResult(_0x4e3a84,null))[_0xf720('0x36')](handleError(_0x4e3a84,null));};exports[_0xf720('0x29')]=function(_0x512ce4,_0x1d34d0){return db['SmsInteraction'][_0xf720('0x67')]({'where':{'id':_0x512ce4[_0xf720('0xbf')]['id']}})[_0xf720('0x2a')](handleEntityNotFound(_0x1d34d0,null))[_0xf720('0x2a')](removeEntity(_0x1d34d0,null))[_0xf720('0x36')](handleError(_0x1d34d0,null));};exports[_0xf720('0xc2')]=function(_0x3a50fa,_0x58b3d9){return db[_0xf720('0x3f')][_0xf720('0xc2')]()[_0xf720('0x2a')](respondWithResult(_0x58b3d9,null))[_0xf720('0x36')](handleError(_0x58b3d9,null));};exports[_0xf720('0xc3')]=function(_0x4cf758,_0x4c0355,_0x311d4e){return db[_0xf720('0xc4')][_0xf720('0x67')]({'where':{'id':_0x4cf758[_0xf720('0xbf')]['id']}})['then'](handleEntityNotFound(_0x4c0355,null))['then'](function(_0x1972e9){if(_0x1972e9){return _0x1972e9[_0xf720('0xc3')](_0x4cf758[_0xf720('0x78')][_0xf720('0xc5')],_[_0xf720('0xc6')](_0x4cf758[_0xf720('0x78')],[_0xf720('0xc5'),'id'])||{});}})[_0xf720('0x2a')](respondWithResult(_0x4c0355,null))[_0xf720('0x36')](handleError(_0x4c0355,null));};exports['getMessages']=function(_0xfd8211,_0x441557,_0x96be40){var _0x33b33f={'raw':![],'where':{}};var _0x2979cb={};var _0x28bf4f={'count':0x0,'rows':[]};return db[_0xf720('0x3f')][_0xf720('0xc7')]({'where':{'id':_0xfd8211['params']['id']}})['then'](handleEntityNotFound(_0x441557,null))['then'](function(_0x5c8949){if(_0x5c8949){_0x2979cb[_0xf720('0x43')]=_[_0xf720('0x44')](db[_0xf720('0xc4')][_0xf720('0x40')]);_0x2979cb[_0xf720('0x45')]=_[_0xf720('0x44')](_0xfd8211[_0xf720('0x45')]);_0x2979cb[_0xf720('0x46')]=_['intersection'](_0x2979cb[_0xf720('0x43')],_0x2979cb['query']);_0x33b33f['attributes']=_[_0xf720('0x47')](_0x2979cb[_0xf720('0x43')],qs[_0xf720('0x49')](_0xfd8211['query'][_0xf720('0x49')]));_0x33b33f['attributes']=_0x33b33f['attributes'][_0xf720('0x66')]?_0x33b33f[_0xf720('0x48')]:_0x2979cb[_0xf720('0x43')];if(!_0xfd8211[_0xf720('0x45')][_0xf720('0x4a')]('nolimit')){_0x33b33f[_0xf720('0x23')]=qs['limit'](_0xfd8211[_0xf720('0x45')]['limit']);_0x33b33f['offset']=qs[_0xf720('0x22')](_0xfd8211[_0xf720('0x45')][_0xf720('0x22')]);}_0x33b33f[_0xf720('0x4c')]=qs[_0xf720('0xc8')](_0xfd8211[_0xf720('0x45')]['sort']);_0x33b33f[_0xf720('0x4d')]=qs[_0xf720('0x46')](_['pick'](_0xfd8211[_0xf720('0x45')],_0x2979cb['filters']));_0x33b33f[_0xf720('0x4d')][_0xf720('0xba')]=_0x5c8949['id'];if(_0xfd8211[_0xf720('0x45')][_0xf720('0x8c')]){_0x33b33f[_0xf720('0x4d')]=_[_0xf720('0xa4')](_0x33b33f[_0xf720('0x4d')],{'$or':_['map'](_0x33b33f[_0xf720('0x48')],function(_0x66cee6){var _0x516014={};_0x516014[_0x66cee6]={'$like':'%'+_0xfd8211[_0xf720('0x45')]['filter']+'%'};return _0x516014;})});}if(_0xfd8211[_0xf720('0x45')][_0xf720('0x82')]){var _0x34de4c=_0xfd8211[_0xf720('0x45')]['$gte'][_0xf720('0x34')](',');var _0x5ab583={};_0x5ab583[_0x34de4c[0x0]]={'$gte':moment(_0x34de4c[0x1])[_0xf720('0xc9')](_0xf720('0xca'))};_0x33b33f[_0xf720('0x4d')]=_[_0xf720('0xa4')](_0x33b33f[_0xf720('0x4d')],_0x5ab583);}_0x33b33f=_[_0xf720('0xa4')]({},_0x33b33f,_0xfd8211[_0xf720('0xcb')]);return db[_0xf720('0xc4')]['count']({'where':_0x33b33f[_0xf720('0x4d')]})[_0xf720('0x2a')](function(_0xa0ce76){_0x28bf4f[_0xf720('0x25')]=_0xa0ce76;if(_0xfd8211[_0xf720('0x45')][_0xf720('0xcc')]){_0x33b33f[_0xf720('0xc0')]=[{'all':!![]}];}return db[_0xf720('0xc4')][_0xf720('0xcd')](_0x33b33f);})['then'](function(_0x3a0ccf){_0x28bf4f[_0xf720('0xbd')]=_0x3a0ccf;return _0x28bf4f;});}})[_0xf720('0x2a')](respondWithFilteredResult(_0x441557,_0x33b33f))['catch'](handleError(_0x441557,null));};exports[_0xf720('0xce')]=function(_0x14cb28,_0x4a2be1,_0x2f38d3){return db[_0xf720('0x3f')]['find']({'where':{'id':_0x14cb28[_0xf720('0xbf')]['id']}})['then'](handleEntityNotFound(_0x4a2be1,null))[_0xf720('0x2a')](function(_0x3da4e7){if(_0x3da4e7){return _0x3da4e7[_0xf720('0xcf')](_0x14cb28[_0xf720('0x78')][_0xf720('0xc5')],_[_0xf720('0xc6')](_0x14cb28[_0xf720('0x78')],['ids','id'])||{})[_0xf720('0xd0')](function(){return db['Tag'][_0xf720('0xcd')]({'attributes':['id',_0xf720('0x2d'),_0xf720('0x4f')],'where':{'id':_0x14cb28[_0xf720('0x78')][_0xf720('0xc5')]}});})[_0xf720('0x2a')](function(_0x2ce7e0){socket[_0xf720('0xd1')](_0xf720('0xd2'),{'id':Number(_0x14cb28[_0xf720('0xbf')]['id']),'tags':_0x2ce7e0||[]});return{'id':Number(_0x14cb28[_0xf720('0xbf')]['id']),'tags':_0x2ce7e0||[]};});}})['then'](respondWithResult(_0x4a2be1,null))[_0xf720('0x36')](handleError(_0x4a2be1,null));};exports[_0xf720('0xd3')]=function(_0x1fd739,_0x306336,_0x3abb5d){return db['SmsInteraction'][_0xf720('0x67')]({'where':{'id':_0x1fd739[_0xf720('0xbf')]['id']}})[_0xf720('0x2a')](handleEntityNotFound(_0x306336,null))[_0xf720('0x2a')](function(_0x20377b){if(_0x20377b){return _0x20377b[_0xf720('0xd3')](_0x1fd739[_0xf720('0x45')][_0xf720('0xc5')]);}})[_0xf720('0x2a')](respondWithStatusCode(_0x306336,null))['catch'](handleError(_0x306336,null));};exports['download']=function(_0x173f3a,_0x17e3ea){var _0x27245b=moment()[_0xf720('0xd4')]()['toString']();var _0x3170b3=path['join'](config[_0xf720('0xd5')],'server',_0xf720('0xd6'),'tmp');var _0x5884d8=path[_0xf720('0xd7')](config[_0xf720('0xd5')],_0xf720('0xd8'),_0xf720('0xd6'),_0xf720('0xd9'));var _0x3cb32e=path['join'](_0x3170b3,_0x27245b);var _0xc4d28e=util[_0xf720('0xc9')](_0xf720('0xda'),_0x173f3a[_0xf720('0xbf')]['id'],_0x27245b);var _0x10fca9=path[_0xf720('0xd7')](_0x3170b3,_0xc4d28e);var _0x5cf2e2=[];_0x5cf2e2['push']({'model':db[_0xf720('0x76')],'as':_0xf720('0x76'),'attributes':['id','fullname'],'raw':!![]});_0x5cf2e2['push']({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0xf720('0xdb')],'raw':!![]});var _0x429487=[{'model':db[_0xf720('0xc4')],'as':_0xf720('0xdc'),'attributes':['id',_0xf720('0x78'),_0xf720('0x80'),_0xf720('0xdd'),_0xf720('0xde'),_0xf720('0x87')],'include':_0x5cf2e2}];_0x429487[_0xf720('0xbb')]({'model':db[_0xf720('0xdf')],'as':_0xf720('0xe0'),'attributes':['id',_0xf720('0x2d')]});_0x429487[_0xf720('0xbb')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db[_0xf720('0x3f')][_0xf720('0x67')]({'where':{'id':_0x173f3a[_0xf720('0xbf')]['id']},'include':_0x429487})['then'](handleEntityNotFound(_0x17e3ea,null))[_0xf720('0x2a')](function(_0x3c93ae){if(_0x3c93ae){var _0x50d030=_0x3c93ae['get']({'plain':!![]});fs['mkdirSync'](_0x3cb32e);var _0x4de0d4={'channel':_0xf720('0xe1'),'account':_0x50d030[_0xf720('0xe0')][_0xf720('0x2d')],'agent':_0x50d030[_0xf720('0xe2')]?_0x50d030[_0xf720('0xe2')][_0xf720('0x31')]:_0xf720('0xe3'),'createdAt':moment(_0x50d030[_0xf720('0x80')])[_0xf720('0xc9')](_0xf720('0xca'))[_0xf720('0xa2')](),'closedAt':_0x50d030['closed']?moment(_0x50d030[_0xf720('0xe4')])[_0xf720('0xc9')](_0xf720('0xca'))['toString']():'','disposition':_0x50d030['disposition'],'messages':_(_0x50d030[_0xf720('0xdc')])[_0xf720('0x8c')]({'secret':![]})[_0xf720('0x30')](function(_0x38423f){return{'date':moment(_0x38423f[_0xf720('0x80')])[_0xf720('0xc9')](_0xf720('0xca'))[_0xf720('0xa2')](),'sender':_0x38423f['direction']===_0xf720('0xe5')?_0x38423f['User']?_0x38423f[_0xf720('0x76')]['fullname']:_0xf720('0xe6'):_0x38423f[_0xf720('0xe7')][_0xf720('0xe8')]+(_0x38423f['Contact']['lastName']?'\x20'+_0x38423f['Contact'][_0xf720('0xdb')]:''),'body':_0x38423f[_0xf720('0x78')],'direction':_0x38423f[_0xf720('0xdd')]==='out'?'A':'C','secret':_0x38423f[_0xf720('0xde')],'read':_0x38423f['read']};})[_0xf720('0x70')]()};return ejs['renderFile'](path['join'](config['root'],'server',_0xf720('0xe9'),_0xf720('0xea')),{'interaction':_0x4de0d4})[_0xf720('0x2a')](function(_0x55b530){var _0x34c312=path[_0xf720('0xd7')](_0x3cb32e,'transcript-'+_0x50d030['id']+'-'+_0x27245b+_0xf720('0xeb'));var _0x5ed1e1={'path':_0x34c312,'channel':_0xf720('0xe1'),'interactionId':_0x50d030['id']};return pdf[_0xf720('0xec')](_0x55b530,_0x5ed1e1);})['then'](function(){return new BPromise(function(_0x294006,_0x3ca96f){zipdir(_0x3cb32e,{'saveTo':_0x10fca9},function(_0x17b336,_0x34f91a){if(_0x17b336)return _0x3ca96f(_0x17b336);return _0x294006(_0x34f91a);});})[_0xf720('0x2a')](function(){return new BPromise(function(_0x8a955,_0x57f8a2){rimraf(_0x3cb32e,function(_0x5915dc){if(_0x5915dc)_0x57f8a2(_0x5915dc);return _0x8a955();});});})[_0xf720('0x2a')](function(){return _0x17e3ea[_0xf720('0xed')](_0x10fca9,_0xc4d28e,function(_0x17f28b){if(_0x17f28b){console[_0xf720('0xee')]('err',_0x17f28b);}else{fs['unlinkSync'](_0x10fca9);}});});});}else{return _0x17e3ea[_0xf720('0x1e')](0xc8);}})[_0xf720('0x36')](handleError(_0x17e3ea,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 92cf5f8..683e278 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 _0x7916=['Users','findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','SmsInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers'];(function(_0x11c3c1,_0xc0550a){var _0x1d2b75=function(_0xb63b31){while(--_0xb63b31){_0x11c3c1['push'](_0x11c3c1['shift']());}};_0x1d2b75(++_0xc0550a);}(_0x7916,0x128));var _0x6791=function(_0xc98be6,_0x4befae){_0xc98be6=_0xc98be6-0x0;var _0x57b80b=_0x7916[_0xc98be6];return _0x57b80b;};'use strict';var EventEmitter=require(_0x6791('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x6791('0x1')];var SmsMessage=require(_0x6791('0x2'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x6791('0x3')](0x0);var events={'afterCreate':_0x6791('0x4'),'afterUpdate':_0x6791('0x5'),'afterDestroy':_0x6791('0x6')};function emitEvent(_0x5e6303){return function(_0xe98396,_0x5a5726,_0x3ca328){_0xe98396[_0x6791('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x8b85ff){_0xe98396['setDataValue'](_0x6791('0x8'),_0x8b85ff['map'](function(_0x4ef65f){return{'id':_0x4ef65f['id']};}));return SmsMessage[_0x6791('0x9')]({'where':{'SmsInteractionId':_0xe98396['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6791('0xa')](function(_0x579950){_0xe98396[_0x6791('0xb')](_0x6791('0xc'),_0x579950[_0x6791('0xd')]);SmsInteractionEvents['emit'](_0x5e6303+':'+_0xe98396['id'],_0xe98396);SmsInteractionEvents[_0x6791('0xe')](_0x5e6303,_0xe98396);_0x3ca328(null);})[_0x6791('0xf')](_0x3ca328(null));};}for(var e in events){if(events[_0x6791('0x10')](e)){var event=events[e];SmsInteraction[_0x6791('0x11')](e,emitEvent(event));}}module[_0x6791('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0x8952=['Users','map','findAll','unreadMessages','catch','hasOwnProperty','hook','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','update','remove','getUsers','setDataValue'];(function(_0x2d59b1,_0x310c38){var _0x133690=function(_0x220cde){while(--_0x220cde){_0x2d59b1['push'](_0x2d59b1['shift']());}};_0x133690(++_0x310c38);}(_0x8952,0x17e));var _0x2895=function(_0x4e9c40,_0x32d8ce){_0x4e9c40=_0x4e9c40-0x0;var _0x385e9f=_0x8952[_0x4e9c40];return _0x385e9f;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x2895('0x0'))['db'][_0x2895('0x1')];var SmsMessage=require(_0x2895('0x0'))['db'][_0x2895('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x2895('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2895('0x4'),'afterDestroy':_0x2895('0x5')};function emitEvent(_0x1f69f6){return function(_0x5b28c6,_0x32429c,_0x73c245){_0x5b28c6[_0x2895('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x526c32){_0x5b28c6[_0x2895('0x7')](_0x2895('0x8'),_0x526c32[_0x2895('0x9')](function(_0x294446){return{'id':_0x294446['id']};}));return SmsMessage[_0x2895('0xa')]({'where':{'SmsInteractionId':_0x5b28c6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x14fb67){_0x5b28c6['setDataValue'](_0x2895('0xb'),_0x14fb67['length']);SmsInteractionEvents['emit'](_0x1f69f6+':'+_0x5b28c6['id'],_0x5b28c6);SmsInteractionEvents['emit'](_0x1f69f6,_0x5b28c6);_0x73c245(null);})[_0x2895('0xc')](_0x73c245(null));};}for(var e in events){if(events[_0x2895('0xd')](e)){var event=events[e];SmsInteraction[_0x2895('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index b4e62ba..59b8e67 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 _0x2c2c=['sms_interactions','changed','closed','format','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x2c2c,0x74));var _0xc2c2=function(_0xf7f1d9,_0x21d983){_0xf7f1d9=_0xf7f1d9-0x0;var _0x5bdce0=_0x2c2c[_0xf7f1d9];return _0x5bdce0;};'use strict';var _=require(_0xc2c2('0x0'));var util=require(_0xc2c2('0x1'));var logger=require('../../config/logger')(_0xc2c2('0x2'));var moment=require(_0xc2c2('0x3'));var BPromise=require(_0xc2c2('0x4'));var rp=require(_0xc2c2('0x5'));var fs=require('fs');var path=require(_0xc2c2('0x6'));var rimraf=require(_0xc2c2('0x7'));var config=require(_0xc2c2('0x8'));var attributes=require(_0xc2c2('0x9'));module[_0xc2c2('0xa')]=function(_0xe69dc,_0x5e2623){return _0xe69dc['define'](_0xc2c2('0xb'),attributes,{'tableName':_0xc2c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x586849,_0x4704d3,_0x128605){if(_0x586849[_0xc2c2('0xd')](_0xc2c2('0xe'))){_0x586849['closedAt']=moment()[_0xc2c2('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x128605(null,_0x586849);}}});}; \ No newline at end of file +var _0xd356=['exports','define','SmsInteraction','sms_interactions','changed','closed','format','lodash','util','api','moment','../../config/environment'];(function(_0x489df9,_0x5d63b8){var _0x1f2679=function(_0x4de304){while(--_0x4de304){_0x489df9['push'](_0x489df9['shift']());}};_0x1f2679(++_0x5d63b8);}(_0xd356,0x13f));var _0x6d35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd356[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6d35('0x0'));var util=require(_0x6d35('0x1'));var logger=require('../../config/logger')(_0x6d35('0x2'));var moment=require(_0x6d35('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6d35('0x4'));var attributes=require('./smsInteraction.attributes');module[_0x6d35('0x5')]=function(_0xe843b5,_0x459828){return _0xe843b5[_0x6d35('0x6')](_0x6d35('0x7'),attributes,{'tableName':_0x6d35('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b732e,_0x373b5d,_0x39df48){if(_0x5b732e[_0x6d35('0x9')](_0x6d35('0xa'))){_0x5b732e['closedAt']=moment()[_0x6d35('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x39df48(null,_0x5b732e);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 9a2c5b8..b107610 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 _0x6953=['result','catch','SmsInteraction','update','options','where','attributes','limit','UpdateSmsInteraction','addTags','body','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message'];(function(_0x81697e,_0x552c16){var _0x1f6e36=function(_0x2a6bbd){while(--_0x2a6bbd){_0x81697e['push'](_0x81697e['shift']());}};_0x1f6e36(++_0x552c16);}(_0x6953,0x19f));var _0x3695=function(_0x51b022,_0x5795c1){_0x51b022=_0x51b022-0x0;var _0x3cd35b=_0x6953[_0x51b022];return _0x3cd35b;};'use strict';var _=require(_0x3695('0x0'));var util=require('util');var moment=require(_0x3695('0x1'));var BPromise=require('bluebird');var rs=require(_0x3695('0x2'));var fs=require('fs');var Redis=require(_0x3695('0x3'));var db=require(_0x3695('0x4'))['db'];var utils=require(_0x3695('0x5'));var logger=require(_0x3695('0x6'))('rpc');var config=require(_0x3695('0x7'));var jayson=require(_0x3695('0x8'));var client=jayson[_0x3695('0x9')]['http']({'port':0x232a});config[_0x3695('0xa')]=_[_0x3695('0xb')](config[_0x3695('0xa')],{'host':_0x3695('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')[_0x3695('0xd')](socket);function respondWithRpcPromise(_0x7e3c47,_0x4dff27,_0x6f5885){return new BPromise(function(_0x2eb84c,_0x52e5b5){return client[_0x3695('0xe')](_0x7e3c47,_0x6f5885)[_0x3695('0xf')](function(_0x2cf69a){logger[_0x3695('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x4dff27,_0x3695('0x11'));logger[_0x3695('0x12')](_0x3695('0x13'),_0x4dff27,'request\x20sent',JSON[_0x3695('0x14')](_0x2cf69a));if(_0x2cf69a[_0x3695('0x15')]){if(_0x2cf69a[_0x3695('0x15')][_0x3695('0x16')]===0x1f4){logger[_0x3695('0x15')](_0x3695('0x17'),_0x4dff27,_0x2cf69a['error'][_0x3695('0x18')]);return _0x52e5b5(_0x2cf69a[_0x3695('0x15')]['message']);}logger[_0x3695('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x4dff27,_0x2cf69a['error']['message']);return _0x2eb84c(_0x2cf69a['error'][_0x3695('0x18')]);}else{logger[_0x3695('0x10')](_0x3695('0x17'),_0x4dff27,_0x3695('0x11'));_0x2eb84c(_0x2cf69a[_0x3695('0x19')][_0x3695('0x18')]);}})[_0x3695('0x1a')](function(_0x2a6b7a){logger[_0x3695('0x15')](_0x3695('0x17'),_0x4dff27,_0x2a6b7a);_0x52e5b5(_0x2a6b7a);});});}exports['UpdateSmsInteraction']=function(_0x5325fe){var _0x33dbb6=this;return new Promise(function(_0x32527c,_0x4c7075){return db[_0x3695('0x1b')][_0x3695('0x1c')](_0x5325fe['body'],{'raw':_0x5325fe[_0x3695('0x1d')]?_0x5325fe[_0x3695('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5325fe[_0x3695('0x1d')]?_0x5325fe[_0x3695('0x1d')][_0x3695('0x1e')]||null:null,'attributes':_0x5325fe[_0x3695('0x1d')]?_0x5325fe[_0x3695('0x1d')][_0x3695('0x1f')]||null:null,'limit':_0x5325fe[_0x3695('0x1d')]?_0x5325fe[_0x3695('0x1d')][_0x3695('0x20')]||null:null})[_0x3695('0xf')](function(_0x523d9c){logger[_0x3695('0x10')](_0x3695('0x21'),_0x5325fe);logger['debug'](_0x3695('0x21'),_0x5325fe,JSON[_0x3695('0x14')](_0x523d9c));_0x32527c(_0x523d9c);})[_0x3695('0x1a')](function(_0x418f2f){logger[_0x3695('0x15')]('UpdateSmsInteraction',_0x418f2f[_0x3695('0x18')],_0x5325fe);_0x4c7075(_0x33dbb6[_0x3695('0x15')](0x1f4,_0x418f2f[_0x3695('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x43dc73){return new Promise(function(_0x285958,_0x37b74e){return db[_0x3695('0x1b')]['find']({'where':_0x43dc73['options']?_0x43dc73[_0x3695('0x1d')][_0x3695('0x1e')]||null:null})['then'](function(_0xa841e7){if(_0xa841e7){return _0xa841e7[_0x3695('0x22')](_0x43dc73[_0x3695('0x23')][_0x3695('0x24')],_[_0x3695('0x25')](_0x43dc73[_0x3695('0x23')],['ids','id'])||{});}})[_0x3695('0x26')](function(_0xf9d7cd){logger[_0x3695('0x10')](_0x3695('0x27'),_0x43dc73);logger['debug']('AddTags',_0x43dc73,JSON[_0x3695('0x14')](_0xf9d7cd));_0x285958(_0xf9d7cd);})[_0x3695('0x1a')](function(_0x43fa11){logger[_0x3695('0x15')](_0x3695('0x27'),_0x43fa11[_0x3695('0x18')],_0x43dc73);_0x37b74e(_this[_0x3695('0x15')](0x1f4,_0x43fa11[_0x3695('0x18')]));});});}; \ No newline at end of file +var _0x46c0=['update','body','options','where','attributes','limit','AddTagsToSmsInteraction','SmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x46c0,0x11c));var _0x046c=function(_0x451f88,_0x5c061a){_0x451f88=_0x451f88-0x0;var _0x2cc2b7=_0x46c0[_0x451f88];return _0x2cc2b7;};'use strict';var _=require(_0x046c('0x0'));var util=require(_0x046c('0x1'));var moment=require(_0x046c('0x2'));var BPromise=require(_0x046c('0x3'));var rs=require(_0x046c('0x4'));var fs=require('fs');var Redis=require(_0x046c('0x5'));var db=require(_0x046c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x046c('0x7'))(_0x046c('0x8'));var config=require(_0x046c('0x9'));var jayson=require(_0x046c('0xa'));var client=jayson[_0x046c('0xb')][_0x046c('0xc')]({'port':0x232a});config[_0x046c('0xd')]=_['defaults'](config[_0x046c('0xd')],{'host':_0x046c('0xe'),'port':0x18eb});var socket=require(_0x046c('0xf'))(new Redis(config[_0x046c('0xd')]));require(_0x046c('0x10'))['register'](socket);function respondWithRpcPromise(_0x1fb4b0,_0x13b5c1,_0x28a1d2){return new BPromise(function(_0x5f34b4,_0x242157){return client[_0x046c('0x11')](_0x1fb4b0,_0x28a1d2)[_0x046c('0x12')](function(_0x116887){logger[_0x046c('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x13b5c1,_0x046c('0x14'));logger[_0x046c('0x15')](_0x046c('0x16'),_0x13b5c1,_0x046c('0x14'),JSON[_0x046c('0x17')](_0x116887));if(_0x116887[_0x046c('0x18')]){if(_0x116887[_0x046c('0x18')][_0x046c('0x19')]===0x1f4){logger[_0x046c('0x18')](_0x046c('0x1a'),_0x13b5c1,_0x116887[_0x046c('0x18')]['message']);return _0x242157(_0x116887[_0x046c('0x18')][_0x046c('0x1b')]);}logger['error'](_0x046c('0x1a'),_0x13b5c1,_0x116887[_0x046c('0x18')][_0x046c('0x1b')]);return _0x5f34b4(_0x116887[_0x046c('0x18')][_0x046c('0x1b')]);}else{logger[_0x046c('0x13')](_0x046c('0x1a'),_0x13b5c1,_0x046c('0x14'));_0x5f34b4(_0x116887[_0x046c('0x1c')][_0x046c('0x1b')]);}})[_0x046c('0x1d')](function(_0x42ff8c){logger['error'](_0x046c('0x1a'),_0x13b5c1,_0x42ff8c);_0x242157(_0x42ff8c);});});}exports[_0x046c('0x1e')]=function(_0x3e0ff9){var _0x33c008=this;return new Promise(function(_0x23f5b2,_0x2eeed6){return db['SmsInteraction'][_0x046c('0x1f')](_0x3e0ff9[_0x046c('0x20')],{'raw':_0x3e0ff9[_0x046c('0x21')]?_0x3e0ff9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e0ff9[_0x046c('0x21')]?_0x3e0ff9['options'][_0x046c('0x22')]||null:null,'attributes':_0x3e0ff9[_0x046c('0x21')]?_0x3e0ff9[_0x046c('0x21')][_0x046c('0x23')]||null:null,'limit':_0x3e0ff9[_0x046c('0x21')]?_0x3e0ff9[_0x046c('0x21')][_0x046c('0x24')]||null:null})['then'](function(_0x3ae37f){logger[_0x046c('0x13')](_0x046c('0x1e'),_0x3e0ff9);logger[_0x046c('0x15')]('UpdateSmsInteraction',_0x3e0ff9,JSON[_0x046c('0x17')](_0x3ae37f));_0x23f5b2(_0x3ae37f);})[_0x046c('0x1d')](function(_0x4c6bb0){logger[_0x046c('0x18')]('UpdateSmsInteraction',_0x4c6bb0[_0x046c('0x1b')],_0x3e0ff9);_0x2eeed6(_0x33c008[_0x046c('0x18')](0x1f4,_0x4c6bb0[_0x046c('0x1b')]));});});};exports[_0x046c('0x25')]=function(_0x27c8a9){return new Promise(function(_0x163a45,_0x52c927){return db[_0x046c('0x26')][_0x046c('0x27')]({'where':_0x27c8a9[_0x046c('0x21')]?_0x27c8a9[_0x046c('0x21')][_0x046c('0x22')]||null:null})[_0x046c('0x12')](function(_0x5c1957){if(_0x5c1957){return _0x5c1957[_0x046c('0x28')](_0x27c8a9['body'][_0x046c('0x29')],_[_0x046c('0x2a')](_0x27c8a9['body'],['ids','id'])||{});}})[_0x046c('0x2b')](function(_0x599cea){logger[_0x046c('0x13')]('AddTags',_0x27c8a9);logger['debug'](_0x046c('0x2c'),_0x27c8a9,JSON['stringify'](_0x599cea));_0x163a45(_0x599cea);})[_0x046c('0x1d')](function(_0x3ef182){logger[_0x046c('0x18')](_0x046c('0x2c'),_0x3ef182[_0x046c('0x1b')],_0x27c8a9);_0x52c927(_this[_0x046c('0x18')](0x1f4,_0x3ef182[_0x046c('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 28b7741..7f5efa2 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 _0xaaa3=['./smsInteraction.events','save','remove','update','emit','removeListener','register','smsInteraction:'];(function(_0x30410c,_0x57b067){var _0x29a684=function(_0x514ceb){while(--_0x514ceb){_0x30410c['push'](_0x30410c['shift']());}};_0x29a684(++_0x57b067);}(_0xaaa3,0xc0));var _0x3aaa=function(_0x34f697,_0xac092f){_0x34f697=_0x34f697-0x0;var _0x1096fe=_0xaaa3[_0x34f697];return _0x1096fe;};'use strict';var SmsInteractionEvents=require(_0x3aaa('0x0'));var events=[_0x3aaa('0x1'),_0x3aaa('0x2'),_0x3aaa('0x3')];function createListener(_0x2b2e98,_0x3d346a){return function(_0x571665){_0x3d346a[_0x3aaa('0x4')](_0x2b2e98,_0x571665);};}function removeListener(_0x1c6f62,_0x26d6a0){return function(){SmsInteractionEvents[_0x3aaa('0x5')](_0x1c6f62,_0x26d6a0);};}exports[_0x3aaa('0x6')]=function(_0x329f97){for(var _0x489de4=0x0,_0x209d96=events['length'];_0x489de4<_0x209d96;_0x489de4++){var _0x4393de=events[_0x489de4];var _0xb6c1c8=createListener(_0x3aaa('0x7')+_0x4393de,_0x329f97);SmsInteractionEvents['on'](_0x4393de,_0xb6c1c8);}}; \ No newline at end of file +var _0x5ebd=['./smsInteraction.events','remove','emit','register','length','smsInteraction:'];(function(_0x4b39e8,_0x46721d){var _0x16e2c7=function(_0x4beeea){while(--_0x4beeea){_0x4b39e8['push'](_0x4b39e8['shift']());}};_0x16e2c7(++_0x46721d);}(_0x5ebd,0x120));var _0xd5eb=function(_0x39d698,_0x461786){_0x39d698=_0x39d698-0x0;var _0x4ef8d3=_0x5ebd[_0x39d698];return _0x4ef8d3;};'use strict';var SmsInteractionEvents=require(_0xd5eb('0x0'));var events=['save',_0xd5eb('0x1'),'update'];function createListener(_0x2105a9,_0x33c650){return function(_0x55e257){_0x33c650[_0xd5eb('0x2')](_0x2105a9,_0x55e257);};}function removeListener(_0x2a4911,_0x117907){return function(){SmsInteractionEvents['removeListener'](_0x2a4911,_0x117907);};}exports[_0xd5eb('0x3')]=function(_0xbe23cd){for(var _0x4276c9=0x0,_0x54d7c4=events[_0xd5eb('0x4')];_0x4276c9<_0x54d7c4;_0x4276c9++){var _0x44524b=events[_0x4276c9];var _0x58b2ce=createListener(_0xd5eb('0x5')+_0x44524b,_0xbe23cd);SmsInteractionEvents['on'](_0x44524b,_0x58b2ce);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 835808c..9d609c1 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 _0x9568=['index','get','/:id','show','tracked','sms','post','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','isAuthenticated'];(function(_0x51c440,_0x3b6802){var _0x67a2d6=function(_0x3d15ab){while(--_0x3d15ab){_0x51c440['push'](_0x51c440['shift']());}};_0x67a2d6(++_0x3b6802);}(_0x9568,0xc7));var _0x8956=function(_0x291167,_0x482eff){_0x291167=_0x291167-0x0;var _0x102c7b=_0x9568[_0x291167];return _0x102c7b;};'use strict';var multer=require(_0x8956('0x0'));var util=require(_0x8956('0x1'));var path=require(_0x8956('0x2'));var timeout=require(_0x8956('0x3'));var express=require(_0x8956('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8956('0x5'));var interaction=require(_0x8956('0x6'));var config=require('../../config/environment');var controller=require(_0x8956('0x7'));router['get']('/',auth[_0x8956('0x8')](),controller[_0x8956('0x9')]);router[_0x8956('0xa')]('/describe',auth[_0x8956('0x8')](),controller['describe']);router[_0x8956('0xa')](_0x8956('0xb'),auth[_0x8956('0x8')](),controller[_0x8956('0xc')]);router['post']('/',auth[_0x8956('0x8')](),interaction[_0x8956('0xd')](_0x8956('0xe'),'smsmessage:create'),controller['create']);router[_0x8956('0xf')]('/:id/status',controller[_0x8956('0x10')]);router[_0x8956('0x11')]('/:id',auth[_0x8956('0x8')](),controller[_0x8956('0x12')]);router[_0x8956('0x11')](_0x8956('0x13'),auth[_0x8956('0x8')](),controller[_0x8956('0x14')]);router[_0x8956('0x11')](_0x8956('0x15'),auth[_0x8956('0x8')](),controller[_0x8956('0x16')]);router[_0x8956('0x17')](_0x8956('0xb'),auth['isAuthenticated'](),controller[_0x8956('0x18')]);module[_0x8956('0x19')]=router; \ No newline at end of file +var _0x2697=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','smsmessage:create','status','put','update','accept','reject','delete'];(function(_0x874bc1,_0xc169fa){var _0x3b8ca5=function(_0x5b1884){while(--_0x5b1884){_0x874bc1['push'](_0x874bc1['shift']());}};_0x3b8ca5(++_0xc169fa);}(_0x2697,0x120));var _0x7269=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x2697[_0x2cfb58];return _0xd99951;};'use strict';var multer=require('multer');var util=require(_0x7269('0x0'));var path=require(_0x7269('0x1'));var timeout=require(_0x7269('0x2'));var express=require(_0x7269('0x3'));var router=express[_0x7269('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7269('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7269('0x6'));var controller=require(_0x7269('0x7'));router[_0x7269('0x8')]('/',auth[_0x7269('0x9')](),controller[_0x7269('0xa')]);router[_0x7269('0x8')](_0x7269('0xb'),auth[_0x7269('0x9')](),controller[_0x7269('0xc')]);router[_0x7269('0x8')](_0x7269('0xd'),auth['isAuthenticated'](),controller[_0x7269('0xe')]);router[_0x7269('0xf')]('/',auth['isAuthenticated'](),interaction[_0x7269('0x10')]('sms',_0x7269('0x11')),controller['create']);router[_0x7269('0xf')]('/:id/status',controller[_0x7269('0x12')]);router[_0x7269('0x13')](_0x7269('0xd'),auth['isAuthenticated'](),controller[_0x7269('0x14')]);router[_0x7269('0x13')]('/:id/accept',auth[_0x7269('0x9')](),controller[_0x7269('0x15')]);router[_0x7269('0x13')]('/:id/reject',auth[_0x7269('0x9')](),controller[_0x7269('0x16')]);router[_0x7269('0x17')](_0x7269('0xd'),auth[_0x7269('0x9')](),controller[_0x7269('0x18')]);module[_0x7269('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 f0f02d1..3b43842 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 _0x74c7=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT'];(function(_0x3989df,_0x457cb5){var _0x42f6b8=function(_0x3794c7){while(--_0x3794c7){_0x3989df['push'](_0x3989df['shift']());}};_0x42f6b8(++_0x457cb5);}(_0x74c7,0x8e));var _0x774c=function(_0x5f3b1f,_0x6edd16){_0x5f3b1f=_0x5f3b1f-0x0;var _0x48d96d=_0x74c7[_0x5f3b1f];return _0x48d96d;};'use strict';var Sequelize=require(_0x774c('0x0'));module['exports']={'body':{'type':Sequelize[_0x774c('0x1')](_0x774c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x774c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x774c('0x4')]('in',_0x774c('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x774c('0x6')](0xbe)},'phone':{'type':Sequelize[_0x774c('0x6')]},'readAt':{'type':Sequelize[_0x774c('0x7')]},'secret':{'type':Sequelize[_0x774c('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x774c('0x1')]}}; \ No newline at end of file +var _0xd45e=['STRING','DATE','exports','TEXT','BOOLEAN','out'];(function(_0x311c37,_0x286efb){var _0x58593e=function(_0x355dc4){while(--_0x355dc4){_0x311c37['push'](_0x311c37['shift']());}};_0x58593e(++_0x286efb);}(_0xd45e,0x182));var _0xed45=function(_0x1bd8a3,_0x59993e){_0x1bd8a3=_0x1bd8a3-0x0;var _0x2d675a=_0xd45e[_0x1bd8a3];return _0x2d675a;};'use strict';var Sequelize=require('sequelize');module[_0xed45('0x0')]={'body':{'type':Sequelize[_0xed45('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xed45('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xed45('0x3')),'defaultValue':_0xed45('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xed45('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xed45('0x5')]},'secret':{'type':Sequelize[_0xed45('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index a43b30a..f0cc258 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 _0xdf5d=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','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','./smsMessage.socket','register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','json','offset','limit','undefined','count','apply','save','then','end','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','query','keys','model','fields','attributes','length','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','show','intersection','include','find','catch','create','body','destroy','params','sms-interactions','accept','sms','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','SmsInteraction','SmsInteractionId','update','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','User','interface','SIP/%s','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','contact','fullname','email','channel','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','Status','plivio','infobip','results','groupName','DELIVERED'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_0xdf5d,0x126));var _0xddf5=function(_0x2e5372,_0xe72f6e){_0x2e5372=_0x2e5372-0x0;var _0x4da14d=_0xdf5d[_0x2e5372];return _0x4da14d;};'use strict';var emlformat=require(_0xddf5('0x0'));var rimraf=require(_0xddf5('0x1'));var zipdir=require(_0xddf5('0x2'));var jsonpatch=require(_0xddf5('0x3'));var rp=require(_0xddf5('0x4'));var moment=require(_0xddf5('0x5'));var BPromise=require(_0xddf5('0x6'));var Mustache=require(_0xddf5('0x7'));var util=require('util');var path=require(_0xddf5('0x8'));var sox=require(_0xddf5('0x9'));var csv=require(_0xddf5('0xa'));var ejs=require(_0xddf5('0xb'));var fs=require('fs');var fs_extra=require(_0xddf5('0xc'));var _=require(_0xddf5('0xd'));var squel=require(_0xddf5('0xe'));var crypto=require(_0xddf5('0xf'));var jsforce=require(_0xddf5('0x10'));var deskjs=require(_0xddf5('0x11'));var toCsv=require(_0xddf5('0xa'));var querystring=require(_0xddf5('0x12'));var Papa=require(_0xddf5('0x13'));var Redis=require(_0xddf5('0x14'));var authService=require(_0xddf5('0x15'));var qs=require(_0xddf5('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xddf5('0x17'));var logger=require(_0xddf5('0x18'))(_0xddf5('0x19'));var utils=require(_0xddf5('0x1a'));var config=require(_0xddf5('0x1b'));var licenseUtil=require(_0xddf5('0x1c'));var db=require(_0xddf5('0x1d'))['db'];config[_0xddf5('0x1e')]=_['defaults'](config['redis'],{'host':_0xddf5('0x1f'),'port':0x18eb});var socket=require(_0xddf5('0x20'))(new Redis(config[_0xddf5('0x1e')]));require(_0xddf5('0x21'))[_0xddf5('0x22')](socket);var jayson=require(_0xddf5('0x23'));var client=jayson[_0xddf5('0x24')][_0xddf5('0x25')]({'port':0x232c});var client9002=jayson['client'][_0xddf5('0x25')]({'port':0x232a});function respondWithRpcPromise(_0x2b2dad,_0x3dd408,_0x1c0c30,_0x19a039){return new BPromise(function(_0x5ef952,_0x3a9263){var _0x53afba=_0x19a039||client;return _0x53afba[_0xddf5('0x26')](_0x2b2dad,_0x1c0c30)['then'](function(_0x4b4f9a){logger[_0xddf5('0x27')](_0xddf5('0x28'),_0x3dd408,_0xddf5('0x29'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3dd408,_0xddf5('0x29'),JSON[_0xddf5('0x2a')](_0x4b4f9a));if(_0x4b4f9a[_0xddf5('0x2b')]){if(_0x4b4f9a[_0xddf5('0x2b')]['code']===0x1f4){logger['error'](_0xddf5('0x28'),_0x3dd408,_0x4b4f9a[_0xddf5('0x2b')][_0xddf5('0x2c')]);return _0x3a9263(_0x4b4f9a['error'][_0xddf5('0x2c')]);}logger[_0xddf5('0x2b')](_0xddf5('0x28'),_0x3dd408,_0x4b4f9a[_0xddf5('0x2b')]['message']);return _0x5ef952(_0x4b4f9a[_0xddf5('0x2b')][_0xddf5('0x2c')]);}else{logger['info'](_0xddf5('0x28'),_0x3dd408,_0xddf5('0x29'));_0x5ef952(_0x4b4f9a[_0xddf5('0x2d')][_0xddf5('0x2c')]);}})['catch'](function(_0x497382){logger[_0xddf5('0x2b')](_0xddf5('0x28'),_0x3dd408,_0x497382);_0x3a9263(_0x497382);});});}function respondWithStatusCode(_0x1eca6a,_0x99fd62){_0x99fd62=_0x99fd62||0xcc;return function(_0x4caa12){if(_0x4caa12){return _0x1eca6a[_0xddf5('0x2e')](_0x99fd62);}return _0x1eca6a[_0xddf5('0x2f')](_0x99fd62)['end']();};}function respondWithResult(_0x4821b7,_0x984d22){_0x984d22=_0x984d22||0xc8;return function(_0x45a53f){if(_0x45a53f){return _0x4821b7[_0xddf5('0x2f')](_0x984d22)[_0xddf5('0x30')](_0x45a53f);}};}function respondWithFilteredResult(_0x3be6f4,_0x1a476d){return function(_0x5a3548){if(_0x5a3548){var _0x26f43c=typeof _0x1a476d[_0xddf5('0x31')]==='undefined'&&typeof _0x1a476d[_0xddf5('0x32')]===_0xddf5('0x33');var _0x281307=_0x5a3548['count'];var _0x4b352b=_0x26f43c?0x0:_0x1a476d['offset'];var _0xdc764b=_0x26f43c?_0x5a3548[_0xddf5('0x34')]:_0x1a476d[_0xddf5('0x31')]+_0x1a476d['limit'];var _0x3d1c7a;if(_0xdc764b>=_0x281307){_0xdc764b=_0x281307;_0x3d1c7a=0xc8;}else{_0x3d1c7a=0xce;}_0x3be6f4['status'](_0x3d1c7a);return _0x3be6f4['set']('Content-Range',_0x4b352b+'-'+_0xdc764b+'/'+_0x281307)[_0xddf5('0x30')](_0x5a3548);}return null;};}function patchUpdates(_0x2faf35){return function(_0x2a4b2e){try{jsonpatch[_0xddf5('0x35')](_0x2a4b2e,_0x2faf35,!![]);}catch(_0x11cee5){return BPromise['reject'](_0x11cee5);}return _0x2a4b2e[_0xddf5('0x36')]();};}function saveUpdates(_0x53e916,_0x1434b7){return function(_0x1e4b04){if(_0x1e4b04){return _0x1e4b04['update'](_0x53e916)[_0xddf5('0x37')](function(_0x1fd693){return _0x1fd693;});}return null;};}function removeEntity(_0x22d01f,_0x431e53){return function(_0x141dd8){if(_0x141dd8){return _0x141dd8['destroy']()[_0xddf5('0x37')](function(){_0x22d01f['status'](0xcc)[_0xddf5('0x38')]();});}};}function handleEntityNotFound(_0x45a373,_0x50240c){return function(_0x1be090){if(!_0x1be090){_0x45a373['sendStatus'](0x194);}return _0x1be090;};}function handleError(_0x40bf1f,_0x4ae041){_0x4ae041=_0x4ae041||0x1f4;return function(_0x5982d3){logger[_0xddf5('0x2b')](_0x5982d3['stack']);if(_0x5982d3[_0xddf5('0x39')]){delete _0x5982d3[_0xddf5('0x39')];}_0x40bf1f[_0xddf5('0x2f')](_0x4ae041)[_0xddf5('0x3a')](_0x5982d3);};}exports[_0xddf5('0x3b')]=function(_0x3ff650,_0x10b7a7){var _0xffdecd={},_0x2605a3={},_0x337c87={'count':0x0,'rows':[]};var _0x28c525=_[_0xddf5('0x3c')](db[_0xddf5('0x3d')][_0xddf5('0x3e')],function(_0x485b67){return{'name':_0x485b67[_0xddf5('0x3f')],'type':_0x485b67[_0xddf5('0x40')][_0xddf5('0x41')]};});_0x2605a3['model']=_[_0xddf5('0x3c')](_0x28c525,_0xddf5('0x39'));_0x2605a3[_0xddf5('0x42')]=_[_0xddf5('0x43')](_0x3ff650[_0xddf5('0x42')]);_0x2605a3['filters']=_['intersection'](_0x2605a3['model'],_0x2605a3[_0xddf5('0x42')]);_0xffdecd['attributes']=_['intersection'](_0x2605a3[_0xddf5('0x44')],qs[_0xddf5('0x45')](_0x3ff650[_0xddf5('0x42')][_0xddf5('0x45')]));_0xffdecd[_0xddf5('0x46')]=_0xffdecd[_0xddf5('0x46')][_0xddf5('0x47')]?_0xffdecd[_0xddf5('0x46')]:_0x2605a3[_0xddf5('0x44')];if(!_0x3ff650[_0xddf5('0x42')]['hasOwnProperty']('nolimit')){_0xffdecd[_0xddf5('0x32')]=qs[_0xddf5('0x32')](_0x3ff650['query']['limit']);_0xffdecd[_0xddf5('0x31')]=qs[_0xddf5('0x31')](_0x3ff650[_0xddf5('0x42')][_0xddf5('0x31')]);}_0xffdecd['order']=qs['sort'](_0x3ff650[_0xddf5('0x42')][_0xddf5('0x48')]);_0xffdecd['where']=qs[_0xddf5('0x49')](_[_0xddf5('0x4a')](_0x3ff650['query'],_0x2605a3[_0xddf5('0x49')]),_0x28c525);if(_0x3ff650['query'][_0xddf5('0x4b')]){_0xffdecd[_0xddf5('0x4c')]=_[_0xddf5('0x4d')](_0xffdecd['where'],{'$or':_[_0xddf5('0x3c')](_0x28c525,function(_0x9a845e){if(_0x9a845e[_0xddf5('0x40')]!==_0xddf5('0x4e')){var _0x1127d6={};_0x1127d6[_0x9a845e[_0xddf5('0x39')]]={'$like':'%'+_0x3ff650['query'][_0xddf5('0x4b')]+'%'};return _0x1127d6;}})});}_0xffdecd=_[_0xddf5('0x4d')]({},_0xffdecd,_0x3ff650[_0xddf5('0x4f')]);var _0x4337b9={'where':_0xffdecd['where']};return db[_0xddf5('0x3d')][_0xddf5('0x34')](_0x4337b9)[_0xddf5('0x37')](function(_0x35b4f2){_0x337c87['count']=_0x35b4f2;if(_0x3ff650[_0xddf5('0x42')][_0xddf5('0x50')]){_0xffdecd['include']=[{'all':!![]}];}return db[_0xddf5('0x3d')]['findAll'](_0xffdecd);})[_0xddf5('0x37')](function(_0x2a2ca7){_0x337c87[_0xddf5('0x51')]=_0x2a2ca7;return _0x337c87;})[_0xddf5('0x37')](respondWithFilteredResult(_0x10b7a7,_0xffdecd))['catch'](handleError(_0x10b7a7,null));};exports[_0xddf5('0x52')]=function(_0x2e2844,_0x5e9ad7){var _0x259907={'raw':!![],'where':{'id':_0x2e2844['params']['id']}},_0x535ae4={};_0x535ae4[_0xddf5('0x44')]=_[_0xddf5('0x43')](db[_0xddf5('0x3d')][_0xddf5('0x3e')]);_0x535ae4[_0xddf5('0x42')]=_[_0xddf5('0x43')](_0x2e2844['query']);_0x535ae4[_0xddf5('0x49')]=_[_0xddf5('0x53')](_0x535ae4[_0xddf5('0x44')],_0x535ae4[_0xddf5('0x42')]);_0x259907['attributes']=_[_0xddf5('0x53')](_0x535ae4[_0xddf5('0x44')],qs['fields'](_0x2e2844[_0xddf5('0x42')][_0xddf5('0x45')]));_0x259907['attributes']=_0x259907[_0xddf5('0x46')]['length']?_0x259907[_0xddf5('0x46')]:_0x535ae4['model'];if(_0x2e2844['query']['includeAll']){_0x259907[_0xddf5('0x54')]=[{'all':!![]}];}_0x259907=_[_0xddf5('0x4d')]({},_0x259907,_0x2e2844[_0xddf5('0x4f')]);return db[_0xddf5('0x3d')][_0xddf5('0x55')](_0x259907)[_0xddf5('0x37')](handleEntityNotFound(_0x5e9ad7,null))[_0xddf5('0x37')](respondWithResult(_0x5e9ad7,null))[_0xddf5('0x56')](handleError(_0x5e9ad7,null));};exports[_0xddf5('0x57')]=function(_0x18e068,_0x57f2a4){return db[_0xddf5('0x3d')][_0xddf5('0x57')](_0x18e068[_0xddf5('0x58')],{})[_0xddf5('0x37')](respondWithResult(_0x57f2a4,0xc9))[_0xddf5('0x56')](handleError(_0x57f2a4,null));};exports['update']=function(_0x3d2df0,_0x522dd6){if(_0x3d2df0[_0xddf5('0x58')]['id']){delete _0x3d2df0[_0xddf5('0x58')]['id'];}return db['SmsMessage'][_0xddf5('0x55')]({'where':{'id':_0x3d2df0['params']['id']}})[_0xddf5('0x37')](handleEntityNotFound(_0x522dd6,null))['then'](saveUpdates(_0x3d2df0['body'],null))[_0xddf5('0x37')](respondWithResult(_0x522dd6,null))[_0xddf5('0x56')](handleError(_0x522dd6,null));};exports[_0xddf5('0x59')]=function(_0x45643e,_0xb62de0){return db[_0xddf5('0x3d')]['find']({'where':{'id':_0x45643e[_0xddf5('0x5a')]['id']}})[_0xddf5('0x37')](handleEntityNotFound(_0xb62de0,null))[_0xddf5('0x37')](removeEntity(_0xb62de0,null))[_0xddf5('0x56')](handleError(_0xb62de0,null));};exports['describe']=function(_0x282246,_0x137cd2){return db[_0xddf5('0x3d')]['describe']()[_0xddf5('0x37')](respondWithResult(_0x137cd2,null))[_0xddf5('0x56')](handleError(_0x137cd2,null));};var interaction_log=require(_0xddf5('0x18'))(_0xddf5('0x5b'));exports[_0xddf5('0x5c')]=function(_0x3c108a,_0x1d6ed0,_0x4112a7){var _0xc84b83={'agent':{},'channel':_0xddf5('0x5d')};if(_0x3c108a[_0xddf5('0x58')]['id']){delete _0x3c108a[_0xddf5('0x58')]['id'];}_0x3c108a[_0xddf5('0x58')]['read']=!![];_0x3c108a[_0xddf5('0x58')]['readAt']=moment()[_0xddf5('0x5e')](_0xddf5('0x5f'));_0x3c108a[_0xddf5('0x58')][_0xddf5('0x60')]=_0x3c108a[_0xddf5('0x58')][_0xddf5('0x60')]||_0x3c108a['user']['id'];_0xc84b83[_0xddf5('0x61')]['id']=_0x3c108a[_0xddf5('0x58')][_0xddf5('0x60')];return db[_0xddf5('0x3d')][_0xddf5('0x55')]({'where':{'id':_0x3c108a['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1d6ed0,null))[_0xddf5('0x37')](saveUpdates(_0x3c108a[_0xddf5('0x58')],null))[_0xddf5('0x37')](function(_0x1781a7){if(_0x1781a7){_0xc84b83['message']=_0x1781a7['get']({'plain':!![]});return db[_0xddf5('0x62')][_0xddf5('0x55')]({'where':{'id':_0x1781a7[_0xddf5('0x63')]}});}return null;})[_0xddf5('0x37')](handleEntityNotFound(_0x1d6ed0,null))[_0xddf5('0x37')](function(_0x1a006d){if(_0x1a006d){return _0x1a006d[_0xddf5('0x64')]({'UserId':_0x3c108a['body']['UserId'],'read1stAt':_['isNil'](_0x1a006d[_0xddf5('0x65')])?moment()[_0xddf5('0x5e')](_0xddf5('0x5f')):undefined});}return null;})[_0xddf5('0x37')](function(_0x1d0105){if(_0x1d0105){_0xc84b83[_0xddf5('0x66')]=_0x1d0105[_0xddf5('0x67')]({'plain':!![]});interaction_log['info'](_0xddf5('0x68'),_0x3c108a[_0xddf5('0x69')]['id'],_0x3c108a['user'][_0xddf5('0x39')],_0x3c108a[_0xddf5('0x69')][_0xddf5('0x6a')],_0xc84b83[_0xddf5('0x66')]['id'],_0x3c108a['body']?JSON[_0xddf5('0x2a')](_0x3c108a[_0xddf5('0x58')]):_0xddf5('0x6b'));return respondWithRpcPromise(_0xddf5('0x6c'),_0xddf5('0x6d'),_0xc84b83);}return null;})[_0xddf5('0x37')](function(_0x551666){var _0x20775e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x551666['message'][_0xddf5('0x6e')];return db['sequelize'][_0xddf5('0x42')](_0x20775e,{'type':db[_0xddf5('0x6f')][_0xddf5('0x70')][_0xddf5('0x71')],'raw':!![]})['then'](function(_0x2c58ee){return _0x2c58ee;});})[_0xddf5('0x37')](function(_0x184a49){if(_0x184a49){_0xc84b83[_0xddf5('0x2c')]['contact']=_0x184a49[0x0];if(!_0x3c108a[_0xddf5('0x58')]['UserId'])return;return db[_0xddf5('0x72')]['find']({'where':{'id':_0x3c108a[_0xddf5('0x58')][_0xddf5('0x60')],'role':_0xddf5('0x61')},'attributes':['id',_0xddf5('0x39'),'fullname','email','internal'],'raw':!![]});}return null;})[_0xddf5('0x37')](function(_0x468682){if(!_0x468682)return null;_0xc84b83[_0xddf5('0x2c')][_0xddf5('0x61')]=_0x468682;return _0xc84b83;})[_0xddf5('0x37')](function(_0x441ba8){if(_0x441ba8){if(_0x3c108a[_0xddf5('0x58')]['manual']){_0xc84b83[_0xddf5('0x2c')][_0xddf5('0x73')]=util['format'](_0xddf5('0x74'),_0x3c108a[_0xddf5('0x69')][_0xddf5('0x39')]);_0xc84b83[_0xddf5('0x2c')]['channel']=_0xc84b83['channel'];_0xc84b83['message'][_0xddf5('0x75')]=_0xc84b83['channel'];_0xc84b83['message'][_0xddf5('0x76')]=_0xddf5('0x5c');return respondWithRpcPromise(_0xddf5('0x77'),_0xddf5('0x77'),{'event':_0xddf5('0x78'),'message':_0xc84b83[_0xddf5('0x2c')]},client9002)[_0xddf5('0x37')](function(){return _0xc84b83;});}return _0xc84b83;}return null;})['then'](respondWithResult(_0x1d6ed0,null))['catch'](handleError(_0x1d6ed0,null));};var interaction_log=require(_0xddf5('0x18'))(_0xddf5('0x5b'));exports['reject']=function(_0x1e5481,_0x5962b4,_0x1a3b42){var _0x3bf028={'agent':{},'channel':'sms'};if(_0x1e5481['body']['id']){delete _0x1e5481[_0xddf5('0x58')]['id'];}_0x1e5481[_0xddf5('0x58')][_0xddf5('0x60')]=_0x1e5481[_0xddf5('0x58')][_0xddf5('0x60')]||_0x1e5481[_0xddf5('0x69')]['id'];_0x3bf028[_0xddf5('0x61')]['id']=_0x1e5481['body'][_0xddf5('0x60')];return db[_0xddf5('0x3d')][_0xddf5('0x55')]({'where':{'id':_0x1e5481['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5962b4,null))['then'](function(_0x57a830){if(_0x57a830){_0x3bf028[_0xddf5('0x2c')]=_0x57a830[_0xddf5('0x67')]({'plain':!![]});return db['SmsInteraction'][_0xddf5('0x55')]({'where':{'id':_0x57a830[_0xddf5('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x5962b4,null))[_0xddf5('0x37')](function(_0xedf2d){if(_0xedf2d){_0x3bf028[_0xddf5('0x66')]=_0xedf2d['get']({'plain':!![]});interaction_log[_0xddf5('0x27')](_0xddf5('0x79'),_0x1e5481['user']['id'],_0x1e5481[_0xddf5('0x69')][_0xddf5('0x39')],_0x1e5481[_0xddf5('0x69')][_0xddf5('0x6a')],_0x3bf028[_0xddf5('0x66')]['id'],_0x1e5481['body']?JSON[_0xddf5('0x2a')](_0x1e5481[_0xddf5('0x58')]):_0xddf5('0x6b'));return respondWithRpcPromise(_0xddf5('0x7a'),_0xddf5('0x7b'),_0x3bf028);}return null;})['then'](function(_0x10c8c9){var _0x5eed8b=_0xddf5('0x7c')+_0x10c8c9[_0xddf5('0x2c')][_0xddf5('0x6e')];return db[_0xddf5('0x7d')][_0xddf5('0x42')](_0x5eed8b,{'type':db[_0xddf5('0x6f')][_0xddf5('0x70')][_0xddf5('0x71')],'raw':!![]})[_0xddf5('0x37')](function(_0x1798f3){return _0x1798f3;});})[_0xddf5('0x37')](function(_0x443924){if(_0x443924){_0x3bf028[_0xddf5('0x2c')][_0xddf5('0x7e')]=_0x443924[0x0];if(!_0x1e5481['body'][_0xddf5('0x60')])return;return db['User'][_0xddf5('0x55')]({'where':{'id':_0x1e5481[_0xddf5('0x58')]['UserId'],'role':_0xddf5('0x61')},'attributes':['id','name',_0xddf5('0x7f'),_0xddf5('0x80'),'internal'],'raw':!![]});}return null;})['then'](function(_0x10bea0){if(!_0x10bea0)return null;_0x3bf028[_0xddf5('0x2c')][_0xddf5('0x61')]=_0x10bea0;return _0x3bf028;})[_0xddf5('0x37')](function(_0x25fb41){if(_0x25fb41){_0x25fb41[_0xddf5('0x2c')][_0xddf5('0x73')]=util[_0xddf5('0x5e')](_0xddf5('0x74'),_0x1e5481[_0xddf5('0x69')][_0xddf5('0x39')]);_0x25fb41[_0xddf5('0x2c')][_0xddf5('0x81')]=_0x3bf028[_0xddf5('0x81')];_0x25fb41['message'][_0xddf5('0x75')]=_0x3bf028[_0xddf5('0x81')];_0x25fb41[_0xddf5('0x2c')][_0xddf5('0x76')]='reject';respondWithRpcPromise(_0xddf5('0x77'),_0xddf5('0x77'),{'event':'rejectmessage','message':_0x25fb41[_0xddf5('0x2c')]},client9002);return _0x3bf028;}return null;})[_0xddf5('0x37')](respondWithResult(_0x5962b4,null))[_0xddf5('0x56')](handleError(_0x5962b4,null));};exports[_0xddf5('0x2f')]=function(_0x458cea,_0x46c199,_0x42a041){if(_0x458cea['body']['id']){delete _0x458cea[_0xddf5('0x58')]['id'];}var _0x38b1e4;return db[_0xddf5('0x3d')][_0xddf5('0x55')]({'where':{'id':_0x458cea['params']['id']}})['then'](handleEntityNotFound(_0x46c199,null))[_0xddf5('0x37')](function(_0x42cea6){if(_0x42cea6){_0x38b1e4=_0x42cea6;return db[_0xddf5('0x82')][_0xddf5('0x55')]({'where':{'id':_0x42cea6[_0xddf5('0x83')]}});}})['then'](handleEntityNotFound(_0x46c199,null))[_0xddf5('0x37')](function(_0x564979){if(_0x564979){logger['debug'](_0xddf5('0x84'),'status',_0xddf5('0x85'),_0x564979[_0xddf5('0x40')],util['inspect'](_0x458cea[_0xddf5('0x58')],{'showHidden':![],'depth':null}));switch(_0x564979[_0xddf5('0x40')]){case _0xddf5('0x86'):if(_0x458cea[_0xddf5('0x58')]['MessageSid']&&_0x458cea[_0xddf5('0x58')]['MessageSid']===_0x38b1e4[_0xddf5('0x87')]){return _0x38b1e4[_0xddf5('0x64')]({'read':!![]});}else{logger[_0xddf5('0x2b')](_0xddf5('0x88'),_0xddf5('0x2f'),_0xddf5('0x86'),util[_0xddf5('0x89')](_0x458cea[_0xddf5('0x58')],{'showHidden':![],'depth':null}));}break;case _0xddf5('0x8a'):if(_0x458cea[_0xddf5('0x58')]['MessageUUID']&&_0x458cea[_0xddf5('0x58')][_0xddf5('0x8b')]===_0x38b1e4[_0xddf5('0x87')]&&_[_0xddf5('0x8c')](['sent','delivered'],_0x458cea['body'][_0xddf5('0x8d')])>=0x0){return _0x38b1e4[_0xddf5('0x64')]({'read':!![]});}else{logger[_0xddf5('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xddf5('0x2f'),_0xddf5('0x8e'),util[_0xddf5('0x89')](_0x458cea[_0xddf5('0x58')],{'showHidden':![],'depth':null}));}break;case _0xddf5('0x8f'):var _0x18f896=_0x458cea[_0xddf5('0x58')][_0xddf5('0x90')][0x0];if(_0x18f896['status'][_0xddf5('0x91')]===_0xddf5('0x92')){return _0x38b1e4[_0xddf5('0x64')]({'read':!![]});}else{logger['error'](_0xddf5('0x88'),_0xddf5('0x2f'),_0xddf5('0x8f'),util[_0xddf5('0x89')](_0x458cea[_0xddf5('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x38b1e4;}})[_0xddf5('0x37')](respondWithResult(_0x46c199,null))[_0xddf5('0x56')](handleError(_0x46c199,null));}; \ No newline at end of file +var _0x930b=['then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','name','send','map','SmsMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','create','body','params','find','describe','sms-interactions','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','RejectMessage','rejectMessage','ContactId','sequelize','event','SmsAccount','SmsAccountId','inspect','type','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','infobip','groupName','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','request'];(function(_0x46bacf,_0x102fc9){var _0x41e653=function(_0x3e841e){while(--_0x3e841e){_0x46bacf['push'](_0x46bacf['shift']());}};_0x41e653(++_0x102fc9);}(_0x930b,0x106));var _0xb930=function(_0x46ca80,_0x275844){_0x46ca80=_0x46ca80-0x0;var _0x19b271=_0x930b[_0x46ca80];return _0x19b271;};'use strict';var emlformat=require(_0xb930('0x0'));var rimraf=require(_0xb930('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb930('0x2'));var rp=require(_0xb930('0x3'));var moment=require(_0xb930('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb930('0x5'));var path=require(_0xb930('0x6'));var sox=require(_0xb930('0x7'));var csv=require('to-csv');var ejs=require(_0xb930('0x8'));var fs=require('fs');var fs_extra=require(_0xb930('0x9'));var _=require(_0xb930('0xa'));var squel=require('squel');var crypto=require(_0xb930('0xb'));var jsforce=require(_0xb930('0xc'));var deskjs=require(_0xb930('0xd'));var toCsv=require(_0xb930('0xe'));var querystring=require(_0xb930('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb930('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb930('0x11'));var hardwareService=require(_0xb930('0x12'));var logger=require(_0xb930('0x13'))(_0xb930('0x14'));var utils=require(_0xb930('0x15'));var config=require(_0xb930('0x16'));var licenseUtil=require(_0xb930('0x17'));var db=require(_0xb930('0x18'))['db'];config['redis']=_['defaults'](config[_0xb930('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xb930('0x1a'))(new Redis(config[_0xb930('0x19')]));require('./smsMessage.socket')[_0xb930('0x1b')](socket);var jayson=require(_0xb930('0x1c'));var client=jayson[_0xb930('0x1d')][_0xb930('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xb930('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2631c9,_0x5d10fe,_0x2833b8,_0x4268e8){return new BPromise(function(_0x496aef,_0x191617){var _0x171e72=_0x4268e8||client;return _0x171e72[_0xb930('0x1f')](_0x2631c9,_0x2833b8)[_0xb930('0x20')](function(_0x1ad4f5){logger[_0xb930('0x21')](_0xb930('0x22'),_0x5d10fe,_0xb930('0x23'));logger[_0xb930('0x24')](_0xb930('0x25'),_0x5d10fe,_0xb930('0x23'),JSON['stringify'](_0x1ad4f5));if(_0x1ad4f5[_0xb930('0x26')]){if(_0x1ad4f5['error'][_0xb930('0x27')]===0x1f4){logger[_0xb930('0x26')](_0xb930('0x22'),_0x5d10fe,_0x1ad4f5[_0xb930('0x26')][_0xb930('0x28')]);return _0x191617(_0x1ad4f5['error'][_0xb930('0x28')]);}logger['error'](_0xb930('0x22'),_0x5d10fe,_0x1ad4f5['error'][_0xb930('0x28')]);return _0x496aef(_0x1ad4f5[_0xb930('0x26')][_0xb930('0x28')]);}else{logger[_0xb930('0x21')](_0xb930('0x22'),_0x5d10fe,_0xb930('0x23'));_0x496aef(_0x1ad4f5[_0xb930('0x29')]['message']);}})[_0xb930('0x2a')](function(_0x1fa805){logger[_0xb930('0x26')](_0xb930('0x22'),_0x5d10fe,_0x1fa805);_0x191617(_0x1fa805);});});}function respondWithStatusCode(_0x5ac173,_0x45f733){_0x45f733=_0x45f733||0xcc;return function(_0x56f524){if(_0x56f524){return _0x5ac173['sendStatus'](_0x45f733);}return _0x5ac173[_0xb930('0x2b')](_0x45f733)[_0xb930('0x2c')]();};}function respondWithResult(_0x2ab4c9,_0x2dadb3){_0x2dadb3=_0x2dadb3||0xc8;return function(_0x4b8c4f){if(_0x4b8c4f){return _0x2ab4c9[_0xb930('0x2b')](_0x2dadb3)[_0xb930('0x2d')](_0x4b8c4f);}};}function respondWithFilteredResult(_0x4f79ef,_0x248340){return function(_0x36ca4a){if(_0x36ca4a){var _0x3d45c2=typeof _0x248340[_0xb930('0x2e')]===_0xb930('0x2f')&&typeof _0x248340[_0xb930('0x30')]===_0xb930('0x2f');var _0x3bcec1=_0x36ca4a[_0xb930('0x31')];var _0x925ac6=_0x3d45c2?0x0:_0x248340['offset'];var _0x25a691=_0x3d45c2?_0x36ca4a[_0xb930('0x31')]:_0x248340[_0xb930('0x2e')]+_0x248340[_0xb930('0x30')];var _0x385c92;if(_0x25a691>=_0x3bcec1){_0x25a691=_0x3bcec1;_0x385c92=0xc8;}else{_0x385c92=0xce;}_0x4f79ef['status'](_0x385c92);return _0x4f79ef['set'](_0xb930('0x32'),_0x925ac6+'-'+_0x25a691+'/'+_0x3bcec1)['json'](_0x36ca4a);}return null;};}function patchUpdates(_0x535cb6){return function(_0x1c7e5a){try{jsonpatch[_0xb930('0x33')](_0x1c7e5a,_0x535cb6,!![]);}catch(_0x44a8b7){return BPromise[_0xb930('0x34')](_0x44a8b7);}return _0x1c7e5a[_0xb930('0x35')]();};}function saveUpdates(_0x3976f4,_0xbd1acb){return function(_0x131093){if(_0x131093){return _0x131093[_0xb930('0x36')](_0x3976f4)['then'](function(_0x12f106){return _0x12f106;});}return null;};}function removeEntity(_0x56e362,_0x10cd2c){return function(_0x8b168d){if(_0x8b168d){return _0x8b168d[_0xb930('0x37')]()[_0xb930('0x20')](function(){_0x56e362[_0xb930('0x2b')](0xcc)[_0xb930('0x2c')]();});}};}function handleEntityNotFound(_0x31caef,_0xcf567e){return function(_0x1f6bd7){if(!_0x1f6bd7){_0x31caef['sendStatus'](0x194);}return _0x1f6bd7;};}function handleError(_0x4b666f,_0x2491e1){_0x2491e1=_0x2491e1||0x1f4;return function(_0x3c45da){logger[_0xb930('0x26')](_0x3c45da['stack']);if(_0x3c45da[_0xb930('0x38')]){delete _0x3c45da[_0xb930('0x38')];}_0x4b666f['status'](_0x2491e1)[_0xb930('0x39')](_0x3c45da);};}exports['index']=function(_0x5496ce,_0x391186){var _0x38aa74={},_0x75b09b={},_0x4881c1={'count':0x0,'rows':[]};var _0x583516=_[_0xb930('0x3a')](db[_0xb930('0x3b')][_0xb930('0x3c')],function(_0x68f18b){return{'name':_0x68f18b[_0xb930('0x3d')],'type':_0x68f18b['type'][_0xb930('0x3e')]};});_0x75b09b[_0xb930('0x3f')]=_[_0xb930('0x3a')](_0x583516,_0xb930('0x38'));_0x75b09b['query']=_[_0xb930('0x40')](_0x5496ce[_0xb930('0x41')]);_0x75b09b[_0xb930('0x42')]=_[_0xb930('0x43')](_0x75b09b[_0xb930('0x3f')],_0x75b09b[_0xb930('0x41')]);_0x38aa74['attributes']=_[_0xb930('0x43')](_0x75b09b[_0xb930('0x3f')],qs['fields'](_0x5496ce[_0xb930('0x41')][_0xb930('0x44')]));_0x38aa74[_0xb930('0x45')]=_0x38aa74[_0xb930('0x45')][_0xb930('0x46')]?_0x38aa74[_0xb930('0x45')]:_0x75b09b[_0xb930('0x3f')];if(!_0x5496ce[_0xb930('0x41')][_0xb930('0x47')](_0xb930('0x48'))){_0x38aa74[_0xb930('0x30')]=qs[_0xb930('0x30')](_0x5496ce[_0xb930('0x41')]['limit']);_0x38aa74[_0xb930('0x2e')]=qs[_0xb930('0x2e')](_0x5496ce[_0xb930('0x41')][_0xb930('0x2e')]);}_0x38aa74['order']=qs[_0xb930('0x49')](_0x5496ce[_0xb930('0x41')][_0xb930('0x49')]);_0x38aa74[_0xb930('0x4a')]=qs[_0xb930('0x42')](_['pick'](_0x5496ce[_0xb930('0x41')],_0x75b09b[_0xb930('0x42')]),_0x583516);if(_0x5496ce[_0xb930('0x41')][_0xb930('0x4b')]){_0x38aa74[_0xb930('0x4a')]=_['merge'](_0x38aa74[_0xb930('0x4a')],{'$or':_[_0xb930('0x3a')](_0x583516,function(_0x344f2f){if(_0x344f2f['type']!==_0xb930('0x4c')){var _0x161a3e={};_0x161a3e[_0x344f2f['name']]={'$like':'%'+_0x5496ce[_0xb930('0x41')][_0xb930('0x4b')]+'%'};return _0x161a3e;}})});}_0x38aa74=_[_0xb930('0x4d')]({},_0x38aa74,_0x5496ce[_0xb930('0x4e')]);var _0x4ac807={'where':_0x38aa74[_0xb930('0x4a')]};return db[_0xb930('0x3b')][_0xb930('0x31')](_0x4ac807)[_0xb930('0x20')](function(_0x41094d){_0x4881c1[_0xb930('0x31')]=_0x41094d;if(_0x5496ce['query'][_0xb930('0x4f')]){_0x38aa74[_0xb930('0x50')]=[{'all':!![]}];}return db[_0xb930('0x3b')][_0xb930('0x51')](_0x38aa74);})[_0xb930('0x20')](function(_0x417d82){_0x4881c1[_0xb930('0x52')]=_0x417d82;return _0x4881c1;})[_0xb930('0x20')](respondWithFilteredResult(_0x391186,_0x38aa74))[_0xb930('0x2a')](handleError(_0x391186,null));};exports[_0xb930('0x53')]=function(_0x2b349d,_0x4c5b85){var _0x2c8fbe={'raw':!![],'where':{'id':_0x2b349d['params']['id']}},_0x30e498={};_0x30e498[_0xb930('0x3f')]=_[_0xb930('0x40')](db['SmsMessage'][_0xb930('0x3c')]);_0x30e498[_0xb930('0x41')]=_['keys'](_0x2b349d['query']);_0x30e498['filters']=_[_0xb930('0x43')](_0x30e498[_0xb930('0x3f')],_0x30e498['query']);_0x2c8fbe[_0xb930('0x45')]=_[_0xb930('0x43')](_0x30e498[_0xb930('0x3f')],qs[_0xb930('0x44')](_0x2b349d[_0xb930('0x41')]['fields']));_0x2c8fbe[_0xb930('0x45')]=_0x2c8fbe['attributes'][_0xb930('0x46')]?_0x2c8fbe[_0xb930('0x45')]:_0x30e498['model'];if(_0x2b349d[_0xb930('0x41')][_0xb930('0x4f')]){_0x2c8fbe[_0xb930('0x50')]=[{'all':!![]}];}_0x2c8fbe=_[_0xb930('0x4d')]({},_0x2c8fbe,_0x2b349d[_0xb930('0x4e')]);return db[_0xb930('0x3b')]['find'](_0x2c8fbe)[_0xb930('0x20')](handleEntityNotFound(_0x4c5b85,null))['then'](respondWithResult(_0x4c5b85,null))[_0xb930('0x2a')](handleError(_0x4c5b85,null));};exports['create']=function(_0x3e8870,_0x562a99){return db['SmsMessage'][_0xb930('0x54')](_0x3e8870[_0xb930('0x55')],{})['then'](respondWithResult(_0x562a99,0xc9))[_0xb930('0x2a')](handleError(_0x562a99,null));};exports[_0xb930('0x36')]=function(_0x59d4ea,_0x58b814){if(_0x59d4ea[_0xb930('0x55')]['id']){delete _0x59d4ea[_0xb930('0x55')]['id'];}return db[_0xb930('0x3b')]['find']({'where':{'id':_0x59d4ea[_0xb930('0x56')]['id']}})['then'](handleEntityNotFound(_0x58b814,null))[_0xb930('0x20')](saveUpdates(_0x59d4ea['body'],null))[_0xb930('0x20')](respondWithResult(_0x58b814,null))['catch'](handleError(_0x58b814,null));};exports[_0xb930('0x37')]=function(_0x699e4f,_0x32c435){return db[_0xb930('0x3b')][_0xb930('0x57')]({'where':{'id':_0x699e4f[_0xb930('0x56')]['id']}})[_0xb930('0x20')](handleEntityNotFound(_0x32c435,null))['then'](removeEntity(_0x32c435,null))['catch'](handleError(_0x32c435,null));};exports[_0xb930('0x58')]=function(_0x263b8e,_0x3c45a8){return db[_0xb930('0x3b')][_0xb930('0x58')]()[_0xb930('0x20')](respondWithResult(_0x3c45a8,null))[_0xb930('0x2a')](handleError(_0x3c45a8,null));};var interaction_log=require('../../config/logger')(_0xb930('0x59'));exports['accept']=function(_0x5a8d9b,_0x4c7779,_0xd917b3){var _0x47b7bf={'agent':{},'channel':_0xb930('0x5a')};if(_0x5a8d9b[_0xb930('0x55')]['id']){delete _0x5a8d9b[_0xb930('0x55')]['id'];}_0x5a8d9b[_0xb930('0x55')][_0xb930('0x5b')]=!![];_0x5a8d9b[_0xb930('0x55')][_0xb930('0x5c')]=moment()['format'](_0xb930('0x5d'));_0x5a8d9b[_0xb930('0x55')][_0xb930('0x5e')]=_0x5a8d9b['body']['UserId']||_0x5a8d9b[_0xb930('0x5f')]['id'];_0x47b7bf[_0xb930('0x60')]['id']=_0x5a8d9b[_0xb930('0x55')][_0xb930('0x5e')];return db[_0xb930('0x3b')]['find']({'where':{'id':_0x5a8d9b[_0xb930('0x56')]['id'],'UserId':null}})[_0xb930('0x20')](handleEntityNotFound(_0x4c7779,null))[_0xb930('0x20')](saveUpdates(_0x5a8d9b[_0xb930('0x55')],null))[_0xb930('0x20')](function(_0x411c6d){if(_0x411c6d){_0x47b7bf[_0xb930('0x28')]=_0x411c6d[_0xb930('0x61')]({'plain':!![]});return db[_0xb930('0x62')]['find']({'where':{'id':_0x411c6d[_0xb930('0x63')]}});}return null;})[_0xb930('0x20')](handleEntityNotFound(_0x4c7779,null))[_0xb930('0x20')](function(_0x17a0db){if(_0x17a0db){return _0x17a0db['update']({'UserId':_0x5a8d9b['body'][_0xb930('0x5e')],'read1stAt':_[_0xb930('0x64')](_0x17a0db[_0xb930('0x65')])?moment()[_0xb930('0x66')](_0xb930('0x5d')):undefined});}return null;})['then'](function(_0x1065ea){if(_0x1065ea){_0x47b7bf[_0xb930('0x67')]=_0x1065ea[_0xb930('0x61')]({'plain':!![]});interaction_log[_0xb930('0x21')](_0xb930('0x68'),_0x5a8d9b['user']['id'],_0x5a8d9b[_0xb930('0x5f')][_0xb930('0x38')],_0x5a8d9b[_0xb930('0x5f')][_0xb930('0x69')],_0x47b7bf[_0xb930('0x67')]['id'],_0x5a8d9b[_0xb930('0x55')]?JSON[_0xb930('0x6a')](_0x5a8d9b[_0xb930('0x55')]):_0xb930('0x6b'));return respondWithRpcPromise(_0xb930('0x6c'),_0xb930('0x6d'),_0x47b7bf);}return null;})['then'](function(_0x5ee0c3){var _0x18131b=_0xb930('0x6e')+_0x5ee0c3[_0xb930('0x28')]['ContactId'];return db['sequelize'][_0xb930('0x41')](_0x18131b,{'type':db[_0xb930('0x6f')][_0xb930('0x70')][_0xb930('0x71')],'raw':!![]})[_0xb930('0x20')](function(_0x219f1e){return _0x219f1e;});})['then'](function(_0xf8abf9){if(_0xf8abf9){_0x47b7bf[_0xb930('0x28')][_0xb930('0x72')]=_0xf8abf9[0x0];if(!_0x5a8d9b[_0xb930('0x55')][_0xb930('0x5e')])return;return db[_0xb930('0x73')]['find']({'where':{'id':_0x5a8d9b[_0xb930('0x55')][_0xb930('0x5e')],'role':_0xb930('0x60')},'attributes':['id',_0xb930('0x38'),_0xb930('0x74'),_0xb930('0x75'),_0xb930('0x76')],'raw':!![]});}return null;})['then'](function(_0x1e6582){if(!_0x1e6582)return null;_0x47b7bf[_0xb930('0x28')]['agent']=_0x1e6582;return _0x47b7bf;})[_0xb930('0x20')](function(_0x4e990b){if(_0x4e990b){if(_0x5a8d9b[_0xb930('0x55')][_0xb930('0x77')]){_0x47b7bf['message'][_0xb930('0x78')]=util[_0xb930('0x66')](_0xb930('0x79'),_0x5a8d9b[_0xb930('0x5f')]['name']);_0x47b7bf[_0xb930('0x28')][_0xb930('0x7a')]=_0x47b7bf[_0xb930('0x7a')];_0x47b7bf[_0xb930('0x28')][_0xb930('0x7b')]=_0x47b7bf[_0xb930('0x7a')];_0x47b7bf[_0xb930('0x28')]['event']=_0xb930('0x7c');return respondWithRpcPromise(_0xb930('0x7d'),_0xb930('0x7d'),{'event':_0xb930('0x7e'),'message':_0x47b7bf[_0xb930('0x28')]},client9002)[_0xb930('0x20')](function(){return _0x47b7bf;});}return _0x47b7bf;}return null;})[_0xb930('0x20')](respondWithResult(_0x4c7779,null))['catch'](handleError(_0x4c7779,null));};var interaction_log=require(_0xb930('0x13'))(_0xb930('0x59'));exports[_0xb930('0x34')]=function(_0x519930,_0x4beab4,_0x586f60){var _0x25cc2e={'agent':{},'channel':_0xb930('0x5a')};if(_0x519930[_0xb930('0x55')]['id']){delete _0x519930[_0xb930('0x55')]['id'];}_0x519930[_0xb930('0x55')][_0xb930('0x5e')]=_0x519930[_0xb930('0x55')][_0xb930('0x5e')]||_0x519930[_0xb930('0x5f')]['id'];_0x25cc2e[_0xb930('0x60')]['id']=_0x519930['body']['UserId'];return db[_0xb930('0x3b')]['find']({'where':{'id':_0x519930['params']['id'],'UserId':null}})[_0xb930('0x20')](handleEntityNotFound(_0x4beab4,null))[_0xb930('0x20')](function(_0x59bebd){if(_0x59bebd){_0x25cc2e[_0xb930('0x28')]=_0x59bebd[_0xb930('0x61')]({'plain':!![]});return db[_0xb930('0x62')][_0xb930('0x57')]({'where':{'id':_0x59bebd['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4beab4,null))[_0xb930('0x20')](function(_0x55fa5a){if(_0x55fa5a){_0x25cc2e[_0xb930('0x67')]=_0x55fa5a[_0xb930('0x61')]({'plain':!![]});interaction_log[_0xb930('0x21')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x519930[_0xb930('0x5f')]['id'],_0x519930[_0xb930('0x5f')][_0xb930('0x38')],_0x519930[_0xb930('0x5f')][_0xb930('0x69')],_0x25cc2e[_0xb930('0x67')]['id'],_0x519930['body']?JSON[_0xb930('0x6a')](_0x519930[_0xb930('0x55')]):_0xb930('0x6b'));return respondWithRpcPromise(_0xb930('0x7f'),_0xb930('0x80'),_0x25cc2e);}return null;})[_0xb930('0x20')](function(_0x74b28b){var _0x1a3ce3=_0xb930('0x6e')+_0x74b28b['message'][_0xb930('0x81')];return db[_0xb930('0x82')][_0xb930('0x41')](_0x1a3ce3,{'type':db[_0xb930('0x6f')][_0xb930('0x70')][_0xb930('0x71')],'raw':!![]})[_0xb930('0x20')](function(_0x194b91){return _0x194b91;});})[_0xb930('0x20')](function(_0x2f3ac3){if(_0x2f3ac3){_0x25cc2e[_0xb930('0x28')]['contact']=_0x2f3ac3[0x0];if(!_0x519930[_0xb930('0x55')][_0xb930('0x5e')])return;return db[_0xb930('0x73')]['find']({'where':{'id':_0x519930[_0xb930('0x55')]['UserId'],'role':_0xb930('0x60')},'attributes':['id',_0xb930('0x38'),'fullname','email',_0xb930('0x76')],'raw':!![]});}return null;})[_0xb930('0x20')](function(_0x1ade32){if(!_0x1ade32)return null;_0x25cc2e[_0xb930('0x28')][_0xb930('0x60')]=_0x1ade32;return _0x25cc2e;})[_0xb930('0x20')](function(_0x4f9f00){if(_0x4f9f00){_0x4f9f00[_0xb930('0x28')]['interface']=util[_0xb930('0x66')](_0xb930('0x79'),_0x519930[_0xb930('0x5f')][_0xb930('0x38')]);_0x4f9f00[_0xb930('0x28')]['channel']=_0x25cc2e['channel'];_0x4f9f00[_0xb930('0x28')][_0xb930('0x7b')]=_0x25cc2e[_0xb930('0x7a')];_0x4f9f00['message'][_0xb930('0x83')]=_0xb930('0x34');respondWithRpcPromise(_0xb930('0x7d'),'EventManager',{'event':'rejectmessage','message':_0x4f9f00[_0xb930('0x28')]},client9002);return _0x25cc2e;}return null;})[_0xb930('0x20')](respondWithResult(_0x4beab4,null))[_0xb930('0x2a')](handleError(_0x4beab4,null));};exports[_0xb930('0x2b')]=function(_0x4d6f06,_0x394a0c,_0x1253f2){if(_0x4d6f06[_0xb930('0x55')]['id']){delete _0x4d6f06[_0xb930('0x55')]['id'];}var _0x7e0502;return db[_0xb930('0x3b')][_0xb930('0x57')]({'where':{'id':_0x4d6f06[_0xb930('0x56')]['id']}})[_0xb930('0x20')](handleEntityNotFound(_0x394a0c,null))[_0xb930('0x20')](function(_0x50eb6b){if(_0x50eb6b){_0x7e0502=_0x50eb6b;return db[_0xb930('0x84')][_0xb930('0x57')]({'where':{'id':_0x50eb6b[_0xb930('0x85')]}});}})['then'](handleEntityNotFound(_0x394a0c,null))[_0xb930('0x20')](function(_0x362957){if(_0x362957){logger[_0xb930('0x24')](_0xb930('0x25'),_0xb930('0x2b'),'received\x20delivery\x20report\x20from',_0x362957['type'],util[_0xb930('0x86')](_0x4d6f06[_0xb930('0x55')],{'showHidden':![],'depth':null}));switch(_0x362957[_0xb930('0x87')]){case _0xb930('0x88'):if(_0x4d6f06[_0xb930('0x55')][_0xb930('0x89')]&&_0x4d6f06[_0xb930('0x55')]['MessageSid']===_0x7e0502[_0xb930('0x8a')]){return _0x7e0502[_0xb930('0x36')]({'read':!![]});}else{logger['error'](_0xb930('0x8b'),_0xb930('0x2b'),_0xb930('0x88'),util[_0xb930('0x86')](_0x4d6f06[_0xb930('0x55')],{'showHidden':![],'depth':null}));}break;case _0xb930('0x8c'):if(_0x4d6f06[_0xb930('0x55')][_0xb930('0x8d')]&&_0x4d6f06[_0xb930('0x55')][_0xb930('0x8d')]===_0x7e0502[_0xb930('0x8a')]&&_[_0xb930('0x8e')]([_0xb930('0x8f'),'delivered'],_0x4d6f06[_0xb930('0x55')]['Status'])>=0x0){return _0x7e0502[_0xb930('0x36')]({'read':!![]});}else{logger[_0xb930('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb930('0x2b'),'plivio',util[_0xb930('0x86')](_0x4d6f06[_0xb930('0x55')],{'showHidden':![],'depth':null}));}break;case _0xb930('0x90'):var _0x4e240b=_0x4d6f06[_0xb930('0x55')]['results'][0x0];if(_0x4e240b['status'][_0xb930('0x91')]===_0xb930('0x92')){return _0x7e0502['update']({'read':!![]});}else{logger[_0xb930('0x26')](_0xb930('0x8b'),'status',_0xb930('0x90'),util[_0xb930('0x86')](_0x4d6f06[_0xb930('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x7e0502;}})[_0xb930('0x20')](respondWithResult(_0x394a0c,null))[_0xb930('0x2a')](handleError(_0x394a0c,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 5b263cf..a64276a 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 _0x8d32=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x172c08,_0x422e49){var _0x569a8a=function(_0x1d8005){while(--_0x1d8005){_0x172c08['push'](_0x172c08['shift']());}};_0x569a8a(++_0x422e49);}(_0x8d32,0x15b));var _0x28d3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8d32[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x28d3('0x0'))['db'][_0x28d3('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x28d3('0x2')](0x0);var events={'afterCreate':_0x28d3('0x3'),'afterUpdate':_0x28d3('0x4'),'afterDestroy':_0x28d3('0x5')};function emitEvent(_0x80327c){return function(_0x483dca,_0x43ec57,_0x4f8b63){SmsMessageEvents['emit'](_0x80327c+':'+_0x483dca['id'],_0x483dca);SmsMessageEvents[_0x28d3('0x6')](_0x80327c,_0x483dca);_0x4f8b63(null);};}for(var e in events){if(events[_0x28d3('0x7')](e)){var event=events[e];SmsMessage[_0x28d3('0x8')](e,emitEvent(event));}}module[_0x28d3('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x6b22=['events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x49406b,_0x4374a0){var _0x447d17=function(_0x584010){while(--_0x584010){_0x49406b['push'](_0x49406b['shift']());}};_0x447d17(++_0x4374a0);}(_0x6b22,0x1d0));var _0x26b2=function(_0x56f097,_0x2fa180){_0x56f097=_0x56f097-0x0;var _0x105589=_0x6b22[_0x56f097];return _0x105589;};'use strict';var EventEmitter=require(_0x26b2('0x0'));var SmsMessage=require(_0x26b2('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x26b2('0x2')](0x0);var events={'afterCreate':_0x26b2('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x273163){return function(_0x393e67,_0x44dd21,_0x1b6f69){SmsMessageEvents[_0x26b2('0x4')](_0x273163+':'+_0x393e67['id'],_0x393e67);SmsMessageEvents[_0x26b2('0x4')](_0x273163,_0x393e67);_0x1b6f69(null);};}for(var e in events){if(events[_0x26b2('0x5')](e)){var event=events[e];SmsMessage[_0x26b2('0x6')](e,emitEvent(event));}}module[_0x26b2('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 219cb30..58d5e73 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 _0xad32=['sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','POST','user_key','session_key','total_sent','deliveryReport','read','skebby','https://smsapi.connectel.se/api/v2/send/','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','senderString','/status?token=','%s:%s','toString','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','sender','timestamp','keys','sort','length','apiKey','createHash','md5','digest','hex','signature=','GET','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','applicationId','intelepeer','Bearer\x20','message','refid','status','Token\x20not\x20received','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','catch','error','out','SmsAccount','find','type','twilio','accountSid','phone','authToken','messages','remote','/api/sms/messages/','token'];(function(_0x2753ac,_0x2daa7f){var _0x206174=function(_0x4f5717){while(--_0x4f5717){_0x2753ac['push'](_0x2753ac['shift']());}};_0x206174(++_0x2daa7f);}(_0xad32,0x13f));var _0x2ad3=function(_0x283d2c,_0x2dca59){_0x283d2c=_0x283d2c-0x0;var _0x29d45f=_0xad32[_0x283d2c];return _0x29d45f;};'use strict';var _=require(_0x2ad3('0x0'));var util=require(_0x2ad3('0x1'));var logger=require(_0x2ad3('0x2'))(_0x2ad3('0x3'));var moment=require('moment');var BPromise=require(_0x2ad3('0x4'));var rp=require(_0x2ad3('0x5'));var fs=require('fs');var path=require(_0x2ad3('0x6'));var rimraf=require(_0x2ad3('0x7'));var config=require(_0x2ad3('0x8'));var attributes=require(_0x2ad3('0x9'));module[_0x2ad3('0xa')]=function(_0x287739,_0x34fa3b){return _0x287739[_0x2ad3('0xb')](_0x2ad3('0xc'),attributes,{'tableName':_0x2ad3('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x2ad3('0xe')]},{'name':_0x2ad3('0xf'),'fields':[_0x2ad3('0x10')],'type':_0x2ad3('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b93e8,_0x4865f7,_0x4586f6){var _0x4d8d98=_0x287739[_0x2ad3('0x12')];var _0x470820=_0x2b93e8[_0x2ad3('0x13')]({'plain':!![]});if(_0x470820[_0x2ad3('0x14')][_0x2ad3('0x15')]()==='in'||_0x470820[_0x2ad3('0x14')][_0x2ad3('0x15')]()==='out'&&!_0x470820[_0x2ad3('0x16')]&&!_[_0x2ad3('0x17')](_0x470820[_0x2ad3('0x18')])&&!_[_0x2ad3('0x17')](_0x470820[_0x2ad3('0x19')])){_0x4d8d98[_0x2ad3('0x1a')][_0x2ad3('0x1b')]({'where':{'id':_0x470820[_0x2ad3('0x19')]}})[_0x2ad3('0x1c')](function(_0x3a51b4){if(_0x3a51b4){_0x3a51b4[_0x2ad3('0x1d')]({'lastMsgAt':_0x470820['createdAt'],'lastMsgDirection':_0x470820[_0x2ad3('0x14')][_0x2ad3('0x15')]()});}})[_0x2ad3('0x1e')](function(_0x234e6a){console[_0x2ad3('0x1f')](_0x234e6a);});}if(_0x470820['direction']===_0x2ad3('0x20')&&!_0x470820[_0x2ad3('0x16')]){var _0x5b3d70;_0x4d8d98[_0x2ad3('0x21')][_0x2ad3('0x22')]({'where':{'id':_0x470820['SmsAccountId']},'raw':!![]})[_0x2ad3('0x1c')](function(_0x41e944){_0x5b3d70=_0x41e944;if(_0x5b3d70&&_0x5b3d70[_0x2ad3('0x23')]){switch(_0x5b3d70[_0x2ad3('0x23')]){case _0x2ad3('0x24'):var _0x1d3dd1=require(_0x2ad3('0x24'));if(_0x5b3d70[_0x2ad3('0x25')]&&_0x5b3d70['authToken']&&_0x5b3d70[_0x2ad3('0x26')]){var _0x42b850=new _0x1d3dd1(_0x5b3d70[_0x2ad3('0x25')],_0x5b3d70[_0x2ad3('0x27')]);_0x42b850[_0x2ad3('0x28')]['create']({'body':_0x470820[_0x2ad3('0x10')],'to':_0x470820['phone'],'from':_0x5b3d70[_0x2ad3('0x26')],'statusCallback':_0x5b3d70[_0x2ad3('0x29')]+_0x2ad3('0x2a')+_0x470820['id']+'/status?token='+_0x5b3d70[_0x2ad3('0x2b')]})[_0x2ad3('0x1c')](function(_0xc52267){if(_0xc52267[_0x2ad3('0x2c')]){return _0x2b93e8[_0x2ad3('0x1d')]({'messageId':_0xc52267[_0x2ad3('0x2c')]});}})[_0x2ad3('0x1e')](function(_0xf02af0){logger['error'](_0x2ad3('0x2d'),_0x2ad3('0x2e'),_0x2ad3('0x24'),util[_0x2ad3('0x2f')](_0xf02af0,{'showHidden':![],'depth':null}));});}else{logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),'afterCreate',_0x2ad3('0x24'),_0x2ad3('0x30'));}break;case'skebby':var _0x409b7e=_0x2ad3('0x31');if(_0x5b3d70[_0x2ad3('0x32')]&&_0x5b3d70[_0x2ad3('0x33')]){var _0x3308bc={'recipient':[_0x470820['phone']],'message':_0x470820[_0x2ad3('0x10')],'message_type':_0x5b3d70['smsMethod']};if(_0x5b3d70[_0x2ad3('0x34')]&&_0x5b3d70[_0x2ad3('0x34')]!=='SI'){_0x3308bc['sender']=_0x5b3d70[_0x2ad3('0x26')];}var _0x3ea8a7={'url':_0x409b7e+_0x2ad3('0x35')+_0x5b3d70[_0x2ad3('0x32')]+_0x2ad3('0x36')+_0x5b3d70['password'],'method':'GET'};rp(_0x3ea8a7)[_0x2ad3('0x1c')](function(_0x13d9f1){var _0xb3f2ba=_0x13d9f1['split'](';');var _0xf9d632={'user_key':_0xb3f2ba[0x0],'session_key':_0xb3f2ba[0x1]};_0x3ea8a7={'url':_0x409b7e+'sms','method':_0x2ad3('0x37'),'headers':{'user_key':_0xf9d632[_0x2ad3('0x38')],'Session_key':_0xf9d632[_0x2ad3('0x39')]},'json':!![],'body':_0x3308bc};return rp(_0x3ea8a7);})[_0x2ad3('0x1c')](function(_0x2ac68d){if(_0x2ac68d[_0x2ad3('0x3a')]>=0x1){var _0x5bef32={'messageId':_0x2ac68d['internal_order_id']};if(_0x5b3d70[_0x2ad3('0x34')]!=='GP'||!_0x5b3d70[_0x2ad3('0x3b')]){_0x5bef32[_0x2ad3('0x3c')]=!![];}return _0x2b93e8[_0x2ad3('0x1d')](_0x5bef32);}else{return logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),_0x2ad3('0x2e'),_0x2ad3('0x3d'),util[_0x2ad3('0x2f')](_0x2ac68d,{'showHidden':![],'depth':null}));}})[_0x2ad3('0x1e')](function(_0x1a3991){return logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),_0x2ad3('0x2e'),'skebby',util[_0x2ad3('0x2f')](_0x1a3991,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2ad3('0x2e'),_0x2ad3('0x3d'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x5b3d70[_0x2ad3('0x27')]){var _0x34bd45={'recipient':_0x470820[_0x2ad3('0x26')],'message':_0x470820['body'],'sender':_0x5b3d70['senderString']||_0x5b3d70[_0x2ad3('0x26')],'authorization':_0x5b3d70['authToken']};var _0x4865f7={'method':'POST','uri':_0x2ad3('0x3e'),'body':_0x34bd45,'json':!![]};rp(_0x4865f7)['then'](function(_0x55cbe1){var _0x5e7b21={'messageId':_0x55cbe1['requestid']};if(!_0x5b3d70[_0x2ad3('0x3b')]){_0x5e7b21[_0x2ad3('0x3c')]=!![];}return _0x2b93e8[_0x2ad3('0x1d')](_0x5e7b21);})[_0x2ad3('0x1e')](function(_0x3d785d){logger['error'](_0x2ad3('0x2d'),_0x2ad3('0x2e'),_0x2ad3('0x3f'),util[_0x2ad3('0x2f')](_0x3d785d,{'showHidden':![],'depth':null}));});}else{logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),'afterCreate',_0x2ad3('0x3f'),_0x2ad3('0x40'));}break;case _0x2ad3('0x41'):if(_0x5b3d70[_0x2ad3('0x32')]&&_0x5b3d70[_0x2ad3('0x33')]){var _0x34bd45={'messages':[{'source':_0x2ad3('0x42'),'to':_0x470820[_0x2ad3('0x26')],'body':_0x470820['body'],'from':_0x5b3d70['senderString']||_0x5b3d70[_0x2ad3('0x26')]}]};var _0x374f74=util[_0x2ad3('0x43')]('%s:%s',_0x5b3d70['username'],_0x5b3d70[_0x2ad3('0x33')]);var _0x4865f7={'method':_0x2ad3('0x37'),'uri':_0x2ad3('0x44'),'body':_0x34bd45,'headers':{'Authorization':util[_0x2ad3('0x43')](_0x2ad3('0x45'),new Buffer(_0x374f74)['toString'](_0x2ad3('0x46')))},'json':!![]};rp(_0x4865f7)[_0x2ad3('0x1c')](function(_0x5353db){if(_0x5353db[_0x2ad3('0x47')]>=0xc8&&_0x5353db[_0x2ad3('0x47')]<=0xce){if(_0x5353db['data']&&_0x5353db[_0x2ad3('0x48')][_0x2ad3('0x49')]>0x0){var _0x43f6c5=_['head'](_0x5353db[_0x2ad3('0x48')][_0x2ad3('0x28')]);var _0x105543={'messageId':_0x43f6c5[_0x2ad3('0x4a')]};if(!_0x5b3d70[_0x2ad3('0x3b')]){_0x105543['read']=!![];}return _0x2b93e8[_0x2ad3('0x1d')](_0x105543);}else{logger[_0x2ad3('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2ad3('0x4b'),util[_0x2ad3('0x2f')](_0x5353db,{'showHidden':![],'depth':null}));}}else{logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),_0x2ad3('0x2e'),_0x2ad3('0x4b'),util[_0x2ad3('0x2f')](_0x5353db,{'showHidden':![],'depth':null}));}})[_0x2ad3('0x1e')](function(_0x2f2c60){logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),_0x2ad3('0x2e'),'clickSend',util[_0x2ad3('0x2f')](_0x2f2c60,{'showHidden':![],'depth':null}));});}else{logger[_0x2ad3('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2ad3('0x2e'),_0x2ad3('0x4b'),_0x2ad3('0x4c'));}break;case _0x2ad3('0x4d'):if(_0x5b3d70[_0x2ad3('0x4e')]&&_0x5b3d70['authToken']){var _0x34bd45={'dst':_0x470820['phone'],'text':_0x470820[_0x2ad3('0x10')],'src':_0x5b3d70[_0x2ad3('0x4f')]||_0x5b3d70[_0x2ad3('0x26')],'url':_0x5b3d70['remote']+'/api/sms/messages/'+_0x470820['id']+_0x2ad3('0x50')+_0x5b3d70['token']};var _0x374f74=util[_0x2ad3('0x43')](_0x2ad3('0x51'),_0x5b3d70['authId'],_0x5b3d70[_0x2ad3('0x27')]);var _0x4865f7={'method':'POST','uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x5b3d70[_0x2ad3('0x4e')]),'body':_0x34bd45,'headers':{'Authorization':util[_0x2ad3('0x43')](_0x2ad3('0x45'),new Buffer(_0x374f74)[_0x2ad3('0x52')](_0x2ad3('0x46')))},'json':!![]};rp(_0x4865f7)[_0x2ad3('0x1c')](function(_0x5bcfa6){var _0x44a927={'messageId':_0x5bcfa6['message_uuid'][0x0]};return _0x2b93e8[_0x2ad3('0x1d')](_0x44a927);})[_0x2ad3('0x1e')](function(_0x47e714){logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),_0x2ad3('0x2e'),_0x2ad3('0x4d'),util[_0x2ad3('0x2f')](_0x47e714,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2ad3('0x2d'),_0x2ad3('0x2e'),_0x2ad3('0x4d'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x2ad3('0x53'):if(_0x5b3d70[_0x2ad3('0x32')]&&_0x5b3d70[_0x2ad3('0x33')]){if(_0x5b3d70[_0x2ad3('0x54')]){var _0x18b036={'method':_0x2ad3('0x37'),'uri':_0x5b3d70[_0x2ad3('0x54')]+_0x2ad3('0x55'),'body':{'username':_0x5b3d70[_0x2ad3('0x32')],'password':_0x5b3d70['password']},'json':!![]};return rp(_0x18b036)[_0x2ad3('0x1c')](function(_0x5d4189){var _0x4b3dbd={'method':_0x2ad3('0x37'),'uri':_0x5b3d70['baseUrl']+_0x2ad3('0x56'),'body':{'messages':[{'from':_0x5b3d70[_0x2ad3('0x26')],'destinations':[{'to':_0x470820[_0x2ad3('0x26')]}],'text':_0x470820[_0x2ad3('0x10')],'notifyUrl':_0x5b3d70[_0x2ad3('0x29')]+_0x2ad3('0x2a')+_0x470820['id']+_0x2ad3('0x50')+_0x5b3d70[_0x2ad3('0x2b')],'notifyContentType':_0x2ad3('0x57'),'callbackData':_0x5b3d70[_0x2ad3('0x26')]+';'+_0x470820['body']}]},'headers':{'Authorization':_0x2ad3('0x58')+_0x5d4189['token']},'json':!![]};return rp(_0x4b3dbd)[_0x2ad3('0x1c')](function(_0x56e0f0){if(_0x56e0f0[_0x2ad3('0x28')]){var _0x3a2102={'messageId':_0x56e0f0[_0x2ad3('0x28')][0x0]['messageId']};if(!_0x5b3d70[_0x2ad3('0x3b')]){_0x3a2102[_0x2ad3('0x3c')]=!![];}return _0x2b93e8[_0x2ad3('0x1d')](_0x3a2102);}else{return logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),_0x2ad3('0x2e'),_0x2ad3('0x53'),util['inspect'](_0x56e0f0,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x549b23){return logger['error'](_0x2ad3('0x2d'),_0x2ad3('0x2e'),_0x2ad3('0x53'),util[_0x2ad3('0x2f')](_0x549b23,{'showHidden':![],'depth':null}));});}else{logger[_0x2ad3('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2ad3('0x53'),_0x2ad3('0x59'));}}else{logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),_0x2ad3('0x2e'),_0x2ad3('0x53'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x2ad3('0x5a'):var _0x4c72ed=require(_0x2ad3('0x5b'));if(_0x5b3d70['apiKey']){var _0x3e6724={};_0x3e6724[_0x2ad3('0x5c')]=_0x5b3d70[_0x2ad3('0x32')];_0x3e6724[_0x2ad3('0x26')]=_0x470820[_0x2ad3('0x26')];_0x3e6724[_0x2ad3('0x5d')]=_0x5b3d70[_0x2ad3('0x26')];_0x3e6724['text']=_0x470820[_0x2ad3('0x10')];_0x3e6724[_0x2ad3('0x5e')]=+new Date();var _0x18e55a='';var _0x4d5325='';var _0x5146d3=Object[_0x2ad3('0x5f')](_0x3e6724);_0x5146d3[_0x2ad3('0x60')]();for(var _0x411171=0x0;_0x411171<_0x5146d3[_0x2ad3('0x61')];_0x411171++){if(_0x18e55a!=''){_0x18e55a+='&';}_0x18e55a+=_0x5146d3[_0x411171]+'='+encodeURIComponent(_0x3e6724[_0x5146d3[_0x411171]]);_0x4d5325+=_0x3e6724[_0x5146d3[_0x411171]];}_0x4d5325+=_0x5b3d70[_0x2ad3('0x62')];_0x4d5325=_0x4c72ed[_0x2ad3('0x63')](_0x2ad3('0x64'))['update'](_0x4d5325)[_0x2ad3('0x65')](_0x2ad3('0x66'));if(_0x18e55a!==''){_0x18e55a+='&';}_0x18e55a+=_0x2ad3('0x67')+_0x4d5325;var _0x3ea8a7={'method':_0x2ad3('0x68'),'uri':_0x5b3d70[_0x2ad3('0x54')]+'/external/get/send.php?'+_0x18e55a,'json':!![]};return rp(_0x3ea8a7)['then'](function(_0x23ddf1){var _0x384683=Object[_0x2ad3('0x5f')](_0x23ddf1);if(_0x23ddf1[_0x384683[0x0]][_0x2ad3('0x1f')]&&parseInt(_0x23ddf1[_0x384683[0x0]][_0x2ad3('0x1f')])===0x0){var _0x38f193={'messageId':_0x23ddf1[_0x384683[0x0]][_0x2ad3('0x69')]};if(!_0x5b3d70['deliveryReport']){_0x38f193[_0x2ad3('0x3c')]=!![];}return _0x2b93e8[_0x2ad3('0x1d')](_0x38f193);}else{return logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),_0x2ad3('0x2e'),'csc',util[_0x2ad3('0x2f')](_0x23ddf1[_0x2ad3('0x1f')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x217923){return logger[_0x2ad3('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2ad3('0x2e'),_0x2ad3('0x5a'),util['inspect'](_0x217923,{'showHidden':![],'depth':null}));});}else{logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),_0x2ad3('0x2e'),_0x2ad3('0x5a'),_0x2ad3('0x6a'));}break;case _0x2ad3('0x6b'):if(_0x5b3d70[_0x2ad3('0x62')]){var _0x1a88cb={'method':_0x2ad3('0x37'),'uri':_0x2ad3('0x6c'),'headers':{'Authorization':_0x5b3d70['apiKey']},'body':{'content':_0x470820[_0x2ad3('0x10')],'to':[_0x470820[_0x2ad3('0x26')]],'from':_0x5b3d70[_0x2ad3('0x26')],'binary':![],'clientMessageId':_0x2ad3('0x6d'),'charset':_0x2ad3('0x6e')},'json':!![]};rp(_0x1a88cb)[_0x2ad3('0x1c')](function(_0x3d00c6){if(!_0x3d00c6[_0x2ad3('0x1f')]){var _0x526327={'messageId':_0x3d00c6[_0x2ad3('0x28')][0x0][_0x2ad3('0x6f')]};if(!_0x5b3d70[_0x2ad3('0x3b')]){_0x526327[_0x2ad3('0x3c')]=!![];}return _0x2b93e8[_0x2ad3('0x1d')](_0x526327);}else{return logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),_0x2ad3('0x2e'),_0x2ad3('0x6b'),util['inspect'](_0x3d00c6[_0x2ad3('0x1f')],{'showHidden':![],'depth':null}));}})[_0x2ad3('0x1e')](function(_0x51128a){return logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),_0x2ad3('0x2e'),_0x2ad3('0x6b'),util['inspect'](_0x51128a,{'showHidden':![],'depth':null}));});}else{logger[_0x2ad3('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2ad3('0x2e'),_0x2ad3('0x6b'),_0x2ad3('0x6a'));}break;case _0x2ad3('0x70'):if(_0x5b3d70[_0x2ad3('0x32')]&&_0x5b3d70[_0x2ad3('0x33')]){var _0x374f74=util['format'](_0x2ad3('0x51'),_0x5b3d70[_0x2ad3('0x32')],_0x5b3d70['password']);var _0x4865f7={'method':_0x2ad3('0x37'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x5b3d70['accountId']+'/messages','body':{'to':[_0x470820[_0x2ad3('0x26')]],'text':_0x470820[_0x2ad3('0x10')],'from':_0x5b3d70[_0x2ad3('0x26')],'applicationId':_0x5b3d70[_0x2ad3('0x71')]},'headers':{'Authorization':util[_0x2ad3('0x43')](_0x2ad3('0x45'),new Buffer(_0x374f74)[_0x2ad3('0x52')]('base64'))},'json':!![]};rp(_0x4865f7)[_0x2ad3('0x1c')](function(_0x2038a8){if(_0x2038a8['id']){var _0x4d84ca={'messageId':_0x2038a8['id']};return _0x2b93e8[_0x2ad3('0x1d')](_0x4d84ca);}else{logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),_0x2ad3('0x2e'),_0x2ad3('0x70'),util['inspect'](_0x2038a8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x216e70){logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),_0x2ad3('0x2e'),_0x2ad3('0x70'),util[_0x2ad3('0x2f')](_0x216e70,{'showHidden':![],'depth':null}));});}else{logger[_0x2ad3('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2ad3('0x70'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x2ad3('0x72'):if(_0x5b3d70[_0x2ad3('0x62')]){var _0x2ffec4={};var _0x3ea8a7={'method':_0x2ad3('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x2ad3('0x73')+_0x5b3d70['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x5b3d70[_0x2ad3('0x26')],'to':_0x470820['phone'],'text':_0x470820[_0x2ad3('0x10')]},'json':!![]};return rp(_0x3ea8a7)[_0x2ad3('0x1c')](function(_0x14fb28){if(_0x14fb28['code']==0xca){_0x2ffec4[_0x2ad3('0x74')]=_0x14fb28;var _0x1e4c86={'method':_0x2ad3('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x5b3d70[_0x2ad3('0x62')],'Content-Type':'application/json'},'body':{'refid':_0x2ffec4['message'][_0x2ad3('0x75')]},'json':!![]};return rp(_0x1e4c86)['then'](function(_0x4e45a5){_0x2ffec4[_0x2ad3('0x76')]=_0x4e45a5;var _0x566535={'messageId':_0x2ffec4[_0x2ad3('0x74')][_0x2ad3('0x75')],'read':!![]};return _0x2b93e8[_0x2ad3('0x1d')](_0x566535);});}else{return logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),_0x2ad3('0x2e'),_0x2ad3('0x72'),util['inspect'](_0x14fb28,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2a8845){return logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),_0x2ad3('0x2e'),'intelepeer',util[_0x2ad3('0x2f')](_0x2a8845,{'showHidden':![],'depth':null}));});}else{return logger[_0x2ad3('0x1f')](_0x2ad3('0x2d'),_0x2ad3('0x2e'),_0x2ad3('0x72'),_0x2ad3('0x77'));}break;}}})['finally'](function(){_0x4586f6();});}else{_0x4586f6();}}},'charset':_0x2ad3('0x78'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x97d2=['timestamp','keys','createHash','md5','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','then','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','login?username=','&password=','GET','POST','total_sent','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','password','xCALLY\x20Motion','senderString','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','data','queued_count','head','clickSend','authId','toString','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender'];(function(_0x22663b,_0xc8c6e3){var _0x310d0a=function(_0x151e66){while(--_0x151e66){_0x22663b['push'](_0x22663b['shift']());}};_0x310d0a(++_0xc8c6e3);}(_0x97d2,0x177));var _0x297d=function(_0x1521a3,_0x59e9ed){_0x1521a3=_0x1521a3-0x0;var _0x1e334b=_0x97d2[_0x1521a3];return _0x1e334b;};'use strict';var _=require(_0x297d('0x0'));var util=require(_0x297d('0x1'));var logger=require(_0x297d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x297d('0x3'));var fs=require('fs');var path=require(_0x297d('0x4'));var rimraf=require(_0x297d('0x5'));var config=require(_0x297d('0x6'));var attributes=require(_0x297d('0x7'));module[_0x297d('0x8')]=function(_0x43e7bd,_0x55bbc6){return _0x43e7bd[_0x297d('0x9')](_0x297d('0xa'),attributes,{'tableName':_0x297d('0xb'),'paranoid':![],'indexes':[{'name':_0x297d('0xc'),'fields':[_0x297d('0xc')]},{'name':_0x297d('0xd'),'fields':['body'],'type':_0x297d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ce59a,_0x2b8bcd,_0x14dead){var _0x24a460=_0x43e7bd[_0x297d('0xf')];var _0x48fa46=_0x3ce59a[_0x297d('0x10')]({'plain':!![]});if(_0x48fa46[_0x297d('0x11')]['toLowerCase']()==='in'||_0x48fa46[_0x297d('0x11')][_0x297d('0x12')]()===_0x297d('0x13')&&!_0x48fa46[_0x297d('0x14')]&&!_[_0x297d('0x15')](_0x48fa46[_0x297d('0x16')])&&!_[_0x297d('0x15')](_0x48fa46['SmsInteractionId'])){_0x24a460[_0x297d('0x17')][_0x297d('0x18')]({'where':{'id':_0x48fa46['SmsInteractionId']}})[_0x297d('0x19')](function(_0x17f9f0){if(_0x17f9f0){_0x17f9f0['update']({'lastMsgAt':_0x48fa46[_0x297d('0x1a')],'lastMsgDirection':_0x48fa46[_0x297d('0x11')][_0x297d('0x12')]()});}})[_0x297d('0x1b')](function(_0x434bbb){console[_0x297d('0x1c')](_0x434bbb);});}if(_0x48fa46[_0x297d('0x11')]===_0x297d('0x13')&&!_0x48fa46[_0x297d('0x14')]){var _0x5d3061;_0x24a460[_0x297d('0x1d')][_0x297d('0x1e')]({'where':{'id':_0x48fa46[_0x297d('0x1f')]},'raw':!![]})[_0x297d('0x19')](function(_0x578968){_0x5d3061=_0x578968;if(_0x5d3061&&_0x5d3061[_0x297d('0x20')]){switch(_0x5d3061[_0x297d('0x20')]){case _0x297d('0x21'):var _0x3abad1=require('twilio');if(_0x5d3061[_0x297d('0x22')]&&_0x5d3061[_0x297d('0x23')]&&_0x5d3061[_0x297d('0x24')]){var _0x555a54=new _0x3abad1(_0x5d3061[_0x297d('0x22')],_0x5d3061[_0x297d('0x23')]);_0x555a54[_0x297d('0x25')][_0x297d('0x26')]({'body':_0x48fa46[_0x297d('0x27')],'to':_0x48fa46[_0x297d('0x24')],'from':_0x5d3061['phone'],'statusCallback':_0x5d3061[_0x297d('0x28')]+_0x297d('0x29')+_0x48fa46['id']+_0x297d('0x2a')+_0x5d3061[_0x297d('0x2b')]})[_0x297d('0x19')](function(_0x290ce7){if(_0x290ce7[_0x297d('0x2c')]){return _0x3ce59a[_0x297d('0x2d')]({'messageId':_0x290ce7[_0x297d('0x2c')]});}})[_0x297d('0x1b')](function(_0x2b9ed4){logger[_0x297d('0x1c')](_0x297d('0x2e'),'afterCreate','twilio',util[_0x297d('0x2f')](_0x2b9ed4,{'showHidden':![],'depth':null}));});}else{logger[_0x297d('0x1c')](_0x297d('0x2e'),_0x297d('0x30'),_0x297d('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x3a6cb7=_0x297d('0x31');if(_0x5d3061[_0x297d('0x32')]&&_0x5d3061['password']){var _0x286a60={'recipient':[_0x48fa46[_0x297d('0x24')]],'message':_0x48fa46['body'],'message_type':_0x5d3061[_0x297d('0x33')]};if(_0x5d3061[_0x297d('0x33')]&&_0x5d3061[_0x297d('0x33')]!=='SI'){_0x286a60['sender']=_0x5d3061[_0x297d('0x24')];}var _0x475d73={'url':_0x3a6cb7+_0x297d('0x34')+_0x5d3061['username']+_0x297d('0x35')+_0x5d3061['password'],'method':_0x297d('0x36')};rp(_0x475d73)[_0x297d('0x19')](function(_0x5d1b4f){var _0x5dc212=_0x5d1b4f['split'](';');var _0x53d557={'user_key':_0x5dc212[0x0],'session_key':_0x5dc212[0x1]};_0x475d73={'url':_0x3a6cb7+'sms','method':_0x297d('0x37'),'headers':{'user_key':_0x53d557['user_key'],'Session_key':_0x53d557['session_key']},'json':!![],'body':_0x286a60};return rp(_0x475d73);})[_0x297d('0x19')](function(_0x3c2a4c){if(_0x3c2a4c[_0x297d('0x38')]>=0x1){var _0x4000f3={'messageId':_0x3c2a4c['internal_order_id']};if(_0x5d3061['smsMethod']!=='GP'||!_0x5d3061[_0x297d('0x39')]){_0x4000f3[_0x297d('0x3a')]=!![];}return _0x3ce59a['update'](_0x4000f3);}else{return logger[_0x297d('0x1c')](_0x297d('0x2e'),_0x297d('0x30'),_0x297d('0x3b'),util[_0x297d('0x2f')](_0x3c2a4c,{'showHidden':![],'depth':null}));}})[_0x297d('0x1b')](function(_0x1a6237){return logger[_0x297d('0x1c')](_0x297d('0x2e'),_0x297d('0x30'),'skebby',util[_0x297d('0x2f')](_0x1a6237,{'showHidden':![],'depth':null}));});}else{logger[_0x297d('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x297d('0x30'),_0x297d('0x3b'),_0x297d('0x3c'));}break;case _0x297d('0x3d'):if(_0x5d3061[_0x297d('0x23')]){var _0x252a96={'recipient':_0x48fa46['phone'],'message':_0x48fa46[_0x297d('0x27')],'sender':_0x5d3061['senderString']||_0x5d3061['phone'],'authorization':_0x5d3061['authToken']};var _0x2b8bcd={'method':_0x297d('0x37'),'uri':_0x297d('0x3e'),'body':_0x252a96,'json':!![]};rp(_0x2b8bcd)[_0x297d('0x19')](function(_0x540540){var _0x3af19c={'messageId':_0x540540[_0x297d('0x3f')]};if(!_0x5d3061[_0x297d('0x39')]){_0x3af19c['read']=!![];}return _0x3ce59a[_0x297d('0x2d')](_0x3af19c);})['catch'](function(_0x2766e5){logger[_0x297d('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x297d('0x30'),_0x297d('0x3d'),util[_0x297d('0x2f')](_0x2766e5,{'showHidden':![],'depth':null}));});}else{logger[_0x297d('0x1c')](_0x297d('0x2e'),'afterCreate','connectel',_0x297d('0x40'));}break;case'clicksend':if(_0x5d3061[_0x297d('0x32')]&&_0x5d3061[_0x297d('0x41')]){var _0x252a96={'messages':[{'source':_0x297d('0x42'),'to':_0x48fa46['phone'],'body':_0x48fa46[_0x297d('0x27')],'from':_0x5d3061[_0x297d('0x43')]||_0x5d3061[_0x297d('0x24')]}]};var _0x2c4858=util[_0x297d('0x44')]('%s:%s',_0x5d3061[_0x297d('0x32')],_0x5d3061[_0x297d('0x41')]);var _0x2b8bcd={'method':_0x297d('0x37'),'uri':_0x297d('0x45'),'body':_0x252a96,'headers':{'Authorization':util[_0x297d('0x44')](_0x297d('0x46'),new Buffer(_0x2c4858)['toString']('base64'))},'json':!![]};rp(_0x2b8bcd)['then'](function(_0x36e448){if(_0x36e448['http_code']>=0xc8&&_0x36e448['http_code']<=0xce){if(_0x36e448[_0x297d('0x47')]&&_0x36e448[_0x297d('0x47')][_0x297d('0x48')]>0x0){var _0x244800=_[_0x297d('0x49')](_0x36e448[_0x297d('0x47')]['messages']);var _0x11648e={'messageId':_0x244800['message_id']};if(!_0x5d3061[_0x297d('0x39')]){_0x11648e[_0x297d('0x3a')]=!![];}return _0x3ce59a[_0x297d('0x2d')](_0x11648e);}else{logger[_0x297d('0x1c')](_0x297d('0x2e'),'afterCreate',_0x297d('0x4a'),util['inspect'](_0x36e448,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x297d('0x30'),'clickSend',util[_0x297d('0x2f')](_0x36e448,{'showHidden':![],'depth':null}));}})[_0x297d('0x1b')](function(_0x35d138){logger[_0x297d('0x1c')](_0x297d('0x2e'),_0x297d('0x30'),'clickSend',util[_0x297d('0x2f')](_0x35d138,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x297d('0x2e'),_0x297d('0x30'),_0x297d('0x4a'),_0x297d('0x3c'));}break;case'plivo':if(_0x5d3061[_0x297d('0x4b')]&&_0x5d3061['authToken']){var _0x252a96={'dst':_0x48fa46[_0x297d('0x24')],'text':_0x48fa46['body'],'src':_0x5d3061[_0x297d('0x43')]||_0x5d3061['phone'],'url':_0x5d3061[_0x297d('0x28')]+_0x297d('0x29')+_0x48fa46['id']+_0x297d('0x2a')+_0x5d3061[_0x297d('0x2b')]};var _0x2c4858=util['format']('%s:%s',_0x5d3061[_0x297d('0x4b')],_0x5d3061[_0x297d('0x23')]);var _0x2b8bcd={'method':_0x297d('0x37'),'uri':util[_0x297d('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x5d3061[_0x297d('0x4b')]),'body':_0x252a96,'headers':{'Authorization':util[_0x297d('0x44')](_0x297d('0x46'),new Buffer(_0x2c4858)[_0x297d('0x4c')](_0x297d('0x4d')))},'json':!![]};rp(_0x2b8bcd)[_0x297d('0x19')](function(_0x54e738){var _0x28d687={'messageId':_0x54e738[_0x297d('0x4e')][0x0]};return _0x3ce59a[_0x297d('0x2d')](_0x28d687);})['catch'](function(_0xd1a13d){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x297d('0x30'),'plivo',util[_0x297d('0x2f')](_0xd1a13d,{'showHidden':![],'depth':null}));});}else{logger[_0x297d('0x1c')](_0x297d('0x2e'),_0x297d('0x30'),'plivo',_0x297d('0x4f'));}break;case _0x297d('0x50'):if(_0x5d3061[_0x297d('0x32')]&&_0x5d3061[_0x297d('0x41')]){if(_0x5d3061[_0x297d('0x51')]){var _0x55e52f={'method':_0x297d('0x37'),'uri':_0x5d3061[_0x297d('0x51')]+'/auth/1/session','body':{'username':_0x5d3061['username'],'password':_0x5d3061[_0x297d('0x41')]},'json':!![]};return rp(_0x55e52f)[_0x297d('0x19')](function(_0x422725){var _0x194d90={'method':_0x297d('0x37'),'uri':_0x5d3061[_0x297d('0x51')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x5d3061[_0x297d('0x24')],'destinations':[{'to':_0x48fa46['phone']}],'text':_0x48fa46[_0x297d('0x27')],'notifyUrl':_0x5d3061['remote']+'/api/sms/messages/'+_0x48fa46['id']+_0x297d('0x2a')+_0x5d3061[_0x297d('0x2b')],'notifyContentType':'application/json','callbackData':_0x5d3061[_0x297d('0x24')]+';'+_0x48fa46['body']}]},'headers':{'Authorization':_0x297d('0x52')+_0x422725[_0x297d('0x2b')]},'json':!![]};return rp(_0x194d90)[_0x297d('0x19')](function(_0x20c1c8){if(_0x20c1c8[_0x297d('0x25')]){var _0x5836f4={'messageId':_0x20c1c8['messages'][0x0][_0x297d('0xc')]};if(!_0x5d3061[_0x297d('0x39')]){_0x5836f4['read']=!![];}return _0x3ce59a['update'](_0x5836f4);}else{return logger['error'](_0x297d('0x2e'),_0x297d('0x30'),_0x297d('0x50'),util[_0x297d('0x2f')](_0x20c1c8,{'showHidden':![],'depth':null}));}});})[_0x297d('0x1b')](function(_0xba202b){return logger[_0x297d('0x1c')](_0x297d('0x2e'),_0x297d('0x30'),'infobip',util[_0x297d('0x2f')](_0xba202b,{'showHidden':![],'depth':null}));});}else{logger[_0x297d('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x297d('0x30'),'infobip',_0x297d('0x53'));}}else{logger[_0x297d('0x1c')](_0x297d('0x2e'),'afterCreate',_0x297d('0x50'),_0x297d('0x3c'));}break;case _0x297d('0x54'):var _0x4d04e1=require(_0x297d('0x55'));if(_0x5d3061[_0x297d('0x56')]){var _0x5a1059={};_0x5a1059[_0x297d('0x57')]=_0x5d3061[_0x297d('0x32')];_0x5a1059['phone']=_0x48fa46[_0x297d('0x24')];_0x5a1059[_0x297d('0x58')]=_0x5d3061[_0x297d('0x24')];_0x5a1059['text']=_0x48fa46['body'];_0x5a1059[_0x297d('0x59')]=+new Date();var _0x2f6135='';var _0x1812d8='';var _0x17e43d=Object[_0x297d('0x5a')](_0x5a1059);_0x17e43d['sort']();for(var _0x2ada22=0x0;_0x2ada22<_0x17e43d['length'];_0x2ada22++){if(_0x2f6135!=''){_0x2f6135+='&';}_0x2f6135+=_0x17e43d[_0x2ada22]+'='+encodeURIComponent(_0x5a1059[_0x17e43d[_0x2ada22]]);_0x1812d8+=_0x5a1059[_0x17e43d[_0x2ada22]];}_0x1812d8+=_0x5d3061['apiKey'];_0x1812d8=_0x4d04e1[_0x297d('0x5b')](_0x297d('0x5c'))['update'](_0x1812d8)['digest']('hex');if(_0x2f6135!==''){_0x2f6135+='&';}_0x2f6135+=_0x297d('0x5d')+_0x1812d8;var _0x475d73={'method':_0x297d('0x36'),'uri':_0x5d3061[_0x297d('0x51')]+_0x297d('0x5e')+_0x2f6135,'json':!![]};return rp(_0x475d73)[_0x297d('0x19')](function(_0x9d978d){var _0x53535b=Object[_0x297d('0x5a')](_0x9d978d);if(_0x9d978d[_0x53535b[0x0]][_0x297d('0x1c')]&&parseInt(_0x9d978d[_0x53535b[0x0]][_0x297d('0x1c')])===0x0){var _0x33a045={'messageId':_0x9d978d[_0x53535b[0x0]][_0x297d('0x5f')]};if(!_0x5d3061[_0x297d('0x39')]){_0x33a045['read']=!![];}return _0x3ce59a[_0x297d('0x2d')](_0x33a045);}else{return logger[_0x297d('0x1c')](_0x297d('0x2e'),_0x297d('0x30'),_0x297d('0x54'),util[_0x297d('0x2f')](_0x9d978d[_0x297d('0x1c')],{'showHidden':![],'depth':null}));}})[_0x297d('0x1b')](function(_0x12c684){return logger[_0x297d('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x297d('0x30'),_0x297d('0x54'),util[_0x297d('0x2f')](_0x12c684,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x297d('0x2e'),_0x297d('0x30'),_0x297d('0x54'),_0x297d('0x60'));}break;case _0x297d('0x61'):if(_0x5d3061[_0x297d('0x56')]){var _0x2782c2={'method':_0x297d('0x37'),'uri':_0x297d('0x62'),'headers':{'Authorization':_0x5d3061[_0x297d('0x56')]},'body':{'content':_0x48fa46['body'],'to':[_0x48fa46['phone']],'from':_0x5d3061[_0x297d('0x24')],'binary':![],'clientMessageId':_0x297d('0x63'),'charset':_0x297d('0x64')},'json':!![]};rp(_0x2782c2)[_0x297d('0x19')](function(_0xcac356){if(!_0xcac356[_0x297d('0x1c')]){var _0x2633b6={'messageId':_0xcac356[_0x297d('0x25')][0x0]['apiMessageId']};if(!_0x5d3061[_0x297d('0x39')]){_0x2633b6[_0x297d('0x3a')]=!![];}return _0x3ce59a['update'](_0x2633b6);}else{return logger[_0x297d('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x297d('0x30'),'clickatell',util[_0x297d('0x2f')](_0xcac356[_0x297d('0x1c')],{'showHidden':![],'depth':null}));}})[_0x297d('0x1b')](function(_0x498321){return logger[_0x297d('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x297d('0x30'),'clickatell',util[_0x297d('0x2f')](_0x498321,{'showHidden':![],'depth':null}));});}else{logger[_0x297d('0x1c')](_0x297d('0x2e'),_0x297d('0x30'),_0x297d('0x61'),_0x297d('0x60'));}break;case _0x297d('0x65'):if(_0x5d3061[_0x297d('0x32')]&&_0x5d3061['password']){var _0x2c4858=util['format'](_0x297d('0x66'),_0x5d3061[_0x297d('0x32')],_0x5d3061[_0x297d('0x41')]);var _0x2b8bcd={'method':_0x297d('0x37'),'uri':_0x297d('0x67')+_0x5d3061['accountId']+_0x297d('0x68'),'body':{'to':[_0x48fa46['phone']],'text':_0x48fa46[_0x297d('0x27')],'from':_0x5d3061['phone'],'applicationId':_0x5d3061[_0x297d('0x69')]},'headers':{'Authorization':util[_0x297d('0x44')](_0x297d('0x46'),new Buffer(_0x2c4858)[_0x297d('0x4c')](_0x297d('0x4d')))},'json':!![]};rp(_0x2b8bcd)[_0x297d('0x19')](function(_0x431177){if(_0x431177['id']){var _0x397a7a={'messageId':_0x431177['id']};return _0x3ce59a[_0x297d('0x2d')](_0x397a7a);}else{logger['error'](_0x297d('0x2e'),_0x297d('0x30'),_0x297d('0x65'),util[_0x297d('0x2f')](_0x431177,{'showHidden':![],'depth':null}));}})[_0x297d('0x1b')](function(_0x32caa3){logger[_0x297d('0x1c')](_0x297d('0x2e'),_0x297d('0x30'),_0x297d('0x65'),util[_0x297d('0x2f')](_0x32caa3,{'showHidden':![],'depth':null}));});}else{logger[_0x297d('0x1c')](_0x297d('0x2e'),_0x297d('0x30'),_0x297d('0x65'),_0x297d('0x3c'));}break;case _0x297d('0x6a'):if(_0x5d3061['apiKey']){var _0x24862a={};var _0x475d73={'method':'POST','uri':_0x297d('0x6b'),'headers':{'Authorization':_0x297d('0x6c')+_0x5d3061[_0x297d('0x56')],'Content-Type':_0x297d('0x6d')},'body':{'from':_0x5d3061[_0x297d('0x24')],'to':_0x48fa46['phone'],'text':_0x48fa46[_0x297d('0x27')]},'json':!![]};return rp(_0x475d73)[_0x297d('0x19')](function(_0x3ea72d){if(_0x3ea72d['code']==0xca){_0x24862a['message']=_0x3ea72d;var _0x4b510a={'method':'POST','uri':_0x297d('0x6e'),'headers':{'Authorization':_0x297d('0x6c')+_0x5d3061[_0x297d('0x56')],'Content-Type':'application/json'},'body':{'refid':_0x24862a[_0x297d('0x6f')][_0x297d('0x70')]},'json':!![]};return rp(_0x4b510a)[_0x297d('0x19')](function(_0x362222){_0x24862a['status']=_0x362222;var _0x2bf5b9={'messageId':_0x24862a['message'][_0x297d('0x70')],'read':!![]};return _0x3ce59a[_0x297d('0x2d')](_0x2bf5b9);});}else{return logger[_0x297d('0x1c')](_0x297d('0x2e'),'afterCreate',_0x297d('0x6a'),util[_0x297d('0x2f')](_0x3ea72d,{'showHidden':![],'depth':null}));}})[_0x297d('0x1b')](function(_0x53b70d){return logger['error'](_0x297d('0x2e'),'afterCreate','intelepeer',util[_0x297d('0x2f')](_0x53b70d,{'showHidden':![],'depth':null}));});}else{return logger[_0x297d('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',_0x297d('0x71'));}break;}}})[_0x297d('0x72')](function(){_0x14dead();});}else{_0x14dead();}}},'charset':_0x297d('0x73'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 84926d0..dcd4d90 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 _0x5e4d=['catch','SmsMessage,\x20%s,\x20%s','SmsMessage','create','body','options','raw','CreateSmsMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1277fb,_0x53a9f9){var _0x42347a=function(_0x17f412){while(--_0x17f412){_0x1277fb['push'](_0x1277fb['shift']());}};_0x42347a(++_0x53a9f9);}(_0x5e4d,0xda));var _0xd5e4=function(_0x41c0f7,_0x703036){_0x41c0f7=_0x41c0f7-0x0;var _0x34393f=_0x5e4d[_0x41c0f7];return _0x34393f;};'use strict';var _=require('lodash');var util=require(_0xd5e4('0x0'));var moment=require(_0xd5e4('0x1'));var BPromise=require(_0xd5e4('0x2'));var rs=require(_0xd5e4('0x3'));var fs=require('fs');var Redis=require(_0xd5e4('0x4'));var db=require(_0xd5e4('0x5'))['db'];var utils=require(_0xd5e4('0x6'));var logger=require(_0xd5e4('0x7'))(_0xd5e4('0x8'));var config=require(_0xd5e4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd5e4('0xa')]['http']({'port':0x232a});config[_0xd5e4('0xb')]=_[_0xd5e4('0xc')](config[_0xd5e4('0xb')],{'host':_0xd5e4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd5e4('0xe'))[_0xd5e4('0xf')](socket);function respondWithRpcPromise(_0x4d2bbe,_0x210b44,_0x29d99d){return new BPromise(function(_0x1ec5ab,_0x2aff3f){return client[_0xd5e4('0x10')](_0x4d2bbe,_0x29d99d)[_0xd5e4('0x11')](function(_0x5077ac){logger[_0xd5e4('0x12')]('SmsMessage,\x20%s,\x20%s',_0x210b44,_0xd5e4('0x13'));logger[_0xd5e4('0x14')](_0xd5e4('0x15'),_0x210b44,_0xd5e4('0x13'),JSON[_0xd5e4('0x16')](_0x5077ac));if(_0x5077ac['error']){if(_0x5077ac[_0xd5e4('0x17')][_0xd5e4('0x18')]===0x1f4){logger[_0xd5e4('0x17')]('SmsMessage,\x20%s,\x20%s',_0x210b44,_0x5077ac[_0xd5e4('0x17')][_0xd5e4('0x19')]);return _0x2aff3f(_0x5077ac[_0xd5e4('0x17')][_0xd5e4('0x19')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x210b44,_0x5077ac[_0xd5e4('0x17')][_0xd5e4('0x19')]);return _0x1ec5ab(_0x5077ac[_0xd5e4('0x17')][_0xd5e4('0x19')]);}else{logger[_0xd5e4('0x12')]('SmsMessage,\x20%s,\x20%s',_0x210b44,_0xd5e4('0x13'));_0x1ec5ab(_0x5077ac[_0xd5e4('0x1a')][_0xd5e4('0x19')]);}})[_0xd5e4('0x1b')](function(_0x2e257d){logger[_0xd5e4('0x17')](_0xd5e4('0x1c'),_0x210b44,_0x2e257d);_0x2aff3f(_0x2e257d);});});}exports['CreateSmsMessage']=function(_0x1a9214){var _0x1e0cda=this;return new Promise(function(_0x4cd0b5,_0x5adcdd){return db[_0xd5e4('0x1d')][_0xd5e4('0x1e')](_0x1a9214[_0xd5e4('0x1f')],{'raw':_0x1a9214[_0xd5e4('0x20')]?_0x1a9214['options'][_0xd5e4('0x21')]===undefined?!![]:![]:!![]})[_0xd5e4('0x11')](function(_0x33f87c){logger[_0xd5e4('0x12')](_0xd5e4('0x22'),_0x1a9214);logger[_0xd5e4('0x14')](_0xd5e4('0x22'),_0x1a9214,JSON['stringify'](_0x33f87c));_0x4cd0b5(_0x33f87c);})[_0xd5e4('0x1b')](function(_0xbaee33){logger['error']('CreateSmsMessage',_0xbaee33['message'],_0x1a9214);_0x5adcdd(_0x1e0cda['error'](0x1f4,_0xbaee33['message']));});});}; \ No newline at end of file +var _0xe00f=['info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then'];(function(_0x5aa8d1,_0x276daf){var _0x550bba=function(_0x1eb972){while(--_0x1eb972){_0x5aa8d1['push'](_0x5aa8d1['shift']());}};_0x550bba(++_0x276daf);}(_0xe00f,0x99));var _0xfe00=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0xe00f[_0x56f7e2];return _0x36240b;};'use strict';var _=require(_0xfe00('0x0'));var util=require(_0xfe00('0x1'));var moment=require(_0xfe00('0x2'));var BPromise=require(_0xfe00('0x3'));var rs=require(_0xfe00('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfe00('0x5'));var logger=require(_0xfe00('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe00('0x7'));var client=jayson[_0xfe00('0x8')]['http']({'port':0x232a});config[_0xfe00('0x9')]=_[_0xfe00('0xa')](config[_0xfe00('0x9')],{'host':_0xfe00('0xb'),'port':0x18eb});var socket=require(_0xfe00('0xc'))(new Redis(config[_0xfe00('0x9')]));require(_0xfe00('0xd'))[_0xfe00('0xe')](socket);function respondWithRpcPromise(_0xe6fe32,_0x3a1495,_0x38a5c2){return new BPromise(function(_0x16584d,_0x2c4832){return client[_0xfe00('0xf')](_0xe6fe32,_0x38a5c2)[_0xfe00('0x10')](function(_0x1a6e14){logger[_0xfe00('0x11')](_0xfe00('0x12'),_0x3a1495,_0xfe00('0x13'));logger[_0xfe00('0x14')](_0xfe00('0x15'),_0x3a1495,_0xfe00('0x13'),JSON[_0xfe00('0x16')](_0x1a6e14));if(_0x1a6e14[_0xfe00('0x17')]){if(_0x1a6e14[_0xfe00('0x17')][_0xfe00('0x18')]===0x1f4){logger[_0xfe00('0x17')](_0xfe00('0x12'),_0x3a1495,_0x1a6e14[_0xfe00('0x17')][_0xfe00('0x19')]);return _0x2c4832(_0x1a6e14[_0xfe00('0x17')][_0xfe00('0x19')]);}logger['error'](_0xfe00('0x12'),_0x3a1495,_0x1a6e14[_0xfe00('0x17')][_0xfe00('0x19')]);return _0x16584d(_0x1a6e14[_0xfe00('0x17')][_0xfe00('0x19')]);}else{logger[_0xfe00('0x11')](_0xfe00('0x12'),_0x3a1495,'request\x20sent');_0x16584d(_0x1a6e14[_0xfe00('0x1a')][_0xfe00('0x19')]);}})[_0xfe00('0x1b')](function(_0x317300){logger['error']('SmsMessage,\x20%s,\x20%s',_0x3a1495,_0x317300);_0x2c4832(_0x317300);});});}exports[_0xfe00('0x1c')]=function(_0xcec534){var _0x579826=this;return new Promise(function(_0x5eca89,_0x1ec4bb){return db[_0xfe00('0x1d')][_0xfe00('0x1e')](_0xcec534[_0xfe00('0x1f')],{'raw':_0xcec534[_0xfe00('0x20')]?_0xcec534[_0xfe00('0x20')][_0xfe00('0x21')]===undefined?!![]:![]:!![]})[_0xfe00('0x10')](function(_0x141764){logger[_0xfe00('0x11')]('CreateSmsMessage',_0xcec534);logger[_0xfe00('0x14')]('CreateSmsMessage',_0xcec534,JSON[_0xfe00('0x16')](_0x141764));_0x5eca89(_0x141764);})[_0xfe00('0x1b')](function(_0x481a38){logger['error']('CreateSmsMessage',_0x481a38[_0xfe00('0x19')],_0xcec534);_0x1ec4bb(_0x579826['error'](0x1f4,_0x481a38['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ae47602..c2965cd 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 _0xec31=['emit','smsMessage:','./smsMessage.events','save','update'];(function(_0x2278de,_0x25cc69){var _0x3ed51f=function(_0x406c52){while(--_0x406c52){_0x2278de['push'](_0x2278de['shift']());}};_0x3ed51f(++_0x25cc69);}(_0xec31,0x1ba));var _0x1ec3=function(_0x358049,_0x56e00a){_0x358049=_0x358049-0x0;var _0x2426d1=_0xec31[_0x358049];return _0x2426d1;};'use strict';var SmsMessageEvents=require(_0x1ec3('0x0'));var events=[_0x1ec3('0x1'),'remove',_0x1ec3('0x2')];function createListener(_0x31d60b,_0x384b88){return function(_0x3abc2b){_0x384b88[_0x1ec3('0x3')](_0x31d60b,_0x3abc2b);};}function removeListener(_0xab19cb,_0x3bdc15){return function(){SmsMessageEvents['removeListener'](_0xab19cb,_0x3bdc15);};}exports['register']=function(_0x5dae5f){for(var _0xb8d149=0x0,_0x3455af=events['length'];_0xb8d149<_0x3455af;_0xb8d149++){var _0x11cc50=events[_0xb8d149];var _0x2ab03a=createListener(_0x1ec3('0x4')+_0x11cc50,_0x5dae5f);SmsMessageEvents['on'](_0x11cc50,_0x2ab03a);}}; \ No newline at end of file +var _0xa00a=['save','remove','update','emit','removeListener','register','length','smsMessage:','./smsMessage.events'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0xa00a,0x104));var _0xaa00=function(_0x54770b,_0x1d07ce){_0x54770b=_0x54770b-0x0;var _0x28b532=_0xa00a[_0x54770b];return _0x28b532;};'use strict';var SmsMessageEvents=require(_0xaa00('0x0'));var events=[_0xaa00('0x1'),_0xaa00('0x2'),_0xaa00('0x3')];function createListener(_0x17f24a,_0x338029){return function(_0x5702b5){_0x338029[_0xaa00('0x4')](_0x17f24a,_0x5702b5);};}function removeListener(_0x28807b,_0x57f114){return function(){SmsMessageEvents[_0xaa00('0x5')](_0x28807b,_0x57f114);};}exports[_0xaa00('0x6')]=function(_0x2e5426){for(var _0x3a3d90=0x0,_0x33fb96=events[_0xaa00('0x7')];_0x3a3d90<_0x33fb96;_0x3a3d90++){var _0x3daf66=events[_0x3a3d90];var _0x4b6c1a=createListener(_0xaa00('0x8')+_0x3daf66,_0x2e5426);SmsMessageEvents['on'](_0x3daf66,_0x4b6c1a);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index e79adec..f45c681 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 _0x4d8b=['/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','post','create','addTeams','addAgents','put','update','destroy','removeTeams','delete','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x52fe99,_0x4de155){var _0x32e644=function(_0x5e2e48){while(--_0x5e2e48){_0x52fe99['push'](_0x52fe99['shift']());}};_0x32e644(++_0x4de155);}(_0x4d8b,0x1e2));var _0xb4d8=function(_0x3bd3d2,_0x413068){_0x3bd3d2=_0x3bd3d2-0x0;var _0x569624=_0x4d8b[_0x3bd3d2];return _0x569624;};'use strict';var multer=require(_0xb4d8('0x0'));var util=require('util');var path=require(_0xb4d8('0x1'));var timeout=require(_0xb4d8('0x2'));var express=require(_0xb4d8('0x3'));var router=express[_0xb4d8('0x4')]();var fs_extra=require(_0xb4d8('0x5'));var auth=require(_0xb4d8('0x6'));var interaction=require(_0xb4d8('0x7'));var config=require('../../config/environment');var controller=require(_0xb4d8('0x8'));router[_0xb4d8('0x9')]('/',auth['isAuthenticated'](),controller[_0xb4d8('0xa')]);router[_0xb4d8('0x9')](_0xb4d8('0xb'),auth[_0xb4d8('0xc')](),controller[_0xb4d8('0xd')]);router[_0xb4d8('0x9')](_0xb4d8('0xe'),auth[_0xb4d8('0xc')](),controller[_0xb4d8('0xf')]);router[_0xb4d8('0x9')](_0xb4d8('0x10'),auth[_0xb4d8('0xc')](),controller[_0xb4d8('0x11')]);router[_0xb4d8('0x9')](_0xb4d8('0x12'),auth[_0xb4d8('0xc')](),controller['getTeams']);router[_0xb4d8('0x9')](_0xb4d8('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0xb4d8('0x14')]('/',auth[_0xb4d8('0xc')](),controller[_0xb4d8('0x15')]);router[_0xb4d8('0x14')](_0xb4d8('0x12'),auth[_0xb4d8('0xc')](),controller[_0xb4d8('0x16')]);router[_0xb4d8('0x14')](_0xb4d8('0x13'),auth[_0xb4d8('0xc')](),controller[_0xb4d8('0x17')]);router[_0xb4d8('0x18')]('/:id',auth[_0xb4d8('0xc')](),controller[_0xb4d8('0x19')]);router['delete'](_0xb4d8('0xe'),auth[_0xb4d8('0xc')](),controller[_0xb4d8('0x1a')]);router['delete']('/:id/teams',auth[_0xb4d8('0xc')](),controller[_0xb4d8('0x1b')]);router[_0xb4d8('0x1c')](_0xb4d8('0x13'),auth['isAuthenticated'](),controller[_0xb4d8('0x1d')]);module[_0xb4d8('0x1e')]=router; \ No newline at end of file +var _0xb902=['util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents'];(function(_0x51fba1,_0x343c04){var _0x8046c2=function(_0x10c611){while(--_0x10c611){_0x51fba1['push'](_0x51fba1['shift']());}};_0x8046c2(++_0x343c04);}(_0xb902,0x168));var _0x2b90=function(_0x5b019e,_0x427517){_0x5b019e=_0x5b019e-0x0;var _0x5d539b=_0xb902[_0x5b019e];return _0x5d539b;};'use strict';var multer=require('multer');var util=require(_0x2b90('0x0'));var path=require('path');var timeout=require(_0x2b90('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2b90('0x2'));var interaction=require(_0x2b90('0x3'));var config=require(_0x2b90('0x4'));var controller=require(_0x2b90('0x5'));router[_0x2b90('0x6')]('/',auth[_0x2b90('0x7')](),controller['index']);router['get']('/describe',auth[_0x2b90('0x7')](),controller[_0x2b90('0x8')]);router[_0x2b90('0x6')]('/:id',auth[_0x2b90('0x7')](),controller['show']);router[_0x2b90('0x6')](_0x2b90('0x9'),auth[_0x2b90('0x7')](),controller[_0x2b90('0xa')]);router[_0x2b90('0x6')](_0x2b90('0xb'),auth[_0x2b90('0x7')](),controller[_0x2b90('0xc')]);router[_0x2b90('0x6')](_0x2b90('0xd'),auth[_0x2b90('0x7')](),controller['getAgents']);router['post']('/',auth[_0x2b90('0x7')](),controller['create']);router[_0x2b90('0xe')](_0x2b90('0xb'),auth[_0x2b90('0x7')](),controller[_0x2b90('0xf')]);router[_0x2b90('0xe')](_0x2b90('0xd'),auth[_0x2b90('0x7')](),controller[_0x2b90('0x10')]);router[_0x2b90('0x11')](_0x2b90('0x12'),auth['isAuthenticated'](),controller[_0x2b90('0x13')]);router[_0x2b90('0x14')]('/:id',auth[_0x2b90('0x7')](),controller[_0x2b90('0x15')]);router['delete']('/:id/teams',auth[_0x2b90('0x7')](),controller[_0x2b90('0x16')]);router[_0x2b90('0x14')](_0x2b90('0xd'),auth[_0x2b90('0x7')](),controller[_0x2b90('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 685b2e1..8d303a5 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 _0x4f76=['exports','STRING','name','ENUM','beepall','roundrobin','sequelize'];(function(_0x4a7b46,_0x5e916c){var _0x436bee=function(_0x1c98ba){while(--_0x1c98ba){_0x4a7b46['push'](_0x4a7b46['shift']());}};_0x436bee(++_0x5e916c);}(_0x4f76,0x11e));var _0x64f7=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x4f76[_0x2f9467];return _0x39894c;};'use strict';var Sequelize=require(_0x64f7('0x0'));module[_0x64f7('0x1')]={'name':{'type':Sequelize[_0x64f7('0x2')],'unique':_0x64f7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x64f7('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x64f7('0x4')]('rrmemory',_0x64f7('0x5'),_0x64f7('0x6'))}}; \ No newline at end of file +var _0xe2f0=['exports','STRING','name','ENUM','beepall','sequelize'];(function(_0xbd38e,_0x8a55e3){var _0x4f0d41=function(_0x273715){while(--_0x273715){_0xbd38e['push'](_0xbd38e['shift']());}};_0x4f0d41(++_0x8a55e3);}(_0xe2f0,0x83));var _0x0e2f=function(_0x1cb84c,_0x576b00){_0x1cb84c=_0x1cb84c-0x0;var _0x1ff4ed=_0xe2f0[_0x1cb84c];return _0x1ff4ed;};'use strict';var Sequelize=require(_0x0e2f('0x0'));module[_0x0e2f('0x1')]={'name':{'type':Sequelize[_0x0e2f('0x2')],'unique':_0x0e2f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0e2f('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0e2f('0x4')]('rrmemory',_0x0e2f('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 8d5ebcb..7f43ba2 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 _0x08d9=['isEmpty','removeAgents','forEach','userSmsQueue:remove','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','map','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','SmsQueue','findAll','rows','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','SmsQueueId','User','UserId','agent','smsPause','updatedAt','format','SIP','createdAt','Team','order','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','value'];(function(_0x424762,_0x4e3b0e){var _0x5a8a44=function(_0x3c428){while(--_0x3c428){_0x424762['push'](_0x424762['shift']());}};_0x5a8a44(++_0x4e3b0e);}(_0x08d9,0x1a2));var _0x908d=function(_0x1211a8,_0x4de88b){_0x1211a8=_0x1211a8-0x0;var _0x21a1fc=_0x08d9[_0x1211a8];return _0x21a1fc;};'use strict';var emlformat=require(_0x908d('0x0'));var rimraf=require(_0x908d('0x1'));var zipdir=require(_0x908d('0x2'));var jsonpatch=require(_0x908d('0x3'));var rp=require('request-promise');var moment=require(_0x908d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x908d('0x5'));var util=require('util');var path=require(_0x908d('0x6'));var sox=require(_0x908d('0x7'));var csv=require(_0x908d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x908d('0x9'));var _=require(_0x908d('0xa'));var squel=require(_0x908d('0xb'));var crypto=require(_0x908d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x908d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x908d('0xe'));var Papa=require(_0x908d('0xf'));var Redis=require('ioredis');var authService=require(_0x908d('0x10'));var qs=require(_0x908d('0x11'));var as=require(_0x908d('0x12'));var hardwareService=require(_0x908d('0x13'));var logger=require(_0x908d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x908d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x908d('0x16')]=_[_0x908d('0x17')](config[_0x908d('0x16')],{'host':_0x908d('0x18'),'port':0x18eb});var socket=require(_0x908d('0x19'))(new Redis(config[_0x908d('0x16')]));require(_0x908d('0x1a'))[_0x908d('0x1b')](socket);function respondWithStatusCode(_0x22ea46,_0x525688){_0x525688=_0x525688||0xcc;return function(_0x1f8f48){if(_0x1f8f48){return _0x22ea46['sendStatus'](_0x525688);}return _0x22ea46['status'](_0x525688)[_0x908d('0x1c')]();};}function respondWithResult(_0xcc44ca,_0x458426){_0x458426=_0x458426||0xc8;return function(_0x374352){if(_0x374352){return _0xcc44ca[_0x908d('0x1d')](_0x458426)[_0x908d('0x1e')](_0x374352);}};}function respondWithFilteredResult(_0xd7a20e,_0x4b12e8){return function(_0x2ef8de){if(_0x2ef8de){var _0x436ab7=typeof _0x4b12e8[_0x908d('0x1f')]===_0x908d('0x20')&&typeof _0x4b12e8[_0x908d('0x21')]==='undefined';var _0x31953d=_0x2ef8de[_0x908d('0x22')];var _0x437b2f=_0x436ab7?0x0:_0x4b12e8[_0x908d('0x1f')];var _0x4e5dff=_0x436ab7?_0x2ef8de[_0x908d('0x22')]:_0x4b12e8[_0x908d('0x1f')]+_0x4b12e8['limit'];var _0x44b85e;if(_0x4e5dff>=_0x31953d){_0x4e5dff=_0x31953d;_0x44b85e=0xc8;}else{_0x44b85e=0xce;}_0xd7a20e[_0x908d('0x1d')](_0x44b85e);return _0xd7a20e[_0x908d('0x23')](_0x908d('0x24'),_0x437b2f+'-'+_0x4e5dff+'/'+_0x31953d)[_0x908d('0x1e')](_0x2ef8de);}return null;};}function patchUpdates(_0x4da94e){return function(_0x34e250){try{jsonpatch[_0x908d('0x25')](_0x34e250,_0x4da94e,!![]);}catch(_0x377480){return BPromise[_0x908d('0x26')](_0x377480);}return _0x34e250[_0x908d('0x27')]();};}function saveUpdates(_0x535855,_0x30d0e6){return function(_0x41c619){if(_0x41c619){return _0x41c619[_0x908d('0x28')](_0x535855)[_0x908d('0x29')](function(_0x543ece){return _0x543ece;});}return null;};}function removeEntity(_0x1ce027,_0x957401){return function(_0x4587de){if(_0x4587de){return _0x4587de[_0x908d('0x2a')]()['then'](function(){var _0x10aeb3=_0x4587de[_0x908d('0x2b')]({'plain':!![]});var _0x93e582='SmsQueues';return db[_0x908d('0x2c')][_0x908d('0x2a')]({'where':{'type':_0x93e582,'resourceId':_0x10aeb3['id']}})['then'](function(){return _0x4587de;});})['then'](function(){_0x1ce027[_0x908d('0x1d')](0xcc)[_0x908d('0x1c')]();});}};}function handleEntityNotFound(_0x3ff7de,_0x247789){return function(_0x48fd1b){if(!_0x48fd1b){_0x3ff7de[_0x908d('0x2d')](0x194);}return _0x48fd1b;};}function handleError(_0x288efb,_0x3981db){_0x3981db=_0x3981db||0x1f4;return function(_0x1adb7b){logger[_0x908d('0x2e')](_0x1adb7b[_0x908d('0x2f')]);if(_0x1adb7b[_0x908d('0x30')]){delete _0x1adb7b[_0x908d('0x30')];}_0x288efb[_0x908d('0x1d')](_0x3981db)['send'](_0x1adb7b);};}exports['index']=function(_0x377361,_0x472eda){var _0x1bb3b6={},_0x349f28={},_0x5ccc3e={'count':0x0,'rows':[]};var _0x73106b=_[_0x908d('0x31')](db['SmsQueue'][_0x908d('0x32')],function(_0x3def79){return{'name':_0x3def79['fieldName'],'type':_0x3def79[_0x908d('0x33')]['key']};});_0x349f28[_0x908d('0x34')]=_[_0x908d('0x31')](_0x73106b,_0x908d('0x30'));_0x349f28['query']=_[_0x908d('0x35')](_0x377361[_0x908d('0x36')]);_0x349f28[_0x908d('0x37')]=_[_0x908d('0x38')](_0x349f28[_0x908d('0x34')],_0x349f28[_0x908d('0x36')]);_0x1bb3b6['attributes']=_['intersection'](_0x349f28['model'],qs['fields'](_0x377361[_0x908d('0x36')][_0x908d('0x39')]));_0x1bb3b6[_0x908d('0x3a')]=_0x1bb3b6[_0x908d('0x3a')][_0x908d('0x3b')]?_0x1bb3b6[_0x908d('0x3a')]:_0x349f28[_0x908d('0x34')];if(!_0x377361[_0x908d('0x36')][_0x908d('0x3c')](_0x908d('0x3d'))){_0x1bb3b6['limit']=qs['limit'](_0x377361[_0x908d('0x36')][_0x908d('0x21')]);_0x1bb3b6[_0x908d('0x1f')]=qs[_0x908d('0x1f')](_0x377361[_0x908d('0x36')][_0x908d('0x1f')]);}_0x1bb3b6['order']=qs[_0x908d('0x3e')](_0x377361[_0x908d('0x36')]['sort']);_0x1bb3b6['where']=qs[_0x908d('0x37')](_[_0x908d('0x3f')](_0x377361[_0x908d('0x36')],_0x349f28[_0x908d('0x37')]),_0x73106b);if(_0x377361['query'][_0x908d('0x40')]){_0x1bb3b6[_0x908d('0x41')]=_[_0x908d('0x42')](_0x1bb3b6[_0x908d('0x41')],{'$or':_[_0x908d('0x31')](_0x73106b,function(_0x13d955){if(_0x13d955[_0x908d('0x33')]!==_0x908d('0x43')){var _0x3dae5a={};_0x3dae5a[_0x13d955[_0x908d('0x30')]]={'$like':'%'+_0x377361[_0x908d('0x36')][_0x908d('0x40')]+'%'};return _0x3dae5a;}})});}_0x1bb3b6=_[_0x908d('0x42')]({},_0x1bb3b6,_0x377361[_0x908d('0x44')]);var _0x362065={'where':_0x1bb3b6[_0x908d('0x41')]};return db[_0x908d('0x45')][_0x908d('0x22')](_0x362065)[_0x908d('0x29')](function(_0x4ab054){_0x5ccc3e[_0x908d('0x22')]=_0x4ab054;if(_0x377361[_0x908d('0x36')]['includeAll']){_0x1bb3b6['include']=[{'all':!![]}];}return db[_0x908d('0x45')][_0x908d('0x46')](_0x1bb3b6);})[_0x908d('0x29')](function(_0x1ca957){_0x5ccc3e[_0x908d('0x47')]=_0x1ca957;return _0x5ccc3e;})['then'](respondWithFilteredResult(_0x472eda,_0x1bb3b6))['catch'](handleError(_0x472eda,null));};exports['show']=function(_0x2ffb0b,_0x45a559){var _0x4cba7b={'raw':!![],'where':{'id':_0x2ffb0b[_0x908d('0x48')]['id']}},_0x2853b9={};_0x2853b9[_0x908d('0x34')]=_[_0x908d('0x35')](db[_0x908d('0x45')][_0x908d('0x32')]);_0x2853b9[_0x908d('0x36')]=_[_0x908d('0x35')](_0x2ffb0b[_0x908d('0x36')]);_0x2853b9['filters']=_[_0x908d('0x38')](_0x2853b9['model'],_0x2853b9[_0x908d('0x36')]);_0x4cba7b['attributes']=_[_0x908d('0x38')](_0x2853b9[_0x908d('0x34')],qs[_0x908d('0x39')](_0x2ffb0b[_0x908d('0x36')]['fields']));_0x4cba7b['attributes']=_0x4cba7b['attributes'][_0x908d('0x3b')]?_0x4cba7b[_0x908d('0x3a')]:_0x2853b9[_0x908d('0x34')];if(_0x2ffb0b[_0x908d('0x36')][_0x908d('0x49')]){_0x4cba7b['include']=[{'all':!![]}];}_0x4cba7b=_[_0x908d('0x42')]({},_0x4cba7b,_0x2ffb0b[_0x908d('0x44')]);return db[_0x908d('0x45')][_0x908d('0x4a')](_0x4cba7b)[_0x908d('0x29')](handleEntityNotFound(_0x45a559,null))['then'](respondWithResult(_0x45a559,null))['catch'](handleError(_0x45a559,null));};exports[_0x908d('0x4b')]=function(_0x19e6a7,_0xa279e5){return db[_0x908d('0x45')][_0x908d('0x4b')](_0x19e6a7[_0x908d('0x4c')],{})[_0x908d('0x29')](function(_0x3adc19){var _0xd39e34=_0x19e6a7[_0x908d('0x4d')][_0x908d('0x2b')]({'plain':!![]});if(!_0xd39e34)throw new Error(_0x908d('0x4e'));if(_0xd39e34[_0x908d('0x4f')]==='user'){var _0x2d634f=_0x3adc19[_0x908d('0x2b')]({'plain':!![]});var _0x560499=_0x908d('0x50');return db['UserProfileSection'][_0x908d('0x4a')]({'where':{'name':_0x560499,'userProfileId':_0xd39e34[_0x908d('0x51')]},'raw':!![]})['then'](function(_0x54d22d){if(_0x54d22d&&_0x54d22d[_0x908d('0x52')]===0x0){return db[_0x908d('0x2c')][_0x908d('0x4b')]({'name':_0x2d634f[_0x908d('0x30')],'resourceId':_0x2d634f['id'],'type':_0x54d22d[_0x908d('0x30')],'sectionId':_0x54d22d['id']},{})[_0x908d('0x29')](function(){return _0x3adc19;});}else{return _0x3adc19;}})[_0x908d('0x53')](function(_0x157837){logger[_0x908d('0x2e')](_0x908d('0x54'),_0x157837);throw _0x157837;});}return _0x3adc19;})['then'](respondWithResult(_0xa279e5,0xc9))[_0x908d('0x53')](handleError(_0xa279e5,null));};exports[_0x908d('0x28')]=function(_0x60b967,_0x1a0936){if(_0x60b967[_0x908d('0x4c')]['id']){delete _0x60b967[_0x908d('0x4c')]['id'];}return db['SmsQueue'][_0x908d('0x4a')]({'where':{'id':_0x60b967[_0x908d('0x48')]['id']}})[_0x908d('0x29')](handleEntityNotFound(_0x1a0936,null))[_0x908d('0x29')](saveUpdates(_0x60b967['body'],null))[_0x908d('0x29')](respondWithResult(_0x1a0936,null))[_0x908d('0x53')](handleError(_0x1a0936,null));};exports['destroy']=function(_0x147784,_0x2df880){return db[_0x908d('0x45')]['find']({'where':{'id':_0x147784[_0x908d('0x48')]['id']}})['then'](handleEntityNotFound(_0x2df880,null))[_0x908d('0x29')](removeEntity(_0x2df880,null))['catch'](handleError(_0x2df880,null));};exports[_0x908d('0x55')]=function(_0x582668,_0x273642){return db[_0x908d('0x45')]['describe']()['then'](respondWithResult(_0x273642,null))[_0x908d('0x53')](handleError(_0x273642,null));};exports['getMembers']=function(_0x4709dd,_0x5e4c57,_0x344f0e){var _0x3799fc={'raw':!![],'where':{}},_0x4bf334={},_0x1ffb4a;return db[_0x908d('0x45')][_0x908d('0x56')]({'where':{'id':_0x4709dd[_0x908d('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e4c57,null))[_0x908d('0x29')](function(_0x44d860){if(_0x44d860){_0x1ffb4a=_0x44d860[_0x908d('0x2b')]({'plain':!![]});_0x4bf334[_0x908d('0x34')]=_[_0x908d('0x35')](db[_0x908d('0x57')][_0x908d('0x32')]);_0x4bf334[_0x908d('0x36')]=_[_0x908d('0x35')](_0x4709dd[_0x908d('0x36')]);_0x4bf334[_0x908d('0x37')]=_[_0x908d('0x38')](_0x4bf334[_0x908d('0x34')],_0x4bf334[_0x908d('0x36')]);_0x3799fc[_0x908d('0x3a')]=_[_0x908d('0x38')](_0x4bf334[_0x908d('0x34')],qs[_0x908d('0x39')](_0x4709dd['query'][_0x908d('0x39')]));_0x3799fc[_0x908d('0x3a')]=_0x3799fc[_0x908d('0x3a')][_0x908d('0x3b')]?_0x3799fc['attributes']:_0x4bf334[_0x908d('0x34')];if(!_0x4709dd[_0x908d('0x36')]['hasOwnProperty'](_0x908d('0x3d'))){_0x3799fc['limit']=qs[_0x908d('0x21')](_0x4709dd['query'][_0x908d('0x21')]);_0x3799fc[_0x908d('0x1f')]=qs['offset'](_0x4709dd[_0x908d('0x36')][_0x908d('0x1f')]);}_0x3799fc['order']=qs['sort'](_0x4709dd['query']['sort']);_0x3799fc[_0x908d('0x41')]=qs[_0x908d('0x37')](_[_0x908d('0x3f')](_0x4709dd[_0x908d('0x36')],_0x4bf334['filters']));_0x3799fc[_0x908d('0x41')][_0x908d('0x58')]=_0x44d860['id'];if(_0x4709dd[_0x908d('0x36')][_0x908d('0x40')]){_0x3799fc['where']=_[_0x908d('0x42')](_0x3799fc[_0x908d('0x41')],{'$or':_['map'](_0x3799fc['attributes'],function(_0x56ccab){var _0x4c8885={};_0x4c8885[_0x56ccab]={'$like':'%'+_0x4709dd[_0x908d('0x36')][_0x908d('0x40')]+'%'};return _0x4c8885;})});}_0x3799fc=_[_0x908d('0x42')]({},_0x3799fc,_0x4709dd[_0x908d('0x44')]);return db[_0x908d('0x57')][_0x908d('0x46')](_0x3799fc);}})[_0x908d('0x29')](function(_0x3a40d6){if(_0x3a40d6){return db[_0x908d('0x59')]['findAndCountAll']({'where':{'id':_[_0x908d('0x31')](_0x3a40d6,_0x908d('0x5a')),'role':_0x908d('0x5b')},'attributes':['id','name',_0x908d('0x5c'),_0x908d('0x5d'),'createdAt']});}})['then'](function(_0xa51cba){if(_0xa51cba){return{'count':_0xa51cba['count'],'rows':_['map'](_0xa51cba[_0x908d('0x47')],function(_0xc8b1da){return{'membername':_0xc8b1da[_0x908d('0x30')],'UserId':_0xc8b1da['id'],'queue_name':_0x1ffb4a[_0x908d('0x30')],'SmsQueueId':_0x1ffb4a['id'],'interface':util[_0x908d('0x5e')]('%s/%s',_0x908d('0x5f'),_0xc8b1da[_0x908d('0x30')]),'penalty':0x0,'paused':_0xc8b1da[_0x908d('0x5c')],'createdAt':_0xc8b1da[_0x908d('0x60')],'updatedAt':_0xc8b1da[_0x908d('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x908d('0x29')](respondWithFilteredResult(_0x5e4c57,_0x3799fc))[_0x908d('0x53')](handleError(_0x5e4c57,null));};exports['getTeams']=function(_0x50873f,_0x275733,_0x45f84a){var _0xeadc6b={};var _0x5daf01={};var _0xe756a7;var _0x3187a8;return db['SmsQueue']['findOne']({'where':{'id':_0x50873f[_0x908d('0x48')]['id']}})[_0x908d('0x29')](handleEntityNotFound(_0x275733,null))[_0x908d('0x29')](function(_0x462363){if(_0x462363){_0xe756a7=_0x462363;_0x5daf01[_0x908d('0x34')]=_[_0x908d('0x35')](db[_0x908d('0x61')]['rawAttributes']);_0x5daf01[_0x908d('0x36')]=_[_0x908d('0x35')](_0x50873f[_0x908d('0x36')]);_0x5daf01[_0x908d('0x37')]=_[_0x908d('0x38')](_0x5daf01[_0x908d('0x34')],_0x5daf01[_0x908d('0x36')]);_0xeadc6b[_0x908d('0x3a')]=_['intersection'](_0x5daf01[_0x908d('0x34')],qs['fields'](_0x50873f[_0x908d('0x36')][_0x908d('0x39')]));_0xeadc6b['attributes']=_0xeadc6b['attributes'][_0x908d('0x3b')]?_0xeadc6b[_0x908d('0x3a')]:_0x5daf01['model'];_0xeadc6b[_0x908d('0x62')]=qs[_0x908d('0x3e')](_0x50873f['query'][_0x908d('0x3e')]);_0xeadc6b[_0x908d('0x41')]=qs[_0x908d('0x37')](_[_0x908d('0x3f')](_0x50873f['query'],_0x5daf01[_0x908d('0x37')]));if(_0x50873f[_0x908d('0x36')][_0x908d('0x40')]){_0xeadc6b[_0x908d('0x41')]=_[_0x908d('0x42')](_0xeadc6b['where'],{'$or':_['map'](_0xeadc6b[_0x908d('0x3a')],function(_0x51fe7c){var _0x138381={};_0x138381[_0x51fe7c]={'$like':'%'+_0x50873f[_0x908d('0x36')]['filter']+'%'};return _0x138381;})});}_0xeadc6b=_['merge']({},_0xeadc6b,_0x50873f[_0x908d('0x44')]);return _0xe756a7[_0x908d('0x63')](_0xeadc6b);}})[_0x908d('0x29')](function(_0x1cc965){if(_0x1cc965){_0x3187a8=_0x1cc965[_0x908d('0x3b')];if(!_0x50873f['query']['hasOwnProperty'](_0x908d('0x3d'))){_0xeadc6b[_0x908d('0x21')]=qs[_0x908d('0x21')](_0x50873f[_0x908d('0x36')][_0x908d('0x21')]);_0xeadc6b[_0x908d('0x1f')]=qs[_0x908d('0x1f')](_0x50873f[_0x908d('0x36')][_0x908d('0x1f')]);}return _0xe756a7[_0x908d('0x63')](_0xeadc6b);}})[_0x908d('0x29')](function(_0x560f7d){if(_0x560f7d){return _0x560f7d?{'count':_0x3187a8,'rows':_0x560f7d}:null;}})[_0x908d('0x29')](respondWithResult(_0x275733,null))[_0x908d('0x53')](handleError(_0x275733,null));};exports[_0x908d('0x64')]=function(_0x1ebc27,_0x321089,_0x171706){var _0x4bd79b=_0x1ebc27[_0x908d('0x4c')][_0x908d('0x65')];return db[_0x908d('0x61')]['findAll']({'where':{'id':_0x4bd79b},'attributes':['id'],'include':[{'model':db[_0x908d('0x59')],'as':_0x908d('0x66'),'attributes':['id',_0x908d('0x30'),_0x908d('0x67'),_0x908d('0x68'),'interface'],'raw':!![]}]})['then'](function(_0x1f4e2d){if(_0x1f4e2d){var _0x534e6b=_[_0x908d('0x69')](_0x1f4e2d,function(_0xfb4778){var _0x653374=_0xfb4778[_0x908d('0x2b')]({'plain':!![]});return _0x653374[_0x908d('0x66')];});return db[_0x908d('0x45')][_0x908d('0x4a')]({'where':{'id':_0x1ebc27[_0x908d('0x48')]['id']}})[_0x908d('0x29')](function(_0x44a994){return db[_0x908d('0x6a')][_0x908d('0x6b')](function(_0x1fb50b){return _0x44a994[_0x908d('0x64')](_0x4bd79b,{'transaction':_0x1fb50b})[_0x908d('0x29')](function(){return BPromise[_0x908d('0x6c')](_0x534e6b,function(_0x2c9ce9){return db[_0x908d('0x57')][_0x908d('0x6d')]({'where':{'UserId':_0x2c9ce9['id'],'SmsQueueId':_0x1ebc27[_0x908d('0x48')]['id']},'transaction':_0x1fb50b});});})[_0x908d('0x29')](function(){_0x534e6b['forEach'](function(_0x1ee8b2){socket[_0x908d('0x6e')](_0x908d('0x6f'),{'UserId':_0x1ee8b2['id'],'SmsQueueId':_0x44a994['id']});});});});});}})[_0x908d('0x29')](respondWithStatusCode(_0x321089,null))['catch'](handleError(_0x321089,null));};exports[_0x908d('0x70')]=function(_0x2e3dc8,_0x49e78d,_0x21864b){return db[_0x908d('0x61')][_0x908d('0x46')]({'where':{'id':_0x2e3dc8[_0x908d('0x36')][_0x908d('0x65')]},'attributes':['id'],'include':[{'model':db[_0x908d('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x49e78d,null))[_0x908d('0x29')](function(_0x3f4883){var _0x1c9196=_[_0x908d('0x31')](_0x3f4883,'id');var _0x845a5=[];var _0x1c32b5=[];var _0xf568a5=squel[_0x908d('0x71')]();_0xf568a5[_0x908d('0x72')](_0x908d('0x73'))[_0x908d('0x74')]('team_has_sms_queues','tq')['join'](_0x908d('0x75'),'ut',_0x908d('0x76'))[_0x908d('0x41')](_0x908d('0x77'),_0x2e3dc8[_0x908d('0x48')]['id']);for(var _0x57194a=0x0;_0x57194a<_0x3f4883[_0x908d('0x3b')];_0x57194a+=0x1){let _0x2f7d78=_0x3f4883[_0x57194a];for(var _0xb08d2d=0x0;_0xb08d2d<_0x2f7d78[_0x908d('0x66')]['length'];_0xb08d2d+=0x1){let _0x955487=_0x2f7d78['Agents'][_0xb08d2d];var _0x5566cc=_0xf568a5[_0x908d('0x78')]();_0x5566cc[_0x908d('0x41')](_0x908d('0x79'),_0x955487['id']);_0x1c32b5['push'](db[_0x908d('0x6a')][_0x908d('0x36')](_0x5566cc[_0x908d('0x7a')](),{'type':db[_0x908d('0x6a')][_0x908d('0x7b')][_0x908d('0x7c')]})[_0x908d('0x29')](function(_0xb65c24){if(_0xb65c24['length']===0x1){return _0x955487['id'];}else{var _0x34e116=_[_0x908d('0x7d')](_['map'](_0xb65c24,_0x908d('0x7e')),function(_0x40b056){return _['includes'](_0x1c9196,_0x40b056);});if(_0x34e116){return _0x955487['id'];}}}));}}return BPromise[_0x908d('0x7f')](_0x1c32b5)[_0x908d('0x29')](function(_0x1f4171){_0x845a5=_(_0x845a5)['union'](_0x1f4171)[_0x908d('0x80')]()[_0x908d('0x81')]();return db[_0x908d('0x45')][_0x908d('0x4a')]({'where':{'id':_0x2e3dc8[_0x908d('0x48')]['id']}})['then'](function(_0x1414ca){return db[_0x908d('0x6a')][_0x908d('0x6b')](function(_0x284451){return _0x1414ca[_0x908d('0x70')](_0x2e3dc8[_0x908d('0x36')][_0x908d('0x65')],{'transaction':_0x284451})[_0x908d('0x29')](function(){if(!_[_0x908d('0x82')](_0x845a5)){return _0x1414ca[_0x908d('0x83')](_0x845a5,{'transaction':_0x284451});}})[_0x908d('0x29')](function(){_0x845a5[_0x908d('0x84')](function(_0x51eda0){socket['emit'](_0x908d('0x85'),{'UserId':_0x51eda0,'SmsQueueId':_0x1414ca['id']});});});});});});})[_0x908d('0x29')](respondWithStatusCode(_0x49e78d,null))[_0x908d('0x53')](handleError(_0x49e78d,null));};exports['addAgents']=function(_0x260fd9,_0x5d04a2,_0x3ba9b2){return db['SmsQueue'][_0x908d('0x4a')]({'where':{'id':_0x260fd9[_0x908d('0x48')]['id']}})[_0x908d('0x29')](handleEntityNotFound(_0x5d04a2,null))['then'](function(_0x551d54){if(_0x551d54){return _0x551d54['addAgents'](_0x260fd9[_0x908d('0x4c')][_0x908d('0x65')],_[_0x908d('0x86')](_0x260fd9['body'],[_0x908d('0x65'),'id'])||{})[_0x908d('0x87')](function(_0x2a4c00){for(var _0x25b6b8=0x0;_0x25b6b8<_0x260fd9[_0x908d('0x4c')][_0x908d('0x65')][_0x908d('0x3b')];_0x25b6b8+=0x1){socket[_0x908d('0x6e')]('userSmsQueue:save',{'UserId':Number(_0x260fd9[_0x908d('0x4c')][_0x908d('0x65')][_0x25b6b8]),'SmsQueueId':Number(_0x260fd9['params']['id'])});}return _0x2a4c00;});}})['then'](respondWithResult(_0x5d04a2,null))[_0x908d('0x53')](handleError(_0x5d04a2,null));};exports[_0x908d('0x83')]=function(_0x4024ef,_0x5676b7,_0x277e7e){return db['SmsQueue'][_0x908d('0x4a')]({'where':{'id':_0x4024ef[_0x908d('0x48')]['id']}})[_0x908d('0x29')](handleEntityNotFound(_0x5676b7,null))[_0x908d('0x29')](function(_0x344baf){if(_0x344baf){return _0x344baf[_0x908d('0x83')](_0x4024ef[_0x908d('0x36')]['ids'])['then'](function(){if(_['isArray'](_0x4024ef[_0x908d('0x36')][_0x908d('0x65')])){for(var _0x43a670=0x0;_0x43a670<_0x4024ef[_0x908d('0x36')]['ids'][_0x908d('0x3b')];_0x43a670+=0x1){socket[_0x908d('0x6e')]('userSmsQueue:remove',{'UserId':Number(_0x4024ef[_0x908d('0x36')][_0x908d('0x65')][_0x43a670]),'SmsQueueId':Number(_0x4024ef[_0x908d('0x48')]['id'])});}}else{socket['emit'](_0x908d('0x85'),{'UserId':Number(_0x4024ef[_0x908d('0x36')][_0x908d('0x65')]),'SmsQueueId':Number(_0x4024ef['params']['id'])});}});}})[_0x908d('0x29')](respondWithStatusCode(_0x5676b7,null))[_0x908d('0x53')](handleError(_0x5676b7,null));};exports[_0x908d('0x88')]=function(_0x3ef971,_0x2e5a52,_0x306577){var _0x482a29={};var _0x36c94d={};var _0x1186aa;var _0x14664c;return db[_0x908d('0x45')]['findOne']({'where':{'id':_0x3ef971[_0x908d('0x48')]['id']}})[_0x908d('0x29')](handleEntityNotFound(_0x2e5a52,null))[_0x908d('0x29')](function(_0x178cf5){if(_0x178cf5){_0x1186aa=_0x178cf5;_0x36c94d[_0x908d('0x34')]=_[_0x908d('0x35')](db[_0x908d('0x59')][_0x908d('0x32')]);_0x36c94d[_0x908d('0x36')]=_['keys'](_0x3ef971[_0x908d('0x36')]);_0x36c94d[_0x908d('0x37')]=_[_0x908d('0x38')](_0x36c94d['model'],_0x36c94d[_0x908d('0x36')]);_0x482a29[_0x908d('0x3a')]=_[_0x908d('0x38')](_0x36c94d['model'],qs[_0x908d('0x39')](_0x3ef971[_0x908d('0x36')][_0x908d('0x39')]));_0x482a29[_0x908d('0x3a')]=_0x482a29[_0x908d('0x3a')][_0x908d('0x3b')]?_0x482a29['attributes']:_0x36c94d[_0x908d('0x34')];_0x482a29[_0x908d('0x62')]=qs['sort'](_0x3ef971[_0x908d('0x36')][_0x908d('0x3e')]);_0x482a29[_0x908d('0x41')]=qs[_0x908d('0x37')](_[_0x908d('0x3f')](_0x3ef971[_0x908d('0x36')],_0x36c94d[_0x908d('0x37')]));if(_0x3ef971['query'][_0x908d('0x40')]){_0x482a29[_0x908d('0x41')]=_[_0x908d('0x42')](_0x482a29['where'],{'$or':_[_0x908d('0x31')](_0x482a29[_0x908d('0x3a')],function(_0x33e75b){var _0xcc13c1={};_0xcc13c1[_0x33e75b]={'$like':'%'+_0x3ef971[_0x908d('0x36')][_0x908d('0x40')]+'%'};return _0xcc13c1;})});}_0x482a29=_[_0x908d('0x42')]({},_0x482a29,_0x3ef971['options']);return _0x1186aa[_0x908d('0x88')](_0x482a29);}})[_0x908d('0x29')](function(_0x1cfd7c){if(_0x1cfd7c){_0x14664c=_0x1cfd7c['length'];if(!_0x3ef971[_0x908d('0x36')]['hasOwnProperty']('nolimit')){_0x482a29['limit']=qs['limit'](_0x3ef971['query'][_0x908d('0x21')]);_0x482a29[_0x908d('0x1f')]=qs['offset'](_0x3ef971[_0x908d('0x36')][_0x908d('0x1f')]);}return _0x1186aa[_0x908d('0x88')](_0x482a29);}})[_0x908d('0x29')](function(_0x346938){if(_0x346938){return _0x346938?{'count':_0x14664c,'rows':_0x346938}:null;}})[_0x908d('0x29')](respondWithResult(_0x2e5a52,null))[_0x908d('0x53')](handleError(_0x2e5a52,null));}; \ No newline at end of file +var _0x6e4d=['Team','getTeams','User','online','voicePause','interface','flatMap','sequelize','transaction','each','UserSmsQueue','forEach','emit','Agents','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','all','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','ids','omit','spread','userSmsQueue:save','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','hasOwnProperty','SmsQueueId','agent','updatedAt','createdAt','format','%s/%s','SIP'];(function(_0x303e92,_0x311e3e){var _0x116b09=function(_0x36221d){while(--_0x36221d){_0x303e92['push'](_0x303e92['shift']());}};_0x116b09(++_0x311e3e);}(_0x6e4d,0x1cb));var _0xd6e4=function(_0x285b70,_0x1b74a1){_0x285b70=_0x285b70-0x0;var _0x34e69d=_0x6e4d[_0x285b70];return _0x34e69d;};'use strict';var emlformat=require(_0xd6e4('0x0'));var rimraf=require(_0xd6e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd6e4('0x2'));var rp=require(_0xd6e4('0x3'));var moment=require('moment');var BPromise=require(_0xd6e4('0x4'));var Mustache=require(_0xd6e4('0x5'));var util=require(_0xd6e4('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd6e4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd6e4('0x8'));var _=require(_0xd6e4('0x9'));var squel=require(_0xd6e4('0xa'));var crypto=require(_0xd6e4('0xb'));var jsforce=require(_0xd6e4('0xc'));var deskjs=require(_0xd6e4('0xd'));var toCsv=require(_0xd6e4('0x7'));var querystring=require(_0xd6e4('0xe'));var Papa=require(_0xd6e4('0xf'));var Redis=require(_0xd6e4('0x10'));var authService=require(_0xd6e4('0x11'));var qs=require(_0xd6e4('0x12'));var as=require(_0xd6e4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd6e4('0x14'))(_0xd6e4('0x15'));var utils=require(_0xd6e4('0x16'));var config=require(_0xd6e4('0x17'));var licenseUtil=require(_0xd6e4('0x18'));var db=require(_0xd6e4('0x19'))['db'];config[_0xd6e4('0x1a')]=_['defaults'](config[_0xd6e4('0x1a')],{'host':_0xd6e4('0x1b'),'port':0x18eb});var socket=require(_0xd6e4('0x1c'))(new Redis(config[_0xd6e4('0x1a')]));require(_0xd6e4('0x1d'))[_0xd6e4('0x1e')](socket);function respondWithStatusCode(_0x55bb3c,_0xb10a2a){_0xb10a2a=_0xb10a2a||0xcc;return function(_0x313140){if(_0x313140){return _0x55bb3c[_0xd6e4('0x1f')](_0xb10a2a);}return _0x55bb3c[_0xd6e4('0x20')](_0xb10a2a)[_0xd6e4('0x21')]();};}function respondWithResult(_0x2cd7f7,_0x20f82c){_0x20f82c=_0x20f82c||0xc8;return function(_0x6a16fd){if(_0x6a16fd){return _0x2cd7f7[_0xd6e4('0x20')](_0x20f82c)['json'](_0x6a16fd);}};}function respondWithFilteredResult(_0x1fcf14,_0x27e9da){return function(_0x316637){if(_0x316637){var _0xac6653=typeof _0x27e9da[_0xd6e4('0x22')]===_0xd6e4('0x23')&&typeof _0x27e9da[_0xd6e4('0x24')]===_0xd6e4('0x23');var _0x44ad2b=_0x316637['count'];var _0x595d2e=_0xac6653?0x0:_0x27e9da[_0xd6e4('0x22')];var _0x77dac1=_0xac6653?_0x316637[_0xd6e4('0x25')]:_0x27e9da[_0xd6e4('0x22')]+_0x27e9da[_0xd6e4('0x24')];var _0x1c3bfe;if(_0x77dac1>=_0x44ad2b){_0x77dac1=_0x44ad2b;_0x1c3bfe=0xc8;}else{_0x1c3bfe=0xce;}_0x1fcf14[_0xd6e4('0x20')](_0x1c3bfe);return _0x1fcf14[_0xd6e4('0x26')](_0xd6e4('0x27'),_0x595d2e+'-'+_0x77dac1+'/'+_0x44ad2b)[_0xd6e4('0x28')](_0x316637);}return null;};}function patchUpdates(_0x2fe648){return function(_0x15c07d){try{jsonpatch[_0xd6e4('0x29')](_0x15c07d,_0x2fe648,!![]);}catch(_0x47448f){return BPromise[_0xd6e4('0x2a')](_0x47448f);}return _0x15c07d['save']();};}function saveUpdates(_0x3a8ac9,_0x3bd6ce){return function(_0x22a3c4){if(_0x22a3c4){return _0x22a3c4[_0xd6e4('0x2b')](_0x3a8ac9)[_0xd6e4('0x2c')](function(_0x34e17e){return _0x34e17e;});}return null;};}function removeEntity(_0x5d6fcc,_0x80ce67){return function(_0x1f9bfa){if(_0x1f9bfa){return _0x1f9bfa[_0xd6e4('0x2d')]()[_0xd6e4('0x2c')](function(){var _0x41b06f=_0x1f9bfa[_0xd6e4('0x2e')]({'plain':!![]});var _0x4e6575=_0xd6e4('0x2f');return db[_0xd6e4('0x30')][_0xd6e4('0x2d')]({'where':{'type':_0x4e6575,'resourceId':_0x41b06f['id']}})['then'](function(){return _0x1f9bfa;});})[_0xd6e4('0x2c')](function(){_0x5d6fcc[_0xd6e4('0x20')](0xcc)[_0xd6e4('0x21')]();});}};}function handleEntityNotFound(_0x39835b,_0x1eb2b0){return function(_0x98689){if(!_0x98689){_0x39835b[_0xd6e4('0x1f')](0x194);}return _0x98689;};}function handleError(_0x82f93a,_0x4e75da){_0x4e75da=_0x4e75da||0x1f4;return function(_0x5d9a2e){logger[_0xd6e4('0x31')](_0x5d9a2e[_0xd6e4('0x32')]);if(_0x5d9a2e[_0xd6e4('0x33')]){delete _0x5d9a2e['name'];}_0x82f93a['status'](_0x4e75da)['send'](_0x5d9a2e);};}exports[_0xd6e4('0x34')]=function(_0x3d393c,_0x2da631){var _0x56bc20={},_0x23fb84={},_0x339fac={'count':0x0,'rows':[]};var _0x26bb33=_[_0xd6e4('0x35')](db[_0xd6e4('0x36')][_0xd6e4('0x37')],function(_0x4d1543){return{'name':_0x4d1543[_0xd6e4('0x38')],'type':_0x4d1543[_0xd6e4('0x39')][_0xd6e4('0x3a')]};});_0x23fb84[_0xd6e4('0x3b')]=_['map'](_0x26bb33,'name');_0x23fb84['query']=_[_0xd6e4('0x3c')](_0x3d393c[_0xd6e4('0x3d')]);_0x23fb84[_0xd6e4('0x3e')]=_[_0xd6e4('0x3f')](_0x23fb84[_0xd6e4('0x3b')],_0x23fb84[_0xd6e4('0x3d')]);_0x56bc20['attributes']=_['intersection'](_0x23fb84[_0xd6e4('0x3b')],qs[_0xd6e4('0x40')](_0x3d393c[_0xd6e4('0x3d')][_0xd6e4('0x40')]));_0x56bc20[_0xd6e4('0x41')]=_0x56bc20[_0xd6e4('0x41')][_0xd6e4('0x42')]?_0x56bc20[_0xd6e4('0x41')]:_0x23fb84[_0xd6e4('0x3b')];if(!_0x3d393c[_0xd6e4('0x3d')]['hasOwnProperty'](_0xd6e4('0x43'))){_0x56bc20[_0xd6e4('0x24')]=qs['limit'](_0x3d393c[_0xd6e4('0x3d')][_0xd6e4('0x24')]);_0x56bc20[_0xd6e4('0x22')]=qs[_0xd6e4('0x22')](_0x3d393c[_0xd6e4('0x3d')][_0xd6e4('0x22')]);}_0x56bc20[_0xd6e4('0x44')]=qs[_0xd6e4('0x45')](_0x3d393c[_0xd6e4('0x3d')][_0xd6e4('0x45')]);_0x56bc20[_0xd6e4('0x46')]=qs[_0xd6e4('0x3e')](_[_0xd6e4('0x47')](_0x3d393c[_0xd6e4('0x3d')],_0x23fb84[_0xd6e4('0x3e')]),_0x26bb33);if(_0x3d393c['query']['filter']){_0x56bc20['where']=_[_0xd6e4('0x48')](_0x56bc20['where'],{'$or':_[_0xd6e4('0x35')](_0x26bb33,function(_0x184d0e){if(_0x184d0e['type']!==_0xd6e4('0x49')){var _0x552f51={};_0x552f51[_0x184d0e['name']]={'$like':'%'+_0x3d393c[_0xd6e4('0x3d')][_0xd6e4('0x4a')]+'%'};return _0x552f51;}})});}_0x56bc20=_[_0xd6e4('0x48')]({},_0x56bc20,_0x3d393c[_0xd6e4('0x4b')]);var _0x3dc396={'where':_0x56bc20[_0xd6e4('0x46')]};return db[_0xd6e4('0x36')][_0xd6e4('0x25')](_0x3dc396)[_0xd6e4('0x2c')](function(_0x1edb43){_0x339fac[_0xd6e4('0x25')]=_0x1edb43;if(_0x3d393c[_0xd6e4('0x3d')][_0xd6e4('0x4c')]){_0x56bc20[_0xd6e4('0x4d')]=[{'all':!![]}];}return db[_0xd6e4('0x36')][_0xd6e4('0x4e')](_0x56bc20);})['then'](function(_0x25aa90){_0x339fac['rows']=_0x25aa90;return _0x339fac;})[_0xd6e4('0x2c')](respondWithFilteredResult(_0x2da631,_0x56bc20))['catch'](handleError(_0x2da631,null));};exports[_0xd6e4('0x4f')]=function(_0x1a99be,_0x412b31){var _0xb83d04={'raw':!![],'where':{'id':_0x1a99be[_0xd6e4('0x50')]['id']}},_0xd2b20d={};_0xd2b20d[_0xd6e4('0x3b')]=_['keys'](db['SmsQueue']['rawAttributes']);_0xd2b20d[_0xd6e4('0x3d')]=_[_0xd6e4('0x3c')](_0x1a99be[_0xd6e4('0x3d')]);_0xd2b20d['filters']=_[_0xd6e4('0x3f')](_0xd2b20d[_0xd6e4('0x3b')],_0xd2b20d['query']);_0xb83d04[_0xd6e4('0x41')]=_['intersection'](_0xd2b20d[_0xd6e4('0x3b')],qs['fields'](_0x1a99be[_0xd6e4('0x3d')][_0xd6e4('0x40')]));_0xb83d04[_0xd6e4('0x41')]=_0xb83d04[_0xd6e4('0x41')]['length']?_0xb83d04[_0xd6e4('0x41')]:_0xd2b20d[_0xd6e4('0x3b')];if(_0x1a99be[_0xd6e4('0x3d')][_0xd6e4('0x4c')]){_0xb83d04['include']=[{'all':!![]}];}_0xb83d04=_[_0xd6e4('0x48')]({},_0xb83d04,_0x1a99be[_0xd6e4('0x4b')]);return db[_0xd6e4('0x36')]['find'](_0xb83d04)['then'](handleEntityNotFound(_0x412b31,null))[_0xd6e4('0x2c')](respondWithResult(_0x412b31,null))[_0xd6e4('0x51')](handleError(_0x412b31,null));};exports[_0xd6e4('0x52')]=function(_0x28ee75,_0x5c8db2){return db['SmsQueue'][_0xd6e4('0x52')](_0x28ee75['body'],{})['then'](function(_0x50ab96){var _0x3a0be4=_0x28ee75['user'][_0xd6e4('0x2e')]({'plain':!![]});if(!_0x3a0be4)throw new Error(_0xd6e4('0x53'));if(_0x3a0be4['role']==='user'){var _0x5147a8=_0x50ab96[_0xd6e4('0x2e')]({'plain':!![]});var _0x2103c7=_0xd6e4('0x2f');return db[_0xd6e4('0x54')][_0xd6e4('0x55')]({'where':{'name':_0x2103c7,'userProfileId':_0x3a0be4[_0xd6e4('0x56')]},'raw':!![]})['then'](function(_0x1e8c3a){if(_0x1e8c3a&&_0x1e8c3a[_0xd6e4('0x57')]===0x0){return db[_0xd6e4('0x30')][_0xd6e4('0x52')]({'name':_0x5147a8['name'],'resourceId':_0x5147a8['id'],'type':_0x1e8c3a[_0xd6e4('0x33')],'sectionId':_0x1e8c3a['id']},{})['then'](function(){return _0x50ab96;});}else{return _0x50ab96;}})['catch'](function(_0x148887){logger[_0xd6e4('0x31')](_0xd6e4('0x58'),_0x148887);throw _0x148887;});}return _0x50ab96;})[_0xd6e4('0x2c')](respondWithResult(_0x5c8db2,0xc9))[_0xd6e4('0x51')](handleError(_0x5c8db2,null));};exports[_0xd6e4('0x2b')]=function(_0x2130c4,_0x4d9168){if(_0x2130c4['body']['id']){delete _0x2130c4[_0xd6e4('0x59')]['id'];}return db['SmsQueue'][_0xd6e4('0x55')]({'where':{'id':_0x2130c4[_0xd6e4('0x50')]['id']}})[_0xd6e4('0x2c')](handleEntityNotFound(_0x4d9168,null))['then'](saveUpdates(_0x2130c4[_0xd6e4('0x59')],null))[_0xd6e4('0x2c')](respondWithResult(_0x4d9168,null))[_0xd6e4('0x51')](handleError(_0x4d9168,null));};exports[_0xd6e4('0x2d')]=function(_0x31c0f1,_0x257bcc){return db[_0xd6e4('0x36')][_0xd6e4('0x55')]({'where':{'id':_0x31c0f1['params']['id']}})[_0xd6e4('0x2c')](handleEntityNotFound(_0x257bcc,null))[_0xd6e4('0x2c')](removeEntity(_0x257bcc,null))[_0xd6e4('0x51')](handleError(_0x257bcc,null));};exports[_0xd6e4('0x5a')]=function(_0x47ab4d,_0x3b2b27){return db['SmsQueue'][_0xd6e4('0x5a')]()[_0xd6e4('0x2c')](respondWithResult(_0x3b2b27,null))[_0xd6e4('0x51')](handleError(_0x3b2b27,null));};exports[_0xd6e4('0x5b')]=function(_0xdd3367,_0x9f383d,_0xe62f56){var _0x208452={'raw':!![],'where':{}},_0x45de45={},_0x3eb1a7;return db[_0xd6e4('0x36')][_0xd6e4('0x5c')]({'where':{'id':_0xdd3367[_0xd6e4('0x50')]['id']}})[_0xd6e4('0x2c')](handleEntityNotFound(_0x9f383d,null))[_0xd6e4('0x2c')](function(_0x4281da){if(_0x4281da){_0x3eb1a7=_0x4281da[_0xd6e4('0x2e')]({'plain':!![]});_0x45de45[_0xd6e4('0x3b')]=_[_0xd6e4('0x3c')](db['UserSmsQueue'][_0xd6e4('0x37')]);_0x45de45[_0xd6e4('0x3d')]=_[_0xd6e4('0x3c')](_0xdd3367[_0xd6e4('0x3d')]);_0x45de45[_0xd6e4('0x3e')]=_[_0xd6e4('0x3f')](_0x45de45['model'],_0x45de45[_0xd6e4('0x3d')]);_0x208452[_0xd6e4('0x41')]=_['intersection'](_0x45de45[_0xd6e4('0x3b')],qs[_0xd6e4('0x40')](_0xdd3367[_0xd6e4('0x3d')][_0xd6e4('0x40')]));_0x208452[_0xd6e4('0x41')]=_0x208452[_0xd6e4('0x41')][_0xd6e4('0x42')]?_0x208452[_0xd6e4('0x41')]:_0x45de45[_0xd6e4('0x3b')];if(!_0xdd3367['query'][_0xd6e4('0x5d')](_0xd6e4('0x43'))){_0x208452[_0xd6e4('0x24')]=qs[_0xd6e4('0x24')](_0xdd3367[_0xd6e4('0x3d')][_0xd6e4('0x24')]);_0x208452[_0xd6e4('0x22')]=qs[_0xd6e4('0x22')](_0xdd3367[_0xd6e4('0x3d')][_0xd6e4('0x22')]);}_0x208452[_0xd6e4('0x44')]=qs[_0xd6e4('0x45')](_0xdd3367[_0xd6e4('0x3d')][_0xd6e4('0x45')]);_0x208452['where']=qs[_0xd6e4('0x3e')](_['pick'](_0xdd3367[_0xd6e4('0x3d')],_0x45de45['filters']));_0x208452[_0xd6e4('0x46')][_0xd6e4('0x5e')]=_0x4281da['id'];if(_0xdd3367[_0xd6e4('0x3d')][_0xd6e4('0x4a')]){_0x208452[_0xd6e4('0x46')]=_['merge'](_0x208452['where'],{'$or':_[_0xd6e4('0x35')](_0x208452[_0xd6e4('0x41')],function(_0x3b74e5){var _0x16f0c1={};_0x16f0c1[_0x3b74e5]={'$like':'%'+_0xdd3367[_0xd6e4('0x3d')][_0xd6e4('0x4a')]+'%'};return _0x16f0c1;})});}_0x208452=_[_0xd6e4('0x48')]({},_0x208452,_0xdd3367[_0xd6e4('0x4b')]);return db['UserSmsQueue'][_0xd6e4('0x4e')](_0x208452);}})[_0xd6e4('0x2c')](function(_0x154b10){if(_0x154b10){return db['User']['findAndCountAll']({'where':{'id':_[_0xd6e4('0x35')](_0x154b10,'UserId'),'role':_0xd6e4('0x5f')},'attributes':['id',_0xd6e4('0x33'),'smsPause',_0xd6e4('0x60'),_0xd6e4('0x61')]});}})[_0xd6e4('0x2c')](function(_0x6fc7c9){if(_0x6fc7c9){return{'count':_0x6fc7c9[_0xd6e4('0x25')],'rows':_['map'](_0x6fc7c9['rows'],function(_0x537481){return{'membername':_0x537481[_0xd6e4('0x33')],'UserId':_0x537481['id'],'queue_name':_0x3eb1a7[_0xd6e4('0x33')],'SmsQueueId':_0x3eb1a7['id'],'interface':util[_0xd6e4('0x62')](_0xd6e4('0x63'),_0xd6e4('0x64'),_0x537481[_0xd6e4('0x33')]),'penalty':0x0,'paused':_0x537481['smsPause'],'createdAt':_0x537481['createdAt'],'updatedAt':_0x537481['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd6e4('0x2c')](respondWithFilteredResult(_0x9f383d,_0x208452))[_0xd6e4('0x51')](handleError(_0x9f383d,null));};exports['getTeams']=function(_0x384c5f,_0x5c6979,_0x33faaf){var _0x9ca99e={};var _0x166c23={};var _0x42d48e;var _0x5e7925;return db[_0xd6e4('0x36')]['findOne']({'where':{'id':_0x384c5f['params']['id']}})[_0xd6e4('0x2c')](handleEntityNotFound(_0x5c6979,null))['then'](function(_0x31ccab){if(_0x31ccab){_0x42d48e=_0x31ccab;_0x166c23['model']=_[_0xd6e4('0x3c')](db[_0xd6e4('0x65')][_0xd6e4('0x37')]);_0x166c23[_0xd6e4('0x3d')]=_[_0xd6e4('0x3c')](_0x384c5f[_0xd6e4('0x3d')]);_0x166c23[_0xd6e4('0x3e')]=_[_0xd6e4('0x3f')](_0x166c23['model'],_0x166c23[_0xd6e4('0x3d')]);_0x9ca99e[_0xd6e4('0x41')]=_[_0xd6e4('0x3f')](_0x166c23[_0xd6e4('0x3b')],qs['fields'](_0x384c5f[_0xd6e4('0x3d')][_0xd6e4('0x40')]));_0x9ca99e[_0xd6e4('0x41')]=_0x9ca99e[_0xd6e4('0x41')]['length']?_0x9ca99e[_0xd6e4('0x41')]:_0x166c23[_0xd6e4('0x3b')];_0x9ca99e[_0xd6e4('0x44')]=qs[_0xd6e4('0x45')](_0x384c5f[_0xd6e4('0x3d')][_0xd6e4('0x45')]);_0x9ca99e[_0xd6e4('0x46')]=qs[_0xd6e4('0x3e')](_['pick'](_0x384c5f[_0xd6e4('0x3d')],_0x166c23['filters']));if(_0x384c5f['query']['filter']){_0x9ca99e[_0xd6e4('0x46')]=_[_0xd6e4('0x48')](_0x9ca99e[_0xd6e4('0x46')],{'$or':_[_0xd6e4('0x35')](_0x9ca99e[_0xd6e4('0x41')],function(_0x109f48){var _0x189f12={};_0x189f12[_0x109f48]={'$like':'%'+_0x384c5f[_0xd6e4('0x3d')][_0xd6e4('0x4a')]+'%'};return _0x189f12;})});}_0x9ca99e=_[_0xd6e4('0x48')]({},_0x9ca99e,_0x384c5f[_0xd6e4('0x4b')]);return _0x42d48e[_0xd6e4('0x66')](_0x9ca99e);}})[_0xd6e4('0x2c')](function(_0x2783f4){if(_0x2783f4){_0x5e7925=_0x2783f4['length'];if(!_0x384c5f[_0xd6e4('0x3d')]['hasOwnProperty'](_0xd6e4('0x43'))){_0x9ca99e[_0xd6e4('0x24')]=qs[_0xd6e4('0x24')](_0x384c5f['query'][_0xd6e4('0x24')]);_0x9ca99e[_0xd6e4('0x22')]=qs[_0xd6e4('0x22')](_0x384c5f['query'][_0xd6e4('0x22')]);}return _0x42d48e[_0xd6e4('0x66')](_0x9ca99e);}})[_0xd6e4('0x2c')](function(_0x2fa187){if(_0x2fa187){return _0x2fa187?{'count':_0x5e7925,'rows':_0x2fa187}:null;}})[_0xd6e4('0x2c')](respondWithResult(_0x5c6979,null))[_0xd6e4('0x51')](handleError(_0x5c6979,null));};exports['addTeams']=function(_0x3f243c,_0x2eb07d,_0x295982){var _0x542890=_0x3f243c['body']['ids'];return db[_0xd6e4('0x65')][_0xd6e4('0x4e')]({'where':{'id':_0x542890},'attributes':['id'],'include':[{'model':db[_0xd6e4('0x67')],'as':'Agents','attributes':['id',_0xd6e4('0x33'),_0xd6e4('0x68'),_0xd6e4('0x69'),_0xd6e4('0x6a')],'raw':!![]}]})[_0xd6e4('0x2c')](function(_0x591056){if(_0x591056){var _0x1e93d7=_[_0xd6e4('0x6b')](_0x591056,function(_0xf06691){var _0x141fd3=_0xf06691[_0xd6e4('0x2e')]({'plain':!![]});return _0x141fd3['Agents'];});return db[_0xd6e4('0x36')][_0xd6e4('0x55')]({'where':{'id':_0x3f243c[_0xd6e4('0x50')]['id']}})[_0xd6e4('0x2c')](function(_0x299568){return db[_0xd6e4('0x6c')][_0xd6e4('0x6d')](function(_0x5a505e){return _0x299568['addTeams'](_0x542890,{'transaction':_0x5a505e})[_0xd6e4('0x2c')](function(){return BPromise[_0xd6e4('0x6e')](_0x1e93d7,function(_0x400a57){return db[_0xd6e4('0x6f')]['findOrCreate']({'where':{'UserId':_0x400a57['id'],'SmsQueueId':_0x3f243c[_0xd6e4('0x50')]['id']},'transaction':_0x5a505e});});})['then'](function(){_0x1e93d7[_0xd6e4('0x70')](function(_0x591737){socket[_0xd6e4('0x71')]('userSmsQueue:save',{'UserId':_0x591737['id'],'SmsQueueId':_0x299568['id']});});});});});}})['then'](respondWithStatusCode(_0x2eb07d,null))['catch'](handleError(_0x2eb07d,null));};exports['removeTeams']=function(_0x545416,_0x59c3c7,_0x117ce1){return db[_0xd6e4('0x65')][_0xd6e4('0x4e')]({'where':{'id':_0x545416[_0xd6e4('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd6e4('0x67')],'as':_0xd6e4('0x72'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x59c3c7,null))[_0xd6e4('0x2c')](function(_0x1535f8){var _0x288443=_[_0xd6e4('0x35')](_0x1535f8,'id');var _0x18f803=[];var _0x51b377=[];var _0x59555e=squel[_0xd6e4('0x73')]();_0x59555e[_0xd6e4('0x74')](_0xd6e4('0x75'))[_0xd6e4('0x76')](_0xd6e4('0x77'),'tq')[_0xd6e4('0x78')](_0xd6e4('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd6e4('0x46')](_0xd6e4('0x7a'),_0x545416[_0xd6e4('0x50')]['id']);for(var _0x2949a4=0x0;_0x2949a4<_0x1535f8['length'];_0x2949a4+=0x1){let _0x25f8f5=_0x1535f8[_0x2949a4];for(var _0xd3bf1d=0x0;_0xd3bf1d<_0x25f8f5['Agents'][_0xd6e4('0x42')];_0xd3bf1d+=0x1){let _0x40a82c=_0x25f8f5[_0xd6e4('0x72')][_0xd3bf1d];var _0x324bd9=_0x59555e[_0xd6e4('0x7b')]();_0x324bd9['where'](_0xd6e4('0x7c'),_0x40a82c['id']);_0x51b377['push'](db['sequelize'][_0xd6e4('0x3d')](_0x324bd9[_0xd6e4('0x7d')](),{'type':db[_0xd6e4('0x6c')][_0xd6e4('0x7e')][_0xd6e4('0x7f')]})['then'](function(_0x3f801b){if(_0x3f801b[_0xd6e4('0x42')]===0x1){return _0x40a82c['id'];}else{var _0x1e93a4=_['every'](_['map'](_0x3f801b,_0xd6e4('0x80')),function(_0x5a783b){return _['includes'](_0x288443,_0x5a783b);});if(_0x1e93a4){return _0x40a82c['id'];}}}));}}return BPromise[_0xd6e4('0x81')](_0x51b377)[_0xd6e4('0x2c')](function(_0x560f64){_0x18f803=_(_0x18f803)['union'](_0x560f64)['compact']()['value']();return db[_0xd6e4('0x36')][_0xd6e4('0x55')]({'where':{'id':_0x545416['params']['id']}})['then'](function(_0x23437e){return db[_0xd6e4('0x6c')][_0xd6e4('0x6d')](function(_0x5a28e6){return _0x23437e[_0xd6e4('0x82')](_0x545416[_0xd6e4('0x3d')]['ids'],{'transaction':_0x5a28e6})[_0xd6e4('0x2c')](function(){if(!_[_0xd6e4('0x83')](_0x18f803)){return _0x23437e[_0xd6e4('0x84')](_0x18f803,{'transaction':_0x5a28e6});}})[_0xd6e4('0x2c')](function(){_0x18f803[_0xd6e4('0x70')](function(_0xb918a8){socket[_0xd6e4('0x71')](_0xd6e4('0x85'),{'UserId':_0xb918a8,'SmsQueueId':_0x23437e['id']});});});});});});})[_0xd6e4('0x2c')](respondWithStatusCode(_0x59c3c7,null))[_0xd6e4('0x51')](handleError(_0x59c3c7,null));};exports[_0xd6e4('0x86')]=function(_0x268523,_0x2cc595,_0x32d3bf){return db[_0xd6e4('0x36')]['find']({'where':{'id':_0x268523[_0xd6e4('0x50')]['id']}})[_0xd6e4('0x2c')](handleEntityNotFound(_0x2cc595,null))[_0xd6e4('0x2c')](function(_0x3e2cb0){if(_0x3e2cb0){return _0x3e2cb0[_0xd6e4('0x86')](_0x268523['body'][_0xd6e4('0x87')],_[_0xd6e4('0x88')](_0x268523['body'],[_0xd6e4('0x87'),'id'])||{})[_0xd6e4('0x89')](function(_0x2132d5){for(var _0x23daca=0x0;_0x23daca<_0x268523['body'][_0xd6e4('0x87')][_0xd6e4('0x42')];_0x23daca+=0x1){socket[_0xd6e4('0x71')](_0xd6e4('0x8a'),{'UserId':Number(_0x268523[_0xd6e4('0x59')][_0xd6e4('0x87')][_0x23daca]),'SmsQueueId':Number(_0x268523[_0xd6e4('0x50')]['id'])});}return _0x2132d5;});}})['then'](respondWithResult(_0x2cc595,null))[_0xd6e4('0x51')](handleError(_0x2cc595,null));};exports[_0xd6e4('0x84')]=function(_0xcf2b8e,_0x450af9,_0x57371c){return db[_0xd6e4('0x36')][_0xd6e4('0x55')]({'where':{'id':_0xcf2b8e['params']['id']}})['then'](handleEntityNotFound(_0x450af9,null))[_0xd6e4('0x2c')](function(_0x16e229){if(_0x16e229){return _0x16e229[_0xd6e4('0x84')](_0xcf2b8e[_0xd6e4('0x3d')][_0xd6e4('0x87')])[_0xd6e4('0x2c')](function(){if(_['isArray'](_0xcf2b8e[_0xd6e4('0x3d')][_0xd6e4('0x87')])){for(var _0x3eed79=0x0;_0x3eed79<_0xcf2b8e[_0xd6e4('0x3d')][_0xd6e4('0x87')]['length'];_0x3eed79+=0x1){socket[_0xd6e4('0x71')](_0xd6e4('0x85'),{'UserId':Number(_0xcf2b8e['query'][_0xd6e4('0x87')][_0x3eed79]),'SmsQueueId':Number(_0xcf2b8e[_0xd6e4('0x50')]['id'])});}}else{socket[_0xd6e4('0x71')](_0xd6e4('0x85'),{'UserId':Number(_0xcf2b8e[_0xd6e4('0x3d')][_0xd6e4('0x87')]),'SmsQueueId':Number(_0xcf2b8e[_0xd6e4('0x50')]['id'])});}});}})[_0xd6e4('0x2c')](respondWithStatusCode(_0x450af9,null))['catch'](handleError(_0x450af9,null));};exports[_0xd6e4('0x8b')]=function(_0xaabd2c,_0xbd2129,_0x23558e){var _0x59b898={};var _0x57cea3={};var _0x132e74;var _0x351f4d;return db['SmsQueue'][_0xd6e4('0x5c')]({'where':{'id':_0xaabd2c[_0xd6e4('0x50')]['id']}})[_0xd6e4('0x2c')](handleEntityNotFound(_0xbd2129,null))[_0xd6e4('0x2c')](function(_0x4c70a0){if(_0x4c70a0){_0x132e74=_0x4c70a0;_0x57cea3[_0xd6e4('0x3b')]=_['keys'](db[_0xd6e4('0x67')]['rawAttributes']);_0x57cea3[_0xd6e4('0x3d')]=_['keys'](_0xaabd2c[_0xd6e4('0x3d')]);_0x57cea3['filters']=_['intersection'](_0x57cea3['model'],_0x57cea3['query']);_0x59b898['attributes']=_[_0xd6e4('0x3f')](_0x57cea3[_0xd6e4('0x3b')],qs[_0xd6e4('0x40')](_0xaabd2c[_0xd6e4('0x3d')][_0xd6e4('0x40')]));_0x59b898[_0xd6e4('0x41')]=_0x59b898[_0xd6e4('0x41')]['length']?_0x59b898[_0xd6e4('0x41')]:_0x57cea3[_0xd6e4('0x3b')];_0x59b898[_0xd6e4('0x44')]=qs[_0xd6e4('0x45')](_0xaabd2c['query'][_0xd6e4('0x45')]);_0x59b898[_0xd6e4('0x46')]=qs['filters'](_['pick'](_0xaabd2c[_0xd6e4('0x3d')],_0x57cea3[_0xd6e4('0x3e')]));if(_0xaabd2c[_0xd6e4('0x3d')]['filter']){_0x59b898['where']=_[_0xd6e4('0x48')](_0x59b898[_0xd6e4('0x46')],{'$or':_[_0xd6e4('0x35')](_0x59b898[_0xd6e4('0x41')],function(_0x5c6b3b){var _0x4a3d47={};_0x4a3d47[_0x5c6b3b]={'$like':'%'+_0xaabd2c[_0xd6e4('0x3d')][_0xd6e4('0x4a')]+'%'};return _0x4a3d47;})});}_0x59b898=_[_0xd6e4('0x48')]({},_0x59b898,_0xaabd2c[_0xd6e4('0x4b')]);return _0x132e74[_0xd6e4('0x8b')](_0x59b898);}})[_0xd6e4('0x2c')](function(_0x131886){if(_0x131886){_0x351f4d=_0x131886[_0xd6e4('0x42')];if(!_0xaabd2c[_0xd6e4('0x3d')][_0xd6e4('0x5d')](_0xd6e4('0x43'))){_0x59b898[_0xd6e4('0x24')]=qs['limit'](_0xaabd2c[_0xd6e4('0x3d')]['limit']);_0x59b898[_0xd6e4('0x22')]=qs[_0xd6e4('0x22')](_0xaabd2c['query']['offset']);}return _0x132e74[_0xd6e4('0x8b')](_0x59b898);}})[_0xd6e4('0x2c')](function(_0x527334){if(_0x527334){return _0x527334?{'count':_0x351f4d,'rows':_0x527334}:null;}})[_0xd6e4('0x2c')](respondWithResult(_0xbd2129,null))[_0xd6e4('0x51')](handleError(_0xbd2129,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 6116526..57bbe20 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 _0x39b5=['remove','emit','hook','exports','events','../../mysqldb','SmsQueue'];(function(_0x49f6b3,_0x9fee31){var _0x48c4db=function(_0x371356){while(--_0x371356){_0x49f6b3['push'](_0x49f6b3['shift']());}};_0x48c4db(++_0x9fee31);}(_0x39b5,0x1a1));var _0x539b=function(_0x59ed67,_0x5eca00){_0x59ed67=_0x59ed67-0x0;var _0x1067ee=_0x39b5[_0x59ed67];return _0x1067ee;};'use strict';var EventEmitter=require(_0x539b('0x0'));var SmsQueue=require(_0x539b('0x1'))['db'][_0x539b('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x539b('0x3')};function emitEvent(_0x298e07){return function(_0x2e2a9a,_0x4a0c5e,_0x1c5ccc){SmsQueueEvents[_0x539b('0x4')](_0x298e07+':'+_0x2e2a9a['id'],_0x2e2a9a);SmsQueueEvents[_0x539b('0x4')](_0x298e07,_0x2e2a9a);_0x1c5ccc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x539b('0x5')](e,emitEvent(event));}}module[_0x539b('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x0553=['update','remove','emit','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x319cb9,_0x4b8d35){var _0x1735fc=function(_0x43b061){while(--_0x43b061){_0x319cb9['push'](_0x319cb9['shift']());}};_0x1735fc(++_0x4b8d35);}(_0x0553,0x1a9));var _0x3055=function(_0x48051b,_0x368d0b){_0x48051b=_0x48051b-0x0;var _0x5669e1=_0x0553[_0x48051b];return _0x5669e1;};'use strict';var EventEmitter=require(_0x3055('0x0'));var SmsQueue=require(_0x3055('0x1'))['db'][_0x3055('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3055('0x3')](0x0);var events={'afterCreate':_0x3055('0x4'),'afterUpdate':_0x3055('0x5'),'afterDestroy':_0x3055('0x6')};function emitEvent(_0x278802){return function(_0x12ff48,_0x363c53,_0x1b30f2){SmsQueueEvents[_0x3055('0x7')](_0x278802+':'+_0x12ff48['id'],_0x12ff48);SmsQueueEvents[_0x3055('0x7')](_0x278802,_0x12ff48);_0x1b30f2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x3055('0x8')](e,emitEvent(event));}}module[_0x3055('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 42d0805..cc8015f 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 _0xd464=['./smsQueue.attributes','exports','define','sms_queues','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xc7a395,_0xc06bac){var _0xa5ad07=function(_0x2617ba){while(--_0x2617ba){_0xc7a395['push'](_0xc7a395['shift']());}};_0xa5ad07(++_0xc06bac);}(_0xd464,0x190));var _0x4d46=function(_0x11d288,_0x4acdba){_0x11d288=_0x11d288-0x0;var _0x56aca1=_0xd464[_0x11d288];return _0x56aca1;};'use strict';var _=require('lodash');var util=require(_0x4d46('0x0'));var logger=require('../../config/logger')(_0x4d46('0x1'));var moment=require('moment');var BPromise=require(_0x4d46('0x2'));var rp=require(_0x4d46('0x3'));var fs=require('fs');var path=require(_0x4d46('0x4'));var rimraf=require(_0x4d46('0x5'));var config=require(_0x4d46('0x6'));var attributes=require(_0x4d46('0x7'));module[_0x4d46('0x8')]=function(_0x4bef3f,_0x57e386){return _0x4bef3f[_0x4d46('0x9')]('SmsQueue',attributes,{'tableName':_0x4d46('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa10a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues'];(function(_0x96bd22,_0x97de4a){var _0x2643ac=function(_0x1ebb41){while(--_0x1ebb41){_0x96bd22['push'](_0x96bd22['shift']());}};_0x2643ac(++_0x97de4a);}(_0xa10a,0xd8));var _0xaa10=function(_0x2fa652,_0x2b3988){_0x2fa652=_0x2fa652-0x0;var _0x3ad2f3=_0xa10a[_0x2fa652];return _0x3ad2f3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaa10('0x0'))(_0xaa10('0x1'));var moment=require(_0xaa10('0x2'));var BPromise=require(_0xaa10('0x3'));var rp=require(_0xaa10('0x4'));var fs=require('fs');var path=require(_0xaa10('0x5'));var rimraf=require(_0xaa10('0x6'));var config=require(_0xaa10('0x7'));var attributes=require(_0xaa10('0x8'));module['exports']=function(_0x1ea838,_0x34ff0b){return _0x1ea838[_0xaa10('0x9')](_0xaa10('0xa'),attributes,{'tableName':_0xaa10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 31f5428..bac4c3e 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 _0x732e=['model','GetSmsQueue','stringify','ShowSmsQueue','SmsQueue','find','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','SmsQueue,\x20%s,\x20%s','message','catch','options','raw','attributes','limit','include','map'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x732e,0xea));var _0xe732=function(_0x5426e2,_0x5f2968){_0x5426e2=_0x5426e2-0x0;var _0x920dc=_0x732e[_0x5426e2];return _0x920dc;};'use strict';var _=require(_0xe732('0x0'));var util=require('util');var moment=require(_0xe732('0x1'));var BPromise=require(_0xe732('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe732('0x3'))['db'];var utils=require(_0xe732('0x4'));var logger=require(_0xe732('0x5'))(_0xe732('0x6'));var config=require(_0xe732('0x7'));var jayson=require(_0xe732('0x8'));var client=jayson[_0xe732('0x9')][_0xe732('0xa')]({'port':0x232a});config[_0xe732('0xb')]=_[_0xe732('0xc')](config[_0xe732('0xb')],{'host':_0xe732('0xd'),'port':0x18eb});var socket=require(_0xe732('0xe'))(new Redis(config['redis']));require(_0xe732('0xf'))['register'](socket);function respondWithRpcPromise(_0x24e462,_0x404189,_0xd8ec8e){return new BPromise(function(_0x5d2dd9,_0x249720){return client['request'](_0x24e462,_0xd8ec8e)[_0xe732('0x10')](function(_0x47ed52){logger[_0xe732('0x11')]('SmsQueue,\x20%s,\x20%s',_0x404189,_0xe732('0x12'));logger[_0xe732('0x13')](_0xe732('0x14'),_0x404189,_0xe732('0x12'),JSON['stringify'](_0x47ed52));if(_0x47ed52[_0xe732('0x15')]){if(_0x47ed52[_0xe732('0x15')][_0xe732('0x16')]===0x1f4){logger[_0xe732('0x15')](_0xe732('0x17'),_0x404189,_0x47ed52['error'][_0xe732('0x18')]);return _0x249720(_0x47ed52[_0xe732('0x15')][_0xe732('0x18')]);}logger[_0xe732('0x15')](_0xe732('0x17'),_0x404189,_0x47ed52['error'][_0xe732('0x18')]);return _0x5d2dd9(_0x47ed52[_0xe732('0x15')]['message']);}else{logger[_0xe732('0x11')]('SmsQueue,\x20%s,\x20%s',_0x404189,_0xe732('0x12'));_0x5d2dd9(_0x47ed52['result']['message']);}})[_0xe732('0x19')](function(_0x2d69db){logger[_0xe732('0x15')](_0xe732('0x17'),_0x404189,_0x2d69db);_0x249720(_0x2d69db);});});}exports['GetSmsQueue']=function(_0x3e7463){var _0x17fa2c=this;return new Promise(function(_0x21f679,_0x180890){return db['SmsQueue']['findAll']({'raw':_0x3e7463[_0xe732('0x1a')]?_0x3e7463[_0xe732('0x1a')][_0xe732('0x1b')]===undefined?!![]:![]:!![],'where':_0x3e7463[_0xe732('0x1a')]?_0x3e7463[_0xe732('0x1a')]['where']||null:null,'attributes':_0x3e7463[_0xe732('0x1a')]?_0x3e7463[_0xe732('0x1a')][_0xe732('0x1c')]||null:null,'limit':_0x3e7463[_0xe732('0x1a')]?_0x3e7463[_0xe732('0x1a')][_0xe732('0x1d')]||null:null,'include':_0x3e7463[_0xe732('0x1a')]?_0x3e7463[_0xe732('0x1a')][_0xe732('0x1e')]?_['map'](_0x3e7463[_0xe732('0x1a')]['include'],function(_0x34f21f){return{'model':db[_0x34f21f['model']],'as':_0x34f21f['as'],'attributes':_0x34f21f['attributes'],'include':_0x34f21f[_0xe732('0x1e')]?_[_0xe732('0x1f')](_0x34f21f[_0xe732('0x1e')],function(_0x51a890){return{'model':db[_0x51a890[_0xe732('0x20')]],'as':_0x51a890['as'],'attributes':_0x51a890['attributes'],'include':_0x51a890['include']?_[_0xe732('0x1f')](_0x51a890[_0xe732('0x1e')],function(_0x368847){return{'model':db[_0x368847[_0xe732('0x20')]],'as':_0x368847['as'],'attributes':_0x368847[_0xe732('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe732('0x10')](function(_0x1dc298){logger['info'](_0xe732('0x21'),_0x3e7463);logger[_0xe732('0x13')](_0xe732('0x21'),_0x3e7463,JSON[_0xe732('0x22')](_0x1dc298));_0x21f679(_0x1dc298);})[_0xe732('0x19')](function(_0x87b4e7){logger[_0xe732('0x15')]('GetSmsQueue',_0x87b4e7[_0xe732('0x18')],_0x3e7463);_0x180890(_0x17fa2c[_0xe732('0x15')](0x1f4,_0x87b4e7[_0xe732('0x18')]));});});};exports[_0xe732('0x23')]=function(_0x195f48){var _0x355438=this;return new Promise(function(_0x3d9acc,_0x16e525){return db[_0xe732('0x24')][_0xe732('0x25')]({'raw':_0x195f48['options']?_0x195f48['options'][_0xe732('0x1b')]===undefined?!![]:![]:!![],'where':_0x195f48[_0xe732('0x1a')]?_0x195f48['options']['where']||null:null,'attributes':_0x195f48[_0xe732('0x1a')]?_0x195f48['options'][_0xe732('0x1c')]||null:null,'include':_0x195f48[_0xe732('0x1a')]?_0x195f48[_0xe732('0x1a')][_0xe732('0x1e')]?_['map'](_0x195f48[_0xe732('0x1a')][_0xe732('0x1e')],function(_0x1af32d){return{'model':db[_0x1af32d[_0xe732('0x20')]],'as':_0x1af32d['as'],'attributes':_0x1af32d['attributes'],'include':_0x1af32d[_0xe732('0x1e')]?_['map'](_0x1af32d[_0xe732('0x1e')],function(_0x4c4155){return{'model':db[_0x4c4155[_0xe732('0x20')]],'as':_0x4c4155['as'],'attributes':_0x4c4155[_0xe732('0x1c')],'include':_0x4c4155[_0xe732('0x1e')]?_[_0xe732('0x1f')](_0x4c4155[_0xe732('0x1e')],function(_0x18a44a){return{'model':db[_0x18a44a[_0xe732('0x20')]],'as':_0x18a44a['as'],'attributes':_0x18a44a[_0xe732('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe732('0x10')](function(_0x2db773){logger['info'](_0xe732('0x23'),_0x195f48);logger[_0xe732('0x13')](_0xe732('0x23'),_0x195f48,JSON['stringify'](_0x2db773));_0x3d9acc(_0x2db773);})[_0xe732('0x19')](function(_0x237d26){logger[_0xe732('0x15')]('ShowSmsQueue',_0x237d26[_0xe732('0x18')],_0x195f48);_0x16e525(_0x355438['error'](0x1f4,_0x237d26[_0xe732('0x18')]));});});}; \ No newline at end of file +var _0xb714=['attributes','debug','ShowSmsQueue','find','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','include','map','model'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xb714,0x116));var _0x4b71=function(_0x27dfe7,_0x3acd6f){_0x27dfe7=_0x27dfe7-0x0;var _0x9d647c=_0xb714[_0x27dfe7];return _0x9d647c;};'use strict';var _=require(_0x4b71('0x0'));var util=require(_0x4b71('0x1'));var moment=require(_0x4b71('0x2'));var BPromise=require(_0x4b71('0x3'));var rs=require(_0x4b71('0x4'));var fs=require('fs');var Redis=require(_0x4b71('0x5'));var db=require(_0x4b71('0x6'))['db'];var utils=require(_0x4b71('0x7'));var logger=require(_0x4b71('0x8'))(_0x4b71('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4b71('0xa')]['http']({'port':0x232a});config[_0x4b71('0xb')]=_[_0x4b71('0xc')](config[_0x4b71('0xb')],{'host':_0x4b71('0xd'),'port':0x18eb});var socket=require(_0x4b71('0xe'))(new Redis(config[_0x4b71('0xb')]));require(_0x4b71('0xf'))['register'](socket);function respondWithRpcPromise(_0x3892cd,_0x3a294c,_0x149f44){return new BPromise(function(_0x316da2,_0x4d688b){return client['request'](_0x3892cd,_0x149f44)[_0x4b71('0x10')](function(_0x13a8ff){logger[_0x4b71('0x11')](_0x4b71('0x12'),_0x3a294c,_0x4b71('0x13'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x3a294c,'request\x20sent',JSON[_0x4b71('0x14')](_0x13a8ff));if(_0x13a8ff[_0x4b71('0x15')]){if(_0x13a8ff[_0x4b71('0x15')]['code']===0x1f4){logger[_0x4b71('0x15')](_0x4b71('0x12'),_0x3a294c,_0x13a8ff[_0x4b71('0x15')][_0x4b71('0x16')]);return _0x4d688b(_0x13a8ff[_0x4b71('0x15')]['message']);}logger['error'](_0x4b71('0x12'),_0x3a294c,_0x13a8ff[_0x4b71('0x15')][_0x4b71('0x16')]);return _0x316da2(_0x13a8ff[_0x4b71('0x15')][_0x4b71('0x16')]);}else{logger[_0x4b71('0x11')](_0x4b71('0x12'),_0x3a294c,_0x4b71('0x13'));_0x316da2(_0x13a8ff[_0x4b71('0x17')][_0x4b71('0x16')]);}})['catch'](function(_0x3ecc2a){logger[_0x4b71('0x15')](_0x4b71('0x12'),_0x3a294c,_0x3ecc2a);_0x4d688b(_0x3ecc2a);});});}exports[_0x4b71('0x18')]=function(_0x36d27a){var _0x458ba4=this;return new Promise(function(_0x21ce01,_0x1b9568){return db[_0x4b71('0x19')][_0x4b71('0x1a')]({'raw':_0x36d27a[_0x4b71('0x1b')]?_0x36d27a[_0x4b71('0x1b')][_0x4b71('0x1c')]===undefined?!![]:![]:!![],'where':_0x36d27a[_0x4b71('0x1b')]?_0x36d27a[_0x4b71('0x1b')][_0x4b71('0x1d')]||null:null,'attributes':_0x36d27a[_0x4b71('0x1b')]?_0x36d27a[_0x4b71('0x1b')]['attributes']||null:null,'limit':_0x36d27a['options']?_0x36d27a[_0x4b71('0x1b')][_0x4b71('0x1e')]||null:null,'include':_0x36d27a['options']?_0x36d27a['options'][_0x4b71('0x1f')]?_[_0x4b71('0x20')](_0x36d27a[_0x4b71('0x1b')][_0x4b71('0x1f')],function(_0x3d570a){return{'model':db[_0x3d570a[_0x4b71('0x21')]],'as':_0x3d570a['as'],'attributes':_0x3d570a[_0x4b71('0x22')],'include':_0x3d570a[_0x4b71('0x1f')]?_[_0x4b71('0x20')](_0x3d570a[_0x4b71('0x1f')],function(_0x53bf96){return{'model':db[_0x53bf96[_0x4b71('0x21')]],'as':_0x53bf96['as'],'attributes':_0x53bf96[_0x4b71('0x22')],'include':_0x53bf96[_0x4b71('0x1f')]?_[_0x4b71('0x20')](_0x53bf96[_0x4b71('0x1f')],function(_0x3b301a){return{'model':db[_0x3b301a[_0x4b71('0x21')]],'as':_0x3b301a['as'],'attributes':_0x3b301a[_0x4b71('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b08f9){logger[_0x4b71('0x11')](_0x4b71('0x18'),_0x36d27a);logger[_0x4b71('0x23')](_0x4b71('0x18'),_0x36d27a,JSON[_0x4b71('0x14')](_0x4b08f9));_0x21ce01(_0x4b08f9);})['catch'](function(_0x34fa66){logger['error'](_0x4b71('0x18'),_0x34fa66[_0x4b71('0x16')],_0x36d27a);_0x1b9568(_0x458ba4[_0x4b71('0x15')](0x1f4,_0x34fa66[_0x4b71('0x16')]));});});};exports[_0x4b71('0x24')]=function(_0x5244c1){var _0x14e391=this;return new Promise(function(_0x1e8ddb,_0x5acbd9){return db[_0x4b71('0x19')][_0x4b71('0x25')]({'raw':_0x5244c1[_0x4b71('0x1b')]?_0x5244c1[_0x4b71('0x1b')][_0x4b71('0x1c')]===undefined?!![]:![]:!![],'where':_0x5244c1[_0x4b71('0x1b')]?_0x5244c1[_0x4b71('0x1b')][_0x4b71('0x1d')]||null:null,'attributes':_0x5244c1[_0x4b71('0x1b')]?_0x5244c1[_0x4b71('0x1b')]['attributes']||null:null,'include':_0x5244c1[_0x4b71('0x1b')]?_0x5244c1['options'][_0x4b71('0x1f')]?_[_0x4b71('0x20')](_0x5244c1[_0x4b71('0x1b')]['include'],function(_0x58cddf){return{'model':db[_0x58cddf[_0x4b71('0x21')]],'as':_0x58cddf['as'],'attributes':_0x58cddf[_0x4b71('0x22')],'include':_0x58cddf[_0x4b71('0x1f')]?_[_0x4b71('0x20')](_0x58cddf[_0x4b71('0x1f')],function(_0x5169e8){return{'model':db[_0x5169e8[_0x4b71('0x21')]],'as':_0x5169e8['as'],'attributes':_0x5169e8['attributes'],'include':_0x5169e8[_0x4b71('0x1f')]?_[_0x4b71('0x20')](_0x5169e8[_0x4b71('0x1f')],function(_0x3b7f66){return{'model':db[_0x3b7f66[_0x4b71('0x21')]],'as':_0x3b7f66['as'],'attributes':_0x3b7f66['attributes']};}):[]};}):[]};}):[]:[]})[_0x4b71('0x10')](function(_0x3c63ea){logger[_0x4b71('0x11')](_0x4b71('0x24'),_0x5244c1);logger[_0x4b71('0x23')](_0x4b71('0x24'),_0x5244c1,JSON[_0x4b71('0x14')](_0x3c63ea));_0x1e8ddb(_0x3c63ea);})[_0x4b71('0x26')](function(_0x41babf){logger[_0x4b71('0x15')]('ShowSmsQueue',_0x41babf['message'],_0x5244c1);_0x5acbd9(_0x14e391['error'](0x1f4,_0x41babf[_0x4b71('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 623e37b..90212f5 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 _0x1d7d=['update','emit','register','length','smsQueue:','./smsQueue.events','save'];(function(_0x31f433,_0x3026f4){var _0x185f84=function(_0x4dba9f){while(--_0x4dba9f){_0x31f433['push'](_0x31f433['shift']());}};_0x185f84(++_0x3026f4);}(_0x1d7d,0x75));var _0xd1d7=function(_0x14cadd,_0x5b8cc1){_0x14cadd=_0x14cadd-0x0;var _0x535279=_0x1d7d[_0x14cadd];return _0x535279;};'use strict';var SmsQueueEvents=require(_0xd1d7('0x0'));var events=[_0xd1d7('0x1'),'remove',_0xd1d7('0x2')];function createListener(_0x302aba,_0x1d3c25){return function(_0x135325){_0x1d3c25[_0xd1d7('0x3')](_0x302aba,_0x135325);};}function removeListener(_0x10bc74,_0x111b03){return function(){SmsQueueEvents['removeListener'](_0x10bc74,_0x111b03);};}exports[_0xd1d7('0x4')]=function(_0x5ba073){for(var _0x534258=0x0,_0x4661a1=events[_0xd1d7('0x5')];_0x534258<_0x4661a1;_0x534258++){var _0x1d6e68=events[_0x534258];var _0x3a2367=createListener(_0xd1d7('0x6')+_0x1d6e68,_0x5ba073);SmsQueueEvents['on'](_0x1d6e68,_0x3a2367);}}; \ No newline at end of file +var _0xfbc6=['emit','register','length','smsQueue:','./smsQueue.events','save','update'];(function(_0x552f30,_0x3c91bb){var _0x475466=function(_0x49ffdf){while(--_0x49ffdf){_0x552f30['push'](_0x552f30['shift']());}};_0x475466(++_0x3c91bb);}(_0xfbc6,0xc1));var _0x6fbc=function(_0x2e81a2,_0x4477fc){_0x2e81a2=_0x2e81a2-0x0;var _0x27b108=_0xfbc6[_0x2e81a2];return _0x27b108;};'use strict';var SmsQueueEvents=require(_0x6fbc('0x0'));var events=[_0x6fbc('0x1'),'remove',_0x6fbc('0x2')];function createListener(_0xb94ff6,_0x222ab6){return function(_0x2ae95e){_0x222ab6[_0x6fbc('0x3')](_0xb94ff6,_0x2ae95e);};}function removeListener(_0x166969,_0x5e9af6){return function(){SmsQueueEvents['removeListener'](_0x166969,_0x5e9af6);};}exports[_0x6fbc('0x4')]=function(_0x54d498){for(var _0x3db4cb=0x0,_0x52b993=events[_0x6fbc('0x5')];_0x3db4cb<_0x52b993;_0x3db4cb++){var _0x1fb086=events[_0x3db4cb];var _0xec81e1=createListener(_0x6fbc('0x6')+_0x1fb086,_0x54d498);SmsQueueEvents['on'](_0x1fb086,_0xec81e1);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index e4cb0d9..e558bc8 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 _0xa3f9=['util','path','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xa3f9,0x140));var _0x9a3f=function(_0x28f39c,_0x2058c6){_0x28f39c=_0x28f39c-0x0;var _0x409951=_0xa3f9[_0x28f39c];return _0x409951;};'use strict';var multer=require('multer');var util=require(_0x9a3f('0x0'));var path=require(_0x9a3f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9a3f('0x2'));var config=require(_0x9a3f('0x3'));var controller=require(_0x9a3f('0x4'));router[_0x9a3f('0x5')]('/',auth[_0x9a3f('0x6')](),controller[_0x9a3f('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x9a3f('0x8'),auth[_0x9a3f('0x6')](),controller[_0x9a3f('0x9')]);router[_0x9a3f('0xa')]('/',auth[_0x9a3f('0x6')](),controller[_0x9a3f('0xb')]);router[_0x9a3f('0xc')](_0x9a3f('0x8'),auth[_0x9a3f('0x6')](),controller[_0x9a3f('0xd')]);router[_0x9a3f('0xe')](_0x9a3f('0x8'),auth[_0x9a3f('0x6')](),controller['destroy']);module[_0x9a3f('0xf')]=router; \ No newline at end of file +var _0xa014=['destroy','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','/describe','/:id','show','post','create','put','isAuthenticated','update','delete'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa014,0xeb));var _0x4a01=function(_0x453b6f,_0x44c9e8){_0x453b6f=_0x453b6f-0x0;var _0x3b3595=_0xa014[_0x453b6f];return _0x3b3595;};'use strict';var multer=require(_0x4a01('0x0'));var util=require(_0x4a01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4a01('0x2')]();var fs_extra=require(_0x4a01('0x3'));var auth=require(_0x4a01('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4a01('0x5'));var controller=require(_0x4a01('0x6'));router[_0x4a01('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4a01('0x7')](_0x4a01('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x4a01('0x7')](_0x4a01('0x9'),auth['isAuthenticated'](),controller[_0x4a01('0xa')]);router[_0x4a01('0xb')]('/',auth['isAuthenticated'](),controller[_0x4a01('0xc')]);router[_0x4a01('0xd')](_0x4a01('0x9'),auth[_0x4a01('0xe')](),controller[_0x4a01('0xf')]);router[_0x4a01('0x10')](_0x4a01('0x9'),auth[_0x4a01('0xe')](),controller[_0x4a01('0x11')]);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 0e1609c..4ecf2c2 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 _0x99e7=['sequelize','exports','STRING','DATE'];(function(_0x2ed92f,_0x54091f){var _0x26ff04=function(_0x5ed317){while(--_0x5ed317){_0x2ed92f['push'](_0x2ed92f['shift']());}};_0x26ff04(++_0x54091f);}(_0x99e7,0xa8));var _0x799e=function(_0x328bd3,_0x9cf5a5){_0x328bd3=_0x328bd3-0x0;var _0x458149=_0x99e7[_0x328bd3];return _0x458149;};'use strict';var moment=require('moment');var Sequelize=require(_0x799e('0x0'));module[_0x799e('0x1')]={'uniqueid':{'type':Sequelize[_0x799e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x799e('0x2')]},'joinAt':{'type':Sequelize[_0x799e('0x3')]},'leaveAt':{'type':Sequelize[_0x799e('0x3')]},'acceptAt':{'type':Sequelize[_0x799e('0x3')]},'exitAt':{'type':Sequelize[_0x799e('0x3')]},'reason':{'type':Sequelize[_0x799e('0x2')]}}; \ No newline at end of file +var _0xb3d7=['sequelize','exports','STRING','DATE','moment'];(function(_0x2d2605,_0x53f46e){var _0x1bae8d=function(_0xc9fdb6){while(--_0xc9fdb6){_0x2d2605['push'](_0x2d2605['shift']());}};_0x1bae8d(++_0x53f46e);}(_0xb3d7,0x18f));var _0x7b3d=function(_0x4168c6,_0x13dabf){_0x4168c6=_0x4168c6-0x0;var _0x583976=_0xb3d7[_0x4168c6];return _0x583976;};'use strict';var moment=require(_0x7b3d('0x0'));var Sequelize=require(_0x7b3d('0x1'));module[_0x7b3d('0x2')]={'uniqueid':{'type':Sequelize[_0x7b3d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7b3d('0x3')]},'joinAt':{'type':Sequelize[_0x7b3d('0x4')]},'leaveAt':{'type':Sequelize[_0x7b3d('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7b3d('0x4')]},'reason':{'type':Sequelize[_0x7b3d('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index fc25ff9..898ec43 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 _0xc9d1=['status','end','json','undefined','offset','count','limit','Content-Range','apply','reject','save','then','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','length','include','create','body','update','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xc9d1,0x195));var _0x1c9d=function(_0x381f7f,_0x1321a9){_0x381f7f=_0x381f7f-0x0;var _0xd2ae6d=_0xc9d1[_0x381f7f];return _0xd2ae6d;};'use strict';var emlformat=require(_0x1c9d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1c9d('0x1'));var jsonpatch=require(_0x1c9d('0x2'));var rp=require(_0x1c9d('0x3'));var moment=require('moment');var BPromise=require(_0x1c9d('0x4'));var Mustache=require(_0x1c9d('0x5'));var util=require(_0x1c9d('0x6'));var path=require('path');var sox=require(_0x1c9d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c9d('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1c9d('0x9'));var jsforce=require(_0x1c9d('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1c9d('0xb'));var Papa=require(_0x1c9d('0xc'));var Redis=require(_0x1c9d('0xd'));var authService=require(_0x1c9d('0xe'));var qs=require(_0x1c9d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c9d('0x10'));var logger=require(_0x1c9d('0x11'))(_0x1c9d('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1c9d('0x13'))['db'];function respondWithStatusCode(_0x5458ba,_0x3b643f){_0x3b643f=_0x3b643f||0xcc;return function(_0x31e13e){if(_0x31e13e){return _0x5458ba[_0x1c9d('0x14')](_0x3b643f);}return _0x5458ba[_0x1c9d('0x15')](_0x3b643f)[_0x1c9d('0x16')]();};}function respondWithResult(_0x59a5eb,_0x2d6517){_0x2d6517=_0x2d6517||0xc8;return function(_0x45c17c){if(_0x45c17c){return _0x59a5eb['status'](_0x2d6517)[_0x1c9d('0x17')](_0x45c17c);}};}function respondWithFilteredResult(_0x4c8f23,_0x3762d6){return function(_0x5ef450){if(_0x5ef450){var _0x4dd838=typeof _0x3762d6['offset']===_0x1c9d('0x18')&&typeof _0x3762d6['limit']===_0x1c9d('0x18');var _0x53ccae=_0x5ef450['count'];var _0x3066ac=_0x4dd838?0x0:_0x3762d6[_0x1c9d('0x19')];var _0x1a5514=_0x4dd838?_0x5ef450[_0x1c9d('0x1a')]:_0x3762d6['offset']+_0x3762d6[_0x1c9d('0x1b')];var _0x4f6eeb;if(_0x1a5514>=_0x53ccae){_0x1a5514=_0x53ccae;_0x4f6eeb=0xc8;}else{_0x4f6eeb=0xce;}_0x4c8f23[_0x1c9d('0x15')](_0x4f6eeb);return _0x4c8f23['set'](_0x1c9d('0x1c'),_0x3066ac+'-'+_0x1a5514+'/'+_0x53ccae)['json'](_0x5ef450);}return null;};}function patchUpdates(_0x5e1f49){return function(_0x576ddb){try{jsonpatch[_0x1c9d('0x1d')](_0x576ddb,_0x5e1f49,!![]);}catch(_0x4f4879){return BPromise[_0x1c9d('0x1e')](_0x4f4879);}return _0x576ddb[_0x1c9d('0x1f')]();};}function saveUpdates(_0x1482d3,_0x3c8ee7){return function(_0x19efb6){if(_0x19efb6){return _0x19efb6['update'](_0x1482d3)[_0x1c9d('0x20')](function(_0x16bae9){return _0x16bae9;});}return null;};}function removeEntity(_0x1e7076,_0x3e0a36){return function(_0x36d9ff){if(_0x36d9ff){return _0x36d9ff['destroy']()[_0x1c9d('0x20')](function(){_0x1e7076[_0x1c9d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa8ca2d,_0x46a6e4){return function(_0x4a389b){if(!_0x4a389b){_0xa8ca2d[_0x1c9d('0x14')](0x194);}return _0x4a389b;};}function handleError(_0x52afe9,_0x18285b){_0x18285b=_0x18285b||0x1f4;return function(_0xb1a369){logger[_0x1c9d('0x21')](_0xb1a369[_0x1c9d('0x22')]);if(_0xb1a369[_0x1c9d('0x23')]){delete _0xb1a369[_0x1c9d('0x23')];}_0x52afe9['status'](_0x18285b)['send'](_0xb1a369);};}exports[_0x1c9d('0x24')]=function(_0xb9b654,_0x3af1d4){var _0xdbabd3={},_0x5243d0={},_0x4867b1={'count':0x0,'rows':[]};var _0x1f7395=_[_0x1c9d('0x25')](db[_0x1c9d('0x26')][_0x1c9d('0x27')],function(_0x414716){return{'name':_0x414716[_0x1c9d('0x28')],'type':_0x414716[_0x1c9d('0x29')][_0x1c9d('0x2a')]};});_0x5243d0[_0x1c9d('0x2b')]=_[_0x1c9d('0x25')](_0x1f7395,_0x1c9d('0x23'));_0x5243d0[_0x1c9d('0x2c')]=_[_0x1c9d('0x2d')](_0xb9b654[_0x1c9d('0x2c')]);_0x5243d0[_0x1c9d('0x2e')]=_[_0x1c9d('0x2f')](_0x5243d0[_0x1c9d('0x2b')],_0x5243d0[_0x1c9d('0x2c')]);_0xdbabd3[_0x1c9d('0x30')]=_['intersection'](_0x5243d0[_0x1c9d('0x2b')],qs['fields'](_0xb9b654['query'][_0x1c9d('0x31')]));_0xdbabd3[_0x1c9d('0x30')]=_0xdbabd3[_0x1c9d('0x30')]['length']?_0xdbabd3['attributes']:_0x5243d0[_0x1c9d('0x2b')];if(!_0xb9b654[_0x1c9d('0x2c')][_0x1c9d('0x32')](_0x1c9d('0x33'))){_0xdbabd3[_0x1c9d('0x1b')]=qs[_0x1c9d('0x1b')](_0xb9b654[_0x1c9d('0x2c')][_0x1c9d('0x1b')]);_0xdbabd3[_0x1c9d('0x19')]=qs['offset'](_0xb9b654[_0x1c9d('0x2c')]['offset']);}_0xdbabd3[_0x1c9d('0x34')]=qs[_0x1c9d('0x35')](_0xb9b654[_0x1c9d('0x2c')][_0x1c9d('0x35')]);_0xdbabd3[_0x1c9d('0x36')]=qs['filters'](_[_0x1c9d('0x37')](_0xb9b654[_0x1c9d('0x2c')],_0x5243d0[_0x1c9d('0x2e')]),_0x1f7395);if(_0xb9b654[_0x1c9d('0x2c')][_0x1c9d('0x38')]){_0xdbabd3['where']=_[_0x1c9d('0x39')](_0xdbabd3[_0x1c9d('0x36')],{'$or':_[_0x1c9d('0x25')](_0x1f7395,function(_0x44d6c2){if(_0x44d6c2[_0x1c9d('0x29')]!=='VIRTUAL'){var _0x5ed526={};_0x5ed526[_0x44d6c2[_0x1c9d('0x23')]]={'$like':'%'+_0xb9b654[_0x1c9d('0x2c')][_0x1c9d('0x38')]+'%'};return _0x5ed526;}})});}_0xdbabd3=_[_0x1c9d('0x39')]({},_0xdbabd3,_0xb9b654[_0x1c9d('0x3a')]);var _0x1d0cbb={'where':_0xdbabd3[_0x1c9d('0x36')]};return db['SmsQueueReport']['count'](_0x1d0cbb)[_0x1c9d('0x20')](function(_0x39ef49){_0x4867b1[_0x1c9d('0x1a')]=_0x39ef49;if(_0xb9b654['query'][_0x1c9d('0x3b')]){_0xdbabd3['include']=[{'all':!![]}];}return db['SmsQueueReport'][_0x1c9d('0x3c')](_0xdbabd3);})['then'](function(_0x1960b2){_0x4867b1[_0x1c9d('0x3d')]=_0x1960b2;return _0x4867b1;})[_0x1c9d('0x20')](respondWithFilteredResult(_0x3af1d4,_0xdbabd3))[_0x1c9d('0x3e')](handleError(_0x3af1d4,null));};exports['show']=function(_0x36a61a,_0x41a714){var _0x320227={'raw':!![],'where':{'id':_0x36a61a[_0x1c9d('0x3f')]['id']}},_0x1e8162={};_0x1e8162[_0x1c9d('0x2b')]=_[_0x1c9d('0x2d')](db[_0x1c9d('0x26')][_0x1c9d('0x27')]);_0x1e8162['query']=_[_0x1c9d('0x2d')](_0x36a61a[_0x1c9d('0x2c')]);_0x1e8162[_0x1c9d('0x2e')]=_['intersection'](_0x1e8162[_0x1c9d('0x2b')],_0x1e8162['query']);_0x320227[_0x1c9d('0x30')]=_[_0x1c9d('0x2f')](_0x1e8162['model'],qs[_0x1c9d('0x31')](_0x36a61a[_0x1c9d('0x2c')][_0x1c9d('0x31')]));_0x320227[_0x1c9d('0x30')]=_0x320227[_0x1c9d('0x30')][_0x1c9d('0x40')]?_0x320227[_0x1c9d('0x30')]:_0x1e8162[_0x1c9d('0x2b')];if(_0x36a61a[_0x1c9d('0x2c')][_0x1c9d('0x3b')]){_0x320227[_0x1c9d('0x41')]=[{'all':!![]}];}_0x320227=_[_0x1c9d('0x39')]({},_0x320227,_0x36a61a['options']);return db[_0x1c9d('0x26')]['find'](_0x320227)[_0x1c9d('0x20')](handleEntityNotFound(_0x41a714,null))['then'](respondWithResult(_0x41a714,null))[_0x1c9d('0x3e')](handleError(_0x41a714,null));};exports[_0x1c9d('0x42')]=function(_0x1be869,_0x14eb01){return db[_0x1c9d('0x26')]['create'](_0x1be869[_0x1c9d('0x43')],{})[_0x1c9d('0x20')](respondWithResult(_0x14eb01,0xc9))[_0x1c9d('0x3e')](handleError(_0x14eb01,null));};exports[_0x1c9d('0x44')]=function(_0x326307,_0x2c5df1){if(_0x326307[_0x1c9d('0x43')]['id']){delete _0x326307[_0x1c9d('0x43')]['id'];}return db[_0x1c9d('0x26')][_0x1c9d('0x45')]({'where':{'id':_0x326307[_0x1c9d('0x3f')]['id']}})[_0x1c9d('0x20')](handleEntityNotFound(_0x2c5df1,null))['then'](saveUpdates(_0x326307[_0x1c9d('0x43')],null))[_0x1c9d('0x20')](respondWithResult(_0x2c5df1,null))[_0x1c9d('0x3e')](handleError(_0x2c5df1,null));};exports['destroy']=function(_0x14a253,_0x16a93b){return db[_0x1c9d('0x26')][_0x1c9d('0x45')]({'where':{'id':_0x14a253['params']['id']}})[_0x1c9d('0x20')](handleEntityNotFound(_0x16a93b,null))['then'](removeEntity(_0x16a93b,null))[_0x1c9d('0x3e')](handleError(_0x16a93b,null));};exports[_0x1c9d('0x46')]=function(_0x379510,_0x535a44){return db[_0x1c9d('0x26')][_0x1c9d('0x46')]()['then'](respondWithResult(_0x535a44,null))['catch'](handleError(_0x535a44,null));}; \ No newline at end of file +var _0x52a6=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x4dff1c,_0x4a77c0){var _0x38019e=function(_0x50b3d8){while(--_0x50b3d8){_0x4dff1c['push'](_0x4dff1c['shift']());}};_0x38019e(++_0x4a77c0);}(_0x52a6,0x1e0));var _0x652a=function(_0x163e75,_0x279680){_0x163e75=_0x163e75-0x0;var _0x140b81=_0x52a6[_0x163e75];return _0x140b81;};'use strict';var emlformat=require(_0x652a('0x0'));var rimraf=require(_0x652a('0x1'));var zipdir=require(_0x652a('0x2'));var jsonpatch=require(_0x652a('0x3'));var rp=require(_0x652a('0x4'));var moment=require(_0x652a('0x5'));var BPromise=require(_0x652a('0x6'));var Mustache=require(_0x652a('0x7'));var util=require(_0x652a('0x8'));var path=require(_0x652a('0x9'));var sox=require(_0x652a('0xa'));var csv=require('to-csv');var ejs=require(_0x652a('0xb'));var fs=require('fs');var fs_extra=require(_0x652a('0xc'));var _=require(_0x652a('0xd'));var squel=require(_0x652a('0xe'));var crypto=require(_0x652a('0xf'));var jsforce=require(_0x652a('0x10'));var deskjs=require(_0x652a('0x11'));var toCsv=require(_0x652a('0x12'));var querystring=require(_0x652a('0x13'));var Papa=require(_0x652a('0x14'));var Redis=require(_0x652a('0x15'));var authService=require(_0x652a('0x16'));var qs=require(_0x652a('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x652a('0x18'));var logger=require(_0x652a('0x19'))(_0x652a('0x1a'));var utils=require('../../config/utils');var config=require(_0x652a('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x652a('0x1c'))['db'];function respondWithStatusCode(_0x2e82a9,_0x222854){_0x222854=_0x222854||0xcc;return function(_0x10dac7){if(_0x10dac7){return _0x2e82a9[_0x652a('0x1d')](_0x222854);}return _0x2e82a9[_0x652a('0x1e')](_0x222854)[_0x652a('0x1f')]();};}function respondWithResult(_0x3cafce,_0x46558e){_0x46558e=_0x46558e||0xc8;return function(_0x425317){if(_0x425317){return _0x3cafce[_0x652a('0x1e')](_0x46558e)[_0x652a('0x20')](_0x425317);}};}function respondWithFilteredResult(_0x50b9c2,_0x4ca2fe){return function(_0x4fc446){if(_0x4fc446){var _0x195517=typeof _0x4ca2fe[_0x652a('0x21')]===_0x652a('0x22')&&typeof _0x4ca2fe[_0x652a('0x23')]===_0x652a('0x22');var _0x58f38d=_0x4fc446['count'];var _0x43da06=_0x195517?0x0:_0x4ca2fe[_0x652a('0x21')];var _0x25293f=_0x195517?_0x4fc446[_0x652a('0x24')]:_0x4ca2fe[_0x652a('0x21')]+_0x4ca2fe[_0x652a('0x23')];var _0x541258;if(_0x25293f>=_0x58f38d){_0x25293f=_0x58f38d;_0x541258=0xc8;}else{_0x541258=0xce;}_0x50b9c2[_0x652a('0x1e')](_0x541258);return _0x50b9c2[_0x652a('0x25')](_0x652a('0x26'),_0x43da06+'-'+_0x25293f+'/'+_0x58f38d)['json'](_0x4fc446);}return null;};}function patchUpdates(_0x4a07b0){return function(_0x388a97){try{jsonpatch[_0x652a('0x27')](_0x388a97,_0x4a07b0,!![]);}catch(_0x360814){return BPromise[_0x652a('0x28')](_0x360814);}return _0x388a97[_0x652a('0x29')]();};}function saveUpdates(_0x1fa29e,_0x47a388){return function(_0x3ec571){if(_0x3ec571){return _0x3ec571['update'](_0x1fa29e)['then'](function(_0x15123d){return _0x15123d;});}return null;};}function removeEntity(_0x53121b,_0x2bc75c){return function(_0x3d6084){if(_0x3d6084){return _0x3d6084[_0x652a('0x2a')]()[_0x652a('0x2b')](function(){_0x53121b[_0x652a('0x1e')](0xcc)[_0x652a('0x1f')]();});}};}function handleEntityNotFound(_0x3f0e09,_0x4b7713){return function(_0x12a867){if(!_0x12a867){_0x3f0e09['sendStatus'](0x194);}return _0x12a867;};}function handleError(_0x5817fd,_0x551700){_0x551700=_0x551700||0x1f4;return function(_0x4f808b){logger[_0x652a('0x2c')](_0x4f808b[_0x652a('0x2d')]);if(_0x4f808b[_0x652a('0x2e')]){delete _0x4f808b[_0x652a('0x2e')];}_0x5817fd[_0x652a('0x1e')](_0x551700)[_0x652a('0x2f')](_0x4f808b);};}exports[_0x652a('0x30')]=function(_0x501b82,_0x124684){var _0x368af6={},_0x56adec={},_0x3fad3e={'count':0x0,'rows':[]};var _0x34fd21=_[_0x652a('0x31')](db[_0x652a('0x32')][_0x652a('0x33')],function(_0x4d667e){return{'name':_0x4d667e[_0x652a('0x34')],'type':_0x4d667e['type'][_0x652a('0x35')]};});_0x56adec[_0x652a('0x36')]=_[_0x652a('0x31')](_0x34fd21,'name');_0x56adec['query']=_[_0x652a('0x37')](_0x501b82['query']);_0x56adec['filters']=_[_0x652a('0x38')](_0x56adec['model'],_0x56adec[_0x652a('0x39')]);_0x368af6[_0x652a('0x3a')]=_['intersection'](_0x56adec['model'],qs[_0x652a('0x3b')](_0x501b82[_0x652a('0x39')][_0x652a('0x3b')]));_0x368af6['attributes']=_0x368af6[_0x652a('0x3a')]['length']?_0x368af6[_0x652a('0x3a')]:_0x56adec[_0x652a('0x36')];if(!_0x501b82[_0x652a('0x39')][_0x652a('0x3c')](_0x652a('0x3d'))){_0x368af6[_0x652a('0x23')]=qs[_0x652a('0x23')](_0x501b82[_0x652a('0x39')][_0x652a('0x23')]);_0x368af6[_0x652a('0x21')]=qs[_0x652a('0x21')](_0x501b82['query'][_0x652a('0x21')]);}_0x368af6[_0x652a('0x3e')]=qs[_0x652a('0x3f')](_0x501b82['query']['sort']);_0x368af6[_0x652a('0x40')]=qs[_0x652a('0x41')](_[_0x652a('0x42')](_0x501b82[_0x652a('0x39')],_0x56adec[_0x652a('0x41')]),_0x34fd21);if(_0x501b82['query']['filter']){_0x368af6[_0x652a('0x40')]=_[_0x652a('0x43')](_0x368af6[_0x652a('0x40')],{'$or':_['map'](_0x34fd21,function(_0xd4efa2){if(_0xd4efa2['type']!=='VIRTUAL'){var _0x100ad9={};_0x100ad9[_0xd4efa2[_0x652a('0x2e')]]={'$like':'%'+_0x501b82[_0x652a('0x39')][_0x652a('0x44')]+'%'};return _0x100ad9;}})});}_0x368af6=_[_0x652a('0x43')]({},_0x368af6,_0x501b82[_0x652a('0x45')]);var _0x773cf9={'where':_0x368af6[_0x652a('0x40')]};return db[_0x652a('0x32')][_0x652a('0x24')](_0x773cf9)['then'](function(_0x42b5de){_0x3fad3e['count']=_0x42b5de;if(_0x501b82[_0x652a('0x39')][_0x652a('0x46')]){_0x368af6[_0x652a('0x47')]=[{'all':!![]}];}return db[_0x652a('0x32')][_0x652a('0x48')](_0x368af6);})[_0x652a('0x2b')](function(_0x55cbfd){_0x3fad3e[_0x652a('0x49')]=_0x55cbfd;return _0x3fad3e;})[_0x652a('0x2b')](respondWithFilteredResult(_0x124684,_0x368af6))[_0x652a('0x4a')](handleError(_0x124684,null));};exports[_0x652a('0x4b')]=function(_0x3af107,_0x3c30a2){var _0x1725d1={'raw':!![],'where':{'id':_0x3af107[_0x652a('0x4c')]['id']}},_0x5c7370={};_0x5c7370[_0x652a('0x36')]=_[_0x652a('0x37')](db[_0x652a('0x32')][_0x652a('0x33')]);_0x5c7370[_0x652a('0x39')]=_['keys'](_0x3af107['query']);_0x5c7370[_0x652a('0x41')]=_[_0x652a('0x38')](_0x5c7370[_0x652a('0x36')],_0x5c7370[_0x652a('0x39')]);_0x1725d1['attributes']=_['intersection'](_0x5c7370[_0x652a('0x36')],qs[_0x652a('0x3b')](_0x3af107[_0x652a('0x39')][_0x652a('0x3b')]));_0x1725d1[_0x652a('0x3a')]=_0x1725d1[_0x652a('0x3a')][_0x652a('0x4d')]?_0x1725d1[_0x652a('0x3a')]:_0x5c7370['model'];if(_0x3af107[_0x652a('0x39')][_0x652a('0x46')]){_0x1725d1[_0x652a('0x47')]=[{'all':!![]}];}_0x1725d1=_[_0x652a('0x43')]({},_0x1725d1,_0x3af107[_0x652a('0x45')]);return db[_0x652a('0x32')][_0x652a('0x4e')](_0x1725d1)[_0x652a('0x2b')](handleEntityNotFound(_0x3c30a2,null))['then'](respondWithResult(_0x3c30a2,null))['catch'](handleError(_0x3c30a2,null));};exports[_0x652a('0x4f')]=function(_0x5388b7,_0x41a198){return db['SmsQueueReport'][_0x652a('0x4f')](_0x5388b7[_0x652a('0x50')],{})[_0x652a('0x2b')](respondWithResult(_0x41a198,0xc9))[_0x652a('0x4a')](handleError(_0x41a198,null));};exports[_0x652a('0x51')]=function(_0x4e649a,_0x183654){if(_0x4e649a[_0x652a('0x50')]['id']){delete _0x4e649a[_0x652a('0x50')]['id'];}return db[_0x652a('0x32')][_0x652a('0x4e')]({'where':{'id':_0x4e649a[_0x652a('0x4c')]['id']}})[_0x652a('0x2b')](handleEntityNotFound(_0x183654,null))['then'](saveUpdates(_0x4e649a[_0x652a('0x50')],null))[_0x652a('0x2b')](respondWithResult(_0x183654,null))[_0x652a('0x4a')](handleError(_0x183654,null));};exports[_0x652a('0x2a')]=function(_0x6aebd4,_0x22620a){return db[_0x652a('0x32')][_0x652a('0x4e')]({'where':{'id':_0x6aebd4[_0x652a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x22620a,null))['then'](removeEntity(_0x22620a,null))[_0x652a('0x4a')](handleError(_0x22620a,null));};exports['describe']=function(_0x1722c8,_0x11ed1c){return db[_0x652a('0x32')]['describe']()[_0x652a('0x2b')](respondWithResult(_0x11ed1c,null))[_0x652a('0x4a')](handleError(_0x11ed1c,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index e417341..7571af6 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(_0x2353fe,_0x4b0bca){var _0x4d43f6=function(_0x5d0bd9){while(--_0x5d0bd9){_0x2353fe['push'](_0x2353fe['shift']());}};_0x4d43f6(++_0x4b0bca);}(_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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x2c6120,_0x1f3e60){var _0x5fb114=function(_0x45a72d){while(--_0x45a72d){_0x2c6120['push'](_0x2c6120['shift']());}};_0x5fb114(++_0x1f3e60);}(_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 diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 766142f..ad92898 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 _0x3c71=['UpdateSmsQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','create','body','options','raw','debug','SmsQueueReport','update','where','attributes','limit','then'];(function(_0x117060,_0x25b2b9){var _0x3db533=function(_0x4819ae){while(--_0x4819ae){_0x117060['push'](_0x117060['shift']());}};_0x3db533(++_0x25b2b9);}(_0x3c71,0x155));var _0x13c7=function(_0x105a11,_0xe798cc){_0x105a11=_0x105a11-0x0;var _0x40d8e1=_0x3c71[_0x105a11];return _0x40d8e1;};'use strict';var _=require(_0x13c7('0x0'));var util=require(_0x13c7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x13c7('0x2'));var fs=require('fs');var Redis=require(_0x13c7('0x3'));var db=require(_0x13c7('0x4'))['db'];var utils=require(_0x13c7('0x5'));var logger=require(_0x13c7('0x6'))(_0x13c7('0x7'));var config=require(_0x13c7('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x13c7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44c704,_0x53bc99,_0x4236c1){return new BPromise(function(_0x1dc576,_0x27de69){return client[_0x13c7('0xa')](_0x44c704,_0x4236c1)['then'](function(_0x1c4992){logger[_0x13c7('0xb')](_0x13c7('0xc'),_0x53bc99,_0x13c7('0xd'));logger['debug'](_0x13c7('0xe'),_0x53bc99,_0x13c7('0xd'),JSON[_0x13c7('0xf')](_0x1c4992));if(_0x1c4992[_0x13c7('0x10')]){if(_0x1c4992[_0x13c7('0x10')][_0x13c7('0x11')]===0x1f4){logger[_0x13c7('0x10')](_0x13c7('0xc'),_0x53bc99,_0x1c4992['error']['message']);return _0x27de69(_0x1c4992['error'][_0x13c7('0x12')]);}logger['error'](_0x13c7('0xc'),_0x53bc99,_0x1c4992['error'][_0x13c7('0x12')]);return _0x1dc576(_0x1c4992['error'][_0x13c7('0x12')]);}else{logger[_0x13c7('0xb')](_0x13c7('0xc'),_0x53bc99,'request\x20sent');_0x1dc576(_0x1c4992[_0x13c7('0x13')]['message']);}})[_0x13c7('0x14')](function(_0x4978a3){logger[_0x13c7('0x10')](_0x13c7('0xc'),_0x53bc99,_0x4978a3);_0x27de69(_0x4978a3);});});}exports[_0x13c7('0x15')]=function(_0x29e895){var _0x46b0ba=this;return new Promise(function(_0x57b9d7,_0x309331){return db['SmsQueueReport'][_0x13c7('0x16')](_0x29e895[_0x13c7('0x17')],{'raw':_0x29e895[_0x13c7('0x18')]?_0x29e895[_0x13c7('0x18')][_0x13c7('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x14fa12){logger[_0x13c7('0xb')](_0x13c7('0x15'),_0x29e895);logger[_0x13c7('0x1a')](_0x13c7('0x15'),_0x29e895,JSON[_0x13c7('0xf')](_0x14fa12));_0x57b9d7(_0x14fa12);})[_0x13c7('0x14')](function(_0x255e22){logger[_0x13c7('0x10')](_0x13c7('0x15'),_0x255e22[_0x13c7('0x12')],_0x29e895);_0x309331(_0x46b0ba[_0x13c7('0x10')](0x1f4,_0x255e22['message']));});});};exports['UpdateSmsQueueReport']=function(_0x4d84ef){var _0x2fd2d6=this;return new Promise(function(_0x2b4554,_0x3ec082){return db[_0x13c7('0x1b')][_0x13c7('0x1c')](_0x4d84ef[_0x13c7('0x17')],{'raw':_0x4d84ef['options']?_0x4d84ef[_0x13c7('0x18')][_0x13c7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d84ef[_0x13c7('0x18')]?_0x4d84ef[_0x13c7('0x18')][_0x13c7('0x1d')]||null:null,'attributes':_0x4d84ef[_0x13c7('0x18')]?_0x4d84ef[_0x13c7('0x18')][_0x13c7('0x1e')]||null:null,'limit':_0x4d84ef[_0x13c7('0x18')]?_0x4d84ef[_0x13c7('0x18')][_0x13c7('0x1f')]||null:null})[_0x13c7('0x20')](function(_0x243283){logger['info'](_0x13c7('0x21'),_0x4d84ef);logger[_0x13c7('0x1a')](_0x13c7('0x21'),_0x4d84ef,JSON['stringify'](_0x243283));_0x2b4554(_0x243283);})[_0x13c7('0x14')](function(_0x56f372){logger[_0x13c7('0x10')]('UpdateSmsQueueReport',_0x56f372['message'],_0x4d84ef);_0x3ec082(_0x2fd2d6['error'](0x1f4,_0x56f372['message']));});});}; \ No newline at end of file +var _0x0588=['update','body','raw','where','stringify','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create','options','debug','catch','UpdateSmsQueueReport'];(function(_0x2cb893,_0x3a6b2c){var _0x2474a9=function(_0x508ba0){while(--_0x508ba0){_0x2cb893['push'](_0x2cb893['shift']());}};_0x2474a9(++_0x3a6b2c);}(_0x0588,0x127));var _0x8058=function(_0x4b6909,_0x1658c7){_0x4b6909=_0x4b6909-0x0;var _0xd054eb=_0x0588[_0x4b6909];return _0xd054eb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8058('0x0'));var BPromise=require('bluebird');var rs=require(_0x8058('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8058('0x2'))['db'];var utils=require(_0x8058('0x3'));var logger=require('../../config/logger')(_0x8058('0x4'));var config=require(_0x8058('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8058('0x6')][_0x8058('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5537ca,_0x2d7914,_0xcaa0b0){return new BPromise(function(_0x49bbe4,_0x4b9197){return client['request'](_0x5537ca,_0xcaa0b0)[_0x8058('0x8')](function(_0xde2215){logger[_0x8058('0x9')](_0x8058('0xa'),_0x2d7914,'request\x20sent');logger['debug'](_0x8058('0xb'),_0x2d7914,_0x8058('0xc'),JSON['stringify'](_0xde2215));if(_0xde2215[_0x8058('0xd')]){if(_0xde2215[_0x8058('0xd')][_0x8058('0xe')]===0x1f4){logger[_0x8058('0xd')](_0x8058('0xa'),_0x2d7914,_0xde2215[_0x8058('0xd')][_0x8058('0xf')]);return _0x4b9197(_0xde2215[_0x8058('0xd')][_0x8058('0xf')]);}logger['error'](_0x8058('0xa'),_0x2d7914,_0xde2215[_0x8058('0xd')][_0x8058('0xf')]);return _0x49bbe4(_0xde2215['error'][_0x8058('0xf')]);}else{logger[_0x8058('0x9')](_0x8058('0xa'),_0x2d7914,_0x8058('0xc'));_0x49bbe4(_0xde2215[_0x8058('0x10')][_0x8058('0xf')]);}})['catch'](function(_0x55c4b3){logger[_0x8058('0xd')](_0x8058('0xa'),_0x2d7914,_0x55c4b3);_0x4b9197(_0x55c4b3);});});}exports[_0x8058('0x11')]=function(_0x1d9f58){var _0x4fd762=this;return new Promise(function(_0x3f19d1,_0x1bd92a){return db[_0x8058('0x12')][_0x8058('0x13')](_0x1d9f58['body'],{'raw':_0x1d9f58[_0x8058('0x14')]?_0x1d9f58[_0x8058('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x8058('0x8')](function(_0x1244ad){logger[_0x8058('0x9')](_0x8058('0x11'),_0x1d9f58);logger[_0x8058('0x15')](_0x8058('0x11'),_0x1d9f58,JSON['stringify'](_0x1244ad));_0x3f19d1(_0x1244ad);})[_0x8058('0x16')](function(_0x30b528){logger[_0x8058('0xd')]('CreateSmsQueueReport',_0x30b528[_0x8058('0xf')],_0x1d9f58);_0x1bd92a(_0x4fd762[_0x8058('0xd')](0x1f4,_0x30b528[_0x8058('0xf')]));});});};exports[_0x8058('0x17')]=function(_0x1bd5ca){var _0x449632=this;return new Promise(function(_0x5f3ce5,_0x510b88){return db[_0x8058('0x12')][_0x8058('0x18')](_0x1bd5ca[_0x8058('0x19')],{'raw':_0x1bd5ca[_0x8058('0x14')]?_0x1bd5ca[_0x8058('0x14')][_0x8058('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bd5ca[_0x8058('0x14')]?_0x1bd5ca['options'][_0x8058('0x1b')]||null:null,'attributes':_0x1bd5ca['options']?_0x1bd5ca[_0x8058('0x14')]['attributes']||null:null,'limit':_0x1bd5ca[_0x8058('0x14')]?_0x1bd5ca[_0x8058('0x14')]['limit']||null:null})[_0x8058('0x8')](function(_0xa5b224){logger['info'](_0x8058('0x17'),_0x1bd5ca);logger['debug'](_0x8058('0x17'),_0x1bd5ca,JSON[_0x8058('0x1c')](_0xa5b224));_0x5f3ce5(_0xa5b224);})['catch'](function(_0x5df375){logger['error'](_0x8058('0x17'),_0x5df375[_0x8058('0xf')],_0x1bd5ca);_0x510b88(_0x449632[_0x8058('0xd')](0x1f4,_0x5df375[_0x8058('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index fd02f1b..9eb2e6b 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 _0x56a4=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','isAuthenticated','describe','post','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x59e725,_0x15f10e){var _0x30d069=function(_0x529f09){while(--_0x529f09){_0x59e725['push'](_0x59e725['shift']());}};_0x30d069(++_0x15f10e);}(_0x56a4,0x11b));var _0x456a=function(_0x472ca8,_0x2c8c37){_0x472ca8=_0x472ca8-0x0;var _0x14c783=_0x56a4[_0x472ca8];return _0x14c783;};'use strict';var multer=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var path=require('path');var timeout=require(_0x456a('0x2'));var express=require(_0x456a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x456a('0x4'));var interaction=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var controller=require(_0x456a('0x7'));router[_0x456a('0x8')]('/',auth['isAuthenticated'](),controller[_0x456a('0x9')]);router['get']('/describe',auth[_0x456a('0xa')](),controller[_0x456a('0xb')]);router[_0x456a('0x8')]('/:id',auth[_0x456a('0xa')](),controller['show']);router[_0x456a('0xc')]('/',auth[_0x456a('0xa')](),controller[_0x456a('0xd')]);router[_0x456a('0xe')](_0x456a('0xf'),auth[_0x456a('0xa')](),controller[_0x456a('0x10')]);router[_0x456a('0x11')](_0x456a('0xf'),auth[_0x456a('0xa')](),controller[_0x456a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x33c5=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x33c5,0xe6));var _0x533c=function(_0x390752,_0x42cad3){_0x390752=_0x390752-0x0;var _0x5eca55=_0x33c5[_0x390752];return _0x5eca55;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var fs_extra=require(_0x533c('0x4'));var auth=require(_0x533c('0x5'));var interaction=require(_0x533c('0x6'));var config=require('../../config/environment');var controller=require(_0x533c('0x7'));router[_0x533c('0x8')]('/',auth[_0x533c('0x9')](),controller[_0x533c('0xa')]);router[_0x533c('0x8')](_0x533c('0xb'),auth[_0x533c('0x9')](),controller[_0x533c('0xc')]);router[_0x533c('0x8')](_0x533c('0xd'),auth[_0x533c('0x9')](),controller[_0x533c('0xe')]);router[_0x533c('0xf')]('/',auth[_0x533c('0x9')](),controller[_0x533c('0x10')]);router[_0x533c('0x11')]('/:id',auth[_0x533c('0x9')](),controller[_0x533c('0x12')]);router[_0x533c('0x13')](_0x533c('0xd'),auth[_0x533c('0x9')](),controller[_0x533c('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 5e55270..e789517 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x533c97,_0x2f97db){var _0x3d7012=function(_0x462999){while(--_0x462999){_0x533c97['push'](_0x533c97['shift']());}};_0x3d7012(++_0x2f97db);}(_0xf4eb,0xec));var _0xbf4e=function(_0x245f91,_0x5c41d1){_0x245f91=_0x245f91-0x0;var _0x2a60af=_0xf4eb[_0x245f91];return _0x2a60af;};'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 +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x54fdd8,_0x2e81ae){var _0x4f6f8a=function(_0x2a970c){while(--_0x2a970c){_0x54fdd8['push'](_0x54fdd8['shift']());}};_0x4f6f8a(++_0x2e81ae);}(_0x54ef,0x112));var _0xf54e=function(_0x3c15bb,_0x35569f){_0x3c15bb=_0x3c15bb-0x0;var _0x4718bb=_0x54ef[_0x3c15bb];return _0x4718bb;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 4d887f1..88fb880 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 _0xb8e2=['hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','include','findAll','then','rows','catch','params','includeAll','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','error','stack','name','send','SmsTransferReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length'];(function(_0x54dce1,_0x257ed7){var _0x1f541a=function(_0x45ac55){while(--_0x45ac55){_0x54dce1['push'](_0x54dce1['shift']());}};_0x1f541a(++_0x257ed7);}(_0xb8e2,0xdd));var _0x2b8e=function(_0x24cc72,_0x4dc73a){_0x24cc72=_0x24cc72-0x0;var _0xd49f1e=_0xb8e2[_0x24cc72];return _0xd49f1e;};'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(_0x2b8e('0x4'));var Mustache=require(_0x2b8e('0x5'));var util=require(_0x2b8e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2b8e('0x7'));var ejs=require(_0x2b8e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2b8e('0x9'));var crypto=require(_0x2b8e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2b8e('0xb'));var toCsv=require(_0x2b8e('0x7'));var querystring=require('querystring');var Papa=require(_0x2b8e('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2b8e('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b8e('0xe'))(_0x2b8e('0xf'));var utils=require(_0x2b8e('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x2b8e('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4da77c,_0x1acbe8){_0x1acbe8=_0x1acbe8||0xcc;return function(_0xe9a904){if(_0xe9a904){return _0x4da77c[_0x2b8e('0x12')](_0x1acbe8);}return _0x4da77c[_0x2b8e('0x13')](_0x1acbe8)[_0x2b8e('0x14')]();};}function respondWithResult(_0x193636,_0x2badc1){_0x2badc1=_0x2badc1||0xc8;return function(_0x412d42){if(_0x412d42){return _0x193636[_0x2b8e('0x13')](_0x2badc1)[_0x2b8e('0x15')](_0x412d42);}};}function respondWithFilteredResult(_0x33d887,_0x2d8588){return function(_0x1af28f){if(_0x1af28f){var _0x365a00=typeof _0x2d8588[_0x2b8e('0x16')]===_0x2b8e('0x17')&&typeof _0x2d8588['limit']===_0x2b8e('0x17');var _0x55294e=_0x1af28f['count'];var _0x4c23a5=_0x365a00?0x0:_0x2d8588[_0x2b8e('0x16')];var _0x19add0=_0x365a00?_0x1af28f[_0x2b8e('0x18')]:_0x2d8588[_0x2b8e('0x16')]+_0x2d8588[_0x2b8e('0x19')];var _0x571017;if(_0x19add0>=_0x55294e){_0x19add0=_0x55294e;_0x571017=0xc8;}else{_0x571017=0xce;}_0x33d887[_0x2b8e('0x13')](_0x571017);return _0x33d887[_0x2b8e('0x1a')](_0x2b8e('0x1b'),_0x4c23a5+'-'+_0x19add0+'/'+_0x55294e)[_0x2b8e('0x15')](_0x1af28f);}return null;};}function patchUpdates(_0xba2933){return function(_0x4b68b3){try{jsonpatch[_0x2b8e('0x1c')](_0x4b68b3,_0xba2933,!![]);}catch(_0x4c90ba){return BPromise['reject'](_0x4c90ba);}return _0x4b68b3['save']();};}function saveUpdates(_0xbfa029,_0xb04942){return function(_0x14c5e3){if(_0x14c5e3){return _0x14c5e3[_0x2b8e('0x1d')](_0xbfa029)['then'](function(_0x10f1cc){return _0x10f1cc;});}return null;};}function removeEntity(_0x2e6d08,_0x240b00){return function(_0x19b513){if(_0x19b513){return _0x19b513['destroy']()['then'](function(){_0x2e6d08[_0x2b8e('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35bcfb,_0x1eeeb6){return function(_0x557c31){if(!_0x557c31){_0x35bcfb['sendStatus'](0x194);}return _0x557c31;};}function handleError(_0x509901,_0x1f5d04){_0x1f5d04=_0x1f5d04||0x1f4;return function(_0x2f27a6){logger[_0x2b8e('0x1e')](_0x2f27a6[_0x2b8e('0x1f')]);if(_0x2f27a6[_0x2b8e('0x20')]){delete _0x2f27a6[_0x2b8e('0x20')];}_0x509901['status'](_0x1f5d04)[_0x2b8e('0x21')](_0x2f27a6);};}exports['index']=function(_0x35c80b,_0x297332){var _0xb366ad={},_0x4bf152={},_0x5ab68a={'count':0x0,'rows':[]};var _0x2fbefb=_['map'](db[_0x2b8e('0x22')][_0x2b8e('0x23')],function(_0x3e10af){return{'name':_0x3e10af[_0x2b8e('0x24')],'type':_0x3e10af[_0x2b8e('0x25')]['key']};});_0x4bf152[_0x2b8e('0x26')]=_[_0x2b8e('0x27')](_0x2fbefb,'name');_0x4bf152[_0x2b8e('0x28')]=_[_0x2b8e('0x29')](_0x35c80b['query']);_0x4bf152[_0x2b8e('0x2a')]=_[_0x2b8e('0x2b')](_0x4bf152[_0x2b8e('0x26')],_0x4bf152['query']);_0xb366ad['attributes']=_[_0x2b8e('0x2b')](_0x4bf152[_0x2b8e('0x26')],qs[_0x2b8e('0x2c')](_0x35c80b['query'][_0x2b8e('0x2c')]));_0xb366ad[_0x2b8e('0x2d')]=_0xb366ad[_0x2b8e('0x2d')][_0x2b8e('0x2e')]?_0xb366ad[_0x2b8e('0x2d')]:_0x4bf152['model'];if(!_0x35c80b['query'][_0x2b8e('0x2f')](_0x2b8e('0x30'))){_0xb366ad[_0x2b8e('0x19')]=qs[_0x2b8e('0x19')](_0x35c80b[_0x2b8e('0x28')][_0x2b8e('0x19')]);_0xb366ad[_0x2b8e('0x16')]=qs[_0x2b8e('0x16')](_0x35c80b[_0x2b8e('0x28')][_0x2b8e('0x16')]);}_0xb366ad[_0x2b8e('0x31')]=qs['sort'](_0x35c80b[_0x2b8e('0x28')]['sort']);_0xb366ad[_0x2b8e('0x32')]=qs[_0x2b8e('0x2a')](_['pick'](_0x35c80b[_0x2b8e('0x28')],_0x4bf152[_0x2b8e('0x2a')]),_0x2fbefb);if(_0x35c80b['query'][_0x2b8e('0x33')]){_0xb366ad[_0x2b8e('0x32')]=_[_0x2b8e('0x34')](_0xb366ad['where'],{'$or':_[_0x2b8e('0x27')](_0x2fbefb,function(_0x2b7020){if(_0x2b7020[_0x2b8e('0x25')]!==_0x2b8e('0x35')){var _0x5efbe9={};_0x5efbe9[_0x2b7020[_0x2b8e('0x20')]]={'$like':'%'+_0x35c80b[_0x2b8e('0x28')][_0x2b8e('0x33')]+'%'};return _0x5efbe9;}})});}_0xb366ad=_['merge']({},_0xb366ad,_0x35c80b[_0x2b8e('0x36')]);var _0x12430c={'where':_0xb366ad[_0x2b8e('0x32')]};return db[_0x2b8e('0x22')][_0x2b8e('0x18')](_0x12430c)['then'](function(_0x11689b){_0x5ab68a[_0x2b8e('0x18')]=_0x11689b;if(_0x35c80b[_0x2b8e('0x28')]['includeAll']){_0xb366ad[_0x2b8e('0x37')]=[{'all':!![]}];}return db[_0x2b8e('0x22')][_0x2b8e('0x38')](_0xb366ad);})[_0x2b8e('0x39')](function(_0x2698e6){_0x5ab68a[_0x2b8e('0x3a')]=_0x2698e6;return _0x5ab68a;})[_0x2b8e('0x39')](respondWithFilteredResult(_0x297332,_0xb366ad))[_0x2b8e('0x3b')](handleError(_0x297332,null));};exports['show']=function(_0x87242a,_0x47462a){var _0x5f08b5={'raw':!![],'where':{'id':_0x87242a[_0x2b8e('0x3c')]['id']}},_0xd03cb0={};_0xd03cb0[_0x2b8e('0x26')]=_[_0x2b8e('0x29')](db[_0x2b8e('0x22')][_0x2b8e('0x23')]);_0xd03cb0[_0x2b8e('0x28')]=_[_0x2b8e('0x29')](_0x87242a[_0x2b8e('0x28')]);_0xd03cb0[_0x2b8e('0x2a')]=_[_0x2b8e('0x2b')](_0xd03cb0[_0x2b8e('0x26')],_0xd03cb0[_0x2b8e('0x28')]);_0x5f08b5[_0x2b8e('0x2d')]=_[_0x2b8e('0x2b')](_0xd03cb0[_0x2b8e('0x26')],qs[_0x2b8e('0x2c')](_0x87242a['query'][_0x2b8e('0x2c')]));_0x5f08b5[_0x2b8e('0x2d')]=_0x5f08b5[_0x2b8e('0x2d')][_0x2b8e('0x2e')]?_0x5f08b5['attributes']:_0xd03cb0[_0x2b8e('0x26')];if(_0x87242a[_0x2b8e('0x28')][_0x2b8e('0x3d')]){_0x5f08b5[_0x2b8e('0x37')]=[{'all':!![]}];}_0x5f08b5=_[_0x2b8e('0x34')]({},_0x5f08b5,_0x87242a[_0x2b8e('0x36')]);return db[_0x2b8e('0x22')]['find'](_0x5f08b5)[_0x2b8e('0x39')](handleEntityNotFound(_0x47462a,null))[_0x2b8e('0x39')](respondWithResult(_0x47462a,null))[_0x2b8e('0x3b')](handleError(_0x47462a,null));};exports[_0x2b8e('0x3e')]=function(_0x38ad8e,_0xe77930){return db[_0x2b8e('0x22')][_0x2b8e('0x3e')](_0x38ad8e[_0x2b8e('0x3f')],{})[_0x2b8e('0x39')](respondWithResult(_0xe77930,0xc9))[_0x2b8e('0x3b')](handleError(_0xe77930,null));};exports['update']=function(_0x26d193,_0x32684d){if(_0x26d193[_0x2b8e('0x3f')]['id']){delete _0x26d193[_0x2b8e('0x3f')]['id'];}return db[_0x2b8e('0x22')][_0x2b8e('0x40')]({'where':{'id':_0x26d193[_0x2b8e('0x3c')]['id']}})[_0x2b8e('0x39')](handleEntityNotFound(_0x32684d,null))[_0x2b8e('0x39')](saveUpdates(_0x26d193[_0x2b8e('0x3f')],null))[_0x2b8e('0x39')](respondWithResult(_0x32684d,null))[_0x2b8e('0x3b')](handleError(_0x32684d,null));};exports[_0x2b8e('0x41')]=function(_0x326036,_0x50dbc9){return db[_0x2b8e('0x22')][_0x2b8e('0x40')]({'where':{'id':_0x326036[_0x2b8e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x50dbc9,null))[_0x2b8e('0x39')](removeEntity(_0x50dbc9,null))[_0x2b8e('0x3b')](handleError(_0x50dbc9,null));};exports[_0x2b8e('0x42')]=function(_0x47e7a4,_0x332aab){return db[_0x2b8e('0x22')]['describe']()[_0x2b8e('0x39')](respondWithResult(_0x332aab,null))['catch'](handleError(_0x332aab,null));}; \ No newline at end of file +var _0xc65e=['rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','SmsTransferReport','fieldName','map','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','merge','find','create','body','describe','eml-format'];(function(_0x469cc8,_0x35b539){var _0x4cd022=function(_0x4ff73f){while(--_0x4ff73f){_0x469cc8['push'](_0x469cc8['shift']());}};_0x4cd022(++_0x35b539);}(_0xc65e,0xe9));var _0xec65=function(_0x5f4e30,_0xfa8b89){_0x5f4e30=_0x5f4e30-0x0;var _0x3ec8b4=_0xc65e[_0x5f4e30];return _0x3ec8b4;};'use strict';var emlformat=require(_0xec65('0x0'));var rimraf=require(_0xec65('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec65('0x2'));var rp=require('request-promise');var moment=require(_0xec65('0x3'));var BPromise=require(_0xec65('0x4'));var Mustache=require('mustache');var util=require(_0xec65('0x5'));var path=require(_0xec65('0x6'));var sox=require(_0xec65('0x7'));var csv=require(_0xec65('0x8'));var ejs=require(_0xec65('0x9'));var fs=require('fs');var fs_extra=require(_0xec65('0xa'));var _=require(_0xec65('0xb'));var squel=require('squel');var crypto=require(_0xec65('0xc'));var jsforce=require(_0xec65('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xec65('0x8'));var querystring=require(_0xec65('0xe'));var Papa=require(_0xec65('0xf'));var Redis=require('ioredis');var authService=require(_0xec65('0x10'));var qs=require(_0xec65('0x11'));var as=require(_0xec65('0x12'));var hardwareService=require(_0xec65('0x13'));var logger=require(_0xec65('0x14'))(_0xec65('0x15'));var utils=require(_0xec65('0x16'));var config=require(_0xec65('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xec65('0x18'))['db'];function respondWithStatusCode(_0x36d3ae,_0x3e3fcf){_0x3e3fcf=_0x3e3fcf||0xcc;return function(_0x579d71){if(_0x579d71){return _0x36d3ae[_0xec65('0x19')](_0x3e3fcf);}return _0x36d3ae[_0xec65('0x1a')](_0x3e3fcf)[_0xec65('0x1b')]();};}function respondWithResult(_0x1bd4f7,_0x25ca4d){_0x25ca4d=_0x25ca4d||0xc8;return function(_0x460c72){if(_0x460c72){return _0x1bd4f7[_0xec65('0x1a')](_0x25ca4d)[_0xec65('0x1c')](_0x460c72);}};}function respondWithFilteredResult(_0x360a33,_0x563644){return function(_0x23a469){if(_0x23a469){var _0x42f0aa=typeof _0x563644[_0xec65('0x1d')]===_0xec65('0x1e')&&typeof _0x563644[_0xec65('0x1f')]===_0xec65('0x1e');var _0xa87847=_0x23a469['count'];var _0x46dfcd=_0x42f0aa?0x0:_0x563644[_0xec65('0x1d')];var _0x55da40=_0x42f0aa?_0x23a469[_0xec65('0x20')]:_0x563644[_0xec65('0x1d')]+_0x563644[_0xec65('0x1f')];var _0x451a14;if(_0x55da40>=_0xa87847){_0x55da40=_0xa87847;_0x451a14=0xc8;}else{_0x451a14=0xce;}_0x360a33[_0xec65('0x1a')](_0x451a14);return _0x360a33[_0xec65('0x21')](_0xec65('0x22'),_0x46dfcd+'-'+_0x55da40+'/'+_0xa87847)[_0xec65('0x1c')](_0x23a469);}return null;};}function patchUpdates(_0x2b78e2){return function(_0x21a515){try{jsonpatch[_0xec65('0x23')](_0x21a515,_0x2b78e2,!![]);}catch(_0x33f43a){return BPromise[_0xec65('0x24')](_0x33f43a);}return _0x21a515[_0xec65('0x25')]();};}function saveUpdates(_0x544a40,_0x472808){return function(_0x2539d7){if(_0x2539d7){return _0x2539d7[_0xec65('0x26')](_0x544a40)[_0xec65('0x27')](function(_0x3d12b0){return _0x3d12b0;});}return null;};}function removeEntity(_0x151389,_0x4ef602){return function(_0x5b3105){if(_0x5b3105){return _0x5b3105[_0xec65('0x28')]()['then'](function(){_0x151389[_0xec65('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d1043,_0x1ae7b9){return function(_0x3af4c4){if(!_0x3af4c4){_0x2d1043['sendStatus'](0x194);}return _0x3af4c4;};}function handleError(_0x28ce2f,_0x3f2811){_0x3f2811=_0x3f2811||0x1f4;return function(_0x2ba311){logger['error'](_0x2ba311['stack']);if(_0x2ba311[_0xec65('0x29')]){delete _0x2ba311[_0xec65('0x29')];}_0x28ce2f['status'](_0x3f2811)[_0xec65('0x2a')](_0x2ba311);};}exports[_0xec65('0x2b')]=function(_0x57f675,_0xf57cb4){var _0x4e4102={},_0xa3c74a={},_0x5c1003={'count':0x0,'rows':[]};var _0x3ef5e0=_['map'](db[_0xec65('0x2c')]['rawAttributes'],function(_0x1f8c85){return{'name':_0x1f8c85[_0xec65('0x2d')],'type':_0x1f8c85['type']['key']};});_0xa3c74a['model']=_[_0xec65('0x2e')](_0x3ef5e0,'name');_0xa3c74a[_0xec65('0x2f')]=_['keys'](_0x57f675[_0xec65('0x2f')]);_0xa3c74a['filters']=_[_0xec65('0x30')](_0xa3c74a['model'],_0xa3c74a[_0xec65('0x2f')]);_0x4e4102[_0xec65('0x31')]=_['intersection'](_0xa3c74a[_0xec65('0x32')],qs[_0xec65('0x33')](_0x57f675[_0xec65('0x2f')][_0xec65('0x33')]));_0x4e4102[_0xec65('0x31')]=_0x4e4102[_0xec65('0x31')][_0xec65('0x34')]?_0x4e4102['attributes']:_0xa3c74a[_0xec65('0x32')];if(!_0x57f675[_0xec65('0x2f')][_0xec65('0x35')](_0xec65('0x36'))){_0x4e4102[_0xec65('0x1f')]=qs[_0xec65('0x1f')](_0x57f675[_0xec65('0x2f')][_0xec65('0x1f')]);_0x4e4102[_0xec65('0x1d')]=qs[_0xec65('0x1d')](_0x57f675[_0xec65('0x2f')][_0xec65('0x1d')]);}_0x4e4102[_0xec65('0x37')]=qs[_0xec65('0x38')](_0x57f675[_0xec65('0x2f')][_0xec65('0x38')]);_0x4e4102[_0xec65('0x39')]=qs[_0xec65('0x3a')](_[_0xec65('0x3b')](_0x57f675['query'],_0xa3c74a[_0xec65('0x3a')]),_0x3ef5e0);if(_0x57f675[_0xec65('0x2f')][_0xec65('0x3c')]){_0x4e4102[_0xec65('0x39')]=_['merge'](_0x4e4102[_0xec65('0x39')],{'$or':_[_0xec65('0x2e')](_0x3ef5e0,function(_0x50ae5b){if(_0x50ae5b[_0xec65('0x3d')]!==_0xec65('0x3e')){var _0x136621={};_0x136621[_0x50ae5b['name']]={'$like':'%'+_0x57f675[_0xec65('0x2f')][_0xec65('0x3c')]+'%'};return _0x136621;}})});}_0x4e4102=_['merge']({},_0x4e4102,_0x57f675[_0xec65('0x3f')]);var _0x22ae13={'where':_0x4e4102[_0xec65('0x39')]};return db[_0xec65('0x2c')][_0xec65('0x20')](_0x22ae13)['then'](function(_0x4981aa){_0x5c1003[_0xec65('0x20')]=_0x4981aa;if(_0x57f675[_0xec65('0x2f')][_0xec65('0x40')]){_0x4e4102[_0xec65('0x41')]=[{'all':!![]}];}return db[_0xec65('0x2c')][_0xec65('0x42')](_0x4e4102);})[_0xec65('0x27')](function(_0x11182e){_0x5c1003[_0xec65('0x43')]=_0x11182e;return _0x5c1003;})['then'](respondWithFilteredResult(_0xf57cb4,_0x4e4102))[_0xec65('0x44')](handleError(_0xf57cb4,null));};exports[_0xec65('0x45')]=function(_0x2089cb,_0x27f530){var _0x588b26={'raw':!![],'where':{'id':_0x2089cb[_0xec65('0x46')]['id']}},_0x3d2196={};_0x3d2196['model']=_[_0xec65('0x47')](db['SmsTransferReport'][_0xec65('0x48')]);_0x3d2196[_0xec65('0x2f')]=_['keys'](_0x2089cb[_0xec65('0x2f')]);_0x3d2196['filters']=_[_0xec65('0x30')](_0x3d2196[_0xec65('0x32')],_0x3d2196[_0xec65('0x2f')]);_0x588b26[_0xec65('0x31')]=_[_0xec65('0x30')](_0x3d2196[_0xec65('0x32')],qs[_0xec65('0x33')](_0x2089cb[_0xec65('0x2f')][_0xec65('0x33')]));_0x588b26[_0xec65('0x31')]=_0x588b26[_0xec65('0x31')][_0xec65('0x34')]?_0x588b26[_0xec65('0x31')]:_0x3d2196['model'];if(_0x2089cb[_0xec65('0x2f')][_0xec65('0x40')]){_0x588b26[_0xec65('0x41')]=[{'all':!![]}];}_0x588b26=_[_0xec65('0x49')]({},_0x588b26,_0x2089cb[_0xec65('0x3f')]);return db[_0xec65('0x2c')][_0xec65('0x4a')](_0x588b26)[_0xec65('0x27')](handleEntityNotFound(_0x27f530,null))['then'](respondWithResult(_0x27f530,null))['catch'](handleError(_0x27f530,null));};exports[_0xec65('0x4b')]=function(_0x1dfabc,_0x2ba7f3){return db[_0xec65('0x2c')][_0xec65('0x4b')](_0x1dfabc[_0xec65('0x4c')],{})[_0xec65('0x27')](respondWithResult(_0x2ba7f3,0xc9))[_0xec65('0x44')](handleError(_0x2ba7f3,null));};exports[_0xec65('0x26')]=function(_0x3fe663,_0x16d664){if(_0x3fe663[_0xec65('0x4c')]['id']){delete _0x3fe663[_0xec65('0x4c')]['id'];}return db[_0xec65('0x2c')][_0xec65('0x4a')]({'where':{'id':_0x3fe663[_0xec65('0x46')]['id']}})[_0xec65('0x27')](handleEntityNotFound(_0x16d664,null))[_0xec65('0x27')](saveUpdates(_0x3fe663[_0xec65('0x4c')],null))['then'](respondWithResult(_0x16d664,null))[_0xec65('0x44')](handleError(_0x16d664,null));};exports[_0xec65('0x28')]=function(_0x44f725,_0x4cc7cd){return db[_0xec65('0x2c')][_0xec65('0x4a')]({'where':{'id':_0x44f725['params']['id']}})[_0xec65('0x27')](handleEntityNotFound(_0x4cc7cd,null))['then'](removeEntity(_0x4cc7cd,null))['catch'](handleError(_0x4cc7cd,null));};exports['describe']=function(_0x1fd827,_0x191714){return db[_0xec65('0x2c')][_0xec65('0x4d')]()[_0xec65('0x27')](respondWithResult(_0x191714,null))['catch'](handleError(_0x191714,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index f0bb640..d77dd3a 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 _0x3212=['../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x3212,0x6f));var _0x2321=function(_0x4cc42e,_0x4b9b36){_0x4cc42e=_0x4cc42e-0x0;var _0x170637=_0x3212[_0x4cc42e];return _0x170637;};'use strict';var _=require(_0x2321('0x0'));var util=require(_0x2321('0x1'));var logger=require(_0x2321('0x2'))(_0x2321('0x3'));var moment=require(_0x2321('0x4'));var BPromise=require(_0x2321('0x5'));var rp=require(_0x2321('0x6'));var fs=require('fs');var path=require(_0x2321('0x7'));var rimraf=require(_0x2321('0x8'));var config=require(_0x2321('0x9'));var attributes=require(_0x2321('0xa'));module[_0x2321('0xb')]=function(_0x53d2e1,_0x14b94e){return _0x53d2e1[_0x2321('0xc')](_0x2321('0xd'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x2321('0xe'),'fields':[_0x2321('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7399=['path','rimraf','../../config/environment','./smsTransferReport.attributes','define','report_sms_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x53115c,_0x4f3917){var _0xbcea2c=function(_0x12253c){while(--_0x12253c){_0x53115c['push'](_0x53115c['shift']());}};_0xbcea2c(++_0x4f3917);}(_0x7399,0x13e));var _0x9739=function(_0x2cd809,_0x4cdedd){_0x2cd809=_0x2cd809-0x0;var _0x5a1519=_0x7399[_0x2cd809];return _0x5a1519;};'use strict';var _=require(_0x9739('0x0'));var util=require(_0x9739('0x1'));var logger=require(_0x9739('0x2'))(_0x9739('0x3'));var moment=require(_0x9739('0x4'));var BPromise=require(_0x9739('0x5'));var rp=require(_0x9739('0x6'));var fs=require('fs');var path=require(_0x9739('0x7'));var rimraf=require(_0x9739('0x8'));var config=require(_0x9739('0x9'));var attributes=require(_0x9739('0xa'));module['exports']=function(_0x5f4e38,_0x4eb9a2){return _0x5f4e38[_0x9739('0xb')]('SmsTransferReport',attributes,{'tableName':_0x9739('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 401d43f..fe9ea0c 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 _0xbecd=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsTransferReport,\x20%s,\x20%s','message','info'];(function(_0x1a8f03,_0x49942f){var _0x5e8a20=function(_0x50dcd8){while(--_0x50dcd8){_0x1a8f03['push'](_0x1a8f03['shift']());}};_0x5e8a20(++_0x49942f);}(_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 moment=require(_0xdbec('0x1'));var BPromise=require(_0xdbec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbec('0x3'));var db=require(_0xdbec('0x4'))['db'];var utils=require(_0xdbec('0x5'));var logger=require(_0xdbec('0x6'))(_0xdbec('0x7'));var config=require(_0xdbec('0x8'));var jayson=require(_0xdbec('0x9'));var client=jayson[_0xdbec('0xa')][_0xdbec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38cac4,_0x13dfff,_0x380bf8){return new BPromise(function(_0x406cd3,_0x242b59){return client[_0xdbec('0xc')](_0x38cac4,_0x380bf8)['then'](function(_0x299d84){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x13dfff,'request\x20sent');logger['debug'](_0xdbec('0xd'),_0x13dfff,_0xdbec('0xe'),JSON['stringify'](_0x299d84));if(_0x299d84[_0xdbec('0xf')]){if(_0x299d84[_0xdbec('0xf')][_0xdbec('0x10')]===0x1f4){logger[_0xdbec('0xf')](_0xdbec('0x11'),_0x13dfff,_0x299d84[_0xdbec('0xf')]['message']);return _0x242b59(_0x299d84[_0xdbec('0xf')][_0xdbec('0x12')]);}logger['error'](_0xdbec('0x11'),_0x13dfff,_0x299d84[_0xdbec('0xf')]['message']);return _0x406cd3(_0x299d84[_0xdbec('0xf')]['message']);}else{logger[_0xdbec('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x13dfff,_0xdbec('0xe'));_0x406cd3(_0x299d84['result']['message']);}})[_0xdbec('0x14')](function(_0x1c9054){logger[_0xdbec('0xf')](_0xdbec('0x11'),_0x13dfff,_0x1c9054);_0x242b59(_0x1c9054);});});} \ No newline at end of file +var _0x423b=['bluebird','ioredis','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','info','result','catch','util'];(function(_0x56cdc0,_0x1dd236){var _0x3bb5d8=function(_0x54c5e2){while(--_0x54c5e2){_0x56cdc0['push'](_0x56cdc0['shift']());}};_0x3bb5d8(++_0x1dd236);}(_0x423b,0x12b));var _0xb423=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x423b[_0x11c573];return _0x6b72de;};'use strict';var _=require('lodash');var util=require(_0xb423('0x0'));var moment=require('moment');var BPromise=require(_0xb423('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb423('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb423('0x3'));var config=require(_0xb423('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xb423('0x5')][_0xb423('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x49eabb,_0x28947d,_0x573e95){return new BPromise(function(_0x4119d7,_0x3ac522){return client[_0xb423('0x7')](_0x49eabb,_0x573e95)[_0xb423('0x8')](function(_0x27dcf3){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x28947d,_0xb423('0x9'));logger[_0xb423('0xa')](_0xb423('0xb'),_0x28947d,_0xb423('0x9'),JSON[_0xb423('0xc')](_0x27dcf3));if(_0x27dcf3['error']){if(_0x27dcf3[_0xb423('0xd')][_0xb423('0xe')]===0x1f4){logger['error'](_0xb423('0xf'),_0x28947d,_0x27dcf3[_0xb423('0xd')][_0xb423('0x10')]);return _0x3ac522(_0x27dcf3['error'][_0xb423('0x10')]);}logger['error'](_0xb423('0xf'),_0x28947d,_0x27dcf3['error']['message']);return _0x4119d7(_0x27dcf3['error'][_0xb423('0x10')]);}else{logger[_0xb423('0x11')](_0xb423('0xf'),_0x28947d,'request\x20sent');_0x4119d7(_0x27dcf3[_0xb423('0x12')][_0xb423('0x10')]);}})[_0xb423('0x13')](function(_0x39edac){logger['error'](_0xb423('0xf'),_0x28947d,_0x39edac);_0x3ac522(_0x39edac);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 3814702..5f31491 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 _0x864a=['../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','show','/:id/download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','post','file','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2912b9,_0x55e6e1){var _0x154da8=function(_0x503667){while(--_0x503667){_0x2912b9['push'](_0x2912b9['shift']());}};_0x154da8(++_0x55e6e1);}(_0x864a,0x161));var _0xa864=function(_0x343817,_0x4f2cb8){_0x343817=_0x343817-0x0;var _0x1b92c7=_0x864a[_0x343817];return _0x1b92c7;};'use strict';var multer=require(_0xa864('0x0'));var util=require(_0xa864('0x1'));var path=require(_0xa864('0x2'));var timeout=require(_0xa864('0x3'));var express=require(_0xa864('0x4'));var router=express[_0xa864('0x5')]();var fs_extra=require(_0xa864('0x6'));var auth=require(_0xa864('0x7'));var interaction=require(_0xa864('0x8'));var config=require('../../config/environment');var controller=require('./sound.controller');router['get']('/',auth[_0xa864('0x9')](),controller[_0xa864('0xa')]);router[_0xa864('0xb')]('/:id',auth[_0xa864('0x9')](),controller[_0xa864('0xc')]);router[_0xa864('0xb')](_0xa864('0xd'),auth[_0xa864('0x9')](),controller['download']);var upload=multer({'storage':multer[_0xa864('0xe')]({'destination':function(_0x135947,_0x44c35e,_0x3edff1){_0x3edff1(null,path['join'](config[_0xa864('0xf')],_0xa864('0x10')));},'filename':function(_0x109710,_0x30f10f,_0x5c3470){_0x30f10f[_0xa864('0x11')]=_0x30f10f[_0xa864('0x11')][_0xa864('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5c3470(null,util[_0xa864('0x13')](_0xa864('0x14'),path['basename'](_0x30f10f[_0xa864('0x11')],path[_0xa864('0x15')](_0x30f10f[_0xa864('0x11')])),Date[_0xa864('0x16')](),path[_0xa864('0x15')](_0x30f10f['originalname'])));}})});router[_0xa864('0x17')]('/',upload['single'](_0xa864('0x18')),controller[_0xa864('0x19')]);router['put'](_0xa864('0x1a'),auth[_0xa864('0x9')](),controller[_0xa864('0x1b')]);router['delete'](_0xa864('0x1a'),auth[_0xa864('0x9')](),controller[_0xa864('0x1c')]);module[_0xa864('0x1d')]=router; \ No newline at end of file +var _0x33c5=['single','file','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x33c5,0xe6));var _0x533c=function(_0x324d02,_0x6d9c0b){_0x324d02=_0x324d02-0x0;var _0x3d4f59=_0x33c5[_0x324d02];return _0x3d4f59;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var fs_extra=require(_0x533c('0x4'));var auth=require(_0x533c('0x5'));var interaction=require(_0x533c('0x6'));var config=require('../../config/environment');var controller=require(_0x533c('0x7'));router[_0x533c('0x8')]('/',auth[_0x533c('0x9')](),controller[_0x533c('0xa')]);router[_0x533c('0x8')](_0x533c('0xb'),auth[_0x533c('0x9')](),controller[_0x533c('0xc')]);router[_0x533c('0x8')](_0x533c('0xd'),auth[_0x533c('0x9')](),controller[_0x533c('0xe')]);var upload=multer({'storage':multer[_0x533c('0xf')]({'destination':function(_0x249f1a,_0x430c51,_0x1b312e){_0x1b312e(null,path['join'](config[_0x533c('0x10')],_0x533c('0x11')));},'filename':function(_0x272a11,_0x1e2b68,_0x1a2c22){_0x1e2b68[_0x533c('0x12')]=_0x1e2b68['originalname'][_0x533c('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1a2c22(null,util[_0x533c('0x14')](_0x533c('0x15'),path[_0x533c('0x16')](_0x1e2b68[_0x533c('0x12')],path[_0x533c('0x17')](_0x1e2b68[_0x533c('0x12')])),Date[_0x533c('0x18')](),path['extname'](_0x1e2b68[_0x533c('0x12')])));}})});router[_0x533c('0x19')]('/',upload[_0x533c('0x1a')](_0x533c('0x1b')),controller['create']);router[_0x533c('0x1c')](_0x533c('0xb'),auth[_0x533c('0x9')](),controller[_0x533c('0x1d')]);router[_0x533c('0x1e')](_0x533c('0xb'),auth[_0x533c('0x9')](),controller[_0x533c('0x1e')]);module[_0x533c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index a7dd63a..80e8bb9 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 _0x4972=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0xaba28a,_0x5c6847){var _0x274ae4=function(_0x5d3f0e){while(--_0x5d3f0e){_0xaba28a['push'](_0xaba28a['shift']());}};_0x274ae4(++_0x5c6847);}(_0x4972,0x147));var _0x2497=function(_0x43f4cf,_0x1cfb38){_0x43f4cf=_0x43f4cf-0x0;var _0x5f2eef=_0x4972[_0x43f4cf];return _0x5f2eef;};'use strict';var Sequelize=require(_0x2497('0x0'));module[_0x2497('0x1')]={'name':{'type':Sequelize[_0x2497('0x2')],'unique':_0x2497('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x2497('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x2497('0x2')]},'original_format':{'type':Sequelize[_0x2497('0x2')]},'original_duration':{'type':Sequelize[_0x2497('0x4')]},'original_sampleCount':{'type':Sequelize[_0x2497('0x5')]},'original_channelCount':{'type':Sequelize[_0x2497('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x2497('0x6')]},'converted_format':{'type':Sequelize[_0x2497('0x2')]},'converted_duration':{'type':Sequelize[_0x2497('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x2497('0x6')]},'converted_bitRate':{'type':Sequelize[_0x2497('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9cbd=['INTEGER','FLOAT','sequelize','STRING','BIGINT'];(function(_0x5432b3,_0xa42b76){var _0x358093=function(_0x544550){while(--_0x544550){_0x5432b3['push'](_0x5432b3['shift']());}};_0x358093(++_0xa42b76);}(_0x9cbd,0x179));var _0xd9cb=function(_0x153ad6,_0x3b9e24){_0x153ad6=_0x153ad6-0x0;var _0x4224aa=_0x9cbd[_0x153ad6];return _0x4224aa;};'use strict';var Sequelize=require(_0xd9cb('0x0'));module['exports']={'name':{'type':Sequelize[_0xd9cb('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xd9cb('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xd9cb('0x1')]},'original_format':{'type':Sequelize[_0xd9cb('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xd9cb('0x2')]},'original_sampleRate':{'type':Sequelize[_0xd9cb('0x3')]},'converted_format':{'type':Sequelize[_0xd9cb('0x1')]},'converted_duration':{'type':Sequelize[_0xd9cb('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xd9cb('0x2')]},'converted_channelCount':{'type':Sequelize[_0xd9cb('0x3')]},'converted_bitRate':{'type':Sequelize[_0xd9cb('0x2')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index fee0783..a110c8b 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 _0xebcf=['path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','save','update','then','destroy','get','Sounds','UserProfileResource','end','error','name','send','index','map','Sound','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','filter','merge','includeAll','include','findAll','rows','show','params','options','find','catch','download','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','%s.%s','format','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','chmodSync','transcode','src','original_duration','duration','original_sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','pick','description','original_format','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache'];(function(_0x499172,_0x5d6e9f){var _0x439036=function(_0xe6f7fa){while(--_0xe6f7fa){_0x499172['push'](_0x499172['shift']());}};_0x439036(++_0x5d6e9f);}(_0xebcf,0x168));var _0xfebc=function(_0x5dd53a,_0x1d5b4f){_0x5dd53a=_0x5dd53a-0x0;var _0x174914=_0xebcf[_0x5dd53a];return _0x174914;};'use strict';var emlformat=require(_0xfebc('0x0'));var rimraf=require(_0xfebc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfebc('0x2'));var rp=require(_0xfebc('0x3'));var moment=require(_0xfebc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfebc('0x5'));var util=require('util');var path=require(_0xfebc('0x6'));var sox=require(_0xfebc('0x7'));var csv=require('to-csv');var ejs=require(_0xfebc('0x8'));var fs=require('fs');var fs_extra=require(_0xfebc('0x9'));var _=require(_0xfebc('0xa'));var squel=require(_0xfebc('0xb'));var crypto=require(_0xfebc('0xc'));var jsforce=require(_0xfebc('0xd'));var deskjs=require(_0xfebc('0xe'));var toCsv=require(_0xfebc('0xf'));var querystring=require(_0xfebc('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfebc('0x11'));var qs=require(_0xfebc('0x12'));var as=require(_0xfebc('0x13'));var hardwareService=require(_0xfebc('0x14'));var logger=require(_0xfebc('0x15'))(_0xfebc('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfebc('0x17'));var db=require(_0xfebc('0x18'))['db'];function respondWithStatusCode(_0x28c140,_0x116db4){_0x116db4=_0x116db4||0xcc;return function(_0x3348b0){if(_0x3348b0){return _0x28c140[_0xfebc('0x19')](_0x116db4);}return _0x28c140[_0xfebc('0x1a')](_0x116db4)['end']();};}function respondWithResult(_0x25881a,_0x55c9fc){_0x55c9fc=_0x55c9fc||0xc8;return function(_0x511153){if(_0x511153){return _0x25881a['status'](_0x55c9fc)[_0xfebc('0x1b')](_0x511153);}};}function respondWithFilteredResult(_0x180f3a,_0x5a5485){return function(_0x3b0fbe){if(_0x3b0fbe){var _0x12893b=typeof _0x5a5485['offset']===_0xfebc('0x1c')&&typeof _0x5a5485[_0xfebc('0x1d')]===_0xfebc('0x1c');var _0x6e29cd=_0x3b0fbe['count'];var _0xee7a68=_0x12893b?0x0:_0x5a5485[_0xfebc('0x1e')];var _0x3dde74=_0x12893b?_0x3b0fbe[_0xfebc('0x1f')]:_0x5a5485['offset']+_0x5a5485[_0xfebc('0x1d')];var _0x1f668f;if(_0x3dde74>=_0x6e29cd){_0x3dde74=_0x6e29cd;_0x1f668f=0xc8;}else{_0x1f668f=0xce;}_0x180f3a[_0xfebc('0x1a')](_0x1f668f);return _0x180f3a[_0xfebc('0x20')](_0xfebc('0x21'),_0xee7a68+'-'+_0x3dde74+'/'+_0x6e29cd)[_0xfebc('0x1b')](_0x3b0fbe);}return null;};}function patchUpdates(_0x46d07c){return function(_0xbbc7eb){try{jsonpatch['apply'](_0xbbc7eb,_0x46d07c,!![]);}catch(_0x1129b1){return BPromise['reject'](_0x1129b1);}return _0xbbc7eb[_0xfebc('0x22')]();};}function saveUpdates(_0xdc0a08,_0x19abc1){return function(_0x35daf1){if(_0x35daf1){return _0x35daf1[_0xfebc('0x23')](_0xdc0a08)[_0xfebc('0x24')](function(_0x5a4500){return _0x5a4500;});}return null;};}function removeEntity(_0x126074,_0x5c2b30){return function(_0x3683c9){if(_0x3683c9){return _0x3683c9[_0xfebc('0x25')]()[_0xfebc('0x24')](function(){var _0x1b463e=_0x3683c9[_0xfebc('0x26')]({'plain':!![]});var _0x477629=_0xfebc('0x27');return db[_0xfebc('0x28')][_0xfebc('0x25')]({'where':{'type':_0x477629,'resourceId':_0x1b463e['id']}})[_0xfebc('0x24')](function(){return _0x3683c9;});})[_0xfebc('0x24')](function(){_0x126074[_0xfebc('0x1a')](0xcc)[_0xfebc('0x29')]();});}};}function handleEntityNotFound(_0x1c772e,_0x702ee1){return function(_0x463959){if(!_0x463959){_0x1c772e[_0xfebc('0x19')](0x194);}return _0x463959;};}function handleError(_0x3f7b85,_0x23aa92){_0x23aa92=_0x23aa92||0x1f4;return function(_0x3e34e6){logger[_0xfebc('0x2a')](_0x3e34e6['stack']);if(_0x3e34e6[_0xfebc('0x2b')]){delete _0x3e34e6[_0xfebc('0x2b')];}_0x3f7b85[_0xfebc('0x1a')](_0x23aa92)[_0xfebc('0x2c')](_0x3e34e6);};}exports[_0xfebc('0x2d')]=function(_0x4d050d,_0x14938b){var _0x240151={},_0x48fe2b={},_0x220a55={'count':0x0,'rows':[]};var _0x28ef2d=_[_0xfebc('0x2e')](db[_0xfebc('0x2f')][_0xfebc('0x30')],function(_0x199ab7){return{'name':_0x199ab7['fieldName'],'type':_0x199ab7[_0xfebc('0x31')][_0xfebc('0x32')]};});_0x48fe2b[_0xfebc('0x33')]=_[_0xfebc('0x2e')](_0x28ef2d,'name');_0x48fe2b[_0xfebc('0x34')]=_[_0xfebc('0x35')](_0x4d050d[_0xfebc('0x34')]);_0x48fe2b[_0xfebc('0x36')]=_[_0xfebc('0x37')](_0x48fe2b[_0xfebc('0x33')],_0x48fe2b['query']);_0x240151[_0xfebc('0x38')]=_['intersection'](_0x48fe2b[_0xfebc('0x33')],qs[_0xfebc('0x39')](_0x4d050d[_0xfebc('0x34')][_0xfebc('0x39')]));_0x240151['attributes']=_0x240151['attributes']['length']?_0x240151[_0xfebc('0x38')]:_0x48fe2b[_0xfebc('0x33')];if(!_0x4d050d['query']['hasOwnProperty'](_0xfebc('0x3a'))){_0x240151[_0xfebc('0x1d')]=qs[_0xfebc('0x1d')](_0x4d050d[_0xfebc('0x34')]['limit']);_0x240151['offset']=qs['offset'](_0x4d050d[_0xfebc('0x34')][_0xfebc('0x1e')]);}_0x240151['order']=qs['sort'](_0x4d050d[_0xfebc('0x34')][_0xfebc('0x3b')]);_0x240151[_0xfebc('0x3c')]=qs[_0xfebc('0x36')](_['pick'](_0x4d050d[_0xfebc('0x34')],_0x48fe2b['filters']),_0x28ef2d);if(_0x4d050d[_0xfebc('0x34')][_0xfebc('0x3d')]){_0x240151[_0xfebc('0x3c')]=_[_0xfebc('0x3e')](_0x240151[_0xfebc('0x3c')],{'$or':_[_0xfebc('0x2e')](_0x28ef2d,function(_0x25e3d6){if(_0x25e3d6['type']!=='VIRTUAL'){var _0x369e27={};_0x369e27[_0x25e3d6[_0xfebc('0x2b')]]={'$like':'%'+_0x4d050d[_0xfebc('0x34')][_0xfebc('0x3d')]+'%'};return _0x369e27;}})});}_0x240151=_[_0xfebc('0x3e')]({},_0x240151,_0x4d050d['options']);var _0x13a47a={'where':_0x240151[_0xfebc('0x3c')]};return db['Sound'][_0xfebc('0x1f')](_0x13a47a)['then'](function(_0x5229da){_0x220a55['count']=_0x5229da;if(_0x4d050d[_0xfebc('0x34')][_0xfebc('0x3f')]){_0x240151[_0xfebc('0x40')]=[{'all':!![]}];}return db['Sound'][_0xfebc('0x41')](_0x240151);})[_0xfebc('0x24')](function(_0x46de26){_0x220a55[_0xfebc('0x42')]=_0x46de26;return _0x220a55;})[_0xfebc('0x24')](respondWithFilteredResult(_0x14938b,_0x240151))['catch'](handleError(_0x14938b,null));};exports[_0xfebc('0x43')]=function(_0x139ed5,_0x33e9fe){var _0x41aa4d={'raw':!![],'where':{'id':_0x139ed5[_0xfebc('0x44')]['id']}},_0x24a90f={};_0x24a90f['model']=_[_0xfebc('0x35')](db[_0xfebc('0x2f')]['rawAttributes']);_0x24a90f[_0xfebc('0x34')]=_['keys'](_0x139ed5[_0xfebc('0x34')]);_0x24a90f[_0xfebc('0x36')]=_[_0xfebc('0x37')](_0x24a90f['model'],_0x24a90f['query']);_0x41aa4d['attributes']=_[_0xfebc('0x37')](_0x24a90f[_0xfebc('0x33')],qs[_0xfebc('0x39')](_0x139ed5[_0xfebc('0x34')][_0xfebc('0x39')]));_0x41aa4d[_0xfebc('0x38')]=_0x41aa4d[_0xfebc('0x38')]['length']?_0x41aa4d[_0xfebc('0x38')]:_0x24a90f[_0xfebc('0x33')];if(_0x139ed5[_0xfebc('0x34')]['includeAll']){_0x41aa4d[_0xfebc('0x40')]=[{'all':!![]}];}_0x41aa4d=_[_0xfebc('0x3e')]({},_0x41aa4d,_0x139ed5[_0xfebc('0x45')]);return db[_0xfebc('0x2f')][_0xfebc('0x46')](_0x41aa4d)[_0xfebc('0x24')](handleEntityNotFound(_0x33e9fe,null))[_0xfebc('0x24')](respondWithResult(_0x33e9fe,null))[_0xfebc('0x47')](handleError(_0x33e9fe,null));};exports[_0xfebc('0x48')]=function(_0x2276bf,_0x3d8ffd,_0x59b0d2){return db['Sound']['find']({'where':{'id':_0x2276bf[_0xfebc('0x44')]['id']},'attributes':[_0xfebc('0x2b'),_0xfebc('0x49'),_0xfebc('0x4a')],'raw':!![]})[_0xfebc('0x24')](handleEntityNotFound(_0x3d8ffd,null))[_0xfebc('0x24')](function(_0x22c2ca){if(_0x22c2ca){if(!fs['existsSync'](path[_0xfebc('0x4b')](config[_0xfebc('0x4c')],_0xfebc('0x4d'),_0x22c2ca[_0xfebc('0x49')]+'.'+_0x22c2ca['converted_format']))){throw new db[(_0xfebc('0x4e'))][(_0xfebc('0x4f'))]('Sound\x20not\x20found');}return _0x3d8ffd[_0xfebc('0x48')](path['join'](config[_0xfebc('0x4c')],_0xfebc('0x4d'),util['format'](_0xfebc('0x50'),_0x22c2ca[_0xfebc('0x49')],_0x22c2ca['converted_format'])),util[_0xfebc('0x51')](_0xfebc('0x50'),_0x22c2ca[_0xfebc('0x2b')],_0x22c2ca[_0xfebc('0x4a')]));}return null;})[_0xfebc('0x47')](handleError(_0x3d8ffd,null));};exports[_0xfebc('0x52')]=function(_0x3fd432,_0x1fb6b4,_0x3f04e5){var _0x5bec1e={'name':path[_0xfebc('0x53')](_0x3fd432[_0xfebc('0x54')][_0xfebc('0x55')],path[_0xfebc('0x56')](_0x3fd432[_0xfebc('0x54')]['originalname'])),'save_name':path['basename'](_0x3fd432[_0xfebc('0x54')]['filename'],path[_0xfebc('0x56')](_0x3fd432['file'][_0xfebc('0x57')])),'original_format':path[_0xfebc('0x56')](_0x3fd432[_0xfebc('0x54')][_0xfebc('0x55')])[_0xfebc('0x58')](0x1),'converted_format':_0xfebc('0x59')};var _0xe3be25=path['join'](config[_0xfebc('0x4c')],_0xfebc('0x5a'),_0x3fd432[_0xfebc('0x54')]['filename']);var _0x52920d=path['join'](config[_0xfebc('0x4c')],'server/files/sounds/converted',util['format'](_0xfebc('0x50'),path[_0xfebc('0x53')](_0x3fd432[_0xfebc('0x54')]['filename'],path['extname'](_0x3fd432[_0xfebc('0x54')][_0xfebc('0x57')])),_0x5bec1e['converted_format']));logger['info'](_0xfebc('0x5b'),_0xe3be25);logger[_0xfebc('0x5c')]('Sound\x20upload\x20destination:\x20%s',_0x52920d);try{fs[_0xfebc('0x5d')](_0xe3be25,parseInt('0777',0x8));var _0x1b174a=sox[_0xfebc('0x5e')](_0xe3be25,_0x52920d,{'sampleRate':0x1f40,'format':_0xfebc('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1b174a['on'](_0xfebc('0x2a'),function(_0x3f97a2){fs['unlinkSync'](_0xe3be25);_0x1fb6b4['status'](0x1f4)[_0xfebc('0x2c')](_0x3f97a2);});_0x1b174a['on'](_0xfebc('0x5f'),function(_0x504f34){_0x5bec1e[_0xfebc('0x60')]=isNaN(_0x504f34[_0xfebc('0x61')])?null:_0x504f34[_0xfebc('0x61')]*0x3e8;_0x5bec1e[_0xfebc('0x62')]=isNaN(_0x504f34['sampleCount'])?null:_0x504f34['sampleCount'];_0x5bec1e[_0xfebc('0x63')]=isNaN(_0x504f34['channelCount'])?null:_0x504f34[_0xfebc('0x64')];_0x5bec1e[_0xfebc('0x65')]=isNaN(_0x504f34[_0xfebc('0x66')])?null:_0x504f34['bitRate'];_0x5bec1e[_0xfebc('0x67')]=isNaN(_0x504f34['sampleRate'])?null:_0x504f34[_0xfebc('0x68')];});_0x1b174a['on'](_0xfebc('0x69'),function(_0x29c7a8){_0x5bec1e[_0xfebc('0x6a')]=isNaN(_0x29c7a8[_0xfebc('0x61')])?null:_0x29c7a8[_0xfebc('0x61')]*0x3e8;_0x5bec1e[_0xfebc('0x6b')]=isNaN(_0x29c7a8[_0xfebc('0x6c')])?null:_0x29c7a8['sampleCount'];_0x5bec1e[_0xfebc('0x6d')]=isNaN(_0x29c7a8[_0xfebc('0x64')])?null:_0x29c7a8[_0xfebc('0x64')];_0x5bec1e[_0xfebc('0x6e')]=isNaN(_0x29c7a8['bitRate'])?null:_0x29c7a8[_0xfebc('0x66')];_0x5bec1e[_0xfebc('0x6f')]=isNaN(_0x29c7a8[_0xfebc('0x68')])?null:_0x29c7a8['sampleRate'];});_0x1b174a['on'](_0xfebc('0x29'),function(){fs['chmodSync'](_0x52920d,parseInt(_0xfebc('0x70'),0x8));return db[_0xfebc('0x2f')][_0xfebc('0x52')](_0x5bec1e)['then'](function(_0x34a50f){var _0x3543c9={'role':_0x3fd432[_0xfebc('0x71')][_0xfebc('0x72')],'userProfileId':_0x3fd432[_0xfebc('0x71')][_0xfebc('0x73')]};if(!_0x3543c9)throw new Error(_0xfebc('0x74'));if(_0x3543c9[_0xfebc('0x72')]==='user'){var _0x27b8bf=_0x34a50f['get']({'plain':!![]});return db['UserProfileSection'][_0xfebc('0x46')]({'where':{'name':_0xfebc('0x27'),'userProfileId':_0x3543c9[_0xfebc('0x73')]},'raw':!![]})[_0xfebc('0x24')](function(_0x58501e){if(_0x58501e&&_0x58501e[_0xfebc('0x75')]===0x0){return db[_0xfebc('0x28')][_0xfebc('0x52')]({'name':_0x27b8bf[_0xfebc('0x2b')],'resourceId':_0x27b8bf['id'],'type':_0x58501e[_0xfebc('0x2b')],'sectionId':_0x58501e['id']},{})[_0xfebc('0x24')](function(){return _0x34a50f;});}else{return _0x34a50f;}})[_0xfebc('0x47')](function(_0x2a50b7){logger[_0xfebc('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a50b7);throw _0x2a50b7;});}return _0x34a50f;})[_0xfebc('0x24')](respondWithResult(_0x1fb6b4,null))[_0xfebc('0x47')](handleError(_0x1fb6b4,null));});_0x1b174a['start']();}catch(_0x58cc1d){_0x1fb6b4['status'](0x1f4)[_0xfebc('0x2c')](_0x58cc1d);}};exports[_0xfebc('0x23')]=function(_0x290969,_0x3cf24f,_0x20e785){return db[_0xfebc('0x2f')][_0xfebc('0x46')]({'where':{'id':_0x290969['params']['id']}})[_0xfebc('0x24')](handleEntityNotFound(_0x3cf24f,null))[_0xfebc('0x24')](saveUpdates(_[_0xfebc('0x76')](_0x290969['body'],[_0xfebc('0x2b'),_0xfebc('0x77')]),null))['then'](respondWithResult(_0x3cf24f,null))['catch'](handleError(_0x3cf24f,null));};exports['delete']=function(_0x3a21f5,_0x349bd8,_0x1c49d9){return db[_0xfebc('0x2f')][_0xfebc('0x46')]({'where':{'id':_0x3a21f5[_0xfebc('0x44')]['id']}})[_0xfebc('0x24')](function(_0x2e2db4){if(_0x2e2db4){return _0x2e2db4[_0xfebc('0x25')]();}})['then'](function(_0x1ed7f1){var _0x49dd5b=path[_0xfebc('0x4b')](config[_0xfebc('0x4c')],_0xfebc('0x5a'),util[_0xfebc('0x51')](_0xfebc('0x50'),_0x1ed7f1[_0xfebc('0x49')],_0x1ed7f1[_0xfebc('0x78')]));var _0x43f684=path[_0xfebc('0x4b')](config[_0xfebc('0x4c')],_0xfebc('0x4d'),util[_0xfebc('0x51')](_0xfebc('0x50'),_0x1ed7f1[_0xfebc('0x49')],_0x1ed7f1[_0xfebc('0x4a')]));fs[_0xfebc('0x79')](_0x49dd5b);fs['unlinkSync'](_0x43f684);return _0x1ed7f1;})[_0xfebc('0x24')](function(_0x179f5c){if(_0x179f5c){return _0x349bd8[_0xfebc('0x1a')](0xcc)[_0xfebc('0x29')]();}})[_0xfebc('0x24')](handleEntityNotFound(_0x349bd8,null))[_0xfebc('0x47')](handleError(_0x349bd8,null));}; \ No newline at end of file +var _0x1968=['duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_channelCount','converted_sampleRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','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','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','Sound','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','originalname','extname','file','basename','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','chmodSync','unlinkSync','src','original_duration'];(function(_0xca341e,_0x50b6c6){var _0x296e77=function(_0xd8b189){while(--_0xd8b189){_0xca341e['push'](_0xca341e['shift']());}};_0x296e77(++_0x50b6c6);}(_0x1968,0x199));var _0x8196=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x1968[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require(_0x8196('0x0'));var rimraf=require(_0x8196('0x1'));var zipdir=require(_0x8196('0x2'));var jsonpatch=require(_0x8196('0x3'));var rp=require(_0x8196('0x4'));var moment=require(_0x8196('0x5'));var BPromise=require(_0x8196('0x6'));var Mustache=require(_0x8196('0x7'));var util=require(_0x8196('0x8'));var path=require(_0x8196('0x9'));var sox=require('sox');var csv=require(_0x8196('0xa'));var ejs=require(_0x8196('0xb'));var fs=require('fs');var fs_extra=require(_0x8196('0xc'));var _=require(_0x8196('0xd'));var squel=require(_0x8196('0xe'));var crypto=require(_0x8196('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8196('0x10'));var toCsv=require(_0x8196('0xa'));var querystring=require(_0x8196('0x11'));var Papa=require('papaparse');var Redis=require(_0x8196('0x12'));var authService=require(_0x8196('0x13'));var qs=require(_0x8196('0x14'));var as=require(_0x8196('0x15'));var hardwareService=require(_0x8196('0x16'));var logger=require(_0x8196('0x17'))(_0x8196('0x18'));var utils=require(_0x8196('0x19'));var config=require(_0x8196('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x8196('0x1b'))['db'];function respondWithStatusCode(_0x4bd36e,_0x49173c){_0x49173c=_0x49173c||0xcc;return function(_0x186e8e){if(_0x186e8e){return _0x4bd36e[_0x8196('0x1c')](_0x49173c);}return _0x4bd36e[_0x8196('0x1d')](_0x49173c)[_0x8196('0x1e')]();};}function respondWithResult(_0x175513,_0x1225fd){_0x1225fd=_0x1225fd||0xc8;return function(_0x58cc07){if(_0x58cc07){return _0x175513[_0x8196('0x1d')](_0x1225fd)[_0x8196('0x1f')](_0x58cc07);}};}function respondWithFilteredResult(_0xdcdefe,_0x51ea00){return function(_0x5267cb){if(_0x5267cb){var _0x163455=typeof _0x51ea00[_0x8196('0x20')]===_0x8196('0x21')&&typeof _0x51ea00[_0x8196('0x22')]==='undefined';var _0x2ac47e=_0x5267cb[_0x8196('0x23')];var _0x2c1518=_0x163455?0x0:_0x51ea00[_0x8196('0x20')];var _0x4fb45b=_0x163455?_0x5267cb[_0x8196('0x23')]:_0x51ea00[_0x8196('0x20')]+_0x51ea00[_0x8196('0x22')];var _0xb050e7;if(_0x4fb45b>=_0x2ac47e){_0x4fb45b=_0x2ac47e;_0xb050e7=0xc8;}else{_0xb050e7=0xce;}_0xdcdefe[_0x8196('0x1d')](_0xb050e7);return _0xdcdefe[_0x8196('0x24')](_0x8196('0x25'),_0x2c1518+'-'+_0x4fb45b+'/'+_0x2ac47e)['json'](_0x5267cb);}return null;};}function patchUpdates(_0x523c76){return function(_0x5540bc){try{jsonpatch['apply'](_0x5540bc,_0x523c76,!![]);}catch(_0x2c75ff){return BPromise[_0x8196('0x26')](_0x2c75ff);}return _0x5540bc['save']();};}function saveUpdates(_0x37f058,_0x1a578b){return function(_0x1524b8){if(_0x1524b8){return _0x1524b8[_0x8196('0x27')](_0x37f058)[_0x8196('0x28')](function(_0x487105){return _0x487105;});}return null;};}function removeEntity(_0x2c3500,_0xca4ad0){return function(_0x1ff9d4){if(_0x1ff9d4){return _0x1ff9d4[_0x8196('0x29')]()[_0x8196('0x28')](function(){var _0x3cec6e=_0x1ff9d4[_0x8196('0x2a')]({'plain':!![]});var _0x4f9585=_0x8196('0x2b');return db[_0x8196('0x2c')]['destroy']({'where':{'type':_0x4f9585,'resourceId':_0x3cec6e['id']}})['then'](function(){return _0x1ff9d4;});})['then'](function(){_0x2c3500[_0x8196('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31d4c0,_0x4c2a72){return function(_0x19fa5d){if(!_0x19fa5d){_0x31d4c0[_0x8196('0x1c')](0x194);}return _0x19fa5d;};}function handleError(_0x21dc08,_0x3ea830){_0x3ea830=_0x3ea830||0x1f4;return function(_0x465924){logger[_0x8196('0x2d')](_0x465924[_0x8196('0x2e')]);if(_0x465924[_0x8196('0x2f')]){delete _0x465924[_0x8196('0x2f')];}_0x21dc08['status'](_0x3ea830)[_0x8196('0x30')](_0x465924);};}exports[_0x8196('0x31')]=function(_0x45eb83,_0x1e8f22){var _0x35a6b={},_0x414222={},_0x1ed7c8={'count':0x0,'rows':[]};var _0x313930=_[_0x8196('0x32')](db['Sound']['rawAttributes'],function(_0x183489){return{'name':_0x183489[_0x8196('0x33')],'type':_0x183489[_0x8196('0x34')][_0x8196('0x35')]};});_0x414222[_0x8196('0x36')]=_[_0x8196('0x32')](_0x313930,_0x8196('0x2f'));_0x414222[_0x8196('0x37')]=_[_0x8196('0x38')](_0x45eb83[_0x8196('0x37')]);_0x414222[_0x8196('0x39')]=_[_0x8196('0x3a')](_0x414222[_0x8196('0x36')],_0x414222[_0x8196('0x37')]);_0x35a6b[_0x8196('0x3b')]=_['intersection'](_0x414222[_0x8196('0x36')],qs[_0x8196('0x3c')](_0x45eb83[_0x8196('0x37')][_0x8196('0x3c')]));_0x35a6b[_0x8196('0x3b')]=_0x35a6b['attributes']['length']?_0x35a6b['attributes']:_0x414222['model'];if(!_0x45eb83[_0x8196('0x37')]['hasOwnProperty'](_0x8196('0x3d'))){_0x35a6b[_0x8196('0x22')]=qs['limit'](_0x45eb83[_0x8196('0x37')][_0x8196('0x22')]);_0x35a6b['offset']=qs[_0x8196('0x20')](_0x45eb83[_0x8196('0x37')][_0x8196('0x20')]);}_0x35a6b[_0x8196('0x3e')]=qs[_0x8196('0x3f')](_0x45eb83[_0x8196('0x37')][_0x8196('0x3f')]);_0x35a6b[_0x8196('0x40')]=qs['filters'](_['pick'](_0x45eb83[_0x8196('0x37')],_0x414222['filters']),_0x313930);if(_0x45eb83[_0x8196('0x37')][_0x8196('0x41')]){_0x35a6b[_0x8196('0x40')]=_[_0x8196('0x42')](_0x35a6b[_0x8196('0x40')],{'$or':_[_0x8196('0x32')](_0x313930,function(_0x2c02a9){if(_0x2c02a9[_0x8196('0x34')]!==_0x8196('0x43')){var _0x821e1b={};_0x821e1b[_0x2c02a9[_0x8196('0x2f')]]={'$like':'%'+_0x45eb83[_0x8196('0x37')][_0x8196('0x41')]+'%'};return _0x821e1b;}})});}_0x35a6b=_[_0x8196('0x42')]({},_0x35a6b,_0x45eb83[_0x8196('0x44')]);var _0x46aed7={'where':_0x35a6b[_0x8196('0x40')]};return db['Sound'][_0x8196('0x23')](_0x46aed7)[_0x8196('0x28')](function(_0x2252f0){_0x1ed7c8[_0x8196('0x23')]=_0x2252f0;if(_0x45eb83[_0x8196('0x37')]['includeAll']){_0x35a6b[_0x8196('0x45')]=[{'all':!![]}];}return db[_0x8196('0x46')][_0x8196('0x47')](_0x35a6b);})[_0x8196('0x28')](function(_0x3863c6){_0x1ed7c8[_0x8196('0x48')]=_0x3863c6;return _0x1ed7c8;})[_0x8196('0x28')](respondWithFilteredResult(_0x1e8f22,_0x35a6b))[_0x8196('0x49')](handleError(_0x1e8f22,null));};exports[_0x8196('0x4a')]=function(_0x3341b0,_0x474598){var _0x13e69e={'raw':!![],'where':{'id':_0x3341b0[_0x8196('0x4b')]['id']}},_0x32eb85={};_0x32eb85[_0x8196('0x36')]=_[_0x8196('0x38')](db[_0x8196('0x46')][_0x8196('0x4c')]);_0x32eb85[_0x8196('0x37')]=_['keys'](_0x3341b0[_0x8196('0x37')]);_0x32eb85[_0x8196('0x39')]=_[_0x8196('0x3a')](_0x32eb85[_0x8196('0x36')],_0x32eb85['query']);_0x13e69e[_0x8196('0x3b')]=_[_0x8196('0x3a')](_0x32eb85['model'],qs[_0x8196('0x3c')](_0x3341b0[_0x8196('0x37')][_0x8196('0x3c')]));_0x13e69e['attributes']=_0x13e69e[_0x8196('0x3b')][_0x8196('0x4d')]?_0x13e69e[_0x8196('0x3b')]:_0x32eb85[_0x8196('0x36')];if(_0x3341b0['query'][_0x8196('0x4e')]){_0x13e69e[_0x8196('0x45')]=[{'all':!![]}];}_0x13e69e=_[_0x8196('0x42')]({},_0x13e69e,_0x3341b0[_0x8196('0x44')]);return db[_0x8196('0x46')][_0x8196('0x4f')](_0x13e69e)[_0x8196('0x28')](handleEntityNotFound(_0x474598,null))[_0x8196('0x28')](respondWithResult(_0x474598,null))[_0x8196('0x49')](handleError(_0x474598,null));};exports[_0x8196('0x50')]=function(_0x396f2d,_0x559737,_0x2a631a){return db[_0x8196('0x46')][_0x8196('0x4f')]({'where':{'id':_0x396f2d[_0x8196('0x4b')]['id']},'attributes':['name',_0x8196('0x51'),_0x8196('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x559737,null))[_0x8196('0x28')](function(_0x56e555){if(_0x56e555){if(!fs[_0x8196('0x53')](path[_0x8196('0x54')](config[_0x8196('0x55')],_0x8196('0x56'),_0x56e555['save_name']+'.'+_0x56e555[_0x8196('0x52')]))){throw new db[(_0x8196('0x57'))][(_0x8196('0x58'))](_0x8196('0x59'));}return _0x559737[_0x8196('0x50')](path['join'](config['root'],'server/files/sounds/converted',util[_0x8196('0x5a')](_0x8196('0x5b'),_0x56e555[_0x8196('0x51')],_0x56e555[_0x8196('0x52')])),util[_0x8196('0x5a')](_0x8196('0x5b'),_0x56e555[_0x8196('0x2f')],_0x56e555[_0x8196('0x52')]));}return null;})[_0x8196('0x49')](handleError(_0x559737,null));};exports[_0x8196('0x5c')]=function(_0x321edd,_0x520886,_0x19a5bb){var _0xfc2c38={'name':path['basename'](_0x321edd['file'][_0x8196('0x5d')],path[_0x8196('0x5e')](_0x321edd[_0x8196('0x5f')][_0x8196('0x5d')])),'save_name':path[_0x8196('0x60')](_0x321edd[_0x8196('0x5f')]['filename'],path[_0x8196('0x5e')](_0x321edd[_0x8196('0x5f')][_0x8196('0x61')])),'original_format':path[_0x8196('0x5e')](_0x321edd[_0x8196('0x5f')][_0x8196('0x5d')])[_0x8196('0x62')](0x1),'converted_format':_0x8196('0x63')};var _0x502c78=path[_0x8196('0x54')](config[_0x8196('0x55')],_0x8196('0x64'),_0x321edd['file'][_0x8196('0x61')]);var _0x486775=path[_0x8196('0x54')](config[_0x8196('0x55')],_0x8196('0x56'),util['format'](_0x8196('0x5b'),path['basename'](_0x321edd[_0x8196('0x5f')][_0x8196('0x61')],path[_0x8196('0x5e')](_0x321edd[_0x8196('0x5f')]['filename'])),_0xfc2c38[_0x8196('0x52')]));logger['info'](_0x8196('0x65'),_0x502c78);logger[_0x8196('0x66')]('Sound\x20upload\x20destination:\x20%s',_0x486775);try{fs[_0x8196('0x67')](_0x502c78,parseInt('0777',0x8));var _0x19d6d1=sox['transcode'](_0x502c78,_0x486775,{'sampleRate':0x1f40,'format':_0x8196('0x63'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x19d6d1['on']('error',function(_0x569d41){fs[_0x8196('0x68')](_0x502c78);_0x520886[_0x8196('0x1d')](0x1f4)[_0x8196('0x30')](_0x569d41);});_0x19d6d1['on'](_0x8196('0x69'),function(_0x417fcd){_0xfc2c38[_0x8196('0x6a')]=isNaN(_0x417fcd[_0x8196('0x6b')])?null:_0x417fcd[_0x8196('0x6b')]*0x3e8;_0xfc2c38[_0x8196('0x6c')]=isNaN(_0x417fcd[_0x8196('0x6d')])?null:_0x417fcd[_0x8196('0x6d')];_0xfc2c38['original_channelCount']=isNaN(_0x417fcd[_0x8196('0x6e')])?null:_0x417fcd[_0x8196('0x6e')];_0xfc2c38[_0x8196('0x6f')]=isNaN(_0x417fcd[_0x8196('0x70')])?null:_0x417fcd[_0x8196('0x70')];_0xfc2c38['original_sampleRate']=isNaN(_0x417fcd[_0x8196('0x71')])?null:_0x417fcd['sampleRate'];});_0x19d6d1['on'](_0x8196('0x72'),function(_0x522c3a){_0xfc2c38['converted_duration']=isNaN(_0x522c3a[_0x8196('0x6b')])?null:_0x522c3a[_0x8196('0x6b')]*0x3e8;_0xfc2c38['converted_sampleCount']=isNaN(_0x522c3a[_0x8196('0x6d')])?null:_0x522c3a[_0x8196('0x6d')];_0xfc2c38[_0x8196('0x73')]=isNaN(_0x522c3a[_0x8196('0x6e')])?null:_0x522c3a[_0x8196('0x6e')];_0xfc2c38['converted_bitRate']=isNaN(_0x522c3a['bitRate'])?null:_0x522c3a[_0x8196('0x70')];_0xfc2c38[_0x8196('0x74')]=isNaN(_0x522c3a['sampleRate'])?null:_0x522c3a[_0x8196('0x71')];});_0x19d6d1['on']('end',function(){fs[_0x8196('0x67')](_0x486775,parseInt(_0x8196('0x75'),0x8));return db[_0x8196('0x46')][_0x8196('0x5c')](_0xfc2c38)[_0x8196('0x28')](function(_0x111970){var _0x13f73d={'role':_0x321edd[_0x8196('0x76')][_0x8196('0x77')],'userProfileId':_0x321edd['body'][_0x8196('0x78')]};if(!_0x13f73d)throw new Error(_0x8196('0x79'));if(_0x13f73d[_0x8196('0x77')]===_0x8196('0x7a')){var _0x9547eb=_0x111970[_0x8196('0x2a')]({'plain':!![]});return db[_0x8196('0x7b')][_0x8196('0x4f')]({'where':{'name':_0x8196('0x2b'),'userProfileId':_0x13f73d[_0x8196('0x78')]},'raw':!![]})[_0x8196('0x28')](function(_0x2d00b9){if(_0x2d00b9&&_0x2d00b9[_0x8196('0x7c')]===0x0){return db['UserProfileResource'][_0x8196('0x5c')]({'name':_0x9547eb[_0x8196('0x2f')],'resourceId':_0x9547eb['id'],'type':_0x2d00b9['name'],'sectionId':_0x2d00b9['id']},{})[_0x8196('0x28')](function(){return _0x111970;});}else{return _0x111970;}})[_0x8196('0x49')](function(_0x2d1ee7){logger[_0x8196('0x2d')](_0x8196('0x7d'),_0x2d1ee7);throw _0x2d1ee7;});}return _0x111970;})[_0x8196('0x28')](respondWithResult(_0x520886,null))['catch'](handleError(_0x520886,null));});_0x19d6d1[_0x8196('0x7e')]();}catch(_0xf6dc44){_0x520886[_0x8196('0x1d')](0x1f4)[_0x8196('0x30')](_0xf6dc44);}};exports[_0x8196('0x27')]=function(_0xafeaca,_0x747a58,_0x1bc3d8){return db['Sound'][_0x8196('0x4f')]({'where':{'id':_0xafeaca[_0x8196('0x4b')]['id']}})[_0x8196('0x28')](handleEntityNotFound(_0x747a58,null))[_0x8196('0x28')](saveUpdates(_['pick'](_0xafeaca['body'],[_0x8196('0x2f'),_0x8196('0x7f')]),null))[_0x8196('0x28')](respondWithResult(_0x747a58,null))[_0x8196('0x49')](handleError(_0x747a58,null));};exports['delete']=function(_0x126c25,_0x361a26,_0x16e8dd){return db[_0x8196('0x46')][_0x8196('0x4f')]({'where':{'id':_0x126c25[_0x8196('0x4b')]['id']}})[_0x8196('0x28')](function(_0x50aa49){if(_0x50aa49){return _0x50aa49['destroy']();}})['then'](function(_0x410495){var _0xdf17e0=path[_0x8196('0x54')](config[_0x8196('0x55')],_0x8196('0x64'),util[_0x8196('0x5a')](_0x8196('0x5b'),_0x410495[_0x8196('0x51')],_0x410495[_0x8196('0x80')]));var _0x16773f=path['join'](config[_0x8196('0x55')],_0x8196('0x56'),util[_0x8196('0x5a')](_0x8196('0x5b'),_0x410495[_0x8196('0x51')],_0x410495[_0x8196('0x52')]));fs[_0x8196('0x68')](_0xdf17e0);fs[_0x8196('0x68')](_0x16773f);return _0x410495;})[_0x8196('0x28')](function(_0x4eba6c){if(_0x4eba6c){return _0x361a26[_0x8196('0x1d')](0xcc)[_0x8196('0x1e')]();}})[_0x8196('0x28')](handleEntityNotFound(_0x361a26,null))[_0x8196('0x49')](handleError(_0x361a26,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index c331844..10eed9e 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 _0xed91=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Sound','lodash'];(function(_0x136514,_0x158581){var _0x19ac59=function(_0x1df743){while(--_0x1df743){_0x136514['push'](_0x136514['shift']());}};_0x19ac59(++_0x158581);}(_0xed91,0x1c2));var _0x1ed9=function(_0x2bcfbb,_0xfaf1ad){_0x2bcfbb=_0x2bcfbb-0x0;var _0x3f2154=_0xed91[_0x2bcfbb];return _0x3f2154;};'use strict';var _=require(_0x1ed9('0x0'));var util=require(_0x1ed9('0x1'));var logger=require(_0x1ed9('0x2'))('api');var moment=require(_0x1ed9('0x3'));var BPromise=require(_0x1ed9('0x4'));var rp=require(_0x1ed9('0x5'));var fs=require('fs');var path=require(_0x1ed9('0x6'));var rimraf=require(_0x1ed9('0x7'));var config=require(_0x1ed9('0x8'));var attributes=require('./sound.attributes');module['exports']=function(_0x38abc7,_0x49f761){return _0x38abc7[_0x1ed9('0x9')](_0x1ed9('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61a7=['../../config/logger','bluebird','request-promise','path','rimraf','define','Sound','tools_sounds','lodash','util'];(function(_0x4a4b45,_0x16bc77){var _0x3d9e27=function(_0x4ae4f8){while(--_0x4ae4f8){_0x4a4b45['push'](_0x4a4b45['shift']());}};_0x3d9e27(++_0x16bc77);}(_0x61a7,0x18e));var _0x761a=function(_0x178a24,_0x20896e){_0x178a24=_0x178a24-0x0;var _0xcaf377=_0x61a7[_0x178a24];return _0xcaf377;};'use strict';var _=require(_0x761a('0x0'));var util=require(_0x761a('0x1'));var logger=require(_0x761a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x761a('0x3'));var rp=require(_0x761a('0x4'));var fs=require('fs');var path=require(_0x761a('0x5'));var rimraf=require(_0x761a('0x6'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module['exports']=function(_0x24ccd7,_0x4eda27){return _0x24ccd7[_0x761a('0x7')](_0x761a('0x8'),attributes,{'tableName':_0x761a('0x9'),'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 6d14e01..b07f650 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 _0xd241=['request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','find','options','raw','where','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0xd241,0x145));var _0x1d24=function(_0x4ada1b,_0x197bc3){_0x4ada1b=_0x4ada1b-0x0;var _0x1ac88a=_0xd241[_0x4ada1b];return _0x1ac88a;};'use strict';var _=require(_0x1d24('0x0'));var util=require(_0x1d24('0x1'));var moment=require(_0x1d24('0x2'));var BPromise=require(_0x1d24('0x3'));var rs=require(_0x1d24('0x4'));var fs=require('fs');var Redis=require(_0x1d24('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d24('0x6'));var logger=require(_0x1d24('0x7'))(_0x1d24('0x8'));var config=require(_0x1d24('0x9'));var jayson=require(_0x1d24('0xa'));var client=jayson['client'][_0x1d24('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x152ec6,_0x5e7007,_0x4a99ec){return new BPromise(function(_0x55c276,_0x33dadd){return client[_0x1d24('0xc')](_0x152ec6,_0x4a99ec)[_0x1d24('0xd')](function(_0x15cc80){logger[_0x1d24('0xe')]('Sound,\x20%s,\x20%s',_0x5e7007,_0x1d24('0xf'));logger['debug'](_0x1d24('0x10'),_0x5e7007,_0x1d24('0xf'),JSON[_0x1d24('0x11')](_0x15cc80));if(_0x15cc80['error']){if(_0x15cc80[_0x1d24('0x12')][_0x1d24('0x13')]===0x1f4){logger[_0x1d24('0x12')](_0x1d24('0x14'),_0x5e7007,_0x15cc80[_0x1d24('0x12')]['message']);return _0x33dadd(_0x15cc80['error'][_0x1d24('0x15')]);}logger[_0x1d24('0x12')](_0x1d24('0x14'),_0x5e7007,_0x15cc80[_0x1d24('0x12')][_0x1d24('0x15')]);return _0x55c276(_0x15cc80[_0x1d24('0x12')][_0x1d24('0x15')]);}else{logger['info'](_0x1d24('0x14'),_0x5e7007,_0x1d24('0xf'));_0x55c276(_0x15cc80[_0x1d24('0x16')][_0x1d24('0x15')]);}})[_0x1d24('0x17')](function(_0x61bd56){logger['error'](_0x1d24('0x14'),_0x5e7007,_0x61bd56);_0x33dadd(_0x61bd56);});});}exports[_0x1d24('0x18')]=function(_0x2e37cc){var _0x1faee5=this;return new Promise(function(_0x1ff232,_0x5ba4eb){return db['Sound'][_0x1d24('0x19')]({'raw':_0x2e37cc[_0x1d24('0x1a')]?_0x2e37cc[_0x1d24('0x1a')][_0x1d24('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e37cc[_0x1d24('0x1a')]?_0x2e37cc[_0x1d24('0x1a')][_0x1d24('0x1c')]||null:null,'attributes':_0x2e37cc[_0x1d24('0x1a')]?_0x2e37cc['options'][_0x1d24('0x1d')]||null:null,'include':_0x2e37cc[_0x1d24('0x1a')]?_0x2e37cc[_0x1d24('0x1a')][_0x1d24('0x1e')]?_[_0x1d24('0x1f')](_0x2e37cc[_0x1d24('0x1a')]['include'],function(_0x371f2f){return{'model':db[_0x371f2f['model']],'as':_0x371f2f['as'],'attributes':_0x371f2f[_0x1d24('0x1d')],'include':_0x371f2f[_0x1d24('0x1e')]?_['map'](_0x371f2f[_0x1d24('0x1e')],function(_0x16a56b){return{'model':db[_0x16a56b[_0x1d24('0x20')]],'as':_0x16a56b['as'],'attributes':_0x16a56b[_0x1d24('0x1d')],'include':_0x16a56b[_0x1d24('0x1e')]?_['map'](_0x16a56b[_0x1d24('0x1e')],function(_0x315c0b){return{'model':db[_0x315c0b['model']],'as':_0x315c0b['as'],'attributes':_0x315c0b[_0x1d24('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1d24('0xd')](function(_0x17b1a5){logger[_0x1d24('0xe')](_0x1d24('0x18'),_0x2e37cc);logger[_0x1d24('0x21')](_0x1d24('0x18'),_0x2e37cc,JSON[_0x1d24('0x11')](_0x17b1a5));_0x1ff232(_0x17b1a5);})[_0x1d24('0x17')](function(_0x1cc1d4){logger[_0x1d24('0x12')](_0x1d24('0x18'),_0x1cc1d4[_0x1d24('0x15')],_0x2e37cc);_0x5ba4eb(_0x1faee5[_0x1d24('0x12')](0x1f4,_0x1cc1d4[_0x1d24('0x15')]));});});}; \ No newline at end of file +var _0x4e7b=['message','catch','ShowSound','Sound','find','options','raw','where','attributes','include','model','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error'];(function(_0x30c91d,_0xcebf26){var _0x1f1570=function(_0x34aaf2){while(--_0x34aaf2){_0x30c91d['push'](_0x30c91d['shift']());}};_0x1f1570(++_0xcebf26);}(_0x4e7b,0x138));var _0xb4e7=function(_0x47e7ff,_0xa49bf1){_0x47e7ff=_0x47e7ff-0x0;var _0x53e230=_0x4e7b[_0x47e7ff];return _0x53e230;};'use strict';var _=require(_0xb4e7('0x0'));var util=require(_0xb4e7('0x1'));var moment=require(_0xb4e7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4e7('0x3'));var db=require(_0xb4e7('0x4'))['db'];var utils=require(_0xb4e7('0x5'));var logger=require(_0xb4e7('0x6'))(_0xb4e7('0x7'));var config=require(_0xb4e7('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb4e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c0ff0,_0x4a498c,_0xf2e459){return new BPromise(function(_0x338639,_0x3d6ecf){return client[_0xb4e7('0xa')](_0x1c0ff0,_0xf2e459)[_0xb4e7('0xb')](function(_0x32b98c){logger[_0xb4e7('0xc')](_0xb4e7('0xd'),_0x4a498c,_0xb4e7('0xe'));logger[_0xb4e7('0xf')](_0xb4e7('0x10'),_0x4a498c,'request\x20sent',JSON['stringify'](_0x32b98c));if(_0x32b98c[_0xb4e7('0x11')]){if(_0x32b98c['error']['code']===0x1f4){logger[_0xb4e7('0x11')]('Sound,\x20%s,\x20%s',_0x4a498c,_0x32b98c['error'][_0xb4e7('0x12')]);return _0x3d6ecf(_0x32b98c[_0xb4e7('0x11')][_0xb4e7('0x12')]);}logger[_0xb4e7('0x11')](_0xb4e7('0xd'),_0x4a498c,_0x32b98c[_0xb4e7('0x11')][_0xb4e7('0x12')]);return _0x338639(_0x32b98c['error']['message']);}else{logger[_0xb4e7('0xc')]('Sound,\x20%s,\x20%s',_0x4a498c,'request\x20sent');_0x338639(_0x32b98c['result']['message']);}})[_0xb4e7('0x13')](function(_0x4eebd2){logger[_0xb4e7('0x11')](_0xb4e7('0xd'),_0x4a498c,_0x4eebd2);_0x3d6ecf(_0x4eebd2);});});}exports[_0xb4e7('0x14')]=function(_0x5b6061){var _0x4fc510=this;return new Promise(function(_0x22f459,_0x4276c6){return db[_0xb4e7('0x15')][_0xb4e7('0x16')]({'raw':_0x5b6061[_0xb4e7('0x17')]?_0x5b6061['options'][_0xb4e7('0x18')]===undefined?!![]:![]:!![],'where':_0x5b6061[_0xb4e7('0x17')]?_0x5b6061['options'][_0xb4e7('0x19')]||null:null,'attributes':_0x5b6061[_0xb4e7('0x17')]?_0x5b6061['options'][_0xb4e7('0x1a')]||null:null,'include':_0x5b6061[_0xb4e7('0x17')]?_0x5b6061['options'][_0xb4e7('0x1b')]?_['map'](_0x5b6061[_0xb4e7('0x17')][_0xb4e7('0x1b')],function(_0x4772f0){return{'model':db[_0x4772f0[_0xb4e7('0x1c')]],'as':_0x4772f0['as'],'attributes':_0x4772f0[_0xb4e7('0x1a')],'include':_0x4772f0['include']?_['map'](_0x4772f0[_0xb4e7('0x1b')],function(_0x5526b5){return{'model':db[_0x5526b5[_0xb4e7('0x1c')]],'as':_0x5526b5['as'],'attributes':_0x5526b5['attributes'],'include':_0x5526b5['include']?_['map'](_0x5526b5[_0xb4e7('0x1b')],function(_0x3edb19){return{'model':db[_0x3edb19[_0xb4e7('0x1c')]],'as':_0x3edb19['as'],'attributes':_0x3edb19[_0xb4e7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb4e7('0xb')](function(_0x3825d9){logger['info'](_0xb4e7('0x14'),_0x5b6061);logger['debug']('ShowSound',_0x5b6061,JSON[_0xb4e7('0x1d')](_0x3825d9));_0x22f459(_0x3825d9);})[_0xb4e7('0x13')](function(_0x12fa32){logger[_0xb4e7('0x11')](_0xb4e7('0x14'),_0x12fa32[_0xb4e7('0x12')],_0x5b6061);_0x4276c6(_0x4fc510['error'](0x1f4,_0x12fa32['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 261e7bf..793c911 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 _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x509367,_0x53a5f7){var _0x2eb5ce=function(_0x4b38a2){while(--_0x4b38a2){_0x509367['push'](_0x509367['shift']());}};_0x2eb5ce(++_0x53a5f7);}(_0x5eb8,0xb0));var _0x85eb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5eb8[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +var _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x4cf769,_0x4873c6){var _0x1375f0=function(_0x12b240){while(--_0x12b240){_0x4cf769['push'](_0x4cf769['shift']());}};_0x1375f0(++_0x4873c6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index d02297b..d7e507b 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 _0x38d7=['STRING','exports','TEXT','medium','out'];(function(_0x41604c,_0x3fb07c){var _0x1ea71a=function(_0x2c3ec2){while(--_0x2c3ec2){_0x41604c['push'](_0x41604c['shift']());}};_0x1ea71a(++_0x3fb07c);}(_0x38d7,0x150));var _0x738d=function(_0xadc7d9,_0x203608){_0xadc7d9=_0xadc7d9-0x0;var _0x915ca1=_0x38d7[_0xadc7d9];return _0x915ca1;};'use strict';var Sequelize=require('sequelize');module[_0x738d('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x738d('0x1')](_0x738d('0x2')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x738d('0x3')),'defaultValue':_0x738d('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0x738d('0x4')]},'providerResponse':{'type':Sequelize[_0x738d('0x1')]}}; \ No newline at end of file +var _0x5ce9=['out','sequelize','exports','STRING','TEXT','ENUM'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x5ce9,0xd3));var _0x95ce=function(_0xf5c2c4,_0x3b761d){_0xf5c2c4=_0xf5c2c4-0x0;var _0x390734=_0x5ce9[_0xf5c2c4];return _0x390734;};'use strict';var Sequelize=require(_0x95ce('0x0'));module[_0x95ce('0x1')]={'uniqueid':{'type':Sequelize[_0x95ce('0x2')]},'body':{'type':Sequelize[_0x95ce('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x95ce('0x4')]('in','out'),'defaultValue':_0x95ce('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x95ce('0x2')]},'providerResponse':{'type':Sequelize[_0x95ce('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 7b94038..cef8c66 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 _0x759e=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','then','stack','name','send','map','SquareMessage','rawAttributes','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','include','findAll','rows','catch','show','params','length','find','create','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel'];(function(_0x22cb10,_0x20db4f){var _0x38a6f8=function(_0xdb4b16){while(--_0xdb4b16){_0x22cb10['push'](_0x22cb10['shift']());}};_0x38a6f8(++_0x20db4f);}(_0x759e,0xd1));var _0xe759=function(_0x13db1a,_0x3b1c3e){_0x13db1a=_0x13db1a-0x0;var _0x469713=_0x759e[_0x13db1a];return _0x469713;};'use strict';var emlformat=require(_0xe759('0x0'));var rimraf=require(_0xe759('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe759('0x2'));var rp=require(_0xe759('0x3'));var moment=require(_0xe759('0x4'));var BPromise=require(_0xe759('0x5'));var Mustache=require(_0xe759('0x6'));var util=require(_0xe759('0x7'));var path=require(_0xe759('0x8'));var sox=require(_0xe759('0x9'));var csv=require(_0xe759('0xa'));var ejs=require(_0xe759('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe759('0xc'));var crypto=require(_0xe759('0xd'));var jsforce=require(_0xe759('0xe'));var deskjs=require(_0xe759('0xf'));var toCsv=require(_0xe759('0xa'));var querystring=require(_0xe759('0x10'));var Papa=require(_0xe759('0x11'));var Redis=require(_0xe759('0x12'));var authService=require(_0xe759('0x13'));var qs=require(_0xe759('0x14'));var as=require(_0xe759('0x15'));var hardwareService=require(_0xe759('0x16'));var logger=require(_0xe759('0x17'))(_0xe759('0x18'));var utils=require(_0xe759('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xe759('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17adf8,_0x6f096f){_0x6f096f=_0x6f096f||0xcc;return function(_0x563673){if(_0x563673){return _0x17adf8[_0xe759('0x1b')](_0x6f096f);}return _0x17adf8['status'](_0x6f096f)[_0xe759('0x1c')]();};}function respondWithResult(_0xf5887b,_0x479fad){_0x479fad=_0x479fad||0xc8;return function(_0x11b640){if(_0x11b640){return _0xf5887b[_0xe759('0x1d')](_0x479fad)['json'](_0x11b640);}};}function respondWithFilteredResult(_0x3ecdbe,_0x43fa09){return function(_0x5b036d){if(_0x5b036d){var _0x48fb22=typeof _0x43fa09['offset']==='undefined'&&typeof _0x43fa09['limit']===_0xe759('0x1e');var _0x5adb49=_0x5b036d[_0xe759('0x1f')];var _0x2f8b68=_0x48fb22?0x0:_0x43fa09[_0xe759('0x20')];var _0x1ce097=_0x48fb22?_0x5b036d[_0xe759('0x1f')]:_0x43fa09[_0xe759('0x20')]+_0x43fa09[_0xe759('0x21')];var _0x202f62;if(_0x1ce097>=_0x5adb49){_0x1ce097=_0x5adb49;_0x202f62=0xc8;}else{_0x202f62=0xce;}_0x3ecdbe[_0xe759('0x1d')](_0x202f62);return _0x3ecdbe[_0xe759('0x22')](_0xe759('0x23'),_0x2f8b68+'-'+_0x1ce097+'/'+_0x5adb49)[_0xe759('0x24')](_0x5b036d);}return null;};}function patchUpdates(_0xe58c6e){return function(_0x463cd5){try{jsonpatch[_0xe759('0x25')](_0x463cd5,_0xe58c6e,!![]);}catch(_0x53dfcf){return BPromise[_0xe759('0x26')](_0x53dfcf);}return _0x463cd5[_0xe759('0x27')]();};}function saveUpdates(_0x796d3c,_0x20c52a){return function(_0x11a5cb){if(_0x11a5cb){return _0x11a5cb['update'](_0x796d3c)[_0xe759('0x28')](function(_0x3a4b81){return _0x3a4b81;});}return null;};}function removeEntity(_0x4b8af7,_0x53f5dc){return function(_0x3c5074){if(_0x3c5074){return _0x3c5074['destroy']()['then'](function(){_0x4b8af7[_0xe759('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c6c84,_0x1a4b7c){return function(_0x268550){if(!_0x268550){_0x1c6c84['sendStatus'](0x194);}return _0x268550;};}function handleError(_0x5bcdb9,_0x3ec99c){_0x3ec99c=_0x3ec99c||0x1f4;return function(_0xc5b3b9){logger['error'](_0xc5b3b9[_0xe759('0x29')]);if(_0xc5b3b9[_0xe759('0x2a')]){delete _0xc5b3b9[_0xe759('0x2a')];}_0x5bcdb9['status'](_0x3ec99c)[_0xe759('0x2b')](_0xc5b3b9);};}exports['index']=function(_0x1949a6,_0x23f110){var _0x5cd4c3={},_0xbd41bf={},_0x1a2e7f={'count':0x0,'rows':[]};var _0xf31338=_[_0xe759('0x2c')](db[_0xe759('0x2d')][_0xe759('0x2e')],function(_0x4943ff){return{'name':_0x4943ff['fieldName'],'type':_0x4943ff['type'][_0xe759('0x2f')]};});_0xbd41bf['model']=_[_0xe759('0x2c')](_0xf31338,_0xe759('0x2a'));_0xbd41bf['query']=_[_0xe759('0x30')](_0x1949a6[_0xe759('0x31')]);_0xbd41bf[_0xe759('0x32')]=_[_0xe759('0x33')](_0xbd41bf[_0xe759('0x34')],_0xbd41bf[_0xe759('0x31')]);_0x5cd4c3[_0xe759('0x35')]=_['intersection'](_0xbd41bf[_0xe759('0x34')],qs['fields'](_0x1949a6[_0xe759('0x31')][_0xe759('0x36')]));_0x5cd4c3[_0xe759('0x35')]=_0x5cd4c3['attributes']['length']?_0x5cd4c3['attributes']:_0xbd41bf['model'];if(!_0x1949a6[_0xe759('0x31')][_0xe759('0x37')](_0xe759('0x38'))){_0x5cd4c3[_0xe759('0x21')]=qs['limit'](_0x1949a6['query'][_0xe759('0x21')]);_0x5cd4c3['offset']=qs[_0xe759('0x20')](_0x1949a6['query']['offset']);}_0x5cd4c3[_0xe759('0x39')]=qs[_0xe759('0x3a')](_0x1949a6['query'][_0xe759('0x3a')]);_0x5cd4c3['where']=qs[_0xe759('0x32')](_[_0xe759('0x3b')](_0x1949a6[_0xe759('0x31')],_0xbd41bf[_0xe759('0x32')]),_0xf31338);if(_0x1949a6['query']['filter']){_0x5cd4c3[_0xe759('0x3c')]=_['merge'](_0x5cd4c3[_0xe759('0x3c')],{'$or':_[_0xe759('0x2c')](_0xf31338,function(_0x333e29){if(_0x333e29['type']!=='VIRTUAL'){var _0x3ed7a9={};_0x3ed7a9[_0x333e29[_0xe759('0x2a')]]={'$like':'%'+_0x1949a6[_0xe759('0x31')]['filter']+'%'};return _0x3ed7a9;}})});}_0x5cd4c3=_[_0xe759('0x3d')]({},_0x5cd4c3,_0x1949a6[_0xe759('0x3e')]);var _0xa2edb5={'where':_0x5cd4c3[_0xe759('0x3c')]};return db[_0xe759('0x2d')]['count'](_0xa2edb5)[_0xe759('0x28')](function(_0x52e155){_0x1a2e7f[_0xe759('0x1f')]=_0x52e155;if(_0x1949a6[_0xe759('0x31')]['includeAll']){_0x5cd4c3[_0xe759('0x3f')]=[{'all':!![]}];}return db['SquareMessage'][_0xe759('0x40')](_0x5cd4c3);})[_0xe759('0x28')](function(_0x5b74be){_0x1a2e7f[_0xe759('0x41')]=_0x5b74be;return _0x1a2e7f;})[_0xe759('0x28')](respondWithFilteredResult(_0x23f110,_0x5cd4c3))[_0xe759('0x42')](handleError(_0x23f110,null));};exports[_0xe759('0x43')]=function(_0x38101d,_0x27fb7e){var _0x53b026={'raw':!![],'where':{'id':_0x38101d[_0xe759('0x44')]['id']}},_0x4d460b={};_0x4d460b[_0xe759('0x34')]=_[_0xe759('0x30')](db['SquareMessage'][_0xe759('0x2e')]);_0x4d460b[_0xe759('0x31')]=_[_0xe759('0x30')](_0x38101d['query']);_0x4d460b['filters']=_[_0xe759('0x33')](_0x4d460b[_0xe759('0x34')],_0x4d460b[_0xe759('0x31')]);_0x53b026[_0xe759('0x35')]=_['intersection'](_0x4d460b[_0xe759('0x34')],qs[_0xe759('0x36')](_0x38101d[_0xe759('0x31')]['fields']));_0x53b026[_0xe759('0x35')]=_0x53b026[_0xe759('0x35')][_0xe759('0x45')]?_0x53b026[_0xe759('0x35')]:_0x4d460b['model'];if(_0x38101d['query']['includeAll']){_0x53b026[_0xe759('0x3f')]=[{'all':!![]}];}_0x53b026=_[_0xe759('0x3d')]({},_0x53b026,_0x38101d['options']);return db[_0xe759('0x2d')][_0xe759('0x46')](_0x53b026)[_0xe759('0x28')](handleEntityNotFound(_0x27fb7e,null))[_0xe759('0x28')](respondWithResult(_0x27fb7e,null))[_0xe759('0x42')](handleError(_0x27fb7e,null));};exports[_0xe759('0x47')]=function(_0x2e1a6a,_0x557b08){return db[_0xe759('0x2d')][_0xe759('0x47')](_0x2e1a6a['body'],{})[_0xe759('0x28')](respondWithResult(_0x557b08,0xc9))[_0xe759('0x42')](handleError(_0x557b08,null));};exports[_0xe759('0x48')]=function(_0x25923f,_0x7bcb2b){if(_0x25923f['body']['id']){delete _0x25923f[_0xe759('0x49')]['id'];}return db[_0xe759('0x2d')][_0xe759('0x46')]({'where':{'id':_0x25923f['params']['id']}})[_0xe759('0x28')](handleEntityNotFound(_0x7bcb2b,null))[_0xe759('0x28')](saveUpdates(_0x25923f[_0xe759('0x49')],null))[_0xe759('0x28')](respondWithResult(_0x7bcb2b,null))[_0xe759('0x42')](handleError(_0x7bcb2b,null));};exports['destroy']=function(_0xc8309f,_0x19c465){return db['SquareMessage'][_0xe759('0x46')]({'where':{'id':_0xc8309f['params']['id']}})[_0xe759('0x28')](handleEntityNotFound(_0x19c465,null))[_0xe759('0x28')](removeEntity(_0x19c465,null))['catch'](handleError(_0x19c465,null));}; \ No newline at end of file +var _0x4e6e=['destroy','status','error','name','send','map','SquareMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x106307,_0x22a5e1){var _0x15c8c4=function(_0x3b93f8){while(--_0x3b93f8){_0x106307['push'](_0x106307['shift']());}};_0x15c8c4(++_0x22a5e1);}(_0x4e6e,0x70));var _0xe4e6=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x4e6e[_0x4a3898];return _0x25ceb0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4e6('0x0'));var zipdir=require(_0xe4e6('0x1'));var jsonpatch=require(_0xe4e6('0x2'));var rp=require(_0xe4e6('0x3'));var moment=require(_0xe4e6('0x4'));var BPromise=require(_0xe4e6('0x5'));var Mustache=require(_0xe4e6('0x6'));var util=require(_0xe4e6('0x7'));var path=require(_0xe4e6('0x8'));var sox=require(_0xe4e6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4e6('0xa'));var _=require(_0xe4e6('0xb'));var squel=require(_0xe4e6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe4e6('0xd'));var querystring=require(_0xe4e6('0xe'));var Papa=require(_0xe4e6('0xf'));var Redis=require(_0xe4e6('0x10'));var authService=require(_0xe4e6('0x11'));var qs=require(_0xe4e6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4e6('0x13'));var logger=require(_0xe4e6('0x14'))(_0xe4e6('0x15'));var utils=require(_0xe4e6('0x16'));var config=require(_0xe4e6('0x17'));var licenseUtil=require(_0xe4e6('0x18'));var db=require(_0xe4e6('0x19'))['db'];function respondWithStatusCode(_0x5b9467,_0x48fe8f){_0x48fe8f=_0x48fe8f||0xcc;return function(_0x53c7f9){if(_0x53c7f9){return _0x5b9467[_0xe4e6('0x1a')](_0x48fe8f);}return _0x5b9467['status'](_0x48fe8f)[_0xe4e6('0x1b')]();};}function respondWithResult(_0x2fc417,_0x1d99d5){_0x1d99d5=_0x1d99d5||0xc8;return function(_0xf37c72){if(_0xf37c72){return _0x2fc417['status'](_0x1d99d5)[_0xe4e6('0x1c')](_0xf37c72);}};}function respondWithFilteredResult(_0x3638fd,_0x3b15bb){return function(_0x1bb913){if(_0x1bb913){var _0x4ccb93=typeof _0x3b15bb[_0xe4e6('0x1d')]===_0xe4e6('0x1e')&&typeof _0x3b15bb[_0xe4e6('0x1f')]===_0xe4e6('0x1e');var _0x3d58dd=_0x1bb913[_0xe4e6('0x20')];var _0x263ba4=_0x4ccb93?0x0:_0x3b15bb[_0xe4e6('0x1d')];var _0x462403=_0x4ccb93?_0x1bb913['count']:_0x3b15bb[_0xe4e6('0x1d')]+_0x3b15bb[_0xe4e6('0x1f')];var _0x213701;if(_0x462403>=_0x3d58dd){_0x462403=_0x3d58dd;_0x213701=0xc8;}else{_0x213701=0xce;}_0x3638fd['status'](_0x213701);return _0x3638fd[_0xe4e6('0x21')](_0xe4e6('0x22'),_0x263ba4+'-'+_0x462403+'/'+_0x3d58dd)[_0xe4e6('0x1c')](_0x1bb913);}return null;};}function patchUpdates(_0x45e849){return function(_0x4bb01c){try{jsonpatch[_0xe4e6('0x23')](_0x4bb01c,_0x45e849,!![]);}catch(_0x268fd8){return BPromise[_0xe4e6('0x24')](_0x268fd8);}return _0x4bb01c[_0xe4e6('0x25')]();};}function saveUpdates(_0x2256bf,_0x49856e){return function(_0x330dd2){if(_0x330dd2){return _0x330dd2[_0xe4e6('0x26')](_0x2256bf)[_0xe4e6('0x27')](function(_0x2cd18a){return _0x2cd18a;});}return null;};}function removeEntity(_0xc9287b,_0x67d5fc){return function(_0x976ef6){if(_0x976ef6){return _0x976ef6[_0xe4e6('0x28')]()['then'](function(){_0xc9287b[_0xe4e6('0x29')](0xcc)[_0xe4e6('0x1b')]();});}};}function handleEntityNotFound(_0x2c39dd,_0x2cfcb7){return function(_0x530425){if(!_0x530425){_0x2c39dd[_0xe4e6('0x1a')](0x194);}return _0x530425;};}function handleError(_0x18b5f5,_0x5717cb){_0x5717cb=_0x5717cb||0x1f4;return function(_0x495ae9){logger[_0xe4e6('0x2a')](_0x495ae9['stack']);if(_0x495ae9[_0xe4e6('0x2b')]){delete _0x495ae9[_0xe4e6('0x2b')];}_0x18b5f5[_0xe4e6('0x29')](_0x5717cb)[_0xe4e6('0x2c')](_0x495ae9);};}exports['index']=function(_0xee4683,_0x489919){var _0x4065e9={},_0x13281f={},_0x1caa13={'count':0x0,'rows':[]};var _0x4254b7=_[_0xe4e6('0x2d')](db[_0xe4e6('0x2e')][_0xe4e6('0x2f')],function(_0x2e536a){return{'name':_0x2e536a[_0xe4e6('0x30')],'type':_0x2e536a['type'][_0xe4e6('0x31')]};});_0x13281f[_0xe4e6('0x32')]=_[_0xe4e6('0x2d')](_0x4254b7,_0xe4e6('0x2b'));_0x13281f[_0xe4e6('0x33')]=_[_0xe4e6('0x34')](_0xee4683[_0xe4e6('0x33')]);_0x13281f[_0xe4e6('0x35')]=_[_0xe4e6('0x36')](_0x13281f[_0xe4e6('0x32')],_0x13281f[_0xe4e6('0x33')]);_0x4065e9[_0xe4e6('0x37')]=_[_0xe4e6('0x36')](_0x13281f['model'],qs[_0xe4e6('0x38')](_0xee4683['query'][_0xe4e6('0x38')]));_0x4065e9['attributes']=_0x4065e9[_0xe4e6('0x37')][_0xe4e6('0x39')]?_0x4065e9['attributes']:_0x13281f['model'];if(!_0xee4683[_0xe4e6('0x33')][_0xe4e6('0x3a')](_0xe4e6('0x3b'))){_0x4065e9[_0xe4e6('0x1f')]=qs[_0xe4e6('0x1f')](_0xee4683[_0xe4e6('0x33')]['limit']);_0x4065e9[_0xe4e6('0x1d')]=qs[_0xe4e6('0x1d')](_0xee4683[_0xe4e6('0x33')][_0xe4e6('0x1d')]);}_0x4065e9[_0xe4e6('0x3c')]=qs['sort'](_0xee4683[_0xe4e6('0x33')][_0xe4e6('0x3d')]);_0x4065e9['where']=qs[_0xe4e6('0x35')](_['pick'](_0xee4683['query'],_0x13281f[_0xe4e6('0x35')]),_0x4254b7);if(_0xee4683[_0xe4e6('0x33')][_0xe4e6('0x3e')]){_0x4065e9['where']=_['merge'](_0x4065e9[_0xe4e6('0x3f')],{'$or':_[_0xe4e6('0x2d')](_0x4254b7,function(_0x164742){if(_0x164742[_0xe4e6('0x40')]!==_0xe4e6('0x41')){var _0xd01efa={};_0xd01efa[_0x164742[_0xe4e6('0x2b')]]={'$like':'%'+_0xee4683[_0xe4e6('0x33')][_0xe4e6('0x3e')]+'%'};return _0xd01efa;}})});}_0x4065e9=_['merge']({},_0x4065e9,_0xee4683[_0xe4e6('0x42')]);var _0x3768c2={'where':_0x4065e9[_0xe4e6('0x3f')]};return db['SquareMessage']['count'](_0x3768c2)['then'](function(_0x23a167){_0x1caa13['count']=_0x23a167;if(_0xee4683[_0xe4e6('0x33')][_0xe4e6('0x43')]){_0x4065e9[_0xe4e6('0x44')]=[{'all':!![]}];}return db[_0xe4e6('0x2e')][_0xe4e6('0x45')](_0x4065e9);})['then'](function(_0x3026c0){_0x1caa13[_0xe4e6('0x46')]=_0x3026c0;return _0x1caa13;})[_0xe4e6('0x27')](respondWithFilteredResult(_0x489919,_0x4065e9))[_0xe4e6('0x47')](handleError(_0x489919,null));};exports['show']=function(_0x3d7b0d,_0x4e6263){var _0xb58a1d={'raw':!![],'where':{'id':_0x3d7b0d['params']['id']}},_0x472569={};_0x472569[_0xe4e6('0x32')]=_['keys'](db['SquareMessage']['rawAttributes']);_0x472569[_0xe4e6('0x33')]=_['keys'](_0x3d7b0d[_0xe4e6('0x33')]);_0x472569['filters']=_[_0xe4e6('0x36')](_0x472569[_0xe4e6('0x32')],_0x472569[_0xe4e6('0x33')]);_0xb58a1d[_0xe4e6('0x37')]=_[_0xe4e6('0x36')](_0x472569[_0xe4e6('0x32')],qs[_0xe4e6('0x38')](_0x3d7b0d[_0xe4e6('0x33')]['fields']));_0xb58a1d[_0xe4e6('0x37')]=_0xb58a1d[_0xe4e6('0x37')][_0xe4e6('0x39')]?_0xb58a1d['attributes']:_0x472569[_0xe4e6('0x32')];if(_0x3d7b0d['query'][_0xe4e6('0x43')]){_0xb58a1d[_0xe4e6('0x44')]=[{'all':!![]}];}_0xb58a1d=_['merge']({},_0xb58a1d,_0x3d7b0d[_0xe4e6('0x42')]);return db[_0xe4e6('0x2e')]['find'](_0xb58a1d)[_0xe4e6('0x27')](handleEntityNotFound(_0x4e6263,null))[_0xe4e6('0x27')](respondWithResult(_0x4e6263,null))[_0xe4e6('0x47')](handleError(_0x4e6263,null));};exports['create']=function(_0x5c763e,_0x265d8b){return db[_0xe4e6('0x2e')][_0xe4e6('0x48')](_0x5c763e['body'],{})['then'](respondWithResult(_0x265d8b,0xc9))[_0xe4e6('0x47')](handleError(_0x265d8b,null));};exports['update']=function(_0x423cb0,_0x58889a){if(_0x423cb0[_0xe4e6('0x49')]['id']){delete _0x423cb0[_0xe4e6('0x49')]['id'];}return db[_0xe4e6('0x2e')][_0xe4e6('0x4a')]({'where':{'id':_0x423cb0['params']['id']}})['then'](handleEntityNotFound(_0x58889a,null))[_0xe4e6('0x27')](saveUpdates(_0x423cb0[_0xe4e6('0x49')],null))['then'](respondWithResult(_0x58889a,null))[_0xe4e6('0x47')](handleError(_0x58889a,null));};exports[_0xe4e6('0x28')]=function(_0x2e9bdd,_0x165f68){return db[_0xe4e6('0x2e')][_0xe4e6('0x4a')]({'where':{'id':_0x2e9bdd[_0xe4e6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x165f68,null))['then'](removeEntity(_0x165f68,null))[_0xe4e6('0x47')](handleError(_0x165f68,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 87bb01a..a50c531 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 _0x9e23=['SquareMessage','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareMessage.attributes','define'];(function(_0x579bc0,_0x34c0cc){var _0x379218=function(_0x1afd20){while(--_0x1afd20){_0x579bc0['push'](_0x579bc0['shift']());}};_0x379218(++_0x34c0cc);}(_0x9e23,0x10f));var _0x39e2=function(_0x44a353,_0x3b5ca8){_0x44a353=_0x44a353-0x0;var _0x38f4ac=_0x9e23[_0x44a353];return _0x38f4ac;};'use strict';var _=require('lodash');var util=require(_0x39e2('0x0'));var logger=require('../../config/logger')(_0x39e2('0x1'));var moment=require(_0x39e2('0x2'));var BPromise=require(_0x39e2('0x3'));var rp=require(_0x39e2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39e2('0x5'));var config=require(_0x39e2('0x6'));var attributes=require(_0x39e2('0x7'));module['exports']=function(_0x11bcb3,_0x1ffafc){return _0x11bcb3[_0x39e2('0x8')](_0x39e2('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03b3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','square_messages','lodash','../../config/logger','api'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x03b3,0x1b9));var _0x303b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03b3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x303b('0x0'));var util=require('util');var logger=require(_0x303b('0x1'))(_0x303b('0x2'));var moment=require(_0x303b('0x3'));var BPromise=require(_0x303b('0x4'));var rp=require(_0x303b('0x5'));var fs=require('fs');var path=require(_0x303b('0x6'));var rimraf=require(_0x303b('0x7'));var config=require(_0x303b('0x8'));var attributes=require('./squareMessage.attributes');module[_0x303b('0x9')]=function(_0x34e2e1,_0x45f103){return _0x34e2e1[_0x303b('0xa')]('SquareMessage',attributes,{'tableName':_0x303b('0xb'),'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 2cd2d01..7fef76c 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 _0x0fa3=['message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x0fa3,0x182));var _0x30fa=function(_0x421d1f,_0x103891){_0x421d1f=_0x421d1f-0x0;var _0x4228bf=_0x0fa3[_0x421d1f];return _0x4228bf;};'use strict';var _=require(_0x30fa('0x0'));var util=require('util');var moment=require(_0x30fa('0x1'));var BPromise=require(_0x30fa('0x2'));var rs=require(_0x30fa('0x3'));var fs=require('fs');var Redis=require(_0x30fa('0x4'));var db=require(_0x30fa('0x5'))['db'];var utils=require(_0x30fa('0x6'));var logger=require(_0x30fa('0x7'))(_0x30fa('0x8'));var config=require('../../config/environment');var jayson=require(_0x30fa('0x9'));var client=jayson['client'][_0x30fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x521124,_0x167dae,_0x249ccb){return new BPromise(function(_0x198312,_0x17252d){return client['request'](_0x521124,_0x249ccb)[_0x30fa('0xb')](function(_0x25db90){logger[_0x30fa('0xc')]('SquareMessage,\x20%s,\x20%s',_0x167dae,_0x30fa('0xd'));logger[_0x30fa('0xe')](_0x30fa('0xf'),_0x167dae,_0x30fa('0xd'),JSON[_0x30fa('0x10')](_0x25db90));if(_0x25db90['error']){if(_0x25db90[_0x30fa('0x11')][_0x30fa('0x12')]===0x1f4){logger['error'](_0x30fa('0x13'),_0x167dae,_0x25db90[_0x30fa('0x11')][_0x30fa('0x14')]);return _0x17252d(_0x25db90['error'][_0x30fa('0x14')]);}logger[_0x30fa('0x11')](_0x30fa('0x13'),_0x167dae,_0x25db90[_0x30fa('0x11')][_0x30fa('0x14')]);return _0x198312(_0x25db90[_0x30fa('0x11')][_0x30fa('0x14')]);}else{logger[_0x30fa('0xc')](_0x30fa('0x13'),_0x167dae,_0x30fa('0xd'));_0x198312(_0x25db90[_0x30fa('0x15')]['message']);}})[_0x30fa('0x16')](function(_0x374878){logger[_0x30fa('0x11')](_0x30fa('0x13'),_0x167dae,_0x374878);_0x17252d(_0x374878);});});}exports[_0x30fa('0x17')]=function(_0x3add27){var _0x53f558=this;return new Promise(function(_0x1ef44c,_0x4129ce){return db[_0x30fa('0x18')][_0x30fa('0x19')](_0x3add27[_0x30fa('0x1a')],{'raw':_0x3add27[_0x30fa('0x1b')]?_0x3add27[_0x30fa('0x1b')][_0x30fa('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x26257d){logger['info'](_0x30fa('0x17'),_0x3add27);logger['debug'](_0x30fa('0x17'),_0x3add27,JSON[_0x30fa('0x10')](_0x26257d));_0x1ef44c(_0x26257d);})['catch'](function(_0x2ac69d){logger[_0x30fa('0x11')](_0x30fa('0x17'),_0x2ac69d['message'],_0x3add27);_0x4129ce(_0x53f558[_0x30fa('0x11')](0x1f4,_0x2ac69d[_0x30fa('0x14')]));});});}; \ No newline at end of file +var _0x3b95=['stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateSquareMessage','body','options','raw'];(function(_0x557a0e,_0x62ab98){var _0x340cbf=function(_0x28db0c){while(--_0x28db0c){_0x557a0e['push'](_0x557a0e['shift']());}};_0x340cbf(++_0x62ab98);}(_0x3b95,0x1b4));var _0x53b9=function(_0x490a0b,_0x25538a){_0x490a0b=_0x490a0b-0x0;var _0xb2674e=_0x3b95[_0x490a0b];return _0xb2674e;};'use strict';var _=require(_0x53b9('0x0'));var util=require(_0x53b9('0x1'));var moment=require(_0x53b9('0x2'));var BPromise=require(_0x53b9('0x3'));var rs=require(_0x53b9('0x4'));var fs=require('fs');var Redis=require(_0x53b9('0x5'));var db=require(_0x53b9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x53b9('0x7'))(_0x53b9('0x8'));var config=require(_0x53b9('0x9'));var jayson=require(_0x53b9('0xa'));var client=jayson[_0x53b9('0xb')][_0x53b9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39c544,_0x4430e,_0x2a599f){return new BPromise(function(_0x2a4b08,_0x3952cb){return client['request'](_0x39c544,_0x2a599f)[_0x53b9('0xd')](function(_0x27920c){logger['info'](_0x53b9('0xe'),_0x4430e,'request\x20sent');logger[_0x53b9('0xf')](_0x53b9('0x10'),_0x4430e,_0x53b9('0x11'),JSON['stringify'](_0x27920c));if(_0x27920c[_0x53b9('0x12')]){if(_0x27920c[_0x53b9('0x12')][_0x53b9('0x13')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x4430e,_0x27920c[_0x53b9('0x12')][_0x53b9('0x14')]);return _0x3952cb(_0x27920c['error'][_0x53b9('0x14')]);}logger[_0x53b9('0x12')](_0x53b9('0xe'),_0x4430e,_0x27920c[_0x53b9('0x12')][_0x53b9('0x14')]);return _0x2a4b08(_0x27920c[_0x53b9('0x12')]['message']);}else{logger[_0x53b9('0x15')](_0x53b9('0xe'),_0x4430e,_0x53b9('0x11'));_0x2a4b08(_0x27920c[_0x53b9('0x16')]['message']);}})[_0x53b9('0x17')](function(_0x28af2a){logger[_0x53b9('0x12')]('SquareMessage,\x20%s,\x20%s',_0x4430e,_0x28af2a);_0x3952cb(_0x28af2a);});});}exports[_0x53b9('0x18')]=function(_0x126471){var _0x2fc243=this;return new Promise(function(_0x51ddcf,_0x3128f4){return db['SquareMessage']['create'](_0x126471[_0x53b9('0x19')],{'raw':_0x126471[_0x53b9('0x1a')]?_0x126471[_0x53b9('0x1a')][_0x53b9('0x1b')]===undefined?!![]:![]:!![]})[_0x53b9('0xd')](function(_0x2e6be7){logger[_0x53b9('0x15')](_0x53b9('0x18'),_0x126471);logger[_0x53b9('0xf')](_0x53b9('0x18'),_0x126471,JSON[_0x53b9('0x1c')](_0x2e6be7));_0x51ddcf(_0x2e6be7);})[_0x53b9('0x17')](function(_0x1bf632){logger[_0x53b9('0x12')](_0x53b9('0x18'),_0x1bf632[_0x53b9('0x14')],_0x126471);_0x3128f4(_0x2fc243[_0x53b9('0x12')](0x1f4,_0x1bf632[_0x53b9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 0177b94..596a736 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 _0xbf0a=['destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','test','post','create','put','update','delete'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0xbf0a,0xbf));var _0xabf0=function(_0x20fb6e,_0x22f88d){_0x20fb6e=_0x20fb6e-0x0;var _0x1eb996=_0xbf0a[_0x20fb6e];return _0x1eb996;};'use strict';var multer=require(_0xabf0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xabf0('0x1'));var express=require(_0xabf0('0x2'));var router=express[_0xabf0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xabf0('0x4'));var interaction=require(_0xabf0('0x5'));var config=require('../../config/environment');var controller=require(_0xabf0('0x6'));router[_0xabf0('0x7')]('/',auth[_0xabf0('0x8')](),controller[_0xabf0('0x9')]);router[_0xabf0('0x7')](_0xabf0('0xa'),auth[_0xabf0('0x8')](),controller[_0xabf0('0xb')]);router[_0xabf0('0x7')]('/:id/test',auth[_0xabf0('0x8')](),timeout('15s'),controller[_0xabf0('0xc')]);router[_0xabf0('0xd')]('/',auth[_0xabf0('0x8')](),controller[_0xabf0('0xe')]);router[_0xabf0('0xf')](_0xabf0('0xa'),auth['isAuthenticated'](),controller[_0xabf0('0x10')]);router[_0xabf0('0x11')]('/:id',auth[_0xabf0('0x8')](),controller[_0xabf0('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe670=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','test','post','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x528454,_0x123f7a){var _0x4cafe0=function(_0x2b8f74){while(--_0x2b8f74){_0x528454['push'](_0x528454['shift']());}};_0x4cafe0(++_0x123f7a);}(_0xe670,0x1c6));var _0x0e67=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xe670[_0x1b5aea];return _0x15cfc6;};'use strict';var multer=require(_0x0e67('0x0'));var util=require('util');var path=require(_0x0e67('0x1'));var timeout=require('connect-timeout');var express=require(_0x0e67('0x2'));var router=express['Router']();var fs_extra=require(_0x0e67('0x3'));var auth=require(_0x0e67('0x4'));var interaction=require(_0x0e67('0x5'));var config=require(_0x0e67('0x6'));var controller=require(_0x0e67('0x7'));router['get']('/',auth[_0x0e67('0x8')](),controller[_0x0e67('0x9')]);router[_0x0e67('0xa')]('/:id',auth[_0x0e67('0x8')](),controller['show']);router['get']('/:id/test',auth[_0x0e67('0x8')](),timeout('15s'),controller[_0x0e67('0xb')]);router[_0x0e67('0xc')]('/',auth[_0x0e67('0x8')](),controller['create']);router[_0x0e67('0xd')](_0x0e67('0xe'),auth[_0x0e67('0x8')](),controller[_0x0e67('0xf')]);router[_0x0e67('0x10')](_0x0e67('0xe'),auth[_0x0e67('0x8')](),controller[_0x0e67('0x11')]);module[_0x0e67('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 0004c73..69ee2fb 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 _0x072c=['name','STRING','sequelize','exports'];(function(_0x16295b,_0x86ef79){var _0x287175=function(_0x5ee76b){while(--_0x5ee76b){_0x16295b['push'](_0x16295b['shift']());}};_0x287175(++_0x86ef79);}(_0x072c,0x1e2));var _0xc072=function(_0x4957db,_0x23e5ad){_0x4957db=_0x4957db-0x0;var _0x42ea0d=_0x072c[_0x4957db];return _0x42ea0d;};'use strict';var Sequelize=require(_0xc072('0x0'));module[_0xc072('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc072('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc072('0x3')]}}; \ No newline at end of file +var _0x299a=['exports','STRING','sequelize'];(function(_0x746596,_0x45026b){var _0x5f4d1a=function(_0x5f7ce7){while(--_0x5f7ce7){_0x746596['push'](_0x746596['shift']());}};_0x5f4d1a(++_0x45026b);}(_0x299a,0x12b));var _0xa299=function(_0x428f32,_0xba79ad){_0x428f32=_0x428f32-0x0;var _0x9e6f89=_0x299a[_0x428f32];return _0x9e6f89;};'use strict';var Sequelize=require(_0xa299('0x0'));module[_0xa299('0x1')]={'name':{'type':Sequelize[_0xa299('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xa299('0x2')]},'description':{'type':Sequelize[_0xa299('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 1727981..a6d8d40 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 _0x8b77=['catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','request-promise','moment','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareOdbc','includeAll','include','findAll'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8b77,0xb8));var _0x78b7=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8b77[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x78b7('0x0'));var rimraf=require(_0x78b7('0x1'));var zipdir=require(_0x78b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x78b7('0x3'));var moment=require(_0x78b7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x78b7('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x78b7('0x6'));var fs=require('fs');var fs_extra=require(_0x78b7('0x7'));var _=require(_0x78b7('0x8'));var squel=require('squel');var crypto=require(_0x78b7('0x9'));var jsforce=require(_0x78b7('0xa'));var deskjs=require(_0x78b7('0xb'));var toCsv=require('to-csv');var querystring=require(_0x78b7('0xc'));var Papa=require('papaparse');var Redis=require(_0x78b7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x78b7('0xe'));var as=require(_0x78b7('0xf'));var hardwareService=require(_0x78b7('0x10'));var logger=require(_0x78b7('0x11'))('api');var utils=require(_0x78b7('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x78b7('0x13'))['db'];function respondWithStatusCode(_0x5f732b,_0x31bb0e){_0x31bb0e=_0x31bb0e||0xcc;return function(_0xe9f9e9){if(_0xe9f9e9){return _0x5f732b['sendStatus'](_0x31bb0e);}return _0x5f732b[_0x78b7('0x14')](_0x31bb0e)[_0x78b7('0x15')]();};}function respondWithResult(_0x25f9f1,_0x40d8b5){_0x40d8b5=_0x40d8b5||0xc8;return function(_0x59c69b){if(_0x59c69b){return _0x25f9f1[_0x78b7('0x14')](_0x40d8b5)[_0x78b7('0x16')](_0x59c69b);}};}function respondWithFilteredResult(_0x58ae4a,_0x1cc200){return function(_0x278f62){if(_0x278f62){var _0x3b5647=typeof _0x1cc200[_0x78b7('0x17')]==='undefined'&&typeof _0x1cc200['limit']===_0x78b7('0x18');var _0x3221f1=_0x278f62[_0x78b7('0x19')];var _0x3375a6=_0x3b5647?0x0:_0x1cc200[_0x78b7('0x17')];var _0x1966d4=_0x3b5647?_0x278f62[_0x78b7('0x19')]:_0x1cc200['offset']+_0x1cc200['limit'];var _0x340d1d;if(_0x1966d4>=_0x3221f1){_0x1966d4=_0x3221f1;_0x340d1d=0xc8;}else{_0x340d1d=0xce;}_0x58ae4a[_0x78b7('0x14')](_0x340d1d);return _0x58ae4a[_0x78b7('0x1a')](_0x78b7('0x1b'),_0x3375a6+'-'+_0x1966d4+'/'+_0x3221f1)[_0x78b7('0x16')](_0x278f62);}return null;};}function patchUpdates(_0x55db9d){return function(_0x4077ec){try{jsonpatch[_0x78b7('0x1c')](_0x4077ec,_0x55db9d,!![]);}catch(_0x5c9a76){return BPromise[_0x78b7('0x1d')](_0x5c9a76);}return _0x4077ec[_0x78b7('0x1e')]();};}function saveUpdates(_0x288e64,_0x24b9e6){return function(_0x55d70f){if(_0x55d70f){return _0x55d70f[_0x78b7('0x1f')](_0x288e64)[_0x78b7('0x20')](function(_0x35f69a){return _0x35f69a;});}return null;};}function removeEntity(_0x31c7d5,_0x5e2f3b){return function(_0x531c83){if(_0x531c83){return _0x531c83[_0x78b7('0x21')]()[_0x78b7('0x20')](function(){var _0x2451af=_0x531c83[_0x78b7('0x22')]({'plain':!![]});var _0x4a517e='ODBC';return db[_0x78b7('0x23')]['destroy']({'where':{'type':_0x4a517e,'resourceId':_0x2451af['id']}})[_0x78b7('0x20')](function(){return _0x531c83;});})['then'](function(){_0x31c7d5[_0x78b7('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56d715,_0x2b8647){return function(_0x2ef4bd){if(!_0x2ef4bd){_0x56d715[_0x78b7('0x24')](0x194);}return _0x2ef4bd;};}function handleError(_0x1fc78d,_0x4113a6){_0x4113a6=_0x4113a6||0x1f4;return function(_0x2d0076){logger[_0x78b7('0x25')](_0x2d0076[_0x78b7('0x26')]);if(_0x2d0076[_0x78b7('0x27')]){delete _0x2d0076[_0x78b7('0x27')];}_0x1fc78d[_0x78b7('0x14')](_0x4113a6)[_0x78b7('0x28')](_0x2d0076);};}exports['index']=function(_0x137918,_0x3b41da){var _0x19800a={},_0x15d036={},_0x1b88d0={'count':0x0,'rows':[]};var _0x33f007=_[_0x78b7('0x29')](db['SquareOdbc'][_0x78b7('0x2a')],function(_0x1fe565){return{'name':_0x1fe565[_0x78b7('0x2b')],'type':_0x1fe565[_0x78b7('0x2c')][_0x78b7('0x2d')]};});_0x15d036[_0x78b7('0x2e')]=_[_0x78b7('0x29')](_0x33f007,_0x78b7('0x27'));_0x15d036[_0x78b7('0x2f')]=_[_0x78b7('0x30')](_0x137918[_0x78b7('0x2f')]);_0x15d036[_0x78b7('0x31')]=_[_0x78b7('0x32')](_0x15d036[_0x78b7('0x2e')],_0x15d036['query']);_0x19800a[_0x78b7('0x33')]=_[_0x78b7('0x32')](_0x15d036[_0x78b7('0x2e')],qs[_0x78b7('0x34')](_0x137918[_0x78b7('0x2f')][_0x78b7('0x34')]));_0x19800a[_0x78b7('0x33')]=_0x19800a[_0x78b7('0x33')][_0x78b7('0x35')]?_0x19800a[_0x78b7('0x33')]:_0x15d036[_0x78b7('0x2e')];if(!_0x137918['query'][_0x78b7('0x36')]('nolimit')){_0x19800a[_0x78b7('0x37')]=qs[_0x78b7('0x37')](_0x137918[_0x78b7('0x2f')][_0x78b7('0x37')]);_0x19800a[_0x78b7('0x17')]=qs[_0x78b7('0x17')](_0x137918['query']['offset']);}_0x19800a[_0x78b7('0x38')]=qs[_0x78b7('0x39')](_0x137918['query'][_0x78b7('0x39')]);_0x19800a[_0x78b7('0x3a')]=qs['filters'](_[_0x78b7('0x3b')](_0x137918['query'],_0x15d036[_0x78b7('0x31')]),_0x33f007);if(_0x137918[_0x78b7('0x2f')]['filter']){_0x19800a[_0x78b7('0x3a')]=_[_0x78b7('0x3c')](_0x19800a['where'],{'$or':_['map'](_0x33f007,function(_0x3c0f10){if(_0x3c0f10[_0x78b7('0x2c')]!==_0x78b7('0x3d')){var _0xf27068={};_0xf27068[_0x3c0f10[_0x78b7('0x27')]]={'$like':'%'+_0x137918[_0x78b7('0x2f')][_0x78b7('0x3e')]+'%'};return _0xf27068;}})});}_0x19800a=_[_0x78b7('0x3c')]({},_0x19800a,_0x137918[_0x78b7('0x3f')]);var _0x2c5fc2={'where':_0x19800a[_0x78b7('0x3a')]};return db[_0x78b7('0x40')][_0x78b7('0x19')](_0x2c5fc2)[_0x78b7('0x20')](function(_0x603533){_0x1b88d0[_0x78b7('0x19')]=_0x603533;if(_0x137918[_0x78b7('0x2f')][_0x78b7('0x41')]){_0x19800a[_0x78b7('0x42')]=[{'all':!![]}];}return db[_0x78b7('0x40')][_0x78b7('0x43')](_0x19800a);})[_0x78b7('0x20')](function(_0x3314a6){_0x1b88d0['rows']=_0x3314a6;return _0x1b88d0;})['then'](respondWithFilteredResult(_0x3b41da,_0x19800a))[_0x78b7('0x44')](handleError(_0x3b41da,null));};exports[_0x78b7('0x45')]=function(_0x43a432,_0x5b80ca){var _0x561219={'raw':!![],'where':{'id':_0x43a432[_0x78b7('0x46')]['id']}},_0x1fcfc8={};_0x1fcfc8[_0x78b7('0x2e')]=_['keys'](db[_0x78b7('0x40')][_0x78b7('0x2a')]);_0x1fcfc8[_0x78b7('0x2f')]=_[_0x78b7('0x30')](_0x43a432[_0x78b7('0x2f')]);_0x1fcfc8['filters']=_[_0x78b7('0x32')](_0x1fcfc8[_0x78b7('0x2e')],_0x1fcfc8[_0x78b7('0x2f')]);_0x561219[_0x78b7('0x33')]=_[_0x78b7('0x32')](_0x1fcfc8['model'],qs['fields'](_0x43a432[_0x78b7('0x2f')]['fields']));_0x561219['attributes']=_0x561219[_0x78b7('0x33')]['length']?_0x561219[_0x78b7('0x33')]:_0x1fcfc8[_0x78b7('0x2e')];if(_0x43a432[_0x78b7('0x2f')][_0x78b7('0x41')]){_0x561219[_0x78b7('0x42')]=[{'all':!![]}];}_0x561219=_['merge']({},_0x561219,_0x43a432[_0x78b7('0x3f')]);return db['SquareOdbc'][_0x78b7('0x47')](_0x561219)[_0x78b7('0x20')](handleEntityNotFound(_0x5b80ca,null))[_0x78b7('0x20')](respondWithResult(_0x5b80ca,null))[_0x78b7('0x44')](handleError(_0x5b80ca,null));};exports[_0x78b7('0x48')]=function(_0x90c94a,_0x287f6a){return db['SquareOdbc'][_0x78b7('0x48')](_0x90c94a[_0x78b7('0x49')],{})[_0x78b7('0x20')](function(_0xfb35ea){var _0x10ed47=_0x90c94a[_0x78b7('0x4a')][_0x78b7('0x22')]({'plain':!![]});if(!_0x10ed47)throw new Error(_0x78b7('0x4b'));if(_0x10ed47[_0x78b7('0x4c')]==='user'){var _0x6c4136=_0xfb35ea[_0x78b7('0x22')]({'plain':!![]});var _0xb56229='ODBC';return db[_0x78b7('0x4d')][_0x78b7('0x47')]({'where':{'name':_0xb56229,'userProfileId':_0x10ed47['userProfileId']},'raw':!![]})[_0x78b7('0x20')](function(_0x591b09){if(_0x591b09&&_0x591b09[_0x78b7('0x4e')]===0x0){return db[_0x78b7('0x23')][_0x78b7('0x48')]({'name':_0x6c4136['name'],'resourceId':_0x6c4136['id'],'type':_0x591b09[_0x78b7('0x27')],'sectionId':_0x591b09['id']},{})[_0x78b7('0x20')](function(){return _0xfb35ea;});}else{return _0xfb35ea;}})[_0x78b7('0x44')](function(_0x224fca){logger[_0x78b7('0x25')](_0x78b7('0x4f'),_0x224fca);throw _0x224fca;});}return _0xfb35ea;})[_0x78b7('0x20')](respondWithResult(_0x287f6a,0xc9))[_0x78b7('0x44')](handleError(_0x287f6a,null));};exports['update']=function(_0x2f6ca1,_0x124ca9){if(_0x2f6ca1[_0x78b7('0x49')]['id']){delete _0x2f6ca1[_0x78b7('0x49')]['id'];}return db[_0x78b7('0x40')]['find']({'where':{'id':_0x2f6ca1['params']['id']}})[_0x78b7('0x20')](handleEntityNotFound(_0x124ca9,null))['then'](saveUpdates(_0x2f6ca1[_0x78b7('0x49')],null))[_0x78b7('0x20')](respondWithResult(_0x124ca9,null))[_0x78b7('0x44')](handleError(_0x124ca9,null));};exports[_0x78b7('0x21')]=function(_0x23d0df,_0x387446){return db[_0x78b7('0x40')][_0x78b7('0x47')]({'where':{'id':_0x23d0df[_0x78b7('0x46')]['id']}})['then'](handleEntityNotFound(_0x387446,null))[_0x78b7('0x20')](removeEntity(_0x387446,null))[_0x78b7('0x44')](handleError(_0x387446,null));};exports[_0x78b7('0x50')]=function(_0x382715,_0x3a456a,_0x39c1ef){var _0x4b448a;return db[_0x78b7('0x40')][_0x78b7('0x47')]({'where':{'id':_0x382715[_0x78b7('0x46')]['id']},'attributes':['id',_0x78b7('0x51')]})[_0x78b7('0x20')](handleEntityNotFound(_0x3a456a,null))[_0x78b7('0x20')](function(_0x2f2414){if(_0x2f2414){var _0xa4855b=require(_0x78b7('0x52'))();_0xa4855b[_0x78b7('0x53')](_0x2f2414[_0x78b7('0x51')]);_0xa4855b['closeSync']();return _0x2f2414;}})['then'](respondWithResult(_0x3a456a,null))[_0x78b7('0x44')](handleError(_0x3a456a,null));}; \ No newline at end of file +var _0x6bdb=['UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','set','Content-Range','then','get','ODBC','UserProfileResource','destroy','error','name','send','index','SquareOdbc','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','limit','order','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','params','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0xc8023,_0xd1912){var _0x448b50=function(_0x4b8a6f){while(--_0x4b8a6f){_0xc8023['push'](_0xc8023['shift']());}};_0x448b50(++_0xd1912);}(_0x6bdb,0xb6));var _0xb6bd=function(_0x2e6a73,_0x3fafbf){_0x2e6a73=_0x2e6a73-0x0;var _0x4fb7f1=_0x6bdb[_0x2e6a73];return _0x4fb7f1;};'use strict';var emlformat=require(_0xb6bd('0x0'));var rimraf=require(_0xb6bd('0x1'));var zipdir=require(_0xb6bd('0x2'));var jsonpatch=require(_0xb6bd('0x3'));var rp=require(_0xb6bd('0x4'));var moment=require(_0xb6bd('0x5'));var BPromise=require(_0xb6bd('0x6'));var Mustache=require(_0xb6bd('0x7'));var util=require(_0xb6bd('0x8'));var path=require(_0xb6bd('0x9'));var sox=require(_0xb6bd('0xa'));var csv=require(_0xb6bd('0xb'));var ejs=require(_0xb6bd('0xc'));var fs=require('fs');var fs_extra=require(_0xb6bd('0xd'));var _=require(_0xb6bd('0xe'));var squel=require(_0xb6bd('0xf'));var crypto=require(_0xb6bd('0x10'));var jsforce=require(_0xb6bd('0x11'));var deskjs=require(_0xb6bd('0x12'));var toCsv=require(_0xb6bd('0xb'));var querystring=require(_0xb6bd('0x13'));var Papa=require(_0xb6bd('0x14'));var Redis=require('ioredis');var authService=require(_0xb6bd('0x15'));var qs=require(_0xb6bd('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb6bd('0x17'));var logger=require(_0xb6bd('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xb6bd('0x19'));var licenseUtil=require(_0xb6bd('0x1a'));var db=require(_0xb6bd('0x1b'))['db'];function respondWithStatusCode(_0x50c546,_0x12abe4){_0x12abe4=_0x12abe4||0xcc;return function(_0x2d11a9){if(_0x2d11a9){return _0x50c546[_0xb6bd('0x1c')](_0x12abe4);}return _0x50c546[_0xb6bd('0x1d')](_0x12abe4)[_0xb6bd('0x1e')]();};}function respondWithResult(_0xdec9de,_0x4a40e3){_0x4a40e3=_0x4a40e3||0xc8;return function(_0x5f1913){if(_0x5f1913){return _0xdec9de[_0xb6bd('0x1d')](_0x4a40e3)[_0xb6bd('0x1f')](_0x5f1913);}};}function respondWithFilteredResult(_0x23ef78,_0x1f4448){return function(_0x3179bd){if(_0x3179bd){var _0x4fbb28=typeof _0x1f4448[_0xb6bd('0x20')]==='undefined'&&typeof _0x1f4448['limit']===_0xb6bd('0x21');var _0x3cec0a=_0x3179bd['count'];var _0x26af68=_0x4fbb28?0x0:_0x1f4448[_0xb6bd('0x20')];var _0x3781eb=_0x4fbb28?_0x3179bd['count']:_0x1f4448[_0xb6bd('0x20')]+_0x1f4448['limit'];var _0x1284a7;if(_0x3781eb>=_0x3cec0a){_0x3781eb=_0x3cec0a;_0x1284a7=0xc8;}else{_0x1284a7=0xce;}_0x23ef78[_0xb6bd('0x1d')](_0x1284a7);return _0x23ef78[_0xb6bd('0x22')](_0xb6bd('0x23'),_0x26af68+'-'+_0x3781eb+'/'+_0x3cec0a)['json'](_0x3179bd);}return null;};}function patchUpdates(_0xa0838d){return function(_0x4faf4b){try{jsonpatch['apply'](_0x4faf4b,_0xa0838d,!![]);}catch(_0x38a100){return BPromise['reject'](_0x38a100);}return _0x4faf4b['save']();};}function saveUpdates(_0x17542e,_0x4e071e){return function(_0x965e04){if(_0x965e04){return _0x965e04['update'](_0x17542e)[_0xb6bd('0x24')](function(_0x4dd938){return _0x4dd938;});}return null;};}function removeEntity(_0x449fc0,_0x29ca10){return function(_0x329707){if(_0x329707){return _0x329707['destroy']()[_0xb6bd('0x24')](function(){var _0x55115a=_0x329707[_0xb6bd('0x25')]({'plain':!![]});var _0x5eb86f=_0xb6bd('0x26');return db[_0xb6bd('0x27')][_0xb6bd('0x28')]({'where':{'type':_0x5eb86f,'resourceId':_0x55115a['id']}})[_0xb6bd('0x24')](function(){return _0x329707;});})[_0xb6bd('0x24')](function(){_0x449fc0['status'](0xcc)[_0xb6bd('0x1e')]();});}};}function handleEntityNotFound(_0x2b516f,_0xb1419a){return function(_0x4e8c7c){if(!_0x4e8c7c){_0x2b516f[_0xb6bd('0x1c')](0x194);}return _0x4e8c7c;};}function handleError(_0xa632d7,_0x7e3df9){_0x7e3df9=_0x7e3df9||0x1f4;return function(_0x473c1e){logger[_0xb6bd('0x29')](_0x473c1e['stack']);if(_0x473c1e[_0xb6bd('0x2a')]){delete _0x473c1e['name'];}_0xa632d7[_0xb6bd('0x1d')](_0x7e3df9)[_0xb6bd('0x2b')](_0x473c1e);};}exports[_0xb6bd('0x2c')]=function(_0xb910e3,_0x39b3d8){var _0x26fa32={},_0x490c87={},_0x4b7238={'count':0x0,'rows':[]};var _0x47be58=_['map'](db[_0xb6bd('0x2d')]['rawAttributes'],function(_0x4056a2){return{'name':_0x4056a2['fieldName'],'type':_0x4056a2['type'][_0xb6bd('0x2e')]};});_0x490c87['model']=_['map'](_0x47be58,_0xb6bd('0x2a'));_0x490c87['query']=_[_0xb6bd('0x2f')](_0xb910e3[_0xb6bd('0x30')]);_0x490c87[_0xb6bd('0x31')]=_[_0xb6bd('0x32')](_0x490c87[_0xb6bd('0x33')],_0x490c87[_0xb6bd('0x30')]);_0x26fa32['attributes']=_[_0xb6bd('0x32')](_0x490c87[_0xb6bd('0x33')],qs[_0xb6bd('0x34')](_0xb910e3[_0xb6bd('0x30')][_0xb6bd('0x34')]));_0x26fa32[_0xb6bd('0x35')]=_0x26fa32['attributes']['length']?_0x26fa32['attributes']:_0x490c87[_0xb6bd('0x33')];if(!_0xb910e3[_0xb6bd('0x30')][_0xb6bd('0x36')]('nolimit')){_0x26fa32['limit']=qs[_0xb6bd('0x37')](_0xb910e3['query'][_0xb6bd('0x37')]);_0x26fa32[_0xb6bd('0x20')]=qs[_0xb6bd('0x20')](_0xb910e3[_0xb6bd('0x30')][_0xb6bd('0x20')]);}_0x26fa32[_0xb6bd('0x38')]=qs['sort'](_0xb910e3[_0xb6bd('0x30')]['sort']);_0x26fa32[_0xb6bd('0x39')]=qs[_0xb6bd('0x31')](_[_0xb6bd('0x3a')](_0xb910e3[_0xb6bd('0x30')],_0x490c87[_0xb6bd('0x31')]),_0x47be58);if(_0xb910e3[_0xb6bd('0x30')][_0xb6bd('0x3b')]){_0x26fa32[_0xb6bd('0x39')]=_['merge'](_0x26fa32['where'],{'$or':_['map'](_0x47be58,function(_0x31d150){if(_0x31d150[_0xb6bd('0x3c')]!==_0xb6bd('0x3d')){var _0x3e93a8={};_0x3e93a8[_0x31d150[_0xb6bd('0x2a')]]={'$like':'%'+_0xb910e3[_0xb6bd('0x30')]['filter']+'%'};return _0x3e93a8;}})});}_0x26fa32=_[_0xb6bd('0x3e')]({},_0x26fa32,_0xb910e3[_0xb6bd('0x3f')]);var _0x5239fd={'where':_0x26fa32[_0xb6bd('0x39')]};return db[_0xb6bd('0x2d')][_0xb6bd('0x40')](_0x5239fd)[_0xb6bd('0x24')](function(_0x1aa378){_0x4b7238['count']=_0x1aa378;if(_0xb910e3[_0xb6bd('0x30')][_0xb6bd('0x41')]){_0x26fa32[_0xb6bd('0x42')]=[{'all':!![]}];}return db[_0xb6bd('0x2d')]['findAll'](_0x26fa32);})[_0xb6bd('0x24')](function(_0x5ac820){_0x4b7238[_0xb6bd('0x43')]=_0x5ac820;return _0x4b7238;})[_0xb6bd('0x24')](respondWithFilteredResult(_0x39b3d8,_0x26fa32))[_0xb6bd('0x44')](handleError(_0x39b3d8,null));};exports[_0xb6bd('0x45')]=function(_0x334f1e,_0x156357){var _0x3cc766={'raw':!![],'where':{'id':_0x334f1e[_0xb6bd('0x46')]['id']}},_0x427590={};_0x427590[_0xb6bd('0x33')]=_[_0xb6bd('0x2f')](db[_0xb6bd('0x2d')]['rawAttributes']);_0x427590[_0xb6bd('0x30')]=_[_0xb6bd('0x2f')](_0x334f1e[_0xb6bd('0x30')]);_0x427590[_0xb6bd('0x31')]=_[_0xb6bd('0x32')](_0x427590[_0xb6bd('0x33')],_0x427590[_0xb6bd('0x30')]);_0x3cc766[_0xb6bd('0x35')]=_[_0xb6bd('0x32')](_0x427590['model'],qs['fields'](_0x334f1e['query'][_0xb6bd('0x34')]));_0x3cc766[_0xb6bd('0x35')]=_0x3cc766[_0xb6bd('0x35')][_0xb6bd('0x47')]?_0x3cc766[_0xb6bd('0x35')]:_0x427590[_0xb6bd('0x33')];if(_0x334f1e[_0xb6bd('0x30')]['includeAll']){_0x3cc766[_0xb6bd('0x42')]=[{'all':!![]}];}_0x3cc766=_[_0xb6bd('0x3e')]({},_0x3cc766,_0x334f1e[_0xb6bd('0x3f')]);return db[_0xb6bd('0x2d')]['find'](_0x3cc766)[_0xb6bd('0x24')](handleEntityNotFound(_0x156357,null))[_0xb6bd('0x24')](respondWithResult(_0x156357,null))['catch'](handleError(_0x156357,null));};exports[_0xb6bd('0x48')]=function(_0x2cf989,_0x821353){return db[_0xb6bd('0x2d')][_0xb6bd('0x48')](_0x2cf989[_0xb6bd('0x49')],{})['then'](function(_0x1eb219){var _0x1fd9be=_0x2cf989['user'][_0xb6bd('0x25')]({'plain':!![]});if(!_0x1fd9be)throw new Error(_0xb6bd('0x4a'));if(_0x1fd9be['role']===_0xb6bd('0x4b')){var _0x15eee1=_0x1eb219[_0xb6bd('0x25')]({'plain':!![]});var _0x1b4722=_0xb6bd('0x26');return db[_0xb6bd('0x4c')][_0xb6bd('0x4d')]({'where':{'name':_0x1b4722,'userProfileId':_0x1fd9be[_0xb6bd('0x4e')]},'raw':!![]})[_0xb6bd('0x24')](function(_0x16142d){if(_0x16142d&&_0x16142d['autoAssociation']===0x0){return db[_0xb6bd('0x27')][_0xb6bd('0x48')]({'name':_0x15eee1['name'],'resourceId':_0x15eee1['id'],'type':_0x16142d['name'],'sectionId':_0x16142d['id']},{})[_0xb6bd('0x24')](function(){return _0x1eb219;});}else{return _0x1eb219;}})[_0xb6bd('0x44')](function(_0x422ae6){logger['error'](_0xb6bd('0x4f'),_0x422ae6);throw _0x422ae6;});}return _0x1eb219;})['then'](respondWithResult(_0x821353,0xc9))['catch'](handleError(_0x821353,null));};exports[_0xb6bd('0x50')]=function(_0x2d0968,_0x162932){if(_0x2d0968['body']['id']){delete _0x2d0968[_0xb6bd('0x49')]['id'];}return db[_0xb6bd('0x2d')][_0xb6bd('0x4d')]({'where':{'id':_0x2d0968[_0xb6bd('0x46')]['id']}})[_0xb6bd('0x24')](handleEntityNotFound(_0x162932,null))['then'](saveUpdates(_0x2d0968['body'],null))[_0xb6bd('0x24')](respondWithResult(_0x162932,null))[_0xb6bd('0x44')](handleError(_0x162932,null));};exports[_0xb6bd('0x28')]=function(_0x57292a,_0x4aafa6){return db['SquareOdbc'][_0xb6bd('0x4d')]({'where':{'id':_0x57292a[_0xb6bd('0x46')]['id']}})[_0xb6bd('0x24')](handleEntityNotFound(_0x4aafa6,null))[_0xb6bd('0x24')](removeEntity(_0x4aafa6,null))[_0xb6bd('0x44')](handleError(_0x4aafa6,null));};exports[_0xb6bd('0x51')]=function(_0x4abc04,_0x195197,_0x4ecc7a){var _0xceadd0;return db['SquareOdbc'][_0xb6bd('0x4d')]({'where':{'id':_0x4abc04[_0xb6bd('0x46')]['id']},'attributes':['id',_0xb6bd('0x52')]})[_0xb6bd('0x24')](handleEntityNotFound(_0x195197,null))['then'](function(_0x4e8d9c){if(_0x4e8d9c){var _0x2a5be9=require(_0xb6bd('0x53'))();_0x2a5be9[_0xb6bd('0x54')](_0x4e8d9c[_0xb6bd('0x52')]);_0x2a5be9[_0xb6bd('0x55')]();return _0x4e8d9c;}})[_0xb6bd('0x24')](respondWithResult(_0x195197,null))[_0xb6bd('0x44')](handleError(_0x195197,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 9e15816..5f48465 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 _0x7089=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','util','../../config/logger','api'];(function(_0x2e5e9f,_0x56933f){var _0x45036b=function(_0x9a4c69){while(--_0x9a4c69){_0x2e5e9f['push'](_0x2e5e9f['shift']());}};_0x45036b(++_0x56933f);}(_0x7089,0x1aa));var _0x9708=function(_0x2e322e,_0x4a63a8){_0x2e322e=_0x2e322e-0x0;var _0x3e27a2=_0x7089[_0x2e322e];return _0x3e27a2;};'use strict';var _=require('lodash');var util=require(_0x9708('0x0'));var logger=require(_0x9708('0x1'))(_0x9708('0x2'));var moment=require(_0x9708('0x3'));var BPromise=require(_0x9708('0x4'));var rp=require(_0x9708('0x5'));var fs=require('fs');var path=require(_0x9708('0x6'));var rimraf=require(_0x9708('0x7'));var config=require(_0x9708('0x8'));var attributes=require(_0x9708('0x9'));module[_0x9708('0xa')]=function(_0x18efec,_0x4c8ddb){return _0x18efec[_0x9708('0xb')]('SquareOdbc',attributes,{'tableName':_0x9708('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc9e=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','exports','define','square_odbc'];(function(_0x1d96ae,_0x103653){var _0xb5d1cd=function(_0x2de0a9){while(--_0x2de0a9){_0x1d96ae['push'](_0x1d96ae['shift']());}};_0xb5d1cd(++_0x103653);}(_0xdc9e,0x6e));var _0xedc9=function(_0x3340dc,_0x3a3c73){_0x3340dc=_0x3340dc-0x0;var _0x105594=_0xdc9e[_0x3340dc];return _0x105594;};'use strict';var _=require(_0xedc9('0x0'));var util=require(_0xedc9('0x1'));var logger=require(_0xedc9('0x2'))('api');var moment=require('moment');var BPromise=require(_0xedc9('0x3'));var rp=require(_0xedc9('0x4'));var fs=require('fs');var path=require(_0xedc9('0x5'));var rimraf=require(_0xedc9('0x6'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xedc9('0x7')]=function(_0x18aeb8,_0x1042a9){return _0x18aeb8[_0xedc9('0x8')]('SquareOdbc',attributes,{'tableName':_0xedc9('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 251f35b..5ea3b67 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 _0x0050=['raw','where','attributes','include','map','model','ShowSquareOdbc','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','options'];(function(_0x21b4cb,_0x103fb9){var _0x17ab75=function(_0x5d0411){while(--_0x5d0411){_0x21b4cb['push'](_0x21b4cb['shift']());}};_0x17ab75(++_0x103fb9);}(_0x0050,0x128));var _0x0005=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0050[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x0005('0x0'));var util=require(_0x0005('0x1'));var moment=require(_0x0005('0x2'));var BPromise=require('bluebird');var rs=require(_0x0005('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0005('0x4'));var logger=require(_0x0005('0x5'))(_0x0005('0x6'));var config=require(_0x0005('0x7'));var jayson=require(_0x0005('0x8'));var client=jayson[_0x0005('0x9')][_0x0005('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21b8c2,_0xec092d,_0x186987){return new BPromise(function(_0x581f85,_0x3b70e0){return client[_0x0005('0xb')](_0x21b8c2,_0x186987)[_0x0005('0xc')](function(_0x475a20){logger['info'](_0x0005('0xd'),_0xec092d,_0x0005('0xe'));logger[_0x0005('0xf')](_0x0005('0x10'),_0xec092d,_0x0005('0xe'),JSON[_0x0005('0x11')](_0x475a20));if(_0x475a20['error']){if(_0x475a20['error'][_0x0005('0x12')]===0x1f4){logger['error'](_0x0005('0xd'),_0xec092d,_0x475a20[_0x0005('0x13')][_0x0005('0x14')]);return _0x3b70e0(_0x475a20[_0x0005('0x13')][_0x0005('0x14')]);}logger['error'](_0x0005('0xd'),_0xec092d,_0x475a20[_0x0005('0x13')]['message']);return _0x581f85(_0x475a20[_0x0005('0x13')][_0x0005('0x14')]);}else{logger[_0x0005('0x15')]('SquareOdbc,\x20%s,\x20%s',_0xec092d,_0x0005('0xe'));_0x581f85(_0x475a20[_0x0005('0x16')][_0x0005('0x14')]);}})['catch'](function(_0x14b8c7){logger[_0x0005('0x13')](_0x0005('0xd'),_0xec092d,_0x14b8c7);_0x3b70e0(_0x14b8c7);});});}exports['ShowSquareOdbc']=function(_0x1510c7){var _0x1d9dea=this;return new Promise(function(_0x52f03a,_0x1352fb){return db['SquareOdbc']['find']({'raw':_0x1510c7[_0x0005('0x17')]?_0x1510c7[_0x0005('0x17')][_0x0005('0x18')]===undefined?!![]:![]:!![],'where':_0x1510c7[_0x0005('0x17')]?_0x1510c7['options'][_0x0005('0x19')]||null:null,'attributes':_0x1510c7[_0x0005('0x17')]?_0x1510c7[_0x0005('0x17')][_0x0005('0x1a')]||null:null,'include':_0x1510c7['options']?_0x1510c7[_0x0005('0x17')][_0x0005('0x1b')]?_[_0x0005('0x1c')](_0x1510c7['options'][_0x0005('0x1b')],function(_0xcf7cc){return{'model':db[_0xcf7cc[_0x0005('0x1d')]],'as':_0xcf7cc['as'],'attributes':_0xcf7cc['attributes'],'include':_0xcf7cc['include']?_[_0x0005('0x1c')](_0xcf7cc['include'],function(_0x131bea){return{'model':db[_0x131bea[_0x0005('0x1d')]],'as':_0x131bea['as'],'attributes':_0x131bea[_0x0005('0x1a')],'include':_0x131bea['include']?_[_0x0005('0x1c')](_0x131bea[_0x0005('0x1b')],function(_0x344b0d){return{'model':db[_0x344b0d[_0x0005('0x1d')]],'as':_0x344b0d['as'],'attributes':_0x344b0d[_0x0005('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0005('0xc')](function(_0x5e5a7f){logger[_0x0005('0x15')](_0x0005('0x1e'),_0x1510c7);logger[_0x0005('0xf')](_0x0005('0x1e'),_0x1510c7,JSON[_0x0005('0x11')](_0x5e5a7f));_0x52f03a(_0x5e5a7f);})[_0x0005('0x1f')](function(_0x1cdc00){logger[_0x0005('0x13')]('ShowSquareOdbc',_0x1cdc00['message'],_0x1510c7);_0x1352fb(_0x1d9dea[_0x0005('0x13')](0x1f4,_0x1cdc00[_0x0005('0x14')]));});});}; \ No newline at end of file +var _0x05d6=['raw','where','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','info','result','catch','ShowSquareOdbc','SquareOdbc','find','options'];(function(_0x2b9184,_0x2e5303){var _0x24c96d=function(_0x25601c){while(--_0x25601c){_0x2b9184['push'](_0x2b9184['shift']());}};_0x24c96d(++_0x2e5303);}(_0x05d6,0xa1));var _0x605d=function(_0x36ee97,_0xc00603){_0x36ee97=_0x36ee97-0x0;var _0x4f8b0d=_0x05d6[_0x36ee97];return _0x4f8b0d;};'use strict';var _=require(_0x605d('0x0'));var util=require(_0x605d('0x1'));var moment=require(_0x605d('0x2'));var BPromise=require(_0x605d('0x3'));var rs=require(_0x605d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x605d('0x5'))['db'];var utils=require(_0x605d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x605d('0x7'));var jayson=require(_0x605d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13774d,_0x3d13b1,_0x46ddfb){return new BPromise(function(_0x3276c9,_0x19d901){return client[_0x605d('0x9')](_0x13774d,_0x46ddfb)['then'](function(_0x22cac8){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x3d13b1,'request\x20sent');logger[_0x605d('0xa')](_0x605d('0xb'),_0x3d13b1,_0x605d('0xc'),JSON[_0x605d('0xd')](_0x22cac8));if(_0x22cac8[_0x605d('0xe')]){if(_0x22cac8[_0x605d('0xe')][_0x605d('0xf')]===0x1f4){logger[_0x605d('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x3d13b1,_0x22cac8[_0x605d('0xe')][_0x605d('0x10')]);return _0x19d901(_0x22cac8[_0x605d('0xe')][_0x605d('0x10')]);}logger[_0x605d('0xe')](_0x605d('0x11'),_0x3d13b1,_0x22cac8[_0x605d('0xe')]['message']);return _0x3276c9(_0x22cac8[_0x605d('0xe')][_0x605d('0x10')]);}else{logger[_0x605d('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x3d13b1,_0x605d('0xc'));_0x3276c9(_0x22cac8[_0x605d('0x13')]['message']);}})[_0x605d('0x14')](function(_0x2c3bb0){logger[_0x605d('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x3d13b1,_0x2c3bb0);_0x19d901(_0x2c3bb0);});});}exports[_0x605d('0x15')]=function(_0x4cf678){var _0x132a3c=this;return new Promise(function(_0x312be0,_0x2329a0){return db[_0x605d('0x16')][_0x605d('0x17')]({'raw':_0x4cf678['options']?_0x4cf678[_0x605d('0x18')][_0x605d('0x19')]===undefined?!![]:![]:!![],'where':_0x4cf678['options']?_0x4cf678[_0x605d('0x18')][_0x605d('0x1a')]||null:null,'attributes':_0x4cf678[_0x605d('0x18')]?_0x4cf678[_0x605d('0x18')]['attributes']||null:null,'include':_0x4cf678[_0x605d('0x18')]?_0x4cf678[_0x605d('0x18')][_0x605d('0x1b')]?_[_0x605d('0x1c')](_0x4cf678['options'][_0x605d('0x1b')],function(_0x5a75d1){return{'model':db[_0x5a75d1[_0x605d('0x1d')]],'as':_0x5a75d1['as'],'attributes':_0x5a75d1[_0x605d('0x1e')],'include':_0x5a75d1[_0x605d('0x1b')]?_['map'](_0x5a75d1[_0x605d('0x1b')],function(_0x1323ad){return{'model':db[_0x1323ad[_0x605d('0x1d')]],'as':_0x1323ad['as'],'attributes':_0x1323ad['attributes'],'include':_0x1323ad[_0x605d('0x1b')]?_[_0x605d('0x1c')](_0x1323ad['include'],function(_0x3821f1){return{'model':db[_0x3821f1['model']],'as':_0x3821f1['as'],'attributes':_0x3821f1[_0x605d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c0e93){logger[_0x605d('0x12')](_0x605d('0x15'),_0x4cf678);logger[_0x605d('0xa')](_0x605d('0x15'),_0x4cf678,JSON[_0x605d('0xd')](_0x3c0e93));_0x312be0(_0x3c0e93);})['catch'](function(_0x13545b){logger[_0x605d('0xe')](_0x605d('0x15'),_0x13545b['message'],_0x4cf678);_0x2329a0(_0x132a3c['error'](0x1f4,_0x13545b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index b5dc654..4474dae 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 _0x659c=['put','update','delete','destroy','removeUsers','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','./squareProject.controller','get','isAuthenticated','index','/:id','post','create','/:id/users','addUsers'];(function(_0x56566e,_0x238b46){var _0x2262ab=function(_0x45d6e8){while(--_0x45d6e8){_0x56566e['push'](_0x56566e['shift']());}};_0x2262ab(++_0x238b46);}(_0x659c,0x1aa));var _0xc659=function(_0xa99357,_0x50ffad){_0xa99357=_0xa99357-0x0;var _0x111875=_0x659c[_0xa99357];return _0x111875;};'use strict';var multer=require(_0xc659('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc659('0x1'));var express=require(_0xc659('0x2'));var router=express['Router']();var fs_extra=require(_0xc659('0x3'));var auth=require(_0xc659('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc659('0x5'));router[_0xc659('0x6')]('/',auth[_0xc659('0x7')](),controller[_0xc659('0x8')]);router[_0xc659('0x6')](_0xc659('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xc659('0x6')]('/:id/users',auth['isAuthenticated'](),controller['getUsers']);router[_0xc659('0xa')]('/',auth[_0xc659('0x7')](),controller[_0xc659('0xb')]);router[_0xc659('0xa')](_0xc659('0xc'),auth[_0xc659('0x7')](),controller[_0xc659('0xd')]);router[_0xc659('0xe')]('/:id',auth[_0xc659('0x7')](),controller[_0xc659('0xf')]);router[_0xc659('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc659('0x11')]);router[_0xc659('0x10')]('/:id/users',auth[_0xc659('0x7')](),controller[_0xc659('0x12')]);module[_0xc659('0x13')]=router; \ No newline at end of file +var _0x8208=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','create','/:id/users','addUsers','update','delete','removeUsers'];(function(_0x490bb5,_0x119a81){var _0x526066=function(_0x2efa18){while(--_0x2efa18){_0x490bb5['push'](_0x490bb5['shift']());}};_0x526066(++_0x119a81);}(_0x8208,0x14b));var _0x8820=function(_0x41853d,_0x93dc0d){_0x41853d=_0x41853d-0x0;var _0x436cc5=_0x8208[_0x41853d];return _0x436cc5;};'use strict';var multer=require(_0x8820('0x0'));var util=require(_0x8820('0x1'));var path=require(_0x8820('0x2'));var timeout=require(_0x8820('0x3'));var express=require(_0x8820('0x4'));var router=express[_0x8820('0x5')]();var fs_extra=require(_0x8820('0x6'));var auth=require(_0x8820('0x7'));var interaction=require(_0x8820('0x8'));var config=require('../../config/environment');var controller=require(_0x8820('0x9'));router[_0x8820('0xa')]('/',auth[_0x8820('0xb')](),controller[_0x8820('0xc')]);router[_0x8820('0xa')](_0x8820('0xd'),auth['isAuthenticated'](),controller[_0x8820('0xe')]);router[_0x8820('0xa')]('/:id/users',auth[_0x8820('0xb')](),controller['getUsers']);router['post']('/',auth[_0x8820('0xb')](),controller[_0x8820('0xf')]);router['post'](_0x8820('0x10'),auth['isAuthenticated'](),controller[_0x8820('0x11')]);router['put']('/:id',auth[_0x8820('0xb')](),controller[_0x8820('0x12')]);router[_0x8820('0x13')](_0x8820('0xd'),auth[_0x8820('0xb')](),controller['destroy']);router[_0x8820('0x13')](_0x8820('0x10'),auth[_0x8820('0xb')](),controller[_0x8820('0x14')]);module[_0x8820('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index abe06db..32e5402 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 _0x10b3=['production','DATE','STRING','name','long','getDataValue','preproduction','toString','utf8'];(function(_0x4bb7ce,_0x3f612f){var _0x583c1e=function(_0xa35fd9){while(--_0xa35fd9){_0x4bb7ce['push'](_0x4bb7ce['shift']());}};_0x583c1e(++_0x3f612f);}(_0x10b3,0x185));var _0x310b=function(_0xc447e4,_0x5302b7){_0xc447e4=_0xc447e4-0x0;var _0x1729d9=_0x10b3[_0xc447e4];return _0x1729d9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x310b('0x0')],'unique':_0x310b('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x310b('0x0')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x310b('0x2')),'get':function(){if(this[_0x310b('0x3')]('preproduction')){return this[_0x310b('0x3')](_0x310b('0x4'))[_0x310b('0x5')](_0x310b('0x6'));}}},'production':{'type':Sequelize['BLOB'](_0x310b('0x2')),'get':function(){if(this[_0x310b('0x3')]('production')){return this['getDataValue'](_0x310b('0x7'))[_0x310b('0x5')](_0x310b('0x6'));}}},'savedAt':{'type':Sequelize[_0x310b('0x8')]},'publishedAt':{'type':Sequelize[_0x310b('0x8')]}}; \ No newline at end of file +var _0xaaee=['DATE','sequelize','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0xe4bb3d,_0x21e87e){var _0xd9e51=function(_0x1f732b){while(--_0x1f732b){_0xe4bb3d['push'](_0xe4bb3d['shift']());}};_0xd9e51(++_0x21e87e);}(_0xaaee,0xa9));var _0xeaae=function(_0x1b34a0,_0x250f11){_0x1b34a0=_0x1b34a0-0x0;var _0x8e04fe=_0xaaee[_0x1b34a0];return _0x8e04fe;};'use strict';var Sequelize=require(_0xeaae('0x0'));module['exports']={'name':{'type':Sequelize[_0xeaae('0x1')],'unique':_0xeaae('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xeaae('0x3')]},'preproduction':{'type':Sequelize[_0xeaae('0x4')](_0xeaae('0x5')),'get':function(){if(this[_0xeaae('0x6')]('preproduction')){return this[_0xeaae('0x6')](_0xeaae('0x7'))[_0xeaae('0x8')](_0xeaae('0x9'));}}},'production':{'type':Sequelize[_0xeaae('0x4')](_0xeaae('0x5')),'get':function(){if(this['getDataValue'](_0xeaae('0xa'))){return this[_0xeaae('0x6')](_0xeaae('0xa'))[_0xeaae('0x8')](_0xeaae('0x9'));}}},'savedAt':{'type':Sequelize[_0xeaae('0xb')]},'publishedAt':{'type':Sequelize[_0xeaae('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 9ccfc3c..57bda64 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 _0x420f=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','get','SquareProjects','UserProfileResource','destroy','error','stack','name','send','index','SquareProject','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','options','include','catch','show','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','removeUsers','isArray','userSquareProject:remove','emit','User','sort','pick','map','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs'];(function(_0x135f1f,_0x45e875){var _0x547ed6=function(_0x466b4c){while(--_0x466b4c){_0x135f1f['push'](_0x135f1f['shift']());}};_0x547ed6(++_0x45e875);}(_0x420f,0x1c1));var _0xf420=function(_0x25b06d,_0x39beae){_0x25b06d=_0x25b06d-0x0;var _0x5da09b=_0x420f[_0x25b06d];return _0x5da09b;};'use strict';var emlformat=require(_0xf420('0x0'));var rimraf=require(_0xf420('0x1'));var zipdir=require(_0xf420('0x2'));var jsonpatch=require(_0xf420('0x3'));var rp=require('request-promise');var moment=require(_0xf420('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf420('0x5'));var path=require('path');var sox=require(_0xf420('0x6'));var csv=require(_0xf420('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf420('0x8'));var _=require(_0xf420('0x9'));var squel=require(_0xf420('0xa'));var crypto=require(_0xf420('0xb'));var jsforce=require(_0xf420('0xc'));var deskjs=require(_0xf420('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf420('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf420('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf420('0x10'));var logger=require(_0xf420('0x11'))(_0xf420('0x12'));var utils=require(_0xf420('0x13'));var config=require(_0xf420('0x14'));var licenseUtil=require(_0xf420('0x15'));var db=require(_0xf420('0x16'))['db'];config[_0xf420('0x17')]=_[_0xf420('0x18')](config[_0xf420('0x17')],{'host':_0xf420('0x19'),'port':0x18eb});var socket=require(_0xf420('0x1a'))(new Redis(config[_0xf420('0x17')]));require(_0xf420('0x1b'))[_0xf420('0x1c')](socket);function respondWithStatusCode(_0x1efd0f,_0x393582){_0x393582=_0x393582||0xcc;return function(_0x382e1b){if(_0x382e1b){return _0x1efd0f[_0xf420('0x1d')](_0x393582);}return _0x1efd0f[_0xf420('0x1e')](_0x393582)[_0xf420('0x1f')]();};}function respondWithResult(_0x2c7de6,_0x372cd1){_0x372cd1=_0x372cd1||0xc8;return function(_0x1d3e7f){if(_0x1d3e7f){return _0x2c7de6[_0xf420('0x1e')](_0x372cd1)['json'](_0x1d3e7f);}};}function respondWithFilteredResult(_0x22337d,_0x49ff17){return function(_0x30f600){if(_0x30f600){var _0x375565=typeof _0x49ff17[_0xf420('0x20')]===_0xf420('0x21')&&typeof _0x49ff17[_0xf420('0x22')]===_0xf420('0x21');var _0x3a9d65=_0x30f600[_0xf420('0x23')];var _0x56dae7=_0x375565?0x0:_0x49ff17[_0xf420('0x20')];var _0x2cb564=_0x375565?_0x30f600['count']:_0x49ff17[_0xf420('0x20')]+_0x49ff17['limit'];var _0x338284;if(_0x2cb564>=_0x3a9d65){_0x2cb564=_0x3a9d65;_0x338284=0xc8;}else{_0x338284=0xce;}_0x22337d[_0xf420('0x1e')](_0x338284);return _0x22337d[_0xf420('0x24')](_0xf420('0x25'),_0x56dae7+'-'+_0x2cb564+'/'+_0x3a9d65)['json'](_0x30f600);}return null;};}function patchUpdates(_0x55f422){return function(_0x4d7562){try{jsonpatch['apply'](_0x4d7562,_0x55f422,!![]);}catch(_0x56fb49){return BPromise['reject'](_0x56fb49);}return _0x4d7562[_0xf420('0x26')]();};}function saveUpdates(_0x35684c,_0x1b2865){return function(_0xff1c2c){if(_0xff1c2c){return _0xff1c2c['update'](_0x35684c)[_0xf420('0x27')](function(_0x2fa188){return _0x2fa188;});}return null;};}function removeEntity(_0x372d36,_0x2399b4){return function(_0x2d2aae){if(_0x2d2aae){return _0x2d2aae['destroy']()[_0xf420('0x27')](function(){var _0x30c98c=_0x2d2aae[_0xf420('0x28')]({'plain':!![]});var _0x1d5712=_0xf420('0x29');return db[_0xf420('0x2a')][_0xf420('0x2b')]({'where':{'type':_0x1d5712,'resourceId':_0x30c98c['id']}})['then'](function(){return _0x2d2aae;});})[_0xf420('0x27')](function(){_0x372d36[_0xf420('0x1e')](0xcc)[_0xf420('0x1f')]();});}};}function handleEntityNotFound(_0x4f8915,_0x1ab1eb){return function(_0x446531){if(!_0x446531){_0x4f8915['sendStatus'](0x194);}return _0x446531;};}function handleError(_0x5346f0,_0x29aaaf){_0x29aaaf=_0x29aaaf||0x1f4;return function(_0x22b51c){logger[_0xf420('0x2c')](_0x22b51c[_0xf420('0x2d')]);if(_0x22b51c['name']){delete _0x22b51c[_0xf420('0x2e')];}_0x5346f0[_0xf420('0x1e')](_0x29aaaf)[_0xf420('0x2f')](_0x22b51c);};}exports[_0xf420('0x30')]=function(_0x2bd067,_0x455be6){var _0x5b9085={},_0x41da36={},_0x32e09e={'count':0x0,'rows':[]};var _0x11ba9f=_['map'](db[_0xf420('0x31')]['rawAttributes'],function(_0xc1529b){return{'name':_0xc1529b[_0xf420('0x32')],'type':_0xc1529b[_0xf420('0x33')]['key']};});_0x41da36[_0xf420('0x34')]=_['map'](_0x11ba9f,_0xf420('0x2e'));_0x41da36[_0xf420('0x35')]=_[_0xf420('0x36')](_0x2bd067[_0xf420('0x35')]);_0x41da36[_0xf420('0x37')]=_[_0xf420('0x38')](_0x41da36['model'],_0x41da36[_0xf420('0x35')]);_0x5b9085['attributes']=_['intersection'](_0x41da36[_0xf420('0x34')],qs[_0xf420('0x39')](_0x2bd067[_0xf420('0x35')][_0xf420('0x39')]));_0x5b9085[_0xf420('0x3a')]=_0x5b9085[_0xf420('0x3a')][_0xf420('0x3b')]?_0x5b9085[_0xf420('0x3a')]:_0x41da36[_0xf420('0x34')];if(!_0x2bd067[_0xf420('0x35')][_0xf420('0x3c')](_0xf420('0x3d'))){_0x5b9085[_0xf420('0x22')]=qs[_0xf420('0x22')](_0x2bd067[_0xf420('0x35')][_0xf420('0x22')]);_0x5b9085[_0xf420('0x20')]=qs[_0xf420('0x20')](_0x2bd067[_0xf420('0x35')][_0xf420('0x20')]);}_0x5b9085[_0xf420('0x3e')]=qs['sort'](_0x2bd067[_0xf420('0x35')]['sort']);_0x5b9085[_0xf420('0x3f')]=qs[_0xf420('0x37')](_['pick'](_0x2bd067[_0xf420('0x35')],_0x41da36[_0xf420('0x37')]),_0x11ba9f);if(_0x2bd067[_0xf420('0x35')][_0xf420('0x40')]){_0x5b9085[_0xf420('0x3f')]=_['merge'](_0x5b9085[_0xf420('0x3f')],{'$or':_['map'](_0x11ba9f,function(_0xd24749){if(_0xd24749[_0xf420('0x33')]!==_0xf420('0x41')){var _0x18a0bd={};_0x18a0bd[_0xd24749[_0xf420('0x2e')]]={'$like':'%'+_0x2bd067[_0xf420('0x35')]['filter']+'%'};return _0x18a0bd;}})});}_0x5b9085=_[_0xf420('0x42')]({},_0x5b9085,_0x2bd067[_0xf420('0x43')]);var _0x3ce9fe={'where':_0x5b9085[_0xf420('0x3f')]};return db['SquareProject'][_0xf420('0x23')](_0x3ce9fe)[_0xf420('0x27')](function(_0xa0c7ce){_0x32e09e['count']=_0xa0c7ce;if(_0x2bd067[_0xf420('0x35')]['includeAll']){_0x5b9085[_0xf420('0x44')]=[{'all':!![]}];}return db[_0xf420('0x31')]['findAll'](_0x5b9085);})[_0xf420('0x27')](function(_0x3748e5){_0x32e09e['rows']=_0x3748e5;return _0x32e09e;})[_0xf420('0x27')](respondWithFilteredResult(_0x455be6,_0x5b9085))[_0xf420('0x45')](handleError(_0x455be6,null));};exports[_0xf420('0x46')]=function(_0x3437d8,_0x20be92){var _0x13cb15={'raw':![],'where':{'id':_0x3437d8['params']['id']}},_0x41866f={};_0x41866f[_0xf420('0x34')]=_[_0xf420('0x36')](db[_0xf420('0x31')][_0xf420('0x47')]);_0x41866f['query']=_[_0xf420('0x36')](_0x3437d8[_0xf420('0x35')]);_0x41866f[_0xf420('0x37')]=_['intersection'](_0x41866f[_0xf420('0x34')],_0x41866f['query']);_0x13cb15[_0xf420('0x3a')]=_[_0xf420('0x38')](_0x41866f['model'],qs[_0xf420('0x39')](_0x3437d8[_0xf420('0x35')][_0xf420('0x39')]));_0x13cb15['attributes']=_0x13cb15[_0xf420('0x3a')][_0xf420('0x3b')]?_0x13cb15[_0xf420('0x3a')]:_0x41866f[_0xf420('0x34')];if(_0x3437d8['query'][_0xf420('0x48')]){_0x13cb15[_0xf420('0x44')]=[{'all':!![]}];}_0x13cb15=_[_0xf420('0x42')]({},_0x13cb15,_0x3437d8[_0xf420('0x43')]);return db['SquareProject'][_0xf420('0x49')](_0x13cb15)[_0xf420('0x27')](handleEntityNotFound(_0x20be92,null))[_0xf420('0x27')](respondWithResult(_0x20be92,null))['catch'](handleError(_0x20be92,null));};exports['create']=function(_0x4f3f02,_0x14e630){return db[_0xf420('0x31')][_0xf420('0x4a')](_0x4f3f02[_0xf420('0x4b')],{})[_0xf420('0x27')](function(_0x33eb74){var _0x50c3cc=_0x4f3f02[_0xf420('0x4c')]['get']({'plain':!![]});if(!_0x50c3cc)throw new Error(_0xf420('0x4d'));if(_0x50c3cc['role']==='user'){var _0x4da279=_0x33eb74[_0xf420('0x28')]({'plain':!![]});var _0x5be863=_0xf420('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x5be863,'userProfileId':_0x50c3cc[_0xf420('0x4e')]},'raw':!![]})[_0xf420('0x27')](function(_0x37752c){if(_0x37752c&&_0x37752c[_0xf420('0x4f')]===0x0){return db[_0xf420('0x2a')][_0xf420('0x4a')]({'name':_0x4da279[_0xf420('0x2e')],'resourceId':_0x4da279['id'],'type':_0x37752c['name'],'sectionId':_0x37752c['id']},{})[_0xf420('0x27')](function(){return _0x33eb74;});}else{return _0x33eb74;}})['catch'](function(_0x27b34f){logger[_0xf420('0x2c')](_0xf420('0x50'),_0x27b34f);throw _0x27b34f;});}return _0x33eb74;})['then'](respondWithResult(_0x14e630,0xc9))[_0xf420('0x45')](handleError(_0x14e630,null));};exports['update']=function(_0x30400c,_0xcb55fe){if(_0x30400c[_0xf420('0x4b')]['id']){delete _0x30400c['body']['id'];}return db[_0xf420('0x31')][_0xf420('0x49')]({'where':{'id':_0x30400c[_0xf420('0x51')]['id']}})[_0xf420('0x27')](handleEntityNotFound(_0xcb55fe,null))['then'](saveUpdates(_0x30400c['body'],null))[_0xf420('0x27')](respondWithResult(_0xcb55fe,null))['catch'](handleError(_0xcb55fe,null));};exports[_0xf420('0x2b')]=function(_0x4242ba,_0xf88f3b){return db['SquareProject'][_0xf420('0x49')]({'where':{'id':_0x4242ba['params']['id']}})[_0xf420('0x27')](handleEntityNotFound(_0xf88f3b,null))[_0xf420('0x27')](removeEntity(_0xf88f3b,null))[_0xf420('0x45')](handleError(_0xf88f3b,null));};exports[_0xf420('0x52')]=function(_0x34f848,_0x5ccf88,_0x48d906){return db[_0xf420('0x31')][_0xf420('0x49')]({'where':{'id':_0x34f848[_0xf420('0x51')]['id']}})[_0xf420('0x27')](handleEntityNotFound(_0x5ccf88,null))[_0xf420('0x27')](function(_0x7a8ac0){if(_0x7a8ac0){return _0x7a8ac0[_0xf420('0x52')](_0x34f848[_0xf420('0x4b')]['ids'],_['omit'](_0x34f848[_0xf420('0x4b')],[_0xf420('0x53'),'id'])||{});}})[_0xf420('0x27')](respondWithResult(_0x5ccf88,null))[_0xf420('0x45')](handleError(_0x5ccf88,null));};exports[_0xf420('0x54')]=function(_0x20aabf,_0x4734a7,_0x18f451){return db[_0xf420('0x31')][_0xf420('0x49')]({'where':{'id':_0x20aabf[_0xf420('0x51')]['id']}})[_0xf420('0x27')](handleEntityNotFound(_0x4734a7,null))[_0xf420('0x27')](function(_0x1e3577){if(_0x1e3577){return _0x1e3577['removeUsers'](_0x20aabf[_0xf420('0x35')][_0xf420('0x53')])[_0xf420('0x27')](function(){if(_[_0xf420('0x55')](_0x20aabf[_0xf420('0x35')][_0xf420('0x53')])){for(var _0x15a2e8=0x0;_0x15a2e8<_0x20aabf[_0xf420('0x35')]['ids'][_0xf420('0x3b')];_0x15a2e8+=0x1){socket['emit'](_0xf420('0x56'),{'UserId':Number(_0x20aabf[_0xf420('0x35')][_0xf420('0x53')][_0x15a2e8]),'SquareProjectId':Number(_0x20aabf['params']['id'])});}}else{socket[_0xf420('0x57')](_0xf420('0x56'),{'UserId':Number(_0x20aabf[_0xf420('0x35')][_0xf420('0x53')]),'SquareProjectId':Number(_0x20aabf[_0xf420('0x51')]['id'])});}});}})[_0xf420('0x27')](respondWithStatusCode(_0x4734a7,null))[_0xf420('0x45')](handleError(_0x4734a7,null));};exports['getUsers']=function(_0x1997c3,_0x39fad2,_0x4d7d96){var _0x3f55b6={};var _0x49c43a={};var _0x399212;var _0x1a2992;return db[_0xf420('0x31')]['findOne']({'where':{'id':_0x1997c3['params']['id']}})['then'](handleEntityNotFound(_0x39fad2,null))[_0xf420('0x27')](function(_0x36181b){if(_0x36181b){_0x399212=_0x36181b;_0x49c43a[_0xf420('0x34')]=_[_0xf420('0x36')](db[_0xf420('0x58')][_0xf420('0x47')]);_0x49c43a[_0xf420('0x35')]=_[_0xf420('0x36')](_0x1997c3[_0xf420('0x35')]);_0x49c43a[_0xf420('0x37')]=_[_0xf420('0x38')](_0x49c43a[_0xf420('0x34')],_0x49c43a[_0xf420('0x35')]);_0x3f55b6[_0xf420('0x3a')]=_[_0xf420('0x38')](_0x49c43a['model'],qs[_0xf420('0x39')](_0x1997c3[_0xf420('0x35')]['fields']));_0x3f55b6[_0xf420('0x3a')]=_0x3f55b6['attributes'][_0xf420('0x3b')]?_0x3f55b6['attributes']:_0x49c43a[_0xf420('0x34')];_0x3f55b6[_0xf420('0x3e')]=qs[_0xf420('0x59')](_0x1997c3[_0xf420('0x35')][_0xf420('0x59')]);_0x3f55b6[_0xf420('0x3f')]=qs['filters'](_[_0xf420('0x5a')](_0x1997c3[_0xf420('0x35')],_0x49c43a[_0xf420('0x37')]));if(_0x1997c3[_0xf420('0x35')][_0xf420('0x40')]){_0x3f55b6[_0xf420('0x3f')]=_[_0xf420('0x42')](_0x3f55b6['where'],{'$or':_[_0xf420('0x5b')](_0x3f55b6[_0xf420('0x3a')],function(_0x18b9ab){var _0xd94cf7={};_0xd94cf7[_0x18b9ab]={'$like':'%'+_0x1997c3[_0xf420('0x35')][_0xf420('0x40')]+'%'};return _0xd94cf7;})});}_0x3f55b6=_['merge']({},_0x3f55b6,_0x1997c3[_0xf420('0x43')]);return _0x399212[_0xf420('0x5c')](_0x3f55b6);}})[_0xf420('0x27')](function(_0x3f374f){if(_0x3f374f){_0x1a2992=_0x3f374f[_0xf420('0x3b')];if(!_0x1997c3[_0xf420('0x35')]['hasOwnProperty'](_0xf420('0x3d'))){_0x3f55b6[_0xf420('0x22')]=qs['limit'](_0x1997c3[_0xf420('0x35')][_0xf420('0x22')]);_0x3f55b6[_0xf420('0x20')]=qs['offset'](_0x1997c3[_0xf420('0x35')][_0xf420('0x20')]);}return _0x399212['getUsers'](_0x3f55b6);}})[_0xf420('0x27')](function(_0x1cfcc6){if(_0x1cfcc6){return _0x1cfcc6?{'count':_0x1a2992,'rows':_0x1cfcc6}:null;}})[_0xf420('0x27')](respondWithResult(_0x39fad2,null))[_0xf420('0x45')](handleError(_0x39fad2,null));}; \ No newline at end of file +var _0x81d5=['length','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','nolimit','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','SquareProjects','UserProfileResource','destroy','end','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields'];(function(_0x42ac5c,_0x280dbb){var _0x439af7=function(_0x513833){while(--_0x513833){_0x42ac5c['push'](_0x42ac5c['shift']());}};_0x439af7(++_0x280dbb);}(_0x81d5,0x154));var _0x581d=function(_0x2cb0ac,_0x3d367f){_0x2cb0ac=_0x2cb0ac-0x0;var _0x4c757a=_0x81d5[_0x2cb0ac];return _0x4c757a;};'use strict';var emlformat=require(_0x581d('0x0'));var rimraf=require(_0x581d('0x1'));var zipdir=require(_0x581d('0x2'));var jsonpatch=require(_0x581d('0x3'));var rp=require(_0x581d('0x4'));var moment=require(_0x581d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x581d('0x6'));var util=require(_0x581d('0x7'));var path=require(_0x581d('0x8'));var sox=require(_0x581d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x581d('0xa'));var _=require(_0x581d('0xb'));var squel=require(_0x581d('0xc'));var crypto=require(_0x581d('0xd'));var jsforce=require(_0x581d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x581d('0xf'));var querystring=require(_0x581d('0x10'));var Papa=require('papaparse');var Redis=require(_0x581d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x581d('0x12'));var as=require(_0x581d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x581d('0x14'))(_0x581d('0x15'));var utils=require(_0x581d('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x581d('0x17'))['db'];config[_0x581d('0x18')]=_[_0x581d('0x19')](config[_0x581d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x581d('0x1a'))(new Redis(config[_0x581d('0x18')]));require(_0x581d('0x1b'))['register'](socket);function respondWithStatusCode(_0x4d9974,_0x258a04){_0x258a04=_0x258a04||0xcc;return function(_0xab283){if(_0xab283){return _0x4d9974[_0x581d('0x1c')](_0x258a04);}return _0x4d9974[_0x581d('0x1d')](_0x258a04)['end']();};}function respondWithResult(_0x5dbf41,_0x13d061){_0x13d061=_0x13d061||0xc8;return function(_0x5ee457){if(_0x5ee457){return _0x5dbf41[_0x581d('0x1d')](_0x13d061)[_0x581d('0x1e')](_0x5ee457);}};}function respondWithFilteredResult(_0xf32c8a,_0x548c16){return function(_0x479919){if(_0x479919){var _0x34eeed=typeof _0x548c16[_0x581d('0x1f')]===_0x581d('0x20')&&typeof _0x548c16[_0x581d('0x21')]===_0x581d('0x20');var _0x202547=_0x479919[_0x581d('0x22')];var _0x3f6c7a=_0x34eeed?0x0:_0x548c16['offset'];var _0x11876c=_0x34eeed?_0x479919[_0x581d('0x22')]:_0x548c16[_0x581d('0x1f')]+_0x548c16[_0x581d('0x21')];var _0x1220c4;if(_0x11876c>=_0x202547){_0x11876c=_0x202547;_0x1220c4=0xc8;}else{_0x1220c4=0xce;}_0xf32c8a[_0x581d('0x1d')](_0x1220c4);return _0xf32c8a[_0x581d('0x23')](_0x581d('0x24'),_0x3f6c7a+'-'+_0x11876c+'/'+_0x202547)[_0x581d('0x1e')](_0x479919);}return null;};}function patchUpdates(_0x4fc750){return function(_0x268d46){try{jsonpatch[_0x581d('0x25')](_0x268d46,_0x4fc750,!![]);}catch(_0x332387){return BPromise[_0x581d('0x26')](_0x332387);}return _0x268d46[_0x581d('0x27')]();};}function saveUpdates(_0x11a1c5,_0x3eb49c){return function(_0x544d36){if(_0x544d36){return _0x544d36[_0x581d('0x28')](_0x11a1c5)[_0x581d('0x29')](function(_0xbb6079){return _0xbb6079;});}return null;};}function removeEntity(_0xed6326,_0x30b241){return function(_0x18eb84){if(_0x18eb84){return _0x18eb84['destroy']()[_0x581d('0x29')](function(){var _0x1e423c=_0x18eb84[_0x581d('0x2a')]({'plain':!![]});var _0x24d7df=_0x581d('0x2b');return db[_0x581d('0x2c')][_0x581d('0x2d')]({'where':{'type':_0x24d7df,'resourceId':_0x1e423c['id']}})[_0x581d('0x29')](function(){return _0x18eb84;});})[_0x581d('0x29')](function(){_0xed6326['status'](0xcc)[_0x581d('0x2e')]();});}};}function handleEntityNotFound(_0xf57a9,_0x153a5f){return function(_0xcc836e){if(!_0xcc836e){_0xf57a9[_0x581d('0x1c')](0x194);}return _0xcc836e;};}function handleError(_0x422e9a,_0x417686){_0x417686=_0x417686||0x1f4;return function(_0x585f62){logger[_0x581d('0x2f')](_0x585f62[_0x581d('0x30')]);if(_0x585f62[_0x581d('0x31')]){delete _0x585f62[_0x581d('0x31')];}_0x422e9a[_0x581d('0x1d')](_0x417686)[_0x581d('0x32')](_0x585f62);};}exports[_0x581d('0x33')]=function(_0x514738,_0x4aac15){var _0x5b3801={},_0x5432e2={},_0x49bb20={'count':0x0,'rows':[]};var _0x17f8ff=_['map'](db[_0x581d('0x34')][_0x581d('0x35')],function(_0x55bf16){return{'name':_0x55bf16[_0x581d('0x36')],'type':_0x55bf16[_0x581d('0x37')][_0x581d('0x38')]};});_0x5432e2[_0x581d('0x39')]=_[_0x581d('0x3a')](_0x17f8ff,_0x581d('0x31'));_0x5432e2[_0x581d('0x3b')]=_[_0x581d('0x3c')](_0x514738[_0x581d('0x3b')]);_0x5432e2[_0x581d('0x3d')]=_[_0x581d('0x3e')](_0x5432e2[_0x581d('0x39')],_0x5432e2[_0x581d('0x3b')]);_0x5b3801['attributes']=_['intersection'](_0x5432e2[_0x581d('0x39')],qs[_0x581d('0x3f')](_0x514738[_0x581d('0x3b')][_0x581d('0x3f')]));_0x5b3801['attributes']=_0x5b3801['attributes'][_0x581d('0x40')]?_0x5b3801[_0x581d('0x41')]:_0x5432e2[_0x581d('0x39')];if(!_0x514738[_0x581d('0x3b')][_0x581d('0x42')]('nolimit')){_0x5b3801[_0x581d('0x21')]=qs[_0x581d('0x21')](_0x514738[_0x581d('0x3b')][_0x581d('0x21')]);_0x5b3801['offset']=qs['offset'](_0x514738[_0x581d('0x3b')][_0x581d('0x1f')]);}_0x5b3801[_0x581d('0x43')]=qs[_0x581d('0x44')](_0x514738[_0x581d('0x3b')][_0x581d('0x44')]);_0x5b3801['where']=qs[_0x581d('0x3d')](_[_0x581d('0x45')](_0x514738['query'],_0x5432e2[_0x581d('0x3d')]),_0x17f8ff);if(_0x514738['query'][_0x581d('0x46')]){_0x5b3801[_0x581d('0x47')]=_[_0x581d('0x48')](_0x5b3801[_0x581d('0x47')],{'$or':_[_0x581d('0x3a')](_0x17f8ff,function(_0x3c606c){if(_0x3c606c['type']!==_0x581d('0x49')){var _0x44bad5={};_0x44bad5[_0x3c606c[_0x581d('0x31')]]={'$like':'%'+_0x514738[_0x581d('0x3b')]['filter']+'%'};return _0x44bad5;}})});}_0x5b3801=_['merge']({},_0x5b3801,_0x514738['options']);var _0x1bddfb={'where':_0x5b3801[_0x581d('0x47')]};return db[_0x581d('0x34')][_0x581d('0x22')](_0x1bddfb)[_0x581d('0x29')](function(_0x2e77ba){_0x49bb20[_0x581d('0x22')]=_0x2e77ba;if(_0x514738[_0x581d('0x3b')]['includeAll']){_0x5b3801[_0x581d('0x4a')]=[{'all':!![]}];}return db[_0x581d('0x34')][_0x581d('0x4b')](_0x5b3801);})[_0x581d('0x29')](function(_0x23cc62){_0x49bb20['rows']=_0x23cc62;return _0x49bb20;})[_0x581d('0x29')](respondWithFilteredResult(_0x4aac15,_0x5b3801))[_0x581d('0x4c')](handleError(_0x4aac15,null));};exports[_0x581d('0x4d')]=function(_0x3bb2c6,_0x3f60f8){var _0x5c085c={'raw':![],'where':{'id':_0x3bb2c6[_0x581d('0x4e')]['id']}},_0x1d7a22={};_0x1d7a22['model']=_[_0x581d('0x3c')](db[_0x581d('0x34')]['rawAttributes']);_0x1d7a22[_0x581d('0x3b')]=_[_0x581d('0x3c')](_0x3bb2c6[_0x581d('0x3b')]);_0x1d7a22[_0x581d('0x3d')]=_[_0x581d('0x3e')](_0x1d7a22[_0x581d('0x39')],_0x1d7a22[_0x581d('0x3b')]);_0x5c085c[_0x581d('0x41')]=_['intersection'](_0x1d7a22[_0x581d('0x39')],qs[_0x581d('0x3f')](_0x3bb2c6['query'][_0x581d('0x3f')]));_0x5c085c['attributes']=_0x5c085c['attributes'][_0x581d('0x40')]?_0x5c085c[_0x581d('0x41')]:_0x1d7a22[_0x581d('0x39')];if(_0x3bb2c6['query'][_0x581d('0x4f')]){_0x5c085c[_0x581d('0x4a')]=[{'all':!![]}];}_0x5c085c=_[_0x581d('0x48')]({},_0x5c085c,_0x3bb2c6[_0x581d('0x50')]);return db['SquareProject'][_0x581d('0x51')](_0x5c085c)['then'](handleEntityNotFound(_0x3f60f8,null))[_0x581d('0x29')](respondWithResult(_0x3f60f8,null))[_0x581d('0x4c')](handleError(_0x3f60f8,null));};exports[_0x581d('0x52')]=function(_0x341cb8,_0x2df36d){return db[_0x581d('0x34')]['create'](_0x341cb8[_0x581d('0x53')],{})['then'](function(_0x3c9adb){var _0x7c24f1=_0x341cb8['user'][_0x581d('0x2a')]({'plain':!![]});if(!_0x7c24f1)throw new Error(_0x581d('0x54'));if(_0x7c24f1['role']===_0x581d('0x55')){var _0xfc46ed=_0x3c9adb[_0x581d('0x2a')]({'plain':!![]});var _0x2189ab=_0x581d('0x2b');return db[_0x581d('0x56')]['find']({'where':{'name':_0x2189ab,'userProfileId':_0x7c24f1[_0x581d('0x57')]},'raw':!![]})[_0x581d('0x29')](function(_0x4a2f07){if(_0x4a2f07&&_0x4a2f07[_0x581d('0x58')]===0x0){return db[_0x581d('0x2c')][_0x581d('0x52')]({'name':_0xfc46ed['name'],'resourceId':_0xfc46ed['id'],'type':_0x4a2f07[_0x581d('0x31')],'sectionId':_0x4a2f07['id']},{})[_0x581d('0x29')](function(){return _0x3c9adb;});}else{return _0x3c9adb;}})[_0x581d('0x4c')](function(_0x25b56c){logger[_0x581d('0x2f')](_0x581d('0x59'),_0x25b56c);throw _0x25b56c;});}return _0x3c9adb;})[_0x581d('0x29')](respondWithResult(_0x2df36d,0xc9))['catch'](handleError(_0x2df36d,null));};exports['update']=function(_0x52db23,_0x56ca02){if(_0x52db23[_0x581d('0x53')]['id']){delete _0x52db23[_0x581d('0x53')]['id'];}return db['SquareProject'][_0x581d('0x51')]({'where':{'id':_0x52db23['params']['id']}})[_0x581d('0x29')](handleEntityNotFound(_0x56ca02,null))[_0x581d('0x29')](saveUpdates(_0x52db23[_0x581d('0x53')],null))[_0x581d('0x29')](respondWithResult(_0x56ca02,null))[_0x581d('0x4c')](handleError(_0x56ca02,null));};exports[_0x581d('0x2d')]=function(_0x1b96e4,_0x446246){return db['SquareProject']['find']({'where':{'id':_0x1b96e4[_0x581d('0x4e')]['id']}})[_0x581d('0x29')](handleEntityNotFound(_0x446246,null))[_0x581d('0x29')](removeEntity(_0x446246,null))[_0x581d('0x4c')](handleError(_0x446246,null));};exports[_0x581d('0x5a')]=function(_0x160d67,_0x25972f,_0x5a4ec9){return db[_0x581d('0x34')]['find']({'where':{'id':_0x160d67[_0x581d('0x4e')]['id']}})[_0x581d('0x29')](handleEntityNotFound(_0x25972f,null))['then'](function(_0x5a71c0){if(_0x5a71c0){return _0x5a71c0['addUsers'](_0x160d67[_0x581d('0x53')][_0x581d('0x5b')],_[_0x581d('0x5c')](_0x160d67['body'],[_0x581d('0x5b'),'id'])||{});}})[_0x581d('0x29')](respondWithResult(_0x25972f,null))[_0x581d('0x4c')](handleError(_0x25972f,null));};exports[_0x581d('0x5d')]=function(_0x565279,_0xcb69ff,_0x3de913){return db[_0x581d('0x34')]['find']({'where':{'id':_0x565279[_0x581d('0x4e')]['id']}})[_0x581d('0x29')](handleEntityNotFound(_0xcb69ff,null))['then'](function(_0xda9a48){if(_0xda9a48){return _0xda9a48[_0x581d('0x5d')](_0x565279[_0x581d('0x3b')]['ids'])[_0x581d('0x29')](function(){if(_[_0x581d('0x5e')](_0x565279['query'][_0x581d('0x5b')])){for(var _0x5e4dc2=0x0;_0x5e4dc2<_0x565279[_0x581d('0x3b')][_0x581d('0x5b')][_0x581d('0x40')];_0x5e4dc2+=0x1){socket[_0x581d('0x5f')](_0x581d('0x60'),{'UserId':Number(_0x565279[_0x581d('0x3b')]['ids'][_0x5e4dc2]),'SquareProjectId':Number(_0x565279[_0x581d('0x4e')]['id'])});}}else{socket[_0x581d('0x5f')](_0x581d('0x60'),{'UserId':Number(_0x565279[_0x581d('0x3b')][_0x581d('0x5b')]),'SquareProjectId':Number(_0x565279['params']['id'])});}});}})[_0x581d('0x29')](respondWithStatusCode(_0xcb69ff,null))[_0x581d('0x4c')](handleError(_0xcb69ff,null));};exports['getUsers']=function(_0x5041ca,_0x129244,_0x73cc26){var _0x10c991={};var _0x3f7210={};var _0x1040ab;var _0x4f03d2;return db['SquareProject'][_0x581d('0x61')]({'where':{'id':_0x5041ca[_0x581d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x129244,null))[_0x581d('0x29')](function(_0x723743){if(_0x723743){_0x1040ab=_0x723743;_0x3f7210[_0x581d('0x39')]=_[_0x581d('0x3c')](db[_0x581d('0x62')][_0x581d('0x35')]);_0x3f7210['query']=_[_0x581d('0x3c')](_0x5041ca['query']);_0x3f7210[_0x581d('0x3d')]=_[_0x581d('0x3e')](_0x3f7210[_0x581d('0x39')],_0x3f7210['query']);_0x10c991[_0x581d('0x41')]=_['intersection'](_0x3f7210[_0x581d('0x39')],qs[_0x581d('0x3f')](_0x5041ca[_0x581d('0x3b')][_0x581d('0x3f')]));_0x10c991[_0x581d('0x41')]=_0x10c991['attributes'][_0x581d('0x40')]?_0x10c991[_0x581d('0x41')]:_0x3f7210[_0x581d('0x39')];_0x10c991['order']=qs[_0x581d('0x44')](_0x5041ca['query'][_0x581d('0x44')]);_0x10c991['where']=qs[_0x581d('0x3d')](_[_0x581d('0x45')](_0x5041ca[_0x581d('0x3b')],_0x3f7210[_0x581d('0x3d')]));if(_0x5041ca[_0x581d('0x3b')]['filter']){_0x10c991[_0x581d('0x47')]=_[_0x581d('0x48')](_0x10c991[_0x581d('0x47')],{'$or':_['map'](_0x10c991['attributes'],function(_0x31ba0e){var _0x45372c={};_0x45372c[_0x31ba0e]={'$like':'%'+_0x5041ca[_0x581d('0x3b')][_0x581d('0x46')]+'%'};return _0x45372c;})});}_0x10c991=_['merge']({},_0x10c991,_0x5041ca[_0x581d('0x50')]);return _0x1040ab['getUsers'](_0x10c991);}})['then'](function(_0x2f66a0){if(_0x2f66a0){_0x4f03d2=_0x2f66a0[_0x581d('0x40')];if(!_0x5041ca[_0x581d('0x3b')][_0x581d('0x42')](_0x581d('0x63'))){_0x10c991[_0x581d('0x21')]=qs['limit'](_0x5041ca[_0x581d('0x3b')][_0x581d('0x21')]);_0x10c991[_0x581d('0x1f')]=qs[_0x581d('0x1f')](_0x5041ca[_0x581d('0x3b')][_0x581d('0x1f')]);}return _0x1040ab[_0x581d('0x64')](_0x10c991);}})[_0x581d('0x29')](function(_0x468fc0){if(_0x468fc0){return _0x468fc0?{'count':_0x4f03d2,'rows':_0x468fc0}:null;}})[_0x581d('0x29')](respondWithResult(_0x129244,null))['catch'](handleError(_0x129244,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 8a60359..b669515 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 _0x7c4d=['emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners','update'];(function(_0x2a61b9,_0x967962){var _0x276ba4=function(_0x21da40){while(--_0x21da40){_0x2a61b9['push'](_0x2a61b9['shift']());}};_0x276ba4(++_0x967962);}(_0x7c4d,0x1cc));var _0xd7c4=function(_0x264806,_0x283c90){_0x264806=_0x264806-0x0;var _0x49e4d3=_0x7c4d[_0x264806];return _0x49e4d3;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xd7c4('0x0'))['db'][_0xd7c4('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd7c4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd7c4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2ada11){return function(_0x2a1a72,_0x4d05c2,_0x31b6df){SquareProjectEvents[_0xd7c4('0x4')](_0x2ada11+':'+_0x2a1a72['id'],_0x2a1a72);SquareProjectEvents['emit'](_0x2ada11,_0x2a1a72);_0x31b6df(null);};}for(var e in events){if(events[_0xd7c4('0x5')](e)){var event=events[e];SquareProject[_0xd7c4('0x6')](e,emitEvent(event));}}module[_0xd7c4('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x3008=['exports','events','save','update','remove','hasOwnProperty','hook'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x3008,0xc5));var _0x8300=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0x3008[_0x34bd34];return _0x4e36d6;};'use strict';var EventEmitter=require(_0x8300('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8300('0x1'),'afterUpdate':_0x8300('0x2'),'afterDestroy':_0x8300('0x3')};function emitEvent(_0x37eaac){return function(_0x178448,_0x180af9,_0x2755db){SquareProjectEvents['emit'](_0x37eaac+':'+_0x178448['id'],_0x178448);SquareProjectEvents['emit'](_0x37eaac,_0x178448);_0x2755db(null);};}for(var e in events){if(events[_0x8300('0x4')](e)){var event=events[e];SquareProject[_0x8300('0x5')](e,emitEvent(event));}}module[_0x8300('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 5de3f87..98b2433 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 _0xfe2a=['bluebird','request-promise','path','../../config/environment','./squareProject.attributes','exports','define','SquareProject','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x2368a5,_0x403455){var _0x3f7108=function(_0x20f88f){while(--_0x20f88f){_0x2368a5['push'](_0x2368a5['shift']());}};_0x3f7108(++_0x403455);}(_0xfe2a,0xd8));var _0xafe2=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xfe2a[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0xafe2('0x0'));var util=require(_0xafe2('0x1'));var logger=require(_0xafe2('0x2'))(_0xafe2('0x3'));var moment=require(_0xafe2('0x4'));var BPromise=require(_0xafe2('0x5'));var rp=require(_0xafe2('0x6'));var fs=require('fs');var path=require(_0xafe2('0x7'));var rimraf=require('rimraf');var config=require(_0xafe2('0x8'));var attributes=require(_0xafe2('0x9'));module[_0xafe2('0xa')]=function(_0x4ca601,_0x10af62){return _0x4ca601[_0xafe2('0xb')](_0xafe2('0xc'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4f3be5,_0x2fb57b,_0x591225){if(_0x4f3be5[_0xafe2('0xd')]('preproduction')){_0x4f3be5[_0xafe2('0xe')]=moment()[_0xafe2('0xf')](_0xafe2('0x10'));}if(_0x4f3be5[_0xafe2('0xd')]('production')){_0x4f3be5['publishedAt']=moment()[_0xafe2('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x591225(null,_0x4f3be5);}}});}; \ No newline at end of file +var _0x96d7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash'];(function(_0x149768,_0x1efa83){var _0x41644f=function(_0x1a64f6){while(--_0x1a64f6){_0x149768['push'](_0x149768['shift']());}};_0x41644f(++_0x1efa83);}(_0x96d7,0x1d3));var _0x796d=function(_0x432de8,_0x50bd8b){_0x432de8=_0x432de8-0x0;var _0x1a2076=_0x96d7[_0x432de8];return _0x1a2076;};'use strict';var _=require(_0x796d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x796d('0x1'));var moment=require(_0x796d('0x2'));var BPromise=require(_0x796d('0x3'));var rp=require(_0x796d('0x4'));var fs=require('fs');var path=require(_0x796d('0x5'));var rimraf=require(_0x796d('0x6'));var config=require(_0x796d('0x7'));var attributes=require(_0x796d('0x8'));module[_0x796d('0x9')]=function(_0x52903a,_0x417039){return _0x52903a[_0x796d('0xa')]('SquareProject',attributes,{'tableName':_0x796d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3e387a,_0x451ef1,_0x2ea735){if(_0x3e387a[_0x796d('0xc')]('preproduction')){_0x3e387a[_0x796d('0xd')]=moment()[_0x796d('0xe')](_0x796d('0xf'));}if(_0x3e387a['changed'](_0x796d('0x10'))){_0x3e387a[_0x796d('0x11')]=moment()['format'](_0x796d('0xf'));}_0x2ea735(null,_0x3e387a);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 7be9166..ef8b6f7 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 _0x430b=['result','catch','SquareProject','options','raw','where','attributes','include','model','map','ShowSquareProject','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x504acd,_0xacd5e1){var _0x457e43=function(_0x18922a){while(--_0x18922a){_0x504acd['push'](_0x504acd['shift']());}};_0x457e43(++_0xacd5e1);}(_0x430b,0x1c8));var _0xb430=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x430b[_0x2f2360];return _0x1cc8d3;};'use strict';var _=require(_0xb430('0x0'));var util=require(_0xb430('0x1'));var moment=require(_0xb430('0x2'));var BPromise=require(_0xb430('0x3'));var rs=require(_0xb430('0x4'));var fs=require('fs');var Redis=require(_0xb430('0x5'));var db=require(_0xb430('0x6'))['db'];var utils=require(_0xb430('0x7'));var logger=require(_0xb430('0x8'))(_0xb430('0x9'));var config=require(_0xb430('0xa'));var jayson=require(_0xb430('0xb'));var client=jayson[_0xb430('0xc')]['http']({'port':0x232a});config[_0xb430('0xd')]=_[_0xb430('0xe')](config['redis'],{'host':_0xb430('0xf'),'port':0x18eb});var socket=require(_0xb430('0x10'))(new Redis(config[_0xb430('0xd')]));require('./squareProject.socket')[_0xb430('0x11')](socket);function respondWithRpcPromise(_0x5ae7a0,_0x583237,_0x481e04){return new BPromise(function(_0x399d98,_0x3f68c7){return client['request'](_0x5ae7a0,_0x481e04)[_0xb430('0x12')](function(_0x92e3cc){logger[_0xb430('0x13')](_0xb430('0x14'),_0x583237,_0xb430('0x15'));logger['debug']('SquareProject,\x20%s,\x20%s,\x20%s',_0x583237,'request\x20sent',JSON['stringify'](_0x92e3cc));if(_0x92e3cc[_0xb430('0x16')]){if(_0x92e3cc['error'][_0xb430('0x17')]===0x1f4){logger[_0xb430('0x16')](_0xb430('0x14'),_0x583237,_0x92e3cc[_0xb430('0x16')]['message']);return _0x3f68c7(_0x92e3cc[_0xb430('0x16')][_0xb430('0x18')]);}logger[_0xb430('0x16')](_0xb430('0x14'),_0x583237,_0x92e3cc['error'][_0xb430('0x18')]);return _0x399d98(_0x92e3cc[_0xb430('0x16')][_0xb430('0x18')]);}else{logger[_0xb430('0x13')](_0xb430('0x14'),_0x583237,_0xb430('0x15'));_0x399d98(_0x92e3cc[_0xb430('0x19')][_0xb430('0x18')]);}})[_0xb430('0x1a')](function(_0x20290e){logger[_0xb430('0x16')](_0xb430('0x14'),_0x583237,_0x20290e);_0x3f68c7(_0x20290e);});});}exports['ShowSquareProject']=function(_0x993596){var _0x50f67d=this;return new Promise(function(_0x33763a,_0x17c48d){return db[_0xb430('0x1b')]['find']({'raw':_0x993596[_0xb430('0x1c')]?_0x993596[_0xb430('0x1c')][_0xb430('0x1d')]===undefined?!![]:![]:!![],'where':_0x993596[_0xb430('0x1c')]?_0x993596[_0xb430('0x1c')][_0xb430('0x1e')]||null:null,'attributes':_0x993596[_0xb430('0x1c')]?_0x993596[_0xb430('0x1c')][_0xb430('0x1f')]||null:null,'include':_0x993596['options']?_0x993596[_0xb430('0x1c')][_0xb430('0x20')]?_['map'](_0x993596[_0xb430('0x1c')][_0xb430('0x20')],function(_0x125d8d){return{'model':db[_0x125d8d[_0xb430('0x21')]],'as':_0x125d8d['as'],'attributes':_0x125d8d[_0xb430('0x1f')],'include':_0x125d8d[_0xb430('0x20')]?_[_0xb430('0x22')](_0x125d8d[_0xb430('0x20')],function(_0x2872ee){return{'model':db[_0x2872ee['model']],'as':_0x2872ee['as'],'attributes':_0x2872ee[_0xb430('0x1f')],'include':_0x2872ee[_0xb430('0x20')]?_[_0xb430('0x22')](_0x2872ee[_0xb430('0x20')],function(_0x2e00b7){return{'model':db[_0x2e00b7[_0xb430('0x21')]],'as':_0x2e00b7['as'],'attributes':_0x2e00b7['attributes']};}):[]};}):[]};}):[]:[]})[_0xb430('0x12')](function(_0x5b60d3){logger[_0xb430('0x13')](_0xb430('0x23'),_0x993596);logger['debug'](_0xb430('0x23'),_0x993596,JSON[_0xb430('0x24')](_0x5b60d3));_0x33763a(_0x5b60d3);})[_0xb430('0x1a')](function(_0x3cbe39){logger[_0xb430('0x16')](_0xb430('0x23'),_0x3cbe39['message'],_0x993596);_0x17c48d(_0x50f67d[_0xb430('0x16')](0x1f4,_0x3cbe39[_0xb430('0x18')]));});});}; \ No newline at end of file +var _0xb428=['options','attributes','include','map','model','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','ShowSquareProject','find'];(function(_0x376048,_0x4b08f2){var _0x5a4a3e=function(_0x1bcc71){while(--_0x1bcc71){_0x376048['push'](_0x376048['shift']());}};_0x5a4a3e(++_0x4b08f2);}(_0xb428,0x12f));var _0x8b42=function(_0x13cd20,_0x1d9211){_0x13cd20=_0x13cd20-0x0;var _0x22b6de=_0xb428[_0x13cd20];return _0x22b6de;};'use strict';var _=require(_0x8b42('0x0'));var util=require('util');var moment=require(_0x8b42('0x1'));var BPromise=require('bluebird');var rs=require(_0x8b42('0x2'));var fs=require('fs');var Redis=require(_0x8b42('0x3'));var db=require(_0x8b42('0x4'))['db'];var utils=require(_0x8b42('0x5'));var logger=require(_0x8b42('0x6'))(_0x8b42('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8b42('0x8')][_0x8b42('0x9')]({'port':0x232a});config[_0x8b42('0xa')]=_['defaults'](config[_0x8b42('0xa')],{'host':_0x8b42('0xb'),'port':0x18eb});var socket=require(_0x8b42('0xc'))(new Redis(config['redis']));require('./squareProject.socket')['register'](socket);function respondWithRpcPromise(_0x538b09,_0x1f2993,_0x41229e){return new BPromise(function(_0x1bce3d,_0x36efe5){return client[_0x8b42('0xd')](_0x538b09,_0x41229e)[_0x8b42('0xe')](function(_0x1f3504){logger['info'](_0x8b42('0xf'),_0x1f2993,_0x8b42('0x10'));logger[_0x8b42('0x11')](_0x8b42('0x12'),_0x1f2993,_0x8b42('0x10'),JSON['stringify'](_0x1f3504));if(_0x1f3504[_0x8b42('0x13')]){if(_0x1f3504['error'][_0x8b42('0x14')]===0x1f4){logger['error'](_0x8b42('0xf'),_0x1f2993,_0x1f3504[_0x8b42('0x13')]['message']);return _0x36efe5(_0x1f3504[_0x8b42('0x13')][_0x8b42('0x15')]);}logger[_0x8b42('0x13')]('SquareProject,\x20%s,\x20%s',_0x1f2993,_0x1f3504[_0x8b42('0x13')][_0x8b42('0x15')]);return _0x1bce3d(_0x1f3504['error'][_0x8b42('0x15')]);}else{logger[_0x8b42('0x16')](_0x8b42('0xf'),_0x1f2993,_0x8b42('0x10'));_0x1bce3d(_0x1f3504[_0x8b42('0x17')][_0x8b42('0x15')]);}})[_0x8b42('0x18')](function(_0x3e42bc){logger['error'](_0x8b42('0xf'),_0x1f2993,_0x3e42bc);_0x36efe5(_0x3e42bc);});});}exports[_0x8b42('0x19')]=function(_0x36d5f0){var _0x2f9e5f=this;return new Promise(function(_0x340725,_0x5dad09){return db['SquareProject'][_0x8b42('0x1a')]({'raw':_0x36d5f0[_0x8b42('0x1b')]?_0x36d5f0[_0x8b42('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x36d5f0[_0x8b42('0x1b')]?_0x36d5f0[_0x8b42('0x1b')]['where']||null:null,'attributes':_0x36d5f0[_0x8b42('0x1b')]?_0x36d5f0[_0x8b42('0x1b')][_0x8b42('0x1c')]||null:null,'include':_0x36d5f0[_0x8b42('0x1b')]?_0x36d5f0[_0x8b42('0x1b')][_0x8b42('0x1d')]?_[_0x8b42('0x1e')](_0x36d5f0[_0x8b42('0x1b')]['include'],function(_0x463332){return{'model':db[_0x463332['model']],'as':_0x463332['as'],'attributes':_0x463332[_0x8b42('0x1c')],'include':_0x463332[_0x8b42('0x1d')]?_[_0x8b42('0x1e')](_0x463332[_0x8b42('0x1d')],function(_0x31c144){return{'model':db[_0x31c144[_0x8b42('0x1f')]],'as':_0x31c144['as'],'attributes':_0x31c144['attributes'],'include':_0x31c144[_0x8b42('0x1d')]?_[_0x8b42('0x1e')](_0x31c144['include'],function(_0x9ffd4f){return{'model':db[_0x9ffd4f['model']],'as':_0x9ffd4f['as'],'attributes':_0x9ffd4f[_0x8b42('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8b42('0xe')](function(_0x29b573){logger[_0x8b42('0x16')](_0x8b42('0x19'),_0x36d5f0);logger[_0x8b42('0x11')](_0x8b42('0x19'),_0x36d5f0,JSON[_0x8b42('0x20')](_0x29b573));_0x340725(_0x29b573);})[_0x8b42('0x18')](function(_0x5f316c){logger[_0x8b42('0x13')](_0x8b42('0x19'),_0x5f316c[_0x8b42('0x15')],_0x36d5f0);_0x5dad09(_0x2f9e5f['error'](0x1f4,_0x5f316c[_0x8b42('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 4c9daa3..0c89a7b 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 _0xae83=['squareProject:','./squareProject.events','save','update','emit','removeListener','register','length'];(function(_0x1aed69,_0x50c351){var _0x276f86=function(_0x147126){while(--_0x147126){_0x1aed69['push'](_0x1aed69['shift']());}};_0x276f86(++_0x50c351);}(_0xae83,0xc9));var _0x3ae8=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xae83[_0x8c43de];return _0xa6591b;};'use strict';var SquareProjectEvents=require(_0x3ae8('0x0'));var events=[_0x3ae8('0x1'),'remove',_0x3ae8('0x2')];function createListener(_0x252af7,_0x1a36cb){return function(_0x4673b0){_0x1a36cb[_0x3ae8('0x3')](_0x252af7,_0x4673b0);};}function removeListener(_0x20d8f3,_0x3b3b53){return function(){SquareProjectEvents[_0x3ae8('0x4')](_0x20d8f3,_0x3b3b53);};}exports[_0x3ae8('0x5')]=function(_0xdff255){for(var _0x11c5e3=0x0,_0x10e958=events[_0x3ae8('0x6')];_0x11c5e3<_0x10e958;_0x11c5e3++){var _0x343939=events[_0x11c5e3];var _0xdddc53=createListener(_0x3ae8('0x7')+_0x343939,_0xdff255);SquareProjectEvents['on'](_0x343939,_0xdddc53);}}; \ No newline at end of file +var _0x9e27=['register','length','squareProject:','./squareProject.events','save','remove','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e27,0x174));var _0x79e2=function(_0x384c1f,_0x45f29d){_0x384c1f=_0x384c1f-0x0;var _0x330577=_0x9e27[_0x384c1f];return _0x330577;};'use strict';var SquareProjectEvents=require(_0x79e2('0x0'));var events=[_0x79e2('0x1'),_0x79e2('0x2'),_0x79e2('0x3')];function createListener(_0x355d9c,_0x36f967){return function(_0x2fa28b){_0x36f967[_0x79e2('0x4')](_0x355d9c,_0x2fa28b);};}function removeListener(_0x3ab19e,_0x48433f){return function(){SquareProjectEvents[_0x79e2('0x5')](_0x3ab19e,_0x48433f);};}exports[_0x79e2('0x6')]=function(_0x56ba0e){for(var _0x3633e6=0x0,_0x409b0a=events[_0x79e2('0x7')];_0x3633e6<_0x409b0a;_0x3633e6++){var _0x559b5f=events[_0x3633e6];var _0x46ce3e=createListener(_0x79e2('0x8')+_0x559b5f,_0x56ba0e);SquareProjectEvents['on'](_0x559b5f,_0x46ce3e);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 37f66d3..66b6062 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 _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x4f7ba8,_0x4a6dbe){var _0xa0df7c=function(_0x137ad8){while(--_0x137ad8){_0x4f7ba8['push'](_0x4f7ba8['shift']());}};_0xa0df7c(++_0x4a6dbe);}(_0xabce,0x103));var _0xeabc=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xabce[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x5ee117,_0x3d9135){var _0x2a11c5=function(_0xd9282f){while(--_0xd9282f){_0x5ee117['push'](_0x5ee117['shift']());}};_0x2a11c5(++_0x3d9135);}(_0x5fab,0x177));var _0xb5fa=function(_0x3c25d7,_0x50ebd0){_0x3c25d7=_0x3c25d7-0x0;var _0xd8d3a6=_0x5fab[_0x3c25d7];return _0xd8d3a6;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 258f0f8..6a1746d 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 _0x46ed=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x20be7e,_0x56db99){var _0x43728c=function(_0x43d386){while(--_0x43d386){_0x20be7e['push'](_0x20be7e['shift']());}};_0x43728c(++_0x56db99);}(_0x46ed,0x168));var _0xd46e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x46ed[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd46e('0x2')]},'calleridname':{'type':Sequelize[_0xd46e('0x2')]},'context':{'type':Sequelize[_0xd46e('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd46e('0x2')]},'accountcode':{'type':Sequelize[_0xd46e('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xd46e('0x2')]},'saveName':{'type':Sequelize[_0xd46e('0x2')]},'filename':{'type':Sequelize[_0xd46e('0x2')]},'savePath':{'type':Sequelize[_0xd46e('0x2')]},'format':{'type':Sequelize[_0xd46e('0x3')],'get':function(){var _0x855f24='';var _0x437ea0=this[_0xd46e('0x4')](_0xd46e('0x5'));if(_0x437ea0){_0x855f24=_0x437ea0[_0xd46e('0x6')](_0x437ea0[_0xd46e('0x7')]('.'));}return _0x855f24;}}}; \ No newline at end of file +var _0xa630=['substring','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa630,0xbe));var _0x0a63=function(_0x6390c2,_0x7fe5da){_0x6390c2=_0x6390c2-0x0;var _0x511a1b=_0xa630[_0x6390c2];return _0x511a1b;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0a63('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x0a63('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0a63('0x2')]},'dnid':{'type':Sequelize[_0x0a63('0x2')]},'projectName':{'type':Sequelize[_0x0a63('0x2')]},'saveName':{'type':Sequelize[_0x0a63('0x2')]},'filename':{'type':Sequelize[_0x0a63('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x0a63('0x3')],'get':function(){var _0x3d5f0b='';var _0xc2dcd7=this[_0x0a63('0x4')](_0x0a63('0x5'));if(_0xc2dcd7){_0x3d5f0b=_0xc2dcd7[_0x0a63('0x6')](_0xc2dcd7['lastIndexOf']('.'));}return _0x3d5f0b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 6814347..5c47a8d 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 _0xeb78=['.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','update','then','destroy','error','name','send','map','SquareRecording','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','create','body','find','download','../../components/encryptor','uniqueid','%s.cypher','existsSync','decryptFile','recording','savePath','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync'];(function(_0x4468e4,_0x5a31c2){var _0xd1b2bc=function(_0x732db1){while(--_0x732db1){_0x4468e4['push'](_0x4468e4['shift']());}};_0xd1b2bc(++_0x5a31c2);}(_0xeb78,0xc5));var _0x8eb7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeb78[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x8eb7('0x0'));var rimraf=require(_0x8eb7('0x1'));var zipdir=require(_0x8eb7('0x2'));var jsonpatch=require(_0x8eb7('0x3'));var rp=require(_0x8eb7('0x4'));var moment=require(_0x8eb7('0x5'));var BPromise=require(_0x8eb7('0x6'));var Mustache=require(_0x8eb7('0x7'));var util=require(_0x8eb7('0x8'));var path=require(_0x8eb7('0x9'));var sox=require('sox');var csv=require(_0x8eb7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8eb7('0xb'));var _=require('lodash');var squel=require(_0x8eb7('0xc'));var crypto=require(_0x8eb7('0xd'));var jsforce=require(_0x8eb7('0xe'));var deskjs=require(_0x8eb7('0xf'));var toCsv=require(_0x8eb7('0xa'));var querystring=require(_0x8eb7('0x10'));var Papa=require(_0x8eb7('0x11'));var Redis=require(_0x8eb7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8eb7('0x13'));var as=require(_0x8eb7('0x14'));var hardwareService=require(_0x8eb7('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x8eb7('0x16'));var config=require(_0x8eb7('0x17'));var licenseUtil=require(_0x8eb7('0x18'));var db=require(_0x8eb7('0x19'))['db'];function respondWithStatusCode(_0x5b6df9,_0x4c380c){_0x4c380c=_0x4c380c||0xcc;return function(_0x7d97ff){if(_0x7d97ff){return _0x5b6df9[_0x8eb7('0x1a')](_0x4c380c);}return _0x5b6df9[_0x8eb7('0x1b')](_0x4c380c)[_0x8eb7('0x1c')]();};}function respondWithResult(_0xa73a77,_0x3c88d5){_0x3c88d5=_0x3c88d5||0xc8;return function(_0x4c6b47){if(_0x4c6b47){return _0xa73a77['status'](_0x3c88d5)[_0x8eb7('0x1d')](_0x4c6b47);}};}function respondWithFilteredResult(_0x5b0fd2,_0x30f0e1){return function(_0x36bc82){if(_0x36bc82){var _0x41b5ff=typeof _0x30f0e1[_0x8eb7('0x1e')]===_0x8eb7('0x1f')&&typeof _0x30f0e1['limit']==='undefined';var _0x4c60c3=_0x36bc82[_0x8eb7('0x20')];var _0x38c1f2=_0x41b5ff?0x0:_0x30f0e1[_0x8eb7('0x1e')];var _0x54c9e0=_0x41b5ff?_0x36bc82[_0x8eb7('0x20')]:_0x30f0e1[_0x8eb7('0x1e')]+_0x30f0e1[_0x8eb7('0x21')];var _0x51902a;if(_0x54c9e0>=_0x4c60c3){_0x54c9e0=_0x4c60c3;_0x51902a=0xc8;}else{_0x51902a=0xce;}_0x5b0fd2[_0x8eb7('0x1b')](_0x51902a);return _0x5b0fd2[_0x8eb7('0x22')]('Content-Range',_0x38c1f2+'-'+_0x54c9e0+'/'+_0x4c60c3)[_0x8eb7('0x1d')](_0x36bc82);}return null;};}function patchUpdates(_0x3a927c){return function(_0x440045){try{jsonpatch[_0x8eb7('0x23')](_0x440045,_0x3a927c,!![]);}catch(_0x1cdfd0){return BPromise['reject'](_0x1cdfd0);}return _0x440045['save']();};}function saveUpdates(_0x286e63,_0x20d197){return function(_0x494ad5){if(_0x494ad5){return _0x494ad5[_0x8eb7('0x24')](_0x286e63)[_0x8eb7('0x25')](function(_0x32546f){return _0x32546f;});}return null;};}function removeEntity(_0x123d19,_0x365768){return function(_0x42f576){if(_0x42f576){return _0x42f576[_0x8eb7('0x26')]()['then'](function(){_0x123d19[_0x8eb7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe220eb,_0x116d60){return function(_0x18637b){if(!_0x18637b){_0xe220eb['sendStatus'](0x194);}return _0x18637b;};}function handleError(_0x2a5bb1,_0x103e5e){_0x103e5e=_0x103e5e||0x1f4;return function(_0x21bb10){logger[_0x8eb7('0x27')](_0x21bb10['stack']);if(_0x21bb10['name']){delete _0x21bb10[_0x8eb7('0x28')];}_0x2a5bb1['status'](_0x103e5e)[_0x8eb7('0x29')](_0x21bb10);};}exports['index']=function(_0x4020e1,_0x4b4bef){var _0x56f860={},_0x5e11f8={},_0x3a1936={'count':0x0,'rows':[]};var _0x5ac786=_[_0x8eb7('0x2a')](db[_0x8eb7('0x2b')]['rawAttributes'],function(_0x3ebfb4){return{'name':_0x3ebfb4[_0x8eb7('0x2c')],'type':_0x3ebfb4[_0x8eb7('0x2d')][_0x8eb7('0x2e')]};});_0x5e11f8['model']=_[_0x8eb7('0x2a')](_0x5ac786,_0x8eb7('0x28'));_0x5e11f8[_0x8eb7('0x2f')]=_[_0x8eb7('0x30')](_0x4020e1[_0x8eb7('0x2f')]);_0x5e11f8[_0x8eb7('0x31')]=_[_0x8eb7('0x32')](_0x5e11f8['model'],_0x5e11f8['query']);_0x56f860[_0x8eb7('0x33')]=_[_0x8eb7('0x32')](_0x5e11f8[_0x8eb7('0x34')],qs[_0x8eb7('0x35')](_0x4020e1[_0x8eb7('0x2f')][_0x8eb7('0x35')]));_0x56f860[_0x8eb7('0x33')]=_0x56f860[_0x8eb7('0x33')][_0x8eb7('0x36')]?_0x56f860[_0x8eb7('0x33')]:_0x5e11f8[_0x8eb7('0x34')];if(!_0x4020e1[_0x8eb7('0x2f')][_0x8eb7('0x37')](_0x8eb7('0x38'))){_0x56f860[_0x8eb7('0x21')]=qs[_0x8eb7('0x21')](_0x4020e1[_0x8eb7('0x2f')][_0x8eb7('0x21')]);_0x56f860[_0x8eb7('0x1e')]=qs['offset'](_0x4020e1['query'][_0x8eb7('0x1e')]);}_0x56f860[_0x8eb7('0x39')]=qs[_0x8eb7('0x3a')](_0x4020e1[_0x8eb7('0x2f')][_0x8eb7('0x3a')]);_0x56f860[_0x8eb7('0x3b')]=qs[_0x8eb7('0x31')](_[_0x8eb7('0x3c')](_0x4020e1[_0x8eb7('0x2f')],_0x5e11f8[_0x8eb7('0x31')]),_0x5ac786);if(_0x4020e1[_0x8eb7('0x2f')][_0x8eb7('0x3d')]){_0x56f860['where']=_[_0x8eb7('0x3e')](_0x56f860[_0x8eb7('0x3b')],{'$or':_[_0x8eb7('0x2a')](_0x5ac786,function(_0x41d7a8){if(_0x41d7a8[_0x8eb7('0x2d')]!==_0x8eb7('0x3f')){var _0x555c21={};_0x555c21[_0x41d7a8[_0x8eb7('0x28')]]={'$like':'%'+_0x4020e1['query']['filter']+'%'};return _0x555c21;}})});}_0x56f860=_[_0x8eb7('0x3e')]({},_0x56f860,_0x4020e1[_0x8eb7('0x40')]);var _0x432697={'where':_0x56f860[_0x8eb7('0x3b')]};return db[_0x8eb7('0x2b')][_0x8eb7('0x20')](_0x432697)['then'](function(_0x20ab2a){_0x3a1936[_0x8eb7('0x20')]=_0x20ab2a;if(_0x4020e1[_0x8eb7('0x2f')][_0x8eb7('0x41')]){_0x56f860['include']=[{'all':!![]}];}return db[_0x8eb7('0x2b')]['findAll'](_0x56f860);})[_0x8eb7('0x25')](function(_0x2e99c0){_0x3a1936[_0x8eb7('0x42')]=_0x2e99c0;return _0x3a1936;})['then'](respondWithFilteredResult(_0x4b4bef,_0x56f860))[_0x8eb7('0x43')](handleError(_0x4b4bef,null));};exports[_0x8eb7('0x44')]=function(_0x2a284e,_0x1cace7){var _0xe185cc={'raw':!![],'where':{'id':_0x2a284e[_0x8eb7('0x45')]['id']}},_0xa2be46={};_0xa2be46[_0x8eb7('0x34')]=_['keys'](db[_0x8eb7('0x2b')][_0x8eb7('0x46')]);_0xa2be46['query']=_['keys'](_0x2a284e[_0x8eb7('0x2f')]);_0xa2be46[_0x8eb7('0x31')]=_[_0x8eb7('0x32')](_0xa2be46['model'],_0xa2be46[_0x8eb7('0x2f')]);_0xe185cc[_0x8eb7('0x33')]=_[_0x8eb7('0x32')](_0xa2be46[_0x8eb7('0x34')],qs['fields'](_0x2a284e[_0x8eb7('0x2f')][_0x8eb7('0x35')]));_0xe185cc[_0x8eb7('0x33')]=_0xe185cc[_0x8eb7('0x33')][_0x8eb7('0x36')]?_0xe185cc['attributes']:_0xa2be46['model'];if(_0x2a284e[_0x8eb7('0x2f')][_0x8eb7('0x41')]){_0xe185cc['include']=[{'all':!![]}];}_0xe185cc=_[_0x8eb7('0x3e')]({},_0xe185cc,_0x2a284e[_0x8eb7('0x40')]);return db[_0x8eb7('0x2b')]['find'](_0xe185cc)['then'](handleEntityNotFound(_0x1cace7,null))[_0x8eb7('0x25')](respondWithResult(_0x1cace7,null))[_0x8eb7('0x43')](handleError(_0x1cace7,null));};exports[_0x8eb7('0x47')]=function(_0x532bb2,_0x1fcc0e){return db[_0x8eb7('0x2b')][_0x8eb7('0x47')](_0x532bb2[_0x8eb7('0x48')],{})[_0x8eb7('0x25')](respondWithResult(_0x1fcc0e,0xc9))['catch'](handleError(_0x1fcc0e,null));};exports['update']=function(_0x4deb82,_0x296d74){if(_0x4deb82[_0x8eb7('0x48')]['id']){delete _0x4deb82[_0x8eb7('0x48')]['id'];}return db[_0x8eb7('0x2b')][_0x8eb7('0x49')]({'where':{'id':_0x4deb82[_0x8eb7('0x45')]['id']}})[_0x8eb7('0x25')](handleEntityNotFound(_0x296d74,null))[_0x8eb7('0x25')](saveUpdates(_0x4deb82[_0x8eb7('0x48')],null))[_0x8eb7('0x25')](respondWithResult(_0x296d74,null))[_0x8eb7('0x43')](handleError(_0x296d74,null));};exports[_0x8eb7('0x4a')]=function(_0x3a73df,_0x62ec4d,_0xf1727){var _0x275ec1=require(_0x8eb7('0x4b'));var _0x505fc7=![];var _0x126c7e={};if(_0x3a73df['query']['type']&&_0x3a73df[_0x8eb7('0x2f')]['type']==='uniqueid'){_0x126c7e[_0x8eb7('0x4c')]=_0x3a73df['params']['id'];}else{_0x126c7e['id']=_0x3a73df[_0x8eb7('0x45')]['id'];}return db['SquareRecording'][_0x8eb7('0x49')]({'where':_0x126c7e,'attributes':['id','savePath','filename'],'raw':!![]})[_0x8eb7('0x25')](handleEntityNotFound(_0x62ec4d,null))[_0x8eb7('0x25')](function(_0x3f6996){if(_0x3f6996){var _0x24bed5=_0x3f6996['savePath'];var _0x1fddbd=util['format'](_0x8eb7('0x4d'),_0x24bed5);if(fs[_0x8eb7('0x4e')](_0x1fddbd)){_0x505fc7=!![];return _0x275ec1[_0x8eb7('0x4f')](_0x1fddbd,_0x24bed5,config['secrets'][_0x8eb7('0x50')])[_0x8eb7('0x25')](function(){return _0x3f6996;});}return _0x3f6996;}})[_0x8eb7('0x25')](function(_0x37e9e4){if(_0x37e9e4){var _0x38f421=_0x37e9e4[_0x8eb7('0x51')];if(!fs[_0x8eb7('0x4e')](_0x38f421)){throw new db[(_0x8eb7('0x52'))][(_0x8eb7('0x53'))](_0x8eb7('0x54'));}if(_0x37e9e4[_0x8eb7('0x55')]){return _0x62ec4d[_0x8eb7('0x4a')](_0x38f421,_0x37e9e4[_0x8eb7('0x55')]+path[_0x8eb7('0x56')](_0x38f421),function(){if(_0x505fc7){fs['unlink'](_0x38f421);}});}else{return _0x62ec4d[_0x8eb7('0x4a')](_0x38f421,function(_0x43c190){if(_0x505fc7){fs[_0x8eb7('0x57')](_0x38f421);}});}}})['catch'](function(_0x15db48){if(_0x15db48[_0x8eb7('0x58')]===_0x8eb7('0x54')){_0x62ec4d[_0x8eb7('0x1b')](0x194)[_0x8eb7('0x29')](_0x8eb7('0x59'));}else{return handleError(_0x62ec4d,null);}});};exports['destroy']=function(_0x1d6428,_0x3d3ad7){return db[_0x8eb7('0x2b')][_0x8eb7('0x49')]({'where':{'id':_0x1d6428[_0x8eb7('0x45')]['id']}})['then'](function(_0x42ad79){if(_['isNil'](_0x42ad79)){throw new ReferenceError(_0x8eb7('0x5a'));}return _0x42ad79;})[_0x8eb7('0x25')](function(_0x40d918){var _0x2de29a=_0x40d918[_0x8eb7('0x51')];logger[_0x8eb7('0x5b')](_0x8eb7('0x5c'),_0x2de29a);if(!_[_0x8eb7('0x5d')](_0x40d918['savePath'])&&fs['existsSync'](_0x2de29a)){logger['info'](_0x8eb7('0x5e')+_0x2de29a+_0x8eb7('0x5f'));fs[_0x8eb7('0x60')](_0x2de29a);}_0x2de29a=_0x2de29a+_0x8eb7('0x61');if(!_[_0x8eb7('0x5d')](_0x40d918[_0x8eb7('0x51')])&&fs[_0x8eb7('0x4e')](_0x2de29a)){logger[_0x8eb7('0x5b')](_0x8eb7('0x5e')+_0x2de29a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2de29a);}return _0x40d918;})['then'](function(_0x393c08){if(!_0x393c08)throw new InternalError();return _0x393c08[_0x8eb7('0x26')]();})[_0x8eb7('0x25')](function(){_0x3d3ad7[_0x8eb7('0x1b')](0xcc)[_0x8eb7('0x1c')]();})[_0x8eb7('0x43')](handleError(_0x3d3ad7,null));}; \ No newline at end of file +var _0x369a=['key','model','intersection','query','attributes','fields','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','rows','show','params','keys','length','includeAll','find','catch','create','body','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName'];(function(_0x213091,_0x1759e1){var _0x2f48e5=function(_0x2ea536){while(--_0x2ea536){_0x213091['push'](_0x213091['shift']());}};_0x2f48e5(++_0x1759e1);}(_0x369a,0xf8));var _0xa369=function(_0x9e4ec1,_0x54b428){_0x9e4ec1=_0x9e4ec1-0x0;var _0x2d1df4=_0x369a[_0x9e4ec1];return _0x2d1df4;};'use strict';var emlformat=require(_0xa369('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa369('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa369('0x2'));var moment=require(_0xa369('0x3'));var BPromise=require(_0xa369('0x4'));var Mustache=require(_0xa369('0x5'));var util=require(_0xa369('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa369('0x7'));var ejs=require(_0xa369('0x8'));var fs=require('fs');var fs_extra=require(_0xa369('0x9'));var _=require(_0xa369('0xa'));var squel=require('squel');var crypto=require(_0xa369('0xb'));var jsforce=require(_0xa369('0xc'));var deskjs=require(_0xa369('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa369('0xe'));var authService=require(_0xa369('0xf'));var qs=require(_0xa369('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa369('0x11'));var logger=require(_0xa369('0x12'))(_0xa369('0x13'));var utils=require('../../config/utils');var config=require(_0xa369('0x14'));var licenseUtil=require(_0xa369('0x15'));var db=require(_0xa369('0x16'))['db'];function respondWithStatusCode(_0x4ef0c1,_0x14eaf5){_0x14eaf5=_0x14eaf5||0xcc;return function(_0x5475e9){if(_0x5475e9){return _0x4ef0c1['sendStatus'](_0x14eaf5);}return _0x4ef0c1[_0xa369('0x17')](_0x14eaf5)[_0xa369('0x18')]();};}function respondWithResult(_0x3391bd,_0x389a4f){_0x389a4f=_0x389a4f||0xc8;return function(_0x4abcbb){if(_0x4abcbb){return _0x3391bd[_0xa369('0x17')](_0x389a4f)[_0xa369('0x19')](_0x4abcbb);}};}function respondWithFilteredResult(_0x9a5ed7,_0x1b107c){return function(_0x2014a4){if(_0x2014a4){var _0x4c3068=typeof _0x1b107c[_0xa369('0x1a')]===_0xa369('0x1b')&&typeof _0x1b107c[_0xa369('0x1c')]===_0xa369('0x1b');var _0x427d98=_0x2014a4[_0xa369('0x1d')];var _0x330f5d=_0x4c3068?0x0:_0x1b107c['offset'];var _0x416e91=_0x4c3068?_0x2014a4[_0xa369('0x1d')]:_0x1b107c[_0xa369('0x1a')]+_0x1b107c[_0xa369('0x1c')];var _0x2af66e;if(_0x416e91>=_0x427d98){_0x416e91=_0x427d98;_0x2af66e=0xc8;}else{_0x2af66e=0xce;}_0x9a5ed7['status'](_0x2af66e);return _0x9a5ed7['set'](_0xa369('0x1e'),_0x330f5d+'-'+_0x416e91+'/'+_0x427d98)[_0xa369('0x19')](_0x2014a4);}return null;};}function patchUpdates(_0x3ec97f){return function(_0x47210d){try{jsonpatch[_0xa369('0x1f')](_0x47210d,_0x3ec97f,!![]);}catch(_0x48dcf0){return BPromise[_0xa369('0x20')](_0x48dcf0);}return _0x47210d[_0xa369('0x21')]();};}function saveUpdates(_0x4d4086,_0x4380e0){return function(_0xc3a41a){if(_0xc3a41a){return _0xc3a41a[_0xa369('0x22')](_0x4d4086)['then'](function(_0x1b2d8d){return _0x1b2d8d;});}return null;};}function removeEntity(_0x398e08,_0x2e0d01){return function(_0x109945){if(_0x109945){return _0x109945[_0xa369('0x23')]()[_0xa369('0x24')](function(){_0x398e08['status'](0xcc)[_0xa369('0x18')]();});}};}function handleEntityNotFound(_0xe3916f,_0x1c2544){return function(_0x4a99cf){if(!_0x4a99cf){_0xe3916f['sendStatus'](0x194);}return _0x4a99cf;};}function handleError(_0x35f404,_0x59f96c){_0x59f96c=_0x59f96c||0x1f4;return function(_0x478e09){logger[_0xa369('0x25')](_0x478e09[_0xa369('0x26')]);if(_0x478e09[_0xa369('0x27')]){delete _0x478e09[_0xa369('0x27')];}_0x35f404['status'](_0x59f96c)[_0xa369('0x28')](_0x478e09);};}exports[_0xa369('0x29')]=function(_0x16ad8a,_0x154514){var _0x34cb75={},_0x668067={},_0x3585e2={'count':0x0,'rows':[]};var _0x58bf2c=_[_0xa369('0x2a')](db[_0xa369('0x2b')][_0xa369('0x2c')],function(_0x12ebde){return{'name':_0x12ebde[_0xa369('0x2d')],'type':_0x12ebde['type'][_0xa369('0x2e')]};});_0x668067[_0xa369('0x2f')]=_[_0xa369('0x2a')](_0x58bf2c,_0xa369('0x27'));_0x668067['query']=_['keys'](_0x16ad8a['query']);_0x668067['filters']=_[_0xa369('0x30')](_0x668067['model'],_0x668067[_0xa369('0x31')]);_0x34cb75[_0xa369('0x32')]=_['intersection'](_0x668067[_0xa369('0x2f')],qs['fields'](_0x16ad8a[_0xa369('0x31')][_0xa369('0x33')]));_0x34cb75[_0xa369('0x32')]=_0x34cb75['attributes']['length']?_0x34cb75[_0xa369('0x32')]:_0x668067[_0xa369('0x2f')];if(!_0x16ad8a[_0xa369('0x31')]['hasOwnProperty'](_0xa369('0x34'))){_0x34cb75[_0xa369('0x1c')]=qs['limit'](_0x16ad8a[_0xa369('0x31')][_0xa369('0x1c')]);_0x34cb75[_0xa369('0x1a')]=qs['offset'](_0x16ad8a[_0xa369('0x31')][_0xa369('0x1a')]);}_0x34cb75[_0xa369('0x35')]=qs[_0xa369('0x36')](_0x16ad8a['query']['sort']);_0x34cb75['where']=qs[_0xa369('0x37')](_[_0xa369('0x38')](_0x16ad8a[_0xa369('0x31')],_0x668067[_0xa369('0x37')]),_0x58bf2c);if(_0x16ad8a['query']['filter']){_0x34cb75[_0xa369('0x39')]=_[_0xa369('0x3a')](_0x34cb75['where'],{'$or':_[_0xa369('0x2a')](_0x58bf2c,function(_0x304d3b){if(_0x304d3b[_0xa369('0x3b')]!==_0xa369('0x3c')){var _0x250d39={};_0x250d39[_0x304d3b[_0xa369('0x27')]]={'$like':'%'+_0x16ad8a['query'][_0xa369('0x3d')]+'%'};return _0x250d39;}})});}_0x34cb75=_['merge']({},_0x34cb75,_0x16ad8a[_0xa369('0x3e')]);var _0x3d1ca8={'where':_0x34cb75[_0xa369('0x39')]};return db[_0xa369('0x2b')]['count'](_0x3d1ca8)['then'](function(_0x48d9ae){_0x3585e2['count']=_0x48d9ae;if(_0x16ad8a[_0xa369('0x31')]['includeAll']){_0x34cb75['include']=[{'all':!![]}];}return db[_0xa369('0x2b')]['findAll'](_0x34cb75);})[_0xa369('0x24')](function(_0x1cba6d){_0x3585e2[_0xa369('0x3f')]=_0x1cba6d;return _0x3585e2;})[_0xa369('0x24')](respondWithFilteredResult(_0x154514,_0x34cb75))['catch'](handleError(_0x154514,null));};exports[_0xa369('0x40')]=function(_0x4a52e3,_0x526dfa){var _0x12e9bd={'raw':!![],'where':{'id':_0x4a52e3[_0xa369('0x41')]['id']}},_0x59e740={};_0x59e740[_0xa369('0x2f')]=_[_0xa369('0x42')](db[_0xa369('0x2b')][_0xa369('0x2c')]);_0x59e740[_0xa369('0x31')]=_['keys'](_0x4a52e3[_0xa369('0x31')]);_0x59e740[_0xa369('0x37')]=_[_0xa369('0x30')](_0x59e740[_0xa369('0x2f')],_0x59e740[_0xa369('0x31')]);_0x12e9bd['attributes']=_[_0xa369('0x30')](_0x59e740[_0xa369('0x2f')],qs['fields'](_0x4a52e3[_0xa369('0x31')][_0xa369('0x33')]));_0x12e9bd[_0xa369('0x32')]=_0x12e9bd[_0xa369('0x32')][_0xa369('0x43')]?_0x12e9bd[_0xa369('0x32')]:_0x59e740[_0xa369('0x2f')];if(_0x4a52e3[_0xa369('0x31')][_0xa369('0x44')]){_0x12e9bd['include']=[{'all':!![]}];}_0x12e9bd=_['merge']({},_0x12e9bd,_0x4a52e3[_0xa369('0x3e')]);return db[_0xa369('0x2b')][_0xa369('0x45')](_0x12e9bd)[_0xa369('0x24')](handleEntityNotFound(_0x526dfa,null))[_0xa369('0x24')](respondWithResult(_0x526dfa,null))[_0xa369('0x46')](handleError(_0x526dfa,null));};exports[_0xa369('0x47')]=function(_0x3135b4,_0x5c497a){return db['SquareRecording'][_0xa369('0x47')](_0x3135b4[_0xa369('0x48')],{})[_0xa369('0x24')](respondWithResult(_0x5c497a,0xc9))[_0xa369('0x46')](handleError(_0x5c497a,null));};exports[_0xa369('0x22')]=function(_0xfd13c6,_0x1052f7){if(_0xfd13c6[_0xa369('0x48')]['id']){delete _0xfd13c6['body']['id'];}return db[_0xa369('0x2b')][_0xa369('0x45')]({'where':{'id':_0xfd13c6[_0xa369('0x41')]['id']}})['then'](handleEntityNotFound(_0x1052f7,null))[_0xa369('0x24')](saveUpdates(_0xfd13c6[_0xa369('0x48')],null))[_0xa369('0x24')](respondWithResult(_0x1052f7,null))[_0xa369('0x46')](handleError(_0x1052f7,null));};exports[_0xa369('0x49')]=function(_0x31ef19,_0x532b40,_0x125f4a){var _0x106e03=require(_0xa369('0x4a'));var _0x2752ee=![];var _0x2a2c07={};if(_0x31ef19['query'][_0xa369('0x3b')]&&_0x31ef19['query']['type']===_0xa369('0x4b')){_0x2a2c07[_0xa369('0x4b')]=_0x31ef19[_0xa369('0x41')]['id'];}else{_0x2a2c07['id']=_0x31ef19[_0xa369('0x41')]['id'];}return db['SquareRecording'][_0xa369('0x45')]({'where':_0x2a2c07,'attributes':['id',_0xa369('0x4c'),'filename'],'raw':!![]})[_0xa369('0x24')](handleEntityNotFound(_0x532b40,null))['then'](function(_0x930797){if(_0x930797){var _0xc59103=_0x930797[_0xa369('0x4c')];var _0x2595c8=util[_0xa369('0x4d')](_0xa369('0x4e'),_0xc59103);if(fs[_0xa369('0x4f')](_0x2595c8)){_0x2752ee=!![];return _0x106e03['decryptFile'](_0x2595c8,_0xc59103,config[_0xa369('0x50')][_0xa369('0x51')])['then'](function(){return _0x930797;});}return _0x930797;}})['then'](function(_0x39a326){if(_0x39a326){var _0x4bd56e=_0x39a326[_0xa369('0x4c')];if(!fs[_0xa369('0x4f')](_0x4bd56e)){throw new db[(_0xa369('0x52'))][(_0xa369('0x53'))](_0xa369('0x54'));}if(_0x39a326[_0xa369('0x55')]){return _0x532b40[_0xa369('0x49')](_0x4bd56e,_0x39a326[_0xa369('0x55')]+path[_0xa369('0x56')](_0x4bd56e),function(){if(_0x2752ee){fs[_0xa369('0x57')](_0x4bd56e);}});}else{return _0x532b40['download'](_0x4bd56e,function(_0x28a1a7){if(_0x2752ee){fs[_0xa369('0x57')](_0x4bd56e);}});}}})[_0xa369('0x46')](function(_0x458b69){if(_0x458b69[_0xa369('0x58')]===_0xa369('0x54')){_0x532b40[_0xa369('0x17')](0x194)[_0xa369('0x28')](_0xa369('0x59'));}else{return handleError(_0x532b40,null);}});};exports[_0xa369('0x23')]=function(_0x3afcce,_0x52ed49){return db[_0xa369('0x2b')][_0xa369('0x45')]({'where':{'id':_0x3afcce['params']['id']}})[_0xa369('0x24')](function(_0x11763f){if(_[_0xa369('0x5a')](_0x11763f)){throw new ReferenceError(_0xa369('0x5b'));}return _0x11763f;})[_0xa369('0x24')](function(_0x22784c){var _0x45f636=_0x22784c[_0xa369('0x4c')];logger[_0xa369('0x5c')](_0xa369('0x5d'),_0x45f636);if(!_[_0xa369('0x5a')](_0x22784c[_0xa369('0x4c')])&&fs[_0xa369('0x4f')](_0x45f636)){logger[_0xa369('0x5c')]('File:\x20\x22'+_0x45f636+_0xa369('0x5e'));fs[_0xa369('0x5f')](_0x45f636);}_0x45f636=_0x45f636+_0xa369('0x60');if(!_[_0xa369('0x5a')](_0x22784c[_0xa369('0x4c')])&&fs['existsSync'](_0x45f636)){logger[_0xa369('0x5c')](_0xa369('0x61')+_0x45f636+_0xa369('0x5e'));fs[_0xa369('0x5f')](_0x45f636);}return _0x22784c;})['then'](function(_0x35d087){if(!_0x35d087)throw new InternalError();return _0x35d087[_0xa369('0x23')]();})[_0xa369('0x24')](function(){_0x52ed49[_0xa369('0x17')](0xcc)['end']();})[_0xa369('0x46')](handleError(_0x52ed49,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index beb0cd2..b8a2696 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 _0x9b0d=['define','SquareRecording','square_recordings','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x289cdb,_0x59a4ef){var _0x2cdfac=function(_0x5c0d56){while(--_0x5c0d56){_0x289cdb['push'](_0x289cdb['shift']());}};_0x2cdfac(++_0x59a4ef);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x13fd9,_0x17e501){_0x13fd9=_0x13fd9-0x0;var _0x517b19=_0x9b0d[_0x13fd9];return _0x517b19;};'use strict';var _=require('lodash');var util=require(_0xd9b0('0x0'));var logger=require(_0xd9b0('0x1'))(_0xd9b0('0x2'));var moment=require(_0xd9b0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd9b0('0x4'));var fs=require('fs');var path=require(_0xd9b0('0x5'));var rimraf=require(_0xd9b0('0x6'));var config=require(_0xd9b0('0x7'));var attributes=require('./squareRecording.attributes');module[_0xd9b0('0x8')]=function(_0x21798d,_0x41dad9){return _0x21798d[_0xd9b0('0x9')](_0xd9b0('0xa'),attributes,{'tableName':_0xd9b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d0b=['rimraf','./squareRecording.attributes','define','SquareRecording','square_recordings','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5a4465,_0x17e503){var _0x399059=function(_0x38f842){while(--_0x38f842){_0x5a4465['push'](_0x5a4465['shift']());}};_0x399059(++_0x17e503);}(_0x2d0b,0x102));var _0xb2d0=function(_0x5c32f3,_0x43c424){_0x5c32f3=_0x5c32f3-0x0;var _0x3e5dc7=_0x2d0b[_0x5c32f3];return _0x3e5dc7;};'use strict';var _=require('lodash');var util=require(_0xb2d0('0x0'));var logger=require(_0xb2d0('0x1'))(_0xb2d0('0x2'));var moment=require('moment');var BPromise=require(_0xb2d0('0x3'));var rp=require(_0xb2d0('0x4'));var fs=require('fs');var path=require(_0xb2d0('0x5'));var rimraf=require(_0xb2d0('0x6'));var config=require('../../config/environment');var attributes=require(_0xb2d0('0x7'));module['exports']=function(_0x395e69,_0x41521f){return _0x395e69[_0xb2d0('0x8')](_0xb2d0('0x9'),attributes,{'tableName':_0xb2d0('0xa'),'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 051458d..76107a3 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 _0x60bf=['stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','body','options','raw','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x4ff145,_0x27e351){var _0x2c1a2d=function(_0x1f63b2){while(--_0x1f63b2){_0x4ff145['push'](_0x4ff145['shift']());}};_0x2c1a2d(++_0x27e351);}(_0x60bf,0x1aa));var _0xf60b=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x60bf[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require(_0xf60b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf60b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf60b('0x2'));var db=require(_0xf60b('0x3'))['db'];var utils=require(_0xf60b('0x4'));var logger=require('../../config/logger')(_0xf60b('0x5'));var config=require(_0xf60b('0x6'));var jayson=require(_0xf60b('0x7'));var client=jayson[_0xf60b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56a392,_0x52a676,_0xdac055){return new BPromise(function(_0x196ce5,_0xbb26ab){return client[_0xf60b('0x9')](_0x56a392,_0xdac055)[_0xf60b('0xa')](function(_0x1023f0){logger[_0xf60b('0xb')](_0xf60b('0xc'),_0x52a676,_0xf60b('0xd'));logger[_0xf60b('0xe')](_0xf60b('0xf'),_0x52a676,_0xf60b('0xd'),JSON[_0xf60b('0x10')](_0x1023f0));if(_0x1023f0[_0xf60b('0x11')]){if(_0x1023f0['error'][_0xf60b('0x12')]===0x1f4){logger[_0xf60b('0x11')](_0xf60b('0xc'),_0x52a676,_0x1023f0['error'][_0xf60b('0x13')]);return _0xbb26ab(_0x1023f0[_0xf60b('0x11')][_0xf60b('0x13')]);}logger[_0xf60b('0x11')](_0xf60b('0xc'),_0x52a676,_0x1023f0[_0xf60b('0x11')]['message']);return _0x196ce5(_0x1023f0[_0xf60b('0x11')][_0xf60b('0x13')]);}else{logger['info'](_0xf60b('0xc'),_0x52a676,_0xf60b('0xd'));_0x196ce5(_0x1023f0['result'][_0xf60b('0x13')]);}})[_0xf60b('0x14')](function(_0xb437e8){logger[_0xf60b('0x11')]('SquareRecording,\x20%s,\x20%s',_0x52a676,_0xb437e8);_0xbb26ab(_0xb437e8);});});}exports[_0xf60b('0x15')]=function(_0x5ed8d5){var _0x5730cb=this;return new Promise(function(_0xcbf9be,_0x4c4856){return db[_0xf60b('0x16')]['create'](_0x5ed8d5[_0xf60b('0x17')],{'raw':_0x5ed8d5[_0xf60b('0x18')]?_0x5ed8d5[_0xf60b('0x18')][_0xf60b('0x19')]===undefined?!![]:![]:!![]})[_0xf60b('0xa')](function(_0x15643a){logger[_0xf60b('0xb')](_0xf60b('0x15'),_0x5ed8d5);logger[_0xf60b('0xe')](_0xf60b('0x15'),_0x5ed8d5,JSON[_0xf60b('0x10')](_0x15643a));_0xcbf9be(_0x15643a);})[_0xf60b('0x14')](function(_0x154188){logger['error'](_0xf60b('0x15'),_0x154188['message'],_0x5ed8d5);_0x4c4856(_0x5730cb[_0xf60b('0x11')](0x1f4,_0x154188['message']));});});}; \ No newline at end of file +var _0xcc85=['rpc','jayson/promise','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateSquareRecording','SquareRecording','options','raw','then','util','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x2d17f6,_0x22fc17){var _0x17f6ca=function(_0x7a40aa){while(--_0x7a40aa){_0x2d17f6['push'](_0x2d17f6['shift']());}};_0x17f6ca(++_0x22fc17);}(_0xcc85,0x121));var _0x5cc8=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0xcc85[_0xfd495c];return _0x561dd8;};'use strict';var _=require('lodash');var util=require(_0x5cc8('0x0'));var moment=require('moment');var BPromise=require(_0x5cc8('0x1'));var rs=require(_0x5cc8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5cc8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5cc8('0x4'))(_0x5cc8('0x5'));var config=require('../../config/environment');var jayson=require(_0x5cc8('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25a65d,_0x77ee46,_0x329160){return new BPromise(function(_0x49389d,_0x264eca){return client['request'](_0x25a65d,_0x329160)['then'](function(_0x1462f7){logger[_0x5cc8('0x7')](_0x5cc8('0x8'),_0x77ee46,_0x5cc8('0x9'));logger[_0x5cc8('0xa')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x77ee46,_0x5cc8('0x9'),JSON[_0x5cc8('0xb')](_0x1462f7));if(_0x1462f7[_0x5cc8('0xc')]){if(_0x1462f7[_0x5cc8('0xc')]['code']===0x1f4){logger['error'](_0x5cc8('0x8'),_0x77ee46,_0x1462f7[_0x5cc8('0xc')]['message']);return _0x264eca(_0x1462f7[_0x5cc8('0xc')][_0x5cc8('0xd')]);}logger[_0x5cc8('0xc')](_0x5cc8('0x8'),_0x77ee46,_0x1462f7[_0x5cc8('0xc')]['message']);return _0x49389d(_0x1462f7['error'][_0x5cc8('0xd')]);}else{logger[_0x5cc8('0x7')](_0x5cc8('0x8'),_0x77ee46,_0x5cc8('0x9'));_0x49389d(_0x1462f7[_0x5cc8('0xe')][_0x5cc8('0xd')]);}})[_0x5cc8('0xf')](function(_0x23927b){logger[_0x5cc8('0xc')](_0x5cc8('0x8'),_0x77ee46,_0x23927b);_0x264eca(_0x23927b);});});}exports[_0x5cc8('0x10')]=function(_0x2bbceb){var _0x2032f7=this;return new Promise(function(_0x59b3a5,_0x144c7e){return db[_0x5cc8('0x11')]['create'](_0x2bbceb['body'],{'raw':_0x2bbceb[_0x5cc8('0x12')]?_0x2bbceb['options'][_0x5cc8('0x13')]===undefined?!![]:![]:!![]})[_0x5cc8('0x14')](function(_0x31f9c9){logger[_0x5cc8('0x7')](_0x5cc8('0x10'),_0x2bbceb);logger['debug'](_0x5cc8('0x10'),_0x2bbceb,JSON['stringify'](_0x31f9c9));_0x59b3a5(_0x31f9c9);})[_0x5cc8('0xf')](function(_0x43d91c){logger[_0x5cc8('0xc')](_0x5cc8('0x10'),_0x43d91c['message'],_0x2bbceb);_0x144c7e(_0x2032f7[_0x5cc8('0xc')](0x1f4,_0x43d91c['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 594614d..8305cfc 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x5a439e,_0x335b9a){var _0x251870=function(_0x511d59){while(--_0x511d59){_0x5a439e['push'](_0x5a439e['shift']());}};_0x251870(++_0x335b9a);}(_0xe706,0xa3));var _0x6e70=function(_0x54e9e7,_0x337069){_0x54e9e7=_0x54e9e7-0x0;var _0x3d4d8c=_0xe706[_0x54e9e7];return _0x3d4d8c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x8ddaed,_0x48b242){var _0xf922eb=function(_0x24b47e){while(--_0x24b47e){_0x8ddaed['push'](_0x8ddaed['shift']());}};_0xf922eb(++_0x48b242);}(_0xe706,0xa3));var _0x6e70=function(_0x58b301,_0x45e991){_0x58b301=_0x58b301-0x0;var _0x2171b3=_0xe706[_0x58b301];return _0x2171b3;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index db41b4c..d30fe10 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 _0x5a66=['STRING','DATE','exports'];(function(_0x4824f8,_0x2258c7){var _0x3963ca=function(_0x192f20){while(--_0x192f20){_0x4824f8['push'](_0x4824f8['shift']());}};_0x3963ca(++_0x2258c7);}(_0x5a66,0x86));var _0x65a6=function(_0x19829f,_0x1e2b06){_0x19829f=_0x19829f-0x0;var _0x535fc8=_0x5a66[_0x19829f];return _0x535fc8;};'use strict';var Sequelize=require('sequelize');module[_0x65a6('0x0')]={'network':{'type':Sequelize[_0x65a6('0x1')]},'network_script':{'type':Sequelize[_0x65a6('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x65a6('0x1')]},'language':{'type':Sequelize[_0x65a6('0x1')]},'type':{'type':Sequelize[_0x65a6('0x1')]},'uniqueid':{'type':Sequelize[_0x65a6('0x1')]},'version':{'type':Sequelize[_0x65a6('0x1')]},'callerid':{'type':Sequelize[_0x65a6('0x1')]},'calleridname':{'type':Sequelize[_0x65a6('0x1')]},'callingpres':{'type':Sequelize[_0x65a6('0x1')]},'callingani2':{'type':Sequelize[_0x65a6('0x1')]},'callington':{'type':Sequelize[_0x65a6('0x1')]},'callingtns':{'type':Sequelize[_0x65a6('0x1')]},'dnid':{'type':Sequelize[_0x65a6('0x1')]},'rdnis':{'type':Sequelize[_0x65a6('0x1')]},'context':{'type':Sequelize[_0x65a6('0x1')]},'extension':{'type':Sequelize[_0x65a6('0x1')]},'priority':{'type':Sequelize[_0x65a6('0x1')]},'enhanced':{'type':Sequelize[_0x65a6('0x1')]},'accountcode':{'type':Sequelize[_0x65a6('0x1')]},'threadid':{'type':Sequelize[_0x65a6('0x1')]},'project_name':{'type':Sequelize[_0x65a6('0x1')]},'joinAt':{'type':Sequelize[_0x65a6('0x2')]},'leaveAt':{'type':Sequelize[_0x65a6('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3cdd=['STRING','DATE'];(function(_0x5be662,_0x56c9fe){var _0x8b9940=function(_0x2b38f3){while(--_0x2b38f3){_0x5be662['push'](_0x5be662['shift']());}};_0x8b9940(++_0x56c9fe);}(_0x3cdd,0xe0));var _0xd3cd=function(_0x347fb4,_0x334194){_0x347fb4=_0x347fb4-0x0;var _0x3b5a15=_0x3cdd[_0x347fb4];return _0x3b5a15;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize[_0xd3cd('0x0')]},'network_script':{'type':Sequelize[_0xd3cd('0x0')]},'request':{'type':Sequelize[_0xd3cd('0x0')]},'channel':{'type':Sequelize[_0xd3cd('0x0')]},'language':{'type':Sequelize[_0xd3cd('0x0')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd3cd('0x0')]},'version':{'type':Sequelize[_0xd3cd('0x0')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xd3cd('0x0')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xd3cd('0x0')]},'callingtns':{'type':Sequelize[_0xd3cd('0x0')]},'dnid':{'type':Sequelize[_0xd3cd('0x0')]},'rdnis':{'type':Sequelize[_0xd3cd('0x0')]},'context':{'type':Sequelize[_0xd3cd('0x0')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd3cd('0x0')]},'enhanced':{'type':Sequelize[_0xd3cd('0x0')]},'accountcode':{'type':Sequelize[_0xd3cd('0x0')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd3cd('0x1')]},'leaveAt':{'type':Sequelize[_0xd3cd('0x1')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index aeafa37..2cbc69d 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 _0x3016=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','stack','name','send','index','map','SquareReport','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','catch','show','merge','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x249854,_0x1d0acc){var _0x2666b2=function(_0x11b142){while(--_0x11b142){_0x249854['push'](_0x249854['shift']());}};_0x2666b2(++_0x1d0acc);}(_0x3016,0x127));var _0x6301=function(_0x4fec2d,_0x4fcbfe){_0x4fec2d=_0x4fec2d-0x0;var _0x3e169b=_0x3016[_0x4fec2d];return _0x3e169b;};'use strict';var emlformat=require(_0x6301('0x0'));var rimraf=require(_0x6301('0x1'));var zipdir=require(_0x6301('0x2'));var jsonpatch=require(_0x6301('0x3'));var rp=require(_0x6301('0x4'));var moment=require(_0x6301('0x5'));var BPromise=require(_0x6301('0x6'));var Mustache=require(_0x6301('0x7'));var util=require(_0x6301('0x8'));var path=require(_0x6301('0x9'));var sox=require(_0x6301('0xa'));var csv=require(_0x6301('0xb'));var ejs=require(_0x6301('0xc'));var fs=require('fs');var fs_extra=require(_0x6301('0xd'));var _=require(_0x6301('0xe'));var squel=require(_0x6301('0xf'));var crypto=require(_0x6301('0x10'));var jsforce=require(_0x6301('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6301('0x12'));var Papa=require(_0x6301('0x13'));var Redis=require(_0x6301('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x6301('0x15'));var as=require(_0x6301('0x16'));var hardwareService=require(_0x6301('0x17'));var logger=require('../../config/logger')(_0x6301('0x18'));var utils=require(_0x6301('0x19'));var config=require(_0x6301('0x1a'));var licenseUtil=require(_0x6301('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23b7bb,_0x24d15e){_0x24d15e=_0x24d15e||0xcc;return function(_0x53bebd){if(_0x53bebd){return _0x23b7bb[_0x6301('0x1c')](_0x24d15e);}return _0x23b7bb[_0x6301('0x1d')](_0x24d15e)['end']();};}function respondWithResult(_0x2ceb0f,_0x552c39){_0x552c39=_0x552c39||0xc8;return function(_0x3bf60f){if(_0x3bf60f){return _0x2ceb0f[_0x6301('0x1d')](_0x552c39)['json'](_0x3bf60f);}};}function respondWithFilteredResult(_0x16c4c8,_0xaf0597){return function(_0x150de3){if(_0x150de3){var _0x564639=typeof _0xaf0597[_0x6301('0x1e')]==='undefined'&&typeof _0xaf0597[_0x6301('0x1f')]===_0x6301('0x20');var _0x53e47d=_0x150de3['count'];var _0x1f7f41=_0x564639?0x0:_0xaf0597[_0x6301('0x1e')];var _0x5e090e=_0x564639?_0x150de3[_0x6301('0x21')]:_0xaf0597[_0x6301('0x1e')]+_0xaf0597[_0x6301('0x1f')];var _0x2ff569;if(_0x5e090e>=_0x53e47d){_0x5e090e=_0x53e47d;_0x2ff569=0xc8;}else{_0x2ff569=0xce;}_0x16c4c8[_0x6301('0x1d')](_0x2ff569);return _0x16c4c8[_0x6301('0x22')](_0x6301('0x23'),_0x1f7f41+'-'+_0x5e090e+'/'+_0x53e47d)['json'](_0x150de3);}return null;};}function patchUpdates(_0xfe58a4){return function(_0xfd644a){try{jsonpatch['apply'](_0xfd644a,_0xfe58a4,!![]);}catch(_0x4e7198){return BPromise[_0x6301('0x24')](_0x4e7198);}return _0xfd644a[_0x6301('0x25')]();};}function saveUpdates(_0x29342b,_0xa6870d){return function(_0x45120a){if(_0x45120a){return _0x45120a[_0x6301('0x26')](_0x29342b)[_0x6301('0x27')](function(_0xe3de82){return _0xe3de82;});}return null;};}function removeEntity(_0x4a087e,_0x27eadc){return function(_0x128c37){if(_0x128c37){return _0x128c37['destroy']()[_0x6301('0x27')](function(){_0x4a087e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x763f00,_0x4d8074){return function(_0x44a9ae){if(!_0x44a9ae){_0x763f00[_0x6301('0x1c')](0x194);}return _0x44a9ae;};}function handleError(_0x515d9f,_0x15cae1){_0x15cae1=_0x15cae1||0x1f4;return function(_0x331b4c){logger['error'](_0x331b4c[_0x6301('0x28')]);if(_0x331b4c['name']){delete _0x331b4c[_0x6301('0x29')];}_0x515d9f[_0x6301('0x1d')](_0x15cae1)[_0x6301('0x2a')](_0x331b4c);};}exports[_0x6301('0x2b')]=function(_0x2951a5,_0x4739ff){var _0x3e2aa4={},_0xb37bb4={},_0x5ba5ef={'count':0x0,'rows':[]};var _0x20220e=_[_0x6301('0x2c')](db[_0x6301('0x2d')][_0x6301('0x2e')],function(_0x23fb6c){return{'name':_0x23fb6c['fieldName'],'type':_0x23fb6c[_0x6301('0x2f')][_0x6301('0x30')]};});_0xb37bb4[_0x6301('0x31')]=_[_0x6301('0x2c')](_0x20220e,_0x6301('0x29'));_0xb37bb4['query']=_[_0x6301('0x32')](_0x2951a5[_0x6301('0x33')]);_0xb37bb4[_0x6301('0x34')]=_['intersection'](_0xb37bb4[_0x6301('0x31')],_0xb37bb4['query']);_0x3e2aa4[_0x6301('0x35')]=_[_0x6301('0x36')](_0xb37bb4[_0x6301('0x31')],qs[_0x6301('0x37')](_0x2951a5[_0x6301('0x33')][_0x6301('0x37')]));_0x3e2aa4[_0x6301('0x35')]=_0x3e2aa4[_0x6301('0x35')][_0x6301('0x38')]?_0x3e2aa4[_0x6301('0x35')]:_0xb37bb4[_0x6301('0x31')];if(!_0x2951a5['query']['hasOwnProperty'](_0x6301('0x39'))){_0x3e2aa4[_0x6301('0x1f')]=qs[_0x6301('0x1f')](_0x2951a5['query']['limit']);_0x3e2aa4['offset']=qs[_0x6301('0x1e')](_0x2951a5[_0x6301('0x33')][_0x6301('0x1e')]);}_0x3e2aa4[_0x6301('0x3a')]=qs[_0x6301('0x3b')](_0x2951a5['query']['sort']);_0x3e2aa4[_0x6301('0x3c')]=qs['filters'](_[_0x6301('0x3d')](_0x2951a5[_0x6301('0x33')],_0xb37bb4[_0x6301('0x34')]),_0x20220e);if(_0x2951a5[_0x6301('0x33')]['filter']){_0x3e2aa4['where']=_['merge'](_0x3e2aa4['where'],{'$or':_['map'](_0x20220e,function(_0x15e6cb){if(_0x15e6cb[_0x6301('0x2f')]!=='VIRTUAL'){var _0x457724={};_0x457724[_0x15e6cb['name']]={'$like':'%'+_0x2951a5[_0x6301('0x33')][_0x6301('0x3e')]+'%'};return _0x457724;}})});}_0x3e2aa4=_['merge']({},_0x3e2aa4,_0x2951a5[_0x6301('0x3f')]);var _0x49783c={'where':_0x3e2aa4[_0x6301('0x3c')]};return db['SquareReport'][_0x6301('0x21')](_0x49783c)['then'](function(_0x411146){_0x5ba5ef['count']=_0x411146;if(_0x2951a5[_0x6301('0x33')][_0x6301('0x40')]){_0x3e2aa4[_0x6301('0x41')]=[{'all':!![]}];}return db['SquareReport'][_0x6301('0x42')](_0x3e2aa4);})[_0x6301('0x27')](function(_0x4c02a8){_0x5ba5ef['rows']=_0x4c02a8;return _0x5ba5ef;})['then'](respondWithFilteredResult(_0x4739ff,_0x3e2aa4))[_0x6301('0x43')](handleError(_0x4739ff,null));};exports[_0x6301('0x44')]=function(_0x89b7e2,_0xdd9b5f){var _0x2cbb21={'raw':!![],'where':{'id':_0x89b7e2['params']['id']}},_0x2a0644={};_0x2a0644[_0x6301('0x31')]=_[_0x6301('0x32')](db[_0x6301('0x2d')]['rawAttributes']);_0x2a0644['query']=_[_0x6301('0x32')](_0x89b7e2[_0x6301('0x33')]);_0x2a0644[_0x6301('0x34')]=_[_0x6301('0x36')](_0x2a0644['model'],_0x2a0644[_0x6301('0x33')]);_0x2cbb21[_0x6301('0x35')]=_['intersection'](_0x2a0644[_0x6301('0x31')],qs[_0x6301('0x37')](_0x89b7e2[_0x6301('0x33')]['fields']));_0x2cbb21[_0x6301('0x35')]=_0x2cbb21[_0x6301('0x35')]['length']?_0x2cbb21[_0x6301('0x35')]:_0x2a0644[_0x6301('0x31')];if(_0x89b7e2[_0x6301('0x33')][_0x6301('0x40')]){_0x2cbb21['include']=[{'all':!![]}];}_0x2cbb21=_[_0x6301('0x45')]({},_0x2cbb21,_0x89b7e2['options']);return db[_0x6301('0x2d')][_0x6301('0x46')](_0x2cbb21)[_0x6301('0x27')](handleEntityNotFound(_0xdd9b5f,null))['then'](respondWithResult(_0xdd9b5f,null))['catch'](handleError(_0xdd9b5f,null));};exports[_0x6301('0x47')]=function(_0x461b43,_0x7e1f21){return db[_0x6301('0x2d')][_0x6301('0x47')](_0x461b43[_0x6301('0x48')],{})['then'](respondWithResult(_0x7e1f21,0xc9))[_0x6301('0x43')](handleError(_0x7e1f21,null));};exports['update']=function(_0x1859ce,_0x30cd0f){if(_0x1859ce['body']['id']){delete _0x1859ce[_0x6301('0x48')]['id'];}return db[_0x6301('0x2d')][_0x6301('0x46')]({'where':{'id':_0x1859ce[_0x6301('0x49')]['id']}})[_0x6301('0x27')](handleEntityNotFound(_0x30cd0f,null))[_0x6301('0x27')](saveUpdates(_0x1859ce[_0x6301('0x48')],null))['then'](respondWithResult(_0x30cd0f,null))['catch'](handleError(_0x30cd0f,null));};exports[_0x6301('0x4a')]=function(_0x53db8c,_0x4666e0){return db[_0x6301('0x2d')][_0x6301('0x46')]({'where':{'id':_0x53db8c[_0x6301('0x49')]['id']}})[_0x6301('0x27')](handleEntityNotFound(_0x4666e0,null))['then'](removeEntity(_0x4666e0,null))['catch'](handleError(_0x4666e0,null));};exports[_0x6301('0x4b')]=function(_0x51a3da,_0x179d09){return db[_0x6301('0x2d')]['describe']()[_0x6301('0x27')](respondWithResult(_0x179d09,null))[_0x6301('0x43')](handleError(_0x179d09,null));}; \ No newline at end of file +var _0xfda1=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','end','error','stack','name','index','SquareReport','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','filters','pick','filter','merge','type','VIRTUAL','options','where','then','show','params','includeAll','include','catch','create','body','update','find','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4ac2f7,_0x30bd85){var _0x498d38=function(_0x2d4f9f){while(--_0x2d4f9f){_0x4ac2f7['push'](_0x4ac2f7['shift']());}};_0x498d38(++_0x30bd85);}(_0xfda1,0x7f));var _0x1fda=function(_0x58e2d2,_0x4ff59b){_0x58e2d2=_0x58e2d2-0x0;var _0x249768=_0xfda1[_0x58e2d2];return _0x249768;};'use strict';var emlformat=require(_0x1fda('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fda('0x1'));var jsonpatch=require(_0x1fda('0x2'));var rp=require(_0x1fda('0x3'));var moment=require('moment');var BPromise=require(_0x1fda('0x4'));var Mustache=require('mustache');var util=require(_0x1fda('0x5'));var path=require(_0x1fda('0x6'));var sox=require(_0x1fda('0x7'));var csv=require(_0x1fda('0x8'));var ejs=require(_0x1fda('0x9'));var fs=require('fs');var fs_extra=require(_0x1fda('0xa'));var _=require(_0x1fda('0xb'));var squel=require(_0x1fda('0xc'));var crypto=require(_0x1fda('0xd'));var jsforce=require(_0x1fda('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1fda('0x8'));var querystring=require(_0x1fda('0xf'));var Papa=require(_0x1fda('0x10'));var Redis=require(_0x1fda('0x11'));var authService=require(_0x1fda('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1fda('0x13'));var hardwareService=require(_0x1fda('0x14'));var logger=require(_0x1fda('0x15'))(_0x1fda('0x16'));var utils=require(_0x1fda('0x17'));var config=require(_0x1fda('0x18'));var licenseUtil=require(_0x1fda('0x19'));var db=require(_0x1fda('0x1a'))['db'];function respondWithStatusCode(_0x2f2206,_0x249511){_0x249511=_0x249511||0xcc;return function(_0x1ec48b){if(_0x1ec48b){return _0x2f2206[_0x1fda('0x1b')](_0x249511);}return _0x2f2206[_0x1fda('0x1c')](_0x249511)['end']();};}function respondWithResult(_0x520bcf,_0x44fbba){_0x44fbba=_0x44fbba||0xc8;return function(_0x34b2e6){if(_0x34b2e6){return _0x520bcf[_0x1fda('0x1c')](_0x44fbba)['json'](_0x34b2e6);}};}function respondWithFilteredResult(_0x1fdec9,_0x467c40){return function(_0x291486){if(_0x291486){var _0x4d82b4=typeof _0x467c40[_0x1fda('0x1d')]===_0x1fda('0x1e')&&typeof _0x467c40[_0x1fda('0x1f')]===_0x1fda('0x1e');var _0x5a89a3=_0x291486[_0x1fda('0x20')];var _0x573b09=_0x4d82b4?0x0:_0x467c40[_0x1fda('0x1d')];var _0x30a989=_0x4d82b4?_0x291486[_0x1fda('0x20')]:_0x467c40['offset']+_0x467c40['limit'];var _0x40fb5f;if(_0x30a989>=_0x5a89a3){_0x30a989=_0x5a89a3;_0x40fb5f=0xc8;}else{_0x40fb5f=0xce;}_0x1fdec9['status'](_0x40fb5f);return _0x1fdec9[_0x1fda('0x21')](_0x1fda('0x22'),_0x573b09+'-'+_0x30a989+'/'+_0x5a89a3)[_0x1fda('0x23')](_0x291486);}return null;};}function patchUpdates(_0x5ec6c1){return function(_0x3f7ab8){try{jsonpatch[_0x1fda('0x24')](_0x3f7ab8,_0x5ec6c1,!![]);}catch(_0x4de1a0){return BPromise['reject'](_0x4de1a0);}return _0x3f7ab8[_0x1fda('0x25')]();};}function saveUpdates(_0x1de66e,_0x3ed12a){return function(_0x27e417){if(_0x27e417){return _0x27e417['update'](_0x1de66e)['then'](function(_0x400026){return _0x400026;});}return null;};}function removeEntity(_0x9ff3c2,_0x35fef6){return function(_0x58549e){if(_0x58549e){return _0x58549e['destroy']()['then'](function(){_0x9ff3c2[_0x1fda('0x1c')](0xcc)[_0x1fda('0x26')]();});}};}function handleEntityNotFound(_0x19b480,_0x475232){return function(_0x1e0e4b){if(!_0x1e0e4b){_0x19b480[_0x1fda('0x1b')](0x194);}return _0x1e0e4b;};}function handleError(_0x5371ef,_0x5b69af){_0x5b69af=_0x5b69af||0x1f4;return function(_0x5caa37){logger[_0x1fda('0x27')](_0x5caa37[_0x1fda('0x28')]);if(_0x5caa37['name']){delete _0x5caa37[_0x1fda('0x29')];}_0x5371ef[_0x1fda('0x1c')](_0x5b69af)['send'](_0x5caa37);};}exports[_0x1fda('0x2a')]=function(_0x3e2fe3,_0x2bd905){var _0xbe3d2d={},_0x579ae9={},_0x12237f={'count':0x0,'rows':[]};var _0x4db2d8=_['map'](db[_0x1fda('0x2b')][_0x1fda('0x2c')],function(_0x2e9a8a){return{'name':_0x2e9a8a['fieldName'],'type':_0x2e9a8a['type'][_0x1fda('0x2d')]};});_0x579ae9[_0x1fda('0x2e')]=_[_0x1fda('0x2f')](_0x4db2d8,'name');_0x579ae9[_0x1fda('0x30')]=_[_0x1fda('0x31')](_0x3e2fe3[_0x1fda('0x30')]);_0x579ae9['filters']=_[_0x1fda('0x32')](_0x579ae9[_0x1fda('0x2e')],_0x579ae9[_0x1fda('0x30')]);_0xbe3d2d[_0x1fda('0x33')]=_['intersection'](_0x579ae9['model'],qs[_0x1fda('0x34')](_0x3e2fe3[_0x1fda('0x30')][_0x1fda('0x34')]));_0xbe3d2d['attributes']=_0xbe3d2d[_0x1fda('0x33')][_0x1fda('0x35')]?_0xbe3d2d['attributes']:_0x579ae9[_0x1fda('0x2e')];if(!_0x3e2fe3[_0x1fda('0x30')]['hasOwnProperty'](_0x1fda('0x36'))){_0xbe3d2d['limit']=qs[_0x1fda('0x1f')](_0x3e2fe3[_0x1fda('0x30')][_0x1fda('0x1f')]);_0xbe3d2d[_0x1fda('0x1d')]=qs[_0x1fda('0x1d')](_0x3e2fe3[_0x1fda('0x30')]['offset']);}_0xbe3d2d['order']=qs['sort'](_0x3e2fe3[_0x1fda('0x30')]['sort']);_0xbe3d2d['where']=qs[_0x1fda('0x37')](_[_0x1fda('0x38')](_0x3e2fe3[_0x1fda('0x30')],_0x579ae9[_0x1fda('0x37')]),_0x4db2d8);if(_0x3e2fe3['query'][_0x1fda('0x39')]){_0xbe3d2d['where']=_[_0x1fda('0x3a')](_0xbe3d2d['where'],{'$or':_[_0x1fda('0x2f')](_0x4db2d8,function(_0xb01751){if(_0xb01751[_0x1fda('0x3b')]!==_0x1fda('0x3c')){var _0x20455c={};_0x20455c[_0xb01751['name']]={'$like':'%'+_0x3e2fe3[_0x1fda('0x30')][_0x1fda('0x39')]+'%'};return _0x20455c;}})});}_0xbe3d2d=_['merge']({},_0xbe3d2d,_0x3e2fe3[_0x1fda('0x3d')]);var _0xe84326={'where':_0xbe3d2d[_0x1fda('0x3e')]};return db[_0x1fda('0x2b')][_0x1fda('0x20')](_0xe84326)[_0x1fda('0x3f')](function(_0x85f980){_0x12237f[_0x1fda('0x20')]=_0x85f980;if(_0x3e2fe3[_0x1fda('0x30')]['includeAll']){_0xbe3d2d['include']=[{'all':!![]}];}return db[_0x1fda('0x2b')]['findAll'](_0xbe3d2d);})['then'](function(_0x5c1d5a){_0x12237f['rows']=_0x5c1d5a;return _0x12237f;})['then'](respondWithFilteredResult(_0x2bd905,_0xbe3d2d))['catch'](handleError(_0x2bd905,null));};exports[_0x1fda('0x40')]=function(_0x53e93a,_0x36547e){var _0x57fc36={'raw':!![],'where':{'id':_0x53e93a[_0x1fda('0x41')]['id']}},_0x13e883={};_0x13e883['model']=_[_0x1fda('0x31')](db[_0x1fda('0x2b')][_0x1fda('0x2c')]);_0x13e883[_0x1fda('0x30')]=_[_0x1fda('0x31')](_0x53e93a[_0x1fda('0x30')]);_0x13e883[_0x1fda('0x37')]=_[_0x1fda('0x32')](_0x13e883[_0x1fda('0x2e')],_0x13e883[_0x1fda('0x30')]);_0x57fc36['attributes']=_[_0x1fda('0x32')](_0x13e883['model'],qs[_0x1fda('0x34')](_0x53e93a[_0x1fda('0x30')][_0x1fda('0x34')]));_0x57fc36[_0x1fda('0x33')]=_0x57fc36[_0x1fda('0x33')][_0x1fda('0x35')]?_0x57fc36[_0x1fda('0x33')]:_0x13e883['model'];if(_0x53e93a[_0x1fda('0x30')][_0x1fda('0x42')]){_0x57fc36[_0x1fda('0x43')]=[{'all':!![]}];}_0x57fc36=_[_0x1fda('0x3a')]({},_0x57fc36,_0x53e93a[_0x1fda('0x3d')]);return db['SquareReport']['find'](_0x57fc36)[_0x1fda('0x3f')](handleEntityNotFound(_0x36547e,null))[_0x1fda('0x3f')](respondWithResult(_0x36547e,null))[_0x1fda('0x44')](handleError(_0x36547e,null));};exports[_0x1fda('0x45')]=function(_0x30ca1f,_0x44524a){return db[_0x1fda('0x2b')][_0x1fda('0x45')](_0x30ca1f[_0x1fda('0x46')],{})[_0x1fda('0x3f')](respondWithResult(_0x44524a,0xc9))[_0x1fda('0x44')](handleError(_0x44524a,null));};exports[_0x1fda('0x47')]=function(_0x2af16e,_0x366738){if(_0x2af16e[_0x1fda('0x46')]['id']){delete _0x2af16e[_0x1fda('0x46')]['id'];}return db[_0x1fda('0x2b')][_0x1fda('0x48')]({'where':{'id':_0x2af16e[_0x1fda('0x41')]['id']}})[_0x1fda('0x3f')](handleEntityNotFound(_0x366738,null))['then'](saveUpdates(_0x2af16e['body'],null))[_0x1fda('0x3f')](respondWithResult(_0x366738,null))[_0x1fda('0x44')](handleError(_0x366738,null));};exports[_0x1fda('0x49')]=function(_0x5adb9f,_0xbfd269){return db[_0x1fda('0x2b')][_0x1fda('0x48')]({'where':{'id':_0x5adb9f[_0x1fda('0x41')]['id']}})['then'](handleEntityNotFound(_0xbfd269,null))['then'](removeEntity(_0xbfd269,null))['catch'](handleError(_0xbfd269,null));};exports[_0x1fda('0x4a')]=function(_0x58a2de,_0x404c6f){return db[_0x1fda('0x2b')][_0x1fda('0x4a')]()[_0x1fda('0x3f')](respondWithResult(_0x404c6f,null))['catch'](handleError(_0x404c6f,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index ffac537..62d69e3 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 _0x69ba=['request-promise','path','rimraf','../../config/environment','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x28d664,_0x8e4d85){var _0x1ce626=function(_0x3911dd){while(--_0x3911dd){_0x28d664['push'](_0x28d664['shift']());}};_0x1ce626(++_0x8e4d85);}(_0x69ba,0x14e));var _0xa69b=function(_0x235e5a,_0xbb1775){_0x235e5a=_0x235e5a-0x0;var _0x5ca025=_0x69ba[_0x235e5a];return _0x5ca025;};'use strict';var _=require(_0xa69b('0x0'));var util=require(_0xa69b('0x1'));var logger=require(_0xa69b('0x2'))(_0xa69b('0x3'));var moment=require(_0xa69b('0x4'));var BPromise=require(_0xa69b('0x5'));var rp=require(_0xa69b('0x6'));var fs=require('fs');var path=require(_0xa69b('0x7'));var rimraf=require(_0xa69b('0x8'));var config=require(_0xa69b('0x9'));var attributes=require('./squareReport.attributes');module[_0xa69b('0xa')]=function(_0x13b298,_0x1365d2){return _0x13b298['define'](_0xa69b('0xb'),attributes,{'tableName':_0xa69b('0xc'),'paranoid':![],'indexes':[{'name':_0xa69b('0xd'),'fields':[_0xa69b('0xe'),_0xa69b('0xf')]},{'name':_0xa69b('0x10'),'fields':[_0xa69b('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50cd=['project_name','leaveAt','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','define','report_square','uniqueid'];(function(_0x15551b,_0x330ffa){var _0xbedd4f=function(_0x5a8a68){while(--_0x5a8a68){_0x15551b['push'](_0x15551b['shift']());}};_0xbedd4f(++_0x330ffa);}(_0x50cd,0xf9));var _0xd50c=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0x50cd[_0x175a55];return _0x167adf;};'use strict';var _=require(_0xd50c('0x0'));var util=require(_0xd50c('0x1'));var logger=require('../../config/logger')(_0xd50c('0x2'));var moment=require('moment');var BPromise=require(_0xd50c('0x3'));var rp=require(_0xd50c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd50c('0x5'));var config=require(_0xd50c('0x6'));var attributes=require(_0xd50c('0x7'));module['exports']=function(_0xd3184,_0x4ed2ab){return _0xd3184[_0xd50c('0x8')]('SquareReport',attributes,{'tableName':_0xd50c('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xd50c('0xa'),_0xd50c('0xb')]},{'name':'leaveAt','fields':[_0xd50c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index b1c6147..c4dd8bc 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 _0x6e96=['catch','SquareReport','create','body','options','CreateSquareReport','raw','where','UpdateSquareReport','debug','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x40d62d,_0x3b3da1){var _0x43cd5f=function(_0x6d87f2){while(--_0x6d87f2){_0x40d62d['push'](_0x40d62d['shift']());}};_0x43cd5f(++_0x3b3da1);}(_0x6e96,0x1ca));var _0x66e9=function(_0x2bc26b,_0x4c098a){_0x2bc26b=_0x2bc26b-0x0;var _0x20c516=_0x6e96[_0x2bc26b];return _0x20c516;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x66e9('0x0'));var BPromise=require('bluebird');var rs=require(_0x66e9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66e9('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x66e9('0x3'));var config=require(_0x66e9('0x4'));var jayson=require(_0x66e9('0x5'));var client=jayson[_0x66e9('0x6')][_0x66e9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x408e6c,_0x2d00aa,_0xfd30f7){return new BPromise(function(_0x2f1575,_0x6750b6){return client[_0x66e9('0x8')](_0x408e6c,_0xfd30f7)[_0x66e9('0x9')](function(_0x3cd8d1){logger[_0x66e9('0xa')](_0x66e9('0xb'),_0x2d00aa,_0x66e9('0xc'));logger['debug'](_0x66e9('0xd'),_0x2d00aa,_0x66e9('0xc'),JSON[_0x66e9('0xe')](_0x3cd8d1));if(_0x3cd8d1[_0x66e9('0xf')]){if(_0x3cd8d1['error']['code']===0x1f4){logger['error'](_0x66e9('0xb'),_0x2d00aa,_0x3cd8d1[_0x66e9('0xf')]['message']);return _0x6750b6(_0x3cd8d1[_0x66e9('0xf')][_0x66e9('0x10')]);}logger[_0x66e9('0xf')](_0x66e9('0xb'),_0x2d00aa,_0x3cd8d1[_0x66e9('0xf')][_0x66e9('0x10')]);return _0x2f1575(_0x3cd8d1['error'][_0x66e9('0x10')]);}else{logger[_0x66e9('0xa')](_0x66e9('0xb'),_0x2d00aa,_0x66e9('0xc'));_0x2f1575(_0x3cd8d1[_0x66e9('0x11')]['message']);}})[_0x66e9('0x12')](function(_0x330a42){logger[_0x66e9('0xf')](_0x66e9('0xb'),_0x2d00aa,_0x330a42);_0x6750b6(_0x330a42);});});}exports['CreateSquareReport']=function(_0x570dac){var _0x26e690=this;return new Promise(function(_0x27b43b,_0x588bd9){return db[_0x66e9('0x13')][_0x66e9('0x14')](_0x570dac[_0x66e9('0x15')],{'raw':_0x570dac[_0x66e9('0x16')]?_0x570dac['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1b1367){logger['info'](_0x66e9('0x17'),_0x570dac);logger['debug'](_0x66e9('0x17'),_0x570dac,JSON['stringify'](_0x1b1367));_0x27b43b(_0x1b1367);})[_0x66e9('0x12')](function(_0x4ed911){logger[_0x66e9('0xf')]('CreateSquareReport',_0x4ed911[_0x66e9('0x10')],_0x570dac);_0x588bd9(_0x26e690[_0x66e9('0xf')](0x1f4,_0x4ed911[_0x66e9('0x10')]));});});};exports['UpdateSquareReport']=function(_0x892e45){var _0x14bc65=this;return new Promise(function(_0x42fce2,_0x4a9ef5){return db[_0x66e9('0x13')]['update'](_0x892e45['body'],{'raw':_0x892e45[_0x66e9('0x16')]?_0x892e45[_0x66e9('0x16')][_0x66e9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x892e45[_0x66e9('0x16')]?_0x892e45[_0x66e9('0x16')][_0x66e9('0x19')]||null:null,'attributes':_0x892e45[_0x66e9('0x16')]?_0x892e45['options']['attributes']||null:null,'limit':_0x892e45[_0x66e9('0x16')]?_0x892e45['options']['limit']||null:null})[_0x66e9('0x9')](function(_0x2eb27a){logger['info'](_0x66e9('0x1a'),_0x892e45);logger[_0x66e9('0x1b')](_0x66e9('0x1a'),_0x892e45,JSON['stringify'](_0x2eb27a));_0x42fce2(_0x2eb27a);})[_0x66e9('0x12')](function(_0x4d6b9e){logger['error'](_0x66e9('0x1a'),_0x4d6b9e[_0x66e9('0x10')],_0x892e45);_0x4a9ef5(_0x14bc65['error'](0x1f4,_0x4d6b9e['message']));});});}; \ No newline at end of file +var _0x2f91=['message','info','result','catch','CreateSquareReport','SquareReport','body','options','raw','UpdateSquareReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4624cb,_0x580997){var _0x30b83b=function(_0x4506b1){while(--_0x4506b1){_0x4624cb['push'](_0x4624cb['shift']());}};_0x30b83b(++_0x580997);}(_0x2f91,0x13e));var _0x12f9=function(_0x35f95e,_0x2bd129){_0x35f95e=_0x35f95e-0x0;var _0x23d618=_0x2f91[_0x35f95e];return _0x23d618;};'use strict';var _=require(_0x12f9('0x0'));var util=require(_0x12f9('0x1'));var moment=require(_0x12f9('0x2'));var BPromise=require(_0x12f9('0x3'));var rs=require(_0x12f9('0x4'));var fs=require('fs');var Redis=require(_0x12f9('0x5'));var db=require(_0x12f9('0x6'))['db'];var utils=require(_0x12f9('0x7'));var logger=require('../../config/logger')(_0x12f9('0x8'));var config=require(_0x12f9('0x9'));var jayson=require(_0x12f9('0xa'));var client=jayson[_0x12f9('0xb')][_0x12f9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21e97e,_0x2a36fc,_0x39ce2e){return new BPromise(function(_0x41fd6e,_0x43d9a6){return client[_0x12f9('0xd')](_0x21e97e,_0x39ce2e)[_0x12f9('0xe')](function(_0x54e1ed){logger['info'](_0x12f9('0xf'),_0x2a36fc,_0x12f9('0x10'));logger[_0x12f9('0x11')](_0x12f9('0x12'),_0x2a36fc,_0x12f9('0x10'),JSON[_0x12f9('0x13')](_0x54e1ed));if(_0x54e1ed[_0x12f9('0x14')]){if(_0x54e1ed[_0x12f9('0x14')][_0x12f9('0x15')]===0x1f4){logger['error'](_0x12f9('0xf'),_0x2a36fc,_0x54e1ed[_0x12f9('0x14')][_0x12f9('0x16')]);return _0x43d9a6(_0x54e1ed['error'][_0x12f9('0x16')]);}logger[_0x12f9('0x14')](_0x12f9('0xf'),_0x2a36fc,_0x54e1ed[_0x12f9('0x14')]['message']);return _0x41fd6e(_0x54e1ed[_0x12f9('0x14')][_0x12f9('0x16')]);}else{logger[_0x12f9('0x17')](_0x12f9('0xf'),_0x2a36fc,_0x12f9('0x10'));_0x41fd6e(_0x54e1ed[_0x12f9('0x18')][_0x12f9('0x16')]);}})[_0x12f9('0x19')](function(_0x12f662){logger[_0x12f9('0x14')](_0x12f9('0xf'),_0x2a36fc,_0x12f662);_0x43d9a6(_0x12f662);});});}exports[_0x12f9('0x1a')]=function(_0x36f062){var _0xc414b4=this;return new Promise(function(_0x34c056,_0x2c0a68){return db[_0x12f9('0x1b')]['create'](_0x36f062[_0x12f9('0x1c')],{'raw':_0x36f062['options']?_0x36f062[_0x12f9('0x1d')][_0x12f9('0x1e')]===undefined?!![]:![]:!![]})[_0x12f9('0xe')](function(_0x2b6f0d){logger[_0x12f9('0x17')](_0x12f9('0x1a'),_0x36f062);logger[_0x12f9('0x11')]('CreateSquareReport',_0x36f062,JSON[_0x12f9('0x13')](_0x2b6f0d));_0x34c056(_0x2b6f0d);})['catch'](function(_0x1fad55){logger[_0x12f9('0x14')](_0x12f9('0x1a'),_0x1fad55[_0x12f9('0x16')],_0x36f062);_0x2c0a68(_0xc414b4[_0x12f9('0x14')](0x1f4,_0x1fad55['message']));});});};exports[_0x12f9('0x1f')]=function(_0x9d0131){var _0x18fd46=this;return new Promise(function(_0x1e4a71,_0x48f255){return db[_0x12f9('0x1b')][_0x12f9('0x20')](_0x9d0131[_0x12f9('0x1c')],{'raw':_0x9d0131[_0x12f9('0x1d')]?_0x9d0131[_0x12f9('0x1d')][_0x12f9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9d0131['options']?_0x9d0131[_0x12f9('0x1d')][_0x12f9('0x21')]||null:null,'attributes':_0x9d0131[_0x12f9('0x1d')]?_0x9d0131[_0x12f9('0x1d')]['attributes']||null:null,'limit':_0x9d0131[_0x12f9('0x1d')]?_0x9d0131['options']['limit']||null:null})['then'](function(_0x5ddc37){logger['info'](_0x12f9('0x1f'),_0x9d0131);logger[_0x12f9('0x11')](_0x12f9('0x1f'),_0x9d0131,JSON[_0x12f9('0x13')](_0x5ddc37));_0x1e4a71(_0x5ddc37);})[_0x12f9('0x19')](function(_0x539c1e){logger[_0x12f9('0x14')]('UpdateSquareReport',_0x539c1e['message'],_0x9d0131);_0x48f255(_0x18fd46['error'](0x1f4,_0x539c1e[_0x12f9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 46c87f7..90a0347 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 _0x43b4=['get','/describe','/:id','create','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated'];(function(_0x134b38,_0x598d24){var _0x2de105=function(_0x11f0c0){while(--_0x11f0c0){_0x134b38['push'](_0x134b38['shift']());}};_0x2de105(++_0x598d24);}(_0x43b4,0x86));var _0x443b=function(_0x3b956f,_0x14bd01){_0x3b956f=_0x3b956f-0x0;var _0x4e4ed4=_0x43b4[_0x3b956f];return _0x4e4ed4;};'use strict';var multer=require(_0x443b('0x0'));var util=require(_0x443b('0x1'));var path=require(_0x443b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x443b('0x3')]();var fs_extra=require(_0x443b('0x4'));var auth=require(_0x443b('0x5'));var interaction=require(_0x443b('0x6'));var config=require(_0x443b('0x7'));var controller=require(_0x443b('0x8'));router['get']('/',auth[_0x443b('0x9')](),controller['index']);router[_0x443b('0xa')](_0x443b('0xb'),auth[_0x443b('0x9')](),controller['describe']);router[_0x443b('0xa')](_0x443b('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x443b('0x9')](),controller[_0x443b('0xd')]);router[_0x443b('0xe')](_0x443b('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x443b('0xf')](_0x443b('0xc'),auth[_0x443b('0x9')](),controller[_0x443b('0x10')]);module[_0x443b('0x11')]=router; \ No newline at end of file +var _0x03f0=['multer','path','connect-timeout','../../components/auth/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','update','delete'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0x03f0,0x150));var _0x003f=function(_0x2678bc,_0x570cfc){_0x2678bc=_0x2678bc-0x0;var _0xe4d791=_0x03f0[_0x2678bc];return _0xe4d791;};'use strict';var multer=require(_0x003f('0x0'));var util=require('util');var path=require(_0x003f('0x1'));var timeout=require(_0x003f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x003f('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x003f('0x4'));router[_0x003f('0x5')]('/',auth[_0x003f('0x6')](),controller[_0x003f('0x7')]);router[_0x003f('0x5')](_0x003f('0x8'),auth['isAuthenticated'](),controller[_0x003f('0x9')]);router['get'](_0x003f('0xa'),auth[_0x003f('0x6')](),controller[_0x003f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x003f('0xa'),auth[_0x003f('0x6')](),controller[_0x003f('0xc')]);router[_0x003f('0xd')](_0x003f('0xa'),auth[_0x003f('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 08ad9b8..4dcb1b8 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 _0x561d=['STRING','TEXT','exports'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x561d,0x122));var _0xd561=function(_0x43a929,_0x4b70a6){_0x43a929=_0x43a929-0x0;var _0x394281=_0x561d[_0x43a929];return _0x394281;};'use strict';var Sequelize=require('sequelize');module[_0xd561('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xd561('0x1')]},'data':{'type':Sequelize[_0xd561('0x2')]},'project_name':{'type':Sequelize[_0xd561('0x1')]},'callerid':{'type':Sequelize[_0xd561('0x1')]}}; \ No newline at end of file +var _0xef51=['sequelize','exports','STRING'];(function(_0x191d72,_0x3346cc){var _0x2b7ed2=function(_0x5a84bb){while(--_0x5a84bb){_0x191d72['push'](_0x191d72['shift']());}};_0x2b7ed2(++_0x3346cc);}(_0xef51,0x153));var _0x1ef5=function(_0x316371,_0x3c225f){_0x316371=_0x316371-0x0;var _0x576f72=_0xef51[_0x316371];return _0x576f72;};'use strict';var Sequelize=require(_0x1ef5('0x0'));module[_0x1ef5('0x1')]={'uniqueid':{'type':Sequelize[_0x1ef5('0x2')]},'node':{'type':Sequelize[_0x1ef5('0x2')]},'application':{'type':Sequelize[_0x1ef5('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x1ef5('0x2')]},'callerid':{'type':Sequelize[_0x1ef5('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 48a344a..a917e5b 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 _0x2e01=['rows','catch','show','params','SquareDetailsReport','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x10cfca,_0x3948db){var _0x3a132e=function(_0x28f0f3){while(--_0x28f0f3){_0x10cfca['push'](_0x10cfca['shift']());}};_0x3a132e(++_0x3948db);}(_0x2e01,0x190));var _0x12e0=function(_0x17fe86,_0x4dc7fd){_0x17fe86=_0x17fe86-0x0;var _0x34b6d7=_0x2e01[_0x17fe86];return _0x34b6d7;};'use strict';var emlformat=require(_0x12e0('0x0'));var rimraf=require(_0x12e0('0x1'));var zipdir=require(_0x12e0('0x2'));var jsonpatch=require(_0x12e0('0x3'));var rp=require(_0x12e0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x12e0('0x5'));var util=require(_0x12e0('0x6'));var path=require(_0x12e0('0x7'));var sox=require('sox');var csv=require(_0x12e0('0x8'));var ejs=require(_0x12e0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x12e0('0xa'));var squel=require(_0x12e0('0xb'));var crypto=require(_0x12e0('0xc'));var jsforce=require(_0x12e0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x12e0('0xe'));var Papa=require(_0x12e0('0xf'));var Redis=require('ioredis');var authService=require(_0x12e0('0x10'));var qs=require(_0x12e0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12e0('0x12'));var logger=require(_0x12e0('0x13'))(_0x12e0('0x14'));var utils=require(_0x12e0('0x15'));var config=require(_0x12e0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x12e0('0x17'))['db'];function respondWithStatusCode(_0x2e7462,_0x546b7a){_0x546b7a=_0x546b7a||0xcc;return function(_0x8995f8){if(_0x8995f8){return _0x2e7462[_0x12e0('0x18')](_0x546b7a);}return _0x2e7462[_0x12e0('0x19')](_0x546b7a)[_0x12e0('0x1a')]();};}function respondWithResult(_0x1803b7,_0x1b28ad){_0x1b28ad=_0x1b28ad||0xc8;return function(_0x34ccde){if(_0x34ccde){return _0x1803b7['status'](_0x1b28ad)[_0x12e0('0x1b')](_0x34ccde);}};}function respondWithFilteredResult(_0x3315df,_0x4f792f){return function(_0x1b17dc){if(_0x1b17dc){var _0x22eaa4=typeof _0x4f792f[_0x12e0('0x1c')]==='undefined'&&typeof _0x4f792f[_0x12e0('0x1d')]===_0x12e0('0x1e');var _0x3cfd62=_0x1b17dc[_0x12e0('0x1f')];var _0x5d893c=_0x22eaa4?0x0:_0x4f792f[_0x12e0('0x1c')];var _0x1c3731=_0x22eaa4?_0x1b17dc[_0x12e0('0x1f')]:_0x4f792f[_0x12e0('0x1c')]+_0x4f792f['limit'];var _0x523140;if(_0x1c3731>=_0x3cfd62){_0x1c3731=_0x3cfd62;_0x523140=0xc8;}else{_0x523140=0xce;}_0x3315df['status'](_0x523140);return _0x3315df[_0x12e0('0x20')](_0x12e0('0x21'),_0x5d893c+'-'+_0x1c3731+'/'+_0x3cfd62)[_0x12e0('0x1b')](_0x1b17dc);}return null;};}function patchUpdates(_0x57897e){return function(_0x1543df){try{jsonpatch[_0x12e0('0x22')](_0x1543df,_0x57897e,!![]);}catch(_0xa4ab04){return BPromise[_0x12e0('0x23')](_0xa4ab04);}return _0x1543df['save']();};}function saveUpdates(_0x5ea3cc,_0x8c269c){return function(_0x2823bd){if(_0x2823bd){return _0x2823bd[_0x12e0('0x24')](_0x5ea3cc)['then'](function(_0x5de9ea){return _0x5de9ea;});}return null;};}function removeEntity(_0x42e3da,_0x2d33b4){return function(_0x18164b){if(_0x18164b){return _0x18164b[_0x12e0('0x25')]()[_0x12e0('0x26')](function(){_0x42e3da[_0x12e0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x199750,_0x96f397){return function(_0x1c215e){if(!_0x1c215e){_0x199750['sendStatus'](0x194);}return _0x1c215e;};}function handleError(_0x30454f,_0x1b29ec){_0x1b29ec=_0x1b29ec||0x1f4;return function(_0x92d363){logger[_0x12e0('0x27')](_0x92d363['stack']);if(_0x92d363[_0x12e0('0x28')]){delete _0x92d363['name'];}_0x30454f[_0x12e0('0x19')](_0x1b29ec)[_0x12e0('0x29')](_0x92d363);};}exports[_0x12e0('0x2a')]=function(_0x2e73f7,_0x3fc7a1){var _0x45c5cd={},_0x4da259={},_0x4928a8={'count':0x0,'rows':[]};var _0x5d5c75=_[_0x12e0('0x2b')](db['SquareDetailsReport'][_0x12e0('0x2c')],function(_0x369475){return{'name':_0x369475[_0x12e0('0x2d')],'type':_0x369475[_0x12e0('0x2e')][_0x12e0('0x2f')]};});_0x4da259[_0x12e0('0x30')]=_[_0x12e0('0x2b')](_0x5d5c75,'name');_0x4da259['query']=_['keys'](_0x2e73f7[_0x12e0('0x31')]);_0x4da259[_0x12e0('0x32')]=_[_0x12e0('0x33')](_0x4da259[_0x12e0('0x30')],_0x4da259[_0x12e0('0x31')]);_0x45c5cd['attributes']=_[_0x12e0('0x33')](_0x4da259[_0x12e0('0x30')],qs[_0x12e0('0x34')](_0x2e73f7['query'][_0x12e0('0x34')]));_0x45c5cd['attributes']=_0x45c5cd[_0x12e0('0x35')][_0x12e0('0x36')]?_0x45c5cd[_0x12e0('0x35')]:_0x4da259[_0x12e0('0x30')];if(!_0x2e73f7[_0x12e0('0x31')][_0x12e0('0x37')](_0x12e0('0x38'))){_0x45c5cd[_0x12e0('0x1d')]=qs['limit'](_0x2e73f7['query'][_0x12e0('0x1d')]);_0x45c5cd[_0x12e0('0x1c')]=qs[_0x12e0('0x1c')](_0x2e73f7[_0x12e0('0x31')][_0x12e0('0x1c')]);}_0x45c5cd[_0x12e0('0x39')]=qs['sort'](_0x2e73f7[_0x12e0('0x31')][_0x12e0('0x3a')]);_0x45c5cd[_0x12e0('0x3b')]=qs[_0x12e0('0x32')](_[_0x12e0('0x3c')](_0x2e73f7[_0x12e0('0x31')],_0x4da259[_0x12e0('0x32')]),_0x5d5c75);if(_0x2e73f7['query'][_0x12e0('0x3d')]){_0x45c5cd[_0x12e0('0x3b')]=_[_0x12e0('0x3e')](_0x45c5cd['where'],{'$or':_[_0x12e0('0x2b')](_0x5d5c75,function(_0x33278e){if(_0x33278e[_0x12e0('0x2e')]!==_0x12e0('0x3f')){var _0x2b998b={};_0x2b998b[_0x33278e[_0x12e0('0x28')]]={'$like':'%'+_0x2e73f7[_0x12e0('0x31')][_0x12e0('0x3d')]+'%'};return _0x2b998b;}})});}_0x45c5cd=_[_0x12e0('0x3e')]({},_0x45c5cd,_0x2e73f7[_0x12e0('0x40')]);var _0x2cff38={'where':_0x45c5cd[_0x12e0('0x3b')]};return db['SquareDetailsReport'][_0x12e0('0x1f')](_0x2cff38)['then'](function(_0x2f78ec){_0x4928a8[_0x12e0('0x1f')]=_0x2f78ec;if(_0x2e73f7[_0x12e0('0x31')][_0x12e0('0x41')]){_0x45c5cd[_0x12e0('0x42')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x12e0('0x43')](_0x45c5cd);})['then'](function(_0x182321){_0x4928a8[_0x12e0('0x44')]=_0x182321;return _0x4928a8;})[_0x12e0('0x26')](respondWithFilteredResult(_0x3fc7a1,_0x45c5cd))[_0x12e0('0x45')](handleError(_0x3fc7a1,null));};exports[_0x12e0('0x46')]=function(_0x1f2d2e,_0x447c46){var _0x3acca1={'raw':!![],'where':{'id':_0x1f2d2e[_0x12e0('0x47')]['id']}},_0x45c875={};_0x45c875[_0x12e0('0x30')]=_['keys'](db[_0x12e0('0x48')][_0x12e0('0x2c')]);_0x45c875[_0x12e0('0x31')]=_[_0x12e0('0x49')](_0x1f2d2e[_0x12e0('0x31')]);_0x45c875[_0x12e0('0x32')]=_[_0x12e0('0x33')](_0x45c875[_0x12e0('0x30')],_0x45c875[_0x12e0('0x31')]);_0x3acca1[_0x12e0('0x35')]=_['intersection'](_0x45c875[_0x12e0('0x30')],qs[_0x12e0('0x34')](_0x1f2d2e['query'][_0x12e0('0x34')]));_0x3acca1['attributes']=_0x3acca1[_0x12e0('0x35')][_0x12e0('0x36')]?_0x3acca1[_0x12e0('0x35')]:_0x45c875[_0x12e0('0x30')];if(_0x1f2d2e[_0x12e0('0x31')]['includeAll']){_0x3acca1['include']=[{'all':!![]}];}_0x3acca1=_[_0x12e0('0x3e')]({},_0x3acca1,_0x1f2d2e[_0x12e0('0x40')]);return db[_0x12e0('0x48')][_0x12e0('0x4a')](_0x3acca1)[_0x12e0('0x26')](handleEntityNotFound(_0x447c46,null))[_0x12e0('0x26')](respondWithResult(_0x447c46,null))['catch'](handleError(_0x447c46,null));};exports[_0x12e0('0x4b')]=function(_0x2595cf,_0x2d188e){return db[_0x12e0('0x48')][_0x12e0('0x4b')](_0x2595cf[_0x12e0('0x4c')],{})[_0x12e0('0x26')](respondWithResult(_0x2d188e,0xc9))[_0x12e0('0x45')](handleError(_0x2d188e,null));};exports[_0x12e0('0x24')]=function(_0x4fa865,_0x4783da){if(_0x4fa865[_0x12e0('0x4c')]['id']){delete _0x4fa865['body']['id'];}return db[_0x12e0('0x48')]['find']({'where':{'id':_0x4fa865[_0x12e0('0x47')]['id']}})[_0x12e0('0x26')](handleEntityNotFound(_0x4783da,null))[_0x12e0('0x26')](saveUpdates(_0x4fa865[_0x12e0('0x4c')],null))['then'](respondWithResult(_0x4783da,null))[_0x12e0('0x45')](handleError(_0x4783da,null));};exports['destroy']=function(_0x4cb90b,_0x3bd7a6){return db[_0x12e0('0x48')]['find']({'where':{'id':_0x4cb90b[_0x12e0('0x47')]['id']}})[_0x12e0('0x26')](handleEntityNotFound(_0x3bd7a6,null))[_0x12e0('0x26')](removeEntity(_0x3bd7a6,null))[_0x12e0('0x45')](handleError(_0x3bd7a6,null));};exports[_0x12e0('0x4d')]=function(_0xd7791c,_0x2fd910){return db[_0x12e0('0x48')][_0x12e0('0x4d')]()[_0x12e0('0x26')](respondWithResult(_0x2fd910,null))[_0x12e0('0x45')](handleError(_0x2fd910,null));}; \ No newline at end of file +var _0x6032=['params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','SquareDetailsReport','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','rows','catch','show','rawAttributes','includeAll','find','body'];(function(_0x1ae8ab,_0x6e5c2a){var _0x1ad705=function(_0x1dfa15){while(--_0x1dfa15){_0x1ae8ab['push'](_0x1ae8ab['shift']());}};_0x1ad705(++_0x6e5c2a);}(_0x6032,0xe9));var _0x2603=function(_0x40fbc8,_0x1eb79f){_0x40fbc8=_0x40fbc8-0x0;var _0x1982d1=_0x6032[_0x40fbc8];return _0x1982d1;};'use strict';var emlformat=require(_0x2603('0x0'));var rimraf=require(_0x2603('0x1'));var zipdir=require(_0x2603('0x2'));var jsonpatch=require(_0x2603('0x3'));var rp=require('request-promise');var moment=require(_0x2603('0x4'));var BPromise=require(_0x2603('0x5'));var Mustache=require(_0x2603('0x6'));var util=require(_0x2603('0x7'));var path=require(_0x2603('0x8'));var sox=require(_0x2603('0x9'));var csv=require(_0x2603('0xa'));var ejs=require(_0x2603('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2603('0xc'));var jsforce=require(_0x2603('0xd'));var deskjs=require(_0x2603('0xe'));var toCsv=require(_0x2603('0xa'));var querystring=require(_0x2603('0xf'));var Papa=require('papaparse');var Redis=require(_0x2603('0x10'));var authService=require(_0x2603('0x11'));var qs=require(_0x2603('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2603('0x13'));var logger=require(_0x2603('0x14'))(_0x2603('0x15'));var utils=require(_0x2603('0x16'));var config=require(_0x2603('0x17'));var licenseUtil=require(_0x2603('0x18'));var db=require(_0x2603('0x19'))['db'];function respondWithStatusCode(_0x577d1f,_0x4d5513){_0x4d5513=_0x4d5513||0xcc;return function(_0x180b8f){if(_0x180b8f){return _0x577d1f['sendStatus'](_0x4d5513);}return _0x577d1f[_0x2603('0x1a')](_0x4d5513)['end']();};}function respondWithResult(_0x4c9c68,_0x4dc1be){_0x4dc1be=_0x4dc1be||0xc8;return function(_0x35cb73){if(_0x35cb73){return _0x4c9c68['status'](_0x4dc1be)[_0x2603('0x1b')](_0x35cb73);}};}function respondWithFilteredResult(_0x1d8d5a,_0x46fc07){return function(_0x5e6b94){if(_0x5e6b94){var _0x4d13ab=typeof _0x46fc07[_0x2603('0x1c')]==='undefined'&&typeof _0x46fc07['limit']===_0x2603('0x1d');var _0x257327=_0x5e6b94[_0x2603('0x1e')];var _0x2f5325=_0x4d13ab?0x0:_0x46fc07[_0x2603('0x1c')];var _0x9b1e91=_0x4d13ab?_0x5e6b94[_0x2603('0x1e')]:_0x46fc07[_0x2603('0x1c')]+_0x46fc07[_0x2603('0x1f')];var _0xebc424;if(_0x9b1e91>=_0x257327){_0x9b1e91=_0x257327;_0xebc424=0xc8;}else{_0xebc424=0xce;}_0x1d8d5a['status'](_0xebc424);return _0x1d8d5a[_0x2603('0x20')](_0x2603('0x21'),_0x2f5325+'-'+_0x9b1e91+'/'+_0x257327)[_0x2603('0x1b')](_0x5e6b94);}return null;};}function patchUpdates(_0x3afdee){return function(_0x4c5fab){try{jsonpatch[_0x2603('0x22')](_0x4c5fab,_0x3afdee,!![]);}catch(_0x8e97f4){return BPromise[_0x2603('0x23')](_0x8e97f4);}return _0x4c5fab[_0x2603('0x24')]();};}function saveUpdates(_0x211141,_0x41b21f){return function(_0x11ab1e){if(_0x11ab1e){return _0x11ab1e[_0x2603('0x25')](_0x211141)[_0x2603('0x26')](function(_0x2865f0){return _0x2865f0;});}return null;};}function removeEntity(_0x2b37b4,_0x4f4ab6){return function(_0xc78da1){if(_0xc78da1){return _0xc78da1[_0x2603('0x27')]()[_0x2603('0x26')](function(){_0x2b37b4[_0x2603('0x1a')](0xcc)[_0x2603('0x28')]();});}};}function handleEntityNotFound(_0x4049b4,_0x465b8a){return function(_0x5e70da){if(!_0x5e70da){_0x4049b4[_0x2603('0x29')](0x194);}return _0x5e70da;};}function handleError(_0x3de71b,_0x4488af){_0x4488af=_0x4488af||0x1f4;return function(_0x22ea52){logger[_0x2603('0x2a')](_0x22ea52[_0x2603('0x2b')]);if(_0x22ea52[_0x2603('0x2c')]){delete _0x22ea52[_0x2603('0x2c')];}_0x3de71b['status'](_0x4488af)[_0x2603('0x2d')](_0x22ea52);};}exports[_0x2603('0x2e')]=function(_0x3cb436,_0x3f4c63){var _0x1e84da={},_0x300762={},_0x348667={'count':0x0,'rows':[]};var _0x5433f1=_['map'](db[_0x2603('0x2f')]['rawAttributes'],function(_0x44c89d){return{'name':_0x44c89d[_0x2603('0x30')],'type':_0x44c89d[_0x2603('0x31')][_0x2603('0x32')]};});_0x300762[_0x2603('0x33')]=_[_0x2603('0x34')](_0x5433f1,_0x2603('0x2c'));_0x300762['query']=_[_0x2603('0x35')](_0x3cb436[_0x2603('0x36')]);_0x300762[_0x2603('0x37')]=_[_0x2603('0x38')](_0x300762[_0x2603('0x33')],_0x300762['query']);_0x1e84da[_0x2603('0x39')]=_[_0x2603('0x38')](_0x300762[_0x2603('0x33')],qs[_0x2603('0x3a')](_0x3cb436[_0x2603('0x36')]['fields']));_0x1e84da['attributes']=_0x1e84da[_0x2603('0x39')]['length']?_0x1e84da[_0x2603('0x39')]:_0x300762['model'];if(!_0x3cb436[_0x2603('0x36')][_0x2603('0x3b')](_0x2603('0x3c'))){_0x1e84da['limit']=qs['limit'](_0x3cb436[_0x2603('0x36')][_0x2603('0x1f')]);_0x1e84da[_0x2603('0x1c')]=qs[_0x2603('0x1c')](_0x3cb436[_0x2603('0x36')][_0x2603('0x1c')]);}_0x1e84da['order']=qs[_0x2603('0x3d')](_0x3cb436[_0x2603('0x36')][_0x2603('0x3d')]);_0x1e84da[_0x2603('0x3e')]=qs['filters'](_[_0x2603('0x3f')](_0x3cb436[_0x2603('0x36')],_0x300762[_0x2603('0x37')]),_0x5433f1);if(_0x3cb436['query'][_0x2603('0x40')]){_0x1e84da[_0x2603('0x3e')]=_['merge'](_0x1e84da['where'],{'$or':_['map'](_0x5433f1,function(_0x4f8a44){if(_0x4f8a44[_0x2603('0x31')]!=='VIRTUAL'){var _0x529d43={};_0x529d43[_0x4f8a44['name']]={'$like':'%'+_0x3cb436[_0x2603('0x36')][_0x2603('0x40')]+'%'};return _0x529d43;}})});}_0x1e84da=_[_0x2603('0x41')]({},_0x1e84da,_0x3cb436[_0x2603('0x42')]);var _0x29abb4={'where':_0x1e84da[_0x2603('0x3e')]};return db[_0x2603('0x2f')][_0x2603('0x1e')](_0x29abb4)[_0x2603('0x26')](function(_0x1f1c9c){_0x348667[_0x2603('0x1e')]=_0x1f1c9c;if(_0x3cb436[_0x2603('0x36')]['includeAll']){_0x1e84da[_0x2603('0x43')]=[{'all':!![]}];}return db[_0x2603('0x2f')]['findAll'](_0x1e84da);})['then'](function(_0x1818e4){_0x348667[_0x2603('0x44')]=_0x1818e4;return _0x348667;})[_0x2603('0x26')](respondWithFilteredResult(_0x3f4c63,_0x1e84da))[_0x2603('0x45')](handleError(_0x3f4c63,null));};exports[_0x2603('0x46')]=function(_0xe97157,_0x3671ad){var _0x463b18={'raw':!![],'where':{'id':_0xe97157['params']['id']}},_0x47119f={};_0x47119f[_0x2603('0x33')]=_['keys'](db[_0x2603('0x2f')][_0x2603('0x47')]);_0x47119f[_0x2603('0x36')]=_[_0x2603('0x35')](_0xe97157[_0x2603('0x36')]);_0x47119f[_0x2603('0x37')]=_[_0x2603('0x38')](_0x47119f[_0x2603('0x33')],_0x47119f['query']);_0x463b18[_0x2603('0x39')]=_['intersection'](_0x47119f['model'],qs[_0x2603('0x3a')](_0xe97157[_0x2603('0x36')][_0x2603('0x3a')]));_0x463b18[_0x2603('0x39')]=_0x463b18[_0x2603('0x39')]['length']?_0x463b18[_0x2603('0x39')]:_0x47119f[_0x2603('0x33')];if(_0xe97157[_0x2603('0x36')][_0x2603('0x48')]){_0x463b18[_0x2603('0x43')]=[{'all':!![]}];}_0x463b18=_['merge']({},_0x463b18,_0xe97157[_0x2603('0x42')]);return db[_0x2603('0x2f')][_0x2603('0x49')](_0x463b18)[_0x2603('0x26')](handleEntityNotFound(_0x3671ad,null))[_0x2603('0x26')](respondWithResult(_0x3671ad,null))[_0x2603('0x45')](handleError(_0x3671ad,null));};exports['create']=function(_0x420c0d,_0x31a9c1){return db[_0x2603('0x2f')]['create'](_0x420c0d[_0x2603('0x4a')],{})['then'](respondWithResult(_0x31a9c1,0xc9))[_0x2603('0x45')](handleError(_0x31a9c1,null));};exports['update']=function(_0x104b8b,_0x218131){if(_0x104b8b[_0x2603('0x4a')]['id']){delete _0x104b8b[_0x2603('0x4a')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x104b8b['params']['id']}})[_0x2603('0x26')](handleEntityNotFound(_0x218131,null))[_0x2603('0x26')](saveUpdates(_0x104b8b[_0x2603('0x4a')],null))[_0x2603('0x26')](respondWithResult(_0x218131,null))[_0x2603('0x45')](handleError(_0x218131,null));};exports[_0x2603('0x27')]=function(_0x219cd0,_0xf4a8a0){return db[_0x2603('0x2f')][_0x2603('0x49')]({'where':{'id':_0x219cd0[_0x2603('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf4a8a0,null))[_0x2603('0x26')](removeEntity(_0xf4a8a0,null))[_0x2603('0x45')](handleError(_0xf4a8a0,null));};exports[_0x2603('0x4c')]=function(_0x49036b,_0x1b1d48){return db[_0x2603('0x2f')][_0x2603('0x4c')]()[_0x2603('0x26')](respondWithResult(_0x1b1d48,null))[_0x2603('0x45')](handleError(_0x1b1d48,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 3fedcf5..e37c0ea 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 _0xd4b9=['request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','../../config/logger','moment','bluebird'];(function(_0x19ae97,_0x44324f){var _0x213322=function(_0x56fdcb){while(--_0x56fdcb){_0x19ae97['push'](_0x19ae97['shift']());}};_0x213322(++_0x44324f);}(_0xd4b9,0x17c));var _0x9d4b=function(_0x8c7fef,_0x1a3181){_0x8c7fef=_0x8c7fef-0x0;var _0x3cd805=_0xd4b9[_0x8c7fef];return _0x3cd805;};'use strict';var _=require(_0x9d4b('0x0'));var util=require('util');var logger=require(_0x9d4b('0x1'))('api');var moment=require(_0x9d4b('0x2'));var BPromise=require(_0x9d4b('0x3'));var rp=require(_0x9d4b('0x4'));var fs=require('fs');var path=require(_0x9d4b('0x5'));var rimraf=require(_0x9d4b('0x6'));var config=require(_0x9d4b('0x7'));var attributes=require(_0x9d4b('0x8'));module[_0x9d4b('0x9')]=function(_0x362b56,_0x1c1dd6){return _0x362b56[_0x9d4b('0xa')](_0x9d4b('0xb'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e1f=['api','moment','request-promise','rimraf','../../config/environment','exports','SquareDetailsReport','report_square_details','lodash','../../config/logger'];(function(_0x24c0bd,_0x189ebe){var _0x532644=function(_0x275c32){while(--_0x275c32){_0x24c0bd['push'](_0x24c0bd['shift']());}};_0x532644(++_0x189ebe);}(_0x5e1f,0x1c0));var _0xf5e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e1f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf5e1('0x0'));var util=require('util');var logger=require(_0xf5e1('0x1'))(_0xf5e1('0x2'));var moment=require(_0xf5e1('0x3'));var BPromise=require('bluebird');var rp=require(_0xf5e1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf5e1('0x5'));var config=require(_0xf5e1('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0xf5e1('0x7')]=function(_0x27e6cf,_0x440a63){return _0x27e6cf['define'](_0xf5e1('0x8'),attributes,{'tableName':_0xf5e1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index af96da9..3cfec07 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 _0x777d=['SquareDetailsReport','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareDetailsReport'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x777d,0xe9));var _0xd777=function(_0x36bf46,_0x3d8db9){_0x36bf46=_0x36bf46-0x0;var _0x1d0a72=_0x777d[_0x36bf46];return _0x1d0a72;};'use strict';var _=require('lodash');var util=require(_0xd777('0x0'));var moment=require(_0xd777('0x1'));var BPromise=require(_0xd777('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd777('0x3'));var db=require(_0xd777('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd777('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd777('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc7c954,_0x5d1a5f,_0x57d67f){return new BPromise(function(_0x49d55d,_0x197296){return client[_0xd777('0x7')](_0xc7c954,_0x57d67f)[_0xd777('0x8')](function(_0x25450d){logger[_0xd777('0x9')](_0xd777('0xa'),_0x5d1a5f,_0xd777('0xb'));logger[_0xd777('0xc')](_0xd777('0xd'),_0x5d1a5f,_0xd777('0xb'),JSON[_0xd777('0xe')](_0x25450d));if(_0x25450d[_0xd777('0xf')]){if(_0x25450d[_0xd777('0xf')]['code']===0x1f4){logger['error'](_0xd777('0xa'),_0x5d1a5f,_0x25450d['error'][_0xd777('0x10')]);return _0x197296(_0x25450d[_0xd777('0xf')][_0xd777('0x10')]);}logger[_0xd777('0xf')](_0xd777('0xa'),_0x5d1a5f,_0x25450d['error'][_0xd777('0x10')]);return _0x49d55d(_0x25450d['error'][_0xd777('0x10')]);}else{logger[_0xd777('0x9')](_0xd777('0xa'),_0x5d1a5f,_0xd777('0xb'));_0x49d55d(_0x25450d[_0xd777('0x11')]['message']);}})[_0xd777('0x12')](function(_0x4b3d52){logger[_0xd777('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x5d1a5f,_0x4b3d52);_0x197296(_0x4b3d52);});});}exports[_0xd777('0x13')]=function(_0x386f1a){var _0x2dd8ec=this;return new Promise(function(_0x13b63b,_0x2c6114){return db[_0xd777('0x14')]['create'](_0x386f1a['body'],{'raw':_0x386f1a[_0xd777('0x15')]?_0x386f1a['options'][_0xd777('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x58a079){logger['info'](_0xd777('0x13'),_0x386f1a);logger['debug']('CreateSquareDetailsReport',_0x386f1a,JSON['stringify'](_0x58a079));_0x13b63b(_0x58a079);})['catch'](function(_0x55b975){logger[_0xd777('0xf')](_0xd777('0x13'),_0x55b975[_0xd777('0x10')],_0x386f1a);_0x2c6114(_0x2dd8ec[_0xd777('0xf')](0x1f4,_0x55b975[_0xd777('0x10')]));});});}; \ No newline at end of file +var _0x693f=['code','message','info','SquareDetailsReport,\x20%s,\x20%s','result','catch','SquareDetailsReport','create','body','options','raw','CreateSquareDetailsReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','debug','request\x20sent','stringify','error'];(function(_0x303d22,_0x4da493){var _0x19e2cf=function(_0x11d276){while(--_0x11d276){_0x303d22['push'](_0x303d22['shift']());}};_0x19e2cf(++_0x4da493);}(_0x693f,0x9d));var _0xf693=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x693f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf693('0x0'));var util=require(_0xf693('0x1'));var moment=require(_0xf693('0x2'));var BPromise=require(_0xf693('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf693('0x4'));var db=require(_0xf693('0x5'))['db'];var utils=require(_0xf693('0x6'));var logger=require(_0xf693('0x7'))(_0xf693('0x8'));var config=require(_0xf693('0x9'));var jayson=require(_0xf693('0xa'));var client=jayson['client'][_0xf693('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33305c,_0x5b91c5,_0x22f362){return new BPromise(function(_0x594505,_0x38e78a){return client['request'](_0x33305c,_0x22f362)[_0xf693('0xc')](function(_0x17075d){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x5b91c5,'request\x20sent');logger[_0xf693('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5b91c5,_0xf693('0xe'),JSON[_0xf693('0xf')](_0x17075d));if(_0x17075d[_0xf693('0x10')]){if(_0x17075d[_0xf693('0x10')][_0xf693('0x11')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x5b91c5,_0x17075d[_0xf693('0x10')][_0xf693('0x12')]);return _0x38e78a(_0x17075d['error'][_0xf693('0x12')]);}logger[_0xf693('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x5b91c5,_0x17075d['error'][_0xf693('0x12')]);return _0x594505(_0x17075d[_0xf693('0x10')][_0xf693('0x12')]);}else{logger[_0xf693('0x13')](_0xf693('0x14'),_0x5b91c5,'request\x20sent');_0x594505(_0x17075d[_0xf693('0x15')][_0xf693('0x12')]);}})[_0xf693('0x16')](function(_0x2a5e1b){logger[_0xf693('0x10')](_0xf693('0x14'),_0x5b91c5,_0x2a5e1b);_0x38e78a(_0x2a5e1b);});});}exports['CreateSquareDetailsReport']=function(_0x5e02e0){var _0x4a5964=this;return new Promise(function(_0x2474d4,_0xf4d20e){return db[_0xf693('0x17')][_0xf693('0x18')](_0x5e02e0[_0xf693('0x19')],{'raw':_0x5e02e0['options']?_0x5e02e0[_0xf693('0x1a')][_0xf693('0x1b')]===undefined?!![]:![]:!![]})[_0xf693('0xc')](function(_0x31b887){logger[_0xf693('0x13')](_0xf693('0x1c'),_0x5e02e0);logger[_0xf693('0xd')](_0xf693('0x1c'),_0x5e02e0,JSON['stringify'](_0x31b887));_0x2474d4(_0x31b887);})[_0xf693('0x16')](function(_0x1188c6){logger[_0xf693('0x10')](_0xf693('0x1c'),_0x1188c6[_0xf693('0x12')],_0x5e02e0);_0xf4d20e(_0x4a5964[_0xf693('0x10')](0x1f4,_0x1188c6[_0xf693('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index a430489..b509588 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 _0x5639=['isAuthenticated','/process/:pid/kill','express','../../components/auth/service','./system.controller','get'];(function(_0x630c8,_0x16da45){var _0x375fb1=function(_0x5a48af){while(--_0x5a48af){_0x630c8['push'](_0x630c8['shift']());}};_0x375fb1(++_0x16da45);}(_0x5639,0x176));var _0x9563=function(_0x1905ca,_0x41386d){_0x1905ca=_0x1905ca-0x0;var _0x5a4cd4=_0x5639[_0x1905ca];return _0x5a4cd4;};'use strict';var express=require(_0x9563('0x0'));var router=express['Router']();var auth=require(_0x9563('0x1'));var controller=require(_0x9563('0x2'));router[_0x9563('0x3')]('/',auth[_0x9563('0x4')](),controller['index']);router[_0x9563('0x3')](_0x9563('0x5'),auth[_0x9563('0x4')](),controller['killProcess']);module['exports']=router; \ No newline at end of file +var _0xf8ff=['express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf8ff,0x157));var _0xff8f=function(_0x3d27a,_0x31311d){_0x3d27a=_0x3d27a-0x0;var _0x314fd7=_0xf8ff[_0x3d27a];return _0x314fd7;};'use strict';var express=require(_0xff8f('0x0'));var router=express[_0xff8f('0x1')]();var auth=require(_0xff8f('0x2'));var controller=require(_0xff8f('0x3'));router[_0xff8f('0x4')]('/',auth[_0xff8f('0x5')](),controller[_0xff8f('0x6')]);router['get']('/process/:pid/kill',auth['isAuthenticated'](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 03ef39a..593ca6d 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 _0xb6df=['<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','index','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger'];(function(_0x3b56c0,_0xe100d8){var _0x377efe=function(_0x181589){while(--_0x181589){_0x3b56c0['push'](_0x3b56c0['shift']());}};_0x377efe(++_0xe100d8);}(_0xb6df,0x134));var _0xfb6d=function(_0x5e5e13,_0x22a943){_0x5e5e13=_0x5e5e13-0x0;var _0x4d34aa=_0xb6df[_0x5e5e13];return _0x4d34aa;};'use strict';var info=require(_0xfb6d('0x0'));var exec=require(_0xfb6d('0x1'))[_0xfb6d('0x2')];var logger=require(_0xfb6d('0x3'))('api');var util=require('util');var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x144f47,_0x528fb3,_0x17b677){_0x528fb3=_0x528fb3||0x1f4;return function(_0x3ce5df){logger['error'](_0xfb6d('0x4'),_0x17b677,_0x528fb3,util[_0xfb6d('0x5')](_0x3ce5df,{'showHidden':![],'depth':null}));delete _0x3ce5df['name'];_0x144f47[_0xfb6d('0x6')](_0x528fb3)['send'](_0x3ce5df);};}exports[_0xfb6d('0x7')]=function(_0x2a86b9,_0x5c4ef3){return info['getAllData']()[_0xfb6d('0x8')](function(_0x2659d3){return _0x5c4ef3[_0xfb6d('0x6')](0xc8)[_0xfb6d('0x9')](_0x2659d3);})[_0xfb6d('0xa')](function(_0x225772){return _0x5c4ef3['status'](0x1f4)['json'](_0x225772);});};exports[_0xfb6d('0xb')]=function(_0x3c012d,_0xb6b06f){var _0x5b43e1=[_0xfb6d('0xc')];return new BPromise(function(_0xfffe4b,_0x31506e){return exec(util[_0xfb6d('0xd')](_0xfb6d('0xe'),_0x3c012d['params'][_0xfb6d('0xf')]),function(_0x1a3420,_0x849cfe,_0x230e97){if(_0x1a3420){return _0x31506e(_0x1a3420);}return _0xfffe4b(_0x849cfe);});})[_0xfb6d('0x8')](function(_0x24274c){var _0xbfef8f=![];var _0xb7d139=_0x24274c[_0xfb6d('0x10')](/\n/);for(var _0x58b087=0x0,_0x3d7f48=_0x5b43e1[_0xfb6d('0x11')];_0x58b087<_0x3d7f48,_0xbfef8f===![];_0x58b087+=0x1){if(_0x24274c[_0xfb6d('0x12')](_0x5b43e1[_0x58b087])>=0x0){_0xbfef8f=!![];}}if(!_0xbfef8f){throw new Error(util[_0xfb6d('0xd')](_0xfb6d('0x13'),_0x3c012d[_0xfb6d('0x14')][_0xfb6d('0xf')]));}process[_0xfb6d('0x15')](_0x3c012d[_0xfb6d('0x14')][_0xfb6d('0xf')],_0xfb6d('0x16'));return _0xb6b06f[_0xfb6d('0x6')](0xc8)[_0xfb6d('0x9')]({'message':util[_0xfb6d('0xd')](_0xfb6d('0x17'),_0x3c012d[_0xfb6d('0x14')]['pid'])});})['catch'](handleError(_0xb6b06f,null,_0xfb6d('0xb')));}; \ No newline at end of file +var _0x5524=['killProcess','components/import/cm','format','params','pid','split','length','indexOf','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','send','index','then','status','json','catch'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x5524,0x76));var _0x4552=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x5524[_0x1ac595];return _0x455fff;};'use strict';var info=require(_0x4552('0x0'));var exec=require(_0x4552('0x1'))[_0x4552('0x2')];var logger=require(_0x4552('0x3'))(_0x4552('0x4'));var util=require(_0x4552('0x5'));var BPromise=require(_0x4552('0x6'));var _=require(_0x4552('0x7'));function handleError(_0x2f9fd4,_0x58013c,_0x55acf9){_0x58013c=_0x58013c||0x1f4;return function(_0x33f371){logger[_0x4552('0x8')](_0x4552('0x9'),_0x55acf9,_0x58013c,util[_0x4552('0xa')](_0x33f371,{'showHidden':![],'depth':null}));delete _0x33f371['name'];_0x2f9fd4['status'](_0x58013c)[_0x4552('0xb')](_0x33f371);};}exports[_0x4552('0xc')]=function(_0x413383,_0x159d7b){return info['getAllData']()[_0x4552('0xd')](function(_0x215d1f){return _0x159d7b[_0x4552('0xe')](0xc8)[_0x4552('0xf')](_0x215d1f);})[_0x4552('0x10')](function(_0x1ecfbc){return _0x159d7b[_0x4552('0xe')](0x1f4)['json'](_0x1ecfbc);});};exports[_0x4552('0x11')]=function(_0x27752d,_0x38df99){var _0x20514b=[_0x4552('0x12')];return new BPromise(function(_0x249512,_0x3e9251){return exec(util[_0x4552('0x13')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x27752d[_0x4552('0x14')][_0x4552('0x15')]),function(_0x37e299,_0x5385a4,_0xe0f840){if(_0x37e299){return _0x3e9251(_0x37e299);}return _0x249512(_0x5385a4);});})[_0x4552('0xd')](function(_0x40b2c6){var _0x4f641a=![];var _0x1fc782=_0x40b2c6[_0x4552('0x16')](/\n/);for(var _0x363dd0=0x0,_0x8bbb89=_0x20514b[_0x4552('0x17')];_0x363dd0<_0x8bbb89,_0x4f641a===![];_0x363dd0+=0x1){if(_0x40b2c6[_0x4552('0x18')](_0x20514b[_0x363dd0])>=0x0){_0x4f641a=!![];}}if(!_0x4f641a){throw new Error(util[_0x4552('0x13')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x27752d['params'][_0x4552('0x15')]));}process['kill'](_0x27752d[_0x4552('0x14')][_0x4552('0x15')],_0x4552('0x19'));return _0x38df99[_0x4552('0xe')](0xc8)[_0x4552('0xf')]({'message':util['format'](_0x4552('0x1a'),_0x27752d['params'][_0x4552('0x15')])});})[_0x4552('0x10')](handleError(_0x38df99,null,_0x4552('0x11')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index ae4d9d3..ed55cb2 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 _0xece7=['../../components/interaction/service','get','isAuthenticated','/:id','create','put','update','delete','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0xece7,0x95));var _0x7ece=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xece7[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x7ece('0x0'));var util=require(_0x7ece('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7ece('0x2'));var router=express[_0x7ece('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7ece('0x4'));var interaction=require(_0x7ece('0x5'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x7ece('0x6')]('/',auth[_0x7ece('0x7')](),controller['index']);router[_0x7ece('0x6')](_0x7ece('0x8'),auth[_0x7ece('0x7')](),controller['show']);router['post']('/',auth[_0x7ece('0x7')](),controller[_0x7ece('0x9')]);router[_0x7ece('0xa')](_0x7ece('0x8'),auth[_0x7ece('0x7')](),controller[_0x7ece('0xb')]);router[_0x7ece('0xc')](_0x7ece('0x8'),auth[_0x7ece('0x7')](),controller['destroy']);module[_0x7ece('0xd')]=router; \ No newline at end of file +var _0xd7ab=['fs-extra','./tag.controller','index','get','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x59b910,_0x36868e){var _0x2624fa=function(_0xbf2517){while(--_0xbf2517){_0x59b910['push'](_0x59b910['shift']());}};_0x2624fa(++_0x36868e);}(_0xd7ab,0x14e));var _0xbd7a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd7ab[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xbd7a('0x0'));var util=require(_0xbd7a('0x1'));var path=require(_0xbd7a('0x2'));var timeout=require(_0xbd7a('0x3'));var express=require(_0xbd7a('0x4'));var router=express[_0xbd7a('0x5')]();var fs_extra=require(_0xbd7a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbd7a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xbd7a('0x8')]);router[_0xbd7a('0x9')](_0xbd7a('0xa'),auth['isAuthenticated'](),controller[_0xbd7a('0xb')]);router[_0xbd7a('0xc')]('/',auth['isAuthenticated'](),controller[_0xbd7a('0xd')]);router['put'](_0xbd7a('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xbd7a('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xbd7a('0xf')]);module[_0xbd7a('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 2acbae1..a849c47 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 _0x80cd=['name','#0091EA','exports','STRING'];(function(_0x24f059,_0x28538b){var _0x462f3d=function(_0xf91068){while(--_0xf91068){_0x24f059['push'](_0x24f059['shift']());}};_0x462f3d(++_0x28538b);}(_0x80cd,0x146));var _0xd80c=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x80cd[_0x5037ab];return _0x512adb;};'use strict';var Sequelize=require('sequelize');module[_0xd80c('0x0')]={'name':{'type':Sequelize[_0xd80c('0x1')],'unique':_0xd80c('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xd80c('0x1')],'defaultValue':_0xd80c('0x3')},'description':{'type':Sequelize[_0xd80c('0x1')]}}; \ No newline at end of file +var _0x705f=['#0091EA','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x705f,0x75));var _0xf705=function(_0x2cd1e4,_0x23d906){_0x2cd1e4=_0x2cd1e4-0x0;var _0x167374=_0x705f[_0x2cd1e4];return _0x167374;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf705('0x0')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf705('0x0')],'defaultValue':_0xf705('0x1')},'description':{'type':Sequelize[_0xf705('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index cbf6295..e07c754 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 _0xec56=['eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','Tag','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x16cb03,_0x43ea58){var _0x10944e=function(_0x27ebaa){while(--_0x27ebaa){_0x16cb03['push'](_0x16cb03['shift']());}};_0x10944e(++_0x43ea58);}(_0xec56,0x1bd));var _0x6ec5=function(_0x495a98,_0x29b129){_0x495a98=_0x495a98-0x0;var _0x25e582=_0xec56[_0x495a98];return _0x25e582;};'use strict';var emlformat=require(_0x6ec5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ec5('0x1'));var rp=require(_0x6ec5('0x2'));var moment=require(_0x6ec5('0x3'));var BPromise=require(_0x6ec5('0x4'));var Mustache=require(_0x6ec5('0x5'));var util=require(_0x6ec5('0x6'));var path=require(_0x6ec5('0x7'));var sox=require(_0x6ec5('0x8'));var csv=require(_0x6ec5('0x9'));var ejs=require(_0x6ec5('0xa'));var fs=require('fs');var fs_extra=require(_0x6ec5('0xb'));var _=require(_0x6ec5('0xc'));var squel=require(_0x6ec5('0xd'));var crypto=require(_0x6ec5('0xe'));var jsforce=require(_0x6ec5('0xf'));var deskjs=require(_0x6ec5('0x10'));var toCsv=require(_0x6ec5('0x9'));var querystring=require(_0x6ec5('0x11'));var Papa=require(_0x6ec5('0x12'));var Redis=require('ioredis');var authService=require(_0x6ec5('0x13'));var qs=require(_0x6ec5('0x14'));var as=require(_0x6ec5('0x15'));var hardwareService=require(_0x6ec5('0x16'));var logger=require(_0x6ec5('0x17'))(_0x6ec5('0x18'));var utils=require(_0x6ec5('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x6ec5('0x1a'));var db=require(_0x6ec5('0x1b'))['db'];function respondWithStatusCode(_0x2b1f61,_0xb04ab6){_0xb04ab6=_0xb04ab6||0xcc;return function(_0x135aaf){if(_0x135aaf){return _0x2b1f61[_0x6ec5('0x1c')](_0xb04ab6);}return _0x2b1f61[_0x6ec5('0x1d')](_0xb04ab6)[_0x6ec5('0x1e')]();};}function respondWithResult(_0x5166ad,_0x3ed07a){_0x3ed07a=_0x3ed07a||0xc8;return function(_0x4d1510){if(_0x4d1510){return _0x5166ad[_0x6ec5('0x1d')](_0x3ed07a)[_0x6ec5('0x1f')](_0x4d1510);}};}function respondWithFilteredResult(_0x4a4e3c,_0x9fc0e7){return function(_0xdc0b10){if(_0xdc0b10){var _0x4d09fe=typeof _0x9fc0e7[_0x6ec5('0x20')]===_0x6ec5('0x21')&&typeof _0x9fc0e7[_0x6ec5('0x22')]===_0x6ec5('0x21');var _0x23b3e3=_0xdc0b10[_0x6ec5('0x23')];var _0x1dbee9=_0x4d09fe?0x0:_0x9fc0e7[_0x6ec5('0x20')];var _0x2608c0=_0x4d09fe?_0xdc0b10[_0x6ec5('0x23')]:_0x9fc0e7[_0x6ec5('0x20')]+_0x9fc0e7[_0x6ec5('0x22')];var _0x437f0f;if(_0x2608c0>=_0x23b3e3){_0x2608c0=_0x23b3e3;_0x437f0f=0xc8;}else{_0x437f0f=0xce;}_0x4a4e3c[_0x6ec5('0x1d')](_0x437f0f);return _0x4a4e3c[_0x6ec5('0x24')](_0x6ec5('0x25'),_0x1dbee9+'-'+_0x2608c0+'/'+_0x23b3e3)[_0x6ec5('0x1f')](_0xdc0b10);}return null;};}function patchUpdates(_0x4abd5d){return function(_0x272532){try{jsonpatch[_0x6ec5('0x26')](_0x272532,_0x4abd5d,!![]);}catch(_0xd045b){return BPromise[_0x6ec5('0x27')](_0xd045b);}return _0x272532[_0x6ec5('0x28')]();};}function saveUpdates(_0x38a821,_0x18243f){return function(_0x48733b){if(_0x48733b){return _0x48733b[_0x6ec5('0x29')](_0x38a821)[_0x6ec5('0x2a')](function(_0x358d18){return _0x358d18;});}return null;};}function removeEntity(_0x1560c6,_0x57060c){return function(_0x27f631){if(_0x27f631){return _0x27f631[_0x6ec5('0x2b')]()['then'](function(){var _0x2dc0a7=_0x27f631[_0x6ec5('0x2c')]({'plain':!![]});var _0xb4d269='Tags';return db[_0x6ec5('0x2d')][_0x6ec5('0x2b')]({'where':{'type':_0xb4d269,'resourceId':_0x2dc0a7['id']}})[_0x6ec5('0x2a')](function(){return _0x27f631;});})[_0x6ec5('0x2a')](function(){_0x1560c6[_0x6ec5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x171e2a,_0x267a30){return function(_0x4a9860){if(!_0x4a9860){_0x171e2a[_0x6ec5('0x1c')](0x194);}return _0x4a9860;};}function handleError(_0x3f5ee0,_0x5c8c7d){_0x5c8c7d=_0x5c8c7d||0x1f4;return function(_0x3d36cb){logger[_0x6ec5('0x2e')](_0x3d36cb[_0x6ec5('0x2f')]);if(_0x3d36cb[_0x6ec5('0x30')]){delete _0x3d36cb[_0x6ec5('0x30')];}_0x3f5ee0['status'](_0x5c8c7d)[_0x6ec5('0x31')](_0x3d36cb);};}exports[_0x6ec5('0x32')]=function(_0x24aff9,_0x174164){var _0x3e6d33={},_0x22c3d3={},_0x394132={'count':0x0,'rows':[]};var _0x59a6de=_[_0x6ec5('0x33')](db['Tag'][_0x6ec5('0x34')],function(_0x5c6517){return{'name':_0x5c6517[_0x6ec5('0x35')],'type':_0x5c6517[_0x6ec5('0x36')]['key']};});_0x22c3d3['model']=_[_0x6ec5('0x33')](_0x59a6de,_0x6ec5('0x30'));_0x22c3d3['query']=_[_0x6ec5('0x37')](_0x24aff9[_0x6ec5('0x38')]);_0x22c3d3['filters']=_[_0x6ec5('0x39')](_0x22c3d3[_0x6ec5('0x3a')],_0x22c3d3[_0x6ec5('0x38')]);_0x3e6d33[_0x6ec5('0x3b')]=_[_0x6ec5('0x39')](_0x22c3d3[_0x6ec5('0x3a')],qs[_0x6ec5('0x3c')](_0x24aff9[_0x6ec5('0x38')]['fields']));_0x3e6d33[_0x6ec5('0x3b')]=_0x3e6d33['attributes'][_0x6ec5('0x3d')]?_0x3e6d33[_0x6ec5('0x3b')]:_0x22c3d3[_0x6ec5('0x3a')];if(!_0x24aff9[_0x6ec5('0x38')][_0x6ec5('0x3e')](_0x6ec5('0x3f'))){_0x3e6d33[_0x6ec5('0x22')]=qs[_0x6ec5('0x22')](_0x24aff9[_0x6ec5('0x38')][_0x6ec5('0x22')]);_0x3e6d33[_0x6ec5('0x20')]=qs['offset'](_0x24aff9['query'][_0x6ec5('0x20')]);}_0x3e6d33['order']=qs[_0x6ec5('0x40')](_0x24aff9[_0x6ec5('0x38')][_0x6ec5('0x40')]);_0x3e6d33[_0x6ec5('0x41')]=qs[_0x6ec5('0x42')](_[_0x6ec5('0x43')](_0x24aff9[_0x6ec5('0x38')],_0x22c3d3['filters']),_0x59a6de);if(_0x24aff9[_0x6ec5('0x38')][_0x6ec5('0x44')]){_0x3e6d33[_0x6ec5('0x41')]=_[_0x6ec5('0x45')](_0x3e6d33[_0x6ec5('0x41')],{'$or':_[_0x6ec5('0x33')](_0x59a6de,function(_0x74e78b){if(_0x74e78b[_0x6ec5('0x36')]!==_0x6ec5('0x46')){var _0x53dcd8={};_0x53dcd8[_0x74e78b[_0x6ec5('0x30')]]={'$like':'%'+_0x24aff9['query'][_0x6ec5('0x44')]+'%'};return _0x53dcd8;}})});}_0x3e6d33=_['merge']({},_0x3e6d33,_0x24aff9[_0x6ec5('0x47')]);var _0x45de3c={'where':_0x3e6d33['where']};return db[_0x6ec5('0x48')][_0x6ec5('0x23')](_0x45de3c)[_0x6ec5('0x2a')](function(_0x48c019){_0x394132[_0x6ec5('0x23')]=_0x48c019;if(_0x24aff9[_0x6ec5('0x38')]['includeAll']){_0x3e6d33[_0x6ec5('0x49')]=[{'all':!![]}];}return db[_0x6ec5('0x48')][_0x6ec5('0x4a')](_0x3e6d33);})[_0x6ec5('0x2a')](function(_0x43d858){_0x394132[_0x6ec5('0x4b')]=_0x43d858;return _0x394132;})[_0x6ec5('0x2a')](respondWithFilteredResult(_0x174164,_0x3e6d33))[_0x6ec5('0x4c')](handleError(_0x174164,null));};exports[_0x6ec5('0x4d')]=function(_0x5a7b9c,_0x96340b){var _0x4ee5f5={'raw':!![],'where':{'id':_0x5a7b9c[_0x6ec5('0x4e')]['id']}},_0x17cfed={};_0x17cfed[_0x6ec5('0x3a')]=_[_0x6ec5('0x37')](db['Tag'][_0x6ec5('0x34')]);_0x17cfed[_0x6ec5('0x38')]=_['keys'](_0x5a7b9c[_0x6ec5('0x38')]);_0x17cfed['filters']=_[_0x6ec5('0x39')](_0x17cfed[_0x6ec5('0x3a')],_0x17cfed[_0x6ec5('0x38')]);_0x4ee5f5[_0x6ec5('0x3b')]=_['intersection'](_0x17cfed['model'],qs[_0x6ec5('0x3c')](_0x5a7b9c['query'][_0x6ec5('0x3c')]));_0x4ee5f5[_0x6ec5('0x3b')]=_0x4ee5f5[_0x6ec5('0x3b')][_0x6ec5('0x3d')]?_0x4ee5f5[_0x6ec5('0x3b')]:_0x17cfed['model'];if(_0x5a7b9c['query'][_0x6ec5('0x4f')]){_0x4ee5f5[_0x6ec5('0x49')]=[{'all':!![]}];}_0x4ee5f5=_[_0x6ec5('0x45')]({},_0x4ee5f5,_0x5a7b9c[_0x6ec5('0x47')]);return db[_0x6ec5('0x48')][_0x6ec5('0x50')](_0x4ee5f5)[_0x6ec5('0x2a')](handleEntityNotFound(_0x96340b,null))[_0x6ec5('0x2a')](respondWithResult(_0x96340b,null))[_0x6ec5('0x4c')](handleError(_0x96340b,null));};exports[_0x6ec5('0x51')]=function(_0xd265c,_0x1c5e2f){return db[_0x6ec5('0x48')][_0x6ec5('0x51')](_0xd265c['body'],{})[_0x6ec5('0x2a')](function(_0x51709d){var _0x40b9cc=_0xd265c[_0x6ec5('0x52')]['get']({'plain':!![]});if(!_0x40b9cc)throw new Error(_0x6ec5('0x53'));if(_0x40b9cc[_0x6ec5('0x54')]==='user'){var _0x23a64d=_0x51709d[_0x6ec5('0x2c')]({'plain':!![]});var _0x486552='Tags';return db[_0x6ec5('0x55')]['find']({'where':{'name':_0x486552,'userProfileId':_0x40b9cc['userProfileId']},'raw':!![]})[_0x6ec5('0x2a')](function(_0x101966){if(_0x101966&&_0x101966[_0x6ec5('0x56')]===0x0){return db[_0x6ec5('0x2d')]['create']({'name':_0x23a64d[_0x6ec5('0x30')],'resourceId':_0x23a64d['id'],'type':_0x101966[_0x6ec5('0x30')],'sectionId':_0x101966['id']},{})[_0x6ec5('0x2a')](function(){return _0x51709d;});}else{return _0x51709d;}})[_0x6ec5('0x4c')](function(_0x9bde51){logger[_0x6ec5('0x2e')](_0x6ec5('0x57'),_0x9bde51);throw _0x9bde51;});}return _0x51709d;})[_0x6ec5('0x2a')](respondWithResult(_0x1c5e2f,0xc9))[_0x6ec5('0x4c')](handleError(_0x1c5e2f,null));};exports[_0x6ec5('0x29')]=function(_0x29317f,_0x4370f2){if(_0x29317f[_0x6ec5('0x58')]['id']){delete _0x29317f['body']['id'];}return db[_0x6ec5('0x48')][_0x6ec5('0x50')]({'where':{'id':_0x29317f['params']['id']}})[_0x6ec5('0x2a')](handleEntityNotFound(_0x4370f2,null))[_0x6ec5('0x2a')](saveUpdates(_0x29317f[_0x6ec5('0x58')],null))[_0x6ec5('0x2a')](respondWithResult(_0x4370f2,null))[_0x6ec5('0x4c')](handleError(_0x4370f2,null));};exports['destroy']=function(_0x5f3d3f,_0x282cbc){return db['Tag'][_0x6ec5('0x50')]({'where':{'id':_0x5f3d3f[_0x6ec5('0x4e')]['id']}})[_0x6ec5('0x2a')](handleEntityNotFound(_0x282cbc,null))[_0x6ec5('0x2a')](removeEntity(_0x282cbc,null))[_0x6ec5('0x4c')](handleError(_0x282cbc,null));}; \ No newline at end of file +var _0x2dae=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','save','update','then','get','Tags','UserProfileResource','destroy','stack','name','map','Tag','rawAttributes','type','key','model','query','keys'];(function(_0x26333b,_0x56470d){var _0x404306=function(_0x5b379e){while(--_0x5b379e){_0x26333b['push'](_0x26333b['shift']());}};_0x404306(++_0x56470d);}(_0x2dae,0xc3));var _0xe2da=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x2dae[_0x412e27];return _0x53da42;};'use strict';var emlformat=require(_0xe2da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe2da('0x1'));var jsonpatch=require(_0xe2da('0x2'));var rp=require(_0xe2da('0x3'));var moment=require(_0xe2da('0x4'));var BPromise=require(_0xe2da('0x5'));var Mustache=require('mustache');var util=require(_0xe2da('0x6'));var path=require(_0xe2da('0x7'));var sox=require(_0xe2da('0x8'));var csv=require(_0xe2da('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe2da('0xa'));var _=require(_0xe2da('0xb'));var squel=require(_0xe2da('0xc'));var crypto=require(_0xe2da('0xd'));var jsforce=require(_0xe2da('0xe'));var deskjs=require(_0xe2da('0xf'));var toCsv=require(_0xe2da('0x9'));var querystring=require(_0xe2da('0x10'));var Papa=require(_0xe2da('0x11'));var Redis=require('ioredis');var authService=require(_0xe2da('0x12'));var qs=require(_0xe2da('0x13'));var as=require(_0xe2da('0x14'));var hardwareService=require(_0xe2da('0x15'));var logger=require(_0xe2da('0x16'))(_0xe2da('0x17'));var utils=require(_0xe2da('0x18'));var config=require(_0xe2da('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe2da('0x1a'))['db'];function respondWithStatusCode(_0x5200b1,_0x4377c6){_0x4377c6=_0x4377c6||0xcc;return function(_0x245ad7){if(_0x245ad7){return _0x5200b1[_0xe2da('0x1b')](_0x4377c6);}return _0x5200b1[_0xe2da('0x1c')](_0x4377c6)[_0xe2da('0x1d')]();};}function respondWithResult(_0x5660b5,_0x295a86){_0x295a86=_0x295a86||0xc8;return function(_0x48584b){if(_0x48584b){return _0x5660b5[_0xe2da('0x1c')](_0x295a86)['json'](_0x48584b);}};}function respondWithFilteredResult(_0x586b27,_0x403d1c){return function(_0x3dfc52){if(_0x3dfc52){var _0x33f919=typeof _0x403d1c['offset']===_0xe2da('0x1e')&&typeof _0x403d1c[_0xe2da('0x1f')]===_0xe2da('0x1e');var _0x33568f=_0x3dfc52['count'];var _0x45bb92=_0x33f919?0x0:_0x403d1c[_0xe2da('0x20')];var _0x417363=_0x33f919?_0x3dfc52[_0xe2da('0x21')]:_0x403d1c[_0xe2da('0x20')]+_0x403d1c['limit'];var _0x56eeb1;if(_0x417363>=_0x33568f){_0x417363=_0x33568f;_0x56eeb1=0xc8;}else{_0x56eeb1=0xce;}_0x586b27[_0xe2da('0x1c')](_0x56eeb1);return _0x586b27['set'](_0xe2da('0x22'),_0x45bb92+'-'+_0x417363+'/'+_0x33568f)[_0xe2da('0x23')](_0x3dfc52);}return null;};}function patchUpdates(_0x332193){return function(_0x203d36){try{jsonpatch[_0xe2da('0x24')](_0x203d36,_0x332193,!![]);}catch(_0x3e22de){return BPromise['reject'](_0x3e22de);}return _0x203d36[_0xe2da('0x25')]();};}function saveUpdates(_0x53cc4e,_0x30efdc){return function(_0x191d38){if(_0x191d38){return _0x191d38[_0xe2da('0x26')](_0x53cc4e)[_0xe2da('0x27')](function(_0x30dea4){return _0x30dea4;});}return null;};}function removeEntity(_0x1e45e9,_0x38f2c4){return function(_0x221e98){if(_0x221e98){return _0x221e98['destroy']()[_0xe2da('0x27')](function(){var _0x357bff=_0x221e98[_0xe2da('0x28')]({'plain':!![]});var _0x14704d=_0xe2da('0x29');return db[_0xe2da('0x2a')][_0xe2da('0x2b')]({'where':{'type':_0x14704d,'resourceId':_0x357bff['id']}})['then'](function(){return _0x221e98;});})[_0xe2da('0x27')](function(){_0x1e45e9[_0xe2da('0x1c')](0xcc)[_0xe2da('0x1d')]();});}};}function handleEntityNotFound(_0x38ee5e,_0x36ca43){return function(_0x2b6c9e){if(!_0x2b6c9e){_0x38ee5e[_0xe2da('0x1b')](0x194);}return _0x2b6c9e;};}function handleError(_0x39f60e,_0x516f42){_0x516f42=_0x516f42||0x1f4;return function(_0x487a7c){logger['error'](_0x487a7c[_0xe2da('0x2c')]);if(_0x487a7c[_0xe2da('0x2d')]){delete _0x487a7c[_0xe2da('0x2d')];}_0x39f60e[_0xe2da('0x1c')](_0x516f42)['send'](_0x487a7c);};}exports['index']=function(_0x356ab4,_0x1ec8ca){var _0x262d40={},_0x39f983={},_0x7ab5ee={'count':0x0,'rows':[]};var _0x15df33=_[_0xe2da('0x2e')](db[_0xe2da('0x2f')][_0xe2da('0x30')],function(_0x499400){return{'name':_0x499400['fieldName'],'type':_0x499400[_0xe2da('0x31')][_0xe2da('0x32')]};});_0x39f983[_0xe2da('0x33')]=_[_0xe2da('0x2e')](_0x15df33,_0xe2da('0x2d'));_0x39f983[_0xe2da('0x34')]=_[_0xe2da('0x35')](_0x356ab4[_0xe2da('0x34')]);_0x39f983[_0xe2da('0x36')]=_[_0xe2da('0x37')](_0x39f983[_0xe2da('0x33')],_0x39f983[_0xe2da('0x34')]);_0x262d40[_0xe2da('0x38')]=_[_0xe2da('0x37')](_0x39f983[_0xe2da('0x33')],qs[_0xe2da('0x39')](_0x356ab4[_0xe2da('0x34')][_0xe2da('0x39')]));_0x262d40['attributes']=_0x262d40[_0xe2da('0x38')][_0xe2da('0x3a')]?_0x262d40[_0xe2da('0x38')]:_0x39f983['model'];if(!_0x356ab4[_0xe2da('0x34')][_0xe2da('0x3b')](_0xe2da('0x3c'))){_0x262d40['limit']=qs['limit'](_0x356ab4[_0xe2da('0x34')][_0xe2da('0x1f')]);_0x262d40['offset']=qs[_0xe2da('0x20')](_0x356ab4[_0xe2da('0x34')][_0xe2da('0x20')]);}_0x262d40[_0xe2da('0x3d')]=qs[_0xe2da('0x3e')](_0x356ab4['query'][_0xe2da('0x3e')]);_0x262d40['where']=qs['filters'](_[_0xe2da('0x3f')](_0x356ab4['query'],_0x39f983[_0xe2da('0x36')]),_0x15df33);if(_0x356ab4[_0xe2da('0x34')]['filter']){_0x262d40[_0xe2da('0x40')]=_[_0xe2da('0x41')](_0x262d40['where'],{'$or':_['map'](_0x15df33,function(_0x55be3e){if(_0x55be3e[_0xe2da('0x31')]!==_0xe2da('0x42')){var _0x26ba99={};_0x26ba99[_0x55be3e[_0xe2da('0x2d')]]={'$like':'%'+_0x356ab4[_0xe2da('0x34')][_0xe2da('0x43')]+'%'};return _0x26ba99;}})});}_0x262d40=_[_0xe2da('0x41')]({},_0x262d40,_0x356ab4['options']);var _0x3d1fd={'where':_0x262d40[_0xe2da('0x40')]};return db[_0xe2da('0x2f')][_0xe2da('0x21')](_0x3d1fd)[_0xe2da('0x27')](function(_0x5a1550){_0x7ab5ee[_0xe2da('0x21')]=_0x5a1550;if(_0x356ab4[_0xe2da('0x34')][_0xe2da('0x44')]){_0x262d40['include']=[{'all':!![]}];}return db[_0xe2da('0x2f')][_0xe2da('0x45')](_0x262d40);})[_0xe2da('0x27')](function(_0x4096c5){_0x7ab5ee[_0xe2da('0x46')]=_0x4096c5;return _0x7ab5ee;})[_0xe2da('0x27')](respondWithFilteredResult(_0x1ec8ca,_0x262d40))[_0xe2da('0x47')](handleError(_0x1ec8ca,null));};exports[_0xe2da('0x48')]=function(_0x4aec15,_0x21cc34){var _0x472d1e={'raw':!![],'where':{'id':_0x4aec15[_0xe2da('0x49')]['id']}},_0x2113e8={};_0x2113e8[_0xe2da('0x33')]=_['keys'](db[_0xe2da('0x2f')][_0xe2da('0x30')]);_0x2113e8[_0xe2da('0x34')]=_[_0xe2da('0x35')](_0x4aec15[_0xe2da('0x34')]);_0x2113e8[_0xe2da('0x36')]=_[_0xe2da('0x37')](_0x2113e8['model'],_0x2113e8[_0xe2da('0x34')]);_0x472d1e['attributes']=_[_0xe2da('0x37')](_0x2113e8[_0xe2da('0x33')],qs[_0xe2da('0x39')](_0x4aec15['query'][_0xe2da('0x39')]));_0x472d1e[_0xe2da('0x38')]=_0x472d1e['attributes'][_0xe2da('0x3a')]?_0x472d1e[_0xe2da('0x38')]:_0x2113e8[_0xe2da('0x33')];if(_0x4aec15['query'][_0xe2da('0x44')]){_0x472d1e['include']=[{'all':!![]}];}_0x472d1e=_['merge']({},_0x472d1e,_0x4aec15[_0xe2da('0x4a')]);return db['Tag'][_0xe2da('0x4b')](_0x472d1e)[_0xe2da('0x27')](handleEntityNotFound(_0x21cc34,null))['then'](respondWithResult(_0x21cc34,null))[_0xe2da('0x47')](handleError(_0x21cc34,null));};exports[_0xe2da('0x4c')]=function(_0x482547,_0x4a6d80){return db[_0xe2da('0x2f')]['create'](_0x482547[_0xe2da('0x4d')],{})[_0xe2da('0x27')](function(_0x259546){var _0x1c17f1=_0x482547[_0xe2da('0x4e')][_0xe2da('0x28')]({'plain':!![]});if(!_0x1c17f1)throw new Error(_0xe2da('0x4f'));if(_0x1c17f1[_0xe2da('0x50')]===_0xe2da('0x4e')){var _0x515f9b=_0x259546[_0xe2da('0x28')]({'plain':!![]});var _0x157c36=_0xe2da('0x29');return db['UserProfileSection'][_0xe2da('0x4b')]({'where':{'name':_0x157c36,'userProfileId':_0x1c17f1[_0xe2da('0x51')]},'raw':!![]})[_0xe2da('0x27')](function(_0x125118){if(_0x125118&&_0x125118[_0xe2da('0x52')]===0x0){return db[_0xe2da('0x2a')][_0xe2da('0x4c')]({'name':_0x515f9b['name'],'resourceId':_0x515f9b['id'],'type':_0x125118['name'],'sectionId':_0x125118['id']},{})[_0xe2da('0x27')](function(){return _0x259546;});}else{return _0x259546;}})[_0xe2da('0x47')](function(_0x28f916){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28f916);throw _0x28f916;});}return _0x259546;})[_0xe2da('0x27')](respondWithResult(_0x4a6d80,0xc9))['catch'](handleError(_0x4a6d80,null));};exports[_0xe2da('0x26')]=function(_0x153749,_0x8e78b9){if(_0x153749[_0xe2da('0x4d')]['id']){delete _0x153749[_0xe2da('0x4d')]['id'];}return db[_0xe2da('0x2f')][_0xe2da('0x4b')]({'where':{'id':_0x153749[_0xe2da('0x49')]['id']}})[_0xe2da('0x27')](handleEntityNotFound(_0x8e78b9,null))['then'](saveUpdates(_0x153749[_0xe2da('0x4d')],null))[_0xe2da('0x27')](respondWithResult(_0x8e78b9,null))[_0xe2da('0x47')](handleError(_0x8e78b9,null));};exports[_0xe2da('0x2b')]=function(_0x51d174,_0x25b8a7){return db[_0xe2da('0x2f')][_0xe2da('0x4b')]({'where':{'id':_0x51d174['params']['id']}})[_0xe2da('0x27')](handleEntityNotFound(_0x25b8a7,null))[_0xe2da('0x27')](removeEntity(_0x25b8a7,null))[_0xe2da('0x47')](handleError(_0x25b8a7,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index f6f7c50..f472125 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 _0x2c83=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','Tag','tools_tags','lodash','util'];(function(_0x32fe53,_0x47b060){var _0x4c71ed=function(_0x1ffd6e){while(--_0x1ffd6e){_0x32fe53['push'](_0x32fe53['shift']());}};_0x4c71ed(++_0x47b060);}(_0x2c83,0x15a));var _0x32c8=function(_0x6eca0c,_0x156573){_0x6eca0c=_0x6eca0c-0x0;var _0x48d25e=_0x2c83[_0x6eca0c];return _0x48d25e;};'use strict';var _=require(_0x32c8('0x0'));var util=require(_0x32c8('0x1'));var logger=require(_0x32c8('0x2'))('api');var moment=require(_0x32c8('0x3'));var BPromise=require(_0x32c8('0x4'));var rp=require(_0x32c8('0x5'));var fs=require('fs');var path=require(_0x32c8('0x6'));var rimraf=require('rimraf');var config=require(_0x32c8('0x7'));var attributes=require('./tag.attributes');module[_0x32c8('0x8')]=function(_0x25bbb8,_0x72e38c){return _0x25bbb8[_0x32c8('0x9')](_0x32c8('0xa'),attributes,{'tableName':_0x32c8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfba1=['bluebird','request-promise','path','rimraf','define','Tag','tools_tags','lodash','../../config/logger','api','moment'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0xfba1,0x1ca));var _0x1fba=function(_0x26df85,_0x3a84a8){_0x26df85=_0x26df85-0x0;var _0x19d2b2=_0xfba1[_0x26df85];return _0x19d2b2;};'use strict';var _=require(_0x1fba('0x0'));var util=require('util');var logger=require(_0x1fba('0x1'))(_0x1fba('0x2'));var moment=require(_0x1fba('0x3'));var BPromise=require(_0x1fba('0x4'));var rp=require(_0x1fba('0x5'));var fs=require('fs');var path=require(_0x1fba('0x6'));var rimraf=require(_0x1fba('0x7'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module['exports']=function(_0x252644,_0x5504ba){return _0x252644[_0x1fba('0x8')](_0x1fba('0x9'),attributes,{'tableName':_0x1fba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 1adf1b7..59cece8 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 _0xae79=['request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s'];(function(_0x548936,_0x197e9e){var _0x3f8efd=function(_0x13921e){while(--_0x13921e){_0x548936['push'](_0x548936['shift']());}};_0x3f8efd(++_0x197e9e);}(_0xae79,0x1d3));var _0x9ae7=function(_0x464af6,_0xa18e44){_0x464af6=_0x464af6-0x0;var _0x21d861=_0xae79[_0x464af6];return _0x21d861;};'use strict';var _=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var moment=require(_0x9ae7('0x2'));var BPromise=require(_0x9ae7('0x3'));var rs=require(_0x9ae7('0x4'));var fs=require('fs');var Redis=require(_0x9ae7('0x5'));var db=require(_0x9ae7('0x6'))['db'];var utils=require(_0x9ae7('0x7'));var logger=require(_0x9ae7('0x8'))(_0x9ae7('0x9'));var config=require(_0x9ae7('0xa'));var jayson=require(_0x9ae7('0xb'));var client=jayson[_0x9ae7('0xc')][_0x9ae7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x409d34,_0x57114d,_0x2761c2){return new BPromise(function(_0x47774e,_0x3c7738){return client[_0x9ae7('0xe')](_0x409d34,_0x2761c2)[_0x9ae7('0xf')](function(_0xc023d2){logger['info'](_0x9ae7('0x10'),_0x57114d,'request\x20sent');logger[_0x9ae7('0x11')](_0x9ae7('0x12'),_0x57114d,_0x9ae7('0x13'),JSON[_0x9ae7('0x14')](_0xc023d2));if(_0xc023d2[_0x9ae7('0x15')]){if(_0xc023d2[_0x9ae7('0x15')][_0x9ae7('0x16')]===0x1f4){logger['error'](_0x9ae7('0x10'),_0x57114d,_0xc023d2[_0x9ae7('0x15')]['message']);return _0x3c7738(_0xc023d2[_0x9ae7('0x15')][_0x9ae7('0x17')]);}logger[_0x9ae7('0x15')](_0x9ae7('0x10'),_0x57114d,_0xc023d2[_0x9ae7('0x15')][_0x9ae7('0x17')]);return _0x47774e(_0xc023d2[_0x9ae7('0x15')]['message']);}else{logger[_0x9ae7('0x18')](_0x9ae7('0x10'),_0x57114d,_0x9ae7('0x13'));_0x47774e(_0xc023d2[_0x9ae7('0x19')]['message']);}})[_0x9ae7('0x1a')](function(_0xe1a2d1){logger[_0x9ae7('0x15')]('Tag,\x20%s,\x20%s',_0x57114d,_0xe1a2d1);_0x3c7738(_0xe1a2d1);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x417caa,_0x272bbe){var _0x488876=function(_0x904f36){while(--_0x904f36){_0x417caa['push'](_0x417caa['shift']());}};_0x488876(++_0x272bbe);}(_0xa41a,0x6b));var _0xaa41=function(_0x13422a,_0x19a36c){_0x13422a=_0x13422a-0x0;var _0x4a9ea9=_0xa41a[_0x13422a];return _0x4a9ea9;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 070c9c4..2307e6f 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 985d3ca..0ed83d4 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(_0x41a7b5,_0xaf3bad){var _0x7605dd=function(_0x267987){while(--_0x267987){_0x41a7b5['push'](_0x41a7b5['shift']());}};_0x7605dd(++_0xaf3bad);}(_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 _0xb10b=['name','sequelize','STRING'];(function(_0x2794ef,_0x4e5989){var _0x3238e7=function(_0x13e13b){while(--_0x13e13b){_0x2794ef['push'](_0x2794ef['shift']());}};_0x3238e7(++_0x4e5989);}(_0xb10b,0x12a));var _0xbb10=function(_0xa1ae5c,_0x44beef){_0xa1ae5c=_0xa1ae5c-0x0;var _0x4573c1=_0xb10b[_0xa1ae5c];return _0x4573c1;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 2198d74..7071131 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 _0xf06d=['show','params','rawAttributes','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','body','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','destroy','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','end','getQueues','findOne','channel','Unknown\x20channel','capitalize','toLowerCase','sort','Queues','isValidChannel','ValidationError','add','ids','removeQueues','remove','isArray','Voice','Chat','Mail','Fax','Openchannel','penalty','QueueId','User','Queue','emit','online','interface','upsert','isNil','format','SIP/%s','voicePause','TeamVoiceQueue','all','addAgents','removeAgents','Sms','Queue:remove','UserVoiceQueueRt','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','Team','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','catch'];(function(_0x3ebe7b,_0xe64301){var _0x64192d=function(_0x32e399){while(--_0x32e399){_0x3ebe7b['push'](_0x3ebe7b['shift']());}};_0x64192d(++_0xe64301);}(_0xf06d,0xe1));var _0xdf06=function(_0x3bc2a,_0x17f6e3){_0x3bc2a=_0x3bc2a-0x0;var _0xa129f9=_0xf06d[_0x3bc2a];return _0xa129f9;};'use strict';var emlformat=require(_0xdf06('0x0'));var rimraf=require(_0xdf06('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf06('0x2'));var rp=require(_0xdf06('0x3'));var moment=require(_0xdf06('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdf06('0x5'));var sox=require(_0xdf06('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf06('0x7'));var _=require(_0xdf06('0x8'));var squel=require(_0xdf06('0x9'));var crypto=require(_0xdf06('0xa'));var jsforce=require(_0xdf06('0xb'));var deskjs=require(_0xdf06('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf06('0xd'));var Redis=require(_0xdf06('0xe'));var authService=require(_0xdf06('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf06('0x10'));var logger=require(_0xdf06('0x11'))(_0xdf06('0x12'));var utils=require(_0xdf06('0x13'));var config=require(_0xdf06('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf06('0x15'))['db'];config['redis']=_[_0xdf06('0x16')](config[_0xdf06('0x17')],{'host':_0xdf06('0x18'),'port':0x18eb});var socket=require(_0xdf06('0x19'))(new Redis(config[_0xdf06('0x17')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x570189,_0x1fe609){_0x1fe609=_0x1fe609||0xcc;return function(_0x565c7f){if(_0x565c7f){return _0x570189[_0xdf06('0x1a')](_0x1fe609);}return _0x570189[_0xdf06('0x1b')](_0x1fe609)['end']();};}function respondWithResult(_0x51a31b,_0x15e429){_0x15e429=_0x15e429||0xc8;return function(_0x5ba783){if(_0x5ba783){return _0x51a31b[_0xdf06('0x1b')](_0x15e429)[_0xdf06('0x1c')](_0x5ba783);}};}function respondWithFilteredResult(_0x946ef3,_0x45d2ed){return function(_0x3d1cb1){if(_0x3d1cb1){var _0x38c5cc=typeof _0x45d2ed[_0xdf06('0x1d')]===_0xdf06('0x1e')&&typeof _0x45d2ed[_0xdf06('0x1f')]===_0xdf06('0x1e');var _0x385305=_0x3d1cb1[_0xdf06('0x20')];var _0x581d2d=_0x38c5cc?0x0:_0x45d2ed[_0xdf06('0x1d')];var _0x2ae4fd=_0x38c5cc?_0x3d1cb1[_0xdf06('0x20')]:_0x45d2ed[_0xdf06('0x1d')]+_0x45d2ed[_0xdf06('0x1f')];var _0x402819;if(_0x2ae4fd>=_0x385305){_0x2ae4fd=_0x385305;_0x402819=0xc8;}else{_0x402819=0xce;}_0x946ef3[_0xdf06('0x1b')](_0x402819);return _0x946ef3['set'](_0xdf06('0x21'),_0x581d2d+'-'+_0x2ae4fd+'/'+_0x385305)[_0xdf06('0x1c')](_0x3d1cb1);}return null;};}function patchUpdates(_0x2aac53){return function(_0x441ee6){try{jsonpatch[_0xdf06('0x22')](_0x441ee6,_0x2aac53,!![]);}catch(_0x12d806){return BPromise[_0xdf06('0x23')](_0x12d806);}return _0x441ee6[_0xdf06('0x24')]();};}function saveUpdates(_0x52f5cb,_0x34f66b){return function(_0x3795da){if(_0x3795da){return _0x3795da[_0xdf06('0x25')](_0x52f5cb)[_0xdf06('0x26')](function(_0x4c4d34){return _0x4c4d34;});}return null;};}function handleEntityNotFound(_0x20e14f,_0x220130){return function(_0x335d71){if(!_0x335d71){_0x20e14f['sendStatus'](0x194);}return _0x335d71;};}function handleError(_0x802e76,_0x4bd289){_0x4bd289=_0x4bd289||0x1f4;return function(_0x32b29f){logger[_0xdf06('0x27')](_0x32b29f[_0xdf06('0x28')]);if(_0x32b29f['name']){delete _0x32b29f[_0xdf06('0x29')];}_0x802e76['status'](_0x4bd289)[_0xdf06('0x2a')](_0x32b29f);};}exports[_0xdf06('0x2b')]=function(_0x1cf020,_0x1a1a54){var _0x4482e1={},_0x3fe4d7={},_0x263f44={'count':0x0,'rows':[]};var _0x459c9e=_[_0xdf06('0x2c')](db[_0xdf06('0x2d')]['rawAttributes'],function(_0x189905){return{'name':_0x189905[_0xdf06('0x2e')],'type':_0x189905[_0xdf06('0x2f')][_0xdf06('0x30')]};});_0x3fe4d7[_0xdf06('0x31')]=_[_0xdf06('0x2c')](_0x459c9e,'name');_0x3fe4d7[_0xdf06('0x32')]=_[_0xdf06('0x33')](_0x1cf020[_0xdf06('0x32')]);_0x3fe4d7[_0xdf06('0x34')]=_[_0xdf06('0x35')](_0x3fe4d7[_0xdf06('0x31')],_0x3fe4d7[_0xdf06('0x32')]);_0x4482e1['attributes']=_[_0xdf06('0x35')](_0x3fe4d7['model'],qs[_0xdf06('0x36')](_0x1cf020[_0xdf06('0x32')]['fields']));_0x4482e1['attributes']=_0x4482e1['attributes'][_0xdf06('0x37')]?_0x4482e1[_0xdf06('0x38')]:_0x3fe4d7[_0xdf06('0x31')];if(!_0x1cf020['query'][_0xdf06('0x39')](_0xdf06('0x3a'))){_0x4482e1[_0xdf06('0x1f')]=qs[_0xdf06('0x1f')](_0x1cf020[_0xdf06('0x32')][_0xdf06('0x1f')]);_0x4482e1['offset']=qs[_0xdf06('0x1d')](_0x1cf020['query'][_0xdf06('0x1d')]);}_0x4482e1[_0xdf06('0x3b')]=qs['sort'](_0x1cf020[_0xdf06('0x32')]['sort']);_0x4482e1[_0xdf06('0x3c')]=qs[_0xdf06('0x34')](_[_0xdf06('0x3d')](_0x1cf020[_0xdf06('0x32')],_0x3fe4d7[_0xdf06('0x34')]),_0x459c9e);if(_0x1cf020[_0xdf06('0x32')][_0xdf06('0x3e')]){_0x4482e1[_0xdf06('0x3c')]=_['merge'](_0x4482e1[_0xdf06('0x3c')],{'$or':_['map'](_0x459c9e,function(_0x4e2267){if(_0x4e2267[_0xdf06('0x2f')]!=='VIRTUAL'){var _0x5e6c6c={};_0x5e6c6c[_0x4e2267[_0xdf06('0x29')]]={'$like':'%'+_0x1cf020[_0xdf06('0x32')][_0xdf06('0x3e')]+'%'};return _0x5e6c6c;}})});}_0x4482e1=_[_0xdf06('0x3f')]({},_0x4482e1,_0x1cf020[_0xdf06('0x40')]);var _0x5c7f1b={'where':_0x4482e1[_0xdf06('0x3c')]};return db['Team'][_0xdf06('0x20')](_0x5c7f1b)[_0xdf06('0x26')](function(_0x29055c){_0x263f44['count']=_0x29055c;if(_0x1cf020[_0xdf06('0x32')][_0xdf06('0x41')]){_0x4482e1[_0xdf06('0x42')]=[{'all':!![]}];}return db[_0xdf06('0x2d')][_0xdf06('0x43')](_0x4482e1);})[_0xdf06('0x26')](function(_0x19496f){_0x263f44['rows']=_0x19496f;return _0x263f44;})[_0xdf06('0x26')](respondWithFilteredResult(_0x1a1a54,_0x4482e1))[_0xdf06('0x44')](handleError(_0x1a1a54,null));};exports[_0xdf06('0x45')]=function(_0x55c7a0,_0x241e3d){var _0x27b313={'raw':![],'where':{'id':_0x55c7a0[_0xdf06('0x46')]['id']}},_0x2906c6={};_0x2906c6[_0xdf06('0x31')]=_[_0xdf06('0x33')](db[_0xdf06('0x2d')][_0xdf06('0x47')]);_0x2906c6[_0xdf06('0x32')]=_['keys'](_0x55c7a0[_0xdf06('0x32')]);_0x2906c6['filters']=_[_0xdf06('0x35')](_0x2906c6[_0xdf06('0x31')],_0x2906c6[_0xdf06('0x32')]);_0x27b313[_0xdf06('0x38')]=_[_0xdf06('0x35')](_0x2906c6[_0xdf06('0x31')],qs[_0xdf06('0x36')](_0x55c7a0[_0xdf06('0x32')]['fields']));_0x27b313[_0xdf06('0x38')]=_0x27b313[_0xdf06('0x38')][_0xdf06('0x37')]?_0x27b313[_0xdf06('0x38')]:_0x2906c6['model'];if(_0x55c7a0[_0xdf06('0x32')][_0xdf06('0x41')]){_0x27b313[_0xdf06('0x42')]=[{'all':!![]}];}_0x27b313=_[_0xdf06('0x3f')]({},_0x27b313,_0x55c7a0[_0xdf06('0x40')]);return db[_0xdf06('0x2d')][_0xdf06('0x48')](_0x27b313)['then'](handleEntityNotFound(_0x241e3d,null))[_0xdf06('0x26')](respondWithResult(_0x241e3d,null))[_0xdf06('0x44')](handleError(_0x241e3d,null));};exports[_0xdf06('0x49')]=function(_0x40e4ed,_0x316f62){return db[_0xdf06('0x2d')][_0xdf06('0x49')](_0x40e4ed['body'],{})[_0xdf06('0x26')](function(_0x2a69af){var _0x92d8bc=_0x40e4ed['user'][_0xdf06('0x4a')]({'plain':!![]});if(!_0x92d8bc)throw new Error(_0xdf06('0x4b'));if(_0x92d8bc[_0xdf06('0x4c')]===_0xdf06('0x4d')){var _0x2d8654=_0x2a69af[_0xdf06('0x4a')]({'plain':!![]});var _0x110951='Teams';return db['UserProfileSection'][_0xdf06('0x48')]({'where':{'name':_0x110951,'userProfileId':_0x92d8bc[_0xdf06('0x4e')]},'raw':!![]})[_0xdf06('0x26')](function(_0x4ca843){if(_0x4ca843&&_0x4ca843[_0xdf06('0x4f')]===0x0){return db[_0xdf06('0x50')]['create']({'name':_0x2d8654[_0xdf06('0x29')],'resourceId':_0x2d8654['id'],'type':_0x4ca843[_0xdf06('0x29')],'sectionId':_0x4ca843['id']},{})[_0xdf06('0x26')](function(){return _0x2a69af;});}else{return _0x2a69af;}})[_0xdf06('0x44')](function(_0x2c2197){logger[_0xdf06('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c2197);throw _0x2c2197;});}return _0x2a69af;})[_0xdf06('0x26')](respondWithResult(_0x316f62,0xc9))[_0xdf06('0x44')](handleError(_0x316f62,null));};exports[_0xdf06('0x25')]=function(_0x281c6b,_0x3d1879){if(_0x281c6b[_0xdf06('0x51')]['id']){delete _0x281c6b['body']['id'];}return db[_0xdf06('0x2d')][_0xdf06('0x48')]({'where':{'id':_0x281c6b['params']['id']}})[_0xdf06('0x26')](handleEntityNotFound(_0x3d1879,null))[_0xdf06('0x26')](saveUpdates(_0x281c6b[_0xdf06('0x51')],null))['then'](respondWithResult(_0x3d1879,null))[_0xdf06('0x44')](handleError(_0x3d1879,null));};exports['destroy']=function(_0xa177b9,_0x489107){var _0x1f7c49=_0xa177b9[_0xdf06('0x46')]['id'];var _0x380c20=[];return db[_0xdf06('0x52')][_0xdf06('0x53')](function(_0x1c437b){var _0x43c0a5=_0xdf06('0x54')+_0x1f7c49;return db[_0xdf06('0x52')][_0xdf06('0x32')](_0x43c0a5,{'type':db[_0xdf06('0x55')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x1c437b})[_0xdf06('0x26')](function(_0x28a333){_0x380c20=_[_0xdf06('0x2c')](_0x28a333,function(_0x4070c6){return Number(_0x4070c6['UserId']);});})[_0xdf06('0x26')](function(){var _0x29f7cf=_0xdf06('0x56')+_0x1f7c49;return db[_0xdf06('0x52')]['query'](_0x29f7cf,{'type':db[_0xdf06('0x55')][_0xdf06('0x57')][_0xdf06('0x58')],'raw':!![],'transaction':_0x1c437b});})[_0xdf06('0x26')](function(_0x5bf0d5){var _0x30faa5=_[_0xdf06('0x2c')](_0x5bf0d5,function(_0x234318){return Number(_0x234318[_0xdf06('0x59')]);});return db[_0xdf06('0x5a')]['destroy']({'where':{'UserId':{'$in':_0x380c20},'VoiceQueueId':{'$in':_0x30faa5}},'transaction':_0x1c437b});})[_0xdf06('0x26')](function(){var _0x4b7d05=_0xdf06('0x5b')+_0x1f7c49;return db[_0xdf06('0x52')][_0xdf06('0x32')](_0x4b7d05,{'type':db['Sequelize']['QueryTypes'][_0xdf06('0x58')],'raw':!![],'transaction':_0x1c437b});})[_0xdf06('0x26')](function(_0x1fb366){var _0x450557=_['map'](_0x1fb366,function(_0x2e28a3){return Number(_0x2e28a3['MailQueueId']);});return db[_0xdf06('0x5c')][_0xdf06('0x5d')]({'where':{'UserId':{'$in':_0x380c20},'MailQueueId':{'$in':_0x450557}},'transaction':_0x1c437b});})[_0xdf06('0x26')](function(){var _0x3bcfeb=_0xdf06('0x5e')+_0x1f7c49;return db[_0xdf06('0x52')][_0xdf06('0x32')](_0x3bcfeb,{'type':db['Sequelize']['QueryTypes'][_0xdf06('0x58')],'raw':!![],'transaction':_0x1c437b});})[_0xdf06('0x26')](function(_0x19617a){var _0x4d9277=_[_0xdf06('0x2c')](_0x19617a,function(_0x8d6d72){return Number(_0x8d6d72[_0xdf06('0x5f')]);});return db[_0xdf06('0x60')]['destroy']({'where':{'UserId':{'$in':_0x380c20},'SmsQueueId':{'$in':_0x4d9277}},'transaction':_0x1c437b});})[_0xdf06('0x26')](function(){var _0x12e933='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1f7c49;return db[_0xdf06('0x52')]['query'](_0x12e933,{'type':db[_0xdf06('0x55')][_0xdf06('0x57')]['SELECT'],'raw':!![],'transaction':_0x1c437b});})['then'](function(_0x2cd6ef){var _0x4938cc=_['map'](_0x2cd6ef,function(_0x51227f){return Number(_0x51227f['ChatQueueId']);});return db[_0xdf06('0x61')][_0xdf06('0x5d')]({'where':{'UserId':{'$in':_0x380c20},'ChatQueueId':{'$in':_0x4938cc}},'transaction':_0x1c437b});})[_0xdf06('0x26')](function(){var _0xb5a645=_0xdf06('0x62')+_0x1f7c49;return db[_0xdf06('0x52')]['query'](_0xb5a645,{'type':db[_0xdf06('0x55')]['QueryTypes'][_0xdf06('0x58')],'raw':!![],'transaction':_0x1c437b});})[_0xdf06('0x26')](function(_0x281f0c){var _0x2058be=_[_0xdf06('0x2c')](_0x281f0c,function(_0x5bc5e4){return Number(_0x5bc5e4[_0xdf06('0x63')]);});return db[_0xdf06('0x64')]['destroy']({'where':{'UserId':{'$in':_0x380c20},'FaxQueueId':{'$in':_0x2058be}},'transaction':_0x1c437b});})[_0xdf06('0x26')](function(){var _0x3a1914=_0xdf06('0x65')+_0x1f7c49;return db['sequelize'][_0xdf06('0x32')](_0x3a1914,{'type':db['Sequelize'][_0xdf06('0x57')]['SELECT'],'raw':!![],'transaction':_0x1c437b});})[_0xdf06('0x26')](function(_0x6f4ee){var _0x2c1df7=_[_0xdf06('0x2c')](_0x6f4ee,function(_0xb90158){return Number(_0xb90158['OpenchannelQueueId']);});return db['UserOpenchannelQueue'][_0xdf06('0x5d')]({'where':{'UserId':{'$in':_0x380c20},'OpenchannelQueueId':{'$in':_0x2c1df7}},'transaction':_0x1c437b});})[_0xdf06('0x26')](function(){var _0x3c0796=_0xdf06('0x66')+_0x1f7c49;return db[_0xdf06('0x52')]['query'](_0x3c0796,{'type':db['Sequelize'][_0xdf06('0x57')][_0xdf06('0x58')],'raw':!![],'transaction':_0x1c437b});})[_0xdf06('0x26')](function(_0x1f04e5){var _0xd0c0c7=_['map'](_0x1f04e5,function(_0x10f3ec){return Number(_0x10f3ec['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0xdf06('0x5d')]({'where':{'UserId':{'$in':_0x380c20},'WhatsappQueueId':{'$in':_0xd0c0c7}},'transaction':_0x1c437b});})[_0xdf06('0x26')](function(){return db[_0xdf06('0x67')][_0xdf06('0x48')]({'where':{'TeamId':_0x1f7c49}});})['then'](function(_0x1998d2){if(_0x1998d2===null){return;}return db[_0xdf06('0x68')][_0xdf06('0x5d')]({'where':{'UserId':{'$in':_0x380c20},'VoicePrefixId':_0x1998d2[_0xdf06('0x69')]},'transaction':_0x1c437b});})[_0xdf06('0x26')](function(){return db[_0xdf06('0x2d')][_0xdf06('0x5d')]({'where':{'id':_0x1f7c49},'cascade':!![],'transaction':_0x1c437b});})[_0xdf06('0x26')](function(_0x4dd712){if(_0x4dd712===0x0){_0x489107[_0xdf06('0x1a')](0x194);}else{return db[_0xdf06('0x50')][_0xdf06('0x5d')]({'where':{'type':'Teams','resourceId':_0x1f7c49},'cascade':!![],'transaction':_0x1c437b})['then'](function(){_0x489107[_0xdf06('0x1b')](0xcc)[_0xdf06('0x6a')]();});}})['catch'](function(_0x3e6c98){_0x489107[_0xdf06('0x1b')](0x1f4)[_0xdf06('0x2a')](_0x3e6c98);});});};exports[_0xdf06('0x6b')]=function(_0x3370c3,_0x29614d,_0x24ceff){return db[_0xdf06('0x2d')][_0xdf06('0x6c')]({'where':{'id':_0x3370c3[_0xdf06('0x46')]['id']}})['then'](handleEntityNotFound(_0x29614d,null))[_0xdf06('0x26')](function(_0x168360){if(!_0x3370c3[_0xdf06('0x32')]['channel']||!utils['isValidChannel'](_0x3370c3[_0xdf06('0x32')][_0xdf06('0x6d')])){throw new db['Sequelize']['ValidationError'](_0xdf06('0x6e'));}var _0x3be1d={};var _0xc030e8={};_0xc030e8[_0xdf06('0x31')]=_[_0xdf06('0x33')](db[_[_0xdf06('0x6f')](_0x3370c3[_0xdf06('0x32')][_0xdf06('0x6d')][_0xdf06('0x70')]())+'Queue']['rawAttributes']);_0xc030e8[_0xdf06('0x32')]=_['keys'](_0x3370c3[_0xdf06('0x32')]);_0xc030e8[_0xdf06('0x34')]=_[_0xdf06('0x35')](_0xc030e8['model'],_0xc030e8[_0xdf06('0x32')]);_0x3be1d[_0xdf06('0x38')]=_[_0xdf06('0x35')](_0xc030e8['model'],qs[_0xdf06('0x36')](_0x3370c3[_0xdf06('0x32')][_0xdf06('0x36')]));_0x3be1d[_0xdf06('0x38')]=_0x3be1d[_0xdf06('0x38')][_0xdf06('0x37')]?_0x3be1d['attributes']:_0xc030e8[_0xdf06('0x31')];_0x3be1d[_0xdf06('0x1f')]=qs['limit'](_0x3370c3['query'][_0xdf06('0x1f')]);_0x3be1d[_0xdf06('0x1d')]=qs[_0xdf06('0x1d')](_0x3370c3[_0xdf06('0x32')][_0xdf06('0x1d')]);_0x3be1d[_0xdf06('0x3b')]=qs[_0xdf06('0x71')](_0x3370c3[_0xdf06('0x32')]['sort']);_0x3be1d[_0xdf06('0x3c')]=qs['filters'](_[_0xdf06('0x3d')](_0x3370c3[_0xdf06('0x32')],_0xc030e8['filters']));_0x3be1d=_[_0xdf06('0x3f')]({},_0x3be1d,_0x3370c3[_0xdf06('0x40')]);return _0x168360['get'+_[_0xdf06('0x6f')](_0x3370c3[_0xdf06('0x32')][_0xdf06('0x6d')][_0xdf06('0x70')]())+_0xdf06('0x72')](_0x3be1d);})[_0xdf06('0x26')](respondWithResult(_0x29614d,null))[_0xdf06('0x44')](handleError(_0x29614d,null));};exports['addQueues']=function(_0x1ec396,_0x1ab72c,_0x2516e2){return db[_0xdf06('0x2d')]['findOne']({'where':{'id':_0x1ec396[_0xdf06('0x46')]['id']}})[_0xdf06('0x26')](function(_0x3a8313){if(_0x3a8313){if(!_0x1ec396['body'][_0xdf06('0x6d')]||!utils[_0xdf06('0x73')](_0x1ec396[_0xdf06('0x51')]['channel'])){throw new db[(_0xdf06('0x55'))][(_0xdf06('0x74'))](_0xdf06('0x6e'));}return _0x3a8313[_0xdf06('0x75')+_['capitalize'](_0x1ec396[_0xdf06('0x51')][_0xdf06('0x6d')][_0xdf06('0x70')]())+_0xdf06('0x72')](_0x1ec396[_0xdf06('0x51')][_0xdf06('0x76')]);}return null;})[_0xdf06('0x26')](handleEntityNotFound(_0x1ab72c,null))[_0xdf06('0x26')](respondWithStatusCode(_0x1ab72c,null))['catch'](handleError(_0x1ab72c,null));};exports[_0xdf06('0x77')]=function(_0x4f9bb2,_0x318574,_0x504b0e){return db[_0xdf06('0x2d')][_0xdf06('0x6c')]({'where':{'id':_0x4f9bb2[_0xdf06('0x46')]['id']}})[_0xdf06('0x26')](function(_0x2c5c6d){if(_0x2c5c6d){if(!_0x4f9bb2[_0xdf06('0x32')][_0xdf06('0x6d')]||!utils[_0xdf06('0x73')](_0x4f9bb2[_0xdf06('0x32')][_0xdf06('0x6d')])){throw new db[(_0xdf06('0x55'))]['ValidationError'](_0xdf06('0x6e'));}return _0x2c5c6d[_0xdf06('0x78')+_[_0xdf06('0x6f')](_0x4f9bb2['query'][_0xdf06('0x6d')]['toLowerCase']())+_0xdf06('0x72')](_0x4f9bb2[_0xdf06('0x32')]['ids']);}return null;})[_0xdf06('0x26')](handleEntityNotFound(_0x318574,null))[_0xdf06('0x26')](respondWithStatusCode(_0x318574,null))[_0xdf06('0x44')](handleError(_0x318574,null));};exports['addAgents']=function(_0x4b3aa5,_0x44973f){var _0x92bfaf=_[_0xdf06('0x79')](_0x4b3aa5[_0xdf06('0x51')]['ids'])?_0x4b3aa5[_0xdf06('0x51')][_0xdf06('0x76')]:[_0x4b3aa5['body']['ids']];var _0x1b426d=_0x4b3aa5[_0xdf06('0x46')]['id'];return db[_0xdf06('0x2d')][_0xdf06('0x48')]({'where':{'id':_0x1b426d}})[_0xdf06('0x26')](handleEntityNotFound(_0x44973f,null))[_0xdf06('0x26')](function(_0x2830e4){if(_0x2830e4){var _0x1d03ae=[_0xdf06('0x7a'),_0xdf06('0x7b'),_0xdf06('0x7c'),'Sms',_0xdf06('0x7d'),_0xdf06('0x7e'),'Whatsapp'];return db['sequelize'][_0xdf06('0x53')](function(_0x2980e0){var _0x15ebc9=_[_0xdf06('0x2c')](_0x1d03ae,function(_0x5701cf){var _0x3881b0={'attributes':['id',_0xdf06('0x29')]};if(_0x5701cf==='Voice'){_0x3881b0['through']={'attributes':[_0xdf06('0x7f')]};}return _0x2830e4[_0xdf06('0x4a')+_0x5701cf+_0xdf06('0x72')](_0x3881b0)[_0xdf06('0x26')](function(_0x3c267e){var _0x5ad55c=_[_0xdf06('0x2c')](_0x3c267e,function(_0x22c413){var _0x28f177=_[_0xdf06('0x2c')](_0x92bfaf,function(_0x2a5af8){var _0x10bf40={'where':{'UserId':_0x2a5af8,[_0x5701cf+_0xdf06('0x80')]:_0x22c413['id']},'transaction':_0x2980e0};if(_0x5701cf==='Voice'){_0x10bf40['defaults']={'penalty':_0x22c413['TeamVoiceQueue']['penalty']};}return db[_0xdf06('0x81')+_0x5701cf+_0xdf06('0x82')]['findOrCreate'](_0x10bf40)[_0xdf06('0x26')](function(){socket[_0xdf06('0x83')]('user'+_0x5701cf+'Queue:save',{'UserId':_0x2a5af8,[_0x5701cf+'QueueId']:_0x22c413['id']});if(_0x5701cf!=='Voice'){return;}return db['User'][_0xdf06('0x43')]({'where':{'id':_0x92bfaf,'online':0x1},'attributes':['id',_0xdf06('0x29'),_0xdf06('0x84'),'voicePause',_0xdf06('0x85')],'raw':!![]})[_0xdf06('0x26')](function(_0x456fa4){var _0x432377=_[_0xdf06('0x2c')](_0x456fa4,function(_0x2f4509){return db['UserVoiceQueueRt'][_0xdf06('0x86')]({'membername':_0x2f4509[_0xdf06('0x29')],'UserId':_0x2f4509['id'],'queue_name':_0x22c413['name'],'VoiceQueueId':_0x22c413['id'],'interface':_[_0xdf06('0x87')](_0x2f4509['interface'])?util[_0xdf06('0x88')](_0xdf06('0x89'),_0x2f4509[_0xdf06('0x29')]):_0x2f4509[_0xdf06('0x85')],'paused':_0x2f4509[_0xdf06('0x8a')]||![],'penalty':_0x22c413[_0xdf06('0x8b')]['penalty']},{'transaction':_0x2980e0});});return Promise[_0xdf06('0x8c')](_0x432377);});});});return Promise[_0xdf06('0x8c')](_0x28f177);});return Promise[_0xdf06('0x8c')](_0x5ad55c);})[_0xdf06('0x26')](function(){return db[_0xdf06('0x67')]['findOne']({'where':{'teamId':_0x1b426d}})[_0xdf06('0x26')](function(_0x38d9ba){if(_0x38d9ba){var _0x48fa6f=_[_0xdf06('0x2c')](_0x92bfaf,function(_0x1d4919){db[_0xdf06('0x68')][_0xdf06('0x86')]({'UserId':_0x1d4919,'VoicePrefixId':_0x38d9ba['VoicePrefixId']});});return Promise[_0xdf06('0x8c')](_0x48fa6f);}});});});return Promise[_0xdf06('0x8c')](_0x15ebc9)['then'](function(){return _0x2830e4[_0xdf06('0x8d')](_0x92bfaf,{'transaction':_0x2980e0})['spread'](function(_0xa88ea9){return _0xa88ea9;});});});}})['then'](respondWithResult(_0x44973f,null))[_0xdf06('0x44')](handleError(_0x44973f,null));};exports[_0xdf06('0x8e')]=function(_0xbbccd3,_0x32133f){var _0xa78ab5=_[_0xdf06('0x79')](_0xbbccd3[_0xdf06('0x32')][_0xdf06('0x76')])?_0xbbccd3[_0xdf06('0x32')][_0xdf06('0x76')]:[_0xbbccd3[_0xdf06('0x32')][_0xdf06('0x76')]];var _0x1e25ef=_0xbbccd3[_0xdf06('0x46')]['id'];return db[_0xdf06('0x2d')]['find']({'where':{'id':_0x1e25ef}})['then'](handleEntityNotFound(_0x32133f,null))['then'](function(_0x2a50bc){if(_0x2a50bc){var _0x4a3824=[_0xdf06('0x7a'),_0xdf06('0x7b'),_0xdf06('0x7c'),_0xdf06('0x8f'),_0xdf06('0x7d'),_0xdf06('0x7e'),'Whatsapp'];return db['sequelize']['transaction'](function(_0x31a11a){var _0x1b6b67=_[_0xdf06('0x2c')](_0x4a3824,function(_0xd2d0b){var _0x5ebe1e={'attributes':['id',_0xdf06('0x29')]};return _0x2a50bc[_0xdf06('0x4a')+_0xd2d0b+_0xdf06('0x72')](_0x5ebe1e)[_0xdf06('0x26')](function(_0x5764fa){var _0x5e7d1c=_[_0xdf06('0x2c')](_0x5764fa,function(_0x247fe4){return _0x247fe4['removeAgents'](_0xa78ab5,{'transaction':_0x31a11a})[_0xdf06('0x26')](function(){var _0x3960f4=_[_0xdf06('0x2c')](_0xa78ab5,function(_0x159609){socket['emit'](_0xdf06('0x4d')+_0xd2d0b+_0xdf06('0x90'),{'UserId':Number(_0x159609),[_0xd2d0b+_0xdf06('0x80')]:_0x247fe4['id']});if(_0xd2d0b!==_0xdf06('0x7a')){return;}return db[_0xdf06('0x91')]['destroy']({'where':{'VoiceQueueId':_0x247fe4['id'],'UserId':_0x159609},'transaction':_0x31a11a});});return Promise[_0xdf06('0x8c')](_0x3960f4);});});return Promise[_0xdf06('0x8c')](_0x5e7d1c);});});return Promise[_0xdf06('0x8c')](_0x1b6b67)[_0xdf06('0x26')](function(){return _0x2a50bc['removeAgents'](_0xa78ab5,{'transaction':_0x31a11a});})['then'](function(){return db[_0xdf06('0x67')][_0xdf06('0x6c')]({'where':{'teamId':_0x1e25ef}})[_0xdf06('0x26')](function(_0x5bd432){if(_0x5bd432){var _0x1011fb=_['map'](_0xa78ab5,function(_0x3b3e80){db[_0xdf06('0x68')][_0xdf06('0x5d')]({'where':{'UserId':_0x3b3e80,'VoicePrefixId':_0x5bd432[_0xdf06('0x69')]}});});return Promise[_0xdf06('0x8c')](_0x1011fb);}});});});}})[_0xdf06('0x26')](respondWithStatusCode(_0x32133f,null))['catch'](handleError(_0x32133f,null));};exports[_0xdf06('0x92')]=function(_0x27816d,_0x2bb1e0,_0x37166e){var _0x499f13={};var _0x40f3ea={};var _0x46fc01;var _0x271206;return db['Team'][_0xdf06('0x6c')]({'where':{'id':_0x27816d[_0xdf06('0x46')]['id']}})[_0xdf06('0x26')](handleEntityNotFound(_0x2bb1e0,null))[_0xdf06('0x26')](function(_0x322fc6){if(_0x322fc6){_0x46fc01=_0x322fc6;_0x40f3ea['model']=_['keys'](db[_0xdf06('0x81')][_0xdf06('0x47')]);_0x40f3ea[_0xdf06('0x32')]=_[_0xdf06('0x33')](_0x27816d[_0xdf06('0x32')]);_0x40f3ea[_0xdf06('0x34')]=_['intersection'](_0x40f3ea[_0xdf06('0x31')],_0x40f3ea[_0xdf06('0x32')]);_0x499f13[_0xdf06('0x38')]=_[_0xdf06('0x35')](_0x40f3ea[_0xdf06('0x31')],qs[_0xdf06('0x36')](_0x27816d[_0xdf06('0x32')][_0xdf06('0x36')]));_0x499f13[_0xdf06('0x38')]=_0x499f13[_0xdf06('0x38')][_0xdf06('0x37')]?_0x499f13[_0xdf06('0x38')]:_0x40f3ea[_0xdf06('0x31')];_0x499f13['order']=qs[_0xdf06('0x71')](_0x27816d['query'][_0xdf06('0x71')]);_0x499f13[_0xdf06('0x3c')]=qs[_0xdf06('0x34')](_['pick'](_0x27816d[_0xdf06('0x32')],_0x40f3ea['filters']));if(_0x27816d[_0xdf06('0x32')][_0xdf06('0x3e')]){_0x499f13[_0xdf06('0x3c')]=_['merge'](_0x499f13[_0xdf06('0x3c')],{'$or':_[_0xdf06('0x2c')](_0x499f13[_0xdf06('0x38')],function(_0x346350){var _0x38ea74={};_0x38ea74[_0x346350]={'$like':'%'+_0x27816d['query'][_0xdf06('0x3e')]+'%'};return _0x38ea74;})});}_0x499f13=_['merge']({},_0x499f13,_0x27816d['options']);return _0x46fc01[_0xdf06('0x92')](_0x499f13);}})[_0xdf06('0x26')](function(_0x169ab9){if(_0x169ab9){_0x271206=_0x169ab9['length'];if(!_0x27816d['query'][_0xdf06('0x39')]('nolimit')){_0x499f13[_0xdf06('0x1f')]=qs[_0xdf06('0x1f')](_0x27816d[_0xdf06('0x32')][_0xdf06('0x1f')]);_0x499f13[_0xdf06('0x1d')]=qs[_0xdf06('0x1d')](_0x27816d[_0xdf06('0x32')][_0xdf06('0x1d')]);}return _0x46fc01['getAgents'](_0x499f13);}})[_0xdf06('0x26')](function(_0x27a1c4){if(_0x27a1c4){return _0x27a1c4?{'count':_0x271206,'rows':_0x27a1c4}:null;}})[_0xdf06('0x26')](respondWithResult(_0x2bb1e0,null))[_0xdf06('0x44')](handleError(_0x2bb1e0,null));}; \ No newline at end of file +var _0xabfb=['fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Team','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','get','role','UserProfileSection','userProfileId','UserProfileResource','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams','getQueues','findOne','isValidChannel','ValidationError','capitalize','channel','Queue','pick','Queues','addQueues','Unknown\x20channel','add','toLowerCase','ids','removeQueues','remove','addAgents','isArray','Voice','Sms','Fax','Openchannel','Whatsapp','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','UserVoiceQueueRt','upsert','isNil','interface','format','all','spread','removeAgents','Chat','Mail','transaction','Queue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','stack','name','send','index','map','rawAttributes'];(function(_0x18667d,_0x35b900){var _0x40a8de=function(_0x46b21f){while(--_0x46b21f){_0x18667d['push'](_0x18667d['shift']());}};_0x40a8de(++_0x35b900);}(_0xabfb,0x108));var _0xbabf=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0xabfb[_0x34bd34];return _0x4e36d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbabf('0x0'));var zipdir=require(_0xbabf('0x1'));var jsonpatch=require(_0xbabf('0x2'));var rp=require(_0xbabf('0x3'));var moment=require('moment');var BPromise=require(_0xbabf('0x4'));var Mustache=require(_0xbabf('0x5'));var util=require('util');var path=require(_0xbabf('0x6'));var sox=require('sox');var csv=require(_0xbabf('0x7'));var ejs=require(_0xbabf('0x8'));var fs=require('fs');var fs_extra=require(_0xbabf('0x9'));var _=require(_0xbabf('0xa'));var squel=require(_0xbabf('0xb'));var crypto=require(_0xbabf('0xc'));var jsforce=require(_0xbabf('0xd'));var deskjs=require(_0xbabf('0xe'));var toCsv=require(_0xbabf('0x7'));var querystring=require(_0xbabf('0xf'));var Papa=require(_0xbabf('0x10'));var Redis=require(_0xbabf('0x11'));var authService=require(_0xbabf('0x12'));var qs=require(_0xbabf('0x13'));var as=require(_0xbabf('0x14'));var hardwareService=require(_0xbabf('0x15'));var logger=require(_0xbabf('0x16'))('api');var utils=require(_0xbabf('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbabf('0x18'))['db'];config[_0xbabf('0x19')]=_[_0xbabf('0x1a')](config['redis'],{'host':_0xbabf('0x1b'),'port':0x18eb});var socket=require(_0xbabf('0x1c'))(new Redis(config[_0xbabf('0x19')]));require(_0xbabf('0x1d'))['register'](socket);function respondWithStatusCode(_0x255c34,_0x5c57ca){_0x5c57ca=_0x5c57ca||0xcc;return function(_0x4e3671){if(_0x4e3671){return _0x255c34[_0xbabf('0x1e')](_0x5c57ca);}return _0x255c34[_0xbabf('0x1f')](_0x5c57ca)[_0xbabf('0x20')]();};}function respondWithResult(_0x38f9d5,_0x5721ae){_0x5721ae=_0x5721ae||0xc8;return function(_0x2288a0){if(_0x2288a0){return _0x38f9d5[_0xbabf('0x1f')](_0x5721ae)[_0xbabf('0x21')](_0x2288a0);}};}function respondWithFilteredResult(_0x3292f5,_0x529f86){return function(_0x58d119){if(_0x58d119){var _0x2c62fa=typeof _0x529f86[_0xbabf('0x22')]==='undefined'&&typeof _0x529f86['limit']===_0xbabf('0x23');var _0x227899=_0x58d119[_0xbabf('0x24')];var _0x1b146b=_0x2c62fa?0x0:_0x529f86[_0xbabf('0x22')];var _0x16e829=_0x2c62fa?_0x58d119[_0xbabf('0x24')]:_0x529f86[_0xbabf('0x22')]+_0x529f86[_0xbabf('0x25')];var _0x505c83;if(_0x16e829>=_0x227899){_0x16e829=_0x227899;_0x505c83=0xc8;}else{_0x505c83=0xce;}_0x3292f5['status'](_0x505c83);return _0x3292f5[_0xbabf('0x26')](_0xbabf('0x27'),_0x1b146b+'-'+_0x16e829+'/'+_0x227899)[_0xbabf('0x21')](_0x58d119);}return null;};}function patchUpdates(_0x1cc9b9){return function(_0x5b3bd2){try{jsonpatch[_0xbabf('0x28')](_0x5b3bd2,_0x1cc9b9,!![]);}catch(_0x37c95e){return BPromise['reject'](_0x37c95e);}return _0x5b3bd2[_0xbabf('0x29')]();};}function saveUpdates(_0xb0a249,_0x316d7a){return function(_0x205b93){if(_0x205b93){return _0x205b93[_0xbabf('0x2a')](_0xb0a249)[_0xbabf('0x2b')](function(_0x3306ca){return _0x3306ca;});}return null;};}function handleEntityNotFound(_0x472efb,_0x3b9dfa){return function(_0x33661f){if(!_0x33661f){_0x472efb[_0xbabf('0x1e')](0x194);}return _0x33661f;};}function handleError(_0x3761a0,_0x44dc40){_0x44dc40=_0x44dc40||0x1f4;return function(_0x41b28e){logger['error'](_0x41b28e[_0xbabf('0x2c')]);if(_0x41b28e[_0xbabf('0x2d')]){delete _0x41b28e[_0xbabf('0x2d')];}_0x3761a0[_0xbabf('0x1f')](_0x44dc40)[_0xbabf('0x2e')](_0x41b28e);};}exports[_0xbabf('0x2f')]=function(_0xdd16a7,_0x1e230f){var _0x223004={},_0x1ceb2c={},_0x21afd8={'count':0x0,'rows':[]};var _0x3d4bb7=_[_0xbabf('0x30')](db['Team'][_0xbabf('0x31')],function(_0x869ca8){return{'name':_0x869ca8[_0xbabf('0x32')],'type':_0x869ca8[_0xbabf('0x33')]['key']};});_0x1ceb2c[_0xbabf('0x34')]=_[_0xbabf('0x30')](_0x3d4bb7,_0xbabf('0x2d'));_0x1ceb2c[_0xbabf('0x35')]=_[_0xbabf('0x36')](_0xdd16a7[_0xbabf('0x35')]);_0x1ceb2c[_0xbabf('0x37')]=_[_0xbabf('0x38')](_0x1ceb2c[_0xbabf('0x34')],_0x1ceb2c['query']);_0x223004[_0xbabf('0x39')]=_[_0xbabf('0x38')](_0x1ceb2c[_0xbabf('0x34')],qs[_0xbabf('0x3a')](_0xdd16a7[_0xbabf('0x35')][_0xbabf('0x3a')]));_0x223004[_0xbabf('0x39')]=_0x223004[_0xbabf('0x39')][_0xbabf('0x3b')]?_0x223004[_0xbabf('0x39')]:_0x1ceb2c['model'];if(!_0xdd16a7[_0xbabf('0x35')]['hasOwnProperty'](_0xbabf('0x3c'))){_0x223004[_0xbabf('0x25')]=qs[_0xbabf('0x25')](_0xdd16a7[_0xbabf('0x35')][_0xbabf('0x25')]);_0x223004[_0xbabf('0x22')]=qs[_0xbabf('0x22')](_0xdd16a7[_0xbabf('0x35')][_0xbabf('0x22')]);}_0x223004[_0xbabf('0x3d')]=qs[_0xbabf('0x3e')](_0xdd16a7[_0xbabf('0x35')]['sort']);_0x223004[_0xbabf('0x3f')]=qs[_0xbabf('0x37')](_['pick'](_0xdd16a7['query'],_0x1ceb2c[_0xbabf('0x37')]),_0x3d4bb7);if(_0xdd16a7[_0xbabf('0x35')][_0xbabf('0x40')]){_0x223004[_0xbabf('0x3f')]=_[_0xbabf('0x41')](_0x223004[_0xbabf('0x3f')],{'$or':_[_0xbabf('0x30')](_0x3d4bb7,function(_0x3530b4){if(_0x3530b4[_0xbabf('0x33')]!==_0xbabf('0x42')){var _0x5ba49d={};_0x5ba49d[_0x3530b4['name']]={'$like':'%'+_0xdd16a7[_0xbabf('0x35')][_0xbabf('0x40')]+'%'};return _0x5ba49d;}})});}_0x223004=_[_0xbabf('0x41')]({},_0x223004,_0xdd16a7[_0xbabf('0x43')]);var _0x374ca8={'where':_0x223004['where']};return db[_0xbabf('0x44')][_0xbabf('0x24')](_0x374ca8)[_0xbabf('0x2b')](function(_0xb19641){_0x21afd8[_0xbabf('0x24')]=_0xb19641;if(_0xdd16a7[_0xbabf('0x35')][_0xbabf('0x45')]){_0x223004['include']=[{'all':!![]}];}return db[_0xbabf('0x44')][_0xbabf('0x46')](_0x223004);})[_0xbabf('0x2b')](function(_0x4ad96e){_0x21afd8[_0xbabf('0x47')]=_0x4ad96e;return _0x21afd8;})['then'](respondWithFilteredResult(_0x1e230f,_0x223004))[_0xbabf('0x48')](handleError(_0x1e230f,null));};exports[_0xbabf('0x49')]=function(_0x2b8d03,_0x1b539d){var _0x1c932d={'raw':![],'where':{'id':_0x2b8d03[_0xbabf('0x4a')]['id']}},_0x491c13={};_0x491c13[_0xbabf('0x34')]=_['keys'](db[_0xbabf('0x44')][_0xbabf('0x31')]);_0x491c13[_0xbabf('0x35')]=_[_0xbabf('0x36')](_0x2b8d03[_0xbabf('0x35')]);_0x491c13[_0xbabf('0x37')]=_[_0xbabf('0x38')](_0x491c13[_0xbabf('0x34')],_0x491c13['query']);_0x1c932d[_0xbabf('0x39')]=_[_0xbabf('0x38')](_0x491c13['model'],qs[_0xbabf('0x3a')](_0x2b8d03[_0xbabf('0x35')][_0xbabf('0x3a')]));_0x1c932d[_0xbabf('0x39')]=_0x1c932d[_0xbabf('0x39')]['length']?_0x1c932d[_0xbabf('0x39')]:_0x491c13[_0xbabf('0x34')];if(_0x2b8d03[_0xbabf('0x35')][_0xbabf('0x45')]){_0x1c932d[_0xbabf('0x4b')]=[{'all':!![]}];}_0x1c932d=_[_0xbabf('0x41')]({},_0x1c932d,_0x2b8d03[_0xbabf('0x43')]);return db[_0xbabf('0x44')][_0xbabf('0x4c')](_0x1c932d)[_0xbabf('0x2b')](handleEntityNotFound(_0x1b539d,null))[_0xbabf('0x2b')](respondWithResult(_0x1b539d,null))[_0xbabf('0x48')](handleError(_0x1b539d,null));};exports['create']=function(_0x144382,_0x5106a7){return db[_0xbabf('0x44')][_0xbabf('0x4d')](_0x144382[_0xbabf('0x4e')],{})[_0xbabf('0x2b')](function(_0x580e3f){var _0x32f866=_0x144382[_0xbabf('0x4f')][_0xbabf('0x50')]({'plain':!![]});if(!_0x32f866)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32f866[_0xbabf('0x51')]===_0xbabf('0x4f')){var _0x11f038=_0x580e3f[_0xbabf('0x50')]({'plain':!![]});var _0x37bfea='Teams';return db[_0xbabf('0x52')][_0xbabf('0x4c')]({'where':{'name':_0x37bfea,'userProfileId':_0x32f866[_0xbabf('0x53')]},'raw':!![]})['then'](function(_0x2dd949){if(_0x2dd949&&_0x2dd949['autoAssociation']===0x0){return db[_0xbabf('0x54')]['create']({'name':_0x11f038[_0xbabf('0x2d')],'resourceId':_0x11f038['id'],'type':_0x2dd949[_0xbabf('0x2d')],'sectionId':_0x2dd949['id']},{})[_0xbabf('0x2b')](function(){return _0x580e3f;});}else{return _0x580e3f;}})[_0xbabf('0x48')](function(_0x431344){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x431344);throw _0x431344;});}return _0x580e3f;})[_0xbabf('0x2b')](respondWithResult(_0x5106a7,0xc9))[_0xbabf('0x48')](handleError(_0x5106a7,null));};exports[_0xbabf('0x2a')]=function(_0x2eff52,_0x4c38e){if(_0x2eff52[_0xbabf('0x4e')]['id']){delete _0x2eff52[_0xbabf('0x4e')]['id'];}return db['Team'][_0xbabf('0x4c')]({'where':{'id':_0x2eff52[_0xbabf('0x4a')]['id']}})[_0xbabf('0x2b')](handleEntityNotFound(_0x4c38e,null))[_0xbabf('0x2b')](saveUpdates(_0x2eff52['body'],null))[_0xbabf('0x2b')](respondWithResult(_0x4c38e,null))[_0xbabf('0x48')](handleError(_0x4c38e,null));};exports[_0xbabf('0x55')]=function(_0x120833,_0x21cfff){var _0x4f3845=_0x120833['params']['id'];var _0x45907d=[];return db[_0xbabf('0x56')]['transaction'](function(_0x266f42){var _0x31df92=_0xbabf('0x57')+_0x4f3845;return db[_0xbabf('0x56')]['query'](_0x31df92,{'type':db[_0xbabf('0x58')][_0xbabf('0x59')]['SELECT'],'raw':!![],'transaction':_0x266f42})[_0xbabf('0x2b')](function(_0x3551fd){_0x45907d=_[_0xbabf('0x30')](_0x3551fd,function(_0x4339bf){return Number(_0x4339bf[_0xbabf('0x5a')]);});})['then'](function(){var _0x5bdb35=_0xbabf('0x5b')+_0x4f3845;return db[_0xbabf('0x56')][_0xbabf('0x35')](_0x5bdb35,{'type':db[_0xbabf('0x58')][_0xbabf('0x59')][_0xbabf('0x5c')],'raw':!![],'transaction':_0x266f42});})[_0xbabf('0x2b')](function(_0x3da8c8){var _0x56a636=_[_0xbabf('0x30')](_0x3da8c8,function(_0x232ed7){return Number(_0x232ed7['VoiceQueueId']);});return db[_0xbabf('0x5d')][_0xbabf('0x55')]({'where':{'UserId':{'$in':_0x45907d},'VoiceQueueId':{'$in':_0x56a636}},'transaction':_0x266f42});})[_0xbabf('0x2b')](function(){var _0x51b304=_0xbabf('0x5e')+_0x4f3845;return db[_0xbabf('0x56')][_0xbabf('0x35')](_0x51b304,{'type':db['Sequelize'][_0xbabf('0x59')]['SELECT'],'raw':!![],'transaction':_0x266f42});})[_0xbabf('0x2b')](function(_0x4596d0){var _0x30928a=_[_0xbabf('0x30')](_0x4596d0,function(_0x8b26fb){return Number(_0x8b26fb[_0xbabf('0x5f')]);});return db[_0xbabf('0x60')][_0xbabf('0x55')]({'where':{'UserId':{'$in':_0x45907d},'MailQueueId':{'$in':_0x30928a}},'transaction':_0x266f42});})[_0xbabf('0x2b')](function(){var _0x272751=_0xbabf('0x61')+_0x4f3845;return db['sequelize'][_0xbabf('0x35')](_0x272751,{'type':db[_0xbabf('0x58')][_0xbabf('0x59')][_0xbabf('0x5c')],'raw':!![],'transaction':_0x266f42});})[_0xbabf('0x2b')](function(_0x5e1d7c){var _0x1e494e=_[_0xbabf('0x30')](_0x5e1d7c,function(_0x13adf3){return Number(_0x13adf3[_0xbabf('0x62')]);});return db['UserSmsQueue'][_0xbabf('0x55')]({'where':{'UserId':{'$in':_0x45907d},'SmsQueueId':{'$in':_0x1e494e}},'transaction':_0x266f42});})[_0xbabf('0x2b')](function(){var _0x17e179=_0xbabf('0x63')+_0x4f3845;return db[_0xbabf('0x56')][_0xbabf('0x35')](_0x17e179,{'type':db['Sequelize']['QueryTypes'][_0xbabf('0x5c')],'raw':!![],'transaction':_0x266f42});})['then'](function(_0x1a9344){var _0x100316=_['map'](_0x1a9344,function(_0x3abf37){return Number(_0x3abf37['ChatQueueId']);});return db[_0xbabf('0x64')]['destroy']({'where':{'UserId':{'$in':_0x45907d},'ChatQueueId':{'$in':_0x100316}},'transaction':_0x266f42});})[_0xbabf('0x2b')](function(){var _0xc278a9=_0xbabf('0x65')+_0x4f3845;return db[_0xbabf('0x56')]['query'](_0xc278a9,{'type':db[_0xbabf('0x58')][_0xbabf('0x59')][_0xbabf('0x5c')],'raw':!![],'transaction':_0x266f42});})[_0xbabf('0x2b')](function(_0x419346){var _0xab451b=_[_0xbabf('0x30')](_0x419346,function(_0x394997){return Number(_0x394997[_0xbabf('0x66')]);});return db[_0xbabf('0x67')][_0xbabf('0x55')]({'where':{'UserId':{'$in':_0x45907d},'FaxQueueId':{'$in':_0xab451b}},'transaction':_0x266f42});})[_0xbabf('0x2b')](function(){var _0x4b4f92=_0xbabf('0x68')+_0x4f3845;return db[_0xbabf('0x56')]['query'](_0x4b4f92,{'type':db[_0xbabf('0x58')]['QueryTypes'][_0xbabf('0x5c')],'raw':!![],'transaction':_0x266f42});})['then'](function(_0x4eb1ce){var _0x3618ec=_['map'](_0x4eb1ce,function(_0x2f2a1e){return Number(_0x2f2a1e[_0xbabf('0x69')]);});return db['UserOpenchannelQueue'][_0xbabf('0x55')]({'where':{'UserId':{'$in':_0x45907d},'OpenchannelQueueId':{'$in':_0x3618ec}},'transaction':_0x266f42});})[_0xbabf('0x2b')](function(){var _0xc71742=_0xbabf('0x6a')+_0x4f3845;return db[_0xbabf('0x56')][_0xbabf('0x35')](_0xc71742,{'type':db[_0xbabf('0x58')][_0xbabf('0x59')][_0xbabf('0x5c')],'raw':!![],'transaction':_0x266f42});})[_0xbabf('0x2b')](function(_0x447de0){var _0x1aceea=_[_0xbabf('0x30')](_0x447de0,function(_0x1fd7f9){return Number(_0x1fd7f9[_0xbabf('0x6b')]);});return db[_0xbabf('0x6c')][_0xbabf('0x55')]({'where':{'UserId':{'$in':_0x45907d},'WhatsappQueueId':{'$in':_0x1aceea}},'transaction':_0x266f42});})[_0xbabf('0x2b')](function(){return db[_0xbabf('0x6d')][_0xbabf('0x4c')]({'where':{'TeamId':_0x4f3845}});})[_0xbabf('0x2b')](function(_0x22d8f8){if(_0x22d8f8===null){return;}return db[_0xbabf('0x6e')][_0xbabf('0x55')]({'where':{'UserId':{'$in':_0x45907d},'VoicePrefixId':_0x22d8f8[_0xbabf('0x6f')]},'transaction':_0x266f42});})['then'](function(){return db[_0xbabf('0x44')][_0xbabf('0x55')]({'where':{'id':_0x4f3845},'cascade':!![],'transaction':_0x266f42});})[_0xbabf('0x2b')](function(_0x2caf5a){if(_0x2caf5a===0x0){_0x21cfff[_0xbabf('0x1e')](0x194);}else{return db[_0xbabf('0x54')][_0xbabf('0x55')]({'where':{'type':_0xbabf('0x70'),'resourceId':_0x4f3845},'cascade':!![],'transaction':_0x266f42})[_0xbabf('0x2b')](function(){_0x21cfff['status'](0xcc)['end']();});}})[_0xbabf('0x48')](function(_0x95720){_0x21cfff[_0xbabf('0x1f')](0x1f4)[_0xbabf('0x2e')](_0x95720);});});};exports[_0xbabf('0x71')]=function(_0x5452e5,_0x488979,_0x30d947){return db[_0xbabf('0x44')][_0xbabf('0x72')]({'where':{'id':_0x5452e5[_0xbabf('0x4a')]['id']}})[_0xbabf('0x2b')](handleEntityNotFound(_0x488979,null))['then'](function(_0x4a71c4){if(!_0x5452e5[_0xbabf('0x35')]['channel']||!utils[_0xbabf('0x73')](_0x5452e5[_0xbabf('0x35')]['channel'])){throw new db[(_0xbabf('0x58'))][(_0xbabf('0x74'))]('Unknown\x20channel');}var _0x33aa22={};var _0xf2fbce={};_0xf2fbce[_0xbabf('0x34')]=_['keys'](db[_[_0xbabf('0x75')](_0x5452e5[_0xbabf('0x35')][_0xbabf('0x76')]['toLowerCase']())+_0xbabf('0x77')][_0xbabf('0x31')]);_0xf2fbce['query']=_['keys'](_0x5452e5[_0xbabf('0x35')]);_0xf2fbce[_0xbabf('0x37')]=_[_0xbabf('0x38')](_0xf2fbce[_0xbabf('0x34')],_0xf2fbce[_0xbabf('0x35')]);_0x33aa22[_0xbabf('0x39')]=_[_0xbabf('0x38')](_0xf2fbce[_0xbabf('0x34')],qs['fields'](_0x5452e5[_0xbabf('0x35')][_0xbabf('0x3a')]));_0x33aa22[_0xbabf('0x39')]=_0x33aa22[_0xbabf('0x39')][_0xbabf('0x3b')]?_0x33aa22[_0xbabf('0x39')]:_0xf2fbce[_0xbabf('0x34')];_0x33aa22[_0xbabf('0x25')]=qs[_0xbabf('0x25')](_0x5452e5[_0xbabf('0x35')][_0xbabf('0x25')]);_0x33aa22[_0xbabf('0x22')]=qs[_0xbabf('0x22')](_0x5452e5[_0xbabf('0x35')]['offset']);_0x33aa22[_0xbabf('0x3d')]=qs['sort'](_0x5452e5[_0xbabf('0x35')][_0xbabf('0x3e')]);_0x33aa22[_0xbabf('0x3f')]=qs[_0xbabf('0x37')](_[_0xbabf('0x78')](_0x5452e5['query'],_0xf2fbce[_0xbabf('0x37')]));_0x33aa22=_[_0xbabf('0x41')]({},_0x33aa22,_0x5452e5[_0xbabf('0x43')]);return _0x4a71c4[_0xbabf('0x50')+_[_0xbabf('0x75')](_0x5452e5[_0xbabf('0x35')]['channel']['toLowerCase']())+_0xbabf('0x79')](_0x33aa22);})[_0xbabf('0x2b')](respondWithResult(_0x488979,null))[_0xbabf('0x48')](handleError(_0x488979,null));};exports[_0xbabf('0x7a')]=function(_0x3c4ed0,_0x4a1cd0,_0x3137a2){return db[_0xbabf('0x44')][_0xbabf('0x72')]({'where':{'id':_0x3c4ed0[_0xbabf('0x4a')]['id']}})['then'](function(_0x59e0a3){if(_0x59e0a3){if(!_0x3c4ed0[_0xbabf('0x4e')][_0xbabf('0x76')]||!utils[_0xbabf('0x73')](_0x3c4ed0['body'][_0xbabf('0x76')])){throw new db['Sequelize']['ValidationError'](_0xbabf('0x7b'));}return _0x59e0a3[_0xbabf('0x7c')+_[_0xbabf('0x75')](_0x3c4ed0['body'][_0xbabf('0x76')][_0xbabf('0x7d')]())+_0xbabf('0x79')](_0x3c4ed0['body'][_0xbabf('0x7e')]);}return null;})['then'](handleEntityNotFound(_0x4a1cd0,null))['then'](respondWithStatusCode(_0x4a1cd0,null))[_0xbabf('0x48')](handleError(_0x4a1cd0,null));};exports[_0xbabf('0x7f')]=function(_0x55d14d,_0x4d216d,_0x3771fd){return db[_0xbabf('0x44')][_0xbabf('0x72')]({'where':{'id':_0x55d14d[_0xbabf('0x4a')]['id']}})[_0xbabf('0x2b')](function(_0x438548){if(_0x438548){if(!_0x55d14d['query'][_0xbabf('0x76')]||!utils[_0xbabf('0x73')](_0x55d14d[_0xbabf('0x35')][_0xbabf('0x76')])){throw new db[(_0xbabf('0x58'))]['ValidationError'](_0xbabf('0x7b'));}return _0x438548[_0xbabf('0x80')+_[_0xbabf('0x75')](_0x55d14d['query'][_0xbabf('0x76')][_0xbabf('0x7d')]())+_0xbabf('0x79')](_0x55d14d[_0xbabf('0x35')][_0xbabf('0x7e')]);}return null;})[_0xbabf('0x2b')](handleEntityNotFound(_0x4d216d,null))['then'](respondWithStatusCode(_0x4d216d,null))[_0xbabf('0x48')](handleError(_0x4d216d,null));};exports[_0xbabf('0x81')]=function(_0x22bd80,_0xbfbba7){var _0x46bce5=_[_0xbabf('0x82')](_0x22bd80[_0xbabf('0x4e')]['ids'])?_0x22bd80[_0xbabf('0x4e')][_0xbabf('0x7e')]:[_0x22bd80[_0xbabf('0x4e')]['ids']];var _0x27cb9c=_0x22bd80['params']['id'];return db[_0xbabf('0x44')][_0xbabf('0x4c')]({'where':{'id':_0x27cb9c}})[_0xbabf('0x2b')](handleEntityNotFound(_0xbfbba7,null))[_0xbabf('0x2b')](function(_0x3d18a0){if(_0x3d18a0){var _0x2594a3=[_0xbabf('0x83'),'Chat','Mail',_0xbabf('0x84'),_0xbabf('0x85'),_0xbabf('0x86'),_0xbabf('0x87')];return db[_0xbabf('0x56')]['transaction'](function(_0x1e1484){var _0x3e2bf0=_[_0xbabf('0x30')](_0x2594a3,function(_0x37c890){var _0x26ddd9={'attributes':['id',_0xbabf('0x2d')]};if(_0x37c890===_0xbabf('0x83')){_0x26ddd9['through']={'attributes':[_0xbabf('0x88')]};}return _0x3d18a0[_0xbabf('0x50')+_0x37c890+_0xbabf('0x79')](_0x26ddd9)[_0xbabf('0x2b')](function(_0x11b767){var _0x529eed=_[_0xbabf('0x30')](_0x11b767,function(_0x3b16f6){var _0x124cf0=_['map'](_0x46bce5,function(_0x4e5ea4){var _0x49dd07={'where':{'UserId':_0x4e5ea4,[_0x37c890+_0xbabf('0x89')]:_0x3b16f6['id']},'transaction':_0x1e1484};if(_0x37c890===_0xbabf('0x83')){_0x49dd07[_0xbabf('0x1a')]={'penalty':_0x3b16f6[_0xbabf('0x8a')][_0xbabf('0x88')]};}return db[_0xbabf('0x8b')+_0x37c890+'Queue'][_0xbabf('0x8c')](_0x49dd07)[_0xbabf('0x2b')](function(){socket[_0xbabf('0x8d')]('user'+_0x37c890+_0xbabf('0x8e'),{'UserId':_0x4e5ea4,[_0x37c890+_0xbabf('0x89')]:_0x3b16f6['id']});if(_0x37c890!==_0xbabf('0x83')){return;}return db[_0xbabf('0x8b')]['findAll']({'where':{'id':_0x46bce5,'online':0x1},'attributes':['id',_0xbabf('0x2d'),_0xbabf('0x8f'),'voicePause','interface'],'raw':!![]})[_0xbabf('0x2b')](function(_0xc5454a){var _0x518609=_['map'](_0xc5454a,function(_0x489841){return db[_0xbabf('0x90')][_0xbabf('0x91')]({'membername':_0x489841[_0xbabf('0x2d')],'UserId':_0x489841['id'],'queue_name':_0x3b16f6['name'],'VoiceQueueId':_0x3b16f6['id'],'interface':_[_0xbabf('0x92')](_0x489841[_0xbabf('0x93')])?util[_0xbabf('0x94')]('SIP/%s',_0x489841[_0xbabf('0x2d')]):_0x489841[_0xbabf('0x93')],'paused':_0x489841['voicePause']||![],'penalty':_0x3b16f6[_0xbabf('0x8a')][_0xbabf('0x88')]},{'transaction':_0x1e1484});});return Promise[_0xbabf('0x95')](_0x518609);});});});return Promise[_0xbabf('0x95')](_0x124cf0);});return Promise[_0xbabf('0x95')](_0x529eed);})[_0xbabf('0x2b')](function(){return db[_0xbabf('0x6d')][_0xbabf('0x72')]({'where':{'teamId':_0x27cb9c}})[_0xbabf('0x2b')](function(_0x2135b7){if(_0x2135b7){var _0x193126=_[_0xbabf('0x30')](_0x46bce5,function(_0xef8d61){db[_0xbabf('0x6e')]['upsert']({'UserId':_0xef8d61,'VoicePrefixId':_0x2135b7[_0xbabf('0x6f')]});});return Promise[_0xbabf('0x95')](_0x193126);}});});});return Promise[_0xbabf('0x95')](_0x3e2bf0)[_0xbabf('0x2b')](function(){return _0x3d18a0[_0xbabf('0x81')](_0x46bce5,{'transaction':_0x1e1484})[_0xbabf('0x96')](function(_0x47e024){return _0x47e024;});});});}})[_0xbabf('0x2b')](respondWithResult(_0xbfbba7,null))[_0xbabf('0x48')](handleError(_0xbfbba7,null));};exports[_0xbabf('0x97')]=function(_0x3d89e5,_0x166345){var _0x507797=_[_0xbabf('0x82')](_0x3d89e5['query'][_0xbabf('0x7e')])?_0x3d89e5[_0xbabf('0x35')]['ids']:[_0x3d89e5[_0xbabf('0x35')][_0xbabf('0x7e')]];var _0x1fad3c=_0x3d89e5[_0xbabf('0x4a')]['id'];return db['Team'][_0xbabf('0x4c')]({'where':{'id':_0x1fad3c}})[_0xbabf('0x2b')](handleEntityNotFound(_0x166345,null))[_0xbabf('0x2b')](function(_0x5f4d2b){if(_0x5f4d2b){var _0x449bcc=['Voice',_0xbabf('0x98'),_0xbabf('0x99'),'Sms',_0xbabf('0x85'),_0xbabf('0x86'),'Whatsapp'];return db['sequelize'][_0xbabf('0x9a')](function(_0x2e9ba6){var _0x487b47=_[_0xbabf('0x30')](_0x449bcc,function(_0xd908af){var _0x4d504b={'attributes':['id','name']};return _0x5f4d2b[_0xbabf('0x50')+_0xd908af+'Queues'](_0x4d504b)['then'](function(_0x417706){var _0x3bf0d7=_[_0xbabf('0x30')](_0x417706,function(_0x570e7c){return _0x570e7c[_0xbabf('0x97')](_0x507797,{'transaction':_0x2e9ba6})[_0xbabf('0x2b')](function(){var _0x14df64=_[_0xbabf('0x30')](_0x507797,function(_0x5307ca){socket[_0xbabf('0x8d')](_0xbabf('0x4f')+_0xd908af+_0xbabf('0x9b'),{'UserId':Number(_0x5307ca),[_0xd908af+'QueueId']:_0x570e7c['id']});if(_0xd908af!==_0xbabf('0x83')){return;}return db[_0xbabf('0x90')]['destroy']({'where':{'VoiceQueueId':_0x570e7c['id'],'UserId':_0x5307ca},'transaction':_0x2e9ba6});});return Promise[_0xbabf('0x95')](_0x14df64);});});return Promise[_0xbabf('0x95')](_0x3bf0d7);});});return Promise[_0xbabf('0x95')](_0x487b47)[_0xbabf('0x2b')](function(){return _0x5f4d2b[_0xbabf('0x97')](_0x507797,{'transaction':_0x2e9ba6});})[_0xbabf('0x2b')](function(){return db[_0xbabf('0x6d')][_0xbabf('0x72')]({'where':{'teamId':_0x1fad3c}})[_0xbabf('0x2b')](function(_0x337be3){if(_0x337be3){var _0x51c174=_[_0xbabf('0x30')](_0x507797,function(_0x254de9){db[_0xbabf('0x6e')][_0xbabf('0x55')]({'where':{'UserId':_0x254de9,'VoicePrefixId':_0x337be3[_0xbabf('0x6f')]}});});return Promise[_0xbabf('0x95')](_0x51c174);}});});});}})[_0xbabf('0x2b')](respondWithStatusCode(_0x166345,null))[_0xbabf('0x48')](handleError(_0x166345,null));};exports[_0xbabf('0x9c')]=function(_0x5e7132,_0x452ab8,_0x44b47b){var _0x45c463={};var _0x1af62d={};var _0x10e72e;var _0x36d102;return db[_0xbabf('0x44')]['findOne']({'where':{'id':_0x5e7132['params']['id']}})[_0xbabf('0x2b')](handleEntityNotFound(_0x452ab8,null))[_0xbabf('0x2b')](function(_0x1c9d4c){if(_0x1c9d4c){_0x10e72e=_0x1c9d4c;_0x1af62d[_0xbabf('0x34')]=_[_0xbabf('0x36')](db['User'][_0xbabf('0x31')]);_0x1af62d[_0xbabf('0x35')]=_[_0xbabf('0x36')](_0x5e7132[_0xbabf('0x35')]);_0x1af62d[_0xbabf('0x37')]=_['intersection'](_0x1af62d[_0xbabf('0x34')],_0x1af62d[_0xbabf('0x35')]);_0x45c463[_0xbabf('0x39')]=_['intersection'](_0x1af62d[_0xbabf('0x34')],qs['fields'](_0x5e7132[_0xbabf('0x35')][_0xbabf('0x3a')]));_0x45c463[_0xbabf('0x39')]=_0x45c463['attributes'][_0xbabf('0x3b')]?_0x45c463['attributes']:_0x1af62d['model'];_0x45c463[_0xbabf('0x3d')]=qs[_0xbabf('0x3e')](_0x5e7132[_0xbabf('0x35')][_0xbabf('0x3e')]);_0x45c463[_0xbabf('0x3f')]=qs[_0xbabf('0x37')](_[_0xbabf('0x78')](_0x5e7132[_0xbabf('0x35')],_0x1af62d[_0xbabf('0x37')]));if(_0x5e7132['query'][_0xbabf('0x40')]){_0x45c463['where']=_[_0xbabf('0x41')](_0x45c463[_0xbabf('0x3f')],{'$or':_['map'](_0x45c463[_0xbabf('0x39')],function(_0x1c5b3a){var _0x5faf78={};_0x5faf78[_0x1c5b3a]={'$like':'%'+_0x5e7132['query'][_0xbabf('0x40')]+'%'};return _0x5faf78;})});}_0x45c463=_['merge']({},_0x45c463,_0x5e7132[_0xbabf('0x43')]);return _0x10e72e[_0xbabf('0x9c')](_0x45c463);}})[_0xbabf('0x2b')](function(_0x358843){if(_0x358843){_0x36d102=_0x358843[_0xbabf('0x3b')];if(!_0x5e7132['query']['hasOwnProperty'](_0xbabf('0x3c'))){_0x45c463[_0xbabf('0x25')]=qs[_0xbabf('0x25')](_0x5e7132[_0xbabf('0x35')][_0xbabf('0x25')]);_0x45c463['offset']=qs['offset'](_0x5e7132[_0xbabf('0x35')][_0xbabf('0x22')]);}return _0x10e72e[_0xbabf('0x9c')](_0x45c463);}})[_0xbabf('0x2b')](function(_0x4f88da){if(_0x4f88da){return _0x4f88da?{'count':_0x36d102,'rows':_0x4f88da}:null;}})['then'](respondWithResult(_0x452ab8,null))['catch'](handleError(_0x452ab8,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 278d13b..f1d2da1 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 _0x90b5=['../../mysqldb','save','update','emit','hasOwnProperty','exports','events'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x90b5,0x195));var _0x590b=function(_0x3af126,_0x1798eb){_0x3af126=_0x3af126-0x0;var _0x3ec1c6=_0x90b5[_0x3af126];return _0x3ec1c6;};'use strict';var EventEmitter=require(_0x590b('0x0'));var Team=require(_0x590b('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x590b('0x2'),'afterUpdate':_0x590b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x93ad9c){return function(_0x2d32d8,_0x41a4df,_0x40eee7){TeamEvents[_0x590b('0x4')](_0x93ad9c+':'+_0x2d32d8['id'],_0x2d32d8);TeamEvents[_0x590b('0x4')](_0x93ad9c,_0x2d32d8);_0x40eee7(null);};}for(var e in events){if(events[_0x590b('0x5')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x590b('0x6')]=TeamEvents; \ No newline at end of file +var _0x2682=['hasOwnProperty','hook','exports','../../mysqldb','Team','save','remove','emit'];(function(_0x263ffd,_0x140cf8){var _0x2b3b8b=function(_0x36331e){while(--_0x36331e){_0x263ffd['push'](_0x263ffd['shift']());}};_0x2b3b8b(++_0x140cf8);}(_0x2682,0x6b));var _0x2268=function(_0x907b46,_0x42ed0c){_0x907b46=_0x907b46-0x0;var _0x5d2931=_0x2682[_0x907b46];return _0x5d2931;};'use strict';var EventEmitter=require('events');var Team=require(_0x2268('0x0'))['db'][_0x2268('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2268('0x2'),'afterUpdate':'update','afterDestroy':_0x2268('0x3')};function emitEvent(_0x25ea51){return function(_0x26578,_0x38ec3c,_0x110cd5){TeamEvents[_0x2268('0x4')](_0x25ea51+':'+_0x26578['id'],_0x26578);TeamEvents['emit'](_0x25ea51,_0x26578);_0x110cd5(null);};}for(var e in events){if(events[_0x2268('0x5')](e)){var event=events[e];Team[_0x2268('0x6')](e,emitEvent(event));}}module[_0x2268('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 56c1681..1944c2b 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 _0x0a98=['define','Team','teams','../../config/logger','api','moment','path','rimraf','../../config/environment','./team.attributes'];(function(_0x123e11,_0x182002){var _0x35f488=function(_0x5a04c9){while(--_0x5a04c9){_0x123e11['push'](_0x123e11['shift']());}};_0x35f488(++_0x182002);}(_0x0a98,0x14d));var _0x80a9=function(_0x39f2a1,_0x31823b){_0x39f2a1=_0x39f2a1-0x0;var _0x3b9e87=_0x0a98[_0x39f2a1];return _0x3b9e87;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x80a9('0x0'))(_0x80a9('0x1'));var moment=require(_0x80a9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x80a9('0x3'));var rimraf=require(_0x80a9('0x4'));var config=require(_0x80a9('0x5'));var attributes=require(_0x80a9('0x6'));module['exports']=function(_0x58a8b4,_0x59d75c){return _0x58a8b4[_0x80a9('0x7')](_0x80a9('0x8'),attributes,{'tableName':_0x80a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b70=['../../config/logger','api','moment','bluebird','request-promise','./team.attributes','exports','define','Team','teams','lodash','util'];(function(_0x1f5095,_0x5d4caf){var _0x3c8297=function(_0xb1dad9){while(--_0xb1dad9){_0x1f5095['push'](_0x1f5095['shift']());}};_0x3c8297(++_0x5d4caf);}(_0x7b70,0x1ba));var _0x07b7=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x7b70[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0x07b7('0x0'));var util=require(_0x07b7('0x1'));var logger=require(_0x07b7('0x2'))(_0x07b7('0x3'));var moment=require(_0x07b7('0x4'));var BPromise=require(_0x07b7('0x5'));var rp=require(_0x07b7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x07b7('0x7'));module[_0x07b7('0x8')]=function(_0x45e180,_0x330843){return _0x45e180[_0x07b7('0x9')](_0x07b7('0xa'),attributes,{'tableName':_0x07b7('0xb'),'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 737e4d5..86463d0 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 _0x1b41=['then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request'];(function(_0x17aac6,_0x5030c3){var _0x551b8f=function(_0x37993e){while(--_0x37993e){_0x17aac6['push'](_0x17aac6['shift']());}};_0x551b8f(++_0x5030c3);}(_0x1b41,0xad));var _0x11b4=function(_0x3018eb,_0x570c63){_0x3018eb=_0x3018eb-0x0;var _0x23131f=_0x1b41[_0x3018eb];return _0x23131f;};'use strict';var _=require(_0x11b4('0x0'));var util=require(_0x11b4('0x1'));var moment=require('moment');var BPromise=require(_0x11b4('0x2'));var rs=require(_0x11b4('0x3'));var fs=require('fs');var Redis=require(_0x11b4('0x4'));var db=require(_0x11b4('0x5'))['db'];var utils=require(_0x11b4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x11b4('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x11b4('0x8')]({'port':0x232a});config[_0x11b4('0x9')]=_[_0x11b4('0xa')](config['redis'],{'host':_0x11b4('0xb'),'port':0x18eb});var socket=require(_0x11b4('0xc'))(new Redis(config[_0x11b4('0x9')]));require(_0x11b4('0xd'))[_0x11b4('0xe')](socket);function respondWithRpcPromise(_0x4799db,_0x2b69ca,_0x5ef76e){return new BPromise(function(_0xfdd7ae,_0x44cf5f){return client[_0x11b4('0xf')](_0x4799db,_0x5ef76e)[_0x11b4('0x10')](function(_0x3c51a0){logger[_0x11b4('0x11')]('Team,\x20%s,\x20%s',_0x2b69ca,_0x11b4('0x12'));logger[_0x11b4('0x13')](_0x11b4('0x14'),_0x2b69ca,_0x11b4('0x12'),JSON[_0x11b4('0x15')](_0x3c51a0));if(_0x3c51a0[_0x11b4('0x16')]){if(_0x3c51a0[_0x11b4('0x16')][_0x11b4('0x17')]===0x1f4){logger['error'](_0x11b4('0x18'),_0x2b69ca,_0x3c51a0[_0x11b4('0x16')][_0x11b4('0x19')]);return _0x44cf5f(_0x3c51a0[_0x11b4('0x16')][_0x11b4('0x19')]);}logger[_0x11b4('0x16')](_0x11b4('0x18'),_0x2b69ca,_0x3c51a0[_0x11b4('0x16')][_0x11b4('0x19')]);return _0xfdd7ae(_0x3c51a0[_0x11b4('0x16')][_0x11b4('0x19')]);}else{logger[_0x11b4('0x11')]('Team,\x20%s,\x20%s',_0x2b69ca,'request\x20sent');_0xfdd7ae(_0x3c51a0['result']['message']);}})[_0x11b4('0x1a')](function(_0x3a966f){logger[_0x11b4('0x16')](_0x11b4('0x18'),_0x2b69ca,_0x3a966f);_0x44cf5f(_0x3a966f);});});} \ No newline at end of file +var _0x286a=['./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x286a,0x107));var _0xa286=function(_0x4700b8,_0x49e015){_0x4700b8=_0x4700b8-0x0;var _0x50191f=_0x286a[_0x4700b8];return _0x50191f;};'use strict';var _=require(_0xa286('0x0'));var util=require('util');var moment=require(_0xa286('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa286('0x2'));var db=require(_0xa286('0x3'))['db'];var utils=require(_0xa286('0x4'));var logger=require(_0xa286('0x5'))(_0xa286('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa286('0x7')][_0xa286('0x8')]({'port':0x232a});config[_0xa286('0x9')]=_[_0xa286('0xa')](config[_0xa286('0x9')],{'host':_0xa286('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa286('0x9')]));require(_0xa286('0xc'))[_0xa286('0xd')](socket);function respondWithRpcPromise(_0x27143e,_0x43ecc2,_0x500432){return new BPromise(function(_0x1daf66,_0x9a2bf){return client['request'](_0x27143e,_0x500432)[_0xa286('0xe')](function(_0x5d6e58){logger[_0xa286('0xf')](_0xa286('0x10'),_0x43ecc2,_0xa286('0x11'));logger[_0xa286('0x12')](_0xa286('0x13'),_0x43ecc2,_0xa286('0x11'),JSON[_0xa286('0x14')](_0x5d6e58));if(_0x5d6e58[_0xa286('0x15')]){if(_0x5d6e58[_0xa286('0x15')][_0xa286('0x16')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x43ecc2,_0x5d6e58['error'][_0xa286('0x17')]);return _0x9a2bf(_0x5d6e58[_0xa286('0x15')]['message']);}logger[_0xa286('0x15')](_0xa286('0x10'),_0x43ecc2,_0x5d6e58['error'][_0xa286('0x17')]);return _0x1daf66(_0x5d6e58[_0xa286('0x15')][_0xa286('0x17')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x43ecc2,_0xa286('0x11'));_0x1daf66(_0x5d6e58['result'][_0xa286('0x17')]);}})[_0xa286('0x18')](function(_0x125279){logger[_0xa286('0x15')](_0xa286('0x10'),_0x43ecc2,_0x125279);_0x9a2bf(_0x125279);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 8c2af97..b6fbef9 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 _0xc638=['update','emit','length','team:','./team.events','save'];(function(_0x5067ed,_0x46b64c){var _0x4cf3b0=function(_0x19108c){while(--_0x19108c){_0x5067ed['push'](_0x5067ed['shift']());}};_0x4cf3b0(++_0x46b64c);}(_0xc638,0x112));var _0x8c63=function(_0xb1d903,_0x2f36f4){_0xb1d903=_0xb1d903-0x0;var _0xfc370f=_0xc638[_0xb1d903];return _0xfc370f;};'use strict';var TeamEvents=require(_0x8c63('0x0'));var events=[_0x8c63('0x1'),'remove',_0x8c63('0x2')];function createListener(_0x54820d,_0x43c8a6){return function(_0x1b1aac){_0x43c8a6[_0x8c63('0x3')](_0x54820d,_0x1b1aac);};}function removeListener(_0x21e78c,_0x158f6a){return function(){TeamEvents['removeListener'](_0x21e78c,_0x158f6a);};}exports['register']=function(_0x4f6303){for(var _0x5deb49=0x0,_0x43eec=events[_0x8c63('0x4')];_0x5deb49<_0x43eec;_0x5deb49++){var _0x101c40=events[_0x5deb49];var _0x992270=createListener(_0x8c63('0x5')+_0x101c40,_0x4f6303);TeamEvents['on'](_0x101c40,_0x992270);}}; \ No newline at end of file +var _0xb133=['removeListener','register','./team.events','save','update','emit'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xb133,0x134));var _0x3b13=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xb133[_0x3070dc];return _0x431489;};'use strict';var TeamEvents=require(_0x3b13('0x0'));var events=[_0x3b13('0x1'),'remove',_0x3b13('0x2')];function createListener(_0x1083de,_0x4c484e){return function(_0x270da8){_0x4c484e[_0x3b13('0x3')](_0x1083de,_0x270da8);};}function removeListener(_0x41e0eb,_0x1aa35f){return function(){TeamEvents[_0x3b13('0x4')](_0x41e0eb,_0x1aa35f);};}exports[_0x3b13('0x5')]=function(_0x369c66){for(var _0xcf62b8=0x0,_0x1f5dde=events['length'];_0xcf62b8<_0x1f5dde;_0xcf62b8++){var _0x57f66e=events[_0xcf62b8];var _0x1999b0=createListener('team:'+_0x57f66e,_0x369c66);TeamEvents['on'](_0x57f66e,_0x1999b0);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 0295707..66d1543 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 _0xd976=['sequelize','exports','INTEGER'];(function(_0x5098d3,_0x245091){var _0x285389=function(_0x2a32c9){while(--_0x2a32c9){_0x5098d3['push'](_0x5098d3['shift']());}};_0x285389(++_0x245091);}(_0xd976,0x12f));var _0x6d97=function(_0x3b4d75,_0x98dd8b){_0x3b4d75=_0x3b4d75-0x0;var _0x1145bd=_0xd976[_0x3b4d75];return _0x1145bd;};'use strict';var Sequelize=require(_0x6d97('0x0'));module[_0x6d97('0x1')]={'TeamId':{'type':Sequelize[_0x6d97('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1094=['exports','INTEGER','sequelize'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0x1094,0x143));var _0x4109=function(_0x45b900,_0x2d7019){_0x45b900=_0x45b900-0x0;var _0x40233d=_0x1094[_0x45b900];return _0x40233d;};'use strict';var Sequelize=require(_0x4109('0x0'));module[_0x4109('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x4109('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 0e6249f..bcb5fdf 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 _0x4ffa=['rimraf','../../config/environment','exports','TeamVoicePrefix','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x25f55c,_0x370e04){var _0x5bef58=function(_0x370f07){while(--_0x370f07){_0x25f55c['push'](_0x25f55c['shift']());}};_0x5bef58(++_0x370e04);}(_0x4ffa,0x124));var _0xa4ff=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4ffa[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa4ff('0x0'))('api');var moment=require(_0xa4ff('0x1'));var BPromise=require(_0xa4ff('0x2'));var rp=require(_0xa4ff('0x3'));var fs=require('fs');var path=require(_0xa4ff('0x4'));var rimraf=require(_0xa4ff('0x5'));var config=require(_0xa4ff('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0xa4ff('0x7')]=function(_0x1d6a4c,_0x2bf21d){return _0x1d6a4c['define'](_0xa4ff('0x8'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93e6=['api','bluebird','path','rimraf','../../config/environment','exports','lodash'];(function(_0x2bafe8,_0xb97c89){var _0x151cfa=function(_0x33eb87){while(--_0x33eb87){_0x2bafe8['push'](_0x2bafe8['shift']());}};_0x151cfa(++_0xb97c89);}(_0x93e6,0x11e));var _0x693e=function(_0x588075,_0x43c3f1){_0x588075=_0x588075-0x0;var _0x1f79d5=_0x93e6[_0x588075];return _0x1f79d5;};'use strict';var _=require(_0x693e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x693e('0x1'));var moment=require('moment');var BPromise=require(_0x693e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x693e('0x3'));var rimraf=require(_0x693e('0x4'));var config=require(_0x693e('0x5'));var attributes=require('./teamVoicePrefix.attributes');module[_0x693e('0x6')]=function(_0x388eb6,_0x2569a4){return _0x388eb6['define']('TeamVoicePrefix',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 e64e56b..0f00d64 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x20500c,_0x1a5523){var _0x2e8ccd=function(_0x10dcbf){while(--_0x10dcbf){_0x20500c['push'](_0x20500c['shift']());}};_0x2e8ccd(++_0x1a5523);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xcb91[_0x256b72];return _0x2183e3;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x26d05f,_0x684d4b){var _0x452216=function(_0x10602b){while(--_0x10602b){_0x26d05f['push'](_0x26d05f['shift']());}};_0x452216(++_0x684d4b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 0414fdf..241a595 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe747=['exports','sequelize'];(function(_0x1726e1,_0x1cc1f4){var _0x44eccc=function(_0x29d671){while(--_0x29d671){_0x1726e1['push'](_0x1726e1['shift']());}};_0x44eccc(++_0x1cc1f4);}(_0xe747,0x13d));var _0x7e74=function(_0x12339c,_0x3aaa17){_0x12339c=_0x12339c-0x0;var _0x293f16=_0xe747[_0x12339c];return _0x293f16;};'use strict';var Sequelize=require(_0x7e74('0x0'));module[_0x7e74('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x94af=['INTEGER','sequelize'];(function(_0x1bb72f,_0x442247){var _0x21a871=function(_0x2a977e){while(--_0x2a977e){_0x1bb72f['push'](_0x1bb72f['shift']());}};_0x21a871(++_0x442247);}(_0x94af,0x18f));var _0xf94a=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x94af[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0xf94a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf94a('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 91bdfc8..aab3488 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 _0x4016=['../../config/logger','request-promise','rimraf','../../config/environment','TeamVoiceQueue','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4016,0x131));var _0x6401=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4016[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x6401('0x0'));var logger=require(_0x6401('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6401('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6401('0x3'));var config=require(_0x6401('0x4'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x3e2c0b,_0x34c7f2){return _0x3e2c0b['define'](_0x6401('0x5'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2123=['request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1425e6,_0x36e33d){var _0x24ca94=function(_0x4765f4){while(--_0x4765f4){_0x1425e6['push'](_0x1425e6['shift']());}};_0x24ca94(++_0x36e33d);}(_0x2123,0x190));var _0x3212=function(_0xec6c0a,_0x5c5aea){_0xec6c0a=_0xec6c0a-0x0;var _0x443b25=_0x2123[_0xec6c0a];return _0x443b25;};'use strict';var _=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var logger=require(_0x3212('0x2'))(_0x3212('0x3'));var moment=require(_0x3212('0x4'));var BPromise=require(_0x3212('0x5'));var rp=require(_0x3212('0x6'));var fs=require('fs');var path=require(_0x3212('0x7'));var rimraf=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var attributes=require(_0x3212('0xa'));module[_0x3212('0xb')]=function(_0x5d9d36,_0x3859e4){return _0x5d9d36[_0x3212('0xc')](_0x3212('0xd'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index dcb45d0..9953293 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 _0xba47=['TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xba47,0x1ac));var _0x7ba4=function(_0x5129aa,_0x3604c1){_0x5129aa=_0x5129aa-0x0;var _0x581c51=_0xba47[_0x5129aa];return _0x581c51;};'use strict';var _=require(_0x7ba4('0x0'));var util=require(_0x7ba4('0x1'));var moment=require(_0x7ba4('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ba4('0x3'));var fs=require('fs');var Redis=require(_0x7ba4('0x4'));var db=require(_0x7ba4('0x5'))['db'];var utils=require(_0x7ba4('0x6'));var logger=require('../../config/logger')(_0x7ba4('0x7'));var config=require(_0x7ba4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7ba4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11ea18,_0x932508,_0x227abe){return new BPromise(function(_0x7963fa,_0x380790){return client[_0x7ba4('0xa')](_0x11ea18,_0x227abe)[_0x7ba4('0xb')](function(_0x48456d){logger['info'](_0x7ba4('0xc'),_0x932508,'request\x20sent');logger[_0x7ba4('0xd')](_0x7ba4('0xe'),_0x932508,_0x7ba4('0xf'),JSON[_0x7ba4('0x10')](_0x48456d));if(_0x48456d['error']){if(_0x48456d[_0x7ba4('0x11')][_0x7ba4('0x12')]===0x1f4){logger['error'](_0x7ba4('0xc'),_0x932508,_0x48456d[_0x7ba4('0x11')][_0x7ba4('0x13')]);return _0x380790(_0x48456d['error'][_0x7ba4('0x13')]);}logger[_0x7ba4('0x11')](_0x7ba4('0xc'),_0x932508,_0x48456d[_0x7ba4('0x11')][_0x7ba4('0x13')]);return _0x7963fa(_0x48456d[_0x7ba4('0x11')][_0x7ba4('0x13')]);}else{logger[_0x7ba4('0x14')](_0x7ba4('0xc'),_0x932508,'request\x20sent');_0x7963fa(_0x48456d['result'][_0x7ba4('0x13')]);}})[_0x7ba4('0x15')](function(_0x53c7b2){logger[_0x7ba4('0x11')](_0x7ba4('0xc'),_0x932508,_0x53c7b2);_0x380790(_0x53c7b2);});});} \ No newline at end of file +var _0xdeb3=['../../config/utils','../../config/logger','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1d2f20,_0x4682e9){var _0x373018=function(_0x16ee8b){while(--_0x16ee8b){_0x1d2f20['push'](_0x1d2f20['shift']());}};_0x373018(++_0x4682e9);}(_0xdeb3,0xeb));var _0x3deb=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdeb3[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x3deb('0x0'));var util=require(_0x3deb('0x1'));var moment=require(_0x3deb('0x2'));var BPromise=require(_0x3deb('0x3'));var rs=require(_0x3deb('0x4'));var fs=require('fs');var Redis=require(_0x3deb('0x5'));var db=require(_0x3deb('0x6'))['db'];var utils=require(_0x3deb('0x7'));var logger=require(_0x3deb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3deb('0x9')][_0x3deb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c8e43,_0x14846f,_0xcaaef7){return new BPromise(function(_0x5ecf47,_0x571adc){return client[_0x3deb('0xb')](_0x3c8e43,_0xcaaef7)[_0x3deb('0xc')](function(_0x30bb01){logger[_0x3deb('0xd')](_0x3deb('0xe'),_0x14846f,_0x3deb('0xf'));logger[_0x3deb('0x10')](_0x3deb('0x11'),_0x14846f,'request\x20sent',JSON['stringify'](_0x30bb01));if(_0x30bb01['error']){if(_0x30bb01[_0x3deb('0x12')]['code']===0x1f4){logger[_0x3deb('0x12')](_0x3deb('0xe'),_0x14846f,_0x30bb01[_0x3deb('0x12')][_0x3deb('0x13')]);return _0x571adc(_0x30bb01['error'][_0x3deb('0x13')]);}logger[_0x3deb('0x12')](_0x3deb('0xe'),_0x14846f,_0x30bb01[_0x3deb('0x12')][_0x3deb('0x13')]);return _0x5ecf47(_0x30bb01[_0x3deb('0x12')][_0x3deb('0x13')]);}else{logger[_0x3deb('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x14846f,_0x3deb('0xf'));_0x5ecf47(_0x30bb01[_0x3deb('0x14')]['message']);}})[_0x3deb('0x15')](function(_0x35923e){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x14846f,_0x35923e);_0x571adc(_0x35923e);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index ab737b8..17402f4 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 _0xeda7=['/:id','show','post','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index'];(function(_0x1725bb,_0x28a801){var _0x119be2=function(_0x2f959c){while(--_0x2f959c){_0x1725bb['push'](_0x1725bb['shift']());}};_0x119be2(++_0x28a801);}(_0xeda7,0x196));var _0x7eda=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xeda7[_0x1992f1];return _0x413dfe;};'use strict';var multer=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var path=require(_0x7eda('0x2'));var timeout=require(_0x7eda('0x3'));var express=require(_0x7eda('0x4'));var router=express[_0x7eda('0x5')]();var fs_extra=require(_0x7eda('0x6'));var auth=require(_0x7eda('0x7'));var interaction=require(_0x7eda('0x8'));var config=require(_0x7eda('0x9'));var controller=require(_0x7eda('0xa'));router[_0x7eda('0xb')]('/',auth[_0x7eda('0xc')](),controller[_0x7eda('0xd')]);router[_0x7eda('0xb')](_0x7eda('0xe'),auth[_0x7eda('0xc')](),controller[_0x7eda('0xf')]);router[_0x7eda('0x10')]('/',auth[_0x7eda('0xc')](),controller['create']);router[_0x7eda('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7eda('0x12')]);router[_0x7eda('0x13')](_0x7eda('0xe'),auth[_0x7eda('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3014=['update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0xb68772,_0x5253ac){var _0x4189bb=function(_0x1b0cf3){while(--_0x1b0cf3){_0xb68772['push'](_0xb68772['shift']());}};_0x4189bb(++_0x5253ac);}(_0x3014,0x1d7));var _0x4301=function(_0x3b6c44,_0x141fb6){_0x3b6c44=_0x3b6c44-0x0;var _0x1b1b73=_0x3014[_0x3b6c44];return _0x1b1b73;};'use strict';var multer=require(_0x4301('0x0'));var util=require(_0x4301('0x1'));var path=require('path');var timeout=require(_0x4301('0x2'));var express=require(_0x4301('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4301('0x4'));var interaction=require(_0x4301('0x5'));var config=require(_0x4301('0x6'));var controller=require(_0x4301('0x7'));router[_0x4301('0x8')]('/',auth[_0x4301('0x9')](),controller[_0x4301('0xa')]);router[_0x4301('0x8')](_0x4301('0xb'),auth[_0x4301('0x9')](),controller[_0x4301('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4301('0xd')]);router[_0x4301('0xe')]('/:id',auth[_0x4301('0x9')](),controller[_0x4301('0xf')]);router[_0x4301('0x10')](_0x4301('0xb'),auth['isAuthenticated'](),controller[_0x4301('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index a868eaa..f026928 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 _0xea69=['STRING','TEXT'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xea69,0x92));var _0x9ea6=function(_0x3fbb48,_0x9b23ea){_0x3fbb48=_0x3fbb48-0x0;var _0xc1cb46=_0xea69[_0x3fbb48];return _0xc1cb46;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9ea6('0x0')]},'description':{'type':Sequelize[_0x9ea6('0x0')]},'html':{'type':Sequelize[_0x9ea6('0x1')]}}; \ No newline at end of file +var _0xcb59=['TEXT','sequelize','exports','STRING'];(function(_0x10c291,_0x17e787){var _0x1cc866=function(_0x214012){while(--_0x214012){_0x10c291['push'](_0x10c291['shift']());}};_0x1cc866(++_0x17e787);}(_0xcb59,0x155));var _0x9cb5=function(_0x1f8e17,_0x3f23e9){_0x1f8e17=_0x1f8e17-0x0;var _0x505ddb=_0xcb59[_0x1f8e17];return _0x505ddb;};'use strict';var Sequelize=require(_0x9cb5('0x0'));module[_0x9cb5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9cb5('0x2')]},'html':{'type':Sequelize[_0x9cb5('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 463efbb..e3aee93 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 _0x9936=['get','Templates','UserProfileResource','error','stack','name','send','map','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','options','Template','include','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','create','body','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x207061,_0xe38cda){var _0x4a2833=function(_0x16906e){while(--_0x16906e){_0x207061['push'](_0x207061['shift']());}};_0x4a2833(++_0xe38cda);}(_0x9936,0x1a0));var _0x6993=function(_0x423611,_0x594bc9){_0x423611=_0x423611-0x0;var _0x377ed0=_0x9936[_0x423611];return _0x377ed0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6993('0x0'));var rp=require(_0x6993('0x1'));var moment=require('moment');var BPromise=require(_0x6993('0x2'));var Mustache=require('mustache');var util=require(_0x6993('0x3'));var path=require('path');var sox=require(_0x6993('0x4'));var csv=require(_0x6993('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6993('0x6'));var _=require(_0x6993('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6993('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x6993('0x5'));var querystring=require(_0x6993('0x9'));var Papa=require(_0x6993('0xa'));var Redis=require(_0x6993('0xb'));var authService=require(_0x6993('0xc'));var qs=require(_0x6993('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6993('0xe'));var logger=require(_0x6993('0xf'))('api');var utils=require(_0x6993('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6993('0x11'))['db'];function respondWithStatusCode(_0xeedc14,_0xda5e5a){_0xda5e5a=_0xda5e5a||0xcc;return function(_0x11bd2f){if(_0x11bd2f){return _0xeedc14[_0x6993('0x12')](_0xda5e5a);}return _0xeedc14['status'](_0xda5e5a)[_0x6993('0x13')]();};}function respondWithResult(_0x34cebb,_0xd90800){_0xd90800=_0xd90800||0xc8;return function(_0x57abfc){if(_0x57abfc){return _0x34cebb[_0x6993('0x14')](_0xd90800)[_0x6993('0x15')](_0x57abfc);}};}function respondWithFilteredResult(_0xd3bd32,_0x3e024d){return function(_0x3adcff){if(_0x3adcff){var _0x300d9a=typeof _0x3e024d[_0x6993('0x16')]===_0x6993('0x17')&&typeof _0x3e024d[_0x6993('0x18')]===_0x6993('0x17');var _0x4a0e0e=_0x3adcff[_0x6993('0x19')];var _0x1c4bc4=_0x300d9a?0x0:_0x3e024d[_0x6993('0x16')];var _0x92da60=_0x300d9a?_0x3adcff[_0x6993('0x19')]:_0x3e024d[_0x6993('0x16')]+_0x3e024d[_0x6993('0x18')];var _0x7222b0;if(_0x92da60>=_0x4a0e0e){_0x92da60=_0x4a0e0e;_0x7222b0=0xc8;}else{_0x7222b0=0xce;}_0xd3bd32[_0x6993('0x14')](_0x7222b0);return _0xd3bd32[_0x6993('0x1a')](_0x6993('0x1b'),_0x1c4bc4+'-'+_0x92da60+'/'+_0x4a0e0e)[_0x6993('0x15')](_0x3adcff);}return null;};}function patchUpdates(_0x12322d){return function(_0x319d76){try{jsonpatch[_0x6993('0x1c')](_0x319d76,_0x12322d,!![]);}catch(_0x28535a){return BPromise[_0x6993('0x1d')](_0x28535a);}return _0x319d76[_0x6993('0x1e')]();};}function saveUpdates(_0xaafced,_0x55623d){return function(_0x5c2a2d){if(_0x5c2a2d){return _0x5c2a2d[_0x6993('0x1f')](_0xaafced)[_0x6993('0x20')](function(_0x28e6a9){return _0x28e6a9;});}return null;};}function removeEntity(_0x3b2de5,_0xdacf79){return function(_0x48edc1){if(_0x48edc1){return _0x48edc1[_0x6993('0x21')]()['then'](function(){var _0x100bbd=_0x48edc1[_0x6993('0x22')]({'plain':!![]});var _0x54a077=_0x6993('0x23');return db[_0x6993('0x24')][_0x6993('0x21')]({'where':{'type':_0x54a077,'resourceId':_0x100bbd['id']}})[_0x6993('0x20')](function(){return _0x48edc1;});})['then'](function(){_0x3b2de5[_0x6993('0x14')](0xcc)[_0x6993('0x13')]();});}};}function handleEntityNotFound(_0xcc7644,_0x3582ea){return function(_0x4cc348){if(!_0x4cc348){_0xcc7644[_0x6993('0x12')](0x194);}return _0x4cc348;};}function handleError(_0x4748bc,_0x3b4422){_0x3b4422=_0x3b4422||0x1f4;return function(_0x26e91b){logger[_0x6993('0x25')](_0x26e91b[_0x6993('0x26')]);if(_0x26e91b[_0x6993('0x27')]){delete _0x26e91b[_0x6993('0x27')];}_0x4748bc['status'](_0x3b4422)[_0x6993('0x28')](_0x26e91b);};}exports['index']=function(_0x2e2d51,_0x22a149){var _0x29080f={},_0x22b482={},_0x39d7a2={'count':0x0,'rows':[]};var _0x56da32=_[_0x6993('0x29')](db['Template']['rawAttributes'],function(_0x4ff07b){return{'name':_0x4ff07b[_0x6993('0x2a')],'type':_0x4ff07b[_0x6993('0x2b')][_0x6993('0x2c')]};});_0x22b482[_0x6993('0x2d')]=_['map'](_0x56da32,'name');_0x22b482[_0x6993('0x2e')]=_['keys'](_0x2e2d51[_0x6993('0x2e')]);_0x22b482['filters']=_[_0x6993('0x2f')](_0x22b482[_0x6993('0x2d')],_0x22b482['query']);_0x29080f[_0x6993('0x30')]=_['intersection'](_0x22b482['model'],qs[_0x6993('0x31')](_0x2e2d51[_0x6993('0x2e')][_0x6993('0x31')]));_0x29080f[_0x6993('0x30')]=_0x29080f[_0x6993('0x30')]['length']?_0x29080f['attributes']:_0x22b482['model'];if(!_0x2e2d51[_0x6993('0x2e')][_0x6993('0x32')]('nolimit')){_0x29080f[_0x6993('0x18')]=qs[_0x6993('0x18')](_0x2e2d51[_0x6993('0x2e')][_0x6993('0x18')]);_0x29080f[_0x6993('0x16')]=qs[_0x6993('0x16')](_0x2e2d51['query']['offset']);}_0x29080f[_0x6993('0x33')]=qs[_0x6993('0x34')](_0x2e2d51[_0x6993('0x2e')]['sort']);_0x29080f[_0x6993('0x35')]=qs['filters'](_['pick'](_0x2e2d51[_0x6993('0x2e')],_0x22b482['filters']),_0x56da32);if(_0x2e2d51['query'][_0x6993('0x36')]){_0x29080f[_0x6993('0x35')]=_[_0x6993('0x37')](_0x29080f[_0x6993('0x35')],{'$or':_[_0x6993('0x29')](_0x56da32,function(_0x3e3597){if(_0x3e3597['type']!=='VIRTUAL'){var _0x4c8fee={};_0x4c8fee[_0x3e3597[_0x6993('0x27')]]={'$like':'%'+_0x2e2d51[_0x6993('0x2e')][_0x6993('0x36')]+'%'};return _0x4c8fee;}})});}_0x29080f=_[_0x6993('0x37')]({},_0x29080f,_0x2e2d51[_0x6993('0x38')]);var _0x3a2894={'where':_0x29080f[_0x6993('0x35')]};return db[_0x6993('0x39')][_0x6993('0x19')](_0x3a2894)[_0x6993('0x20')](function(_0x1cba57){_0x39d7a2['count']=_0x1cba57;if(_0x2e2d51[_0x6993('0x2e')]['includeAll']){_0x29080f[_0x6993('0x3a')]=[{'all':!![]}];}return db['Template'][_0x6993('0x3b')](_0x29080f);})[_0x6993('0x20')](function(_0x51f625){_0x39d7a2[_0x6993('0x3c')]=_0x51f625;return _0x39d7a2;})['then'](respondWithFilteredResult(_0x22a149,_0x29080f))[_0x6993('0x3d')](handleError(_0x22a149,null));};exports[_0x6993('0x3e')]=function(_0x1797a8,_0x35da0c){var _0x2eab7f={'raw':!![],'where':{'id':_0x1797a8[_0x6993('0x3f')]['id']}},_0x361341={};_0x361341[_0x6993('0x2d')]=_[_0x6993('0x40')](db['Template'][_0x6993('0x41')]);_0x361341[_0x6993('0x2e')]=_[_0x6993('0x40')](_0x1797a8[_0x6993('0x2e')]);_0x361341['filters']=_['intersection'](_0x361341[_0x6993('0x2d')],_0x361341[_0x6993('0x2e')]);_0x2eab7f[_0x6993('0x30')]=_[_0x6993('0x2f')](_0x361341['model'],qs[_0x6993('0x31')](_0x1797a8[_0x6993('0x2e')][_0x6993('0x31')]));_0x2eab7f[_0x6993('0x30')]=_0x2eab7f[_0x6993('0x30')][_0x6993('0x42')]?_0x2eab7f[_0x6993('0x30')]:_0x361341[_0x6993('0x2d')];if(_0x1797a8['query'][_0x6993('0x43')]){_0x2eab7f['include']=[{'all':!![]}];}_0x2eab7f=_[_0x6993('0x37')]({},_0x2eab7f,_0x1797a8[_0x6993('0x38')]);return db[_0x6993('0x39')]['find'](_0x2eab7f)['then'](handleEntityNotFound(_0x35da0c,null))[_0x6993('0x20')](respondWithResult(_0x35da0c,null))[_0x6993('0x3d')](handleError(_0x35da0c,null));};exports[_0x6993('0x44')]=function(_0x21d9de,_0x5233d6){return db[_0x6993('0x39')]['create'](_0x21d9de[_0x6993('0x45')],{})[_0x6993('0x20')](function(_0x416a58){var _0x7d3dd0=_0x21d9de[_0x6993('0x46')][_0x6993('0x22')]({'plain':!![]});if(!_0x7d3dd0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7d3dd0[_0x6993('0x47')]===_0x6993('0x46')){var _0x1302ab=_0x416a58[_0x6993('0x22')]({'plain':!![]});var _0x4638d1=_0x6993('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x4638d1,'userProfileId':_0x7d3dd0[_0x6993('0x48')]},'raw':!![]})['then'](function(_0x567b33){if(_0x567b33&&_0x567b33['autoAssociation']===0x0){return db['UserProfileResource'][_0x6993('0x44')]({'name':_0x1302ab[_0x6993('0x27')],'resourceId':_0x1302ab['id'],'type':_0x567b33[_0x6993('0x27')],'sectionId':_0x567b33['id']},{})['then'](function(){return _0x416a58;});}else{return _0x416a58;}})['catch'](function(_0x21db8d){logger[_0x6993('0x25')](_0x6993('0x49'),_0x21db8d);throw _0x21db8d;});}return _0x416a58;})[_0x6993('0x20')](respondWithResult(_0x5233d6,0xc9))['catch'](handleError(_0x5233d6,null));};exports[_0x6993('0x1f')]=function(_0x200beb,_0xd754d5){if(_0x200beb[_0x6993('0x45')]['id']){delete _0x200beb[_0x6993('0x45')]['id'];}return db[_0x6993('0x39')][_0x6993('0x4a')]({'where':{'id':_0x200beb[_0x6993('0x3f')]['id']}})[_0x6993('0x20')](handleEntityNotFound(_0xd754d5,null))['then'](saveUpdates(_0x200beb['body'],null))[_0x6993('0x20')](respondWithResult(_0xd754d5,null))['catch'](handleError(_0xd754d5,null));};exports['destroy']=function(_0xa148f2,_0x22fd58){return db[_0x6993('0x39')][_0x6993('0x4a')]({'where':{'id':_0xa148f2[_0x6993('0x3f')]['id']}})[_0x6993('0x20')](handleEntityNotFound(_0x22fd58,null))[_0x6993('0x20')](removeEntity(_0x22fd58,null))[_0x6993('0x3d')](handleError(_0x22fd58,null));}; \ No newline at end of file +var _0x00f9=['show','params','length','options','find','catch','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','apply','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','Template','includeAll','include','findAll','rows'];(function(_0x4536d7,_0x2c14bd){var _0x268280=function(_0x36b137){while(--_0x36b137){_0x4536d7['push'](_0x4536d7['shift']());}};_0x268280(++_0x2c14bd);}(_0x00f9,0x14d));var _0x900f=function(_0xae01dd,_0xbd8a3c){_0xae01dd=_0xae01dd-0x0;var _0x8c26df=_0x00f9[_0xae01dd];return _0x8c26df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x900f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x900f('0x1'));var rp=require(_0x900f('0x2'));var moment=require(_0x900f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x900f('0x4'));var path=require(_0x900f('0x5'));var sox=require(_0x900f('0x6'));var csv=require(_0x900f('0x7'));var ejs=require(_0x900f('0x8'));var fs=require('fs');var fs_extra=require(_0x900f('0x9'));var _=require(_0x900f('0xa'));var squel=require(_0x900f('0xb'));var crypto=require('crypto');var jsforce=require(_0x900f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x900f('0xd'));var Papa=require('papaparse');var Redis=require(_0x900f('0xe'));var authService=require(_0x900f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x900f('0x10'));var logger=require(_0x900f('0x11'))(_0x900f('0x12'));var utils=require(_0x900f('0x13'));var config=require(_0x900f('0x14'));var licenseUtil=require(_0x900f('0x15'));var db=require(_0x900f('0x16'))['db'];function respondWithStatusCode(_0x1bdd5c,_0x286080){_0x286080=_0x286080||0xcc;return function(_0x5d96dc){if(_0x5d96dc){return _0x1bdd5c[_0x900f('0x17')](_0x286080);}return _0x1bdd5c[_0x900f('0x18')](_0x286080)[_0x900f('0x19')]();};}function respondWithResult(_0xe206e2,_0x25fe74){_0x25fe74=_0x25fe74||0xc8;return function(_0x55a66b){if(_0x55a66b){return _0xe206e2[_0x900f('0x18')](_0x25fe74)[_0x900f('0x1a')](_0x55a66b);}};}function respondWithFilteredResult(_0x14f05,_0x592424){return function(_0x14c8cd){if(_0x14c8cd){var _0x1a8025=typeof _0x592424['offset']==='undefined'&&typeof _0x592424['limit']===_0x900f('0x1b');var _0x1c1265=_0x14c8cd['count'];var _0x187e54=_0x1a8025?0x0:_0x592424[_0x900f('0x1c')];var _0x4c9225=_0x1a8025?_0x14c8cd[_0x900f('0x1d')]:_0x592424[_0x900f('0x1c')]+_0x592424[_0x900f('0x1e')];var _0x359e1;if(_0x4c9225>=_0x1c1265){_0x4c9225=_0x1c1265;_0x359e1=0xc8;}else{_0x359e1=0xce;}_0x14f05[_0x900f('0x18')](_0x359e1);return _0x14f05['set'](_0x900f('0x1f'),_0x187e54+'-'+_0x4c9225+'/'+_0x1c1265)[_0x900f('0x1a')](_0x14c8cd);}return null;};}function patchUpdates(_0x2b5769){return function(_0x59302c){try{jsonpatch[_0x900f('0x20')](_0x59302c,_0x2b5769,!![]);}catch(_0xc60785){return BPromise['reject'](_0xc60785);}return _0x59302c['save']();};}function saveUpdates(_0x44de18,_0x46ef4b){return function(_0x1fa889){if(_0x1fa889){return _0x1fa889[_0x900f('0x21')](_0x44de18)[_0x900f('0x22')](function(_0x4879fd){return _0x4879fd;});}return null;};}function removeEntity(_0x474350,_0x546d2f){return function(_0x286a58){if(_0x286a58){return _0x286a58[_0x900f('0x23')]()[_0x900f('0x22')](function(){var _0x5ea123=_0x286a58[_0x900f('0x24')]({'plain':!![]});var _0x52ee3d=_0x900f('0x25');return db[_0x900f('0x26')]['destroy']({'where':{'type':_0x52ee3d,'resourceId':_0x5ea123['id']}})['then'](function(){return _0x286a58;});})[_0x900f('0x22')](function(){_0x474350[_0x900f('0x18')](0xcc)[_0x900f('0x19')]();});}};}function handleEntityNotFound(_0x1e802a,_0x1d19dd){return function(_0x4a09a9){if(!_0x4a09a9){_0x1e802a['sendStatus'](0x194);}return _0x4a09a9;};}function handleError(_0x108bc3,_0xa0f082){_0xa0f082=_0xa0f082||0x1f4;return function(_0x210461){logger[_0x900f('0x27')](_0x210461[_0x900f('0x28')]);if(_0x210461[_0x900f('0x29')]){delete _0x210461[_0x900f('0x29')];}_0x108bc3['status'](_0xa0f082)['send'](_0x210461);};}exports[_0x900f('0x2a')]=function(_0x576706,_0x116ced){var _0x34f0e9={},_0x188212={},_0xe9dd2e={'count':0x0,'rows':[]};var _0x2340ab=_['map'](db['Template'][_0x900f('0x2b')],function(_0xdbc104){return{'name':_0xdbc104[_0x900f('0x2c')],'type':_0xdbc104['type'][_0x900f('0x2d')]};});_0x188212[_0x900f('0x2e')]=_[_0x900f('0x2f')](_0x2340ab,_0x900f('0x29'));_0x188212[_0x900f('0x30')]=_[_0x900f('0x31')](_0x576706['query']);_0x188212[_0x900f('0x32')]=_['intersection'](_0x188212[_0x900f('0x2e')],_0x188212[_0x900f('0x30')]);_0x34f0e9[_0x900f('0x33')]=_[_0x900f('0x34')](_0x188212[_0x900f('0x2e')],qs[_0x900f('0x35')](_0x576706[_0x900f('0x30')][_0x900f('0x35')]));_0x34f0e9[_0x900f('0x33')]=_0x34f0e9[_0x900f('0x33')]['length']?_0x34f0e9[_0x900f('0x33')]:_0x188212[_0x900f('0x2e')];if(!_0x576706[_0x900f('0x30')][_0x900f('0x36')](_0x900f('0x37'))){_0x34f0e9['limit']=qs[_0x900f('0x1e')](_0x576706[_0x900f('0x30')][_0x900f('0x1e')]);_0x34f0e9[_0x900f('0x1c')]=qs[_0x900f('0x1c')](_0x576706[_0x900f('0x30')][_0x900f('0x1c')]);}_0x34f0e9['order']=qs[_0x900f('0x38')](_0x576706['query']['sort']);_0x34f0e9[_0x900f('0x39')]=qs[_0x900f('0x32')](_[_0x900f('0x3a')](_0x576706['query'],_0x188212[_0x900f('0x32')]),_0x2340ab);if(_0x576706['query'][_0x900f('0x3b')]){_0x34f0e9[_0x900f('0x39')]=_[_0x900f('0x3c')](_0x34f0e9[_0x900f('0x39')],{'$or':_[_0x900f('0x2f')](_0x2340ab,function(_0x3c29cf){if(_0x3c29cf[_0x900f('0x3d')]!=='VIRTUAL'){var _0x4057af={};_0x4057af[_0x3c29cf['name']]={'$like':'%'+_0x576706[_0x900f('0x30')]['filter']+'%'};return _0x4057af;}})});}_0x34f0e9=_[_0x900f('0x3c')]({},_0x34f0e9,_0x576706['options']);var _0x13531f={'where':_0x34f0e9[_0x900f('0x39')]};return db[_0x900f('0x3e')][_0x900f('0x1d')](_0x13531f)[_0x900f('0x22')](function(_0x70c01c){_0xe9dd2e[_0x900f('0x1d')]=_0x70c01c;if(_0x576706[_0x900f('0x30')][_0x900f('0x3f')]){_0x34f0e9[_0x900f('0x40')]=[{'all':!![]}];}return db[_0x900f('0x3e')][_0x900f('0x41')](_0x34f0e9);})[_0x900f('0x22')](function(_0x5deb36){_0xe9dd2e[_0x900f('0x42')]=_0x5deb36;return _0xe9dd2e;})[_0x900f('0x22')](respondWithFilteredResult(_0x116ced,_0x34f0e9))['catch'](handleError(_0x116ced,null));};exports[_0x900f('0x43')]=function(_0x142c07,_0x28424e){var _0x40dd64={'raw':!![],'where':{'id':_0x142c07[_0x900f('0x44')]['id']}},_0x1f7478={};_0x1f7478[_0x900f('0x2e')]=_['keys'](db['Template'][_0x900f('0x2b')]);_0x1f7478[_0x900f('0x30')]=_[_0x900f('0x31')](_0x142c07[_0x900f('0x30')]);_0x1f7478['filters']=_[_0x900f('0x34')](_0x1f7478['model'],_0x1f7478[_0x900f('0x30')]);_0x40dd64['attributes']=_[_0x900f('0x34')](_0x1f7478['model'],qs[_0x900f('0x35')](_0x142c07[_0x900f('0x30')]['fields']));_0x40dd64['attributes']=_0x40dd64[_0x900f('0x33')][_0x900f('0x45')]?_0x40dd64[_0x900f('0x33')]:_0x1f7478['model'];if(_0x142c07[_0x900f('0x30')][_0x900f('0x3f')]){_0x40dd64[_0x900f('0x40')]=[{'all':!![]}];}_0x40dd64=_[_0x900f('0x3c')]({},_0x40dd64,_0x142c07[_0x900f('0x46')]);return db[_0x900f('0x3e')][_0x900f('0x47')](_0x40dd64)[_0x900f('0x22')](handleEntityNotFound(_0x28424e,null))[_0x900f('0x22')](respondWithResult(_0x28424e,null))[_0x900f('0x48')](handleError(_0x28424e,null));};exports['create']=function(_0x27d2d8,_0x1dab3a){return db['Template'][_0x900f('0x49')](_0x27d2d8['body'],{})[_0x900f('0x22')](function(_0x3eb30a){var _0xaa1a90=_0x27d2d8[_0x900f('0x4a')][_0x900f('0x24')]({'plain':!![]});if(!_0xaa1a90)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xaa1a90['role']===_0x900f('0x4a')){var _0x41952b=_0x3eb30a['get']({'plain':!![]});var _0x48472d=_0x900f('0x25');return db[_0x900f('0x4b')][_0x900f('0x47')]({'where':{'name':_0x48472d,'userProfileId':_0xaa1a90[_0x900f('0x4c')]},'raw':!![]})['then'](function(_0x9113fa){if(_0x9113fa&&_0x9113fa[_0x900f('0x4d')]===0x0){return db[_0x900f('0x26')][_0x900f('0x49')]({'name':_0x41952b[_0x900f('0x29')],'resourceId':_0x41952b['id'],'type':_0x9113fa[_0x900f('0x29')],'sectionId':_0x9113fa['id']},{})[_0x900f('0x22')](function(){return _0x3eb30a;});}else{return _0x3eb30a;}})[_0x900f('0x48')](function(_0x4beb64){logger[_0x900f('0x27')](_0x900f('0x4e'),_0x4beb64);throw _0x4beb64;});}return _0x3eb30a;})[_0x900f('0x22')](respondWithResult(_0x1dab3a,0xc9))[_0x900f('0x48')](handleError(_0x1dab3a,null));};exports[_0x900f('0x21')]=function(_0x5a9301,_0x53ef12){if(_0x5a9301[_0x900f('0x4f')]['id']){delete _0x5a9301[_0x900f('0x4f')]['id'];}return db[_0x900f('0x3e')]['find']({'where':{'id':_0x5a9301[_0x900f('0x44')]['id']}})[_0x900f('0x22')](handleEntityNotFound(_0x53ef12,null))[_0x900f('0x22')](saveUpdates(_0x5a9301[_0x900f('0x4f')],null))[_0x900f('0x22')](respondWithResult(_0x53ef12,null))[_0x900f('0x48')](handleError(_0x53ef12,null));};exports['destroy']=function(_0x18946d,_0x5c14e2){return db['Template'][_0x900f('0x47')]({'where':{'id':_0x18946d['params']['id']}})[_0x900f('0x22')](handleEntityNotFound(_0x5c14e2,null))[_0x900f('0x22')](removeEntity(_0x5c14e2,null))[_0x900f('0x48')](handleError(_0x5c14e2,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 7a45bfe..d18d81d 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 _0x2016=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','tools_templates','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2016,0x175));var _0x6201=function(_0x526f4f,_0xd67b84){_0x526f4f=_0x526f4f-0x0;var _0x301e5a=_0x2016[_0x526f4f];return _0x301e5a;};'use strict';var _=require('lodash');var util=require(_0x6201('0x0'));var logger=require(_0x6201('0x1'))('api');var moment=require(_0x6201('0x2'));var BPromise=require(_0x6201('0x3'));var rp=require(_0x6201('0x4'));var fs=require('fs');var path=require(_0x6201('0x5'));var rimraf=require(_0x6201('0x6'));var config=require(_0x6201('0x7'));var attributes=require(_0x6201('0x8'));module[_0x6201('0x9')]=function(_0x23e6f7,_0x19dd2a){return _0x23e6f7['define']('Template',attributes,{'tableName':_0x6201('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4107=['rimraf','./template.attributes','exports','define','Template','tools_templates','lodash','util','api','moment','request-promise'];(function(_0x3ebb69,_0x3e612e){var _0x421e59=function(_0x5a8c66){while(--_0x5a8c66){_0x3ebb69['push'](_0x3ebb69['shift']());}};_0x421e59(++_0x3e612e);}(_0x4107,0x1c9));var _0x7410=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0x4107[_0x202c61];return _0x540691;};'use strict';var _=require(_0x7410('0x0'));var util=require(_0x7410('0x1'));var logger=require('../../config/logger')(_0x7410('0x2'));var moment=require(_0x7410('0x3'));var BPromise=require('bluebird');var rp=require(_0x7410('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7410('0x5'));var config=require('../../config/environment');var attributes=require(_0x7410('0x6'));module[_0x7410('0x7')]=function(_0xbd472a,_0x4fbcca){return _0xbd472a[_0x7410('0x8')](_0x7410('0x9'),attributes,{'tableName':_0x7410('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index a06f572..f749d4b 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 _0x4178=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','where','attributes','limit','include','map','model','GetTemplate','catch','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x4178,0x7f));var _0x8417=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x4178[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0x8417('0x0'));var moment=require(_0x8417('0x1'));var BPromise=require(_0x8417('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8417('0x3'));var db=require(_0x8417('0x4'))['db'];var utils=require(_0x8417('0x5'));var logger=require(_0x8417('0x6'))(_0x8417('0x7'));var config=require(_0x8417('0x8'));var jayson=require(_0x8417('0x9'));var client=jayson[_0x8417('0xa')][_0x8417('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ca2a5,_0x3981be,_0x5f0140){return new BPromise(function(_0x3ab6f5,_0x14b485){return client['request'](_0x2ca2a5,_0x5f0140)[_0x8417('0xc')](function(_0x2abab1){logger[_0x8417('0xd')](_0x8417('0xe'),_0x3981be,_0x8417('0xf'));logger[_0x8417('0x10')](_0x8417('0x11'),_0x3981be,'request\x20sent',JSON[_0x8417('0x12')](_0x2abab1));if(_0x2abab1[_0x8417('0x13')]){if(_0x2abab1[_0x8417('0x13')][_0x8417('0x14')]===0x1f4){logger['error'](_0x8417('0xe'),_0x3981be,_0x2abab1[_0x8417('0x13')][_0x8417('0x15')]);return _0x14b485(_0x2abab1[_0x8417('0x13')][_0x8417('0x15')]);}logger['error'](_0x8417('0xe'),_0x3981be,_0x2abab1[_0x8417('0x13')][_0x8417('0x15')]);return _0x3ab6f5(_0x2abab1[_0x8417('0x13')][_0x8417('0x15')]);}else{logger[_0x8417('0xd')](_0x8417('0xe'),_0x3981be,'request\x20sent');_0x3ab6f5(_0x2abab1[_0x8417('0x16')][_0x8417('0x15')]);}})['catch'](function(_0xfb0896){logger[_0x8417('0x13')](_0x8417('0xe'),_0x3981be,_0xfb0896);_0x14b485(_0xfb0896);});});}exports['GetTemplate']=function(_0x2c2714){var _0x41d640=this;return new Promise(function(_0x1cfcb8,_0x35ec6e){return db['Template'][_0x8417('0x17')]({'raw':_0x2c2714['options']?_0x2c2714[_0x8417('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2c2714[_0x8417('0x18')]?_0x2c2714['options'][_0x8417('0x19')]||null:null,'attributes':_0x2c2714['options']?_0x2c2714[_0x8417('0x18')][_0x8417('0x1a')]||null:null,'limit':_0x2c2714['options']?_0x2c2714['options'][_0x8417('0x1b')]||null:null,'include':_0x2c2714[_0x8417('0x18')]?_0x2c2714[_0x8417('0x18')][_0x8417('0x1c')]?_[_0x8417('0x1d')](_0x2c2714['options']['include'],function(_0x46939){return{'model':db[_0x46939[_0x8417('0x1e')]],'as':_0x46939['as'],'attributes':_0x46939[_0x8417('0x1a')],'include':_0x46939[_0x8417('0x1c')]?_[_0x8417('0x1d')](_0x46939['include'],function(_0x2b157c){return{'model':db[_0x2b157c[_0x8417('0x1e')]],'as':_0x2b157c['as'],'attributes':_0x2b157c[_0x8417('0x1a')],'include':_0x2b157c[_0x8417('0x1c')]?_[_0x8417('0x1d')](_0x2b157c['include'],function(_0x384a55){return{'model':db[_0x384a55[_0x8417('0x1e')]],'as':_0x384a55['as'],'attributes':_0x384a55['attributes']};}):[]};}):[]};}):[]:[]})[_0x8417('0xc')](function(_0x3a25d3){logger[_0x8417('0xd')]('GetTemplate',_0x2c2714);logger[_0x8417('0x10')](_0x8417('0x1f'),_0x2c2714,JSON['stringify'](_0x3a25d3));_0x1cfcb8(_0x3a25d3);})[_0x8417('0x20')](function(_0x301ad2){logger[_0x8417('0x13')](_0x8417('0x1f'),_0x301ad2['message'],_0x2c2714);_0x35ec6e(_0x41d640['error'](0x1f4,_0x301ad2[_0x8417('0x15')]));});});}; \ No newline at end of file +var _0x7d26=['findAll','options','where','include','map','model','attributes','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','Template,\x20%s,\x20%s','message','result','catch','GetTemplate'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7d26,0x16f));var _0x67d2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7d26[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x67d2('0x0'));var moment=require('moment');var BPromise=require(_0x67d2('0x1'));var rs=require(_0x67d2('0x2'));var fs=require('fs');var Redis=require(_0x67d2('0x3'));var db=require(_0x67d2('0x4'))['db'];var utils=require(_0x67d2('0x5'));var logger=require(_0x67d2('0x6'))(_0x67d2('0x7'));var config=require(_0x67d2('0x8'));var jayson=require(_0x67d2('0x9'));var client=jayson[_0x67d2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2479fa,_0x46683f,_0x1b3cfe){return new BPromise(function(_0x158c03,_0xbd653e){return client[_0x67d2('0xb')](_0x2479fa,_0x1b3cfe)[_0x67d2('0xc')](function(_0xdc85a0){logger[_0x67d2('0xd')]('Template,\x20%s,\x20%s',_0x46683f,_0x67d2('0xe'));logger[_0x67d2('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x46683f,'request\x20sent',JSON[_0x67d2('0x10')](_0xdc85a0));if(_0xdc85a0[_0x67d2('0x11')]){if(_0xdc85a0[_0x67d2('0x11')]['code']===0x1f4){logger[_0x67d2('0x11')](_0x67d2('0x12'),_0x46683f,_0xdc85a0[_0x67d2('0x11')][_0x67d2('0x13')]);return _0xbd653e(_0xdc85a0[_0x67d2('0x11')][_0x67d2('0x13')]);}logger[_0x67d2('0x11')](_0x67d2('0x12'),_0x46683f,_0xdc85a0[_0x67d2('0x11')]['message']);return _0x158c03(_0xdc85a0[_0x67d2('0x11')][_0x67d2('0x13')]);}else{logger[_0x67d2('0xd')](_0x67d2('0x12'),_0x46683f,_0x67d2('0xe'));_0x158c03(_0xdc85a0[_0x67d2('0x14')]['message']);}})[_0x67d2('0x15')](function(_0x4d7d1c){logger['error'](_0x67d2('0x12'),_0x46683f,_0x4d7d1c);_0xbd653e(_0x4d7d1c);});});}exports[_0x67d2('0x16')]=function(_0x38e228){var _0xf32f25=this;return new Promise(function(_0x19c651,_0x360cac){return db['Template'][_0x67d2('0x17')]({'raw':_0x38e228[_0x67d2('0x18')]?_0x38e228[_0x67d2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x38e228['options']?_0x38e228['options'][_0x67d2('0x19')]||null:null,'attributes':_0x38e228['options']?_0x38e228[_0x67d2('0x18')]['attributes']||null:null,'limit':_0x38e228[_0x67d2('0x18')]?_0x38e228['options']['limit']||null:null,'include':_0x38e228[_0x67d2('0x18')]?_0x38e228[_0x67d2('0x18')][_0x67d2('0x1a')]?_[_0x67d2('0x1b')](_0x38e228[_0x67d2('0x18')][_0x67d2('0x1a')],function(_0x225d05){return{'model':db[_0x225d05[_0x67d2('0x1c')]],'as':_0x225d05['as'],'attributes':_0x225d05[_0x67d2('0x1d')],'include':_0x225d05[_0x67d2('0x1a')]?_['map'](_0x225d05[_0x67d2('0x1a')],function(_0x2f5da7){return{'model':db[_0x2f5da7[_0x67d2('0x1c')]],'as':_0x2f5da7['as'],'attributes':_0x2f5da7[_0x67d2('0x1d')],'include':_0x2f5da7[_0x67d2('0x1a')]?_[_0x67d2('0x1b')](_0x2f5da7[_0x67d2('0x1a')],function(_0x2ab9fc){return{'model':db[_0x2ab9fc[_0x67d2('0x1c')]],'as':_0x2ab9fc['as'],'attributes':_0x2ab9fc[_0x67d2('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a0956){logger[_0x67d2('0xd')](_0x67d2('0x16'),_0x38e228);logger['debug'](_0x67d2('0x16'),_0x38e228,JSON[_0x67d2('0x10')](_0x1a0956));_0x19c651(_0x1a0956);})['catch'](function(_0x3e36f8){logger['error'](_0x67d2('0x16'),_0x3e36f8['message'],_0x38e228);_0x360cac(_0xf32f25[_0x67d2('0x11')](0x1f4,_0x3e36f8[_0x67d2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 10c0f08..0cb1786 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 _0xde4d=['addAllCondition','addAnyCondition','addAction','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','get','index','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','post'];(function(_0x2f5ca2,_0x661e5f){var _0x2aa53f=function(_0x20d52c){while(--_0x20d52c){_0x2f5ca2['push'](_0x2f5ca2['shift']());}};_0x2aa53f(++_0x661e5f);}(_0xde4d,0xf1));var _0xdde4=function(_0x3673ff,_0x58bfdb){_0x3673ff=_0x3673ff-0x0;var _0x530bf5=_0xde4d[_0x3673ff];return _0x530bf5;};'use strict';var multer=require(_0xdde4('0x0'));var util=require(_0xdde4('0x1'));var path=require(_0xdde4('0x2'));var timeout=require(_0xdde4('0x3'));var express=require(_0xdde4('0x4'));var router=express[_0xdde4('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('./trigger.controller');router[_0xdde4('0x6')]('/',auth['isAuthenticated'](),controller[_0xdde4('0x7')]);router['get'](_0xdde4('0x8'),auth[_0xdde4('0x9')](),controller[_0xdde4('0xa')]);router[_0xdde4('0x6')](_0xdde4('0xb'),auth['isAuthenticated'](),controller[_0xdde4('0xc')]);router['get'](_0xdde4('0xd'),auth[_0xdde4('0x9')](),controller[_0xdde4('0xe')]);router[_0xdde4('0x6')](_0xdde4('0xf'),auth['isAuthenticated'](),controller[_0xdde4('0x10')]);router['post']('/',auth[_0xdde4('0x9')](),controller[_0xdde4('0x11')]);router[_0xdde4('0x12')](_0xdde4('0xb'),auth[_0xdde4('0x9')](),controller[_0xdde4('0x13')]);router[_0xdde4('0x12')](_0xdde4('0xd'),auth[_0xdde4('0x9')](),controller[_0xdde4('0x14')]);router[_0xdde4('0x12')](_0xdde4('0xf'),auth['isAuthenticated'](),controller[_0xdde4('0x15')]);router[_0xdde4('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xdde4('0x17')]);router[_0xdde4('0x18')](_0xdde4('0x8'),auth[_0xdde4('0x9')](),controller['destroy']);module[_0xdde4('0x19')]=router; \ No newline at end of file +var _0x4220=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./trigger.controller','isAuthenticated','index','get','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAnyCondition','addAction','put'];(function(_0x49d19d,_0x245cf5){var _0x4ebef1=function(_0xf0a4e6){while(--_0xf0a4e6){_0x49d19d['push'](_0x49d19d['shift']());}};_0x4ebef1(++_0x245cf5);}(_0x4220,0xd4));var _0x0422=function(_0x5837dd,_0x47bd39){_0x5837dd=_0x5837dd-0x0;var _0x3fa3a6=_0x4220[_0x5837dd];return _0x3fa3a6;};'use strict';var multer=require('multer');var util=require(_0x0422('0x0'));var path=require(_0x0422('0x1'));var timeout=require(_0x0422('0x2'));var express=require(_0x0422('0x3'));var router=express[_0x0422('0x4')]();var fs_extra=require(_0x0422('0x5'));var auth=require(_0x0422('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0422('0x7'));router['get']('/',auth[_0x0422('0x8')](),controller[_0x0422('0x9')]);router[_0x0422('0xa')]('/:id',auth[_0x0422('0x8')](),controller[_0x0422('0xb')]);router['get'](_0x0422('0xc'),auth[_0x0422('0x8')](),controller['getAllConditions']);router[_0x0422('0xa')](_0x0422('0xd'),auth[_0x0422('0x8')](),controller[_0x0422('0xe')]);router[_0x0422('0xa')](_0x0422('0xf'),auth['isAuthenticated'](),controller[_0x0422('0x10')]);router[_0x0422('0x11')]('/',auth[_0x0422('0x8')](),controller[_0x0422('0x12')]);router[_0x0422('0x11')](_0x0422('0xc'),auth[_0x0422('0x8')](),controller['addAllCondition']);router[_0x0422('0x11')]('/:id/any_conditions',auth[_0x0422('0x8')](),controller[_0x0422('0x13')]);router[_0x0422('0x11')](_0x0422('0xf'),auth[_0x0422('0x8')](),controller[_0x0422('0x14')]);router[_0x0422('0x15')](_0x0422('0x16'),auth['isAuthenticated'](),controller[_0x0422('0x17')]);router[_0x0422('0x18')](_0x0422('0x16'),auth[_0x0422('0x8')](),controller['destroy']);module[_0x0422('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 9f920a0..6bbbb50 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 _0x769f=['STRING','BOOLEAN','sequelize','exports'];(function(_0x29ef77,_0x5b1ec7){var _0x407408=function(_0x4c9c55){while(--_0x4c9c55){_0x29ef77['push'](_0x29ef77['shift']());}};_0x407408(++_0x5b1ec7);}(_0x769f,0xea));var _0xf769=function(_0x2b0954,_0x3c511b){_0x2b0954=_0x2b0954-0x0;var _0x55272e=_0x769f[_0x2b0954];return _0x55272e;};'use strict';var Sequelize=require(_0xf769('0x0'));module[_0xf769('0x1')]={'name':{'type':Sequelize[_0xf769('0x2')]},'channel':{'type':Sequelize[_0xf769('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xf769('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5398=['STRING','BOOLEAN','sequelize','exports'];(function(_0x51f40e,_0x14e8ea){var _0xb37761=function(_0x10bce3){while(--_0x10bce3){_0x51f40e['push'](_0x51f40e['shift']());}};_0xb37761(++_0x14e8ea);}(_0x5398,0x146));var _0x8539=function(_0x201d3e,_0x28f61a){_0x201d3e=_0x201d3e-0x0;var _0x36d221=_0x5398[_0x201d3e];return _0x36d221;};'use strict';var Sequelize=require(_0x8539('0x0'));module[_0x8539('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8539('0x2')]},'description':{'type':Sequelize[_0x8539('0x2')]},'status':{'type':Sequelize[_0x8539('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index d782bf9..036fc34 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 _0x9140=['set','apply','reject','save','then','destroy','get','UserProfileResource','error','name','status','send','index','map','Trigger','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addAllCondition','Condition','TriggerAnyId','getAllConditions','order','getAnyConditions','findOne','addAction','Action','getActions','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9140,0x1b0));var _0x0914=function(_0xf705f0,_0x1149dc){_0xf705f0=_0xf705f0-0x0;var _0x4dd0e4=_0x9140[_0xf705f0];return _0x4dd0e4;};'use strict';var emlformat=require(_0x0914('0x0'));var rimraf=require(_0x0914('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0914('0x2'));var moment=require(_0x0914('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0914('0x4'));var util=require(_0x0914('0x5'));var path=require(_0x0914('0x6'));var sox=require(_0x0914('0x7'));var csv=require(_0x0914('0x8'));var ejs=require(_0x0914('0x9'));var fs=require('fs');var fs_extra=require(_0x0914('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0914('0xb'));var deskjs=require(_0x0914('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0914('0xd'));var Papa=require(_0x0914('0xe'));var Redis=require(_0x0914('0xf'));var authService=require(_0x0914('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0914('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0914('0x12'))('api');var utils=require(_0x0914('0x13'));var config=require(_0x0914('0x14'));var licenseUtil=require(_0x0914('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38d647,_0x39ee2e){_0x39ee2e=_0x39ee2e||0xcc;return function(_0x1593f1){if(_0x1593f1){return _0x38d647[_0x0914('0x16')](_0x39ee2e);}return _0x38d647['status'](_0x39ee2e)[_0x0914('0x17')]();};}function respondWithResult(_0x2339b6,_0x40b539){_0x40b539=_0x40b539||0xc8;return function(_0x22b801){if(_0x22b801){return _0x2339b6['status'](_0x40b539)[_0x0914('0x18')](_0x22b801);}};}function respondWithFilteredResult(_0x14c18a,_0x430233){return function(_0x1326b8){if(_0x1326b8){var _0x507809=typeof _0x430233[_0x0914('0x19')]==='undefined'&&typeof _0x430233['limit']===_0x0914('0x1a');var _0x3fc582=_0x1326b8['count'];var _0x3c8a73=_0x507809?0x0:_0x430233[_0x0914('0x19')];var _0x2580cd=_0x507809?_0x1326b8[_0x0914('0x1b')]:_0x430233[_0x0914('0x19')]+_0x430233['limit'];var _0x4eae85;if(_0x2580cd>=_0x3fc582){_0x2580cd=_0x3fc582;_0x4eae85=0xc8;}else{_0x4eae85=0xce;}_0x14c18a['status'](_0x4eae85);return _0x14c18a[_0x0914('0x1c')]('Content-Range',_0x3c8a73+'-'+_0x2580cd+'/'+_0x3fc582)[_0x0914('0x18')](_0x1326b8);}return null;};}function patchUpdates(_0xe1eddc){return function(_0x5edf8f){try{jsonpatch[_0x0914('0x1d')](_0x5edf8f,_0xe1eddc,!![]);}catch(_0x5c4adc){return BPromise[_0x0914('0x1e')](_0x5c4adc);}return _0x5edf8f[_0x0914('0x1f')]();};}function saveUpdates(_0x440d54,_0x3bb43f){return function(_0x3b057c){if(_0x3b057c){return _0x3b057c['update'](_0x440d54)[_0x0914('0x20')](function(_0x31b6f2){return _0x31b6f2;});}return null;};}function removeEntity(_0xa40872,_0x54eb34){return function(_0x288062){if(_0x288062){return _0x288062[_0x0914('0x21')]()[_0x0914('0x20')](function(){var _0x5fd8eb=_0x288062[_0x0914('0x22')]({'plain':!![]});var _0x23f231='Triggers';return db[_0x0914('0x23')]['destroy']({'where':{'type':_0x23f231,'resourceId':_0x5fd8eb['id']}})[_0x0914('0x20')](function(){return _0x288062;});})[_0x0914('0x20')](function(){_0xa40872['status'](0xcc)[_0x0914('0x17')]();});}};}function handleEntityNotFound(_0x39084c,_0xb7c392){return function(_0x2cf97f){if(!_0x2cf97f){_0x39084c[_0x0914('0x16')](0x194);}return _0x2cf97f;};}function handleError(_0x53c23e,_0x35d587){_0x35d587=_0x35d587||0x1f4;return function(_0x3b6b13){logger[_0x0914('0x24')](_0x3b6b13['stack']);if(_0x3b6b13[_0x0914('0x25')]){delete _0x3b6b13['name'];}_0x53c23e[_0x0914('0x26')](_0x35d587)[_0x0914('0x27')](_0x3b6b13);};}exports[_0x0914('0x28')]=function(_0x3cbd9e,_0x1f214d){var _0x209c68={},_0x26a0a6={},_0x6df3ce={'count':0x0,'rows':[]};var _0x21906d=_[_0x0914('0x29')](db[_0x0914('0x2a')][_0x0914('0x2b')],function(_0x3c74b1){return{'name':_0x3c74b1[_0x0914('0x2c')],'type':_0x3c74b1['type'][_0x0914('0x2d')]};});_0x26a0a6['model']=_[_0x0914('0x29')](_0x21906d,_0x0914('0x25'));_0x26a0a6[_0x0914('0x2e')]=_[_0x0914('0x2f')](_0x3cbd9e[_0x0914('0x2e')]);_0x26a0a6['filters']=_[_0x0914('0x30')](_0x26a0a6[_0x0914('0x31')],_0x26a0a6[_0x0914('0x2e')]);_0x209c68[_0x0914('0x32')]=_['intersection'](_0x26a0a6[_0x0914('0x31')],qs[_0x0914('0x33')](_0x3cbd9e[_0x0914('0x2e')][_0x0914('0x33')]));_0x209c68[_0x0914('0x32')]=_0x209c68[_0x0914('0x32')][_0x0914('0x34')]?_0x209c68[_0x0914('0x32')]:_0x26a0a6[_0x0914('0x31')];if(!_0x3cbd9e['query'][_0x0914('0x35')](_0x0914('0x36'))){_0x209c68[_0x0914('0x37')]=qs[_0x0914('0x37')](_0x3cbd9e[_0x0914('0x2e')][_0x0914('0x37')]);_0x209c68[_0x0914('0x19')]=qs[_0x0914('0x19')](_0x3cbd9e[_0x0914('0x2e')][_0x0914('0x19')]);}_0x209c68['order']=qs[_0x0914('0x38')](_0x3cbd9e['query'][_0x0914('0x38')]);_0x209c68[_0x0914('0x39')]=qs[_0x0914('0x3a')](_[_0x0914('0x3b')](_0x3cbd9e[_0x0914('0x2e')],_0x26a0a6[_0x0914('0x3a')]),_0x21906d);if(_0x3cbd9e[_0x0914('0x2e')][_0x0914('0x3c')]){_0x209c68[_0x0914('0x39')]=_[_0x0914('0x3d')](_0x209c68[_0x0914('0x39')],{'$or':_[_0x0914('0x29')](_0x21906d,function(_0x4eb808){if(_0x4eb808[_0x0914('0x3e')]!==_0x0914('0x3f')){var _0x4a7f20={};_0x4a7f20[_0x4eb808[_0x0914('0x25')]]={'$like':'%'+_0x3cbd9e[_0x0914('0x2e')][_0x0914('0x3c')]+'%'};return _0x4a7f20;}})});}_0x209c68=_['merge']({},_0x209c68,_0x3cbd9e[_0x0914('0x40')]);var _0x50aea2={'where':_0x209c68[_0x0914('0x39')]};return db['Trigger'][_0x0914('0x1b')](_0x50aea2)['then'](function(_0x12386){_0x6df3ce[_0x0914('0x1b')]=_0x12386;if(_0x3cbd9e[_0x0914('0x2e')][_0x0914('0x41')]){_0x209c68['include']=[{'all':!![]}];}return db[_0x0914('0x2a')][_0x0914('0x42')](_0x209c68);})[_0x0914('0x20')](function(_0x1781df){_0x6df3ce[_0x0914('0x43')]=_0x1781df;return _0x6df3ce;})[_0x0914('0x20')](respondWithFilteredResult(_0x1f214d,_0x209c68))[_0x0914('0x44')](handleError(_0x1f214d,null));};exports['show']=function(_0x1e5e9e,_0x22bc61){var _0x59f37d={'raw':![],'where':{'id':_0x1e5e9e[_0x0914('0x45')]['id']}},_0x46d833={};_0x46d833['model']=_[_0x0914('0x2f')](db['Trigger'][_0x0914('0x2b')]);_0x46d833[_0x0914('0x2e')]=_[_0x0914('0x2f')](_0x1e5e9e[_0x0914('0x2e')]);_0x46d833[_0x0914('0x3a')]=_[_0x0914('0x30')](_0x46d833[_0x0914('0x31')],_0x46d833['query']);_0x59f37d[_0x0914('0x32')]=_[_0x0914('0x30')](_0x46d833[_0x0914('0x31')],qs[_0x0914('0x33')](_0x1e5e9e[_0x0914('0x2e')]['fields']));_0x59f37d[_0x0914('0x32')]=_0x59f37d[_0x0914('0x32')]['length']?_0x59f37d[_0x0914('0x32')]:_0x46d833[_0x0914('0x31')];if(_0x1e5e9e['query']['includeAll']){_0x59f37d[_0x0914('0x46')]=[{'all':!![]}];}_0x59f37d=_[_0x0914('0x3d')]({},_0x59f37d,_0x1e5e9e[_0x0914('0x40')]);return db[_0x0914('0x2a')][_0x0914('0x47')](_0x59f37d)[_0x0914('0x20')](handleEntityNotFound(_0x22bc61,null))['then'](respondWithResult(_0x22bc61,null))['catch'](handleError(_0x22bc61,null));};exports[_0x0914('0x48')]=function(_0x13cee7,_0x5f2ff6){return db[_0x0914('0x2a')]['create'](_0x13cee7['body'],{})[_0x0914('0x20')](function(_0x5839be){var _0x441e4e=_0x13cee7[_0x0914('0x49')]['get']({'plain':!![]});if(!_0x441e4e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x441e4e[_0x0914('0x4a')]===_0x0914('0x49')){var _0x5b977f=_0x5839be[_0x0914('0x22')]({'plain':!![]});var _0x527973=_0x0914('0x4b');return db[_0x0914('0x4c')][_0x0914('0x47')]({'where':{'name':_0x527973,'userProfileId':_0x441e4e[_0x0914('0x4d')]},'raw':!![]})[_0x0914('0x20')](function(_0x298e3a){if(_0x298e3a&&_0x298e3a[_0x0914('0x4e')]===0x0){return db[_0x0914('0x23')][_0x0914('0x48')]({'name':_0x5b977f['name'],'resourceId':_0x5b977f['id'],'type':_0x298e3a[_0x0914('0x25')],'sectionId':_0x298e3a['id']},{})['then'](function(){return _0x5839be;});}else{return _0x5839be;}})[_0x0914('0x44')](function(_0x24b03d){logger[_0x0914('0x24')](_0x0914('0x4f'),_0x24b03d);throw _0x24b03d;});}return _0x5839be;})[_0x0914('0x20')](respondWithResult(_0x5f2ff6,0xc9))['catch'](handleError(_0x5f2ff6,null));};exports[_0x0914('0x50')]=function(_0x552584,_0xf6e84e){if(_0x552584['body']['id']){delete _0x552584[_0x0914('0x51')]['id'];}return db['Trigger']['find']({'where':{'id':_0x552584[_0x0914('0x45')]['id']}})[_0x0914('0x20')](handleEntityNotFound(_0xf6e84e,null))[_0x0914('0x20')](saveUpdates(_0x552584[_0x0914('0x51')],null))['then'](respondWithResult(_0xf6e84e,null))[_0x0914('0x44')](handleError(_0xf6e84e,null));};exports[_0x0914('0x21')]=function(_0x1083b5,_0x5ae137){return db[_0x0914('0x2a')][_0x0914('0x47')]({'where':{'id':_0x1083b5[_0x0914('0x45')]['id']}})[_0x0914('0x20')](handleEntityNotFound(_0x5ae137,null))[_0x0914('0x20')](removeEntity(_0x5ae137,null))[_0x0914('0x44')](handleError(_0x5ae137,null));};exports[_0x0914('0x52')]=function(_0x44fd4a,_0x12b50e,_0xb1e22f){if(_0x44fd4a[_0x0914('0x51')]['id']){delete _0x44fd4a[_0x0914('0x51')]['id'];}return db[_0x0914('0x2a')][_0x0914('0x47')]({'where':{'id':_0x44fd4a[_0x0914('0x45')]['id']}})[_0x0914('0x20')](handleEntityNotFound(_0x12b50e,null))['then'](function(_0x41e6d6){if(_0x41e6d6){_0x44fd4a[_0x0914('0x51')]['TriggerAllId']=_0x41e6d6['id'];return db[_0x0914('0x53')][_0x0914('0x48')](_0x44fd4a[_0x0914('0x51')]);}})['then'](respondWithResult(_0x12b50e,null))['catch'](handleError(_0x12b50e,null));};exports['addAnyCondition']=function(_0x5f0540,_0x272c8f,_0x11dea4){if(_0x5f0540[_0x0914('0x51')]['id']){delete _0x5f0540[_0x0914('0x51')]['id'];}return db[_0x0914('0x2a')][_0x0914('0x47')]({'where':{'id':_0x5f0540[_0x0914('0x45')]['id']}})[_0x0914('0x20')](handleEntityNotFound(_0x272c8f,null))[_0x0914('0x20')](function(_0x53d1c3){if(_0x53d1c3){_0x5f0540[_0x0914('0x51')][_0x0914('0x54')]=_0x53d1c3['id'];return db[_0x0914('0x53')][_0x0914('0x48')](_0x5f0540[_0x0914('0x51')]);}})[_0x0914('0x20')](respondWithResult(_0x272c8f,null))[_0x0914('0x44')](handleError(_0x272c8f,null));};exports[_0x0914('0x55')]=function(_0xbd0df1,_0x3d58de,_0x599379){var _0x3fab6d={};var _0x2c820e={};var _0x476be1;var _0x30a5b2;return db[_0x0914('0x2a')]['findOne']({'where':{'id':_0xbd0df1['params']['id']}})[_0x0914('0x20')](handleEntityNotFound(_0x3d58de,null))[_0x0914('0x20')](function(_0x2290f0){if(_0x2290f0){_0x476be1=_0x2290f0;_0x2c820e[_0x0914('0x31')]=_[_0x0914('0x2f')](db['Condition'][_0x0914('0x2b')]);_0x2c820e[_0x0914('0x2e')]=_[_0x0914('0x2f')](_0xbd0df1[_0x0914('0x2e')]);_0x2c820e[_0x0914('0x3a')]=_['intersection'](_0x2c820e[_0x0914('0x31')],_0x2c820e[_0x0914('0x2e')]);_0x3fab6d['attributes']=_[_0x0914('0x30')](_0x2c820e['model'],qs[_0x0914('0x33')](_0xbd0df1[_0x0914('0x2e')]['fields']));_0x3fab6d['attributes']=_0x3fab6d[_0x0914('0x32')][_0x0914('0x34')]?_0x3fab6d[_0x0914('0x32')]:_0x2c820e['model'];_0x3fab6d[_0x0914('0x56')]=qs[_0x0914('0x38')](_0xbd0df1[_0x0914('0x2e')][_0x0914('0x38')]);_0x3fab6d[_0x0914('0x39')]=qs['filters'](_[_0x0914('0x3b')](_0xbd0df1[_0x0914('0x2e')],_0x2c820e[_0x0914('0x3a')]));if(_0xbd0df1[_0x0914('0x2e')][_0x0914('0x3c')]){_0x3fab6d[_0x0914('0x39')]=_[_0x0914('0x3d')](_0x3fab6d['where'],{'$or':_[_0x0914('0x29')](_0x3fab6d[_0x0914('0x32')],function(_0x5deadf){var _0x1ce8d2={};_0x1ce8d2[_0x5deadf]={'$like':'%'+_0xbd0df1['query'][_0x0914('0x3c')]+'%'};return _0x1ce8d2;})});}_0x3fab6d=_['merge']({},_0x3fab6d,_0xbd0df1[_0x0914('0x40')]);return _0x476be1[_0x0914('0x55')](_0x3fab6d);}})[_0x0914('0x20')](function(_0x226b19){if(_0x226b19){_0x30a5b2=_0x226b19['length'];if(!_0xbd0df1['query'][_0x0914('0x35')]('nolimit')){_0x3fab6d['limit']=qs[_0x0914('0x37')](_0xbd0df1[_0x0914('0x2e')][_0x0914('0x37')]);_0x3fab6d['offset']=qs[_0x0914('0x19')](_0xbd0df1[_0x0914('0x2e')][_0x0914('0x19')]);}return _0x476be1[_0x0914('0x55')](_0x3fab6d);}})[_0x0914('0x20')](function(_0x3aefb9){if(_0x3aefb9){return _0x3aefb9?{'count':_0x30a5b2,'rows':_0x3aefb9}:null;}})[_0x0914('0x20')](respondWithResult(_0x3d58de,null))[_0x0914('0x44')](handleError(_0x3d58de,null));};exports[_0x0914('0x57')]=function(_0x130a97,_0x506a11,_0x30059b){var _0x5b1b2f={};var _0x2acb1f={};var _0x1b8e9b;var _0x5f4895;return db['Trigger'][_0x0914('0x58')]({'where':{'id':_0x130a97['params']['id']}})['then'](handleEntityNotFound(_0x506a11,null))['then'](function(_0x2fabbe){if(_0x2fabbe){_0x1b8e9b=_0x2fabbe;_0x2acb1f['model']=_['keys'](db[_0x0914('0x53')][_0x0914('0x2b')]);_0x2acb1f[_0x0914('0x2e')]=_[_0x0914('0x2f')](_0x130a97[_0x0914('0x2e')]);_0x2acb1f[_0x0914('0x3a')]=_[_0x0914('0x30')](_0x2acb1f['model'],_0x2acb1f[_0x0914('0x2e')]);_0x5b1b2f['attributes']=_['intersection'](_0x2acb1f[_0x0914('0x31')],qs[_0x0914('0x33')](_0x130a97[_0x0914('0x2e')][_0x0914('0x33')]));_0x5b1b2f['attributes']=_0x5b1b2f[_0x0914('0x32')][_0x0914('0x34')]?_0x5b1b2f[_0x0914('0x32')]:_0x2acb1f[_0x0914('0x31')];_0x5b1b2f[_0x0914('0x56')]=qs[_0x0914('0x38')](_0x130a97[_0x0914('0x2e')][_0x0914('0x38')]);_0x5b1b2f['where']=qs[_0x0914('0x3a')](_[_0x0914('0x3b')](_0x130a97['query'],_0x2acb1f[_0x0914('0x3a')]));if(_0x130a97[_0x0914('0x2e')][_0x0914('0x3c')]){_0x5b1b2f[_0x0914('0x39')]=_[_0x0914('0x3d')](_0x5b1b2f['where'],{'$or':_['map'](_0x5b1b2f[_0x0914('0x32')],function(_0xe169d){var _0x4672a9={};_0x4672a9[_0xe169d]={'$like':'%'+_0x130a97['query'][_0x0914('0x3c')]+'%'};return _0x4672a9;})});}_0x5b1b2f=_[_0x0914('0x3d')]({},_0x5b1b2f,_0x130a97['options']);return _0x1b8e9b[_0x0914('0x57')](_0x5b1b2f);}})[_0x0914('0x20')](function(_0x41d6e3){if(_0x41d6e3){_0x5f4895=_0x41d6e3[_0x0914('0x34')];if(!_0x130a97[_0x0914('0x2e')][_0x0914('0x35')](_0x0914('0x36'))){_0x5b1b2f[_0x0914('0x37')]=qs['limit'](_0x130a97[_0x0914('0x2e')]['limit']);_0x5b1b2f[_0x0914('0x19')]=qs[_0x0914('0x19')](_0x130a97[_0x0914('0x2e')][_0x0914('0x19')]);}return _0x1b8e9b[_0x0914('0x57')](_0x5b1b2f);}})[_0x0914('0x20')](function(_0x225fcf){if(_0x225fcf){return _0x225fcf?{'count':_0x5f4895,'rows':_0x225fcf}:null;}})[_0x0914('0x20')](respondWithResult(_0x506a11,null))['catch'](handleError(_0x506a11,null));};exports[_0x0914('0x59')]=function(_0x59435d,_0x80c506,_0x3dbbdd){if(_0x59435d[_0x0914('0x51')]['id']){delete _0x59435d[_0x0914('0x51')]['id'];}return db[_0x0914('0x2a')][_0x0914('0x47')]({'where':{'id':_0x59435d[_0x0914('0x45')]['id']}})[_0x0914('0x20')](handleEntityNotFound(_0x80c506,null))[_0x0914('0x20')](function(_0x357919){if(_0x357919){_0x59435d['body']['TriggerId']=_0x357919['id'];return db[_0x0914('0x5a')][_0x0914('0x48')](_0x59435d[_0x0914('0x51')]);}})[_0x0914('0x20')](respondWithResult(_0x80c506,null))[_0x0914('0x44')](handleError(_0x80c506,null));};exports[_0x0914('0x5b')]=function(_0x37a5fe,_0x2c303e,_0x5520fa){var _0x2a4090={};var _0xde35fb={};var _0x2404e8;var _0x2619cc;return db['Trigger'][_0x0914('0x58')]({'where':{'id':_0x37a5fe['params']['id']}})[_0x0914('0x20')](handleEntityNotFound(_0x2c303e,null))[_0x0914('0x20')](function(_0x138561){if(_0x138561){_0x2404e8=_0x138561;_0xde35fb[_0x0914('0x31')]=_[_0x0914('0x2f')](db[_0x0914('0x5a')]['rawAttributes']);_0xde35fb[_0x0914('0x2e')]=_[_0x0914('0x2f')](_0x37a5fe[_0x0914('0x2e')]);_0xde35fb[_0x0914('0x3a')]=_['intersection'](_0xde35fb[_0x0914('0x31')],_0xde35fb[_0x0914('0x2e')]);_0x2a4090[_0x0914('0x32')]=_[_0x0914('0x30')](_0xde35fb[_0x0914('0x31')],qs[_0x0914('0x33')](_0x37a5fe[_0x0914('0x2e')][_0x0914('0x33')]));_0x2a4090[_0x0914('0x32')]=_0x2a4090['attributes']['length']?_0x2a4090[_0x0914('0x32')]:_0xde35fb[_0x0914('0x31')];_0x2a4090[_0x0914('0x56')]=qs[_0x0914('0x38')](_0x37a5fe[_0x0914('0x2e')]['sort']);_0x2a4090[_0x0914('0x39')]=qs[_0x0914('0x3a')](_[_0x0914('0x3b')](_0x37a5fe[_0x0914('0x2e')],_0xde35fb[_0x0914('0x3a')]));if(_0x37a5fe[_0x0914('0x2e')][_0x0914('0x3c')]){_0x2a4090[_0x0914('0x39')]=_[_0x0914('0x3d')](_0x2a4090['where'],{'$or':_[_0x0914('0x29')](_0x2a4090['attributes'],function(_0x221270){var _0x4cbfc2={};_0x4cbfc2[_0x221270]={'$like':'%'+_0x37a5fe[_0x0914('0x2e')][_0x0914('0x3c')]+'%'};return _0x4cbfc2;})});}_0x2a4090=_['merge']({},_0x2a4090,_0x37a5fe[_0x0914('0x40')]);return _0x2404e8[_0x0914('0x5b')](_0x2a4090);}})['then'](function(_0x503f42){if(_0x503f42){_0x2619cc=_0x503f42[_0x0914('0x34')];if(!_0x37a5fe[_0x0914('0x2e')][_0x0914('0x35')](_0x0914('0x36'))){_0x2a4090[_0x0914('0x37')]=qs[_0x0914('0x37')](_0x37a5fe[_0x0914('0x2e')][_0x0914('0x37')]);_0x2a4090['offset']=qs[_0x0914('0x19')](_0x37a5fe['query']['offset']);}return _0x2404e8[_0x0914('0x5b')](_0x2a4090);}})[_0x0914('0x20')](function(_0x33689d){if(_0x33689d){return _0x33689d?{'count':_0x2619cc,'rows':_0x33689d}:null;}})['then'](respondWithResult(_0x2c303e,null))[_0x0914('0x44')](handleError(_0x2c303e,null));}; \ No newline at end of file +var _0x0866=['VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','fields','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Triggers','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','TriggerAnyId','Condition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','UserProfileResource','name','index','map','Trigger','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x1058db,_0x7e3063){var _0x195b98=function(_0x1db9ce){while(--_0x1db9ce){_0x1058db['push'](_0x1058db['shift']());}};_0x195b98(++_0x7e3063);}(_0x0866,0x1c2));var _0x6086=function(_0x519401,_0x45fdb1){_0x519401=_0x519401-0x0;var _0x40d7b2=_0x0866[_0x519401];return _0x40d7b2;};'use strict';var emlformat=require(_0x6086('0x0'));var rimraf=require(_0x6086('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6086('0x2'));var moment=require('moment');var BPromise=require(_0x6086('0x3'));var Mustache=require(_0x6086('0x4'));var util=require(_0x6086('0x5'));var path=require(_0x6086('0x6'));var sox=require(_0x6086('0x7'));var csv=require(_0x6086('0x8'));var ejs=require(_0x6086('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6086('0xa'));var squel=require(_0x6086('0xb'));var crypto=require(_0x6086('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6086('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6086('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6086('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6086('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x6086('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39ddf8,_0x2baa3d){_0x2baa3d=_0x2baa3d||0xcc;return function(_0x43d439){if(_0x43d439){return _0x39ddf8[_0x6086('0x12')](_0x2baa3d);}return _0x39ddf8[_0x6086('0x13')](_0x2baa3d)['end']();};}function respondWithResult(_0x5111ea,_0x432b00){_0x432b00=_0x432b00||0xc8;return function(_0x54213f){if(_0x54213f){return _0x5111ea[_0x6086('0x13')](_0x432b00)[_0x6086('0x14')](_0x54213f);}};}function respondWithFilteredResult(_0x342fd4,_0x410ccc){return function(_0x515be1){if(_0x515be1){var _0x35f5b5=typeof _0x410ccc[_0x6086('0x15')]===_0x6086('0x16')&&typeof _0x410ccc[_0x6086('0x17')]===_0x6086('0x16');var _0x437421=_0x515be1[_0x6086('0x18')];var _0x1207e7=_0x35f5b5?0x0:_0x410ccc['offset'];var _0x347dd5=_0x35f5b5?_0x515be1['count']:_0x410ccc[_0x6086('0x15')]+_0x410ccc['limit'];var _0x5eecd8;if(_0x347dd5>=_0x437421){_0x347dd5=_0x437421;_0x5eecd8=0xc8;}else{_0x5eecd8=0xce;}_0x342fd4[_0x6086('0x13')](_0x5eecd8);return _0x342fd4[_0x6086('0x19')](_0x6086('0x1a'),_0x1207e7+'-'+_0x347dd5+'/'+_0x437421)[_0x6086('0x14')](_0x515be1);}return null;};}function patchUpdates(_0x124dd6){return function(_0x31528d){try{jsonpatch[_0x6086('0x1b')](_0x31528d,_0x124dd6,!![]);}catch(_0x1b7b4a){return BPromise['reject'](_0x1b7b4a);}return _0x31528d['save']();};}function saveUpdates(_0x32b015,_0x142fc8){return function(_0x44227a){if(_0x44227a){return _0x44227a[_0x6086('0x1c')](_0x32b015)[_0x6086('0x1d')](function(_0x2d1ab4){return _0x2d1ab4;});}return null;};}function removeEntity(_0x348920,_0xb1f603){return function(_0x22351a){if(_0x22351a){return _0x22351a[_0x6086('0x1e')]()['then'](function(){var _0x12e0d1=_0x22351a['get']({'plain':!![]});var _0x23e2d9='Triggers';return db[_0x6086('0x1f')][_0x6086('0x1e')]({'where':{'type':_0x23e2d9,'resourceId':_0x12e0d1['id']}})[_0x6086('0x1d')](function(){return _0x22351a;});})[_0x6086('0x1d')](function(){_0x348920['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x477628,_0x50c1fb){return function(_0x1ebcb1){if(!_0x1ebcb1){_0x477628[_0x6086('0x12')](0x194);}return _0x1ebcb1;};}function handleError(_0x55f73e,_0x3d811f){_0x3d811f=_0x3d811f||0x1f4;return function(_0x5b57d2){logger['error'](_0x5b57d2['stack']);if(_0x5b57d2[_0x6086('0x20')]){delete _0x5b57d2['name'];}_0x55f73e[_0x6086('0x13')](_0x3d811f)['send'](_0x5b57d2);};}exports[_0x6086('0x21')]=function(_0x386de1,_0x455511){var _0x4cdc4f={},_0x32138a={},_0x27c798={'count':0x0,'rows':[]};var _0x92708=_[_0x6086('0x22')](db[_0x6086('0x23')]['rawAttributes'],function(_0x179ff9){return{'name':_0x179ff9[_0x6086('0x24')],'type':_0x179ff9[_0x6086('0x25')][_0x6086('0x26')]};});_0x32138a['model']=_[_0x6086('0x22')](_0x92708,'name');_0x32138a[_0x6086('0x27')]=_[_0x6086('0x28')](_0x386de1['query']);_0x32138a[_0x6086('0x29')]=_[_0x6086('0x2a')](_0x32138a[_0x6086('0x2b')],_0x32138a[_0x6086('0x27')]);_0x4cdc4f['attributes']=_[_0x6086('0x2a')](_0x32138a[_0x6086('0x2b')],qs['fields'](_0x386de1[_0x6086('0x27')]['fields']));_0x4cdc4f['attributes']=_0x4cdc4f[_0x6086('0x2c')][_0x6086('0x2d')]?_0x4cdc4f[_0x6086('0x2c')]:_0x32138a[_0x6086('0x2b')];if(!_0x386de1[_0x6086('0x27')][_0x6086('0x2e')](_0x6086('0x2f'))){_0x4cdc4f[_0x6086('0x17')]=qs['limit'](_0x386de1[_0x6086('0x27')][_0x6086('0x17')]);_0x4cdc4f[_0x6086('0x15')]=qs[_0x6086('0x15')](_0x386de1['query']['offset']);}_0x4cdc4f[_0x6086('0x30')]=qs[_0x6086('0x31')](_0x386de1[_0x6086('0x27')]['sort']);_0x4cdc4f[_0x6086('0x32')]=qs[_0x6086('0x29')](_[_0x6086('0x33')](_0x386de1[_0x6086('0x27')],_0x32138a[_0x6086('0x29')]),_0x92708);if(_0x386de1[_0x6086('0x27')][_0x6086('0x34')]){_0x4cdc4f[_0x6086('0x32')]=_[_0x6086('0x35')](_0x4cdc4f[_0x6086('0x32')],{'$or':_[_0x6086('0x22')](_0x92708,function(_0x3bfa63){if(_0x3bfa63[_0x6086('0x25')]!==_0x6086('0x36')){var _0xb0c2e2={};_0xb0c2e2[_0x3bfa63['name']]={'$like':'%'+_0x386de1[_0x6086('0x27')][_0x6086('0x34')]+'%'};return _0xb0c2e2;}})});}_0x4cdc4f=_[_0x6086('0x35')]({},_0x4cdc4f,_0x386de1[_0x6086('0x37')]);var _0x3dace4={'where':_0x4cdc4f[_0x6086('0x32')]};return db[_0x6086('0x23')]['count'](_0x3dace4)[_0x6086('0x1d')](function(_0x2a4479){_0x27c798[_0x6086('0x18')]=_0x2a4479;if(_0x386de1[_0x6086('0x27')][_0x6086('0x38')]){_0x4cdc4f[_0x6086('0x39')]=[{'all':!![]}];}return db[_0x6086('0x23')]['findAll'](_0x4cdc4f);})['then'](function(_0x5e5b0e){_0x27c798[_0x6086('0x3a')]=_0x5e5b0e;return _0x27c798;})['then'](respondWithFilteredResult(_0x455511,_0x4cdc4f))[_0x6086('0x3b')](handleError(_0x455511,null));};exports[_0x6086('0x3c')]=function(_0x449f2f,_0x1ba0bd){var _0x56537b={'raw':![],'where':{'id':_0x449f2f[_0x6086('0x3d')]['id']}},_0x583e9d={};_0x583e9d[_0x6086('0x2b')]=_['keys'](db[_0x6086('0x23')][_0x6086('0x3e')]);_0x583e9d[_0x6086('0x27')]=_[_0x6086('0x28')](_0x449f2f[_0x6086('0x27')]);_0x583e9d['filters']=_[_0x6086('0x2a')](_0x583e9d[_0x6086('0x2b')],_0x583e9d[_0x6086('0x27')]);_0x56537b[_0x6086('0x2c')]=_[_0x6086('0x2a')](_0x583e9d[_0x6086('0x2b')],qs['fields'](_0x449f2f[_0x6086('0x27')][_0x6086('0x3f')]));_0x56537b[_0x6086('0x2c')]=_0x56537b['attributes'][_0x6086('0x2d')]?_0x56537b[_0x6086('0x2c')]:_0x583e9d[_0x6086('0x2b')];if(_0x449f2f[_0x6086('0x27')][_0x6086('0x38')]){_0x56537b['include']=[{'all':!![]}];}_0x56537b=_[_0x6086('0x35')]({},_0x56537b,_0x449f2f[_0x6086('0x37')]);return db[_0x6086('0x23')]['find'](_0x56537b)['then'](handleEntityNotFound(_0x1ba0bd,null))[_0x6086('0x1d')](respondWithResult(_0x1ba0bd,null))[_0x6086('0x3b')](handleError(_0x1ba0bd,null));};exports[_0x6086('0x40')]=function(_0x430509,_0x2e821e){return db[_0x6086('0x23')][_0x6086('0x40')](_0x430509[_0x6086('0x41')],{})[_0x6086('0x1d')](function(_0x8fae75){var _0x3ceb6a=_0x430509[_0x6086('0x42')][_0x6086('0x43')]({'plain':!![]});if(!_0x3ceb6a)throw new Error(_0x6086('0x44'));if(_0x3ceb6a['role']===_0x6086('0x42')){var _0x2d44a1=_0x8fae75[_0x6086('0x43')]({'plain':!![]});var _0x4e35ab=_0x6086('0x45');return db[_0x6086('0x46')][_0x6086('0x47')]({'where':{'name':_0x4e35ab,'userProfileId':_0x3ceb6a['userProfileId']},'raw':!![]})[_0x6086('0x1d')](function(_0x149258){if(_0x149258&&_0x149258['autoAssociation']===0x0){return db[_0x6086('0x1f')]['create']({'name':_0x2d44a1[_0x6086('0x20')],'resourceId':_0x2d44a1['id'],'type':_0x149258[_0x6086('0x20')],'sectionId':_0x149258['id']},{})[_0x6086('0x1d')](function(){return _0x8fae75;});}else{return _0x8fae75;}})['catch'](function(_0x1c3ab4){logger['error'](_0x6086('0x48'),_0x1c3ab4);throw _0x1c3ab4;});}return _0x8fae75;})[_0x6086('0x1d')](respondWithResult(_0x2e821e,0xc9))[_0x6086('0x3b')](handleError(_0x2e821e,null));};exports[_0x6086('0x1c')]=function(_0x56a7ca,_0x2e0d37){if(_0x56a7ca[_0x6086('0x41')]['id']){delete _0x56a7ca[_0x6086('0x41')]['id'];}return db[_0x6086('0x23')][_0x6086('0x47')]({'where':{'id':_0x56a7ca[_0x6086('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2e0d37,null))[_0x6086('0x1d')](saveUpdates(_0x56a7ca[_0x6086('0x41')],null))[_0x6086('0x1d')](respondWithResult(_0x2e0d37,null))['catch'](handleError(_0x2e0d37,null));};exports[_0x6086('0x1e')]=function(_0x2abb32,_0x7bfd4e){return db[_0x6086('0x23')][_0x6086('0x47')]({'where':{'id':_0x2abb32[_0x6086('0x3d')]['id']}})['then'](handleEntityNotFound(_0x7bfd4e,null))[_0x6086('0x1d')](removeEntity(_0x7bfd4e,null))[_0x6086('0x3b')](handleError(_0x7bfd4e,null));};exports[_0x6086('0x49')]=function(_0x42e723,_0x4135a3,_0x1f07c6){if(_0x42e723[_0x6086('0x41')]['id']){delete _0x42e723['body']['id'];}return db['Trigger'][_0x6086('0x47')]({'where':{'id':_0x42e723['params']['id']}})[_0x6086('0x1d')](handleEntityNotFound(_0x4135a3,null))[_0x6086('0x1d')](function(_0xf93a40){if(_0xf93a40){_0x42e723[_0x6086('0x41')][_0x6086('0x4a')]=_0xf93a40['id'];return db['Condition'][_0x6086('0x40')](_0x42e723[_0x6086('0x41')]);}})[_0x6086('0x1d')](respondWithResult(_0x4135a3,null))[_0x6086('0x3b')](handleError(_0x4135a3,null));};exports['addAnyCondition']=function(_0x30008f,_0x43415f,_0x2c57d4){if(_0x30008f[_0x6086('0x41')]['id']){delete _0x30008f[_0x6086('0x41')]['id'];}return db[_0x6086('0x23')][_0x6086('0x47')]({'where':{'id':_0x30008f[_0x6086('0x3d')]['id']}})[_0x6086('0x1d')](handleEntityNotFound(_0x43415f,null))[_0x6086('0x1d')](function(_0x2c4438){if(_0x2c4438){_0x30008f['body'][_0x6086('0x4b')]=_0x2c4438['id'];return db[_0x6086('0x4c')][_0x6086('0x40')](_0x30008f['body']);}})['then'](respondWithResult(_0x43415f,null))[_0x6086('0x3b')](handleError(_0x43415f,null));};exports['getAllConditions']=function(_0x15c628,_0x9f18b4,_0xdf21bf){var _0x4ae8f9={};var _0x3655a0={};var _0x104471;var _0x482acf;return db[_0x6086('0x23')]['findOne']({'where':{'id':_0x15c628[_0x6086('0x3d')]['id']}})[_0x6086('0x1d')](handleEntityNotFound(_0x9f18b4,null))[_0x6086('0x1d')](function(_0x5eacb6){if(_0x5eacb6){_0x104471=_0x5eacb6;_0x3655a0['model']=_['keys'](db[_0x6086('0x4c')][_0x6086('0x3e')]);_0x3655a0[_0x6086('0x27')]=_['keys'](_0x15c628[_0x6086('0x27')]);_0x3655a0['filters']=_['intersection'](_0x3655a0[_0x6086('0x2b')],_0x3655a0[_0x6086('0x27')]);_0x4ae8f9['attributes']=_[_0x6086('0x2a')](_0x3655a0[_0x6086('0x2b')],qs[_0x6086('0x3f')](_0x15c628[_0x6086('0x27')][_0x6086('0x3f')]));_0x4ae8f9['attributes']=_0x4ae8f9[_0x6086('0x2c')][_0x6086('0x2d')]?_0x4ae8f9['attributes']:_0x3655a0['model'];_0x4ae8f9[_0x6086('0x30')]=qs[_0x6086('0x31')](_0x15c628[_0x6086('0x27')]['sort']);_0x4ae8f9['where']=qs[_0x6086('0x29')](_['pick'](_0x15c628[_0x6086('0x27')],_0x3655a0[_0x6086('0x29')]));if(_0x15c628[_0x6086('0x27')][_0x6086('0x34')]){_0x4ae8f9[_0x6086('0x32')]=_[_0x6086('0x35')](_0x4ae8f9['where'],{'$or':_[_0x6086('0x22')](_0x4ae8f9[_0x6086('0x2c')],function(_0x410a97){var _0x307b45={};_0x307b45[_0x410a97]={'$like':'%'+_0x15c628[_0x6086('0x27')][_0x6086('0x34')]+'%'};return _0x307b45;})});}_0x4ae8f9=_[_0x6086('0x35')]({},_0x4ae8f9,_0x15c628['options']);return _0x104471[_0x6086('0x4d')](_0x4ae8f9);}})[_0x6086('0x1d')](function(_0x35f3de){if(_0x35f3de){_0x482acf=_0x35f3de['length'];if(!_0x15c628[_0x6086('0x27')]['hasOwnProperty']('nolimit')){_0x4ae8f9[_0x6086('0x17')]=qs[_0x6086('0x17')](_0x15c628['query'][_0x6086('0x17')]);_0x4ae8f9[_0x6086('0x15')]=qs['offset'](_0x15c628[_0x6086('0x27')][_0x6086('0x15')]);}return _0x104471[_0x6086('0x4d')](_0x4ae8f9);}})['then'](function(_0x5950b0){if(_0x5950b0){return _0x5950b0?{'count':_0x482acf,'rows':_0x5950b0}:null;}})['then'](respondWithResult(_0x9f18b4,null))[_0x6086('0x3b')](handleError(_0x9f18b4,null));};exports['getAnyConditions']=function(_0x1cdda4,_0x1bb6d6,_0x508ebe){var _0x47d75b={};var _0x46504e={};var _0x1eb7ab;var _0x205238;return db[_0x6086('0x23')][_0x6086('0x4e')]({'where':{'id':_0x1cdda4[_0x6086('0x3d')]['id']}})[_0x6086('0x1d')](handleEntityNotFound(_0x1bb6d6,null))[_0x6086('0x1d')](function(_0x45aa99){if(_0x45aa99){_0x1eb7ab=_0x45aa99;_0x46504e[_0x6086('0x2b')]=_[_0x6086('0x28')](db[_0x6086('0x4c')]['rawAttributes']);_0x46504e[_0x6086('0x27')]=_[_0x6086('0x28')](_0x1cdda4[_0x6086('0x27')]);_0x46504e['filters']=_[_0x6086('0x2a')](_0x46504e[_0x6086('0x2b')],_0x46504e[_0x6086('0x27')]);_0x47d75b['attributes']=_[_0x6086('0x2a')](_0x46504e[_0x6086('0x2b')],qs[_0x6086('0x3f')](_0x1cdda4[_0x6086('0x27')][_0x6086('0x3f')]));_0x47d75b[_0x6086('0x2c')]=_0x47d75b['attributes'][_0x6086('0x2d')]?_0x47d75b[_0x6086('0x2c')]:_0x46504e[_0x6086('0x2b')];_0x47d75b[_0x6086('0x30')]=qs[_0x6086('0x31')](_0x1cdda4[_0x6086('0x27')][_0x6086('0x31')]);_0x47d75b['where']=qs['filters'](_[_0x6086('0x33')](_0x1cdda4[_0x6086('0x27')],_0x46504e[_0x6086('0x29')]));if(_0x1cdda4[_0x6086('0x27')]['filter']){_0x47d75b[_0x6086('0x32')]=_['merge'](_0x47d75b[_0x6086('0x32')],{'$or':_[_0x6086('0x22')](_0x47d75b[_0x6086('0x2c')],function(_0x1ef557){var _0x243a15={};_0x243a15[_0x1ef557]={'$like':'%'+_0x1cdda4[_0x6086('0x27')]['filter']+'%'};return _0x243a15;})});}_0x47d75b=_[_0x6086('0x35')]({},_0x47d75b,_0x1cdda4[_0x6086('0x37')]);return _0x1eb7ab[_0x6086('0x4f')](_0x47d75b);}})[_0x6086('0x1d')](function(_0x4c99af){if(_0x4c99af){_0x205238=_0x4c99af[_0x6086('0x2d')];if(!_0x1cdda4[_0x6086('0x27')][_0x6086('0x2e')](_0x6086('0x2f'))){_0x47d75b[_0x6086('0x17')]=qs[_0x6086('0x17')](_0x1cdda4[_0x6086('0x27')][_0x6086('0x17')]);_0x47d75b[_0x6086('0x15')]=qs[_0x6086('0x15')](_0x1cdda4[_0x6086('0x27')][_0x6086('0x15')]);}return _0x1eb7ab['getAnyConditions'](_0x47d75b);}})[_0x6086('0x1d')](function(_0x3092f5){if(_0x3092f5){return _0x3092f5?{'count':_0x205238,'rows':_0x3092f5}:null;}})[_0x6086('0x1d')](respondWithResult(_0x1bb6d6,null))[_0x6086('0x3b')](handleError(_0x1bb6d6,null));};exports[_0x6086('0x50')]=function(_0x32ab2d,_0x1ec44e,_0x18dced){if(_0x32ab2d[_0x6086('0x41')]['id']){delete _0x32ab2d['body']['id'];}return db[_0x6086('0x23')][_0x6086('0x47')]({'where':{'id':_0x32ab2d[_0x6086('0x3d')]['id']}})[_0x6086('0x1d')](handleEntityNotFound(_0x1ec44e,null))['then'](function(_0x5ab931){if(_0x5ab931){_0x32ab2d[_0x6086('0x41')][_0x6086('0x51')]=_0x5ab931['id'];return db['Action']['create'](_0x32ab2d['body']);}})[_0x6086('0x1d')](respondWithResult(_0x1ec44e,null))['catch'](handleError(_0x1ec44e,null));};exports[_0x6086('0x52')]=function(_0x1d048d,_0x289e53,_0x238cf6){var _0x2532ef={};var _0x4c1b5e={};var _0x1e68b4;var _0x5f4a98;return db['Trigger'][_0x6086('0x4e')]({'where':{'id':_0x1d048d['params']['id']}})[_0x6086('0x1d')](handleEntityNotFound(_0x289e53,null))[_0x6086('0x1d')](function(_0x5783b0){if(_0x5783b0){_0x1e68b4=_0x5783b0;_0x4c1b5e[_0x6086('0x2b')]=_[_0x6086('0x28')](db[_0x6086('0x53')][_0x6086('0x3e')]);_0x4c1b5e[_0x6086('0x27')]=_['keys'](_0x1d048d[_0x6086('0x27')]);_0x4c1b5e['filters']=_[_0x6086('0x2a')](_0x4c1b5e['model'],_0x4c1b5e[_0x6086('0x27')]);_0x2532ef[_0x6086('0x2c')]=_['intersection'](_0x4c1b5e['model'],qs[_0x6086('0x3f')](_0x1d048d[_0x6086('0x27')][_0x6086('0x3f')]));_0x2532ef[_0x6086('0x2c')]=_0x2532ef[_0x6086('0x2c')][_0x6086('0x2d')]?_0x2532ef['attributes']:_0x4c1b5e[_0x6086('0x2b')];_0x2532ef[_0x6086('0x30')]=qs[_0x6086('0x31')](_0x1d048d[_0x6086('0x27')][_0x6086('0x31')]);_0x2532ef[_0x6086('0x32')]=qs[_0x6086('0x29')](_[_0x6086('0x33')](_0x1d048d['query'],_0x4c1b5e[_0x6086('0x29')]));if(_0x1d048d['query'][_0x6086('0x34')]){_0x2532ef[_0x6086('0x32')]=_[_0x6086('0x35')](_0x2532ef[_0x6086('0x32')],{'$or':_[_0x6086('0x22')](_0x2532ef[_0x6086('0x2c')],function(_0x10c20c){var _0x3c1892={};_0x3c1892[_0x10c20c]={'$like':'%'+_0x1d048d[_0x6086('0x27')][_0x6086('0x34')]+'%'};return _0x3c1892;})});}_0x2532ef=_[_0x6086('0x35')]({},_0x2532ef,_0x1d048d[_0x6086('0x37')]);return _0x1e68b4['getActions'](_0x2532ef);}})['then'](function(_0x3a63c2){if(_0x3a63c2){_0x5f4a98=_0x3a63c2[_0x6086('0x2d')];if(!_0x1d048d[_0x6086('0x27')][_0x6086('0x2e')](_0x6086('0x2f'))){_0x2532ef[_0x6086('0x17')]=qs['limit'](_0x1d048d[_0x6086('0x27')][_0x6086('0x17')]);_0x2532ef[_0x6086('0x15')]=qs[_0x6086('0x15')](_0x1d048d['query']['offset']);}return _0x1e68b4['getActions'](_0x2532ef);}})[_0x6086('0x1d')](function(_0x423710){if(_0x423710){return _0x423710?{'count':_0x5f4a98,'rows':_0x423710}:null;}})[_0x6086('0x1d')](respondWithResult(_0x289e53,null))['catch'](handleError(_0x289e53,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index c38be1e..90fcf1e 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 _0x0a52=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers'];(function(_0x55b7c2,_0x42a993){var _0x536902=function(_0x1796ff){while(--_0x1796ff){_0x55b7c2['push'](_0x55b7c2['shift']());}};_0x536902(++_0x42a993);}(_0x0a52,0xe4));var _0x20a5=function(_0x31dcf7,_0x49b951){_0x31dcf7=_0x31dcf7-0x0;var _0x65837f=_0x0a52[_0x31dcf7];return _0x65837f;};'use strict';var _=require(_0x20a5('0x0'));var util=require(_0x20a5('0x1'));var logger=require('../../config/logger')(_0x20a5('0x2'));var moment=require(_0x20a5('0x3'));var BPromise=require(_0x20a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a5('0x5'));var rimraf=require(_0x20a5('0x6'));var config=require(_0x20a5('0x7'));var attributes=require(_0x20a5('0x8'));module[_0x20a5('0x9')]=function(_0x1fcc72,_0x4acc66){return _0x1fcc72['define'](_0x20a5('0xa'),attributes,{'tableName':_0x20a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cd6=['path','./trigger.attributes','exports','define','tools_triggers','lodash','util','api','moment','request-promise'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x0cd6,0x113));var _0x60cd=function(_0x470e67,_0x4a596d){_0x470e67=_0x470e67-0x0;var _0x28bbde=_0x0cd6[_0x470e67];return _0x28bbde;};'use strict';var _=require(_0x60cd('0x0'));var util=require(_0x60cd('0x1'));var logger=require('../../config/logger')(_0x60cd('0x2'));var moment=require(_0x60cd('0x3'));var BPromise=require('bluebird');var rp=require(_0x60cd('0x4'));var fs=require('fs');var path=require(_0x60cd('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x60cd('0x6'));module[_0x60cd('0x7')]=function(_0x22f155,_0x4e3293){return _0x22f155[_0x60cd('0x8')]('Trigger',attributes,{'tableName':_0x60cd('0x9'),'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 527f7a6..09a6060 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 _0x3066=['info','result','catch','GetTrigger','Trigger','raw','options','where','attributes','limit','include','model','map','debug','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x3066,0x185));var _0x6306=function(_0xc2f609,_0x346dde){_0xc2f609=_0xc2f609-0x0;var _0x55840b=_0x3066[_0xc2f609];return _0x55840b;};'use strict';var _=require(_0x6306('0x0'));var util=require(_0x6306('0x1'));var moment=require(_0x6306('0x2'));var BPromise=require(_0x6306('0x3'));var rs=require(_0x6306('0x4'));var fs=require('fs');var Redis=require(_0x6306('0x5'));var db=require(_0x6306('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6306('0x7'))(_0x6306('0x8'));var config=require(_0x6306('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6306('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c5261,_0x2fe5ba,_0xd657f1){return new BPromise(function(_0xfc12db,_0x3bfe77){return client[_0x6306('0xb')](_0x1c5261,_0xd657f1)[_0x6306('0xc')](function(_0x17fd59){logger['info']('Trigger,\x20%s,\x20%s',_0x2fe5ba,_0x6306('0xd'));logger['debug'](_0x6306('0xe'),_0x2fe5ba,'request\x20sent',JSON[_0x6306('0xf')](_0x17fd59));if(_0x17fd59[_0x6306('0x10')]){if(_0x17fd59[_0x6306('0x10')]['code']===0x1f4){logger[_0x6306('0x10')](_0x6306('0x11'),_0x2fe5ba,_0x17fd59[_0x6306('0x10')]['message']);return _0x3bfe77(_0x17fd59['error'][_0x6306('0x12')]);}logger[_0x6306('0x10')](_0x6306('0x11'),_0x2fe5ba,_0x17fd59[_0x6306('0x10')][_0x6306('0x12')]);return _0xfc12db(_0x17fd59[_0x6306('0x10')][_0x6306('0x12')]);}else{logger[_0x6306('0x13')](_0x6306('0x11'),_0x2fe5ba,'request\x20sent');_0xfc12db(_0x17fd59[_0x6306('0x14')]['message']);}})[_0x6306('0x15')](function(_0x442775){logger[_0x6306('0x10')](_0x6306('0x11'),_0x2fe5ba,_0x442775);_0x3bfe77(_0x442775);});});}exports[_0x6306('0x16')]=function(_0x310c24){var _0x39b2fa=this;return new Promise(function(_0x27806c,_0x5e8c44){return db[_0x6306('0x17')]['findAll']({'raw':_0x310c24['options']?_0x310c24['options'][_0x6306('0x18')]===undefined?!![]:![]:!![],'where':_0x310c24[_0x6306('0x19')]?_0x310c24['options'][_0x6306('0x1a')]||null:null,'attributes':_0x310c24[_0x6306('0x19')]?_0x310c24[_0x6306('0x19')][_0x6306('0x1b')]||null:null,'limit':_0x310c24[_0x6306('0x19')]?_0x310c24[_0x6306('0x19')][_0x6306('0x1c')]||null:null,'include':_0x310c24[_0x6306('0x19')]?_0x310c24[_0x6306('0x19')][_0x6306('0x1d')]?_['map'](_0x310c24[_0x6306('0x19')][_0x6306('0x1d')],function(_0x4ee116){return{'model':db[_0x4ee116[_0x6306('0x1e')]],'as':_0x4ee116['as'],'attributes':_0x4ee116[_0x6306('0x1b')],'include':_0x4ee116[_0x6306('0x1d')]?_['map'](_0x4ee116[_0x6306('0x1d')],function(_0x1712e3){return{'model':db[_0x1712e3[_0x6306('0x1e')]],'as':_0x1712e3['as'],'attributes':_0x1712e3[_0x6306('0x1b')],'include':_0x1712e3[_0x6306('0x1d')]?_[_0x6306('0x1f')](_0x1712e3[_0x6306('0x1d')],function(_0x1d20e2){return{'model':db[_0x1d20e2[_0x6306('0x1e')]],'as':_0x1d20e2['as'],'attributes':_0x1d20e2[_0x6306('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6306('0xc')](function(_0x1136f5){logger['info'](_0x6306('0x16'),_0x310c24);logger[_0x6306('0x20')](_0x6306('0x16'),_0x310c24,JSON[_0x6306('0xf')](_0x1136f5));_0x27806c(_0x1136f5);})[_0x6306('0x15')](function(_0x1319a5){logger[_0x6306('0x10')](_0x6306('0x16'),_0x1319a5[_0x6306('0x12')],_0x310c24);_0x5e8c44(_0x39b2fa['error'](0x1f4,_0x1319a5[_0x6306('0x12')]));});});};exports[_0x6306('0x21')]=function(_0x1c79d6){var _0x350378=this;return new Promise(function(_0x3926ba,_0x1487f0){return db[_0x6306('0x17')]['find']({'raw':_0x1c79d6[_0x6306('0x19')]?_0x1c79d6[_0x6306('0x19')][_0x6306('0x18')]===undefined?!![]:![]:!![],'where':_0x1c79d6[_0x6306('0x19')]?_0x1c79d6[_0x6306('0x19')][_0x6306('0x1a')]||null:null,'attributes':_0x1c79d6[_0x6306('0x19')]?_0x1c79d6['options'][_0x6306('0x1b')]||null:null,'include':_0x1c79d6[_0x6306('0x19')]?_0x1c79d6['options'][_0x6306('0x1d')]?_[_0x6306('0x1f')](_0x1c79d6[_0x6306('0x19')][_0x6306('0x1d')],function(_0x1f9b56){return{'model':db[_0x1f9b56[_0x6306('0x1e')]],'as':_0x1f9b56['as'],'attributes':_0x1f9b56[_0x6306('0x1b')],'include':_0x1f9b56['include']?_[_0x6306('0x1f')](_0x1f9b56[_0x6306('0x1d')],function(_0x594978){return{'model':db[_0x594978[_0x6306('0x1e')]],'as':_0x594978['as'],'attributes':_0x594978[_0x6306('0x1b')],'include':_0x594978[_0x6306('0x1d')]?_[_0x6306('0x1f')](_0x594978[_0x6306('0x1d')],function(_0x31490e){return{'model':db[_0x31490e[_0x6306('0x1e')]],'as':_0x31490e['as'],'attributes':_0x31490e[_0x6306('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d7d4e){logger['info']('ShowTrigger',_0x1c79d6);logger[_0x6306('0x20')](_0x6306('0x21'),_0x1c79d6,JSON[_0x6306('0xf')](_0x4d7d4e));_0x3926ba(_0x4d7d4e);})['catch'](function(_0xc2f974){logger['error']('ShowTrigger',_0xc2f974[_0x6306('0x12')],_0x1c79d6);_0x1487f0(_0x350378[_0x6306('0x10')](0x1f4,_0xc2f974[_0x6306('0x12')]));});});}; \ No newline at end of file +var _0x98d1=['options','raw','attributes','limit','include','map','model','GetTrigger','ShowTrigger','Trigger','find','where','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x98d1,0x13e));var _0x198d=function(_0x5d37c4,_0x519e98){_0x5d37c4=_0x5d37c4-0x0;var _0x4a0ab1=_0x98d1[_0x5d37c4];return _0x4a0ab1;};'use strict';var _=require(_0x198d('0x0'));var util=require('util');var moment=require(_0x198d('0x1'));var BPromise=require('bluebird');var rs=require(_0x198d('0x2'));var fs=require('fs');var Redis=require(_0x198d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x198d('0x4'));var logger=require(_0x198d('0x5'))(_0x198d('0x6'));var config=require(_0x198d('0x7'));var jayson=require(_0x198d('0x8'));var client=jayson['client'][_0x198d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ddaa8,_0x2daf4e,_0x46d65c){return new BPromise(function(_0x4d82e6,_0x5ebd19){return client['request'](_0x2ddaa8,_0x46d65c)[_0x198d('0xa')](function(_0x2c6570){logger['info'](_0x198d('0xb'),_0x2daf4e,_0x198d('0xc'));logger[_0x198d('0xd')](_0x198d('0xe'),_0x2daf4e,_0x198d('0xc'),JSON[_0x198d('0xf')](_0x2c6570));if(_0x2c6570[_0x198d('0x10')]){if(_0x2c6570[_0x198d('0x10')][_0x198d('0x11')]===0x1f4){logger['error'](_0x198d('0xb'),_0x2daf4e,_0x2c6570['error'][_0x198d('0x12')]);return _0x5ebd19(_0x2c6570['error']['message']);}logger['error'](_0x198d('0xb'),_0x2daf4e,_0x2c6570[_0x198d('0x10')][_0x198d('0x12')]);return _0x4d82e6(_0x2c6570[_0x198d('0x10')][_0x198d('0x12')]);}else{logger[_0x198d('0x13')]('Trigger,\x20%s,\x20%s',_0x2daf4e,_0x198d('0xc'));_0x4d82e6(_0x2c6570[_0x198d('0x14')][_0x198d('0x12')]);}})[_0x198d('0x15')](function(_0x4c6e37){logger['error'](_0x198d('0xb'),_0x2daf4e,_0x4c6e37);_0x5ebd19(_0x4c6e37);});});}exports['GetTrigger']=function(_0x535889){var _0x52882e=this;return new Promise(function(_0x9170c8,_0x5f3870){return db['Trigger']['findAll']({'raw':_0x535889[_0x198d('0x16')]?_0x535889['options'][_0x198d('0x17')]===undefined?!![]:![]:!![],'where':_0x535889['options']?_0x535889['options']['where']||null:null,'attributes':_0x535889[_0x198d('0x16')]?_0x535889[_0x198d('0x16')][_0x198d('0x18')]||null:null,'limit':_0x535889[_0x198d('0x16')]?_0x535889[_0x198d('0x16')][_0x198d('0x19')]||null:null,'include':_0x535889[_0x198d('0x16')]?_0x535889[_0x198d('0x16')][_0x198d('0x1a')]?_[_0x198d('0x1b')](_0x535889[_0x198d('0x16')][_0x198d('0x1a')],function(_0xb0c309){return{'model':db[_0xb0c309[_0x198d('0x1c')]],'as':_0xb0c309['as'],'attributes':_0xb0c309[_0x198d('0x18')],'include':_0xb0c309[_0x198d('0x1a')]?_['map'](_0xb0c309[_0x198d('0x1a')],function(_0x207137){return{'model':db[_0x207137[_0x198d('0x1c')]],'as':_0x207137['as'],'attributes':_0x207137['attributes'],'include':_0x207137[_0x198d('0x1a')]?_[_0x198d('0x1b')](_0x207137[_0x198d('0x1a')],function(_0x4513cc){return{'model':db[_0x4513cc[_0x198d('0x1c')]],'as':_0x4513cc['as'],'attributes':_0x4513cc[_0x198d('0x18')]};}):[]};}):[]};}):[]:[]})[_0x198d('0xa')](function(_0x1696ca){logger['info'](_0x198d('0x1d'),_0x535889);logger[_0x198d('0xd')](_0x198d('0x1d'),_0x535889,JSON[_0x198d('0xf')](_0x1696ca));_0x9170c8(_0x1696ca);})[_0x198d('0x15')](function(_0x61e503){logger[_0x198d('0x10')](_0x198d('0x1d'),_0x61e503['message'],_0x535889);_0x5f3870(_0x52882e[_0x198d('0x10')](0x1f4,_0x61e503[_0x198d('0x12')]));});});};exports[_0x198d('0x1e')]=function(_0x4ab93c){var _0x28ad40=this;return new Promise(function(_0x31356f,_0x376f64){return db[_0x198d('0x1f')][_0x198d('0x20')]({'raw':_0x4ab93c[_0x198d('0x16')]?_0x4ab93c[_0x198d('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4ab93c[_0x198d('0x16')]?_0x4ab93c[_0x198d('0x16')][_0x198d('0x21')]||null:null,'attributes':_0x4ab93c[_0x198d('0x16')]?_0x4ab93c[_0x198d('0x16')][_0x198d('0x18')]||null:null,'include':_0x4ab93c[_0x198d('0x16')]?_0x4ab93c['options']['include']?_['map'](_0x4ab93c['options'][_0x198d('0x1a')],function(_0x11b4d5){return{'model':db[_0x11b4d5[_0x198d('0x1c')]],'as':_0x11b4d5['as'],'attributes':_0x11b4d5[_0x198d('0x18')],'include':_0x11b4d5[_0x198d('0x1a')]?_[_0x198d('0x1b')](_0x11b4d5['include'],function(_0x473cc4){return{'model':db[_0x473cc4[_0x198d('0x1c')]],'as':_0x473cc4['as'],'attributes':_0x473cc4[_0x198d('0x18')],'include':_0x473cc4[_0x198d('0x1a')]?_[_0x198d('0x1b')](_0x473cc4[_0x198d('0x1a')],function(_0x55038b){return{'model':db[_0x55038b[_0x198d('0x1c')]],'as':_0x55038b['as'],'attributes':_0x55038b[_0x198d('0x18')]};}):[]};}):[]};}):[]:[]})[_0x198d('0xa')](function(_0x20c744){logger[_0x198d('0x13')](_0x198d('0x1e'),_0x4ab93c);logger[_0x198d('0xd')]('ShowTrigger',_0x4ab93c,JSON[_0x198d('0xf')](_0x20c744));_0x31356f(_0x20c744);})[_0x198d('0x15')](function(_0x1e701e){logger[_0x198d('0x10')]('ShowTrigger',_0x1e701e['message'],_0x4ab93c);_0x376f64(_0x28ad40[_0x198d('0x10')](0x1f4,_0x1e701e[_0x198d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index c53d198..4005fcb 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 _0x0679=['exports','multer','util','path','express','fs-extra','../../config/environment','index','get','/:id','isAuthenticated','show','post','/:id/clone','clone','create','update','delete','destroy'];(function(_0x7f0895,_0x34fcd8){var _0x88a921=function(_0x4a87e4){while(--_0x4a87e4){_0x7f0895['push'](_0x7f0895['shift']());}};_0x88a921(++_0x34fcd8);}(_0x0679,0x73));var _0x9067=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x0679[_0x10004e];return _0x5af990;};'use strict';var multer=require(_0x9067('0x0'));var util=require(_0x9067('0x1'));var path=require(_0x9067('0x2'));var timeout=require('connect-timeout');var express=require(_0x9067('0x3'));var router=express['Router']();var fs_extra=require(_0x9067('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9067('0x5'));var controller=require('./trunk.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9067('0x6')]);router[_0x9067('0x7')](_0x9067('0x8'),auth[_0x9067('0x9')](),controller[_0x9067('0xa')]);router[_0x9067('0xb')](_0x9067('0xc'),auth[_0x9067('0x9')](),controller[_0x9067('0xd')]);router[_0x9067('0xb')]('/',auth[_0x9067('0x9')](),controller[_0x9067('0xe')]);router['put'](_0x9067('0x8'),auth[_0x9067('0x9')](),controller[_0x9067('0xf')]);router[_0x9067('0x10')](_0x9067('0x8'),auth[_0x9067('0x9')](),controller[_0x9067('0x11')]);module[_0x9067('0x12')]=router; \ No newline at end of file +var _0x5c33=['../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','post','clone','create','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x5c33,0xd5));var _0x35c3=function(_0x2a67cc,_0x4756fd){_0x2a67cc=_0x2a67cc-0x0;var _0x1484de=_0x5c33[_0x2a67cc];return _0x1484de;};'use strict';var multer=require(_0x35c3('0x0'));var util=require(_0x35c3('0x1'));var path=require(_0x35c3('0x2'));var timeout=require(_0x35c3('0x3'));var express=require(_0x35c3('0x4'));var router=express[_0x35c3('0x5')]();var fs_extra=require(_0x35c3('0x6'));var auth=require(_0x35c3('0x7'));var interaction=require(_0x35c3('0x8'));var config=require('../../config/environment');var controller=require(_0x35c3('0x9'));router[_0x35c3('0xa')]('/',auth[_0x35c3('0xb')](),controller[_0x35c3('0xc')]);router[_0x35c3('0xa')](_0x35c3('0xd'),auth[_0x35c3('0xb')](),controller[_0x35c3('0xe')]);router[_0x35c3('0xf')]('/:id/clone',auth[_0x35c3('0xb')](),controller[_0x35c3('0x10')]);router['post']('/',auth[_0x35c3('0xb')](),controller[_0x35c3('0x11')]);router[_0x35c3('0x12')](_0x35c3('0xd'),auth[_0x35c3('0xb')](),controller['update']);router['delete'](_0x35c3('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x35c3('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index e08f7cf..8d5fec3 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 _0x16cf=['PROHIB_FAILED_SCREEN','PROHIB','udp','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','outgoing','force_rport,comedia','setDataValue','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','refuse','uac','uas','pai','fingerprint','certificate','active','passive','nonat','update','update,nonat','BOOLEAN','exports','STRING','name','friend','user','peer','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x16cf,0x91));var _0xf16c=function(_0x563ae2,_0x2bb500){_0x563ae2=_0x563ae2-0x0;var _0xb80c12=_0x16cf[_0x563ae2];return _0xb80c12;};'use strict';var Sequelize=require('sequelize');module[_0xf16c('0x0')]={'name':{'type':Sequelize[_0xf16c('0x1')],'allowNull':![],'unique':_0xf16c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xf16c('0x3'),_0xf16c('0x4'),_0xf16c('0x5')),'allowNull':![],'defaultValue':_0xf16c('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x7'),_0xf16c('0x8'),'ALLOWED_FAILED_SCREEN',_0xf16c('0x9'),_0xf16c('0xa'),'PROHIB_PASSED_SCREEN',_0xf16c('0xb'),_0xf16c('0xc'))},'deny':{'type':Sequelize[_0xf16c('0x1')]},'permit':{'type':Sequelize[_0xf16c('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xf16c('0x1')]},'remotesecret':{'type':Sequelize[_0xf16c('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xf16c('0xd'),'set':function(_0xfdddd){this['setDataValue']('transport',_0xfdddd?_0xfdddd['join'](','):null);},'get':function(){return this[_0xf16c('0xe')](_0xf16c('0xf'))?this['getDataValue']('transport')[_0xf16c('0x10')](','):null;},'comment':_0xf16c('0x11')},'dtmfmode':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x12'),_0xf16c('0x13'),_0xf16c('0x14'),'inband',_0xf16c('0x15')),'defaultValue':_0xf16c('0x12')},'directmedia':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x16'),'no','nonat','update',_0xf16c('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xf16c('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf16c('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xf16c('0x18'),'set':function(_0x4d81ae){this[_0xf16c('0x19')](_0xf16c('0x1a'),_0x4d81ae?_0x4d81ae[_0xf16c('0x1b')](','):null);},'get':function(){return this[_0xf16c('0xe')](_0xf16c('0x1a'))?this['getDataValue'](_0xf16c('0x1a'))[_0xf16c('0x10')](','):null;},'comment':_0xf16c('0x1c')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xf16c('0x1')]},'pickupgroup':{'type':Sequelize[_0xf16c('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xf16c('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xf16c('0x1d')},'allow':{'type':Sequelize[_0xf16c('0x1')],'allowNull':![],'defaultValue':_0xf16c('0x1e'),'set':function(_0x5a1441){this[_0xf16c('0x19')](_0xf16c('0x1f'),_0x5a1441?_0x5a1441[_0xf16c('0x1b')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xf16c('0xe')](_0xf16c('0x1f'))?this['getDataValue']('allow')[_0xf16c('0x10')](';'):null;},'comment':_0xf16c('0x20')},'autoframing':{'type':Sequelize['ENUM'](_0xf16c('0x16'),'no')},'insecure':{'type':Sequelize[_0xf16c('0x1')],'defaultValue':_0xf16c('0x21'),'set':function(_0x3b3078){this['setDataValue'](_0xf16c('0x22'),_0x3b3078?_0x3b3078[_0xf16c('0x1b')](','):null);},'get':function(){return this[_0xf16c('0xe')](_0xf16c('0x22'))?this[_0xf16c('0xe')]('insecure')[_0xf16c('0x10')](','):null;},'comment':_0xf16c('0x23')},'trustrpid':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xf16c('0x24'))},'promiscredir':{'type':Sequelize[_0xf16c('0x6')]('yes','no')},'useclientcode':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x16'),'no')},'accountcode':{'type':Sequelize[_0xf16c('0x25')](0xb)},'setvar':{'type':Sequelize[_0xf16c('0x1')]},'callerid':{'type':Sequelize[_0xf16c('0x1')],'defaultValue':_0xf16c('0x26')},'amaflags':{'type':Sequelize[_0xf16c('0x1')]},'callcounter':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x16'),'no'),'defaultValue':_0xf16c('0x16')},'busylevel':{'type':Sequelize[_0xf16c('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0xf16c('0x6')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xf16c('0x1')]},'videosupport':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x16'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf16c('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x16'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x27'),_0xf16c('0x28'),'originate')},'session_expires':{'type':Sequelize[_0xf16c('0x25')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x29'),_0xf16c('0x2a')),'defaultValue':_0xf16c('0x2a')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xf16c('0x1')]},'fromdomain':{'type':Sequelize[_0xf16c('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf16c('0x25')](0x5)},'qualify':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x16'),'no'),'defaultValue':_0xf16c('0x16')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xf16c('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xf16c('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf16c('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf16c('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xf16c('0x6')]('yes','no',_0xf16c('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xf16c('0x1')]},'timert1':{'type':Sequelize[_0xf16c('0x25')](0xb)},'timerb':{'type':Sequelize[_0xf16c('0x25')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xf16c('0x1')]},'contactacl':{'type':Sequelize[_0xf16c('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xf16c('0x1')]},'use_q850_reason':{'type':Sequelize[_0xf16c('0x1')]},'maxforwards':{'type':Sequelize[_0xf16c('0x25')](0xb)},'encryption':{'type':Sequelize[_0xf16c('0x6')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x16'),'no')},'icesupport':{'type':Sequelize[_0xf16c('0x6')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0xf16c('0x6')]('yes','no',_0xf16c('0x2c'),_0xf16c('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xf16c('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xf16c('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xf16c('0x1')]},'dtlscipher':{'type':Sequelize[_0xf16c('0x1')]},'dtlscafile':{'type':Sequelize[_0xf16c('0x1')]},'dtlscapath':{'type':Sequelize[_0xf16c('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xf16c('0x2e'),_0xf16c('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf16c('0x1')]},'usereqphone':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf16c('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf16c('0x6')](_0xf16c('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0xf16c('0x6')]('yes','no')},'vmexten':{'type':Sequelize[_0xf16c('0x1')]},'mohinterpret':{'type':Sequelize[_0xf16c('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xf16c('0x1')]},'description':{'type':Sequelize[_0xf16c('0x1')]},'host':{'type':Sequelize[_0xf16c('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0xf16c('0x16'),'no',_0xf16c('0x30'),_0xf16c('0x31'),_0xf16c('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xf16c('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xc32a=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','inband','auto','rfc2833','yes','nonat','outgoing','force_rport,comedia','nat'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc32a,0xa5));var _0xac32=function(_0x296923,_0x4adaed){_0x296923=_0x296923-0x0;var _0x29af70=_0xc32a[_0x296923];return _0x29af70;};'use strict';var Sequelize=require(_0xac32('0x0'));module[_0xac32('0x1')]={'name':{'type':Sequelize[_0xac32('0x2')],'allowNull':![],'unique':_0xac32('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x5'),_0xac32('0x6'),_0xac32('0x7')),'allowNull':![],'defaultValue':_0xac32('0x5')},'context':{'type':Sequelize[_0xac32('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xac32('0x4')]('ALLOWED_NOT_SCREENED',_0xac32('0x8'),_0xac32('0x9'),_0xac32('0xa'),_0xac32('0xb'),'PROHIB_PASSED_SCREEN',_0xac32('0xc'),_0xac32('0xd'))},'deny':{'type':Sequelize[_0xac32('0x2')]},'permit':{'type':Sequelize[_0xac32('0x2')]},'secret':{'type':Sequelize[_0xac32('0x2')]},'md5secret':{'type':Sequelize[_0xac32('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xac32('0x2')],'defaultValue':'udp','set':function(_0x3da806){this[_0xac32('0xe')](_0xac32('0xf'),_0x3da806?_0x3da806[_0xac32('0x10')](','):null);},'get':function(){return this[_0xac32('0x11')](_0xac32('0xf'))?this[_0xac32('0x11')](_0xac32('0xf'))[_0xac32('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833','info','shortinfo',_0xac32('0x13'),_0xac32('0x14')),'defaultValue':_0xac32('0x15')},'directmedia':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no',_0xac32('0x17'),'update',_0xac32('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xac32('0x2')]},'nat':{'type':Sequelize[_0xac32('0x2')],'defaultValue':_0xac32('0x19'),'set':function(_0xeb44cf){this[_0xac32('0xe')](_0xac32('0x1a'),_0xeb44cf?_0xeb44cf[_0xac32('0x10')](','):null);},'get':function(){return this[_0xac32('0x11')]('nat')?this['getDataValue'](_0xac32('0x1a'))[_0xac32('0x12')](','):null;},'comment':_0xac32('0x1b')},'callgroup':{'type':Sequelize[_0xac32('0x2')]},'namedcallgroup':{'type':Sequelize[_0xac32('0x2')]},'pickupgroup':{'type':Sequelize[_0xac32('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xac32('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xac32('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xac32('0x2')],'defaultValue':_0xac32('0x1c')},'allow':{'type':Sequelize[_0xac32('0x2')],'allowNull':![],'defaultValue':_0xac32('0x1d'),'set':function(_0x79a21c){this[_0xac32('0xe')](_0xac32('0x1e'),_0x79a21c?_0x79a21c[_0xac32('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xac32('0x11')](_0xac32('0x1e'))?this['getDataValue'](_0xac32('0x1e'))[_0xac32('0x12')](';'):null;},'comment':_0xac32('0x1f')},'autoframing':{'type':Sequelize[_0xac32('0x4')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x166dde){this[_0xac32('0xe')](_0xac32('0x20'),_0x166dde?_0x166dde[_0xac32('0x10')](','):null);},'get':function(){return this[_0xac32('0x11')](_0xac32('0x20'))?this[_0xac32('0x11')](_0xac32('0x20'))[_0xac32('0x12')](','):null;},'comment':_0xac32('0x21')},'trustrpid':{'type':Sequelize['ENUM'](_0xac32('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xac32('0x4')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no')},'useclientcode':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no')},'accountcode':{'type':Sequelize[_0xac32('0x22')](0xb)},'setvar':{'type':Sequelize[_0xac32('0x2')]},'callerid':{'type':Sequelize[_0xac32('0x2')],'defaultValue':_0xac32('0x23')},'amaflags':{'type':Sequelize[_0xac32('0x2')]},'callcounter':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no'),'defaultValue':_0xac32('0x16')},'busylevel':{'type':Sequelize[_0xac32('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no',_0xac32('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no')},'mailbox':{'type':Sequelize[_0xac32('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0xac32('0x25'),_0xac32('0x26'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xac32('0x27'),'uas'),'defaultValue':_0xac32('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0xac32('0x2')]},'regexten':{'type':Sequelize[_0xac32('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xac32('0x2')]},'port':{'type':Sequelize[_0xac32('0x22')](0x5)},'qualify':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no'),'defaultValue':_0xac32('0x16')},'keepalive':{'type':Sequelize[_0xac32('0x22')](0xb)},'defaultip':{'type':Sequelize[_0xac32('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xac32('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xac32('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xac32('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xac32('0x22')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xac32('0x2')]},'contactacl':{'type':Sequelize[_0xac32('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xac32('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xac32('0x22')](0xb)},'encryption':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xac32('0x16'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xac32('0x16'),'no')},'icesupport':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no',_0xac32('0x29'),_0xac32('0x2a'))},'dtlsrekey':{'type':Sequelize[_0xac32('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0xac32('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xac32('0x2')]},'dtlscapath':{'type':Sequelize[_0xac32('0x2')]},'dtlssetup':{'type':Sequelize[_0xac32('0x4')]('active','passive',_0xac32('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xac32('0x2')]},'usereqphone':{'type':Sequelize[_0xac32('0x4')](_0xac32('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xac32('0x2')]},'call_limit':{'type':Sequelize[_0xac32('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xac32('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0xac32('0x2')]},'mohinterpret':{'type':Sequelize[_0xac32('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xac32('0x2')]},'host':{'type':Sequelize[_0xac32('0x2')],'defaultValue':_0xac32('0x2c')},'canreinvite':{'type':Sequelize[_0xac32('0x4')]('yes','no','nonat',_0xac32('0x2d'),_0xac32('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xac32('0x2')]},'active':{'type':Sequelize[_0xac32('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xac32('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index fab5b56..7704320 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 _0x425d=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','userProfileId','/etc/asterisk/sip_xcally_trunks.conf','destroy','eml-format','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/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','Trunk,\x20%s,\x20%s','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','stack','name','send','index','map','Trunk','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','find','omit','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8'];(function(_0xf53bd1,_0x21a7cb){var _0x570f3c=function(_0x647035){while(--_0x647035){_0xf53bd1['push'](_0xf53bd1['shift']());}};_0x570f3c(++_0x21a7cb);}(_0x425d,0x1e0));var _0xd425=function(_0x503287,_0x252ead){_0x503287=_0x503287-0x0;var _0x3709ef=_0x425d[_0x503287];return _0x3709ef;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];var jayson=require(_0xd425('0x1d'));var client=jayson[_0xd425('0x1e')][_0xd425('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x18eafb,_0x51263f,_0x27318c,_0x17a498){return new BPromise(function(_0x336dc3,_0x5d3d60){var _0x309263=_0x17a498||client;return _0x309263[_0xd425('0x20')](_0x18eafb,_0x27318c)[_0xd425('0x21')](function(_0x41f34d){logger[_0xd425('0x22')]('Trunk,\x20%s,\x20%s',_0x51263f,_0xd425('0x23'));logger[_0xd425('0x24')](_0xd425('0x25'),_0x51263f,_0xd425('0x23'),JSON['stringify'](_0x41f34d));if(_0x41f34d[_0xd425('0x26')]){if(_0x41f34d[_0xd425('0x26')][_0xd425('0x27')]===0x1f4){logger[_0xd425('0x26')]('Trunk,\x20%s,\x20%s',_0x51263f,_0x41f34d['error']['message']);return _0x5d3d60(_0x41f34d['error'][_0xd425('0x28')]);}logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x41f34d['error'][_0xd425('0x28')]);return _0x336dc3(_0x41f34d[_0xd425('0x26')]['message']);}else{logger[_0xd425('0x22')](_0xd425('0x29'),_0x51263f,_0xd425('0x23'));_0x336dc3(_0x41f34d[_0xd425('0x2a')][_0xd425('0x28')]);}})[_0xd425('0x2b')](function(_0x2480a0){logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x2480a0);_0x5d3d60(_0x2480a0);});});}function respondWithStatusCode(_0x2b030b,_0x151ad9){_0x151ad9=_0x151ad9||0xcc;return function(_0x40e84b){if(_0x40e84b){return _0x2b030b['sendStatus'](_0x151ad9);}return _0x2b030b[_0xd425('0x2c')](_0x151ad9)[_0xd425('0x2d')]();};}function respondWithResult(_0x398985,_0x1908a5){_0x1908a5=_0x1908a5||0xc8;return function(_0x2afcdb){if(_0x2afcdb){return _0x398985[_0xd425('0x2c')](_0x1908a5)[_0xd425('0x2e')](_0x2afcdb);}};}function respondWithFilteredResult(_0x577e4b,_0x12f951){return function(_0x177de2){if(_0x177de2){var _0x1d8861=typeof _0x12f951['offset']===_0xd425('0x2f')&&typeof _0x12f951[_0xd425('0x30')]===_0xd425('0x2f');var _0x999fb9=_0x177de2[_0xd425('0x31')];var _0x185d7e=_0x1d8861?0x0:_0x12f951[_0xd425('0x32')];var _0x37b63c=_0x1d8861?_0x177de2[_0xd425('0x31')]:_0x12f951[_0xd425('0x32')]+_0x12f951['limit'];var _0x471e3e;if(_0x37b63c>=_0x999fb9){_0x37b63c=_0x999fb9;_0x471e3e=0xc8;}else{_0x471e3e=0xce;}_0x577e4b[_0xd425('0x2c')](_0x471e3e);return _0x577e4b[_0xd425('0x33')](_0xd425('0x34'),_0x185d7e+'-'+_0x37b63c+'/'+_0x999fb9)[_0xd425('0x2e')](_0x177de2);}return null;};}function patchUpdates(_0x1abf33){return function(_0x47405f){try{jsonpatch[_0xd425('0x35')](_0x47405f,_0x1abf33,!![]);}catch(_0x3ec51b){return BPromise[_0xd425('0x36')](_0x3ec51b);}return _0x47405f[_0xd425('0x37')]();};}function saveUpdates(_0x5f3dab,_0x316493){return function(_0x2a2a9b){if(_0x2a2a9b){return _0x2a2a9b[_0xd425('0x38')](_0x5f3dab)[_0xd425('0x21')](function(_0x28870f){return _0x28870f;});}return null;};}function removeEntity(_0x4eddbc,_0x4aa168){return function(_0x3badcc){if(_0x3badcc){return _0x3badcc['destroy']()['then'](function(){var _0x51669d=_0x3badcc[_0xd425('0x39')]({'plain':!![]});var _0xfb0c8=_0xd425('0x3a');return db[_0xd425('0x3b')]['destroy']({'where':{'type':_0xfb0c8,'resourceId':_0x51669d['id']}})[_0xd425('0x21')](function(){return _0x3badcc;});})[_0xd425('0x21')](function(){_0x4eddbc[_0xd425('0x2c')](0xcc)[_0xd425('0x2d')]();});}};}function handleEntityNotFound(_0x27b9e2,_0x1e12f2){return function(_0x35bbec){if(!_0x35bbec){_0x27b9e2['sendStatus'](0x194);}return _0x35bbec;};}function handleError(_0x363fb0,_0x59b3d3){_0x59b3d3=_0x59b3d3||0x1f4;return function(_0x22df81){logger[_0xd425('0x26')](_0x22df81[_0xd425('0x3c')]);if(_0x22df81['name']){delete _0x22df81[_0xd425('0x3d')];}_0x363fb0[_0xd425('0x2c')](_0x59b3d3)[_0xd425('0x3e')](_0x22df81);};}exports[_0xd425('0x3f')]=function(_0x58f36d,_0x1d38fa){var _0x3cf540={},_0x59e326={},_0x5d310e={'count':0x0,'rows':[]};var _0x48fc85=_[_0xd425('0x40')](db[_0xd425('0x41')][_0xd425('0x42')],function(_0x588688){return{'name':_0x588688['fieldName'],'type':_0x588688['type'][_0xd425('0x43')]};});_0x59e326[_0xd425('0x44')]=_[_0xd425('0x40')](_0x48fc85,_0xd425('0x3d'));_0x59e326[_0xd425('0x45')]=_[_0xd425('0x46')](_0x58f36d[_0xd425('0x45')]);_0x59e326['filters']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],_0x59e326[_0xd425('0x45')]);_0x3cf540['attributes']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],qs[_0xd425('0x48')](_0x58f36d['query'][_0xd425('0x48')]));_0x3cf540[_0xd425('0x49')]=_0x3cf540[_0xd425('0x49')][_0xd425('0x4a')]?_0x3cf540['attributes']:_0x59e326[_0xd425('0x44')];if(!_0x58f36d[_0xd425('0x45')][_0xd425('0x4b')](_0xd425('0x4c'))){_0x3cf540[_0xd425('0x30')]=qs[_0xd425('0x30')](_0x58f36d[_0xd425('0x45')]['limit']);_0x3cf540[_0xd425('0x32')]=qs[_0xd425('0x32')](_0x58f36d['query'][_0xd425('0x32')]);}_0x3cf540['order']=qs['sort'](_0x58f36d[_0xd425('0x45')]['sort']);_0x3cf540[_0xd425('0x4d')]=qs['filters'](_[_0xd425('0x4e')](_0x58f36d[_0xd425('0x45')],_0x59e326[_0xd425('0x4f')]),_0x48fc85);if(_0x58f36d[_0xd425('0x45')][_0xd425('0x50')]){_0x3cf540['where']=_[_0xd425('0x51')](_0x3cf540['where'],{'$or':_[_0xd425('0x40')](_0x48fc85,function(_0x55a15d){if(_0x55a15d[_0xd425('0x52')]!==_0xd425('0x53')){var _0x3fd2ce={};_0x3fd2ce[_0x55a15d[_0xd425('0x3d')]]={'$like':'%'+_0x58f36d[_0xd425('0x45')]['filter']+'%'};return _0x3fd2ce;}})});}_0x3cf540=_[_0xd425('0x51')]({},_0x3cf540,_0x58f36d[_0xd425('0x54')]);var _0x35e77b={'where':_0x3cf540[_0xd425('0x4d')]};return db[_0xd425('0x41')]['count'](_0x35e77b)[_0xd425('0x21')](function(_0x177704){_0x5d310e[_0xd425('0x31')]=_0x177704;if(_0x58f36d[_0xd425('0x45')][_0xd425('0x55')]){_0x3cf540[_0xd425('0x56')]=[{'all':!![]}];}return db['Trunk'][_0xd425('0x57')](_0x3cf540);})[_0xd425('0x21')](function(_0x5bfac6){_0x5d310e[_0xd425('0x58')]=_0x5bfac6;return _0x5d310e;})[_0xd425('0x21')](respondWithFilteredResult(_0x1d38fa,_0x3cf540))[_0xd425('0x2b')](handleError(_0x1d38fa,null));};exports[_0xd425('0x59')]=function(_0x5c0219,_0x54f1d){var _0x2b8882={'raw':![],'where':{'id':_0x5c0219[_0xd425('0x5a')]['id']}},_0x4552cd={};_0x4552cd[_0xd425('0x44')]=_['keys'](db['Trunk'][_0xd425('0x42')]);_0x4552cd['query']=_[_0xd425('0x46')](_0x5c0219[_0xd425('0x45')]);_0x4552cd['filters']=_[_0xd425('0x47')](_0x4552cd['model'],_0x4552cd['query']);_0x2b8882[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4552cd[_0xd425('0x44')],qs[_0xd425('0x48')](_0x5c0219[_0xd425('0x45')][_0xd425('0x48')]));_0x2b8882[_0xd425('0x49')]=_0x2b8882[_0xd425('0x49')]['length']?_0x2b8882[_0xd425('0x49')]:_0x4552cd[_0xd425('0x44')];if(_0x5c0219[_0xd425('0x45')][_0xd425('0x55')]){_0x2b8882[_0xd425('0x56')]=[{'all':!![]}];}_0x2b8882=_[_0xd425('0x51')]({},_0x2b8882,_0x5c0219[_0xd425('0x54')]);return db[_0xd425('0x41')]['find'](_0x2b8882)['then'](handleEntityNotFound(_0x54f1d,null))['then'](respondWithResult(_0x54f1d,null))[_0xd425('0x2b')](handleError(_0x54f1d,null));};exports[_0xd425('0x5b')]=function(_0x3dec61,_0x3c6b49){var _0x59c286={'where':{'id':_0x3dec61['params']['id']}},_0x4fedc0={};_0x4fedc0['model']=_[_0xd425('0x46')](db[_0xd425('0x41')]['rawAttributes']);_0x59c286[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4fedc0[_0xd425('0x44')],qs['fields'](_0x3dec61['query'][_0xd425('0x48')]));_0x59c286['attributes']=_0x59c286['attributes']['length']?_0x59c286[_0xd425('0x49')]:_0x4fedc0[_0xd425('0x44')];if(_0x3dec61[_0xd425('0x45')]['includeAll']){_0x59c286[_0xd425('0x56')]=[{'all':!![]}];}_0x59c286=_['merge']({},_0x59c286,_0x3dec61[_0xd425('0x54')]);return db[_0xd425('0x41')][_0xd425('0x5c')](_0x59c286)[_0xd425('0x21')](handleEntityNotFound(_0x3c6b49,null))[_0xd425('0x21')](function(_0xd261a){if(_0xd261a){var _0xa21f7c=_0xd261a[_0xd425('0x39')]({'plain':!![]});_0xa21f7c=qs[_0xd425('0x5d')](_0xa21f7c,['id','createdAt',_0xd425('0x5e')]);_0x3dec61[_0xd425('0x5f')]=_[_0xd425('0x5d')](_0x3dec61[_0xd425('0x5f')],['id','createdAt','updatedAt']);return db[_0xd425('0x41')][_0xd425('0x60')](_[_0xd425('0x51')](_0xa21f7c,_0x3dec61[_0xd425('0x5f')]),{'include':_0x3dec61[_0xd425('0x45')][_0xd425('0x55')]?[{'all':!![]}]:undefined})[_0xd425('0x21')](function(_0x44782a){var _0x1fcde4=_0x3dec61[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x1fcde4)throw new Error(_0xd425('0x62'));if(_0x1fcde4[_0xd425('0x63')]===_0xd425('0x61')){var _0x5e72db=_0x44782a[_0xd425('0x39')]({'plain':!![]});var _0x343cc1=_0xd425('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x343cc1,'userProfileId':_0x1fcde4['userProfileId']},'raw':!![]})[_0xd425('0x21')](function(_0x34d065){if(_0x34d065&&_0x34d065[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x5e72db['name'],'resourceId':_0x5e72db['id'],'type':_0x34d065[_0xd425('0x3d')],'sectionId':_0x34d065['id']},{})[_0xd425('0x21')](function(){return _0x44782a;});}else{return _0x44782a;}})[_0xd425('0x2b')](function(_0x5113fc){logger[_0xd425('0x26')](_0xd425('0x65'),_0x5113fc);throw _0x5113fc;});}return _0x44782a;});}})[_0xd425('0x21')](respondWithResult(_0x3c6b49,0xc9))[_0xd425('0x2b')](handleError(_0x3c6b49,null));};exports[_0xd425('0x60')]=function(_0x43b1a9,_0x38a762,_0x44db7f){var _0xcb1a64;return db[_0xd425('0x41')][_0xd425('0x60')](_0x43b1a9[_0xd425('0x5f')],{'raw':!![]})[_0xd425('0x21')](function(_0x285d54){_0xcb1a64=_0x285d54;return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})[_0xd425('0x21')](function(_0x25cae6){var _0x541218=fs['readFileSync'](path[_0xd425('0x66')](config['root'],_0xd425('0x67')),_0xd425('0x68'));var _0xb407bb=fs[_0xd425('0x69')](path['join'](config[_0xd425('0x6a')],_0xd425('0x6b')),_0xd425('0x68'));var _0x689332=ejs[_0xd425('0x6c')](_0x541218,{'trunks':_0x25cae6||[]});fs[_0xd425('0x6d')]('/etc/asterisk/sip_xcally_trunks.conf',_0x689332);if(_0xcb1a64['registry']){var _0x3ccffe=ejs[_0xd425('0x6c')](_0xb407bb,{'trunks':_0x25cae6||[]});fs['writeFileSync'](_0xd425('0x6e'),_0x3ccffe);}})['then'](function(){return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x60'),{'module':_0xd425('0x70')});})[_0xd425('0x21')](function(){var _0x376134=_0x43b1a9[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x376134)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x376134[_0xd425('0x63')]===_0xd425('0x61')){var _0x24af3=_0xcb1a64[_0xd425('0x39')]({'plain':!![]});return db[_0xd425('0x71')]['find']({'where':{'name':_0xd425('0x3a'),'userProfileId':_0x376134[_0xd425('0x72')]},'raw':!![]})['then'](function(_0x2bb36f){if(_0x2bb36f&&_0x2bb36f[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x24af3[_0xd425('0x3d')],'resourceId':_0x24af3['id'],'type':_0x2bb36f[_0xd425('0x3d')],'sectionId':_0x2bb36f['id']},{})[_0xd425('0x21')](function(){return _0xcb1a64;});}else{return _0xcb1a64;}})[_0xd425('0x2b')](function(_0x572f23){logger[_0xd425('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x572f23);throw _0x572f23;});}return _0xcb1a64;})[_0xd425('0x21')](respondWithResult(_0x38a762,0xc9))[_0xd425('0x2b')](handleError(_0x38a762,null));};exports['update']=function(_0x2bf8e6,_0xcf7b51,_0x66d87b){var _0x1fc64d;return db['Trunk']['find']({'where':{'id':_0x2bf8e6[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0xcf7b51,null))[_0xd425('0x21')](saveUpdates(_0x2bf8e6['body'],null))[_0xd425('0x21')](function(_0xb1479e){if(_0xb1479e){_0x1fc64d=_0xb1479e;return db['Trunk'][_0xd425('0x57')]({'raw':!![]});}})['then'](function(_0x998ad1){if(_0x998ad1){var _0x46346c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config['root'],'server/files/templates/trunk.ejs'),_0xd425('0x68'));var _0x413a65=fs['readFileSync'](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x369f8b=ejs[_0xd425('0x6c')](_0x46346c,{'trunks':_0x998ad1||[]});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x369f8b);var _0xf251e6=ejs[_0xd425('0x6c')](_0x413a65,{'trunks':_0x998ad1||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0xf251e6);return respondWithRpcPromise(_0xd425('0x6f'),'update',{'module':_0xd425('0x70')});}return null;})[_0xd425('0x21')](function(_0x58cad5){if(_0x58cad5){return _0x1fc64d;}})[_0xd425('0x21')](respondWithResult(_0xcf7b51,null))[_0xd425('0x2b')](handleError(_0xcf7b51,null));};exports['destroy']=function(_0x592c40,_0x750685,_0x242ed8){var _0x16eac6;return db[_0xd425('0x41')][_0xd425('0x5c')]({'where':{'id':_0x592c40[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0x750685,null))[_0xd425('0x21')](removeEntity(_0x750685,null))['then'](function(){return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})['then'](function(_0x2bbcf3){var _0x1d386c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],_0xd425('0x67')),_0xd425('0x68'));var _0x2c3995=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x498e81=ejs['render'](_0x1d386c,{'trunks':_0x2bbcf3});var _0x2c8d63=ejs['render'](_0x2c3995,{'trunks':_0x2bbcf3});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x498e81);fs[_0xd425('0x6d')](_0xd425('0x6e'),_0x2c8d63);return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x74'),{'module':_0xd425('0x70')});})['catch'](handleError(_0x750685,null));}; \ No newline at end of file +var _0xedd9=['body','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','create','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trunk,\x20%s,\x20%s','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Trunk','findAll','rows','show','params','length','find','omit'];(function(_0x2737a3,_0x353aac){var _0x203100=function(_0x1e6bf8){while(--_0x1e6bf8){_0x2737a3['push'](_0x2737a3['shift']());}};_0x203100(++_0x353aac);}(_0xedd9,0xfc));var _0x9edd=function(_0x19e120,_0x5b1a0d){_0x19e120=_0x19e120-0x0;var _0x20c72e=_0xedd9[_0x19e120];return _0x20c72e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];var jayson=require(_0x9edd('0x18'));var client=jayson[_0x9edd('0x19')][_0x9edd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xfca576,_0xef5498,_0x47eb64,_0x176bfa){return new BPromise(function(_0x44fc7c,_0x891832){var _0x4d9a7=_0x176bfa||client;return _0x4d9a7[_0x9edd('0x1b')](_0xfca576,_0x47eb64)[_0x9edd('0x1c')](function(_0x1042aa){logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x9edd('0x1e'));logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0xef5498,'request\x20sent',JSON[_0x9edd('0x21')](_0x1042aa));if(_0x1042aa[_0x9edd('0x22')]){if(_0x1042aa[_0x9edd('0x22')]['code']===0x1f4){logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')][_0x9edd('0x23')]);return _0x891832(_0x1042aa['error']['message']);}logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')]['message']);return _0x44fc7c(_0x1042aa['error'][_0x9edd('0x23')]);}else{logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,'request\x20sent');_0x44fc7c(_0x1042aa[_0x9edd('0x24')][_0x9edd('0x23')]);}})[_0x9edd('0x25')](function(_0x542172){logger[_0x9edd('0x22')](_0x9edd('0x26'),_0xef5498,_0x542172);_0x891832(_0x542172);});});}function respondWithStatusCode(_0x44a6c1,_0x2ca65f){_0x2ca65f=_0x2ca65f||0xcc;return function(_0x339a0d){if(_0x339a0d){return _0x44a6c1['sendStatus'](_0x2ca65f);}return _0x44a6c1[_0x9edd('0x27')](_0x2ca65f)[_0x9edd('0x28')]();};}function respondWithResult(_0x3a1ea5,_0x2f9f86){_0x2f9f86=_0x2f9f86||0xc8;return function(_0x310a4d){if(_0x310a4d){return _0x3a1ea5['status'](_0x2f9f86)['json'](_0x310a4d);}};}function respondWithFilteredResult(_0x3276ee,_0xfeca7b){return function(_0x8d67aa){if(_0x8d67aa){var _0x25e135=typeof _0xfeca7b[_0x9edd('0x29')]==='undefined'&&typeof _0xfeca7b['limit']===_0x9edd('0x2a');var _0x257a26=_0x8d67aa[_0x9edd('0x2b')];var _0x52746a=_0x25e135?0x0:_0xfeca7b[_0x9edd('0x29')];var _0x28cfae=_0x25e135?_0x8d67aa[_0x9edd('0x2b')]:_0xfeca7b[_0x9edd('0x29')]+_0xfeca7b['limit'];var _0x2155a1;if(_0x28cfae>=_0x257a26){_0x28cfae=_0x257a26;_0x2155a1=0xc8;}else{_0x2155a1=0xce;}_0x3276ee[_0x9edd('0x27')](_0x2155a1);return _0x3276ee[_0x9edd('0x2c')](_0x9edd('0x2d'),_0x52746a+'-'+_0x28cfae+'/'+_0x257a26)[_0x9edd('0x2e')](_0x8d67aa);}return null;};}function patchUpdates(_0x42e664){return function(_0x209aba){try{jsonpatch[_0x9edd('0x2f')](_0x209aba,_0x42e664,!![]);}catch(_0x19b6c1){return BPromise[_0x9edd('0x30')](_0x19b6c1);}return _0x209aba[_0x9edd('0x31')]();};}function saveUpdates(_0x138002,_0x6907a5){return function(_0xa55906){if(_0xa55906){return _0xa55906[_0x9edd('0x32')](_0x138002)['then'](function(_0x1453d2){return _0x1453d2;});}return null;};}function removeEntity(_0x259259,_0x267c74){return function(_0x5d1707){if(_0x5d1707){return _0x5d1707[_0x9edd('0x33')]()[_0x9edd('0x1c')](function(){var _0xde9b13=_0x5d1707[_0x9edd('0x34')]({'plain':!![]});var _0x21bc30=_0x9edd('0x35');return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'type':_0x21bc30,'resourceId':_0xde9b13['id']}})[_0x9edd('0x1c')](function(){return _0x5d1707;});})[_0x9edd('0x1c')](function(){_0x259259[_0x9edd('0x27')](0xcc)[_0x9edd('0x28')]();});}};}function handleEntityNotFound(_0x27eb7e,_0x14f780){return function(_0x5757fc){if(!_0x5757fc){_0x27eb7e[_0x9edd('0x37')](0x194);}return _0x5757fc;};}function handleError(_0x5ed62d,_0x968303){_0x968303=_0x968303||0x1f4;return function(_0x148630){logger[_0x9edd('0x22')](_0x148630[_0x9edd('0x38')]);if(_0x148630[_0x9edd('0x39')]){delete _0x148630['name'];}_0x5ed62d[_0x9edd('0x27')](_0x968303)[_0x9edd('0x3a')](_0x148630);};}exports[_0x9edd('0x3b')]=function(_0x38e9be,_0x1be77f){var _0x337e6c={},_0x5c0627={},_0x1cbbac={'count':0x0,'rows':[]};var _0x1ccee8=_[_0x9edd('0x3c')](db['Trunk'][_0x9edd('0x3d')],function(_0x56a228){return{'name':_0x56a228[_0x9edd('0x3e')],'type':_0x56a228['type'][_0x9edd('0x3f')]};});_0x5c0627[_0x9edd('0x40')]=_[_0x9edd('0x3c')](_0x1ccee8,'name');_0x5c0627[_0x9edd('0x41')]=_[_0x9edd('0x42')](_0x38e9be[_0x9edd('0x41')]);_0x5c0627['filters']=_[_0x9edd('0x43')](_0x5c0627['model'],_0x5c0627[_0x9edd('0x41')]);_0x337e6c[_0x9edd('0x44')]=_['intersection'](_0x5c0627[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x45')]));_0x337e6c['attributes']=_0x337e6c[_0x9edd('0x44')]['length']?_0x337e6c[_0x9edd('0x44')]:_0x5c0627[_0x9edd('0x40')];if(!_0x38e9be['query'][_0x9edd('0x46')]('nolimit')){_0x337e6c['limit']=qs[_0x9edd('0x47')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x47')]);_0x337e6c[_0x9edd('0x29')]=qs[_0x9edd('0x29')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x29')]);}_0x337e6c[_0x9edd('0x48')]=qs[_0x9edd('0x49')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x49')]);_0x337e6c[_0x9edd('0x4a')]=qs[_0x9edd('0x4b')](_[_0x9edd('0x4c')](_0x38e9be[_0x9edd('0x41')],_0x5c0627['filters']),_0x1ccee8);if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x4d')]){_0x337e6c[_0x9edd('0x4a')]=_[_0x9edd('0x4e')](_0x337e6c[_0x9edd('0x4a')],{'$or':_[_0x9edd('0x3c')](_0x1ccee8,function(_0x10d41e){if(_0x10d41e['type']!=='VIRTUAL'){var _0x4bc7a1={};_0x4bc7a1[_0x10d41e[_0x9edd('0x39')]]={'$like':'%'+_0x38e9be['query'][_0x9edd('0x4d')]+'%'};return _0x4bc7a1;}})});}_0x337e6c=_[_0x9edd('0x4e')]({},_0x337e6c,_0x38e9be[_0x9edd('0x4f')]);var _0x8db801={'where':_0x337e6c[_0x9edd('0x4a')]};return db['Trunk'][_0x9edd('0x2b')](_0x8db801)[_0x9edd('0x1c')](function(_0x40e33d){_0x1cbbac['count']=_0x40e33d;if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x50')]){_0x337e6c[_0x9edd('0x51')]=[{'all':!![]}];}return db[_0x9edd('0x52')][_0x9edd('0x53')](_0x337e6c);})[_0x9edd('0x1c')](function(_0x4d4f33){_0x1cbbac[_0x9edd('0x54')]=_0x4d4f33;return _0x1cbbac;})[_0x9edd('0x1c')](respondWithFilteredResult(_0x1be77f,_0x337e6c))['catch'](handleError(_0x1be77f,null));};exports[_0x9edd('0x55')]=function(_0x8d8701,_0x4bb324){var _0x2bd089={'raw':![],'where':{'id':_0x8d8701[_0x9edd('0x56')]['id']}},_0x8134cd={};_0x8134cd['model']=_[_0x9edd('0x42')](db[_0x9edd('0x52')][_0x9edd('0x3d')]);_0x8134cd[_0x9edd('0x41')]=_['keys'](_0x8d8701[_0x9edd('0x41')]);_0x8134cd[_0x9edd('0x4b')]=_[_0x9edd('0x43')](_0x8134cd['model'],_0x8134cd[_0x9edd('0x41')]);_0x2bd089[_0x9edd('0x44')]=_['intersection'](_0x8134cd[_0x9edd('0x40')],qs['fields'](_0x8d8701[_0x9edd('0x41')][_0x9edd('0x45')]));_0x2bd089[_0x9edd('0x44')]=_0x2bd089[_0x9edd('0x44')][_0x9edd('0x57')]?_0x2bd089[_0x9edd('0x44')]:_0x8134cd[_0x9edd('0x40')];if(_0x8d8701[_0x9edd('0x41')][_0x9edd('0x50')]){_0x2bd089[_0x9edd('0x51')]=[{'all':!![]}];}_0x2bd089=_[_0x9edd('0x4e')]({},_0x2bd089,_0x8d8701['options']);return db[_0x9edd('0x52')][_0x9edd('0x58')](_0x2bd089)[_0x9edd('0x1c')](handleEntityNotFound(_0x4bb324,null))['then'](respondWithResult(_0x4bb324,null))[_0x9edd('0x25')](handleError(_0x4bb324,null));};exports['clone']=function(_0x54d83d,_0x54ecfa){var _0x1348a7={'where':{'id':_0x54d83d[_0x9edd('0x56')]['id']}},_0x45f47c={};_0x45f47c[_0x9edd('0x40')]=_['keys'](db['Trunk']['rawAttributes']);_0x1348a7[_0x9edd('0x44')]=_[_0x9edd('0x43')](_0x45f47c[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x54d83d[_0x9edd('0x41')][_0x9edd('0x45')]));_0x1348a7[_0x9edd('0x44')]=_0x1348a7[_0x9edd('0x44')]['length']?_0x1348a7[_0x9edd('0x44')]:_0x45f47c['model'];if(_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]){_0x1348a7['include']=[{'all':!![]}];}_0x1348a7=_[_0x9edd('0x4e')]({},_0x1348a7,_0x54d83d[_0x9edd('0x4f')]);return db[_0x9edd('0x52')]['find'](_0x1348a7)[_0x9edd('0x1c')](handleEntityNotFound(_0x54ecfa,null))[_0x9edd('0x1c')](function(_0x430eb4){if(_0x430eb4){var _0x15ebfa=_0x430eb4[_0x9edd('0x34')]({'plain':!![]});_0x15ebfa=qs[_0x9edd('0x59')](_0x15ebfa,['id','createdAt','updatedAt']);_0x54d83d[_0x9edd('0x5a')]=_['omit'](_0x54d83d[_0x9edd('0x5a')],['id',_0x9edd('0x5b'),_0x9edd('0x5c')]);return db[_0x9edd('0x52')]['create'](_[_0x9edd('0x4e')](_0x15ebfa,_0x54d83d['body']),{'include':_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]?[{'all':!![]}]:undefined})[_0x9edd('0x1c')](function(_0x5ca123){var _0x2651a2=_0x54d83d['user'][_0x9edd('0x34')]({'plain':!![]});if(!_0x2651a2)throw new Error(_0x9edd('0x5d'));if(_0x2651a2['role']===_0x9edd('0x5e')){var _0x4a72d0=_0x5ca123[_0x9edd('0x34')]({'plain':!![]});var _0x134c9c=_0x9edd('0x35');return db['UserProfileSection'][_0x9edd('0x58')]({'where':{'name':_0x134c9c,'userProfileId':_0x2651a2[_0x9edd('0x5f')]},'raw':!![]})[_0x9edd('0x1c')](function(_0x2015fc){if(_0x2015fc&&_0x2015fc[_0x9edd('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a72d0[_0x9edd('0x39')],'resourceId':_0x4a72d0['id'],'type':_0x2015fc[_0x9edd('0x39')],'sectionId':_0x2015fc['id']},{})['then'](function(){return _0x5ca123;});}else{return _0x5ca123;}})['catch'](function(_0x52afd7){logger[_0x9edd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52afd7);throw _0x52afd7;});}return _0x5ca123;});}})['then'](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x25')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x61')]=function(_0x589348,_0xb9ebeb,_0x11e082){var _0x34dff5;return db['Trunk'][_0x9edd('0x61')](_0x589348['body'],{'raw':!![]})[_0x9edd('0x1c')](function(_0x18d1a0){_0x34dff5=_0x18d1a0;return db['Trunk'][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x5c1746){var _0x2bd6d1=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/trunk.ejs'),_0x9edd('0x65'));var _0x58330c=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/registry.ejs'),_0x9edd('0x65'));var _0x286593=ejs[_0x9edd('0x66')](_0x2bd6d1,{'trunks':_0x5c1746||[]});fs[_0x9edd('0x67')](_0x9edd('0x68'),_0x286593);if(_0x34dff5[_0x9edd('0x69')]){var _0x3fa4a9=ejs['render'](_0x58330c,{'trunks':_0x5c1746||[]});fs['writeFileSync'](_0x9edd('0x6a'),_0x3fa4a9);}})[_0x9edd('0x1c')](function(){return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x61'),{'module':_0x9edd('0x6c')});})['then'](function(){var _0x2e40c8=_0x589348[_0x9edd('0x5e')][_0x9edd('0x34')]({'plain':!![]});if(!_0x2e40c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e40c8[_0x9edd('0x6d')]===_0x9edd('0x5e')){var _0x4b1c12=_0x34dff5[_0x9edd('0x34')]({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'name':_0x9edd('0x35'),'userProfileId':_0x2e40c8[_0x9edd('0x5f')]},'raw':!![]})['then'](function(_0x3f08ac){if(_0x3f08ac&&_0x3f08ac['autoAssociation']===0x0){return db['UserProfileResource'][_0x9edd('0x61')]({'name':_0x4b1c12[_0x9edd('0x39')],'resourceId':_0x4b1c12['id'],'type':_0x3f08ac[_0x9edd('0x39')],'sectionId':_0x3f08ac['id']},{})['then'](function(){return _0x34dff5;});}else{return _0x34dff5;}})[_0x9edd('0x25')](function(_0x286e47){logger['error'](_0x9edd('0x6f'),_0x286e47);throw _0x286e47;});}return _0x34dff5;})[_0x9edd('0x1c')](respondWithResult(_0xb9ebeb,0xc9))[_0x9edd('0x25')](handleError(_0xb9ebeb,null));};exports[_0x9edd('0x32')]=function(_0x54ac71,_0x5e68db,_0x1129b7){var _0x5bb28c;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x54ac71[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x5e68db,null))[_0x9edd('0x1c')](saveUpdates(_0x54ac71[_0x9edd('0x5a')],null))[_0x9edd('0x1c')](function(_0x5a4d4b){if(_0x5a4d4b){_0x5bb28c=_0x5a4d4b;return db[_0x9edd('0x52')]['findAll']({'raw':!![]});}})[_0x9edd('0x1c')](function(_0x3c4db7){if(_0x3c4db7){var _0x2c7562=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),'utf8');var _0x25e3e7=fs[_0x9edd('0x62')](path['join'](config[_0x9edd('0x64')],_0x9edd('0x71')),'utf8');var _0x304e56=ejs[_0x9edd('0x66')](_0x2c7562,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x304e56);var _0x41cd76=ejs[_0x9edd('0x66')](_0x25e3e7,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x41cd76);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}return null;})[_0x9edd('0x1c')](function(_0x1a6d3d){if(_0x1a6d3d){return _0x5bb28c;}})[_0x9edd('0x1c')](respondWithResult(_0x5e68db,null))['catch'](handleError(_0x5e68db,null));};exports['destroy']=function(_0x49dc1d,_0x56d794,_0x388252){var _0x20762d;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x49dc1d[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x56d794,null))[_0x9edd('0x1c')](removeEntity(_0x56d794,null))[_0x9edd('0x1c')](function(){return db[_0x9edd('0x52')][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x4cfa99){var _0x367fc6=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),_0x9edd('0x65'));var _0x3d4890=fs[_0x9edd('0x62')](path['join'](config['root'],_0x9edd('0x71')),'utf8');var _0x35950b=ejs['render'](_0x367fc6,{'trunks':_0x4cfa99});var _0x21c35f=ejs[_0x9edd('0x66')](_0x3d4890,{'trunks':_0x4cfa99});fs['writeFileSync'](_0x9edd('0x68'),_0x35950b);fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x21c35f);return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x33'),{'module':_0x9edd('0x6c')});})[_0x9edd('0x25')](handleError(_0x56d794,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index bc0aa0e..3c78ceb 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 _0x0ec3=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports'];(function(_0xcd385f,_0x237ac1){var _0x2f4d33=function(_0x28ede8){while(--_0x28ede8){_0xcd385f['push'](_0xcd385f['shift']());}};_0x2f4d33(++_0x237ac1);}(_0x0ec3,0xde));var _0x30ec=function(_0x4aca60,_0x1b82e6){_0x4aca60=_0x4aca60-0x0;var _0x443a84=_0x0ec3[_0x4aca60];return _0x443a84;};'use strict';var _=require(_0x30ec('0x0'));var util=require(_0x30ec('0x1'));var logger=require(_0x30ec('0x2'))(_0x30ec('0x3'));var moment=require(_0x30ec('0x4'));var BPromise=require(_0x30ec('0x5'));var rp=require(_0x30ec('0x6'));var fs=require('fs');var path=require(_0x30ec('0x7'));var rimraf=require(_0x30ec('0x8'));var config=require(_0x30ec('0x9'));var attributes=require(_0x30ec('0xa'));module[_0x30ec('0xb')]=function(_0x26f457,_0x4f42d7){return _0x26f457[_0x30ec('0xc')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3683=['tools_trunks','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports'];(function(_0x3af0c4,_0x138d21){var _0x3aca04=function(_0x300309){while(--_0x300309){_0x3af0c4['push'](_0x3af0c4['shift']());}};_0x3aca04(++_0x138d21);}(_0x3683,0x1e5));var _0x3368=function(_0x4d1f80,_0x3fc424){_0x4d1f80=_0x4d1f80-0x0;var _0x2190b9=_0x3683[_0x4d1f80];return _0x2190b9;};'use strict';var _=require(_0x3368('0x0'));var util=require(_0x3368('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3368('0x2'));var BPromise=require(_0x3368('0x3'));var rp=require(_0x3368('0x4'));var fs=require('fs');var path=require(_0x3368('0x5'));var rimraf=require(_0x3368('0x6'));var config=require(_0x3368('0x7'));var attributes=require(_0x3368('0x8'));module[_0x3368('0x9')]=function(_0x378cf7,_0x34ea38){return _0x378cf7['define']('Trunk',attributes,{'tableName':_0x3368('0xa'),'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 aa20b21..837ce66 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 _0xc381=['GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowTrunk','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x46c5ec,_0x270606){var _0x3d29f1=function(_0x37420c){while(--_0x37420c){_0x46c5ec['push'](_0x46c5ec['shift']());}};_0x3d29f1(++_0x270606);}(_0xc381,0x1b1));var _0x1c38=function(_0x2be726,_0x39922c){_0x2be726=_0x2be726-0x0;var _0x4b37ac=_0xc381[_0x2be726];return _0x4b37ac;};'use strict';var _=require(_0x1c38('0x0'));var util=require(_0x1c38('0x1'));var moment=require(_0x1c38('0x2'));var BPromise=require('bluebird');var rs=require(_0x1c38('0x3'));var fs=require('fs');var Redis=require(_0x1c38('0x4'));var db=require(_0x1c38('0x5'))['db'];var utils=require(_0x1c38('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1c38('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1c38('0x8')][_0x1c38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f5f11,_0x1e03cb,_0x37943f){return new BPromise(function(_0x3d3f7a,_0x2305d0){return client[_0x1c38('0xa')](_0x2f5f11,_0x37943f)[_0x1c38('0xb')](function(_0x513b63){logger[_0x1c38('0xc')](_0x1c38('0xd'),_0x1e03cb,_0x1c38('0xe'));logger[_0x1c38('0xf')](_0x1c38('0x10'),_0x1e03cb,_0x1c38('0xe'),JSON[_0x1c38('0x11')](_0x513b63));if(_0x513b63[_0x1c38('0x12')]){if(_0x513b63[_0x1c38('0x12')]['code']===0x1f4){logger[_0x1c38('0x12')]('Trunk,\x20%s,\x20%s',_0x1e03cb,_0x513b63[_0x1c38('0x12')]['message']);return _0x2305d0(_0x513b63['error'][_0x1c38('0x13')]);}logger[_0x1c38('0x12')](_0x1c38('0xd'),_0x1e03cb,_0x513b63[_0x1c38('0x12')]['message']);return _0x3d3f7a(_0x513b63[_0x1c38('0x12')]['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x1e03cb,_0x1c38('0xe'));_0x3d3f7a(_0x513b63[_0x1c38('0x14')][_0x1c38('0x13')]);}})[_0x1c38('0x15')](function(_0xdd0507){logger[_0x1c38('0x12')](_0x1c38('0xd'),_0x1e03cb,_0xdd0507);_0x2305d0(_0xdd0507);});});}exports[_0x1c38('0x16')]=function(_0x290594){var _0x4206d9=this;return new Promise(function(_0x215eb7,_0x4b2138){return db[_0x1c38('0x17')][_0x1c38('0x18')]({'raw':_0x290594[_0x1c38('0x19')]?_0x290594['options'][_0x1c38('0x1a')]===undefined?!![]:![]:!![],'where':_0x290594[_0x1c38('0x19')]?_0x290594[_0x1c38('0x19')][_0x1c38('0x1b')]||null:null,'attributes':_0x290594[_0x1c38('0x19')]?_0x290594['options'][_0x1c38('0x1c')]||null:null,'limit':_0x290594['options']?_0x290594['options'][_0x1c38('0x1d')]||null:null,'include':_0x290594[_0x1c38('0x19')]?_0x290594[_0x1c38('0x19')][_0x1c38('0x1e')]?_[_0x1c38('0x1f')](_0x290594[_0x1c38('0x19')]['include'],function(_0x5d7568){return{'model':db[_0x5d7568[_0x1c38('0x20')]],'as':_0x5d7568['as'],'attributes':_0x5d7568[_0x1c38('0x1c')],'include':_0x5d7568[_0x1c38('0x1e')]?_[_0x1c38('0x1f')](_0x5d7568[_0x1c38('0x1e')],function(_0x14db64){return{'model':db[_0x14db64['model']],'as':_0x14db64['as'],'attributes':_0x14db64[_0x1c38('0x1c')],'include':_0x14db64[_0x1c38('0x1e')]?_[_0x1c38('0x1f')](_0x14db64[_0x1c38('0x1e')],function(_0x5bc86a){return{'model':db[_0x5bc86a[_0x1c38('0x20')]],'as':_0x5bc86a['as'],'attributes':_0x5bc86a[_0x1c38('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35a111){logger['info'](_0x1c38('0x16'),_0x290594);logger[_0x1c38('0xf')](_0x1c38('0x16'),_0x290594,JSON['stringify'](_0x35a111));_0x215eb7(_0x35a111);})[_0x1c38('0x15')](function(_0xc204f8){logger['error'](_0x1c38('0x16'),_0xc204f8[_0x1c38('0x13')],_0x290594);_0x4b2138(_0x4206d9[_0x1c38('0x12')](0x1f4,_0xc204f8[_0x1c38('0x13')]));});});};exports['ShowTrunk']=function(_0x2bc953){var _0x49fa07=this;return new Promise(function(_0x11021f,_0x4b6b77){return db['Trunk'][_0x1c38('0x21')]({'raw':_0x2bc953[_0x1c38('0x19')]?_0x2bc953[_0x1c38('0x19')][_0x1c38('0x1a')]===undefined?!![]:![]:!![],'where':_0x2bc953[_0x1c38('0x19')]?_0x2bc953[_0x1c38('0x19')]['where']||null:null,'attributes':_0x2bc953[_0x1c38('0x19')]?_0x2bc953[_0x1c38('0x19')]['attributes']||null:null,'include':_0x2bc953['options']?_0x2bc953[_0x1c38('0x19')]['include']?_[_0x1c38('0x1f')](_0x2bc953['options'][_0x1c38('0x1e')],function(_0x97af0b){return{'model':db[_0x97af0b[_0x1c38('0x20')]],'as':_0x97af0b['as'],'attributes':_0x97af0b[_0x1c38('0x1c')],'include':_0x97af0b[_0x1c38('0x1e')]?_[_0x1c38('0x1f')](_0x97af0b[_0x1c38('0x1e')],function(_0x342364){return{'model':db[_0x342364[_0x1c38('0x20')]],'as':_0x342364['as'],'attributes':_0x342364[_0x1c38('0x1c')],'include':_0x342364[_0x1c38('0x1e')]?_[_0x1c38('0x1f')](_0x342364[_0x1c38('0x1e')],function(_0x526286){return{'model':db[_0x526286[_0x1c38('0x20')]],'as':_0x526286['as'],'attributes':_0x526286[_0x1c38('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1c38('0xb')](function(_0xd40b5e){logger[_0x1c38('0xc')]('ShowTrunk',_0x2bc953);logger[_0x1c38('0xf')](_0x1c38('0x22'),_0x2bc953,JSON[_0x1c38('0x11')](_0xd40b5e));_0x11021f(_0xd40b5e);})[_0x1c38('0x15')](function(_0x11a0d4){logger[_0x1c38('0x12')](_0x1c38('0x22'),_0x11a0d4[_0x1c38('0x13')],_0x2bc953);_0x4b6b77(_0x49fa07[_0x1c38('0x12')](0x1f4,_0x11a0d4[_0x1c38('0x13')]));});});}; \ No newline at end of file +var _0x39a8=['../../config/utils','../../config/logger','jayson/promise','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','limit','include','model','attributes','map','ShowTrunk','find','debug','stringify','lodash','util','randomstring','ioredis'];(function(_0x300860,_0x509371){var _0x2094ad=function(_0x2090a2){while(--_0x2090a2){_0x300860['push'](_0x300860['shift']());}};_0x2094ad(++_0x509371);}(_0x39a8,0x13c));var _0x839a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x39a8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x839a('0x0'));var util=require(_0x839a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x839a('0x2'));var fs=require('fs');var Redis=require(_0x839a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x839a('0x4'));var logger=require(_0x839a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x839a('0x6'));var client=jayson['client'][_0x839a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x20a779,_0x4eba4c,_0x1a9a6a){return new BPromise(function(_0x5fcd6,_0x51ae2a){return client['request'](_0x20a779,_0x1a9a6a)[_0x839a('0x8')](function(_0x386f2b){logger[_0x839a('0x9')](_0x839a('0xa'),_0x4eba4c,_0x839a('0xb'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x4eba4c,_0x839a('0xb'),JSON['stringify'](_0x386f2b));if(_0x386f2b['error']){if(_0x386f2b[_0x839a('0xc')][_0x839a('0xd')]===0x1f4){logger[_0x839a('0xc')](_0x839a('0xa'),_0x4eba4c,_0x386f2b[_0x839a('0xc')][_0x839a('0xe')]);return _0x51ae2a(_0x386f2b[_0x839a('0xc')][_0x839a('0xe')]);}logger['error'](_0x839a('0xa'),_0x4eba4c,_0x386f2b['error'][_0x839a('0xe')]);return _0x5fcd6(_0x386f2b['error'][_0x839a('0xe')]);}else{logger[_0x839a('0x9')](_0x839a('0xa'),_0x4eba4c,_0x839a('0xb'));_0x5fcd6(_0x386f2b[_0x839a('0xf')][_0x839a('0xe')]);}})[_0x839a('0x10')](function(_0x5b3cea){logger[_0x839a('0xc')]('Trunk,\x20%s,\x20%s',_0x4eba4c,_0x5b3cea);_0x51ae2a(_0x5b3cea);});});}exports[_0x839a('0x11')]=function(_0x160ef0){var _0x2239d4=this;return new Promise(function(_0x514af1,_0x1117db){return db[_0x839a('0x12')][_0x839a('0x13')]({'raw':_0x160ef0[_0x839a('0x14')]?_0x160ef0['options'][_0x839a('0x15')]===undefined?!![]:![]:!![],'where':_0x160ef0[_0x839a('0x14')]?_0x160ef0['options'][_0x839a('0x16')]||null:null,'attributes':_0x160ef0['options']?_0x160ef0[_0x839a('0x14')]['attributes']||null:null,'limit':_0x160ef0['options']?_0x160ef0[_0x839a('0x14')][_0x839a('0x17')]||null:null,'include':_0x160ef0[_0x839a('0x14')]?_0x160ef0[_0x839a('0x14')][_0x839a('0x18')]?_['map'](_0x160ef0[_0x839a('0x14')][_0x839a('0x18')],function(_0x56c682){return{'model':db[_0x56c682[_0x839a('0x19')]],'as':_0x56c682['as'],'attributes':_0x56c682[_0x839a('0x1a')],'include':_0x56c682['include']?_[_0x839a('0x1b')](_0x56c682[_0x839a('0x18')],function(_0x98a287){return{'model':db[_0x98a287[_0x839a('0x19')]],'as':_0x98a287['as'],'attributes':_0x98a287['attributes'],'include':_0x98a287[_0x839a('0x18')]?_[_0x839a('0x1b')](_0x98a287[_0x839a('0x18')],function(_0x846382){return{'model':db[_0x846382['model']],'as':_0x846382['as'],'attributes':_0x846382[_0x839a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x839a('0x8')](function(_0x290e7d){logger['info']('GetTrunk',_0x160ef0);logger['debug'](_0x839a('0x11'),_0x160ef0,JSON['stringify'](_0x290e7d));_0x514af1(_0x290e7d);})[_0x839a('0x10')](function(_0x366d14){logger[_0x839a('0xc')](_0x839a('0x11'),_0x366d14[_0x839a('0xe')],_0x160ef0);_0x1117db(_0x2239d4[_0x839a('0xc')](0x1f4,_0x366d14['message']));});});};exports[_0x839a('0x1c')]=function(_0xeb9d64){var _0x5aebcc=this;return new Promise(function(_0x1cfe62,_0x157d20){return db[_0x839a('0x12')][_0x839a('0x1d')]({'raw':_0xeb9d64[_0x839a('0x14')]?_0xeb9d64['options'][_0x839a('0x15')]===undefined?!![]:![]:!![],'where':_0xeb9d64[_0x839a('0x14')]?_0xeb9d64[_0x839a('0x14')][_0x839a('0x16')]||null:null,'attributes':_0xeb9d64[_0x839a('0x14')]?_0xeb9d64[_0x839a('0x14')][_0x839a('0x1a')]||null:null,'include':_0xeb9d64[_0x839a('0x14')]?_0xeb9d64['options']['include']?_[_0x839a('0x1b')](_0xeb9d64['options'][_0x839a('0x18')],function(_0x2df69a){return{'model':db[_0x2df69a['model']],'as':_0x2df69a['as'],'attributes':_0x2df69a[_0x839a('0x1a')],'include':_0x2df69a[_0x839a('0x18')]?_[_0x839a('0x1b')](_0x2df69a[_0x839a('0x18')],function(_0x210268){return{'model':db[_0x210268[_0x839a('0x19')]],'as':_0x210268['as'],'attributes':_0x210268[_0x839a('0x1a')],'include':_0x210268[_0x839a('0x18')]?_[_0x839a('0x1b')](_0x210268[_0x839a('0x18')],function(_0x34f1c6){return{'model':db[_0x34f1c6['model']],'as':_0x34f1c6['as'],'attributes':_0x34f1c6[_0x839a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x839a('0x8')](function(_0x2874d0){logger[_0x839a('0x9')](_0x839a('0x1c'),_0xeb9d64);logger[_0x839a('0x1e')]('ShowTrunk',_0xeb9d64,JSON[_0x839a('0x1f')](_0x2874d0));_0x1cfe62(_0x2874d0);})[_0x839a('0x10')](function(_0x423399){logger[_0x839a('0xc')](_0x839a('0x1c'),_0x423399[_0x839a('0xe')],_0xeb9d64);_0x157d20(_0x5aebcc['error'](0x1f4,_0x423399[_0x839a('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index f112496..49e60f2 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 _0xcbc7=['Router','../../components/auth/service','put','isAuthenticated','update','exports','express'];(function(_0x30d9e1,_0x22e0c0){var _0x4d7ca1=function(_0x2c10ae){while(--_0x2c10ae){_0x30d9e1['push'](_0x30d9e1['shift']());}};_0x4d7ca1(++_0x22e0c0);}(_0xcbc7,0x99));var _0x7cbc=function(_0x336f33,_0x43cc91){_0x336f33=_0x336f33-0x0;var _0x3ea123=_0xcbc7[_0x336f33];return _0x3ea123;};'use strict';var express=require(_0x7cbc('0x0'));var router=express[_0x7cbc('0x1')]();var auth=require(_0x7cbc('0x2'));var controller=require('./user-setting.controller');router[_0x7cbc('0x3')]('/:id',auth[_0x7cbc('0x4')](),controller[_0x7cbc('0x5')]);module[_0x7cbc('0x6')]=router; \ No newline at end of file +var _0xe1d4=['isAuthenticated','update','exports','express','./user-setting.controller','/:id'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0xe1d4,0x1cb));var _0x4e1d=function(_0x260987,_0x2b2ca0){_0x260987=_0x260987-0x0;var _0x2b71b7=_0xe1d4[_0x260987];return _0x2b71b7;};'use strict';var express=require(_0x4e1d('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x4e1d('0x1'));router['put'](_0x4e1d('0x2'),auth[_0x4e1d('0x3')](),controller[_0x4e1d('0x4')]);module[_0x4e1d('0x5')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 5058083..64bc7c3 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 _0xa9e0=['exports','BOOLEAN','DATE','sequelize','error','warning'];(function(_0x25eb95,_0x200210){var _0x1d8fe5=function(_0x2f3c9e){while(--_0x2f3c9e){_0x25eb95['push'](_0x25eb95['shift']());}};_0x1d8fe5(++_0x200210);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var Sequelize=require(_0x0a9e('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x0a9e('0x1'),_0x0a9e('0x2'),'info','debug'];module[_0x0a9e('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0a9e('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xa9e0=['exports','BOOLEAN','DATE','sequelize','error','warning'];(function(_0x399abf,_0x5487af){var _0x329dfc=function(_0x25937a){while(--_0x25937a){_0x399abf['push'](_0x399abf['shift']());}};_0x329dfc(++_0x5487af);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var Sequelize=require(_0x0a9e('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x0a9e('0x1'),_0x0a9e('0x2'),'info','debug'];module[_0x0a9e('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0a9e('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':!![],'defaultValue':null}}; \ 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 db39e40..3ba15ba 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 _0xd847=['./user-setting.socket','register','status','json','update','sendStatus','error','stack','name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','then','catch','lodash','ioredis','../../config/logger','api','socket.io-emitter','redis'];(function(_0x1d4ff6,_0x43a375){var _0x4a76db=function(_0x544e03){while(--_0x544e03){_0x1d4ff6['push'](_0x1d4ff6['shift']());}};_0x4a76db(++_0x43a375);}(_0xd847,0x18a));var _0x7d84=function(_0x551f60,_0x33d5eb){_0x551f60=_0x551f60-0x0;var _0x2a1cda=_0xd847[_0x551f60];return _0x2a1cda;};'use strict';var _=require(_0x7d84('0x0'));var Redis=require(_0x7d84('0x1'));var logger=require(_0x7d84('0x2'))(_0x7d84('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x7d84('0x4'))(new Redis(config[_0x7d84('0x5')]));require(_0x7d84('0x6'))[_0x7d84('0x7')](socket);config[_0x7d84('0x5')]=_['defaults'](config[_0x7d84('0x5')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x3c57cd,_0x20ce63){_0x20ce63=_0x20ce63||0xc8;return function(_0x1d6297){if(_0x1d6297){return _0x3c57cd[_0x7d84('0x8')](_0x20ce63)[_0x7d84('0x9')](_0x1d6297);}};}function saveUpdates(_0x31ec83){return function(_0x5d7fda){if(_0x5d7fda){return _0x5d7fda[_0x7d84('0xa')](_0x31ec83)['then'](function(_0x4a9dc7){return _0x4a9dc7;});}return null;};}function handleEntityNotFound(_0x11c4ec){return function(_0x2156a9){if(!_0x2156a9){_0x11c4ec[_0x7d84('0xb')](0x194);}return _0x2156a9;};}function handleError(_0x27aa7a,_0x45261e){_0x45261e=_0x45261e||0x1f4;return function(_0x2a0e6d){logger[_0x7d84('0xc')](_0x2a0e6d[_0x7d84('0xd')]);if(_0x2a0e6d[_0x7d84('0xe')]){delete _0x2a0e6d[_0x7d84('0xe')];}_0x27aa7a[_0x7d84('0x8')](_0x45261e)[_0x7d84('0xf')](_0x2a0e6d);};}exports[_0x7d84('0xa')]=function(_0x245dd6,_0xc47a80){if(_0x245dd6[_0x7d84('0x10')][_0x7d84('0x11')]!==_0x7d84('0x12'))throw new Error(_0x7d84('0x13'));if(isNaN(Number(_0x245dd6[_0x7d84('0x14')]['id'])))throw new Error(_0x7d84('0x15'));return db['UserSetting'][_0x7d84('0x16')]({'where':{'id':_0x245dd6[_0x7d84('0x14')]['id']}})['then'](handleEntityNotFound(_0xc47a80,null))['then'](saveUpdates(_0x245dd6['body'],null))[_0x7d84('0x17')](respondWithResult(_0xc47a80,null))[_0x7d84('0x18')](handleError(_0xc47a80,null));}; \ No newline at end of file +var _0x1cc7=['name','send','user','role','admin','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','lodash','ioredis','../../config/logger','socket.io-emitter','redis','./user-setting.socket','status','json','update','then','stack'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x1cc7,0x15a));var _0x71cc=function(_0x4c5745,_0x10f994){_0x4c5745=_0x4c5745-0x0;var _0x553312=_0x1cc7[_0x4c5745];return _0x553312;};'use strict';var _=require(_0x71cc('0x0'));var Redis=require(_0x71cc('0x1'));var logger=require(_0x71cc('0x2'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x71cc('0x3'))(new Redis(config[_0x71cc('0x4')]));require(_0x71cc('0x5'))['register'](socket);config['redis']=_['defaults'](config[_0x71cc('0x4')],{'host':'localhost','port':0x18eb});function respondWithResult(_0xc0444e,_0x41a004){_0x41a004=_0x41a004||0xc8;return function(_0x4039ce){if(_0x4039ce){return _0xc0444e[_0x71cc('0x6')](_0x41a004)[_0x71cc('0x7')](_0x4039ce);}};}function saveUpdates(_0x5a8bc6){return function(_0x1e2781){if(_0x1e2781){return _0x1e2781[_0x71cc('0x8')](_0x5a8bc6)[_0x71cc('0x9')](function(_0x5ae8e7){return _0x5ae8e7;});}return null;};}function handleEntityNotFound(_0x554044){return function(_0x50a7b7){if(!_0x50a7b7){_0x554044['sendStatus'](0x194);}return _0x50a7b7;};}function handleError(_0xeb4747,_0x2db190){_0x2db190=_0x2db190||0x1f4;return function(_0x37e34b){logger['error'](_0x37e34b[_0x71cc('0xa')]);if(_0x37e34b['name']){delete _0x37e34b[_0x71cc('0xb')];}_0xeb4747['status'](_0x2db190)[_0x71cc('0xc')](_0x37e34b);};}exports['update']=function(_0x13625b,_0x1f478c){if(_0x13625b[_0x71cc('0xd')][_0x71cc('0xe')]!==_0x71cc('0xf'))throw new Error('Unauthorized');if(isNaN(Number(_0x13625b[_0x71cc('0x10')]['id'])))throw new Error(_0x71cc('0x11'));return db[_0x71cc('0x12')][_0x71cc('0x13')]({'where':{'id':_0x13625b[_0x71cc('0x10')]['id']}})[_0x71cc('0x9')](handleEntityNotFound(_0x1f478c,null))[_0x71cc('0x9')](saveUpdates(_0x13625b['body'],null))[_0x71cc('0x9')](respondWithResult(_0x1f478c,null))[_0x71cc('0x14')](handleError(_0x1f478c,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 97e72cc..a33d87d 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 _0x03e1=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x03e1,0x14b));var _0x103e=function(_0x443928,_0x4f001c){_0x443928=_0x443928-0x0;var _0x311e41=_0x03e1[_0x443928];return _0x311e41;};'use strict';var EventEmitter=require(_0x103e('0x0'));var UserSetting=require(_0x103e('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x103e('0x2'),'afterUpdate':_0x103e('0x3'),'afterDestroy':_0x103e('0x4')};function emitEvent(_0xa3f9a8){return function(_0xed3a6d,_0x17e0d6,_0x2b54b7){UserSettingEvents[_0x103e('0x5')](_0xa3f9a8+':'+_0xed3a6d['id'],_0xed3a6d);UserSettingEvents[_0x103e('0x5')](_0xa3f9a8,_0xed3a6d);_0x2b54b7(null);};}for(var e in events){if(events[_0x103e('0x6')](e)){var event=events[e];UserSetting[_0x103e('0x7')](e,emitEvent(event));}}module[_0x103e('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x0726=['hasOwnProperty','exports','events','../../mysqldb','UserSetting','setMaxListeners','update','remove','emit'];(function(_0x48cf09,_0x3b5f6c){var _0x203b57=function(_0x359da1){while(--_0x359da1){_0x48cf09['push'](_0x48cf09['shift']());}};_0x203b57(++_0x3b5f6c);}(_0x0726,0x110));var _0x6072=function(_0x3818cd,_0x2722ae){_0x3818cd=_0x3818cd-0x0;var _0x369053=_0x0726[_0x3818cd];return _0x369053;};'use strict';var EventEmitter=require(_0x6072('0x0'));var UserSetting=require(_0x6072('0x1'))['db'][_0x6072('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x6072('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6072('0x4'),'afterDestroy':_0x6072('0x5')};function emitEvent(_0x314e5c){return function(_0x367188,_0x41fe8d,_0x3c41cc){UserSettingEvents['emit'](_0x314e5c+':'+_0x367188['id'],_0x367188);UserSettingEvents[_0x6072('0x6')](_0x314e5c,_0x367188);_0x3c41cc(null);};}for(var e in events){if(events[_0x6072('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x6072('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 076242a..441bb79 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 _0x74f0=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','exports','UserSetting'];(function(_0x5c5ab6,_0x1e8e2e){var _0x210564=function(_0x10c565){while(--_0x10c565){_0x5c5ab6['push'](_0x5c5ab6['shift']());}};_0x210564(++_0x1e8e2e);}(_0x74f0,0xf3));var _0x074f=function(_0x24679e,_0x22d9d7){_0x24679e=_0x24679e-0x0;var _0x291f21=_0x74f0[_0x24679e];return _0x291f21;};'use strict';var attributes=require('./user-setting.attributes');module[_0x074f('0x0')]=function(_0x57b681){return _0x57b681['define'](_0x074f('0x1'),attributes,{'tableName':_0x074f('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15ae79){if(!_0x15ae79[_0x074f('0x3')])_0x15ae79['clientSideLoggingEnabledSince']=null;else if(_0x15ae79['clientSideLoggingEnabledSince']===null)_0x15ae79[_0x074f('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x9ffd=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','UserSetting','user_settings'];(function(_0x46044b,_0x48c143){var _0x212749=function(_0x101929){while(--_0x101929){_0x46044b['push'](_0x46044b['shift']());}};_0x212749(++_0x48c143);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x74ccbd,_0x12368f){_0x74ccbd=_0x74ccbd-0x0;var _0x1bd8a1=_0x9ffd[_0x74ccbd];return _0x1bd8a1;};'use strict';var attributes=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]=function(_0x47e5c0){return _0x47e5c0['define'](_0xd9ff('0x2'),attributes,{'tableName':_0xd9ff('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x26dc20){if(!_0x26dc20[_0xd9ff('0x4')])_0x26dc20['clientSideLoggingEnabledSince']=null;else if(_0x26dc20[_0xd9ff('0x5')]===null)_0x26dc20[_0xd9ff('0x5')]=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 09469e2..55f4dcb 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 _0x72ec=['emit','user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','save','remove','update'];(function(_0x30500b,_0x41a17e){var _0x35f252=function(_0x6d2bd3){while(--_0x6d2bd3){_0x30500b['push'](_0x30500b['shift']());}};_0x35f252(++_0x41a17e);}(_0x72ec,0x1dd));var _0xc72e=function(_0x47794f,_0x12c9b3){_0x47794f=_0x47794f-0x0;var _0x2ca51d=_0x72ec[_0x47794f];return _0x2ca51d;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xc72e('0x0'),_0xc72e('0x1'),_0xc72e('0x2')];function createListener(_0x5c6918,_0x50503d){return function(_0x1eb842){_0x50503d[_0xc72e('0x3')](_0x5c6918,_0x1eb842);if(_0x5c6918===_0xc72e('0x4')){_0x50503d[_0xc72e('0x3')](_0xc72e('0x5')+_0x1eb842[_0xc72e('0x6')],_0x1eb842);}};}exports[_0xc72e('0x7')]=function(_0x1765ea){for(var _0x301014=0x0,_0x57968e=events[_0xc72e('0x8')];_0x301014<_0x57968e;_0x301014++){var _0x11b268=events[_0x301014];var _0x44ec43=createListener(_0xc72e('0x9')+_0x11b268,_0x1765ea);UserSettingEvents['on'](_0x11b268,_0x44ec43);}}; \ No newline at end of file +var _0x66a8=['remove','emit','user-setting:update:user-','UserId','register','length','./user-setting.events'];(function(_0x1635c3,_0x3004ab){var _0x165ddc=function(_0x18ce01){while(--_0x18ce01){_0x1635c3['push'](_0x1635c3['shift']());}};_0x165ddc(++_0x3004ab);}(_0x66a8,0x99));var _0x866a=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x66a8[_0x263a74];return _0x2aa86c;};'use strict';var UserSettingEvents=require(_0x866a('0x0'));var events=['save',_0x866a('0x1'),'update'];function createListener(_0x51579c,_0x3186ab){return function(_0x5ea686){_0x3186ab[_0x866a('0x2')](_0x51579c,_0x5ea686);if(_0x51579c==='user-setting:update'){_0x3186ab[_0x866a('0x2')](_0x866a('0x3')+_0x5ea686[_0x866a('0x4')],_0x5ea686);}};}exports[_0x866a('0x5')]=function(_0x3d7e98){for(var _0x3b445d=0x0,_0x4e7aaf=events[_0x866a('0x6')];_0x3b445d<_0x4e7aaf;_0x3b445d++){var _0x2c9467=events[_0x3b445d];var _0x396a85=createListener('user-setting:'+_0x2c9467,_0x3d7e98);UserSettingEvents['on'](_0x2c9467,_0x396a85);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index f7f2f51..097f49a 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 _0x489a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','whoami','getPresence','/:id','show','/:id/avatar','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getFaxInteractions','getWhatsappInteractions','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','addContacts','create','/create_many','addQueues','diskStorage','root','server/files/images/','format','%s-%s','originalname','single','file','addAvatar','login','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/openchannel_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id/password','delete','removeQueues','/:id/teams','removeMailInteractions','/:id/fax_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','path','connect-timeout','express'];(function(_0x2ade6f,_0x18d576){var _0x28fa0f=function(_0x4ad67c){while(--_0x4ad67c){_0x2ade6f['push'](_0x2ade6f['shift']());}};_0x28fa0f(++_0x18d576);}(_0x489a,0x69));var _0xa489=function(_0xac8055,_0x5ababb){_0xac8055=_0xac8055-0x0;var _0x2d5608=_0x489a[_0xac8055];return _0x2d5608;};'use strict';var multer=require(_0xa489('0x0'));var util=require('util');var path=require(_0xa489('0x1'));var timeout=require(_0xa489('0x2'));var express=require(_0xa489('0x3'));var router=express[_0xa489('0x4')]();var fs_extra=require(_0xa489('0x5'));var auth=require(_0xa489('0x6'));var interaction=require(_0xa489('0x7'));var config=require(_0xa489('0x8'));var controller=require('./user.controller');router[_0xa489('0x9')]('/',auth[_0xa489('0xa')](),controller['index']);router['get'](_0xa489('0xb'),auth[_0xa489('0xa')](),controller[_0xa489('0xc')]);router[_0xa489('0x9')]('/whoami',auth[_0xa489('0xa')](),controller[_0xa489('0xd')]);router['get']('/presence',auth[_0xa489('0xa')](),controller[_0xa489('0xe')]);router[_0xa489('0x9')](_0xa489('0xf'),auth[_0xa489('0xa')](),controller[_0xa489('0x10')]);router[_0xa489('0x9')](_0xa489('0x11'),controller['getAvatar']);router['get']('/:id/open_tabs',auth[_0xa489('0xa')](),controller[_0xa489('0x12')]);router[_0xa489('0x9')]('/:id/contacts',auth[_0xa489('0xa')](),controller[_0xa489('0x13')]);router[_0xa489('0x9')](_0xa489('0x14'),auth[_0xa489('0xa')](),controller[_0xa489('0x15')]);router[_0xa489('0x9')](_0xa489('0x16'),auth[_0xa489('0xa')](),controller['getVoiceQueuesRt']);router['get'](_0xa489('0x17'),auth[_0xa489('0xa')](),controller['getGroups']);router[_0xa489('0x9')](_0xa489('0x18'),auth[_0xa489('0xa')](),controller[_0xa489('0x19')]);router['get'](_0xa489('0x1a'),auth['isAuthenticated'](),controller[_0xa489('0x1b')]);router[_0xa489('0x9')](_0xa489('0x1c'),auth[_0xa489('0xa')](),controller[_0xa489('0x1d')]);router[_0xa489('0x9')](_0xa489('0x1e'),auth[_0xa489('0xa')](),controller[_0xa489('0x1f')]);router['get'](_0xa489('0x20'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0xa489('0x9')]('/:id/sms/interactions',auth[_0xa489('0xa')](),controller['getSmsInteractions']);router[_0xa489('0x9')]('/:id/fax/interactions',auth[_0xa489('0xa')](),controller[_0xa489('0x21')]);router[_0xa489('0x9')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0xa489('0x22')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0xa489('0x23'),auth[_0xa489('0xa')](),controller['getLists']);router['get'](_0xa489('0x24'),auth[_0xa489('0xa')](),controller[_0xa489('0x25')]);router[_0xa489('0x9')](_0xa489('0x26'),auth[_0xa489('0xa')](),controller[_0xa489('0x27')]);router['get'](_0xa489('0x28'),auth[_0xa489('0xa')](),controller[_0xa489('0x29')]);router['get']('/:id/mail_accounts',auth[_0xa489('0xa')](),controller[_0xa489('0x2a')]);router[_0xa489('0x9')](_0xa489('0x2b'),auth['isAuthenticated'](),controller[_0xa489('0x2c')]);router[_0xa489('0x9')](_0xa489('0x2d'),auth[_0xa489('0xa')](),controller[_0xa489('0x2e')]);router[_0xa489('0x9')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xa489('0x2f')]);router[_0xa489('0x9')](_0xa489('0x30'),auth[_0xa489('0xa')](),controller[_0xa489('0x31')]);router['get'](_0xa489('0x32'),auth['isAuthenticated'](),controller[_0xa489('0x33')]);router[_0xa489('0x9')](_0xa489('0x34'),auth['isAuthenticated'](),controller[_0xa489('0x35')]);router[_0xa489('0x9')](_0xa489('0x36'),auth[_0xa489('0xa')](),controller[_0xa489('0x37')]);router[_0xa489('0x38')](_0xa489('0x39'),auth[_0xa489('0xa')](),controller[_0xa489('0x3a')]);router['post']('/',auth[_0xa489('0xa')](),controller[_0xa489('0x3b')]);router[_0xa489('0x38')](_0xa489('0x3c'),auth[_0xa489('0xa')](),controller['bulkCreate']);router[_0xa489('0x38')](_0xa489('0x14'),auth[_0xa489('0xa')](),controller[_0xa489('0x3d')]);var upload=multer({'storage':multer[_0xa489('0x3e')]({'destination':function(_0x188515,_0x4c0444,_0x57f5be){_0x57f5be(null,path['join'](config[_0xa489('0x3f')],_0xa489('0x40')));},'filename':function(_0x5c0092,_0x3e3281,_0x435674){_0x435674(null,util[_0xa489('0x41')](_0xa489('0x42'),Date['now'](),_0x3e3281[_0xa489('0x43')]));}})});router[_0xa489('0x38')]('/:id/avatar',upload[_0xa489('0x44')](_0xa489('0x45')),controller[_0xa489('0x46')]);router[_0xa489('0x38')]('/:id/login',auth[_0xa489('0xa')](),controller[_0xa489('0x47')]);router['post']('/:id/logout',auth['isAuthenticated'](),controller['logout']);router[_0xa489('0x38')](_0xa489('0x48'),auth[_0xa489('0xa')](),controller[_0xa489('0x49')]);router['post']('/:id/unpause',auth[_0xa489('0xa')](),controller[_0xa489('0x4a')]);router[_0xa489('0x38')]('/:id/teams',auth[_0xa489('0xa')](),controller[_0xa489('0x4b')]);router[_0xa489('0x38')](_0xa489('0x4c'),auth[_0xa489('0xa')](),controller[_0xa489('0x4d')]);router[_0xa489('0x38')](_0xa489('0x4e'),auth[_0xa489('0xa')](),controller['addMailInteractions']);router[_0xa489('0x38')]('/:id/fax_interactions',auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0xa489('0x38')]('/:id/sms_interactions',auth[_0xa489('0xa')](),controller['addSmsInteractions']);router[_0xa489('0x38')](_0xa489('0x4f'),auth[_0xa489('0xa')](),controller['addOpenchannelInteractions']);router[_0xa489('0x38')]('/:id/whatsapp_interactions',auth[_0xa489('0xa')](),controller[_0xa489('0x50')]);router[_0xa489('0x38')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xa489('0x51')]);router['post'](_0xa489('0x52'),auth[_0xa489('0xa')](),controller[_0xa489('0x53')]);router[_0xa489('0x38')]('/:id/openchannel_accounts',auth[_0xa489('0xa')](),controller[_0xa489('0x54')]);router[_0xa489('0x38')](_0xa489('0x2d'),auth[_0xa489('0xa')](),controller[_0xa489('0x55')]);router[_0xa489('0x38')]('/:id/chat_websites',auth[_0xa489('0xa')](),controller[_0xa489('0x56')]);router[_0xa489('0x38')](_0xa489('0x30'),auth['isAuthenticated'](),controller[_0xa489('0x57')]);router[_0xa489('0x38')](_0xa489('0x32'),auth[_0xa489('0xa')](),controller[_0xa489('0x58')]);router[_0xa489('0x38')](_0xa489('0x36'),auth[_0xa489('0xa')](),controller[_0xa489('0x59')]);router[_0xa489('0x5a')](_0xa489('0xf'),auth[_0xa489('0xa')](),controller['update']);router['put'](_0xa489('0x5b'),auth[_0xa489('0xa')](),controller['changePassword']);router[_0xa489('0x5c')]('/:id/queues',auth[_0xa489('0xa')](),controller[_0xa489('0x5d')]);router[_0xa489('0x5c')](_0xa489('0x5e'),auth[_0xa489('0xa')](),controller['removeTeams']);router['delete'](_0xa489('0xf'),auth[_0xa489('0xa')](),controller['destroy']);router[_0xa489('0x5c')]('/:id/chat_interactions',auth[_0xa489('0xa')](),controller['removeChatInteractions']);router[_0xa489('0x5c')]('/:id/mail_interactions',auth[_0xa489('0xa')](),controller[_0xa489('0x5f')]);router['delete'](_0xa489('0x60'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router['delete']('/:id/sms_interactions',auth[_0xa489('0xa')](),controller['removeSmsInteractions']);router[_0xa489('0x5c')](_0xa489('0x4f'),auth[_0xa489('0xa')](),controller[_0xa489('0x61')]);router['delete'](_0xa489('0x62'),auth[_0xa489('0xa')](),controller['removeWhatsappInteractions']);router['delete'](_0xa489('0x28'),auth[_0xa489('0xa')](),controller[_0xa489('0x63')]);router[_0xa489('0x5c')]('/:id/mail_accounts',auth[_0xa489('0xa')](),controller[_0xa489('0x64')]);router[_0xa489('0x5c')](_0xa489('0x2b'),auth['isAuthenticated'](),controller[_0xa489('0x65')]);router[_0xa489('0x5c')](_0xa489('0x2d'),auth[_0xa489('0xa')](),controller[_0xa489('0x66')]);router[_0xa489('0x5c')](_0xa489('0x67'),auth[_0xa489('0xa')](),controller[_0xa489('0x68')]);router[_0xa489('0x5c')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xa489('0x69')]);router[_0xa489('0x5c')]('/:id/square_projects',auth[_0xa489('0xa')](),controller[_0xa489('0x6a')]);router[_0xa489('0x5c')](_0xa489('0x36'),auth[_0xa489('0xa')](),controller[_0xa489('0x6b')]);module[_0xa489('0x6c')]=router; \ No newline at end of file +var _0x2415=['/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','/:id/contacts','addContacts','create','post','bulkCreate','addQueues','join','root','format','%s-%s','now','originalname','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','update','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','/:id/mail_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','whoami','/presence','getPresence','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/recordings','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites'];(function(_0x2e0910,_0x406b76){var _0x1cbd1a=function(_0x33a172){while(--_0x33a172){_0x2e0910['push'](_0x2e0910['shift']());}};_0x1cbd1a(++_0x406b76);}(_0x2415,0xb8));var _0x5241=function(_0xf7941b,_0x1e022f){_0xf7941b=_0xf7941b-0x0;var _0xfabcd8=_0x2415[_0xf7941b];return _0xfabcd8;};'use strict';var multer=require(_0x5241('0x0'));var util=require(_0x5241('0x1'));var path=require(_0x5241('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5241('0x3'));var auth=require(_0x5241('0x4'));var interaction=require(_0x5241('0x5'));var config=require(_0x5241('0x6'));var controller=require('./user.controller');router[_0x5241('0x7')]('/',auth['isAuthenticated'](),controller[_0x5241('0x8')]);router['get'](_0x5241('0x9'),auth[_0x5241('0xa')](),controller[_0x5241('0xb')]);router['get']('/whoami',auth[_0x5241('0xa')](),controller[_0x5241('0xc')]);router[_0x5241('0x7')](_0x5241('0xd'),auth[_0x5241('0xa')](),controller[_0x5241('0xe')]);router[_0x5241('0x7')]('/:id',auth[_0x5241('0xa')](),controller['show']);router['get'](_0x5241('0xf'),controller[_0x5241('0x10')]);router[_0x5241('0x7')](_0x5241('0x11'),auth[_0x5241('0xa')](),controller[_0x5241('0x12')]);router['get']('/:id/contacts',auth[_0x5241('0xa')](),controller['getContacts']);router['get'](_0x5241('0x13'),auth[_0x5241('0xa')](),controller[_0x5241('0x14')]);router[_0x5241('0x7')](_0x5241('0x15'),auth['isAuthenticated'](),controller[_0x5241('0x16')]);router['get']('/:id/groups',auth[_0x5241('0xa')](),controller['getGroups']);router[_0x5241('0x7')](_0x5241('0x17'),auth[_0x5241('0xa')](),controller[_0x5241('0x18')]);router['get']('/:id/screen_recordings',auth['isAuthenticated'](),controller['getScreenRecordings']);router['get'](_0x5241('0x19'),auth[_0x5241('0xa')](),controller[_0x5241('0x1a')]);router[_0x5241('0x7')](_0x5241('0x1b'),auth[_0x5241('0xa')](),controller[_0x5241('0x1c')]);router[_0x5241('0x7')](_0x5241('0x1d'),auth[_0x5241('0xa')](),controller['getMailInteractions']);router[_0x5241('0x7')](_0x5241('0x1e'),auth[_0x5241('0xa')](),controller[_0x5241('0x1f')]);router[_0x5241('0x7')](_0x5241('0x20'),auth[_0x5241('0xa')](),controller[_0x5241('0x21')]);router['get'](_0x5241('0x22'),auth['isAuthenticated'](),controller[_0x5241('0x23')]);router[_0x5241('0x7')](_0x5241('0x24'),auth[_0x5241('0xa')](),controller[_0x5241('0x25')]);router['get'](_0x5241('0x26'),auth[_0x5241('0xa')](),controller[_0x5241('0x27')]);router[_0x5241('0x7')](_0x5241('0x28'),auth[_0x5241('0xa')](),controller[_0x5241('0x29')]);router['get'](_0x5241('0x2a'),auth[_0x5241('0xa')](),controller['getVoicePrefixes']);router[_0x5241('0x7')](_0x5241('0x2b'),auth[_0x5241('0xa')](),controller[_0x5241('0x2c')]);router[_0x5241('0x7')]('/:id/mail_accounts',auth[_0x5241('0xa')](),controller['getMailAccounts']);router[_0x5241('0x7')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x5241('0x2d')]);router[_0x5241('0x7')]('/:id/sms_accounts',auth[_0x5241('0xa')](),controller[_0x5241('0x2e')]);router['get']('/:id/chat_websites',auth[_0x5241('0xa')](),controller[_0x5241('0x2f')]);router[_0x5241('0x7')](_0x5241('0x30'),auth[_0x5241('0xa')](),controller[_0x5241('0x31')]);router[_0x5241('0x7')](_0x5241('0x32'),auth[_0x5241('0xa')](),controller[_0x5241('0x33')]);router[_0x5241('0x7')](_0x5241('0x34'),auth[_0x5241('0xa')](),controller['getScheduledCalls']);router[_0x5241('0x7')](_0x5241('0x35'),auth[_0x5241('0xa')](),controller[_0x5241('0x36')]);router['post'](_0x5241('0x37'),auth[_0x5241('0xa')](),controller[_0x5241('0x38')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5241('0x39')]);router[_0x5241('0x3a')]('/create_many',auth['isAuthenticated'](),controller[_0x5241('0x3b')]);router[_0x5241('0x3a')](_0x5241('0x13'),auth['isAuthenticated'](),controller[_0x5241('0x3c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5905a0,_0x4f980f,_0x13f6b8){_0x13f6b8(null,path[_0x5241('0x3d')](config[_0x5241('0x3e')],'server/files/images/'));},'filename':function(_0x1a0117,_0x3e39c1,_0x110fa){_0x110fa(null,util[_0x5241('0x3f')](_0x5241('0x40'),Date[_0x5241('0x41')](),_0x3e39c1[_0x5241('0x42')]));}})});router[_0x5241('0x3a')]('/:id/avatar',upload[_0x5241('0x43')](_0x5241('0x44')),controller['addAvatar']);router[_0x5241('0x3a')](_0x5241('0x45'),auth['isAuthenticated'](),controller[_0x5241('0x46')]);router[_0x5241('0x3a')](_0x5241('0x47'),auth[_0x5241('0xa')](),controller[_0x5241('0x48')]);router[_0x5241('0x3a')](_0x5241('0x49'),auth[_0x5241('0xa')](),controller[_0x5241('0x4a')]);router[_0x5241('0x3a')](_0x5241('0x4b'),auth[_0x5241('0xa')](),controller[_0x5241('0x4c')]);router[_0x5241('0x3a')](_0x5241('0x24'),auth[_0x5241('0xa')](),controller['addTeams']);router['post'](_0x5241('0x4d'),auth[_0x5241('0xa')](),controller[_0x5241('0x4e')]);router['post'](_0x5241('0x4f'),auth[_0x5241('0xa')](),controller['addMailInteractions']);router[_0x5241('0x3a')](_0x5241('0x50'),auth[_0x5241('0xa')](),controller[_0x5241('0x51')]);router['post']('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x5241('0x52')]);router['post']('/:id/openchannel_interactions',auth[_0x5241('0xa')](),controller[_0x5241('0x53')]);router[_0x5241('0x3a')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x5241('0x54')]);router[_0x5241('0x3a')](_0x5241('0x2b'),auth['isAuthenticated'](),controller[_0x5241('0x55')]);router['post']('/:id/mail_accounts',auth[_0x5241('0xa')](),controller[_0x5241('0x56')]);router[_0x5241('0x3a')](_0x5241('0x57'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router['post'](_0x5241('0x58'),auth[_0x5241('0xa')](),controller[_0x5241('0x59')]);router['post'](_0x5241('0x5a'),auth['isAuthenticated'](),controller[_0x5241('0x5b')]);router[_0x5241('0x3a')](_0x5241('0x30'),auth[_0x5241('0xa')](),controller[_0x5241('0x5c')]);router[_0x5241('0x3a')](_0x5241('0x32'),auth[_0x5241('0xa')](),controller[_0x5241('0x5d')]);router['post'](_0x5241('0x35'),auth[_0x5241('0xa')](),controller[_0x5241('0x5e')]);router[_0x5241('0x5f')](_0x5241('0x60'),auth[_0x5241('0xa')](),controller[_0x5241('0x61')]);router[_0x5241('0x5f')]('/:id/password',auth[_0x5241('0xa')](),controller[_0x5241('0x62')]);router[_0x5241('0x63')](_0x5241('0x13'),auth['isAuthenticated'](),controller[_0x5241('0x64')]);router[_0x5241('0x63')]('/:id/teams',auth[_0x5241('0xa')](),controller[_0x5241('0x65')]);router[_0x5241('0x63')](_0x5241('0x60'),auth[_0x5241('0xa')](),controller[_0x5241('0x66')]);router[_0x5241('0x63')](_0x5241('0x4d'),auth[_0x5241('0xa')](),controller[_0x5241('0x67')]);router['delete'](_0x5241('0x4f'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x5241('0x63')](_0x5241('0x50'),auth[_0x5241('0xa')](),controller[_0x5241('0x68')]);router[_0x5241('0x63')](_0x5241('0x69'),auth[_0x5241('0xa')](),controller['removeSmsInteractions']);router[_0x5241('0x63')](_0x5241('0x6a'),auth[_0x5241('0xa')](),controller[_0x5241('0x6b')]);router[_0x5241('0x63')](_0x5241('0x6c'),auth[_0x5241('0xa')](),controller['removeWhatsappInteractions']);router[_0x5241('0x63')]('/:id/fax_accounts',auth[_0x5241('0xa')](),controller[_0x5241('0x6d')]);router[_0x5241('0x63')](_0x5241('0x6e'),auth['isAuthenticated'](),controller['removeMailAccounts']);router['delete'](_0x5241('0x57'),auth[_0x5241('0xa')](),controller[_0x5241('0x6f')]);router[_0x5241('0x63')](_0x5241('0x58'),auth[_0x5241('0xa')](),controller[_0x5241('0x70')]);router[_0x5241('0x63')](_0x5241('0x5a'),auth[_0x5241('0xa')](),controller[_0x5241('0x71')]);router[_0x5241('0x63')](_0x5241('0x30'),auth[_0x5241('0xa')](),controller[_0x5241('0x72')]);router[_0x5241('0x63')](_0x5241('0x32'),auth['isAuthenticated'](),controller[_0x5241('0x73')]);router[_0x5241('0x63')]('/:id/api_key',auth['isAuthenticated'](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 366d225..0600b52 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 _0x46f5=['TEXT','showWebBar','get','isArray','udp','wss','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','name','setDataValue','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','getDataValue','email','toLowerCase','ENUM','admin','user','agent','local','INTEGER','internal','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','nonat','update','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','active','passive','actpass','update,nonat'];(function(_0x16e3dc,_0x35770a){var _0x2f1001=function(_0x516ef7){while(--_0x516ef7){_0x16e3dc['push'](_0x16e3dc['shift']());}};_0x2f1001(++_0x35770a);}(_0x46f5,0x1ec));var _0x546f=function(_0x59cf91,_0x4bb5b8){_0x59cf91=_0x59cf91-0x0;var _0x286835=_0x46f5[_0x59cf91];return _0x286835;};'use strict';var Sequelize=require(_0x546f('0x0'));var moment=require(_0x546f('0x1'));var util=require(_0x546f('0x2'));var _=require(_0x546f('0x3'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x546f('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5993ef){this[_0x546f('0x5')](_0x546f('0x4'),_0x5993ef);this[_0x546f('0x5')]('defaultuser',_0x5993ef);},'comment':_0x546f('0x6')},'fullname':{'type':Sequelize[_0x546f('0x7')],'allowNull':![],'set':function(_0x20a556){this[_0x546f('0x5')](_0x546f('0x8'),_0x20a556);this[_0x546f('0x5')](_0x546f('0x9'),util[_0x546f('0xa')]('\x22%s\x22\x20<%s>',_0x20a556,this[_0x546f('0xb')]('internal')));}},'alias':{'type':Sequelize[_0x546f('0x7')]},'email':{'type':Sequelize[_0x546f('0x7')],'allowNull':![],'unique':_0x546f('0xc'),'validate':{'isEmail':!![]},'set':function(_0x39afba){if(_0x39afba){this[_0x546f('0x5')]('email',_0x39afba[_0x546f('0xd')]());}}},'role':{'type':Sequelize[_0x546f('0xe')](_0x546f('0xf'),_0x546f('0x10'),_0x546f('0x11'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x546f('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x546f('0x7')],'defaultValue':_0x546f('0x12')},'internal':{'type':Sequelize[_0x546f('0x13')](0xb),'allowNull':![],'unique':_0x546f('0x14'),'set':function(_0x327cb7){this[_0x546f('0x5')](_0x546f('0x14'),_0x327cb7);this[_0x546f('0x5')](_0x546f('0x15'),_0x327cb7);this['setDataValue'](_0x546f('0x9'),util['format']('\x22%s\x22\x20<%s>',this[_0x546f('0xb')](_0x546f('0x8')),_0x327cb7));}},'salt':{'type':Sequelize[_0x546f('0x7')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x546f('0x7')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x546f('0x7')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x546f('0x7')]},'online':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x546f('0x17')]},'voicePause':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x546f('0x18')},'lastPauseAt':{'type':Sequelize[_0x546f('0x17')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x546f('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x546f('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x546f('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x546f('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x546f('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x546f('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x546f('0x19')},'ipaddr':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'port':{'type':Sequelize[_0x546f('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x546f('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x546f('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x546f('0xe')]('friend',_0x546f('0x10'),_0x546f('0x1a')),'allowNull':!![],'defaultValue':_0x546f('0x1b')},'context':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![],'defaultValue':_0x546f('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x546f('0x1d'),_0x546f('0x1e'),'ALLOWED_FAILED_SCREEN',_0x546f('0x1f'),_0x546f('0x20'),_0x546f('0x21'),_0x546f('0x22'),_0x546f('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'permit':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x378130){this['setDataValue']('transport',_0x378130?_0x378130[_0x546f('0x24')](','):null);},'get':function(){return this[_0x546f('0xb')]('transport')?this['getDataValue'](_0x546f('0x25'))[_0x546f('0x26')](','):null;},'comment':_0x546f('0x27')},'dtmfmode':{'type':Sequelize[_0x546f('0xe')](_0x546f('0x28'),'info','shortinfo',_0x546f('0x29'),'auto'),'allowNull':!![],'defaultValue':_0x546f('0x28')},'directmedia':{'type':Sequelize[_0x546f('0xe')]('yes','no',_0x546f('0x2a'),_0x546f('0x2b'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x546f('0xe')](_0x546f('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'nat':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![],'defaultValue':_0x546f('0x2d'),'set':function(_0x1beb95){this['setDataValue'](_0x546f('0x2e'),_0x1beb95?_0x1beb95[_0x546f('0x24')](','):null);},'get':function(){return this[_0x546f('0xb')](_0x546f('0x2e'))?this['getDataValue'](_0x546f('0x2e'))[_0x546f('0x26')](','):null;},'comment':_0x546f('0x2f')},'callgroup':{'type':Sequelize[_0x546f('0x7')]},'namedcallgroup':{'type':Sequelize[_0x546f('0x7')]},'pickupgroup':{'type':Sequelize[_0x546f('0x7')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x546f('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x546f('0x7')]},'disallow':{'type':Sequelize[_0x546f('0x7')],'allowNull':![],'defaultValue':_0x546f('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x466f50){this[_0x546f('0x5')]('allow',_0x466f50?_0x466f50[_0x546f('0x24')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x546f('0xb')](_0x546f('0x31'))?this[_0x546f('0xb')](_0x546f('0x31'))['split'](';'):null;},'comment':_0x546f('0x32')},'autoframing':{'type':Sequelize['ENUM'](_0x546f('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![],'set':function(_0x1f03a8){this[_0x546f('0x5')](_0x546f('0x33'),_0x1f03a8?_0x1f03a8[_0x546f('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x546f('0x33'))?this[_0x546f('0xb')](_0x546f('0x33'))[_0x546f('0x26')](','):null;},'comment':_0x546f('0x34')},'trustrpid':{'type':Sequelize[_0x546f('0xe')](_0x546f('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x546f('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x546f('0xe')]('yes','no',_0x546f('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x546f('0xe')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x546f('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x546f('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![],'defaultValue':_0x546f('0x36')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x546f('0xe')](_0x546f('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x546f('0x2c')},'busylevel':{'type':Sequelize[_0x546f('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x546f('0xe')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x546f('0xe')](_0x546f('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x546f('0xe')](_0x546f('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x546f('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'template':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x546f('0xe')](_0x546f('0x2c'),'no',_0x546f('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x546f('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x546f('0x38'),_0x546f('0x39'),_0x546f('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x546f('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x546f('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x546f('0x3b'),_0x546f('0x3c')),'allowNull':!![],'defaultValue':_0x546f('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x546f('0xe')](_0x546f('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x546f('0x2c')},'keepalive':{'type':Sequelize[_0x546f('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x546f('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x546f('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x546f('0xe')](_0x546f('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x546f('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x546f('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x546f('0xe')](_0x546f('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x546f('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x546f('0xe')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x546f('0xe')](_0x546f('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x546f('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x546f('0x2c'),'no',_0x546f('0x3d'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x546f('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x546f('0xe')](_0x546f('0x3e'),_0x546f('0x3f'),_0x546f('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x546f('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x546f('0xe')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x546f('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x546f('0xe')]('yes','no',_0x546f('0x2a'),_0x546f('0x2b'),_0x546f('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x546f('0x17')]},'passwordResetAt':{'type':Sequelize[_0x546f('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x546f('0x42')]},'showWebBar':{'type':Sequelize[_0x546f('0x13')],'defaultValue':0x0,'set':function(_0x1a8552){this[_0x546f('0x5')](_0x546f('0x43'),_0x1a8552);var _0x137c87=this[_0x546f('0x44')]({'plain':!![]});switch(_0x1a8552){case 0x0:case 0x1:var _0x40c96a=_0x137c87[_0x546f('0x25')]?_[_0x546f('0x45')](_0x137c87['transport'])?_0x137c87['transport'][_0x546f('0x24')]():_0x137c87[_0x546f('0x25')]:_0x546f('0x46');if(_0x40c96a===_0x546f('0x47')){_0x40c96a='udp';}this['setDataValue']('transport',_0x40c96a);this[_0x546f('0x5')](_0x546f('0x48'),'no');this[_0x546f('0x5')](_0x546f('0x49'),null);this['setDataValue'](_0x546f('0x4a'),null);this[_0x546f('0x5')]('icesupport',null);this[_0x546f('0x5')](_0x546f('0x4b'),null);this['setDataValue'](_0x546f('0x4c'),null);this['setDataValue'](_0x546f('0x4d'),null);this[_0x546f('0x5')](_0x546f('0x4e'),null);this['setDataValue']('dtlsprivatekey',null);this[_0x546f('0x5')](_0x546f('0x4f'),'no');break;case 0x2:this['setDataValue'](_0x546f('0x25'),'wss');this[_0x546f('0x5')](_0x546f('0x48'),'yes');this[_0x546f('0x5')](_0x546f('0x49'),_0x546f('0x2c'));this['setDataValue']('force_avp',_0x546f('0x2c'));this[_0x546f('0x5')]('icesupport',_0x546f('0x2c'));this[_0x546f('0x5')]('dtlsenable',_0x546f('0x2c'));this[_0x546f('0x5')](_0x546f('0x4c'),'no');this[_0x546f('0x5')]('dtlssetup',_0x546f('0x40'));this[_0x546f('0x5')](_0x546f('0x4e'),_0x137c87[_0x546f('0x4e')]||_0x546f('0x50'));this[_0x546f('0x5')](_0x546f('0x51'),_0x137c87['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0x546f('0x5')](_0x546f('0x4f'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x546f('0x42')],'set':function(_0x36384a){this['setDataValue']('permissions',_0x36384a?_0x36384a[_0x546f('0x24')](','):[]);},'get':function(){return this['getDataValue'](_0x546f('0x52'))?_[_0x546f('0x53')](this[_0x546f('0xb')](_0x546f('0x52'))['split'](','),function(_0x387864){return parseInt(_0x387864,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x546f('0x7')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x546f('0x7')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x546f('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x546f('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x546f('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x546f('0x7')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x546f('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x546f('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x546f('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x546f('0x54')],'get':function(){return this[_0x546f('0xb')](_0x546f('0x55'))?this[_0x546f('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x546f('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x546f('0x7')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![],'set':function(_0x286999){if(typeof _0x286999==='string'){var _0x507ef4=_0x286999==='1'?!![]:_0x286999==='0'?![]:_0x286999===_0x546f('0x56')?!![]:_0x286999===_0x546f('0x57')?![]:![];this[_0x546f('0x5')]('screenrecording',_0x507ef4);}else{this[_0x546f('0x5')](_0x546f('0x58'),_0x286999);}}},'blocked':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![],'set':function(_0x43b033){this[_0x546f('0x5')](_0x546f('0x59'),_0x43b033);if(_0x43b033===!![]){this['setDataValue'](_0x546f('0x5a'),moment());this[_0x546f('0x5')](_0x546f('0x5b'),0x0);}else{this[_0x546f('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x546f('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x546f('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x546f('0x13')](0x5)[_0x546f('0x5c')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x546f('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x546f('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x546f('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0x4b43=['defaultuser','setDataValue','fullname','callerid','getDataValue','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','internal','accountcode','format','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uac','uas','certificate','actpass','TEXT','showWebBar','get','isArray','wss','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','dtlsenable','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','sequelize','moment','util','lodash','exports','STRING','name'];(function(_0x352983,_0x1a1495){var _0x50343a=function(_0x1695b4){while(--_0x1695b4){_0x352983['push'](_0x352983['shift']());}};_0x50343a(++_0x1a1495);}(_0x4b43,0x116));var _0x34b4=function(_0x11d6b2,_0x57be7c){_0x11d6b2=_0x11d6b2-0x0;var _0x44c071=_0x4b43[_0x11d6b2];return _0x44c071;};'use strict';var Sequelize=require(_0x34b4('0x0'));var moment=require(_0x34b4('0x1'));var util=require(_0x34b4('0x2'));var _=require(_0x34b4('0x3'));module[_0x34b4('0x4')]={'name':{'type':Sequelize[_0x34b4('0x5')],'allowNull':![],'unique':_0x34b4('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x6fd182){this['setDataValue'](_0x34b4('0x6'),_0x6fd182);this['setDataValue'](_0x34b4('0x7'),_0x6fd182);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3abb0a){this[_0x34b4('0x8')](_0x34b4('0x9'),_0x3abb0a);this[_0x34b4('0x8')](_0x34b4('0xa'),util['format']('\x22%s\x22\x20<%s>',_0x3abb0a,this[_0x34b4('0xb')]('internal')));}},'alias':{'type':Sequelize[_0x34b4('0x5')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x34b4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x3bf5cc){if(_0x3bf5cc){this[_0x34b4('0x8')](_0x34b4('0xc'),_0x3bf5cc[_0x34b4('0xd')]());}}},'role':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0xf'),'user',_0x34b4('0x10'),_0x34b4('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x34b4('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x34b4('0x12')},'internal':{'type':Sequelize[_0x34b4('0x13')](0xb),'allowNull':![],'unique':_0x34b4('0x14'),'set':function(_0x2efccd){this[_0x34b4('0x8')]('internal',_0x2efccd);this[_0x34b4('0x8')](_0x34b4('0x15'),_0x2efccd);this[_0x34b4('0x8')](_0x34b4('0xa'),util[_0x34b4('0x16')](_0x34b4('0x17'),this[_0x34b4('0xb')](_0x34b4('0x9')),_0x2efccd));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x34b4('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x34b4('0x5')]},'userpic':{'type':Sequelize[_0x34b4('0x5')]},'city':{'type':Sequelize[_0x34b4('0x5')]},'country':{'type':Sequelize[_0x34b4('0x5')]},'online':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x34b4('0x19')]},'voicePause':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x34b4('0x5')],'defaultValue':_0x34b4('0x1a')},'lastPauseAt':{'type':Sequelize[_0x34b4('0x19')]},'chatCapacity':{'type':Sequelize[_0x34b4('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x34b4('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x34b4('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x34b4('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x34b4('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x34b4('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x34b4('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x34b4('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![],'defaultValue':_0x34b4('0x1b')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x34b4('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x34b4('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x34b4('0x1c'),_0x34b4('0x1d'),_0x34b4('0x1e')),'allowNull':!![],'defaultValue':_0x34b4('0x1c')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x34b4('0x1f')},'callingpres':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x20'),_0x34b4('0x21'),_0x34b4('0x22'),_0x34b4('0x23'),_0x34b4('0x24'),_0x34b4('0x25'),_0x34b4('0x26'),_0x34b4('0x27')),'allowNull':!![]},'deny':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![],'defaultValue':_0x34b4('0x28'),'set':function(_0xfe9e42){this[_0x34b4('0x8')]('transport',_0xfe9e42?_0xfe9e42[_0x34b4('0x29')](','):null);},'get':function(){return this[_0x34b4('0xb')](_0x34b4('0x2a'))?this[_0x34b4('0xb')]('transport')[_0x34b4('0x2b')](','):null;},'comment':_0x34b4('0x2c')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x34b4('0x2d'),_0x34b4('0x2e'),_0x34b4('0x2f'),_0x34b4('0x30')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x34b4('0x31'),'no',_0x34b4('0x32'),_0x34b4('0x33'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x34b4('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![],'defaultValue':_0x34b4('0x34'),'set':function(_0x37ee71){this['setDataValue'](_0x34b4('0x35'),_0x37ee71?_0x37ee71[_0x34b4('0x29')](','):null);},'get':function(){return this[_0x34b4('0xb')](_0x34b4('0x35'))?this['getDataValue']('nat')[_0x34b4('0x2b')](','):null;},'comment':_0x34b4('0x36')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x34b4('0x5')]},'pickupgroup':{'type':Sequelize[_0x34b4('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x34b4('0x5')]},'language':{'type':Sequelize[_0x34b4('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x34b4('0x5')]},'disallow':{'type':Sequelize[_0x34b4('0x5')],'allowNull':![],'defaultValue':_0x34b4('0x37')},'allow':{'type':Sequelize[_0x34b4('0x5')],'allowNull':![],'defaultValue':_0x34b4('0x38'),'set':function(_0x3276c4){this['setDataValue'](_0x34b4('0x39'),_0x3276c4?_0x3276c4['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x34b4('0xb')](_0x34b4('0x39'))?this[_0x34b4('0xb')](_0x34b4('0x39'))['split'](';'):null;},'comment':_0x34b4('0x3a')},'autoframing':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x31'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![],'set':function(_0x31b075){this[_0x34b4('0x8')](_0x34b4('0x3b'),_0x31b075?_0x31b075['join'](','):null);},'get':function(){return this[_0x34b4('0xb')](_0x34b4('0x3b'))?this[_0x34b4('0xb')](_0x34b4('0x3b'))['split'](','):null;},'comment':_0x34b4('0x3c')},'trustrpid':{'type':Sequelize['ENUM'](_0x34b4('0x31'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x31'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x34b4('0xe')]('yes','no',_0x34b4('0x3d')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x31'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x34b4('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![],'defaultValue':_0x34b4('0x3e')},'amaflags':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x34b4('0x31')},'busylevel':{'type':Sequelize[_0x34b4('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x34b4('0xe')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x31'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x31'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x34b4('0x31'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x31'),'no',_0x34b4('0x3f')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x31'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x40'),'refuse',_0x34b4('0x41')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x34b4('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x34b4('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x42'),'uas'),'allowNull':!![],'defaultValue':_0x34b4('0x43')},'t38pt_usertpsource':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x34b4('0x31'),'no'),'allowNull':!![],'defaultValue':_0x34b4('0x31')},'keepalive':{'type':Sequelize[_0x34b4('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x34b4('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x34b4('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x34b4('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x31'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x34b4('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x34b4('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x34b4('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x34b4('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x31'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x31'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x31'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x31'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x31'),'no','fingerprint',_0x34b4('0x44')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x34b4('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x34b4('0xe')]('active','passive',_0x34b4('0x45')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x34b4('0x31'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x34b4('0x31'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x31'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x31'),'no',_0x34b4('0x32'),_0x34b4('0x33'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x34b4('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x34b4('0x19')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x34b4('0x46')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3d4bc8){this[_0x34b4('0x8')](_0x34b4('0x47'),_0x3d4bc8);var _0x3991b7=this[_0x34b4('0x48')]({'plain':!![]});switch(_0x3d4bc8){case 0x0:case 0x1:var _0x12b61d=_0x3991b7[_0x34b4('0x2a')]?_[_0x34b4('0x49')](_0x3991b7[_0x34b4('0x2a')])?_0x3991b7[_0x34b4('0x2a')]['join']():_0x3991b7['transport']:_0x34b4('0x28');if(_0x12b61d===_0x34b4('0x4a')){_0x12b61d=_0x34b4('0x28');}this['setDataValue'](_0x34b4('0x2a'),_0x12b61d);this['setDataValue']('encryption','no');this['setDataValue'](_0x34b4('0x4b'),null);this[_0x34b4('0x8')](_0x34b4('0x4c'),null);this[_0x34b4('0x8')](_0x34b4('0x4d'),null);this[_0x34b4('0x8')]('dtlsenable',null);this[_0x34b4('0x8')](_0x34b4('0x4e'),null);this['setDataValue'](_0x34b4('0x4f'),null);this[_0x34b4('0x8')]('dtlscertfile',null);this[_0x34b4('0x8')](_0x34b4('0x50'),null);this[_0x34b4('0x8')](_0x34b4('0x51'),'no');break;case 0x2:this[_0x34b4('0x8')]('transport',_0x34b4('0x4a'));this['setDataValue'](_0x34b4('0x52'),_0x34b4('0x31'));this['setDataValue'](_0x34b4('0x4b'),_0x34b4('0x31'));this['setDataValue'](_0x34b4('0x4c'),_0x34b4('0x31'));this[_0x34b4('0x8')](_0x34b4('0x4d'),_0x34b4('0x31'));this[_0x34b4('0x8')](_0x34b4('0x53'),_0x34b4('0x31'));this[_0x34b4('0x8')]('dtlsverify','no');this[_0x34b4('0x8')](_0x34b4('0x4f'),_0x34b4('0x45'));this[_0x34b4('0x8')](_0x34b4('0x54'),_0x3991b7['dtlscertfile']||_0x34b4('0x55'));this[_0x34b4('0x8')](_0x34b4('0x50'),_0x3991b7[_0x34b4('0x50')]||_0x34b4('0x56'));this[_0x34b4('0x8')]('rtcp_mux',_0x34b4('0x31'));break;default:}}},'permissions':{'type':Sequelize[_0x34b4('0x46')],'set':function(_0x2fdc5b){this[_0x34b4('0x8')](_0x34b4('0x57'),_0x2fdc5b?_0x2fdc5b[_0x34b4('0x29')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this['getDataValue']('permissions')['split'](','),function(_0x4b2b30){return parseInt(_0x4b2b30,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x34b4('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x34b4('0x5')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x34b4('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x34b4('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x34b4('0xe')](_0x34b4('0x31'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x34b4('0x58')],'get':function(){return this[_0x34b4('0xb')](_0x34b4('0x59'))?this[_0x34b4('0xb')](_0x34b4('0x59')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0x34b4('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x34b4('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x35cde6){if(typeof _0x35cde6==='string'){var _0x339719=_0x35cde6==='1'?!![]:_0x35cde6==='0'?![]:_0x35cde6===_0x34b4('0x5a')?!![]:_0x35cde6===_0x34b4('0x5b')?![]:![];this[_0x34b4('0x8')](_0x34b4('0x5c'),_0x339719);}else{this[_0x34b4('0x8')](_0x34b4('0x5c'),_0x35cde6);}}},'blocked':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![],'set':function(_0x3cddcb){this['setDataValue'](_0x34b4('0x5d'),_0x3cddcb);if(_0x3cddcb===!![]){this['setDataValue'](_0x34b4('0x5e'),moment());this[_0x34b4('0x8')]('loginAttempts',0x0);}else{this[_0x34b4('0x8')](_0x34b4('0x5e'),null);}}},'blockedAt':{'type':Sequelize[_0x34b4('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x34b4('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x34b4('0x13')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x34b4('0x18')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index ce09546..2a8f269 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 _0x1096=['Users','agent','Telephones','telephone','filter','ignore','map','value','find','end','stack','name','send','index','User','rawAttributes','fieldName','includes','password','salt','getOptions','query','includeAll','include','userSetting','true','UserSetting','attributes','findAll','rows','openTabs','length','push','chat','sms','dataValues','fax','openchannel','whatsapp','all','show','params','differenceBy','keys','filters','intersection','model','fields','merge','options','mail','body','role','describe','addContacts','ids','internal','Setting','findById','securePassword','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','voicemail','VoiceMail','fullname','email','permissions','101','102','113','110','106','107','108','100','114','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','autoAssociation','Agents','compact','oldPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','updatePasswordsHistory','previousPasswords','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','toLowerCase','Queues','penalty','spread','capitalize','Queue:save','voice','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','QueueId','emit','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','server/files/images/','ChatOpenTabs','CHAT','createdAt','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','WhatsappOpenTabs','concat','getContacts','CmContact','order','where','hasOwnProperty','CmList','List','Tag','tag','limit','getQueues','Queue','sort','Unknown\x20role','getVoiceQueuesRt','nolimit','getGroups','pick','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','device','LOGININPAUSE','resolve','pause','PAUSE','updateAttributes','type','DEFAULT\x20PAUSE','chatPause','openchannelPause','smsPause','whatsapppause','pauseType','unpause','manual','%s%s','QueuePause','getTeams','Team','addTeams','omit','Voice','setDataValue','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Openchannel','flatten','transaction','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','getChatQueues','Fax','getOpenchannelQueues','removeAgent','getLists','getAgents','values','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','firstName','lastName','CmHopper','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','teams','queues','isEmpty','inbound','lower','col','toString','desc','asc','substring','orderBy','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','ringing','voiceStatus','busy','slice','toUpperCase','select','ui.','InteractionId','field','ui.createdAt','user_has_','ui.UserId\x20=\x20?','OpenTabs','moment','path','squel','jayson/promise','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','./user.socket','redis','defaults','localhost','http','request','info','debug','request\x20sent','stringify','code','User,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','offset','undefined','count','set','Content-Range','update','then','destroy','get','admin'];(function(_0x14cfc1,_0x293ed8){var _0x144d21=function(_0x3950c4){while(--_0x3950c4){_0x14cfc1['push'](_0x14cfc1['shift']());}};_0x144d21(++_0x293ed8);}(_0x1096,0x16f));var _0x6109=function(_0x34a736,_0xe2ccaa){_0x34a736=_0x34a736-0x0;var _0x5269bf=_0x1096[_0x34a736];return _0x5269bf;};'use strict';var moment=require(_0x6109('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x6109('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6109('0x2'));var jayson=require(_0x6109('0x3'));var Redis=require(_0x6109('0x4'));var authService=require(_0x6109('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x6109('0x6'))(_0x6109('0x7'));var utils=require(_0x6109('0x8'));var config=require(_0x6109('0x9'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6109('0xa'))['register'](socket);config[_0x6109('0xb')]=_[_0x6109('0xc')](config[_0x6109('0xb')],{'host':_0x6109('0xd'),'port':0x18eb});var client=jayson['client'][_0x6109('0xe')]({'port':0x232a});var values;function respondWithRpcPromise(_0x36ff90,_0x45b549,_0x313696,_0x3b2865){return new BPromise(function(_0x29dca5,_0x4794da){var _0x584cb4=_0x3b2865||client;return _0x584cb4[_0x6109('0xf')](_0x36ff90,_0x313696)['then'](function(_0x4a0f55){logger[_0x6109('0x10')]('User,\x20%s,\x20%s',_0x45b549,'request\x20sent');logger[_0x6109('0x11')]('User,\x20%s,\x20%s,\x20%s',_0x45b549,_0x6109('0x12'),JSON[_0x6109('0x13')](_0x4a0f55));if(_0x4a0f55['error']){if(_0x4a0f55['error'][_0x6109('0x14')]===0x1f4){logger['error'](_0x6109('0x15'),_0x45b549,_0x4a0f55['error']['message']);return _0x4794da(_0x4a0f55[_0x6109('0x16')][_0x6109('0x17')]);}logger[_0x6109('0x16')]('User,\x20%s,\x20%s',_0x45b549,_0x4a0f55[_0x6109('0x16')][_0x6109('0x17')]);return _0x29dca5(_0x4a0f55[_0x6109('0x16')]['message']);}else{logger[_0x6109('0x10')](_0x6109('0x15'),_0x45b549,_0x6109('0x12'));_0x29dca5(_0x4a0f55[_0x6109('0x18')]['message']);}})[_0x6109('0x19')](function(_0x362406){logger['error'](_0x6109('0x15'),_0x45b549,_0x362406);_0x4794da(_0x362406);});});}function respondWithStatusCode(_0x4aaed8,_0x235c18){_0x235c18=_0x235c18||0xcc;return function(_0x12527f){if(_0x12527f){return _0x4aaed8[_0x6109('0x1a')](_0x235c18);}return _0x4aaed8['status'](_0x235c18)['end']();};}function respondWithResult(_0x3e3dd0,_0x258942){_0x258942=_0x258942||0xc8;return function(_0x198fa2){if(_0x198fa2){return _0x3e3dd0[_0x6109('0x1b')](_0x258942)[_0x6109('0x1c')](_0x198fa2);}};}function respondWithFilteredResult(_0x3d08d1,_0x53dd9d){return function(_0x132bb1){if(_0x132bb1){var _0x1896a9=typeof _0x53dd9d[_0x6109('0x1d')]==='undefined'&&typeof _0x53dd9d['limit']===_0x6109('0x1e');var _0x40d341=_0x132bb1[_0x6109('0x1f')];var _0x259d71=_0x1896a9?0x0:_0x53dd9d[_0x6109('0x1d')];var _0x1f9214=_0x1896a9?_0x132bb1[_0x6109('0x1f')]:_0x53dd9d[_0x6109('0x1d')]+_0x53dd9d['limit'];var _0x3b0dec;if(_0x1f9214>=_0x40d341){_0x1f9214=_0x40d341;_0x3b0dec=0xc8;}else{_0x3b0dec=0xce;}_0x3d08d1[_0x6109('0x1b')](_0x3b0dec);return _0x3d08d1[_0x6109('0x20')](_0x6109('0x21'),_0x259d71+'-'+_0x1f9214+'/'+_0x40d341)[_0x6109('0x1c')](_0x132bb1);}return null;};}function saveUpdates(_0x2cc427){return function(_0x142f0f){if(_0x142f0f){return _0x142f0f[_0x6109('0x22')](_0x2cc427)[_0x6109('0x23')](function(_0x3a02eb){return _0x3a02eb;});}return null;};}function removeEntity(_0x942308){return function(_0xdcbec1){if(_0xdcbec1){return _0xdcbec1[_0x6109('0x24')]()[_0x6109('0x23')](function(){var _0xbfb52a=_0xdcbec1[_0x6109('0x25')]({'plain':!![]});if(_0xbfb52a['role']===_0x6109('0x26'))return;var _0x2a9a43=[{'name':_0x6109('0x27'),'value':'user','ignore':!![]},{'name':'Agents','value':_0x6109('0x28'),'ignore':![]},{'name':_0x6109('0x29'),'value':_0x6109('0x2a'),'ignore':![]}];var _0x5c314b=_(_0x2a9a43)[_0x6109('0x2b')](_0x6109('0x2c'))[_0x6109('0x2d')](_0x6109('0x2e'))[_0x6109('0x2e')]();if(_['includes'](_0x5c314b,_0xbfb52a['role'])){return;}var _0x2cf027=_[_0x6109('0x2f')](_0x2a9a43,[_0x6109('0x2e'),_0xbfb52a['role']])['name'];return db['UserProfileResource'][_0x6109('0x24')]({'where':{'type':_0x2cf027,'resourceId':_0xbfb52a['id']}})['then'](function(){return _0xdcbec1;});})[_0x6109('0x23')](function(){_0x942308[_0x6109('0x1b')](0xcc)[_0x6109('0x30')]();});}};}function handleEntityNotFound(_0x357593){return function(_0x35ec6d){if(!_0x35ec6d){_0x357593[_0x6109('0x1a')](0x194);}return _0x35ec6d;};}function handleError(_0x4e5b07,_0x5a44fd){_0x5a44fd=_0x5a44fd||0x1f4;return function(_0x21afa7){logger[_0x6109('0x16')](_0x21afa7[_0x6109('0x31')]);if(_0x21afa7[_0x6109('0x32')]){delete _0x21afa7[_0x6109('0x32')];}_0x4e5b07['status'](_0x5a44fd)[_0x6109('0x33')](_0x21afa7);};}exports[_0x6109('0x34')]=function(_0x1df902,_0x16bbaa){var _0x11205e={},_0x32a16b={'count':0x0,'rows':[]};var _0x3062a4=_(db[_0x6109('0x35')][_0x6109('0x36')])[_0x6109('0x2d')](function(_0x8121b3){return{'name':_0x8121b3[_0x6109('0x37')],'type':_0x8121b3['type']['key']};})[_0x6109('0x2b')](function(_0x465fda){return!_[_0x6109('0x38')]([_0x6109('0x39'),_0x6109('0x3a')],_0x465fda['name']);})[_0x6109('0x2e')]();_0x11205e=qs[_0x6109('0x3b')](_0x3062a4,_0x1df902);var _0x45f9d8={'where':_0x11205e['where']};return db[_0x6109('0x35')][_0x6109('0x1f')](_0x45f9d8)[_0x6109('0x23')](function(_0x36cf1b){_0x32a16b[_0x6109('0x1f')]=_0x36cf1b;if(_0x1df902[_0x6109('0x3c')][_0x6109('0x3d')]){_0x11205e[_0x6109('0x3e')]=[{'all':!![]}];}if(_0x1df902[_0x6109('0x3c')][_0x6109('0x3f')]===_0x6109('0x40')){_0x11205e[_0x6109('0x3e')]=[{'model':db[_0x6109('0x41')],'as':_0x6109('0x3f')}];}if(!_[_0x6109('0x38')](_0x11205e[_0x6109('0x42')],'id')){_0x11205e['attributes']['push']('id');}return db[_0x6109('0x35')][_0x6109('0x43')](_0x11205e);})[_0x6109('0x23')](function(_0x3924d8){_0x32a16b[_0x6109('0x44')]=_0x3924d8;if(_0x1df902['query'][_0x6109('0x45')]===_0x6109('0x40')){var _0x494a3b=[];for(var _0x266656=0x0;_0x266656<_0x32a16b[_0x6109('0x44')][_0x6109('0x46')];_0x266656++){_0x494a3b[_0x6109('0x47')](get_open_tabs(_0x6109('0x48'),_0x32a16b[_0x6109('0x44')][_0x266656]['dataValues']));_0x494a3b['push'](get_open_tabs(_0x6109('0x49'),_0x32a16b[_0x6109('0x44')][_0x266656][_0x6109('0x4a')]));_0x494a3b[_0x6109('0x47')](get_open_tabs(_0x6109('0x4b'),_0x32a16b[_0x6109('0x44')][_0x266656][_0x6109('0x4a')]));_0x494a3b[_0x6109('0x47')](get_open_tabs('mail',_0x32a16b['rows'][_0x266656][_0x6109('0x4a')]));_0x494a3b['push'](get_open_tabs(_0x6109('0x4c'),_0x32a16b[_0x6109('0x44')][_0x266656]['dataValues']));_0x494a3b[_0x6109('0x47')](get_open_tabs(_0x6109('0x4d'),_0x32a16b[_0x6109('0x44')][_0x266656]['dataValues']));}return BPromise[_0x6109('0x4e')](_0x494a3b)['then'](function(){return _0x32a16b;});}else{return _0x32a16b;}})[_0x6109('0x23')](respondWithFilteredResult(_0x16bbaa,_0x11205e))['catch'](handleError(_0x16bbaa,null));};exports[_0x6109('0x4f')]=function(_0x5022cd,_0x7b14f){var _0x5d7ee0={'raw':![],'where':{'id':_0x5022cd[_0x6109('0x50')]['id']}},_0x5b1940={};_0x5b1940['model']=_[_0x6109('0x51')](_['keys'](db['User'][_0x6109('0x36')]),[_0x6109('0x39'),_0x6109('0x3a')]);_0x5b1940[_0x6109('0x3c')]=_[_0x6109('0x52')](_0x5022cd[_0x6109('0x3c')]);_0x5b1940[_0x6109('0x53')]=_[_0x6109('0x54')](_0x5b1940['model'],_0x5b1940['query']);_0x5d7ee0[_0x6109('0x42')]=_[_0x6109('0x54')](_0x5b1940[_0x6109('0x55')],qs[_0x6109('0x56')](_0x5022cd[_0x6109('0x3c')]['fields']));_0x5d7ee0[_0x6109('0x42')]=_0x5d7ee0[_0x6109('0x42')][_0x6109('0x46')]?_0x5d7ee0[_0x6109('0x42')]:_0x5b1940[_0x6109('0x55')];if(_0x5022cd['query'][_0x6109('0x3d')]){_0x5d7ee0[_0x6109('0x3e')]=[{'all':!![]}];}if(_0x5022cd[_0x6109('0x3c')][_0x6109('0x3f')]==='true'){_0x5d7ee0[_0x6109('0x3e')]=[{'model':db['UserSetting'],'as':_0x6109('0x3f')}];}_0x5d7ee0=_[_0x6109('0x57')]({},_0x5d7ee0,_0x5022cd[_0x6109('0x58')]);if(!_[_0x6109('0x38')](_0x5d7ee0[_0x6109('0x42')],'id')){_0x5d7ee0[_0x6109('0x42')][_0x6109('0x47')]('id');}return db[_0x6109('0x35')][_0x6109('0x2f')](_0x5d7ee0)[_0x6109('0x23')](handleEntityNotFound(_0x7b14f,null))[_0x6109('0x23')](function(_0x493f9c){var _0x4c3cc3=[];values=_0x493f9c;if(_0x5022cd[_0x6109('0x3c')][_0x6109('0x45')]===_0x6109('0x40')){_0x4c3cc3['push'](get_open_tabs(_0x6109('0x48'),_0x493f9c[_0x6109('0x4a')]));_0x4c3cc3[_0x6109('0x47')](get_open_tabs(_0x6109('0x49'),_0x493f9c[_0x6109('0x4a')]));_0x4c3cc3[_0x6109('0x47')](get_open_tabs(_0x6109('0x4c'),_0x493f9c[_0x6109('0x4a')]));_0x4c3cc3['push'](get_open_tabs(_0x6109('0x4d'),_0x493f9c['dataValues']));_0x4c3cc3[_0x6109('0x47')](get_open_tabs(_0x6109('0x4b'),_0x493f9c[_0x6109('0x4a')]));_0x4c3cc3[_0x6109('0x47')](get_open_tabs(_0x6109('0x59'),_0x493f9c['dataValues']));return BPromise[_0x6109('0x4e')](_0x4c3cc3);}else{return values;}})[_0x6109('0x23')](function(){return values;})[_0x6109('0x23')](respondWithResult(_0x7b14f,null))[_0x6109('0x19')](handleError(_0x7b14f,null));};exports[_0x6109('0x22')]=function(_0x1a9537,_0x216cf8){if(_0x1a9537[_0x6109('0x5a')]['id']){delete _0x1a9537[_0x6109('0x5a')]['id'];}delete _0x1a9537[_0x6109('0x5a')][_0x6109('0x5b')];return db[_0x6109('0x35')][_0x6109('0x2f')]({'where':{'id':_0x1a9537['params']['id']}})[_0x6109('0x23')](handleEntityNotFound(_0x216cf8,null))[_0x6109('0x23')](saveUpdates(_0x1a9537[_0x6109('0x5a')],null))['then'](respondWithResult(_0x216cf8,null))[_0x6109('0x19')](handleError(_0x216cf8,null));};exports[_0x6109('0x5c')]=function(_0x2585a4,_0x15f900){return db[_0x6109('0x35')][_0x6109('0x5c')]()[_0x6109('0x23')](respondWithResult(_0x15f900,null))[_0x6109('0x19')](handleError(_0x15f900,null));};exports[_0x6109('0x5d')]=function(_0x1115d8,_0xe9e82b){return db[_0x6109('0x35')][_0x6109('0x2f')]({'where':{'id':_0x1115d8[_0x6109('0x50')]['id']}})[_0x6109('0x23')](handleEntityNotFound(_0xe9e82b,null))['then'](function(_0x55ecc5){if(_0x55ecc5){return _0x55ecc5[_0x6109('0x5d')](_0x1115d8[_0x6109('0x5a')][_0x6109('0x5e')],_['omit'](_0x1115d8[_0x6109('0x5a')],[_0x6109('0x5e'),'id'])||{});}})[_0x6109('0x23')](respondWithResult(_0xe9e82b,null))['catch'](handleError(_0xe9e82b,null));};function validateUser(_0x3d8d5f){return new BPromise(function(_0x29dc37,_0x4e0274){if(_0x3d8d5f[_0x6109('0x5f')])return _0x29dc37(_0x3d8d5f);return db[_0x6109('0x60')][_0x6109('0x61')](0x1)[_0x6109('0x23')](function(_0x38212f){if(_0x38212f[_0x6109('0x62')])authService['validatePasswordPattern'](_0x3d8d5f[_0x6109('0x39')]);db[_0x6109('0x35')][_0x6109('0x63')](_0x6109('0x5f'))[_0x6109('0x23')](function(_0x28872f){if(_[_0x6109('0x64')](_0x28872f)){_0x3d8d5f[_0x6109('0x5f')]=_0x38212f['min_internal']||0x1;return;}if(_[_0x6109('0x64')](_0x38212f[_0x6109('0x65')])||_0x38212f[_0x6109('0x65')]===_0x28872f){_0x3d8d5f[_0x6109('0x5f')]=_0x28872f+0x1;return;}if(_0x38212f[_0x6109('0x65')]>_0x28872f){_0x3d8d5f[_0x6109('0x5f')]=_0x38212f['min_internal'];return;}return db[_0x6109('0x66')][_0x6109('0x3c')](_0x6109('0x67'),{'type':db[_0x6109('0x66')][_0x6109('0x68')][_0x6109('0x69')]})['then'](function(_0x20d56f){if(_0x20d56f&&_0x20d56f[_0x6109('0x46')]){for(var _0x3872f3=0x0,_0x52aebf=_0x20d56f[_0x6109('0x46')];_0x3872f3<_0x52aebf&&_[_0x6109('0x64')](_0x3d8d5f['internal']);_0x3872f3++){if(_0x38212f['min_internal']<=_0x20d56f[_0x3872f3]['from']){_0x3d8d5f[_0x6109('0x5f')]=_0x20d56f[_0x3872f3]['from'];}else if(_0x38212f[_0x6109('0x65')]>_0x20d56f[_0x3872f3]['from']&&_0x38212f[_0x6109('0x65')]<=_0x20d56f[_0x3872f3]['to']){_0x3d8d5f[_0x6109('0x5f')]=_0x38212f[_0x6109('0x65')];}}}if(_[_0x6109('0x64')](_0x3d8d5f[_0x6109('0x5f')])){_0x3d8d5f['internal']=_0x28872f+0x1;}return _0x29dc37(_0x3d8d5f);});});})[_0x6109('0x19')](function(_0x15d00f){_0x4e0274(_0x15d00f);});});}function updateUser(_0x5eefb4){return new BPromise(function(_0x434755,_0x2917f3){try{if(_0x5eefb4[_0x6109('0x6a')]){_0x5eefb4['mailbox']=_0x5eefb4[_0x6109('0x5f')];_0x5eefb4[_0x6109('0x6b')]={'mailbox':_0x5eefb4[_0x6109('0x5f')],'password':_0x5eefb4['password'],'fullname':_0x5eefb4[_0x6109('0x6c')],'email':_0x5eefb4[_0x6109('0x6d')]};}if(_0x5eefb4[_0x6109('0x5b')]===_0x6109('0x28')){if(!_0x5eefb4[_0x6109('0x6e')])_0x5eefb4['permissions']=[_0x6109('0x6f'),_0x6109('0x70'),'103',_0x6109('0x71'),_0x6109('0x72'),'104','105',_0x6109('0x73'),_0x6109('0x74'),_0x6109('0x75'),'109',_0x6109('0x76'),'111',_0x6109('0x77'),'115'];}_0x434755(_0x5eefb4);}catch(_0xdb930c){_0x2917f3(_0xdb930c);}});}exports['create']=function(_0x154c5f,_0x3c7c92){if(_0x154c5f[_0x6109('0x78')][_0x6109('0x5b')]===_0x6109('0x28'))throw new Error(_0x6109('0x79'));if(_0x154c5f[_0x6109('0x5a')][_0x6109('0x5b')]===_0x6109('0x78')&&_0x154c5f['user'][_0x6109('0x5b')]!==_0x6109('0x26')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x154c5f[_0x6109('0x5a')][_0x6109('0x5b')]==='admin'&&_0x154c5f[_0x6109('0x78')][_0x6109('0x5b')]!=='admin'){throw new Error(_0x6109('0x7a'));}return licenseUtil[_0x6109('0x7b')]([_0x154c5f[_0x6109('0x5a')]])[_0x6109('0x23')](function(){return validateUser(_0x154c5f[_0x6109('0x5a')]);})[_0x6109('0x23')](function(_0x2d55d7){return updateUser(_0x2d55d7)[_0x6109('0x23')](function(_0x1e5bd8){if(_0x1e5bd8['role']===_0x6109('0x26')){_0x1e5bd8[_0x6109('0x7c')]=_0x154c5f['user'][_0x6109('0x7c')];delete _0x1e5bd8['userProfileId'];}return _0x1e5bd8;});})[_0x6109('0x23')](function(_0x1576d4){return db[_0x6109('0x35')]['create'](_0x1576d4,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0x6109('0x23')](function(_0x3062de){if(_0x154c5f[_0x6109('0x5a')][_0x6109('0x5b')]===_0x6109('0x78'))return _0x3062de;if(_0x154c5f[_0x6109('0x78')][_0x6109('0x5b')]!==_0x6109('0x78'))return _0x3062de;return db['UserProfileSection'][_0x6109('0x2f')]({'where':{'name':_0x3062de[_0x6109('0x5b')]==='agent'?'Agents':_0x6109('0x29'),'userProfileId':_0x154c5f[_0x6109('0x78')][_0x6109('0x7d')]},'raw':!![]})[_0x6109('0x23')](function(_0x4b0b82){if(!_0x4b0b82||_0x4b0b82['autoAssociation']!=0x0)return _0x3062de;return db[_0x6109('0x7e')][_0x6109('0x7f')]({'name':_0x3062de[_0x6109('0x32')],'resourceId':_0x3062de['id'],'type':_0x4b0b82[_0x6109('0x32')],'sectionId':_0x4b0b82['id']},{})['then'](function(){return _0x3062de;});})[_0x6109('0x19')](function(_0x529589){logger[_0x6109('0x16')](_0x6109('0x80'),_0x529589);throw _0x529589;});})[_0x6109('0x23')](respondWithResult(_0x3c7c92,0xc9))[_0x6109('0x19')](handleError(_0x3c7c92,null));};exports[_0x6109('0x81')]=function(_0x4e16e7,_0x1f637a){var _0x3a6f85=_0x4e16e7[_0x6109('0x5a')];var _0x48e6a2=[];if(_0x4e16e7[_0x6109('0x78')][_0x6109('0x5b')]===_0x6109('0x28'))throw new Error('Unauthorized');if(_[_0x6109('0x82')](_0x3a6f85,[_0x6109('0x5b'),_0x6109('0x78')])&&_0x4e16e7[_0x6109('0x78')][_0x6109('0x5b')]!==_0x6109('0x26')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x3a6f85,[_0x6109('0x5b'),'admin'])&&_0x4e16e7[_0x6109('0x78')][_0x6109('0x5b')]!==_0x6109('0x26')){throw new Error(_0x6109('0x83'));}return licenseUtil[_0x6109('0x7b')](_0x3a6f85)[_0x6109('0x23')](function(){return validateUser(_0x3a6f85[0x0]);})[_0x6109('0x23')](function(){for(var _0x9e2e3f=0x1;_0x9e2e3f<_0x3a6f85[_0x6109('0x46')];_0x9e2e3f++){var _0xa78415=_0x3a6f85[_0x9e2e3f-0x1][_0x6109('0x5f')];if(!_0x3a6f85[_0x9e2e3f][_0x6109('0x5f')])_0x3a6f85[_0x9e2e3f][_0x6109('0x5f')]=_0xa78415+0x1;_0x48e6a2['push'](validateUser(_0x3a6f85[_0x9e2e3f]));}return BPromise[_0x6109('0x4e')](_0x48e6a2);})[_0x6109('0x23')](function(){_0x48e6a2=[];for(var _0xfc6b4=0x0;_0xfc6b4<_0x3a6f85[_0x6109('0x46')];_0xfc6b4++){_0x48e6a2[_0x6109('0x47')](updateUser(_0x3a6f85[_0xfc6b4]));}return BPromise[_0x6109('0x4e')](_0x48e6a2);})[_0x6109('0x23')](function(){return BPromise[_0x6109('0x84')](_0x3a6f85,function(_0x45db84){return db['User'][_0x6109('0x7f')](_0x45db84,{'include':[{'model':db['VoiceMail'],'as':_0x6109('0x6b')}]})[_0x6109('0x23')](function(_0xf38a3f){_0x45db84['id']=_0xf38a3f['id'];return _0x45db84;});});})['then'](function(_0x52b419){if(_0x4e16e7[_0x6109('0x5a')][_0x6109('0x5b')]===_0x6109('0x78'))return _0x52b419;if(_0x4e16e7[_0x6109('0x78')][_0x6109('0x5b')]!==_0x6109('0x78'))return _0x52b419;var _0x147cf7=_[_0x6109('0x82')](_0x52b419,function(_0x6eeaaa){return _0x6eeaaa[_0x6109('0x5b')]===_0x6109('0x28')||_0x6eeaaa[_0x6109('0x5b')]===_0x6109('0x2a');});if(!_0x147cf7)return _0x52b419;return db['UserProfileSection'][_0x6109('0x43')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x4e16e7['user'][_0x6109('0x7d')]},'raw':!![]})[_0x6109('0x23')](function(_0x504fad){if(_['isEmpty'](_0x504fad)||!_[_0x6109('0x82')](_0x504fad,['autoAssociation',0x0]))return _0x52b419;_0x48e6a2=[];var _0x21e29a=_(_0x504fad)['map'](function(_0x3677e6){if(_0x3677e6[_0x6109('0x85')]===0x1)return;return _0x3677e6[_0x6109('0x32')]===_0x6109('0x86')?_0x6109('0x28'):_0x6109('0x2a');})[_0x6109('0x87')]()[_0x6109('0x2e')]();for(var _0x6e82f=0x0;_0x6e82f<_0x52b419[_0x6109('0x46')];_0x6e82f++){if(!_[_0x6109('0x38')](_0x21e29a,_0x52b419[_0x6e82f][_0x6109('0x5b')]))return;var _0x4bc86a=_0x52b419[_0x6e82f][_0x6109('0x5b')]===_0x6109('0x28')?_0x6109('0x86'):_0x6109('0x29');_0x48e6a2[_0x6109('0x47')](db[_0x6109('0x7e')][_0x6109('0x7f')]({'name':_0x52b419[_0x6e82f][_0x6109('0x32')],'resourceId':_0x52b419[_0x6e82f]['id'],'type':_0x4bc86a,'sectionId':_[_0x6109('0x2f')](_0x504fad,[_0x6109('0x32'),_0x4bc86a])['id']},{}));}return BPromise[_0x6109('0x4e')](_0x48e6a2);});})['then'](respondWithResult(_0x1f637a,0xc9))[_0x6109('0x19')](handleError(_0x1f637a,null));};exports['changePassword']=function(_0x47d018,_0x55f831){if(_0x47d018[_0x6109('0x5a')]['id']){delete _0x47d018[_0x6109('0x5a')]['id'];}return db['User']['find']({'where':{'id':_0x47d018[_0x6109('0x50')]['id']}})[_0x6109('0x23')](function(_0x413167){if(!_0x413167)return null;if(_0x413167['id']===_0x47d018[_0x6109('0x78')]['id']){if(!_0x47d018[_0x6109('0x5a')][_0x6109('0x88')]||!_0x47d018[_0x6109('0x5a')]['newPassword']){throw new db[(_0x6109('0x89'))][(_0x6109('0x8a'))](_0x6109('0x8b'));}if(!_0x413167[_0x6109('0x8c')](_0x47d018[_0x6109('0x5a')][_0x6109('0x88')])){throw new db[(_0x6109('0x89'))][(_0x6109('0x8a'))](_0x6109('0x8d'));}if(_0x47d018['body'][_0x6109('0x88')]===_0x47d018['body'][_0x6109('0x8e')]){throw new db[(_0x6109('0x89'))]['ValidationError'](_0x6109('0x8f'));}}else if(_0x47d018['user'][_0x6109('0x5b')]===_0x6109('0x26')){if(!_0x47d018['body'][_0x6109('0x8e')]){throw new db['Sequelize'][(_0x6109('0x8a'))](_0x6109('0x90'));}}else if(_0x47d018[_0x6109('0x78')][_0x6109('0x5b')]===_0x6109('0x78')){if(!_0x47d018[_0x6109('0x5a')]['newPassword']){throw new db[(_0x6109('0x89'))][(_0x6109('0x8a'))](_0x6109('0x90'));}if(_0x413167[_0x6109('0x5b')]!==_0x6109('0x28')){throw new db[(_0x6109('0x89'))][(_0x6109('0x8a'))]('Unauthorized');}}else{throw new db[(_0x6109('0x89'))][(_0x6109('0x8a'))](_0x6109('0x79'));}return _0x413167;})['then'](handleEntityNotFound(_0x55f831,null))[_0x6109('0x23')](function(_0x2cc5e8){return db['Setting'][_0x6109('0x91')]({'attributes':['id',_0x6109('0x62'),_0x6109('0x92'),_0x6109('0x93')]})[_0x6109('0x23')](function(_0x40213b){if(_0x40213b[_0x6109('0x62')])authService[_0x6109('0x94')](_0x47d018[_0x6109('0x5a')]['newPassword']);if(!_0x40213b[_0x6109('0x92')]||!_0x2cc5e8['previousPasswords'])return _0x2cc5e8;authService[_0x6109('0x95')](_0x47d018[_0x6109('0x5a')][_0x6109('0x8e')],_0x2cc5e8['previousPasswords'],_0x40213b[_0x6109('0x93')]);return _0x2cc5e8;})['then'](saveUpdates({'password':_0x47d018[_0x6109('0x5a')][_0x6109('0x8e')],'passwordResetAt':_0x47d018[_0x6109('0x78')]['id']==_0x47d018[_0x6109('0x50')]['id']?moment():null,'previousPasswords':authService[_0x6109('0x96')](_0x47d018['body'][_0x6109('0x8e')],_0x2cc5e8[_0x6109('0x97')])},null));})[_0x6109('0x23')](respondWithResult(_0x55f831,null))['catch'](handleError(_0x55f831,null));};exports['addQueues']=function(_0x282a34,_0x4fa814){var _0x37a280=_0x282a34[_0x6109('0x5a')][_0x6109('0x98')];return db['User'][_0x6109('0x2f')]({'where':{'id':_0x282a34[_0x6109('0x50')]['id']},'attributes':['id',_0x6109('0x32'),_0x6109('0x5b'),_0x6109('0x99'),_0x6109('0x9a'),_0x6109('0x9b'),_0x6109('0x9c')]})[_0x6109('0x23')](handleEntityNotFound(_0x4fa814,null))[_0x6109('0x23')](function(_0x51edac){if(_0x51edac){if(!utils[_0x6109('0x9d')](_0x37a280)){throw new db[(_0x6109('0x89'))][(_0x6109('0x8a'))](_0x6109('0x9e'));}return _0x51edac[_0x6109('0x9f')+_['capitalize'](_0x37a280[_0x6109('0xa0')]())+_0x6109('0xa1')](_0x282a34[_0x6109('0x5a')][_0x6109('0x5e')],{'penalty':_0x282a34['body'][_0x6109('0xa2')]||0x0})[_0x6109('0xa3')](function(_0x20fc18){for(var _0x35b97e=0x0;_0x35b97e<_0x282a34[_0x6109('0x5a')][_0x6109('0x5e')][_0x6109('0x46')];_0x35b97e+=0x1){var _0x14883b={'UserId':Number(_0x282a34[_0x6109('0x50')]['id'])};_0x14883b[_[_0x6109('0xa4')](_0x37a280[_0x6109('0xa0')]())+'QueueId']=Number(_0x282a34['body']['ids'][_0x35b97e]);socket['emit']('user'+_['capitalize'](_0x37a280[_0x6109('0xa0')]())+_0x6109('0xa5'),_0x14883b);}return _0x20fc18;})[_0x6109('0x23')](function(){if(_0x37a280===_0x6109('0xa6')){return db['VoiceQueue']['findAll']({'where':{'id':_0x282a34[_0x6109('0x5a')][_0x6109('0x5e')]||[]},'raw':!![],'attributes':['id',_0x6109('0x32')]});}})[_0x6109('0x23')](function(_0x52fc60){var _0x1c13f9=_0x51edac[_0x6109('0x25')]({'plain':!![]});var _0x4aa783=[];if(_0x37a280===_0x6109('0xa6')&&_0x1c13f9[_0x6109('0x5b')]===_0x6109('0x28')&&_0x1c13f9[_0x6109('0x99')]){for(var _0x5d7077=0x0;_0x5d7077<_0x52fc60[_0x6109('0x46')];_0x5d7077+=0x1){_0x4aa783[_0x6109('0x47')]({'membername':_0x1c13f9[_0x6109('0x32')],'UserId':_0x1c13f9['id'],'queue_name':_0x52fc60[_0x5d7077]['name'],'VoiceQueueId':_0x52fc60[_0x5d7077]['id'],'interface':_[_0x6109('0x64')](_0x1c13f9[_0x6109('0x9c')])?util[_0x6109('0xa7')](_0x6109('0xa8'),_0x1c13f9[_0x6109('0x32')]):_0x1c13f9[_0x6109('0x9c')],'paused':_0x1c13f9[_0x6109('0x9b')]||![],'penalty':_0x282a34[_0x6109('0x5a')][_0x6109('0xa2')]||0x0});}return BPromise[_0x6109('0x84')](_0x4aa783,function(_0x20b17b){return db[_0x6109('0xa9')][_0x6109('0xaa')](_0x20b17b);});}return _0x51edac;});}})[_0x6109('0x23')](respondWithStatusCode(_0x4fa814,null))[_0x6109('0x19')](handleError(_0x4fa814,null));};exports[_0x6109('0xab')]=function(_0xaec7da,_0x71640e){var _0x58fcc4,_0x105592;return db['User'][_0x6109('0x2f')]({'where':{'id':_0xaec7da[_0x6109('0x50')]['id']},'attributes':['id',_0x6109('0x32'),'role']})[_0x6109('0x23')](handleEntityNotFound(_0x71640e,null))[_0x6109('0x23')](function(_0x24d903){if(_0x24d903){_0x58fcc4=_0x24d903;if(!_0xaec7da['query'][_0x6109('0x98')]||!utils[_0x6109('0x9d')](_0xaec7da[_0x6109('0x3c')][_0x6109('0x98')])){throw new db[(_0x6109('0x89'))][(_0x6109('0x8a'))](_0x6109('0x9e'));}return _0x24d903[_0x6109('0xac')+_[_0x6109('0xa4')](_0xaec7da[_0x6109('0x3c')][_0x6109('0x98')][_0x6109('0xa0')]())+'Queues'](_0xaec7da[_0x6109('0x3c')]['ids']);}})[_0x6109('0x23')](function(_0x1fddd1){if(_['isArray'](_0xaec7da[_0x6109('0x3c')][_0x6109('0x5e')])){for(var _0x281ec9=0x0;_0x281ec9<_0xaec7da[_0x6109('0x3c')][_0x6109('0x5e')][_0x6109('0x46')];_0x281ec9+=0x1){_0x105592={'UserId':Number(_0xaec7da[_0x6109('0x50')]['id'])};_0x105592[_[_0x6109('0xa4')](_0xaec7da[_0x6109('0x3c')]['channel']['toLowerCase']())+_0x6109('0xad')]=Number(_0xaec7da[_0x6109('0x3c')][_0x6109('0x5e')][_0x281ec9]);socket[_0x6109('0xae')](_0x6109('0x78')+_[_0x6109('0xa4')](_0xaec7da[_0x6109('0x3c')][_0x6109('0x98')]['toLowerCase']())+'Queue:remove',_0x105592);}}else{_0x105592={'UserId':Number(_0xaec7da['params']['id'])};_0x105592[_['capitalize'](_0xaec7da[_0x6109('0x3c')][_0x6109('0x98')][_0x6109('0xa0')]())+_0x6109('0xad')]=Number(_0xaec7da['query']['ids']);socket['emit'](_0x6109('0x78')+_['capitalize'](_0xaec7da[_0x6109('0x3c')][_0x6109('0x98')]['toLowerCase']())+_0x6109('0xaf'),_0x105592);}return _0x1fddd1;})['then'](function(){if(_0xaec7da['query'][_0x6109('0x98')]==='voice'){return db[_0x6109('0xa9')]['destroy']({'where':{'UserId':_0xaec7da['params']['id'],'VoiceQueueId':_0xaec7da[_0x6109('0x3c')][_0x6109('0x5e')]},'individualHooks':!![]})[_0x6109('0x23')](function(){return _0x58fcc4;});}return _0x58fcc4;})[_0x6109('0x23')](respondWithStatusCode(_0x71640e,null))[_0x6109('0x19')](handleError(_0x71640e,null));};exports[_0x6109('0xb0')]=function(_0x5f314a,_0xe8b9e9){_0x5f314a[_0x6109('0x5a')][_0x6109('0xb1')]=_0x5f314a[_0x6109('0xb2')][_0x6109('0xb3')];return db['User'][_0x6109('0x2f')]({'where':{'id':_0x5f314a[_0x6109('0x50')]['id']}})[_0x6109('0x23')](handleEntityNotFound(_0xe8b9e9,null))[_0x6109('0x23')](saveUpdates(_0x5f314a[_0x6109('0x5a')],null))[_0x6109('0x23')](respondWithResult(_0xe8b9e9,null))[_0x6109('0x19')](handleError(_0xe8b9e9,null));};exports[_0x6109('0xb4')]=function(_0x9f8ae5,_0x134845){var _0x2f5398=path[_0x6109('0xb5')](config[_0x6109('0xb6')],_0x6109('0xb7'));return db['User'][_0x6109('0x2f')]({'where':{'id':_0x9f8ae5[_0x6109('0x50')]['id']},'attributes':['id',_0x6109('0xb1')],'raw':!![]})[_0x6109('0x23')](handleEntityNotFound(_0x134845,null))[_0x6109('0x23')](function(_0x541cac){if(_0x541cac){if(_[_0x6109('0x64')](_0x541cac[_0x6109('0xb1')])){return _0x134845[_0x6109('0xb8')](_0x2f5398);}else{if(!fs['existsSync'](path['join'](config[_0x6109('0xb6')],_0x6109('0xb9'),_0x541cac[_0x6109('0xb1')]))){return _0x134845['download'](_0x2f5398);}return _0x134845[_0x6109('0xb8')](path['join'](config[_0x6109('0xb6')],_0x6109('0xb9'),_0x541cac[_0x6109('0xb1')]));}}})[_0x6109('0x19')](handleError(_0x134845,null));};exports['getOpenTabs']=function(_0x2635b6,_0x494890){return db[_0x6109('0x35')][_0x6109('0x2f')]({'where':{'id':_0x2635b6['params']['id']},'attributes':['id']})[_0x6109('0x23')](handleEntityNotFound(_0x494890,null))[_0x6109('0x23')](function(_0x1e0db1){var _0x28d2ab=[];values=_0x1e0db1[_0x6109('0x4a')];_0x28d2ab[_0x6109('0x47')](get_open_tabs('chat',_0x1e0db1[_0x6109('0x4a')]));_0x28d2ab['push'](get_open_tabs(_0x6109('0x49'),_0x1e0db1[_0x6109('0x4a')]));_0x28d2ab[_0x6109('0x47')](get_open_tabs('openchannel',_0x1e0db1[_0x6109('0x4a')]));_0x28d2ab[_0x6109('0x47')](get_open_tabs(_0x6109('0x4d'),_0x1e0db1[_0x6109('0x4a')]));_0x28d2ab[_0x6109('0x47')](get_open_tabs(_0x6109('0x4b'),_0x1e0db1[_0x6109('0x4a')]));_0x28d2ab[_0x6109('0x47')](get_open_tabs(_0x6109('0x59'),_0x1e0db1['dataValues']));return BPromise[_0x6109('0x4e')](_0x28d2ab);})[_0x6109('0x23')](function(_0x5ac36c){if(_0x5ac36c){var _0x50c666=_[_0x6109('0x2d')](values[_0x6109('0xba')],function(_0x2371bb){return{'channel':_0x6109('0xbb'),'id':_0x2371bb['id'],'createdAt':_0x2371bb[_0x6109('0xbc')]};});var _0x9c6fd2=_[_0x6109('0x2d')](values['FaxOpenTabs'],function(_0x3cc160){return{'channel':_0x6109('0xbd'),'id':_0x3cc160['id'],'createdAt':_0x3cc160[_0x6109('0xbc')]};});var _0x5aa2ab=_[_0x6109('0x2d')](values[_0x6109('0xbe')],function(_0x14136d){return{'channel':_0x6109('0xbf'),'id':_0x14136d['id'],'createdAt':_0x14136d[_0x6109('0xbc')]};});var _0x48e912=_[_0x6109('0x2d')](values[_0x6109('0xc0')],function(_0x4b01cf){return{'channel':_0x6109('0xc1'),'id':_0x4b01cf['id'],'createdAt':_0x4b01cf[_0x6109('0xbc')]};});var _0x3eef3e=_[_0x6109('0x2d')](values['SmsOpenTabs'],function(_0x4459e9){return{'channel':'SMS','id':_0x4459e9['id'],'createdAt':_0x4459e9[_0x6109('0xbc')]};});var _0x4b1c4a=_['map'](values[_0x6109('0xc2')],function(_0x4c8a35){return{'channel':'WHATSAPP','id':_0x4c8a35['id'],'createdAt':_0x4c8a35[_0x6109('0xbc')]};});var _0x5f38a3=_[_0x6109('0xc3')](_0x50c666,_0x9c6fd2,_0x5aa2ab,_0x48e912,_0x3eef3e,_0x4b1c4a);var _0x4b4999={'count':_0x5f38a3[_0x6109('0x46')],'rows':_0x5f38a3};return _0x4b4999;}else return null;})[_0x6109('0x23')](respondWithResult(_0x494890,null))[_0x6109('0x19')](handleError(_0x494890,null));};exports[_0x6109('0xc4')]=function(_0x393418,_0x8391d8){var _0x4a47ed={};var _0x1d9a3b={};var _0x45656a;var _0x25421f;return db['User'][_0x6109('0x91')]({'where':{'id':_0x393418[_0x6109('0x50')]['id']}})['then'](handleEntityNotFound(_0x8391d8,null))[_0x6109('0x23')](function(_0x42fd77){if(_0x42fd77){_0x45656a=_0x42fd77;_0x1d9a3b['model']=_[_0x6109('0x52')](db[_0x6109('0xc5')][_0x6109('0x36')]);_0x1d9a3b['query']=_[_0x6109('0x52')](_0x393418[_0x6109('0x3c')]);_0x1d9a3b[_0x6109('0x53')]=_['intersection'](_0x1d9a3b[_0x6109('0x55')],_0x1d9a3b['query']);_0x4a47ed[_0x6109('0x42')]=_['intersection'](_0x1d9a3b[_0x6109('0x55')],qs[_0x6109('0x56')](_0x393418['query'][_0x6109('0x56')]));_0x4a47ed['attributes']=_0x4a47ed[_0x6109('0x42')][_0x6109('0x46')]?_0x4a47ed[_0x6109('0x42')]:_0x1d9a3b['model'];_0x4a47ed[_0x6109('0xc6')]=qs['sort'](_0x393418[_0x6109('0x3c')]['sort']);_0x4a47ed[_0x6109('0xc7')]=qs['filters'](_['pick'](_0x393418[_0x6109('0x3c')],_0x1d9a3b[_0x6109('0x53')]));if(_0x393418[_0x6109('0x3c')][_0x6109('0x2b')]){_0x4a47ed[_0x6109('0xc7')]=_[_0x6109('0x57')](_0x4a47ed[_0x6109('0xc7')],{'$or':_[_0x6109('0x2d')](_0x4a47ed[_0x6109('0x42')],function(_0x19a883){var _0x43f69f={};_0x43f69f[_0x19a883]={'$like':'%'+_0x393418['query'][_0x6109('0x2b')]+'%'};return _0x43f69f;})});}_0x4a47ed=_[_0x6109('0x57')]({},_0x4a47ed,_0x393418[_0x6109('0x58')]);return _0x45656a['getContacts'](_0x4a47ed);}})[_0x6109('0x23')](function(_0x466cbc){if(_0x466cbc){_0x25421f=_0x466cbc['length'];if(_0x393418[_0x6109('0x3c')][_0x6109('0xc8')](_0x6109('0x3d'))){_0x4a47ed[_0x6109('0x3e')]=[{'model':db[_0x6109('0xc9')],'as':_0x6109('0xca'),'required':![]},{'model':db[_0x6109('0xcb')],'as':'Tags','attributes':['id',_0x6109('0x32'),'color'],'where':_0x393418[_0x6109('0x3c')][_0x6109('0xcc')]?{'id':_0x393418[_0x6109('0x3c')]['tag']}:undefined,'required':_0x393418[_0x6109('0x3c')][_0x6109('0xcc')]?!![]:![]}];}if(!_0x393418[_0x6109('0x3c')][_0x6109('0xc8')]('nolimit')){_0x4a47ed['limit']=qs[_0x6109('0xcd')](_0x393418[_0x6109('0x3c')][_0x6109('0xcd')]);_0x4a47ed[_0x6109('0x1d')]=qs[_0x6109('0x1d')](_0x393418[_0x6109('0x3c')][_0x6109('0x1d')]);}return _0x45656a[_0x6109('0xc4')](_0x4a47ed);}})[_0x6109('0x23')](function(_0x221a10){if(_0x221a10){return _0x221a10?{'count':_0x25421f,'rows':_0x221a10}:null;}})[_0x6109('0x23')](respondWithResult(_0x8391d8,null))[_0x6109('0x19')](handleError(_0x8391d8,null));};exports[_0x6109('0xce')]=function(_0x31f7d3,_0xa1f3ff){var _0x102c2e;var _0x103d93={};var _0x32b766;return db['User'][_0x6109('0x91')]({'where':{'id':_0x31f7d3[_0x6109('0x50')]['id']},'attributes':['id','name','role']})[_0x6109('0x23')](handleEntityNotFound(_0xa1f3ff,null))[_0x6109('0x23')](function(_0x251ea8){if(!utils[_0x6109('0x9d')](_0x31f7d3[_0x6109('0x3c')][_0x6109('0x98')])){throw new db[(_0x6109('0x89'))][(_0x6109('0x8a'))](_0x6109('0x9e'));}_0x102c2e=_0x251ea8;var _0x1690eb={};_0x1690eb['model']=_['keys'](db[_[_0x6109('0xa4')](_0x31f7d3[_0x6109('0x3c')]['channel'])+_0x6109('0xcf')]['rawAttributes']);_0x1690eb['query']=_[_0x6109('0x52')](_0x31f7d3['query']);_0x1690eb[_0x6109('0x53')]=_[_0x6109('0x54')](_0x1690eb[_0x6109('0x55')],_0x1690eb[_0x6109('0x3c')]);_0x103d93[_0x6109('0x42')]=_[_0x6109('0x54')](_0x1690eb['model'],qs['fields'](_0x31f7d3[_0x6109('0x3c')][_0x6109('0x56')]));_0x103d93[_0x6109('0x42')]=_0x103d93[_0x6109('0x42')][_0x6109('0x46')]?_0x103d93['attributes']:_0x1690eb[_0x6109('0x55')];_0x103d93[_0x6109('0xc6')]=qs[_0x6109('0xd0')](_0x31f7d3[_0x6109('0x3c')][_0x6109('0xd0')]);_0x103d93[_0x6109('0xc7')]=qs[_0x6109('0x53')](_['pick'](_0x31f7d3['query'],_0x1690eb[_0x6109('0x53')]));if(_0x31f7d3[_0x6109('0x3c')][_0x6109('0x2b')]){_0x103d93[_0x6109('0xc7')]=_[_0x6109('0x57')](_0x103d93[_0x6109('0xc7')],{'$or':_[_0x6109('0x2d')](_0x103d93[_0x6109('0x42')],function(_0x50d499){var _0x5727cf={};_0x5727cf[_0x50d499]={'$like':'%'+_0x31f7d3['query'][_0x6109('0x2b')]+'%'};return _0x5727cf;})});}_0x103d93=_['merge']({},_0x103d93,_0x31f7d3['options']);switch(_0x102c2e[_0x6109('0x5b')]){case _0x6109('0x26'):return db[_['capitalize'](_0x31f7d3[_0x6109('0x3c')]['channel'])+'Queue']['findAll'](_0x103d93);case _0x6109('0x78'):case _0x6109('0x28'):return _0x102c2e[_0x6109('0x25')+_[_0x6109('0xa4')](_0x31f7d3[_0x6109('0x3c')]['channel'])+'Queues'](_0x103d93);default:throw new db['Sequelize']['ValidationError'](_0x6109('0xd1'));}})['then'](function(_0x14466d){_0x32b766=_0x14466d[_0x6109('0x46')];if(!_0x31f7d3['query'][_0x6109('0xc8')]('nolimit')){_0x103d93[_0x6109('0xcd')]=qs[_0x6109('0xcd')](_0x31f7d3[_0x6109('0x3c')][_0x6109('0xcd')]);_0x103d93[_0x6109('0x1d')]=qs[_0x6109('0x1d')](_0x31f7d3[_0x6109('0x3c')][_0x6109('0x1d')]);}switch(_0x102c2e[_0x6109('0x5b')]){case _0x6109('0x26'):return db[_[_0x6109('0xa4')](_0x31f7d3[_0x6109('0x3c')][_0x6109('0x98')])+_0x6109('0xcf')]['findAll'](_0x103d93);case _0x6109('0x78'):case'agent':return _0x102c2e[_0x6109('0x25')+_[_0x6109('0xa4')](_0x31f7d3[_0x6109('0x3c')][_0x6109('0x98')])+_0x6109('0xa1')](_0x103d93);}})[_0x6109('0x23')](function(_0x35aead){return{'count':_0x32b766,'rows':_0x35aead};})['then'](respondWithResult(_0xa1f3ff,null))[_0x6109('0x19')](handleError(_0xa1f3ff,null));};exports['getVoiceQueuesRt']=function(_0x3649ba,_0x1592ce){var _0x5a158a={};var _0x3a7c2b={};var _0x407348;var _0x327bbd;return db[_0x6109('0x35')][_0x6109('0x91')]({'where':{'id':_0x3649ba['params']['id']}})[_0x6109('0x23')](handleEntityNotFound(_0x1592ce,null))[_0x6109('0x23')](function(_0x3c82df){if(_0x3c82df){_0x407348=_0x3c82df;_0x3a7c2b[_0x6109('0x55')]=_['keys'](db[_0x6109('0xa9')][_0x6109('0x36')]);_0x3a7c2b[_0x6109('0x3c')]=_[_0x6109('0x52')](_0x3649ba['query']);_0x3a7c2b['filters']=_[_0x6109('0x54')](_0x3a7c2b[_0x6109('0x55')],_0x3a7c2b['query']);_0x5a158a['attributes']=_['intersection'](_0x3a7c2b[_0x6109('0x55')],qs[_0x6109('0x56')](_0x3649ba[_0x6109('0x3c')][_0x6109('0x56')]));_0x5a158a[_0x6109('0x42')]=_0x5a158a['attributes']['length']?_0x5a158a['attributes']:_0x3a7c2b[_0x6109('0x55')];_0x5a158a['order']=qs[_0x6109('0xd0')](_0x3649ba[_0x6109('0x3c')][_0x6109('0xd0')]);_0x5a158a[_0x6109('0xc7')]=qs[_0x6109('0x53')](_['pick'](_0x3649ba[_0x6109('0x3c')],_0x3a7c2b[_0x6109('0x53')]));if(_0x3649ba['query'][_0x6109('0x2b')]){_0x5a158a[_0x6109('0xc7')]=_[_0x6109('0x57')](_0x5a158a[_0x6109('0xc7')],{'$or':_[_0x6109('0x2d')](_0x5a158a[_0x6109('0x42')],function(_0x1c1301){var _0x43e545={};_0x43e545[_0x1c1301]={'$like':'%'+_0x3649ba[_0x6109('0x3c')]['filter']+'%'};return _0x43e545;})});}_0x5a158a=_[_0x6109('0x57')]({},_0x5a158a,_0x3649ba[_0x6109('0x58')]);return _0x407348[_0x6109('0xd2')](_0x5a158a);}})[_0x6109('0x23')](function(_0x4ede95){if(_0x4ede95){_0x327bbd=_0x4ede95[_0x6109('0x46')];if(!_0x3649ba[_0x6109('0x3c')][_0x6109('0xc8')](_0x6109('0xd3'))){_0x5a158a['limit']=qs['limit'](_0x3649ba['query'][_0x6109('0xcd')]);_0x5a158a[_0x6109('0x1d')]=qs['offset'](_0x3649ba[_0x6109('0x3c')][_0x6109('0x1d')]);}return _0x407348[_0x6109('0xd2')](_0x5a158a);}})['then'](function(_0x25e0a4){if(_0x25e0a4){return _0x25e0a4?{'count':_0x327bbd,'rows':_0x25e0a4}:null;}})[_0x6109('0x23')](respondWithResult(_0x1592ce,null))[_0x6109('0x19')](handleError(_0x1592ce,null));};exports[_0x6109('0xd4')]=function(_0x5f3cb3,_0x4c3451){var _0x418d77={};var _0x4bad5e={};var _0x5cc53a;var _0x1c35a;return db[_0x6109('0x35')][_0x6109('0x91')]({'where':{'id':_0x5f3cb3[_0x6109('0x50')]['id']}})[_0x6109('0x23')](handleEntityNotFound(_0x4c3451,null))[_0x6109('0x23')](function(_0x4dc533){if(_0x4dc533){_0x5cc53a=_0x4dc533;_0x4bad5e[_0x6109('0x55')]=_[_0x6109('0x52')](db['ChatGroup'][_0x6109('0x36')]);_0x4bad5e[_0x6109('0x3c')]=_[_0x6109('0x52')](_0x5f3cb3[_0x6109('0x3c')]);_0x4bad5e['filters']=_[_0x6109('0x54')](_0x4bad5e[_0x6109('0x55')],_0x4bad5e['query']);_0x418d77[_0x6109('0x42')]=_[_0x6109('0x54')](_0x4bad5e[_0x6109('0x55')],qs[_0x6109('0x56')](_0x5f3cb3[_0x6109('0x3c')]['fields']));_0x418d77[_0x6109('0x42')]=_0x418d77[_0x6109('0x42')][_0x6109('0x46')]?_0x418d77['attributes']:_0x4bad5e['model'];_0x418d77['order']=qs['sort'](_0x5f3cb3[_0x6109('0x3c')]['sort']);_0x418d77[_0x6109('0xc7')]=qs[_0x6109('0x53')](_[_0x6109('0xd5')](_0x5f3cb3[_0x6109('0x3c')],_0x4bad5e['filters']));if(_0x5f3cb3[_0x6109('0x3c')]['filter']){_0x418d77[_0x6109('0xc7')]=_[_0x6109('0x57')](_0x418d77['where'],{'$or':_[_0x6109('0x2d')](_0x418d77[_0x6109('0x42')],function(_0xcbe5f4){var _0x25a018={};_0x25a018[_0xcbe5f4]={'$like':'%'+_0x5f3cb3['query']['filter']+'%'};return _0x25a018;})});}_0x418d77=_[_0x6109('0x57')]({},_0x418d77,_0x5f3cb3[_0x6109('0x58')]);return _0x5cc53a[_0x6109('0xd4')](_0x418d77);}})[_0x6109('0x23')](function(_0xe54c05){if(_0xe54c05){_0x1c35a=_0xe54c05[_0x6109('0x46')];if(!_0x5f3cb3[_0x6109('0x3c')]['hasOwnProperty'](_0x6109('0xd3'))){_0x418d77[_0x6109('0xcd')]=qs[_0x6109('0xcd')](_0x5f3cb3[_0x6109('0x3c')]['limit']);_0x418d77[_0x6109('0x1d')]=qs[_0x6109('0x1d')](_0x5f3cb3[_0x6109('0x3c')][_0x6109('0x1d')]);}return _0x5cc53a['getGroups'](_0x418d77);}})[_0x6109('0x23')](function(_0x38f15a){if(_0x38f15a){return _0x38f15a?{'count':_0x1c35a,'rows':_0x38f15a}:null;}})[_0x6109('0x23')](respondWithResult(_0x4c3451,null))[_0x6109('0x19')](handleError(_0x4c3451,null));};exports['getRecordings']=function(_0x5c02ac,_0x6b2e52){var _0xf8bbdf={'raw':!![],'where':{}};var _0x4dbfbc={};var _0x2a71d0={'count':0x0,'rows':[]};return db[_0x6109('0x35')]['findOne']({'where':{'id':_0x5c02ac['params']['id']}})[_0x6109('0x23')](handleEntityNotFound(_0x6b2e52,null))[_0x6109('0x23')](function(_0x483261){if(_0x483261){_0x4dbfbc[_0x6109('0x55')]=_[_0x6109('0x52')](db[_0x6109('0xd6')][_0x6109('0x36')]);_0x4dbfbc[_0x6109('0x3c')]=_[_0x6109('0x52')](_0x5c02ac[_0x6109('0x3c')]);_0x4dbfbc[_0x6109('0x53')]=_['intersection'](_0x4dbfbc['model'],_0x4dbfbc[_0x6109('0x3c')]);_0xf8bbdf[_0x6109('0x42')]=_[_0x6109('0x54')](_0x4dbfbc[_0x6109('0x55')],qs[_0x6109('0x56')](_0x5c02ac[_0x6109('0x3c')][_0x6109('0x56')]));_0xf8bbdf['attributes']=_0xf8bbdf[_0x6109('0x42')]['length']?_0xf8bbdf['attributes']:_0x4dbfbc[_0x6109('0x55')];if(!_0x5c02ac['query'][_0x6109('0xc8')](_0x6109('0xd3'))){_0xf8bbdf[_0x6109('0xcd')]=qs[_0x6109('0xcd')](_0x5c02ac[_0x6109('0x3c')]['limit']);_0xf8bbdf['offset']=qs[_0x6109('0x1d')](_0x5c02ac[_0x6109('0x3c')]['offset']);}_0xf8bbdf[_0x6109('0xc6')]=qs[_0x6109('0xd0')](_0x5c02ac[_0x6109('0x3c')][_0x6109('0xd0')]);_0xf8bbdf[_0x6109('0xc7')]=qs['filters'](_[_0x6109('0xd5')](_0x5c02ac[_0x6109('0x3c')],_0x4dbfbc[_0x6109('0x53')]));_0xf8bbdf['where'][_0x6109('0xd7')]=_0x483261['id'];if(_0x5c02ac[_0x6109('0x3c')][_0x6109('0x2b')]){_0xf8bbdf[_0x6109('0xc7')]=_[_0x6109('0x57')](_0xf8bbdf[_0x6109('0xc7')],{'$or':_[_0x6109('0x2d')](_0xf8bbdf['attributes'],function(_0x475ade){var _0x593846={};_0x593846[_0x475ade]={'$like':'%'+_0x5c02ac[_0x6109('0x3c')][_0x6109('0x2b')]+'%'};return _0x593846;})});}_0xf8bbdf=_[_0x6109('0x57')]({},_0xf8bbdf,_0x5c02ac[_0x6109('0x58')]);return db[_0x6109('0xd6')]['count']({'where':_0xf8bbdf[_0x6109('0xc7')]})['then'](function(_0xaf1c20){_0x2a71d0[_0x6109('0x1f')]=_0xaf1c20;if(_0x5c02ac['query'][_0x6109('0x3d')]){_0xf8bbdf[_0x6109('0x3e')]=[{'all':!![]}];}return db[_0x6109('0xd6')][_0x6109('0x43')](_0xf8bbdf);})[_0x6109('0x23')](function(_0x3099f0){_0x2a71d0[_0x6109('0x44')]=_0x3099f0;return _0x2a71d0;});}})[_0x6109('0x23')](respondWithFilteredResult(_0x6b2e52,_0xf8bbdf))['catch'](handleError(_0x6b2e52,null));};exports[_0x6109('0xd8')]=function(_0x583c3f,_0x586fcc){var _0xcf7c2c={'raw':!![],'where':{}};var _0x232ad5={};var _0x590d78={'count':0x0,'rows':[]};return db[_0x6109('0x35')][_0x6109('0x91')]({'where':{'id':_0x583c3f[_0x6109('0x50')]['id']}})[_0x6109('0x23')](handleEntityNotFound(_0x586fcc,null))[_0x6109('0x23')](function(_0x2e88d7){if(_0x2e88d7){_0x232ad5['model']=_[_0x6109('0x52')](db['ScreenRecording'][_0x6109('0x36')]);_0x232ad5[_0x6109('0x3c')]=_[_0x6109('0x52')](_0x583c3f['query']);_0x232ad5['filters']=_['intersection'](_0x232ad5[_0x6109('0x55')],_0x232ad5[_0x6109('0x3c')]);_0xcf7c2c[_0x6109('0x42')]=_[_0x6109('0x54')](_0x232ad5[_0x6109('0x55')],qs['fields'](_0x583c3f[_0x6109('0x3c')][_0x6109('0x56')]));_0xcf7c2c[_0x6109('0x42')]=_0xcf7c2c[_0x6109('0x42')][_0x6109('0x46')]?_0xcf7c2c[_0x6109('0x42')]:_0x232ad5[_0x6109('0x55')];if(!_0x583c3f[_0x6109('0x3c')][_0x6109('0xc8')]('nolimit')){_0xcf7c2c['limit']=qs[_0x6109('0xcd')](_0x583c3f['query']['limit']);_0xcf7c2c[_0x6109('0x1d')]=qs[_0x6109('0x1d')](_0x583c3f['query'][_0x6109('0x1d')]);}_0xcf7c2c[_0x6109('0xc6')]=qs[_0x6109('0xd0')](_0x583c3f[_0x6109('0x3c')][_0x6109('0xd0')]);_0xcf7c2c[_0x6109('0xc7')]=qs['filters'](_['pick'](_0x583c3f[_0x6109('0x3c')],_0x232ad5[_0x6109('0x53')]));_0xcf7c2c[_0x6109('0xc7')][_0x6109('0xd7')]=_0x2e88d7['id'];if(_0x583c3f[_0x6109('0x3c')][_0x6109('0x2b')]){_0xcf7c2c[_0x6109('0xc7')]=_[_0x6109('0x57')](_0xcf7c2c[_0x6109('0xc7')],{'$or':_['map'](_0xcf7c2c[_0x6109('0x42')],function(_0x49dfcc){var _0x5e956e={};_0x5e956e[_0x49dfcc]={'$like':'%'+_0x583c3f[_0x6109('0x3c')][_0x6109('0x2b')]+'%'};return _0x5e956e;})});}_0xcf7c2c=_[_0x6109('0x57')]({},_0xcf7c2c,_0x583c3f['options']);return db[_0x6109('0xd9')][_0x6109('0x1f')]({'where':_0xcf7c2c['where']})[_0x6109('0x23')](function(_0x51aeb8){_0x590d78[_0x6109('0x1f')]=_0x51aeb8;if(_0x583c3f[_0x6109('0x3c')][_0x6109('0x3d')]){_0xcf7c2c[_0x6109('0x3e')]=[{'all':!![]}];}return db['ScreenRecording'][_0x6109('0x43')](_0xcf7c2c);})['then'](function(_0x37a945){_0x590d78[_0x6109('0x44')]=_0x37a945;return _0x590d78;});}})[_0x6109('0x23')](respondWithFilteredResult(_0x586fcc,_0xcf7c2c))[_0x6109('0x19')](handleError(_0x586fcc,null));};exports['getChatInteractions']=function(_0x4c4c64,_0x5ba8d5){var _0x2c4f3e={};var _0x2d1ffd={};var _0x476339;var _0x1fa82f;return db['User'][_0x6109('0x91')]({'where':{'id':_0x4c4c64[_0x6109('0x50')]['id']}})[_0x6109('0x23')](handleEntityNotFound(_0x5ba8d5,null))[_0x6109('0x23')](function(_0x292471){if(_0x292471){_0x476339=_0x292471;_0x2d1ffd[_0x6109('0x55')]=_[_0x6109('0x52')](db[_0x6109('0xda')][_0x6109('0x36')]);_0x2d1ffd['query']=_[_0x6109('0x52')](_0x4c4c64['query']);_0x2d1ffd[_0x6109('0x53')]=_['intersection'](_0x2d1ffd[_0x6109('0x55')],_0x2d1ffd['query']);_0x2c4f3e[_0x6109('0x42')]=_[_0x6109('0x54')](_0x2d1ffd[_0x6109('0x55')],qs[_0x6109('0x56')](_0x4c4c64['query'][_0x6109('0x56')]));_0x2c4f3e[_0x6109('0x42')]=_0x2c4f3e['attributes'][_0x6109('0x46')]?_0x2c4f3e[_0x6109('0x42')]:_0x2d1ffd['model'];_0x2c4f3e[_0x6109('0xc6')]=qs[_0x6109('0xd0')](_0x4c4c64[_0x6109('0x3c')][_0x6109('0xd0')]);_0x2c4f3e['where']=qs[_0x6109('0x53')](_['pick'](_0x4c4c64[_0x6109('0x3c')],_0x2d1ffd['filters']));if(_0x4c4c64[_0x6109('0x3c')]['filter']){_0x2c4f3e['where']=_['merge'](_0x2c4f3e[_0x6109('0xc7')],{'$or':_[_0x6109('0x2d')](_0x2c4f3e['attributes'],function(_0x515434){var _0x47bb0c={};_0x47bb0c[_0x515434]={'$like':'%'+_0x4c4c64['query'][_0x6109('0x2b')]+'%'};return _0x47bb0c;})});}_0x2c4f3e=_[_0x6109('0x57')]({},_0x2c4f3e,_0x4c4c64[_0x6109('0x58')]);return _0x476339['getChatInteractions'](_0x2c4f3e);}})[_0x6109('0x23')](function(_0x47f0ac){if(_0x47f0ac){_0x1fa82f=_0x47f0ac[_0x6109('0x46')];if(!_0x4c4c64[_0x6109('0x3c')][_0x6109('0xc8')](_0x6109('0xd3'))){_0x2c4f3e[_0x6109('0xcd')]=qs['limit'](_0x4c4c64['query'][_0x6109('0xcd')]);_0x2c4f3e[_0x6109('0x1d')]=qs[_0x6109('0x1d')](_0x4c4c64[_0x6109('0x3c')]['offset']);}return _0x476339[_0x6109('0xdb')](_0x2c4f3e);}})['then'](function(_0x136848){if(_0x136848){return _0x136848?{'count':_0x1fa82f,'rows':_0x136848}:null;}})[_0x6109('0x23')](respondWithResult(_0x5ba8d5,null))[_0x6109('0x19')](handleError(_0x5ba8d5,null));};exports[_0x6109('0xdc')]=function(_0x4b9ba7,_0x560fa6){var _0x551256={};var _0x4e16a7={};var _0x4a1cde;var _0x4cf15e;return db[_0x6109('0x35')][_0x6109('0x91')]({'where':{'id':_0x4b9ba7['params']['id']}})['then'](handleEntityNotFound(_0x560fa6,null))[_0x6109('0x23')](function(_0x5ca88e){if(_0x5ca88e){_0x4a1cde=_0x5ca88e;_0x4e16a7['model']=_[_0x6109('0x52')](db[_0x6109('0xdd')]['rawAttributes']);_0x4e16a7[_0x6109('0x3c')]=_[_0x6109('0x52')](_0x4b9ba7[_0x6109('0x3c')]);_0x4e16a7[_0x6109('0x53')]=_[_0x6109('0x54')](_0x4e16a7[_0x6109('0x55')],_0x4e16a7[_0x6109('0x3c')]);_0x551256[_0x6109('0x42')]=_['intersection'](_0x4e16a7[_0x6109('0x55')],qs['fields'](_0x4b9ba7['query'][_0x6109('0x56')]));_0x551256[_0x6109('0x42')]=_0x551256[_0x6109('0x42')][_0x6109('0x46')]?_0x551256[_0x6109('0x42')]:_0x4e16a7[_0x6109('0x55')];_0x551256[_0x6109('0xc6')]=qs['sort'](_0x4b9ba7['query'][_0x6109('0xd0')]);_0x551256[_0x6109('0xc7')]=qs[_0x6109('0x53')](_[_0x6109('0xd5')](_0x4b9ba7[_0x6109('0x3c')],_0x4e16a7[_0x6109('0x53')]));if(_0x4b9ba7[_0x6109('0x3c')][_0x6109('0x2b')]){_0x551256[_0x6109('0xc7')]=_['merge'](_0x551256['where'],{'$or':_[_0x6109('0x2d')](_0x551256[_0x6109('0x42')],function(_0x54a1cf){var _0x486f81={};_0x486f81[_0x54a1cf]={'$like':'%'+_0x4b9ba7[_0x6109('0x3c')][_0x6109('0x2b')]+'%'};return _0x486f81;})});}_0x551256=_[_0x6109('0x57')]({},_0x551256,_0x4b9ba7['options']);return _0x4a1cde[_0x6109('0xdc')](_0x551256);}})[_0x6109('0x23')](function(_0x32bcaf){if(_0x32bcaf){_0x4cf15e=_0x32bcaf[_0x6109('0x46')];if(!_0x4b9ba7[_0x6109('0x3c')][_0x6109('0xc8')](_0x6109('0xd3'))){_0x551256[_0x6109('0xcd')]=qs[_0x6109('0xcd')](_0x4b9ba7[_0x6109('0x3c')][_0x6109('0xcd')]);_0x551256[_0x6109('0x1d')]=qs[_0x6109('0x1d')](_0x4b9ba7[_0x6109('0x3c')][_0x6109('0x1d')]);}return _0x4a1cde[_0x6109('0xdc')](_0x551256);}})[_0x6109('0x23')](function(_0x4c9154){if(_0x4c9154){return _0x4c9154?{'count':_0x4cf15e,'rows':_0x4c9154}:null;}})['then'](respondWithResult(_0x560fa6,null))[_0x6109('0x19')](handleError(_0x560fa6,null));};exports[_0x6109('0xde')]=function(_0x570e7a,_0x1ca400){var _0x58eb66={'raw':!![],'where':{}};var _0x4c5ebd={};var _0xdbe62={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x570e7a[_0x6109('0x50')]['id']}})[_0x6109('0x23')](handleEntityNotFound(_0x1ca400,null))[_0x6109('0x23')](function(_0x4a68f9){if(_0x4a68f9){_0x4c5ebd['model']=_[_0x6109('0x52')](db[_0x6109('0xdf')]['rawAttributes']);_0x4c5ebd[_0x6109('0x3c')]=_[_0x6109('0x52')](_0x570e7a[_0x6109('0x3c')]);_0x4c5ebd[_0x6109('0x53')]=_[_0x6109('0x54')](_0x4c5ebd[_0x6109('0x55')],_0x4c5ebd[_0x6109('0x3c')]);_0x58eb66[_0x6109('0x42')]=_['intersection'](_0x4c5ebd[_0x6109('0x55')],qs[_0x6109('0x56')](_0x570e7a[_0x6109('0x3c')][_0x6109('0x56')]));_0x58eb66[_0x6109('0x42')]=_0x58eb66[_0x6109('0x42')][_0x6109('0x46')]?_0x58eb66[_0x6109('0x42')]:_0x4c5ebd[_0x6109('0x55')];if(!_0x570e7a[_0x6109('0x3c')]['hasOwnProperty'](_0x6109('0xd3'))){_0x58eb66[_0x6109('0xcd')]=qs['limit'](_0x570e7a['query'][_0x6109('0xcd')]);_0x58eb66[_0x6109('0x1d')]=qs[_0x6109('0x1d')](_0x570e7a[_0x6109('0x3c')][_0x6109('0x1d')]);}_0x58eb66[_0x6109('0xc6')]=qs['sort'](_0x570e7a[_0x6109('0x3c')]['sort']);_0x58eb66[_0x6109('0xc7')]=qs[_0x6109('0x53')](_[_0x6109('0xd5')](_0x570e7a[_0x6109('0x3c')],_0x4c5ebd['filters']));_0x58eb66[_0x6109('0xc7')][_0x6109('0xd7')]=_0x4a68f9['id'];if(_0x570e7a[_0x6109('0x3c')][_0x6109('0x2b')]){_0x58eb66[_0x6109('0xc7')]=_['merge'](_0x58eb66[_0x6109('0xc7')],{'$or':_[_0x6109('0x2d')](_0x58eb66[_0x6109('0x42')],function(_0x198409){var _0x16ebc8={};_0x16ebc8[_0x198409]={'$like':'%'+_0x570e7a['query'][_0x6109('0x2b')]+'%'};return _0x16ebc8;})});}_0x58eb66=_[_0x6109('0x57')]({},_0x58eb66,_0x570e7a[_0x6109('0x58')]);return db[_0x6109('0xdf')][_0x6109('0x1f')]({'where':_0x58eb66[_0x6109('0xc7')]})[_0x6109('0x23')](function(_0x597102){_0xdbe62['count']=_0x597102;if(_0x570e7a[_0x6109('0x3c')][_0x6109('0x3d')]){_0x58eb66[_0x6109('0x3e')]=[{'all':!![]}];}return db[_0x6109('0xdf')][_0x6109('0x43')](_0x58eb66);})[_0x6109('0x23')](function(_0x2b8267){_0xdbe62[_0x6109('0x44')]=_0x2b8267;return _0xdbe62;});}})['then'](respondWithFilteredResult(_0x1ca400,_0x58eb66))[_0x6109('0x19')](handleError(_0x1ca400,null));};exports[_0x6109('0xe0')]=function(_0xe5bb7a,_0x1b55eb){var _0xc6098b={};var _0x3302b7={};var _0x3aed05;var _0x556715;return db[_0x6109('0x35')][_0x6109('0x91')]({'where':{'id':_0xe5bb7a['params']['id']}})[_0x6109('0x23')](handleEntityNotFound(_0x1b55eb,null))['then'](function(_0x5853e8){if(_0x5853e8){_0x3aed05=_0x5853e8;_0x3302b7[_0x6109('0x55')]=_[_0x6109('0x52')](db[_0x6109('0xe1')][_0x6109('0x36')]);_0x3302b7[_0x6109('0x3c')]=_[_0x6109('0x52')](_0xe5bb7a['query']);_0x3302b7[_0x6109('0x53')]=_['intersection'](_0x3302b7[_0x6109('0x55')],_0x3302b7[_0x6109('0x3c')]);_0xc6098b[_0x6109('0x42')]=_[_0x6109('0x54')](_0x3302b7[_0x6109('0x55')],qs[_0x6109('0x56')](_0xe5bb7a[_0x6109('0x3c')][_0x6109('0x56')]));_0xc6098b[_0x6109('0x42')]=_0xc6098b['attributes'][_0x6109('0x46')]?_0xc6098b[_0x6109('0x42')]:_0x3302b7[_0x6109('0x55')];_0xc6098b[_0x6109('0xc6')]=qs[_0x6109('0xd0')](_0xe5bb7a[_0x6109('0x3c')][_0x6109('0xd0')]);_0xc6098b['where']=qs['filters'](_[_0x6109('0xd5')](_0xe5bb7a['query'],_0x3302b7[_0x6109('0x53')]));if(_0xe5bb7a[_0x6109('0x3c')][_0x6109('0x2b')]){_0xc6098b[_0x6109('0xc7')]=_[_0x6109('0x57')](_0xc6098b[_0x6109('0xc7')],{'$or':_[_0x6109('0x2d')](_0xc6098b[_0x6109('0x42')],function(_0x45acfe){var _0x4bd3b7={};_0x4bd3b7[_0x45acfe]={'$like':'%'+_0xe5bb7a[_0x6109('0x3c')][_0x6109('0x2b')]+'%'};return _0x4bd3b7;})});}_0xc6098b=_[_0x6109('0x57')]({},_0xc6098b,_0xe5bb7a[_0x6109('0x58')]);return _0x3aed05[_0x6109('0xe0')](_0xc6098b);}})[_0x6109('0x23')](function(_0x3b167b){if(_0x3b167b){_0x556715=_0x3b167b[_0x6109('0x46')];if(!_0xe5bb7a[_0x6109('0x3c')]['hasOwnProperty'](_0x6109('0xd3'))){_0xc6098b[_0x6109('0xcd')]=qs[_0x6109('0xcd')](_0xe5bb7a['query']['limit']);_0xc6098b[_0x6109('0x1d')]=qs[_0x6109('0x1d')](_0xe5bb7a[_0x6109('0x3c')]['offset']);}return _0x3aed05[_0x6109('0xe0')](_0xc6098b);}})[_0x6109('0x23')](function(_0x4a8f5e){if(_0x4a8f5e){return _0x4a8f5e?{'count':_0x556715,'rows':_0x4a8f5e}:null;}})[_0x6109('0x23')](respondWithResult(_0x1b55eb,null))['catch'](handleError(_0x1b55eb,null));};exports[_0x6109('0xe2')]=function(_0x5b01d0,_0x599856){var _0x229ab5={};var _0x4ad23d={};var _0x2b13a8;var _0x4984bd;return db[_0x6109('0x35')][_0x6109('0x91')]({'where':{'id':_0x5b01d0[_0x6109('0x50')]['id']}})[_0x6109('0x23')](handleEntityNotFound(_0x599856,null))['then'](function(_0x3a6d58){if(_0x3a6d58){_0x2b13a8=_0x3a6d58;_0x4ad23d[_0x6109('0x55')]=_[_0x6109('0x52')](db[_0x6109('0xe3')][_0x6109('0x36')]);_0x4ad23d[_0x6109('0x3c')]=_[_0x6109('0x52')](_0x5b01d0[_0x6109('0x3c')]);_0x4ad23d[_0x6109('0x53')]=_['intersection'](_0x4ad23d['model'],_0x4ad23d[_0x6109('0x3c')]);_0x229ab5[_0x6109('0x42')]=_[_0x6109('0x54')](_0x4ad23d[_0x6109('0x55')],qs[_0x6109('0x56')](_0x5b01d0['query'][_0x6109('0x56')]));_0x229ab5[_0x6109('0x42')]=_0x229ab5[_0x6109('0x42')]['length']?_0x229ab5[_0x6109('0x42')]:_0x4ad23d[_0x6109('0x55')];_0x229ab5[_0x6109('0xc6')]=qs[_0x6109('0xd0')](_0x5b01d0[_0x6109('0x3c')]['sort']);_0x229ab5[_0x6109('0xc7')]=qs[_0x6109('0x53')](_[_0x6109('0xd5')](_0x5b01d0[_0x6109('0x3c')],_0x4ad23d[_0x6109('0x53')]));if(_0x5b01d0[_0x6109('0x3c')]['filter']){_0x229ab5[_0x6109('0xc7')]=_[_0x6109('0x57')](_0x229ab5[_0x6109('0xc7')],{'$or':_[_0x6109('0x2d')](_0x229ab5[_0x6109('0x42')],function(_0x54edcf){var _0x599370={};_0x599370[_0x54edcf]={'$like':'%'+_0x5b01d0[_0x6109('0x3c')][_0x6109('0x2b')]+'%'};return _0x599370;})});}_0x229ab5=_[_0x6109('0x57')]({},_0x229ab5,_0x5b01d0['options']);return _0x2b13a8[_0x6109('0xe2')](_0x229ab5);}})[_0x6109('0x23')](function(_0x6a8395){if(_0x6a8395){_0x4984bd=_0x6a8395[_0x6109('0x46')];if(!_0x5b01d0['query']['hasOwnProperty']('nolimit')){_0x229ab5[_0x6109('0xcd')]=qs[_0x6109('0xcd')](_0x5b01d0[_0x6109('0x3c')][_0x6109('0xcd')]);_0x229ab5[_0x6109('0x1d')]=qs[_0x6109('0x1d')](_0x5b01d0[_0x6109('0x3c')][_0x6109('0x1d')]);}return _0x2b13a8[_0x6109('0xe2')](_0x229ab5);}})[_0x6109('0x23')](function(_0x4d7abb){if(_0x4d7abb){return _0x4d7abb?{'count':_0x4984bd,'rows':_0x4d7abb}:null;}})[_0x6109('0x23')](respondWithResult(_0x599856,null))['catch'](handleError(_0x599856,null));};exports[_0x6109('0xe4')]=function(_0x263876,_0x1583e5){var _0x543286={};var _0x48e6dc={};var _0x433797;var _0x2da89e;return db['User'][_0x6109('0x91')]({'where':{'id':_0x263876[_0x6109('0x50')]['id']}})[_0x6109('0x23')](handleEntityNotFound(_0x1583e5,null))['then'](function(_0x3d74d8){if(_0x3d74d8){_0x433797=_0x3d74d8;_0x48e6dc[_0x6109('0x55')]=_[_0x6109('0x52')](db['WhatsappInteraction'][_0x6109('0x36')]);_0x48e6dc[_0x6109('0x3c')]=_[_0x6109('0x52')](_0x263876['query']);_0x48e6dc[_0x6109('0x53')]=_[_0x6109('0x54')](_0x48e6dc[_0x6109('0x55')],_0x48e6dc[_0x6109('0x3c')]);_0x543286['attributes']=_[_0x6109('0x54')](_0x48e6dc['model'],qs[_0x6109('0x56')](_0x263876[_0x6109('0x3c')][_0x6109('0x56')]));_0x543286[_0x6109('0x42')]=_0x543286[_0x6109('0x42')][_0x6109('0x46')]?_0x543286[_0x6109('0x42')]:_0x48e6dc[_0x6109('0x55')];_0x543286[_0x6109('0xc6')]=qs[_0x6109('0xd0')](_0x263876[_0x6109('0x3c')][_0x6109('0xd0')]);_0x543286[_0x6109('0xc7')]=qs[_0x6109('0x53')](_[_0x6109('0xd5')](_0x263876['query'],_0x48e6dc[_0x6109('0x53')]));if(_0x263876[_0x6109('0x3c')]['filter']){_0x543286[_0x6109('0xc7')]=_['merge'](_0x543286['where'],{'$or':_[_0x6109('0x2d')](_0x543286[_0x6109('0x42')],function(_0x2b240b){var _0x387495={};_0x387495[_0x2b240b]={'$like':'%'+_0x263876[_0x6109('0x3c')][_0x6109('0x2b')]+'%'};return _0x387495;})});}_0x543286=_[_0x6109('0x57')]({},_0x543286,_0x263876[_0x6109('0x58')]);return _0x433797['getWhatsappInteractions'](_0x543286);}})['then'](function(_0x1c289d){if(_0x1c289d){_0x2da89e=_0x1c289d[_0x6109('0x46')];if(!_0x263876[_0x6109('0x3c')][_0x6109('0xc8')](_0x6109('0xd3'))){_0x543286[_0x6109('0xcd')]=qs[_0x6109('0xcd')](_0x263876['query']['limit']);_0x543286['offset']=qs[_0x6109('0x1d')](_0x263876[_0x6109('0x3c')][_0x6109('0x1d')]);}return _0x433797[_0x6109('0xe4')](_0x543286);}})['then'](function(_0x5746f4){if(_0x5746f4){return _0x5746f4?{'count':_0x2da89e,'rows':_0x5746f4}:null;}})[_0x6109('0x23')](respondWithResult(_0x1583e5,null))[_0x6109('0x19')](handleError(_0x1583e5,null));};exports[_0x6109('0xe5')]=function(_0xa9121b,_0x21fd99,_0x40f1d0){var _0x1a0014;var _0x359b29;var _0x46c83b;var _0xe134e1=!_[_0x6109('0x64')](_0xa9121b[_0x6109('0x50')]['id'])?_0xa9121b[_0x6109('0x50')]['id']:!_['isNil'](_0xa9121b[_0x6109('0x78')]['id'])?_0xa9121b[_0x6109('0x78')]['id']:null;return db['User'][_0x6109('0x2f')]({'where':{'id':_0xe134e1,'role':{'$or':[_0x6109('0x26'),_0x6109('0x78'),_0x6109('0x28')]}},'attributes':['id','name',_0x6109('0xe6'),_0x6109('0xe7'),'role','internal','loginInPause']})[_0x6109('0x23')](function(_0x2d983a){if(_0x2d983a){if(_0x2d983a[_0x6109('0x5b')]==='agent'){_0x1a0014=_0x2d983a;if(_0xa9121b[_0x6109('0x5a')]['interface']){_0x46c83b=util[_0x6109('0xa7')](_0x6109('0xe8'),_0x1a0014[_0xa9121b[_0x6109('0x5a')][_0x6109('0x9c')]]);}else if(_0xa9121b['body']['intrf']){_0x46c83b=util[_0x6109('0xa7')](_0x6109('0xa8'),_0xa9121b[_0x6109('0x5a')][_0x6109('0xe9')]);}else{_0x46c83b=util[_0x6109('0xa7')](_0x6109('0xa8'),_0x1a0014[_0x6109('0x32')]);}socket['to'](util[_0x6109('0xa7')](_0x6109('0xea'),_0x1a0014[_0x6109('0x32')]))[_0x6109('0xae')](_0x6109('0xeb'),{'user':{'id':_0x1a0014['id'],'name':_0x1a0014[_0x6109('0x32')]},'ip':_0xa9121b['headers'][_0x6109('0xec')]||_0xa9121b[_0x6109('0xed')]['remoteAddress']||_0xa9121b[_0x6109('0xee')][_0x6109('0xef')]||_0xa9121b[_0x6109('0xed')]['socket'][_0x6109('0xef')]});return db[_0x6109('0xa9')][_0x6109('0x24')]({'where':{'membername':_0x1a0014['name']},'individualHooks':!![]});}}else{throw new db[(_0x6109('0x89'))][(_0x6109('0x8a'))](_0x6109('0xf0'));}})[_0x6109('0x23')](function(){if(_0x1a0014){return _0x1a0014[_0x6109('0xf1')]({'raw':!![]});}})[_0x6109('0x23')](function(_0x1830ee){if(_0x1a0014){var _0x4b6ca8=[];if(_0x1830ee){_0x359b29=_0x1830ee;if(_0x359b29[_0x6109('0x46')]){for(var _0x9fb16a=0x0;_0x9fb16a<_0x359b29[_0x6109('0x46')];_0x9fb16a++){_0x4b6ca8[_0x6109('0x47')]({'membername':_0x1a0014[_0x6109('0x32')],'UserId':_0x1a0014['id'],'queue_name':_0x359b29[_0x9fb16a][_0x6109('0x32')],'VoiceQueueId':_0x359b29[_0x9fb16a]['id'],'interface':_0x46c83b,'paused':_0x1a0014[_0x6109('0x9a')]||![],'penalty':_0x359b29[_0x9fb16a][_0x6109('0xf2')]||0x0});}return BPromise[_0x6109('0x84')](_0x4b6ca8,function(_0x5da8b1){return db[_0x6109('0xa9')][_0x6109('0xaa')](_0x5da8b1);});}}}})[_0x6109('0x23')](function(){if(_0x1a0014){return db[_0x6109('0xf3')][_0x6109('0x43')]({'where':{'membername':_0x1a0014['name'],'exitAt':null}});}})['then'](function(_0x457186){if(_0x1a0014){var _0x4ed576=[];_0x457186['forEach'](function(_0x4eef21){_0x4ed576[_0x6109('0x47')](_0x4eef21[_0x6109('0x22')]({'exitAt':moment()[_0x6109('0xa7')](_0x6109('0xf4'))}));});return BPromise['all'](_0x4ed576);}})[_0x6109('0x23')](function(){if(_0x1a0014){var _0x4d8ac0=[];var _0x445c5f=[];var _0x1f3b6e=utils[_0x6109('0xf5')]();var _0x4b002a={'membername':_0x1a0014[_0x6109('0x32')],'interface':_0x46c83b,'enterAt':moment()[_0x6109('0xa7')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1a0014[_0x6109('0x5b')],'internal':_0x1a0014[_0x6109('0x5f')]};_0x1f3b6e[_0x6109('0xf6')](function(_0x3461af){_0x4d8ac0[_0x6109('0x47')](_[_0x6109('0x57')]({'channel':_0x3461af,'type':_0x6109('0xf7'),'data1':_0xa9121b[_0x6109('0x5a')][_0x6109('0xf8')],'data2':_0x46c83b},_0x4b002a));if(_0x1a0014['loginInPause']){_0x445c5f['push'](_[_0x6109('0x57')]({'channel':_0x3461af,'type':'PAUSE','data1':_0x6109('0xf9')},_0x4b002a));}});return db['MemberReport'][_0x6109('0x81')](_0x4d8ac0[_0x6109('0xc3')](_0x445c5f),{'individualHooks':!![]});}})['then'](function(){if(_0x1a0014){return _0x1a0014['update']({'online':!![],'lastLoginAt':moment()['format'](_0x6109('0xf4')),'voicePause':_0x1a0014[_0x6109('0x9a')]||![],'mailPause':_0x1a0014[_0x6109('0x9a')]||![],'chatPause':_0x1a0014[_0x6109('0x9a')]||![],'faxPause':_0x1a0014[_0x6109('0x9a')]||![],'smsPause':_0x1a0014['loginInPause']||![],'openchannelPause':_0x1a0014[_0x6109('0x9a')]||![],'whatsappPause':_0x1a0014[_0x6109('0x9a')]||![],'pauseType':_0x1a0014[_0x6109('0x9a')]?'LOGININPAUSE':null,'interface':_0x46c83b,'lastPauseAt':moment()[_0x6109('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x6109('0x23')](function(_0x8b8e71){if(_0xa9121b['isMiddleware']){return _0x40f1d0();}else{return BPromise[_0x6109('0xfa')](_0x8b8e71)[_0x6109('0x23')](respondWithResult(_0x21fd99,null));}})['catch'](handleError(_0x21fd99,null));};exports['logout']=function(_0x342649,_0x17b68c){var _0x378f59;return db[_0x6109('0x35')][_0x6109('0x2f')]({'where':{'id':_0x342649[_0x6109('0x50')]['id'],'role':_0x6109('0x28')},'attributes':['id',_0x6109('0x32'),_0x6109('0x5b')]})[_0x6109('0x23')](handleEntityNotFound(_0x17b68c,null))[_0x6109('0x23')](function(_0x10f5f8){if(_0x10f5f8){_0x378f59=_0x10f5f8;return db[_0x6109('0xa9')][_0x6109('0x24')]({'where':{'membername':_0x378f59[_0x6109('0x32')]},'individualHooks':!![]});}})[_0x6109('0x23')](function(){return db[_0x6109('0xf3')][_0x6109('0x43')]({'where':{'membername':_0x378f59[_0x6109('0x32')],'exitAt':null}});})[_0x6109('0x23')](function(_0x3877b4){var _0x66112b=[];_0x3877b4[_0x6109('0xf6')](function(_0x3f9afa){_0x66112b[_0x6109('0x47')](_0x3f9afa[_0x6109('0x22')]({'exitAt':moment()[_0x6109('0xa7')](_0x6109('0xf4'))}));});return BPromise[_0x6109('0x4e')](_0x66112b);})['then'](function(){return _0x378f59[_0x6109('0x22')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x17b68c,null))[_0x6109('0x19')](handleError(_0x17b68c,null));};exports[_0x6109('0xfb')]=function(_0x43d9e0,_0x513a4f){var _0xce2d26;return db[_0x6109('0xa9')][_0x6109('0x22')]({'paused':0x1},{'where':{'UserId':_0x43d9e0[_0x6109('0x50')]['id']},'individualHooks':!![]})[_0x6109('0x23')](function(){return db[_0x6109('0x35')][_0x6109('0x2f')]({'where':{'id':_0x43d9e0[_0x6109('0x50')]['id'],'role':_0x6109('0x28')},'attributes':['id',_0x6109('0x32'),'role','internal','interface']});})[_0x6109('0x23')](handleEntityNotFound(_0x513a4f,null))[_0x6109('0x23')](function(_0x47472b){if(_0x47472b){_0xce2d26=_0x47472b;return respondWithRpcPromise('QueuePause',_0x6109('0xfb'),{'id':_0xce2d26['id'],'name':_0xce2d26[_0x6109('0x32')],'pause':!![]});}})[_0x6109('0x23')](function(){if(_0xce2d26){return db[_0x6109('0xf3')][_0x6109('0x43')]({'where':{'membername':_0xce2d26['name'],'type':_0x6109('0xfc'),'exitAt':null}});}})[_0x6109('0x23')](function(_0x4f8f26){if(_0x4f8f26['length']){var _0x15388d=moment()[_0x6109('0xa7')](_0x6109('0xf4'));for(var _0x28f599=0x0,_0x26a2f6=_0x4f8f26[_0x6109('0x46')];_0x28f599<_0x26a2f6;_0x28f599++){_0x4f8f26[_0x28f599][_0x6109('0xfd')]({'exitAt':_0x15388d});}}})[_0x6109('0x23')](function(){var _0x1d47c7=[];var _0x172f60=utils[_0x6109('0xf5')]();_0x172f60[_0x6109('0xf6')](function(_0xe4a007){_0x1d47c7[_0x6109('0x47')]({'channel':_0xe4a007,'membername':_0xce2d26['name'],'interface':_[_0x6109('0x64')](_0xce2d26['interface'])?util[_0x6109('0xa7')](_0x6109('0xa8'),_0xce2d26[_0x6109('0x32')]):_0xce2d26[_0x6109('0x9c')],'type':_0x6109('0xfc'),'enterAt':moment()[_0x6109('0xa7')](_0x6109('0xf4')),'data1':_0x43d9e0[_0x6109('0x5a')][_0x6109('0xfe')]||_0x6109('0xff'),'role':_0xce2d26[_0x6109('0x5b')],'internal':_0xce2d26[_0x6109('0x5f')]});});return db[_0x6109('0xf3')]['bulkCreate'](_0x1d47c7,{'individualHooks':!![]});})[_0x6109('0x23')](function(){return _0xce2d26['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x43d9e0[_0x6109('0x5a')][_0x6109('0xfe')]||_0x6109('0xff'),'lastPauseAt':moment()[_0x6109('0xa7')](_0x6109('0xf4'))});})[_0x6109('0x23')](respondWithResult(_0x513a4f,null))['catch'](handleError(_0x513a4f,null));};exports['unpause']=function(_0x1506a4,_0x2d7d94){var _0x1e756a;return db[_0x6109('0x35')][_0x6109('0x2f')]({'where':{'id':_0x1506a4['params']['id']},'attributes':['id','name',_0x6109('0x5b'),_0x6109('0x9b'),'mailPause',_0x6109('0x100'),'faxPause',_0x6109('0x101'),_0x6109('0x102'),_0x6109('0x103'),_0x6109('0x104'),'lastPauseAt']})[_0x6109('0x23')](handleEntityNotFound(_0x2d7d94,null))[_0x6109('0x23')](function(_0x5d0803){if(_0x5d0803){_0x1e756a=_0x5d0803;if(_0x1506a4[_0x6109('0x5a')][_0x6109('0x98')]&&!utils[_0x6109('0x9d')](_0x1506a4[_0x6109('0x5a')][_0x6109('0x98')])){throw new db[(_0x6109('0x89'))]['ValidationError'](_0x6109('0x9e'));}switch(_0x1506a4[_0x6109('0x5a')][_0x6109('0x98')]){case _0x6109('0xa6'):return respondWithRpcPromise('QueuePause',_0x6109('0x105'),{'id':_0x1e756a['id'],'name':_0x1e756a['name'],'pause':![]})['then'](function(){return db[_0x6109('0xa9')][_0x6109('0x22')]({'paused':0x0},{'where':{'UserId':_0x1e756a['id']},'individualHooks':!![]});})[_0x6109('0x23')](function(){return db[_0x6109('0xf3')]['find']({'where':{'channel':_0x1506a4['body'][_0x6109('0x98')],'membername':_0x1e756a[_0x6109('0x32')],'type':_0x6109('0xfc'),'exitAt':null}});})[_0x6109('0x23')](function(_0x3cb96a){if(_0x3cb96a){return _0x3cb96a[_0x6109('0x22')]({'exitAt':moment()['format'](_0x6109('0xf4')),'data2':_0x6109('0x106')},{'individualHooks':!![]});}return null;})[_0x6109('0x23')](function(){return _0x1e756a[_0x6109('0x22')]({'voicePause':![]});});case'mail':case _0x6109('0x48'):case _0x6109('0x4b'):case'sms':case'whatsapp':case'openchannel':return db[_0x6109('0xf3')][_0x6109('0x2f')]({'where':{'channel':_0x1506a4[_0x6109('0x5a')]['channel'],'membername':_0x1e756a['name'],'type':_0x6109('0xfc'),'exitAt':null}})[_0x6109('0x23')](function(_0x27f89c){if(_0x27f89c){return _0x27f89c[_0x6109('0x22')]({'exitAt':moment()[_0x6109('0xa7')](_0x6109('0xf4')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){var _0x15ff38={};_[_0x6109('0x20')](_0x15ff38,util['format'](_0x6109('0x107'),_0x1506a4[_0x6109('0x5a')]['channel'],'Pause'),![]);return _0x1e756a[_0x6109('0x22')](_0x15ff38);});default:return respondWithRpcPromise(_0x6109('0x108'),_0x6109('0x105'),{'id':_0x1e756a['id'],'name':_0x1e756a[_0x6109('0x32')],'pause':![]})[_0x6109('0x23')](function(){return db[_0x6109('0xa9')][_0x6109('0x22')]({'paused':0x0},{'where':{'UserId':_0x1e756a['id']}});})[_0x6109('0x23')](function(){return db['MemberReport'][_0x6109('0x43')]({'where':{'membername':_0x1e756a[_0x6109('0x32')],'type':'PAUSE','exitAt':null}});})[_0x6109('0x23')](function(_0x509349){var _0x52deb6=[];_0x509349['forEach'](function(_0x484d54){_0x52deb6[_0x6109('0x47')](_0x484d54['update']({'exitAt':moment()[_0x6109('0xa7')](_0x6109('0xf4')),'data2':_0x6109('0x106')}));});return BPromise[_0x6109('0x4e')](_0x52deb6);})[_0x6109('0x23')](function(){return _0x1e756a['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x6109('0x23')](respondWithResult(_0x2d7d94,null))[_0x6109('0x19')](handleError(_0x2d7d94,null));};exports[_0x6109('0x109')]=function(_0x1abf2e,_0x442907){var _0xd7f08a={};var _0x3321ad={};var _0x2e4d4f;var _0x4748ff;return db[_0x6109('0x35')][_0x6109('0x91')]({'where':{'id':_0x1abf2e[_0x6109('0x50')]['id']}})['then'](handleEntityNotFound(_0x442907,null))[_0x6109('0x23')](function(_0x3c24d2){if(_0x3c24d2){_0x2e4d4f=_0x3c24d2;_0x3321ad[_0x6109('0x55')]=_['keys'](db[_0x6109('0x10a')][_0x6109('0x36')]);_0x3321ad[_0x6109('0x3c')]=_['keys'](_0x1abf2e['query']);_0x3321ad[_0x6109('0x53')]=_['intersection'](_0x3321ad[_0x6109('0x55')],_0x3321ad[_0x6109('0x3c')]);_0xd7f08a[_0x6109('0x42')]=_[_0x6109('0x54')](_0x3321ad[_0x6109('0x55')],qs[_0x6109('0x56')](_0x1abf2e[_0x6109('0x3c')][_0x6109('0x56')]));_0xd7f08a[_0x6109('0x42')]=_0xd7f08a[_0x6109('0x42')][_0x6109('0x46')]?_0xd7f08a[_0x6109('0x42')]:_0x3321ad[_0x6109('0x55')];_0xd7f08a[_0x6109('0xc6')]=qs[_0x6109('0xd0')](_0x1abf2e[_0x6109('0x3c')]['sort']);_0xd7f08a[_0x6109('0xc7')]=qs[_0x6109('0x53')](_['pick'](_0x1abf2e[_0x6109('0x3c')],_0x3321ad['filters']));if(_0x1abf2e[_0x6109('0x3c')][_0x6109('0x2b')]){_0xd7f08a['where']=_[_0x6109('0x57')](_0xd7f08a[_0x6109('0xc7')],{'$or':_['map'](_0xd7f08a[_0x6109('0x42')],function(_0x71de6d){var _0xf473c0={};_0xf473c0[_0x71de6d]={'$like':'%'+_0x1abf2e[_0x6109('0x3c')][_0x6109('0x2b')]+'%'};return _0xf473c0;})});}_0xd7f08a=_[_0x6109('0x57')]({},_0xd7f08a,_0x1abf2e['options']);return _0x2e4d4f[_0x6109('0x109')](_0xd7f08a);}})[_0x6109('0x23')](function(_0x37396d){if(_0x37396d){_0x4748ff=_0x37396d['length'];if(!_0x1abf2e[_0x6109('0x3c')][_0x6109('0xc8')](_0x6109('0xd3'))){_0xd7f08a[_0x6109('0xcd')]=qs['limit'](_0x1abf2e[_0x6109('0x3c')][_0x6109('0xcd')]);_0xd7f08a[_0x6109('0x1d')]=qs[_0x6109('0x1d')](_0x1abf2e[_0x6109('0x3c')][_0x6109('0x1d')]);}return _0x2e4d4f[_0x6109('0x109')](_0xd7f08a);}})[_0x6109('0x23')](function(_0x391851){if(_0x391851){return _0x391851?{'count':_0x4748ff,'rows':_0x391851}:null;}})[_0x6109('0x23')](respondWithResult(_0x442907,null))[_0x6109('0x19')](handleError(_0x442907,null));};exports[_0x6109('0x10b')]=function(_0x34aff1,_0x39fe55){return db['User']['find']({'where':{'id':_0x34aff1[_0x6109('0x50')]['id']}})['then'](handleEntityNotFound(_0x39fe55,null))['then'](function(_0x5cc870){if(_0x5cc870){var _0x59fc37=_0x5cc870[_0x6109('0x25')]({'plain':!![]});return _0x5cc870[_0x6109('0x10b')](_0x34aff1[_0x6109('0x5a')]['ids'],_[_0x6109('0x10c')](_0x34aff1[_0x6109('0x5a')],[_0x6109('0x5e'),'id'])||{})[_0x6109('0x23')](function(){for(var _0x38a721=0x0;_0x38a721<_0x34aff1['body'][_0x6109('0x5e')][_0x6109('0x46')];_0x38a721++){var _0x330b22=[];var _0x3f5682={};db[_0x6109('0x10a')][_0x6109('0x91')]({'where':{'id':_0x34aff1[_0x6109('0x5a')][_0x6109('0x5e')][_0x38a721]}})[_0x6109('0x23')](function(_0x191300){_0x3f5682=_0x191300['dataValues'];_0x330b22[_0x6109('0x47')](_0x191300[_0x6109('0xf1')]()[_0x6109('0x23')](function(_0x12040d){for(var _0x189219=0x0;_0x189219<_0x12040d[_0x6109('0x46')];_0x189219++){_0x12040d[_0x189219]['setDataValue'](_0x6109('0x98'),_0x6109('0x10d'));}return _0x12040d;}));_0x330b22[_0x6109('0x47')](_0x191300['getChatQueues']()[_0x6109('0x23')](function(_0x308871){for(var _0x49f2e5=0x0;_0x49f2e5<_0x308871['length'];_0x49f2e5++){_0x308871[_0x49f2e5][_0x6109('0x10e')](_0x6109('0x98'),_0x6109('0x10f'));}return _0x308871;}));_0x330b22[_0x6109('0x47')](_0x191300[_0x6109('0x110')]()[_0x6109('0x23')](function(_0x571a12){for(var _0x4166f7=0x0;_0x4166f7<_0x571a12['length'];_0x4166f7++){_0x571a12[_0x4166f7]['setDataValue'](_0x6109('0x98'),_0x6109('0x111'));}return _0x571a12;}));_0x330b22[_0x6109('0x47')](_0x191300[_0x6109('0x112')]()['then'](function(_0x194da7){for(var _0x2ca2bd=0x0;_0x2ca2bd<_0x194da7[_0x6109('0x46')];_0x2ca2bd++){_0x194da7[_0x2ca2bd][_0x6109('0x10e')]('channel',_0x6109('0x113'));}return _0x194da7;}));_0x330b22[_0x6109('0x47')](_0x191300[_0x6109('0x114')]()[_0x6109('0x23')](function(_0x4d697e){for(var _0x271859=0x0;_0x271859<_0x4d697e['length'];_0x271859++){_0x4d697e[_0x271859]['setDataValue'](_0x6109('0x98'),_0x6109('0x115'));}return _0x4d697e;}));_0x330b22[_0x6109('0x47')](_0x191300[_0x6109('0x116')]()[_0x6109('0x23')](function(_0x2d7282){for(var _0x5eecea=0x0;_0x5eecea<_0x2d7282[_0x6109('0x46')];_0x5eecea++){_0x2d7282[_0x5eecea]['setDataValue'](_0x6109('0x98'),'Fax');}return _0x2d7282;}));_0x330b22[_0x6109('0x47')](_0x191300['getOpenchannelQueues']()[_0x6109('0x23')](function(_0x47965d){for(var _0x218ff2=0x0;_0x218ff2<_0x47965d[_0x6109('0x46')];_0x218ff2++){_0x47965d[_0x218ff2]['setDataValue'](_0x6109('0x98'),_0x6109('0x117'));}return _0x47965d;}));return BPromise[_0x6109('0x4e')](_0x330b22);})['then'](function(_0x9e3d43){var _0x763c7b=_[_0x6109('0x118')](_0x9e3d43);_0x330b22=[];return db[_0x6109('0x66')][_0x6109('0x119')](function(_0x171bb3){for(var _0x35dc40=0x0;_0x35dc40<_0x763c7b[_0x6109('0x46')];_0x35dc40++){_0x330b22[_0x6109('0x47')](_0x763c7b[_0x35dc40]['addAgent'](_0x59fc37['id']),{'transaction':_0x171bb3});}return BPromise[_0x6109('0x4e')](_0x330b22)['then'](function(){if(_0x59fc37[_0x6109('0x99')]){return BPromise[_0x6109('0x84')](_[_0x6109('0x2b')](_0x763c7b,function(_0x22cddb){return _0x22cddb[_0x6109('0x11a')](_0x6109('0x98'))===_0x6109('0x10d');}),function(_0x2a5b30){return db[_0x6109('0xa9')][_0x6109('0xaa')]({'membername':_0x59fc37['name'],'UserId':_0x59fc37['id'],'queue_name':_0x2a5b30['name'],'VoiceQueueId':_0x2a5b30['id'],'interface':_['isNil'](_0x59fc37['interface'])?util[_0x6109('0xa7')](_0x6109('0xa8'),_0x59fc37[_0x6109('0x32')]):_0x59fc37[_0x6109('0x9c')],'paused':_0x59fc37['voicePause']||![],'penalty':_0x59fc37[_0x6109('0xa2')]},{'transaction':_0x171bb3});});}else{return;}})[_0x6109('0x23')](function(){for(var _0x435815=0x0;_0x435815<_0x763c7b[_0x6109('0x46')];_0x435815++){var _0x352c12=_0x763c7b[_0x435815][_0x6109('0x11a')](_0x6109('0x98'));var _0x3ae39d=_0x352c12+_0x6109('0xad');socket[_0x6109('0xae')](_0x6109('0x78')+_0x352c12+'Queue:save',{'UserId':_0x59fc37['id'],['queueField']:_0x763c7b[_0x435815]['id']});}});});})[_0x6109('0x23')](function(){db[_0x6109('0x11b')]['findOne']({'where':{'teamId':_0x3f5682['id']}})[_0x6109('0x23')](function(_0x4a5da0){if(_0x4a5da0){db[_0x6109('0x11c')][_0x6109('0x7f')]({'UserId':_0x34aff1[_0x6109('0x50')]['id'],'VoicePrefixId':_0x4a5da0[_0x6109('0x11d')]});}});});}});}})[_0x6109('0x23')](respondWithStatusCode(_0x39fe55,null))[_0x6109('0x19')](handleError(_0x39fe55,null));};exports[_0x6109('0x11e')]=function(_0x41d0a2,_0x5791aa){return db[_0x6109('0x35')]['findOne']({'where':{'id':_0x41d0a2[_0x6109('0x50')]['id']}})[_0x6109('0x23')](handleEntityNotFound(_0x5791aa,null))[_0x6109('0x23')](function(_0x3adf42){if(_0x3adf42){var _0x4f84d5=_0x3adf42[_0x6109('0x25')]({'plain':!![]});var _0x4de5bf=_0x41d0a2[_0x6109('0x3c')][_0x6109('0x5e')];return _0x3adf42[_0x6109('0x11e')](_0x4de5bf)['then'](function(){for(var _0x126e67=0x0;_0x126e67<_0x4de5bf[_0x6109('0x46')];_0x126e67++){var _0xfacbf6=[];var _0x3027c0={};db[_0x6109('0x10a')][_0x6109('0x91')]({'where':{'id':_0x4de5bf[_0x126e67]}})[_0x6109('0x23')](function(_0x381582){_0x3027c0=_0x381582[_0x6109('0x4a')];_0xfacbf6[_0x6109('0x47')](_0x381582['getVoiceQueues']()[_0x6109('0x23')](function(_0x2b978c){for(var _0x1ab0c0=0x0;_0x1ab0c0<_0x2b978c[_0x6109('0x46')];_0x1ab0c0++){_0x2b978c[_0x1ab0c0][_0x6109('0x10e')](_0x6109('0x98'),'Voice');}return _0x2b978c;}));_0xfacbf6[_0x6109('0x47')](_0x381582[_0x6109('0x11f')]()['then'](function(_0x1f7c81){for(var _0x519a88=0x0;_0x519a88<_0x1f7c81[_0x6109('0x46')];_0x519a88++){_0x1f7c81[_0x519a88][_0x6109('0x10e')](_0x6109('0x98'),'Chat');}return _0x1f7c81;}));_0xfacbf6[_0x6109('0x47')](_0x381582['getMailQueues']()['then'](function(_0x291641){for(var _0x4ae156=0x0;_0x4ae156<_0x291641[_0x6109('0x46')];_0x4ae156++){_0x291641[_0x4ae156][_0x6109('0x10e')](_0x6109('0x98'),_0x6109('0x111'));}return _0x291641;}));_0xfacbf6[_0x6109('0x47')](_0x381582[_0x6109('0x112')]()['then'](function(_0x37952d){for(var _0x54f3ae=0x0;_0x54f3ae<_0x37952d['length'];_0x54f3ae++){_0x37952d[_0x54f3ae][_0x6109('0x10e')]('channel',_0x6109('0x113'));}return _0x37952d;}));_0xfacbf6[_0x6109('0x47')](_0x381582['getWhatsappQueues']()[_0x6109('0x23')](function(_0x485ef8){for(var _0x9fedcb=0x0;_0x9fedcb<_0x485ef8[_0x6109('0x46')];_0x9fedcb++){_0x485ef8[_0x9fedcb]['setDataValue']('channel',_0x6109('0x115'));}return _0x485ef8;}));_0xfacbf6[_0x6109('0x47')](_0x381582[_0x6109('0x116')]()['then'](function(_0x21f717){for(var _0xd2360f=0x0;_0xd2360f<_0x21f717[_0x6109('0x46')];_0xd2360f++){_0x21f717[_0xd2360f]['setDataValue'](_0x6109('0x98'),_0x6109('0x120'));}return _0x21f717;}));_0xfacbf6[_0x6109('0x47')](_0x381582[_0x6109('0x121')]()['then'](function(_0x427bd2){for(var _0x5a1b19=0x0;_0x5a1b19<_0x427bd2[_0x6109('0x46')];_0x5a1b19++){_0x427bd2[_0x5a1b19][_0x6109('0x10e')]('channel','Openchannel');}return _0x427bd2;}));return BPromise[_0x6109('0x4e')](_0xfacbf6);})[_0x6109('0x23')](function(_0xa88b79){var _0x4adc33=_['flatten'](_0xa88b79);_0xfacbf6=[];return db[_0x6109('0x66')][_0x6109('0x119')](function(_0x56af68){for(var _0x7cc90b=0x0;_0x7cc90b<_0x4adc33[_0x6109('0x46')];_0x7cc90b++){_0xfacbf6[_0x6109('0x47')](_0x4adc33[_0x7cc90b][_0x6109('0x122')](_0x4f84d5['id']),{'transaction':_0x56af68});}return BPromise['all'](_0xfacbf6)['then'](function(){if(_0x4f84d5['online']){return BPromise[_0x6109('0x84')](_['filter'](_0x4adc33,function(_0x4fb6f5){return _0x4fb6f5['getDataValue'](_0x6109('0x98'))===_0x6109('0x10d');}),function(_0x4cbc72){return db[_0x6109('0xa9')][_0x6109('0x24')]({'where':{'VoiceQueueId':_0x4cbc72['id'],'UserId':_0x4f84d5['id']},'transaction':_0x56af68});});}else{return;}})[_0x6109('0x23')](function(){db[_0x6109('0x11b')][_0x6109('0x91')]({'where':{'teamId':_0x3027c0['id']}})[_0x6109('0x23')](function(_0x468774){if(_0x468774){return db[_0x6109('0x11c')][_0x6109('0x24')]({'where':{'UserId':_0x4f84d5['id'],'VoicePrefixId':_0x468774[_0x6109('0x4a')][_0x6109('0x11d')]}});}});})[_0x6109('0x23')](function(){for(var _0x2dc943=0x0;_0x2dc943<_0x4adc33[_0x6109('0x46')];_0x2dc943++){var _0x33b07c=_0x4adc33[_0x2dc943][_0x6109('0x11a')](_0x6109('0x98'));var _0x11b43b=_0x33b07c+_0x6109('0xad');socket[_0x6109('0xae')](_0x6109('0x78')+_0x33b07c+_0x6109('0xaf'),{'UserId':_0x4f84d5['id'],['queueField']:_0x4adc33[_0x2dc943]['id']});}});});});}});}})[_0x6109('0x23')](respondWithStatusCode(_0x5791aa,null))[_0x6109('0x19')](handleError(_0x5791aa,null));};exports['getLists']=function(_0x11d3f0,_0x1f6e92){var _0x163964={};var _0x2e19b7={};var _0x45d768;var _0x3c0a50;return db[_0x6109('0x35')]['findOne']({'where':{'id':_0x11d3f0[_0x6109('0x50')]['id']}})['then'](handleEntityNotFound(_0x1f6e92,null))['then'](function(_0x1c4005){if(_0x1c4005){_0x45d768=_0x1c4005;_0x2e19b7[_0x6109('0x55')]=_['keys'](db[_0x6109('0xc9')]['rawAttributes']);_0x2e19b7[_0x6109('0x3c')]=_[_0x6109('0x52')](_0x11d3f0['query']);_0x2e19b7['filters']=_[_0x6109('0x54')](_0x2e19b7[_0x6109('0x55')],_0x2e19b7[_0x6109('0x3c')]);_0x163964[_0x6109('0x42')]=_[_0x6109('0x54')](_0x2e19b7[_0x6109('0x55')],qs[_0x6109('0x56')](_0x11d3f0['query']['fields']));_0x163964[_0x6109('0x42')]=_0x163964[_0x6109('0x42')][_0x6109('0x46')]?_0x163964[_0x6109('0x42')]:_0x2e19b7[_0x6109('0x55')];_0x163964['order']=qs[_0x6109('0xd0')](_0x11d3f0[_0x6109('0x3c')][_0x6109('0xd0')]);_0x163964[_0x6109('0xc7')]=qs['filters'](_[_0x6109('0xd5')](_0x11d3f0[_0x6109('0x3c')],_0x2e19b7[_0x6109('0x53')]));if(_0x11d3f0[_0x6109('0x3c')][_0x6109('0x2b')]){_0x163964[_0x6109('0xc7')]=_[_0x6109('0x57')](_0x163964[_0x6109('0xc7')],{'$or':_['map'](_0x163964[_0x6109('0x42')],function(_0x324176){var _0x7c8bac={};_0x7c8bac[_0x324176]={'$like':'%'+_0x11d3f0[_0x6109('0x3c')][_0x6109('0x2b')]+'%'};return _0x7c8bac;})});}_0x163964=_[_0x6109('0x57')]({},_0x163964,_0x11d3f0[_0x6109('0x58')]);return _0x45d768[_0x6109('0x123')](_0x163964);}})[_0x6109('0x23')](function(_0x3c93e5){if(_0x3c93e5){_0x3c0a50=_0x3c93e5[_0x6109('0x46')];if(!_0x11d3f0[_0x6109('0x3c')][_0x6109('0xc8')](_0x6109('0xd3'))){_0x163964[_0x6109('0xcd')]=qs[_0x6109('0xcd')](_0x11d3f0[_0x6109('0x3c')]['limit']);_0x163964['offset']=qs[_0x6109('0x1d')](_0x11d3f0[_0x6109('0x3c')][_0x6109('0x1d')]);}return _0x45d768[_0x6109('0x123')](_0x163964);}})[_0x6109('0x23')](function(_0x45f804){if(_0x45f804){return _0x45f804?{'count':_0x3c0a50,'rows':_0x45f804}:null;}})['then'](respondWithResult(_0x1f6e92,null))[_0x6109('0x19')](handleError(_0x1f6e92,null));};exports[_0x6109('0x124')]=function(_0x40bf3d,_0x1923cb){var _0x3faa9c={};var _0x22b370={};var _0x118e2e;return db['User']['findOne']({'where':{'id':_0x40bf3d[_0x6109('0x50')]['id']}})[_0x6109('0x23')](handleEntityNotFound(_0x1923cb,null))['then'](function(_0x27113d){if(_0x27113d){_0x118e2e=_0x27113d;_0x22b370[_0x6109('0x55')]=_[_0x6109('0x52')](db['User'][_0x6109('0x36')]);_0x22b370['query']=_[_0x6109('0x52')](_0x40bf3d[_0x6109('0x3c')]);_0x22b370[_0x6109('0x53')]=_['intersection'](_0x22b370[_0x6109('0x55')],_0x22b370[_0x6109('0x3c')]);_0x3faa9c[_0x6109('0x42')]=_[_0x6109('0x54')](_0x22b370[_0x6109('0x55')],qs['fields'](_0x40bf3d[_0x6109('0x3c')][_0x6109('0x56')]));_0x3faa9c[_0x6109('0x42')]=_0x3faa9c[_0x6109('0x42')]['length']?_0x3faa9c['attributes']:_0x22b370[_0x6109('0x55')];_0x3faa9c[_0x6109('0xc6')]=qs[_0x6109('0xd0')](_0x40bf3d[_0x6109('0x3c')][_0x6109('0xd0')]);_0x3faa9c['where']=qs[_0x6109('0x53')](_[_0x6109('0xd5')](_0x40bf3d[_0x6109('0x3c')],_0x22b370[_0x6109('0x53')]));if(_0x40bf3d[_0x6109('0x3c')][_0x6109('0x2b')]){_0x3faa9c[_0x6109('0xc7')]=_[_0x6109('0x57')](_0x3faa9c[_0x6109('0xc7')],{'$or':_[_0x6109('0x2d')](_0x3faa9c[_0x6109('0x42')],function(_0x2a7505){var _0x357dd9={};_0x357dd9[_0x2a7505]={'$like':'%'+_0x40bf3d[_0x6109('0x3c')][_0x6109('0x2b')]+'%'};return _0x357dd9;})});}_0x3faa9c['model']=db['User'];_0x3faa9c['as']='Agents';_0x3faa9c=_['merge']({},_0x3faa9c,_0x40bf3d['options']);return _0x118e2e[_0x6109('0xf1')]({'include':[_0x3faa9c]});}})['then'](function(_0xc761fe){if(_0xc761fe){var _0x21ccbc={},_0x582667=[];for(var _0x3e6d7a=0x0;_0x3e6d7a<_0xc761fe['length'];_0x3e6d7a+=0x1){for(var _0x33ae39=0x0,_0x1bb97b;_0x33ae39<_0xc761fe[_0x3e6d7a]['Agents'][_0x6109('0x46')];_0x33ae39+=0x1){_0x1bb97b=_0xc761fe[_0x3e6d7a][_0x6109('0x86')][_0x33ae39][_0x6109('0x25')]({'plain':!![]});_0x21ccbc[_0x1bb97b['id']]=_0x1bb97b;}}_0x21ccbc=_[_0x6109('0x125')](_0x21ccbc);for(var _0x3f3d29=qs[_0x6109('0x1d')](_0x40bf3d['query'][_0x6109('0x1d')]);_0x3f3d29<_0x21ccbc[_0x6109('0x46')]&&_0x582667[_0x6109('0x46')]=_0x151817){_0x1eb033=_0x151817;_0x401ea7=0xc8;}else{_0x401ea7=0xce;}_0x40793c[_0x24b2('0x26')](_0x401ea7);return _0x40793c[_0x24b2('0x27')](_0x24b2('0x28'),_0x11531d+'-'+_0x1eb033+'/'+_0x151817)[_0x24b2('0x29')](_0x14fbf5);}return null;};}function saveUpdates(_0x345a49){return function(_0x452858){if(_0x452858){return _0x452858['update'](_0x345a49)['then'](function(_0x2d72f1){return _0x2d72f1;});}return null;};}function removeEntity(_0x668662){return function(_0x1bc79b){if(_0x1bc79b){return _0x1bc79b[_0x24b2('0x2a')]()[_0x24b2('0x15')](function(){var _0x491dd3=_0x1bc79b[_0x24b2('0x2b')]({'plain':!![]});if(_0x491dd3[_0x24b2('0x2c')]===_0x24b2('0x2d'))return;var _0x43194e=[{'name':_0x24b2('0x2e'),'value':_0x24b2('0x2f'),'ignore':!![]},{'name':_0x24b2('0x30'),'value':_0x24b2('0x31'),'ignore':![]},{'name':_0x24b2('0x32'),'value':'telephone','ignore':![]}];var _0x189a5c=_(_0x43194e)['filter'](_0x24b2('0x33'))[_0x24b2('0x34')](_0x24b2('0x35'))[_0x24b2('0x35')]();if(_[_0x24b2('0x36')](_0x189a5c,_0x491dd3['role'])){return;}var _0x2771e6=_[_0x24b2('0x37')](_0x43194e,[_0x24b2('0x35'),_0x491dd3[_0x24b2('0x2c')]])[_0x24b2('0x38')];return db[_0x24b2('0x39')][_0x24b2('0x2a')]({'where':{'type':_0x2771e6,'resourceId':_0x491dd3['id']}})['then'](function(){return _0x1bc79b;});})[_0x24b2('0x15')](function(){_0x668662[_0x24b2('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x207889){return function(_0x3b937e){if(!_0x3b937e){_0x207889['sendStatus'](0x194);}return _0x3b937e;};}function handleError(_0x166386,_0x2f8a23){_0x2f8a23=_0x2f8a23||0x1f4;return function(_0x42ad59){logger['error'](_0x42ad59[_0x24b2('0x3a')]);if(_0x42ad59['name']){delete _0x42ad59[_0x24b2('0x38')];}_0x166386[_0x24b2('0x26')](_0x2f8a23)['send'](_0x42ad59);};}exports[_0x24b2('0x3b')]=function(_0x3ac924,_0xf46961){var _0x23abd2={},_0x3db147={'count':0x0,'rows':[]};var _0x584e1b=_(db[_0x24b2('0x3c')]['rawAttributes'])['map'](function(_0x639e34){return{'name':_0x639e34[_0x24b2('0x3d')],'type':_0x639e34[_0x24b2('0x3e')][_0x24b2('0x3f')]};})['filter'](function(_0x1e3286){return!_['includes']([_0x24b2('0x40'),'salt'],_0x1e3286[_0x24b2('0x38')]);})[_0x24b2('0x35')]();_0x23abd2=qs[_0x24b2('0x41')](_0x584e1b,_0x3ac924);var _0x34aa90={'where':_0x23abd2[_0x24b2('0x42')]};return db[_0x24b2('0x3c')][_0x24b2('0x25')](_0x34aa90)[_0x24b2('0x15')](function(_0x5dc8d9){_0x3db147['count']=_0x5dc8d9;if(_0x3ac924[_0x24b2('0x43')]['includeAll']){_0x23abd2[_0x24b2('0x44')]=[{'all':!![]}];}if(_0x3ac924[_0x24b2('0x43')][_0x24b2('0x45')]===_0x24b2('0x46')){_0x23abd2[_0x24b2('0x44')]=[{'model':db['UserSetting'],'as':_0x24b2('0x45')}];}if(!_[_0x24b2('0x36')](_0x23abd2[_0x24b2('0x47')],'id')){_0x23abd2[_0x24b2('0x47')][_0x24b2('0x48')]('id');}return db['User'][_0x24b2('0x49')](_0x23abd2);})['then'](function(_0x403ff4){_0x3db147[_0x24b2('0x4a')]=_0x403ff4;if(_0x3ac924['query']['openTabs']==='true'){var _0x5af596=[];for(var _0x5a52d1=0x0;_0x5a52d1<_0x3db147[_0x24b2('0x4a')][_0x24b2('0x4b')];_0x5a52d1++){_0x5af596[_0x24b2('0x48')](get_open_tabs(_0x24b2('0x4c'),_0x3db147[_0x24b2('0x4a')][_0x5a52d1][_0x24b2('0x4d')]));_0x5af596['push'](get_open_tabs(_0x24b2('0x4e'),_0x3db147[_0x24b2('0x4a')][_0x5a52d1][_0x24b2('0x4d')]));_0x5af596[_0x24b2('0x48')](get_open_tabs('fax',_0x3db147[_0x24b2('0x4a')][_0x5a52d1][_0x24b2('0x4d')]));_0x5af596[_0x24b2('0x48')](get_open_tabs(_0x24b2('0x4f'),_0x3db147[_0x24b2('0x4a')][_0x5a52d1][_0x24b2('0x4d')]));_0x5af596[_0x24b2('0x48')](get_open_tabs(_0x24b2('0x50'),_0x3db147[_0x24b2('0x4a')][_0x5a52d1]['dataValues']));_0x5af596[_0x24b2('0x48')](get_open_tabs(_0x24b2('0x51'),_0x3db147[_0x24b2('0x4a')][_0x5a52d1]['dataValues']));}return BPromise[_0x24b2('0x52')](_0x5af596)[_0x24b2('0x15')](function(){return _0x3db147;});}else{return _0x3db147;}})['then'](respondWithFilteredResult(_0xf46961,_0x23abd2))[_0x24b2('0x1f')](handleError(_0xf46961,null));};exports[_0x24b2('0x53')]=function(_0x243d30,_0x1b7238){var _0x347e55={'raw':![],'where':{'id':_0x243d30[_0x24b2('0x54')]['id']}},_0x9825d7={};_0x9825d7[_0x24b2('0x55')]=_[_0x24b2('0x56')](_['keys'](db[_0x24b2('0x3c')][_0x24b2('0x57')]),[_0x24b2('0x40'),_0x24b2('0x58')]);_0x9825d7[_0x24b2('0x43')]=_[_0x24b2('0x59')](_0x243d30[_0x24b2('0x43')]);_0x9825d7[_0x24b2('0x5a')]=_[_0x24b2('0x5b')](_0x9825d7[_0x24b2('0x55')],_0x9825d7[_0x24b2('0x43')]);_0x347e55['attributes']=_[_0x24b2('0x5b')](_0x9825d7[_0x24b2('0x55')],qs[_0x24b2('0x5c')](_0x243d30['query'][_0x24b2('0x5c')]));_0x347e55[_0x24b2('0x47')]=_0x347e55[_0x24b2('0x47')][_0x24b2('0x4b')]?_0x347e55[_0x24b2('0x47')]:_0x9825d7['model'];if(_0x243d30[_0x24b2('0x43')][_0x24b2('0x5d')]){_0x347e55[_0x24b2('0x44')]=[{'all':!![]}];}if(_0x243d30[_0x24b2('0x43')][_0x24b2('0x45')]===_0x24b2('0x46')){_0x347e55[_0x24b2('0x44')]=[{'model':db[_0x24b2('0x5e')],'as':'userSetting'}];}_0x347e55=_[_0x24b2('0x5f')]({},_0x347e55,_0x243d30[_0x24b2('0x60')]);if(!_[_0x24b2('0x36')](_0x347e55[_0x24b2('0x47')],'id')){_0x347e55[_0x24b2('0x47')][_0x24b2('0x48')]('id');}return db['User'][_0x24b2('0x37')](_0x347e55)[_0x24b2('0x15')](handleEntityNotFound(_0x1b7238,null))['then'](function(_0xe0deb4){var _0x8b949a=[];values=_0xe0deb4;if(_0x243d30['query'][_0x24b2('0x61')]===_0x24b2('0x46')){_0x8b949a[_0x24b2('0x48')](get_open_tabs(_0x24b2('0x4c'),_0xe0deb4['dataValues']));_0x8b949a[_0x24b2('0x48')](get_open_tabs(_0x24b2('0x4e'),_0xe0deb4['dataValues']));_0x8b949a[_0x24b2('0x48')](get_open_tabs('openchannel',_0xe0deb4[_0x24b2('0x4d')]));_0x8b949a[_0x24b2('0x48')](get_open_tabs('whatsapp',_0xe0deb4['dataValues']));_0x8b949a[_0x24b2('0x48')](get_open_tabs('fax',_0xe0deb4[_0x24b2('0x4d')]));_0x8b949a[_0x24b2('0x48')](get_open_tabs(_0x24b2('0x4f'),_0xe0deb4['dataValues']));return BPromise[_0x24b2('0x52')](_0x8b949a);}else{return values;}})[_0x24b2('0x15')](function(){return values;})['then'](respondWithResult(_0x1b7238,null))[_0x24b2('0x1f')](handleError(_0x1b7238,null));};exports[_0x24b2('0x62')]=function(_0x3632c8,_0x2af8ee){if(_0x3632c8[_0x24b2('0x63')]['id']){delete _0x3632c8[_0x24b2('0x63')]['id'];}delete _0x3632c8[_0x24b2('0x63')][_0x24b2('0x2c')];return db[_0x24b2('0x3c')]['find']({'where':{'id':_0x3632c8[_0x24b2('0x54')]['id']}})[_0x24b2('0x15')](handleEntityNotFound(_0x2af8ee,null))[_0x24b2('0x15')](saveUpdates(_0x3632c8[_0x24b2('0x63')],null))[_0x24b2('0x15')](respondWithResult(_0x2af8ee,null))[_0x24b2('0x1f')](handleError(_0x2af8ee,null));};exports[_0x24b2('0x64')]=function(_0x33f894,_0x42521f){return db['User'][_0x24b2('0x64')]()['then'](respondWithResult(_0x42521f,null))[_0x24b2('0x1f')](handleError(_0x42521f,null));};exports[_0x24b2('0x65')]=function(_0x88b2bb,_0x42a331){return db[_0x24b2('0x3c')][_0x24b2('0x37')]({'where':{'id':_0x88b2bb[_0x24b2('0x54')]['id']}})[_0x24b2('0x15')](handleEntityNotFound(_0x42a331,null))[_0x24b2('0x15')](function(_0x4ea7b6){if(_0x4ea7b6){return _0x4ea7b6[_0x24b2('0x65')](_0x88b2bb[_0x24b2('0x63')][_0x24b2('0x66')],_['omit'](_0x88b2bb[_0x24b2('0x63')],[_0x24b2('0x66'),'id'])||{});}})[_0x24b2('0x15')](respondWithResult(_0x42a331,null))[_0x24b2('0x1f')](handleError(_0x42a331,null));};function validateUser(_0xb8d277){return new BPromise(function(_0x2c037a,_0x166c89){if(_0xb8d277[_0x24b2('0x67')])return _0x2c037a(_0xb8d277);return db[_0x24b2('0x68')][_0x24b2('0x69')](0x1)[_0x24b2('0x15')](function(_0x37dc29){if(_0x37dc29['securePassword'])authService[_0x24b2('0x6a')](_0xb8d277[_0x24b2('0x40')]);db[_0x24b2('0x3c')][_0x24b2('0x6b')](_0x24b2('0x67'))[_0x24b2('0x15')](function(_0x51ba0d){if(_[_0x24b2('0x6c')](_0x51ba0d)){_0xb8d277['internal']=_0x37dc29[_0x24b2('0x6d')]||0x1;return;}if(_[_0x24b2('0x6c')](_0x37dc29[_0x24b2('0x6d')])||_0x37dc29[_0x24b2('0x6d')]===_0x51ba0d){_0xb8d277[_0x24b2('0x67')]=_0x51ba0d+0x1;return;}if(_0x37dc29[_0x24b2('0x6d')]>_0x51ba0d){_0xb8d277[_0x24b2('0x67')]=_0x37dc29[_0x24b2('0x6d')];return;}return db[_0x24b2('0x6e')][_0x24b2('0x43')](_0x24b2('0x6f'),{'type':db[_0x24b2('0x6e')][_0x24b2('0x70')]['SELECT']})[_0x24b2('0x15')](function(_0x47a9ed){if(_0x47a9ed&&_0x47a9ed[_0x24b2('0x4b')]){for(var _0x8f7d4d=0x0,_0x1c5dee=_0x47a9ed[_0x24b2('0x4b')];_0x8f7d4d<_0x1c5dee&&_[_0x24b2('0x6c')](_0xb8d277[_0x24b2('0x67')]);_0x8f7d4d++){if(_0x37dc29['min_internal']<=_0x47a9ed[_0x8f7d4d][_0x24b2('0x71')]){_0xb8d277['internal']=_0x47a9ed[_0x8f7d4d][_0x24b2('0x71')];}else if(_0x37dc29['min_internal']>_0x47a9ed[_0x8f7d4d][_0x24b2('0x71')]&&_0x37dc29[_0x24b2('0x6d')]<=_0x47a9ed[_0x8f7d4d]['to']){_0xb8d277['internal']=_0x37dc29[_0x24b2('0x6d')];}}}if(_['isNil'](_0xb8d277[_0x24b2('0x67')])){_0xb8d277['internal']=_0x51ba0d+0x1;}return _0x2c037a(_0xb8d277);});});})[_0x24b2('0x1f')](function(_0x4e5f66){_0x166c89(_0x4e5f66);});});}function updateUser(_0x3b4dcf){return new BPromise(function(_0x162dec,_0xa9b61f){try{if(_0x3b4dcf['voicemail']){_0x3b4dcf[_0x24b2('0x72')]=_0x3b4dcf[_0x24b2('0x67')];_0x3b4dcf['VoiceMail']={'mailbox':_0x3b4dcf[_0x24b2('0x67')],'password':_0x3b4dcf[_0x24b2('0x40')],'fullname':_0x3b4dcf[_0x24b2('0x73')],'email':_0x3b4dcf[_0x24b2('0x74')]};}if(_0x3b4dcf[_0x24b2('0x2c')]==='agent'){if(!_0x3b4dcf[_0x24b2('0x75')])_0x3b4dcf['permissions']=[_0x24b2('0x76'),_0x24b2('0x77'),_0x24b2('0x78'),_0x24b2('0x79'),_0x24b2('0x7a'),'104',_0x24b2('0x7b'),_0x24b2('0x7c'),_0x24b2('0x7d'),_0x24b2('0x7e'),_0x24b2('0x7f'),_0x24b2('0x80'),'111',_0x24b2('0x81'),_0x24b2('0x82')];}_0x162dec(_0x3b4dcf);}catch(_0x1b4739){_0xa9b61f(_0x1b4739);}});}exports[_0x24b2('0x83')]=function(_0x19e4a8,_0x1c7115){if(_0x19e4a8['user'][_0x24b2('0x2c')]===_0x24b2('0x31'))throw new Error(_0x24b2('0x84'));if(_0x19e4a8[_0x24b2('0x63')][_0x24b2('0x2c')]==='user'&&_0x19e4a8[_0x24b2('0x2f')][_0x24b2('0x2c')]!==_0x24b2('0x2d')){throw new Error(_0x24b2('0x85'));}if(_0x19e4a8[_0x24b2('0x63')][_0x24b2('0x2c')]===_0x24b2('0x2d')&&_0x19e4a8[_0x24b2('0x2f')][_0x24b2('0x2c')]!==_0x24b2('0x2d')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x19e4a8['body']])[_0x24b2('0x15')](function(){return validateUser(_0x19e4a8[_0x24b2('0x63')]);})['then'](function(_0x9c34d0){return updateUser(_0x9c34d0)[_0x24b2('0x15')](function(_0x15f8a3){if(_0x15f8a3[_0x24b2('0x2c')]===_0x24b2('0x2d')){_0x15f8a3[_0x24b2('0x86')]=_0x19e4a8[_0x24b2('0x2f')]['settingsEnabled'];delete _0x15f8a3[_0x24b2('0x87')];}return _0x15f8a3;});})[_0x24b2('0x15')](function(_0x3ae57b){return db[_0x24b2('0x3c')][_0x24b2('0x83')](_0x3ae57b,{'include':[{'model':db[_0x24b2('0x88')],'as':'VoiceMail'}]});})['then'](function(_0x25c64b){if(_0x19e4a8['body'][_0x24b2('0x2c')]==='user')return _0x25c64b;if(_0x19e4a8['user'][_0x24b2('0x2c')]!==_0x24b2('0x2f'))return _0x25c64b;return db['UserProfileSection'][_0x24b2('0x37')]({'where':{'name':_0x25c64b[_0x24b2('0x2c')]===_0x24b2('0x31')?_0x24b2('0x30'):_0x24b2('0x32'),'userProfileId':_0x19e4a8[_0x24b2('0x2f')][_0x24b2('0x87')]},'raw':!![]})[_0x24b2('0x15')](function(_0x5202cb){if(!_0x5202cb||_0x5202cb['autoAssociation']!=0x0)return _0x25c64b;return db[_0x24b2('0x39')][_0x24b2('0x83')]({'name':_0x25c64b[_0x24b2('0x38')],'resourceId':_0x25c64b['id'],'type':_0x5202cb[_0x24b2('0x38')],'sectionId':_0x5202cb['id']},{})[_0x24b2('0x15')](function(){return _0x25c64b;});})[_0x24b2('0x1f')](function(_0x3cadd3){logger[_0x24b2('0x1c')](_0x24b2('0x89'),_0x3cadd3);throw _0x3cadd3;});})['then'](respondWithResult(_0x1c7115,0xc9))[_0x24b2('0x1f')](handleError(_0x1c7115,null));};exports[_0x24b2('0x8a')]=function(_0x85a639,_0x4b2072){var _0x2c776c=_0x85a639[_0x24b2('0x63')];var _0x545ff5=[];if(_0x85a639[_0x24b2('0x2f')][_0x24b2('0x2c')]==='agent')throw new Error('Unauthorized');if(_[_0x24b2('0x8b')](_0x2c776c,['role',_0x24b2('0x2f')])&&_0x85a639['user'][_0x24b2('0x2c')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x2c776c,[_0x24b2('0x2c'),_0x24b2('0x2d')])&&_0x85a639['user'][_0x24b2('0x2c')]!==_0x24b2('0x2d')){throw new Error(_0x24b2('0x8c'));}return licenseUtil[_0x24b2('0x8d')](_0x2c776c)[_0x24b2('0x15')](function(){return validateUser(_0x2c776c[0x0]);})[_0x24b2('0x15')](function(){for(var _0x35177c=0x1;_0x35177c<_0x2c776c[_0x24b2('0x4b')];_0x35177c++){var _0x301bd0=_0x2c776c[_0x35177c-0x1][_0x24b2('0x67')];if(!_0x2c776c[_0x35177c][_0x24b2('0x67')])_0x2c776c[_0x35177c][_0x24b2('0x67')]=_0x301bd0+0x1;_0x545ff5[_0x24b2('0x48')](validateUser(_0x2c776c[_0x35177c]));}return BPromise[_0x24b2('0x52')](_0x545ff5);})['then'](function(){_0x545ff5=[];for(var _0x253ca4=0x0;_0x253ca4<_0x2c776c[_0x24b2('0x4b')];_0x253ca4++){_0x545ff5[_0x24b2('0x48')](updateUser(_0x2c776c[_0x253ca4]));}return BPromise[_0x24b2('0x52')](_0x545ff5);})[_0x24b2('0x15')](function(){return BPromise['each'](_0x2c776c,function(_0x5d96d2){return db[_0x24b2('0x3c')][_0x24b2('0x83')](_0x5d96d2,{'include':[{'model':db[_0x24b2('0x88')],'as':'VoiceMail'}]})[_0x24b2('0x15')](function(_0x4740c2){_0x5d96d2['id']=_0x4740c2['id'];return _0x5d96d2;});});})[_0x24b2('0x15')](function(_0x1742fc){if(_0x85a639['body'][_0x24b2('0x2c')]===_0x24b2('0x2f'))return _0x1742fc;if(_0x85a639[_0x24b2('0x2f')][_0x24b2('0x2c')]!=='user')return _0x1742fc;var _0x4a4741=_[_0x24b2('0x8b')](_0x1742fc,function(_0x5c98a6){return _0x5c98a6['role']===_0x24b2('0x31')||_0x5c98a6[_0x24b2('0x2c')]===_0x24b2('0x8e');});if(!_0x4a4741)return _0x1742fc;return db[_0x24b2('0x8f')]['findAll']({'where':{'name':{'$or':[_0x24b2('0x30'),_0x24b2('0x32')]},'userProfileId':_0x85a639['user'][_0x24b2('0x87')]},'raw':!![]})[_0x24b2('0x15')](function(_0x12d11c){if(_[_0x24b2('0x90')](_0x12d11c)||!_[_0x24b2('0x8b')](_0x12d11c,[_0x24b2('0x91'),0x0]))return _0x1742fc;_0x545ff5=[];var _0x3410b9=_(_0x12d11c)[_0x24b2('0x34')](function(_0x5a4fed){if(_0x5a4fed[_0x24b2('0x91')]===0x1)return;return _0x5a4fed[_0x24b2('0x38')]==='Agents'?'agent':'telephone';})[_0x24b2('0x92')]()[_0x24b2('0x35')]();for(var _0xfbca84=0x0;_0xfbca84<_0x1742fc[_0x24b2('0x4b')];_0xfbca84++){if(!_[_0x24b2('0x36')](_0x3410b9,_0x1742fc[_0xfbca84][_0x24b2('0x2c')]))return;var _0x2dc5fc=_0x1742fc[_0xfbca84][_0x24b2('0x2c')]==='agent'?_0x24b2('0x30'):_0x24b2('0x32');_0x545ff5[_0x24b2('0x48')](db[_0x24b2('0x39')]['create']({'name':_0x1742fc[_0xfbca84][_0x24b2('0x38')],'resourceId':_0x1742fc[_0xfbca84]['id'],'type':_0x2dc5fc,'sectionId':_[_0x24b2('0x37')](_0x12d11c,['name',_0x2dc5fc])['id']},{}));}return BPromise[_0x24b2('0x52')](_0x545ff5);});})[_0x24b2('0x15')](respondWithResult(_0x4b2072,0xc9))['catch'](handleError(_0x4b2072,null));};exports[_0x24b2('0x93')]=function(_0x5c0e8f,_0x47d6f0){if(_0x5c0e8f[_0x24b2('0x63')]['id']){delete _0x5c0e8f[_0x24b2('0x63')]['id'];}return db[_0x24b2('0x3c')]['find']({'where':{'id':_0x5c0e8f[_0x24b2('0x54')]['id']}})['then'](function(_0x2ead49){if(!_0x2ead49)return null;if(_0x2ead49['id']===_0x5c0e8f[_0x24b2('0x2f')]['id']){if(!_0x5c0e8f[_0x24b2('0x63')][_0x24b2('0x94')]||!_0x5c0e8f['body'][_0x24b2('0x95')]){throw new db[(_0x24b2('0x96'))][(_0x24b2('0x97'))](_0x24b2('0x98'));}if(!_0x2ead49[_0x24b2('0x99')](_0x5c0e8f[_0x24b2('0x63')][_0x24b2('0x94')])){throw new db[(_0x24b2('0x96'))][(_0x24b2('0x97'))]('Wrong\x20credentials');}if(_0x5c0e8f[_0x24b2('0x63')][_0x24b2('0x94')]===_0x5c0e8f[_0x24b2('0x63')][_0x24b2('0x95')]){throw new db[(_0x24b2('0x96'))][(_0x24b2('0x97'))](_0x24b2('0x9a'));}}else if(_0x5c0e8f[_0x24b2('0x2f')][_0x24b2('0x2c')]==='admin'){if(!_0x5c0e8f['body']['newPassword']){throw new db['Sequelize'][(_0x24b2('0x97'))](_0x24b2('0x9b'));}}else if(_0x5c0e8f[_0x24b2('0x2f')][_0x24b2('0x2c')]===_0x24b2('0x2f')){if(!_0x5c0e8f[_0x24b2('0x63')][_0x24b2('0x95')]){throw new db[(_0x24b2('0x96'))][(_0x24b2('0x97'))](_0x24b2('0x9b'));}if(_0x2ead49[_0x24b2('0x2c')]!==_0x24b2('0x31')){throw new db[(_0x24b2('0x96'))][(_0x24b2('0x97'))](_0x24b2('0x84'));}}else{throw new db[(_0x24b2('0x96'))][(_0x24b2('0x97'))](_0x24b2('0x84'));}return _0x2ead49;})[_0x24b2('0x15')](handleEntityNotFound(_0x47d6f0,null))[_0x24b2('0x15')](function(_0x591c19){return db[_0x24b2('0x68')][_0x24b2('0x9c')]({'attributes':['id',_0x24b2('0x9d'),_0x24b2('0x9e'),_0x24b2('0x9f')]})[_0x24b2('0x15')](function(_0x298a44){if(_0x298a44[_0x24b2('0x9d')])authService[_0x24b2('0x6a')](_0x5c0e8f[_0x24b2('0x63')][_0x24b2('0x95')]);if(!_0x298a44[_0x24b2('0x9e')]||!_0x591c19[_0x24b2('0xa0')])return _0x591c19;authService[_0x24b2('0xa1')](_0x5c0e8f['body'][_0x24b2('0x95')],_0x591c19[_0x24b2('0xa0')],_0x298a44[_0x24b2('0x9f')]);return _0x591c19;})['then'](saveUpdates({'password':_0x5c0e8f[_0x24b2('0x63')][_0x24b2('0x95')],'passwordResetAt':_0x5c0e8f[_0x24b2('0x2f')]['id']==_0x5c0e8f[_0x24b2('0x54')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x5c0e8f[_0x24b2('0x63')][_0x24b2('0x95')],_0x591c19[_0x24b2('0xa0')])},null));})['then'](respondWithResult(_0x47d6f0,null))[_0x24b2('0x1f')](handleError(_0x47d6f0,null));};exports[_0x24b2('0xa2')]=function(_0x50905a,_0x5c8a4b){var _0x2d3831=_0x50905a[_0x24b2('0x63')][_0x24b2('0xa3')];return db[_0x24b2('0x3c')][_0x24b2('0x37')]({'where':{'id':_0x50905a[_0x24b2('0x54')]['id']},'attributes':['id','name',_0x24b2('0x2c'),_0x24b2('0xa4'),_0x24b2('0xa5'),_0x24b2('0xa6'),_0x24b2('0xa7')]})[_0x24b2('0x15')](handleEntityNotFound(_0x5c8a4b,null))[_0x24b2('0x15')](function(_0x262796){if(_0x262796){if(!utils[_0x24b2('0xa8')](_0x2d3831)){throw new db['Sequelize'][(_0x24b2('0x97'))]('Unknown\x20channel');}return _0x262796[_0x24b2('0xa9')+_[_0x24b2('0xaa')](_0x2d3831[_0x24b2('0xab')]())+_0x24b2('0xac')](_0x50905a[_0x24b2('0x63')]['ids'],{'penalty':_0x50905a[_0x24b2('0x63')]['penalty']||0x0})['spread'](function(_0x28a10d){for(var _0xddd17a=0x0;_0xddd17a<_0x50905a[_0x24b2('0x63')]['ids'][_0x24b2('0x4b')];_0xddd17a+=0x1){var _0x689a8f={'UserId':Number(_0x50905a[_0x24b2('0x54')]['id'])};_0x689a8f[_['capitalize'](_0x2d3831['toLowerCase']())+_0x24b2('0xad')]=Number(_0x50905a[_0x24b2('0x63')][_0x24b2('0x66')][_0xddd17a]);socket[_0x24b2('0xae')](_0x24b2('0x2f')+_[_0x24b2('0xaa')](_0x2d3831[_0x24b2('0xab')]())+_0x24b2('0xaf'),_0x689a8f);}return _0x28a10d;})[_0x24b2('0x15')](function(){if(_0x2d3831===_0x24b2('0xb0')){return db[_0x24b2('0xb1')][_0x24b2('0x49')]({'where':{'id':_0x50905a[_0x24b2('0x63')][_0x24b2('0x66')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x4e3690){var _0x5ed4ad=_0x262796[_0x24b2('0x2b')]({'plain':!![]});var _0xffc5c0=[];if(_0x2d3831==='voice'&&_0x5ed4ad[_0x24b2('0x2c')]===_0x24b2('0x31')&&_0x5ed4ad[_0x24b2('0xa4')]){for(var _0x1bdecf=0x0;_0x1bdecf<_0x4e3690[_0x24b2('0x4b')];_0x1bdecf+=0x1){_0xffc5c0[_0x24b2('0x48')]({'membername':_0x5ed4ad[_0x24b2('0x38')],'UserId':_0x5ed4ad['id'],'queue_name':_0x4e3690[_0x1bdecf][_0x24b2('0x38')],'VoiceQueueId':_0x4e3690[_0x1bdecf]['id'],'interface':_['isNil'](_0x5ed4ad[_0x24b2('0xa7')])?util[_0x24b2('0xb2')]('SIP/%s',_0x5ed4ad[_0x24b2('0x38')]):_0x5ed4ad[_0x24b2('0xa7')],'paused':_0x5ed4ad[_0x24b2('0xa6')]||![],'penalty':_0x50905a[_0x24b2('0x63')]['penalty']||0x0});}return BPromise['each'](_0xffc5c0,function(_0x2c7900){return db[_0x24b2('0xb3')][_0x24b2('0xb4')](_0x2c7900);});}return _0x262796;});}})['then'](respondWithStatusCode(_0x5c8a4b,null))[_0x24b2('0x1f')](handleError(_0x5c8a4b,null));};exports[_0x24b2('0xb5')]=function(_0x200cc7,_0x1af6ce){var _0x36cd45,_0x517f4d;return db[_0x24b2('0x3c')][_0x24b2('0x37')]({'where':{'id':_0x200cc7['params']['id']},'attributes':['id',_0x24b2('0x38'),_0x24b2('0x2c')]})[_0x24b2('0x15')](handleEntityNotFound(_0x1af6ce,null))[_0x24b2('0x15')](function(_0x2964f8){if(_0x2964f8){_0x36cd45=_0x2964f8;if(!_0x200cc7['query']['channel']||!utils[_0x24b2('0xa8')](_0x200cc7[_0x24b2('0x43')][_0x24b2('0xa3')])){throw new db[(_0x24b2('0x96'))][(_0x24b2('0x97'))](_0x24b2('0xb6'));}return _0x2964f8[_0x24b2('0xb7')+_[_0x24b2('0xaa')](_0x200cc7[_0x24b2('0x43')][_0x24b2('0xa3')][_0x24b2('0xab')]())+_0x24b2('0xac')](_0x200cc7[_0x24b2('0x43')][_0x24b2('0x66')]);}})[_0x24b2('0x15')](function(_0x506894){if(_[_0x24b2('0xb8')](_0x200cc7[_0x24b2('0x43')][_0x24b2('0x66')])){for(var _0x3ffa8e=0x0;_0x3ffa8e<_0x200cc7[_0x24b2('0x43')][_0x24b2('0x66')][_0x24b2('0x4b')];_0x3ffa8e+=0x1){_0x517f4d={'UserId':Number(_0x200cc7[_0x24b2('0x54')]['id'])};_0x517f4d[_[_0x24b2('0xaa')](_0x200cc7[_0x24b2('0x43')][_0x24b2('0xa3')]['toLowerCase']())+_0x24b2('0xad')]=Number(_0x200cc7[_0x24b2('0x43')]['ids'][_0x3ffa8e]);socket[_0x24b2('0xae')](_0x24b2('0x2f')+_[_0x24b2('0xaa')](_0x200cc7[_0x24b2('0x43')][_0x24b2('0xa3')][_0x24b2('0xab')]())+_0x24b2('0xb9'),_0x517f4d);}}else{_0x517f4d={'UserId':Number(_0x200cc7['params']['id'])};_0x517f4d[_[_0x24b2('0xaa')](_0x200cc7[_0x24b2('0x43')][_0x24b2('0xa3')][_0x24b2('0xab')]())+_0x24b2('0xad')]=Number(_0x200cc7['query'][_0x24b2('0x66')]);socket['emit'](_0x24b2('0x2f')+_[_0x24b2('0xaa')](_0x200cc7['query'][_0x24b2('0xa3')][_0x24b2('0xab')]())+_0x24b2('0xb9'),_0x517f4d);}return _0x506894;})[_0x24b2('0x15')](function(){if(_0x200cc7[_0x24b2('0x43')]['channel']===_0x24b2('0xb0')){return db[_0x24b2('0xb3')][_0x24b2('0x2a')]({'where':{'UserId':_0x200cc7[_0x24b2('0x54')]['id'],'VoiceQueueId':_0x200cc7['query'][_0x24b2('0x66')]},'individualHooks':!![]})[_0x24b2('0x15')](function(){return _0x36cd45;});}return _0x36cd45;})['then'](respondWithStatusCode(_0x1af6ce,null))[_0x24b2('0x1f')](handleError(_0x1af6ce,null));};exports[_0x24b2('0xba')]=function(_0x5b6c12,_0x20eede){_0x5b6c12[_0x24b2('0x63')][_0x24b2('0xbb')]=_0x5b6c12[_0x24b2('0xbc')][_0x24b2('0xbd')];return db[_0x24b2('0x3c')][_0x24b2('0x37')]({'where':{'id':_0x5b6c12[_0x24b2('0x54')]['id']}})[_0x24b2('0x15')](handleEntityNotFound(_0x20eede,null))[_0x24b2('0x15')](saveUpdates(_0x5b6c12[_0x24b2('0x63')],null))[_0x24b2('0x15')](respondWithResult(_0x20eede,null))['catch'](handleError(_0x20eede,null));};exports['getAvatar']=function(_0xbe8cbb,_0x8111ab){var _0x177d95=path[_0x24b2('0xbe')](config['root'],_0x24b2('0xbf'));return db[_0x24b2('0x3c')]['find']({'where':{'id':_0xbe8cbb[_0x24b2('0x54')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x8111ab,null))[_0x24b2('0x15')](function(_0x369f3a){if(_0x369f3a){if(_['isNil'](_0x369f3a[_0x24b2('0xbb')])){return _0x8111ab[_0x24b2('0xc0')](_0x177d95);}else{if(!fs[_0x24b2('0xc1')](path['join'](config[_0x24b2('0xc2')],_0x24b2('0xc3'),_0x369f3a[_0x24b2('0xbb')]))){return _0x8111ab[_0x24b2('0xc0')](_0x177d95);}return _0x8111ab[_0x24b2('0xc0')](path[_0x24b2('0xbe')](config['root'],_0x24b2('0xc3'),_0x369f3a[_0x24b2('0xbb')]));}}})[_0x24b2('0x1f')](handleError(_0x8111ab,null));};exports[_0x24b2('0xc4')]=function(_0x42cd74,_0x13b6e5){return db[_0x24b2('0x3c')]['find']({'where':{'id':_0x42cd74[_0x24b2('0x54')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x13b6e5,null))[_0x24b2('0x15')](function(_0x98f94c){var _0x278ef8=[];values=_0x98f94c[_0x24b2('0x4d')];_0x278ef8[_0x24b2('0x48')](get_open_tabs(_0x24b2('0x4c'),_0x98f94c[_0x24b2('0x4d')]));_0x278ef8[_0x24b2('0x48')](get_open_tabs(_0x24b2('0x4e'),_0x98f94c[_0x24b2('0x4d')]));_0x278ef8['push'](get_open_tabs('openchannel',_0x98f94c[_0x24b2('0x4d')]));_0x278ef8[_0x24b2('0x48')](get_open_tabs(_0x24b2('0x51'),_0x98f94c[_0x24b2('0x4d')]));_0x278ef8[_0x24b2('0x48')](get_open_tabs(_0x24b2('0xc5'),_0x98f94c['dataValues']));_0x278ef8[_0x24b2('0x48')](get_open_tabs(_0x24b2('0x4f'),_0x98f94c[_0x24b2('0x4d')]));return BPromise[_0x24b2('0x52')](_0x278ef8);})['then'](function(_0x2a8f92){if(_0x2a8f92){var _0x207b8f=_['map'](values[_0x24b2('0xc6')],function(_0x2d5c18){return{'channel':'CHAT','id':_0x2d5c18['id'],'createdAt':_0x2d5c18['createdAt']};});var _0x40bd3b=_[_0x24b2('0x34')](values[_0x24b2('0xc7')],function(_0x33bfc3){return{'channel':'FAX','id':_0x33bfc3['id'],'createdAt':_0x33bfc3['createdAt']};});var _0x5a969a=_['map'](values[_0x24b2('0xc8')],function(_0x31c34a){return{'channel':'OPENCHANNEL','id':_0x31c34a['id'],'createdAt':_0x31c34a[_0x24b2('0xc9')]};});var _0x21c9d0=_['map'](values[_0x24b2('0xca')],function(_0x6146b8){return{'channel':'MAIL','id':_0x6146b8['id'],'createdAt':_0x6146b8[_0x24b2('0xc9')]};});var _0x3962ed=_[_0x24b2('0x34')](values[_0x24b2('0xcb')],function(_0x48e3cc){return{'channel':_0x24b2('0xcc'),'id':_0x48e3cc['id'],'createdAt':_0x48e3cc[_0x24b2('0xc9')]};});var _0x556557=_[_0x24b2('0x34')](values[_0x24b2('0xcd')],function(_0x1ddd89){return{'channel':'WHATSAPP','id':_0x1ddd89['id'],'createdAt':_0x1ddd89['createdAt']};});var _0x2fe65e=_[_0x24b2('0xce')](_0x207b8f,_0x40bd3b,_0x5a969a,_0x21c9d0,_0x3962ed,_0x556557);var _0x4de706={'count':_0x2fe65e[_0x24b2('0x4b')],'rows':_0x2fe65e};return _0x4de706;}else return null;})[_0x24b2('0x15')](respondWithResult(_0x13b6e5,null))[_0x24b2('0x1f')](handleError(_0x13b6e5,null));};exports[_0x24b2('0xcf')]=function(_0x1dfafc,_0x5b0e88){var _0x3ab6f6={};var _0x2e1d7c={};var _0x1c8179;var _0x3c42ea;return db[_0x24b2('0x3c')][_0x24b2('0x9c')]({'where':{'id':_0x1dfafc['params']['id']}})[_0x24b2('0x15')](handleEntityNotFound(_0x5b0e88,null))[_0x24b2('0x15')](function(_0x4036c2){if(_0x4036c2){_0x1c8179=_0x4036c2;_0x2e1d7c[_0x24b2('0x55')]=_['keys'](db[_0x24b2('0xd0')][_0x24b2('0x57')]);_0x2e1d7c['query']=_[_0x24b2('0x59')](_0x1dfafc[_0x24b2('0x43')]);_0x2e1d7c[_0x24b2('0x5a')]=_[_0x24b2('0x5b')](_0x2e1d7c[_0x24b2('0x55')],_0x2e1d7c['query']);_0x3ab6f6[_0x24b2('0x47')]=_[_0x24b2('0x5b')](_0x2e1d7c[_0x24b2('0x55')],qs[_0x24b2('0x5c')](_0x1dfafc[_0x24b2('0x43')][_0x24b2('0x5c')]));_0x3ab6f6['attributes']=_0x3ab6f6[_0x24b2('0x47')][_0x24b2('0x4b')]?_0x3ab6f6[_0x24b2('0x47')]:_0x2e1d7c['model'];_0x3ab6f6[_0x24b2('0xd1')]=qs[_0x24b2('0xd2')](_0x1dfafc[_0x24b2('0x43')][_0x24b2('0xd2')]);_0x3ab6f6[_0x24b2('0x42')]=qs[_0x24b2('0x5a')](_[_0x24b2('0xd3')](_0x1dfafc[_0x24b2('0x43')],_0x2e1d7c[_0x24b2('0x5a')]));if(_0x1dfafc[_0x24b2('0x43')][_0x24b2('0xd4')]){_0x3ab6f6['where']=_[_0x24b2('0x5f')](_0x3ab6f6[_0x24b2('0x42')],{'$or':_['map'](_0x3ab6f6[_0x24b2('0x47')],function(_0xdc493e){var _0xb2bde1={};_0xb2bde1[_0xdc493e]={'$like':'%'+_0x1dfafc[_0x24b2('0x43')][_0x24b2('0xd4')]+'%'};return _0xb2bde1;})});}_0x3ab6f6=_['merge']({},_0x3ab6f6,_0x1dfafc[_0x24b2('0x60')]);return _0x1c8179[_0x24b2('0xcf')](_0x3ab6f6);}})[_0x24b2('0x15')](function(_0xe8e0b2){if(_0xe8e0b2){_0x3c42ea=_0xe8e0b2[_0x24b2('0x4b')];if(_0x1dfafc[_0x24b2('0x43')][_0x24b2('0xd5')](_0x24b2('0x5d'))){_0x3ab6f6[_0x24b2('0x44')]=[{'model':db[_0x24b2('0xd6')],'as':_0x24b2('0xd7'),'required':![]},{'model':db[_0x24b2('0xd8')],'as':_0x24b2('0xd9'),'attributes':['id','name',_0x24b2('0xda')],'where':_0x1dfafc[_0x24b2('0x43')]['tag']?{'id':_0x1dfafc[_0x24b2('0x43')]['tag']}:undefined,'required':_0x1dfafc['query'][_0x24b2('0xdb')]?!![]:![]}];}if(!_0x1dfafc['query'][_0x24b2('0xd5')](_0x24b2('0xdc'))){_0x3ab6f6[_0x24b2('0x24')]=qs['limit'](_0x1dfafc[_0x24b2('0x43')][_0x24b2('0x24')]);_0x3ab6f6[_0x24b2('0x22')]=qs['offset'](_0x1dfafc[_0x24b2('0x43')][_0x24b2('0x22')]);}return _0x1c8179[_0x24b2('0xcf')](_0x3ab6f6);}})['then'](function(_0x2e0220){if(_0x2e0220){return _0x2e0220?{'count':_0x3c42ea,'rows':_0x2e0220}:null;}})[_0x24b2('0x15')](respondWithResult(_0x5b0e88,null))[_0x24b2('0x1f')](handleError(_0x5b0e88,null));};exports[_0x24b2('0xdd')]=function(_0x57fe35,_0x34e81b){var _0x185e66;var _0x2d11fa={};var _0x1d3448;return db[_0x24b2('0x3c')][_0x24b2('0x9c')]({'where':{'id':_0x57fe35[_0x24b2('0x54')]['id']},'attributes':['id',_0x24b2('0x38'),'role']})['then'](handleEntityNotFound(_0x34e81b,null))['then'](function(_0x1e65be){if(!utils[_0x24b2('0xa8')](_0x57fe35[_0x24b2('0x43')][_0x24b2('0xa3')])){throw new db['Sequelize']['ValidationError'](_0x24b2('0xb6'));}_0x185e66=_0x1e65be;var _0x307e7a={};_0x307e7a[_0x24b2('0x55')]=_[_0x24b2('0x59')](db[_[_0x24b2('0xaa')](_0x57fe35[_0x24b2('0x43')][_0x24b2('0xa3')])+_0x24b2('0xde')][_0x24b2('0x57')]);_0x307e7a['query']=_[_0x24b2('0x59')](_0x57fe35['query']);_0x307e7a[_0x24b2('0x5a')]=_[_0x24b2('0x5b')](_0x307e7a[_0x24b2('0x55')],_0x307e7a[_0x24b2('0x43')]);_0x2d11fa[_0x24b2('0x47')]=_[_0x24b2('0x5b')](_0x307e7a[_0x24b2('0x55')],qs[_0x24b2('0x5c')](_0x57fe35[_0x24b2('0x43')][_0x24b2('0x5c')]));_0x2d11fa[_0x24b2('0x47')]=_0x2d11fa[_0x24b2('0x47')][_0x24b2('0x4b')]?_0x2d11fa[_0x24b2('0x47')]:_0x307e7a[_0x24b2('0x55')];_0x2d11fa[_0x24b2('0xd1')]=qs[_0x24b2('0xd2')](_0x57fe35[_0x24b2('0x43')][_0x24b2('0xd2')]);_0x2d11fa[_0x24b2('0x42')]=qs[_0x24b2('0x5a')](_[_0x24b2('0xd3')](_0x57fe35[_0x24b2('0x43')],_0x307e7a[_0x24b2('0x5a')]));if(_0x57fe35[_0x24b2('0x43')][_0x24b2('0xd4')]){_0x2d11fa[_0x24b2('0x42')]=_[_0x24b2('0x5f')](_0x2d11fa[_0x24b2('0x42')],{'$or':_[_0x24b2('0x34')](_0x2d11fa[_0x24b2('0x47')],function(_0x26f404){var _0xce0cd1={};_0xce0cd1[_0x26f404]={'$like':'%'+_0x57fe35['query']['filter']+'%'};return _0xce0cd1;})});}_0x2d11fa=_[_0x24b2('0x5f')]({},_0x2d11fa,_0x57fe35[_0x24b2('0x60')]);switch(_0x185e66['role']){case'admin':return db[_[_0x24b2('0xaa')](_0x57fe35[_0x24b2('0x43')][_0x24b2('0xa3')])+_0x24b2('0xde')][_0x24b2('0x49')](_0x2d11fa);case _0x24b2('0x2f'):case'agent':return _0x185e66[_0x24b2('0x2b')+_[_0x24b2('0xaa')](_0x57fe35[_0x24b2('0x43')][_0x24b2('0xa3')])+'Queues'](_0x2d11fa);default:throw new db[(_0x24b2('0x96'))]['ValidationError']('Unknown\x20role');}})[_0x24b2('0x15')](function(_0x39698e){_0x1d3448=_0x39698e[_0x24b2('0x4b')];if(!_0x57fe35[_0x24b2('0x43')][_0x24b2('0xd5')](_0x24b2('0xdc'))){_0x2d11fa[_0x24b2('0x24')]=qs['limit'](_0x57fe35[_0x24b2('0x43')]['limit']);_0x2d11fa[_0x24b2('0x22')]=qs[_0x24b2('0x22')](_0x57fe35['query'][_0x24b2('0x22')]);}switch(_0x185e66[_0x24b2('0x2c')]){case'admin':return db[_[_0x24b2('0xaa')](_0x57fe35[_0x24b2('0x43')][_0x24b2('0xa3')])+_0x24b2('0xde')]['findAll'](_0x2d11fa);case _0x24b2('0x2f'):case'agent':return _0x185e66[_0x24b2('0x2b')+_[_0x24b2('0xaa')](_0x57fe35[_0x24b2('0x43')]['channel'])+'Queues'](_0x2d11fa);}})[_0x24b2('0x15')](function(_0x2ee854){return{'count':_0x1d3448,'rows':_0x2ee854};})[_0x24b2('0x15')](respondWithResult(_0x34e81b,null))[_0x24b2('0x1f')](handleError(_0x34e81b,null));};exports[_0x24b2('0xdf')]=function(_0x57cf9a,_0x5e2da2){var _0xab0981={};var _0x77d4ef={};var _0x256baa;var _0x526c52;return db[_0x24b2('0x3c')]['findOne']({'where':{'id':_0x57cf9a['params']['id']}})['then'](handleEntityNotFound(_0x5e2da2,null))[_0x24b2('0x15')](function(_0x3074ac){if(_0x3074ac){_0x256baa=_0x3074ac;_0x77d4ef['model']=_['keys'](db[_0x24b2('0xb3')][_0x24b2('0x57')]);_0x77d4ef['query']=_['keys'](_0x57cf9a[_0x24b2('0x43')]);_0x77d4ef[_0x24b2('0x5a')]=_['intersection'](_0x77d4ef[_0x24b2('0x55')],_0x77d4ef[_0x24b2('0x43')]);_0xab0981[_0x24b2('0x47')]=_[_0x24b2('0x5b')](_0x77d4ef[_0x24b2('0x55')],qs[_0x24b2('0x5c')](_0x57cf9a[_0x24b2('0x43')][_0x24b2('0x5c')]));_0xab0981[_0x24b2('0x47')]=_0xab0981['attributes'][_0x24b2('0x4b')]?_0xab0981[_0x24b2('0x47')]:_0x77d4ef[_0x24b2('0x55')];_0xab0981[_0x24b2('0xd1')]=qs[_0x24b2('0xd2')](_0x57cf9a[_0x24b2('0x43')][_0x24b2('0xd2')]);_0xab0981[_0x24b2('0x42')]=qs[_0x24b2('0x5a')](_[_0x24b2('0xd3')](_0x57cf9a[_0x24b2('0x43')],_0x77d4ef[_0x24b2('0x5a')]));if(_0x57cf9a[_0x24b2('0x43')]['filter']){_0xab0981[_0x24b2('0x42')]=_[_0x24b2('0x5f')](_0xab0981[_0x24b2('0x42')],{'$or':_[_0x24b2('0x34')](_0xab0981[_0x24b2('0x47')],function(_0x5a45e8){var _0x511e51={};_0x511e51[_0x5a45e8]={'$like':'%'+_0x57cf9a[_0x24b2('0x43')][_0x24b2('0xd4')]+'%'};return _0x511e51;})});}_0xab0981=_[_0x24b2('0x5f')]({},_0xab0981,_0x57cf9a['options']);return _0x256baa[_0x24b2('0xdf')](_0xab0981);}})[_0x24b2('0x15')](function(_0x4bb030){if(_0x4bb030){_0x526c52=_0x4bb030[_0x24b2('0x4b')];if(!_0x57cf9a[_0x24b2('0x43')][_0x24b2('0xd5')](_0x24b2('0xdc'))){_0xab0981['limit']=qs['limit'](_0x57cf9a[_0x24b2('0x43')]['limit']);_0xab0981['offset']=qs['offset'](_0x57cf9a[_0x24b2('0x43')]['offset']);}return _0x256baa['getVoiceQueuesRt'](_0xab0981);}})[_0x24b2('0x15')](function(_0x3d908d){if(_0x3d908d){return _0x3d908d?{'count':_0x526c52,'rows':_0x3d908d}:null;}})[_0x24b2('0x15')](respondWithResult(_0x5e2da2,null))[_0x24b2('0x1f')](handleError(_0x5e2da2,null));};exports['getGroups']=function(_0x381bb1,_0x300deb){var _0x376c42={};var _0x4e2166={};var _0x4bf808;var _0x2bd442;return db[_0x24b2('0x3c')][_0x24b2('0x9c')]({'where':{'id':_0x381bb1['params']['id']}})[_0x24b2('0x15')](handleEntityNotFound(_0x300deb,null))[_0x24b2('0x15')](function(_0x30cb33){if(_0x30cb33){_0x4bf808=_0x30cb33;_0x4e2166[_0x24b2('0x55')]=_[_0x24b2('0x59')](db[_0x24b2('0xe0')][_0x24b2('0x57')]);_0x4e2166[_0x24b2('0x43')]=_[_0x24b2('0x59')](_0x381bb1[_0x24b2('0x43')]);_0x4e2166[_0x24b2('0x5a')]=_[_0x24b2('0x5b')](_0x4e2166[_0x24b2('0x55')],_0x4e2166[_0x24b2('0x43')]);_0x376c42[_0x24b2('0x47')]=_[_0x24b2('0x5b')](_0x4e2166['model'],qs['fields'](_0x381bb1[_0x24b2('0x43')][_0x24b2('0x5c')]));_0x376c42[_0x24b2('0x47')]=_0x376c42[_0x24b2('0x47')]['length']?_0x376c42[_0x24b2('0x47')]:_0x4e2166[_0x24b2('0x55')];_0x376c42[_0x24b2('0xd1')]=qs[_0x24b2('0xd2')](_0x381bb1[_0x24b2('0x43')][_0x24b2('0xd2')]);_0x376c42[_0x24b2('0x42')]=qs[_0x24b2('0x5a')](_[_0x24b2('0xd3')](_0x381bb1[_0x24b2('0x43')],_0x4e2166[_0x24b2('0x5a')]));if(_0x381bb1['query'][_0x24b2('0xd4')]){_0x376c42[_0x24b2('0x42')]=_[_0x24b2('0x5f')](_0x376c42[_0x24b2('0x42')],{'$or':_[_0x24b2('0x34')](_0x376c42['attributes'],function(_0x2a47c4){var _0x44cf2d={};_0x44cf2d[_0x2a47c4]={'$like':'%'+_0x381bb1['query'][_0x24b2('0xd4')]+'%'};return _0x44cf2d;})});}_0x376c42=_[_0x24b2('0x5f')]({},_0x376c42,_0x381bb1[_0x24b2('0x60')]);return _0x4bf808[_0x24b2('0xe1')](_0x376c42);}})[_0x24b2('0x15')](function(_0x45e53c){if(_0x45e53c){_0x2bd442=_0x45e53c['length'];if(!_0x381bb1[_0x24b2('0x43')]['hasOwnProperty']('nolimit')){_0x376c42[_0x24b2('0x24')]=qs['limit'](_0x381bb1['query']['limit']);_0x376c42[_0x24b2('0x22')]=qs[_0x24b2('0x22')](_0x381bb1[_0x24b2('0x43')][_0x24b2('0x22')]);}return _0x4bf808[_0x24b2('0xe1')](_0x376c42);}})['then'](function(_0x3798b7){if(_0x3798b7){return _0x3798b7?{'count':_0x2bd442,'rows':_0x3798b7}:null;}})[_0x24b2('0x15')](respondWithResult(_0x300deb,null))[_0x24b2('0x1f')](handleError(_0x300deb,null));};exports['getRecordings']=function(_0x489433,_0x59175a){var _0x313c8e={'raw':!![],'where':{}};var _0x11fa37={};var _0x32b515={'count':0x0,'rows':[]};return db['User'][_0x24b2('0x9c')]({'where':{'id':_0x489433['params']['id']}})['then'](handleEntityNotFound(_0x59175a,null))['then'](function(_0x2c1061){if(_0x2c1061){_0x11fa37['model']=_[_0x24b2('0x59')](db[_0x24b2('0xe2')][_0x24b2('0x57')]);_0x11fa37['query']=_[_0x24b2('0x59')](_0x489433[_0x24b2('0x43')]);_0x11fa37[_0x24b2('0x5a')]=_['intersection'](_0x11fa37['model'],_0x11fa37[_0x24b2('0x43')]);_0x313c8e[_0x24b2('0x47')]=_[_0x24b2('0x5b')](_0x11fa37[_0x24b2('0x55')],qs[_0x24b2('0x5c')](_0x489433[_0x24b2('0x43')][_0x24b2('0x5c')]));_0x313c8e[_0x24b2('0x47')]=_0x313c8e[_0x24b2('0x47')][_0x24b2('0x4b')]?_0x313c8e[_0x24b2('0x47')]:_0x11fa37[_0x24b2('0x55')];if(!_0x489433[_0x24b2('0x43')][_0x24b2('0xd5')](_0x24b2('0xdc'))){_0x313c8e[_0x24b2('0x24')]=qs[_0x24b2('0x24')](_0x489433[_0x24b2('0x43')]['limit']);_0x313c8e[_0x24b2('0x22')]=qs[_0x24b2('0x22')](_0x489433[_0x24b2('0x43')][_0x24b2('0x22')]);}_0x313c8e['order']=qs[_0x24b2('0xd2')](_0x489433[_0x24b2('0x43')][_0x24b2('0xd2')]);_0x313c8e[_0x24b2('0x42')]=qs[_0x24b2('0x5a')](_[_0x24b2('0xd3')](_0x489433[_0x24b2('0x43')],_0x11fa37[_0x24b2('0x5a')]));_0x313c8e[_0x24b2('0x42')][_0x24b2('0xe3')]=_0x2c1061['id'];if(_0x489433[_0x24b2('0x43')][_0x24b2('0xd4')]){_0x313c8e[_0x24b2('0x42')]=_[_0x24b2('0x5f')](_0x313c8e['where'],{'$or':_[_0x24b2('0x34')](_0x313c8e[_0x24b2('0x47')],function(_0x5be336){var _0x3bd70f={};_0x3bd70f[_0x5be336]={'$like':'%'+_0x489433[_0x24b2('0x43')][_0x24b2('0xd4')]+'%'};return _0x3bd70f;})});}_0x313c8e=_[_0x24b2('0x5f')]({},_0x313c8e,_0x489433['options']);return db[_0x24b2('0xe2')][_0x24b2('0x25')]({'where':_0x313c8e[_0x24b2('0x42')]})['then'](function(_0x5892a2){_0x32b515[_0x24b2('0x25')]=_0x5892a2;if(_0x489433[_0x24b2('0x43')][_0x24b2('0x5d')]){_0x313c8e[_0x24b2('0x44')]=[{'all':!![]}];}return db['VoiceRecording'][_0x24b2('0x49')](_0x313c8e);})[_0x24b2('0x15')](function(_0x37087e){_0x32b515[_0x24b2('0x4a')]=_0x37087e;return _0x32b515;});}})[_0x24b2('0x15')](respondWithFilteredResult(_0x59175a,_0x313c8e))[_0x24b2('0x1f')](handleError(_0x59175a,null));};exports[_0x24b2('0xe4')]=function(_0x561ea5,_0x37d30e){var _0x51b9d2={'raw':!![],'where':{}};var _0x2d135d={};var _0x342e11={'count':0x0,'rows':[]};return db['User'][_0x24b2('0x9c')]({'where':{'id':_0x561ea5[_0x24b2('0x54')]['id']}})['then'](handleEntityNotFound(_0x37d30e,null))['then'](function(_0x51c91d){if(_0x51c91d){_0x2d135d[_0x24b2('0x55')]=_[_0x24b2('0x59')](db[_0x24b2('0xe5')]['rawAttributes']);_0x2d135d[_0x24b2('0x43')]=_['keys'](_0x561ea5[_0x24b2('0x43')]);_0x2d135d[_0x24b2('0x5a')]=_[_0x24b2('0x5b')](_0x2d135d[_0x24b2('0x55')],_0x2d135d[_0x24b2('0x43')]);_0x51b9d2[_0x24b2('0x47')]=_[_0x24b2('0x5b')](_0x2d135d[_0x24b2('0x55')],qs[_0x24b2('0x5c')](_0x561ea5['query']['fields']));_0x51b9d2[_0x24b2('0x47')]=_0x51b9d2[_0x24b2('0x47')][_0x24b2('0x4b')]?_0x51b9d2['attributes']:_0x2d135d[_0x24b2('0x55')];if(!_0x561ea5[_0x24b2('0x43')][_0x24b2('0xd5')](_0x24b2('0xdc'))){_0x51b9d2[_0x24b2('0x24')]=qs[_0x24b2('0x24')](_0x561ea5['query'][_0x24b2('0x24')]);_0x51b9d2[_0x24b2('0x22')]=qs['offset'](_0x561ea5[_0x24b2('0x43')][_0x24b2('0x22')]);}_0x51b9d2['order']=qs[_0x24b2('0xd2')](_0x561ea5[_0x24b2('0x43')][_0x24b2('0xd2')]);_0x51b9d2['where']=qs['filters'](_['pick'](_0x561ea5[_0x24b2('0x43')],_0x2d135d[_0x24b2('0x5a')]));_0x51b9d2[_0x24b2('0x42')][_0x24b2('0xe3')]=_0x51c91d['id'];if(_0x561ea5[_0x24b2('0x43')][_0x24b2('0xd4')]){_0x51b9d2[_0x24b2('0x42')]=_[_0x24b2('0x5f')](_0x51b9d2[_0x24b2('0x42')],{'$or':_[_0x24b2('0x34')](_0x51b9d2[_0x24b2('0x47')],function(_0x4eb9a8){var _0xc65508={};_0xc65508[_0x4eb9a8]={'$like':'%'+_0x561ea5['query'][_0x24b2('0xd4')]+'%'};return _0xc65508;})});}_0x51b9d2=_['merge']({},_0x51b9d2,_0x561ea5[_0x24b2('0x60')]);return db[_0x24b2('0xe5')][_0x24b2('0x25')]({'where':_0x51b9d2['where']})['then'](function(_0x1b7ab6){_0x342e11['count']=_0x1b7ab6;if(_0x561ea5[_0x24b2('0x43')][_0x24b2('0x5d')]){_0x51b9d2[_0x24b2('0x44')]=[{'all':!![]}];}return db[_0x24b2('0xe5')][_0x24b2('0x49')](_0x51b9d2);})['then'](function(_0x5186d5){_0x342e11[_0x24b2('0x4a')]=_0x5186d5;return _0x342e11;});}})['then'](respondWithFilteredResult(_0x37d30e,_0x51b9d2))[_0x24b2('0x1f')](handleError(_0x37d30e,null));};exports['getChatInteractions']=function(_0x4cbeaa,_0x16d77c){var _0x41dbf1={};var _0x30c440={};var _0xfe4717;var _0x3b69f7;return db[_0x24b2('0x3c')]['findOne']({'where':{'id':_0x4cbeaa[_0x24b2('0x54')]['id']}})[_0x24b2('0x15')](handleEntityNotFound(_0x16d77c,null))[_0x24b2('0x15')](function(_0x3d874e){if(_0x3d874e){_0xfe4717=_0x3d874e;_0x30c440['model']=_[_0x24b2('0x59')](db['ChatInteraction'][_0x24b2('0x57')]);_0x30c440['query']=_[_0x24b2('0x59')](_0x4cbeaa['query']);_0x30c440[_0x24b2('0x5a')]=_[_0x24b2('0x5b')](_0x30c440[_0x24b2('0x55')],_0x30c440['query']);_0x41dbf1[_0x24b2('0x47')]=_[_0x24b2('0x5b')](_0x30c440[_0x24b2('0x55')],qs[_0x24b2('0x5c')](_0x4cbeaa[_0x24b2('0x43')]['fields']));_0x41dbf1[_0x24b2('0x47')]=_0x41dbf1['attributes'][_0x24b2('0x4b')]?_0x41dbf1[_0x24b2('0x47')]:_0x30c440['model'];_0x41dbf1[_0x24b2('0xd1')]=qs[_0x24b2('0xd2')](_0x4cbeaa[_0x24b2('0x43')][_0x24b2('0xd2')]);_0x41dbf1[_0x24b2('0x42')]=qs[_0x24b2('0x5a')](_[_0x24b2('0xd3')](_0x4cbeaa[_0x24b2('0x43')],_0x30c440['filters']));if(_0x4cbeaa[_0x24b2('0x43')][_0x24b2('0xd4')]){_0x41dbf1[_0x24b2('0x42')]=_['merge'](_0x41dbf1[_0x24b2('0x42')],{'$or':_[_0x24b2('0x34')](_0x41dbf1[_0x24b2('0x47')],function(_0x111e2b){var _0x4f09e2={};_0x4f09e2[_0x111e2b]={'$like':'%'+_0x4cbeaa[_0x24b2('0x43')][_0x24b2('0xd4')]+'%'};return _0x4f09e2;})});}_0x41dbf1=_[_0x24b2('0x5f')]({},_0x41dbf1,_0x4cbeaa['options']);return _0xfe4717[_0x24b2('0xe6')](_0x41dbf1);}})[_0x24b2('0x15')](function(_0x4a91b7){if(_0x4a91b7){_0x3b69f7=_0x4a91b7[_0x24b2('0x4b')];if(!_0x4cbeaa['query'][_0x24b2('0xd5')](_0x24b2('0xdc'))){_0x41dbf1['limit']=qs[_0x24b2('0x24')](_0x4cbeaa[_0x24b2('0x43')][_0x24b2('0x24')]);_0x41dbf1[_0x24b2('0x22')]=qs[_0x24b2('0x22')](_0x4cbeaa[_0x24b2('0x43')][_0x24b2('0x22')]);}return _0xfe4717[_0x24b2('0xe6')](_0x41dbf1);}})[_0x24b2('0x15')](function(_0x4fbf17){if(_0x4fbf17){return _0x4fbf17?{'count':_0x3b69f7,'rows':_0x4fbf17}:null;}})['then'](respondWithResult(_0x16d77c,null))[_0x24b2('0x1f')](handleError(_0x16d77c,null));};exports[_0x24b2('0xe7')]=function(_0x4e1284,_0x314ac5){var _0x147a82={};var _0x2e91ce={};var _0x54403f;var _0x569c68;return db[_0x24b2('0x3c')][_0x24b2('0x9c')]({'where':{'id':_0x4e1284[_0x24b2('0x54')]['id']}})[_0x24b2('0x15')](handleEntityNotFound(_0x314ac5,null))['then'](function(_0x1059f7){if(_0x1059f7){_0x54403f=_0x1059f7;_0x2e91ce[_0x24b2('0x55')]=_[_0x24b2('0x59')](db['OpenchannelInteraction'][_0x24b2('0x57')]);_0x2e91ce['query']=_[_0x24b2('0x59')](_0x4e1284[_0x24b2('0x43')]);_0x2e91ce[_0x24b2('0x5a')]=_[_0x24b2('0x5b')](_0x2e91ce['model'],_0x2e91ce['query']);_0x147a82['attributes']=_[_0x24b2('0x5b')](_0x2e91ce[_0x24b2('0x55')],qs[_0x24b2('0x5c')](_0x4e1284['query']['fields']));_0x147a82[_0x24b2('0x47')]=_0x147a82[_0x24b2('0x47')][_0x24b2('0x4b')]?_0x147a82[_0x24b2('0x47')]:_0x2e91ce['model'];_0x147a82[_0x24b2('0xd1')]=qs[_0x24b2('0xd2')](_0x4e1284[_0x24b2('0x43')]['sort']);_0x147a82[_0x24b2('0x42')]=qs[_0x24b2('0x5a')](_[_0x24b2('0xd3')](_0x4e1284[_0x24b2('0x43')],_0x2e91ce[_0x24b2('0x5a')]));if(_0x4e1284['query'][_0x24b2('0xd4')]){_0x147a82[_0x24b2('0x42')]=_['merge'](_0x147a82[_0x24b2('0x42')],{'$or':_[_0x24b2('0x34')](_0x147a82[_0x24b2('0x47')],function(_0x955ce8){var _0x454d34={};_0x454d34[_0x955ce8]={'$like':'%'+_0x4e1284[_0x24b2('0x43')][_0x24b2('0xd4')]+'%'};return _0x454d34;})});}_0x147a82=_['merge']({},_0x147a82,_0x4e1284['options']);return _0x54403f[_0x24b2('0xe7')](_0x147a82);}})['then'](function(_0x158397){if(_0x158397){_0x569c68=_0x158397[_0x24b2('0x4b')];if(!_0x4e1284[_0x24b2('0x43')][_0x24b2('0xd5')](_0x24b2('0xdc'))){_0x147a82['limit']=qs[_0x24b2('0x24')](_0x4e1284[_0x24b2('0x43')][_0x24b2('0x24')]);_0x147a82[_0x24b2('0x22')]=qs[_0x24b2('0x22')](_0x4e1284[_0x24b2('0x43')]['offset']);}return _0x54403f[_0x24b2('0xe7')](_0x147a82);}})['then'](function(_0x5dad95){if(_0x5dad95){return _0x5dad95?{'count':_0x569c68,'rows':_0x5dad95}:null;}})['then'](respondWithResult(_0x314ac5,null))[_0x24b2('0x1f')](handleError(_0x314ac5,null));};exports[_0x24b2('0xe8')]=function(_0x3da4e9,_0x61d961){var _0x371624={'raw':!![],'where':{}};var _0x31f52d={};var _0x1c9b6d={'count':0x0,'rows':[]};return db[_0x24b2('0x3c')][_0x24b2('0x9c')]({'where':{'id':_0x3da4e9['params']['id']}})[_0x24b2('0x15')](handleEntityNotFound(_0x61d961,null))[_0x24b2('0x15')](function(_0x46fec9){if(_0x46fec9){_0x31f52d[_0x24b2('0x55')]=_[_0x24b2('0x59')](db[_0x24b2('0xe9')][_0x24b2('0x57')]);_0x31f52d[_0x24b2('0x43')]=_[_0x24b2('0x59')](_0x3da4e9[_0x24b2('0x43')]);_0x31f52d[_0x24b2('0x5a')]=_[_0x24b2('0x5b')](_0x31f52d[_0x24b2('0x55')],_0x31f52d[_0x24b2('0x43')]);_0x371624[_0x24b2('0x47')]=_['intersection'](_0x31f52d[_0x24b2('0x55')],qs[_0x24b2('0x5c')](_0x3da4e9[_0x24b2('0x43')]['fields']));_0x371624['attributes']=_0x371624[_0x24b2('0x47')][_0x24b2('0x4b')]?_0x371624['attributes']:_0x31f52d['model'];if(!_0x3da4e9[_0x24b2('0x43')][_0x24b2('0xd5')](_0x24b2('0xdc'))){_0x371624[_0x24b2('0x24')]=qs[_0x24b2('0x24')](_0x3da4e9['query']['limit']);_0x371624[_0x24b2('0x22')]=qs[_0x24b2('0x22')](_0x3da4e9[_0x24b2('0x43')]['offset']);}_0x371624[_0x24b2('0xd1')]=qs[_0x24b2('0xd2')](_0x3da4e9[_0x24b2('0x43')]['sort']);_0x371624[_0x24b2('0x42')]=qs[_0x24b2('0x5a')](_[_0x24b2('0xd3')](_0x3da4e9[_0x24b2('0x43')],_0x31f52d[_0x24b2('0x5a')]));_0x371624[_0x24b2('0x42')][_0x24b2('0xe3')]=_0x46fec9['id'];if(_0x3da4e9[_0x24b2('0x43')]['filter']){_0x371624[_0x24b2('0x42')]=_['merge'](_0x371624[_0x24b2('0x42')],{'$or':_[_0x24b2('0x34')](_0x371624[_0x24b2('0x47')],function(_0x43d7c5){var _0x3dac2b={};_0x3dac2b[_0x43d7c5]={'$like':'%'+_0x3da4e9['query'][_0x24b2('0xd4')]+'%'};return _0x3dac2b;})});}_0x371624=_[_0x24b2('0x5f')]({},_0x371624,_0x3da4e9[_0x24b2('0x60')]);return db['MailInteraction'][_0x24b2('0x25')]({'where':_0x371624[_0x24b2('0x42')]})[_0x24b2('0x15')](function(_0x519853){_0x1c9b6d[_0x24b2('0x25')]=_0x519853;if(_0x3da4e9['query'][_0x24b2('0x5d')]){_0x371624[_0x24b2('0x44')]=[{'all':!![]}];}return db['MailInteraction'][_0x24b2('0x49')](_0x371624);})[_0x24b2('0x15')](function(_0x5ac901){_0x1c9b6d[_0x24b2('0x4a')]=_0x5ac901;return _0x1c9b6d;});}})[_0x24b2('0x15')](respondWithFilteredResult(_0x61d961,_0x371624))[_0x24b2('0x1f')](handleError(_0x61d961,null));};exports[_0x24b2('0xea')]=function(_0x4f5950,_0x500222){var _0x4408d7={};var _0x54630f={};var _0x215dab;var _0x189df2;return db[_0x24b2('0x3c')][_0x24b2('0x9c')]({'where':{'id':_0x4f5950[_0x24b2('0x54')]['id']}})['then'](handleEntityNotFound(_0x500222,null))[_0x24b2('0x15')](function(_0x115846){if(_0x115846){_0x215dab=_0x115846;_0x54630f[_0x24b2('0x55')]=_[_0x24b2('0x59')](db[_0x24b2('0xeb')][_0x24b2('0x57')]);_0x54630f['query']=_[_0x24b2('0x59')](_0x4f5950[_0x24b2('0x43')]);_0x54630f[_0x24b2('0x5a')]=_[_0x24b2('0x5b')](_0x54630f[_0x24b2('0x55')],_0x54630f[_0x24b2('0x43')]);_0x4408d7['attributes']=_[_0x24b2('0x5b')](_0x54630f[_0x24b2('0x55')],qs[_0x24b2('0x5c')](_0x4f5950[_0x24b2('0x43')]['fields']));_0x4408d7['attributes']=_0x4408d7[_0x24b2('0x47')][_0x24b2('0x4b')]?_0x4408d7[_0x24b2('0x47')]:_0x54630f[_0x24b2('0x55')];_0x4408d7[_0x24b2('0xd1')]=qs[_0x24b2('0xd2')](_0x4f5950[_0x24b2('0x43')][_0x24b2('0xd2')]);_0x4408d7[_0x24b2('0x42')]=qs['filters'](_[_0x24b2('0xd3')](_0x4f5950[_0x24b2('0x43')],_0x54630f['filters']));if(_0x4f5950['query'][_0x24b2('0xd4')]){_0x4408d7[_0x24b2('0x42')]=_[_0x24b2('0x5f')](_0x4408d7[_0x24b2('0x42')],{'$or':_[_0x24b2('0x34')](_0x4408d7[_0x24b2('0x47')],function(_0x240e64){var _0x3d2685={};_0x3d2685[_0x240e64]={'$like':'%'+_0x4f5950['query']['filter']+'%'};return _0x3d2685;})});}_0x4408d7=_[_0x24b2('0x5f')]({},_0x4408d7,_0x4f5950[_0x24b2('0x60')]);return _0x215dab[_0x24b2('0xea')](_0x4408d7);}})[_0x24b2('0x15')](function(_0x3c62e7){if(_0x3c62e7){_0x189df2=_0x3c62e7[_0x24b2('0x4b')];if(!_0x4f5950[_0x24b2('0x43')][_0x24b2('0xd5')](_0x24b2('0xdc'))){_0x4408d7[_0x24b2('0x24')]=qs[_0x24b2('0x24')](_0x4f5950[_0x24b2('0x43')][_0x24b2('0x24')]);_0x4408d7[_0x24b2('0x22')]=qs[_0x24b2('0x22')](_0x4f5950[_0x24b2('0x43')][_0x24b2('0x22')]);}return _0x215dab[_0x24b2('0xea')](_0x4408d7);}})[_0x24b2('0x15')](function(_0x3de509){if(_0x3de509){return _0x3de509?{'count':_0x189df2,'rows':_0x3de509}:null;}})[_0x24b2('0x15')](respondWithResult(_0x500222,null))[_0x24b2('0x1f')](handleError(_0x500222,null));};exports[_0x24b2('0xec')]=function(_0x33b56b,_0x5d0b3c){var _0x3d4545={};var _0xcfa35c={};var _0x5ac472;var _0x309cf7;return db['User'][_0x24b2('0x9c')]({'where':{'id':_0x33b56b[_0x24b2('0x54')]['id']}})[_0x24b2('0x15')](handleEntityNotFound(_0x5d0b3c,null))[_0x24b2('0x15')](function(_0x2d50f5){if(_0x2d50f5){_0x5ac472=_0x2d50f5;_0xcfa35c[_0x24b2('0x55')]=_['keys'](db[_0x24b2('0xed')][_0x24b2('0x57')]);_0xcfa35c['query']=_[_0x24b2('0x59')](_0x33b56b[_0x24b2('0x43')]);_0xcfa35c['filters']=_[_0x24b2('0x5b')](_0xcfa35c[_0x24b2('0x55')],_0xcfa35c[_0x24b2('0x43')]);_0x3d4545[_0x24b2('0x47')]=_[_0x24b2('0x5b')](_0xcfa35c[_0x24b2('0x55')],qs[_0x24b2('0x5c')](_0x33b56b[_0x24b2('0x43')][_0x24b2('0x5c')]));_0x3d4545[_0x24b2('0x47')]=_0x3d4545[_0x24b2('0x47')][_0x24b2('0x4b')]?_0x3d4545[_0x24b2('0x47')]:_0xcfa35c[_0x24b2('0x55')];_0x3d4545['order']=qs[_0x24b2('0xd2')](_0x33b56b[_0x24b2('0x43')][_0x24b2('0xd2')]);_0x3d4545[_0x24b2('0x42')]=qs['filters'](_[_0x24b2('0xd3')](_0x33b56b[_0x24b2('0x43')],_0xcfa35c[_0x24b2('0x5a')]));if(_0x33b56b[_0x24b2('0x43')][_0x24b2('0xd4')]){_0x3d4545['where']=_[_0x24b2('0x5f')](_0x3d4545[_0x24b2('0x42')],{'$or':_[_0x24b2('0x34')](_0x3d4545[_0x24b2('0x47')],function(_0x52e20b){var _0x52ec9f={};_0x52ec9f[_0x52e20b]={'$like':'%'+_0x33b56b[_0x24b2('0x43')]['filter']+'%'};return _0x52ec9f;})});}_0x3d4545=_['merge']({},_0x3d4545,_0x33b56b['options']);return _0x5ac472[_0x24b2('0xec')](_0x3d4545);}})['then'](function(_0xfe00bf){if(_0xfe00bf){_0x309cf7=_0xfe00bf[_0x24b2('0x4b')];if(!_0x33b56b[_0x24b2('0x43')][_0x24b2('0xd5')]('nolimit')){_0x3d4545['limit']=qs[_0x24b2('0x24')](_0x33b56b[_0x24b2('0x43')]['limit']);_0x3d4545['offset']=qs[_0x24b2('0x22')](_0x33b56b[_0x24b2('0x43')][_0x24b2('0x22')]);}return _0x5ac472[_0x24b2('0xec')](_0x3d4545);}})[_0x24b2('0x15')](function(_0x8f04c0){if(_0x8f04c0){return _0x8f04c0?{'count':_0x309cf7,'rows':_0x8f04c0}:null;}})['then'](respondWithResult(_0x5d0b3c,null))[_0x24b2('0x1f')](handleError(_0x5d0b3c,null));};exports['getWhatsappInteractions']=function(_0x3b4982,_0x2b5559){var _0x114d91={};var _0x1d0c50={};var _0x575399;var _0x1ae80d;return db[_0x24b2('0x3c')]['findOne']({'where':{'id':_0x3b4982[_0x24b2('0x54')]['id']}})[_0x24b2('0x15')](handleEntityNotFound(_0x2b5559,null))[_0x24b2('0x15')](function(_0x95ed64){if(_0x95ed64){_0x575399=_0x95ed64;_0x1d0c50[_0x24b2('0x55')]=_[_0x24b2('0x59')](db[_0x24b2('0xee')]['rawAttributes']);_0x1d0c50[_0x24b2('0x43')]=_[_0x24b2('0x59')](_0x3b4982[_0x24b2('0x43')]);_0x1d0c50[_0x24b2('0x5a')]=_[_0x24b2('0x5b')](_0x1d0c50[_0x24b2('0x55')],_0x1d0c50[_0x24b2('0x43')]);_0x114d91[_0x24b2('0x47')]=_[_0x24b2('0x5b')](_0x1d0c50[_0x24b2('0x55')],qs[_0x24b2('0x5c')](_0x3b4982[_0x24b2('0x43')]['fields']));_0x114d91['attributes']=_0x114d91[_0x24b2('0x47')][_0x24b2('0x4b')]?_0x114d91['attributes']:_0x1d0c50[_0x24b2('0x55')];_0x114d91[_0x24b2('0xd1')]=qs[_0x24b2('0xd2')](_0x3b4982[_0x24b2('0x43')][_0x24b2('0xd2')]);_0x114d91[_0x24b2('0x42')]=qs[_0x24b2('0x5a')](_[_0x24b2('0xd3')](_0x3b4982[_0x24b2('0x43')],_0x1d0c50[_0x24b2('0x5a')]));if(_0x3b4982[_0x24b2('0x43')][_0x24b2('0xd4')]){_0x114d91['where']=_['merge'](_0x114d91[_0x24b2('0x42')],{'$or':_['map'](_0x114d91[_0x24b2('0x47')],function(_0x146e5d){var _0x1a1230={};_0x1a1230[_0x146e5d]={'$like':'%'+_0x3b4982['query']['filter']+'%'};return _0x1a1230;})});}_0x114d91=_['merge']({},_0x114d91,_0x3b4982[_0x24b2('0x60')]);return _0x575399[_0x24b2('0xef')](_0x114d91);}})['then'](function(_0xcd8f46){if(_0xcd8f46){_0x1ae80d=_0xcd8f46[_0x24b2('0x4b')];if(!_0x3b4982[_0x24b2('0x43')][_0x24b2('0xd5')](_0x24b2('0xdc'))){_0x114d91[_0x24b2('0x24')]=qs['limit'](_0x3b4982[_0x24b2('0x43')][_0x24b2('0x24')]);_0x114d91[_0x24b2('0x22')]=qs[_0x24b2('0x22')](_0x3b4982[_0x24b2('0x43')][_0x24b2('0x22')]);}return _0x575399['getWhatsappInteractions'](_0x114d91);}})[_0x24b2('0x15')](function(_0x436404){if(_0x436404){return _0x436404?{'count':_0x1ae80d,'rows':_0x436404}:null;}})['then'](respondWithResult(_0x2b5559,null))[_0x24b2('0x1f')](handleError(_0x2b5559,null));};exports[_0x24b2('0xf0')]=function(_0x526686,_0x2a1a02,_0x4b7173){var _0x5a1260;var _0x1e5fa4;var _0x2513d1;var _0xef9644=!_[_0x24b2('0x6c')](_0x526686[_0x24b2('0x54')]['id'])?_0x526686[_0x24b2('0x54')]['id']:!_[_0x24b2('0x6c')](_0x526686[_0x24b2('0x2f')]['id'])?_0x526686['user']['id']:null;return db[_0x24b2('0x3c')][_0x24b2('0x37')]({'where':{'id':_0xef9644,'role':{'$or':[_0x24b2('0x2d'),_0x24b2('0x2f'),_0x24b2('0x31')]}},'attributes':['id','name',_0x24b2('0xf1'),'mobile',_0x24b2('0x2c'),_0x24b2('0x67'),'loginInPause']})[_0x24b2('0x15')](function(_0xbe5d7){if(_0xbe5d7){if(_0xbe5d7[_0x24b2('0x2c')]==='agent'){_0x5a1260=_0xbe5d7;if(_0x526686[_0x24b2('0x63')]['interface']){_0x2513d1=util['format'](_0x24b2('0xf2'),_0x5a1260[_0x526686[_0x24b2('0x63')][_0x24b2('0xa7')]]);}else if(_0x526686[_0x24b2('0x63')]['intrf']){_0x2513d1=util['format'](_0x24b2('0xf3'),_0x526686[_0x24b2('0x63')]['intrf']);}else{_0x2513d1=util['format'](_0x24b2('0xf3'),_0x5a1260[_0x24b2('0x38')]);}socket['to'](util['format'](_0x24b2('0xf4'),_0x5a1260[_0x24b2('0x38')]))[_0x24b2('0xae')]('user:forcelogout',{'user':{'id':_0x5a1260['id'],'name':_0x5a1260['name']},'ip':_0x526686[_0x24b2('0xf5')][_0x24b2('0xf6')]||_0x526686[_0x24b2('0xf7')][_0x24b2('0xf8')]||_0x526686[_0x24b2('0xf9')][_0x24b2('0xf8')]||_0x526686[_0x24b2('0xf7')][_0x24b2('0xf9')][_0x24b2('0xf8')]});return db[_0x24b2('0xb3')][_0x24b2('0x2a')]({'where':{'membername':_0x5a1260[_0x24b2('0x38')]},'individualHooks':!![]});}}else{throw new db[(_0x24b2('0x96'))][(_0x24b2('0x97'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x24b2('0x15')](function(){if(_0x5a1260){return _0x5a1260[_0x24b2('0xfa')]({'raw':!![]});}})[_0x24b2('0x15')](function(_0x475d60){if(_0x5a1260){var _0x4deb7c=[];if(_0x475d60){_0x1e5fa4=_0x475d60;if(_0x1e5fa4[_0x24b2('0x4b')]){for(var _0x5aeb05=0x0;_0x5aeb05<_0x1e5fa4[_0x24b2('0x4b')];_0x5aeb05++){_0x4deb7c[_0x24b2('0x48')]({'membername':_0x5a1260[_0x24b2('0x38')],'UserId':_0x5a1260['id'],'queue_name':_0x1e5fa4[_0x5aeb05][_0x24b2('0x38')],'VoiceQueueId':_0x1e5fa4[_0x5aeb05]['id'],'interface':_0x2513d1,'paused':_0x5a1260['loginInPause']||![],'penalty':_0x1e5fa4[_0x5aeb05][_0x24b2('0xfb')]||0x0});}return BPromise[_0x24b2('0xfc')](_0x4deb7c,function(_0x521493){return db['UserVoiceQueueRt'][_0x24b2('0xb4')](_0x521493);});}}}})['then'](function(){if(_0x5a1260){return db[_0x24b2('0xfd')][_0x24b2('0x49')]({'where':{'membername':_0x5a1260[_0x24b2('0x38')],'exitAt':null}});}})[_0x24b2('0x15')](function(_0x4f6054){if(_0x5a1260){var _0x5a1807=[];_0x4f6054[_0x24b2('0xfe')](function(_0x887068){_0x5a1807[_0x24b2('0x48')](_0x887068[_0x24b2('0x62')]({'exitAt':moment()[_0x24b2('0xb2')](_0x24b2('0xff'))}));});return BPromise['all'](_0x5a1807);}})['then'](function(){if(_0x5a1260){var _0x2f9f39=[];var _0xb45122=[];var _0xe40476=utils[_0x24b2('0x100')]();var _0x349cbb={'membername':_0x5a1260['name'],'interface':_0x2513d1,'enterAt':moment()[_0x24b2('0xb2')](_0x24b2('0xff')),'role':_0x5a1260['role'],'internal':_0x5a1260[_0x24b2('0x67')]};_0xe40476[_0x24b2('0xfe')](function(_0x1bec0a){_0x2f9f39[_0x24b2('0x48')](_[_0x24b2('0x5f')]({'channel':_0x1bec0a,'type':_0x24b2('0x101'),'data1':_0x526686['body'][_0x24b2('0x102')],'data2':_0x2513d1},_0x349cbb));if(_0x5a1260[_0x24b2('0xa5')]){_0xb45122['push'](_[_0x24b2('0x5f')]({'channel':_0x1bec0a,'type':_0x24b2('0x103'),'data1':_0x24b2('0x104')},_0x349cbb));}});return db['MemberReport'][_0x24b2('0x8a')](_0x2f9f39[_0x24b2('0xce')](_0xb45122),{'individualHooks':!![]});}})['then'](function(){if(_0x5a1260){return _0x5a1260[_0x24b2('0x62')]({'online':!![],'lastLoginAt':moment()['format'](_0x24b2('0xff')),'voicePause':_0x5a1260[_0x24b2('0xa5')]||![],'mailPause':_0x5a1260[_0x24b2('0xa5')]||![],'chatPause':_0x5a1260[_0x24b2('0xa5')]||![],'faxPause':_0x5a1260[_0x24b2('0xa5')]||![],'smsPause':_0x5a1260[_0x24b2('0xa5')]||![],'openchannelPause':_0x5a1260[_0x24b2('0xa5')]||![],'whatsappPause':_0x5a1260[_0x24b2('0xa5')]||![],'pauseType':_0x5a1260[_0x24b2('0xa5')]?_0x24b2('0x104'):null,'interface':_0x2513d1,'lastPauseAt':moment()[_0x24b2('0xb2')](_0x24b2('0xff'))});}})[_0x24b2('0x15')](function(_0x2ca50d){if(_0x526686['isMiddleware']){return _0x4b7173();}else{return BPromise[_0x24b2('0x105')](_0x2ca50d)[_0x24b2('0x15')](respondWithResult(_0x2a1a02,null));}})[_0x24b2('0x1f')](handleError(_0x2a1a02,null));};exports[_0x24b2('0x106')]=function(_0x344377,_0x1d224e){var _0x356737;return db[_0x24b2('0x3c')]['find']({'where':{'id':_0x344377['params']['id'],'role':'agent'},'attributes':['id','name','role']})[_0x24b2('0x15')](handleEntityNotFound(_0x1d224e,null))[_0x24b2('0x15')](function(_0xf225da){if(_0xf225da){_0x356737=_0xf225da;return db[_0x24b2('0xb3')][_0x24b2('0x2a')]({'where':{'membername':_0x356737[_0x24b2('0x38')]},'individualHooks':!![]});}})[_0x24b2('0x15')](function(){return db[_0x24b2('0xfd')][_0x24b2('0x49')]({'where':{'membername':_0x356737[_0x24b2('0x38')],'exitAt':null}});})[_0x24b2('0x15')](function(_0x3ac0b6){var _0x554a81=[];_0x3ac0b6[_0x24b2('0xfe')](function(_0x163a8c){_0x554a81[_0x24b2('0x48')](_0x163a8c[_0x24b2('0x62')]({'exitAt':moment()['format'](_0x24b2('0xff'))}));});return BPromise[_0x24b2('0x52')](_0x554a81);})['then'](function(){return _0x356737[_0x24b2('0x62')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x24b2('0x15')](respondWithResult(_0x1d224e,null))[_0x24b2('0x1f')](handleError(_0x1d224e,null));};exports[_0x24b2('0x107')]=function(_0x1d9f0c,_0x30c2a2){var _0x6bc4b4;return db[_0x24b2('0xb3')][_0x24b2('0x62')]({'paused':0x1},{'where':{'UserId':_0x1d9f0c[_0x24b2('0x54')]['id']},'individualHooks':!![]})[_0x24b2('0x15')](function(){return db['User'][_0x24b2('0x37')]({'where':{'id':_0x1d9f0c[_0x24b2('0x54')]['id'],'role':'agent'},'attributes':['id',_0x24b2('0x38'),_0x24b2('0x2c'),_0x24b2('0x67'),_0x24b2('0xa7')]});})['then'](handleEntityNotFound(_0x30c2a2,null))[_0x24b2('0x15')](function(_0x3e6ebf){if(_0x3e6ebf){_0x6bc4b4=_0x3e6ebf;return respondWithRpcPromise(_0x24b2('0x108'),_0x24b2('0x107'),{'id':_0x6bc4b4['id'],'name':_0x6bc4b4[_0x24b2('0x38')],'pause':!![]});}})['then'](function(){if(_0x6bc4b4){return db['MemberReport'][_0x24b2('0x49')]({'where':{'membername':_0x6bc4b4[_0x24b2('0x38')],'type':_0x24b2('0x103'),'exitAt':null}});}})[_0x24b2('0x15')](function(_0x27b7a8){if(_0x27b7a8[_0x24b2('0x4b')]){var _0x2826c8=moment()[_0x24b2('0xb2')](_0x24b2('0xff'));for(var _0x45a7bc=0x0,_0x13f9e4=_0x27b7a8['length'];_0x45a7bc<_0x13f9e4;_0x45a7bc++){_0x27b7a8[_0x45a7bc][_0x24b2('0x109')]({'exitAt':_0x2826c8});}}})[_0x24b2('0x15')](function(){var _0x525eb4=[];var _0x4e091b=utils[_0x24b2('0x100')]();_0x4e091b[_0x24b2('0xfe')](function(_0x1acc9c){_0x525eb4['push']({'channel':_0x1acc9c,'membername':_0x6bc4b4[_0x24b2('0x38')],'interface':_[_0x24b2('0x6c')](_0x6bc4b4[_0x24b2('0xa7')])?util[_0x24b2('0xb2')](_0x24b2('0xf3'),_0x6bc4b4[_0x24b2('0x38')]):_0x6bc4b4['interface'],'type':'PAUSE','enterAt':moment()[_0x24b2('0xb2')](_0x24b2('0xff')),'data1':_0x1d9f0c[_0x24b2('0x63')][_0x24b2('0x3e')]||'DEFAULT\x20PAUSE','role':_0x6bc4b4[_0x24b2('0x2c')],'internal':_0x6bc4b4['internal']});});return db[_0x24b2('0xfd')][_0x24b2('0x8a')](_0x525eb4,{'individualHooks':!![]});})[_0x24b2('0x15')](function(){return _0x6bc4b4[_0x24b2('0x62')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1d9f0c[_0x24b2('0x63')][_0x24b2('0x3e')]||_0x24b2('0x10a'),'lastPauseAt':moment()[_0x24b2('0xb2')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x24b2('0x15')](respondWithResult(_0x30c2a2,null))[_0x24b2('0x1f')](handleError(_0x30c2a2,null));};exports['unpause']=function(_0x1affe8,_0x4f0453){var _0x5052f7;return db[_0x24b2('0x3c')][_0x24b2('0x37')]({'where':{'id':_0x1affe8[_0x24b2('0x54')]['id']},'attributes':['id',_0x24b2('0x38'),'role',_0x24b2('0xa6'),_0x24b2('0x10b'),'chatPause',_0x24b2('0x10c'),_0x24b2('0x10d'),_0x24b2('0x10e'),'whatsapppause',_0x24b2('0x10f'),_0x24b2('0x110')]})['then'](handleEntityNotFound(_0x4f0453,null))[_0x24b2('0x15')](function(_0xa47b34){if(_0xa47b34){_0x5052f7=_0xa47b34;if(_0x1affe8[_0x24b2('0x63')][_0x24b2('0xa3')]&&!utils[_0x24b2('0xa8')](_0x1affe8[_0x24b2('0x63')][_0x24b2('0xa3')])){throw new db['Sequelize'][(_0x24b2('0x97'))](_0x24b2('0xb6'));}switch(_0x1affe8[_0x24b2('0x63')][_0x24b2('0xa3')]){case'voice':return respondWithRpcPromise(_0x24b2('0x108'),_0x24b2('0x111'),{'id':_0x5052f7['id'],'name':_0x5052f7[_0x24b2('0x38')],'pause':![]})[_0x24b2('0x15')](function(){return db[_0x24b2('0xb3')][_0x24b2('0x62')]({'paused':0x0},{'where':{'UserId':_0x5052f7['id']},'individualHooks':!![]});})[_0x24b2('0x15')](function(){return db[_0x24b2('0xfd')][_0x24b2('0x37')]({'where':{'channel':_0x1affe8[_0x24b2('0x63')][_0x24b2('0xa3')],'membername':_0x5052f7['name'],'type':_0x24b2('0x103'),'exitAt':null}});})[_0x24b2('0x15')](function(_0x1d984b){if(_0x1d984b){return _0x1d984b[_0x24b2('0x62')]({'exitAt':moment()[_0x24b2('0xb2')](_0x24b2('0xff')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x24b2('0x15')](function(){return _0x5052f7['update']({'voicePause':![]});});case _0x24b2('0x4f'):case _0x24b2('0x4c'):case'fax':case'sms':case _0x24b2('0x51'):case _0x24b2('0x50'):return db[_0x24b2('0xfd')]['find']({'where':{'channel':_0x1affe8['body'][_0x24b2('0xa3')],'membername':_0x5052f7[_0x24b2('0x38')],'type':_0x24b2('0x103'),'exitAt':null}})[_0x24b2('0x15')](function(_0x30aacf){if(_0x30aacf){return _0x30aacf[_0x24b2('0x62')]({'exitAt':moment()[_0x24b2('0xb2')](_0x24b2('0xff')),'data2':_0x24b2('0x112')},{'individualHooks':!![]});}return null;})[_0x24b2('0x15')](function(){var _0x15ac33={};_[_0x24b2('0x27')](_0x15ac33,util[_0x24b2('0xb2')]('%s%s',_0x1affe8[_0x24b2('0x63')][_0x24b2('0xa3')],'Pause'),![]);return _0x5052f7['update'](_0x15ac33);});default:return respondWithRpcPromise(_0x24b2('0x108'),'unpause',{'id':_0x5052f7['id'],'name':_0x5052f7[_0x24b2('0x38')],'pause':![]})[_0x24b2('0x15')](function(){return db[_0x24b2('0xb3')][_0x24b2('0x62')]({'paused':0x0},{'where':{'UserId':_0x5052f7['id']}});})['then'](function(){return db[_0x24b2('0xfd')][_0x24b2('0x49')]({'where':{'membername':_0x5052f7[_0x24b2('0x38')],'type':_0x24b2('0x103'),'exitAt':null}});})['then'](function(_0x4fbe6e){var _0x1546d5=[];_0x4fbe6e[_0x24b2('0xfe')](function(_0x5dc3c0){_0x1546d5[_0x24b2('0x48')](_0x5dc3c0[_0x24b2('0x62')]({'exitAt':moment()[_0x24b2('0xb2')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x24b2('0x112')}));});return BPromise['all'](_0x1546d5);})[_0x24b2('0x15')](function(){return _0x5052f7[_0x24b2('0x62')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x24b2('0x15')](respondWithResult(_0x4f0453,null))['catch'](handleError(_0x4f0453,null));};exports[_0x24b2('0x113')]=function(_0x2d1a82,_0x55d928){var _0x995a33={};var _0x396ee9={};var _0x318426;var _0x1ef807;return db[_0x24b2('0x3c')][_0x24b2('0x9c')]({'where':{'id':_0x2d1a82[_0x24b2('0x54')]['id']}})[_0x24b2('0x15')](handleEntityNotFound(_0x55d928,null))['then'](function(_0x16e4fc){if(_0x16e4fc){_0x318426=_0x16e4fc;_0x396ee9[_0x24b2('0x55')]=_[_0x24b2('0x59')](db[_0x24b2('0x114')][_0x24b2('0x57')]);_0x396ee9[_0x24b2('0x43')]=_['keys'](_0x2d1a82['query']);_0x396ee9[_0x24b2('0x5a')]=_[_0x24b2('0x5b')](_0x396ee9[_0x24b2('0x55')],_0x396ee9[_0x24b2('0x43')]);_0x995a33[_0x24b2('0x47')]=_['intersection'](_0x396ee9['model'],qs[_0x24b2('0x5c')](_0x2d1a82[_0x24b2('0x43')]['fields']));_0x995a33[_0x24b2('0x47')]=_0x995a33[_0x24b2('0x47')]['length']?_0x995a33[_0x24b2('0x47')]:_0x396ee9[_0x24b2('0x55')];_0x995a33[_0x24b2('0xd1')]=qs[_0x24b2('0xd2')](_0x2d1a82[_0x24b2('0x43')][_0x24b2('0xd2')]);_0x995a33[_0x24b2('0x42')]=qs[_0x24b2('0x5a')](_['pick'](_0x2d1a82[_0x24b2('0x43')],_0x396ee9['filters']));if(_0x2d1a82[_0x24b2('0x43')][_0x24b2('0xd4')]){_0x995a33[_0x24b2('0x42')]=_['merge'](_0x995a33[_0x24b2('0x42')],{'$or':_[_0x24b2('0x34')](_0x995a33[_0x24b2('0x47')],function(_0x587954){var _0x1702b5={};_0x1702b5[_0x587954]={'$like':'%'+_0x2d1a82['query'][_0x24b2('0xd4')]+'%'};return _0x1702b5;})});}_0x995a33=_[_0x24b2('0x5f')]({},_0x995a33,_0x2d1a82[_0x24b2('0x60')]);return _0x318426[_0x24b2('0x113')](_0x995a33);}})[_0x24b2('0x15')](function(_0x12b1cb){if(_0x12b1cb){_0x1ef807=_0x12b1cb[_0x24b2('0x4b')];if(!_0x2d1a82['query'][_0x24b2('0xd5')](_0x24b2('0xdc'))){_0x995a33[_0x24b2('0x24')]=qs[_0x24b2('0x24')](_0x2d1a82['query'][_0x24b2('0x24')]);_0x995a33['offset']=qs[_0x24b2('0x22')](_0x2d1a82['query'][_0x24b2('0x22')]);}return _0x318426['getTeams'](_0x995a33);}})[_0x24b2('0x15')](function(_0x4d340a){if(_0x4d340a){return _0x4d340a?{'count':_0x1ef807,'rows':_0x4d340a}:null;}})[_0x24b2('0x15')](respondWithResult(_0x55d928,null))[_0x24b2('0x1f')](handleError(_0x55d928,null));};exports[_0x24b2('0x115')]=function(_0x1bc1fa,_0x522704){return db[_0x24b2('0x3c')][_0x24b2('0x37')]({'where':{'id':_0x1bc1fa['params']['id']}})['then'](handleEntityNotFound(_0x522704,null))[_0x24b2('0x15')](function(_0x3ffcd8){if(_0x3ffcd8){var _0x1e827f=_0x3ffcd8['get']({'plain':!![]});return _0x3ffcd8['addTeams'](_0x1bc1fa[_0x24b2('0x63')][_0x24b2('0x66')],_[_0x24b2('0x116')](_0x1bc1fa[_0x24b2('0x63')],[_0x24b2('0x66'),'id'])||{})[_0x24b2('0x15')](function(){for(var _0x43982c=0x0;_0x43982c<_0x1bc1fa[_0x24b2('0x63')]['ids'][_0x24b2('0x4b')];_0x43982c++){var _0x5546d2=[];var _0x483813={};db[_0x24b2('0x114')]['findOne']({'where':{'id':_0x1bc1fa['body'][_0x24b2('0x66')][_0x43982c]}})[_0x24b2('0x15')](function(_0xa4dd62){_0x483813=_0xa4dd62['dataValues'];_0x5546d2[_0x24b2('0x48')](_0xa4dd62[_0x24b2('0xfa')]()['then'](function(_0x4badc6){for(var _0x508379=0x0;_0x508379<_0x4badc6[_0x24b2('0x4b')];_0x508379++){_0x4badc6[_0x508379][_0x24b2('0x117')](_0x24b2('0xa3'),_0x24b2('0x118'));}return _0x4badc6;}));_0x5546d2[_0x24b2('0x48')](_0xa4dd62['getChatQueues']()[_0x24b2('0x15')](function(_0x47083a){for(var _0x2dde19=0x0;_0x2dde19<_0x47083a[_0x24b2('0x4b')];_0x2dde19++){_0x47083a[_0x2dde19][_0x24b2('0x117')](_0x24b2('0xa3'),_0x24b2('0x119'));}return _0x47083a;}));_0x5546d2[_0x24b2('0x48')](_0xa4dd62[_0x24b2('0x11a')]()[_0x24b2('0x15')](function(_0x511b17){for(var _0x53b052=0x0;_0x53b052<_0x511b17[_0x24b2('0x4b')];_0x53b052++){_0x511b17[_0x53b052]['setDataValue'](_0x24b2('0xa3'),'Mail');}return _0x511b17;}));_0x5546d2[_0x24b2('0x48')](_0xa4dd62['getSmsQueues']()['then'](function(_0x4209df){for(var _0x31b251=0x0;_0x31b251<_0x4209df['length'];_0x31b251++){_0x4209df[_0x31b251][_0x24b2('0x117')]('channel','Sms');}return _0x4209df;}));_0x5546d2[_0x24b2('0x48')](_0xa4dd62[_0x24b2('0x11b')]()[_0x24b2('0x15')](function(_0x270afa){for(var _0x13f3d4=0x0;_0x13f3d4<_0x270afa['length'];_0x13f3d4++){_0x270afa[_0x13f3d4][_0x24b2('0x117')]('channel',_0x24b2('0x11c'));}return _0x270afa;}));_0x5546d2[_0x24b2('0x48')](_0xa4dd62[_0x24b2('0x11d')]()[_0x24b2('0x15')](function(_0xe53342){for(var _0x5ec649=0x0;_0x5ec649<_0xe53342['length'];_0x5ec649++){_0xe53342[_0x5ec649]['setDataValue']('channel',_0x24b2('0x11e'));}return _0xe53342;}));_0x5546d2[_0x24b2('0x48')](_0xa4dd62[_0x24b2('0x11f')]()['then'](function(_0x49b49d){for(var _0x25531d=0x0;_0x25531d<_0x49b49d[_0x24b2('0x4b')];_0x25531d++){_0x49b49d[_0x25531d]['setDataValue']('channel','Openchannel');}return _0x49b49d;}));return BPromise[_0x24b2('0x52')](_0x5546d2);})['then'](function(_0x4a5300){var _0x49a43b=_[_0x24b2('0x120')](_0x4a5300);_0x5546d2=[];return db[_0x24b2('0x6e')][_0x24b2('0x121')](function(_0x18e4b9){for(var _0x48ae77=0x0;_0x48ae77<_0x49a43b[_0x24b2('0x4b')];_0x48ae77++){_0x5546d2[_0x24b2('0x48')](_0x49a43b[_0x48ae77][_0x24b2('0x122')](_0x1e827f['id']),{'transaction':_0x18e4b9});}return BPromise[_0x24b2('0x52')](_0x5546d2)[_0x24b2('0x15')](function(){if(_0x1e827f[_0x24b2('0xa4')]){return BPromise[_0x24b2('0xfc')](_['filter'](_0x49a43b,function(_0x314430){return _0x314430[_0x24b2('0x123')](_0x24b2('0xa3'))===_0x24b2('0x118');}),function(_0x4c88ed){return db[_0x24b2('0xb3')][_0x24b2('0xb4')]({'membername':_0x1e827f[_0x24b2('0x38')],'UserId':_0x1e827f['id'],'queue_name':_0x4c88ed[_0x24b2('0x38')],'VoiceQueueId':_0x4c88ed['id'],'interface':_[_0x24b2('0x6c')](_0x1e827f[_0x24b2('0xa7')])?util[_0x24b2('0xb2')](_0x24b2('0xf3'),_0x1e827f[_0x24b2('0x38')]):_0x1e827f['interface'],'paused':_0x1e827f['voicePause']||![],'penalty':_0x1e827f[_0x24b2('0x124')]},{'transaction':_0x18e4b9});});}else{return;}})[_0x24b2('0x15')](function(){for(var _0x2d62fe=0x0;_0x2d62fe<_0x49a43b[_0x24b2('0x4b')];_0x2d62fe++){var _0x2f4e31=_0x49a43b[_0x2d62fe][_0x24b2('0x123')](_0x24b2('0xa3'));var _0x3bd0bb=_0x2f4e31+'QueueId';socket[_0x24b2('0xae')](_0x24b2('0x2f')+_0x2f4e31+_0x24b2('0xaf'),{'UserId':_0x1e827f['id'],['queueField']:_0x49a43b[_0x2d62fe]['id']});}});});})[_0x24b2('0x15')](function(){db[_0x24b2('0x125')][_0x24b2('0x9c')]({'where':{'teamId':_0x483813['id']}})[_0x24b2('0x15')](function(_0x18fd34){if(_0x18fd34){db[_0x24b2('0x126')][_0x24b2('0x83')]({'UserId':_0x1bc1fa[_0x24b2('0x54')]['id'],'VoicePrefixId':_0x18fd34['VoicePrefixId']});}});});}});}})['then'](respondWithStatusCode(_0x522704,null))[_0x24b2('0x1f')](handleError(_0x522704,null));};exports['removeTeams']=function(_0xfcac2,_0x1b14f0){return db['User']['findOne']({'where':{'id':_0xfcac2['params']['id']}})['then'](handleEntityNotFound(_0x1b14f0,null))[_0x24b2('0x15')](function(_0x5e755b){if(_0x5e755b){var _0x491d2f=_0x5e755b[_0x24b2('0x2b')]({'plain':!![]});var _0x3c9031=_0xfcac2[_0x24b2('0x43')]['ids'];return _0x5e755b[_0x24b2('0x127')](_0x3c9031)['then'](function(){for(var _0x2b44ad=0x0;_0x2b44ad<_0x3c9031['length'];_0x2b44ad++){var _0x491f02=[];var _0x3f0671={};db[_0x24b2('0x114')][_0x24b2('0x9c')]({'where':{'id':_0x3c9031[_0x2b44ad]}})['then'](function(_0x46db57){_0x3f0671=_0x46db57[_0x24b2('0x4d')];_0x491f02['push'](_0x46db57[_0x24b2('0xfa')]()[_0x24b2('0x15')](function(_0xf597ce){for(var _0x52bc88=0x0;_0x52bc88<_0xf597ce['length'];_0x52bc88++){_0xf597ce[_0x52bc88][_0x24b2('0x117')](_0x24b2('0xa3'),'Voice');}return _0xf597ce;}));_0x491f02[_0x24b2('0x48')](_0x46db57[_0x24b2('0x128')]()[_0x24b2('0x15')](function(_0x4419ea){for(var _0x4f6547=0x0;_0x4f6547<_0x4419ea[_0x24b2('0x4b')];_0x4f6547++){_0x4419ea[_0x4f6547][_0x24b2('0x117')](_0x24b2('0xa3'),_0x24b2('0x119'));}return _0x4419ea;}));_0x491f02[_0x24b2('0x48')](_0x46db57['getMailQueues']()[_0x24b2('0x15')](function(_0xec92b4){for(var _0x33a496=0x0;_0x33a496<_0xec92b4['length'];_0x33a496++){_0xec92b4[_0x33a496][_0x24b2('0x117')](_0x24b2('0xa3'),_0x24b2('0x129'));}return _0xec92b4;}));_0x491f02[_0x24b2('0x48')](_0x46db57[_0x24b2('0x12a')]()[_0x24b2('0x15')](function(_0x142e0f){for(var _0x5053f8=0x0;_0x5053f8<_0x142e0f[_0x24b2('0x4b')];_0x5053f8++){_0x142e0f[_0x5053f8][_0x24b2('0x117')](_0x24b2('0xa3'),'Sms');}return _0x142e0f;}));_0x491f02[_0x24b2('0x48')](_0x46db57[_0x24b2('0x11b')]()['then'](function(_0x1e67d5){for(var _0x423fdc=0x0;_0x423fdc<_0x1e67d5[_0x24b2('0x4b')];_0x423fdc++){_0x1e67d5[_0x423fdc][_0x24b2('0x117')](_0x24b2('0xa3'),_0x24b2('0x11c'));}return _0x1e67d5;}));_0x491f02[_0x24b2('0x48')](_0x46db57[_0x24b2('0x11d')]()[_0x24b2('0x15')](function(_0x5a41f8){for(var _0x356541=0x0;_0x356541<_0x5a41f8[_0x24b2('0x4b')];_0x356541++){_0x5a41f8[_0x356541][_0x24b2('0x117')]('channel',_0x24b2('0x11e'));}return _0x5a41f8;}));_0x491f02[_0x24b2('0x48')](_0x46db57[_0x24b2('0x11f')]()[_0x24b2('0x15')](function(_0x477273){for(var _0x4126de=0x0;_0x4126de<_0x477273[_0x24b2('0x4b')];_0x4126de++){_0x477273[_0x4126de][_0x24b2('0x117')](_0x24b2('0xa3'),_0x24b2('0x12b'));}return _0x477273;}));return BPromise[_0x24b2('0x52')](_0x491f02);})[_0x24b2('0x15')](function(_0x373217){var _0x5675c6=_['flatten'](_0x373217);_0x491f02=[];return db[_0x24b2('0x6e')]['transaction'](function(_0x5750ea){for(var _0x3d8bec=0x0;_0x3d8bec<_0x5675c6[_0x24b2('0x4b')];_0x3d8bec++){_0x491f02['push'](_0x5675c6[_0x3d8bec][_0x24b2('0x12c')](_0x491d2f['id']),{'transaction':_0x5750ea});}return BPromise[_0x24b2('0x52')](_0x491f02)[_0x24b2('0x15')](function(){if(_0x491d2f[_0x24b2('0xa4')]){return BPromise['each'](_['filter'](_0x5675c6,function(_0x4a876c){return _0x4a876c['getDataValue']('channel')===_0x24b2('0x118');}),function(_0x21f322){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x21f322['id'],'UserId':_0x491d2f['id']},'transaction':_0x5750ea});});}else{return;}})[_0x24b2('0x15')](function(){db[_0x24b2('0x125')]['findOne']({'where':{'teamId':_0x3f0671['id']}})[_0x24b2('0x15')](function(_0x439adf){if(_0x439adf){return db[_0x24b2('0x126')][_0x24b2('0x2a')]({'where':{'UserId':_0x491d2f['id'],'VoicePrefixId':_0x439adf['dataValues']['VoicePrefixId']}});}});})[_0x24b2('0x15')](function(){for(var _0x19c406=0x0;_0x19c406<_0x5675c6['length'];_0x19c406++){var _0x1b5317=_0x5675c6[_0x19c406][_0x24b2('0x123')](_0x24b2('0xa3'));var _0xa7a435=_0x1b5317+'QueueId';socket[_0x24b2('0xae')](_0x24b2('0x2f')+_0x1b5317+_0x24b2('0xb9'),{'UserId':_0x491d2f['id'],['queueField']:_0x5675c6[_0x19c406]['id']});}});});});}});}})[_0x24b2('0x15')](respondWithStatusCode(_0x1b14f0,null))['catch'](handleError(_0x1b14f0,null));};exports['getLists']=function(_0x4a630a,_0x4d45b2){var _0x20ca22={};var _0x466334={};var _0x3687a0;var _0x203d6a;return db[_0x24b2('0x3c')][_0x24b2('0x9c')]({'where':{'id':_0x4a630a[_0x24b2('0x54')]['id']}})[_0x24b2('0x15')](handleEntityNotFound(_0x4d45b2,null))['then'](function(_0x2c73cb){if(_0x2c73cb){_0x3687a0=_0x2c73cb;_0x466334[_0x24b2('0x55')]=_['keys'](db['CmList'][_0x24b2('0x57')]);_0x466334[_0x24b2('0x43')]=_['keys'](_0x4a630a['query']);_0x466334['filters']=_['intersection'](_0x466334[_0x24b2('0x55')],_0x466334['query']);_0x20ca22['attributes']=_[_0x24b2('0x5b')](_0x466334[_0x24b2('0x55')],qs['fields'](_0x4a630a[_0x24b2('0x43')][_0x24b2('0x5c')]));_0x20ca22['attributes']=_0x20ca22[_0x24b2('0x47')][_0x24b2('0x4b')]?_0x20ca22[_0x24b2('0x47')]:_0x466334['model'];_0x20ca22[_0x24b2('0xd1')]=qs[_0x24b2('0xd2')](_0x4a630a[_0x24b2('0x43')][_0x24b2('0xd2')]);_0x20ca22[_0x24b2('0x42')]=qs['filters'](_[_0x24b2('0xd3')](_0x4a630a[_0x24b2('0x43')],_0x466334[_0x24b2('0x5a')]));if(_0x4a630a[_0x24b2('0x43')][_0x24b2('0xd4')]){_0x20ca22[_0x24b2('0x42')]=_[_0x24b2('0x5f')](_0x20ca22[_0x24b2('0x42')],{'$or':_['map'](_0x20ca22['attributes'],function(_0x2f3dc4){var _0x12949a={};_0x12949a[_0x2f3dc4]={'$like':'%'+_0x4a630a['query'][_0x24b2('0xd4')]+'%'};return _0x12949a;})});}_0x20ca22=_[_0x24b2('0x5f')]({},_0x20ca22,_0x4a630a[_0x24b2('0x60')]);return _0x3687a0[_0x24b2('0x12d')](_0x20ca22);}})[_0x24b2('0x15')](function(_0x4742f8){if(_0x4742f8){_0x203d6a=_0x4742f8[_0x24b2('0x4b')];if(!_0x4a630a[_0x24b2('0x43')][_0x24b2('0xd5')](_0x24b2('0xdc'))){_0x20ca22[_0x24b2('0x24')]=qs[_0x24b2('0x24')](_0x4a630a[_0x24b2('0x43')][_0x24b2('0x24')]);_0x20ca22[_0x24b2('0x22')]=qs['offset'](_0x4a630a[_0x24b2('0x43')][_0x24b2('0x22')]);}return _0x3687a0[_0x24b2('0x12d')](_0x20ca22);}})[_0x24b2('0x15')](function(_0x14d551){if(_0x14d551){return _0x14d551?{'count':_0x203d6a,'rows':_0x14d551}:null;}})[_0x24b2('0x15')](respondWithResult(_0x4d45b2,null))[_0x24b2('0x1f')](handleError(_0x4d45b2,null));};exports[_0x24b2('0x12e')]=function(_0xe9b133,_0x2117fb){var _0x1787ca={};var _0x512a86={};var _0x4c6175;return db[_0x24b2('0x3c')]['findOne']({'where':{'id':_0xe9b133[_0x24b2('0x54')]['id']}})[_0x24b2('0x15')](handleEntityNotFound(_0x2117fb,null))[_0x24b2('0x15')](function(_0x5db3b2){if(_0x5db3b2){_0x4c6175=_0x5db3b2;_0x512a86[_0x24b2('0x55')]=_[_0x24b2('0x59')](db[_0x24b2('0x3c')]['rawAttributes']);_0x512a86[_0x24b2('0x43')]=_[_0x24b2('0x59')](_0xe9b133[_0x24b2('0x43')]);_0x512a86[_0x24b2('0x5a')]=_[_0x24b2('0x5b')](_0x512a86['model'],_0x512a86[_0x24b2('0x43')]);_0x1787ca[_0x24b2('0x47')]=_[_0x24b2('0x5b')](_0x512a86['model'],qs[_0x24b2('0x5c')](_0xe9b133[_0x24b2('0x43')][_0x24b2('0x5c')]));_0x1787ca[_0x24b2('0x47')]=_0x1787ca[_0x24b2('0x47')][_0x24b2('0x4b')]?_0x1787ca[_0x24b2('0x47')]:_0x512a86[_0x24b2('0x55')];_0x1787ca[_0x24b2('0xd1')]=qs[_0x24b2('0xd2')](_0xe9b133[_0x24b2('0x43')]['sort']);_0x1787ca[_0x24b2('0x42')]=qs[_0x24b2('0x5a')](_['pick'](_0xe9b133[_0x24b2('0x43')],_0x512a86[_0x24b2('0x5a')]));if(_0xe9b133[_0x24b2('0x43')][_0x24b2('0xd4')]){_0x1787ca[_0x24b2('0x42')]=_['merge'](_0x1787ca['where'],{'$or':_[_0x24b2('0x34')](_0x1787ca[_0x24b2('0x47')],function(_0x563d78){var _0x39a1db={};_0x39a1db[_0x563d78]={'$like':'%'+_0xe9b133[_0x24b2('0x43')][_0x24b2('0xd4')]+'%'};return _0x39a1db;})});}_0x1787ca['model']=db[_0x24b2('0x3c')];_0x1787ca['as']=_0x24b2('0x30');_0x1787ca=_[_0x24b2('0x5f')]({},_0x1787ca,_0xe9b133[_0x24b2('0x60')]);return _0x4c6175[_0x24b2('0xfa')]({'include':[_0x1787ca]});}})['then'](function(_0x102c89){if(_0x102c89){var _0x20749e={},_0x3d4aba=[];for(var _0x584803=0x0;_0x584803<_0x102c89[_0x24b2('0x4b')];_0x584803+=0x1){for(var _0x3c72ee=0x0,_0x45b41a;_0x3c72ee<_0x102c89[_0x584803][_0x24b2('0x30')][_0x24b2('0x4b')];_0x3c72ee+=0x1){_0x45b41a=_0x102c89[_0x584803][_0x24b2('0x30')][_0x3c72ee]['get']({'plain':!![]});_0x20749e[_0x45b41a['id']]=_0x45b41a;}}_0x20749e=_[_0x24b2('0x12f')](_0x20749e);for(var _0x4f17a8=qs[_0x24b2('0x22')](_0xe9b133['query'][_0x24b2('0x22')]);_0x4f17a8<_0x20749e[_0x24b2('0x4b')]&&_0x3d4aba[_0x24b2('0x4b')]=_0x25f542[_0x0ff8('0x55')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x0ff8('0xd')](function(){if(_0x2eb07c){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x2eb07c[_0x0ff8('0x2c')]},'individualHooks':!![]});}})[_0x0ff8('0xd')](function(){if(_0x2eb07c){return _0x2eb07c[_0x0ff8('0x56')]({'raw':!![]});}})[_0x0ff8('0xd')](function(_0x138d2d){if(_0x2eb07c){if(_0x138d2d){var _0x3634d6=[];_0x3cf48a=_0x138d2d;if(_0x3cf48a[_0x0ff8('0x2e')]){for(var _0x361f6d=0x0;_0x361f6d<_0x3cf48a['length'];_0x361f6d++){_0x3634d6[_0x0ff8('0x4b')](db[_0x0ff8('0x29')][_0x0ff8('0x57')]({'membername':_0x2eb07c[_0x0ff8('0x2c')],'UserId':_0x2eb07c['id'],'queue_name':_0x3cf48a[_0x361f6d][_0x0ff8('0x2c')],'VoiceQueueId':_0x3cf48a[_0x361f6d]['id'],'interface':_0x51f0c7,'paused':_0x2eb07c[_0x0ff8('0x50')]||![],'penalty':_0x3cf48a[_0x361f6d][_0x0ff8('0x58')]||0x0}));}return BPromise[_0x0ff8('0x4c')](_0x3634d6);}}}})[_0x0ff8('0xd')](function(){if(_0x2eb07c){return db[_0x0ff8('0x2b')][_0x0ff8('0x19')]({'where':{'membername':_0x2eb07c['name'],'exitAt':null}});}})[_0x0ff8('0xd')](function(_0x2b91e7){if(_0x2eb07c){if(_0x2b91e7&&_0x2b91e7[_0x0ff8('0x2e')]){var _0x3fd337=[];_0x2b91e7[_0x0ff8('0x32')](function(_0x3035ee){_0x3fd337[_0x0ff8('0x4b')](_0x3035ee['update']({'exitAt':moment()[_0x0ff8('0x2f')](_0x0ff8('0x3b'))}));});return BPromise['all'](_0x3fd337);}}})['then'](function(_0x54e24c){if(_0x2eb07c){var _0x453616=[];var _0x231c49=[];var _0x5c9cfb=utils[_0x0ff8('0x31')]();var _0x3ec34c={'membername':_0x2eb07c[_0x0ff8('0x2c')],'interface':_0x51f0c7,'enterAt':moment()[_0x0ff8('0x2f')](_0x0ff8('0x3b')),'role':_0x2eb07c[_0x0ff8('0x37')],'internal':_0x2eb07c[_0x0ff8('0x27')]};_0x5c9cfb[_0x0ff8('0x32')](function(_0xe1d2f7){_0x453616[_0x0ff8('0x4b')](_['merge']({'channel':_0xe1d2f7,'type':'LOGIN','data1':'callysquare','data2':_0x51f0c7},_0x3ec34c));if(_0x2eb07c[_0x0ff8('0x50')]){_0x231c49[_0x0ff8('0x4b')](_[_0x0ff8('0x59')]({'channel':_0xe1d2f7,'type':_0x0ff8('0x2d'),'data1':'LOGININPAUSE'},_0x3ec34c));}});return db[_0x0ff8('0x2b')][_0x0ff8('0x39')](_0x453616[_0x0ff8('0x5a')](_0x231c49),{'individualHooks':!![]});}})[_0x0ff8('0xd')](function(){if(_0x2eb07c){return _0x2eb07c[_0x0ff8('0x2a')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2eb07c[_0x0ff8('0x50')]||![],'mailPause':_0x2eb07c[_0x0ff8('0x50')]||![],'chatPause':_0x2eb07c[_0x0ff8('0x50')]||![],'faxPause':_0x2eb07c[_0x0ff8('0x50')]||![],'smsPause':_0x2eb07c[_0x0ff8('0x50')]||![],'openchannelPause':_0x2eb07c[_0x0ff8('0x50')]||![],'pauseType':_0x2eb07c['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x0ff8('0x2f')](_0x0ff8('0x3b')),'interface':_0x51f0c7});}})[_0x0ff8('0xd')](function(_0x32e9d5){_0x425f48(_0x32e9d5);})[_0x0ff8('0x17')](function(_0x174304){_0x4459f7(_0x59fecb[_0x0ff8('0x13')](0x1f4,_0x174304[_0x0ff8('0x15')]));});});}; \ No newline at end of file +var _0x1c67=['User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','message','result','catch','findAll','options','where','attributes','limit','include','map','model','then','GetUser','stringify','ShowUser','find','raw','PauseUser','name','role','internal','interface','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','SIP/%s','type','DEFAULT\x20PAUSE','body','uniqueid','update','UnpauseUser','User','findOne','channel','isValidChannel','Unknown\x20channel','voice','UserVoiceQueueRt','system','mail','chat','fax','openchannel','whatsapp','set','%s%s','Pause','push','all','destroy','LoginUser','phone','loginInPause','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','merge','callysquare','concat','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','register','info'];(function(_0x10a42d,_0x4ad8a6){var _0x521559=function(_0x4d1f0f){while(--_0x4d1f0f){_0x10a42d['push'](_0x10a42d['shift']());}};_0x521559(++_0x4ad8a6);}(_0x1c67,0x100));var _0x71c6=function(_0x1e63f8,_0x11a865){_0x1e63f8=_0x1e63f8-0x0;var _0x9ac527=_0x1c67[_0x1e63f8];return _0x9ac527;};'use strict';var _=require(_0x71c6('0x0'));var util=require(_0x71c6('0x1'));var moment=require(_0x71c6('0x2'));var BPromise=require(_0x71c6('0x3'));var rs=require(_0x71c6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71c6('0x5'))['db'];var utils=require(_0x71c6('0x6'));var logger=require('../../config/logger')(_0x71c6('0x7'));var config=require(_0x71c6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x71c6('0x9')]['http']({'port':0x232a});config[_0x71c6('0xa')]=_[_0x71c6('0xb')](config[_0x71c6('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x71c6('0xa')]));require('./user.socket')[_0x71c6('0xc')](socket);function respondWithRpcPromise(_0x560bc6,_0xaf577b,_0x4067bf){return new BPromise(function(_0x325a7d,_0xa5c176){return client['request'](_0x560bc6,_0x4067bf)['then'](function(_0x2c3fa){logger[_0x71c6('0xd')](_0x71c6('0xe'),_0xaf577b,_0x71c6('0xf'));logger[_0x71c6('0x10')](_0x71c6('0x11'),_0xaf577b,'request\x20sent',JSON['stringify'](_0x2c3fa));if(_0x2c3fa[_0x71c6('0x12')]){if(_0x2c3fa[_0x71c6('0x12')]['code']===0x1f4){logger[_0x71c6('0x12')]('User,\x20%s,\x20%s',_0xaf577b,_0x2c3fa[_0x71c6('0x12')][_0x71c6('0x13')]);return _0xa5c176(_0x2c3fa[_0x71c6('0x12')][_0x71c6('0x13')]);}logger['error'](_0x71c6('0xe'),_0xaf577b,_0x2c3fa[_0x71c6('0x12')]['message']);return _0x325a7d(_0x2c3fa[_0x71c6('0x12')][_0x71c6('0x13')]);}else{logger['info']('User,\x20%s,\x20%s',_0xaf577b,_0x71c6('0xf'));_0x325a7d(_0x2c3fa[_0x71c6('0x14')][_0x71c6('0x13')]);}})[_0x71c6('0x15')](function(_0x3f1484){logger[_0x71c6('0x12')]('User,\x20%s,\x20%s',_0xaf577b,_0x3f1484);_0xa5c176(_0x3f1484);});});}exports['GetUser']=function(_0x177d56){var _0x2c5ff5=this;return new Promise(function(_0x4f5542,_0xa7a2aa){return db['User'][_0x71c6('0x16')]({'raw':_0x177d56[_0x71c6('0x17')]?_0x177d56[_0x71c6('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x177d56['options']?_0x177d56[_0x71c6('0x17')][_0x71c6('0x18')]||null:null,'attributes':_0x177d56[_0x71c6('0x17')]?_0x177d56['options'][_0x71c6('0x19')]||null:null,'limit':_0x177d56[_0x71c6('0x17')]?_0x177d56[_0x71c6('0x17')][_0x71c6('0x1a')]||null:null,'include':_0x177d56[_0x71c6('0x17')]?_0x177d56[_0x71c6('0x17')][_0x71c6('0x1b')]?_[_0x71c6('0x1c')](_0x177d56[_0x71c6('0x17')][_0x71c6('0x1b')],function(_0x32e8de){return{'model':db[_0x32e8de['model']],'as':_0x32e8de['as'],'attributes':_0x32e8de[_0x71c6('0x19')],'include':_0x32e8de[_0x71c6('0x1b')]?_[_0x71c6('0x1c')](_0x32e8de[_0x71c6('0x1b')],function(_0x5758fb){return{'model':db[_0x5758fb[_0x71c6('0x1d')]],'as':_0x5758fb['as'],'attributes':_0x5758fb[_0x71c6('0x19')],'include':_0x5758fb['include']?_['map'](_0x5758fb[_0x71c6('0x1b')],function(_0x3b203f){return{'model':db[_0x3b203f[_0x71c6('0x1d')]],'as':_0x3b203f['as'],'attributes':_0x3b203f['attributes']};}):[]};}):[]};}):[]:[]})[_0x71c6('0x1e')](function(_0xc0074){logger['info'](_0x71c6('0x1f'),_0x177d56);logger[_0x71c6('0x10')](_0x71c6('0x1f'),_0x177d56,JSON[_0x71c6('0x20')](_0xc0074));_0x4f5542(_0xc0074);})['catch'](function(_0x51c3ee){logger[_0x71c6('0x12')](_0x71c6('0x1f'),_0x51c3ee[_0x71c6('0x13')],_0x177d56);_0xa7a2aa(_0x2c5ff5[_0x71c6('0x12')](0x1f4,_0x51c3ee['message']));});});};exports[_0x71c6('0x21')]=function(_0x2cf34a){var _0x436fc9=this;return new Promise(function(_0x265c0d,_0x38a2d4){return db['User'][_0x71c6('0x22')]({'raw':_0x2cf34a[_0x71c6('0x17')]?_0x2cf34a['options'][_0x71c6('0x23')]===undefined?!![]:![]:!![],'where':_0x2cf34a[_0x71c6('0x17')]?_0x2cf34a[_0x71c6('0x17')][_0x71c6('0x18')]||null:null,'attributes':_0x2cf34a[_0x71c6('0x17')]?_0x2cf34a[_0x71c6('0x17')][_0x71c6('0x19')]||null:null,'include':_0x2cf34a[_0x71c6('0x17')]?_0x2cf34a[_0x71c6('0x17')][_0x71c6('0x1b')]?_[_0x71c6('0x1c')](_0x2cf34a[_0x71c6('0x17')]['include'],function(_0x4909fe){return{'model':db[_0x4909fe['model']],'as':_0x4909fe['as'],'attributes':_0x4909fe[_0x71c6('0x19')],'include':_0x4909fe[_0x71c6('0x1b')]?_[_0x71c6('0x1c')](_0x4909fe[_0x71c6('0x1b')],function(_0x2f7aa1){return{'model':db[_0x2f7aa1[_0x71c6('0x1d')]],'as':_0x2f7aa1['as'],'attributes':_0x2f7aa1[_0x71c6('0x19')],'include':_0x2f7aa1[_0x71c6('0x1b')]?_[_0x71c6('0x1c')](_0x2f7aa1[_0x71c6('0x1b')],function(_0x450c5a){return{'model':db[_0x450c5a[_0x71c6('0x1d')]],'as':_0x450c5a['as'],'attributes':_0x450c5a[_0x71c6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x71c6('0x1e')](function(_0x4b4f09){logger['info']('ShowUser',_0x2cf34a);logger[_0x71c6('0x10')](_0x71c6('0x21'),_0x2cf34a,JSON[_0x71c6('0x20')](_0x4b4f09));_0x265c0d(_0x4b4f09);})['catch'](function(_0x5c949f){logger[_0x71c6('0x12')](_0x71c6('0x21'),_0x5c949f[_0x71c6('0x13')],_0x2cf34a);_0x38a2d4(_0x436fc9['error'](0x1f4,_0x5c949f[_0x71c6('0x13')]));});});};exports[_0x71c6('0x24')]=function(_0x2706e5){var _0x46f0f1=this;return new Promise(function(_0x3ddada,_0x1dec68){var _0x2a7e45;return db['User']['find']({'where':_0x2706e5['options']['where']||{},'attributes':['id',_0x71c6('0x25'),_0x71c6('0x26'),_0x71c6('0x27'),_0x71c6('0x28')]})[_0x71c6('0x1e')](function(_0x59c524){if(_0x59c524){_0x2a7e45=_0x59c524;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x2a7e45['id']},'individualHooks':!![]});}})[_0x71c6('0x1e')](function(){if(_0x2a7e45){return db[_0x71c6('0x29')][_0x71c6('0x16')]({'where':{'membername':_0x2a7e45[_0x71c6('0x25')],'type':_0x71c6('0x2a'),'exitAt':null}});}})[_0x71c6('0x1e')](function(_0xd6ba89){if(_0x2a7e45){if(_0xd6ba89&&_0xd6ba89[_0x71c6('0x2b')]){var _0x2d64cd=moment()[_0x71c6('0x2c')](_0x71c6('0x2d'));for(var _0x2b8c35=0x0,_0x16dee7=_0xd6ba89[_0x71c6('0x2b')];_0x2b8c35<_0x16dee7;_0x2b8c35++){_0xd6ba89[_0x2b8c35][_0x71c6('0x2e')]({'exitAt':_0x2d64cd});}}}})[_0x71c6('0x1e')](function(){if(_0x2a7e45){var _0x55d48f=[];var _0x24de64=utils[_0x71c6('0x2f')]();_0x24de64[_0x71c6('0x30')](function(_0x1d5999){_0x55d48f['push']({'channel':_0x1d5999,'membername':_0x2a7e45[_0x71c6('0x25')],'interface':_[_0x71c6('0x31')](_0x2a7e45[_0x71c6('0x28')])?util[_0x71c6('0x2c')](_0x71c6('0x32'),_0x2a7e45[_0x71c6('0x25')]):_0x2a7e45[_0x71c6('0x28')],'type':_0x71c6('0x2a'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x2706e5['body'][_0x71c6('0x33')]||_0x71c6('0x34'),'role':_0x2a7e45['role'],'internal':_0x2a7e45[_0x71c6('0x27')],'uniqueid':_0x2706e5[_0x71c6('0x35')][_0x71c6('0x36')]||null});});return db[_0x71c6('0x29')]['bulkCreate'](_0x55d48f,{'individualHooks':!![]});}})[_0x71c6('0x1e')](function(){if(_0x2a7e45){return _0x2a7e45[_0x71c6('0x37')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2706e5[_0x71c6('0x35')]['type']||_0x71c6('0x34'),'lastPauseAt':moment()[_0x71c6('0x2c')](_0x71c6('0x2d'))});}})[_0x71c6('0x1e')](function(_0x405768){_0x3ddada(_0x405768);})[_0x71c6('0x15')](function(_0x5d17d4){_0x1dec68(_0x46f0f1[_0x71c6('0x12')](0x1f4,_0x5d17d4['message']));});});};exports[_0x71c6('0x38')]=function(_0x5342f9){var _0x45c2b2=this;return new Promise(function(_0x429064,_0x4a87d){var _0x3b26a8;return db[_0x71c6('0x39')][_0x71c6('0x3a')]({'where':_0x5342f9[_0x71c6('0x17')][_0x71c6('0x18')]||{},'attributes':['id',_0x71c6('0x25')]})[_0x71c6('0x1e')](function(_0x409453){if(_0x409453){_0x3b26a8=_0x409453;if(_0x5342f9['body'][_0x71c6('0x3b')]&&!utils[_0x71c6('0x3c')](_0x5342f9[_0x71c6('0x35')][_0x71c6('0x3b')])){throw new Error(_0x71c6('0x3d'));}switch(_0x5342f9[_0x71c6('0x35')][_0x71c6('0x3b')]){case _0x71c6('0x3e'):return db[_0x71c6('0x3f')]['update']({'paused':0x0},{'where':{'UserId':_0x3b26a8['id']}})[_0x71c6('0x1e')](function(){return db[_0x71c6('0x29')][_0x71c6('0x22')]({'where':{'channel':_0x5342f9['body'][_0x71c6('0x3b')],'membername':_0x3b26a8[_0x71c6('0x25')],'type':_0x71c6('0x2a'),'exitAt':null}});})['then'](function(_0x47c2db){if(_0x47c2db){return _0x47c2db[_0x71c6('0x37')]({'exitAt':moment()['format'](_0x71c6('0x2d')),'data2':_0x71c6('0x40')},{'individualHooks':!![]});}return null;})[_0x71c6('0x1e')](function(){return _0x3b26a8[_0x71c6('0x37')]({'voicePause':![]});});case _0x71c6('0x41'):case _0x71c6('0x42'):case _0x71c6('0x43'):case'sms':case _0x71c6('0x44'):case _0x71c6('0x45'):return db[_0x71c6('0x29')][_0x71c6('0x22')]({'where':{'channel':_0x5342f9[_0x71c6('0x35')]['channel'],'membername':_0x3b26a8[_0x71c6('0x25')],'type':_0x71c6('0x2a'),'exitAt':null}})['then'](function(_0x5bd1c9){return _0x5bd1c9[_0x71c6('0x37')]({'exitAt':moment()['format'](_0x71c6('0x2d')),'data2':_0x71c6('0x40')},{'individualHooks':!![]});})[_0x71c6('0x1e')](function(){var _0xbe5494={};_[_0x71c6('0x46')](_0xbe5494,util[_0x71c6('0x2c')](_0x71c6('0x47'),_0x5342f9[_0x71c6('0x35')][_0x71c6('0x3b')],_0x71c6('0x48')),![]);return _0x3b26a8[_0x71c6('0x37')](_0xbe5494);});default:return db['UserVoiceQueueRt'][_0x71c6('0x37')]({'paused':0x0},{'where':{'UserId':_0x3b26a8['id']}})['then'](function(){return db[_0x71c6('0x29')][_0x71c6('0x16')]({'where':{'membername':_0x3b26a8[_0x71c6('0x25')],'type':_0x71c6('0x2a'),'exitAt':null}});})['then'](function(_0x25df1c){var _0x1b431d=[];_0x25df1c[_0x71c6('0x30')](function(_0x170308){_0x1b431d[_0x71c6('0x49')](_0x170308[_0x71c6('0x37')]({'exitAt':moment()[_0x71c6('0x2c')](_0x71c6('0x2d')),'data2':_0x71c6('0x40')}));});return BPromise[_0x71c6('0x4a')](_0x1b431d);})[_0x71c6('0x1e')](function(){return _0x3b26a8[_0x71c6('0x37')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x71c6('0x1e')](function(_0x550120){_0x429064(_0x550120);})[_0x71c6('0x15')](function(_0x18eeef){_0x4a87d(_0x45c2b2['error'](0x1f4,_0x18eeef[_0x71c6('0x13')]));});});};exports['LogoutUser']=function(_0x723ee1){var _0xd9d241=this;return new Promise(function(_0x3905ba,_0x470036){var _0x2bcc88;return db[_0x71c6('0x39')][_0x71c6('0x3a')]({'where':_0x723ee1[_0x71c6('0x17')][_0x71c6('0x18')]||{},'attributes':['id',_0x71c6('0x25')]})['then'](function(_0x411817){if(_0x411817){_0x2bcc88=_0x411817;return db['UserVoiceQueueRt'][_0x71c6('0x4b')]({'where':{'membername':_0x2bcc88[_0x71c6('0x25')]},'individualHooks':!![]});}})[_0x71c6('0x1e')](function(){if(_0x2bcc88){return db[_0x71c6('0x29')][_0x71c6('0x16')]({'where':{'membername':_0x2bcc88[_0x71c6('0x25')],'exitAt':null}});}})[_0x71c6('0x1e')](function(_0x183c02){if(_0x2bcc88){if(_0x183c02&&_0x183c02['length']){var _0x301d13=[];_0x183c02[_0x71c6('0x30')](function(_0x4e93ee){_0x301d13['push'](_0x4e93ee[_0x71c6('0x37')]({'exitAt':moment()[_0x71c6('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x71c6('0x4a')](_0x301d13);}}})[_0x71c6('0x1e')](function(){if(_0x2bcc88){return _0x2bcc88[_0x71c6('0x37')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0xa34560){_0x3905ba(_0xa34560);})[_0x71c6('0x15')](function(_0x1af7b2){_0x470036(_0xd9d241[_0x71c6('0x12')](0x1f4,_0x1af7b2[_0x71c6('0x13')]));});});};exports[_0x71c6('0x4c')]=function(_0x322320){var _0x3dfbf7=this;return new Promise(function(_0x11411a,_0x312b1a){var _0xcc902e;var _0x5bd399;var _0x24eb74;var _0x455574;return db[_0x71c6('0x39')]['findOne']({'where':_0x322320[_0x71c6('0x17')]['where']||{},'attributes':['id',_0x71c6('0x25'),'role','mobile',_0x71c6('0x4d'),_0x71c6('0x27'),_0x71c6('0x4e'),_0x71c6('0x28')]})[_0x71c6('0x1e')](function(_0x1f4b03){if(_0x1f4b03){_0xcc902e=_0x1f4b03;_0x455574=_0x322320[_0x71c6('0x35')]['interface']?_0x322320['body'][_0x71c6('0x28')]:util[_0x71c6('0x2c')](_0x71c6('0x32'),_0xcc902e[_0x71c6('0x25')]);return db[_0x71c6('0x39')]['count']({'where':{'role':_0x71c6('0x4f'),'online':!![],'id':{'$ne':_0xcc902e['id']}}});}})[_0x71c6('0x1e')](function(_0x199638){if(_0x199638){_0x24eb74=_0x199638;return require(_0x71c6('0x50'))[_0x71c6('0x51')]();}})[_0x71c6('0x1e')](function(_0x1645bc){if(_0x1645bc&&_0x1645bc[_0x71c6('0x52')]&&_0x24eb74>=_0x1645bc['agents']){throw new Error(_0x71c6('0x53'));}})[_0x71c6('0x1e')](function(){if(_0xcc902e){return db['UserVoiceQueueRt'][_0x71c6('0x4b')]({'where':{'membername':_0xcc902e[_0x71c6('0x25')]},'individualHooks':!![]});}})[_0x71c6('0x1e')](function(){if(_0xcc902e){return _0xcc902e['getVoiceQueues']({'raw':!![]});}})[_0x71c6('0x1e')](function(_0x448059){if(_0xcc902e){if(_0x448059){var _0x14fa6=[];_0x5bd399=_0x448059;if(_0x5bd399['length']){for(var _0x28a3a5=0x0;_0x28a3a5<_0x5bd399[_0x71c6('0x2b')];_0x28a3a5++){_0x14fa6['push'](db[_0x71c6('0x3f')][_0x71c6('0x54')]({'membername':_0xcc902e[_0x71c6('0x25')],'UserId':_0xcc902e['id'],'queue_name':_0x5bd399[_0x28a3a5]['name'],'VoiceQueueId':_0x5bd399[_0x28a3a5]['id'],'interface':_0x455574,'paused':_0xcc902e['loginInPause']||![],'penalty':_0x5bd399[_0x28a3a5][_0x71c6('0x55')]||0x0}));}return BPromise[_0x71c6('0x4a')](_0x14fa6);}}}})[_0x71c6('0x1e')](function(){if(_0xcc902e){return db[_0x71c6('0x29')][_0x71c6('0x16')]({'where':{'membername':_0xcc902e[_0x71c6('0x25')],'exitAt':null}});}})[_0x71c6('0x1e')](function(_0x2d5307){if(_0xcc902e){if(_0x2d5307&&_0x2d5307[_0x71c6('0x2b')]){var _0x410607=[];_0x2d5307['forEach'](function(_0x30146a){_0x410607[_0x71c6('0x49')](_0x30146a[_0x71c6('0x37')]({'exitAt':moment()[_0x71c6('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x71c6('0x4a')](_0x410607);}}})[_0x71c6('0x1e')](function(_0x53da6c){if(_0xcc902e){var _0x26fb07=[];var _0x14de3c=[];var _0x5a853c=utils[_0x71c6('0x2f')]();var _0x353d72={'membername':_0xcc902e['name'],'interface':_0x455574,'enterAt':moment()['format'](_0x71c6('0x2d')),'role':_0xcc902e[_0x71c6('0x26')],'internal':_0xcc902e['internal']};_0x5a853c[_0x71c6('0x30')](function(_0x5328e9){_0x26fb07['push'](_[_0x71c6('0x56')]({'channel':_0x5328e9,'type':'LOGIN','data1':_0x71c6('0x57'),'data2':_0x455574},_0x353d72));if(_0xcc902e[_0x71c6('0x4e')]){_0x14de3c[_0x71c6('0x49')](_['merge']({'channel':_0x5328e9,'type':_0x71c6('0x2a'),'data1':'LOGININPAUSE'},_0x353d72));}});return db[_0x71c6('0x29')]['bulkCreate'](_0x26fb07[_0x71c6('0x58')](_0x14de3c),{'individualHooks':!![]});}})[_0x71c6('0x1e')](function(){if(_0xcc902e){return _0xcc902e['update']({'online':!![],'lastLoginAt':moment()[_0x71c6('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0xcc902e[_0x71c6('0x4e')]||![],'mailPause':_0xcc902e[_0x71c6('0x4e')]||![],'chatPause':_0xcc902e[_0x71c6('0x4e')]||![],'faxPause':_0xcc902e[_0x71c6('0x4e')]||![],'smsPause':_0xcc902e['loginInPause']||![],'openchannelPause':_0xcc902e[_0x71c6('0x4e')]||![],'pauseType':_0xcc902e[_0x71c6('0x4e')]?_0x71c6('0x59'):null,'lastPauseAt':moment()[_0x71c6('0x2c')](_0x71c6('0x2d')),'interface':_0x455574});}})[_0x71c6('0x1e')](function(_0x4dc98f){_0x11411a(_0x4dc98f);})[_0x71c6('0x15')](function(_0x479e79){_0x312b1a(_0x3dfbf7['error'](0x1f4,_0x479e79[_0x71c6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 8d61ee7..7e912ac 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 _0xdc0d=['removeListener','length','./user.events','save','remove','update','emit'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xdc0d,0xbf));var _0xddc0=function(_0x4d4087,_0x4ce9a6){_0x4d4087=_0x4d4087-0x0;var _0x1d6e26=_0xdc0d[_0x4d4087];return _0x1d6e26;};'use strict';var UserEvents=require(_0xddc0('0x0'));var events=[_0xddc0('0x1'),_0xddc0('0x2'),_0xddc0('0x3')];function createListener(_0x4397d2,_0x531895){return function(_0x3df444){_0x531895[_0xddc0('0x4')](_0x4397d2,_0x3df444);};}function removeListener(_0x5b3aee,_0x5210be){return function(){UserEvents[_0xddc0('0x5')](_0x5b3aee,_0x5210be);};}exports['register']=function(_0x16c427){for(var _0x340b1f=0x0,_0x2ae9fe=events[_0xddc0('0x6')];_0x340b1f<_0x2ae9fe;_0x340b1f++){var _0x187d35=events[_0x340b1f];var _0x2d1c43=createListener('user:'+_0x187d35,_0x16c427);UserEvents['on'](_0x187d35,_0x2d1c43);}}; \ No newline at end of file +var _0x842c=['emit','removeListener','register','user:','./user.events','save','remove','update'];(function(_0x473938,_0x1a4d8c){var _0x214615=function(_0x135810){while(--_0x135810){_0x473938['push'](_0x473938['shift']());}};_0x214615(++_0x1a4d8c);}(_0x842c,0x1bc));var _0xc842=function(_0x18cb8d,_0x46dc3d){_0x18cb8d=_0x18cb8d-0x0;var _0x4cf43a=_0x842c[_0x18cb8d];return _0x4cf43a;};'use strict';var UserEvents=require(_0xc842('0x0'));var events=[_0xc842('0x1'),_0xc842('0x2'),_0xc842('0x3')];function createListener(_0x33c9e8,_0x54d94a){return function(_0x556672){_0x54d94a[_0xc842('0x4')](_0x33c9e8,_0x556672);};}function removeListener(_0x1bafb0,_0x440134){return function(){UserEvents[_0xc842('0x5')](_0x1bafb0,_0x440134);};}exports[_0xc842('0x6')]=function(_0x1b7358){for(var _0x49e96a=0x0,_0x238a6d=events['length'];_0x49e96a<_0x238a6d;_0x49e96a++){var _0x57d338=events[_0x49e96a];var _0x5333e0=createListener(_0xc842('0x7')+_0x57d338,_0x1b7358);UserEvents['on'](_0x57d338,_0x5333e0);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 45f58eb..aa32f90 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x578482,_0x597d67){var _0x44f9f9=function(_0x24432a){while(--_0x24432a){_0x578482['push'](_0x578482['shift']());}};_0x44f9f9(++_0x597d67);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0xcb91[_0x1dbaf7];return _0x593f05;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x155f22,_0x30422c){var _0x569d57=function(_0x1aeed6){while(--_0x1aeed6){_0x155f22['push'](_0x155f22['shift']());}};_0x569d57(++_0x30422c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 95676e6..b7bf29e 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 _0x47aa=['exports','INTEGER','sequelize'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x47aa,0x9e));var _0xa47a=function(_0x5c840e,_0x3e3d83){_0x5c840e=_0x5c840e-0x0;var _0xa4079a=_0x47aa[_0x5c840e];return _0xa4079a;};'use strict';var Sequelize=require(_0xa47a('0x0'));module[_0xa47a('0x1')]={'penalty':{'type':Sequelize[_0xa47a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x50e5=['exports','INTEGER'];(function(_0x56ec07,_0x56a55f){var _0x3ce6f7=function(_0x1915c6){while(--_0x1915c6){_0x56ec07['push'](_0x56ec07['shift']());}};_0x3ce6f7(++_0x56a55f);}(_0x50e5,0x66));var _0x550e=function(_0x33a3ac,_0x1f93fe){_0x33a3ac=_0x33a3ac-0x0;var _0x7144e7=_0x50e5[_0x33a3ac];return _0x7144e7;};'use strict';var Sequelize=require('sequelize');module[_0x550e('0x0')]={'penalty':{'type':Sequelize[_0x550e('0x1')],'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 014277f..1f0087a 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 _0x5958=['path','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x5958,0x97));var _0x8595=function(_0x1dfa63,_0x362bd4){_0x1dfa63=_0x1dfa63-0x0;var _0x26f2a9=_0x5958[_0x1dfa63];return _0x26f2a9;};'use strict';var _=require(_0x8595('0x0'));var util=require(_0x8595('0x1'));var logger=require(_0x8595('0x2'))('api');var moment=require(_0x8595('0x3'));var BPromise=require(_0x8595('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8595('0x5'));var rimraf=require('rimraf');var config=require(_0x8595('0x6'));var attributes=require(_0x8595('0x7'));module[_0x8595('0x8')]=function(_0x3f5562,_0xa87aa4){return _0x3f5562[_0x8595('0x9')](_0x8595('0xa'),attributes,{'tableName':_0x8595('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe31a=['request-promise','path','rimraf','../../config/environment','exports','define','UserChatQueue','lodash','util','moment','bluebird'];(function(_0x51185b,_0x320003){var _0x14ae64=function(_0x356cb3){while(--_0x356cb3){_0x51185b['push'](_0x51185b['shift']());}};_0x14ae64(++_0x320003);}(_0xe31a,0xe3));var _0xae31=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xe31a[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0xae31('0x0'));var util=require(_0xae31('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xae31('0x2'));var BPromise=require(_0xae31('0x3'));var rp=require(_0xae31('0x4'));var fs=require('fs');var path=require(_0xae31('0x5'));var rimraf=require(_0xae31('0x6'));var config=require(_0xae31('0x7'));var attributes=require('./userChatQueue.attributes');module[_0xae31('0x8')]=function(_0x1c445d,_0x496421){return _0x1c445d[_0xae31('0x9')](_0xae31('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index aac3b5b..476a3ab 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 _0x3fda=['UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','request\x20sent','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x4fb3f9,_0x11a445){var _0x4b55e8=function(_0x238779){while(--_0x238779){_0x4fb3f9['push'](_0x4fb3f9['shift']());}};_0x4b55e8(++_0x11a445);}(_0x3fda,0xbc));var _0xa3fd=function(_0x1cce12,_0x355196){_0x1cce12=_0x1cce12-0x0;var _0x57ebd3=_0x3fda[_0x1cce12];return _0x57ebd3;};'use strict';var _=require(_0xa3fd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa3fd('0x1'));var fs=require('fs');var Redis=require(_0xa3fd('0x2'));var db=require(_0xa3fd('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa3fd('0x4'))(_0xa3fd('0x5'));var config=require(_0xa3fd('0x6'));var jayson=require(_0xa3fd('0x7'));var client=jayson[_0xa3fd('0x8')][_0xa3fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x512b40,_0x53c365,_0x29068e){return new BPromise(function(_0x655384,_0x4433ad){return client['request'](_0x512b40,_0x29068e)[_0xa3fd('0xa')](function(_0x1e85b7){logger[_0xa3fd('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x53c365,'request\x20sent');logger['debug'](_0xa3fd('0xc'),_0x53c365,'request\x20sent',JSON[_0xa3fd('0xd')](_0x1e85b7));if(_0x1e85b7[_0xa3fd('0xe')]){if(_0x1e85b7[_0xa3fd('0xe')][_0xa3fd('0xf')]===0x1f4){logger[_0xa3fd('0xe')](_0xa3fd('0x10'),_0x53c365,_0x1e85b7[_0xa3fd('0xe')]['message']);return _0x4433ad(_0x1e85b7[_0xa3fd('0xe')][_0xa3fd('0x11')]);}logger[_0xa3fd('0xe')](_0xa3fd('0x10'),_0x53c365,_0x1e85b7[_0xa3fd('0xe')][_0xa3fd('0x11')]);return _0x655384(_0x1e85b7[_0xa3fd('0xe')][_0xa3fd('0x11')]);}else{logger[_0xa3fd('0xb')](_0xa3fd('0x10'),_0x53c365,_0xa3fd('0x12'));_0x655384(_0x1e85b7['result'][_0xa3fd('0x11')]);}})[_0xa3fd('0x13')](function(_0x30e1c0){logger[_0xa3fd('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x53c365,_0x30e1c0);_0x4433ad(_0x30e1c0);});});} \ No newline at end of file +var _0xd8bd=['http','request','request\x20sent','debug','stringify','error','code','message','UserChatQueue,\x20%s,\x20%s','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xcdb4b7,_0x34e76e){var _0x172479=function(_0x1cf038){while(--_0x1cf038){_0xcdb4b7['push'](_0xcdb4b7['shift']());}};_0x172479(++_0x34e76e);}(_0xd8bd,0xb4));var _0xdd8b=function(_0x4df524,_0x4a04d3){_0x4df524=_0x4df524-0x0;var _0x365e5c=_0xd8bd[_0x4df524];return _0x365e5c;};'use strict';var _=require('lodash');var util=require(_0xdd8b('0x0'));var moment=require(_0xdd8b('0x1'));var BPromise=require(_0xdd8b('0x2'));var rs=require(_0xdd8b('0x3'));var fs=require('fs');var Redis=require(_0xdd8b('0x4'));var db=require(_0xdd8b('0x5'))['db'];var utils=require(_0xdd8b('0x6'));var logger=require(_0xdd8b('0x7'))(_0xdd8b('0x8'));var config=require(_0xdd8b('0x9'));var jayson=require(_0xdd8b('0xa'));var client=jayson[_0xdd8b('0xb')][_0xdd8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x325f7b,_0xd48633,_0x307aeb){return new BPromise(function(_0x5d64d5,_0x5ab727){return client[_0xdd8b('0xd')](_0x325f7b,_0x307aeb)['then'](function(_0x1454a7){logger['info']('UserChatQueue,\x20%s,\x20%s',_0xd48633,_0xdd8b('0xe'));logger[_0xdd8b('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0xd48633,_0xdd8b('0xe'),JSON[_0xdd8b('0x10')](_0x1454a7));if(_0x1454a7[_0xdd8b('0x11')]){if(_0x1454a7[_0xdd8b('0x11')][_0xdd8b('0x12')]===0x1f4){logger[_0xdd8b('0x11')]('UserChatQueue,\x20%s,\x20%s',_0xd48633,_0x1454a7[_0xdd8b('0x11')][_0xdd8b('0x13')]);return _0x5ab727(_0x1454a7[_0xdd8b('0x11')][_0xdd8b('0x13')]);}logger[_0xdd8b('0x11')](_0xdd8b('0x14'),_0xd48633,_0x1454a7['error']['message']);return _0x5d64d5(_0x1454a7[_0xdd8b('0x11')]['message']);}else{logger[_0xdd8b('0x15')](_0xdd8b('0x14'),_0xd48633,_0xdd8b('0xe'));_0x5d64d5(_0x1454a7[_0xdd8b('0x16')][_0xdd8b('0x13')]);}})[_0xdd8b('0x17')](function(_0x31e540){logger[_0xdd8b('0x11')](_0xdd8b('0x14'),_0xd48633,_0x31e540);_0x5ab727(_0x31e540);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 1a6d3ce..3d18ec8 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x169139,_0x447a88){var _0x3817fb=function(_0x507b53){while(--_0x507b53){_0x169139['push'](_0x169139['shift']());}};_0x3817fb(++_0x447a88);}(_0x70e0,0x17b));var _0x070e=function(_0x17a9e7,_0x19de90){_0x17a9e7=_0x17a9e7-0x0;var _0x53a048=_0x70e0[_0x17a9e7];return _0x53a048;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5e6bb2,_0x5478c6){var _0x43721e=function(_0x280fd3){while(--_0x280fd3){_0x5e6bb2['push'](_0x5e6bb2['shift']());}};_0x43721e(++_0x5478c6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 210d061..589b3d2 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 _0x7afd=['sequelize','INTEGER'];(function(_0x4d0f20,_0x130a10){var _0x551c25=function(_0xd3ef44){while(--_0xd3ef44){_0x4d0f20['push'](_0x4d0f20['shift']());}};_0x551c25(++_0x130a10);}(_0x7afd,0x7a));var _0xd7af=function(_0x4a0b15,_0x54818b){_0x4a0b15=_0x4a0b15-0x0;var _0x54f515=_0x7afd[_0x4a0b15];return _0x54f515;};'use strict';var Sequelize=require(_0xd7af('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd7af('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7f61=['sequelize','INTEGER'];(function(_0x460e2e,_0x564ba8){var _0x2b3784=function(_0xd7aeec){while(--_0xd7aeec){_0x460e2e['push'](_0x460e2e['shift']());}};_0x2b3784(++_0x564ba8);}(_0x7f61,0x1ee));var _0x17f6=function(_0x518fd1,_0x29854d){_0x518fd1=_0x518fd1-0x0;var _0x39061b=_0x7f61[_0x518fd1];return _0x39061b;};'use strict';var Sequelize=require(_0x17f6('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x17f6('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x17f6('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 2e1b260..f9cef98 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 _0xbf1a=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x2e6516,_0x125bc3){var _0xafbb16=function(_0x4a7a03){while(--_0x4a7a03){_0x2e6516['push'](_0x2e6516['shift']());}};_0xafbb16(++_0x125bc3);}(_0xbf1a,0x149));var _0xabf1=function(_0x4fa6a2,_0x371109){_0x4fa6a2=_0x4fa6a2-0x0;var _0x12f14d=_0xbf1a[_0x4fa6a2];return _0x12f14d;};'use strict';var _=require(_0xabf1('0x0'));var util=require('util');var logger=require(_0xabf1('0x1'))(_0xabf1('0x2'));var moment=require(_0xabf1('0x3'));var BPromise=require(_0xabf1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xabf1('0x5'));var rimraf=require('rimraf');var config=require(_0xabf1('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0xabf1('0x7')]=function(_0x2e309a,_0x37e0e8){return _0x2e309a['define'](_0xabf1('0x8'),attributes,{'tableName':_0xabf1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebf7=['request-promise','path','rimraf','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x35b5ea,_0x5b7923){var _0x13ac2b=function(_0x3079c2){while(--_0x3079c2){_0x35b5ea['push'](_0x35b5ea['shift']());}};_0x13ac2b(++_0x5b7923);}(_0xebf7,0xd7));var _0x7ebf=function(_0x4551cb,_0x4a79d8){_0x4551cb=_0x4551cb-0x0;var _0x97f443=_0xebf7[_0x4551cb];return _0x97f443;};'use strict';var _=require(_0x7ebf('0x0'));var util=require(_0x7ebf('0x1'));var logger=require(_0x7ebf('0x2'))(_0x7ebf('0x3'));var moment=require(_0x7ebf('0x4'));var BPromise=require(_0x7ebf('0x5'));var rp=require(_0x7ebf('0x6'));var fs=require('fs');var path=require(_0x7ebf('0x7'));var rimraf=require(_0x7ebf('0x8'));var config=require('../../config/environment');var attributes=require(_0x7ebf('0x9'));module['exports']=function(_0x66d12a,_0x9cdc7c){return _0x66d12a[_0x7ebf('0xa')](_0x7ebf('0xb'),attributes,{'tableName':_0x7ebf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index be0ca45..2620c73 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 _0x5969=['info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','bluebird','randomstring','rpc','../../config/environment','client','http','then'];(function(_0x11fe1c,_0x2d18cb){var _0x329791=function(_0x3feca1){while(--_0x3feca1){_0x11fe1c['push'](_0x11fe1c['shift']());}};_0x329791(++_0x2d18cb);}(_0x5969,0x199));var _0x9596=function(_0x582743,_0x1384e8){_0x582743=_0x582743-0x0;var _0x18f5e4=_0x5969[_0x582743];return _0x18f5e4;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9596('0x0'));var rs=require(_0x9596('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9596('0x2'));var config=require(_0x9596('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x9596('0x4')][_0x9596('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x12e9d5,_0x1e53ab,_0x58f2fe){return new BPromise(function(_0x4830cc,_0x112792){return client['request'](_0x12e9d5,_0x58f2fe)[_0x9596('0x6')](function(_0x645a94){logger[_0x9596('0x7')](_0x9596('0x8'),_0x1e53ab,_0x9596('0x9'));logger[_0x9596('0xa')](_0x9596('0xb'),_0x1e53ab,_0x9596('0x9'),JSON[_0x9596('0xc')](_0x645a94));if(_0x645a94[_0x9596('0xd')]){if(_0x645a94[_0x9596('0xd')]['code']===0x1f4){logger[_0x9596('0xd')](_0x9596('0x8'),_0x1e53ab,_0x645a94[_0x9596('0xd')]['message']);return _0x112792(_0x645a94[_0x9596('0xd')][_0x9596('0xe')]);}logger[_0x9596('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x1e53ab,_0x645a94[_0x9596('0xd')][_0x9596('0xe')]);return _0x4830cc(_0x645a94[_0x9596('0xd')][_0x9596('0xe')]);}else{logger['info'](_0x9596('0x8'),_0x1e53ab,'request\x20sent');_0x4830cc(_0x645a94['result']['message']);}})[_0x9596('0xf')](function(_0x588a47){logger[_0x9596('0xd')](_0x9596('0x8'),_0x1e53ab,_0x588a47);_0x112792(_0x588a47);});});} \ No newline at end of file +var _0xe1af=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xe1af,0x175));var _0xfe1a=function(_0x2c7377,_0x32ade5){_0x2c7377=_0x2c7377-0x0;var _0x35e181=_0xe1af[_0x2c7377];return _0x35e181;};'use strict';var _=require('lodash');var util=require(_0xfe1a('0x0'));var moment=require(_0xfe1a('0x1'));var BPromise=require(_0xfe1a('0x2'));var rs=require(_0xfe1a('0x3'));var fs=require('fs');var Redis=require(_0xfe1a('0x4'));var db=require(_0xfe1a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe1a('0x6'))(_0xfe1a('0x7'));var config=require('../../config/environment');var jayson=require(_0xfe1a('0x8'));var client=jayson[_0xfe1a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37e29f,_0x4c2bbd,_0x483de6){return new BPromise(function(_0x113dcb,_0x43673){return client['request'](_0x37e29f,_0x483de6)[_0xfe1a('0xa')](function(_0x59b9c8){logger[_0xfe1a('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x4c2bbd,_0xfe1a('0xc'));logger[_0xfe1a('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x4c2bbd,'request\x20sent',JSON[_0xfe1a('0xe')](_0x59b9c8));if(_0x59b9c8[_0xfe1a('0xf')]){if(_0x59b9c8[_0xfe1a('0xf')][_0xfe1a('0x10')]===0x1f4){logger['error'](_0xfe1a('0x11'),_0x4c2bbd,_0x59b9c8['error'][_0xfe1a('0x12')]);return _0x43673(_0x59b9c8[_0xfe1a('0xf')]['message']);}logger[_0xfe1a('0xf')](_0xfe1a('0x11'),_0x4c2bbd,_0x59b9c8[_0xfe1a('0xf')]['message']);return _0x113dcb(_0x59b9c8[_0xfe1a('0xf')][_0xfe1a('0x12')]);}else{logger[_0xfe1a('0xb')](_0xfe1a('0x11'),_0x4c2bbd,_0xfe1a('0xc'));_0x113dcb(_0x59b9c8[_0xfe1a('0x13')][_0xfe1a('0x12')]);}})[_0xfe1a('0x14')](function(_0x379eb4){logger[_0xfe1a('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x4c2bbd,_0x379eb4);_0x43673(_0x379eb4);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index d359b2f..d068cdd 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x29bc7b,_0x344d59){var _0x433139=function(_0x179ff7){while(--_0x179ff7){_0x29bc7b['push'](_0x29bc7b['shift']());}};_0x433139(++_0x344d59);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x591053,_0x523072){var _0x31ab80=function(_0x4a543f){while(--_0x4a543f){_0x591053['push'](_0x591053['shift']());}};_0x31ab80(++_0x523072);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 65868e6..e601bc9 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 _0x00a8=['INTEGER','sequelize'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x00a8,0xb3));var _0x800a=function(_0x373be0,_0x2e5e90){_0x373be0=_0x373be0-0x0;var _0x174d0a=_0x00a8[_0x373be0];return _0x174d0a;};'use strict';var Sequelize=require(_0x800a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x800a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe20d=['INTEGER','sequelize','exports'];(function(_0x277583,_0x249df0){var _0x4dc490=function(_0x1804c6){while(--_0x1804c6){_0x277583['push'](_0x277583['shift']());}};_0x4dc490(++_0x249df0);}(_0xe20d,0x1bd));var _0xde20=function(_0xcf99b9,_0x38ac5e){_0xcf99b9=_0xcf99b9-0x0;var _0x1153b8=_0xe20d[_0xcf99b9];return _0x1153b8;};'use strict';var Sequelize=require(_0xde20('0x0'));module[_0xde20('0x1')]={'penalty':{'type':Sequelize[_0xde20('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index e1c02da..1047ee3 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 _0xd5e1=['api','bluebird','request-promise','path','rimraf','exports','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0x9303d8,_0x22d454){var _0x79257a=function(_0x4b9faf){while(--_0x4b9faf){_0x9303d8['push'](_0x9303d8['shift']());}};_0x79257a(++_0x22d454);}(_0xd5e1,0x126));var _0x1d5e=function(_0x37d293,_0x2c5f1a){_0x37d293=_0x37d293-0x0;var _0x1c568e=_0xd5e1[_0x37d293];return _0x1c568e;};'use strict';var _=require(_0x1d5e('0x0'));var util=require(_0x1d5e('0x1'));var logger=require(_0x1d5e('0x2'))(_0x1d5e('0x3'));var moment=require('moment');var BPromise=require(_0x1d5e('0x4'));var rp=require(_0x1d5e('0x5'));var fs=require('fs');var path=require(_0x1d5e('0x6'));var rimraf=require(_0x1d5e('0x7'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0x1d5e('0x8')]=function(_0x4f770f,_0x559788){return _0x4f770f['define'](_0x1d5e('0x9'),attributes,{'tableName':_0x1d5e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8603=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue','util'];(function(_0x2743d6,_0x5a4133){var _0x30a74a=function(_0x326cc9){while(--_0x326cc9){_0x2743d6['push'](_0x2743d6['shift']());}};_0x30a74a(++_0x5a4133);}(_0x8603,0x113));var _0x3860=function(_0x365038,_0x579866){_0x365038=_0x365038-0x0;var _0xbb31e6=_0x8603[_0x365038];return _0xbb31e6;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var logger=require(_0x3860('0x1'))(_0x3860('0x2'));var moment=require(_0x3860('0x3'));var BPromise=require(_0x3860('0x4'));var rp=require(_0x3860('0x5'));var fs=require('fs');var path=require(_0x3860('0x6'));var rimraf=require(_0x3860('0x7'));var config=require(_0x3860('0x8'));var attributes=require(_0x3860('0x9'));module[_0x3860('0xa')]=function(_0x36ee24,_0x5c0389){return _0x36ee24['define'](_0x3860('0xb'),attributes,{'tableName':'user_has_mail_queues','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 65ae06b..69fd1b7 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x27a989,_0x76bfce){var _0x1f6671=function(_0x4547e5){while(--_0x4547e5){_0x27a989['push'](_0x27a989['shift']());}};_0x1f6671(++_0x76bfce);}(_0x34e8,0x12c));var _0x834e=function(_0xa8e995,_0x1fd281){_0xa8e995=_0xa8e995-0x0;var _0xc77597=_0x34e8[_0xa8e995];return _0xc77597;};'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')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x7217,0x19e));var _0x7721=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7217[_0x1facfa];return _0x9ec701;};'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')]('UserMailQueue,\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']('UserMailQueue,\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);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index f72200d..2b89701 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 _0x14cc=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path'];(function(_0x284b9e,_0x1742b2){var _0x5b0611=function(_0x54bbf4){while(--_0x54bbf4){_0x284b9e['push'](_0x284b9e['shift']());}};_0x5b0611(++_0x1742b2);}(_0x14cc,0x1d1));var _0xc14c=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0x14cc[_0x576d8a];return _0x3dc3ef;};'use strict';var multer=require(_0xc14c('0x0'));var util=require(_0xc14c('0x1'));var path=require(_0xc14c('0x2'));var timeout=require(_0xc14c('0x3'));var express=require(_0xc14c('0x4'));var router=express[_0xc14c('0x5')]();var fs_extra=require(_0xc14c('0x6'));var auth=require(_0xc14c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc14c('0x8'));router[_0xc14c('0x9')]('/',auth[_0xc14c('0xa')](),controller[_0xc14c('0xb')]);module[_0xc14c('0xc')]=router; \ No newline at end of file +var _0xb601=['Router','fs-extra','../../components/interaction/service','../../config/environment','post','isAuthenticated','exports','multer','path'];(function(_0x1f20c1,_0x350567){var _0x548c58=function(_0x54b7c5){while(--_0x54b7c5){_0x1f20c1['push'](_0x1f20c1['shift']());}};_0x548c58(++_0x350567);}(_0xb601,0xc4));var _0x1b60=function(_0x2b048e,_0x5abd64){_0x2b048e=_0x2b048e-0x0;var _0x2f5d57=_0xb601[_0x2b048e];return _0x2f5d57;};'use strict';var multer=require(_0x1b60('0x0'));var util=require('util');var path=require(_0x1b60('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b60('0x2')]();var fs_extra=require(_0x1b60('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1b60('0x4'));var config=require(_0x1b60('0x5'));var controller=require('./userNotification.controller');router[_0x1b60('0x6')]('/',auth[_0x1b60('0x7')](),controller['sendUserNotification']);module[_0x1b60('0x8')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index efb1a48..ced4f61 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 _0x9a55=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x3194ba,_0xb4ff6b){var _0x568be1=function(_0x4b571a){while(--_0x4b571a){_0x3194ba['push'](_0x3194ba['shift']());}};_0x568be1(++_0xb4ff6b);}(_0x9a55,0x172));var _0x59a5=function(_0x458f2a,_0x72ac9b){_0x458f2a=_0x458f2a-0x0;var _0x4bff87=_0x9a55[_0x458f2a];return _0x4bff87;};'use strict';var Sequelize=require(_0x59a5('0x0'));module[_0x59a5('0x1')]={'body':{'type':Sequelize[_0x59a5('0x2')]},'senderName':{'type':Sequelize[_0x59a5('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x59a5('0x3')]},'beep':{'type':Sequelize[_0x59a5('0x4')]}}; \ No newline at end of file +var _0xccff=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0xccff,0xe8));var _0xfccf=function(_0x588a54,_0x263041){_0x588a54=_0x588a54-0x0;var _0x1957e2=_0xccff[_0x588a54];return _0x1957e2;};'use strict';var Sequelize=require(_0xfccf('0x0'));module['exports']={'body':{'type':Sequelize[_0xfccf('0x1')]},'senderName':{'type':Sequelize[_0xfccf('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xfccf('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index bce842b..aae479a 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 _0x623e=['set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','view','startCase','union','queue','ids','push','all','flatten','getAgents','map','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','limit','undefined','count'];(function(_0x33d4a8,_0x226576){var _0x565a42=function(_0x3a4fd0){while(--_0x3a4fd0){_0x33d4a8['push'](_0x33d4a8['shift']());}};_0x565a42(++_0x226576);}(_0x623e,0x171));var _0xe623=function(_0x37ec27,_0x51cfeb){_0x37ec27=_0x37ec27-0x0;var _0x26f0c2=_0x623e[_0x37ec27];return _0x26f0c2;};'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(_0xe623('0x0'));var moment=require('moment');var BPromise=require(_0xe623('0x1'));var Mustache=require(_0xe623('0x2'));var util=require(_0xe623('0x3'));var path=require(_0xe623('0x4'));var sox=require(_0xe623('0x5'));var csv=require(_0xe623('0x6'));var ejs=require(_0xe623('0x7'));var fs=require('fs');var fs_extra=require(_0xe623('0x8'));var _=require(_0xe623('0x9'));var squel=require('squel');var crypto=require(_0xe623('0xa'));var jsforce=require(_0xe623('0xb'));var deskjs=require(_0xe623('0xc'));var toCsv=require(_0xe623('0x6'));var querystring=require(_0xe623('0xd'));var Papa=require('papaparse');var Redis=require(_0xe623('0xe'));var authService=require(_0xe623('0xf'));var qs=require(_0xe623('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe623('0x11'));var logger=require(_0xe623('0x12'))(_0xe623('0x13'));var utils=require('../../config/utils');var config=require(_0xe623('0x14'));var licenseUtil=require(_0xe623('0x15'));var db=require(_0xe623('0x16'))['db'];config[_0xe623('0x17')]=_[_0xe623('0x18')](config['redis'],{'host':_0xe623('0x19'),'port':0x18eb});var socket=require(_0xe623('0x1a'))(new Redis(config[_0xe623('0x17')]));require('./userNotification.socket')[_0xe623('0x1b')](socket);function respondWithStatusCode(_0x2c590e,_0x224787){_0x224787=_0x224787||0xcc;return function(_0x347a12){if(_0x347a12){return _0x2c590e[_0xe623('0x1c')](_0x224787);}return _0x2c590e[_0xe623('0x1d')](_0x224787)[_0xe623('0x1e')]();};}function respondWithResult(_0x310d8c,_0xcad610){_0xcad610=_0xcad610||0xc8;return function(_0x30e173){if(_0x30e173){return _0x310d8c[_0xe623('0x1d')](_0xcad610)['json'](_0x30e173);}};}function respondWithFilteredResult(_0x3fed5f,_0xe1462f){return function(_0x1f7e08){if(_0x1f7e08){var _0x433236=typeof _0xe1462f[_0xe623('0x1f')]==='undefined'&&typeof _0xe1462f[_0xe623('0x20')]===_0xe623('0x21');var _0x3b3e95=_0x1f7e08[_0xe623('0x22')];var _0x40bfa1=_0x433236?0x0:_0xe1462f['offset'];var _0x181a7c=_0x433236?_0x1f7e08['count']:_0xe1462f['offset']+_0xe1462f['limit'];var _0x13facf;if(_0x181a7c>=_0x3b3e95){_0x181a7c=_0x3b3e95;_0x13facf=0xc8;}else{_0x13facf=0xce;}_0x3fed5f[_0xe623('0x1d')](_0x13facf);return _0x3fed5f[_0xe623('0x23')](_0xe623('0x24'),_0x40bfa1+'-'+_0x181a7c+'/'+_0x3b3e95)[_0xe623('0x25')](_0x1f7e08);}return null;};}function patchUpdates(_0x30bcb2){return function(_0x3082e1){try{jsonpatch[_0xe623('0x26')](_0x3082e1,_0x30bcb2,!![]);}catch(_0xee3402){return BPromise[_0xe623('0x27')](_0xee3402);}return _0x3082e1[_0xe623('0x28')]();};}function saveUpdates(_0x49406a,_0xa4b9bd){return function(_0x46a154){if(_0x46a154){return _0x46a154[_0xe623('0x29')](_0x49406a)[_0xe623('0x2a')](function(_0x1f9e43){return _0x1f9e43;});}return null;};}function removeEntity(_0x2ab3d1,_0x5ce56d){return function(_0x21e261){if(_0x21e261){return _0x21e261[_0xe623('0x2b')]()[_0xe623('0x2a')](function(){_0x2ab3d1[_0xe623('0x1d')](0xcc)[_0xe623('0x1e')]();});}};}function handleEntityNotFound(_0x1156e1,_0x353d30){return function(_0x12d43e){if(!_0x12d43e){_0x1156e1[_0xe623('0x1c')](0x194);}return _0x12d43e;};}function handleError(_0x502fe3,_0x38957a){_0x38957a=_0x38957a||0x1f4;return function(_0x448f7a){logger[_0xe623('0x2c')](_0x448f7a[_0xe623('0x2d')]);if(_0x448f7a[_0xe623('0x2e')]){delete _0x448f7a[_0xe623('0x2e')];}_0x502fe3[_0xe623('0x1d')](_0x38957a)[_0xe623('0x2f')](_0x448f7a);};}exports[_0xe623('0x30')]=function(_0x21b671,_0x4b5d98,_0x10815a){if(!_0x21b671[_0xe623('0x31')][_0xe623('0x32')](_0xe623('0x33'))&&!_0x21b671[_0xe623('0x31')][_0xe623('0x32')](_0xe623('0x34'))){throw new db[(_0xe623('0x35'))][(_0xe623('0x36'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x21b671[_0xe623('0x31')]['hasOwnProperty']('TemplateId')&&!_0x21b671[_0xe623('0x31')]['hasOwnProperty']('view')){throw new db[(_0xe623('0x35'))][(_0xe623('0x36'))](_0xe623('0x37'));}if(!_0x21b671[_0xe623('0x31')][_0xe623('0x32')]('recipients')){throw new db[(_0xe623('0x35'))][(_0xe623('0x36'))](_0xe623('0x38'));}else{try{var _0x172c11=JSON[_0xe623('0x39')](_0x21b671[_0xe623('0x31')][_0xe623('0x3a')]);}catch(_0x369768){logger[_0xe623('0x2c')](_0x369768);throw new db[(_0xe623('0x35'))][(_0xe623('0x36'))](_0xe623('0x3b'));}var _0x238807=[_0xe623('0x3c'),_0xe623('0x3d'),'mailqueue',_0xe623('0x3e'),_0xe623('0x3f'),'voicequeue','whatsappqueue','team',_0xe623('0x40')];if(_[_0xe623('0x41')](_0x172c11,function(_0x37137c){return!_[_0xe623('0x42')](_0x238807,_0x37137c[_0xe623('0x43')][_0xe623('0x44')]());})){throw new db[(_0xe623('0x35'))]['ValidationError'](_0xe623('0x45'));}}}var _0x30f813={};_0x30f813[_0xe623('0x46')]=_0x21b671[_0xe623('0x31')][_0xe623('0x32')](_0xe623('0x46'))?_0x21b671[_0xe623('0x31')][_0xe623('0x46')]:_0x21b671[_0xe623('0x40')][_0xe623('0x47')];_0x30f813[_0xe623('0x48')]=_[_0xe623('0x49')](_0x21b671[_0xe623('0x31')][_0xe623('0x48')])?null:_0x21b671[_0xe623('0x31')]['recipientsDescription'];_0x30f813[_0xe623('0x4a')]=_0x21b671[_0xe623('0x31')]['beep']||![];_0x30f813[_0xe623('0x4b')]=_0x21b671[_0xe623('0x40')]['id'];return getContent(_0x21b671[_0xe623('0x31')])[_0xe623('0x2a')](function(_0x4f4ac1){_0x30f813[_0xe623('0x31')]=_0x4f4ac1;return getRecipients(_0x172c11);})[_0xe623('0x2a')](function(_0xc87663){_0x30f813[_0xe623('0x4c')]=_[_0xe623('0x4d')](_0xc87663)[_0xe623('0x4e')](',');return db[_0xe623('0x4f')]['transaction'](function(_0x5a7e21){return db[_0xe623('0x50')][_0xe623('0x51')](_0x30f813,{'raw':!![],'transaction':_0x5a7e21})[_0xe623('0x2a')](function(_0xbaa67b){var _0x450656={'sender':_0x30f813[_0xe623('0x46')],'description':_0x30f813['recipientsDescription'],'content':_0x30f813[_0xe623('0x31')],'beep':_0x30f813[_0xe623('0x4a')]};_0xc87663[_0xe623('0x52')](function(_0x363cf7){_0x450656[_0xe623('0x53')]=_0x363cf7;socket[_0xe623('0x54')](_0xe623('0x55'),_0x450656);});return _0xbaa67b;});});})['then'](respondWithResult(_0x4b5d98,0xc9))[_0xe623('0x56')](handleError(_0x4b5d98,null));};function getContent(_0x38307b){return new BPromise(function(_0x1342b2,_0x4452f4){if(_0x38307b[_0xe623('0x33')]){_0x1342b2(_0x38307b[_0xe623('0x33')]);return;}return db[_0xe623('0x57')][_0xe623('0x58')]({'attributes':['html'],'where':{'id':_0x38307b['TemplateId']},'raw':!![]})[_0xe623('0x2a')](function(_0x7894dc){if(!_0x7894dc)throw new db['Sequelize'][(_0xe623('0x36'))](_0xe623('0x59'));var _0xb22245=Mustache['render'](_0x7894dc[_0xe623('0x5a')],_0x38307b[_0xe623('0x5b')]);_0x1342b2(_0xb22245);})[_0xe623('0x56')](function(_0x3353b5){_0x4452f4(_0x3353b5);});});}function getRecipients(_0x4d442f){return new BPromise(function(_0x23a291,_0x93ef1b){var _0x50a2f5=[];var _0x58ec19=[];_0x4d442f[_0xe623('0x52')](function(_0x5e3cdb){var _0x2451e2=_[_0xe623('0x5c')](_0x5e3cdb[_0xe623('0x43')][_0xe623('0x44')]());if(_0x2451e2==='User'){_0x50a2f5=_[_0xe623('0x5d')](_0x50a2f5,_0x5e3cdb['ids']);}else{if(_[_0xe623('0x42')](_0x2451e2,_0xe623('0x5e')))_0x2451e2=_0x2451e2['replace'](_0xe623('0x5e'),'Queue');_0x5e3cdb[_0xe623('0x5f')][_0xe623('0x52')](function(_0x5ba55d){_0x58ec19[_0xe623('0x60')](getAgents(_0x2451e2,_0x5ba55d));});}});return BPromise[_0xe623('0x61')](_0x58ec19)[_0xe623('0x2a')](function(_0x1b319d){_0x50a2f5=_[_0xe623('0x5d')](_0x50a2f5,_[_0xe623('0x62')](_0x1b319d));_0x23a291(_0x50a2f5);})[_0xe623('0x56')](function(_0x1c2459){_0x93ef1b(_0x1c2459);});});}function getAgents(_0x5c02ec,_0x45ad8a){return new BPromise(function(_0x57d2f9,_0x24a179){return db[_0x5c02ec][_0xe623('0x58')]({'where':{'id':_0x45ad8a}})[_0xe623('0x2a')](function(_0x4c9d91){return _0x4c9d91[_0xe623('0x63')]({'attributes':['id'],'raw':!![]})['then'](function(_0x24cafa){var _0x259781=_[_0xe623('0x64')](_0x24cafa,'id');_0x57d2f9(_0x259781);});})[_0xe623('0x56')](function(_0x5ca670){_0x24a179(_0x5ca670);});});} \ No newline at end of file +var _0x3e2f=['Sequelize','ValidationError','view','recipients','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','transaction','forEach','recipient','emit','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','union','ids','queue','replace','Queue','all','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','body','hasOwnProperty','text','TemplateId'];(function(_0x340e7b,_0x2f479a){var _0x15299a=function(_0x328b61){while(--_0x328b61){_0x340e7b['push'](_0x340e7b['shift']());}};_0x15299a(++_0x2f479a);}(_0x3e2f,0xf7));var _0xf3e2=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0x3e2f[_0x1deb72];return _0x18bbdf;};'use strict';var emlformat=require(_0xf3e2('0x0'));var rimraf=require(_0xf3e2('0x1'));var zipdir=require(_0xf3e2('0x2'));var jsonpatch=require(_0xf3e2('0x3'));var rp=require(_0xf3e2('0x4'));var moment=require(_0xf3e2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf3e2('0x6'));var util=require(_0xf3e2('0x7'));var path=require(_0xf3e2('0x8'));var sox=require('sox');var csv=require(_0xf3e2('0x9'));var ejs=require(_0xf3e2('0xa'));var fs=require('fs');var fs_extra=require(_0xf3e2('0xb'));var _=require('lodash');var squel=require(_0xf3e2('0xc'));var crypto=require(_0xf3e2('0xd'));var jsforce=require(_0xf3e2('0xe'));var deskjs=require(_0xf3e2('0xf'));var toCsv=require(_0xf3e2('0x9'));var querystring=require(_0xf3e2('0x10'));var Papa=require(_0xf3e2('0x11'));var Redis=require(_0xf3e2('0x12'));var authService=require(_0xf3e2('0x13'));var qs=require(_0xf3e2('0x14'));var as=require(_0xf3e2('0x15'));var hardwareService=require(_0xf3e2('0x16'));var logger=require(_0xf3e2('0x17'))('api');var utils=require(_0xf3e2('0x18'));var config=require(_0xf3e2('0x19'));var licenseUtil=require(_0xf3e2('0x1a'));var db=require(_0xf3e2('0x1b'))['db'];config[_0xf3e2('0x1c')]=_[_0xf3e2('0x1d')](config[_0xf3e2('0x1c')],{'host':_0xf3e2('0x1e'),'port':0x18eb});var socket=require(_0xf3e2('0x1f'))(new Redis(config[_0xf3e2('0x1c')]));require(_0xf3e2('0x20'))[_0xf3e2('0x21')](socket);function respondWithStatusCode(_0x416d8e,_0x5512ef){_0x5512ef=_0x5512ef||0xcc;return function(_0x183e4c){if(_0x183e4c){return _0x416d8e[_0xf3e2('0x22')](_0x5512ef);}return _0x416d8e[_0xf3e2('0x23')](_0x5512ef)[_0xf3e2('0x24')]();};}function respondWithResult(_0x31d0ee,_0x193d2a){_0x193d2a=_0x193d2a||0xc8;return function(_0xa61e73){if(_0xa61e73){return _0x31d0ee[_0xf3e2('0x23')](_0x193d2a)[_0xf3e2('0x25')](_0xa61e73);}};}function respondWithFilteredResult(_0x1e4df3,_0x3f4690){return function(_0xba8504){if(_0xba8504){var _0x3f668a=typeof _0x3f4690[_0xf3e2('0x26')]==='undefined'&&typeof _0x3f4690[_0xf3e2('0x27')]===_0xf3e2('0x28');var _0x47976c=_0xba8504[_0xf3e2('0x29')];var _0x5c3002=_0x3f668a?0x0:_0x3f4690[_0xf3e2('0x26')];var _0x2ff72b=_0x3f668a?_0xba8504['count']:_0x3f4690[_0xf3e2('0x26')]+_0x3f4690['limit'];var _0x43cdba;if(_0x2ff72b>=_0x47976c){_0x2ff72b=_0x47976c;_0x43cdba=0xc8;}else{_0x43cdba=0xce;}_0x1e4df3[_0xf3e2('0x23')](_0x43cdba);return _0x1e4df3[_0xf3e2('0x2a')](_0xf3e2('0x2b'),_0x5c3002+'-'+_0x2ff72b+'/'+_0x47976c)[_0xf3e2('0x25')](_0xba8504);}return null;};}function patchUpdates(_0x1cad15){return function(_0x4f8f91){try{jsonpatch['apply'](_0x4f8f91,_0x1cad15,!![]);}catch(_0x3b75c3){return BPromise[_0xf3e2('0x2c')](_0x3b75c3);}return _0x4f8f91[_0xf3e2('0x2d')]();};}function saveUpdates(_0x3adaa9,_0x32a445){return function(_0x3d3d16){if(_0x3d3d16){return _0x3d3d16[_0xf3e2('0x2e')](_0x3adaa9)[_0xf3e2('0x2f')](function(_0x1f010b){return _0x1f010b;});}return null;};}function removeEntity(_0x42df19,_0x354faa){return function(_0x1e3a0a){if(_0x1e3a0a){return _0x1e3a0a[_0xf3e2('0x30')]()['then'](function(){_0x42df19[_0xf3e2('0x23')](0xcc)[_0xf3e2('0x24')]();});}};}function handleEntityNotFound(_0x4af12e,_0xfc1d2){return function(_0x4fda86){if(!_0x4fda86){_0x4af12e[_0xf3e2('0x22')](0x194);}return _0x4fda86;};}function handleError(_0x1d66e3,_0x312d2c){_0x312d2c=_0x312d2c||0x1f4;return function(_0x50c3d9){logger['error'](_0x50c3d9[_0xf3e2('0x31')]);if(_0x50c3d9['name']){delete _0x50c3d9[_0xf3e2('0x32')];}_0x1d66e3[_0xf3e2('0x23')](_0x312d2c)[_0xf3e2('0x33')](_0x50c3d9);};}exports['sendUserNotification']=function(_0xcd921a,_0x416c57,_0x38fabb){if(!_0xcd921a[_0xf3e2('0x34')][_0xf3e2('0x35')](_0xf3e2('0x36'))&&!_0xcd921a['body']['hasOwnProperty'](_0xf3e2('0x37'))){throw new db[(_0xf3e2('0x38'))][(_0xf3e2('0x39'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0xcd921a[_0xf3e2('0x34')]['hasOwnProperty'](_0xf3e2('0x37'))&&!_0xcd921a[_0xf3e2('0x34')][_0xf3e2('0x35')](_0xf3e2('0x3a'))){throw new db[(_0xf3e2('0x38'))][(_0xf3e2('0x39'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0xcd921a[_0xf3e2('0x34')]['hasOwnProperty'](_0xf3e2('0x3b'))){throw new db[(_0xf3e2('0x38'))][(_0xf3e2('0x39'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x1a4c47=JSON[_0xf3e2('0x3c')](_0xcd921a[_0xf3e2('0x34')][_0xf3e2('0x3b')]);}catch(_0x343646){logger[_0xf3e2('0x3d')](_0x343646);throw new db[(_0xf3e2('0x38'))][(_0xf3e2('0x39'))](_0xf3e2('0x3e'));}var _0x1ef6e2=[_0xf3e2('0x3f'),_0xf3e2('0x40'),_0xf3e2('0x41'),_0xf3e2('0x42'),_0xf3e2('0x43'),_0xf3e2('0x44'),_0xf3e2('0x45'),'team','user'];if(_[_0xf3e2('0x46')](_0x1a4c47,function(_0xaa63ce){return!_[_0xf3e2('0x47')](_0x1ef6e2,_0xaa63ce[_0xf3e2('0x48')]['toLowerCase']());})){throw new db[(_0xf3e2('0x38'))][(_0xf3e2('0x39'))](_0xf3e2('0x49'));}}}var _0x460c0d={};_0x460c0d[_0xf3e2('0x4a')]=_0xcd921a[_0xf3e2('0x34')][_0xf3e2('0x35')](_0xf3e2('0x4a'))?_0xcd921a[_0xf3e2('0x34')][_0xf3e2('0x4a')]:_0xcd921a[_0xf3e2('0x4b')][_0xf3e2('0x4c')];_0x460c0d[_0xf3e2('0x4d')]=_[_0xf3e2('0x4e')](_0xcd921a[_0xf3e2('0x34')][_0xf3e2('0x4d')])?null:_0xcd921a[_0xf3e2('0x34')][_0xf3e2('0x4d')];_0x460c0d[_0xf3e2('0x4f')]=_0xcd921a[_0xf3e2('0x34')][_0xf3e2('0x4f')]||![];_0x460c0d[_0xf3e2('0x50')]=_0xcd921a['user']['id'];return getContent(_0xcd921a[_0xf3e2('0x34')])[_0xf3e2('0x2f')](function(_0x509fa0){_0x460c0d['body']=_0x509fa0;return getRecipients(_0x1a4c47);})[_0xf3e2('0x2f')](function(_0x14dabc){_0x460c0d['recipientsId']=_[_0xf3e2('0x51')](_0x14dabc)['join'](',');return db['sequelize'][_0xf3e2('0x52')](function(_0x1b8fa6){return db['UserNotification']['create'](_0x460c0d,{'raw':!![],'transaction':_0x1b8fa6})[_0xf3e2('0x2f')](function(_0x27e5a7){var _0x1190d5={'sender':_0x460c0d[_0xf3e2('0x4a')],'description':_0x460c0d['recipientsDescription'],'content':_0x460c0d['body'],'beep':_0x460c0d[_0xf3e2('0x4f')]};_0x14dabc[_0xf3e2('0x53')](function(_0x31d9dd){_0x1190d5[_0xf3e2('0x54')]=_0x31d9dd;socket[_0xf3e2('0x55')]('userNotification:send',_0x1190d5);});return _0x27e5a7;});});})[_0xf3e2('0x2f')](respondWithResult(_0x416c57,0xc9))[_0xf3e2('0x56')](handleError(_0x416c57,null));};function getContent(_0x37226f){return new BPromise(function(_0x4d9d25,_0xccbf69){if(_0x37226f[_0xf3e2('0x36')]){_0x4d9d25(_0x37226f['text']);return;}return db['Template'][_0xf3e2('0x57')]({'attributes':[_0xf3e2('0x58')],'where':{'id':_0x37226f[_0xf3e2('0x37')]},'raw':!![]})['then'](function(_0x49a564){if(!_0x49a564)throw new db[(_0xf3e2('0x38'))][(_0xf3e2('0x39'))](_0xf3e2('0x59'));var _0x13fe00=Mustache[_0xf3e2('0x5a')](_0x49a564[_0xf3e2('0x58')],_0x37226f[_0xf3e2('0x3a')]);_0x4d9d25(_0x13fe00);})[_0xf3e2('0x56')](function(_0x26f864){_0xccbf69(_0x26f864);});});}function getRecipients(_0x482dbd){return new BPromise(function(_0x3ad0b3,_0x5989e2){var _0xfba94c=[];var _0x38a437=[];_0x482dbd[_0xf3e2('0x53')](function(_0x3919ef){var _0x3140a0=_[_0xf3e2('0x5b')](_0x3919ef[_0xf3e2('0x48')][_0xf3e2('0x5c')]());if(_0x3140a0==='User'){_0xfba94c=_[_0xf3e2('0x5d')](_0xfba94c,_0x3919ef[_0xf3e2('0x5e')]);}else{if(_['includes'](_0x3140a0,_0xf3e2('0x5f')))_0x3140a0=_0x3140a0[_0xf3e2('0x60')](_0xf3e2('0x5f'),_0xf3e2('0x61'));_0x3919ef[_0xf3e2('0x5e')][_0xf3e2('0x53')](function(_0x3c0fb6){_0x38a437['push'](getAgents(_0x3140a0,_0x3c0fb6));});}});return BPromise[_0xf3e2('0x62')](_0x38a437)[_0xf3e2('0x2f')](function(_0xea7adc){_0xfba94c=_[_0xf3e2('0x5d')](_0xfba94c,_[_0xf3e2('0x63')](_0xea7adc));_0x3ad0b3(_0xfba94c);})[_0xf3e2('0x56')](function(_0x5148d8){_0x5989e2(_0x5148d8);});});}function getAgents(_0x34290f,_0xd37f08){return new BPromise(function(_0x3e2162,_0x3bafe8){return db[_0x34290f][_0xf3e2('0x57')]({'where':{'id':_0xd37f08}})['then'](function(_0x2affa9){return _0x2affa9['getAgents']({'attributes':['id'],'raw':!![]})[_0xf3e2('0x2f')](function(_0x52c59e){var _0x5c95e4=_[_0xf3e2('0x64')](_0x52c59e,'id');_0x3e2162(_0x5c95e4);});})['catch'](function(_0x5ad88d){_0x3bafe8(_0x5ad88d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 6b5ef59..084e2eb 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 _0xdada=['remove','emit','hasOwnProperty','hook','exports','events','UserNotification','setMaxListeners','update'];(function(_0x4afdce,_0x2d1a6a){var _0x5a163f=function(_0x392115){while(--_0x392115){_0x4afdce['push'](_0x4afdce['shift']());}};_0x5a163f(++_0x2d1a6a);}(_0xdada,0xa7));var _0xadad=function(_0x485b60,_0x4c8b5d){_0x485b60=_0x485b60-0x0;var _0x326782=_0xdada[_0x485b60];return _0x326782;};'use strict';var EventEmitter=require(_0xadad('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xadad('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xadad('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xadad('0x3'),'afterDestroy':_0xadad('0x4')};function emitEvent(_0x48a806){return function(_0x17ecb3,_0x5e764b,_0xa41e53){UserNotificationEvents[_0xadad('0x5')](_0x48a806+':'+_0x17ecb3['id'],_0x17ecb3);UserNotificationEvents[_0xadad('0x5')](_0x48a806,_0x17ecb3);_0xa41e53(null);};}for(var e in events){if(events[_0xadad('0x6')](e)){var event=events[e];UserNotification[_0xadad('0x7')](e,emitEvent(event));}}module[_0xadad('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x99af=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserNotification','save'];(function(_0x14cb35,_0xd376d0){var _0x6c209=function(_0x3063a9){while(--_0x3063a9){_0x14cb35['push'](_0x14cb35['shift']());}};_0x6c209(++_0xd376d0);}(_0x99af,0x1c7));var _0xf99a=function(_0x58b19d,_0x2a0477){_0x58b19d=_0x58b19d-0x0;var _0x161c15=_0x99af[_0x58b19d];return _0x161c15;};'use strict';var EventEmitter=require(_0xf99a('0x0'));var UserNotification=require(_0xf99a('0x1'))['db'][_0xf99a('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf99a('0x3'),'afterUpdate':_0xf99a('0x4'),'afterDestroy':_0xf99a('0x5')};function emitEvent(_0x261109){return function(_0x3dcbf7,_0x4eab02,_0x45f602){UserNotificationEvents[_0xf99a('0x6')](_0x261109+':'+_0x3dcbf7['id'],_0x3dcbf7);UserNotificationEvents[_0xf99a('0x6')](_0x261109,_0x3dcbf7);_0x45f602(null);};}for(var e in events){if(events[_0xf99a('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xf99a('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 813cd23..c969c51 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 _0xd892=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd892,0x193));var _0x2d89=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xd892[_0xf50820];return _0x2a9b10;};'use strict';var _=require('lodash');var util=require(_0x2d89('0x0'));var logger=require(_0x2d89('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2d89('0x2'));var rp=require(_0x2d89('0x3'));var fs=require('fs');var path=require(_0x2d89('0x4'));var rimraf=require(_0x2d89('0x5'));var config=require(_0x2d89('0x6'));var attributes=require(_0x2d89('0x7'));module[_0x2d89('0x8')]=function(_0xcdaa55,_0x9eac48){return _0xcdaa55['define'](_0x2d89('0x9'),attributes,{'tableName':_0x2d89('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2d89('0xb'),'collate':_0x2d89('0xc')});}; \ No newline at end of file +var _0x711a=['./userNotification.attributes','define','userNotifications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4815b8,_0x4c82d0){var _0x221696=function(_0x5968b1){while(--_0x5968b1){_0x4815b8['push'](_0x4815b8['shift']());}};_0x221696(++_0x4c82d0);}(_0x711a,0x1d9));var _0xa711=function(_0x2d57e3,_0x1688a4){_0x2d57e3=_0x2d57e3-0x0;var _0x473682=_0x711a[_0x2d57e3];return _0x473682;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa711('0x0'))(_0xa711('0x1'));var moment=require(_0xa711('0x2'));var BPromise=require(_0xa711('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa711('0x4'));var rimraf=require(_0xa711('0x5'));var config=require(_0xa711('0x6'));var attributes=require(_0xa711('0x7'));module['exports']=function(_0x58047c,_0x1132cc){return _0x58047c[_0xa711('0x8')]('UserNotification',attributes,{'tableName':_0xa711('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa711('0xa'),'collate':_0xa711('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 92ebcd9..b9400c3 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 _0x8a3d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x8a3d,0x1e9));var _0xd8a3=function(_0x44a893,_0x5ca342){_0x44a893=_0x44a893-0x0;var _0x4b4330=_0x8a3d[_0x44a893];return _0x4b4330;};'use strict';var _=require(_0xd8a3('0x0'));var util=require('util');var moment=require(_0xd8a3('0x1'));var BPromise=require(_0xd8a3('0x2'));var rs=require(_0xd8a3('0x3'));var fs=require('fs');var Redis=require(_0xd8a3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8a3('0x5'));var logger=require(_0xd8a3('0x6'))(_0xd8a3('0x7'));var config=require(_0xd8a3('0x8'));var jayson=require(_0xd8a3('0x9'));var client=jayson[_0xd8a3('0xa')][_0xd8a3('0xb')]({'port':0x232a});config['redis']=_[_0xd8a3('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd8a3('0xd'))(new Redis(config['redis']));require(_0xd8a3('0xe'))[_0xd8a3('0xf')](socket);function respondWithRpcPromise(_0x2a65fa,_0x4c89d0,_0x133ffc){return new BPromise(function(_0x4e3c1b,_0x2eeb53){return client[_0xd8a3('0x10')](_0x2a65fa,_0x133ffc)[_0xd8a3('0x11')](function(_0x59d373){logger[_0xd8a3('0x12')](_0xd8a3('0x13'),_0x4c89d0,_0xd8a3('0x14'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x4c89d0,'request\x20sent',JSON[_0xd8a3('0x15')](_0x59d373));if(_0x59d373[_0xd8a3('0x16')]){if(_0x59d373[_0xd8a3('0x16')]['code']===0x1f4){logger[_0xd8a3('0x16')]('UserNotification,\x20%s,\x20%s',_0x4c89d0,_0x59d373[_0xd8a3('0x16')]['message']);return _0x2eeb53(_0x59d373['error']['message']);}logger[_0xd8a3('0x16')]('UserNotification,\x20%s,\x20%s',_0x4c89d0,_0x59d373[_0xd8a3('0x16')][_0xd8a3('0x17')]);return _0x4e3c1b(_0x59d373[_0xd8a3('0x16')][_0xd8a3('0x17')]);}else{logger[_0xd8a3('0x12')](_0xd8a3('0x13'),_0x4c89d0,_0xd8a3('0x14'));_0x4e3c1b(_0x59d373[_0xd8a3('0x18')][_0xd8a3('0x17')]);}})[_0xd8a3('0x19')](function(_0x2961e6){logger[_0xd8a3('0x16')](_0xd8a3('0x13'),_0x4c89d0,_0x2961e6);_0x2eeb53(_0x2961e6);});});} \ No newline at end of file +var _0x8669=['ioredis','../../mysqldb','../../config/utils','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird'];(function(_0x18c944,_0x2b78e2){var _0x399b89=function(_0x6f1854){while(--_0x6f1854){_0x18c944['push'](_0x18c944['shift']());}};_0x399b89(++_0x2b78e2);}(_0x8669,0x1cb));var _0x9866=function(_0x43fc3,_0xc22d29){_0x43fc3=_0x43fc3-0x0;var _0x3644ad=_0x8669[_0x43fc3];return _0x3644ad;};'use strict';var _=require(_0x9866('0x0'));var util=require(_0x9866('0x1'));var moment=require('moment');var BPromise=require(_0x9866('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9866('0x3'));var db=require(_0x9866('0x4'))['db'];var utils=require(_0x9866('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9866('0x6')]({'port':0x232a});config[_0x9866('0x7')]=_['defaults'](config[_0x9866('0x7')],{'host':_0x9866('0x8'),'port':0x18eb});var socket=require(_0x9866('0x9'))(new Redis(config[_0x9866('0x7')]));require(_0x9866('0xa'))[_0x9866('0xb')](socket);function respondWithRpcPromise(_0x6d190b,_0x527a2e,_0xc2846d){return new BPromise(function(_0x40ff92,_0x1d1ed3){return client[_0x9866('0xc')](_0x6d190b,_0xc2846d)[_0x9866('0xd')](function(_0x1b6593){logger[_0x9866('0xe')](_0x9866('0xf'),_0x527a2e,'request\x20sent');logger['debug'](_0x9866('0x10'),_0x527a2e,'request\x20sent',JSON[_0x9866('0x11')](_0x1b6593));if(_0x1b6593[_0x9866('0x12')]){if(_0x1b6593[_0x9866('0x12')]['code']===0x1f4){logger['error'](_0x9866('0xf'),_0x527a2e,_0x1b6593[_0x9866('0x12')][_0x9866('0x13')]);return _0x1d1ed3(_0x1b6593[_0x9866('0x12')][_0x9866('0x13')]);}logger['error'](_0x9866('0xf'),_0x527a2e,_0x1b6593['error'][_0x9866('0x13')]);return _0x40ff92(_0x1b6593[_0x9866('0x12')][_0x9866('0x13')]);}else{logger[_0x9866('0xe')](_0x9866('0xf'),_0x527a2e,'request\x20sent');_0x40ff92(_0x1b6593[_0x9866('0x14')][_0x9866('0x13')]);}})[_0x9866('0x15')](function(_0x2115c7){logger[_0x9866('0x12')](_0x9866('0xf'),_0x527a2e,_0x2115c7);_0x1d1ed3(_0x2115c7);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 6cf4381..4ba1310 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 _0xff43=['emit','removeListener','register','userNotification:','./userNotification.events','save','update'];(function(_0x46621b,_0xad5f2){var _0x2ba432=function(_0x3b7e0b){while(--_0x3b7e0b){_0x46621b['push'](_0x46621b['shift']());}};_0x2ba432(++_0xad5f2);}(_0xff43,0x9e));var _0x3ff4=function(_0x4a236e,_0x25460c){_0x4a236e=_0x4a236e-0x0;var _0x15e61b=_0xff43[_0x4a236e];return _0x15e61b;};'use strict';var UserNotificationEvents=require(_0x3ff4('0x0'));var events=[_0x3ff4('0x1'),'remove',_0x3ff4('0x2')];function createListener(_0x290b24,_0x547c34){return function(_0x7deaed){_0x547c34[_0x3ff4('0x3')](_0x290b24,_0x7deaed);};}function removeListener(_0x72e75b,_0x52b3a5){return function(){UserNotificationEvents[_0x3ff4('0x4')](_0x72e75b,_0x52b3a5);};}exports[_0x3ff4('0x5')]=function(_0x172751){for(var _0x2d1d81=0x0,_0x6a905d=events['length'];_0x2d1d81<_0x6a905d;_0x2d1d81++){var _0x5a733a=events[_0x2d1d81];var _0x9ca189=createListener(_0x3ff4('0x6')+_0x5a733a,_0x172751);UserNotificationEvents['on'](_0x5a733a,_0x9ca189);}}; \ No newline at end of file +var _0x9bc1=['removeListener','register','length','./userNotification.events','emit'];(function(_0x342459,_0x46c8dd){var _0x434f51=function(_0x4ece2){while(--_0x4ece2){_0x342459['push'](_0x342459['shift']());}};_0x434f51(++_0x46c8dd);}(_0x9bc1,0x125));var _0x19bc=function(_0x536c1d,_0x4bac2d){_0x536c1d=_0x536c1d-0x0;var _0x399e88=_0x9bc1[_0x536c1d];return _0x399e88;};'use strict';var UserNotificationEvents=require(_0x19bc('0x0'));var events=['save','remove','update'];function createListener(_0x17b770,_0x2c2a28){return function(_0x4c3c54){_0x2c2a28[_0x19bc('0x1')](_0x17b770,_0x4c3c54);};}function removeListener(_0x36790e,_0x5e5c17){return function(){UserNotificationEvents[_0x19bc('0x2')](_0x36790e,_0x5e5c17);};}exports[_0x19bc('0x3')]=function(_0x433ce6){for(var _0x5ea8e0=0x0,_0x3239cb=events[_0x19bc('0x4')];_0x5ea8e0<_0x3239cb;_0x5ea8e0++){var _0x4b45c7=events[_0x5ea8e0];var _0x2894c9=createListener('userNotification:'+_0x4b45c7,_0x433ce6);UserNotificationEvents['on'](_0x4b45c7,_0x2894c9);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 05559ba..288968b 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x578b6c,_0x2838aa){var _0x24a715=function(_0x522826){while(--_0x522826){_0x578b6c['push'](_0x578b6c['shift']());}};_0x24a715(++_0x2838aa);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1c1694,_0xa28f24){var _0xa22480=function(_0x5ea8a3){while(--_0x5ea8a3){_0x1c1694['push'](_0x1c1694['shift']());}};_0xa22480(++_0xa28f24);}(_0xedd9,0xfc));var _0x9edd=function(_0x160bbd,_0x5adce6){_0x160bbd=_0x160bbd-0x0;var _0x18cb69=_0xedd9[_0x160bbd];return _0x18cb69;};'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 2bd593f..3681bc7 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 _0x501e=['sequelize','exports','INTEGER'];(function(_0x304600,_0x4ecdfe){var _0x337878=function(_0xe2b418){while(--_0xe2b418){_0x304600['push'](_0x304600['shift']());}};_0x337878(++_0x4ecdfe);}(_0x501e,0x150));var _0xe501=function(_0x358355,_0x22e11b){_0x358355=_0x358355-0x0;var _0x1716b3=_0x501e[_0x358355];return _0x1716b3;};'use strict';var Sequelize=require(_0xe501('0x0'));module[_0xe501('0x1')]={'penalty':{'type':Sequelize[_0xe501('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xabce=['INTEGER','sequelize','exports'];(function(_0x213497,_0x269c96){var _0x208298=function(_0x5e9ab8){while(--_0x5e9ab8){_0x213497['push'](_0x213497['shift']());}};_0x208298(++_0x269c96);}(_0xabce,0x103));var _0xeabc=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xabce[_0x411add];return _0x238242;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'penalty':{'type':Sequelize[_0xeabc('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 1507a9f..2f11fbf 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 _0x926a=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash'];(function(_0x5bc4ca,_0x21f738){var _0x12bf3b=function(_0x202536){while(--_0x202536){_0x5bc4ca['push'](_0x5bc4ca['shift']());}};_0x12bf3b(++_0x21f738);}(_0x926a,0xb5));var _0xa926=function(_0x3f0a79,_0x7e77a9){_0x3f0a79=_0x3f0a79-0x0;var _0x3a2864=_0x926a[_0x3f0a79];return _0x3a2864;};'use strict';var _=require(_0xa926('0x0'));var util=require(_0xa926('0x1'));var logger=require(_0xa926('0x2'))(_0xa926('0x3'));var moment=require(_0xa926('0x4'));var BPromise=require(_0xa926('0x5'));var rp=require(_0xa926('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa926('0x7'));var config=require(_0xa926('0x8'));var attributes=require(_0xa926('0x9'));module[_0xa926('0xa')]=function(_0x5949bb,_0x23b356){return _0x5949bb[_0xa926('0xb')]('UserOpenchannelQueue',attributes,{'tableName':_0xa926('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea1c=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','moment','request-promise','path'];(function(_0x5229d1,_0x1f670c){var _0x2ac5ec=function(_0x4e5ab0){while(--_0x4e5ab0){_0x5229d1['push'](_0x5229d1['shift']());}};_0x2ac5ec(++_0x1f670c);}(_0xea1c,0x1ab));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcea1('0x0'));var util=require('util');var logger=require(_0xcea1('0x1'))('api');var moment=require(_0xcea1('0x2'));var BPromise=require('bluebird');var rp=require(_0xcea1('0x3'));var fs=require('fs');var path=require(_0xcea1('0x4'));var rimraf=require(_0xcea1('0x5'));var config=require(_0xcea1('0x6'));var attributes=require(_0xcea1('0x7'));module[_0xcea1('0x8')]=function(_0x540b76,_0xca750c){return _0x540b76[_0xcea1('0x9')](_0xcea1('0xa'),attributes,{'tableName':_0xcea1('0xb'),'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 b7e556c..26a381f 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 _0xbdec=['error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x29cc71,_0xf8eacf){var _0x2b28ec=function(_0x494b5d){while(--_0x494b5d){_0x29cc71['push'](_0x29cc71['shift']());}};_0x2b28ec(++_0xf8eacf);}(_0xbdec,0x64));var _0xcbde=function(_0x47ed26,_0x2050f1){_0x47ed26=_0x47ed26-0x0;var _0x4a6ba4=_0xbdec[_0x47ed26];return _0x4a6ba4;};'use strict';var _=require(_0xcbde('0x0'));var util=require(_0xcbde('0x1'));var moment=require('moment');var BPromise=require(_0xcbde('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbde('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcbde('0x4'));var logger=require('../../config/logger')(_0xcbde('0x5'));var config=require(_0xcbde('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcbde('0x7')][_0xcbde('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6420b0,_0xc60644,_0x100296){return new BPromise(function(_0x2abbed,_0x2513be){return client[_0xcbde('0x9')](_0x6420b0,_0x100296)['then'](function(_0x313692){logger[_0xcbde('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0xc60644,_0xcbde('0xb'));logger[_0xcbde('0xc')](_0xcbde('0xd'),_0xc60644,'request\x20sent',JSON['stringify'](_0x313692));if(_0x313692[_0xcbde('0xe')]){if(_0x313692[_0xcbde('0xe')][_0xcbde('0xf')]===0x1f4){logger[_0xcbde('0xe')](_0xcbde('0x10'),_0xc60644,_0x313692['error'][_0xcbde('0x11')]);return _0x2513be(_0x313692['error']['message']);}logger[_0xcbde('0xe')](_0xcbde('0x10'),_0xc60644,_0x313692['error'][_0xcbde('0x11')]);return _0x2abbed(_0x313692[_0xcbde('0xe')][_0xcbde('0x11')]);}else{logger[_0xcbde('0xa')](_0xcbde('0x10'),_0xc60644,_0xcbde('0xb'));_0x2abbed(_0x313692['result'][_0xcbde('0x11')]);}})[_0xcbde('0x12')](function(_0xc0099c){logger['error'](_0xcbde('0x10'),_0xc60644,_0xc0099c);_0x2513be(_0xc0099c);});});} \ No newline at end of file +var _0x92d5=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x558dbc,_0x2339e1){var _0x20da35=function(_0x132ed7){while(--_0x132ed7){_0x558dbc['push'](_0x558dbc['shift']());}};_0x20da35(++_0x2339e1);}(_0x92d5,0x9f));var _0x592d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x92d5[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x592d('0x0'));var util=require('util');var moment=require(_0x592d('0x1'));var BPromise=require(_0x592d('0x2'));var rs=require(_0x592d('0x3'));var fs=require('fs');var Redis=require(_0x592d('0x4'));var db=require(_0x592d('0x5'))['db'];var utils=require(_0x592d('0x6'));var logger=require(_0x592d('0x7'))(_0x592d('0x8'));var config=require(_0x592d('0x9'));var jayson=require(_0x592d('0xa'));var client=jayson[_0x592d('0xb')][_0x592d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xbeb21b,_0x5ce42d,_0x2b32fa){return new BPromise(function(_0xfdc7a3,_0xa59e81){return client[_0x592d('0xd')](_0xbeb21b,_0x2b32fa)[_0x592d('0xe')](function(_0x19c7d5){logger[_0x592d('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5ce42d,_0x592d('0x10'));logger['debug'](_0x592d('0x11'),_0x5ce42d,_0x592d('0x10'),JSON[_0x592d('0x12')](_0x19c7d5));if(_0x19c7d5[_0x592d('0x13')]){if(_0x19c7d5[_0x592d('0x13')]['code']===0x1f4){logger[_0x592d('0x13')](_0x592d('0x14'),_0x5ce42d,_0x19c7d5[_0x592d('0x13')][_0x592d('0x15')]);return _0xa59e81(_0x19c7d5[_0x592d('0x13')][_0x592d('0x15')]);}logger['error'](_0x592d('0x14'),_0x5ce42d,_0x19c7d5[_0x592d('0x13')][_0x592d('0x15')]);return _0xfdc7a3(_0x19c7d5[_0x592d('0x13')][_0x592d('0x15')]);}else{logger[_0x592d('0xf')](_0x592d('0x14'),_0x5ce42d,'request\x20sent');_0xfdc7a3(_0x19c7d5[_0x592d('0x16')]['message']);}})[_0x592d('0x17')](function(_0xaaff3a){logger[_0x592d('0x13')](_0x592d('0x14'),_0x5ce42d,_0xaaff3a);_0xa59e81(_0xaaff3a);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 5e1745f..df62be2 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 _0xcd89=['addSections','addResources','put','/:id','update','delete','removeSections','removeResources','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','show','/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','clone'];(function(_0x2f80a3,_0x15964b){var _0x53460a=function(_0x24da41){while(--_0x24da41){_0x2f80a3['push'](_0x2f80a3['shift']());}};_0x53460a(++_0x15964b);}(_0xcd89,0xe1));var _0x9cd8=function(_0x24524e,_0x29aac6){_0x24524e=_0x24524e-0x0;var _0xbbc00e=_0xcd89[_0x24524e];return _0xbbc00e;};'use strict';var multer=require(_0x9cd8('0x0'));var util=require(_0x9cd8('0x1'));var path=require(_0x9cd8('0x2'));var timeout=require(_0x9cd8('0x3'));var express=require(_0x9cd8('0x4'));var router=express['Router']();var fs_extra=require(_0x9cd8('0x5'));var auth=require(_0x9cd8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9cd8('0x7'));var controller=require(_0x9cd8('0x8'));router[_0x9cd8('0x9')]('/',auth[_0x9cd8('0xa')](),controller[_0x9cd8('0xb')]);router[_0x9cd8('0x9')](_0x9cd8('0xc'),auth[_0x9cd8('0xa')](),controller[_0x9cd8('0xd')]);router['get']('/:id',auth[_0x9cd8('0xa')](),controller[_0x9cd8('0xe')]);router[_0x9cd8('0x9')](_0x9cd8('0xf'),auth[_0x9cd8('0xa')](),controller[_0x9cd8('0x10')]);router['get'](_0x9cd8('0x11'),auth['isAuthenticated'](),controller[_0x9cd8('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9cd8('0x13')]);router[_0x9cd8('0x14')](_0x9cd8('0x15'),auth[_0x9cd8('0xa')](),controller[_0x9cd8('0x16')]);router['post']('/:id/sections',auth['isAuthenticated'](),controller[_0x9cd8('0x17')]);router[_0x9cd8('0x14')](_0x9cd8('0x11'),auth[_0x9cd8('0xa')](),controller[_0x9cd8('0x18')]);router[_0x9cd8('0x19')](_0x9cd8('0x1a'),auth[_0x9cd8('0xa')](),controller[_0x9cd8('0x1b')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x9cd8('0x1c')](_0x9cd8('0xf'),auth[_0x9cd8('0xa')](),controller[_0x9cd8('0x1d')]);router[_0x9cd8('0x1c')](_0x9cd8('0x11'),auth[_0x9cd8('0xa')](),controller[_0x9cd8('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xcda7=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/sections','getSections','post','create','/:id/clone','clone','addSections','/:id/resources','addResources','put','update','delete','removeSections','removeResources','connect-timeout','express'];(function(_0x24aa5c,_0x4ee4d3){var _0x19eb18=function(_0xf3b56b){while(--_0xf3b56b){_0x24aa5c['push'](_0x24aa5c['shift']());}};_0x19eb18(++_0x4ee4d3);}(_0xcda7,0xce));var _0x7cda=function(_0x43fbea,_0x576190){_0x43fbea=_0x43fbea-0x0;var _0x3aad6d=_0xcda7[_0x43fbea];return _0x3aad6d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7cda('0x0'));var express=require(_0x7cda('0x1'));var router=express[_0x7cda('0x2')]();var fs_extra=require(_0x7cda('0x3'));var auth=require(_0x7cda('0x4'));var interaction=require(_0x7cda('0x5'));var config=require(_0x7cda('0x6'));var controller=require('./userProfile.controller');router[_0x7cda('0x7')]('/',auth[_0x7cda('0x8')](),controller['index']);router['get'](_0x7cda('0x9'),auth[_0x7cda('0x8')](),controller[_0x7cda('0xa')]);router[_0x7cda('0x7')](_0x7cda('0xb'),auth[_0x7cda('0x8')](),controller['show']);router['get'](_0x7cda('0xc'),auth[_0x7cda('0x8')](),controller[_0x7cda('0xd')]);router[_0x7cda('0x7')]('/:id/resources',auth[_0x7cda('0x8')](),controller['getResources']);router[_0x7cda('0xe')]('/',auth['isAuthenticated'](),controller[_0x7cda('0xf')]);router[_0x7cda('0xe')](_0x7cda('0x10'),auth[_0x7cda('0x8')](),controller[_0x7cda('0x11')]);router[_0x7cda('0xe')](_0x7cda('0xc'),auth['isAuthenticated'](),controller[_0x7cda('0x12')]);router[_0x7cda('0xe')](_0x7cda('0x13'),auth['isAuthenticated'](),controller[_0x7cda('0x14')]);router[_0x7cda('0x15')](_0x7cda('0xb'),auth[_0x7cda('0x8')](),controller[_0x7cda('0x16')]);router[_0x7cda('0x17')](_0x7cda('0xb'),auth[_0x7cda('0x8')](),controller['destroy']);router[_0x7cda('0x17')](_0x7cda('0xc'),auth['isAuthenticated'](),controller[_0x7cda('0x18')]);router[_0x7cda('0x17')](_0x7cda('0x13'),auth['isAuthenticated'](),controller[_0x7cda('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 7ad0f47..0540722 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 _0x47b1=['join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions'];(function(_0x5e05e4,_0x2ac12a){var _0x149f81=function(_0x5b56e8){while(--_0x5b56e8){_0x5e05e4['push'](_0x5e05e4['shift']());}};_0x149f81(++_0x2ac12a);}(_0x47b1,0xea));var _0x147b=function(_0x2f5ec2,_0x5dfeab){_0x2f5ec2=_0x2f5ec2-0x0;var _0x1d39d0=_0x47b1[_0x2f5ec2];return _0x1d39d0;};'use strict';var Sequelize=require(_0x147b('0x0'));module[_0x147b('0x1')]={'name':{'type':Sequelize[_0x147b('0x2')],'allowNull':![],'unique':_0x147b('0x3')},'crudPermissions':{'type':Sequelize[_0x147b('0x2')],'set':function(_0x140ec7){this[_0x147b('0x4')](_0x147b('0x5'),_0x140ec7?_0x140ec7[_0x147b('0x6')](''):[]);},'get':function(){return this[_0x147b('0x7')](_0x147b('0x5'))?this[_0x147b('0x7')](_0x147b('0x5'))[_0x147b('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x147b('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x147b('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x147b('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x147b('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x147b('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x147b('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8fc0=['name','setDataValue','getDataValue','crudPermissions','split','STRING','BOOLEAN','sequelize'];(function(_0x4df2d8,_0x28b07f){var _0x217e9e=function(_0x19cca0){while(--_0x19cca0){_0x4df2d8['push'](_0x4df2d8['shift']());}};_0x217e9e(++_0x28b07f);}(_0x8fc0,0xff));var _0x08fc=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8fc0[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x08fc('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x08fc('0x1')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x37028f){this[_0x08fc('0x2')]('crudPermissions',_0x37028f?_0x37028f['join'](''):[]);},'get':function(){return this[_0x08fc('0x3')](_0x08fc('0x4'))?this['getDataValue'](_0x08fc('0x4'))[_0x08fc('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x08fc('0x6')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x08fc('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x08fc('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x08fc('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x08fc('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x08fc('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x08fc('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x08fc('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 580a9a1..9d47b39 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 _0xd0da=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','limit','count','offset','set','json','apply','reject','then','sendStatus','error','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','create','catch','find','get','omit','createdAt','updatedAt','body','transaction','UserProfileSection','each','autoAssociation','sectionId','Resources','UserProfileResource','update','destroy','addSections','sequelize','userProfileId','push','removeSections','getSections','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','ids','getResources','section','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x4fa0ea,_0x2cd534){var _0x51d027=function(_0xe67342){while(--_0xe67342){_0x4fa0ea['push'](_0x4fa0ea['shift']());}};_0x51d027(++_0x2cd534);}(_0xd0da,0x1b1));var _0xad0d=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xd0da[_0x30cd7e];return _0x462a02;};'use strict';var emlformat=require(_0xad0d('0x0'));var rimraf=require(_0xad0d('0x1'));var zipdir=require(_0xad0d('0x2'));var jsonpatch=require(_0xad0d('0x3'));var rp=require(_0xad0d('0x4'));var moment=require('moment');var BPromise=require(_0xad0d('0x5'));var Mustache=require(_0xad0d('0x6'));var util=require(_0xad0d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xad0d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad0d('0x9'));var squel=require(_0xad0d('0xa'));var crypto=require(_0xad0d('0xb'));var jsforce=require(_0xad0d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xad0d('0x8'));var querystring=require(_0xad0d('0xd'));var Papa=require(_0xad0d('0xe'));var Redis=require(_0xad0d('0xf'));var authService=require(_0xad0d('0x10'));var qs=require(_0xad0d('0x11'));var as=require(_0xad0d('0x12'));var hardwareService=require(_0xad0d('0x13'));var logger=require(_0xad0d('0x14'))(_0xad0d('0x15'));var utils=require(_0xad0d('0x16'));var config=require(_0xad0d('0x17'));var licenseUtil=require(_0xad0d('0x18'));var db=require('../../mysqldb')['db'];config[_0xad0d('0x19')]=_[_0xad0d('0x1a')](config['redis'],{'host':_0xad0d('0x1b'),'port':0x18eb});var socket=require(_0xad0d('0x1c'))(new Redis(config['redis']));require(_0xad0d('0x1d'))[_0xad0d('0x1e')](socket);function respondWithStatusCode(_0x5973a4,_0x2cab04){_0x2cab04=_0x2cab04||0xcc;return function(_0x698ee){if(_0x698ee){return _0x5973a4['sendStatus'](_0x2cab04);}return _0x5973a4[_0xad0d('0x1f')](_0x2cab04)['end']();};}function respondWithResult(_0x56d253,_0x3efaab){_0x3efaab=_0x3efaab||0xc8;return function(_0x3677b5){if(_0x3677b5){return _0x56d253[_0xad0d('0x1f')](_0x3efaab)['json'](_0x3677b5);}};}function respondWithFilteredResult(_0x1cac0c,_0x2f3bb3){return function(_0x5862bd){if(_0x5862bd){var _0xb6c032=typeof _0x2f3bb3['offset']==='undefined'&&typeof _0x2f3bb3[_0xad0d('0x20')]==='undefined';var _0x439484=_0x5862bd[_0xad0d('0x21')];var _0x3f77b1=_0xb6c032?0x0:_0x2f3bb3['offset'];var _0x490bb9=_0xb6c032?_0x5862bd[_0xad0d('0x21')]:_0x2f3bb3[_0xad0d('0x22')]+_0x2f3bb3[_0xad0d('0x20')];var _0x542bd8;if(_0x490bb9>=_0x439484){_0x490bb9=_0x439484;_0x542bd8=0xc8;}else{_0x542bd8=0xce;}_0x1cac0c['status'](_0x542bd8);return _0x1cac0c[_0xad0d('0x23')]('Content-Range',_0x3f77b1+'-'+_0x490bb9+'/'+_0x439484)[_0xad0d('0x24')](_0x5862bd);}return null;};}function patchUpdates(_0x129e80){return function(_0x3dd9a4){try{jsonpatch[_0xad0d('0x25')](_0x3dd9a4,_0x129e80,!![]);}catch(_0xefaf5f){return BPromise[_0xad0d('0x26')](_0xefaf5f);}return _0x3dd9a4['save']();};}function saveUpdates(_0x171757,_0x45f401){return function(_0x59499a){if(_0x59499a){return _0x59499a['update'](_0x171757)[_0xad0d('0x27')](function(_0x3e510e){return _0x3e510e;});}return null;};}function removeEntity(_0x444eda,_0x4ed3c8){return function(_0x3f70a6){if(_0x3f70a6){return _0x3f70a6['destroy']()[_0xad0d('0x27')](function(){_0x444eda[_0xad0d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481e1a,_0x3111fd){return function(_0x434221){if(!_0x434221){_0x481e1a[_0xad0d('0x28')](0x194);}return _0x434221;};}function handleError(_0x54a0c1,_0x472706){_0x472706=_0x472706||0x1f4;return function(_0x62dfed){logger[_0xad0d('0x29')](_0x62dfed['stack']);if(_0x62dfed[_0xad0d('0x2a')]){delete _0x62dfed[_0xad0d('0x2a')];}_0x54a0c1['status'](_0x472706)[_0xad0d('0x2b')](_0x62dfed);};}exports[_0xad0d('0x2c')]=function(_0x20bb3d,_0x11c203){var _0x185b9e={},_0x36c0f9={},_0x299752={'count':0x0,'rows':[]};var _0x4372e3=_[_0xad0d('0x2d')](db[_0xad0d('0x2e')][_0xad0d('0x2f')],function(_0x53ebdf){return{'name':_0x53ebdf[_0xad0d('0x30')],'type':_0x53ebdf['type'][_0xad0d('0x31')]};});_0x36c0f9[_0xad0d('0x32')]=_[_0xad0d('0x2d')](_0x4372e3,_0xad0d('0x2a'));_0x36c0f9['query']=_[_0xad0d('0x33')](_0x20bb3d[_0xad0d('0x34')]);_0x36c0f9['filters']=_[_0xad0d('0x35')](_0x36c0f9[_0xad0d('0x32')],_0x36c0f9[_0xad0d('0x34')]);_0x185b9e[_0xad0d('0x36')]=_[_0xad0d('0x35')](_0x36c0f9['model'],qs[_0xad0d('0x37')](_0x20bb3d[_0xad0d('0x34')][_0xad0d('0x37')]));_0x185b9e[_0xad0d('0x36')]=_0x185b9e['attributes'][_0xad0d('0x38')]?_0x185b9e['attributes']:_0x36c0f9[_0xad0d('0x32')];if(!_0x20bb3d[_0xad0d('0x34')][_0xad0d('0x39')]('nolimit')){_0x185b9e[_0xad0d('0x20')]=qs[_0xad0d('0x20')](_0x20bb3d[_0xad0d('0x34')][_0xad0d('0x20')]);_0x185b9e[_0xad0d('0x22')]=qs[_0xad0d('0x22')](_0x20bb3d[_0xad0d('0x34')][_0xad0d('0x22')]);}_0x185b9e['order']=qs[_0xad0d('0x3a')](_0x20bb3d[_0xad0d('0x34')][_0xad0d('0x3a')]);_0x185b9e[_0xad0d('0x3b')]=qs['filters'](_[_0xad0d('0x3c')](_0x20bb3d[_0xad0d('0x34')],_0x36c0f9[_0xad0d('0x3d')]),_0x4372e3);if(_0x20bb3d[_0xad0d('0x34')][_0xad0d('0x3e')]){_0x185b9e['where']=_['merge'](_0x185b9e[_0xad0d('0x3b')],{'$or':_['map'](_0x4372e3,function(_0x3b617d){if(_0x3b617d[_0xad0d('0x3f')]!==_0xad0d('0x40')){var _0x3041f8={};_0x3041f8[_0x3b617d[_0xad0d('0x2a')]]={'$like':'%'+_0x20bb3d[_0xad0d('0x34')][_0xad0d('0x3e')]+'%'};return _0x3041f8;}})});}_0x185b9e=_[_0xad0d('0x41')]({},_0x185b9e,_0x20bb3d[_0xad0d('0x42')]);var _0x539d55={'where':_0x185b9e[_0xad0d('0x3b')]};return db[_0xad0d('0x2e')][_0xad0d('0x21')](_0x539d55)[_0xad0d('0x27')](function(_0x3a1775){_0x299752[_0xad0d('0x21')]=_0x3a1775;if(_0x20bb3d[_0xad0d('0x34')][_0xad0d('0x43')]){_0x185b9e[_0xad0d('0x44')]=[{'all':!![]}];}return db[_0xad0d('0x2e')][_0xad0d('0x45')](_0x185b9e);})[_0xad0d('0x27')](function(_0x336ac8){_0x299752[_0xad0d('0x46')]=_0x336ac8;return _0x299752;})[_0xad0d('0x27')](respondWithFilteredResult(_0x11c203,_0x185b9e))['catch'](handleError(_0x11c203,null));};exports[_0xad0d('0x47')]=function(_0x8816f0,_0x20f0f6){var _0xb9ba8c={'raw':![],'where':{'id':_0x8816f0[_0xad0d('0x48')]['id']}},_0x416b6e={};_0x416b6e[_0xad0d('0x32')]=_[_0xad0d('0x33')](db[_0xad0d('0x2e')][_0xad0d('0x2f')]);_0x416b6e['query']=_[_0xad0d('0x33')](_0x8816f0[_0xad0d('0x34')]);_0x416b6e[_0xad0d('0x3d')]=_['intersection'](_0x416b6e[_0xad0d('0x32')],_0x416b6e[_0xad0d('0x34')]);_0xb9ba8c['attributes']=_[_0xad0d('0x35')](_0x416b6e['model'],qs[_0xad0d('0x37')](_0x8816f0['query']['fields']));_0xb9ba8c['attributes']=_0xb9ba8c['attributes'][_0xad0d('0x38')]?_0xb9ba8c['attributes']:_0x416b6e['model'];if(_0x8816f0['query'][_0xad0d('0x43')]){_0xb9ba8c['include']=[{'all':!![]}];}_0xb9ba8c=_['merge']({},_0xb9ba8c,_0x8816f0[_0xad0d('0x42')]);return db[_0xad0d('0x2e')]['find'](_0xb9ba8c)[_0xad0d('0x27')](handleEntityNotFound(_0x20f0f6,null))[_0xad0d('0x27')](respondWithResult(_0x20f0f6,null))['catch'](handleError(_0x20f0f6,null));};exports[_0xad0d('0x49')]=function(_0x3ef5e7,_0x32bad5){return db[_0xad0d('0x2e')][_0xad0d('0x49')](_0x3ef5e7['body'],{})[_0xad0d('0x27')](respondWithResult(_0x32bad5,0xc9))[_0xad0d('0x4a')](handleError(_0x32bad5,null));};exports['clone']=function(_0x5ece67,_0x323b1e){var _0x2ced7c={'where':{'id':_0x5ece67[_0xad0d('0x48')]['id']}},_0x140eac={};_0x140eac['model']=_[_0xad0d('0x33')](db[_0xad0d('0x2e')][_0xad0d('0x2f')]);_0x2ced7c['attributes']=_[_0xad0d('0x35')](_0x140eac[_0xad0d('0x32')],qs[_0xad0d('0x37')](_0x5ece67[_0xad0d('0x34')][_0xad0d('0x37')]));_0x2ced7c[_0xad0d('0x36')]=_0x2ced7c[_0xad0d('0x36')][_0xad0d('0x38')]?_0x2ced7c['attributes']:_0x140eac['model'];if(_0x5ece67[_0xad0d('0x34')][_0xad0d('0x43')]){_0x2ced7c[_0xad0d('0x44')]=[{'all':!![]}];}_0x2ced7c=_[_0xad0d('0x41')]({},_0x2ced7c,_0x5ece67[_0xad0d('0x42')]);return db[_0xad0d('0x2e')][_0xad0d('0x4b')](_0x2ced7c)[_0xad0d('0x27')](handleEntityNotFound(_0x323b1e,null))['then'](function(_0x19dd26){if(_0x19dd26){var _0x5b8b02=_0x19dd26[_0xad0d('0x4c')]({'plain':!![]});_0x5b8b02=qs[_0xad0d('0x4d')](_0x5b8b02,['id',_0xad0d('0x4e'),_0xad0d('0x4f'),'crudPermissions']);_0x5ece67[_0xad0d('0x50')]=_[_0xad0d('0x4d')](_0x5ece67['body'],['id',_0xad0d('0x4e'),_0xad0d('0x4f')]);return db['sequelize'][_0xad0d('0x51')](function(_0x1e34ab){return db[_0xad0d('0x2e')]['create'](_[_0xad0d('0x41')](_0x5b8b02,_0x5ece67[_0xad0d('0x50')]),{'include':_0x5ece67['query'][_0xad0d('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x1e34ab})[_0xad0d('0x27')](function(_0x5cffc5){var _0x4658c9=_0x5cffc5[_0xad0d('0x4c')]({'plain':!![]});return db[_0xad0d('0x52')][_0xad0d('0x45')]({'where':{'userProfileId':_0x5ece67[_0xad0d('0x48')]['id']},'raw':!![]})[_0xad0d('0x27')](function(_0x265076){if(_0x265076){return BPromise[_0xad0d('0x53')](_0x265076,function(_0x93b874){return new BPromise(function(_0x3de9f1,_0x4519c9){if(_0x93b874['autoAssociation']===null||_0x93b874[_0xad0d('0x54')]===0x1)_0x3de9f1(null);return db['UserProfileResource'][_0xad0d('0x45')]({'where':{'sectionId':_0x93b874['id']},'raw':!![]})['then'](function(_0x503037){var _0x5ef2e2=_[_0xad0d('0x2d')](_0x503037,function(_0x3a7268){return qs[_0xad0d('0x4d')](_0x3a7268,['id',_0xad0d('0x4e'),_0xad0d('0x4f'),_0xad0d('0x55')]);});_0x3de9f1(_0x5ef2e2);})[_0xad0d('0x4a')](function(_0x11b492){_0x4519c9(_0x11b492);});})['then'](function(_0x4f7cc9){var _0x313b3e=qs['omit'](_0x93b874,['id','createdAt',_0xad0d('0x4f')]);_0x313b3e['userProfileId']=_0x4658c9['id'];if(_0x4f7cc9)_0x313b3e[_0xad0d('0x56')]=_0x4f7cc9;return _0x313b3e;})[_0xad0d('0x27')](function(_0x597ddb){return db[_0xad0d('0x52')][_0xad0d('0x49')](_0x597ddb,{'include':[{'model':db[_0xad0d('0x57')],'as':_0xad0d('0x56')}],'raw':!![],'transaction':_0x1e34ab});});})[_0xad0d('0x27')](function(){return _0x4658c9;});}});});});}})[_0xad0d('0x27')](respondWithResult(_0x323b1e,0xc9))[_0xad0d('0x4a')](handleError(_0x323b1e,null));};exports[_0xad0d('0x58')]=function(_0x299d09,_0x15404b){if(_0x299d09[_0xad0d('0x50')]['id']){delete _0x299d09[_0xad0d('0x50')]['id'];}return db[_0xad0d('0x2e')][_0xad0d('0x4b')]({'where':{'id':_0x299d09['params']['id']}})[_0xad0d('0x27')](handleEntityNotFound(_0x15404b,null))[_0xad0d('0x27')](saveUpdates(_0x299d09[_0xad0d('0x50')],null))['then'](respondWithResult(_0x15404b,null))['catch'](handleError(_0x15404b,null));};exports[_0xad0d('0x59')]=function(_0x47bd94,_0xaa56ed){return db[_0xad0d('0x2e')][_0xad0d('0x4b')]({'where':{'id':_0x47bd94[_0xad0d('0x48')]['id']}})[_0xad0d('0x27')](handleEntityNotFound(_0xaa56ed,null))[_0xad0d('0x27')](removeEntity(_0xaa56ed,null))['catch'](handleError(_0xaa56ed,null));};exports['describe']=function(_0x10958f,_0x4c3768){return db[_0xad0d('0x2e')]['describe']()['then'](respondWithResult(_0x4c3768,null))[_0xad0d('0x4a')](handleError(_0x4c3768,null));};exports[_0xad0d('0x5a')]=function(_0x2a3509,_0x11cf4a){var _0x222b3a=_0x2a3509['body'];return db[_0xad0d('0x2e')][_0xad0d('0x4b')]({'where':{'id':_0x2a3509[_0xad0d('0x48')]['id']}})['then'](handleEntityNotFound(_0x11cf4a,null))[_0xad0d('0x27')](function(_0x530297){if(_0x530297){return db[_0xad0d('0x5b')][_0xad0d('0x51')](function(_0x52ccb8){return db[_0xad0d('0x52')][_0xad0d('0x59')]({'where':{'userProfileId':_0x2a3509[_0xad0d('0x48')]['id'],'sectionId':_[_0xad0d('0x2d')](_0x222b3a,function(_0x3f5899){return _0x3f5899[_0xad0d('0x55')];})},'transaction':_0x52ccb8})['then'](function(){var _0x21cc0f=_['map'](_0x222b3a,function(_0x2dafe6){_0x2dafe6[_0xad0d('0x5c')]=_0x2a3509[_0xad0d('0x48')]['id'];return _0x2dafe6;});var _0x37664f=[];return BPromise[_0xad0d('0x53')](_0x21cc0f,function(_0xc077d7){return db[_0xad0d('0x52')][_0xad0d('0x49')](_0xc077d7,{'include':[{'model':db['UserProfileResource'],'as':_0xad0d('0x56')}],'raw':!![],'transaction':_0x52ccb8})[_0xad0d('0x27')](function(_0x92aa13){_0x37664f[_0xad0d('0x5d')](_0x92aa13['get']({'plain':!![]}));});})[_0xad0d('0x27')](function(){return _0x37664f;});});});}})[_0xad0d('0x27')](function(_0x32de95){return _0x32de95;})[_0xad0d('0x27')](respondWithResult(_0x11cf4a,null))[_0xad0d('0x4a')](handleError(_0x11cf4a,null));};exports[_0xad0d('0x5e')]=function(_0x11e002,_0xc257b4){var _0x2db0c2;return db[_0xad0d('0x2e')]['find']({'where':{'id':_0x11e002['params']['id']},'attributes':['id',_0xad0d('0x2a')]})['then'](handleEntityNotFound(_0xc257b4,null))['then'](function(_0x2f8dcb){if(_0x2f8dcb){_0x2db0c2=_0x2f8dcb;return db[_0xad0d('0x52')][_0xad0d('0x59')]({'where':{'userProfileId':_0x11e002['params']['id'],'sectionId':_0x11e002[_0xad0d('0x34')]['ids']}});}})[_0xad0d('0x27')](function(){return _0x2db0c2;})[_0xad0d('0x27')](respondWithStatusCode(_0xc257b4,null))[_0xad0d('0x4a')](handleError(_0xc257b4,null));};exports[_0xad0d('0x5f')]=function(_0xfddadb,_0x48c584){var _0x382b18=[];var _0x10120d=[];return db[_0xad0d('0x52')][_0xad0d('0x45')]({'where':{'userProfileId':_0xfddadb[_0xad0d('0x48')]['id']},'raw':!![]})['then'](function(_0x26d5d3){_0x382b18=_[_0xad0d('0x3e')](_0x26d5d3,function(_0x47a4c6){return _0x47a4c6['enabled']===0x1||_[_0xad0d('0x60')]([0x3eb,0x709],_0x47a4c6['sectionId']);});if(!_[_0xad0d('0x61')](_0x382b18)){return _['map'](_0x382b18,function(_0x1df5cb){return _0x1df5cb[_0xad0d('0x55')];});}else{return;}})[_0xad0d('0x27')](function(_0x3ca170){if(_0x3ca170)_0x10120d=_0x3ca170;if(_[_0xad0d('0x60')](_0x10120d,0x64)){var _0x35195a=_[_0xad0d('0x4b')](_0x382b18,{'sectionId':0x64});return hasDefaultDashboard(_0x35195a)[_0xad0d('0x27')](function(_0x437307){return _[_0xad0d('0x2d')](_0x382b18,function(_0xe1c7a6){if(_0xe1c7a6[_0xad0d('0x55')]===0x64){_0xe1c7a6[_0xad0d('0x62')]=_0x437307;}return _0xe1c7a6;});});}else{return;}})['then'](function(_0x12063c){if(_0x12063c)_0x382b18=_0x12063c;if(_[_0xad0d('0x60')](_0x10120d,0x3eb)){var _0xfe3458=_[_0xad0d('0x4b')](_0x382b18,{'sectionId':0x3eb});return getCustomDashboards(_0xfe3458)[_0xad0d('0x27')](function(_0x135f52){return _[_0xad0d('0x2d')](_0x382b18,function(_0x19d5b7){if(_0xfe3458[_0xad0d('0x63')]){if(_0x19d5b7['sectionId']===0x3eb){_0x19d5b7['subsections']=_0x135f52;}}else{if(_0x19d5b7[_0xad0d('0x55')]===0x64){_0x19d5b7['subsections']=_0x135f52;}}return _0x19d5b7;});});}else{return;}})[_0xad0d('0x27')](function(_0x51f4e2){if(_0x51f4e2)_0x382b18=_0x51f4e2;if(_[_0xad0d('0x60')](_0x10120d,0x709)){var _0x3f70a7=_[_0xad0d('0x4b')](_0x382b18,{'sectionId':0x709});return getPlugins(_0x3f70a7)[_0xad0d('0x27')](function(_0x554f78){if(_0x3f70a7[_0xad0d('0x63')]){return _[_0xad0d('0x2d')](_0x382b18,function(_0x5e64cf){if(_0x5e64cf[_0xad0d('0x55')]===0x709){_0x5e64cf[_0xad0d('0x62')]=_0x554f78;}return _0x5e64cf;});}else{var _0x152332={'sectionId':0x76c,'enabled':0x1,'subsections':_0x554f78};var _0x428e83=_[_0xad0d('0x2d')](_0x382b18);_0x428e83['push'](_0x152332);return _0x428e83;}});}else{return;}})['then'](function(_0x59841c){if(_0x59841c)_0x382b18=_0x59841c;return _[_0xad0d('0x3e')](_0x382b18,['enabled',0x1]);})[_0xad0d('0x27')](respondWithResult(_0x48c584,null))[_0xad0d('0x4a')](handleError(_0x48c584,null));};function hasDefaultDashboard(_0x29c4b8){var _0x51f788=[0x65];return new BPromise(function(_0x572196,_0x486b23){try{if(_0x29c4b8[_0xad0d('0x54')]){_0x572196(_0x51f788);}else{return db['UserProfileResource'][_0xad0d('0x64')]({'where':{'sectionId':_0x29c4b8['id']},'raw':!![]})['then'](function(_0x29c307){_0x29c307?_0x572196(_0x51f788):_0x572196();});}}catch(_0x461ba8){_0x486b23(_0x461ba8);}});}function getCustomDashboards(_0x476bb4){var _0x3a6373=[];return new BPromise(function(_0x469987,_0xcfde6){try{if(_0x476bb4['autoAssociation']){return db[_0xad0d('0x65')][_0xad0d('0x45')]({'raw':!![]})['then'](function(_0x207a06){_0x207a06['forEach'](function(_0x259d65){_0x3a6373[_0xad0d('0x5d')](_0x259d65['id']+0x1869f);});_0x469987(_0x3a6373);});}else{return db[_0xad0d('0x57')]['findAll']({'where':{'sectionId':_0x476bb4['id']},'raw':!![]})['then'](function(_0x9436a5){_0x9436a5[_0xad0d('0x66')](function(_0x41a462){_0x3a6373[_0xad0d('0x5d')](_0x41a462[_0xad0d('0x67')]+0x1869f);});_0x469987(_0x3a6373);});}}catch(_0x2b3dfc){_0xcfde6(_0x2b3dfc);}});}function getPlugins(_0x100dc4){var _0x46e828=[];return new BPromise(function(_0x1e418f,_0x53bfbe){try{if(_0x100dc4[_0xad0d('0x54')]){return db[_0xad0d('0x68')][_0xad0d('0x45')]({'raw':!![]})[_0xad0d('0x27')](function(_0x3530c1){_0x3530c1[_0xad0d('0x66')](function(_0x3b54f3){_0x46e828[_0xad0d('0x5d')](_0x3b54f3['id']+0x15b38);});_0x1e418f(_0x46e828);});}else{return db[_0xad0d('0x57')][_0xad0d('0x45')]({'where':{'sectionId':_0x100dc4['id']},'raw':!![]})[_0xad0d('0x27')](function(_0x529c53){_0x529c53[_0xad0d('0x66')](function(_0x9e3216){_0x46e828[_0xad0d('0x5d')](_0x9e3216[_0xad0d('0x67')]+0x15b38);});_0x1e418f(_0x46e828);});}}catch(_0x1d2116){_0x53bfbe(_0x1d2116);}});}exports['addResources']=function(_0x167f0f,_0x10fd8f){return db[_0xad0d('0x2e')]['find']({'where':{'id':_0x167f0f['params']['id']}})[_0xad0d('0x27')](handleEntityNotFound(_0x10fd8f,null))[_0xad0d('0x27')](function(_0x118180){if(_0x118180){return db['sequelize']['transaction'](function(_0x4b8691){return db[_0xad0d('0x52')][_0xad0d('0x45')]({'where':{'userProfileId':_0x167f0f[_0xad0d('0x48')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x13892d){if(_0x13892d){return db[_0xad0d('0x52')]['destroy']({'where':{'userProfileId':_0x167f0f[_0xad0d('0x48')]['id'],'id':_[_0xad0d('0x2d')](_0x13892d,function(_0x34f3db){return _0x34f3db['id'];})},'transaction':_0x4b8691});}})[_0xad0d('0x27')](function(_0x3b05ef){var _0x15a94e=_[_0xad0d('0x2d')](_0x167f0f[_0xad0d('0x50')],function(_0x3d8e4a){_0x3d8e4a[_0xad0d('0x5c')]=_0x167f0f[_0xad0d('0x48')]['id'];return _0x3d8e4a;});return db[_0xad0d('0x52')]['bulkCreate'](_0x15a94e,{'raw':!![],'transaction':_0x4b8691});})[_0xad0d('0x27')](function(_0x4f33f2){var _0x28a7b3=_[_0xad0d('0x3e')](_[_0xad0d('0x2d')](_0x4f33f2,function(_0x37d48){return _0x37d48['get']({'plain':!![]});}),{'includeAll':![]});if(_0x28a7b3){return db[_0xad0d('0x52')][_0xad0d('0x45')]({'where':{'userProfileId':_0x167f0f[_0xad0d('0x48')]['id'],'sectionId':_['map'](_0x28a7b3,function(_0x2d2620){return _0x2d2620['sectionId'];})},'attributes':['id',_0xad0d('0x55')],'raw':!![]})[_0xad0d('0x27')](function(_0x19c57d){var _0x1b3def=_['map'](_0x167f0f[_0xad0d('0x50')],function(_0x5e065c){_0x5e065c[_0xad0d('0x5c')]=_0x167f0f[_0xad0d('0x48')]['id'];return _0x5e065c;});return db[_0xad0d('0x57')][_0xad0d('0x69')](_0x1b3def,{'raw':!![],'transaction':_0x4b8691});});}})[_0xad0d('0x4a')](handleError(_0x10fd8f,null));});}})['then'](function(_0x5f22ce){var _0x3820ed=_['map'](_0x5f22ce,function(_0x3b909c){return _0x3b909c[_0xad0d('0x4c')]({'plain':!![]});});})[_0xad0d('0x27')](respondWithResult(_0x10fd8f,null))[_0xad0d('0x4a')](handleError(_0x10fd8f,null));};exports[_0xad0d('0x6a')]=function(_0x5dff1a,_0x21c59f,_0x12e3a3){return db['UserProfile'][_0xad0d('0x4b')]({'where':{'id':_0x5dff1a[_0xad0d('0x48')]['id']}})[_0xad0d('0x27')](handleEntityNotFound(_0x21c59f,null))['then'](function(_0x2f9ac7){if(_0x2f9ac7){return _0x2f9ac7[_0xad0d('0x6a')](_0x5dff1a['query'][_0xad0d('0x6b')]);}})[_0xad0d('0x27')](respondWithStatusCode(_0x21c59f,null))[_0xad0d('0x4a')](handleError(_0x21c59f,null));};exports[_0xad0d('0x6c')]=function(_0x1e40b4,_0x32e6ff){var _0x4cdec6={};if(!_0x1e40b4[_0xad0d('0x34')][_0xad0d('0x6d')])throw new Error('Missing\x20section\x20parameter');if(!_0x1e40b4[_0xad0d('0x34')][_0xad0d('0x39')](_0xad0d('0x6e'))){_0x4cdec6[_0xad0d('0x20')]=qs[_0xad0d('0x20')](_0x1e40b4[_0xad0d('0x34')]['limit']);_0x4cdec6[_0xad0d('0x22')]=qs['offset'](_0x1e40b4[_0xad0d('0x34')][_0xad0d('0x22')]);}return db[_0xad0d('0x2e')][_0xad0d('0x4b')]({'where':{'id':_0x1e40b4[_0xad0d('0x48')]['id']}})[_0xad0d('0x27')](function(_0x17d86e){if(!_0x17d86e)throw new Error(_0xad0d('0x6f')+_0x1e40b4[_0xad0d('0x48')]['id']);return db[_0xad0d('0x2e')][_0xad0d('0x6c')](_0x1e40b4);})[_0xad0d('0x27')](respondWithFilteredResult(_0x32e6ff,_0x4cdec6))[_0xad0d('0x4a')](handleError(_0x32e6ff,null));}; \ No newline at end of file +var _0x94e6=['destroy','then','stack','name','send','UserProfile','fieldName','key','model','map','keys','filters','intersection','attributes','fields','query','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','body','clone','length','find','get','omit','createdAt','crudPermissions','sequelize','transaction','autoAssociation','findAll','updatedAt','userProfileId','Resources','UserProfileSection','UserProfileResource','describe','addSections','sectionId','each','push','removeSections','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','addResources','bulkCreate','ids','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x3bfbd8,_0x5521b7){var _0x475f43=function(_0x4ca517){while(--_0x4ca517){_0x3bfbd8['push'](_0x3bfbd8['shift']());}};_0x475f43(++_0x5521b7);}(_0x94e6,0x194));var _0x694e=function(_0x3e2f84,_0x19275e){_0x3e2f84=_0x3e2f84-0x0;var _0x2b01fd=_0x94e6[_0x3e2f84];return _0x2b01fd;};'use strict';var emlformat=require(_0x694e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x694e('0x1'));var jsonpatch=require(_0x694e('0x2'));var rp=require(_0x694e('0x3'));var moment=require(_0x694e('0x4'));var BPromise=require(_0x694e('0x5'));var Mustache=require(_0x694e('0x6'));var util=require('util');var path=require(_0x694e('0x7'));var sox=require(_0x694e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x694e('0x9'));var _=require(_0x694e('0xa'));var squel=require(_0x694e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x694e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x694e('0xd'));var authService=require(_0x694e('0xe'));var qs=require(_0x694e('0xf'));var as=require(_0x694e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x694e('0x11'))(_0x694e('0x12'));var utils=require('../../config/utils');var config=require(_0x694e('0x13'));var licenseUtil=require(_0x694e('0x14'));var db=require(_0x694e('0x15'))['db'];config[_0x694e('0x16')]=_['defaults'](config[_0x694e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x694e('0x17'))(new Redis(config[_0x694e('0x16')]));require(_0x694e('0x18'))[_0x694e('0x19')](socket);function respondWithStatusCode(_0x1532f6,_0x310a08){_0x310a08=_0x310a08||0xcc;return function(_0x4e9c8){if(_0x4e9c8){return _0x1532f6[_0x694e('0x1a')](_0x310a08);}return _0x1532f6[_0x694e('0x1b')](_0x310a08)[_0x694e('0x1c')]();};}function respondWithResult(_0x327f83,_0x46d46c){_0x46d46c=_0x46d46c||0xc8;return function(_0x8771fa){if(_0x8771fa){return _0x327f83['status'](_0x46d46c)[_0x694e('0x1d')](_0x8771fa);}};}function respondWithFilteredResult(_0x414a6c,_0x40b5bd){return function(_0x38966f){if(_0x38966f){var _0x2a332b=typeof _0x40b5bd[_0x694e('0x1e')]===_0x694e('0x1f')&&typeof _0x40b5bd[_0x694e('0x20')]===_0x694e('0x1f');var _0x42a46c=_0x38966f[_0x694e('0x21')];var _0x4ef505=_0x2a332b?0x0:_0x40b5bd[_0x694e('0x1e')];var _0x4b5c54=_0x2a332b?_0x38966f[_0x694e('0x21')]:_0x40b5bd[_0x694e('0x1e')]+_0x40b5bd['limit'];var _0x3982d5;if(_0x4b5c54>=_0x42a46c){_0x4b5c54=_0x42a46c;_0x3982d5=0xc8;}else{_0x3982d5=0xce;}_0x414a6c[_0x694e('0x1b')](_0x3982d5);return _0x414a6c[_0x694e('0x22')](_0x694e('0x23'),_0x4ef505+'-'+_0x4b5c54+'/'+_0x42a46c)[_0x694e('0x1d')](_0x38966f);}return null;};}function patchUpdates(_0x308e24){return function(_0x2bb6dc){try{jsonpatch[_0x694e('0x24')](_0x2bb6dc,_0x308e24,!![]);}catch(_0x562ef3){return BPromise[_0x694e('0x25')](_0x562ef3);}return _0x2bb6dc[_0x694e('0x26')]();};}function saveUpdates(_0x508b9b,_0x5e2332){return function(_0x436579){if(_0x436579){return _0x436579[_0x694e('0x27')](_0x508b9b)['then'](function(_0x1e8647){return _0x1e8647;});}return null;};}function removeEntity(_0x2f6984,_0x389a5a){return function(_0x275486){if(_0x275486){return _0x275486[_0x694e('0x28')]()[_0x694e('0x29')](function(){_0x2f6984[_0x694e('0x1b')](0xcc)[_0x694e('0x1c')]();});}};}function handleEntityNotFound(_0x5bd749,_0x315ef3){return function(_0x3ef315){if(!_0x3ef315){_0x5bd749[_0x694e('0x1a')](0x194);}return _0x3ef315;};}function handleError(_0x34690a,_0xbce4e7){_0xbce4e7=_0xbce4e7||0x1f4;return function(_0x3fe22a){logger['error'](_0x3fe22a[_0x694e('0x2a')]);if(_0x3fe22a['name']){delete _0x3fe22a[_0x694e('0x2b')];}_0x34690a[_0x694e('0x1b')](_0xbce4e7)[_0x694e('0x2c')](_0x3fe22a);};}exports['index']=function(_0x1a3ec5,_0x5a59cf){var _0x548094={},_0x3771f4={},_0x44c8d1={'count':0x0,'rows':[]};var _0xd0a3ff=_['map'](db[_0x694e('0x2d')]['rawAttributes'],function(_0x1fb642){return{'name':_0x1fb642[_0x694e('0x2e')],'type':_0x1fb642['type'][_0x694e('0x2f')]};});_0x3771f4[_0x694e('0x30')]=_[_0x694e('0x31')](_0xd0a3ff,_0x694e('0x2b'));_0x3771f4['query']=_[_0x694e('0x32')](_0x1a3ec5['query']);_0x3771f4[_0x694e('0x33')]=_[_0x694e('0x34')](_0x3771f4[_0x694e('0x30')],_0x3771f4['query']);_0x548094[_0x694e('0x35')]=_[_0x694e('0x34')](_0x3771f4[_0x694e('0x30')],qs[_0x694e('0x36')](_0x1a3ec5[_0x694e('0x37')][_0x694e('0x36')]));_0x548094[_0x694e('0x35')]=_0x548094[_0x694e('0x35')]['length']?_0x548094[_0x694e('0x35')]:_0x3771f4[_0x694e('0x30')];if(!_0x1a3ec5[_0x694e('0x37')][_0x694e('0x38')]('nolimit')){_0x548094[_0x694e('0x20')]=qs[_0x694e('0x20')](_0x1a3ec5[_0x694e('0x37')][_0x694e('0x20')]);_0x548094[_0x694e('0x1e')]=qs[_0x694e('0x1e')](_0x1a3ec5[_0x694e('0x37')][_0x694e('0x1e')]);}_0x548094[_0x694e('0x39')]=qs['sort'](_0x1a3ec5['query'][_0x694e('0x3a')]);_0x548094[_0x694e('0x3b')]=qs[_0x694e('0x33')](_[_0x694e('0x3c')](_0x1a3ec5[_0x694e('0x37')],_0x3771f4['filters']),_0xd0a3ff);if(_0x1a3ec5[_0x694e('0x37')][_0x694e('0x3d')]){_0x548094[_0x694e('0x3b')]=_[_0x694e('0x3e')](_0x548094[_0x694e('0x3b')],{'$or':_[_0x694e('0x31')](_0xd0a3ff,function(_0x33d53c){if(_0x33d53c[_0x694e('0x3f')]!==_0x694e('0x40')){var _0x4a16ab={};_0x4a16ab[_0x33d53c[_0x694e('0x2b')]]={'$like':'%'+_0x1a3ec5['query'][_0x694e('0x3d')]+'%'};return _0x4a16ab;}})});}_0x548094=_['merge']({},_0x548094,_0x1a3ec5[_0x694e('0x41')]);var _0x80607e={'where':_0x548094[_0x694e('0x3b')]};return db['UserProfile'][_0x694e('0x21')](_0x80607e)[_0x694e('0x29')](function(_0x150201){_0x44c8d1[_0x694e('0x21')]=_0x150201;if(_0x1a3ec5[_0x694e('0x37')][_0x694e('0x42')]){_0x548094['include']=[{'all':!![]}];}return db[_0x694e('0x2d')]['findAll'](_0x548094);})['then'](function(_0x5aff61){_0x44c8d1[_0x694e('0x43')]=_0x5aff61;return _0x44c8d1;})[_0x694e('0x29')](respondWithFilteredResult(_0x5a59cf,_0x548094))[_0x694e('0x44')](handleError(_0x5a59cf,null));};exports[_0x694e('0x45')]=function(_0x13039d,_0x5e9fbc){var _0x357599={'raw':![],'where':{'id':_0x13039d[_0x694e('0x46')]['id']}},_0x29ecce={};_0x29ecce[_0x694e('0x30')]=_[_0x694e('0x32')](db[_0x694e('0x2d')][_0x694e('0x47')]);_0x29ecce[_0x694e('0x37')]=_['keys'](_0x13039d['query']);_0x29ecce[_0x694e('0x33')]=_[_0x694e('0x34')](_0x29ecce[_0x694e('0x30')],_0x29ecce['query']);_0x357599[_0x694e('0x35')]=_[_0x694e('0x34')](_0x29ecce[_0x694e('0x30')],qs[_0x694e('0x36')](_0x13039d[_0x694e('0x37')][_0x694e('0x36')]));_0x357599[_0x694e('0x35')]=_0x357599[_0x694e('0x35')]['length']?_0x357599[_0x694e('0x35')]:_0x29ecce[_0x694e('0x30')];if(_0x13039d[_0x694e('0x37')]['includeAll']){_0x357599[_0x694e('0x48')]=[{'all':!![]}];}_0x357599=_[_0x694e('0x3e')]({},_0x357599,_0x13039d[_0x694e('0x41')]);return db[_0x694e('0x2d')]['find'](_0x357599)[_0x694e('0x29')](handleEntityNotFound(_0x5e9fbc,null))[_0x694e('0x29')](respondWithResult(_0x5e9fbc,null))[_0x694e('0x44')](handleError(_0x5e9fbc,null));};exports['create']=function(_0x131851,_0xdfa0dd){return db[_0x694e('0x2d')]['create'](_0x131851[_0x694e('0x49')],{})[_0x694e('0x29')](respondWithResult(_0xdfa0dd,0xc9))[_0x694e('0x44')](handleError(_0xdfa0dd,null));};exports[_0x694e('0x4a')]=function(_0x537e23,_0x529ee0){var _0x1c5cce={'where':{'id':_0x537e23[_0x694e('0x46')]['id']}},_0x46236c={};_0x46236c[_0x694e('0x30')]=_[_0x694e('0x32')](db[_0x694e('0x2d')][_0x694e('0x47')]);_0x1c5cce[_0x694e('0x35')]=_[_0x694e('0x34')](_0x46236c[_0x694e('0x30')],qs[_0x694e('0x36')](_0x537e23[_0x694e('0x37')][_0x694e('0x36')]));_0x1c5cce[_0x694e('0x35')]=_0x1c5cce['attributes'][_0x694e('0x4b')]?_0x1c5cce[_0x694e('0x35')]:_0x46236c[_0x694e('0x30')];if(_0x537e23[_0x694e('0x37')][_0x694e('0x42')]){_0x1c5cce[_0x694e('0x48')]=[{'all':!![]}];}_0x1c5cce=_[_0x694e('0x3e')]({},_0x1c5cce,_0x537e23[_0x694e('0x41')]);return db[_0x694e('0x2d')][_0x694e('0x4c')](_0x1c5cce)[_0x694e('0x29')](handleEntityNotFound(_0x529ee0,null))[_0x694e('0x29')](function(_0x28d4f6){if(_0x28d4f6){var _0x272a3f=_0x28d4f6[_0x694e('0x4d')]({'plain':!![]});_0x272a3f=qs[_0x694e('0x4e')](_0x272a3f,['id',_0x694e('0x4f'),'updatedAt',_0x694e('0x50')]);_0x537e23[_0x694e('0x49')]=_[_0x694e('0x4e')](_0x537e23[_0x694e('0x49')],['id',_0x694e('0x4f'),'updatedAt']);return db[_0x694e('0x51')][_0x694e('0x52')](function(_0x5758e4){return db['UserProfile']['create'](_['merge'](_0x272a3f,_0x537e23[_0x694e('0x49')]),{'include':_0x537e23['query'][_0x694e('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x5758e4})[_0x694e('0x29')](function(_0x497d2c){var _0x4575ef=_0x497d2c[_0x694e('0x4d')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x537e23[_0x694e('0x46')]['id']},'raw':!![]})['then'](function(_0x5a171c){if(_0x5a171c){return BPromise['each'](_0x5a171c,function(_0x208973){return new BPromise(function(_0x54ca88,_0x813b94){if(_0x208973[_0x694e('0x53')]===null||_0x208973[_0x694e('0x53')]===0x1)_0x54ca88(null);return db['UserProfileResource'][_0x694e('0x54')]({'where':{'sectionId':_0x208973['id']},'raw':!![]})[_0x694e('0x29')](function(_0x1cba5f){var _0x26540c=_[_0x694e('0x31')](_0x1cba5f,function(_0x987358){return qs[_0x694e('0x4e')](_0x987358,['id',_0x694e('0x4f'),_0x694e('0x55'),'sectionId']);});_0x54ca88(_0x26540c);})[_0x694e('0x44')](function(_0x2d8da2){_0x813b94(_0x2d8da2);});})[_0x694e('0x29')](function(_0x122890){var _0x4b0240=qs[_0x694e('0x4e')](_0x208973,['id','createdAt',_0x694e('0x55')]);_0x4b0240[_0x694e('0x56')]=_0x4575ef['id'];if(_0x122890)_0x4b0240[_0x694e('0x57')]=_0x122890;return _0x4b0240;})['then'](function(_0x364a53){return db[_0x694e('0x58')]['create'](_0x364a53,{'include':[{'model':db[_0x694e('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x5758e4});});})['then'](function(){return _0x4575ef;});}});});});}})[_0x694e('0x29')](respondWithResult(_0x529ee0,0xc9))['catch'](handleError(_0x529ee0,null));};exports[_0x694e('0x27')]=function(_0x59652e,_0x33b81d){if(_0x59652e['body']['id']){delete _0x59652e['body']['id'];}return db['UserProfile'][_0x694e('0x4c')]({'where':{'id':_0x59652e[_0x694e('0x46')]['id']}})[_0x694e('0x29')](handleEntityNotFound(_0x33b81d,null))['then'](saveUpdates(_0x59652e['body'],null))[_0x694e('0x29')](respondWithResult(_0x33b81d,null))[_0x694e('0x44')](handleError(_0x33b81d,null));};exports[_0x694e('0x28')]=function(_0x4addb0,_0x1122a3){return db[_0x694e('0x2d')][_0x694e('0x4c')]({'where':{'id':_0x4addb0[_0x694e('0x46')]['id']}})[_0x694e('0x29')](handleEntityNotFound(_0x1122a3,null))[_0x694e('0x29')](removeEntity(_0x1122a3,null))[_0x694e('0x44')](handleError(_0x1122a3,null));};exports['describe']=function(_0x1c579f,_0x16515f){return db[_0x694e('0x2d')][_0x694e('0x5a')]()['then'](respondWithResult(_0x16515f,null))[_0x694e('0x44')](handleError(_0x16515f,null));};exports[_0x694e('0x5b')]=function(_0x505ff2,_0x599adf){var _0x1b891b=_0x505ff2[_0x694e('0x49')];return db[_0x694e('0x2d')]['find']({'where':{'id':_0x505ff2[_0x694e('0x46')]['id']}})[_0x694e('0x29')](handleEntityNotFound(_0x599adf,null))[_0x694e('0x29')](function(_0x568978){if(_0x568978){return db[_0x694e('0x51')][_0x694e('0x52')](function(_0x23cbbc){return db[_0x694e('0x58')][_0x694e('0x28')]({'where':{'userProfileId':_0x505ff2[_0x694e('0x46')]['id'],'sectionId':_[_0x694e('0x31')](_0x1b891b,function(_0x4b604f){return _0x4b604f[_0x694e('0x5c')];})},'transaction':_0x23cbbc})['then'](function(){var _0x55217b=_[_0x694e('0x31')](_0x1b891b,function(_0x532dc0){_0x532dc0[_0x694e('0x56')]=_0x505ff2['params']['id'];return _0x532dc0;});var _0xb0088a=[];return BPromise[_0x694e('0x5d')](_0x55217b,function(_0x51acb5){return db[_0x694e('0x58')]['create'](_0x51acb5,{'include':[{'model':db[_0x694e('0x59')],'as':_0x694e('0x57')}],'raw':!![],'transaction':_0x23cbbc})[_0x694e('0x29')](function(_0x3860ce){_0xb0088a[_0x694e('0x5e')](_0x3860ce['get']({'plain':!![]}));});})[_0x694e('0x29')](function(){return _0xb0088a;});});});}})[_0x694e('0x29')](function(_0x48cc11){return _0x48cc11;})[_0x694e('0x29')](respondWithResult(_0x599adf,null))['catch'](handleError(_0x599adf,null));};exports[_0x694e('0x5f')]=function(_0x25c558,_0x292d2e){var _0x372827;return db['UserProfile']['find']({'where':{'id':_0x25c558[_0x694e('0x46')]['id']},'attributes':['id',_0x694e('0x2b')]})[_0x694e('0x29')](handleEntityNotFound(_0x292d2e,null))[_0x694e('0x29')](function(_0x550b31){if(_0x550b31){_0x372827=_0x550b31;return db[_0x694e('0x58')]['destroy']({'where':{'userProfileId':_0x25c558[_0x694e('0x46')]['id'],'sectionId':_0x25c558[_0x694e('0x37')]['ids']}});}})['then'](function(){return _0x372827;})[_0x694e('0x29')](respondWithStatusCode(_0x292d2e,null))['catch'](handleError(_0x292d2e,null));};exports['getSections']=function(_0xae3ca,_0x100c92){var _0x43f990=[];var _0xe1b414=[];return db['UserProfileSection'][_0x694e('0x54')]({'where':{'userProfileId':_0xae3ca[_0x694e('0x46')]['id']},'raw':!![]})[_0x694e('0x29')](function(_0x933bf8){_0x43f990=_['filter'](_0x933bf8,function(_0x2bfe29){return _0x2bfe29[_0x694e('0x60')]===0x1||_[_0x694e('0x61')]([0x3eb,0x709],_0x2bfe29['sectionId']);});if(!_[_0x694e('0x62')](_0x43f990)){return _[_0x694e('0x31')](_0x43f990,function(_0x4bb0d9){return _0x4bb0d9[_0x694e('0x5c')];});}else{return;}})['then'](function(_0x498718){if(_0x498718)_0xe1b414=_0x498718;if(_[_0x694e('0x61')](_0xe1b414,0x64)){var _0x24b7b1=_[_0x694e('0x4c')](_0x43f990,{'sectionId':0x64});return hasDefaultDashboard(_0x24b7b1)[_0x694e('0x29')](function(_0x3df96e){return _[_0x694e('0x31')](_0x43f990,function(_0x4286d8){if(_0x4286d8['sectionId']===0x64){_0x4286d8[_0x694e('0x63')]=_0x3df96e;}return _0x4286d8;});});}else{return;}})[_0x694e('0x29')](function(_0x44f74c){if(_0x44f74c)_0x43f990=_0x44f74c;if(_[_0x694e('0x61')](_0xe1b414,0x3eb)){var _0x24cf44=_[_0x694e('0x4c')](_0x43f990,{'sectionId':0x3eb});return getCustomDashboards(_0x24cf44)[_0x694e('0x29')](function(_0x482ca1){return _[_0x694e('0x31')](_0x43f990,function(_0x48346b){if(_0x24cf44[_0x694e('0x60')]){if(_0x48346b[_0x694e('0x5c')]===0x3eb){_0x48346b[_0x694e('0x63')]=_0x482ca1;}}else{if(_0x48346b[_0x694e('0x5c')]===0x64){_0x48346b['subsections']=_0x482ca1;}}return _0x48346b;});});}else{return;}})[_0x694e('0x29')](function(_0x1f18fe){if(_0x1f18fe)_0x43f990=_0x1f18fe;if(_[_0x694e('0x61')](_0xe1b414,0x709)){var _0x433916=_['find'](_0x43f990,{'sectionId':0x709});return getPlugins(_0x433916)['then'](function(_0xf39b77){if(_0x433916[_0x694e('0x60')]){return _[_0x694e('0x31')](_0x43f990,function(_0xcba0c5){if(_0xcba0c5['sectionId']===0x709){_0xcba0c5[_0x694e('0x63')]=_0xf39b77;}return _0xcba0c5;});}else{var _0x32a45b={'sectionId':0x76c,'enabled':0x1,'subsections':_0xf39b77};var _0x5645d4=_[_0x694e('0x31')](_0x43f990);_0x5645d4[_0x694e('0x5e')](_0x32a45b);return _0x5645d4;}});}else{return;}})[_0x694e('0x29')](function(_0x32c03e){if(_0x32c03e)_0x43f990=_0x32c03e;return _['filter'](_0x43f990,['enabled',0x1]);})[_0x694e('0x29')](respondWithResult(_0x100c92,null))[_0x694e('0x44')](handleError(_0x100c92,null));};function hasDefaultDashboard(_0x53f2f8){var _0x4bd7f9=[0x65];return new BPromise(function(_0x4219be,_0x4be9bf){try{if(_0x53f2f8[_0x694e('0x53')]){_0x4219be(_0x4bd7f9);}else{return db[_0x694e('0x59')][_0x694e('0x64')]({'where':{'sectionId':_0x53f2f8['id']},'raw':!![]})[_0x694e('0x29')](function(_0x2d8ba9){_0x2d8ba9?_0x4219be(_0x4bd7f9):_0x4219be();});}}catch(_0x403704){_0x4be9bf(_0x403704);}});}function getCustomDashboards(_0x35bf3c){var _0x150f81=[];return new BPromise(function(_0x26525e,_0x5a3cf6){try{if(_0x35bf3c['autoAssociation']){return db['Dashboard'][_0x694e('0x54')]({'raw':!![]})[_0x694e('0x29')](function(_0x57bca2){_0x57bca2[_0x694e('0x65')](function(_0xee9086){_0x150f81['push'](_0xee9086['id']+0x1869f);});_0x26525e(_0x150f81);});}else{return db[_0x694e('0x59')]['findAll']({'where':{'sectionId':_0x35bf3c['id']},'raw':!![]})[_0x694e('0x29')](function(_0x1c12e7){_0x1c12e7[_0x694e('0x65')](function(_0x7af61d){_0x150f81['push'](_0x7af61d[_0x694e('0x66')]+0x1869f);});_0x26525e(_0x150f81);});}}catch(_0xb1967){_0x5a3cf6(_0xb1967);}});}function getPlugins(_0x32a9ab){var _0x183e52=[];return new BPromise(function(_0x197079,_0x79fda){try{if(_0x32a9ab[_0x694e('0x53')]){return db['Plugin']['findAll']({'raw':!![]})['then'](function(_0x52a13d){_0x52a13d[_0x694e('0x65')](function(_0x2211d8){_0x183e52['push'](_0x2211d8['id']+0x15b38);});_0x197079(_0x183e52);});}else{return db[_0x694e('0x59')][_0x694e('0x54')]({'where':{'sectionId':_0x32a9ab['id']},'raw':!![]})[_0x694e('0x29')](function(_0x441225){_0x441225['forEach'](function(_0x246512){_0x183e52[_0x694e('0x5e')](_0x246512[_0x694e('0x66')]+0x15b38);});_0x197079(_0x183e52);});}}catch(_0x49e15e){_0x79fda(_0x49e15e);}});}exports[_0x694e('0x67')]=function(_0x2cf553,_0x227f11){return db[_0x694e('0x2d')][_0x694e('0x4c')]({'where':{'id':_0x2cf553[_0x694e('0x46')]['id']}})[_0x694e('0x29')](handleEntityNotFound(_0x227f11,null))[_0x694e('0x29')](function(_0x37740c){if(_0x37740c){return db[_0x694e('0x51')]['transaction'](function(_0xfcf156){return db[_0x694e('0x58')][_0x694e('0x54')]({'where':{'userProfileId':_0x2cf553[_0x694e('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0x694e('0x29')](function(_0x8aef66){if(_0x8aef66){return db[_0x694e('0x58')][_0x694e('0x28')]({'where':{'userProfileId':_0x2cf553[_0x694e('0x46')]['id'],'id':_['map'](_0x8aef66,function(_0x1605eb){return _0x1605eb['id'];})},'transaction':_0xfcf156});}})[_0x694e('0x29')](function(_0x685d2a){var _0x2d7c48=_[_0x694e('0x31')](_0x2cf553[_0x694e('0x49')],function(_0x223143){_0x223143['userProfileId']=_0x2cf553[_0x694e('0x46')]['id'];return _0x223143;});return db[_0x694e('0x58')][_0x694e('0x68')](_0x2d7c48,{'raw':!![],'transaction':_0xfcf156});})[_0x694e('0x29')](function(_0x1d1d20){var _0x4bb91a=_[_0x694e('0x3d')](_['map'](_0x1d1d20,function(_0x20fa45){return _0x20fa45['get']({'plain':!![]});}),{'includeAll':![]});if(_0x4bb91a){return db[_0x694e('0x58')][_0x694e('0x54')]({'where':{'userProfileId':_0x2cf553['params']['id'],'sectionId':_[_0x694e('0x31')](_0x4bb91a,function(_0x5fb735){return _0x5fb735['sectionId'];})},'attributes':['id',_0x694e('0x5c')],'raw':!![]})['then'](function(_0x2e8b0c){var _0x2f857c=_['map'](_0x2cf553[_0x694e('0x49')],function(_0x2db415){_0x2db415[_0x694e('0x56')]=_0x2cf553[_0x694e('0x46')]['id'];return _0x2db415;});return db[_0x694e('0x59')][_0x694e('0x68')](_0x2f857c,{'raw':!![],'transaction':_0xfcf156});});}})[_0x694e('0x44')](handleError(_0x227f11,null));});}})[_0x694e('0x29')](function(_0x4da862){var _0x320ed0=_[_0x694e('0x31')](_0x4da862,function(_0xcb0223){return _0xcb0223[_0x694e('0x4d')]({'plain':!![]});});})['then'](respondWithResult(_0x227f11,null))['catch'](handleError(_0x227f11,null));};exports['removeResources']=function(_0x16d192,_0x51b0fe,_0x452431){return db[_0x694e('0x2d')][_0x694e('0x4c')]({'where':{'id':_0x16d192[_0x694e('0x46')]['id']}})[_0x694e('0x29')](handleEntityNotFound(_0x51b0fe,null))['then'](function(_0x42a878){if(_0x42a878){return _0x42a878['removeResources'](_0x16d192[_0x694e('0x37')][_0x694e('0x69')]);}})[_0x694e('0x29')](respondWithStatusCode(_0x51b0fe,null))['catch'](handleError(_0x51b0fe,null));};exports[_0x694e('0x6a')]=function(_0x4e8e11,_0x1602e1){var _0x80e166={};if(!_0x4e8e11[_0x694e('0x37')][_0x694e('0x6b')])throw new Error(_0x694e('0x6c'));if(!_0x4e8e11[_0x694e('0x37')][_0x694e('0x38')](_0x694e('0x6d'))){_0x80e166[_0x694e('0x20')]=qs['limit'](_0x4e8e11[_0x694e('0x37')]['limit']);_0x80e166['offset']=qs[_0x694e('0x1e')](_0x4e8e11[_0x694e('0x37')]['offset']);}return db['UserProfile'][_0x694e('0x4c')]({'where':{'id':_0x4e8e11['params']['id']}})[_0x694e('0x29')](function(_0x162821){if(!_0x162821)throw new Error(_0x694e('0x6e')+_0x4e8e11[_0x694e('0x46')]['id']);return db[_0x694e('0x2d')][_0x694e('0x6a')](_0x4e8e11);})[_0x694e('0x29')](respondWithFilteredResult(_0x1602e1,_0x80e166))['catch'](handleError(_0x1602e1,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 40e873b..7236b36 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 _0x77a9=['hasOwnProperty','events','UserProfile','save','update','remove','emit'];(function(_0x482eea,_0x1bc204){var _0x5a69b9=function(_0x32c137){while(--_0x32c137){_0x482eea['push'](_0x482eea['shift']());}};_0x5a69b9(++_0x1bc204);}(_0x77a9,0x19e));var _0x977a=function(_0x329032,_0xb4599a){_0x329032=_0x329032-0x0;var _0x1e2be8=_0x77a9[_0x329032];return _0x1e2be8;};'use strict';var EventEmitter=require(_0x977a('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x977a('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x977a('0x2'),'afterUpdate':_0x977a('0x3'),'afterDestroy':_0x977a('0x4')};function emitEvent(_0x368664){return function(_0x520cd7,_0x318fc8,_0xb755){UserProfileEvents[_0x977a('0x5')](_0x368664+':'+_0x520cd7['id'],_0x520cd7);UserProfileEvents[_0x977a('0x5')](_0x368664,_0x520cd7);_0xb755(null);};}for(var e in events){if(events[_0x977a('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x5ae0=['emit','hasOwnProperty','exports','../../mysqldb','UserProfile','save','update'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x5ae0,0xf8));var _0x05ae=function(_0x4a75fa,_0x157827){_0x4a75fa=_0x4a75fa-0x0;var _0x2e8bb2=_0x5ae0[_0x4a75fa];return _0x2e8bb2;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x05ae('0x0'))['db'][_0x05ae('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x05ae('0x2'),'afterUpdate':_0x05ae('0x3'),'afterDestroy':'remove'};function emitEvent(_0xd7e47f){return function(_0xaae02b,_0x4aac85,_0x554b43){UserProfileEvents[_0x05ae('0x4')](_0xd7e47f+':'+_0xaae02b['id'],_0xaae02b);UserProfileEvents[_0x05ae('0x4')](_0xd7e47f,_0xaae02b);_0x554b43(null);};}for(var e in events){if(events[_0x05ae('0x5')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x05ae('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 92d93a5..3784921 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 _0x68dc=['projectName','projects','JscriptyProject','contacts','Lists','ListId','CmList','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','VoiceMail','VoiceRecording','name','membername','User','role','Telephones','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','musiconholds','chanspies','VoiceChanSpy','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','admin','user','Agents','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Dashboard','intervals','Interval','pauses','Pause','tags','Tag','templates','Template','Trigger','trunks','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','reportId','slice','Sequelize','QueryTypes','select','ui.','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','UserProfileSection','find','all','ignore','isEmpty','union','length','push','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','default','DefaultReports','custom','CustomReports','count','CmContact','color','tag','ThroughTags','rows','openTabs','true','chat','dataValues','sms','fax','mail','whatsapp','lodash','squel','exports','filter','field','associatedResources','catch','value','model','findAll','then','map','UserProfileResource','resourceId','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects'];(function(_0x67b7f8,_0x3b2cce){var _0xa0ebce=function(_0x13e076){while(--_0x13e076){_0x67b7f8['push'](_0x67b7f8['shift']());}};_0xa0ebce(++_0x3b2cce);}(_0x68dc,0x14c));var _0xc68d=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x68dc[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xc68d('0x0'));var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');var squel=require(_0xc68d('0x1'));module[_0xc68d('0x2')]=function(_0x2c3f3e){var _0x305595=_0x2c3f3e['models'];function _0x16e4b3(_0x2f325d,_0x3a2751){return new Promise(function(_0x2c296f,_0x116eb5){if(!_0x3a2751)return _0x2c296f(null);var _0x458a36=_0x3a2751[_0xc68d('0x3')]?{[_0x3a2751[_0xc68d('0x3')][_0xc68d('0x4')]]:_0x3a2751[_0xc68d('0x3')]['value']}:undefined;return _0x305595[_0x2f325d]['findAll']({'where':_0x458a36,'raw':!![]})['then'](function(_0x49e1b8){_0x3a2751[_0xc68d('0x5')]=_['map'](_0x49e1b8,'id');_0x2c296f(_0x3a2751);})[_0xc68d('0x6')](function(_0x5842f1){_0x116eb5(_0x5842f1);});});}function _0x1d19ce(_0x465f17,_0x4180bf){return new Promise(function(_0x1d4906,_0xce8444){var _0x4ce893=_0x465f17[_0xc68d('0x3')]?{[_0x465f17[_0xc68d('0x3')]['field']]:_0x465f17[_0xc68d('0x3')][_0xc68d('0x7')]}:undefined;return _0x305595[_0x465f17[_0xc68d('0x8')]][_0xc68d('0x9')]({'where':_0x4ce893,'raw':!![]})[_0xc68d('0xa')](function(_0x335ccb){_0x4180bf[_0xc68d('0x5')]=_[_0xc68d('0xb')](_0x335ccb,function(_0x2a76e1){return _0x2a76e1['name'];});_0x1d4906(_0x4180bf);})[_0xc68d('0x6')](function(_0x3672b3){_0xce8444(_0x3672b3);});});}function _0x6c5971(_0x206c2c,_0x3a5b76,_0x18a108){if(!_0x3a5b76)return Promise['resolve'](null);return new Promise(function(_0xbeceb2,_0x2630af){return _0x305595[_0xc68d('0xc')][_0xc68d('0x9')]({'where':{'sectionId':_0x3a5b76['id']},'raw':!![]})[_0xc68d('0xa')](function(_0x28c72b){if(_0x206c2c[_0xc68d('0x4')]&&_0x206c2c[_0xc68d('0x4')]!=='id'){_0x3a5b76[_0xc68d('0x5')]=_[_0xc68d('0xb')](_0x28c72b,function(_0x481c58){return _0x481c58[_0x206c2c['field']];});}else{if(_0x18a108==='AnalyticExtractedReport'){_0x3a5b76[_0xc68d('0x5')]=_[_0xc68d('0xb')](_0x28c72b,function(_0x5da60b){return{'id':_0x5da60b[_0xc68d('0xd')],'type':_0x5da60b['type']};});}else{_0x3a5b76[_0xc68d('0x5')]=_[_0xc68d('0xb')](_0x28c72b,function(_0x528ce2){return _0x528ce2[_0xc68d('0xd')];});}}_0xbeceb2(_0x3a5b76);})[_0xc68d('0x6')](function(_0x316bf5){_0x2630af(_0x316bf5);});});}function _0x38e652(_0x473197,_0xa85274){var _0x4dfc58={'parentSections':[]};switch(_0x473197['toLowerCase']()){case _0xc68d('0xe'):_0x4dfc58[_0xc68d('0xf')]='SquareProject';break;case _0xc68d('0x10'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x11');break;case _0xc68d('0x12'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x13');_0x4dfc58[_0xc68d('0x14')]=[{'name':_0xc68d('0x15'),'field':'name','foreignKey':_0xc68d('0x16')}];break;case _0xc68d('0x17'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x18');break;case _0xc68d('0x19'):_0x4dfc58[_0xc68d('0xf')]='CmContact';_0x4dfc58['parentSections']=[{'name':_0xc68d('0x1a'),'field':'id','foreignKey':_0xc68d('0x1b')}];break;case'lists':_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x1c');break;case'companies':_0x4dfc58[_0xc68d('0xf')]='CmCompany';break;case _0xc68d('0x1d'):_0x4dfc58['childModel']=_0xc68d('0x1e');break;case _0xc68d('0x1f'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x20');break;case'chatwebsites':_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x21');break;case _0xc68d('0x22'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x23');break;case'faxaccounts':_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x24');break;case _0xc68d('0x25'):case'internalroutes':case _0xc68d('0x26'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x27');break;case'contexts':_0x4dfc58[_0xc68d('0xf')]='VoiceContext';break;case'voicemails':_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x28');break;case'voicerecordings':_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x29');_0x4dfc58[_0xc68d('0x14')]=[{'name':'Agents','field':_0xc68d('0x2a'),'foreignKey':_0xc68d('0x2b'),'model':_0xc68d('0x2c'),'filter':{'field':_0xc68d('0x2d'),'value':['agent']}},{'name':_0xc68d('0x2e'),'field':_0xc68d('0x2a'),'foreignKey':'membername','model':_0xc68d('0x2c'),'filter':{'field':_0xc68d('0x2d'),'value':[_0xc68d('0x2f')]}},{'name':_0xc68d('0x30'),'field':_0xc68d('0x2a'),'foreignKey':_0xc68d('0x31'),'model':_0xc68d('0x32'),'filter':{'field':_0xc68d('0x33'),'value':[_0xc68d('0x34')]}},{'name':_0xc68d('0x35'),'field':_0xc68d('0x2a'),'foreignKey':_0xc68d('0x31'),'model':_0xc68d('0x32'),'filter':{'field':'type','value':['outbound']}}];break;case _0xc68d('0x36'):_0x4dfc58['childModel']='VoiceMusicOnHold';break;case _0xc68d('0x37'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x38');break;case'voiceprefixes':_0x4dfc58[_0xc68d('0xf')]='VoicePrefix';break;case'ivrcampaigns':_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x39');break;case _0xc68d('0x3a'):_0x4dfc58['childModel']=_0xc68d('0x3b');break;case _0xc68d('0x3c'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x3d');break;case _0xc68d('0x3e'):_0x4dfc58['childModel']='MailSubstatus';break;case'openchannelqueues':_0x4dfc58['childModel']=_0xc68d('0x3f');break;case _0xc68d('0x40'):_0x4dfc58[_0xc68d('0xf')]='OpenchannelAccount';break;case _0xc68d('0x41'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x42');break;case _0xc68d('0x43'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x44');break;case'whatsappqueues':_0x4dfc58[_0xc68d('0xf')]='WhatsappQueue';break;case _0xc68d('0x45'):_0x4dfc58['childModel']=_0xc68d('0x46');break;case _0xc68d('0x47'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x48');break;case _0xc68d('0x49'):case _0xc68d('0x4a'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x32');if(_0xa85274){_0x4dfc58['parentSections']=[{'name':'VoiceQueues'},{'name':_0xc68d('0x35')}];}break;case _0xc68d('0x4b'):case _0xc68d('0x4c'):case'telephones':_0x4dfc58['childModel']=_0xc68d('0x2c');if(_0xa85274){_0x4dfc58['parentSections']=[{'name':'Users','filter':{'field':_0xc68d('0x2d'),'value':[_0xc68d('0x4d'),_0xc68d('0x4e')]},'ignore':!![]},{'name':_0xc68d('0x4f')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x4dfc58['childModel']=_0xc68d('0x50');break;case _0xc68d('0x51'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x52');break;case _0xc68d('0x53'):_0x4dfc58[_0xc68d('0xf')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x54');break;case _0xc68d('0x55'):_0x4dfc58['childModel']='DeskAccount';break;case _0xc68d('0x56'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x57');break;case _0xc68d('0x58'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x2c');break;case _0xc68d('0x59'):_0x4dfc58['childModel']=_0xc68d('0x5a');break;case _0xc68d('0x5b'):_0x4dfc58[_0xc68d('0xf')]='Disposition';break;case'customdashboards':_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x5c');break;case _0xc68d('0x5d'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x5e');break;case _0xc68d('0x5f'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x60');break;case'scheduler':_0x4dfc58[_0xc68d('0xf')]='Schedule';break;case'sounds':_0x4dfc58[_0xc68d('0xf')]='Sound';break;case _0xc68d('0x61'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x62');break;case _0xc68d('0x63'):_0x4dfc58['childModel']=_0xc68d('0x64');break;case'triggers':_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x65');break;case _0xc68d('0x66'):_0x4dfc58[_0xc68d('0xf')]='Trunk';break;case _0xc68d('0x67'):_0x4dfc58['childModel']=_0xc68d('0x68');break;case _0xc68d('0x69'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x6a');break;case _0xc68d('0x6b'):_0x4dfc58[_0xc68d('0xf')]=_0xc68d('0x6c');_0x4dfc58[_0xc68d('0x14')]=[{'name':'Reports','field':'id','foreignKey':_0xc68d('0x6d')}];break;case'metrics':_0x4dfc58[_0xc68d('0xf')]='AnalyticMetric';break;}return _0x4dfc58;}function _0x5ee752(_0x10f028,_0x1e0afd){var _0x397f34=_0x10f028['charAt'](0x0)['toUpperCase']()+_0x10f028[_0xc68d('0x6e')](0x1);var _0x1634de={'type':_0x305595[_0xc68d('0x6f')][_0xc68d('0x70')]['SELECT'],'raw':!![]};return new Promise(function(_0x2bd31c,_0x4873ee){var _0x1d4ebf=squel[_0xc68d('0x71')]()['field'](_0xc68d('0x72')+_0x397f34+'InteractionId','id')[_0xc68d('0x4')](_0xc68d('0x73'))[_0xc68d('0x74')](_0xc68d('0x75')+_0x10f028+_0xc68d('0x76'),'ui')[_0xc68d('0x77')](_0xc68d('0x78'),_0x1e0afd['id']);return _0x305595[_0xc68d('0x79')][_0xc68d('0x7a')](_0x1d4ebf['toString'](),_0x1634de)[_0xc68d('0xa')](function(_0x5e26b4){_0x1e0afd[_0x397f34+'OpenTabs']=_0x5e26b4;_0x2bd31c(_0x5e26b4);})[_0xc68d('0x6')](function(_0x2fbd23){_0x4873ee(_0x2fbd23);});});}return _0x2c3f3e[_0xc68d('0x7b')](_0xc68d('0x7c'),attributes,{'tableName':_0xc68d('0x7d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2a06d8){var _0x547b07={'raw':_0x2a06d8[_0xc68d('0x7a')][_0xc68d('0x7e')],'where':{}};var _0x29ca3f={};var _0x27554f={'count':0x0,'rows':[]};var _0x3b6608=_0x2a06d8[_0xc68d('0x7a')][_0xc68d('0x7f')];var _0x3bf3f2=_0x2a06d8[_0xc68d('0x7a')][_0xc68d('0x80')]||![];var _0x264745=_0x38e652(_0x3b6608,_0x3bf3f2);if(!_0x264745[_0xc68d('0xf')])throw new Error(_0xc68d('0x81')+_0x3b6608+'\x27');var _0xed75d7=[{'name':_0x3b6608}];if(!_['isEmpty'](_0x264745[_0xc68d('0x14')]))_0xed75d7=_0x264745[_0xc68d('0x14')];var _0x583533=[];for(var _0x13a780=0x0;_0x13a780<_0xed75d7['length'];_0x13a780++){_0x583533['push'](_0x305595[_0xc68d('0x82')][_0xc68d('0x83')]({'where':{'userProfileId':_0x2a06d8['params']['id'],'name':_0xed75d7[_0x13a780]['name']},'raw':!![]}));}return Promise[_0xc68d('0x84')](_0x583533)[_0xc68d('0xa')](function(_0x1a3580){var _0x1d0bee=_[_0xc68d('0x3')](_0x1a3580,function(_0x456435){return _0x456435?_0x456435:undefined;});var _0x27ce46=_['filter'](_0xed75d7,[_0xc68d('0x85'),!![]]);var _0x45ef0a=_[_0xc68d('0x86')](_0x1d0bee)&&_['isEmpty'](_0x27ce46)?null:_[_0xc68d('0x87')](_0x27ce46,_0x1d0bee);if(!_0x45ef0a)return null;var _0x569ae8=[];for(var _0x33022b=0x0;_0x33022b<_0x45ef0a[_0xc68d('0x88')];_0x33022b++){var _0x347951=_['find'](_0xed75d7,function(_0x304688){return _0x45ef0a[_0x33022b]?_0x304688[_0xc68d('0x2a')]===_0x45ef0a[_0x33022b][_0xc68d('0x2a')]:null;});if(_0x347951){if(_0x45ef0a[_0x33022b][_0xc68d('0x85')]){_0x569ae8[_0xc68d('0x89')](_0x16e4b3(_0x264745[_0xc68d('0xf')],_0x45ef0a[_0x33022b]));}else{if(!_0x45ef0a[_0x33022b][_0xc68d('0x8a')]){_0x569ae8[_0xc68d('0x89')](_0x6c5971(_0x347951,_0x45ef0a[_0x33022b],_0x264745[_0xc68d('0xf')]));}else{if(_0x347951[_0xc68d('0x8')]){_0x569ae8[_0xc68d('0x89')](_0x1d19ce(_0x347951,_0x45ef0a[_0x33022b]));}}}}}return Promise[_0xc68d('0x84')](_0x569ae8);})[_0xc68d('0xa')](function(_0x43748a){var _0x345324=_0x43748a;var _0x1b010f=null;if(_0x345324){_0x1b010f=_0x345324[_0xc68d('0x88')]===0x1?_0x345324[0x0]:null;}if(!_0x1b010f&&!_0x345324)return _0x27554f;var _0xd577=_0x305595[_0x264745[_0xc68d('0xf')]][_0xc68d('0x8b')];_0x29ca3f[_0xc68d('0x8')]=_['keys'](_0xd577);_0x29ca3f[_0xc68d('0x7a')]=_[_0xc68d('0x8c')](_0x2a06d8[_0xc68d('0x7a')]);_0x29ca3f[_0xc68d('0x8d')]=_[_0xc68d('0x8e')](_0x29ca3f[_0xc68d('0x8')],_0x29ca3f[_0xc68d('0x7a')]);_0x547b07['attributes']=_[_0xc68d('0x8e')](_0x29ca3f[_0xc68d('0x8')],qs[_0xc68d('0x8f')](_0x2a06d8['query'][_0xc68d('0x8f')]));_0x547b07[_0xc68d('0x90')]=_0x547b07[_0xc68d('0x90')]['length']?_0x547b07[_0xc68d('0x90')]:_0x29ca3f['model'];if(!_0x2a06d8['query'][_0xc68d('0x91')]('nolimit')){_0x547b07[_0xc68d('0x92')]=qs['limit'](_0x2a06d8[_0xc68d('0x7a')][_0xc68d('0x92')]);_0x547b07[_0xc68d('0x93')]=qs[_0xc68d('0x93')](_0x2a06d8[_0xc68d('0x7a')][_0xc68d('0x93')]);}_0x547b07[_0xc68d('0x94')]=qs[_0xc68d('0x95')](_0x2a06d8['query'][_0xc68d('0x95')]);_0x547b07['where']=qs['filters'](_[_0xc68d('0x96')](_0x2a06d8[_0xc68d('0x7a')],_0x29ca3f[_0xc68d('0x8d')]));if(_0x2a06d8['query']['filter']){_0x547b07[_0xc68d('0x77')]=_[_0xc68d('0x97')](_0x547b07[_0xc68d('0x77')],{'$or':_['map'](_0xd577,function(_0x193db9){if(_0x193db9[_0xc68d('0x33')][_0xc68d('0x98')]!==_0xc68d('0x99')){var _0x3a78ca={};_0x3a78ca[_0x193db9[_0xc68d('0x4')]]={'$like':'%'+_0x2a06d8[_0xc68d('0x7a')][_0xc68d('0x3')]+'%'};return _0x3a78ca;}})});}var _0x2a2c84=[];var _0x58ab82=null;var _0x5bbc13={};if(_0x1b010f){_0x58ab82=_[_0xc68d('0x83')](_0xed75d7,[_0xc68d('0x2a'),_0x1b010f['name']]);if(_0x58ab82[_0xc68d('0x4')]){_0x5bbc13={};if(_0x264745[_0xc68d('0xf')]===_0xc68d('0x6c')){_0x5bbc13[_0x58ab82[_0xc68d('0x9a')]]=_[_0xc68d('0xb')](_0x1b010f[_0xc68d('0x5')],'id');}else{_0x5bbc13[_0x58ab82[_0xc68d('0x9a')]]=_0x1b010f[_0xc68d('0x5')];}_0x2a2c84['push'](_0x5bbc13);}else{_0x547b07[_0xc68d('0x77')]['id']=_0x1b010f[_0xc68d('0x5')];}}else{for(var _0x4bbc1a=0x0;_0x4bbc1a<_0x345324['length'];_0x4bbc1a++){_0x58ab82=_[_0xc68d('0x83')](_0xed75d7,['name',_0x345324[_0x4bbc1a]['name']]);if(_0x58ab82[_0xc68d('0x4')]){_0x5bbc13={};_0x5bbc13[_0x58ab82[_0xc68d('0x9a')]]=_0x345324[_0x4bbc1a]['associatedResources'];_0x2a2c84[_0xc68d('0x89')](_0x5bbc13);}else{if(!_0x547b07[_0xc68d('0x77')]['id'])_0x547b07[_0xc68d('0x77')]['id']=[];_0x345324[_0x4bbc1a][_0xc68d('0x5')][_0xc68d('0x9b')](function(_0x3b6c87){_0x547b07['where']['id'][_0xc68d('0x89')](_0x3b6c87);});}}}if(!_[_0xc68d('0x86')](_0x2a2c84)){_0x547b07[_0xc68d('0x77')]=_[_0xc68d('0x97')](_0x547b07['where'],{'$and':{'$or':_0x2a2c84}});}_0x547b07=_[_0xc68d('0x97')]({},_0x547b07,_0x2a06d8[_0xc68d('0x9c')]);if(_0x1b010f&&!_0x1b010f[_0xc68d('0x8a')]&&_0x264745[_0xc68d('0xf')]===_0xc68d('0x6c')){if(_0x2a06d8['query'][_0xc68d('0x9d')]){_0x547b07[_0xc68d('0x9e')]=[{'all':!![]}];}return _0x305595[_0x264745[_0xc68d('0xf')]]['findAll'](_0x547b07)[_0xc68d('0xa')](function(_0x25d9fb){var _0x270239=[];_0x25d9fb[_0xc68d('0x9b')](function(_0x4c826f){var _0x5c181d;switch(_0x4c826f['reportType']){case _0xc68d('0x9f'):_0x5c181d=_['find'](_0x1b010f[_0xc68d('0x5')],function(_0x4ce0db){return _0x4ce0db['id']===_0x4c826f[_0xc68d('0x6d')]&&_0x4ce0db[_0xc68d('0x33')]===_0xc68d('0xa0');});break;case _0xc68d('0xa1'):_0x5c181d=_[_0xc68d('0x83')](_0x1b010f['associatedResources'],function(_0x4feb9){return _0x4feb9['id']===_0x4c826f['reportId']&&_0x4feb9[_0xc68d('0x33')]===_0xc68d('0xa2');});break;}if(_0x5c181d)_0x270239[_0xc68d('0x89')](_0x4c826f);});_0x27554f[_0xc68d('0xa3')]=_0x270239['length'];_0x27554f['rows']=_0x270239;return _0x27554f;});}else{return _0x305595[_0x264745['childModel']][_0xc68d('0xa3')]({'where':_0x547b07[_0xc68d('0x77')]})[_0xc68d('0xa')](function(_0x417362){_0x27554f[_0xc68d('0xa3')]=_0x417362;if(_0x2a06d8[_0xc68d('0x7a')]['includeAll']){if(_0x264745['childModel']===_0xc68d('0xa4')){_0x547b07[_0xc68d('0x9e')]=[{'model':_0x305595['Tag'],'as':'Tags','attributes':['id','name',_0xc68d('0xa5')],'required':_0x2a06d8[_0xc68d('0x7a')][_0xc68d('0xa6')]?!![]:![]},{'model':_0x305595['Tag'],'as':_0xc68d('0xa7'),'attributes':['id',_0xc68d('0x2a'),_0xc68d('0xa5')],'through':_0x2a06d8['query'][_0xc68d('0xa6')]?{'attributes':[],'where':{'TagId':_0x2a06d8[_0xc68d('0x7a')][_0xc68d('0xa6')]||undefined}}:{},'required':_0x2a06d8[_0xc68d('0x7a')][_0xc68d('0xa6')]?!![]:![]}];}else{_0x547b07['include']=[{'all':!![]}];}}return _0x305595[_0x264745['childModel']]['findAll'](_0x547b07);})[_0xc68d('0xa')](function(_0xc8c8a0){_0x27554f[_0xc68d('0xa8')]=_0xc8c8a0;if(_0x3b6608===_0xc68d('0x4f')&&_0x2a06d8[_0xc68d('0x7a')][_0xc68d('0xa9')]===_0xc68d('0xaa')){var _0x25d172=[];for(var _0x3b0013=0x0;_0x3b0013<_0x27554f['rows'][_0xc68d('0x88')];_0x3b0013++){_0x25d172[_0xc68d('0x89')](_0x5ee752(_0xc68d('0xab'),_0x27554f[_0xc68d('0xa8')][_0x3b0013][_0xc68d('0xac')]));_0x25d172[_0xc68d('0x89')](_0x5ee752(_0xc68d('0xad'),_0x27554f['rows'][_0x3b0013]['dataValues']));_0x25d172[_0xc68d('0x89')](_0x5ee752(_0xc68d('0xae'),_0x27554f[_0xc68d('0xa8')][_0x3b0013][_0xc68d('0xac')]));_0x25d172[_0xc68d('0x89')](_0x5ee752(_0xc68d('0xaf'),_0x27554f[_0xc68d('0xa8')][_0x3b0013]['dataValues']));_0x25d172[_0xc68d('0x89')](_0x5ee752('openchannel',_0x27554f[_0xc68d('0xa8')][_0x3b0013]['dataValues']));_0x25d172[_0xc68d('0x89')](_0x5ee752(_0xc68d('0xb0'),_0x27554f[_0xc68d('0xa8')][_0x3b0013]['dataValues']));}return Promise[_0xc68d('0x84')](_0x25d172)[_0xc68d('0xa')](function(){return _0x27554f;});}return _0x27554f;});}});}}});}; \ No newline at end of file +var _0x0d69=['users','agents','telephones','Users','admin','user','Telephones','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','Tag','Template','Trigger','trunks','Trunk','variables','Variable','Plugin','Reports','reportId','metrics','charAt','slice','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','toString','define','UserProfile','query','raw','Invalid\x20section\x20\x27','length','push','UserProfileSection','params','ignore','isEmpty','union','find','autoAssociation','all','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','merge','key','foreignKey','forEach','options','includeAll','default','DefaultReports','custom','count','rows','include','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','mail','openchannel','whatsapp','lodash','./userProfile.attributes','filter','field','value','findAll','map','model','then','associatedResources','name','catch','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','parentSections','projectName','projects','JscriptyProject','contacts','CmContact','Lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','outboundroutes','contexts','VoiceContext','voicemails','voicerecordings','Agents','membername','User','role','agent','telephone','VoiceQueues','type','QueueCampaigns','queue','VoiceQueue','outbound','musiconholds','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns'];(function(_0x2cf9b1,_0x504ebf){var _0xc94a41=function(_0x3e9ff6){while(--_0x3e9ff6){_0x2cf9b1['push'](_0x2cf9b1['shift']());}};_0xc94a41(++_0x504ebf);}(_0x0d69,0x11d));var _0x90d6=function(_0x26b4be,_0x2a9490){_0x26b4be=_0x26b4be-0x0;var _0xcc3067=_0x0d69[_0x26b4be];return _0xcc3067;};'use strict';var _=require(_0x90d6('0x0'));var attributes=require(_0x90d6('0x1'));var qs=require('../../components/parsers/qs');var squel=require('squel');module['exports']=function(_0x545c6f){var _0xa7ec3=_0x545c6f['models'];function _0x585f67(_0x465d05,_0x5e6a79){return new Promise(function(_0x403f98,_0x49503a){if(!_0x5e6a79)return _0x403f98(null);var _0x867722=_0x5e6a79[_0x90d6('0x2')]?{[_0x5e6a79['filter'][_0x90d6('0x3')]]:_0x5e6a79[_0x90d6('0x2')][_0x90d6('0x4')]}:undefined;return _0xa7ec3[_0x465d05][_0x90d6('0x5')]({'where':_0x867722,'raw':!![]})['then'](function(_0x12f500){_0x5e6a79['associatedResources']=_[_0x90d6('0x6')](_0x12f500,'id');_0x403f98(_0x5e6a79);})['catch'](function(_0x529e2f){_0x49503a(_0x529e2f);});});}function _0x21dd3c(_0x518f7a,_0x4f9157){return new Promise(function(_0x22bf76,_0x97906c){var _0xd2df94=_0x518f7a[_0x90d6('0x2')]?{[_0x518f7a[_0x90d6('0x2')][_0x90d6('0x3')]]:_0x518f7a[_0x90d6('0x2')][_0x90d6('0x4')]}:undefined;return _0xa7ec3[_0x518f7a[_0x90d6('0x7')]][_0x90d6('0x5')]({'where':_0xd2df94,'raw':!![]})[_0x90d6('0x8')](function(_0x7f21c8){_0x4f9157[_0x90d6('0x9')]=_[_0x90d6('0x6')](_0x7f21c8,function(_0x17002a){return _0x17002a[_0x90d6('0xa')];});_0x22bf76(_0x4f9157);})[_0x90d6('0xb')](function(_0x5892a9){_0x97906c(_0x5892a9);});});}function _0xb0ef79(_0x116f8d,_0x48ca87,_0x4f294d){if(!_0x48ca87)return Promise['resolve'](null);return new Promise(function(_0x3dd05b,_0x4f2824){return _0xa7ec3[_0x90d6('0xc')][_0x90d6('0x5')]({'where':{'sectionId':_0x48ca87['id']},'raw':!![]})['then'](function(_0x3faf36){if(_0x116f8d['field']&&_0x116f8d[_0x90d6('0x3')]!=='id'){_0x48ca87[_0x90d6('0x9')]=_[_0x90d6('0x6')](_0x3faf36,function(_0x1d64c9){return _0x1d64c9[_0x116f8d[_0x90d6('0x3')]];});}else{if(_0x4f294d===_0x90d6('0xd')){_0x48ca87[_0x90d6('0x9')]=_['map'](_0x3faf36,function(_0x4f721f){return{'id':_0x4f721f['resourceId'],'type':_0x4f721f['type']};});}else{_0x48ca87['associatedResources']=_[_0x90d6('0x6')](_0x3faf36,function(_0x4a6b9b){return _0x4a6b9b[_0x90d6('0xe')];});}}_0x3dd05b(_0x48ca87);})[_0x90d6('0xb')](function(_0x307a43){_0x4f2824(_0x307a43);});});}function _0x4d5de6(_0x2b08d9,_0x387353){var _0x3cd0db={'parentSections':[]};switch(_0x2b08d9[_0x90d6('0xf')]()){case _0x90d6('0x10'):_0x3cd0db[_0x90d6('0x11')]='SquareProject';break;case _0x90d6('0x12'):_0x3cd0db['childModel']=_0x90d6('0x13');break;case'squarerecordings':_0x3cd0db[_0x90d6('0x11')]='SquareRecording';_0x3cd0db[_0x90d6('0x14')]=[{'name':'SquareProjects','field':_0x90d6('0xa'),'foreignKey':_0x90d6('0x15')}];break;case _0x90d6('0x16'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x17');break;case _0x90d6('0x18'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x19');_0x3cd0db[_0x90d6('0x14')]=[{'name':_0x90d6('0x1a'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x1b');break;case _0x90d6('0x1c'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x1d');break;case _0x90d6('0x1e'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x1f');break;case _0x90d6('0x20'):_0x3cd0db['childModel']=_0x90d6('0x21');break;case'chatwebsites':_0x3cd0db['childModel']=_0x90d6('0x22');break;case _0x90d6('0x23'):_0x3cd0db[_0x90d6('0x11')]='FaxQueue';break;case _0x90d6('0x24'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x25');break;case _0x90d6('0x26'):case'internalroutes':case _0x90d6('0x27'):_0x3cd0db['childModel']='VoiceExtension';break;case _0x90d6('0x28'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x29');break;case _0x90d6('0x2a'):_0x3cd0db[_0x90d6('0x11')]='VoiceMail';break;case _0x90d6('0x2b'):_0x3cd0db[_0x90d6('0x11')]='VoiceRecording';_0x3cd0db[_0x90d6('0x14')]=[{'name':_0x90d6('0x2c'),'field':_0x90d6('0xa'),'foreignKey':_0x90d6('0x2d'),'model':_0x90d6('0x2e'),'filter':{'field':_0x90d6('0x2f'),'value':[_0x90d6('0x30')]}},{'name':'Telephones','field':_0x90d6('0xa'),'foreignKey':_0x90d6('0x2d'),'model':'User','filter':{'field':_0x90d6('0x2f'),'value':[_0x90d6('0x31')]}},{'name':_0x90d6('0x32'),'field':'name','foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x90d6('0x33'),'value':['inbound']}},{'name':_0x90d6('0x34'),'field':_0x90d6('0xa'),'foreignKey':_0x90d6('0x35'),'model':_0x90d6('0x36'),'filter':{'field':_0x90d6('0x33'),'value':[_0x90d6('0x37')]}}];break;case _0x90d6('0x38'):_0x3cd0db[_0x90d6('0x11')]='VoiceMusicOnHold';break;case _0x90d6('0x39'):_0x3cd0db[_0x90d6('0x11')]='VoiceChanSpy';break;case _0x90d6('0x3a'):_0x3cd0db['childModel']=_0x90d6('0x3b');break;case _0x90d6('0x3c'):_0x3cd0db['childModel']='Campaign';break;case'mailqueues':_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x3d');break;case'mailaccounts':_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x3e');break;case _0x90d6('0x3f'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x40');break;case _0x90d6('0x41'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x42');break;case'openchannelaccounts':_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x43');break;case _0x90d6('0x44'):_0x3cd0db['childModel']=_0x90d6('0x45');break;case _0x90d6('0x46'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x47');break;case'whatsappqueues':_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x48');break;case _0x90d6('0x49'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x4a');break;case _0x90d6('0x4b'):_0x3cd0db['childModel']=_0x90d6('0x4c');break;case _0x90d6('0x4d'):case _0x90d6('0x4e'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x36');if(_0x387353){_0x3cd0db[_0x90d6('0x14')]=[{'name':_0x90d6('0x32')},{'name':_0x90d6('0x34')}];}break;case _0x90d6('0x4f'):case _0x90d6('0x50'):case _0x90d6('0x51'):_0x3cd0db['childModel']=_0x90d6('0x2e');if(_0x387353){_0x3cd0db[_0x90d6('0x14')]=[{'name':_0x90d6('0x52'),'filter':{'field':_0x90d6('0x2f'),'value':[_0x90d6('0x53'),_0x90d6('0x54')]},'ignore':!![]},{'name':'Agents'},{'name':_0x90d6('0x55')}];}break;case'zendeskaccounts':_0x3cd0db['childModel']='ZendeskAccount';break;case _0x90d6('0x56'):_0x3cd0db['childModel']=_0x90d6('0x57');break;case'freshdeskaccounts':_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x58');break;case _0x90d6('0x59'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x5a');break;case _0x90d6('0x5b'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x5c');break;case _0x90d6('0x5d'):_0x3cd0db['childModel']=_0x90d6('0x5e');break;case _0x90d6('0x5f'):_0x3cd0db['childModel']='User';break;case _0x90d6('0x60'):_0x3cd0db['childModel']='CannedAnswer';break;case _0x90d6('0x61'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x62');break;case _0x90d6('0x63'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x64');break;case _0x90d6('0x65'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x66');break;case _0x90d6('0x67'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x68');break;case'scheduler':_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x69');break;case _0x90d6('0x6a'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x6b');break;case'tags':_0x3cd0db['childModel']=_0x90d6('0x6c');break;case'templates':_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x6d');break;case'triggers':_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x6e');break;case _0x90d6('0x6f'):_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x70');break;case _0x90d6('0x71'):_0x3cd0db['childModel']=_0x90d6('0x72');break;case'plugins':_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0x73');break;case'extractedreports':_0x3cd0db[_0x90d6('0x11')]=_0x90d6('0xd');_0x3cd0db['parentSections']=[{'name':_0x90d6('0x74'),'field':'id','foreignKey':_0x90d6('0x75')}];break;case _0x90d6('0x76'):_0x3cd0db[_0x90d6('0x11')]='AnalyticMetric';break;}return _0x3cd0db;}function _0x186adc(_0x589dd3,_0x220778){var _0x4c2e21=_0x589dd3[_0x90d6('0x77')](0x0)['toUpperCase']()+_0x589dd3[_0x90d6('0x78')](0x1);var _0x5bc57e={'type':_0xa7ec3[_0x90d6('0x79')][_0x90d6('0x7a')]['SELECT'],'raw':!![]};return new Promise(function(_0x4e0e61,_0x40a59c){var _0x25d2a3=squel[_0x90d6('0x7b')]()[_0x90d6('0x3')](_0x90d6('0x7c')+_0x4c2e21+_0x90d6('0x7d'),'id')[_0x90d6('0x3')](_0x90d6('0x7e'))[_0x90d6('0x7f')](_0x90d6('0x80')+_0x589dd3+'_interactions','ui')[_0x90d6('0x81')](_0x90d6('0x82'),_0x220778['id']);return _0xa7ec3[_0x90d6('0x83')]['query'](_0x25d2a3[_0x90d6('0x84')](),_0x5bc57e)[_0x90d6('0x8')](function(_0x579717){_0x220778[_0x4c2e21+'OpenTabs']=_0x579717;_0x4e0e61(_0x579717);})[_0x90d6('0xb')](function(_0x1b0f96){_0x40a59c(_0x1b0f96);});});}return _0x545c6f[_0x90d6('0x85')](_0x90d6('0x86'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x36bb03){var _0xc6fabb={'raw':_0x36bb03[_0x90d6('0x87')][_0x90d6('0x88')],'where':{}};var _0x1749dd={};var _0x327810={'count':0x0,'rows':[]};var _0x55d685=_0x36bb03['query']['section'];var _0x139510=_0x36bb03[_0x90d6('0x87')]['mergeResources']||![];var _0x1a7de1=_0x4d5de6(_0x55d685,_0x139510);if(!_0x1a7de1[_0x90d6('0x11')])throw new Error(_0x90d6('0x89')+_0x55d685+'\x27');var _0x25b5bc=[{'name':_0x55d685}];if(!_['isEmpty'](_0x1a7de1['parentSections']))_0x25b5bc=_0x1a7de1[_0x90d6('0x14')];var _0x3d894a=[];for(var _0xacfcd5=0x0;_0xacfcd5<_0x25b5bc[_0x90d6('0x8a')];_0xacfcd5++){_0x3d894a[_0x90d6('0x8b')](_0xa7ec3[_0x90d6('0x8c')]['find']({'where':{'userProfileId':_0x36bb03[_0x90d6('0x8d')]['id'],'name':_0x25b5bc[_0xacfcd5][_0x90d6('0xa')]},'raw':!![]}));}return Promise['all'](_0x3d894a)['then'](function(_0x3423be){var _0x462913=_[_0x90d6('0x2')](_0x3423be,function(_0x504fa3){return _0x504fa3?_0x504fa3:undefined;});var _0x40e235=_[_0x90d6('0x2')](_0x25b5bc,[_0x90d6('0x8e'),!![]]);var _0x49beed=_[_0x90d6('0x8f')](_0x462913)&&_['isEmpty'](_0x40e235)?null:_[_0x90d6('0x90')](_0x40e235,_0x462913);if(!_0x49beed)return null;var _0x3e99a4=[];for(var _0x5069d1=0x0;_0x5069d1<_0x49beed[_0x90d6('0x8a')];_0x5069d1++){var _0x583dfe=_[_0x90d6('0x91')](_0x25b5bc,function(_0x4ad21e){return _0x49beed[_0x5069d1]?_0x4ad21e[_0x90d6('0xa')]===_0x49beed[_0x5069d1]['name']:null;});if(_0x583dfe){if(_0x49beed[_0x5069d1][_0x90d6('0x8e')]){_0x3e99a4[_0x90d6('0x8b')](_0x585f67(_0x1a7de1['childModel'],_0x49beed[_0x5069d1]));}else{if(!_0x49beed[_0x5069d1][_0x90d6('0x92')]){_0x3e99a4['push'](_0xb0ef79(_0x583dfe,_0x49beed[_0x5069d1],_0x1a7de1[_0x90d6('0x11')]));}else{if(_0x583dfe[_0x90d6('0x7')]){_0x3e99a4[_0x90d6('0x8b')](_0x21dd3c(_0x583dfe,_0x49beed[_0x5069d1]));}}}}}return Promise[_0x90d6('0x93')](_0x3e99a4);})[_0x90d6('0x8')](function(_0x303201){var _0xddae64=_0x303201;var _0x483535=null;if(_0xddae64){_0x483535=_0xddae64[_0x90d6('0x8a')]===0x1?_0xddae64[0x0]:null;}if(!_0x483535&&!_0xddae64)return _0x327810;var _0x5c9b6c=_0xa7ec3[_0x1a7de1['childModel']]['rawAttributes'];_0x1749dd[_0x90d6('0x7')]=_[_0x90d6('0x94')](_0x5c9b6c);_0x1749dd[_0x90d6('0x87')]=_['keys'](_0x36bb03[_0x90d6('0x87')]);_0x1749dd[_0x90d6('0x95')]=_[_0x90d6('0x96')](_0x1749dd[_0x90d6('0x7')],_0x1749dd[_0x90d6('0x87')]);_0xc6fabb[_0x90d6('0x97')]=_[_0x90d6('0x96')](_0x1749dd[_0x90d6('0x7')],qs[_0x90d6('0x98')](_0x36bb03[_0x90d6('0x87')][_0x90d6('0x98')]));_0xc6fabb[_0x90d6('0x97')]=_0xc6fabb[_0x90d6('0x97')]['length']?_0xc6fabb[_0x90d6('0x97')]:_0x1749dd[_0x90d6('0x7')];if(!_0x36bb03[_0x90d6('0x87')][_0x90d6('0x99')]('nolimit')){_0xc6fabb[_0x90d6('0x9a')]=qs['limit'](_0x36bb03[_0x90d6('0x87')][_0x90d6('0x9a')]);_0xc6fabb[_0x90d6('0x9b')]=qs[_0x90d6('0x9b')](_0x36bb03[_0x90d6('0x87')][_0x90d6('0x9b')]);}_0xc6fabb[_0x90d6('0x9c')]=qs['sort'](_0x36bb03[_0x90d6('0x87')][_0x90d6('0x9d')]);_0xc6fabb[_0x90d6('0x81')]=qs['filters'](_[_0x90d6('0x9e')](_0x36bb03[_0x90d6('0x87')],_0x1749dd[_0x90d6('0x95')]));if(_0x36bb03['query'][_0x90d6('0x2')]){_0xc6fabb['where']=_[_0x90d6('0x9f')](_0xc6fabb[_0x90d6('0x81')],{'$or':_[_0x90d6('0x6')](_0x5c9b6c,function(_0x48599e){if(_0x48599e[_0x90d6('0x33')][_0x90d6('0xa0')]!=='VIRTUAL'){var _0x48409f={};_0x48409f[_0x48599e[_0x90d6('0x3')]]={'$like':'%'+_0x36bb03[_0x90d6('0x87')][_0x90d6('0x2')]+'%'};return _0x48409f;}})});}var _0x2d4a9e=[];var _0x59cfc8=null;var _0x36fe0c={};if(_0x483535){_0x59cfc8=_[_0x90d6('0x91')](_0x25b5bc,[_0x90d6('0xa'),_0x483535['name']]);if(_0x59cfc8[_0x90d6('0x3')]){_0x36fe0c={};if(_0x1a7de1[_0x90d6('0x11')]==='AnalyticExtractedReport'){_0x36fe0c[_0x59cfc8[_0x90d6('0xa1')]]=_[_0x90d6('0x6')](_0x483535[_0x90d6('0x9')],'id');}else{_0x36fe0c[_0x59cfc8[_0x90d6('0xa1')]]=_0x483535[_0x90d6('0x9')];}_0x2d4a9e[_0x90d6('0x8b')](_0x36fe0c);}else{_0xc6fabb[_0x90d6('0x81')]['id']=_0x483535[_0x90d6('0x9')];}}else{for(var _0x17f677=0x0;_0x17f677<_0xddae64['length'];_0x17f677++){_0x59cfc8=_[_0x90d6('0x91')](_0x25b5bc,['name',_0xddae64[_0x17f677][_0x90d6('0xa')]]);if(_0x59cfc8[_0x90d6('0x3')]){_0x36fe0c={};_0x36fe0c[_0x59cfc8[_0x90d6('0xa1')]]=_0xddae64[_0x17f677][_0x90d6('0x9')];_0x2d4a9e[_0x90d6('0x8b')](_0x36fe0c);}else{if(!_0xc6fabb[_0x90d6('0x81')]['id'])_0xc6fabb[_0x90d6('0x81')]['id']=[];_0xddae64[_0x17f677][_0x90d6('0x9')][_0x90d6('0xa2')](function(_0x4129b5){_0xc6fabb[_0x90d6('0x81')]['id'][_0x90d6('0x8b')](_0x4129b5);});}}}if(!_[_0x90d6('0x8f')](_0x2d4a9e)){_0xc6fabb[_0x90d6('0x81')]=_[_0x90d6('0x9f')](_0xc6fabb[_0x90d6('0x81')],{'$and':{'$or':_0x2d4a9e}});}_0xc6fabb=_[_0x90d6('0x9f')]({},_0xc6fabb,_0x36bb03[_0x90d6('0xa3')]);if(_0x483535&&!_0x483535[_0x90d6('0x92')]&&_0x1a7de1[_0x90d6('0x11')]===_0x90d6('0xd')){if(_0x36bb03['query'][_0x90d6('0xa4')]){_0xc6fabb['include']=[{'all':!![]}];}return _0xa7ec3[_0x1a7de1[_0x90d6('0x11')]][_0x90d6('0x5')](_0xc6fabb)[_0x90d6('0x8')](function(_0x31459e){var _0x3778f7=[];_0x31459e['forEach'](function(_0x28f1d6){var _0x2917a6;switch(_0x28f1d6['reportType']){case _0x90d6('0xa5'):_0x2917a6=_[_0x90d6('0x91')](_0x483535[_0x90d6('0x9')],function(_0x26fdd5){return _0x26fdd5['id']===_0x28f1d6[_0x90d6('0x75')]&&_0x26fdd5['type']===_0x90d6('0xa6');});break;case _0x90d6('0xa7'):_0x2917a6=_[_0x90d6('0x91')](_0x483535['associatedResources'],function(_0x2b7a98){return _0x2b7a98['id']===_0x28f1d6['reportId']&&_0x2b7a98[_0x90d6('0x33')]==='CustomReports';});break;}if(_0x2917a6)_0x3778f7['push'](_0x28f1d6);});_0x327810[_0x90d6('0xa8')]=_0x3778f7['length'];_0x327810[_0x90d6('0xa9')]=_0x3778f7;return _0x327810;});}else{return _0xa7ec3[_0x1a7de1['childModel']][_0x90d6('0xa8')]({'where':_0xc6fabb[_0x90d6('0x81')]})[_0x90d6('0x8')](function(_0x5cc092){_0x327810['count']=_0x5cc092;if(_0x36bb03[_0x90d6('0x87')][_0x90d6('0xa4')]){if(_0x1a7de1[_0x90d6('0x11')]===_0x90d6('0x19')){_0xc6fabb[_0x90d6('0xaa')]=[{'model':_0xa7ec3[_0x90d6('0x6c')],'as':_0x90d6('0xab'),'attributes':['id',_0x90d6('0xa'),_0x90d6('0xac')],'required':_0x36bb03[_0x90d6('0x87')][_0x90d6('0xad')]?!![]:![]},{'model':_0xa7ec3[_0x90d6('0x6c')],'as':_0x90d6('0xae'),'attributes':['id',_0x90d6('0xa'),_0x90d6('0xac')],'through':_0x36bb03[_0x90d6('0x87')]['tag']?{'attributes':[],'where':{'TagId':_0x36bb03[_0x90d6('0x87')][_0x90d6('0xad')]||undefined}}:{},'required':_0x36bb03[_0x90d6('0x87')]['tag']?!![]:![]}];}else{_0xc6fabb[_0x90d6('0xaa')]=[{'all':!![]}];}}return _0xa7ec3[_0x1a7de1[_0x90d6('0x11')]][_0x90d6('0x5')](_0xc6fabb);})[_0x90d6('0x8')](function(_0x3ce33a){_0x327810[_0x90d6('0xa9')]=_0x3ce33a;if(_0x55d685===_0x90d6('0x2c')&&_0x36bb03[_0x90d6('0x87')][_0x90d6('0xaf')]===_0x90d6('0xb0')){var _0x18f230=[];for(var _0x3b2393=0x0;_0x3b2393<_0x327810[_0x90d6('0xa9')][_0x90d6('0x8a')];_0x3b2393++){_0x18f230[_0x90d6('0x8b')](_0x186adc(_0x90d6('0xb1'),_0x327810['rows'][_0x3b2393][_0x90d6('0xb2')]));_0x18f230[_0x90d6('0x8b')](_0x186adc('sms',_0x327810[_0x90d6('0xa9')][_0x3b2393][_0x90d6('0xb2')]));_0x18f230[_0x90d6('0x8b')](_0x186adc('fax',_0x327810['rows'][_0x3b2393][_0x90d6('0xb2')]));_0x18f230['push'](_0x186adc(_0x90d6('0xb3'),_0x327810[_0x90d6('0xa9')][_0x3b2393][_0x90d6('0xb2')]));_0x18f230[_0x90d6('0x8b')](_0x186adc(_0x90d6('0xb4'),_0x327810[_0x90d6('0xa9')][_0x3b2393][_0x90d6('0xb2')]));_0x18f230[_0x90d6('0x8b')](_0x186adc(_0x90d6('0xb5'),_0x327810[_0x90d6('0xa9')][_0x3b2393][_0x90d6('0xb2')]));}return Promise['all'](_0x18f230)['then'](function(){return _0x327810;});}return _0x327810;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 3a19b30..d5f15b2 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 _0x3e24=['info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register'];(function(_0x488120,_0x5328d9){var _0xf61b61=function(_0x2ce472){while(--_0x2ce472){_0x488120['push'](_0x488120['shift']());}};_0xf61b61(++_0x5328d9);}(_0x3e24,0x167));var _0x43e2=function(_0x4b6dc0,_0x27f881){_0x4b6dc0=_0x4b6dc0-0x0;var _0x4be496=_0x3e24[_0x4b6dc0];return _0x4be496;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});config[_0x43e2('0xc')]=_[_0x43e2('0xd')](config['redis'],{'host':_0x43e2('0xe'),'port':0x18eb});var socket=require(_0x43e2('0xf'))(new Redis(config['redis']));require(_0x43e2('0x10'))[_0x43e2('0x11')](socket);function respondWithRpcPromise(_0x5375d8,_0x2ed387,_0x1ef968){return new BPromise(function(_0x52146c,_0x45848e){return client['request'](_0x5375d8,_0x1ef968)['then'](function(_0x5847f0){logger[_0x43e2('0x12')](_0x43e2('0x13'),_0x2ed387,_0x43e2('0x14'));logger[_0x43e2('0x15')](_0x43e2('0x16'),_0x2ed387,_0x43e2('0x14'),JSON[_0x43e2('0x17')](_0x5847f0));if(_0x5847f0[_0x43e2('0x18')]){if(_0x5847f0[_0x43e2('0x18')][_0x43e2('0x19')]===0x1f4){logger[_0x43e2('0x18')](_0x43e2('0x13'),_0x2ed387,_0x5847f0['error'][_0x43e2('0x1a')]);return _0x45848e(_0x5847f0[_0x43e2('0x18')][_0x43e2('0x1a')]);}logger[_0x43e2('0x18')]('UserProfile,\x20%s,\x20%s',_0x2ed387,_0x5847f0['error'][_0x43e2('0x1a')]);return _0x52146c(_0x5847f0[_0x43e2('0x18')][_0x43e2('0x1a')]);}else{logger[_0x43e2('0x12')](_0x43e2('0x13'),_0x2ed387,_0x43e2('0x14'));_0x52146c(_0x5847f0[_0x43e2('0x1b')][_0x43e2('0x1a')]);}})[_0x43e2('0x1c')](function(_0x399cab){logger['error'](_0x43e2('0x13'),_0x2ed387,_0x399cab);_0x45848e(_0x399cab);});});} \ No newline at end of file +var _0x0324=['debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./userProfile.socket','request','then','request\x20sent'];(function(_0x15c392,_0x281597){var _0x1c9538=function(_0x5ab107){while(--_0x5ab107){_0x15c392['push'](_0x15c392['shift']());}};_0x1c9538(++_0x281597);}(_0x0324,0x90));var _0x4032=function(_0x1bc0d0,_0x853e68){_0x1bc0d0=_0x1bc0d0-0x0;var _0x40edd6=_0x0324[_0x1bc0d0];return _0x40edd6;};'use strict';var _=require('lodash');var util=require(_0x4032('0x0'));var moment=require(_0x4032('0x1'));var BPromise=require(_0x4032('0x2'));var rs=require(_0x4032('0x3'));var fs=require('fs');var Redis=require(_0x4032('0x4'));var db=require(_0x4032('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4032('0x6'))(_0x4032('0x7'));var config=require(_0x4032('0x8'));var jayson=require(_0x4032('0x9'));var client=jayson[_0x4032('0xa')][_0x4032('0xb')]({'port':0x232a});config['redis']=_[_0x4032('0xc')](config[_0x4032('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4032('0xd')]));require(_0x4032('0xe'))['register'](socket);function respondWithRpcPromise(_0x35d7fd,_0x2940da,_0x3bc38e){return new BPromise(function(_0x3d38aa,_0x561064){return client[_0x4032('0xf')](_0x35d7fd,_0x3bc38e)[_0x4032('0x10')](function(_0x5e9430){logger['info']('UserProfile,\x20%s,\x20%s',_0x2940da,_0x4032('0x11'));logger[_0x4032('0x12')](_0x4032('0x13'),_0x2940da,_0x4032('0x11'),JSON[_0x4032('0x14')](_0x5e9430));if(_0x5e9430[_0x4032('0x15')]){if(_0x5e9430[_0x4032('0x15')][_0x4032('0x16')]===0x1f4){logger[_0x4032('0x15')](_0x4032('0x17'),_0x2940da,_0x5e9430['error']['message']);return _0x561064(_0x5e9430[_0x4032('0x15')][_0x4032('0x18')]);}logger[_0x4032('0x15')](_0x4032('0x17'),_0x2940da,_0x5e9430[_0x4032('0x15')][_0x4032('0x18')]);return _0x3d38aa(_0x5e9430['error'][_0x4032('0x18')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x2940da,_0x4032('0x11'));_0x3d38aa(_0x5e9430[_0x4032('0x19')][_0x4032('0x18')]);}})[_0x4032('0x1a')](function(_0x194abb){logger[_0x4032('0x15')]('UserProfile,\x20%s,\x20%s',_0x2940da,_0x194abb);_0x561064(_0x194abb);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 5958317..95482e0 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 _0x0a65=['length','./userProfile.events','remove','update','emit','removeListener','register'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0x0a65,0xa9));var _0x50a6=function(_0x173024,_0x33604d){_0x173024=_0x173024-0x0;var _0x484143=_0x0a65[_0x173024];return _0x484143;};'use strict';var UserProfileEvents=require(_0x50a6('0x0'));var events=['save',_0x50a6('0x1'),_0x50a6('0x2')];function createListener(_0x333e23,_0x4fd13c){return function(_0x54f7d1){_0x4fd13c[_0x50a6('0x3')](_0x333e23,_0x54f7d1);};}function removeListener(_0x57e293,_0xe8d9d0){return function(){UserProfileEvents[_0x50a6('0x4')](_0x57e293,_0xe8d9d0);};}exports[_0x50a6('0x5')]=function(_0x1a3f5c){for(var _0x498c9c=0x0,_0x27c596=events[_0x50a6('0x6')];_0x498c9c<_0x27c596;_0x498c9c++){var _0x53aa0e=events[_0x498c9c];var _0x3e35de=createListener('userProfile:'+_0x53aa0e,_0x1a3f5c);UserProfileEvents['on'](_0x53aa0e,_0x3e35de);}}; \ No newline at end of file +var _0x0f45=['save','update','emit','removeListener','register','length'];(function(_0x500f1b,_0x2125b9){var _0x1078c4=function(_0x1c003d){while(--_0x1c003d){_0x500f1b['push'](_0x500f1b['shift']());}};_0x1078c4(++_0x2125b9);}(_0x0f45,0x11a));var _0x50f4=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x0f45[_0x1928c9];return _0x51b5fb;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x50f4('0x0'),'remove',_0x50f4('0x1')];function createListener(_0x9ee3bd,_0x487653){return function(_0x285690){_0x487653[_0x50f4('0x2')](_0x9ee3bd,_0x285690);};}function removeListener(_0x3a8926,_0x53ab64){return function(){UserProfileEvents[_0x50f4('0x3')](_0x3a8926,_0x53ab64);};}exports[_0x50f4('0x4')]=function(_0x129ef1){for(var _0x361707=0x0,_0x44bb5e=events[_0x50f4('0x5')];_0x361707<_0x44bb5e;_0x361707++){var _0x2613db=events[_0x361707];var _0x59fa09=createListener('userProfile:'+_0x2613db,_0x129ef1);UserProfileEvents['on'](_0x2613db,_0x59fa09);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index c4bfd3c..687bfa6 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 _0xb865=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','create','/:id','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x5c88c8,_0x2c04cf){var _0x7b15d5=function(_0x3435dd){while(--_0x3435dd){_0x5c88c8['push'](_0x5c88c8['shift']());}};_0x7b15d5(++_0x2c04cf);}(_0xb865,0x1e0));var _0x5b86=function(_0x43df6d,_0x16679e){_0x43df6d=_0x43df6d-0x0;var _0x1f6bf8=_0xb865[_0x43df6d];return _0x1f6bf8;};'use strict';var multer=require(_0x5b86('0x0'));var util=require(_0x5b86('0x1'));var path=require(_0x5b86('0x2'));var timeout=require(_0x5b86('0x3'));var express=require(_0x5b86('0x4'));var router=express[_0x5b86('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5b86('0x6'));var interaction=require(_0x5b86('0x7'));var config=require(_0x5b86('0x8'));var controller=require(_0x5b86('0x9'));router[_0x5b86('0xa')]('/',auth[_0x5b86('0xb')](),controller[_0x5b86('0xc')]);router[_0x5b86('0xa')]('/describe',auth[_0x5b86('0xb')](),controller[_0x5b86('0xd')]);router['get']('/:id',auth[_0x5b86('0xb')](),controller['show']);router['post']('/',auth[_0x5b86('0xb')](),controller[_0x5b86('0xe')]);router['put'](_0x5b86('0xf'),auth[_0x5b86('0xb')](),controller[_0x5b86('0x10')]);router[_0x5b86('0x11')]('/:id',auth[_0x5b86('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x98ea=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','isAuthenticated','index','get','describe','/:id','post','create','delete','multer','path'];(function(_0x4f54d0,_0x31b413){var _0x1d0d2e=function(_0x2c3ae9){while(--_0x2c3ae9){_0x4f54d0['push'](_0x4f54d0['shift']());}};_0x1d0d2e(++_0x31b413);}(_0x98ea,0x1ce));var _0xa98e=function(_0x3c063e,_0x4667c3){_0x3c063e=_0x3c063e-0x0;var _0x1eabfc=_0x98ea[_0x3c063e];return _0x1eabfc;};'use strict';var multer=require(_0xa98e('0x0'));var util=require('util');var path=require(_0xa98e('0x1'));var timeout=require('connect-timeout');var express=require(_0xa98e('0x2'));var router=express[_0xa98e('0x3')]();var fs_extra=require(_0xa98e('0x4'));var auth=require(_0xa98e('0x5'));var interaction=require(_0xa98e('0x6'));var config=require('../../config/environment');var controller=require(_0xa98e('0x7'));router['get']('/',auth[_0xa98e('0x8')](),controller[_0xa98e('0x9')]);router[_0xa98e('0xa')]('/describe',auth[_0xa98e('0x8')](),controller[_0xa98e('0xb')]);router['get'](_0xa98e('0xc'),auth[_0xa98e('0x8')](),controller['show']);router[_0xa98e('0xd')]('/',auth['isAuthenticated'](),controller[_0xa98e('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa98e('0xf')](_0xa98e('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 83e1e5d..cd07fd3 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 _0xf3e0=['sequelize','exports','STRING'];(function(_0x193ddf,_0x6f30bb){var _0x5bc6df=function(_0x70fd9e){while(--_0x70fd9e){_0x193ddf['push'](_0x193ddf['shift']());}};_0x5bc6df(++_0x6f30bb);}(_0xf3e0,0x1e0));var _0x0f3e=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xf3e0[_0x5a3cf0];return _0x5a64ee;};'use strict';var Sequelize=require(_0x0f3e('0x0'));module[_0x0f3e('0x1')]={'name':{'type':Sequelize[_0x0f3e('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x0f3e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x47c5=['INTEGER','sequelize','STRING'];(function(_0x133876,_0x3a44aa){var _0x4c9f76=function(_0x5e561c){while(--_0x5e561c){_0x133876['push'](_0x133876['shift']());}};_0x4c9f76(++_0x3a44aa);}(_0x47c5,0x1a5));var _0x547c=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0x47c5[_0x5c1cdc];return _0x2e8317;};'use strict';var Sequelize=require(_0x547c('0x0'));module['exports']={'name':{'type':Sequelize[_0x547c('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x547c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x547c('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 2abea5e..1eda6ce 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 _0xe2fe=['find','body','params','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','UserProfileResource','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show'];(function(_0x290844,_0x366077){var _0x546847=function(_0x4ea65e){while(--_0x4ea65e){_0x290844['push'](_0x290844['shift']());}};_0x546847(++_0x366077);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['UserProfileResource']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['UserProfileResource']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));};exports[_0xee2f('0x40')]=function(_0x3acae6,_0x2a450f){return db[_0xee2f('0x23')][_0xee2f('0x40')]()[_0xee2f('0x1c')](respondWithResult(_0x2a450f,null))[_0xee2f('0x3b')](handleError(_0x2a450f,null));}; \ No newline at end of file +var _0x781d=['sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','UserProfileResource','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x781d,0x14a));var _0xd781=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x781d[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['create']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['create'](_0x13a907[_0xd781('0x44')],{})[_0xd781('0x26')](respondWithResult(_0x16d16e,0xc9))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x336d30,_0x3828ad){if(_0x336d30[_0xd781('0x44')]['id']){delete _0x336d30['body']['id'];}return db[_0xd781('0x2c')][_0xd781('0x45')]({'where':{'id':_0x336d30[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x3828ad,null))[_0xd781('0x26')](saveUpdates(_0x336d30[_0xd781('0x44')],null))['then'](respondWithResult(_0x3828ad,null))[_0xd781('0x3f')](handleError(_0x3828ad,null));};exports[_0xd781('0x25')]=function(_0x41caac,_0x207546){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x41caac[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x207546,null))[_0xd781('0x26')](removeEntity(_0x207546,null))['catch'](handleError(_0x207546,null));};exports[_0xd781('0x46')]=function(_0x17a46e,_0x4f9e37){return db[_0xd781('0x2c')]['describe']()['then'](respondWithResult(_0x4f9e37,null))['catch'](handleError(_0x4f9e37,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index b54b672..1df078f 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 _0x5c1d=['define','user_profile_has_resources','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x11ceaa,_0x537665){var _0x5cb730=function(_0x2bb5ae){while(--_0x2bb5ae){_0x11ceaa['push'](_0x11ceaa['shift']());}};_0x5cb730(++_0x537665);}(_0x5c1d,0x170));var _0xd5c1=function(_0x96cff6,_0x366421){_0x96cff6=_0x96cff6-0x0;var _0x265cd0=_0x5c1d[_0x96cff6];return _0x265cd0;};'use strict';var _=require(_0xd5c1('0x0'));var util=require(_0xd5c1('0x1'));var logger=require(_0xd5c1('0x2'))(_0xd5c1('0x3'));var moment=require(_0xd5c1('0x4'));var BPromise=require(_0xd5c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd5c1('0x6'));var rimraf=require(_0xd5c1('0x7'));var config=require(_0xd5c1('0x8'));var attributes=require(_0xd5c1('0x9'));module['exports']=function(_0x1f923e,_0x30645f){return _0x1f923e[_0xd5c1('0xa')]('UserProfileResource',attributes,{'tableName':_0xd5c1('0xb'),'paranoid':![],'indexes':[{'name':_0xd5c1('0xc'),'fields':['resourceId',_0xd5c1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f3c=['rimraf','../../config/environment','./userProfileResource.attributes','exports','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2ea322,_0x5b0e21){var _0x9aece8=function(_0x3e65ce){while(--_0x3e65ce){_0x2ea322['push'](_0x2ea322['shift']());}};_0x9aece8(++_0x5b0e21);}(_0x0f3c,0x7d));var _0xc0f3=function(_0x3918e2,_0x24d29b){_0x3918e2=_0x3918e2-0x0;var _0x31edab=_0x0f3c[_0x3918e2];return _0x31edab;};'use strict';var _=require(_0xc0f3('0x0'));var util=require(_0xc0f3('0x1'));var logger=require(_0xc0f3('0x2'))(_0xc0f3('0x3'));var moment=require('moment');var BPromise=require(_0xc0f3('0x4'));var rp=require(_0xc0f3('0x5'));var fs=require('fs');var path=require(_0xc0f3('0x6'));var rimraf=require(_0xc0f3('0x7'));var config=require(_0xc0f3('0x8'));var attributes=require(_0xc0f3('0x9'));module[_0xc0f3('0xa')]=function(_0x5273ce,_0x2fc069){return _0x5273ce['define']('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index e113353..8be3f37 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 _0x3e37=['then','info','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1a14eb,_0x262526){var _0x20a40f=function(_0x33e54b){while(--_0x33e54b){_0x1a14eb['push'](_0x1a14eb['shift']());}};_0x20a40f(++_0x262526);}(_0x3e37,0x14c));var _0x73e3=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x3e37[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73e3('0x0'));var BPromise=require(_0x73e3('0x1'));var rs=require(_0x73e3('0x2'));var fs=require('fs');var Redis=require(_0x73e3('0x3'));var db=require(_0x73e3('0x4'))['db'];var utils=require(_0x73e3('0x5'));var logger=require(_0x73e3('0x6'))(_0x73e3('0x7'));var config=require(_0x73e3('0x8'));var jayson=require(_0x73e3('0x9'));var client=jayson[_0x73e3('0xa')][_0x73e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41c15e,_0x28675d,_0x1fcd1c){return new BPromise(function(_0x5c53c9,_0x1181bf){return client[_0x73e3('0xc')](_0x41c15e,_0x1fcd1c)[_0x73e3('0xd')](function(_0xe7a202){logger[_0x73e3('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x28675d,_0x73e3('0xf'));logger['debug'](_0x73e3('0x10'),_0x28675d,_0x73e3('0xf'),JSON['stringify'](_0xe7a202));if(_0xe7a202[_0x73e3('0x11')]){if(_0xe7a202[_0x73e3('0x11')][_0x73e3('0x12')]===0x1f4){logger['error'](_0x73e3('0x13'),_0x28675d,_0xe7a202['error']['message']);return _0x1181bf(_0xe7a202[_0x73e3('0x11')][_0x73e3('0x14')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x28675d,_0xe7a202[_0x73e3('0x11')][_0x73e3('0x14')]);return _0x5c53c9(_0xe7a202[_0x73e3('0x11')][_0x73e3('0x14')]);}else{logger[_0x73e3('0xe')](_0x73e3('0x13'),_0x28675d,_0x73e3('0xf'));_0x5c53c9(_0xe7a202[_0x73e3('0x15')][_0x73e3('0x14')]);}})[_0x73e3('0x16')](function(_0x5e2d4a){logger[_0x73e3('0x11')](_0x73e3('0x13'),_0x28675d,_0x5e2d4a);_0x1181bf(_0x5e2d4a);});});} \ No newline at end of file +var _0x9322=['then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1a910e,_0x305276){var _0x3f429b=function(_0x563e78){while(--_0x563e78){_0x1a910e['push'](_0x1a910e['shift']());}};_0x3f429b(++_0x305276);}(_0x9322,0x1bf));var _0x2932=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9322[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require(_0x2932('0x0'));var moment=require(_0x2932('0x1'));var BPromise=require(_0x2932('0x2'));var rs=require(_0x2932('0x3'));var fs=require('fs');var Redis=require(_0x2932('0x4'));var db=require(_0x2932('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2932('0x6'))(_0x2932('0x7'));var config=require(_0x2932('0x8'));var jayson=require(_0x2932('0x9'));var client=jayson[_0x2932('0xa')][_0x2932('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27f1af,_0x19f350,_0x375e0f){return new BPromise(function(_0x1f3f1a,_0x33bc18){return client[_0x2932('0xc')](_0x27f1af,_0x375e0f)[_0x2932('0xd')](function(_0x358a62){logger[_0x2932('0xe')](_0x2932('0xf'),_0x19f350,_0x2932('0x10'));logger[_0x2932('0x11')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x19f350,_0x2932('0x10'),JSON['stringify'](_0x358a62));if(_0x358a62[_0x2932('0x12')]){if(_0x358a62['error'][_0x2932('0x13')]===0x1f4){logger['error'](_0x2932('0xf'),_0x19f350,_0x358a62['error'][_0x2932('0x14')]);return _0x33bc18(_0x358a62[_0x2932('0x12')][_0x2932('0x14')]);}logger[_0x2932('0x12')](_0x2932('0xf'),_0x19f350,_0x358a62[_0x2932('0x12')]['message']);return _0x1f3f1a(_0x358a62[_0x2932('0x12')]['message']);}else{logger[_0x2932('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x19f350,'request\x20sent');_0x1f3f1a(_0x358a62[_0x2932('0x15')]['message']);}})[_0x2932('0x16')](function(_0x47be49){logger[_0x2932('0x12')](_0x2932('0xf'),_0x19f350,_0x47be49);_0x33bc18(_0x47be49);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index c9d7117..bbe4bd9 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 _0x8607=['/describe','describe','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x8607,0x159));var _0x7860=function(_0x3826ad,_0x2c0643){_0x3826ad=_0x3826ad-0x0;var _0x368a4f=_0x8607[_0x3826ad];return _0x368a4f;};'use strict';var multer=require(_0x7860('0x0'));var util=require(_0x7860('0x1'));var path=require(_0x7860('0x2'));var timeout=require(_0x7860('0x3'));var express=require(_0x7860('0x4'));var router=express[_0x7860('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7860('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7860('0x7'));var controller=require(_0x7860('0x8'));router[_0x7860('0x9')]('/',auth[_0x7860('0xa')](),controller[_0x7860('0xb')]);router[_0x7860('0x9')](_0x7860('0xc'),auth[_0x7860('0xa')](),controller[_0x7860('0xd')]);router['get'](_0x7860('0xe'),auth[_0x7860('0xa')](),controller[_0x7860('0xf')]);router[_0x7860('0x10')]('/',auth['isAuthenticated'](),controller[_0x7860('0x11')]);router[_0x7860('0x12')](_0x7860('0xe'),auth[_0x7860('0xa')](),controller['update']);router[_0x7860('0x13')](_0x7860('0xe'),auth['isAuthenticated'](),controller[_0x7860('0x14')]);module['exports']=router; \ No newline at end of file +var _0x78f0=['delete','exports','multer','util','path','express','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update'];(function(_0x1143f0,_0x460430){var _0x52ecc0=function(_0x37a7a0){while(--_0x37a7a0){_0x1143f0['push'](_0x1143f0['shift']());}};_0x52ecc0(++_0x460430);}(_0x78f0,0x189));var _0x078f=function(_0x5e5d88,_0xa03ca7){_0x5e5d88=_0x5e5d88-0x0;var _0x371278=_0x78f0[_0x5e5d88];return _0x371278;};'use strict';var multer=require(_0x078f('0x0'));var util=require(_0x078f('0x1'));var path=require(_0x078f('0x2'));var timeout=require('connect-timeout');var express=require(_0x078f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x078f('0x4'));var controller=require(_0x078f('0x5'));router[_0x078f('0x6')]('/',auth[_0x078f('0x7')](),controller[_0x078f('0x8')]);router['get'](_0x078f('0x9'),auth[_0x078f('0x7')](),controller['describe']);router[_0x078f('0x6')](_0x078f('0xa'),auth[_0x078f('0x7')](),controller['show']);router[_0x078f('0xb')]('/',auth[_0x078f('0x7')](),controller[_0x078f('0xc')]);router[_0x078f('0xd')](_0x078f('0xa'),auth[_0x078f('0x7')](),controller[_0x078f('0xe')]);router[_0x078f('0xf')](_0x078f('0xa'),auth[_0x078f('0x7')](),controller['destroy']);module[_0x078f('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index a953f28..7e1628d 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 _0xd914=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','getDataValue','split','sequelize'];(function(_0x3ec359,_0x563c22){var _0x442c1a=function(_0x5ff505){while(--_0x5ff505){_0x3ec359['push'](_0x3ec359['shift']());}};_0x442c1a(++_0x563c22);}(_0xd914,0x17f));var _0x4d91=function(_0x2c27ed,_0x5c50f0){_0x2c27ed=_0x2c27ed-0x0;var _0x597bd1=_0xd914[_0x2c27ed];return _0x597bd1;};'use strict';var Sequelize=require(_0x4d91('0x0'));module[_0x4d91('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x4d91('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4d91('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4d91('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4d91('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4d91('0x2')],'set':function(_0x2db8c5){this['setDataValue'](_0x4d91('0x5'),_0x2db8c5?_0x2db8c5['join'](''):[]);},'get':function(){return this[_0x4d91('0x6')](_0x4d91('0x5'))?this[_0x4d91('0x6')](_0x4d91('0x5'))[_0x4d91('0x7')](''):[];}}}; \ No newline at end of file +var _0x7072=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split'];(function(_0x113f42,_0x537edb){var _0x1057ae=function(_0x483c29){while(--_0x483c29){_0x113f42['push'](_0x113f42['shift']());}};_0x1057ae(++_0x537edb);}(_0x7072,0x138));var _0x2707=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x7072[_0x474bc0];return _0x4b24cf;};'use strict';var Sequelize=require('sequelize');module[_0x2707('0x0')]={'name':{'type':Sequelize[_0x2707('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x2707('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x2707('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x2707('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xfdfa7a){this['setDataValue'](_0x2707('0x4'),_0xfdfa7a?_0xfdfa7a[_0x2707('0x5')](''):[]);},'get':function(){return this[_0x2707('0x6')](_0x2707('0x4'))?this[_0x2707('0x6')](_0x2707('0x4'))[_0x2707('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 140afb5..c430348 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 _0xfdd7=['fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','then','end','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','length','find','create','update','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xfdd7,0x115));var _0x7fdd=function(_0x19a9af,_0x8855ec){_0x19a9af=_0x19a9af-0x0;var _0x359f34=_0xfdd7[_0x19a9af];return _0x359f34;};'use strict';var emlformat=require(_0x7fdd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7fdd('0x1'));var jsonpatch=require(_0x7fdd('0x2'));var rp=require(_0x7fdd('0x3'));var moment=require(_0x7fdd('0x4'));var BPromise=require(_0x7fdd('0x5'));var Mustache=require(_0x7fdd('0x6'));var util=require(_0x7fdd('0x7'));var path=require('path');var sox=require(_0x7fdd('0x8'));var csv=require(_0x7fdd('0x9'));var ejs=require(_0x7fdd('0xa'));var fs=require('fs');var fs_extra=require(_0x7fdd('0xb'));var _=require(_0x7fdd('0xc'));var squel=require(_0x7fdd('0xd'));var crypto=require(_0x7fdd('0xe'));var jsforce=require(_0x7fdd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7fdd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7fdd('0x10'));var authService=require(_0x7fdd('0x11'));var qs=require(_0x7fdd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7fdd('0x13'));var utils=require(_0x7fdd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7fdd('0x15'));var db=require(_0x7fdd('0x16'))['db'];function respondWithStatusCode(_0x18e58a,_0x548149){_0x548149=_0x548149||0xcc;return function(_0x1fd73d){if(_0x1fd73d){return _0x18e58a[_0x7fdd('0x17')](_0x548149);}return _0x18e58a[_0x7fdd('0x18')](_0x548149)['end']();};}function respondWithResult(_0x1479d5,_0x1fa270){_0x1fa270=_0x1fa270||0xc8;return function(_0x2b000b){if(_0x2b000b){return _0x1479d5[_0x7fdd('0x18')](_0x1fa270)[_0x7fdd('0x19')](_0x2b000b);}};}function respondWithFilteredResult(_0x837b2a,_0x2df442){return function(_0x58b64e){if(_0x58b64e){var _0x26342e=typeof _0x2df442[_0x7fdd('0x1a')]==='undefined'&&typeof _0x2df442[_0x7fdd('0x1b')]==='undefined';var _0x5e11ce=_0x58b64e['count'];var _0x4ef5fa=_0x26342e?0x0:_0x2df442[_0x7fdd('0x1a')];var _0x3e1ee9=_0x26342e?_0x58b64e[_0x7fdd('0x1c')]:_0x2df442[_0x7fdd('0x1a')]+_0x2df442['limit'];var _0x2c8a97;if(_0x3e1ee9>=_0x5e11ce){_0x3e1ee9=_0x5e11ce;_0x2c8a97=0xc8;}else{_0x2c8a97=0xce;}_0x837b2a['status'](_0x2c8a97);return _0x837b2a['set'](_0x7fdd('0x1d'),_0x4ef5fa+'-'+_0x3e1ee9+'/'+_0x5e11ce)['json'](_0x58b64e);}return null;};}function patchUpdates(_0x305673){return function(_0x580346){try{jsonpatch[_0x7fdd('0x1e')](_0x580346,_0x305673,!![]);}catch(_0x412685){return BPromise[_0x7fdd('0x1f')](_0x412685);}return _0x580346[_0x7fdd('0x20')]();};}function saveUpdates(_0x1f3945,_0x496f88){return function(_0x3a11b2){if(_0x3a11b2){return _0x3a11b2['update'](_0x1f3945)[_0x7fdd('0x21')](function(_0x982e4){return _0x982e4;});}return null;};}function removeEntity(_0x24532f,_0x337c60){return function(_0x371952){if(_0x371952){return _0x371952['destroy']()[_0x7fdd('0x21')](function(){_0x24532f[_0x7fdd('0x18')](0xcc)[_0x7fdd('0x22')]();});}};}function handleEntityNotFound(_0x1c68d5,_0x29f0ae){return function(_0x165fd8){if(!_0x165fd8){_0x1c68d5['sendStatus'](0x194);}return _0x165fd8;};}function handleError(_0x30892d,_0x3ef1a6){_0x3ef1a6=_0x3ef1a6||0x1f4;return function(_0x2b0ee8){logger[_0x7fdd('0x23')](_0x2b0ee8[_0x7fdd('0x24')]);if(_0x2b0ee8[_0x7fdd('0x25')]){delete _0x2b0ee8['name'];}_0x30892d[_0x7fdd('0x18')](_0x3ef1a6)['send'](_0x2b0ee8);};}exports[_0x7fdd('0x26')]=function(_0x1933b1,_0x3fd54c){var _0x2653e8={},_0xbca361={},_0xf10a42={'count':0x0,'rows':[]};var _0x4ffbaf=_[_0x7fdd('0x27')](db[_0x7fdd('0x28')][_0x7fdd('0x29')],function(_0x2af836){return{'name':_0x2af836[_0x7fdd('0x2a')],'type':_0x2af836[_0x7fdd('0x2b')][_0x7fdd('0x2c')]};});_0xbca361[_0x7fdd('0x2d')]=_[_0x7fdd('0x27')](_0x4ffbaf,_0x7fdd('0x25'));_0xbca361['query']=_[_0x7fdd('0x2e')](_0x1933b1[_0x7fdd('0x2f')]);_0xbca361['filters']=_[_0x7fdd('0x30')](_0xbca361[_0x7fdd('0x2d')],_0xbca361['query']);_0x2653e8[_0x7fdd('0x31')]=_['intersection'](_0xbca361['model'],qs[_0x7fdd('0x32')](_0x1933b1[_0x7fdd('0x2f')]['fields']));_0x2653e8[_0x7fdd('0x31')]=_0x2653e8[_0x7fdd('0x31')]['length']?_0x2653e8[_0x7fdd('0x31')]:_0xbca361[_0x7fdd('0x2d')];if(!_0x1933b1['query'][_0x7fdd('0x33')]('nolimit')){_0x2653e8[_0x7fdd('0x1b')]=qs[_0x7fdd('0x1b')](_0x1933b1[_0x7fdd('0x2f')][_0x7fdd('0x1b')]);_0x2653e8[_0x7fdd('0x1a')]=qs[_0x7fdd('0x1a')](_0x1933b1['query'][_0x7fdd('0x1a')]);}_0x2653e8[_0x7fdd('0x34')]=qs[_0x7fdd('0x35')](_0x1933b1[_0x7fdd('0x2f')][_0x7fdd('0x35')]);_0x2653e8[_0x7fdd('0x36')]=qs['filters'](_['pick'](_0x1933b1[_0x7fdd('0x2f')],_0xbca361[_0x7fdd('0x37')]),_0x4ffbaf);if(_0x1933b1[_0x7fdd('0x2f')][_0x7fdd('0x38')]){_0x2653e8[_0x7fdd('0x36')]=_[_0x7fdd('0x39')](_0x2653e8[_0x7fdd('0x36')],{'$or':_[_0x7fdd('0x27')](_0x4ffbaf,function(_0x5b2038){if(_0x5b2038[_0x7fdd('0x2b')]!==_0x7fdd('0x3a')){var _0x2dede8={};_0x2dede8[_0x5b2038[_0x7fdd('0x25')]]={'$like':'%'+_0x1933b1['query']['filter']+'%'};return _0x2dede8;}})});}_0x2653e8=_[_0x7fdd('0x39')]({},_0x2653e8,_0x1933b1[_0x7fdd('0x3b')]);var _0x116a8b={'where':_0x2653e8['where']};return db['UserProfileSection'][_0x7fdd('0x1c')](_0x116a8b)[_0x7fdd('0x21')](function(_0x42f5c1){_0xf10a42['count']=_0x42f5c1;if(_0x1933b1[_0x7fdd('0x2f')][_0x7fdd('0x3c')]){_0x2653e8[_0x7fdd('0x3d')]=[{'all':!![]}];}return db[_0x7fdd('0x28')]['findAll'](_0x2653e8);})[_0x7fdd('0x21')](function(_0x5c3e23){_0xf10a42[_0x7fdd('0x3e')]=_0x5c3e23;return _0xf10a42;})[_0x7fdd('0x21')](respondWithFilteredResult(_0x3fd54c,_0x2653e8))[_0x7fdd('0x3f')](handleError(_0x3fd54c,null));};exports['show']=function(_0x2ab5d5,_0x38f1bb){var _0xaac317={'raw':![],'where':{'id':_0x2ab5d5[_0x7fdd('0x40')]['id']}},_0x2dec60={};_0x2dec60[_0x7fdd('0x2d')]=_[_0x7fdd('0x2e')](db[_0x7fdd('0x28')][_0x7fdd('0x29')]);_0x2dec60['query']=_[_0x7fdd('0x2e')](_0x2ab5d5[_0x7fdd('0x2f')]);_0x2dec60[_0x7fdd('0x37')]=_[_0x7fdd('0x30')](_0x2dec60[_0x7fdd('0x2d')],_0x2dec60['query']);_0xaac317['attributes']=_[_0x7fdd('0x30')](_0x2dec60[_0x7fdd('0x2d')],qs[_0x7fdd('0x32')](_0x2ab5d5[_0x7fdd('0x2f')][_0x7fdd('0x32')]));_0xaac317[_0x7fdd('0x31')]=_0xaac317[_0x7fdd('0x31')][_0x7fdd('0x41')]?_0xaac317[_0x7fdd('0x31')]:_0x2dec60[_0x7fdd('0x2d')];if(_0x2ab5d5['query'][_0x7fdd('0x3c')]){_0xaac317['include']=[{'all':!![]}];}_0xaac317=_[_0x7fdd('0x39')]({},_0xaac317,_0x2ab5d5[_0x7fdd('0x3b')]);return db[_0x7fdd('0x28')][_0x7fdd('0x42')](_0xaac317)[_0x7fdd('0x21')](handleEntityNotFound(_0x38f1bb,null))['then'](respondWithResult(_0x38f1bb,null))['catch'](handleError(_0x38f1bb,null));};exports[_0x7fdd('0x43')]=function(_0x55bff9,_0x5afcbf){return db[_0x7fdd('0x28')][_0x7fdd('0x43')](_0x55bff9['body'],{})[_0x7fdd('0x21')](respondWithResult(_0x5afcbf,0xc9))[_0x7fdd('0x3f')](handleError(_0x5afcbf,null));};exports[_0x7fdd('0x44')]=function(_0x207f0b,_0x354cd9){if(_0x207f0b[_0x7fdd('0x45')]['id']){delete _0x207f0b[_0x7fdd('0x45')]['id'];}return db[_0x7fdd('0x28')][_0x7fdd('0x42')]({'where':{'id':_0x207f0b['params']['id']}})[_0x7fdd('0x21')](handleEntityNotFound(_0x354cd9,null))[_0x7fdd('0x21')](saveUpdates(_0x207f0b[_0x7fdd('0x45')],null))[_0x7fdd('0x21')](respondWithResult(_0x354cd9,null))[_0x7fdd('0x3f')](handleError(_0x354cd9,null));};exports[_0x7fdd('0x46')]=function(_0x1e5eac,_0x9516cd){return db[_0x7fdd('0x28')][_0x7fdd('0x42')]({'where':{'id':_0x1e5eac[_0x7fdd('0x40')]['id']}})[_0x7fdd('0x21')](handleEntityNotFound(_0x9516cd,null))[_0x7fdd('0x21')](removeEntity(_0x9516cd,null))[_0x7fdd('0x3f')](handleError(_0x9516cd,null));};exports[_0x7fdd('0x47')]=function(_0x210535,_0x465104){return db[_0x7fdd('0x28')]['describe']()[_0x7fdd('0x21')](respondWithResult(_0x465104,null))['catch'](handleError(_0x465104,null));}; \ No newline at end of file +var _0x119a=['moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','keys','catch','create','body','update','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x354dd2,_0x48c889){var _0x3a4d4c=function(_0x3bfcca){while(--_0x3bfcca){_0x354dd2['push'](_0x354dd2['shift']());}};_0x3a4d4c(++_0x48c889);}(_0x119a,0xe3));var _0xa119=function(_0x153433,_0x4d8b05){_0x153433=_0x153433-0x0;var _0x365580=_0x119a[_0x153433];return _0x365580;};'use strict';var emlformat=require(_0xa119('0x0'));var rimraf=require(_0xa119('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa119('0x2'));var rp=require(_0xa119('0x3'));var moment=require(_0xa119('0x4'));var BPromise=require(_0xa119('0x5'));var Mustache=require('mustache');var util=require(_0xa119('0x6'));var path=require(_0xa119('0x7'));var sox=require('sox');var csv=require(_0xa119('0x8'));var ejs=require(_0xa119('0x9'));var fs=require('fs');var fs_extra=require(_0xa119('0xa'));var _=require('lodash');var squel=require(_0xa119('0xb'));var crypto=require(_0xa119('0xc'));var jsforce=require(_0xa119('0xd'));var deskjs=require(_0xa119('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa119('0xf'));var Papa=require('papaparse');var Redis=require(_0xa119('0x10'));var authService=require(_0xa119('0x11'));var qs=require(_0xa119('0x12'));var as=require(_0xa119('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa119('0x14'));var utils=require(_0xa119('0x15'));var config=require(_0xa119('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa119('0x17'))['db'];function respondWithStatusCode(_0x15afd0,_0x20123f){_0x20123f=_0x20123f||0xcc;return function(_0x322e16){if(_0x322e16){return _0x15afd0[_0xa119('0x18')](_0x20123f);}return _0x15afd0[_0xa119('0x19')](_0x20123f)['end']();};}function respondWithResult(_0xbd4d3e,_0x2d71a2){_0x2d71a2=_0x2d71a2||0xc8;return function(_0x235a8a){if(_0x235a8a){return _0xbd4d3e[_0xa119('0x19')](_0x2d71a2)[_0xa119('0x1a')](_0x235a8a);}};}function respondWithFilteredResult(_0x48a742,_0x29f666){return function(_0x2eb076){if(_0x2eb076){var _0x5a13b9=typeof _0x29f666[_0xa119('0x1b')]===_0xa119('0x1c')&&typeof _0x29f666[_0xa119('0x1d')]===_0xa119('0x1c');var _0x57039f=_0x2eb076[_0xa119('0x1e')];var _0xb7d747=_0x5a13b9?0x0:_0x29f666['offset'];var _0x1d6608=_0x5a13b9?_0x2eb076[_0xa119('0x1e')]:_0x29f666[_0xa119('0x1b')]+_0x29f666['limit'];var _0x353d0b;if(_0x1d6608>=_0x57039f){_0x1d6608=_0x57039f;_0x353d0b=0xc8;}else{_0x353d0b=0xce;}_0x48a742['status'](_0x353d0b);return _0x48a742['set'](_0xa119('0x1f'),_0xb7d747+'-'+_0x1d6608+'/'+_0x57039f)['json'](_0x2eb076);}return null;};}function patchUpdates(_0x4c532f){return function(_0x4ab68c){try{jsonpatch[_0xa119('0x20')](_0x4ab68c,_0x4c532f,!![]);}catch(_0xb408c7){return BPromise[_0xa119('0x21')](_0xb408c7);}return _0x4ab68c[_0xa119('0x22')]();};}function saveUpdates(_0x5d855e,_0x219a3a){return function(_0x27b6f8){if(_0x27b6f8){return _0x27b6f8['update'](_0x5d855e)[_0xa119('0x23')](function(_0x49fa69){return _0x49fa69;});}return null;};}function removeEntity(_0x4c1d63,_0x146ce2){return function(_0x512e13){if(_0x512e13){return _0x512e13['destroy']()['then'](function(){_0x4c1d63[_0xa119('0x19')](0xcc)[_0xa119('0x24')]();});}};}function handleEntityNotFound(_0xbc407e,_0x52c013){return function(_0x4dcbdc){if(!_0x4dcbdc){_0xbc407e[_0xa119('0x18')](0x194);}return _0x4dcbdc;};}function handleError(_0x14318c,_0x2feef8){_0x2feef8=_0x2feef8||0x1f4;return function(_0x2a18e7){logger[_0xa119('0x25')](_0x2a18e7[_0xa119('0x26')]);if(_0x2a18e7['name']){delete _0x2a18e7[_0xa119('0x27')];}_0x14318c[_0xa119('0x19')](_0x2feef8)[_0xa119('0x28')](_0x2a18e7);};}exports[_0xa119('0x29')]=function(_0x2d9018,_0x399098){var _0x447808={},_0x5b6f4b={},_0x2a7376={'count':0x0,'rows':[]};var _0x528fd3=_[_0xa119('0x2a')](db[_0xa119('0x2b')][_0xa119('0x2c')],function(_0xd5584a){return{'name':_0xd5584a[_0xa119('0x2d')],'type':_0xd5584a[_0xa119('0x2e')][_0xa119('0x2f')]};});_0x5b6f4b[_0xa119('0x30')]=_[_0xa119('0x2a')](_0x528fd3,'name');_0x5b6f4b['query']=_['keys'](_0x2d9018[_0xa119('0x31')]);_0x5b6f4b[_0xa119('0x32')]=_[_0xa119('0x33')](_0x5b6f4b[_0xa119('0x30')],_0x5b6f4b[_0xa119('0x31')]);_0x447808[_0xa119('0x34')]=_['intersection'](_0x5b6f4b[_0xa119('0x30')],qs[_0xa119('0x35')](_0x2d9018[_0xa119('0x31')]['fields']));_0x447808[_0xa119('0x34')]=_0x447808[_0xa119('0x34')][_0xa119('0x36')]?_0x447808[_0xa119('0x34')]:_0x5b6f4b[_0xa119('0x30')];if(!_0x2d9018[_0xa119('0x31')][_0xa119('0x37')](_0xa119('0x38'))){_0x447808[_0xa119('0x1d')]=qs[_0xa119('0x1d')](_0x2d9018[_0xa119('0x31')][_0xa119('0x1d')]);_0x447808[_0xa119('0x1b')]=qs['offset'](_0x2d9018[_0xa119('0x31')]['offset']);}_0x447808[_0xa119('0x39')]=qs['sort'](_0x2d9018[_0xa119('0x31')][_0xa119('0x3a')]);_0x447808[_0xa119('0x3b')]=qs[_0xa119('0x32')](_[_0xa119('0x3c')](_0x2d9018[_0xa119('0x31')],_0x5b6f4b[_0xa119('0x32')]),_0x528fd3);if(_0x2d9018['query']['filter']){_0x447808[_0xa119('0x3b')]=_[_0xa119('0x3d')](_0x447808[_0xa119('0x3b')],{'$or':_[_0xa119('0x2a')](_0x528fd3,function(_0x591e35){if(_0x591e35[_0xa119('0x2e')]!=='VIRTUAL'){var _0x3b9352={};_0x3b9352[_0x591e35[_0xa119('0x27')]]={'$like':'%'+_0x2d9018[_0xa119('0x31')][_0xa119('0x3e')]+'%'};return _0x3b9352;}})});}_0x447808=_['merge']({},_0x447808,_0x2d9018[_0xa119('0x3f')]);var _0x2271c8={'where':_0x447808[_0xa119('0x3b')]};return db['UserProfileSection'][_0xa119('0x1e')](_0x2271c8)['then'](function(_0x9b961e){_0x2a7376[_0xa119('0x1e')]=_0x9b961e;if(_0x2d9018[_0xa119('0x31')][_0xa119('0x40')]){_0x447808[_0xa119('0x41')]=[{'all':!![]}];}return db[_0xa119('0x2b')][_0xa119('0x42')](_0x447808);})[_0xa119('0x23')](function(_0x2b7437){_0x2a7376[_0xa119('0x43')]=_0x2b7437;return _0x2a7376;})[_0xa119('0x23')](respondWithFilteredResult(_0x399098,_0x447808))['catch'](handleError(_0x399098,null));};exports[_0xa119('0x44')]=function(_0x21c361,_0x25a55f){var _0x44c436={'raw':![],'where':{'id':_0x21c361['params']['id']}},_0xd88ef7={};_0xd88ef7[_0xa119('0x30')]=_[_0xa119('0x45')](db[_0xa119('0x2b')]['rawAttributes']);_0xd88ef7['query']=_[_0xa119('0x45')](_0x21c361['query']);_0xd88ef7['filters']=_['intersection'](_0xd88ef7[_0xa119('0x30')],_0xd88ef7['query']);_0x44c436[_0xa119('0x34')]=_[_0xa119('0x33')](_0xd88ef7['model'],qs[_0xa119('0x35')](_0x21c361['query'][_0xa119('0x35')]));_0x44c436[_0xa119('0x34')]=_0x44c436[_0xa119('0x34')][_0xa119('0x36')]?_0x44c436['attributes']:_0xd88ef7[_0xa119('0x30')];if(_0x21c361[_0xa119('0x31')][_0xa119('0x40')]){_0x44c436[_0xa119('0x41')]=[{'all':!![]}];}_0x44c436=_[_0xa119('0x3d')]({},_0x44c436,_0x21c361['options']);return db[_0xa119('0x2b')]['find'](_0x44c436)[_0xa119('0x23')](handleEntityNotFound(_0x25a55f,null))['then'](respondWithResult(_0x25a55f,null))[_0xa119('0x46')](handleError(_0x25a55f,null));};exports[_0xa119('0x47')]=function(_0x556c3c,_0x524425){return db[_0xa119('0x2b')][_0xa119('0x47')](_0x556c3c[_0xa119('0x48')],{})[_0xa119('0x23')](respondWithResult(_0x524425,0xc9))[_0xa119('0x46')](handleError(_0x524425,null));};exports[_0xa119('0x49')]=function(_0x1f0b52,_0x10cebc){if(_0x1f0b52[_0xa119('0x48')]['id']){delete _0x1f0b52[_0xa119('0x48')]['id'];}return db[_0xa119('0x2b')][_0xa119('0x4a')]({'where':{'id':_0x1f0b52[_0xa119('0x4b')]['id']}})[_0xa119('0x23')](handleEntityNotFound(_0x10cebc,null))[_0xa119('0x23')](saveUpdates(_0x1f0b52[_0xa119('0x48')],null))[_0xa119('0x23')](respondWithResult(_0x10cebc,null))['catch'](handleError(_0x10cebc,null));};exports['destroy']=function(_0x3a4776,_0x35f6b5){return db[_0xa119('0x2b')]['find']({'where':{'id':_0x3a4776[_0xa119('0x4b')]['id']}})[_0xa119('0x23')](handleEntityNotFound(_0x35f6b5,null))['then'](removeEntity(_0x35f6b5,null))[_0xa119('0x46')](handleError(_0x35f6b5,null));};exports['describe']=function(_0x37c416,_0x20cc38){return db[_0xa119('0x2b')][_0xa119('0x4c')]()[_0xa119('0x23')](respondWithResult(_0x20cc38,null))[_0xa119('0x46')](handleError(_0x20cc38,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 9d66c9e..e44e634 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 _0xab95=['bluebird','request-promise','path','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','util','../../config/logger','api','moment'];(function(_0x51301e,_0x35ff89){var _0x1ab7f4=function(_0x109891){while(--_0x109891){_0x51301e['push'](_0x51301e['shift']());}};_0x1ab7f4(++_0x35ff89);}(_0xab95,0xaf));var _0x5ab9=function(_0x5ebd29,_0x5c4a13){_0x5ebd29=_0x5ebd29-0x0;var _0x120879=_0xab95[_0x5ebd29];return _0x120879;};'use strict';var _=require(_0x5ab9('0x0'));var util=require(_0x5ab9('0x1'));var logger=require(_0x5ab9('0x2'))(_0x5ab9('0x3'));var moment=require(_0x5ab9('0x4'));var BPromise=require(_0x5ab9('0x5'));var rp=require(_0x5ab9('0x6'));var fs=require('fs');var path=require(_0x5ab9('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5ab9('0x8'));module[_0x5ab9('0x9')]=function(_0x8f739e,_0x46af13){return _0x8f739e[_0x5ab9('0xa')](_0x5ab9('0xb'),attributes,{'tableName':_0x5ab9('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x5ab9('0xd'),_0x5ab9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b64=['api','moment','bluebird','request-promise','rimraf','./userProfileSection.attributes','exports','define','user_profile_has_sections','sectionId','userProfileId','lodash','util','../../config/logger'];(function(_0x3fba41,_0x39825c){var _0x12e6a2=function(_0x5dda68){while(--_0x5dda68){_0x3fba41['push'](_0x3fba41['shift']());}};_0x12e6a2(++_0x39825c);}(_0x3b64,0x1bd));var _0x43b6=function(_0xf97911,_0x536388){_0xf97911=_0xf97911-0x0;var _0x5cc400=_0x3b64[_0xf97911];return _0x5cc400;};'use strict';var _=require(_0x43b6('0x0'));var util=require(_0x43b6('0x1'));var logger=require(_0x43b6('0x2'))(_0x43b6('0x3'));var moment=require(_0x43b6('0x4'));var BPromise=require(_0x43b6('0x5'));var rp=require(_0x43b6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43b6('0x7'));var config=require('../../config/environment');var attributes=require(_0x43b6('0x8'));module[_0x43b6('0x9')]=function(_0x39612b,_0x4d49e5){return _0x39612b[_0x43b6('0xa')]('UserProfileSection',attributes,{'tableName':_0x43b6('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x43b6('0xc'),_0x43b6('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 d3207a4..9f7a386 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 _0x63a0=['request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfileSection,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x20058a,_0xcc8d68){var _0x27cfce=function(_0x1cc490){while(--_0x1cc490){_0x20058a['push'](_0x20058a['shift']());}};_0x27cfce(++_0xcc8d68);}(_0x63a0,0xe1));var _0x063a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x63a0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x063a('0x0'));var util=require(_0x063a('0x1'));var moment=require(_0x063a('0x2'));var BPromise=require(_0x063a('0x3'));var rs=require(_0x063a('0x4'));var fs=require('fs');var Redis=require(_0x063a('0x5'));var db=require(_0x063a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x063a('0x7'))(_0x063a('0x8'));var config=require(_0x063a('0x9'));var jayson=require(_0x063a('0xa'));var client=jayson[_0x063a('0xb')][_0x063a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x177c6f,_0x336581,_0x2fe4a6){return new BPromise(function(_0x2dae9d,_0xbfbf7d){return client['request'](_0x177c6f,_0x2fe4a6)[_0x063a('0xd')](function(_0x2c9b3e){logger[_0x063a('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x336581,_0x063a('0xf'));logger[_0x063a('0x10')](_0x063a('0x11'),_0x336581,_0x063a('0xf'),JSON[_0x063a('0x12')](_0x2c9b3e));if(_0x2c9b3e[_0x063a('0x13')]){if(_0x2c9b3e[_0x063a('0x13')][_0x063a('0x14')]===0x1f4){logger[_0x063a('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x336581,_0x2c9b3e[_0x063a('0x13')][_0x063a('0x15')]);return _0xbfbf7d(_0x2c9b3e[_0x063a('0x13')][_0x063a('0x15')]);}logger[_0x063a('0x13')](_0x063a('0x16'),_0x336581,_0x2c9b3e[_0x063a('0x13')][_0x063a('0x15')]);return _0x2dae9d(_0x2c9b3e[_0x063a('0x13')]['message']);}else{logger[_0x063a('0xe')](_0x063a('0x16'),_0x336581,_0x063a('0xf'));_0x2dae9d(_0x2c9b3e['result']['message']);}})[_0x063a('0x17')](function(_0x5f2814){logger[_0x063a('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x336581,_0x5f2814);_0xbfbf7d(_0x5f2814);});});} \ No newline at end of file +var _0xd464=['result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message'];(function(_0x337570,_0xdd86bc){var _0x27b1fb=function(_0x567d79){while(--_0x567d79){_0x337570['push'](_0x337570['shift']());}};_0x27b1fb(++_0xdd86bc);}(_0xd464,0x162));var _0x4d46=function(_0x1d1fe8,_0x27d218){_0x1d1fe8=_0x1d1fe8-0x0;var _0x3efdd8=_0xd464[_0x1d1fe8];return _0x3efdd8;};'use strict';var _=require(_0x4d46('0x0'));var util=require(_0x4d46('0x1'));var moment=require('moment');var BPromise=require(_0x4d46('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d46('0x3'));var db=require(_0x4d46('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d46('0x5'))(_0x4d46('0x6'));var config=require(_0x4d46('0x7'));var jayson=require(_0x4d46('0x8'));var client=jayson[_0x4d46('0x9')][_0x4d46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x131a7c,_0x3da5dc,_0x3bed73){return new BPromise(function(_0x342b0e,_0x5628a4){return client[_0x4d46('0xb')](_0x131a7c,_0x3bed73)['then'](function(_0x279109){logger[_0x4d46('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x3da5dc,_0x4d46('0xd'));logger[_0x4d46('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x3da5dc,'request\x20sent',JSON[_0x4d46('0xf')](_0x279109));if(_0x279109['error']){if(_0x279109[_0x4d46('0x10')][_0x4d46('0x11')]===0x1f4){logger[_0x4d46('0x10')](_0x4d46('0x12'),_0x3da5dc,_0x279109[_0x4d46('0x10')][_0x4d46('0x13')]);return _0x5628a4(_0x279109[_0x4d46('0x10')][_0x4d46('0x13')]);}logger['error'](_0x4d46('0x12'),_0x3da5dc,_0x279109['error']['message']);return _0x342b0e(_0x279109[_0x4d46('0x10')]['message']);}else{logger[_0x4d46('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x3da5dc,_0x4d46('0xd'));_0x342b0e(_0x279109[_0x4d46('0x14')][_0x4d46('0x13')]);}})[_0x4d46('0x15')](function(_0x311f7b){logger[_0x4d46('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x3da5dc,_0x311f7b);_0x5628a4(_0x311f7b);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index c667fa1..44618f3 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5886ea,_0xf1a4b5){var _0x206a01=function(_0x1be4d5){while(--_0x1be4d5){_0x5886ea['push'](_0x5886ea['shift']());}};_0x206a01(++_0xf1a4b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x1710c9,_0xabe4bd){var _0x22abb6=function(_0x5d15b0){while(--_0x5d15b0){_0x1710c9['push'](_0x1710c9['shift']());}};_0x22abb6(++_0xabe4bd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0xcb91[_0x3430aa];return _0x2ac5c;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b1b0aff..e7a12c2 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 _0xd5a1=['INTEGER'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xd5a1,0x162));var _0x1d5a=function(_0x5150c6,_0x56feec){_0x5150c6=_0x5150c6-0x0;var _0x267ebe=_0xd5a1[_0x5150c6];return _0x267ebe;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x1d5a('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf362=['exports'];(function(_0x6a72b2,_0x2b5d6f){var _0x165781=function(_0x373384){while(--_0x373384){_0x6a72b2['push'](_0x6a72b2['shift']());}};_0x165781(++_0x2b5d6f);}(_0xf362,0xb3));var _0x2f36=function(_0x13fa27,_0x2fe942){_0x13fa27=_0x13fa27-0x0;var _0x361af9=_0xf362[_0x13fa27];return _0x361af9;};'use strict';var Sequelize=require('sequelize');module[_0x2f36('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 81bbde0..1226cd1 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 _0x4819=['user_has_sms_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','UserSmsQueue'];(function(_0x37fb95,_0x2f5e9a){var _0x1cbf1c=function(_0xff2fa7){while(--_0xff2fa7){_0x37fb95['push'](_0x37fb95['shift']());}};_0x1cbf1c(++_0x2f5e9a);}(_0x4819,0xcd));var _0x9481=function(_0x19865b,_0x279613){_0x19865b=_0x19865b-0x0;var _0x186b3a=_0x4819[_0x19865b];return _0x186b3a;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a6d=['util','api','moment','bluebird','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x3a6d,0x143));var _0xd3a6=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x3a6d[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var logger=require('../../config/logger')(_0xd3a6('0x2'));var moment=require(_0xd3a6('0x3'));var BPromise=require(_0xd3a6('0x4'));var rp=require(_0xd3a6('0x5'));var fs=require('fs');var path=require(_0xd3a6('0x6'));var rimraf=require('rimraf');var config=require(_0xd3a6('0x7'));var attributes=require(_0xd3a6('0x8'));module[_0xd3a6('0x9')]=function(_0x1fc450,_0x25b042){return _0x1fc450[_0xd3a6('0xa')]('UserSmsQueue',attributes,{'tableName':_0xd3a6('0xb'),'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 8948301..72ca873 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 _0xd830=['../../config/utils','client','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','util','bluebird','randomstring','../../mysqldb'];(function(_0x21d0db,_0x458cab){var _0x454676=function(_0x173d20){while(--_0x173d20){_0x21d0db['push'](_0x21d0db['shift']());}};_0x454676(++_0x458cab);}(_0xd830,0x10a));var _0x0d83=function(_0x435550,_0x49abd3){_0x435550=_0x435550-0x0;var _0x17aeed=_0xd830[_0x435550];return _0x17aeed;};'use strict';var _=require('lodash');var util=require(_0x0d83('0x0'));var moment=require('moment');var BPromise=require(_0x0d83('0x1'));var rs=require(_0x0d83('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d83('0x3'))['db'];var utils=require(_0x0d83('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d83('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe8365f,_0x58eac4,_0x55dc67){return new BPromise(function(_0x44302e,_0x659e1f){return client[_0x0d83('0x6')](_0xe8365f,_0x55dc67)['then'](function(_0x1a79b5){logger[_0x0d83('0x7')](_0x0d83('0x8'),_0x58eac4,_0x0d83('0x9'));logger[_0x0d83('0xa')](_0x0d83('0xb'),_0x58eac4,'request\x20sent',JSON['stringify'](_0x1a79b5));if(_0x1a79b5[_0x0d83('0xc')]){if(_0x1a79b5[_0x0d83('0xc')][_0x0d83('0xd')]===0x1f4){logger[_0x0d83('0xc')](_0x0d83('0x8'),_0x58eac4,_0x1a79b5[_0x0d83('0xc')][_0x0d83('0xe')]);return _0x659e1f(_0x1a79b5[_0x0d83('0xc')][_0x0d83('0xe')]);}logger[_0x0d83('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x58eac4,_0x1a79b5[_0x0d83('0xc')][_0x0d83('0xe')]);return _0x44302e(_0x1a79b5[_0x0d83('0xc')][_0x0d83('0xe')]);}else{logger[_0x0d83('0x7')]('UserSmsQueue,\x20%s,\x20%s',_0x58eac4,_0x0d83('0x9'));_0x44302e(_0x1a79b5['result'][_0x0d83('0xe')]);}})['catch'](function(_0x507bb8){logger[_0x0d83('0xc')](_0x0d83('0x8'),_0x58eac4,_0x507bb8);_0x659e1f(_0x507bb8);});});} \ No newline at end of file +var _0x6586=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x214a25,_0x15071d){var _0x405988=function(_0x5c6fc1){while(--_0x5c6fc1){_0x214a25['push'](_0x214a25['shift']());}};_0x405988(++_0x15071d);}(_0x6586,0x1d8));var _0x6658=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x6586[_0x4bb66f];return _0xf2772f;};'use strict';var _=require(_0x6658('0x0'));var util=require(_0x6658('0x1'));var moment=require(_0x6658('0x2'));var BPromise=require(_0x6658('0x3'));var rs=require(_0x6658('0x4'));var fs=require('fs');var Redis=require(_0x6658('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6658('0x6'));var logger=require(_0x6658('0x7'))(_0x6658('0x8'));var config=require(_0x6658('0x9'));var jayson=require(_0x6658('0xa'));var client=jayson[_0x6658('0xb')][_0x6658('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39b0e3,_0x162bd5,_0x4d0324){return new BPromise(function(_0x4ee57d,_0x5c8457){return client['request'](_0x39b0e3,_0x4d0324)[_0x6658('0xd')](function(_0x57733f){logger[_0x6658('0xe')](_0x6658('0xf'),_0x162bd5,_0x6658('0x10'));logger[_0x6658('0x11')](_0x6658('0x12'),_0x162bd5,'request\x20sent',JSON[_0x6658('0x13')](_0x57733f));if(_0x57733f[_0x6658('0x14')]){if(_0x57733f[_0x6658('0x14')][_0x6658('0x15')]===0x1f4){logger['error'](_0x6658('0xf'),_0x162bd5,_0x57733f[_0x6658('0x14')][_0x6658('0x16')]);return _0x5c8457(_0x57733f[_0x6658('0x14')]['message']);}logger['error'](_0x6658('0xf'),_0x162bd5,_0x57733f[_0x6658('0x14')][_0x6658('0x16')]);return _0x4ee57d(_0x57733f[_0x6658('0x14')]['message']);}else{logger[_0x6658('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x162bd5,_0x6658('0x10'));_0x4ee57d(_0x57733f[_0x6658('0x17')][_0x6658('0x16')]);}})[_0x6658('0x18')](function(_0x578abc){logger[_0x6658('0x14')](_0x6658('0xf'),_0x162bd5,_0x578abc);_0x5c8457(_0x578abc);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index fa4e488..d75aef1 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 _0x7a06=['exports','INTEGER','sequelize'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x7a06,0xb9));var _0x67a0=function(_0x42ab00,_0x59a747){_0x42ab00=_0x42ab00-0x0;var _0x407717=_0x7a06[_0x42ab00];return _0x407717;};'use strict';var Sequelize=require(_0x67a0('0x0'));module[_0x67a0('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x67a0('0x2')]}}; \ No newline at end of file +var _0x50b7=['exports','INTEGER','sequelize'];(function(_0x509572,_0x5c4ee9){var _0x579f64=function(_0x320ae1){while(--_0x320ae1){_0x509572['push'](_0x509572['shift']());}};_0x579f64(++_0x5c4ee9);}(_0x50b7,0xa1));var _0x750b=function(_0x55dedb,_0x36ca16){_0x55dedb=_0x55dedb-0x0;var _0x589c6a=_0x50b7[_0x55dedb];return _0x589c6a;};'use strict';var Sequelize=require(_0x750b('0x0'));module[_0x750b('0x1')]={'UserId':{'type':Sequelize[_0x750b('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x750b('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 477d4e2..da2613c 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(_0x5c5c51,_0xd5cf09){var _0x68b56c=function(_0x3a1a49){while(--_0x3a1a49){_0x5c5c51['push'](_0x5c5c51['shift']());}};_0x68b56c(++_0xd5cf09);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x55a183,_0x16de35){var _0x4ce230=function(_0x40e50b){while(--_0x40e50b){_0x55a183['push'](_0x55a183['shift']());}};_0x4ce230(++_0x16de35);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 617759f..e30ff87 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2fecf2,_0x25ef12){var _0x30cbd8=function(_0x3d78f6){while(--_0x3d78f6){_0x2fecf2['push'](_0x2fecf2['shift']());}};_0x30cbd8(++_0x25ef12);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5c39b7,_0x5cb0a2){var _0x2702dc=function(_0x5d2ec9){while(--_0x5d2ec9){_0x5c39b7['push'](_0x5c39b7['shift']());}};_0x2702dc(++_0x5cb0a2);}(_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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 43e641f..e37c4bb 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 _0xb3dd=['sequelize','exports'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0xb3dd,0xce));var _0xdb3d=function(_0x215560,_0x508a45){_0x215560=_0x215560-0x0;var _0x100cdd=_0xb3dd[_0x215560];return _0x100cdd;};'use strict';var Sequelize=require(_0xdb3d('0x0'));module[_0xdb3d('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe933=['INTEGER','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe933,0x103));var _0x3e93=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xe933[_0x1589dd];return _0x1bddd1;};'use strict';var Sequelize=require(_0x3e93('0x0'));module[_0x3e93('0x1')]={'penalty':{'type':Sequelize[_0x3e93('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 8581cd1..10040d1 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 _0xc395=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x4080e4,_0x3406c5){var _0x285b1e=function(_0x12d3ef){while(--_0x12d3ef){_0x4080e4['push'](_0x4080e4['shift']());}};_0x285b1e(++_0x3406c5);}(_0xc395,0x186));var _0x5c39=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0xc395[_0xf48cce];return _0x2a5c38;};'use strict';var _=require('lodash');var util=require(_0x5c39('0x0'));var logger=require('../../config/logger')(_0x5c39('0x1'));var moment=require(_0x5c39('0x2'));var BPromise=require(_0x5c39('0x3'));var rp=require(_0x5c39('0x4'));var fs=require('fs');var path=require(_0x5c39('0x5'));var rimraf=require(_0x5c39('0x6'));var config=require(_0x5c39('0x7'));var attributes=require(_0x5c39('0x8'));module[_0x5c39('0x9')]=function(_0x48851e,_0x14b3eb){return _0x48851e[_0x5c39('0xa')](_0x5c39('0xb'),attributes,{'tableName':_0x5c39('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47d2=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x146907,_0x541dcb){var _0x47e370=function(_0x1b7984){while(--_0x1b7984){_0x146907['push'](_0x146907['shift']());}};_0x47e370(++_0x541dcb);}(_0x47d2,0x12c));var _0x247d=function(_0x1657fa,_0xc8dd45){_0x1657fa=_0x1657fa-0x0;var _0x33c9ca=_0x47d2[_0x1657fa];return _0x33c9ca;};'use strict';var _=require(_0x247d('0x0'));var util=require('util');var logger=require(_0x247d('0x1'))(_0x247d('0x2'));var moment=require(_0x247d('0x3'));var BPromise=require(_0x247d('0x4'));var rp=require(_0x247d('0x5'));var fs=require('fs');var path=require(_0x247d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x247d('0x7'));module[_0x247d('0x8')]=function(_0x2d3cdf,_0x1e1012){return _0x2d3cdf[_0x247d('0x9')](_0x247d('0xa'),attributes,{'tableName':_0x247d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 6ab1c4a..54f81b9 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 _0x02f2=['request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','client','http'];(function(_0x1aab74,_0x38a57b){var _0x396af2=function(_0x1c2e0d){while(--_0x1c2e0d){_0x1aab74['push'](_0x1aab74['shift']());}};_0x396af2(++_0x38a57b);}(_0x02f2,0x19b));var _0x202f=function(_0x279604,_0x32d606){_0x279604=_0x279604-0x0;var _0xd7e4c7=_0x02f2[_0x279604];return _0xd7e4c7;};'use strict';var _=require(_0x202f('0x0'));var util=require(_0x202f('0x1'));var moment=require(_0x202f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x202f('0x3'))['db'];var utils=require(_0x202f('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x202f('0x5')][_0x202f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x19bbc2,_0x50ea71,_0x385bed){return new BPromise(function(_0x3a811f,_0x3a5ffc){return client[_0x202f('0x7')](_0x19bbc2,_0x385bed)[_0x202f('0x8')](function(_0x194dd5){logger[_0x202f('0x9')](_0x202f('0xa'),_0x50ea71,_0x202f('0xb'));logger[_0x202f('0xc')](_0x202f('0xd'),_0x50ea71,'request\x20sent',JSON[_0x202f('0xe')](_0x194dd5));if(_0x194dd5[_0x202f('0xf')]){if(_0x194dd5['error'][_0x202f('0x10')]===0x1f4){logger[_0x202f('0xf')](_0x202f('0xa'),_0x50ea71,_0x194dd5[_0x202f('0xf')][_0x202f('0x11')]);return _0x3a5ffc(_0x194dd5['error']['message']);}logger[_0x202f('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x50ea71,_0x194dd5[_0x202f('0xf')]['message']);return _0x3a811f(_0x194dd5[_0x202f('0xf')]['message']);}else{logger[_0x202f('0x9')]('UserVoiceQueue,\x20%s,\x20%s',_0x50ea71,_0x202f('0xb'));_0x3a811f(_0x194dd5['result'][_0x202f('0x11')]);}})[_0x202f('0x12')](function(_0x34dcb7){logger[_0x202f('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x50ea71,_0x34dcb7);_0x3a5ffc(_0x34dcb7);});});} \ No newline at end of file +var _0x5628=['error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x9a3dff,_0x338109){var _0x29295b=function(_0x1576fd){while(--_0x1576fd){_0x9a3dff['push'](_0x9a3dff['shift']());}};_0x29295b(++_0x338109);}(_0x5628,0x65));var _0x8562=function(_0x276ccf,_0x540a27){_0x276ccf=_0x276ccf-0x0;var _0x2d73a3=_0x5628[_0x276ccf];return _0x2d73a3;};'use strict';var _=require(_0x8562('0x0'));var util=require('util');var moment=require(_0x8562('0x1'));var BPromise=require(_0x8562('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8562('0x3'));var db=require(_0x8562('0x4'))['db'];var utils=require(_0x8562('0x5'));var logger=require(_0x8562('0x6'))(_0x8562('0x7'));var config=require(_0x8562('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8562('0x9')][_0x8562('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x568a5a,_0xa81ee8,_0x5b3287){return new BPromise(function(_0x159101,_0x29ff1a){return client[_0x8562('0xb')](_0x568a5a,_0x5b3287)[_0x8562('0xc')](function(_0x29bb9c){logger[_0x8562('0xd')](_0x8562('0xe'),_0xa81ee8,_0x8562('0xf'));logger[_0x8562('0x10')](_0x8562('0x11'),_0xa81ee8,_0x8562('0xf'),JSON[_0x8562('0x12')](_0x29bb9c));if(_0x29bb9c[_0x8562('0x13')]){if(_0x29bb9c[_0x8562('0x13')][_0x8562('0x14')]===0x1f4){logger[_0x8562('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0xa81ee8,_0x29bb9c[_0x8562('0x13')][_0x8562('0x15')]);return _0x29ff1a(_0x29bb9c[_0x8562('0x13')]['message']);}logger[_0x8562('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0xa81ee8,_0x29bb9c[_0x8562('0x13')][_0x8562('0x15')]);return _0x159101(_0x29bb9c[_0x8562('0x13')][_0x8562('0x15')]);}else{logger['info'](_0x8562('0xe'),_0xa81ee8,_0x8562('0xf'));_0x159101(_0x29bb9c[_0x8562('0x16')][_0x8562('0x15')]);}})[_0x8562('0x17')](function(_0x5e89cf){logger[_0x8562('0x13')](_0x8562('0xe'),_0xa81ee8,_0x5e89cf);_0x29ff1a(_0x5e89cf);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index a4a5ccd..99fff7e 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3e4a61,_0x59a7c0){var _0x2361b5=function(_0x218adf){while(--_0x218adf){_0x3e4a61['push'](_0x3e4a61['shift']());}};_0x2361b5(++_0x59a7c0);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3992d4,_0x18de26){var _0x42fdfb=function(_0x2d7a73){while(--_0x2d7a73){_0x3992d4['push'](_0x3992d4['shift']());}};_0x42fdfb(++_0x18de26);}(_0xedd9,0xfc));var _0x9edd=function(_0x23b6ec,_0x193e32){_0x23b6ec=_0x23b6ec-0x0;var _0x18b9e7=_0xedd9[_0x23b6ec];return _0x18b9e7;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index a8d9174..46f5f89 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 _0x4339=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x3eabbd,_0x60102f){var _0x16ccac=function(_0x310a4f){while(--_0x310a4f){_0x3eabbd['push'](_0x3eabbd['shift']());}};_0x16ccac(++_0x60102f);}(_0x4339,0x146));var _0x9433=function(_0x4d497f,_0xee4daa){_0x4d497f=_0x4d497f-0x0;var _0x440ba2=_0x4339[_0x4d497f];return _0x440ba2;};'use strict';var Sequelize=require(_0x9433('0x0'));module[_0x9433('0x1')]={'uniqueid':{'type':Sequelize[_0x9433('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x9433('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x9433('0x3')},'UserId':{'type':Sequelize[_0x9433('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9433('0x4')],'allowNull':![],'unique':_0x9433('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x9433('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x9433('0x4')],'allowNull':![],'unique':_0x9433('0x5'),'comment':_0x9433('0x3')},'penalty':{'type':Sequelize[_0x9433('0x2')](0xb),'defaultValue':0x0,'comment':_0x9433('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x9433('0x3')}}; \ No newline at end of file +var _0xc023=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc023,0x8f));var _0x3c02=function(_0x188a2a,_0x368961){_0x188a2a=_0x188a2a-0x0;var _0x38598a=_0xc023[_0x188a2a];return _0x38598a;};'use strict';var Sequelize=require(_0x3c02('0x0'));module[_0x3c02('0x1')]={'uniqueid':{'type':Sequelize[_0x3c02('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3c02('0x3')},'membername':{'type':Sequelize[_0x3c02('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3c02('0x4')],'allowNull':![],'unique':_0x3c02('0x5'),'comment':_0x3c02('0x3')},'VoiceQueueId':{'type':Sequelize[_0x3c02('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x3c02('0x4')],'allowNull':![],'unique':_0x3c02('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x3c02('0x2')](0xb),'defaultValue':0x0,'comment':_0x3c02('0x3')},'paused':{'type':Sequelize[_0x3c02('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index eb06abd..db3e80e 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 _0xa1a4=['hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3b6ffa,_0x46c2d1){var _0x3735ed=function(_0x4133c3){while(--_0x4133c3){_0x3b6ffa['push'](_0x3b6ffa['shift']());}};_0x3735ed(++_0x46c2d1);}(_0xa1a4,0x79));var _0x4a1a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa1a4[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require(_0x4a1a('0x0'));var UserVoiceQueueRt=require(_0x4a1a('0x1'))['db'][_0x4a1a('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x4a1a('0x3')](0x0);var events={'afterCreate':_0x4a1a('0x4'),'afterUpdate':_0x4a1a('0x5'),'afterDestroy':_0x4a1a('0x6')};function emitEvent(_0xe2b79){return function(_0x1417e1,_0x454efb,_0x45a63d){UserVoiceQueueRtEvents[_0x4a1a('0x7')](_0xe2b79+':'+_0x1417e1['id'],_0x1417e1);UserVoiceQueueRtEvents[_0x4a1a('0x7')](_0xe2b79,_0x1417e1);_0x45a63d(null);};}for(var e in events){if(events[_0x4a1a('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x4a1a('0x9')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x41bd=['update','remove','emit','hook','exports','events','../../mysqldb','UserVoiceQueueRt','save'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x41bd,0x113));var _0xd41b=function(_0x321696,_0x1ab7fe){_0x321696=_0x321696-0x0;var _0x2eb196=_0x41bd[_0x321696];return _0x2eb196;};'use strict';var EventEmitter=require(_0xd41b('0x0'));var UserVoiceQueueRt=require(_0xd41b('0x1'))['db'][_0xd41b('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd41b('0x3'),'afterUpdate':_0xd41b('0x4'),'afterDestroy':_0xd41b('0x5')};function emitEvent(_0x245244){return function(_0x2bf09b,_0x523a16,_0x5474b6){UserVoiceQueueRtEvents[_0xd41b('0x6')](_0x245244+':'+_0x2bf09b['id'],_0x2bf09b);UserVoiceQueueRtEvents[_0xd41b('0x6')](_0x245244,_0x2bf09b);_0x5474b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xd41b('0x7')](e,emitEvent(event));}}module[_0xd41b('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index e7b3ccd..f5c4936 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 _0x78d7=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0xe248ab,_0xabd446){var _0x3e4f69=function(_0x52709d){while(--_0x52709d){_0xe248ab['push'](_0xe248ab['shift']());}};_0x3e4f69(++_0xabd446);}(_0x78d7,0x156));var _0x778d=function(_0x4fb8d7,_0x3e5017){_0x4fb8d7=_0x4fb8d7-0x0;var _0x228ba3=_0x78d7[_0x4fb8d7];return _0x228ba3;};'use strict';var _=require(_0x778d('0x0'));var util=require(_0x778d('0x1'));var logger=require(_0x778d('0x2'))('api');var moment=require(_0x778d('0x3'));var BPromise=require('bluebird');var rp=require(_0x778d('0x4'));var fs=require('fs');var path=require(_0x778d('0x5'));var rimraf=require(_0x778d('0x6'));var config=require(_0x778d('0x7'));var attributes=require(_0x778d('0x8'));module[_0x778d('0x9')]=function(_0x48a00c,_0x576bd3){return _0x48a00c[_0x778d('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0x778d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56dd=['./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x8edb3e,_0x468878){var _0x36f816=function(_0x128b2d){while(--_0x128b2d){_0x8edb3e['push'](_0x8edb3e['shift']());}};_0x36f816(++_0x468878);}(_0x56dd,0x101));var _0xd56d=function(_0x1c31c7,_0x16cf7d){_0x1c31c7=_0x1c31c7-0x0;var _0x21316c=_0x56dd[_0x1c31c7];return _0x21316c;};'use strict';var _=require('lodash');var util=require(_0xd56d('0x0'));var logger=require('../../config/logger')(_0xd56d('0x1'));var moment=require('moment');var BPromise=require(_0xd56d('0x2'));var rp=require(_0xd56d('0x3'));var fs=require('fs');var path=require(_0xd56d('0x4'));var rimraf=require(_0xd56d('0x5'));var config=require(_0xd56d('0x6'));var attributes=require(_0xd56d('0x7'));module[_0xd56d('0x8')]=function(_0x4cf196,_0x13c4c6){return _0x4cf196[_0xd56d('0x9')]('UserVoiceQueueRt',attributes,{'tableName':_0xd56d('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 42031cf..6b74df0 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 _0x4253=['message','info','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','sequelize','COUNT','outboundQueuePauses','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','request','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x12f74b,_0x19eb55){var _0x5603a3=function(_0x3783f5){while(--_0x3783f5){_0x12f74b['push'](_0x12f74b['shift']());}};_0x5603a3(++_0x19eb55);}(_0x4253,0x196));var _0x3425=function(_0x3e5f69,_0x1eb2b1){_0x3e5f69=_0x3e5f69-0x0;var _0x55df21=_0x4253[_0x3e5f69];return _0x55df21;};'use strict';var _=require(_0x3425('0x0'));var util=require(_0x3425('0x1'));var moment=require(_0x3425('0x2'));var BPromise=require(_0x3425('0x3'));var rs=require(_0x3425('0x4'));var fs=require('fs');var Redis=require(_0x3425('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3425('0x6'));var logger=require('../../config/logger')(_0x3425('0x7'));var config=require('../../config/environment');var jayson=require(_0x3425('0x8'));var client=jayson[_0x3425('0x9')][_0x3425('0xa')]({'port':0x232a});config['redis']=_[_0x3425('0xb')](config[_0x3425('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3425('0xd'))(new Redis(config[_0x3425('0xc')]));require(_0x3425('0xe'))[_0x3425('0xf')](socket);function respondWithRpcPromise(_0x1d5284,_0x43cae4,_0x4127e6){return new BPromise(function(_0x30dd92,_0x46a3f1){return client[_0x3425('0x10')](_0x1d5284,_0x4127e6)['then'](function(_0x3d28e9){logger['info'](_0x3425('0x11'),_0x43cae4,'request\x20sent');logger['debug'](_0x3425('0x12'),_0x43cae4,_0x3425('0x13'),JSON[_0x3425('0x14')](_0x3d28e9));if(_0x3d28e9[_0x3425('0x15')]){if(_0x3d28e9[_0x3425('0x15')][_0x3425('0x16')]===0x1f4){logger[_0x3425('0x15')](_0x3425('0x11'),_0x43cae4,_0x3d28e9[_0x3425('0x15')]['message']);return _0x46a3f1(_0x3d28e9[_0x3425('0x15')][_0x3425('0x17')]);}logger[_0x3425('0x15')](_0x3425('0x11'),_0x43cae4,_0x3d28e9[_0x3425('0x15')][_0x3425('0x17')]);return _0x30dd92(_0x3d28e9[_0x3425('0x15')]['message']);}else{logger[_0x3425('0x18')](_0x3425('0x11'),_0x43cae4,_0x3425('0x13'));_0x30dd92(_0x3d28e9['result'][_0x3425('0x17')]);}})[_0x3425('0x19')](function(_0x38ee32){logger[_0x3425('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x43cae4,_0x38ee32);_0x46a3f1(_0x38ee32);});});}exports[_0x3425('0x1a')]=function(_0x331dfe){var _0x37134b=this;return new Promise(function(_0x39a097,_0x1b0905){return db[_0x3425('0x1b')]['findAll']({'raw':_0x331dfe['options']?_0x331dfe[_0x3425('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x331dfe[_0x3425('0x1c')]?_0x331dfe['options']['where']||null:null,'attributes':[[db[_0x3425('0x1d')]['fn'](_0x3425('0x1e'),db[_0x3425('0x1d')]['fn']('IF',db['sequelize']['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x3425('0x1f')]]})['then'](function(_0x43d43b){logger[_0x3425('0x18')](_0x3425('0x1a'),_0x331dfe);logger[_0x3425('0x20')]('GetVoiceQueueRtPauses',_0x331dfe,JSON[_0x3425('0x14')](_0x43d43b));_0x39a097(_0x43d43b);})[_0x3425('0x19')](function(_0x47decc){logger[_0x3425('0x15')](_0x3425('0x1a'),_0x47decc['message'],_0x331dfe);_0x1b0905(_0x37134b[_0x3425('0x15')](0x1f4,_0x47decc[_0x3425('0x17')]));});});}; \ No newline at end of file +var _0x8ba8=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UserVoiceQueueRt','findAll','options','where','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x566667,_0x3f99c2){var _0x277136=function(_0x129ea0){while(--_0x129ea0){_0x566667['push'](_0x566667['shift']());}};_0x277136(++_0x3f99c2);}(_0x8ba8,0x198));var _0x88ba=function(_0x5b965,_0x37831b){_0x5b965=_0x5b965-0x0;var _0x5ab77f=_0x8ba8[_0x5b965];return _0x5ab77f;};'use strict';var _=require(_0x88ba('0x0'));var util=require(_0x88ba('0x1'));var moment=require(_0x88ba('0x2'));var BPromise=require(_0x88ba('0x3'));var rs=require(_0x88ba('0x4'));var fs=require('fs');var Redis=require(_0x88ba('0x5'));var db=require(_0x88ba('0x6'))['db'];var utils=require(_0x88ba('0x7'));var logger=require(_0x88ba('0x8'))(_0x88ba('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x88ba('0xa')]({'port':0x232a});config[_0x88ba('0xb')]=_[_0x88ba('0xc')](config['redis'],{'host':_0x88ba('0xd'),'port':0x18eb});var socket=require(_0x88ba('0xe'))(new Redis(config[_0x88ba('0xb')]));require('./userVoiceQueueRt.socket')[_0x88ba('0xf')](socket);function respondWithRpcPromise(_0x35ab8a,_0x486a1b,_0x4059d4){return new BPromise(function(_0xff9632,_0x830806){return client[_0x88ba('0x10')](_0x35ab8a,_0x4059d4)[_0x88ba('0x11')](function(_0x7eb450){logger['info'](_0x88ba('0x12'),_0x486a1b,_0x88ba('0x13'));logger['debug'](_0x88ba('0x14'),_0x486a1b,_0x88ba('0x13'),JSON[_0x88ba('0x15')](_0x7eb450));if(_0x7eb450[_0x88ba('0x16')]){if(_0x7eb450[_0x88ba('0x16')][_0x88ba('0x17')]===0x1f4){logger[_0x88ba('0x16')](_0x88ba('0x12'),_0x486a1b,_0x7eb450[_0x88ba('0x16')][_0x88ba('0x18')]);return _0x830806(_0x7eb450[_0x88ba('0x16')][_0x88ba('0x18')]);}logger[_0x88ba('0x16')](_0x88ba('0x12'),_0x486a1b,_0x7eb450[_0x88ba('0x16')][_0x88ba('0x18')]);return _0xff9632(_0x7eb450[_0x88ba('0x16')][_0x88ba('0x18')]);}else{logger[_0x88ba('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x486a1b,'request\x20sent');_0xff9632(_0x7eb450[_0x88ba('0x1a')][_0x88ba('0x18')]);}})[_0x88ba('0x1b')](function(_0x29a292){logger[_0x88ba('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x486a1b,_0x29a292);_0x830806(_0x29a292);});});}exports['GetVoiceQueueRtPauses']=function(_0xb93fbd){var _0x3b0257=this;return new Promise(function(_0x228ee1,_0x26bbf0){return db[_0x88ba('0x1c')][_0x88ba('0x1d')]({'raw':_0xb93fbd[_0x88ba('0x1e')]?_0xb93fbd[_0x88ba('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xb93fbd[_0x88ba('0x1e')]?_0xb93fbd[_0x88ba('0x1e')][_0x88ba('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0x88ba('0x20'),db[_0x88ba('0x21')]['fn']('IF',db[_0x88ba('0x21')]['literal'](_0x88ba('0x22')))),_0x88ba('0x23')]]})['then'](function(_0x18759d){logger['info'](_0x88ba('0x24'),_0xb93fbd);logger[_0x88ba('0x25')](_0x88ba('0x24'),_0xb93fbd,JSON[_0x88ba('0x15')](_0x18759d));_0x228ee1(_0x18759d);})[_0x88ba('0x1b')](function(_0x511ad7){logger[_0x88ba('0x16')](_0x88ba('0x24'),_0x511ad7[_0x88ba('0x18')],_0xb93fbd);_0x26bbf0(_0x3b0257['error'](0x1f4,_0x511ad7[_0x88ba('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 847ae66..8dccf58 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 _0x9206=['save','remove','update','length','./userVoiceQueueRt.events'];(function(_0x284425,_0x3c952d){var _0x36506b=function(_0x43290a){while(--_0x43290a){_0x284425['push'](_0x284425['shift']());}};_0x36506b(++_0x3c952d);}(_0x9206,0x176));var _0x6920=function(_0x1255ef,_0x3e87ac){_0x1255ef=_0x1255ef-0x0;var _0x5a5fe8=_0x9206[_0x1255ef];return _0x5a5fe8;};'use strict';var UserVoiceQueueRtEvents=require(_0x6920('0x0'));var events=[_0x6920('0x1'),_0x6920('0x2'),_0x6920('0x3')];function createListener(_0x18c93a,_0x319cce){return function(_0x4bc24b){_0x319cce['emit'](_0x18c93a,_0x4bc24b);};}function removeListener(_0x1770ce,_0x3c84f7){return function(){UserVoiceQueueRtEvents['removeListener'](_0x1770ce,_0x3c84f7);};}exports['register']=function(_0x41c8c4){for(var _0x4d67d7=0x0,_0x21fb21=events[_0x6920('0x4')];_0x4d67d7<_0x21fb21;_0x4d67d7++){var _0x2aad51=events[_0x4d67d7];var _0xef5d38=createListener('userVoiceQueueRt:'+_0x2aad51,_0x41c8c4);UserVoiceQueueRtEvents['on'](_0x2aad51,_0xef5d38);}}; \ No newline at end of file +var _0x1561=['userVoiceQueueRt:','remove','update','removeListener','register','length'];(function(_0x77ccc3,_0x4a6479){var _0x5d7059=function(_0xbeb9eb){while(--_0xbeb9eb){_0x77ccc3['push'](_0x77ccc3['shift']());}};_0x5d7059(++_0x4a6479);}(_0x1561,0x1bd));var _0x1156=function(_0x387d5c,_0xe56ff6){_0x387d5c=_0x387d5c-0x0;var _0x2f3dd0=_0x1561[_0x387d5c];return _0x2f3dd0;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x1156('0x0'),_0x1156('0x1')];function createListener(_0x14f74b,_0x1ce4ca){return function(_0x1f66f7){_0x1ce4ca['emit'](_0x14f74b,_0x1f66f7);};}function removeListener(_0x1be639,_0x2b0b90){return function(){UserVoiceQueueRtEvents[_0x1156('0x2')](_0x1be639,_0x2b0b90);};}exports[_0x1156('0x3')]=function(_0x5c989c){for(var _0xb0dab7=0x0,_0x4a7048=events[_0x1156('0x4')];_0xb0dab7<_0x4a7048;_0xb0dab7++){var _0x6c3476=events[_0xb0dab7];var _0x273b53=createListener(_0x1156('0x5')+_0x6c3476,_0x5c989c);UserVoiceQueueRtEvents['on'](_0x6c3476,_0x273b53);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index c24f17c..5c3b641 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3a8ec5,_0x378f44){var _0x483caf=function(_0x559670){while(--_0x559670){_0x3a8ec5['push'](_0x3a8ec5['shift']());}};_0x483caf(++_0x378f44);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x279188,_0x34545d){var _0x557102=function(_0xe3743d){while(--_0xe3743d){_0x279188['push'](_0x279188['shift']());}};_0x557102(++_0x34545d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index a69d447..d71cea1 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 _0xfbb3=['exports','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfbb3,0x17c));var _0x3fbb=function(_0x27669b,_0x1700c5){_0x27669b=_0x27669b-0x0;var _0x122c08=_0xfbb3[_0x27669b];return _0x122c08;};'use strict';var Sequelize=require('sequelize');module[_0x3fbb('0x0')]={'penalty':{'type':Sequelize[_0x3fbb('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3eb7=['exports','INTEGER'];(function(_0x899a7b,_0x47f3fe){var _0x501574=function(_0x721be2){while(--_0x721be2){_0x899a7b['push'](_0x899a7b['shift']());}};_0x501574(++_0x47f3fe);}(_0x3eb7,0x14e));var _0x73eb=function(_0x15e2c2,_0xc8a861){_0x15e2c2=_0x15e2c2-0x0;var _0x112f1f=_0x3eb7[_0x15e2c2];return _0x112f1f;};'use strict';var Sequelize=require('sequelize');module[_0x73eb('0x0')]={'penalty':{'type':Sequelize[_0x73eb('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 77703c7..36e27ff 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 _0x8a63=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','moment','bluebird','path','rimraf','./userWhatsappQueue.attributes','exports'];(function(_0x14e536,_0x2d1abd){var _0x1b2876=function(_0x42140c){while(--_0x42140c){_0x14e536['push'](_0x14e536['shift']());}};_0x1b2876(++_0x2d1abd);}(_0x8a63,0x115));var _0x38a6=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0x8a63[_0x540133];return _0x26b6e9;};'use strict';var _=require(_0x38a6('0x0'));var util=require(_0x38a6('0x1'));var logger=require('../../config/logger')(_0x38a6('0x2'));var moment=require(_0x38a6('0x3'));var BPromise=require(_0x38a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38a6('0x5'));var rimraf=require(_0x38a6('0x6'));var config=require('../../config/environment');var attributes=require(_0x38a6('0x7'));module[_0x38a6('0x8')]=function(_0x5544c3,_0x3446dc){return _0x5544c3['define'](_0x38a6('0x9'),attributes,{'tableName':_0x38a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7eb=['rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xf7eb,0x1b3));var _0xbf7e=function(_0x213596,_0x11866b){_0x213596=_0x213596-0x0;var _0x375b7f=_0xf7eb[_0x213596];return _0x375b7f;};'use strict';var _=require(_0xbf7e('0x0'));var util=require('util');var logger=require(_0xbf7e('0x1'))(_0xbf7e('0x2'));var moment=require('moment');var BPromise=require(_0xbf7e('0x3'));var rp=require(_0xbf7e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf7e('0x5'));var config=require(_0xbf7e('0x6'));var attributes=require(_0xbf7e('0x7'));module[_0xbf7e('0x8')]=function(_0x413d13,_0x53693d){return _0x413d13[_0xbf7e('0x9')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index d4cedb0..24d3023 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 _0x9533=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3480e9,_0x1ce980){var _0x389aad=function(_0x4b6bda){while(--_0x4b6bda){_0x3480e9['push'](_0x3480e9['shift']());}};_0x389aad(++_0x1ce980);}(_0x9533,0x121));var _0x3953=function(_0xba2717,_0x5d299c){_0xba2717=_0xba2717-0x0;var _0x54f179=_0x9533[_0xba2717];return _0x54f179;};'use strict';var _=require(_0x3953('0x0'));var util=require(_0x3953('0x1'));var moment=require(_0x3953('0x2'));var BPromise=require(_0x3953('0x3'));var rs=require(_0x3953('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3953('0x5'))['db'];var utils=require(_0x3953('0x6'));var logger=require(_0x3953('0x7'))('rpc');var config=require(_0x3953('0x8'));var jayson=require(_0x3953('0x9'));var client=jayson[_0x3953('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f36a0,_0x80707b,_0x50bc3f){return new BPromise(function(_0x5896f7,_0x388bc3){return client['request'](_0x5f36a0,_0x50bc3f)[_0x3953('0xb')](function(_0x245683){logger['info'](_0x3953('0xc'),_0x80707b,_0x3953('0xd'));logger[_0x3953('0xe')](_0x3953('0xf'),_0x80707b,_0x3953('0xd'),JSON['stringify'](_0x245683));if(_0x245683['error']){if(_0x245683[_0x3953('0x10')][_0x3953('0x11')]===0x1f4){logger['error'](_0x3953('0xc'),_0x80707b,_0x245683['error'][_0x3953('0x12')]);return _0x388bc3(_0x245683['error'][_0x3953('0x12')]);}logger['error'](_0x3953('0xc'),_0x80707b,_0x245683[_0x3953('0x10')][_0x3953('0x12')]);return _0x5896f7(_0x245683[_0x3953('0x10')][_0x3953('0x12')]);}else{logger[_0x3953('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x80707b,_0x3953('0xd'));_0x5896f7(_0x245683[_0x3953('0x14')]['message']);}})[_0x3953('0x15')](function(_0x4fbc5b){logger[_0x3953('0x10')](_0x3953('0xc'),_0x80707b,_0x4fbc5b);_0x388bc3(_0x4fbc5b);});});} \ No newline at end of file +var _0x2176=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserWhatsappQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xb4ebbb,_0x284d06){var _0x3dc8b5=function(_0x4b1c63){while(--_0x4b1c63){_0xb4ebbb['push'](_0xb4ebbb['shift']());}};_0x3dc8b5(++_0x284d06);}(_0x2176,0x93));var _0x6217=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2176[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6217('0x0'));var util=require(_0x6217('0x1'));var moment=require(_0x6217('0x2'));var BPromise=require(_0x6217('0x3'));var rs=require(_0x6217('0x4'));var fs=require('fs');var Redis=require(_0x6217('0x5'));var db=require(_0x6217('0x6'))['db'];var utils=require(_0x6217('0x7'));var logger=require(_0x6217('0x8'))(_0x6217('0x9'));var config=require('../../config/environment');var jayson=require(_0x6217('0xa'));var client=jayson['client'][_0x6217('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc31902,_0x734391,_0x15b8f2){return new BPromise(function(_0xc4793b,_0x16252a){return client[_0x6217('0xc')](_0xc31902,_0x15b8f2)[_0x6217('0xd')](function(_0x305bcf){logger[_0x6217('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x734391,_0x6217('0xf'));logger['debug'](_0x6217('0x10'),_0x734391,_0x6217('0xf'),JSON[_0x6217('0x11')](_0x305bcf));if(_0x305bcf[_0x6217('0x12')]){if(_0x305bcf['error']['code']===0x1f4){logger[_0x6217('0x12')](_0x6217('0x13'),_0x734391,_0x305bcf['error'][_0x6217('0x14')]);return _0x16252a(_0x305bcf['error']['message']);}logger[_0x6217('0x12')](_0x6217('0x13'),_0x734391,_0x305bcf['error']['message']);return _0xc4793b(_0x305bcf[_0x6217('0x12')][_0x6217('0x14')]);}else{logger[_0x6217('0xe')](_0x6217('0x13'),_0x734391,_0x6217('0xf'));_0xc4793b(_0x305bcf['result'][_0x6217('0x14')]);}})[_0x6217('0x15')](function(_0xad8a67){logger[_0x6217('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x734391,_0xad8a67);_0x16252a(_0xad8a67);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 60834e5..4b9f04e 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 _0x43fd=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x14267a,_0x4505a6){var _0x37ae58=function(_0x5c247b){while(--_0x5c247b){_0x14267a['push'](_0x14267a['shift']());}};_0x37ae58(++_0x4505a6);}(_0x43fd,0x150));var _0xd43f=function(_0x174b10,_0xd8478a){_0x174b10=_0x174b10-0x0;var _0x567753=_0x43fd[_0x174b10];return _0x567753;};'use strict';var multer=require(_0xd43f('0x0'));var util=require(_0xd43f('0x1'));var path=require('path');var timeout=require(_0xd43f('0x2'));var express=require('express');var router=express[_0xd43f('0x3')]();var fs_extra=require(_0xd43f('0x4'));var auth=require(_0xd43f('0x5'));var interaction=require(_0xd43f('0x6'));var config=require(_0xd43f('0x7'));var controller=require(_0xd43f('0x8'));router[_0xd43f('0x9')]('/',auth[_0xd43f('0xa')](),controller[_0xd43f('0xb')]);router[_0xd43f('0x9')](_0xd43f('0xc'),auth[_0xd43f('0xa')](),controller[_0xd43f('0xd')]);router[_0xd43f('0xe')]('/',auth['isAuthenticated'](),controller[_0xd43f('0xf')]);router[_0xd43f('0x10')](_0xd43f('0xc'),auth['isAuthenticated'](),controller[_0xd43f('0x11')]);router[_0xd43f('0x12')]('/:id',auth[_0xd43f('0xa')](),controller[_0xd43f('0x13')]);module[_0xd43f('0x14')]=router; \ No newline at end of file +var _0xd82a=['index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated'];(function(_0x36b36a,_0x48bcb8){var _0x4c9106=function(_0x442d76){while(--_0x442d76){_0x36b36a['push'](_0x36b36a['shift']());}};_0x4c9106(++_0x48bcb8);}(_0xd82a,0xbd));var _0xad82=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xd82a[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0xad82('0x0'));var util=require(_0xad82('0x1'));var path=require(_0xad82('0x2'));var timeout=require(_0xad82('0x3'));var express=require('express');var router=express[_0xad82('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xad82('0x5'));var interaction=require(_0xad82('0x6'));var config=require(_0xad82('0x7'));var controller=require(_0xad82('0x8'));router[_0xad82('0x9')]('/',auth[_0xad82('0xa')](),controller[_0xad82('0xb')]);router[_0xad82('0x9')](_0xad82('0xc'),auth[_0xad82('0xa')](),controller['show']);router[_0xad82('0xd')]('/',auth[_0xad82('0xa')](),controller[_0xad82('0xe')]);router[_0xad82('0xf')](_0xad82('0xc'),auth[_0xad82('0xa')](),controller[_0xad82('0x10')]);router[_0xad82('0x11')](_0xad82('0xc'),auth[_0xad82('0xa')](),controller[_0xad82('0x12')]);module[_0xad82('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 6d23665..cbe2d6b 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 _0x8e6a=['STRING','sequelize','exports','name'];(function(_0x40d078,_0x210a77){var _0x46fc81=function(_0x3673da){while(--_0x3673da){_0x40d078['push'](_0x40d078['shift']());}};_0x46fc81(++_0x210a77);}(_0x8e6a,0x105));var _0xa8e6=function(_0xf24df9,_0x497230){_0xf24df9=_0xf24df9-0x0;var _0x371c7c=_0x8e6a[_0xf24df9];return _0x371c7c;};'use strict';var Sequelize=require(_0xa8e6('0x0'));module[_0xa8e6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa8e6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa8e6('0x3')]}}; \ No newline at end of file +var _0xe3cb=['name','sequelize','exports','STRING'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0xe3cb,0xd5));var _0xbe3c=function(_0x35d1f8,_0x12c794){_0x35d1f8=_0x35d1f8-0x0;var _0x2dd7c1=_0xe3cb[_0x35d1f8];return _0x2dd7c1;};'use strict';var Sequelize=require(_0xbe3c('0x0'));module[_0xbe3c('0x1')]={'name':{'type':Sequelize[_0xbe3c('0x2')],'unique':_0xbe3c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbe3c('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index b6126de..fa3fc7c 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 _0xeec9=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Variable','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','pick','merge','VIRTUAL','filter','where','includeAll','include','findAll','rows','catch','show','rawAttributes','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x34a3dc,_0x493d63){var _0x1cb812=function(_0x1f0da2){while(--_0x1f0da2){_0x34a3dc['push'](_0x34a3dc['shift']());}};_0x1cb812(++_0x493d63);}(_0xeec9,0x96));var _0x9eec=function(_0x3153ad,_0x5ad5ca){_0x3153ad=_0x3153ad-0x0;var _0x26626f=_0xeec9[_0x3153ad];return _0x26626f;};'use strict';var emlformat=require(_0x9eec('0x0'));var rimraf=require(_0x9eec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9eec('0x2'));var rp=require(_0x9eec('0x3'));var moment=require(_0x9eec('0x4'));var BPromise=require(_0x9eec('0x5'));var Mustache=require(_0x9eec('0x6'));var util=require('util');var path=require(_0x9eec('0x7'));var sox=require(_0x9eec('0x8'));var csv=require(_0x9eec('0x9'));var ejs=require(_0x9eec('0xa'));var fs=require('fs');var fs_extra=require(_0x9eec('0xb'));var _=require(_0x9eec('0xc'));var squel=require(_0x9eec('0xd'));var crypto=require('crypto');var jsforce=require(_0x9eec('0xe'));var deskjs=require(_0x9eec('0xf'));var toCsv=require(_0x9eec('0x9'));var querystring=require(_0x9eec('0x10'));var Papa=require(_0x9eec('0x11'));var Redis=require(_0x9eec('0x12'));var authService=require(_0x9eec('0x13'));var qs=require(_0x9eec('0x14'));var as=require(_0x9eec('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9eec('0x16'))(_0x9eec('0x17'));var utils=require('../../config/utils');var config=require(_0x9eec('0x18'));var licenseUtil=require(_0x9eec('0x19'));var db=require(_0x9eec('0x1a'))['db'];function respondWithStatusCode(_0x484c0a,_0x29a0a9){_0x29a0a9=_0x29a0a9||0xcc;return function(_0x40adc1){if(_0x40adc1){return _0x484c0a[_0x9eec('0x1b')](_0x29a0a9);}return _0x484c0a[_0x9eec('0x1c')](_0x29a0a9)[_0x9eec('0x1d')]();};}function respondWithResult(_0x42e364,_0x2b8a55){_0x2b8a55=_0x2b8a55||0xc8;return function(_0x4364f2){if(_0x4364f2){return _0x42e364[_0x9eec('0x1c')](_0x2b8a55)[_0x9eec('0x1e')](_0x4364f2);}};}function respondWithFilteredResult(_0x128351,_0x56a6ef){return function(_0x5a8ddc){if(_0x5a8ddc){var _0x3e4353=typeof _0x56a6ef[_0x9eec('0x1f')]===_0x9eec('0x20')&&typeof _0x56a6ef[_0x9eec('0x21')]===_0x9eec('0x20');var _0x237e63=_0x5a8ddc['count'];var _0x1f7c25=_0x3e4353?0x0:_0x56a6ef[_0x9eec('0x1f')];var _0x5404c3=_0x3e4353?_0x5a8ddc[_0x9eec('0x22')]:_0x56a6ef[_0x9eec('0x1f')]+_0x56a6ef[_0x9eec('0x21')];var _0x1cf51d;if(_0x5404c3>=_0x237e63){_0x5404c3=_0x237e63;_0x1cf51d=0xc8;}else{_0x1cf51d=0xce;}_0x128351['status'](_0x1cf51d);return _0x128351[_0x9eec('0x23')]('Content-Range',_0x1f7c25+'-'+_0x5404c3+'/'+_0x237e63)[_0x9eec('0x1e')](_0x5a8ddc);}return null;};}function patchUpdates(_0x4d71b1){return function(_0x2b0660){try{jsonpatch[_0x9eec('0x24')](_0x2b0660,_0x4d71b1,!![]);}catch(_0x57188f){return BPromise[_0x9eec('0x25')](_0x57188f);}return _0x2b0660['save']();};}function saveUpdates(_0x5c2d9f,_0x555f37){return function(_0x1d3f86){if(_0x1d3f86){return _0x1d3f86['update'](_0x5c2d9f)[_0x9eec('0x26')](function(_0x358d67){return _0x358d67;});}return null;};}function removeEntity(_0x274b9f,_0x2a9678){return function(_0x4bc733){if(_0x4bc733){return _0x4bc733[_0x9eec('0x27')]()['then'](function(){var _0x461705=_0x4bc733[_0x9eec('0x28')]({'plain':!![]});var _0xb7a142='Variables';return db[_0x9eec('0x29')]['destroy']({'where':{'type':_0xb7a142,'resourceId':_0x461705['id']}})[_0x9eec('0x26')](function(){return _0x4bc733;});})['then'](function(){_0x274b9f[_0x9eec('0x1c')](0xcc)[_0x9eec('0x1d')]();});}};}function handleEntityNotFound(_0x124b33,_0x5cd050){return function(_0x4cb678){if(!_0x4cb678){_0x124b33[_0x9eec('0x1b')](0x194);}return _0x4cb678;};}function handleError(_0x19526b,_0x197cdb){_0x197cdb=_0x197cdb||0x1f4;return function(_0xc2a585){logger[_0x9eec('0x2a')](_0xc2a585[_0x9eec('0x2b')]);if(_0xc2a585['name']){delete _0xc2a585[_0x9eec('0x2c')];}_0x19526b[_0x9eec('0x1c')](_0x197cdb)[_0x9eec('0x2d')](_0xc2a585);};}exports[_0x9eec('0x2e')]=function(_0x146ff2,_0x10dd71){var _0x3ee276={},_0x3ed412={},_0x33098a={'count':0x0,'rows':[]};var _0x261b57=_[_0x9eec('0x2f')](db[_0x9eec('0x30')]['rawAttributes'],function(_0x3a91db){return{'name':_0x3a91db['fieldName'],'type':_0x3a91db[_0x9eec('0x31')][_0x9eec('0x32')]};});_0x3ed412[_0x9eec('0x33')]=_[_0x9eec('0x2f')](_0x261b57,_0x9eec('0x2c'));_0x3ed412['query']=_[_0x9eec('0x34')](_0x146ff2['query']);_0x3ed412[_0x9eec('0x35')]=_[_0x9eec('0x36')](_0x3ed412['model'],_0x3ed412[_0x9eec('0x37')]);_0x3ee276[_0x9eec('0x38')]=_[_0x9eec('0x36')](_0x3ed412[_0x9eec('0x33')],qs[_0x9eec('0x39')](_0x146ff2[_0x9eec('0x37')][_0x9eec('0x39')]));_0x3ee276[_0x9eec('0x38')]=_0x3ee276[_0x9eec('0x38')]['length']?_0x3ee276['attributes']:_0x3ed412[_0x9eec('0x33')];if(!_0x146ff2[_0x9eec('0x37')][_0x9eec('0x3a')]('nolimit')){_0x3ee276[_0x9eec('0x21')]=qs[_0x9eec('0x21')](_0x146ff2['query'][_0x9eec('0x21')]);_0x3ee276[_0x9eec('0x1f')]=qs['offset'](_0x146ff2[_0x9eec('0x37')][_0x9eec('0x1f')]);}_0x3ee276[_0x9eec('0x3b')]=qs[_0x9eec('0x3c')](_0x146ff2[_0x9eec('0x37')][_0x9eec('0x3c')]);_0x3ee276['where']=qs[_0x9eec('0x35')](_[_0x9eec('0x3d')](_0x146ff2[_0x9eec('0x37')],_0x3ed412['filters']),_0x261b57);if(_0x146ff2[_0x9eec('0x37')]['filter']){_0x3ee276['where']=_[_0x9eec('0x3e')](_0x3ee276['where'],{'$or':_[_0x9eec('0x2f')](_0x261b57,function(_0x1a48da){if(_0x1a48da[_0x9eec('0x31')]!==_0x9eec('0x3f')){var _0x361099={};_0x361099[_0x1a48da[_0x9eec('0x2c')]]={'$like':'%'+_0x146ff2[_0x9eec('0x37')][_0x9eec('0x40')]+'%'};return _0x361099;}})});}_0x3ee276=_['merge']({},_0x3ee276,_0x146ff2['options']);var _0x4ea8e1={'where':_0x3ee276[_0x9eec('0x41')]};return db[_0x9eec('0x30')][_0x9eec('0x22')](_0x4ea8e1)[_0x9eec('0x26')](function(_0x1c7d3e){_0x33098a['count']=_0x1c7d3e;if(_0x146ff2[_0x9eec('0x37')][_0x9eec('0x42')]){_0x3ee276[_0x9eec('0x43')]=[{'all':!![]}];}return db['Variable'][_0x9eec('0x44')](_0x3ee276);})[_0x9eec('0x26')](function(_0x197e2b){_0x33098a[_0x9eec('0x45')]=_0x197e2b;return _0x33098a;})[_0x9eec('0x26')](respondWithFilteredResult(_0x10dd71,_0x3ee276))[_0x9eec('0x46')](handleError(_0x10dd71,null));};exports[_0x9eec('0x47')]=function(_0x393609,_0x54bf5b){var _0x2616a7={'raw':!![],'where':{'id':_0x393609['params']['id']}},_0x3e7fb8={};_0x3e7fb8[_0x9eec('0x33')]=_['keys'](db[_0x9eec('0x30')][_0x9eec('0x48')]);_0x3e7fb8[_0x9eec('0x37')]=_[_0x9eec('0x34')](_0x393609[_0x9eec('0x37')]);_0x3e7fb8[_0x9eec('0x35')]=_['intersection'](_0x3e7fb8['model'],_0x3e7fb8[_0x9eec('0x37')]);_0x2616a7['attributes']=_[_0x9eec('0x36')](_0x3e7fb8[_0x9eec('0x33')],qs[_0x9eec('0x39')](_0x393609['query'][_0x9eec('0x39')]));_0x2616a7[_0x9eec('0x38')]=_0x2616a7[_0x9eec('0x38')][_0x9eec('0x49')]?_0x2616a7[_0x9eec('0x38')]:_0x3e7fb8['model'];if(_0x393609[_0x9eec('0x37')][_0x9eec('0x42')]){_0x2616a7[_0x9eec('0x43')]=[{'all':!![]}];}_0x2616a7=_[_0x9eec('0x3e')]({},_0x2616a7,_0x393609['options']);return db[_0x9eec('0x30')]['find'](_0x2616a7)[_0x9eec('0x26')](handleEntityNotFound(_0x54bf5b,null))[_0x9eec('0x26')](respondWithResult(_0x54bf5b,null))[_0x9eec('0x46')](handleError(_0x54bf5b,null));};exports[_0x9eec('0x4a')]=function(_0x2269ee,_0x235bc5){return db[_0x9eec('0x30')][_0x9eec('0x4a')](_0x2269ee[_0x9eec('0x4b')],{})[_0x9eec('0x26')](function(_0x582def){var _0x3bdd21=_0x2269ee[_0x9eec('0x4c')][_0x9eec('0x28')]({'plain':!![]});if(!_0x3bdd21)throw new Error(_0x9eec('0x4d'));if(_0x3bdd21['role']===_0x9eec('0x4c')){var _0x3c209f=_0x582def[_0x9eec('0x28')]({'plain':!![]});var _0x1399a9='Variables';return db['UserProfileSection']['find']({'where':{'name':_0x1399a9,'userProfileId':_0x3bdd21[_0x9eec('0x4e')]},'raw':!![]})[_0x9eec('0x26')](function(_0x101af7){if(_0x101af7&&_0x101af7['autoAssociation']===0x0){return db[_0x9eec('0x29')][_0x9eec('0x4a')]({'name':_0x3c209f[_0x9eec('0x2c')],'resourceId':_0x3c209f['id'],'type':_0x101af7[_0x9eec('0x2c')],'sectionId':_0x101af7['id']},{})[_0x9eec('0x26')](function(){return _0x582def;});}else{return _0x582def;}})[_0x9eec('0x46')](function(_0x1338fe){logger[_0x9eec('0x2a')](_0x9eec('0x4f'),_0x1338fe);throw _0x1338fe;});}return _0x582def;})['then'](respondWithResult(_0x235bc5,0xc9))[_0x9eec('0x46')](handleError(_0x235bc5,null));};exports[_0x9eec('0x50')]=function(_0x33bc03,_0xed000e){if(_0x33bc03[_0x9eec('0x4b')]['id']){delete _0x33bc03[_0x9eec('0x4b')]['id'];}return db[_0x9eec('0x30')][_0x9eec('0x51')]({'where':{'id':_0x33bc03[_0x9eec('0x52')]['id']}})[_0x9eec('0x26')](handleEntityNotFound(_0xed000e,null))[_0x9eec('0x26')](saveUpdates(_0x33bc03[_0x9eec('0x4b')],null))[_0x9eec('0x26')](respondWithResult(_0xed000e,null))[_0x9eec('0x46')](handleError(_0xed000e,null));};exports[_0x9eec('0x27')]=function(_0x24dc96,_0xe73efb){return db['Variable'][_0x9eec('0x51')]({'where':{'id':_0x24dc96[_0x9eec('0x52')]['id']}})['then'](handleEntityNotFound(_0xe73efb,null))[_0x9eec('0x26')](removeEntity(_0xe73efb,null))['catch'](handleError(_0xe73efb,null));}; \ No newline at end of file +var _0x7f55=['length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','rawAttributes','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','get','Variables','UserProfileResource','destroy','sendStatus','name','send','index','map','Variable','fieldName','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x3cf97c,_0x3938c5){var _0x5c0e44=function(_0x382c83){while(--_0x382c83){_0x3cf97c['push'](_0x3cf97c['shift']());}};_0x5c0e44(++_0x3938c5);}(_0x7f55,0x156));var _0x57f5=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x7f55[_0x279d37];return _0x530173;};'use strict';var emlformat=require(_0x57f5('0x0'));var rimraf=require(_0x57f5('0x1'));var zipdir=require(_0x57f5('0x2'));var jsonpatch=require(_0x57f5('0x3'));var rp=require(_0x57f5('0x4'));var moment=require('moment');var BPromise=require(_0x57f5('0x5'));var Mustache=require(_0x57f5('0x6'));var util=require(_0x57f5('0x7'));var path=require(_0x57f5('0x8'));var sox=require('sox');var csv=require(_0x57f5('0x9'));var ejs=require(_0x57f5('0xa'));var fs=require('fs');var fs_extra=require(_0x57f5('0xb'));var _=require(_0x57f5('0xc'));var squel=require('squel');var crypto=require(_0x57f5('0xd'));var jsforce=require(_0x57f5('0xe'));var deskjs=require(_0x57f5('0xf'));var toCsv=require(_0x57f5('0x9'));var querystring=require('querystring');var Papa=require(_0x57f5('0x10'));var Redis=require(_0x57f5('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x57f5('0x12'))(_0x57f5('0x13'));var utils=require(_0x57f5('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x57f5('0x15'))['db'];function respondWithStatusCode(_0x3fb8a9,_0x11e703){_0x11e703=_0x11e703||0xcc;return function(_0x1cbfc3){if(_0x1cbfc3){return _0x3fb8a9['sendStatus'](_0x11e703);}return _0x3fb8a9[_0x57f5('0x16')](_0x11e703)[_0x57f5('0x17')]();};}function respondWithResult(_0x2b6f55,_0x2f238f){_0x2f238f=_0x2f238f||0xc8;return function(_0x2befaa){if(_0x2befaa){return _0x2b6f55[_0x57f5('0x16')](_0x2f238f)['json'](_0x2befaa);}};}function respondWithFilteredResult(_0x39a995,_0x1edfe4){return function(_0x256eac){if(_0x256eac){var _0x582c0c=typeof _0x1edfe4[_0x57f5('0x18')]===_0x57f5('0x19')&&typeof _0x1edfe4[_0x57f5('0x1a')]===_0x57f5('0x19');var _0x1e46ea=_0x256eac['count'];var _0x156399=_0x582c0c?0x0:_0x1edfe4[_0x57f5('0x18')];var _0x48c26c=_0x582c0c?_0x256eac[_0x57f5('0x1b')]:_0x1edfe4['offset']+_0x1edfe4['limit'];var _0x143202;if(_0x48c26c>=_0x1e46ea){_0x48c26c=_0x1e46ea;_0x143202=0xc8;}else{_0x143202=0xce;}_0x39a995[_0x57f5('0x16')](_0x143202);return _0x39a995[_0x57f5('0x1c')]('Content-Range',_0x156399+'-'+_0x48c26c+'/'+_0x1e46ea)[_0x57f5('0x1d')](_0x256eac);}return null;};}function patchUpdates(_0x57cd0a){return function(_0x463f63){try{jsonpatch[_0x57f5('0x1e')](_0x463f63,_0x57cd0a,!![]);}catch(_0xcf525c){return BPromise[_0x57f5('0x1f')](_0xcf525c);}return _0x463f63['save']();};}function saveUpdates(_0x10721d,_0x45b55){return function(_0x56d5eb){if(_0x56d5eb){return _0x56d5eb[_0x57f5('0x20')](_0x10721d)[_0x57f5('0x21')](function(_0x7f5ea8){return _0x7f5ea8;});}return null;};}function removeEntity(_0x257dd2,_0x8a9609){return function(_0x2a3679){if(_0x2a3679){return _0x2a3679['destroy']()[_0x57f5('0x21')](function(){var _0x4e4377=_0x2a3679[_0x57f5('0x22')]({'plain':!![]});var _0x483394=_0x57f5('0x23');return db[_0x57f5('0x24')][_0x57f5('0x25')]({'where':{'type':_0x483394,'resourceId':_0x4e4377['id']}})[_0x57f5('0x21')](function(){return _0x2a3679;});})['then'](function(){_0x257dd2[_0x57f5('0x16')](0xcc)[_0x57f5('0x17')]();});}};}function handleEntityNotFound(_0x3a5ae2,_0x254053){return function(_0x29b1f2){if(!_0x29b1f2){_0x3a5ae2[_0x57f5('0x26')](0x194);}return _0x29b1f2;};}function handleError(_0x10fd1e,_0x314863){_0x314863=_0x314863||0x1f4;return function(_0x4450f5){logger['error'](_0x4450f5['stack']);if(_0x4450f5[_0x57f5('0x27')]){delete _0x4450f5[_0x57f5('0x27')];}_0x10fd1e[_0x57f5('0x16')](_0x314863)[_0x57f5('0x28')](_0x4450f5);};}exports[_0x57f5('0x29')]=function(_0x48329f,_0x5a2585){var _0x2e35c6={},_0x30deb8={},_0x4523ef={'count':0x0,'rows':[]};var _0x239716=_[_0x57f5('0x2a')](db[_0x57f5('0x2b')]['rawAttributes'],function(_0xda4bd8){return{'name':_0xda4bd8[_0x57f5('0x2c')],'type':_0xda4bd8[_0x57f5('0x2d')]['key']};});_0x30deb8[_0x57f5('0x2e')]=_[_0x57f5('0x2a')](_0x239716,_0x57f5('0x27'));_0x30deb8[_0x57f5('0x2f')]=_[_0x57f5('0x30')](_0x48329f[_0x57f5('0x2f')]);_0x30deb8[_0x57f5('0x31')]=_[_0x57f5('0x32')](_0x30deb8['model'],_0x30deb8[_0x57f5('0x2f')]);_0x2e35c6[_0x57f5('0x33')]=_[_0x57f5('0x32')](_0x30deb8[_0x57f5('0x2e')],qs['fields'](_0x48329f[_0x57f5('0x2f')][_0x57f5('0x34')]));_0x2e35c6[_0x57f5('0x33')]=_0x2e35c6[_0x57f5('0x33')][_0x57f5('0x35')]?_0x2e35c6[_0x57f5('0x33')]:_0x30deb8['model'];if(!_0x48329f[_0x57f5('0x2f')][_0x57f5('0x36')](_0x57f5('0x37'))){_0x2e35c6['limit']=qs[_0x57f5('0x1a')](_0x48329f[_0x57f5('0x2f')][_0x57f5('0x1a')]);_0x2e35c6[_0x57f5('0x18')]=qs[_0x57f5('0x18')](_0x48329f[_0x57f5('0x2f')][_0x57f5('0x18')]);}_0x2e35c6[_0x57f5('0x38')]=qs[_0x57f5('0x39')](_0x48329f[_0x57f5('0x2f')][_0x57f5('0x39')]);_0x2e35c6[_0x57f5('0x3a')]=qs[_0x57f5('0x31')](_['pick'](_0x48329f['query'],_0x30deb8[_0x57f5('0x31')]),_0x239716);if(_0x48329f[_0x57f5('0x2f')][_0x57f5('0x3b')]){_0x2e35c6[_0x57f5('0x3a')]=_[_0x57f5('0x3c')](_0x2e35c6['where'],{'$or':_[_0x57f5('0x2a')](_0x239716,function(_0xf148aa){if(_0xf148aa['type']!==_0x57f5('0x3d')){var _0x1c6d95={};_0x1c6d95[_0xf148aa[_0x57f5('0x27')]]={'$like':'%'+_0x48329f[_0x57f5('0x2f')][_0x57f5('0x3b')]+'%'};return _0x1c6d95;}})});}_0x2e35c6=_['merge']({},_0x2e35c6,_0x48329f[_0x57f5('0x3e')]);var _0x3c3c30={'where':_0x2e35c6['where']};return db[_0x57f5('0x2b')][_0x57f5('0x1b')](_0x3c3c30)['then'](function(_0x5efe7f){_0x4523ef['count']=_0x5efe7f;if(_0x48329f[_0x57f5('0x2f')]['includeAll']){_0x2e35c6[_0x57f5('0x3f')]=[{'all':!![]}];}return db['Variable'][_0x57f5('0x40')](_0x2e35c6);})[_0x57f5('0x21')](function(_0x39b023){_0x4523ef['rows']=_0x39b023;return _0x4523ef;})[_0x57f5('0x21')](respondWithFilteredResult(_0x5a2585,_0x2e35c6))[_0x57f5('0x41')](handleError(_0x5a2585,null));};exports[_0x57f5('0x42')]=function(_0x2cebd2,_0x5d7cec){var _0x31e3e8={'raw':!![],'where':{'id':_0x2cebd2['params']['id']}},_0x34af2b={};_0x34af2b[_0x57f5('0x2e')]=_[_0x57f5('0x30')](db[_0x57f5('0x2b')][_0x57f5('0x43')]);_0x34af2b[_0x57f5('0x2f')]=_[_0x57f5('0x30')](_0x2cebd2[_0x57f5('0x2f')]);_0x34af2b[_0x57f5('0x31')]=_[_0x57f5('0x32')](_0x34af2b[_0x57f5('0x2e')],_0x34af2b[_0x57f5('0x2f')]);_0x31e3e8[_0x57f5('0x33')]=_[_0x57f5('0x32')](_0x34af2b[_0x57f5('0x2e')],qs[_0x57f5('0x34')](_0x2cebd2[_0x57f5('0x2f')]['fields']));_0x31e3e8[_0x57f5('0x33')]=_0x31e3e8[_0x57f5('0x33')][_0x57f5('0x35')]?_0x31e3e8[_0x57f5('0x33')]:_0x34af2b[_0x57f5('0x2e')];if(_0x2cebd2[_0x57f5('0x2f')][_0x57f5('0x44')]){_0x31e3e8['include']=[{'all':!![]}];}_0x31e3e8=_[_0x57f5('0x3c')]({},_0x31e3e8,_0x2cebd2[_0x57f5('0x3e')]);return db[_0x57f5('0x2b')]['find'](_0x31e3e8)[_0x57f5('0x21')](handleEntityNotFound(_0x5d7cec,null))['then'](respondWithResult(_0x5d7cec,null))[_0x57f5('0x41')](handleError(_0x5d7cec,null));};exports[_0x57f5('0x45')]=function(_0x307365,_0xdd240a){return db['Variable'][_0x57f5('0x45')](_0x307365['body'],{})[_0x57f5('0x21')](function(_0x7a09d3){var _0x34a253=_0x307365[_0x57f5('0x46')][_0x57f5('0x22')]({'plain':!![]});if(!_0x34a253)throw new Error(_0x57f5('0x47'));if(_0x34a253[_0x57f5('0x48')]===_0x57f5('0x46')){var _0x4dde60=_0x7a09d3[_0x57f5('0x22')]({'plain':!![]});var _0x2df3bd=_0x57f5('0x23');return db[_0x57f5('0x49')][_0x57f5('0x4a')]({'where':{'name':_0x2df3bd,'userProfileId':_0x34a253['userProfileId']},'raw':!![]})['then'](function(_0x5952c5){if(_0x5952c5&&_0x5952c5['autoAssociation']===0x0){return db[_0x57f5('0x24')][_0x57f5('0x45')]({'name':_0x4dde60[_0x57f5('0x27')],'resourceId':_0x4dde60['id'],'type':_0x5952c5[_0x57f5('0x27')],'sectionId':_0x5952c5['id']},{})[_0x57f5('0x21')](function(){return _0x7a09d3;});}else{return _0x7a09d3;}})[_0x57f5('0x41')](function(_0x563bf2){logger[_0x57f5('0x4b')](_0x57f5('0x4c'),_0x563bf2);throw _0x563bf2;});}return _0x7a09d3;})[_0x57f5('0x21')](respondWithResult(_0xdd240a,0xc9))[_0x57f5('0x41')](handleError(_0xdd240a,null));};exports[_0x57f5('0x20')]=function(_0x14bf00,_0x327e59){if(_0x14bf00[_0x57f5('0x4d')]['id']){delete _0x14bf00['body']['id'];}return db['Variable'][_0x57f5('0x4a')]({'where':{'id':_0x14bf00[_0x57f5('0x4e')]['id']}})[_0x57f5('0x21')](handleEntityNotFound(_0x327e59,null))[_0x57f5('0x21')](saveUpdates(_0x14bf00[_0x57f5('0x4d')],null))[_0x57f5('0x21')](respondWithResult(_0x327e59,null))[_0x57f5('0x41')](handleError(_0x327e59,null));};exports[_0x57f5('0x25')]=function(_0x2db0dc,_0x177b9a){return db[_0x57f5('0x2b')][_0x57f5('0x4a')]({'where':{'id':_0x2db0dc[_0x57f5('0x4e')]['id']}})[_0x57f5('0x21')](handleEntityNotFound(_0x177b9a,null))[_0x57f5('0x21')](removeEntity(_0x177b9a,null))['catch'](handleError(_0x177b9a,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 4bb9092..af5ca3d 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 _0xc559=['define','Variable','tools_variables','lodash','util','api','moment','request-promise','../../config/environment','./variable.attributes'];(function(_0x276714,_0x12e7b6){var _0x5b4454=function(_0x2be52e){while(--_0x2be52e){_0x276714['push'](_0x276714['shift']());}};_0x5b4454(++_0x12e7b6);}(_0xc559,0xb7));var _0x9c55=function(_0x5e1c63,_0x5182ef){_0x5e1c63=_0x5e1c63-0x0;var _0x3eebaf=_0xc559[_0x5e1c63];return _0x3eebaf;};'use strict';var _=require(_0x9c55('0x0'));var util=require(_0x9c55('0x1'));var logger=require('../../config/logger')(_0x9c55('0x2'));var moment=require(_0x9c55('0x3'));var BPromise=require('bluebird');var rp=require(_0x9c55('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9c55('0x5'));var attributes=require(_0x9c55('0x6'));module['exports']=function(_0x3d7f67,_0x49e0dd){return _0x3d7f67[_0x9c55('0x7')](_0x9c55('0x8'),attributes,{'tableName':_0x9c55('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcda=['../../config/environment','./variable.attributes','exports','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x17cc96,_0x2316fc){var _0x4606fe=function(_0xb2e9f3){while(--_0xb2e9f3){_0x17cc96['push'](_0x17cc96['shift']());}};_0x4606fe(++_0x2316fc);}(_0xdcda,0x101));var _0xadcd=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xdcda[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xadcd('0x0'));var util=require(_0xadcd('0x1'));var logger=require(_0xadcd('0x2'))(_0xadcd('0x3'));var moment=require(_0xadcd('0x4'));var BPromise=require(_0xadcd('0x5'));var rp=require(_0xadcd('0x6'));var fs=require('fs');var path=require(_0xadcd('0x7'));var rimraf=require(_0xadcd('0x8'));var config=require(_0xadcd('0x9'));var attributes=require(_0xadcd('0xa'));module[_0xadcd('0xb')]=function(_0x31088b,_0x12abd1){return _0x31088b['define'](_0xadcd('0xc'),attributes,{'tableName':_0xadcd('0xd'),'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 cb02136..cb59ca5 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0xba144b,_0x62e472){var _0x43b7f1=function(_0x28485b){while(--_0x28485b){_0xba144b['push'](_0xba144b['shift']());}};_0x43b7f1(++_0x62e472);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0x5fc3[_0x3ceb54];return _0x26d8a6;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x5b7621,_0x4c697d){var _0x30339d=function(_0x371a5d){while(--_0x371a5d){_0x5b7621['push'](_0x5b7621['shift']());}};_0x30339d(++_0x4c697d);}(_0x6aa7,0x178));var _0x76aa=function(_0x11a3d0,_0x24cfc9){_0x11a3d0=_0x11a3d0-0x0;var _0x4feca8=_0x6aa7[_0x11a3d0];return _0x4feca8;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 46d00b2..66a3c9e 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 _0xa2e1=['reset','/pull','isAuthenticated','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','get','index','/fetch','canUpdate'];(function(_0x72dfac,_0x369d2d){var _0x313dd7=function(_0x546593){while(--_0x546593){_0x72dfac['push'](_0x72dfac['shift']());}};_0x313dd7(++_0x369d2d);}(_0xa2e1,0x119));var _0x1a2e=function(_0x4e4ca7,_0x2dac67){_0x4e4ca7=_0x4e4ca7-0x0;var _0x509014=_0xa2e1[_0x4e4ca7];return _0x509014;};'use strict';var express=require(_0x1a2e('0x0'));var router=express[_0x1a2e('0x1')]();var auth=require(_0x1a2e('0x2'));var controller=require('./version.controller');router[_0x1a2e('0x3')]('/',controller[_0x1a2e('0x4')]);router[_0x1a2e('0x3')](_0x1a2e('0x5'),auth['isAuthenticated'](),auth[_0x1a2e('0x6')](),controller['fetch']);router[_0x1a2e('0x3')]('/reset',auth['isAuthenticated'](),auth[_0x1a2e('0x6')](),controller[_0x1a2e('0x7')]);router[_0x1a2e('0x3')](_0x1a2e('0x8'),auth[_0x1a2e('0x9')](),auth[_0x1a2e('0x6')](),controller[_0x1a2e('0xa')]);router[_0x1a2e('0x3')](_0x1a2e('0xb'),auth[_0x1a2e('0x9')](),controller[_0x1a2e('0xc')]);router[_0x1a2e('0x3')](_0x1a2e('0xd'),controller[_0x1a2e('0xe')]);module[_0x1a2e('0xf')]=router; \ No newline at end of file +var _0x4574=['/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','/restart','restart','/migrations','migrations','Router','../../components/auth/service','./version.controller','get'];(function(_0x5f42f1,_0x956be5){var _0x5534ee=function(_0x532333){while(--_0x532333){_0x5f42f1['push'](_0x5f42f1['shift']());}};_0x5534ee(++_0x956be5);}(_0x4574,0x173));var _0x4457=function(_0x93d696,_0x50db73){_0x93d696=_0x93d696-0x0;var _0x583366=_0x4574[_0x93d696];return _0x583366;};'use strict';var express=require('express');var router=express[_0x4457('0x0')]();var auth=require(_0x4457('0x1'));var controller=require(_0x4457('0x2'));router[_0x4457('0x3')]('/',controller['index']);router['get'](_0x4457('0x4'),auth[_0x4457('0x5')](),auth[_0x4457('0x6')](),controller[_0x4457('0x7')]);router[_0x4457('0x3')](_0x4457('0x8'),auth[_0x4457('0x5')](),auth[_0x4457('0x6')](),controller[_0x4457('0x9')]);router[_0x4457('0x3')](_0x4457('0xa'),auth[_0x4457('0x5')](),auth['canUpdate'](),controller['pull']);router[_0x4457('0x3')](_0x4457('0xb'),auth[_0x4457('0x5')](),controller[_0x4457('0xc')]);router[_0x4457('0x3')](_0x4457('0xd'),controller[_0x4457('0xe')]);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 9488d14..1b039e0 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 _0x91fb=['../../config/environment','../../config/pm2','../../config/logger','update','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','readdirSync','join','server','migrations','length','.js','sort','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x91fb,0x15e));var _0xb91f=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x91fb[_0x243217];return _0x478029;};'use strict';var Umzug=require('umzug');var path=require(_0xb91f('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xb91f('0x1'))(module,_0xb91f('0x2'));var compareVersions=require(_0xb91f('0x3'));var exec=require(_0xb91f('0x4'))[_0xb91f('0x5')];var db=require(_0xb91f('0x6'))['db'];var config=require(_0xb91f('0x7'));var pm2=require(_0xb91f('0x8'));var logger=require(_0xb91f('0x9'))(_0xb91f('0xa'));var git=require('simple-git')(config[_0xb91f('0xb')]);exports[_0xb91f('0xc')]=function(_0x2d27bb,_0x1b2aeb){var _0x232a41={'current':module[_0xb91f('0xd')]['version'],'phonebar':0x2};if(_0x2d27bb[_0xb91f('0xe')]&&_0x2d27bb[_0xb91f('0xe')][_0xb91f('0xf')]){return git[_0xb91f('0x10')]()[_0xb91f('0x11')](function(_0x3604c4,_0x24b138){_0x232a41[_0xb91f('0xf')]=(_0x3604c4?module[_0xb91f('0xd')][_0xb91f('0x2')]:_0x24b138[_0xb91f('0xf')])||_0xb91f('0x12');return _0x1b2aeb[_0xb91f('0x13')](0xc8)[_0xb91f('0x14')](_0x232a41);});}else{return _0x1b2aeb[_0xb91f('0x13')](0xc8)[_0xb91f('0x14')](_0x232a41);}};exports[_0xb91f('0x10')]=function(_0x5ce64a,_0xb80b4d){return git[_0xb91f('0x10')]([_0xb91f('0x15'),_0xb91f('0x16')],function(_0x53675b){if(_0x53675b){logger[_0xb91f('0x17')](_0x53675b);return _0xb80b4d[_0xb91f('0x13')](0x1f4)[_0xb91f('0x14')](_0x53675b);}logger[_0xb91f('0x18')]('git\x20fetch');return _0xb80b4d[_0xb91f('0x13')](0xc8)['json']({'output':_0xb91f('0x19')});});};exports['reset']=function(_0x22d73a,_0x495bd9){return git[_0xb91f('0x1a')]([_0xb91f('0x1b'),_0xb91f('0x1c')],function(_0x491d14){if(_0x491d14){logger[_0xb91f('0x17')](_0x491d14);return _0x495bd9[_0xb91f('0x13')](0x1f4)['json'](_0x491d14);}logger[_0xb91f('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x495bd9[_0xb91f('0x13')](0xc8)[_0xb91f('0x14')]({'output':_0xb91f('0x1d')});});};exports[_0xb91f('0x1e')]=function(_0x2589e2,_0xf25de4){exec(_0xb91f('0x1f'),function(_0x4391af,_0x2b8ac2,_0x35569e){logger['info'](_0x2b8ac2);logger['info'](_0x35569e);if(_0x4391af){logger[_0xb91f('0x17')](_0x4391af);return _0xf25de4[_0xb91f('0x13')](0x1f4)['json'](_0x4391af);}return _0xf25de4['status'](0xc8)[_0xb91f('0x14')]({'output':_0x2b8ac2});});};exports[_0xb91f('0x20')]=function(_0x5ca24c,_0xf32ec7){return pm2[_0xb91f('0x20')](_0xb91f('0x21'))[_0xb91f('0x22')](function(_0x41817d){logger[_0xb91f('0x18')](_0xb91f('0x23'),_0x41817d);return _0xf32ec7[_0xb91f('0x13')](0xc8)[_0xb91f('0x14')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x3b7eff){logger[_0xb91f('0x17')](_0x3b7eff);return _0xf32ec7[_0xb91f('0x13')](0x1f4)[_0xb91f('0x14')](_0x3b7eff);});};exports['migrations']=function(_0x485964,_0x17c169){var _0x541b5d=fs[_0xb91f('0x24')](path[_0xb91f('0x25')](config[_0xb91f('0xb')],_0xb91f('0x26'),_0xb91f('0x27')));var _0x429b0c=[];for(var _0xdb86c5=0x0;_0xdb86c5<_0x541b5d[_0xb91f('0x28')];_0xdb86c5++){var _0x58b690=_0x541b5d[_0xdb86c5]['replace'](_0xb91f('0x29'),'');if(compareVersions(module[_0xb91f('0xd')]['version'],_0x58b690)===-0x1){_0x429b0c['push'](_0x58b690);}}if(_0x429b0c[_0xb91f('0x28')]){var _0xb5fce9=_0x429b0c[_0xb91f('0x2a')](compareVersions);var _0x387350=new Umzug({'storage':_0xb91f('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0xb91f('0x2')},'migrations':{'params':[db[_0xb91f('0x2b')][_0xb91f('0x2c')](),db['sequelize'][_0xb91f('0x2d')],function(){throw new Error(_0xb91f('0x2e'));}],'path':path[_0xb91f('0x25')](config[_0xb91f('0xb')],_0xb91f('0x26'),'migrations'),'pattern':/\.js$/}});_0x387350['up']({'migrations':_[_0xb91f('0x2f')](_0xb5fce9,function(_0x50b483){return _0x50b483+_0xb91f('0x29');})})[_0xb91f('0x22')](function(){return _0x17c169[_0xb91f('0x13')](0xc8)[_0xb91f('0x14')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0xb91f('0x2')]+'\x20to\x20'+_[_0xb91f('0x30')](_0xb5fce9),'migrations':_[_0xb91f('0x25')](_0xb5fce9)});})['catch'](function(_0x5b86e3){if(_0x5b86e3 instanceof db[_0xb91f('0x2b')][_0xb91f('0x31')]){return _0x17c169[_0xb91f('0x13')](0xc8)['json']({'output':_0xb91f('0x32')});}else{return _0x17c169['status'](0x1f4)[_0xb91f('0x14')](_0x5b86e3);}});}else{return _0x17c169[_0xb91f('0x13')](0xc8)[_0xb91f('0x14')]({'output':_0xb91f('0x32')});}}; \ No newline at end of file +var _0x4bc1=['join','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','index','query','latest','fetch','exports','2.0.0','status','json','master','error','git\x20fetch','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','info','restart','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','replace','push','length','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x4bc1,0x70));var _0x14bc=function(_0xf6a492,_0xe43e4b){_0xf6a492=_0xf6a492-0x0;var _0x59c2ff=_0x4bc1[_0xf6a492];return _0x59c2ff;};'use strict';var Umzug=require(_0x14bc('0x0'));var path=require(_0x14bc('0x1'));var fs=require('fs');var _=require(_0x14bc('0x2'));var pkginfo=require(_0x14bc('0x3'))(module,_0x14bc('0x4'));var compareVersions=require(_0x14bc('0x5'));var exec=require(_0x14bc('0x6'))[_0x14bc('0x7')];var db=require(_0x14bc('0x8'))['db'];var config=require('../../config/environment');var pm2=require(_0x14bc('0x9'));var logger=require(_0x14bc('0xa'))(_0x14bc('0xb'));var git=require(_0x14bc('0xc'))(config[_0x14bc('0xd')]);exports[_0x14bc('0xe')]=function(_0x2fe127,_0xe9dea){var _0x5663ae={'current':module['exports'][_0x14bc('0x4')],'phonebar':0x2};if(_0x2fe127[_0x14bc('0xf')]&&_0x2fe127[_0x14bc('0xf')][_0x14bc('0x10')]){return git[_0x14bc('0x11')]()['tags'](function(_0x4a7989,_0x1f4386){_0x5663ae[_0x14bc('0x10')]=(_0x4a7989?module[_0x14bc('0x12')][_0x14bc('0x4')]:_0x1f4386[_0x14bc('0x10')])||_0x14bc('0x13');return _0xe9dea[_0x14bc('0x14')](0xc8)[_0x14bc('0x15')](_0x5663ae);});}else{return _0xe9dea[_0x14bc('0x14')](0xc8)[_0x14bc('0x15')](_0x5663ae);}};exports['fetch']=function(_0x54aca8,_0x5d7b75){return git[_0x14bc('0x11')](['origin',_0x14bc('0x16')],function(_0xcae9ac){if(_0xcae9ac){logger[_0x14bc('0x17')](_0xcae9ac);return _0x5d7b75[_0x14bc('0x14')](0x1f4)[_0x14bc('0x15')](_0xcae9ac);}logger['info'](_0x14bc('0x18'));return _0x5d7b75[_0x14bc('0x14')](0xc8)[_0x14bc('0x15')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x20a7ef,_0x28b852){return git['reset']([_0x14bc('0x19'),_0x14bc('0x1a')],function(_0x313c9e){if(_0x313c9e){logger[_0x14bc('0x17')](_0x313c9e);return _0x28b852[_0x14bc('0x14')](0x1f4)[_0x14bc('0x15')](_0x313c9e);}logger['info'](_0x14bc('0x1b'));return _0x28b852[_0x14bc('0x14')](0xc8)['json']({'output':_0x14bc('0x1c')});});};exports[_0x14bc('0x1d')]=function(_0x1c75e7,_0xa491f8){exec(_0x14bc('0x1e'),function(_0x4035c7,_0x1de09a,_0x5d820f){logger[_0x14bc('0x1f')](_0x1de09a);logger[_0x14bc('0x1f')](_0x5d820f);if(_0x4035c7){logger['error'](_0x4035c7);return _0xa491f8[_0x14bc('0x14')](0x1f4)[_0x14bc('0x15')](_0x4035c7);}return _0xa491f8[_0x14bc('0x14')](0xc8)['json']({'output':_0x1de09a});});};exports[_0x14bc('0x20')]=function(_0x224b29,_0x422a50){return pm2[_0x14bc('0x20')]('motion2')[_0x14bc('0x21')](function(_0x1bcc9f){logger[_0x14bc('0x1f')]('pm2\x20restart\x20motion\x20%s',_0x1bcc9f);return _0x422a50[_0x14bc('0x14')](0xc8)[_0x14bc('0x15')]({'output':_0x14bc('0x22')});})[_0x14bc('0x23')](function(_0x550764){logger['error'](_0x550764);return _0x422a50[_0x14bc('0x14')](0x1f4)[_0x14bc('0x15')](_0x550764);});};exports[_0x14bc('0x24')]=function(_0x39c214,_0x17edb5){var _0x5dc4e0=fs[_0x14bc('0x25')](path['join'](config[_0x14bc('0xd')],_0x14bc('0x26'),_0x14bc('0x24')));var _0xb4db17=[];for(var _0x48255a=0x0;_0x48255a<_0x5dc4e0['length'];_0x48255a++){var _0x207252=_0x5dc4e0[_0x48255a][_0x14bc('0x27')]('.js','');if(compareVersions(module[_0x14bc('0x12')][_0x14bc('0x4')],_0x207252)===-0x1){_0xb4db17[_0x14bc('0x28')](_0x207252);}}if(_0xb4db17[_0x14bc('0x29')]){var _0x213539=_0xb4db17['sort'](compareVersions);var _0x1b68b8=new Umzug({'storage':_0x14bc('0x2a'),'storageOptions':{'model':db[_0x14bc('0x2b')],'modelName':_0x14bc('0x2b'),'columnName':_0x14bc('0x4')},'migrations':{'params':[db[_0x14bc('0x2a')][_0x14bc('0x2c')](),db['sequelize'][_0x14bc('0x2d')],function(){throw new Error(_0x14bc('0x2e'));}],'path':path[_0x14bc('0x2f')](config[_0x14bc('0xd')],'server',_0x14bc('0x24')),'pattern':/\.js$/}});_0x1b68b8['up']({'migrations':_['map'](_0x213539,function(_0x25e292){return _0x25e292+'.js';})})[_0x14bc('0x21')](function(){return _0x17edb5[_0x14bc('0x14')](0xc8)[_0x14bc('0x15')]({'output':_0x14bc('0x30')+module[_0x14bc('0x12')][_0x14bc('0x4')]+_0x14bc('0x31')+_[_0x14bc('0x32')](_0x213539),'migrations':_[_0x14bc('0x2f')](_0x213539)});})[_0x14bc('0x23')](function(_0x5e3a8e){if(_0x5e3a8e instanceof db[_0x14bc('0x2a')][_0x14bc('0x33')]){return _0x17edb5[_0x14bc('0x14')](0xc8)['json']({'output':_0x14bc('0x34')});}else{return _0x17edb5[_0x14bc('0x14')](0x1f4)[_0x14bc('0x15')](_0x5e3a8e);}});}else{return _0x17edb5['status'](0xc8)['json']({'output':_0x14bc('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 1bab67c..d506f65 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 _0x8d94=['update','delete','/:id','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','get','/describe','describe','show','post','create','put'];(function(_0x5bbfa7,_0x118a4a){var _0x671f7=function(_0x39d481){while(--_0x39d481){_0x5bbfa7['push'](_0x5bbfa7['shift']());}};_0x671f7(++_0x118a4a);}(_0x8d94,0x1e5));var _0x48d9=function(_0x321ef3,_0xeb776b){_0x321ef3=_0x321ef3-0x0;var _0x1415b7=_0x8d94[_0x321ef3];return _0x1415b7;};'use strict';var multer=require('multer');var util=require(_0x48d9('0x0'));var path=require(_0x48d9('0x1'));var timeout=require(_0x48d9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x48d9('0x3'));var interaction=require(_0x48d9('0x4'));var config=require(_0x48d9('0x5'));var controller=require(_0x48d9('0x6'));router['get']('/',auth[_0x48d9('0x7')](),controller['index']);router[_0x48d9('0x8')](_0x48d9('0x9'),auth[_0x48d9('0x7')](),controller[_0x48d9('0xa')]);router[_0x48d9('0x8')]('/:id',auth[_0x48d9('0x7')](),controller[_0x48d9('0xb')]);router[_0x48d9('0xc')]('/',auth['isAuthenticated'](),controller[_0x48d9('0xd')]);router[_0x48d9('0xe')]('/:id',auth[_0x48d9('0x7')](),controller[_0x48d9('0xf')]);router[_0x48d9('0x10')](_0x48d9('0x11'),auth['isAuthenticated'](),controller[_0x48d9('0x12')]);module[_0x48d9('0x13')]=router; \ No newline at end of file +var _0xf1fe=['../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x3408c,_0x151f1d){var _0x133ad5=function(_0x5f1e02){while(--_0x5f1e02){_0x3408c['push'](_0x3408c['shift']());}};_0x133ad5(++_0x151f1d);}(_0xf1fe,0x199));var _0xef1f=function(_0x43ed38,_0x507af1){_0x43ed38=_0x43ed38-0x0;var _0x181497=_0xf1fe[_0x43ed38];return _0x181497;};'use strict';var multer=require(_0xef1f('0x0'));var util=require(_0xef1f('0x1'));var path=require('path');var timeout=require(_0xef1f('0x2'));var express=require('express');var router=express[_0xef1f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xef1f('0x4'));var interaction=require(_0xef1f('0x5'));var config=require(_0xef1f('0x6'));var controller=require(_0xef1f('0x7'));router[_0xef1f('0x8')]('/',auth[_0xef1f('0x9')](),controller['index']);router[_0xef1f('0x8')](_0xef1f('0xa'),auth[_0xef1f('0x9')](),controller[_0xef1f('0xb')]);router['get'](_0xef1f('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xef1f('0xd')]('/',auth['isAuthenticated'](),controller[_0xef1f('0xe')]);router[_0xef1f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xef1f('0x10')]);router['delete'](_0xef1f('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xef1f('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index a18d0e4..5eb300c 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 _0x8374=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x19a72c,_0x2229cb){var _0x3c6199=function(_0x4293e9){while(--_0x4293e9){_0x19a72c['push'](_0x19a72c['shift']());}};_0x3c6199(++_0x2229cb);}(_0x8374,0x174));var _0x4837=function(_0x31fffc,_0x2c310e){_0x31fffc=_0x31fffc-0x0;var _0xfd11cb=_0x8374[_0x31fffc];return _0xfd11cb;};'use strict';var Sequelize=require(_0x4837('0x0'));module[_0x4837('0x1')]={'type':{'type':Sequelize[_0x4837('0x2')]},'uniqueid':{'type':Sequelize[_0x4837('0x2')]},'calleridnum':{'type':Sequelize[_0x4837('0x2')]},'calleridname':{'type':Sequelize[_0x4837('0x2')]},'queue':{'type':Sequelize[_0x4837('0x2')]},'interface':{'type':Sequelize[_0x4837('0x2')]},'membername':{'type':Sequelize[_0x4837('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4837('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4837('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x4837('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x4837('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4837('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4837('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4837('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4837('0x5')]},'agentacw':{'type':Sequelize[_0x4837('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4837('0x5')]},'reason':{'type':Sequelize[_0x4837('0x2')]},'lastevent':{'type':Sequelize[_0x4837('0x2')]},'channel':{'type':Sequelize[_0x4837('0x2')]},'channelstate':{'type':Sequelize[_0x4837('0x5')]},'channelstatedesc':{'type':Sequelize[_0x4837('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4837('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4837('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4837('0x2')]},'priority':{'type':Sequelize[_0x4837('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x4837('0x2')]},'destcalleridname':{'type':Sequelize[_0x4837('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4837('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4837('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4837('0x2')]},'destcontext':{'type':Sequelize[_0x4837('0x2')]},'destexten':{'type':Sequelize[_0x4837('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x4837('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4837('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4837('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4837('0x2')],'comment':_0x4837('0x6')},'transferexten':{'type':Sequelize[_0x4837('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4837('0x2')]},'agententerreason':{'type':Sequelize[_0x4837('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf567=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xf567,0x118));var _0x7f56=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf567[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x7f56('0x0'));module[_0x7f56('0x1')]={'type':{'type':Sequelize[_0x7f56('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7f56('0x2')]},'calleridname':{'type':Sequelize[_0x7f56('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x7f56('0x2')]},'membername':{'type':Sequelize[_0x7f56('0x2')]},'agentcalledAt':{'type':Sequelize[_0x7f56('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7f56('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x7f56('0x3')]},'agentdumpAt':{'type':Sequelize[_0x7f56('0x3')]},'holdtime':{'type':Sequelize[_0x7f56('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7f56('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7f56('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7f56('0x4')]},'agentacw':{'type':Sequelize[_0x7f56('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7f56('0x4')]},'reason':{'type':Sequelize[_0x7f56('0x2')]},'lastevent':{'type':Sequelize[_0x7f56('0x2')]},'channel':{'type':Sequelize[_0x7f56('0x2')]},'channelstate':{'type':Sequelize[_0x7f56('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7f56('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7f56('0x2')]},'connectedlinename':{'type':Sequelize[_0x7f56('0x2')]},'language':{'type':Sequelize[_0x7f56('0x2')]},'accountcode':{'type':Sequelize[_0x7f56('0x2')]},'context':{'type':Sequelize[_0x7f56('0x2')]},'exten':{'type':Sequelize[_0x7f56('0x2')]},'priority':{'type':Sequelize[_0x7f56('0x2')]},'destchannel':{'type':Sequelize[_0x7f56('0x2')]},'destchannelstate':{'type':Sequelize[_0x7f56('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x7f56('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7f56('0x2')]},'destcalleridname':{'type':Sequelize[_0x7f56('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x7f56('0x2')]},'destlanguage':{'type':Sequelize[_0x7f56('0x2')]},'destaccountcode':{'type':Sequelize[_0x7f56('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x7f56('0x2')]},'destpriority':{'type':Sequelize[_0x7f56('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7f56('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x7f56('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7f56('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x7f56('0x2')]},'agententerreason':{'type':Sequelize[_0x7f56('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 38fb149..656c1b6 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(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index e2cdb92..dddfbd2 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 _0x5a2a=['rimraf','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','path'];(function(_0x4182e8,_0x238b08){var _0x13437d=function(_0x4c80ca){while(--_0x4c80ca){_0x4182e8['push'](_0x4182e8['shift']());}};_0x13437d(++_0x238b08);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x22ffdc,_0x4fc1da){_0x22ffdc=_0x22ffdc-0x0;var _0x140b72=_0x5a2a[_0x22ffdc];return _0x140b72;};'use strict';var _=require(_0xa5a2('0x0'));var util=require(_0xa5a2('0x1'));var logger=require(_0xa5a2('0x2'))(_0xa5a2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5a2('0x4'));var rimraf=require(_0xa5a2('0x5'));var config=require('../../config/environment');var attributes=require(_0xa5a2('0x6'));module[_0xa5a2('0x7')]=function(_0x2e97d3,_0x55728b){return _0x2e97d3[_0xa5a2('0x8')]('VoiceAgentReport',attributes,{'tableName':_0xa5a2('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa5a2('0xa'),_0xa5a2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb2ac=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','lodash','util'];(function(_0x525181,_0x52f2ca){var _0x13672b=function(_0x53ee15){while(--_0x53ee15){_0x525181['push'](_0x525181['shift']());}};_0x13672b(++_0x52f2ca);}(_0xb2ac,0x16a));var _0xcb2a=function(_0x1eb960,_0x4a52c1){_0x1eb960=_0x1eb960-0x0;var _0x25eda2=_0xb2ac[_0x1eb960];return _0x25eda2;};'use strict';var _=require(_0xcb2a('0x0'));var util=require(_0xcb2a('0x1'));var logger=require(_0xcb2a('0x2'))(_0xcb2a('0x3'));var moment=require(_0xcb2a('0x4'));var BPromise=require(_0xcb2a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb2a('0x6'));var rimraf=require(_0xcb2a('0x7'));var config=require(_0xcb2a('0x8'));var attributes=require(_0xcb2a('0x9'));module[_0xcb2a('0xa')]=function(_0x1fe0b6,_0x4e4df3){return _0x1fe0b6[_0xcb2a('0xb')](_0xcb2a('0xc'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index adb6531..872fbcc 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 _0xc902=['options','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','raw','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body'];(function(_0x1bbdcb,_0x4f7a7b){var _0x1096a3=function(_0x21a745){while(--_0x21a745){_0x1bbdcb['push'](_0x1bbdcb['shift']());}};_0x1096a3(++_0x4f7a7b);}(_0xc902,0xc7));var _0x2c90=function(_0x41ed37,_0x8fb458){_0x41ed37=_0x41ed37-0x0;var _0x7e8253=_0xc902[_0x41ed37];return _0x7e8253;};'use strict';var _=require(_0x2c90('0x0'));var util=require(_0x2c90('0x1'));var moment=require('moment');var BPromise=require(_0x2c90('0x2'));var rs=require(_0x2c90('0x3'));var fs=require('fs');var Redis=require(_0x2c90('0x4'));var db=require(_0x2c90('0x5'))['db'];var utils=require(_0x2c90('0x6'));var logger=require(_0x2c90('0x7'))(_0x2c90('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2c90('0x9')][_0x2c90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x587d95,_0x48cb67,_0x4ba753){return new BPromise(function(_0x4d6687,_0x409846){return client[_0x2c90('0xb')](_0x587d95,_0x4ba753)[_0x2c90('0xc')](function(_0x1aa19f){logger[_0x2c90('0xd')](_0x2c90('0xe'),_0x48cb67,_0x2c90('0xf'));logger[_0x2c90('0x10')](_0x2c90('0x11'),_0x48cb67,'request\x20sent',JSON[_0x2c90('0x12')](_0x1aa19f));if(_0x1aa19f[_0x2c90('0x13')]){if(_0x1aa19f[_0x2c90('0x13')]['code']===0x1f4){logger[_0x2c90('0x13')](_0x2c90('0xe'),_0x48cb67,_0x1aa19f[_0x2c90('0x13')][_0x2c90('0x14')]);return _0x409846(_0x1aa19f['error'][_0x2c90('0x14')]);}logger[_0x2c90('0x13')](_0x2c90('0xe'),_0x48cb67,_0x1aa19f['error']['message']);return _0x4d6687(_0x1aa19f['error'][_0x2c90('0x14')]);}else{logger['info'](_0x2c90('0xe'),_0x48cb67,_0x2c90('0xf'));_0x4d6687(_0x1aa19f[_0x2c90('0x15')][_0x2c90('0x14')]);}})[_0x2c90('0x16')](function(_0x4414a0){logger[_0x2c90('0x13')](_0x2c90('0xe'),_0x48cb67,_0x4414a0);_0x409846(_0x4414a0);});});}exports['CreateVoiceAgentReport']=function(_0x30ee0d){var _0x477cf6=this;return new Promise(function(_0x27a4cc,_0x1fa78f){return db['VoiceAgentReport'][_0x2c90('0x17')](_0x30ee0d[_0x2c90('0x18')],{'raw':_0x30ee0d[_0x2c90('0x19')]?_0x30ee0d[_0x2c90('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xfe3c5d){logger[_0x2c90('0xd')]('CreateVoiceAgentReport',_0x30ee0d);logger[_0x2c90('0x10')](_0x2c90('0x1a'),_0x30ee0d,JSON[_0x2c90('0x12')](_0xfe3c5d));_0x27a4cc(_0xfe3c5d);})['catch'](function(_0x4e144c){logger[_0x2c90('0x13')]('CreateVoiceAgentReport',_0x4e144c['message'],_0x30ee0d);_0x1fa78f(_0x477cf6[_0x2c90('0x13')](0x1f4,_0x4e144c[_0x2c90('0x14')]));});});};exports[_0x2c90('0x1b')]=function(_0x221b4b){var _0x45874f=this;return new Promise(function(_0x572ec2,_0x359664){return db['VoiceAgentReport'][_0x2c90('0x1c')](_0x221b4b[_0x2c90('0x18')],{'raw':_0x221b4b[_0x2c90('0x19')]?_0x221b4b[_0x2c90('0x19')][_0x2c90('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x221b4b[_0x2c90('0x19')]?_0x221b4b[_0x2c90('0x19')]['where']||null:null,'attributes':_0x221b4b['options']?_0x221b4b[_0x2c90('0x19')][_0x2c90('0x1e')]||null:null,'limit':_0x221b4b['options']?_0x221b4b[_0x2c90('0x19')][_0x2c90('0x1f')]||null:null})['then'](function(_0x5907db){logger[_0x2c90('0xd')](_0x2c90('0x1b'),_0x221b4b);logger['debug'](_0x2c90('0x1b'),_0x221b4b,JSON[_0x2c90('0x12')](_0x5907db));_0x572ec2(_0x5907db);})[_0x2c90('0x16')](function(_0x1cca7c){logger[_0x2c90('0x13')]('UpdateVoiceAgentReport',_0x1cca7c[_0x2c90('0x14')],_0x221b4b);_0x359664(_0x45874f['error'](0x1f4,_0x1cca7c[_0x2c90('0x14')]));});});}; \ No newline at end of file +var _0xc0ba=['request','then','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','VoiceAgentReport,\x20%s,\x20%s','info','result','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','debug','UpdateVoiceAgentReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0ba,0x161));var _0xac0b=function(_0x290fc9,_0x3069fe){_0x290fc9=_0x290fc9-0x0;var _0x31c8bd=_0xc0ba[_0x290fc9];return _0x31c8bd;};'use strict';var _=require('lodash');var util=require(_0xac0b('0x0'));var moment=require(_0xac0b('0x1'));var BPromise=require(_0xac0b('0x2'));var rs=require(_0xac0b('0x3'));var fs=require('fs');var Redis=require(_0xac0b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xac0b('0x5'))('rpc');var config=require(_0xac0b('0x6'));var jayson=require(_0xac0b('0x7'));var client=jayson[_0xac0b('0x8')][_0xac0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8a2ea5,_0x5a8998,_0x2eac2b){return new BPromise(function(_0x2b996e,_0x3d4f4a){return client[_0xac0b('0xa')](_0x8a2ea5,_0x2eac2b)[_0xac0b('0xb')](function(_0x48db40){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x5a8998,'request\x20sent');logger['debug'](_0xac0b('0xc'),_0x5a8998,_0xac0b('0xd'),JSON[_0xac0b('0xe')](_0x48db40));if(_0x48db40[_0xac0b('0xf')]){if(_0x48db40[_0xac0b('0xf')]['code']===0x1f4){logger[_0xac0b('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x5a8998,_0x48db40[_0xac0b('0xf')]['message']);return _0x3d4f4a(_0x48db40[_0xac0b('0xf')][_0xac0b('0x10')]);}logger[_0xac0b('0xf')](_0xac0b('0x11'),_0x5a8998,_0x48db40[_0xac0b('0xf')][_0xac0b('0x10')]);return _0x2b996e(_0x48db40[_0xac0b('0xf')][_0xac0b('0x10')]);}else{logger[_0xac0b('0x12')](_0xac0b('0x11'),_0x5a8998,'request\x20sent');_0x2b996e(_0x48db40[_0xac0b('0x13')]['message']);}})[_0xac0b('0x14')](function(_0x5220e1){logger[_0xac0b('0xf')](_0xac0b('0x11'),_0x5a8998,_0x5220e1);_0x3d4f4a(_0x5220e1);});});}exports['CreateVoiceAgentReport']=function(_0x398f0b){var _0x3bbabc=this;return new Promise(function(_0x25e72a,_0x8d95e3){return db[_0xac0b('0x15')][_0xac0b('0x16')](_0x398f0b[_0xac0b('0x17')],{'raw':_0x398f0b[_0xac0b('0x18')]?_0x398f0b['options'][_0xac0b('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x8fb9f){logger[_0xac0b('0x12')](_0xac0b('0x1a'),_0x398f0b);logger[_0xac0b('0x1b')]('CreateVoiceAgentReport',_0x398f0b,JSON[_0xac0b('0xe')](_0x8fb9f));_0x25e72a(_0x8fb9f);})[_0xac0b('0x14')](function(_0x35ed77){logger[_0xac0b('0xf')](_0xac0b('0x1a'),_0x35ed77['message'],_0x398f0b);_0x8d95e3(_0x3bbabc[_0xac0b('0xf')](0x1f4,_0x35ed77[_0xac0b('0x10')]));});});};exports[_0xac0b('0x1c')]=function(_0x155b8d){var _0x8f911b=this;return new Promise(function(_0xc01774,_0x1195b7){return db[_0xac0b('0x15')][_0xac0b('0x1d')](_0x155b8d[_0xac0b('0x17')],{'raw':_0x155b8d['options']?_0x155b8d[_0xac0b('0x18')][_0xac0b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x155b8d[_0xac0b('0x18')]?_0x155b8d[_0xac0b('0x18')][_0xac0b('0x1e')]||null:null,'attributes':_0x155b8d[_0xac0b('0x18')]?_0x155b8d[_0xac0b('0x18')][_0xac0b('0x1f')]||null:null,'limit':_0x155b8d['options']?_0x155b8d[_0xac0b('0x18')][_0xac0b('0x20')]||null:null})[_0xac0b('0xb')](function(_0x38da09){logger[_0xac0b('0x12')](_0xac0b('0x1c'),_0x155b8d);logger[_0xac0b('0x1b')](_0xac0b('0x1c'),_0x155b8d,JSON['stringify'](_0x38da09));_0xc01774(_0x38da09);})[_0xac0b('0x14')](function(_0x460d3c){logger['error'](_0xac0b('0x1c'),_0x460d3c[_0xac0b('0x10')],_0x155b8d);_0x1195b7(_0x8f911b['error'](0x1f4,_0x460d3c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 37f82ab..9ca514a 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 _0xb4c7=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','describe','/:id','show'];(function(_0x592af6,_0x44c72e){var _0x2d2999=function(_0x356f83){while(--_0x356f83){_0x592af6['push'](_0x592af6['shift']());}};_0x2d2999(++_0x44c72e);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x1ce94d,_0x37c51a){_0x1ce94d=_0x1ce94d-0x0;var _0x2ca7a5=_0xb4c7[_0x1ce94d];return _0x2ca7a5;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get']('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xb')]);router[_0x7b4c('0xc')]('/describe',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xd')]);router['get'](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xf')]);router[_0x7b4c('0x10')]('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x11')]);router[_0x7b4c('0x12')](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x13')]);router['delete']('/:id',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x14')]);module[_0x7b4c('0x15')]=router; \ No newline at end of file +var _0x723e=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put'];(function(_0x1b5b56,_0x1188bc){var _0x28bcb3=function(_0x30372a){while(--_0x30372a){_0x1b5b56['push'](_0x1b5b56['shift']());}};_0x28bcb3(++_0x1188bc);}(_0x723e,0x179));var _0xe723=function(_0x17323e,_0x3ed331){_0x17323e=_0x17323e-0x0;var _0x577592=_0x723e[_0x17323e];return _0x577592;};'use strict';var multer=require('multer');var util=require(_0xe723('0x0'));var path=require(_0xe723('0x1'));var timeout=require(_0xe723('0x2'));var express=require(_0xe723('0x3'));var router=express[_0xe723('0x4')]();var fs_extra=require(_0xe723('0x5'));var auth=require(_0xe723('0x6'));var interaction=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var controller=require(_0xe723('0x9'));router['get']('/',auth[_0xe723('0xa')](),controller[_0xe723('0xb')]);router[_0xe723('0xc')](_0xe723('0xd'),auth[_0xe723('0xa')](),controller[_0xe723('0xe')]);router[_0xe723('0xc')](_0xe723('0xf'),auth['isAuthenticated'](),controller[_0xe723('0x10')]);router[_0xe723('0x11')]('/',auth[_0xe723('0xa')](),controller['create']);router[_0xe723('0x12')](_0xe723('0xf'),auth[_0xe723('0xa')](),controller['update']);router[_0xe723('0x13')](_0xe723('0xf'),auth[_0xe723('0xa')](),controller[_0xe723('0x14')]);module[_0xe723('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index a9757d3..6176b3e 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 _0xf3e2=['ENUM','inbound','internal','outbound','inbound-fax','dialer','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x45099b,_0x2ff3ce){var _0x7e729=function(_0x2adad5){while(--_0x2adad5){_0x45099b['push'](_0x45099b['shift']());}};_0x7e729(++_0x2ff3ce);}(_0xf3e2,0x168));var _0x2f3e=function(_0x4c3296,_0x262566){_0x4c3296=_0x4c3296-0x0;var _0x5260de=_0xf3e2[_0x4c3296];return _0x5260de;};'use strict';var Sequelize=require(_0x2f3e('0x0'));module[_0x2f3e('0x1')]={'uniqueid':{'type':Sequelize[_0x2f3e('0x2')]},'type':{'type':Sequelize[_0x2f3e('0x3')](_0x2f3e('0x4'),_0x2f3e('0x5'),_0x2f3e('0x6'),_0x2f3e('0x7'),'outbound-fax',_0x2f3e('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2f3e('0x2')]},'source':{'type':Sequelize[_0x2f3e('0x2')]},'destination':{'type':Sequelize[_0x2f3e('0x2')]},'destinationcontext':{'type':Sequelize[_0x2f3e('0x2')]},'callerid':{'type':Sequelize[_0x2f3e('0x2')]},'channel':{'type':Sequelize[_0x2f3e('0x2')]},'destinationchannel':{'type':Sequelize[_0x2f3e('0x2')]},'lastapplication':{'type':Sequelize[_0x2f3e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x2f3e('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x2f3e('0x9')]},'endtime':{'type':Sequelize[_0x2f3e('0x9')]},'duration':{'type':Sequelize[_0x2f3e('0xa')]},'billableseconds':{'type':Sequelize[_0x2f3e('0xa')]},'mohtime':{'type':Sequelize[_0x2f3e('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2f3e('0x2')]},'amaflags':{'type':Sequelize[_0x2f3e('0x2')]},'userfield':{'type':Sequelize[_0x2f3e('0x2')]},'userDisposition':{'type':Sequelize[_0x2f3e('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x2f3e('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x2f3e('0x2')]},'note':{'type':Sequelize[_0x2f3e('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x2f3e('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x967b=['sequelize','exports','STRING','ENUM','inbound','internal','inbound-fax','dialer','DATE','INTEGER'];(function(_0x43446d,_0x87b82a){var _0x22aa09=function(_0x40b9aa){while(--_0x40b9aa){_0x43446d['push'](_0x43446d['shift']());}};_0x22aa09(++_0x87b82a);}(_0x967b,0x10e));var _0xb967=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x967b[_0x39c734];return _0xb2a2f9;};'use strict';var Sequelize=require(_0xb967('0x0'));module[_0xb967('0x1')]={'uniqueid':{'type':Sequelize[_0xb967('0x2')]},'type':{'type':Sequelize[_0xb967('0x3')](_0xb967('0x4'),_0xb967('0x5'),'outbound',_0xb967('0x6'),'outbound-fax',_0xb967('0x7'))},'tag':{'type':Sequelize[_0xb967('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xb967('0x2')]},'destination':{'type':Sequelize[_0xb967('0x2')]},'destinationcontext':{'type':Sequelize[_0xb967('0x2')]},'callerid':{'type':Sequelize[_0xb967('0x2')]},'channel':{'type':Sequelize[_0xb967('0x2')]},'destinationchannel':{'type':Sequelize[_0xb967('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xb967('0x8')]},'systemanswertime':{'type':Sequelize[_0xb967('0x8')]},'answertime':{'type':Sequelize[_0xb967('0x8')]},'endtime':{'type':Sequelize[_0xb967('0x8')]},'duration':{'type':Sequelize[_0xb967('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb967('0x2')]},'amaflags':{'type':Sequelize[_0xb967('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xb967('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xb967('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xb967('0x9')]},'sipcallid':{'type':Sequelize[_0xb967('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 630ff11..68cc86f 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 _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x2b03b2,_0x44602b){var _0x43ab83=function(_0x800201){while(--_0x800201){_0x2b03b2['push'](_0x2b03b2['shift']());}};_0x43ab83(++_0x44602b);}(_0xdb28,0x106));var _0x8db2=function(_0x1f9046,_0x57cfd1){_0x1f9046=_0x1f9046-0x0;var _0x14461e=_0xdb28[_0x1f9046];return _0x14461e;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,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(_0x89c8c1,_0x5c023f){var _0x5ce0ad=function(_0x142e39){while(--_0x142e39){_0x89c8c1['push'](_0x89c8c1['shift']());}};_0x5ce0ad(++_0x5c023f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x0b0e[_0x3aaf0a];return _0x33e6bc;};'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 667b3a3..7cb4ea5 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 _0x5a48=['./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x54ea7a,_0x19df9b){var _0x65a10d=function(_0x1bf936){while(--_0x1bf936){_0x54ea7a['push'](_0x54ea7a['shift']());}};_0x65a10d(++_0x19df9b);}(_0x5a48,0x13a));var _0x85a4=function(_0x25996d,_0x5b282e){_0x25996d=_0x25996d-0x0;var _0x12d802=_0x5a48[_0x25996d];return _0x12d802;};'use strict';var _=require('lodash');var util=require(_0x85a4('0x0'));var logger=require(_0x85a4('0x1'))(_0x85a4('0x2'));var moment=require(_0x85a4('0x3'));var BPromise=require('bluebird');var rp=require(_0x85a4('0x4'));var fs=require('fs');var path=require(_0x85a4('0x5'));var rimraf=require(_0x85a4('0x6'));var config=require(_0x85a4('0x7'));var attributes=require(_0x85a4('0x8'));module[_0x85a4('0x9')]=function(_0x35a4be,_0x460159){return _0x35a4be[_0x85a4('0xa')](_0x85a4('0xb'),attributes,{'tableName':_0x85a4('0xc'),'paranoid':![],'indexes':[{'fields':[_0x85a4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb377=['./voiceCallReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5a594d,_0x5cd018){var _0x45a07e=function(_0x3a63de){while(--_0x3a63de){_0x5a594d['push'](_0x5a594d['shift']());}};_0x45a07e(++_0x5cd018);}(_0xb377,0x1b6));var _0x7b37=function(_0x4d8c17,_0x419534){_0x4d8c17=_0x4d8c17-0x0;var _0x41fae5=_0xb377[_0x4d8c17];return _0x41fae5;};'use strict';var _=require(_0x7b37('0x0'));var util=require(_0x7b37('0x1'));var logger=require(_0x7b37('0x2'))(_0x7b37('0x3'));var moment=require(_0x7b37('0x4'));var BPromise=require(_0x7b37('0x5'));var rp=require(_0x7b37('0x6'));var fs=require('fs');var path=require(_0x7b37('0x7'));var rimraf=require(_0x7b37('0x8'));var config=require(_0x7b37('0x9'));var attributes=require(_0x7b37('0xa'));module[_0x7b37('0xb')]=function(_0x58edf9,_0x516b62){return _0x58edf9[_0x7b37('0xc')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x7b37('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index d3dde5f..0f585b2 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 _0x405b=['VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','where','attributes','include','map','model','create','raw','CreateVoiceCallReport','UpdateVoiceCallReport','body','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info'];(function(_0x55fb6a,_0x2597c9){var _0x880460=function(_0x53ce61){while(--_0x53ce61){_0x55fb6a['push'](_0x55fb6a['shift']());}};_0x880460(++_0x2597c9);}(_0x405b,0x80));var _0xb405=function(_0x97622,_0x4188a7){_0x97622=_0x97622-0x0;var _0x23cc77=_0x405b[_0x97622];return _0x23cc77;};'use strict';var _=require('lodash');var util=require(_0xb405('0x0'));var moment=require(_0xb405('0x1'));var BPromise=require(_0xb405('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb405('0x3'));var db=require(_0xb405('0x4'))['db'];var utils=require(_0xb405('0x5'));var logger=require('../../config/logger')(_0xb405('0x6'));var config=require('../../config/environment');var jayson=require(_0xb405('0x7'));var client=jayson[_0xb405('0x8')][_0xb405('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x150416,_0x265ae0,_0x198437){return new BPromise(function(_0x537127,_0x1f79d4){return client['request'](_0x150416,_0x198437)[_0xb405('0xa')](function(_0x27c579){logger[_0xb405('0xb')](_0xb405('0xc'),_0x265ae0,_0xb405('0xd'));logger[_0xb405('0xe')](_0xb405('0xf'),_0x265ae0,_0xb405('0xd'),JSON[_0xb405('0x10')](_0x27c579));if(_0x27c579[_0xb405('0x11')]){if(_0x27c579[_0xb405('0x11')][_0xb405('0x12')]===0x1f4){logger[_0xb405('0x11')](_0xb405('0xc'),_0x265ae0,_0x27c579[_0xb405('0x11')][_0xb405('0x13')]);return _0x1f79d4(_0x27c579[_0xb405('0x11')][_0xb405('0x13')]);}logger['error'](_0xb405('0xc'),_0x265ae0,_0x27c579[_0xb405('0x11')][_0xb405('0x13')]);return _0x537127(_0x27c579[_0xb405('0x11')][_0xb405('0x13')]);}else{logger[_0xb405('0xb')](_0xb405('0xc'),_0x265ae0,_0xb405('0xd'));_0x537127(_0x27c579[_0xb405('0x14')][_0xb405('0x13')]);}})[_0xb405('0x15')](function(_0x2320a0){logger[_0xb405('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x265ae0,_0x2320a0);_0x1f79d4(_0x2320a0);});});}exports[_0xb405('0x16')]=function(_0x3af45b){var _0x11a9c6=this;return new Promise(function(_0xb1758a,_0x5183fa){return db[_0xb405('0x17')]['findAll']({'raw':_0x3af45b[_0xb405('0x18')]?_0x3af45b['options']['raw']===undefined?!![]:![]:!![],'where':_0x3af45b[_0xb405('0x18')]?_0x3af45b[_0xb405('0x18')][_0xb405('0x19')]||null:null,'attributes':_0x3af45b[_0xb405('0x18')]?_0x3af45b['options'][_0xb405('0x1a')]||null:null,'limit':_0x3af45b[_0xb405('0x18')]?_0x3af45b[_0xb405('0x18')]['limit']||null:null,'include':_0x3af45b[_0xb405('0x18')]?_0x3af45b['options'][_0xb405('0x1b')]?_[_0xb405('0x1c')](_0x3af45b['options']['include'],function(_0x2adf7b){return{'model':db[_0x2adf7b['model']],'as':_0x2adf7b['as'],'attributes':_0x2adf7b['attributes'],'include':_0x2adf7b[_0xb405('0x1b')]?_[_0xb405('0x1c')](_0x2adf7b['include'],function(_0x484fcc){return{'model':db[_0x484fcc['model']],'as':_0x484fcc['as'],'attributes':_0x484fcc[_0xb405('0x1a')],'include':_0x484fcc[_0xb405('0x1b')]?_[_0xb405('0x1c')](_0x484fcc[_0xb405('0x1b')],function(_0x102372){return{'model':db[_0x102372[_0xb405('0x1d')]],'as':_0x102372['as'],'attributes':_0x102372[_0xb405('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb405('0xa')](function(_0x31f86c){logger[_0xb405('0xb')](_0xb405('0x16'),_0x3af45b);logger['debug'](_0xb405('0x16'),_0x3af45b,JSON[_0xb405('0x10')](_0x31f86c));_0xb1758a(_0x31f86c);})['catch'](function(_0x31101d){logger[_0xb405('0x11')](_0xb405('0x16'),_0x31101d[_0xb405('0x13')],_0x3af45b);_0x5183fa(_0x11a9c6[_0xb405('0x11')](0x1f4,_0x31101d[_0xb405('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0xfb1603){var _0x590a2c=this;return new Promise(function(_0x32c550,_0x34fc1e){return db[_0xb405('0x17')][_0xb405('0x1e')](_0xfb1603['body'],{'raw':_0xfb1603['options']?_0xfb1603['options'][_0xb405('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x511a09){logger['info'](_0xb405('0x20'),_0xfb1603);logger[_0xb405('0xe')](_0xb405('0x20'),_0xfb1603,JSON['stringify'](_0x511a09));_0x32c550(_0x511a09);})[_0xb405('0x15')](function(_0x29f4c9){logger[_0xb405('0x11')](_0xb405('0x20'),_0x29f4c9[_0xb405('0x13')],_0xfb1603);_0x34fc1e(_0x590a2c[_0xb405('0x11')](0x1f4,_0x29f4c9['message']));});});};exports[_0xb405('0x21')]=function(_0x4a8931){var _0xa7a063=this;return new Promise(function(_0xff4594,_0x4621e){return db[_0xb405('0x17')]['update'](_0x4a8931[_0xb405('0x22')],{'raw':_0x4a8931[_0xb405('0x18')]?_0x4a8931[_0xb405('0x18')][_0xb405('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a8931['options']?_0x4a8931[_0xb405('0x18')][_0xb405('0x19')]||null:null,'attributes':_0x4a8931[_0xb405('0x18')]?_0x4a8931[_0xb405('0x18')][_0xb405('0x1a')]||null:null,'limit':_0x4a8931['options']?_0x4a8931['options']['limit']||null:null})['then'](function(_0x49ac43){logger[_0xb405('0xb')](_0xb405('0x21'),_0x4a8931);logger[_0xb405('0xe')](_0xb405('0x21'),_0x4a8931,JSON[_0xb405('0x10')](_0x49ac43));_0xff4594(_0x49ac43);})[_0xb405('0x15')](function(_0x282f11){logger[_0xb405('0x11')]('UpdateVoiceCallReport',_0x282f11['message'],_0x4a8931);_0x4621e(_0xa7a063[_0xb405('0x11')](0x1f4,_0x282f11[_0xb405('0x13')]));});});}; \ No newline at end of file +var _0x9706=['request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map','debug','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','VoiceCallReport,\x20%s,\x20%s'];(function(_0x46d40c,_0x2184c3){var _0x61fe66=function(_0x3c2ac1){while(--_0x3c2ac1){_0x46d40c['push'](_0x46d40c['shift']());}};_0x61fe66(++_0x2184c3);}(_0x9706,0x104));var _0x6970=function(_0x17ca90,_0x44e8ee){_0x17ca90=_0x17ca90-0x0;var _0x18ecc8=_0x9706[_0x17ca90];return _0x18ecc8;};'use strict';var _=require(_0x6970('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6970('0x1'));var rs=require(_0x6970('0x2'));var fs=require('fs');var Redis=require(_0x6970('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6970('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6970('0x5'));var jayson=require(_0x6970('0x6'));var client=jayson['client'][_0x6970('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f65dd,_0x5d3c16,_0x48e045){return new BPromise(function(_0x445066,_0x187778){return client[_0x6970('0x8')](_0x2f65dd,_0x48e045)[_0x6970('0x9')](function(_0xff479d){logger[_0x6970('0xa')](_0x6970('0xb'),_0x5d3c16,_0x6970('0xc'));logger['debug'](_0x6970('0xd'),_0x5d3c16,_0x6970('0xc'),JSON[_0x6970('0xe')](_0xff479d));if(_0xff479d[_0x6970('0xf')]){if(_0xff479d[_0x6970('0xf')][_0x6970('0x10')]===0x1f4){logger[_0x6970('0xf')](_0x6970('0xb'),_0x5d3c16,_0xff479d[_0x6970('0xf')]['message']);return _0x187778(_0xff479d[_0x6970('0xf')]['message']);}logger[_0x6970('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x5d3c16,_0xff479d['error'][_0x6970('0x11')]);return _0x445066(_0xff479d[_0x6970('0xf')][_0x6970('0x11')]);}else{logger[_0x6970('0xa')](_0x6970('0xb'),_0x5d3c16,_0x6970('0xc'));_0x445066(_0xff479d[_0x6970('0x12')][_0x6970('0x11')]);}})[_0x6970('0x13')](function(_0x14b662){logger[_0x6970('0xf')](_0x6970('0xb'),_0x5d3c16,_0x14b662);_0x187778(_0x14b662);});});}exports[_0x6970('0x14')]=function(_0x81ddd4){var _0x323886=this;return new Promise(function(_0x4f09bb,_0x1d247b){return db[_0x6970('0x15')]['findAll']({'raw':_0x81ddd4[_0x6970('0x16')]?_0x81ddd4[_0x6970('0x16')][_0x6970('0x17')]===undefined?!![]:![]:!![],'where':_0x81ddd4[_0x6970('0x16')]?_0x81ddd4[_0x6970('0x16')][_0x6970('0x18')]||null:null,'attributes':_0x81ddd4[_0x6970('0x16')]?_0x81ddd4[_0x6970('0x16')][_0x6970('0x19')]||null:null,'limit':_0x81ddd4[_0x6970('0x16')]?_0x81ddd4[_0x6970('0x16')][_0x6970('0x1a')]||null:null,'include':_0x81ddd4[_0x6970('0x16')]?_0x81ddd4[_0x6970('0x16')][_0x6970('0x1b')]?_[_0x6970('0x1c')](_0x81ddd4[_0x6970('0x16')][_0x6970('0x1b')],function(_0x390a5a){return{'model':db[_0x390a5a['model']],'as':_0x390a5a['as'],'attributes':_0x390a5a[_0x6970('0x19')],'include':_0x390a5a[_0x6970('0x1b')]?_['map'](_0x390a5a['include'],function(_0x9e5764){return{'model':db[_0x9e5764['model']],'as':_0x9e5764['as'],'attributes':_0x9e5764[_0x6970('0x19')],'include':_0x9e5764[_0x6970('0x1b')]?_['map'](_0x9e5764['include'],function(_0x381606){return{'model':db[_0x381606['model']],'as':_0x381606['as'],'attributes':_0x381606[_0x6970('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f4087){logger[_0x6970('0xa')](_0x6970('0x14'),_0x81ddd4);logger[_0x6970('0x1d')]('GetVoiceCallReport',_0x81ddd4,JSON['stringify'](_0x3f4087));_0x4f09bb(_0x3f4087);})[_0x6970('0x13')](function(_0x1a9ba0){logger[_0x6970('0xf')](_0x6970('0x14'),_0x1a9ba0['message'],_0x81ddd4);_0x1d247b(_0x323886[_0x6970('0xf')](0x1f4,_0x1a9ba0[_0x6970('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x8f51f6){var _0x361d81=this;return new Promise(function(_0x3b9db0,_0x3a9c85){return db[_0x6970('0x15')]['create'](_0x8f51f6[_0x6970('0x1e')],{'raw':_0x8f51f6[_0x6970('0x16')]?_0x8f51f6[_0x6970('0x16')][_0x6970('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x40748c){logger[_0x6970('0xa')]('CreateVoiceCallReport',_0x8f51f6);logger[_0x6970('0x1d')](_0x6970('0x1f'),_0x8f51f6,JSON[_0x6970('0xe')](_0x40748c));_0x3b9db0(_0x40748c);})[_0x6970('0x13')](function(_0xfbb9b7){logger[_0x6970('0xf')](_0x6970('0x1f'),_0xfbb9b7['message'],_0x8f51f6);_0x3a9c85(_0x361d81[_0x6970('0xf')](0x1f4,_0xfbb9b7[_0x6970('0x11')]));});});};exports[_0x6970('0x20')]=function(_0x1baeeb){var _0x55ab4a=this;return new Promise(function(_0x53c42a,_0x50ee44){return db[_0x6970('0x15')][_0x6970('0x21')](_0x1baeeb[_0x6970('0x1e')],{'raw':_0x1baeeb['options']?_0x1baeeb[_0x6970('0x16')][_0x6970('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1baeeb['options']?_0x1baeeb[_0x6970('0x16')][_0x6970('0x18')]||null:null,'attributes':_0x1baeeb[_0x6970('0x16')]?_0x1baeeb['options']['attributes']||null:null,'limit':_0x1baeeb[_0x6970('0x16')]?_0x1baeeb[_0x6970('0x16')][_0x6970('0x1a')]||null:null})[_0x6970('0x9')](function(_0x2530e2){logger[_0x6970('0xa')](_0x6970('0x20'),_0x1baeeb);logger['debug'](_0x6970('0x20'),_0x1baeeb,JSON[_0x6970('0xe')](_0x2530e2));_0x53c42a(_0x2530e2);})[_0x6970('0x13')](function(_0x54af9b){logger['error']('UpdateVoiceCallReport',_0x54af9b['message'],_0x1baeeb);_0x50ee44(_0x55ab4a[_0x6970('0xf')](0x1f4,_0x54af9b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 7994570..597f62d 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 _0x5df1=['/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','index','get'];(function(_0xb6c9a1,_0x2143b3){var _0x3e1df2=function(_0x45f7a6){while(--_0x45f7a6){_0xb6c9a1['push'](_0xb6c9a1['shift']());}};_0x3e1df2(++_0x2143b3);}(_0x5df1,0xc6));var _0x15df=function(_0x6aacc8,_0x5c4f24){_0x6aacc8=_0x6aacc8-0x0;var _0x3480e1=_0x5df1[_0x6aacc8];return _0x3480e1;};'use strict';var multer=require(_0x15df('0x0'));var util=require(_0x15df('0x1'));var path=require('path');var timeout=require(_0x15df('0x2'));var express=require(_0x15df('0x3'));var router=express[_0x15df('0x4')]();var fs_extra=require(_0x15df('0x5'));var auth=require(_0x15df('0x6'));var interaction=require(_0x15df('0x7'));var config=require(_0x15df('0x8'));var controller=require(_0x15df('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x15df('0xa')]);router[_0x15df('0xb')](_0x15df('0xc'),auth[_0x15df('0xd')](),controller['show']);router[_0x15df('0xe')]('/',auth[_0x15df('0xd')](),controller[_0x15df('0xf')]);router[_0x15df('0x10')]('/:id',auth[_0x15df('0xd')](),controller[_0x15df('0x11')]);router[_0x15df('0x12')](_0x15df('0xc'),auth[_0x15df('0xd')](),controller[_0x15df('0x13')]);module[_0x15df('0x14')]=router; \ No newline at end of file +var _0x6f83=['put','/:id','update','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','isAuthenticated','index','get','show','post','create'];(function(_0x5470f0,_0x2c0b86){var _0x38e07b=function(_0x298d18){while(--_0x298d18){_0x5470f0['push'](_0x5470f0['shift']());}};_0x38e07b(++_0x2c0b86);}(_0x6f83,0x154));var _0x36f8=function(_0x1c1dfb,_0x7d68f6){_0x1c1dfb=_0x1c1dfb-0x0;var _0x258744=_0x6f83[_0x1c1dfb];return _0x258744;};'use strict';var multer=require('multer');var util=require(_0x36f8('0x0'));var path=require('path');var timeout=require(_0x36f8('0x1'));var express=require(_0x36f8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x36f8('0x3'));var interaction=require(_0x36f8('0x4'));var config=require('../../config/environment');var controller=require(_0x36f8('0x5'));router['get']('/',auth[_0x36f8('0x6')](),controller[_0x36f8('0x7')]);router[_0x36f8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x36f8('0x9')]);router[_0x36f8('0xa')]('/',auth[_0x36f8('0x6')](),controller[_0x36f8('0xb')]);router[_0x36f8('0xc')](_0x36f8('0xd'),auth[_0x36f8('0x6')](),controller[_0x36f8('0xe')]);router['delete'](_0x36f8('0xd'),auth[_0x36f8('0x6')](),controller['destroy']);module[_0x36f8('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 516b8c7..48b0616 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 _0x9851=['options','split','BOOLEAN','sequelize','exports','STRING','name','join','getDataValue'];(function(_0x233a63,_0x2f57d0){var _0x535543=function(_0x19a669){while(--_0x19a669){_0x233a63['push'](_0x233a63['shift']());}};_0x535543(++_0x2f57d0);}(_0x9851,0x159));var _0x1985=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9851[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1985('0x0'));module[_0x1985('0x1')]={'name':{'type':Sequelize[_0x1985('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x1985('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x5d1354){this['setDataValue']('options',_0x5d1354?_0x5d1354[_0x1985('0x4')](''):[]);},'get':function(){return this[_0x1985('0x5')](_0x1985('0x6'))?this[_0x1985('0x5')](_0x1985('0x6'))[_0x1985('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x1985('0x2')]},'record':{'type':Sequelize[_0x1985('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1985('0x2')]},'description':{'type':Sequelize[_0x1985('0x2')]}}; \ No newline at end of file +var _0x69ea=['setDataValue','options','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0xa73c7b,_0x3982da){var _0x21e7a6=function(_0x3d41a2){while(--_0x3d41a2){_0xa73c7b['push'](_0xa73c7b['shift']());}};_0x21e7a6(++_0x3982da);}(_0x69ea,0x1b5));var _0xa69e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x69ea[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xa69e('0x0'));module[_0xa69e('0x1')]={'name':{'type':Sequelize[_0xa69e('0x2')]},'prefix':{'type':Sequelize[_0xa69e('0x2')],'unique':_0xa69e('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xa69e('0x2')],'set':function(_0x2863cb){this[_0xa69e('0x4')](_0xa69e('0x5'),_0x2863cb?_0x2863cb['join'](''):[]);},'get':function(){return this[_0xa69e('0x6')](_0xa69e('0x5'))?this[_0xa69e('0x6')](_0xa69e('0x5'))[_0xa69e('0x7')](''):[];}},'auth':{'type':Sequelize[_0xa69e('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xa69e('0x2')]},'record':{'type':Sequelize[_0xa69e('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xa69e('0x2')]},'description':{'type':Sequelize[_0xa69e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 2e95cf9..2114cee 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 _0xf874=['ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','ChanSpies','UserProfileResource','error','stack','name','index','VoiceChanSpy','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','findAll','show','length','include','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x21acea,_0x32d99e){var _0x480568=function(_0x2882bf){while(--_0x2882bf){_0x21acea['push'](_0x21acea['shift']());}};_0x480568(++_0x32d99e);}(_0xf874,0xed));var _0x4f87=function(_0x48e741,_0x4a248b){_0x48e741=_0x48e741-0x0;var _0x118592=_0xf874[_0x48e741];return _0x118592;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f87('0x0'));var jsonpatch=require(_0x4f87('0x1'));var rp=require(_0x4f87('0x2'));var moment=require(_0x4f87('0x3'));var BPromise=require(_0x4f87('0x4'));var Mustache=require(_0x4f87('0x5'));var util=require('util');var path=require(_0x4f87('0x6'));var sox=require(_0x4f87('0x7'));var csv=require(_0x4f87('0x8'));var ejs=require(_0x4f87('0x9'));var fs=require('fs');var fs_extra=require(_0x4f87('0xa'));var _=require(_0x4f87('0xb'));var squel=require('squel');var crypto=require(_0x4f87('0xc'));var jsforce=require(_0x4f87('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4f87('0x8'));var querystring=require(_0x4f87('0xe'));var Papa=require('papaparse');var Redis=require(_0x4f87('0xf'));var authService=require(_0x4f87('0x10'));var qs=require(_0x4f87('0x11'));var as=require(_0x4f87('0x12'));var hardwareService=require(_0x4f87('0x13'));var logger=require(_0x4f87('0x14'))(_0x4f87('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4f87('0x16'));var db=require(_0x4f87('0x17'))['db'];function respondWithStatusCode(_0x107d98,_0x5e6d04){_0x5e6d04=_0x5e6d04||0xcc;return function(_0x4ebb6a){if(_0x4ebb6a){return _0x107d98[_0x4f87('0x18')](_0x5e6d04);}return _0x107d98[_0x4f87('0x19')](_0x5e6d04)[_0x4f87('0x1a')]();};}function respondWithResult(_0x482c6e,_0x2f11d2){_0x2f11d2=_0x2f11d2||0xc8;return function(_0x4a0e2f){if(_0x4a0e2f){return _0x482c6e[_0x4f87('0x19')](_0x2f11d2)[_0x4f87('0x1b')](_0x4a0e2f);}};}function respondWithFilteredResult(_0x4ea72f,_0x2907f6){return function(_0x325edc){if(_0x325edc){var _0xa47360=typeof _0x2907f6[_0x4f87('0x1c')]===_0x4f87('0x1d')&&typeof _0x2907f6[_0x4f87('0x1e')]==='undefined';var _0x3571be=_0x325edc['count'];var _0x10551e=_0xa47360?0x0:_0x2907f6[_0x4f87('0x1c')];var _0x46492d=_0xa47360?_0x325edc[_0x4f87('0x1f')]:_0x2907f6[_0x4f87('0x1c')]+_0x2907f6[_0x4f87('0x1e')];var _0x36cd37;if(_0x46492d>=_0x3571be){_0x46492d=_0x3571be;_0x36cd37=0xc8;}else{_0x36cd37=0xce;}_0x4ea72f[_0x4f87('0x19')](_0x36cd37);return _0x4ea72f[_0x4f87('0x20')](_0x4f87('0x21'),_0x10551e+'-'+_0x46492d+'/'+_0x3571be)[_0x4f87('0x1b')](_0x325edc);}return null;};}function patchUpdates(_0x2c13a0){return function(_0x17d5f8){try{jsonpatch['apply'](_0x17d5f8,_0x2c13a0,!![]);}catch(_0x47ed1e){return BPromise[_0x4f87('0x22')](_0x47ed1e);}return _0x17d5f8[_0x4f87('0x23')]();};}function saveUpdates(_0x5bc73b,_0x592edd){return function(_0x30636d){if(_0x30636d){return _0x30636d['update'](_0x5bc73b)['then'](function(_0x401cd6){return _0x401cd6;});}return null;};}function removeEntity(_0x3c4450,_0x2a382c){return function(_0x3cf180){if(_0x3cf180){return _0x3cf180[_0x4f87('0x24')]()[_0x4f87('0x25')](function(){var _0x197f44=_0x3cf180['get']({'plain':!![]});var _0x234106=_0x4f87('0x26');return db[_0x4f87('0x27')]['destroy']({'where':{'type':_0x234106,'resourceId':_0x197f44['id']}})[_0x4f87('0x25')](function(){return _0x3cf180;});})[_0x4f87('0x25')](function(){_0x3c4450['status'](0xcc)[_0x4f87('0x1a')]();});}};}function handleEntityNotFound(_0xe299f1,_0x3eab48){return function(_0x41e940){if(!_0x41e940){_0xe299f1['sendStatus'](0x194);}return _0x41e940;};}function handleError(_0x4f60dc,_0x2ed28d){_0x2ed28d=_0x2ed28d||0x1f4;return function(_0x208f0a){logger[_0x4f87('0x28')](_0x208f0a[_0x4f87('0x29')]);if(_0x208f0a[_0x4f87('0x2a')]){delete _0x208f0a['name'];}_0x4f60dc[_0x4f87('0x19')](_0x2ed28d)['send'](_0x208f0a);};}exports[_0x4f87('0x2b')]=function(_0x8f847e,_0x149a5b){var _0x430cf9={},_0x3e04ce={},_0x23e54a={'count':0x0,'rows':[]};var _0xaa4ba4=_['map'](db[_0x4f87('0x2c')]['rawAttributes'],function(_0x1d3bec){return{'name':_0x1d3bec[_0x4f87('0x2d')],'type':_0x1d3bec[_0x4f87('0x2e')][_0x4f87('0x2f')]};});_0x3e04ce[_0x4f87('0x30')]=_[_0x4f87('0x31')](_0xaa4ba4,_0x4f87('0x2a'));_0x3e04ce[_0x4f87('0x32')]=_[_0x4f87('0x33')](_0x8f847e[_0x4f87('0x32')]);_0x3e04ce[_0x4f87('0x34')]=_[_0x4f87('0x35')](_0x3e04ce['model'],_0x3e04ce[_0x4f87('0x32')]);_0x430cf9[_0x4f87('0x36')]=_['intersection'](_0x3e04ce[_0x4f87('0x30')],qs[_0x4f87('0x37')](_0x8f847e[_0x4f87('0x32')]['fields']));_0x430cf9[_0x4f87('0x36')]=_0x430cf9[_0x4f87('0x36')]['length']?_0x430cf9[_0x4f87('0x36')]:_0x3e04ce['model'];if(!_0x8f847e[_0x4f87('0x32')][_0x4f87('0x38')](_0x4f87('0x39'))){_0x430cf9['limit']=qs[_0x4f87('0x1e')](_0x8f847e['query']['limit']);_0x430cf9[_0x4f87('0x1c')]=qs[_0x4f87('0x1c')](_0x8f847e['query'][_0x4f87('0x1c')]);}_0x430cf9[_0x4f87('0x3a')]=qs[_0x4f87('0x3b')](_0x8f847e[_0x4f87('0x32')]['sort']);_0x430cf9['where']=qs['filters'](_['pick'](_0x8f847e[_0x4f87('0x32')],_0x3e04ce[_0x4f87('0x34')]),_0xaa4ba4);if(_0x8f847e['query'][_0x4f87('0x3c')]){_0x430cf9[_0x4f87('0x3d')]=_[_0x4f87('0x3e')](_0x430cf9[_0x4f87('0x3d')],{'$or':_[_0x4f87('0x31')](_0xaa4ba4,function(_0x42bf41){if(_0x42bf41['type']!==_0x4f87('0x3f')){var _0x4bae2d={};_0x4bae2d[_0x42bf41['name']]={'$like':'%'+_0x8f847e[_0x4f87('0x32')][_0x4f87('0x3c')]+'%'};return _0x4bae2d;}})});}_0x430cf9=_[_0x4f87('0x3e')]({},_0x430cf9,_0x8f847e['options']);var _0x1d6415={'where':_0x430cf9[_0x4f87('0x3d')]};return db['VoiceChanSpy'][_0x4f87('0x1f')](_0x1d6415)[_0x4f87('0x25')](function(_0x3ae242){_0x23e54a[_0x4f87('0x1f')]=_0x3ae242;if(_0x8f847e[_0x4f87('0x32')][_0x4f87('0x40')]){_0x430cf9['include']=[{'all':!![]}];}return db[_0x4f87('0x2c')][_0x4f87('0x41')](_0x430cf9);})[_0x4f87('0x25')](function(_0x29c7c5){_0x23e54a['rows']=_0x29c7c5;return _0x23e54a;})[_0x4f87('0x25')](respondWithFilteredResult(_0x149a5b,_0x430cf9))['catch'](handleError(_0x149a5b,null));};exports[_0x4f87('0x42')]=function(_0x28f049,_0x3afdcb){var _0x1610f1={'raw':![],'where':{'id':_0x28f049['params']['id']}},_0x58f2db={};_0x58f2db['model']=_['keys'](db['VoiceChanSpy']['rawAttributes']);_0x58f2db[_0x4f87('0x32')]=_[_0x4f87('0x33')](_0x28f049[_0x4f87('0x32')]);_0x58f2db[_0x4f87('0x34')]=_[_0x4f87('0x35')](_0x58f2db[_0x4f87('0x30')],_0x58f2db[_0x4f87('0x32')]);_0x1610f1[_0x4f87('0x36')]=_['intersection'](_0x58f2db[_0x4f87('0x30')],qs[_0x4f87('0x37')](_0x28f049[_0x4f87('0x32')][_0x4f87('0x37')]));_0x1610f1[_0x4f87('0x36')]=_0x1610f1[_0x4f87('0x36')][_0x4f87('0x43')]?_0x1610f1[_0x4f87('0x36')]:_0x58f2db[_0x4f87('0x30')];if(_0x28f049[_0x4f87('0x32')][_0x4f87('0x40')]){_0x1610f1[_0x4f87('0x44')]=[{'all':!![]}];}_0x1610f1=_[_0x4f87('0x3e')]({},_0x1610f1,_0x28f049[_0x4f87('0x45')]);return db[_0x4f87('0x2c')][_0x4f87('0x46')](_0x1610f1)[_0x4f87('0x25')](handleEntityNotFound(_0x3afdcb,null))['then'](respondWithResult(_0x3afdcb,null))[_0x4f87('0x47')](handleError(_0x3afdcb,null));};exports['create']=function(_0x59a7ce,_0x3e7383){return db[_0x4f87('0x2c')][_0x4f87('0x48')](_0x59a7ce[_0x4f87('0x49')],{})[_0x4f87('0x25')](function(_0x1e29dc){var _0x221c14=_0x59a7ce[_0x4f87('0x4a')][_0x4f87('0x4b')]({'plain':!![]});if(!_0x221c14)throw new Error(_0x4f87('0x4c'));if(_0x221c14['role']==='user'){var _0x2b9af9=_0x1e29dc[_0x4f87('0x4b')]({'plain':!![]});var _0xb34275='ChanSpies';return db['UserProfileSection'][_0x4f87('0x46')]({'where':{'name':_0xb34275,'userProfileId':_0x221c14[_0x4f87('0x4d')]},'raw':!![]})[_0x4f87('0x25')](function(_0xc81d81){if(_0xc81d81&&_0xc81d81[_0x4f87('0x4e')]===0x0){return db[_0x4f87('0x27')]['create']({'name':_0x2b9af9[_0x4f87('0x2a')],'resourceId':_0x2b9af9['id'],'type':_0xc81d81['name'],'sectionId':_0xc81d81['id']},{})[_0x4f87('0x25')](function(){return _0x1e29dc;});}else{return _0x1e29dc;}})['catch'](function(_0x225c5c){logger[_0x4f87('0x28')](_0x4f87('0x4f'),_0x225c5c);throw _0x225c5c;});}return _0x1e29dc;})[_0x4f87('0x25')](respondWithResult(_0x3e7383,0xc9))[_0x4f87('0x47')](handleError(_0x3e7383,null));};exports[_0x4f87('0x50')]=function(_0x22c389,_0x526c78){if(_0x22c389[_0x4f87('0x49')]['id']){delete _0x22c389[_0x4f87('0x49')]['id'];}return db[_0x4f87('0x2c')]['find']({'where':{'id':_0x22c389[_0x4f87('0x51')]['id']}})['then'](handleEntityNotFound(_0x526c78,null))[_0x4f87('0x25')](saveUpdates(_0x22c389[_0x4f87('0x49')],null))[_0x4f87('0x25')](respondWithResult(_0x526c78,null))[_0x4f87('0x47')](handleError(_0x526c78,null));};exports[_0x4f87('0x24')]=function(_0x51ee0e,_0x16e323){return db[_0x4f87('0x2c')]['find']({'where':{'id':_0x51ee0e[_0x4f87('0x51')]['id']}})[_0x4f87('0x25')](handleEntityNotFound(_0x16e323,null))[_0x4f87('0x25')](removeEntity(_0x16e323,null))[_0x4f87('0x47')](handleError(_0x16e323,null));}; \ No newline at end of file +var _0x9c2c=['moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc9c2('0x0'));var rimraf=require(_0xc9c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc9c2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc9c2('0x3'));var util=require(_0xc9c2('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xc9c2('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9c2('0x6'));var _=require(_0xc9c2('0x7'));var squel=require(_0xc9c2('0x8'));var crypto=require(_0xc9c2('0x9'));var jsforce=require(_0xc9c2('0xa'));var deskjs=require(_0xc9c2('0xb'));var toCsv=require(_0xc9c2('0x5'));var querystring=require(_0xc9c2('0xc'));var Papa=require(_0xc9c2('0xd'));var Redis=require('ioredis');var authService=require(_0xc9c2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc9c2('0xf'));var hardwareService=require(_0xc9c2('0x10'));var logger=require(_0xc9c2('0x11'))(_0xc9c2('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc9c2('0x13'));var db=require(_0xc9c2('0x14'))['db'];function respondWithStatusCode(_0x568f69,_0x7ec780){_0x7ec780=_0x7ec780||0xcc;return function(_0x1f08a7){if(_0x1f08a7){return _0x568f69[_0xc9c2('0x15')](_0x7ec780);}return _0x568f69[_0xc9c2('0x16')](_0x7ec780)[_0xc9c2('0x17')]();};}function respondWithResult(_0x3b0058,_0x33b288){_0x33b288=_0x33b288||0xc8;return function(_0x132702){if(_0x132702){return _0x3b0058[_0xc9c2('0x16')](_0x33b288)[_0xc9c2('0x18')](_0x132702);}};}function respondWithFilteredResult(_0xf94209,_0x383667){return function(_0x480d7c){if(_0x480d7c){var _0x27840d=typeof _0x383667[_0xc9c2('0x19')]===_0xc9c2('0x1a')&&typeof _0x383667[_0xc9c2('0x1b')]===_0xc9c2('0x1a');var _0x49413b=_0x480d7c[_0xc9c2('0x1c')];var _0x37c027=_0x27840d?0x0:_0x383667[_0xc9c2('0x19')];var _0x4e4ded=_0x27840d?_0x480d7c[_0xc9c2('0x1c')]:_0x383667[_0xc9c2('0x19')]+_0x383667[_0xc9c2('0x1b')];var _0x484ca3;if(_0x4e4ded>=_0x49413b){_0x4e4ded=_0x49413b;_0x484ca3=0xc8;}else{_0x484ca3=0xce;}_0xf94209[_0xc9c2('0x16')](_0x484ca3);return _0xf94209[_0xc9c2('0x1d')]('Content-Range',_0x37c027+'-'+_0x4e4ded+'/'+_0x49413b)['json'](_0x480d7c);}return null;};}function patchUpdates(_0x37e3){return function(_0x50f280){try{jsonpatch[_0xc9c2('0x1e')](_0x50f280,_0x37e3,!![]);}catch(_0x140c8a){return BPromise[_0xc9c2('0x1f')](_0x140c8a);}return _0x50f280[_0xc9c2('0x20')]();};}function saveUpdates(_0x3e1774,_0x53c460){return function(_0x1fbac4){if(_0x1fbac4){return _0x1fbac4[_0xc9c2('0x21')](_0x3e1774)[_0xc9c2('0x22')](function(_0x11cc07){return _0x11cc07;});}return null;};}function removeEntity(_0x32c372,_0x385030){return function(_0x56e515){if(_0x56e515){return _0x56e515[_0xc9c2('0x23')]()[_0xc9c2('0x22')](function(){var _0x5e47c2=_0x56e515[_0xc9c2('0x24')]({'plain':!![]});var _0x4b3b97=_0xc9c2('0x25');return db[_0xc9c2('0x26')][_0xc9c2('0x23')]({'where':{'type':_0x4b3b97,'resourceId':_0x5e47c2['id']}})[_0xc9c2('0x22')](function(){return _0x56e515;});})['then'](function(){_0x32c372[_0xc9c2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fcaa3,_0x3bd8e8){return function(_0x41f3e8){if(!_0x41f3e8){_0x2fcaa3[_0xc9c2('0x15')](0x194);}return _0x41f3e8;};}function handleError(_0x2119c6,_0x4cf642){_0x4cf642=_0x4cf642||0x1f4;return function(_0x3cedb5){logger[_0xc9c2('0x27')](_0x3cedb5[_0xc9c2('0x28')]);if(_0x3cedb5[_0xc9c2('0x29')]){delete _0x3cedb5[_0xc9c2('0x29')];}_0x2119c6[_0xc9c2('0x16')](_0x4cf642)[_0xc9c2('0x2a')](_0x3cedb5);};}exports['index']=function(_0x55b9c6,_0x4a9fca){var _0x228971={},_0x17d174={},_0x49fcd3={'count':0x0,'rows':[]};var _0xefbf7a=_[_0xc9c2('0x2b')](db[_0xc9c2('0x2c')][_0xc9c2('0x2d')],function(_0x5ccb7a){return{'name':_0x5ccb7a[_0xc9c2('0x2e')],'type':_0x5ccb7a[_0xc9c2('0x2f')]['key']};});_0x17d174['model']=_[_0xc9c2('0x2b')](_0xefbf7a,_0xc9c2('0x29'));_0x17d174[_0xc9c2('0x30')]=_['keys'](_0x55b9c6['query']);_0x17d174[_0xc9c2('0x31')]=_[_0xc9c2('0x32')](_0x17d174['model'],_0x17d174[_0xc9c2('0x30')]);_0x228971['attributes']=_[_0xc9c2('0x32')](_0x17d174[_0xc9c2('0x33')],qs[_0xc9c2('0x34')](_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x34')]));_0x228971[_0xc9c2('0x35')]=_0x228971[_0xc9c2('0x35')][_0xc9c2('0x36')]?_0x228971[_0xc9c2('0x35')]:_0x17d174['model'];if(!_0x55b9c6[_0xc9c2('0x30')]['hasOwnProperty'](_0xc9c2('0x37'))){_0x228971[_0xc9c2('0x1b')]=qs['limit'](_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x1b')]);_0x228971['offset']=qs[_0xc9c2('0x19')](_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x19')]);}_0x228971['order']=qs[_0xc9c2('0x38')](_0x55b9c6['query'][_0xc9c2('0x38')]);_0x228971[_0xc9c2('0x39')]=qs['filters'](_[_0xc9c2('0x3a')](_0x55b9c6[_0xc9c2('0x30')],_0x17d174[_0xc9c2('0x31')]),_0xefbf7a);if(_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x3b')]){_0x228971[_0xc9c2('0x39')]=_[_0xc9c2('0x3c')](_0x228971[_0xc9c2('0x39')],{'$or':_[_0xc9c2('0x2b')](_0xefbf7a,function(_0x42b8ec){if(_0x42b8ec[_0xc9c2('0x2f')]!=='VIRTUAL'){var _0x4c3bc0={};_0x4c3bc0[_0x42b8ec[_0xc9c2('0x29')]]={'$like':'%'+_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x3b')]+'%'};return _0x4c3bc0;}})});}_0x228971=_[_0xc9c2('0x3c')]({},_0x228971,_0x55b9c6[_0xc9c2('0x3d')]);var _0x394050={'where':_0x228971['where']};return db[_0xc9c2('0x2c')][_0xc9c2('0x1c')](_0x394050)[_0xc9c2('0x22')](function(_0x46c740){_0x49fcd3[_0xc9c2('0x1c')]=_0x46c740;if(_0x55b9c6['query'][_0xc9c2('0x3e')]){_0x228971[_0xc9c2('0x3f')]=[{'all':!![]}];}return db[_0xc9c2('0x2c')]['findAll'](_0x228971);})[_0xc9c2('0x22')](function(_0xd3d946){_0x49fcd3[_0xc9c2('0x40')]=_0xd3d946;return _0x49fcd3;})[_0xc9c2('0x22')](respondWithFilteredResult(_0x4a9fca,_0x228971))[_0xc9c2('0x41')](handleError(_0x4a9fca,null));};exports['show']=function(_0x54857b,_0x136dfb){var _0x75de3={'raw':![],'where':{'id':_0x54857b[_0xc9c2('0x42')]['id']}},_0x4df180={};_0x4df180[_0xc9c2('0x33')]=_[_0xc9c2('0x43')](db[_0xc9c2('0x2c')][_0xc9c2('0x2d')]);_0x4df180[_0xc9c2('0x30')]=_[_0xc9c2('0x43')](_0x54857b['query']);_0x4df180[_0xc9c2('0x31')]=_['intersection'](_0x4df180[_0xc9c2('0x33')],_0x4df180['query']);_0x75de3[_0xc9c2('0x35')]=_['intersection'](_0x4df180[_0xc9c2('0x33')],qs['fields'](_0x54857b[_0xc9c2('0x30')][_0xc9c2('0x34')]));_0x75de3[_0xc9c2('0x35')]=_0x75de3[_0xc9c2('0x35')][_0xc9c2('0x36')]?_0x75de3[_0xc9c2('0x35')]:_0x4df180[_0xc9c2('0x33')];if(_0x54857b['query'][_0xc9c2('0x3e')]){_0x75de3[_0xc9c2('0x3f')]=[{'all':!![]}];}_0x75de3=_[_0xc9c2('0x3c')]({},_0x75de3,_0x54857b[_0xc9c2('0x3d')]);return db[_0xc9c2('0x2c')][_0xc9c2('0x44')](_0x75de3)['then'](handleEntityNotFound(_0x136dfb,null))[_0xc9c2('0x22')](respondWithResult(_0x136dfb,null))[_0xc9c2('0x41')](handleError(_0x136dfb,null));};exports[_0xc9c2('0x45')]=function(_0x88fa84,_0x2e9925){return db[_0xc9c2('0x2c')][_0xc9c2('0x45')](_0x88fa84[_0xc9c2('0x46')],{})['then'](function(_0x44d1bb){var _0x7aff01=_0x88fa84[_0xc9c2('0x47')][_0xc9c2('0x24')]({'plain':!![]});if(!_0x7aff01)throw new Error(_0xc9c2('0x48'));if(_0x7aff01['role']===_0xc9c2('0x47')){var _0x4e2589=_0x44d1bb[_0xc9c2('0x24')]({'plain':!![]});var _0x5c8933=_0xc9c2('0x25');return db['UserProfileSection'][_0xc9c2('0x44')]({'where':{'name':_0x5c8933,'userProfileId':_0x7aff01['userProfileId']},'raw':!![]})['then'](function(_0x13bcbd){if(_0x13bcbd&&_0x13bcbd[_0xc9c2('0x49')]===0x0){return db[_0xc9c2('0x26')][_0xc9c2('0x45')]({'name':_0x4e2589[_0xc9c2('0x29')],'resourceId':_0x4e2589['id'],'type':_0x13bcbd[_0xc9c2('0x29')],'sectionId':_0x13bcbd['id']},{})[_0xc9c2('0x22')](function(){return _0x44d1bb;});}else{return _0x44d1bb;}})[_0xc9c2('0x41')](function(_0x3f8fce){logger[_0xc9c2('0x27')](_0xc9c2('0x4a'),_0x3f8fce);throw _0x3f8fce;});}return _0x44d1bb;})['then'](respondWithResult(_0x2e9925,0xc9))[_0xc9c2('0x41')](handleError(_0x2e9925,null));};exports[_0xc9c2('0x21')]=function(_0x568de4,_0x8a840){if(_0x568de4[_0xc9c2('0x46')]['id']){delete _0x568de4[_0xc9c2('0x46')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x568de4[_0xc9c2('0x42')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x8a840,null))[_0xc9c2('0x22')](saveUpdates(_0x568de4[_0xc9c2('0x46')],null))[_0xc9c2('0x22')](respondWithResult(_0x8a840,null))[_0xc9c2('0x41')](handleError(_0x8a840,null));};exports[_0xc9c2('0x23')]=function(_0x42905b,_0x158632){return db[_0xc9c2('0x2c')][_0xc9c2('0x44')]({'where':{'id':_0x42905b[_0xc9c2('0x42')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x158632,null))[_0xc9c2('0x22')](removeEntity(_0x158632,null))[_0xc9c2('0x41')](handleError(_0x158632,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index e5dab35..cf9e699 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 _0xc268=['ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','concat','internal','User','findAll','name','agent','then','exports','models','length','VoiceExtension','bulkCreate','catch','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','%s%s','prefix','system','merge','Set','format','CDR(type)=%s','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat'];(function(_0xeb6281,_0x3e3dce){var _0x5193b1=function(_0x495841){while(--_0x495841){_0xeb6281['push'](_0xeb6281['shift']());}};_0x5193b1(++_0x3e3dce);}(_0xc268,0x1b7));var _0x8c26=function(_0x411d5a,_0x21411b){_0x411d5a=_0x411d5a-0x0;var _0x4c97b1=_0xc268[_0x411d5a];return _0x4c97b1;};'use strict';var _=require(_0x8c26('0x0'));var util=require('util');var BPromise=require(_0x8c26('0x1'));var attributes=require(_0x8c26('0x2'));var getUserApplications=function(_0x485888,_0xed6e4,_0xaa609a){var _0x411f7f=0x1;var _0x40d209=[];var _0x389d4f={'context':_0xed6e4[_0x8c26('0x3')]||'from-sip','exten':util['format'](_0x8c26('0x4'),_0x485888[_0x8c26('0x5')],_0xaa609a),'type':_0x8c26('0x6'),'isApp':![],'ChanSpyId':_0x485888['id'],'UserId':_0xed6e4['id']};_0x40d209['push'](_[_0x8c26('0x7')]({'app':_0x8c26('0x8'),'appdata':util[_0x8c26('0x9')](_0x8c26('0xa'),'chanspy'),'priority':_0x411f7f++},_0x389d4f));if(_0x485888[_0x8c26('0xb')]){_0x40d209[_0x8c26('0xc')](_[_0x8c26('0x7')]({'app':_0x8c26('0xd'),'appdata':util[_0x8c26('0x9')](_0x8c26('0xe'),_0x485888[_0x8c26('0xf')]),'priority':_0x411f7f++},_0x389d4f));}if(_0x485888['auth']){_0x40d209[_0x8c26('0xc')](_[_0x8c26('0x7')]({'app':'Authenticate','appdata':_0x485888['password'],'priority':_0x411f7f++},_0x389d4f));}_0x40d209[_0x8c26('0xc')](_[_0x8c26('0x7')]({'app':_0x8c26('0x10'),'appdata':util[_0x8c26('0x9')](_0x8c26('0x11'),_0xed6e4['name'],_0x485888[_0x8c26('0x12')]?_0x485888['options'][_0x8c26('0x13')](''):''),'priority':_0x411f7f++},_0x389d4f));if(_0x485888['record']){_0x40d209[_0x8c26('0xc')](_[_0x8c26('0x7')]({'app':_0x8c26('0x14'),'priority':_0x411f7f++},_0x389d4f));}return _0x40d209;};var getChanSpyApplications=function(_0x16bd1a,_0x5e97e9){var _0x4580e9=[];for(var _0x597f98=0x0,_0x418615=0x1;_0x597f98<_0x5e97e9['length'];_0x597f98++,_0x418615=0x1){_0x4580e9=_0x4580e9[_0x8c26('0x15')](getUserApplications(_0x16bd1a,_0x5e97e9[_0x597f98],_0x5e97e9[_0x597f98][_0x8c26('0x16')]));if(_0x5e97e9[_0x597f98][_0x8c26('0x16')]!=_0x5e97e9[_0x597f98]['name']){_0x4580e9=_0x4580e9[_0x8c26('0x15')](getUserApplications(_0x16bd1a,_0x5e97e9[_0x597f98],_0x5e97e9[_0x597f98]['name']));}}return _0x4580e9;};var getChanSpyPromise=function(_0x573ef8,_0x2b4458){return new BPromise(function(_0x230b34,_0x3e84f8){return _0x573ef8[_0x8c26('0x17')][_0x8c26('0x18')]({'attributes':['id',_0x8c26('0x19'),_0x8c26('0x16')],'where':{'role':_0x8c26('0x1a'),'chanspy':!![]},'raw':!![]})[_0x8c26('0x1b')](function(_0xe63664){if(_0xe63664){return _0x230b34(getChanSpyApplications(_0x2b4458,_0xe63664));}return _0x230b34([]);})['catch'](function(_0x10416e){_0x3e84f8(_0x10416e);});});};module[_0x8c26('0x1c')]=function(_0x22c47d,_0x58d4d7){var _0x48b71b=_0x22c47d[_0x8c26('0x1d')];return _0x22c47d['define']('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x464005,_0x8f895d,_0x1ffdfd){return getChanSpyPromise(_0x48b71b,_0x464005)[_0x8c26('0x1b')](function(_0x5a0b70){if(_0x5a0b70&&_0x5a0b70[_0x8c26('0x1e')]){return _0x48b71b[_0x8c26('0x1f')][_0x8c26('0x20')](_0x5a0b70);}})['then'](function(){_0x1ffdfd();})[_0x8c26('0x21')](function(_0x1a5acd){_0x1ffdfd(_0x1a5acd);});},'afterUpdate':function(_0xb37449,_0x576aea,_0x74f2d1){return _0x48b71b['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0xb37449['id']}})['then'](function(){return getChanSpyPromise(_0x48b71b,_0xb37449);})['then'](function(_0x400b51){if(_0x400b51&&_0x400b51['length']){return _0x48b71b[_0x8c26('0x1f')][_0x8c26('0x20')](_0x400b51);}})[_0x8c26('0x1b')](function(){_0x74f2d1();})[_0x8c26('0x21')](function(_0x1d2256){_0x74f2d1(_0x1d2256);});},'afterDestroy':function(_0x5d3494,_0x25b76c,_0x54d93b){return _0x48b71b[_0x8c26('0x1f')][_0x8c26('0x22')]({'where':{'ChanSpyId':_0x5d3494['id']}})[_0x8c26('0x1b')](function(){_0x54d93b();})[_0x8c26('0x21')](function(_0x54044b){_0x54d93b(_0x54044b);});}}});}; \ No newline at end of file +var _0x65ce=['%s%s','prefix','system','push','merge','Set','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','record','concat','internal','User','findAll','then','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','length','destroy','lodash','bluebird','./voiceChanSpy.attributes','from-sip','format'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0x65ce,0x1ab));var _0xe65c=function(_0x3324a6,_0x5b9759){_0x3324a6=_0x3324a6-0x0;var _0x4e382a=_0x65ce[_0x3324a6];return _0x4e382a;};'use strict';var _=require(_0xe65c('0x0'));var util=require('util');var BPromise=require(_0xe65c('0x1'));var attributes=require(_0xe65c('0x2'));var getUserApplications=function(_0x3361f3,_0xb21a16,_0x310e78){var _0x863cd6=0x1;var _0x9c88eb=[];var _0x138f2d={'context':_0xb21a16['context']||_0xe65c('0x3'),'exten':util[_0xe65c('0x4')](_0xe65c('0x5'),_0x3361f3[_0xe65c('0x6')],_0x310e78),'type':_0xe65c('0x7'),'isApp':![],'ChanSpyId':_0x3361f3['id'],'UserId':_0xb21a16['id']};_0x9c88eb[_0xe65c('0x8')](_[_0xe65c('0x9')]({'app':_0xe65c('0xa'),'appdata':util[_0xe65c('0x4')]('CDR(type)=%s','chanspy'),'priority':_0x863cd6++},_0x138f2d));if(_0x3361f3['record']){_0x9c88eb[_0xe65c('0x8')](_['merge']({'app':_0xe65c('0xb'),'appdata':util[_0xe65c('0x4')](_0xe65c('0xc'),_0x3361f3[_0xe65c('0xd')]),'priority':_0x863cd6++},_0x138f2d));}if(_0x3361f3['auth']){_0x9c88eb[_0xe65c('0x8')](_[_0xe65c('0x9')]({'app':_0xe65c('0xe'),'appdata':_0x3361f3[_0xe65c('0xf')],'priority':_0x863cd6++},_0x138f2d));}_0x9c88eb[_0xe65c('0x8')](_[_0xe65c('0x9')]({'app':_0xe65c('0x10'),'appdata':util['format'](_0xe65c('0x11'),_0xb21a16[_0xe65c('0x12')],_0x3361f3[_0xe65c('0x13')]?_0x3361f3[_0xe65c('0x13')][_0xe65c('0x14')](''):''),'priority':_0x863cd6++},_0x138f2d));if(_0x3361f3[_0xe65c('0x15')]){_0x9c88eb[_0xe65c('0x8')](_['merge']({'app':'StopMixMonitor','priority':_0x863cd6++},_0x138f2d));}return _0x9c88eb;};var getChanSpyApplications=function(_0x453c48,_0x371fca){var _0x4fcc60=[];for(var _0xe16ec9=0x0,_0x856375=0x1;_0xe16ec9<_0x371fca['length'];_0xe16ec9++,_0x856375=0x1){_0x4fcc60=_0x4fcc60[_0xe65c('0x16')](getUserApplications(_0x453c48,_0x371fca[_0xe16ec9],_0x371fca[_0xe16ec9]['internal']));if(_0x371fca[_0xe16ec9][_0xe65c('0x17')]!=_0x371fca[_0xe16ec9][_0xe65c('0x12')]){_0x4fcc60=_0x4fcc60[_0xe65c('0x16')](getUserApplications(_0x453c48,_0x371fca[_0xe16ec9],_0x371fca[_0xe16ec9][_0xe65c('0x12')]));}}return _0x4fcc60;};var getChanSpyPromise=function(_0x5d718f,_0x52470e){return new BPromise(function(_0x444959,_0x123309){return _0x5d718f[_0xe65c('0x18')][_0xe65c('0x19')]({'attributes':['id',_0xe65c('0x12'),_0xe65c('0x17')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xe65c('0x1a')](function(_0x4ee7ac){if(_0x4ee7ac){return _0x444959(getChanSpyApplications(_0x52470e,_0x4ee7ac));}return _0x444959([]);})['catch'](function(_0x2f2808){_0x123309(_0x2f2808);});});};module['exports']=function(_0x14d020,_0x561f2b){var _0x1629c4=_0x14d020[_0xe65c('0x1b')];return _0x14d020[_0xe65c('0x1c')](_0xe65c('0x1d'),attributes,{'tableName':_0xe65c('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xc8211d,_0x2f50bf,_0x534623){return getChanSpyPromise(_0x1629c4,_0xc8211d)['then'](function(_0x103d8e){if(_0x103d8e&&_0x103d8e['length']){return _0x1629c4[_0xe65c('0x1f')][_0xe65c('0x20')](_0x103d8e);}})[_0xe65c('0x1a')](function(){_0x534623();})[_0xe65c('0x21')](function(_0x156e95){_0x534623(_0x156e95);});},'afterUpdate':function(_0x12477d,_0x386b9a,_0x12bd98){return _0x1629c4[_0xe65c('0x1f')]['destroy']({'where':{'ChanSpyId':_0x12477d['id']}})['then'](function(){return getChanSpyPromise(_0x1629c4,_0x12477d);})[_0xe65c('0x1a')](function(_0x1f4fdc){if(_0x1f4fdc&&_0x1f4fdc[_0xe65c('0x22')]){return _0x1629c4['VoiceExtension'][_0xe65c('0x20')](_0x1f4fdc);}})['then'](function(){_0x12bd98();})['catch'](function(_0x2557a9){_0x12bd98(_0x2557a9);});},'afterDestroy':function(_0x21d764,_0x1419cd,_0x5b0970){return _0x1629c4[_0xe65c('0x1f')][_0xe65c('0x23')]({'where':{'ChanSpyId':_0x21d764['id']}})[_0xe65c('0x1a')](function(){_0x5b0970();})[_0xe65c('0x21')](function(_0x3ce0d2){_0x5b0970(_0x3ce0d2);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 1c6e137..eccbd50 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 _0x222f=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x520322,_0x4f169e){var _0xbe8b2f=function(_0x4949f4){while(--_0x4949f4){_0x520322['push'](_0x520322['shift']());}};_0xbe8b2f(++_0x4f169e);}(_0x222f,0x1a4));var _0xf222=function(_0x131acf,_0x4b4597){_0x131acf=_0x131acf-0x0;var _0x40d32e=_0x222f[_0x131acf];return _0x40d32e;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var moment=require(_0xf222('0x2'));var BPromise=require(_0xf222('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf222('0x4'))['db'];var utils=require(_0xf222('0x5'));var logger=require(_0xf222('0x6'))(_0xf222('0x7'));var config=require('../../config/environment');var jayson=require(_0xf222('0x8'));var client=jayson['client'][_0xf222('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f129,_0x518ebb,_0xf5a105){return new BPromise(function(_0x302d7a,_0x4aceb4){return client[_0xf222('0xa')](_0x26f129,_0xf5a105)[_0xf222('0xb')](function(_0x878804){logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));logger['debug'](_0xf222('0xf'),_0x518ebb,_0xf222('0xe'),JSON[_0xf222('0x10')](_0x878804));if(_0x878804[_0xf222('0x11')]){if(_0x878804['error'][_0xf222('0x12')]===0x1f4){logger[_0xf222('0x11')](_0xf222('0xd'),_0x518ebb,_0x878804[_0xf222('0x11')][_0xf222('0x13')]);return _0x4aceb4(_0x878804[_0xf222('0x11')][_0xf222('0x13')]);}logger[_0xf222('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x518ebb,_0x878804['error'][_0xf222('0x13')]);return _0x302d7a(_0x878804[_0xf222('0x11')]['message']);}else{logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));_0x302d7a(_0x878804[_0xf222('0x14')][_0xf222('0x13')]);}})[_0xf222('0x15')](function(_0x30b646){logger['error'](_0xf222('0xd'),_0x518ebb,_0x30b646);_0x4aceb4(_0x30b646);});});} \ No newline at end of file +var _0xa45c=['code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4e5ee5,_0x1acb8a){var _0x3e5776=function(_0x418cb0){while(--_0x418cb0){_0x4e5ee5['push'](_0x4e5ee5['shift']());}};_0x3e5776(++_0x1acb8a);}(_0xa45c,0x6d));var _0xca45=function(_0x479d97,_0x3eab9a){_0x479d97=_0x479d97-0x0;var _0x4d1720=_0xa45c[_0x479d97];return _0x4d1720;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca45('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca45('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xca45('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xca45('0x5'));var client=jayson[_0xca45('0x6')][_0xca45('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15628b,_0x578a7b,_0x1a8b9c){return new BPromise(function(_0x276897,_0x7ceab1){return client[_0xca45('0x8')](_0x15628b,_0x1a8b9c)[_0xca45('0x9')](function(_0x5c18b9){logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));logger[_0xca45('0xd')](_0xca45('0xe'),_0x578a7b,_0xca45('0xc'),JSON[_0xca45('0xf')](_0x5c18b9));if(_0x5c18b9['error']){if(_0x5c18b9[_0xca45('0x10')][_0xca45('0x11')]===0x1f4){logger[_0xca45('0x10')](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x7ceab1(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}logger['error'](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x276897(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}else{logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));_0x276897(_0x5c18b9[_0xca45('0x13')]['message']);}})[_0xca45('0x14')](function(_0x5b4e29){logger['error'](_0xca45('0xb'),_0x578a7b,_0x5b4e29);_0x7ceab1(_0x5b4e29);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 731b33e..8b58920 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 _0xeb57=['create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','/:id','show','post','isAuthenticated'];(function(_0x255704,_0x5393c0){var _0x23ffaf=function(_0x3baa9b){while(--_0x3baa9b){_0x255704['push'](_0x255704['shift']());}};_0x23ffaf(++_0x5393c0);}(_0xeb57,0x11c));var _0x7eb5=function(_0x20995e,_0x50c4f3){_0x20995e=_0x20995e-0x0;var _0x4aa6dd=_0xeb57[_0x20995e];return _0x4aa6dd;};'use strict';var multer=require(_0x7eb5('0x0'));var util=require(_0x7eb5('0x1'));var path=require(_0x7eb5('0x2'));var timeout=require(_0x7eb5('0x3'));var express=require(_0x7eb5('0x4'));var router=express[_0x7eb5('0x5')]();var fs_extra=require(_0x7eb5('0x6'));var auth=require(_0x7eb5('0x7'));var interaction=require(_0x7eb5('0x8'));var config=require(_0x7eb5('0x9'));var controller=require(_0x7eb5('0xa'));router[_0x7eb5('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7eb5('0xb')](_0x7eb5('0xc'),auth['isAuthenticated'](),controller[_0x7eb5('0xd')]);router[_0x7eb5('0xe')]('/',auth[_0x7eb5('0xf')](),controller[_0x7eb5('0x10')]);router['put'](_0x7eb5('0xc'),auth[_0x7eb5('0xf')](),controller[_0x7eb5('0x11')]);router['delete'](_0x7eb5('0xc'),auth[_0x7eb5('0xf')](),controller[_0x7eb5('0x12')]);module[_0x7eb5('0x13')]=router; \ No newline at end of file +var _0xae41=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','path','express'];(function(_0x20de4c,_0x40d1da){var _0x12bea2=function(_0x5a927c){while(--_0x5a927c){_0x20de4c['push'](_0x20de4c['shift']());}};_0x12bea2(++_0x40d1da);}(_0xae41,0xf4));var _0x1ae4=function(_0x57acd8,_0x406392){_0x57acd8=_0x57acd8-0x0;var _0x1bcda0=_0xae41[_0x57acd8];return _0x1bcda0;};'use strict';var multer=require(_0x1ae4('0x0'));var util=require('util');var path=require(_0x1ae4('0x1'));var timeout=require('connect-timeout');var express=require(_0x1ae4('0x2'));var router=express[_0x1ae4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1ae4('0x4'));var interaction=require(_0x1ae4('0x5'));var config=require(_0x1ae4('0x6'));var controller=require(_0x1ae4('0x7'));router[_0x1ae4('0x8')]('/',auth[_0x1ae4('0x9')](),controller[_0x1ae4('0xa')]);router[_0x1ae4('0x8')](_0x1ae4('0xb'),auth[_0x1ae4('0x9')](),controller[_0x1ae4('0xc')]);router[_0x1ae4('0xd')]('/',auth[_0x1ae4('0x9')](),controller[_0x1ae4('0xe')]);router[_0x1ae4('0xf')](_0x1ae4('0xb'),auth[_0x1ae4('0x9')](),controller[_0x1ae4('0x10')]);router[_0x1ae4('0x11')](_0x1ae4('0xb'),auth[_0x1ae4('0x9')](),controller[_0x1ae4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 7536a3d..dada33e 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 _0xcb0f=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb0f,0x111));var _0xfcb0=function(_0x3d1b4b,_0x5541ea){_0x3d1b4b=_0x3d1b4b-0x0;var _0x369328=_0xcb0f[_0x3d1b4b];return _0x369328;};'use strict';var Sequelize=require(_0xfcb0('0x0'));module[_0xfcb0('0x1')]={'name':{'type':Sequelize[_0xfcb0('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xfcb0('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe5ae=['sequelize','name','STRING','BOOLEAN'];(function(_0x3fbb8b,_0x287963){var _0x5f3e22=function(_0x26feaa){while(--_0x26feaa){_0x3fbb8b['push'](_0x3fbb8b['shift']());}};_0x5f3e22(++_0x287963);}(_0xe5ae,0x1dc));var _0xee5a=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0xe5ae[_0x152136];return _0x20df44;};'use strict';var Sequelize=require(_0xee5a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xee5a('0x1')},'description':{'type':Sequelize[_0xee5a('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xee5a('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index b568d02..57517bd 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 _0x7c92=['Contexts','UserProfileResource','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','VoiceContext','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','save','update','destroy'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x7c92,0x173));var _0x27c9=function(_0x1b3fb2,_0x3d3be3){_0x1b3fb2=_0x1b3fb2-0x0;var _0x8f80b0=_0x7c92[_0x1b3fb2];return _0x8f80b0;};'use strict';var emlformat=require(_0x27c9('0x0'));var rimraf=require(_0x27c9('0x1'));var zipdir=require(_0x27c9('0x2'));var jsonpatch=require(_0x27c9('0x3'));var rp=require('request-promise');var moment=require(_0x27c9('0x4'));var BPromise=require(_0x27c9('0x5'));var Mustache=require(_0x27c9('0x6'));var util=require(_0x27c9('0x7'));var path=require(_0x27c9('0x8'));var sox=require(_0x27c9('0x9'));var csv=require(_0x27c9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x27c9('0xb'));var _=require('lodash');var squel=require(_0x27c9('0xc'));var crypto=require('crypto');var jsforce=require(_0x27c9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x27c9('0xa'));var querystring=require(_0x27c9('0xe'));var Papa=require(_0x27c9('0xf'));var Redis=require('ioredis');var authService=require(_0x27c9('0x10'));var qs=require(_0x27c9('0x11'));var as=require(_0x27c9('0x12'));var hardwareService=require(_0x27c9('0x13'));var logger=require('../../config/logger')(_0x27c9('0x14'));var utils=require(_0x27c9('0x15'));var config=require(_0x27c9('0x16'));var licenseUtil=require(_0x27c9('0x17'));var db=require(_0x27c9('0x18'))['db'];var jayson=require(_0x27c9('0x19'));var client=jayson[_0x27c9('0x1a')][_0x27c9('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4eb8c4,_0x95e223,_0x1ff749,_0x569aaf){return new BPromise(function(_0x4e4e08,_0x7092){var _0x5ba7a6=_0x569aaf||client;return _0x5ba7a6[_0x27c9('0x1c')](_0x4eb8c4,_0x1ff749)[_0x27c9('0x1d')](function(_0x26c3bd){logger[_0x27c9('0x1e')](_0x27c9('0x1f'),_0x95e223,_0x27c9('0x20'));logger[_0x27c9('0x21')](_0x27c9('0x22'),_0x95e223,_0x27c9('0x20'),JSON[_0x27c9('0x23')](_0x26c3bd));if(_0x26c3bd['error']){if(_0x26c3bd[_0x27c9('0x24')][_0x27c9('0x25')]===0x1f4){logger[_0x27c9('0x24')](_0x27c9('0x1f'),_0x95e223,_0x26c3bd[_0x27c9('0x24')]['message']);return _0x7092(_0x26c3bd[_0x27c9('0x24')]['message']);}logger[_0x27c9('0x24')]('VoiceContext,\x20%s,\x20%s',_0x95e223,_0x26c3bd['error'][_0x27c9('0x26')]);return _0x4e4e08(_0x26c3bd[_0x27c9('0x24')]['message']);}else{logger[_0x27c9('0x1e')](_0x27c9('0x1f'),_0x95e223,_0x27c9('0x20'));_0x4e4e08(_0x26c3bd[_0x27c9('0x27')][_0x27c9('0x26')]);}})['catch'](function(_0x360669){logger[_0x27c9('0x24')](_0x27c9('0x1f'),_0x95e223,_0x360669);_0x7092(_0x360669);});});}function respondWithStatusCode(_0x2384d0,_0x27dda8){_0x27dda8=_0x27dda8||0xcc;return function(_0x1e17b1){if(_0x1e17b1){return _0x2384d0[_0x27c9('0x28')](_0x27dda8);}return _0x2384d0['status'](_0x27dda8)[_0x27c9('0x29')]();};}function respondWithResult(_0x576787,_0x52c50f){_0x52c50f=_0x52c50f||0xc8;return function(_0x345357){if(_0x345357){return _0x576787[_0x27c9('0x2a')](_0x52c50f)['json'](_0x345357);}};}function respondWithFilteredResult(_0x232d29,_0x186d20){return function(_0x252e7b){if(_0x252e7b){var _0x28f0a2=typeof _0x186d20[_0x27c9('0x2b')]===_0x27c9('0x2c')&&typeof _0x186d20[_0x27c9('0x2d')]==='undefined';var _0xc30831=_0x252e7b[_0x27c9('0x2e')];var _0x4be74f=_0x28f0a2?0x0:_0x186d20[_0x27c9('0x2b')];var _0x5793dc=_0x28f0a2?_0x252e7b[_0x27c9('0x2e')]:_0x186d20['offset']+_0x186d20[_0x27c9('0x2d')];var _0x1e1b8f;if(_0x5793dc>=_0xc30831){_0x5793dc=_0xc30831;_0x1e1b8f=0xc8;}else{_0x1e1b8f=0xce;}_0x232d29[_0x27c9('0x2a')](_0x1e1b8f);return _0x232d29[_0x27c9('0x2f')](_0x27c9('0x30'),_0x4be74f+'-'+_0x5793dc+'/'+_0xc30831)[_0x27c9('0x31')](_0x252e7b);}return null;};}function patchUpdates(_0x1c2dce){return function(_0x22c88b){try{jsonpatch['apply'](_0x22c88b,_0x1c2dce,!![]);}catch(_0xa6e15e){return BPromise['reject'](_0xa6e15e);}return _0x22c88b[_0x27c9('0x32')]();};}function saveUpdates(_0x17e98a,_0x571566){return function(_0x489eac){if(_0x489eac){return _0x489eac[_0x27c9('0x33')](_0x17e98a)[_0x27c9('0x1d')](function(_0x834b1b){return _0x834b1b;});}return null;};}function removeEntity(_0x3525d8,_0x3fdc5a){return function(_0x1f7b7a){if(_0x1f7b7a){return _0x1f7b7a[_0x27c9('0x34')]()['then'](function(){var _0x3219f1=_0x1f7b7a['get']({'plain':!![]});var _0x2aeec1=_0x27c9('0x35');return db[_0x27c9('0x36')][_0x27c9('0x34')]({'where':{'type':_0x2aeec1,'resourceId':_0x3219f1['id']}})['then'](function(){return _0x1f7b7a;});})[_0x27c9('0x1d')](function(){_0x3525d8[_0x27c9('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaf13b5,_0x4445c9){return function(_0x3449ab){if(!_0x3449ab){_0xaf13b5[_0x27c9('0x28')](0x194);}return _0x3449ab;};}function handleError(_0x5732b7,_0x5da5aa){_0x5da5aa=_0x5da5aa||0x1f4;return function(_0x516bde){logger[_0x27c9('0x24')](_0x516bde['stack']);if(_0x516bde['name']){delete _0x516bde[_0x27c9('0x37')];}_0x5732b7['status'](_0x5da5aa)[_0x27c9('0x38')](_0x516bde);};}exports[_0x27c9('0x39')]=function(_0x8ab361,_0xdfb3fd){var _0x4cd0f8={},_0x39cabe={},_0x729adf={'count':0x0,'rows':[]};var _0x1e7bd7=_[_0x27c9('0x3a')](db['VoiceContext']['rawAttributes'],function(_0x67e3e5){return{'name':_0x67e3e5[_0x27c9('0x3b')],'type':_0x67e3e5[_0x27c9('0x3c')][_0x27c9('0x3d')]};});_0x39cabe[_0x27c9('0x3e')]=_[_0x27c9('0x3a')](_0x1e7bd7,'name');_0x39cabe[_0x27c9('0x3f')]=_['keys'](_0x8ab361[_0x27c9('0x3f')]);_0x39cabe[_0x27c9('0x40')]=_[_0x27c9('0x41')](_0x39cabe[_0x27c9('0x3e')],_0x39cabe[_0x27c9('0x3f')]);_0x4cd0f8[_0x27c9('0x42')]=_[_0x27c9('0x41')](_0x39cabe[_0x27c9('0x3e')],qs['fields'](_0x8ab361[_0x27c9('0x3f')][_0x27c9('0x43')]));_0x4cd0f8[_0x27c9('0x42')]=_0x4cd0f8['attributes'][_0x27c9('0x44')]?_0x4cd0f8['attributes']:_0x39cabe[_0x27c9('0x3e')];if(!_0x8ab361['query']['hasOwnProperty'](_0x27c9('0x45'))){_0x4cd0f8[_0x27c9('0x2d')]=qs[_0x27c9('0x2d')](_0x8ab361[_0x27c9('0x3f')][_0x27c9('0x2d')]);_0x4cd0f8[_0x27c9('0x2b')]=qs[_0x27c9('0x2b')](_0x8ab361[_0x27c9('0x3f')][_0x27c9('0x2b')]);}_0x4cd0f8[_0x27c9('0x46')]=qs[_0x27c9('0x47')](_0x8ab361[_0x27c9('0x3f')][_0x27c9('0x47')]);_0x4cd0f8[_0x27c9('0x48')]=qs['filters'](_[_0x27c9('0x49')](_0x8ab361[_0x27c9('0x3f')],_0x39cabe['filters']),_0x1e7bd7);if(_0x8ab361[_0x27c9('0x3f')]['filter']){_0x4cd0f8[_0x27c9('0x48')]=_[_0x27c9('0x4a')](_0x4cd0f8[_0x27c9('0x48')],{'$or':_['map'](_0x1e7bd7,function(_0x5620aa){if(_0x5620aa[_0x27c9('0x3c')]!=='VIRTUAL'){var _0x3e0499={};_0x3e0499[_0x5620aa[_0x27c9('0x37')]]={'$like':'%'+_0x8ab361[_0x27c9('0x3f')][_0x27c9('0x4b')]+'%'};return _0x3e0499;}})});}_0x4cd0f8=_['merge']({},_0x4cd0f8,_0x8ab361['options']);var _0x2f5248={'where':_0x4cd0f8[_0x27c9('0x48')]};return db[_0x27c9('0x4c')]['count'](_0x2f5248)['then'](function(_0x309fbf){_0x729adf[_0x27c9('0x2e')]=_0x309fbf;if(_0x8ab361[_0x27c9('0x3f')][_0x27c9('0x4d')]){_0x4cd0f8[_0x27c9('0x4e')]=[{'all':!![]}];}return db[_0x27c9('0x4c')][_0x27c9('0x4f')](_0x4cd0f8);})[_0x27c9('0x1d')](function(_0x3806b6){_0x729adf[_0x27c9('0x50')]=_0x3806b6;return _0x729adf;})[_0x27c9('0x1d')](respondWithFilteredResult(_0xdfb3fd,_0x4cd0f8))[_0x27c9('0x51')](handleError(_0xdfb3fd,null));};exports[_0x27c9('0x52')]=function(_0x2e790e,_0xef8d8a){var _0x10282d={'raw':![],'where':{'id':_0x2e790e['params']['id']}},_0x393841={};_0x393841['model']=_[_0x27c9('0x53')](db['VoiceContext'][_0x27c9('0x54')]);_0x393841[_0x27c9('0x3f')]=_[_0x27c9('0x53')](_0x2e790e[_0x27c9('0x3f')]);_0x393841[_0x27c9('0x40')]=_[_0x27c9('0x41')](_0x393841[_0x27c9('0x3e')],_0x393841['query']);_0x10282d['attributes']=_[_0x27c9('0x41')](_0x393841[_0x27c9('0x3e')],qs[_0x27c9('0x43')](_0x2e790e[_0x27c9('0x3f')]['fields']));_0x10282d['attributes']=_0x10282d[_0x27c9('0x42')][_0x27c9('0x44')]?_0x10282d[_0x27c9('0x42')]:_0x393841[_0x27c9('0x3e')];if(_0x2e790e[_0x27c9('0x3f')][_0x27c9('0x4d')]){_0x10282d[_0x27c9('0x4e')]=[{'all':!![]}];}_0x10282d=_[_0x27c9('0x4a')]({},_0x10282d,_0x2e790e['options']);return db[_0x27c9('0x4c')][_0x27c9('0x55')](_0x10282d)[_0x27c9('0x1d')](handleEntityNotFound(_0xef8d8a,null))[_0x27c9('0x1d')](respondWithResult(_0xef8d8a,null))[_0x27c9('0x51')](handleError(_0xef8d8a,null));};exports[_0x27c9('0x56')]=function(_0x23d31d,_0x3a7696,_0x1d9025){var _0x30d4f9;return db[_0x27c9('0x4c')][_0x27c9('0x56')](_0x23d31d[_0x27c9('0x57')],{'raw':!![]})[_0x27c9('0x1d')](function(_0x4985c3){_0x30d4f9=_0x4985c3;return db['VoiceContext'][_0x27c9('0x4f')]({'raw':!![]});})[_0x27c9('0x1d')](function(_0x2f5354){var _0x387caf=fs[_0x27c9('0x58')](path[_0x27c9('0x59')](config[_0x27c9('0x5a')],_0x27c9('0x5b')),_0x27c9('0x5c'));var _0x3dda8d=ejs[_0x27c9('0x5d')](_0x387caf,{'contexts':_0x2f5354||[]});fs[_0x27c9('0x5e')](_0x27c9('0x5f'),_0x3dda8d);})[_0x27c9('0x1d')](function(){return respondWithRpcPromise(_0x27c9('0x60'),'create',{'module':_0x27c9('0x61')});})[_0x27c9('0x1d')](function(){var _0x1c9b7f=_0x23d31d['user'][_0x27c9('0x62')]({'plain':!![]});if(!_0x1c9b7f)throw new Error(_0x27c9('0x63'));if(_0x1c9b7f['role']===_0x27c9('0x64')){var _0x15449f=_0x30d4f9[_0x27c9('0x62')]({'plain':!![]});return db[_0x27c9('0x65')]['find']({'where':{'name':_0x27c9('0x35'),'userProfileId':_0x1c9b7f[_0x27c9('0x66')]},'raw':!![]})['then'](function(_0x1d78cc){if(_0x1d78cc&&_0x1d78cc[_0x27c9('0x67')]===0x0){return db['UserProfileResource']['create']({'name':_0x15449f[_0x27c9('0x37')],'resourceId':_0x15449f['id'],'type':_0x1d78cc[_0x27c9('0x37')],'sectionId':_0x1d78cc['id']},{})[_0x27c9('0x1d')](function(){return _0x30d4f9;});}else{return _0x30d4f9;}})[_0x27c9('0x51')](function(_0x498876){logger[_0x27c9('0x24')](_0x27c9('0x68'),_0x498876);throw _0x498876;});}return _0x30d4f9;})[_0x27c9('0x1d')](respondWithResult(_0x3a7696,0xc9))['catch'](handleError(_0x3a7696,null));};exports['update']=function(_0x4307ed,_0x2f3ea7,_0x24acbb){var _0x4af942;return db[_0x27c9('0x4c')][_0x27c9('0x55')]({'where':{'id':_0x4307ed[_0x27c9('0x69')]['id']}})[_0x27c9('0x1d')](handleEntityNotFound(_0x2f3ea7,null))[_0x27c9('0x1d')](saveUpdates(_0x4307ed['body'],null))[_0x27c9('0x1d')](function(_0x5e87ae){if(_0x5e87ae){_0x4af942=_0x5e87ae;return db[_0x27c9('0x4c')]['findAll']({'raw':!![]});}})[_0x27c9('0x1d')](function(_0x45529f){var _0x52d808=fs[_0x27c9('0x58')](path[_0x27c9('0x59')](config[_0x27c9('0x5a')],_0x27c9('0x5b')),'utf8');var _0x2faa96=ejs[_0x27c9('0x5d')](_0x52d808,{'contexts':_0x45529f||[]});fs[_0x27c9('0x5e')](_0x27c9('0x5f'),_0x2faa96);})[_0x27c9('0x1d')](function(){return respondWithRpcPromise(_0x27c9('0x60'),_0x27c9('0x33'),{'module':_0x27c9('0x61')});})['then'](function(){return _0x4af942;})[_0x27c9('0x1d')](respondWithResult(_0x2f3ea7,null))[_0x27c9('0x51')](handleError(_0x2f3ea7,null));};exports[_0x27c9('0x34')]=function(_0x3d7047,_0x3dfa4e,_0x11a3c3){var _0x28efa3;return db[_0x27c9('0x4c')]['find']({'where':{'id':_0x3d7047[_0x27c9('0x69')]['id']}})[_0x27c9('0x1d')](handleEntityNotFound(_0x3dfa4e,null))[_0x27c9('0x1d')](removeEntity(_0x3dfa4e,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x34c604){var _0x26e55c=fs[_0x27c9('0x58')](path[_0x27c9('0x59')](config[_0x27c9('0x5a')],_0x27c9('0x5b')),_0x27c9('0x5c'));var _0x2a5dac=ejs['render'](_0x26e55c,{'contexts':_0x34c604});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x2a5dac);return respondWithRpcPromise(_0x27c9('0x60'),_0x27c9('0x34'),{'module':_0x27c9('0x61')});})[_0x27c9('0x51')](handleError(_0x3dfa4e,null));}; \ No newline at end of file +var _0x8876=['pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','find','create','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','UserProfileResource','params','body','render','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','undefined','limit','offset','Content-Range','json','apply','reject','save','update','destroy','get','sendStatus','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8876,0x153));var _0x6887=function(_0x37b7ba,_0x37fd44){_0x37b7ba=_0x37b7ba-0x0;var _0x5d88e7=_0x8876[_0x37b7ba];return _0x5d88e7;};'use strict';var emlformat=require(_0x6887('0x0'));var rimraf=require(_0x6887('0x1'));var zipdir=require(_0x6887('0x2'));var jsonpatch=require(_0x6887('0x3'));var rp=require(_0x6887('0x4'));var moment=require('moment');var BPromise=require(_0x6887('0x5'));var Mustache=require(_0x6887('0x6'));var util=require(_0x6887('0x7'));var path=require(_0x6887('0x8'));var sox=require(_0x6887('0x9'));var csv=require(_0x6887('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6887('0xb'));var _=require(_0x6887('0xc'));var squel=require(_0x6887('0xd'));var crypto=require(_0x6887('0xe'));var jsforce=require(_0x6887('0xf'));var deskjs=require(_0x6887('0x10'));var toCsv=require(_0x6887('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6887('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6887('0x12'));var logger=require(_0x6887('0x13'))('api');var utils=require(_0x6887('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6887('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6887('0x16'));var client=jayson[_0x6887('0x17')][_0x6887('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5bdad3,_0x49935c,_0x33cd7c,_0x5e0ac6){return new BPromise(function(_0x174525,_0x229d0c){var _0x89b54f=_0x5e0ac6||client;return _0x89b54f[_0x6887('0x19')](_0x5bdad3,_0x33cd7c)[_0x6887('0x1a')](function(_0xcc0f0d){logger[_0x6887('0x1b')](_0x6887('0x1c'),_0x49935c,_0x6887('0x1d'));logger['debug'](_0x6887('0x1e'),_0x49935c,'request\x20sent',JSON['stringify'](_0xcc0f0d));if(_0xcc0f0d[_0x6887('0x1f')]){if(_0xcc0f0d[_0x6887('0x1f')][_0x6887('0x20')]===0x1f4){logger[_0x6887('0x1f')](_0x6887('0x1c'),_0x49935c,_0xcc0f0d[_0x6887('0x1f')][_0x6887('0x21')]);return _0x229d0c(_0xcc0f0d[_0x6887('0x1f')][_0x6887('0x21')]);}logger[_0x6887('0x1f')](_0x6887('0x1c'),_0x49935c,_0xcc0f0d[_0x6887('0x1f')]['message']);return _0x174525(_0xcc0f0d['error']['message']);}else{logger[_0x6887('0x1b')](_0x6887('0x1c'),_0x49935c,_0x6887('0x1d'));_0x174525(_0xcc0f0d[_0x6887('0x22')]['message']);}})['catch'](function(_0x23d765){logger['error'](_0x6887('0x1c'),_0x49935c,_0x23d765);_0x229d0c(_0x23d765);});});}function respondWithStatusCode(_0x4e3349,_0x8ef585){_0x8ef585=_0x8ef585||0xcc;return function(_0x502a52){if(_0x502a52){return _0x4e3349['sendStatus'](_0x8ef585);}return _0x4e3349[_0x6887('0x23')](_0x8ef585)[_0x6887('0x24')]();};}function respondWithResult(_0x154f2f,_0x5321f9){_0x5321f9=_0x5321f9||0xc8;return function(_0x13baad){if(_0x13baad){return _0x154f2f[_0x6887('0x23')](_0x5321f9)['json'](_0x13baad);}};}function respondWithFilteredResult(_0x157cc9,_0x28c577){return function(_0x62de9b){if(_0x62de9b){var _0x5cfe89=typeof _0x28c577['offset']===_0x6887('0x25')&&typeof _0x28c577[_0x6887('0x26')]===_0x6887('0x25');var _0x53a874=_0x62de9b['count'];var _0x2b98c6=_0x5cfe89?0x0:_0x28c577['offset'];var _0xc092a0=_0x5cfe89?_0x62de9b['count']:_0x28c577[_0x6887('0x27')]+_0x28c577[_0x6887('0x26')];var _0x5edaab;if(_0xc092a0>=_0x53a874){_0xc092a0=_0x53a874;_0x5edaab=0xc8;}else{_0x5edaab=0xce;}_0x157cc9[_0x6887('0x23')](_0x5edaab);return _0x157cc9['set'](_0x6887('0x28'),_0x2b98c6+'-'+_0xc092a0+'/'+_0x53a874)[_0x6887('0x29')](_0x62de9b);}return null;};}function patchUpdates(_0x34d634){return function(_0x516906){try{jsonpatch[_0x6887('0x2a')](_0x516906,_0x34d634,!![]);}catch(_0x4a1798){return BPromise[_0x6887('0x2b')](_0x4a1798);}return _0x516906[_0x6887('0x2c')]();};}function saveUpdates(_0x19eef9,_0x4995d3){return function(_0x534207){if(_0x534207){return _0x534207[_0x6887('0x2d')](_0x19eef9)[_0x6887('0x1a')](function(_0xe16dc9){return _0xe16dc9;});}return null;};}function removeEntity(_0x2f33bc,_0xfb882){return function(_0x3bcb1d){if(_0x3bcb1d){return _0x3bcb1d[_0x6887('0x2e')]()[_0x6887('0x1a')](function(){var _0x25c77a=_0x3bcb1d[_0x6887('0x2f')]({'plain':!![]});var _0x5ef48b='Contexts';return db['UserProfileResource'][_0x6887('0x2e')]({'where':{'type':_0x5ef48b,'resourceId':_0x25c77a['id']}})[_0x6887('0x1a')](function(){return _0x3bcb1d;});})[_0x6887('0x1a')](function(){_0x2f33bc[_0x6887('0x23')](0xcc)[_0x6887('0x24')]();});}};}function handleEntityNotFound(_0x18ced8,_0x64f503){return function(_0x1c2158){if(!_0x1c2158){_0x18ced8[_0x6887('0x30')](0x194);}return _0x1c2158;};}function handleError(_0x1d2cb9,_0x518f5f){_0x518f5f=_0x518f5f||0x1f4;return function(_0xb4000d){logger['error'](_0xb4000d[_0x6887('0x31')]);if(_0xb4000d[_0x6887('0x32')]){delete _0xb4000d[_0x6887('0x32')];}_0x1d2cb9[_0x6887('0x23')](_0x518f5f)[_0x6887('0x33')](_0xb4000d);};}exports[_0x6887('0x34')]=function(_0x56a4a6,_0x88ae52){var _0x42eea2={},_0x2a6abf={},_0x3752d4={'count':0x0,'rows':[]};var _0x4d1dc5=_[_0x6887('0x35')](db[_0x6887('0x36')][_0x6887('0x37')],function(_0x580da5){return{'name':_0x580da5[_0x6887('0x38')],'type':_0x580da5[_0x6887('0x39')][_0x6887('0x3a')]};});_0x2a6abf[_0x6887('0x3b')]=_[_0x6887('0x35')](_0x4d1dc5,_0x6887('0x32'));_0x2a6abf[_0x6887('0x3c')]=_[_0x6887('0x3d')](_0x56a4a6[_0x6887('0x3c')]);_0x2a6abf[_0x6887('0x3e')]=_[_0x6887('0x3f')](_0x2a6abf[_0x6887('0x3b')],_0x2a6abf[_0x6887('0x3c')]);_0x42eea2['attributes']=_['intersection'](_0x2a6abf['model'],qs['fields'](_0x56a4a6['query'][_0x6887('0x40')]));_0x42eea2['attributes']=_0x42eea2[_0x6887('0x41')]['length']?_0x42eea2['attributes']:_0x2a6abf[_0x6887('0x3b')];if(!_0x56a4a6['query'][_0x6887('0x42')](_0x6887('0x43'))){_0x42eea2[_0x6887('0x26')]=qs['limit'](_0x56a4a6['query']['limit']);_0x42eea2[_0x6887('0x27')]=qs[_0x6887('0x27')](_0x56a4a6[_0x6887('0x3c')]['offset']);}_0x42eea2['order']=qs[_0x6887('0x44')](_0x56a4a6[_0x6887('0x3c')][_0x6887('0x44')]);_0x42eea2['where']=qs[_0x6887('0x3e')](_[_0x6887('0x45')](_0x56a4a6['query'],_0x2a6abf['filters']),_0x4d1dc5);if(_0x56a4a6[_0x6887('0x3c')][_0x6887('0x46')]){_0x42eea2['where']=_[_0x6887('0x47')](_0x42eea2[_0x6887('0x48')],{'$or':_[_0x6887('0x35')](_0x4d1dc5,function(_0x2b98b7){if(_0x2b98b7[_0x6887('0x39')]!==_0x6887('0x49')){var _0x34634f={};_0x34634f[_0x2b98b7[_0x6887('0x32')]]={'$like':'%'+_0x56a4a6[_0x6887('0x3c')]['filter']+'%'};return _0x34634f;}})});}_0x42eea2=_[_0x6887('0x47')]({},_0x42eea2,_0x56a4a6[_0x6887('0x4a')]);var _0xc4678f={'where':_0x42eea2[_0x6887('0x48')]};return db['VoiceContext']['count'](_0xc4678f)[_0x6887('0x1a')](function(_0x51c855){_0x3752d4['count']=_0x51c855;if(_0x56a4a6['query'][_0x6887('0x4b')]){_0x42eea2[_0x6887('0x4c')]=[{'all':!![]}];}return db[_0x6887('0x36')]['findAll'](_0x42eea2);})['then'](function(_0x1eaff4){_0x3752d4[_0x6887('0x4d')]=_0x1eaff4;return _0x3752d4;})['then'](respondWithFilteredResult(_0x88ae52,_0x42eea2))[_0x6887('0x4e')](handleError(_0x88ae52,null));};exports['show']=function(_0x5767af,_0x373425){var _0x5a5cfe={'raw':![],'where':{'id':_0x5767af['params']['id']}},_0x4d38b8={};_0x4d38b8[_0x6887('0x3b')]=_[_0x6887('0x3d')](db[_0x6887('0x36')][_0x6887('0x37')]);_0x4d38b8['query']=_['keys'](_0x5767af[_0x6887('0x3c')]);_0x4d38b8[_0x6887('0x3e')]=_[_0x6887('0x3f')](_0x4d38b8['model'],_0x4d38b8[_0x6887('0x3c')]);_0x5a5cfe[_0x6887('0x41')]=_[_0x6887('0x3f')](_0x4d38b8[_0x6887('0x3b')],qs[_0x6887('0x40')](_0x5767af[_0x6887('0x3c')]['fields']));_0x5a5cfe[_0x6887('0x41')]=_0x5a5cfe[_0x6887('0x41')]['length']?_0x5a5cfe[_0x6887('0x41')]:_0x4d38b8[_0x6887('0x3b')];if(_0x5767af[_0x6887('0x3c')]['includeAll']){_0x5a5cfe[_0x6887('0x4c')]=[{'all':!![]}];}_0x5a5cfe=_[_0x6887('0x47')]({},_0x5a5cfe,_0x5767af[_0x6887('0x4a')]);return db[_0x6887('0x36')][_0x6887('0x4f')](_0x5a5cfe)[_0x6887('0x1a')](handleEntityNotFound(_0x373425,null))['then'](respondWithResult(_0x373425,null))[_0x6887('0x4e')](handleError(_0x373425,null));};exports[_0x6887('0x50')]=function(_0x23168b,_0x116bce,_0x191355){var _0xda4b0d;return db['VoiceContext'][_0x6887('0x50')](_0x23168b['body'],{'raw':!![]})['then'](function(_0xaaa65a){_0xda4b0d=_0xaaa65a;return db['VoiceContext'][_0x6887('0x51')]({'raw':!![]});})[_0x6887('0x1a')](function(_0x34b159){var _0x224cef=fs[_0x6887('0x52')](path[_0x6887('0x53')](config[_0x6887('0x54')],_0x6887('0x55')),_0x6887('0x56'));var _0x270697=ejs['render'](_0x224cef,{'contexts':_0x34b159||[]});fs[_0x6887('0x57')](_0x6887('0x58'),_0x270697);})[_0x6887('0x1a')](function(){return respondWithRpcPromise(_0x6887('0x59'),'create',{'module':_0x6887('0x5a')});})['then'](function(){var _0x47d2c9=_0x23168b[_0x6887('0x5b')][_0x6887('0x2f')]({'plain':!![]});if(!_0x47d2c9)throw new Error(_0x6887('0x5c'));if(_0x47d2c9[_0x6887('0x5d')]===_0x6887('0x5b')){var _0xedfd9d=_0xda4b0d[_0x6887('0x2f')]({'plain':!![]});return db[_0x6887('0x5e')][_0x6887('0x4f')]({'where':{'name':_0x6887('0x5f'),'userProfileId':_0x47d2c9[_0x6887('0x60')]},'raw':!![]})[_0x6887('0x1a')](function(_0x51fd5a){if(_0x51fd5a&&_0x51fd5a[_0x6887('0x61')]===0x0){return db[_0x6887('0x62')]['create']({'name':_0xedfd9d[_0x6887('0x32')],'resourceId':_0xedfd9d['id'],'type':_0x51fd5a[_0x6887('0x32')],'sectionId':_0x51fd5a['id']},{})[_0x6887('0x1a')](function(){return _0xda4b0d;});}else{return _0xda4b0d;}})['catch'](function(_0x267c86){logger[_0x6887('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x267c86);throw _0x267c86;});}return _0xda4b0d;})[_0x6887('0x1a')](respondWithResult(_0x116bce,0xc9))[_0x6887('0x4e')](handleError(_0x116bce,null));};exports[_0x6887('0x2d')]=function(_0x50ddb5,_0x44f3e5,_0x1ed80f){var _0x382334;return db['VoiceContext'][_0x6887('0x4f')]({'where':{'id':_0x50ddb5[_0x6887('0x63')]['id']}})['then'](handleEntityNotFound(_0x44f3e5,null))[_0x6887('0x1a')](saveUpdates(_0x50ddb5[_0x6887('0x64')],null))[_0x6887('0x1a')](function(_0x54d5ec){if(_0x54d5ec){_0x382334=_0x54d5ec;return db[_0x6887('0x36')][_0x6887('0x51')]({'raw':!![]});}})[_0x6887('0x1a')](function(_0x1f9235){var _0x3b7c8e=fs[_0x6887('0x52')](path[_0x6887('0x53')](config['root'],_0x6887('0x55')),'utf8');var _0x3a41fd=ejs[_0x6887('0x65')](_0x3b7c8e,{'contexts':_0x1f9235||[]});fs[_0x6887('0x57')](_0x6887('0x58'),_0x3a41fd);})['then'](function(){return respondWithRpcPromise(_0x6887('0x59'),_0x6887('0x2d'),{'module':_0x6887('0x5a')});})[_0x6887('0x1a')](function(){return _0x382334;})[_0x6887('0x1a')](respondWithResult(_0x44f3e5,null))[_0x6887('0x4e')](handleError(_0x44f3e5,null));};exports['destroy']=function(_0x4eabb2,_0x5a50a3,_0x2bf148){var _0x1be677;return db[_0x6887('0x36')][_0x6887('0x4f')]({'where':{'id':_0x4eabb2[_0x6887('0x63')]['id']}})[_0x6887('0x1a')](handleEntityNotFound(_0x5a50a3,null))[_0x6887('0x1a')](removeEntity(_0x5a50a3,null))[_0x6887('0x1a')](function(){return db['VoiceContext'][_0x6887('0x51')]({'raw':!![]});})[_0x6887('0x1a')](function(_0x3f1a1a){var _0x334bd6=fs[_0x6887('0x52')](path[_0x6887('0x53')](config[_0x6887('0x54')],_0x6887('0x55')),'utf8');var _0x5dcbfe=ejs[_0x6887('0x65')](_0x334bd6,{'contexts':_0x3f1a1a});fs[_0x6887('0x57')](_0x6887('0x58'),_0x5dcbfe);return respondWithRpcPromise(_0x6887('0x59'),'destroy',{'module':'chan_sip.so'});})[_0x6887('0x4e')](handleError(_0x5a50a3,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index c79cfcc..594dab7 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 _0xb7a5=['./voiceContext.attributes','exports','VoiceContext','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x4e27,_0x31aa08){var _0x23e904=function(_0x26ffd7){while(--_0x26ffd7){_0x4e27['push'](_0x4e27['shift']());}};_0x23e904(++_0x31aa08);}(_0xb7a5,0x67));var _0x5b7a=function(_0x5a0991,_0x4d4ebc){_0x5a0991=_0x5a0991-0x0;var _0x59b265=_0xb7a5[_0x5a0991];return _0x59b265;};'use strict';var _=require(_0x5b7a('0x0'));var util=require(_0x5b7a('0x1'));var logger=require(_0x5b7a('0x2'))('api');var moment=require(_0x5b7a('0x3'));var BPromise=require('bluebird');var rp=require(_0x5b7a('0x4'));var fs=require('fs');var path=require(_0x5b7a('0x5'));var rimraf=require(_0x5b7a('0x6'));var config=require('../../config/environment');var attributes=require(_0x5b7a('0x7'));module[_0x5b7a('0x8')]=function(_0x1eb9a7,_0x54a7c5){return _0x1eb9a7['define'](_0x5b7a('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f82=['voice_contexts','util','api','moment','bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','exports'];(function(_0x7bce7f,_0x94c408){var _0x3408ec=function(_0x21b4fc){while(--_0x21b4fc){_0x7bce7f['push'](_0x7bce7f['shift']());}};_0x3408ec(++_0x94c408);}(_0x0f82,0x155));var _0x20f8=function(_0x2739ac,_0x45a29d){_0x2739ac=_0x2739ac-0x0;var _0xa610df=_0x0f82[_0x2739ac];return _0xa610df;};'use strict';var _=require('lodash');var util=require(_0x20f8('0x0'));var logger=require('../../config/logger')(_0x20f8('0x1'));var moment=require(_0x20f8('0x2'));var BPromise=require(_0x20f8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20f8('0x4'));var rimraf=require(_0x20f8('0x5'));var config=require(_0x20f8('0x6'));var attributes=require(_0x20f8('0x7'));module[_0x20f8('0x8')]=function(_0x1bd217,_0x227084){return _0x1bd217['define']('VoiceContext',attributes,{'tableName':_0x20f8('0x9'),'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 38d3dc4..010cdd7 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 _0xa03c=['info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x8a51fd,_0x340cda){var _0x355599=function(_0x34ca8e){while(--_0x34ca8e){_0x8a51fd['push'](_0x8a51fd['shift']());}};_0x355599(++_0x340cda);}(_0xa03c,0x94));var _0xca03=function(_0x417f7a,_0x51bd4d){_0x417f7a=_0x417f7a-0x0;var _0x40a02a=_0xa03c[_0x417f7a];return _0x40a02a;};'use strict';var _=require(_0xca03('0x0'));var util=require('util');var moment=require(_0xca03('0x1'));var BPromise=require(_0xca03('0x2'));var rs=require(_0xca03('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca03('0x4'))['db'];var utils=require(_0xca03('0x5'));var logger=require(_0xca03('0x6'))('rpc');var config=require(_0xca03('0x7'));var jayson=require(_0xca03('0x8'));var client=jayson[_0xca03('0x9')][_0xca03('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27aac6,_0x9d2b3d,_0x52f12e){return new BPromise(function(_0x1832cc,_0x18ddee){return client[_0xca03('0xb')](_0x27aac6,_0x52f12e)[_0xca03('0xc')](function(_0x31e7be){logger[_0xca03('0xd')](_0xca03('0xe'),_0x9d2b3d,_0xca03('0xf'));logger[_0xca03('0x10')](_0xca03('0x11'),_0x9d2b3d,'request\x20sent',JSON[_0xca03('0x12')](_0x31e7be));if(_0x31e7be[_0xca03('0x13')]){if(_0x31e7be[_0xca03('0x13')][_0xca03('0x14')]===0x1f4){logger[_0xca03('0x13')](_0xca03('0xe'),_0x9d2b3d,_0x31e7be[_0xca03('0x13')][_0xca03('0x15')]);return _0x18ddee(_0x31e7be[_0xca03('0x13')][_0xca03('0x15')]);}logger[_0xca03('0x13')](_0xca03('0xe'),_0x9d2b3d,_0x31e7be[_0xca03('0x13')][_0xca03('0x15')]);return _0x1832cc(_0x31e7be[_0xca03('0x13')][_0xca03('0x15')]);}else{logger[_0xca03('0xd')](_0xca03('0xe'),_0x9d2b3d,_0xca03('0xf'));_0x1832cc(_0x31e7be['result'][_0xca03('0x15')]);}})[_0xca03('0x16')](function(_0x184313){logger[_0xca03('0x13')](_0xca03('0xe'),_0x9d2b3d,_0x184313);_0x18ddee(_0x184313);});});} \ No newline at end of file +var _0x2be0=['request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x5372e6,_0x38b930){var _0x4ea514=function(_0x19be3c){while(--_0x19be3c){_0x5372e6['push'](_0x5372e6['shift']());}};_0x4ea514(++_0x38b930);}(_0x2be0,0x128));var _0x02be=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x2be0[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0x02be('0x0'));var util=require(_0x02be('0x1'));var moment=require(_0x02be('0x2'));var BPromise=require(_0x02be('0x3'));var rs=require(_0x02be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02be('0x5'))['db'];var utils=require(_0x02be('0x6'));var logger=require(_0x02be('0x7'))('rpc');var config=require(_0x02be('0x8'));var jayson=require(_0x02be('0x9'));var client=jayson[_0x02be('0xa')][_0x02be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x522686,_0x32748e,_0x3eaa8a){return new BPromise(function(_0x22686f,_0xd049ec){return client[_0x02be('0xc')](_0x522686,_0x3eaa8a)[_0x02be('0xd')](function(_0x3e701d){logger[_0x02be('0xe')](_0x02be('0xf'),_0x32748e,_0x02be('0x10'));logger[_0x02be('0x11')](_0x02be('0x12'),_0x32748e,_0x02be('0x10'),JSON[_0x02be('0x13')](_0x3e701d));if(_0x3e701d['error']){if(_0x3e701d[_0x02be('0x14')][_0x02be('0x15')]===0x1f4){logger[_0x02be('0x14')](_0x02be('0xf'),_0x32748e,_0x3e701d['error'][_0x02be('0x16')]);return _0xd049ec(_0x3e701d['error'][_0x02be('0x16')]);}logger[_0x02be('0x14')](_0x02be('0xf'),_0x32748e,_0x3e701d[_0x02be('0x14')][_0x02be('0x16')]);return _0x22686f(_0x3e701d[_0x02be('0x14')][_0x02be('0x16')]);}else{logger[_0x02be('0xe')]('VoiceContext,\x20%s,\x20%s',_0x32748e,_0x02be('0x10'));_0x22686f(_0x3e701d[_0x02be('0x17')]['message']);}})['catch'](function(_0x4376a3){logger['error']('VoiceContext,\x20%s,\x20%s',_0x32748e,_0x4376a3);_0xd049ec(_0x4376a3);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 6bee424..d675859 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 _0xd28a=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','delete','destroy'];(function(_0x3d185c,_0x3b76de){var _0x2b28cc=function(_0x3f5610){while(--_0x3f5610){_0x3d185c['push'](_0x3d185c['shift']());}};_0x2b28cc(++_0x3b76de);}(_0xd28a,0xdd));var _0xad28=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xd28a[_0x344a3f];return _0x264712;};'use strict';var multer=require(_0xad28('0x0'));var util=require(_0xad28('0x1'));var path=require(_0xad28('0x2'));var timeout=require(_0xad28('0x3'));var express=require('express');var router=express[_0xad28('0x4')]();var fs_extra=require(_0xad28('0x5'));var auth=require(_0xad28('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xad28('0x7'));var controller=require(_0xad28('0x8'));router[_0xad28('0x9')]('/',auth[_0xad28('0xa')](),controller[_0xad28('0xb')]);router[_0xad28('0x9')](_0xad28('0xc'),auth[_0xad28('0xa')](),controller['describe']);router[_0xad28('0x9')](_0xad28('0xd'),auth[_0xad28('0xa')](),controller[_0xad28('0xe')]);router[_0xad28('0xf')]('/',auth[_0xad28('0xa')](),controller['create']);router[_0xad28('0x10')]('/:id',auth[_0xad28('0xa')](),controller['update']);router[_0xad28('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xad28('0x12')]);module[_0xad28('0x13')]=router; \ No newline at end of file +var _0x395d=['../../config/environment','./voiceDialReport.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1fa98c,_0x3f81e6){var _0x3b7495=function(_0x220e49){while(--_0x220e49){_0x1fa98c['push'](_0x1fa98c['shift']());}};_0x3b7495(++_0x3f81e6);}(_0x395d,0x1da));var _0xd395=function(_0x33b662,_0x62fe8f){_0x33b662=_0x33b662-0x0;var _0xc50bc9=_0x395d[_0x33b662];return _0xc50bc9;};'use strict';var multer=require('multer');var util=require(_0xd395('0x0'));var path=require(_0xd395('0x1'));var timeout=require('connect-timeout');var express=require(_0xd395('0x2'));var router=express[_0xd395('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd395('0x4'));var interaction=require(_0xd395('0x5'));var config=require(_0xd395('0x6'));var controller=require(_0xd395('0x7'));router[_0xd395('0x8')]('/',auth['isAuthenticated'](),controller[_0xd395('0x9')]);router['get']('/describe',auth[_0xd395('0xa')](),controller['describe']);router[_0xd395('0x8')]('/:id',auth[_0xd395('0xa')](),controller[_0xd395('0xb')]);router[_0xd395('0xc')]('/',auth[_0xd395('0xa')](),controller[_0xd395('0xd')]);router[_0xd395('0xe')](_0xd395('0xf'),auth[_0xd395('0xa')](),controller[_0xd395('0x10')]);router[_0xd395('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd395('0x12')]);module[_0xd395('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 71856c4..6ec7abe 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 _0x6aa7=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x190338,_0x33155e){var _0x294e0f=function(_0x375ee8){while(--_0x375ee8){_0x190338['push'](_0x190338['shift']());}};_0x294e0f(++_0x33155e);}(_0x6aa7,0x178));var _0x76aa=function(_0x3fa386,_0x2a03d0){_0x3fa386=_0x3fa386-0x0;var _0x118475=_0x6aa7[_0x3fa386];return _0x118475;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'channelstate':{'type':Sequelize[_0x76aa('0x2')]},'channelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x76aa('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x2')]},'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'linkedid':{'type':Sequelize[_0x76aa('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x76aa('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'destlanguage':{'type':Sequelize[_0x76aa('0x1')]},'destaccountcode':{'type':Sequelize[_0x76aa('0x1')]},'destcontext':{'type':Sequelize[_0x76aa('0x1')]},'destexten':{'type':Sequelize[_0x76aa('0x1')]},'destpriority':{'type':Sequelize[_0x76aa('0x2')]},'destuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'destlinkedid':{'type':Sequelize[_0x76aa('0x1')]},'dialstring':{'type':Sequelize[_0x76aa('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x76aa('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x76aa('0x3')]},'lastevent':{'type':Sequelize[_0x76aa('0x1')],'comment':_0x76aa('0x4')},'routeId':{'type':Sequelize[_0x76aa('0x2')]},'duration':{'type':Sequelize[_0x76aa('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x00bb=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x38ca5e,_0x542d10){var _0x2f0499=function(_0x26eb85){while(--_0x26eb85){_0x38ca5e['push'](_0x38ca5e['shift']());}};_0x2f0499(++_0x542d10);}(_0x00bb,0x1d8));var _0xb00b=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x00bb[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'privilege':{'type':Sequelize[_0xb00b('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb00b('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb00b('0x2')]},'calleridname':{'type':Sequelize[_0xb00b('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'language':{'type':Sequelize[_0xb00b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb00b('0x3')]},'uniqueid':{'type':Sequelize[_0xb00b('0x2')]},'linkedid':{'type':Sequelize[_0xb00b('0x2')]},'destchannel':{'type':Sequelize[_0xb00b('0x2')]},'destchannelstate':{'type':Sequelize[_0xb00b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb00b('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb00b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'destlanguage':{'type':Sequelize[_0xb00b('0x2')]},'destaccountcode':{'type':Sequelize[_0xb00b('0x2')]},'destcontext':{'type':Sequelize[_0xb00b('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb00b('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xb00b('0x2')]},'starttime':{'type':Sequelize[_0xb00b('0x4')]},'answertime':{'type':Sequelize[_0xb00b('0x4')]},'endtime':{'type':Sequelize[_0xb00b('0x4')]},'lastevent':{'type':Sequelize[_0xb00b('0x2')],'comment':_0xb00b('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xb00b('0x3')]},'holdtime':{'type':Sequelize[_0xb00b('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index a9b3141..abdad37 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 _0xb1be=['options','includeAll','include','findAll','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','send','map','VoiceDialReport','rawAttributes','type','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL'];(function(_0x19f5ad,_0xb7bc88){var _0x3c1507=function(_0x2b10df){while(--_0x2b10df){_0x19f5ad['push'](_0x19f5ad['shift']());}};_0x3c1507(++_0xb7bc88);}(_0xb1be,0x18b));var _0xeb1b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1be[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xeb1b('0x0'));var rimraf=require(_0xeb1b('0x1'));var zipdir=require(_0xeb1b('0x2'));var jsonpatch=require(_0xeb1b('0x3'));var rp=require(_0xeb1b('0x4'));var moment=require('moment');var BPromise=require(_0xeb1b('0x5'));var Mustache=require(_0xeb1b('0x6'));var util=require(_0xeb1b('0x7'));var path=require(_0xeb1b('0x8'));var sox=require(_0xeb1b('0x9'));var csv=require(_0xeb1b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb1b('0xb'));var squel=require(_0xeb1b('0xc'));var crypto=require('crypto');var jsforce=require(_0xeb1b('0xd'));var deskjs=require(_0xeb1b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeb1b('0xf'));var Redis=require('ioredis');var authService=require(_0xeb1b('0x10'));var qs=require(_0xeb1b('0x11'));var as=require(_0xeb1b('0x12'));var hardwareService=require(_0xeb1b('0x13'));var logger=require(_0xeb1b('0x14'))(_0xeb1b('0x15'));var utils=require(_0xeb1b('0x16'));var config=require(_0xeb1b('0x17'));var licenseUtil=require(_0xeb1b('0x18'));var db=require(_0xeb1b('0x19'))['db'];function respondWithStatusCode(_0x6e53b5,_0x29b7bb){_0x29b7bb=_0x29b7bb||0xcc;return function(_0x221ae9){if(_0x221ae9){return _0x6e53b5[_0xeb1b('0x1a')](_0x29b7bb);}return _0x6e53b5[_0xeb1b('0x1b')](_0x29b7bb)[_0xeb1b('0x1c')]();};}function respondWithResult(_0x17a154,_0x534458){_0x534458=_0x534458||0xc8;return function(_0x5f25fb){if(_0x5f25fb){return _0x17a154[_0xeb1b('0x1b')](_0x534458)[_0xeb1b('0x1d')](_0x5f25fb);}};}function respondWithFilteredResult(_0xa9ba24,_0x3101ee){return function(_0x1947d9){if(_0x1947d9){var _0x2fb2f6=typeof _0x3101ee[_0xeb1b('0x1e')]===_0xeb1b('0x1f')&&typeof _0x3101ee[_0xeb1b('0x20')]==='undefined';var _0x12c984=_0x1947d9['count'];var _0x2c5574=_0x2fb2f6?0x0:_0x3101ee[_0xeb1b('0x1e')];var _0x122f42=_0x2fb2f6?_0x1947d9[_0xeb1b('0x21')]:_0x3101ee['offset']+_0x3101ee[_0xeb1b('0x20')];var _0x13707d;if(_0x122f42>=_0x12c984){_0x122f42=_0x12c984;_0x13707d=0xc8;}else{_0x13707d=0xce;}_0xa9ba24[_0xeb1b('0x1b')](_0x13707d);return _0xa9ba24[_0xeb1b('0x22')](_0xeb1b('0x23'),_0x2c5574+'-'+_0x122f42+'/'+_0x12c984)[_0xeb1b('0x1d')](_0x1947d9);}return null;};}function patchUpdates(_0x45fa56){return function(_0x9f4017){try{jsonpatch[_0xeb1b('0x24')](_0x9f4017,_0x45fa56,!![]);}catch(_0x241671){return BPromise[_0xeb1b('0x25')](_0x241671);}return _0x9f4017[_0xeb1b('0x26')]();};}function saveUpdates(_0x5e1dfa,_0x17bb78){return function(_0x23fd41){if(_0x23fd41){return _0x23fd41[_0xeb1b('0x27')](_0x5e1dfa)[_0xeb1b('0x28')](function(_0x1583b8){return _0x1583b8;});}return null;};}function removeEntity(_0x3defa2,_0x2bab14){return function(_0xef10f8){if(_0xef10f8){return _0xef10f8[_0xeb1b('0x29')]()[_0xeb1b('0x28')](function(){_0x3defa2['status'](0xcc)[_0xeb1b('0x1c')]();});}};}function handleEntityNotFound(_0x130c49,_0x46e39b){return function(_0x2628d1){if(!_0x2628d1){_0x130c49['sendStatus'](0x194);}return _0x2628d1;};}function handleError(_0x441266,_0x121a93){_0x121a93=_0x121a93||0x1f4;return function(_0x1b60f5){logger[_0xeb1b('0x2a')](_0x1b60f5['stack']);if(_0x1b60f5['name']){delete _0x1b60f5['name'];}_0x441266[_0xeb1b('0x1b')](_0x121a93)[_0xeb1b('0x2b')](_0x1b60f5);};}exports['index']=function(_0x13f8fa,_0x3a2666){var _0x13a366={},_0x400568={},_0x50dca9={'count':0x0,'rows':[]};var _0xf92771=_[_0xeb1b('0x2c')](db[_0xeb1b('0x2d')][_0xeb1b('0x2e')],function(_0x45a18c){return{'name':_0x45a18c['fieldName'],'type':_0x45a18c[_0xeb1b('0x2f')][_0xeb1b('0x30')]};});_0x400568[_0xeb1b('0x31')]=_[_0xeb1b('0x2c')](_0xf92771,_0xeb1b('0x32'));_0x400568['query']=_[_0xeb1b('0x33')](_0x13f8fa[_0xeb1b('0x34')]);_0x400568['filters']=_[_0xeb1b('0x35')](_0x400568[_0xeb1b('0x31')],_0x400568[_0xeb1b('0x34')]);_0x13a366[_0xeb1b('0x36')]=_[_0xeb1b('0x35')](_0x400568[_0xeb1b('0x31')],qs['fields'](_0x13f8fa[_0xeb1b('0x34')][_0xeb1b('0x37')]));_0x13a366[_0xeb1b('0x36')]=_0x13a366['attributes'][_0xeb1b('0x38')]?_0x13a366[_0xeb1b('0x36')]:_0x400568[_0xeb1b('0x31')];if(!_0x13f8fa[_0xeb1b('0x34')][_0xeb1b('0x39')](_0xeb1b('0x3a'))){_0x13a366[_0xeb1b('0x20')]=qs[_0xeb1b('0x20')](_0x13f8fa[_0xeb1b('0x34')][_0xeb1b('0x20')]);_0x13a366[_0xeb1b('0x1e')]=qs['offset'](_0x13f8fa[_0xeb1b('0x34')]['offset']);}_0x13a366[_0xeb1b('0x3b')]=qs[_0xeb1b('0x3c')](_0x13f8fa[_0xeb1b('0x34')][_0xeb1b('0x3c')]);_0x13a366['where']=qs[_0xeb1b('0x3d')](_[_0xeb1b('0x3e')](_0x13f8fa[_0xeb1b('0x34')],_0x400568[_0xeb1b('0x3d')]),_0xf92771);if(_0x13f8fa[_0xeb1b('0x34')][_0xeb1b('0x3f')]){_0x13a366[_0xeb1b('0x40')]=_[_0xeb1b('0x41')](_0x13a366[_0xeb1b('0x40')],{'$or':_[_0xeb1b('0x2c')](_0xf92771,function(_0x28f955){if(_0x28f955[_0xeb1b('0x2f')]!==_0xeb1b('0x42')){var _0xc1ead2={};_0xc1ead2[_0x28f955['name']]={'$like':'%'+_0x13f8fa[_0xeb1b('0x34')]['filter']+'%'};return _0xc1ead2;}})});}_0x13a366=_[_0xeb1b('0x41')]({},_0x13a366,_0x13f8fa[_0xeb1b('0x43')]);var _0x23f419={'where':_0x13a366[_0xeb1b('0x40')]};return db[_0xeb1b('0x2d')][_0xeb1b('0x21')](_0x23f419)[_0xeb1b('0x28')](function(_0x195e54){_0x50dca9[_0xeb1b('0x21')]=_0x195e54;if(_0x13f8fa['query'][_0xeb1b('0x44')]){_0x13a366[_0xeb1b('0x45')]=[{'all':!![]}];}return db[_0xeb1b('0x2d')][_0xeb1b('0x46')](_0x13a366);})[_0xeb1b('0x28')](function(_0x4acd93){_0x50dca9['rows']=_0x4acd93;return _0x50dca9;})[_0xeb1b('0x28')](respondWithFilteredResult(_0x3a2666,_0x13a366))[_0xeb1b('0x47')](handleError(_0x3a2666,null));};exports['show']=function(_0x35c17e,_0x3e2142){var _0x4c0d9e={'raw':!![],'where':{'id':_0x35c17e[_0xeb1b('0x48')]['id']}},_0x1419f3={};_0x1419f3[_0xeb1b('0x31')]=_[_0xeb1b('0x33')](db[_0xeb1b('0x2d')][_0xeb1b('0x2e')]);_0x1419f3['query']=_['keys'](_0x35c17e['query']);_0x1419f3['filters']=_[_0xeb1b('0x35')](_0x1419f3['model'],_0x1419f3[_0xeb1b('0x34')]);_0x4c0d9e[_0xeb1b('0x36')]=_[_0xeb1b('0x35')](_0x1419f3[_0xeb1b('0x31')],qs[_0xeb1b('0x37')](_0x35c17e[_0xeb1b('0x34')][_0xeb1b('0x37')]));_0x4c0d9e[_0xeb1b('0x36')]=_0x4c0d9e[_0xeb1b('0x36')]['length']?_0x4c0d9e[_0xeb1b('0x36')]:_0x1419f3[_0xeb1b('0x31')];if(_0x35c17e[_0xeb1b('0x34')][_0xeb1b('0x44')]){_0x4c0d9e['include']=[{'all':!![]}];}_0x4c0d9e=_[_0xeb1b('0x41')]({},_0x4c0d9e,_0x35c17e[_0xeb1b('0x43')]);return db[_0xeb1b('0x2d')][_0xeb1b('0x49')](_0x4c0d9e)['then'](handleEntityNotFound(_0x3e2142,null))[_0xeb1b('0x28')](respondWithResult(_0x3e2142,null))[_0xeb1b('0x47')](handleError(_0x3e2142,null));};exports['create']=function(_0x4e16c3,_0x280504){return db[_0xeb1b('0x2d')][_0xeb1b('0x4a')](_0x4e16c3['body'],{})['then'](respondWithResult(_0x280504,0xc9))[_0xeb1b('0x47')](handleError(_0x280504,null));};exports[_0xeb1b('0x27')]=function(_0x42702d,_0x489747){if(_0x42702d[_0xeb1b('0x4b')]['id']){delete _0x42702d['body']['id'];}return db[_0xeb1b('0x2d')][_0xeb1b('0x49')]({'where':{'id':_0x42702d['params']['id']}})[_0xeb1b('0x28')](handleEntityNotFound(_0x489747,null))['then'](saveUpdates(_0x42702d[_0xeb1b('0x4b')],null))['then'](respondWithResult(_0x489747,null))['catch'](handleError(_0x489747,null));};exports[_0xeb1b('0x29')]=function(_0x4e4d52,_0x202734){return db[_0xeb1b('0x2d')][_0xeb1b('0x49')]({'where':{'id':_0x4e4d52[_0xeb1b('0x48')]['id']}})[_0xeb1b('0x28')](handleEntityNotFound(_0x202734,null))[_0xeb1b('0x28')](removeEntity(_0x202734,null))['catch'](handleError(_0x202734,null));};exports[_0xeb1b('0x4c')]=function(_0xab731f,_0x4a816b){return db[_0xeb1b('0x2d')][_0xeb1b('0x4c')]()[_0xeb1b('0x28')](respondWithResult(_0x4a816b,null))['catch'](handleError(_0x4a816b,null));}; \ No newline at end of file +var _0xba83=['fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','rows','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','save','update','then','destroy','end','error','name','send','index','map','VoiceDialReport','rawAttributes'];(function(_0x8a3409,_0x3d7bf5){var _0x152604=function(_0x2901b2){while(--_0x2901b2){_0x8a3409['push'](_0x8a3409['shift']());}};_0x152604(++_0x3d7bf5);}(_0xba83,0x6e));var _0x3ba8=function(_0x37c8ef,_0x334449){_0x37c8ef=_0x37c8ef-0x0;var _0x5eaee9=_0xba83[_0x37c8ef];return _0x5eaee9;};'use strict';var emlformat=require(_0x3ba8('0x0'));var rimraf=require(_0x3ba8('0x1'));var zipdir=require(_0x3ba8('0x2'));var jsonpatch=require(_0x3ba8('0x3'));var rp=require(_0x3ba8('0x4'));var moment=require(_0x3ba8('0x5'));var BPromise=require(_0x3ba8('0x6'));var Mustache=require(_0x3ba8('0x7'));var util=require(_0x3ba8('0x8'));var path=require(_0x3ba8('0x9'));var sox=require(_0x3ba8('0xa'));var csv=require(_0x3ba8('0xb'));var ejs=require(_0x3ba8('0xc'));var fs=require('fs');var fs_extra=require(_0x3ba8('0xd'));var _=require(_0x3ba8('0xe'));var squel=require('squel');var crypto=require(_0x3ba8('0xf'));var jsforce=require(_0x3ba8('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x3ba8('0xb'));var querystring=require(_0x3ba8('0x11'));var Papa=require(_0x3ba8('0x12'));var Redis=require(_0x3ba8('0x13'));var authService=require(_0x3ba8('0x14'));var qs=require(_0x3ba8('0x15'));var as=require(_0x3ba8('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ba8('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x3ba8('0x18'));var licenseUtil=require(_0x3ba8('0x19'));var db=require(_0x3ba8('0x1a'))['db'];function respondWithStatusCode(_0x4411d4,_0x37787b){_0x37787b=_0x37787b||0xcc;return function(_0x149ac0){if(_0x149ac0){return _0x4411d4[_0x3ba8('0x1b')](_0x37787b);}return _0x4411d4['status'](_0x37787b)['end']();};}function respondWithResult(_0x2e3bbf,_0x5c7183){_0x5c7183=_0x5c7183||0xc8;return function(_0x192a42){if(_0x192a42){return _0x2e3bbf[_0x3ba8('0x1c')](_0x5c7183)['json'](_0x192a42);}};}function respondWithFilteredResult(_0x287336,_0x44ff00){return function(_0x28cfa5){if(_0x28cfa5){var _0x459a69=typeof _0x44ff00['offset']===_0x3ba8('0x1d')&&typeof _0x44ff00[_0x3ba8('0x1e')]===_0x3ba8('0x1d');var _0x18a81a=_0x28cfa5[_0x3ba8('0x1f')];var _0xb830b4=_0x459a69?0x0:_0x44ff00[_0x3ba8('0x20')];var _0x509e8c=_0x459a69?_0x28cfa5[_0x3ba8('0x1f')]:_0x44ff00['offset']+_0x44ff00[_0x3ba8('0x1e')];var _0x32bcce;if(_0x509e8c>=_0x18a81a){_0x509e8c=_0x18a81a;_0x32bcce=0xc8;}else{_0x32bcce=0xce;}_0x287336[_0x3ba8('0x1c')](_0x32bcce);return _0x287336[_0x3ba8('0x21')](_0x3ba8('0x22'),_0xb830b4+'-'+_0x509e8c+'/'+_0x18a81a)[_0x3ba8('0x23')](_0x28cfa5);}return null;};}function patchUpdates(_0x4010b2){return function(_0x2cbe30){try{jsonpatch['apply'](_0x2cbe30,_0x4010b2,!![]);}catch(_0x4209b6){return BPromise['reject'](_0x4209b6);}return _0x2cbe30[_0x3ba8('0x24')]();};}function saveUpdates(_0x5d8058,_0x3edcad){return function(_0x688da3){if(_0x688da3){return _0x688da3[_0x3ba8('0x25')](_0x5d8058)[_0x3ba8('0x26')](function(_0x59020b){return _0x59020b;});}return null;};}function removeEntity(_0x12856c,_0x213aff){return function(_0x201af0){if(_0x201af0){return _0x201af0[_0x3ba8('0x27')]()[_0x3ba8('0x26')](function(){_0x12856c['status'](0xcc)[_0x3ba8('0x28')]();});}};}function handleEntityNotFound(_0x3e0eac,_0x3146dd){return function(_0x2517c8){if(!_0x2517c8){_0x3e0eac[_0x3ba8('0x1b')](0x194);}return _0x2517c8;};}function handleError(_0x461300,_0x24fd87){_0x24fd87=_0x24fd87||0x1f4;return function(_0x5c5e04){logger[_0x3ba8('0x29')](_0x5c5e04['stack']);if(_0x5c5e04[_0x3ba8('0x2a')]){delete _0x5c5e04[_0x3ba8('0x2a')];}_0x461300[_0x3ba8('0x1c')](_0x24fd87)[_0x3ba8('0x2b')](_0x5c5e04);};}exports[_0x3ba8('0x2c')]=function(_0x2e98b1,_0x427625){var _0x1a2606={},_0x1659a2={},_0x1a90ca={'count':0x0,'rows':[]};var _0xe3c0f5=_[_0x3ba8('0x2d')](db[_0x3ba8('0x2e')][_0x3ba8('0x2f')],function(_0x418a6e){return{'name':_0x418a6e[_0x3ba8('0x30')],'type':_0x418a6e[_0x3ba8('0x31')][_0x3ba8('0x32')]};});_0x1659a2['model']=_[_0x3ba8('0x2d')](_0xe3c0f5,_0x3ba8('0x2a'));_0x1659a2[_0x3ba8('0x33')]=_['keys'](_0x2e98b1[_0x3ba8('0x33')]);_0x1659a2[_0x3ba8('0x34')]=_[_0x3ba8('0x35')](_0x1659a2[_0x3ba8('0x36')],_0x1659a2[_0x3ba8('0x33')]);_0x1a2606[_0x3ba8('0x37')]=_[_0x3ba8('0x35')](_0x1659a2[_0x3ba8('0x36')],qs[_0x3ba8('0x38')](_0x2e98b1[_0x3ba8('0x33')][_0x3ba8('0x38')]));_0x1a2606[_0x3ba8('0x37')]=_0x1a2606['attributes'][_0x3ba8('0x39')]?_0x1a2606['attributes']:_0x1659a2[_0x3ba8('0x36')];if(!_0x2e98b1[_0x3ba8('0x33')][_0x3ba8('0x3a')](_0x3ba8('0x3b'))){_0x1a2606[_0x3ba8('0x1e')]=qs[_0x3ba8('0x1e')](_0x2e98b1['query'][_0x3ba8('0x1e')]);_0x1a2606[_0x3ba8('0x20')]=qs[_0x3ba8('0x20')](_0x2e98b1[_0x3ba8('0x33')][_0x3ba8('0x20')]);}_0x1a2606[_0x3ba8('0x3c')]=qs[_0x3ba8('0x3d')](_0x2e98b1[_0x3ba8('0x33')][_0x3ba8('0x3d')]);_0x1a2606['where']=qs['filters'](_[_0x3ba8('0x3e')](_0x2e98b1['query'],_0x1659a2[_0x3ba8('0x34')]),_0xe3c0f5);if(_0x2e98b1[_0x3ba8('0x33')][_0x3ba8('0x3f')]){_0x1a2606['where']=_[_0x3ba8('0x40')](_0x1a2606['where'],{'$or':_[_0x3ba8('0x2d')](_0xe3c0f5,function(_0x3d3c2f){if(_0x3d3c2f[_0x3ba8('0x31')]!==_0x3ba8('0x41')){var _0x22edac={};_0x22edac[_0x3d3c2f['name']]={'$like':'%'+_0x2e98b1['query'][_0x3ba8('0x3f')]+'%'};return _0x22edac;}})});}_0x1a2606=_[_0x3ba8('0x40')]({},_0x1a2606,_0x2e98b1[_0x3ba8('0x42')]);var _0x129d51={'where':_0x1a2606[_0x3ba8('0x43')]};return db[_0x3ba8('0x2e')][_0x3ba8('0x1f')](_0x129d51)['then'](function(_0x32333d){_0x1a90ca['count']=_0x32333d;if(_0x2e98b1['query'][_0x3ba8('0x44')]){_0x1a2606[_0x3ba8('0x45')]=[{'all':!![]}];}return db[_0x3ba8('0x2e')]['findAll'](_0x1a2606);})['then'](function(_0x17c6e8){_0x1a90ca[_0x3ba8('0x46')]=_0x17c6e8;return _0x1a90ca;})['then'](respondWithFilteredResult(_0x427625,_0x1a2606))[_0x3ba8('0x47')](handleError(_0x427625,null));};exports[_0x3ba8('0x48')]=function(_0x21d71,_0x5807ae){var _0x3014fa={'raw':!![],'where':{'id':_0x21d71[_0x3ba8('0x49')]['id']}},_0x5442ca={};_0x5442ca[_0x3ba8('0x36')]=_[_0x3ba8('0x4a')](db['VoiceDialReport'][_0x3ba8('0x2f')]);_0x5442ca[_0x3ba8('0x33')]=_[_0x3ba8('0x4a')](_0x21d71[_0x3ba8('0x33')]);_0x5442ca[_0x3ba8('0x34')]=_[_0x3ba8('0x35')](_0x5442ca[_0x3ba8('0x36')],_0x5442ca[_0x3ba8('0x33')]);_0x3014fa[_0x3ba8('0x37')]=_[_0x3ba8('0x35')](_0x5442ca[_0x3ba8('0x36')],qs[_0x3ba8('0x38')](_0x21d71['query'][_0x3ba8('0x38')]));_0x3014fa[_0x3ba8('0x37')]=_0x3014fa[_0x3ba8('0x37')][_0x3ba8('0x39')]?_0x3014fa[_0x3ba8('0x37')]:_0x5442ca['model'];if(_0x21d71[_0x3ba8('0x33')]['includeAll']){_0x3014fa[_0x3ba8('0x45')]=[{'all':!![]}];}_0x3014fa=_['merge']({},_0x3014fa,_0x21d71[_0x3ba8('0x42')]);return db[_0x3ba8('0x2e')]['find'](_0x3014fa)[_0x3ba8('0x26')](handleEntityNotFound(_0x5807ae,null))[_0x3ba8('0x26')](respondWithResult(_0x5807ae,null))['catch'](handleError(_0x5807ae,null));};exports[_0x3ba8('0x4b')]=function(_0xc9c743,_0x1c3eab){return db[_0x3ba8('0x2e')]['create'](_0xc9c743[_0x3ba8('0x4c')],{})[_0x3ba8('0x26')](respondWithResult(_0x1c3eab,0xc9))[_0x3ba8('0x47')](handleError(_0x1c3eab,null));};exports['update']=function(_0x2919b3,_0x2cb4f4){if(_0x2919b3[_0x3ba8('0x4c')]['id']){delete _0x2919b3[_0x3ba8('0x4c')]['id'];}return db[_0x3ba8('0x2e')]['find']({'where':{'id':_0x2919b3['params']['id']}})[_0x3ba8('0x26')](handleEntityNotFound(_0x2cb4f4,null))[_0x3ba8('0x26')](saveUpdates(_0x2919b3[_0x3ba8('0x4c')],null))[_0x3ba8('0x26')](respondWithResult(_0x2cb4f4,null))[_0x3ba8('0x47')](handleError(_0x2cb4f4,null));};exports[_0x3ba8('0x27')]=function(_0x17ca67,_0x1ebedc){return db['VoiceDialReport'][_0x3ba8('0x4d')]({'where':{'id':_0x17ca67[_0x3ba8('0x49')]['id']}})[_0x3ba8('0x26')](handleEntityNotFound(_0x1ebedc,null))['then'](removeEntity(_0x1ebedc,null))[_0x3ba8('0x47')](handleError(_0x1ebedc,null));};exports[_0x3ba8('0x4e')]=function(_0x38e694,_0x59dd5e){return db['VoiceDialReport']['describe']()['then'](respondWithResult(_0x59dd5e,null))[_0x3ba8('0x47')](handleError(_0x59dd5e,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index bb9541d..caab724 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 _0xc358=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial','lodash','util'];(function(_0x4d78e3,_0x231342){var _0x3b0ee4=function(_0x972306){while(--_0x972306){_0x4d78e3['push'](_0x4d78e3['shift']());}};_0x3b0ee4(++_0x231342);}(_0xc358,0x108));var _0x8c35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc358[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8c35('0x0'));var util=require(_0x8c35('0x1'));var logger=require(_0x8c35('0x2'))(_0x8c35('0x3'));var moment=require(_0x8c35('0x4'));var BPromise=require(_0x8c35('0x5'));var rp=require(_0x8c35('0x6'));var fs=require('fs');var path=require(_0x8c35('0x7'));var rimraf=require(_0x8c35('0x8'));var config=require(_0x8c35('0x9'));var attributes=require(_0x8c35('0xa'));module[_0x8c35('0xb')]=function(_0xe37c50,_0x57ed53){return _0xe37c50[_0x8c35('0xc')]('VoiceDialReport',attributes,{'tableName':_0x8c35('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6460=['path','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','moment','request-promise'];(function(_0x2096b2,_0x53c8bd){var _0x540b16=function(_0x4f7d38){while(--_0x4f7d38){_0x2096b2['push'](_0x2096b2['shift']());}};_0x540b16(++_0x53c8bd);}(_0x6460,0x158));var _0x0646=function(_0x1b81ae,_0x1941f7){_0x1b81ae=_0x1b81ae-0x0;var _0x33ba48=_0x6460[_0x1b81ae];return _0x33ba48;};'use strict';var _=require('lodash');var util=require(_0x0646('0x0'));var logger=require(_0x0646('0x1'))('api');var moment=require(_0x0646('0x2'));var BPromise=require('bluebird');var rp=require(_0x0646('0x3'));var fs=require('fs');var path=require(_0x0646('0x4'));var rimraf=require('rimraf');var config=require(_0x0646('0x5'));var attributes=require(_0x0646('0x6'));module[_0x0646('0x7')]=function(_0x84717c,_0x569813){return _0x84717c[_0x0646('0x8')](_0x0646('0x9'),attributes,{'tableName':_0x0646('0xa'),'paranoid':![],'indexes':[{'fields':[_0x0646('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 28dcdb8..908a2c4 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 _0xace0=['request\x20sent','error','code','message','info','result','catch','VoiceDialReport','body','options','raw','then','CreateVoiceDialReport','UpdateVoiceDialReport','update','attributes','stringify','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s'];(function(_0x55b58c,_0x2c4cc2){var _0x1bbde4=function(_0x1d323e){while(--_0x1d323e){_0x55b58c['push'](_0x55b58c['shift']());}};_0x1bbde4(++_0x2c4cc2);}(_0xace0,0x89));var _0x0ace=function(_0xee588,_0x368239){_0xee588=_0xee588-0x0;var _0x58dd1a=_0xace0[_0xee588];return _0x58dd1a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0ace('0x0'));var BPromise=require(_0x0ace('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ace('0x2'));var db=require(_0x0ace('0x3'))['db'];var utils=require(_0x0ace('0x4'));var logger=require('../../config/logger')(_0x0ace('0x5'));var config=require('../../config/environment');var jayson=require(_0x0ace('0x6'));var client=jayson[_0x0ace('0x7')][_0x0ace('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3749e4,_0x2b1ac4,_0x14ef70){return new BPromise(function(_0x3349af,_0x34473e){return client[_0x0ace('0x9')](_0x3749e4,_0x14ef70)['then'](function(_0x2177e4){logger['info'](_0x0ace('0xa'),_0x2b1ac4,'request\x20sent');logger[_0x0ace('0xb')](_0x0ace('0xc'),_0x2b1ac4,_0x0ace('0xd'),JSON['stringify'](_0x2177e4));if(_0x2177e4['error']){if(_0x2177e4[_0x0ace('0xe')][_0x0ace('0xf')]===0x1f4){logger[_0x0ace('0xe')](_0x0ace('0xa'),_0x2b1ac4,_0x2177e4[_0x0ace('0xe')]['message']);return _0x34473e(_0x2177e4[_0x0ace('0xe')][_0x0ace('0x10')]);}logger['error'](_0x0ace('0xa'),_0x2b1ac4,_0x2177e4[_0x0ace('0xe')]['message']);return _0x3349af(_0x2177e4['error'][_0x0ace('0x10')]);}else{logger[_0x0ace('0x11')](_0x0ace('0xa'),_0x2b1ac4,'request\x20sent');_0x3349af(_0x2177e4[_0x0ace('0x12')][_0x0ace('0x10')]);}})[_0x0ace('0x13')](function(_0x14a821){logger[_0x0ace('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x2b1ac4,_0x14a821);_0x34473e(_0x14a821);});});}exports['CreateVoiceDialReport']=function(_0x51739f){var _0x462bb9=this;return new Promise(function(_0x1bf348,_0x22786c){return db[_0x0ace('0x14')]['create'](_0x51739f[_0x0ace('0x15')],{'raw':_0x51739f['options']?_0x51739f[_0x0ace('0x16')][_0x0ace('0x17')]===undefined?!![]:![]:!![]})[_0x0ace('0x18')](function(_0x59f774){logger[_0x0ace('0x11')]('CreateVoiceDialReport',_0x51739f);logger[_0x0ace('0xb')](_0x0ace('0x19'),_0x51739f,JSON['stringify'](_0x59f774));_0x1bf348(_0x59f774);})['catch'](function(_0x5db131){logger[_0x0ace('0xe')](_0x0ace('0x19'),_0x5db131[_0x0ace('0x10')],_0x51739f);_0x22786c(_0x462bb9['error'](0x1f4,_0x5db131['message']));});});};exports[_0x0ace('0x1a')]=function(_0x2e4dc8){var _0xf61872=this;return new Promise(function(_0x1b0d89,_0xf3f064){return db[_0x0ace('0x14')][_0x0ace('0x1b')](_0x2e4dc8['body'],{'raw':_0x2e4dc8[_0x0ace('0x16')]?_0x2e4dc8[_0x0ace('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e4dc8[_0x0ace('0x16')]?_0x2e4dc8[_0x0ace('0x16')]['where']||null:null,'attributes':_0x2e4dc8[_0x0ace('0x16')]?_0x2e4dc8[_0x0ace('0x16')][_0x0ace('0x1c')]||null:null,'limit':_0x2e4dc8['options']?_0x2e4dc8['options']['limit']||null:null})[_0x0ace('0x18')](function(_0x46f696){logger['info'](_0x0ace('0x1a'),_0x2e4dc8);logger[_0x0ace('0xb')](_0x0ace('0x1a'),_0x2e4dc8,JSON[_0x0ace('0x1d')](_0x46f696));_0x1b0d89(_0x46f696);})[_0x0ace('0x13')](function(_0x532585){logger[_0x0ace('0xe')]('UpdateVoiceDialReport',_0x532585[_0x0ace('0x10')],_0x2e4dc8);_0xf3f064(_0xf61872[_0x0ace('0xe')](0x1f4,_0x532585[_0x0ace('0x10')]));});});}; \ No newline at end of file +var _0xa56f=['catch','CreateVoiceDialReport','VoiceDialReport','body','options','debug','UpdateVoiceDialReport','update','raw','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x28ab95,_0x5e5670){var _0x369b86=function(_0x2e76a4){while(--_0x2e76a4){_0x28ab95['push'](_0x28ab95['shift']());}};_0x369b86(++_0x5e5670);}(_0xa56f,0x1ca));var _0xfa56=function(_0xb4e843,_0x2b7cef){_0xb4e843=_0xb4e843-0x0;var _0x1c2346=_0xa56f[_0xb4e843];return _0x1c2346;};'use strict';var _=require(_0xfa56('0x0'));var util=require(_0xfa56('0x1'));var moment=require(_0xfa56('0x2'));var BPromise=require(_0xfa56('0x3'));var rs=require(_0xfa56('0x4'));var fs=require('fs');var Redis=require(_0xfa56('0x5'));var db=require(_0xfa56('0x6'))['db'];var utils=require(_0xfa56('0x7'));var logger=require(_0xfa56('0x8'))('rpc');var config=require(_0xfa56('0x9'));var jayson=require(_0xfa56('0xa'));var client=jayson[_0xfa56('0xb')][_0xfa56('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315f92,_0x12dfc8,_0x73fb2f){return new BPromise(function(_0x36653e,_0x5509b1){return client['request'](_0x315f92,_0x73fb2f)[_0xfa56('0xd')](function(_0x36b980){logger[_0xfa56('0xe')](_0xfa56('0xf'),_0x12dfc8,_0xfa56('0x10'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x12dfc8,_0xfa56('0x10'),JSON[_0xfa56('0x11')](_0x36b980));if(_0x36b980['error']){if(_0x36b980[_0xfa56('0x12')][_0xfa56('0x13')]===0x1f4){logger[_0xfa56('0x12')](_0xfa56('0xf'),_0x12dfc8,_0x36b980['error']['message']);return _0x5509b1(_0x36b980[_0xfa56('0x12')][_0xfa56('0x14')]);}logger[_0xfa56('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x12dfc8,_0x36b980[_0xfa56('0x12')]['message']);return _0x36653e(_0x36b980[_0xfa56('0x12')][_0xfa56('0x14')]);}else{logger[_0xfa56('0xe')](_0xfa56('0xf'),_0x12dfc8,_0xfa56('0x10'));_0x36653e(_0x36b980[_0xfa56('0x15')][_0xfa56('0x14')]);}})[_0xfa56('0x16')](function(_0x34e1f2){logger[_0xfa56('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x12dfc8,_0x34e1f2);_0x5509b1(_0x34e1f2);});});}exports[_0xfa56('0x17')]=function(_0x34082f){var _0x5e7dbc=this;return new Promise(function(_0x160ab1,_0x5def6e){return db[_0xfa56('0x18')]['create'](_0x34082f[_0xfa56('0x19')],{'raw':_0x34082f[_0xfa56('0x1a')]?_0x34082f['options']['raw']===undefined?!![]:![]:!![]})[_0xfa56('0xd')](function(_0x3cb7fd){logger[_0xfa56('0xe')](_0xfa56('0x17'),_0x34082f);logger[_0xfa56('0x1b')]('CreateVoiceDialReport',_0x34082f,JSON[_0xfa56('0x11')](_0x3cb7fd));_0x160ab1(_0x3cb7fd);})['catch'](function(_0x5f13f1){logger[_0xfa56('0x12')](_0xfa56('0x17'),_0x5f13f1[_0xfa56('0x14')],_0x34082f);_0x5def6e(_0x5e7dbc[_0xfa56('0x12')](0x1f4,_0x5f13f1[_0xfa56('0x14')]));});});};exports[_0xfa56('0x1c')]=function(_0x5cf47b){var _0xf0e8ca=this;return new Promise(function(_0x48611e,_0xed3f3a){return db[_0xfa56('0x18')][_0xfa56('0x1d')](_0x5cf47b['body'],{'raw':_0x5cf47b[_0xfa56('0x1a')]?_0x5cf47b['options'][_0xfa56('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cf47b[_0xfa56('0x1a')]?_0x5cf47b['options']['where']||null:null,'attributes':_0x5cf47b['options']?_0x5cf47b[_0xfa56('0x1a')]['attributes']||null:null,'limit':_0x5cf47b[_0xfa56('0x1a')]?_0x5cf47b['options'][_0xfa56('0x1f')]||null:null})['then'](function(_0x2f639b){logger['info'](_0xfa56('0x1c'),_0x5cf47b);logger[_0xfa56('0x1b')](_0xfa56('0x1c'),_0x5cf47b,JSON[_0xfa56('0x11')](_0x2f639b));_0x48611e(_0x2f639b);})[_0xfa56('0x16')](function(_0x4ab72c){logger[_0xfa56('0x12')]('UpdateVoiceDialReport',_0x4ab72c['message'],_0x5cf47b);_0xed3f3a(_0xf0e8ca[_0xfa56('0x12')](0x1f4,_0x4ab72c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 9963474..9d89087 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 _0x8405=['destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','/:id/applications','put','update','delete'];(function(_0x25cae9,_0x4df5f9){var _0x100f4a=function(_0x48c654){while(--_0x48c654){_0x25cae9['push'](_0x25cae9['shift']());}};_0x100f4a(++_0x4df5f9);}(_0x8405,0xfe));var _0x5840=function(_0x22b719,_0x315885){_0x22b719=_0x22b719-0x0;var _0x4a87d9=_0x8405[_0x22b719];return _0x4a87d9;};'use strict';var multer=require('multer');var util=require(_0x5840('0x0'));var path=require('path');var timeout=require(_0x5840('0x1'));var express=require(_0x5840('0x2'));var router=express[_0x5840('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5840('0x4'));var interaction=require(_0x5840('0x5'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0x5840('0x6')]('/',auth[_0x5840('0x7')](),controller['index']);router[_0x5840('0x6')](_0x5840('0x8'),auth[_0x5840('0x7')](),controller[_0x5840('0x9')]);router[_0x5840('0xa')]('/',auth[_0x5840('0x7')](),controller[_0x5840('0xb')]);router[_0x5840('0xa')](_0x5840('0xc'),auth[_0x5840('0x7')](),controller['addApplications']);router[_0x5840('0xd')](_0x5840('0x8'),auth[_0x5840('0x7')](),controller[_0x5840('0xe')]);router[_0x5840('0xf')](_0x5840('0x8'),auth[_0x5840('0x7')](),controller[_0x5840('0x10')]);module[_0x5840('0x11')]=router; \ No newline at end of file +var _0x4b9c=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','addApplications','delete','exports','multer','util'];(function(_0x43bb70,_0x3e6af9){var _0x2f7d40=function(_0x2e44fe){while(--_0x2e44fe){_0x43bb70['push'](_0x43bb70['shift']());}};_0x2f7d40(++_0x3e6af9);}(_0x4b9c,0x64));var _0xc4b9=function(_0x1aa578,_0x178cea){_0x1aa578=_0x1aa578-0x0;var _0x572be8=_0x4b9c[_0x1aa578];return _0x572be8;};'use strict';var multer=require(_0xc4b9('0x0'));var util=require(_0xc4b9('0x1'));var path=require(_0xc4b9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc4b9('0x3')]();var fs_extra=require(_0xc4b9('0x4'));var auth=require(_0xc4b9('0x5'));var interaction=require(_0xc4b9('0x6'));var config=require(_0xc4b9('0x7'));var controller=require('./voiceExtension.controller');router[_0xc4b9('0x8')]('/',auth['isAuthenticated'](),controller[_0xc4b9('0x9')]);router[_0xc4b9('0x8')](_0xc4b9('0xa'),auth[_0xc4b9('0xb')](),controller[_0xc4b9('0xc')]);router[_0xc4b9('0xd')]('/',auth[_0xc4b9('0xb')](),controller['create']);router[_0xc4b9('0xd')]('/:id/applications',auth[_0xc4b9('0xb')](),controller[_0xc4b9('0xe')]);router['put'](_0xc4b9('0xa'),auth[_0xc4b9('0xb')](),controller['update']);router[_0xc4b9('0xf')](_0xc4b9('0xa'),auth[_0xc4b9('0xb')](),controller['destroy']);module[_0xc4b9('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 2b40884..85e04df 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 _0xcbf5=['inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','wav','getDataValue','exports','STRING','compositeIndex','NoOp','ENUM','internal'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0xcbf5,0xcc));var _0x5cbf=function(_0x2a8dc7,_0x58ace0){_0x2a8dc7=_0x2a8dc7-0x0;var _0x836dba=_0xcbf5[_0x2a8dc7];return _0x836dba;};'use strict';var Sequelize=require('sequelize');module[_0x5cbf('0x0')]={'context':{'type':Sequelize[_0x5cbf('0x1')],'allowNull':![],'unique':_0x5cbf('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x5cbf('0x1')],'allowNull':![],'unique':_0x5cbf('0x2')},'priority':{'type':Sequelize[_0x5cbf('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x5cbf('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x5cbf('0x1')],'allowNull':![],'defaultValue':_0x5cbf('0x3')},'appdata':{'type':Sequelize[_0x5cbf('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x5cbf('0x4')]('inbound','outbound',_0x5cbf('0x5'),_0x5cbf('0x6'),_0x5cbf('0x7'),_0x5cbf('0x8'),_0x5cbf('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x5cbf('0x1')]},'interval':{'type':Sequelize[_0x5cbf('0x1')],'allowNull':![],'defaultValue':_0x5cbf('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x5cbf('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x5cbf('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x5cbf('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x5cbf('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x5cbf('0xc')]},'recordingFormat':{'type':Sequelize[_0x5cbf('0x1')],'defaultValue':_0x5cbf('0xd')},'answer':{'type':Sequelize[_0x5cbf('0xb')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x40d620){return this[_0x5cbf('0xe')]('exten');}},'alias':{'type':Sequelize[_0x5cbf('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xac50=['outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','wav','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax'];(function(_0x14652e,_0x59fb87){var _0x1e3b87=function(_0x3942f2){while(--_0x3942f2){_0x14652e['push'](_0x14652e['shift']());}};_0x1e3b87(++_0x59fb87);}(_0xac50,0x128));var _0x0ac5=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xac50[_0x4fbfd9];return _0x31dc94;};'use strict';var Sequelize=require(_0x0ac5('0x0'));module[_0x0ac5('0x1')]={'context':{'type':Sequelize[_0x0ac5('0x2')],'allowNull':![],'unique':_0x0ac5('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0ac5('0x2')],'allowNull':![],'unique':_0x0ac5('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0ac5('0x3')},'tag':{'type':Sequelize[_0x0ac5('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0ac5('0x2')],'allowNull':![],'defaultValue':_0x0ac5('0x4')},'appdata':{'type':Sequelize[_0x0ac5('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0ac5('0x5')](_0x0ac5('0x6'),_0x0ac5('0x7'),_0x0ac5('0x8'),_0x0ac5('0x9'),_0x0ac5('0xa'),_0x0ac5('0xb'),_0x0ac5('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x0ac5('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0ac5('0xd')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x0ac5('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x0ac5('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x0ac5('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0ac5('0xf')]},'recordingFormat':{'type':Sequelize[_0x0ac5('0x2')],'defaultValue':_0x0ac5('0x10')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x469838){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0x0ac5('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index b0c8152..8f50fa2 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 _0x7c16=['name','UserProfileResource','stack','send','index','map','rawAttributes','fieldName','model','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','options','VoiceExtension','includeAll','include','rows','show','params','catch','create','startsWith','body','concat','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','description','cutdigits','mandatoryDisposition','alias','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../config/logger','api','../../config/environment','redis','./voiceExtension.socket','register','sendStatus','end','status','json','limit','undefined','offset','count','set','Content-Range','destroy','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','includes','type','find'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7c16,0x1f0));var _0x67c1=function(_0x40c849,_0xbc22a1){_0x40c849=_0x40c849-0x0;var _0x7d3bef=_0x7c16[_0x40c849];return _0x7d3bef;};'use strict';var _=require(_0x67c1('0x0'));var Redis=require(_0x67c1('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x67c1('0x2'))(_0x67c1('0x3'));var config=require(_0x67c1('0x4'));var db=require('../../mysqldb')['db'];config[_0x67c1('0x5')]=_['defaults'](config[_0x67c1('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x67c1('0x5')]));require(_0x67c1('0x6'))[_0x67c1('0x7')](socket);function respondWithStatusCode(_0x1fadc0,_0x2a23f2){_0x2a23f2=_0x2a23f2||0xcc;return function(_0x26c950){if(_0x26c950){return _0x1fadc0[_0x67c1('0x8')](_0x2a23f2);}return _0x1fadc0['status'](_0x2a23f2)[_0x67c1('0x9')]();};}function respondWithResult(_0x169240,_0x3844b5){_0x3844b5=_0x3844b5||0xc8;return function(_0x43d446){if(_0x43d446){return _0x169240[_0x67c1('0xa')](_0x3844b5)[_0x67c1('0xb')](_0x43d446);}};}function respondWithFilteredResult(_0xf7529f,_0x1cd58d){return function(_0x1000bb){if(_0x1000bb){var _0x5f4e6f=typeof _0x1cd58d['offset']==='undefined'&&typeof _0x1cd58d[_0x67c1('0xc')]===_0x67c1('0xd');var _0x453f11=_0x1000bb['count'];var _0x18a2a9=_0x5f4e6f?0x0:_0x1cd58d[_0x67c1('0xe')];var _0x3ee15e=_0x5f4e6f?_0x1000bb[_0x67c1('0xf')]:_0x1cd58d[_0x67c1('0xe')]+_0x1cd58d[_0x67c1('0xc')];var _0x3b3b1a;if(_0x3ee15e>=_0x453f11){_0x3ee15e=_0x453f11;_0x3b3b1a=0xc8;}else{_0x3b3b1a=0xce;}_0xf7529f[_0x67c1('0xa')](_0x3b3b1a);return _0xf7529f[_0x67c1('0x10')](_0x67c1('0x11'),_0x18a2a9+'-'+_0x3ee15e+'/'+_0x453f11)[_0x67c1('0xb')](_0x1000bb);}return null;};}function removeEntity(_0x2af2fc){return function(_0x34f564){if(_0x34f564){return _0x34f564[_0x67c1('0x12')]()[_0x67c1('0x13')](function(){var _0x471c6f=_0x34f564[_0x67c1('0x14')]({'plain':!![]});var _0x3e5bfd=[{'name':_0x67c1('0x15'),'value':'inbound','ignore':![]},{'name':_0x67c1('0x16'),'value':_0x67c1('0x17'),'ignore':![]},{'name':_0x67c1('0x18'),'value':_0x67c1('0x19'),'ignore':![]}];var _0x204593=_(_0x3e5bfd)[_0x67c1('0x1a')](_0x67c1('0x1b'))['map'](_0x67c1('0x1c'))[_0x67c1('0x1c')]();if(_[_0x67c1('0x1d')](_0x204593,_0x471c6f[_0x67c1('0x1e')])){return;}var _0x118fe8=_[_0x67c1('0x1f')](_0x3e5bfd,['value',_0x471c6f[_0x67c1('0x1e')]])[_0x67c1('0x20')];return db[_0x67c1('0x21')][_0x67c1('0x12')]({'where':{'type':_0x118fe8,'resourceId':_0x471c6f['id']}})[_0x67c1('0x13')](function(){return _0x34f564;});})[_0x67c1('0x13')](function(){_0x2af2fc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42d78e){return function(_0x431cbf){if(!_0x431cbf){_0x42d78e[_0x67c1('0x8')](0x194);}return _0x431cbf;};}function handleError(_0x402b4e,_0x3f6c75){_0x3f6c75=_0x3f6c75||0x1f4;return function(_0x51d793){logger['error'](_0x51d793[_0x67c1('0x22')]);if(_0x51d793[_0x67c1('0x20')]){delete _0x51d793[_0x67c1('0x20')];}_0x402b4e[_0x67c1('0xa')](_0x3f6c75)[_0x67c1('0x23')](_0x51d793);};}exports[_0x67c1('0x24')]=function(_0x105d4f,_0x3bbd72){var _0x137697={},_0x30c8d8={},_0x1fd294={'count':0x0,'rows':[]};var _0x356b0c=_[_0x67c1('0x25')](db['VoiceExtension'][_0x67c1('0x26')],function(_0x35de66){return{'name':_0x35de66[_0x67c1('0x27')],'type':_0x35de66[_0x67c1('0x1e')]['key']};});_0x30c8d8[_0x67c1('0x28')]=_[_0x67c1('0x25')](_0x356b0c,_0x67c1('0x20'));_0x30c8d8['query']=_[_0x67c1('0x29')](_0x105d4f['query']);_0x30c8d8['filters']=_[_0x67c1('0x2a')](_0x30c8d8[_0x67c1('0x28')],_0x30c8d8['query']);_0x137697[_0x67c1('0x2b')]=_[_0x67c1('0x2a')](_0x30c8d8['model'],qs[_0x67c1('0x2c')](_0x105d4f[_0x67c1('0x2d')][_0x67c1('0x2c')]));_0x137697[_0x67c1('0x2b')]=_0x137697[_0x67c1('0x2b')][_0x67c1('0x2e')]?_0x137697[_0x67c1('0x2b')]:_0x30c8d8[_0x67c1('0x28')];if(!_0x105d4f['query'][_0x67c1('0x2f')](_0x67c1('0x30'))){_0x137697[_0x67c1('0xc')]=qs[_0x67c1('0xc')](_0x105d4f[_0x67c1('0x2d')][_0x67c1('0xc')]);_0x137697['offset']=qs[_0x67c1('0xe')](_0x105d4f[_0x67c1('0x2d')][_0x67c1('0xe')]);}_0x137697[_0x67c1('0x31')]=qs['sort'](_0x105d4f[_0x67c1('0x2d')][_0x67c1('0x32')]);_0x137697[_0x67c1('0x33')]=qs[_0x67c1('0x34')](_['pick'](_0x105d4f[_0x67c1('0x2d')],_0x30c8d8['filters']),_0x356b0c);if(_0x105d4f[_0x67c1('0x2d')]['filter']){_0x137697[_0x67c1('0x33')]=_['merge'](_0x137697[_0x67c1('0x33')],{'$or':_['map'](_0x356b0c,function(_0x28ef1e){if(_0x28ef1e[_0x67c1('0x1e')]!=='VIRTUAL'){var _0x47571e={};_0x47571e[_0x28ef1e[_0x67c1('0x20')]]={'$like':'%'+_0x105d4f[_0x67c1('0x2d')][_0x67c1('0x1a')]+'%'};return _0x47571e;}})});}_0x137697=_[_0x67c1('0x35')]({},_0x137697,_0x105d4f[_0x67c1('0x36')]);var _0x6dbbbd={'where':_0x137697[_0x67c1('0x33')]};return db[_0x67c1('0x37')][_0x67c1('0xf')](_0x6dbbbd)['then'](function(_0xe3989e){_0x1fd294[_0x67c1('0xf')]=_0xe3989e;if(_0x105d4f[_0x67c1('0x2d')][_0x67c1('0x38')]){_0x137697[_0x67c1('0x39')]=[{'all':!![]}];}return db[_0x67c1('0x37')]['findAll'](_0x137697);})['then'](function(_0x5debba){_0x1fd294[_0x67c1('0x3a')]=_0x5debba;return _0x1fd294;})[_0x67c1('0x13')](respondWithFilteredResult(_0x3bbd72,_0x137697))['catch'](handleError(_0x3bbd72,null));};exports[_0x67c1('0x3b')]=function(_0x194d65,_0x488286){var _0x28d316={'raw':![],'where':{'id':_0x194d65[_0x67c1('0x3c')]['id']}},_0x11701a={};_0x11701a[_0x67c1('0x28')]=_[_0x67c1('0x29')](db[_0x67c1('0x37')][_0x67c1('0x26')]);_0x11701a[_0x67c1('0x2d')]=_[_0x67c1('0x29')](_0x194d65[_0x67c1('0x2d')]);_0x11701a[_0x67c1('0x34')]=_[_0x67c1('0x2a')](_0x11701a[_0x67c1('0x28')],_0x11701a[_0x67c1('0x2d')]);_0x28d316['attributes']=_[_0x67c1('0x2a')](_0x11701a[_0x67c1('0x28')],qs['fields'](_0x194d65[_0x67c1('0x2d')][_0x67c1('0x2c')]));_0x28d316[_0x67c1('0x2b')]=_0x28d316[_0x67c1('0x2b')]['length']?_0x28d316[_0x67c1('0x2b')]:_0x11701a[_0x67c1('0x28')];if(_0x194d65['query']['includeAll']){_0x28d316[_0x67c1('0x39')]=[{'all':!![]}];}_0x28d316=_[_0x67c1('0x35')]({},_0x28d316,_0x194d65[_0x67c1('0x36')]);return db[_0x67c1('0x37')][_0x67c1('0x1f')](_0x28d316)[_0x67c1('0x13')](handleEntityNotFound(_0x488286,null))[_0x67c1('0x13')](respondWithResult(_0x488286,null))[_0x67c1('0x3d')](handleError(_0x488286,null));};exports[_0x67c1('0x12')]=function(_0x26a9df,_0x27dea2){return db[_0x67c1('0x37')][_0x67c1('0x1f')]({'where':{'id':_0x26a9df['params']['id']}})[_0x67c1('0x13')](handleEntityNotFound(_0x27dea2,null))[_0x67c1('0x13')](removeEntity(_0x27dea2,null))[_0x67c1('0x3d')](handleError(_0x27dea2,null));};exports[_0x67c1('0x3e')]=function(_0x19b346,_0x19ad8b){if(_0x19b346['body']['type']===_0x67c1('0x17')&&!_[_0x67c1('0x3f')](_0x19b346['body']['exten'],'_')){_0x19b346[_0x67c1('0x40')]['exten']='_'[_0x67c1('0x41')](_0x19b346['body'][_0x67c1('0x42')]);}return db[_0x67c1('0x37')][_0x67c1('0x3e')](_0x19b346[_0x67c1('0x40')],{'raw':![]})[_0x67c1('0x13')](function(_0x204e42){var _0x3fbe8a=_0x19b346[_0x67c1('0x43')]['get']({'plain':!![]});if(!_0x3fbe8a)throw new Error(_0x67c1('0x44'));if(_0x3fbe8a['role']===_0x67c1('0x43')){var _0x4aced7=_0x204e42['get']({'plain':!![]});var _0x363575=[{'name':_0x67c1('0x15'),'value':'inbound'},{'name':_0x67c1('0x16'),'value':_0x67c1('0x17')},{'name':'InternalRoutes','value':_0x67c1('0x19')}];var _0x3d84f6=_[_0x67c1('0x1f')](_0x363575,[_0x67c1('0x1c'),_0x4aced7[_0x67c1('0x1e')]])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x3d84f6,'userProfileId':_0x3fbe8a[_0x67c1('0x45')]},'raw':!![]})[_0x67c1('0x13')](function(_0x5718f3){if(_0x5718f3&&_0x5718f3[_0x67c1('0x46')]===0x0){return db[_0x67c1('0x21')][_0x67c1('0x3e')]({'name':_0x4aced7[_0x67c1('0x20')],'resourceId':_0x4aced7['id'],'type':_0x5718f3[_0x67c1('0x20')],'sectionId':_0x5718f3['id']},{})[_0x67c1('0x13')](function(){return _0x204e42;});}else{return _0x204e42;}})[_0x67c1('0x3d')](function(_0x556157){logger['error'](_0x67c1('0x47'),_0x556157);throw _0x556157;});}return _0x204e42;})['then'](respondWithResult(_0x19ad8b,0xc9))[_0x67c1('0x3d')](handleError(_0x19ad8b,null));};exports[_0x67c1('0x48')]=function(_0x28d339,_0x455a8a){if(_0x28d339[_0x67c1('0x40')]['id']){delete _0x28d339['body']['id'];}return db['VoiceExtension'][_0x67c1('0x1f')]({'where':{'id':_0x28d339[_0x67c1('0x3c')]['id']}})['then'](handleEntityNotFound(_0x455a8a,null))[_0x67c1('0x13')](function(_0x283ba1){if(_0x283ba1){return db[_0x67c1('0x37')][_0x67c1('0x48')](_[_0x67c1('0x49')](_0x28d339[_0x67c1('0x40')],[_0x67c1('0x42'),'context',_0x67c1('0x4a'),'recordingFormat',_0x67c1('0x4b'),_0x67c1('0x4c'),_0x67c1('0x4d')]),{'where':{'context':_0x283ba1['context'],'exten':_0x283ba1[_0x67c1('0x42')]},'individualHooks':!![]})[_0x67c1('0x13')](function(_0x58483e){return _0x58483e;});}return null;})['then'](respondWithStatusCode(_0x455a8a,null))[_0x67c1('0x3d')](handleError(_0x455a8a,null));};exports['addApplications']=function(_0x642b60,_0x42ee1d){var _0x380308=_0x642b60[_0x67c1('0x3c')]['id'];var _0x31ccc3=_0x642b60[_0x67c1('0x40')];var _0x502a7d=0xc8;var _0x241970=null;return db[_0x67c1('0x4e')][_0x67c1('0x4f')]({'isolationLevel':db[_0x67c1('0x4e')][_0x67c1('0x50')][_0x67c1('0x51')][_0x67c1('0x52')]},function(_0x153858){return db[_0x67c1('0x37')][_0x67c1('0x53')]({'where':{'id':_0x380308},'transaction':_0x153858})[_0x67c1('0x13')](function(_0x4dc441){if(_0x4dc441){return db[_0x67c1('0x37')]['destroy']({'where':{'VoiceExtensionId':_0x380308},'transaction':_0x153858})[_0x67c1('0x13')](function(){var _0x362e4b=_[_0x67c1('0x25')](_0x31ccc3,function(_0x1e28f2){_0x1e28f2[_0x67c1('0x54')]=_0x380308;_0x1e28f2[_0x67c1('0x55')]=!![];return _0x1e28f2;});return _0x4dc441['createRouting'](_0x362e4b);})[_0x67c1('0x13')](function(_0x570b27){return db[_0x67c1('0x37')]['bulkCreate'](_0x570b27,{'transaction':_0x153858});});}else{_0x502a7d=0x194;_0x241970=[];}});})['then'](function(){if(_0x502a7d!==0x194){return db['VoiceExtension'][_0x67c1('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x380308},'order':_0x67c1('0x57')})['then'](function(_0x398af1){_0x241970=_0x398af1;});}})[_0x67c1('0x3d')](function(_0x5910b2){_0x502a7d=0x1f4;logger['error'](_0x5910b2[_0x67c1('0x22')]);if(_0x5910b2['name']){delete _0x5910b2[_0x67c1('0x20')];}_0x241970=_0x5910b2;})['finally'](function(){if(_0x241970===null){_0x42ee1d['sendStatus'](_0x502a7d);}else{if(_0x502a7d===0x1f4){_0x42ee1d['status'](_0x502a7d)[_0x67c1('0x23')](_0x241970);}else{_0x42ee1d['status'](_0x502a7d)['json'](_0x241970);}}});}; \ No newline at end of file +var _0x62f8=['outbound','InternalRoutes','internal','filter','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','where','VIRTUAL','options','VoiceExtension','includeAll','findAll','rows','show','params','length','merge','catch','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','inbound','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','mandatoryDisposition','alias','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','findAndCountAll','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./voiceExtension.socket','sendStatus','end','status','json','offset','limit','count','set','Content-Range','destroy','then','get','OutboundRoutes'];(function(_0x5100b3,_0x1d77d9){var _0x30e50f=function(_0x38423f){while(--_0x38423f){_0x5100b3['push'](_0x5100b3['shift']());}};_0x30e50f(++_0x1d77d9);}(_0x62f8,0xed));var _0x862f=function(_0xc98d43,_0x52fd9f){_0xc98d43=_0xc98d43-0x0;var _0x299c3e=_0x62f8[_0xc98d43];return _0x299c3e;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x862f('0x0'));var logger=require(_0x862f('0x1'))(_0x862f('0x2'));var config=require(_0x862f('0x3'));var db=require('../../mysqldb')['db'];config[_0x862f('0x4')]=_[_0x862f('0x5')](config[_0x862f('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x862f('0x6'))(new Redis(config[_0x862f('0x4')]));require(_0x862f('0x7'))['register'](socket);function respondWithStatusCode(_0x4bd3d0,_0x4fcb55){_0x4fcb55=_0x4fcb55||0xcc;return function(_0x4b8345){if(_0x4b8345){return _0x4bd3d0[_0x862f('0x8')](_0x4fcb55);}return _0x4bd3d0['status'](_0x4fcb55)[_0x862f('0x9')]();};}function respondWithResult(_0x3e68e1,_0xc7e981){_0xc7e981=_0xc7e981||0xc8;return function(_0x12c6d8){if(_0x12c6d8){return _0x3e68e1[_0x862f('0xa')](_0xc7e981)[_0x862f('0xb')](_0x12c6d8);}};}function respondWithFilteredResult(_0x2710f4,_0x2e8a14){return function(_0x657dbd){if(_0x657dbd){var _0x31c02a=typeof _0x2e8a14[_0x862f('0xc')]==='undefined'&&typeof _0x2e8a14[_0x862f('0xd')]==='undefined';var _0x1a87e4=_0x657dbd[_0x862f('0xe')];var _0x44ea6f=_0x31c02a?0x0:_0x2e8a14[_0x862f('0xc')];var _0x283f31=_0x31c02a?_0x657dbd[_0x862f('0xe')]:_0x2e8a14[_0x862f('0xc')]+_0x2e8a14['limit'];var _0x1b9a89;if(_0x283f31>=_0x1a87e4){_0x283f31=_0x1a87e4;_0x1b9a89=0xc8;}else{_0x1b9a89=0xce;}_0x2710f4[_0x862f('0xa')](_0x1b9a89);return _0x2710f4[_0x862f('0xf')](_0x862f('0x10'),_0x44ea6f+'-'+_0x283f31+'/'+_0x1a87e4)[_0x862f('0xb')](_0x657dbd);}return null;};}function removeEntity(_0x450a71){return function(_0x1f6738){if(_0x1f6738){return _0x1f6738[_0x862f('0x11')]()[_0x862f('0x12')](function(){var _0x2bced0=_0x1f6738[_0x862f('0x13')]({'plain':!![]});var _0x575d08=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x862f('0x14'),'value':_0x862f('0x15'),'ignore':![]},{'name':_0x862f('0x16'),'value':_0x862f('0x17'),'ignore':![]}];var _0x1cfdc7=_(_0x575d08)[_0x862f('0x18')]('ignore')[_0x862f('0x19')](_0x862f('0x1a'))[_0x862f('0x1a')]();if(_[_0x862f('0x1b')](_0x1cfdc7,_0x2bced0[_0x862f('0x1c')])){return;}var _0x2ee328=_[_0x862f('0x1d')](_0x575d08,[_0x862f('0x1a'),_0x2bced0[_0x862f('0x1c')]])[_0x862f('0x1e')];return db[_0x862f('0x1f')][_0x862f('0x11')]({'where':{'type':_0x2ee328,'resourceId':_0x2bced0['id']}})[_0x862f('0x12')](function(){return _0x1f6738;});})[_0x862f('0x12')](function(){_0x450a71['status'](0xcc)[_0x862f('0x9')]();});}};}function handleEntityNotFound(_0x1054d9){return function(_0x3ed3c2){if(!_0x3ed3c2){_0x1054d9[_0x862f('0x8')](0x194);}return _0x3ed3c2;};}function handleError(_0x219196,_0x2ad07e){_0x2ad07e=_0x2ad07e||0x1f4;return function(_0x56a4ba){logger[_0x862f('0x20')](_0x56a4ba[_0x862f('0x21')]);if(_0x56a4ba[_0x862f('0x1e')]){delete _0x56a4ba['name'];}_0x219196[_0x862f('0xa')](_0x2ad07e)[_0x862f('0x22')](_0x56a4ba);};}exports[_0x862f('0x23')]=function(_0x1ac532,_0x1e44f2){var _0x52edbb={},_0x19518e={},_0x62ce89={'count':0x0,'rows':[]};var _0x2da630=_[_0x862f('0x19')](db['VoiceExtension'][_0x862f('0x24')],function(_0x135267){return{'name':_0x135267[_0x862f('0x25')],'type':_0x135267[_0x862f('0x1c')][_0x862f('0x26')]};});_0x19518e['model']=_['map'](_0x2da630,_0x862f('0x1e'));_0x19518e[_0x862f('0x27')]=_[_0x862f('0x28')](_0x1ac532[_0x862f('0x27')]);_0x19518e['filters']=_[_0x862f('0x29')](_0x19518e[_0x862f('0x2a')],_0x19518e[_0x862f('0x27')]);_0x52edbb[_0x862f('0x2b')]=_[_0x862f('0x29')](_0x19518e[_0x862f('0x2a')],qs[_0x862f('0x2c')](_0x1ac532[_0x862f('0x27')][_0x862f('0x2c')]));_0x52edbb['attributes']=_0x52edbb[_0x862f('0x2b')]['length']?_0x52edbb[_0x862f('0x2b')]:_0x19518e[_0x862f('0x2a')];if(!_0x1ac532['query'][_0x862f('0x2d')](_0x862f('0x2e'))){_0x52edbb[_0x862f('0xd')]=qs['limit'](_0x1ac532['query'][_0x862f('0xd')]);_0x52edbb[_0x862f('0xc')]=qs[_0x862f('0xc')](_0x1ac532[_0x862f('0x27')]['offset']);}_0x52edbb['order']=qs[_0x862f('0x2f')](_0x1ac532['query'][_0x862f('0x2f')]);_0x52edbb['where']=qs[_0x862f('0x30')](_[_0x862f('0x31')](_0x1ac532[_0x862f('0x27')],_0x19518e[_0x862f('0x30')]),_0x2da630);if(_0x1ac532[_0x862f('0x27')][_0x862f('0x18')]){_0x52edbb[_0x862f('0x32')]=_['merge'](_0x52edbb[_0x862f('0x32')],{'$or':_[_0x862f('0x19')](_0x2da630,function(_0x57b0d8){if(_0x57b0d8['type']!==_0x862f('0x33')){var _0xa7158a={};_0xa7158a[_0x57b0d8[_0x862f('0x1e')]]={'$like':'%'+_0x1ac532[_0x862f('0x27')]['filter']+'%'};return _0xa7158a;}})});}_0x52edbb=_['merge']({},_0x52edbb,_0x1ac532[_0x862f('0x34')]);var _0x2bd268={'where':_0x52edbb[_0x862f('0x32')]};return db[_0x862f('0x35')][_0x862f('0xe')](_0x2bd268)[_0x862f('0x12')](function(_0x510844){_0x62ce89[_0x862f('0xe')]=_0x510844;if(_0x1ac532[_0x862f('0x27')][_0x862f('0x36')]){_0x52edbb['include']=[{'all':!![]}];}return db[_0x862f('0x35')][_0x862f('0x37')](_0x52edbb);})['then'](function(_0x6130ed){_0x62ce89[_0x862f('0x38')]=_0x6130ed;return _0x62ce89;})['then'](respondWithFilteredResult(_0x1e44f2,_0x52edbb))['catch'](handleError(_0x1e44f2,null));};exports[_0x862f('0x39')]=function(_0x1fd8ba,_0x929c4){var _0x3d9340={'raw':![],'where':{'id':_0x1fd8ba[_0x862f('0x3a')]['id']}},_0x2370c9={};_0x2370c9[_0x862f('0x2a')]=_['keys'](db[_0x862f('0x35')]['rawAttributes']);_0x2370c9[_0x862f('0x27')]=_[_0x862f('0x28')](_0x1fd8ba[_0x862f('0x27')]);_0x2370c9[_0x862f('0x30')]=_[_0x862f('0x29')](_0x2370c9['model'],_0x2370c9[_0x862f('0x27')]);_0x3d9340[_0x862f('0x2b')]=_[_0x862f('0x29')](_0x2370c9['model'],qs[_0x862f('0x2c')](_0x1fd8ba[_0x862f('0x27')][_0x862f('0x2c')]));_0x3d9340[_0x862f('0x2b')]=_0x3d9340[_0x862f('0x2b')][_0x862f('0x3b')]?_0x3d9340['attributes']:_0x2370c9[_0x862f('0x2a')];if(_0x1fd8ba[_0x862f('0x27')][_0x862f('0x36')]){_0x3d9340['include']=[{'all':!![]}];}_0x3d9340=_[_0x862f('0x3c')]({},_0x3d9340,_0x1fd8ba[_0x862f('0x34')]);return db[_0x862f('0x35')][_0x862f('0x1d')](_0x3d9340)['then'](handleEntityNotFound(_0x929c4,null))[_0x862f('0x12')](respondWithResult(_0x929c4,null))[_0x862f('0x3d')](handleError(_0x929c4,null));};exports['destroy']=function(_0x2e51dd,_0x2078cb){return db[_0x862f('0x35')][_0x862f('0x1d')]({'where':{'id':_0x2e51dd['params']['id']}})[_0x862f('0x12')](handleEntityNotFound(_0x2078cb,null))[_0x862f('0x12')](removeEntity(_0x2078cb,null))['catch'](handleError(_0x2078cb,null));};exports[_0x862f('0x3e')]=function(_0x1dd065,_0x2e327c){if(_0x1dd065[_0x862f('0x3f')][_0x862f('0x1c')]===_0x862f('0x15')&&!_['startsWith'](_0x1dd065[_0x862f('0x3f')]['exten'],'_')){_0x1dd065[_0x862f('0x3f')][_0x862f('0x40')]='_'[_0x862f('0x41')](_0x1dd065[_0x862f('0x3f')][_0x862f('0x40')]);}return db[_0x862f('0x35')][_0x862f('0x3e')](_0x1dd065[_0x862f('0x3f')],{'raw':![]})[_0x862f('0x12')](function(_0x53aff5){var _0x1a484c=_0x1dd065[_0x862f('0x42')][_0x862f('0x13')]({'plain':!![]});if(!_0x1a484c)throw new Error(_0x862f('0x43'));if(_0x1a484c[_0x862f('0x44')]===_0x862f('0x42')){var _0x47bc01=_0x53aff5[_0x862f('0x13')]({'plain':!![]});var _0x218098=[{'name':_0x862f('0x45'),'value':_0x862f('0x46')},{'name':_0x862f('0x14'),'value':'outbound'},{'name':_0x862f('0x16'),'value':_0x862f('0x17')}];var _0x50a38e=_[_0x862f('0x1d')](_0x218098,[_0x862f('0x1a'),_0x47bc01[_0x862f('0x1c')]])[_0x862f('0x1e')];return db[_0x862f('0x47')][_0x862f('0x1d')]({'where':{'name':_0x50a38e,'userProfileId':_0x1a484c['userProfileId']},'raw':!![]})[_0x862f('0x12')](function(_0xad5481){if(_0xad5481&&_0xad5481['autoAssociation']===0x0){return db['UserProfileResource'][_0x862f('0x3e')]({'name':_0x47bc01[_0x862f('0x1e')],'resourceId':_0x47bc01['id'],'type':_0xad5481[_0x862f('0x1e')],'sectionId':_0xad5481['id']},{})[_0x862f('0x12')](function(){return _0x53aff5;});}else{return _0x53aff5;}})[_0x862f('0x3d')](function(_0x3b5903){logger['error'](_0x862f('0x48'),_0x3b5903);throw _0x3b5903;});}return _0x53aff5;})[_0x862f('0x12')](respondWithResult(_0x2e327c,0xc9))['catch'](handleError(_0x2e327c,null));};exports[_0x862f('0x49')]=function(_0x2024e3,_0x452a41){if(_0x2024e3[_0x862f('0x3f')]['id']){delete _0x2024e3[_0x862f('0x3f')]['id'];}return db['VoiceExtension'][_0x862f('0x1d')]({'where':{'id':_0x2024e3['params']['id']}})[_0x862f('0x12')](handleEntityNotFound(_0x452a41,null))[_0x862f('0x12')](function(_0x2de32b){if(_0x2de32b){return db['VoiceExtension'][_0x862f('0x49')](_['pick'](_0x2024e3['body'],[_0x862f('0x40'),_0x862f('0x4a'),'description',_0x862f('0x4b'),'cutdigits',_0x862f('0x4c'),_0x862f('0x4d')]),{'where':{'context':_0x2de32b[_0x862f('0x4a')],'exten':_0x2de32b[_0x862f('0x40')]},'individualHooks':!![]})['then'](function(_0x9203d3){return _0x9203d3;});}return null;})[_0x862f('0x12')](respondWithStatusCode(_0x452a41,null))[_0x862f('0x3d')](handleError(_0x452a41,null));};exports['addApplications']=function(_0x14f751,_0x514ebb){var _0x415350=_0x14f751[_0x862f('0x3a')]['id'];var _0x39ba13=_0x14f751[_0x862f('0x3f')];var _0x4ed491=0xc8;var _0x33c77a=null;return db[_0x862f('0x4e')]['transaction']({'isolationLevel':db[_0x862f('0x4e')][_0x862f('0x4f')][_0x862f('0x50')][_0x862f('0x51')]},function(_0xee9165){return db[_0x862f('0x35')][_0x862f('0x52')]({'where':{'id':_0x415350},'transaction':_0xee9165})[_0x862f('0x12')](function(_0x40bfeb){if(_0x40bfeb){return db['VoiceExtension'][_0x862f('0x11')]({'where':{'VoiceExtensionId':_0x415350},'transaction':_0xee9165})[_0x862f('0x12')](function(){var _0x1a9363=_[_0x862f('0x19')](_0x39ba13,function(_0x36087f){_0x36087f[_0x862f('0x53')]=_0x415350;_0x36087f['isApp']=!![];return _0x36087f;});return _0x40bfeb[_0x862f('0x54')](_0x1a9363);})[_0x862f('0x12')](function(_0x42197e){return db['VoiceExtension']['bulkCreate'](_0x42197e,{'transaction':_0xee9165});});}else{_0x4ed491=0x194;_0x33c77a=[];}});})[_0x862f('0x12')](function(){if(_0x4ed491!==0x194){return db[_0x862f('0x35')][_0x862f('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x415350},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x3bd357){_0x33c77a=_0x3bd357;});}})[_0x862f('0x3d')](function(_0x42a386){_0x4ed491=0x1f4;logger[_0x862f('0x20')](_0x42a386[_0x862f('0x21')]);if(_0x42a386[_0x862f('0x1e')]){delete _0x42a386[_0x862f('0x1e')];}_0x33c77a=_0x42a386;})['finally'](function(){if(_0x33c77a===null){_0x514ebb['sendStatus'](_0x4ed491);}else{if(_0x4ed491===0x1f4){_0x514ebb['status'](_0x4ed491)[_0x862f('0x22')](_0x33c77a);}else{_0x514ebb[_0x862f('0xa')](_0x4ed491)[_0x862f('0xb')](_0x33c77a);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 73a43e9..30b3fcf 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 _0x93dc=['remove','emit','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x357702,_0x203968){var _0x4dd94a=function(_0x11bc16){while(--_0x11bc16){_0x357702['push'](_0x357702['shift']());}};_0x4dd94a(++_0x203968);}(_0x93dc,0xb3));var _0xc93d=function(_0x442ff9,_0x2bb6f2){_0x442ff9=_0x442ff9-0x0;var _0x13268b=_0x93dc[_0x442ff9];return _0x13268b;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xc93d('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xc93d('0x1')](0x0);var events={'afterCreate':_0xc93d('0x2'),'afterUpdate':'update','afterDestroy':_0xc93d('0x3')};function emitEvent(_0x1e63cc){return function(_0x4f1764,_0x150ff4,_0x4854a4){VoiceExtensionEvents[_0xc93d('0x4')](_0x1e63cc+':'+_0x4f1764['id'],_0x4f1764);VoiceExtensionEvents[_0xc93d('0x4')](_0x1e63cc,_0x4f1764);_0x4854a4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xc93d('0x5')](e,emitEvent(event));}}module[_0xc93d('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x6209=['hasOwnProperty','hook','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit'];(function(_0x4d2ef6,_0x828659){var _0xff411f=function(_0xf9334f){while(--_0xf9334f){_0x4d2ef6['push'](_0x4d2ef6['shift']());}};_0xff411f(++_0x828659);}(_0x6209,0x138));var _0x9620=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6209[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0x9620('0x0'));var VoiceExtension=require(_0x9620('0x1'))['db'][_0x9620('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9620('0x3')](0x0);var events={'afterCreate':_0x9620('0x4'),'afterUpdate':_0x9620('0x5'),'afterDestroy':_0x9620('0x6')};function emitEvent(_0x5baa5c){return function(_0x1a5bff,_0x2a913b,_0x2f0340){VoiceExtensionEvents[_0x9620('0x7')](_0x5baa5c+':'+_0x1a5bff['id'],_0x1a5bff);VoiceExtensionEvents[_0x9620('0x7')](_0x5baa5c,_0x1a5bff);_0x2f0340(null);};}for(var e in events){if(events[_0x9620('0x8')](e)){var event=events[e];VoiceExtension[_0x9620('0x9')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index c3c9043..19b630c 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 _0x4c60=['recordingFormat','none','push','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','timeout','options','split','trunk','param','phone','prefix','SIP','join','U(xcally-mixmonitor-context)','isEmpty','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter','toLowerCase','tag','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','appdata','priority','last','concat','catch','define','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','context','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','outbound','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty'];(function(_0x11cb58,_0x5cfd33){var _0x32bd37=function(_0x5ac844){while(--_0x5ac844){_0x11cb58['push'](_0x11cb58['shift']());}};_0x32bd37(++_0x5cfd33);}(_0x4c60,0x166));var _0x04c6=function(_0x1d6489,_0xc208ed){_0x1d6489=_0x1d6489-0x0;var _0x511733=_0x4c60[_0x1d6489];return _0x511733;};'use strict';var _=require(_0x04c6('0x0'));var attributes=require(_0x04c6('0x1'));module[_0x04c6('0x2')]=function(_0x39b86c){var _0x4fa03c=_0x39b86c[_0x04c6('0x3')];function _0x59028f(_0x5ec39d){var _0xe2e1d7=0x2;var _0xbfdbd0=[{'type':_0x5ec39d[_0x04c6('0x4')],'app':_0x04c6('0x5'),'appdata':'CDR(type)='+_0x5ec39d[_0x04c6('0x4')],'context':_0x5ec39d[_0x04c6('0x6')],'exten':_0x5ec39d[_0x04c6('0x7')],'priority':_0xe2e1d7++,'VoiceExtensionId':_0x5ec39d['id']},{'type':_0x5ec39d[_0x04c6('0x4')],'app':_0x5ec39d[_0x04c6('0x8')]?_0x04c6('0x5'):'NoOp','appdata':_0x5ec39d[_0x04c6('0x8')]?_0x04c6('0x9')+_0x5ec39d[_0x04c6('0x8')]:_0x04c6('0xa'),'context':_0x5ec39d[_0x04c6('0x6')],'exten':_0x5ec39d['exten'],'priority':_0xe2e1d7++,'VoiceExtensionId':_0x5ec39d['id']}];if(_0x5ec39d[_0x04c6('0x4')]===_0x04c6('0xb')){_0xbfdbd0['push']({'type':_0x04c6('0xb'),'app':_0x04c6('0x5'),'appdata':_0x04c6('0xc')+_0x5ec39d['id'],'context':_0x5ec39d[_0x04c6('0x6')],'exten':_0x5ec39d[_0x04c6('0x7')],'priority':_0xe2e1d7++,'VoiceExtensionId':_0x5ec39d['id']});}_0xbfdbd0['push']({'type':_0x5ec39d[_0x04c6('0x4')],'app':_0x04c6('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5ec39d[_0x04c6('0x6')],'exten':_0x5ec39d[_0x04c6('0x7')],'priority':_0xe2e1d7++,'VoiceExtensionId':_0x5ec39d['id']},{'type':_0x5ec39d['type'],'app':'Set','appdata':_0x04c6('0xd'),'context':_0x5ec39d[_0x04c6('0x6')],'exten':_0x5ec39d[_0x04c6('0x7')],'priority':_0xe2e1d7++,'VoiceExtensionId':_0x5ec39d['id']},{'type':_0x5ec39d['type'],'app':_0x04c6('0x5'),'appdata':_0x04c6('0xe'),'context':_0x5ec39d[_0x04c6('0x6')],'exten':_0x5ec39d['exten'],'priority':_0xe2e1d7++,'VoiceExtensionId':_0x5ec39d['id']});return _0xbfdbd0;}function _0x25bafd(_0x4e226c){var _0x37cf3c=0x2;var _0x292a9f=[{'type':'outbound','app':_0x04c6('0x5'),'appdata':'CDR(type)=outbound','context':_0x4e226c['context'],'exten':_0x4e226c[_0x04c6('0x7')],'priority':_0x37cf3c++,'VoiceExtensionId':_0x4e226c['id']},{'type':'outbound','app':_0x4e226c['alias']?_0x04c6('0x5'):'NoOp','appdata':_0x4e226c[_0x04c6('0x8')]?_0x04c6('0x9')+_0x4e226c[_0x04c6('0x8')]:_0x04c6('0xa'),'context':_0x4e226c[_0x04c6('0x6')],'exten':_0x4e226c[_0x04c6('0x7')],'priority':_0x37cf3c++,'VoiceExtensionId':_0x4e226c['id']},{'type':'outbound','app':_0x04c6('0x5'),'appdata':_0x04c6('0xf')+(_0x4e226c['cutdigits']?_0x04c6('0x10')+_0x4e226c[_0x04c6('0x11')]+'}':_0x04c6('0x12')),'context':_0x4e226c['context'],'exten':_0x4e226c[_0x04c6('0x7')],'priority':_0x37cf3c++,'VoiceExtensionId':_0x4e226c['id']},{'type':_0x04c6('0x13'),'app':'Set','appdata':_0x04c6('0xc')+_0x4e226c['id'],'context':_0x4e226c[_0x04c6('0x6')],'exten':_0x4e226c[_0x04c6('0x7')],'priority':_0x37cf3c++,'VoiceExtensionId':_0x4e226c['id']},{'type':_0x04c6('0x13'),'app':_0x04c6('0x14'),'appdata':_0x04c6('0x15')+(_0x37cf3c+0x2)+_0x04c6('0x16')+(_0x37cf3c+0x1)+')','context':_0x4e226c[_0x04c6('0x6')],'exten':_0x4e226c['exten'],'priority':_0x37cf3c++,'VoiceExtensionId':_0x4e226c['id']},{'type':_0x04c6('0x13'),'app':_0x04c6('0x5'),'appdata':_0x4e226c[_0x04c6('0x11')]?'CDR(prefix)=${EXTEN:0:'+_0x4e226c['cutdigits']+'}':_0x04c6('0x17'),'context':_0x4e226c['context'],'exten':_0x4e226c[_0x04c6('0x7')],'priority':_0x37cf3c++,'VoiceExtensionId':_0x4e226c['id']},{'type':_0x04c6('0x13'),'app':_0x04c6('0x5'),'appdata':_0x04c6('0x18'),'context':_0x4e226c['context'],'exten':_0x4e226c[_0x04c6('0x7')],'priority':_0x37cf3c++,'VoiceExtensionId':_0x4e226c['id']},{'type':_0x04c6('0x13'),'app':_0x04c6('0x5'),'appdata':_0x04c6('0xd'),'context':_0x4e226c[_0x04c6('0x6')],'exten':_0x4e226c[_0x04c6('0x7')],'priority':_0x37cf3c++,'VoiceExtensionId':_0x4e226c['id']},{'type':_0x04c6('0x13'),'app':_0x04c6('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4e226c[_0x04c6('0x6')],'exten':_0x4e226c[_0x04c6('0x7')],'priority':_0x37cf3c++,'VoiceExtensionId':_0x4e226c['id']},{'type':_0x04c6('0x13'),'app':_0x04c6('0x5'),'appdata':_0x04c6('0x19')+_0x4e226c['id'],'context':_0x4e226c['context'],'exten':_0x4e226c[_0x04c6('0x7')],'priority':_0x37cf3c++,'VoiceExtensionId':_0x4e226c['id']}];if(_0x4e226c[_0x04c6('0x1a')](_0x04c6('0x1b'))&&_0x4e226c[_0x04c6('0x1b')]!==_0x04c6('0x1c')){_0x292a9f[_0x04c6('0x1d')]({'type':'outbound','app':_0x04c6('0x5'),'appdata':_0x04c6('0x1e'),'context':_0x4e226c[_0x04c6('0x6')],'exten':_0x4e226c[_0x04c6('0x7')],'priority':_0x37cf3c++,'VoiceExtensionId':_0x4e226c['id']},{'type':_0x04c6('0x13'),'app':_0x04c6('0x5'),'appdata':_0x04c6('0x1f')+_0x4e226c['recordingFormat']||'wav','context':_0x4e226c[_0x04c6('0x6')],'exten':_0x4e226c['exten'],'priority':_0x37cf3c++,'VoiceExtensionId':_0x4e226c['id']});}return _0x292a9f;}function _0x5bc9f8(_0x45ccab,_0x2ed0e5){var _0x31d801=[{'name':'trunk','param':0x0},{'name':_0x04c6('0x20'),'param':0x1},{'name':_0x04c6('0x21'),'param':0x2},{'name':'url','param':0x3}];var _0xbc83ac={};var _0x15a2d4=_0x2ed0e5[_0x04c6('0x22')](',');var _0x319277=[];for(var _0x259760=0x0;_0x259760<_0x31d801['length'];_0x259760++){switch(_0x31d801[_0x259760]['name']){case _0x04c6('0x23'):_0xbc83ac[_0x04c6('0x23')]=_0x15a2d4[_0x31d801[_0x259760][_0x04c6('0x24')]][_0x04c6('0x22')]('/')[0x1];_0xbc83ac[_0x04c6('0x25')]=_0x15a2d4[_0x31d801[_0x259760][_0x04c6('0x24')]][_0x04c6('0x22')]('/')[0x2];_0xbc83ac[_0x04c6('0x26')]=_0xbc83ac['phone']?_0xbc83ac[_0x04c6('0x25')][_0x04c6('0x22')]('$')[0x0]:undefined;_0xbc83ac['phone']=_0x45ccab[_0x04c6('0x11')]?(_0xbc83ac[_0x04c6('0x26')]||'')+'${EXTEN:'+_0x45ccab[_0x04c6('0x11')]+'}':(_0xbc83ac[_0x04c6('0x26')]||'')+'${EXTEN}';_0x319277[_0x31d801[_0x259760][_0x04c6('0x24')]]=[_0x04c6('0x27'),_0xbc83ac[_0x04c6('0x23')],_0xbc83ac[_0x04c6('0x25')]][_0x04c6('0x28')]('/');break;case _0x04c6('0x21'):_0xbc83ac[_0x04c6('0x21')]=_0x15a2d4[_0x31d801[_0x259760][_0x04c6('0x24')]];if(_0x45ccab[_0x04c6('0x1b')]!==_0x04c6('0x1c')){if(_0xbc83ac['options']['indexOf'](_0x04c6('0x29'))<0x0){_0xbc83ac[_0x04c6('0x21')]+=_0x04c6('0x29');}}else{_0xbc83ac[_0x04c6('0x21')]=_0xbc83ac[_0x04c6('0x21')]['replace'](_0x04c6('0x29'),'');}_0x319277[_0x31d801[_0x259760][_0x04c6('0x24')]]=_0xbc83ac[_0x04c6('0x21')];break;default:_0x319277[_0x31d801[_0x259760][_0x04c6('0x24')]]=_0x15a2d4[_0x31d801[_0x259760][_0x04c6('0x24')]];}}return _0x319277[_0x04c6('0x28')](',');}function _0x3f752b(_0x31915d,_0x5d9d8e,_0x50c078){return new Promise(function(_0x115797,_0x283d08){var _0x32ddb9=[];if(_[_0x04c6('0x2a')](_0x5d9d8e))return _0x115797(_0x32ddb9);_0x4fa03c['Interval'][_0x04c6('0x2b')]({'attributes':['id',_0x04c6('0x2c'),_0x04c6('0x2d')],'raw':!![]})[_0x04c6('0x2e')](function(_0x36ed4b){for(var _0x108b72=0x0,_0x3ac637=0x0;_0x108b72<_0x5d9d8e[_0x04c6('0x2f')];_0x108b72++,_0x3ac637=0x0){var _0x2eae4f=_0x5d9d8e[_0x108b72];var _0x495e43=[];var _0x312814=[];delete _0x2eae4f['id'];if(_0x2eae4f[_0x04c6('0x2c')]!==_0x04c6('0x30')){_0x2eae4f[_0x04c6('0x31')]=[_0x2eae4f['interval']];}else{_0x2eae4f[_0x04c6('0x31')]=_0x2eae4f[_0x04c6('0x2d')]?_[_0x04c6('0x32')](_[_0x04c6('0x33')](_0x36ed4b,{'IntervalId':_0x2eae4f[_0x04c6('0x2d')]}),_0x04c6('0x2c')):[];}_0x2eae4f[_0x04c6('0x6')]=_0x31915d['context'];_0x2eae4f[_0x04c6('0x7')]=_0x31915d[_0x04c6('0x7')];if(_0x2eae4f[_0x04c6('0x4')])_0x2eae4f[_0x04c6('0x4')]=_0x2eae4f[_0x04c6('0x4')][_0x04c6('0x34')]();if(_0x31915d['type']===_0x04c6('0x13')){if(_0x2eae4f['hasOwnProperty']('tag')&&_0x2eae4f[_0x04c6('0x35')]&&_0x2eae4f[_0x04c6('0x35')]!=='--'){_0x495e43[_0x04c6('0x1d')]({'type':_0x2eae4f['type'][_0x04c6('0x34')](),'app':_0x04c6('0x5'),'appdata':'CDR(tag)='+_0x2eae4f[_0x04c6('0x35')],'context':_0x31915d[_0x04c6('0x6')],'exten':_0x31915d[_0x04c6('0x7')],'priority':_0x2eae4f[_0x04c6('0x31')]['length']+_0x50c078+_0x3ac637++,'VoiceExtensionId':_0x31915d['id']});}_0x495e43['push']({'type':_0x2eae4f[_0x04c6('0x4')][_0x04c6('0x34')](),'app':_0x04c6('0x14'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x2eae4f['callerID']?_0x04c6('0x36')+_0x2eae4f['callerID']+')':_0x04c6('0x37')),'context':_0x31915d[_0x04c6('0x6')],'exten':_0x31915d[_0x04c6('0x7')],'priority':_0x2eae4f['intervals'][_0x04c6('0x2f')]+_0x50c078+_0x3ac637++,'VoiceExtensionId':_0x31915d['id']});}else{if(_0x2eae4f[_0x04c6('0x1a')](_0x04c6('0x38'))){if([_0x04c6('0x39'),_0x04c6('0x3a')][_0x04c6('0x3b')](_0x2eae4f[_0x04c6('0x3c')]['toLowerCase']())&&_0x2eae4f['appType']!==_0x04c6('0x3d')){if(_0x2eae4f[_0x04c6('0x38')]){_0x495e43['push']({'type':_0x2eae4f['type'][_0x04c6('0x34')](),'app':_0x04c6('0x14'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x31915d['context'],'exten':_0x31915d[_0x04c6('0x7')],'priority':_0x2eae4f[_0x04c6('0x31')][_0x04c6('0x2f')]+_0x50c078+_0x3ac637++,'VoiceExtensionId':_0x31915d['id']});_0x495e43[_0x04c6('0x1d')]({'type':_0x2eae4f[_0x04c6('0x4')]['toLowerCase'](),'app':_0x04c6('0x5'),'appdata':_0x04c6('0x3e'),'context':_0x31915d[_0x04c6('0x6')],'exten':_0x31915d[_0x04c6('0x7')],'priority':_0x2eae4f['intervals'][_0x04c6('0x2f')]+_0x50c078+_0x3ac637++,'VoiceExtensionId':_0x31915d['id']});}else{_0x495e43[_0x04c6('0x1d')]({'type':_0x2eae4f[_0x04c6('0x4')]['toLowerCase'](),'app':_0x04c6('0x14'),'appdata':_0x04c6('0x3f'),'context':_0x31915d[_0x04c6('0x6')],'exten':_0x31915d['exten'],'priority':_0x2eae4f[_0x04c6('0x31')][_0x04c6('0x2f')]+_0x50c078+_0x3ac637++,'VoiceExtensionId':_0x31915d['id']});_0x495e43['push']({'type':_0x2eae4f[_0x04c6('0x4')][_0x04c6('0x34')](),'app':_0x04c6('0x5'),'appdata':_0x04c6('0x40'),'context':_0x31915d[_0x04c6('0x6')],'exten':_0x31915d[_0x04c6('0x7')],'priority':_0x2eae4f[_0x04c6('0x31')][_0x04c6('0x2f')]+_0x50c078+_0x3ac637++,'VoiceExtensionId':_0x31915d['id']});}}}}for(var _0x523ba4=0x0;_0x523ba4<_0x2eae4f['intervals']['length'];_0x523ba4++){var _0x3b7e15=_0x50c078+_0x2eae4f[_0x04c6('0x31')]['length'];var _0x2a499e=_0x523ba4===_0x2eae4f['intervals'][_0x04c6('0x2f')]-0x1?_0x50c078+_0x495e43[_0x04c6('0x2f')]+_0x312814['length']+0x2:_0x50c078+_0x523ba4+0x1;_0x495e43['splice'](_0x523ba4,0x0,{'type':_0x31915d[_0x04c6('0x4')],'app':_0x04c6('0x41'),'appdata':_0x2eae4f[_0x04c6('0x31')][_0x523ba4]+'?'+_0x31915d[_0x04c6('0x6')]+_0x04c6('0x42')+_0x3b7e15+':'+_0x31915d['context']+_0x04c6('0x42')+_0x2a499e,'exten':_0x31915d[_0x04c6('0x7')],'context':_0x31915d[_0x04c6('0x6')],'priority':_0x50c078+_0x523ba4,'VoiceExtensionId':_0x31915d['id']});}if(_0x2eae4f[_0x04c6('0x43')]==='outboundDial')_0x2eae4f[_0x04c6('0x44')]=_0x5bc9f8(_0x31915d,_0x2eae4f['appdata']);_0x2eae4f[_0x04c6('0x45')]=_0x495e43[_0x04c6('0x2f')]?_[_0x04c6('0x46')](_0x495e43)['priority']+0x1:_0x50c078;_0x32ddb9=_[_0x04c6('0x47')](_0x32ddb9,_0x495e43,[_0x2eae4f],_0x312814);_0x50c078=_[_0x04c6('0x46')](_0x32ddb9)['priority']+0x1;}return _0x115797(_0x32ddb9);})[_0x04c6('0x48')](function(_0x22932c){_0x283d08(_0x22932c);});});}return _0x39b86c[_0x04c6('0x49')]('VoiceExtension',attributes,{'tableName':_0x04c6('0x4a'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x8ef055){var _0x3c7833=this[_0x04c6('0x4b')]({'plain':!![]});var _0x555e75=_0x3c7833[_0x04c6('0x4')]===_0x04c6('0x13')?_0x25bafd(_0x3c7833):_0x59028f(_0x3c7833);return _0x3f752b(_0x3c7833,_0x8ef055,_[_0x04c6('0x46')](_0x555e75)[_0x04c6('0x45')]+0x1)[_0x04c6('0x2e')](function(_0x28e0aa){var _0x5e2a46=_['concat'](_0x555e75,_0x28e0aa);_0x5e2a46[_0x04c6('0x1d')]({'type':_0x3c7833['type'],'app':_0x04c6('0x4c'),'exten':_0x3c7833[_0x04c6('0x7')],'context':_0x3c7833[_0x04c6('0x6')],'priority':_[_0x04c6('0x46')](_0x5e2a46)[_0x04c6('0x45')]+0x1,'VoiceExtensionId':_0x3c7833['id']});return _0x5e2a46;});}}});}; \ No newline at end of file +var _0x38ec=['Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','length','param','phone','prefix','${EXTEN:','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','then','interval','*,*,*,*','intervals','IntervalId','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','catch','get','concat'];(function(_0x580197,_0xbb7e10){var _0x54a754=function(_0x271e2b){while(--_0x271e2b){_0x580197['push'](_0x580197['shift']());}};_0x54a754(++_0xbb7e10);}(_0x38ec,0xfa));var _0xc38e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38ec[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xc38e('0x0'));var attributes=require(_0xc38e('0x1'));module[_0xc38e('0x2')]=function(_0x427553){var _0x3cc294=_0x427553[_0xc38e('0x3')];function _0x1a9bd5(_0x174c60){var _0x1279ae=0x2;var _0x586e1e=[{'type':_0x174c60[_0xc38e('0x4')],'app':_0xc38e('0x5'),'appdata':_0xc38e('0x6')+_0x174c60[_0xc38e('0x4')],'context':_0x174c60[_0xc38e('0x7')],'exten':_0x174c60[_0xc38e('0x8')],'priority':_0x1279ae++,'VoiceExtensionId':_0x174c60['id']},{'type':_0x174c60[_0xc38e('0x4')],'app':_0x174c60[_0xc38e('0x9')]?_0xc38e('0x5'):_0xc38e('0xa'),'appdata':_0x174c60['alias']?'CDR(routeAlias)='+_0x174c60[_0xc38e('0x9')]:_0xc38e('0xb'),'context':_0x174c60[_0xc38e('0x7')],'exten':_0x174c60[_0xc38e('0x8')],'priority':_0x1279ae++,'VoiceExtensionId':_0x174c60['id']}];if(_0x174c60['type']===_0xc38e('0xc')){_0x586e1e[_0xc38e('0xd')]({'type':'inbound','app':_0xc38e('0x5'),'appdata':'CDR(routeid)='+_0x174c60['id'],'context':_0x174c60['context'],'exten':_0x174c60[_0xc38e('0x8')],'priority':_0x1279ae++,'VoiceExtensionId':_0x174c60['id']});}_0x586e1e[_0xc38e('0xd')]({'type':_0x174c60[_0xc38e('0x4')],'app':_0xc38e('0x5'),'appdata':_0xc38e('0xe'),'context':_0x174c60[_0xc38e('0x7')],'exten':_0x174c60[_0xc38e('0x8')],'priority':_0x1279ae++,'VoiceExtensionId':_0x174c60['id']},{'type':_0x174c60[_0xc38e('0x4')],'app':'Set','appdata':_0xc38e('0xf'),'context':_0x174c60[_0xc38e('0x7')],'exten':_0x174c60['exten'],'priority':_0x1279ae++,'VoiceExtensionId':_0x174c60['id']},{'type':_0x174c60[_0xc38e('0x4')],'app':_0xc38e('0x5'),'appdata':_0xc38e('0x10'),'context':_0x174c60[_0xc38e('0x7')],'exten':_0x174c60['exten'],'priority':_0x1279ae++,'VoiceExtensionId':_0x174c60['id']});return _0x586e1e;}function _0xff5d13(_0x3efff7){var _0x38be21=0x2;var _0x3a8cd0=[{'type':_0xc38e('0x11'),'app':_0xc38e('0x5'),'appdata':_0xc38e('0x12'),'context':_0x3efff7[_0xc38e('0x7')],'exten':_0x3efff7[_0xc38e('0x8')],'priority':_0x38be21++,'VoiceExtensionId':_0x3efff7['id']},{'type':_0xc38e('0x11'),'app':_0x3efff7[_0xc38e('0x9')]?_0xc38e('0x5'):'NoOp','appdata':_0x3efff7[_0xc38e('0x9')]?_0xc38e('0x13')+_0x3efff7[_0xc38e('0x9')]:'No\x20alias\x20set','context':_0x3efff7[_0xc38e('0x7')],'exten':_0x3efff7[_0xc38e('0x8')],'priority':_0x38be21++,'VoiceExtensionId':_0x3efff7['id']},{'type':_0xc38e('0x11'),'app':_0xc38e('0x5'),'appdata':_0xc38e('0x14')+(_0x3efff7[_0xc38e('0x15')]?'${EXTEN:'+_0x3efff7['cutdigits']+'}':_0xc38e('0x16')),'context':_0x3efff7[_0xc38e('0x7')],'exten':_0x3efff7['exten'],'priority':_0x38be21++,'VoiceExtensionId':_0x3efff7['id']},{'type':_0xc38e('0x11'),'app':'Set','appdata':_0xc38e('0x17')+_0x3efff7['id'],'context':_0x3efff7[_0xc38e('0x7')],'exten':_0x3efff7[_0xc38e('0x8')],'priority':_0x38be21++,'VoiceExtensionId':_0x3efff7['id']},{'type':_0xc38e('0x11'),'app':_0xc38e('0x18'),'appdata':_0xc38e('0x19')+(_0x38be21+0x2)+_0xc38e('0x1a')+(_0x38be21+0x1)+')','context':_0x3efff7['context'],'exten':_0x3efff7['exten'],'priority':_0x38be21++,'VoiceExtensionId':_0x3efff7['id']},{'type':'outbound','app':_0xc38e('0x5'),'appdata':_0x3efff7[_0xc38e('0x15')]?_0xc38e('0x1b')+_0x3efff7[_0xc38e('0x15')]+'}':_0xc38e('0x1c'),'context':_0x3efff7[_0xc38e('0x7')],'exten':_0x3efff7[_0xc38e('0x8')],'priority':_0x38be21++,'VoiceExtensionId':_0x3efff7['id']},{'type':_0xc38e('0x11'),'app':_0xc38e('0x5'),'appdata':_0xc38e('0xe'),'context':_0x3efff7[_0xc38e('0x7')],'exten':_0x3efff7[_0xc38e('0x8')],'priority':_0x38be21++,'VoiceExtensionId':_0x3efff7['id']},{'type':_0xc38e('0x11'),'app':_0xc38e('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3efff7[_0xc38e('0x7')],'exten':_0x3efff7[_0xc38e('0x8')],'priority':_0x38be21++,'VoiceExtensionId':_0x3efff7['id']},{'type':_0xc38e('0x11'),'app':_0xc38e('0x5'),'appdata':_0xc38e('0x10'),'context':_0x3efff7[_0xc38e('0x7')],'exten':_0x3efff7[_0xc38e('0x8')],'priority':_0x38be21++,'VoiceExtensionId':_0x3efff7['id']},{'type':_0xc38e('0x11'),'app':_0xc38e('0x5'),'appdata':_0xc38e('0x1d')+_0x3efff7['id'],'context':_0x3efff7[_0xc38e('0x7')],'exten':_0x3efff7[_0xc38e('0x8')],'priority':_0x38be21++,'VoiceExtensionId':_0x3efff7['id']}];if(_0x3efff7[_0xc38e('0x1e')](_0xc38e('0x1f'))&&_0x3efff7[_0xc38e('0x1f')]!==_0xc38e('0x20')){_0x3a8cd0[_0xc38e('0xd')]({'type':_0xc38e('0x11'),'app':_0xc38e('0x5'),'appdata':_0xc38e('0x21'),'context':_0x3efff7[_0xc38e('0x7')],'exten':_0x3efff7[_0xc38e('0x8')],'priority':_0x38be21++,'VoiceExtensionId':_0x3efff7['id']},{'type':_0xc38e('0x11'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3efff7[_0xc38e('0x1f')]||_0xc38e('0x22'),'context':_0x3efff7[_0xc38e('0x7')],'exten':_0x3efff7[_0xc38e('0x8')],'priority':_0x38be21++,'VoiceExtensionId':_0x3efff7['id']});}return _0x3a8cd0;}function _0x42f3f2(_0x334a6f,_0x54d655){var _0x8ee021=[{'name':_0xc38e('0x23'),'param':0x0},{'name':_0xc38e('0x24'),'param':0x1},{'name':_0xc38e('0x25'),'param':0x2},{'name':_0xc38e('0x26'),'param':0x3}];var _0x19ceb4={};var _0x1b9258=_0x54d655[_0xc38e('0x27')](',');var _0x1d2d0d=[];for(var _0x47cf98=0x0;_0x47cf98<_0x8ee021[_0xc38e('0x28')];_0x47cf98++){switch(_0x8ee021[_0x47cf98]['name']){case _0xc38e('0x23'):_0x19ceb4[_0xc38e('0x23')]=_0x1b9258[_0x8ee021[_0x47cf98][_0xc38e('0x29')]][_0xc38e('0x27')]('/')[0x1];_0x19ceb4[_0xc38e('0x2a')]=_0x1b9258[_0x8ee021[_0x47cf98][_0xc38e('0x29')]][_0xc38e('0x27')]('/')[0x2];_0x19ceb4[_0xc38e('0x2b')]=_0x19ceb4[_0xc38e('0x2a')]?_0x19ceb4[_0xc38e('0x2a')][_0xc38e('0x27')]('$')[0x0]:undefined;_0x19ceb4[_0xc38e('0x2a')]=_0x334a6f['cutdigits']?(_0x19ceb4[_0xc38e('0x2b')]||'')+_0xc38e('0x2c')+_0x334a6f[_0xc38e('0x15')]+'}':(_0x19ceb4[_0xc38e('0x2b')]||'')+'${EXTEN}';_0x1d2d0d[_0x8ee021[_0x47cf98][_0xc38e('0x29')]]=['SIP',_0x19ceb4[_0xc38e('0x23')],_0x19ceb4[_0xc38e('0x2a')]][_0xc38e('0x2d')]('/');break;case'options':_0x19ceb4['options']=_0x1b9258[_0x8ee021[_0x47cf98]['param']];if(_0x334a6f[_0xc38e('0x1f')]!==_0xc38e('0x20')){if(_0x19ceb4['options'][_0xc38e('0x2e')]('U(xcally-mixmonitor-context)')<0x0){_0x19ceb4[_0xc38e('0x25')]+=_0xc38e('0x2f');}}else{_0x19ceb4[_0xc38e('0x25')]=_0x19ceb4[_0xc38e('0x25')][_0xc38e('0x30')]('U(xcally-mixmonitor-context)','');}_0x1d2d0d[_0x8ee021[_0x47cf98][_0xc38e('0x29')]]=_0x19ceb4[_0xc38e('0x25')];break;default:_0x1d2d0d[_0x8ee021[_0x47cf98][_0xc38e('0x29')]]=_0x1b9258[_0x8ee021[_0x47cf98][_0xc38e('0x29')]];}}return _0x1d2d0d[_0xc38e('0x2d')](',');}function _0xd6f718(_0x598c2c,_0xead33f,_0x3f51ef){return new Promise(function(_0x1bf043,_0x4fd907){var _0x1131fc=[];if(_[_0xc38e('0x31')](_0xead33f))return _0x1bf043(_0x1131fc);_0x3cc294['Interval'][_0xc38e('0x32')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0xc38e('0x33')](function(_0x267a50){for(var _0x4485d0=0x0,_0x4c835f=0x0;_0x4485d0<_0xead33f['length'];_0x4485d0++,_0x4c835f=0x0){var _0x35c29a=_0xead33f[_0x4485d0];var _0xb41a72=[];var _0x3d8626=[];delete _0x35c29a['id'];if(_0x35c29a[_0xc38e('0x34')]!==_0xc38e('0x35')){_0x35c29a[_0xc38e('0x36')]=[_0x35c29a[_0xc38e('0x34')]];}else{_0x35c29a[_0xc38e('0x36')]=_0x35c29a[_0xc38e('0x37')]?_['map'](_['filter'](_0x267a50,{'IntervalId':_0x35c29a['IntervalId']}),_0xc38e('0x34')):[];}_0x35c29a[_0xc38e('0x7')]=_0x598c2c[_0xc38e('0x7')];_0x35c29a[_0xc38e('0x8')]=_0x598c2c[_0xc38e('0x8')];if(_0x35c29a[_0xc38e('0x4')])_0x35c29a[_0xc38e('0x4')]=_0x35c29a[_0xc38e('0x4')][_0xc38e('0x38')]();if(_0x598c2c[_0xc38e('0x4')]===_0xc38e('0x11')){if(_0x35c29a[_0xc38e('0x1e')](_0xc38e('0x39'))&&_0x35c29a['tag']&&_0x35c29a[_0xc38e('0x39')]!=='--'){_0xb41a72['push']({'type':_0x35c29a[_0xc38e('0x4')][_0xc38e('0x38')](),'app':_0xc38e('0x5'),'appdata':_0xc38e('0x3a')+_0x35c29a[_0xc38e('0x39')],'context':_0x598c2c['context'],'exten':_0x598c2c[_0xc38e('0x8')],'priority':_0x35c29a[_0xc38e('0x36')][_0xc38e('0x28')]+_0x3f51ef+_0x4c835f++,'VoiceExtensionId':_0x598c2c['id']});}_0xb41a72[_0xc38e('0xd')]({'type':_0x35c29a['type']['toLowerCase'](),'app':'ExecIf','appdata':_0xc38e('0x3b')+(_0x35c29a[_0xc38e('0x3c')]?'Set(CALLERID(all)='+_0x35c29a[_0xc38e('0x3c')]+')':_0xc38e('0x3d')),'context':_0x598c2c['context'],'exten':_0x598c2c['exten'],'priority':_0x35c29a[_0xc38e('0x36')][_0xc38e('0x28')]+_0x3f51ef+_0x4c835f++,'VoiceExtensionId':_0x598c2c['id']});}else{if(_0x35c29a['hasOwnProperty'](_0xc38e('0x3e'))){if([_0xc38e('0x3f'),_0xc38e('0x40')][_0xc38e('0x41')](_0x35c29a['app'][_0xc38e('0x38')]())&&_0x35c29a[_0xc38e('0x42')]!==_0xc38e('0x43')){if(_0x35c29a[_0xc38e('0x3e')]){_0xb41a72[_0xc38e('0xd')]({'type':_0x35c29a[_0xc38e('0x4')]['toLowerCase'](),'app':_0xc38e('0x18'),'appdata':_0xc38e('0x44'),'context':_0x598c2c['context'],'exten':_0x598c2c['exten'],'priority':_0x35c29a['intervals'][_0xc38e('0x28')]+_0x3f51ef+_0x4c835f++,'VoiceExtensionId':_0x598c2c['id']});_0xb41a72[_0xc38e('0xd')]({'type':_0x35c29a['type'][_0xc38e('0x38')](),'app':_0xc38e('0x5'),'appdata':_0xc38e('0x45'),'context':_0x598c2c[_0xc38e('0x7')],'exten':_0x598c2c[_0xc38e('0x8')],'priority':_0x35c29a[_0xc38e('0x36')][_0xc38e('0x28')]+_0x3f51ef+_0x4c835f++,'VoiceExtensionId':_0x598c2c['id']});}else{_0xb41a72[_0xc38e('0xd')]({'type':_0x35c29a[_0xc38e('0x4')]['toLowerCase'](),'app':_0xc38e('0x18'),'appdata':_0xc38e('0x46'),'context':_0x598c2c[_0xc38e('0x7')],'exten':_0x598c2c[_0xc38e('0x8')],'priority':_0x35c29a[_0xc38e('0x36')][_0xc38e('0x28')]+_0x3f51ef+_0x4c835f++,'VoiceExtensionId':_0x598c2c['id']});_0xb41a72[_0xc38e('0xd')]({'type':_0x35c29a[_0xc38e('0x4')][_0xc38e('0x38')](),'app':_0xc38e('0x5'),'appdata':_0xc38e('0x47'),'context':_0x598c2c[_0xc38e('0x7')],'exten':_0x598c2c['exten'],'priority':_0x35c29a[_0xc38e('0x36')][_0xc38e('0x28')]+_0x3f51ef+_0x4c835f++,'VoiceExtensionId':_0x598c2c['id']});}}}}for(var _0x5c0402=0x0;_0x5c0402<_0x35c29a[_0xc38e('0x36')][_0xc38e('0x28')];_0x5c0402++){var _0x26134f=_0x3f51ef+_0x35c29a[_0xc38e('0x36')]['length'];var _0x51981b=_0x5c0402===_0x35c29a[_0xc38e('0x36')][_0xc38e('0x28')]-0x1?_0x3f51ef+_0xb41a72[_0xc38e('0x28')]+_0x3d8626['length']+0x2:_0x3f51ef+_0x5c0402+0x1;_0xb41a72[_0xc38e('0x48')](_0x5c0402,0x0,{'type':_0x598c2c['type'],'app':_0xc38e('0x49'),'appdata':_0x35c29a[_0xc38e('0x36')][_0x5c0402]+'?'+_0x598c2c[_0xc38e('0x7')]+_0xc38e('0x4a')+_0x26134f+':'+_0x598c2c[_0xc38e('0x7')]+_0xc38e('0x4a')+_0x51981b,'exten':_0x598c2c[_0xc38e('0x8')],'context':_0x598c2c[_0xc38e('0x7')],'priority':_0x3f51ef+_0x5c0402,'VoiceExtensionId':_0x598c2c['id']});}if(_0x35c29a[_0xc38e('0x42')]===_0xc38e('0x4b'))_0x35c29a['appdata']=_0x42f3f2(_0x598c2c,_0x35c29a[_0xc38e('0x4c')]);_0x35c29a[_0xc38e('0x4d')]=_0xb41a72['length']?_[_0xc38e('0x4e')](_0xb41a72)[_0xc38e('0x4d')]+0x1:_0x3f51ef;_0x1131fc=_['concat'](_0x1131fc,_0xb41a72,[_0x35c29a],_0x3d8626);_0x3f51ef=_['last'](_0x1131fc)[_0xc38e('0x4d')]+0x1;}return _0x1bf043(_0x1131fc);})[_0xc38e('0x4f')](function(_0x3524da){_0x4fd907(_0x3524da);});});}return _0x427553['define']('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5e1d9b){var _0x215675=this[_0xc38e('0x50')]({'plain':!![]});var _0x13850c=_0x215675[_0xc38e('0x4')]===_0xc38e('0x11')?_0xff5d13(_0x215675):_0x1a9bd5(_0x215675);return _0xd6f718(_0x215675,_0x5e1d9b,_[_0xc38e('0x4e')](_0x13850c)[_0xc38e('0x4d')]+0x1)[_0xc38e('0x33')](function(_0x10ddbd){var _0x3ba1ee=_[_0xc38e('0x51')](_0x13850c,_0x10ddbd);_0x3ba1ee[_0xc38e('0xd')]({'type':_0x215675[_0xc38e('0x4')],'app':_0xc38e('0x52'),'exten':_0x215675['exten'],'context':_0x215675[_0xc38e('0x7')],'priority':_[_0xc38e('0x4e')](_0x3ba1ee)[_0xc38e('0x4d')]+0x1,'VoiceExtensionId':_0x215675['id']});return _0x3ba1ee;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 8cd1aeb..effc222 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 _0x4553=['stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','model','attributes','map','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s'];(function(_0x4d0e8b,_0x25837e){var _0x1163d3=function(_0x417a53){while(--_0x417a53){_0x4d0e8b['push'](_0x4d0e8b['shift']());}};_0x1163d3(++_0x25837e);}(_0x4553,0x1be));var _0x3455=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x4553[_0x5d80de];return _0x1c7556;};'use strict';var _=require('lodash');var util=require(_0x3455('0x0'));var moment=require(_0x3455('0x1'));var BPromise=require(_0x3455('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3455('0x3'))['db'];var utils=require(_0x3455('0x4'));var logger=require(_0x3455('0x5'))(_0x3455('0x6'));var config=require(_0x3455('0x7'));var jayson=require(_0x3455('0x8'));var client=jayson[_0x3455('0x9')][_0x3455('0xa')]({'port':0x232a});config[_0x3455('0xb')]=_['defaults'](config[_0x3455('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3455('0xc'))(new Redis(config['redis']));require(_0x3455('0xd'))[_0x3455('0xe')](socket);function respondWithRpcPromise(_0x2732c6,_0x49b469,_0x5553b5){return new BPromise(function(_0x2a0338,_0xdf9c72){return client[_0x3455('0xf')](_0x2732c6,_0x5553b5)[_0x3455('0x10')](function(_0xaa628d){logger[_0x3455('0x11')](_0x3455('0x12'),_0x49b469,_0x3455('0x13'));logger[_0x3455('0x14')](_0x3455('0x15'),_0x49b469,_0x3455('0x13'),JSON[_0x3455('0x16')](_0xaa628d));if(_0xaa628d[_0x3455('0x17')]){if(_0xaa628d[_0x3455('0x17')][_0x3455('0x18')]===0x1f4){logger[_0x3455('0x17')](_0x3455('0x12'),_0x49b469,_0xaa628d['error'][_0x3455('0x19')]);return _0xdf9c72(_0xaa628d[_0x3455('0x17')][_0x3455('0x19')]);}logger[_0x3455('0x17')](_0x3455('0x12'),_0x49b469,_0xaa628d[_0x3455('0x17')]['message']);return _0x2a0338(_0xaa628d[_0x3455('0x17')][_0x3455('0x19')]);}else{logger[_0x3455('0x11')](_0x3455('0x12'),_0x49b469,_0x3455('0x13'));_0x2a0338(_0xaa628d[_0x3455('0x1a')]['message']);}})[_0x3455('0x1b')](function(_0x56b02e){logger[_0x3455('0x17')](_0x3455('0x12'),_0x49b469,_0x56b02e);_0xdf9c72(_0x56b02e);});});}exports[_0x3455('0x1c')]=function(_0x215329){var _0x2511b8=this;return new Promise(function(_0x33ae85,_0x192d90){return db[_0x3455('0x1d')][_0x3455('0x1e')]({'raw':_0x215329['options']?_0x215329[_0x3455('0x1f')][_0x3455('0x20')]===undefined?!![]:![]:!![],'where':_0x215329[_0x3455('0x1f')]?_0x215329['options'][_0x3455('0x21')]||null:null,'attributes':_0x215329[_0x3455('0x1f')]?_0x215329['options']['attributes']||null:null,'limit':_0x215329[_0x3455('0x1f')]?_0x215329[_0x3455('0x1f')][_0x3455('0x22')]||null:null,'include':_0x215329[_0x3455('0x1f')]?_0x215329['options'][_0x3455('0x23')]?_['map'](_0x215329[_0x3455('0x1f')]['include'],function(_0x1ddb6a){return{'model':db[_0x1ddb6a[_0x3455('0x24')]],'as':_0x1ddb6a['as'],'attributes':_0x1ddb6a[_0x3455('0x25')],'include':_0x1ddb6a['include']?_[_0x3455('0x26')](_0x1ddb6a[_0x3455('0x23')],function(_0x5c607b){return{'model':db[_0x5c607b[_0x3455('0x24')]],'as':_0x5c607b['as'],'attributes':_0x5c607b['attributes'],'include':_0x5c607b['include']?_[_0x3455('0x26')](_0x5c607b[_0x3455('0x23')],function(_0x2f8ded){return{'model':db[_0x2f8ded['model']],'as':_0x2f8ded['as'],'attributes':_0x2f8ded[_0x3455('0x25')]};}):[]};}):[]};}):[]:[]})[_0x3455('0x10')](function(_0x170f56){logger[_0x3455('0x11')]('GetVoiceExtension',_0x215329);logger[_0x3455('0x14')](_0x3455('0x1c'),_0x215329,JSON[_0x3455('0x16')](_0x170f56));_0x33ae85(_0x170f56);})[_0x3455('0x1b')](function(_0x3ff829){logger['error'](_0x3455('0x1c'),_0x3ff829[_0x3455('0x19')],_0x215329);_0x192d90(_0x2511b8['error'](0x1f4,_0x3ff829[_0x3455('0x19')]));});});}; \ No newline at end of file +var _0x53ec=['then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','include','model','map','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register'];(function(_0x156742,_0x6c77b4){var _0x3bb165=function(_0x4a49fb){while(--_0x4a49fb){_0x156742['push'](_0x156742['shift']());}};_0x3bb165(++_0x6c77b4);}(_0x53ec,0x192));var _0xc53e=function(_0x397d61,_0x1f2002){_0x397d61=_0x397d61-0x0;var _0x270833=_0x53ec[_0x397d61];return _0x270833;};'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});config[_0xc53e('0xa')]=_[_0xc53e('0xb')](config['redis'],{'host':_0xc53e('0xc'),'port':0x18eb});var socket=require(_0xc53e('0xd'))(new Redis(config[_0xc53e('0xa')]));require(_0xc53e('0xe'))[_0xc53e('0xf')](socket);function respondWithRpcPromise(_0x2c88cb,_0xd82002,_0x361e9d){return new BPromise(function(_0xa98198,_0x4b7cfa){return client['request'](_0x2c88cb,_0x361e9d)[_0xc53e('0x10')](function(_0x5a2da7){logger['info'](_0xc53e('0x11'),_0xd82002,_0xc53e('0x12'));logger[_0xc53e('0x13')](_0xc53e('0x14'),_0xd82002,'request\x20sent',JSON['stringify'](_0x5a2da7));if(_0x5a2da7[_0xc53e('0x15')]){if(_0x5a2da7[_0xc53e('0x15')][_0xc53e('0x16')]===0x1f4){logger[_0xc53e('0x15')](_0xc53e('0x11'),_0xd82002,_0x5a2da7[_0xc53e('0x15')][_0xc53e('0x17')]);return _0x4b7cfa(_0x5a2da7[_0xc53e('0x15')][_0xc53e('0x17')]);}logger[_0xc53e('0x15')]('VoiceExtension,\x20%s,\x20%s',_0xd82002,_0x5a2da7[_0xc53e('0x15')][_0xc53e('0x17')]);return _0xa98198(_0x5a2da7[_0xc53e('0x15')][_0xc53e('0x17')]);}else{logger[_0xc53e('0x18')](_0xc53e('0x11'),_0xd82002,_0xc53e('0x12'));_0xa98198(_0x5a2da7[_0xc53e('0x19')][_0xc53e('0x17')]);}})['catch'](function(_0x546fab){logger[_0xc53e('0x15')](_0xc53e('0x11'),_0xd82002,_0x546fab);_0x4b7cfa(_0x546fab);});});}exports[_0xc53e('0x1a')]=function(_0x2e85df){var _0x20066e=this;return new Promise(function(_0x2cfe2b,_0x15a015){return db[_0xc53e('0x1b')][_0xc53e('0x1c')]({'raw':_0x2e85df[_0xc53e('0x1d')]?_0x2e85df[_0xc53e('0x1d')][_0xc53e('0x1e')]===undefined?!![]:![]:!![],'where':_0x2e85df[_0xc53e('0x1d')]?_0x2e85df['options']['where']||null:null,'attributes':_0x2e85df['options']?_0x2e85df[_0xc53e('0x1d')][_0xc53e('0x1f')]||null:null,'limit':_0x2e85df[_0xc53e('0x1d')]?_0x2e85df[_0xc53e('0x1d')][_0xc53e('0x20')]||null:null,'include':_0x2e85df['options']?_0x2e85df['options'][_0xc53e('0x21')]?_['map'](_0x2e85df[_0xc53e('0x1d')][_0xc53e('0x21')],function(_0x443179){return{'model':db[_0x443179[_0xc53e('0x22')]],'as':_0x443179['as'],'attributes':_0x443179[_0xc53e('0x1f')],'include':_0x443179['include']?_[_0xc53e('0x23')](_0x443179['include'],function(_0x4d9a68){return{'model':db[_0x4d9a68['model']],'as':_0x4d9a68['as'],'attributes':_0x4d9a68[_0xc53e('0x1f')],'include':_0x4d9a68['include']?_[_0xc53e('0x23')](_0x4d9a68['include'],function(_0x24a77e){return{'model':db[_0x24a77e['model']],'as':_0x24a77e['as'],'attributes':_0x24a77e['attributes']};}):[]};}):[]};}):[]:[]})[_0xc53e('0x10')](function(_0x6a62b0){logger[_0xc53e('0x18')](_0xc53e('0x1a'),_0x2e85df);logger[_0xc53e('0x13')](_0xc53e('0x1a'),_0x2e85df,JSON[_0xc53e('0x24')](_0x6a62b0));_0x2cfe2b(_0x6a62b0);})[_0xc53e('0x25')](function(_0x4ace0b){logger[_0xc53e('0x15')](_0xc53e('0x1a'),_0x4ace0b[_0xc53e('0x17')],_0x2e85df);_0x15a015(_0x20066e['error'](0x1f4,_0x4ace0b[_0xc53e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index db20ef4..d53ec94 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 _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x15583d,_0x3f49ae){var _0xd47acc=function(_0x3361cf){while(--_0x3361cf){_0x15583d['push'](_0x15583d['shift']());}};_0xd47acc(++_0x3f49ae);}(_0xe14b,0x93));var _0xbe14=function(_0x24b636,_0x390351){_0x24b636=_0x24b636-0x0;var _0x96fd48=_0xe14b[_0x24b636];return _0x96fd48;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0xcd6476,_0x292055){var _0x2df158=function(_0x35f5be){while(--_0x35f5be){_0xcd6476['push'](_0xcd6476['shift']());}};_0x2df158(++_0x292055);}(_0x7a54,0x106));var _0x47a5=function(_0x410b72,_0x32519b){_0x410b72=_0x410b72-0x0;var _0x1c69e8=_0x7a54[_0x410b72];return _0x1c69e8;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 49f15f8..3fe55a9 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 _0xf61e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','isAuthenticated','show','getMessages','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x310ee6,_0x17eee3){var _0x519d55=function(_0x5b3605){while(--_0x5b3605){_0x310ee6['push'](_0x310ee6['shift']());}};_0x519d55(++_0x17eee3);}(_0xf61e,0x191));var _0xef61=function(_0x1765b5,_0x55274a){_0x1765b5=_0x1765b5-0x0;var _0x1bda5c=_0xf61e[_0x1765b5];return _0x1bda5c;};'use strict';var multer=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var path=require(_0xef61('0x2'));var timeout=require(_0xef61('0x3'));var express=require(_0xef61('0x4'));var router=express[_0xef61('0x5')]();var fs_extra=require(_0xef61('0x6'));var auth=require(_0xef61('0x7'));var interaction=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var controller=require(_0xef61('0xa'));router[_0xef61('0xb')]('/',auth['isAuthenticated'](),controller[_0xef61('0xc')]);router[_0xef61('0xb')]('/:id',auth[_0xef61('0xd')](),controller[_0xef61('0xe')]);router[_0xef61('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0xef61('0xf')]);router[_0xef61('0x10')]('/',auth[_0xef61('0xd')](),controller[_0xef61('0x11')]);router[_0xef61('0x12')](_0xef61('0x13'),auth[_0xef61('0xd')](),controller[_0xef61('0x14')]);router[_0xef61('0x15')](_0xef61('0x13'),auth[_0xef61('0xd')](),controller[_0xef61('0x16')]);module[_0xef61('0x17')]=router; \ No newline at end of file +var _0x2d72=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update','exports'];(function(_0x5cabfd,_0x5dea47){var _0x4bc06c=function(_0x4a2fea){while(--_0x4a2fea){_0x5cabfd['push'](_0x5cabfd['shift']());}};_0x4bc06c(++_0x5dea47);}(_0x2d72,0xa8));var _0x22d7=function(_0x199af3,_0x2149dc){_0x199af3=_0x199af3-0x0;var _0x7867fd=_0x2d72[_0x199af3];return _0x7867fd;};'use strict';var multer=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var path=require(_0x22d7('0x2'));var timeout=require(_0x22d7('0x3'));var express=require(_0x22d7('0x4'));var router=express[_0x22d7('0x5')]();var fs_extra=require(_0x22d7('0x6'));var auth=require(_0x22d7('0x7'));var interaction=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var controller=require(_0x22d7('0xa'));router[_0x22d7('0xb')]('/',auth[_0x22d7('0xc')](),controller[_0x22d7('0xd')]);router['get'](_0x22d7('0xe'),auth[_0x22d7('0xc')](),controller['show']);router[_0x22d7('0xb')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x22d7('0x11')]);router[_0x22d7('0x12')](_0x22d7('0xe'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x13')]);router['delete']('/:id',auth[_0x22d7('0xc')](),controller['destroy']);module[_0x22d7('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 13b0d8b..67c95e4 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 _0xa3b0=['INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','STRING','from-voicemail','contest_mailbox','email','string','trim','central','ENUM','yes','TINYINT(4)'];(function(_0xd247c2,_0x589a8a){var _0x43afba=function(_0x43e42b){while(--_0x43e42b){_0xd247c2['push'](_0xd247c2['shift']());}};_0x43afba(++_0x589a8a);}(_0xa3b0,0x135));var _0x0a3b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa3b0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0a3b('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x0a3b('0x1')]},'context':{'type':Sequelize[_0x0a3b('0x1')],'defaultValue':_0x0a3b('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x0a3b('0x1')],'defaultValue':'','allowNull':![],'unique':_0x0a3b('0x3')},'password':{'type':Sequelize[_0x0a3b('0x1')]},'fullname':{'type':Sequelize[_0x0a3b('0x1')]},'email':{'type':Sequelize[_0x0a3b('0x1')],'validate':{'isEmail':!![]},'set':function(_0x48e97f){this['setDataValue'](_0x0a3b('0x4'),typeof _0x48e97f===_0x0a3b('0x5')&&_0x48e97f[_0x0a3b('0x6')]()?_0x48e97f[_0x0a3b('0x6')]():null);}},'pager':{'type':Sequelize[_0x0a3b('0x1')]},'tz':{'type':Sequelize[_0x0a3b('0x1')],'defaultValue':_0x0a3b('0x7')},'attach':{'type':Sequelize[_0x0a3b('0x8')](_0x0a3b('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x0a3b('0x9'),'no'),'defaultValue':_0x0a3b('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0a3b('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x0a3b('0x8')](_0x0a3b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0a3b('0x8')](_0x0a3b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0a3b('0x8')](_0x0a3b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0a3b('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0a3b('0x8')](_0x0a3b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0a3b('0x8')](_0x0a3b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x0a3b('0x9'),'no'),'defaultValue':_0x0a3b('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0a3b('0x8')](_0x0a3b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0a3b('0x8')]('yes','no'),'defaultValue':_0x0a3b('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x0a3b('0x1')]},'emailbody':{'type':Sequelize[_0x0a3b('0x1')]},'maxsecs':{'type':Sequelize[_0x0a3b('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0a3b('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0a3b('0xc')],'get':function(){return this[_0x0a3b('0xd')](_0x0a3b('0xe'))+_0x0a3b('0xf')+this['getDataValue']('mailbox');}}}; \ No newline at end of file +var _0x0efa=['mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname'];(function(_0x1d83db,_0x89d115){var _0x2dc1d1=function(_0x13fdc3){while(--_0x13fdc3){_0x1d83db['push'](_0x1d83db['shift']());}};_0x2dc1d1(++_0x89d115);}(_0x0efa,0xfd));var _0xa0ef=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x0efa[_0x5f309e];return _0x487b5e;};'use strict';var Sequelize=require(_0xa0ef('0x0'));module[_0xa0ef('0x1')]={'customer_id':{'type':Sequelize[_0xa0ef('0x2')]},'context':{'type':Sequelize[_0xa0ef('0x2')],'defaultValue':_0xa0ef('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xa0ef('0x2')],'defaultValue':'','allowNull':![],'unique':_0xa0ef('0x4')},'password':{'type':Sequelize[_0xa0ef('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa0ef('0x2')],'validate':{'isEmail':!![]},'set':function(_0x253e4a){this[_0xa0ef('0x5')](_0xa0ef('0x6'),typeof _0x253e4a===_0xa0ef('0x7')&&_0x253e4a[_0xa0ef('0x8')]()?_0x253e4a[_0xa0ef('0x8')]():null);}},'pager':{'type':Sequelize[_0xa0ef('0x2')]},'tz':{'type':Sequelize[_0xa0ef('0x2')],'defaultValue':_0xa0ef('0x9')},'attach':{'type':Sequelize[_0xa0ef('0xa')](_0xa0ef('0xb'),'no'),'defaultValue':_0xa0ef('0xb'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xa0ef('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xa0ef('0x2')]},'callback':{'type':Sequelize[_0xa0ef('0x2')]},'review':{'type':Sequelize[_0xa0ef('0xa')](_0xa0ef('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xa0ef('0xa')](_0xa0ef('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xa0ef('0xa')](_0xa0ef('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xa0ef('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xa0ef('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xa0ef('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xa0ef('0xa')](_0xa0ef('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xa0ef('0xa')](_0xa0ef('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xa0ef('0xa')](_0xa0ef('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xa0ef('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xa0ef('0xb'),'no'),'defaultValue':_0xa0ef('0xb'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xa0ef('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xa0ef('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xa0ef('0xe')],'get':function(){return this[_0xa0ef('0xf')](_0xa0ef('0x10'))+'\x20-\x20'+this[_0xa0ef('0xf')](_0xa0ef('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 2165df5..4c0d82c 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 _0xf45e=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','UserProfileResource','error','stack','name','send','map','VoiceMail','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','zip-dir'];(function(_0x444849,_0x958259){var _0x5d2ed0=function(_0x4c2b18){while(--_0x4c2b18){_0x444849['push'](_0x444849['shift']());}};_0x5d2ed0(++_0x958259);}(_0xf45e,0x115));var _0xef45=function(_0x5c0687,_0xe75ce2){_0x5c0687=_0x5c0687-0x0;var _0x581f60=_0xf45e[_0x5c0687];return _0x581f60;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){var _0x315777=_0x7817d0['get']({'plain':!![]});var _0x208b35='Voicemails';return db[_0xef45('0x2a')][_0xef45('0x28')]({'where':{'type':_0x208b35,'resourceId':_0x315777['id']}})['then'](function(){return _0x7817d0;});})[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1096af,_0x4f8c9b){return function(_0x550e18){if(!_0x550e18){_0x1096af['sendStatus'](0x194);}return _0x550e18;};}function handleError(_0x53690e,_0x1f636f){_0x1f636f=_0x1f636f||0x1f4;return function(_0x2f72ef){logger[_0xef45('0x2b')](_0x2f72ef[_0xef45('0x2c')]);if(_0x2f72ef['name']){delete _0x2f72ef[_0xef45('0x2d')];}_0x53690e['status'](_0x1f636f)[_0xef45('0x2e')](_0x2f72ef);};}exports['index']=function(_0x3e6922,_0x5bfd2d){var _0x575734={},_0x14ce5a={},_0x3e45de={'count':0x0,'rows':[]};var _0x390a7a=_[_0xef45('0x2f')](db[_0xef45('0x30')]['rawAttributes'],function(_0x5551ce){return{'name':_0x5551ce['fieldName'],'type':_0x5551ce[_0xef45('0x31')][_0xef45('0x32')]};});_0x14ce5a[_0xef45('0x33')]=_[_0xef45('0x2f')](_0x390a7a,_0xef45('0x2d'));_0x14ce5a[_0xef45('0x34')]=_[_0xef45('0x35')](_0x3e6922['query']);_0x14ce5a['filters']=_[_0xef45('0x36')](_0x14ce5a['model'],_0x14ce5a[_0xef45('0x34')]);_0x575734['attributes']=_[_0xef45('0x36')](_0x14ce5a[_0xef45('0x33')],qs[_0xef45('0x37')](_0x3e6922[_0xef45('0x34')][_0xef45('0x37')]));_0x575734['attributes']=_0x575734[_0xef45('0x38')][_0xef45('0x39')]?_0x575734[_0xef45('0x38')]:_0x14ce5a['model'];if(!_0x3e6922['query'][_0xef45('0x3a')](_0xef45('0x3b'))){_0x575734['limit']=qs[_0xef45('0x20')](_0x3e6922['query']['limit']);_0x575734[_0xef45('0x1e')]=qs[_0xef45('0x1e')](_0x3e6922[_0xef45('0x34')]['offset']);}_0x575734[_0xef45('0x3c')]=qs[_0xef45('0x3d')](_0x3e6922[_0xef45('0x34')][_0xef45('0x3d')]);_0x575734['where']=qs['filters'](_[_0xef45('0x3e')](_0x3e6922[_0xef45('0x34')],_0x14ce5a[_0xef45('0x3f')]),_0x390a7a);if(_0x3e6922[_0xef45('0x34')][_0xef45('0x40')]){_0x575734[_0xef45('0x41')]=_[_0xef45('0x42')](_0x575734[_0xef45('0x41')],{'$or':_['map'](_0x390a7a,function(_0x4f5877){if(_0x4f5877[_0xef45('0x31')]!==_0xef45('0x43')){var _0x154e72={};_0x154e72[_0x4f5877[_0xef45('0x2d')]]={'$like':'%'+_0x3e6922[_0xef45('0x34')][_0xef45('0x40')]+'%'};return _0x154e72;}})});}_0x575734=_[_0xef45('0x42')]({},_0x575734,_0x3e6922[_0xef45('0x44')]);var _0x3a5082={'where':_0x575734[_0xef45('0x41')]};return db[_0xef45('0x30')][_0xef45('0x21')](_0x3a5082)[_0xef45('0x29')](function(_0xd7d217){_0x3e45de[_0xef45('0x21')]=_0xd7d217;if(_0x3e6922[_0xef45('0x34')]['includeAll']){_0x575734[_0xef45('0x45')]=[{'all':!![]}];}return db[_0xef45('0x30')][_0xef45('0x46')](_0x575734);})[_0xef45('0x29')](function(_0x54ccb8){_0x3e45de[_0xef45('0x47')]=_0x54ccb8;return _0x3e45de;})['then'](respondWithFilteredResult(_0x5bfd2d,_0x575734))[_0xef45('0x48')](handleError(_0x5bfd2d,null));};exports['show']=function(_0x5faf67,_0x2d086f){var _0x2236d9={'raw':!![],'where':{'id':_0x5faf67[_0xef45('0x49')]['id']}},_0x36e81a={};_0x36e81a[_0xef45('0x33')]=_[_0xef45('0x35')](db['VoiceMail'][_0xef45('0x4a')]);_0x36e81a[_0xef45('0x34')]=_[_0xef45('0x35')](_0x5faf67[_0xef45('0x34')]);_0x36e81a[_0xef45('0x3f')]=_[_0xef45('0x36')](_0x36e81a[_0xef45('0x33')],_0x36e81a[_0xef45('0x34')]);_0x2236d9[_0xef45('0x38')]=_[_0xef45('0x36')](_0x36e81a[_0xef45('0x33')],qs[_0xef45('0x37')](_0x5faf67[_0xef45('0x34')][_0xef45('0x37')]));_0x2236d9[_0xef45('0x38')]=_0x2236d9['attributes'][_0xef45('0x39')]?_0x2236d9[_0xef45('0x38')]:_0x36e81a[_0xef45('0x33')];if(_0x5faf67['query']['includeAll']){_0x2236d9['include']=[{'all':!![]}];}_0x2236d9=_[_0xef45('0x42')]({},_0x2236d9,_0x5faf67[_0xef45('0x44')]);return db[_0xef45('0x30')][_0xef45('0x4b')](_0x2236d9)[_0xef45('0x29')](handleEntityNotFound(_0x2d086f,null))[_0xef45('0x29')](respondWithResult(_0x2d086f,null))['catch'](handleError(_0x2d086f,null));};exports[_0xef45('0x4c')]=function(_0x463796,_0x2b2419){return db['VoiceMail']['create'](_0x463796[_0xef45('0x4d')],{})[_0xef45('0x29')](function(_0x4feeb1){var _0x1a56ae=_0x463796[_0xef45('0x4e')][_0xef45('0x4f')]({'plain':!![]});if(!_0x1a56ae)throw new Error(_0xef45('0x50'));if(_0x1a56ae[_0xef45('0x51')]===_0xef45('0x4e')){var _0x23581f=_0x4feeb1[_0xef45('0x4f')]({'plain':!![]});var _0x1961b4=_0xef45('0x52');return db[_0xef45('0x53')][_0xef45('0x4b')]({'where':{'name':_0x1961b4,'userProfileId':_0x1a56ae[_0xef45('0x54')]},'raw':!![]})[_0xef45('0x29')](function(_0x48a391){if(_0x48a391&&_0x48a391[_0xef45('0x55')]===0x0){return db[_0xef45('0x2a')][_0xef45('0x4c')]({'name':_0x23581f['name'],'resourceId':_0x23581f['id'],'type':_0x48a391[_0xef45('0x2d')],'sectionId':_0x48a391['id']},{})[_0xef45('0x29')](function(){return _0x4feeb1;});}else{return _0x4feeb1;}})[_0xef45('0x48')](function(_0x1531ea){logger['error'](_0xef45('0x56'),_0x1531ea);throw _0x1531ea;});}return _0x4feeb1;})[_0xef45('0x29')](respondWithResult(_0x2b2419,0xc9))[_0xef45('0x48')](handleError(_0x2b2419,null));};exports[_0xef45('0x57')]=function(_0x67d57b,_0x41f575){if(_0x67d57b[_0xef45('0x4d')]['id']){delete _0x67d57b[_0xef45('0x4d')]['id'];}return db[_0xef45('0x30')][_0xef45('0x4b')]({'where':{'id':_0x67d57b[_0xef45('0x49')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x41f575,null))['then'](saveUpdates(_0x67d57b[_0xef45('0x4d')],null))[_0xef45('0x29')](respondWithResult(_0x41f575,null))[_0xef45('0x48')](handleError(_0x41f575,null));};exports[_0xef45('0x28')]=function(_0x2fe9cf,_0x32232f){return db['VoiceMail']['find']({'where':{'id':_0x2fe9cf[_0xef45('0x49')]['id']}})['then'](handleEntityNotFound(_0x32232f,null))[_0xef45('0x29')](removeEntity(_0x32232f,null))[_0xef45('0x48')](handleError(_0x32232f,null));};exports[_0xef45('0x58')]=function(_0x5676fb,_0x16b04e,_0x398dc0){return db['VoiceMail'][_0xef45('0x59')]({'where':{'id':_0x5676fb['params']['id']}})['then'](handleEntityNotFound(_0x16b04e,null))[_0xef45('0x29')](function(_0x4f78ac){var _0x189f22;var _0x3fbc26={},_0x22fd64={};_0x22fd64['model']=_[_0xef45('0x35')](db[_0xef45('0x5a')]['rawAttributes']);_0x22fd64[_0xef45('0x34')]=_[_0xef45('0x35')](_0x5676fb[_0xef45('0x34')]);_0x22fd64[_0xef45('0x3f')]=_[_0xef45('0x36')](_0x22fd64[_0xef45('0x33')],_0x22fd64[_0xef45('0x34')]);_0x3fbc26[_0xef45('0x38')]=_['intersection'](_0x22fd64[_0xef45('0x33')],qs['fields'](_0x5676fb['query'][_0xef45('0x37')]));_0x3fbc26['attributes']=_0x3fbc26[_0xef45('0x38')][_0xef45('0x39')]?_0x3fbc26['attributes']:_0x22fd64[_0xef45('0x33')];if(!_0x5676fb[_0xef45('0x34')][_0xef45('0x3a')](_0xef45('0x3b'))){_0x3fbc26[_0xef45('0x20')]=qs[_0xef45('0x20')](_0x5676fb['query'][_0xef45('0x20')]);_0x3fbc26[_0xef45('0x1e')]=qs[_0xef45('0x1e')](_0x5676fb[_0xef45('0x34')][_0xef45('0x1e')]);}_0x3fbc26['order']=qs[_0xef45('0x3d')](_0x5676fb['query'][_0xef45('0x3d')]);_0x3fbc26[_0xef45('0x41')]=qs['filters'](_[_0xef45('0x3e')](_0x5676fb[_0xef45('0x34')],_0x22fd64[_0xef45('0x3f')]));if(_0x5676fb['query']['filter']){_0x3fbc26[_0xef45('0x41')]=_[_0xef45('0x42')](_0x3fbc26[_0xef45('0x41')],{'$or':_['map'](_0x3fbc26[_0xef45('0x38')],function(_0x3956b0){var _0x49131e={};_0x49131e[_0x3956b0]={'$like':'%'+_0x5676fb[_0xef45('0x34')]['filter']+'%'};return _0x49131e;})});}_0x3fbc26[_0xef45('0x41')]=_[_0xef45('0x42')](_0x3fbc26[_0xef45('0x41')],{'mailboxuser':_0x4f78ac[_0xef45('0x5b')]});_0x3fbc26=_[_0xef45('0x42')]({},_0x3fbc26,_0x5676fb[_0xef45('0x44')]);return db[_0xef45('0x5a')][_0xef45('0x5c')](_0x3fbc26)['then'](respondWithFilteredResult(_0x16b04e,_0x3fbc26));})[_0xef45('0x48')](handleError(_0x16b04e,null));}; \ No newline at end of file +var _0x9c00=['name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','VoiceMail','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','get','Voicemails','UserProfileResource','then','stack'];(function(_0x533a34,_0x3724d2){var _0xfc339=function(_0xf18221){while(--_0xf18221){_0x533a34['push'](_0x533a34['shift']());}};_0xfc339(++_0x3724d2);}(_0x9c00,0x1a0));var _0x09c0=function(_0x14691c,_0xe1c878){_0x14691c=_0x14691c-0x0;var _0xbec98=_0x9c00[_0x14691c];return _0xbec98;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];function respondWithStatusCode(_0x144271,_0x3b95cc){_0x3b95cc=_0x3b95cc||0xcc;return function(_0x331905){if(_0x331905){return _0x144271[_0x09c0('0x1b')](_0x3b95cc);}return _0x144271[_0x09c0('0x1c')](_0x3b95cc)[_0x09c0('0x1d')]();};}function respondWithResult(_0x3649d2,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x254598){if(_0x254598){return _0x3649d2[_0x09c0('0x1c')](_0x16e490)[_0x09c0('0x1e')](_0x254598);}};}function respondWithFilteredResult(_0x33c3d6,_0x2fdf11){return function(_0x4ff6b7){if(_0x4ff6b7){var _0x590129=typeof _0x2fdf11['offset']===_0x09c0('0x1f')&&typeof _0x2fdf11[_0x09c0('0x20')]===_0x09c0('0x1f');var _0x628272=_0x4ff6b7['count'];var _0x2c4440=_0x590129?0x0:_0x2fdf11['offset'];var _0x4c29a7=_0x590129?_0x4ff6b7[_0x09c0('0x21')]:_0x2fdf11['offset']+_0x2fdf11[_0x09c0('0x20')];var _0x319c36;if(_0x4c29a7>=_0x628272){_0x4c29a7=_0x628272;_0x319c36=0xc8;}else{_0x319c36=0xce;}_0x33c3d6[_0x09c0('0x1c')](_0x319c36);return _0x33c3d6['set'](_0x09c0('0x22'),_0x2c4440+'-'+_0x4c29a7+'/'+_0x628272)[_0x09c0('0x1e')](_0x4ff6b7);}return null;};}function patchUpdates(_0x8ad645){return function(_0x3447c5){try{jsonpatch[_0x09c0('0x23')](_0x3447c5,_0x8ad645,!![]);}catch(_0xa5d16f){return BPromise[_0x09c0('0x24')](_0xa5d16f);}return _0x3447c5['save']();};}function saveUpdates(_0x1695e8,_0x46f171){return function(_0x473fbd){if(_0x473fbd){return _0x473fbd[_0x09c0('0x25')](_0x1695e8)['then'](function(_0x4f6824){return _0x4f6824;});}return null;};}function removeEntity(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(_0x1e8a1c){return _0x1e8a1c[_0x09c0('0x26')]()['then'](function(){var _0x42ebfc=_0x1e8a1c[_0x09c0('0x27')]({'plain':!![]});var _0x56d883=_0x09c0('0x28');return db[_0x09c0('0x29')][_0x09c0('0x26')]({'where':{'type':_0x56d883,'resourceId':_0x42ebfc['id']}})[_0x09c0('0x2a')](function(){return _0x1e8a1c;});})[_0x09c0('0x2a')](function(){_0x321bcc[_0x09c0('0x1c')](0xcc)[_0x09c0('0x1d')]();});}};}function handleEntityNotFound(_0x35b61c,_0x1ea951){return function(_0x1aa80e){if(!_0x1aa80e){_0x35b61c[_0x09c0('0x1b')](0x194);}return _0x1aa80e;};}function handleError(_0x5e53ac,_0x15a667){_0x15a667=_0x15a667||0x1f4;return function(_0x1bdde9){logger['error'](_0x1bdde9[_0x09c0('0x2b')]);if(_0x1bdde9['name']){delete _0x1bdde9[_0x09c0('0x2c')];}_0x5e53ac['status'](_0x15a667)[_0x09c0('0x2d')](_0x1bdde9);};}exports[_0x09c0('0x2e')]=function(_0x108409,_0x4159bc){var _0x4e999a={},_0x5478b7={},_0x17c374={'count':0x0,'rows':[]};var _0x38a315=_[_0x09c0('0x2f')](db['VoiceMail'][_0x09c0('0x30')],function(_0x4bdae9){return{'name':_0x4bdae9[_0x09c0('0x31')],'type':_0x4bdae9[_0x09c0('0x32')][_0x09c0('0x33')]};});_0x5478b7['model']=_[_0x09c0('0x2f')](_0x38a315,_0x09c0('0x2c'));_0x5478b7[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x108409[_0x09c0('0x34')]);_0x5478b7[_0x09c0('0x36')]=_[_0x09c0('0x37')](_0x5478b7['model'],_0x5478b7[_0x09c0('0x34')]);_0x4e999a[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x5478b7[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x108409['query'][_0x09c0('0x3a')]));_0x4e999a[_0x09c0('0x38')]=_0x4e999a[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x4e999a[_0x09c0('0x38')]:_0x5478b7['model'];if(!_0x108409[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x4e999a[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x108409[_0x09c0('0x34')][_0x09c0('0x20')]);_0x4e999a['offset']=qs[_0x09c0('0x3e')](_0x108409[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x4e999a[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x108409['query']['sort']);_0x4e999a['where']=qs['filters'](_[_0x09c0('0x41')](_0x108409[_0x09c0('0x34')],_0x5478b7[_0x09c0('0x36')]),_0x38a315);if(_0x108409[_0x09c0('0x34')][_0x09c0('0x42')]){_0x4e999a['where']=_[_0x09c0('0x43')](_0x4e999a[_0x09c0('0x44')],{'$or':_['map'](_0x38a315,function(_0x1067cf){if(_0x1067cf['type']!==_0x09c0('0x45')){var _0x5c80a2={};_0x5c80a2[_0x1067cf[_0x09c0('0x2c')]]={'$like':'%'+_0x108409[_0x09c0('0x34')]['filter']+'%'};return _0x5c80a2;}})});}_0x4e999a=_[_0x09c0('0x43')]({},_0x4e999a,_0x108409[_0x09c0('0x46')]);var _0x5d69fd={'where':_0x4e999a[_0x09c0('0x44')]};return db[_0x09c0('0x47')][_0x09c0('0x21')](_0x5d69fd)[_0x09c0('0x2a')](function(_0xeb8191){_0x17c374[_0x09c0('0x21')]=_0xeb8191;if(_0x108409['query'][_0x09c0('0x48')]){_0x4e999a[_0x09c0('0x49')]=[{'all':!![]}];}return db[_0x09c0('0x47')]['findAll'](_0x4e999a);})[_0x09c0('0x2a')](function(_0x30c0c5){_0x17c374[_0x09c0('0x4a')]=_0x30c0c5;return _0x17c374;})['then'](respondWithFilteredResult(_0x4159bc,_0x4e999a))[_0x09c0('0x4b')](handleError(_0x4159bc,null));};exports[_0x09c0('0x4c')]=function(_0x52cd5c,_0x5bbf4e){var _0x397e73={'raw':!![],'where':{'id':_0x52cd5c['params']['id']}},_0x471078={};_0x471078[_0x09c0('0x39')]=_[_0x09c0('0x35')](db['VoiceMail'][_0x09c0('0x30')]);_0x471078[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x52cd5c[_0x09c0('0x34')]);_0x471078[_0x09c0('0x36')]=_['intersection'](_0x471078[_0x09c0('0x39')],_0x471078['query']);_0x397e73['attributes']=_[_0x09c0('0x37')](_0x471078[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x3a')]));_0x397e73[_0x09c0('0x38')]=_0x397e73['attributes']['length']?_0x397e73['attributes']:_0x471078[_0x09c0('0x39')];if(_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x48')]){_0x397e73['include']=[{'all':!![]}];}_0x397e73=_[_0x09c0('0x43')]({},_0x397e73,_0x52cd5c[_0x09c0('0x46')]);return db[_0x09c0('0x47')][_0x09c0('0x4d')](_0x397e73)[_0x09c0('0x2a')](handleEntityNotFound(_0x5bbf4e,null))[_0x09c0('0x2a')](respondWithResult(_0x5bbf4e,null))[_0x09c0('0x4b')](handleError(_0x5bbf4e,null));};exports[_0x09c0('0x4e')]=function(_0x3f6d14,_0x38085c){return db[_0x09c0('0x47')][_0x09c0('0x4e')](_0x3f6d14[_0x09c0('0x4f')],{})[_0x09c0('0x2a')](function(_0x332b69){var _0x32abbe=_0x3f6d14[_0x09c0('0x50')][_0x09c0('0x27')]({'plain':!![]});if(!_0x32abbe)throw new Error(_0x09c0('0x51'));if(_0x32abbe[_0x09c0('0x52')]==='user'){var _0x4acf54=_0x332b69[_0x09c0('0x27')]({'plain':!![]});var _0x15b0a2=_0x09c0('0x28');return db[_0x09c0('0x53')]['find']({'where':{'name':_0x15b0a2,'userProfileId':_0x32abbe[_0x09c0('0x54')]},'raw':!![]})[_0x09c0('0x2a')](function(_0x1823c2){if(_0x1823c2&&_0x1823c2['autoAssociation']===0x0){return db[_0x09c0('0x29')][_0x09c0('0x4e')]({'name':_0x4acf54[_0x09c0('0x2c')],'resourceId':_0x4acf54['id'],'type':_0x1823c2[_0x09c0('0x2c')],'sectionId':_0x1823c2['id']},{})[_0x09c0('0x2a')](function(){return _0x332b69;});}else{return _0x332b69;}})[_0x09c0('0x4b')](function(_0x45ecd0){logger['error'](_0x09c0('0x55'),_0x45ecd0);throw _0x45ecd0;});}return _0x332b69;})[_0x09c0('0x2a')](respondWithResult(_0x38085c,0xc9))[_0x09c0('0x4b')](handleError(_0x38085c,null));};exports[_0x09c0('0x25')]=function(_0x21fe00,_0x316fbd){if(_0x21fe00[_0x09c0('0x4f')]['id']){delete _0x21fe00['body']['id'];}return db['VoiceMail'][_0x09c0('0x4d')]({'where':{'id':_0x21fe00[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x316fbd,null))['then'](saveUpdates(_0x21fe00[_0x09c0('0x4f')],null))['then'](respondWithResult(_0x316fbd,null))[_0x09c0('0x4b')](handleError(_0x316fbd,null));};exports[_0x09c0('0x26')]=function(_0x42d4dd,_0x290618){return db[_0x09c0('0x47')][_0x09c0('0x4d')]({'where':{'id':_0x42d4dd[_0x09c0('0x56')]['id']}})['then'](handleEntityNotFound(_0x290618,null))[_0x09c0('0x2a')](removeEntity(_0x290618,null))[_0x09c0('0x4b')](handleError(_0x290618,null));};exports[_0x09c0('0x57')]=function(_0x270ff2,_0x3a6845,_0x219195){return db[_0x09c0('0x47')][_0x09c0('0x58')]({'where':{'id':_0x270ff2[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x3a6845,null))[_0x09c0('0x2a')](function(_0x4c4339){var _0x34cc0a;var _0x3564e6={},_0x26dc22={};_0x26dc22[_0x09c0('0x39')]=_['keys'](db[_0x09c0('0x59')]['rawAttributes']);_0x26dc22[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x270ff2[_0x09c0('0x34')]);_0x26dc22['filters']=_['intersection'](_0x26dc22[_0x09c0('0x39')],_0x26dc22[_0x09c0('0x34')]);_0x3564e6[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x26dc22['model'],qs[_0x09c0('0x3a')](_0x270ff2[_0x09c0('0x34')]['fields']));_0x3564e6[_0x09c0('0x38')]=_0x3564e6[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x3564e6[_0x09c0('0x38')]:_0x26dc22['model'];if(!_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x3564e6[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x20')]);_0x3564e6[_0x09c0('0x3e')]=qs[_0x09c0('0x3e')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x3564e6[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x270ff2['query'][_0x09c0('0x40')]);_0x3564e6[_0x09c0('0x44')]=qs[_0x09c0('0x36')](_[_0x09c0('0x41')](_0x270ff2[_0x09c0('0x34')],_0x26dc22['filters']));if(_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]){_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'$or':_[_0x09c0('0x2f')](_0x3564e6[_0x09c0('0x38')],function(_0x569462){var _0x325013={};_0x325013[_0x569462]={'$like':'%'+_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]+'%'};return _0x325013;})});}_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'mailboxuser':_0x4c4339[_0x09c0('0x5a')]});_0x3564e6=_[_0x09c0('0x43')]({},_0x3564e6,_0x270ff2[_0x09c0('0x46')]);return db[_0x09c0('0x59')][_0x09c0('0x5b')](_0x3564e6)['then'](respondWithFilteredResult(_0x3a6845,_0x3564e6));})[_0x09c0('0x4b')](handleError(_0x3a6845,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index f37581e..f9f7cef 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 _0xce7a=['rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x30d3b3,_0x4d139c){var _0x37aff6=function(_0x23e066){while(--_0x23e066){_0x30d3b3['push'](_0x30d3b3['shift']());}};_0x37aff6(++_0x4d139c);}(_0xce7a,0x13c));var _0xace7=function(_0x3007bc,_0xea74b4){_0x3007bc=_0x3007bc-0x0;var _0x34162a=_0xce7a[_0x3007bc];return _0x34162a;};'use strict';var _=require(_0xace7('0x0'));var util=require(_0xace7('0x1'));var logger=require(_0xace7('0x2'))(_0xace7('0x3'));var moment=require(_0xace7('0x4'));var BPromise=require(_0xace7('0x5'));var rp=require(_0xace7('0x6'));var fs=require('fs');var path=require(_0xace7('0x7'));var rimraf=require(_0xace7('0x8'));var config=require(_0xace7('0x9'));var attributes=require(_0xace7('0xa'));module[_0xace7('0xb')]=function(_0x418295,_0x2f4b4c){return _0x418295[_0xace7('0xc')](_0xace7('0xd'),attributes,{'tableName':_0xace7('0xe'),'paranoid':![],'indexes':[{'name':_0xace7('0xf'),'fields':[_0xace7('0x10'),_0xace7('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x19d1=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','define','voice_voicemail','context','lodash','util','../../config/logger','api','moment'];(function(_0x512b8d,_0x10602a){var _0x4d72d9=function(_0x2780ee){while(--_0x2780ee){_0x512b8d['push'](_0x512b8d['shift']());}};_0x4d72d9(++_0x10602a);}(_0x19d1,0x79));var _0x119d=function(_0x250454,_0x3e270d){_0x250454=_0x250454-0x0;var _0x32817f=_0x19d1[_0x250454];return _0x32817f;};'use strict';var _=require(_0x119d('0x0'));var util=require(_0x119d('0x1'));var logger=require(_0x119d('0x2'))(_0x119d('0x3'));var moment=require(_0x119d('0x4'));var BPromise=require(_0x119d('0x5'));var rp=require(_0x119d('0x6'));var fs=require('fs');var path=require(_0x119d('0x7'));var rimraf=require(_0x119d('0x8'));var config=require(_0x119d('0x9'));var attributes=require(_0x119d('0xa'));module['exports']=function(_0x3db900,_0x415a13){return _0x3db900[_0x119d('0xb')]('VoiceMail',attributes,{'tableName':_0x119d('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x119d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 481a764..d68d9f4 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 _0x52a6=['message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x52a6,0x16b));var _0x652a=function(_0x153534,_0x13df93){_0x153534=_0x153534-0x0;var _0x45b013=_0x52a6[_0x153534];return _0x45b013;};'use strict';var _=require(_0x652a('0x0'));var util=require(_0x652a('0x1'));var moment=require(_0x652a('0x2'));var BPromise=require('bluebird');var rs=require(_0x652a('0x3'));var fs=require('fs');var Redis=require(_0x652a('0x4'));var db=require(_0x652a('0x5'))['db'];var utils=require(_0x652a('0x6'));var logger=require(_0x652a('0x7'))(_0x652a('0x8'));var config=require(_0x652a('0x9'));var jayson=require(_0x652a('0xa'));var client=jayson[_0x652a('0xb')][_0x652a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x161d52,_0x36d240,_0xa6274b){return new BPromise(function(_0x47c2dc,_0x5d2a7d){return client[_0x652a('0xd')](_0x161d52,_0xa6274b)[_0x652a('0xe')](function(_0x538912){logger['info'](_0x652a('0xf'),_0x36d240,'request\x20sent');logger['debug'](_0x652a('0x10'),_0x36d240,_0x652a('0x11'),JSON[_0x652a('0x12')](_0x538912));if(_0x538912[_0x652a('0x13')]){if(_0x538912['error'][_0x652a('0x14')]===0x1f4){logger[_0x652a('0x13')](_0x652a('0xf'),_0x36d240,_0x538912[_0x652a('0x13')]['message']);return _0x5d2a7d(_0x538912[_0x652a('0x13')][_0x652a('0x15')]);}logger[_0x652a('0x13')](_0x652a('0xf'),_0x36d240,_0x538912['error'][_0x652a('0x15')]);return _0x47c2dc(_0x538912[_0x652a('0x13')][_0x652a('0x15')]);}else{logger[_0x652a('0x16')]('VoiceMail,\x20%s,\x20%s',_0x36d240,'request\x20sent');_0x47c2dc(_0x538912[_0x652a('0x17')][_0x652a('0x15')]);}})['catch'](function(_0xb5be64){logger[_0x652a('0x13')](_0x652a('0xf'),_0x36d240,_0xb5be64);_0x5d2a7d(_0xb5be64);});});} \ No newline at end of file +var _0x9b44=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x6d8a56,_0x3dde22){var _0x66a1a5=function(_0x15ccaa){while(--_0x15ccaa){_0x6d8a56['push'](_0x6d8a56['shift']());}};_0x66a1a5(++_0x3dde22);}(_0x9b44,0xc0));var _0x49b4=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x9b44[_0x8a7e38];return _0x228609;};'use strict';var _=require(_0x49b4('0x0'));var util=require(_0x49b4('0x1'));var moment=require('moment');var BPromise=require(_0x49b4('0x2'));var rs=require(_0x49b4('0x3'));var fs=require('fs');var Redis=require(_0x49b4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x49b4('0x5'));var logger=require(_0x49b4('0x6'))(_0x49b4('0x7'));var config=require(_0x49b4('0x8'));var jayson=require(_0x49b4('0x9'));var client=jayson[_0x49b4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x473633,_0x323ed7,_0xd9bd4a){return new BPromise(function(_0x365b27,_0x1ff1a4){return client[_0x49b4('0xb')](_0x473633,_0xd9bd4a)[_0x49b4('0xc')](function(_0x15ebd4){logger[_0x49b4('0xd')](_0x49b4('0xe'),_0x323ed7,_0x49b4('0xf'));logger[_0x49b4('0x10')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x323ed7,_0x49b4('0xf'),JSON[_0x49b4('0x11')](_0x15ebd4));if(_0x15ebd4[_0x49b4('0x12')]){if(_0x15ebd4[_0x49b4('0x12')][_0x49b4('0x13')]===0x1f4){logger[_0x49b4('0x12')](_0x49b4('0xe'),_0x323ed7,_0x15ebd4[_0x49b4('0x12')]['message']);return _0x1ff1a4(_0x15ebd4[_0x49b4('0x12')][_0x49b4('0x14')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x323ed7,_0x15ebd4['error'][_0x49b4('0x14')]);return _0x365b27(_0x15ebd4[_0x49b4('0x12')][_0x49b4('0x14')]);}else{logger['info'](_0x49b4('0xe'),_0x323ed7,_0x49b4('0xf'));_0x365b27(_0x15ebd4['result'][_0x49b4('0x14')]);}})[_0x49b4('0x15')](function(_0x22c1d8){logger[_0x49b4('0x12')](_0x49b4('0xe'),_0x323ed7,_0x22c1d8);_0x1ff1a4(_0x22c1d8);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index fb657e6..69e1848 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 _0xad67=['isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/download'];(function(_0x212d22,_0x2309d2){var _0x48f2b1=function(_0x43cc92){while(--_0x43cc92){_0x212d22['push'](_0x212d22['shift']());}};_0x48f2b1(++_0x2309d2);}(_0xad67,0x76));var _0x7ad6=function(_0x5a6744,_0x144876){_0x5a6744=_0x5a6744-0x0;var _0xff7177=_0xad67[_0x5a6744];return _0xff7177;};'use strict';var multer=require(_0x7ad6('0x0'));var util=require(_0x7ad6('0x1'));var path=require(_0x7ad6('0x2'));var timeout=require('connect-timeout');var express=require(_0x7ad6('0x3'));var router=express[_0x7ad6('0x4')]();var fs_extra=require(_0x7ad6('0x5'));var auth=require(_0x7ad6('0x6'));var interaction=require(_0x7ad6('0x7'));var config=require(_0x7ad6('0x8'));var controller=require('./voiceMailMessage.controller');router[_0x7ad6('0x9')]('/',auth['isAuthenticated'](),controller[_0x7ad6('0xa')]);router[_0x7ad6('0x9')](_0x7ad6('0xb'),auth['isAuthenticated'](),controller[_0x7ad6('0xc')]);router[_0x7ad6('0x9')](_0x7ad6('0xd'),auth[_0x7ad6('0xe')](),controller['download']);router[_0x7ad6('0xf')]('/',auth['isAuthenticated'](),controller[_0x7ad6('0x10')]);router[_0x7ad6('0x11')]('/:id',auth[_0x7ad6('0xe')](),controller[_0x7ad6('0x12')]);router[_0x7ad6('0x13')](_0x7ad6('0xb'),auth[_0x7ad6('0xe')](),controller[_0x7ad6('0x14')]);module[_0x7ad6('0x15')]=router; \ No newline at end of file +var _0x4bdd=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','show','download','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x25d4ab,_0x307164){var _0x3b31f3=function(_0x12f56c){while(--_0x12f56c){_0x25d4ab['push'](_0x25d4ab['shift']());}};_0x3b31f3(++_0x307164);}(_0x4bdd,0xaf));var _0xd4bd=function(_0x31ccbc,_0x34930e){_0x31ccbc=_0x31ccbc-0x0;var _0x4654ec=_0x4bdd[_0x31ccbc];return _0x4654ec;};'use strict';var multer=require(_0xd4bd('0x0'));var util=require(_0xd4bd('0x1'));var path=require('path');var timeout=require(_0xd4bd('0x2'));var express=require(_0xd4bd('0x3'));var router=express[_0xd4bd('0x4')]();var fs_extra=require(_0xd4bd('0x5'));var auth=require(_0xd4bd('0x6'));var interaction=require(_0xd4bd('0x7'));var config=require('../../config/environment');var controller=require(_0xd4bd('0x8'));router['get']('/',auth[_0xd4bd('0x9')](),controller[_0xd4bd('0xa')]);router[_0xd4bd('0xb')](_0xd4bd('0xc'),auth[_0xd4bd('0x9')](),controller[_0xd4bd('0xd')]);router[_0xd4bd('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0xd4bd('0xe')]);router['post']('/',auth[_0xd4bd('0x9')](),controller[_0xd4bd('0xf')]);router['put'](_0xd4bd('0xc'),auth[_0xd4bd('0x9')](),controller[_0xd4bd('0x10')]);router[_0xd4bd('0x11')](_0xd4bd('0xc'),auth[_0xd4bd('0x9')](),controller[_0xd4bd('0x12')]);module[_0xd4bd('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 2b153ac..3f7c07c 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 _0x5aab=['STRING','BLOB','long','literal','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x59e09e,_0x178b27){var _0x355105=function(_0x56b703){while(--_0x56b703){_0x59e09e['push'](_0x59e09e['shift']());}};_0x355105(++_0x178b27);}(_0x5aab,0x174));var _0xb5aa=function(_0x16843e,_0x237eb9){_0x16843e=_0x16843e-0x0;var _0x5c9dd3=_0x5aab[_0x16843e];return _0x5c9dd3;};'use strict';var Sequelize=require(_0xb5aa('0x0'));module[_0xb5aa('0x1')]={'name':{'type':Sequelize[_0xb5aa('0x2')],'get':function(_0x4cba6a){return this[_0xb5aa('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb5aa('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xb5aa('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb5aa('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xb5aa('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xb5aa('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xb5aa('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb5aa('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xb5aa('0x5')](_0xb5aa('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb5aa('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xb5aa('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x9106=['exports','getDataValue','STRING','BLOB','long','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x466a8d,_0x33a801){var _0x3b61de=function(_0x235a24){while(--_0x235a24){_0x466a8d['push'](_0x466a8d['shift']());}};_0x3b61de(++_0x33a801);}(_0x9106,0x198));var _0x6910=function(_0x190f92,_0x5180cc){_0x190f92=_0x190f92-0x0;var _0x3297f1=_0x9106[_0x190f92];return _0x3297f1;};'use strict';var Sequelize=require('sequelize');module[_0x6910('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1dc2e4){return this[_0x6910('0x1')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x6910('0x2')],'defaultValue':''},'origtime':{'type':Sequelize[_0x6910('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0x6910('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6910('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6910('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0x6910('0x3')](_0x6910('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x6910('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0x6910('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 729bae7..c536f13 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 _0x568f=['then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','VoiceMailMessage','include','findAll','rows','catch','params','length','includeAll','options','find','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save'];(function(_0x2efc2e,_0x4345f6){var _0x33f5aa=function(_0x334689){while(--_0x334689){_0x2efc2e['push'](_0x2efc2e['shift']());}};_0x33f5aa(++_0x4345f6);}(_0x568f,0x168));var _0xf568=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x568f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf568('0x0'));var rimraf=require(_0xf568('0x1'));var zipdir=require(_0xf568('0x2'));var jsonpatch=require(_0xf568('0x3'));var rp=require(_0xf568('0x4'));var moment=require(_0xf568('0x5'));var BPromise=require(_0xf568('0x6'));var Mustache=require(_0xf568('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf568('0x8'));var ejs=require(_0xf568('0x9'));var fs=require('fs');var fs_extra=require(_0xf568('0xa'));var _=require(_0xf568('0xb'));var squel=require(_0xf568('0xc'));var crypto=require(_0xf568('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf568('0xe'));var toCsv=require(_0xf568('0x8'));var querystring=require(_0xf568('0xf'));var Papa=require(_0xf568('0x10'));var Redis=require(_0xf568('0x11'));var authService=require(_0xf568('0x12'));var qs=require(_0xf568('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf568('0x14'))(_0xf568('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf568('0x16'))['db'];function respondWithStatusCode(_0xb0aaaf,_0x27d190){_0x27d190=_0x27d190||0xcc;return function(_0x4e0c4e){if(_0x4e0c4e){return _0xb0aaaf[_0xf568('0x17')](_0x27d190);}return _0xb0aaaf[_0xf568('0x18')](_0x27d190)[_0xf568('0x19')]();};}function respondWithResult(_0x2a954e,_0x1bd786){_0x1bd786=_0x1bd786||0xc8;return function(_0x46dce1){if(_0x46dce1){return _0x2a954e[_0xf568('0x18')](_0x1bd786)[_0xf568('0x1a')](_0x46dce1);}};}function respondWithFilteredResult(_0x18cd95,_0x2ae651){return function(_0x5ec170){if(_0x5ec170){var _0x2a52d7=typeof _0x2ae651[_0xf568('0x1b')]===_0xf568('0x1c')&&typeof _0x2ae651[_0xf568('0x1d')]===_0xf568('0x1c');var _0xe8792b=_0x5ec170[_0xf568('0x1e')];var _0xd6f7cd=_0x2a52d7?0x0:_0x2ae651[_0xf568('0x1b')];var _0x1fd4e2=_0x2a52d7?_0x5ec170[_0xf568('0x1e')]:_0x2ae651[_0xf568('0x1b')]+_0x2ae651[_0xf568('0x1d')];var _0x3616fe;if(_0x1fd4e2>=_0xe8792b){_0x1fd4e2=_0xe8792b;_0x3616fe=0xc8;}else{_0x3616fe=0xce;}_0x18cd95[_0xf568('0x18')](_0x3616fe);return _0x18cd95[_0xf568('0x1f')](_0xf568('0x20'),_0xd6f7cd+'-'+_0x1fd4e2+'/'+_0xe8792b)[_0xf568('0x1a')](_0x5ec170);}return null;};}function patchUpdates(_0x3cfb8e){return function(_0x3b714d){try{jsonpatch['apply'](_0x3b714d,_0x3cfb8e,!![]);}catch(_0xa8edc4){return BPromise[_0xf568('0x21')](_0xa8edc4);}return _0x3b714d[_0xf568('0x22')]();};}function saveUpdates(_0x4f1649,_0x3e2e34){return function(_0x12b342){if(_0x12b342){return _0x12b342['update'](_0x4f1649)[_0xf568('0x23')](function(_0x771cd5){return _0x771cd5;});}return null;};}function removeEntity(_0x2036fe,_0x3bc529){return function(_0x2651de){if(_0x2651de){return _0x2651de[_0xf568('0x24')]()[_0xf568('0x23')](function(){_0x2036fe[_0xf568('0x18')](0xcc)[_0xf568('0x19')]();});}};}function handleEntityNotFound(_0x22c900,_0x3ff952){return function(_0x5a07b1){if(!_0x5a07b1){_0x22c900[_0xf568('0x17')](0x194);}return _0x5a07b1;};}function handleError(_0x16d7dd,_0x528952){_0x528952=_0x528952||0x1f4;return function(_0x20d1cc){logger[_0xf568('0x25')](_0x20d1cc[_0xf568('0x26')]);if(_0x20d1cc[_0xf568('0x27')]){delete _0x20d1cc['name'];}_0x16d7dd[_0xf568('0x18')](_0x528952)[_0xf568('0x28')](_0x20d1cc);};}exports['index']=function(_0x3de9dd,_0x101ce7){var _0x4a98c3={},_0x28d7e2={},_0x4cf7d5={'count':0x0,'rows':[]};var _0x1f87c5=_[_0xf568('0x29')](db['VoiceMailMessage'][_0xf568('0x2a')],function(_0x54136f){return{'name':_0x54136f[_0xf568('0x2b')],'type':_0x54136f[_0xf568('0x2c')][_0xf568('0x2d')]};});_0x28d7e2[_0xf568('0x2e')]=_['differenceBy'](_['map'](_0x1f87c5,'name'),[_0xf568('0x27')]);_0x28d7e2[_0xf568('0x2f')]=_[_0xf568('0x30')](_0x3de9dd[_0xf568('0x2f')]);_0x28d7e2['filters']=_[_0xf568('0x31')](_0x28d7e2[_0xf568('0x2e')],_0x28d7e2[_0xf568('0x2f')]);_0x4a98c3[_0xf568('0x32')]=_[_0xf568('0x31')](_0x28d7e2[_0xf568('0x2e')],qs[_0xf568('0x33')](_0x3de9dd[_0xf568('0x2f')][_0xf568('0x33')]));_0x4a98c3[_0xf568('0x32')]=_0x4a98c3[_0xf568('0x32')]['length']?_0x4a98c3[_0xf568('0x32')]:_0x28d7e2[_0xf568('0x2e')];if(!_0x3de9dd[_0xf568('0x2f')][_0xf568('0x34')](_0xf568('0x35'))){_0x4a98c3['limit']=qs[_0xf568('0x1d')](_0x3de9dd[_0xf568('0x2f')][_0xf568('0x1d')]);_0x4a98c3[_0xf568('0x1b')]=qs[_0xf568('0x1b')](_0x3de9dd[_0xf568('0x2f')][_0xf568('0x1b')]);}_0x4a98c3[_0xf568('0x36')]=qs['sort'](_0x3de9dd[_0xf568('0x2f')]['sort']);_0x4a98c3[_0xf568('0x37')]=qs['filters'](_['pick'](_0x3de9dd['query'],_0x28d7e2[_0xf568('0x38')]),_0x1f87c5);if(_0x3de9dd[_0xf568('0x2f')]['filter']){_0x4a98c3['where']=_[_0xf568('0x39')](_0x4a98c3[_0xf568('0x37')],{'$or':_[_0xf568('0x29')](_0x1f87c5,function(_0x315fce){if(_0x315fce[_0xf568('0x2c')]!==_0xf568('0x3a')){var _0x55e77d={};_0x55e77d[_0x315fce[_0xf568('0x27')]]={'$like':'%'+_0x3de9dd['query']['filter']+'%'};return _0x55e77d;}})});}_0x4a98c3=_[_0xf568('0x39')]({},_0x4a98c3,_0x3de9dd['options']);var _0x30e66f={'where':_0x4a98c3['where']};return db[_0xf568('0x3b')][_0xf568('0x1e')](_0x30e66f)[_0xf568('0x23')](function(_0x21a2ed){_0x4cf7d5[_0xf568('0x1e')]=_0x21a2ed;if(_0x3de9dd[_0xf568('0x2f')]['includeAll']){_0x4a98c3[_0xf568('0x3c')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xf568('0x3d')](_0x4a98c3);})[_0xf568('0x23')](function(_0x3b350b){_0x4cf7d5[_0xf568('0x3e')]=_0x3b350b;return _0x4cf7d5;})['then'](respondWithFilteredResult(_0x101ce7,_0x4a98c3))[_0xf568('0x3f')](handleError(_0x101ce7,null));};exports['show']=function(_0x3b04e4,_0x499060){var _0x459ec8={'raw':!![],'where':{'id':_0x3b04e4[_0xf568('0x40')]['id']}},_0x4c6c50={};_0x4c6c50[_0xf568('0x2e')]=_[_0xf568('0x30')](db[_0xf568('0x3b')][_0xf568('0x2a')]);_0x4c6c50[_0xf568('0x2f')]=_[_0xf568('0x30')](_0x3b04e4['query']);_0x4c6c50[_0xf568('0x38')]=_[_0xf568('0x31')](_0x4c6c50[_0xf568('0x2e')],_0x4c6c50[_0xf568('0x2f')]);_0x459ec8[_0xf568('0x32')]=_[_0xf568('0x31')](_0x4c6c50[_0xf568('0x2e')],qs[_0xf568('0x33')](_0x3b04e4['query'][_0xf568('0x33')]));_0x459ec8[_0xf568('0x32')]=_0x459ec8[_0xf568('0x32')][_0xf568('0x41')]?_0x459ec8[_0xf568('0x32')]:_0x4c6c50[_0xf568('0x2e')];if(_0x3b04e4['query'][_0xf568('0x42')]){_0x459ec8['include']=[{'all':!![]}];}_0x459ec8=_['merge']({},_0x459ec8,_0x3b04e4[_0xf568('0x43')]);return db[_0xf568('0x3b')][_0xf568('0x44')](_0x459ec8)['then'](handleEntityNotFound(_0x499060,null))[_0xf568('0x23')](respondWithResult(_0x499060,null))[_0xf568('0x3f')](handleError(_0x499060,null));};exports[_0xf568('0x45')]=function(_0x4180bf,_0x280b34){return db[_0xf568('0x3b')][_0xf568('0x45')](_0x4180bf['body'],{})['then'](respondWithResult(_0x280b34,0xc9))[_0xf568('0x3f')](handleError(_0x280b34,null));};exports['update']=function(_0x2214ab,_0x344070){if(_0x2214ab[_0xf568('0x46')]['id']){delete _0x2214ab[_0xf568('0x46')]['id'];}return db[_0xf568('0x3b')][_0xf568('0x44')]({'where':{'id':_0x2214ab[_0xf568('0x40')]['id']}})[_0xf568('0x23')](handleEntityNotFound(_0x344070,null))[_0xf568('0x23')](saveUpdates(_0x2214ab['body'],null))[_0xf568('0x23')](respondWithResult(_0x344070,null))['catch'](handleError(_0x344070,null));};exports[_0xf568('0x24')]=function(_0x2db406,_0x2b6137){return db[_0xf568('0x3b')]['find']({'where':{'id':_0x2db406['params']['id']}})[_0xf568('0x23')](handleEntityNotFound(_0x2b6137,null))[_0xf568('0x23')](removeEntity(_0x2b6137,null))['catch'](handleError(_0x2b6137,null));};exports[_0xf568('0x47')]=function(_0x290d4f,_0x58b720,_0xdbcc62){return db[_0xf568('0x3b')][_0xf568('0x44')]({'where':{'id':_0x290d4f[_0xf568('0x40')]['id']},'attributes':['id',_0xf568('0x48'),'msg_id']})['then'](handleEntityNotFound(_0x58b720,null))[_0xf568('0x23')](function(_0xb99786){if(_0xb99786){if(!_0xb99786[_0xf568('0x48')]){throw new db[(_0xf568('0x49'))][(_0xf568('0x4a'))](_0xf568('0x4b'));}var _0x557f02={'Content-Type':_0xf568('0x4c'),'Content-Disposition':'attachment'};if(_0xb99786[_0xf568('0x4d')]){_0x557f02['Content-Disposition']=_0xf568('0x4e')+_0xb99786[_0xf568('0x4d')]+'.wav\x22';}_0x58b720[_0xf568('0x1f')](_0x557f02);return _0x58b720[_0xf568('0x28')](new Buffer(_0xb99786['recording']));}})[_0xf568('0x3f')](handleError(_0x58b720,null));}; \ No newline at end of file +var _0x24c2=['set','Content-Range','json','apply','reject','update','destroy','then','sendStatus','error','stack','name','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','find','catch','create','body','params','download','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','msg_id','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../mysqldb','end','status','undefined','count','offset','limit'];(function(_0x193070,_0x172524){var _0x26c876=function(_0x273563){while(--_0x273563){_0x193070['push'](_0x193070['shift']());}};_0x26c876(++_0x172524);}(_0x24c2,0x121));var _0x224c=function(_0x2c4260,_0x19882c){_0x2c4260=_0x2c4260-0x0;var _0x13972e=_0x24c2[_0x2c4260];return _0x13972e;};'use strict';var emlformat=require(_0x224c('0x0'));var rimraf=require(_0x224c('0x1'));var zipdir=require(_0x224c('0x2'));var jsonpatch=require(_0x224c('0x3'));var rp=require(_0x224c('0x4'));var moment=require(_0x224c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x224c('0x6'));var util=require(_0x224c('0x7'));var path=require(_0x224c('0x8'));var sox=require(_0x224c('0x9'));var csv=require(_0x224c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x224c('0xb'));var _=require(_0x224c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x224c('0xd'));var deskjs=require(_0x224c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x224c('0xf'));var Papa=require('papaparse');var Redis=require(_0x224c('0x10'));var authService=require(_0x224c('0x11'));var qs=require(_0x224c('0x12'));var as=require(_0x224c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x224c('0x14'))['db'];function respondWithStatusCode(_0x414519,_0x4fccb8){_0x4fccb8=_0x4fccb8||0xcc;return function(_0x3e161c){if(_0x3e161c){return _0x414519['sendStatus'](_0x4fccb8);}return _0x414519['status'](_0x4fccb8)[_0x224c('0x15')]();};}function respondWithResult(_0x227733,_0x2f2b4d){_0x2f2b4d=_0x2f2b4d||0xc8;return function(_0x4109e2){if(_0x4109e2){return _0x227733[_0x224c('0x16')](_0x2f2b4d)['json'](_0x4109e2);}};}function respondWithFilteredResult(_0x19dae8,_0x3d448c){return function(_0x2b97c4){if(_0x2b97c4){var _0x444024=typeof _0x3d448c['offset']===_0x224c('0x17')&&typeof _0x3d448c['limit']===_0x224c('0x17');var _0x53312c=_0x2b97c4[_0x224c('0x18')];var _0x169005=_0x444024?0x0:_0x3d448c[_0x224c('0x19')];var _0x46e339=_0x444024?_0x2b97c4[_0x224c('0x18')]:_0x3d448c['offset']+_0x3d448c[_0x224c('0x1a')];var _0x13810e;if(_0x46e339>=_0x53312c){_0x46e339=_0x53312c;_0x13810e=0xc8;}else{_0x13810e=0xce;}_0x19dae8[_0x224c('0x16')](_0x13810e);return _0x19dae8[_0x224c('0x1b')](_0x224c('0x1c'),_0x169005+'-'+_0x46e339+'/'+_0x53312c)[_0x224c('0x1d')](_0x2b97c4);}return null;};}function patchUpdates(_0x17e8c5){return function(_0xa0da2f){try{jsonpatch[_0x224c('0x1e')](_0xa0da2f,_0x17e8c5,!![]);}catch(_0x34af78){return BPromise[_0x224c('0x1f')](_0x34af78);}return _0xa0da2f['save']();};}function saveUpdates(_0x4be527,_0x52d74b){return function(_0x7a506b){if(_0x7a506b){return _0x7a506b[_0x224c('0x20')](_0x4be527)['then'](function(_0x391c06){return _0x391c06;});}return null;};}function removeEntity(_0x3c0c7a,_0x5ea9e9){return function(_0x24a255){if(_0x24a255){return _0x24a255[_0x224c('0x21')]()[_0x224c('0x22')](function(){_0x3c0c7a['status'](0xcc)[_0x224c('0x15')]();});}};}function handleEntityNotFound(_0x55c83a,_0x3828dc){return function(_0x15ac90){if(!_0x15ac90){_0x55c83a[_0x224c('0x23')](0x194);}return _0x15ac90;};}function handleError(_0x1bebf6,_0x4abd35){_0x4abd35=_0x4abd35||0x1f4;return function(_0x469eb6){logger[_0x224c('0x24')](_0x469eb6[_0x224c('0x25')]);if(_0x469eb6['name']){delete _0x469eb6[_0x224c('0x26')];}_0x1bebf6[_0x224c('0x16')](_0x4abd35)['send'](_0x469eb6);};}exports[_0x224c('0x27')]=function(_0x2959f7,_0x574045){var _0x382fb6={},_0x2f0c5c={},_0x438430={'count':0x0,'rows':[]};var _0x7601ca=_[_0x224c('0x28')](db[_0x224c('0x29')][_0x224c('0x2a')],function(_0x4dc07f){return{'name':_0x4dc07f[_0x224c('0x2b')],'type':_0x4dc07f[_0x224c('0x2c')][_0x224c('0x2d')]};});_0x2f0c5c[_0x224c('0x2e')]=_[_0x224c('0x2f')](_[_0x224c('0x28')](_0x7601ca,_0x224c('0x26')),[_0x224c('0x26')]);_0x2f0c5c['query']=_[_0x224c('0x30')](_0x2959f7[_0x224c('0x31')]);_0x2f0c5c[_0x224c('0x32')]=_[_0x224c('0x33')](_0x2f0c5c['model'],_0x2f0c5c[_0x224c('0x31')]);_0x382fb6['attributes']=_[_0x224c('0x33')](_0x2f0c5c[_0x224c('0x2e')],qs[_0x224c('0x34')](_0x2959f7[_0x224c('0x31')][_0x224c('0x34')]));_0x382fb6[_0x224c('0x35')]=_0x382fb6[_0x224c('0x35')]['length']?_0x382fb6[_0x224c('0x35')]:_0x2f0c5c[_0x224c('0x2e')];if(!_0x2959f7['query']['hasOwnProperty'](_0x224c('0x36'))){_0x382fb6['limit']=qs[_0x224c('0x1a')](_0x2959f7[_0x224c('0x31')]['limit']);_0x382fb6[_0x224c('0x19')]=qs[_0x224c('0x19')](_0x2959f7[_0x224c('0x31')][_0x224c('0x19')]);}_0x382fb6[_0x224c('0x37')]=qs['sort'](_0x2959f7[_0x224c('0x31')][_0x224c('0x38')]);_0x382fb6['where']=qs[_0x224c('0x32')](_[_0x224c('0x39')](_0x2959f7[_0x224c('0x31')],_0x2f0c5c[_0x224c('0x32')]),_0x7601ca);if(_0x2959f7['query'][_0x224c('0x3a')]){_0x382fb6['where']=_['merge'](_0x382fb6[_0x224c('0x3b')],{'$or':_[_0x224c('0x28')](_0x7601ca,function(_0x59fbc4){if(_0x59fbc4[_0x224c('0x2c')]!==_0x224c('0x3c')){var _0x4dfb54={};_0x4dfb54[_0x59fbc4[_0x224c('0x26')]]={'$like':'%'+_0x2959f7[_0x224c('0x31')][_0x224c('0x3a')]+'%'};return _0x4dfb54;}})});}_0x382fb6=_[_0x224c('0x3d')]({},_0x382fb6,_0x2959f7[_0x224c('0x3e')]);var _0x1fb306={'where':_0x382fb6[_0x224c('0x3b')]};return db[_0x224c('0x29')]['count'](_0x1fb306)[_0x224c('0x22')](function(_0x2ecb92){_0x438430['count']=_0x2ecb92;if(_0x2959f7[_0x224c('0x31')][_0x224c('0x3f')]){_0x382fb6['include']=[{'all':!![]}];}return db[_0x224c('0x29')]['findAll'](_0x382fb6);})[_0x224c('0x22')](function(_0x2890a0){_0x438430['rows']=_0x2890a0;return _0x438430;})['then'](respondWithFilteredResult(_0x574045,_0x382fb6))['catch'](handleError(_0x574045,null));};exports['show']=function(_0x16e22d,_0x18c4ed){var _0xac3372={'raw':!![],'where':{'id':_0x16e22d['params']['id']}},_0x53006b={};_0x53006b[_0x224c('0x2e')]=_['keys'](db[_0x224c('0x29')][_0x224c('0x2a')]);_0x53006b[_0x224c('0x31')]=_[_0x224c('0x30')](_0x16e22d[_0x224c('0x31')]);_0x53006b[_0x224c('0x32')]=_[_0x224c('0x33')](_0x53006b[_0x224c('0x2e')],_0x53006b['query']);_0xac3372[_0x224c('0x35')]=_[_0x224c('0x33')](_0x53006b[_0x224c('0x2e')],qs[_0x224c('0x34')](_0x16e22d[_0x224c('0x31')][_0x224c('0x34')]));_0xac3372[_0x224c('0x35')]=_0xac3372[_0x224c('0x35')]['length']?_0xac3372[_0x224c('0x35')]:_0x53006b[_0x224c('0x2e')];if(_0x16e22d[_0x224c('0x31')][_0x224c('0x3f')]){_0xac3372[_0x224c('0x40')]=[{'all':!![]}];}_0xac3372=_['merge']({},_0xac3372,_0x16e22d['options']);return db[_0x224c('0x29')][_0x224c('0x41')](_0xac3372)[_0x224c('0x22')](handleEntityNotFound(_0x18c4ed,null))[_0x224c('0x22')](respondWithResult(_0x18c4ed,null))[_0x224c('0x42')](handleError(_0x18c4ed,null));};exports[_0x224c('0x43')]=function(_0x5a6155,_0xd81830){return db[_0x224c('0x29')][_0x224c('0x43')](_0x5a6155[_0x224c('0x44')],{})[_0x224c('0x22')](respondWithResult(_0xd81830,0xc9))[_0x224c('0x42')](handleError(_0xd81830,null));};exports[_0x224c('0x20')]=function(_0xf54f02,_0xb404ef){if(_0xf54f02[_0x224c('0x44')]['id']){delete _0xf54f02[_0x224c('0x44')]['id'];}return db[_0x224c('0x29')][_0x224c('0x41')]({'where':{'id':_0xf54f02['params']['id']}})[_0x224c('0x22')](handleEntityNotFound(_0xb404ef,null))[_0x224c('0x22')](saveUpdates(_0xf54f02[_0x224c('0x44')],null))[_0x224c('0x22')](respondWithResult(_0xb404ef,null))[_0x224c('0x42')](handleError(_0xb404ef,null));};exports['destroy']=function(_0x582146,_0x189c10){return db[_0x224c('0x29')][_0x224c('0x41')]({'where':{'id':_0x582146[_0x224c('0x45')]['id']}})['then'](handleEntityNotFound(_0x189c10,null))[_0x224c('0x22')](removeEntity(_0x189c10,null))['catch'](handleError(_0x189c10,null));};exports[_0x224c('0x46')]=function(_0x3f8a15,_0xd2a1b4,_0x57aab1){return db['VoiceMailMessage'][_0x224c('0x41')]({'where':{'id':_0x3f8a15[_0x224c('0x45')]['id']},'attributes':['id','recording','msg_id']})[_0x224c('0x22')](handleEntityNotFound(_0xd2a1b4,null))[_0x224c('0x22')](function(_0x9c6c84){if(_0x9c6c84){if(!_0x9c6c84[_0x224c('0x47')]){throw new db['Sequelize'][(_0x224c('0x48'))](_0x224c('0x49'));}var _0x4a7991={'Content-Type':_0x224c('0x4a'),'Content-Disposition':_0x224c('0x4b')};if(_0x9c6c84['msg_id']){_0x4a7991[_0x224c('0x4c')]=_0x224c('0x4d')+_0x9c6c84[_0x224c('0x4e')]+'.wav\x22';}_0xd2a1b4[_0x224c('0x1b')](_0x4a7991);return _0xd2a1b4['send'](new Buffer(_0x9c6c84[_0x224c('0x47')]));}})['catch'](handleError(_0xd2a1b4,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 2a8670d..b928685 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 _0x60f0=['define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x60f0,0x156));var _0x060f=function(_0x8d0f3c,_0x384b58){_0x8d0f3c=_0x8d0f3c-0x0;var _0x25ea9b=_0x60f0[_0x8d0f3c];return _0x25ea9b;};'use strict';var _=require('lodash');var util=require(_0x060f('0x0'));var logger=require(_0x060f('0x1'))(_0x060f('0x2'));var moment=require(_0x060f('0x3'));var BPromise=require(_0x060f('0x4'));var rp=require(_0x060f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x060f('0x6'));var config=require(_0x060f('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0x060f('0x8')]=function(_0x4255f5,_0x1a1038){return _0x4255f5[_0x060f('0x9')](_0x060f('0xa'),attributes,{'tableName':_0x060f('0xb'),'paranoid':![],'indexes':[{'name':_0x060f('0xc'),'fields':[_0x060f('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xfab5=['exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3bed99,_0x488735){var _0x1b0fbe=function(_0x5640df){while(--_0x5640df){_0x3bed99['push'](_0x3bed99['shift']());}};_0x1b0fbe(++_0x488735);}(_0xfab5,0xa0));var _0x5fab=function(_0x2bb0a4,_0x3572cc){_0x2bb0a4=_0x2bb0a4-0x0;var _0x4372fd=_0xfab5[_0x2bb0a4];return _0x4372fd;};'use strict';var _=require(_0x5fab('0x0'));var util=require('util');var logger=require(_0x5fab('0x1'))(_0x5fab('0x2'));var moment=require(_0x5fab('0x3'));var BPromise=require(_0x5fab('0x4'));var rp=require(_0x5fab('0x5'));var fs=require('fs');var path=require(_0x5fab('0x6'));var rimraf=require('rimraf');var config=require(_0x5fab('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0x5fab('0x8')]=function(_0x4cd495,_0x563248){return _0x4cd495['define'](_0x5fab('0x9'),attributes,{'tableName':_0x5fab('0xa'),'paranoid':![],'indexes':[{'name':_0x5fab('0xb'),'fields':[_0x5fab('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 66647b8..45a9db5 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 _0x3054=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment'];(function(_0x1b0c51,_0x331463){var _0x5cc54d=function(_0x48421a){while(--_0x48421a){_0x1b0c51['push'](_0x1b0c51['shift']());}};_0x5cc54d(++_0x331463);}(_0x3054,0x1e1));var _0x4305=function(_0x474e0a,_0x1d8e66){_0x474e0a=_0x474e0a-0x0;var _0x4fab0f=_0x3054[_0x474e0a];return _0x4fab0f;};'use strict';var _=require(_0x4305('0x0'));var util=require('util');var moment=require(_0x4305('0x1'));var BPromise=require(_0x4305('0x2'));var rs=require(_0x4305('0x3'));var fs=require('fs');var Redis=require(_0x4305('0x4'));var db=require(_0x4305('0x5'))['db'];var utils=require(_0x4305('0x6'));var logger=require(_0x4305('0x7'))('rpc');var config=require(_0x4305('0x8'));var jayson=require(_0x4305('0x9'));var client=jayson[_0x4305('0xa')][_0x4305('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33a4b9,_0x1e2409,_0x30b7dc){return new BPromise(function(_0x453a6a,_0x5564f3){return client[_0x4305('0xc')](_0x33a4b9,_0x30b7dc)[_0x4305('0xd')](function(_0x231436){logger['info'](_0x4305('0xe'),_0x1e2409,_0x4305('0xf'));logger['debug'](_0x4305('0x10'),_0x1e2409,_0x4305('0xf'),JSON[_0x4305('0x11')](_0x231436));if(_0x231436[_0x4305('0x12')]){if(_0x231436['error']['code']===0x1f4){logger[_0x4305('0x12')](_0x4305('0xe'),_0x1e2409,_0x231436[_0x4305('0x12')]['message']);return _0x5564f3(_0x231436['error'][_0x4305('0x13')]);}logger[_0x4305('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x1e2409,_0x231436[_0x4305('0x12')][_0x4305('0x13')]);return _0x453a6a(_0x231436[_0x4305('0x12')][_0x4305('0x13')]);}else{logger[_0x4305('0x14')](_0x4305('0xe'),_0x1e2409,_0x4305('0xf'));_0x453a6a(_0x231436[_0x4305('0x15')][_0x4305('0x13')]);}})[_0x4305('0x16')](function(_0x21f71a){logger['error'](_0x4305('0xe'),_0x1e2409,_0x21f71a);_0x5564f3(_0x21f71a);});});} \ No newline at end of file +var _0x99c1=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x99c1,0x1e1));var _0x199c=function(_0x1b370f,_0x3887a8){_0x1b370f=_0x1b370f-0x0;var _0x2698a6=_0x99c1[_0x1b370f];return _0x2698a6;};'use strict';var _=require(_0x199c('0x0'));var util=require(_0x199c('0x1'));var moment=require(_0x199c('0x2'));var BPromise=require(_0x199c('0x3'));var rs=require(_0x199c('0x4'));var fs=require('fs');var Redis=require(_0x199c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x199c('0x6'));var logger=require('../../config/logger')(_0x199c('0x7'));var config=require(_0x199c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x199c('0x9')][_0x199c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33150e,_0x5b93eb,_0x538b3d){return new BPromise(function(_0x38b9bd,_0x51636b){return client['request'](_0x33150e,_0x538b3d)[_0x199c('0xb')](function(_0x1e43df){logger[_0x199c('0xc')](_0x199c('0xd'),_0x5b93eb,'request\x20sent');logger[_0x199c('0xe')](_0x199c('0xf'),_0x5b93eb,_0x199c('0x10'),JSON[_0x199c('0x11')](_0x1e43df));if(_0x1e43df[_0x199c('0x12')]){if(_0x1e43df[_0x199c('0x12')][_0x199c('0x13')]===0x1f4){logger[_0x199c('0x12')](_0x199c('0xd'),_0x5b93eb,_0x1e43df['error'][_0x199c('0x14')]);return _0x51636b(_0x1e43df[_0x199c('0x12')]['message']);}logger[_0x199c('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x5b93eb,_0x1e43df['error'][_0x199c('0x14')]);return _0x38b9bd(_0x1e43df[_0x199c('0x12')][_0x199c('0x14')]);}else{logger[_0x199c('0xc')](_0x199c('0xd'),_0x5b93eb,_0x199c('0x10'));_0x38b9bd(_0x1e43df[_0x199c('0x15')][_0x199c('0x14')]);}})[_0x199c('0x16')](function(_0x1864ea){logger[_0x199c('0x12')](_0x199c('0xd'),_0x5b93eb,_0x1864ea);_0x51636b(_0x1864ea);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 21e94ea..6a03459 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 _0x3dfd=['post','put','delete','/:id/sounds/:id2','removeSound','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/sounds','getSounds'];(function(_0x7aee79,_0x124af2){var _0xcbf9d1=function(_0x3f9f5f){while(--_0x3f9f5f){_0x7aee79['push'](_0x7aee79['shift']());}};_0xcbf9d1(++_0x124af2);}(_0x3dfd,0x146));var _0xd3df=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x3dfd[_0xa148b7];return _0x51efd3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd3df('0x0'));var timeout=require(_0xd3df('0x1'));var express=require('express');var router=express[_0xd3df('0x2')]();var fs_extra=require(_0xd3df('0x3'));var auth=require(_0xd3df('0x4'));var interaction=require(_0xd3df('0x5'));var config=require(_0xd3df('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0xd3df('0x7')]('/',auth['isAuthenticated'](),controller[_0xd3df('0x8')]);router[_0xd3df('0x7')](_0xd3df('0x9'),auth[_0xd3df('0xa')](),controller[_0xd3df('0xb')]);router['get'](_0xd3df('0xc'),auth[_0xd3df('0xa')](),controller[_0xd3df('0xd')]);router[_0xd3df('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd3df('0xe')](_0xd3df('0xc'),auth['isAuthenticated'](),controller['addSound']);router[_0xd3df('0xf')](_0xd3df('0x9'),auth[_0xd3df('0xa')](),controller['update']);router[_0xd3df('0x10')](_0xd3df('0x9'),auth[_0xd3df('0xa')](),controller['destroy']);router[_0xd3df('0x10')](_0xd3df('0x11'),auth[_0xd3df('0xa')](),controller[_0xd3df('0x12')]);module[_0xd3df('0x13')]=router; \ No newline at end of file +var _0x14b0=['delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','create','addSound','put','/:id','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14b0,0x12e));var _0x014b=function(_0x397b74,_0x2734ee){_0x397b74=_0x397b74-0x0;var _0x3ad12d=_0x14b0[_0x397b74];return _0x3ad12d;};'use strict';var multer=require(_0x014b('0x0'));var util=require(_0x014b('0x1'));var path=require(_0x014b('0x2'));var timeout=require(_0x014b('0x3'));var express=require(_0x014b('0x4'));var router=express['Router']();var fs_extra=require(_0x014b('0x5'));var auth=require(_0x014b('0x6'));var interaction=require(_0x014b('0x7'));var config=require(_0x014b('0x8'));var controller=require(_0x014b('0x9'));router[_0x014b('0xa')]('/',auth[_0x014b('0xb')](),controller[_0x014b('0xc')]);router[_0x014b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x014b('0xd')]);router[_0x014b('0xa')](_0x014b('0xe'),auth[_0x014b('0xb')](),controller[_0x014b('0xf')]);router[_0x014b('0x10')]('/',auth[_0x014b('0xb')](),controller[_0x014b('0x11')]);router['post'](_0x014b('0xe'),auth[_0x014b('0xb')](),controller[_0x014b('0x12')]);router[_0x014b('0x13')](_0x014b('0x14'),auth[_0x014b('0xb')](),controller[_0x014b('0x15')]);router[_0x014b('0x16')](_0x014b('0x14'),auth[_0x014b('0xb')](),controller[_0x014b('0x17')]);router[_0x014b('0x16')](_0x014b('0x18'),auth[_0x014b('0xb')](),controller[_0x014b('0x19')]);module[_0x014b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 9085aca..33d78b7 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 _0xb2f8=['quietmp3','mp3','files','alpha','TIMESTAMP','exports','STRING','name','ENUM','custom','mp3nb'];(function(_0x39eba6,_0x2fcfd5){var _0x422d49=function(_0x57b038){while(--_0x57b038){_0x39eba6['push'](_0x39eba6['shift']());}};_0x422d49(++_0x2fcfd5);}(_0xb2f8,0xe1));var _0x8b2f=function(_0x2300f2,_0x315c5f){_0x2300f2=_0x2300f2-0x0;var _0x6bd508=_0xb2f8[_0x2300f2];return _0x6bd508;};'use strict';var Sequelize=require('sequelize');module[_0x8b2f('0x0')]={'name':{'type':Sequelize[_0x8b2f('0x1')],'allowNull':![],'unique':_0x8b2f('0x2')},'mode':{'type':Sequelize[_0x8b2f('0x3')](_0x8b2f('0x4'),'files',_0x8b2f('0x5'),'quietmp3nb',_0x8b2f('0x6'),_0x8b2f('0x7')),'allowNull':!![],'defaultValue':_0x8b2f('0x8')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x8b2f('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x8b2f('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x8b2f('0x9')},'format':{'type':Sequelize[_0x8b2f('0x1')],'allowNull':!![]},'stamp':{'type':_0x8b2f('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc9ce=['sequelize','exports','STRING','name','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN'];(function(_0xf99de5,_0x32e224){var _0xdc325a=function(_0x41620e){while(--_0x41620e){_0xf99de5['push'](_0xf99de5['shift']());}};_0xdc325a(++_0x32e224);}(_0xc9ce,0x6c));var _0xec9c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc9ce[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xec9c('0x0'));module[_0xec9c('0x1')]={'name':{'type':Sequelize[_0xec9c('0x2')],'allowNull':![],'unique':_0xec9c('0x3')},'mode':{'type':Sequelize['ENUM'](_0xec9c('0x4'),_0xec9c('0x5'),_0xec9c('0x6'),_0xec9c('0x7'),_0xec9c('0x8'),_0xec9c('0x9')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xec9c('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xec9c('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xec9c('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xec9c('0x2')],'allowNull':!![],'defaultValue':_0xec9c('0xa')},'format':{'type':Sequelize[_0xec9c('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xec9c('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index e855ac3..6edc4ea 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 _0xa174=['then','destroy','get','MusicOnHolds','UserProfileResource','stack','name','send','VoiceMusicOnHold','rawAttributes','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','update','find','create','transaction','body','mode','directory','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','sequelize','Sound','findOne','save_name','converted_format','join','format','basename','%s.%s','symlinkSync','removeSound','id2','createdAt','getSounds','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','reject','save'];(function(_0x35035e,_0x26bc1d){var _0x3a042f=function(_0x38d4e3){while(--_0x38d4e3){_0x35035e['push'](_0x35035e['shift']());}};_0x3a042f(++_0x26bc1d);}(_0xa174,0x129));var _0x4a17=function(_0x15ff6b,_0x4f1bda){_0x15ff6b=_0x15ff6b-0x0;var _0x31c287=_0xa174[_0x15ff6b];return _0x31c287;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a17('0x0'));var zipdir=require(_0x4a17('0x1'));var jsonpatch=require(_0x4a17('0x2'));var rp=require(_0x4a17('0x3'));var moment=require(_0x4a17('0x4'));var BPromise=require(_0x4a17('0x5'));var Mustache=require('mustache');var util=require(_0x4a17('0x6'));var path=require(_0x4a17('0x7'));var sox=require(_0x4a17('0x8'));var csv=require(_0x4a17('0x9'));var ejs=require(_0x4a17('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4a17('0xb'));var crypto=require(_0x4a17('0xc'));var jsforce=require(_0x4a17('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4a17('0xe'));var Papa=require(_0x4a17('0xf'));var Redis=require(_0x4a17('0x10'));var authService=require(_0x4a17('0x11'));var qs=require(_0x4a17('0x12'));var as=require(_0x4a17('0x13'));var hardwareService=require(_0x4a17('0x14'));var logger=require('../../config/logger')(_0x4a17('0x15'));var utils=require(_0x4a17('0x16'));var config=require(_0x4a17('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4a17('0x18'))['db'];function respondWithStatusCode(_0x4715c0,_0x680d0e){_0x680d0e=_0x680d0e||0xcc;return function(_0x1e437d){if(_0x1e437d){return _0x4715c0[_0x4a17('0x19')](_0x680d0e);}return _0x4715c0[_0x4a17('0x1a')](_0x680d0e)[_0x4a17('0x1b')]();};}function respondWithResult(_0x13edfb,_0x2a72f7){_0x2a72f7=_0x2a72f7||0xc8;return function(_0x5578d2){if(_0x5578d2){return _0x13edfb[_0x4a17('0x1a')](_0x2a72f7)[_0x4a17('0x1c')](_0x5578d2);}};}function respondWithFilteredResult(_0x255c2e,_0x400f86){return function(_0x21dce2){if(_0x21dce2){var _0x3c06fc=typeof _0x400f86['offset']==='undefined'&&typeof _0x400f86[_0x4a17('0x1d')]==='undefined';var _0x5d8653=_0x21dce2[_0x4a17('0x1e')];var _0x3cfbec=_0x3c06fc?0x0:_0x400f86[_0x4a17('0x1f')];var _0xd569bd=_0x3c06fc?_0x21dce2['count']:_0x400f86[_0x4a17('0x1f')]+_0x400f86[_0x4a17('0x1d')];var _0x2aa638;if(_0xd569bd>=_0x5d8653){_0xd569bd=_0x5d8653;_0x2aa638=0xc8;}else{_0x2aa638=0xce;}_0x255c2e[_0x4a17('0x1a')](_0x2aa638);return _0x255c2e[_0x4a17('0x20')](_0x4a17('0x21'),_0x3cfbec+'-'+_0xd569bd+'/'+_0x5d8653)[_0x4a17('0x1c')](_0x21dce2);}return null;};}function patchUpdates(_0x59c475){return function(_0x382ff9){try{jsonpatch['apply'](_0x382ff9,_0x59c475,!![]);}catch(_0x516825){return BPromise[_0x4a17('0x22')](_0x516825);}return _0x382ff9[_0x4a17('0x23')]();};}function saveUpdates(_0x1b9888,_0x16a13e){return function(_0xd46769){if(_0xd46769){return _0xd46769['update'](_0x1b9888)[_0x4a17('0x24')](function(_0x3500f2){return _0x3500f2;});}return null;};}function removeEntity(_0x56b2a7,_0x4135d0){return function(_0x52d8b6){if(_0x52d8b6){return _0x52d8b6[_0x4a17('0x25')]()['then'](function(){var _0xbf2350=_0x52d8b6[_0x4a17('0x26')]({'plain':!![]});var _0x57874d=_0x4a17('0x27');return db[_0x4a17('0x28')][_0x4a17('0x25')]({'where':{'type':_0x57874d,'resourceId':_0xbf2350['id']}})[_0x4a17('0x24')](function(){return _0x52d8b6;});})[_0x4a17('0x24')](function(){_0x56b2a7['status'](0xcc)[_0x4a17('0x1b')]();});}};}function handleEntityNotFound(_0x2a8a25,_0x424f91){return function(_0x3d04e4){if(!_0x3d04e4){_0x2a8a25[_0x4a17('0x19')](0x194);}return _0x3d04e4;};}function handleError(_0x3369cc,_0x51f085){_0x51f085=_0x51f085||0x1f4;return function(_0x50d8b0){logger['error'](_0x50d8b0[_0x4a17('0x29')]);if(_0x50d8b0['name']){delete _0x50d8b0[_0x4a17('0x2a')];}_0x3369cc[_0x4a17('0x1a')](_0x51f085)[_0x4a17('0x2b')](_0x50d8b0);};}exports['index']=function(_0x3071fd,_0xc9ef2d){var _0x1227ce={},_0x58c997={},_0x26e57d={'count':0x0,'rows':[]};var _0x349c0a=_['map'](db[_0x4a17('0x2c')][_0x4a17('0x2d')],function(_0x4c374c){return{'name':_0x4c374c['fieldName'],'type':_0x4c374c['type']['key']};});_0x58c997[_0x4a17('0x2e')]=_[_0x4a17('0x2f')](_0x349c0a,'name');_0x58c997[_0x4a17('0x30')]=_['keys'](_0x3071fd[_0x4a17('0x30')]);_0x58c997[_0x4a17('0x31')]=_[_0x4a17('0x32')](_0x58c997['model'],_0x58c997[_0x4a17('0x30')]);_0x1227ce[_0x4a17('0x33')]=_[_0x4a17('0x32')](_0x58c997[_0x4a17('0x2e')],qs[_0x4a17('0x34')](_0x3071fd['query']['fields']));_0x1227ce['attributes']=_0x1227ce[_0x4a17('0x33')][_0x4a17('0x35')]?_0x1227ce[_0x4a17('0x33')]:_0x58c997['model'];if(!_0x3071fd['query'][_0x4a17('0x36')](_0x4a17('0x37'))){_0x1227ce[_0x4a17('0x1d')]=qs[_0x4a17('0x1d')](_0x3071fd[_0x4a17('0x30')][_0x4a17('0x1d')]);_0x1227ce[_0x4a17('0x1f')]=qs[_0x4a17('0x1f')](_0x3071fd[_0x4a17('0x30')][_0x4a17('0x1f')]);}_0x1227ce['order']=qs[_0x4a17('0x38')](_0x3071fd[_0x4a17('0x30')]['sort']);delete _0x3071fd['query'][_0x4a17('0x38')];_0x1227ce['where']=qs[_0x4a17('0x31')](_[_0x4a17('0x39')](_0x3071fd[_0x4a17('0x30')],_0x58c997[_0x4a17('0x31')]),_0x349c0a);if(_0x3071fd['query'][_0x4a17('0x3a')]){_0x1227ce[_0x4a17('0x3b')]=_[_0x4a17('0x3c')](_0x1227ce[_0x4a17('0x3b')],{'$or':_[_0x4a17('0x2f')](_0x349c0a,function(_0x35366b){if(_0x35366b[_0x4a17('0x3d')]!==_0x4a17('0x3e')){var _0xf5a0d6={};_0xf5a0d6[_0x35366b[_0x4a17('0x2a')]]={'$like':'%'+_0x3071fd[_0x4a17('0x30')]['filter']+'%'};return _0xf5a0d6;}})});}_0x1227ce=_[_0x4a17('0x3c')]({},_0x1227ce,_0x3071fd[_0x4a17('0x3f')]);var _0x2d59e9={'where':_0x1227ce[_0x4a17('0x3b')]};return db[_0x4a17('0x2c')][_0x4a17('0x1e')](_0x2d59e9)['then'](function(_0x544264){_0x26e57d[_0x4a17('0x1e')]=_0x544264;if(_0x3071fd[_0x4a17('0x30')][_0x4a17('0x40')]){_0x1227ce[_0x4a17('0x41')]=[{'all':!![]}];}return db[_0x4a17('0x2c')][_0x4a17('0x42')](_0x1227ce);})[_0x4a17('0x24')](function(_0x85e006){_0x26e57d[_0x4a17('0x43')]=_0x85e006;return _0x26e57d;})[_0x4a17('0x24')](respondWithFilteredResult(_0xc9ef2d,_0x1227ce))[_0x4a17('0x44')](handleError(_0xc9ef2d,null));};exports[_0x4a17('0x45')]=function(_0x5c34ef,_0xdca0bf){var _0x5b8a50={'raw':![],'where':{'id':_0x5c34ef[_0x4a17('0x46')]['id']}},_0x2eac57={};_0x2eac57[_0x4a17('0x2e')]=_['keys'](db[_0x4a17('0x2c')][_0x4a17('0x2d')]);_0x2eac57['query']=_[_0x4a17('0x47')](_0x5c34ef['query']);_0x2eac57[_0x4a17('0x31')]=_[_0x4a17('0x32')](_0x2eac57[_0x4a17('0x2e')],_0x2eac57[_0x4a17('0x30')]);_0x5b8a50[_0x4a17('0x33')]=_[_0x4a17('0x32')](_0x2eac57['model'],qs[_0x4a17('0x34')](_0x5c34ef[_0x4a17('0x30')][_0x4a17('0x34')]));_0x5b8a50[_0x4a17('0x33')]=_0x5b8a50[_0x4a17('0x33')][_0x4a17('0x35')]?_0x5b8a50[_0x4a17('0x33')]:_0x2eac57[_0x4a17('0x2e')];if(_0x5c34ef[_0x4a17('0x30')]['includeAll']){_0x5b8a50[_0x4a17('0x41')]=[{'all':!![]}];}_0x5b8a50=_[_0x4a17('0x3c')]({},_0x5b8a50,_0x5c34ef[_0x4a17('0x3f')]);return db[_0x4a17('0x2c')]['find'](_0x5b8a50)[_0x4a17('0x24')](handleEntityNotFound(_0xdca0bf,null))['then'](respondWithResult(_0xdca0bf,null))['catch'](handleError(_0xdca0bf,null));};exports[_0x4a17('0x48')]=function(_0x167a39,_0xc084fc){if(_0x167a39['body']['id']){delete _0x167a39['body']['id'];}return db[_0x4a17('0x2c')][_0x4a17('0x49')]({'where':{'id':_0x167a39[_0x4a17('0x46')]['id']}})[_0x4a17('0x24')](handleEntityNotFound(_0xc084fc,null))[_0x4a17('0x24')](saveUpdates(_0x167a39['body'],null))['then'](respondWithResult(_0xc084fc,null))[_0x4a17('0x44')](handleError(_0xc084fc,null));};exports[_0x4a17('0x4a')]=function(_0x27cdb7,_0x116a42,_0xfb8f26){return db['sequelize'][_0x4a17('0x4b')](function(_0x258ea5){if(_0x27cdb7[_0x4a17('0x4c')][_0x4a17('0x4d')]==='files'){_0x27cdb7[_0x4a17('0x4c')][_0x4a17('0x4e')]=path['join'](config[_0x4a17('0x4f')],_0x4a17('0x50'),_0x27cdb7[_0x4a17('0x4c')][_0x4a17('0x2a')]);}return db[_0x4a17('0x2c')][_0x4a17('0x4a')](_0x27cdb7[_0x4a17('0x4c')],{'transaction':_0x258ea5})[_0x4a17('0x24')](function(_0x11b6bf){if(_0x27cdb7[_0x4a17('0x4c')][_0x4a17('0x4d')]==='files'){fs[_0x4a17('0x51')](_0x11b6bf[_0x4a17('0x4e')],parseInt(_0x4a17('0x52'),0x8));}var _0x2b8a7f=_0x27cdb7[_0x4a17('0x53')][_0x4a17('0x26')]({'plain':!![]});if(!_0x2b8a7f)throw new Error(_0x4a17('0x54'));if(_0x2b8a7f[_0x4a17('0x55')]===_0x4a17('0x53')){var _0x5a423c=_0x11b6bf[_0x4a17('0x26')]({'plain':!![]});return db[_0x4a17('0x56')]['find']({'where':{'name':_0x4a17('0x27'),'userProfileId':_0x2b8a7f[_0x4a17('0x57')]},'raw':!![]})[_0x4a17('0x24')](function(_0x56ff6a){if(_0x56ff6a&&_0x56ff6a['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5a423c['name'],'resourceId':_0x5a423c['id'],'type':_0x56ff6a[_0x4a17('0x2a')],'sectionId':_0x56ff6a['id']},{})[_0x4a17('0x24')](function(){return _0x11b6bf;});}else{return _0x11b6bf;}})[_0x4a17('0x44')](function(_0x447a41){logger['error'](_0x4a17('0x58'),_0x447a41);});}return _0x11b6bf;});})[_0x4a17('0x24')](respondWithResult(_0x116a42,0xc9))[_0x4a17('0x44')](handleError(_0x116a42,null));};exports[_0x4a17('0x25')]=function(_0x24fb62,_0x437f00,_0x1e7ddd){var _0x59b327;return db[_0x4a17('0x2c')][_0x4a17('0x49')]({'where':{'id':_0x24fb62[_0x4a17('0x46')]['id']}})[_0x4a17('0x24')](function(_0x3c1b2d){if(_0x3c1b2d){return db['sequelize'][_0x4a17('0x4b')](function(_0x235a9a){return _0x3c1b2d['destroy']({'transaction':_0x235a9a,'raw':!![]})[_0x4a17('0x24')](function(_0x31e47d){if(_0x31e47d[_0x4a17('0x4e')]){fs[_0x4a17('0x59')](_0x31e47d[_0x4a17('0x4e')])[_0x4a17('0x5a')](function(_0xdc3dc0){fs[_0x4a17('0x5b')](path['join'](_0x31e47d[_0x4a17('0x4e')],_0xdc3dc0));});fs[_0x4a17('0x5c')](_0x31e47d[_0x4a17('0x4e')]);}return _0x31e47d;});})[_0x4a17('0x44')](function(_0x28c1e8){throw new db[(_0x4a17('0x5d'))][(_0x4a17('0x5e'))](_0x28c1e8[_0x4a17('0x5f')]);});}})[_0x4a17('0x24')](handleEntityNotFound(_0x437f00,null))[_0x4a17('0x24')](removeEntity(_0x437f00,null))[_0x4a17('0x44')](handleError(_0x437f00,null));};exports[_0x4a17('0x60')]=function(_0x536506,_0x45afda,_0x430be5){return db[_0x4a17('0x61')][_0x4a17('0x4b')](function(_0x6547ee){var _0x41e3f7;return db[_0x4a17('0x2c')][_0x4a17('0x49')]({'where':{'id':_0x536506[_0x4a17('0x46')]['id']}})[_0x4a17('0x24')](function(_0x14929f){if(_0x14929f){_0x41e3f7=_0x14929f;return _0x14929f['addSound'](_0x536506[_0x4a17('0x4c')]['id'],{'transaction':_0x6547ee});}})[_0x4a17('0x24')](function(_0x887cb2){if(_0x887cb2){return db[_0x4a17('0x62')][_0x4a17('0x63')]({'where':{'id':_0x536506['body']['id']},'attributes':['id',_0x4a17('0x2a'),_0x4a17('0x64'),_0x4a17('0x65'),'createdAt'],'raw':!![]});}})[_0x4a17('0x24')](function(_0x54c689){if(_0x54c689){var _0xc50143=path[_0x4a17('0x66')](config[_0x4a17('0x4f')],'server/files/sounds/converted',util[_0x4a17('0x67')]('%s.%s',path[_0x4a17('0x68')](_0x54c689[_0x4a17('0x64')],path['extname'](_0x54c689['save_name'])),_0x54c689[_0x4a17('0x65')]));var _0x4ec466=path[_0x4a17('0x66')](config['root'],'server/files/moh',_0x41e3f7[_0x4a17('0x2a')],util[_0x4a17('0x67')](_0x4a17('0x69'),_0x54c689[_0x4a17('0x2a')],_0x54c689[_0x4a17('0x65')]));fs[_0x4a17('0x6a')](_0xc50143,_0x4ec466);return _0x54c689;}})[_0x4a17('0x44')](function(_0x243091){throw new db['Sequelize']['ValidationError'](_0x243091[_0x4a17('0x5f')]);});})[_0x4a17('0x24')](handleEntityNotFound(_0x45afda,null))[_0x4a17('0x24')](respondWithResult(_0x45afda,0xc9))[_0x4a17('0x44')](handleError(_0x45afda,null));};exports[_0x4a17('0x6b')]=function(_0x2c86c0,_0x2bf679,_0x2e1ff4){return db[_0x4a17('0x61')][_0x4a17('0x4b')](function(_0x13dfaf){var _0x30b618;return db[_0x4a17('0x2c')][_0x4a17('0x63')]({'where':{'id':_0x2c86c0[_0x4a17('0x46')]['id']}})[_0x4a17('0x24')](handleEntityNotFound(_0x2bf679,null))[_0x4a17('0x24')](function(_0x33db6a){if(_0x33db6a){_0x30b618=_0x33db6a;return _0x33db6a[_0x4a17('0x6b')](_0x2c86c0[_0x4a17('0x46')][_0x4a17('0x6c')]);}})[_0x4a17('0x24')](function(_0x1054cf){if(_0x1054cf){return db[_0x4a17('0x62')]['findOne']({'where':{'id':_0x2c86c0[_0x4a17('0x46')][_0x4a17('0x6c')]},'attributes':['id',_0x4a17('0x2a'),_0x4a17('0x64'),_0x4a17('0x65'),_0x4a17('0x6d')],'raw':!![]});}})[_0x4a17('0x24')](function(_0x37e30a){if(_0x37e30a){fs['unlinkSync'](path[_0x4a17('0x66')](_0x30b618[_0x4a17('0x4e')],util[_0x4a17('0x67')](_0x4a17('0x69'),_0x37e30a[_0x4a17('0x2a')],_0x37e30a[_0x4a17('0x65')])));return _0x37e30a;}})[_0x4a17('0x44')](function(_0x395b05){throw new db[(_0x4a17('0x5d'))]['ValidationError'](_0x395b05[_0x4a17('0x5f')]);});})[_0x4a17('0x24')](handleEntityNotFound(_0x2bf679,null))[_0x4a17('0x24')](respondWithStatusCode(_0x2bf679,0xcc))['catch'](handleError(_0x2bf679,null));};exports['getSounds']=function(_0x3b4dfa,_0x30d65e,_0x57d42f){var _0x38db2c={};var _0x221738={};var _0x311a60;var _0x37f19a;return db[_0x4a17('0x2c')][_0x4a17('0x63')]({'where':{'id':_0x3b4dfa[_0x4a17('0x46')]['id']}})[_0x4a17('0x24')](handleEntityNotFound(_0x30d65e,null))[_0x4a17('0x24')](function(_0x5f3d52){if(_0x5f3d52){_0x311a60=_0x5f3d52;_0x221738[_0x4a17('0x2e')]=_['keys'](db['Sound'][_0x4a17('0x2d')]);_0x221738['query']=_[_0x4a17('0x47')](_0x3b4dfa[_0x4a17('0x30')]);_0x221738['filters']=_[_0x4a17('0x32')](_0x221738[_0x4a17('0x2e')],_0x221738[_0x4a17('0x30')]);_0x38db2c[_0x4a17('0x33')]=_['intersection'](_0x221738[_0x4a17('0x2e')],qs[_0x4a17('0x34')](_0x3b4dfa[_0x4a17('0x30')][_0x4a17('0x34')]));_0x38db2c[_0x4a17('0x33')]=_0x38db2c[_0x4a17('0x33')]['length']?_0x38db2c[_0x4a17('0x33')]:_0x221738[_0x4a17('0x2e')];_0x38db2c['order']=qs[_0x4a17('0x38')](_0x3b4dfa[_0x4a17('0x30')]['sort']);_0x38db2c['where']=qs['filters'](_[_0x4a17('0x39')](_0x3b4dfa[_0x4a17('0x30')],_0x221738[_0x4a17('0x31')]));if(_0x3b4dfa[_0x4a17('0x30')][_0x4a17('0x3a')]){_0x38db2c['where']=_[_0x4a17('0x3c')](_0x38db2c['where'],{'$or':_[_0x4a17('0x2f')](_0x38db2c[_0x4a17('0x33')],function(_0x58ec9e){var _0x3d583c={};_0x3d583c[_0x58ec9e]={'$like':'%'+_0x3b4dfa[_0x4a17('0x30')][_0x4a17('0x3a')]+'%'};return _0x3d583c;})});}_0x38db2c=_['merge']({},_0x38db2c,_0x3b4dfa[_0x4a17('0x3f')]);return _0x311a60[_0x4a17('0x6e')](_0x38db2c);}})['then'](function(_0x2a12f1){if(_0x2a12f1){_0x37f19a=_0x2a12f1[_0x4a17('0x35')];if(!_0x3b4dfa[_0x4a17('0x30')]['hasOwnProperty']('nolimit')){_0x38db2c['limit']=qs['limit'](_0x3b4dfa['query']['limit']);_0x38db2c['offset']=qs[_0x4a17('0x1f')](_0x3b4dfa['query'][_0x4a17('0x1f')]);}return _0x311a60['getSounds'](_0x38db2c);}})[_0x4a17('0x24')](function(_0xdea313){if(_0xdea313){return _0xdea313?{'count':_0x37f19a,'rows':_0xdea313}:null;}})['then'](respondWithResult(_0x30d65e,null))[_0x4a17('0x44')](handleError(_0x30d65e,null));}; \ No newline at end of file +var _0xb620=['find','body','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','sequelize','transaction','readdirSync','forEach','message','addSound','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','Sequelize','ValidationError','removeSound','findOne','id2','Sound','unlinkSync','getSounds','hasOwnProperty','nolimit','eml-format','fast-json-patch','moment','mustache','path','sox','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','end','sendStatus','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xb620,0x16d));var _0x0b62=function(_0x26417a,_0x1ec951){_0x26417a=_0x26417a-0x0;var _0x9d7fcc=_0xb620[_0x26417a];return _0x9d7fcc;};'use strict';var emlformat=require(_0x0b62('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0b62('0x1'));var rp=require('request-promise');var moment=require(_0x0b62('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0b62('0x3'));var util=require('util');var path=require(_0x0b62('0x4'));var sox=require(_0x0b62('0x5'));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(_0x0b62('0x6'));var crypto=require('crypto');var jsforce=require(_0x0b62('0x7'));var deskjs=require(_0x0b62('0x8'));var toCsv=require(_0x0b62('0x9'));var querystring=require(_0x0b62('0xa'));var Papa=require(_0x0b62('0xb'));var Redis=require(_0x0b62('0xc'));var authService=require(_0x0b62('0xd'));var qs=require(_0x0b62('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b62('0xf'));var logger=require('../../config/logger')(_0x0b62('0x10'));var utils=require('../../config/utils');var config=require(_0x0b62('0x11'));var licenseUtil=require(_0x0b62('0x12'));var db=require(_0x0b62('0x13'))['db'];function respondWithStatusCode(_0xa136d7,_0x48699c){_0x48699c=_0x48699c||0xcc;return function(_0x4dd7ff){if(_0x4dd7ff){return _0xa136d7['sendStatus'](_0x48699c);}return _0xa136d7[_0x0b62('0x14')](_0x48699c)['end']();};}function respondWithResult(_0x5cd477,_0x58dee7){_0x58dee7=_0x58dee7||0xc8;return function(_0x3dfb38){if(_0x3dfb38){return _0x5cd477[_0x0b62('0x14')](_0x58dee7)[_0x0b62('0x15')](_0x3dfb38);}};}function respondWithFilteredResult(_0x49ad49,_0x169d4b){return function(_0x37a183){if(_0x37a183){var _0x3f927e=typeof _0x169d4b[_0x0b62('0x16')]===_0x0b62('0x17')&&typeof _0x169d4b['limit']===_0x0b62('0x17');var _0x560f53=_0x37a183[_0x0b62('0x18')];var _0x2669be=_0x3f927e?0x0:_0x169d4b[_0x0b62('0x16')];var _0x2436a8=_0x3f927e?_0x37a183['count']:_0x169d4b[_0x0b62('0x16')]+_0x169d4b[_0x0b62('0x19')];var _0x134604;if(_0x2436a8>=_0x560f53){_0x2436a8=_0x560f53;_0x134604=0xc8;}else{_0x134604=0xce;}_0x49ad49[_0x0b62('0x14')](_0x134604);return _0x49ad49[_0x0b62('0x1a')](_0x0b62('0x1b'),_0x2669be+'-'+_0x2436a8+'/'+_0x560f53)[_0x0b62('0x15')](_0x37a183);}return null;};}function patchUpdates(_0x206575){return function(_0x1b7b7e){try{jsonpatch[_0x0b62('0x1c')](_0x1b7b7e,_0x206575,!![]);}catch(_0x387afb){return BPromise[_0x0b62('0x1d')](_0x387afb);}return _0x1b7b7e[_0x0b62('0x1e')]();};}function saveUpdates(_0x9a0721,_0xfcd141){return function(_0x34d45e){if(_0x34d45e){return _0x34d45e[_0x0b62('0x1f')](_0x9a0721)['then'](function(_0x1a60dd){return _0x1a60dd;});}return null;};}function removeEntity(_0x26528e,_0xde624d){return function(_0x177c75){if(_0x177c75){return _0x177c75[_0x0b62('0x20')]()['then'](function(){var _0x1768e3=_0x177c75[_0x0b62('0x21')]({'plain':!![]});var _0x58d180=_0x0b62('0x22');return db[_0x0b62('0x23')][_0x0b62('0x20')]({'where':{'type':_0x58d180,'resourceId':_0x1768e3['id']}})[_0x0b62('0x24')](function(){return _0x177c75;});})[_0x0b62('0x24')](function(){_0x26528e['status'](0xcc)[_0x0b62('0x25')]();});}};}function handleEntityNotFound(_0x14c4b4,_0xe443b2){return function(_0x34bb54){if(!_0x34bb54){_0x14c4b4[_0x0b62('0x26')](0x194);}return _0x34bb54;};}function handleError(_0xcb49a1,_0xbefe21){_0xbefe21=_0xbefe21||0x1f4;return function(_0x51cd66){logger[_0x0b62('0x27')](_0x51cd66['stack']);if(_0x51cd66[_0x0b62('0x28')]){delete _0x51cd66[_0x0b62('0x28')];}_0xcb49a1[_0x0b62('0x14')](_0xbefe21)[_0x0b62('0x29')](_0x51cd66);};}exports[_0x0b62('0x2a')]=function(_0x11783e,_0x43bb9f){var _0x39481f={},_0x4bca9f={},_0x42701f={'count':0x0,'rows':[]};var _0x28f8b5=_[_0x0b62('0x2b')](db[_0x0b62('0x2c')][_0x0b62('0x2d')],function(_0x4bbff2){return{'name':_0x4bbff2[_0x0b62('0x2e')],'type':_0x4bbff2[_0x0b62('0x2f')][_0x0b62('0x30')]};});_0x4bca9f[_0x0b62('0x31')]=_[_0x0b62('0x2b')](_0x28f8b5,_0x0b62('0x28'));_0x4bca9f[_0x0b62('0x32')]=_[_0x0b62('0x33')](_0x11783e[_0x0b62('0x32')]);_0x4bca9f[_0x0b62('0x34')]=_[_0x0b62('0x35')](_0x4bca9f[_0x0b62('0x31')],_0x4bca9f['query']);_0x39481f[_0x0b62('0x36')]=_[_0x0b62('0x35')](_0x4bca9f[_0x0b62('0x31')],qs['fields'](_0x11783e['query'][_0x0b62('0x37')]));_0x39481f[_0x0b62('0x36')]=_0x39481f[_0x0b62('0x36')]['length']?_0x39481f[_0x0b62('0x36')]:_0x4bca9f['model'];if(!_0x11783e[_0x0b62('0x32')]['hasOwnProperty']('nolimit')){_0x39481f['limit']=qs[_0x0b62('0x19')](_0x11783e[_0x0b62('0x32')]['limit']);_0x39481f[_0x0b62('0x16')]=qs['offset'](_0x11783e[_0x0b62('0x32')][_0x0b62('0x16')]);}_0x39481f[_0x0b62('0x38')]=qs[_0x0b62('0x39')](_0x11783e[_0x0b62('0x32')][_0x0b62('0x39')]);delete _0x11783e['query'][_0x0b62('0x39')];_0x39481f[_0x0b62('0x3a')]=qs[_0x0b62('0x34')](_['pick'](_0x11783e[_0x0b62('0x32')],_0x4bca9f[_0x0b62('0x34')]),_0x28f8b5);if(_0x11783e['query'][_0x0b62('0x3b')]){_0x39481f['where']=_[_0x0b62('0x3c')](_0x39481f[_0x0b62('0x3a')],{'$or':_['map'](_0x28f8b5,function(_0x165319){if(_0x165319[_0x0b62('0x2f')]!==_0x0b62('0x3d')){var _0x420c08={};_0x420c08[_0x165319[_0x0b62('0x28')]]={'$like':'%'+_0x11783e['query'][_0x0b62('0x3b')]+'%'};return _0x420c08;}})});}_0x39481f=_['merge']({},_0x39481f,_0x11783e[_0x0b62('0x3e')]);var _0x57f794={'where':_0x39481f[_0x0b62('0x3a')]};return db['VoiceMusicOnHold'][_0x0b62('0x18')](_0x57f794)[_0x0b62('0x24')](function(_0x1c0242){_0x42701f[_0x0b62('0x18')]=_0x1c0242;if(_0x11783e['query'][_0x0b62('0x3f')]){_0x39481f[_0x0b62('0x40')]=[{'all':!![]}];}return db[_0x0b62('0x2c')][_0x0b62('0x41')](_0x39481f);})['then'](function(_0x48f78b){_0x42701f[_0x0b62('0x42')]=_0x48f78b;return _0x42701f;})[_0x0b62('0x24')](respondWithFilteredResult(_0x43bb9f,_0x39481f))[_0x0b62('0x43')](handleError(_0x43bb9f,null));};exports[_0x0b62('0x44')]=function(_0x40b82e,_0x393607){var _0x166a41={'raw':![],'where':{'id':_0x40b82e[_0x0b62('0x45')]['id']}},_0x4bd743={};_0x4bd743[_0x0b62('0x31')]=_[_0x0b62('0x33')](db[_0x0b62('0x2c')][_0x0b62('0x2d')]);_0x4bd743[_0x0b62('0x32')]=_[_0x0b62('0x33')](_0x40b82e[_0x0b62('0x32')]);_0x4bd743[_0x0b62('0x34')]=_['intersection'](_0x4bd743[_0x0b62('0x31')],_0x4bd743[_0x0b62('0x32')]);_0x166a41[_0x0b62('0x36')]=_[_0x0b62('0x35')](_0x4bd743[_0x0b62('0x31')],qs[_0x0b62('0x37')](_0x40b82e[_0x0b62('0x32')][_0x0b62('0x37')]));_0x166a41['attributes']=_0x166a41[_0x0b62('0x36')][_0x0b62('0x46')]?_0x166a41[_0x0b62('0x36')]:_0x4bd743[_0x0b62('0x31')];if(_0x40b82e['query'][_0x0b62('0x3f')]){_0x166a41['include']=[{'all':!![]}];}_0x166a41=_[_0x0b62('0x3c')]({},_0x166a41,_0x40b82e[_0x0b62('0x3e')]);return db[_0x0b62('0x2c')][_0x0b62('0x47')](_0x166a41)[_0x0b62('0x24')](handleEntityNotFound(_0x393607,null))[_0x0b62('0x24')](respondWithResult(_0x393607,null))[_0x0b62('0x43')](handleError(_0x393607,null));};exports[_0x0b62('0x1f')]=function(_0x3c9fba,_0x15f040){if(_0x3c9fba[_0x0b62('0x48')]['id']){delete _0x3c9fba[_0x0b62('0x48')]['id'];}return db['VoiceMusicOnHold'][_0x0b62('0x47')]({'where':{'id':_0x3c9fba[_0x0b62('0x45')]['id']}})[_0x0b62('0x24')](handleEntityNotFound(_0x15f040,null))[_0x0b62('0x24')](saveUpdates(_0x3c9fba['body'],null))[_0x0b62('0x24')](respondWithResult(_0x15f040,null))[_0x0b62('0x43')](handleError(_0x15f040,null));};exports['create']=function(_0x518ddc,_0x3fe2e4,_0x1c2dc8){return db['sequelize']['transaction'](function(_0x1aaf0b){if(_0x518ddc[_0x0b62('0x48')][_0x0b62('0x49')]===_0x0b62('0x4a')){_0x518ddc[_0x0b62('0x48')]['directory']=path[_0x0b62('0x4b')](config[_0x0b62('0x4c')],_0x0b62('0x4d'),_0x518ddc[_0x0b62('0x48')][_0x0b62('0x28')]);}return db[_0x0b62('0x2c')]['create'](_0x518ddc['body'],{'transaction':_0x1aaf0b})[_0x0b62('0x24')](function(_0x35307c){if(_0x518ddc['body'][_0x0b62('0x49')]===_0x0b62('0x4a')){fs[_0x0b62('0x4e')](_0x35307c[_0x0b62('0x4f')],parseInt(_0x0b62('0x50'),0x8));}var _0x2955fe=_0x518ddc[_0x0b62('0x51')]['get']({'plain':!![]});if(!_0x2955fe)throw new Error(_0x0b62('0x52'));if(_0x2955fe[_0x0b62('0x53')]===_0x0b62('0x51')){var _0x5df991=_0x35307c['get']({'plain':!![]});return db['UserProfileSection'][_0x0b62('0x47')]({'where':{'name':_0x0b62('0x22'),'userProfileId':_0x2955fe[_0x0b62('0x54')]},'raw':!![]})['then'](function(_0x2406e1){if(_0x2406e1&&_0x2406e1['autoAssociation']===0x0){return db[_0x0b62('0x23')]['create']({'name':_0x5df991[_0x0b62('0x28')],'resourceId':_0x5df991['id'],'type':_0x2406e1['name'],'sectionId':_0x2406e1['id']},{})[_0x0b62('0x24')](function(){return _0x35307c;});}else{return _0x35307c;}})['catch'](function(_0x799c42){logger[_0x0b62('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x799c42);});}return _0x35307c;});})[_0x0b62('0x24')](respondWithResult(_0x3fe2e4,0xc9))[_0x0b62('0x43')](handleError(_0x3fe2e4,null));};exports[_0x0b62('0x20')]=function(_0x1a8cc0,_0xbaca4,_0x422e29){var _0x4762dd;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x1a8cc0['params']['id']}})['then'](function(_0x3771a9){if(_0x3771a9){return db[_0x0b62('0x55')][_0x0b62('0x56')](function(_0x253b1a){return _0x3771a9['destroy']({'transaction':_0x253b1a,'raw':!![]})['then'](function(_0x3140f9){if(_0x3140f9['directory']){fs[_0x0b62('0x57')](_0x3140f9[_0x0b62('0x4f')])[_0x0b62('0x58')](function(_0x395098){fs['unlinkSync'](path[_0x0b62('0x4b')](_0x3140f9[_0x0b62('0x4f')],_0x395098));});fs['rmdirSync'](_0x3140f9[_0x0b62('0x4f')]);}return _0x3140f9;});})['catch'](function(_0x18cd78){throw new db['Sequelize']['ValidationError'](_0x18cd78[_0x0b62('0x59')]);});}})[_0x0b62('0x24')](handleEntityNotFound(_0xbaca4,null))['then'](removeEntity(_0xbaca4,null))[_0x0b62('0x43')](handleError(_0xbaca4,null));};exports[_0x0b62('0x5a')]=function(_0x450348,_0x4ac9c8,_0x2a9e53){return db[_0x0b62('0x55')][_0x0b62('0x56')](function(_0x11db55){var _0x6611db;return db[_0x0b62('0x2c')][_0x0b62('0x47')]({'where':{'id':_0x450348[_0x0b62('0x45')]['id']}})['then'](function(_0x1bdec2){if(_0x1bdec2){_0x6611db=_0x1bdec2;return _0x1bdec2[_0x0b62('0x5a')](_0x450348[_0x0b62('0x48')]['id'],{'transaction':_0x11db55});}})[_0x0b62('0x24')](function(_0x373e66){if(_0x373e66){return db['Sound']['findOne']({'where':{'id':_0x450348[_0x0b62('0x48')]['id']},'attributes':['id','name',_0x0b62('0x5b'),_0x0b62('0x5c'),_0x0b62('0x5d')],'raw':!![]});}})['then'](function(_0x3b04ae){if(_0x3b04ae){var _0x3850f1=path[_0x0b62('0x4b')](config[_0x0b62('0x4c')],_0x0b62('0x5e'),util[_0x0b62('0x5f')](_0x0b62('0x60'),path[_0x0b62('0x61')](_0x3b04ae[_0x0b62('0x5b')],path[_0x0b62('0x62')](_0x3b04ae[_0x0b62('0x5b')])),_0x3b04ae[_0x0b62('0x5c')]));var _0x471a0e=path[_0x0b62('0x4b')](config['root'],'server/files/moh',_0x6611db['name'],util[_0x0b62('0x5f')]('%s.%s',_0x3b04ae[_0x0b62('0x28')],_0x3b04ae[_0x0b62('0x5c')]));fs['symlinkSync'](_0x3850f1,_0x471a0e);return _0x3b04ae;}})[_0x0b62('0x43')](function(_0x3ecb00){throw new db[(_0x0b62('0x63'))][(_0x0b62('0x64'))](_0x3ecb00[_0x0b62('0x59')]);});})[_0x0b62('0x24')](handleEntityNotFound(_0x4ac9c8,null))[_0x0b62('0x24')](respondWithResult(_0x4ac9c8,0xc9))[_0x0b62('0x43')](handleError(_0x4ac9c8,null));};exports[_0x0b62('0x65')]=function(_0x2eb823,_0x575038,_0x35f4a8){return db[_0x0b62('0x55')][_0x0b62('0x56')](function(_0x579940){var _0x324dbe;return db['VoiceMusicOnHold'][_0x0b62('0x66')]({'where':{'id':_0x2eb823[_0x0b62('0x45')]['id']}})[_0x0b62('0x24')](handleEntityNotFound(_0x575038,null))[_0x0b62('0x24')](function(_0x47a70b){if(_0x47a70b){_0x324dbe=_0x47a70b;return _0x47a70b[_0x0b62('0x65')](_0x2eb823[_0x0b62('0x45')][_0x0b62('0x67')]);}})[_0x0b62('0x24')](function(_0x385810){if(_0x385810){return db[_0x0b62('0x68')][_0x0b62('0x66')]({'where':{'id':_0x2eb823['params']['id2']},'attributes':['id',_0x0b62('0x28'),_0x0b62('0x5b'),_0x0b62('0x5c'),'createdAt'],'raw':!![]});}})[_0x0b62('0x24')](function(_0xe5e7a4){if(_0xe5e7a4){fs[_0x0b62('0x69')](path[_0x0b62('0x4b')](_0x324dbe[_0x0b62('0x4f')],util[_0x0b62('0x5f')](_0x0b62('0x60'),_0xe5e7a4[_0x0b62('0x28')],_0xe5e7a4['converted_format'])));return _0xe5e7a4;}})[_0x0b62('0x43')](function(_0x586f92){throw new db[(_0x0b62('0x63'))][(_0x0b62('0x64'))](_0x586f92['message']);});})[_0x0b62('0x24')](handleEntityNotFound(_0x575038,null))[_0x0b62('0x24')](respondWithStatusCode(_0x575038,0xcc))[_0x0b62('0x43')](handleError(_0x575038,null));};exports[_0x0b62('0x6a')]=function(_0x5c66d8,_0x1f81c4,_0x489b25){var _0x4e6b24={};var _0x4414c3={};var _0x531768;var _0x87f93a;return db[_0x0b62('0x2c')][_0x0b62('0x66')]({'where':{'id':_0x5c66d8[_0x0b62('0x45')]['id']}})[_0x0b62('0x24')](handleEntityNotFound(_0x1f81c4,null))[_0x0b62('0x24')](function(_0x1ffbbd){if(_0x1ffbbd){_0x531768=_0x1ffbbd;_0x4414c3[_0x0b62('0x31')]=_[_0x0b62('0x33')](db[_0x0b62('0x68')]['rawAttributes']);_0x4414c3['query']=_['keys'](_0x5c66d8[_0x0b62('0x32')]);_0x4414c3[_0x0b62('0x34')]=_['intersection'](_0x4414c3[_0x0b62('0x31')],_0x4414c3[_0x0b62('0x32')]);_0x4e6b24['attributes']=_[_0x0b62('0x35')](_0x4414c3[_0x0b62('0x31')],qs[_0x0b62('0x37')](_0x5c66d8['query'][_0x0b62('0x37')]));_0x4e6b24[_0x0b62('0x36')]=_0x4e6b24['attributes']['length']?_0x4e6b24[_0x0b62('0x36')]:_0x4414c3[_0x0b62('0x31')];_0x4e6b24[_0x0b62('0x38')]=qs[_0x0b62('0x39')](_0x5c66d8[_0x0b62('0x32')][_0x0b62('0x39')]);_0x4e6b24[_0x0b62('0x3a')]=qs[_0x0b62('0x34')](_['pick'](_0x5c66d8[_0x0b62('0x32')],_0x4414c3['filters']));if(_0x5c66d8['query'][_0x0b62('0x3b')]){_0x4e6b24['where']=_['merge'](_0x4e6b24[_0x0b62('0x3a')],{'$or':_[_0x0b62('0x2b')](_0x4e6b24[_0x0b62('0x36')],function(_0x1c76e1){var _0x2b552e={};_0x2b552e[_0x1c76e1]={'$like':'%'+_0x5c66d8['query'][_0x0b62('0x3b')]+'%'};return _0x2b552e;})});}_0x4e6b24=_[_0x0b62('0x3c')]({},_0x4e6b24,_0x5c66d8['options']);return _0x531768[_0x0b62('0x6a')](_0x4e6b24);}})['then'](function(_0x65d814){if(_0x65d814){_0x87f93a=_0x65d814['length'];if(!_0x5c66d8[_0x0b62('0x32')][_0x0b62('0x6b')](_0x0b62('0x6c'))){_0x4e6b24[_0x0b62('0x19')]=qs[_0x0b62('0x19')](_0x5c66d8[_0x0b62('0x32')][_0x0b62('0x19')]);_0x4e6b24[_0x0b62('0x16')]=qs[_0x0b62('0x16')](_0x5c66d8[_0x0b62('0x32')][_0x0b62('0x16')]);}return _0x531768[_0x0b62('0x6a')](_0x4e6b24);}})[_0x0b62('0x24')](function(_0x59ace0){if(_0x59ace0){return _0x59ace0?{'count':_0x87f93a,'rows':_0x59ace0}:null;}})[_0x0b62('0x24')](respondWithResult(_0x1f81c4,null))[_0x0b62('0x43')](handleError(_0x1f81c4,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 2c442d0..3a0c5ce 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 _0xfedd=['voice_musiconhold','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x238656,_0x558ec3){var _0x4d4894=function(_0x26e666){while(--_0x26e666){_0x238656['push'](_0x238656['shift']());}};_0x4d4894(++_0x558ec3);}(_0xfedd,0x160));var _0xdfed=function(_0x1d1efb,_0x5784a2){_0x1d1efb=_0x1d1efb-0x0;var _0x175a2f=_0xfedd[_0x1d1efb];return _0x175a2f;};'use strict';var _=require('lodash');var util=require(_0xdfed('0x0'));var logger=require(_0xdfed('0x1'))(_0xdfed('0x2'));var moment=require(_0xdfed('0x3'));var BPromise=require(_0xdfed('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdfed('0x5'));var rimraf=require(_0xdfed('0x6'));var config=require(_0xdfed('0x7'));var attributes=require(_0xdfed('0x8'));module[_0xdfed('0x9')]=function(_0x229c9b,_0x57c6f4){return _0x229c9b[_0xdfed('0xa')](_0xdfed('0xb'),attributes,{'tableName':_0xdfed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67cf=['voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','VoiceMusicOnHold'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67cf,0x1ed));var _0xf67c=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0x67cf[_0x2601b4];return _0x3e3661;};'use strict';var _=require(_0xf67c('0x0'));var util=require(_0xf67c('0x1'));var logger=require(_0xf67c('0x2'))(_0xf67c('0x3'));var moment=require(_0xf67c('0x4'));var BPromise=require(_0xf67c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf67c('0x6'));var rimraf=require(_0xf67c('0x7'));var config=require(_0xf67c('0x8'));var attributes=require(_0xf67c('0x9'));module['exports']=function(_0x5b39f1,_0x4ddd68){return _0x5b39f1['define'](_0xf67c('0xa'),attributes,{'tableName':_0xf67c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 35abb53..6ca4e37 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 _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x131774,_0x286ff1){var _0x22e32c=function(_0x2b3b38){while(--_0x2b3b38){_0x131774['push'](_0x131774['shift']());}};_0x22e32c(++_0x286ff1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0xc0c05c,_0x326bdf){var _0x22ccf0=function(_0x9da901){while(--_0x9da901){_0xc0c05c['push'](_0xc0c05c['shift']());}};_0x22ccf0(++_0x326bdf);}(_0xedd9,0xfc));var _0x9edd=function(_0x2806ee,_0x5b8fd4){_0x2806ee=_0x2806ee-0x0;var _0x5ec790=_0xedd9[_0x2806ee];return _0x5ec790;};'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});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 2f7dfb9..dd82262 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 _0xc932=['removeTeams','multer','connect-timeout','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','post','create','addAgents','put','update','delete','removeAgents'];(function(_0x532a06,_0x24b35d){var _0x5620ae=function(_0x1dfc88){while(--_0x1dfc88){_0x532a06['push'](_0x532a06['shift']());}};_0x5620ae(++_0x24b35d);}(_0xc932,0x18d));var _0x2c93=function(_0x64a51,_0x1c61b7){_0x64a51=_0x64a51-0x0;var _0x1eba45=_0xc932[_0x64a51];return _0x1eba45;};'use strict';var multer=require(_0x2c93('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2c93('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2c93('0x2'));var auth=require(_0x2c93('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x2c93('0x4')]('/',auth[_0x2c93('0x5')](),controller[_0x2c93('0x6')]);router['get'](_0x2c93('0x7'),auth[_0x2c93('0x5')](),controller[_0x2c93('0x8')]);router['get'](_0x2c93('0x9'),auth[_0x2c93('0x5')](),controller[_0x2c93('0xa')]);router[_0x2c93('0x4')](_0x2c93('0xb'),auth[_0x2c93('0x5')](),controller[_0x2c93('0xc')]);router['get'](_0x2c93('0xd'),auth['isAuthenticated'](),controller['getTeams']);router[_0x2c93('0xe')]('/',auth[_0x2c93('0x5')](),controller[_0x2c93('0xf')]);router[_0x2c93('0xe')](_0x2c93('0xb'),auth['isAuthenticated'](),controller[_0x2c93('0x10')]);router[_0x2c93('0xe')](_0x2c93('0xd'),auth[_0x2c93('0x5')](),controller['addTeams']);router[_0x2c93('0x11')](_0x2c93('0x9'),auth[_0x2c93('0x5')](),controller[_0x2c93('0x12')]);router['delete'](_0x2c93('0x9'),auth[_0x2c93('0x5')](),controller['destroy']);router[_0x2c93('0x13')]('/:id/users',auth[_0x2c93('0x5')](),controller[_0x2c93('0x14')]);router['delete'](_0x2c93('0xd'),auth['isAuthenticated'](),controller[_0x2c93('0x15')]);module['exports']=router; \ No newline at end of file +var _0xacc8=['addTeams','/:id','delete','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','index','isAuthenticated','show','/:id/users','getAgents','/:id/teams','getTeams','post','create'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xacc8,0xc5));var _0x8acc=function(_0x47cfb2,_0x550212){_0x47cfb2=_0x47cfb2-0x0;var _0x1d5212=_0xacc8[_0x47cfb2];return _0x1d5212;};'use strict';var multer=require(_0x8acc('0x0'));var util=require('util');var path=require(_0x8acc('0x1'));var timeout=require(_0x8acc('0x2'));var express=require(_0x8acc('0x3'));var router=express[_0x8acc('0x4')]();var fs_extra=require(_0x8acc('0x5'));var auth=require(_0x8acc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8acc('0x7'));var controller=require(_0x8acc('0x8'));router[_0x8acc('0x9')]('/',auth['isAuthenticated'](),controller[_0x8acc('0xa')]);router['get']('/describe',auth[_0x8acc('0xb')](),controller['describe']);router[_0x8acc('0x9')]('/:id',auth[_0x8acc('0xb')](),controller[_0x8acc('0xc')]);router['get'](_0x8acc('0xd'),auth[_0x8acc('0xb')](),controller[_0x8acc('0xe')]);router[_0x8acc('0x9')](_0x8acc('0xf'),auth[_0x8acc('0xb')](),controller[_0x8acc('0x10')]);router[_0x8acc('0x11')]('/',auth[_0x8acc('0xb')](),controller[_0x8acc('0x12')]);router[_0x8acc('0x11')]('/:id/users',auth[_0x8acc('0xb')](),controller['addAgents']);router[_0x8acc('0x11')](_0x8acc('0xf'),auth['isAuthenticated'](),controller[_0x8acc('0x13')]);router['put'](_0x8acc('0x14'),auth[_0x8acc('0xb')](),controller['update']);router[_0x8acc('0x15')](_0x8acc('0x14'),auth[_0x8acc('0xb')](),controller['destroy']);router[_0x8acc('0x15')](_0x8acc('0xd'),auth[_0x8acc('0xb')](),controller[_0x8acc('0x16')]);router['delete'](_0x8acc('0xf'),auth['isAuthenticated'](),controller['removeTeams']);module[_0x8acc('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 8609888..7a62ce5 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 _0xb2f8=['STRING','INTEGER','sequelize','exports','name','VIRTUAL','system-'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0xb2f8,0x19f));var _0x8b2f=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0xb2f8[_0x5a6644];return _0x3a2a5d;};'use strict';var Sequelize=require(_0x8b2f('0x0'));module[_0x8b2f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8b2f('0x2')},'prefix':{'type':Sequelize[_0x8b2f('0x3')],'get':function(_0x7af1c4){return _0x8b2f('0x4')+this['getDataValue'](_0x8b2f('0x2'))+'-';}},'description':{'type':Sequelize[_0x8b2f('0x5')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x8b2f('0x6')]}}; \ No newline at end of file +var _0xbd6a=['name','VIRTUAL','system-','INTEGER','sequelize','exports','STRING'];(function(_0x3202fb,_0x4667a5){var _0x23cf65=function(_0x23d6d8){while(--_0x23d6d8){_0x3202fb['push'](_0x3202fb['shift']());}};_0x23cf65(++_0x4667a5);}(_0xbd6a,0x107));var _0xabd6=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0xbd6a[_0x462999];return _0x4b1366;};'use strict';var Sequelize=require(_0xabd6('0x0'));module[_0xabd6('0x1')]={'name':{'type':Sequelize[_0xabd6('0x2')],'allowNull':![],'unique':_0xabd6('0x3')},'prefix':{'type':Sequelize[_0xabd6('0x4')],'get':function(_0x1a9678){return _0xabd6('0x5')+this['getDataValue'](_0xabd6('0x3'))+'-';}},'description':{'type':Sequelize[_0xabd6('0x2')]},'callerIdAll':{'type':Sequelize[_0xabd6('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xabd6('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index eea5dba..948aa44 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 _0x1893=['compact','value','isEmpty','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','error','name','index','map','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','VoicePrefix','includeAll','findAll','rows','show','length','options','find','catch','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','context','${EXTEN:','charAt','body','system-','findById','addAgents','params','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','rawAttributes','pick','getAgents','getTeams','addTeams','Team','Agents','online','voicePause','flatMap','each','upsert','findOrCreate','forEach','removeTeams','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1893,0xa2));var _0x3189=function(_0x2fcaa3,_0x2ba904){_0x2fcaa3=_0x2fcaa3-0x0;var _0x8f4089=_0x1893[_0x2fcaa3];return _0x8f4089;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3189('0x0'));var jsonpatch=require(_0x3189('0x1'));var rp=require(_0x3189('0x2'));var moment=require(_0x3189('0x3'));var BPromise=require(_0x3189('0x4'));var Mustache=require(_0x3189('0x5'));var util=require(_0x3189('0x6'));var path=require('path');var sox=require(_0x3189('0x7'));var csv=require(_0x3189('0x8'));var ejs=require(_0x3189('0x9'));var fs=require('fs');var fs_extra=require(_0x3189('0xa'));var _=require(_0x3189('0xb'));var squel=require(_0x3189('0xc'));var crypto=require(_0x3189('0xd'));var jsforce=require(_0x3189('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3189('0x8'));var querystring=require('querystring');var Papa=require(_0x3189('0xf'));var Redis=require('ioredis');var authService=require(_0x3189('0x10'));var qs=require(_0x3189('0x11'));var as=require(_0x3189('0x12'));var hardwareService=require(_0x3189('0x13'));var logger=require('../../config/logger')(_0x3189('0x14'));var utils=require(_0x3189('0x15'));var config=require(_0x3189('0x16'));var licenseUtil=require(_0x3189('0x17'));var db=require(_0x3189('0x18'))['db'];config['redis']=_[_0x3189('0x19')](config[_0x3189('0x1a')],{'host':_0x3189('0x1b'),'port':0x18eb});var socket=require(_0x3189('0x1c'))(new Redis(config[_0x3189('0x1a')]));require(_0x3189('0x1d'))[_0x3189('0x1e')](socket);function respondWithStatusCode(_0x25a917,_0x5521bb){_0x5521bb=_0x5521bb||0xcc;return function(_0x220b18){if(_0x220b18){return _0x25a917[_0x3189('0x1f')](_0x5521bb);}return _0x25a917[_0x3189('0x20')](_0x5521bb)[_0x3189('0x21')]();};}function respondWithResult(_0x486dd2,_0x40195d){_0x40195d=_0x40195d||0xc8;return function(_0x5f2e82){if(_0x5f2e82){return _0x486dd2['status'](_0x40195d)[_0x3189('0x22')](_0x5f2e82);}};}function respondWithFilteredResult(_0x49b1bc,_0x42c3a3){return function(_0xf8aed7){if(_0xf8aed7){var _0x22c7ba=typeof _0x42c3a3[_0x3189('0x23')]==='undefined'&&typeof _0x42c3a3[_0x3189('0x24')]===_0x3189('0x25');var _0x16edd7=_0xf8aed7['count'];var _0x561265=_0x22c7ba?0x0:_0x42c3a3[_0x3189('0x23')];var _0x306ed3=_0x22c7ba?_0xf8aed7[_0x3189('0x26')]:_0x42c3a3[_0x3189('0x23')]+_0x42c3a3['limit'];var _0x1771a8;if(_0x306ed3>=_0x16edd7){_0x306ed3=_0x16edd7;_0x1771a8=0xc8;}else{_0x1771a8=0xce;}_0x49b1bc[_0x3189('0x20')](_0x1771a8);return _0x49b1bc[_0x3189('0x27')]('Content-Range',_0x561265+'-'+_0x306ed3+'/'+_0x16edd7)[_0x3189('0x22')](_0xf8aed7);}return null;};}function patchUpdates(_0x47abb4){return function(_0x4bfc03){try{jsonpatch[_0x3189('0x28')](_0x4bfc03,_0x47abb4,!![]);}catch(_0x200f16){return BPromise[_0x3189('0x29')](_0x200f16);}return _0x4bfc03[_0x3189('0x2a')]();};}function saveUpdates(_0x393fcb,_0x5a08dc){return function(_0x4b03ad){if(_0x4b03ad){return _0x4b03ad[_0x3189('0x2b')](_0x393fcb)[_0x3189('0x2c')](function(_0x1dc1c8){return _0x1dc1c8;});}return null;};}function removeEntity(_0x3cc1e5,_0x103de4){return function(_0x3f4789){if(_0x3f4789){return _0x3f4789[_0x3189('0x2d')]()[_0x3189('0x2c')](function(){var _0x17b540=_0x3f4789[_0x3189('0x2e')]({'plain':!![]});var _0x5ce5f5='VoicePrefixes';return db['UserProfileResource'][_0x3189('0x2d')]({'where':{'type':_0x5ce5f5,'resourceId':_0x17b540['id']}})[_0x3189('0x2c')](function(){return _0x3f4789;});})[_0x3189('0x2c')](function(){_0x3cc1e5[_0x3189('0x20')](0xcc)[_0x3189('0x21')]();});}};}function handleEntityNotFound(_0x2f7504,_0x4d453a){return function(_0x1ab94b){if(!_0x1ab94b){_0x2f7504[_0x3189('0x1f')](0x194);}return _0x1ab94b;};}function handleError(_0x4bd677,_0x173f18){_0x173f18=_0x173f18||0x1f4;return function(_0x3744ff){logger[_0x3189('0x2f')](_0x3744ff['stack']);if(_0x3744ff[_0x3189('0x30')]){delete _0x3744ff[_0x3189('0x30')];}_0x4bd677[_0x3189('0x20')](_0x173f18)['send'](_0x3744ff);};}exports[_0x3189('0x31')]=function(_0x47f7a7,_0x51ce54){var _0x32ca90={},_0x34007b={},_0x374f23={'count':0x0,'rows':[]};var _0x3bdc84=_[_0x3189('0x32')](db['VoicePrefix']['rawAttributes'],function(_0x7d7745){return{'name':_0x7d7745['fieldName'],'type':_0x7d7745[_0x3189('0x33')][_0x3189('0x34')]};});_0x34007b[_0x3189('0x35')]=_[_0x3189('0x32')](_0x3bdc84,_0x3189('0x30'));_0x34007b[_0x3189('0x36')]=_[_0x3189('0x37')](_0x47f7a7[_0x3189('0x36')]);_0x34007b[_0x3189('0x38')]=_['intersection'](_0x34007b[_0x3189('0x35')],_0x34007b[_0x3189('0x36')]);_0x32ca90[_0x3189('0x39')]=_[_0x3189('0x3a')](_0x34007b[_0x3189('0x35')],qs[_0x3189('0x3b')](_0x47f7a7[_0x3189('0x36')]['fields']));_0x32ca90['attributes']=_0x32ca90[_0x3189('0x39')]['length']?_0x32ca90[_0x3189('0x39')]:_0x34007b[_0x3189('0x35')];if(!_0x47f7a7['query'][_0x3189('0x3c')](_0x3189('0x3d'))){_0x32ca90[_0x3189('0x24')]=qs[_0x3189('0x24')](_0x47f7a7['query'][_0x3189('0x24')]);_0x32ca90['offset']=qs['offset'](_0x47f7a7[_0x3189('0x36')][_0x3189('0x23')]);}_0x32ca90[_0x3189('0x3e')]=qs[_0x3189('0x3f')](_0x47f7a7[_0x3189('0x36')][_0x3189('0x3f')]);_0x32ca90[_0x3189('0x40')]=qs[_0x3189('0x38')](_['pick'](_0x47f7a7['query'],_0x34007b[_0x3189('0x38')]),_0x3bdc84);if(_0x47f7a7[_0x3189('0x36')][_0x3189('0x41')]){_0x32ca90[_0x3189('0x40')]=_[_0x3189('0x42')](_0x32ca90[_0x3189('0x40')],{'$or':_['map'](_0x3bdc84,function(_0x280146){if(_0x280146[_0x3189('0x33')]!==_0x3189('0x43')){var _0xaf76f1={};_0xaf76f1[_0x280146['name']]={'$like':'%'+_0x47f7a7[_0x3189('0x36')][_0x3189('0x41')]+'%'};return _0xaf76f1;}})});}_0x32ca90=_['merge']({},_0x32ca90,_0x47f7a7['options']);var _0x1ef1b2={'where':_0x32ca90['where']};return db[_0x3189('0x44')][_0x3189('0x26')](_0x1ef1b2)[_0x3189('0x2c')](function(_0x9593f3){_0x374f23['count']=_0x9593f3;if(_0x47f7a7[_0x3189('0x36')][_0x3189('0x45')]){_0x32ca90['include']=[{'all':!![]}];}return db[_0x3189('0x44')][_0x3189('0x46')](_0x32ca90);})[_0x3189('0x2c')](function(_0x3a6a36){_0x374f23[_0x3189('0x47')]=_0x3a6a36;return _0x374f23;})['then'](respondWithFilteredResult(_0x51ce54,_0x32ca90))['catch'](handleError(_0x51ce54,null));};exports[_0x3189('0x48')]=function(_0x5ca360,_0x44e45f){var _0xf095fe={'raw':![],'where':{'id':_0x5ca360['params']['id']}},_0x1a3e51={};_0x1a3e51[_0x3189('0x35')]=_[_0x3189('0x37')](db[_0x3189('0x44')]['rawAttributes']);_0x1a3e51[_0x3189('0x36')]=_[_0x3189('0x37')](_0x5ca360[_0x3189('0x36')]);_0x1a3e51[_0x3189('0x38')]=_[_0x3189('0x3a')](_0x1a3e51[_0x3189('0x35')],_0x1a3e51['query']);_0xf095fe['attributes']=_[_0x3189('0x3a')](_0x1a3e51['model'],qs['fields'](_0x5ca360[_0x3189('0x36')]['fields']));_0xf095fe[_0x3189('0x39')]=_0xf095fe[_0x3189('0x39')][_0x3189('0x49')]?_0xf095fe['attributes']:_0x1a3e51[_0x3189('0x35')];if(_0x5ca360['query'][_0x3189('0x45')]){_0xf095fe['include']=[{'all':!![]}];}_0xf095fe=_['merge']({},_0xf095fe,_0x5ca360[_0x3189('0x4a')]);return db['VoicePrefix'][_0x3189('0x4b')](_0xf095fe)['then'](handleEntityNotFound(_0x44e45f,null))['then'](respondWithResult(_0x44e45f,null))[_0x3189('0x4c')](handleError(_0x44e45f,null));};exports[_0x3189('0x2d')]=function(_0x4373f6,_0x35cb23){return db[_0x3189('0x44')][_0x3189('0x4b')]({'where':{'id':_0x4373f6['params']['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x35cb23,null))['then'](removeEntity(_0x35cb23,null))['catch'](handleError(_0x35cb23,null));};exports[_0x3189('0x4d')]=function(_0x4f641a,_0xd90868){return db[_0x3189('0x44')][_0x3189('0x4d')]()[_0x3189('0x2c')](respondWithResult(_0xd90868,null))['catch'](handleError(_0xd90868,null));};exports[_0x3189('0x4e')]=function(_0x4ad892,_0x35fdb2){var _0x242ec4;return db[_0x3189('0x4f')][_0x3189('0x50')](function(_0x4f41e5){return db[_0x3189('0x44')][_0x3189('0x4e')](_0x4ad892['body'],{'transaction':_0x4f41e5})[_0x3189('0x2c')](function(_0xbf07c5){_0x242ec4=_0xbf07c5[_0x3189('0x2e')]({'plain':!![]});return db[_0x3189('0x51')]['find']({'where':{'id':_0x242ec4[_0x3189('0x52')]},'raw':!![]})['then'](function(_0x1ebb0d){return createVoicePrefixExtensions(_0x242ec4,_0x1ebb0d,_0x4f41e5);});});})['then'](function(){var _0x460c6e=_0x4ad892[_0x3189('0x53')]['get']({'plain':!![]});if(!_0x460c6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x460c6e['role']===_0x3189('0x53')){var _0x5b14ac=_0x242ec4;return db[_0x3189('0x54')][_0x3189('0x4b')]({'where':{'name':_0x3189('0x55'),'userProfileId':_0x460c6e[_0x3189('0x56')]},'raw':!![]})[_0x3189('0x2c')](function(_0x40623f){if(_0x40623f&&_0x40623f[_0x3189('0x57')]===0x0){return db[_0x3189('0x58')][_0x3189('0x4e')]({'name':_0x5b14ac['name'],'resourceId':_0x5b14ac['id'],'type':_0x40623f[_0x3189('0x30')],'sectionId':_0x40623f['id']},{})[_0x3189('0x2c')](function(){return _0x242ec4;});}else{return _0x242ec4;}})[_0x3189('0x4c')](function(_0x429de3){logger[_0x3189('0x2f')](_0x3189('0x59'),_0x429de3);throw _0x429de3;});}return _0x242ec4;})[_0x3189('0x2c')](respondWithResult(_0x35fdb2,null))[_0x3189('0x4c')](handleError(_0x35fdb2,null));};function Extension(_0xa1316a,_0x68de3c,_0x187877,_0x3a2fe6){this['context']='from-sip';this[_0x3189('0x5a')]=_0xa1316a;this[_0x3189('0x5b')]=_0x187877;this[_0x3189('0x33')]=_0x3189('0x5c');this[_0x3189('0x5d')]=_0x3189('0x5e');this[_0x3189('0x5f')]=_0x68de3c;this[_0x3189('0x60')]=_0x3a2fe6;}function createVoicePrefixExtensions(_0x120a8a,_0x1472b6,_0xd45395){return new BPromise(function(_0x4f0ccb,_0x5b31dd){var _0x57aae5=new Extension(formatPrefixName(_0x120a8a[_0x3189('0x61')]),0x1,_0x3189('0x62'),'Voice\x20Prefix');_0x57aae5[_0x3189('0x63')]=_0x120a8a['id'];return db[_0x3189('0x51')][_0x3189('0x4e')](_0x57aae5,{'transaction':_0xd45395})[_0x3189('0x2c')](function(_0x26fdf2){var _0x4875a2=_0x26fdf2[_0x3189('0x2e')]({'plain':!![]});var _0x35a4d1=_[_0x3189('0x32')](addVoicePrefixExtensions(_0x120a8a,_0x1472b6),function(_0x228dfc){_0x228dfc['VoiceExtensionId']=_0x4875a2['id'];_0x228dfc[_0x3189('0x63')]=_0x120a8a['id'];return _0x228dfc;});return db[_0x3189('0x51')][_0x3189('0x64')](_0x35a4d1,{'transaction':_0xd45395})[_0x3189('0x2c')](function(_0x4a7172){if(!_0x4a7172){return _0x5b31dd(_0x3189('0x65'));}else{return _0x4f0ccb(_0x4a7172);}})['catch'](function(_0x1d7a44){return _0x5b31dd(_0x1d7a44);});});;});};function addVoicePrefixExtensions(_0x448635,_0x10fe1b){var _0xb02b4f=[];var _0x55bcf0=formatPrefixName(_0x448635[_0x3189('0x61')]);_0xb02b4f[_0x3189('0x66')](new Extension(_0x55bcf0,0x2,_0x3189('0x67'),_0x3189('0x68')+_0x448635[_0x3189('0x30')]));if(_0x448635[_0x3189('0x69')]){_0xb02b4f['push'](new Extension(_0x55bcf0,0x3,_0x3189('0x67'),_0x3189('0x6a')+_0x448635[_0x3189('0x69')]));}else{_0xb02b4f[_0x3189('0x66')](new Extension(_0x55bcf0,0x3,_0x3189('0x62'),'No\x20callerid\x20available'));}_0xb02b4f[_0x3189('0x66')](new Extension(_0x55bcf0,0x4,'goto',_0x10fe1b[_0x3189('0x6b')]+','+_0x3189('0x6c')+(0x8+_0x448635[_0x3189('0x30')][_0x3189('0x49')])+'}'+','+0x1));return _0xb02b4f;}function formatPrefixName(_0x46faac){var _0x458db9='_';for(var _0x403d31=0x0;_0x403d31<_0x46faac[_0x3189('0x49')];_0x403d31++){if(_0x46faac['charAt'](_0x403d31)=='-'){_0x458db9+=_0x46faac[_0x3189('0x6d')](_0x403d31);}else{_0x458db9+='['+_0x46faac['charAt'](_0x403d31)+']';}}_0x458db9+='.';return _0x458db9;}exports[_0x3189('0x2b')]=function(_0x2eedf4,_0xf740b0,_0x1e08f4){var _0x3d11ac=_0x2eedf4[_0x3189('0x6e')];_0x3d11ac['prefix']=_0x3189('0x6f')+_0x3d11ac[_0x3189('0x30')]+'-';return db['sequelize'][_0x3189('0x50')](function(_0x50438f){return db[_0x3189('0x44')][_0x3189('0x2b')](_0x3d11ac,{'where':{'id':_0x3d11ac['id']},'transaction':_0x50438f})[_0x3189('0x2c')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x3d11ac['id']},'transaction':_0x50438f})[_0x3189('0x2c')](function(){return db[_0x3189('0x51')][_0x3189('0x4b')]({'where':{'id':_0x3d11ac['VoiceExtensionId']},'raw':!![]})[_0x3189('0x2c')](function(_0x285b0d){return createVoicePrefixExtensions(_0x3d11ac,_0x285b0d,_0x50438f);});});});})['then'](function(){return db[_0x3189('0x44')][_0x3189('0x70')](_0x3d11ac['id']);})[_0x3189('0x2c')](respondWithResult(_0xf740b0,null))['catch'](handleError(_0xf740b0,null));};exports[_0x3189('0x71')]=function(_0x28bbe6,_0x3ab88e,_0x5d3478){return db['VoicePrefix'][_0x3189('0x4b')]({'where':{'id':_0x28bbe6[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x3ab88e,null))['then'](function(_0x1f57c7){if(_0x1f57c7){return _0x1f57c7[_0x3189('0x71')](_0x28bbe6[_0x3189('0x6e')][_0x3189('0x73')],_[_0x3189('0x74')](_0x28bbe6[_0x3189('0x6e')],[_0x3189('0x73'),'id'])||{})[_0x3189('0x75')](function(_0x2c110e){for(var _0x41d415=0x0;_0x41d415<_0x28bbe6['body'][_0x3189('0x73')][_0x3189('0x49')];_0x41d415+=0x1){socket[_0x3189('0x76')](_0x3189('0x77'),{'UserId':Number(_0x28bbe6[_0x3189('0x6e')][_0x3189('0x73')][_0x41d415]),'VoicePrefixId':Number(_0x28bbe6[_0x3189('0x72')]['id'])});}return _0x2c110e;});}})[_0x3189('0x2c')](respondWithResult(_0x3ab88e,null))['catch'](handleError(_0x3ab88e,null));};exports[_0x3189('0x78')]=function(_0x4861ba,_0x226a58,_0x176c44){return db[_0x3189('0x44')][_0x3189('0x4b')]({'where':{'id':_0x4861ba['params']['id']}})['then'](handleEntityNotFound(_0x226a58,null))[_0x3189('0x2c')](function(_0x2c0e85){if(_0x2c0e85){return _0x2c0e85[_0x3189('0x78')](_0x4861ba[_0x3189('0x36')]['ids'])[_0x3189('0x2c')](function(){if(_[_0x3189('0x79')](_0x4861ba['query'][_0x3189('0x73')])){for(var _0x65c13f=0x0;_0x65c13f<_0x4861ba['query'][_0x3189('0x73')][_0x3189('0x49')];_0x65c13f+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x4861ba[_0x3189('0x36')]['ids'][_0x65c13f]),'VoicePrefixId':Number(_0x4861ba[_0x3189('0x72')]['id'])});}}else{socket[_0x3189('0x76')](_0x3189('0x7a'),{'UserId':Number(_0x4861ba[_0x3189('0x36')][_0x3189('0x73')]),'VoicePrefixId':Number(_0x4861ba['params']['id'])});}});}})['then'](respondWithStatusCode(_0x226a58,null))[_0x3189('0x4c')](handleError(_0x226a58,null));};exports['getAgents']=function(_0x33b271,_0x5c138a,_0x583d35){var _0x51303a={};var _0x278553={};var _0x4917e3;var _0x2d3d78;return db[_0x3189('0x44')][_0x3189('0x7b')]({'where':{'id':_0x33b271[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x5c138a,null))[_0x3189('0x2c')](function(_0x4d3554){if(_0x4d3554){_0x4917e3=_0x4d3554;_0x278553[_0x3189('0x35')]=_[_0x3189('0x37')](db[_0x3189('0x7c')][_0x3189('0x7d')]);_0x278553[_0x3189('0x36')]=_['keys'](_0x33b271[_0x3189('0x36')]);_0x278553[_0x3189('0x38')]=_[_0x3189('0x3a')](_0x278553[_0x3189('0x35')],_0x278553[_0x3189('0x36')]);_0x51303a['attributes']=_[_0x3189('0x3a')](_0x278553[_0x3189('0x35')],qs[_0x3189('0x3b')](_0x33b271[_0x3189('0x36')][_0x3189('0x3b')]));_0x51303a[_0x3189('0x39')]=_0x51303a[_0x3189('0x39')][_0x3189('0x49')]?_0x51303a[_0x3189('0x39')]:_0x278553[_0x3189('0x35')];_0x51303a['order']=qs[_0x3189('0x3f')](_0x33b271[_0x3189('0x36')][_0x3189('0x3f')]);_0x51303a[_0x3189('0x40')]=qs[_0x3189('0x38')](_[_0x3189('0x7e')](_0x33b271['query'],_0x278553[_0x3189('0x38')]));if(_0x33b271['query'][_0x3189('0x41')]){_0x51303a['where']=_[_0x3189('0x42')](_0x51303a['where'],{'$or':_[_0x3189('0x32')](_0x51303a['attributes'],function(_0x3a84e8){var _0x17b46a={};_0x17b46a[_0x3a84e8]={'$like':'%'+_0x33b271['query'][_0x3189('0x41')]+'%'};return _0x17b46a;})});}_0x51303a=_[_0x3189('0x42')]({},_0x51303a,_0x33b271[_0x3189('0x4a')]);return _0x4917e3[_0x3189('0x7f')](_0x51303a);}})[_0x3189('0x2c')](function(_0x549bbd){if(_0x549bbd){_0x2d3d78=_0x549bbd['length'];if(!_0x33b271[_0x3189('0x36')][_0x3189('0x3c')](_0x3189('0x3d'))){_0x51303a[_0x3189('0x24')]=qs[_0x3189('0x24')](_0x33b271[_0x3189('0x36')]['limit']);_0x51303a[_0x3189('0x23')]=qs[_0x3189('0x23')](_0x33b271['query'][_0x3189('0x23')]);}return _0x4917e3[_0x3189('0x7f')](_0x51303a);}})[_0x3189('0x2c')](function(_0x5d10f8){if(_0x5d10f8){return _0x5d10f8?{'count':_0x2d3d78,'rows':_0x5d10f8}:null;}})[_0x3189('0x2c')](respondWithResult(_0x5c138a,null))[_0x3189('0x4c')](handleError(_0x5c138a,null));};exports[_0x3189('0x80')]=function(_0x24fec5,_0x5a7cf4,_0x2ef30c){var _0x14cecc={};var _0x2165f1={};var _0x1b8666;var _0x5bbf36;return db[_0x3189('0x44')][_0x3189('0x7b')]({'where':{'id':_0x24fec5[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x5a7cf4,null))['then'](function(_0x4371b7){if(_0x4371b7){_0x1b8666=_0x4371b7;_0x2165f1[_0x3189('0x35')]=_[_0x3189('0x37')](db['Team'][_0x3189('0x7d')]);_0x2165f1['query']=_[_0x3189('0x37')](_0x24fec5['query']);_0x2165f1[_0x3189('0x38')]=_[_0x3189('0x3a')](_0x2165f1[_0x3189('0x35')],_0x2165f1[_0x3189('0x36')]);_0x14cecc['attributes']=_[_0x3189('0x3a')](_0x2165f1[_0x3189('0x35')],qs[_0x3189('0x3b')](_0x24fec5[_0x3189('0x36')][_0x3189('0x3b')]));_0x14cecc[_0x3189('0x39')]=_0x14cecc['attributes']['length']?_0x14cecc[_0x3189('0x39')]:_0x2165f1[_0x3189('0x35')];_0x14cecc['order']=qs[_0x3189('0x3f')](_0x24fec5[_0x3189('0x36')][_0x3189('0x3f')]);_0x14cecc[_0x3189('0x40')]=qs['filters'](_[_0x3189('0x7e')](_0x24fec5[_0x3189('0x36')],_0x2165f1[_0x3189('0x38')]));if(_0x24fec5[_0x3189('0x36')]['filter']){_0x14cecc[_0x3189('0x40')]=_[_0x3189('0x42')](_0x14cecc['where'],{'$or':_[_0x3189('0x32')](_0x14cecc[_0x3189('0x39')],function(_0x5eeb3d){var _0xe94bda={};_0xe94bda[_0x5eeb3d]={'$like':'%'+_0x24fec5[_0x3189('0x36')]['filter']+'%'};return _0xe94bda;})});}_0x14cecc=_[_0x3189('0x42')]({},_0x14cecc,_0x24fec5[_0x3189('0x4a')]);return _0x1b8666[_0x3189('0x80')](_0x14cecc);}})[_0x3189('0x2c')](function(_0x23d34e){if(_0x23d34e){_0x5bbf36=_0x23d34e[_0x3189('0x49')];if(!_0x24fec5['query'][_0x3189('0x3c')](_0x3189('0x3d'))){_0x14cecc[_0x3189('0x24')]=qs[_0x3189('0x24')](_0x24fec5[_0x3189('0x36')][_0x3189('0x24')]);_0x14cecc[_0x3189('0x23')]=qs[_0x3189('0x23')](_0x24fec5['query'][_0x3189('0x23')]);}return _0x1b8666[_0x3189('0x80')](_0x14cecc);}})['then'](function(_0x418ef8){if(_0x418ef8){return _0x418ef8?{'count':_0x5bbf36,'rows':_0x418ef8}:null;}})[_0x3189('0x2c')](respondWithResult(_0x5a7cf4,null))['catch'](handleError(_0x5a7cf4,null));};exports[_0x3189('0x81')]=function(_0x85c195,_0x4917ee,_0x2a8f73){var _0x464843=_0x85c195[_0x3189('0x6e')][_0x3189('0x73')];var _0x429bc1;return db[_0x3189('0x82')]['findAll']({'where':{'id':_0x464843},'attributes':['id'],'include':[{'model':db[_0x3189('0x7c')],'as':_0x3189('0x83'),'attributes':['id','name',_0x3189('0x84'),_0x3189('0x85'),'interface'],'raw':!![]}]})['then'](function(_0x158199){if(_0x158199){_0x429bc1=_0x158199;var _0x431e68=_[_0x3189('0x86')](_0x158199,function(_0x18d525){var _0x5e565c=_0x18d525['get']({'plain':!![]});return _0x5e565c[_0x3189('0x83')];});return db[_0x3189('0x44')]['find']({'where':{'id':_0x85c195[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](function(_0x36262a){return db['sequelize'][_0x3189('0x50')](function(_0xd24f4a){return _0x36262a[_0x3189('0x81')](_0x464843,{'transaction':_0xd24f4a})[_0x3189('0x2c')](function(){return BPromise[_0x3189('0x87')](_0x429bc1,function(_0x33f64c){return db['TeamVoicePrefix'][_0x3189('0x88')]({'TeamId':_0x33f64c['id'],'VoicePrefixId':_0x85c195['params']['id']},{'transaction':_0xd24f4a});});})[_0x3189('0x2c')](function(){return BPromise[_0x3189('0x87')](_0x431e68,function(_0x1c919f){return db['UserVoicePrefix'][_0x3189('0x89')]({'where':{'UserId':_0x1c919f['id'],'VoicePrefixId':_0x85c195[_0x3189('0x72')]['id']},'transaction':_0xd24f4a});});})['then'](function(){_0x431e68[_0x3189('0x8a')](function(_0x2bab94){socket['emit'](_0x3189('0x77'),{'UserId':_0x2bab94['id'],'VoicePrefixId':_0x36262a['id']});});});});});}})[_0x3189('0x2c')](respondWithStatusCode(_0x4917ee,null))[_0x3189('0x4c')](handleError(_0x4917ee,null));};exports[_0x3189('0x8b')]=function(_0x39fe89,_0x4f564d,_0x341e23){return db['Team'][_0x3189('0x46')]({'where':{'id':_0x39fe89[_0x3189('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3189('0x7c')],'as':_0x3189('0x83'),'attributes':['id'],'raw':!![]}]})[_0x3189('0x2c')](handleEntityNotFound(_0x4f564d,null))['then'](function(_0x4fb475){var _0x522aa5=_[_0x3189('0x32')](_0x4fb475,'id');var _0x1f0c98=[];var _0x3f5cf9=[];var _0x47ce18=squel['select']();_0x47ce18[_0x3189('0x8c')](_0x3189('0x8d'))[_0x3189('0x8e')](_0x3189('0x8f'),'tq')[_0x3189('0x90')]('user_has_teams','ut',_0x3189('0x91'))['where'](_0x3189('0x92'),_0x39fe89['params']['id']);for(var _0x241a67=0x0;_0x241a67<_0x4fb475[_0x3189('0x49')];_0x241a67+=0x1){let _0x51913c=_0x4fb475[_0x241a67];for(var _0x1a07d7=0x0;_0x1a07d7<_0x51913c[_0x3189('0x83')][_0x3189('0x49')];_0x1a07d7+=0x1){let _0x36602c=_0x51913c['Agents'][_0x1a07d7];var _0x1f9018=_0x47ce18[_0x3189('0x93')]();_0x1f9018[_0x3189('0x40')]('ut.UserId\x20=\x20?',_0x36602c['id']);_0x3f5cf9[_0x3189('0x66')](db[_0x3189('0x4f')][_0x3189('0x36')](_0x1f9018[_0x3189('0x94')](),{'type':db['sequelize'][_0x3189('0x95')][_0x3189('0x96')]})[_0x3189('0x2c')](function(_0x13fc9f){if(_0x13fc9f[_0x3189('0x49')]===0x1){return _0x36602c['id'];}else{var _0x516164=_[_0x3189('0x97')](_['map'](_0x13fc9f,_0x3189('0x98')),function(_0x1f506c){return _[_0x3189('0x99')](_0x522aa5,_0x1f506c);});if(_0x516164){return _0x36602c['id'];}}}));}}return BPromise[_0x3189('0x9a')](_0x3f5cf9)[_0x3189('0x2c')](function(_0x48835c){_0x1f0c98=_(_0x1f0c98)[_0x3189('0x9b')](_0x48835c)[_0x3189('0x9c')]()[_0x3189('0x9d')]();return db['VoicePrefix']['find']({'where':{'id':_0x39fe89[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](function(_0x4c19e2){return db[_0x3189('0x4f')][_0x3189('0x50')](function(_0x5d89ec){return _0x4c19e2[_0x3189('0x8b')](_0x39fe89[_0x3189('0x36')][_0x3189('0x73')],{'transaction':_0x5d89ec})['then'](function(){if(!_[_0x3189('0x9e')](_0x1f0c98)){return _0x4c19e2[_0x3189('0x78')](_0x1f0c98,{'transaction':_0x5d89ec});}})['then'](function(){_0x1f0c98[_0x3189('0x8a')](function(_0xab746c){socket[_0x3189('0x76')](_0x3189('0x7a'),{'UserId':_0xab746c,'VoicePrefixId':_0x4c19e2['id']});});});});});});})[_0x3189('0x2c')](respondWithStatusCode(_0x4f564d,null))[_0x3189('0x4c')](handleError(_0x4f564d,null));}; \ No newline at end of file +var _0x9f0e=['limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','index','map','VoicePrefix','rawAttributes','key','keys','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','filters','options','find','describe','create','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','sequelize','findById','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','order','pick','getAgents','getTeams','Team','User','Agents','flatMap','addTeams','each','TeamVoicePrefix','upsert','forEach','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','TeamId','all','union','value','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','status','end','json','undefined'];(function(_0x409518,_0x47c046){var _0x4de2d8=function(_0x1572ce){while(--_0x1572ce){_0x409518['push'](_0x409518['shift']());}};_0x4de2d8(++_0x47c046);}(_0x9f0e,0x116));var _0xe9f0=function(_0x4e4806,_0x5a697b){_0x4e4806=_0x4e4806-0x0;var _0x1f04c5=_0x9f0e[_0x4e4806];return _0x1f04c5;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];config['redis']=_[_0xe9f0('0x19')](config[_0xe9f0('0x1a')],{'host':_0xe9f0('0x1b'),'port':0x18eb});var socket=require(_0xe9f0('0x1c'))(new Redis(config['redis']));require(_0xe9f0('0x1d'))['register'](socket);function respondWithStatusCode(_0x1e3ba8,_0x23914b){_0x23914b=_0x23914b||0xcc;return function(_0x3800e8){if(_0x3800e8){return _0x1e3ba8['sendStatus'](_0x23914b);}return _0x1e3ba8[_0xe9f0('0x1e')](_0x23914b)[_0xe9f0('0x1f')]();};}function respondWithResult(_0x2e68ef,_0x598eee){_0x598eee=_0x598eee||0xc8;return function(_0xaa7aa6){if(_0xaa7aa6){return _0x2e68ef[_0xe9f0('0x1e')](_0x598eee)[_0xe9f0('0x20')](_0xaa7aa6);}};}function respondWithFilteredResult(_0xd71ac8,_0x3ed69a){return function(_0x2ab12b){if(_0x2ab12b){var _0x3da237=typeof _0x3ed69a['offset']===_0xe9f0('0x21')&&typeof _0x3ed69a[_0xe9f0('0x22')]===_0xe9f0('0x21');var _0x5c4182=_0x2ab12b[_0xe9f0('0x23')];var _0x30b8c7=_0x3da237?0x0:_0x3ed69a[_0xe9f0('0x24')];var _0x43f399=_0x3da237?_0x2ab12b['count']:_0x3ed69a[_0xe9f0('0x24')]+_0x3ed69a[_0xe9f0('0x22')];var _0x583687;if(_0x43f399>=_0x5c4182){_0x43f399=_0x5c4182;_0x583687=0xc8;}else{_0x583687=0xce;}_0xd71ac8['status'](_0x583687);return _0xd71ac8['set'](_0xe9f0('0x25'),_0x30b8c7+'-'+_0x43f399+'/'+_0x5c4182)[_0xe9f0('0x20')](_0x2ab12b);}return null;};}function patchUpdates(_0x1211ae){return function(_0x316cdf){try{jsonpatch[_0xe9f0('0x26')](_0x316cdf,_0x1211ae,!![]);}catch(_0x4a5c27){return BPromise[_0xe9f0('0x27')](_0x4a5c27);}return _0x316cdf[_0xe9f0('0x28')]();};}function saveUpdates(_0x437d43,_0x10801b){return function(_0x3ca991){if(_0x3ca991){return _0x3ca991[_0xe9f0('0x29')](_0x437d43)[_0xe9f0('0x2a')](function(_0x1321bb){return _0x1321bb;});}return null;};}function removeEntity(_0x3c4ba9,_0x3fce54){return function(_0x48128a){if(_0x48128a){return _0x48128a[_0xe9f0('0x2b')]()[_0xe9f0('0x2a')](function(){var _0x2ddfba=_0x48128a[_0xe9f0('0x2c')]({'plain':!![]});var _0x4cf1b1=_0xe9f0('0x2d');return db[_0xe9f0('0x2e')][_0xe9f0('0x2b')]({'where':{'type':_0x4cf1b1,'resourceId':_0x2ddfba['id']}})[_0xe9f0('0x2a')](function(){return _0x48128a;});})[_0xe9f0('0x2a')](function(){_0x3c4ba9['status'](0xcc)[_0xe9f0('0x1f')]();});}};}function handleEntityNotFound(_0xdc16bc,_0x44fb5b){return function(_0xab3d81){if(!_0xab3d81){_0xdc16bc[_0xe9f0('0x2f')](0x194);}return _0xab3d81;};}function handleError(_0xd19788,_0x1d788a){_0x1d788a=_0x1d788a||0x1f4;return function(_0x2efd33){logger[_0xe9f0('0x30')](_0x2efd33[_0xe9f0('0x31')]);if(_0x2efd33[_0xe9f0('0x32')]){delete _0x2efd33[_0xe9f0('0x32')];}_0xd19788[_0xe9f0('0x1e')](_0x1d788a)[_0xe9f0('0x33')](_0x2efd33);};}exports[_0xe9f0('0x34')]=function(_0x2097c4,_0x80e3ac){var _0x3e1846={},_0x2e7535={},_0x19d799={'count':0x0,'rows':[]};var _0x4089cc=_[_0xe9f0('0x35')](db[_0xe9f0('0x36')][_0xe9f0('0x37')],function(_0x5480ce){return{'name':_0x5480ce['fieldName'],'type':_0x5480ce['type'][_0xe9f0('0x38')]};});_0x2e7535['model']=_[_0xe9f0('0x35')](_0x4089cc,_0xe9f0('0x32'));_0x2e7535['query']=_[_0xe9f0('0x39')](_0x2097c4['query']);_0x2e7535['filters']=_['intersection'](_0x2e7535[_0xe9f0('0x3a')],_0x2e7535[_0xe9f0('0x3b')]);_0x3e1846['attributes']=_[_0xe9f0('0x3c')](_0x2e7535[_0xe9f0('0x3a')],qs[_0xe9f0('0x3d')](_0x2097c4['query']['fields']));_0x3e1846[_0xe9f0('0x3e')]=_0x3e1846[_0xe9f0('0x3e')][_0xe9f0('0x3f')]?_0x3e1846['attributes']:_0x2e7535[_0xe9f0('0x3a')];if(!_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x40')](_0xe9f0('0x41'))){_0x3e1846[_0xe9f0('0x22')]=qs['limit'](_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x22')]);_0x3e1846[_0xe9f0('0x24')]=qs['offset'](_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x24')]);}_0x3e1846['order']=qs[_0xe9f0('0x42')](_0x2097c4['query'][_0xe9f0('0x42')]);_0x3e1846['where']=qs['filters'](_['pick'](_0x2097c4['query'],_0x2e7535['filters']),_0x4089cc);if(_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x43')]){_0x3e1846[_0xe9f0('0x44')]=_[_0xe9f0('0x45')](_0x3e1846[_0xe9f0('0x44')],{'$or':_[_0xe9f0('0x35')](_0x4089cc,function(_0x3d4eb7){if(_0x3d4eb7[_0xe9f0('0x46')]!==_0xe9f0('0x47')){var _0x4e1c68={};_0x4e1c68[_0x3d4eb7[_0xe9f0('0x32')]]={'$like':'%'+_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x43')]+'%'};return _0x4e1c68;}})});}_0x3e1846=_['merge']({},_0x3e1846,_0x2097c4['options']);var _0x3cbf49={'where':_0x3e1846['where']};return db[_0xe9f0('0x36')][_0xe9f0('0x23')](_0x3cbf49)[_0xe9f0('0x2a')](function(_0x42d9d2){_0x19d799['count']=_0x42d9d2;if(_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x48')]){_0x3e1846[_0xe9f0('0x49')]=[{'all':!![]}];}return db[_0xe9f0('0x36')][_0xe9f0('0x4a')](_0x3e1846);})['then'](function(_0x60a40d){_0x19d799[_0xe9f0('0x4b')]=_0x60a40d;return _0x19d799;})[_0xe9f0('0x2a')](respondWithFilteredResult(_0x80e3ac,_0x3e1846))[_0xe9f0('0x4c')](handleError(_0x80e3ac,null));};exports[_0xe9f0('0x4d')]=function(_0x4ffc17,_0x3a8d1d){var _0x54ab8f={'raw':![],'where':{'id':_0x4ffc17[_0xe9f0('0x4e')]['id']}},_0x54e432={};_0x54e432[_0xe9f0('0x3a')]=_['keys'](db[_0xe9f0('0x36')][_0xe9f0('0x37')]);_0x54e432[_0xe9f0('0x3b')]=_[_0xe9f0('0x39')](_0x4ffc17[_0xe9f0('0x3b')]);_0x54e432[_0xe9f0('0x4f')]=_[_0xe9f0('0x3c')](_0x54e432['model'],_0x54e432[_0xe9f0('0x3b')]);_0x54ab8f['attributes']=_[_0xe9f0('0x3c')](_0x54e432['model'],qs[_0xe9f0('0x3d')](_0x4ffc17['query'][_0xe9f0('0x3d')]));_0x54ab8f[_0xe9f0('0x3e')]=_0x54ab8f[_0xe9f0('0x3e')]['length']?_0x54ab8f[_0xe9f0('0x3e')]:_0x54e432[_0xe9f0('0x3a')];if(_0x4ffc17[_0xe9f0('0x3b')][_0xe9f0('0x48')]){_0x54ab8f[_0xe9f0('0x49')]=[{'all':!![]}];}_0x54ab8f=_[_0xe9f0('0x45')]({},_0x54ab8f,_0x4ffc17[_0xe9f0('0x50')]);return db[_0xe9f0('0x36')][_0xe9f0('0x51')](_0x54ab8f)[_0xe9f0('0x2a')](handleEntityNotFound(_0x3a8d1d,null))[_0xe9f0('0x2a')](respondWithResult(_0x3a8d1d,null))[_0xe9f0('0x4c')](handleError(_0x3a8d1d,null));};exports['destroy']=function(_0x55e898,_0x31aa19){return db[_0xe9f0('0x36')][_0xe9f0('0x51')]({'where':{'id':_0x55e898['params']['id']}})[_0xe9f0('0x2a')](handleEntityNotFound(_0x31aa19,null))['then'](removeEntity(_0x31aa19,null))[_0xe9f0('0x4c')](handleError(_0x31aa19,null));};exports[_0xe9f0('0x52')]=function(_0x31770f,_0x4e8416){return db['VoicePrefix'][_0xe9f0('0x52')]()[_0xe9f0('0x2a')](respondWithResult(_0x4e8416,null))['catch'](handleError(_0x4e8416,null));};exports[_0xe9f0('0x53')]=function(_0xafb4d7,_0x33f26c){var _0xa26972;return db['sequelize'][_0xe9f0('0x54')](function(_0x3a5d19){return db[_0xe9f0('0x36')][_0xe9f0('0x53')](_0xafb4d7[_0xe9f0('0x55')],{'transaction':_0x3a5d19})[_0xe9f0('0x2a')](function(_0x1cba23){_0xa26972=_0x1cba23[_0xe9f0('0x2c')]({'plain':!![]});return db['VoiceExtension'][_0xe9f0('0x51')]({'where':{'id':_0xa26972[_0xe9f0('0x56')]},'raw':!![]})[_0xe9f0('0x2a')](function(_0x4728e7){return createVoicePrefixExtensions(_0xa26972,_0x4728e7,_0x3a5d19);});});})[_0xe9f0('0x2a')](function(){var _0xe67052=_0xafb4d7[_0xe9f0('0x57')][_0xe9f0('0x2c')]({'plain':!![]});if(!_0xe67052)throw new Error(_0xe9f0('0x58'));if(_0xe67052[_0xe9f0('0x59')]===_0xe9f0('0x57')){var _0x3c26ac=_0xa26972;return db[_0xe9f0('0x5a')][_0xe9f0('0x51')]({'where':{'name':'VoicePrefixes','userProfileId':_0xe67052[_0xe9f0('0x5b')]},'raw':!![]})[_0xe9f0('0x2a')](function(_0x52bcce){if(_0x52bcce&&_0x52bcce['autoAssociation']===0x0){return db['UserProfileResource'][_0xe9f0('0x53')]({'name':_0x3c26ac['name'],'resourceId':_0x3c26ac['id'],'type':_0x52bcce[_0xe9f0('0x32')],'sectionId':_0x52bcce['id']},{})[_0xe9f0('0x2a')](function(){return _0xa26972;});}else{return _0xa26972;}})[_0xe9f0('0x4c')](function(_0x4c983e){logger[_0xe9f0('0x30')](_0xe9f0('0x5c'),_0x4c983e);throw _0x4c983e;});}return _0xa26972;})[_0xe9f0('0x2a')](respondWithResult(_0x33f26c,null))[_0xe9f0('0x4c')](handleError(_0x33f26c,null));};function Extension(_0x4bb39d,_0x392eae,_0x3a05e7,_0x28a66e){this[_0xe9f0('0x5d')]='from-sip';this['exten']=_0x4bb39d;this[_0xe9f0('0x5e')]=_0x3a05e7;this[_0xe9f0('0x46')]=_0xe9f0('0x5f');this[_0xe9f0('0x60')]=_0xe9f0('0x61');this['priority']=_0x392eae;this[_0xe9f0('0x62')]=_0x28a66e;}function createVoicePrefixExtensions(_0x55ce2d,_0x16b3c0,_0x5858a9){return new BPromise(function(_0x7c05aa,_0x15ece3){var _0x8b26f2=new Extension(formatPrefixName(_0x55ce2d[_0xe9f0('0x63')]),0x1,_0xe9f0('0x64'),'Voice\x20Prefix');_0x8b26f2['VoicePrefixId']=_0x55ce2d['id'];return db['VoiceExtension'][_0xe9f0('0x53')](_0x8b26f2,{'transaction':_0x5858a9})[_0xe9f0('0x2a')](function(_0x4f6f7c){var _0x2fd3b2=_0x4f6f7c['get']({'plain':!![]});var _0x4f6a5b=_[_0xe9f0('0x35')](addVoicePrefixExtensions(_0x55ce2d,_0x16b3c0),function(_0x329e9e){_0x329e9e[_0xe9f0('0x56')]=_0x2fd3b2['id'];_0x329e9e[_0xe9f0('0x65')]=_0x55ce2d['id'];return _0x329e9e;});return db[_0xe9f0('0x66')][_0xe9f0('0x67')](_0x4f6a5b,{'transaction':_0x5858a9})['then'](function(_0x5e4ad4){if(!_0x5e4ad4){return _0x15ece3(_0xe9f0('0x68'));}else{return _0x7c05aa(_0x5e4ad4);}})[_0xe9f0('0x4c')](function(_0x12d40a){return _0x15ece3(_0x12d40a);});});;});};function addVoicePrefixExtensions(_0x1f57a1,_0x55dae1){var _0xb9b439=[];var _0x83dea9=formatPrefixName(_0x1f57a1[_0xe9f0('0x63')]);_0xb9b439[_0xe9f0('0x69')](new Extension(_0x83dea9,0x2,_0xe9f0('0x6a'),_0xe9f0('0x6b')+_0x1f57a1['name']));if(_0x1f57a1[_0xe9f0('0x6c')]){_0xb9b439[_0xe9f0('0x69')](new Extension(_0x83dea9,0x3,_0xe9f0('0x6a'),_0xe9f0('0x6d')+_0x1f57a1[_0xe9f0('0x6c')]));}else{_0xb9b439['push'](new Extension(_0x83dea9,0x3,_0xe9f0('0x64'),_0xe9f0('0x6e')));}_0xb9b439[_0xe9f0('0x69')](new Extension(_0x83dea9,0x4,_0xe9f0('0x6f'),_0x55dae1[_0xe9f0('0x5d')]+','+_0xe9f0('0x70')+(0x8+_0x1f57a1[_0xe9f0('0x32')][_0xe9f0('0x3f')])+'}'+','+0x1));return _0xb9b439;}function formatPrefixName(_0x2eaead){var _0x27e6bc='_';for(var _0xeaab41=0x0;_0xeaab41<_0x2eaead[_0xe9f0('0x3f')];_0xeaab41++){if(_0x2eaead['charAt'](_0xeaab41)=='-'){_0x27e6bc+=_0x2eaead[_0xe9f0('0x71')](_0xeaab41);}else{_0x27e6bc+='['+_0x2eaead[_0xe9f0('0x71')](_0xeaab41)+']';}}_0x27e6bc+='.';return _0x27e6bc;}exports[_0xe9f0('0x29')]=function(_0x116ec5,_0x3c700e,_0x2428aa){var _0x158e44=_0x116ec5['body'];_0x158e44[_0xe9f0('0x63')]=_0xe9f0('0x72')+_0x158e44['name']+'-';return db[_0xe9f0('0x73')][_0xe9f0('0x54')](function(_0x442b78){return db['VoicePrefix'][_0xe9f0('0x29')](_0x158e44,{'where':{'id':_0x158e44['id']},'transaction':_0x442b78})[_0xe9f0('0x2a')](function(){return db['VoiceExtension'][_0xe9f0('0x2b')]({'where':{'VoicePrefixId':_0x158e44['id']},'transaction':_0x442b78})[_0xe9f0('0x2a')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x158e44[_0xe9f0('0x56')]},'raw':!![]})['then'](function(_0x386d7b){return createVoicePrefixExtensions(_0x158e44,_0x386d7b,_0x442b78);});});});})[_0xe9f0('0x2a')](function(){return db['VoicePrefix'][_0xe9f0('0x74')](_0x158e44['id']);})[_0xe9f0('0x2a')](respondWithResult(_0x3c700e,null))[_0xe9f0('0x4c')](handleError(_0x3c700e,null));};exports[_0xe9f0('0x75')]=function(_0x161ee4,_0x8096c2,_0x42e4e9){return db[_0xe9f0('0x36')][_0xe9f0('0x51')]({'where':{'id':_0x161ee4['params']['id']}})[_0xe9f0('0x2a')](handleEntityNotFound(_0x8096c2,null))[_0xe9f0('0x2a')](function(_0xe7fdb){if(_0xe7fdb){return _0xe7fdb[_0xe9f0('0x75')](_0x161ee4[_0xe9f0('0x55')][_0xe9f0('0x76')],_[_0xe9f0('0x77')](_0x161ee4[_0xe9f0('0x55')],['ids','id'])||{})[_0xe9f0('0x78')](function(_0x17c18c){for(var _0x2ce60c=0x0;_0x2ce60c<_0x161ee4[_0xe9f0('0x55')][_0xe9f0('0x76')][_0xe9f0('0x3f')];_0x2ce60c+=0x1){socket['emit'](_0xe9f0('0x79'),{'UserId':Number(_0x161ee4['body']['ids'][_0x2ce60c]),'VoicePrefixId':Number(_0x161ee4['params']['id'])});}return _0x17c18c;});}})[_0xe9f0('0x2a')](respondWithResult(_0x8096c2,null))[_0xe9f0('0x4c')](handleError(_0x8096c2,null));};exports[_0xe9f0('0x7a')]=function(_0x3b5b57,_0x2bf006,_0x8f8df5){return db[_0xe9f0('0x36')][_0xe9f0('0x51')]({'where':{'id':_0x3b5b57[_0xe9f0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2bf006,null))[_0xe9f0('0x2a')](function(_0x29eee2){if(_0x29eee2){return _0x29eee2[_0xe9f0('0x7a')](_0x3b5b57[_0xe9f0('0x3b')][_0xe9f0('0x76')])[_0xe9f0('0x2a')](function(){if(_[_0xe9f0('0x7b')](_0x3b5b57[_0xe9f0('0x3b')][_0xe9f0('0x76')])){for(var _0x1a4217=0x0;_0x1a4217<_0x3b5b57['query']['ids'][_0xe9f0('0x3f')];_0x1a4217+=0x1){socket[_0xe9f0('0x7c')](_0xe9f0('0x7d'),{'UserId':Number(_0x3b5b57[_0xe9f0('0x3b')][_0xe9f0('0x76')][_0x1a4217]),'VoicePrefixId':Number(_0x3b5b57[_0xe9f0('0x4e')]['id'])});}}else{socket[_0xe9f0('0x7c')](_0xe9f0('0x7d'),{'UserId':Number(_0x3b5b57['query']['ids']),'VoicePrefixId':Number(_0x3b5b57[_0xe9f0('0x4e')]['id'])});}});}})[_0xe9f0('0x2a')](respondWithStatusCode(_0x2bf006,null))['catch'](handleError(_0x2bf006,null));};exports['getAgents']=function(_0x2c9d84,_0x145040,_0x3ed26a){var _0xab92b={};var _0x2f73cd={};var _0x5553df;var _0x20c026;return db[_0xe9f0('0x36')][_0xe9f0('0x7e')]({'where':{'id':_0x2c9d84[_0xe9f0('0x4e')]['id']}})[_0xe9f0('0x2a')](handleEntityNotFound(_0x145040,null))[_0xe9f0('0x2a')](function(_0x2aca09){if(_0x2aca09){_0x5553df=_0x2aca09;_0x2f73cd['model']=_['keys'](db['User'][_0xe9f0('0x37')]);_0x2f73cd[_0xe9f0('0x3b')]=_[_0xe9f0('0x39')](_0x2c9d84[_0xe9f0('0x3b')]);_0x2f73cd['filters']=_[_0xe9f0('0x3c')](_0x2f73cd['model'],_0x2f73cd[_0xe9f0('0x3b')]);_0xab92b['attributes']=_[_0xe9f0('0x3c')](_0x2f73cd[_0xe9f0('0x3a')],qs[_0xe9f0('0x3d')](_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x3d')]));_0xab92b[_0xe9f0('0x3e')]=_0xab92b['attributes'][_0xe9f0('0x3f')]?_0xab92b[_0xe9f0('0x3e')]:_0x2f73cd[_0xe9f0('0x3a')];_0xab92b[_0xe9f0('0x7f')]=qs[_0xe9f0('0x42')](_0x2c9d84['query'][_0xe9f0('0x42')]);_0xab92b[_0xe9f0('0x44')]=qs['filters'](_[_0xe9f0('0x80')](_0x2c9d84['query'],_0x2f73cd[_0xe9f0('0x4f')]));if(_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x43')]){_0xab92b['where']=_[_0xe9f0('0x45')](_0xab92b[_0xe9f0('0x44')],{'$or':_[_0xe9f0('0x35')](_0xab92b['attributes'],function(_0x2a5d79){var _0x473f78={};_0x473f78[_0x2a5d79]={'$like':'%'+_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x43')]+'%'};return _0x473f78;})});}_0xab92b=_[_0xe9f0('0x45')]({},_0xab92b,_0x2c9d84[_0xe9f0('0x50')]);return _0x5553df[_0xe9f0('0x81')](_0xab92b);}})['then'](function(_0x4a416c){if(_0x4a416c){_0x20c026=_0x4a416c[_0xe9f0('0x3f')];if(!_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x40')]('nolimit')){_0xab92b[_0xe9f0('0x22')]=qs[_0xe9f0('0x22')](_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x22')]);_0xab92b['offset']=qs['offset'](_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x24')]);}return _0x5553df['getAgents'](_0xab92b);}})[_0xe9f0('0x2a')](function(_0x5b26b1){if(_0x5b26b1){return _0x5b26b1?{'count':_0x20c026,'rows':_0x5b26b1}:null;}})['then'](respondWithResult(_0x145040,null))[_0xe9f0('0x4c')](handleError(_0x145040,null));};exports[_0xe9f0('0x82')]=function(_0x77b59d,_0x32ad0e,_0x10c4cf){var _0x563f55={};var _0x5761d3={};var _0x3e323e;var _0x41c1a9;return db[_0xe9f0('0x36')][_0xe9f0('0x7e')]({'where':{'id':_0x77b59d[_0xe9f0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x32ad0e,null))['then'](function(_0x5ae1ce){if(_0x5ae1ce){_0x3e323e=_0x5ae1ce;_0x5761d3[_0xe9f0('0x3a')]=_['keys'](db[_0xe9f0('0x83')][_0xe9f0('0x37')]);_0x5761d3[_0xe9f0('0x3b')]=_[_0xe9f0('0x39')](_0x77b59d[_0xe9f0('0x3b')]);_0x5761d3[_0xe9f0('0x4f')]=_['intersection'](_0x5761d3['model'],_0x5761d3[_0xe9f0('0x3b')]);_0x563f55[_0xe9f0('0x3e')]=_[_0xe9f0('0x3c')](_0x5761d3[_0xe9f0('0x3a')],qs[_0xe9f0('0x3d')](_0x77b59d[_0xe9f0('0x3b')][_0xe9f0('0x3d')]));_0x563f55[_0xe9f0('0x3e')]=_0x563f55[_0xe9f0('0x3e')][_0xe9f0('0x3f')]?_0x563f55[_0xe9f0('0x3e')]:_0x5761d3[_0xe9f0('0x3a')];_0x563f55[_0xe9f0('0x7f')]=qs[_0xe9f0('0x42')](_0x77b59d['query'][_0xe9f0('0x42')]);_0x563f55[_0xe9f0('0x44')]=qs[_0xe9f0('0x4f')](_[_0xe9f0('0x80')](_0x77b59d[_0xe9f0('0x3b')],_0x5761d3[_0xe9f0('0x4f')]));if(_0x77b59d[_0xe9f0('0x3b')][_0xe9f0('0x43')]){_0x563f55[_0xe9f0('0x44')]=_[_0xe9f0('0x45')](_0x563f55[_0xe9f0('0x44')],{'$or':_['map'](_0x563f55[_0xe9f0('0x3e')],function(_0x2b9c16){var _0x41ef5b={};_0x41ef5b[_0x2b9c16]={'$like':'%'+_0x77b59d[_0xe9f0('0x3b')][_0xe9f0('0x43')]+'%'};return _0x41ef5b;})});}_0x563f55=_[_0xe9f0('0x45')]({},_0x563f55,_0x77b59d[_0xe9f0('0x50')]);return _0x3e323e[_0xe9f0('0x82')](_0x563f55);}})['then'](function(_0x5c5ac9){if(_0x5c5ac9){_0x41c1a9=_0x5c5ac9[_0xe9f0('0x3f')];if(!_0x77b59d[_0xe9f0('0x3b')]['hasOwnProperty']('nolimit')){_0x563f55[_0xe9f0('0x22')]=qs[_0xe9f0('0x22')](_0x77b59d[_0xe9f0('0x3b')][_0xe9f0('0x22')]);_0x563f55[_0xe9f0('0x24')]=qs[_0xe9f0('0x24')](_0x77b59d['query'][_0xe9f0('0x24')]);}return _0x3e323e[_0xe9f0('0x82')](_0x563f55);}})['then'](function(_0x4d59c0){if(_0x4d59c0){return _0x4d59c0?{'count':_0x41c1a9,'rows':_0x4d59c0}:null;}})[_0xe9f0('0x2a')](respondWithResult(_0x32ad0e,null))[_0xe9f0('0x4c')](handleError(_0x32ad0e,null));};exports['addTeams']=function(_0x17013a,_0x63e374,_0x34eda8){var _0x5a38f4=_0x17013a[_0xe9f0('0x55')][_0xe9f0('0x76')];var _0x2a607b;return db[_0xe9f0('0x83')]['findAll']({'where':{'id':_0x5a38f4},'attributes':['id'],'include':[{'model':db[_0xe9f0('0x84')],'as':_0xe9f0('0x85'),'attributes':['id',_0xe9f0('0x32'),'online','voicePause','interface'],'raw':!![]}]})[_0xe9f0('0x2a')](function(_0x58db9d){if(_0x58db9d){_0x2a607b=_0x58db9d;var _0x4820a1=_[_0xe9f0('0x86')](_0x58db9d,function(_0x4cd8bc){var _0x1b2532=_0x4cd8bc[_0xe9f0('0x2c')]({'plain':!![]});return _0x1b2532[_0xe9f0('0x85')];});return db[_0xe9f0('0x36')]['find']({'where':{'id':_0x17013a[_0xe9f0('0x4e')]['id']}})[_0xe9f0('0x2a')](function(_0x231d94){return db[_0xe9f0('0x73')][_0xe9f0('0x54')](function(_0x25c2f6){return _0x231d94[_0xe9f0('0x87')](_0x5a38f4,{'transaction':_0x25c2f6})[_0xe9f0('0x2a')](function(){return BPromise[_0xe9f0('0x88')](_0x2a607b,function(_0x2cd0a5){return db[_0xe9f0('0x89')][_0xe9f0('0x8a')]({'TeamId':_0x2cd0a5['id'],'VoicePrefixId':_0x17013a[_0xe9f0('0x4e')]['id']},{'transaction':_0x25c2f6});});})['then'](function(){return BPromise[_0xe9f0('0x88')](_0x4820a1,function(_0x1d8fb5){return db['UserVoicePrefix']['findOrCreate']({'where':{'UserId':_0x1d8fb5['id'],'VoicePrefixId':_0x17013a[_0xe9f0('0x4e')]['id']},'transaction':_0x25c2f6});});})[_0xe9f0('0x2a')](function(){_0x4820a1[_0xe9f0('0x8b')](function(_0x1c0db4){socket['emit'](_0xe9f0('0x79'),{'UserId':_0x1c0db4['id'],'VoicePrefixId':_0x231d94['id']});});});});});}})[_0xe9f0('0x2a')](respondWithStatusCode(_0x63e374,null))[_0xe9f0('0x4c')](handleError(_0x63e374,null));};exports['removeTeams']=function(_0x448834,_0x116aec,_0x4398fd){return db[_0xe9f0('0x83')][_0xe9f0('0x4a')]({'where':{'id':_0x448834['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xe9f0('0x84')],'as':_0xe9f0('0x85'),'attributes':['id'],'raw':!![]}]})[_0xe9f0('0x2a')](handleEntityNotFound(_0x116aec,null))[_0xe9f0('0x2a')](function(_0x13ad0d){var _0x1b4977=_[_0xe9f0('0x35')](_0x13ad0d,'id');var _0x34f99d=[];var _0x5ae9f1=[];var _0x1aacfa=squel['select']();_0x1aacfa['field'](_0xe9f0('0x8c'))[_0xe9f0('0x8d')](_0xe9f0('0x8e'),'tq')['join'](_0xe9f0('0x8f'),'ut',_0xe9f0('0x90'))['where'](_0xe9f0('0x91'),_0x448834[_0xe9f0('0x4e')]['id']);for(var _0x14e369=0x0;_0x14e369<_0x13ad0d[_0xe9f0('0x3f')];_0x14e369+=0x1){let _0x56e09f=_0x13ad0d[_0x14e369];for(var _0x25750e=0x0;_0x25750e<_0x56e09f['Agents'][_0xe9f0('0x3f')];_0x25750e+=0x1){let _0x56e47c=_0x56e09f['Agents'][_0x25750e];var _0x58d863=_0x1aacfa[_0xe9f0('0x92')]();_0x58d863[_0xe9f0('0x44')]('ut.UserId\x20=\x20?',_0x56e47c['id']);_0x5ae9f1[_0xe9f0('0x69')](db[_0xe9f0('0x73')][_0xe9f0('0x3b')](_0x58d863[_0xe9f0('0x93')](),{'type':db[_0xe9f0('0x73')][_0xe9f0('0x94')][_0xe9f0('0x95')]})['then'](function(_0x5b10a5){if(_0x5b10a5[_0xe9f0('0x3f')]===0x1){return _0x56e47c['id'];}else{var _0x32eb6c=_['every'](_[_0xe9f0('0x35')](_0x5b10a5,_0xe9f0('0x96')),function(_0x96e959){return _['includes'](_0x1b4977,_0x96e959);});if(_0x32eb6c){return _0x56e47c['id'];}}}));}}return BPromise[_0xe9f0('0x97')](_0x5ae9f1)[_0xe9f0('0x2a')](function(_0x59fbca){_0x34f99d=_(_0x34f99d)[_0xe9f0('0x98')](_0x59fbca)['compact']()[_0xe9f0('0x99')]();return db[_0xe9f0('0x36')][_0xe9f0('0x51')]({'where':{'id':_0x448834[_0xe9f0('0x4e')]['id']}})[_0xe9f0('0x2a')](function(_0x305d2f){return db['sequelize'][_0xe9f0('0x54')](function(_0x17f9bd){return _0x305d2f[_0xe9f0('0x9a')](_0x448834[_0xe9f0('0x3b')][_0xe9f0('0x76')],{'transaction':_0x17f9bd})[_0xe9f0('0x2a')](function(){if(!_[_0xe9f0('0x9b')](_0x34f99d)){return _0x305d2f['removeAgents'](_0x34f99d,{'transaction':_0x17f9bd});}})['then'](function(){_0x34f99d[_0xe9f0('0x8b')](function(_0x3e8745){socket['emit'](_0xe9f0('0x7d'),{'UserId':_0x3e8745,'VoicePrefixId':_0x305d2f['id']});});});});});});})['then'](respondWithStatusCode(_0x116aec,null))[_0xe9f0('0x4c')](handleError(_0x116aec,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 82ca7a6..659f4d9 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 _0x3937=['save','update','emit','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x541d3d,_0x29cc7b){var _0x2c116d=function(_0x318264){while(--_0x318264){_0x541d3d['push'](_0x541d3d['shift']());}};_0x2c116d(++_0x29cc7b);}(_0x3937,0x9e));var _0x7393=function(_0x2440d3,_0x511aac){_0x2440d3=_0x2440d3-0x0;var _0x3d2e7f=_0x3937[_0x2440d3];return _0x3d2e7f;};'use strict';var EventEmitter=require(_0x7393('0x0'));var VoicePrefix=require(_0x7393('0x1'))['db'][_0x7393('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x7393('0x3')](0x0);var events={'afterCreate':_0x7393('0x4'),'afterUpdate':_0x7393('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2251e7){return function(_0x2d9f25,_0x2ac10e,_0x41f02c){VoicePrefixEvents[_0x7393('0x6')](_0x2251e7+':'+_0x2d9f25['id'],_0x2d9f25);VoicePrefixEvents[_0x7393('0x6')](_0x2251e7,_0x2d9f25);_0x41f02c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x7393('0x7')](e,emitEvent(event));}}module[_0x7393('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x1d45=['VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x40df5f,_0x8fd59f){var _0x1573f1=function(_0x57b8b8){while(--_0x57b8b8){_0x40df5f['push'](_0x40df5f['shift']());}};_0x1573f1(++_0x8fd59f);}(_0x1d45,0x77));var _0x51d4=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x1d45[_0x1a9204];return _0x17ca68;};'use strict';var EventEmitter=require(_0x51d4('0x0'));var VoicePrefix=require(_0x51d4('0x1'))['db'][_0x51d4('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x51d4('0x3')](0x0);var events={'afterCreate':_0x51d4('0x4'),'afterUpdate':_0x51d4('0x5'),'afterDestroy':_0x51d4('0x6')};function emitEvent(_0x1c04e4){return function(_0x2d0248,_0x56f3c4,_0x729790){VoicePrefixEvents[_0x51d4('0x7')](_0x1c04e4+':'+_0x2d0248['id'],_0x2d0248);VoicePrefixEvents['emit'](_0x1c04e4,_0x2d0248);_0x729790(null);};}for(var e in events){if(events[_0x51d4('0x8')](e)){var event=events[e];VoicePrefix[_0x51d4('0x9')](e,emitEvent(event));}}module[_0x51d4('0xa')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index ad4c5ae..772671a 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 _0xc4d0=['request-promise','rimraf','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','../../config/logger','api','bluebird'];(function(_0x49b311,_0x571f11){var _0x28ded7=function(_0x362d13){while(--_0x362d13){_0x49b311['push'](_0x49b311['shift']());}};_0x28ded7(++_0x571f11);}(_0xc4d0,0xa7));var _0x0c4d=function(_0x5e6515,_0x2954b1){_0x5e6515=_0x5e6515-0x0;var _0xd33ce2=_0xc4d0[_0x5e6515];return _0xd33ce2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c4d('0x0'))(_0x0c4d('0x1'));var moment=require('moment');var BPromise=require(_0x0c4d('0x2'));var rp=require(_0x0c4d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c4d('0x4'));var config=require('../../config/environment');var attributes=require(_0x0c4d('0x5'));module[_0x0c4d('0x6')]=function(_0x142956,_0x5cf4fc){return _0x142956[_0x0c4d('0x7')](_0x0c4d('0x8'),attributes,{'tableName':_0x0c4d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cdc=['request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','moment'];(function(_0x202f8f,_0x30fd2f){var _0x45e362=function(_0x246eee){while(--_0x246eee){_0x202f8f['push'](_0x202f8f['shift']());}};_0x45e362(++_0x30fd2f);}(_0x0cdc,0x1f4));var _0xc0cd=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x0cdc[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0xc0cd('0x0'));var util=require(_0xc0cd('0x1'));var logger=require(_0xc0cd('0x2'))('api');var moment=require(_0xc0cd('0x3'));var BPromise=require('bluebird');var rp=require(_0xc0cd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0cd('0x5'));var config=require(_0xc0cd('0x6'));var attributes=require(_0xc0cd('0x7'));module[_0xc0cd('0x8')]=function(_0x5cab2a,_0x328d9b){return _0x5cab2a[_0xc0cd('0x9')](_0xc0cd('0xa'),attributes,{'tableName':_0xc0cd('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 aa56dbc..3200d01 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 _0xf9ac=['../../mysqldb','../../config/logger','jayson/promise','client','http','redis','localhost','./voicePrefix.socket','request','then','request\x20sent','debug','stringify','error','code','message','VoicePrefix,\x20%s,\x20%s','info','result','catch','lodash','bluebird','randomstring'];(function(_0x1e8ecc,_0x27b83b){var _0x11abc1=function(_0x42c432){while(--_0x42c432){_0x1e8ecc['push'](_0x1e8ecc['shift']());}};_0x11abc1(++_0x27b83b);}(_0xf9ac,0x87));var _0xcf9a=function(_0x4f7bd5,_0x5dc0ad){_0x4f7bd5=_0x4f7bd5-0x0;var _0x4a7c11=_0xf9ac[_0x4f7bd5];return _0x4a7c11;};'use strict';var _=require(_0xcf9a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcf9a('0x1'));var rs=require(_0xcf9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf9a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf9a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcf9a('0x5'));var client=jayson[_0xcf9a('0x6')][_0xcf9a('0x7')]({'port':0x232a});config[_0xcf9a('0x8')]=_['defaults'](config[_0xcf9a('0x8')],{'host':_0xcf9a('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcf9a('0xa'))['register'](socket);function respondWithRpcPromise(_0x2c8a46,_0x5ac4cb,_0x35564a){return new BPromise(function(_0x49b1aa,_0x3d93ad){return client[_0xcf9a('0xb')](_0x2c8a46,_0x35564a)[_0xcf9a('0xc')](function(_0x53c5ae){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x5ac4cb,_0xcf9a('0xd'));logger[_0xcf9a('0xe')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x5ac4cb,_0xcf9a('0xd'),JSON[_0xcf9a('0xf')](_0x53c5ae));if(_0x53c5ae[_0xcf9a('0x10')]){if(_0x53c5ae['error'][_0xcf9a('0x11')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x5ac4cb,_0x53c5ae['error']['message']);return _0x3d93ad(_0x53c5ae[_0xcf9a('0x10')][_0xcf9a('0x12')]);}logger[_0xcf9a('0x10')](_0xcf9a('0x13'),_0x5ac4cb,_0x53c5ae[_0xcf9a('0x10')][_0xcf9a('0x12')]);return _0x49b1aa(_0x53c5ae[_0xcf9a('0x10')]['message']);}else{logger[_0xcf9a('0x14')](_0xcf9a('0x13'),_0x5ac4cb,'request\x20sent');_0x49b1aa(_0x53c5ae[_0xcf9a('0x15')]['message']);}})[_0xcf9a('0x16')](function(_0x4f1714){logger[_0xcf9a('0x10')](_0xcf9a('0x13'),_0x5ac4cb,_0x4f1714);_0x3d93ad(_0x4f1714);});});} \ No newline at end of file +var _0xc1d3=['jayson/promise','http','redis','defaults','localhost','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x160248,_0x2a57e6){var _0x4e589d=function(_0x1ba722){while(--_0x1ba722){_0x160248['push'](_0x160248['shift']());}};_0x4e589d(++_0x2a57e6);}(_0xc1d3,0x147));var _0x3c1d=function(_0x46d219,_0x191d9c){_0x46d219=_0x46d219-0x0;var _0x3a1acc=_0xc1d3[_0x46d219];return _0x3a1acc;};'use strict';var _=require(_0x3c1d('0x0'));var util=require(_0x3c1d('0x1'));var moment=require(_0x3c1d('0x2'));var BPromise=require(_0x3c1d('0x3'));var rs=require(_0x3c1d('0x4'));var fs=require('fs');var Redis=require(_0x3c1d('0x5'));var db=require(_0x3c1d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3c1d('0x7'));var config=require(_0x3c1d('0x8'));var jayson=require(_0x3c1d('0x9'));var client=jayson['client'][_0x3c1d('0xa')]({'port':0x232a});config[_0x3c1d('0xb')]=_[_0x3c1d('0xc')](config[_0x3c1d('0xb')],{'host':_0x3c1d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c1d('0xb')]));require(_0x3c1d('0xe'))[_0x3c1d('0xf')](socket);function respondWithRpcPromise(_0x417fbb,_0x255ea9,_0x11be8e){return new BPromise(function(_0x2974a3,_0x20458f){return client['request'](_0x417fbb,_0x11be8e)[_0x3c1d('0x10')](function(_0x1eaabc){logger[_0x3c1d('0x11')](_0x3c1d('0x12'),_0x255ea9,_0x3c1d('0x13'));logger['debug'](_0x3c1d('0x14'),_0x255ea9,_0x3c1d('0x13'),JSON['stringify'](_0x1eaabc));if(_0x1eaabc[_0x3c1d('0x15')]){if(_0x1eaabc['error']['code']===0x1f4){logger['error'](_0x3c1d('0x12'),_0x255ea9,_0x1eaabc[_0x3c1d('0x15')][_0x3c1d('0x16')]);return _0x20458f(_0x1eaabc[_0x3c1d('0x15')][_0x3c1d('0x16')]);}logger[_0x3c1d('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x255ea9,_0x1eaabc['error'][_0x3c1d('0x16')]);return _0x2974a3(_0x1eaabc['error'][_0x3c1d('0x16')]);}else{logger[_0x3c1d('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x255ea9,'request\x20sent');_0x2974a3(_0x1eaabc['result'][_0x3c1d('0x16')]);}})[_0x3c1d('0x17')](function(_0x14c64b){logger[_0x3c1d('0x15')](_0x3c1d('0x12'),_0x255ea9,_0x14c64b);_0x20458f(_0x14c64b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index adfffe2..cf8c9ff 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 _0x4ded=['save','remove','update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x4f324f,_0x1bb9ae){var _0x526d38=function(_0x235e16){while(--_0x235e16){_0x4f324f['push'](_0x4f324f['shift']());}};_0x526d38(++_0x1bb9ae);}(_0x4ded,0x116));var _0xd4de=function(_0x43c556,_0x10b08a){_0x43c556=_0x43c556-0x0;var _0x467e26=_0x4ded[_0x43c556];return _0x467e26;};'use strict';var VoicePrefixEvents=require(_0xd4de('0x0'));var events=[_0xd4de('0x1'),_0xd4de('0x2'),_0xd4de('0x3')];function createListener(_0x2349f5,_0x377530){return function(_0x1b2252){_0x377530[_0xd4de('0x4')](_0x2349f5,_0x1b2252);};}function removeListener(_0x20930f,_0x36d4dd){return function(){VoicePrefixEvents[_0xd4de('0x5')](_0x20930f,_0x36d4dd);};}exports[_0xd4de('0x6')]=function(_0x554a51){for(var _0x23e5b9=0x0,_0x2433b8=events[_0xd4de('0x7')];_0x23e5b9<_0x2433b8;_0x23e5b9++){var _0x2c56d5=events[_0x23e5b9];var _0x4453c2=createListener(_0xd4de('0x8')+_0x2c56d5,_0x554a51);VoicePrefixEvents['on'](_0x2c56d5,_0x4453c2);}}; \ No newline at end of file +var _0x8e0d=['./voicePrefix.events','update','emit','length','voicePrefix:'];(function(_0x4312d8,_0x568c69){var _0x344adf=function(_0x4c706c){while(--_0x4c706c){_0x4312d8['push'](_0x4312d8['shift']());}};_0x344adf(++_0x568c69);}(_0x8e0d,0x82));var _0xd8e0=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x8e0d[_0x1bc0ae];return _0x501104;};'use strict';var VoicePrefixEvents=require(_0xd8e0('0x0'));var events=['save','remove',_0xd8e0('0x1')];function createListener(_0x11f7df,_0x549e82){return function(_0x3ee520){_0x549e82[_0xd8e0('0x2')](_0x11f7df,_0x3ee520);};}function removeListener(_0x14598d,_0xe9c59f){return function(){VoicePrefixEvents['removeListener'](_0x14598d,_0xe9c59f);};}exports['register']=function(_0x2e79ab){for(var _0x33ff41=0x0,_0x42d42b=events[_0xd8e0('0x3')];_0x33ff41<_0x42d42b;_0x33ff41++){var _0x5e9735=events[_0x33ff41];var _0xd0c45c=createListener(_0xd8e0('0x4')+_0x5e9735,_0x2e79ab);VoicePrefixEvents['on'](_0x5e9735,_0xd0c45c);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 301811c..ad4ded5 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0xc81f5f,_0x181205){var _0x4410dc=function(_0x3cf9a5){while(--_0x3cf9a5){_0xc81f5f['push'](_0xc81f5f['shift']());}};_0x4410dc(++_0x181205);}(_0xb10b,0x12a));var _0xbb10=function(_0x9ccc17,_0x1d087c){_0x9ccc17=_0x9ccc17-0x0;var _0x46e989=_0xb10b[_0x9ccc17];return _0x46e989;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x20eacd,_0x2394e2){var _0x57942a=function(_0xd86eda){while(--_0xd86eda){_0x20eacd['push'](_0x20eacd['shift']());}};_0x57942a(++_0x2394e2);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ddb6d,_0x25d45b){_0x2ddb6d=_0x2ddb6d-0x0;var _0x56c103=_0xb10b[_0x2ddb6d];return _0x56c103;};'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 a439559..28f87c3 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 _0x1679=['Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','mandatoryDispositionPauseId','exports','name','inbound','outbound','STRING','default','ENUM','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','ringall','getDataValue','type','dialMethod','strategy','booked','progressive','predictive','power','INTEGER','yes','all','once','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED'];(function(_0x2dbe3,_0x3887ed){var _0x39f134=function(_0x26cb66){while(--_0x26cb66){_0x2dbe3['push'](_0x2dbe3['shift']());}};_0x39f134(++_0x3887ed);}(_0x1679,0x155));var _0x9167=function(_0x9390d0,_0x1c1feb){_0x9390d0=_0x9390d0-0x0;var _0x455bd2=_0x1679[_0x9390d0];return _0x455bd2;};'use strict';var Sequelize=require('sequelize');module[_0x9167('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9167('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x9167('0x2'),_0x9167('0x3')),'allowNull':![],'defaultValue':_0x9167('0x2')},'musiconhold':{'type':Sequelize[_0x9167('0x4')],'defaultValue':_0x9167('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x9167('0x6')]('rr','ringall',_0x9167('0x7'),_0x9167('0x8'),'random',_0x9167('0x9'),_0x9167('0xa'),_0x9167('0xb'),_0x9167('0xc')),'allowNull':![],'defaultValue':_0x9167('0xd'),'set':function(_0x5454c4){this['setDataValue']('strategy',_0x5454c4?_0x5454c4:_0x9167('0x9'));},'get':function(){var _0x5605ce=this[_0x9167('0xe')](_0x9167('0xf'));var _0x33aef4=this[_0x9167('0xe')](_0x9167('0x10'));var _0x241479=this[_0x9167('0xe')](_0x9167('0x11'));if(_0x5605ce===_0x9167('0x2')){return _0x241479;}if(_0x33aef4===_0x9167('0x12')&&_0x241479===_0x9167('0x9')||_0x33aef4===_0x9167('0x12')&&_0x241479==='roundrobin'){return _0x241479;}if(_0x33aef4===_0x9167('0x13')||_0x33aef4===_0x9167('0x14')||_0x33aef4===_0x9167('0x15')){return _0x241479;}return null;}},'servicelevel':{'type':Sequelize[_0x9167('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x9167('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x9167('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x9167('0x4')]},'weight':{'type':Sequelize[_0x9167('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x9167('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x9167('0x6')](_0x9167('0x17'),'no'),'defaultValue':_0x9167('0x17')},'autopause':{'type':Sequelize[_0x9167('0x6')](_0x9167('0x17'),'no',_0x9167('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x9167('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x9167('0x6')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x9167('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x9167('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9167('0x6')](_0x9167('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x9167('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x9167('0x6')](_0x9167('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x9167('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x9167('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x9167('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x9167('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9167('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x9167('0x6')](_0x9167('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x9167('0x6')](_0x9167('0x17'),'no'),'defaultValue':_0x9167('0x17')},'announce_holdtime':{'type':Sequelize[_0x9167('0x6')](_0x9167('0x17'),'no',_0x9167('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x9167('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x9167('0x6')](_0x9167('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x9167('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x9167('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x9167('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x9167('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9167('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x9167('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x9167('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x9167('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x9167('0x4')]},'queue_quantity1':{'type':Sequelize[_0x9167('0x4')]},'queue_quantity2':{'type':Sequelize[_0x9167('0x4')]},'queue_periodic_announce':{'type':Sequelize[_0x9167('0x4')]},'queue_less_than':{'type':Sequelize[_0x9167('0x4')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x54636d){this[_0x9167('0x1a')](_0x9167('0x1b'),_0x54636d?_0x54636d[_0x9167('0x1c')](','):[]);},'get':function(){return this[_0x9167('0xe')]('periodic_announce')?this[_0x9167('0xe')](_0x9167('0x1b'))[_0x9167('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x9167('0x4')],'defaultValue':_0x9167('0x17'),'set':function(_0xb208be){this[_0x9167('0x1a')](_0x9167('0x1e'),_0xb208be?_0xb208be[_0x9167('0x1c')](','):undefined);},'get':function(){return this[_0x9167('0xe')](_0x9167('0x1e'))?this[_0x9167('0xe')](_0x9167('0x1e'))[_0x9167('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9167('0x4')],'defaultValue':'no','set':function(_0x36022c){this[_0x9167('0x1a')]('leavewhenempty',_0x36022c?_0x36022c[_0x9167('0x1c')](','):undefined);},'get':function(){return this[_0x9167('0xe')](_0x9167('0x1f'))?this[_0x9167('0xe')](_0x9167('0x1f'))[_0x9167('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9167('0x6')](_0x9167('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x9167('0x6')](_0x9167('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x9167('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x9167('0x6')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x9167('0x4')]},'description':{'type':Sequelize[_0x9167('0x4')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x26a47b){this[_0x9167('0x1a')](_0x9167('0x20'),_0x26a47b);if(_0x26a47b){if(this['getDataValue']('wrapuptime')<0x2){this['setDataValue'](_0x9167('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x9167('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x9167('0x22')],'defaultValue':0x0,'comment':_0x9167('0x23')},'dialMethod':{'type':Sequelize[_0x9167('0x6')](_0x9167('0x24'),_0x9167('0x13'),_0x9167('0x15'),_0x9167('0x14'),_0x9167('0x12')),'defaultValue':_0x9167('0x13'),'comment':_0x9167('0x25')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x9167('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9167('0x27')},'dialLimitQueue':{'type':Sequelize[_0x9167('0x16')](0x4)[_0x9167('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x9167('0x28')](0x2)[_0x9167('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x9167('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x9167('0x6')](_0x9167('0x2a'),_0x9167('0x2b')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x9167('0x28')](0x2)[_0x9167('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x9167('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x9167('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9167('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x9167('0x16')](0x3)[_0x9167('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9167('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x9167('0x4')],'defaultValue':_0x9167('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x9167('0x16')](0x3)[_0x9167('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9167('0x2e')},'dialQueueProject':{'type':Sequelize[_0x9167('0x4')],'comment':_0x9167('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9167('0x16')](0x3)[_0x9167('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9167('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9167('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x9167('0x16')](0x3)[_0x9167('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x9167('0x16')](0x5)[_0x9167('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9167('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9167('0x16')](0x3)[_0x9167('0x26')],'defaultValue':0x3,'comment':_0x9167('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9167('0x16')](0x5)[_0x9167('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9167('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9167('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x9167('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9167('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x9167('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9167('0x6')]('always','never','onlyIfOpen'),'defaultValue':_0x9167('0x35')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x9167('0x36')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9167('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x9167('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9167('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9167('0x16')](0x9)[_0x9167('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9167('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9167('0x16')](0x9)[_0x9167('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9167('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x9167('0x16')](0x9)[_0x9167('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9167('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9167('0x16')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9167('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9167('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9167('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9167('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9167('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x9167('0x16')](0x5)[_0x9167('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x9167('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x9167('0x22')],'defaultValue':0x0,'comment':_0x9167('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9167('0x6')](_0x9167('0x41'),_0x9167('0x42')),'defaultValue':_0x9167('0x41')},'dialQueueProject2':{'type':Sequelize[_0x9167('0x4')],'comment':_0x9167('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x9167('0x22')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x9167('0x22')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9167('0x16')](0x3)[_0x9167('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9167('0x43')},'dialCutDigit':{'type':Sequelize[_0x9167('0x16')](0x3)[_0x9167('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9167('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9167('0x16')](0x3)[_0x9167('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9167('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x9167('0x16')](0x3)[_0x9167('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x9167('0x16')](0x5)[_0x9167('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9167('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9167('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9167('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9167('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9167('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9167('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9167('0x16')](0x5)[_0x9167('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9167('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9167('0x16')](0x3)[_0x9167('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9167('0x16')](0x5)[_0x9167('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9167('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9167('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9167('0x22')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x419039){if(!_0x419039)this[_0x9167('0x1a')](_0x9167('0x4b'),null);this['setDataValue']('mandatoryDisposition',_0x419039);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x9167('0x16')](0x3)[_0x9167('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x9167('0x16')](0x3)[_0x9167('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x9167('0x22')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x9167('0x22')],'defaultValue':![]}}; \ No newline at end of file +var _0x9186=['type','dialMethod','strategy','booked','progressive','predictive','power','INTEGER','yes','all','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','outbound','inbound','default','ringall','leastrecent','random','rrmemory','linear','wrandom','rrordered','setDataValue','getDataValue'];(function(_0x5b2208,_0xdef329){var _0x2bbec8=function(_0x98aa0f){while(--_0x98aa0f){_0x5b2208['push'](_0x5b2208['shift']());}};_0x2bbec8(++_0xdef329);}(_0x9186,0x97));var _0x6918=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0x9186[_0x2459fd];return _0x364cd2;};'use strict';var Sequelize=require(_0x6918('0x0'));module[_0x6918('0x1')]={'name':{'type':Sequelize[_0x6918('0x2')],'allowNull':![],'unique':_0x6918('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6918('0x4')]('inbound',_0x6918('0x5')),'allowNull':![],'defaultValue':_0x6918('0x6')},'musiconhold':{'type':Sequelize[_0x6918('0x2')],'defaultValue':_0x6918('0x7')},'announce':{'type':Sequelize[_0x6918('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x6918('0x4')]('rr',_0x6918('0x8'),_0x6918('0x9'),'fewestcalls',_0x6918('0xa'),_0x6918('0xb'),_0x6918('0xc'),_0x6918('0xd'),_0x6918('0xe')),'allowNull':![],'defaultValue':_0x6918('0x8'),'set':function(_0x29451d){this[_0x6918('0xf')]('strategy',_0x29451d?_0x29451d:_0x6918('0xb'));},'get':function(){var _0x256c4c=this[_0x6918('0x10')](_0x6918('0x11'));var _0x2f4b7a=this['getDataValue'](_0x6918('0x12'));var _0x54a1fd=this[_0x6918('0x10')](_0x6918('0x13'));if(_0x256c4c===_0x6918('0x6')){return _0x54a1fd;}if(_0x2f4b7a===_0x6918('0x14')&&_0x54a1fd===_0x6918('0xb')||_0x2f4b7a===_0x6918('0x14')&&_0x54a1fd==='roundrobin'){return _0x54a1fd;}if(_0x2f4b7a===_0x6918('0x15')||_0x2f4b7a===_0x6918('0x16')||_0x2f4b7a===_0x6918('0x17')){return _0x54a1fd;}return null;}},'servicelevel':{'type':Sequelize[_0x6918('0x18')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x6918('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x6918('0x18')](0xb)},'timeout':{'type':Sequelize[_0x6918('0x18')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x6918('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x6918('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x6918('0x19'),'no'),'defaultValue':_0x6918('0x19')},'autopause':{'type':Sequelize[_0x6918('0x4')](_0x6918('0x19'),'no',_0x6918('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x6918('0x18')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x6918('0x4')](_0x6918('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x6918('0x18')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x6918('0x4')](_0x6918('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x6918('0x4')](_0x6918('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x6918('0x4')](_0x6918('0x19'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x6918('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x6918('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x6918('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x6918('0x18')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x6918('0x18')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x6918('0x19'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x6918('0x19'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x6918('0x4')](_0x6918('0x19'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x6918('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0x6918('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x6918('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x6918('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x6918('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x6918('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x6918('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x6918('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x6918('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x6918('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x6918('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x6918('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x6918('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x6918('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x6918('0x1b')],'set':function(_0x12f16c){this['setDataValue']('periodic_announce',_0x12f16c?_0x12f16c[_0x6918('0x1c')](','):[]);},'get':function(){return this[_0x6918('0x10')]('periodic_announce')?this[_0x6918('0x10')](_0x6918('0x1d'))[_0x6918('0x1e')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x6918('0x19'),'set':function(_0x1e1928){this[_0x6918('0xf')]('joinempty',_0x1e1928?_0x1e1928[_0x6918('0x1c')](','):undefined);},'get':function(){return this[_0x6918('0x10')](_0x6918('0x1f'))?this['getDataValue']('joinempty')[_0x6918('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x6918('0x2')],'defaultValue':'no','set':function(_0x942432){this[_0x6918('0xf')]('leavewhenempty',_0x942432?_0x942432[_0x6918('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0x6918('0x20'))?this[_0x6918('0x10')](_0x6918('0x20'))[_0x6918('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x6918('0x19'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x6918('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x6918('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x6918('0x4')](_0x6918('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x6918('0x2')]},'description':{'type':Sequelize[_0x6918('0x2')]},'acw':{'type':Sequelize[_0x6918('0x21')],'defaultValue':0x0,'set':function(_0x735e17){this[_0x6918('0xf')](_0x6918('0x22'),_0x735e17);if(_0x735e17){if(this[_0x6918('0x10')](_0x6918('0x23'))<0x2){this[_0x6918('0xf')](_0x6918('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x6918('0x21')],'defaultValue':0x0,'comment':_0x6918('0x24')},'dialMethod':{'type':Sequelize['ENUM'](_0x6918('0x25'),_0x6918('0x15'),_0x6918('0x17'),_0x6918('0x16'),_0x6918('0x14')),'defaultValue':_0x6918('0x15'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x6918('0x18')](0x4)[_0x6918('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6918('0x27')},'dialLimitQueue':{'type':Sequelize[_0x6918('0x18')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6918('0x28')},'dialPowerLevel':{'type':Sequelize[_0x6918('0x29')](0x2)[_0x6918('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x6918('0x4')](_0x6918('0x2a'),_0x6918('0x2b')),'defaultValue':_0x6918('0x2b'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x6918('0x29')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x6918('0x2c')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x6918('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x6918('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6918('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6918('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x6918('0x18')](0x3)[_0x6918('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x6918('0x2')],'defaultValue':_0x6918('0x2e'),'comment':_0x6918('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x6918('0x18')](0x3)[_0x6918('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6918('0x30')},'dialQueueProject':{'type':Sequelize[_0x6918('0x2')],'comment':_0x6918('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0x6918('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6918('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6918('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x6918('0x18')](0x3)[_0x6918('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x6918('0x18')](0x5)[_0x6918('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6918('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6918('0x18')](0x3)[_0x6918('0x26')],'defaultValue':0x3,'comment':_0x6918('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6918('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6918('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6918('0x18')](0x3)[_0x6918('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x6918('0x36')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x6918('0x4')](_0x6918('0x37'),_0x6918('0x38'),_0x6918('0x39')),'defaultValue':_0x6918('0x37')},'dialAMDActive':{'type':Sequelize[_0x6918('0x21')],'defaultValue':0x0,'comment':_0x6918('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0x6918('0x18')](0x9)[_0x6918('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6918('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0x6918('0x18')](0x9)[_0x6918('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6918('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6918('0x18')](0x9)[_0x6918('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6918('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x6918('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6918('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0x6918('0x18')](0x9)[_0x6918('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6918('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6918('0x18')](0x9)[_0x6918('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6918('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6918('0x18')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6918('0x18')](0x5)[_0x6918('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6918('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6918('0x18')](0x9)[_0x6918('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6918('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0x6918('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x6918('0x21')],'defaultValue':0x0,'comment':_0x6918('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x6918('0x4')](_0x6918('0x44'),'ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x6918('0x2')],'comment':_0x6918('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x6918('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x6918('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6918('0x18')](0x3)[_0x6918('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6918('0x45')},'dialCutDigit':{'type':Sequelize[_0x6918('0x18')](0x3)[_0x6918('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6918('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6918('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6918('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6918('0x18')](0x5)[_0x6918('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6918('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0x6918('0x18')](0x3)[_0x6918('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6918('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0x6918('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6918('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6918('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6918('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x6918('0x18')](0x5)[_0x6918('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6918('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0x6918('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6918('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6918('0x18')](0x5)[_0x6918('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6918('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6918('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6918('0x18')](0x5)[_0x6918('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6918('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6918('0x18')],'allowNull':!![],'comment':_0x6918('0x50')},'mandatoryDisposition':{'type':Sequelize[_0x6918('0x21')],'defaultValue':![],'comment':_0x6918('0x51'),'set':function(_0x3d100b){if(!_0x3d100b)this[_0x6918('0xf')](_0x6918('0x52'),null);this[_0x6918('0xf')](_0x6918('0x53'),_0x3d100b);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x6918('0x18')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x6918('0x18')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x6918('0x21')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index f36e0a5..3f820e0 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 _0x4521=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','type','options','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','VoiceQueues','value','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','UserProfileSection','getHoppers','findOne','CmHopper','VoiceQueueId','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','voicePause','flatMap','penalty','sequelize','transaction','upsert','UserVoiceQueue','findOrCreate','each','isNil','interface','format','SIP/%s','forEach','userVoiceQueue:save','removeTeams','ids','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','all','union','compact','isEmpty','removeAgents','UserVoiceQueueRt','emit','userVoiceQueue:remove','addAgents','online','isArray','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','field','CmListId','NOW()','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','status','json','undefined','limit','count','offset','apply','reject','save','update','destroy','then','get','inbound','QueueCampaigns','outbound','filter','ignore','map','includes','UserProfileResource','end','sendStatus','stack','name','send','VoiceQueue','fieldName','key','model','keys','intersection','query'];(function(_0x35a55e,_0x412d81){var _0x17a0eb=function(_0x2ce052){while(--_0x2ce052){_0x35a55e['push'](_0x35a55e['shift']());}};_0x17a0eb(++_0x412d81);}(_0x4521,0x135));var _0x1452=function(_0x2fb04b,_0xca795d){_0x2fb04b=_0x2fb04b-0x0;var _0x46f622=_0x4521[_0x2fb04b];return _0x46f622;};'use strict';var emlformat=require(_0x1452('0x0'));var rimraf=require(_0x1452('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1452('0x2'));var rp=require('request-promise');var moment=require(_0x1452('0x3'));var BPromise=require(_0x1452('0x4'));var Mustache=require(_0x1452('0x5'));var util=require(_0x1452('0x6'));var path=require(_0x1452('0x7'));var sox=require(_0x1452('0x8'));var csv=require('to-csv');var ejs=require(_0x1452('0x9'));var fs=require('fs');var fs_extra=require(_0x1452('0xa'));var _=require(_0x1452('0xb'));var squel=require('squel');var crypto=require(_0x1452('0xc'));var jsforce=require(_0x1452('0xd'));var deskjs=require(_0x1452('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1452('0xf'));var Papa=require(_0x1452('0x10'));var Redis=require(_0x1452('0x11'));var authService=require(_0x1452('0x12'));var qs=require(_0x1452('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1452('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1452('0x15'));var config=require(_0x1452('0x16'));var licenseUtil=require(_0x1452('0x17'));var db=require(_0x1452('0x18'))['db'];config[_0x1452('0x19')]=_['defaults'](config[_0x1452('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x1452('0x1a'))(new Redis(config[_0x1452('0x19')]));require('./voiceQueue.socket')[_0x1452('0x1b')](socket);function respondWithStatusCode(_0x24f463,_0x50d886){_0x50d886=_0x50d886||0xcc;return function(_0x3734ed){if(_0x3734ed){return _0x24f463['sendStatus'](_0x50d886);}return _0x24f463[_0x1452('0x1c')](_0x50d886)['end']();};}function respondWithResult(_0x4d6787,_0x59c477){_0x59c477=_0x59c477||0xc8;return function(_0x1205f6){if(_0x1205f6){return _0x4d6787[_0x1452('0x1c')](_0x59c477)[_0x1452('0x1d')](_0x1205f6);}};}function respondWithFilteredResult(_0x2e0a0a,_0x588d6f){return function(_0x3d6298){if(_0x3d6298){var _0x43167b=typeof _0x588d6f['offset']===_0x1452('0x1e')&&typeof _0x588d6f[_0x1452('0x1f')]===_0x1452('0x1e');var _0xf2e39b=_0x3d6298[_0x1452('0x20')];var _0x32a356=_0x43167b?0x0:_0x588d6f[_0x1452('0x21')];var _0x3eea07=_0x43167b?_0x3d6298[_0x1452('0x20')]:_0x588d6f[_0x1452('0x21')]+_0x588d6f[_0x1452('0x1f')];var _0x3ae90e;if(_0x3eea07>=_0xf2e39b){_0x3eea07=_0xf2e39b;_0x3ae90e=0xc8;}else{_0x3ae90e=0xce;}_0x2e0a0a[_0x1452('0x1c')](_0x3ae90e);return _0x2e0a0a['set']('Content-Range',_0x32a356+'-'+_0x3eea07+'/'+_0xf2e39b)['json'](_0x3d6298);}return null;};}function patchUpdates(_0xf4223e){return function(_0x1158a0){try{jsonpatch[_0x1452('0x22')](_0x1158a0,_0xf4223e,!![]);}catch(_0x22c660){return BPromise[_0x1452('0x23')](_0x22c660);}return _0x1158a0[_0x1452('0x24')]();};}function saveUpdates(_0x22fa95,_0x35ad22){return function(_0x85c96){if(_0x85c96){return _0x85c96[_0x1452('0x25')](_0x22fa95)['then'](function(_0x25fdbd){return _0x25fdbd;});}return null;};}function removeEntity(_0x1d2db0,_0x387f70){return function(_0xe75058){if(_0xe75058){return _0xe75058[_0x1452('0x26')]()[_0x1452('0x27')](function(){var _0x81e79f=_0xe75058[_0x1452('0x28')]({'plain':!![]});var _0x474ce7=[{'name':'VoiceQueues','value':_0x1452('0x29'),'ignore':![]},{'name':_0x1452('0x2a'),'value':_0x1452('0x2b'),'ignore':![]}];var _0x23f768=_(_0x474ce7)[_0x1452('0x2c')](_0x1452('0x2d'))[_0x1452('0x2e')]('value')['value']();if(_[_0x1452('0x2f')](_0x23f768,_0x81e79f['type'])){return;}var _0x76c37c=_['find'](_0x474ce7,['value',_0x81e79f['type']])['name'];return db[_0x1452('0x30')][_0x1452('0x26')]({'where':{'type':_0x76c37c,'resourceId':_0x81e79f['id']}})[_0x1452('0x27')](function(){return _0xe75058;});})[_0x1452('0x27')](function(){_0x1d2db0[_0x1452('0x1c')](0xcc)[_0x1452('0x31')]();});}};}function handleEntityNotFound(_0xa0706d,_0x36b19b){return function(_0x2cc5c7){if(!_0x2cc5c7){_0xa0706d[_0x1452('0x32')](0x194);}return _0x2cc5c7;};}function handleError(_0x2d5f84,_0x5d78bf){_0x5d78bf=_0x5d78bf||0x1f4;return function(_0x236483){logger['error'](_0x236483[_0x1452('0x33')]);if(_0x236483[_0x1452('0x34')]){delete _0x236483[_0x1452('0x34')];}_0x2d5f84[_0x1452('0x1c')](_0x5d78bf)[_0x1452('0x35')](_0x236483);};}exports['index']=function(_0x104a01,_0x2cc001){var _0x1d67be={},_0x5a9943={},_0x178895={'count':0x0,'rows':[]};var _0xccf984=_[_0x1452('0x2e')](db[_0x1452('0x36')]['rawAttributes'],function(_0x15065e){return{'name':_0x15065e[_0x1452('0x37')],'type':_0x15065e['type'][_0x1452('0x38')]};});_0x5a9943[_0x1452('0x39')]=_[_0x1452('0x2e')](_0xccf984,_0x1452('0x34'));_0x5a9943['query']=_[_0x1452('0x3a')](_0x104a01['query']);_0x5a9943['filters']=_[_0x1452('0x3b')](_0x5a9943[_0x1452('0x39')],_0x5a9943[_0x1452('0x3c')]);_0x1d67be[_0x1452('0x3d')]=_[_0x1452('0x3b')](_0x5a9943[_0x1452('0x39')],qs[_0x1452('0x3e')](_0x104a01[_0x1452('0x3c')]['fields']));_0x1d67be[_0x1452('0x3d')]=_0x1d67be[_0x1452('0x3d')][_0x1452('0x3f')]?_0x1d67be['attributes']:_0x5a9943[_0x1452('0x39')];if(!_0x104a01[_0x1452('0x3c')][_0x1452('0x40')]('nolimit')){_0x1d67be[_0x1452('0x1f')]=qs[_0x1452('0x1f')](_0x104a01[_0x1452('0x3c')][_0x1452('0x1f')]);_0x1d67be[_0x1452('0x21')]=qs[_0x1452('0x21')](_0x104a01[_0x1452('0x3c')][_0x1452('0x21')]);}_0x1d67be[_0x1452('0x41')]=qs[_0x1452('0x42')](_0x104a01['query'][_0x1452('0x42')]);_0x1d67be[_0x1452('0x43')]=qs['filters'](_[_0x1452('0x44')](_0x104a01[_0x1452('0x3c')],_0x5a9943[_0x1452('0x45')]),_0xccf984);if(_0x104a01[_0x1452('0x3c')]['filter']){_0x1d67be[_0x1452('0x43')]=_[_0x1452('0x46')](_0x1d67be['where'],{'$or':_[_0x1452('0x2e')](_0xccf984,function(_0x5dedc5){if(_0x5dedc5[_0x1452('0x47')]!=='VIRTUAL'){var _0x4b3dc4={};_0x4b3dc4[_0x5dedc5[_0x1452('0x34')]]={'$like':'%'+_0x104a01[_0x1452('0x3c')][_0x1452('0x2c')]+'%'};return _0x4b3dc4;}})});}_0x1d67be=_[_0x1452('0x46')]({},_0x1d67be,_0x104a01[_0x1452('0x48')]);var _0x37199f={'where':_0x1d67be['where']};return db[_0x1452('0x36')][_0x1452('0x20')](_0x37199f)[_0x1452('0x27')](function(_0x1f0050){_0x178895[_0x1452('0x20')]=_0x1f0050;if(_0x104a01[_0x1452('0x3c')][_0x1452('0x49')]){_0x1d67be['include']=[{'all':!![]}];}return db[_0x1452('0x36')]['findAll'](_0x1d67be);})[_0x1452('0x27')](function(_0x5b48d4){_0x178895[_0x1452('0x4a')]=_0x5b48d4;return _0x178895;})[_0x1452('0x27')](respondWithFilteredResult(_0x2cc001,_0x1d67be))[_0x1452('0x4b')](handleError(_0x2cc001,null));};exports[_0x1452('0x4c')]=function(_0x155175,_0x1435ff){var _0x3b36e3={'raw':![],'where':{'id':_0x155175[_0x1452('0x4d')]['id']}},_0xfa6231={};_0xfa6231[_0x1452('0x39')]=_[_0x1452('0x3a')](db['VoiceQueue'][_0x1452('0x4e')]);_0xfa6231[_0x1452('0x3c')]=_[_0x1452('0x3a')](_0x155175['query']);_0xfa6231[_0x1452('0x45')]=_['intersection'](_0xfa6231[_0x1452('0x39')],_0xfa6231[_0x1452('0x3c')]);_0x3b36e3[_0x1452('0x3d')]=_[_0x1452('0x3b')](_0xfa6231[_0x1452('0x39')],qs[_0x1452('0x3e')](_0x155175[_0x1452('0x3c')][_0x1452('0x3e')]));_0x3b36e3['attributes']=_0x3b36e3[_0x1452('0x3d')][_0x1452('0x3f')]?_0x3b36e3[_0x1452('0x3d')]:_0xfa6231['model'];if(_0x155175[_0x1452('0x3c')][_0x1452('0x49')]){_0x3b36e3[_0x1452('0x4f')]=[{'all':!![]}];}_0x3b36e3=_[_0x1452('0x46')]({},_0x3b36e3,_0x155175[_0x1452('0x48')]);return db[_0x1452('0x36')][_0x1452('0x50')](_0x3b36e3)[_0x1452('0x27')](handleEntityNotFound(_0x1435ff,null))[_0x1452('0x27')](respondWithResult(_0x1435ff,null))[_0x1452('0x4b')](handleError(_0x1435ff,null));};exports[_0x1452('0x51')]=function(_0x334e61,_0x4319d7){return db['VoiceQueue']['create'](_0x334e61[_0x1452('0x52')],{})['then'](function(_0x2185ce){var _0x47fe0b=_0x334e61['user']['get']({'plain':!![]});if(!_0x47fe0b)throw new Error(_0x1452('0x53'));if(_0x47fe0b[_0x1452('0x54')]===_0x1452('0x55')){var _0x582d91=_0x2185ce['get']({'plain':!![]});var _0x5804f6=[{'name':_0x1452('0x56'),'value':_0x1452('0x29')},{'name':'QueueCampaigns','value':_0x1452('0x2b')}];var _0xa1343e=_[_0x1452('0x50')](_0x5804f6,[_0x1452('0x57'),_0x582d91[_0x1452('0x47')]])['name'];return db['UserProfileSection']['find']({'where':{'name':_0xa1343e,'userProfileId':_0x47fe0b[_0x1452('0x58')]},'raw':!![]})[_0x1452('0x27')](function(_0x3636cd){if(_0x3636cd&&_0x3636cd[_0x1452('0x59')]===0x0){return db[_0x1452('0x30')][_0x1452('0x51')]({'name':_0x582d91[_0x1452('0x34')],'resourceId':_0x582d91['id'],'type':_0x3636cd[_0x1452('0x34')],'sectionId':_0x3636cd['id']},{})[_0x1452('0x27')](function(){return _0x2185ce;});}else{return _0x2185ce;}})[_0x1452('0x4b')](function(_0x4dddc4){logger[_0x1452('0x5a')](_0x1452('0x5b'),_0x4dddc4);throw _0x4dddc4;});}return _0x2185ce;})['then'](respondWithResult(_0x4319d7,0xc9))[_0x1452('0x4b')](handleError(_0x4319d7,null));};exports['clone']=function(_0x47645e,_0x23c392){var _0x387d90={'where':{'id':_0x47645e['params']['id']}},_0x4327f7={};_0x4327f7[_0x1452('0x39')]=_['keys'](db['VoiceQueue']['rawAttributes']);_0x387d90['attributes']=_[_0x1452('0x3b')](_0x4327f7[_0x1452('0x39')],qs[_0x1452('0x3e')](_0x47645e['query'][_0x1452('0x3e')]));_0x387d90[_0x1452('0x3d')]=_0x387d90['attributes']['length']?_0x387d90[_0x1452('0x3d')]:_0x4327f7[_0x1452('0x39')];if(_0x47645e[_0x1452('0x3c')][_0x1452('0x49')]){_0x387d90[_0x1452('0x4f')]=[{'all':!![]}];}_0x387d90=_['merge']({},_0x387d90,_0x47645e[_0x1452('0x48')]);return db[_0x1452('0x36')][_0x1452('0x50')](_0x387d90)['then'](handleEntityNotFound(_0x23c392,null))['then'](function(_0x9e3792){if(_0x9e3792){var _0x402cab=_0x9e3792[_0x1452('0x28')]({'plain':!![]});_0x402cab=qs[_0x1452('0x5c')](_0x402cab,['id','createdAt',_0x1452('0x5d')]);_0x47645e[_0x1452('0x52')]=_['omit'](_0x47645e['body'],['id',_0x1452('0x5e'),_0x1452('0x5d')]);return db[_0x1452('0x36')][_0x1452('0x51')](_[_0x1452('0x46')](_0x402cab,_0x47645e['body']),{'include':_0x47645e[_0x1452('0x3c')][_0x1452('0x49')]?[{'all':!![]}]:undefined})[_0x1452('0x27')](function(_0x21edaa){var _0x59ee58=_0x47645e[_0x1452('0x55')][_0x1452('0x28')]({'plain':!![]});if(!_0x59ee58)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59ee58[_0x1452('0x54')]===_0x1452('0x55')){var _0xd484a=_0x21edaa[_0x1452('0x28')]({'plain':!![]});var _0x4728da=[{'name':_0x1452('0x56'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x1452('0x2b')}];var _0x4f1340=_[_0x1452('0x50')](_0x4728da,[_0x1452('0x57'),_0xd484a[_0x1452('0x47')]])[_0x1452('0x34')];return db[_0x1452('0x5f')][_0x1452('0x50')]({'where':{'name':_0x4f1340,'userProfileId':_0x59ee58['userProfileId']},'raw':!![]})[_0x1452('0x27')](function(_0x4ff536){if(_0x4ff536&&_0x4ff536[_0x1452('0x59')]===0x0){return db[_0x1452('0x30')][_0x1452('0x51')]({'name':_0xd484a[_0x1452('0x34')],'resourceId':_0xd484a['id'],'type':_0x4ff536['name'],'sectionId':_0x4ff536['id']},{})[_0x1452('0x27')](function(){return _0x21edaa;});}else{return _0x21edaa;}})[_0x1452('0x4b')](function(_0x4d6f78){logger[_0x1452('0x5a')](_0x1452('0x5b'),_0x4d6f78);throw _0x4d6f78;});}return _0x21edaa;});}})['then'](respondWithResult(_0x23c392,0xc9))[_0x1452('0x4b')](handleError(_0x23c392,null));};exports[_0x1452('0x25')]=function(_0x573716,_0x29f9b7){if(_0x573716['body']['id']){delete _0x573716[_0x1452('0x52')]['id'];}return db[_0x1452('0x36')][_0x1452('0x50')]({'where':{'id':_0x573716[_0x1452('0x4d')]['id']}})[_0x1452('0x27')](handleEntityNotFound(_0x29f9b7,null))[_0x1452('0x27')](saveUpdates(_0x573716[_0x1452('0x52')],null))[_0x1452('0x27')](respondWithResult(_0x29f9b7,null))['catch'](handleError(_0x29f9b7,null));};exports[_0x1452('0x26')]=function(_0x209871,_0x4864db){return db['VoiceQueue'][_0x1452('0x50')]({'where':{'id':_0x209871[_0x1452('0x4d')]['id']}})[_0x1452('0x27')](handleEntityNotFound(_0x4864db,null))[_0x1452('0x27')](removeEntity(_0x4864db,null))[_0x1452('0x4b')](handleError(_0x4864db,null));};exports[_0x1452('0x60')]=function(_0x8a270,_0x53bc13,_0x380dbd){var _0x36d5df={'raw':![],'where':{}};var _0x36cf90={};var _0x541e22={'count':0x0,'rows':[]};return db[_0x1452('0x36')][_0x1452('0x61')]({'where':{'id':_0x8a270[_0x1452('0x4d')]['id']}})[_0x1452('0x27')](handleEntityNotFound(_0x53bc13,null))['then'](function(_0x142b3c){if(_0x142b3c){_0x36cf90['model']=_['keys'](db[_0x1452('0x62')][_0x1452('0x4e')]);_0x36cf90[_0x1452('0x3c')]=_[_0x1452('0x3a')](_0x8a270[_0x1452('0x3c')]);_0x36cf90[_0x1452('0x45')]=_[_0x1452('0x3b')](_0x36cf90['model'],_0x36cf90[_0x1452('0x3c')]);_0x36d5df['attributes']=_['intersection'](_0x36cf90['model'],qs['fields'](_0x8a270['query'][_0x1452('0x3e')]));_0x36d5df[_0x1452('0x3d')]=_0x36d5df[_0x1452('0x3d')]['length']?_0x36d5df['attributes']:_0x36cf90[_0x1452('0x39')];if(!_0x8a270[_0x1452('0x3c')][_0x1452('0x40')]('nolimit')){_0x36d5df['limit']=qs[_0x1452('0x1f')](_0x8a270[_0x1452('0x3c')][_0x1452('0x1f')]);_0x36d5df[_0x1452('0x21')]=qs['offset'](_0x8a270['query'][_0x1452('0x21')]);}_0x36d5df['order']=qs[_0x1452('0x42')](_0x8a270[_0x1452('0x3c')][_0x1452('0x42')]);_0x36d5df[_0x1452('0x43')]=qs[_0x1452('0x45')](_[_0x1452('0x44')](_0x8a270[_0x1452('0x3c')],_0x36cf90['filters']));_0x36d5df['where'][_0x1452('0x63')]=_0x142b3c['id'];if(_0x8a270[_0x1452('0x3c')][_0x1452('0x2c')]){_0x36d5df[_0x1452('0x43')]=_[_0x1452('0x46')](_0x36d5df['where'],{'$or':_[_0x1452('0x2e')](_0x36d5df[_0x1452('0x3d')],function(_0x3c6afe){var _0x43b9b6={};_0x43b9b6[_0x3c6afe]={'$like':'%'+_0x8a270[_0x1452('0x3c')][_0x1452('0x2c')]+'%'};return _0x43b9b6;})});}_0x36d5df=_[_0x1452('0x46')]({},_0x36d5df,_0x8a270['options']);return db[_0x1452('0x62')][_0x1452('0x20')]({'where':_0x36d5df['where']})[_0x1452('0x27')](function(_0x4f5ab2){_0x541e22[_0x1452('0x20')]=_0x4f5ab2;if(_0x8a270['query'][_0x1452('0x49')]){_0x36d5df['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x36d5df);})[_0x1452('0x27')](function(_0x29c1fa){_0x541e22[_0x1452('0x4a')]=_0x29c1fa;return _0x541e22;});}})[_0x1452('0x27')](respondWithFilteredResult(_0x53bc13,_0x36d5df))[_0x1452('0x4b')](handleError(_0x53bc13,null));};exports['getHopperHistories']=function(_0x256170,_0x23c252,_0x5d02bc){var _0x78d9b5={'raw':!![],'where':{}};var _0x203d34={};var _0x3855e9={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x1452('0x61')]({'where':{'id':_0x256170[_0x1452('0x4d')]['id']}})[_0x1452('0x27')](handleEntityNotFound(_0x23c252,null))[_0x1452('0x27')](function(_0x28fb37){if(_0x28fb37){_0x203d34['model']=_[_0x1452('0x3a')](db[_0x1452('0x64')][_0x1452('0x4e')]);_0x203d34['query']=_['keys'](_0x256170['query']);_0x203d34[_0x1452('0x45')]=_[_0x1452('0x3b')](_0x203d34[_0x1452('0x39')],_0x203d34[_0x1452('0x3c')]);_0x78d9b5[_0x1452('0x3d')]=_[_0x1452('0x3b')](_0x203d34[_0x1452('0x39')],qs[_0x1452('0x3e')](_0x256170[_0x1452('0x3c')]['fields']));_0x78d9b5[_0x1452('0x3d')]=_0x78d9b5[_0x1452('0x3d')][_0x1452('0x3f')]?_0x78d9b5[_0x1452('0x3d')]:_0x203d34[_0x1452('0x39')];if(!_0x256170[_0x1452('0x3c')][_0x1452('0x40')]('nolimit')){_0x78d9b5[_0x1452('0x1f')]=qs[_0x1452('0x1f')](_0x256170[_0x1452('0x3c')][_0x1452('0x1f')]);_0x78d9b5[_0x1452('0x21')]=qs['offset'](_0x256170[_0x1452('0x3c')][_0x1452('0x21')]);}_0x78d9b5[_0x1452('0x41')]=qs['sort'](_0x256170[_0x1452('0x3c')][_0x1452('0x42')]);_0x78d9b5[_0x1452('0x43')]=qs[_0x1452('0x45')](_[_0x1452('0x44')](_0x256170['query'],_0x203d34[_0x1452('0x45')]));_0x78d9b5[_0x1452('0x43')][_0x1452('0x63')]=_0x28fb37['id'];if(_0x256170[_0x1452('0x3c')][_0x1452('0x2c')]){_0x78d9b5['where']=_[_0x1452('0x46')](_0x78d9b5[_0x1452('0x43')],{'$or':_[_0x1452('0x2e')](_0x78d9b5[_0x1452('0x3d')],function(_0x55c37a){var _0x14d462={};_0x14d462[_0x55c37a]={'$like':'%'+_0x256170[_0x1452('0x3c')][_0x1452('0x2c')]+'%'};return _0x14d462;})});}_0x78d9b5=_[_0x1452('0x46')]({},_0x78d9b5,_0x256170[_0x1452('0x48')]);return db[_0x1452('0x64')][_0x1452('0x20')]({'where':_0x78d9b5['where']})[_0x1452('0x27')](function(_0x45bac4){_0x3855e9[_0x1452('0x20')]=_0x45bac4;if(_0x256170[_0x1452('0x3c')][_0x1452('0x49')]){_0x78d9b5['include']=[{'all':!![]}];}return db[_0x1452('0x64')][_0x1452('0x65')](_0x78d9b5);})[_0x1452('0x27')](function(_0xd29fa3){_0x3855e9[_0x1452('0x4a')]=_0xd29fa3;return _0x3855e9;});}})['then'](respondWithFilteredResult(_0x23c252,_0x78d9b5))['catch'](handleError(_0x23c252,null));};exports[_0x1452('0x66')]=function(_0x28f791,_0x1591f8,_0x39b21b){var _0x4cd3ee={'raw':!![],'where':{}};var _0x36d16c={};var _0x575bb9={'count':0x0,'rows':[]};return db[_0x1452('0x36')]['findOne']({'where':{'id':_0x28f791['params']['id']}})[_0x1452('0x27')](handleEntityNotFound(_0x1591f8,null))[_0x1452('0x27')](function(_0xab89a0){if(_0xab89a0){_0x36d16c['model']=_[_0x1452('0x3a')](db[_0x1452('0x67')][_0x1452('0x4e')]);_0x36d16c[_0x1452('0x3c')]=_[_0x1452('0x3a')](_0x28f791[_0x1452('0x3c')]);_0x36d16c[_0x1452('0x45')]=_[_0x1452('0x3b')](_0x36d16c['model'],_0x36d16c[_0x1452('0x3c')]);_0x4cd3ee['attributes']=_[_0x1452('0x3b')](_0x36d16c['model'],qs[_0x1452('0x3e')](_0x28f791[_0x1452('0x3c')][_0x1452('0x3e')]));_0x4cd3ee['attributes']=_0x4cd3ee[_0x1452('0x3d')]['length']?_0x4cd3ee[_0x1452('0x3d')]:_0x36d16c[_0x1452('0x39')];if(!_0x28f791[_0x1452('0x3c')][_0x1452('0x40')](_0x1452('0x68'))){_0x4cd3ee[_0x1452('0x1f')]=qs[_0x1452('0x1f')](_0x28f791[_0x1452('0x3c')][_0x1452('0x1f')]);_0x4cd3ee[_0x1452('0x21')]=qs['offset'](_0x28f791[_0x1452('0x3c')][_0x1452('0x21')]);}_0x4cd3ee['order']=qs['sort'](_0x28f791['query']['sort']);_0x4cd3ee[_0x1452('0x43')]=qs[_0x1452('0x45')](_[_0x1452('0x44')](_0x28f791[_0x1452('0x3c')],_0x36d16c[_0x1452('0x45')]));_0x4cd3ee[_0x1452('0x43')]['VoiceQueueId']=_0xab89a0['id'];if(_0x28f791['query'][_0x1452('0x2c')]){_0x4cd3ee[_0x1452('0x43')]=_[_0x1452('0x46')](_0x4cd3ee[_0x1452('0x43')],{'$or':_[_0x1452('0x2e')](_0x4cd3ee[_0x1452('0x3d')],function(_0x4a1dfb){var _0x201001={};_0x201001[_0x4a1dfb]={'$like':'%'+_0x28f791[_0x1452('0x3c')][_0x1452('0x2c')]+'%'};return _0x201001;})});}_0x4cd3ee=_['merge']({},_0x4cd3ee,_0x28f791['options']);return db[_0x1452('0x67')][_0x1452('0x20')]({'where':_0x4cd3ee[_0x1452('0x43')]})[_0x1452('0x27')](function(_0x26ba70){_0x575bb9['count']=_0x26ba70;if(_0x28f791[_0x1452('0x3c')][_0x1452('0x49')]){_0x4cd3ee[_0x1452('0x4f')]=[{'all':!![]}];}return db[_0x1452('0x67')][_0x1452('0x65')](_0x4cd3ee);})[_0x1452('0x27')](function(_0x5e4b14){_0x575bb9[_0x1452('0x4a')]=_0x5e4b14;return _0x575bb9;});}})[_0x1452('0x27')](respondWithFilteredResult(_0x1591f8,_0x4cd3ee))[_0x1452('0x4b')](handleError(_0x1591f8,null));};exports[_0x1452('0x69')]=function(_0x40ee8b,_0x19e358,_0x5d2f40){var _0x336c65={'raw':!![],'where':{}};var _0x9f48c0={};var _0x1cc91a={'count':0x0,'rows':[]};return db[_0x1452('0x36')][_0x1452('0x61')]({'where':{'id':_0x40ee8b[_0x1452('0x4d')]['id']}})[_0x1452('0x27')](handleEntityNotFound(_0x19e358,null))['then'](function(_0x184fb2){if(_0x184fb2){_0x9f48c0[_0x1452('0x39')]=_[_0x1452('0x3a')](db[_0x1452('0x6a')][_0x1452('0x4e')]);_0x9f48c0[_0x1452('0x3c')]=_[_0x1452('0x3a')](_0x40ee8b[_0x1452('0x3c')]);_0x9f48c0[_0x1452('0x45')]=_[_0x1452('0x3b')](_0x9f48c0[_0x1452('0x39')],_0x9f48c0[_0x1452('0x3c')]);_0x336c65['attributes']=_[_0x1452('0x3b')](_0x9f48c0[_0x1452('0x39')],qs[_0x1452('0x3e')](_0x40ee8b['query']['fields']));_0x336c65['attributes']=_0x336c65[_0x1452('0x3d')][_0x1452('0x3f')]?_0x336c65[_0x1452('0x3d')]:_0x9f48c0[_0x1452('0x39')];if(!_0x40ee8b[_0x1452('0x3c')][_0x1452('0x40')](_0x1452('0x68'))){_0x336c65['limit']=qs[_0x1452('0x1f')](_0x40ee8b[_0x1452('0x3c')][_0x1452('0x1f')]);_0x336c65[_0x1452('0x21')]=qs[_0x1452('0x21')](_0x40ee8b['query'][_0x1452('0x21')]);}_0x336c65[_0x1452('0x41')]=qs[_0x1452('0x42')](_0x40ee8b['query']['sort']);_0x336c65[_0x1452('0x43')]=qs['filters'](_[_0x1452('0x44')](_0x40ee8b[_0x1452('0x3c')],_0x9f48c0[_0x1452('0x45')]));_0x336c65['where'][_0x1452('0x63')]=_0x184fb2['id'];if(_0x40ee8b['query'][_0x1452('0x2c')]){_0x336c65[_0x1452('0x43')]=_['merge'](_0x336c65[_0x1452('0x43')],{'$or':_[_0x1452('0x2e')](_0x336c65[_0x1452('0x3d')],function(_0x5369ce){var _0x499ec1={};_0x499ec1[_0x5369ce]={'$like':'%'+_0x40ee8b[_0x1452('0x3c')][_0x1452('0x2c')]+'%'};return _0x499ec1;})});}_0x336c65=_['merge']({},_0x336c65,_0x40ee8b['options']);return db['CmHopperBlack']['count']({'where':_0x336c65[_0x1452('0x43')]})[_0x1452('0x27')](function(_0x103dda){_0x1cc91a['count']=_0x103dda;if(_0x40ee8b['query'][_0x1452('0x49')]){_0x336c65[_0x1452('0x4f')]=[{'all':!![]}];}return db[_0x1452('0x6a')][_0x1452('0x65')](_0x336c65);})[_0x1452('0x27')](function(_0x2e183e){_0x1cc91a[_0x1452('0x4a')]=_0x2e183e;return _0x1cc91a;});}})['then'](respondWithFilteredResult(_0x19e358,_0x336c65))['catch'](handleError(_0x19e358,null));};exports[_0x1452('0x6b')]=function(_0x2890c3,_0x2c11f6,_0x250487){var _0x12acaf={};var _0x469a7c={};var _0x335f4e;var _0x2c9618;return db[_0x1452('0x36')]['findOne']({'where':{'id':_0x2890c3[_0x1452('0x4d')]['id']}})[_0x1452('0x27')](handleEntityNotFound(_0x2c11f6,null))[_0x1452('0x27')](function(_0x376490){if(_0x376490){_0x335f4e=_0x376490;_0x469a7c[_0x1452('0x39')]=_[_0x1452('0x3a')](db['Team'][_0x1452('0x4e')]);_0x469a7c['query']=_[_0x1452('0x3a')](_0x2890c3['query']);_0x469a7c[_0x1452('0x45')]=_[_0x1452('0x3b')](_0x469a7c[_0x1452('0x39')],_0x469a7c['query']);_0x12acaf[_0x1452('0x3d')]=_[_0x1452('0x3b')](_0x469a7c[_0x1452('0x39')],qs['fields'](_0x2890c3[_0x1452('0x3c')][_0x1452('0x3e')]));_0x12acaf['attributes']=_0x12acaf['attributes']['length']?_0x12acaf['attributes']:_0x469a7c[_0x1452('0x39')];_0x12acaf[_0x1452('0x41')]=qs['sort'](_0x2890c3[_0x1452('0x3c')][_0x1452('0x42')]);_0x12acaf[_0x1452('0x43')]=qs[_0x1452('0x45')](_[_0x1452('0x44')](_0x2890c3[_0x1452('0x3c')],_0x469a7c[_0x1452('0x45')]));if(_0x2890c3[_0x1452('0x3c')][_0x1452('0x2c')]){_0x12acaf['where']=_[_0x1452('0x46')](_0x12acaf[_0x1452('0x43')],{'$or':_[_0x1452('0x2e')](_0x12acaf[_0x1452('0x3d')],function(_0x5c4449){var _0x5b76e4={};_0x5b76e4[_0x5c4449]={'$like':'%'+_0x2890c3[_0x1452('0x3c')]['filter']+'%'};return _0x5b76e4;})});}_0x12acaf=_[_0x1452('0x46')]({},_0x12acaf,_0x2890c3[_0x1452('0x48')]);return _0x335f4e[_0x1452('0x6b')](_0x12acaf);}})[_0x1452('0x27')](function(_0x28cbbe){if(_0x28cbbe){_0x2c9618=_0x28cbbe[_0x1452('0x3f')];if(!_0x2890c3[_0x1452('0x3c')]['hasOwnProperty'](_0x1452('0x68'))){_0x12acaf[_0x1452('0x1f')]=qs[_0x1452('0x1f')](_0x2890c3[_0x1452('0x3c')][_0x1452('0x1f')]);_0x12acaf[_0x1452('0x21')]=qs['offset'](_0x2890c3[_0x1452('0x3c')][_0x1452('0x21')]);}return _0x335f4e[_0x1452('0x6b')](_0x12acaf);}})[_0x1452('0x27')](function(_0x5610ba){if(_0x5610ba){return _0x5610ba?{'count':_0x2c9618,'rows':_0x5610ba}:null;}})[_0x1452('0x27')](respondWithResult(_0x2c11f6,null))[_0x1452('0x4b')](handleError(_0x2c11f6,null));};exports[_0x1452('0x6c')]=function(_0xac1298,_0x59d8e5,_0x303505){var _0x27893b=_0xac1298[_0x1452('0x52')][_0x1452('0x6d')];var _0x3a563b=_[_0x1452('0x2e')](_0x27893b,'id');return db[_0x1452('0x6e')][_0x1452('0x65')]({'where':{'id':_0x3a563b},'attributes':['id'],'include':[{'model':db[_0x1452('0x6f')],'as':_0x1452('0x70'),'attributes':['id',_0x1452('0x34'),'online',_0x1452('0x71'),'interface'],'raw':!![]}]})['then'](function(_0x5051e2){if(_0x5051e2){var _0x4317d7=_[_0x1452('0x72')](_0x5051e2,function(_0x6f1236){var _0x21efbd=_0x6f1236[_0x1452('0x28')]({'plain':!![]});_0x21efbd[_0x1452('0x70')]['forEach'](function(_0x3a1f86){_0x3a1f86[_0x1452('0x73')]=_[_0x1452('0x50')](_0x27893b,{'id':_0x21efbd['id']})[_0x1452('0x73')];});return _0x21efbd[_0x1452('0x70')];});return db[_0x1452('0x36')][_0x1452('0x50')]({'where':{'id':_0xac1298[_0x1452('0x4d')]['id']}})['then'](function(_0x19486e){return db[_0x1452('0x74')][_0x1452('0x75')](function(_0x40f1a5){return _0x19486e[_0x1452('0x6c')](_0x3a563b,{'transaction':_0x40f1a5})[_0x1452('0x27')](function(){return BPromise['each'](_0x27893b,function(_0x3e3d92){return db['TeamVoiceQueue'][_0x1452('0x76')]({'TeamId':_0x3e3d92['id'],'VoiceQueueId':_0xac1298[_0x1452('0x4d')]['id'],'penalty':_0x3e3d92[_0x1452('0x73')]},{'transaction':_0x40f1a5});});})[_0x1452('0x27')](function(){return BPromise['each'](_0x4317d7,function(_0x54b4b2){return db[_0x1452('0x77')][_0x1452('0x78')]({'where':{'UserId':_0x54b4b2['id'],'VoiceQueueId':_0xac1298[_0x1452('0x4d')]['id']},'defaults':{'penalty':_0x54b4b2['penalty']},'transaction':_0x40f1a5});});})[_0x1452('0x27')](function(){return BPromise[_0x1452('0x79')](_[_0x1452('0x2c')](_0x4317d7,{'online':!![]}),function(_0xadc487){return db['UserVoiceQueueRt'][_0x1452('0x76')]({'membername':_0xadc487[_0x1452('0x34')],'UserId':_0xadc487['id'],'queue_name':_0x19486e[_0x1452('0x34')],'VoiceQueueId':_0x19486e['id'],'interface':_[_0x1452('0x7a')](_0xadc487[_0x1452('0x7b')])?util[_0x1452('0x7c')](_0x1452('0x7d'),_0xadc487[_0x1452('0x34')]):_0xadc487[_0x1452('0x7b')],'paused':_0xadc487[_0x1452('0x71')]||![],'penalty':_0xadc487[_0x1452('0x73')]},{'transaction':_0x40f1a5});});})['then'](function(){_0x4317d7[_0x1452('0x7e')](function(_0x3b60bb){socket['emit'](_0x1452('0x7f'),{'UserId':_0x3b60bb['id'],'VoiceQueueId':_0x19486e['id']});});});});});}})[_0x1452('0x27')](respondWithStatusCode(_0x59d8e5,null))[_0x1452('0x4b')](handleError(_0x59d8e5,null));};exports[_0x1452('0x80')]=function(_0x13a689,_0x1fb621,_0x51e55c){return db[_0x1452('0x6e')]['findAll']({'where':{'id':_0x13a689[_0x1452('0x3c')][_0x1452('0x81')]},'attributes':['id'],'include':[{'model':db[_0x1452('0x6f')],'as':_0x1452('0x70'),'attributes':['id'],'raw':!![]}]})[_0x1452('0x27')](handleEntityNotFound(_0x1fb621,null))[_0x1452('0x27')](function(_0x394a3c){var _0x53991d=_[_0x1452('0x2e')](_0x394a3c,'id');var _0xaeafa3=[];var _0x3e2fd6=[];var _0xc23f4b=squel[_0x1452('0x82')]();_0xc23f4b['field'](_0x1452('0x83'))[_0x1452('0x84')]('team_has_voice_queues','tq')[_0x1452('0x85')](_0x1452('0x86'),'ut',_0x1452('0x87'))[_0x1452('0x43')]('VoiceQueueId\x20=\x20?',_0x13a689[_0x1452('0x4d')]['id']);for(var _0x36fdfc=0x0;_0x36fdfc<_0x394a3c[_0x1452('0x3f')];_0x36fdfc+=0x1){let _0x52240d=_0x394a3c[_0x36fdfc];for(var _0x1a45bc=0x0;_0x1a45bc<_0x52240d[_0x1452('0x70')]['length'];_0x1a45bc+=0x1){let _0x13b000=_0x52240d['Agents'][_0x1a45bc];var _0x56282f=_0xc23f4b[_0x1452('0x88')]();_0x56282f['where'](_0x1452('0x89'),_0x13b000['id']);_0x3e2fd6[_0x1452('0x8a')](db[_0x1452('0x74')]['query'](_0x56282f[_0x1452('0x8b')](),{'type':db[_0x1452('0x74')]['QueryTypes'][_0x1452('0x8c')]})[_0x1452('0x27')](function(_0x152cde){if(_0x152cde[_0x1452('0x3f')]===0x1){return _0x13b000['id'];}else{var _0x47b23d=_['every'](_[_0x1452('0x2e')](_0x152cde,_0x1452('0x8d')),function(_0x40aab7){return _[_0x1452('0x2f')](_0x53991d,_0x40aab7);});if(_0x47b23d){return _0x13b000['id'];}}}));}}return BPromise[_0x1452('0x8e')](_0x3e2fd6)['then'](function(_0x3f81a5){_0xaeafa3=_(_0xaeafa3)[_0x1452('0x8f')](_0x3f81a5)[_0x1452('0x90')]()[_0x1452('0x57')]();return db[_0x1452('0x36')][_0x1452('0x50')]({'where':{'id':_0x13a689[_0x1452('0x4d')]['id']}})['then'](function(_0x21f6a9){return db[_0x1452('0x74')][_0x1452('0x75')](function(_0x13dcca){return _0x21f6a9['removeTeams'](_0x13a689[_0x1452('0x3c')][_0x1452('0x81')],{'transaction':_0x13dcca})['then'](function(){if(!_[_0x1452('0x91')](_0xaeafa3)){return _0x21f6a9[_0x1452('0x92')](_0xaeafa3,{'transaction':_0x13dcca})[_0x1452('0x27')](function(){return db[_0x1452('0x93')]['destroy']({'where':{'VoiceQueueId':_0x13a689[_0x1452('0x4d')]['id'],'UserId':_0xaeafa3},'transaction':_0x13dcca});});}})['then'](function(){_0xaeafa3[_0x1452('0x7e')](function(_0x2c613d){socket[_0x1452('0x94')](_0x1452('0x95'),{'UserId':_0x2c613d,'VoiceQueueId':_0x21f6a9['id']});});});});});});})[_0x1452('0x27')](respondWithStatusCode(_0x1fb621,null))[_0x1452('0x4b')](handleError(_0x1fb621,null));};exports[_0x1452('0x96')]=function(_0x59f9f6,_0x26ce19,_0xaf1041){var _0x2b5aee,_0xf1dcc2;return db[_0x1452('0x36')]['find']({'where':{'id':_0x59f9f6[_0x1452('0x4d')]['id']}})['then'](handleEntityNotFound(_0x26ce19,null))[_0x1452('0x27')](function(_0x2a1693){if(_0x2a1693){_0xf1dcc2=_0x2a1693;return _0x2a1693['addAgents'](_0x59f9f6[_0x1452('0x52')][_0x1452('0x81')],_[_0x1452('0x5c')](_0x59f9f6[_0x1452('0x52')],[_0x1452('0x81'),'id'])||{})['spread'](function(_0x4ceecc){for(var _0x37e953=0x0;_0x37e953<_0x59f9f6['body'][_0x1452('0x81')][_0x1452('0x3f')];_0x37e953+=0x1){socket[_0x1452('0x94')](_0x1452('0x7f'),{'UserId':Number(_0x59f9f6[_0x1452('0x52')]['ids'][_0x37e953]),'VoiceQueueId':Number(_0x59f9f6['params']['id'])});}return _0x4ceecc;});}})[_0x1452('0x27')](function(_0x3fa016){_0x2b5aee=_0x3fa016||[];if(_0xf1dcc2){return db[_0x1452('0x6f')][_0x1452('0x65')]({'where':{'id':_0x59f9f6[_0x1452('0x52')]['ids']},'attributes':['id','name',_0x1452('0x97'),'voicePause',_0x1452('0x7b')],'raw':!![]});}})[_0x1452('0x27')](function(_0x3c2275){if(!_['isEmpty'](_0x3c2275)){var _0x1c86c0=[];for(var _0x3d0041=0x0;_0x3d0041<_0x3c2275[_0x1452('0x3f')];_0x3d0041++){if(_0x3c2275[_0x3d0041][_0x1452('0x97')]){_0x1c86c0['push'](db[_0x1452('0x93')][_0x1452('0x76')]({'membername':_0x3c2275[_0x3d0041][_0x1452('0x34')],'UserId':_0x3c2275[_0x3d0041]['id'],'queue_name':_0xf1dcc2[_0x1452('0x34')],'VoiceQueueId':_0xf1dcc2['id'],'interface':_[_0x1452('0x7a')](_0x3c2275[_0x3d0041][_0x1452('0x7b')])?util[_0x1452('0x7c')]('SIP/%s',_0x3c2275[_0x3d0041][_0x1452('0x34')]):_0x3c2275[_0x3d0041][_0x1452('0x7b')],'paused':_0x3c2275[_0x3d0041][_0x1452('0x71')]||![],'penalty':_0x59f9f6[_0x1452('0x52')]['penalty']||0x0}));}}return BPromise['all'](_0x1c86c0);}})[_0x1452('0x27')](function(){return _0x2b5aee;})[_0x1452('0x27')](respondWithResult(_0x26ce19,null))['catch'](handleError(_0x26ce19,null));};exports[_0x1452('0x92')]=function(_0x1289e7,_0x11baae,_0x4134a2){return db[_0x1452('0x36')][_0x1452('0x50')]({'where':{'id':_0x1289e7['params']['id']}})[_0x1452('0x27')](handleEntityNotFound(_0x11baae,null))[_0x1452('0x27')](function(_0x3617b6){if(_0x3617b6){return _0x3617b6[_0x1452('0x92')](_0x1289e7[_0x1452('0x3c')]['ids'])[_0x1452('0x27')](function(){if(_[_0x1452('0x98')](_0x1289e7['query'][_0x1452('0x81')])){for(var _0x4d9aeb=0x0;_0x4d9aeb<_0x1289e7[_0x1452('0x3c')][_0x1452('0x81')]['length'];_0x4d9aeb+=0x1){socket[_0x1452('0x94')]('userVoiceQueue:remove',{'UserId':Number(_0x1289e7['query']['ids'][_0x4d9aeb]),'VoiceQueueId':Number(_0x1289e7[_0x1452('0x4d')]['id'])});}}else{socket[_0x1452('0x94')](_0x1452('0x95'),{'UserId':Number(_0x1289e7['query'][_0x1452('0x81')]),'VoiceQueueId':Number(_0x1289e7[_0x1452('0x4d')]['id'])});}});}})[_0x1452('0x27')](function(_0x252fab){return db[_0x1452('0x93')]['destroy']({'where':{'VoiceQueueId':_0x1289e7[_0x1452('0x4d')]['id'],'UserId':_0x1289e7[_0x1452('0x3c')]['ids']}})['then'](function(){return _0x252fab;});})['then'](respondWithStatusCode(_0x11baae,null))[_0x1452('0x4b')](handleError(_0x11baae,null));};exports['getAgents']=function(_0x484e71,_0x1d63ae,_0x5071ad){var _0x4939d7={};var _0x21e195={};var _0x3ec5a7;var _0x4a974b;return db[_0x1452('0x36')][_0x1452('0x61')]({'where':{'id':_0x484e71['params']['id']}})[_0x1452('0x27')](handleEntityNotFound(_0x1d63ae,null))[_0x1452('0x27')](function(_0x43c537){if(_0x43c537){_0x3ec5a7=_0x43c537;_0x21e195[_0x1452('0x39')]=_[_0x1452('0x3a')](db[_0x1452('0x6f')]['rawAttributes']);_0x21e195['query']=_[_0x1452('0x3a')](_0x484e71[_0x1452('0x3c')]);_0x21e195[_0x1452('0x45')]=_['intersection'](_0x21e195[_0x1452('0x39')],_0x21e195[_0x1452('0x3c')]);_0x4939d7[_0x1452('0x3d')]=_[_0x1452('0x3b')](_0x21e195[_0x1452('0x39')],qs[_0x1452('0x3e')](_0x484e71[_0x1452('0x3c')][_0x1452('0x3e')]));_0x4939d7['attributes']=_0x4939d7['attributes'][_0x1452('0x3f')]?_0x4939d7['attributes']:_0x21e195[_0x1452('0x39')];_0x4939d7[_0x1452('0x41')]=qs['sort'](_0x484e71[_0x1452('0x3c')][_0x1452('0x42')]);_0x4939d7[_0x1452('0x43')]=qs[_0x1452('0x45')](_[_0x1452('0x44')](_0x484e71[_0x1452('0x3c')],_0x21e195[_0x1452('0x45')]));if(_0x484e71[_0x1452('0x3c')][_0x1452('0x2c')]){_0x4939d7[_0x1452('0x43')]=_['merge'](_0x4939d7[_0x1452('0x43')],{'$or':_[_0x1452('0x2e')](_0x4939d7[_0x1452('0x3d')],function(_0x153e08){var _0x337dd4={};_0x337dd4[_0x153e08]={'$like':'%'+_0x484e71[_0x1452('0x3c')][_0x1452('0x2c')]+'%'};return _0x337dd4;})});}_0x4939d7=_[_0x1452('0x46')]({},_0x4939d7,_0x484e71['options']);return _0x3ec5a7[_0x1452('0x99')](_0x4939d7);}})['then'](function(_0x123cd4){if(_0x123cd4){_0x4a974b=_0x123cd4['length'];if(!_0x484e71[_0x1452('0x3c')][_0x1452('0x40')](_0x1452('0x68'))){_0x4939d7[_0x1452('0x1f')]=qs['limit'](_0x484e71[_0x1452('0x3c')]['limit']);_0x4939d7[_0x1452('0x21')]=qs[_0x1452('0x21')](_0x484e71['query'][_0x1452('0x21')]);}return _0x3ec5a7[_0x1452('0x99')](_0x4939d7);}})[_0x1452('0x27')](function(_0xd4c5d2){if(_0xd4c5d2){return _0xd4c5d2?{'count':_0x4a974b,'rows':_0xd4c5d2}:null;}})[_0x1452('0x27')](respondWithResult(_0x1d63ae,null))[_0x1452('0x4b')](handleError(_0x1d63ae,null));};exports[_0x1452('0x9a')]=function(_0xb12d9,_0x3fb020,_0x46633f){var _0x4c4a18={};var _0x47a7d3={};var _0x209189;var _0x9fe17;return db[_0x1452('0x36')][_0x1452('0x61')]({'where':{'id':_0xb12d9['params']['id']}})['then'](handleEntityNotFound(_0x3fb020,null))['then'](function(_0x15ef2c){if(_0x15ef2c){_0x209189=_0x15ef2c;_0x47a7d3[_0x1452('0x39')]=_[_0x1452('0x3a')](db['UserVoiceQueueRt'][_0x1452('0x4e')]);_0x47a7d3['query']=_['keys'](_0xb12d9[_0x1452('0x3c')]);_0x47a7d3['filters']=_[_0x1452('0x3b')](_0x47a7d3[_0x1452('0x39')],_0x47a7d3[_0x1452('0x3c')]);_0x4c4a18[_0x1452('0x3d')]=_[_0x1452('0x3b')](_0x47a7d3[_0x1452('0x39')],qs[_0x1452('0x3e')](_0xb12d9[_0x1452('0x3c')]['fields']));_0x4c4a18[_0x1452('0x3d')]=_0x4c4a18['attributes'][_0x1452('0x3f')]?_0x4c4a18[_0x1452('0x3d')]:_0x47a7d3[_0x1452('0x39')];_0x4c4a18[_0x1452('0x41')]=qs[_0x1452('0x42')](_0xb12d9['query'][_0x1452('0x42')]);_0x4c4a18[_0x1452('0x43')]=qs[_0x1452('0x45')](_[_0x1452('0x44')](_0xb12d9[_0x1452('0x3c')],_0x47a7d3[_0x1452('0x45')]));if(_0xb12d9[_0x1452('0x3c')]['filter']){_0x4c4a18['where']=_[_0x1452('0x46')](_0x4c4a18[_0x1452('0x43')],{'$or':_[_0x1452('0x2e')](_0x4c4a18[_0x1452('0x3d')],function(_0x353fe6){var _0x572a17={};_0x572a17[_0x353fe6]={'$like':'%'+_0xb12d9['query'][_0x1452('0x2c')]+'%'};return _0x572a17;})});}_0x4c4a18=_[_0x1452('0x46')]({},_0x4c4a18,_0xb12d9['options']);return _0x209189[_0x1452('0x9a')](_0x4c4a18);}})[_0x1452('0x27')](function(_0x1770cc){if(_0x1770cc){_0x9fe17=_0x1770cc[_0x1452('0x3f')];if(!_0xb12d9[_0x1452('0x3c')][_0x1452('0x40')](_0x1452('0x68'))){_0x4c4a18[_0x1452('0x1f')]=qs[_0x1452('0x1f')](_0xb12d9[_0x1452('0x3c')][_0x1452('0x1f')]);_0x4c4a18[_0x1452('0x21')]=qs[_0x1452('0x21')](_0xb12d9[_0x1452('0x3c')][_0x1452('0x21')]);}return _0x209189[_0x1452('0x9a')](_0x4c4a18);}})[_0x1452('0x27')](function(_0x560fd9){return _0x560fd9?{'count':_0x9fe17,'rows':_0x560fd9}:null;})['then'](respondWithResult(_0x3fb020,null))[_0x1452('0x4b')](handleError(_0x3fb020,null));};exports[_0x1452('0x9b')]=function(_0x2a3d04,_0xe849b4,_0xa69d3b){var _0x467f91={};var _0x594e6e={};var _0xcba4ee;var _0x3bb2b2;return db[_0x1452('0x36')]['findOne']({'where':{'id':_0x2a3d04[_0x1452('0x4d')]['id']}})[_0x1452('0x27')](handleEntityNotFound(_0xe849b4,null))['then'](function(_0x4662c7){if(_0x4662c7){_0xcba4ee=_0x4662c7;_0x594e6e['model']=_['keys'](db['CmList']['rawAttributes']);_0x594e6e[_0x1452('0x3c')]=_[_0x1452('0x3a')](_0x2a3d04['query']);_0x594e6e['filters']=_[_0x1452('0x3b')](_0x594e6e[_0x1452('0x39')],_0x594e6e[_0x1452('0x3c')]);_0x467f91[_0x1452('0x3d')]=_[_0x1452('0x3b')](_0x594e6e[_0x1452('0x39')],qs[_0x1452('0x3e')](_0x2a3d04['query']['fields']));_0x467f91['attributes']=_0x467f91[_0x1452('0x3d')]['length']?_0x467f91[_0x1452('0x3d')]:_0x594e6e[_0x1452('0x39')];_0x467f91[_0x1452('0x41')]=qs[_0x1452('0x42')](_0x2a3d04[_0x1452('0x3c')][_0x1452('0x42')]);_0x467f91[_0x1452('0x43')]=qs[_0x1452('0x45')](_[_0x1452('0x44')](_0x2a3d04[_0x1452('0x3c')],_0x594e6e['filters']));if(_0x2a3d04[_0x1452('0x3c')][_0x1452('0x2c')]){_0x467f91[_0x1452('0x43')]=_['merge'](_0x467f91['where'],{'$or':_[_0x1452('0x2e')](_0x467f91[_0x1452('0x3d')],function(_0x553ac6){var _0x75fa29={};_0x75fa29[_0x553ac6]={'$like':'%'+_0x2a3d04['query'][_0x1452('0x2c')]+'%'};return _0x75fa29;})});}_0x467f91=_[_0x1452('0x46')]({},_0x467f91,_0x2a3d04[_0x1452('0x48')]);return _0xcba4ee[_0x1452('0x9b')](_0x467f91);}})[_0x1452('0x27')](function(_0x524c4f){if(_0x524c4f){_0x3bb2b2=_0x524c4f[_0x1452('0x3f')];if(!_0x2a3d04['query'][_0x1452('0x40')](_0x1452('0x68'))){_0x467f91[_0x1452('0x1f')]=qs[_0x1452('0x1f')](_0x2a3d04['query'][_0x1452('0x1f')]);_0x467f91[_0x1452('0x21')]=qs[_0x1452('0x21')](_0x2a3d04[_0x1452('0x3c')][_0x1452('0x21')]);}return _0xcba4ee['getLists'](_0x467f91);}})[_0x1452('0x27')](function(_0x20155d){if(_0x20155d){return _0x20155d?{'count':_0x3bb2b2,'rows':_0x20155d}:null;}})[_0x1452('0x27')](respondWithResult(_0xe849b4,null))[_0x1452('0x4b')](handleError(_0xe849b4,null));};exports[_0x1452('0x9c')]=function(_0x4d0b16,_0x37babd,_0x1a33f3){var _0x1facae,_0x4cfdfd;return db[_0x1452('0x36')][_0x1452('0x50')]({'where':{'id':_0x4d0b16[_0x1452('0x4d')]['id']}})[_0x1452('0x27')](handleEntityNotFound(_0x37babd,null))[_0x1452('0x27')](function(_0x6365f4){if(_0x6365f4){_0x4cfdfd=_0x6365f4;return _0x6365f4[_0x1452('0x9c')](_0x4d0b16[_0x1452('0x52')][_0x1452('0x81')],_['omit'](_0x4d0b16[_0x1452('0x52')],[_0x1452('0x81'),'id'])||{});}return null;})[_0x1452('0x9d')](function(_0xdf5155){var _0x663ddd;_0x1facae=_0xdf5155||[];var _0x4a28bf=[];if(_0xdf5155){for(var _0x270788=0x0;_0x270788<_0xdf5155[_0x1452('0x3f')];_0x270788+=0x1){var _0x3e1494=_0xdf5155[_0x270788]['get']({'plain':!![]});_0x4cfdfd[_0x1452('0x9e')]=_0x4d0b16[_0x1452('0x52')][_0x1452('0x9e')]?_0x4d0b16[_0x1452('0x52')]['dialCheckDuplicateType']:_0x4cfdfd['dialCheckDuplicateType'];switch(_0x4cfdfd[_0x1452('0x9e')]){case _0x1452('0x9f'):_0x663ddd=squel[_0x1452('0xa0')]()[_0x1452('0xa1')]('cm_hopper')[_0x1452('0xa2')]([_0x1452('0xa3'),_0x1452('0xa4'),_0x1452('0xa5'),_0x1452('0xa6'),_0x1452('0x63'),'createdAt',_0x1452('0x5d')],squel[_0x1452('0x82')]()[_0x1452('0xa7')]('phone','phone')[_0x1452('0xa7')]('NOW()',_0x1452('0xa4'))[_0x1452('0xa7')]('id','ContactId')[_0x1452('0xa7')](_0x3e1494[_0x1452('0xa8')]['toString'](),_0x1452('0xa6'))['field'](_0x4d0b16['params']['id'][_0x1452('0x8b')](),_0x1452('0x63'))[_0x1452('0xa7')](_0x1452('0xa9'),'createdAt')[_0x1452('0xa7')](_0x1452('0xa9'),'updatedAt')[_0x1452('0x84')]('cm_contacts')[_0x1452('0x43')]('deletedAt\x20IS\x20NULL')[_0x1452('0x43')]('ListId\x20=\x20?',_0x3e1494['CmListId'][_0x1452('0x8b')]())[_0x1452('0x43')](_0x1452('0xaa'))[_0x1452('0x43')](_0x1452('0xab'),squel['select']()[_0x1452('0xa7')](_0x1452('0xac'))[_0x1452('0x84')](_0x1452('0xad'))[_0x1452('0x43')](_0x1452('0xae'),_0x4d0b16[_0x1452('0x4d')]['id'][_0x1452('0x8b')]()))[_0x1452('0x43')](_0x1452('0xab'),squel[_0x1452('0x82')]()[_0x1452('0xa7')](_0x1452('0xaf'))[_0x1452('0x84')](_0x1452('0xb0'))[_0x1452('0x43')](_0x1452('0xae'),_0x4d0b16[_0x1452('0x4d')]['id'][_0x1452('0x8b')]())))['toString']();break;case'onlyIfOpen':_0x663ddd=squel[_0x1452('0xa0')]()['into'](_0x1452('0xb0'))[_0x1452('0xa2')](['phone','scheduledAt',_0x1452('0xa5'),_0x1452('0xa6'),_0x1452('0x63'),'createdAt',_0x1452('0x5d')],squel[_0x1452('0x82')]()[_0x1452('0xa7')](_0x1452('0xa3'),'phone')[_0x1452('0xa7')](_0x1452('0xa9'),'scheduledAt')[_0x1452('0xa7')]('id',_0x1452('0xa5'))['field'](_0x3e1494[_0x1452('0xa8')]['toString'](),_0x1452('0xa6'))[_0x1452('0xa7')](_0x4d0b16[_0x1452('0x4d')]['id'][_0x1452('0x8b')](),_0x1452('0x63'))[_0x1452('0xa7')](_0x1452('0xa9'),_0x1452('0x5e'))[_0x1452('0xa7')](_0x1452('0xa9'),'updatedAt')['from'](_0x1452('0xb1'))[_0x1452('0x43')](_0x1452('0xb2'))[_0x1452('0x43')](_0x1452('0xb3'),_0x3e1494['CmListId'][_0x1452('0x8b')]())['where'](_0x1452('0xaa'))[_0x1452('0x43')](_0x1452('0xab'),squel[_0x1452('0x82')]()['field'](_0x1452('0xaf'))['from'](_0x1452('0xb0'))[_0x1452('0x43')](_0x1452('0xae'),_0x4d0b16[_0x1452('0x4d')]['id'][_0x1452('0x8b')]())))[_0x1452('0x8b')]();break;default:_0x663ddd=squel[_0x1452('0xa0')]()[_0x1452('0xa1')](_0x1452('0xb0'))[_0x1452('0xa2')]([_0x1452('0xa3'),_0x1452('0xa4'),'ContactId',_0x1452('0xa6'),_0x1452('0x63'),_0x1452('0x5e'),_0x1452('0x5d')],squel['select']()[_0x1452('0xa7')]('phone','phone')['field'](_0x1452('0xa9'),'scheduledAt')[_0x1452('0xa7')]('id',_0x1452('0xa5'))[_0x1452('0xa7')](_0x3e1494[_0x1452('0xa8')][_0x1452('0x8b')](),_0x1452('0xa6'))['field'](_0x4d0b16[_0x1452('0x4d')]['id'][_0x1452('0x8b')](),_0x1452('0x63'))[_0x1452('0xa7')](_0x1452('0xa9'),_0x1452('0x5e'))[_0x1452('0xa7')](_0x1452('0xa9'),_0x1452('0x5d'))[_0x1452('0x84')](_0x1452('0xb1'))['where']('deletedAt\x20IS\x20NULL')[_0x1452('0x43')](_0x1452('0xb3'),_0x3e1494[_0x1452('0xa8')][_0x1452('0x8b')]())[_0x1452('0x43')](_0x1452('0xaa')))[_0x1452('0x8b')]();}_0x4a28bf[_0x1452('0x8a')](db['sequelize'][_0x1452('0x3c')](_0x663ddd));}return BPromise[_0x1452('0x8e')](_0x4a28bf);}})[_0x1452('0x27')](function(){return _0x1facae;})[_0x1452('0x27')](respondWithResult(_0x37babd,null))[_0x1452('0x4b')](handleError(_0x37babd,null));};exports[_0x1452('0xb4')]=function(_0x4a3b63,_0x543b4c,_0x430471){return db[_0x1452('0x36')]['find']({'where':{'id':_0x4a3b63[_0x1452('0x4d')]['id']}})[_0x1452('0x27')](handleEntityNotFound(_0x543b4c,null))[_0x1452('0x27')](function(_0x218663){if(_0x218663){return _0x218663[_0x1452('0xb4')](_0x4a3b63[_0x1452('0x3c')][_0x1452('0x81')]);}})['then'](function(_0x599873){if(_0x599873){return db['CmHopper']['destroy']({'where':{'ListId':_0x4a3b63[_0x1452('0x3c')][_0x1452('0x81')],'VoiceQueueId':_0x4a3b63['params']['id']}})[_0x1452('0x27')](function(){return _0x599873;});}})[_0x1452('0x27')](respondWithStatusCode(_0x543b4c,null))['catch'](handleError(_0x543b4c,null));};exports[_0x1452('0xb5')]=function(_0x4f485f,_0x28476d,_0x203efc){var _0x152ba1={};var _0xb7bcf7={};var _0x5d5775;var _0x15e5eb;return db[_0x1452('0x36')][_0x1452('0x61')]({'where':{'id':_0x4f485f[_0x1452('0x4d')]['id']}})[_0x1452('0x27')](handleEntityNotFound(_0x28476d,null))[_0x1452('0x27')](function(_0x3ffd7c){if(_0x3ffd7c){_0x5d5775=_0x3ffd7c;_0xb7bcf7['model']=_[_0x1452('0x3a')](db['CmList'][_0x1452('0x4e')]);_0xb7bcf7['query']=_['keys'](_0x4f485f[_0x1452('0x3c')]);_0xb7bcf7[_0x1452('0x45')]=_[_0x1452('0x3b')](_0xb7bcf7[_0x1452('0x39')],_0xb7bcf7[_0x1452('0x3c')]);_0x152ba1['attributes']=_[_0x1452('0x3b')](_0xb7bcf7[_0x1452('0x39')],qs['fields'](_0x4f485f[_0x1452('0x3c')][_0x1452('0x3e')]));_0x152ba1[_0x1452('0x3d')]=_0x152ba1[_0x1452('0x3d')]['length']?_0x152ba1[_0x1452('0x3d')]:_0xb7bcf7[_0x1452('0x39')];_0x152ba1[_0x1452('0x41')]=qs[_0x1452('0x42')](_0x4f485f[_0x1452('0x3c')][_0x1452('0x42')]);_0x152ba1[_0x1452('0x43')]=qs[_0x1452('0x45')](_[_0x1452('0x44')](_0x4f485f[_0x1452('0x3c')],_0xb7bcf7[_0x1452('0x45')]));if(_0x4f485f['query'][_0x1452('0x2c')]){_0x152ba1['where']=_[_0x1452('0x46')](_0x152ba1[_0x1452('0x43')],{'$or':_[_0x1452('0x2e')](_0x152ba1[_0x1452('0x3d')],function(_0x1e6163){var _0x727903={};_0x727903[_0x1e6163]={'$like':'%'+_0x4f485f[_0x1452('0x3c')][_0x1452('0x2c')]+'%'};return _0x727903;})});}_0x152ba1=_[_0x1452('0x46')]({},_0x152ba1,_0x4f485f['options']);return _0x5d5775['getBlackLists'](_0x152ba1);}})[_0x1452('0x27')](function(_0x56bc2e){if(_0x56bc2e){_0x15e5eb=_0x56bc2e['length'];if(!_0x4f485f[_0x1452('0x3c')][_0x1452('0x40')](_0x1452('0x68'))){_0x152ba1[_0x1452('0x1f')]=qs['limit'](_0x4f485f[_0x1452('0x3c')][_0x1452('0x1f')]);_0x152ba1[_0x1452('0x21')]=qs[_0x1452('0x21')](_0x4f485f['query']['offset']);}return _0x5d5775[_0x1452('0xb5')](_0x152ba1);}})[_0x1452('0x27')](function(_0x2103e8){if(_0x2103e8){return _0x2103e8?{'count':_0x15e5eb,'rows':_0x2103e8}:null;}})[_0x1452('0x27')](respondWithResult(_0x28476d,null))[_0x1452('0x4b')](handleError(_0x28476d,null));};exports[_0x1452('0xb6')]=function(_0x49e0b2,_0x2f263c,_0x3558bb){var _0x2c0cfd,_0x34e642;return db[_0x1452('0x36')][_0x1452('0x50')]({'where':{'id':_0x49e0b2[_0x1452('0x4d')]['id']}})[_0x1452('0x27')](handleEntityNotFound(_0x2f263c,null))[_0x1452('0x27')](function(_0x17fabf){if(_0x17fabf){_0x34e642=_0x17fabf;return _0x17fabf[_0x1452('0xb6')](_0x49e0b2[_0x1452('0x52')][_0x1452('0x81')],_[_0x1452('0x5c')](_0x49e0b2[_0x1452('0x52')],[_0x1452('0x81'),'id'])||{});}return null;})[_0x1452('0x9d')](function(_0x53fec4){var _0x2f9a62;_0x2c0cfd=_0x53fec4||[];var _0x2dc514=[];if(_0x53fec4){for(var _0x1d0474=0x0;_0x1d0474<_0x53fec4['length'];_0x1d0474+=0x1){var _0x38a7d4=_0x53fec4[_0x1d0474][_0x1452('0x28')]({'plain':!![]});_0x2f9a62=squel['insert']()[_0x1452('0xa1')](_0x1452('0xb7'))['fromQuery']([_0x1452('0xa3'),'ContactId','ListId',_0x1452('0x63'),'createdAt',_0x1452('0x5d')],squel[_0x1452('0x82')]()['field'](_0x1452('0xa3'),_0x1452('0xa3'))[_0x1452('0xa7')]('id','ContactId')[_0x1452('0xa7')](_0x38a7d4['CmListId']['toString'](),_0x1452('0xa6'))[_0x1452('0xa7')](_0x49e0b2[_0x1452('0x4d')]['id'][_0x1452('0x8b')](),'VoiceQueueId')[_0x1452('0xa7')]('NOW()',_0x1452('0x5e'))[_0x1452('0xa7')]('NOW()',_0x1452('0x5d'))['from'](_0x1452('0xb1'))[_0x1452('0x43')]('deletedAt\x20IS\x20NULL')['where'](_0x1452('0xb3'),_0x38a7d4[_0x1452('0xa8')][_0x1452('0x8b')]())['where'](_0x1452('0xaa')))[_0x1452('0x8b')]();_0x2dc514[_0x1452('0x8a')](db[_0x1452('0x74')][_0x1452('0x3c')](_0x2f9a62));}return BPromise['all'](_0x2dc514);}})['then'](function(){return _0x2c0cfd;})['then'](respondWithResult(_0x2f263c,null))[_0x1452('0x4b')](handleError(_0x2f263c,null));};exports[_0x1452('0xb8')]=function(_0x580b06,_0x359be5,_0x175002){return db[_0x1452('0x36')][_0x1452('0x50')]({'where':{'id':_0x580b06['params']['id']}})[_0x1452('0x27')](handleEntityNotFound(_0x359be5,null))[_0x1452('0x27')](function(_0x24fc65){if(_0x24fc65){return _0x24fc65[_0x1452('0xb8')](_0x580b06[_0x1452('0x3c')][_0x1452('0x81')]);}})[_0x1452('0x27')](function(_0xe19ef9){if(_0xe19ef9){return db['CmHopperBlack'][_0x1452('0x26')]({'where':{'ListId':_0x580b06[_0x1452('0x3c')][_0x1452('0x81')],'VoiceQueueId':_0x580b06[_0x1452('0x4d')]['id']}})[_0x1452('0x27')](function(){return _0xe19ef9;});}})['then'](respondWithStatusCode(_0x359be5,null))['catch'](handleError(_0x359be5,null));}; \ No newline at end of file +var _0x1ecc=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','keys','updatedAt','omit','createdAt','findOne','CmHopper','hasOwnProperty','pick','VoiceQueueId','options','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','User','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','interface','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','compact','transaction','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','push','isNil','all','isArray','getAgents','getMembers','CmList','getLists','addLists','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','ContactId','ListId','phone','scheduledAt','CmListId','NOW()','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','outbound','filter','map','value','find','name','UserProfileResource','end','error','stack','send','index','VoiceQueue','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','QueueCampaigns','UserProfileSection'];(function(_0x3a4329,_0x5d117d){var _0xcef98a=function(_0x402129){while(--_0x402129){_0x3a4329['push'](_0x3a4329['shift']());}};_0xcef98a(++_0x5d117d);}(_0x1ecc,0x1e1));var _0xc1ec=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0x1ecc[_0x54c9dd];return _0x855156;};'use strict';var emlformat=require(_0xc1ec('0x0'));var rimraf=require(_0xc1ec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1ec('0x2'));var rp=require('request-promise');var moment=require(_0xc1ec('0x3'));var BPromise=require(_0xc1ec('0x4'));var Mustache=require(_0xc1ec('0x5'));var util=require(_0xc1ec('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc1ec('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1ec('0x8'));var _=require(_0xc1ec('0x9'));var squel=require(_0xc1ec('0xa'));var crypto=require(_0xc1ec('0xb'));var jsforce=require(_0xc1ec('0xc'));var deskjs=require(_0xc1ec('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc1ec('0xe'));var Papa=require(_0xc1ec('0xf'));var Redis=require(_0xc1ec('0x10'));var authService=require(_0xc1ec('0x11'));var qs=require(_0xc1ec('0x12'));var as=require(_0xc1ec('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1ec('0x14'))(_0xc1ec('0x15'));var utils=require(_0xc1ec('0x16'));var config=require(_0xc1ec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1ec('0x18'))['db'];config[_0xc1ec('0x19')]=_[_0xc1ec('0x1a')](config['redis'],{'host':_0xc1ec('0x1b'),'port':0x18eb});var socket=require(_0xc1ec('0x1c'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0xc1ec('0x1d')](socket);function respondWithStatusCode(_0x56d1f9,_0x327e4e){_0x327e4e=_0x327e4e||0xcc;return function(_0x4241ae){if(_0x4241ae){return _0x56d1f9[_0xc1ec('0x1e')](_0x327e4e);}return _0x56d1f9[_0xc1ec('0x1f')](_0x327e4e)['end']();};}function respondWithResult(_0x211d51,_0x5ba872){_0x5ba872=_0x5ba872||0xc8;return function(_0x2388b5){if(_0x2388b5){return _0x211d51[_0xc1ec('0x1f')](_0x5ba872)[_0xc1ec('0x20')](_0x2388b5);}};}function respondWithFilteredResult(_0x4b4d93,_0x4f04cb){return function(_0x1d819c){if(_0x1d819c){var _0x2770b3=typeof _0x4f04cb[_0xc1ec('0x21')]===_0xc1ec('0x22')&&typeof _0x4f04cb['limit']===_0xc1ec('0x22');var _0x41a064=_0x1d819c[_0xc1ec('0x23')];var _0x3adeda=_0x2770b3?0x0:_0x4f04cb[_0xc1ec('0x21')];var _0xf4974f=_0x2770b3?_0x1d819c['count']:_0x4f04cb[_0xc1ec('0x21')]+_0x4f04cb[_0xc1ec('0x24')];var _0x52c080;if(_0xf4974f>=_0x41a064){_0xf4974f=_0x41a064;_0x52c080=0xc8;}else{_0x52c080=0xce;}_0x4b4d93[_0xc1ec('0x1f')](_0x52c080);return _0x4b4d93[_0xc1ec('0x25')](_0xc1ec('0x26'),_0x3adeda+'-'+_0xf4974f+'/'+_0x41a064)[_0xc1ec('0x20')](_0x1d819c);}return null;};}function patchUpdates(_0x2a7f2b){return function(_0x5b1cc4){try{jsonpatch[_0xc1ec('0x27')](_0x5b1cc4,_0x2a7f2b,!![]);}catch(_0x9d4429){return BPromise[_0xc1ec('0x28')](_0x9d4429);}return _0x5b1cc4[_0xc1ec('0x29')]();};}function saveUpdates(_0x598fc2,_0x11a6b6){return function(_0x5811f1){if(_0x5811f1){return _0x5811f1[_0xc1ec('0x2a')](_0x598fc2)[_0xc1ec('0x2b')](function(_0x5c36d1){return _0x5c36d1;});}return null;};}function removeEntity(_0x2da848,_0x59a00c){return function(_0x50ac19){if(_0x50ac19){return _0x50ac19[_0xc1ec('0x2c')]()[_0xc1ec('0x2b')](function(){var _0x2b15d9=_0x50ac19[_0xc1ec('0x2d')]({'plain':!![]});var _0x4d511d=[{'name':_0xc1ec('0x2e'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0xc1ec('0x2f'),'ignore':![]}];var _0x5efb05=_(_0x4d511d)[_0xc1ec('0x30')]('ignore')[_0xc1ec('0x31')](_0xc1ec('0x32'))[_0xc1ec('0x32')]();if(_['includes'](_0x5efb05,_0x2b15d9['type'])){return;}var _0x29f122=_[_0xc1ec('0x33')](_0x4d511d,[_0xc1ec('0x32'),_0x2b15d9['type']])[_0xc1ec('0x34')];return db[_0xc1ec('0x35')][_0xc1ec('0x2c')]({'where':{'type':_0x29f122,'resourceId':_0x2b15d9['id']}})[_0xc1ec('0x2b')](function(){return _0x50ac19;});})[_0xc1ec('0x2b')](function(){_0x2da848[_0xc1ec('0x1f')](0xcc)[_0xc1ec('0x36')]();});}};}function handleEntityNotFound(_0xe0cc5a,_0x5221b7){return function(_0xb59bcc){if(!_0xb59bcc){_0xe0cc5a[_0xc1ec('0x1e')](0x194);}return _0xb59bcc;};}function handleError(_0x39cddc,_0x398582){_0x398582=_0x398582||0x1f4;return function(_0x318554){logger[_0xc1ec('0x37')](_0x318554[_0xc1ec('0x38')]);if(_0x318554['name']){delete _0x318554[_0xc1ec('0x34')];}_0x39cddc[_0xc1ec('0x1f')](_0x398582)[_0xc1ec('0x39')](_0x318554);};}exports[_0xc1ec('0x3a')]=function(_0x56b6f3,_0x10c41d){var _0x4a0cf8={},_0x4f4df3={},_0x45493c={'count':0x0,'rows':[]};var _0x30001f=_[_0xc1ec('0x31')](db[_0xc1ec('0x3b')]['rawAttributes'],function(_0x20e9f2){return{'name':_0x20e9f2[_0xc1ec('0x3c')],'type':_0x20e9f2[_0xc1ec('0x3d')][_0xc1ec('0x3e')]};});_0x4f4df3[_0xc1ec('0x3f')]=_[_0xc1ec('0x31')](_0x30001f,_0xc1ec('0x34'));_0x4f4df3[_0xc1ec('0x40')]=_['keys'](_0x56b6f3['query']);_0x4f4df3[_0xc1ec('0x41')]=_[_0xc1ec('0x42')](_0x4f4df3[_0xc1ec('0x3f')],_0x4f4df3[_0xc1ec('0x40')]);_0x4a0cf8[_0xc1ec('0x43')]=_['intersection'](_0x4f4df3[_0xc1ec('0x3f')],qs['fields'](_0x56b6f3[_0xc1ec('0x40')][_0xc1ec('0x44')]));_0x4a0cf8[_0xc1ec('0x43')]=_0x4a0cf8[_0xc1ec('0x43')][_0xc1ec('0x45')]?_0x4a0cf8[_0xc1ec('0x43')]:_0x4f4df3[_0xc1ec('0x3f')];if(!_0x56b6f3[_0xc1ec('0x40')]['hasOwnProperty'](_0xc1ec('0x46'))){_0x4a0cf8['limit']=qs[_0xc1ec('0x24')](_0x56b6f3['query'][_0xc1ec('0x24')]);_0x4a0cf8[_0xc1ec('0x21')]=qs[_0xc1ec('0x21')](_0x56b6f3[_0xc1ec('0x40')][_0xc1ec('0x21')]);}_0x4a0cf8[_0xc1ec('0x47')]=qs[_0xc1ec('0x48')](_0x56b6f3[_0xc1ec('0x40')][_0xc1ec('0x48')]);_0x4a0cf8[_0xc1ec('0x49')]=qs[_0xc1ec('0x41')](_['pick'](_0x56b6f3[_0xc1ec('0x40')],_0x4f4df3[_0xc1ec('0x41')]),_0x30001f);if(_0x56b6f3[_0xc1ec('0x40')][_0xc1ec('0x30')]){_0x4a0cf8['where']=_[_0xc1ec('0x4a')](_0x4a0cf8[_0xc1ec('0x49')],{'$or':_['map'](_0x30001f,function(_0x31bae1){if(_0x31bae1[_0xc1ec('0x3d')]!==_0xc1ec('0x4b')){var _0x5bc2cd={};_0x5bc2cd[_0x31bae1['name']]={'$like':'%'+_0x56b6f3[_0xc1ec('0x40')][_0xc1ec('0x30')]+'%'};return _0x5bc2cd;}})});}_0x4a0cf8=_[_0xc1ec('0x4a')]({},_0x4a0cf8,_0x56b6f3['options']);var _0x2b6f53={'where':_0x4a0cf8[_0xc1ec('0x49')]};return db['VoiceQueue'][_0xc1ec('0x23')](_0x2b6f53)[_0xc1ec('0x2b')](function(_0x3b235b){_0x45493c['count']=_0x3b235b;if(_0x56b6f3[_0xc1ec('0x40')][_0xc1ec('0x4c')]){_0x4a0cf8[_0xc1ec('0x4d')]=[{'all':!![]}];}return db[_0xc1ec('0x3b')][_0xc1ec('0x4e')](_0x4a0cf8);})['then'](function(_0x383610){_0x45493c[_0xc1ec('0x4f')]=_0x383610;return _0x45493c;})[_0xc1ec('0x2b')](respondWithFilteredResult(_0x10c41d,_0x4a0cf8))['catch'](handleError(_0x10c41d,null));};exports[_0xc1ec('0x50')]=function(_0x43bca1,_0x3e7d6b){var _0x748536={'raw':![],'where':{'id':_0x43bca1[_0xc1ec('0x51')]['id']}},_0x51844e={};_0x51844e[_0xc1ec('0x3f')]=_['keys'](db['VoiceQueue'][_0xc1ec('0x52')]);_0x51844e['query']=_['keys'](_0x43bca1[_0xc1ec('0x40')]);_0x51844e[_0xc1ec('0x41')]=_[_0xc1ec('0x42')](_0x51844e[_0xc1ec('0x3f')],_0x51844e[_0xc1ec('0x40')]);_0x748536[_0xc1ec('0x43')]=_[_0xc1ec('0x42')](_0x51844e[_0xc1ec('0x3f')],qs['fields'](_0x43bca1[_0xc1ec('0x40')]['fields']));_0x748536[_0xc1ec('0x43')]=_0x748536[_0xc1ec('0x43')][_0xc1ec('0x45')]?_0x748536['attributes']:_0x51844e[_0xc1ec('0x3f')];if(_0x43bca1[_0xc1ec('0x40')][_0xc1ec('0x4c')]){_0x748536[_0xc1ec('0x4d')]=[{'all':!![]}];}_0x748536=_[_0xc1ec('0x4a')]({},_0x748536,_0x43bca1['options']);return db[_0xc1ec('0x3b')][_0xc1ec('0x33')](_0x748536)[_0xc1ec('0x2b')](handleEntityNotFound(_0x3e7d6b,null))['then'](respondWithResult(_0x3e7d6b,null))[_0xc1ec('0x53')](handleError(_0x3e7d6b,null));};exports[_0xc1ec('0x54')]=function(_0x13464d,_0x187395){return db[_0xc1ec('0x3b')][_0xc1ec('0x54')](_0x13464d[_0xc1ec('0x55')],{})[_0xc1ec('0x2b')](function(_0x484d94){var _0x5c06b7=_0x13464d[_0xc1ec('0x56')][_0xc1ec('0x2d')]({'plain':!![]});if(!_0x5c06b7)throw new Error(_0xc1ec('0x57'));if(_0x5c06b7[_0xc1ec('0x58')]===_0xc1ec('0x56')){var _0x488984=_0x484d94['get']({'plain':!![]});var _0x5d68d=[{'name':_0xc1ec('0x2e'),'value':_0xc1ec('0x59')},{'name':_0xc1ec('0x5a'),'value':'outbound'}];var _0xe37950=_[_0xc1ec('0x33')](_0x5d68d,[_0xc1ec('0x32'),_0x488984[_0xc1ec('0x3d')]])['name'];return db[_0xc1ec('0x5b')][_0xc1ec('0x33')]({'where':{'name':_0xe37950,'userProfileId':_0x5c06b7[_0xc1ec('0x5c')]},'raw':!![]})['then'](function(_0x2b16c9){if(_0x2b16c9&&_0x2b16c9[_0xc1ec('0x5d')]===0x0){return db[_0xc1ec('0x35')][_0xc1ec('0x54')]({'name':_0x488984[_0xc1ec('0x34')],'resourceId':_0x488984['id'],'type':_0x2b16c9[_0xc1ec('0x34')],'sectionId':_0x2b16c9['id']},{})[_0xc1ec('0x2b')](function(){return _0x484d94;});}else{return _0x484d94;}})[_0xc1ec('0x53')](function(_0x48eb78){logger['error'](_0xc1ec('0x5e'),_0x48eb78);throw _0x48eb78;});}return _0x484d94;})['then'](respondWithResult(_0x187395,0xc9))[_0xc1ec('0x53')](handleError(_0x187395,null));};exports['clone']=function(_0x3a9eef,_0xc87f7f){var _0x5c76cb={'where':{'id':_0x3a9eef[_0xc1ec('0x51')]['id']}},_0x315b73={};_0x315b73[_0xc1ec('0x3f')]=_[_0xc1ec('0x5f')](db[_0xc1ec('0x3b')]['rawAttributes']);_0x5c76cb[_0xc1ec('0x43')]=_[_0xc1ec('0x42')](_0x315b73[_0xc1ec('0x3f')],qs[_0xc1ec('0x44')](_0x3a9eef[_0xc1ec('0x40')][_0xc1ec('0x44')]));_0x5c76cb[_0xc1ec('0x43')]=_0x5c76cb[_0xc1ec('0x43')][_0xc1ec('0x45')]?_0x5c76cb[_0xc1ec('0x43')]:_0x315b73['model'];if(_0x3a9eef[_0xc1ec('0x40')][_0xc1ec('0x4c')]){_0x5c76cb[_0xc1ec('0x4d')]=[{'all':!![]}];}_0x5c76cb=_[_0xc1ec('0x4a')]({},_0x5c76cb,_0x3a9eef['options']);return db['VoiceQueue'][_0xc1ec('0x33')](_0x5c76cb)['then'](handleEntityNotFound(_0xc87f7f,null))[_0xc1ec('0x2b')](function(_0x46b323){if(_0x46b323){var _0x6c2f2a=_0x46b323[_0xc1ec('0x2d')]({'plain':!![]});_0x6c2f2a=qs['omit'](_0x6c2f2a,['id','createdAt',_0xc1ec('0x60')]);_0x3a9eef[_0xc1ec('0x55')]=_[_0xc1ec('0x61')](_0x3a9eef['body'],['id',_0xc1ec('0x62'),_0xc1ec('0x60')]);return db[_0xc1ec('0x3b')][_0xc1ec('0x54')](_[_0xc1ec('0x4a')](_0x6c2f2a,_0x3a9eef['body']),{'include':_0x3a9eef[_0xc1ec('0x40')][_0xc1ec('0x4c')]?[{'all':!![]}]:undefined})[_0xc1ec('0x2b')](function(_0x273e45){var _0x45cb44=_0x3a9eef[_0xc1ec('0x56')][_0xc1ec('0x2d')]({'plain':!![]});if(!_0x45cb44)throw new Error(_0xc1ec('0x57'));if(_0x45cb44['role']===_0xc1ec('0x56')){var _0x5db916=_0x273e45['get']({'plain':!![]});var _0x24d0df=[{'name':_0xc1ec('0x2e'),'value':'inbound'},{'name':_0xc1ec('0x5a'),'value':_0xc1ec('0x2f')}];var _0x5f20e8=_[_0xc1ec('0x33')](_0x24d0df,[_0xc1ec('0x32'),_0x5db916[_0xc1ec('0x3d')]])[_0xc1ec('0x34')];return db[_0xc1ec('0x5b')][_0xc1ec('0x33')]({'where':{'name':_0x5f20e8,'userProfileId':_0x45cb44[_0xc1ec('0x5c')]},'raw':!![]})['then'](function(_0x733fae){if(_0x733fae&&_0x733fae[_0xc1ec('0x5d')]===0x0){return db[_0xc1ec('0x35')][_0xc1ec('0x54')]({'name':_0x5db916[_0xc1ec('0x34')],'resourceId':_0x5db916['id'],'type':_0x733fae[_0xc1ec('0x34')],'sectionId':_0x733fae['id']},{})[_0xc1ec('0x2b')](function(){return _0x273e45;});}else{return _0x273e45;}})[_0xc1ec('0x53')](function(_0x5b7f6c){logger[_0xc1ec('0x37')](_0xc1ec('0x5e'),_0x5b7f6c);throw _0x5b7f6c;});}return _0x273e45;});}})[_0xc1ec('0x2b')](respondWithResult(_0xc87f7f,0xc9))[_0xc1ec('0x53')](handleError(_0xc87f7f,null));};exports['update']=function(_0x1ca43b,_0x8f8abf){if(_0x1ca43b[_0xc1ec('0x55')]['id']){delete _0x1ca43b[_0xc1ec('0x55')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x1ca43b['params']['id']}})[_0xc1ec('0x2b')](handleEntityNotFound(_0x8f8abf,null))['then'](saveUpdates(_0x1ca43b[_0xc1ec('0x55')],null))[_0xc1ec('0x2b')](respondWithResult(_0x8f8abf,null))['catch'](handleError(_0x8f8abf,null));};exports[_0xc1ec('0x2c')]=function(_0x924cc,_0x3d11fe){return db[_0xc1ec('0x3b')][_0xc1ec('0x33')]({'where':{'id':_0x924cc[_0xc1ec('0x51')]['id']}})[_0xc1ec('0x2b')](handleEntityNotFound(_0x3d11fe,null))[_0xc1ec('0x2b')](removeEntity(_0x3d11fe,null))['catch'](handleError(_0x3d11fe,null));};exports['getHoppers']=function(_0x4261fc,_0x2f1456,_0x2f307a){var _0x498388={'raw':![],'where':{}};var _0x4e2f85={};var _0x5f5763={'count':0x0,'rows':[]};return db[_0xc1ec('0x3b')][_0xc1ec('0x63')]({'where':{'id':_0x4261fc[_0xc1ec('0x51')]['id']}})['then'](handleEntityNotFound(_0x2f1456,null))['then'](function(_0x20741e){if(_0x20741e){_0x4e2f85[_0xc1ec('0x3f')]=_[_0xc1ec('0x5f')](db[_0xc1ec('0x64')][_0xc1ec('0x52')]);_0x4e2f85[_0xc1ec('0x40')]=_['keys'](_0x4261fc[_0xc1ec('0x40')]);_0x4e2f85['filters']=_['intersection'](_0x4e2f85[_0xc1ec('0x3f')],_0x4e2f85[_0xc1ec('0x40')]);_0x498388[_0xc1ec('0x43')]=_[_0xc1ec('0x42')](_0x4e2f85['model'],qs[_0xc1ec('0x44')](_0x4261fc[_0xc1ec('0x40')][_0xc1ec('0x44')]));_0x498388[_0xc1ec('0x43')]=_0x498388[_0xc1ec('0x43')][_0xc1ec('0x45')]?_0x498388[_0xc1ec('0x43')]:_0x4e2f85[_0xc1ec('0x3f')];if(!_0x4261fc['query'][_0xc1ec('0x65')]('nolimit')){_0x498388['limit']=qs[_0xc1ec('0x24')](_0x4261fc['query']['limit']);_0x498388[_0xc1ec('0x21')]=qs[_0xc1ec('0x21')](_0x4261fc[_0xc1ec('0x40')][_0xc1ec('0x21')]);}_0x498388[_0xc1ec('0x47')]=qs[_0xc1ec('0x48')](_0x4261fc[_0xc1ec('0x40')][_0xc1ec('0x48')]);_0x498388['where']=qs[_0xc1ec('0x41')](_[_0xc1ec('0x66')](_0x4261fc[_0xc1ec('0x40')],_0x4e2f85[_0xc1ec('0x41')]));_0x498388['where'][_0xc1ec('0x67')]=_0x20741e['id'];if(_0x4261fc[_0xc1ec('0x40')]['filter']){_0x498388['where']=_['merge'](_0x498388['where'],{'$or':_[_0xc1ec('0x31')](_0x498388[_0xc1ec('0x43')],function(_0x485f9f){var _0x569b29={};_0x569b29[_0x485f9f]={'$like':'%'+_0x4261fc['query'][_0xc1ec('0x30')]+'%'};return _0x569b29;})});}_0x498388=_[_0xc1ec('0x4a')]({},_0x498388,_0x4261fc[_0xc1ec('0x68')]);return db['CmHopper']['count']({'where':_0x498388[_0xc1ec('0x49')]})['then'](function(_0x37fabf){_0x5f5763[_0xc1ec('0x23')]=_0x37fabf;if(_0x4261fc[_0xc1ec('0x40')][_0xc1ec('0x4c')]){_0x498388[_0xc1ec('0x4d')]=[{'all':!![]}];}return db[_0xc1ec('0x64')]['findAll'](_0x498388);})[_0xc1ec('0x2b')](function(_0x19aac3){_0x5f5763[_0xc1ec('0x4f')]=_0x19aac3;return _0x5f5763;});}})[_0xc1ec('0x2b')](respondWithFilteredResult(_0x2f1456,_0x498388))['catch'](handleError(_0x2f1456,null));};exports[_0xc1ec('0x69')]=function(_0x240604,_0x560423,_0x211b8f){var _0x200718={'raw':!![],'where':{}};var _0x58cd25={};var _0x2ec4ab={'count':0x0,'rows':[]};return db[_0xc1ec('0x3b')][_0xc1ec('0x63')]({'where':{'id':_0x240604[_0xc1ec('0x51')]['id']}})['then'](handleEntityNotFound(_0x560423,null))[_0xc1ec('0x2b')](function(_0x220ef1){if(_0x220ef1){_0x58cd25['model']=_['keys'](db['CmHopperHistory'][_0xc1ec('0x52')]);_0x58cd25[_0xc1ec('0x40')]=_[_0xc1ec('0x5f')](_0x240604[_0xc1ec('0x40')]);_0x58cd25[_0xc1ec('0x41')]=_['intersection'](_0x58cd25[_0xc1ec('0x3f')],_0x58cd25[_0xc1ec('0x40')]);_0x200718[_0xc1ec('0x43')]=_[_0xc1ec('0x42')](_0x58cd25[_0xc1ec('0x3f')],qs[_0xc1ec('0x44')](_0x240604['query'][_0xc1ec('0x44')]));_0x200718[_0xc1ec('0x43')]=_0x200718[_0xc1ec('0x43')][_0xc1ec('0x45')]?_0x200718['attributes']:_0x58cd25[_0xc1ec('0x3f')];if(!_0x240604['query'][_0xc1ec('0x65')](_0xc1ec('0x46'))){_0x200718['limit']=qs['limit'](_0x240604[_0xc1ec('0x40')][_0xc1ec('0x24')]);_0x200718[_0xc1ec('0x21')]=qs[_0xc1ec('0x21')](_0x240604['query'][_0xc1ec('0x21')]);}_0x200718[_0xc1ec('0x47')]=qs[_0xc1ec('0x48')](_0x240604[_0xc1ec('0x40')][_0xc1ec('0x48')]);_0x200718['where']=qs[_0xc1ec('0x41')](_[_0xc1ec('0x66')](_0x240604['query'],_0x58cd25[_0xc1ec('0x41')]));_0x200718[_0xc1ec('0x49')][_0xc1ec('0x67')]=_0x220ef1['id'];if(_0x240604['query']['filter']){_0x200718[_0xc1ec('0x49')]=_[_0xc1ec('0x4a')](_0x200718[_0xc1ec('0x49')],{'$or':_[_0xc1ec('0x31')](_0x200718[_0xc1ec('0x43')],function(_0x45b9d5){var _0x532b97={};_0x532b97[_0x45b9d5]={'$like':'%'+_0x240604[_0xc1ec('0x40')]['filter']+'%'};return _0x532b97;})});}_0x200718=_[_0xc1ec('0x4a')]({},_0x200718,_0x240604['options']);return db[_0xc1ec('0x6a')]['count']({'where':_0x200718['where']})[_0xc1ec('0x2b')](function(_0x26078f){_0x2ec4ab[_0xc1ec('0x23')]=_0x26078f;if(_0x240604[_0xc1ec('0x40')][_0xc1ec('0x4c')]){_0x200718['include']=[{'all':!![]}];}return db[_0xc1ec('0x6a')][_0xc1ec('0x4e')](_0x200718);})[_0xc1ec('0x2b')](function(_0x1f1efb){_0x2ec4ab['rows']=_0x1f1efb;return _0x2ec4ab;});}})['then'](respondWithFilteredResult(_0x560423,_0x200718))[_0xc1ec('0x53')](handleError(_0x560423,null));};exports[_0xc1ec('0x6b')]=function(_0x1d79b3,_0x1fd7a7,_0x52b468){var _0x400ccc={'raw':!![],'where':{}};var _0x6babee={};var _0x553596={'count':0x0,'rows':[]};return db[_0xc1ec('0x3b')]['findOne']({'where':{'id':_0x1d79b3['params']['id']}})[_0xc1ec('0x2b')](handleEntityNotFound(_0x1fd7a7,null))[_0xc1ec('0x2b')](function(_0x1b0ff3){if(_0x1b0ff3){_0x6babee[_0xc1ec('0x3f')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x6babee[_0xc1ec('0x40')]=_[_0xc1ec('0x5f')](_0x1d79b3[_0xc1ec('0x40')]);_0x6babee[_0xc1ec('0x41')]=_[_0xc1ec('0x42')](_0x6babee[_0xc1ec('0x3f')],_0x6babee[_0xc1ec('0x40')]);_0x400ccc[_0xc1ec('0x43')]=_['intersection'](_0x6babee['model'],qs['fields'](_0x1d79b3['query'][_0xc1ec('0x44')]));_0x400ccc[_0xc1ec('0x43')]=_0x400ccc[_0xc1ec('0x43')][_0xc1ec('0x45')]?_0x400ccc[_0xc1ec('0x43')]:_0x6babee[_0xc1ec('0x3f')];if(!_0x1d79b3[_0xc1ec('0x40')][_0xc1ec('0x65')](_0xc1ec('0x46'))){_0x400ccc[_0xc1ec('0x24')]=qs[_0xc1ec('0x24')](_0x1d79b3[_0xc1ec('0x40')][_0xc1ec('0x24')]);_0x400ccc[_0xc1ec('0x21')]=qs['offset'](_0x1d79b3[_0xc1ec('0x40')][_0xc1ec('0x21')]);}_0x400ccc[_0xc1ec('0x47')]=qs[_0xc1ec('0x48')](_0x1d79b3[_0xc1ec('0x40')][_0xc1ec('0x48')]);_0x400ccc[_0xc1ec('0x49')]=qs['filters'](_['pick'](_0x1d79b3[_0xc1ec('0x40')],_0x6babee[_0xc1ec('0x41')]));_0x400ccc[_0xc1ec('0x49')][_0xc1ec('0x67')]=_0x1b0ff3['id'];if(_0x1d79b3[_0xc1ec('0x40')][_0xc1ec('0x30')]){_0x400ccc['where']=_['merge'](_0x400ccc['where'],{'$or':_[_0xc1ec('0x31')](_0x400ccc[_0xc1ec('0x43')],function(_0xeb39b0){var _0x4d9d6d={};_0x4d9d6d[_0xeb39b0]={'$like':'%'+_0x1d79b3[_0xc1ec('0x40')][_0xc1ec('0x30')]+'%'};return _0x4d9d6d;})});}_0x400ccc=_[_0xc1ec('0x4a')]({},_0x400ccc,_0x1d79b3[_0xc1ec('0x68')]);return db['CmHopperFinal'][_0xc1ec('0x23')]({'where':_0x400ccc[_0xc1ec('0x49')]})[_0xc1ec('0x2b')](function(_0x4623b0){_0x553596[_0xc1ec('0x23')]=_0x4623b0;if(_0x1d79b3[_0xc1ec('0x40')][_0xc1ec('0x4c')]){_0x400ccc['include']=[{'all':!![]}];}return db[_0xc1ec('0x6c')][_0xc1ec('0x4e')](_0x400ccc);})['then'](function(_0xa06c24){_0x553596[_0xc1ec('0x4f')]=_0xa06c24;return _0x553596;});}})[_0xc1ec('0x2b')](respondWithFilteredResult(_0x1fd7a7,_0x400ccc))[_0xc1ec('0x53')](handleError(_0x1fd7a7,null));};exports[_0xc1ec('0x6d')]=function(_0x5d02c8,_0x3a59ef,_0x34817d){var _0x3c74f5={'raw':!![],'where':{}};var _0x49aa2b={};var _0x23ed6c={'count':0x0,'rows':[]};return db[_0xc1ec('0x3b')]['findOne']({'where':{'id':_0x5d02c8[_0xc1ec('0x51')]['id']}})['then'](handleEntityNotFound(_0x3a59ef,null))[_0xc1ec('0x2b')](function(_0x53cd6a){if(_0x53cd6a){_0x49aa2b['model']=_[_0xc1ec('0x5f')](db[_0xc1ec('0x6e')][_0xc1ec('0x52')]);_0x49aa2b['query']=_['keys'](_0x5d02c8['query']);_0x49aa2b['filters']=_[_0xc1ec('0x42')](_0x49aa2b['model'],_0x49aa2b[_0xc1ec('0x40')]);_0x3c74f5[_0xc1ec('0x43')]=_[_0xc1ec('0x42')](_0x49aa2b[_0xc1ec('0x3f')],qs[_0xc1ec('0x44')](_0x5d02c8['query'][_0xc1ec('0x44')]));_0x3c74f5[_0xc1ec('0x43')]=_0x3c74f5[_0xc1ec('0x43')]['length']?_0x3c74f5[_0xc1ec('0x43')]:_0x49aa2b[_0xc1ec('0x3f')];if(!_0x5d02c8[_0xc1ec('0x40')][_0xc1ec('0x65')](_0xc1ec('0x46'))){_0x3c74f5[_0xc1ec('0x24')]=qs['limit'](_0x5d02c8[_0xc1ec('0x40')][_0xc1ec('0x24')]);_0x3c74f5['offset']=qs[_0xc1ec('0x21')](_0x5d02c8[_0xc1ec('0x40')][_0xc1ec('0x21')]);}_0x3c74f5[_0xc1ec('0x47')]=qs['sort'](_0x5d02c8[_0xc1ec('0x40')][_0xc1ec('0x48')]);_0x3c74f5[_0xc1ec('0x49')]=qs['filters'](_['pick'](_0x5d02c8['query'],_0x49aa2b[_0xc1ec('0x41')]));_0x3c74f5[_0xc1ec('0x49')]['VoiceQueueId']=_0x53cd6a['id'];if(_0x5d02c8[_0xc1ec('0x40')][_0xc1ec('0x30')]){_0x3c74f5[_0xc1ec('0x49')]=_['merge'](_0x3c74f5[_0xc1ec('0x49')],{'$or':_[_0xc1ec('0x31')](_0x3c74f5[_0xc1ec('0x43')],function(_0x5df22c){var _0x228ea2={};_0x228ea2[_0x5df22c]={'$like':'%'+_0x5d02c8[_0xc1ec('0x40')][_0xc1ec('0x30')]+'%'};return _0x228ea2;})});}_0x3c74f5=_[_0xc1ec('0x4a')]({},_0x3c74f5,_0x5d02c8['options']);return db[_0xc1ec('0x6e')][_0xc1ec('0x23')]({'where':_0x3c74f5[_0xc1ec('0x49')]})[_0xc1ec('0x2b')](function(_0x17f4a3){_0x23ed6c[_0xc1ec('0x23')]=_0x17f4a3;if(_0x5d02c8[_0xc1ec('0x40')][_0xc1ec('0x4c')]){_0x3c74f5[_0xc1ec('0x4d')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xc1ec('0x4e')](_0x3c74f5);})[_0xc1ec('0x2b')](function(_0x3ac247){_0x23ed6c[_0xc1ec('0x4f')]=_0x3ac247;return _0x23ed6c;});}})[_0xc1ec('0x2b')](respondWithFilteredResult(_0x3a59ef,_0x3c74f5))[_0xc1ec('0x53')](handleError(_0x3a59ef,null));};exports[_0xc1ec('0x6f')]=function(_0x5844cc,_0x33e539,_0xa86be4){var _0x3c00ee={};var _0x268e79={};var _0x5bfdd3;var _0xbd66fb;return db[_0xc1ec('0x3b')][_0xc1ec('0x63')]({'where':{'id':_0x5844cc[_0xc1ec('0x51')]['id']}})[_0xc1ec('0x2b')](handleEntityNotFound(_0x33e539,null))[_0xc1ec('0x2b')](function(_0x1165ad){if(_0x1165ad){_0x5bfdd3=_0x1165ad;_0x268e79[_0xc1ec('0x3f')]=_[_0xc1ec('0x5f')](db[_0xc1ec('0x70')][_0xc1ec('0x52')]);_0x268e79['query']=_[_0xc1ec('0x5f')](_0x5844cc[_0xc1ec('0x40')]);_0x268e79['filters']=_[_0xc1ec('0x42')](_0x268e79[_0xc1ec('0x3f')],_0x268e79[_0xc1ec('0x40')]);_0x3c00ee[_0xc1ec('0x43')]=_[_0xc1ec('0x42')](_0x268e79[_0xc1ec('0x3f')],qs[_0xc1ec('0x44')](_0x5844cc[_0xc1ec('0x40')][_0xc1ec('0x44')]));_0x3c00ee[_0xc1ec('0x43')]=_0x3c00ee[_0xc1ec('0x43')][_0xc1ec('0x45')]?_0x3c00ee[_0xc1ec('0x43')]:_0x268e79[_0xc1ec('0x3f')];_0x3c00ee['order']=qs[_0xc1ec('0x48')](_0x5844cc[_0xc1ec('0x40')]['sort']);_0x3c00ee[_0xc1ec('0x49')]=qs[_0xc1ec('0x41')](_['pick'](_0x5844cc[_0xc1ec('0x40')],_0x268e79[_0xc1ec('0x41')]));if(_0x5844cc['query'][_0xc1ec('0x30')]){_0x3c00ee[_0xc1ec('0x49')]=_[_0xc1ec('0x4a')](_0x3c00ee['where'],{'$or':_[_0xc1ec('0x31')](_0x3c00ee[_0xc1ec('0x43')],function(_0x169b73){var _0x4887d4={};_0x4887d4[_0x169b73]={'$like':'%'+_0x5844cc['query']['filter']+'%'};return _0x4887d4;})});}_0x3c00ee=_['merge']({},_0x3c00ee,_0x5844cc[_0xc1ec('0x68')]);return _0x5bfdd3[_0xc1ec('0x6f')](_0x3c00ee);}})[_0xc1ec('0x2b')](function(_0x55616d){if(_0x55616d){_0xbd66fb=_0x55616d[_0xc1ec('0x45')];if(!_0x5844cc[_0xc1ec('0x40')][_0xc1ec('0x65')]('nolimit')){_0x3c00ee[_0xc1ec('0x24')]=qs[_0xc1ec('0x24')](_0x5844cc[_0xc1ec('0x40')][_0xc1ec('0x24')]);_0x3c00ee[_0xc1ec('0x21')]=qs[_0xc1ec('0x21')](_0x5844cc[_0xc1ec('0x40')][_0xc1ec('0x21')]);}return _0x5bfdd3[_0xc1ec('0x6f')](_0x3c00ee);}})[_0xc1ec('0x2b')](function(_0x4b9b84){if(_0x4b9b84){return _0x4b9b84?{'count':_0xbd66fb,'rows':_0x4b9b84}:null;}})[_0xc1ec('0x2b')](respondWithResult(_0x33e539,null))[_0xc1ec('0x53')](handleError(_0x33e539,null));};exports['addTeams']=function(_0x1b13b8,_0x8da59d,_0x28fff2){var _0x44926e=_0x1b13b8['body'][_0xc1ec('0x71')];var _0x426363=_[_0xc1ec('0x31')](_0x44926e,'id');return db['Team']['findAll']({'where':{'id':_0x426363},'attributes':['id'],'include':[{'model':db[_0xc1ec('0x72')],'as':_0xc1ec('0x73'),'attributes':['id',_0xc1ec('0x34'),_0xc1ec('0x74'),_0xc1ec('0x75'),'interface'],'raw':!![]}]})[_0xc1ec('0x2b')](function(_0x4eefbe){if(_0x4eefbe){var _0xa67efa=_[_0xc1ec('0x76')](_0x4eefbe,function(_0x1f29f5){var _0x71001e=_0x1f29f5[_0xc1ec('0x2d')]({'plain':!![]});_0x71001e[_0xc1ec('0x73')][_0xc1ec('0x77')](function(_0x455bca){_0x455bca[_0xc1ec('0x78')]=_[_0xc1ec('0x33')](_0x44926e,{'id':_0x71001e['id']})[_0xc1ec('0x78')];});return _0x71001e[_0xc1ec('0x73')];});return db[_0xc1ec('0x3b')][_0xc1ec('0x33')]({'where':{'id':_0x1b13b8[_0xc1ec('0x51')]['id']}})[_0xc1ec('0x2b')](function(_0x4c0060){return db[_0xc1ec('0x79')]['transaction'](function(_0x30add5){return _0x4c0060[_0xc1ec('0x7a')](_0x426363,{'transaction':_0x30add5})[_0xc1ec('0x2b')](function(){return BPromise[_0xc1ec('0x7b')](_0x44926e,function(_0x4c6b76){return db[_0xc1ec('0x7c')][_0xc1ec('0x7d')]({'TeamId':_0x4c6b76['id'],'VoiceQueueId':_0x1b13b8[_0xc1ec('0x51')]['id'],'penalty':_0x4c6b76[_0xc1ec('0x78')]},{'transaction':_0x30add5});});})[_0xc1ec('0x2b')](function(){return BPromise[_0xc1ec('0x7b')](_0xa67efa,function(_0x5d7066){return db[_0xc1ec('0x7e')][_0xc1ec('0x7f')]({'where':{'UserId':_0x5d7066['id'],'VoiceQueueId':_0x1b13b8[_0xc1ec('0x51')]['id']},'defaults':{'penalty':_0x5d7066[_0xc1ec('0x78')]},'transaction':_0x30add5});});})['then'](function(){return BPromise[_0xc1ec('0x7b')](_['filter'](_0xa67efa,{'online':!![]}),function(_0x9888c6){return db[_0xc1ec('0x80')][_0xc1ec('0x7d')]({'membername':_0x9888c6[_0xc1ec('0x34')],'UserId':_0x9888c6['id'],'queue_name':_0x4c0060[_0xc1ec('0x34')],'VoiceQueueId':_0x4c0060['id'],'interface':_['isNil'](_0x9888c6[_0xc1ec('0x81')])?util[_0xc1ec('0x82')](_0xc1ec('0x83'),_0x9888c6[_0xc1ec('0x34')]):_0x9888c6[_0xc1ec('0x81')],'paused':_0x9888c6[_0xc1ec('0x75')]||![],'penalty':_0x9888c6['penalty']},{'transaction':_0x30add5});});})['then'](function(){_0xa67efa[_0xc1ec('0x77')](function(_0x167488){socket['emit'](_0xc1ec('0x84'),{'UserId':_0x167488['id'],'VoiceQueueId':_0x4c0060['id']});});});});});}})[_0xc1ec('0x2b')](respondWithStatusCode(_0x8da59d,null))[_0xc1ec('0x53')](handleError(_0x8da59d,null));};exports[_0xc1ec('0x85')]=function(_0x5f29aa,_0x11de71,_0x4cb44b){return db['Team']['findAll']({'where':{'id':_0x5f29aa[_0xc1ec('0x40')][_0xc1ec('0x86')]},'attributes':['id'],'include':[{'model':db[_0xc1ec('0x72')],'as':_0xc1ec('0x73'),'attributes':['id'],'raw':!![]}]})[_0xc1ec('0x2b')](handleEntityNotFound(_0x11de71,null))[_0xc1ec('0x2b')](function(_0x17c9d3){var _0x196663=_[_0xc1ec('0x31')](_0x17c9d3,'id');var _0x340960=[];var _0x57dd6c=[];var _0x12a669=squel[_0xc1ec('0x87')]();_0x12a669[_0xc1ec('0x88')](_0xc1ec('0x89'))['from'](_0xc1ec('0x8a'),'tq')[_0xc1ec('0x8b')]('user_has_teams','ut',_0xc1ec('0x8c'))[_0xc1ec('0x49')]('VoiceQueueId\x20=\x20?',_0x5f29aa[_0xc1ec('0x51')]['id']);for(var _0x3f0003=0x0;_0x3f0003<_0x17c9d3[_0xc1ec('0x45')];_0x3f0003+=0x1){let _0x504f1f=_0x17c9d3[_0x3f0003];for(var _0x15377c=0x0;_0x15377c<_0x504f1f[_0xc1ec('0x73')]['length'];_0x15377c+=0x1){let _0x2f69e8=_0x504f1f[_0xc1ec('0x73')][_0x15377c];var _0x168bfe=_0x12a669['clone']();_0x168bfe[_0xc1ec('0x49')](_0xc1ec('0x8d'),_0x2f69e8['id']);_0x57dd6c['push'](db['sequelize'][_0xc1ec('0x40')](_0x168bfe[_0xc1ec('0x8e')](),{'type':db[_0xc1ec('0x79')][_0xc1ec('0x8f')][_0xc1ec('0x90')]})[_0xc1ec('0x2b')](function(_0x2166a9){if(_0x2166a9[_0xc1ec('0x45')]===0x1){return _0x2f69e8['id'];}else{var _0x5c4013=_[_0xc1ec('0x91')](_['map'](_0x2166a9,_0xc1ec('0x92')),function(_0x592902){return _['includes'](_0x196663,_0x592902);});if(_0x5c4013){return _0x2f69e8['id'];}}}));}}return BPromise['all'](_0x57dd6c)['then'](function(_0x166046){_0x340960=_(_0x340960)['union'](_0x166046)[_0xc1ec('0x93')]()['value']();return db[_0xc1ec('0x3b')][_0xc1ec('0x33')]({'where':{'id':_0x5f29aa[_0xc1ec('0x51')]['id']}})[_0xc1ec('0x2b')](function(_0x5cb066){return db[_0xc1ec('0x79')][_0xc1ec('0x94')](function(_0x1c6873){return _0x5cb066[_0xc1ec('0x85')](_0x5f29aa[_0xc1ec('0x40')][_0xc1ec('0x86')],{'transaction':_0x1c6873})[_0xc1ec('0x2b')](function(){if(!_[_0xc1ec('0x95')](_0x340960)){return _0x5cb066[_0xc1ec('0x96')](_0x340960,{'transaction':_0x1c6873})[_0xc1ec('0x2b')](function(){return db[_0xc1ec('0x80')]['destroy']({'where':{'VoiceQueueId':_0x5f29aa[_0xc1ec('0x51')]['id'],'UserId':_0x340960},'transaction':_0x1c6873});});}})['then'](function(){_0x340960[_0xc1ec('0x77')](function(_0x26ef66){socket[_0xc1ec('0x97')](_0xc1ec('0x98'),{'UserId':_0x26ef66,'VoiceQueueId':_0x5cb066['id']});});});});});});})[_0xc1ec('0x2b')](respondWithStatusCode(_0x11de71,null))[_0xc1ec('0x53')](handleError(_0x11de71,null));};exports[_0xc1ec('0x99')]=function(_0x3a01cd,_0x32b09f,_0x1adfe7){var _0x5772fd,_0x5a3a72;return db[_0xc1ec('0x3b')][_0xc1ec('0x33')]({'where':{'id':_0x3a01cd[_0xc1ec('0x51')]['id']}})[_0xc1ec('0x2b')](handleEntityNotFound(_0x32b09f,null))['then'](function(_0x512e1b){if(_0x512e1b){_0x5a3a72=_0x512e1b;return _0x512e1b[_0xc1ec('0x99')](_0x3a01cd[_0xc1ec('0x55')]['ids'],_[_0xc1ec('0x61')](_0x3a01cd[_0xc1ec('0x55')],[_0xc1ec('0x86'),'id'])||{})['spread'](function(_0x9bcbe0){for(var _0x40311f=0x0;_0x40311f<_0x3a01cd[_0xc1ec('0x55')][_0xc1ec('0x86')][_0xc1ec('0x45')];_0x40311f+=0x1){socket[_0xc1ec('0x97')](_0xc1ec('0x84'),{'UserId':Number(_0x3a01cd['body'][_0xc1ec('0x86')][_0x40311f]),'VoiceQueueId':Number(_0x3a01cd[_0xc1ec('0x51')]['id'])});}return _0x9bcbe0;});}})['then'](function(_0x6aa016){_0x5772fd=_0x6aa016||[];if(_0x5a3a72){return db['User'][_0xc1ec('0x4e')]({'where':{'id':_0x3a01cd[_0xc1ec('0x55')]['ids']},'attributes':['id',_0xc1ec('0x34'),_0xc1ec('0x74'),_0xc1ec('0x75'),_0xc1ec('0x81')],'raw':!![]});}})[_0xc1ec('0x2b')](function(_0x43b2ce){if(!_[_0xc1ec('0x95')](_0x43b2ce)){var _0x2978c7=[];for(var _0x14adb9=0x0;_0x14adb9<_0x43b2ce[_0xc1ec('0x45')];_0x14adb9++){if(_0x43b2ce[_0x14adb9][_0xc1ec('0x74')]){_0x2978c7[_0xc1ec('0x9a')](db[_0xc1ec('0x80')][_0xc1ec('0x7d')]({'membername':_0x43b2ce[_0x14adb9][_0xc1ec('0x34')],'UserId':_0x43b2ce[_0x14adb9]['id'],'queue_name':_0x5a3a72['name'],'VoiceQueueId':_0x5a3a72['id'],'interface':_[_0xc1ec('0x9b')](_0x43b2ce[_0x14adb9]['interface'])?util['format'](_0xc1ec('0x83'),_0x43b2ce[_0x14adb9]['name']):_0x43b2ce[_0x14adb9][_0xc1ec('0x81')],'paused':_0x43b2ce[_0x14adb9][_0xc1ec('0x75')]||![],'penalty':_0x3a01cd[_0xc1ec('0x55')]['penalty']||0x0}));}}return BPromise[_0xc1ec('0x9c')](_0x2978c7);}})[_0xc1ec('0x2b')](function(){return _0x5772fd;})[_0xc1ec('0x2b')](respondWithResult(_0x32b09f,null))['catch'](handleError(_0x32b09f,null));};exports['removeAgents']=function(_0x10ad21,_0x594013,_0x4cf393){return db[_0xc1ec('0x3b')]['find']({'where':{'id':_0x10ad21[_0xc1ec('0x51')]['id']}})[_0xc1ec('0x2b')](handleEntityNotFound(_0x594013,null))[_0xc1ec('0x2b')](function(_0x21d375){if(_0x21d375){return _0x21d375['removeAgents'](_0x10ad21[_0xc1ec('0x40')][_0xc1ec('0x86')])[_0xc1ec('0x2b')](function(){if(_[_0xc1ec('0x9d')](_0x10ad21[_0xc1ec('0x40')]['ids'])){for(var _0x4a289c=0x0;_0x4a289c<_0x10ad21[_0xc1ec('0x40')]['ids'][_0xc1ec('0x45')];_0x4a289c+=0x1){socket[_0xc1ec('0x97')]('userVoiceQueue:remove',{'UserId':Number(_0x10ad21['query']['ids'][_0x4a289c]),'VoiceQueueId':Number(_0x10ad21[_0xc1ec('0x51')]['id'])});}}else{socket[_0xc1ec('0x97')](_0xc1ec('0x98'),{'UserId':Number(_0x10ad21[_0xc1ec('0x40')][_0xc1ec('0x86')]),'VoiceQueueId':Number(_0x10ad21[_0xc1ec('0x51')]['id'])});}});}})[_0xc1ec('0x2b')](function(_0x4df86b){return db[_0xc1ec('0x80')][_0xc1ec('0x2c')]({'where':{'VoiceQueueId':_0x10ad21[_0xc1ec('0x51')]['id'],'UserId':_0x10ad21['query']['ids']}})[_0xc1ec('0x2b')](function(){return _0x4df86b;});})[_0xc1ec('0x2b')](respondWithStatusCode(_0x594013,null))[_0xc1ec('0x53')](handleError(_0x594013,null));};exports[_0xc1ec('0x9e')]=function(_0x1073e5,_0x4f2770,_0x4549bc){var _0x84366c={};var _0x3a4687={};var _0x40629c;var _0x189db5;return db[_0xc1ec('0x3b')][_0xc1ec('0x63')]({'where':{'id':_0x1073e5[_0xc1ec('0x51')]['id']}})[_0xc1ec('0x2b')](handleEntityNotFound(_0x4f2770,null))[_0xc1ec('0x2b')](function(_0x40a63b){if(_0x40a63b){_0x40629c=_0x40a63b;_0x3a4687[_0xc1ec('0x3f')]=_['keys'](db['User']['rawAttributes']);_0x3a4687['query']=_['keys'](_0x1073e5[_0xc1ec('0x40')]);_0x3a4687['filters']=_[_0xc1ec('0x42')](_0x3a4687[_0xc1ec('0x3f')],_0x3a4687[_0xc1ec('0x40')]);_0x84366c[_0xc1ec('0x43')]=_[_0xc1ec('0x42')](_0x3a4687[_0xc1ec('0x3f')],qs[_0xc1ec('0x44')](_0x1073e5[_0xc1ec('0x40')]['fields']));_0x84366c['attributes']=_0x84366c[_0xc1ec('0x43')]['length']?_0x84366c[_0xc1ec('0x43')]:_0x3a4687[_0xc1ec('0x3f')];_0x84366c[_0xc1ec('0x47')]=qs['sort'](_0x1073e5[_0xc1ec('0x40')][_0xc1ec('0x48')]);_0x84366c['where']=qs['filters'](_['pick'](_0x1073e5[_0xc1ec('0x40')],_0x3a4687[_0xc1ec('0x41')]));if(_0x1073e5['query'][_0xc1ec('0x30')]){_0x84366c[_0xc1ec('0x49')]=_[_0xc1ec('0x4a')](_0x84366c['where'],{'$or':_[_0xc1ec('0x31')](_0x84366c[_0xc1ec('0x43')],function(_0x48811e){var _0x29aaf1={};_0x29aaf1[_0x48811e]={'$like':'%'+_0x1073e5[_0xc1ec('0x40')][_0xc1ec('0x30')]+'%'};return _0x29aaf1;})});}_0x84366c=_['merge']({},_0x84366c,_0x1073e5['options']);return _0x40629c[_0xc1ec('0x9e')](_0x84366c);}})[_0xc1ec('0x2b')](function(_0x135c14){if(_0x135c14){_0x189db5=_0x135c14[_0xc1ec('0x45')];if(!_0x1073e5['query']['hasOwnProperty']('nolimit')){_0x84366c['limit']=qs[_0xc1ec('0x24')](_0x1073e5[_0xc1ec('0x40')][_0xc1ec('0x24')]);_0x84366c[_0xc1ec('0x21')]=qs[_0xc1ec('0x21')](_0x1073e5['query'][_0xc1ec('0x21')]);}return _0x40629c[_0xc1ec('0x9e')](_0x84366c);}})[_0xc1ec('0x2b')](function(_0x560316){if(_0x560316){return _0x560316?{'count':_0x189db5,'rows':_0x560316}:null;}})[_0xc1ec('0x2b')](respondWithResult(_0x4f2770,null))[_0xc1ec('0x53')](handleError(_0x4f2770,null));};exports[_0xc1ec('0x9f')]=function(_0x4ddf43,_0x33e537,_0x4c5748){var _0x130bc3={};var _0x1e29ed={};var _0x1263ea;var _0x30343e;return db[_0xc1ec('0x3b')][_0xc1ec('0x63')]({'where':{'id':_0x4ddf43['params']['id']}})[_0xc1ec('0x2b')](handleEntityNotFound(_0x33e537,null))['then'](function(_0x1e0252){if(_0x1e0252){_0x1263ea=_0x1e0252;_0x1e29ed[_0xc1ec('0x3f')]=_[_0xc1ec('0x5f')](db[_0xc1ec('0x80')][_0xc1ec('0x52')]);_0x1e29ed[_0xc1ec('0x40')]=_['keys'](_0x4ddf43['query']);_0x1e29ed[_0xc1ec('0x41')]=_['intersection'](_0x1e29ed[_0xc1ec('0x3f')],_0x1e29ed[_0xc1ec('0x40')]);_0x130bc3['attributes']=_['intersection'](_0x1e29ed[_0xc1ec('0x3f')],qs[_0xc1ec('0x44')](_0x4ddf43[_0xc1ec('0x40')]['fields']));_0x130bc3[_0xc1ec('0x43')]=_0x130bc3[_0xc1ec('0x43')][_0xc1ec('0x45')]?_0x130bc3[_0xc1ec('0x43')]:_0x1e29ed[_0xc1ec('0x3f')];_0x130bc3[_0xc1ec('0x47')]=qs['sort'](_0x4ddf43['query']['sort']);_0x130bc3[_0xc1ec('0x49')]=qs[_0xc1ec('0x41')](_[_0xc1ec('0x66')](_0x4ddf43[_0xc1ec('0x40')],_0x1e29ed[_0xc1ec('0x41')]));if(_0x4ddf43[_0xc1ec('0x40')][_0xc1ec('0x30')]){_0x130bc3[_0xc1ec('0x49')]=_[_0xc1ec('0x4a')](_0x130bc3['where'],{'$or':_['map'](_0x130bc3['attributes'],function(_0x491595){var _0x3019cc={};_0x3019cc[_0x491595]={'$like':'%'+_0x4ddf43[_0xc1ec('0x40')][_0xc1ec('0x30')]+'%'};return _0x3019cc;})});}_0x130bc3=_[_0xc1ec('0x4a')]({},_0x130bc3,_0x4ddf43[_0xc1ec('0x68')]);return _0x1263ea[_0xc1ec('0x9f')](_0x130bc3);}})[_0xc1ec('0x2b')](function(_0x2e259e){if(_0x2e259e){_0x30343e=_0x2e259e['length'];if(!_0x4ddf43['query'][_0xc1ec('0x65')]('nolimit')){_0x130bc3['limit']=qs['limit'](_0x4ddf43[_0xc1ec('0x40')]['limit']);_0x130bc3[_0xc1ec('0x21')]=qs[_0xc1ec('0x21')](_0x4ddf43[_0xc1ec('0x40')][_0xc1ec('0x21')]);}return _0x1263ea[_0xc1ec('0x9f')](_0x130bc3);}})[_0xc1ec('0x2b')](function(_0x18b929){return _0x18b929?{'count':_0x30343e,'rows':_0x18b929}:null;})[_0xc1ec('0x2b')](respondWithResult(_0x33e537,null))[_0xc1ec('0x53')](handleError(_0x33e537,null));};exports['getLists']=function(_0x42d99c,_0x3e2d16,_0x3f01cb){var _0x10c837={};var _0x3547e8={};var _0x1e9851;var _0x5194b9;return db[_0xc1ec('0x3b')][_0xc1ec('0x63')]({'where':{'id':_0x42d99c[_0xc1ec('0x51')]['id']}})['then'](handleEntityNotFound(_0x3e2d16,null))[_0xc1ec('0x2b')](function(_0xf570b6){if(_0xf570b6){_0x1e9851=_0xf570b6;_0x3547e8['model']=_[_0xc1ec('0x5f')](db[_0xc1ec('0xa0')][_0xc1ec('0x52')]);_0x3547e8[_0xc1ec('0x40')]=_[_0xc1ec('0x5f')](_0x42d99c[_0xc1ec('0x40')]);_0x3547e8[_0xc1ec('0x41')]=_[_0xc1ec('0x42')](_0x3547e8[_0xc1ec('0x3f')],_0x3547e8[_0xc1ec('0x40')]);_0x10c837[_0xc1ec('0x43')]=_[_0xc1ec('0x42')](_0x3547e8[_0xc1ec('0x3f')],qs[_0xc1ec('0x44')](_0x42d99c['query']['fields']));_0x10c837[_0xc1ec('0x43')]=_0x10c837[_0xc1ec('0x43')][_0xc1ec('0x45')]?_0x10c837[_0xc1ec('0x43')]:_0x3547e8[_0xc1ec('0x3f')];_0x10c837[_0xc1ec('0x47')]=qs[_0xc1ec('0x48')](_0x42d99c[_0xc1ec('0x40')][_0xc1ec('0x48')]);_0x10c837[_0xc1ec('0x49')]=qs[_0xc1ec('0x41')](_[_0xc1ec('0x66')](_0x42d99c[_0xc1ec('0x40')],_0x3547e8[_0xc1ec('0x41')]));if(_0x42d99c[_0xc1ec('0x40')]['filter']){_0x10c837['where']=_[_0xc1ec('0x4a')](_0x10c837['where'],{'$or':_[_0xc1ec('0x31')](_0x10c837[_0xc1ec('0x43')],function(_0x3d04fa){var _0x1c02f8={};_0x1c02f8[_0x3d04fa]={'$like':'%'+_0x42d99c['query']['filter']+'%'};return _0x1c02f8;})});}_0x10c837=_[_0xc1ec('0x4a')]({},_0x10c837,_0x42d99c['options']);return _0x1e9851[_0xc1ec('0xa1')](_0x10c837);}})[_0xc1ec('0x2b')](function(_0x3aa378){if(_0x3aa378){_0x5194b9=_0x3aa378[_0xc1ec('0x45')];if(!_0x42d99c[_0xc1ec('0x40')][_0xc1ec('0x65')](_0xc1ec('0x46'))){_0x10c837[_0xc1ec('0x24')]=qs['limit'](_0x42d99c['query'][_0xc1ec('0x24')]);_0x10c837[_0xc1ec('0x21')]=qs[_0xc1ec('0x21')](_0x42d99c[_0xc1ec('0x40')][_0xc1ec('0x21')]);}return _0x1e9851[_0xc1ec('0xa1')](_0x10c837);}})[_0xc1ec('0x2b')](function(_0x16e914){if(_0x16e914){return _0x16e914?{'count':_0x5194b9,'rows':_0x16e914}:null;}})[_0xc1ec('0x2b')](respondWithResult(_0x3e2d16,null))[_0xc1ec('0x53')](handleError(_0x3e2d16,null));};exports[_0xc1ec('0xa2')]=function(_0x4595ba,_0x44a1a3,_0x2648ff){var _0x513e57,_0x203604;return db['VoiceQueue'][_0xc1ec('0x33')]({'where':{'id':_0x4595ba[_0xc1ec('0x51')]['id']}})[_0xc1ec('0x2b')](handleEntityNotFound(_0x44a1a3,null))[_0xc1ec('0x2b')](function(_0x100f00){if(_0x100f00){_0x203604=_0x100f00;return _0x100f00[_0xc1ec('0xa2')](_0x4595ba[_0xc1ec('0x55')]['ids'],_['omit'](_0x4595ba[_0xc1ec('0x55')],[_0xc1ec('0x86'),'id'])||{});}return null;})[_0xc1ec('0xa3')](function(_0x483d62){var _0x1d38e8;_0x513e57=_0x483d62||[];var _0x3526cd=[];if(_0x483d62){for(var _0x43081e=0x0;_0x43081e<_0x483d62[_0xc1ec('0x45')];_0x43081e+=0x1){var _0x1ce437=_0x483d62[_0x43081e][_0xc1ec('0x2d')]({'plain':!![]});_0x203604[_0xc1ec('0xa4')]=_0x4595ba[_0xc1ec('0x55')][_0xc1ec('0xa4')]?_0x4595ba[_0xc1ec('0x55')]['dialCheckDuplicateType']:_0x203604['dialCheckDuplicateType'];switch(_0x203604[_0xc1ec('0xa4')]){case _0xc1ec('0xa5'):_0x1d38e8=squel[_0xc1ec('0xa6')]()['into'](_0xc1ec('0xa7'))[_0xc1ec('0xa8')](['phone','scheduledAt',_0xc1ec('0xa9'),_0xc1ec('0xaa'),_0xc1ec('0x67'),_0xc1ec('0x62'),_0xc1ec('0x60')],squel['select']()[_0xc1ec('0x88')](_0xc1ec('0xab'),_0xc1ec('0xab'))[_0xc1ec('0x88')]('NOW()',_0xc1ec('0xac'))[_0xc1ec('0x88')]('id',_0xc1ec('0xa9'))[_0xc1ec('0x88')](_0x1ce437[_0xc1ec('0xad')][_0xc1ec('0x8e')](),_0xc1ec('0xaa'))[_0xc1ec('0x88')](_0x4595ba['params']['id']['toString'](),_0xc1ec('0x67'))[_0xc1ec('0x88')]('NOW()',_0xc1ec('0x62'))[_0xc1ec('0x88')](_0xc1ec('0xae'),'updatedAt')[_0xc1ec('0xaf')](_0xc1ec('0xb0'))['where']('deletedAt\x20IS\x20NULL')[_0xc1ec('0x49')](_0xc1ec('0xb1'),_0x1ce437[_0xc1ec('0xad')][_0xc1ec('0x8e')]())[_0xc1ec('0x49')](_0xc1ec('0xb2'))[_0xc1ec('0x49')](_0xc1ec('0xb3'),squel[_0xc1ec('0x87')]()[_0xc1ec('0x88')](_0xc1ec('0xb4'))[_0xc1ec('0xaf')]('cm_hopper_final')[_0xc1ec('0x49')](_0xc1ec('0xb5'),_0x4595ba[_0xc1ec('0x51')]['id']['toString']()))[_0xc1ec('0x49')](_0xc1ec('0xb3'),squel['select']()[_0xc1ec('0x88')](_0xc1ec('0xb6'))[_0xc1ec('0xaf')](_0xc1ec('0xa7'))[_0xc1ec('0x49')]('VoiceQueueId\x20=\x20?',_0x4595ba[_0xc1ec('0x51')]['id'][_0xc1ec('0x8e')]())))[_0xc1ec('0x8e')]();break;case _0xc1ec('0xb7'):_0x1d38e8=squel[_0xc1ec('0xa6')]()[_0xc1ec('0xb8')](_0xc1ec('0xa7'))[_0xc1ec('0xa8')]([_0xc1ec('0xab'),_0xc1ec('0xac'),_0xc1ec('0xa9'),'ListId',_0xc1ec('0x67'),'createdAt',_0xc1ec('0x60')],squel['select']()[_0xc1ec('0x88')](_0xc1ec('0xab'),_0xc1ec('0xab'))[_0xc1ec('0x88')](_0xc1ec('0xae'),_0xc1ec('0xac'))[_0xc1ec('0x88')]('id',_0xc1ec('0xa9'))[_0xc1ec('0x88')](_0x1ce437[_0xc1ec('0xad')][_0xc1ec('0x8e')](),'ListId')[_0xc1ec('0x88')](_0x4595ba[_0xc1ec('0x51')]['id'][_0xc1ec('0x8e')](),_0xc1ec('0x67'))['field'](_0xc1ec('0xae'),_0xc1ec('0x62'))[_0xc1ec('0x88')]('NOW()',_0xc1ec('0x60'))[_0xc1ec('0xaf')](_0xc1ec('0xb0'))[_0xc1ec('0x49')]('deletedAt\x20IS\x20NULL')[_0xc1ec('0x49')](_0xc1ec('0xb1'),_0x1ce437[_0xc1ec('0xad')][_0xc1ec('0x8e')]())[_0xc1ec('0x49')]('phone\x20IS\x20NOT\x20NULL')[_0xc1ec('0x49')](_0xc1ec('0xb3'),squel[_0xc1ec('0x87')]()[_0xc1ec('0x88')](_0xc1ec('0xb6'))['from'](_0xc1ec('0xa7'))['where'](_0xc1ec('0xb5'),_0x4595ba[_0xc1ec('0x51')]['id'][_0xc1ec('0x8e')]())))[_0xc1ec('0x8e')]();break;default:_0x1d38e8=squel[_0xc1ec('0xa6')]()[_0xc1ec('0xb8')]('cm_hopper')['fromQuery'](['phone',_0xc1ec('0xac'),_0xc1ec('0xa9'),_0xc1ec('0xaa'),'VoiceQueueId',_0xc1ec('0x62'),_0xc1ec('0x60')],squel[_0xc1ec('0x87')]()[_0xc1ec('0x88')]('phone',_0xc1ec('0xab'))[_0xc1ec('0x88')]('NOW()','scheduledAt')[_0xc1ec('0x88')]('id','ContactId')[_0xc1ec('0x88')](_0x1ce437[_0xc1ec('0xad')]['toString'](),_0xc1ec('0xaa'))[_0xc1ec('0x88')](_0x4595ba[_0xc1ec('0x51')]['id']['toString'](),_0xc1ec('0x67'))[_0xc1ec('0x88')](_0xc1ec('0xae'),_0xc1ec('0x62'))[_0xc1ec('0x88')](_0xc1ec('0xae'),_0xc1ec('0x60'))['from']('cm_contacts')['where'](_0xc1ec('0xb9'))[_0xc1ec('0x49')]('ListId\x20=\x20?',_0x1ce437[_0xc1ec('0xad')][_0xc1ec('0x8e')]())[_0xc1ec('0x49')](_0xc1ec('0xb2')))[_0xc1ec('0x8e')]();}_0x3526cd[_0xc1ec('0x9a')](db['sequelize'][_0xc1ec('0x40')](_0x1d38e8));}return BPromise['all'](_0x3526cd);}})[_0xc1ec('0x2b')](function(){return _0x513e57;})[_0xc1ec('0x2b')](respondWithResult(_0x44a1a3,null))['catch'](handleError(_0x44a1a3,null));};exports[_0xc1ec('0xba')]=function(_0x2e74b2,_0x589d17,_0x46c1ba){return db[_0xc1ec('0x3b')][_0xc1ec('0x33')]({'where':{'id':_0x2e74b2['params']['id']}})['then'](handleEntityNotFound(_0x589d17,null))['then'](function(_0x3f9494){if(_0x3f9494){return _0x3f9494[_0xc1ec('0xba')](_0x2e74b2[_0xc1ec('0x40')]['ids']);}})[_0xc1ec('0x2b')](function(_0xfc1bbc){if(_0xfc1bbc){return db[_0xc1ec('0x64')]['destroy']({'where':{'ListId':_0x2e74b2['query']['ids'],'VoiceQueueId':_0x2e74b2['params']['id']}})[_0xc1ec('0x2b')](function(){return _0xfc1bbc;});}})['then'](respondWithStatusCode(_0x589d17,null))[_0xc1ec('0x53')](handleError(_0x589d17,null));};exports[_0xc1ec('0xbb')]=function(_0x3c118b,_0x2dc291,_0xde78d0){var _0x3d1e59={};var _0x45082e={};var _0x523ad4;var _0x44a856;return db[_0xc1ec('0x3b')][_0xc1ec('0x63')]({'where':{'id':_0x3c118b['params']['id']}})[_0xc1ec('0x2b')](handleEntityNotFound(_0x2dc291,null))['then'](function(_0x46e6b9){if(_0x46e6b9){_0x523ad4=_0x46e6b9;_0x45082e[_0xc1ec('0x3f')]=_['keys'](db[_0xc1ec('0xa0')][_0xc1ec('0x52')]);_0x45082e['query']=_[_0xc1ec('0x5f')](_0x3c118b[_0xc1ec('0x40')]);_0x45082e[_0xc1ec('0x41')]=_['intersection'](_0x45082e[_0xc1ec('0x3f')],_0x45082e[_0xc1ec('0x40')]);_0x3d1e59[_0xc1ec('0x43')]=_[_0xc1ec('0x42')](_0x45082e[_0xc1ec('0x3f')],qs['fields'](_0x3c118b[_0xc1ec('0x40')][_0xc1ec('0x44')]));_0x3d1e59[_0xc1ec('0x43')]=_0x3d1e59[_0xc1ec('0x43')]['length']?_0x3d1e59[_0xc1ec('0x43')]:_0x45082e[_0xc1ec('0x3f')];_0x3d1e59[_0xc1ec('0x47')]=qs[_0xc1ec('0x48')](_0x3c118b[_0xc1ec('0x40')][_0xc1ec('0x48')]);_0x3d1e59['where']=qs[_0xc1ec('0x41')](_[_0xc1ec('0x66')](_0x3c118b[_0xc1ec('0x40')],_0x45082e[_0xc1ec('0x41')]));if(_0x3c118b[_0xc1ec('0x40')][_0xc1ec('0x30')]){_0x3d1e59[_0xc1ec('0x49')]=_[_0xc1ec('0x4a')](_0x3d1e59[_0xc1ec('0x49')],{'$or':_[_0xc1ec('0x31')](_0x3d1e59[_0xc1ec('0x43')],function(_0x78dfd5){var _0x29be15={};_0x29be15[_0x78dfd5]={'$like':'%'+_0x3c118b[_0xc1ec('0x40')][_0xc1ec('0x30')]+'%'};return _0x29be15;})});}_0x3d1e59=_['merge']({},_0x3d1e59,_0x3c118b[_0xc1ec('0x68')]);return _0x523ad4[_0xc1ec('0xbb')](_0x3d1e59);}})[_0xc1ec('0x2b')](function(_0x3a8cf4){if(_0x3a8cf4){_0x44a856=_0x3a8cf4[_0xc1ec('0x45')];if(!_0x3c118b['query'][_0xc1ec('0x65')](_0xc1ec('0x46'))){_0x3d1e59[_0xc1ec('0x24')]=qs[_0xc1ec('0x24')](_0x3c118b[_0xc1ec('0x40')][_0xc1ec('0x24')]);_0x3d1e59[_0xc1ec('0x21')]=qs[_0xc1ec('0x21')](_0x3c118b['query'][_0xc1ec('0x21')]);}return _0x523ad4[_0xc1ec('0xbb')](_0x3d1e59);}})[_0xc1ec('0x2b')](function(_0x46a386){if(_0x46a386){return _0x46a386?{'count':_0x44a856,'rows':_0x46a386}:null;}})[_0xc1ec('0x2b')](respondWithResult(_0x2dc291,null))[_0xc1ec('0x53')](handleError(_0x2dc291,null));};exports[_0xc1ec('0xbc')]=function(_0x576d15,_0x54e997,_0x22717d){var _0x1af335,_0x3a6ad3;return db['VoiceQueue'][_0xc1ec('0x33')]({'where':{'id':_0x576d15[_0xc1ec('0x51')]['id']}})[_0xc1ec('0x2b')](handleEntityNotFound(_0x54e997,null))[_0xc1ec('0x2b')](function(_0x4c59ff){if(_0x4c59ff){_0x3a6ad3=_0x4c59ff;return _0x4c59ff[_0xc1ec('0xbc')](_0x576d15[_0xc1ec('0x55')][_0xc1ec('0x86')],_[_0xc1ec('0x61')](_0x576d15['body'],[_0xc1ec('0x86'),'id'])||{});}return null;})[_0xc1ec('0xa3')](function(_0x4d26c5){var _0x543ceb;_0x1af335=_0x4d26c5||[];var _0x5e9dbf=[];if(_0x4d26c5){for(var _0x358e65=0x0;_0x358e65<_0x4d26c5[_0xc1ec('0x45')];_0x358e65+=0x1){var _0x4381b7=_0x4d26c5[_0x358e65][_0xc1ec('0x2d')]({'plain':!![]});_0x543ceb=squel[_0xc1ec('0xa6')]()[_0xc1ec('0xb8')](_0xc1ec('0xbd'))['fromQuery']([_0xc1ec('0xab'),'ContactId','ListId',_0xc1ec('0x67'),_0xc1ec('0x62'),_0xc1ec('0x60')],squel[_0xc1ec('0x87')]()[_0xc1ec('0x88')]('phone','phone')[_0xc1ec('0x88')]('id',_0xc1ec('0xa9'))[_0xc1ec('0x88')](_0x4381b7['CmListId'][_0xc1ec('0x8e')](),_0xc1ec('0xaa'))[_0xc1ec('0x88')](_0x576d15[_0xc1ec('0x51')]['id']['toString'](),_0xc1ec('0x67'))[_0xc1ec('0x88')](_0xc1ec('0xae'),'createdAt')[_0xc1ec('0x88')](_0xc1ec('0xae'),_0xc1ec('0x60'))[_0xc1ec('0xaf')](_0xc1ec('0xb0'))[_0xc1ec('0x49')](_0xc1ec('0xb9'))[_0xc1ec('0x49')](_0xc1ec('0xb1'),_0x4381b7[_0xc1ec('0xad')][_0xc1ec('0x8e')]())['where'](_0xc1ec('0xb2')))[_0xc1ec('0x8e')]();_0x5e9dbf[_0xc1ec('0x9a')](db[_0xc1ec('0x79')][_0xc1ec('0x40')](_0x543ceb));}return BPromise[_0xc1ec('0x9c')](_0x5e9dbf);}})['then'](function(){return _0x1af335;})[_0xc1ec('0x2b')](respondWithResult(_0x54e997,null))['catch'](handleError(_0x54e997,null));};exports[_0xc1ec('0xbe')]=function(_0x5b5948,_0x143133,_0x2f27b9){return db['VoiceQueue'][_0xc1ec('0x33')]({'where':{'id':_0x5b5948[_0xc1ec('0x51')]['id']}})[_0xc1ec('0x2b')](handleEntityNotFound(_0x143133,null))['then'](function(_0xc329bc){if(_0xc329bc){return _0xc329bc[_0xc1ec('0xbe')](_0x5b5948[_0xc1ec('0x40')]['ids']);}})[_0xc1ec('0x2b')](function(_0x179228){if(_0x179228){return db[_0xc1ec('0x6e')][_0xc1ec('0x2c')]({'where':{'ListId':_0x5b5948[_0xc1ec('0x40')][_0xc1ec('0x86')],'VoiceQueueId':_0x5b5948[_0xc1ec('0x51')]['id']}})[_0xc1ec('0x2b')](function(){return _0x179228;});}})[_0xc1ec('0x2b')](respondWithStatusCode(_0x143133,null))[_0xc1ec('0x53')](handleError(_0x143133,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 6a4e136..63fa170 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 _0x8ca4=['events','../../mysqldb','VoiceQueue','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x8ca4,0x1f4));var _0x48ca=function(_0xe36749,_0x2a45c8){_0xe36749=_0xe36749-0x0;var _0x5d86b7=_0x8ca4[_0xe36749];return _0x5d86b7;};'use strict';var EventEmitter=require(_0x48ca('0x0'));var VoiceQueue=require(_0x48ca('0x1'))['db'][_0x48ca('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x48ca('0x3'),'afterUpdate':_0x48ca('0x4'),'afterDestroy':_0x48ca('0x5')};function emitEvent(_0x2448ca){return function(_0x5b6927,_0x9b654f,_0x4bd4cf){VoiceQueueEvents[_0x48ca('0x6')](_0x2448ca+':'+_0x5b6927['id'],_0x5b6927);VoiceQueueEvents[_0x48ca('0x6')](_0x2448ca,_0x5b6927);_0x4bd4cf(null);};}for(var e in events){if(events[_0x48ca('0x7')](e)){var event=events[e];VoiceQueue[_0x48ca('0x8')](e,emitEvent(event));}}module[_0x48ca('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xa17d=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa17d,0x18c));var _0xda17=function(_0x6182ff,_0x59d492){_0x6182ff=_0x6182ff-0x0;var _0x1cec22=_0xa17d[_0x6182ff];return _0x1cec22;};'use strict';var EventEmitter=require(_0xda17('0x0'));var VoiceQueue=require(_0xda17('0x1'))['db'][_0xda17('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xda17('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xda17('0x4'),'afterDestroy':_0xda17('0x5')};function emitEvent(_0x1debed){return function(_0x3f8afc,_0x4295c8,_0x3719c6){VoiceQueueEvents[_0xda17('0x6')](_0x1debed+':'+_0x3f8afc['id'],_0x3f8afc);VoiceQueueEvents[_0xda17('0x6')](_0x1debed,_0x3f8afc);_0x3719c6(null);};}for(var e in events){if(events[_0xda17('0x7')](e)){var event=events[e];VoiceQueue[_0xda17('0x8')](e,emitEvent(event));}}module[_0xda17('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 8c3e7fa..9148ffd 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x88bffa,_0x33d157){var _0x3b61c2=function(_0x4af06c){while(--_0x4af06c){_0x88bffa['push'](_0x88bffa['shift']());}};_0x3b61c2(++_0x33d157);}(_0xedd9,0xfc));var _0x9edd=function(_0x25e010,_0x122018){_0x25e010=_0x25e010-0x0;var _0x51de4f=_0xedd9[_0x25e010];return _0x51de4f;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xdad2f9,_0x41a5ba){var _0x4d2c2c=function(_0x2d836d){while(--_0x2d836d){_0xdad2f9['push'](_0xdad2f9['shift']());}};_0x4d2c2c(++_0x41a5ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 203b69a..4ea5448 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 _0xe2e3=['../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueue','findAll','options','raw','where','map','include','model','attributes','ShowVoiceQueue','VoiceQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x19cac5,_0xb7af39){var _0x228fa2=function(_0x24dbba){while(--_0x24dbba){_0x19cac5['push'](_0x19cac5['shift']());}};_0x228fa2(++_0xb7af39);}(_0xe2e3,0x193));var _0x3e2e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xe2e3[_0xf50820];return _0x2a9b10;};'use strict';var _=require('lodash');var util=require(_0x3e2e('0x0'));var moment=require(_0x3e2e('0x1'));var BPromise=require(_0x3e2e('0x2'));var rs=require(_0x3e2e('0x3'));var fs=require('fs');var Redis=require(_0x3e2e('0x4'));var db=require(_0x3e2e('0x5'))['db'];var utils=require(_0x3e2e('0x6'));var logger=require(_0x3e2e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3e2e('0x8'));var client=jayson[_0x3e2e('0x9')][_0x3e2e('0xa')]({'port':0x232a});config[_0x3e2e('0xb')]=_[_0x3e2e('0xc')](config[_0x3e2e('0xb')],{'host':_0x3e2e('0xd'),'port':0x18eb});var socket=require(_0x3e2e('0xe'))(new Redis(config[_0x3e2e('0xb')]));require(_0x3e2e('0xf'))['register'](socket);function respondWithRpcPromise(_0x1d9857,_0x304ce6,_0x5a8f30){return new BPromise(function(_0x422581,_0xfe7beb){return client[_0x3e2e('0x10')](_0x1d9857,_0x5a8f30)[_0x3e2e('0x11')](function(_0x4bea94){logger[_0x3e2e('0x12')](_0x3e2e('0x13'),_0x304ce6,'request\x20sent');logger[_0x3e2e('0x14')](_0x3e2e('0x15'),_0x304ce6,_0x3e2e('0x16'),JSON[_0x3e2e('0x17')](_0x4bea94));if(_0x4bea94[_0x3e2e('0x18')]){if(_0x4bea94[_0x3e2e('0x18')][_0x3e2e('0x19')]===0x1f4){logger['error'](_0x3e2e('0x13'),_0x304ce6,_0x4bea94['error'][_0x3e2e('0x1a')]);return _0xfe7beb(_0x4bea94['error'][_0x3e2e('0x1a')]);}logger[_0x3e2e('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x304ce6,_0x4bea94[_0x3e2e('0x18')][_0x3e2e('0x1a')]);return _0x422581(_0x4bea94['error'][_0x3e2e('0x1a')]);}else{logger[_0x3e2e('0x12')](_0x3e2e('0x13'),_0x304ce6,_0x3e2e('0x16'));_0x422581(_0x4bea94[_0x3e2e('0x1b')][_0x3e2e('0x1a')]);}})[_0x3e2e('0x1c')](function(_0x4e92b3){logger[_0x3e2e('0x18')](_0x3e2e('0x13'),_0x304ce6,_0x4e92b3);_0xfe7beb(_0x4e92b3);});});}exports[_0x3e2e('0x1d')]=function(_0x197830){var _0x8696dc=this;return new Promise(function(_0x389346,_0x4b19bf){return db['VoiceQueue'][_0x3e2e('0x1e')]({'raw':_0x197830['options']?_0x197830[_0x3e2e('0x1f')][_0x3e2e('0x20')]===undefined?!![]:![]:!![],'where':_0x197830['options']?_0x197830['options'][_0x3e2e('0x21')]||null:null,'attributes':_0x197830[_0x3e2e('0x1f')]?_0x197830[_0x3e2e('0x1f')]['attributes']||null:null,'limit':_0x197830[_0x3e2e('0x1f')]?_0x197830[_0x3e2e('0x1f')]['limit']||null:null,'include':_0x197830[_0x3e2e('0x1f')]?_0x197830[_0x3e2e('0x1f')]['include']?_[_0x3e2e('0x22')](_0x197830[_0x3e2e('0x1f')][_0x3e2e('0x23')],function(_0x23da5){return{'model':db[_0x23da5[_0x3e2e('0x24')]],'as':_0x23da5['as'],'attributes':_0x23da5[_0x3e2e('0x25')],'include':_0x23da5[_0x3e2e('0x23')]?_['map'](_0x23da5['include'],function(_0x720088){return{'model':db[_0x720088[_0x3e2e('0x24')]],'as':_0x720088['as'],'attributes':_0x720088[_0x3e2e('0x25')],'include':_0x720088[_0x3e2e('0x23')]?_[_0x3e2e('0x22')](_0x720088[_0x3e2e('0x23')],function(_0x2fe141){return{'model':db[_0x2fe141['model']],'as':_0x2fe141['as'],'attributes':_0x2fe141[_0x3e2e('0x25')]};}):[]};}):[]};}):[]:[]})[_0x3e2e('0x11')](function(_0x52de2c){logger[_0x3e2e('0x12')](_0x3e2e('0x1d'),_0x197830);logger[_0x3e2e('0x14')](_0x3e2e('0x1d'),_0x197830,JSON['stringify'](_0x52de2c));_0x389346(_0x52de2c);})['catch'](function(_0x5215d0){logger[_0x3e2e('0x18')](_0x3e2e('0x1d'),_0x5215d0[_0x3e2e('0x1a')],_0x197830);_0x4b19bf(_0x8696dc[_0x3e2e('0x18')](0x1f4,_0x5215d0[_0x3e2e('0x1a')]));});});};exports[_0x3e2e('0x26')]=function(_0x332da2){var _0xd6b7e0=this;return new Promise(function(_0x3360e3,_0x24eff9){return db[_0x3e2e('0x27')][_0x3e2e('0x28')]({'raw':_0x332da2[_0x3e2e('0x1f')]?_0x332da2[_0x3e2e('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x332da2[_0x3e2e('0x1f')]?_0x332da2[_0x3e2e('0x1f')][_0x3e2e('0x21')]||null:null,'attributes':_0x332da2[_0x3e2e('0x1f')]?_0x332da2['options']['attributes']||null:null,'include':_0x332da2[_0x3e2e('0x1f')]?_0x332da2[_0x3e2e('0x1f')]['include']?_[_0x3e2e('0x22')](_0x332da2['options'][_0x3e2e('0x23')],function(_0x5bcf86){return{'model':db[_0x5bcf86[_0x3e2e('0x24')]],'as':_0x5bcf86['as'],'attributes':_0x5bcf86['attributes'],'include':_0x5bcf86['include']?_[_0x3e2e('0x22')](_0x5bcf86[_0x3e2e('0x23')],function(_0x310df5){return{'model':db[_0x310df5['model']],'as':_0x310df5['as'],'attributes':_0x310df5[_0x3e2e('0x25')],'include':_0x310df5[_0x3e2e('0x23')]?_[_0x3e2e('0x22')](_0x310df5[_0x3e2e('0x23')],function(_0x178f27){return{'model':db[_0x178f27[_0x3e2e('0x24')]],'as':_0x178f27['as'],'attributes':_0x178f27[_0x3e2e('0x25')]};}):[]};}):[]};}):[]:[]})[_0x3e2e('0x11')](function(_0x2558f4){logger[_0x3e2e('0x12')]('ShowVoiceQueue',_0x332da2);logger[_0x3e2e('0x14')]('ShowVoiceQueue',_0x332da2,JSON[_0x3e2e('0x17')](_0x2558f4));_0x3360e3(_0x2558f4);})[_0x3e2e('0x1c')](function(_0x1dbc8d){logger[_0x3e2e('0x18')]('ShowVoiceQueue',_0x1dbc8d['message'],_0x332da2);_0x24eff9(_0xd6b7e0['error'](0x1f4,_0x1dbc8d[_0x3e2e('0x1a')]));});});}; \ No newline at end of file +var _0x6fd9=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','include','map','model','then','debug','ShowVoiceQueue','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x171d2a,_0x483923){var _0x1fbf36=function(_0x50eb36){while(--_0x50eb36){_0x171d2a['push'](_0x171d2a['shift']());}};_0x1fbf36(++_0x483923);}(_0x6fd9,0x6d));var _0x96fd=function(_0x409f17,_0x4744b3){_0x409f17=_0x409f17-0x0;var _0x322b8c=_0x6fd9[_0x409f17];return _0x322b8c;};'use strict';var _=require(_0x96fd('0x0'));var util=require('util');var moment=require(_0x96fd('0x1'));var BPromise=require(_0x96fd('0x2'));var rs=require(_0x96fd('0x3'));var fs=require('fs');var Redis=require(_0x96fd('0x4'));var db=require(_0x96fd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x96fd('0x6'))('rpc');var config=require(_0x96fd('0x7'));var jayson=require(_0x96fd('0x8'));var client=jayson[_0x96fd('0x9')][_0x96fd('0xa')]({'port':0x232a});config[_0x96fd('0xb')]=_[_0x96fd('0xc')](config[_0x96fd('0xb')],{'host':_0x96fd('0xd'),'port':0x18eb});var socket=require(_0x96fd('0xe'))(new Redis(config[_0x96fd('0xb')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x108754,_0x2402e2,_0x22724a){return new BPromise(function(_0x5e7747,_0x49ee5c){return client[_0x96fd('0xf')](_0x108754,_0x22724a)['then'](function(_0x58bcbd){logger[_0x96fd('0x10')](_0x96fd('0x11'),_0x2402e2,_0x96fd('0x12'));logger['debug'](_0x96fd('0x13'),_0x2402e2,'request\x20sent',JSON[_0x96fd('0x14')](_0x58bcbd));if(_0x58bcbd[_0x96fd('0x15')]){if(_0x58bcbd['error']['code']===0x1f4){logger['error'](_0x96fd('0x11'),_0x2402e2,_0x58bcbd[_0x96fd('0x15')][_0x96fd('0x16')]);return _0x49ee5c(_0x58bcbd[_0x96fd('0x15')]['message']);}logger[_0x96fd('0x15')](_0x96fd('0x11'),_0x2402e2,_0x58bcbd[_0x96fd('0x15')][_0x96fd('0x16')]);return _0x5e7747(_0x58bcbd[_0x96fd('0x15')][_0x96fd('0x16')]);}else{logger[_0x96fd('0x10')](_0x96fd('0x11'),_0x2402e2,_0x96fd('0x12'));_0x5e7747(_0x58bcbd[_0x96fd('0x17')][_0x96fd('0x16')]);}})[_0x96fd('0x18')](function(_0xe8412a){logger[_0x96fd('0x15')](_0x96fd('0x11'),_0x2402e2,_0xe8412a);_0x49ee5c(_0xe8412a);});});}exports[_0x96fd('0x19')]=function(_0x81fb58){var _0xef2de9=this;return new Promise(function(_0x5e1caf,_0x417982){return db[_0x96fd('0x1a')]['findAll']({'raw':_0x81fb58[_0x96fd('0x1b')]?_0x81fb58['options'][_0x96fd('0x1c')]===undefined?!![]:![]:!![],'where':_0x81fb58[_0x96fd('0x1b')]?_0x81fb58[_0x96fd('0x1b')][_0x96fd('0x1d')]||null:null,'attributes':_0x81fb58[_0x96fd('0x1b')]?_0x81fb58[_0x96fd('0x1b')][_0x96fd('0x1e')]||null:null,'limit':_0x81fb58['options']?_0x81fb58[_0x96fd('0x1b')][_0x96fd('0x1f')]||null:null,'include':_0x81fb58['options']?_0x81fb58['options'][_0x96fd('0x20')]?_[_0x96fd('0x21')](_0x81fb58[_0x96fd('0x1b')][_0x96fd('0x20')],function(_0x4ff402){return{'model':db[_0x4ff402['model']],'as':_0x4ff402['as'],'attributes':_0x4ff402['attributes'],'include':_0x4ff402[_0x96fd('0x20')]?_[_0x96fd('0x21')](_0x4ff402[_0x96fd('0x20')],function(_0x1ba961){return{'model':db[_0x1ba961[_0x96fd('0x22')]],'as':_0x1ba961['as'],'attributes':_0x1ba961[_0x96fd('0x1e')],'include':_0x1ba961[_0x96fd('0x20')]?_['map'](_0x1ba961['include'],function(_0x119eda){return{'model':db[_0x119eda['model']],'as':_0x119eda['as'],'attributes':_0x119eda[_0x96fd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x96fd('0x23')](function(_0x503a97){logger[_0x96fd('0x10')](_0x96fd('0x19'),_0x81fb58);logger[_0x96fd('0x24')](_0x96fd('0x19'),_0x81fb58,JSON[_0x96fd('0x14')](_0x503a97));_0x5e1caf(_0x503a97);})[_0x96fd('0x18')](function(_0x3df2c8){logger[_0x96fd('0x15')](_0x96fd('0x19'),_0x3df2c8[_0x96fd('0x16')],_0x81fb58);_0x417982(_0xef2de9[_0x96fd('0x15')](0x1f4,_0x3df2c8[_0x96fd('0x16')]));});});};exports[_0x96fd('0x25')]=function(_0x47ba0d){var _0x53324e=this;return new Promise(function(_0x5cf937,_0x2086bb){return db['VoiceQueue']['find']({'raw':_0x47ba0d[_0x96fd('0x1b')]?_0x47ba0d[_0x96fd('0x1b')][_0x96fd('0x1c')]===undefined?!![]:![]:!![],'where':_0x47ba0d[_0x96fd('0x1b')]?_0x47ba0d['options'][_0x96fd('0x1d')]||null:null,'attributes':_0x47ba0d[_0x96fd('0x1b')]?_0x47ba0d[_0x96fd('0x1b')][_0x96fd('0x1e')]||null:null,'include':_0x47ba0d[_0x96fd('0x1b')]?_0x47ba0d['options'][_0x96fd('0x20')]?_[_0x96fd('0x21')](_0x47ba0d['options'][_0x96fd('0x20')],function(_0x4341cc){return{'model':db[_0x4341cc['model']],'as':_0x4341cc['as'],'attributes':_0x4341cc[_0x96fd('0x1e')],'include':_0x4341cc[_0x96fd('0x20')]?_[_0x96fd('0x21')](_0x4341cc[_0x96fd('0x20')],function(_0x5a356d){return{'model':db[_0x5a356d[_0x96fd('0x22')]],'as':_0x5a356d['as'],'attributes':_0x5a356d['attributes'],'include':_0x5a356d[_0x96fd('0x20')]?_['map'](_0x5a356d[_0x96fd('0x20')],function(_0x441f4d){return{'model':db[_0x441f4d['model']],'as':_0x441f4d['as'],'attributes':_0x441f4d['attributes']};}):[]};}):[]};}):[]:[]})[_0x96fd('0x23')](function(_0x1bed56){logger[_0x96fd('0x10')](_0x96fd('0x25'),_0x47ba0d);logger[_0x96fd('0x24')](_0x96fd('0x25'),_0x47ba0d,JSON[_0x96fd('0x14')](_0x1bed56));_0x5cf937(_0x1bed56);})[_0x96fd('0x18')](function(_0x3ba170){logger[_0x96fd('0x15')](_0x96fd('0x25'),_0x3ba170[_0x96fd('0x16')],_0x47ba0d);_0x2086bb(_0x53324e[_0x96fd('0x15')](0x1f4,_0x3ba170[_0x96fd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 0489aa6..49ac8f4 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 _0x77ac=['save','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0x77ac,0x127));var _0xc77a=function(_0x1098db,_0x39ba6b){_0x1098db=_0x1098db-0x0;var _0x14f090=_0x77ac[_0x1098db];return _0x14f090;};'use strict';var VoiceQueueEvents=require(_0xc77a('0x0'));var events=[_0xc77a('0x1'),'remove',_0xc77a('0x2')];function createListener(_0x4b0dbf,_0x190204){return function(_0x1ef0ff){_0x190204[_0xc77a('0x3')](_0x4b0dbf,_0x1ef0ff);};}function removeListener(_0x428be9,_0x514cc1){return function(){VoiceQueueEvents[_0xc77a('0x4')](_0x428be9,_0x514cc1);};}exports[_0xc77a('0x5')]=function(_0x37a2c4){for(var _0x293d09=0x0,_0x29098d=events[_0xc77a('0x6')];_0x293d09<_0x29098d;_0x293d09++){var _0x1c91e1=events[_0x293d09];var _0x64240a=createListener(_0xc77a('0x7')+_0x1c91e1,_0x37a2c4);VoiceQueueEvents['on'](_0x1c91e1,_0x64240a);}}; \ No newline at end of file +var _0xb0ab=['register','length','voiceQueue:','./voiceQueue.events','save','remove','update','emit','removeListener'];(function(_0x4e6243,_0x1a9002){var _0x4f237c=function(_0x304941){while(--_0x304941){_0x4e6243['push'](_0x4e6243['shift']());}};_0x4f237c(++_0x1a9002);}(_0xb0ab,0x186));var _0xbb0a=function(_0x9355cd,_0xaa9e3e){_0x9355cd=_0x9355cd-0x0;var _0x21f33a=_0xb0ab[_0x9355cd];return _0x21f33a;};'use strict';var VoiceQueueEvents=require(_0xbb0a('0x0'));var events=[_0xbb0a('0x1'),_0xbb0a('0x2'),_0xbb0a('0x3')];function createListener(_0x2d56fe,_0x7d09b9){return function(_0x1850c7){_0x7d09b9[_0xbb0a('0x4')](_0x2d56fe,_0x1850c7);};}function removeListener(_0x4336fb,_0x3dcdca){return function(){VoiceQueueEvents[_0xbb0a('0x5')](_0x4336fb,_0x3dcdca);};}exports[_0xbb0a('0x6')]=function(_0x8b9661){for(var _0x436448=0x0,_0x371177=events[_0xbb0a('0x7')];_0x436448<_0x371177;_0x436448++){var _0x394ddf=events[_0x436448];var _0x2e5596=createListener(_0xbb0a('0x8')+_0x394ddf,_0x8b9661);VoiceQueueEvents['on'](_0x394ddf,_0x2e5596);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 1a09d25..f2a338c 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 _0x6f12=['get','describe','getVoiceQueuesReport','show','post','create','put','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index'];(function(_0xde433c,_0x3873b3){var _0x3a8dad=function(_0x39ad77){while(--_0x39ad77){_0xde433c['push'](_0xde433c['shift']());}};_0x3a8dad(++_0x3873b3);}(_0x6f12,0x16b));var _0x26f1=function(_0x3ec174,_0x9e2c41){_0x3ec174=_0x3ec174-0x0;var _0x19ff4d=_0x6f12[_0x3ec174];return _0x19ff4d;};'use strict';var multer=require(_0x26f1('0x0'));var util=require(_0x26f1('0x1'));var path=require('path');var timeout=require(_0x26f1('0x2'));var express=require(_0x26f1('0x3'));var router=express[_0x26f1('0x4')]();var fs_extra=require(_0x26f1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x26f1('0x6'));var config=require(_0x26f1('0x7'));var controller=require(_0x26f1('0x8'));router['get']('/',auth[_0x26f1('0x9')](),controller[_0x26f1('0xa')]);router[_0x26f1('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x26f1('0xc')]);router[_0x26f1('0xb')]('/index',auth[_0x26f1('0x9')](),controller[_0x26f1('0xd')]);router[_0x26f1('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x26f1('0xe')]);router[_0x26f1('0xf')]('/',auth[_0x26f1('0x9')](),controller[_0x26f1('0x10')]);router[_0x26f1('0x11')]('/:id',auth[_0x26f1('0x9')](),controller['update']);router[_0x26f1('0x12')](_0x26f1('0x13'),auth[_0x26f1('0x9')](),controller[_0x26f1('0x14')]);module[_0x26f1('0x15')]=router; \ No newline at end of file +var _0xd215=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','show','post','create','update','delete'];(function(_0x58d63b,_0x4773fd){var _0x49bd72=function(_0x4a02b0){while(--_0x4a02b0){_0x58d63b['push'](_0x58d63b['shift']());}};_0x49bd72(++_0x4773fd);}(_0xd215,0x1f1));var _0x5d21=function(_0x63bd0b,_0x5b12df){_0x63bd0b=_0x63bd0b-0x0;var _0xfa619f=_0xd215[_0x63bd0b];return _0xfa619f;};'use strict';var multer=require(_0x5d21('0x0'));var util=require(_0x5d21('0x1'));var path=require(_0x5d21('0x2'));var timeout=require(_0x5d21('0x3'));var express=require(_0x5d21('0x4'));var router=express[_0x5d21('0x5')]();var fs_extra=require(_0x5d21('0x6'));var auth=require(_0x5d21('0x7'));var interaction=require(_0x5d21('0x8'));var config=require(_0x5d21('0x9'));var controller=require(_0x5d21('0xa'));router[_0x5d21('0xb')]('/',auth['isAuthenticated'](),controller[_0x5d21('0xc')]);router[_0x5d21('0xb')](_0x5d21('0xd'),auth[_0x5d21('0xe')](),controller[_0x5d21('0xf')]);router[_0x5d21('0xb')](_0x5d21('0x10'),auth[_0x5d21('0xe')](),controller[_0x5d21('0x11')]);router[_0x5d21('0xb')]('/:id',auth[_0x5d21('0xe')](),controller[_0x5d21('0x12')]);router[_0x5d21('0x13')]('/',auth[_0x5d21('0xe')](),controller[_0x5d21('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5d21('0x15')]);router[_0x5d21('0x16')](_0x5d21('0x17'),auth['isAuthenticated'](),controller[_0x5d21('0x18')]);module[_0x5d21('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 68c9a3a..c3d9028 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 _0xd238=['YYYY-MM-DD\x20HH:mm:ss','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','getDataValue','queuecallerjoinAt'];(function(_0x3fa7d3,_0x37f83c){var _0x4c51bd=function(_0x59e85b){while(--_0x59e85b){_0x3fa7d3['push'](_0x3fa7d3['shift']());}};_0x4c51bd(++_0x37f83c);}(_0xd238,0xda));var _0x8d23=function(_0x394099,_0x1393b8){_0x394099=_0x394099-0x0;var _0x438a19=_0xd238[_0x394099];return _0x438a19;};'use strict';var Sequelize=require(_0x8d23('0x0'));var moment=require(_0x8d23('0x1'));module[_0x8d23('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8d23('0x3')]},'calleridnum':{'type':Sequelize[_0x8d23('0x3')]},'calleridname':{'type':Sequelize[_0x8d23('0x3')]},'queue':{'type':Sequelize[_0x8d23('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x107f0c){var _0x485d91=moment(_0x107f0c);var _0x5b0b0d=moment(this[_0x8d23('0x4')](_0x8d23('0x5')))['format'](_0x8d23('0x6'));var _0x4b78ef=_0x485d91['diff'](_0x5b0b0d,_0x8d23('0x7'));this['setDataValue'](_0x8d23('0x8'),_0x107f0c);this[_0x8d23('0x9')](_0x8d23('0xa'),_0x4b78ef||null);}},'position':{'type':Sequelize[_0x8d23('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x8d23('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x8d23('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x8d23('0xd')]},'queuecallerexit':{'type':Sequelize[_0x8d23('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x8d23('0xd')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x8d23('0xe')},'originalposition':{'type':Sequelize[_0x8d23('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x8d23('0x3')]},'connectedlinename':{'type':Sequelize[_0x8d23('0x3')]},'accountcode':{'type':Sequelize[_0x8d23('0x3')]},'context':{'type':Sequelize[_0x8d23('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x8d23('0xb')]},'mohtime':{'type':Sequelize[_0x8d23('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8d23('0x3')],'comment':_0x8d23('0xf')},'transferexten':{'type':Sequelize[_0x8d23('0x3')]},'transferuniqueid':{'type':Sequelize[_0x8d23('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8d23('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8d23('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x8d23('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x72cc=['seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','DATE','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x224b9b,_0x39ae3b){var _0x27efe0=function(_0xf1a128){while(--_0xf1a128){_0x224b9b['push'](_0x224b9b['shift']());}};_0x27efe0(++_0x39ae3b);}(_0x72cc,0xf6));var _0xc72c=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x72cc[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc72c('0x0'));module[_0xc72c('0x1')]={'type':{'type':Sequelize[_0xc72c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc72c('0x2')]},'calleridname':{'type':Sequelize[_0xc72c('0x2')]},'queue':{'type':Sequelize[_0xc72c('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x50bec0){var _0x151636=moment(_0x50bec0);var _0x456a2d=moment(this[_0xc72c('0x3')]('queuecallerjoinAt'))['format'](_0xc72c('0x4'));var _0xa0a06e=_0x151636[_0xc72c('0x5')](_0x456a2d,_0xc72c('0x6'));this['setDataValue'](_0xc72c('0x7'),_0x50bec0);this[_0xc72c('0x8')](_0xc72c('0x9'),_0xa0a06e||null);}},'position':{'type':Sequelize[_0xc72c('0xa')]},'count':{'type':Sequelize[_0xc72c('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xc72c('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xc72c('0xc')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xc72c('0xc')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xc72c('0xc')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xc72c('0xa')]},'channel':{'type':Sequelize[_0xc72c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc72c('0x2')]},'connectedlinename':{'type':Sequelize[_0xc72c('0x2')]},'accountcode':{'type':Sequelize[_0xc72c('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc72c('0x2')]},'priority':{'type':Sequelize[_0xc72c('0x2')]},'holdtime':{'type':Sequelize[_0xc72c('0xa')]},'mohtime':{'type':Sequelize[_0xc72c('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc72c('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xc72c('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xc72c('0xd')},'transferexten':{'type':Sequelize[_0xc72c('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xc72c('0x2')]},'secondDisposition':{'type':Sequelize[_0xc72c('0x2')]},'thirdDisposition':{'type':Sequelize[_0xc72c('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xc72c('0xa')],'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 247799e..82f8bfb 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 _0x6d7e=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','./voiceQueueReport.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','end','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','include','findAll','rows','catch','show','params','includeAll','merge','options','find','create','body','describe','nolimit','getVoiceQueuesReport','eml-format','request-promise','moment','mustache','util','path'];(function(_0x301dab,_0x38050a){var _0x2500a2=function(_0x4d3dff){while(--_0x4d3dff){_0x301dab['push'](_0x301dab['shift']());}};_0x2500a2(++_0x38050a);}(_0x6d7e,0xe7));var _0xe6d7=function(_0x545772,_0x1a3393){_0x545772=_0x545772-0x0;var _0x325345=_0x6d7e[_0x545772];return _0x325345;};'use strict';var emlformat=require(_0xe6d7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe6d7('0x1'));var moment=require(_0xe6d7('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe6d7('0x3'));var util=require(_0xe6d7('0x4'));var path=require(_0xe6d7('0x5'));var sox=require('sox');var csv=require(_0xe6d7('0x6'));var ejs=require(_0xe6d7('0x7'));var fs=require('fs');var fs_extra=require(_0xe6d7('0x8'));var _=require(_0xe6d7('0x9'));var squel=require(_0xe6d7('0xa'));var crypto=require(_0xe6d7('0xb'));var jsforce=require(_0xe6d7('0xc'));var deskjs=require(_0xe6d7('0xd'));var toCsv=require(_0xe6d7('0x6'));var querystring=require(_0xe6d7('0xe'));var Papa=require('papaparse');var Redis=require(_0xe6d7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe6d7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6d7('0x11'));var logger=require(_0xe6d7('0x12'))(_0xe6d7('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe6d7('0x14'));var db=require(_0xe6d7('0x15'))['db'];config[_0xe6d7('0x16')]=_['defaults'](config[_0xe6d7('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe6d7('0x16')]));require(_0xe6d7('0x17'))[_0xe6d7('0x18')](socket);function respondWithStatusCode(_0x2761f6,_0x2f979c){_0x2f979c=_0x2f979c||0xcc;return function(_0x2f576e){if(_0x2f576e){return _0x2761f6[_0xe6d7('0x19')](_0x2f979c);}return _0x2761f6[_0xe6d7('0x1a')](_0x2f979c)['end']();};}function respondWithResult(_0xc0abb9,_0x30d541){_0x30d541=_0x30d541||0xc8;return function(_0x2c82c7){if(_0x2c82c7){return _0xc0abb9[_0xe6d7('0x1a')](_0x30d541)['json'](_0x2c82c7);}};}function respondWithFilteredResult(_0x47ab0b,_0x264a3f){return function(_0x229526){if(_0x229526){var _0x1c458c=typeof _0x264a3f[_0xe6d7('0x1b')]===_0xe6d7('0x1c')&&typeof _0x264a3f[_0xe6d7('0x1d')]===_0xe6d7('0x1c');var _0x2faa73=_0x229526[_0xe6d7('0x1e')];var _0x2cbc06=_0x1c458c?0x0:_0x264a3f['offset'];var _0x426a16=_0x1c458c?_0x229526[_0xe6d7('0x1e')]:_0x264a3f[_0xe6d7('0x1b')]+_0x264a3f['limit'];var _0x5205bc;if(_0x426a16>=_0x2faa73){_0x426a16=_0x2faa73;_0x5205bc=0xc8;}else{_0x5205bc=0xce;}_0x47ab0b[_0xe6d7('0x1a')](_0x5205bc);return _0x47ab0b[_0xe6d7('0x1f')](_0xe6d7('0x20'),_0x2cbc06+'-'+_0x426a16+'/'+_0x2faa73)[_0xe6d7('0x21')](_0x229526);}return null;};}function patchUpdates(_0x4d4d9c){return function(_0x35a32e){try{jsonpatch['apply'](_0x35a32e,_0x4d4d9c,!![]);}catch(_0x1a150d){return BPromise['reject'](_0x1a150d);}return _0x35a32e['save']();};}function saveUpdates(_0x2ebcb1,_0xacb55c){return function(_0x396785){if(_0x396785){return _0x396785[_0xe6d7('0x22')](_0x2ebcb1)[_0xe6d7('0x23')](function(_0x1364ae){return _0x1364ae;});}return null;};}function removeEntity(_0x3090ea,_0x49073b){return function(_0x5ca3e7){if(_0x5ca3e7){return _0x5ca3e7[_0xe6d7('0x24')]()[_0xe6d7('0x23')](function(){_0x3090ea[_0xe6d7('0x1a')](0xcc)[_0xe6d7('0x25')]();});}};}function handleEntityNotFound(_0x4d9c8d,_0x591e42){return function(_0xd03db6){if(!_0xd03db6){_0x4d9c8d[_0xe6d7('0x19')](0x194);}return _0xd03db6;};}function handleError(_0x29e090,_0x1c5932){_0x1c5932=_0x1c5932||0x1f4;return function(_0x3f1ac6){logger[_0xe6d7('0x26')](_0x3f1ac6[_0xe6d7('0x27')]);if(_0x3f1ac6['name']){delete _0x3f1ac6[_0xe6d7('0x28')];}_0x29e090['status'](_0x1c5932)[_0xe6d7('0x29')](_0x3f1ac6);};}exports[_0xe6d7('0x2a')]=function(_0x1ba819,_0x4194e5){var _0x209365={},_0x557983={},_0x370378={'count':0x0,'rows':[]};var _0x51c4aa=_[_0xe6d7('0x2b')](db[_0xe6d7('0x2c')][_0xe6d7('0x2d')],function(_0x8ce34a){return{'name':_0x8ce34a[_0xe6d7('0x2e')],'type':_0x8ce34a[_0xe6d7('0x2f')][_0xe6d7('0x30')]};});_0x557983[_0xe6d7('0x31')]=_['map'](_0x51c4aa,'name');_0x557983['query']=_[_0xe6d7('0x32')](_0x1ba819[_0xe6d7('0x33')]);_0x557983[_0xe6d7('0x34')]=_[_0xe6d7('0x35')](_0x557983[_0xe6d7('0x31')],_0x557983[_0xe6d7('0x33')]);_0x209365[_0xe6d7('0x36')]=_[_0xe6d7('0x35')](_0x557983[_0xe6d7('0x31')],qs[_0xe6d7('0x37')](_0x1ba819[_0xe6d7('0x33')][_0xe6d7('0x37')]));_0x209365[_0xe6d7('0x36')]=_0x209365[_0xe6d7('0x36')][_0xe6d7('0x38')]?_0x209365[_0xe6d7('0x36')]:_0x557983[_0xe6d7('0x31')];if(!_0x1ba819['query'][_0xe6d7('0x39')]('nolimit')){_0x209365['limit']=qs[_0xe6d7('0x1d')](_0x1ba819['query'][_0xe6d7('0x1d')]);_0x209365['offset']=qs[_0xe6d7('0x1b')](_0x1ba819['query']['offset']);}_0x209365[_0xe6d7('0x3a')]=qs[_0xe6d7('0x3b')](_0x1ba819[_0xe6d7('0x33')][_0xe6d7('0x3b')]);_0x209365[_0xe6d7('0x3c')]=qs[_0xe6d7('0x34')](_[_0xe6d7('0x3d')](_0x1ba819['query'],_0x557983['filters']),_0x51c4aa);if(_0x1ba819[_0xe6d7('0x33')]['filter']){_0x209365[_0xe6d7('0x3c')]=_['merge'](_0x209365[_0xe6d7('0x3c')],{'$or':_[_0xe6d7('0x2b')](_0x51c4aa,function(_0x5dd0a5){if(_0x5dd0a5[_0xe6d7('0x2f')]!==_0xe6d7('0x3e')){var _0x36b3df={};_0x36b3df[_0x5dd0a5[_0xe6d7('0x28')]]={'$like':'%'+_0x1ba819[_0xe6d7('0x33')][_0xe6d7('0x3f')]+'%'};return _0x36b3df;}})});}_0x209365=_['merge']({},_0x209365,_0x1ba819['options']);var _0x1e6bf9={'where':_0x209365[_0xe6d7('0x3c')]};return db[_0xe6d7('0x2c')][_0xe6d7('0x1e')](_0x1e6bf9)[_0xe6d7('0x23')](function(_0x49d481){_0x370378[_0xe6d7('0x1e')]=_0x49d481;if(_0x1ba819[_0xe6d7('0x33')]['includeAll']){_0x209365[_0xe6d7('0x40')]=[{'all':!![]}];}return db[_0xe6d7('0x2c')][_0xe6d7('0x41')](_0x209365);})[_0xe6d7('0x23')](function(_0x375cda){_0x370378[_0xe6d7('0x42')]=_0x375cda;return _0x370378;})[_0xe6d7('0x23')](respondWithFilteredResult(_0x4194e5,_0x209365))[_0xe6d7('0x43')](handleError(_0x4194e5,null));};exports[_0xe6d7('0x44')]=function(_0x4ffe7a,_0x4dcbb8){var _0x930648={'raw':![],'where':{'id':_0x4ffe7a[_0xe6d7('0x45')]['id']}},_0x17c89f={};_0x17c89f[_0xe6d7('0x31')]=_['keys'](db[_0xe6d7('0x2c')][_0xe6d7('0x2d')]);_0x17c89f[_0xe6d7('0x33')]=_['keys'](_0x4ffe7a[_0xe6d7('0x33')]);_0x17c89f['filters']=_['intersection'](_0x17c89f[_0xe6d7('0x31')],_0x17c89f[_0xe6d7('0x33')]);_0x930648[_0xe6d7('0x36')]=_[_0xe6d7('0x35')](_0x17c89f[_0xe6d7('0x31')],qs[_0xe6d7('0x37')](_0x4ffe7a[_0xe6d7('0x33')]['fields']));_0x930648['attributes']=_0x930648[_0xe6d7('0x36')]['length']?_0x930648[_0xe6d7('0x36')]:_0x17c89f[_0xe6d7('0x31')];if(_0x4ffe7a[_0xe6d7('0x33')][_0xe6d7('0x46')]){_0x930648['include']=[{'all':!![]}];}_0x930648=_[_0xe6d7('0x47')]({},_0x930648,_0x4ffe7a[_0xe6d7('0x48')]);return db[_0xe6d7('0x2c')][_0xe6d7('0x49')](_0x930648)[_0xe6d7('0x23')](handleEntityNotFound(_0x4dcbb8,null))[_0xe6d7('0x23')](respondWithResult(_0x4dcbb8,null))[_0xe6d7('0x43')](handleError(_0x4dcbb8,null));};exports[_0xe6d7('0x4a')]=function(_0x2389cf,_0x56b780){return db[_0xe6d7('0x2c')]['create'](_0x2389cf[_0xe6d7('0x4b')],{})['then'](respondWithResult(_0x56b780,0xc9))[_0xe6d7('0x43')](handleError(_0x56b780,null));};exports[_0xe6d7('0x22')]=function(_0x4eb785,_0x511e5b){if(_0x4eb785[_0xe6d7('0x4b')]['id']){delete _0x4eb785[_0xe6d7('0x4b')]['id'];}return db[_0xe6d7('0x2c')]['find']({'where':{'id':_0x4eb785[_0xe6d7('0x45')]['id']}})['then'](handleEntityNotFound(_0x511e5b,null))['then'](saveUpdates(_0x4eb785[_0xe6d7('0x4b')],null))[_0xe6d7('0x23')](respondWithResult(_0x511e5b,null))['catch'](handleError(_0x511e5b,null));};exports[_0xe6d7('0x24')]=function(_0x2a1487,_0x4ebe15){return db['VoiceQueueReport'][_0xe6d7('0x49')]({'where':{'id':_0x2a1487['params']['id']}})['then'](handleEntityNotFound(_0x4ebe15,null))[_0xe6d7('0x23')](removeEntity(_0x4ebe15,null))[_0xe6d7('0x43')](handleError(_0x4ebe15,null));};exports[_0xe6d7('0x4c')]=function(_0x331e2a,_0x1063ec){return db[_0xe6d7('0x2c')][_0xe6d7('0x4c')]()[_0xe6d7('0x23')](respondWithResult(_0x1063ec,null))[_0xe6d7('0x43')](handleError(_0x1063ec,null));};exports['getVoiceQueuesReport']=function(_0x27b8f7,_0x535849){var _0x5add4a={},_0x1e09ce={},_0x115137={'count':0x0,'rows':[]};_0x1e09ce[_0xe6d7('0x31')]=_[_0xe6d7('0x32')](db[_0xe6d7('0x2c')][_0xe6d7('0x2d')]);_0x1e09ce['query']=_[_0xe6d7('0x32')](_0x27b8f7[_0xe6d7('0x33')]);_0x1e09ce[_0xe6d7('0x34')]=_['intersection'](_0x1e09ce[_0xe6d7('0x31')],_0x1e09ce[_0xe6d7('0x33')]);_0x5add4a['attributes']=_[_0xe6d7('0x35')](_0x1e09ce['model'],qs[_0xe6d7('0x37')](_0x27b8f7['query'][_0xe6d7('0x37')]));_0x5add4a['attributes']=_0x5add4a[_0xe6d7('0x36')]['length']?_0x5add4a['attributes']:_0x1e09ce['model'];if(!_0x27b8f7[_0xe6d7('0x33')]['hasOwnProperty'](_0xe6d7('0x4d'))){_0x5add4a[_0xe6d7('0x1d')]=qs[_0xe6d7('0x1d')](_0x27b8f7[_0xe6d7('0x33')]['limit']);_0x5add4a[_0xe6d7('0x1b')]=qs[_0xe6d7('0x1b')](_0x27b8f7['query'][_0xe6d7('0x1b')]);}_0x5add4a[_0xe6d7('0x3a')]=qs[_0xe6d7('0x3b')](_0x27b8f7[_0xe6d7('0x33')][_0xe6d7('0x3b')]);_0x5add4a['where']=qs[_0xe6d7('0x34')](_['pick'](_0x27b8f7[_0xe6d7('0x33')],_0x1e09ce[_0xe6d7('0x34')]));if(_0x27b8f7[_0xe6d7('0x33')][_0xe6d7('0x3f')]){_0x5add4a[_0xe6d7('0x3c')]=_[_0xe6d7('0x47')](_0x5add4a['where'],{'$or':_['map'](_0x5add4a[_0xe6d7('0x36')],function(_0x201b7e){var _0x4f8ea4={};_0x4f8ea4[_0x201b7e]={'$like':'%'+_0x27b8f7[_0xe6d7('0x33')][_0xe6d7('0x3f')]+'%'};return _0x4f8ea4;})});}_0x5add4a=_[_0xe6d7('0x47')]({},_0x5add4a,_0x27b8f7[_0xe6d7('0x48')]);var _0xa99221={'where':_0x5add4a['where']};return db['VoiceQueueReport'][_0xe6d7('0x1e')](_0xa99221)['then'](function(_0x53809f){_0x115137[_0xe6d7('0x1e')]=_0x53809f;if(_0x27b8f7[_0xe6d7('0x33')][_0xe6d7('0x46')]){_0x5add4a[_0xe6d7('0x40')]=[{'all':!![]}];}return db[_0xe6d7('0x2c')][_0xe6d7('0x41')](_0x5add4a);})[_0xe6d7('0x23')](function(_0x3a99c4){_0x115137[_0xe6d7('0x42')]=_0x3a99c4;return _0x115137;})['then'](respondWithFilteredResult(_0x535849,_0x5add4a,_0xe6d7('0x4e')))['catch'](handleError(_0x535849,null,_0xe6d7('0x4e')));}; \ No newline at end of file +var _0x9a9f=['findAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','end','stack','name','send','VoiceQueueReport','fieldName','type','key','model','map','keys','intersection','query','fields','attributes','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','rows','params','rawAttributes','length','catch','create','body','find','describe','getVoiceQueuesReport','hasOwnProperty'];(function(_0x18a723,_0x2f16d9){var _0x3ed653=function(_0x5e89c1){while(--_0x5e89c1){_0x18a723['push'](_0x18a723['shift']());}};_0x3ed653(++_0x2f16d9);}(_0x9a9f,0x1f3));var _0xf9a9=function(_0x164f70,_0x3971c2){_0x164f70=_0x164f70-0x0;var _0x30b1d2=_0x9a9f[_0x164f70];return _0x30b1d2;};'use strict';var emlformat=require(_0xf9a9('0x0'));var rimraf=require(_0xf9a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf9a9('0x2'));var rp=require(_0xf9a9('0x3'));var moment=require(_0xf9a9('0x4'));var BPromise=require(_0xf9a9('0x5'));var Mustache=require(_0xf9a9('0x6'));var util=require(_0xf9a9('0x7'));var path=require(_0xf9a9('0x8'));var sox=require('sox');var csv=require(_0xf9a9('0x9'));var ejs=require(_0xf9a9('0xa'));var fs=require('fs');var fs_extra=require(_0xf9a9('0xb'));var _=require(_0xf9a9('0xc'));var squel=require(_0xf9a9('0xd'));var crypto=require(_0xf9a9('0xe'));var jsforce=require(_0xf9a9('0xf'));var deskjs=require(_0xf9a9('0x10'));var toCsv=require(_0xf9a9('0x9'));var querystring=require(_0xf9a9('0x11'));var Papa=require(_0xf9a9('0x12'));var Redis=require(_0xf9a9('0x13'));var authService=require(_0xf9a9('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xf9a9('0x15'));var hardwareService=require(_0xf9a9('0x16'));var logger=require(_0xf9a9('0x17'))(_0xf9a9('0x18'));var utils=require('../../config/utils');var config=require(_0xf9a9('0x19'));var licenseUtil=require(_0xf9a9('0x1a'));var db=require(_0xf9a9('0x1b'))['db'];config['redis']=_['defaults'](config[_0xf9a9('0x1c')],{'host':_0xf9a9('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf9a9('0x1c')]));require(_0xf9a9('0x1e'))[_0xf9a9('0x1f')](socket);function respondWithStatusCode(_0x52129f,_0x409249){_0x409249=_0x409249||0xcc;return function(_0x23e9f9){if(_0x23e9f9){return _0x52129f[_0xf9a9('0x20')](_0x409249);}return _0x52129f[_0xf9a9('0x21')](_0x409249)['end']();};}function respondWithResult(_0x6382e8,_0x52748c){_0x52748c=_0x52748c||0xc8;return function(_0x47bc92){if(_0x47bc92){return _0x6382e8[_0xf9a9('0x21')](_0x52748c)[_0xf9a9('0x22')](_0x47bc92);}};}function respondWithFilteredResult(_0x12aa9d,_0x4922ee){return function(_0x81a4fe){if(_0x81a4fe){var _0x5a66d7=typeof _0x4922ee[_0xf9a9('0x23')]===_0xf9a9('0x24')&&typeof _0x4922ee['limit']===_0xf9a9('0x24');var _0x5c404a=_0x81a4fe[_0xf9a9('0x25')];var _0xc9030c=_0x5a66d7?0x0:_0x4922ee[_0xf9a9('0x23')];var _0x1dc2e2=_0x5a66d7?_0x81a4fe[_0xf9a9('0x25')]:_0x4922ee['offset']+_0x4922ee[_0xf9a9('0x26')];var _0x332f6e;if(_0x1dc2e2>=_0x5c404a){_0x1dc2e2=_0x5c404a;_0x332f6e=0xc8;}else{_0x332f6e=0xce;}_0x12aa9d[_0xf9a9('0x21')](_0x332f6e);return _0x12aa9d[_0xf9a9('0x27')](_0xf9a9('0x28'),_0xc9030c+'-'+_0x1dc2e2+'/'+_0x5c404a)['json'](_0x81a4fe);}return null;};}function patchUpdates(_0x33e514){return function(_0x296469){try{jsonpatch[_0xf9a9('0x29')](_0x296469,_0x33e514,!![]);}catch(_0x1ad282){return BPromise['reject'](_0x1ad282);}return _0x296469[_0xf9a9('0x2a')]();};}function saveUpdates(_0x5870e8,_0x2cc755){return function(_0x4b6969){if(_0x4b6969){return _0x4b6969[_0xf9a9('0x2b')](_0x5870e8)[_0xf9a9('0x2c')](function(_0x276769){return _0x276769;});}return null;};}function removeEntity(_0x2e81da,_0x2ae66e){return function(_0x8d4dd4){if(_0x8d4dd4){return _0x8d4dd4['destroy']()['then'](function(){_0x2e81da[_0xf9a9('0x21')](0xcc)[_0xf9a9('0x2d')]();});}};}function handleEntityNotFound(_0x5931fa,_0x2eabdc){return function(_0x20b963){if(!_0x20b963){_0x5931fa['sendStatus'](0x194);}return _0x20b963;};}function handleError(_0x3e204c,_0x5124ac){_0x5124ac=_0x5124ac||0x1f4;return function(_0x3d9ec5){logger['error'](_0x3d9ec5[_0xf9a9('0x2e')]);if(_0x3d9ec5[_0xf9a9('0x2f')]){delete _0x3d9ec5[_0xf9a9('0x2f')];}_0x3e204c[_0xf9a9('0x21')](_0x5124ac)[_0xf9a9('0x30')](_0x3d9ec5);};}exports['index']=function(_0x4d339f,_0x3b1e03){var _0x209dcd={},_0x5dfdf6={},_0x4ea5e6={'count':0x0,'rows':[]};var _0x34aef0=_['map'](db[_0xf9a9('0x31')]['rawAttributes'],function(_0x1875df){return{'name':_0x1875df[_0xf9a9('0x32')],'type':_0x1875df[_0xf9a9('0x33')][_0xf9a9('0x34')]};});_0x5dfdf6[_0xf9a9('0x35')]=_[_0xf9a9('0x36')](_0x34aef0,_0xf9a9('0x2f'));_0x5dfdf6['query']=_[_0xf9a9('0x37')](_0x4d339f['query']);_0x5dfdf6['filters']=_[_0xf9a9('0x38')](_0x5dfdf6[_0xf9a9('0x35')],_0x5dfdf6[_0xf9a9('0x39')]);_0x209dcd['attributes']=_[_0xf9a9('0x38')](_0x5dfdf6[_0xf9a9('0x35')],qs[_0xf9a9('0x3a')](_0x4d339f[_0xf9a9('0x39')][_0xf9a9('0x3a')]));_0x209dcd[_0xf9a9('0x3b')]=_0x209dcd[_0xf9a9('0x3b')]['length']?_0x209dcd[_0xf9a9('0x3b')]:_0x5dfdf6[_0xf9a9('0x35')];if(!_0x4d339f['query']['hasOwnProperty'](_0xf9a9('0x3c'))){_0x209dcd[_0xf9a9('0x26')]=qs[_0xf9a9('0x26')](_0x4d339f[_0xf9a9('0x39')][_0xf9a9('0x26')]);_0x209dcd[_0xf9a9('0x23')]=qs[_0xf9a9('0x23')](_0x4d339f[_0xf9a9('0x39')][_0xf9a9('0x23')]);}_0x209dcd[_0xf9a9('0x3d')]=qs[_0xf9a9('0x3e')](_0x4d339f['query'][_0xf9a9('0x3e')]);_0x209dcd['where']=qs[_0xf9a9('0x3f')](_[_0xf9a9('0x40')](_0x4d339f[_0xf9a9('0x39')],_0x5dfdf6[_0xf9a9('0x3f')]),_0x34aef0);if(_0x4d339f[_0xf9a9('0x39')][_0xf9a9('0x41')]){_0x209dcd[_0xf9a9('0x42')]=_[_0xf9a9('0x43')](_0x209dcd[_0xf9a9('0x42')],{'$or':_['map'](_0x34aef0,function(_0x14a546){if(_0x14a546['type']!=='VIRTUAL'){var _0x2ffcb5={};_0x2ffcb5[_0x14a546[_0xf9a9('0x2f')]]={'$like':'%'+_0x4d339f[_0xf9a9('0x39')]['filter']+'%'};return _0x2ffcb5;}})});}_0x209dcd=_[_0xf9a9('0x43')]({},_0x209dcd,_0x4d339f[_0xf9a9('0x44')]);var _0xc37f89={'where':_0x209dcd[_0xf9a9('0x42')]};return db['VoiceQueueReport']['count'](_0xc37f89)[_0xf9a9('0x2c')](function(_0x470f2b){_0x4ea5e6[_0xf9a9('0x25')]=_0x470f2b;if(_0x4d339f['query'][_0xf9a9('0x45')]){_0x209dcd[_0xf9a9('0x46')]=[{'all':!![]}];}return db[_0xf9a9('0x31')]['findAll'](_0x209dcd);})[_0xf9a9('0x2c')](function(_0x3cdcc7){_0x4ea5e6[_0xf9a9('0x47')]=_0x3cdcc7;return _0x4ea5e6;})[_0xf9a9('0x2c')](respondWithFilteredResult(_0x3b1e03,_0x209dcd))['catch'](handleError(_0x3b1e03,null));};exports['show']=function(_0x5c594d,_0x383eac){var _0x54c4d4={'raw':![],'where':{'id':_0x5c594d[_0xf9a9('0x48')]['id']}},_0x5c0235={};_0x5c0235['model']=_['keys'](db['VoiceQueueReport'][_0xf9a9('0x49')]);_0x5c0235[_0xf9a9('0x39')]=_[_0xf9a9('0x37')](_0x5c594d[_0xf9a9('0x39')]);_0x5c0235['filters']=_[_0xf9a9('0x38')](_0x5c0235[_0xf9a9('0x35')],_0x5c0235[_0xf9a9('0x39')]);_0x54c4d4['attributes']=_['intersection'](_0x5c0235[_0xf9a9('0x35')],qs[_0xf9a9('0x3a')](_0x5c594d[_0xf9a9('0x39')][_0xf9a9('0x3a')]));_0x54c4d4[_0xf9a9('0x3b')]=_0x54c4d4['attributes'][_0xf9a9('0x4a')]?_0x54c4d4[_0xf9a9('0x3b')]:_0x5c0235[_0xf9a9('0x35')];if(_0x5c594d[_0xf9a9('0x39')]['includeAll']){_0x54c4d4['include']=[{'all':!![]}];}_0x54c4d4=_[_0xf9a9('0x43')]({},_0x54c4d4,_0x5c594d[_0xf9a9('0x44')]);return db[_0xf9a9('0x31')]['find'](_0x54c4d4)[_0xf9a9('0x2c')](handleEntityNotFound(_0x383eac,null))['then'](respondWithResult(_0x383eac,null))[_0xf9a9('0x4b')](handleError(_0x383eac,null));};exports[_0xf9a9('0x4c')]=function(_0x2179a7,_0x48f6f3){return db[_0xf9a9('0x31')]['create'](_0x2179a7[_0xf9a9('0x4d')],{})[_0xf9a9('0x2c')](respondWithResult(_0x48f6f3,0xc9))[_0xf9a9('0x4b')](handleError(_0x48f6f3,null));};exports['update']=function(_0xd2f0ce,_0x3aa19f){if(_0xd2f0ce[_0xf9a9('0x4d')]['id']){delete _0xd2f0ce['body']['id'];}return db['VoiceQueueReport'][_0xf9a9('0x4e')]({'where':{'id':_0xd2f0ce['params']['id']}})[_0xf9a9('0x2c')](handleEntityNotFound(_0x3aa19f,null))[_0xf9a9('0x2c')](saveUpdates(_0xd2f0ce[_0xf9a9('0x4d')],null))[_0xf9a9('0x2c')](respondWithResult(_0x3aa19f,null))[_0xf9a9('0x4b')](handleError(_0x3aa19f,null));};exports['destroy']=function(_0x14f60a,_0x54310e){return db[_0xf9a9('0x31')][_0xf9a9('0x4e')]({'where':{'id':_0x14f60a[_0xf9a9('0x48')]['id']}})[_0xf9a9('0x2c')](handleEntityNotFound(_0x54310e,null))[_0xf9a9('0x2c')](removeEntity(_0x54310e,null))[_0xf9a9('0x4b')](handleError(_0x54310e,null));};exports['describe']=function(_0x1e3661,_0x32df80){return db['VoiceQueueReport'][_0xf9a9('0x4f')]()[_0xf9a9('0x2c')](respondWithResult(_0x32df80,null))[_0xf9a9('0x4b')](handleError(_0x32df80,null));};exports[_0xf9a9('0x50')]=function(_0xd5c5ce,_0x523ffa){var _0x49e2e6={},_0x14ed87={},_0x2e1828={'count':0x0,'rows':[]};_0x14ed87[_0xf9a9('0x35')]=_[_0xf9a9('0x37')](db[_0xf9a9('0x31')][_0xf9a9('0x49')]);_0x14ed87[_0xf9a9('0x39')]=_['keys'](_0xd5c5ce[_0xf9a9('0x39')]);_0x14ed87[_0xf9a9('0x3f')]=_[_0xf9a9('0x38')](_0x14ed87[_0xf9a9('0x35')],_0x14ed87['query']);_0x49e2e6[_0xf9a9('0x3b')]=_['intersection'](_0x14ed87['model'],qs[_0xf9a9('0x3a')](_0xd5c5ce[_0xf9a9('0x39')]['fields']));_0x49e2e6['attributes']=_0x49e2e6[_0xf9a9('0x3b')]['length']?_0x49e2e6[_0xf9a9('0x3b')]:_0x14ed87[_0xf9a9('0x35')];if(!_0xd5c5ce['query'][_0xf9a9('0x51')](_0xf9a9('0x3c'))){_0x49e2e6[_0xf9a9('0x26')]=qs[_0xf9a9('0x26')](_0xd5c5ce['query'][_0xf9a9('0x26')]);_0x49e2e6[_0xf9a9('0x23')]=qs[_0xf9a9('0x23')](_0xd5c5ce[_0xf9a9('0x39')][_0xf9a9('0x23')]);}_0x49e2e6['order']=qs[_0xf9a9('0x3e')](_0xd5c5ce[_0xf9a9('0x39')][_0xf9a9('0x3e')]);_0x49e2e6['where']=qs['filters'](_[_0xf9a9('0x40')](_0xd5c5ce[_0xf9a9('0x39')],_0x14ed87[_0xf9a9('0x3f')]));if(_0xd5c5ce[_0xf9a9('0x39')][_0xf9a9('0x41')]){_0x49e2e6[_0xf9a9('0x42')]=_['merge'](_0x49e2e6[_0xf9a9('0x42')],{'$or':_[_0xf9a9('0x36')](_0x49e2e6[_0xf9a9('0x3b')],function(_0x5f16cc){var _0x25b8d6={};_0x25b8d6[_0x5f16cc]={'$like':'%'+_0xd5c5ce[_0xf9a9('0x39')][_0xf9a9('0x41')]+'%'};return _0x25b8d6;})});}_0x49e2e6=_[_0xf9a9('0x43')]({},_0x49e2e6,_0xd5c5ce[_0xf9a9('0x44')]);var _0xa0350f={'where':_0x49e2e6['where']};return db[_0xf9a9('0x31')]['count'](_0xa0350f)[_0xf9a9('0x2c')](function(_0x5dea2a){_0x2e1828[_0xf9a9('0x25')]=_0x5dea2a;if(_0xd5c5ce['query'][_0xf9a9('0x45')]){_0x49e2e6[_0xf9a9('0x46')]=[{'all':!![]}];}return db[_0xf9a9('0x31')][_0xf9a9('0x52')](_0x49e2e6);})['then'](function(_0x15869e){_0x2e1828[_0xf9a9('0x47')]=_0x15869e;return _0x2e1828;})['then'](respondWithFilteredResult(_0x523ffa,_0x49e2e6,_0xf9a9('0x50')))[_0xf9a9('0x4b')](handleError(_0x523ffa,null,_0xf9a9('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 70811c1..4027891 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 _0xc35f=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc35f,0xae));var _0xfc35=function(_0x4a98d4,_0xde5351){_0x4a98d4=_0x4a98d4-0x0;var _0x287ed6=_0xc35f[_0x4a98d4];return _0x287ed6;};'use strict';var EventEmitter=require(_0xfc35('0x0'));var VoiceQueueReport=require(_0xfc35('0x1'))['db'][_0xfc35('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xfc35('0x3')](0x0);var events={'afterCreate':_0xfc35('0x4'),'afterUpdate':_0xfc35('0x5'),'afterDestroy':_0xfc35('0x6')};function emitEvent(_0x21727b){return function(_0x5455f5,_0x9cb979,_0x9c5ce8){VoiceQueueReportEvents[_0xfc35('0x7')](_0x21727b+':'+_0x5455f5['id'],_0x5455f5);VoiceQueueReportEvents[_0xfc35('0x7')](_0x21727b,_0x5455f5);_0x9c5ce8(null);};}for(var e in events){if(events[_0xfc35('0x8')](e)){var event=events[e];VoiceQueueReport[_0xfc35('0x9')](e,emitEvent(event));}}module[_0xfc35('0xa')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xc803=['remove','emit','hasOwnProperty','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update'];(function(_0x2fe485,_0x6010d7){var _0x28e193=function(_0x37ec34){while(--_0x37ec34){_0x2fe485['push'](_0x2fe485['shift']());}};_0x28e193(++_0x6010d7);}(_0xc803,0xdb));var _0x3c80=function(_0x392eb9,_0x4f5e5d){_0x392eb9=_0x392eb9-0x0;var _0x91b016=_0xc803[_0x392eb9];return _0x91b016;};'use strict';var EventEmitter=require(_0x3c80('0x0'));var VoiceQueueReport=require(_0x3c80('0x1'))['db'][_0x3c80('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x3c80('0x3')](0x0);var events={'afterCreate':_0x3c80('0x4'),'afterUpdate':_0x3c80('0x5'),'afterDestroy':_0x3c80('0x6')};function emitEvent(_0x4b5e3a){return function(_0x71cd49,_0x6075a3,_0x2b7063){VoiceQueueReportEvents[_0x3c80('0x7')](_0x4b5e3a+':'+_0x71cd49['id'],_0x71cd49);VoiceQueueReportEvents[_0x3c80('0x7')](_0x4b5e3a,_0x71cd49);_0x2b7063(null);};}for(var e in events){if(events[_0x3c80('0x8')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 5923615..f33cff1 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 _0x3021=['moment','bluebird','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','uniqueid','lodash','../../config/logger','api'];(function(_0x551906,_0x569941){var _0x58bfb6=function(_0x1eb6de){while(--_0x1eb6de){_0x551906['push'](_0x551906['shift']());}};_0x58bfb6(++_0x569941);}(_0x3021,0x10e));var _0x1302=function(_0x24516c,_0x59fcd8){_0x24516c=_0x24516c-0x0;var _0xaf2987=_0x3021[_0x24516c];return _0xaf2987;};'use strict';var _=require(_0x1302('0x0'));var util=require('util');var logger=require(_0x1302('0x1'))(_0x1302('0x2'));var moment=require(_0x1302('0x3'));var BPromise=require(_0x1302('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1302('0x5'));var rimraf=require(_0x1302('0x6'));var config=require(_0x1302('0x7'));var attributes=require(_0x1302('0x8'));module[_0x1302('0x9')]=function(_0x5b5af2,_0x34fdee){return _0x5b5af2['define'](_0x1302('0xa'),attributes,{'tableName':_0x1302('0xb'),'paranoid':![],'indexes':[{'fields':[_0x1302('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xedee=['report_queue','uniqueid','calleridnum','util','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xedee,0xe0));var _0xeede=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xedee[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require(_0xeede('0x0'));var logger=require('../../config/logger')(_0xeede('0x1'));var moment=require(_0xeede('0x2'));var BPromise=require('bluebird');var rp=require(_0xeede('0x3'));var fs=require('fs');var path=require(_0xeede('0x4'));var rimraf=require(_0xeede('0x5'));var config=require(_0xeede('0x6'));var attributes=require(_0xeede('0x7'));module[_0xeede('0x8')]=function(_0x40eb5b,_0x22b215){return _0x40eb5b['define'](_0xeede('0x9'),attributes,{'tableName':_0xeede('0xa'),'paranoid':![],'indexes':[{'fields':[_0xeede('0xb')]},{'fields':[_0xeede('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 3580a6e..0e34ab4 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 _0x9d8b=['catch','update','where','UpdateVoiceQueueReport','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueueReport,\x20%s,\x20%s','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','map','include','model','CreateVoiceQueueReport','create','body'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x9d8b,0x1bc));var _0xb9d8=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0x9d8b[_0x43a1b8];return _0x324ecc;};'use strict';var _=require(_0xb9d8('0x0'));var util=require(_0xb9d8('0x1'));var moment=require(_0xb9d8('0x2'));var BPromise=require('bluebird');var rs=require(_0xb9d8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9d8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb9d8('0x5'))(_0xb9d8('0x6'));var config=require(_0xb9d8('0x7'));var jayson=require(_0xb9d8('0x8'));var client=jayson[_0xb9d8('0x9')]['http']({'port':0x232a});config[_0xb9d8('0xa')]=_['defaults'](config['redis'],{'host':_0xb9d8('0xb'),'port':0x18eb});var socket=require(_0xb9d8('0xc'))(new Redis(config[_0xb9d8('0xa')]));require(_0xb9d8('0xd'))[_0xb9d8('0xe')](socket);function respondWithRpcPromise(_0x293c05,_0x20864b,_0x20ff15){return new BPromise(function(_0x5518a6,_0x3d6bef){return client[_0xb9d8('0xf')](_0x293c05,_0x20ff15)[_0xb9d8('0x10')](function(_0x4f022c){logger[_0xb9d8('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x20864b,_0xb9d8('0x12'));logger[_0xb9d8('0x13')](_0xb9d8('0x14'),_0x20864b,_0xb9d8('0x12'),JSON[_0xb9d8('0x15')](_0x4f022c));if(_0x4f022c[_0xb9d8('0x16')]){if(_0x4f022c[_0xb9d8('0x16')][_0xb9d8('0x17')]===0x1f4){logger[_0xb9d8('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x20864b,_0x4f022c[_0xb9d8('0x16')][_0xb9d8('0x18')]);return _0x3d6bef(_0x4f022c[_0xb9d8('0x16')][_0xb9d8('0x18')]);}logger[_0xb9d8('0x16')](_0xb9d8('0x19'),_0x20864b,_0x4f022c[_0xb9d8('0x16')][_0xb9d8('0x18')]);return _0x5518a6(_0x4f022c[_0xb9d8('0x16')][_0xb9d8('0x18')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x20864b,_0xb9d8('0x12'));_0x5518a6(_0x4f022c[_0xb9d8('0x1a')][_0xb9d8('0x18')]);}})['catch'](function(_0x248906){logger[_0xb9d8('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x20864b,_0x248906);_0x3d6bef(_0x248906);});});}exports[_0xb9d8('0x1b')]=function(_0x457aad){var _0x3344b2=this;return new Promise(function(_0x2404c6,_0x430108){return db[_0xb9d8('0x1c')][_0xb9d8('0x1d')]({'raw':_0x457aad[_0xb9d8('0x1e')]?_0x457aad['options'][_0xb9d8('0x1f')]===undefined?!![]:![]:!![],'where':_0x457aad[_0xb9d8('0x1e')]?_0x457aad[_0xb9d8('0x1e')]['where']||null:null,'attributes':_0x457aad['options']?_0x457aad['options'][_0xb9d8('0x20')]||null:null,'limit':_0x457aad[_0xb9d8('0x1e')]?_0x457aad[_0xb9d8('0x1e')][_0xb9d8('0x21')]||null:null,'include':_0x457aad[_0xb9d8('0x1e')]?_0x457aad[_0xb9d8('0x1e')]['include']?_[_0xb9d8('0x22')](_0x457aad[_0xb9d8('0x1e')][_0xb9d8('0x23')],function(_0x5d94ad){return{'model':db[_0x5d94ad['model']],'as':_0x5d94ad['as'],'attributes':_0x5d94ad[_0xb9d8('0x20')],'include':_0x5d94ad[_0xb9d8('0x23')]?_[_0xb9d8('0x22')](_0x5d94ad[_0xb9d8('0x23')],function(_0x58ce14){return{'model':db[_0x58ce14['model']],'as':_0x58ce14['as'],'attributes':_0x58ce14['attributes'],'include':_0x58ce14['include']?_['map'](_0x58ce14[_0xb9d8('0x23')],function(_0x5d30ca){return{'model':db[_0x5d30ca[_0xb9d8('0x24')]],'as':_0x5d30ca['as'],'attributes':_0x5d30ca[_0xb9d8('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb9d8('0x10')](function(_0x36bc17){logger[_0xb9d8('0x11')]('GetVoiceQueueReport',_0x457aad);logger['debug'](_0xb9d8('0x1b'),_0x457aad,JSON[_0xb9d8('0x15')](_0x36bc17));_0x2404c6(_0x36bc17);})['catch'](function(_0x1aacbd){logger['error']('GetVoiceQueueReport',_0x1aacbd[_0xb9d8('0x18')],_0x457aad);_0x430108(_0x3344b2[_0xb9d8('0x16')](0x1f4,_0x1aacbd[_0xb9d8('0x18')]));});});};exports[_0xb9d8('0x25')]=function(_0x383b2f){var _0x23ea8e=this;return new Promise(function(_0x527bcc,_0x155e85){return db[_0xb9d8('0x1c')][_0xb9d8('0x26')](_0x383b2f[_0xb9d8('0x27')],{'raw':_0x383b2f['options']?_0x383b2f[_0xb9d8('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xb9d8('0x10')](function(_0x468289){logger[_0xb9d8('0x11')](_0xb9d8('0x25'),_0x383b2f);logger[_0xb9d8('0x13')](_0xb9d8('0x25'),_0x383b2f,JSON[_0xb9d8('0x15')](_0x468289));_0x527bcc(_0x468289);})[_0xb9d8('0x28')](function(_0x2efa06){logger[_0xb9d8('0x16')](_0xb9d8('0x25'),_0x2efa06[_0xb9d8('0x18')],_0x383b2f);_0x155e85(_0x23ea8e[_0xb9d8('0x16')](0x1f4,_0x2efa06[_0xb9d8('0x18')]));});});};exports['UpdateVoiceQueueReport']=function(_0x8d0b03){var _0x5b84b1=this;return new Promise(function(_0x19c2e4,_0x495a54){return db[_0xb9d8('0x1c')][_0xb9d8('0x29')](_0x8d0b03[_0xb9d8('0x27')],{'raw':_0x8d0b03[_0xb9d8('0x1e')]?_0x8d0b03[_0xb9d8('0x1e')][_0xb9d8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8d0b03[_0xb9d8('0x1e')]?_0x8d0b03[_0xb9d8('0x1e')][_0xb9d8('0x2a')]||null:null,'attributes':_0x8d0b03[_0xb9d8('0x1e')]?_0x8d0b03['options'][_0xb9d8('0x20')]||null:null,'limit':_0x8d0b03['options']?_0x8d0b03[_0xb9d8('0x1e')]['limit']||null:null})[_0xb9d8('0x10')](function(_0x204399){logger[_0xb9d8('0x11')]('UpdateVoiceQueueReport',_0x8d0b03);logger['debug'](_0xb9d8('0x2b'),_0x8d0b03,JSON[_0xb9d8('0x15')](_0x204399));_0x19c2e4(_0x204399);})[_0xb9d8('0x28')](function(_0x3f0b38){logger[_0xb9d8('0x16')](_0xb9d8('0x2b'),_0x3f0b38['message'],_0x8d0b03);_0x495a54(_0x5b84b1[_0xb9d8('0x16')](0x1f4,_0x3f0b38[_0xb9d8('0x18')]));});});}; \ No newline at end of file +var _0xdf79=['message','result','catch','GetVoiceQueueReport','findAll','options','raw','attributes','include','map','model','CreateVoiceQueueReport','body','debug','UpdateVoiceQueueReport','VoiceQueueReport','update','where','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1c9602,_0x10ab7c){var _0x21bd3c=function(_0x16db07){while(--_0x16db07){_0x1c9602['push'](_0x1c9602['shift']());}};_0x21bd3c(++_0x10ab7c);}(_0xdf79,0x140));var _0x9df7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdf79[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9df7('0x0'));var util=require(_0x9df7('0x1'));var moment=require(_0x9df7('0x2'));var BPromise=require(_0x9df7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9df7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9df7('0x5'));var logger=require(_0x9df7('0x6'))(_0x9df7('0x7'));var config=require(_0x9df7('0x8'));var jayson=require(_0x9df7('0x9'));var client=jayson[_0x9df7('0xa')]['http']({'port':0x232a});config['redis']=_[_0x9df7('0xb')](config[_0x9df7('0xc')],{'host':_0x9df7('0xd'),'port':0x18eb});var socket=require(_0x9df7('0xe'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x9df7('0xf')](socket);function respondWithRpcPromise(_0x2e93f8,_0x24ca64,_0x4eb8fa){return new BPromise(function(_0x4fcbbe,_0x2fca9b){return client['request'](_0x2e93f8,_0x4eb8fa)[_0x9df7('0x10')](function(_0x34e30f){logger[_0x9df7('0x11')](_0x9df7('0x12'),_0x24ca64,_0x9df7('0x13'));logger['debug'](_0x9df7('0x14'),_0x24ca64,_0x9df7('0x13'),JSON[_0x9df7('0x15')](_0x34e30f));if(_0x34e30f[_0x9df7('0x16')]){if(_0x34e30f[_0x9df7('0x16')][_0x9df7('0x17')]===0x1f4){logger[_0x9df7('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x24ca64,_0x34e30f[_0x9df7('0x16')][_0x9df7('0x18')]);return _0x2fca9b(_0x34e30f[_0x9df7('0x16')][_0x9df7('0x18')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x24ca64,_0x34e30f[_0x9df7('0x16')][_0x9df7('0x18')]);return _0x4fcbbe(_0x34e30f[_0x9df7('0x16')][_0x9df7('0x18')]);}else{logger[_0x9df7('0x11')](_0x9df7('0x12'),_0x24ca64,_0x9df7('0x13'));_0x4fcbbe(_0x34e30f[_0x9df7('0x19')]['message']);}})[_0x9df7('0x1a')](function(_0x573397){logger['error'](_0x9df7('0x12'),_0x24ca64,_0x573397);_0x2fca9b(_0x573397);});});}exports[_0x9df7('0x1b')]=function(_0x5733f5){var _0x23e477=this;return new Promise(function(_0x278c19,_0x1b2679){return db['VoiceQueueReport'][_0x9df7('0x1c')]({'raw':_0x5733f5[_0x9df7('0x1d')]?_0x5733f5[_0x9df7('0x1d')][_0x9df7('0x1e')]===undefined?!![]:![]:!![],'where':_0x5733f5[_0x9df7('0x1d')]?_0x5733f5[_0x9df7('0x1d')]['where']||null:null,'attributes':_0x5733f5[_0x9df7('0x1d')]?_0x5733f5['options'][_0x9df7('0x1f')]||null:null,'limit':_0x5733f5['options']?_0x5733f5[_0x9df7('0x1d')]['limit']||null:null,'include':_0x5733f5[_0x9df7('0x1d')]?_0x5733f5[_0x9df7('0x1d')][_0x9df7('0x20')]?_[_0x9df7('0x21')](_0x5733f5['options']['include'],function(_0x22fae2){return{'model':db[_0x22fae2['model']],'as':_0x22fae2['as'],'attributes':_0x22fae2[_0x9df7('0x1f')],'include':_0x22fae2[_0x9df7('0x20')]?_[_0x9df7('0x21')](_0x22fae2[_0x9df7('0x20')],function(_0x3e0220){return{'model':db[_0x3e0220['model']],'as':_0x3e0220['as'],'attributes':_0x3e0220[_0x9df7('0x1f')],'include':_0x3e0220['include']?_['map'](_0x3e0220['include'],function(_0x1abd09){return{'model':db[_0x1abd09[_0x9df7('0x22')]],'as':_0x1abd09['as'],'attributes':_0x1abd09[_0x9df7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9df7('0x10')](function(_0x2e0144){logger[_0x9df7('0x11')](_0x9df7('0x1b'),_0x5733f5);logger['debug'](_0x9df7('0x1b'),_0x5733f5,JSON['stringify'](_0x2e0144));_0x278c19(_0x2e0144);})[_0x9df7('0x1a')](function(_0x29f6c6){logger['error']('GetVoiceQueueReport',_0x29f6c6[_0x9df7('0x18')],_0x5733f5);_0x1b2679(_0x23e477['error'](0x1f4,_0x29f6c6[_0x9df7('0x18')]));});});};exports[_0x9df7('0x23')]=function(_0xb49d98){var _0x112997=this;return new Promise(function(_0x27914b,_0x3c0f3d){return db['VoiceQueueReport']['create'](_0xb49d98[_0x9df7('0x24')],{'raw':_0xb49d98[_0x9df7('0x1d')]?_0xb49d98[_0x9df7('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x9df7('0x10')](function(_0x46f51f){logger[_0x9df7('0x11')]('CreateVoiceQueueReport',_0xb49d98);logger[_0x9df7('0x25')]('CreateVoiceQueueReport',_0xb49d98,JSON[_0x9df7('0x15')](_0x46f51f));_0x27914b(_0x46f51f);})[_0x9df7('0x1a')](function(_0x222e31){logger[_0x9df7('0x16')](_0x9df7('0x23'),_0x222e31[_0x9df7('0x18')],_0xb49d98);_0x3c0f3d(_0x112997[_0x9df7('0x16')](0x1f4,_0x222e31[_0x9df7('0x18')]));});});};exports[_0x9df7('0x26')]=function(_0xb03e58){var _0x2c1ac1=this;return new Promise(function(_0x4d9dc5,_0x563182){return db[_0x9df7('0x27')][_0x9df7('0x28')](_0xb03e58[_0x9df7('0x24')],{'raw':_0xb03e58[_0x9df7('0x1d')]?_0xb03e58[_0x9df7('0x1d')][_0x9df7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb03e58['options']?_0xb03e58[_0x9df7('0x1d')][_0x9df7('0x29')]||null:null,'attributes':_0xb03e58[_0x9df7('0x1d')]?_0xb03e58['options'][_0x9df7('0x1f')]||null:null,'limit':_0xb03e58[_0x9df7('0x1d')]?_0xb03e58[_0x9df7('0x1d')][_0x9df7('0x2a')]||null:null})[_0x9df7('0x10')](function(_0x1ca5fb){logger[_0x9df7('0x11')](_0x9df7('0x26'),_0xb03e58);logger['debug']('UpdateVoiceQueueReport',_0xb03e58,JSON[_0x9df7('0x15')](_0x1ca5fb));_0x4d9dc5(_0x1ca5fb);})['catch'](function(_0xf686da){logger[_0x9df7('0x16')]('UpdateVoiceQueueReport',_0xf686da[_0x9df7('0x18')],_0xb03e58);_0x563182(_0x2c1ac1['error'](0x1f4,_0xf686da[_0x9df7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 98509f2..e6a2095 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 _0x1c3d=['emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x19e7aa,_0x21de84){var _0x1e3cd6=function(_0x7d9c24){while(--_0x7d9c24){_0x19e7aa['push'](_0x19e7aa['shift']());}};_0x1e3cd6(++_0x21de84);}(_0x1c3d,0x68));var _0xd1c3=function(_0xe20d48,_0x11f1d0){_0xe20d48=_0xe20d48-0x0;var _0x1580e6=_0x1c3d[_0xe20d48];return _0x1580e6;};'use strict';var VoiceQueueReportEvents=require(_0xd1c3('0x0'));var events=[_0xd1c3('0x1'),_0xd1c3('0x2'),_0xd1c3('0x3')];function createListener(_0x2c7ce0,_0x5e2662){return function(_0xead51e){_0x5e2662[_0xd1c3('0x4')](_0x2c7ce0,_0xead51e);};}function removeListener(_0xce1b73,_0x2919df){return function(){VoiceQueueReportEvents[_0xd1c3('0x5')](_0xce1b73,_0x2919df);};}exports[_0xd1c3('0x6')]=function(_0xa5b3ec){for(var _0x352556=0x0,_0x2721cf=events[_0xd1c3('0x7')];_0x352556<_0x2721cf;_0x352556++){var _0x46ced5=events[_0x352556];var _0x2ecee0=createListener(_0xd1c3('0x8')+_0x46ced5,_0xa5b3ec);VoiceQueueReportEvents['on'](_0x46ced5,_0x2ecee0);}}; \ No newline at end of file +var _0xa7d8=['emit','removeListener','register','length','./voiceQueueReport.events','remove'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xa7d8,0x94));var _0x8a7d=function(_0xc2849d,_0x6831fd){_0xc2849d=_0xc2849d-0x0;var _0xe410cb=_0xa7d8[_0xc2849d];return _0xe410cb;};'use strict';var VoiceQueueReportEvents=require(_0x8a7d('0x0'));var events=['save',_0x8a7d('0x1'),'update'];function createListener(_0x262e73,_0x3f4f31){return function(_0x56d6be){_0x3f4f31[_0x8a7d('0x2')](_0x262e73,_0x56d6be);};}function removeListener(_0x262bf0,_0xb6d9e9){return function(){VoiceQueueReportEvents[_0x8a7d('0x3')](_0x262bf0,_0xb6d9e9);};}exports[_0x8a7d('0x4')]=function(_0x630b94){for(var _0x583af5=0x0,_0x3821fb=events[_0x8a7d('0x5')];_0x583af5<_0x3821fb;_0x583af5++){var _0x500943=events[_0x583af5];var _0x1f4767=createListener('voiceQueueReport:'+_0x500943,_0x630b94);VoiceQueueReportEvents['on'](_0x500943,_0x1f4767);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 648a210..a40bfa4 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 _0x8dcd=['destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','/:id','isAuthenticated','post','create','put','update','delete'];(function(_0x43da37,_0x39b067){var _0x370304=function(_0x4ce037){while(--_0x4ce037){_0x43da37['push'](_0x43da37['shift']());}};_0x370304(++_0x39b067);}(_0x8dcd,0xce));var _0xd8dc=function(_0x40932c,_0x2df66a){_0x40932c=_0x40932c-0x0;var _0x31175b=_0x8dcd[_0x40932c];return _0x31175b;};'use strict';var multer=require(_0xd8dc('0x0'));var util=require(_0xd8dc('0x1'));var path=require(_0xd8dc('0x2'));var timeout=require(_0xd8dc('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd8dc('0x4'));var config=require(_0xd8dc('0x5'));var controller=require(_0xd8dc('0x6'));router[_0xd8dc('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd8dc('0x7')](_0xd8dc('0x8'),auth[_0xd8dc('0x9')](),controller['show']);router[_0xd8dc('0xa')]('/',auth[_0xd8dc('0x9')](),controller[_0xd8dc('0xb')]);router[_0xd8dc('0xc')](_0xd8dc('0x8'),auth[_0xd8dc('0x9')](),controller[_0xd8dc('0xd')]);router[_0xd8dc('0xe')]('/:id',auth[_0xd8dc('0x9')](),controller[_0xd8dc('0xf')]);module[_0xd8dc('0x10')]=router; \ No newline at end of file +var _0x7e93=['../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x2eaedf,_0x481885){var _0x4b0bf8=function(_0x1feb83){while(--_0x1feb83){_0x2eaedf['push'](_0x2eaedf['shift']());}};_0x4b0bf8(++_0x481885);}(_0x7e93,0x78));var _0x37e9=function(_0x3c1947,_0x3819b9){_0x3c1947=_0x3c1947-0x0;var _0x230ef6=_0x7e93[_0x3c1947];return _0x230ef6;};'use strict';var multer=require(_0x37e9('0x0'));var util=require(_0x37e9('0x1'));var path=require(_0x37e9('0x2'));var timeout=require(_0x37e9('0x3'));var express=require('express');var router=express[_0x37e9('0x4')]();var fs_extra=require(_0x37e9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x37e9('0x6'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0x37e9('0x7')]('/',auth[_0x37e9('0x8')](),controller[_0x37e9('0x9')]);router['get'](_0x37e9('0xa'),auth[_0x37e9('0x8')](),controller[_0x37e9('0xb')]);router['post']('/',auth[_0x37e9('0x8')](),controller[_0x37e9('0xc')]);router[_0x37e9('0xd')](_0x37e9('0xa'),auth['isAuthenticated'](),controller[_0x37e9('0xe')]);router[_0x37e9('0xf')](_0x37e9('0xa'),auth[_0x37e9('0x8')](),controller[_0x37e9('0x10')]);module[_0x37e9('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index d26346f..617b01c 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 _0xac4f=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','STRING','DATE'];(function(_0x4da4ea,_0x2875d3){var _0x3cc102=function(_0x5549c2){while(--_0x5549c2){_0x4da4ea['push'](_0x4da4ea['shift']());}};_0x3cc102(++_0x2875d3);}(_0xac4f,0x122));var _0xfac4=function(_0x33df84,_0x5825d1){_0x33df84=_0x33df84-0x0;var _0x42e95e=_0xac4f[_0x33df84];return _0x42e95e;};'use strict';var Sequelize=require(_0xfac4('0x0'));var moment=require('moment');module[_0xfac4('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xfac4('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xfac4('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xfac4('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xfac4('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xfac4('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xfac4('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xfac4('0x3')],'allowNull':![],'defaultValue':moment()[_0xfac4('0x4')](_0xfac4('0x5'))}}; \ No newline at end of file +var _0x6b01=['moment','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x118bfb,_0x162353){var _0x363059=function(_0x418d92){while(--_0x418d92){_0x118bfb['push'](_0x118bfb['shift']());}};_0x363059(++_0x162353);}(_0x6b01,0x109));var _0x16b0=function(_0x3333bd,_0x23cf4c){_0x3333bd=_0x3333bd-0x0;var _0x5edb96=_0x6b01[_0x3333bd];return _0x5edb96;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x16b0('0x0'));module[_0x16b0('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x16b0('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x16b0('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x16b0('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x16b0('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x16b0('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x16b0('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x16b0('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x16b0('0x3')](_0x16b0('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 015e59b..8341296 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 _0x9833=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueuesLog','includeAll','include','rows','params','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x420c44,_0x11af5b){var _0x138afb=function(_0x3e52f5){while(--_0x3e52f5){_0x420c44['push'](_0x420c44['shift']());}};_0x138afb(++_0x11af5b);}(_0x9833,0x8d));var _0x3983=function(_0x52ee1b,_0x42a5e0){_0x52ee1b=_0x52ee1b-0x0;var _0x573fc6=_0x9833[_0x52ee1b];return _0x573fc6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3983('0x0'));var zipdir=require(_0x3983('0x1'));var jsonpatch=require(_0x3983('0x2'));var rp=require(_0x3983('0x3'));var moment=require(_0x3983('0x4'));var BPromise=require(_0x3983('0x5'));var Mustache=require(_0x3983('0x6'));var util=require('util');var path=require(_0x3983('0x7'));var sox=require(_0x3983('0x8'));var csv=require(_0x3983('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3983('0xa'));var _=require(_0x3983('0xb'));var squel=require(_0x3983('0xc'));var crypto=require(_0x3983('0xd'));var jsforce=require(_0x3983('0xe'));var deskjs=require(_0x3983('0xf'));var toCsv=require(_0x3983('0x9'));var querystring=require(_0x3983('0x10'));var Papa=require('papaparse');var Redis=require(_0x3983('0x11'));var authService=require(_0x3983('0x12'));var qs=require(_0x3983('0x13'));var as=require(_0x3983('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3983('0x15'));var utils=require(_0x3983('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3983('0x17'));var db=require(_0x3983('0x18'))['db'];function respondWithStatusCode(_0xa10ef9,_0x2f1987){_0x2f1987=_0x2f1987||0xcc;return function(_0x4fe813){if(_0x4fe813){return _0xa10ef9[_0x3983('0x19')](_0x2f1987);}return _0xa10ef9[_0x3983('0x1a')](_0x2f1987)['end']();};}function respondWithResult(_0x96bfd9,_0x4ce4c5){_0x4ce4c5=_0x4ce4c5||0xc8;return function(_0x894ed1){if(_0x894ed1){return _0x96bfd9[_0x3983('0x1a')](_0x4ce4c5)[_0x3983('0x1b')](_0x894ed1);}};}function respondWithFilteredResult(_0x2f15cc,_0x130e4d){return function(_0x343e0b){if(_0x343e0b){var _0x5328a2=typeof _0x130e4d[_0x3983('0x1c')]==='undefined'&&typeof _0x130e4d[_0x3983('0x1d')]===_0x3983('0x1e');var _0x2e50a0=_0x343e0b[_0x3983('0x1f')];var _0x5b6348=_0x5328a2?0x0:_0x130e4d[_0x3983('0x1c')];var _0x53859e=_0x5328a2?_0x343e0b[_0x3983('0x1f')]:_0x130e4d[_0x3983('0x1c')]+_0x130e4d[_0x3983('0x1d')];var _0x4dee88;if(_0x53859e>=_0x2e50a0){_0x53859e=_0x2e50a0;_0x4dee88=0xc8;}else{_0x4dee88=0xce;}_0x2f15cc[_0x3983('0x1a')](_0x4dee88);return _0x2f15cc[_0x3983('0x20')](_0x3983('0x21'),_0x5b6348+'-'+_0x53859e+'/'+_0x2e50a0)[_0x3983('0x1b')](_0x343e0b);}return null;};}function patchUpdates(_0x1bb056){return function(_0x3eb8fb){try{jsonpatch[_0x3983('0x22')](_0x3eb8fb,_0x1bb056,!![]);}catch(_0x3a3d29){return BPromise[_0x3983('0x23')](_0x3a3d29);}return _0x3eb8fb['save']();};}function saveUpdates(_0x1c8800,_0x3145c2){return function(_0x4e8c5a){if(_0x4e8c5a){return _0x4e8c5a[_0x3983('0x24')](_0x1c8800)[_0x3983('0x25')](function(_0x54d70a){return _0x54d70a;});}return null;};}function removeEntity(_0x295c1a,_0x24f098){return function(_0x4e74b3){if(_0x4e74b3){return _0x4e74b3[_0x3983('0x26')]()[_0x3983('0x25')](function(){_0x295c1a[_0x3983('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x292a49,_0x13d0b8){return function(_0x1df2e9){if(!_0x1df2e9){_0x292a49[_0x3983('0x19')](0x194);}return _0x1df2e9;};}function handleError(_0x3bbb98,_0x40b826){_0x40b826=_0x40b826||0x1f4;return function(_0x2a7045){logger['error'](_0x2a7045[_0x3983('0x27')]);if(_0x2a7045[_0x3983('0x28')]){delete _0x2a7045['name'];}_0x3bbb98['status'](_0x40b826)[_0x3983('0x29')](_0x2a7045);};}exports[_0x3983('0x2a')]=function(_0xf998cd,_0xd4c3e6){var _0x1e2ced={},_0x164acc={},_0x23196e={'count':0x0,'rows':[]};var _0x3b5d5d=_[_0x3983('0x2b')](db['VoiceQueuesLog'][_0x3983('0x2c')],function(_0xdc19a4){return{'name':_0xdc19a4[_0x3983('0x2d')],'type':_0xdc19a4[_0x3983('0x2e')][_0x3983('0x2f')]};});_0x164acc[_0x3983('0x30')]=_[_0x3983('0x2b')](_0x3b5d5d,_0x3983('0x28'));_0x164acc['query']=_[_0x3983('0x31')](_0xf998cd[_0x3983('0x32')]);_0x164acc[_0x3983('0x33')]=_['intersection'](_0x164acc[_0x3983('0x30')],_0x164acc['query']);_0x1e2ced['attributes']=_[_0x3983('0x34')](_0x164acc[_0x3983('0x30')],qs[_0x3983('0x35')](_0xf998cd[_0x3983('0x32')][_0x3983('0x35')]));_0x1e2ced['attributes']=_0x1e2ced[_0x3983('0x36')][_0x3983('0x37')]?_0x1e2ced[_0x3983('0x36')]:_0x164acc[_0x3983('0x30')];if(!_0xf998cd[_0x3983('0x32')][_0x3983('0x38')](_0x3983('0x39'))){_0x1e2ced[_0x3983('0x1d')]=qs[_0x3983('0x1d')](_0xf998cd['query'][_0x3983('0x1d')]);_0x1e2ced[_0x3983('0x1c')]=qs[_0x3983('0x1c')](_0xf998cd[_0x3983('0x32')]['offset']);}_0x1e2ced[_0x3983('0x3a')]=qs[_0x3983('0x3b')](_0xf998cd[_0x3983('0x32')][_0x3983('0x3b')]);_0x1e2ced[_0x3983('0x3c')]=qs[_0x3983('0x33')](_[_0x3983('0x3d')](_0xf998cd[_0x3983('0x32')],_0x164acc[_0x3983('0x33')]),_0x3b5d5d);if(_0xf998cd[_0x3983('0x32')][_0x3983('0x3e')]){_0x1e2ced[_0x3983('0x3c')]=_[_0x3983('0x3f')](_0x1e2ced[_0x3983('0x3c')],{'$or':_[_0x3983('0x2b')](_0x3b5d5d,function(_0x499c40){if(_0x499c40[_0x3983('0x2e')]!==_0x3983('0x40')){var _0x34085f={};_0x34085f[_0x499c40['name']]={'$like':'%'+_0xf998cd['query'][_0x3983('0x3e')]+'%'};return _0x34085f;}})});}_0x1e2ced=_['merge']({},_0x1e2ced,_0xf998cd[_0x3983('0x41')]);var _0x1f06e3={'where':_0x1e2ced['where']};return db[_0x3983('0x42')][_0x3983('0x1f')](_0x1f06e3)[_0x3983('0x25')](function(_0x235ed5){_0x23196e[_0x3983('0x1f')]=_0x235ed5;if(_0xf998cd[_0x3983('0x32')][_0x3983('0x43')]){_0x1e2ced[_0x3983('0x44')]=[{'all':!![]}];}return db[_0x3983('0x42')]['findAll'](_0x1e2ced);})[_0x3983('0x25')](function(_0x5addc9){_0x23196e[_0x3983('0x45')]=_0x5addc9;return _0x23196e;})[_0x3983('0x25')](respondWithFilteredResult(_0xd4c3e6,_0x1e2ced))['catch'](handleError(_0xd4c3e6,null));};exports['show']=function(_0x281cb6,_0x4444d5){var _0x4e7287={'raw':!![],'where':{'id':_0x281cb6[_0x3983('0x46')]['id']}},_0x418dc9={};_0x418dc9[_0x3983('0x30')]=_[_0x3983('0x31')](db[_0x3983('0x42')][_0x3983('0x2c')]);_0x418dc9[_0x3983('0x32')]=_[_0x3983('0x31')](_0x281cb6[_0x3983('0x32')]);_0x418dc9[_0x3983('0x33')]=_[_0x3983('0x34')](_0x418dc9['model'],_0x418dc9[_0x3983('0x32')]);_0x4e7287[_0x3983('0x36')]=_['intersection'](_0x418dc9[_0x3983('0x30')],qs[_0x3983('0x35')](_0x281cb6['query'][_0x3983('0x35')]));_0x4e7287[_0x3983('0x36')]=_0x4e7287['attributes']['length']?_0x4e7287[_0x3983('0x36')]:_0x418dc9[_0x3983('0x30')];if(_0x281cb6[_0x3983('0x32')]['includeAll']){_0x4e7287[_0x3983('0x44')]=[{'all':!![]}];}_0x4e7287=_[_0x3983('0x3f')]({},_0x4e7287,_0x281cb6['options']);return db['VoiceQueuesLog'][_0x3983('0x47')](_0x4e7287)['then'](handleEntityNotFound(_0x4444d5,null))[_0x3983('0x25')](respondWithResult(_0x4444d5,null))[_0x3983('0x48')](handleError(_0x4444d5,null));};exports[_0x3983('0x49')]=function(_0x33bc82,_0x2d2776){return db[_0x3983('0x42')][_0x3983('0x49')](_0x33bc82['body'],{})[_0x3983('0x25')](respondWithResult(_0x2d2776,0xc9))[_0x3983('0x48')](handleError(_0x2d2776,null));};exports[_0x3983('0x24')]=function(_0xec8c06,_0x1fd059){if(_0xec8c06['body']['id']){delete _0xec8c06[_0x3983('0x4a')]['id'];}return db['VoiceQueuesLog'][_0x3983('0x47')]({'where':{'id':_0xec8c06[_0x3983('0x46')]['id']}})[_0x3983('0x25')](handleEntityNotFound(_0x1fd059,null))[_0x3983('0x25')](saveUpdates(_0xec8c06[_0x3983('0x4a')],null))['then'](respondWithResult(_0x1fd059,null))[_0x3983('0x48')](handleError(_0x1fd059,null));};exports['destroy']=function(_0x2eaa55,_0x22d6c6){return db['VoiceQueuesLog']['find']({'where':{'id':_0x2eaa55['params']['id']}})[_0x3983('0x25')](handleEntityNotFound(_0x22d6c6,null))[_0x3983('0x25')](removeEntity(_0x22d6c6,null))[_0x3983('0x48')](handleError(_0x22d6c6,null));}; \ No newline at end of file +var _0x1db6=['sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','VoiceQueuesLog','includeAll','include','findAll','then','rows','catch','show','params','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xb0d059,_0x527e5d){var _0x8e82b8=function(_0x42392a){while(--_0x42392a){_0xb0d059['push'](_0xb0d059['shift']());}};_0x8e82b8(++_0x527e5d);}(_0x1db6,0x1ee));var _0x61db=function(_0x58478f,_0x17e92b){_0x58478f=_0x58478f-0x0;var _0x10b03f=_0x1db6[_0x58478f];return _0x10b03f;};'use strict';var emlformat=require(_0x61db('0x0'));var rimraf=require(_0x61db('0x1'));var zipdir=require(_0x61db('0x2'));var jsonpatch=require(_0x61db('0x3'));var rp=require(_0x61db('0x4'));var moment=require(_0x61db('0x5'));var BPromise=require(_0x61db('0x6'));var Mustache=require(_0x61db('0x7'));var util=require(_0x61db('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x61db('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61db('0xa'));var _=require(_0x61db('0xb'));var squel=require(_0x61db('0xc'));var crypto=require('crypto');var jsforce=require(_0x61db('0xd'));var deskjs=require(_0x61db('0xe'));var toCsv=require(_0x61db('0x9'));var querystring=require(_0x61db('0xf'));var Papa=require(_0x61db('0x10'));var Redis=require('ioredis');var authService=require(_0x61db('0x11'));var qs=require(_0x61db('0x12'));var as=require(_0x61db('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x61db('0x14'));var utils=require(_0x61db('0x15'));var config=require(_0x61db('0x16'));var licenseUtil=require(_0x61db('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dc51a,_0x3da23c){_0x3da23c=_0x3da23c||0xcc;return function(_0x3483c5){if(_0x3483c5){return _0x3dc51a[_0x61db('0x18')](_0x3da23c);}return _0x3dc51a[_0x61db('0x19')](_0x3da23c)['end']();};}function respondWithResult(_0x520890,_0x49a08b){_0x49a08b=_0x49a08b||0xc8;return function(_0x388d46){if(_0x388d46){return _0x520890[_0x61db('0x19')](_0x49a08b)[_0x61db('0x1a')](_0x388d46);}};}function respondWithFilteredResult(_0x267243,_0x54c134){return function(_0x2cd8bc){if(_0x2cd8bc){var _0x5ad7ca=typeof _0x54c134[_0x61db('0x1b')]==='undefined'&&typeof _0x54c134[_0x61db('0x1c')]==='undefined';var _0x5dd72d=_0x2cd8bc['count'];var _0x3d2539=_0x5ad7ca?0x0:_0x54c134['offset'];var _0x1a12f9=_0x5ad7ca?_0x2cd8bc[_0x61db('0x1d')]:_0x54c134[_0x61db('0x1b')]+_0x54c134[_0x61db('0x1c')];var _0x3abad2;if(_0x1a12f9>=_0x5dd72d){_0x1a12f9=_0x5dd72d;_0x3abad2=0xc8;}else{_0x3abad2=0xce;}_0x267243['status'](_0x3abad2);return _0x267243[_0x61db('0x1e')](_0x61db('0x1f'),_0x3d2539+'-'+_0x1a12f9+'/'+_0x5dd72d)[_0x61db('0x1a')](_0x2cd8bc);}return null;};}function patchUpdates(_0x468714){return function(_0x17420c){try{jsonpatch[_0x61db('0x20')](_0x17420c,_0x468714,!![]);}catch(_0x31c7e0){return BPromise[_0x61db('0x21')](_0x31c7e0);}return _0x17420c[_0x61db('0x22')]();};}function saveUpdates(_0x99d0ed,_0x16d4b5){return function(_0x1f4ede){if(_0x1f4ede){return _0x1f4ede['update'](_0x99d0ed)['then'](function(_0x334445){return _0x334445;});}return null;};}function removeEntity(_0x96835f,_0x1d695f){return function(_0x2b59ae){if(_0x2b59ae){return _0x2b59ae[_0x61db('0x23')]()['then'](function(){_0x96835f[_0x61db('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1116d0,_0x498168){return function(_0x1e6368){if(!_0x1e6368){_0x1116d0[_0x61db('0x18')](0x194);}return _0x1e6368;};}function handleError(_0x23309f,_0xe5b7d5){_0xe5b7d5=_0xe5b7d5||0x1f4;return function(_0x4a9a3a){logger[_0x61db('0x24')](_0x4a9a3a[_0x61db('0x25')]);if(_0x4a9a3a[_0x61db('0x26')]){delete _0x4a9a3a[_0x61db('0x26')];}_0x23309f[_0x61db('0x19')](_0xe5b7d5)[_0x61db('0x27')](_0x4a9a3a);};}exports[_0x61db('0x28')]=function(_0x13ab8b,_0x2cf177){var _0x57bdc9={},_0x471987={},_0x569602={'count':0x0,'rows':[]};var _0xa17d54=_['map'](db['VoiceQueuesLog'][_0x61db('0x29')],function(_0x53499e){return{'name':_0x53499e[_0x61db('0x2a')],'type':_0x53499e['type'][_0x61db('0x2b')]};});_0x471987[_0x61db('0x2c')]=_[_0x61db('0x2d')](_0xa17d54,_0x61db('0x26'));_0x471987[_0x61db('0x2e')]=_[_0x61db('0x2f')](_0x13ab8b[_0x61db('0x2e')]);_0x471987[_0x61db('0x30')]=_[_0x61db('0x31')](_0x471987[_0x61db('0x2c')],_0x471987[_0x61db('0x2e')]);_0x57bdc9[_0x61db('0x32')]=_[_0x61db('0x31')](_0x471987[_0x61db('0x2c')],qs[_0x61db('0x33')](_0x13ab8b[_0x61db('0x2e')]['fields']));_0x57bdc9['attributes']=_0x57bdc9[_0x61db('0x32')]['length']?_0x57bdc9[_0x61db('0x32')]:_0x471987[_0x61db('0x2c')];if(!_0x13ab8b['query']['hasOwnProperty'](_0x61db('0x34'))){_0x57bdc9[_0x61db('0x1c')]=qs[_0x61db('0x1c')](_0x13ab8b['query'][_0x61db('0x1c')]);_0x57bdc9['offset']=qs[_0x61db('0x1b')](_0x13ab8b[_0x61db('0x2e')][_0x61db('0x1b')]);}_0x57bdc9['order']=qs[_0x61db('0x35')](_0x13ab8b[_0x61db('0x2e')]['sort']);_0x57bdc9['where']=qs[_0x61db('0x30')](_[_0x61db('0x36')](_0x13ab8b[_0x61db('0x2e')],_0x471987['filters']),_0xa17d54);if(_0x13ab8b[_0x61db('0x2e')][_0x61db('0x37')]){_0x57bdc9[_0x61db('0x38')]=_[_0x61db('0x39')](_0x57bdc9['where'],{'$or':_[_0x61db('0x2d')](_0xa17d54,function(_0x65abcf){if(_0x65abcf[_0x61db('0x3a')]!==_0x61db('0x3b')){var _0x2dee30={};_0x2dee30[_0x65abcf[_0x61db('0x26')]]={'$like':'%'+_0x13ab8b['query']['filter']+'%'};return _0x2dee30;}})});}_0x57bdc9=_[_0x61db('0x39')]({},_0x57bdc9,_0x13ab8b[_0x61db('0x3c')]);var _0x4622c2={'where':_0x57bdc9[_0x61db('0x38')]};return db[_0x61db('0x3d')]['count'](_0x4622c2)['then'](function(_0x43c7b5){_0x569602[_0x61db('0x1d')]=_0x43c7b5;if(_0x13ab8b[_0x61db('0x2e')][_0x61db('0x3e')]){_0x57bdc9[_0x61db('0x3f')]=[{'all':!![]}];}return db[_0x61db('0x3d')][_0x61db('0x40')](_0x57bdc9);})[_0x61db('0x41')](function(_0x4e063c){_0x569602[_0x61db('0x42')]=_0x4e063c;return _0x569602;})[_0x61db('0x41')](respondWithFilteredResult(_0x2cf177,_0x57bdc9))[_0x61db('0x43')](handleError(_0x2cf177,null));};exports[_0x61db('0x44')]=function(_0xb34312,_0x448de7){var _0x4118e0={'raw':!![],'where':{'id':_0xb34312[_0x61db('0x45')]['id']}},_0xe06e5e={};_0xe06e5e[_0x61db('0x2c')]=_[_0x61db('0x2f')](db['VoiceQueuesLog'][_0x61db('0x29')]);_0xe06e5e[_0x61db('0x2e')]=_[_0x61db('0x2f')](_0xb34312['query']);_0xe06e5e[_0x61db('0x30')]=_['intersection'](_0xe06e5e[_0x61db('0x2c')],_0xe06e5e['query']);_0x4118e0['attributes']=_['intersection'](_0xe06e5e[_0x61db('0x2c')],qs[_0x61db('0x33')](_0xb34312[_0x61db('0x2e')][_0x61db('0x33')]));_0x4118e0['attributes']=_0x4118e0[_0x61db('0x32')]['length']?_0x4118e0[_0x61db('0x32')]:_0xe06e5e['model'];if(_0xb34312['query'][_0x61db('0x3e')]){_0x4118e0[_0x61db('0x3f')]=[{'all':!![]}];}_0x4118e0=_[_0x61db('0x39')]({},_0x4118e0,_0xb34312[_0x61db('0x3c')]);return db[_0x61db('0x3d')]['find'](_0x4118e0)[_0x61db('0x41')](handleEntityNotFound(_0x448de7,null))['then'](respondWithResult(_0x448de7,null))[_0x61db('0x43')](handleError(_0x448de7,null));};exports[_0x61db('0x46')]=function(_0x39e71b,_0x244c68){return db[_0x61db('0x3d')][_0x61db('0x46')](_0x39e71b[_0x61db('0x47')],{})[_0x61db('0x41')](respondWithResult(_0x244c68,0xc9))['catch'](handleError(_0x244c68,null));};exports[_0x61db('0x48')]=function(_0x5d23b3,_0x35d60f){if(_0x5d23b3['body']['id']){delete _0x5d23b3[_0x61db('0x47')]['id'];}return db[_0x61db('0x3d')][_0x61db('0x49')]({'where':{'id':_0x5d23b3['params']['id']}})[_0x61db('0x41')](handleEntityNotFound(_0x35d60f,null))[_0x61db('0x41')](saveUpdates(_0x5d23b3[_0x61db('0x47')],null))[_0x61db('0x41')](respondWithResult(_0x35d60f,null))[_0x61db('0x43')](handleError(_0x35d60f,null));};exports[_0x61db('0x23')]=function(_0x19560f,_0x443780){return db[_0x61db('0x3d')][_0x61db('0x49')]({'where':{'id':_0x19560f[_0x61db('0x45')]['id']}})[_0x61db('0x41')](handleEntityNotFound(_0x443780,null))[_0x61db('0x41')](removeEntity(_0x443780,null))[_0x61db('0x43')](handleError(_0x443780,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 9f9646d..559d0df 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 _0x7800=['define','VoiceQueuesLog','event','dtm','lodash','util','../../config/logger','request-promise','rimraf','../../config/environment'];(function(_0x21910e,_0x13de25){var _0x1a9d3f=function(_0x42b4a3){while(--_0x42b4a3){_0x21910e['push'](_0x21910e['shift']());}};_0x1a9d3f(++_0x13de25);}(_0x7800,0x1ee));var _0x0780=function(_0x19928d,_0x2afed2){_0x19928d=_0x19928d-0x0;var _0x386c3a=_0x7800[_0x19928d];return _0x386c3a;};'use strict';var _=require(_0x0780('0x0'));var util=require(_0x0780('0x1'));var logger=require(_0x0780('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0780('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0780('0x4'));var config=require(_0x0780('0x5'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x4eecb3,_0x1c0432){return _0x4eecb3[_0x0780('0x6')](_0x0780('0x7'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x0780('0x8'),_0x0780('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0xa0aa=['request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','dtm','lodash','util','api','moment','bluebird'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa0aa,0x19b));var _0xaa0a=function(_0x5d7223,_0x5c71e3){_0x5d7223=_0x5d7223-0x0;var _0x521bd8=_0xa0aa[_0x5d7223];return _0x521bd8;};'use strict';var _=require(_0xaa0a('0x0'));var util=require(_0xaa0a('0x1'));var logger=require('../../config/logger')(_0xaa0a('0x2'));var moment=require(_0xaa0a('0x3'));var BPromise=require(_0xaa0a('0x4'));var rp=require(_0xaa0a('0x5'));var fs=require('fs');var path=require(_0xaa0a('0x6'));var rimraf=require(_0xaa0a('0x7'));var config=require(_0xaa0a('0x8'));var attributes=require(_0xaa0a('0x9'));module[_0xaa0a('0xa')]=function(_0x2b6224,_0x1ff9b4){return _0x2b6224[_0xaa0a('0xb')](_0xaa0a('0xc'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xaa0a('0xd'),'fields':[_0xaa0a('0xe'),_0xaa0a('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 21b1ac4..2f3f61a 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 _0xb70f=['info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','code','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x1b5163,_0x4447be){var _0x7660db=function(_0x5be70c){while(--_0x5be70c){_0x1b5163['push'](_0x1b5163['shift']());}};_0x7660db(++_0x4447be);}(_0xb70f,0xba));var _0xfb70=function(_0x3302b1,_0x6e5693){_0x3302b1=_0x3302b1-0x0;var _0x54cd8e=_0xb70f[_0x3302b1];return _0x54cd8e;};'use strict';var _=require(_0xfb70('0x0'));var util=require(_0xfb70('0x1'));var moment=require(_0xfb70('0x2'));var BPromise=require(_0xfb70('0x3'));var rs=require(_0xfb70('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb70('0x5'))['db'];var utils=require(_0xfb70('0x6'));var logger=require(_0xfb70('0x7'))(_0xfb70('0x8'));var config=require(_0xfb70('0x9'));var jayson=require(_0xfb70('0xa'));var client=jayson['client'][_0xfb70('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3447b6,_0x46cf08,_0x5037ff){return new BPromise(function(_0x188875,_0x23f448){return client[_0xfb70('0xc')](_0x3447b6,_0x5037ff)[_0xfb70('0xd')](function(_0x239531){logger[_0xfb70('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x46cf08,_0xfb70('0xf'));logger[_0xfb70('0x10')](_0xfb70('0x11'),_0x46cf08,_0xfb70('0xf'),JSON[_0xfb70('0x12')](_0x239531));if(_0x239531['error']){if(_0x239531['error'][_0xfb70('0x13')]===0x1f4){logger[_0xfb70('0x14')](_0xfb70('0x15'),_0x46cf08,_0x239531['error']['message']);return _0x23f448(_0x239531[_0xfb70('0x14')][_0xfb70('0x16')]);}logger[_0xfb70('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x46cf08,_0x239531['error'][_0xfb70('0x16')]);return _0x188875(_0x239531[_0xfb70('0x14')]['message']);}else{logger[_0xfb70('0xe')](_0xfb70('0x15'),_0x46cf08,'request\x20sent');_0x188875(_0x239531[_0xfb70('0x17')][_0xfb70('0x16')]);}})[_0xfb70('0x18')](function(_0x1ec371){logger[_0xfb70('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x46cf08,_0x1ec371);_0x23f448(_0x1ec371);});});} \ No newline at end of file +var _0x8dc1=['../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x17b608,_0x3410be){var _0x59f024=function(_0x3a2d6c){while(--_0x3a2d6c){_0x17b608['push'](_0x17b608['shift']());}};_0x59f024(++_0x3410be);}(_0x8dc1,0x12e));var _0x18dc=function(_0x2ce364,_0x5b17b1){_0x2ce364=_0x2ce364-0x0;var _0x2d4a34=_0x8dc1[_0x2ce364];return _0x2d4a34;};'use strict';var _=require(_0x18dc('0x0'));var util=require(_0x18dc('0x1'));var moment=require(_0x18dc('0x2'));var BPromise=require('bluebird');var rs=require(_0x18dc('0x3'));var fs=require('fs');var Redis=require(_0x18dc('0x4'));var db=require(_0x18dc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x18dc('0x6'))(_0x18dc('0x7'));var config=require('../../config/environment');var jayson=require(_0x18dc('0x8'));var client=jayson[_0x18dc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d2fe2,_0x313921,_0x4afaa1){return new BPromise(function(_0x1b6900,_0x32fa3d){return client[_0x18dc('0xa')](_0x5d2fe2,_0x4afaa1)[_0x18dc('0xb')](function(_0x5a0d55){logger[_0x18dc('0xc')](_0x18dc('0xd'),_0x313921,'request\x20sent');logger[_0x18dc('0xe')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x313921,_0x18dc('0xf'),JSON[_0x18dc('0x10')](_0x5a0d55));if(_0x5a0d55[_0x18dc('0x11')]){if(_0x5a0d55['error'][_0x18dc('0x12')]===0x1f4){logger['error'](_0x18dc('0xd'),_0x313921,_0x5a0d55['error'][_0x18dc('0x13')]);return _0x32fa3d(_0x5a0d55[_0x18dc('0x11')][_0x18dc('0x13')]);}logger[_0x18dc('0x11')](_0x18dc('0xd'),_0x313921,_0x5a0d55[_0x18dc('0x11')][_0x18dc('0x13')]);return _0x1b6900(_0x5a0d55[_0x18dc('0x11')][_0x18dc('0x13')]);}else{logger[_0x18dc('0xc')](_0x18dc('0xd'),_0x313921,'request\x20sent');_0x1b6900(_0x5a0d55[_0x18dc('0x14')][_0x18dc('0x13')]);}})[_0x18dc('0x15')](function(_0x28b4fb){logger[_0x18dc('0x11')](_0x18dc('0xd'),_0x313921,_0x28b4fb);_0x32fa3d(_0x28b4fb);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index ce09e39..b93831a 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 _0xacd3=['delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','/:id','show','download','/:id/downloads','downloads','downloadTranscribe','post','create','update'];(function(_0x32db4b,_0x2543f7){var _0x56fd80=function(_0x1bf3ec){while(--_0x1bf3ec){_0x32db4b['push'](_0x32db4b['shift']());}};_0x56fd80(++_0x2543f7);}(_0xacd3,0x66));var _0x3acd=function(_0x216eaf,_0x5a2444){_0x216eaf=_0x216eaf-0x0;var _0x406b1c=_0xacd3[_0x216eaf];return _0x406b1c;};'use strict';var multer=require(_0x3acd('0x0'));var util=require(_0x3acd('0x1'));var path=require(_0x3acd('0x2'));var timeout=require(_0x3acd('0x3'));var express=require('express');var router=express[_0x3acd('0x4')]();var fs_extra=require(_0x3acd('0x5'));var auth=require(_0x3acd('0x6'));var interaction=require(_0x3acd('0x7'));var config=require(_0x3acd('0x8'));var controller=require(_0x3acd('0x9'));router[_0x3acd('0xa')]('/',auth[_0x3acd('0xb')](),controller[_0x3acd('0xc')]);router[_0x3acd('0xa')](_0x3acd('0xd'),auth[_0x3acd('0xb')](),controller['describe']);router[_0x3acd('0xa')](_0x3acd('0xe'),auth[_0x3acd('0xb')](),controller[_0x3acd('0xf')]);router['get']('/:id/download',auth[_0x3acd('0xb')](),controller[_0x3acd('0x10')]);router['get'](_0x3acd('0x11'),controller[_0x3acd('0x12')]);router[_0x3acd('0xa')]('/:id/transcribe',auth[_0x3acd('0xb')](),controller[_0x3acd('0x13')]);router[_0x3acd('0x14')]('/',auth[_0x3acd('0xb')](),controller[_0x3acd('0x15')]);router[_0x3acd('0x14')]('/:id/transcribe',auth[_0x3acd('0xb')](),controller['runTranscribe']);router['put']('/:id',auth[_0x3acd('0xb')](),controller[_0x3acd('0x16')]);router[_0x3acd('0x17')](_0x3acd('0xe'),auth[_0x3acd('0xb')](),controller['destroy']);module[_0x3acd('0x18')]=router; \ No newline at end of file +var _0xf2d8=['index','/describe','describe','show','/:id/download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','update','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./voiceRecording.controller','get','isAuthenticated'];(function(_0x1e5128,_0x5ce479){var _0x39c8a2=function(_0x185af2){while(--_0x185af2){_0x1e5128['push'](_0x1e5128['shift']());}};_0x39c8a2(++_0x5ce479);}(_0xf2d8,0x9e));var _0x8f2d=function(_0x3cf387,_0x31ed26){_0x3cf387=_0x3cf387-0x0;var _0x24425f=_0xf2d8[_0x3cf387];return _0x24425f;};'use strict';var multer=require(_0x8f2d('0x0'));var util=require(_0x8f2d('0x1'));var path=require(_0x8f2d('0x2'));var timeout=require(_0x8f2d('0x3'));var express=require(_0x8f2d('0x4'));var router=express[_0x8f2d('0x5')]();var fs_extra=require(_0x8f2d('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8f2d('0x7'));router[_0x8f2d('0x8')]('/',auth[_0x8f2d('0x9')](),controller[_0x8f2d('0xa')]);router[_0x8f2d('0x8')](_0x8f2d('0xb'),auth[_0x8f2d('0x9')](),controller[_0x8f2d('0xc')]);router['get']('/:id',auth[_0x8f2d('0x9')](),controller[_0x8f2d('0xd')]);router['get'](_0x8f2d('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x8f2d('0x8')](_0x8f2d('0xf'),controller['downloads']);router[_0x8f2d('0x8')](_0x8f2d('0x10'),auth['isAuthenticated'](),controller[_0x8f2d('0x11')]);router[_0x8f2d('0x12')]('/',auth[_0x8f2d('0x9')](),controller[_0x8f2d('0x13')]);router['post']('/:id/transcribe',auth[_0x8f2d('0x9')](),controller[_0x8f2d('0x14')]);router['put']('/:id',auth[_0x8f2d('0x9')](),controller[_0x8f2d('0x15')]);router['delete'](_0x8f2d('0x16'),auth[_0x8f2d('0x9')](),controller['destroy']);module[_0x8f2d('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index a9c73b9..378b16c 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(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 6e8f346..34eb159 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 _0x83ce=['sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','stack','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','name','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','update','describe','download','../../components/encryptor','uniqueid','params','find','value','decryptFile','recording','Sequelize','ValidationError','filename','extname','message','VoiceRecording\x20not\x20found','Not\x20found','sequelize','MD5','push','$and','%s.cypher','existsSync','unlink','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','unlinkSync','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','secrets','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','Transcribe\x20not\x20configured','runSentiment'];(function(_0x47c206,_0x25df44){var _0xcb9d80=function(_0x3148d2){while(--_0x3148d2){_0x47c206['push'](_0x47c206['shift']());}};_0xcb9d80(++_0x25df44);}(_0x83ce,0xa1));var _0xe83c=function(_0x5f16e6,_0x1a19cf){_0x5f16e6=_0x5f16e6-0x0;var _0xd898f9=_0x83ce[_0x5f16e6];return _0xd898f9;};'use strict';var emlformat=require(_0xe83c('0x0'));var rimraf=require(_0xe83c('0x1'));var zipdir=require(_0xe83c('0x2'));var jsonpatch=require(_0xe83c('0x3'));var rp=require('request-promise');var moment=require(_0xe83c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe83c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xe83c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe83c('0x7'));var _=require(_0xe83c('0x8'));var squel=require(_0xe83c('0x9'));var crypto=require(_0xe83c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe83c('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe83c('0xc'));var Papa=require('papaparse');var AWS=require(_0xe83c('0xd'));var uuidv4=require(_0xe83c('0xe'));var Redis=require(_0xe83c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe83c('0x10'));var as=require(_0xe83c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe83c('0x12'));var utils=require(_0xe83c('0x13'));var config=require(_0xe83c('0x14'));var licenseUtil=require(_0xe83c('0x15'));var db=require(_0xe83c('0x16'))['db'];function respondWithStatusCode(_0x2cc187,_0x15d3d8){_0x15d3d8=_0x15d3d8||0xcc;return function(_0x21ecb3){if(_0x21ecb3){return _0x2cc187[_0xe83c('0x17')](_0x15d3d8);}return _0x2cc187['status'](_0x15d3d8)[_0xe83c('0x18')]();};}function respondWithResult(_0x3203ff,_0x4956a2){_0x4956a2=_0x4956a2||0xc8;return function(_0x3ccd78){if(_0x3ccd78){return _0x3203ff[_0xe83c('0x19')](_0x4956a2)[_0xe83c('0x1a')](_0x3ccd78);}};}function respondWithFilteredResult(_0x36f65e,_0x5bcd8c){return function(_0x45ca25){if(_0x45ca25){var _0x5c9a8d=typeof _0x5bcd8c[_0xe83c('0x1b')]===_0xe83c('0x1c')&&typeof _0x5bcd8c['limit']===_0xe83c('0x1c');var _0x16960=_0x45ca25[_0xe83c('0x1d')];var _0x2b7193=_0x5c9a8d?0x0:_0x5bcd8c[_0xe83c('0x1b')];var _0xe55238=_0x5c9a8d?_0x45ca25[_0xe83c('0x1d')]:_0x5bcd8c['offset']+_0x5bcd8c[_0xe83c('0x1e')];var _0x228346;if(_0xe55238>=_0x16960){_0xe55238=_0x16960;_0x228346=0xc8;}else{_0x228346=0xce;}_0x36f65e[_0xe83c('0x19')](_0x228346);return _0x36f65e[_0xe83c('0x1f')](_0xe83c('0x20'),_0x2b7193+'-'+_0xe55238+'/'+_0x16960)[_0xe83c('0x1a')](_0x45ca25);}return null;};}function patchUpdates(_0x5af6fe){return function(_0xbbbe9e){try{jsonpatch[_0xe83c('0x21')](_0xbbbe9e,_0x5af6fe,!![]);}catch(_0x357440){return BPromise[_0xe83c('0x22')](_0x357440);}return _0xbbbe9e[_0xe83c('0x23')]();};}function saveUpdates(_0x5ad674,_0x500af9){return function(_0x4fcf2b){if(_0x4fcf2b){return _0x4fcf2b['update'](_0x5ad674)[_0xe83c('0x24')](function(_0xa4655f){return _0xa4655f;});}return null;};}function removeEntity(_0x517c97,_0x4936cf){return function(_0x22f044){if(_0x22f044){return _0x22f044[_0xe83c('0x25')]()[_0xe83c('0x24')](function(){_0x517c97[_0xe83c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f4b1a,_0x33f1db){return function(_0x42e571){if(!_0x42e571){_0x3f4b1a[_0xe83c('0x17')](0x194);}return _0x42e571;};}function handleError(_0x11d82e,_0x414412){_0x414412=_0x414412||0x1f4;return function(_0x31ccf1){logger['error'](_0x31ccf1[_0xe83c('0x26')]);if(_0x31ccf1['name']){delete _0x31ccf1['name'];}_0x11d82e[_0xe83c('0x19')](_0x414412)[_0xe83c('0x27')](_0x31ccf1);};}exports[_0xe83c('0x28')]=function(_0x2dee20,_0x10db5e){var _0x5db7b3={},_0x1daad8={},_0x58f66a={'count':0x0,'rows':[]};var _0x1a0017=_[_0xe83c('0x29')](db[_0xe83c('0x2a')][_0xe83c('0x2b')],function(_0x1c2285){return{'name':_0x1c2285[_0xe83c('0x2c')],'type':_0x1c2285[_0xe83c('0x2d')][_0xe83c('0x2e')]};});_0x1daad8[_0xe83c('0x2f')]=_[_0xe83c('0x30')](_[_0xe83c('0x29')](_0x1a0017,_0xe83c('0x31')),[_0xe83c('0x32')]);_0x1daad8[_0xe83c('0x33')]=_[_0xe83c('0x34')](_0x2dee20[_0xe83c('0x33')]);_0x1daad8[_0xe83c('0x35')]=_[_0xe83c('0x36')](_0x1daad8[_0xe83c('0x2f')],_0x1daad8[_0xe83c('0x33')]);_0x5db7b3[_0xe83c('0x37')]=_['intersection'](_0x1daad8[_0xe83c('0x2f')],qs[_0xe83c('0x38')](_0x2dee20['query'][_0xe83c('0x38')]));_0x5db7b3['attributes']=_0x5db7b3['attributes'][_0xe83c('0x39')]?_0x5db7b3[_0xe83c('0x37')]:_0x1daad8[_0xe83c('0x2f')];if(!_0x2dee20[_0xe83c('0x33')][_0xe83c('0x3a')]('nolimit')){_0x5db7b3[_0xe83c('0x1e')]=qs['limit'](_0x2dee20[_0xe83c('0x33')]['limit']);_0x5db7b3[_0xe83c('0x1b')]=qs[_0xe83c('0x1b')](_0x2dee20[_0xe83c('0x33')]['offset']);}_0x5db7b3['order']=qs['sort'](_0x2dee20[_0xe83c('0x33')][_0xe83c('0x3b')]);_0x5db7b3[_0xe83c('0x3c')]=qs['filters'](_[_0xe83c('0x3d')](_0x2dee20[_0xe83c('0x33')],_0x1daad8[_0xe83c('0x35')]),_0x1a0017);if(_0x2dee20[_0xe83c('0x33')][_0xe83c('0x3e')]){_0x5db7b3[_0xe83c('0x3c')]=_[_0xe83c('0x3f')](_0x5db7b3[_0xe83c('0x3c')],{'$or':_['map'](_0x1a0017,function(_0x4ad1df){if(_0x4ad1df['type']!=='VIRTUAL'){var _0x9237f5={};_0x9237f5[_0x4ad1df[_0xe83c('0x31')]]={'$like':'%'+_0x2dee20[_0xe83c('0x33')][_0xe83c('0x3e')]+'%'};return _0x9237f5;}})});}_0x5db7b3=_['merge']({},_0x5db7b3,_0x2dee20[_0xe83c('0x40')]);var _0x2b541a={'where':_0x5db7b3[_0xe83c('0x3c')]};return db['VoiceRecording'][_0xe83c('0x1d')](_0x2b541a)[_0xe83c('0x24')](function(_0x3642bb){_0x58f66a[_0xe83c('0x1d')]=_0x3642bb;if(_0x2dee20[_0xe83c('0x33')][_0xe83c('0x41')]){_0x5db7b3[_0xe83c('0x42')]=[{'all':!![]}];}return db['VoiceRecording'][_0xe83c('0x43')](_0x5db7b3);})[_0xe83c('0x24')](function(_0x10e872){_0x58f66a[_0xe83c('0x44')]=_0x10e872;return _0x58f66a;})[_0xe83c('0x24')](respondWithFilteredResult(_0x10db5e,_0x5db7b3))[_0xe83c('0x45')](handleError(_0x10db5e,null));};exports[_0xe83c('0x46')]=function(_0x4b919a,_0x14a070){var _0x2a707b={'raw':![],'where':{'id':_0x4b919a['params']['id']}},_0x3d0707={};_0x3d0707[_0xe83c('0x2f')]=_['keys'](db[_0xe83c('0x2a')]['rawAttributes']);_0x3d0707[_0xe83c('0x33')]=_[_0xe83c('0x34')](_0x4b919a[_0xe83c('0x33')]);_0x3d0707[_0xe83c('0x35')]=_[_0xe83c('0x36')](_0x3d0707[_0xe83c('0x2f')],_0x3d0707['query']);_0x2a707b['attributes']=_[_0xe83c('0x36')](_0x3d0707['model'],qs[_0xe83c('0x38')](_0x4b919a['query'][_0xe83c('0x38')]));_0x2a707b[_0xe83c('0x37')]=_0x2a707b[_0xe83c('0x37')][_0xe83c('0x39')]?_0x2a707b['attributes']:_0x3d0707[_0xe83c('0x2f')];if(_0x4b919a[_0xe83c('0x33')][_0xe83c('0x41')]){_0x2a707b[_0xe83c('0x42')]=[{'all':!![]}];}_0x2a707b=_[_0xe83c('0x3f')]({},_0x2a707b,_0x4b919a[_0xe83c('0x40')]);return db[_0xe83c('0x2a')]['find'](_0x2a707b)[_0xe83c('0x24')](handleEntityNotFound(_0x14a070,null))['then'](respondWithResult(_0x14a070,null))[_0xe83c('0x45')](handleError(_0x14a070,null));};exports['create']=function(_0x504c93,_0x1db716){return db[_0xe83c('0x2a')][_0xe83c('0x47')](_0x504c93[_0xe83c('0x48')],{})[_0xe83c('0x24')](respondWithResult(_0x1db716,0xc9))['catch'](handleError(_0x1db716,null));};exports[_0xe83c('0x49')]=function(_0x4003c6,_0x455499){if(_0x4003c6[_0xe83c('0x48')]['id']){delete _0x4003c6[_0xe83c('0x48')]['id'];}return db[_0xe83c('0x2a')]['find']({'where':{'id':_0x4003c6['params']['id']}})[_0xe83c('0x24')](handleEntityNotFound(_0x455499,null))[_0xe83c('0x24')](saveUpdates(_0x4003c6['body'],null))['then'](respondWithResult(_0x455499,null))[_0xe83c('0x45')](handleError(_0x455499,null));};exports['describe']=function(_0x5b5a35,_0x11c8e7){return db[_0xe83c('0x2a')][_0xe83c('0x4a')]()[_0xe83c('0x24')](respondWithResult(_0x11c8e7,null))[_0xe83c('0x45')](handleError(_0x11c8e7,null));};exports[_0xe83c('0x4b')]=function(_0x4aa3eb,_0x215da5,_0x268b0e){var _0x267b10=require(_0xe83c('0x4c'));var _0x1c6511=![];var _0x28ed90={};if(_0x4aa3eb[_0xe83c('0x33')][_0xe83c('0x2d')]&&_0x4aa3eb[_0xe83c('0x33')][_0xe83c('0x2d')]===_0xe83c('0x4d')){_0x28ed90[_0xe83c('0x4d')]=_0x4aa3eb[_0xe83c('0x4e')]['id'];}else{_0x28ed90['id']=_0x4aa3eb['params']['id'];}return db['VoiceRecording'][_0xe83c('0x4f')]({'where':_0x28ed90,'attributes':['id',_0xe83c('0x50')],'raw':!![]})[_0xe83c('0x24')](handleEntityNotFound(_0x215da5,null))[_0xe83c('0x24')](function(_0x405539){if(_0x405539){var _0x45c496=_0x405539[_0xe83c('0x50')];var _0x25235c=util['format']('%s.cypher',_0x45c496);if(fs['existsSync'](_0x25235c)){_0x1c6511=!![];return _0x267b10[_0xe83c('0x51')](_0x25235c,_0x45c496,config['secrets'][_0xe83c('0x52')])[_0xe83c('0x24')](function(){return _0x405539;});}return _0x405539;}})[_0xe83c('0x24')](function(_0xe2b5d3){if(_0xe2b5d3){var _0x4b9dea=_0xe2b5d3['value'];if(!fs['existsSync'](_0x4b9dea)){throw new db[(_0xe83c('0x53'))][(_0xe83c('0x54'))]('VoiceRecording\x20not\x20found');}if(_0xe2b5d3[_0xe83c('0x55')]){return _0x215da5[_0xe83c('0x4b')](_0x4b9dea,_0xe2b5d3[_0xe83c('0x55')]+path[_0xe83c('0x56')](_0x4b9dea),function(){if(_0x1c6511){fs['unlink'](_0x4b9dea);}});}else{return _0x215da5[_0xe83c('0x4b')](_0x4b9dea,function(_0x345178){if(_0x1c6511){fs['unlink'](_0x4b9dea);}});}}})[_0xe83c('0x45')](function(_0x432ed9){if(_0x432ed9[_0xe83c('0x57')]===_0xe83c('0x58')){_0x215da5[_0xe83c('0x19')](0x194)[_0xe83c('0x27')](_0xe83c('0x59'));}else{return handleError(_0x215da5,null);}});};exports['downloads']=function(_0x3bf933,_0x254eaf,_0x1b6a1d){var _0x12ea41=require(_0xe83c('0x4c'));var _0x2b0954=![];var _0x260f84={'$and':[db['sequelize'][_0xe83c('0x3c')](db[_0xe83c('0x5a')]['fn'](_0xe83c('0x5b'),db[_0xe83c('0x5a')]['col'](_0xe83c('0x4d'))),_0x3bf933[_0xe83c('0x33')]['token'])]};if(_0x3bf933['query'][_0xe83c('0x2d')]&&_0x3bf933[_0xe83c('0x33')][_0xe83c('0x2d')]===_0xe83c('0x4d')){_0x260f84['$and'][_0xe83c('0x5c')]({'uniqueid':_0x3bf933[_0xe83c('0x4e')]['id']});}else{_0x260f84[_0xe83c('0x5d')]['push']({'id':_0x3bf933[_0xe83c('0x4e')]['id']});}return db[_0xe83c('0x2a')][_0xe83c('0x4f')]({'where':_0x260f84,'attributes':['id',_0xe83c('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x254eaf,null))[_0xe83c('0x24')](function(_0x2e399c){if(_0x2e399c){var _0x29ea96=util[_0xe83c('0x32')](_0xe83c('0x5e'),_0x2e399c[_0xe83c('0x50')]);if(fs[_0xe83c('0x5f')](_0x29ea96)){_0x2b0954=!![];return _0x12ea41[_0xe83c('0x51')](_0x29ea96,_0x2e399c[_0xe83c('0x50')],config['secrets'][_0xe83c('0x52')])[_0xe83c('0x24')](function(){return _0x2e399c;});}return _0x2e399c;}})[_0xe83c('0x24')](function(_0x22400a){if(_0x22400a){if(!fs[_0xe83c('0x5f')](_0x22400a[_0xe83c('0x50')])){throw new db[(_0xe83c('0x53'))][(_0xe83c('0x54'))](_0xe83c('0x58'));}if(_0x22400a[_0xe83c('0x55')]){return _0x254eaf[_0xe83c('0x4b')](_0x22400a[_0xe83c('0x50')],_0x22400a[_0xe83c('0x55')]+path['extname'](_0x22400a['value']),function(){if(_0x2b0954){fs[_0xe83c('0x60')](_0x22400a[_0xe83c('0x50')]);}});}else{return _0x254eaf[_0xe83c('0x4b')](_0x22400a[_0xe83c('0x50')],function(_0x3b8cdb){if(_0x2b0954){fs[_0xe83c('0x60')](_0x22400a['value']);}});}}})['catch'](handleError(_0x254eaf,null));};exports[_0xe83c('0x25')]=function(_0x4bef5e,_0x354a2f){return db[_0xe83c('0x2a')][_0xe83c('0x4f')]({'where':{'id':_0x4bef5e['params']['id']}})[_0xe83c('0x24')](function(_0x38618e){if(_['isNil'](_0x38618e)){throw new ReferenceError(_0xe83c('0x61'));}return _0x38618e;})[_0xe83c('0x24')](function(_0x530c06){var _0x1215b0=_0x530c06[_0xe83c('0x50')];logger['info'](_0xe83c('0x62'),_0x1215b0);if(!_[_0xe83c('0x63')](_0x530c06['value'])&&fs[_0xe83c('0x5f')](_0x1215b0)){logger[_0xe83c('0x64')]('File:\x20\x22'+_0x1215b0+_0xe83c('0x65'));fs['unlinkSync'](_0x1215b0);}_0x1215b0=_0x1215b0+_0xe83c('0x66');if(!_['isNil'](_0x530c06[_0xe83c('0x50')])&&fs[_0xe83c('0x5f')](_0x1215b0)){logger[_0xe83c('0x64')](_0xe83c('0x67')+_0x1215b0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe83c('0x68')](_0x1215b0);}return _0x530c06;})[_0xe83c('0x24')](function(_0x37d93e){if(!_0x37d93e)throw new InternalError();return _0x37d93e[_0xe83c('0x25')]();})['then'](function(){_0x354a2f['status'](0xcc)[_0xe83c('0x18')]();})['catch'](handleError(_0x354a2f,null));};function getBucketslist(_0x59e046,_0xf5d421,_0x5babf8){return new Promise(function(_0x2e24da,_0x4c7aae){var _0x1eca31=new AWS['S3']({'accessKeyId':_0xf5d421,'secretAccessKey':_0x59e046,'region':_0x5babf8});_0x1eca31['listBuckets']({},function(_0x363ce6,_0x556b94){if(_0x363ce6){return _0x4c7aae(_0x363ce6);}else{return _0x2e24da(_0x556b94);}});});}function createBucket(_0x5f2e8c,_0x28e002,_0x1be126,_0xac89fb){return new Promise(function(_0x5df950,_0x2a4213){var _0x15518a=new AWS['S3']({'accessKeyId':_0x28e002,'secretAccessKey':_0x5f2e8c,'region':_0x1be126});_0x15518a[_0xe83c('0x69')]({'Bucket':_0xac89fb},function(_0x37dc3c,_0x30e3c2){if(_0x37dc3c){return _0x2a4213(_0x37dc3c);}else{return _0x5df950(_0x30e3c2);}});});}function uploadFile(_0x41bf97,_0x33fcdf,_0x22b26e,_0x2e306b,_0x3a859d,_0x492651){return new Promise(function(_0x907343,_0x150bdb){var _0x5593fd=new AWS['S3']({'accessKeyId':_0x33fcdf,'secretAccessKey':_0x41bf97,'region':_0x22b26e});_0x5593fd[_0xe83c('0x6a')]({'Bucket':_0x2e306b,'Key':_0x3a859d,'Body':_0x492651},function(_0x2d474e,_0x22cc0b){if(_0x2d474e){return _0x150bdb(_0x2d474e);}else{return _0x907343(_0x22cc0b);}});});}function startTranscribe(_0x3f0b48,_0x3ff819,_0x420c78,_0x4c132b,_0x4644f9,_0x3c424b){return new Promise(function(_0x52f4fd,_0x56a595){var _0x2af32b=new AWS[(_0xe83c('0x6b'))]({'accessKeyId':_0x3ff819,'secretAccessKey':_0x3f0b48,'region':_0x420c78});_0x2af32b['startTranscriptionJob']({'TranscriptionJobName':_0x4c132b,'LanguageCode':_0x4644f9,'Media':{'MediaFileUri':_0x3c424b}},function(_0x54d369,_0xba87cb){if(_0x54d369){return _0x56a595(_0x54d369);}else{return _0x52f4fd(_0xba87cb);}});});}function transcribe(_0x402559,_0x40e904,_0x433044,_0x368603,_0x31dd67,_0x57a568,_0x13613d){return new Promise(function(_0x11fc73,_0x3341ee){var _0x3e04c3={};logger[_0xe83c('0x64')](util['format'](_0xe83c('0x6c'),_0x402559,_0x31dd67));return uploadFile(_0x40e904,_0x433044,_0x368603,_0x31dd67,path['basename'](_0x57a568),fs[_0xe83c('0x6d')](_0x57a568))[_0xe83c('0x24')](function(_0x140033){logger['info'](util[_0xe83c('0x32')](_0xe83c('0x6e'),_0x402559,_0x31dd67,_0x140033[_0xe83c('0x6f')]));_0x3e04c3[_0xe83c('0x70')]=_0x140033[_0xe83c('0x71')];_0x3e04c3[_0xe83c('0x72')]=_0x140033[_0xe83c('0x6f')];logger[_0xe83c('0x64')](util[_0xe83c('0x32')](_0xe83c('0x73'),_0x402559));return startTranscribe(_0x40e904,_0x433044,_0x368603,uuidv4(),_0x13613d,_0x140033[_0xe83c('0x6f')]);})[_0xe83c('0x24')](function(_0x46020b){logger['info'](util['format'](_0xe83c('0x74'),_0x402559,_0x46020b[_0xe83c('0x75')][_0xe83c('0x76')]));_0x3e04c3[_0xe83c('0x77')]=_0x46020b[_0xe83c('0x75')][_0xe83c('0x76')];_0x3e04c3[_0xe83c('0x78')]=_0x46020b[_0xe83c('0x75')]['TranscriptionJobStatus'];return _0x11fc73(_0x3e04c3);})[_0xe83c('0x45')](function(_0x20b46b){return _0x3341ee(_0x20b46b);});});}exports[_0xe83c('0x79')]=function(_0x5192fd,_0x54fc30,_0x1ad190){var _0x19b50d;var _0x4fb58c;var _0x599eca;var _0x53b663=require('../../components/encryptor');return db['VoiceRecording'][_0xe83c('0x7a')]({'where':{'id':_0x5192fd['params']['id']}})[_0xe83c('0x24')](function(_0x587b37){if(_0x587b37){var _0x279c99=util[_0xe83c('0x32')](_0xe83c('0x5e'),_0x587b37['value']);if(fs[_0xe83c('0x5f')](_0x279c99)){cypher=!![];return _0x53b663[_0xe83c('0x51')](_0x279c99,_0x587b37[_0xe83c('0x50')],config[_0xe83c('0x7b')][_0xe83c('0x52')])['then'](function(){return _0x587b37;});}return _0x587b37;}})[_0xe83c('0x24')](function(_0x53347b){if(!_0x53347b){throw new db['Sequelize']['ValidationError'](_0xe83c('0x7c'));}_0x4fb58c=_0x53347b;return db[_0xe83c('0x7d')][_0xe83c('0x7a')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x54fc30,null))['then'](function(_0x372645){if(_0x372645){_0x19b50d=_0x372645;if(!_0x19b50d['transcribe']||!_0x19b50d['transcribeAccountId']||!_0x19b50d[_0xe83c('0x7e')]||!_0x19b50d['language']||!_0x19b50d[_0xe83c('0x70')]){throw new db['Sequelize']['ValidationError'](_0xe83c('0x7f'));}if(_0x5192fd[_0xe83c('0x48')][_0xe83c('0x80')]&&(!_0x19b50d['sentiment']||!_0x19b50d[_0xe83c('0x81')]||!_0x19b50d[_0xe83c('0x82')]||!_0x19b50d['language']||!_0x19b50d[_0xe83c('0x70')])){throw new db['Sequelize'][(_0xe83c('0x54'))](_0xe83c('0x83'));}return db['CloudProvider'][_0xe83c('0x7a')]({'where':{'id':_0x19b50d[_0xe83c('0x84')]}});}})['then'](function(_0x3a6a08){if(!_0x3a6a08){throw new db[(_0xe83c('0x53'))][(_0xe83c('0x54'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3a6a08[_0xe83c('0x85')]||!_0x3a6a08[_0xe83c('0x86')]){throw new db[(_0xe83c('0x53'))][(_0xe83c('0x54'))]('Cloud\x20Provider\x20not\x20configured');}_0x599eca=_0x3a6a08;return getBucketslist(_0x599eca[_0xe83c('0x85')],_0x599eca['data2'],_0x19b50d[_0xe83c('0x7e')]);})[_0xe83c('0x24')](function(_0x4e380a){if(_0x4e380a&&_0x4e380a['Buckets']){var _0x334acf=_[_0xe83c('0x4f')](_0x4e380a[_0xe83c('0x87')],function(_0x3e2fef){return _0x3e2fef[_0xe83c('0x88')]===_0x19b50d[_0xe83c('0x70')];});if(!_0x334acf){logger[_0xe83c('0x64')](util[_0xe83c('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x5192fd[_0xe83c('0x4e')]['id'],_0x19b50d[_0xe83c('0x70')]));return createBucket(_0x599eca[_0xe83c('0x85')],_0x599eca['data2'],_0x19b50d[_0xe83c('0x7e')],_0x19b50d[_0xe83c('0x70')]);}logger[_0xe83c('0x64')](util[_0xe83c('0x32')](_0xe83c('0x89'),_0x5192fd['params']['id'],_0x19b50d[_0xe83c('0x70')]));return;}})[_0xe83c('0x24')](function(_0x29201e){if(_0x4fb58c['transcribeStatus']==='NEW'){return transcribe(_0x5192fd[_0xe83c('0x4e')]['id'],_0x599eca['data1'],_0x599eca[_0xe83c('0x86')],_0x19b50d[_0xe83c('0x7e')],_0x19b50d[_0xe83c('0x70')],_0x4fb58c[_0xe83c('0x50')],_0x19b50d['language']);}else{logger[_0xe83c('0x64')](util[_0xe83c('0x32')](_0xe83c('0x8a'),_0x5192fd[_0xe83c('0x4e')]['id']));return{'transcribeStatus':_0xe83c('0x8b')};}})['then'](function(_0x3b33a3){if(_0x3b33a3){_0x3b33a3[_0xe83c('0x8c')]=_0x5192fd[_0xe83c('0x48')][_0xe83c('0x80')];return _0x4fb58c[_0xe83c('0x8d')](_0x3b33a3);}})[_0xe83c('0x24')](respondWithResult(_0x54fc30,null))['catch'](handleError(_0x54fc30,null));};function writeFile(_0x532dc3,_0x236e79){return new Promise(function(_0xa4348a,_0x5cd3bd){fs[_0xe83c('0x8e')](_0x236e79,_0x532dc3,function(_0x4da2e6,_0x19e2c7){if(_0x4da2e6){return _0x5cd3bd(_0x4da2e6);}else{return _0xa4348a(_0x19e2c7);}});});}exports[_0xe83c('0x8f')]=function(_0x153c11,_0x116a6b,_0xda94aa){return db[_0xe83c('0x2a')][_0xe83c('0x7a')]({'where':{'id':_0x153c11[_0xe83c('0x4e')]['id']}})[_0xe83c('0x24')](handleEntityNotFound(_0x116a6b))[_0xe83c('0x24')](function(_0x8a8619){if(_0x8a8619&&_0x8a8619[_0xe83c('0x90')]){var _0x5b5687=_0x8a8619[_0xe83c('0x90')];var _0x36bc28=config['root']+'/server/files/transcribes/transcribe_'+_0x8a8619['id']+'.txt';if(fs['existsSync'](_0x36bc28)){return _0x36bc28;}return writeFile(_0x5b5687,_0x36bc28)['then'](function(){return _0x36bc28;});}else{throw new db[(_0xe83c('0x53'))][(_0xe83c('0x54'))]('Transcript\x20not\x20available');}})['then'](function(_0xc121f2){return _0x116a6b[_0xe83c('0x4b')](_0xc121f2);})['catch'](handleError(_0x116a6b));}; \ No newline at end of file +var _0x51cf=['desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','index','map','VoiceRecording','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','rows','catch','show','rawAttributes','include','find','create','body','update','describe','download','uniqueid','params','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','value','recording','filename','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','unlinkSync','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeAccountId','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data2','Cloud\x20Provider\x20not\x20configured','data1','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x51cf,0x84));var _0xf51c=function(_0x489f2a,_0x25edb7){_0x489f2a=_0x489f2a-0x0;var _0x4e719b=_0x51cf[_0x489f2a];return _0x4e719b;};'use strict';var emlformat=require(_0xf51c('0x0'));var rimraf=require(_0xf51c('0x1'));var zipdir=require(_0xf51c('0x2'));var jsonpatch=require(_0xf51c('0x3'));var rp=require('request-promise');var moment=require(_0xf51c('0x4'));var BPromise=require(_0xf51c('0x5'));var Mustache=require(_0xf51c('0x6'));var util=require(_0xf51c('0x7'));var path=require(_0xf51c('0x8'));var sox=require('sox');var csv=require(_0xf51c('0x9'));var ejs=require(_0xf51c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf51c('0xb'));var squel=require(_0xf51c('0xc'));var crypto=require(_0xf51c('0xd'));var jsforce=require(_0xf51c('0xe'));var deskjs=require(_0xf51c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf51c('0x10'));var Papa=require('papaparse');var AWS=require(_0xf51c('0x11'));var uuidv4=require(_0xf51c('0x12'));var Redis=require(_0xf51c('0x13'));var authService=require(_0xf51c('0x14'));var qs=require(_0xf51c('0x15'));var as=require(_0xf51c('0x16'));var hardwareService=require(_0xf51c('0x17'));var logger=require(_0xf51c('0x18'))(_0xf51c('0x19'));var utils=require('../../config/utils');var config=require(_0xf51c('0x1a'));var licenseUtil=require(_0xf51c('0x1b'));var db=require(_0xf51c('0x1c'))['db'];function respondWithStatusCode(_0x449ba6,_0x5b057e){_0x5b057e=_0x5b057e||0xcc;return function(_0x480d86){if(_0x480d86){return _0x449ba6['sendStatus'](_0x5b057e);}return _0x449ba6[_0xf51c('0x1d')](_0x5b057e)[_0xf51c('0x1e')]();};}function respondWithResult(_0x5ef68b,_0x257869){_0x257869=_0x257869||0xc8;return function(_0x5f43ee){if(_0x5f43ee){return _0x5ef68b[_0xf51c('0x1d')](_0x257869)[_0xf51c('0x1f')](_0x5f43ee);}};}function respondWithFilteredResult(_0x36d829,_0x1901c7){return function(_0x2f8f77){if(_0x2f8f77){var _0x187506=typeof _0x1901c7[_0xf51c('0x20')]===_0xf51c('0x21')&&typeof _0x1901c7[_0xf51c('0x22')]==='undefined';var _0x4e793a=_0x2f8f77[_0xf51c('0x23')];var _0x3e6cda=_0x187506?0x0:_0x1901c7[_0xf51c('0x20')];var _0x49a670=_0x187506?_0x2f8f77[_0xf51c('0x23')]:_0x1901c7[_0xf51c('0x20')]+_0x1901c7[_0xf51c('0x22')];var _0x39f23d;if(_0x49a670>=_0x4e793a){_0x49a670=_0x4e793a;_0x39f23d=0xc8;}else{_0x39f23d=0xce;}_0x36d829[_0xf51c('0x1d')](_0x39f23d);return _0x36d829[_0xf51c('0x24')](_0xf51c('0x25'),_0x3e6cda+'-'+_0x49a670+'/'+_0x4e793a)[_0xf51c('0x1f')](_0x2f8f77);}return null;};}function patchUpdates(_0x2b1497){return function(_0x46ff79){try{jsonpatch[_0xf51c('0x26')](_0x46ff79,_0x2b1497,!![]);}catch(_0x1aa961){return BPromise[_0xf51c('0x27')](_0x1aa961);}return _0x46ff79[_0xf51c('0x28')]();};}function saveUpdates(_0x4ebc0f,_0x1291c0){return function(_0x52cda4){if(_0x52cda4){return _0x52cda4['update'](_0x4ebc0f)[_0xf51c('0x29')](function(_0x4a34c6){return _0x4a34c6;});}return null;};}function removeEntity(_0x142de4,_0x5600cf){return function(_0x5eb248){if(_0x5eb248){return _0x5eb248[_0xf51c('0x2a')]()[_0xf51c('0x29')](function(){_0x142de4[_0xf51c('0x1d')](0xcc)[_0xf51c('0x1e')]();});}};}function handleEntityNotFound(_0x5b6121,_0x5c3c27){return function(_0x2974eb){if(!_0x2974eb){_0x5b6121[_0xf51c('0x2b')](0x194);}return _0x2974eb;};}function handleError(_0x325553,_0x330809){_0x330809=_0x330809||0x1f4;return function(_0x5d7a2c){logger['error'](_0x5d7a2c['stack']);if(_0x5d7a2c[_0xf51c('0x2c')]){delete _0x5d7a2c[_0xf51c('0x2c')];}_0x325553[_0xf51c('0x1d')](_0x330809)['send'](_0x5d7a2c);};}exports[_0xf51c('0x2d')]=function(_0x1dd1c7,_0x223ce1){var _0x51ec03={},_0x2b77e3={},_0x2ba16c={'count':0x0,'rows':[]};var _0x11f797=_[_0xf51c('0x2e')](db[_0xf51c('0x2f')]['rawAttributes'],function(_0x1d532a){return{'name':_0x1d532a['fieldName'],'type':_0x1d532a['type'][_0xf51c('0x30')]};});_0x2b77e3[_0xf51c('0x31')]=_[_0xf51c('0x32')](_['map'](_0x11f797,'name'),[_0xf51c('0x33')]);_0x2b77e3[_0xf51c('0x34')]=_[_0xf51c('0x35')](_0x1dd1c7[_0xf51c('0x34')]);_0x2b77e3[_0xf51c('0x36')]=_[_0xf51c('0x37')](_0x2b77e3[_0xf51c('0x31')],_0x2b77e3[_0xf51c('0x34')]);_0x51ec03[_0xf51c('0x38')]=_['intersection'](_0x2b77e3['model'],qs[_0xf51c('0x39')](_0x1dd1c7['query'][_0xf51c('0x39')]));_0x51ec03['attributes']=_0x51ec03[_0xf51c('0x38')][_0xf51c('0x3a')]?_0x51ec03[_0xf51c('0x38')]:_0x2b77e3[_0xf51c('0x31')];if(!_0x1dd1c7[_0xf51c('0x34')][_0xf51c('0x3b')](_0xf51c('0x3c'))){_0x51ec03[_0xf51c('0x22')]=qs[_0xf51c('0x22')](_0x1dd1c7[_0xf51c('0x34')][_0xf51c('0x22')]);_0x51ec03[_0xf51c('0x20')]=qs['offset'](_0x1dd1c7['query'][_0xf51c('0x20')]);}_0x51ec03[_0xf51c('0x3d')]=qs[_0xf51c('0x3e')](_0x1dd1c7[_0xf51c('0x34')][_0xf51c('0x3e')]);_0x51ec03[_0xf51c('0x3f')]=qs[_0xf51c('0x36')](_['pick'](_0x1dd1c7[_0xf51c('0x34')],_0x2b77e3[_0xf51c('0x36')]),_0x11f797);if(_0x1dd1c7['query'][_0xf51c('0x40')]){_0x51ec03[_0xf51c('0x3f')]=_['merge'](_0x51ec03['where'],{'$or':_[_0xf51c('0x2e')](_0x11f797,function(_0x3402be){if(_0x3402be[_0xf51c('0x41')]!==_0xf51c('0x42')){var _0x7f9a34={};_0x7f9a34[_0x3402be[_0xf51c('0x2c')]]={'$like':'%'+_0x1dd1c7[_0xf51c('0x34')]['filter']+'%'};return _0x7f9a34;}})});}_0x51ec03=_['merge']({},_0x51ec03,_0x1dd1c7['options']);var _0x16a4bf={'where':_0x51ec03[_0xf51c('0x3f')]};return db[_0xf51c('0x2f')]['count'](_0x16a4bf)[_0xf51c('0x29')](function(_0x13a761){_0x2ba16c[_0xf51c('0x23')]=_0x13a761;if(_0x1dd1c7[_0xf51c('0x34')][_0xf51c('0x43')]){_0x51ec03['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x51ec03);})['then'](function(_0x5123e1){_0x2ba16c[_0xf51c('0x44')]=_0x5123e1;return _0x2ba16c;})[_0xf51c('0x29')](respondWithFilteredResult(_0x223ce1,_0x51ec03))[_0xf51c('0x45')](handleError(_0x223ce1,null));};exports[_0xf51c('0x46')]=function(_0x2e7014,_0x114050){var _0x5afc9b={'raw':![],'where':{'id':_0x2e7014['params']['id']}},_0x2f90f6={};_0x2f90f6[_0xf51c('0x31')]=_[_0xf51c('0x35')](db[_0xf51c('0x2f')][_0xf51c('0x47')]);_0x2f90f6[_0xf51c('0x34')]=_[_0xf51c('0x35')](_0x2e7014[_0xf51c('0x34')]);_0x2f90f6['filters']=_[_0xf51c('0x37')](_0x2f90f6[_0xf51c('0x31')],_0x2f90f6['query']);_0x5afc9b[_0xf51c('0x38')]=_[_0xf51c('0x37')](_0x2f90f6[_0xf51c('0x31')],qs[_0xf51c('0x39')](_0x2e7014[_0xf51c('0x34')][_0xf51c('0x39')]));_0x5afc9b[_0xf51c('0x38')]=_0x5afc9b[_0xf51c('0x38')][_0xf51c('0x3a')]?_0x5afc9b[_0xf51c('0x38')]:_0x2f90f6[_0xf51c('0x31')];if(_0x2e7014[_0xf51c('0x34')][_0xf51c('0x43')]){_0x5afc9b[_0xf51c('0x48')]=[{'all':!![]}];}_0x5afc9b=_['merge']({},_0x5afc9b,_0x2e7014['options']);return db[_0xf51c('0x2f')][_0xf51c('0x49')](_0x5afc9b)[_0xf51c('0x29')](handleEntityNotFound(_0x114050,null))['then'](respondWithResult(_0x114050,null))[_0xf51c('0x45')](handleError(_0x114050,null));};exports[_0xf51c('0x4a')]=function(_0x13f3d3,_0x1a752a){return db[_0xf51c('0x2f')]['create'](_0x13f3d3[_0xf51c('0x4b')],{})[_0xf51c('0x29')](respondWithResult(_0x1a752a,0xc9))[_0xf51c('0x45')](handleError(_0x1a752a,null));};exports[_0xf51c('0x4c')]=function(_0x2f2f8b,_0x20ee24){if(_0x2f2f8b[_0xf51c('0x4b')]['id']){delete _0x2f2f8b[_0xf51c('0x4b')]['id'];}return db[_0xf51c('0x2f')][_0xf51c('0x49')]({'where':{'id':_0x2f2f8b['params']['id']}})['then'](handleEntityNotFound(_0x20ee24,null))[_0xf51c('0x29')](saveUpdates(_0x2f2f8b[_0xf51c('0x4b')],null))[_0xf51c('0x29')](respondWithResult(_0x20ee24,null))[_0xf51c('0x45')](handleError(_0x20ee24,null));};exports[_0xf51c('0x4d')]=function(_0x2410a2,_0x422ca0){return db[_0xf51c('0x2f')][_0xf51c('0x4d')]()[_0xf51c('0x29')](respondWithResult(_0x422ca0,null))['catch'](handleError(_0x422ca0,null));};exports[_0xf51c('0x4e')]=function(_0xf4ecef,_0x231a0c,_0x18113c){var _0x4483fb=require('../../components/encryptor');var _0x2fbc62=![];var _0xc8049b={};if(_0xf4ecef[_0xf51c('0x34')][_0xf51c('0x41')]&&_0xf4ecef[_0xf51c('0x34')][_0xf51c('0x41')]===_0xf51c('0x4f')){_0xc8049b[_0xf51c('0x4f')]=_0xf4ecef[_0xf51c('0x50')]['id'];}else{_0xc8049b['id']=_0xf4ecef[_0xf51c('0x50')]['id'];}return db['VoiceRecording']['find']({'where':_0xc8049b,'attributes':['id','value'],'raw':!![]})[_0xf51c('0x29')](handleEntityNotFound(_0x231a0c,null))[_0xf51c('0x29')](function(_0x443587){if(_0x443587){var _0x104121=_0x443587['value'];var _0x591792=util[_0xf51c('0x33')](_0xf51c('0x51'),_0x104121);if(fs[_0xf51c('0x52')](_0x591792)){_0x2fbc62=!![];return _0x4483fb[_0xf51c('0x53')](_0x591792,_0x104121,config[_0xf51c('0x54')]['recording'])[_0xf51c('0x29')](function(){return _0x443587;});}return _0x443587;}})[_0xf51c('0x29')](function(_0x2b1f24){if(_0x2b1f24){var _0x180d6f=_0x2b1f24['value'];if(!fs['existsSync'](_0x180d6f)){throw new db[(_0xf51c('0x55'))][(_0xf51c('0x56'))](_0xf51c('0x57'));}if(_0x2b1f24['filename']){return _0x231a0c[_0xf51c('0x4e')](_0x180d6f,_0x2b1f24['filename']+path[_0xf51c('0x58')](_0x180d6f),function(){if(_0x2fbc62){fs[_0xf51c('0x59')](_0x180d6f);}});}else{return _0x231a0c[_0xf51c('0x4e')](_0x180d6f,function(_0x23f593){if(_0x2fbc62){fs[_0xf51c('0x59')](_0x180d6f);}});}}})[_0xf51c('0x45')](function(_0x39dfb6){if(_0x39dfb6[_0xf51c('0x5a')]==='VoiceRecording\x20not\x20found'){_0x231a0c[_0xf51c('0x1d')](0x194)[_0xf51c('0x5b')](_0xf51c('0x5c'));}else{return handleError(_0x231a0c,null);}});};exports[_0xf51c('0x5d')]=function(_0x4b4d9d,_0x56b7a8,_0x2045a9){var _0x554f74=require('../../components/encryptor');var _0x42a30b=![];var _0x48ef90={'$and':[db['sequelize'][_0xf51c('0x3f')](db[_0xf51c('0x5e')]['fn'](_0xf51c('0x5f'),db['sequelize'][_0xf51c('0x60')](_0xf51c('0x4f'))),_0x4b4d9d['query'][_0xf51c('0x61')])]};if(_0x4b4d9d[_0xf51c('0x34')][_0xf51c('0x41')]&&_0x4b4d9d[_0xf51c('0x34')][_0xf51c('0x41')]===_0xf51c('0x4f')){_0x48ef90[_0xf51c('0x62')][_0xf51c('0x63')]({'uniqueid':_0x4b4d9d['params']['id']});}else{_0x48ef90[_0xf51c('0x62')]['push']({'id':_0x4b4d9d[_0xf51c('0x50')]['id']});}return db[_0xf51c('0x2f')][_0xf51c('0x49')]({'where':_0x48ef90,'attributes':['id','value'],'raw':!![]})[_0xf51c('0x29')](handleEntityNotFound(_0x56b7a8,null))[_0xf51c('0x29')](function(_0x534add){if(_0x534add){var _0x3db034=util[_0xf51c('0x33')](_0xf51c('0x51'),_0x534add['value']);if(fs['existsSync'](_0x3db034)){_0x42a30b=!![];return _0x554f74[_0xf51c('0x53')](_0x3db034,_0x534add[_0xf51c('0x64')],config['secrets'][_0xf51c('0x65')])[_0xf51c('0x29')](function(){return _0x534add;});}return _0x534add;}})[_0xf51c('0x29')](function(_0x5268f2){if(_0x5268f2){if(!fs[_0xf51c('0x52')](_0x5268f2[_0xf51c('0x64')])){throw new db[(_0xf51c('0x55'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x5268f2[_0xf51c('0x66')]){return _0x56b7a8['download'](_0x5268f2[_0xf51c('0x64')],_0x5268f2[_0xf51c('0x66')]+path[_0xf51c('0x58')](_0x5268f2[_0xf51c('0x64')]),function(){if(_0x42a30b){fs[_0xf51c('0x59')](_0x5268f2[_0xf51c('0x64')]);}});}else{return _0x56b7a8[_0xf51c('0x4e')](_0x5268f2[_0xf51c('0x64')],function(_0x4f0aa5){if(_0x42a30b){fs[_0xf51c('0x59')](_0x5268f2[_0xf51c('0x64')]);}});}}})['catch'](handleError(_0x56b7a8,null));};exports[_0xf51c('0x2a')]=function(_0xe194a7,_0x112dfb){return db['VoiceRecording']['find']({'where':{'id':_0xe194a7[_0xf51c('0x50')]['id']}})[_0xf51c('0x29')](function(_0x290aa9){if(_['isNil'](_0x290aa9)){throw new ReferenceError('Entity\x20not\x20found');}return _0x290aa9;})['then'](function(_0x3593e1){var _0x2413cf=_0x3593e1[_0xf51c('0x64')];logger['info'](_0xf51c('0x67'),_0x2413cf);if(!_[_0xf51c('0x68')](_0x3593e1[_0xf51c('0x64')])&&fs[_0xf51c('0x52')](_0x2413cf)){logger[_0xf51c('0x69')](_0xf51c('0x6a')+_0x2413cf+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf51c('0x6b')](_0x2413cf);}_0x2413cf=_0x2413cf+'.cypher';if(!_[_0xf51c('0x68')](_0x3593e1[_0xf51c('0x64')])&&fs[_0xf51c('0x52')](_0x2413cf)){logger['info'](_0xf51c('0x6a')+_0x2413cf+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf51c('0x6b')](_0x2413cf);}return _0x3593e1;})[_0xf51c('0x29')](function(_0x1f34e5){if(!_0x1f34e5)throw new InternalError();return _0x1f34e5[_0xf51c('0x2a')]();})[_0xf51c('0x29')](function(){_0x112dfb['status'](0xcc)[_0xf51c('0x1e')]();})[_0xf51c('0x45')](handleError(_0x112dfb,null));};function getBucketslist(_0x67a4e1,_0x1a155c,_0x1bdea9){return new Promise(function(_0x520289,_0x1b3608){var _0x80ef28=new AWS['S3']({'accessKeyId':_0x1a155c,'secretAccessKey':_0x67a4e1,'region':_0x1bdea9});_0x80ef28[_0xf51c('0x6c')]({},function(_0xc7613d,_0x1f1f05){if(_0xc7613d){return _0x1b3608(_0xc7613d);}else{return _0x520289(_0x1f1f05);}});});}function createBucket(_0xa783b8,_0x52f2af,_0x4df0b1,_0x50dac4){return new Promise(function(_0x1ef2bc,_0x3c8fda){var _0x42f036=new AWS['S3']({'accessKeyId':_0x52f2af,'secretAccessKey':_0xa783b8,'region':_0x4df0b1});_0x42f036[_0xf51c('0x6d')]({'Bucket':_0x50dac4},function(_0x54cb3c,_0x54ab3d){if(_0x54cb3c){return _0x3c8fda(_0x54cb3c);}else{return _0x1ef2bc(_0x54ab3d);}});});}function uploadFile(_0x39f8aa,_0x50ed17,_0x37e5cd,_0x275b29,_0x4939ed,_0x15132b){return new Promise(function(_0x225acf,_0x923884){var _0x4a068c=new AWS['S3']({'accessKeyId':_0x50ed17,'secretAccessKey':_0x39f8aa,'region':_0x37e5cd});_0x4a068c[_0xf51c('0x6e')]({'Bucket':_0x275b29,'Key':_0x4939ed,'Body':_0x15132b},function(_0x42cf46,_0x3c1eb3){if(_0x42cf46){return _0x923884(_0x42cf46);}else{return _0x225acf(_0x3c1eb3);}});});}function startTranscribe(_0x3cb00a,_0x1eb5c5,_0xd1d819,_0x522bb7,_0xa4040d,_0x49bbe0){return new Promise(function(_0x57d89e,_0x8521df){var _0x526012=new AWS['TranscribeService']({'accessKeyId':_0x1eb5c5,'secretAccessKey':_0x3cb00a,'region':_0xd1d819});_0x526012[_0xf51c('0x6f')]({'TranscriptionJobName':_0x522bb7,'LanguageCode':_0xa4040d,'Media':{'MediaFileUri':_0x49bbe0}},function(_0x4e04a5,_0x266bc6){if(_0x4e04a5){return _0x8521df(_0x4e04a5);}else{return _0x57d89e(_0x266bc6);}});});}function transcribe(_0x3b3a07,_0x3bf5f9,_0x43d314,_0x1a2c81,_0x2ffb3b,_0x42f227,_0x569d17){return new Promise(function(_0x2d8d43,_0x150d60){var _0x43a204={};logger[_0xf51c('0x69')](util[_0xf51c('0x33')](_0xf51c('0x70'),_0x3b3a07,_0x2ffb3b));return uploadFile(_0x3bf5f9,_0x43d314,_0x1a2c81,_0x2ffb3b,path[_0xf51c('0x71')](_0x42f227),fs[_0xf51c('0x72')](_0x42f227))[_0xf51c('0x29')](function(_0x363a98){logger[_0xf51c('0x69')](util[_0xf51c('0x33')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x3b3a07,_0x2ffb3b,_0x363a98['Location']));_0x43a204['bucket']=_0x363a98['Bucket'];_0x43a204[_0xf51c('0x73')]=_0x363a98[_0xf51c('0x74')];logger[_0xf51c('0x69')](util[_0xf51c('0x33')](_0xf51c('0x75'),_0x3b3a07));return startTranscribe(_0x3bf5f9,_0x43d314,_0x1a2c81,uuidv4(),_0x569d17,_0x363a98[_0xf51c('0x74')]);})['then'](function(_0x146999){logger['info'](util[_0xf51c('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x3b3a07,_0x146999[_0xf51c('0x76')]['TranscriptionJobName']));_0x43a204['transcribeName']=_0x146999[_0xf51c('0x76')]['TranscriptionJobName'];_0x43a204[_0xf51c('0x77')]=_0x146999[_0xf51c('0x76')][_0xf51c('0x78')];return _0x2d8d43(_0x43a204);})['catch'](function(_0x53b957){return _0x150d60(_0x53b957);});});}exports[_0xf51c('0x79')]=function(_0x5ddfd4,_0x4a2ed4,_0x4016d5){var _0xa469c8;var _0x463cda;var _0x2f0ef8;var _0x4cd04b=require('../../components/encryptor');return db[_0xf51c('0x2f')]['findOne']({'where':{'id':_0x5ddfd4['params']['id']}})[_0xf51c('0x29')](function(_0x58290d){if(_0x58290d){var _0x376227=util['format']('%s.cypher',_0x58290d[_0xf51c('0x64')]);if(fs['existsSync'](_0x376227)){cypher=!![];return _0x4cd04b['decryptFile'](_0x376227,_0x58290d[_0xf51c('0x64')],config[_0xf51c('0x54')]['recording'])[_0xf51c('0x29')](function(){return _0x58290d;});}return _0x58290d;}})[_0xf51c('0x29')](function(_0x41ef01){if(!_0x41ef01){throw new db[(_0xf51c('0x55'))]['ValidationError'](_0xf51c('0x7a'));}_0x463cda=_0x41ef01;return db[_0xf51c('0x7b')][_0xf51c('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x4a2ed4,null))['then'](function(_0x72fec7){if(_0x72fec7){_0xa469c8=_0x72fec7;if(!_0xa469c8['transcribe']||!_0xa469c8[_0xf51c('0x7d')]||!_0xa469c8['transcribeRegion']||!_0xa469c8['language']||!_0xa469c8[_0xf51c('0x7e')]){throw new db[(_0xf51c('0x55'))][(_0xf51c('0x56'))](_0xf51c('0x7f'));}if(_0x5ddfd4[_0xf51c('0x4b')][_0xf51c('0x80')]&&(!_0xa469c8[_0xf51c('0x81')]||!_0xa469c8[_0xf51c('0x82')]||!_0xa469c8[_0xf51c('0x83')]||!_0xa469c8[_0xf51c('0x84')]||!_0xa469c8['bucket'])){throw new db['Sequelize'][(_0xf51c('0x56'))](_0xf51c('0x85'));}return db[_0xf51c('0x86')]['findOne']({'where':{'id':_0xa469c8[_0xf51c('0x7d')]}});}})[_0xf51c('0x29')](function(_0x20eb37){if(!_0x20eb37){throw new db[(_0xf51c('0x55'))][(_0xf51c('0x56'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x20eb37['data1']||!_0x20eb37[_0xf51c('0x87')]){throw new db[(_0xf51c('0x55'))]['ValidationError'](_0xf51c('0x88'));}_0x2f0ef8=_0x20eb37;return getBucketslist(_0x2f0ef8[_0xf51c('0x89')],_0x2f0ef8[_0xf51c('0x87')],_0xa469c8[_0xf51c('0x8a')]);})[_0xf51c('0x29')](function(_0x53eea4){if(_0x53eea4&&_0x53eea4[_0xf51c('0x8b')]){var _0x332f0b=_[_0xf51c('0x49')](_0x53eea4[_0xf51c('0x8b')],function(_0xf6e000){return _0xf6e000['Name']===_0xa469c8['bucket'];});if(!_0x332f0b){logger[_0xf51c('0x69')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x5ddfd4['params']['id'],_0xa469c8[_0xf51c('0x7e')]));return createBucket(_0x2f0ef8[_0xf51c('0x89')],_0x2f0ef8[_0xf51c('0x87')],_0xa469c8['transcribeRegion'],_0xa469c8[_0xf51c('0x7e')]);}logger[_0xf51c('0x69')](util[_0xf51c('0x33')](_0xf51c('0x8c'),_0x5ddfd4[_0xf51c('0x50')]['id'],_0xa469c8[_0xf51c('0x7e')]));return;}})['then'](function(_0x46dc51){if(_0x463cda['transcribeStatus']==='NEW'){return transcribe(_0x5ddfd4[_0xf51c('0x50')]['id'],_0x2f0ef8['data1'],_0x2f0ef8[_0xf51c('0x87')],_0xa469c8['transcribeRegion'],_0xa469c8['bucket'],_0x463cda['value'],_0xa469c8['language']);}else{logger['info'](util[_0xf51c('0x33')](_0xf51c('0x8d'),_0x5ddfd4[_0xf51c('0x50')]['id']));return{'transcribeStatus':_0xf51c('0x8e')};}})[_0xf51c('0x29')](function(_0x11b7ca){if(_0x11b7ca){_0x11b7ca['tempSentiment']=_0x5ddfd4[_0xf51c('0x4b')][_0xf51c('0x80')];return _0x463cda[_0xf51c('0x8f')](_0x11b7ca);}})[_0xf51c('0x29')](respondWithResult(_0x4a2ed4,null))[_0xf51c('0x45')](handleError(_0x4a2ed4,null));};function writeFile(_0x2bbbc3,_0x379a78){return new Promise(function(_0x41bc12,_0x1d667c){fs[_0xf51c('0x90')](_0x379a78,_0x2bbbc3,function(_0x310696,_0x2ddbe0){if(_0x310696){return _0x1d667c(_0x310696);}else{return _0x41bc12(_0x2ddbe0);}});});}exports['downloadTranscribe']=function(_0x1bee75,_0x3483d1,_0x293cda){return db[_0xf51c('0x2f')][_0xf51c('0x7c')]({'where':{'id':_0x1bee75[_0xf51c('0x50')]['id']}})[_0xf51c('0x29')](handleEntityNotFound(_0x3483d1))['then'](function(_0x357837){if(_0x357837&&_0x357837['fileText']){var _0x9918c=_0x357837['fileText'];var _0x5cdb85=config['root']+_0xf51c('0x91')+_0x357837['id']+'.txt';if(fs[_0xf51c('0x52')](_0x5cdb85)){return _0x5cdb85;}return writeFile(_0x9918c,_0x5cdb85)[_0xf51c('0x29')](function(){return _0x5cdb85;});}else{throw new db[(_0xf51c('0x55'))]['ValidationError'](_0xf51c('0x92'));}})[_0xf51c('0x29')](function(_0x5295af){return _0x3483d1['download'](_0x5295af);})['catch'](handleError(_0x3483d1));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 0bdf82a..3814dee 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 _0xd2e0=['request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xd2e0,0x174));var _0x0d2e=function(_0x53c427,_0x22b3aa){_0x53c427=_0x53c427-0x0;var _0x23c97d=_0xd2e0[_0x53c427];return _0x23c97d;};'use strict';var _=require(_0x0d2e('0x0'));var util=require(_0x0d2e('0x1'));var logger=require(_0x0d2e('0x2'))(_0x0d2e('0x3'));var moment=require('moment');var BPromise=require(_0x0d2e('0x4'));var rp=require(_0x0d2e('0x5'));var fs=require('fs');var path=require(_0x0d2e('0x6'));var rimraf=require(_0x0d2e('0x7'));var config=require(_0x0d2e('0x8'));var attributes=require(_0x0d2e('0x9'));module[_0x0d2e('0xa')]=function(_0x52637b,_0x2bfe5d){return _0x52637b[_0x0d2e('0xb')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x0d2e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb4a1=['api','moment','bluebird','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger'];(function(_0x34456b,_0x4f644b){var _0x42c9e4=function(_0x34207f){while(--_0x34207f){_0x34456b['push'](_0x34456b['shift']());}};_0x42c9e4(++_0x4f644b);}(_0xb4a1,0x65));var _0x1b4a=function(_0x383875,_0x45b02b){_0x383875=_0x383875-0x0;var _0x128fc2=_0xb4a1[_0x383875];return _0x128fc2;};'use strict';var _=require(_0x1b4a('0x0'));var util=require(_0x1b4a('0x1'));var logger=require(_0x1b4a('0x2'))(_0x1b4a('0x3'));var moment=require(_0x1b4a('0x4'));var BPromise=require(_0x1b4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b4a('0x6'));var config=require('../../config/environment');var attributes=require(_0x1b4a('0x7'));module[_0x1b4a('0x8')]=function(_0x48d638,_0x26db0c){return _0x48d638[_0x1b4a('0x9')](_0x1b4a('0xa'),attributes,{'tableName':_0x1b4a('0xb'),'paranoid':![],'indexes':[{'name':_0x1b4a('0xc'),'fields':[_0x1b4a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index be94ac0..4178c6a 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 _0x0598=['catch','UpdateVoiceRecording','VoiceRecording','body','options','where','limit','then','CreateVoiceRecording','../../components/encryptor','callRecordingEncryption','value','format','%s.cypher','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x0598,0x92));var _0x8059=function(_0x412b43,_0x459665){_0x412b43=_0x412b43-0x0;var _0x219e2e=_0x0598[_0x412b43];return _0x219e2e;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5996d7,_0x248273,_0x347f1b){return new BPromise(function(_0x4610d2,_0x116946){return client['request'](_0x5996d7,_0x347f1b)['then'](function(_0x89dda1){logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,_0x8059('0x9'));logger[_0x8059('0xa')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x248273,'request\x20sent',JSON[_0x8059('0xb')](_0x89dda1));if(_0x89dda1[_0x8059('0xc')]){if(_0x89dda1['error']['code']===0x1f4){logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);return _0x116946(_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);}logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1['error'][_0x8059('0xd')]);return _0x4610d2(_0x89dda1['error'][_0x8059('0xd')]);}else{logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,'request\x20sent');_0x4610d2(_0x89dda1['result']['message']);}})[_0x8059('0xe')](function(_0x239195){logger[_0x8059('0xc')](_0x8059('0x8'),_0x248273,_0x239195);_0x116946(_0x239195);});});}exports[_0x8059('0xf')]=function(_0x4b6d55){var _0x10ad98=this;return new Promise(function(_0x2bb670,_0x37e926){return db[_0x8059('0x10')]['update'](_0x4b6d55[_0x8059('0x11')],{'raw':_0x4b6d55['options']?_0x4b6d55[_0x8059('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b6d55[_0x8059('0x12')]?_0x4b6d55['options'][_0x8059('0x13')]||null:null,'attributes':_0x4b6d55[_0x8059('0x12')]?_0x4b6d55[_0x8059('0x12')]['attributes']||null:null,'limit':_0x4b6d55['options']?_0x4b6d55[_0x8059('0x12')][_0x8059('0x14')]||null:null})[_0x8059('0x15')](function(_0x1585a3){logger['info'](_0x8059('0xf'),_0x4b6d55);logger[_0x8059('0xa')](_0x8059('0xf'),_0x4b6d55,JSON['stringify'](_0x1585a3));_0x2bb670(_0x1585a3);})[_0x8059('0xe')](function(_0x2256b1){logger[_0x8059('0xc')](_0x8059('0xf'),_0x2256b1['message'],_0x4b6d55);_0x37e926(_0x10ad98[_0x8059('0xc')](0x1f4,_0x2256b1[_0x8059('0xd')]));});});};exports[_0x8059('0x16')]=function(_0x3e2d2b){var _0x202b30=this;return new Promise(function(_0x54b88b,_0x387350){var _0x19b95a=require(_0x8059('0x17'));var _0x4a294f;return db['Setting']['findOne']({'attributes':['id',_0x8059('0x18')],'where':{'id':0x1},'raw':!![]})[_0x8059('0x15')](function(_0xc32b1f){_0x4a294f=_0xc32b1f;return db[_0x8059('0x10')]['create'](_0x3e2d2b[_0x8059('0x11')]);})['then'](function(_0x2f887c){if(_0x4a294f[_0x8059('0x18')]&&fs['existsSync'](_0x2f887c[_0x8059('0x19')])){var _0x1aead2=util[_0x8059('0x1a')](_0x8059('0x1b'),_0x2f887c[_0x8059('0x19')]);return _0x19b95a[_0x8059('0x1c')](_0x2f887c[_0x8059('0x19')],_0x1aead2,config[_0x8059('0x1d')]['recording'])[_0x8059('0x15')](function(){fs[_0x8059('0x1e')](_0x2f887c[_0x8059('0x19')]);logger[_0x8059('0x7')](_0x8059('0x1f'));return _0x2f887c;});}return _0x2f887c;})['then'](function(_0x39f1c4){logger[_0x8059('0x7')](_0x8059('0x16'),_0x3e2d2b);logger[_0x8059('0xa')](_0x8059('0x16'),_0x3e2d2b,JSON[_0x8059('0xb')](_0x39f1c4));_0x54b88b(_0x39f1c4);})[_0x8059('0xe')](function(_0x175d57){logger[_0x8059('0xc')](_0x8059('0x16'),_0x175d57['message'],_0x3e2d2b);_0x387350(_0x202b30[_0x8059('0xc')](0x1f4,_0x175d57['message']));});});}; \ No newline at end of file +var _0x524e=['UpdateVoiceRecording','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','body','existsSync','value','%s.cypher','recording','unlink','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceRecording','update','options','where','attributes','limit'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x524e,0x15e));var _0xe524=function(_0x575c4c,_0x49ca7e){_0x575c4c=_0x575c4c-0x0;var _0x50f17e=_0x524e[_0x575c4c];return _0x50f17e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});}exports['UpdateVoiceRecording']=function(_0x3a4027){var _0x4f1dfb=this;return new Promise(function(_0x11b2a1,_0x238f8f){return db[_0xe524('0x16')][_0xe524('0x17')](_0x3a4027['body'],{'raw':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x19')]||null:null,'attributes':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'limit':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1b')]||null:null})['then'](function(_0x7d1f92){logger['info']('UpdateVoiceRecording',_0x3a4027);logger[_0xe524('0x10')](_0xe524('0x1c'),_0x3a4027,JSON[_0xe524('0x12')](_0x7d1f92));_0x11b2a1(_0x7d1f92);})[_0xe524('0x1d')](function(_0x599d5d){logger[_0xe524('0x13')]('UpdateVoiceRecording',_0x599d5d[_0xe524('0x15')],_0x3a4027);_0x238f8f(_0x4f1dfb[_0xe524('0x13')](0x1f4,_0x599d5d[_0xe524('0x15')]));});});};exports[_0xe524('0x1e')]=function(_0x4102d9){var _0xfd5965=this;return new Promise(function(_0x2141db,_0x583cc3){var _0x58a896=require(_0xe524('0x1f'));var _0x45abad;return db[_0xe524('0x20')][_0xe524('0x21')]({'attributes':['id',_0xe524('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x52f140){_0x45abad=_0x52f140;return db[_0xe524('0x16')][_0xe524('0x23')](_0x4102d9[_0xe524('0x24')]);})[_0xe524('0xc')](function(_0x25c0a1){if(_0x45abad['callRecordingEncryption']&&fs[_0xe524('0x25')](_0x25c0a1[_0xe524('0x26')])){var _0x4a4e15=util['format'](_0xe524('0x27'),_0x25c0a1[_0xe524('0x26')]);return _0x58a896['encryptFile'](_0x25c0a1[_0xe524('0x26')],_0x4a4e15,config['secrets'][_0xe524('0x28')])['then'](function(){fs[_0xe524('0x29')](_0x25c0a1[_0xe524('0x26')]);logger[_0xe524('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x25c0a1;});}return _0x25c0a1;})[_0xe524('0xc')](function(_0x5238c9){logger[_0xe524('0xd')](_0xe524('0x1e'),_0x4102d9);logger[_0xe524('0x10')]('CreateVoiceRecording',_0x4102d9,JSON[_0xe524('0x12')](_0x5238c9));_0x2141db(_0x5238c9);})[_0xe524('0x1d')](function(_0x49c43e){logger[_0xe524('0x13')](_0xe524('0x1e'),_0x49c43e[_0xe524('0x15')],_0x4102d9);_0x583cc3(_0xfd5965[_0xe524('0x13')](0x1f4,_0x49c43e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 55a215b..66ff64d 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 _0x9e00=['index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9e00,0x1ef));var _0x09e0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9e00[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x09e0('0x0'));var path=require(_0x09e0('0x1'));var timeout=require(_0x09e0('0x2'));var express=require(_0x09e0('0x3'));var router=express[_0x09e0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x09e0('0x5'));var interaction=require(_0x09e0('0x6'));var config=require(_0x09e0('0x7'));var controller=require(_0x09e0('0x8'));router[_0x09e0('0x9')]('/',auth[_0x09e0('0xa')](),controller[_0x09e0('0xb')]);router[_0x09e0('0x9')](_0x09e0('0xc'),auth[_0x09e0('0xa')](),controller[_0x09e0('0xd')]);router['get'](_0x09e0('0xe'),auth[_0x09e0('0xa')](),controller['show']);router[_0x09e0('0xf')]('/',auth['isAuthenticated'](),controller[_0x09e0('0x10')]);router[_0x09e0('0x11')]('/:id',auth[_0x09e0('0xa')](),controller[_0x09e0('0x12')]);router[_0x09e0('0x13')](_0x09e0('0xe'),auth[_0x09e0('0xa')](),controller[_0x09e0('0x14')]);module[_0x09e0('0x15')]=router; \ No newline at end of file +var _0x46c8=['show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x5da27f,_0x504b76){var _0x54a3fb=function(_0x3b65a8){while(--_0x3b65a8){_0x5da27f['push'](_0x5da27f['shift']());}};_0x54a3fb(++_0x504b76);}(_0x46c8,0x1d5));var _0x846c=function(_0x1bfcb3,_0x37a363){_0x1bfcb3=_0x1bfcb3-0x0;var _0x517f7b=_0x46c8[_0x1bfcb3];return _0x517f7b;};'use strict';var multer=require(_0x846c('0x0'));var util=require(_0x846c('0x1'));var path=require(_0x846c('0x2'));var timeout=require(_0x846c('0x3'));var express=require(_0x846c('0x4'));var router=express[_0x846c('0x5')]();var fs_extra=require(_0x846c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x846c('0x7'));var config=require(_0x846c('0x8'));var controller=require(_0x846c('0x9'));router[_0x846c('0xa')]('/',auth[_0x846c('0xb')](),controller[_0x846c('0xc')]);router['get'](_0x846c('0xd'),auth[_0x846c('0xb')](),controller['describe']);router[_0x846c('0xa')](_0x846c('0xe'),auth[_0x846c('0xb')](),controller[_0x846c('0xf')]);router['post']('/',auth[_0x846c('0xb')](),controller[_0x846c('0x10')]);router[_0x846c('0x11')](_0x846c('0xe'),auth[_0x846c('0xb')](),controller[_0x846c('0x12')]);router[_0x846c('0x13')](_0x846c('0xe'),auth['isAuthenticated'](),controller[_0x846c('0x14')]);module[_0x846c('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 12b8bbb..287bc9a 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 _0xe666=['moment','exports','ENUM','STRING','Yes'];(function(_0x42ba81,_0x147f56){var _0x395be1=function(_0x4a25ab){while(--_0x4a25ab){_0x42ba81['push'](_0x42ba81['shift']());}};_0x395be1(++_0x147f56);}(_0xe666,0x1b8));var _0x6e66=function(_0x13f198,_0x3a2508){_0x13f198=_0x13f198-0x0;var _0x15a919=_0xe666[_0x13f198];return _0x15a919;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6e66('0x0'));module[_0x6e66('0x1')]={'type':{'type':Sequelize[_0x6e66('0x2')]('blind','attended')},'result':{'type':Sequelize[_0x6e66('0x3')]},'transfererchannel':{'type':Sequelize[_0x6e66('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x6e66('0x3')]},'transferercalleridname':{'type':Sequelize[_0x6e66('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x6e66('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x6e66('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x6e66('0x3')]},'transferercontext':{'type':Sequelize[_0x6e66('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x6e66('0x3')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x6e66('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x6e66('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x6e66('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x6e66('0x3')]},'transfereecontext':{'type':Sequelize[_0x6e66('0x3')]},'transfereeexten':{'type':Sequelize[_0x6e66('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x6e66('0x3')]},'isexternal':{'type':Sequelize[_0x6e66('0x2')](_0x6e66('0x4'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x6e66('0x3')]}}; \ No newline at end of file +var _0x2eab=['Yes','sequelize','exports','ENUM','attended','STRING'];(function(_0x4f8f18,_0x1a6ab0){var _0x331d0b=function(_0x510c5e){while(--_0x510c5e){_0x4f8f18['push'](_0x4f8f18['shift']());}};_0x331d0b(++_0x1a6ab0);}(_0x2eab,0x127));var _0xb2ea=function(_0x316018,_0xe81000){_0x316018=_0x316018-0x0;var _0xe4f0ed=_0x2eab[_0x316018];return _0xe4f0ed;};'use strict';var Sequelize=require(_0xb2ea('0x0'));var moment=require('moment');module[_0xb2ea('0x1')]={'type':{'type':Sequelize[_0xb2ea('0x2')]('blind',_0xb2ea('0x3'))},'result':{'type':Sequelize[_0xb2ea('0x4')]},'transfererchannel':{'type':Sequelize[_0xb2ea('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xb2ea('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb2ea('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xb2ea('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xb2ea('0x4')]},'transferercontext':{'type':Sequelize[_0xb2ea('0x4')]},'transfererexten':{'type':Sequelize[_0xb2ea('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xb2ea('0x4')]},'transfereechannel':{'type':Sequelize[_0xb2ea('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xb2ea('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xb2ea('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xb2ea('0x4')]},'transfereeexten':{'type':Sequelize[_0xb2ea('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xb2ea('0x2')](_0xb2ea('0x5'),'No')},'context':{'type':Sequelize[_0xb2ea('0x4')]},'extension':{'type':Sequelize[_0xb2ea('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 6e3af7f..a5d1773 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 _0xa997=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','reject','save','update','then','destroy','name','send','map','VoiceTransferReport','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','options','includeAll','rows','params','include','find','catch','body','rimraf','zip-dir','fast-json-patch','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x17638c,_0x47547f){var _0x4db282=function(_0x5bdfa3){while(--_0x5bdfa3){_0x17638c['push'](_0x17638c['shift']());}};_0x4db282(++_0x47547f);}(_0xa997,0xf9));var _0x7a99=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0xa997[_0x5eb22e];return _0x27fed5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a99('0x0'));var zipdir=require(_0x7a99('0x1'));var jsonpatch=require(_0x7a99('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7a99('0x3'));var util=require('util');var path=require(_0x7a99('0x4'));var sox=require(_0x7a99('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a99('0x6'));var _=require(_0x7a99('0x7'));var squel=require(_0x7a99('0x8'));var crypto=require(_0x7a99('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7a99('0xa'));var toCsv=require(_0x7a99('0xb'));var querystring=require(_0x7a99('0xc'));var Papa=require(_0x7a99('0xd'));var Redis=require(_0x7a99('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7a99('0xf'));var hardwareService=require(_0x7a99('0x10'));var logger=require(_0x7a99('0x11'))(_0x7a99('0x12'));var utils=require(_0x7a99('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7a99('0x14'));var db=require(_0x7a99('0x15'))['db'];function respondWithStatusCode(_0x13b7c6,_0x5185ce){_0x5185ce=_0x5185ce||0xcc;return function(_0x37b341){if(_0x37b341){return _0x13b7c6[_0x7a99('0x16')](_0x5185ce);}return _0x13b7c6['status'](_0x5185ce)[_0x7a99('0x17')]();};}function respondWithResult(_0x3565d4,_0x3245b8){_0x3245b8=_0x3245b8||0xc8;return function(_0x4fe92d){if(_0x4fe92d){return _0x3565d4[_0x7a99('0x18')](_0x3245b8)[_0x7a99('0x19')](_0x4fe92d);}};}function respondWithFilteredResult(_0x3a0986,_0x2c0c8f){return function(_0x144fc3){if(_0x144fc3){var _0x45bed4=typeof _0x2c0c8f['offset']===_0x7a99('0x1a')&&typeof _0x2c0c8f['limit']===_0x7a99('0x1a');var _0xfbaad2=_0x144fc3[_0x7a99('0x1b')];var _0x249728=_0x45bed4?0x0:_0x2c0c8f[_0x7a99('0x1c')];var _0x252c24=_0x45bed4?_0x144fc3[_0x7a99('0x1b')]:_0x2c0c8f[_0x7a99('0x1c')]+_0x2c0c8f[_0x7a99('0x1d')];var _0x110398;if(_0x252c24>=_0xfbaad2){_0x252c24=_0xfbaad2;_0x110398=0xc8;}else{_0x110398=0xce;}_0x3a0986[_0x7a99('0x18')](_0x110398);return _0x3a0986[_0x7a99('0x1e')]('Content-Range',_0x249728+'-'+_0x252c24+'/'+_0xfbaad2)[_0x7a99('0x19')](_0x144fc3);}return null;};}function patchUpdates(_0x2bff5e){return function(_0x5edc79){try{jsonpatch['apply'](_0x5edc79,_0x2bff5e,!![]);}catch(_0x5dbd50){return BPromise[_0x7a99('0x1f')](_0x5dbd50);}return _0x5edc79[_0x7a99('0x20')]();};}function saveUpdates(_0x2e2466,_0x4cd88d){return function(_0x5a6502){if(_0x5a6502){return _0x5a6502[_0x7a99('0x21')](_0x2e2466)[_0x7a99('0x22')](function(_0x3e9697){return _0x3e9697;});}return null;};}function removeEntity(_0x3f1eef,_0x463fe8){return function(_0x389094){if(_0x389094){return _0x389094[_0x7a99('0x23')]()['then'](function(){_0x3f1eef[_0x7a99('0x18')](0xcc)[_0x7a99('0x17')]();});}};}function handleEntityNotFound(_0x46d5cc,_0x14f7b7){return function(_0x29141a){if(!_0x29141a){_0x46d5cc[_0x7a99('0x16')](0x194);}return _0x29141a;};}function handleError(_0x1430bc,_0x58e076){_0x58e076=_0x58e076||0x1f4;return function(_0x24f3e3){logger['error'](_0x24f3e3['stack']);if(_0x24f3e3[_0x7a99('0x24')]){delete _0x24f3e3[_0x7a99('0x24')];}_0x1430bc[_0x7a99('0x18')](_0x58e076)[_0x7a99('0x25')](_0x24f3e3);};}exports['index']=function(_0x162e5e,_0x36ea9f){var _0x4a576c={},_0x57ce68={},_0x1bf756={'count':0x0,'rows':[]};var _0x1a9688=_[_0x7a99('0x26')](db[_0x7a99('0x27')][_0x7a99('0x28')],function(_0x6adfc5){return{'name':_0x6adfc5['fieldName'],'type':_0x6adfc5[_0x7a99('0x29')][_0x7a99('0x2a')]};});_0x57ce68[_0x7a99('0x2b')]=_[_0x7a99('0x26')](_0x1a9688,_0x7a99('0x24'));_0x57ce68['query']=_[_0x7a99('0x2c')](_0x162e5e['query']);_0x57ce68['filters']=_[_0x7a99('0x2d')](_0x57ce68[_0x7a99('0x2b')],_0x57ce68[_0x7a99('0x2e')]);_0x4a576c[_0x7a99('0x2f')]=_['intersection'](_0x57ce68['model'],qs[_0x7a99('0x30')](_0x162e5e[_0x7a99('0x2e')][_0x7a99('0x30')]));_0x4a576c[_0x7a99('0x2f')]=_0x4a576c[_0x7a99('0x2f')][_0x7a99('0x31')]?_0x4a576c[_0x7a99('0x2f')]:_0x57ce68[_0x7a99('0x2b')];if(!_0x162e5e[_0x7a99('0x2e')][_0x7a99('0x32')](_0x7a99('0x33'))){_0x4a576c[_0x7a99('0x1d')]=qs[_0x7a99('0x1d')](_0x162e5e[_0x7a99('0x2e')][_0x7a99('0x1d')]);_0x4a576c[_0x7a99('0x1c')]=qs[_0x7a99('0x1c')](_0x162e5e[_0x7a99('0x2e')][_0x7a99('0x1c')]);}_0x4a576c['order']=qs[_0x7a99('0x34')](_0x162e5e[_0x7a99('0x2e')]['sort']);_0x4a576c['where']=qs[_0x7a99('0x35')](_[_0x7a99('0x36')](_0x162e5e['query'],_0x57ce68[_0x7a99('0x35')]),_0x1a9688);if(_0x162e5e[_0x7a99('0x2e')][_0x7a99('0x37')]){_0x4a576c[_0x7a99('0x38')]=_[_0x7a99('0x39')](_0x4a576c[_0x7a99('0x38')],{'$or':_[_0x7a99('0x26')](_0x1a9688,function(_0x5527cf){if(_0x5527cf[_0x7a99('0x29')]!=='VIRTUAL'){var _0x1e338d={};_0x1e338d[_0x5527cf['name']]={'$like':'%'+_0x162e5e[_0x7a99('0x2e')]['filter']+'%'};return _0x1e338d;}})});}_0x4a576c=_[_0x7a99('0x39')]({},_0x4a576c,_0x162e5e[_0x7a99('0x3a')]);var _0x5115a0={'where':_0x4a576c[_0x7a99('0x38')]};return db['VoiceTransferReport'][_0x7a99('0x1b')](_0x5115a0)[_0x7a99('0x22')](function(_0x37fb9a){_0x1bf756['count']=_0x37fb9a;if(_0x162e5e[_0x7a99('0x2e')][_0x7a99('0x3b')]){_0x4a576c['include']=[{'all':!![]}];}return db[_0x7a99('0x27')]['findAll'](_0x4a576c);})[_0x7a99('0x22')](function(_0x433394){_0x1bf756[_0x7a99('0x3c')]=_0x433394;return _0x1bf756;})[_0x7a99('0x22')](respondWithFilteredResult(_0x36ea9f,_0x4a576c))['catch'](handleError(_0x36ea9f,null));};exports['show']=function(_0x345cc6,_0x2c19fa){var _0x2f27f5={'raw':!![],'where':{'id':_0x345cc6[_0x7a99('0x3d')]['id']}},_0x5b9a7a={};_0x5b9a7a[_0x7a99('0x2b')]=_['keys'](db[_0x7a99('0x27')]['rawAttributes']);_0x5b9a7a[_0x7a99('0x2e')]=_['keys'](_0x345cc6['query']);_0x5b9a7a[_0x7a99('0x35')]=_[_0x7a99('0x2d')](_0x5b9a7a['model'],_0x5b9a7a['query']);_0x2f27f5[_0x7a99('0x2f')]=_[_0x7a99('0x2d')](_0x5b9a7a['model'],qs[_0x7a99('0x30')](_0x345cc6[_0x7a99('0x2e')][_0x7a99('0x30')]));_0x2f27f5[_0x7a99('0x2f')]=_0x2f27f5[_0x7a99('0x2f')][_0x7a99('0x31')]?_0x2f27f5[_0x7a99('0x2f')]:_0x5b9a7a[_0x7a99('0x2b')];if(_0x345cc6[_0x7a99('0x2e')][_0x7a99('0x3b')]){_0x2f27f5[_0x7a99('0x3e')]=[{'all':!![]}];}_0x2f27f5=_[_0x7a99('0x39')]({},_0x2f27f5,_0x345cc6[_0x7a99('0x3a')]);return db[_0x7a99('0x27')][_0x7a99('0x3f')](_0x2f27f5)[_0x7a99('0x22')](handleEntityNotFound(_0x2c19fa,null))['then'](respondWithResult(_0x2c19fa,null))[_0x7a99('0x40')](handleError(_0x2c19fa,null));};exports['create']=function(_0x287415,_0xee22e4){return db[_0x7a99('0x27')]['create'](_0x287415[_0x7a99('0x41')],{})['then'](respondWithResult(_0xee22e4,0xc9))['catch'](handleError(_0xee22e4,null));};exports['update']=function(_0x2d7ccf,_0x55cec7){if(_0x2d7ccf['body']['id']){delete _0x2d7ccf[_0x7a99('0x41')]['id'];}return db[_0x7a99('0x27')][_0x7a99('0x3f')]({'where':{'id':_0x2d7ccf[_0x7a99('0x3d')]['id']}})[_0x7a99('0x22')](handleEntityNotFound(_0x55cec7,null))[_0x7a99('0x22')](saveUpdates(_0x2d7ccf[_0x7a99('0x41')],null))['then'](respondWithResult(_0x55cec7,null))[_0x7a99('0x40')](handleError(_0x55cec7,null));};exports['destroy']=function(_0x579317,_0x399d34){return db[_0x7a99('0x27')][_0x7a99('0x3f')]({'where':{'id':_0x579317[_0x7a99('0x3d')]['id']}})[_0x7a99('0x22')](handleEntityNotFound(_0x399d34,null))[_0x7a99('0x22')](removeEntity(_0x399d34,null))[_0x7a99('0x40')](handleError(_0x399d34,null));};exports['describe']=function(_0x8a8f4e,_0x186148){return db['VoiceTransferReport']['describe']()[_0x7a99('0x22')](respondWithResult(_0x186148,null))[_0x7a99('0x40')](handleError(_0x186148,null));}; \ No newline at end of file +var _0x52be=['attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0x52be,0xaf));var _0xe52b=function(_0x24618a,_0x2cd0f4){_0x24618a=_0x24618a-0x0;var _0x2e3d64=_0x52be[_0x24618a];return _0x2e3d64;};'use strict';var emlformat=require(_0xe52b('0x0'));var rimraf=require(_0xe52b('0x1'));var zipdir=require(_0xe52b('0x2'));var jsonpatch=require(_0xe52b('0x3'));var rp=require(_0xe52b('0x4'));var moment=require(_0xe52b('0x5'));var BPromise=require(_0xe52b('0x6'));var Mustache=require(_0xe52b('0x7'));var util=require(_0xe52b('0x8'));var path=require(_0xe52b('0x9'));var sox=require(_0xe52b('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe52b('0xb'));var _=require(_0xe52b('0xc'));var squel=require(_0xe52b('0xd'));var crypto=require(_0xe52b('0xe'));var jsforce=require(_0xe52b('0xf'));var deskjs=require(_0xe52b('0x10'));var toCsv=require(_0xe52b('0x11'));var querystring=require(_0xe52b('0x12'));var Papa=require('papaparse');var Redis=require(_0xe52b('0x13'));var authService=require(_0xe52b('0x14'));var qs=require(_0xe52b('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe52b('0x16'))('api');var utils=require(_0xe52b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe52b('0x18'));var db=require(_0xe52b('0x19'))['db'];function respondWithStatusCode(_0x7b01bf,_0x4e28ce){_0x4e28ce=_0x4e28ce||0xcc;return function(_0x2b42bb){if(_0x2b42bb){return _0x7b01bf[_0xe52b('0x1a')](_0x4e28ce);}return _0x7b01bf['status'](_0x4e28ce)['end']();};}function respondWithResult(_0x1fc443,_0xd0045e){_0xd0045e=_0xd0045e||0xc8;return function(_0x222ffd){if(_0x222ffd){return _0x1fc443[_0xe52b('0x1b')](_0xd0045e)[_0xe52b('0x1c')](_0x222ffd);}};}function respondWithFilteredResult(_0x49cb68,_0x2c4f8b){return function(_0x2cf87b){if(_0x2cf87b){var _0x58c3c0=typeof _0x2c4f8b[_0xe52b('0x1d')]===_0xe52b('0x1e')&&typeof _0x2c4f8b[_0xe52b('0x1f')]===_0xe52b('0x1e');var _0x2cd0b2=_0x2cf87b[_0xe52b('0x20')];var _0x55f21e=_0x58c3c0?0x0:_0x2c4f8b[_0xe52b('0x1d')];var _0x56fb02=_0x58c3c0?_0x2cf87b[_0xe52b('0x20')]:_0x2c4f8b[_0xe52b('0x1d')]+_0x2c4f8b['limit'];var _0x51721d;if(_0x56fb02>=_0x2cd0b2){_0x56fb02=_0x2cd0b2;_0x51721d=0xc8;}else{_0x51721d=0xce;}_0x49cb68['status'](_0x51721d);return _0x49cb68['set'](_0xe52b('0x21'),_0x55f21e+'-'+_0x56fb02+'/'+_0x2cd0b2)[_0xe52b('0x1c')](_0x2cf87b);}return null;};}function patchUpdates(_0x87c10a){return function(_0xe38627){try{jsonpatch[_0xe52b('0x22')](_0xe38627,_0x87c10a,!![]);}catch(_0xae3423){return BPromise[_0xe52b('0x23')](_0xae3423);}return _0xe38627['save']();};}function saveUpdates(_0x3f83ee,_0x3c6a9c){return function(_0x3d2544){if(_0x3d2544){return _0x3d2544[_0xe52b('0x24')](_0x3f83ee)[_0xe52b('0x25')](function(_0x1c3b49){return _0x1c3b49;});}return null;};}function removeEntity(_0x3b63e7,_0x145863){return function(_0x4cb8c6){if(_0x4cb8c6){return _0x4cb8c6[_0xe52b('0x26')]()[_0xe52b('0x25')](function(){_0x3b63e7[_0xe52b('0x1b')](0xcc)[_0xe52b('0x27')]();});}};}function handleEntityNotFound(_0x5c5154,_0x3f955e){return function(_0x580683){if(!_0x580683){_0x5c5154[_0xe52b('0x1a')](0x194);}return _0x580683;};}function handleError(_0x1952ca,_0x950121){_0x950121=_0x950121||0x1f4;return function(_0x5814e3){logger[_0xe52b('0x28')](_0x5814e3[_0xe52b('0x29')]);if(_0x5814e3[_0xe52b('0x2a')]){delete _0x5814e3[_0xe52b('0x2a')];}_0x1952ca[_0xe52b('0x1b')](_0x950121)['send'](_0x5814e3);};}exports[_0xe52b('0x2b')]=function(_0x9e82dc,_0x4513e0){var _0x5635d6={},_0xac7402={},_0x5630d0={'count':0x0,'rows':[]};var _0x1deec8=_[_0xe52b('0x2c')](db['VoiceTransferReport'][_0xe52b('0x2d')],function(_0x10153c){return{'name':_0x10153c[_0xe52b('0x2e')],'type':_0x10153c[_0xe52b('0x2f')]['key']};});_0xac7402[_0xe52b('0x30')]=_[_0xe52b('0x2c')](_0x1deec8,_0xe52b('0x2a'));_0xac7402[_0xe52b('0x31')]=_[_0xe52b('0x32')](_0x9e82dc[_0xe52b('0x31')]);_0xac7402[_0xe52b('0x33')]=_[_0xe52b('0x34')](_0xac7402[_0xe52b('0x30')],_0xac7402[_0xe52b('0x31')]);_0x5635d6[_0xe52b('0x35')]=_[_0xe52b('0x34')](_0xac7402[_0xe52b('0x30')],qs['fields'](_0x9e82dc[_0xe52b('0x31')][_0xe52b('0x36')]));_0x5635d6[_0xe52b('0x35')]=_0x5635d6[_0xe52b('0x35')][_0xe52b('0x37')]?_0x5635d6[_0xe52b('0x35')]:_0xac7402[_0xe52b('0x30')];if(!_0x9e82dc[_0xe52b('0x31')]['hasOwnProperty'](_0xe52b('0x38'))){_0x5635d6[_0xe52b('0x1f')]=qs['limit'](_0x9e82dc['query'][_0xe52b('0x1f')]);_0x5635d6[_0xe52b('0x1d')]=qs[_0xe52b('0x1d')](_0x9e82dc[_0xe52b('0x31')]['offset']);}_0x5635d6[_0xe52b('0x39')]=qs[_0xe52b('0x3a')](_0x9e82dc[_0xe52b('0x31')][_0xe52b('0x3a')]);_0x5635d6[_0xe52b('0x3b')]=qs[_0xe52b('0x33')](_['pick'](_0x9e82dc[_0xe52b('0x31')],_0xac7402[_0xe52b('0x33')]),_0x1deec8);if(_0x9e82dc[_0xe52b('0x31')][_0xe52b('0x3c')]){_0x5635d6[_0xe52b('0x3b')]=_[_0xe52b('0x3d')](_0x5635d6[_0xe52b('0x3b')],{'$or':_[_0xe52b('0x2c')](_0x1deec8,function(_0x3fc91d){if(_0x3fc91d['type']!==_0xe52b('0x3e')){var _0x1d2799={};_0x1d2799[_0x3fc91d[_0xe52b('0x2a')]]={'$like':'%'+_0x9e82dc[_0xe52b('0x31')][_0xe52b('0x3c')]+'%'};return _0x1d2799;}})});}_0x5635d6=_[_0xe52b('0x3d')]({},_0x5635d6,_0x9e82dc[_0xe52b('0x3f')]);var _0x1fe7d9={'where':_0x5635d6[_0xe52b('0x3b')]};return db[_0xe52b('0x40')][_0xe52b('0x20')](_0x1fe7d9)[_0xe52b('0x25')](function(_0x5e7d01){_0x5630d0['count']=_0x5e7d01;if(_0x9e82dc[_0xe52b('0x31')][_0xe52b('0x41')]){_0x5635d6[_0xe52b('0x42')]=[{'all':!![]}];}return db[_0xe52b('0x40')][_0xe52b('0x43')](_0x5635d6);})[_0xe52b('0x25')](function(_0x1f8f37){_0x5630d0[_0xe52b('0x44')]=_0x1f8f37;return _0x5630d0;})[_0xe52b('0x25')](respondWithFilteredResult(_0x4513e0,_0x5635d6))[_0xe52b('0x45')](handleError(_0x4513e0,null));};exports[_0xe52b('0x46')]=function(_0x2639f5,_0x3eb3e5){var _0x2f8748={'raw':!![],'where':{'id':_0x2639f5[_0xe52b('0x47')]['id']}},_0x291438={};_0x291438['model']=_[_0xe52b('0x32')](db[_0xe52b('0x40')][_0xe52b('0x2d')]);_0x291438['query']=_[_0xe52b('0x32')](_0x2639f5[_0xe52b('0x31')]);_0x291438['filters']=_[_0xe52b('0x34')](_0x291438['model'],_0x291438['query']);_0x2f8748[_0xe52b('0x35')]=_[_0xe52b('0x34')](_0x291438['model'],qs[_0xe52b('0x36')](_0x2639f5[_0xe52b('0x31')][_0xe52b('0x36')]));_0x2f8748[_0xe52b('0x35')]=_0x2f8748[_0xe52b('0x35')]['length']?_0x2f8748['attributes']:_0x291438[_0xe52b('0x30')];if(_0x2639f5['query']['includeAll']){_0x2f8748[_0xe52b('0x42')]=[{'all':!![]}];}_0x2f8748=_[_0xe52b('0x3d')]({},_0x2f8748,_0x2639f5['options']);return db['VoiceTransferReport'][_0xe52b('0x48')](_0x2f8748)[_0xe52b('0x25')](handleEntityNotFound(_0x3eb3e5,null))['then'](respondWithResult(_0x3eb3e5,null))['catch'](handleError(_0x3eb3e5,null));};exports['create']=function(_0x4f0903,_0x18db08){return db[_0xe52b('0x40')][_0xe52b('0x49')](_0x4f0903['body'],{})[_0xe52b('0x25')](respondWithResult(_0x18db08,0xc9))[_0xe52b('0x45')](handleError(_0x18db08,null));};exports[_0xe52b('0x24')]=function(_0x9310c5,_0x272160){if(_0x9310c5[_0xe52b('0x4a')]['id']){delete _0x9310c5[_0xe52b('0x4a')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x9310c5[_0xe52b('0x47')]['id']}})['then'](handleEntityNotFound(_0x272160,null))[_0xe52b('0x25')](saveUpdates(_0x9310c5[_0xe52b('0x4a')],null))[_0xe52b('0x25')](respondWithResult(_0x272160,null))['catch'](handleError(_0x272160,null));};exports[_0xe52b('0x26')]=function(_0x2a2628,_0x484d5e){return db['VoiceTransferReport'][_0xe52b('0x48')]({'where':{'id':_0x2a2628[_0xe52b('0x47')]['id']}})[_0xe52b('0x25')](handleEntityNotFound(_0x484d5e,null))[_0xe52b('0x25')](removeEntity(_0x484d5e,null))['catch'](handleError(_0x484d5e,null));};exports[_0xe52b('0x4b')]=function(_0x3d080b,_0x5d0ce0){return db[_0xe52b('0x40')]['describe']()[_0xe52b('0x25')](respondWithResult(_0x5d0ce0,null))[_0xe52b('0x45')](handleError(_0x5d0ce0,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index bec1b2f..25e5509 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 _0xb6d9=['define','VoiceTransferReport','report_call_transfer','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports'];(function(_0x43c71d,_0x243746){var _0x1168f0=function(_0x56c725){while(--_0x56c725){_0x43c71d['push'](_0x43c71d['shift']());}};_0x1168f0(++_0x243746);}(_0xb6d9,0x87));var _0x9b6d=function(_0x479387,_0xdea27f){_0x479387=_0x479387-0x0;var _0x3436d0=_0xb6d9[_0x479387];return _0x3436d0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9b6d('0x0'));var moment=require(_0x9b6d('0x1'));var BPromise=require(_0x9b6d('0x2'));var rp=require(_0x9b6d('0x3'));var fs=require('fs');var path=require(_0x9b6d('0x4'));var rimraf=require(_0x9b6d('0x5'));var config=require(_0x9b6d('0x6'));var attributes=require(_0x9b6d('0x7'));module[_0x9b6d('0x8')]=function(_0x2ba20d,_0x39318f){return _0x2ba20d[_0x9b6d('0x9')](_0x9b6d('0xa'),attributes,{'tableName':_0x9b6d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9b0=['api','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0xa9b0,0x1de));var _0x0a9b=function(_0x2ae8ce,_0x2a5a1f){_0x2ae8ce=_0x2ae8ce-0x0;var _0x4bf686=_0xa9b0[_0x2ae8ce];return _0x4bf686;};'use strict';var _=require(_0x0a9b('0x0'));var util=require(_0x0a9b('0x1'));var logger=require(_0x0a9b('0x2'))(_0x0a9b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0a9b('0x4'));var fs=require('fs');var path=require(_0x0a9b('0x5'));var rimraf=require(_0x0a9b('0x6'));var config=require(_0x0a9b('0x7'));var attributes=require(_0x0a9b('0x8'));module[_0x0a9b('0x9')]=function(_0x364349,_0x3a47db){return _0x364349[_0x0a9b('0xa')](_0x0a9b('0xb'),attributes,{'tableName':_0x0a9b('0xc'),'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 6c61eff..66dc9d2 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 _0xfd5f=['VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x42f0d1,_0x45fe4a){var _0x43f981=function(_0x5882e8){while(--_0x5882e8){_0x42f0d1['push'](_0x42f0d1['shift']());}};_0x43f981(++_0x45fe4a);}(_0xfd5f,0x1c2));var _0xffd5=function(_0x22e25d,_0x5ba043){_0x22e25d=_0x22e25d-0x0;var _0x3d2755=_0xfd5f[_0x22e25d];return _0x3d2755;};'use strict';var _=require(_0xffd5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xffd5('0x1'));var rs=require(_0xffd5('0x2'));var fs=require('fs');var Redis=require(_0xffd5('0x3'));var db=require(_0xffd5('0x4'))['db'];var utils=require(_0xffd5('0x5'));var logger=require(_0xffd5('0x6'))(_0xffd5('0x7'));var config=require(_0xffd5('0x8'));var jayson=require(_0xffd5('0x9'));var client=jayson[_0xffd5('0xa')][_0xffd5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x379f3f,_0x43d9ab,_0x305133){return new BPromise(function(_0x461b50,_0xc1ae48){return client[_0xffd5('0xc')](_0x379f3f,_0x305133)[_0xffd5('0xd')](function(_0x52762a){logger['info'](_0xffd5('0xe'),_0x43d9ab,_0xffd5('0xf'));logger['debug'](_0xffd5('0x10'),_0x43d9ab,_0xffd5('0xf'),JSON['stringify'](_0x52762a));if(_0x52762a[_0xffd5('0x11')]){if(_0x52762a[_0xffd5('0x11')][_0xffd5('0x12')]===0x1f4){logger[_0xffd5('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x43d9ab,_0x52762a['error'][_0xffd5('0x13')]);return _0xc1ae48(_0x52762a[_0xffd5('0x11')][_0xffd5('0x13')]);}logger[_0xffd5('0x11')](_0xffd5('0xe'),_0x43d9ab,_0x52762a[_0xffd5('0x11')][_0xffd5('0x13')]);return _0x461b50(_0x52762a[_0xffd5('0x11')][_0xffd5('0x13')]);}else{logger[_0xffd5('0x14')](_0xffd5('0xe'),_0x43d9ab,'request\x20sent');_0x461b50(_0x52762a[_0xffd5('0x15')][_0xffd5('0x13')]);}})[_0xffd5('0x16')](function(_0x2f8593){logger[_0xffd5('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x43d9ab,_0x2f8593);_0xc1ae48(_0x2f8593);});});}exports[_0xffd5('0x17')]=function(_0x35fce1){var _0x592db1=this;return new Promise(function(_0x4be273,_0x5730d3){return db[_0xffd5('0x18')][_0xffd5('0x19')](_0x35fce1[_0xffd5('0x1a')],{'raw':_0x35fce1[_0xffd5('0x1b')]?_0x35fce1[_0xffd5('0x1b')][_0xffd5('0x1c')]===undefined?!![]:![]:!![]})[_0xffd5('0xd')](function(_0x42f271){logger[_0xffd5('0x14')](_0xffd5('0x17'),_0x35fce1);logger['debug'](_0xffd5('0x17'),_0x35fce1,JSON['stringify'](_0x42f271));_0x4be273(_0x42f271);})['catch'](function(_0x3e5e93){logger[_0xffd5('0x11')](_0xffd5('0x17'),_0x3e5e93[_0xffd5('0x13')],_0x35fce1);_0x5730d3(_0x592db1[_0xffd5('0x11')](0x1f4,_0x3e5e93[_0xffd5('0x13')]));});});}; \ No newline at end of file +var _0x27ab=['raw','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateVoiceTransferReport','create','options'];(function(_0x5239f6,_0x3bc30a){var _0xb66a8b=function(_0x3573ac){while(--_0x3573ac){_0x5239f6['push'](_0x5239f6['shift']());}};_0xb66a8b(++_0x3bc30a);}(_0x27ab,0x75));var _0xb27a=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x27ab[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0xb27a('0x0'));var util=require(_0xb27a('0x1'));var moment=require(_0xb27a('0x2'));var BPromise=require(_0xb27a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb27a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb27a('0x5'));var logger=require('../../config/logger')(_0xb27a('0x6'));var config=require(_0xb27a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb27a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11b1eb,_0x346596,_0x3a1d92){return new BPromise(function(_0xb3c2dc,_0xc12530){return client['request'](_0x11b1eb,_0x3a1d92)[_0xb27a('0x9')](function(_0xc15f0c){logger[_0xb27a('0xa')](_0xb27a('0xb'),_0x346596,_0xb27a('0xc'));logger[_0xb27a('0xd')](_0xb27a('0xe'),_0x346596,'request\x20sent',JSON['stringify'](_0xc15f0c));if(_0xc15f0c[_0xb27a('0xf')]){if(_0xc15f0c[_0xb27a('0xf')]['code']===0x1f4){logger[_0xb27a('0xf')](_0xb27a('0xb'),_0x346596,_0xc15f0c[_0xb27a('0xf')][_0xb27a('0x10')]);return _0xc12530(_0xc15f0c['error']['message']);}logger[_0xb27a('0xf')](_0xb27a('0xb'),_0x346596,_0xc15f0c[_0xb27a('0xf')][_0xb27a('0x10')]);return _0xb3c2dc(_0xc15f0c[_0xb27a('0xf')][_0xb27a('0x10')]);}else{logger[_0xb27a('0xa')](_0xb27a('0xb'),_0x346596,_0xb27a('0xc'));_0xb3c2dc(_0xc15f0c['result']['message']);}})[_0xb27a('0x11')](function(_0xd35598){logger[_0xb27a('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x346596,_0xd35598);_0xc12530(_0xd35598);});});}exports[_0xb27a('0x12')]=function(_0x26b0ac){var _0x309acf=this;return new Promise(function(_0x2280b5,_0xd793a0){return db['VoiceTransferReport'][_0xb27a('0x13')](_0x26b0ac['body'],{'raw':_0x26b0ac['options']?_0x26b0ac[_0xb27a('0x14')][_0xb27a('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x807293){logger[_0xb27a('0xa')](_0xb27a('0x12'),_0x26b0ac);logger[_0xb27a('0xd')](_0xb27a('0x12'),_0x26b0ac,JSON[_0xb27a('0x16')](_0x807293));_0x2280b5(_0x807293);})['catch'](function(_0x3cf106){logger[_0xb27a('0xf')](_0xb27a('0x12'),_0x3cf106['message'],_0x26b0ac);_0xd793a0(_0x309acf[_0xb27a('0xf')](0x1f4,_0x3cf106[_0xb27a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index b8b7fd2..622a13a 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 _0xf3cd=['/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','isAuthenticated','hangup','/answer','answer'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x78db5e,_0x3b9804){_0x78db5e=_0x78db5e-0x0;var _0x250b88=_0xf3cd[_0x78db5e];return _0x250b88;};'use strict';var express=require(_0xdf3c('0x0'));var router=express[_0xdf3c('0x1')]();var auth=require(_0xdf3c('0x2'));var controller=require(_0xdf3c('0x3'));router[_0xdf3c('0x4')](_0xdf3c('0x5'),auth['isAuthenticated'](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x7')]);router[_0xdf3c('0x4')]('/hangup',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x9')]);router[_0xdf3c('0x4')](_0xdf3c('0xa'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xb')]);router['post']('/hold',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller['hold']);router[_0xdf3c('0x4')](_0xdf3c('0xc'),auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0x4')](_0xdf3c('0xe'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x4')](_0xdf3c('0x10'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0x11')]);module[_0xdf3c('0x12')]=router; \ No newline at end of file +var _0xb821=['/unhold','unhold','/calls','calls','/transfer','Router','../../components/auth/service','/originate','originate','post','/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','answer','/hold','hold'];(function(_0x1a09f3,_0x55835f){var _0x4bf28c=function(_0x543041){while(--_0x543041){_0x1a09f3['push'](_0x1a09f3['shift']());}};_0x4bf28c(++_0x55835f);}(_0xb821,0xa7));var _0x1b82=function(_0x3b81e9,_0x53525f){_0x3b81e9=_0x3b81e9-0x0;var _0x413f2d=_0xb821[_0x3b81e9];return _0x413f2d;};'use strict';var express=require('express');var router=express[_0x1b82('0x0')]();var auth=require(_0x1b82('0x1'));var controller=require('./webbar.controller');router['post'](_0x1b82('0x2'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x1b82('0x3')]);router[_0x1b82('0x4')](_0x1b82('0x5'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x4')](_0x1b82('0x8'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x4')](_0x1b82('0xb'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0xc')]);router[_0x1b82('0x4')](_0x1b82('0xd'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xe')]);router[_0x1b82('0x4')](_0x1b82('0xf'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller[_0x1b82('0x10')]);router[_0x1b82('0x4')](_0x1b82('0x11'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller['transfer']);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 9c9e492..9bdae2d 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 _0x4d9e=['length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','then','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','userId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','transfer','transferNumber','path','../../config/environment','bluebird','client','http','webbarapi','ioredis','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','info','handleError:','stack','name','status','send','NotFound','request','error','code','message','result','catch','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId'];(function(_0x3c04ef,_0x9d110c){var _0x6a3a69=function(_0x333514){while(--_0x333514){_0x3c04ef['push'](_0x3c04ef['shift']());}};_0x6a3a69(++_0x9d110c);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x2f4c11,_0x3c09dc){_0x2f4c11=_0x2f4c11-0x0;var _0x502388=_0x4d9e[_0x2f4c11];return _0x502388;};'use strict';var path=require(_0xe4d9('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0xe4d9('0x1'));var util=require('util');var BPromise=require(_0xe4d9('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0xe4d9('0x3')][_0xe4d9('0x4')]({'port':0x232a});var logger=require('../../config/logger')(_0xe4d9('0x5'));var Redis=require(_0xe4d9('0x6'));config[_0xe4d9('0x7')]=_[_0xe4d9('0x8')](config[_0xe4d9('0x7')],{'host':_0xe4d9('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe4d9('0x7')]));var Schema=require(_0xe4d9('0xa'));var originateValidation=new Schema({'userId':{'type':_0xe4d9('0xb'),'required':[!![],_0xe4d9('0xc')]},'callNumber':{'type':_0xe4d9('0xd'),'required':[!![],_0xe4d9('0xe')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xe4d9('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0xe4d9('0xb'),'required':[!![],_0xe4d9('0xc')]},'sessionId':{'type':_0xe4d9('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xe4d9('0xb'),'required':[!![],_0xe4d9('0xc')]},'sessionId':{'type':_0xe4d9('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xe4d9('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe4d9('0xb'),'required':[!![],_0xe4d9('0xc')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xe4d9('0xb'),'required':[!![],_0xe4d9('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0xe4d9('0xb'),'required':[!![],_0xe4d9('0xc')]}});function emit(_0x58d0cf,_0x331ef3,_0x35cbc2){logger[_0xe4d9('0xf')](_0x58d0cf,_0x331ef3,JSON['stringify'](_0x35cbc2));io['to'](_0x58d0cf)['emit'](_0x331ef3,_0x35cbc2);}function handleError(_0x7abb80){return function(_0x112315){console['log'](_0xe4d9('0x10'),_0x112315,_0x112315 instanceof RangeError);logger['error'](_0x112315[_0xe4d9('0x11')]);if(_0x112315 instanceof RangeError){if(_0x112315[_0xe4d9('0x12')]){delete _0x112315[_0xe4d9('0x12')];}_0x7abb80[_0xe4d9('0x13')](0x194)['send'](_0x112315);}else{if(_0x112315[_0xe4d9('0x12')]){delete _0x112315[_0xe4d9('0x12')];}_0x7abb80[_0xe4d9('0x13')](0x1f4)[_0xe4d9('0x14')](_0x112315);}};}function checkError(){return function(_0x2c6b89){if(!_0x2c6b89){throw new RangeError(_0xe4d9('0x15'));}return _0x2c6b89;};}function respondWithRpcPromise(_0x30d923,_0x29e0c9){return new BPromise(function(_0x562bab,_0x4fed7f){var _0x44f1aa=amiClient;return _0x44f1aa[_0xe4d9('0x16')](_0x30d923,_0x29e0c9)['then'](function(_0x189dad){if(_0x189dad['error']){if(_0x189dad[_0xe4d9('0x17')][_0xe4d9('0x18')]===0x1f4){return _0x4fed7f(_0x189dad['error'][_0xe4d9('0x19')]);}return _0x562bab(_0x189dad[_0xe4d9('0x17')]['message']);}else{_0x562bab(_0x189dad[_0xe4d9('0x1a')]);}})[_0xe4d9('0x1b')](function(_0x36444c){_0x4fed7f(_0x36444c);});});}function getAgent(_0x5bb43b){return db['User'][_0xe4d9('0x1c')]({'where':{'id':_0x5bb43b,'role':_0xe4d9('0x1d')}})['then'](checkError());}function getAgentCheckSession(_0x5dddd2,_0x4954b5){return new BPromise(function(_0x529e2b,_0x221a61){var _0x48d481=respondWithRpcPromise(_0xe4d9('0x1e'));var _0x1f3d90=getAgent(_0x5dddd2);Promise[_0xe4d9('0x1f')]([_0x48d481,_0x1f3d90])['then'](function(_0xec8d64){var _0x2a0d1f=_0xec8d64[0x0];var _0x250de5=_0xec8d64[0x1];var _0x45e8a3=_[_0xe4d9('0x20')](_0x2a0d1f[_0xe4d9('0x21')],function(_0x21b7a9){return _0x21b7a9[_0xe4d9('0x22')]==_0x250de5['id']&&_0x21b7a9[_0xe4d9('0x23')]==_0x4954b5;});if(_0x45e8a3[_0xe4d9('0x24')]==0x1){_0x529e2b(_0x250de5);}else{_0x221a61(new RangeError(_0xe4d9('0x25')+_0x4954b5+_0xe4d9('0x26')));}});});}exports['originate']=function(_0x22efd2,_0x349be3){logger[_0xe4d9('0xf')](_0xe4d9('0x27'),_0x22efd2[_0xe4d9('0x28')]);var _0x12e0ae=originateValidation['validate'](_0x22efd2['body']);if(_0x12e0ae['length']>0x0){return _0x349be3[_0xe4d9('0x13')](0x190)[_0xe4d9('0x29')](_0x12e0ae);}var _0x9f1acf=_0x22efd2['body']['userId'];var _0x5ad794=_0x22efd2['body'][_0xe4d9('0x2a')];var _0x16aaff=_0x22efd2['body'][_0xe4d9('0x2b')];var _0x24c084=_0x22efd2['body'][_0xe4d9('0x2c')];return getAgent(_0x9f1acf)[_0xe4d9('0x2d')](function(_0x945a80){logger[_0xe4d9('0xf')](_0xe4d9('0x2e'),_0x945a80[_0xe4d9('0x12')]);emit(util[_0xe4d9('0x2f')](_0xe4d9('0x30'),_0x945a80[_0xe4d9('0x12')]),_0xe4d9('0x31'),{'callNumber':_0x5ad794,'callerId':_0x16aaff,'callbackUrl':_0x24c084});return _0x349be3[_0xe4d9('0x13')](0xc8)[_0xe4d9('0x29')]({'error':![],'message':_0xe4d9('0x32')});})[_0xe4d9('0x1b')](handleError(_0x349be3));};exports['hangup']=function(_0x35b5f5,_0x20aef6){logger[_0xe4d9('0xf')](_0xe4d9('0x33'),_0x35b5f5[_0xe4d9('0x28')]);var _0x331161=hangupValidation[_0xe4d9('0xa')](_0x35b5f5[_0xe4d9('0x28')]);if(_0x331161[_0xe4d9('0x24')]>0x0){return _0x20aef6['status'](0x190)['json'](_0x331161);}var _0x5f5bc5=_0x35b5f5[_0xe4d9('0x28')][_0xe4d9('0x34')];var _0x32179b=_0x35b5f5[_0xe4d9('0x28')][_0xe4d9('0x23')];return getAgent(_0x5f5bc5)[_0xe4d9('0x2d')](function(_0x392cdd){logger['info']('entityFound:',_0x392cdd['name']);emit(util[_0xe4d9('0x2f')](_0xe4d9('0x30'),_0x392cdd['name']),_0xe4d9('0x35'),{'sessionId':_0x32179b});return _0x20aef6[_0xe4d9('0x13')](0xc8)[_0xe4d9('0x29')]({'error':![],'message':_0xe4d9('0x36')});})['catch'](handleError(_0x20aef6));};exports[_0xe4d9('0x37')]=function(_0x348667,_0x2afa91){logger[_0xe4d9('0xf')](_0xe4d9('0x38'),_0x348667[_0xe4d9('0x28')]);var _0x25b1f0=answerValidation[_0xe4d9('0xa')](_0x348667[_0xe4d9('0x28')]);if(_0x25b1f0[_0xe4d9('0x24')]>0x0){return _0x2afa91[_0xe4d9('0x13')](0x190)['json'](_0x25b1f0);}var _0x429be=_0x348667[_0xe4d9('0x28')][_0xe4d9('0x34')];var _0x2b7e25=_0x348667[_0xe4d9('0x28')]['sessionId'];return getAgent(_0x429be)[_0xe4d9('0x2d')](function(_0x31db47){logger[_0xe4d9('0xf')](_0xe4d9('0x2e'),_0x31db47[_0xe4d9('0x12')]);emit(util[_0xe4d9('0x2f')](_0xe4d9('0x30'),_0x31db47[_0xe4d9('0x12')]),_0xe4d9('0x39'),{'sessionId':_0x2b7e25});return _0x2afa91[_0xe4d9('0x13')](0xc8)['json']({'error':![],'message':_0xe4d9('0x3a')});})[_0xe4d9('0x1b')](handleError(_0x2afa91));};exports[_0xe4d9('0x3b')]=function(_0x54bf07,_0x131e11){logger[_0xe4d9('0xf')](_0xe4d9('0x3c'),_0x54bf07[_0xe4d9('0x28')]);var _0x1e0b7b=holdValidation[_0xe4d9('0xa')](_0x54bf07[_0xe4d9('0x28')]);if(_0x1e0b7b['length']>0x0){return _0x131e11[_0xe4d9('0x13')](0x190)[_0xe4d9('0x29')](_0x1e0b7b);}var _0x38bc8f=_0x54bf07[_0xe4d9('0x28')][_0xe4d9('0x34')];var _0x423881=_0x54bf07['body'][_0xe4d9('0x23')];return getAgent(_0x38bc8f)[_0xe4d9('0x2d')](function(_0x87f230){logger[_0xe4d9('0xf')](_0xe4d9('0x2e'),_0x87f230[_0xe4d9('0x12')]);emit(util['format'](_0xe4d9('0x30'),_0x87f230[_0xe4d9('0x12')]),'webbar:hold',{'sessionId':_0x423881});return _0x131e11[_0xe4d9('0x13')](0xc8)['json']({'error':![],'message':_0xe4d9('0x3d')});})[_0xe4d9('0x1b')](handleError(_0x131e11));};exports['unhold']=function(_0x657961,_0x5e5267){logger[_0xe4d9('0xf')](_0xe4d9('0x3e'),_0x657961[_0xe4d9('0x28')]);var _0x48b9fa=unholdValidation[_0xe4d9('0xa')](_0x657961[_0xe4d9('0x28')]);if(_0x48b9fa['length']>0x0){return _0x5e5267[_0xe4d9('0x13')](0x190)[_0xe4d9('0x29')](_0x48b9fa);}var _0x37af58=_0x657961[_0xe4d9('0x28')]['userId'];var _0x50f513=_0x657961[_0xe4d9('0x28')][_0xe4d9('0x23')];return getAgent(_0x37af58)[_0xe4d9('0x2d')](function(_0x19ebdc){logger[_0xe4d9('0xf')](_0xe4d9('0x2e'),_0x19ebdc['name']);emit(util['format'](_0xe4d9('0x30'),_0x19ebdc[_0xe4d9('0x12')]),_0xe4d9('0x3f'),{'sessionId':_0x50f513});return _0x5e5267[_0xe4d9('0x13')](0xc8)[_0xe4d9('0x29')]({'error':![],'message':_0xe4d9('0x40')});})['catch'](handleError(_0x5e5267));};exports[_0xe4d9('0x41')]=function(_0x291d0c,_0x47596a){logger['info'](_0xe4d9('0x42'),_0x47596a[_0xe4d9('0x28')]);var _0x281fda=callsValidation['validate'](_0x291d0c[_0xe4d9('0x28')]);if(_0x281fda['length']>0x0){return _0x47596a[_0xe4d9('0x13')](0x190)[_0xe4d9('0x29')](_0x281fda);}var _0x175346=_0x291d0c['body']['userId'];var _0x5bd06b=respondWithRpcPromise(_0xe4d9('0x1e'));var _0x588bcb=getAgent(_0x175346);return Promise[_0xe4d9('0x1f')]([_0x5bd06b,_0x588bcb])['then'](function(_0x4d7e81){var _0x3c2196=_0x4d7e81[0x0];var _0x2a4428=_0x4d7e81[0x1];var _0x467c29=_[_0xe4d9('0x20')](_0x3c2196[_0xe4d9('0x21')],function(_0x580bb4){return _0x580bb4['UserId']==_0x2a4428['id'];});return _0x47596a['status'](0xc8)['json']({'count':_0x467c29[_0xe4d9('0x24')],'rows':_0x467c29});})[_0xe4d9('0x1b')](handleError(_0x47596a));};exports[_0xe4d9('0x43')]=function(_0x39e74a,_0x1d522e){logger[_0xe4d9('0xf')](_0xe4d9('0x44'),_0x39e74a['body']);var _0x524e8c=conferenceValidation[_0xe4d9('0xa')](_0x39e74a[_0xe4d9('0x28')]);if(_0x524e8c[_0xe4d9('0x24')]>0x0){return _0x1d522e[_0xe4d9('0x13')](0x190)[_0xe4d9('0x29')](_0x524e8c);}var _0xa7cbad=_0x39e74a[_0xe4d9('0x28')][_0xe4d9('0x34')];return getAgent(_0xa7cbad)[_0xe4d9('0x2d')](function(_0x394635){logger[_0xe4d9('0xf')](_0xe4d9('0x2e'),_0x394635['name']);emit(util[_0xe4d9('0x2f')](_0xe4d9('0x30'),_0x394635[_0xe4d9('0x12')]),_0xe4d9('0x45'));return _0x1d522e['status'](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0xe4d9('0x1b')](handleError(_0x1d522e));};exports[_0xe4d9('0x46')]=function(_0x3ffe34,_0x43b750){logger['info']('transfer\x20fired:',_0x3ffe34[_0xe4d9('0x28')]);var _0xf41d89=transferValidation[_0xe4d9('0xa')](_0x3ffe34[_0xe4d9('0x28')]);if(_0xf41d89[_0xe4d9('0x24')]>0x0){return _0x43b750[_0xe4d9('0x13')](0x190)['json'](_0xf41d89);}var _0x348c8d=_0x3ffe34['body'][_0xe4d9('0x34')];var _0x3be5a4=_0x3ffe34['body'][_0xe4d9('0x23')];var _0xc31086=_0x3ffe34['body'][_0xe4d9('0x47')];return getAgent(_0x348c8d)[_0xe4d9('0x2d')](function(_0x46d795){logger[_0xe4d9('0xf')](_0xe4d9('0x2e'),_0x46d795[_0xe4d9('0x12')]);emit(util['format']('user:%s',_0x46d795[_0xe4d9('0x12')]),'webbar:transfer',{'sessionId':_0x3be5a4,'transferNumber':_0xc31086});return _0x43b750[_0xe4d9('0x13')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})[_0xe4d9('0x1b')](handleError(_0x43b750));}; \ No newline at end of file +var _0xc36d=['all','rows','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','filter','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','client','http','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','NotFound','request','then','code','result','catch','User','findOne','agent','VoiceChannels'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc36d,0x7d));var _0xdc36=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0xc36d[_0x1d7037];return _0x4d6568;};'use strict';var path=require(_0xdc36('0x0'));var fs=require('fs');var _=require(_0xdc36('0x1'));var db=require(_0xdc36('0x2'))['db'];var config=require(_0xdc36('0x3'));var util=require(_0xdc36('0x4'));var BPromise=require(_0xdc36('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xdc36('0x6')][_0xdc36('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xdc36('0x8'));var Redis=require(_0xdc36('0x9'));config[_0xdc36('0xa')]=_[_0xdc36('0xb')](config[_0xdc36('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xdc36('0xc'))(new Redis(config[_0xdc36('0xa')]));var Schema=require(_0xdc36('0xd'));var originateValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xdc36('0xf'),'required':[!![],_0xdc36('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xdc36('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],_0xdc36('0x11')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],_0xdc36('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xdc36('0x11')]},'sessionId':{'type':_0xdc36('0xf'),'required':[!![],_0xdc36('0x12')]},'transferNumber':{'type':_0xdc36('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],_0xdc36('0x11')]},'sessionId':{'type':_0xdc36('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],_0xdc36('0x11')]},'sessionId':{'type':_0xdc36('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],_0xdc36('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xdc36('0x11')]}});function emit(_0x526ac8,_0x4baf2e,_0x59c88f){logger[_0xdc36('0x13')](_0x526ac8,_0x4baf2e,JSON[_0xdc36('0x14')](_0x59c88f));io['to'](_0x526ac8)['emit'](_0x4baf2e,_0x59c88f);}function handleError(_0xd38826){return function(_0x219a73){console[_0xdc36('0x15')](_0xdc36('0x16'),_0x219a73,_0x219a73 instanceof RangeError);logger[_0xdc36('0x17')](_0x219a73[_0xdc36('0x18')]);if(_0x219a73 instanceof RangeError){if(_0x219a73['name']){delete _0x219a73[_0xdc36('0x19')];}_0xd38826[_0xdc36('0x1a')](0x194)['send'](_0x219a73);}else{if(_0x219a73[_0xdc36('0x19')]){delete _0x219a73[_0xdc36('0x19')];}_0xd38826[_0xdc36('0x1a')](0x1f4)['send'](_0x219a73);}};}function checkError(){return function(_0x10aafb){if(!_0x10aafb){throw new RangeError(_0xdc36('0x1b'));}return _0x10aafb;};}function respondWithRpcPromise(_0x5b9891,_0x388b1a){return new BPromise(function(_0x480277,_0x5a6e35){var _0x12f9d8=amiClient;return _0x12f9d8[_0xdc36('0x1c')](_0x5b9891,_0x388b1a)[_0xdc36('0x1d')](function(_0xda916b){if(_0xda916b[_0xdc36('0x17')]){if(_0xda916b[_0xdc36('0x17')][_0xdc36('0x1e')]===0x1f4){return _0x5a6e35(_0xda916b[_0xdc36('0x17')]['message']);}return _0x480277(_0xda916b[_0xdc36('0x17')]['message']);}else{_0x480277(_0xda916b[_0xdc36('0x1f')]);}})[_0xdc36('0x20')](function(_0x15e686){_0x5a6e35(_0x15e686);});});}function getAgent(_0x5c785b){return db[_0xdc36('0x21')][_0xdc36('0x22')]({'where':{'id':_0x5c785b,'role':_0xdc36('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x28a005,_0x2f3b6a){return new BPromise(function(_0x2a596d,_0x5f3b20){var _0x3c39e3=respondWithRpcPromise(_0xdc36('0x24'));var _0x4b15b4=getAgent(_0x28a005);Promise[_0xdc36('0x25')]([_0x3c39e3,_0x4b15b4])[_0xdc36('0x1d')](function(_0x4ea2ad){var _0x21151b=_0x4ea2ad[0x0];var _0x5bba0b=_0x4ea2ad[0x1];var _0x49bbf2=_['filter'](_0x21151b[_0xdc36('0x26')],function(_0x2f2bb4){return _0x2f2bb4['UserId']==_0x5bba0b['id']&&_0x2f2bb4[_0xdc36('0x27')]==_0x2f3b6a;});if(_0x49bbf2[_0xdc36('0x28')]==0x1){_0x2a596d(_0x5bba0b);}else{_0x5f3b20(new RangeError(_0xdc36('0x29')+_0x2f3b6a+'\x20not\x20found!'));}});});}exports[_0xdc36('0x2a')]=function(_0xcfff77,_0x1d010c){logger[_0xdc36('0x13')](_0xdc36('0x2b'),_0xcfff77[_0xdc36('0x2c')]);var _0x1aa877=originateValidation['validate'](_0xcfff77[_0xdc36('0x2c')]);if(_0x1aa877[_0xdc36('0x28')]>0x0){return _0x1d010c['status'](0x190)['json'](_0x1aa877);}var _0x359e7c=_0xcfff77[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x58a899=_0xcfff77['body'][_0xdc36('0x2e')];var _0x1a2261=_0xcfff77[_0xdc36('0x2c')][_0xdc36('0x2f')];var _0x302d69=_0xcfff77[_0xdc36('0x2c')][_0xdc36('0x30')];return getAgent(_0x359e7c)[_0xdc36('0x1d')](function(_0x734ad6){logger[_0xdc36('0x13')](_0xdc36('0x31'),_0x734ad6['name']);emit(util[_0xdc36('0x32')](_0xdc36('0x33'),_0x734ad6[_0xdc36('0x19')]),_0xdc36('0x34'),{'callNumber':_0x58a899,'callerId':_0x1a2261,'callbackUrl':_0x302d69});return _0x1d010c['status'](0xc8)[_0xdc36('0x35')]({'error':![],'message':_0xdc36('0x36')});})[_0xdc36('0x20')](handleError(_0x1d010c));};exports[_0xdc36('0x37')]=function(_0x4c4105,_0x3c8bd5){logger['info']('hangup\x20fired:',_0x4c4105[_0xdc36('0x2c')]);var _0x169c1e=hangupValidation[_0xdc36('0xd')](_0x4c4105['body']);if(_0x169c1e[_0xdc36('0x28')]>0x0){return _0x3c8bd5['status'](0x190)[_0xdc36('0x35')](_0x169c1e);}var _0x34f6be=_0x4c4105[_0xdc36('0x2c')]['userId'];var _0x34fe4d=_0x4c4105[_0xdc36('0x2c')][_0xdc36('0x27')];return getAgent(_0x34f6be)[_0xdc36('0x1d')](function(_0x50cf7b){logger[_0xdc36('0x13')](_0xdc36('0x31'),_0x50cf7b[_0xdc36('0x19')]);emit(util['format']('user:%s',_0x50cf7b[_0xdc36('0x19')]),_0xdc36('0x38'),{'sessionId':_0x34fe4d});return _0x3c8bd5['status'](0xc8)['json']({'error':![],'message':_0xdc36('0x39')});})[_0xdc36('0x20')](handleError(_0x3c8bd5));};exports[_0xdc36('0x3a')]=function(_0x1c0a6c,_0x26fb8c){logger[_0xdc36('0x13')](_0xdc36('0x3b'),_0x1c0a6c[_0xdc36('0x2c')]);var _0x2f4c89=answerValidation[_0xdc36('0xd')](_0x1c0a6c[_0xdc36('0x2c')]);if(_0x2f4c89[_0xdc36('0x28')]>0x0){return _0x26fb8c[_0xdc36('0x1a')](0x190)[_0xdc36('0x35')](_0x2f4c89);}var _0x1f2604=_0x1c0a6c[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x16dcb7=_0x1c0a6c[_0xdc36('0x2c')][_0xdc36('0x27')];return getAgent(_0x1f2604)[_0xdc36('0x1d')](function(_0x608220){logger[_0xdc36('0x13')](_0xdc36('0x31'),_0x608220[_0xdc36('0x19')]);emit(util[_0xdc36('0x32')]('user:%s',_0x608220[_0xdc36('0x19')]),_0xdc36('0x3c'),{'sessionId':_0x16dcb7});return _0x26fb8c['status'](0xc8)['json']({'error':![],'message':_0xdc36('0x3d')});})['catch'](handleError(_0x26fb8c));};exports[_0xdc36('0x3e')]=function(_0x51a276,_0x19c7fe){logger[_0xdc36('0x13')](_0xdc36('0x3f'),_0x51a276[_0xdc36('0x2c')]);var _0x34af88=holdValidation[_0xdc36('0xd')](_0x51a276[_0xdc36('0x2c')]);if(_0x34af88[_0xdc36('0x28')]>0x0){return _0x19c7fe[_0xdc36('0x1a')](0x190)[_0xdc36('0x35')](_0x34af88);}var _0x3c27c7=_0x51a276[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x10d865=_0x51a276[_0xdc36('0x2c')][_0xdc36('0x27')];return getAgent(_0x3c27c7)[_0xdc36('0x1d')](function(_0x3399cc){logger['info']('entityFound:',_0x3399cc[_0xdc36('0x19')]);emit(util[_0xdc36('0x32')](_0xdc36('0x33'),_0x3399cc[_0xdc36('0x19')]),_0xdc36('0x40'),{'sessionId':_0x10d865});return _0x19c7fe[_0xdc36('0x1a')](0xc8)['json']({'error':![],'message':_0xdc36('0x41')});})[_0xdc36('0x20')](handleError(_0x19c7fe));};exports[_0xdc36('0x42')]=function(_0x49f456,_0x2c6856){logger[_0xdc36('0x13')](_0xdc36('0x43'),_0x49f456[_0xdc36('0x2c')]);var _0x3bfc00=unholdValidation[_0xdc36('0xd')](_0x49f456['body']);if(_0x3bfc00[_0xdc36('0x28')]>0x0){return _0x2c6856[_0xdc36('0x1a')](0x190)[_0xdc36('0x35')](_0x3bfc00);}var _0x18272a=_0x49f456[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x26775a=_0x49f456[_0xdc36('0x2c')]['sessionId'];return getAgent(_0x18272a)[_0xdc36('0x1d')](function(_0x5bdc6){logger[_0xdc36('0x13')](_0xdc36('0x31'),_0x5bdc6[_0xdc36('0x19')]);emit(util[_0xdc36('0x32')](_0xdc36('0x33'),_0x5bdc6[_0xdc36('0x19')]),'webbar:unhold',{'sessionId':_0x26775a});return _0x2c6856['status'](0xc8)[_0xdc36('0x35')]({'error':![],'message':_0xdc36('0x44')});})['catch'](handleError(_0x2c6856));};exports[_0xdc36('0x45')]=function(_0xd8af57,_0x502033){logger['info'](_0xdc36('0x46'),_0x502033['body']);var _0x4277b4=callsValidation['validate'](_0xd8af57[_0xdc36('0x2c')]);if(_0x4277b4['length']>0x0){return _0x502033['status'](0x190)[_0xdc36('0x35')](_0x4277b4);}var _0x5d139f=_0xd8af57[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x33b3d2=respondWithRpcPromise(_0xdc36('0x24'));var _0x396a6a=getAgent(_0x5d139f);return Promise['all']([_0x33b3d2,_0x396a6a])[_0xdc36('0x1d')](function(_0x379a72){var _0x42d0a6=_0x379a72[0x0];var _0x4e62c2=_0x379a72[0x1];var _0x4f7bf5=_[_0xdc36('0x47')](_0x42d0a6['rows'],function(_0x3c50ea){return _0x3c50ea[_0xdc36('0x48')]==_0x4e62c2['id'];});return _0x502033[_0xdc36('0x1a')](0xc8)[_0xdc36('0x35')]({'count':_0x4f7bf5['length'],'rows':_0x4f7bf5});})['catch'](handleError(_0x502033));};exports[_0xdc36('0x49')]=function(_0x1d4707,_0x3d8c56){logger[_0xdc36('0x13')](_0xdc36('0x4a'),_0x1d4707[_0xdc36('0x2c')]);var _0x2359bd=conferenceValidation[_0xdc36('0xd')](_0x1d4707[_0xdc36('0x2c')]);if(_0x2359bd[_0xdc36('0x28')]>0x0){return _0x3d8c56['status'](0x190)[_0xdc36('0x35')](_0x2359bd);}var _0x4ea344=_0x1d4707[_0xdc36('0x2c')][_0xdc36('0x2d')];return getAgent(_0x4ea344)[_0xdc36('0x1d')](function(_0x35adec){logger[_0xdc36('0x13')](_0xdc36('0x31'),_0x35adec[_0xdc36('0x19')]);emit(util[_0xdc36('0x32')](_0xdc36('0x33'),_0x35adec[_0xdc36('0x19')]),_0xdc36('0x4b'));return _0x3d8c56[_0xdc36('0x1a')](0xc8)[_0xdc36('0x35')]({'error':![],'message':_0xdc36('0x4c')});})[_0xdc36('0x20')](handleError(_0x3d8c56));};exports[_0xdc36('0x4d')]=function(_0x43e23e,_0x1994c6){logger[_0xdc36('0x13')](_0xdc36('0x4e'),_0x43e23e['body']);var _0x327c04=transferValidation[_0xdc36('0xd')](_0x43e23e[_0xdc36('0x2c')]);if(_0x327c04[_0xdc36('0x28')]>0x0){return _0x1994c6[_0xdc36('0x1a')](0x190)[_0xdc36('0x35')](_0x327c04);}var _0x5ae258=_0x43e23e[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x52e7f7=_0x43e23e['body'][_0xdc36('0x27')];var _0x271004=_0x43e23e[_0xdc36('0x2c')]['transferNumber'];return getAgent(_0x5ae258)['then'](function(_0x6888a8){logger[_0xdc36('0x13')]('entityFound:',_0x6888a8['name']);emit(util[_0xdc36('0x32')](_0xdc36('0x33'),_0x6888a8[_0xdc36('0x19')]),_0xdc36('0x4f'),{'sessionId':_0x52e7f7,'transferNumber':_0x271004});return _0x1994c6[_0xdc36('0x1a')](0xc8)[_0xdc36('0x35')]({'error':![],'message':_0xdc36('0x50')});})[_0xdc36('0x20')](handleError(_0x1994c6));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 5a9a931..8e0eca8 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 _0x2ef3=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','addDisposition','addAnswer','/:id/notify','/:id/send','send','put','update','delete','removeAnswers'];(function(_0x4ff521,_0x44efaa){var _0x8313e1=function(_0x4b4b4d){while(--_0x4b4b4d){_0x4ff521['push'](_0x4ff521['shift']());}};_0x8313e1(++_0x44efaa);}(_0x2ef3,0xba));var _0x32ef=function(_0x50d73d,_0x54307a){_0x50d73d=_0x50d73d-0x0;var _0x400544=_0x2ef3[_0x50d73d];return _0x400544;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['get'](_0x32ef('0x12'),auth['isAuthenticated'](),controller[_0x32ef('0x13')]);router['get'](_0x32ef('0x14'),auth[_0x32ef('0xb')](),controller['getApplications']);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x15')](_0x32ef('0xf'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x16')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x32ef('0x17')]);router[_0x32ef('0x15')](_0x32ef('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x32ef('0x15')](_0x32ef('0x14'),auth[_0x32ef('0xb')](),controller['addApplications']);router[_0x32ef('0x15')](_0x32ef('0x18'),controller['notify']);router[_0x32ef('0x15')](_0x32ef('0x19'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x1a')]);router[_0x32ef('0x1b')](_0x32ef('0xd'),auth['isAuthenticated'](),controller[_0x32ef('0x1c')]);router['delete'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller['destroy']);router[_0x32ef('0x1d')](_0x32ef('0xf'),auth[_0x32ef('0xb')](),controller['removeDispositions']);router['delete'](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x1e')]);router['delete']('/:id/users',auth[_0x32ef('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x93e9=['/describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/applications','getApplications','post','create','addDisposition','addAnswer','/:id/users','addApplications','/:id/notify','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x93e9,0xcc));var _0x993e=function(_0x553e25,_0x214f94){_0x553e25=_0x553e25-0x0;var _0x18b236=_0x93e9[_0x553e25];return _0x18b236;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['describe']);router[_0x993e('0x9')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0x9')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller['getDispositions']);router[_0x993e('0x9')](_0x993e('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x993e('0x9')]('/:id/users',auth[_0x993e('0xa')](),controller['getAgents']);router['get'](_0x993e('0x11'),auth[_0x993e('0xa')](),controller[_0x993e('0x12')]);router[_0x993e('0x13')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0x14')]);router[_0x993e('0x13')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller[_0x993e('0x15')]);router[_0x993e('0x13')](_0x993e('0x10'),auth[_0x993e('0xa')](),controller[_0x993e('0x16')]);router[_0x993e('0x13')](_0x993e('0x17'),auth[_0x993e('0xa')](),controller['addAgents']);router[_0x993e('0x13')](_0x993e('0x11'),auth[_0x993e('0xa')](),controller[_0x993e('0x18')]);router[_0x993e('0x13')](_0x993e('0x19'),controller['notify']);router[_0x993e('0x13')](_0x993e('0x1a'),auth[_0x993e('0xa')](),controller[_0x993e('0x1b')]);router[_0x993e('0x1c')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0x1d')]);router['delete'](_0x993e('0xd'),auth['isAuthenticated'](),controller[_0x993e('0x1e')]);router[_0x993e('0x1f')](_0x993e('0xf'),auth['isAuthenticated'](),controller[_0x993e('0x20')]);router[_0x993e('0x1f')](_0x993e('0x10'),auth[_0x993e('0xa')](),controller[_0x993e('0x21')]);router[_0x993e('0x1f')](_0x993e('0x17'),auth[_0x993e('0xa')](),controller[_0x993e('0x22')]);module[_0x993e('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 9987571..b655f3a 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 _0x340d=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','sinch'];(function(_0x2c3201,_0x1f76ff){var _0x564fc4=function(_0x424493){while(--_0x424493){_0x2c3201['push'](_0x2c3201['shift']());}};_0x564fc4(++_0x1f76ff);}(_0x340d,0x72));var _0xd340=function(_0x61bc2a,_0x134210){_0x61bc2a=_0x61bc2a-0x0;var _0x5639e1=_0x340d[_0x61bc2a];return _0x5639e1;};'use strict';var Sequelize=require(_0xd340('0x0'));var rs=require(_0xd340('0x1'));module[_0xd340('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xd340('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xd340('0x3')],'defaultValue':function(){return rs[_0xd340('0x4')]();}},'phone':{'type':Sequelize[_0xd340('0x3')]},'type':{'type':Sequelize['ENUM']('twilio',_0xd340('0x5'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0xd340('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xd340('0x6')],'defaultValue':function(){return _0xd340('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd340('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd340('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd340('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd340('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd340('0x9')],'comment':_0xd340('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd340('0xb'),'set':function(_0x417317){if(!_0x417317){this[_0xd340('0xc')](_0xd340('0xd'),null);}this[_0xd340('0xc')](_0xd340('0xe'),_0x417317);}},'description':{'type':Sequelize[_0xd340('0x3')]}}; \ No newline at end of file +var _0x0cef=['randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue'];(function(_0x1a3ac7,_0x5e4b52){var _0x1dfb7d=function(_0x74c3f9){while(--_0x74c3f9){_0x1a3ac7['push'](_0x1a3ac7['shift']());}};_0x1dfb7d(++_0x5e4b52);}(_0x0cef,0x84));var _0xf0ce=function(_0x4ca89a,_0x33ffb8){_0x4ca89a=_0x4ca89a-0x0;var _0xfeb04d=_0x0cef[_0x4ca89a];return _0xfeb04d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf0ce('0x0'));module[_0xf0ce('0x1')]={'name':{'type':Sequelize[_0xf0ce('0x2')],'unique':_0xf0ce('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xf0ce('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xf0ce('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf0ce('0x4')]();}},'phone':{'type':Sequelize[_0xf0ce('0x2')]},'type':{'type':Sequelize[_0xf0ce('0x5')](_0xf0ce('0x6'),'sinch')},'accountSid':{'type':Sequelize[_0xf0ce('0x2')]},'baseUrl':{'type':Sequelize[_0xf0ce('0x2')]},'authToken':{'type':Sequelize[_0xf0ce('0x2')]},'notificationTemplate':{'type':Sequelize[_0xf0ce('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf0ce('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf0ce('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf0ce('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf0ce('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf0ce('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf0ce('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf0ce('0x9')],'comment':_0xf0ce('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xf0ce('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x25f2c7){if(!_0x25f2c7){this[_0xf0ce('0xb')]('mandatoryDispositionPauseId',null);}this[_0xf0ce('0xb')]('mandatoryDisposition',_0x25f2c7);}},'description':{'type':Sequelize[_0xf0ce('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 01bbe61..2077f05 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 _0x512a=['info','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','WhatsappAccounts','stack','name','index','Pause','map','WhatsappAccount','rawAttributes','fieldName','type','key','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','mandatoryDispositionPause','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','sort','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','getAgents','User','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','updatedAt','createdAt','CompanyId','mobile','twilio','from','From','replace','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','Contacts','DESC','list','contact','WhatsappInteraction','interaction','push','close','*,*,*,*','created','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','send','to\x20is\x20mandatory','List','out','Messages','dataValues','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request'];(function(_0x5d20a3,_0x117618){var _0x323669=function(_0x1c1195){while(--_0x1c1195){_0x5d20a3['push'](_0x5d20a3['shift']());}};_0x323669(++_0x117618);}(_0x512a,0x16c));var _0xa512=function(_0x4e828b,_0x588bd8){_0x4e828b=_0x4e828b-0x0;var _0x4ad720=_0x512a[_0x4e828b];return _0x4ad720;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa512('0x0'));var zipdir=require(_0xa512('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa512('0x2'));var BPromise=require(_0xa512('0x3'));var Mustache=require(_0xa512('0x4'));var util=require(_0xa512('0x5'));var path=require(_0xa512('0x6'));var sox=require(_0xa512('0x7'));var csv=require(_0xa512('0x8'));var ejs=require(_0xa512('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa512('0xa'));var squel=require(_0xa512('0xb'));var crypto=require(_0xa512('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa512('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa512('0xe'));var Papa=require(_0xa512('0xf'));var Redis=require(_0xa512('0x10'));var authService=require(_0xa512('0x11'));var qs=require(_0xa512('0x12'));var as=require(_0xa512('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa512('0x14'))(_0xa512('0x15'));var utils=require(_0xa512('0x16'));var config=require(_0xa512('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa512('0x18')]=_[_0xa512('0x19')](config['redis'],{'host':_0xa512('0x1a'),'port':0x18eb});var socket=require(_0xa512('0x1b'))(new Redis(config['redis']));require(_0xa512('0x1c'))[_0xa512('0x1d')](socket);var jayson=require(_0xa512('0x1e'));var client=jayson[_0xa512('0x1f')][_0xa512('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x1c7826,_0x16309f,_0x3faf72,_0x35ffe8){return new BPromise(function(_0x69cc18,_0x54efce){var _0x557aad=_0x35ffe8||client;return _0x557aad[_0xa512('0x21')](_0x1c7826,_0x3faf72)['then'](function(_0x3e6f7b){logger[_0xa512('0x22')](_0xa512('0x23'),_0x16309f,'request\x20sent');logger[_0xa512('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x16309f,_0xa512('0x25'),JSON[_0xa512('0x26')](_0x3e6f7b));if(_0x3e6f7b['error']){if(_0x3e6f7b['error'][_0xa512('0x27')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x16309f,_0x3e6f7b[_0xa512('0x28')][_0xa512('0x29')]);return _0x54efce(_0x3e6f7b[_0xa512('0x28')][_0xa512('0x29')]);}logger[_0xa512('0x28')](_0xa512('0x23'),_0x16309f,_0x3e6f7b[_0xa512('0x28')][_0xa512('0x29')]);return _0x69cc18(_0x3e6f7b[_0xa512('0x28')][_0xa512('0x29')]);}else{logger[_0xa512('0x22')](_0xa512('0x23'),_0x16309f,_0xa512('0x25'));_0x69cc18(_0x3e6f7b[_0xa512('0x2a')]['message']);}})[_0xa512('0x2b')](function(_0x16789e){logger[_0xa512('0x28')](_0xa512('0x23'),_0x16309f,_0x16789e);_0x54efce(_0x16789e);});});}function respondWithStatusCode(_0x4b58fd,_0x10f13b){_0x10f13b=_0x10f13b||0xcc;return function(_0x523169){if(_0x523169){return _0x4b58fd[_0xa512('0x2c')](_0x10f13b);}return _0x4b58fd[_0xa512('0x2d')](_0x10f13b)[_0xa512('0x2e')]();};}function respondWithResult(_0x2b6577,_0x2c5b5c){_0x2c5b5c=_0x2c5b5c||0xc8;return function(_0x3c433a){if(_0x3c433a){return _0x2b6577[_0xa512('0x2d')](_0x2c5b5c)[_0xa512('0x2f')](_0x3c433a);}};}function respondWithFilteredResult(_0x3c27c0,_0x284cda){return function(_0x3c2f5f){if(_0x3c2f5f){var _0x7745cc=typeof _0x284cda[_0xa512('0x30')]===_0xa512('0x31')&&typeof _0x284cda[_0xa512('0x32')]===_0xa512('0x31');var _0x14b698=_0x3c2f5f[_0xa512('0x33')];var _0x512889=_0x7745cc?0x0:_0x284cda['offset'];var _0x1732c4=_0x7745cc?_0x3c2f5f[_0xa512('0x33')]:_0x284cda['offset']+_0x284cda[_0xa512('0x32')];var _0x5ba6c2;if(_0x1732c4>=_0x14b698){_0x1732c4=_0x14b698;_0x5ba6c2=0xc8;}else{_0x5ba6c2=0xce;}_0x3c27c0['status'](_0x5ba6c2);return _0x3c27c0[_0xa512('0x34')](_0xa512('0x35'),_0x512889+'-'+_0x1732c4+'/'+_0x14b698)[_0xa512('0x2f')](_0x3c2f5f);}return null;};}function patchUpdates(_0x5f3ff8){return function(_0x3db5e2){try{jsonpatch['apply'](_0x3db5e2,_0x5f3ff8,!![]);}catch(_0x26be64){return BPromise[_0xa512('0x36')](_0x26be64);}return _0x3db5e2[_0xa512('0x37')]();};}function saveUpdates(_0x3ea839,_0x56cd4a){return function(_0x138f73){if(_0x138f73){return _0x138f73[_0xa512('0x38')](_0x3ea839)[_0xa512('0x39')](function(_0x1086bb){return _0x1086bb;});}return null;};}function removeEntity(_0x102dd6,_0x221422){return function(_0x2fff11){if(_0x2fff11){return _0x2fff11[_0xa512('0x3a')]()['then'](function(){var _0x2e8cf2=_0x2fff11[_0xa512('0x3b')]({'plain':!![]});var _0x3e74a8=_0xa512('0x3c');return db['UserProfileResource'][_0xa512('0x3a')]({'where':{'type':_0x3e74a8,'resourceId':_0x2e8cf2['id']}})[_0xa512('0x39')](function(){return _0x2fff11;});})['then'](function(){_0x102dd6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f2129,_0x53cfab){return function(_0x5673ec){if(!_0x5673ec){_0x5f2129[_0xa512('0x2c')](0x194);}return _0x5673ec;};}function handleError(_0xcefb11,_0x3c2e4f){_0x3c2e4f=_0x3c2e4f||0x1f4;return function(_0x1856b){logger[_0xa512('0x28')](_0x1856b[_0xa512('0x3d')]);if(_0x1856b[_0xa512('0x3e')]){delete _0x1856b[_0xa512('0x3e')];}_0xcefb11[_0xa512('0x2d')](_0x3c2e4f)['send'](_0x1856b);};}exports[_0xa512('0x3f')]=function(_0xfadfa1,_0x2ac425){var _0x4a8ede={'include':[{'model':db[_0xa512('0x40')],'as':'mandatoryDispositionPause'}]},_0x50104d={},_0x27bc59={'count':0x0,'rows':[]};var _0x4f7676=_[_0xa512('0x41')](db[_0xa512('0x42')][_0xa512('0x43')],function(_0x1aa1e9){return{'name':_0x1aa1e9[_0xa512('0x44')],'type':_0x1aa1e9[_0xa512('0x45')][_0xa512('0x46')]};});_0x50104d['model']=_['map'](_0x4f7676,'name');_0x50104d['query']=_[_0xa512('0x47')](_0xfadfa1['query']);_0x50104d[_0xa512('0x48')]=_[_0xa512('0x49')](_0x50104d['model'],_0x50104d[_0xa512('0x4a')]);_0x4a8ede[_0xa512('0x4b')]=_['intersection'](_0x50104d[_0xa512('0x4c')],qs[_0xa512('0x4d')](_0xfadfa1[_0xa512('0x4a')][_0xa512('0x4d')]));_0x4a8ede['attributes']=_0x4a8ede[_0xa512('0x4b')][_0xa512('0x4e')]?_0x4a8ede[_0xa512('0x4b')]:_0x50104d[_0xa512('0x4c')];if(!_0xfadfa1[_0xa512('0x4a')][_0xa512('0x4f')](_0xa512('0x50'))){_0x4a8ede[_0xa512('0x32')]=qs[_0xa512('0x32')](_0xfadfa1[_0xa512('0x4a')][_0xa512('0x32')]);_0x4a8ede[_0xa512('0x30')]=qs[_0xa512('0x30')](_0xfadfa1[_0xa512('0x4a')][_0xa512('0x30')]);}_0x4a8ede[_0xa512('0x51')]=qs['sort'](_0xfadfa1[_0xa512('0x4a')]['sort']);_0x4a8ede['where']=qs['filters'](_[_0xa512('0x52')](_0xfadfa1[_0xa512('0x4a')],_0x50104d['filters']),_0x4f7676);if(_0xfadfa1['query'][_0xa512('0x53')]){_0x4a8ede[_0xa512('0x54')]=_[_0xa512('0x55')](_0x4a8ede[_0xa512('0x54')],{'$or':_[_0xa512('0x41')](_0x4f7676,function(_0x717dd0){if(_0x717dd0[_0xa512('0x45')]!==_0xa512('0x56')){var _0x722da0={};_0x722da0[_0x717dd0[_0xa512('0x3e')]]={'$like':'%'+_0xfadfa1[_0xa512('0x4a')][_0xa512('0x53')]+'%'};return _0x722da0;}})});}_0x4a8ede=_[_0xa512('0x55')]({},_0x4a8ede,_0xfadfa1[_0xa512('0x57')]);var _0x1de32e={'where':_0x4a8ede[_0xa512('0x54')]};return db[_0xa512('0x42')][_0xa512('0x33')](_0x1de32e)[_0xa512('0x39')](function(_0x4dd87c){_0x27bc59[_0xa512('0x33')]=_0x4dd87c;if(_0xfadfa1['query'][_0xa512('0x58')]){_0x4a8ede[_0xa512('0x59')]=[{'all':!![]}];}return db[_0xa512('0x42')]['findAll'](_0x4a8ede);})['then'](function(_0x1783fc){_0x27bc59[_0xa512('0x5a')]=_0x1783fc;return _0x27bc59;})[_0xa512('0x39')](respondWithFilteredResult(_0x2ac425,_0x4a8ede))[_0xa512('0x2b')](handleError(_0x2ac425,null));};exports[_0xa512('0x5b')]=function(_0x5f2880,_0x2d64d0){var _0x199297={'raw':![],'where':{'id':_0x5f2880[_0xa512('0x5c')]['id']},'include':[{'model':db[_0xa512('0x40')],'as':_0xa512('0x5d')}]},_0x46941d={};_0x46941d['model']=_[_0xa512('0x47')](db[_0xa512('0x42')][_0xa512('0x43')]);_0x46941d[_0xa512('0x4a')]=_['keys'](_0x5f2880[_0xa512('0x4a')]);_0x46941d[_0xa512('0x48')]=_[_0xa512('0x49')](_0x46941d[_0xa512('0x4c')],_0x46941d['query']);_0x199297[_0xa512('0x4b')]=_[_0xa512('0x49')](_0x46941d['model'],qs['fields'](_0x5f2880[_0xa512('0x4a')][_0xa512('0x4d')]));_0x199297[_0xa512('0x4b')]=_0x199297[_0xa512('0x4b')][_0xa512('0x4e')]?_0x199297[_0xa512('0x4b')]:_0x46941d['model'];if(_0x5f2880[_0xa512('0x4a')]['includeAll']){_0x199297['include']=[{'all':!![]}];}_0x199297=_[_0xa512('0x55')]({},_0x199297,_0x5f2880['options']);return db[_0xa512('0x42')][_0xa512('0x5e')](_0x199297)[_0xa512('0x39')](handleEntityNotFound(_0x2d64d0,null))[_0xa512('0x39')](respondWithResult(_0x2d64d0,null))[_0xa512('0x2b')](handleError(_0x2d64d0,null));};exports[_0xa512('0x5f')]=function(_0x516c1,_0x2e0b7e){return db[_0xa512('0x42')][_0xa512('0x5f')](_0x516c1[_0xa512('0x60')],{})[_0xa512('0x39')](function(_0x26437f){var _0x557d2a=_0x516c1[_0xa512('0x61')]['get']({'plain':!![]});if(!_0x557d2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x557d2a[_0xa512('0x62')]===_0xa512('0x61')){var _0x5ecd8e=_0x26437f[_0xa512('0x3b')]({'plain':!![]});var _0x588174=_0xa512('0x3c');return db[_0xa512('0x63')][_0xa512('0x5e')]({'where':{'name':_0x588174,'userProfileId':_0x557d2a[_0xa512('0x64')]},'raw':!![]})[_0xa512('0x39')](function(_0x30f244){if(_0x30f244&&_0x30f244['autoAssociation']===0x0){return db[_0xa512('0x65')][_0xa512('0x5f')]({'name':_0x5ecd8e[_0xa512('0x3e')],'resourceId':_0x5ecd8e['id'],'type':_0x30f244[_0xa512('0x3e')],'sectionId':_0x30f244['id']},{})['then'](function(){return _0x26437f;});}else{return _0x26437f;}})[_0xa512('0x2b')](function(_0x3148a0){logger[_0xa512('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3148a0);throw _0x3148a0;});}return _0x26437f;})[_0xa512('0x39')](respondWithResult(_0x2e0b7e,0xc9))[_0xa512('0x2b')](handleError(_0x2e0b7e,null));};exports[_0xa512('0x38')]=function(_0x119757,_0x100a7a){if(_0x119757['body']['id']){delete _0x119757[_0xa512('0x60')]['id'];}return db[_0xa512('0x42')][_0xa512('0x5e')]({'where':{'id':_0x119757[_0xa512('0x5c')]['id']},'include':[{'model':db[_0xa512('0x40')],'as':_0xa512('0x5d')}]})['then'](handleEntityNotFound(_0x100a7a,null))['then'](saveUpdates(_0x119757['body'],null))[_0xa512('0x39')](respondWithResult(_0x100a7a,null))[_0xa512('0x2b')](handleError(_0x100a7a,null));};exports[_0xa512('0x3a')]=function(_0x218261,_0xcabc7a){return db['WhatsappAccount']['find']({'where':{'id':_0x218261[_0xa512('0x5c')]['id']}})[_0xa512('0x39')](handleEntityNotFound(_0xcabc7a,null))['then'](removeEntity(_0xcabc7a,null))[_0xa512('0x2b')](handleError(_0xcabc7a,null));};exports[_0xa512('0x66')]=function(_0x26b7a8,_0x288bbc){return db[_0xa512('0x42')][_0xa512('0x66')]()[_0xa512('0x39')](respondWithResult(_0x288bbc,null))['catch'](handleError(_0x288bbc,null));};exports[_0xa512('0x67')]=function(_0x3f0689,_0x600859,_0xc5dc30){if(_0x3f0689[_0xa512('0x60')]['id']){delete _0x3f0689[_0xa512('0x60')]['id'];}return db['WhatsappAccount'][_0xa512('0x5e')]({'where':{'id':_0x3f0689[_0xa512('0x5c')]['id']}})['then'](handleEntityNotFound(_0x600859,null))[_0xa512('0x39')](function(_0x2efdb7){if(_0x2efdb7){_0x3f0689[_0xa512('0x60')][_0xa512('0x68')]=_0x2efdb7['id'];return db['Disposition']['create'](_0x3f0689[_0xa512('0x60')]);}})[_0xa512('0x39')](respondWithResult(_0x600859,null))[_0xa512('0x2b')](handleError(_0x600859,null));};exports[_0xa512('0x69')]=function(_0x57f611,_0x21fe25,_0xeac7f2){var _0x4d23b3={'raw':![],'where':{}};var _0x5e2c4c={};var _0x3575d5={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xa512('0x6a')]({'where':{'id':_0x57f611[_0xa512('0x5c')]['id']}})[_0xa512('0x39')](handleEntityNotFound(_0x21fe25,null))['then'](function(_0xc90c1a){if(_0xc90c1a){_0x5e2c4c[_0xa512('0x4c')]=_[_0xa512('0x47')](db[_0xa512('0x6b')][_0xa512('0x43')]);_0x5e2c4c[_0xa512('0x4a')]=_['keys'](_0x57f611['query']);_0x5e2c4c[_0xa512('0x48')]=_[_0xa512('0x49')](_0x5e2c4c[_0xa512('0x4c')],_0x5e2c4c['query']);_0x4d23b3['attributes']=_[_0xa512('0x49')](_0x5e2c4c[_0xa512('0x4c')],qs[_0xa512('0x4d')](_0x57f611[_0xa512('0x4a')][_0xa512('0x4d')]));_0x4d23b3[_0xa512('0x4b')]=_0x4d23b3[_0xa512('0x4b')][_0xa512('0x4e')]?_0x4d23b3[_0xa512('0x4b')]:_0x5e2c4c[_0xa512('0x4c')];if(!_0x57f611[_0xa512('0x4a')]['hasOwnProperty']('nolimit')){_0x4d23b3['limit']=qs['limit'](_0x57f611[_0xa512('0x4a')][_0xa512('0x32')]);_0x4d23b3[_0xa512('0x30')]=qs[_0xa512('0x30')](_0x57f611[_0xa512('0x4a')][_0xa512('0x30')]);}_0x4d23b3['order']=qs[_0xa512('0x6c')](_0x57f611[_0xa512('0x4a')][_0xa512('0x6c')]);_0x4d23b3[_0xa512('0x54')]=qs['filters'](_[_0xa512('0x52')](_0x57f611[_0xa512('0x4a')],_0x5e2c4c['filters']));_0x4d23b3['where'][_0xa512('0x68')]=_0xc90c1a['id'];if(_0x57f611[_0xa512('0x4a')][_0xa512('0x53')]){_0x4d23b3['where']=_[_0xa512('0x55')](_0x4d23b3[_0xa512('0x54')],{'$or':_[_0xa512('0x41')](_0x4d23b3['attributes'],function(_0xe0f4f8){var _0x500a14={};_0x500a14[_0xe0f4f8]={'$like':'%'+_0x57f611[_0xa512('0x4a')][_0xa512('0x53')]+'%'};return _0x500a14;})});}_0x4d23b3=_['merge']({},_0x4d23b3,_0x57f611['options']);return db[_0xa512('0x6b')]['count']({'where':_0x4d23b3[_0xa512('0x54')]})[_0xa512('0x39')](function(_0x4cd05c){_0x3575d5[_0xa512('0x33')]=_0x4cd05c;if(_0x57f611[_0xa512('0x4a')]['includeAll']){_0x4d23b3['include']=[{'all':!![]}];}return db[_0xa512('0x6b')][_0xa512('0x6d')](_0x4d23b3);})[_0xa512('0x39')](function(_0x3a6d44){_0x3575d5[_0xa512('0x5a')]=_0x3a6d44;return _0x3575d5;});}})['then'](respondWithFilteredResult(_0x21fe25,_0x4d23b3))[_0xa512('0x2b')](handleError(_0x21fe25,null));};exports[_0xa512('0x6e')]=function(_0x39d793,_0x35b463,_0x470dbc){return db['WhatsappAccount']['find']({'where':{'id':_0x39d793[_0xa512('0x5c')]['id']}})[_0xa512('0x39')](handleEntityNotFound(_0x35b463,null))[_0xa512('0x39')](function(_0x1ba528){if(_0x1ba528){return _0x1ba528['removeDispositions'](_0x39d793[_0xa512('0x4a')][_0xa512('0x6f')]);}})[_0xa512('0x39')](respondWithStatusCode(_0x35b463,null))[_0xa512('0x2b')](handleError(_0x35b463,null));};exports[_0xa512('0x70')]=function(_0x34bb24,_0x4a8011,_0x23f600){if(_0x34bb24[_0xa512('0x60')]['id']){delete _0x34bb24[_0xa512('0x60')]['id'];}return db[_0xa512('0x42')]['find']({'where':{'id':_0x34bb24[_0xa512('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4a8011,null))[_0xa512('0x39')](function(_0x40f95b){if(_0x40f95b){_0x34bb24[_0xa512('0x60')][_0xa512('0x68')]=_0x40f95b['id'];return db['CannedAnswer'][_0xa512('0x5f')](_0x34bb24[_0xa512('0x60')]);}})['then'](respondWithResult(_0x4a8011,null))[_0xa512('0x2b')](handleError(_0x4a8011,null));};exports['getAnswers']=function(_0x566b91,_0x2aaabf,_0x58e0b9){var _0x25d4c4={'raw':![],'where':{}};var _0x2c257b={};var _0x5c3520={'count':0x0,'rows':[]};return db[_0xa512('0x42')]['findOne']({'where':{'id':_0x566b91[_0xa512('0x5c')]['id']}})[_0xa512('0x39')](handleEntityNotFound(_0x2aaabf,null))[_0xa512('0x39')](function(_0x45713f){if(_0x45713f){_0x2c257b[_0xa512('0x4c')]=_['keys'](db[_0xa512('0x71')][_0xa512('0x43')]);_0x2c257b[_0xa512('0x4a')]=_[_0xa512('0x47')](_0x566b91['query']);_0x2c257b[_0xa512('0x48')]=_[_0xa512('0x49')](_0x2c257b[_0xa512('0x4c')],_0x2c257b['query']);_0x25d4c4[_0xa512('0x4b')]=_[_0xa512('0x49')](_0x2c257b['model'],qs['fields'](_0x566b91['query'][_0xa512('0x4d')]));_0x25d4c4[_0xa512('0x4b')]=_0x25d4c4[_0xa512('0x4b')][_0xa512('0x4e')]?_0x25d4c4['attributes']:_0x2c257b['model'];if(!_0x566b91[_0xa512('0x4a')][_0xa512('0x4f')]('nolimit')){_0x25d4c4[_0xa512('0x32')]=qs[_0xa512('0x32')](_0x566b91[_0xa512('0x4a')][_0xa512('0x32')]);_0x25d4c4[_0xa512('0x30')]=qs[_0xa512('0x30')](_0x566b91['query'][_0xa512('0x30')]);}_0x25d4c4[_0xa512('0x51')]=qs[_0xa512('0x6c')](_0x566b91[_0xa512('0x4a')][_0xa512('0x6c')]);_0x25d4c4[_0xa512('0x54')]=qs['filters'](_[_0xa512('0x52')](_0x566b91[_0xa512('0x4a')],_0x2c257b['filters']));_0x25d4c4['where']['WhatsappAccountId']=_0x45713f['id'];if(_0x566b91[_0xa512('0x4a')]['filter']){_0x25d4c4[_0xa512('0x54')]=_[_0xa512('0x55')](_0x25d4c4[_0xa512('0x54')],{'$or':_['map'](_0x25d4c4[_0xa512('0x4b')],function(_0x6c1545){var _0x3a53e3={};_0x3a53e3[_0x6c1545]={'$like':'%'+_0x566b91[_0xa512('0x4a')][_0xa512('0x53')]+'%'};return _0x3a53e3;})});}_0x25d4c4=_[_0xa512('0x55')]({},_0x25d4c4,_0x566b91[_0xa512('0x57')]);return db['CannedAnswer'][_0xa512('0x33')]({'where':_0x25d4c4[_0xa512('0x54')]})[_0xa512('0x39')](function(_0x3a7e01){_0x5c3520[_0xa512('0x33')]=_0x3a7e01;if(_0x566b91[_0xa512('0x4a')]['includeAll']){_0x25d4c4[_0xa512('0x59')]=[{'all':!![]}];}return db[_0xa512('0x71')][_0xa512('0x6d')](_0x25d4c4);})[_0xa512('0x39')](function(_0x1b100d){_0x5c3520[_0xa512('0x5a')]=_0x1b100d;return _0x5c3520;});}})[_0xa512('0x39')](respondWithFilteredResult(_0x2aaabf,_0x25d4c4))[_0xa512('0x2b')](handleError(_0x2aaabf,null));};exports[_0xa512('0x72')]=function(_0x31781c,_0x3717f4,_0x1401e1){return db['WhatsappAccount'][_0xa512('0x5e')]({'where':{'id':_0x31781c['params']['id']}})[_0xa512('0x39')](handleEntityNotFound(_0x3717f4,null))['then'](function(_0x1ff9f5){if(_0x1ff9f5){return _0x1ff9f5[_0xa512('0x72')](_0x31781c[_0xa512('0x4a')][_0xa512('0x6f')]);}})['then'](respondWithStatusCode(_0x3717f4,null))[_0xa512('0x2b')](handleError(_0x3717f4,null));};exports[_0xa512('0x73')]=function(_0x3275c1,_0x57bcae,_0x377ccb){return db['WhatsappAccount'][_0xa512('0x5e')]({'where':{'id':_0x3275c1['params']['id']}})[_0xa512('0x39')](handleEntityNotFound(_0x57bcae,null))['then'](function(_0x2cc166){if(_0x2cc166){return _0x2cc166[_0xa512('0x73')](_0x3275c1[_0xa512('0x60')]['ids'],_[_0xa512('0x74')](_0x3275c1['body'],[_0xa512('0x6f'),'id'])||{})[_0xa512('0x75')](function(_0x499de7){for(var _0x1e2e11=0x0;_0x1e2e11<_0x3275c1[_0xa512('0x60')]['ids'][_0xa512('0x4e')];_0x1e2e11+=0x1){socket[_0xa512('0x76')](_0xa512('0x77'),{'UserId':Number(_0x3275c1[_0xa512('0x60')][_0xa512('0x6f')][_0x1e2e11]),'WhatsappAccountId':Number(_0x3275c1[_0xa512('0x5c')]['id'])});}return _0x499de7;});}})[_0xa512('0x39')](respondWithResult(_0x57bcae,null))[_0xa512('0x2b')](handleError(_0x57bcae,null));};exports[_0xa512('0x78')]=function(_0x115ae6,_0x33a6e0,_0x4469f8){return db[_0xa512('0x42')]['find']({'where':{'id':_0x115ae6[_0xa512('0x5c')]['id']}})['then'](handleEntityNotFound(_0x33a6e0,null))[_0xa512('0x39')](function(_0x232b5c){if(_0x232b5c){return _0x232b5c['removeAgents'](_0x115ae6[_0xa512('0x4a')]['ids'])[_0xa512('0x39')](function(){if(_[_0xa512('0x79')](_0x115ae6['query'][_0xa512('0x6f')])){for(var _0x12d69b=0x0;_0x12d69b<_0x115ae6[_0xa512('0x4a')][_0xa512('0x6f')][_0xa512('0x4e')];_0x12d69b+=0x1){socket[_0xa512('0x76')]('userWhatsappAccount:remove',{'UserId':Number(_0x115ae6['query'][_0xa512('0x6f')][_0x12d69b]),'WhatsappAccountId':Number(_0x115ae6[_0xa512('0x5c')]['id'])});}}else{socket[_0xa512('0x76')]('userWhatsappAccount:remove',{'UserId':Number(_0x115ae6[_0xa512('0x4a')][_0xa512('0x6f')]),'WhatsappAccountId':Number(_0x115ae6[_0xa512('0x5c')]['id'])});}});}})[_0xa512('0x39')](respondWithStatusCode(_0x33a6e0,null))[_0xa512('0x2b')](handleError(_0x33a6e0,null));};exports[_0xa512('0x7a')]=function(_0x1bcb7f,_0x52e98a,_0x4a12b1){var _0x67911b={};var _0xff8489={};var _0x28cce9;var _0x420a4f;return db['WhatsappAccount'][_0xa512('0x6a')]({'where':{'id':_0x1bcb7f['params']['id']}})[_0xa512('0x39')](handleEntityNotFound(_0x52e98a,null))[_0xa512('0x39')](function(_0x1774ad){if(_0x1774ad){_0x28cce9=_0x1774ad;_0xff8489[_0xa512('0x4c')]=_[_0xa512('0x47')](db[_0xa512('0x7b')][_0xa512('0x43')]);_0xff8489[_0xa512('0x4a')]=_['keys'](_0x1bcb7f[_0xa512('0x4a')]);_0xff8489[_0xa512('0x48')]=_[_0xa512('0x49')](_0xff8489[_0xa512('0x4c')],_0xff8489[_0xa512('0x4a')]);_0x67911b[_0xa512('0x4b')]=_[_0xa512('0x49')](_0xff8489[_0xa512('0x4c')],qs[_0xa512('0x4d')](_0x1bcb7f[_0xa512('0x4a')][_0xa512('0x4d')]));_0x67911b['attributes']=_0x67911b[_0xa512('0x4b')][_0xa512('0x4e')]?_0x67911b[_0xa512('0x4b')]:_0xff8489[_0xa512('0x4c')];_0x67911b[_0xa512('0x51')]=qs['sort'](_0x1bcb7f[_0xa512('0x4a')][_0xa512('0x6c')]);_0x67911b[_0xa512('0x54')]=qs['filters'](_[_0xa512('0x52')](_0x1bcb7f['query'],_0xff8489[_0xa512('0x48')]));if(_0x1bcb7f[_0xa512('0x4a')][_0xa512('0x53')]){_0x67911b[_0xa512('0x54')]=_[_0xa512('0x55')](_0x67911b[_0xa512('0x54')],{'$or':_['map'](_0x67911b['attributes'],function(_0x4dc61a){var _0xc004be={};_0xc004be[_0x4dc61a]={'$like':'%'+_0x1bcb7f[_0xa512('0x4a')][_0xa512('0x53')]+'%'};return _0xc004be;})});}_0x67911b=_[_0xa512('0x55')]({},_0x67911b,_0x1bcb7f[_0xa512('0x57')]);return _0x28cce9['getAgents'](_0x67911b);}})['then'](function(_0x29389e){if(_0x29389e){_0x420a4f=_0x29389e[_0xa512('0x4e')];if(!_0x1bcb7f[_0xa512('0x4a')]['hasOwnProperty'](_0xa512('0x50'))){_0x67911b[_0xa512('0x32')]=qs[_0xa512('0x32')](_0x1bcb7f[_0xa512('0x4a')]['limit']);_0x67911b[_0xa512('0x30')]=qs['offset'](_0x1bcb7f[_0xa512('0x4a')][_0xa512('0x30')]);}return _0x28cce9['getAgents'](_0x67911b);}})[_0xa512('0x39')](function(_0x2183a){if(_0x2183a){return _0x2183a?{'count':_0x420a4f,'rows':_0x2183a}:null;}})[_0xa512('0x39')](respondWithResult(_0x52e98a,null))['catch'](handleError(_0x52e98a,null));};exports[_0xa512('0x7c')]=function(_0x4ef985,_0x1d40a9){var _0x54d817=_0x4ef985[_0xa512('0x5c')]['id'];var _0x1a9a14=_0x4ef985['body'];var _0x291184=0xc8;var _0x2c7bca=null;return db[_0xa512('0x7d')][_0xa512('0x7e')]({'isolationLevel':db['sequelize'][_0xa512('0x7f')]['ISOLATION_LEVELS'][_0xa512('0x80')]},function(_0x1671a6){return db[_0xa512('0x42')]['findOne']({'where':{'id':_0x54d817},'transaction':_0x1671a6})['then'](function(_0x4b797f){if(_0x4b797f){return db[_0xa512('0x81')][_0xa512('0x3a')]({'where':{'WhatsappAccountId':_0x54d817},'transaction':_0x1671a6})[_0xa512('0x39')](function(){var _0x5e60c7=_[_0xa512('0x41')](_0x1a9a14,function(_0x37196b){_0x37196b[_0xa512('0x68')]=_0x54d817;return _0x37196b;});return db[_0xa512('0x81')][_0xa512('0x82')](_0x5e60c7,{'transaction':_0x1671a6});});}else{_0x291184=0x194;_0x2c7bca=[];}});})[_0xa512('0x39')](function(){if(_0x291184!==0x194){return db['WhatsappApplication'][_0xa512('0x83')]({'where':{'WhatsappAccountId':_0x54d817},'order':_0xa512('0x84')})['then'](function(_0x3d3577){_0x2c7bca=_0x3d3577;});}})['catch'](function(_0x37a170){_0x291184=0x1f4;logger[_0xa512('0x28')](_0x37a170[_0xa512('0x3d')]);if(_0x37a170[_0xa512('0x3e')]){delete _0x37a170[_0xa512('0x3e')];}_0x2c7bca=_0x37a170;})[_0xa512('0x85')](function(){if(_0x2c7bca===null){_0x1d40a9[_0xa512('0x2c')](_0x291184);}else{if(_0x291184===0x1f4){_0x1d40a9[_0xa512('0x2d')](_0x291184)['send'](_0x2c7bca);}else{_0x1d40a9['status'](_0x291184)[_0xa512('0x2f')](_0x2c7bca);}}});};exports['getApplications']=function(_0x15c14b,_0x242ede,_0x1952d7){var _0x2ee0f4={};var _0x915501={};var _0x11231f;var _0x3cd4e5;return db[_0xa512('0x42')][_0xa512('0x6a')]({'where':{'id':_0x15c14b[_0xa512('0x5c')]['id']}})[_0xa512('0x39')](handleEntityNotFound(_0x242ede,null))[_0xa512('0x39')](function(_0x908d82){if(_0x908d82){_0x11231f=_0x908d82;_0x915501[_0xa512('0x4c')]=_[_0xa512('0x47')](db[_0xa512('0x81')][_0xa512('0x43')]);_0x915501[_0xa512('0x4a')]=_['keys'](_0x15c14b[_0xa512('0x4a')]);_0x915501['filters']=_[_0xa512('0x49')](_0x915501[_0xa512('0x4c')],_0x915501[_0xa512('0x4a')]);_0x2ee0f4[_0xa512('0x4b')]=_['intersection'](_0x915501[_0xa512('0x4c')],qs[_0xa512('0x4d')](_0x15c14b[_0xa512('0x4a')][_0xa512('0x4d')]));_0x2ee0f4[_0xa512('0x4b')]=_0x2ee0f4[_0xa512('0x4b')][_0xa512('0x4e')]?_0x2ee0f4[_0xa512('0x4b')]:_0x915501['model'];_0x2ee0f4[_0xa512('0x51')]=qs[_0xa512('0x6c')](_0x15c14b[_0xa512('0x4a')][_0xa512('0x6c')]);_0x2ee0f4[_0xa512('0x54')]=qs[_0xa512('0x48')](_[_0xa512('0x52')](_0x15c14b[_0xa512('0x4a')],_0x915501[_0xa512('0x48')]));if(_0x15c14b[_0xa512('0x4a')][_0xa512('0x53')]){_0x2ee0f4[_0xa512('0x54')]=_[_0xa512('0x55')](_0x2ee0f4[_0xa512('0x54')],{'$or':_[_0xa512('0x41')](_0x2ee0f4[_0xa512('0x4b')],function(_0x403d87){var _0x591782={};_0x591782[_0x403d87]={'$like':'%'+_0x15c14b[_0xa512('0x4a')][_0xa512('0x53')]+'%'};return _0x591782;})});}_0x2ee0f4=_[_0xa512('0x55')]({},_0x2ee0f4,_0x15c14b[_0xa512('0x57')]);return _0x11231f['getApplications'](_0x2ee0f4);}})['then'](function(_0x4f29cb){if(_0x4f29cb){_0x3cd4e5=_0x4f29cb['length'];if(!_0x15c14b['query'][_0xa512('0x4f')](_0xa512('0x50'))){_0x2ee0f4[_0xa512('0x32')]=qs[_0xa512('0x32')](_0x15c14b[_0xa512('0x4a')]['limit']);_0x2ee0f4['offset']=qs[_0xa512('0x30')](_0x15c14b[_0xa512('0x4a')][_0xa512('0x30')]);}return _0x11231f[_0xa512('0x86')](_0x2ee0f4);}})['then'](function(_0x34592e){if(_0x34592e){return _0x34592e?{'count':_0x3cd4e5,'rows':_0x34592e}:null;}})[_0xa512('0x39')](respondWithResult(_0x242ede,null))['catch'](handleError(_0x242ede,null));};exports[_0xa512('0x87')]=function(_0x3e540d,_0x5e73ba,_0x4dfa9a){var _0x20b876={'channel':_0xa512('0x88')};var _0x4eedf6=[];var _0x36b7ab=[];var _0x5716a2={};return db[_0xa512('0x42')][_0xa512('0x5e')]({'where':{'id':_0x3e540d[_0xa512('0x5c')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xa512('0x89')}]})[_0xa512('0x39')](handleEntityNotFound(_0x5e73ba,null))[_0xa512('0x39')](function(_0x3036a5){_0x20b876[_0xa512('0x8a')]=_0x3036a5;if(_0x20b876[_0xa512('0x8a')]&&_0x20b876[_0xa512('0x8a')]['type']===_0xa512('0x8b')&&_0x3e540d['body']['statuses']){if(_0x3e540d['body'][_0xa512('0x8c')]['length']===0x0)return;if(_0x3e540d[_0xa512('0x60')][_0xa512('0x8c')][0x0][_0xa512('0x8d')]!==_0xa512('0x8e'))return;return db[_0xa512('0x8f')]['update']({'read':!![],'readAt':_0x3e540d[_0xa512('0x60')][_0xa512('0x8c')][0x0][_0xa512('0x90')]},{'where':{'messageId':_0x3e540d[_0xa512('0x60')]['statuses'][0x0][_0xa512('0x91')]},'individualHooks':!![]})[_0xa512('0x39')](function(_0x2f5004){return _0x5e73ba[_0xa512('0x2d')](0xc8)[_0xa512('0x2f')](_0x2f5004);});}_0x20b876[_0xa512('0x92')]=_[_0xa512('0x93')](_0x3036a5['Applications'],[_0xa512('0x84')],[_0xa512('0x94')]);if(_0x20b876[_0xa512('0x8a')][_0xa512('0x89')]){delete _0x20b876['account']['Applications'];}return db[_0xa512('0x95')][_0xa512('0x66')]()[_0xa512('0x39')](function(_0x576370){if(!_0x576370){throw new db['Sequelize'][(_0xa512('0x96'))](_0xa512('0x97'));}_0x4eedf6=_['difference'](_[_0xa512('0x47')](_0x576370),['createdAt',_0xa512('0x98')]);_0x36b7ab=_['difference'](_[_0xa512('0x47')](_0x576370),[_0xa512('0x99'),'updatedAt',_0xa512('0x9a'),'ListId']);_0x20b876[_0xa512('0x60')]={'mapKey':_0xa512('0x9b')};if(_0x20b876[_0xa512('0x8a')]&&_0x20b876[_0xa512('0x8a')][_0xa512('0x45')]===_0xa512('0x9c')){_0x20b876[_0xa512('0x60')][_0xa512('0x9d')]=_0x3e540d[_0xa512('0x60')][_0xa512('0x9e')][_0xa512('0x9f')]('whatsapp:','');_0x20b876[_0xa512('0x60')][_0xa512('0x60')]=_0x3e540d['body'][_0xa512('0xa0')];_0x20b876[_0xa512('0x60')][_0xa512('0xa1')]=_0x3e540d[_0xa512('0x60')][_0xa512('0xa2')];}if(_0x20b876['account']&&_0x20b876[_0xa512('0x8a')][_0xa512('0x45')]===_0xa512('0x8b')){_0x20b876[_0xa512('0x60')][_0xa512('0x9d')]=_0x3e540d[_0xa512('0x60')][_0xa512('0xa3')][0x0]['from'];_0x20b876['body'][_0xa512('0x60')]=_0x3e540d['body'][_0xa512('0xa3')][0x0]['message'][_0xa512('0x60')];_0x20b876['body'][_0xa512('0xa1')]=_0x3e540d[_0xa512('0x60')][_0xa512('0xa3')][0x0][_0xa512('0x91')];}if(_0x20b876[_0xa512('0x60')]['id']){delete _0x20b876[_0xa512('0x60')]['id'];}if(_[_0xa512('0xa4')](_0x20b876[_0xa512('0x60')][_0xa512('0x9d')])){throw new db[(_0xa512('0xa5'))]['ValidationError'](_0xa512('0xa6'));}if(_[_0xa512('0xa4')](_0x20b876[_0xa512('0x60')][_0xa512('0x60')])||_0x20b876[_0xa512('0x60')][_0xa512('0x60')]===''){throw new db['Sequelize'][(_0xa512('0x96'))](_0xa512('0xa7'));}if(_[_0xa512('0xa4')](_0x20b876['body'][_0xa512('0xa8')])){throw new db[(_0xa512('0xa5'))][(_0xa512('0x96'))](_0xa512('0xa9')+_0x36b7ab);}if(!_['includes'](_0x36b7ab,_0x20b876[_0xa512('0x60')][_0xa512('0xa8')])){throw new db[(_0xa512('0xa5'))][(_0xa512('0x96'))](_0xa512('0xaa')+_0x36b7ab);}_0x5716a2[_0x20b876[_0xa512('0x60')][_0xa512('0xa8')]]=_0x20b876[_0xa512('0x60')]['from'];return db[_0xa512('0xab')][_0xa512('0x5e')]({'where':{'id':_0x20b876[_0xa512('0x8a')]['ListId']},'include':[{'model':db[_0xa512('0x95')],'as':_0xa512('0xac'),'where':_0x5716a2,'limit':0x1,'order':[[_0xa512('0x98'),_0xa512('0xad')]]}]});})['then'](handleEntityNotFound(_0x5e73ba,null))[_0xa512('0x39')](function(_0x38386a){if(_0x38386a){_0x20b876[_0xa512('0xae')]=_[_0xa512('0x74')](_0x38386a,[_0xa512('0xac')]);if(_0x38386a[_0xa512('0xac')]['length']){return _0x38386a[_0xa512('0xac')][0x0];}var _0x11cbeb=_['defaults'](_0x20b876['body'],{'firstName':_0x20b876[_0xa512('0x60')][_0xa512('0x9d')],'ListId':_0x38386a['id']});_0x11cbeb[_0x20b876[_0xa512('0x60')][_0xa512('0xa8')]]=_0x20b876['body'][_0xa512('0x9d')];return db[_0xa512('0x95')][_0xa512('0x5f')](_0x11cbeb,{'fields':_0x4eedf6,'raw':!![]});}})[_0xa512('0x39')](handleEntityNotFound(_0x5e73ba,null))[_0xa512('0x39')](function(_0x121241){if(_0x121241){_0x20b876[_0xa512('0xaf')]=_0x121241;var _0x383b41={'ContactId':_0x121241['id'],'phone':_0x20b876[_0xa512('0x60')]['from'],'WhatsappAccountId':_0x3e540d[_0xa512('0x5c')]['id']};var _0x4543b0={'ContactId':_0x121241['id'],'WhatsappAccountId':_0x3e540d[_0xa512('0x5c')]['id'],'closed':![]};return db[_0xa512('0xb0')]['find']({'where':_0x4543b0})['then'](function(_0x759a7d){if(_0x759a7d){return[_0x759a7d,![]];}return db[_0xa512('0xb0')][_0xa512('0x5f')](_0x383b41)[_0xa512('0x39')](function(_0x1aa292){return[_0x1aa292,!![]];});});}})[_0xa512('0x75')](function(_0x2cd721,_0x2e2cbe){_0x20b876[_0xa512('0xb1')]=_0x2cd721[_0xa512('0x3b')]({'plain':!![]});_0x20b876[_0xa512('0xb1')]['created']=![];if(_0x2e2cbe){if(_0x20b876[_0xa512('0x8a')]['autoclose']){_0x20b876[_0xa512('0x92')][_0xa512('0xb2')]({'id':0x0,'priority':_0x20b876[_0xa512('0x92')]['length']+0x1,'app':_0xa512('0xb3'),'appdata':'unmanaged','interval':_0xa512('0xb4')});}_0x20b876['interaction'][_0xa512('0xb5')]=!![];}return db[_0xa512('0x8f')][_0xa512('0x5f')]({'phone':_0x20b876[_0xa512('0x60')][_0xa512('0x9d')],'messageId':_0x20b876[_0xa512('0x60')][_0xa512('0xa1')],'body':_0x20b876['body'][_0xa512('0x60')],'WhatsappAccountId':_0x3e540d[_0xa512('0x5c')]['id'],'WhatsappInteractionId':_0x2cd721['id'],'direction':'in','ContactId':_0x2cd721[_0xa512('0xb6')],'AttachmentId':_0x20b876['body'][_0xa512('0xb7')]});})['then'](function(_0x232d0e){_0x20b876[_0xa512('0x29')]=_0x232d0e;if(_0x20b876[_0xa512('0xb1')][_0xa512('0xb8')]){return db[_0xa512('0x7b')][_0xa512('0x5e')]({'attributes':['id',_0xa512('0x3e')],'where':{'id':_0x20b876[_0xa512('0xb1')]['UserId']}})[_0xa512('0x39')](function(_0x18bda4){if(_0x18bda4){_0x20b876[_0xa512('0x92')]['unshift']({'id':0x0,'priority':0x0,'app':_0xa512('0xb9'),'appdata':_0x18bda4[_0xa512('0x3e')]+','+(_0x20b876[_0xa512('0x8a')][_0xa512('0xba')]||0xa),'interval':_0xa512('0xb4')});}return respondWithRpcPromise(_0xa512('0xbb'),_0xa512('0xbc'),_0x20b876);});}return respondWithRpcPromise(_0xa512('0xbb'),_0xa512('0xbc'),_0x20b876);})[_0xa512('0x39')](function(_0x246df5){if(_0x246df5){var _0x436a11=0xc8;var _0x26de7a=_0xa512('0xbd');logger[_0xa512('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x26de7a,_0x436a11,_0xa512('0xbe'));logger[_0xa512('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x26de7a,_0x436a11,_0xa512('0xbe'),JSON[_0xa512('0x26')](_0x246df5));if(_0x20b876[_0xa512('0x8a')]['type']===_0xa512('0x9c')){return _0x5e73ba[_0xa512('0x2d')](_0x436a11)['set'](_0xa512('0xbf'),_0xa512('0xc0'))[_0xa512('0xc1')]('\x0a');}else{return _0x5e73ba[_0xa512('0x2d')](_0x436a11)[_0xa512('0x2f')](_0x246df5);}}});})[_0xa512('0x2b')](handleError(_0x5e73ba,null));};exports[_0xa512('0xc1')]=function(_0x4f776c,_0x45ecfa,_0x3b38ad){var _0x52ee53,_0x22ab9e,_0x41bcfb;if(_[_0xa512('0xa4')](_0x4f776c[_0xa512('0x60')]['body'])||_0x4f776c[_0xa512('0x60')][_0xa512('0x60')]===''){throw new db['Sequelize'][(_0xa512('0x96'))](_0xa512('0xa7'));}if(_[_0xa512('0xa4')](_0x4f776c[_0xa512('0x60')]['to'])){throw new db[(_0xa512('0xa5'))][(_0xa512('0x96'))](_0xa512('0xc2'));}_0x52ee53=_0x4f776c['body']['to'];return db[_0xa512('0x42')]['find']({'where':{'id':_0x4f776c[_0xa512('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0xa512('0xc3'),'include':[{'model':db[_0xa512('0x95')],'as':_0xa512('0xac'),'where':{'mobile':_0x52ee53},'limit':0x1,'order':[[_0xa512('0x98'),'DESC']]}]}]})[_0xa512('0x39')](handleEntityNotFound(_0x45ecfa,null))['then'](function(_0x1e61ef){if(_0x1e61ef&&_0x1e61ef[_0xa512('0xc3')]){_0x22ab9e=_0x1e61ef[_0xa512('0x3b')]({'plain':!![]});if(_0x22ab9e[_0xa512('0xc3')]&&_0x22ab9e[_0xa512('0xc3')][_0xa512('0xac')]['length']){return _0x22ab9e[_0xa512('0xc3')][_0xa512('0xac')][0x0];}return db[_0xa512('0x95')][_0xa512('0x5f')](_[_0xa512('0x19')](_0x4f776c[_0xa512('0x60')],{'firstName':_0x52ee53,'mobile':_0x52ee53,'phone':_0x52ee53,'ListId':_0x22ab9e['ListId']}));}})[_0xa512('0x39')](handleEntityNotFound(_0x45ecfa,null))[_0xa512('0x39')](function(_0x541057){if(_0x541057){_0x41bcfb=_0x541057;return db[_0xa512('0xb0')][_0xa512('0x5e')]({'where':{'ContactId':_0x41bcfb['id'],'closed':![],'WhatsappAccountId':_0x22ab9e['id']}})['then'](function(_0x13c8ae){if(_0x13c8ae){return[_0x13c8ae,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x4f776c[_0xa512('0x61')]['id'],'ContactId':_0x41bcfb['id'],'WhatsappAccountId':_0x22ab9e['id'],'phone':_0x52ee53,'firstMsgDirection':_0xa512('0xc4'),'Messages':[_[_0xa512('0x55')](_0x4f776c[_0xa512('0x60')],{'read':![],'body':_0x4f776c[_0xa512('0x60')][_0xa512('0x60')],'phone':_0x52ee53,'WhatsappAccountId':_0x22ab9e['id'],'UserId':_0x4f776c[_0xa512('0x61')]['id'],'ContactId':_0x41bcfb['id']})]},{'include':[{'model':db[_0xa512('0x8f')],'as':_0xa512('0xc5')}]})[_0xa512('0x39')](function(_0x166f2a){return[_0x166f2a,!![]];});});}})['spread'](function(_0x522833,_0x27d6bc){if(_0x27d6bc){return _0x522833;}return db[_0xa512('0x8f')][_0xa512('0x5f')](_[_0xa512('0x55')](_0x4f776c[_0xa512('0x60')],{'read':![],'body':_0x4f776c[_0xa512('0x60')][_0xa512('0x60')],'phone':_0x52ee53,'WhatsappAccountId':_0x22ab9e['id'],'WhatsappInteractionId':_0x522833['id'],'UserId':_0x4f776c[_0xa512('0x61')]['id'],'ContactId':_0x41bcfb['id']}))[_0xa512('0x39')](function(_0x5202b2){_0x522833[_0xa512('0xc6')][_0xa512('0xc5')]=[];_0x522833[_0xa512('0xc6')][_0xa512('0xc5')][_0xa512('0xb2')](_0x5202b2['dataValues']);return _0x522833;});})['then'](respondWithResult(_0x45ecfa,null))[_0xa512('0x2b')](handleError(_0x45ecfa,null));}; \ No newline at end of file +var _0xf1d8=['no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','Body','messageId','notifications','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','list','omit','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','redis','defaults','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','end','status','undefined','limit','count','set','Content-Range','json','apply','reject','update','WhatsappAccounts','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','rawAttributes','nolimit','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','getApplications','notify','whatsapp','Applications','account','type','sinch','statuses','state','message_id','applications','orderBy','asc','CmContact','ValidationError'];(function(_0x2a70d4,_0x40925a){var _0x516f71=function(_0x506a46){while(--_0x506a46){_0x2a70d4['push'](_0x2a70d4['shift']());}};_0x516f71(++_0x40925a);}(_0xf1d8,0x1ba));var _0x8f1d=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xf1d8[_0x5416db];return _0x243e35;};'use strict';var emlformat=require(_0x8f1d('0x0'));var rimraf=require(_0x8f1d('0x1'));var zipdir=require(_0x8f1d('0x2'));var jsonpatch=require(_0x8f1d('0x3'));var rp=require(_0x8f1d('0x4'));var moment=require(_0x8f1d('0x5'));var BPromise=require(_0x8f1d('0x6'));var Mustache=require(_0x8f1d('0x7'));var util=require(_0x8f1d('0x8'));var path=require('path');var sox=require(_0x8f1d('0x9'));var csv=require(_0x8f1d('0xa'));var ejs=require(_0x8f1d('0xb'));var fs=require('fs');var fs_extra=require(_0x8f1d('0xc'));var _=require(_0x8f1d('0xd'));var squel=require(_0x8f1d('0xe'));var crypto=require(_0x8f1d('0xf'));var jsforce=require(_0x8f1d('0x10'));var deskjs=require(_0x8f1d('0x11'));var toCsv=require(_0x8f1d('0xa'));var querystring=require(_0x8f1d('0x12'));var Papa=require(_0x8f1d('0x13'));var Redis=require(_0x8f1d('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x8f1d('0x15'));var as=require(_0x8f1d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8f1d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8f1d('0x18')]=_[_0x8f1d('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8f1d('0x1a'))(new Redis(config['redis']));require(_0x8f1d('0x1b'))['register'](socket);var jayson=require(_0x8f1d('0x1c'));var client=jayson[_0x8f1d('0x1d')][_0x8f1d('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x17b9db,_0x517c73,_0x51cb42,_0x3d5cb2){return new BPromise(function(_0x5b0372,_0x19b5c2){var _0x4b9cfd=_0x3d5cb2||client;return _0x4b9cfd[_0x8f1d('0x1f')](_0x17b9db,_0x51cb42)[_0x8f1d('0x20')](function(_0x16b758){logger[_0x8f1d('0x21')](_0x8f1d('0x22'),_0x517c73,'request\x20sent');logger[_0x8f1d('0x23')](_0x8f1d('0x24'),_0x517c73,_0x8f1d('0x25'),JSON[_0x8f1d('0x26')](_0x16b758));if(_0x16b758[_0x8f1d('0x27')]){if(_0x16b758[_0x8f1d('0x27')][_0x8f1d('0x28')]===0x1f4){logger[_0x8f1d('0x27')](_0x8f1d('0x22'),_0x517c73,_0x16b758[_0x8f1d('0x27')]['message']);return _0x19b5c2(_0x16b758[_0x8f1d('0x27')][_0x8f1d('0x29')]);}logger[_0x8f1d('0x27')](_0x8f1d('0x22'),_0x517c73,_0x16b758[_0x8f1d('0x27')][_0x8f1d('0x29')]);return _0x5b0372(_0x16b758[_0x8f1d('0x27')][_0x8f1d('0x29')]);}else{logger[_0x8f1d('0x21')](_0x8f1d('0x22'),_0x517c73,_0x8f1d('0x25'));_0x5b0372(_0x16b758['result']['message']);}})[_0x8f1d('0x2a')](function(_0x4545ea){logger[_0x8f1d('0x27')](_0x8f1d('0x22'),_0x517c73,_0x4545ea);_0x19b5c2(_0x4545ea);});});}function respondWithStatusCode(_0x351a3e,_0x2e8ae7){_0x2e8ae7=_0x2e8ae7||0xcc;return function(_0x16ea76){if(_0x16ea76){return _0x351a3e[_0x8f1d('0x2b')](_0x2e8ae7);}return _0x351a3e['status'](_0x2e8ae7)[_0x8f1d('0x2c')]();};}function respondWithResult(_0x1e72ce,_0x2181d2){_0x2181d2=_0x2181d2||0xc8;return function(_0x2b8803){if(_0x2b8803){return _0x1e72ce[_0x8f1d('0x2d')](_0x2181d2)['json'](_0x2b8803);}};}function respondWithFilteredResult(_0x562ce6,_0x934989){return function(_0x2b9885){if(_0x2b9885){var _0x1a18fa=typeof _0x934989['offset']===_0x8f1d('0x2e')&&typeof _0x934989[_0x8f1d('0x2f')]===_0x8f1d('0x2e');var _0x10af2d=_0x2b9885[_0x8f1d('0x30')];var _0x3a840d=_0x1a18fa?0x0:_0x934989['offset'];var _0x4049be=_0x1a18fa?_0x2b9885[_0x8f1d('0x30')]:_0x934989['offset']+_0x934989[_0x8f1d('0x2f')];var _0x5a271e;if(_0x4049be>=_0x10af2d){_0x4049be=_0x10af2d;_0x5a271e=0xc8;}else{_0x5a271e=0xce;}_0x562ce6[_0x8f1d('0x2d')](_0x5a271e);return _0x562ce6[_0x8f1d('0x31')](_0x8f1d('0x32'),_0x3a840d+'-'+_0x4049be+'/'+_0x10af2d)[_0x8f1d('0x33')](_0x2b9885);}return null;};}function patchUpdates(_0x112fe6){return function(_0x1cb3de){try{jsonpatch[_0x8f1d('0x34')](_0x1cb3de,_0x112fe6,!![]);}catch(_0x2500b7){return BPromise[_0x8f1d('0x35')](_0x2500b7);}return _0x1cb3de['save']();};}function saveUpdates(_0x495a30,_0x3c4faa){return function(_0x1d3131){if(_0x1d3131){return _0x1d3131[_0x8f1d('0x36')](_0x495a30)['then'](function(_0x498e8c){return _0x498e8c;});}return null;};}function removeEntity(_0x19e93b,_0x37213a){return function(_0x306166){if(_0x306166){return _0x306166['destroy']()[_0x8f1d('0x20')](function(){var _0xcf45e=_0x306166['get']({'plain':!![]});var _0x513e02=_0x8f1d('0x37');return db['UserProfileResource'][_0x8f1d('0x38')]({'where':{'type':_0x513e02,'resourceId':_0xcf45e['id']}})[_0x8f1d('0x20')](function(){return _0x306166;});})[_0x8f1d('0x20')](function(){_0x19e93b[_0x8f1d('0x2d')](0xcc)[_0x8f1d('0x2c')]();});}};}function handleEntityNotFound(_0x57bba1,_0x3b8fcb){return function(_0x565fa7){if(!_0x565fa7){_0x57bba1['sendStatus'](0x194);}return _0x565fa7;};}function handleError(_0x5db093,_0x127bc5){_0x127bc5=_0x127bc5||0x1f4;return function(_0x59ed76){logger[_0x8f1d('0x27')](_0x59ed76[_0x8f1d('0x39')]);if(_0x59ed76[_0x8f1d('0x3a')]){delete _0x59ed76[_0x8f1d('0x3a')];}_0x5db093[_0x8f1d('0x2d')](_0x127bc5)[_0x8f1d('0x3b')](_0x59ed76);};}exports[_0x8f1d('0x3c')]=function(_0x407f11,_0x172125){var _0x4c20b4={'include':[{'model':db[_0x8f1d('0x3d')],'as':_0x8f1d('0x3e')}]},_0xf233e5={},_0x51e24a={'count':0x0,'rows':[]};var _0x3106c7=_['map'](db[_0x8f1d('0x3f')]['rawAttributes'],function(_0x4a9bd0){return{'name':_0x4a9bd0[_0x8f1d('0x40')],'type':_0x4a9bd0['type'][_0x8f1d('0x41')]};});_0xf233e5[_0x8f1d('0x42')]=_[_0x8f1d('0x43')](_0x3106c7,_0x8f1d('0x3a'));_0xf233e5['query']=_[_0x8f1d('0x44')](_0x407f11[_0x8f1d('0x45')]);_0xf233e5[_0x8f1d('0x46')]=_[_0x8f1d('0x47')](_0xf233e5[_0x8f1d('0x42')],_0xf233e5[_0x8f1d('0x45')]);_0x4c20b4['attributes']=_[_0x8f1d('0x47')](_0xf233e5[_0x8f1d('0x42')],qs['fields'](_0x407f11[_0x8f1d('0x45')][_0x8f1d('0x48')]));_0x4c20b4['attributes']=_0x4c20b4[_0x8f1d('0x49')]['length']?_0x4c20b4[_0x8f1d('0x49')]:_0xf233e5[_0x8f1d('0x42')];if(!_0x407f11[_0x8f1d('0x45')][_0x8f1d('0x4a')]('nolimit')){_0x4c20b4['limit']=qs[_0x8f1d('0x2f')](_0x407f11['query'][_0x8f1d('0x2f')]);_0x4c20b4[_0x8f1d('0x4b')]=qs['offset'](_0x407f11[_0x8f1d('0x45')]['offset']);}_0x4c20b4[_0x8f1d('0x4c')]=qs[_0x8f1d('0x4d')](_0x407f11[_0x8f1d('0x45')]['sort']);_0x4c20b4[_0x8f1d('0x4e')]=qs['filters'](_[_0x8f1d('0x4f')](_0x407f11[_0x8f1d('0x45')],_0xf233e5[_0x8f1d('0x46')]),_0x3106c7);if(_0x407f11['query'][_0x8f1d('0x50')]){_0x4c20b4[_0x8f1d('0x4e')]=_[_0x8f1d('0x51')](_0x4c20b4[_0x8f1d('0x4e')],{'$or':_[_0x8f1d('0x43')](_0x3106c7,function(_0x24a683){if(_0x24a683['type']!==_0x8f1d('0x52')){var _0x559638={};_0x559638[_0x24a683[_0x8f1d('0x3a')]]={'$like':'%'+_0x407f11[_0x8f1d('0x45')][_0x8f1d('0x50')]+'%'};return _0x559638;}})});}_0x4c20b4=_['merge']({},_0x4c20b4,_0x407f11[_0x8f1d('0x53')]);var _0xaaaab2={'where':_0x4c20b4['where']};return db[_0x8f1d('0x3f')]['count'](_0xaaaab2)[_0x8f1d('0x20')](function(_0x1bbff3){_0x51e24a[_0x8f1d('0x30')]=_0x1bbff3;if(_0x407f11[_0x8f1d('0x45')][_0x8f1d('0x54')]){_0x4c20b4['include']=[{'all':!![]}];}return db[_0x8f1d('0x3f')][_0x8f1d('0x55')](_0x4c20b4);})['then'](function(_0x58ed4c){_0x51e24a[_0x8f1d('0x56')]=_0x58ed4c;return _0x51e24a;})[_0x8f1d('0x20')](respondWithFilteredResult(_0x172125,_0x4c20b4))[_0x8f1d('0x2a')](handleError(_0x172125,null));};exports[_0x8f1d('0x57')]=function(_0x3b6367,_0x42a7d8){var _0x509b05={'raw':![],'where':{'id':_0x3b6367[_0x8f1d('0x58')]['id']},'include':[{'model':db[_0x8f1d('0x3d')],'as':_0x8f1d('0x3e')}]},_0x481ede={};_0x481ede[_0x8f1d('0x42')]=_[_0x8f1d('0x44')](db[_0x8f1d('0x3f')]['rawAttributes']);_0x481ede[_0x8f1d('0x45')]=_['keys'](_0x3b6367[_0x8f1d('0x45')]);_0x481ede[_0x8f1d('0x46')]=_[_0x8f1d('0x47')](_0x481ede[_0x8f1d('0x42')],_0x481ede[_0x8f1d('0x45')]);_0x509b05['attributes']=_[_0x8f1d('0x47')](_0x481ede[_0x8f1d('0x42')],qs[_0x8f1d('0x48')](_0x3b6367[_0x8f1d('0x45')][_0x8f1d('0x48')]));_0x509b05[_0x8f1d('0x49')]=_0x509b05['attributes'][_0x8f1d('0x59')]?_0x509b05[_0x8f1d('0x49')]:_0x481ede[_0x8f1d('0x42')];if(_0x3b6367[_0x8f1d('0x45')][_0x8f1d('0x54')]){_0x509b05[_0x8f1d('0x5a')]=[{'all':!![]}];}_0x509b05=_[_0x8f1d('0x51')]({},_0x509b05,_0x3b6367[_0x8f1d('0x53')]);return db[_0x8f1d('0x3f')][_0x8f1d('0x5b')](_0x509b05)[_0x8f1d('0x20')](handleEntityNotFound(_0x42a7d8,null))[_0x8f1d('0x20')](respondWithResult(_0x42a7d8,null))[_0x8f1d('0x2a')](handleError(_0x42a7d8,null));};exports[_0x8f1d('0x5c')]=function(_0x52829f,_0x168146){return db[_0x8f1d('0x3f')]['create'](_0x52829f[_0x8f1d('0x5d')],{})[_0x8f1d('0x20')](function(_0x57ceeb){var _0x146830=_0x52829f[_0x8f1d('0x5e')][_0x8f1d('0x5f')]({'plain':!![]});if(!_0x146830)throw new Error(_0x8f1d('0x60'));if(_0x146830[_0x8f1d('0x61')]===_0x8f1d('0x5e')){var _0x35af74=_0x57ceeb[_0x8f1d('0x5f')]({'plain':!![]});var _0x19d5c7=_0x8f1d('0x37');return db[_0x8f1d('0x62')][_0x8f1d('0x5b')]({'where':{'name':_0x19d5c7,'userProfileId':_0x146830['userProfileId']},'raw':!![]})[_0x8f1d('0x20')](function(_0x51cdae){if(_0x51cdae&&_0x51cdae[_0x8f1d('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x35af74['name'],'resourceId':_0x35af74['id'],'type':_0x51cdae['name'],'sectionId':_0x51cdae['id']},{})[_0x8f1d('0x20')](function(){return _0x57ceeb;});}else{return _0x57ceeb;}})[_0x8f1d('0x2a')](function(_0x2c2999){logger[_0x8f1d('0x27')](_0x8f1d('0x64'),_0x2c2999);throw _0x2c2999;});}return _0x57ceeb;})[_0x8f1d('0x20')](respondWithResult(_0x168146,0xc9))[_0x8f1d('0x2a')](handleError(_0x168146,null));};exports['update']=function(_0x1f0e6f,_0x462ee2){if(_0x1f0e6f[_0x8f1d('0x5d')]['id']){delete _0x1f0e6f['body']['id'];}return db[_0x8f1d('0x3f')][_0x8f1d('0x5b')]({'where':{'id':_0x1f0e6f[_0x8f1d('0x58')]['id']},'include':[{'model':db[_0x8f1d('0x3d')],'as':_0x8f1d('0x3e')}]})['then'](handleEntityNotFound(_0x462ee2,null))[_0x8f1d('0x20')](saveUpdates(_0x1f0e6f['body'],null))['then'](respondWithResult(_0x462ee2,null))['catch'](handleError(_0x462ee2,null));};exports[_0x8f1d('0x38')]=function(_0x3c3134,_0x9e7ae8){return db[_0x8f1d('0x3f')][_0x8f1d('0x5b')]({'where':{'id':_0x3c3134[_0x8f1d('0x58')]['id']}})[_0x8f1d('0x20')](handleEntityNotFound(_0x9e7ae8,null))['then'](removeEntity(_0x9e7ae8,null))[_0x8f1d('0x2a')](handleError(_0x9e7ae8,null));};exports[_0x8f1d('0x65')]=function(_0x368181,_0x44f5df){return db[_0x8f1d('0x3f')][_0x8f1d('0x65')]()['then'](respondWithResult(_0x44f5df,null))[_0x8f1d('0x2a')](handleError(_0x44f5df,null));};exports['addDisposition']=function(_0x507fbd,_0x215890,_0x1284a4){if(_0x507fbd['body']['id']){delete _0x507fbd[_0x8f1d('0x5d')]['id'];}return db[_0x8f1d('0x3f')][_0x8f1d('0x5b')]({'where':{'id':_0x507fbd[_0x8f1d('0x58')]['id']}})[_0x8f1d('0x20')](handleEntityNotFound(_0x215890,null))[_0x8f1d('0x20')](function(_0x2d9ae5){if(_0x2d9ae5){_0x507fbd[_0x8f1d('0x5d')]['WhatsappAccountId']=_0x2d9ae5['id'];return db[_0x8f1d('0x66')][_0x8f1d('0x5c')](_0x507fbd[_0x8f1d('0x5d')]);}})[_0x8f1d('0x20')](respondWithResult(_0x215890,null))[_0x8f1d('0x2a')](handleError(_0x215890,null));};exports[_0x8f1d('0x67')]=function(_0x2956f0,_0x276b54,_0x5be8e5){var _0x565387={'raw':![],'where':{}};var _0x338615={};var _0x5340c2={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x8f1d('0x68')]({'where':{'id':_0x2956f0[_0x8f1d('0x58')]['id']}})['then'](handleEntityNotFound(_0x276b54,null))[_0x8f1d('0x20')](function(_0x1b1da8){if(_0x1b1da8){_0x338615[_0x8f1d('0x42')]=_[_0x8f1d('0x44')](db['Disposition'][_0x8f1d('0x69')]);_0x338615[_0x8f1d('0x45')]=_[_0x8f1d('0x44')](_0x2956f0[_0x8f1d('0x45')]);_0x338615['filters']=_[_0x8f1d('0x47')](_0x338615[_0x8f1d('0x42')],_0x338615['query']);_0x565387[_0x8f1d('0x49')]=_[_0x8f1d('0x47')](_0x338615[_0x8f1d('0x42')],qs[_0x8f1d('0x48')](_0x2956f0[_0x8f1d('0x45')]['fields']));_0x565387[_0x8f1d('0x49')]=_0x565387[_0x8f1d('0x49')][_0x8f1d('0x59')]?_0x565387[_0x8f1d('0x49')]:_0x338615[_0x8f1d('0x42')];if(!_0x2956f0[_0x8f1d('0x45')][_0x8f1d('0x4a')](_0x8f1d('0x6a'))){_0x565387['limit']=qs[_0x8f1d('0x2f')](_0x2956f0[_0x8f1d('0x45')][_0x8f1d('0x2f')]);_0x565387['offset']=qs[_0x8f1d('0x4b')](_0x2956f0[_0x8f1d('0x45')]['offset']);}_0x565387[_0x8f1d('0x4c')]=qs[_0x8f1d('0x4d')](_0x2956f0['query'][_0x8f1d('0x4d')]);_0x565387['where']=qs[_0x8f1d('0x46')](_[_0x8f1d('0x4f')](_0x2956f0[_0x8f1d('0x45')],_0x338615[_0x8f1d('0x46')]));_0x565387[_0x8f1d('0x4e')][_0x8f1d('0x6b')]=_0x1b1da8['id'];if(_0x2956f0[_0x8f1d('0x45')][_0x8f1d('0x50')]){_0x565387[_0x8f1d('0x4e')]=_[_0x8f1d('0x51')](_0x565387[_0x8f1d('0x4e')],{'$or':_['map'](_0x565387[_0x8f1d('0x49')],function(_0x4db555){var _0x1099d3={};_0x1099d3[_0x4db555]={'$like':'%'+_0x2956f0[_0x8f1d('0x45')][_0x8f1d('0x50')]+'%'};return _0x1099d3;})});}_0x565387=_['merge']({},_0x565387,_0x2956f0[_0x8f1d('0x53')]);return db['Disposition'][_0x8f1d('0x30')]({'where':_0x565387['where']})['then'](function(_0x5076c3){_0x5340c2[_0x8f1d('0x30')]=_0x5076c3;if(_0x2956f0[_0x8f1d('0x45')][_0x8f1d('0x54')]){_0x565387[_0x8f1d('0x5a')]=[{'all':!![]}];}return db[_0x8f1d('0x66')]['findAll'](_0x565387);})[_0x8f1d('0x20')](function(_0x4c99a6){_0x5340c2[_0x8f1d('0x56')]=_0x4c99a6;return _0x5340c2;});}})[_0x8f1d('0x20')](respondWithFilteredResult(_0x276b54,_0x565387))[_0x8f1d('0x2a')](handleError(_0x276b54,null));};exports[_0x8f1d('0x6c')]=function(_0x45e5ff,_0x352183,_0x481d80){return db[_0x8f1d('0x3f')][_0x8f1d('0x5b')]({'where':{'id':_0x45e5ff[_0x8f1d('0x58')]['id']}})[_0x8f1d('0x20')](handleEntityNotFound(_0x352183,null))[_0x8f1d('0x20')](function(_0x17df00){if(_0x17df00){return _0x17df00[_0x8f1d('0x6c')](_0x45e5ff[_0x8f1d('0x45')][_0x8f1d('0x6d')]);}})[_0x8f1d('0x20')](respondWithStatusCode(_0x352183,null))[_0x8f1d('0x2a')](handleError(_0x352183,null));};exports[_0x8f1d('0x6e')]=function(_0x5e8155,_0x73f94c,_0x1d0615){if(_0x5e8155['body']['id']){delete _0x5e8155[_0x8f1d('0x5d')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x5e8155[_0x8f1d('0x58')]['id']}})[_0x8f1d('0x20')](handleEntityNotFound(_0x73f94c,null))[_0x8f1d('0x20')](function(_0xbd2483){if(_0xbd2483){_0x5e8155[_0x8f1d('0x5d')][_0x8f1d('0x6b')]=_0xbd2483['id'];return db[_0x8f1d('0x6f')][_0x8f1d('0x5c')](_0x5e8155[_0x8f1d('0x5d')]);}})['then'](respondWithResult(_0x73f94c,null))[_0x8f1d('0x2a')](handleError(_0x73f94c,null));};exports[_0x8f1d('0x70')]=function(_0x4d3103,_0x1d4d80,_0x18684f){var _0x306847={'raw':![],'where':{}};var _0x54d196={};var _0x338c3b={'count':0x0,'rows':[]};return db[_0x8f1d('0x3f')][_0x8f1d('0x68')]({'where':{'id':_0x4d3103['params']['id']}})[_0x8f1d('0x20')](handleEntityNotFound(_0x1d4d80,null))[_0x8f1d('0x20')](function(_0x59b988){if(_0x59b988){_0x54d196[_0x8f1d('0x42')]=_['keys'](db[_0x8f1d('0x6f')]['rawAttributes']);_0x54d196['query']=_['keys'](_0x4d3103[_0x8f1d('0x45')]);_0x54d196[_0x8f1d('0x46')]=_[_0x8f1d('0x47')](_0x54d196[_0x8f1d('0x42')],_0x54d196['query']);_0x306847[_0x8f1d('0x49')]=_['intersection'](_0x54d196[_0x8f1d('0x42')],qs['fields'](_0x4d3103[_0x8f1d('0x45')][_0x8f1d('0x48')]));_0x306847[_0x8f1d('0x49')]=_0x306847['attributes'][_0x8f1d('0x59')]?_0x306847[_0x8f1d('0x49')]:_0x54d196[_0x8f1d('0x42')];if(!_0x4d3103[_0x8f1d('0x45')]['hasOwnProperty'](_0x8f1d('0x6a'))){_0x306847[_0x8f1d('0x2f')]=qs['limit'](_0x4d3103[_0x8f1d('0x45')]['limit']);_0x306847[_0x8f1d('0x4b')]=qs[_0x8f1d('0x4b')](_0x4d3103[_0x8f1d('0x45')][_0x8f1d('0x4b')]);}_0x306847[_0x8f1d('0x4c')]=qs['sort'](_0x4d3103['query'][_0x8f1d('0x4d')]);_0x306847[_0x8f1d('0x4e')]=qs['filters'](_[_0x8f1d('0x4f')](_0x4d3103[_0x8f1d('0x45')],_0x54d196[_0x8f1d('0x46')]));_0x306847[_0x8f1d('0x4e')][_0x8f1d('0x6b')]=_0x59b988['id'];if(_0x4d3103[_0x8f1d('0x45')][_0x8f1d('0x50')]){_0x306847[_0x8f1d('0x4e')]=_[_0x8f1d('0x51')](_0x306847[_0x8f1d('0x4e')],{'$or':_['map'](_0x306847['attributes'],function(_0x42d5fb){var _0x21725e={};_0x21725e[_0x42d5fb]={'$like':'%'+_0x4d3103[_0x8f1d('0x45')]['filter']+'%'};return _0x21725e;})});}_0x306847=_[_0x8f1d('0x51')]({},_0x306847,_0x4d3103[_0x8f1d('0x53')]);return db['CannedAnswer'][_0x8f1d('0x30')]({'where':_0x306847[_0x8f1d('0x4e')]})[_0x8f1d('0x20')](function(_0x2e4d7c){_0x338c3b[_0x8f1d('0x30')]=_0x2e4d7c;if(_0x4d3103[_0x8f1d('0x45')][_0x8f1d('0x54')]){_0x306847[_0x8f1d('0x5a')]=[{'all':!![]}];}return db[_0x8f1d('0x6f')][_0x8f1d('0x55')](_0x306847);})['then'](function(_0x555b1a){_0x338c3b[_0x8f1d('0x56')]=_0x555b1a;return _0x338c3b;});}})[_0x8f1d('0x20')](respondWithFilteredResult(_0x1d4d80,_0x306847))[_0x8f1d('0x2a')](handleError(_0x1d4d80,null));};exports[_0x8f1d('0x71')]=function(_0x22675c,_0x5bf87d,_0x3f7bde){return db[_0x8f1d('0x3f')][_0x8f1d('0x5b')]({'where':{'id':_0x22675c[_0x8f1d('0x58')]['id']}})[_0x8f1d('0x20')](handleEntityNotFound(_0x5bf87d,null))[_0x8f1d('0x20')](function(_0x45f6e5){if(_0x45f6e5){return _0x45f6e5[_0x8f1d('0x71')](_0x22675c[_0x8f1d('0x45')]['ids']);}})[_0x8f1d('0x20')](respondWithStatusCode(_0x5bf87d,null))['catch'](handleError(_0x5bf87d,null));};exports[_0x8f1d('0x72')]=function(_0x11ebc1,_0x4d1dbc,_0x4601db){return db[_0x8f1d('0x3f')][_0x8f1d('0x5b')]({'where':{'id':_0x11ebc1[_0x8f1d('0x58')]['id']}})['then'](handleEntityNotFound(_0x4d1dbc,null))[_0x8f1d('0x20')](function(_0x15f278){if(_0x15f278){return _0x15f278[_0x8f1d('0x72')](_0x11ebc1[_0x8f1d('0x5d')][_0x8f1d('0x6d')],_['omit'](_0x11ebc1[_0x8f1d('0x5d')],[_0x8f1d('0x6d'),'id'])||{})[_0x8f1d('0x73')](function(_0xfb838c){for(var _0x12b955=0x0;_0x12b955<_0x11ebc1[_0x8f1d('0x5d')][_0x8f1d('0x6d')][_0x8f1d('0x59')];_0x12b955+=0x1){socket['emit'](_0x8f1d('0x74'),{'UserId':Number(_0x11ebc1[_0x8f1d('0x5d')][_0x8f1d('0x6d')][_0x12b955]),'WhatsappAccountId':Number(_0x11ebc1[_0x8f1d('0x58')]['id'])});}return _0xfb838c;});}})[_0x8f1d('0x20')](respondWithResult(_0x4d1dbc,null))[_0x8f1d('0x2a')](handleError(_0x4d1dbc,null));};exports['removeAgents']=function(_0x5baf1c,_0x1ddafc,_0x9d3c1c){return db['WhatsappAccount']['find']({'where':{'id':_0x5baf1c[_0x8f1d('0x58')]['id']}})['then'](handleEntityNotFound(_0x1ddafc,null))[_0x8f1d('0x20')](function(_0x1f4ab1){if(_0x1f4ab1){return _0x1f4ab1[_0x8f1d('0x75')](_0x5baf1c[_0x8f1d('0x45')][_0x8f1d('0x6d')])['then'](function(){if(_[_0x8f1d('0x76')](_0x5baf1c['query']['ids'])){for(var _0xcb7be7=0x0;_0xcb7be7<_0x5baf1c[_0x8f1d('0x45')][_0x8f1d('0x6d')][_0x8f1d('0x59')];_0xcb7be7+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x5baf1c[_0x8f1d('0x45')]['ids'][_0xcb7be7]),'WhatsappAccountId':Number(_0x5baf1c[_0x8f1d('0x58')]['id'])});}}else{socket[_0x8f1d('0x77')](_0x8f1d('0x78'),{'UserId':Number(_0x5baf1c[_0x8f1d('0x45')][_0x8f1d('0x6d')]),'WhatsappAccountId':Number(_0x5baf1c[_0x8f1d('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x1ddafc,null))[_0x8f1d('0x2a')](handleError(_0x1ddafc,null));};exports[_0x8f1d('0x79')]=function(_0x5db00f,_0x2d6ef3,_0x2cc296){var _0xa52d99={};var _0x3182a1={};var _0x42962d;var _0x42cde1;return db[_0x8f1d('0x3f')][_0x8f1d('0x68')]({'where':{'id':_0x5db00f[_0x8f1d('0x58')]['id']}})[_0x8f1d('0x20')](handleEntityNotFound(_0x2d6ef3,null))['then'](function(_0x3f408d){if(_0x3f408d){_0x42962d=_0x3f408d;_0x3182a1[_0x8f1d('0x42')]=_[_0x8f1d('0x44')](db['User'][_0x8f1d('0x69')]);_0x3182a1['query']=_['keys'](_0x5db00f[_0x8f1d('0x45')]);_0x3182a1[_0x8f1d('0x46')]=_[_0x8f1d('0x47')](_0x3182a1[_0x8f1d('0x42')],_0x3182a1[_0x8f1d('0x45')]);_0xa52d99['attributes']=_[_0x8f1d('0x47')](_0x3182a1['model'],qs[_0x8f1d('0x48')](_0x5db00f[_0x8f1d('0x45')][_0x8f1d('0x48')]));_0xa52d99[_0x8f1d('0x49')]=_0xa52d99[_0x8f1d('0x49')]['length']?_0xa52d99[_0x8f1d('0x49')]:_0x3182a1[_0x8f1d('0x42')];_0xa52d99[_0x8f1d('0x4c')]=qs['sort'](_0x5db00f[_0x8f1d('0x45')][_0x8f1d('0x4d')]);_0xa52d99[_0x8f1d('0x4e')]=qs[_0x8f1d('0x46')](_[_0x8f1d('0x4f')](_0x5db00f['query'],_0x3182a1['filters']));if(_0x5db00f[_0x8f1d('0x45')]['filter']){_0xa52d99[_0x8f1d('0x4e')]=_[_0x8f1d('0x51')](_0xa52d99['where'],{'$or':_[_0x8f1d('0x43')](_0xa52d99[_0x8f1d('0x49')],function(_0x21d744){var _0x2d3969={};_0x2d3969[_0x21d744]={'$like':'%'+_0x5db00f[_0x8f1d('0x45')]['filter']+'%'};return _0x2d3969;})});}_0xa52d99=_[_0x8f1d('0x51')]({},_0xa52d99,_0x5db00f[_0x8f1d('0x53')]);return _0x42962d[_0x8f1d('0x79')](_0xa52d99);}})[_0x8f1d('0x20')](function(_0x2fdd1c){if(_0x2fdd1c){_0x42cde1=_0x2fdd1c[_0x8f1d('0x59')];if(!_0x5db00f[_0x8f1d('0x45')][_0x8f1d('0x4a')](_0x8f1d('0x6a'))){_0xa52d99[_0x8f1d('0x2f')]=qs[_0x8f1d('0x2f')](_0x5db00f[_0x8f1d('0x45')]['limit']);_0xa52d99[_0x8f1d('0x4b')]=qs[_0x8f1d('0x4b')](_0x5db00f[_0x8f1d('0x45')][_0x8f1d('0x4b')]);}return _0x42962d['getAgents'](_0xa52d99);}})[_0x8f1d('0x20')](function(_0x34a308){if(_0x34a308){return _0x34a308?{'count':_0x42cde1,'rows':_0x34a308}:null;}})['then'](respondWithResult(_0x2d6ef3,null))[_0x8f1d('0x2a')](handleError(_0x2d6ef3,null));};exports[_0x8f1d('0x7a')]=function(_0x191a22,_0x2c5fac){var _0x214cbc=_0x191a22[_0x8f1d('0x58')]['id'];var _0x577835=_0x191a22['body'];var _0x1052c7=0xc8;var _0x52a5b5=null;return db[_0x8f1d('0x7b')]['transaction']({'isolationLevel':db[_0x8f1d('0x7b')][_0x8f1d('0x7c')][_0x8f1d('0x7d')][_0x8f1d('0x7e')]},function(_0x486574){return db[_0x8f1d('0x3f')][_0x8f1d('0x68')]({'where':{'id':_0x214cbc},'transaction':_0x486574})[_0x8f1d('0x20')](function(_0x5326de){if(_0x5326de){return db[_0x8f1d('0x7f')]['destroy']({'where':{'WhatsappAccountId':_0x214cbc},'transaction':_0x486574})[_0x8f1d('0x20')](function(){var _0x35bf9e=_[_0x8f1d('0x43')](_0x577835,function(_0xa14cbb){_0xa14cbb[_0x8f1d('0x6b')]=_0x214cbc;return _0xa14cbb;});return db['WhatsappApplication'][_0x8f1d('0x80')](_0x35bf9e,{'transaction':_0x486574});});}else{_0x1052c7=0x194;_0x52a5b5=[];}});})[_0x8f1d('0x20')](function(){if(_0x1052c7!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x214cbc},'order':_0x8f1d('0x81')})[_0x8f1d('0x20')](function(_0x582f83){_0x52a5b5=_0x582f83;});}})['catch'](function(_0x351b36){_0x1052c7=0x1f4;logger[_0x8f1d('0x27')](_0x351b36[_0x8f1d('0x39')]);if(_0x351b36[_0x8f1d('0x3a')]){delete _0x351b36[_0x8f1d('0x3a')];}_0x52a5b5=_0x351b36;})[_0x8f1d('0x82')](function(){if(_0x52a5b5===null){_0x2c5fac[_0x8f1d('0x2b')](_0x1052c7);}else{if(_0x1052c7===0x1f4){_0x2c5fac['status'](_0x1052c7)[_0x8f1d('0x3b')](_0x52a5b5);}else{_0x2c5fac[_0x8f1d('0x2d')](_0x1052c7)['json'](_0x52a5b5);}}});};exports[_0x8f1d('0x83')]=function(_0x4e12d4,_0x298b79,_0x51e4d3){var _0x460a8c={};var _0x587e29={};var _0x404222;var _0x92137a;return db['WhatsappAccount'][_0x8f1d('0x68')]({'where':{'id':_0x4e12d4[_0x8f1d('0x58')]['id']}})[_0x8f1d('0x20')](handleEntityNotFound(_0x298b79,null))[_0x8f1d('0x20')](function(_0x4b87c4){if(_0x4b87c4){_0x404222=_0x4b87c4;_0x587e29['model']=_['keys'](db[_0x8f1d('0x7f')][_0x8f1d('0x69')]);_0x587e29['query']=_[_0x8f1d('0x44')](_0x4e12d4['query']);_0x587e29[_0x8f1d('0x46')]=_[_0x8f1d('0x47')](_0x587e29[_0x8f1d('0x42')],_0x587e29[_0x8f1d('0x45')]);_0x460a8c['attributes']=_['intersection'](_0x587e29[_0x8f1d('0x42')],qs[_0x8f1d('0x48')](_0x4e12d4[_0x8f1d('0x45')]['fields']));_0x460a8c[_0x8f1d('0x49')]=_0x460a8c[_0x8f1d('0x49')][_0x8f1d('0x59')]?_0x460a8c[_0x8f1d('0x49')]:_0x587e29['model'];_0x460a8c[_0x8f1d('0x4c')]=qs[_0x8f1d('0x4d')](_0x4e12d4[_0x8f1d('0x45')][_0x8f1d('0x4d')]);_0x460a8c[_0x8f1d('0x4e')]=qs[_0x8f1d('0x46')](_[_0x8f1d('0x4f')](_0x4e12d4[_0x8f1d('0x45')],_0x587e29[_0x8f1d('0x46')]));if(_0x4e12d4[_0x8f1d('0x45')][_0x8f1d('0x50')]){_0x460a8c[_0x8f1d('0x4e')]=_[_0x8f1d('0x51')](_0x460a8c['where'],{'$or':_[_0x8f1d('0x43')](_0x460a8c[_0x8f1d('0x49')],function(_0xa76bc7){var _0x41d35a={};_0x41d35a[_0xa76bc7]={'$like':'%'+_0x4e12d4[_0x8f1d('0x45')][_0x8f1d('0x50')]+'%'};return _0x41d35a;})});}_0x460a8c=_[_0x8f1d('0x51')]({},_0x460a8c,_0x4e12d4[_0x8f1d('0x53')]);return _0x404222[_0x8f1d('0x83')](_0x460a8c);}})[_0x8f1d('0x20')](function(_0x20bce6){if(_0x20bce6){_0x92137a=_0x20bce6['length'];if(!_0x4e12d4[_0x8f1d('0x45')][_0x8f1d('0x4a')](_0x8f1d('0x6a'))){_0x460a8c[_0x8f1d('0x2f')]=qs['limit'](_0x4e12d4[_0x8f1d('0x45')]['limit']);_0x460a8c[_0x8f1d('0x4b')]=qs[_0x8f1d('0x4b')](_0x4e12d4[_0x8f1d('0x45')][_0x8f1d('0x4b')]);}return _0x404222[_0x8f1d('0x83')](_0x460a8c);}})['then'](function(_0x52b98b){if(_0x52b98b){return _0x52b98b?{'count':_0x92137a,'rows':_0x52b98b}:null;}})[_0x8f1d('0x20')](respondWithResult(_0x298b79,null))[_0x8f1d('0x2a')](handleError(_0x298b79,null));};exports[_0x8f1d('0x84')]=function(_0x52a4a3,_0xc9b753,_0x538a4e){var _0x51f463={'channel':_0x8f1d('0x85')};var _0x1bcbbd=[];var _0x32ce2c=[];var _0x5596d9={};return db[_0x8f1d('0x3f')][_0x8f1d('0x5b')]({'where':{'id':_0x52a4a3[_0x8f1d('0x58')]['id']},'include':[{'model':db[_0x8f1d('0x7f')],'as':_0x8f1d('0x86')}]})[_0x8f1d('0x20')](handleEntityNotFound(_0xc9b753,null))[_0x8f1d('0x20')](function(_0x3fb1d8){_0x51f463[_0x8f1d('0x87')]=_0x3fb1d8;if(_0x51f463[_0x8f1d('0x87')]&&_0x51f463[_0x8f1d('0x87')][_0x8f1d('0x88')]===_0x8f1d('0x89')&&_0x52a4a3['body'][_0x8f1d('0x8a')]){if(_0x52a4a3[_0x8f1d('0x5d')][_0x8f1d('0x8a')]['length']===0x0)return;if(_0x52a4a3[_0x8f1d('0x5d')]['statuses'][0x0][_0x8f1d('0x8b')]!=='read')return;return db['WhatsappMessage'][_0x8f1d('0x36')]({'read':!![],'readAt':_0x52a4a3[_0x8f1d('0x5d')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x52a4a3['body'][_0x8f1d('0x8a')][0x0][_0x8f1d('0x8c')]},'individualHooks':!![]})[_0x8f1d('0x20')](function(_0x10d1e8){return _0xc9b753[_0x8f1d('0x2d')](0xc8)['json'](_0x10d1e8);});}_0x51f463[_0x8f1d('0x8d')]=_[_0x8f1d('0x8e')](_0x3fb1d8[_0x8f1d('0x86')],[_0x8f1d('0x81')],[_0x8f1d('0x8f')]);if(_0x51f463['account']['Applications']){delete _0x51f463[_0x8f1d('0x87')][_0x8f1d('0x86')];}return db[_0x8f1d('0x90')][_0x8f1d('0x65')]()['then'](function(_0x2455d1){if(!_0x2455d1){throw new db['Sequelize'][(_0x8f1d('0x91'))](_0x8f1d('0x92'));}_0x1bcbbd=_['difference'](_[_0x8f1d('0x44')](_0x2455d1),['createdAt','updatedAt']);_0x32ce2c=_['difference'](_[_0x8f1d('0x44')](_0x2455d1),[_0x8f1d('0x93'),_0x8f1d('0x94'),_0x8f1d('0x95'),_0x8f1d('0x96')]);_0x51f463[_0x8f1d('0x5d')]={'mapKey':_0x8f1d('0x97')};if(_0x51f463[_0x8f1d('0x87')]&&_0x51f463['account'][_0x8f1d('0x88')]===_0x8f1d('0x98')){_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0x99')]=_0x52a4a3[_0x8f1d('0x5d')][_0x8f1d('0x9a')]['replace'](_0x8f1d('0x9b'),'');_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0x5d')]=_0x52a4a3[_0x8f1d('0x5d')][_0x8f1d('0x9c')];_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0x9d')]=_0x52a4a3['body']['MessageSid'];}if(_0x51f463['account']&&_0x51f463[_0x8f1d('0x87')][_0x8f1d('0x88')]===_0x8f1d('0x89')){_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0x99')]=_0x52a4a3[_0x8f1d('0x5d')][_0x8f1d('0x9e')][0x0][_0x8f1d('0x99')];_0x51f463['body']['body']=_0x52a4a3[_0x8f1d('0x5d')][_0x8f1d('0x9e')][0x0][_0x8f1d('0x29')][_0x8f1d('0x5d')];_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0x9d')]=_0x52a4a3[_0x8f1d('0x5d')][_0x8f1d('0x9e')][0x0][_0x8f1d('0x8c')];}if(_0x51f463['body']['id']){delete _0x51f463[_0x8f1d('0x5d')]['id'];}if(_[_0x8f1d('0x9f')](_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0x99')])){throw new db[(_0x8f1d('0xa0'))][(_0x8f1d('0x91'))](_0x8f1d('0xa1'));}if(_[_0x8f1d('0x9f')](_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0x5d')])||_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0x5d')]===''){throw new db['Sequelize'][(_0x8f1d('0x91'))](_0x8f1d('0xa2'));}if(_['isNil'](_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0xa3')])){throw new db[(_0x8f1d('0xa0'))][(_0x8f1d('0x91'))](_0x8f1d('0xa4')+_0x32ce2c);}if(!_[_0x8f1d('0xa5')](_0x32ce2c,_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0xa3')])){throw new db['Sequelize'][(_0x8f1d('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x32ce2c);}_0x5596d9[_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0xa3')]]=_0x51f463['body'][_0x8f1d('0x99')];return db[_0x8f1d('0xa6')][_0x8f1d('0x5b')]({'where':{'id':_0x51f463[_0x8f1d('0x87')][_0x8f1d('0x96')]},'include':[{'model':db[_0x8f1d('0x90')],'as':'Contacts','where':_0x5596d9,'limit':0x1,'order':[[_0x8f1d('0x94'),_0x8f1d('0xa7')]]}]});})['then'](handleEntityNotFound(_0xc9b753,null))[_0x8f1d('0x20')](function(_0x144b4c){if(_0x144b4c){_0x51f463[_0x8f1d('0xa8')]=_[_0x8f1d('0xa9')](_0x144b4c,['Contacts']);if(_0x144b4c[_0x8f1d('0xaa')]['length']){return _0x144b4c[_0x8f1d('0xaa')][0x0];}var _0x3eb728=_[_0x8f1d('0x19')](_0x51f463['body'],{'firstName':_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0x99')],'ListId':_0x144b4c['id']});_0x3eb728[_0x51f463['body'][_0x8f1d('0xa3')]]=_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0x99')];return db[_0x8f1d('0x90')]['create'](_0x3eb728,{'fields':_0x1bcbbd,'raw':!![]});}})[_0x8f1d('0x20')](handleEntityNotFound(_0xc9b753,null))[_0x8f1d('0x20')](function(_0x58822d){if(_0x58822d){_0x51f463[_0x8f1d('0xab')]=_0x58822d;var _0x36e9e2={'ContactId':_0x58822d['id'],'phone':_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0x99')],'WhatsappAccountId':_0x52a4a3[_0x8f1d('0x58')]['id']};var _0x4ab814={'ContactId':_0x58822d['id'],'WhatsappAccountId':_0x52a4a3[_0x8f1d('0x58')]['id'],'closed':![]};return db[_0x8f1d('0xac')][_0x8f1d('0x5b')]({'where':_0x4ab814})[_0x8f1d('0x20')](function(_0x15651a){if(_0x15651a){return[_0x15651a,![]];}return db[_0x8f1d('0xac')][_0x8f1d('0x5c')](_0x36e9e2)['then'](function(_0xc372bf){return[_0xc372bf,!![]];});});}})[_0x8f1d('0x73')](function(_0x1f2996,_0x2a63f7){_0x51f463[_0x8f1d('0xad')]=_0x1f2996['get']({'plain':!![]});_0x51f463[_0x8f1d('0xad')][_0x8f1d('0xae')]=![];if(_0x2a63f7){if(_0x51f463['account'][_0x8f1d('0xaf')]){_0x51f463[_0x8f1d('0x8d')]['push']({'id':0x0,'priority':_0x51f463['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x8f1d('0xb0')});}_0x51f463[_0x8f1d('0xad')][_0x8f1d('0xae')]=!![];}return db[_0x8f1d('0xb1')][_0x8f1d('0x5c')]({'phone':_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0x99')],'messageId':_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0x9d')],'body':_0x51f463[_0x8f1d('0x5d')][_0x8f1d('0x5d')],'WhatsappAccountId':_0x52a4a3[_0x8f1d('0x58')]['id'],'WhatsappInteractionId':_0x1f2996['id'],'direction':'in','ContactId':_0x1f2996[_0x8f1d('0xb2')],'AttachmentId':_0x51f463['body'][_0x8f1d('0xb3')]});})[_0x8f1d('0x20')](function(_0x1e9a53){_0x51f463[_0x8f1d('0x29')]=_0x1e9a53;if(_0x51f463[_0x8f1d('0xad')][_0x8f1d('0xb4')]){return db[_0x8f1d('0xb5')]['find']({'attributes':['id',_0x8f1d('0x3a')],'where':{'id':_0x51f463[_0x8f1d('0xad')][_0x8f1d('0xb4')]}})[_0x8f1d('0x20')](function(_0x58616f){if(_0x58616f){_0x51f463[_0x8f1d('0x8d')][_0x8f1d('0xb6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x58616f[_0x8f1d('0x3a')]+','+(_0x51f463[_0x8f1d('0x87')][_0x8f1d('0xb7')]||0xa),'interval':_0x8f1d('0xb0')});}return respondWithRpcPromise(_0x8f1d('0xb8'),'startRouting',_0x51f463);});}return respondWithRpcPromise(_0x8f1d('0xb8'),_0x8f1d('0xb9'),_0x51f463);})[_0x8f1d('0x20')](function(_0xce89b2){if(_0xce89b2){var _0x2e1d6b=0xc8;var _0x1ecef0='receiveMessage';logger['info'](_0x8f1d('0x24'),_0x1ecef0,_0x2e1d6b,_0x8f1d('0xba'));logger['debug'](_0x8f1d('0xbb'),_0x1ecef0,_0x2e1d6b,'entity\x20found',JSON[_0x8f1d('0x26')](_0xce89b2));if(_0x51f463[_0x8f1d('0x87')][_0x8f1d('0x88')]==='twilio'){return _0xc9b753[_0x8f1d('0x2d')](_0x2e1d6b)[_0x8f1d('0x31')](_0x8f1d('0xbc'),'text/xml')[_0x8f1d('0x3b')](_0x8f1d('0xbd'));}else{return _0xc9b753['status'](_0x2e1d6b)[_0x8f1d('0x33')](_0xce89b2);}}});})[_0x8f1d('0x2a')](handleError(_0xc9b753,null));};exports['send']=function(_0xc1f0d5,_0x3f8a88,_0x5918dd){var _0xd533b1,_0x48dcd5,_0x31b32f;if(_['isNil'](_0xc1f0d5['body'][_0x8f1d('0x5d')])||_0xc1f0d5[_0x8f1d('0x5d')]['body']===''){throw new db[(_0x8f1d('0xa0'))]['ValidationError'](_0x8f1d('0xa2'));}if(_['isNil'](_0xc1f0d5[_0x8f1d('0x5d')]['to'])){throw new db[(_0x8f1d('0xa0'))][(_0x8f1d('0x91'))](_0x8f1d('0xbe'));}_0xd533b1=_0xc1f0d5[_0x8f1d('0x5d')]['to'];return db[_0x8f1d('0x3f')][_0x8f1d('0x5b')]({'where':{'id':_0xc1f0d5[_0x8f1d('0x58')]['id']},'include':[{'model':db[_0x8f1d('0xa6')],'as':_0x8f1d('0xbf'),'include':[{'model':db[_0x8f1d('0x90')],'as':_0x8f1d('0xaa'),'where':{'mobile':_0xd533b1},'limit':0x1,'order':[[_0x8f1d('0x94'),'DESC']]}]}]})[_0x8f1d('0x20')](handleEntityNotFound(_0x3f8a88,null))[_0x8f1d('0x20')](function(_0x1ae836){if(_0x1ae836&&_0x1ae836[_0x8f1d('0xbf')]){_0x48dcd5=_0x1ae836[_0x8f1d('0x5f')]({'plain':!![]});if(_0x48dcd5[_0x8f1d('0xbf')]&&_0x48dcd5['List'][_0x8f1d('0xaa')][_0x8f1d('0x59')]){return _0x48dcd5[_0x8f1d('0xbf')][_0x8f1d('0xaa')][0x0];}return db[_0x8f1d('0x90')]['create'](_[_0x8f1d('0x19')](_0xc1f0d5[_0x8f1d('0x5d')],{'firstName':_0xd533b1,'mobile':_0xd533b1,'phone':_0xd533b1,'ListId':_0x48dcd5[_0x8f1d('0x96')]}));}})[_0x8f1d('0x20')](handleEntityNotFound(_0x3f8a88,null))[_0x8f1d('0x20')](function(_0x39a1e2){if(_0x39a1e2){_0x31b32f=_0x39a1e2;return db[_0x8f1d('0xac')][_0x8f1d('0x5b')]({'where':{'ContactId':_0x31b32f['id'],'closed':![],'WhatsappAccountId':_0x48dcd5['id']}})[_0x8f1d('0x20')](function(_0xa5a61d){if(_0xa5a61d){return[_0xa5a61d,![]];}return db[_0x8f1d('0xac')]['create']({'UserId':_0xc1f0d5[_0x8f1d('0x5e')]['id'],'ContactId':_0x31b32f['id'],'WhatsappAccountId':_0x48dcd5['id'],'phone':_0xd533b1,'firstMsgDirection':_0x8f1d('0xc0'),'Messages':[_[_0x8f1d('0x51')](_0xc1f0d5['body'],{'read':![],'body':_0xc1f0d5[_0x8f1d('0x5d')]['body'],'phone':_0xd533b1,'WhatsappAccountId':_0x48dcd5['id'],'UserId':_0xc1f0d5[_0x8f1d('0x5e')]['id'],'ContactId':_0x31b32f['id']})]},{'include':[{'model':db[_0x8f1d('0xb1')],'as':_0x8f1d('0xc1')}]})['then'](function(_0x1c02fc){return[_0x1c02fc,!![]];});});}})[_0x8f1d('0x73')](function(_0x1edc8d,_0x13ee31){if(_0x13ee31){return _0x1edc8d;}return db[_0x8f1d('0xb1')][_0x8f1d('0x5c')](_[_0x8f1d('0x51')](_0xc1f0d5['body'],{'read':![],'body':_0xc1f0d5[_0x8f1d('0x5d')]['body'],'phone':_0xd533b1,'WhatsappAccountId':_0x48dcd5['id'],'WhatsappInteractionId':_0x1edc8d['id'],'UserId':_0xc1f0d5[_0x8f1d('0x5e')]['id'],'ContactId':_0x31b32f['id']}))[_0x8f1d('0x20')](function(_0x296bb1){_0x1edc8d[_0x8f1d('0xc2')][_0x8f1d('0xc1')]=[];_0x1edc8d[_0x8f1d('0xc2')][_0x8f1d('0xc1')][_0x8f1d('0xc3')](_0x296bb1[_0x8f1d('0xc2')]);return _0x1edc8d;});})[_0x8f1d('0x20')](respondWithResult(_0x3f8a88,null))[_0x8f1d('0x2a')](handleError(_0x3f8a88,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 8e077ae..7190146 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 _0x0644=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3f87eb,_0x44596e){var _0x2d7ef1=function(_0x18ae41){while(--_0x18ae41){_0x3f87eb['push'](_0x3f87eb['shift']());}};_0x2d7ef1(++_0x44596e);}(_0x0644,0x1b8));var _0x4064=function(_0x55a20f,_0x57d254){_0x55a20f=_0x55a20f-0x0;var _0x357924=_0x0644[_0x55a20f];return _0x357924;};'use strict';var EventEmitter=require(_0x4064('0x0'));var WhatsappAccount=require(_0x4064('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x4064('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4064('0x3'),'afterDestroy':_0x4064('0x4')};function emitEvent(_0x94814b){return function(_0xa7e7a6,_0x4ddeb4,_0x7ae18){WhatsappAccountEvents['emit'](_0x94814b+':'+_0xa7e7a6['id'],_0xa7e7a6);WhatsappAccountEvents[_0x4064('0x5')](_0x94814b,_0xa7e7a6);_0x7ae18(null);};}for(var e in events){if(events[_0x4064('0x6')](e)){var event=events[e];WhatsappAccount[_0x4064('0x7')](e,emitEvent(event));}}module[_0x4064('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x8f76=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','save','update','emit'];(function(_0x22b2f6,_0x21a80b){var _0x2b70ab=function(_0x19baa7){while(--_0x19baa7){_0x22b2f6['push'](_0x22b2f6['shift']());}};_0x2b70ab(++_0x21a80b);}(_0x8f76,0xe4));var _0x68f7=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x8f76[_0x46aff0];return _0x9d78cf;};'use strict';var EventEmitter=require(_0x68f7('0x0'));var WhatsappAccount=require(_0x68f7('0x1'))['db'][_0x68f7('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x68f7('0x3'),'afterUpdate':_0x68f7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x25311c){return function(_0x412103,_0x36a62b,_0x27571c){WhatsappAccountEvents['emit'](_0x25311c+':'+_0x412103['id'],_0x412103);WhatsappAccountEvents[_0x68f7('0x5')](_0x25311c,_0x412103);_0x27571c(null);};}for(var e in events){if(events[_0x68f7('0x6')](e)){var event=events[e];WhatsappAccount[_0x68f7('0x7')](e,emitEvent(event));}}module[_0x68f7('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 5af8906..85287f7 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 _0x7e93=['define','../../config/logger','api','moment','request-promise','../../config/environment','./whatsappAccount.attributes'];(function(_0x5a26d5,_0x317a00){var _0x1e6190=function(_0x178b48){while(--_0x178b48){_0x5a26d5['push'](_0x5a26d5['shift']());}};_0x1e6190(++_0x317a00);}(_0x7e93,0x1f2));var _0x37e9=function(_0xb15e22,_0x75380c){_0xb15e22=_0xb15e22-0x0;var _0x23b33a=_0x7e93[_0xb15e22];return _0x23b33a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x37e9('0x0'))(_0x37e9('0x1'));var moment=require(_0x37e9('0x2'));var BPromise=require('bluebird');var rp=require(_0x37e9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x37e9('0x4'));var attributes=require(_0x37e9('0x5'));module['exports']=function(_0x5b552c,_0x148ca7){return _0x5b552c[_0x37e9('0x6')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd940=['WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd940,0x1a6));var _0x0d94=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0xd940[_0xe8129c];return _0x709fc5;};'use strict';var _=require(_0x0d94('0x0'));var util=require(_0x0d94('0x1'));var logger=require(_0x0d94('0x2'))(_0x0d94('0x3'));var moment=require(_0x0d94('0x4'));var BPromise=require(_0x0d94('0x5'));var rp=require(_0x0d94('0x6'));var fs=require('fs');var path=require(_0x0d94('0x7'));var rimraf=require(_0x0d94('0x8'));var config=require(_0x0d94('0x9'));var attributes=require(_0x0d94('0xa'));module[_0x0d94('0xb')]=function(_0x499423,_0x47892f){return _0x499423[_0x0d94('0xc')](_0x0d94('0xd'),attributes,{'tableName':_0x0d94('0xe'),'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 5458f4c..25dbf63 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 _0xb71a=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','./whatsappAccount.socket','register','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','catch','ShowWhatsappAccount','WhatsappAccount','find','options','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2474c1,_0x36f89f){var _0x3f54cf=function(_0xbd8fb6){while(--_0xbd8fb6){_0x2474c1['push'](_0x2474c1['shift']());}};_0x3f54cf(++_0x36f89f);}(_0xb71a,0x102));var _0xab71=function(_0x61b3ab,_0x1fc298){_0x61b3ab=_0x61b3ab-0x0;var _0x57097f=_0xb71a[_0x61b3ab];return _0x57097f;};'use strict';var _=require('lodash');var util=require(_0xab71('0x0'));var moment=require(_0xab71('0x1'));var BPromise=require(_0xab71('0x2'));var rs=require(_0xab71('0x3'));var fs=require('fs');var Redis=require(_0xab71('0x4'));var db=require(_0xab71('0x5'))['db'];var utils=require(_0xab71('0x6'));var logger=require(_0xab71('0x7'))('rpc');var config=require(_0xab71('0x8'));var jayson=require(_0xab71('0x9'));var client=jayson[_0xab71('0xa')]['http']({'port':0x232a});config[_0xab71('0xb')]=_[_0xab71('0xc')](config[_0xab71('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab71('0xb')]));require(_0xab71('0xd'))[_0xab71('0xe')](socket);function respondWithRpcPromise(_0x21ad4c,_0x3221df,_0x386cbc){return new BPromise(function(_0x36cbe4,_0x52eed5){return client['request'](_0x21ad4c,_0x386cbc)[_0xab71('0xf')](function(_0x434431){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x3221df,_0xab71('0x10'));logger[_0xab71('0x11')](_0xab71('0x12'),_0x3221df,'request\x20sent',JSON[_0xab71('0x13')](_0x434431));if(_0x434431[_0xab71('0x14')]){if(_0x434431[_0xab71('0x14')][_0xab71('0x15')]===0x1f4){logger[_0xab71('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x3221df,_0x434431[_0xab71('0x14')][_0xab71('0x16')]);return _0x52eed5(_0x434431[_0xab71('0x14')][_0xab71('0x16')]);}logger['error'](_0xab71('0x17'),_0x3221df,_0x434431['error'][_0xab71('0x16')]);return _0x36cbe4(_0x434431[_0xab71('0x14')][_0xab71('0x16')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x3221df,_0xab71('0x10'));_0x36cbe4(_0x434431['result'][_0xab71('0x16')]);}})[_0xab71('0x18')](function(_0xfbe6bc){logger[_0xab71('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x3221df,_0xfbe6bc);_0x52eed5(_0xfbe6bc);});});}exports[_0xab71('0x19')]=function(_0x64b5f2){var _0x33cbe5=this;return new Promise(function(_0x5a4bfe,_0x2f378c){return db[_0xab71('0x1a')][_0xab71('0x1b')]({'raw':_0x64b5f2[_0xab71('0x1c')]?_0x64b5f2[_0xab71('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x64b5f2[_0xab71('0x1c')]?_0x64b5f2[_0xab71('0x1c')]['where']||null:null,'attributes':_0x64b5f2['options']?_0x64b5f2[_0xab71('0x1c')][_0xab71('0x1d')]||null:null,'include':_0x64b5f2[_0xab71('0x1c')]?_0x64b5f2[_0xab71('0x1c')][_0xab71('0x1e')]?_[_0xab71('0x1f')](_0x64b5f2[_0xab71('0x1c')][_0xab71('0x1e')],function(_0x594775){return{'model':db[_0x594775[_0xab71('0x20')]],'as':_0x594775['as'],'attributes':_0x594775['attributes'],'include':_0x594775[_0xab71('0x1e')]?_['map'](_0x594775['include'],function(_0x37ba79){return{'model':db[_0x37ba79[_0xab71('0x20')]],'as':_0x37ba79['as'],'attributes':_0x37ba79['attributes'],'include':_0x37ba79['include']?_[_0xab71('0x1f')](_0x37ba79['include'],function(_0x3905a7){return{'model':db[_0x3905a7[_0xab71('0x20')]],'as':_0x3905a7['as'],'attributes':_0x3905a7[_0xab71('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xab71('0xf')](function(_0x168aa2){logger['info'](_0xab71('0x19'),_0x64b5f2);logger[_0xab71('0x11')](_0xab71('0x19'),_0x64b5f2,JSON[_0xab71('0x13')](_0x168aa2));_0x5a4bfe(_0x168aa2);})['catch'](function(_0x21fc9e){logger[_0xab71('0x14')](_0xab71('0x19'),_0x21fc9e[_0xab71('0x16')],_0x64b5f2);_0x2f378c(_0x33cbe5[_0xab71('0x14')](0x1f4,_0x21fc9e[_0xab71('0x16')]));});});}; \ No newline at end of file +var _0x98f0=['debug','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','catch','lodash','moment','bluebird','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent'];(function(_0x4b24ac,_0x45bf40){var _0x335ecf=function(_0x34fcdf){while(--_0x34fcdf){_0x4b24ac['push'](_0x4b24ac['shift']());}};_0x335ecf(++_0x45bf40);}(_0x98f0,0x1b5));var _0x098f=function(_0x437435,_0x40fc37){_0x437435=_0x437435-0x0;var _0x435af1=_0x98f0[_0x437435];return _0x435af1;};'use strict';var _=require(_0x098f('0x0'));var util=require('util');var moment=require(_0x098f('0x1'));var BPromise=require(_0x098f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x098f('0x3'));var config=require(_0x098f('0x4'));var jayson=require(_0x098f('0x5'));var client=jayson[_0x098f('0x6')][_0x098f('0x7')]({'port':0x232a});config['redis']=_[_0x098f('0x8')](config[_0x098f('0x9')],{'host':_0x098f('0xa'),'port':0x18eb});var socket=require(_0x098f('0xb'))(new Redis(config[_0x098f('0x9')]));require(_0x098f('0xc'))[_0x098f('0xd')](socket);function respondWithRpcPromise(_0x8c7531,_0x4bcd15,_0x5954ea){return new BPromise(function(_0x292e2f,_0x5be478){return client[_0x098f('0xe')](_0x8c7531,_0x5954ea)[_0x098f('0xf')](function(_0x3d13a9){logger[_0x098f('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x4bcd15,_0x098f('0x11'));logger[_0x098f('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4bcd15,_0x098f('0x11'),JSON[_0x098f('0x13')](_0x3d13a9));if(_0x3d13a9[_0x098f('0x14')]){if(_0x3d13a9[_0x098f('0x14')]['code']===0x1f4){logger[_0x098f('0x14')](_0x098f('0x15'),_0x4bcd15,_0x3d13a9['error'][_0x098f('0x16')]);return _0x5be478(_0x3d13a9['error'][_0x098f('0x16')]);}logger[_0x098f('0x14')](_0x098f('0x15'),_0x4bcd15,_0x3d13a9[_0x098f('0x14')][_0x098f('0x16')]);return _0x292e2f(_0x3d13a9['error'][_0x098f('0x16')]);}else{logger[_0x098f('0x10')](_0x098f('0x15'),_0x4bcd15,_0x098f('0x11'));_0x292e2f(_0x3d13a9[_0x098f('0x17')][_0x098f('0x16')]);}})['catch'](function(_0xa85478){logger[_0x098f('0x14')](_0x098f('0x15'),_0x4bcd15,_0xa85478);_0x5be478(_0xa85478);});});}exports[_0x098f('0x18')]=function(_0x1df8f0){var _0x391356=this;return new Promise(function(_0x3c6322,_0x25e661){return db[_0x098f('0x19')][_0x098f('0x1a')]({'raw':_0x1df8f0[_0x098f('0x1b')]?_0x1df8f0[_0x098f('0x1b')][_0x098f('0x1c')]===undefined?!![]:![]:!![],'where':_0x1df8f0[_0x098f('0x1b')]?_0x1df8f0[_0x098f('0x1b')][_0x098f('0x1d')]||null:null,'attributes':_0x1df8f0['options']?_0x1df8f0[_0x098f('0x1b')][_0x098f('0x1e')]||null:null,'include':_0x1df8f0['options']?_0x1df8f0[_0x098f('0x1b')][_0x098f('0x1f')]?_[_0x098f('0x20')](_0x1df8f0[_0x098f('0x1b')]['include'],function(_0x34027a){return{'model':db[_0x34027a[_0x098f('0x21')]],'as':_0x34027a['as'],'attributes':_0x34027a[_0x098f('0x1e')],'include':_0x34027a['include']?_[_0x098f('0x20')](_0x34027a[_0x098f('0x1f')],function(_0xb7fca5){return{'model':db[_0xb7fca5['model']],'as':_0xb7fca5['as'],'attributes':_0xb7fca5[_0x098f('0x1e')],'include':_0xb7fca5[_0x098f('0x1f')]?_[_0x098f('0x20')](_0xb7fca5[_0x098f('0x1f')],function(_0x3146d1){return{'model':db[_0x3146d1[_0x098f('0x21')]],'as':_0x3146d1['as'],'attributes':_0x3146d1[_0x098f('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43907){logger['info'](_0x098f('0x18'),_0x1df8f0);logger['debug'](_0x098f('0x18'),_0x1df8f0,JSON[_0x098f('0x13')](_0x43907));_0x3c6322(_0x43907);})[_0x098f('0x22')](function(_0x1348ae){logger[_0x098f('0x14')](_0x098f('0x18'),_0x1348ae[_0x098f('0x16')],_0x1df8f0);_0x25e661(_0x391356[_0x098f('0x14')](0x1f4,_0x1348ae[_0x098f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 73ca7c5..fbcac4d 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 _0xcafd=['removeListener','register','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x27527b,_0x42672e){var _0x242ed9=function(_0x57f257){while(--_0x57f257){_0x27527b['push'](_0x27527b['shift']());}};_0x242ed9(++_0x42672e);}(_0xcafd,0xcb));var _0xdcaf=function(_0x4bc45b,_0x139998){_0x4bc45b=_0x4bc45b-0x0;var _0x47e9dc=_0xcafd[_0x4bc45b];return _0x47e9dc;};'use strict';var WhatsappAccountEvents=require(_0xdcaf('0x0'));var events=[_0xdcaf('0x1'),'remove','update'];function createListener(_0x5c02b6,_0xdf6cc2){return function(_0x4050c2){_0xdf6cc2['emit'](_0x5c02b6,_0x4050c2);};}function removeListener(_0x1e6d90,_0x2cab87){return function(){WhatsappAccountEvents[_0xdcaf('0x2')](_0x1e6d90,_0x2cab87);};}exports[_0xdcaf('0x3')]=function(_0x56bae3){for(var _0x1deb48=0x0,_0x32aafc=events['length'];_0x1deb48<_0x32aafc;_0x1deb48++){var _0x2a6116=events[_0x1deb48];var _0x21cf9a=createListener(_0xdcaf('0x4')+_0x2a6116,_0x56bae3);WhatsappAccountEvents['on'](_0x2a6116,_0x21cf9a);}}; \ No newline at end of file +var _0x60f2=['remove','update','emit','removeListener','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x1079e4,_0x2a33a5){var _0x1bb83a=function(_0xb1fe6b){while(--_0xb1fe6b){_0x1079e4['push'](_0x1079e4['shift']());}};_0x1bb83a(++_0x2a33a5);}(_0x60f2,0x1ee));var _0x260f=function(_0x20c911,_0x49d518){_0x20c911=_0x20c911-0x0;var _0x1e3f54=_0x60f2[_0x20c911];return _0x1e3f54;};'use strict';var WhatsappAccountEvents=require(_0x260f('0x0'));var events=[_0x260f('0x1'),_0x260f('0x2'),_0x260f('0x3')];function createListener(_0x13e3c6,_0x51496c){return function(_0x300800){_0x51496c[_0x260f('0x4')](_0x13e3c6,_0x300800);};}function removeListener(_0x1ee1df,_0x17e5f7){return function(){WhatsappAccountEvents[_0x260f('0x5')](_0x1ee1df,_0x17e5f7);};}exports['register']=function(_0x27eb62){for(var _0x1cca36=0x0,_0x48c972=events[_0x260f('0x6')];_0x1cca36<_0x48c972;_0x1cca36++){var _0x46aef4=events[_0x1cca36];var _0x4448d4=createListener(_0x260f('0x7')+_0x46aef4,_0x27eb62);WhatsappAccountEvents['on'](_0x46aef4,_0x4448d4);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 491d57d..36e779a 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 _0xa676=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports'];(function(_0x29a986,_0x18d77d){var _0xd4a8a4=function(_0x508a12){while(--_0x508a12){_0x29a986['push'](_0x29a986['shift']());}};_0xd4a8a4(++_0x18d77d);}(_0xa676,0x17c));var _0x6a67=function(_0x44dc88,_0x574d1f){_0x44dc88=_0x44dc88-0x0;var _0x3b13ed=_0xa676[_0x44dc88];return _0x3b13ed;};'use strict';var multer=require('multer');var util=require(_0x6a67('0x0'));var path=require(_0x6a67('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a67('0x2'));var router=express[_0x6a67('0x3')]();var fs_extra=require(_0x6a67('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6a67('0x5'));var config=require(_0x6a67('0x6'));var controller=require(_0x6a67('0x7'));router[_0x6a67('0x8')]('/',auth[_0x6a67('0x9')](),controller[_0x6a67('0xa')]);router[_0x6a67('0x8')]('/:id',auth[_0x6a67('0x9')](),controller[_0x6a67('0xb')]);router[_0x6a67('0xc')]('/',auth[_0x6a67('0x9')](),controller[_0x6a67('0xd')]);router['put'](_0x6a67('0xe'),auth[_0x6a67('0x9')](),controller[_0x6a67('0xf')]);router[_0x6a67('0x10')](_0x6a67('0xe'),auth[_0x6a67('0x9')](),controller[_0x6a67('0x11')]);module[_0x6a67('0x12')]=router; \ No newline at end of file +var _0x6d5f=['multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','exports'];(function(_0x366f29,_0xd326b5){var _0x3479ff=function(_0x5962e9){while(--_0x5962e9){_0x366f29['push'](_0x366f29['shift']());}};_0x3479ff(++_0xd326b5);}(_0x6d5f,0xd0));var _0xf6d5=function(_0x5ec7b3,_0x30c0d6){_0x5ec7b3=_0x5ec7b3-0x0;var _0x4cb178=_0x6d5f[_0x5ec7b3];return _0x4cb178;};'use strict';var multer=require(_0xf6d5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf6d5('0x1'));var express=require(_0xf6d5('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf6d5('0x3'));var interaction=require(_0xf6d5('0x4'));var config=require(_0xf6d5('0x5'));var controller=require(_0xf6d5('0x6'));router[_0xf6d5('0x7')]('/',auth[_0xf6d5('0x8')](),controller[_0xf6d5('0x9')]);router[_0xf6d5('0x7')](_0xf6d5('0xa'),auth[_0xf6d5('0x8')](),controller[_0xf6d5('0xb')]);router[_0xf6d5('0xc')]('/',auth[_0xf6d5('0x8')](),controller['create']);router[_0xf6d5('0xd')](_0xf6d5('0xa'),auth['isAuthenticated'](),controller[_0xf6d5('0xe')]);router['delete'](_0xf6d5('0xa'),auth[_0xf6d5('0x8')](),controller['destroy']);module[_0xf6d5('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 7c63f31..1fae7dd 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 _0x9100=['noop','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x2a777b,_0x14047f){var _0x926e93=function(_0x471735){while(--_0x471735){_0x2a777b['push'](_0x2a777b['shift']());}};_0x926e93(++_0x14047f);}(_0x9100,0xa2));var _0x0910=function(_0x4e7d3e,_0x10fd16){_0x4e7d3e=_0x4e7d3e-0x0;var _0x1e9554=_0x9100[_0x4e7d3e];return _0x1e9554;};'use strict';var Sequelize=require(_0x0910('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0910('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0910('0x2')],'allowNull':![],'defaultValue':_0x0910('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0910('0x2')]},'interval':{'type':Sequelize[_0x0910('0x2')],'defaultValue':_0x0910('0x4')}}; \ No newline at end of file +var _0x7d4a=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7d4a,0x12d));var _0xa7d4=function(_0x2d9404,_0x41b1b){_0x2d9404=_0x2d9404-0x0;var _0x33d5f4=_0x7d4a[_0x2d9404];return _0x33d5f4;};'use strict';var Sequelize=require(_0xa7d4('0x0'));module[_0xa7d4('0x1')]={'priority':{'type':Sequelize[_0xa7d4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa7d4('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa7d4('0x4')]()},'description':{'type':Sequelize[_0xa7d4('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa7d4('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index dbe75b9..f70f8fa 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 _0xc74c=['fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappApplication','includeAll','include','findAll','catch','show','params','keys','create','body','find','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0xc74c,0x163));var _0xcc74=function(_0x6e599d,_0x3fba21){_0x6e599d=_0x6e599d-0x0;var _0x5d2829=_0xc74c[_0x6e599d];return _0x5d2829;};'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'];function respondWithStatusCode(_0x4b3988,_0x4e4003){_0x4e4003=_0x4e4003||0xcc;return function(_0x4e5600){if(_0x4e5600){return _0x4b3988[_0xcc74('0x17')](_0x4e4003);}return _0x4b3988[_0xcc74('0x18')](_0x4e4003)[_0xcc74('0x19')]();};}function respondWithResult(_0x104853,_0x77b311){_0x77b311=_0x77b311||0xc8;return function(_0x59eff4){if(_0x59eff4){return _0x104853[_0xcc74('0x18')](_0x77b311)[_0xcc74('0x1a')](_0x59eff4);}};}function respondWithFilteredResult(_0x1ab204,_0x1646c4){return function(_0x351463){if(_0x351463){var _0x57f804=typeof _0x1646c4[_0xcc74('0x1b')]===_0xcc74('0x1c')&&typeof _0x1646c4[_0xcc74('0x1d')]===_0xcc74('0x1c');var _0x2f33ad=_0x351463[_0xcc74('0x1e')];var _0x170583=_0x57f804?0x0:_0x1646c4[_0xcc74('0x1b')];var _0x30101f=_0x57f804?_0x351463['count']:_0x1646c4[_0xcc74('0x1b')]+_0x1646c4[_0xcc74('0x1d')];var _0x1cd9ae;if(_0x30101f>=_0x2f33ad){_0x30101f=_0x2f33ad;_0x1cd9ae=0xc8;}else{_0x1cd9ae=0xce;}_0x1ab204[_0xcc74('0x18')](_0x1cd9ae);return _0x1ab204[_0xcc74('0x1f')](_0xcc74('0x20'),_0x170583+'-'+_0x30101f+'/'+_0x2f33ad)['json'](_0x351463);}return null;};}function patchUpdates(_0x379342){return function(_0xa7fcba){try{jsonpatch['apply'](_0xa7fcba,_0x379342,!![]);}catch(_0x17a3aa){return BPromise[_0xcc74('0x21')](_0x17a3aa);}return _0xa7fcba[_0xcc74('0x22')]();};}function saveUpdates(_0x545749,_0x1a2e25){return function(_0x22b39f){if(_0x22b39f){return _0x22b39f[_0xcc74('0x23')](_0x545749)[_0xcc74('0x24')](function(_0x554111){return _0x554111;});}return null;};}function removeEntity(_0x43830a,_0x11811d){return function(_0x462348){if(_0x462348){return _0x462348['destroy']()[_0xcc74('0x24')](function(){_0x43830a[_0xcc74('0x18')](0xcc)[_0xcc74('0x19')]();});}};}function handleEntityNotFound(_0x5a9fa6,_0x59ee69){return function(_0x563b64){if(!_0x563b64){_0x5a9fa6[_0xcc74('0x17')](0x194);}return _0x563b64;};}function handleError(_0x3c36cf,_0x387c57){_0x387c57=_0x387c57||0x1f4;return function(_0x311cc2){logger[_0xcc74('0x25')](_0x311cc2[_0xcc74('0x26')]);if(_0x311cc2['name']){delete _0x311cc2[_0xcc74('0x27')];}_0x3c36cf[_0xcc74('0x18')](_0x387c57)[_0xcc74('0x28')](_0x311cc2);};}exports[_0xcc74('0x29')]=function(_0x47f50b,_0x153b17){var _0x4dd6ea={},_0x46e47f={},_0x362a31={'count':0x0,'rows':[]};var _0x391325=_[_0xcc74('0x2a')](db['WhatsappApplication'][_0xcc74('0x2b')],function(_0x5cb390){return{'name':_0x5cb390[_0xcc74('0x2c')],'type':_0x5cb390[_0xcc74('0x2d')][_0xcc74('0x2e')]};});_0x46e47f[_0xcc74('0x2f')]=_[_0xcc74('0x2a')](_0x391325,_0xcc74('0x27'));_0x46e47f['query']=_['keys'](_0x47f50b[_0xcc74('0x30')]);_0x46e47f[_0xcc74('0x31')]=_[_0xcc74('0x32')](_0x46e47f['model'],_0x46e47f[_0xcc74('0x30')]);_0x4dd6ea[_0xcc74('0x33')]=_['intersection'](_0x46e47f['model'],qs[_0xcc74('0x34')](_0x47f50b[_0xcc74('0x30')]['fields']));_0x4dd6ea[_0xcc74('0x33')]=_0x4dd6ea[_0xcc74('0x33')][_0xcc74('0x35')]?_0x4dd6ea[_0xcc74('0x33')]:_0x46e47f[_0xcc74('0x2f')];if(!_0x47f50b[_0xcc74('0x30')]['hasOwnProperty'](_0xcc74('0x36'))){_0x4dd6ea[_0xcc74('0x1d')]=qs[_0xcc74('0x1d')](_0x47f50b[_0xcc74('0x30')][_0xcc74('0x1d')]);_0x4dd6ea[_0xcc74('0x1b')]=qs[_0xcc74('0x1b')](_0x47f50b['query'][_0xcc74('0x1b')]);}_0x4dd6ea['order']=qs[_0xcc74('0x37')](_0x47f50b[_0xcc74('0x30')][_0xcc74('0x37')]);_0x4dd6ea[_0xcc74('0x38')]=qs[_0xcc74('0x31')](_[_0xcc74('0x39')](_0x47f50b[_0xcc74('0x30')],_0x46e47f[_0xcc74('0x31')]),_0x391325);if(_0x47f50b[_0xcc74('0x30')][_0xcc74('0x3a')]){_0x4dd6ea[_0xcc74('0x38')]=_[_0xcc74('0x3b')](_0x4dd6ea['where'],{'$or':_[_0xcc74('0x2a')](_0x391325,function(_0x2917c8){if(_0x2917c8['type']!==_0xcc74('0x3c')){var _0x1563d1={};_0x1563d1[_0x2917c8[_0xcc74('0x27')]]={'$like':'%'+_0x47f50b[_0xcc74('0x30')][_0xcc74('0x3a')]+'%'};return _0x1563d1;}})});}_0x4dd6ea=_['merge']({},_0x4dd6ea,_0x47f50b[_0xcc74('0x3d')]);var _0x545433={'where':_0x4dd6ea[_0xcc74('0x38')]};return db[_0xcc74('0x3e')][_0xcc74('0x1e')](_0x545433)['then'](function(_0x128f3d){_0x362a31[_0xcc74('0x1e')]=_0x128f3d;if(_0x47f50b[_0xcc74('0x30')][_0xcc74('0x3f')]){_0x4dd6ea[_0xcc74('0x40')]=[{'all':!![]}];}return db[_0xcc74('0x3e')][_0xcc74('0x41')](_0x4dd6ea);})[_0xcc74('0x24')](function(_0x3e6052){_0x362a31['rows']=_0x3e6052;return _0x362a31;})[_0xcc74('0x24')](respondWithFilteredResult(_0x153b17,_0x4dd6ea))[_0xcc74('0x42')](handleError(_0x153b17,null));};exports[_0xcc74('0x43')]=function(_0x42c417,_0xed8acf){var _0x26fb5f={'raw':!![],'where':{'id':_0x42c417[_0xcc74('0x44')]['id']}},_0x37deeb={};_0x37deeb[_0xcc74('0x2f')]=_[_0xcc74('0x45')](db['WhatsappApplication'][_0xcc74('0x2b')]);_0x37deeb[_0xcc74('0x30')]=_[_0xcc74('0x45')](_0x42c417[_0xcc74('0x30')]);_0x37deeb[_0xcc74('0x31')]=_[_0xcc74('0x32')](_0x37deeb['model'],_0x37deeb[_0xcc74('0x30')]);_0x26fb5f[_0xcc74('0x33')]=_[_0xcc74('0x32')](_0x37deeb[_0xcc74('0x2f')],qs['fields'](_0x42c417['query'][_0xcc74('0x34')]));_0x26fb5f[_0xcc74('0x33')]=_0x26fb5f[_0xcc74('0x33')][_0xcc74('0x35')]?_0x26fb5f[_0xcc74('0x33')]:_0x37deeb[_0xcc74('0x2f')];if(_0x42c417['query'][_0xcc74('0x3f')]){_0x26fb5f[_0xcc74('0x40')]=[{'all':!![]}];}_0x26fb5f=_[_0xcc74('0x3b')]({},_0x26fb5f,_0x42c417[_0xcc74('0x3d')]);return db[_0xcc74('0x3e')]['find'](_0x26fb5f)['then'](handleEntityNotFound(_0xed8acf,null))[_0xcc74('0x24')](respondWithResult(_0xed8acf,null))[_0xcc74('0x42')](handleError(_0xed8acf,null));};exports[_0xcc74('0x46')]=function(_0x32bfde,_0xcfe8f6){return db[_0xcc74('0x3e')]['create'](_0x32bfde['body'],{})['then'](respondWithResult(_0xcfe8f6,0xc9))[_0xcc74('0x42')](handleError(_0xcfe8f6,null));};exports['update']=function(_0x39e560,_0x32b67c){if(_0x39e560[_0xcc74('0x47')]['id']){delete _0x39e560['body']['id'];}return db[_0xcc74('0x3e')][_0xcc74('0x48')]({'where':{'id':_0x39e560[_0xcc74('0x44')]['id']}})[_0xcc74('0x24')](handleEntityNotFound(_0x32b67c,null))[_0xcc74('0x24')](saveUpdates(_0x39e560[_0xcc74('0x47')],null))['then'](respondWithResult(_0x32b67c,null))['catch'](handleError(_0x32b67c,null));};exports['destroy']=function(_0x4265d3,_0x5c5409){return db[_0xcc74('0x3e')][_0xcc74('0x48')]({'where':{'id':_0x4265d3[_0xcc74('0x44')]['id']}})[_0xcc74('0x24')](handleEntityNotFound(_0x5c5409,null))[_0xcc74('0x24')](removeEntity(_0x5c5409,null))[_0xcc74('0x42')](handleError(_0x5c5409,null));}; \ No newline at end of file +var _0xf567=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','apply','reject','save','update','then','destroy','end','error','name','send','key','map','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','type','merge','options','WhatsappApplication','includeAll','include','findAll','rows','show','params','keys','create','body','catch','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x29e1bf,_0x29bea5){var _0x179c12=function(_0x410648){while(--_0x410648){_0x29e1bf['push'](_0x29e1bf['shift']());}};_0x179c12(++_0x29bea5);}(_0xf567,0x118));var _0x7f56=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf567[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x7f56('0x0'));var rimraf=require(_0x7f56('0x1'));var zipdir=require(_0x7f56('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f56('0x3'));var moment=require(_0x7f56('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7f56('0x5'));var util=require(_0x7f56('0x6'));var path=require(_0x7f56('0x7'));var sox=require(_0x7f56('0x8'));var csv=require('to-csv');var ejs=require(_0x7f56('0x9'));var fs=require('fs');var fs_extra=require(_0x7f56('0xa'));var _=require(_0x7f56('0xb'));var squel=require('squel');var crypto=require(_0x7f56('0xc'));var jsforce=require(_0x7f56('0xd'));var deskjs=require(_0x7f56('0xe'));var toCsv=require(_0x7f56('0xf'));var querystring=require(_0x7f56('0x10'));var Papa=require(_0x7f56('0x11'));var Redis=require(_0x7f56('0x12'));var authService=require(_0x7f56('0x13'));var qs=require(_0x7f56('0x14'));var as=require(_0x7f56('0x15'));var hardwareService=require(_0x7f56('0x16'));var logger=require(_0x7f56('0x17'))(_0x7f56('0x18'));var utils=require(_0x7f56('0x19'));var config=require(_0x7f56('0x1a'));var licenseUtil=require(_0x7f56('0x1b'));var db=require(_0x7f56('0x1c'))['db'];function respondWithStatusCode(_0x12557f,_0x3677af){_0x3677af=_0x3677af||0xcc;return function(_0x13b663){if(_0x13b663){return _0x12557f[_0x7f56('0x1d')](_0x3677af);}return _0x12557f[_0x7f56('0x1e')](_0x3677af)['end']();};}function respondWithResult(_0x3cc92b,_0x32119f){_0x32119f=_0x32119f||0xc8;return function(_0x11d663){if(_0x11d663){return _0x3cc92b['status'](_0x32119f)[_0x7f56('0x1f')](_0x11d663);}};}function respondWithFilteredResult(_0x211be1,_0x52e072){return function(_0x5f9e3c){if(_0x5f9e3c){var _0x441459=typeof _0x52e072['offset']==='undefined'&&typeof _0x52e072[_0x7f56('0x20')]==='undefined';var _0x415b6f=_0x5f9e3c[_0x7f56('0x21')];var _0x5201eb=_0x441459?0x0:_0x52e072[_0x7f56('0x22')];var _0x3779a9=_0x441459?_0x5f9e3c[_0x7f56('0x21')]:_0x52e072[_0x7f56('0x22')]+_0x52e072[_0x7f56('0x20')];var _0x24fe45;if(_0x3779a9>=_0x415b6f){_0x3779a9=_0x415b6f;_0x24fe45=0xc8;}else{_0x24fe45=0xce;}_0x211be1['status'](_0x24fe45);return _0x211be1[_0x7f56('0x23')]('Content-Range',_0x5201eb+'-'+_0x3779a9+'/'+_0x415b6f)[_0x7f56('0x1f')](_0x5f9e3c);}return null;};}function patchUpdates(_0x56ba40){return function(_0x38e7d5){try{jsonpatch[_0x7f56('0x24')](_0x38e7d5,_0x56ba40,!![]);}catch(_0x289207){return BPromise[_0x7f56('0x25')](_0x289207);}return _0x38e7d5[_0x7f56('0x26')]();};}function saveUpdates(_0x4480b1,_0x9b7f15){return function(_0x3f54f8){if(_0x3f54f8){return _0x3f54f8[_0x7f56('0x27')](_0x4480b1)[_0x7f56('0x28')](function(_0x52a902){return _0x52a902;});}return null;};}function removeEntity(_0x19bc9f,_0xe8f270){return function(_0x2943fe){if(_0x2943fe){return _0x2943fe[_0x7f56('0x29')]()[_0x7f56('0x28')](function(){_0x19bc9f[_0x7f56('0x1e')](0xcc)[_0x7f56('0x2a')]();});}};}function handleEntityNotFound(_0x5da9ce,_0x4a20d5){return function(_0x4a1f1b){if(!_0x4a1f1b){_0x5da9ce[_0x7f56('0x1d')](0x194);}return _0x4a1f1b;};}function handleError(_0x5d2c39,_0x243a16){_0x243a16=_0x243a16||0x1f4;return function(_0xc53c00){logger[_0x7f56('0x2b')](_0xc53c00['stack']);if(_0xc53c00[_0x7f56('0x2c')]){delete _0xc53c00[_0x7f56('0x2c')];}_0x5d2c39[_0x7f56('0x1e')](_0x243a16)[_0x7f56('0x2d')](_0xc53c00);};}exports['index']=function(_0x3d3095,_0x35d40b){var _0x20335a={},_0x57d1db={},_0x10372d={'count':0x0,'rows':[]};var _0x1f247e=_['map'](db['WhatsappApplication']['rawAttributes'],function(_0x2849f8){return{'name':_0x2849f8['fieldName'],'type':_0x2849f8['type'][_0x7f56('0x2e')]};});_0x57d1db['model']=_[_0x7f56('0x2f')](_0x1f247e,_0x7f56('0x2c'));_0x57d1db[_0x7f56('0x30')]=_['keys'](_0x3d3095[_0x7f56('0x30')]);_0x57d1db[_0x7f56('0x31')]=_[_0x7f56('0x32')](_0x57d1db['model'],_0x57d1db[_0x7f56('0x30')]);_0x20335a[_0x7f56('0x33')]=_[_0x7f56('0x32')](_0x57d1db[_0x7f56('0x34')],qs[_0x7f56('0x35')](_0x3d3095[_0x7f56('0x30')][_0x7f56('0x35')]));_0x20335a[_0x7f56('0x33')]=_0x20335a[_0x7f56('0x33')][_0x7f56('0x36')]?_0x20335a[_0x7f56('0x33')]:_0x57d1db[_0x7f56('0x34')];if(!_0x3d3095['query']['hasOwnProperty'](_0x7f56('0x37'))){_0x20335a['limit']=qs[_0x7f56('0x20')](_0x3d3095[_0x7f56('0x30')]['limit']);_0x20335a[_0x7f56('0x22')]=qs[_0x7f56('0x22')](_0x3d3095['query'][_0x7f56('0x22')]);}_0x20335a[_0x7f56('0x38')]=qs['sort'](_0x3d3095[_0x7f56('0x30')][_0x7f56('0x39')]);_0x20335a[_0x7f56('0x3a')]=qs['filters'](_[_0x7f56('0x3b')](_0x3d3095['query'],_0x57d1db[_0x7f56('0x31')]),_0x1f247e);if(_0x3d3095['query'][_0x7f56('0x3c')]){_0x20335a[_0x7f56('0x3a')]=_['merge'](_0x20335a['where'],{'$or':_['map'](_0x1f247e,function(_0x3b37fc){if(_0x3b37fc[_0x7f56('0x3d')]!=='VIRTUAL'){var _0x471e8b={};_0x471e8b[_0x3b37fc[_0x7f56('0x2c')]]={'$like':'%'+_0x3d3095[_0x7f56('0x30')][_0x7f56('0x3c')]+'%'};return _0x471e8b;}})});}_0x20335a=_[_0x7f56('0x3e')]({},_0x20335a,_0x3d3095[_0x7f56('0x3f')]);var _0x39c017={'where':_0x20335a[_0x7f56('0x3a')]};return db[_0x7f56('0x40')][_0x7f56('0x21')](_0x39c017)[_0x7f56('0x28')](function(_0x34c0d1){_0x10372d[_0x7f56('0x21')]=_0x34c0d1;if(_0x3d3095[_0x7f56('0x30')][_0x7f56('0x41')]){_0x20335a[_0x7f56('0x42')]=[{'all':!![]}];}return db[_0x7f56('0x40')][_0x7f56('0x43')](_0x20335a);})[_0x7f56('0x28')](function(_0xe02966){_0x10372d[_0x7f56('0x44')]=_0xe02966;return _0x10372d;})[_0x7f56('0x28')](respondWithFilteredResult(_0x35d40b,_0x20335a))['catch'](handleError(_0x35d40b,null));};exports[_0x7f56('0x45')]=function(_0x4a776b,_0x5e51d6){var _0x2ab999={'raw':!![],'where':{'id':_0x4a776b[_0x7f56('0x46')]['id']}},_0x438a30={};_0x438a30[_0x7f56('0x34')]=_[_0x7f56('0x47')](db[_0x7f56('0x40')]['rawAttributes']);_0x438a30[_0x7f56('0x30')]=_[_0x7f56('0x47')](_0x4a776b['query']);_0x438a30[_0x7f56('0x31')]=_[_0x7f56('0x32')](_0x438a30[_0x7f56('0x34')],_0x438a30[_0x7f56('0x30')]);_0x2ab999[_0x7f56('0x33')]=_[_0x7f56('0x32')](_0x438a30[_0x7f56('0x34')],qs[_0x7f56('0x35')](_0x4a776b[_0x7f56('0x30')][_0x7f56('0x35')]));_0x2ab999[_0x7f56('0x33')]=_0x2ab999['attributes']['length']?_0x2ab999[_0x7f56('0x33')]:_0x438a30[_0x7f56('0x34')];if(_0x4a776b['query'][_0x7f56('0x41')]){_0x2ab999['include']=[{'all':!![]}];}_0x2ab999=_[_0x7f56('0x3e')]({},_0x2ab999,_0x4a776b[_0x7f56('0x3f')]);return db[_0x7f56('0x40')]['find'](_0x2ab999)[_0x7f56('0x28')](handleEntityNotFound(_0x5e51d6,null))['then'](respondWithResult(_0x5e51d6,null))['catch'](handleError(_0x5e51d6,null));};exports[_0x7f56('0x48')]=function(_0x39cf30,_0x498259){return db[_0x7f56('0x40')]['create'](_0x39cf30[_0x7f56('0x49')],{})[_0x7f56('0x28')](respondWithResult(_0x498259,0xc9))[_0x7f56('0x4a')](handleError(_0x498259,null));};exports[_0x7f56('0x27')]=function(_0x5cc708,_0x25704f){if(_0x5cc708[_0x7f56('0x49')]['id']){delete _0x5cc708[_0x7f56('0x49')]['id'];}return db[_0x7f56('0x40')][_0x7f56('0x4b')]({'where':{'id':_0x5cc708[_0x7f56('0x46')]['id']}})[_0x7f56('0x28')](handleEntityNotFound(_0x25704f,null))[_0x7f56('0x28')](saveUpdates(_0x5cc708[_0x7f56('0x49')],null))['then'](respondWithResult(_0x25704f,null))['catch'](handleError(_0x25704f,null));};exports[_0x7f56('0x29')]=function(_0x5b9f6c,_0x1b2bfb){return db[_0x7f56('0x40')]['find']({'where':{'id':_0x5b9f6c[_0x7f56('0x46')]['id']}})[_0x7f56('0x28')](handleEntityNotFound(_0x1b2bfb,null))['then'](removeEntity(_0x1b2bfb,null))[_0x7f56('0x4a')](handleError(_0x1b2bfb,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 3e1e7a1..86ab609 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 _0x2121=['define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2121,0x1b4));var _0x1212=function(_0x2ee06c,_0x20d901){_0x2ee06c=_0x2ee06c-0x0;var _0x490a86=_0x2121[_0x2ee06c];return _0x490a86;};'use strict';var _=require(_0x1212('0x0'));var util=require(_0x1212('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1212('0x2'));var BPromise=require(_0x1212('0x3'));var rp=require(_0x1212('0x4'));var fs=require('fs');var path=require(_0x1212('0x5'));var rimraf=require(_0x1212('0x6'));var config=require('../../config/environment');var attributes=require(_0x1212('0x7'));module['exports']=function(_0x7b16ef,_0x452116){return _0x7b16ef[_0x1212('0x8')](_0x1212('0x9'),attributes,{'tableName':_0x1212('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1212('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5292=['rimraf','./whatsappApplication.attributes','define','WhatsappApplication','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path'];(function(_0x404fa2,_0x1fd982){var _0x20a19a=function(_0x2c242b){while(--_0x2c242b){_0x404fa2['push'](_0x404fa2['shift']());}};_0x20a19a(++_0x1fd982);}(_0x5292,0xf7));var _0x2529=function(_0x7e557a,_0x3e41ab){_0x7e557a=_0x7e557a-0x0;var _0x3aba18=_0x5292[_0x7e557a];return _0x3aba18;};'use strict';var _=require(_0x2529('0x0'));var util=require(_0x2529('0x1'));var logger=require('../../config/logger')(_0x2529('0x2'));var moment=require('moment');var BPromise=require(_0x2529('0x3'));var rp=require(_0x2529('0x4'));var fs=require('fs');var path=require(_0x2529('0x5'));var rimraf=require(_0x2529('0x6'));var config=require('../../config/environment');var attributes=require(_0x2529('0x7'));module['exports']=function(_0x4c9b4c,_0x4e7a9e){return _0x4c9b4c[_0x2529('0x8')](_0x2529('0x9'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2529('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 2df33b7..27c7544 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappApplication,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x142336,_0x10dbf7){var _0x4dfb8d=function(_0x438f02){while(--_0x438f02){_0x142336['push'](_0x142336['shift']());}};_0x4dfb8d(++_0x10dbf7);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x4b84[_0x2c0dc0];return _0x4c0990;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('WhatsappApplication,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0xd2ea=['../../config/environment','jayson/promise','client','request','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1f2f53,_0x209d0f){var _0x3e86bf=function(_0x5663fc){while(--_0x5663fc){_0x1f2f53['push'](_0x1f2f53['shift']());}};_0x3e86bf(++_0x209d0f);}(_0xd2ea,0x15f));var _0xad2e=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0xd2ea[_0x3a9661];return _0x5bb119;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index f262acd..7c9d120 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 _0x6f47=['whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','getMessages','download','post','create','/:id/messages','addMessage','/:id/tags','addTags','put','tracked','whatsapp'];(function(_0x73ba1f,_0x588ccb){var _0x2e2725=function(_0x145578){while(--_0x145578){_0x73ba1f['push'](_0x73ba1f['shift']());}};_0x2e2725(++_0x588ccb);}(_0x6f47,0xc7));var _0x76f4=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x6f47[_0xa6cc5c];return _0x44803d;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var fs_extra=require(_0x76f4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var controller=require(_0x76f4('0x6'));router[_0x76f4('0x7')]('/',auth['isAuthenticated'](),controller[_0x76f4('0x8')]);router[_0x76f4('0x7')](_0x76f4('0x9'),auth['isAuthenticated'](),controller[_0x76f4('0xa')]);router[_0x76f4('0x7')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),controller[_0x76f4('0xd')]);router['get']('/:id/messages',auth[_0x76f4('0xc')](),controller[_0x76f4('0xe')]);router['get']('/:id/download',auth[_0x76f4('0xc')](),controller[_0x76f4('0xf')]);router[_0x76f4('0x10')]('/',auth[_0x76f4('0xc')](),controller[_0x76f4('0x11')]);router[_0x76f4('0x10')](_0x76f4('0x12'),auth[_0x76f4('0xc')](),controller[_0x76f4('0x13')]);router['post'](_0x76f4('0x14'),auth[_0x76f4('0xc')](),interaction['tracked']('whatsapp','whatsappinteraction:addtags'),controller[_0x76f4('0x15')]);router[_0x76f4('0x16')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),interaction[_0x76f4('0x17')](_0x76f4('0x18'),_0x76f4('0x19')),controller[_0x76f4('0x1a')]);router[_0x76f4('0x1b')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),interaction[_0x76f4('0x17')](_0x76f4('0x18'),_0x76f4('0x1c')),controller[_0x76f4('0x1d')]);router[_0x76f4('0x1b')](_0x76f4('0x14'),auth[_0x76f4('0xc')](),controller[_0x76f4('0x1e')]);module[_0x76f4('0x1f')]=router; \ No newline at end of file +var _0xd046=['Router','../../components/interaction/service','./whatsappInteraction.controller','index','get','describe','show','/:id/messages','/:id/download','isAuthenticated','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','delete','destroy','removeTags','exports','util','path','connect-timeout'];(function(_0x1c2c7d,_0x1f97ae){var _0x52ed5d=function(_0x41ba97){while(--_0x41ba97){_0x1c2c7d['push'](_0x1c2c7d['shift']());}};_0x52ed5d(++_0x1f97ae);}(_0xd046,0x129));var _0x6d04=function(_0x251b12,_0x5e2616){_0x251b12=_0x251b12-0x0;var _0x1ee2a7=_0xd046[_0x251b12];return _0x1ee2a7;};'use strict';var multer=require('multer');var util=require(_0x6d04('0x0'));var path=require(_0x6d04('0x1'));var timeout=require(_0x6d04('0x2'));var express=require('express');var router=express[_0x6d04('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d04('0x4'));var config=require('../../config/environment');var controller=require(_0x6d04('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x6d04('0x6')]);router[_0x6d04('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x6d04('0x8')]);router[_0x6d04('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x6d04('0x9')]);router['get'](_0x6d04('0xa'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x6d04('0xb'),auth[_0x6d04('0xc')](),controller[_0x6d04('0xd')]);router[_0x6d04('0xe')]('/',auth['isAuthenticated'](),controller[_0x6d04('0xf')]);router[_0x6d04('0xe')](_0x6d04('0xa'),auth[_0x6d04('0xc')](),controller[_0x6d04('0x10')]);router[_0x6d04('0xe')](_0x6d04('0x11'),auth[_0x6d04('0xc')](),interaction[_0x6d04('0x12')](_0x6d04('0x13'),_0x6d04('0x14')),controller[_0x6d04('0x15')]);router[_0x6d04('0x16')](_0x6d04('0x17'),auth[_0x6d04('0xc')](),interaction[_0x6d04('0x12')](_0x6d04('0x13'),_0x6d04('0x18')),controller[_0x6d04('0x19')]);router[_0x6d04('0x1a')](_0x6d04('0x17'),auth[_0x6d04('0xc')](),interaction[_0x6d04('0x12')](_0x6d04('0x13'),'whatsappinteraction:destroy'),controller[_0x6d04('0x1b')]);router[_0x6d04('0x1a')](_0x6d04('0x11'),auth[_0x6d04('0xc')](),controller[_0x6d04('0x1c')]);module[_0x6d04('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index f5969d9..c19163b 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 _0xbe52=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x48a60a,_0xd0045d){var _0x45cb32=function(_0xf734cd){while(--_0xf734cd){_0x48a60a['push'](_0x48a60a['shift']());}};_0x45cb32(++_0xd0045d);}(_0xbe52,0x164));var _0x2be5=function(_0x48fbb2,_0xa34174){_0x48fbb2=_0x48fbb2-0x0;var _0x2650e6=_0xbe52[_0x48fbb2];return _0x2650e6;};'use strict';var Sequelize=require(_0x2be5('0x0'));var moment=require(_0x2be5('0x1'));module[_0x2be5('0x2')]={'closed':{'type':Sequelize[_0x2be5('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2be5('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2be5('0x5')]},'thirdDisposition':{'type':Sequelize[_0x2be5('0x5')]},'note':{'type':Sequelize[_0x2be5('0x5')]},'phone':{'type':Sequelize[_0x2be5('0x5')]},'read1stAt':{'type':Sequelize[_0x2be5('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2be5('0x6')]('in',_0x2be5('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2be5('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x2be5('0x6')]('in',_0x2be5('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2be5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3148=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x3148,0x1d3));var _0x8314=function(_0x5870c1,_0x173ba3){_0x5870c1=_0x5870c1-0x0;var _0x344685=_0x3148[_0x5870c1];return _0x344685;};'use strict';var Sequelize=require(_0x8314('0x0'));var moment=require(_0x8314('0x1'));module['exports']={'closed':{'type':Sequelize[_0x8314('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8314('0x3')]},'disposition':{'type':Sequelize[_0x8314('0x4')]},'secondDisposition':{'type':Sequelize[_0x8314('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8314('0x4')]},'phone':{'type':Sequelize[_0x8314('0x4')]},'read1stAt':{'type':Sequelize[_0x8314('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8314('0x5')]('in',_0x8314('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8314('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8314('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8314('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 bd44ae3..f9dbbfe 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 _0x229c=['Content-Range','apply','save','update','then','error','stack','name','send','Users','map','fullname','TagIds','split','Tags','push','catch','waiting','talking','unmanaged','total','UserId','closed','index','WhatsappInteraction','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_whatsapp_interactions','left_join','users','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20>\x200','operator','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','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','keys','some','where','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','role','sequelize','toString','merge','unreadMessages','a.key','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.email','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.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','show','params','includeAll','include','options','create','destroy','describe','WhatsappMessage','addMessage','ids','omit','getMessages','findOne','format','rows','setTags','spread','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','CmContact','Contact','firstName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','basename','createReadStream','pipe','direction','out','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','rimraf','request-promise','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x229c,0xcf));var _0xc229=function(_0x1ec585,_0x290d8c){_0x1ec585=_0x1ec585-0x0;var _0x42afa8=_0x229c[_0x1ec585];return _0x42afa8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc229('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc229('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc229('0x2'));var util=require('util');var path=require(_0xc229('0x3'));var sox=require(_0xc229('0x4'));var csv=require(_0xc229('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc229('0x6'));var _=require('lodash');var squel=require(_0xc229('0x7'));var crypto=require(_0xc229('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xc229('0x9'));var toCsv=require(_0xc229('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc229('0xa'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc229('0xb'));var pdf=require(_0xc229('0xc'));var hardwareService=require(_0xc229('0xd'));var logger=require(_0xc229('0xe'))(_0xc229('0xf'));var utils=require(_0xc229('0x10'));var config=require(_0xc229('0x11'));var licenseUtil=require(_0xc229('0x12'));var db=require(_0xc229('0x13'))['db'];config[_0xc229('0x14')]=_[_0xc229('0x15')](config[_0xc229('0x14')],{'host':_0xc229('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc229('0x14')]));require('./whatsappInteraction.socket')[_0xc229('0x17')](socket);function respondWithStatusCode(_0x967747,_0x231086){_0x231086=_0x231086||0xcc;return function(_0x1cc8ed){if(_0x1cc8ed){return _0x967747[_0xc229('0x18')](_0x231086);}return _0x967747[_0xc229('0x19')](_0x231086)[_0xc229('0x1a')]();};}function respondWithResult(_0x2bc9ea,_0x569bdd){_0x569bdd=_0x569bdd||0xc8;return function(_0x3c3b1c){if(_0x3c3b1c){return _0x2bc9ea[_0xc229('0x19')](_0x569bdd)[_0xc229('0x1b')](_0x3c3b1c);}};}function respondWithFilteredResult(_0x517560,_0x4cae05){return function(_0x379e41){if(_0x379e41){var _0x10339a=typeof _0x4cae05[_0xc229('0x1c')]===_0xc229('0x1d')&&typeof _0x4cae05[_0xc229('0x1e')]===_0xc229('0x1d');var _0x119e07=_0x379e41['count'];var _0x599eeb=_0x10339a?0x0:_0x4cae05[_0xc229('0x1c')];var _0x53dbba=_0x10339a?_0x379e41[_0xc229('0x1f')]:_0x4cae05[_0xc229('0x1c')]+_0x4cae05['limit'];var _0x51b527;if(_0x53dbba>=_0x119e07){_0x53dbba=_0x119e07;_0x51b527=0xc8;}else{_0x51b527=0xce;}_0x517560[_0xc229('0x19')](_0x51b527);return _0x517560[_0xc229('0x20')](_0xc229('0x21'),_0x599eeb+'-'+_0x53dbba+'/'+_0x119e07)[_0xc229('0x1b')](_0x379e41);}return null;};}function patchUpdates(_0x35ad01){return function(_0x1ee398){try{jsonpatch[_0xc229('0x22')](_0x1ee398,_0x35ad01,!![]);}catch(_0x50fd02){return BPromise['reject'](_0x50fd02);}return _0x1ee398[_0xc229('0x23')]();};}function saveUpdates(_0xe55ddf,_0x56b7c6){return function(_0x5400f7){if(_0x5400f7){return _0x5400f7[_0xc229('0x24')](_0xe55ddf)[_0xc229('0x25')](function(_0x12a5b8){return _0x12a5b8;});}return null;};}function removeEntity(_0x190e58,_0xb05c4c){return function(_0x268546){if(_0x268546){return _0x268546['destroy']()[_0xc229('0x25')](function(){_0x190e58[_0xc229('0x19')](0xcc)[_0xc229('0x1a')]();});}};}function handleEntityNotFound(_0x537033,_0x524908){return function(_0x155a51){if(!_0x155a51){_0x537033['sendStatus'](0x194);}return _0x155a51;};}function handleError(_0x3dfbc9,_0x2a6e38){_0x2a6e38=_0x2a6e38||0x1f4;return function(_0x2c5fbf){logger[_0xc229('0x26')](_0x2c5fbf[_0xc229('0x27')]);if(_0x2c5fbf[_0xc229('0x28')]){delete _0x2c5fbf[_0xc229('0x28')];}_0x3dfbc9[_0xc229('0x19')](_0x2a6e38)[_0xc229('0x29')](_0x2c5fbf);};}function getInteractionUsers(_0x20a9c5,_0x195be7){return new BPromise(function(_0x3aef16,_0x4192d0){try{if(_0x195be7[_0x20a9c5['id']]){_0x20a9c5[_0xc229('0x2a')]=_[_0xc229('0x2b')](_0x195be7[_0x20a9c5['id']],function(_0x16ff51){return{'id':_0x16ff51['id'],'fullname':_0x16ff51[_0xc229('0x2c')]};});}}catch(_0x313660){_0x4192d0(_0x313660);}_0x3aef16(_0x20a9c5);});}function getInteractionTags(_0x27195c,_0x39d335){return new BPromise(function(_0x453c80,_0x5165f2){try{if(_0x27195c[_0xc229('0x2d')]){_0x27195c['Tags']=[];_0x27195c[_0xc229('0x2d')][_0xc229('0x2e')](',')['forEach'](function(_0x209e5a){_0x27195c[_0xc229('0x2f')][_0xc229('0x30')](_0x39d335[_0x209e5a]);});}delete _0x27195c[_0xc229('0x2d')];}catch(_0x413a52){_0x5165f2(_0x413a52);}_0x453c80(_0x27195c);});}function updateWhatsappInteraction(_0x42b7a3,_0x4aabf5,_0x471def){return new BPromise(function(_0x16cf1f,_0x10dfc0){return getInteractionUsers(_0x42b7a3,_0x471def)[_0xc229('0x25')](function(_0x39a7c2){return getInteractionTags(_0x39a7c2,_0x4aabf5);})[_0xc229('0x25')](function(_0x372912){return getStateInteraction(_0x372912);})[_0xc229('0x25')](function(_0x2b6383){_0x16cf1f(_0x2b6383);})[_0xc229('0x31')](function(_0x31d5bb){_0x10dfc0(_0x31d5bb);});});}function getStateInteraction(_0x4cb0f8){return new BPromise(function(_0x424ca3){_0x4cb0f8[_0xc229('0x32')]=0x0;_0x4cb0f8[_0xc229('0x33')]=0x0;_0x4cb0f8['answered']=0x0;_0x4cb0f8[_0xc229('0x34')]=0x0;_0x4cb0f8[_0xc229('0x35')]=0x0;if(!_0x4cb0f8['closed']&&!_0x4cb0f8['UserId']){_0x4cb0f8[_0xc229('0x32')]+=0x1;}if(!_0x4cb0f8['closed']&&_0x4cb0f8['UserId']){_0x4cb0f8['talking']+=0x1;if(_0x4cb0f8[_0xc229('0x32')]){_0x4cb0f8['waiting']-=0x1;}}if(_0x4cb0f8['closed']&&_0x4cb0f8[_0xc229('0x36')]){_0x4cb0f8['answered']+=0x1;if(_0x4cb0f8[_0xc229('0x33')]){_0x4cb0f8[_0xc229('0x33')]-=0x1;}}if(_0x4cb0f8[_0xc229('0x37')]&&!_0x4cb0f8[_0xc229('0x36')]){_0x4cb0f8[_0xc229('0x34')]+=0x1;if(_0x4cb0f8['waiting']){_0x4cb0f8[_0xc229('0x32')]-=0x1;}}_0x4cb0f8['total']+=0x1;_0x424ca3(_0x4cb0f8);});}exports[_0xc229('0x38')]=function(_0x2f8ed6,_0xe0762e){var _0x1fab42={},_0x2c352b={},_0xf94693={'count':0x0,'rows':[]};var _0x47d54f=_[_0xc229('0x2b')](db[_0xc229('0x39')][_0xc229('0x3a')],function(_0x21dfd4){return{'name':_0x21dfd4[_0xc229('0x3b')],'type':_0x21dfd4['type']['key']};});_0x2c352b[_0xc229('0x3c')]=_[_0xc229('0x2b')](_0x47d54f,_0xc229('0x28'));_0x2c352b[_0xc229('0x3d')]=_['keys'](_0x2f8ed6[_0xc229('0x3d')]);_0x2c352b[_0xc229('0x3e')]=_[_0xc229('0x3f')](_0x2c352b[_0xc229('0x3c')],_0x2c352b[_0xc229('0x3d')]);_0x1fab42[_0xc229('0x40')]=_[_0xc229('0x3f')](_0x2c352b['model'],qs['fields'](_0x2f8ed6[_0xc229('0x3d')][_0xc229('0x41')]));_0x1fab42[_0xc229('0x40')]=_0x1fab42[_0xc229('0x40')][_0xc229('0x42')]?_0x1fab42[_0xc229('0x40')]:_0x2c352b[_0xc229('0x3c')];if(!_0x2f8ed6[_0xc229('0x3d')][_0xc229('0x43')](_0xc229('0x44'))){_0x1fab42['limit']=qs[_0xc229('0x1e')](_0x2f8ed6['query'][_0xc229('0x1e')]);_0x1fab42[_0xc229('0x1c')]=qs[_0xc229('0x1c')](_0x2f8ed6['query'][_0xc229('0x1c')]);}_0x1fab42['order']=qs[_0xc229('0x45')](_0x2f8ed6[_0xc229('0x3d')][_0xc229('0x45')]);_0x1fab42['where']=qs[_0xc229('0x3e')](_[_0xc229('0x46')](_0x2f8ed6[_0xc229('0x3d')],_0x2c352b[_0xc229('0x3e')]),_0x47d54f);var _0x2f3cc=[];var _0x7d7799=squel[_0xc229('0x47')]()[_0xc229('0x48')]('id')[_0xc229('0x48')](_0xc229('0x28'))[_0xc229('0x48')](_0xc229('0x49'))[_0xc229('0x4a')](_0xc229('0x4b'));var _0x1944ec=squel[_0xc229('0x47')]()[_0xc229('0x48')](_0xc229('0x4c'))[_0xc229('0x48')](_0xc229('0x4d'))['field']('ui.WhatsappInteractionId')[_0xc229('0x4a')](_0xc229('0x4e'),'ui')[_0xc229('0x4f')](_0xc229('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x549895=squel[_0xc229('0x47')]()['from'](_0xc229('0x51'),'i')['left_join'](_0xc229('0x52'),'c',_0xc229('0x53'))['left_join'](_0xc229('0x50'),'o',_0xc229('0x54'))[_0xc229('0x4f')]('whatsapp_accounts','a',_0xc229('0x55'))[_0xc229('0x4f')](_0xc229('0x56'),'me',_0xc229('0x57'))[_0xc229('0x4f')](_0xc229('0x58'),'it',_0xc229('0x59'))[_0xc229('0x4f')](_0xc229('0x4b'),'t','t.id\x20=\x20it.TagId');var _0x3b3c62=squel[_0xc229('0x5a')]();var _0x2e4cc1=[];var _0x2bea38=squel[_0xc229('0x5a')]();var _0x22c443;if(_0x2f8ed6[_0xc229('0x3d')][_0xc229('0x5b')]){_0x22c443=as[_0xc229('0x5c')](_0x2f8ed6[_0xc229('0x3d')]['search']);var _0x36b600=_0x22c443[_0xc229('0x5d')];for(var _0x1f9fd2=0x0;_0x1f9fd2<_0x22c443['conditions'][_0xc229('0x42')];_0x1f9fd2++){var _0x5a3f18=_0x22c443[_0xc229('0x5e')][_0x1f9fd2];var _0x45fff0='i';var _0x49570c=_[_0xc229('0x5f')](_0x47d54f,[_0xc229('0x28'),_0x5a3f18[_0xc229('0x48')]]);if(!_0x49570c){switch(_0x5a3f18['field']){case'unreadMessages':if(_0x5a3f18[_0xc229('0x60')]==0x1){_0x549895[_0xc229('0x61')]('`'+_0x5a3f18[_0xc229('0x48')]+'`\x20=\x200');}else{_0x549895[_0xc229('0x61')]('`'+_0x5a3f18[_0xc229('0x48')]+_0xc229('0x62'));}break;case'Contact':if(_0x5a3f18[_0xc229('0x63')]==='$substring'){if(_0x5a3f18[_0xc229('0x60')][_0xc229('0x2e')]('\x20')['length']>0x1){_0x3b3c62[_0x36b600](_0xc229('0x64'),qs[_0xc229('0x65')](_0x5a3f18['value']),null);}else{var _0x45e191='%'+_0x5a3f18[_0xc229('0x60')]+'%';_0x3b3c62[_0x36b600](_0xc229('0x66'),_0x45e191,_0x45e191,_0x45e191);}}else{_0x49570c=_[_0xc229('0x5f')](_0x47d54f,[_0xc229('0x28'),_0xc229('0x67')]);_0x5a3f18[_0xc229('0x48')]=_0xc229('0x67');_0x4e3ad6=as[_0xc229('0x68')](_0x45fff0,_0x49570c[_0xc229('0x69')],_0x5a3f18);_0x3b3c62[_0x36b600](_0x4e3ad6[_0xc229('0x6a')],_0x4e3ad6['value']['start'],_0x4e3ad6['value'][_0xc229('0x1a')]);}break;case _0xc229('0x6b'):var _0x184f17=_0x5a3f18[_0xc229('0x60')][_0xc229('0x2e')](',')['map'](function(_0x2a8a08){return Number(_0x2a8a08);});_0x184f17[_0xc229('0x6c')](function(_0x3fec17){_0x2bea38['or'](_0xc229('0x6d'),'%,'+_0x3fec17+',%');});_0x2e4cc1=_[_0xc229('0x6e')](_0x2e4cc1,_0x184f17);break;case _0xc229('0x6f'):if(_0x5a3f18[_0xc229('0x63')]===_0xc229('0x70')){_0x3b3c62[_0x36b600](_0xc229('0x71'),'%'+_0x5a3f18[_0xc229('0x60')]+'%',null);}else{_0x49570c=_[_0xc229('0x5f')](_0x47d54f,[_0xc229('0x28'),_0xc229('0x36')]);_0x5a3f18[_0xc229('0x48')]='UserId';_0x4e3ad6=as['buildExpression'](_0x45fff0,_0x49570c[_0xc229('0x69')],_0x5a3f18);_0x3b3c62[_0x36b600](_0x4e3ad6[_0xc229('0x6a')],_0x4e3ad6[_0xc229('0x60')][_0xc229('0x72')],_0x4e3ad6[_0xc229('0x60')][_0xc229('0x1a')]);}break;case _0xc229('0x73'):_0x4e3ad6=as[_0xc229('0x68')]('me',null,_0x5a3f18);_0x3b3c62[_0x36b600](_0x4e3ad6[_0xc229('0x6a')],_0x4e3ad6[_0xc229('0x60')][_0xc229('0x72')],_0x4e3ad6[_0xc229('0x60')][_0xc229('0x1a')]);break;}}else{var _0x4e3ad6=as[_0xc229('0x68')](_0x45fff0,_0x49570c[_0xc229('0x69')],_0x5a3f18);_0x3b3c62[_0x36b600](_0x4e3ad6[_0xc229('0x6a')],_0x4e3ad6[_0xc229('0x60')]['start'],_0x4e3ad6[_0xc229('0x60')][_0xc229('0x1a')]);}}}else{var _0x58fec5=_(_0x2f8ed6[_0xc229('0x3d')])[_0xc229('0x74')]()[_0xc229('0x2b')](function(_0x1f2158){return _[_0xc229('0x75')](_0x47d54f,[_0xc229('0x28'),_0x1f2158])?_0x1f2158:undefined;})['compact']()[_0xc229('0x60')]();if(!_['isEmpty'](_0x58fec5)){_0x58fec5['forEach'](function(_0x50e23c){if(_0x50e23c==='WhatsappAccountId'){_0x549895[_0xc229('0x76')]('i.WhatsappAccountId\x20IN\x20?',[][_0xc229('0x77')](_0x2f8ed6[_0xc229('0x3d')][_0x50e23c]));}else if(_0x50e23c===_0xc229('0x78')){var _0x54f27f=JSON[_0xc229('0x79')](_0x2f8ed6[_0xc229('0x3d')][_0x50e23c])[_0xc229('0x7a')];var _0xb2be=JSON[_0xc229('0x79')](_0x2f8ed6[_0xc229('0x3d')][_0x50e23c])[_0xc229('0x7b')];_0x549895[_0xc229('0x76')](_0xc229('0x7c'),_0x54f27f,_0xb2be);}else{if(_0x2f8ed6[_0xc229('0x3d')][_0x50e23c]==='null'){_0x549895[_0xc229('0x76')]('i.'+_0x50e23c+_0xc229('0x7d'));}else{_0x549895[_0xc229('0x76')]('i.'+_0x50e23c+_0xc229('0x7e'),_0x2f8ed6['query'][_0x50e23c]);}}});}if(_0x2f8ed6['query'][_0xc229('0x7f')]){if(_0x2f8ed6[_0xc229('0x3d')][_0xc229('0x7f')]==0x1){_0x549895['having'](_0xc229('0x80'));}else{_0x549895[_0xc229('0x61')](_0xc229('0x81'));}}if(_0x2f8ed6[_0xc229('0x3d')][_0xc229('0x82')]){_0x2e4cc1=_[_0xc229('0x83')](_0x2f8ed6[_0xc229('0x3d')][_0xc229('0x82')])?_0x2f8ed6[_0xc229('0x3d')][_0xc229('0x82')]:new Array(_0x2f8ed6[_0xc229('0x3d')][_0xc229('0x82')]);_0x2e4cc1['forEach'](function(_0x1236f5){_0x2bea38['or'](_0xc229('0x6d'),'%,'+_0x1236f5+',%');});}if(_0x2f8ed6[_0xc229('0x3d')][_0xc229('0x84')]){var _0x559d12=_0x2f8ed6['query'][_0xc229('0x84')][_0xc229('0x85')]('\x5c','\x5c\x5c')[_0xc229('0x85')](/'/g,'\x27\x27');if(qs[_0xc229('0x86')](_0x559d12)){_0x3b3c62['or']('i.id\x20LIKE\x20?',_0x559d12+'%')['or'](_0xc229('0x87'),_0x559d12+'%');}else{_0x3b3c62['or'](_0xc229('0x88'),qs[_0xc229('0x65')](_0x559d12))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x559d12+'%');}}}_0x549895[_0xc229('0x76')](_0x3b3c62);_0x549895[_0xc229('0x89')]('i.id');var _0x55d0e2={'type':db[_0xc229('0x8a')][_0xc229('0x8b')][_0xc229('0x8c')],'raw':!![]};var _0x5d9395=_0x549895[_0xc229('0x8d')]();_0x5d9395[_0xc229('0x48')]('i.id');_0x5d9395[_0xc229('0x48')](_0xc229('0x8e'),'unreadMessages');if(_0x1fab42[_0xc229('0x8f')]){_0x1fab42[_0xc229('0x8f')][_0xc229('0x6c')](function(_0x41d983){var _0x21745c=_0x41d983[0x0]===_0xc229('0x90')?_0x41d983[0x0]:'i.'+_0x41d983[0x0];_0x549895[_0xc229('0x8f')](_0x21745c,_0x41d983[0x1]===_0xc229('0x91')?![]:!![]);});}if(!_[_0xc229('0x92')](_0x2e4cc1)){_0x549895[_0xc229('0x61')](_0x2bea38);_0x5d9395[_0xc229('0x76')]('t.id\x20IN\x20?',_0x2e4cc1);}BPromise['resolve']()[_0xc229('0x25')](function(){if(!_0x22c443){if(_0x2f8ed6[_0xc229('0x3d')]['WhatsappAccountId'])return;_0x5d9395['where'](_0xc229('0x93'));_0x549895[_0xc229('0x76')](_0xc229('0x93'));return;}if(_0x2f8ed6[_0xc229('0x94')]['role']!==_0xc229('0x95'))return;return _0x2f8ed6[_0xc229('0x94')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x6868bf){if(_['isEmpty'](_0x6868bf)){_0x5d9395[_0xc229('0x76')](_0xc229('0x96'));_0x549895['where'](_0xc229('0x96'));}else{_0x5d9395[_0xc229('0x76')](_0xc229('0x97'),_['map'](_0x6868bf,'id'));_0x549895[_0xc229('0x76')](_0xc229('0x97'),_[_0xc229('0x2b')](_0x6868bf,'id'));}});})[_0xc229('0x25')](function(){if(_0x2f8ed6[_0xc229('0x94')][_0xc229('0x98')]===_0xc229('0x95')&&!_0x22c443&&!_0x2f8ed6[_0xc229('0x3d')]['WhatsappAccountId'])return[];return db[_0xc229('0x99')][_0xc229('0x3d')](_0x5d9395[_0xc229('0x9a')](),_0x55d0e2);})[_0xc229('0x25')](function(_0x16226a){_0xf94693[_0xc229('0x1f')]=_0x16226a[_0xc229('0x42')];if(_0xf94693['count']===0x0)return[];return db[_0xc229('0x99')][_0xc229('0x3d')](_0x7d7799['toString'](),_0x55d0e2)['then'](function(_0x3aff90){_0x2f3cc=_['keyBy'](_0x3aff90,'id');_0x55d0e2=_[_0xc229('0x9b')](_0x55d0e2,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f8ed6[_0xc229('0x3d')][_0xc229('0x41')]){_0x1fab42['attributes'][_0xc229('0x6c')](function(_0xe73c7a){_0x549895[_0xc229('0x48')]('i.'+_0xe73c7a);});}else{_0x549895[_0xc229('0x48')](_0xc229('0x8e'),_0xc229('0x9c'));_0x549895['field'](_0xc229('0x9d'),_0xc229('0x9e'));_0x549895['field'](_0xc229('0x9f'),_0xc229('0xa0'));_0x549895[_0xc229('0x48')](_0xc229('0xa1'),_0xc229('0x90'));_0x549895[_0xc229('0x48')](_0xc229('0xa2'));_0x549895[_0xc229('0x48')](_0xc229('0xa3'),_0xc229('0xa4'));_0x549895[_0xc229('0x48')](_0xc229('0xa5'),'Contact.lastName');_0x549895['field'](_0xc229('0xa6'),_0xc229('0xa7'));_0x549895['field'](_0xc229('0xa8'),_0xc229('0xa9'));_0x549895[_0xc229('0x48')](_0xc229('0xaa'),_0xc229('0xab'));_0x549895[_0xc229('0x48')](_0xc229('0xac'),_0xc229('0xad'));_0x549895['field'](_0xc229('0xae'),_0xc229('0xaf'));_0x549895[_0xc229('0x48')](_0xc229('0xb0'),_0xc229('0xb1'));_0x549895[_0xc229('0x48')](_0xc229('0xb2'),_0xc229('0x2d'));}if(_0x1fab42[_0xc229('0x1e')])_0x549895['limit'](_0x1fab42[_0xc229('0x1e')]);if(_0x1fab42[_0xc229('0x1c')])_0x549895[_0xc229('0x1c')](_0x1fab42[_0xc229('0x1c')]);return db[_0xc229('0x99')][_0xc229('0x3d')](_0x549895[_0xc229('0x9a')](),_0x55d0e2);})['then'](function(_0x135857){if(_0x135857[_0xc229('0x42')]>0x0)_0x1944ec[_0xc229('0x76')](_0xc229('0xb3'),_[_0xc229('0x2b')](_0x135857,'id'));return db[_0xc229('0x99')][_0xc229('0x3d')](_0x1944ec[_0xc229('0x9a')](),_0x55d0e2)[_0xc229('0x25')](function(_0x34b1c4){var _0x3446b8=_[_0xc229('0xb4')](_0x34b1c4,_0xc229('0xb5'));var _0x175922=[];_0x135857[_0xc229('0x6c')](function(_0x20adf4){_0x175922[_0xc229('0x30')](updateWhatsappInteraction(_0x20adf4,_0x2f3cc,_0x3446b8));});return BPromise['all'](_0x175922);});});})[_0xc229('0x25')](function(_0x3d3fd5){_0xf94693['rows']=_0x3d3fd5;return _0xf94693;})['then'](respondWithFilteredResult(_0xe0762e,_0x1fab42))[_0xc229('0x31')](handleError(_0xe0762e,null));};exports[_0xc229('0xb6')]=function(_0x5b8949,_0x14accf){var _0x32da99={'raw':![],'where':{'id':_0x5b8949[_0xc229('0xb7')]['id']}},_0x3ab002={};_0x3ab002[_0xc229('0x3c')]=_[_0xc229('0x74')](db[_0xc229('0x39')][_0xc229('0x3a')]);_0x3ab002[_0xc229('0x3d')]=_[_0xc229('0x74')](_0x5b8949[_0xc229('0x3d')]);_0x3ab002[_0xc229('0x3e')]=_['intersection'](_0x3ab002[_0xc229('0x3c')],_0x3ab002[_0xc229('0x3d')]);_0x32da99['attributes']=_[_0xc229('0x3f')](_0x3ab002[_0xc229('0x3c')],qs[_0xc229('0x41')](_0x5b8949[_0xc229('0x3d')][_0xc229('0x41')]));_0x32da99[_0xc229('0x40')]=_0x32da99['attributes'][_0xc229('0x42')]?_0x32da99[_0xc229('0x40')]:_0x3ab002['model'];if(_0x5b8949['query'][_0xc229('0xb8')]){_0x32da99[_0xc229('0xb9')]=[{'all':!![]}];}_0x32da99=_[_0xc229('0x9b')]({},_0x32da99,_0x5b8949[_0xc229('0xba')]);return db['WhatsappInteraction'][_0xc229('0x5f')](_0x32da99)[_0xc229('0x25')](handleEntityNotFound(_0x14accf,null))[_0xc229('0x25')](respondWithResult(_0x14accf,null))[_0xc229('0x31')](handleError(_0x14accf,null));};exports[_0xc229('0xbb')]=function(_0x4d6a73,_0x470b20){return db[_0xc229('0x39')][_0xc229('0xbb')](_0x4d6a73[_0xc229('0x73')],{})[_0xc229('0x25')](respondWithResult(_0x470b20,0xc9))['catch'](handleError(_0x470b20,null));};exports['update']=function(_0x4a605d,_0x5c0d83){if(_0x4a605d[_0xc229('0x73')]['id']){delete _0x4a605d[_0xc229('0x73')]['id'];}return db[_0xc229('0x39')]['find']({'where':{'id':_0x4a605d[_0xc229('0xb7')]['id']}})[_0xc229('0x25')](handleEntityNotFound(_0x5c0d83,null))[_0xc229('0x25')](saveUpdates(_0x4a605d[_0xc229('0x73')],null))[_0xc229('0x25')](respondWithResult(_0x5c0d83,null))['catch'](handleError(_0x5c0d83,null));};exports[_0xc229('0xbc')]=function(_0x5432d0,_0x123646){return db[_0xc229('0x39')][_0xc229('0x5f')]({'where':{'id':_0x5432d0[_0xc229('0xb7')]['id']}})[_0xc229('0x25')](handleEntityNotFound(_0x123646,null))['then'](removeEntity(_0x123646,null))[_0xc229('0x31')](handleError(_0x123646,null));};exports['describe']=function(_0x2f6aa1,_0x402b18){return db[_0xc229('0x39')][_0xc229('0xbd')]()['then'](respondWithResult(_0x402b18,null))['catch'](handleError(_0x402b18,null));};exports['addMessage']=function(_0x36e7c2,_0x25e590,_0x13858e){return db[_0xc229('0xbe')]['find']({'where':{'id':_0x36e7c2['params']['id']}})['then'](handleEntityNotFound(_0x25e590,null))['then'](function(_0x4fe4fb){if(_0x4fe4fb){return _0x4fe4fb[_0xc229('0xbf')](_0x36e7c2[_0xc229('0x73')][_0xc229('0xc0')],_[_0xc229('0xc1')](_0x36e7c2['body'],['ids','id'])||{});}})[_0xc229('0x25')](respondWithResult(_0x25e590,null))[_0xc229('0x31')](handleError(_0x25e590,null));};exports[_0xc229('0xc2')]=function(_0x4f2f35,_0x22b09b,_0x5d6c86){var _0xb6e1c7={'raw':![],'where':{}};var _0x5710a0={};var _0x56f1a6={'count':0x0,'rows':[]};return db[_0xc229('0x39')][_0xc229('0xc3')]({'where':{'id':_0x4f2f35[_0xc229('0xb7')]['id']}})[_0xc229('0x25')](handleEntityNotFound(_0x22b09b,null))[_0xc229('0x25')](function(_0x545e43){if(_0x545e43){_0x5710a0[_0xc229('0x3c')]=_['keys'](db[_0xc229('0xbe')][_0xc229('0x3a')]);_0x5710a0[_0xc229('0x3d')]=_[_0xc229('0x74')](_0x4f2f35[_0xc229('0x3d')]);_0x5710a0[_0xc229('0x3e')]=_[_0xc229('0x3f')](_0x5710a0[_0xc229('0x3c')],_0x5710a0[_0xc229('0x3d')]);_0xb6e1c7[_0xc229('0x40')]=_[_0xc229('0x3f')](_0x5710a0['model'],qs['fields'](_0x4f2f35[_0xc229('0x3d')][_0xc229('0x41')]));_0xb6e1c7[_0xc229('0x40')]=_0xb6e1c7['attributes'][_0xc229('0x42')]?_0xb6e1c7[_0xc229('0x40')]:_0x5710a0[_0xc229('0x3c')];if(!_0x4f2f35[_0xc229('0x3d')]['hasOwnProperty'](_0xc229('0x44'))){_0xb6e1c7['limit']=qs['limit'](_0x4f2f35[_0xc229('0x3d')][_0xc229('0x1e')]);_0xb6e1c7['offset']=qs[_0xc229('0x1c')](_0x4f2f35[_0xc229('0x3d')][_0xc229('0x1c')]);}_0xb6e1c7[_0xc229('0x8f')]=qs[_0xc229('0x45')](_0x4f2f35['query'][_0xc229('0x45')]);_0xb6e1c7[_0xc229('0x76')]=qs[_0xc229('0x3e')](_[_0xc229('0x46')](_0x4f2f35[_0xc229('0x3d')],_0x5710a0[_0xc229('0x3e')]));_0xb6e1c7[_0xc229('0x76')][_0xc229('0xb5')]=_0x545e43['id'];if(_0x4f2f35[_0xc229('0x3d')]['filter']){_0xb6e1c7[_0xc229('0x76')]=_[_0xc229('0x9b')](_0xb6e1c7['where'],{'$or':_[_0xc229('0x2b')](_0xb6e1c7['attributes'],function(_0x1f09e4){var _0x4ef10b={};_0x4ef10b[_0x1f09e4]={'$like':'%'+_0x4f2f35[_0xc229('0x3d')]['filter']+'%'};return _0x4ef10b;})});}if(_0x4f2f35[_0xc229('0x3d')]['$gte']){var _0xf25700=_0x4f2f35[_0xc229('0x3d')][_0xc229('0x7a')][_0xc229('0x2e')](',');var _0x111e7d={};_0x111e7d[_0xf25700[0x0]]={'$gte':moment(_0xf25700[0x1])[_0xc229('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')};_0xb6e1c7[_0xc229('0x76')]=_[_0xc229('0x9b')](_0xb6e1c7[_0xc229('0x76')],_0x111e7d);}_0xb6e1c7=_['merge']({},_0xb6e1c7,_0x4f2f35[_0xc229('0xba')]);return db['WhatsappMessage'][_0xc229('0x1f')]({'where':_0xb6e1c7[_0xc229('0x76')]})[_0xc229('0x25')](function(_0x35c767){_0x56f1a6[_0xc229('0x1f')]=_0x35c767;if(_0x4f2f35[_0xc229('0x3d')][_0xc229('0xb8')]){_0xb6e1c7['include']=[{'all':!![]}];}return db[_0xc229('0xbe')]['findAll'](_0xb6e1c7);})['then'](function(_0x1decd4){_0x56f1a6[_0xc229('0xc5')]=_0x1decd4;return _0x56f1a6;});}})['then'](respondWithFilteredResult(_0x22b09b,_0xb6e1c7))[_0xc229('0x31')](handleError(_0x22b09b,null));};exports['addTags']=function(_0x224fae,_0xd1547d,_0x36dc49){return db[_0xc229('0x39')][_0xc229('0x5f')]({'where':{'id':_0x224fae[_0xc229('0xb7')]['id']}})[_0xc229('0x25')](handleEntityNotFound(_0xd1547d,null))[_0xc229('0x25')](function(_0x2a20ad){if(_0x2a20ad){return _0x2a20ad[_0xc229('0xc6')](_0x224fae['body']['ids'],_[_0xc229('0xc1')](_0x224fae[_0xc229('0x73')],['ids','id'])||{})[_0xc229('0xc7')](function(){return db[_0xc229('0x6b')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x224fae[_0xc229('0x73')][_0xc229('0xc0')]}});})[_0xc229('0x25')](function(_0x259aca){socket['emit'](_0xc229('0xc8'),{'id':Number(_0x224fae[_0xc229('0xb7')]['id']),'tags':_0x259aca||[]});return{'id':Number(_0x224fae[_0xc229('0xb7')]['id']),'tags':_0x259aca||[]};});}})[_0xc229('0x25')](respondWithResult(_0xd1547d,null))[_0xc229('0x31')](handleError(_0xd1547d,null));};exports[_0xc229('0xc9')]=function(_0x526fa4,_0x403c11,_0x1c025f){return db['WhatsappInteraction']['find']({'where':{'id':_0x526fa4['params']['id']}})[_0xc229('0x25')](handleEntityNotFound(_0x403c11,null))[_0xc229('0x25')](function(_0x79a4d4){if(_0x79a4d4){return _0x79a4d4[_0xc229('0xc9')](_0x526fa4['query'][_0xc229('0xc0')]);}})[_0xc229('0x25')](respondWithStatusCode(_0x403c11,null))[_0xc229('0x31')](handleError(_0x403c11,null));};exports[_0xc229('0xca')]=function(_0x2a3f1e,_0x4557be){var _0x5c9416=moment()[_0xc229('0xcb')]()[_0xc229('0x9a')]();var _0x44e143=path[_0xc229('0xcc')](config[_0xc229('0xcd')],_0xc229('0xce'),_0xc229('0xcf'),'tmp');var _0x2be932=path[_0xc229('0xcc')](config['root'],_0xc229('0xce'),_0xc229('0xcf'),_0xc229('0xd0'));var _0x52b831=path['join'](_0x44e143,_0x5c9416);var _0x4bf183=util[_0xc229('0xc4')](_0xc229('0xd1'),_0x2a3f1e[_0xc229('0xb7')]['id'],_0x5c9416);var _0x1e0baa=path['join'](_0x44e143,_0x4bf183);var _0x11f842=[];_0x11f842[_0xc229('0x30')]({'model':db[_0xc229('0x6f')],'as':'User','attributes':['id',_0xc229('0x2c')],'raw':!![]});_0x11f842[_0xc229('0x30')]({'model':db[_0xc229('0xd2')],'as':_0xc229('0xd3'),'attributes':['id',_0xc229('0xd4'),'lastName'],'raw':!![]});if(_0x2a3f1e[_0xc229('0x3d')][_0xc229('0xd0')]){_0x11f842['push']({'model':db['Attachment'],'as':_0xc229('0xd5'),'raw':!![]});}var _0x395dd5=[{'model':db[_0xc229('0xbe')],'as':_0xc229('0xd6'),'attributes':['id',_0xc229('0x73'),_0xc229('0x78'),'direction',_0xc229('0xd7'),_0xc229('0x7f')],'include':_0x11f842}];_0x395dd5[_0xc229('0x30')]({'model':db[_0xc229('0xd8')],'as':_0xc229('0xd9'),'attributes':['id',_0xc229('0x28')]});_0x395dd5[_0xc229('0x30')]({'model':db[_0xc229('0x6f')],'as':_0xc229('0xda'),'attributes':['id',_0xc229('0x2c')]});return db[_0xc229('0x39')][_0xc229('0x5f')]({'where':{'id':_0x2a3f1e[_0xc229('0xb7')]['id']},'include':_0x395dd5})['then'](handleEntityNotFound(_0x4557be,null))[_0xc229('0x25')](function(_0x4d3bb8){if(_0x4d3bb8){var _0x18b1b4=_0x4d3bb8[_0xc229('0xdb')]({'plain':!![]});fs[_0xc229('0xdc')](_0x52b831);var _0x354236={'channel':'Whatsapp','account':_0x18b1b4[_0xc229('0xd9')]['name'],'agent':_0x18b1b4[_0xc229('0xda')]?_0x18b1b4[_0xc229('0xda')][_0xc229('0x2c')]:_0xc229('0xdd'),'createdAt':moment(_0x18b1b4[_0xc229('0x78')])[_0xc229('0xc4')](_0xc229('0xde'))['toString'](),'closedAt':_0x18b1b4[_0xc229('0x37')]?moment(_0x18b1b4['closedAt'])['format'](_0xc229('0xde'))[_0xc229('0x9a')]():'','disposition':_0x18b1b4['disposition'],'messages':_(_0x18b1b4[_0xc229('0xd6')])[_0xc229('0x84')]({'secret':![]})[_0xc229('0x2b')](function(_0xbc93c5){if(_0xbc93c5['Attachment']){var _0x5712c4=path[_0xc229('0xcc')](_0x2be932,_0xbc93c5[_0xc229('0xd5')][_0xc229('0xdf')]);if(fs['existsSync'](_0x5712c4)){fs[_0xc229('0xe0')](_0x5712c4)[_0xc229('0xe1')](fs['createWriteStream'](path[_0xc229('0xcc')](_0x52b831,_0xbc93c5[_0xc229('0xd5')]['basename'])));}}return{'date':moment(_0xbc93c5[_0xc229('0x78')])[_0xc229('0xc4')](_0xc229('0xde'))['toString'](),'sender':_0xbc93c5[_0xc229('0xe2')]===_0xc229('0xe3')?_0xbc93c5[_0xc229('0x6f')]?_0xbc93c5[_0xc229('0x6f')]['fullname']:_0xc229('0xe4'):_0xbc93c5['Contact'][_0xc229('0xd4')]+(_0xbc93c5[_0xc229('0xd3')][_0xc229('0xe5')]?'\x20'+_0xbc93c5[_0xc229('0xd3')][_0xc229('0xe5')]:''),'body':_0xbc93c5['Attachment']?_0xbc93c5[_0xc229('0xd5')]['basename']:_0xbc93c5[_0xc229('0x73')],'direction':_0xbc93c5['direction']===_0xc229('0xe3')?'A':'C','secret':_0xbc93c5['secret'],'read':_0xbc93c5['read'],'attachment':_0xbc93c5[_0xc229('0xd5')]};})[_0xc229('0x60')]()};return ejs[_0xc229('0xe6')](path[_0xc229('0xcc')](config[_0xc229('0xcd')],'server',_0xc229('0xe7'),_0xc229('0xe8')),{'interaction':_0x354236})[_0xc229('0x25')](function(_0x320f7e){var _0x538bcf=path[_0xc229('0xcc')](_0x52b831,_0xc229('0xe9')+_0x18b1b4['id']+'-'+_0x5c9416+_0xc229('0xea'));var _0x280725={'path':_0x538bcf,'channel':_0xc229('0xeb'),'interactionId':_0x18b1b4['id']};return pdf[_0xc229('0xec')](_0x320f7e,_0x280725);})[_0xc229('0x25')](function(){return new BPromise(function(_0x4769eb,_0x5c3dc7){zipdir(_0x52b831,{'saveTo':_0x1e0baa},function(_0x20e7eb,_0x3e2fb3){if(_0x20e7eb)return _0x5c3dc7(_0x20e7eb);return _0x4769eb(_0x3e2fb3);});})[_0xc229('0x25')](function(){return new BPromise(function(_0x44ae14,_0x5e060c){rimraf(_0x52b831,function(_0x186a6d){if(_0x186a6d)_0x5e060c(_0x186a6d);return _0x44ae14();});});})[_0xc229('0x25')](function(){return _0x4557be['download'](_0x1e0baa,_0x4bf183,function(_0x351ffa){if(_0x351ffa){console[_0xc229('0xed')](_0xc229('0xee'),_0x351ffa);}else{fs[_0xc229('0xef')](_0x1e0baa);}});});});}else{return _0x4557be[_0xc229('0x18')](0xc8);}})[_0xc229('0x31')](handleError(_0x4557be,null));}; \ No newline at end of file +var _0xc5df=['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','keys','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','agent','sequelize','count','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','groupBy','all','rows','show','intersection','includeAll','include','options','create','params','addMessage','WhatsappMessage','ids','getMessages','nolimit','WhatsappInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','emit','whatsappInteractionTags:save','removeTags','root','server','tmp','join','files','attachments','format','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Attachment','Messages','direction','WhatsappAccount','Owner','Whatsapp','N.A.','closedAt','disposition','basename','existsSync','createWriteStream','out','System','secret','views','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','sendStatus','end','json','offset','undefined','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','Users','map','fullname','Tags','split','forEach','push','TagIds','catch','talking','answered','unmanaged','total','closed','UserId','waiting','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','field','color','tools_tags','select','u.fullname','user_has_whatsapp_interactions','left_join','u.id\x20=\x20ui.UserId','from','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','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','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5df,0x80));var _0xfc5d=function(_0x624f16,_0x31eec8){_0x624f16=_0x624f16-0x0;var _0x10402e=_0xc5df[_0x624f16];return _0x10402e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfc5d('0x0'));var jsonpatch=require(_0xfc5d('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc5d('0x2'));var Mustache=require(_0xfc5d('0x3'));var util=require(_0xfc5d('0x4'));var path=require(_0xfc5d('0x5'));var sox=require(_0xfc5d('0x6'));var csv=require('to-csv');var ejs=require(_0xfc5d('0x7'));var fs=require('fs');var fs_extra=require(_0xfc5d('0x8'));var _=require(_0xfc5d('0x9'));var squel=require(_0xfc5d('0xa'));var crypto=require(_0xfc5d('0xb'));var jsforce=require(_0xfc5d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfc5d('0xd'));var querystring=require(_0xfc5d('0xe'));var Papa=require('papaparse');var Redis=require(_0xfc5d('0xf'));var authService=require(_0xfc5d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfc5d('0x11'));var pdf=require(_0xfc5d('0x12'));var hardwareService=require(_0xfc5d('0x13'));var logger=require(_0xfc5d('0x14'))('api');var utils=require(_0xfc5d('0x15'));var config=require(_0xfc5d('0x16'));var licenseUtil=require(_0xfc5d('0x17'));var db=require('../../mysqldb')['db'];config[_0xfc5d('0x18')]=_[_0xfc5d('0x19')](config['redis'],{'host':_0xfc5d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc5d('0x18')]));require('./whatsappInteraction.socket')[_0xfc5d('0x1b')](socket);function respondWithStatusCode(_0x206207,_0x1606ee){_0x1606ee=_0x1606ee||0xcc;return function(_0x105bea){if(_0x105bea){return _0x206207[_0xfc5d('0x1c')](_0x1606ee);}return _0x206207['status'](_0x1606ee)[_0xfc5d('0x1d')]();};}function respondWithResult(_0x1d496e,_0x4db0cd){_0x4db0cd=_0x4db0cd||0xc8;return function(_0x26f84a){if(_0x26f84a){return _0x1d496e['status'](_0x4db0cd)[_0xfc5d('0x1e')](_0x26f84a);}};}function respondWithFilteredResult(_0x581c1c,_0x4783d5){return function(_0x3ae06e){if(_0x3ae06e){var _0x1b8c0d=typeof _0x4783d5[_0xfc5d('0x1f')]===_0xfc5d('0x20')&&typeof _0x4783d5['limit']==='undefined';var _0x4580d7=_0x3ae06e['count'];var _0x4e3ac3=_0x1b8c0d?0x0:_0x4783d5['offset'];var _0x2fe92b=_0x1b8c0d?_0x3ae06e['count']:_0x4783d5[_0xfc5d('0x1f')]+_0x4783d5['limit'];var _0x1e997c;if(_0x2fe92b>=_0x4580d7){_0x2fe92b=_0x4580d7;_0x1e997c=0xc8;}else{_0x1e997c=0xce;}_0x581c1c[_0xfc5d('0x21')](_0x1e997c);return _0x581c1c[_0xfc5d('0x22')](_0xfc5d('0x23'),_0x4e3ac3+'-'+_0x2fe92b+'/'+_0x4580d7)['json'](_0x3ae06e);}return null;};}function patchUpdates(_0x4cf28c){return function(_0x5c88fc){try{jsonpatch[_0xfc5d('0x24')](_0x5c88fc,_0x4cf28c,!![]);}catch(_0x8c2b1b){return BPromise[_0xfc5d('0x25')](_0x8c2b1b);}return _0x5c88fc['save']();};}function saveUpdates(_0x30b782,_0x22eb5a){return function(_0x37f692){if(_0x37f692){return _0x37f692[_0xfc5d('0x26')](_0x30b782)[_0xfc5d('0x27')](function(_0xee4bb6){return _0xee4bb6;});}return null;};}function removeEntity(_0x64cf33,_0x5c2392){return function(_0x533d18){if(_0x533d18){return _0x533d18[_0xfc5d('0x28')]()['then'](function(){_0x64cf33['status'](0xcc)[_0xfc5d('0x1d')]();});}};}function handleEntityNotFound(_0x5d4470,_0x1c9fd7){return function(_0x29d36c){if(!_0x29d36c){_0x5d4470['sendStatus'](0x194);}return _0x29d36c;};}function handleError(_0xf9156d,_0x5bc69c){_0x5bc69c=_0x5bc69c||0x1f4;return function(_0x4d2d3b){logger[_0xfc5d('0x29')](_0x4d2d3b[_0xfc5d('0x2a')]);if(_0x4d2d3b[_0xfc5d('0x2b')]){delete _0x4d2d3b[_0xfc5d('0x2b')];}_0xf9156d[_0xfc5d('0x21')](_0x5bc69c)[_0xfc5d('0x2c')](_0x4d2d3b);};}function getInteractionUsers(_0x366313,_0x560198){return new BPromise(function(_0x82f10a,_0x5eb75f){try{if(_0x560198[_0x366313['id']]){_0x366313[_0xfc5d('0x2d')]=_[_0xfc5d('0x2e')](_0x560198[_0x366313['id']],function(_0x53c893){return{'id':_0x53c893['id'],'fullname':_0x53c893[_0xfc5d('0x2f')]};});}}catch(_0x2390bb){_0x5eb75f(_0x2390bb);}_0x82f10a(_0x366313);});}function getInteractionTags(_0x116272,_0x47ba6e){return new BPromise(function(_0x39461c,_0x1468cf){try{if(_0x116272['TagIds']){_0x116272[_0xfc5d('0x30')]=[];_0x116272['TagIds'][_0xfc5d('0x31')](',')[_0xfc5d('0x32')](function(_0x28f7ee){_0x116272[_0xfc5d('0x30')][_0xfc5d('0x33')](_0x47ba6e[_0x28f7ee]);});}delete _0x116272[_0xfc5d('0x34')];}catch(_0x121fe0){_0x1468cf(_0x121fe0);}_0x39461c(_0x116272);});}function updateWhatsappInteraction(_0x5e5693,_0x4bb2f6,_0x51dcf6){return new BPromise(function(_0x5a694d,_0x162a9b){return getInteractionUsers(_0x5e5693,_0x51dcf6)[_0xfc5d('0x27')](function(_0x3c9bb0){return getInteractionTags(_0x3c9bb0,_0x4bb2f6);})[_0xfc5d('0x27')](function(_0x4f3f1d){return getStateInteraction(_0x4f3f1d);})['then'](function(_0x3fad63){_0x5a694d(_0x3fad63);})[_0xfc5d('0x35')](function(_0x3671fe){_0x162a9b(_0x3671fe);});});}function getStateInteraction(_0x3e6c99){return new BPromise(function(_0x50bba7){_0x3e6c99['waiting']=0x0;_0x3e6c99[_0xfc5d('0x36')]=0x0;_0x3e6c99[_0xfc5d('0x37')]=0x0;_0x3e6c99[_0xfc5d('0x38')]=0x0;_0x3e6c99[_0xfc5d('0x39')]=0x0;if(!_0x3e6c99[_0xfc5d('0x3a')]&&!_0x3e6c99[_0xfc5d('0x3b')]){_0x3e6c99[_0xfc5d('0x3c')]+=0x1;}if(!_0x3e6c99[_0xfc5d('0x3a')]&&_0x3e6c99[_0xfc5d('0x3b')]){_0x3e6c99['talking']+=0x1;if(_0x3e6c99[_0xfc5d('0x3c')]){_0x3e6c99[_0xfc5d('0x3c')]-=0x1;}}if(_0x3e6c99['closed']&&_0x3e6c99[_0xfc5d('0x3b')]){_0x3e6c99[_0xfc5d('0x37')]+=0x1;if(_0x3e6c99['talking']){_0x3e6c99['talking']-=0x1;}}if(_0x3e6c99['closed']&&!_0x3e6c99['UserId']){_0x3e6c99['unmanaged']+=0x1;if(_0x3e6c99[_0xfc5d('0x3c')]){_0x3e6c99['waiting']-=0x1;}}_0x3e6c99[_0xfc5d('0x39')]+=0x1;_0x50bba7(_0x3e6c99);});}exports[_0xfc5d('0x3d')]=function(_0x4dac1b,_0x33edcf){var _0x523813={},_0x27cf58={},_0x5c34b0={'count':0x0,'rows':[]};var _0xc3c797=_[_0xfc5d('0x2e')](db[_0xfc5d('0x3e')][_0xfc5d('0x3f')],function(_0x493229){return{'name':_0x493229[_0xfc5d('0x40')],'type':_0x493229[_0xfc5d('0x41')][_0xfc5d('0x42')]};});_0x27cf58[_0xfc5d('0x43')]=_[_0xfc5d('0x2e')](_0xc3c797,_0xfc5d('0x2b'));_0x27cf58['query']=_['keys'](_0x4dac1b[_0xfc5d('0x44')]);_0x27cf58[_0xfc5d('0x45')]=_['intersection'](_0x27cf58[_0xfc5d('0x43')],_0x27cf58[_0xfc5d('0x44')]);_0x523813[_0xfc5d('0x46')]=_['intersection'](_0x27cf58[_0xfc5d('0x43')],qs[_0xfc5d('0x47')](_0x4dac1b[_0xfc5d('0x44')][_0xfc5d('0x47')]));_0x523813[_0xfc5d('0x46')]=_0x523813[_0xfc5d('0x46')][_0xfc5d('0x48')]?_0x523813[_0xfc5d('0x46')]:_0x27cf58[_0xfc5d('0x43')];if(!_0x4dac1b['query'][_0xfc5d('0x49')]('nolimit')){_0x523813['limit']=qs[_0xfc5d('0x4a')](_0x4dac1b[_0xfc5d('0x44')][_0xfc5d('0x4a')]);_0x523813[_0xfc5d('0x1f')]=qs[_0xfc5d('0x1f')](_0x4dac1b[_0xfc5d('0x44')]['offset']);}_0x523813[_0xfc5d('0x4b')]=qs[_0xfc5d('0x4c')](_0x4dac1b[_0xfc5d('0x44')]['sort']);_0x523813['where']=qs[_0xfc5d('0x45')](_[_0xfc5d('0x4d')](_0x4dac1b[_0xfc5d('0x44')],_0x27cf58[_0xfc5d('0x45')]),_0xc3c797);var _0x27f487=[];var _0xbd64f=squel['select']()[_0xfc5d('0x4e')]('id')[_0xfc5d('0x4e')](_0xfc5d('0x2b'))[_0xfc5d('0x4e')](_0xfc5d('0x4f'))['from'](_0xfc5d('0x50'));var _0x1d3ec1=squel[_0xfc5d('0x51')]()[_0xfc5d('0x4e')]('u.id')['field'](_0xfc5d('0x52'))[_0xfc5d('0x4e')]('ui.WhatsappInteractionId')['from'](_0xfc5d('0x53'),'ui')[_0xfc5d('0x54')]('users','u',_0xfc5d('0x55'));var _0x4a73dd=squel['select']()[_0xfc5d('0x56')](_0xfc5d('0x57'),'i')[_0xfc5d('0x54')]('cm_contacts','c',_0xfc5d('0x58'))[_0xfc5d('0x54')](_0xfc5d('0x59'),'o',_0xfc5d('0x5a'))[_0xfc5d('0x54')](_0xfc5d('0x5b'),'a',_0xfc5d('0x5c'))['left_join']('whatsapp_messages','me',_0xfc5d('0x5d'))[_0xfc5d('0x54')]('whatsapp_interaction_has_tags','it',_0xfc5d('0x5e'))['left_join'](_0xfc5d('0x50'),'t',_0xfc5d('0x5f'));var _0x2c7a8f=squel[_0xfc5d('0x60')]();var _0x35fcc6=[];var _0xadbc54=squel[_0xfc5d('0x60')]();var _0xfb1102;if(_0x4dac1b[_0xfc5d('0x44')][_0xfc5d('0x61')]){_0xfb1102=as[_0xfc5d('0x62')](_0x4dac1b[_0xfc5d('0x44')]['search']);var _0x18703f=_0xfb1102[_0xfc5d('0x63')];for(var _0x13f6a9=0x0;_0x13f6a9<_0xfb1102[_0xfc5d('0x64')][_0xfc5d('0x48')];_0x13f6a9++){var _0x52fbdd=_0xfb1102[_0xfc5d('0x64')][_0x13f6a9];var _0x3565be='i';var _0x36b61f=_[_0xfc5d('0x65')](_0xc3c797,[_0xfc5d('0x2b'),_0x52fbdd[_0xfc5d('0x4e')]]);if(!_0x36b61f){switch(_0x52fbdd['field']){case _0xfc5d('0x66'):if(_0x52fbdd[_0xfc5d('0x67')]==0x1){_0x4a73dd[_0xfc5d('0x68')]('`'+_0x52fbdd[_0xfc5d('0x4e')]+_0xfc5d('0x69'));}else{_0x4a73dd[_0xfc5d('0x68')]('`'+_0x52fbdd[_0xfc5d('0x4e')]+_0xfc5d('0x6a'));}break;case _0xfc5d('0x6b'):if(_0x52fbdd['operator']===_0xfc5d('0x6c')){if(_0x52fbdd[_0xfc5d('0x67')][_0xfc5d('0x31')]('\x20')[_0xfc5d('0x48')]>0x1){_0x2c7a8f[_0x18703f](_0xfc5d('0x6d'),qs[_0xfc5d('0x6e')](_0x52fbdd[_0xfc5d('0x67')]),null);}else{var _0x5c7981='%'+_0x52fbdd[_0xfc5d('0x67')]+'%';_0x2c7a8f[_0x18703f](_0xfc5d('0x6f'),_0x5c7981,_0x5c7981,_0x5c7981);}}else{_0x36b61f=_[_0xfc5d('0x65')](_0xc3c797,[_0xfc5d('0x2b'),'ContactId']);_0x52fbdd[_0xfc5d('0x4e')]=_0xfc5d('0x70');_0x4c0b0f=as[_0xfc5d('0x71')](_0x3565be,_0x36b61f[_0xfc5d('0x41')],_0x52fbdd);_0x2c7a8f[_0x18703f](_0x4c0b0f[_0xfc5d('0x72')],_0x4c0b0f[_0xfc5d('0x67')][_0xfc5d('0x73')],_0x4c0b0f[_0xfc5d('0x67')][_0xfc5d('0x1d')]);}break;case _0xfc5d('0x74'):var _0x1d3059=_0x52fbdd['value']['split'](',')[_0xfc5d('0x2e')](function(_0x5007f5){return Number(_0x5007f5);});_0x1d3059['forEach'](function(_0x3f9e33){_0xadbc54['or'](_0xfc5d('0x75'),'%,'+_0x3f9e33+',%');});_0x35fcc6=_[_0xfc5d('0x76')](_0x35fcc6,_0x1d3059);break;case'User':if(_0x52fbdd['operator']===_0xfc5d('0x6c')){_0x2c7a8f[_0x18703f](_0xfc5d('0x77'),'%'+_0x52fbdd[_0xfc5d('0x67')]+'%',null);}else{_0x36b61f=_[_0xfc5d('0x65')](_0xc3c797,['name',_0xfc5d('0x3b')]);_0x52fbdd[_0xfc5d('0x4e')]=_0xfc5d('0x3b');_0x4c0b0f=as['buildExpression'](_0x3565be,_0x36b61f['type'],_0x52fbdd);_0x2c7a8f[_0x18703f](_0x4c0b0f[_0xfc5d('0x72')],_0x4c0b0f['value']['start'],_0x4c0b0f[_0xfc5d('0x67')][_0xfc5d('0x1d')]);}break;case _0xfc5d('0x78'):_0x4c0b0f=as[_0xfc5d('0x71')]('me',null,_0x52fbdd);_0x2c7a8f[_0x18703f](_0x4c0b0f[_0xfc5d('0x72')],_0x4c0b0f[_0xfc5d('0x67')][_0xfc5d('0x73')],_0x4c0b0f['value']['end']);break;}}else{var _0x4c0b0f=as[_0xfc5d('0x71')](_0x3565be,_0x36b61f[_0xfc5d('0x41')],_0x52fbdd);_0x2c7a8f[_0x18703f](_0x4c0b0f['text'],_0x4c0b0f[_0xfc5d('0x67')][_0xfc5d('0x73')],_0x4c0b0f['value']['end']);}}}else{var _0x2e2d7f=_(_0x4dac1b[_0xfc5d('0x44')])[_0xfc5d('0x79')]()[_0xfc5d('0x2e')](function(_0x1939b3){return _['some'](_0xc3c797,[_0xfc5d('0x2b'),_0x1939b3])?_0x1939b3:undefined;})['compact']()[_0xfc5d('0x67')]();if(!_['isEmpty'](_0x2e2d7f)){_0x2e2d7f['forEach'](function(_0x234b58){if(_0x234b58===_0xfc5d('0x7a')){_0x4a73dd[_0xfc5d('0x7b')](_0xfc5d('0x7c'),[]['concat'](_0x4dac1b[_0xfc5d('0x44')][_0x234b58]));}else if(_0x234b58===_0xfc5d('0x7d')){var _0x23296a=JSON[_0xfc5d('0x7e')](_0x4dac1b['query'][_0x234b58])[_0xfc5d('0x7f')];var _0x2df54e=JSON[_0xfc5d('0x7e')](_0x4dac1b[_0xfc5d('0x44')][_0x234b58])[_0xfc5d('0x80')];_0x4a73dd[_0xfc5d('0x7b')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x23296a,_0x2df54e);}else{if(_0x4dac1b['query'][_0x234b58]===_0xfc5d('0x81')){_0x4a73dd['where']('i.'+_0x234b58+_0xfc5d('0x82'));}else{_0x4a73dd[_0xfc5d('0x7b')]('i.'+_0x234b58+_0xfc5d('0x83'),_0x4dac1b[_0xfc5d('0x44')][_0x234b58]);}}});}if(_0x4dac1b[_0xfc5d('0x44')][_0xfc5d('0x84')]){if(_0x4dac1b[_0xfc5d('0x44')]['read']==0x1){_0x4a73dd[_0xfc5d('0x68')](_0xfc5d('0x85'));}else{_0x4a73dd[_0xfc5d('0x68')]('`unreadMessages`\x20>\x200');}}if(_0x4dac1b[_0xfc5d('0x44')][_0xfc5d('0x86')]){_0x35fcc6=_[_0xfc5d('0x87')](_0x4dac1b['query'][_0xfc5d('0x86')])?_0x4dac1b[_0xfc5d('0x44')][_0xfc5d('0x86')]:new Array(_0x4dac1b['query'][_0xfc5d('0x86')]);_0x35fcc6[_0xfc5d('0x32')](function(_0x4e9420){_0xadbc54['or'](_0xfc5d('0x75'),'%,'+_0x4e9420+',%');});}if(_0x4dac1b[_0xfc5d('0x44')][_0xfc5d('0x88')]){var _0xba4c03=_0x4dac1b[_0xfc5d('0x44')][_0xfc5d('0x88')][_0xfc5d('0x89')]('\x5c','\x5c\x5c')[_0xfc5d('0x89')](/'/g,'\x27\x27');if(qs[_0xfc5d('0x8a')](_0xba4c03)){_0x2c7a8f['or']('i.id\x20LIKE\x20?',_0xba4c03+'%')['or'](_0xfc5d('0x8b'),_0xba4c03+'%');}else{_0x2c7a8f['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xfc5d('0x6e')](_0xba4c03))['or'](_0xfc5d('0x8c'),_0xba4c03+'%');}}}_0x4a73dd[_0xfc5d('0x7b')](_0x2c7a8f);_0x4a73dd['group']('i.id');var _0x31283e={'type':db[_0xfc5d('0x8d')][_0xfc5d('0x8e')][_0xfc5d('0x8f')],'raw':!![]};var _0x3f46bd=_0x4a73dd[_0xfc5d('0x90')]();_0x3f46bd[_0xfc5d('0x4e')](_0xfc5d('0x91'));_0x3f46bd['field'](_0xfc5d('0x92'),_0xfc5d('0x66'));if(_0x523813[_0xfc5d('0x4b')]){_0x523813[_0xfc5d('0x4b')][_0xfc5d('0x32')](function(_0x3c029f){var _0x379ff1=_0x3c029f[0x0]===_0xfc5d('0x93')?_0x3c029f[0x0]:'i.'+_0x3c029f[0x0];_0x4a73dd[_0xfc5d('0x4b')](_0x379ff1,_0x3c029f[0x1]===_0xfc5d('0x94')?![]:!![]);});}if(!_[_0xfc5d('0x95')](_0x35fcc6)){_0x4a73dd[_0xfc5d('0x68')](_0xadbc54);_0x3f46bd[_0xfc5d('0x7b')](_0xfc5d('0x96'),_0x35fcc6);}BPromise[_0xfc5d('0x97')]()[_0xfc5d('0x27')](function(){if(!_0xfb1102){if(_0x4dac1b['query'][_0xfc5d('0x7a')])return;_0x3f46bd['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x4a73dd[_0xfc5d('0x7b')](_0xfc5d('0x98'));return;}if(_0x4dac1b[_0xfc5d('0x99')]['role']!=='agent')return;return _0x4dac1b[_0xfc5d('0x99')][_0xfc5d('0x9a')]({'attributes':['id'],'raw':!![]})[_0xfc5d('0x27')](function(_0xe14c70){if(_[_0xfc5d('0x95')](_0xe14c70)){_0x3f46bd['where'](_0xfc5d('0x9b'));_0x4a73dd[_0xfc5d('0x7b')](_0xfc5d('0x9b'));}else{_0x3f46bd['where'](_0xfc5d('0x7c'),_[_0xfc5d('0x2e')](_0xe14c70,'id'));_0x4a73dd['where'](_0xfc5d('0x7c'),_[_0xfc5d('0x2e')](_0xe14c70,'id'));}});})[_0xfc5d('0x27')](function(){if(_0x4dac1b[_0xfc5d('0x99')][_0xfc5d('0x9c')]===_0xfc5d('0x9d')&&!_0xfb1102&&!_0x4dac1b[_0xfc5d('0x44')][_0xfc5d('0x7a')])return[];return db[_0xfc5d('0x9e')][_0xfc5d('0x44')](_0x3f46bd['toString'](),_0x31283e);})[_0xfc5d('0x27')](function(_0x207771){_0x5c34b0[_0xfc5d('0x9f')]=_0x207771[_0xfc5d('0x48')];if(_0x5c34b0[_0xfc5d('0x9f')]===0x0)return[];return db[_0xfc5d('0x9e')]['query'](_0xbd64f['toString'](),_0x31283e)[_0xfc5d('0x27')](function(_0x3934d5){_0x27f487=_[_0xfc5d('0xa0')](_0x3934d5,'id');_0x31283e=_[_0xfc5d('0xa1')](_0x31283e,{'model':db[_0xfc5d('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4dac1b[_0xfc5d('0x44')][_0xfc5d('0x47')]){_0x523813[_0xfc5d('0x46')][_0xfc5d('0x32')](function(_0x4dd491){_0x4a73dd[_0xfc5d('0x4e')]('i.'+_0x4dd491);});}else{_0x4a73dd[_0xfc5d('0x4e')](_0xfc5d('0x92'),_0xfc5d('0x66'));_0x4a73dd['field'](_0xfc5d('0xa2'),_0xfc5d('0xa3'));_0x4a73dd['field'](_0xfc5d('0xa4'),_0xfc5d('0xa5'));_0x4a73dd[_0xfc5d('0x4e')]('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',_0xfc5d('0x93'));_0x4a73dd['field'](_0xfc5d('0xa6'));_0x4a73dd[_0xfc5d('0x4e')](_0xfc5d('0xa7'),_0xfc5d('0xa8'));_0x4a73dd[_0xfc5d('0x4e')](_0xfc5d('0xa9'),_0xfc5d('0xaa'));_0x4a73dd[_0xfc5d('0x4e')]('c.email',_0xfc5d('0xab'));_0x4a73dd[_0xfc5d('0x4e')]('c.phone',_0xfc5d('0xac'));_0x4a73dd[_0xfc5d('0x4e')]('c.mobile',_0xfc5d('0xad'));_0x4a73dd[_0xfc5d('0x4e')](_0xfc5d('0xae'),_0xfc5d('0xaf'));_0x4a73dd['field'](_0xfc5d('0xb0'),_0xfc5d('0xb1'));_0x4a73dd[_0xfc5d('0x4e')](_0xfc5d('0xb2'),_0xfc5d('0xb3'));_0x4a73dd[_0xfc5d('0x4e')](_0xfc5d('0xb4'),_0xfc5d('0x34'));}if(_0x523813[_0xfc5d('0x4a')])_0x4a73dd['limit'](_0x523813[_0xfc5d('0x4a')]);if(_0x523813[_0xfc5d('0x1f')])_0x4a73dd[_0xfc5d('0x1f')](_0x523813['offset']);return db[_0xfc5d('0x9e')][_0xfc5d('0x44')](_0x4a73dd[_0xfc5d('0xb5')](),_0x31283e);})['then'](function(_0x33c13b){if(_0x33c13b['length']>0x0)_0x1d3ec1[_0xfc5d('0x7b')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0xfc5d('0x2e')](_0x33c13b,'id'));return db[_0xfc5d('0x9e')][_0xfc5d('0x44')](_0x1d3ec1[_0xfc5d('0xb5')](),_0x31283e)[_0xfc5d('0x27')](function(_0x1ea804){var _0x4ebb7b=_[_0xfc5d('0xb6')](_0x1ea804,'WhatsappInteractionId');var _0x488269=[];_0x33c13b[_0xfc5d('0x32')](function(_0x5a6365){_0x488269[_0xfc5d('0x33')](updateWhatsappInteraction(_0x5a6365,_0x27f487,_0x4ebb7b));});return BPromise[_0xfc5d('0xb7')](_0x488269);});});})['then'](function(_0x36c51b){_0x5c34b0[_0xfc5d('0xb8')]=_0x36c51b;return _0x5c34b0;})[_0xfc5d('0x27')](respondWithFilteredResult(_0x33edcf,_0x523813))[_0xfc5d('0x35')](handleError(_0x33edcf,null));};exports[_0xfc5d('0xb9')]=function(_0x388de7,_0x3aa824){var _0x57868e={'raw':![],'where':{'id':_0x388de7['params']['id']}},_0x13843b={};_0x13843b['model']=_[_0xfc5d('0x79')](db[_0xfc5d('0x3e')][_0xfc5d('0x3f')]);_0x13843b[_0xfc5d('0x44')]=_[_0xfc5d('0x79')](_0x388de7[_0xfc5d('0x44')]);_0x13843b[_0xfc5d('0x45')]=_[_0xfc5d('0xba')](_0x13843b[_0xfc5d('0x43')],_0x13843b[_0xfc5d('0x44')]);_0x57868e[_0xfc5d('0x46')]=_['intersection'](_0x13843b[_0xfc5d('0x43')],qs[_0xfc5d('0x47')](_0x388de7[_0xfc5d('0x44')][_0xfc5d('0x47')]));_0x57868e[_0xfc5d('0x46')]=_0x57868e['attributes'][_0xfc5d('0x48')]?_0x57868e['attributes']:_0x13843b[_0xfc5d('0x43')];if(_0x388de7[_0xfc5d('0x44')][_0xfc5d('0xbb')]){_0x57868e[_0xfc5d('0xbc')]=[{'all':!![]}];}_0x57868e=_[_0xfc5d('0xa1')]({},_0x57868e,_0x388de7[_0xfc5d('0xbd')]);return db[_0xfc5d('0x3e')]['find'](_0x57868e)[_0xfc5d('0x27')](handleEntityNotFound(_0x3aa824,null))['then'](respondWithResult(_0x3aa824,null))[_0xfc5d('0x35')](handleError(_0x3aa824,null));};exports[_0xfc5d('0xbe')]=function(_0x36a311,_0x2de3b4){return db[_0xfc5d('0x3e')][_0xfc5d('0xbe')](_0x36a311[_0xfc5d('0x78')],{})[_0xfc5d('0x27')](respondWithResult(_0x2de3b4,0xc9))[_0xfc5d('0x35')](handleError(_0x2de3b4,null));};exports[_0xfc5d('0x26')]=function(_0x2d987a,_0x57e66b){if(_0x2d987a[_0xfc5d('0x78')]['id']){delete _0x2d987a[_0xfc5d('0x78')]['id'];}return db[_0xfc5d('0x3e')][_0xfc5d('0x65')]({'where':{'id':_0x2d987a[_0xfc5d('0xbf')]['id']}})[_0xfc5d('0x27')](handleEntityNotFound(_0x57e66b,null))[_0xfc5d('0x27')](saveUpdates(_0x2d987a['body'],null))['then'](respondWithResult(_0x57e66b,null))[_0xfc5d('0x35')](handleError(_0x57e66b,null));};exports[_0xfc5d('0x28')]=function(_0x113dd7,_0x5b4918){return db['WhatsappInteraction'][_0xfc5d('0x65')]({'where':{'id':_0x113dd7[_0xfc5d('0xbf')]['id']}})[_0xfc5d('0x27')](handleEntityNotFound(_0x5b4918,null))[_0xfc5d('0x27')](removeEntity(_0x5b4918,null))[_0xfc5d('0x35')](handleError(_0x5b4918,null));};exports['describe']=function(_0x4b5b7f,_0x994359){return db[_0xfc5d('0x3e')]['describe']()['then'](respondWithResult(_0x994359,null))['catch'](handleError(_0x994359,null));};exports[_0xfc5d('0xc0')]=function(_0x3877c8,_0x1dbf7c,_0xf11d68){return db[_0xfc5d('0xc1')][_0xfc5d('0x65')]({'where':{'id':_0x3877c8[_0xfc5d('0xbf')]['id']}})[_0xfc5d('0x27')](handleEntityNotFound(_0x1dbf7c,null))[_0xfc5d('0x27')](function(_0xe4e63c){if(_0xe4e63c){return _0xe4e63c[_0xfc5d('0xc0')](_0x3877c8[_0xfc5d('0x78')]['ids'],_['omit'](_0x3877c8[_0xfc5d('0x78')],[_0xfc5d('0xc2'),'id'])||{});}})[_0xfc5d('0x27')](respondWithResult(_0x1dbf7c,null))[_0xfc5d('0x35')](handleError(_0x1dbf7c,null));};exports[_0xfc5d('0xc3')]=function(_0x5cc83a,_0x1c87c6,_0x24942f){var _0x153b3c={'raw':![],'where':{}};var _0x4ec736={};var _0x5ea54a={'count':0x0,'rows':[]};return db[_0xfc5d('0x3e')]['findOne']({'where':{'id':_0x5cc83a[_0xfc5d('0xbf')]['id']}})[_0xfc5d('0x27')](handleEntityNotFound(_0x1c87c6,null))[_0xfc5d('0x27')](function(_0x1946b7){if(_0x1946b7){_0x4ec736[_0xfc5d('0x43')]=_[_0xfc5d('0x79')](db[_0xfc5d('0xc1')][_0xfc5d('0x3f')]);_0x4ec736[_0xfc5d('0x44')]=_[_0xfc5d('0x79')](_0x5cc83a[_0xfc5d('0x44')]);_0x4ec736[_0xfc5d('0x45')]=_['intersection'](_0x4ec736[_0xfc5d('0x43')],_0x4ec736['query']);_0x153b3c[_0xfc5d('0x46')]=_[_0xfc5d('0xba')](_0x4ec736[_0xfc5d('0x43')],qs[_0xfc5d('0x47')](_0x5cc83a[_0xfc5d('0x44')][_0xfc5d('0x47')]));_0x153b3c['attributes']=_0x153b3c[_0xfc5d('0x46')]['length']?_0x153b3c[_0xfc5d('0x46')]:_0x4ec736[_0xfc5d('0x43')];if(!_0x5cc83a[_0xfc5d('0x44')][_0xfc5d('0x49')](_0xfc5d('0xc4'))){_0x153b3c['limit']=qs['limit'](_0x5cc83a[_0xfc5d('0x44')][_0xfc5d('0x4a')]);_0x153b3c['offset']=qs[_0xfc5d('0x1f')](_0x5cc83a[_0xfc5d('0x44')]['offset']);}_0x153b3c[_0xfc5d('0x4b')]=qs[_0xfc5d('0x4c')](_0x5cc83a['query'][_0xfc5d('0x4c')]);_0x153b3c[_0xfc5d('0x7b')]=qs['filters'](_[_0xfc5d('0x4d')](_0x5cc83a[_0xfc5d('0x44')],_0x4ec736[_0xfc5d('0x45')]));_0x153b3c[_0xfc5d('0x7b')][_0xfc5d('0xc5')]=_0x1946b7['id'];if(_0x5cc83a[_0xfc5d('0x44')][_0xfc5d('0x88')]){_0x153b3c[_0xfc5d('0x7b')]=_[_0xfc5d('0xa1')](_0x153b3c[_0xfc5d('0x7b')],{'$or':_[_0xfc5d('0x2e')](_0x153b3c[_0xfc5d('0x46')],function(_0x4eb723){var _0x23e4e1={};_0x23e4e1[_0x4eb723]={'$like':'%'+_0x5cc83a[_0xfc5d('0x44')][_0xfc5d('0x88')]+'%'};return _0x23e4e1;})});}if(_0x5cc83a[_0xfc5d('0x44')][_0xfc5d('0x7f')]){var _0x37ef74=_0x5cc83a[_0xfc5d('0x44')][_0xfc5d('0x7f')][_0xfc5d('0x31')](',');var _0x539a63={};_0x539a63[_0x37ef74[0x0]]={'$gte':moment(_0x37ef74[0x1])['format'](_0xfc5d('0xc6'))};_0x153b3c[_0xfc5d('0x7b')]=_[_0xfc5d('0xa1')](_0x153b3c[_0xfc5d('0x7b')],_0x539a63);}_0x153b3c=_[_0xfc5d('0xa1')]({},_0x153b3c,_0x5cc83a['options']);return db['WhatsappMessage'][_0xfc5d('0x9f')]({'where':_0x153b3c[_0xfc5d('0x7b')]})[_0xfc5d('0x27')](function(_0x4d0a3d){_0x5ea54a[_0xfc5d('0x9f')]=_0x4d0a3d;if(_0x5cc83a[_0xfc5d('0x44')][_0xfc5d('0xbb')]){_0x153b3c['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xfc5d('0xc7')](_0x153b3c);})[_0xfc5d('0x27')](function(_0x4b5904){_0x5ea54a[_0xfc5d('0xb8')]=_0x4b5904;return _0x5ea54a;});}})[_0xfc5d('0x27')](respondWithFilteredResult(_0x1c87c6,_0x153b3c))[_0xfc5d('0x35')](handleError(_0x1c87c6,null));};exports[_0xfc5d('0xc8')]=function(_0x1ec64a,_0x264032,_0x59dc56){return db['WhatsappInteraction'][_0xfc5d('0x65')]({'where':{'id':_0x1ec64a[_0xfc5d('0xbf')]['id']}})[_0xfc5d('0x27')](handleEntityNotFound(_0x264032,null))[_0xfc5d('0x27')](function(_0xdde0f1){if(_0xdde0f1){return _0xdde0f1[_0xfc5d('0xc9')](_0x1ec64a[_0xfc5d('0x78')][_0xfc5d('0xc2')],_[_0xfc5d('0xca')](_0x1ec64a[_0xfc5d('0x78')],[_0xfc5d('0xc2'),'id'])||{})[_0xfc5d('0xcb')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0xfc5d('0x4f')],'where':{'id':_0x1ec64a[_0xfc5d('0x78')][_0xfc5d('0xc2')]}});})['then'](function(_0x1b4c44){socket[_0xfc5d('0xcc')](_0xfc5d('0xcd'),{'id':Number(_0x1ec64a[_0xfc5d('0xbf')]['id']),'tags':_0x1b4c44||[]});return{'id':Number(_0x1ec64a[_0xfc5d('0xbf')]['id']),'tags':_0x1b4c44||[]};});}})[_0xfc5d('0x27')](respondWithResult(_0x264032,null))[_0xfc5d('0x35')](handleError(_0x264032,null));};exports[_0xfc5d('0xce')]=function(_0x4fd19b,_0x34167e,_0xfcd598){return db[_0xfc5d('0x3e')][_0xfc5d('0x65')]({'where':{'id':_0x4fd19b[_0xfc5d('0xbf')]['id']}})[_0xfc5d('0x27')](handleEntityNotFound(_0x34167e,null))[_0xfc5d('0x27')](function(_0x145db9){if(_0x145db9){return _0x145db9[_0xfc5d('0xce')](_0x4fd19b[_0xfc5d('0x44')][_0xfc5d('0xc2')]);}})['then'](respondWithStatusCode(_0x34167e,null))['catch'](handleError(_0x34167e,null));};exports['download']=function(_0x43fd15,_0x4801bb){var _0x138a6c=moment()['unix']()[_0xfc5d('0xb5')]();var _0x405e69=path['join'](config[_0xfc5d('0xcf')],_0xfc5d('0xd0'),'files',_0xfc5d('0xd1'));var _0x288eda=path[_0xfc5d('0xd2')](config[_0xfc5d('0xcf')],_0xfc5d('0xd0'),_0xfc5d('0xd3'),_0xfc5d('0xd4'));var _0x5bda95=path[_0xfc5d('0xd2')](_0x405e69,_0x138a6c);var _0x6dd327=util[_0xfc5d('0xd5')](_0xfc5d('0xd6'),_0x43fd15['params']['id'],_0x138a6c);var _0x48c277=path[_0xfc5d('0xd2')](_0x405e69,_0x6dd327);var _0x38b9b4=[];_0x38b9b4[_0xfc5d('0x33')]({'model':db[_0xfc5d('0xd7')],'as':'User','attributes':['id',_0xfc5d('0x2f')],'raw':!![]});_0x38b9b4['push']({'model':db[_0xfc5d('0xd8')],'as':'Contact','attributes':['id',_0xfc5d('0xd9'),_0xfc5d('0xda')],'raw':!![]});if(_0x43fd15[_0xfc5d('0x44')][_0xfc5d('0xd4')]){_0x38b9b4[_0xfc5d('0x33')]({'model':db[_0xfc5d('0xdb')],'as':_0xfc5d('0xdb'),'raw':!![]});}var _0xb7b18e=[{'model':db[_0xfc5d('0xc1')],'as':_0xfc5d('0xdc'),'attributes':['id',_0xfc5d('0x78'),_0xfc5d('0x7d'),_0xfc5d('0xdd'),'secret',_0xfc5d('0x84')],'include':_0x38b9b4}];_0xb7b18e['push']({'model':db[_0xfc5d('0xde')],'as':'Account','attributes':['id','name']});_0xb7b18e['push']({'model':db[_0xfc5d('0xd7')],'as':_0xfc5d('0xdf'),'attributes':['id',_0xfc5d('0x2f')]});return db[_0xfc5d('0x3e')][_0xfc5d('0x65')]({'where':{'id':_0x43fd15[_0xfc5d('0xbf')]['id']},'include':_0xb7b18e})['then'](handleEntityNotFound(_0x4801bb,null))[_0xfc5d('0x27')](function(_0xb65030){if(_0xb65030){var _0x1cd88f=_0xb65030['get']({'plain':!![]});fs['mkdirSync'](_0x5bda95);var _0x44e420={'channel':_0xfc5d('0xe0'),'account':_0x1cd88f['Account'][_0xfc5d('0x2b')],'agent':_0x1cd88f[_0xfc5d('0xdf')]?_0x1cd88f[_0xfc5d('0xdf')][_0xfc5d('0x2f')]:_0xfc5d('0xe1'),'createdAt':moment(_0x1cd88f['createdAt'])[_0xfc5d('0xd5')](_0xfc5d('0xc6'))[_0xfc5d('0xb5')](),'closedAt':_0x1cd88f[_0xfc5d('0x3a')]?moment(_0x1cd88f[_0xfc5d('0xe2')])[_0xfc5d('0xd5')](_0xfc5d('0xc6'))[_0xfc5d('0xb5')]():'','disposition':_0x1cd88f[_0xfc5d('0xe3')],'messages':_(_0x1cd88f[_0xfc5d('0xdc')])['filter']({'secret':![]})[_0xfc5d('0x2e')](function(_0x2660c9){if(_0x2660c9['Attachment']){var _0xeb0e3d=path[_0xfc5d('0xd2')](_0x288eda,_0x2660c9['Attachment'][_0xfc5d('0xe4')]);if(fs[_0xfc5d('0xe5')](_0xeb0e3d)){fs['createReadStream'](_0xeb0e3d)['pipe'](fs[_0xfc5d('0xe6')](path[_0xfc5d('0xd2')](_0x5bda95,_0x2660c9[_0xfc5d('0xdb')][_0xfc5d('0xe4')])));}}return{'date':moment(_0x2660c9[_0xfc5d('0x7d')])[_0xfc5d('0xd5')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfc5d('0xb5')](),'sender':_0x2660c9['direction']===_0xfc5d('0xe7')?_0x2660c9['User']?_0x2660c9[_0xfc5d('0xd7')][_0xfc5d('0x2f')]:_0xfc5d('0xe8'):_0x2660c9[_0xfc5d('0x6b')]['firstName']+(_0x2660c9[_0xfc5d('0x6b')][_0xfc5d('0xda')]?'\x20'+_0x2660c9[_0xfc5d('0x6b')][_0xfc5d('0xda')]:''),'body':_0x2660c9[_0xfc5d('0xdb')]?_0x2660c9['Attachment'][_0xfc5d('0xe4')]:_0x2660c9[_0xfc5d('0x78')],'direction':_0x2660c9[_0xfc5d('0xdd')]===_0xfc5d('0xe7')?'A':'C','secret':_0x2660c9[_0xfc5d('0xe9')],'read':_0x2660c9['read'],'attachment':_0x2660c9[_0xfc5d('0xdb')]};})[_0xfc5d('0x67')]()};return ejs['renderFile'](path['join'](config[_0xfc5d('0xcf')],_0xfc5d('0xd0'),_0xfc5d('0xea'),'downloadInteraction.ejs'),{'interaction':_0x44e420})[_0xfc5d('0x27')](function(_0x556296){var _0x329537=path[_0xfc5d('0xd2')](_0x5bda95,_0xfc5d('0xeb')+_0x1cd88f['id']+'-'+_0x138a6c+_0xfc5d('0xec'));var _0x18701a={'path':_0x329537,'channel':_0xfc5d('0xe0'),'interactionId':_0x1cd88f['id']};return pdf[_0xfc5d('0xed')](_0x556296,_0x18701a);})['then'](function(){return new BPromise(function(_0x4c20f7,_0x3f723c){zipdir(_0x5bda95,{'saveTo':_0x48c277},function(_0x543270,_0x4c1c78){if(_0x543270)return _0x3f723c(_0x543270);return _0x4c20f7(_0x4c1c78);});})[_0xfc5d('0x27')](function(){return new BPromise(function(_0x5b0f11,_0x717f3b){rimraf(_0x5bda95,function(_0x1f349e){if(_0x1f349e)_0x717f3b(_0x1f349e);return _0x5b0f11();});});})[_0xfc5d('0x27')](function(){return _0x4801bb[_0xfc5d('0xee')](_0x48c277,_0x6dd327,function(_0x4b8ecd){if(_0x4b8ecd){console[_0xfc5d('0xef')](_0xfc5d('0xf0'),_0x4b8ecd);}else{fs[_0xfc5d('0xf1')](_0x48c277);}});});});}else{return _0x4801bb[_0xfc5d('0x1c')](0xc8);}})[_0xfc5d('0x35')](handleError(_0x4801bb,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 4a968c0..d9d606c 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 _0xbdeb=['setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','../../mysqldb'];(function(_0x31a09b,_0x2f3a0c){var _0x4532e8=function(_0x20bfd0){while(--_0x20bfd0){_0x31a09b['push'](_0x31a09b['shift']());}};_0x4532e8(++_0x2f3a0c);}(_0xbdeb,0x6f));var _0xbbde=function(_0x56ec94,_0x539e9e){_0x56ec94=_0x56ec94-0x0;var _0x5a88e3=_0xbdeb[_0x56ec94];return _0x5a88e3;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xbbde('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xbbde('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xbbde('0x1')](0x0);var events={'afterCreate':_0xbbde('0x2'),'afterUpdate':_0xbbde('0x3'),'afterDestroy':_0xbbde('0x4')};function emitEvent(_0x5362c3){return function(_0x56c2f0,_0x1037e6,_0x1d4042){_0x56c2f0[_0xbbde('0x5')]({'attributes':['id'],'raw':!![]})[_0xbbde('0x6')](function(_0x5e6273){_0x56c2f0['setDataValue'](_0xbbde('0x7'),_0x5e6273[_0xbbde('0x8')](function(_0x51706d){return{'id':_0x51706d['id']};}));return WhatsappMessage[_0xbbde('0x9')]({'where':{'WhatsappInteractionId':_0x56c2f0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbbde('0x6')](function(_0x3164f7){_0x56c2f0[_0xbbde('0xa')](_0xbbde('0xb'),_0x3164f7[_0xbbde('0xc')]);WhatsappInteractionEvents[_0xbbde('0xd')](_0x5362c3+':'+_0x56c2f0['id'],_0x56c2f0);WhatsappInteractionEvents[_0xbbde('0xd')](_0x5362c3,_0x56c2f0);_0x1d4042(null);})[_0xbbde('0xe')](_0x1d4042(null));};}for(var e in events){if(events[_0xbbde('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x8cc8=['WhatsappMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','findAll','then','length','emit','catch','hook','exports','events','../../mysqldb','WhatsappInteraction'];(function(_0x137aa6,_0xc9ad62){var _0x24cb82=function(_0x278fcd){while(--_0x278fcd){_0x137aa6['push'](_0x137aa6['shift']());}};_0x24cb82(++_0xc9ad62);}(_0x8cc8,0x177));var _0x88cc=function(_0x284c37,_0x475e4a){_0x284c37=_0x284c37-0x0;var _0x4f85ac=_0x8cc8[_0x284c37];return _0x4f85ac;};'use strict';var EventEmitter=require(_0x88cc('0x0'));var WhatsappInteraction=require(_0x88cc('0x1'))['db'][_0x88cc('0x2')];var WhatsappMessage=require(_0x88cc('0x1'))['db'][_0x88cc('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x88cc('0x4')](0x0);var events={'afterCreate':_0x88cc('0x5'),'afterUpdate':_0x88cc('0x6'),'afterDestroy':_0x88cc('0x7')};function emitEvent(_0xce4dc7){return function(_0x1c943a,_0x88dfa3,_0x1683f9){_0x1c943a['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3d35ed){_0x1c943a[_0x88cc('0x8')](_0x88cc('0x9'),_0x3d35ed[_0x88cc('0xa')](function(_0x4b61a1){return{'id':_0x4b61a1['id']};}));return WhatsappMessage[_0x88cc('0xb')]({'where':{'WhatsappInteractionId':_0x1c943a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x88cc('0xc')](function(_0x574946){_0x1c943a[_0x88cc('0x8')]('unreadMessages',_0x574946[_0x88cc('0xd')]);WhatsappInteractionEvents[_0x88cc('0xe')](_0xce4dc7+':'+_0x1c943a['id'],_0x1c943a);WhatsappInteractionEvents[_0x88cc('0xe')](_0xce4dc7,_0x1c943a);_0x1683f9(null);})[_0x88cc('0xf')](_0x1683f9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x88cc('0x10')](e,emitEvent(event));}}module[_0x88cc('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 32cda38..c78c860 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 _0x8ce6=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','closed'];(function(_0x41125d,_0x3c1c7e){var _0x4694df=function(_0xc352e5){while(--_0xc352e5){_0x41125d['push'](_0x41125d['shift']());}};_0x4694df(++_0x3c1c7e);}(_0x8ce6,0xcf));var _0x68ce=function(_0xee2683,_0x516635){_0xee2683=_0xee2683-0x0;var _0x51bea4=_0x8ce6[_0xee2683];return _0x51bea4;};'use strict';var _=require(_0x68ce('0x0'));var util=require(_0x68ce('0x1'));var logger=require(_0x68ce('0x2'))(_0x68ce('0x3'));var moment=require(_0x68ce('0x4'));var BPromise=require(_0x68ce('0x5'));var rp=require(_0x68ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ce('0x7'));var config=require(_0x68ce('0x8'));var attributes=require(_0x68ce('0x9'));module['exports']=function(_0x3edc31,_0xebd886){return _0x3edc31[_0x68ce('0xa')](_0x68ce('0xb'),attributes,{'tableName':_0x68ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48c0d8,_0x58c8d0,_0x583272){if(_0x48c0d8['changed'](_0x68ce('0xd'))){_0x48c0d8[_0x68ce('0xe')]=moment()[_0x68ce('0xf')](_0x68ce('0x10'));}_0x583272(null,_0x48c0d8);}}});}; \ No newline at end of file +var _0x07c9=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','closed'];(function(_0x46800d,_0x588500){var _0x3824cd=function(_0x14b132){while(--_0x14b132){_0x46800d['push'](_0x46800d['shift']());}};_0x3824cd(++_0x588500);}(_0x07c9,0x6f));var _0x907c=function(_0x526b4c,_0x112ee3){_0x526b4c=_0x526b4c-0x0;var _0x39639d=_0x07c9[_0x526b4c];return _0x39639d;};'use strict';var _=require(_0x907c('0x0'));var util=require(_0x907c('0x1'));var logger=require('../../config/logger')(_0x907c('0x2'));var moment=require(_0x907c('0x3'));var BPromise=require(_0x907c('0x4'));var rp=require(_0x907c('0x5'));var fs=require('fs');var path=require(_0x907c('0x6'));var rimraf=require(_0x907c('0x7'));var config=require(_0x907c('0x8'));var attributes=require(_0x907c('0x9'));module[_0x907c('0xa')]=function(_0x1bf64f,_0x4b92e1){return _0x1bf64f[_0x907c('0xb')](_0x907c('0xc'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503dc3,_0x1f69e0,_0x206750){if(_0x503dc3[_0x907c('0xd')](_0x907c('0xe'))){_0x503dc3[_0x907c('0xf')]=moment()[_0x907c('0x10')](_0x907c('0x11'));}_0x206750(null,_0x503dc3);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index cc0b159..10585cd 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 _0xc8da=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','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','code','message','result','catch','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment'];(function(_0x326843,_0xaf93e3){var _0x5b0dd3=function(_0x2bfb00){while(--_0x2bfb00){_0x326843['push'](_0x326843['shift']());}};_0x5b0dd3(++_0xaf93e3);}(_0xc8da,0xe3));var _0xac8d=function(_0x2f70f9,_0x182c4b){_0x2f70f9=_0x2f70f9-0x0;var _0x3ecefb=_0xc8da[_0x2f70f9];return _0x3ecefb;};'use strict';var _=require(_0xac8d('0x0'));var util=require(_0xac8d('0x1'));var moment=require(_0xac8d('0x2'));var BPromise=require(_0xac8d('0x3'));var rs=require(_0xac8d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac8d('0x5'))['db'];var utils=require(_0xac8d('0x6'));var logger=require(_0xac8d('0x7'))(_0xac8d('0x8'));var config=require(_0xac8d('0x9'));var jayson=require(_0xac8d('0xa'));var client=jayson[_0xac8d('0xb')][_0xac8d('0xc')]({'port':0x232a});config[_0xac8d('0xd')]=_[_0xac8d('0xe')](config[_0xac8d('0xd')],{'host':_0xac8d('0xf'),'port':0x18eb});var socket=require(_0xac8d('0x10'))(new Redis(config[_0xac8d('0xd')]));require(_0xac8d('0x11'))[_0xac8d('0x12')](socket);function respondWithRpcPromise(_0x565ca2,_0x47f4f7,_0x121540){return new BPromise(function(_0x536891,_0x278697){return client[_0xac8d('0x13')](_0x565ca2,_0x121540)[_0xac8d('0x14')](function(_0x2c296a){logger[_0xac8d('0x15')](_0xac8d('0x16'),_0x47f4f7,_0xac8d('0x17'));logger[_0xac8d('0x18')](_0xac8d('0x19'),_0x47f4f7,_0xac8d('0x17'),JSON[_0xac8d('0x1a')](_0x2c296a));if(_0x2c296a[_0xac8d('0x1b')]){if(_0x2c296a[_0xac8d('0x1b')][_0xac8d('0x1c')]===0x1f4){logger[_0xac8d('0x1b')](_0xac8d('0x16'),_0x47f4f7,_0x2c296a[_0xac8d('0x1b')][_0xac8d('0x1d')]);return _0x278697(_0x2c296a[_0xac8d('0x1b')][_0xac8d('0x1d')]);}logger[_0xac8d('0x1b')]('WhatsappInteraction,\x20%s,\x20%s',_0x47f4f7,_0x2c296a[_0xac8d('0x1b')]['message']);return _0x536891(_0x2c296a[_0xac8d('0x1b')][_0xac8d('0x1d')]);}else{logger[_0xac8d('0x15')](_0xac8d('0x16'),_0x47f4f7,_0xac8d('0x17'));_0x536891(_0x2c296a[_0xac8d('0x1e')][_0xac8d('0x1d')]);}})[_0xac8d('0x1f')](function(_0x286525){logger[_0xac8d('0x1b')]('WhatsappInteraction,\x20%s,\x20%s',_0x47f4f7,_0x286525);_0x278697(_0x286525);});});}exports['UpdateWhatsappInteraction']=function(_0x5f5a23){var _0x39e86d=this;return new Promise(function(_0x18f10f,_0x1429f2){return db['WhatsappInteraction'][_0xac8d('0x20')](_0x5f5a23[_0xac8d('0x21')],{'raw':_0x5f5a23['options']?_0x5f5a23[_0xac8d('0x22')][_0xac8d('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f5a23['options']?_0x5f5a23['options'][_0xac8d('0x24')]||null:null,'attributes':_0x5f5a23[_0xac8d('0x22')]?_0x5f5a23[_0xac8d('0x22')][_0xac8d('0x25')]||null:null,'limit':_0x5f5a23[_0xac8d('0x22')]?_0x5f5a23[_0xac8d('0x22')][_0xac8d('0x26')]||null:null})[_0xac8d('0x14')](function(_0x2768ab){logger[_0xac8d('0x15')](_0xac8d('0x27'),_0x5f5a23);logger[_0xac8d('0x18')](_0xac8d('0x27'),_0x5f5a23,JSON[_0xac8d('0x1a')](_0x2768ab));_0x18f10f(_0x2768ab);})[_0xac8d('0x1f')](function(_0x4b8d1a){logger['error'](_0xac8d('0x27'),_0x4b8d1a[_0xac8d('0x1d')],_0x5f5a23);_0x1429f2(_0x39e86d[_0xac8d('0x1b')](0x1f4,_0x4b8d1a[_0xac8d('0x1d')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x55c10e){return new Promise(function(_0xaa6e42,_0xccca9e){return db['WhatsappInteraction'][_0xac8d('0x28')]({'where':_0x55c10e[_0xac8d('0x22')]?_0x55c10e['options'][_0xac8d('0x24')]||null:null})[_0xac8d('0x14')](function(_0x96e2bc){if(_0x96e2bc){return _0x96e2bc[_0xac8d('0x29')](_0x55c10e[_0xac8d('0x21')][_0xac8d('0x2a')],_[_0xac8d('0x2b')](_0x55c10e[_0xac8d('0x21')],[_0xac8d('0x2a'),'id'])||{});}})[_0xac8d('0x2c')](function(_0x4617e9){logger['info']('AddTags',_0x55c10e);logger[_0xac8d('0x18')](_0xac8d('0x2d'),_0x55c10e,JSON['stringify'](_0x4617e9));_0xaa6e42(_0x4617e9);})['catch'](function(_0x58fdf1){logger[_0xac8d('0x1b')](_0xac8d('0x2d'),_0x58fdf1[_0xac8d('0x1d')],_0x55c10e);_0xccca9e(_this[_0xac8d('0x1b')](0x1f4,_0x58fdf1[_0xac8d('0x1d')]));});});}; \ No newline at end of file +var _0x1167=['localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToWhatsappInteraction','WhatsappInteraction','find','omit','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x4e65ca,_0x49c33f){var _0x4ad760=function(_0x3541e7){while(--_0x3541e7){_0x4e65ca['push'](_0x4e65ca['shift']());}};_0x4ad760(++_0x49c33f);}(_0x1167,0x196));var _0x7116=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x1167[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x7116('0x0'));var util=require(_0x7116('0x1'));var moment=require(_0x7116('0x2'));var BPromise=require(_0x7116('0x3'));var rs=require(_0x7116('0x4'));var fs=require('fs');var Redis=require(_0x7116('0x5'));var db=require(_0x7116('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7116('0x7'))('rpc');var config=require(_0x7116('0x8'));var jayson=require(_0x7116('0x9'));var client=jayson[_0x7116('0xa')][_0x7116('0xb')]({'port':0x232a});config[_0x7116('0xc')]=_[_0x7116('0xd')](config[_0x7116('0xc')],{'host':_0x7116('0xe'),'port':0x18eb});var socket=require(_0x7116('0xf'))(new Redis(config[_0x7116('0xc')]));require(_0x7116('0x10'))['register'](socket);function respondWithRpcPromise(_0x194867,_0x39843e,_0x5729bb){return new BPromise(function(_0x2514c9,_0x385e86){return client[_0x7116('0x11')](_0x194867,_0x5729bb)[_0x7116('0x12')](function(_0x33bc2d){logger[_0x7116('0x13')](_0x7116('0x14'),_0x39843e,_0x7116('0x15'));logger['debug'](_0x7116('0x16'),_0x39843e,_0x7116('0x15'),JSON[_0x7116('0x17')](_0x33bc2d));if(_0x33bc2d[_0x7116('0x18')]){if(_0x33bc2d['error'][_0x7116('0x19')]===0x1f4){logger[_0x7116('0x18')](_0x7116('0x14'),_0x39843e,_0x33bc2d[_0x7116('0x18')][_0x7116('0x1a')]);return _0x385e86(_0x33bc2d[_0x7116('0x18')][_0x7116('0x1a')]);}logger[_0x7116('0x18')](_0x7116('0x14'),_0x39843e,_0x33bc2d[_0x7116('0x18')][_0x7116('0x1a')]);return _0x2514c9(_0x33bc2d[_0x7116('0x18')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x39843e,_0x7116('0x15'));_0x2514c9(_0x33bc2d['result'][_0x7116('0x1a')]);}})['catch'](function(_0x396944){logger[_0x7116('0x18')](_0x7116('0x14'),_0x39843e,_0x396944);_0x385e86(_0x396944);});});}exports[_0x7116('0x1b')]=function(_0x3f7716){var _0x2ff711=this;return new Promise(function(_0x9f1c5d,_0x38da14){return db['WhatsappInteraction'][_0x7116('0x1c')](_0x3f7716[_0x7116('0x1d')],{'raw':_0x3f7716[_0x7116('0x1e')]?_0x3f7716['options'][_0x7116('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7716[_0x7116('0x1e')]?_0x3f7716[_0x7116('0x1e')][_0x7116('0x20')]||null:null,'attributes':_0x3f7716[_0x7116('0x1e')]?_0x3f7716[_0x7116('0x1e')][_0x7116('0x21')]||null:null,'limit':_0x3f7716[_0x7116('0x1e')]?_0x3f7716['options'][_0x7116('0x22')]||null:null})[_0x7116('0x12')](function(_0x37890a){logger['info'](_0x7116('0x1b'),_0x3f7716);logger[_0x7116('0x23')](_0x7116('0x1b'),_0x3f7716,JSON[_0x7116('0x17')](_0x37890a));_0x9f1c5d(_0x37890a);})['catch'](function(_0x8d710b){logger[_0x7116('0x18')](_0x7116('0x1b'),_0x8d710b[_0x7116('0x1a')],_0x3f7716);_0x38da14(_0x2ff711['error'](0x1f4,_0x8d710b[_0x7116('0x1a')]));});});};exports[_0x7116('0x24')]=function(_0x359fca){return new Promise(function(_0x4de958,_0x68599){return db[_0x7116('0x25')][_0x7116('0x26')]({'where':_0x359fca[_0x7116('0x1e')]?_0x359fca[_0x7116('0x1e')][_0x7116('0x20')]||null:null})['then'](function(_0x2eb195){if(_0x2eb195){return _0x2eb195['addTags'](_0x359fca[_0x7116('0x1d')]['ids'],_[_0x7116('0x27')](_0x359fca[_0x7116('0x1d')],['ids','id'])||{});}})['spread'](function(_0x5076ef){logger[_0x7116('0x13')]('AddTags',_0x359fca);logger['debug'](_0x7116('0x28'),_0x359fca,JSON[_0x7116('0x17')](_0x5076ef));_0x4de958(_0x5076ef);})[_0x7116('0x29')](function(_0x54778c){logger['error']('AddTags',_0x54778c[_0x7116('0x1a')],_0x359fca);_0x68599(_this[_0x7116('0x18')](0x1f4,_0x54778c[_0x7116('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index a8eedf1..c1bc773 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 _0x2318=['whatsappInteraction:','save','update','emit','removeListener','register','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2318,0xfd));var _0x8231=function(_0xc83107,_0x1886c8){_0xc83107=_0xc83107-0x0;var _0x33373a=_0x2318[_0xc83107];return _0x33373a;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x8231('0x0'),'remove',_0x8231('0x1')];function createListener(_0x1aa3e2,_0x22b0d9){return function(_0x3729ce){_0x22b0d9[_0x8231('0x2')](_0x1aa3e2,_0x3729ce);};}function removeListener(_0x225b7c,_0x35371f){return function(){WhatsappInteractionEvents[_0x8231('0x3')](_0x225b7c,_0x35371f);};}exports[_0x8231('0x4')]=function(_0xf60f8a){for(var _0x4c3be1=0x0,_0x4a2f5b=events[_0x8231('0x5')];_0x4c3be1<_0x4a2f5b;_0x4c3be1++){var _0x5bad99=events[_0x4c3be1];var _0x178d12=createListener(_0x8231('0x6')+_0x5bad99,_0xf60f8a);WhatsappInteractionEvents['on'](_0x5bad99,_0x178d12);}}; \ No newline at end of file +var _0x36dd=['emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x36dd,0xcc));var _0xd36d=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x36dd[_0x4b2436];return _0x4f5ab2;};'use strict';var WhatsappInteractionEvents=require(_0xd36d('0x0'));var events=[_0xd36d('0x1'),_0xd36d('0x2'),_0xd36d('0x3')];function createListener(_0x117035,_0x4d7df8){return function(_0x54ac15){_0x4d7df8[_0xd36d('0x4')](_0x117035,_0x54ac15);};}function removeListener(_0x4bf996,_0x5f23a9){return function(){WhatsappInteractionEvents[_0xd36d('0x5')](_0x4bf996,_0x5f23a9);};}exports['register']=function(_0x4bd924){for(var _0x5cee71=0x0,_0x36ed95=events[_0xd36d('0x6')];_0x5cee71<_0x36ed95;_0x5cee71++){var _0x2dc08d=events[_0x5cee71];var _0x5ba15d=createListener(_0xd36d('0x7')+_0x2dc08d,_0x4bd924);WhatsappInteractionEvents['on'](_0x2dc08d,_0x5ba15d);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 06a481f..7a01ca9 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 _0x781f=['reject','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','status','/:id','update','put','/:id/accept','accept'];(function(_0x3b085,_0x250543){var _0x476a57=function(_0x480941){while(--_0x480941){_0x3b085['push'](_0x3b085['shift']());}};_0x476a57(++_0x250543);}(_0x781f,0x189));var _0xf781=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0x781f[_0x25c326];return _0x762452;};'use strict';var multer=require(_0xf781('0x0'));var util=require(_0xf781('0x1'));var path=require(_0xf781('0x2'));var timeout=require('connect-timeout');var express=require(_0xf781('0x3'));var router=express[_0xf781('0x4')]();var fs_extra=require(_0xf781('0x5'));var auth=require(_0xf781('0x6'));var interaction=require(_0xf781('0x7'));var config=require(_0xf781('0x8'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0xf781('0x9')](),controller[_0xf781('0xa')]);router[_0xf781('0xb')](_0xf781('0xc'),auth[_0xf781('0x9')](),controller[_0xf781('0xd')]);router[_0xf781('0xb')]('/:id',auth[_0xf781('0x9')](),controller[_0xf781('0xe')]);router['post']('/',auth[_0xf781('0x9')](),interaction[_0xf781('0xf')](_0xf781('0x10'),_0xf781('0x11')),controller[_0xf781('0x12')]);router[_0xf781('0x13')](_0xf781('0x14'),controller[_0xf781('0x15')]);router['put'](_0xf781('0x16'),auth[_0xf781('0x9')](),controller[_0xf781('0x17')]);router[_0xf781('0x18')](_0xf781('0x19'),auth[_0xf781('0x9')](),controller[_0xf781('0x1a')]);router[_0xf781('0x18')]('/:id/reject',auth['isAuthenticated'](),controller[_0xf781('0x1b')]);router['delete'](_0xf781('0x16'),auth[_0xf781('0x9')](),controller[_0xf781('0x1c')]);module[_0xf781('0x1d')]=router; \ No newline at end of file +var _0x2e57=['create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','/:id','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','post','tracked','whatsapp'];(function(_0x6cb8bd,_0x41c74b){var _0x391aa8=function(_0x1f3204){while(--_0x1f3204){_0x6cb8bd['push'](_0x6cb8bd['shift']());}};_0x391aa8(++_0x41c74b);}(_0x2e57,0x6a));var _0x72e5=function(_0x3b4a85,_0x11e1b4){_0x3b4a85=_0x3b4a85-0x0;var _0x415f4f=_0x2e57[_0x3b4a85];return _0x415f4f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x72e5('0x0'));var timeout=require(_0x72e5('0x1'));var express=require(_0x72e5('0x2'));var router=express[_0x72e5('0x3')]();var fs_extra=require(_0x72e5('0x4'));var auth=require(_0x72e5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x72e5('0x6'));var controller=require(_0x72e5('0x7'));router[_0x72e5('0x8')]('/',auth[_0x72e5('0x9')](),controller['index']);router[_0x72e5('0x8')](_0x72e5('0xa'),auth[_0x72e5('0x9')](),controller['describe']);router[_0x72e5('0x8')]('/:id',auth[_0x72e5('0x9')](),controller['show']);router[_0x72e5('0xb')]('/',auth[_0x72e5('0x9')](),interaction[_0x72e5('0xc')](_0x72e5('0xd'),'whatsappmessage:create'),controller[_0x72e5('0xe')]);router[_0x72e5('0xb')](_0x72e5('0xf'),controller['status']);router[_0x72e5('0x10')]('/:id',auth[_0x72e5('0x9')](),controller[_0x72e5('0x11')]);router[_0x72e5('0x10')](_0x72e5('0x12'),auth[_0x72e5('0x9')](),controller[_0x72e5('0x13')]);router['put'](_0x72e5('0x14'),auth[_0x72e5('0x9')](),controller[_0x72e5('0x15')]);router['delete'](_0x72e5('0x16'),auth['isAuthenticated'](),controller[_0x72e5('0x17')]);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 2ef6261..bdbb401 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 _0xc213=['ENUM','out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc213,0x19b));var _0x3c21=function(_0x2372a7,_0x58ea1c){_0x2372a7=_0x2372a7-0x0;var _0x34a617=_0xc213[_0x2372a7];return _0x34a617;};'use strict';var Sequelize=require(_0x3c21('0x0'));module[_0x3c21('0x1')]={'body':{'type':Sequelize[_0x3c21('0x2')](_0x3c21('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3c21('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3c21('0x5')]('in',_0x3c21('0x6')),'defaultValue':_0x3c21('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3c21('0x7')](0xbe)},'phone':{'type':Sequelize[_0x3c21('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x3c21('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3c21('0x7')]},'providerResponse':{'type':Sequelize[_0x3c21('0x2')]}}; \ No newline at end of file +var _0xede3=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','medium'];(function(_0x471a85,_0x239e8d){var _0x5f2039=function(_0x378952){while(--_0x378952){_0x471a85['push'](_0x471a85['shift']());}};_0x5f2039(++_0x239e8d);}(_0xede3,0xf3));var _0x3ede=function(_0x2290ff,_0x5ec45e){_0x2290ff=_0x2290ff-0x0;var _0xbfcb9f=_0xede3[_0x2290ff];return _0xbfcb9f;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x3ede('0x0')](_0x3ede('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x3ede('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3ede('0x3')]('in',_0x3ede('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x3ede('0x5')](0xbe)},'phone':{'type':Sequelize[_0x3ede('0x5')]},'readAt':{'type':Sequelize[_0x3ede('0x6')]},'secret':{'type':Sequelize[_0x3ede('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3ede('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 51d3335..9676f16 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 _0x4c0f=['to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','client','http','request','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','WhatsappMessage,\x20%s,\x20%s','message','info','catch','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','show','keys','include','find','create','body','params','describe','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','reject','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectmessage','WhatsappAccount','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x4c0f,0x195));var _0xf4c0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4c0f[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0xf4c0('0x0'));var rimraf=require(_0xf4c0('0x1'));var zipdir=require(_0xf4c0('0x2'));var jsonpatch=require(_0xf4c0('0x3'));var rp=require(_0xf4c0('0x4'));var moment=require('moment');var BPromise=require(_0xf4c0('0x5'));var Mustache=require(_0xf4c0('0x6'));var util=require('util');var path=require(_0xf4c0('0x7'));var sox=require(_0xf4c0('0x8'));var csv=require(_0xf4c0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf4c0('0xa'));var _=require('lodash');var squel=require(_0xf4c0('0xb'));var crypto=require(_0xf4c0('0xc'));var jsforce=require(_0xf4c0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf4c0('0x9'));var querystring=require(_0xf4c0('0xe'));var Papa=require(_0xf4c0('0xf'));var Redis=require('ioredis');var authService=require(_0xf4c0('0x10'));var qs=require(_0xf4c0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4c0('0x12'))(_0xf4c0('0x13'));var utils=require(_0xf4c0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf4c0('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf4c0('0x16')](config[_0xf4c0('0x17')],{'host':_0xf4c0('0x18'),'port':0x18eb});var socket=require(_0xf4c0('0x19'))(new Redis(config[_0xf4c0('0x17')]));require('./whatsappMessage.socket')[_0xf4c0('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf4c0('0x1b')][_0xf4c0('0x1c')]({'port':0x232c});var client9002=jayson[_0xf4c0('0x1b')][_0xf4c0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4e1e4f,_0xb6d239,_0x32dc4f,_0xb34f7c){return new BPromise(function(_0x573d8d,_0x40fb8e){var _0x34b33f=_0xb34f7c||client;return _0x34b33f[_0xf4c0('0x1d')](_0x4e1e4f,_0x32dc4f)['then'](function(_0x21f77b){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0xb6d239,_0xf4c0('0x1e'));logger['debug'](_0xf4c0('0x1f'),_0xb6d239,_0xf4c0('0x1e'),JSON['stringify'](_0x21f77b));if(_0x21f77b[_0xf4c0('0x20')]){if(_0x21f77b['error']['code']===0x1f4){logger[_0xf4c0('0x20')](_0xf4c0('0x21'),_0xb6d239,_0x21f77b[_0xf4c0('0x20')]['message']);return _0x40fb8e(_0x21f77b[_0xf4c0('0x20')][_0xf4c0('0x22')]);}logger[_0xf4c0('0x20')](_0xf4c0('0x21'),_0xb6d239,_0x21f77b[_0xf4c0('0x20')][_0xf4c0('0x22')]);return _0x573d8d(_0x21f77b[_0xf4c0('0x20')][_0xf4c0('0x22')]);}else{logger[_0xf4c0('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0xb6d239,_0xf4c0('0x1e'));_0x573d8d(_0x21f77b['result'][_0xf4c0('0x22')]);}})[_0xf4c0('0x24')](function(_0x369fd9){logger[_0xf4c0('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0xb6d239,_0x369fd9);_0x40fb8e(_0x369fd9);});});}function respondWithStatusCode(_0x12c65a,_0x320d00){_0x320d00=_0x320d00||0xcc;return function(_0x4e6343){if(_0x4e6343){return _0x12c65a[_0xf4c0('0x25')](_0x320d00);}return _0x12c65a[_0xf4c0('0x26')](_0x320d00)['end']();};}function respondWithResult(_0x4ce632,_0x4c74c7){_0x4c74c7=_0x4c74c7||0xc8;return function(_0x56b2f3){if(_0x56b2f3){return _0x4ce632[_0xf4c0('0x26')](_0x4c74c7)['json'](_0x56b2f3);}};}function respondWithFilteredResult(_0x4f6d3b,_0x1eef62){return function(_0x5db4e0){if(_0x5db4e0){var _0x214eb0=typeof _0x1eef62[_0xf4c0('0x27')]==='undefined'&&typeof _0x1eef62[_0xf4c0('0x28')]===_0xf4c0('0x29');var _0x2d716f=_0x5db4e0[_0xf4c0('0x2a')];var _0x2138bc=_0x214eb0?0x0:_0x1eef62[_0xf4c0('0x27')];var _0x471ced=_0x214eb0?_0x5db4e0['count']:_0x1eef62[_0xf4c0('0x27')]+_0x1eef62[_0xf4c0('0x28')];var _0xb543c6;if(_0x471ced>=_0x2d716f){_0x471ced=_0x2d716f;_0xb543c6=0xc8;}else{_0xb543c6=0xce;}_0x4f6d3b['status'](_0xb543c6);return _0x4f6d3b[_0xf4c0('0x2b')](_0xf4c0('0x2c'),_0x2138bc+'-'+_0x471ced+'/'+_0x2d716f)['json'](_0x5db4e0);}return null;};}function patchUpdates(_0x68795){return function(_0x5078cb){try{jsonpatch[_0xf4c0('0x2d')](_0x5078cb,_0x68795,!![]);}catch(_0x13cb0a){return BPromise['reject'](_0x13cb0a);}return _0x5078cb[_0xf4c0('0x2e')]();};}function saveUpdates(_0x2238d8,_0x342a40){return function(_0x1e1057){if(_0x1e1057){return _0x1e1057[_0xf4c0('0x2f')](_0x2238d8)[_0xf4c0('0x30')](function(_0x293362){return _0x293362;});}return null;};}function removeEntity(_0x289e19,_0x43de94){return function(_0x507f9c){if(_0x507f9c){return _0x507f9c[_0xf4c0('0x31')]()[_0xf4c0('0x30')](function(){_0x289e19[_0xf4c0('0x26')](0xcc)[_0xf4c0('0x32')]();});}};}function handleEntityNotFound(_0x237cd5,_0x11e124){return function(_0x173181){if(!_0x173181){_0x237cd5['sendStatus'](0x194);}return _0x173181;};}function handleError(_0x257cba,_0x4fb331){_0x4fb331=_0x4fb331||0x1f4;return function(_0x4b5376){logger[_0xf4c0('0x20')](_0x4b5376[_0xf4c0('0x33')]);if(_0x4b5376[_0xf4c0('0x34')]){delete _0x4b5376[_0xf4c0('0x34')];}_0x257cba['status'](_0x4fb331)[_0xf4c0('0x35')](_0x4b5376);};}exports[_0xf4c0('0x36')]=function(_0x518568,_0x5d02ba){var _0x323b0a={},_0x12851a={},_0x92ee84={'count':0x0,'rows':[]};var _0x3dc753=_[_0xf4c0('0x37')](db[_0xf4c0('0x38')][_0xf4c0('0x39')],function(_0x4f80e8){return{'name':_0x4f80e8[_0xf4c0('0x3a')],'type':_0x4f80e8[_0xf4c0('0x3b')][_0xf4c0('0x3c')]};});_0x12851a[_0xf4c0('0x3d')]=_[_0xf4c0('0x37')](_0x3dc753,_0xf4c0('0x34'));_0x12851a[_0xf4c0('0x3e')]=_['keys'](_0x518568[_0xf4c0('0x3e')]);_0x12851a['filters']=_[_0xf4c0('0x3f')](_0x12851a['model'],_0x12851a[_0xf4c0('0x3e')]);_0x323b0a[_0xf4c0('0x40')]=_['intersection'](_0x12851a[_0xf4c0('0x3d')],qs[_0xf4c0('0x41')](_0x518568['query'][_0xf4c0('0x41')]));_0x323b0a['attributes']=_0x323b0a[_0xf4c0('0x40')][_0xf4c0('0x42')]?_0x323b0a[_0xf4c0('0x40')]:_0x12851a[_0xf4c0('0x3d')];if(!_0x518568[_0xf4c0('0x3e')][_0xf4c0('0x43')]('nolimit')){_0x323b0a[_0xf4c0('0x28')]=qs['limit'](_0x518568[_0xf4c0('0x3e')][_0xf4c0('0x28')]);_0x323b0a[_0xf4c0('0x27')]=qs[_0xf4c0('0x27')](_0x518568[_0xf4c0('0x3e')][_0xf4c0('0x27')]);}_0x323b0a[_0xf4c0('0x44')]=qs[_0xf4c0('0x45')](_0x518568['query'][_0xf4c0('0x45')]);_0x323b0a[_0xf4c0('0x46')]=qs[_0xf4c0('0x47')](_[_0xf4c0('0x48')](_0x518568[_0xf4c0('0x3e')],_0x12851a[_0xf4c0('0x47')]),_0x3dc753);if(_0x518568[_0xf4c0('0x3e')][_0xf4c0('0x49')]){_0x323b0a[_0xf4c0('0x46')]=_[_0xf4c0('0x4a')](_0x323b0a['where'],{'$or':_[_0xf4c0('0x37')](_0x3dc753,function(_0x5b8e9f){if(_0x5b8e9f[_0xf4c0('0x3b')]!==_0xf4c0('0x4b')){var _0x295438={};_0x295438[_0x5b8e9f[_0xf4c0('0x34')]]={'$like':'%'+_0x518568[_0xf4c0('0x3e')][_0xf4c0('0x49')]+'%'};return _0x295438;}})});}_0x323b0a=_[_0xf4c0('0x4a')]({},_0x323b0a,_0x518568[_0xf4c0('0x4c')]);var _0x2bc879={'where':_0x323b0a[_0xf4c0('0x46')]};return db[_0xf4c0('0x38')][_0xf4c0('0x2a')](_0x2bc879)[_0xf4c0('0x30')](function(_0x21b215){_0x92ee84['count']=_0x21b215;if(_0x518568[_0xf4c0('0x3e')][_0xf4c0('0x4d')]){_0x323b0a['include']=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x323b0a);})['then'](function(_0x20115d){_0x92ee84['rows']=_0x20115d;return _0x92ee84;})[_0xf4c0('0x30')](respondWithFilteredResult(_0x5d02ba,_0x323b0a))['catch'](handleError(_0x5d02ba,null));};exports[_0xf4c0('0x4e')]=function(_0x2b6875,_0x5e77e3){var _0x352a7c={'raw':!![],'where':{'id':_0x2b6875['params']['id']}},_0x6dff56={};_0x6dff56[_0xf4c0('0x3d')]=_[_0xf4c0('0x4f')](db[_0xf4c0('0x38')][_0xf4c0('0x39')]);_0x6dff56['query']=_['keys'](_0x2b6875[_0xf4c0('0x3e')]);_0x6dff56['filters']=_['intersection'](_0x6dff56[_0xf4c0('0x3d')],_0x6dff56[_0xf4c0('0x3e')]);_0x352a7c[_0xf4c0('0x40')]=_['intersection'](_0x6dff56[_0xf4c0('0x3d')],qs[_0xf4c0('0x41')](_0x2b6875['query'][_0xf4c0('0x41')]));_0x352a7c['attributes']=_0x352a7c[_0xf4c0('0x40')][_0xf4c0('0x42')]?_0x352a7c['attributes']:_0x6dff56[_0xf4c0('0x3d')];if(_0x2b6875[_0xf4c0('0x3e')][_0xf4c0('0x4d')]){_0x352a7c[_0xf4c0('0x50')]=[{'all':!![]}];}_0x352a7c=_['merge']({},_0x352a7c,_0x2b6875[_0xf4c0('0x4c')]);return db['WhatsappMessage'][_0xf4c0('0x51')](_0x352a7c)[_0xf4c0('0x30')](handleEntityNotFound(_0x5e77e3,null))['then'](respondWithResult(_0x5e77e3,null))[_0xf4c0('0x24')](handleError(_0x5e77e3,null));};exports[_0xf4c0('0x52')]=function(_0x2eb232,_0x315b06){return db[_0xf4c0('0x38')][_0xf4c0('0x52')](_0x2eb232[_0xf4c0('0x53')],{})[_0xf4c0('0x30')](respondWithResult(_0x315b06,0xc9))[_0xf4c0('0x24')](handleError(_0x315b06,null));};exports[_0xf4c0('0x2f')]=function(_0x4b38df,_0x46ea4b){if(_0x4b38df[_0xf4c0('0x53')]['id']){delete _0x4b38df[_0xf4c0('0x53')]['id'];}return db[_0xf4c0('0x38')]['find']({'where':{'id':_0x4b38df[_0xf4c0('0x54')]['id']}})[_0xf4c0('0x30')](handleEntityNotFound(_0x46ea4b,null))['then'](saveUpdates(_0x4b38df['body'],null))[_0xf4c0('0x30')](respondWithResult(_0x46ea4b,null))[_0xf4c0('0x24')](handleError(_0x46ea4b,null));};exports[_0xf4c0('0x31')]=function(_0x3821d4,_0x768d24){return db['WhatsappMessage'][_0xf4c0('0x51')]({'where':{'id':_0x3821d4[_0xf4c0('0x54')]['id']}})[_0xf4c0('0x30')](handleEntityNotFound(_0x768d24,null))[_0xf4c0('0x30')](removeEntity(_0x768d24,null))[_0xf4c0('0x24')](handleError(_0x768d24,null));};exports[_0xf4c0('0x55')]=function(_0x57bd6a,_0x2e9452){return db[_0xf4c0('0x38')][_0xf4c0('0x55')]()[_0xf4c0('0x30')](respondWithResult(_0x2e9452,null))[_0xf4c0('0x24')](handleError(_0x2e9452,null));};var interaction_log=require(_0xf4c0('0x12'))('whatsapp-interactions');exports[_0xf4c0('0x56')]=function(_0x2560db,_0x238dd5,_0x16b9e3){var _0x5dfcc2={'agent':{},'channel':_0xf4c0('0x57')};if(_0x2560db[_0xf4c0('0x53')]['id']){delete _0x2560db[_0xf4c0('0x53')]['id'];}_0x2560db[_0xf4c0('0x53')][_0xf4c0('0x58')]=!![];_0x2560db[_0xf4c0('0x53')][_0xf4c0('0x59')]=moment()[_0xf4c0('0x5a')](_0xf4c0('0x5b'));_0x2560db['body']['UserId']=_0x2560db[_0xf4c0('0x53')][_0xf4c0('0x5c')]||_0x2560db[_0xf4c0('0x5d')]['id'];_0x5dfcc2[_0xf4c0('0x5e')]['id']=_0x2560db[_0xf4c0('0x53')][_0xf4c0('0x5c')];return db[_0xf4c0('0x38')]['find']({'where':{'id':_0x2560db[_0xf4c0('0x54')]['id'],'UserId':null}})[_0xf4c0('0x30')](handleEntityNotFound(_0x238dd5,null))[_0xf4c0('0x30')](saveUpdates(_0x2560db[_0xf4c0('0x53')],null))[_0xf4c0('0x30')](function(_0xcc0488){if(_0xcc0488){_0x5dfcc2[_0xf4c0('0x22')]=_0xcc0488[_0xf4c0('0x5f')]({'plain':!![]});return db[_0xf4c0('0x60')][_0xf4c0('0x51')]({'where':{'id':_0xcc0488['WhatsappInteractionId']}});}return null;})[_0xf4c0('0x30')](handleEntityNotFound(_0x238dd5,null))[_0xf4c0('0x30')](function(_0x52ef34){if(_0x52ef34){return _0x52ef34[_0xf4c0('0x2f')]({'UserId':_0x2560db[_0xf4c0('0x53')]['UserId'],'read1stAt':_[_0xf4c0('0x61')](_0x52ef34[_0xf4c0('0x62')])?moment()[_0xf4c0('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf4c0('0x30')](function(_0x1f4ee9){if(_0x1f4ee9){_0x5dfcc2[_0xf4c0('0x63')]=_0x1f4ee9['get']({'plain':!![]});interaction_log[_0xf4c0('0x23')](_0xf4c0('0x64'),_0x2560db[_0xf4c0('0x5d')]['id'],_0x2560db[_0xf4c0('0x5d')][_0xf4c0('0x34')],_0x2560db['user'][_0xf4c0('0x65')],_0x5dfcc2[_0xf4c0('0x63')]['id'],_0x2560db[_0xf4c0('0x53')]?JSON[_0xf4c0('0x66')](_0x2560db[_0xf4c0('0x53')]):_0xf4c0('0x67'));return respondWithRpcPromise(_0xf4c0('0x68'),_0xf4c0('0x69'),_0x5dfcc2);}return null;})[_0xf4c0('0x30')](function(_0x37085b){var _0x3a0107=_0xf4c0('0x6a')+_0x37085b[_0xf4c0('0x22')][_0xf4c0('0x6b')];return db[_0xf4c0('0x6c')]['query'](_0x3a0107,{'type':db[_0xf4c0('0x6d')][_0xf4c0('0x6e')][_0xf4c0('0x6f')],'raw':!![]})[_0xf4c0('0x30')](function(_0x2951a9){return _0x2951a9;});})[_0xf4c0('0x30')](function(_0x3ec1fe){if(_0x3ec1fe){_0x5dfcc2['message'][_0xf4c0('0x70')]=_0x3ec1fe[0x0];if(!_0x2560db['body'][_0xf4c0('0x5c')])return;return db[_0xf4c0('0x71')][_0xf4c0('0x51')]({'where':{'id':_0x2560db[_0xf4c0('0x53')][_0xf4c0('0x5c')],'role':_0xf4c0('0x5e')},'attributes':['id',_0xf4c0('0x34'),_0xf4c0('0x72'),_0xf4c0('0x73'),_0xf4c0('0x74')],'raw':!![]});}return null;})[_0xf4c0('0x30')](function(_0x4da834){if(!_0x4da834)return null;_0x5dfcc2[_0xf4c0('0x22')][_0xf4c0('0x5e')]=_0x4da834;return _0x5dfcc2;})[_0xf4c0('0x30')](function(_0x3a71ba){if(_0x3a71ba){if(_0x2560db['body'][_0xf4c0('0x75')]){_0x5dfcc2[_0xf4c0('0x22')][_0xf4c0('0x76')]=util[_0xf4c0('0x5a')](_0xf4c0('0x77'),_0x2560db[_0xf4c0('0x5d')][_0xf4c0('0x34')]);_0x5dfcc2[_0xf4c0('0x22')]['channel']=_0x5dfcc2[_0xf4c0('0x78')];_0x5dfcc2[_0xf4c0('0x22')][_0xf4c0('0x79')]=_0x5dfcc2['channel'];_0x5dfcc2[_0xf4c0('0x22')][_0xf4c0('0x7a')]='accept';return respondWithRpcPromise(_0xf4c0('0x7b'),'EventManager',{'event':_0xf4c0('0x7c'),'message':_0x5dfcc2[_0xf4c0('0x22')]},client9002)[_0xf4c0('0x30')](function(){return _0x5dfcc2;});}return _0x5dfcc2;}return null;})['then'](respondWithResult(_0x238dd5,null))[_0xf4c0('0x24')](handleError(_0x238dd5,null));};var interaction_log=require('../../config/logger')(_0xf4c0('0x7d'));exports[_0xf4c0('0x7e')]=function(_0x296aca,_0x4b48fd,_0x2ba31c){var _0x2c0948={'agent':{},'channel':_0xf4c0('0x57')};if(_0x296aca[_0xf4c0('0x53')]['id']){delete _0x296aca[_0xf4c0('0x53')]['id'];}_0x296aca[_0xf4c0('0x53')][_0xf4c0('0x5c')]=_0x296aca[_0xf4c0('0x53')][_0xf4c0('0x5c')]||_0x296aca[_0xf4c0('0x5d')]['id'];_0x2c0948['agent']['id']=_0x296aca[_0xf4c0('0x53')][_0xf4c0('0x5c')];return db[_0xf4c0('0x38')][_0xf4c0('0x51')]({'where':{'id':_0x296aca[_0xf4c0('0x54')]['id'],'UserId':null}})[_0xf4c0('0x30')](handleEntityNotFound(_0x4b48fd,null))[_0xf4c0('0x30')](function(_0x1493de){if(_0x1493de){_0x2c0948[_0xf4c0('0x22')]=_0x1493de[_0xf4c0('0x5f')]({'plain':!![]});return db[_0xf4c0('0x60')][_0xf4c0('0x51')]({'where':{'id':_0x1493de[_0xf4c0('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x4b48fd,null))[_0xf4c0('0x30')](function(_0x492109){if(_0x492109){_0x2c0948[_0xf4c0('0x63')]=_0x492109[_0xf4c0('0x5f')]({'plain':!![]});interaction_log['info'](_0xf4c0('0x80'),_0x296aca[_0xf4c0('0x5d')]['id'],_0x296aca[_0xf4c0('0x5d')][_0xf4c0('0x34')],_0x296aca[_0xf4c0('0x5d')][_0xf4c0('0x65')],_0x2c0948[_0xf4c0('0x63')]['id'],_0x296aca[_0xf4c0('0x53')]?JSON[_0xf4c0('0x66')](_0x296aca[_0xf4c0('0x53')]):_0xf4c0('0x67'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x2c0948);}return null;})[_0xf4c0('0x30')](function(_0x7405e1){var _0x101ae0=_0xf4c0('0x6a')+_0x7405e1['message'][_0xf4c0('0x6b')];return db['sequelize'][_0xf4c0('0x3e')](_0x101ae0,{'type':db[_0xf4c0('0x6d')][_0xf4c0('0x6e')][_0xf4c0('0x6f')],'raw':!![]})[_0xf4c0('0x30')](function(_0x16a62b){return _0x16a62b;});})['then'](function(_0x1e3fda){if(_0x1e3fda){_0x2c0948[_0xf4c0('0x22')][_0xf4c0('0x70')]=_0x1e3fda[0x0];if(!_0x296aca[_0xf4c0('0x53')][_0xf4c0('0x5c')])return;return db[_0xf4c0('0x71')][_0xf4c0('0x51')]({'where':{'id':_0x296aca[_0xf4c0('0x53')][_0xf4c0('0x5c')],'role':'agent'},'attributes':['id',_0xf4c0('0x34'),_0xf4c0('0x72'),_0xf4c0('0x73'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1d76cb){if(!_0x1d76cb)return null;_0x2c0948[_0xf4c0('0x22')][_0xf4c0('0x5e')]=_0x1d76cb;return _0x2c0948;})['then'](function(_0x299f09){if(_0x299f09){_0x299f09['message'][_0xf4c0('0x76')]=util[_0xf4c0('0x5a')](_0xf4c0('0x77'),_0x296aca[_0xf4c0('0x5d')][_0xf4c0('0x34')]);_0x299f09[_0xf4c0('0x22')][_0xf4c0('0x78')]=_0x2c0948[_0xf4c0('0x78')];_0x299f09[_0xf4c0('0x22')][_0xf4c0('0x79')]=_0x2c0948[_0xf4c0('0x78')];_0x299f09[_0xf4c0('0x22')]['event']='reject';respondWithRpcPromise(_0xf4c0('0x7b'),_0xf4c0('0x7b'),{'event':_0xf4c0('0x81'),'message':_0x299f09[_0xf4c0('0x22')]},client9002);return _0x2c0948;}return null;})[_0xf4c0('0x30')](respondWithResult(_0x4b48fd,null))[_0xf4c0('0x24')](handleError(_0x4b48fd,null));};exports[_0xf4c0('0x26')]=function(_0x56fee0,_0x2a7a72,_0x4eee14){if(_0x56fee0[_0xf4c0('0x53')]['id']){delete _0x56fee0[_0xf4c0('0x53')]['id'];}var _0xf3e284;return db[_0xf4c0('0x38')]['find']({'where':{'id':_0x56fee0[_0xf4c0('0x54')]['id']}})[_0xf4c0('0x30')](handleEntityNotFound(_0x2a7a72,null))[_0xf4c0('0x30')](function(_0x3cbd30){if(_0x3cbd30){_0xf3e284=_0x3cbd30;return db[_0xf4c0('0x82')]['find']({'where':{'id':_0x3cbd30['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x2a7a72,null))[_0xf4c0('0x30')](function(_0x249831){if(_0x249831){logger[_0xf4c0('0x83')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xf4c0('0x26'),_0xf4c0('0x84'),_0x249831[_0xf4c0('0x3b')],util[_0xf4c0('0x85')](_0x56fee0['body'],{'showHidden':![],'depth':null}));switch(_0x249831[_0xf4c0('0x3b')]){case _0xf4c0('0x86'):if(_0x56fee0[_0xf4c0('0x53')][_0xf4c0('0x87')]&&_0x56fee0[_0xf4c0('0x53')][_0xf4c0('0x87')]===_0xf3e284[_0xf4c0('0x88')]&&_0x56fee0[_0xf4c0('0x53')][_0xf4c0('0x89')]&&_0x56fee0['body']['MessageStatus']==='read'){return _0xf3e284[_0xf4c0('0x2f')]({'read':!![]});}else{logger[_0xf4c0('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0xf4c0('0x86'),util[_0xf4c0('0x85')](_0x56fee0[_0xf4c0('0x53')],{'showHidden':![],'depth':null}));}break;}return _0xf3e284;}})[_0xf4c0('0x30')](respondWithResult(_0x2a7a72,null))[_0xf4c0('0x24')](handleError(_0x2a7a72,null));}; \ No newline at end of file +var _0x2288=['acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','WhatsappInteraction','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','internal','motionChannel','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','zip-dir','fast-json-patch','request-promise','moment','mustache','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','../../mysqldb','redis','defaults','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','include','findAll','rows','show','includeAll','create','body','find','params','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteractionId','isNil','read1stAt','format','interaction','user','role','AcceptMessage'];(function(_0x486436,_0x210872){var _0x7214af=function(_0x3250eb){while(--_0x3250eb){_0x486436['push'](_0x486436['shift']());}};_0x7214af(++_0x210872);}(_0x2288,0xab));var _0x8228=function(_0x2a05d0,_0x275681){_0x2a05d0=_0x2a05d0-0x0;var _0x54fe1a=_0x2288[_0x2a05d0];return _0x54fe1a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8228('0x0'));var jsonpatch=require(_0x8228('0x1'));var rp=require(_0x8228('0x2'));var moment=require(_0x8228('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8228('0x4'));var util=require('util');var path=require('path');var sox=require(_0x8228('0x5'));var csv=require(_0x8228('0x6'));var ejs=require(_0x8228('0x7'));var fs=require('fs');var fs_extra=require(_0x8228('0x8'));var _=require(_0x8228('0x9'));var squel=require(_0x8228('0xa'));var crypto=require('crypto');var jsforce=require(_0x8228('0xb'));var deskjs=require(_0x8228('0xc'));var toCsv=require(_0x8228('0x6'));var querystring=require(_0x8228('0xd'));var Papa=require(_0x8228('0xe'));var Redis=require(_0x8228('0xf'));var authService=require(_0x8228('0x10'));var qs=require(_0x8228('0x11'));var as=require(_0x8228('0x12'));var hardwareService=require(_0x8228('0x13'));var logger=require(_0x8228('0x14'))('api');var utils=require(_0x8228('0x15'));var config=require(_0x8228('0x16'));var licenseUtil=require(_0x8228('0x17'));var db=require(_0x8228('0x18'))['db'];config[_0x8228('0x19')]=_[_0x8228('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8228('0x1b'))[_0x8228('0x1c')](socket);var jayson=require(_0x8228('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x8228('0x1e')][_0x8228('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x26d415,_0x216347,_0x4da50d,_0x3eab98){return new BPromise(function(_0x5197eb,_0x118096){var _0x42fb59=_0x3eab98||client;return _0x42fb59['request'](_0x26d415,_0x4da50d)[_0x8228('0x20')](function(_0x4575f9){logger[_0x8228('0x21')](_0x8228('0x22'),_0x216347,_0x8228('0x23'));logger['debug'](_0x8228('0x24'),_0x216347,'request\x20sent',JSON[_0x8228('0x25')](_0x4575f9));if(_0x4575f9[_0x8228('0x26')]){if(_0x4575f9[_0x8228('0x26')][_0x8228('0x27')]===0x1f4){logger[_0x8228('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x216347,_0x4575f9[_0x8228('0x26')][_0x8228('0x28')]);return _0x118096(_0x4575f9[_0x8228('0x26')]['message']);}logger['error'](_0x8228('0x22'),_0x216347,_0x4575f9[_0x8228('0x26')]['message']);return _0x5197eb(_0x4575f9[_0x8228('0x26')][_0x8228('0x28')]);}else{logger[_0x8228('0x21')](_0x8228('0x22'),_0x216347,_0x8228('0x23'));_0x5197eb(_0x4575f9[_0x8228('0x29')][_0x8228('0x28')]);}})[_0x8228('0x2a')](function(_0x1a9c03){logger[_0x8228('0x26')](_0x8228('0x22'),_0x216347,_0x1a9c03);_0x118096(_0x1a9c03);});});}function respondWithStatusCode(_0x3b70d4,_0x44b93f){_0x44b93f=_0x44b93f||0xcc;return function(_0x576010){if(_0x576010){return _0x3b70d4[_0x8228('0x2b')](_0x44b93f);}return _0x3b70d4[_0x8228('0x2c')](_0x44b93f)[_0x8228('0x2d')]();};}function respondWithResult(_0x5555ad,_0x3ec863){_0x3ec863=_0x3ec863||0xc8;return function(_0x47d8e9){if(_0x47d8e9){return _0x5555ad['status'](_0x3ec863)[_0x8228('0x2e')](_0x47d8e9);}};}function respondWithFilteredResult(_0x3c0d63,_0x1f2d39){return function(_0x16b6cb){if(_0x16b6cb){var _0x527c5c=typeof _0x1f2d39[_0x8228('0x2f')]===_0x8228('0x30')&&typeof _0x1f2d39[_0x8228('0x31')]==='undefined';var _0x31f7b8=_0x16b6cb[_0x8228('0x32')];var _0x512240=_0x527c5c?0x0:_0x1f2d39['offset'];var _0x4a249d=_0x527c5c?_0x16b6cb[_0x8228('0x32')]:_0x1f2d39[_0x8228('0x2f')]+_0x1f2d39[_0x8228('0x31')];var _0x2e4542;if(_0x4a249d>=_0x31f7b8){_0x4a249d=_0x31f7b8;_0x2e4542=0xc8;}else{_0x2e4542=0xce;}_0x3c0d63['status'](_0x2e4542);return _0x3c0d63[_0x8228('0x33')](_0x8228('0x34'),_0x512240+'-'+_0x4a249d+'/'+_0x31f7b8)[_0x8228('0x2e')](_0x16b6cb);}return null;};}function patchUpdates(_0x3380e3){return function(_0x335b40){try{jsonpatch[_0x8228('0x35')](_0x335b40,_0x3380e3,!![]);}catch(_0x573b40){return BPromise[_0x8228('0x36')](_0x573b40);}return _0x335b40[_0x8228('0x37')]();};}function saveUpdates(_0x1050be,_0x183da5){return function(_0x27f558){if(_0x27f558){return _0x27f558[_0x8228('0x38')](_0x1050be)[_0x8228('0x20')](function(_0x51d2a1){return _0x51d2a1;});}return null;};}function removeEntity(_0x557826,_0x5e85ec){return function(_0x4e6ce3){if(_0x4e6ce3){return _0x4e6ce3[_0x8228('0x39')]()['then'](function(){_0x557826[_0x8228('0x2c')](0xcc)[_0x8228('0x2d')]();});}};}function handleEntityNotFound(_0x38829a,_0x274544){return function(_0x4a8060){if(!_0x4a8060){_0x38829a[_0x8228('0x2b')](0x194);}return _0x4a8060;};}function handleError(_0xd4691e,_0x3622af){_0x3622af=_0x3622af||0x1f4;return function(_0x468b90){logger['error'](_0x468b90[_0x8228('0x3a')]);if(_0x468b90[_0x8228('0x3b')]){delete _0x468b90[_0x8228('0x3b')];}_0xd4691e[_0x8228('0x2c')](_0x3622af)[_0x8228('0x3c')](_0x468b90);};}exports['index']=function(_0x2ffd4f,_0xe20f79){var _0x1bb8ee={},_0x3f7544={},_0xf6dc44={'count':0x0,'rows':[]};var _0x1770d8=_[_0x8228('0x3d')](db[_0x8228('0x3e')][_0x8228('0x3f')],function(_0x22e1fd){return{'name':_0x22e1fd[_0x8228('0x40')],'type':_0x22e1fd[_0x8228('0x41')][_0x8228('0x42')]};});_0x3f7544[_0x8228('0x43')]=_['map'](_0x1770d8,_0x8228('0x3b'));_0x3f7544[_0x8228('0x44')]=_[_0x8228('0x45')](_0x2ffd4f[_0x8228('0x44')]);_0x3f7544[_0x8228('0x46')]=_[_0x8228('0x47')](_0x3f7544[_0x8228('0x43')],_0x3f7544[_0x8228('0x44')]);_0x1bb8ee[_0x8228('0x48')]=_['intersection'](_0x3f7544[_0x8228('0x43')],qs['fields'](_0x2ffd4f[_0x8228('0x44')][_0x8228('0x49')]));_0x1bb8ee[_0x8228('0x48')]=_0x1bb8ee['attributes'][_0x8228('0x4a')]?_0x1bb8ee['attributes']:_0x3f7544[_0x8228('0x43')];if(!_0x2ffd4f[_0x8228('0x44')][_0x8228('0x4b')](_0x8228('0x4c'))){_0x1bb8ee[_0x8228('0x31')]=qs[_0x8228('0x31')](_0x2ffd4f[_0x8228('0x44')][_0x8228('0x31')]);_0x1bb8ee['offset']=qs[_0x8228('0x2f')](_0x2ffd4f['query'][_0x8228('0x2f')]);}_0x1bb8ee['order']=qs['sort'](_0x2ffd4f[_0x8228('0x44')]['sort']);_0x1bb8ee[_0x8228('0x4d')]=qs[_0x8228('0x46')](_[_0x8228('0x4e')](_0x2ffd4f[_0x8228('0x44')],_0x3f7544[_0x8228('0x46')]),_0x1770d8);if(_0x2ffd4f[_0x8228('0x44')][_0x8228('0x4f')]){_0x1bb8ee[_0x8228('0x4d')]=_[_0x8228('0x50')](_0x1bb8ee[_0x8228('0x4d')],{'$or':_[_0x8228('0x3d')](_0x1770d8,function(_0x3b5bad){if(_0x3b5bad['type']!=='VIRTUAL'){var _0x3a19fd={};_0x3a19fd[_0x3b5bad[_0x8228('0x3b')]]={'$like':'%'+_0x2ffd4f[_0x8228('0x44')]['filter']+'%'};return _0x3a19fd;}})});}_0x1bb8ee=_[_0x8228('0x50')]({},_0x1bb8ee,_0x2ffd4f[_0x8228('0x51')]);var _0x401b5d={'where':_0x1bb8ee[_0x8228('0x4d')]};return db[_0x8228('0x3e')][_0x8228('0x32')](_0x401b5d)['then'](function(_0xf7f7b7){_0xf6dc44[_0x8228('0x32')]=_0xf7f7b7;if(_0x2ffd4f[_0x8228('0x44')]['includeAll']){_0x1bb8ee[_0x8228('0x52')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x8228('0x53')](_0x1bb8ee);})[_0x8228('0x20')](function(_0x1b831b){_0xf6dc44[_0x8228('0x54')]=_0x1b831b;return _0xf6dc44;})[_0x8228('0x20')](respondWithFilteredResult(_0xe20f79,_0x1bb8ee))[_0x8228('0x2a')](handleError(_0xe20f79,null));};exports[_0x8228('0x55')]=function(_0x51c077,_0x2086ef){var _0x5ac157={'raw':!![],'where':{'id':_0x51c077['params']['id']}},_0x2ff785={};_0x2ff785[_0x8228('0x43')]=_[_0x8228('0x45')](db[_0x8228('0x3e')][_0x8228('0x3f')]);_0x2ff785[_0x8228('0x44')]=_['keys'](_0x51c077[_0x8228('0x44')]);_0x2ff785[_0x8228('0x46')]=_['intersection'](_0x2ff785[_0x8228('0x43')],_0x2ff785['query']);_0x5ac157['attributes']=_['intersection'](_0x2ff785[_0x8228('0x43')],qs[_0x8228('0x49')](_0x51c077[_0x8228('0x44')]['fields']));_0x5ac157['attributes']=_0x5ac157['attributes']['length']?_0x5ac157[_0x8228('0x48')]:_0x2ff785['model'];if(_0x51c077[_0x8228('0x44')][_0x8228('0x56')]){_0x5ac157[_0x8228('0x52')]=[{'all':!![]}];}_0x5ac157=_[_0x8228('0x50')]({},_0x5ac157,_0x51c077[_0x8228('0x51')]);return db[_0x8228('0x3e')]['find'](_0x5ac157)[_0x8228('0x20')](handleEntityNotFound(_0x2086ef,null))['then'](respondWithResult(_0x2086ef,null))['catch'](handleError(_0x2086ef,null));};exports['create']=function(_0x5172c2,_0xcb6375){return db['WhatsappMessage'][_0x8228('0x57')](_0x5172c2['body'],{})['then'](respondWithResult(_0xcb6375,0xc9))[_0x8228('0x2a')](handleError(_0xcb6375,null));};exports[_0x8228('0x38')]=function(_0x11c94,_0x141a95){if(_0x11c94[_0x8228('0x58')]['id']){delete _0x11c94[_0x8228('0x58')]['id'];}return db[_0x8228('0x3e')][_0x8228('0x59')]({'where':{'id':_0x11c94[_0x8228('0x5a')]['id']}})[_0x8228('0x20')](handleEntityNotFound(_0x141a95,null))['then'](saveUpdates(_0x11c94['body'],null))[_0x8228('0x20')](respondWithResult(_0x141a95,null))['catch'](handleError(_0x141a95,null));};exports[_0x8228('0x39')]=function(_0x36261f,_0x5cdc41){return db[_0x8228('0x3e')][_0x8228('0x59')]({'where':{'id':_0x36261f[_0x8228('0x5a')]['id']}})[_0x8228('0x20')](handleEntityNotFound(_0x5cdc41,null))[_0x8228('0x20')](removeEntity(_0x5cdc41,null))[_0x8228('0x2a')](handleError(_0x5cdc41,null));};exports[_0x8228('0x5b')]=function(_0x2a37ce,_0xd35959){return db[_0x8228('0x3e')][_0x8228('0x5b')]()['then'](respondWithResult(_0xd35959,null))[_0x8228('0x2a')](handleError(_0xd35959,null));};var interaction_log=require(_0x8228('0x14'))(_0x8228('0x5c'));exports[_0x8228('0x5d')]=function(_0x43376f,_0x246129,_0x394f7c){var _0x3d16b1={'agent':{},'channel':_0x8228('0x5e')};if(_0x43376f['body']['id']){delete _0x43376f[_0x8228('0x58')]['id'];}_0x43376f[_0x8228('0x58')][_0x8228('0x5f')]=!![];_0x43376f[_0x8228('0x58')][_0x8228('0x60')]=moment()['format'](_0x8228('0x61'));_0x43376f[_0x8228('0x58')][_0x8228('0x62')]=_0x43376f['body'][_0x8228('0x62')]||_0x43376f['user']['id'];_0x3d16b1[_0x8228('0x63')]['id']=_0x43376f[_0x8228('0x58')]['UserId'];return db[_0x8228('0x3e')][_0x8228('0x59')]({'where':{'id':_0x43376f['params']['id'],'UserId':null}})[_0x8228('0x20')](handleEntityNotFound(_0x246129,null))[_0x8228('0x20')](saveUpdates(_0x43376f[_0x8228('0x58')],null))[_0x8228('0x20')](function(_0x4ed99e){if(_0x4ed99e){_0x3d16b1[_0x8228('0x28')]=_0x4ed99e[_0x8228('0x64')]({'plain':!![]});return db['WhatsappInteraction'][_0x8228('0x59')]({'where':{'id':_0x4ed99e[_0x8228('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x246129,null))['then'](function(_0xd07c){if(_0xd07c){return _0xd07c[_0x8228('0x38')]({'UserId':_0x43376f[_0x8228('0x58')][_0x8228('0x62')],'read1stAt':_[_0x8228('0x66')](_0xd07c[_0x8228('0x67')])?moment()[_0x8228('0x68')](_0x8228('0x61')):undefined});}return null;})['then'](function(_0x3ed481){if(_0x3ed481){_0x3d16b1[_0x8228('0x69')]=_0x3ed481[_0x8228('0x64')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x43376f['user']['id'],_0x43376f['user'][_0x8228('0x3b')],_0x43376f[_0x8228('0x6a')][_0x8228('0x6b')],_0x3d16b1[_0x8228('0x69')]['id'],_0x43376f[_0x8228('0x58')]?JSON[_0x8228('0x25')](_0x43376f[_0x8228('0x58')]):'null');return respondWithRpcPromise(_0x8228('0x6c'),_0x8228('0x6d'),_0x3d16b1);}return null;})['then'](function(_0x172a80){var _0x4d6331='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x172a80[_0x8228('0x28')][_0x8228('0x6e')];return db[_0x8228('0x6f')][_0x8228('0x44')](_0x4d6331,{'type':db[_0x8228('0x70')][_0x8228('0x71')][_0x8228('0x72')],'raw':!![]})[_0x8228('0x20')](function(_0x56634d){return _0x56634d;});})['then'](function(_0x253ae4){if(_0x253ae4){_0x3d16b1['message'][_0x8228('0x73')]=_0x253ae4[0x0];if(!_0x43376f[_0x8228('0x58')][_0x8228('0x62')])return;return db[_0x8228('0x74')][_0x8228('0x59')]({'where':{'id':_0x43376f[_0x8228('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0x8228('0x3b'),_0x8228('0x75'),_0x8228('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x56f8c5){if(!_0x56f8c5)return null;_0x3d16b1[_0x8228('0x28')][_0x8228('0x63')]=_0x56f8c5;return _0x3d16b1;})['then'](function(_0x30341f){if(_0x30341f){if(_0x43376f[_0x8228('0x58')][_0x8228('0x77')]){_0x3d16b1[_0x8228('0x28')][_0x8228('0x78')]=util['format'](_0x8228('0x79'),_0x43376f[_0x8228('0x6a')][_0x8228('0x3b')]);_0x3d16b1[_0x8228('0x28')][_0x8228('0x7a')]=_0x3d16b1[_0x8228('0x7a')];_0x3d16b1[_0x8228('0x28')]['motionChannel']=_0x3d16b1[_0x8228('0x7a')];_0x3d16b1['message'][_0x8228('0x7b')]=_0x8228('0x5d');return respondWithRpcPromise('EventManager',_0x8228('0x7c'),{'event':_0x8228('0x7d'),'message':_0x3d16b1[_0x8228('0x28')]},client9002)['then'](function(){return _0x3d16b1;});}return _0x3d16b1;}return null;})[_0x8228('0x20')](respondWithResult(_0x246129,null))[_0x8228('0x2a')](handleError(_0x246129,null));};var interaction_log=require(_0x8228('0x14'))('whatsapp-interactions');exports[_0x8228('0x36')]=function(_0x2d1b88,_0x66c19,_0x1d3963){var _0xaa0f29={'agent':{},'channel':_0x8228('0x5e')};if(_0x2d1b88[_0x8228('0x58')]['id']){delete _0x2d1b88[_0x8228('0x58')]['id'];}_0x2d1b88[_0x8228('0x58')][_0x8228('0x62')]=_0x2d1b88[_0x8228('0x58')]['UserId']||_0x2d1b88[_0x8228('0x6a')]['id'];_0xaa0f29[_0x8228('0x63')]['id']=_0x2d1b88[_0x8228('0x58')][_0x8228('0x62')];return db[_0x8228('0x3e')]['find']({'where':{'id':_0x2d1b88[_0x8228('0x5a')]['id'],'UserId':null}})[_0x8228('0x20')](handleEntityNotFound(_0x66c19,null))[_0x8228('0x20')](function(_0x3d3577){if(_0x3d3577){_0xaa0f29[_0x8228('0x28')]=_0x3d3577['get']({'plain':!![]});return db[_0x8228('0x7e')][_0x8228('0x59')]({'where':{'id':_0x3d3577[_0x8228('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x66c19,null))[_0x8228('0x20')](function(_0x409ff4){if(_0x409ff4){_0xaa0f29[_0x8228('0x69')]=_0x409ff4['get']({'plain':!![]});interaction_log[_0x8228('0x21')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2d1b88['user']['id'],_0x2d1b88[_0x8228('0x6a')][_0x8228('0x3b')],_0x2d1b88[_0x8228('0x6a')][_0x8228('0x6b')],_0xaa0f29[_0x8228('0x69')]['id'],_0x2d1b88[_0x8228('0x58')]?JSON[_0x8228('0x25')](_0x2d1b88[_0x8228('0x58')]):_0x8228('0x7f'));return respondWithRpcPromise(_0x8228('0x80'),'rejectMessage',_0xaa0f29);}return null;})[_0x8228('0x20')](function(_0x3cdcd9){var _0x283d19=_0x8228('0x81')+_0x3cdcd9[_0x8228('0x28')][_0x8228('0x6e')];return db[_0x8228('0x6f')][_0x8228('0x44')](_0x283d19,{'type':db[_0x8228('0x70')][_0x8228('0x71')]['SELECT'],'raw':!![]})['then'](function(_0x1e501f){return _0x1e501f;});})[_0x8228('0x20')](function(_0x5440c9){if(_0x5440c9){_0xaa0f29[_0x8228('0x28')][_0x8228('0x73')]=_0x5440c9[0x0];if(!_0x2d1b88[_0x8228('0x58')][_0x8228('0x62')])return;return db['User'][_0x8228('0x59')]({'where':{'id':_0x2d1b88[_0x8228('0x58')]['UserId'],'role':_0x8228('0x63')},'attributes':['id','name',_0x8228('0x75'),'email',_0x8228('0x82')],'raw':!![]});}return null;})[_0x8228('0x20')](function(_0x22b762){if(!_0x22b762)return null;_0xaa0f29[_0x8228('0x28')]['agent']=_0x22b762;return _0xaa0f29;})['then'](function(_0x1abb2c){if(_0x1abb2c){_0x1abb2c[_0x8228('0x28')]['interface']=util[_0x8228('0x68')](_0x8228('0x79'),_0x2d1b88[_0x8228('0x6a')][_0x8228('0x3b')]);_0x1abb2c[_0x8228('0x28')][_0x8228('0x7a')]=_0xaa0f29[_0x8228('0x7a')];_0x1abb2c[_0x8228('0x28')][_0x8228('0x83')]=_0xaa0f29[_0x8228('0x7a')];_0x1abb2c[_0x8228('0x28')]['event']=_0x8228('0x36');respondWithRpcPromise('EventManager',_0x8228('0x7c'),{'event':'rejectmessage','message':_0x1abb2c[_0x8228('0x28')]},client9002);return _0xaa0f29;}return null;})[_0x8228('0x20')](respondWithResult(_0x66c19,null))[_0x8228('0x2a')](handleError(_0x66c19,null));};exports[_0x8228('0x2c')]=function(_0x23e95e,_0x2714c9,_0x5c9906){if(_0x23e95e[_0x8228('0x58')]['id']){delete _0x23e95e[_0x8228('0x58')]['id'];}var _0x1a3b8b;return db[_0x8228('0x3e')][_0x8228('0x59')]({'where':{'id':_0x23e95e[_0x8228('0x5a')]['id']}})[_0x8228('0x20')](handleEntityNotFound(_0x2714c9,null))[_0x8228('0x20')](function(_0x5f43b4){if(_0x5f43b4){_0x1a3b8b=_0x5f43b4;return db['WhatsappAccount'][_0x8228('0x59')]({'where':{'id':_0x5f43b4[_0x8228('0x84')]}});}})[_0x8228('0x20')](handleEntityNotFound(_0x2714c9,null))[_0x8228('0x20')](function(_0x5b1906){if(_0x5b1906){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x8228('0x2c'),_0x8228('0x85'),_0x5b1906[_0x8228('0x41')],util[_0x8228('0x86')](_0x23e95e['body'],{'showHidden':![],'depth':null}));switch(_0x5b1906[_0x8228('0x41')]){case _0x8228('0x87'):if(_0x23e95e[_0x8228('0x58')][_0x8228('0x88')]&&_0x23e95e[_0x8228('0x58')][_0x8228('0x88')]===_0x1a3b8b[_0x8228('0x89')]&&_0x23e95e['body'][_0x8228('0x8a')]&&_0x23e95e[_0x8228('0x58')][_0x8228('0x8a')]===_0x8228('0x5f')){return _0x1a3b8b[_0x8228('0x38')]({'read':!![]});}else{logger[_0x8228('0x26')](_0x8228('0x8b'),'status','twilio',util[_0x8228('0x86')](_0x23e95e[_0x8228('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x1a3b8b;}})['then'](respondWithResult(_0x2714c9,null))[_0x8228('0x2a')](handleError(_0x2714c9,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 8d9bfca..ad213b7 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 _0x06ef=['emit','WhatsappMessage'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x06ef,0x185));var _0xf06e=function(_0x32c04b,_0x187085){_0x32c04b=_0x32c04b-0x0;var _0x2947b1=_0x06ef[_0x32c04b];return _0x2947b1;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0xf06e('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x404485){return function(_0x1281ca,_0x16d4da,_0x569390){WhatsappMessageEvents[_0xf06e('0x1')](_0x404485+':'+_0x1281ca['id'],_0x1281ca);WhatsappMessageEvents[_0xf06e('0x1')](_0x404485,_0x1281ca);_0x569390(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xd4f4=['update','remove','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xd4f4,0x8b));var _0x4d4f=function(_0xbd10a7,_0x51c6b3){_0xbd10a7=_0xbd10a7-0x0;var _0x5ede49=_0xd4f4[_0xbd10a7];return _0x5ede49;};'use strict';var EventEmitter=require(_0x4d4f('0x0'));var WhatsappMessage=require(_0x4d4f('0x1'))['db'][_0x4d4f('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4d4f('0x3')](0x0);var events={'afterCreate':_0x4d4f('0x4'),'afterUpdate':_0x4d4f('0x5'),'afterDestroy':_0x4d4f('0x6')};function emitEvent(_0x2c43da){return function(_0x25087a,_0xa53cb8,_0x15585){WhatsappMessageEvents['emit'](_0x2c43da+':'+_0x25087a['id'],_0x25087a);WhatsappMessageEvents['emit'](_0x2c43da,_0x25087a);_0x15585(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x4d4f('0x7')](e,emitEvent(event));}}module[_0x4d4f('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 58678a0..4ddd84f 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 _0x8cd9=['messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','exports','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','toLowerCase','catch','error','secret','WhatsappAccount','find','type','twilio','authToken','phone'];(function(_0x3d3d7b,_0x5c0937){var _0x33e7c8=function(_0xe0ee81){while(--_0xe0ee81){_0x3d3d7b['push'](_0x3d3d7b['shift']());}};_0x33e7c8(++_0x5c0937);}(_0x8cd9,0x186));var _0x98cd=function(_0x14d6a7,_0x2c00d8){_0x14d6a7=_0x14d6a7-0x0;var _0x401e93=_0x8cd9[_0x14d6a7];return _0x401e93;};'use strict';var _=require(_0x98cd('0x0'));var util=require(_0x98cd('0x1'));var logger=require(_0x98cd('0x2'))(_0x98cd('0x3'));var moment=require(_0x98cd('0x4'));var BPromise=require(_0x98cd('0x5'));var rp=require(_0x98cd('0x6'));var fetch=require(_0x98cd('0x7'));var fs=require('fs');var path=require(_0x98cd('0x8'));var rimraf=require(_0x98cd('0x9'));var config=require(_0x98cd('0xa'));var attributes=require('./whatsappMessage.attributes');module[_0x98cd('0xb')]=function(_0x59e346,_0x386ab8){return _0x59e346['define']('WhatsappMessage',attributes,{'tableName':_0x98cd('0xc'),'paranoid':![],'indexes':[{'name':_0x98cd('0xd'),'fields':[_0x98cd('0xd')]},{'name':_0x98cd('0xe'),'fields':[_0x98cd('0xf')],'type':_0x98cd('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x14f5bb,_0x4bc74b,_0x2244f8){var _0x124102=_0x59e346['models'];var _0x14bdc7=_0x14f5bb[_0x98cd('0x11')]({'plain':!![]});if(_0x14bdc7['direction']['toLowerCase']()==='in'||_0x14bdc7[_0x98cd('0x12')]['toLowerCase']()===_0x98cd('0x13')&&!_0x14bdc7['secret']&&!_[_0x98cd('0x14')](_0x14bdc7[_0x98cd('0x15')])){_0x124102[_0x98cd('0x16')][_0x98cd('0x17')]({'where':{'id':_0x14bdc7[_0x98cd('0x18')]}})[_0x98cd('0x19')](function(_0xff7f08){if(_0xff7f08){_0xff7f08[_0x98cd('0x1a')]({'lastMsgAt':_0x14bdc7['createdAt'],'lastMsgDirection':_0x14bdc7[_0x98cd('0x12')][_0x98cd('0x1b')]()});}})[_0x98cd('0x1c')](function(_0x41af8f){console[_0x98cd('0x1d')](_0x41af8f);});}if(_0x14bdc7['direction']==='out'&&!_0x14bdc7[_0x98cd('0x1e')]){var _0x4bab4b;_0x124102[_0x98cd('0x1f')][_0x98cd('0x20')]({'where':{'id':_0x14bdc7['WhatsappAccountId']},'raw':!![]})[_0x98cd('0x19')](function(_0x8b1343){_0x4bab4b=_0x8b1343;if(_0x4bab4b&&_0x4bab4b[_0x98cd('0x21')]){switch(_0x4bab4b[_0x98cd('0x21')]){case _0x98cd('0x22'):var _0x58e9b3=require('twilio');if(_0x4bab4b['accountSid']&&_0x4bab4b[_0x98cd('0x23')]&&_0x4bab4b[_0x98cd('0x24')]){var _0x5b23e7=new _0x58e9b3(_0x4bab4b['accountSid'],_0x4bab4b[_0x98cd('0x23')]);_0x5b23e7[_0x98cd('0x25')][_0x98cd('0x26')]({'body':_0x14bdc7[_0x98cd('0xf')],'to':'whatsapp:'+_0x14bdc7['phone'],'from':_0x98cd('0x27')+_0x4bab4b[_0x98cd('0x24')],'statusCallback':_0x4bab4b[_0x98cd('0x28')]+_0x98cd('0x29')+_0x14bdc7['id']+_0x98cd('0x2a')+_0x4bab4b['token']})[_0x98cd('0x19')](function(_0x49ab3b){if(_0x49ab3b[_0x98cd('0x2b')]){return _0x14f5bb[_0x98cd('0x1a')]({'messageId':_0x49ab3b[_0x98cd('0x2b')]});}})[_0x98cd('0x1c')](function(_0x361707){logger['error'](_0x98cd('0x2c'),_0x98cd('0x2d'),_0x98cd('0x22'),util[_0x98cd('0x2e')](_0x361707,{'showHidden':![],'depth':null}));});}else{logger[_0x98cd('0x1d')](_0x98cd('0x2c'),'afterCreate',_0x98cd('0x22'),_0x98cd('0x2f'));}break;case _0x98cd('0x30'):var _0x5cb015=_0x4bab4b['accountSid'];var _0x993137=_0x4bab4b[_0x98cd('0x23')];var _0x591bf2=_0x4bab4b[_0x98cd('0x31')]+_0x98cd('0x32')+_0x5cb015+_0x98cd('0x33');var _0x1d1c45={'to':[_0x14bdc7[_0x98cd('0x24')]],'message':{'type':_0x98cd('0x34'),'text':_0x14bdc7[_0x98cd('0xf')]}};var _0x2f4cd8={'method':_0x98cd('0x35'),'uri':_0x591bf2,'headers':{'Authorization':_0x98cd('0x36')+_0x993137,'Content-Type':_0x98cd('0x37')},'body':_0x1d1c45,'json':!![]};rp(_0x2f4cd8)[_0x98cd('0x19')](function(_0x25f365){if(_0x25f365[_0x98cd('0x38')][0x0][_0x98cd('0x39')]){return _0x14f5bb[_0x98cd('0x1a')]({'messageId':_0x25f365[_0x98cd('0x38')][0x0][_0x98cd('0x39')]});}})[_0x98cd('0x1c')](function(_0x33e1e8){logger['err'](_0x98cd('0x3a'),_0x33e1e8);});break;}}})['finally'](function(){_0x2244f8();});}else{_0x2244f8();}}},'charset':_0x98cd('0x3b'),'collate':_0x98cd('0x3c')});}; \ No newline at end of file +var _0x3397=['findOne','then','update','direction','catch','error','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','messages','whatsapp:','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','node-fetch','path','rimraf','./whatsappMessage.attributes','exports','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction'];(function(_0x35035e,_0x26bc1d){var _0x3a042f=function(_0x38d4e3){while(--_0x38d4e3){_0x35035e['push'](_0x35035e['shift']());}};_0x3a042f(++_0x26bc1d);}(_0x3397,0x1a3));var _0x7339=function(_0x36cff7,_0x5cb048){_0x36cff7=_0x36cff7-0x0;var _0x21c697=_0x3397[_0x36cff7];return _0x21c697;};'use strict';var _=require(_0x7339('0x0'));var util=require(_0x7339('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7339('0x2'));var BPromise=require(_0x7339('0x3'));var rp=require('request-promise');var fetch=require(_0x7339('0x4'));var fs=require('fs');var path=require(_0x7339('0x5'));var rimraf=require(_0x7339('0x6'));var config=require('../../config/environment');var attributes=require(_0x7339('0x7'));module[_0x7339('0x8')]=function(_0x1e42c4,_0x24b6bc){return _0x1e42c4['define']('WhatsappMessage',attributes,{'tableName':_0x7339('0x9'),'paranoid':![],'indexes':[{'name':_0x7339('0xa'),'fields':[_0x7339('0xa')]},{'name':_0x7339('0xb'),'fields':[_0x7339('0xc')],'type':_0x7339('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5acf56,_0x2d5832,_0x243008){var _0x113806=_0x1e42c4['models'];var _0xa09433=_0x5acf56[_0x7339('0xe')]({'plain':!![]});if(_0xa09433['direction'][_0x7339('0xf')]()==='in'||_0xa09433['direction']['toLowerCase']()===_0x7339('0x10')&&!_0xa09433[_0x7339('0x11')]&&!_[_0x7339('0x12')](_0xa09433[_0x7339('0x13')])){_0x113806[_0x7339('0x14')][_0x7339('0x15')]({'where':{'id':_0xa09433['WhatsappInteractionId']}})[_0x7339('0x16')](function(_0x55cf3f){if(_0x55cf3f){_0x55cf3f[_0x7339('0x17')]({'lastMsgAt':_0xa09433['createdAt'],'lastMsgDirection':_0xa09433[_0x7339('0x18')]['toLowerCase']()});}})[_0x7339('0x19')](function(_0x220f15){console[_0x7339('0x1a')](_0x220f15);});}if(_0xa09433[_0x7339('0x18')]===_0x7339('0x10')&&!_0xa09433[_0x7339('0x11')]){var _0xaa52bf;_0x113806[_0x7339('0x1b')][_0x7339('0x1c')]({'where':{'id':_0xa09433['WhatsappAccountId']},'raw':!![]})[_0x7339('0x16')](function(_0x1fcb11){_0xaa52bf=_0x1fcb11;if(_0xaa52bf&&_0xaa52bf['type']){switch(_0xaa52bf[_0x7339('0x1d')]){case'twilio':var _0x473f0c=require(_0x7339('0x1e'));if(_0xaa52bf[_0x7339('0x1f')]&&_0xaa52bf[_0x7339('0x20')]&&_0xaa52bf[_0x7339('0x21')]){var _0x246003=new _0x473f0c(_0xaa52bf[_0x7339('0x1f')],_0xaa52bf[_0x7339('0x20')]);_0x246003[_0x7339('0x22')]['create']({'body':_0xa09433[_0x7339('0xc')],'to':_0x7339('0x23')+_0xa09433['phone'],'from':'whatsapp:'+_0xaa52bf[_0x7339('0x21')],'statusCallback':_0xaa52bf['remote']+_0x7339('0x24')+_0xa09433['id']+'/status?token='+_0xaa52bf[_0x7339('0x25')]})['then'](function(_0x4ef934){if(_0x4ef934[_0x7339('0x26')]){return _0x5acf56['update']({'messageId':_0x4ef934[_0x7339('0x26')]});}})[_0x7339('0x19')](function(_0xd6565e){logger['error'](_0x7339('0x27'),'afterCreate',_0x7339('0x1e'),util[_0x7339('0x28')](_0xd6565e,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x7339('0x29'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x3385f8=_0xaa52bf['accountSid'];var _0x374c2c=_0xaa52bf[_0x7339('0x20')];var _0x149928=_0xaa52bf['baseUrl']+_0x7339('0x2a')+_0x3385f8+_0x7339('0x2b');var _0x494649={'to':[_0xa09433[_0x7339('0x21')]],'message':{'type':_0x7339('0x2c'),'text':_0xa09433[_0x7339('0xc')]}};var _0x1a3c63={'method':_0x7339('0x2d'),'uri':_0x149928,'headers':{'Authorization':_0x7339('0x2e')+_0x374c2c,'Content-Type':_0x7339('0x2f')},'body':_0x494649,'json':!![]};rp(_0x1a3c63)['then'](function(_0x2ffe90){if(_0x2ffe90[_0x7339('0x30')][0x0][_0x7339('0x31')]){return _0x5acf56[_0x7339('0x17')]({'messageId':_0x2ffe90[_0x7339('0x30')][0x0][_0x7339('0x31')]});}})['catch'](function(_0x40ef23){logger[_0x7339('0x32')](_0x7339('0x33'),_0x40ef23);});break;}}})[_0x7339('0x34')](function(){_0x243008();});}else{_0x243008();}}},'charset':_0x7339('0x35'),'collate':_0x7339('0x36')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 3942398..f536ac0 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 _0xd0f0=['info','request\x20sent','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','WhatsappMessage','create','body','options','raw','then','CreateWhatsappMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request'];(function(_0x5d82d9,_0x3d7694){var _0x3dfd86=function(_0x53735e){while(--_0x53735e){_0x5d82d9['push'](_0x5d82d9['shift']());}};_0x3dfd86(++_0x3d7694);}(_0xd0f0,0x19d));var _0x0d0f=function(_0x34217a,_0x1f545a){_0x34217a=_0x34217a-0x0;var _0x23c2be=_0xd0f0[_0x34217a];return _0x23c2be;};'use strict';var _=require(_0x0d0f('0x0'));var util=require(_0x0d0f('0x1'));var moment=require(_0x0d0f('0x2'));var BPromise=require(_0x0d0f('0x3'));var rs=require(_0x0d0f('0x4'));var fs=require('fs');var Redis=require(_0x0d0f('0x5'));var db=require(_0x0d0f('0x6'))['db'];var utils=require(_0x0d0f('0x7'));var logger=require(_0x0d0f('0x8'))(_0x0d0f('0x9'));var config=require(_0x0d0f('0xa'));var jayson=require(_0x0d0f('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x0d0f('0xc')]=_[_0x0d0f('0xd')](config['redis'],{'host':_0x0d0f('0xe'),'port':0x18eb});var socket=require(_0x0d0f('0xf'))(new Redis(config['redis']));require(_0x0d0f('0x10'))[_0x0d0f('0x11')](socket);function respondWithRpcPromise(_0x59cdbc,_0x16b449,_0x258c79){return new BPromise(function(_0x2c4cc6,_0x26c6bd){return client[_0x0d0f('0x12')](_0x59cdbc,_0x258c79)['then'](function(_0x1e37aa){logger[_0x0d0f('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x16b449,_0x0d0f('0x14'));logger[_0x0d0f('0x15')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x16b449,_0x0d0f('0x14'),JSON[_0x0d0f('0x16')](_0x1e37aa));if(_0x1e37aa[_0x0d0f('0x17')]){if(_0x1e37aa[_0x0d0f('0x17')][_0x0d0f('0x18')]===0x1f4){logger[_0x0d0f('0x17')](_0x0d0f('0x19'),_0x16b449,_0x1e37aa[_0x0d0f('0x17')][_0x0d0f('0x1a')]);return _0x26c6bd(_0x1e37aa['error'][_0x0d0f('0x1a')]);}logger[_0x0d0f('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x16b449,_0x1e37aa[_0x0d0f('0x17')][_0x0d0f('0x1a')]);return _0x2c4cc6(_0x1e37aa['error']['message']);}else{logger[_0x0d0f('0x13')](_0x0d0f('0x19'),_0x16b449,_0x0d0f('0x14'));_0x2c4cc6(_0x1e37aa[_0x0d0f('0x1b')][_0x0d0f('0x1a')]);}})[_0x0d0f('0x1c')](function(_0x3295f3){logger[_0x0d0f('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x16b449,_0x3295f3);_0x26c6bd(_0x3295f3);});});}exports['CreateWhatsappMessage']=function(_0x173ed6){var _0x318b3c=this;return new Promise(function(_0x4b47f6,_0x5e160b){return db[_0x0d0f('0x1d')][_0x0d0f('0x1e')](_0x173ed6[_0x0d0f('0x1f')],{'raw':_0x173ed6['options']?_0x173ed6[_0x0d0f('0x20')][_0x0d0f('0x21')]===undefined?!![]:![]:!![]})[_0x0d0f('0x22')](function(_0x6db5f8){logger['info'](_0x0d0f('0x23'),_0x173ed6);logger[_0x0d0f('0x15')]('CreateWhatsappMessage',_0x173ed6,JSON[_0x0d0f('0x16')](_0x6db5f8));_0x4b47f6(_0x6db5f8);})[_0x0d0f('0x1c')](function(_0xd7af3b){logger[_0x0d0f('0x17')]('CreateWhatsappMessage',_0xd7af3b[_0x0d0f('0x1a')],_0x173ed6);_0x5e160b(_0x318b3c[_0x0d0f('0x17')](0x1f4,_0xd7af3b[_0x0d0f('0x1a')]));});});}; \ No newline at end of file +var _0xc4f5=['CreateWhatsappMessage','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','WhatsappMessage','create','body','options','raw'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0xc4f5,0xaf));var _0x5c4f=function(_0x4da3b6,_0x233aff){_0x4da3b6=_0x4da3b6-0x0;var _0x574d38=_0xc4f5[_0x4da3b6];return _0x574d38;};'use strict';var _=require(_0x5c4f('0x0'));var util=require(_0x5c4f('0x1'));var moment=require(_0x5c4f('0x2'));var BPromise=require(_0x5c4f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5c4f('0x4'));var logger=require(_0x5c4f('0x5'))(_0x5c4f('0x6'));var config=require(_0x5c4f('0x7'));var jayson=require(_0x5c4f('0x8'));var client=jayson[_0x5c4f('0x9')][_0x5c4f('0xa')]({'port':0x232a});config[_0x5c4f('0xb')]=_['defaults'](config['redis'],{'host':_0x5c4f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5c4f('0xb')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0xb452e2,_0x2cac20,_0x2c3878){return new BPromise(function(_0x50225b,_0x1cef78){return client['request'](_0xb452e2,_0x2c3878)[_0x5c4f('0xd')](function(_0x15defb){logger[_0x5c4f('0xe')](_0x5c4f('0xf'),_0x2cac20,_0x5c4f('0x10'));logger[_0x5c4f('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x2cac20,'request\x20sent',JSON[_0x5c4f('0x12')](_0x15defb));if(_0x15defb[_0x5c4f('0x13')]){if(_0x15defb[_0x5c4f('0x13')]['code']===0x1f4){logger[_0x5c4f('0x13')](_0x5c4f('0xf'),_0x2cac20,_0x15defb['error'][_0x5c4f('0x14')]);return _0x1cef78(_0x15defb[_0x5c4f('0x13')]['message']);}logger['error'](_0x5c4f('0xf'),_0x2cac20,_0x15defb[_0x5c4f('0x13')][_0x5c4f('0x14')]);return _0x50225b(_0x15defb[_0x5c4f('0x13')][_0x5c4f('0x14')]);}else{logger[_0x5c4f('0xe')]('WhatsappMessage,\x20%s,\x20%s',_0x2cac20,_0x5c4f('0x10'));_0x50225b(_0x15defb[_0x5c4f('0x15')][_0x5c4f('0x14')]);}})[_0x5c4f('0x16')](function(_0x39453d){logger[_0x5c4f('0x13')](_0x5c4f('0xf'),_0x2cac20,_0x39453d);_0x1cef78(_0x39453d);});});}exports['CreateWhatsappMessage']=function(_0x4864e4){var _0x1ce25d=this;return new Promise(function(_0x1c9a78,_0x4a7147){return db[_0x5c4f('0x17')][_0x5c4f('0x18')](_0x4864e4[_0x5c4f('0x19')],{'raw':_0x4864e4[_0x5c4f('0x1a')]?_0x4864e4['options'][_0x5c4f('0x1b')]===undefined?!![]:![]:!![]})[_0x5c4f('0xd')](function(_0x25d0ee){logger[_0x5c4f('0xe')]('CreateWhatsappMessage',_0x4864e4);logger[_0x5c4f('0x11')]('CreateWhatsappMessage',_0x4864e4,JSON[_0x5c4f('0x12')](_0x25d0ee));_0x1c9a78(_0x25d0ee);})[_0x5c4f('0x16')](function(_0xaa5385){logger[_0x5c4f('0x13')](_0x5c4f('0x1c'),_0xaa5385[_0x5c4f('0x14')],_0x4864e4);_0x4a7147(_0x1ce25d[_0x5c4f('0x13')](0x1f4,_0xaa5385['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index c498df9..49d434c 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 _0x7caa=['removeListener','register','length','./whatsappMessage.events','save','remove'];(function(_0x4808f6,_0x11cec2){var _0x2bd5f0=function(_0x3514c7){while(--_0x3514c7){_0x4808f6['push'](_0x4808f6['shift']());}};_0x2bd5f0(++_0x11cec2);}(_0x7caa,0xab));var _0xa7ca=function(_0x36e7c5,_0x1f8625){_0x36e7c5=_0x36e7c5-0x0;var _0x7e342a=_0x7caa[_0x36e7c5];return _0x7e342a;};'use strict';var WhatsappMessageEvents=require(_0xa7ca('0x0'));var events=[_0xa7ca('0x1'),_0xa7ca('0x2'),'update'];function createListener(_0x1d9161,_0x49468d){return function(_0x50a3ce){_0x49468d['emit'](_0x1d9161,_0x50a3ce);};}function removeListener(_0x13a8e7,_0x4daedc){return function(){WhatsappMessageEvents[_0xa7ca('0x3')](_0x13a8e7,_0x4daedc);};}exports[_0xa7ca('0x4')]=function(_0x5a47b9){for(var _0x27c169=0x0,_0x54ad88=events[_0xa7ca('0x5')];_0x27c169<_0x54ad88;_0x27c169++){var _0x5b6e26=events[_0x27c169];var _0x43ece4=createListener('whatsappMessage:'+_0x5b6e26,_0x5a47b9);WhatsappMessageEvents['on'](_0x5b6e26,_0x43ece4);}}; \ No newline at end of file +var _0x06c0=['register','length','whatsappMessage:','save','remove','update','removeListener'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x06c0,0xf8));var _0x006c=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x06c0[_0x36dfbd];return _0x4ecad9;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x006c('0x0'),_0x006c('0x1'),_0x006c('0x2')];function createListener(_0x4b4fee,_0x11fcd0){return function(_0x15bc23){_0x11fcd0['emit'](_0x4b4fee,_0x15bc23);};}function removeListener(_0x63fe9c,_0x3988f8){return function(){WhatsappMessageEvents[_0x006c('0x3')](_0x63fe9c,_0x3988f8);};}exports[_0x006c('0x4')]=function(_0x25a988){for(var _0x667715=0x0,_0x189cc5=events[_0x006c('0x5')];_0x667715<_0x189cc5;_0x667715++){var _0x590345=events[_0x667715];var _0x34cf3e=createListener(_0x006c('0x6')+_0x590345,_0x25a988);WhatsappMessageEvents['on'](_0x590345,_0x34cf3e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 5dec018..f9ccf67 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 _0xcbd7=['destroy','removeTeams','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete'];(function(_0x11be99,_0x37d766){var _0x58ef1c=function(_0x5cfcb5){while(--_0x5cfcb5){_0x11be99['push'](_0x11be99['shift']());}};_0x58ef1c(++_0x37d766);}(_0xcbd7,0x197));var _0x7cbd=function(_0x2ba850,_0xda6ccd){_0x2ba850=_0x2ba850-0x0;var _0x177ddb=_0xcbd7[_0x2ba850];return _0x177ddb;};'use strict';var multer=require('multer');var util=require(_0x7cbd('0x0'));var path=require('path');var timeout=require(_0x7cbd('0x1'));var express=require('express');var router=express[_0x7cbd('0x2')]();var fs_extra=require(_0x7cbd('0x3'));var auth=require(_0x7cbd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7cbd('0x5'));var controller=require(_0x7cbd('0x6'));router[_0x7cbd('0x7')]('/',auth['isAuthenticated'](),controller[_0x7cbd('0x8')]);router[_0x7cbd('0x7')](_0x7cbd('0x9'),auth[_0x7cbd('0xa')](),controller[_0x7cbd('0xb')]);router[_0x7cbd('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7cbd('0x7')](_0x7cbd('0xc'),auth[_0x7cbd('0xa')](),controller[_0x7cbd('0xd')]);router['get'](_0x7cbd('0xe'),auth[_0x7cbd('0xa')](),controller['getTeams']);router[_0x7cbd('0x7')](_0x7cbd('0xf'),auth[_0x7cbd('0xa')](),controller[_0x7cbd('0x10')]);router[_0x7cbd('0x11')]('/',auth[_0x7cbd('0xa')](),controller[_0x7cbd('0x12')]);router[_0x7cbd('0x11')](_0x7cbd('0xe'),auth[_0x7cbd('0xa')](),controller[_0x7cbd('0x13')]);router['post'](_0x7cbd('0xf'),auth['isAuthenticated'](),controller[_0x7cbd('0x14')]);router[_0x7cbd('0x15')](_0x7cbd('0x16'),auth[_0x7cbd('0xa')](),controller[_0x7cbd('0x17')]);router[_0x7cbd('0x18')]('/:id',auth[_0x7cbd('0xa')](),controller[_0x7cbd('0x19')]);router[_0x7cbd('0x18')](_0x7cbd('0xe'),auth[_0x7cbd('0xa')](),controller[_0x7cbd('0x1a')]);router[_0x7cbd('0x18')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x65fe=['util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','update','destroy','delete','removeTeams','exports'];(function(_0x5abb00,_0x342d70){var _0xf9b854=function(_0x43ac30){while(--_0x43ac30){_0x5abb00['push'](_0x5abb00['shift']());}};_0xf9b854(++_0x342d70);}(_0x65fe,0x16c));var _0xe65f=function(_0x43d5c7,_0x1441ae){_0x43d5c7=_0x43d5c7-0x0;var _0x3c2505=_0x65fe[_0x43d5c7];return _0x3c2505;};'use strict';var multer=require('multer');var util=require(_0xe65f('0x0'));var path=require('path');var timeout=require(_0xe65f('0x1'));var express=require(_0xe65f('0x2'));var router=express[_0xe65f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe65f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe65f('0x5'));var controller=require(_0xe65f('0x6'));router[_0xe65f('0x7')]('/',auth['isAuthenticated'](),controller[_0xe65f('0x8')]);router['get'](_0xe65f('0x9'),auth[_0xe65f('0xa')](),controller[_0xe65f('0xb')]);router[_0xe65f('0x7')](_0xe65f('0xc'),auth[_0xe65f('0xa')](),controller[_0xe65f('0xd')]);router['get']('/:id/members',auth[_0xe65f('0xa')](),controller[_0xe65f('0xe')]);router[_0xe65f('0x7')]('/:id/teams',auth[_0xe65f('0xa')](),controller['getTeams']);router['get'](_0xe65f('0xf'),auth[_0xe65f('0xa')](),controller[_0xe65f('0x10')]);router[_0xe65f('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xe65f('0x12'),auth[_0xe65f('0xa')](),controller[_0xe65f('0x13')]);router[_0xe65f('0x11')](_0xe65f('0xf'),auth[_0xe65f('0xa')](),controller[_0xe65f('0x14')]);router['put'](_0xe65f('0xc'),auth[_0xe65f('0xa')](),controller[_0xe65f('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe65f('0x16')]);router[_0xe65f('0x17')](_0xe65f('0x12'),auth['isAuthenticated'](),controller[_0xe65f('0x18')]);router[_0xe65f('0x17')]('/:id/users',auth[_0xe65f('0xa')](),controller['removeAgents']);module[_0xe65f('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index be71239..c1c3c3a 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 _0xe3ed=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xe3ed,0x8d));var _0xde3e=function(_0x512560,_0x1614f1){_0x512560=_0x512560-0x0;var _0x2aad44=_0xe3ed[_0x512560];return _0x2aad44;};'use strict';var Sequelize=require(_0xde3e('0x0'));module[_0xde3e('0x1')]={'name':{'type':Sequelize[_0xde3e('0x2')],'unique':_0xde3e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xde3e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xde3e('0x5')](_0xde3e('0x6'),_0xde3e('0x7'),'roundrobin')},'description':{'type':Sequelize[_0xde3e('0x2')]}}; \ No newline at end of file +var _0x1be1=['STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x4bd152,_0x547c21){var _0x10d639=function(_0x1a4001){while(--_0x1a4001){_0x4bd152['push'](_0x4bd152['shift']());}};_0x10d639(++_0x547c21);}(_0x1be1,0x192));var _0x11be=function(_0x1d5ac8,_0x3690c9){_0x1d5ac8=_0x1d5ac8-0x0;var _0x184e7c=_0x1be1[_0x1d5ac8];return _0x184e7c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x11be('0x0')],'unique':_0x11be('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x11be('0x2')](_0x11be('0x3'),_0x11be('0x4'),_0x11be('0x5'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 516d960..c1a419a 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 _0xd0ae=['name','send','index','map','WhatsappQueue','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','options','include','rows','show','params','rawAttributes','includeAll','find','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserWhatsappQueue','sort','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','isArray','getAgents','rimraf','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','WhatsappQueues','UserProfileResource','error','stack'];(function(_0x32a4dc,_0x2b4c60){var _0x191f56=function(_0x4aa603){while(--_0x4aa603){_0x32a4dc['push'](_0x32a4dc['shift']());}};_0x191f56(++_0x2b4c60);}(_0xd0ae,0x178));var _0xed0a=function(_0x18575f,_0x495b19){_0x18575f=_0x18575f-0x0;var _0x33ff6d=_0xd0ae[_0x18575f];return _0x33ff6d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed0a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xed0a('0x1'));var moment=require(_0xed0a('0x2'));var BPromise=require(_0xed0a('0x3'));var Mustache=require('mustache');var util=require(_0xed0a('0x4'));var path=require(_0xed0a('0x5'));var sox=require(_0xed0a('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xed0a('0x7'));var _=require(_0xed0a('0x8'));var squel=require('squel');var crypto=require(_0xed0a('0x9'));var jsforce=require(_0xed0a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xed0a('0xb'));var querystring=require(_0xed0a('0xc'));var Papa=require(_0xed0a('0xd'));var Redis=require('ioredis');var authService=require(_0xed0a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xed0a('0xf'));var hardwareService=require(_0xed0a('0x10'));var logger=require(_0xed0a('0x11'))(_0xed0a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xed0a('0x13'));var db=require(_0xed0a('0x14'))['db'];config[_0xed0a('0x15')]=_[_0xed0a('0x16')](config[_0xed0a('0x15')],{'host':_0xed0a('0x17'),'port':0x18eb});var socket=require(_0xed0a('0x18'))(new Redis(config[_0xed0a('0x15')]));require(_0xed0a('0x19'))['register'](socket);function respondWithStatusCode(_0x39f4ed,_0x12f069){_0x12f069=_0x12f069||0xcc;return function(_0x5bb788){if(_0x5bb788){return _0x39f4ed[_0xed0a('0x1a')](_0x12f069);}return _0x39f4ed[_0xed0a('0x1b')](_0x12f069)[_0xed0a('0x1c')]();};}function respondWithResult(_0x110527,_0x217f6c){_0x217f6c=_0x217f6c||0xc8;return function(_0x3bc0ed){if(_0x3bc0ed){return _0x110527[_0xed0a('0x1b')](_0x217f6c)[_0xed0a('0x1d')](_0x3bc0ed);}};}function respondWithFilteredResult(_0x1a79fa,_0x3dc652){return function(_0x42dc51){if(_0x42dc51){var _0x5833f0=typeof _0x3dc652[_0xed0a('0x1e')]===_0xed0a('0x1f')&&typeof _0x3dc652[_0xed0a('0x20')]==='undefined';var _0xc612ef=_0x42dc51[_0xed0a('0x21')];var _0x4ebe15=_0x5833f0?0x0:_0x3dc652['offset'];var _0x37a747=_0x5833f0?_0x42dc51[_0xed0a('0x21')]:_0x3dc652[_0xed0a('0x1e')]+_0x3dc652['limit'];var _0x1b345d;if(_0x37a747>=_0xc612ef){_0x37a747=_0xc612ef;_0x1b345d=0xc8;}else{_0x1b345d=0xce;}_0x1a79fa['status'](_0x1b345d);return _0x1a79fa[_0xed0a('0x22')](_0xed0a('0x23'),_0x4ebe15+'-'+_0x37a747+'/'+_0xc612ef)[_0xed0a('0x1d')](_0x42dc51);}return null;};}function patchUpdates(_0xb2bc33){return function(_0xdd5e9e){try{jsonpatch[_0xed0a('0x24')](_0xdd5e9e,_0xb2bc33,!![]);}catch(_0x1161c0){return BPromise[_0xed0a('0x25')](_0x1161c0);}return _0xdd5e9e[_0xed0a('0x26')]();};}function saveUpdates(_0x2d6558,_0x340179){return function(_0x1a8ab6){if(_0x1a8ab6){return _0x1a8ab6[_0xed0a('0x27')](_0x2d6558)['then'](function(_0x2592ee){return _0x2592ee;});}return null;};}function removeEntity(_0x341810,_0x135966){return function(_0x1be879){if(_0x1be879){return _0x1be879[_0xed0a('0x28')]()[_0xed0a('0x29')](function(){var _0x4b7e4f=_0x1be879[_0xed0a('0x2a')]({'plain':!![]});var _0xa7bd10=_0xed0a('0x2b');return db[_0xed0a('0x2c')][_0xed0a('0x28')]({'where':{'type':_0xa7bd10,'resourceId':_0x4b7e4f['id']}})[_0xed0a('0x29')](function(){return _0x1be879;});})[_0xed0a('0x29')](function(){_0x341810['status'](0xcc)[_0xed0a('0x1c')]();});}};}function handleEntityNotFound(_0x4812db,_0x43deb7){return function(_0x57f366){if(!_0x57f366){_0x4812db[_0xed0a('0x1a')](0x194);}return _0x57f366;};}function handleError(_0x98ddeb,_0x1149c1){_0x1149c1=_0x1149c1||0x1f4;return function(_0x59aa01){logger[_0xed0a('0x2d')](_0x59aa01[_0xed0a('0x2e')]);if(_0x59aa01[_0xed0a('0x2f')]){delete _0x59aa01[_0xed0a('0x2f')];}_0x98ddeb[_0xed0a('0x1b')](_0x1149c1)[_0xed0a('0x30')](_0x59aa01);};}exports[_0xed0a('0x31')]=function(_0x49f8df,_0x47eed8){var _0x2d8b1c={},_0x143182={},_0x2e1b2c={'count':0x0,'rows':[]};var _0x2864c0=_[_0xed0a('0x32')](db[_0xed0a('0x33')]['rawAttributes'],function(_0x253b36){return{'name':_0x253b36[_0xed0a('0x34')],'type':_0x253b36[_0xed0a('0x35')][_0xed0a('0x36')]};});_0x143182[_0xed0a('0x37')]=_[_0xed0a('0x32')](_0x2864c0,_0xed0a('0x2f'));_0x143182['query']=_[_0xed0a('0x38')](_0x49f8df[_0xed0a('0x39')]);_0x143182[_0xed0a('0x3a')]=_[_0xed0a('0x3b')](_0x143182[_0xed0a('0x37')],_0x143182[_0xed0a('0x39')]);_0x2d8b1c[_0xed0a('0x3c')]=_[_0xed0a('0x3b')](_0x143182[_0xed0a('0x37')],qs[_0xed0a('0x3d')](_0x49f8df['query'][_0xed0a('0x3d')]));_0x2d8b1c['attributes']=_0x2d8b1c[_0xed0a('0x3c')][_0xed0a('0x3e')]?_0x2d8b1c[_0xed0a('0x3c')]:_0x143182[_0xed0a('0x37')];if(!_0x49f8df[_0xed0a('0x39')][_0xed0a('0x3f')](_0xed0a('0x40'))){_0x2d8b1c[_0xed0a('0x20')]=qs[_0xed0a('0x20')](_0x49f8df['query'][_0xed0a('0x20')]);_0x2d8b1c[_0xed0a('0x1e')]=qs[_0xed0a('0x1e')](_0x49f8df[_0xed0a('0x39')]['offset']);}_0x2d8b1c[_0xed0a('0x41')]=qs['sort'](_0x49f8df[_0xed0a('0x39')]['sort']);_0x2d8b1c['where']=qs['filters'](_[_0xed0a('0x42')](_0x49f8df[_0xed0a('0x39')],_0x143182[_0xed0a('0x3a')]),_0x2864c0);if(_0x49f8df[_0xed0a('0x39')]['filter']){_0x2d8b1c[_0xed0a('0x43')]=_[_0xed0a('0x44')](_0x2d8b1c[_0xed0a('0x43')],{'$or':_[_0xed0a('0x32')](_0x2864c0,function(_0x480214){if(_0x480214[_0xed0a('0x35')]!==_0xed0a('0x45')){var _0xedbc52={};_0xedbc52[_0x480214['name']]={'$like':'%'+_0x49f8df[_0xed0a('0x39')][_0xed0a('0x46')]+'%'};return _0xedbc52;}})});}_0x2d8b1c=_[_0xed0a('0x44')]({},_0x2d8b1c,_0x49f8df[_0xed0a('0x47')]);var _0x14c16b={'where':_0x2d8b1c[_0xed0a('0x43')]};return db['WhatsappQueue'][_0xed0a('0x21')](_0x14c16b)[_0xed0a('0x29')](function(_0x2ad109){_0x2e1b2c[_0xed0a('0x21')]=_0x2ad109;if(_0x49f8df[_0xed0a('0x39')]['includeAll']){_0x2d8b1c[_0xed0a('0x48')]=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x2d8b1c);})[_0xed0a('0x29')](function(_0x429e1c){_0x2e1b2c[_0xed0a('0x49')]=_0x429e1c;return _0x2e1b2c;})[_0xed0a('0x29')](respondWithFilteredResult(_0x47eed8,_0x2d8b1c))['catch'](handleError(_0x47eed8,null));};exports[_0xed0a('0x4a')]=function(_0x98284e,_0x1b89d4){var _0x4d62a3={'raw':!![],'where':{'id':_0x98284e[_0xed0a('0x4b')]['id']}},_0x42c72b={};_0x42c72b[_0xed0a('0x37')]=_['keys'](db['WhatsappQueue'][_0xed0a('0x4c')]);_0x42c72b[_0xed0a('0x39')]=_[_0xed0a('0x38')](_0x98284e[_0xed0a('0x39')]);_0x42c72b[_0xed0a('0x3a')]=_['intersection'](_0x42c72b[_0xed0a('0x37')],_0x42c72b[_0xed0a('0x39')]);_0x4d62a3[_0xed0a('0x3c')]=_[_0xed0a('0x3b')](_0x42c72b[_0xed0a('0x37')],qs['fields'](_0x98284e['query']['fields']));_0x4d62a3[_0xed0a('0x3c')]=_0x4d62a3[_0xed0a('0x3c')]['length']?_0x4d62a3[_0xed0a('0x3c')]:_0x42c72b[_0xed0a('0x37')];if(_0x98284e[_0xed0a('0x39')][_0xed0a('0x4d')]){_0x4d62a3['include']=[{'all':!![]}];}_0x4d62a3=_[_0xed0a('0x44')]({},_0x4d62a3,_0x98284e[_0xed0a('0x47')]);return db[_0xed0a('0x33')][_0xed0a('0x4e')](_0x4d62a3)[_0xed0a('0x29')](handleEntityNotFound(_0x1b89d4,null))[_0xed0a('0x29')](respondWithResult(_0x1b89d4,null))[_0xed0a('0x4f')](handleError(_0x1b89d4,null));};exports[_0xed0a('0x50')]=function(_0x4ffb7b,_0x2f327c){return db['WhatsappQueue']['create'](_0x4ffb7b[_0xed0a('0x51')],{})['then'](function(_0xe13a4a){var _0x470ff4=_0x4ffb7b[_0xed0a('0x52')][_0xed0a('0x2a')]({'plain':!![]});if(!_0x470ff4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x470ff4['role']===_0xed0a('0x52')){var _0x406ed2=_0xe13a4a[_0xed0a('0x2a')]({'plain':!![]});var _0x3910e7=_0xed0a('0x2b');return db[_0xed0a('0x53')][_0xed0a('0x4e')]({'where':{'name':_0x3910e7,'userProfileId':_0x470ff4[_0xed0a('0x54')]},'raw':!![]})[_0xed0a('0x29')](function(_0x409aae){if(_0x409aae&&_0x409aae[_0xed0a('0x55')]===0x0){return db[_0xed0a('0x2c')][_0xed0a('0x50')]({'name':_0x406ed2[_0xed0a('0x2f')],'resourceId':_0x406ed2['id'],'type':_0x409aae['name'],'sectionId':_0x409aae['id']},{})[_0xed0a('0x29')](function(){return _0xe13a4a;});}else{return _0xe13a4a;}})[_0xed0a('0x4f')](function(_0xa68b27){logger[_0xed0a('0x2d')](_0xed0a('0x56'),_0xa68b27);throw _0xa68b27;});}return _0xe13a4a;})['then'](respondWithResult(_0x2f327c,0xc9))[_0xed0a('0x4f')](handleError(_0x2f327c,null));};exports[_0xed0a('0x27')]=function(_0x28912b,_0x5295ef){if(_0x28912b[_0xed0a('0x51')]['id']){delete _0x28912b[_0xed0a('0x51')]['id'];}return db['WhatsappQueue'][_0xed0a('0x4e')]({'where':{'id':_0x28912b[_0xed0a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5295ef,null))[_0xed0a('0x29')](saveUpdates(_0x28912b[_0xed0a('0x51')],null))[_0xed0a('0x29')](respondWithResult(_0x5295ef,null))[_0xed0a('0x4f')](handleError(_0x5295ef,null));};exports[_0xed0a('0x28')]=function(_0x24a96b,_0x968d39){return db[_0xed0a('0x33')][_0xed0a('0x4e')]({'where':{'id':_0x24a96b[_0xed0a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x968d39,null))['then'](removeEntity(_0x968d39,null))['catch'](handleError(_0x968d39,null));};exports[_0xed0a('0x57')]=function(_0xf363cd,_0x3a0c91){return db[_0xed0a('0x33')][_0xed0a('0x57')]()['then'](respondWithResult(_0x3a0c91,null))[_0xed0a('0x4f')](handleError(_0x3a0c91,null));};exports['getMembers']=function(_0x352db7,_0x1045dc,_0x7929a){var _0x4aec9f={'raw':!![],'where':{}},_0x3ec4a2={},_0x515d10;return db[_0xed0a('0x33')][_0xed0a('0x58')]({'where':{'id':_0x352db7['params']['id']}})[_0xed0a('0x29')](handleEntityNotFound(_0x1045dc,null))[_0xed0a('0x29')](function(_0x1fbc2f){if(_0x1fbc2f){_0x515d10=_0x1fbc2f[_0xed0a('0x2a')]({'plain':!![]});_0x3ec4a2[_0xed0a('0x37')]=_[_0xed0a('0x38')](db[_0xed0a('0x59')][_0xed0a('0x4c')]);_0x3ec4a2[_0xed0a('0x39')]=_['keys'](_0x352db7['query']);_0x3ec4a2[_0xed0a('0x3a')]=_[_0xed0a('0x3b')](_0x3ec4a2[_0xed0a('0x37')],_0x3ec4a2[_0xed0a('0x39')]);_0x4aec9f[_0xed0a('0x3c')]=_[_0xed0a('0x3b')](_0x3ec4a2[_0xed0a('0x37')],qs['fields'](_0x352db7['query'][_0xed0a('0x3d')]));_0x4aec9f[_0xed0a('0x3c')]=_0x4aec9f['attributes'][_0xed0a('0x3e')]?_0x4aec9f[_0xed0a('0x3c')]:_0x3ec4a2[_0xed0a('0x37')];if(!_0x352db7[_0xed0a('0x39')][_0xed0a('0x3f')](_0xed0a('0x40'))){_0x4aec9f[_0xed0a('0x20')]=qs[_0xed0a('0x20')](_0x352db7['query'][_0xed0a('0x20')]);_0x4aec9f['offset']=qs['offset'](_0x352db7[_0xed0a('0x39')][_0xed0a('0x1e')]);}_0x4aec9f['order']=qs[_0xed0a('0x5a')](_0x352db7[_0xed0a('0x39')][_0xed0a('0x5a')]);_0x4aec9f['where']=qs[_0xed0a('0x3a')](_['pick'](_0x352db7[_0xed0a('0x39')],_0x3ec4a2['filters']));_0x4aec9f[_0xed0a('0x43')]['WhatsappQueueId']=_0x1fbc2f['id'];if(_0x352db7[_0xed0a('0x39')][_0xed0a('0x46')]){_0x4aec9f['where']=_[_0xed0a('0x44')](_0x4aec9f['where'],{'$or':_[_0xed0a('0x32')](_0x4aec9f['attributes'],function(_0x1461ac){var _0x38aec4={};_0x38aec4[_0x1461ac]={'$like':'%'+_0x352db7['query'][_0xed0a('0x46')]+'%'};return _0x38aec4;})});}_0x4aec9f=_[_0xed0a('0x44')]({},_0x4aec9f,_0x352db7[_0xed0a('0x47')]);return db['UserWhatsappQueue'][_0xed0a('0x5b')](_0x4aec9f);}})[_0xed0a('0x29')](function(_0x23d7bf){if(_0x23d7bf){return db[_0xed0a('0x5c')][_0xed0a('0x5d')]({'where':{'id':_[_0xed0a('0x32')](_0x23d7bf,_0xed0a('0x5e')),'role':_0xed0a('0x5f')},'attributes':['id',_0xed0a('0x2f'),_0xed0a('0x60'),_0xed0a('0x61'),_0xed0a('0x62')]});}})['then'](function(_0x279c52){if(_0x279c52){return{'count':_0x279c52[_0xed0a('0x21')],'rows':_[_0xed0a('0x32')](_0x279c52[_0xed0a('0x49')],function(_0x21c8fa){return{'membername':_0x21c8fa['name'],'UserId':_0x21c8fa['id'],'queue_name':_0x515d10[_0xed0a('0x2f')],'WhatsappQueueId':_0x515d10['id'],'interface':util[_0xed0a('0x63')](_0xed0a('0x64'),'SIP',_0x21c8fa[_0xed0a('0x2f')]),'penalty':0x0,'paused':_0x21c8fa[_0xed0a('0x60')],'createdAt':_0x21c8fa[_0xed0a('0x62')],'updatedAt':_0x21c8fa[_0xed0a('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1045dc,_0x4aec9f))['catch'](handleError(_0x1045dc,null));};exports[_0xed0a('0x65')]=function(_0x1bb184,_0x5e319b,_0x24421d){var _0x2723db={};var _0x28b1ba={};var _0x21f685;var _0x4d7921;return db[_0xed0a('0x33')]['findOne']({'where':{'id':_0x1bb184['params']['id']}})[_0xed0a('0x29')](handleEntityNotFound(_0x5e319b,null))[_0xed0a('0x29')](function(_0x4b5eff){if(_0x4b5eff){_0x21f685=_0x4b5eff;_0x28b1ba[_0xed0a('0x37')]=_['keys'](db[_0xed0a('0x66')][_0xed0a('0x4c')]);_0x28b1ba[_0xed0a('0x39')]=_['keys'](_0x1bb184[_0xed0a('0x39')]);_0x28b1ba[_0xed0a('0x3a')]=_[_0xed0a('0x3b')](_0x28b1ba[_0xed0a('0x37')],_0x28b1ba[_0xed0a('0x39')]);_0x2723db[_0xed0a('0x3c')]=_['intersection'](_0x28b1ba[_0xed0a('0x37')],qs['fields'](_0x1bb184['query'][_0xed0a('0x3d')]));_0x2723db['attributes']=_0x2723db[_0xed0a('0x3c')][_0xed0a('0x3e')]?_0x2723db[_0xed0a('0x3c')]:_0x28b1ba['model'];_0x2723db['order']=qs[_0xed0a('0x5a')](_0x1bb184[_0xed0a('0x39')][_0xed0a('0x5a')]);_0x2723db[_0xed0a('0x43')]=qs[_0xed0a('0x3a')](_['pick'](_0x1bb184[_0xed0a('0x39')],_0x28b1ba[_0xed0a('0x3a')]));if(_0x1bb184[_0xed0a('0x39')]['filter']){_0x2723db[_0xed0a('0x43')]=_['merge'](_0x2723db[_0xed0a('0x43')],{'$or':_[_0xed0a('0x32')](_0x2723db[_0xed0a('0x3c')],function(_0x2421d1){var _0x38930c={};_0x38930c[_0x2421d1]={'$like':'%'+_0x1bb184['query'][_0xed0a('0x46')]+'%'};return _0x38930c;})});}_0x2723db=_[_0xed0a('0x44')]({},_0x2723db,_0x1bb184[_0xed0a('0x47')]);return _0x21f685[_0xed0a('0x65')](_0x2723db);}})['then'](function(_0xb7e292){if(_0xb7e292){_0x4d7921=_0xb7e292[_0xed0a('0x3e')];if(!_0x1bb184['query'][_0xed0a('0x3f')](_0xed0a('0x40'))){_0x2723db[_0xed0a('0x20')]=qs[_0xed0a('0x20')](_0x1bb184[_0xed0a('0x39')][_0xed0a('0x20')]);_0x2723db[_0xed0a('0x1e')]=qs[_0xed0a('0x1e')](_0x1bb184[_0xed0a('0x39')]['offset']);}return _0x21f685['getTeams'](_0x2723db);}})['then'](function(_0x2fccc3){if(_0x2fccc3){return _0x2fccc3?{'count':_0x4d7921,'rows':_0x2fccc3}:null;}})[_0xed0a('0x29')](respondWithResult(_0x5e319b,null))[_0xed0a('0x4f')](handleError(_0x5e319b,null));};exports[_0xed0a('0x67')]=function(_0x39bf1c,_0x155517,_0x339303){var _0x1ec9cd=_0x39bf1c[_0xed0a('0x51')][_0xed0a('0x68')];return db[_0xed0a('0x66')][_0xed0a('0x5b')]({'where':{'id':_0x1ec9cd},'attributes':['id'],'include':[{'model':db[_0xed0a('0x5c')],'as':'Agents','attributes':['id',_0xed0a('0x2f'),'online',_0xed0a('0x69'),_0xed0a('0x6a')],'raw':!![]}]})['then'](function(_0x2f5cbf){if(_0x2f5cbf){var _0x5a5552=_[_0xed0a('0x6b')](_0x2f5cbf,function(_0x1d0fac){var _0x10c7fd=_0x1d0fac[_0xed0a('0x2a')]({'plain':!![]});return _0x10c7fd[_0xed0a('0x6c')];});return db[_0xed0a('0x33')][_0xed0a('0x4e')]({'where':{'id':_0x39bf1c['params']['id']}})['then'](function(_0x57031a){return db[_0xed0a('0x6d')][_0xed0a('0x6e')](function(_0x5e3307){return _0x57031a[_0xed0a('0x67')](_0x1ec9cd,{'transaction':_0x5e3307})[_0xed0a('0x29')](function(){return BPromise[_0xed0a('0x6f')](_0x5a5552,function(_0xe6f65c){return db[_0xed0a('0x59')][_0xed0a('0x70')]({'where':{'UserId':_0xe6f65c['id'],'WhatsappQueueId':_0x39bf1c['params']['id']},'transaction':_0x5e3307});});})[_0xed0a('0x29')](function(){_0x5a5552[_0xed0a('0x71')](function(_0x58d066){socket[_0xed0a('0x72')](_0xed0a('0x73'),{'UserId':_0x58d066['id'],'WhatsappQueueId':_0x57031a['id']});});});});});}})[_0xed0a('0x29')](respondWithStatusCode(_0x155517,null))[_0xed0a('0x4f')](handleError(_0x155517,null));};exports[_0xed0a('0x74')]=function(_0x24e5f9,_0x568580,_0x13892d){return db['Team'][_0xed0a('0x5b')]({'where':{'id':_0x24e5f9['query'][_0xed0a('0x68')]},'attributes':['id'],'include':[{'model':db[_0xed0a('0x5c')],'as':_0xed0a('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xed0a('0x29')](handleEntityNotFound(_0x568580,null))[_0xed0a('0x29')](function(_0x208f1b){var _0x226e49=_[_0xed0a('0x32')](_0x208f1b,'id');var _0x3c239b=[];var _0x12cc01=[];var _0x91fbc1=squel['select']();_0x91fbc1[_0xed0a('0x75')](_0xed0a('0x76'))[_0xed0a('0x77')](_0xed0a('0x78'),'tq')[_0xed0a('0x79')](_0xed0a('0x7a'),'ut',_0xed0a('0x7b'))[_0xed0a('0x43')]('WhatsappQueueId\x20=\x20?',_0x24e5f9['params']['id']);for(var _0x101ad2=0x0;_0x101ad2<_0x208f1b['length'];_0x101ad2+=0x1){let _0x2e2b44=_0x208f1b[_0x101ad2];for(var _0x39a509=0x0;_0x39a509<_0x2e2b44[_0xed0a('0x6c')][_0xed0a('0x3e')];_0x39a509+=0x1){let _0x468771=_0x2e2b44['Agents'][_0x39a509];var _0x5c519c=_0x91fbc1[_0xed0a('0x7c')]();_0x5c519c[_0xed0a('0x43')]('ut.UserId\x20=\x20?',_0x468771['id']);_0x12cc01['push'](db[_0xed0a('0x6d')][_0xed0a('0x39')](_0x5c519c[_0xed0a('0x7d')](),{'type':db['sequelize'][_0xed0a('0x7e')][_0xed0a('0x7f')]})[_0xed0a('0x29')](function(_0x32b91f){if(_0x32b91f['length']===0x1){return _0x468771['id'];}else{var _0x59e01c=_[_0xed0a('0x80')](_[_0xed0a('0x32')](_0x32b91f,_0xed0a('0x81')),function(_0x2c22ff){return _[_0xed0a('0x82')](_0x226e49,_0x2c22ff);});if(_0x59e01c){return _0x468771['id'];}}}));}}return BPromise[_0xed0a('0x83')](_0x12cc01)[_0xed0a('0x29')](function(_0x3d5d78){_0x3c239b=_(_0x3c239b)[_0xed0a('0x84')](_0x3d5d78)[_0xed0a('0x85')]()[_0xed0a('0x86')]();return db[_0xed0a('0x33')][_0xed0a('0x4e')]({'where':{'id':_0x24e5f9[_0xed0a('0x4b')]['id']}})['then'](function(_0x2c1b1f){return db['sequelize'][_0xed0a('0x6e')](function(_0x48c350){return _0x2c1b1f[_0xed0a('0x74')](_0x24e5f9[_0xed0a('0x39')][_0xed0a('0x68')],{'transaction':_0x48c350})['then'](function(){if(!_[_0xed0a('0x87')](_0x3c239b)){return _0x2c1b1f[_0xed0a('0x88')](_0x3c239b,{'transaction':_0x48c350});}})[_0xed0a('0x29')](function(){_0x3c239b[_0xed0a('0x71')](function(_0x3c5fa1){socket[_0xed0a('0x72')](_0xed0a('0x89'),{'UserId':_0x3c5fa1,'WhatsappQueueId':_0x2c1b1f['id']});});});});});});})['then'](respondWithStatusCode(_0x568580,null))['catch'](handleError(_0x568580,null));};exports[_0xed0a('0x8a')]=function(_0x575392,_0x162191,_0x219a72){return db['WhatsappQueue']['find']({'where':{'id':_0x575392[_0xed0a('0x4b')]['id']}})[_0xed0a('0x29')](handleEntityNotFound(_0x162191,null))['then'](function(_0x1242b8){if(_0x1242b8){return _0x1242b8[_0xed0a('0x8a')](_0x575392[_0xed0a('0x51')][_0xed0a('0x68')],_['omit'](_0x575392[_0xed0a('0x51')],[_0xed0a('0x68'),'id'])||{})['spread'](function(_0x579189){for(var _0x48d8bc=0x0;_0x48d8bc<_0x575392[_0xed0a('0x51')][_0xed0a('0x68')][_0xed0a('0x3e')];_0x48d8bc+=0x1){socket[_0xed0a('0x72')](_0xed0a('0x73'),{'UserId':Number(_0x575392['body']['ids'][_0x48d8bc]),'WhatsappQueueId':Number(_0x575392[_0xed0a('0x4b')]['id'])});}return _0x579189;});}})[_0xed0a('0x29')](respondWithResult(_0x162191,null))[_0xed0a('0x4f')](handleError(_0x162191,null));};exports[_0xed0a('0x88')]=function(_0x3acddd,_0x398229,_0x2abfb5){return db[_0xed0a('0x33')][_0xed0a('0x4e')]({'where':{'id':_0x3acddd[_0xed0a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x398229,null))['then'](function(_0x3c8a79){if(_0x3c8a79){return _0x3c8a79[_0xed0a('0x88')](_0x3acddd['query'][_0xed0a('0x68')])[_0xed0a('0x29')](function(){if(_[_0xed0a('0x8b')](_0x3acddd['query'][_0xed0a('0x68')])){for(var _0x3ff867=0x0;_0x3ff867<_0x3acddd[_0xed0a('0x39')][_0xed0a('0x68')]['length'];_0x3ff867+=0x1){socket[_0xed0a('0x72')]('userWhatsappQueue:remove',{'UserId':Number(_0x3acddd[_0xed0a('0x39')]['ids'][_0x3ff867]),'WhatsappQueueId':Number(_0x3acddd[_0xed0a('0x4b')]['id'])});}}else{socket[_0xed0a('0x72')](_0xed0a('0x89'),{'UserId':Number(_0x3acddd[_0xed0a('0x39')][_0xed0a('0x68')]),'WhatsappQueueId':Number(_0x3acddd[_0xed0a('0x4b')]['id'])});}});}})[_0xed0a('0x29')](respondWithStatusCode(_0x398229,null))[_0xed0a('0x4f')](handleError(_0x398229,null));};exports[_0xed0a('0x8c')]=function(_0x34f2e9,_0x167680,_0x2e317a){var _0xb0d6e6={};var _0x41104c={};var _0x35e3c5;var _0x3352bb;return db[_0xed0a('0x33')]['findOne']({'where':{'id':_0x34f2e9['params']['id']}})[_0xed0a('0x29')](handleEntityNotFound(_0x167680,null))[_0xed0a('0x29')](function(_0x12a49d){if(_0x12a49d){_0x35e3c5=_0x12a49d;_0x41104c['model']=_[_0xed0a('0x38')](db[_0xed0a('0x5c')][_0xed0a('0x4c')]);_0x41104c[_0xed0a('0x39')]=_[_0xed0a('0x38')](_0x34f2e9['query']);_0x41104c[_0xed0a('0x3a')]=_['intersection'](_0x41104c[_0xed0a('0x37')],_0x41104c['query']);_0xb0d6e6[_0xed0a('0x3c')]=_['intersection'](_0x41104c['model'],qs['fields'](_0x34f2e9['query'][_0xed0a('0x3d')]));_0xb0d6e6[_0xed0a('0x3c')]=_0xb0d6e6['attributes']['length']?_0xb0d6e6[_0xed0a('0x3c')]:_0x41104c[_0xed0a('0x37')];_0xb0d6e6['order']=qs[_0xed0a('0x5a')](_0x34f2e9[_0xed0a('0x39')][_0xed0a('0x5a')]);_0xb0d6e6[_0xed0a('0x43')]=qs[_0xed0a('0x3a')](_[_0xed0a('0x42')](_0x34f2e9['query'],_0x41104c['filters']));if(_0x34f2e9[_0xed0a('0x39')][_0xed0a('0x46')]){_0xb0d6e6[_0xed0a('0x43')]=_[_0xed0a('0x44')](_0xb0d6e6[_0xed0a('0x43')],{'$or':_[_0xed0a('0x32')](_0xb0d6e6[_0xed0a('0x3c')],function(_0x4125ba){var _0xbb597c={};_0xbb597c[_0x4125ba]={'$like':'%'+_0x34f2e9[_0xed0a('0x39')][_0xed0a('0x46')]+'%'};return _0xbb597c;})});}_0xb0d6e6=_['merge']({},_0xb0d6e6,_0x34f2e9[_0xed0a('0x47')]);return _0x35e3c5[_0xed0a('0x8c')](_0xb0d6e6);}})[_0xed0a('0x29')](function(_0x1b0eac){if(_0x1b0eac){_0x3352bb=_0x1b0eac[_0xed0a('0x3e')];if(!_0x34f2e9[_0xed0a('0x39')][_0xed0a('0x3f')](_0xed0a('0x40'))){_0xb0d6e6[_0xed0a('0x20')]=qs['limit'](_0x34f2e9[_0xed0a('0x39')][_0xed0a('0x20')]);_0xb0d6e6['offset']=qs[_0xed0a('0x1e')](_0x34f2e9[_0xed0a('0x39')][_0xed0a('0x1e')]);}return _0x35e3c5[_0xed0a('0x8c')](_0xb0d6e6);}})[_0xed0a('0x29')](function(_0x183bd8){if(_0x183bd8){return _0x183bd8?{'count':_0x3352bb,'rows':_0x183bd8}:null;}})['then'](respondWithResult(_0x167680,null))[_0xed0a('0x4f')](handleError(_0x167680,null));}; \ No newline at end of file +var _0xd4e5=['createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','transaction','each','forEach','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','addAgents','omit','isArray','userWhatsappQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','socket.io-emitter','redis','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','get','UserProfileResource','then','error','stack','name','send','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','WhatsappQueue','include','findAll','rows','catch','params','rawAttributes','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt'];(function(_0xf9165d,_0x471a7a){var _0x50ec7e=function(_0x1e71b9){while(--_0x1e71b9){_0xf9165d['push'](_0xf9165d['shift']());}};_0x50ec7e(++_0x471a7a);}(_0xd4e5,0x140));var _0x5d4e=function(_0x27fe19,_0x5ec7c3){_0x27fe19=_0x27fe19-0x0;var _0x17cbe4=_0xd4e5[_0x27fe19];return _0x17cbe4;};'use strict';var emlformat=require(_0x5d4e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d4e('0x1'));var jsonpatch=require(_0x5d4e('0x2'));var rp=require('request-promise');var moment=require(_0x5d4e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5d4e('0x4'));var util=require(_0x5d4e('0x5'));var path=require(_0x5d4e('0x6'));var sox=require('sox');var csv=require(_0x5d4e('0x7'));var ejs=require(_0x5d4e('0x8'));var fs=require('fs');var fs_extra=require(_0x5d4e('0x9'));var _=require(_0x5d4e('0xa'));var squel=require(_0x5d4e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5d4e('0xc'));var toCsv=require(_0x5d4e('0x7'));var querystring=require(_0x5d4e('0xd'));var Papa=require(_0x5d4e('0xe'));var Redis=require(_0x5d4e('0xf'));var authService=require(_0x5d4e('0x10'));var qs=require(_0x5d4e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d4e('0x12'));var logger=require(_0x5d4e('0x13'))('api');var utils=require(_0x5d4e('0x14'));var config=require(_0x5d4e('0x15'));var licenseUtil=require(_0x5d4e('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5d4e('0x17'))(new Redis(config[_0x5d4e('0x18')]));require(_0x5d4e('0x19'))[_0x5d4e('0x1a')](socket);function respondWithStatusCode(_0x45f655,_0x47ece6){_0x47ece6=_0x47ece6||0xcc;return function(_0x3cbb84){if(_0x3cbb84){return _0x45f655[_0x5d4e('0x1b')](_0x47ece6);}return _0x45f655[_0x5d4e('0x1c')](_0x47ece6)[_0x5d4e('0x1d')]();};}function respondWithResult(_0xa7e801,_0x614cd6){_0x614cd6=_0x614cd6||0xc8;return function(_0x5330cf){if(_0x5330cf){return _0xa7e801['status'](_0x614cd6)[_0x5d4e('0x1e')](_0x5330cf);}};}function respondWithFilteredResult(_0x3f84ad,_0x1ebef8){return function(_0x5bcb1c){if(_0x5bcb1c){var _0x35849c=typeof _0x1ebef8[_0x5d4e('0x1f')]==='undefined'&&typeof _0x1ebef8[_0x5d4e('0x20')]===_0x5d4e('0x21');var _0x15cc72=_0x5bcb1c['count'];var _0x2c573f=_0x35849c?0x0:_0x1ebef8[_0x5d4e('0x1f')];var _0xd30d98=_0x35849c?_0x5bcb1c[_0x5d4e('0x22')]:_0x1ebef8[_0x5d4e('0x1f')]+_0x1ebef8[_0x5d4e('0x20')];var _0x34300f;if(_0xd30d98>=_0x15cc72){_0xd30d98=_0x15cc72;_0x34300f=0xc8;}else{_0x34300f=0xce;}_0x3f84ad[_0x5d4e('0x1c')](_0x34300f);return _0x3f84ad[_0x5d4e('0x23')]('Content-Range',_0x2c573f+'-'+_0xd30d98+'/'+_0x15cc72)[_0x5d4e('0x1e')](_0x5bcb1c);}return null;};}function patchUpdates(_0x3435f2){return function(_0x2ad055){try{jsonpatch['apply'](_0x2ad055,_0x3435f2,!![]);}catch(_0x12a075){return BPromise[_0x5d4e('0x24')](_0x12a075);}return _0x2ad055[_0x5d4e('0x25')]();};}function saveUpdates(_0x2ae206,_0x41a960){return function(_0x235cba){if(_0x235cba){return _0x235cba[_0x5d4e('0x26')](_0x2ae206)['then'](function(_0x52c213){return _0x52c213;});}return null;};}function removeEntity(_0x19c5a4,_0x160674){return function(_0x5cc807){if(_0x5cc807){return _0x5cc807['destroy']()['then'](function(){var _0x5a89d4=_0x5cc807[_0x5d4e('0x27')]({'plain':!![]});var _0x55b12a='WhatsappQueues';return db[_0x5d4e('0x28')]['destroy']({'where':{'type':_0x55b12a,'resourceId':_0x5a89d4['id']}})[_0x5d4e('0x29')](function(){return _0x5cc807;});})[_0x5d4e('0x29')](function(){_0x19c5a4[_0x5d4e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x231975,_0x3c1569){return function(_0x24dc8a){if(!_0x24dc8a){_0x231975['sendStatus'](0x194);}return _0x24dc8a;};}function handleError(_0x473501,_0x103401){_0x103401=_0x103401||0x1f4;return function(_0x3f72aa){logger[_0x5d4e('0x2a')](_0x3f72aa[_0x5d4e('0x2b')]);if(_0x3f72aa['name']){delete _0x3f72aa[_0x5d4e('0x2c')];}_0x473501['status'](_0x103401)[_0x5d4e('0x2d')](_0x3f72aa);};}exports['index']=function(_0x4776cd,_0x3348bf){var _0x173508={},_0x263f22={},_0x2da180={'count':0x0,'rows':[]};var _0x15f35d=_['map'](db['WhatsappQueue']['rawAttributes'],function(_0x1e0265){return{'name':_0x1e0265[_0x5d4e('0x2e')],'type':_0x1e0265[_0x5d4e('0x2f')][_0x5d4e('0x30')]};});_0x263f22[_0x5d4e('0x31')]=_[_0x5d4e('0x32')](_0x15f35d,'name');_0x263f22['query']=_[_0x5d4e('0x33')](_0x4776cd['query']);_0x263f22[_0x5d4e('0x34')]=_[_0x5d4e('0x35')](_0x263f22[_0x5d4e('0x31')],_0x263f22[_0x5d4e('0x36')]);_0x173508[_0x5d4e('0x37')]=_[_0x5d4e('0x35')](_0x263f22[_0x5d4e('0x31')],qs[_0x5d4e('0x38')](_0x4776cd[_0x5d4e('0x36')][_0x5d4e('0x38')]));_0x173508[_0x5d4e('0x37')]=_0x173508[_0x5d4e('0x37')]['length']?_0x173508[_0x5d4e('0x37')]:_0x263f22[_0x5d4e('0x31')];if(!_0x4776cd['query'][_0x5d4e('0x39')](_0x5d4e('0x3a'))){_0x173508[_0x5d4e('0x20')]=qs[_0x5d4e('0x20')](_0x4776cd['query'][_0x5d4e('0x20')]);_0x173508[_0x5d4e('0x1f')]=qs[_0x5d4e('0x1f')](_0x4776cd['query'][_0x5d4e('0x1f')]);}_0x173508[_0x5d4e('0x3b')]=qs['sort'](_0x4776cd['query'][_0x5d4e('0x3c')]);_0x173508[_0x5d4e('0x3d')]=qs[_0x5d4e('0x34')](_[_0x5d4e('0x3e')](_0x4776cd['query'],_0x263f22[_0x5d4e('0x34')]),_0x15f35d);if(_0x4776cd['query'][_0x5d4e('0x3f')]){_0x173508[_0x5d4e('0x3d')]=_[_0x5d4e('0x40')](_0x173508[_0x5d4e('0x3d')],{'$or':_[_0x5d4e('0x32')](_0x15f35d,function(_0x230435){if(_0x230435[_0x5d4e('0x2f')]!=='VIRTUAL'){var _0x32f7cf={};_0x32f7cf[_0x230435[_0x5d4e('0x2c')]]={'$like':'%'+_0x4776cd[_0x5d4e('0x36')][_0x5d4e('0x3f')]+'%'};return _0x32f7cf;}})});}_0x173508=_[_0x5d4e('0x40')]({},_0x173508,_0x4776cd['options']);var _0x4a1bbe={'where':_0x173508[_0x5d4e('0x3d')]};return db[_0x5d4e('0x41')][_0x5d4e('0x22')](_0x4a1bbe)[_0x5d4e('0x29')](function(_0x3b4f32){_0x2da180[_0x5d4e('0x22')]=_0x3b4f32;if(_0x4776cd['query']['includeAll']){_0x173508[_0x5d4e('0x42')]=[{'all':!![]}];}return db[_0x5d4e('0x41')][_0x5d4e('0x43')](_0x173508);})[_0x5d4e('0x29')](function(_0x59b2a1){_0x2da180[_0x5d4e('0x44')]=_0x59b2a1;return _0x2da180;})[_0x5d4e('0x29')](respondWithFilteredResult(_0x3348bf,_0x173508))[_0x5d4e('0x45')](handleError(_0x3348bf,null));};exports['show']=function(_0x8974cd,_0x513616){var _0xcb9a92={'raw':!![],'where':{'id':_0x8974cd[_0x5d4e('0x46')]['id']}},_0x4a5c05={};_0x4a5c05['model']=_[_0x5d4e('0x33')](db[_0x5d4e('0x41')][_0x5d4e('0x47')]);_0x4a5c05[_0x5d4e('0x36')]=_[_0x5d4e('0x33')](_0x8974cd[_0x5d4e('0x36')]);_0x4a5c05[_0x5d4e('0x34')]=_[_0x5d4e('0x35')](_0x4a5c05[_0x5d4e('0x31')],_0x4a5c05[_0x5d4e('0x36')]);_0xcb9a92[_0x5d4e('0x37')]=_[_0x5d4e('0x35')](_0x4a5c05['model'],qs['fields'](_0x8974cd[_0x5d4e('0x36')]['fields']));_0xcb9a92[_0x5d4e('0x37')]=_0xcb9a92[_0x5d4e('0x37')][_0x5d4e('0x48')]?_0xcb9a92['attributes']:_0x4a5c05['model'];if(_0x8974cd[_0x5d4e('0x36')][_0x5d4e('0x49')]){_0xcb9a92[_0x5d4e('0x42')]=[{'all':!![]}];}_0xcb9a92=_[_0x5d4e('0x40')]({},_0xcb9a92,_0x8974cd[_0x5d4e('0x4a')]);return db[_0x5d4e('0x41')][_0x5d4e('0x4b')](_0xcb9a92)['then'](handleEntityNotFound(_0x513616,null))[_0x5d4e('0x29')](respondWithResult(_0x513616,null))[_0x5d4e('0x45')](handleError(_0x513616,null));};exports[_0x5d4e('0x4c')]=function(_0x179835,_0x5308f7){return db['WhatsappQueue'][_0x5d4e('0x4c')](_0x179835[_0x5d4e('0x4d')],{})[_0x5d4e('0x29')](function(_0x3d5bb4){var _0x509a91=_0x179835[_0x5d4e('0x4e')][_0x5d4e('0x27')]({'plain':!![]});if(!_0x509a91)throw new Error(_0x5d4e('0x4f'));if(_0x509a91['role']===_0x5d4e('0x4e')){var _0x23e903=_0x3d5bb4['get']({'plain':!![]});var _0x4da5de=_0x5d4e('0x50');return db[_0x5d4e('0x51')]['find']({'where':{'name':_0x4da5de,'userProfileId':_0x509a91[_0x5d4e('0x52')]},'raw':!![]})[_0x5d4e('0x29')](function(_0x2e3142){if(_0x2e3142&&_0x2e3142[_0x5d4e('0x53')]===0x0){return db['UserProfileResource'][_0x5d4e('0x4c')]({'name':_0x23e903['name'],'resourceId':_0x23e903['id'],'type':_0x2e3142['name'],'sectionId':_0x2e3142['id']},{})['then'](function(){return _0x3d5bb4;});}else{return _0x3d5bb4;}})[_0x5d4e('0x45')](function(_0x466ed6){logger[_0x5d4e('0x2a')](_0x5d4e('0x54'),_0x466ed6);throw _0x466ed6;});}return _0x3d5bb4;})[_0x5d4e('0x29')](respondWithResult(_0x5308f7,0xc9))[_0x5d4e('0x45')](handleError(_0x5308f7,null));};exports[_0x5d4e('0x26')]=function(_0x16f405,_0x4e1991){if(_0x16f405[_0x5d4e('0x4d')]['id']){delete _0x16f405[_0x5d4e('0x4d')]['id'];}return db[_0x5d4e('0x41')][_0x5d4e('0x4b')]({'where':{'id':_0x16f405['params']['id']}})[_0x5d4e('0x29')](handleEntityNotFound(_0x4e1991,null))['then'](saveUpdates(_0x16f405['body'],null))['then'](respondWithResult(_0x4e1991,null))[_0x5d4e('0x45')](handleError(_0x4e1991,null));};exports[_0x5d4e('0x55')]=function(_0x13a717,_0x3aac1d){return db[_0x5d4e('0x41')][_0x5d4e('0x4b')]({'where':{'id':_0x13a717[_0x5d4e('0x46')]['id']}})[_0x5d4e('0x29')](handleEntityNotFound(_0x3aac1d,null))['then'](removeEntity(_0x3aac1d,null))[_0x5d4e('0x45')](handleError(_0x3aac1d,null));};exports[_0x5d4e('0x56')]=function(_0x3d353f,_0x1be2c0){return db[_0x5d4e('0x41')][_0x5d4e('0x56')]()[_0x5d4e('0x29')](respondWithResult(_0x1be2c0,null))['catch'](handleError(_0x1be2c0,null));};exports[_0x5d4e('0x57')]=function(_0x85f96b,_0x11c684,_0x4d648b){var _0x3dacfe={'raw':!![],'where':{}},_0x1810a6={},_0x4b3ea4;return db[_0x5d4e('0x41')][_0x5d4e('0x58')]({'where':{'id':_0x85f96b[_0x5d4e('0x46')]['id']}})[_0x5d4e('0x29')](handleEntityNotFound(_0x11c684,null))['then'](function(_0x1a7d13){if(_0x1a7d13){_0x4b3ea4=_0x1a7d13[_0x5d4e('0x27')]({'plain':!![]});_0x1810a6['model']=_[_0x5d4e('0x33')](db[_0x5d4e('0x59')][_0x5d4e('0x47')]);_0x1810a6[_0x5d4e('0x36')]=_[_0x5d4e('0x33')](_0x85f96b[_0x5d4e('0x36')]);_0x1810a6['filters']=_['intersection'](_0x1810a6['model'],_0x1810a6[_0x5d4e('0x36')]);_0x3dacfe[_0x5d4e('0x37')]=_['intersection'](_0x1810a6[_0x5d4e('0x31')],qs[_0x5d4e('0x38')](_0x85f96b['query'][_0x5d4e('0x38')]));_0x3dacfe[_0x5d4e('0x37')]=_0x3dacfe[_0x5d4e('0x37')][_0x5d4e('0x48')]?_0x3dacfe[_0x5d4e('0x37')]:_0x1810a6[_0x5d4e('0x31')];if(!_0x85f96b['query'][_0x5d4e('0x39')](_0x5d4e('0x3a'))){_0x3dacfe[_0x5d4e('0x20')]=qs['limit'](_0x85f96b[_0x5d4e('0x36')]['limit']);_0x3dacfe[_0x5d4e('0x1f')]=qs['offset'](_0x85f96b[_0x5d4e('0x36')][_0x5d4e('0x1f')]);}_0x3dacfe[_0x5d4e('0x3b')]=qs[_0x5d4e('0x3c')](_0x85f96b[_0x5d4e('0x36')]['sort']);_0x3dacfe[_0x5d4e('0x3d')]=qs[_0x5d4e('0x34')](_[_0x5d4e('0x3e')](_0x85f96b[_0x5d4e('0x36')],_0x1810a6[_0x5d4e('0x34')]));_0x3dacfe[_0x5d4e('0x3d')][_0x5d4e('0x5a')]=_0x1a7d13['id'];if(_0x85f96b[_0x5d4e('0x36')][_0x5d4e('0x3f')]){_0x3dacfe[_0x5d4e('0x3d')]=_['merge'](_0x3dacfe['where'],{'$or':_[_0x5d4e('0x32')](_0x3dacfe[_0x5d4e('0x37')],function(_0xa7895a){var _0x19bc75={};_0x19bc75[_0xa7895a]={'$like':'%'+_0x85f96b[_0x5d4e('0x36')][_0x5d4e('0x3f')]+'%'};return _0x19bc75;})});}_0x3dacfe=_['merge']({},_0x3dacfe,_0x85f96b['options']);return db[_0x5d4e('0x59')][_0x5d4e('0x43')](_0x3dacfe);}})['then'](function(_0x436db4){if(_0x436db4){return db[_0x5d4e('0x5b')][_0x5d4e('0x5c')]({'where':{'id':_[_0x5d4e('0x32')](_0x436db4,_0x5d4e('0x5d')),'role':_0x5d4e('0x5e')},'attributes':['id','name',_0x5d4e('0x5f'),_0x5d4e('0x60'),_0x5d4e('0x61')]});}})[_0x5d4e('0x29')](function(_0x38c253){if(_0x38c253){return{'count':_0x38c253['count'],'rows':_[_0x5d4e('0x32')](_0x38c253['rows'],function(_0x3bfba7){return{'membername':_0x3bfba7[_0x5d4e('0x2c')],'UserId':_0x3bfba7['id'],'queue_name':_0x4b3ea4[_0x5d4e('0x2c')],'WhatsappQueueId':_0x4b3ea4['id'],'interface':util[_0x5d4e('0x62')](_0x5d4e('0x63'),_0x5d4e('0x64'),_0x3bfba7[_0x5d4e('0x2c')]),'penalty':0x0,'paused':_0x3bfba7['whatsappPause'],'createdAt':_0x3bfba7[_0x5d4e('0x61')],'updatedAt':_0x3bfba7[_0x5d4e('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5d4e('0x29')](respondWithFilteredResult(_0x11c684,_0x3dacfe))[_0x5d4e('0x45')](handleError(_0x11c684,null));};exports[_0x5d4e('0x65')]=function(_0x3d65bd,_0x23eec6,_0x37b2fb){var _0x34f535={};var _0x1cb022={};var _0x216588;var _0x41ceed;return db[_0x5d4e('0x41')][_0x5d4e('0x58')]({'where':{'id':_0x3d65bd[_0x5d4e('0x46')]['id']}})[_0x5d4e('0x29')](handleEntityNotFound(_0x23eec6,null))['then'](function(_0x4ad2f4){if(_0x4ad2f4){_0x216588=_0x4ad2f4;_0x1cb022[_0x5d4e('0x31')]=_[_0x5d4e('0x33')](db[_0x5d4e('0x66')]['rawAttributes']);_0x1cb022[_0x5d4e('0x36')]=_[_0x5d4e('0x33')](_0x3d65bd['query']);_0x1cb022[_0x5d4e('0x34')]=_[_0x5d4e('0x35')](_0x1cb022['model'],_0x1cb022[_0x5d4e('0x36')]);_0x34f535['attributes']=_[_0x5d4e('0x35')](_0x1cb022[_0x5d4e('0x31')],qs[_0x5d4e('0x38')](_0x3d65bd[_0x5d4e('0x36')][_0x5d4e('0x38')]));_0x34f535[_0x5d4e('0x37')]=_0x34f535[_0x5d4e('0x37')][_0x5d4e('0x48')]?_0x34f535[_0x5d4e('0x37')]:_0x1cb022[_0x5d4e('0x31')];_0x34f535[_0x5d4e('0x3b')]=qs[_0x5d4e('0x3c')](_0x3d65bd[_0x5d4e('0x36')][_0x5d4e('0x3c')]);_0x34f535[_0x5d4e('0x3d')]=qs[_0x5d4e('0x34')](_[_0x5d4e('0x3e')](_0x3d65bd[_0x5d4e('0x36')],_0x1cb022[_0x5d4e('0x34')]));if(_0x3d65bd['query']['filter']){_0x34f535['where']=_[_0x5d4e('0x40')](_0x34f535[_0x5d4e('0x3d')],{'$or':_[_0x5d4e('0x32')](_0x34f535[_0x5d4e('0x37')],function(_0x48fbc8){var _0xc04302={};_0xc04302[_0x48fbc8]={'$like':'%'+_0x3d65bd['query']['filter']+'%'};return _0xc04302;})});}_0x34f535=_[_0x5d4e('0x40')]({},_0x34f535,_0x3d65bd[_0x5d4e('0x4a')]);return _0x216588[_0x5d4e('0x65')](_0x34f535);}})['then'](function(_0x181dc9){if(_0x181dc9){_0x41ceed=_0x181dc9[_0x5d4e('0x48')];if(!_0x3d65bd[_0x5d4e('0x36')]['hasOwnProperty'](_0x5d4e('0x3a'))){_0x34f535[_0x5d4e('0x20')]=qs[_0x5d4e('0x20')](_0x3d65bd[_0x5d4e('0x36')]['limit']);_0x34f535[_0x5d4e('0x1f')]=qs[_0x5d4e('0x1f')](_0x3d65bd[_0x5d4e('0x36')]['offset']);}return _0x216588[_0x5d4e('0x65')](_0x34f535);}})['then'](function(_0x520574){if(_0x520574){return _0x520574?{'count':_0x41ceed,'rows':_0x520574}:null;}})[_0x5d4e('0x29')](respondWithResult(_0x23eec6,null))[_0x5d4e('0x45')](handleError(_0x23eec6,null));};exports[_0x5d4e('0x67')]=function(_0x3e47ec,_0xd95ac7,_0x2c34b0){var _0x3c2c34=_0x3e47ec['body'][_0x5d4e('0x68')];return db[_0x5d4e('0x66')][_0x5d4e('0x43')]({'where':{'id':_0x3c2c34},'attributes':['id'],'include':[{'model':db[_0x5d4e('0x5b')],'as':_0x5d4e('0x69'),'attributes':['id',_0x5d4e('0x2c'),_0x5d4e('0x6a'),_0x5d4e('0x6b'),_0x5d4e('0x6c')],'raw':!![]}]})[_0x5d4e('0x29')](function(_0x1f9af4){if(_0x1f9af4){var _0xa57609=_['flatMap'](_0x1f9af4,function(_0xbb9ec6){var _0x33bc89=_0xbb9ec6[_0x5d4e('0x27')]({'plain':!![]});return _0x33bc89[_0x5d4e('0x69')];});return db[_0x5d4e('0x41')][_0x5d4e('0x4b')]({'where':{'id':_0x3e47ec[_0x5d4e('0x46')]['id']}})[_0x5d4e('0x29')](function(_0x5b441c){return db['sequelize'][_0x5d4e('0x6d')](function(_0x304513){return _0x5b441c['addTeams'](_0x3c2c34,{'transaction':_0x304513})[_0x5d4e('0x29')](function(){return BPromise[_0x5d4e('0x6e')](_0xa57609,function(_0x3f8583){return db[_0x5d4e('0x59')]['findOrCreate']({'where':{'UserId':_0x3f8583['id'],'WhatsappQueueId':_0x3e47ec[_0x5d4e('0x46')]['id']},'transaction':_0x304513});});})[_0x5d4e('0x29')](function(){_0xa57609[_0x5d4e('0x6f')](function(_0x29e597){socket[_0x5d4e('0x70')](_0x5d4e('0x71'),{'UserId':_0x29e597['id'],'WhatsappQueueId':_0x5b441c['id']});});});});});}})[_0x5d4e('0x29')](respondWithStatusCode(_0xd95ac7,null))[_0x5d4e('0x45')](handleError(_0xd95ac7,null));};exports[_0x5d4e('0x72')]=function(_0x2385c6,_0x455af3,_0x75bb96){return db['Team'][_0x5d4e('0x43')]({'where':{'id':_0x2385c6[_0x5d4e('0x36')][_0x5d4e('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5d4e('0x69'),'attributes':['id'],'raw':!![]}]})[_0x5d4e('0x29')](handleEntityNotFound(_0x455af3,null))['then'](function(_0x323f9f){var _0x5ab786=_[_0x5d4e('0x32')](_0x323f9f,'id');var _0x1af122=[];var _0x781a88=[];var _0x14144d=squel[_0x5d4e('0x73')]();_0x14144d['field'](_0x5d4e('0x74'))['from'](_0x5d4e('0x75'),'tq')[_0x5d4e('0x76')](_0x5d4e('0x77'),'ut',_0x5d4e('0x78'))[_0x5d4e('0x3d')](_0x5d4e('0x79'),_0x2385c6[_0x5d4e('0x46')]['id']);for(var _0x264b17=0x0;_0x264b17<_0x323f9f[_0x5d4e('0x48')];_0x264b17+=0x1){let _0xf5a39c=_0x323f9f[_0x264b17];for(var _0x181bf0=0x0;_0x181bf0<_0xf5a39c['Agents'][_0x5d4e('0x48')];_0x181bf0+=0x1){let _0x31c95f=_0xf5a39c['Agents'][_0x181bf0];var _0x36d691=_0x14144d[_0x5d4e('0x7a')]();_0x36d691[_0x5d4e('0x3d')]('ut.UserId\x20=\x20?',_0x31c95f['id']);_0x781a88['push'](db[_0x5d4e('0x7b')]['query'](_0x36d691[_0x5d4e('0x7c')](),{'type':db[_0x5d4e('0x7b')][_0x5d4e('0x7d')][_0x5d4e('0x7e')]})[_0x5d4e('0x29')](function(_0x51056b){if(_0x51056b[_0x5d4e('0x48')]===0x1){return _0x31c95f['id'];}else{var _0xa1d68f=_[_0x5d4e('0x7f')](_[_0x5d4e('0x32')](_0x51056b,_0x5d4e('0x80')),function(_0x106888){return _[_0x5d4e('0x81')](_0x5ab786,_0x106888);});if(_0xa1d68f){return _0x31c95f['id'];}}}));}}return BPromise[_0x5d4e('0x82')](_0x781a88)[_0x5d4e('0x29')](function(_0x1fc7e6){_0x1af122=_(_0x1af122)[_0x5d4e('0x83')](_0x1fc7e6)['compact']()['value']();return db['WhatsappQueue'][_0x5d4e('0x4b')]({'where':{'id':_0x2385c6[_0x5d4e('0x46')]['id']}})[_0x5d4e('0x29')](function(_0x56b911){return db[_0x5d4e('0x7b')][_0x5d4e('0x6d')](function(_0x1ac22c){return _0x56b911[_0x5d4e('0x72')](_0x2385c6['query'][_0x5d4e('0x68')],{'transaction':_0x1ac22c})[_0x5d4e('0x29')](function(){if(!_[_0x5d4e('0x84')](_0x1af122)){return _0x56b911[_0x5d4e('0x85')](_0x1af122,{'transaction':_0x1ac22c});}})[_0x5d4e('0x29')](function(){_0x1af122['forEach'](function(_0x55b21b){socket[_0x5d4e('0x70')]('userWhatsappQueue:remove',{'UserId':_0x55b21b,'WhatsappQueueId':_0x56b911['id']});});});});});});})[_0x5d4e('0x29')](respondWithStatusCode(_0x455af3,null))['catch'](handleError(_0x455af3,null));};exports[_0x5d4e('0x86')]=function(_0x149e96,_0x4935f6,_0x5722bc){return db[_0x5d4e('0x41')][_0x5d4e('0x4b')]({'where':{'id':_0x149e96[_0x5d4e('0x46')]['id']}})['then'](handleEntityNotFound(_0x4935f6,null))[_0x5d4e('0x29')](function(_0x2d7028){if(_0x2d7028){return _0x2d7028['addAgents'](_0x149e96[_0x5d4e('0x4d')][_0x5d4e('0x68')],_[_0x5d4e('0x87')](_0x149e96[_0x5d4e('0x4d')],[_0x5d4e('0x68'),'id'])||{})['spread'](function(_0x1c1e4b){for(var _0x457187=0x0;_0x457187<_0x149e96['body'][_0x5d4e('0x68')]['length'];_0x457187+=0x1){socket['emit'](_0x5d4e('0x71'),{'UserId':Number(_0x149e96[_0x5d4e('0x4d')][_0x5d4e('0x68')][_0x457187]),'WhatsappQueueId':Number(_0x149e96['params']['id'])});}return _0x1c1e4b;});}})['then'](respondWithResult(_0x4935f6,null))[_0x5d4e('0x45')](handleError(_0x4935f6,null));};exports[_0x5d4e('0x85')]=function(_0x1e6e0d,_0x597d3a,_0x2cd0b9){return db[_0x5d4e('0x41')]['find']({'where':{'id':_0x1e6e0d[_0x5d4e('0x46')]['id']}})['then'](handleEntityNotFound(_0x597d3a,null))['then'](function(_0x28382b){if(_0x28382b){return _0x28382b[_0x5d4e('0x85')](_0x1e6e0d['query'][_0x5d4e('0x68')])[_0x5d4e('0x29')](function(){if(_[_0x5d4e('0x88')](_0x1e6e0d[_0x5d4e('0x36')][_0x5d4e('0x68')])){for(var _0x279243=0x0;_0x279243<_0x1e6e0d[_0x5d4e('0x36')][_0x5d4e('0x68')][_0x5d4e('0x48')];_0x279243+=0x1){socket[_0x5d4e('0x70')](_0x5d4e('0x89'),{'UserId':Number(_0x1e6e0d[_0x5d4e('0x36')][_0x5d4e('0x68')][_0x279243]),'WhatsappQueueId':Number(_0x1e6e0d['params']['id'])});}}else{socket[_0x5d4e('0x70')](_0x5d4e('0x89'),{'UserId':Number(_0x1e6e0d['query'][_0x5d4e('0x68')]),'WhatsappQueueId':Number(_0x1e6e0d['params']['id'])});}});}})['then'](respondWithStatusCode(_0x597d3a,null))[_0x5d4e('0x45')](handleError(_0x597d3a,null));};exports['getAgents']=function(_0x4ca170,_0x5154fb,_0x441fb7){var _0x4e9b6b={};var _0xdffe46={};var _0x83ca4a;var _0x2a019e;return db[_0x5d4e('0x41')][_0x5d4e('0x58')]({'where':{'id':_0x4ca170[_0x5d4e('0x46')]['id']}})[_0x5d4e('0x29')](handleEntityNotFound(_0x5154fb,null))['then'](function(_0x2e0f91){if(_0x2e0f91){_0x83ca4a=_0x2e0f91;_0xdffe46[_0x5d4e('0x31')]=_['keys'](db[_0x5d4e('0x5b')][_0x5d4e('0x47')]);_0xdffe46[_0x5d4e('0x36')]=_[_0x5d4e('0x33')](_0x4ca170[_0x5d4e('0x36')]);_0xdffe46[_0x5d4e('0x34')]=_[_0x5d4e('0x35')](_0xdffe46[_0x5d4e('0x31')],_0xdffe46['query']);_0x4e9b6b[_0x5d4e('0x37')]=_['intersection'](_0xdffe46[_0x5d4e('0x31')],qs['fields'](_0x4ca170[_0x5d4e('0x36')]['fields']));_0x4e9b6b[_0x5d4e('0x37')]=_0x4e9b6b[_0x5d4e('0x37')][_0x5d4e('0x48')]?_0x4e9b6b['attributes']:_0xdffe46['model'];_0x4e9b6b['order']=qs['sort'](_0x4ca170[_0x5d4e('0x36')][_0x5d4e('0x3c')]);_0x4e9b6b[_0x5d4e('0x3d')]=qs[_0x5d4e('0x34')](_[_0x5d4e('0x3e')](_0x4ca170[_0x5d4e('0x36')],_0xdffe46['filters']));if(_0x4ca170[_0x5d4e('0x36')][_0x5d4e('0x3f')]){_0x4e9b6b[_0x5d4e('0x3d')]=_[_0x5d4e('0x40')](_0x4e9b6b[_0x5d4e('0x3d')],{'$or':_[_0x5d4e('0x32')](_0x4e9b6b[_0x5d4e('0x37')],function(_0x5a137a){var _0x46c1fb={};_0x46c1fb[_0x5a137a]={'$like':'%'+_0x4ca170[_0x5d4e('0x36')]['filter']+'%'};return _0x46c1fb;})});}_0x4e9b6b=_[_0x5d4e('0x40')]({},_0x4e9b6b,_0x4ca170[_0x5d4e('0x4a')]);return _0x83ca4a[_0x5d4e('0x8a')](_0x4e9b6b);}})[_0x5d4e('0x29')](function(_0x4aea17){if(_0x4aea17){_0x2a019e=_0x4aea17[_0x5d4e('0x48')];if(!_0x4ca170[_0x5d4e('0x36')][_0x5d4e('0x39')](_0x5d4e('0x3a'))){_0x4e9b6b[_0x5d4e('0x20')]=qs['limit'](_0x4ca170[_0x5d4e('0x36')][_0x5d4e('0x20')]);_0x4e9b6b[_0x5d4e('0x1f')]=qs[_0x5d4e('0x1f')](_0x4ca170['query'][_0x5d4e('0x1f')]);}return _0x83ca4a['getAgents'](_0x4e9b6b);}})[_0x5d4e('0x29')](function(_0x4f5674){if(_0x4f5674){return _0x4f5674?{'count':_0x2a019e,'rows':_0x4f5674}:null;}})[_0x5d4e('0x29')](respondWithResult(_0x5154fb,null))[_0x5d4e('0x45')](handleError(_0x5154fb,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 3cc3af3..d2314f9 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 _0xa5a5=['WhatsappQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xa5a5,0x67));var _0x5a5a=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0xa5a5[_0xbb14db];return _0x36bed7;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x5a5a('0x0'))['db'][_0x5a5a('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5a5a('0x2')](0x0);var events={'afterCreate':_0x5a5a('0x3'),'afterUpdate':'update','afterDestroy':_0x5a5a('0x4')};function emitEvent(_0x455890){return function(_0x2b972f,_0x36fe6e,_0x5f3625){WhatsappQueueEvents[_0x5a5a('0x5')](_0x455890+':'+_0x2b972f['id'],_0x2b972f);WhatsappQueueEvents[_0x5a5a('0x5')](_0x455890,_0x2b972f);_0x5f3625(null);};}for(var e in events){if(events[_0x5a5a('0x6')](e)){var event=events[e];WhatsappQueue[_0x5a5a('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xc7e6=['hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue','save','update','emit'];(function(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0xc7e6,0x1ab));var _0x6c7e=function(_0x1c2d01,_0x55590b){_0x1c2d01=_0x1c2d01-0x0;var _0x2fe07e=_0xc7e6[_0x1c2d01];return _0x2fe07e;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x6c7e('0x0'))['db'][_0x6c7e('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6c7e('0x2'),'afterUpdate':_0x6c7e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3cd7ff){return function(_0x5dd3b9,_0x3d62ac,_0x417ba5){WhatsappQueueEvents[_0x6c7e('0x4')](_0x3cd7ff+':'+_0x5dd3b9['id'],_0x5dd3b9);WhatsappQueueEvents[_0x6c7e('0x4')](_0x3cd7ff,_0x5dd3b9);_0x417ba5(null);};}for(var e in events){if(events[_0x6c7e('0x5')](e)){var event=events[e];WhatsappQueue[_0x6c7e('0x6')](e,emitEvent(event));}}module[_0x6c7e('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 499546f..8be4e60 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 _0x4599=['define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes'];(function(_0x19745c,_0x4c9605){var _0x1b01c8=function(_0x28eb58){while(--_0x28eb58){_0x19745c['push'](_0x19745c['shift']());}};_0x1b01c8(++_0x4c9605);}(_0x4599,0xfa));var _0x9459=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4599[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x9459('0x0'));var logger=require(_0x9459('0x1'))(_0x9459('0x2'));var moment=require(_0x9459('0x3'));var BPromise=require(_0x9459('0x4'));var rp=require(_0x9459('0x5'));var fs=require('fs');var path=require(_0x9459('0x6'));var rimraf=require(_0x9459('0x7'));var config=require(_0x9459('0x8'));var attributes=require(_0x9459('0x9'));module['exports']=function(_0x9049f8,_0x4de306){return _0x9049f8[_0x9459('0xa')](_0x9459('0xb'),attributes,{'tableName':_0x9459('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0a9=['WhatsappQueue','whatsapp_queues','util','../../config/logger','api','bluebird','rimraf','./whatsappQueue.attributes','exports'];(function(_0x58cf2b,_0x4b3053){var _0x57bfa9=function(_0x3ef34f){while(--_0x3ef34f){_0x58cf2b['push'](_0x58cf2b['shift']());}};_0x57bfa9(++_0x4b3053);}(_0xf0a9,0x9b));var _0x9f0a=function(_0x4bd82f,_0x3cb7d9){_0x4bd82f=_0x4bd82f-0x0;var _0xaf8563=_0xf0a9[_0x4bd82f];return _0xaf8563;};'use strict';var _=require('lodash');var util=require(_0x9f0a('0x0'));var logger=require(_0x9f0a('0x1'))(_0x9f0a('0x2'));var moment=require('moment');var BPromise=require(_0x9f0a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9f0a('0x4'));var config=require('../../config/environment');var attributes=require(_0x9f0a('0x5'));module[_0x9f0a('0x6')]=function(_0xd7593e,_0x14b7f6){return _0xd7593e['define'](_0x9f0a('0x7'),attributes,{'tableName':_0x9f0a('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 fab41e4..fb446d0 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 _0xb15d=['message','result','GetWhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','debug','catch','ShowWhatsappQueue','WhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5e4ffa,_0x56154d){var _0x43a656=function(_0x507ed4){while(--_0x507ed4){_0x5e4ffa['push'](_0x5e4ffa['shift']());}};_0x43a656(++_0x56154d);}(_0xb15d,0x101));var _0xdb15=function(_0x15df2d,_0x4b41ab){_0x15df2d=_0x15df2d-0x0;var _0x503c12=_0xb15d[_0x15df2d];return _0x503c12;};'use strict';var _=require(_0xdb15('0x0'));var util=require(_0xdb15('0x1'));var moment=require(_0xdb15('0x2'));var BPromise=require(_0xdb15('0x3'));var rs=require(_0xdb15('0x4'));var fs=require('fs');var Redis=require(_0xdb15('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb15('0x6'));var logger=require('../../config/logger')(_0xdb15('0x7'));var config=require('../../config/environment');var jayson=require(_0xdb15('0x8'));var client=jayson[_0xdb15('0x9')][_0xdb15('0xa')]({'port':0x232a});config[_0xdb15('0xb')]=_['defaults'](config[_0xdb15('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb15('0xc'))(new Redis(config[_0xdb15('0xb')]));require(_0xdb15('0xd'))[_0xdb15('0xe')](socket);function respondWithRpcPromise(_0x25db83,_0x12c118,_0x22dde8){return new BPromise(function(_0x352e85,_0x4850ae){return client['request'](_0x25db83,_0x22dde8)[_0xdb15('0xf')](function(_0x3c7c82){logger[_0xdb15('0x10')](_0xdb15('0x11'),_0x12c118,'request\x20sent');logger['debug'](_0xdb15('0x12'),_0x12c118,_0xdb15('0x13'),JSON[_0xdb15('0x14')](_0x3c7c82));if(_0x3c7c82['error']){if(_0x3c7c82[_0xdb15('0x15')][_0xdb15('0x16')]===0x1f4){logger[_0xdb15('0x15')](_0xdb15('0x11'),_0x12c118,_0x3c7c82[_0xdb15('0x15')][_0xdb15('0x17')]);return _0x4850ae(_0x3c7c82['error'][_0xdb15('0x17')]);}logger[_0xdb15('0x15')](_0xdb15('0x11'),_0x12c118,_0x3c7c82['error'][_0xdb15('0x17')]);return _0x352e85(_0x3c7c82[_0xdb15('0x15')]['message']);}else{logger['info'](_0xdb15('0x11'),_0x12c118,_0xdb15('0x13'));_0x352e85(_0x3c7c82[_0xdb15('0x18')]['message']);}})['catch'](function(_0x5aebee){logger[_0xdb15('0x15')](_0xdb15('0x11'),_0x12c118,_0x5aebee);_0x4850ae(_0x5aebee);});});}exports[_0xdb15('0x19')]=function(_0x249d64){var _0x1c8ab8=this;return new Promise(function(_0x508b2a,_0xdfbbd8){return db['WhatsappQueue'][_0xdb15('0x1a')]({'raw':_0x249d64[_0xdb15('0x1b')]?_0x249d64[_0xdb15('0x1b')][_0xdb15('0x1c')]===undefined?!![]:![]:!![],'where':_0x249d64[_0xdb15('0x1b')]?_0x249d64['options'][_0xdb15('0x1d')]||null:null,'attributes':_0x249d64[_0xdb15('0x1b')]?_0x249d64[_0xdb15('0x1b')]['attributes']||null:null,'limit':_0x249d64[_0xdb15('0x1b')]?_0x249d64[_0xdb15('0x1b')][_0xdb15('0x1e')]||null:null,'include':_0x249d64[_0xdb15('0x1b')]?_0x249d64['options'][_0xdb15('0x1f')]?_[_0xdb15('0x20')](_0x249d64[_0xdb15('0x1b')][_0xdb15('0x1f')],function(_0x3a4b5c){return{'model':db[_0x3a4b5c[_0xdb15('0x21')]],'as':_0x3a4b5c['as'],'attributes':_0x3a4b5c[_0xdb15('0x22')],'include':_0x3a4b5c[_0xdb15('0x1f')]?_[_0xdb15('0x20')](_0x3a4b5c['include'],function(_0x4e8cfe){return{'model':db[_0x4e8cfe[_0xdb15('0x21')]],'as':_0x4e8cfe['as'],'attributes':_0x4e8cfe[_0xdb15('0x22')],'include':_0x4e8cfe[_0xdb15('0x1f')]?_[_0xdb15('0x20')](_0x4e8cfe['include'],function(_0xf2cfbe){return{'model':db[_0xf2cfbe[_0xdb15('0x21')]],'as':_0xf2cfbe['as'],'attributes':_0xf2cfbe[_0xdb15('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d57bd){logger['info'](_0xdb15('0x19'),_0x249d64);logger[_0xdb15('0x23')](_0xdb15('0x19'),_0x249d64,JSON[_0xdb15('0x14')](_0x4d57bd));_0x508b2a(_0x4d57bd);})[_0xdb15('0x24')](function(_0x29d2de){logger[_0xdb15('0x15')](_0xdb15('0x19'),_0x29d2de[_0xdb15('0x17')],_0x249d64);_0xdfbbd8(_0x1c8ab8[_0xdb15('0x15')](0x1f4,_0x29d2de[_0xdb15('0x17')]));});});};exports[_0xdb15('0x25')]=function(_0x23b7f0){var _0x741cef=this;return new Promise(function(_0x135f0d,_0x5d6d1f){return db[_0xdb15('0x26')][_0xdb15('0x27')]({'raw':_0x23b7f0['options']?_0x23b7f0[_0xdb15('0x1b')][_0xdb15('0x1c')]===undefined?!![]:![]:!![],'where':_0x23b7f0[_0xdb15('0x1b')]?_0x23b7f0[_0xdb15('0x1b')]['where']||null:null,'attributes':_0x23b7f0[_0xdb15('0x1b')]?_0x23b7f0[_0xdb15('0x1b')]['attributes']||null:null,'include':_0x23b7f0['options']?_0x23b7f0[_0xdb15('0x1b')][_0xdb15('0x1f')]?_['map'](_0x23b7f0[_0xdb15('0x1b')][_0xdb15('0x1f')],function(_0x21b344){return{'model':db[_0x21b344[_0xdb15('0x21')]],'as':_0x21b344['as'],'attributes':_0x21b344['attributes'],'include':_0x21b344['include']?_[_0xdb15('0x20')](_0x21b344[_0xdb15('0x1f')],function(_0xeb9d9c){return{'model':db[_0xeb9d9c[_0xdb15('0x21')]],'as':_0xeb9d9c['as'],'attributes':_0xeb9d9c[_0xdb15('0x22')],'include':_0xeb9d9c[_0xdb15('0x1f')]?_['map'](_0xeb9d9c['include'],function(_0x50c2ec){return{'model':db[_0x50c2ec['model']],'as':_0x50c2ec['as'],'attributes':_0x50c2ec[_0xdb15('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdb15('0xf')](function(_0x26665b){logger[_0xdb15('0x10')]('ShowWhatsappQueue',_0x23b7f0);logger['debug']('ShowWhatsappQueue',_0x23b7f0,JSON[_0xdb15('0x14')](_0x26665b));_0x135f0d(_0x26665b);})[_0xdb15('0x24')](function(_0x215e67){logger[_0xdb15('0x15')](_0xdb15('0x25'),_0x215e67['message'],_0x23b7f0);_0x5d6d1f(_0x741cef['error'](0x1f4,_0x215e67[_0xdb15('0x17')]));});});}; \ No newline at end of file +var _0x90ef=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','info','request\x20sent','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch','WhatsappQueue','findAll','options','raw','where','attributes','map','include','model','then','GetWhatsappQueue','debug','stringify','ShowWhatsappQueue','find','lodash','util','moment'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x90ef,0x10e));var _0xf90e=function(_0x36d94f,_0x5e30f4){_0x36d94f=_0x36d94f-0x0;var _0x467193=_0x90ef[_0x36d94f];return _0x467193;};'use strict';var _=require(_0xf90e('0x0'));var util=require(_0xf90e('0x1'));var moment=require(_0xf90e('0x2'));var BPromise=require(_0xf90e('0x3'));var rs=require(_0xf90e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf90e('0x5'))['db'];var utils=require(_0xf90e('0x6'));var logger=require(_0xf90e('0x7'))(_0xf90e('0x8'));var config=require(_0xf90e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf90e('0xa')]({'port':0x232a});config[_0xf90e('0xb')]=_[_0xf90e('0xc')](config[_0xf90e('0xb')],{'host':_0xf90e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf90e('0xb')]));require(_0xf90e('0xe'))[_0xf90e('0xf')](socket);function respondWithRpcPromise(_0x491667,_0x4c7a18,_0x55907c){return new BPromise(function(_0xee471c,_0x1c2ea0){return client[_0xf90e('0x10')](_0x491667,_0x55907c)['then'](function(_0x3a429d){logger[_0xf90e('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x4c7a18,_0xf90e('0x12'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4c7a18,_0xf90e('0x12'),JSON['stringify'](_0x3a429d));if(_0x3a429d['error']){if(_0x3a429d['error']['code']===0x1f4){logger[_0xf90e('0x13')](_0xf90e('0x14'),_0x4c7a18,_0x3a429d['error'][_0xf90e('0x15')]);return _0x1c2ea0(_0x3a429d[_0xf90e('0x13')][_0xf90e('0x15')]);}logger[_0xf90e('0x13')](_0xf90e('0x14'),_0x4c7a18,_0x3a429d[_0xf90e('0x13')]['message']);return _0xee471c(_0x3a429d['error']['message']);}else{logger[_0xf90e('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x4c7a18,_0xf90e('0x12'));_0xee471c(_0x3a429d[_0xf90e('0x16')]['message']);}})[_0xf90e('0x17')](function(_0x3d3263){logger[_0xf90e('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x4c7a18,_0x3d3263);_0x1c2ea0(_0x3d3263);});});}exports['GetWhatsappQueue']=function(_0x3e73f0){var _0x419673=this;return new Promise(function(_0x372f3b,_0x352f87){return db[_0xf90e('0x18')][_0xf90e('0x19')]({'raw':_0x3e73f0[_0xf90e('0x1a')]?_0x3e73f0['options'][_0xf90e('0x1b')]===undefined?!![]:![]:!![],'where':_0x3e73f0[_0xf90e('0x1a')]?_0x3e73f0[_0xf90e('0x1a')][_0xf90e('0x1c')]||null:null,'attributes':_0x3e73f0['options']?_0x3e73f0[_0xf90e('0x1a')][_0xf90e('0x1d')]||null:null,'limit':_0x3e73f0[_0xf90e('0x1a')]?_0x3e73f0['options']['limit']||null:null,'include':_0x3e73f0['options']?_0x3e73f0['options']['include']?_[_0xf90e('0x1e')](_0x3e73f0[_0xf90e('0x1a')][_0xf90e('0x1f')],function(_0x51f172){return{'model':db[_0x51f172[_0xf90e('0x20')]],'as':_0x51f172['as'],'attributes':_0x51f172[_0xf90e('0x1d')],'include':_0x51f172['include']?_[_0xf90e('0x1e')](_0x51f172['include'],function(_0x2bb209){return{'model':db[_0x2bb209[_0xf90e('0x20')]],'as':_0x2bb209['as'],'attributes':_0x2bb209['attributes'],'include':_0x2bb209[_0xf90e('0x1f')]?_[_0xf90e('0x1e')](_0x2bb209[_0xf90e('0x1f')],function(_0x42847b){return{'model':db[_0x42847b['model']],'as':_0x42847b['as'],'attributes':_0x42847b[_0xf90e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf90e('0x21')](function(_0x2b533f){logger['info'](_0xf90e('0x22'),_0x3e73f0);logger[_0xf90e('0x23')]('GetWhatsappQueue',_0x3e73f0,JSON[_0xf90e('0x24')](_0x2b533f));_0x372f3b(_0x2b533f);})['catch'](function(_0x4cf953){logger[_0xf90e('0x13')]('GetWhatsappQueue',_0x4cf953[_0xf90e('0x15')],_0x3e73f0);_0x352f87(_0x419673[_0xf90e('0x13')](0x1f4,_0x4cf953[_0xf90e('0x15')]));});});};exports[_0xf90e('0x25')]=function(_0x37ae62){var _0x2bec5f=this;return new Promise(function(_0x5e43aa,_0xba8790){return db['WhatsappQueue'][_0xf90e('0x26')]({'raw':_0x37ae62[_0xf90e('0x1a')]?_0x37ae62[_0xf90e('0x1a')][_0xf90e('0x1b')]===undefined?!![]:![]:!![],'where':_0x37ae62['options']?_0x37ae62[_0xf90e('0x1a')][_0xf90e('0x1c')]||null:null,'attributes':_0x37ae62[_0xf90e('0x1a')]?_0x37ae62['options']['attributes']||null:null,'include':_0x37ae62[_0xf90e('0x1a')]?_0x37ae62[_0xf90e('0x1a')][_0xf90e('0x1f')]?_['map'](_0x37ae62[_0xf90e('0x1a')][_0xf90e('0x1f')],function(_0x3736ef){return{'model':db[_0x3736ef['model']],'as':_0x3736ef['as'],'attributes':_0x3736ef[_0xf90e('0x1d')],'include':_0x3736ef[_0xf90e('0x1f')]?_[_0xf90e('0x1e')](_0x3736ef[_0xf90e('0x1f')],function(_0x4eff0c){return{'model':db[_0x4eff0c[_0xf90e('0x20')]],'as':_0x4eff0c['as'],'attributes':_0x4eff0c[_0xf90e('0x1d')],'include':_0x4eff0c['include']?_[_0xf90e('0x1e')](_0x4eff0c[_0xf90e('0x1f')],function(_0x2468db){return{'model':db[_0x2468db[_0xf90e('0x20')]],'as':_0x2468db['as'],'attributes':_0x2468db[_0xf90e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf90e('0x21')](function(_0x35951a){logger[_0xf90e('0x11')](_0xf90e('0x25'),_0x37ae62);logger[_0xf90e('0x23')](_0xf90e('0x25'),_0x37ae62,JSON[_0xf90e('0x24')](_0x35951a));_0x5e43aa(_0x35951a);})['catch'](function(_0x492cd6){logger[_0xf90e('0x13')]('ShowWhatsappQueue',_0x492cd6[_0xf90e('0x15')],_0x37ae62);_0xba8790(_0x2bec5f[_0xf90e('0x13')](0x1f4,_0x492cd6[_0xf90e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 2ea2a48..d8a9be6 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 _0x90df=['./whatsappQueue.events','remove','update','emit','removeListener','register'];(function(_0x26df48,_0x22aa50){var _0x209047=function(_0x1d068b){while(--_0x1d068b){_0x26df48['push'](_0x26df48['shift']());}};_0x209047(++_0x22aa50);}(_0x90df,0x13e));var _0xf90d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90df[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappQueueEvents=require(_0xf90d('0x0'));var events=['save',_0xf90d('0x1'),_0xf90d('0x2')];function createListener(_0x5b4721,_0x2a13d7){return function(_0x1260e9){_0x2a13d7[_0xf90d('0x3')](_0x5b4721,_0x1260e9);};}function removeListener(_0x31c98e,_0x36a3e5){return function(){WhatsappQueueEvents[_0xf90d('0x4')](_0x31c98e,_0x36a3e5);};}exports[_0xf90d('0x5')]=function(_0x29cf1c){for(var _0x5c5861=0x0,_0x564b7a=events['length'];_0x5c5861<_0x564b7a;_0x5c5861++){var _0x39261b=events[_0x5c5861];var _0x339779=createListener('whatsappQueue:'+_0x39261b,_0x29cf1c);WhatsappQueueEvents['on'](_0x39261b,_0x339779);}}; \ No newline at end of file +var _0x6da2=['length','save','remove','update','emit','removeListener','register'];(function(_0xd8a91d,_0x10e7ca){var _0x4417c0=function(_0x2428ee){while(--_0x2428ee){_0xd8a91d['push'](_0xd8a91d['shift']());}};_0x4417c0(++_0x10e7ca);}(_0x6da2,0x9b));var _0x26da=function(_0x146b09,_0x345cd3){_0x146b09=_0x146b09-0x0;var _0x4e9e36=_0x6da2[_0x146b09];return _0x4e9e36;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x26da('0x0'),_0x26da('0x1'),_0x26da('0x2')];function createListener(_0x41368a,_0x4e5123){return function(_0x1fd75e){_0x4e5123[_0x26da('0x3')](_0x41368a,_0x1fd75e);};}function removeListener(_0x237c3e,_0x3626a7){return function(){WhatsappQueueEvents[_0x26da('0x4')](_0x237c3e,_0x3626a7);};}exports[_0x26da('0x5')]=function(_0x12c9d4){for(var _0x347ba0=0x0,_0x27ff19=events[_0x26da('0x6')];_0x347ba0<_0x27ff19;_0x347ba0++){var _0x454b78=events[_0x347ba0];var _0x177d7f=createListener('whatsappQueue:'+_0x454b78,_0x12c9d4);WhatsappQueueEvents['on'](_0x454b78,_0x177d7f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 5fa688a..3fb90ab 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 _0x23c9=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x23c9,0x1ed));var _0x923c=function(_0x405f28,_0x3ea99f){_0x405f28=_0x405f28-0x0;var _0x1a6075=_0x23c9[_0x405f28];return _0x1a6075;};'use strict';var multer=require(_0x923c('0x0'));var util=require('util');var path=require(_0x923c('0x1'));var timeout=require('connect-timeout');var express=require(_0x923c('0x2'));var router=express[_0x923c('0x3')]();var fs_extra=require(_0x923c('0x4'));var auth=require(_0x923c('0x5'));var interaction=require(_0x923c('0x6'));var config=require(_0x923c('0x7'));var controller=require(_0x923c('0x8'));router['get']('/',auth[_0x923c('0x9')](),controller[_0x923c('0xa')]);router[_0x923c('0xb')](_0x923c('0xc'),auth[_0x923c('0x9')](),controller[_0x923c('0xd')]);router[_0x923c('0xb')](_0x923c('0xe'),auth[_0x923c('0x9')](),controller['show']);router[_0x923c('0xf')]('/',auth['isAuthenticated'](),controller[_0x923c('0x10')]);router[_0x923c('0x11')](_0x923c('0xe'),auth[_0x923c('0x9')](),controller[_0x923c('0x12')]);router[_0x923c('0x13')](_0x923c('0xe'),auth['isAuthenticated'](),controller[_0x923c('0x14')]);module[_0x923c('0x15')]=router; \ No newline at end of file +var _0x79ea=['/:id','update','destroy','exports','multer','connect-timeout','Router','fs-extra','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x3fc833,_0x5f25e7){var _0x493f24=function(_0x315c42){while(--_0x315c42){_0x3fc833['push'](_0x3fc833['shift']());}};_0x493f24(++_0x5f25e7);}(_0x79ea,0x8b));var _0xa79e=function(_0x90f34f,_0x404021){_0x90f34f=_0x90f34f-0x0;var _0x4b18cf=_0x79ea[_0x90f34f];return _0x4b18cf;};'use strict';var multer=require(_0xa79e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa79e('0x1'));var express=require('express');var router=express[_0xa79e('0x2')]();var fs_extra=require(_0xa79e('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router[_0xa79e('0x4')]('/',auth[_0xa79e('0x5')](),controller[_0xa79e('0x6')]);router[_0xa79e('0x4')](_0xa79e('0x7'),auth['isAuthenticated'](),controller[_0xa79e('0x8')]);router[_0xa79e('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xa79e('0x9')]);router[_0xa79e('0xa')]('/',auth[_0xa79e('0x5')](),controller['create']);router['put'](_0xa79e('0xb'),auth[_0xa79e('0x5')](),controller[_0xa79e('0xc')]);router['delete'](_0xa79e('0xb'),auth[_0xa79e('0x5')](),controller[_0xa79e('0xd')]);module[_0xa79e('0xe')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index ac01148..5aa51ac 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(_0x1cdf9c,_0x3b3b20){var _0x36caf8=function(_0x4d134b){while(--_0x4d134b){_0x1cdf9c['push'](_0x1cdf9c['shift']());}};_0x36caf8(++_0x3b3b20);}(_0x7a54,0x106));var _0x47a5=function(_0x5abcbf,_0x2c9233){_0x5abcbf=_0x5abcbf-0x0;var _0x3310ef=_0x7a54[_0x5abcbf];return _0x3310ef;};'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(_0x3a08ef,_0x59a1c5){var _0x2cacdc=function(_0x50d491){while(--_0x50d491){_0x3a08ef['push'](_0x3a08ef['shift']());}};_0x2cacdc(++_0x59a1c5);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 1b17d72..6f9d0bd 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 _0xb574=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','WhatsappQueueReport','findAll','rows','catch','params','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x38bfde,_0x1b3b32){var _0x185305=function(_0x806fcd){while(--_0x806fcd){_0x38bfde['push'](_0x38bfde['shift']());}};_0x185305(++_0x1b3b32);}(_0xb574,0x106));var _0x4b57=function(_0x69197a,_0x48af83){_0x69197a=_0x69197a-0x0;var _0x31a7a0=_0xb574[_0x69197a];return _0x31a7a0;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];function respondWithStatusCode(_0x357c8b,_0x43d066){_0x43d066=_0x43d066||0xcc;return function(_0xf8a6fc){if(_0xf8a6fc){return _0x357c8b[_0x4b57('0x16')](_0x43d066);}return _0x357c8b[_0x4b57('0x17')](_0x43d066)[_0x4b57('0x18')]();};}function respondWithResult(_0xd5ee6d,_0x31cced){_0x31cced=_0x31cced||0xc8;return function(_0x4e15be){if(_0x4e15be){return _0xd5ee6d['status'](_0x31cced)[_0x4b57('0x19')](_0x4e15be);}};}function respondWithFilteredResult(_0x24f776,_0x10b9ff){return function(_0x58d6bd){if(_0x58d6bd){var _0x284640=typeof _0x10b9ff['offset']===_0x4b57('0x1a')&&typeof _0x10b9ff[_0x4b57('0x1b')]===_0x4b57('0x1a');var _0x10eda5=_0x58d6bd[_0x4b57('0x1c')];var _0xfb71cc=_0x284640?0x0:_0x10b9ff['offset'];var _0x1b35ff=_0x284640?_0x58d6bd[_0x4b57('0x1c')]:_0x10b9ff[_0x4b57('0x1d')]+_0x10b9ff[_0x4b57('0x1b')];var _0x4baaeb;if(_0x1b35ff>=_0x10eda5){_0x1b35ff=_0x10eda5;_0x4baaeb=0xc8;}else{_0x4baaeb=0xce;}_0x24f776[_0x4b57('0x17')](_0x4baaeb);return _0x24f776[_0x4b57('0x1e')](_0x4b57('0x1f'),_0xfb71cc+'-'+_0x1b35ff+'/'+_0x10eda5)[_0x4b57('0x19')](_0x58d6bd);}return null;};}function patchUpdates(_0xef1eae){return function(_0x4454c8){try{jsonpatch['apply'](_0x4454c8,_0xef1eae,!![]);}catch(_0x4b504b){return BPromise[_0x4b57('0x20')](_0x4b504b);}return _0x4454c8[_0x4b57('0x21')]();};}function saveUpdates(_0x567d8f,_0x380554){return function(_0x4a34b2){if(_0x4a34b2){return _0x4a34b2[_0x4b57('0x22')](_0x567d8f)[_0x4b57('0x23')](function(_0x56f017){return _0x56f017;});}return null;};}function removeEntity(_0x271361,_0x368c5f){return function(_0x4d07c9){if(_0x4d07c9){return _0x4d07c9[_0x4b57('0x24')]()[_0x4b57('0x23')](function(){_0x271361[_0x4b57('0x17')](0xcc)[_0x4b57('0x18')]();});}};}function handleEntityNotFound(_0x540eff,_0x156962){return function(_0x51d0c3){if(!_0x51d0c3){_0x540eff[_0x4b57('0x16')](0x194);}return _0x51d0c3;};}function handleError(_0x517119,_0x36ceb1){_0x36ceb1=_0x36ceb1||0x1f4;return function(_0x2dc9d8){logger[_0x4b57('0x25')](_0x2dc9d8[_0x4b57('0x26')]);if(_0x2dc9d8[_0x4b57('0x27')]){delete _0x2dc9d8[_0x4b57('0x27')];}_0x517119['status'](_0x36ceb1)['send'](_0x2dc9d8);};}exports[_0x4b57('0x28')]=function(_0x4c58e4,_0x1ea0cb){var _0x458f70={},_0x874cf7={},_0x3af22f={'count':0x0,'rows':[]};var _0x249461=_[_0x4b57('0x29')](db['WhatsappQueueReport'][_0x4b57('0x2a')],function(_0x2e9922){return{'name':_0x2e9922[_0x4b57('0x2b')],'type':_0x2e9922[_0x4b57('0x2c')]['key']};});_0x874cf7[_0x4b57('0x2d')]=_[_0x4b57('0x29')](_0x249461,'name');_0x874cf7[_0x4b57('0x2e')]=_[_0x4b57('0x2f')](_0x4c58e4[_0x4b57('0x2e')]);_0x874cf7[_0x4b57('0x30')]=_['intersection'](_0x874cf7['model'],_0x874cf7['query']);_0x458f70[_0x4b57('0x31')]=_[_0x4b57('0x32')](_0x874cf7[_0x4b57('0x2d')],qs[_0x4b57('0x33')](_0x4c58e4[_0x4b57('0x2e')]['fields']));_0x458f70[_0x4b57('0x31')]=_0x458f70[_0x4b57('0x31')][_0x4b57('0x34')]?_0x458f70['attributes']:_0x874cf7[_0x4b57('0x2d')];if(!_0x4c58e4[_0x4b57('0x2e')][_0x4b57('0x35')]('nolimit')){_0x458f70[_0x4b57('0x1b')]=qs[_0x4b57('0x1b')](_0x4c58e4['query'][_0x4b57('0x1b')]);_0x458f70[_0x4b57('0x1d')]=qs[_0x4b57('0x1d')](_0x4c58e4[_0x4b57('0x2e')][_0x4b57('0x1d')]);}_0x458f70[_0x4b57('0x36')]=qs['sort'](_0x4c58e4[_0x4b57('0x2e')][_0x4b57('0x37')]);_0x458f70[_0x4b57('0x38')]=qs[_0x4b57('0x30')](_[_0x4b57('0x39')](_0x4c58e4[_0x4b57('0x2e')],_0x874cf7[_0x4b57('0x30')]),_0x249461);if(_0x4c58e4['query']['filter']){_0x458f70[_0x4b57('0x38')]=_[_0x4b57('0x3a')](_0x458f70[_0x4b57('0x38')],{'$or':_['map'](_0x249461,function(_0x40414f){if(_0x40414f[_0x4b57('0x2c')]!==_0x4b57('0x3b')){var _0x3c086e={};_0x3c086e[_0x40414f['name']]={'$like':'%'+_0x4c58e4[_0x4b57('0x2e')][_0x4b57('0x3c')]+'%'};return _0x3c086e;}})});}_0x458f70=_[_0x4b57('0x3a')]({},_0x458f70,_0x4c58e4[_0x4b57('0x3d')]);var _0x56528f={'where':_0x458f70['where']};return db['WhatsappQueueReport'][_0x4b57('0x1c')](_0x56528f)[_0x4b57('0x23')](function(_0x188f24){_0x3af22f[_0x4b57('0x1c')]=_0x188f24;if(_0x4c58e4['query'][_0x4b57('0x3e')]){_0x458f70[_0x4b57('0x3f')]=[{'all':!![]}];}return db[_0x4b57('0x40')][_0x4b57('0x41')](_0x458f70);})[_0x4b57('0x23')](function(_0x453129){_0x3af22f[_0x4b57('0x42')]=_0x453129;return _0x3af22f;})[_0x4b57('0x23')](respondWithFilteredResult(_0x1ea0cb,_0x458f70))[_0x4b57('0x43')](handleError(_0x1ea0cb,null));};exports['show']=function(_0x318187,_0x3685fd){var _0x3c5095={'raw':!![],'where':{'id':_0x318187[_0x4b57('0x44')]['id']}},_0x5b2f50={};_0x5b2f50['model']=_[_0x4b57('0x2f')](db[_0x4b57('0x40')][_0x4b57('0x2a')]);_0x5b2f50[_0x4b57('0x2e')]=_[_0x4b57('0x2f')](_0x318187[_0x4b57('0x2e')]);_0x5b2f50[_0x4b57('0x30')]=_[_0x4b57('0x32')](_0x5b2f50[_0x4b57('0x2d')],_0x5b2f50[_0x4b57('0x2e')]);_0x3c5095[_0x4b57('0x31')]=_[_0x4b57('0x32')](_0x5b2f50[_0x4b57('0x2d')],qs['fields'](_0x318187['query'][_0x4b57('0x33')]));_0x3c5095[_0x4b57('0x31')]=_0x3c5095[_0x4b57('0x31')][_0x4b57('0x34')]?_0x3c5095['attributes']:_0x5b2f50[_0x4b57('0x2d')];if(_0x318187[_0x4b57('0x2e')]['includeAll']){_0x3c5095[_0x4b57('0x3f')]=[{'all':!![]}];}_0x3c5095=_['merge']({},_0x3c5095,_0x318187[_0x4b57('0x3d')]);return db['WhatsappQueueReport']['find'](_0x3c5095)[_0x4b57('0x23')](handleEntityNotFound(_0x3685fd,null))[_0x4b57('0x23')](respondWithResult(_0x3685fd,null))['catch'](handleError(_0x3685fd,null));};exports[_0x4b57('0x45')]=function(_0xc19684,_0x2732ff){return db[_0x4b57('0x40')][_0x4b57('0x45')](_0xc19684[_0x4b57('0x46')],{})['then'](respondWithResult(_0x2732ff,0xc9))[_0x4b57('0x43')](handleError(_0x2732ff,null));};exports[_0x4b57('0x22')]=function(_0x4a632c,_0xd529fb){if(_0x4a632c[_0x4b57('0x46')]['id']){delete _0x4a632c[_0x4b57('0x46')]['id'];}return db['WhatsappQueueReport'][_0x4b57('0x47')]({'where':{'id':_0x4a632c['params']['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0xd529fb,null))[_0x4b57('0x23')](saveUpdates(_0x4a632c[_0x4b57('0x46')],null))[_0x4b57('0x23')](respondWithResult(_0xd529fb,null))[_0x4b57('0x43')](handleError(_0xd529fb,null));};exports[_0x4b57('0x24')]=function(_0x3d1ecd,_0x3ec6ba){return db['WhatsappQueueReport'][_0x4b57('0x47')]({'where':{'id':_0x3d1ecd[_0x4b57('0x44')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x3ec6ba,null))['then'](removeEntity(_0x3ec6ba,null))[_0x4b57('0x43')](handleError(_0x3ec6ba,null));};exports[_0x4b57('0x48')]=function(_0x32985f,_0x488bea){return db[_0x4b57('0x40')][_0x4b57('0x48')]()[_0x4b57('0x23')](respondWithResult(_0x488bea,null))[_0x4b57('0x43')](handleError(_0x488bea,null));}; \ No newline at end of file +var _0xae60=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','index','WhatsappQueueReport','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x221856,_0x967124){var _0x5b31db=function(_0x2e91b2){while(--_0x2e91b2){_0x221856['push'](_0x221856['shift']());}};_0x5b31db(++_0x967124);}(_0xae60,0x1c7));var _0x0ae6=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xae60[_0x565ed7];return _0x183ad7;};'use strict';var emlformat=require(_0x0ae6('0x0'));var rimraf=require(_0x0ae6('0x1'));var zipdir=require(_0x0ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae6('0x3'));var moment=require(_0x0ae6('0x4'));var BPromise=require(_0x0ae6('0x5'));var Mustache=require('mustache');var util=require(_0x0ae6('0x6'));var path=require(_0x0ae6('0x7'));var sox=require('sox');var csv=require(_0x0ae6('0x8'));var ejs=require(_0x0ae6('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae6('0xa'));var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var licenseUtil=require(_0x0ae6('0x1a'));var db=require(_0x0ae6('0x1b'))['db'];function respondWithStatusCode(_0x3b05a4,_0x30f8f9){_0x30f8f9=_0x30f8f9||0xcc;return function(_0x1aefd5){if(_0x1aefd5){return _0x3b05a4[_0x0ae6('0x1c')](_0x30f8f9);}return _0x3b05a4[_0x0ae6('0x1d')](_0x30f8f9)[_0x0ae6('0x1e')]();};}function respondWithResult(_0x4d2da8,_0x3809c6){_0x3809c6=_0x3809c6||0xc8;return function(_0x10c3bc){if(_0x10c3bc){return _0x4d2da8[_0x0ae6('0x1d')](_0x3809c6)[_0x0ae6('0x1f')](_0x10c3bc);}};}function respondWithFilteredResult(_0xce3e23,_0x3a1e26){return function(_0x151144){if(_0x151144){var _0x3b64ac=typeof _0x3a1e26[_0x0ae6('0x20')]===_0x0ae6('0x21')&&typeof _0x3a1e26[_0x0ae6('0x22')]===_0x0ae6('0x21');var _0xa97151=_0x151144[_0x0ae6('0x23')];var _0xda4f01=_0x3b64ac?0x0:_0x3a1e26[_0x0ae6('0x20')];var _0x2fdf25=_0x3b64ac?_0x151144[_0x0ae6('0x23')]:_0x3a1e26[_0x0ae6('0x20')]+_0x3a1e26[_0x0ae6('0x22')];var _0x26b369;if(_0x2fdf25>=_0xa97151){_0x2fdf25=_0xa97151;_0x26b369=0xc8;}else{_0x26b369=0xce;}_0xce3e23[_0x0ae6('0x1d')](_0x26b369);return _0xce3e23['set'](_0x0ae6('0x24'),_0xda4f01+'-'+_0x2fdf25+'/'+_0xa97151)[_0x0ae6('0x1f')](_0x151144);}return null;};}function patchUpdates(_0x140a3b){return function(_0x1027c2){try{jsonpatch[_0x0ae6('0x25')](_0x1027c2,_0x140a3b,!![]);}catch(_0xb4e6af){return BPromise[_0x0ae6('0x26')](_0xb4e6af);}return _0x1027c2[_0x0ae6('0x27')]();};}function saveUpdates(_0x515f3d,_0x39b22e){return function(_0x2a6484){if(_0x2a6484){return _0x2a6484[_0x0ae6('0x28')](_0x515f3d)[_0x0ae6('0x29')](function(_0x31ad85){return _0x31ad85;});}return null;};}function removeEntity(_0x4eba72,_0x296a9d){return function(_0x4e1242){if(_0x4e1242){return _0x4e1242[_0x0ae6('0x2a')]()[_0x0ae6('0x29')](function(){_0x4eba72[_0x0ae6('0x1d')](0xcc)[_0x0ae6('0x1e')]();});}};}function handleEntityNotFound(_0x5b86fe,_0x3630e6){return function(_0x2dcdb7){if(!_0x2dcdb7){_0x5b86fe['sendStatus'](0x194);}return _0x2dcdb7;};}function handleError(_0x55dbe1,_0x44eb95){_0x44eb95=_0x44eb95||0x1f4;return function(_0x3255a7){logger[_0x0ae6('0x2b')](_0x3255a7['stack']);if(_0x3255a7[_0x0ae6('0x2c')]){delete _0x3255a7[_0x0ae6('0x2c')];}_0x55dbe1[_0x0ae6('0x1d')](_0x44eb95)['send'](_0x3255a7);};}exports[_0x0ae6('0x2d')]=function(_0x29fef3,_0x449c33){var _0x232fbd={},_0x14eed5={},_0x257af5={'count':0x0,'rows':[]};var _0x4fc7bd=_['map'](db[_0x0ae6('0x2e')][_0x0ae6('0x2f')],function(_0x4e6df8){return{'name':_0x4e6df8['fieldName'],'type':_0x4e6df8[_0x0ae6('0x30')][_0x0ae6('0x31')]};});_0x14eed5[_0x0ae6('0x32')]=_[_0x0ae6('0x33')](_0x4fc7bd,'name');_0x14eed5[_0x0ae6('0x34')]=_[_0x0ae6('0x35')](_0x29fef3[_0x0ae6('0x34')]);_0x14eed5['filters']=_[_0x0ae6('0x36')](_0x14eed5[_0x0ae6('0x32')],_0x14eed5[_0x0ae6('0x34')]);_0x232fbd[_0x0ae6('0x37')]=_[_0x0ae6('0x36')](_0x14eed5[_0x0ae6('0x32')],qs[_0x0ae6('0x38')](_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x38')]));_0x232fbd[_0x0ae6('0x37')]=_0x232fbd['attributes'][_0x0ae6('0x39')]?_0x232fbd[_0x0ae6('0x37')]:_0x14eed5['model'];if(!_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x3a')](_0x0ae6('0x3b'))){_0x232fbd['limit']=qs[_0x0ae6('0x22')](_0x29fef3['query']['limit']);_0x232fbd[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x20')]);}_0x232fbd[_0x0ae6('0x3c')]=qs['sort'](_0x29fef3['query'][_0x0ae6('0x3d')]);_0x232fbd['where']=qs[_0x0ae6('0x3e')](_['pick'](_0x29fef3[_0x0ae6('0x34')],_0x14eed5['filters']),_0x4fc7bd);if(_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x3f')]){_0x232fbd[_0x0ae6('0x40')]=_[_0x0ae6('0x41')](_0x232fbd['where'],{'$or':_['map'](_0x4fc7bd,function(_0x43414c){if(_0x43414c[_0x0ae6('0x30')]!==_0x0ae6('0x42')){var _0x59480a={};_0x59480a[_0x43414c[_0x0ae6('0x2c')]]={'$like':'%'+_0x29fef3['query'][_0x0ae6('0x3f')]+'%'};return _0x59480a;}})});}_0x232fbd=_[_0x0ae6('0x41')]({},_0x232fbd,_0x29fef3[_0x0ae6('0x43')]);var _0x19403c={'where':_0x232fbd[_0x0ae6('0x40')]};return db[_0x0ae6('0x2e')]['count'](_0x19403c)[_0x0ae6('0x29')](function(_0x601ef9){_0x257af5[_0x0ae6('0x23')]=_0x601ef9;if(_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x44')]){_0x232fbd[_0x0ae6('0x45')]=[{'all':!![]}];}return db[_0x0ae6('0x2e')][_0x0ae6('0x46')](_0x232fbd);})['then'](function(_0x38faeb){_0x257af5[_0x0ae6('0x47')]=_0x38faeb;return _0x257af5;})[_0x0ae6('0x29')](respondWithFilteredResult(_0x449c33,_0x232fbd))[_0x0ae6('0x48')](handleError(_0x449c33,null));};exports[_0x0ae6('0x49')]=function(_0x167ed1,_0x24c021){var _0x21431e={'raw':!![],'where':{'id':_0x167ed1[_0x0ae6('0x4a')]['id']}},_0xb38cbb={};_0xb38cbb[_0x0ae6('0x32')]=_[_0x0ae6('0x35')](db[_0x0ae6('0x2e')][_0x0ae6('0x2f')]);_0xb38cbb[_0x0ae6('0x34')]=_[_0x0ae6('0x35')](_0x167ed1[_0x0ae6('0x34')]);_0xb38cbb[_0x0ae6('0x3e')]=_['intersection'](_0xb38cbb[_0x0ae6('0x32')],_0xb38cbb[_0x0ae6('0x34')]);_0x21431e[_0x0ae6('0x37')]=_[_0x0ae6('0x36')](_0xb38cbb[_0x0ae6('0x32')],qs[_0x0ae6('0x38')](_0x167ed1['query'][_0x0ae6('0x38')]));_0x21431e[_0x0ae6('0x37')]=_0x21431e[_0x0ae6('0x37')][_0x0ae6('0x39')]?_0x21431e['attributes']:_0xb38cbb['model'];if(_0x167ed1['query'][_0x0ae6('0x44')]){_0x21431e[_0x0ae6('0x45')]=[{'all':!![]}];}_0x21431e=_[_0x0ae6('0x41')]({},_0x21431e,_0x167ed1['options']);return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')](_0x21431e)['then'](handleEntityNotFound(_0x24c021,null))[_0x0ae6('0x29')](respondWithResult(_0x24c021,null))[_0x0ae6('0x48')](handleError(_0x24c021,null));};exports['create']=function(_0x354efd,_0x3d1e75){return db['WhatsappQueueReport'][_0x0ae6('0x4c')](_0x354efd[_0x0ae6('0x4d')],{})[_0x0ae6('0x29')](respondWithResult(_0x3d1e75,0xc9))['catch'](handleError(_0x3d1e75,null));};exports[_0x0ae6('0x28')]=function(_0x21de54,_0x46075a){if(_0x21de54[_0x0ae6('0x4d')]['id']){delete _0x21de54[_0x0ae6('0x4d')]['id'];}return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')]({'where':{'id':_0x21de54['params']['id']}})['then'](handleEntityNotFound(_0x46075a,null))[_0x0ae6('0x29')](saveUpdates(_0x21de54[_0x0ae6('0x4d')],null))[_0x0ae6('0x29')](respondWithResult(_0x46075a,null))['catch'](handleError(_0x46075a,null));};exports[_0x0ae6('0x2a')]=function(_0x51df5c,_0x582a5e){return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')]({'where':{'id':_0x51df5c[_0x0ae6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x582a5e,null))[_0x0ae6('0x29')](removeEntity(_0x582a5e,null))[_0x0ae6('0x48')](handleError(_0x582a5e,null));};exports[_0x0ae6('0x4e')]=function(_0x327b55,_0x173acd){return db[_0x0ae6('0x2e')][_0x0ae6('0x4e')]()[_0x0ae6('0x29')](respondWithResult(_0x173acd,null))[_0x0ae6('0x48')](handleError(_0x173acd,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index f94cfd2..e2b2fa9 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 _0xab97=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xab97,0x185));var _0x7ab9=function(_0x22a67a,_0xc2bdf3){_0x22a67a=_0x22a67a-0x0;var _0x3bb6b3=_0xab97[_0x22a67a];return _0x3bb6b3;};'use strict';var _=require(_0x7ab9('0x0'));var util=require(_0x7ab9('0x1'));var logger=require(_0x7ab9('0x2'))(_0x7ab9('0x3'));var moment=require(_0x7ab9('0x4'));var BPromise=require(_0x7ab9('0x5'));var rp=require(_0x7ab9('0x6'));var fs=require('fs');var path=require(_0x7ab9('0x7'));var rimraf=require(_0x7ab9('0x8'));var config=require('../../config/environment');var attributes=require(_0x7ab9('0x9'));module[_0x7ab9('0xa')]=function(_0x18ba8e,_0x356a6b){return _0x18ba8e[_0x7ab9('0xb')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x7ab9('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xedda=['path','rimraf','../../config/environment','exports','define','WhatsappQueueReport','uniqueid','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x3f0906,_0x4468c0){var _0x4774a8=function(_0x364978){while(--_0x364978){_0x3f0906['push'](_0x3f0906['shift']());}};_0x4774a8(++_0x4468c0);}(_0xedda,0xdf));var _0xaedd=function(_0x4bbb56,_0x4d62a5){_0x4bbb56=_0x4bbb56-0x0;var _0x59fc61=_0xedda[_0x4bbb56];return _0x59fc61;};'use strict';var _=require(_0xaedd('0x0'));var util=require('util');var logger=require(_0xaedd('0x1'))(_0xaedd('0x2'));var moment=require('moment');var BPromise=require(_0xaedd('0x3'));var rp=require(_0xaedd('0x4'));var fs=require('fs');var path=require(_0xaedd('0x5'));var rimraf=require(_0xaedd('0x6'));var config=require(_0xaedd('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0xaedd('0x8')]=function(_0x462a04,_0x1ab65){return _0x462a04[_0xaedd('0x9')](_0xaedd('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xaedd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index c0b2c9d..ce0a321 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 _0xced3=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','create','options','CreateWhatsappQueueReport','debug','WhatsappQueueReport','update','body','where','attributes','limit','UpdateWhatsappQueueReport','util','randomstring'];(function(_0x294e3d,_0x32ad48){var _0x350291=function(_0x43467e){while(--_0x43467e){_0x294e3d['push'](_0x294e3d['shift']());}};_0x350291(++_0x32ad48);}(_0xced3,0x12a));var _0x3ced=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0xced3[_0x74892f];return _0x10ee61;};'use strict';var _=require('lodash');var util=require(_0x3ced('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3ced('0x1'));var fs=require('fs');var Redis=require(_0x3ced('0x2'));var db=require(_0x3ced('0x3'))['db'];var utils=require(_0x3ced('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x3ced('0x5'));var jayson=require(_0x3ced('0x6'));var client=jayson[_0x3ced('0x7')][_0x3ced('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10c80f,_0x2e95e1,_0x203117){return new BPromise(function(_0x4e2c17,_0x17be31){return client[_0x3ced('0x9')](_0x10c80f,_0x203117)[_0x3ced('0xa')](function(_0x47d16d){logger['info'](_0x3ced('0xb'),_0x2e95e1,_0x3ced('0xc'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x2e95e1,_0x3ced('0xc'),JSON[_0x3ced('0xd')](_0x47d16d));if(_0x47d16d[_0x3ced('0xe')]){if(_0x47d16d[_0x3ced('0xe')]['code']===0x1f4){logger[_0x3ced('0xe')](_0x3ced('0xb'),_0x2e95e1,_0x47d16d[_0x3ced('0xe')][_0x3ced('0xf')]);return _0x17be31(_0x47d16d['error'][_0x3ced('0xf')]);}logger[_0x3ced('0xe')](_0x3ced('0xb'),_0x2e95e1,_0x47d16d[_0x3ced('0xe')][_0x3ced('0xf')]);return _0x4e2c17(_0x47d16d[_0x3ced('0xe')]['message']);}else{logger[_0x3ced('0x10')](_0x3ced('0xb'),_0x2e95e1,_0x3ced('0xc'));_0x4e2c17(_0x47d16d[_0x3ced('0x11')][_0x3ced('0xf')]);}})[_0x3ced('0x12')](function(_0x1448fc){logger[_0x3ced('0xe')](_0x3ced('0xb'),_0x2e95e1,_0x1448fc);_0x17be31(_0x1448fc);});});}exports['CreateWhatsappQueueReport']=function(_0x578688){var _0x2cfdfa=this;return new Promise(function(_0x203007,_0x9df975){return db['WhatsappQueueReport'][_0x3ced('0x13')](_0x578688['body'],{'raw':_0x578688['options']?_0x578688[_0x3ced('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x3ced('0xa')](function(_0x2678c3){logger[_0x3ced('0x10')](_0x3ced('0x15'),_0x578688);logger[_0x3ced('0x16')](_0x3ced('0x15'),_0x578688,JSON[_0x3ced('0xd')](_0x2678c3));_0x203007(_0x2678c3);})[_0x3ced('0x12')](function(_0x1bd177){logger[_0x3ced('0xe')](_0x3ced('0x15'),_0x1bd177[_0x3ced('0xf')],_0x578688);_0x9df975(_0x2cfdfa[_0x3ced('0xe')](0x1f4,_0x1bd177['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x19cf03){var _0x2c3068=this;return new Promise(function(_0x256bc4,_0x2817ff){return db[_0x3ced('0x17')][_0x3ced('0x18')](_0x19cf03[_0x3ced('0x19')],{'raw':_0x19cf03[_0x3ced('0x14')]?_0x19cf03[_0x3ced('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19cf03['options']?_0x19cf03['options'][_0x3ced('0x1a')]||null:null,'attributes':_0x19cf03[_0x3ced('0x14')]?_0x19cf03[_0x3ced('0x14')][_0x3ced('0x1b')]||null:null,'limit':_0x19cf03[_0x3ced('0x14')]?_0x19cf03[_0x3ced('0x14')][_0x3ced('0x1c')]||null:null})['then'](function(_0x386a5d){logger['info'](_0x3ced('0x1d'),_0x19cf03);logger[_0x3ced('0x16')](_0x3ced('0x1d'),_0x19cf03,JSON[_0x3ced('0xd')](_0x386a5d));_0x256bc4(_0x386a5d);})[_0x3ced('0x12')](function(_0x4c513b){logger[_0x3ced('0xe')]('UpdateWhatsappQueueReport',_0x4c513b[_0x3ced('0xf')],_0x19cf03);_0x2817ff(_0x2c3068[_0x3ced('0xe')](0x1f4,_0x4c513b['message']));});});}; \ No newline at end of file +var _0x7f97=['message','WhatsappQueueReport,\x20%s,\x20%s','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','attributes','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1f56ab,_0x1e3058){var _0xfe0bf0=function(_0x20350e){while(--_0x20350e){_0x1f56ab['push'](_0x1f56ab['shift']());}};_0xfe0bf0(++_0x1e3058);}(_0x7f97,0x157));var _0x77f9=function(_0x37a58b,_0x34a8a8){_0x37a58b=_0x37a58b-0x0;var _0x4c7399=_0x7f97[_0x37a58b];return _0x4c7399;};'use strict';var _=require('lodash');var util=require(_0x77f9('0x0'));var moment=require(_0x77f9('0x1'));var BPromise=require('bluebird');var rs=require(_0x77f9('0x2'));var fs=require('fs');var Redis=require(_0x77f9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x77f9('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x77f9('0x5'));var jayson=require(_0x77f9('0x6'));var client=jayson['client'][_0x77f9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a833a,_0x29a7b4,_0x1be0b5){return new BPromise(function(_0x1d917a,_0x437964){return client[_0x77f9('0x8')](_0x1a833a,_0x1be0b5)[_0x77f9('0x9')](function(_0x1d2ae5){logger[_0x77f9('0xa')]('WhatsappQueueReport,\x20%s,\x20%s',_0x29a7b4,_0x77f9('0xb'));logger[_0x77f9('0xc')](_0x77f9('0xd'),_0x29a7b4,'request\x20sent',JSON[_0x77f9('0xe')](_0x1d2ae5));if(_0x1d2ae5[_0x77f9('0xf')]){if(_0x1d2ae5[_0x77f9('0xf')][_0x77f9('0x10')]===0x1f4){logger[_0x77f9('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x29a7b4,_0x1d2ae5[_0x77f9('0xf')][_0x77f9('0x11')]);return _0x437964(_0x1d2ae5[_0x77f9('0xf')][_0x77f9('0x11')]);}logger['error'](_0x77f9('0x12'),_0x29a7b4,_0x1d2ae5[_0x77f9('0xf')]['message']);return _0x1d917a(_0x1d2ae5[_0x77f9('0xf')][_0x77f9('0x11')]);}else{logger[_0x77f9('0xa')](_0x77f9('0x12'),_0x29a7b4,_0x77f9('0xb'));_0x1d917a(_0x1d2ae5[_0x77f9('0x13')][_0x77f9('0x11')]);}})[_0x77f9('0x14')](function(_0xa20f3e){logger[_0x77f9('0xf')](_0x77f9('0x12'),_0x29a7b4,_0xa20f3e);_0x437964(_0xa20f3e);});});}exports[_0x77f9('0x15')]=function(_0x1f139c){var _0x425290=this;return new Promise(function(_0x25d561,_0x3a2fdf){return db[_0x77f9('0x16')][_0x77f9('0x17')](_0x1f139c[_0x77f9('0x18')],{'raw':_0x1f139c[_0x77f9('0x19')]?_0x1f139c[_0x77f9('0x19')][_0x77f9('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4a9150){logger['info']('CreateWhatsappQueueReport',_0x1f139c);logger[_0x77f9('0xc')]('CreateWhatsappQueueReport',_0x1f139c,JSON[_0x77f9('0xe')](_0x4a9150));_0x25d561(_0x4a9150);})[_0x77f9('0x14')](function(_0x209a5f){logger[_0x77f9('0xf')](_0x77f9('0x15'),_0x209a5f[_0x77f9('0x11')],_0x1f139c);_0x3a2fdf(_0x425290[_0x77f9('0xf')](0x1f4,_0x209a5f[_0x77f9('0x11')]));});});};exports[_0x77f9('0x1b')]=function(_0x1cbb55){var _0x1b512e=this;return new Promise(function(_0x5874ab,_0x478962){return db[_0x77f9('0x16')][_0x77f9('0x1c')](_0x1cbb55[_0x77f9('0x18')],{'raw':_0x1cbb55['options']?_0x1cbb55[_0x77f9('0x19')][_0x77f9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cbb55[_0x77f9('0x19')]?_0x1cbb55['options']['where']||null:null,'attributes':_0x1cbb55[_0x77f9('0x19')]?_0x1cbb55[_0x77f9('0x19')][_0x77f9('0x1d')]||null:null,'limit':_0x1cbb55[_0x77f9('0x19')]?_0x1cbb55[_0x77f9('0x19')]['limit']||null:null})['then'](function(_0x5e4aa5){logger['info']('UpdateWhatsappQueueReport',_0x1cbb55);logger['debug'](_0x77f9('0x1b'),_0x1cbb55,JSON[_0x77f9('0xe')](_0x5e4aa5));_0x5874ab(_0x5e4aa5);})[_0x77f9('0x14')](function(_0x57479e){logger[_0x77f9('0xf')](_0x77f9('0x1b'),_0x57479e[_0x77f9('0x11')],_0x1cbb55);_0x478962(_0x1b512e[_0x77f9('0xf')](0x1f4,_0x57479e[_0x77f9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index da1abf9..48521fc 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 _0xea19=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5ddf70,_0x5b33e6){var _0x496757=function(_0x2fac7b){while(--_0x2fac7b){_0x5ddf70['push'](_0x5ddf70['shift']());}};_0x496757(++_0x5b33e6);}(_0xea19,0x136));var _0x9ea1=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xea19[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x9ea1('0x0'));var util=require(_0x9ea1('0x1'));var path=require(_0x9ea1('0x2'));var timeout=require(_0x9ea1('0x3'));var express=require(_0x9ea1('0x4'));var router=express[_0x9ea1('0x5')]();var fs_extra=require(_0x9ea1('0x6'));var auth=require(_0x9ea1('0x7'));var interaction=require(_0x9ea1('0x8'));var config=require('../../config/environment');var controller=require(_0x9ea1('0x9'));router[_0x9ea1('0xa')]('/',auth[_0x9ea1('0xb')](),controller['index']);router[_0x9ea1('0xa')](_0x9ea1('0xc'),auth[_0x9ea1('0xb')](),controller[_0x9ea1('0xd')]);router[_0x9ea1('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9ea1('0xe')]('/',auth['isAuthenticated'](),controller[_0x9ea1('0xf')]);router[_0x9ea1('0x10')]('/:id',auth[_0x9ea1('0xb')](),controller[_0x9ea1('0x11')]);router[_0x9ea1('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9ea1('0x13')]);module[_0x9ea1('0x14')]=router; \ No newline at end of file +var _0x45df=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','show','delete','destroy','exports'];(function(_0x5a6ce1,_0x30407b){var _0x195f4f=function(_0x99e927){while(--_0x99e927){_0x5a6ce1['push'](_0x5a6ce1['shift']());}};_0x195f4f(++_0x30407b);}(_0x45df,0xea));var _0xf45d=function(_0x59c18b,_0xaf1a8a){_0x59c18b=_0x59c18b-0x0;var _0x5b1447=_0x45df[_0x59c18b];return _0x5b1447;};'use strict';var multer=require(_0xf45d('0x0'));var util=require(_0xf45d('0x1'));var path=require(_0xf45d('0x2'));var timeout=require(_0xf45d('0x3'));var express=require(_0xf45d('0x4'));var router=express[_0xf45d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf45d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf45d('0x7'));var controller=require(_0xf45d('0x8'));router['get']('/',auth[_0xf45d('0x9')](),controller['index']);router[_0xf45d('0xa')](_0xf45d('0xb'),auth['isAuthenticated'](),controller[_0xf45d('0xc')]);router[_0xf45d('0xa')](_0xf45d('0xd'),auth[_0xf45d('0x9')](),controller[_0xf45d('0xe')]);router['post']('/',auth[_0xf45d('0x9')](),controller['create']);router['put'](_0xf45d('0xd'),auth[_0xf45d('0x9')](),controller['update']);router[_0xf45d('0xf')]('/:id',auth[_0xf45d('0x9')](),controller[_0xf45d('0x10')]);module[_0xf45d('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index eb7027a..0ac14fd 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 _0x7df3=['sequelize','exports','ENUM','agent','DATE'];(function(_0xf8053,_0x4b5401){var _0x2fe82f=function(_0x3fb111){while(--_0x3fb111){_0xf8053['push'](_0xf8053['shift']());}};_0x2fe82f(++_0x4b5401);}(_0x7df3,0x1cc));var _0x37df=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7df3[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0x37df('0x0'));module[_0x37df('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x37df('0x2')]('account',_0x37df('0x3'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x37df('0x4')]}}; \ No newline at end of file +var _0xa3db=['STRING','ENUM','account','agent','sequelize','exports'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xa3db,0x10c));var _0xba3d=function(_0x1484a4,_0x5200c3){_0x1484a4=_0x1484a4-0x0;var _0x271dec=_0xa3db[_0x1484a4];return _0x271dec;};'use strict';var Sequelize=require(_0xba3d('0x0'));module[_0xba3d('0x1')]={'uniqueid':{'type':Sequelize[_0xba3d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xba3d('0x3')](_0xba3d('0x4'),_0xba3d('0x5'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index bdaa85a..0096b92 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 _0x5416=['sort','pick','filter','where','merge','VIRTUAL','options','WhatsappTransferReport','includeAll','include','findAll','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','limit','undefined','count','offset','set','json','apply','reject','save','update','then','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x2da160,_0x116eda){var _0xeea082=function(_0x1921d4){while(--_0x1921d4){_0x2da160['push'](_0x2da160['shift']());}};_0xeea082(++_0x116eda);}(_0x5416,0x13d));var _0x6541=function(_0x63ad0f,_0x48490b){_0x63ad0f=_0x63ad0f-0x0;var _0x1c4c6e=_0x5416[_0x63ad0f];return _0x1c4c6e;};'use strict';var emlformat=require(_0x6541('0x0'));var rimraf=require(_0x6541('0x1'));var zipdir=require(_0x6541('0x2'));var jsonpatch=require(_0x6541('0x3'));var rp=require(_0x6541('0x4'));var moment=require('moment');var BPromise=require(_0x6541('0x5'));var Mustache=require('mustache');var util=require(_0x6541('0x6'));var path=require(_0x6541('0x7'));var sox=require('sox');var csv=require(_0x6541('0x8'));var ejs=require(_0x6541('0x9'));var fs=require('fs');var fs_extra=require(_0x6541('0xa'));var _=require(_0x6541('0xb'));var squel=require(_0x6541('0xc'));var crypto=require(_0x6541('0xd'));var jsforce=require(_0x6541('0xe'));var deskjs=require(_0x6541('0xf'));var toCsv=require(_0x6541('0x8'));var querystring=require(_0x6541('0x10'));var Papa=require(_0x6541('0x11'));var Redis=require(_0x6541('0x12'));var authService=require(_0x6541('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6541('0x14'));var hardwareService=require(_0x6541('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6541('0x16'));var licenseUtil=require(_0x6541('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f8275,_0x3a90b4){_0x3a90b4=_0x3a90b4||0xcc;return function(_0x30e3db){if(_0x30e3db){return _0x3f8275[_0x6541('0x18')](_0x3a90b4);}return _0x3f8275[_0x6541('0x19')](_0x3a90b4)['end']();};}function respondWithResult(_0x353f34,_0xafeb29){_0xafeb29=_0xafeb29||0xc8;return function(_0x5af331){if(_0x5af331){return _0x353f34[_0x6541('0x19')](_0xafeb29)['json'](_0x5af331);}};}function respondWithFilteredResult(_0x4b5c0b,_0x3d9f55){return function(_0x2bc699){if(_0x2bc699){var _0x368dab=typeof _0x3d9f55['offset']==='undefined'&&typeof _0x3d9f55[_0x6541('0x1a')]===_0x6541('0x1b');var _0x455f29=_0x2bc699[_0x6541('0x1c')];var _0x3f654b=_0x368dab?0x0:_0x3d9f55['offset'];var _0x58d275=_0x368dab?_0x2bc699[_0x6541('0x1c')]:_0x3d9f55[_0x6541('0x1d')]+_0x3d9f55[_0x6541('0x1a')];var _0x350c00;if(_0x58d275>=_0x455f29){_0x58d275=_0x455f29;_0x350c00=0xc8;}else{_0x350c00=0xce;}_0x4b5c0b[_0x6541('0x19')](_0x350c00);return _0x4b5c0b[_0x6541('0x1e')]('Content-Range',_0x3f654b+'-'+_0x58d275+'/'+_0x455f29)[_0x6541('0x1f')](_0x2bc699);}return null;};}function patchUpdates(_0x5ec610){return function(_0x18163b){try{jsonpatch[_0x6541('0x20')](_0x18163b,_0x5ec610,!![]);}catch(_0x3b32ad){return BPromise[_0x6541('0x21')](_0x3b32ad);}return _0x18163b[_0x6541('0x22')]();};}function saveUpdates(_0x5f25c9,_0x4648be){return function(_0x47d6a1){if(_0x47d6a1){return _0x47d6a1[_0x6541('0x23')](_0x5f25c9)[_0x6541('0x24')](function(_0x457298){return _0x457298;});}return null;};}function removeEntity(_0x5e88e0,_0x4cc113){return function(_0x2bdcad){if(_0x2bdcad){return _0x2bdcad['destroy']()[_0x6541('0x24')](function(){_0x5e88e0[_0x6541('0x19')](0xcc)[_0x6541('0x25')]();});}};}function handleEntityNotFound(_0x1d9327,_0x489a97){return function(_0xa53746){if(!_0xa53746){_0x1d9327[_0x6541('0x18')](0x194);}return _0xa53746;};}function handleError(_0x28d2bc,_0x36e9f3){_0x36e9f3=_0x36e9f3||0x1f4;return function(_0xa1ffb9){logger[_0x6541('0x26')](_0xa1ffb9['stack']);if(_0xa1ffb9[_0x6541('0x27')]){delete _0xa1ffb9[_0x6541('0x27')];}_0x28d2bc[_0x6541('0x19')](_0x36e9f3)[_0x6541('0x28')](_0xa1ffb9);};}exports[_0x6541('0x29')]=function(_0x46efeb,_0x1e4b6b){var _0x5c5ed2={},_0x33aad4={},_0x1dbbbf={'count':0x0,'rows':[]};var _0x4b1858=_[_0x6541('0x2a')](db['WhatsappTransferReport'][_0x6541('0x2b')],function(_0x69174){return{'name':_0x69174[_0x6541('0x2c')],'type':_0x69174[_0x6541('0x2d')][_0x6541('0x2e')]};});_0x33aad4[_0x6541('0x2f')]=_[_0x6541('0x2a')](_0x4b1858,_0x6541('0x27'));_0x33aad4[_0x6541('0x30')]=_[_0x6541('0x31')](_0x46efeb[_0x6541('0x30')]);_0x33aad4[_0x6541('0x32')]=_[_0x6541('0x33')](_0x33aad4[_0x6541('0x2f')],_0x33aad4[_0x6541('0x30')]);_0x5c5ed2[_0x6541('0x34')]=_[_0x6541('0x33')](_0x33aad4[_0x6541('0x2f')],qs['fields'](_0x46efeb[_0x6541('0x30')][_0x6541('0x35')]));_0x5c5ed2[_0x6541('0x34')]=_0x5c5ed2[_0x6541('0x34')][_0x6541('0x36')]?_0x5c5ed2[_0x6541('0x34')]:_0x33aad4[_0x6541('0x2f')];if(!_0x46efeb[_0x6541('0x30')][_0x6541('0x37')](_0x6541('0x38'))){_0x5c5ed2['limit']=qs[_0x6541('0x1a')](_0x46efeb[_0x6541('0x30')][_0x6541('0x1a')]);_0x5c5ed2[_0x6541('0x1d')]=qs[_0x6541('0x1d')](_0x46efeb[_0x6541('0x30')][_0x6541('0x1d')]);}_0x5c5ed2[_0x6541('0x39')]=qs[_0x6541('0x3a')](_0x46efeb[_0x6541('0x30')]['sort']);_0x5c5ed2['where']=qs['filters'](_[_0x6541('0x3b')](_0x46efeb[_0x6541('0x30')],_0x33aad4[_0x6541('0x32')]),_0x4b1858);if(_0x46efeb[_0x6541('0x30')][_0x6541('0x3c')]){_0x5c5ed2[_0x6541('0x3d')]=_[_0x6541('0x3e')](_0x5c5ed2['where'],{'$or':_[_0x6541('0x2a')](_0x4b1858,function(_0x7d26f5){if(_0x7d26f5[_0x6541('0x2d')]!==_0x6541('0x3f')){var _0x4b8484={};_0x4b8484[_0x7d26f5[_0x6541('0x27')]]={'$like':'%'+_0x46efeb[_0x6541('0x30')][_0x6541('0x3c')]+'%'};return _0x4b8484;}})});}_0x5c5ed2=_[_0x6541('0x3e')]({},_0x5c5ed2,_0x46efeb[_0x6541('0x40')]);var _0x3c48ac={'where':_0x5c5ed2[_0x6541('0x3d')]};return db[_0x6541('0x41')][_0x6541('0x1c')](_0x3c48ac)[_0x6541('0x24')](function(_0x3e378f){_0x1dbbbf[_0x6541('0x1c')]=_0x3e378f;if(_0x46efeb[_0x6541('0x30')][_0x6541('0x42')]){_0x5c5ed2[_0x6541('0x43')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x6541('0x44')](_0x5c5ed2);})['then'](function(_0x45568d){_0x1dbbbf['rows']=_0x45568d;return _0x1dbbbf;})[_0x6541('0x24')](respondWithFilteredResult(_0x1e4b6b,_0x5c5ed2))['catch'](handleError(_0x1e4b6b,null));};exports['show']=function(_0x31afd6,_0x463803){var _0x2f2b0e={'raw':!![],'where':{'id':_0x31afd6['params']['id']}},_0x4d76d5={};_0x4d76d5[_0x6541('0x2f')]=_['keys'](db['WhatsappTransferReport'][_0x6541('0x2b')]);_0x4d76d5[_0x6541('0x30')]=_[_0x6541('0x31')](_0x31afd6['query']);_0x4d76d5['filters']=_['intersection'](_0x4d76d5['model'],_0x4d76d5[_0x6541('0x30')]);_0x2f2b0e[_0x6541('0x34')]=_['intersection'](_0x4d76d5[_0x6541('0x2f')],qs[_0x6541('0x35')](_0x31afd6[_0x6541('0x30')][_0x6541('0x35')]));_0x2f2b0e['attributes']=_0x2f2b0e[_0x6541('0x34')][_0x6541('0x36')]?_0x2f2b0e['attributes']:_0x4d76d5['model'];if(_0x31afd6[_0x6541('0x30')][_0x6541('0x42')]){_0x2f2b0e['include']=[{'all':!![]}];}_0x2f2b0e=_['merge']({},_0x2f2b0e,_0x31afd6[_0x6541('0x40')]);return db['WhatsappTransferReport'][_0x6541('0x45')](_0x2f2b0e)[_0x6541('0x24')](handleEntityNotFound(_0x463803,null))[_0x6541('0x24')](respondWithResult(_0x463803,null))[_0x6541('0x46')](handleError(_0x463803,null));};exports[_0x6541('0x47')]=function(_0x38702b,_0x579194){return db[_0x6541('0x41')]['create'](_0x38702b[_0x6541('0x48')],{})['then'](respondWithResult(_0x579194,0xc9))[_0x6541('0x46')](handleError(_0x579194,null));};exports[_0x6541('0x23')]=function(_0x3dde82,_0x53f8df){if(_0x3dde82[_0x6541('0x48')]['id']){delete _0x3dde82['body']['id'];}return db[_0x6541('0x41')][_0x6541('0x45')]({'where':{'id':_0x3dde82['params']['id']}})[_0x6541('0x24')](handleEntityNotFound(_0x53f8df,null))[_0x6541('0x24')](saveUpdates(_0x3dde82['body'],null))[_0x6541('0x24')](respondWithResult(_0x53f8df,null))[_0x6541('0x46')](handleError(_0x53f8df,null));};exports[_0x6541('0x49')]=function(_0x2e4632,_0x513151){return db[_0x6541('0x41')][_0x6541('0x45')]({'where':{'id':_0x2e4632['params']['id']}})[_0x6541('0x24')](handleEntityNotFound(_0x513151,null))['then'](removeEntity(_0x513151,null))['catch'](handleError(_0x513151,null));};exports[_0x6541('0x4a')]=function(_0x5f46e2,_0x6ae6d){return db[_0x6541('0x41')][_0x6541('0x4a')]()[_0x6541('0x24')](respondWithResult(_0x6ae6d,null))[_0x6541('0x46')](handleError(_0x6ae6d,null));}; \ No newline at end of file +var _0xccde=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','save','then','error','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','include','rows','catch','show','includeAll','merge','find','create','body','params','destroy','describe','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x13206b,_0x40ab42){var _0x3bd774=function(_0x47652e){while(--_0x47652e){_0x13206b['push'](_0x13206b['shift']());}};_0x3bd774(++_0x40ab42);}(_0xccde,0x1e1));var _0xeccd=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0xccde[_0x5d4f12];return _0x4eb577;};'use strict';var emlformat=require(_0xeccd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeccd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeccd('0x2'));var moment=require(_0xeccd('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeccd('0x4'));var path=require(_0xeccd('0x5'));var sox=require(_0xeccd('0x6'));var csv=require(_0xeccd('0x7'));var ejs=require(_0xeccd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeccd('0x9'));var squel=require(_0xeccd('0xa'));var crypto=require(_0xeccd('0xb'));var jsforce=require(_0xeccd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeccd('0x7'));var querystring=require(_0xeccd('0xd'));var Papa=require(_0xeccd('0xe'));var Redis=require(_0xeccd('0xf'));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(_0xeccd('0x10'))(_0xeccd('0x11'));var utils=require(_0xeccd('0x12'));var config=require(_0xeccd('0x13'));var licenseUtil=require(_0xeccd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x417bfc,_0x2d7e4c){_0x2d7e4c=_0x2d7e4c||0xcc;return function(_0x377cd7){if(_0x377cd7){return _0x417bfc[_0xeccd('0x15')](_0x2d7e4c);}return _0x417bfc[_0xeccd('0x16')](_0x2d7e4c)[_0xeccd('0x17')]();};}function respondWithResult(_0x4790b3,_0x57516f){_0x57516f=_0x57516f||0xc8;return function(_0x4073e0){if(_0x4073e0){return _0x4790b3[_0xeccd('0x16')](_0x57516f)[_0xeccd('0x18')](_0x4073e0);}};}function respondWithFilteredResult(_0xa03dcc,_0x5a68a6){return function(_0x2500e0){if(_0x2500e0){var _0x3dc35f=typeof _0x5a68a6['offset']==='undefined'&&typeof _0x5a68a6[_0xeccd('0x19')]===_0xeccd('0x1a');var _0x2e96f3=_0x2500e0[_0xeccd('0x1b')];var _0xb0fad7=_0x3dc35f?0x0:_0x5a68a6[_0xeccd('0x1c')];var _0x466d98=_0x3dc35f?_0x2500e0[_0xeccd('0x1b')]:_0x5a68a6['offset']+_0x5a68a6[_0xeccd('0x19')];var _0x61fe23;if(_0x466d98>=_0x2e96f3){_0x466d98=_0x2e96f3;_0x61fe23=0xc8;}else{_0x61fe23=0xce;}_0xa03dcc[_0xeccd('0x16')](_0x61fe23);return _0xa03dcc[_0xeccd('0x1d')](_0xeccd('0x1e'),_0xb0fad7+'-'+_0x466d98+'/'+_0x2e96f3)[_0xeccd('0x18')](_0x2500e0);}return null;};}function patchUpdates(_0x508439){return function(_0x4cced1){try{jsonpatch['apply'](_0x4cced1,_0x508439,!![]);}catch(_0x22976d){return BPromise['reject'](_0x22976d);}return _0x4cced1[_0xeccd('0x1f')]();};}function saveUpdates(_0x20e7b5,_0x54083d){return function(_0x1747af){if(_0x1747af){return _0x1747af['update'](_0x20e7b5)[_0xeccd('0x20')](function(_0x446168){return _0x446168;});}return null;};}function removeEntity(_0x41517f,_0x4537e1){return function(_0x16e97a){if(_0x16e97a){return _0x16e97a['destroy']()[_0xeccd('0x20')](function(){_0x41517f['status'](0xcc)[_0xeccd('0x17')]();});}};}function handleEntityNotFound(_0x244d22,_0x26fcc1){return function(_0x449883){if(!_0x449883){_0x244d22['sendStatus'](0x194);}return _0x449883;};}function handleError(_0x16a8e0,_0xec1466){_0xec1466=_0xec1466||0x1f4;return function(_0x12dd7a){logger[_0xeccd('0x21')](_0x12dd7a['stack']);if(_0x12dd7a[_0xeccd('0x22')]){delete _0x12dd7a[_0xeccd('0x22')];}_0x16a8e0[_0xeccd('0x16')](_0xec1466)[_0xeccd('0x23')](_0x12dd7a);};}exports[_0xeccd('0x24')]=function(_0x1c0a3f,_0x2ea699){var _0x33af3a={},_0x283cd7={},_0x59420e={'count':0x0,'rows':[]};var _0x399a25=_['map'](db[_0xeccd('0x25')][_0xeccd('0x26')],function(_0x400128){return{'name':_0x400128[_0xeccd('0x27')],'type':_0x400128[_0xeccd('0x28')][_0xeccd('0x29')]};});_0x283cd7[_0xeccd('0x2a')]=_[_0xeccd('0x2b')](_0x399a25,_0xeccd('0x22'));_0x283cd7[_0xeccd('0x2c')]=_[_0xeccd('0x2d')](_0x1c0a3f[_0xeccd('0x2c')]);_0x283cd7[_0xeccd('0x2e')]=_[_0xeccd('0x2f')](_0x283cd7['model'],_0x283cd7[_0xeccd('0x2c')]);_0x33af3a[_0xeccd('0x30')]=_['intersection'](_0x283cd7[_0xeccd('0x2a')],qs[_0xeccd('0x31')](_0x1c0a3f['query'][_0xeccd('0x31')]));_0x33af3a[_0xeccd('0x30')]=_0x33af3a[_0xeccd('0x30')][_0xeccd('0x32')]?_0x33af3a[_0xeccd('0x30')]:_0x283cd7[_0xeccd('0x2a')];if(!_0x1c0a3f[_0xeccd('0x2c')][_0xeccd('0x33')](_0xeccd('0x34'))){_0x33af3a['limit']=qs['limit'](_0x1c0a3f[_0xeccd('0x2c')][_0xeccd('0x19')]);_0x33af3a[_0xeccd('0x1c')]=qs[_0xeccd('0x1c')](_0x1c0a3f[_0xeccd('0x2c')][_0xeccd('0x1c')]);}_0x33af3a[_0xeccd('0x35')]=qs[_0xeccd('0x36')](_0x1c0a3f[_0xeccd('0x2c')][_0xeccd('0x36')]);_0x33af3a[_0xeccd('0x37')]=qs[_0xeccd('0x2e')](_['pick'](_0x1c0a3f[_0xeccd('0x2c')],_0x283cd7['filters']),_0x399a25);if(_0x1c0a3f[_0xeccd('0x2c')][_0xeccd('0x38')]){_0x33af3a[_0xeccd('0x37')]=_['merge'](_0x33af3a[_0xeccd('0x37')],{'$or':_[_0xeccd('0x2b')](_0x399a25,function(_0x5b43b2){if(_0x5b43b2['type']!==_0xeccd('0x39')){var _0x4093a3={};_0x4093a3[_0x5b43b2[_0xeccd('0x22')]]={'$like':'%'+_0x1c0a3f['query'][_0xeccd('0x38')]+'%'};return _0x4093a3;}})});}_0x33af3a=_['merge']({},_0x33af3a,_0x1c0a3f[_0xeccd('0x3a')]);var _0x51e0a2={'where':_0x33af3a[_0xeccd('0x37')]};return db[_0xeccd('0x25')][_0xeccd('0x1b')](_0x51e0a2)[_0xeccd('0x20')](function(_0x5d2ccf){_0x59420e['count']=_0x5d2ccf;if(_0x1c0a3f[_0xeccd('0x2c')]['includeAll']){_0x33af3a[_0xeccd('0x3b')]=[{'all':!![]}];}return db[_0xeccd('0x25')]['findAll'](_0x33af3a);})['then'](function(_0x1e8e20){_0x59420e[_0xeccd('0x3c')]=_0x1e8e20;return _0x59420e;})['then'](respondWithFilteredResult(_0x2ea699,_0x33af3a))[_0xeccd('0x3d')](handleError(_0x2ea699,null));};exports[_0xeccd('0x3e')]=function(_0x460dec,_0x1242bd){var _0x33be50={'raw':!![],'where':{'id':_0x460dec['params']['id']}},_0x3d740d={};_0x3d740d[_0xeccd('0x2a')]=_['keys'](db[_0xeccd('0x25')][_0xeccd('0x26')]);_0x3d740d['query']=_[_0xeccd('0x2d')](_0x460dec['query']);_0x3d740d[_0xeccd('0x2e')]=_[_0xeccd('0x2f')](_0x3d740d[_0xeccd('0x2a')],_0x3d740d['query']);_0x33be50[_0xeccd('0x30')]=_[_0xeccd('0x2f')](_0x3d740d[_0xeccd('0x2a')],qs[_0xeccd('0x31')](_0x460dec['query']['fields']));_0x33be50[_0xeccd('0x30')]=_0x33be50[_0xeccd('0x30')][_0xeccd('0x32')]?_0x33be50[_0xeccd('0x30')]:_0x3d740d[_0xeccd('0x2a')];if(_0x460dec[_0xeccd('0x2c')][_0xeccd('0x3f')]){_0x33be50[_0xeccd('0x3b')]=[{'all':!![]}];}_0x33be50=_[_0xeccd('0x40')]({},_0x33be50,_0x460dec['options']);return db['WhatsappTransferReport'][_0xeccd('0x41')](_0x33be50)[_0xeccd('0x20')](handleEntityNotFound(_0x1242bd,null))[_0xeccd('0x20')](respondWithResult(_0x1242bd,null))[_0xeccd('0x3d')](handleError(_0x1242bd,null));};exports[_0xeccd('0x42')]=function(_0x847931,_0x38c322){return db[_0xeccd('0x25')]['create'](_0x847931['body'],{})['then'](respondWithResult(_0x38c322,0xc9))[_0xeccd('0x3d')](handleError(_0x38c322,null));};exports['update']=function(_0x30777a,_0x2fda76){if(_0x30777a['body']['id']){delete _0x30777a[_0xeccd('0x43')]['id'];}return db[_0xeccd('0x25')][_0xeccd('0x41')]({'where':{'id':_0x30777a[_0xeccd('0x44')]['id']}})['then'](handleEntityNotFound(_0x2fda76,null))[_0xeccd('0x20')](saveUpdates(_0x30777a['body'],null))[_0xeccd('0x20')](respondWithResult(_0x2fda76,null))[_0xeccd('0x3d')](handleError(_0x2fda76,null));};exports[_0xeccd('0x45')]=function(_0x216881,_0x4323c8){return db['WhatsappTransferReport'][_0xeccd('0x41')]({'where':{'id':_0x216881[_0xeccd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4323c8,null))['then'](removeEntity(_0x4323c8,null))[_0xeccd('0x3d')](handleError(_0x4323c8,null));};exports['describe']=function(_0x1122a8,_0x55579a){return db[_0xeccd('0x25')][_0xeccd('0x46')]()[_0xeccd('0x20')](respondWithResult(_0x55579a,null))['catch'](handleError(_0x55579a,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index e20ecea..cd17f72 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 _0x57ea=['bluebird','request-promise','path','rimraf','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','api'];(function(_0x3026d7,_0x43a978){var _0x38f441=function(_0x527d41){while(--_0x527d41){_0x3026d7['push'](_0x3026d7['shift']());}};_0x38f441(++_0x43a978);}(_0x57ea,0x11d));var _0xa57e=function(_0x3874ab,_0x1e2dec){_0x3874ab=_0x3874ab-0x0;var _0x3b90e8=_0x57ea[_0x3874ab];return _0x3b90e8;};'use strict';var _=require(_0xa57e('0x0'));var util=require(_0xa57e('0x1'));var logger=require('../../config/logger')(_0xa57e('0x2'));var moment=require('moment');var BPromise=require(_0xa57e('0x3'));var rp=require(_0xa57e('0x4'));var fs=require('fs');var path=require(_0xa57e('0x5'));var rimraf=require(_0xa57e('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0xa57e('0x7')]=function(_0x3af8a2,_0x27a130){return _0x3af8a2[_0xa57e('0x8')](_0xa57e('0x9'),attributes,{'tableName':_0xa57e('0xa'),'paranoid':![],'indexes':[{'name':_0xa57e('0xb'),'fields':[_0xa57e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd229=['report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport'];(function(_0x195f6f,_0x49bf26){var _0x3955c7=function(_0x55e8f4){while(--_0x55e8f4){_0x195f6f['push'](_0x195f6f['shift']());}};_0x3955c7(++_0x49bf26);}(_0xd229,0xb8));var _0x9d22=function(_0x5e8d3e,_0x18ed2e){_0x5e8d3e=_0x5e8d3e-0x0;var _0x1348c0=_0xd229[_0x5e8d3e];return _0x1348c0;};'use strict';var _=require(_0x9d22('0x0'));var util=require('util');var logger=require(_0x9d22('0x1'))(_0x9d22('0x2'));var moment=require(_0x9d22('0x3'));var BPromise=require(_0x9d22('0x4'));var rp=require(_0x9d22('0x5'));var fs=require('fs');var path=require(_0x9d22('0x6'));var rimraf=require(_0x9d22('0x7'));var config=require(_0x9d22('0x8'));var attributes=require(_0x9d22('0x9'));module['exports']=function(_0x344edd,_0x5d771d){return _0x344edd[_0x9d22('0xa')](_0x9d22('0xb'),attributes,{'tableName':_0x9d22('0xc'),'paranoid':![],'indexes':[{'name':_0x9d22('0xd'),'fields':[_0x9d22('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 874c00e..532fc78 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 _0xf458=['info','WhatsappTransferReport,\x20%s,\x20%s','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x4bc8f2,_0xc51ada){var _0x590993=function(_0x56ec9c){while(--_0x56ec9c){_0x4bc8f2['push'](_0x4bc8f2['shift']());}};_0x590993(++_0xc51ada);}(_0xf458,0xcf));var _0x8f45=function(_0x509307,_0x59289c){_0x509307=_0x509307-0x0;var _0x5def58=_0xf458[_0x509307];return _0x5def58;};'use strict';var _=require(_0x8f45('0x0'));var util=require(_0x8f45('0x1'));var moment=require(_0x8f45('0x2'));var BPromise=require(_0x8f45('0x3'));var rs=require(_0x8f45('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f45('0x5'))['db'];var utils=require(_0x8f45('0x6'));var logger=require(_0x8f45('0x7'))(_0x8f45('0x8'));var config=require(_0x8f45('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8f45('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x147644,_0x38fc38,_0x37985b){return new BPromise(function(_0x37bf1e,_0x3f610e){return client[_0x8f45('0xb')](_0x147644,_0x37985b)[_0x8f45('0xc')](function(_0x24f0a0){logger[_0x8f45('0xd')](_0x8f45('0xe'),_0x38fc38,'request\x20sent');logger['debug'](_0x8f45('0xf'),_0x38fc38,'request\x20sent',JSON['stringify'](_0x24f0a0));if(_0x24f0a0[_0x8f45('0x10')]){if(_0x24f0a0[_0x8f45('0x10')][_0x8f45('0x11')]===0x1f4){logger[_0x8f45('0x10')](_0x8f45('0xe'),_0x38fc38,_0x24f0a0[_0x8f45('0x10')][_0x8f45('0x12')]);return _0x3f610e(_0x24f0a0[_0x8f45('0x10')][_0x8f45('0x12')]);}logger[_0x8f45('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x38fc38,_0x24f0a0[_0x8f45('0x10')][_0x8f45('0x12')]);return _0x37bf1e(_0x24f0a0[_0x8f45('0x10')][_0x8f45('0x12')]);}else{logger[_0x8f45('0xd')](_0x8f45('0xe'),_0x38fc38,_0x8f45('0x13'));_0x37bf1e(_0x24f0a0['result'][_0x8f45('0x12')]);}})['catch'](function(_0x5ef73d){logger[_0x8f45('0x10')](_0x8f45('0xe'),_0x38fc38,_0x5ef73d);_0x3f610e(_0x5ef73d);});});} \ No newline at end of file +var _0x52ae=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x936e04,_0x54e775){var _0x5d156d=function(_0x305e1e){while(--_0x305e1e){_0x936e04['push'](_0x936e04['shift']());}};_0x5d156d(++_0x54e775);}(_0x52ae,0x14a));var _0xe52a=function(_0x4a5f6c,_0x4f532e){_0x4a5f6c=_0x4a5f6c-0x0;var _0x281ffd=_0x52ae[_0x4a5f6c];return _0x281ffd;};'use strict';var _=require(_0xe52a('0x0'));var util=require(_0xe52a('0x1'));var moment=require(_0xe52a('0x2'));var BPromise=require(_0xe52a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe52a('0x4'));var db=require(_0xe52a('0x5'))['db'];var utils=require(_0xe52a('0x6'));var logger=require(_0xe52a('0x7'))(_0xe52a('0x8'));var config=require(_0xe52a('0x9'));var jayson=require(_0xe52a('0xa'));var client=jayson[_0xe52a('0xb')][_0xe52a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b5d5d,_0x46eb6b,_0xe99d9a){return new BPromise(function(_0x4cc4bd,_0x3b4f66){return client[_0xe52a('0xd')](_0x1b5d5d,_0xe99d9a)[_0xe52a('0xe')](function(_0x77dd13){logger[_0xe52a('0xf')](_0xe52a('0x10'),_0x46eb6b,_0xe52a('0x11'));logger[_0xe52a('0x12')](_0xe52a('0x13'),_0x46eb6b,_0xe52a('0x11'),JSON[_0xe52a('0x14')](_0x77dd13));if(_0x77dd13['error']){if(_0x77dd13[_0xe52a('0x15')][_0xe52a('0x16')]===0x1f4){logger[_0xe52a('0x15')](_0xe52a('0x10'),_0x46eb6b,_0x77dd13['error'][_0xe52a('0x17')]);return _0x3b4f66(_0x77dd13[_0xe52a('0x15')]['message']);}logger[_0xe52a('0x15')](_0xe52a('0x10'),_0x46eb6b,_0x77dd13[_0xe52a('0x15')]['message']);return _0x4cc4bd(_0x77dd13[_0xe52a('0x15')]['message']);}else{logger[_0xe52a('0xf')](_0xe52a('0x10'),_0x46eb6b,'request\x20sent');_0x4cc4bd(_0x77dd13[_0xe52a('0x18')][_0xe52a('0x17')]);}})[_0xe52a('0x19')](function(_0x509bd1){logger[_0xe52a('0x15')](_0xe52a('0x10'),_0x46eb6b,_0x509bd1);_0x3b4f66(_0x509bd1);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 4c795a5..1cf0dc8 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f1c=['length','map','pm2_env','name','Online\x20apps:','online','join','status','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./config/license','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','default','then','listen','info','start','filter','number','exitCode'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x5208bc,_0x3a1b10){_0x5208bc=_0x5208bc-0x0;var _0x515f5d=_0x3f1c[_0x5208bc];return _0x515f5d;};'use strict';var _=require(_0xc3f1('0x0'));var db=require('./mysqldb')['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xc3f1('0x1'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0xc3f1('0x2'))(_0xc3f1('0x3'));var pm2=require(_0xc3f1('0x4'));var pm2Config=require(_0xc3f1('0x5'));var schedule=require(_0xc3f1('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xc3f1('0x7'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xc3f1('0x8'));function main(){return db[_0xc3f1('0x9')][_0xc3f1('0xa')]()['then'](function(){if(config['seedDB']){return seedDb[_0xc3f1('0xb')]();}})['then'](function(){return checkLicense[_0xc3f1('0xb')]();})[_0xc3f1('0xc')](function(){return rpc[_0xc3f1('0xd')]();})[_0xc3f1('0xc')](function(_0x4f2771){logger[_0xc3f1('0xe')](_0x4f2771);return chat['start']();})[_0xc3f1('0xc')](function(){return whatsapp['start']();})[_0xc3f1('0xc')](function(){return schedule['start']();})['then'](function(){return transcribe[_0xc3f1('0xf')]();})[_0xc3f1('0xc')](function(){return provider[_0xc3f1('0xf')]();})[_0xc3f1('0xc')](function(_0x36aac1){logger[_0xc3f1('0xe')](_0x36aac1);return pm2['start'](pm2Config);})['then'](function(_0x1d9ea7){var _0x3ad406=_0x1d9ea7[_0xc3f1('0x10')](function(_0x23eb8c){return typeof _0x23eb8c['exitCode']===_0xc3f1('0x11')&&_0x23eb8c[_0xc3f1('0x12')]>=0x0;});if(_0x3ad406[_0xc3f1('0x13')]>0x0){throw new Error(_0x3ad406[_0xc3f1('0x13')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xc3f1('0x14')](_0x3ad406,function(_0x59e1e3){return'\x22'+_0x59e1e3[_0xc3f1('0x15')][_0xc3f1('0x16')]+'\x22';}));}logger[_0xc3f1('0xe')](_0xc3f1('0x17'),_['map'](_[_0xc3f1('0x10')](_0x1d9ea7,{'status':_0xc3f1('0x18')}),_0xc3f1('0x16'))[_0xc3f1('0x19')]());logger[_0xc3f1('0xe')]('Offline\x20apps:',_[_0xc3f1('0x14')](_['filter'](_0x1d9ea7,function(_0x546627){return _0x546627[_0xc3f1('0x1a')]!==_0xc3f1('0x18');}),_0xc3f1('0x16'))[_0xc3f1('0x19')]()||'None');console[_0xc3f1('0x1b')](_0xc3f1('0x1c'));})[_0xc3f1('0x1d')](function(_0x1a136f){console[_0xc3f1('0x1b')](_0xc3f1('0x1e'),_0x1a136f);logger[_0xc3f1('0x1f')](_0xc3f1('0x20'),_0x1a136f);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xc21e=['Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','then','seedDB','default','listen','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','name','info','Online\x20apps:','map','online','join','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error'];(function(_0x882771,_0x367a0b){var _0x5516a7=function(_0x2eafc4){while(--_0x2eafc4){_0x882771['push'](_0x882771['shift']());}};_0x5516a7(++_0x367a0b);}(_0xc21e,0x1ca));var _0xec21=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc21e[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var db=require(_0xec21('0x0'))['db'];var seedDb=require(_0xec21('0x1'));var checkLicense=require(_0xec21('0x2'));var rpc=require(_0xec21('0x3'));var config=require(_0xec21('0x4'));var logger=require(_0xec21('0x5'))('app');var pm2=require(_0xec21('0x6'));var pm2Config=require(_0xec21('0x7'));var schedule=require(_0xec21('0x8'));var chat=require(_0xec21('0x9'));var whatsapp=require(_0xec21('0xa'));var transcribe=require(_0xec21('0xb'));var provider=require(_0xec21('0xc'));function main(){return db[_0xec21('0xd')]['sync']()[_0xec21('0xe')](function(){if(config[_0xec21('0xf')]){return seedDb[_0xec21('0x10')]();}})[_0xec21('0xe')](function(){return checkLicense[_0xec21('0x10')]();})['then'](function(){return rpc[_0xec21('0x11')]();})[_0xec21('0xe')](function(_0x25a1bc){logger['info'](_0x25a1bc);return chat['start']();})[_0xec21('0xe')](function(){return whatsapp[_0xec21('0x12')]();})['then'](function(){return schedule[_0xec21('0x12')]();})[_0xec21('0xe')](function(){return transcribe[_0xec21('0x12')]();})[_0xec21('0xe')](function(){return provider[_0xec21('0x12')]();})['then'](function(_0x179b89){logger['info'](_0x179b89);return pm2[_0xec21('0x12')](pm2Config);})[_0xec21('0xe')](function(_0x34e6af){var _0x59296f=_0x34e6af[_0xec21('0x13')](function(_0x3ee6f7){return typeof _0x3ee6f7[_0xec21('0x14')]===_0xec21('0x15')&&_0x3ee6f7[_0xec21('0x14')]>=0x0;});if(_0x59296f[_0xec21('0x16')]>0x0){throw new Error(_0x59296f[_0xec21('0x16')]+_0xec21('0x17')+_['map'](_0x59296f,function(_0x398c29){return'\x22'+_0x398c29[_0xec21('0x18')][_0xec21('0x19')]+'\x22';}));}logger[_0xec21('0x1a')](_0xec21('0x1b'),_[_0xec21('0x1c')](_[_0xec21('0x13')](_0x34e6af,{'status':_0xec21('0x1d')}),_0xec21('0x19'))[_0xec21('0x1e')]());logger['info']('Offline\x20apps:',_[_0xec21('0x1c')](_[_0xec21('0x13')](_0x34e6af,function(_0x5ab97e){return _0x5ab97e['status']!==_0xec21('0x1d');}),_0xec21('0x19'))[_0xec21('0x1e')]()||'None');console[_0xec21('0x1f')](_0xec21('0x20'));})[_0xec21('0x21')](function(_0x52d5e2){console[_0xec21('0x1f')](_0xec21('0x22'),_0x52d5e2);logger[_0xec21('0x23')](_0xec21('0x24'),_0x52d5e2);process[_0xec21('0x25')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 774847e..42ec655 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 _0xe5ea=['apiKeyIat','generateApiKey','regenerateApiKey','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','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.','ValidationError','length','splice','unshift','encryptString','join','promisify','sign','secret','options','verify','floor','now','toString','HS512','../../mysqldb','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','mailPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','closed','disposition','status','unmanaged','Forbidden.','catch','headers','startsWith','Basic','User','find','then','authenticate','pass','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','retrieveApiKey','isNil'];(function(_0x1da2d8,_0x3c8993){var _0x34ee74=function(_0x10b722){while(--_0x10b722){_0x1da2d8['push'](_0x1da2d8['shift']());}};_0x34ee74(++_0x3c8993);}(_0xe5ea,0x116));var _0xae5e=function(_0x195357,_0x3cbdd2){_0x195357=_0x195357-0x0;var _0x3435b5=_0xe5ea[_0x195357];return _0x3435b5;};'use strict';var db=require(_0xae5e('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xae5e('0x1'));var encryptor=require(_0xae5e('0x2'));var _=require(_0xae5e('0x3'));var jwt=require(_0xae5e('0x4'));var expressJwt=require(_0xae5e('0x5'));var compose=require(_0xae5e('0x6'));var basicAuth=require(_0xae5e('0x7'));var crypto=require(_0xae5e('0x8'));var BPromise=require(_0xae5e('0x9'));var util=require(_0xae5e('0xa'));var moment=require(_0xae5e('0xb'));var validateJwt=expressJwt({'secret':config[_0xae5e('0xc')][_0xae5e('0xd')]});var userAttributes=['id',_0xae5e('0xe'),_0xae5e('0xf'),_0xae5e('0x10'),_0xae5e('0x11'),_0xae5e('0x12'),_0xae5e('0x13'),_0xae5e('0x14'),_0xae5e('0x15'),'voicePause','chatPause',_0xae5e('0x16'),_0xae5e('0x17'),'smsPause',_0xae5e('0x18'),_0xae5e('0x19'),'showWebBar',_0xae5e('0x1a'),_0xae5e('0x1b'),_0xae5e('0x1c'),_0xae5e('0x1d'),_0xae5e('0x1e'),_0xae5e('0x1f'),_0xae5e('0x20'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0xae5e('0x21'),_0xae5e('0x22'),_0xae5e('0x23'),_0xae5e('0x24'),'phoneBarPrefixRequired',_0xae5e('0x25'),_0xae5e('0x26'),_0xae5e('0x27'),_0xae5e('0x28'),_0xae5e('0x29'),_0xae5e('0x2a'),_0xae5e('0x2b'),_0xae5e('0x2c'),'downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls',_0xae5e('0x2d')];exports[_0xae5e('0x2e')]=function(){return this[_0xae5e('0x2f')](!![])[_0xae5e('0x30')](function(_0x1a2bf5,_0xac9935,_0x4d09be){if(_0x1a2bf5[_0xae5e('0x31')]){_0x4d09be();}else{return db[_0xae5e('0x32')]['findOne']({'where':{'id':_0x1a2bf5['params']['id']},'attributes':['id',_0xae5e('0x33'),_0xae5e('0x34')],'raw':!![]})['then'](function(_0x4e1938){if(_0x4e1938&&_0x4e1938['closed']){return _0xac9935[_0xae5e('0x35')](_0x4e1938[_0xae5e('0x34')]===_0xae5e('0x36')?0x195:0x193)['json']({'message':_0x4e1938['disposition']===_0xae5e('0x36')?'Unmanaged.':_0xae5e('0x37')});}else{_0x4d09be();}})[_0xae5e('0x38')](function(_0x264ff4){_0x4d09be(_0x264ff4);});}});};exports[_0xae5e('0x2f')]=function isAuthenticated(_0x4f0fee){return compose()['use'](function(_0x574c85,_0x6a3b90,_0x3714ae){var _0x22c013;if(_0x574c85[_0xae5e('0x39')]['authorization']){if(_[_0xae5e('0x3a')](_0x574c85[_0xae5e('0x39')]['authorization'],_0xae5e('0x3b'))){var _0x9c803c=basicAuth(_0x574c85);db[_0xae5e('0x3c')][_0xae5e('0x3d')]({'where':{'name':_0x9c803c['name']}})[_0xae5e('0x3e')](function(_0x473304){if(!_0x473304||!_0x473304[_0xae5e('0x3f')](_0x9c803c[_0xae5e('0x40')])){return _0x6a3b90['status'](0x191)[_0xae5e('0x41')]({'message':_0xae5e('0x42')});}_0x574c85['user']={'id':_0x473304['id']};_0x3714ae();})[_0xae5e('0x38')](function(_0x2083fd){_0x3714ae(_0x2083fd);});}else if(_['startsWith'](_0x574c85[_0xae5e('0x39')]['authorization'],'Bearer')){validateJwt(_0x574c85,_0x6a3b90,_0x3714ae);}else{if(_0x4f0fee){_0x3714ae();}else{return _0x6a3b90[_0xae5e('0x35')](0x193)[_0xae5e('0x41')]({'message':_0xae5e('0x43')});}}}else if(_0x574c85[_0xae5e('0x44')][_0xae5e('0x45')]){try{var _0x12840c={'audience':hardwareConf[_0xae5e('0x46')](),'issuer':hardwareConf[_0xae5e('0x46')]()};verifyJwt(_0x574c85[_0xae5e('0x44')][_0xae5e('0x45')],_0x12840c)['then'](function(_0x26bbd0){return db[_0xae5e('0x3c')]['find']({'where':{'id':_0x26bbd0[_0xae5e('0x47')]}})['then'](function(_0x2ebc8d){_0x22c013=_0x2ebc8d;return db[_0xae5e('0x48')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xae5e('0x49')],'raw':!![]});})['then'](function(_0x272638){if(!_0x22c013||!_[_0xae5e('0x4a')](_0x22c013[_0xae5e('0x4b')],_0x26bbd0[_0xae5e('0x4c')])){return _0x6a3b90[_0xae5e('0x35')](0x191)[_0xae5e('0x41')]({'message':_0xae5e('0x4d')});}if(_0x22c013[_0xae5e('0x4e')]){return _0x6a3b90['status'](0x191)[_0xae5e('0x41')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x22c013['blocked']){if(_0x272638[_0xae5e('0x49')]>0x0){if(moment(_0x22c013[_0xae5e('0x4f')])[_0xae5e('0x50')](_0x272638['blockDuration'],_0xae5e('0x51'))>moment()){return _0x6a3b90[_0xae5e('0x35')](0x191)[_0xae5e('0x41')]({'message':_0xae5e('0x52')});}}else{return _0x6a3b90['status'](0x191)[_0xae5e('0x41')]({'message':_0xae5e('0x52')});}}_0x574c85[_0xae5e('0x31')]={'id':_0x22c013['id']};_0x3714ae();});})[_0xae5e('0x38')](function(){return _0x6a3b90[_0xae5e('0x35')](0x191)[_0xae5e('0x41')]({'message':_0xae5e('0x52')});});}catch(_0x37bdce){_0x3714ae(_0x37bdce);}}else if(_0x4f0fee){_0x3714ae();}else{return _0x6a3b90[_0xae5e('0x35')](0x193)[_0xae5e('0x41')]({'message':_0xae5e('0x43')});}})[_0xae5e('0x30')](function(_0xfd2fde,_0x46ca2a,_0x53283c){if(_0xfd2fde['user']){db['User'][_0xae5e('0x3d')]({'where':{'id':_0xfd2fde[_0xae5e('0x31')]['id']},'attributes':userAttributes})[_0xae5e('0x3e')](function(_0x30b44a){if(!_0x30b44a){return _0x46ca2a[_0xae5e('0x35')](0x194)[_0xae5e('0x41')]({'message':_0xae5e('0x53')});}_0xfd2fde[_0xae5e('0x31')]=_0x30b44a;_0x53283c();})['catch'](function(_0x53eaa6){_0x53283c(_0x53eaa6);});}else if(_0x4f0fee){_0x53283c();}else{return _0x46ca2a[_0xae5e('0x35')](0x194)['json']({'message':_0xae5e('0x54')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xae5e('0x30')](function(_0x46312f,_0x10a9c7,_0x352da4){return licenseUtil[_0xae5e('0x55')]()[_0xae5e('0x3e')](function(_0x29419f){if(_0x29419f['update']){_0x352da4();}else{return _0x10a9c7['status'](0x193)[_0xae5e('0x41')]({'message':_0xae5e('0x56')});}})[_0xae5e('0x38')](function(_0x5c1401){_0x352da4(_0x5c1401);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xae5e('0x30')](function(_0x10fd06,_0x418319,_0x4d6bd8){return licenseUtil[_0xae5e('0x55')]()['then'](function(_0xff7382){if(_0xff7382[_0xae5e('0x57')]){_0x4d6bd8();}else{return _0x418319[_0xae5e('0x35')](0x193)[_0xae5e('0x41')]({'message':_0xae5e('0x56')});}})['catch'](function(_0x3d81e4){_0x4d6bd8(_0x3d81e4);});});};exports['isMiddleware']=function(_0x38d142,_0x588815,_0x430e2f){_0x38d142[_0xae5e('0x58')]=!![];return _0x430e2f();};exports[_0xae5e('0x59')]=function signToken(_0x5cd0f9){return signJwt(_0x5cd0f9);};exports[_0xae5e('0x5a')]=function(_0x1886f3,_0x250a09){if(!_0x1886f3[_0xae5e('0x31')]){return _0x250a09[_0xae5e('0x35')](0x194)[_0xae5e('0x41')]({'message':_0xae5e('0x5b')});}var _0x1aae34={'payload':{'id':_0x1886f3[_0xae5e('0x31')]['id'],'role':_0x1886f3['user'][_0xae5e('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1aae34)['then'](function(_0x259655){_0x250a09[_0xae5e('0x5c')](_0xae5e('0x5d'),_0x259655);_0x250a09['redirect'](_0xae5e('0x5e'));})[_0xae5e('0x38')](function(_0x2a5f3b){return _0x250a09['status'](0x1f4)['send'](_0x2a5f3b);});};exports[_0xae5e('0x5f')]=function(_0x436072){if(_[_0xae5e('0x60')](_0x436072[_0xae5e('0x4b')])||_[_0xae5e('0x60')](_0x436072[_0xae5e('0x61')])){return null;}else{return createJwt(_0x436072);}};exports[_0xae5e('0x62')]=function(_0x198143){_0x198143['apiKeyNonce']=generateNonce();_0x198143[_0xae5e('0x61')]=generateIssuedAt();return createJwt(_0x198143);};exports[_0xae5e('0x63')]=function(_0x30850c,_0x5d711a){var _0x337e05=_0x30850c[_0xae5e('0x44')][_0xae5e('0x45')];if(_0x337e05){var _0x3ed497={'nonce':_0x5d711a[_0xae5e('0x4b')],'iat':_0x5d711a[_0xae5e('0x61')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x337e05,_0x3ed497)[_0xae5e('0x3e')](function(){return generateApiKey(_0x5d711a);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x21d5f5){var _0x129650=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x129650[_0xae5e('0x64')](_0x21d5f5))throw new db[(_0xae5e('0x65'))]['ValidationError'](_0xae5e('0x66'));return;};exports[_0xae5e('0x67')]=function(_0x5489c1,_0x98eccc,_0xdf85ea){var _0x93c4b4=encryptor[_0xae5e('0x68')](_0x98eccc)[_0xae5e('0x69')](',');for(var _0x467184=0x0;_0x467184<_0xdf85ea;_0x467184++){if(!_0x93c4b4[_0x467184])break;if(_0x5489c1[_0xae5e('0x6a')]()===_0x93c4b4[_0x467184]['toLowerCase']()){var _0x3fad08=util[_0xae5e('0x6b')](_0xae5e('0x6c'),_0xdf85ea);if(_0xdf85ea===0x1){_0x3fad08=_0xae5e('0x6d');}throw new db[(_0xae5e('0x65'))][(_0xae5e('0x6e'))](_0x3fad08);}}return;};exports['updatePasswordsHistory']=function(_0x405e3a,_0x127a87){var _0x560ee2=_0x127a87?encryptor[_0xae5e('0x68')](_0x127a87)[_0xae5e('0x69')](','):[];if(_0x560ee2[_0xae5e('0x6f')]===0x5){_0x560ee2[_0xae5e('0x70')](-0x1,0x1);}_0x560ee2[_0xae5e('0x71')](_0x405e3a);return encryptor[_0xae5e('0x72')](_0x560ee2[_0xae5e('0x73')](','));};function signJwt(_0x1f2e51){var _0x579548=BPromise[_0xae5e('0x74')](jwt[_0xae5e('0x75')],{'context':jwt});var _0x4516bf=_0x1f2e51[_0xae5e('0x76')]||config[_0xae5e('0xc')][_0xae5e('0xd')];return new BPromise(function(_0x339696,_0x37815c){_0x579548(_0x1f2e51['payload'],_0x4516bf,_0x1f2e51[_0xae5e('0x77')])[_0xae5e('0x3e')](function(_0x32f783){_0x339696(_0x32f783);})['catch'](function(_0x45606a){_0x37815c(_0x45606a);});});}function verifyJwt(_0x47a9ec,_0x443238,_0x4e7a52){var _0xa68cc2=BPromise['promisify'](jwt[_0xae5e('0x78')],{'context':jwt});var _0x4acb82=_0x4e7a52||config['secrets'][_0xae5e('0xd')];return new BPromise(function(_0x5ecbde,_0x540f45){_0xa68cc2(_0x47a9ec,_0x4acb82,_0x443238)[_0xae5e('0x3e')](function(_0x582546){_0x5ecbde(_0x582546);})[_0xae5e('0x38')](function(_0x23a9ff){_0x540f45(_0x23a9ff);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0xae5e('0x79')](Date[_0xae5e('0x7a')]()/0x3e8)[_0xae5e('0x7b')]();}function createJwt(_0x494e7e){var _0x44da7a={'payload':{'iat':_0x494e7e[_0xae5e('0x61')],'nonce':_0x494e7e[_0xae5e('0x4b')]},'options':{'algorithm':_0xae5e('0x7c'),'subject':_0x494e7e['id'][_0xae5e('0x7b')](),'issuer':hardwareConf[_0xae5e('0x46')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x44da7a)[_0xae5e('0x3e')](function(_0xdff06f){return{'iat':_0x494e7e[_0xae5e('0x61')],'nonce':_0x494e7e[_0xae5e('0x4b')],'token':_0xdff06f};});} \ No newline at end of file +var _0x9d7c=['openchannelPause','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarExpires','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','isChatInteractionAuthorized','use','ChatInteraction','params','closed','then','disposition','unmanaged','json','Unmanaged.','headers','authorization','Basic','User','authenticate','Wrong\x20credentials.','startsWith','Bearer','status','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','user','catch','find','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','payload','options','randomBytes','toString','floor','now','../../mysqldb','../../config/environment','../../config/license/util','composable-middleware','bluebird','util','moment','secrets','session','name','internal','userpic','permissions','md5secret','voicePause','chatPause','mailPause'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x9d7c,0xdf));var _0xc9d7=function(_0x503ffd,_0x8ecde){_0x503ffd=_0x503ffd-0x0;var _0x160437=_0x9d7c[_0x503ffd];return _0x160437;};'use strict';var db=require(_0xc9d7('0x0'))['db'];var config=require(_0xc9d7('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xc9d7('0x2'));var encryptor=require('../encryptor');var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0xc9d7('0x3'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0xc9d7('0x4'));var util=require(_0xc9d7('0x5'));var moment=require(_0xc9d7('0x6'));var validateJwt=expressJwt({'secret':config[_0xc9d7('0x7')][_0xc9d7('0x8')]});var userAttributes=['id','role','fullname',_0xc9d7('0x9'),_0xc9d7('0xa'),'email',_0xc9d7('0xb'),_0xc9d7('0xc'),_0xc9d7('0xd'),_0xc9d7('0xe'),_0xc9d7('0xf'),_0xc9d7('0x10'),'faxPause','smsPause',_0xc9d7('0x11'),'pauseType','showWebBar',_0xc9d7('0x12'),_0xc9d7('0x13'),_0xc9d7('0x14'),_0xc9d7('0x15'),'passwordResetAt',_0xc9d7('0x16'),_0xc9d7('0x17'),_0xc9d7('0x18'),_0xc9d7('0x19'),_0xc9d7('0x1a'),'phoneBarEnableDtmfTone','phoneBarEnableSettings',_0xc9d7('0x1b'),'phoneBarPrefixRequired','phoneBarRemoteControl',_0xc9d7('0x1c'),_0xc9d7('0x1d'),_0xc9d7('0x1e'),'userProfileId',_0xc9d7('0x1f'),_0xc9d7('0x20'),_0xc9d7('0x21'),_0xc9d7('0x22'),'downloadOmnichannelInteractions',_0xc9d7('0x23'),'ignorePauseForPreviewCalls',_0xc9d7('0x24')];exports[_0xc9d7('0x25')]=function(){return this['isAuthenticated'](!![])[_0xc9d7('0x26')](function(_0x16079a,_0x3218df,_0x4b7e19){if(_0x16079a['user']){_0x4b7e19();}else{return db[_0xc9d7('0x27')]['findOne']({'where':{'id':_0x16079a[_0xc9d7('0x28')]['id']},'attributes':['id',_0xc9d7('0x29'),'disposition'],'raw':!![]})[_0xc9d7('0x2a')](function(_0x526d98){if(_0x526d98&&_0x526d98[_0xc9d7('0x29')]){return _0x3218df['status'](_0x526d98[_0xc9d7('0x2b')]===_0xc9d7('0x2c')?0x195:0x193)[_0xc9d7('0x2d')]({'message':_0x526d98[_0xc9d7('0x2b')]==='unmanaged'?_0xc9d7('0x2e'):'Forbidden.'});}else{_0x4b7e19();}})['catch'](function(_0x58370b){_0x4b7e19(_0x58370b);});}});};exports['isAuthenticated']=function isAuthenticated(_0x57dbc7){return compose()[_0xc9d7('0x26')](function(_0x1d5645,_0x5be70f,_0xd05aaa){var _0x47d0c2;if(_0x1d5645[_0xc9d7('0x2f')][_0xc9d7('0x30')]){if(_['startsWith'](_0x1d5645[_0xc9d7('0x2f')][_0xc9d7('0x30')],_0xc9d7('0x31'))){var _0x1c4c4d=basicAuth(_0x1d5645);db[_0xc9d7('0x32')]['find']({'where':{'name':_0x1c4c4d[_0xc9d7('0x9')]}})[_0xc9d7('0x2a')](function(_0x24459d){if(!_0x24459d||!_0x24459d[_0xc9d7('0x33')](_0x1c4c4d['pass'])){return _0x5be70f['status'](0x191)[_0xc9d7('0x2d')]({'message':_0xc9d7('0x34')});}_0x1d5645['user']={'id':_0x24459d['id']};_0xd05aaa();})['catch'](function(_0x4a461c){_0xd05aaa(_0x4a461c);});}else if(_[_0xc9d7('0x35')](_0x1d5645[_0xc9d7('0x2f')][_0xc9d7('0x30')],_0xc9d7('0x36'))){validateJwt(_0x1d5645,_0x5be70f,_0xd05aaa);}else{if(_0x57dbc7){_0xd05aaa();}else{return _0x5be70f[_0xc9d7('0x37')](0x193)[_0xc9d7('0x2d')]({'message':_0xc9d7('0x38')});}}}else if(_0x1d5645[_0xc9d7('0x39')]['apikey']){try{var _0xdc58e3={'audience':hardwareConf[_0xc9d7('0x3a')](),'issuer':hardwareConf[_0xc9d7('0x3a')]()};verifyJwt(_0x1d5645[_0xc9d7('0x39')][_0xc9d7('0x3b')],_0xdc58e3)[_0xc9d7('0x2a')](function(_0x56f02c){return db['User']['find']({'where':{'id':_0x56f02c[_0xc9d7('0x3c')]}})[_0xc9d7('0x2a')](function(_0x2129d1){_0x47d0c2=_0x2129d1;return db[_0xc9d7('0x3d')]['findOne']({'where':{'id':0x1},'attributes':[_0xc9d7('0x3e'),_0xc9d7('0x3f')],'raw':!![]});})[_0xc9d7('0x2a')](function(_0x514ee6){if(!_0x47d0c2||!_[_0xc9d7('0x40')](_0x47d0c2['apiKeyNonce'],_0x56f02c[_0xc9d7('0x41')])){return _0x5be70f[_0xc9d7('0x37')](0x191)[_0xc9d7('0x2d')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x47d0c2['disabled']){return _0x5be70f[_0xc9d7('0x37')](0x191)[_0xc9d7('0x2d')]({'message':_0xc9d7('0x42')});}if(_0x47d0c2[_0xc9d7('0x43')]){if(_0x514ee6[_0xc9d7('0x3f')]>0x0){if(moment(_0x47d0c2[_0xc9d7('0x44')])[_0xc9d7('0x45')](_0x514ee6[_0xc9d7('0x3f')],_0xc9d7('0x46'))>moment()){return _0x5be70f[_0xc9d7('0x37')](0x191)[_0xc9d7('0x2d')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x5be70f[_0xc9d7('0x37')](0x191)[_0xc9d7('0x2d')]({'message':_0xc9d7('0x42')});}}_0x1d5645[_0xc9d7('0x47')]={'id':_0x47d0c2['id']};_0xd05aaa();});})[_0xc9d7('0x48')](function(){return _0x5be70f[_0xc9d7('0x37')](0x191)[_0xc9d7('0x2d')]({'message':_0xc9d7('0x42')});});}catch(_0x21ae96){_0xd05aaa(_0x21ae96);}}else if(_0x57dbc7){_0xd05aaa();}else{return _0x5be70f[_0xc9d7('0x37')](0x193)[_0xc9d7('0x2d')]({'message':_0xc9d7('0x38')});}})[_0xc9d7('0x26')](function(_0x1f0813,_0x47415e,_0x220981){if(_0x1f0813[_0xc9d7('0x47')]){db[_0xc9d7('0x32')][_0xc9d7('0x49')]({'where':{'id':_0x1f0813[_0xc9d7('0x47')]['id']},'attributes':userAttributes})['then'](function(_0x29582b){if(!_0x29582b){return _0x47415e['status'](0x194)[_0xc9d7('0x2d')]({'message':_0xc9d7('0x4a')});}_0x1f0813[_0xc9d7('0x47')]=_0x29582b;_0x220981();})[_0xc9d7('0x48')](function(_0xd96816){_0x220981(_0xd96816);});}else if(_0x57dbc7){_0x220981();}else{return _0x47415e[_0xc9d7('0x37')](0x194)[_0xc9d7('0x2d')]({'message':_0xc9d7('0x4b')});}});};exports[_0xc9d7('0x4c')]=function canUpdate(){return compose()[_0xc9d7('0x26')](function(_0x70fc5a,_0x42a082,_0x4fe8d6){return licenseUtil['getLicense']()[_0xc9d7('0x2a')](function(_0x30edd2){if(_0x30edd2[_0xc9d7('0x4d')]){_0x4fe8d6();}else{return _0x42a082['status'](0x193)[_0xc9d7('0x2d')]({'message':_0xc9d7('0x4e')});}})[_0xc9d7('0x48')](function(_0x42e4e3){_0x4fe8d6(_0x42e4e3);});});};exports[_0xc9d7('0x4f')]=function isWebrtcLicence(){return compose()['use'](function(_0xcdcac9,_0x557d82,_0x360867){return licenseUtil[_0xc9d7('0x50')]()[_0xc9d7('0x2a')](function(_0x45a223){if(_0x45a223[_0xc9d7('0x51')]){_0x360867();}else{return _0x557d82[_0xc9d7('0x37')](0x193)['json']({'message':_0xc9d7('0x4e')});}})[_0xc9d7('0x48')](function(_0x365017){_0x360867(_0x365017);});});};exports[_0xc9d7('0x52')]=function(_0x1ca155,_0x4219df,_0x19d862){_0x1ca155[_0xc9d7('0x52')]=!![];return _0x19d862();};exports[_0xc9d7('0x53')]=function signToken(_0x235e6f){return signJwt(_0x235e6f);};exports[_0xc9d7('0x54')]=function(_0x2a8d8a,_0x140de6){if(!_0x2a8d8a[_0xc9d7('0x47')]){return _0x140de6[_0xc9d7('0x37')](0x194)[_0xc9d7('0x2d')]({'message':_0xc9d7('0x55')});}var _0x4fc13f={'payload':{'id':_0x2a8d8a[_0xc9d7('0x47')]['id'],'role':_0x2a8d8a[_0xc9d7('0x47')][_0xc9d7('0x56')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4fc13f)['then'](function(_0x322947){_0x140de6[_0xc9d7('0x57')](_0xc9d7('0x58'),_0x322947);_0x140de6[_0xc9d7('0x59')](_0xc9d7('0x5a'));})[_0xc9d7('0x48')](function(_0x27bf6c){return _0x140de6['status'](0x1f4)[_0xc9d7('0x5b')](_0x27bf6c);});};exports[_0xc9d7('0x5c')]=function(_0x2371b9){if(_[_0xc9d7('0x5d')](_0x2371b9[_0xc9d7('0x5e')])||_[_0xc9d7('0x5d')](_0x2371b9[_0xc9d7('0x5f')])){return null;}else{return createJwt(_0x2371b9);}};exports['generateApiKey']=function(_0x31a57c){_0x31a57c['apiKeyNonce']=generateNonce();_0x31a57c[_0xc9d7('0x5f')]=generateIssuedAt();return createJwt(_0x31a57c);};exports[_0xc9d7('0x60')]=function(_0x5a957e,_0x192eff){var _0x27577b=_0x5a957e[_0xc9d7('0x39')]['apikey'];if(_0x27577b){var _0x324b57={'nonce':_0x192eff[_0xc9d7('0x5e')],'iat':_0x192eff['apiKeyIat'],'audience':hardwareConf[_0xc9d7('0x3a')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x27577b,_0x324b57)[_0xc9d7('0x2a')](function(){return generateApiKey(_0x192eff);});}else{throw{'message':_0xc9d7('0x61')};}};exports[_0xc9d7('0x62')]=function(_0x5c6cc6){var _0x7ac817=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x7ac817[_0xc9d7('0x63')](_0x5c6cc6))throw new db[(_0xc9d7('0x64'))]['ValidationError'](_0xc9d7('0x65'));return;};exports[_0xc9d7('0x66')]=function(_0x489eb0,_0x51341a,_0x32695f){var _0x55e942=encryptor[_0xc9d7('0x67')](_0x51341a)['split'](',');for(var _0x4e136c=0x0;_0x4e136c<_0x32695f;_0x4e136c++){if(!_0x55e942[_0x4e136c])break;if(_0x489eb0[_0xc9d7('0x68')]()===_0x55e942[_0x4e136c][_0xc9d7('0x68')]()){var _0x11af32=util['format'](_0xc9d7('0x69'),_0x32695f);if(_0x32695f===0x1){_0x11af32='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize']['ValidationError'](_0x11af32);}}return;};exports[_0xc9d7('0x6a')]=function(_0x45833b,_0x1038e1){var _0x554b3c=_0x1038e1?encryptor[_0xc9d7('0x67')](_0x1038e1)['split'](','):[];if(_0x554b3c[_0xc9d7('0x6b')]===0x5){_0x554b3c['splice'](-0x1,0x1);}_0x554b3c[_0xc9d7('0x6c')](_0x45833b);return encryptor[_0xc9d7('0x6d')](_0x554b3c[_0xc9d7('0x6e')](','));};function signJwt(_0x42f39d){var _0x1a84c1=BPromise[_0xc9d7('0x6f')](jwt[_0xc9d7('0x70')],{'context':jwt});var _0x2dfd00=_0x42f39d[_0xc9d7('0x71')]||config[_0xc9d7('0x7')][_0xc9d7('0x8')];return new BPromise(function(_0x5862f6,_0xeba3fe){_0x1a84c1(_0x42f39d[_0xc9d7('0x72')],_0x2dfd00,_0x42f39d[_0xc9d7('0x73')])[_0xc9d7('0x2a')](function(_0x4560d6){_0x5862f6(_0x4560d6);})[_0xc9d7('0x48')](function(_0x26156d){_0xeba3fe(_0x26156d);});});}function verifyJwt(_0x11d5e3,_0x18c74e,_0x3ca721){var _0x2186d2=BPromise[_0xc9d7('0x6f')](jwt['verify'],{'context':jwt});var _0x37fdb9=_0x3ca721||config['secrets']['session'];return new BPromise(function(_0x12b0cc,_0x2255e4){_0x2186d2(_0x11d5e3,_0x37fdb9,_0x18c74e)['then'](function(_0x515dd7){_0x12b0cc(_0x515dd7);})[_0xc9d7('0x48')](function(_0x346056){_0x2255e4(_0x346056);});});}function generateNonce(){return crypto[_0xc9d7('0x74')](0x10)[_0xc9d7('0x75')]('hex');}function generateIssuedAt(){return Math[_0xc9d7('0x76')](Date[_0xc9d7('0x77')]()/0x3e8)[_0xc9d7('0x75')]();}function createJwt(_0x7e067e){var _0x3ce190={'payload':{'iat':_0x7e067e[_0xc9d7('0x5f')],'nonce':_0x7e067e[_0xc9d7('0x5e')]},'options':{'algorithm':'HS512','subject':_0x7e067e['id'][_0xc9d7('0x75')](),'issuer':hardwareConf[_0xc9d7('0x3a')](),'audience':hardwareConf[_0xc9d7('0x3a')]()}};return signJwt(_0x3ce190)['then'](function(_0x292e50){return{'iat':_0x7e067e[_0xc9d7('0x5f')],'nonce':_0x7e067e['apiKeyNonce'],'token':_0x292e50};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 8438e41..28716c5 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 _0x0a49=['write','end','final','binary','close','unlink','decryptFile','createDecipher','update','encryptString','base64','decryptString','secret','utf8','bluebird','lodash','../../config/environment','../../config/logger','app','session','aes-256-ctr','encrypt','algorithm','join','error','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x0a49,0xb3));var _0x90a4=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0x0a49[_0xdd827a];return _0x2f46f1;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x90a4('0x0'));var _=require(_0x90a4('0x1'));var config=require(_0x90a4('0x2'));var logger=require(_0x90a4('0x3'))(_0x90a4('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x90a4('0x5')],'algorithm':_0x90a4('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0x90a4('0x7')]&&config[_0x90a4('0x7')][_0x90a4('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x90a4('0x8')]);if(isSupported){fileOptions[_0x90a4('0x8')]=config[_0x90a4('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x90a4('0x9')](',\x20');logger[_0x90a4('0xa')](config[_0x90a4('0x7')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x33c5fb){return AES_SUPPORTED_RX['test'](_0x33c5fb);}function getSupportedCiphers(){return crypto[_0x90a4('0xb')]()[_0x90a4('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x38ad08){return getSupportedCiphers()['indexOf'](_0x38ad08)>-0x1;}function combineOptions(_0x46d6fe){var _0x379b18={};for(var _0x186274 in fileOptions){if(fileOptions['hasOwnProperty'](_0x186274)){_0x379b18[_0x186274]=fileOptions[_0x186274];}}if(_0x46d6fe){for(var _0x304874 in _0x46d6fe){if(_0x46d6fe[_0x90a4('0xd')](_0x304874)){_0x379b18[_0x304874]=_0x46d6fe[_0x304874];}}}return _0x379b18;}exports[_0x90a4('0xe')]=function(_0x30a052,_0x5ab688,_0x22694c,_0x7b1c8e){return new BPromise(function(_0x57d957,_0xbd6271){_0x7b1c8e=combineOptions(_0x7b1c8e);var _0x1d7e1a=new Buffer(_0x22694c);var _0x4c8b67=fs[_0x90a4('0xf')](_0x30a052);var _0x1f77d6=fs[_0x90a4('0x10')](_0x5ab688);var _0x3d9c2d=crypto[_0x90a4('0x11')](_0x7b1c8e[_0x90a4('0x8')],_0x1d7e1a);_0x4c8b67['on'](_0x90a4('0x12'),function(_0x383b3e){var _0x3b43ea=new Buffer(_0x3d9c2d['update'](_0x383b3e),'binary');_0x1f77d6[_0x90a4('0x13')](_0x3b43ea);});_0x4c8b67['on'](_0x90a4('0x14'),function(){try{var _0x337380=new Buffer(_0x3d9c2d[_0x90a4('0x15')](_0x90a4('0x16')),_0x90a4('0x16'));_0x1f77d6[_0x90a4('0x13')](_0x337380);_0x1f77d6[_0x90a4('0x14')]();_0x1f77d6['on'](_0x90a4('0x17'),function(){return _0x57d957(_0x5ab688);});}catch(_0x5a2920){fs[_0x90a4('0x18')](_0x5ab688);return _0xbd6271(_0x5a2920);}});});};exports[_0x90a4('0x19')]=function(_0x53312a,_0x4b279b,_0x125cc0,_0x4a2044){return new BPromise(function(_0x1f2f94,_0x28aed8){_0x4a2044=combineOptions(_0x4a2044);var _0x36c9ba=new Buffer(_0x125cc0);var _0x2c8c43=fs[_0x90a4('0xf')](_0x53312a);var _0x2a6f21=fs[_0x90a4('0x10')](_0x4b279b);var _0x1d7010=crypto[_0x90a4('0x1a')](_0x4a2044['algorithm'],_0x36c9ba);_0x2c8c43['on'](_0x90a4('0x12'),function(_0x1a70aa){var _0x53b6f1=new Buffer(_0x1d7010[_0x90a4('0x1b')](_0x1a70aa),_0x90a4('0x16'));_0x2a6f21[_0x90a4('0x13')](_0x53b6f1);});_0x2c8c43['on']('end',function(){try{var _0x53372a=new Buffer(_0x1d7010[_0x90a4('0x15')](_0x90a4('0x16')),'binary');_0x2a6f21[_0x90a4('0x13')](_0x53372a);_0x2a6f21[_0x90a4('0x14')]();_0x2a6f21['on']('close',function(){return _0x1f2f94(_0x4b279b);});}catch(_0xa3c149){fs['unlink'](_0x4b279b);return _0x28aed8(_0xa3c149);}});});};exports[_0x90a4('0x1c')]=function(_0x58dedc,_0x2cfe6f,_0x442a95){var _0x18b522=_0x442a95||stringOptions[_0x90a4('0x8')];var _0x4d47c0=_0x2cfe6f||stringOptions['secret'];var _0x357b62=crypto[_0x90a4('0x11')](_0x18b522,_0x4d47c0);var _0x2b7b4e=_0x357b62['update'](_0x58dedc,'utf8',_0x90a4('0x1d'));_0x2b7b4e+=_0x357b62['final']('base64');return _0x2b7b4e;};exports[_0x90a4('0x1e')]=function(_0x857f48,_0x497cf4,_0xa22faa){var _0xb28e1=_0xa22faa||stringOptions[_0x90a4('0x8')];var _0x3ed53c=_0x497cf4||stringOptions[_0x90a4('0x1f')];var _0x1fa118=crypto['createDecipher'](_0xb28e1,_0x3ed53c);var _0xdd49bd=_0x1fa118[_0x90a4('0x1b')](_0x857f48,'base64',_0x90a4('0x20'));_0xdd49bd+=_0x1fa118[_0x90a4('0x15')](_0x90a4('0x20'));return _0xdd49bd;}; \ No newline at end of file +var _0xa022=['utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','session','aes-256-ctr','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','hasOwnProperty','encryptFile','createReadStream','createWriteStream','update','end','binary','unlink','decryptFile','createDecipher','write','final','close','encryptString','secret'];(function(_0x246593,_0x185e9c){var _0x5b72c2=function(_0x566325){while(--_0x566325){_0x246593['push'](_0x246593['shift']());}};_0x5b72c2(++_0x185e9c);}(_0xa022,0xe3));var _0x2a02=function(_0x45659d,_0x1f7a9a){_0x45659d=_0x45659d-0x0;var _0x43c50a=_0xa022[_0x45659d];return _0x43c50a;};'use strict';var crypto=require(_0x2a02('0x0'));var fs=require('fs');var BPromise=require(_0x2a02('0x1'));var _=require(_0x2a02('0x2'));var config=require(_0x2a02('0x3'));var logger=require(_0x2a02('0x4'))(_0x2a02('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x2a02('0x6')],'algorithm':_0x2a02('0x7')};const fileOptions={'algorithm':_0x2a02('0x8')};if(config[_0x2a02('0x9')]&&config[_0x2a02('0x9')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x2a02('0x9')][_0x2a02('0xa')]);if(isSupported){fileOptions[_0x2a02('0xa')]=config[_0x2a02('0x9')][_0x2a02('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x2a02('0x9')][_0x2a02('0xa')],_0x2a02('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x1e5eb1){return AES_SUPPORTED_RX[_0x2a02('0xc')](_0x1e5eb1);}function getSupportedCiphers(){return crypto[_0x2a02('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x111fef){return getSupportedCiphers()['indexOf'](_0x111fef)>-0x1;}function combineOptions(_0xefea23){var _0x10856a={};for(var _0x8c7ab5 in fileOptions){if(fileOptions[_0x2a02('0xe')](_0x8c7ab5)){_0x10856a[_0x8c7ab5]=fileOptions[_0x8c7ab5];}}if(_0xefea23){for(var _0x13b5c5 in _0xefea23){if(_0xefea23[_0x2a02('0xe')](_0x13b5c5)){_0x10856a[_0x13b5c5]=_0xefea23[_0x13b5c5];}}}return _0x10856a;}exports[_0x2a02('0xf')]=function(_0x1e2968,_0x338aef,_0x2f424d,_0x99c28a){return new BPromise(function(_0x3fb7fe,_0x3393aa){_0x99c28a=combineOptions(_0x99c28a);var _0x15ecdd=new Buffer(_0x2f424d);var _0x5770db=fs[_0x2a02('0x10')](_0x1e2968);var _0x5c20e7=fs[_0x2a02('0x11')](_0x338aef);var _0xd9b11e=crypto['createCipher'](_0x99c28a[_0x2a02('0xa')],_0x15ecdd);_0x5770db['on']('data',function(_0x5bf502){var _0x2d28f7=new Buffer(_0xd9b11e[_0x2a02('0x12')](_0x5bf502),'binary');_0x5c20e7['write'](_0x2d28f7);});_0x5770db['on'](_0x2a02('0x13'),function(){try{var _0x52b2ae=new Buffer(_0xd9b11e['final'](_0x2a02('0x14')),_0x2a02('0x14'));_0x5c20e7['write'](_0x52b2ae);_0x5c20e7['end']();_0x5c20e7['on']('close',function(){return _0x3fb7fe(_0x338aef);});}catch(_0x119788){fs[_0x2a02('0x15')](_0x338aef);return _0x3393aa(_0x119788);}});});};exports[_0x2a02('0x16')]=function(_0x2ef4bf,_0x627215,_0x5ea04c,_0x1cb6b8){return new BPromise(function(_0x1a9a71,_0x906d40){_0x1cb6b8=combineOptions(_0x1cb6b8);var _0x4990ce=new Buffer(_0x5ea04c);var _0x3d13f8=fs[_0x2a02('0x10')](_0x2ef4bf);var _0x482a42=fs['createWriteStream'](_0x627215);var _0x103785=crypto[_0x2a02('0x17')](_0x1cb6b8[_0x2a02('0xa')],_0x4990ce);_0x3d13f8['on']('data',function(_0x4d1aad){var _0x7a4985=new Buffer(_0x103785[_0x2a02('0x12')](_0x4d1aad),_0x2a02('0x14'));_0x482a42[_0x2a02('0x18')](_0x7a4985);});_0x3d13f8['on'](_0x2a02('0x13'),function(){try{var _0x5820a6=new Buffer(_0x103785[_0x2a02('0x19')](_0x2a02('0x14')),_0x2a02('0x14'));_0x482a42['write'](_0x5820a6);_0x482a42[_0x2a02('0x13')]();_0x482a42['on'](_0x2a02('0x1a'),function(){return _0x1a9a71(_0x627215);});}catch(_0x57eb55){fs[_0x2a02('0x15')](_0x627215);return _0x906d40(_0x57eb55);}});});};exports[_0x2a02('0x1b')]=function(_0x14044b,_0x1942c1,_0x580892){var _0x3ce9d5=_0x580892||stringOptions[_0x2a02('0xa')];var _0x2035a6=_0x1942c1||stringOptions[_0x2a02('0x1c')];var _0x13dcb1=crypto['createCipher'](_0x3ce9d5,_0x2035a6);var _0x481dca=_0x13dcb1[_0x2a02('0x12')](_0x14044b,_0x2a02('0x1d'),_0x2a02('0x1e'));_0x481dca+=_0x13dcb1[_0x2a02('0x19')](_0x2a02('0x1e'));return _0x481dca;};exports[_0x2a02('0x1f')]=function(_0x3747c1,_0x1dc456,_0x525997){var _0x32cd42=_0x525997||stringOptions['algorithm'];var _0xbaf58a=_0x1dc456||stringOptions[_0x2a02('0x1c')];var _0x55e5ce=crypto['createDecipher'](_0x32cd42,_0xbaf58a);var _0x566897=_0x55e5ce[_0x2a02('0x12')](_0x3747c1,_0x2a02('0x1e'),_0x2a02('0x1d'));_0x566897+=_0x55e5ce[_0x2a02('0x19')]('utf8');return _0x566897;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index edf03a4..50b6333 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 _0x362e=['path','to-csv','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','sequelize','query','format','QueryTypes','SELECT','then','num','Empty','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','existsSync','join','each','%s%d.%s','%s.%s','csv','writeFileSync','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util'];(function(_0x4cdcdc,_0x34eac7){var _0x4704ce=function(_0x1de4ed){while(--_0x1de4ed){_0x4cdcdc['push'](_0x4cdcdc['shift']());}};_0x4704ce(++_0x34eac7);}(_0x362e,0xe5));var _0xe362=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0x362e[_0x3fb9dd];return _0x20136a;};'use strict';var util=require(_0xe362('0x0'));var path=require(_0xe362('0x1'));var _=require('lodash');var csv=require(_0xe362('0x2'));var fs=require('fs');var BPromise=require(_0xe362('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0xe362('0x4'))['db'];var dbH=require(_0xe362('0x4'))[_0xe362('0x5')];var logger=require(_0xe362('0x6'))(_0xe362('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xe362('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x52774c,_0x3d526e){var _0x407258={'status':_0x52774c};var _0x442a2c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3d526e){_0x407258[_0xe362('0x9')]=_0x3d526e;}return db[_0xe362('0xa')][_0xe362('0xb')](_0x407258,_0x442a2c);}function main(){var _0x126bca=0x1388;var _0x53ea7d;logger[_0xe362('0xc')](util['format'](_0xe362('0xd'),EXTRACTED_REPORT_ID,_0xe362('0xe')));return db['Setting'][_0xe362('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe362('0x10'),'splitSizeCsv']})['then'](function(_0x4ca5a6){if(_0x4ca5a6){_0x53ea7d=_0x4ca5a6;_0x126bca=_0x53ea7d[_0xe362('0x11')]||0x1388;}})['then'](function(){return dbH[_0xe362('0x12')][_0xe362('0x13')](util[_0xe362('0x14')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xe362('0x15')][_0xe362('0x16')]});})[_0xe362('0x17')](function(_0x2f7498){if(!_0x2f7498[0x0][_0xe362('0x18')]){return analyticExtractedReport(_0xe362('0x19'));}var _0x32afc6=[];var _0x36d532=0x0;if(_0x53ea7d[_0xe362('0x10')]){if(_0x2f7498&&_0x2f7498[_0xe362('0x1a')]){var _0x243423=_['range'](_0x2f7498[0x0][_0xe362('0x18')]/_0x126bca);var _0x5c9ff5=Number[_0xe362('0x1b')](_0x2f7498[0x0]['num']/_0x126bca)?_0x2f7498[0x0][_0xe362('0x18')]%_0x126bca:0x0;_0x243423[_0xe362('0x1c')](function(_0x1b1a53){if(_0x1b1a53>0x0){_0x36d532+=_0x126bca;}_0x32afc6[_0xe362('0x1d')](dbH[_0xe362('0x12')]['query'](util['format'](_0xe362('0x1e'),QUERY,_0x126bca,_0x36d532),{'type':dbH[_0xe362('0x12')]['QueryTypes'][_0xe362('0x16')]}));});if(_0x5c9ff5>0x0){_0x36d532+=_0x126bca;_0x32afc6[_0xe362('0x1d')](dbH[_0xe362('0x12')]['query'](util[_0xe362('0x14')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5c9ff5,_0x36d532),{'type':dbH[_0xe362('0x12')]['QueryTypes'][_0xe362('0x16')]}));}}}else{_0x32afc6[_0xe362('0x1d')](dbH[_0xe362('0x12')]['query'](QUERY,{'type':dbH[_0xe362('0x12')][_0xe362('0x15')]['SELECT']}));}var _0x258c30=path[_0xe362('0x1f')](PATH);var _0x1db87b=path['basename'](PATH,'.csv');var _0x25943e=_0x53ea7d['split']&&_0x32afc6[_0xe362('0x1a')]>0x1;var _0xf6d9b0=[];if(!fs[_0xe362('0x20')](path[_0xe362('0x21')](_0x258c30,_0x1db87b))&&_0x25943e){fs['mkdirSync'](path[_0xe362('0x21')](_0x258c30,_0x1db87b));}return BPromise[_0xe362('0x22')](_0x32afc6,function(_0x5e179b){_0xf6d9b0[_0xe362('0x1d')](_0x5e179b);})[_0xe362('0x17')](function(){for(var _0x3bd76d=0x0;_0x3bd76d<_0xf6d9b0[_0xe362('0x1a')];_0x3bd76d+=0x1){var _0x1970dd;var _0x36fe5a=_0xf6d9b0[_0x3bd76d];if(_0x25943e){_0x1970dd=path[_0xe362('0x21')](_0x258c30,_0x1db87b,util[_0xe362('0x14')](_0xe362('0x23'),_0x1db87b,_0x3bd76d,'csv'));}else{_0x1970dd=path['join'](_0x258c30,util[_0xe362('0x14')](_0xe362('0x24'),_0x1db87b,_0xe362('0x25')));}fs[_0xe362('0x26')](_0x1970dd,csv(_0x36fe5a));}})['then'](function(){if(_0x25943e){return new Promise(function(_0x8d790){zipdir(path['join'](_0x258c30,_0x1db87b),{'saveTo':path['join'](_0x258c30,util[_0xe362('0x14')](_0xe362('0x24'),_0x1db87b,_0xe362('0x27')))},function(_0x35c5dc,_0x2bdfc6){rimraf(path[_0xe362('0x21')](_0x258c30,_0x1db87b),function(){});_0x8d790('zip\x20finished');});});}})[_0xe362('0x17')](function(){logger[_0xe362('0xc')](util[_0xe362('0x14')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xe362('0x28'),_0x25943e?util[_0xe362('0x14')](_0xe362('0x24'),_0x1db87b,_0x25943e?_0xe362('0x27'):_0xe362('0x25')):null);});})[_0xe362('0x29')](function(_0xfea617){logger[_0xe362('0xc')](util[_0xe362('0x14')](_0xe362('0x2a'),EXTRACTED_REPORT_ID,_0xe362('0xe')),util[_0xe362('0x2b')](_0xfea617,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe362('0x2c'));})[_0xe362('0x2d')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xc922=['AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename'];(function(_0x2a7d50,_0x5206f3){var _0x34e83b=function(_0x58c2b5){while(--_0x58c2b5){_0x2a7d50['push'](_0x2a7d50['shift']());}};_0x34e83b(++_0x5206f3);}(_0xc922,0x159));var _0x2c92=function(_0xc9ef00,_0x1c8135){_0xc9ef00=_0xc9ef00-0x0;var _0x54385d=_0xc922[_0xc9ef00];return _0x54385d;};'use strict';var util=require(_0x2c92('0x0'));var path=require(_0x2c92('0x1'));var _=require(_0x2c92('0x2'));var csv=require(_0x2c92('0x3'));var fs=require('fs');var BPromise=require(_0x2c92('0x4'));var zipdir=require(_0x2c92('0x5'));var rimraf=require(_0x2c92('0x6'));var db=require(_0x2c92('0x7'))['db'];var dbH=require(_0x2c92('0x7'))[_0x2c92('0x8')];var logger=require('../../config/logger')(_0x2c92('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x2c92('0xa')][0x2]);var QUERY=process[_0x2c92('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x588ee8,_0x1d404e){var _0x4494a5={'status':_0x588ee8};var _0x3c8197={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1d404e){_0x4494a5[_0x2c92('0xb')]=_0x1d404e;}return db[_0x2c92('0xc')][_0x2c92('0xd')](_0x4494a5,_0x3c8197);}function main(){var _0x3db9a7=0x1388;var _0x171de1;logger['info'](util[_0x2c92('0xe')](_0x2c92('0xf'),EXTRACTED_REPORT_ID,_0x2c92('0x10')));return db[_0x2c92('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2c92('0x12'),_0x2c92('0x13')]})['then'](function(_0x1d2951){if(_0x1d2951){_0x171de1=_0x1d2951;_0x3db9a7=_0x171de1[_0x2c92('0x13')]||0x1388;}})[_0x2c92('0x14')](function(){return dbH[_0x2c92('0x15')][_0x2c92('0x16')](util[_0x2c92('0xe')](_0x2c92('0x17'),QUERY),{'type':dbH[_0x2c92('0x15')][_0x2c92('0x18')]['SELECT']});})[_0x2c92('0x14')](function(_0x1eb258){if(!_0x1eb258[0x0][_0x2c92('0x19')]){return analyticExtractedReport(_0x2c92('0x1a'));}var _0x1f538f=[];var _0x2f24ae=0x0;if(_0x171de1['split']){if(_0x1eb258&&_0x1eb258[_0x2c92('0x1b')]){var _0x100084=_[_0x2c92('0x1c')](_0x1eb258[0x0][_0x2c92('0x19')]/_0x3db9a7);var _0x4cf4ca=Number['isInteger'](_0x1eb258[0x0][_0x2c92('0x19')]/_0x3db9a7)?_0x1eb258[0x0][_0x2c92('0x19')]%_0x3db9a7:0x0;_0x100084[_0x2c92('0x1d')](function(_0x4a4e05){if(_0x4a4e05>0x0){_0x2f24ae+=_0x3db9a7;}_0x1f538f[_0x2c92('0x1e')](dbH[_0x2c92('0x15')][_0x2c92('0x16')](util[_0x2c92('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3db9a7,_0x2f24ae),{'type':dbH[_0x2c92('0x15')][_0x2c92('0x18')]['SELECT']}));});if(_0x4cf4ca>0x0){_0x2f24ae+=_0x3db9a7;_0x1f538f[_0x2c92('0x1e')](dbH[_0x2c92('0x15')]['query'](util[_0x2c92('0xe')](_0x2c92('0x1f'),QUERY,_0x4cf4ca,_0x2f24ae),{'type':dbH[_0x2c92('0x15')][_0x2c92('0x18')][_0x2c92('0x20')]}));}}}else{_0x1f538f[_0x2c92('0x1e')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x2c92('0x15')]['QueryTypes'][_0x2c92('0x20')]}));}var _0x1b6d9a=path[_0x2c92('0x21')](PATH);var _0x4b70fb=path[_0x2c92('0x22')](PATH,_0x2c92('0x23'));var _0x3ed3e1=_0x171de1[_0x2c92('0x12')]&&_0x1f538f[_0x2c92('0x1b')]>0x1;var _0x4cd60b=[];if(!fs[_0x2c92('0x24')](path['join'](_0x1b6d9a,_0x4b70fb))&&_0x3ed3e1){fs[_0x2c92('0x25')](path[_0x2c92('0x26')](_0x1b6d9a,_0x4b70fb));}return BPromise[_0x2c92('0x27')](_0x1f538f,function(_0x3d7c71){_0x4cd60b[_0x2c92('0x1e')](_0x3d7c71);})['then'](function(){for(var _0x1f1d07=0x0;_0x1f1d07<_0x4cd60b[_0x2c92('0x1b')];_0x1f1d07+=0x1){var _0x681f10;var _0x39b98a=_0x4cd60b[_0x1f1d07];if(_0x3ed3e1){_0x681f10=path['join'](_0x1b6d9a,_0x4b70fb,util[_0x2c92('0xe')](_0x2c92('0x28'),_0x4b70fb,_0x1f1d07,_0x2c92('0x29')));}else{_0x681f10=path['join'](_0x1b6d9a,util[_0x2c92('0xe')](_0x2c92('0x2a'),_0x4b70fb,_0x2c92('0x29')));}fs[_0x2c92('0x2b')](_0x681f10,csv(_0x39b98a));}})[_0x2c92('0x14')](function(){if(_0x3ed3e1){return new Promise(function(_0x537359){zipdir(path[_0x2c92('0x26')](_0x1b6d9a,_0x4b70fb),{'saveTo':path[_0x2c92('0x26')](_0x1b6d9a,util[_0x2c92('0xe')](_0x2c92('0x2a'),_0x4b70fb,_0x2c92('0x2c')))},function(_0x2d5b38,_0x35104a){rimraf(path[_0x2c92('0x26')](_0x1b6d9a,_0x4b70fb),function(){});_0x537359(_0x2c92('0x2d'));});});}})[_0x2c92('0x14')](function(){logger[_0x2c92('0x2e')](util[_0x2c92('0xe')](_0x2c92('0x2f'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x3ed3e1?util[_0x2c92('0xe')]('%s.%s',_0x4b70fb,_0x3ed3e1?_0x2c92('0x2c'):_0x2c92('0x29')):null);});})['catch'](function(_0x31d2b4){logger['info'](util[_0x2c92('0xe')](_0x2c92('0x30'),EXTRACTED_REPORT_ID,_0x2c92('0x10')),util[_0x2c92('0x31')](_0x31d2b4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2c92('0x32'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 5d3a16e..09dcf87 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 _0xf064=['split','splitSizePdf','then','range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','query','SELECT','dirname','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','pdf','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','info','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','channel','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','path','lodash','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','tableHeader','map','pick','toString','value','fill','length','push','body','concat','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','header','pageBreak','landscape','\x20/\x20','Arial','black','right','num','Empty','Setting','find'];(function(_0x2cc8bb,_0x5f2607){var _0x140e40=function(_0x80d96d){while(--_0x80d96d){_0x2cc8bb['push'](_0x2cc8bb['shift']());}};_0x140e40(++_0x5f2607);}(_0xf064,0x86));var _0x4f06=function(_0x1c7889,_0x24cd26){_0x1c7889=_0x1c7889-0x0;var _0x2f14e5=_0xf064[_0x1c7889];return _0x2f14e5;};'use strict';var _=require(_0x4f06('0x0'));var fs=require('fs');var util=require(_0x4f06('0x1'));var path=require('path');var moment=require(_0x4f06('0x2'));var htmlToPdfmake=require(_0x4f06('0x3'));var PdfPrinter=require(_0x4f06('0x4'));var zipdir=require(_0x4f06('0x5'));var rimraf=require(_0x4f06('0x6'));var JSDOM=require('jsdom')[_0x4f06('0x7')];var window=new JSDOM('')[_0x4f06('0x8')];var BPromise=require(_0x4f06('0x9'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4f06('0xa'))['dbH'];var logger=require(_0x4f06('0xb'))(_0x4f06('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4f06('0xd')][0x4];var NAME=process[_0x4f06('0xd')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x32a423,_0x68bfdb){var _0x62132c={'status':_0x32a423};var _0x404ac3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x68bfdb){_0x62132c[_0x4f06('0xe')]=_0x68bfdb;}return db[_0x4f06('0xf')][_0x4f06('0x10')](_0x62132c,_0x404ac3);}function getHeaders(_0x3c2cd3){return _['map'](_0x3c2cd3,function(_0x7b884a){return{'text':_0x7b884a,'style':_0x4f06('0x11')};});}function getRows(_0x35012c,_0xf58e6f){return _[_0x4f06('0x12')](_0xf58e6f,function(_0x520b46){return _(_0x520b46)[_0x4f06('0x13')](_0x35012c)[_0x4f06('0x12')](function(_0x1f97b4){return _0x1f97b4?_[_0x4f06('0x14')](_0x1f97b4):'';})[_0x4f06('0x15')]();});}function createTable(_0x5490c7,_0x5996c2){var _0x2dd718={'widths':_[_0x4f06('0x16')](Array(_0x5490c7[_0x4f06('0x17')]),0x91),'heights':function(_0x11db36){return _0x11db36===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x65c6c4=getHeaders(_0x5490c7);_0x2dd718['body'][_0x4f06('0x18')](_0x65c6c4);var _0x501890=getRows(_0x5490c7,_0x5996c2);_0x2dd718[_0x4f06('0x19')]=_0x2dd718['body'][_0x4f06('0x1a')](_0x501890);return _0x2dd718;}function createTables(_0x470be6){var _0x32b25c=[];var _0x467da0=_['chunk'](Object[_0x4f06('0x1b')](_0x470be6[0x0]),0x5);_0x467da0[_0x4f06('0x1c')](function(_0x5b9ff0){_0x32b25c[_0x4f06('0x18')](createTable(_0x5b9ff0,_0x470be6));});return _0x32b25c;}function getPDFDocDefinition(_0x131e77){var _0x4305a2=util[_0x4f06('0x1d')](_0x4f06('0x1e'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0x4f06('0x1d')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x4f06('0x1d')](FORMAT));var _0x5b57aa=[];for(var _0x147894=0x0;_0x147894<_0x131e77[_0x4f06('0x17')];_0x147894++){var _0x42d77f=[];if(_0x147894===0x0){_0x42d77f[_0x4f06('0x18')]({'text':_0x4305a2,'style':_0x4f06('0x1f')});}var _0x35d827={'table':_0x131e77[_0x147894]};if(_0x147894>0x0){_0x35d827[_0x4f06('0x20')]='before';_0x35d827['margin']=[0x0,0x46,0x0,0x0];}_0x42d77f[_0x4f06('0x18')](_0x35d827);_0x5b57aa[_0x4f06('0x18')](_0x42d77f);}return{'pageSize':'A4','pageOrientation':_0x4f06('0x21'),'content':_0x5b57aa,'footer':function(_0x58ac06,_0x3860a5){return{'text':_0x58ac06[_0x4f06('0x14')]()+_0x4f06('0x22')+_0x3860a5,'style':'footer'};},'defaultStyle':{'font':_0x4f06('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x4f06('0x24')},'footer':{'alignment':_0x4f06('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xf93580){var _0x460c8c=0x1388;var _0x1078ab;if(!_0xf93580[0x0][_0x4f06('0x26')]){return analyticExtractedReport(_0x4f06('0x27'));}return db[_0x4f06('0x28')][_0x4f06('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4f06('0x2a'),_0x4f06('0x2b')]})[_0x4f06('0x2c')](function(_0x4dc50e){if(_0x4dc50e){_0x1078ab=_0x4dc50e;_0x460c8c=_0x1078ab['splitSizePdf']||0x3e8;}})['then'](function(){var _0x682204=[];var _0x1b8fc2=0x0;if(_0x1078ab[_0x4f06('0x2a')]){if(_0xf93580&&_0xf93580['length']){var _0x1f045a=_[_0x4f06('0x2d')](_0xf93580[0x0][_0x4f06('0x26')]/_0x460c8c);var _0x7fd854=Number[_0x4f06('0x2e')](_0xf93580[0x0][_0x4f06('0x26')]/_0x460c8c)?_0xf93580[0x0][_0x4f06('0x26')]%_0x460c8c:0x0;_0x1f045a[_0x4f06('0x1c')](function(_0x3bfec3){if(_0x3bfec3>0x0){_0x1b8fc2+=_0x460c8c;}_0x682204[_0x4f06('0x18')](dbH['sequelize']['query'](util[_0x4f06('0x1d')](_0x4f06('0x2f'),QUERY,_0x460c8c,_0x1b8fc2),{'type':dbH[_0x4f06('0x30')][_0x4f06('0x31')]['SELECT']}));});if(_0x7fd854>0x0){_0x1b8fc2+=_0x460c8c;_0x682204[_0x4f06('0x18')](dbH[_0x4f06('0x30')][_0x4f06('0x32')](util[_0x4f06('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x7fd854,_0x1b8fc2),{'type':dbH[_0x4f06('0x30')][_0x4f06('0x31')][_0x4f06('0x33')]}));}}}else{_0x682204[_0x4f06('0x18')](dbH['sequelize'][_0x4f06('0x32')](QUERY,{'type':dbH[_0x4f06('0x30')][_0x4f06('0x31')]['SELECT']}));}var _0x1e7c8f=path[_0x4f06('0x34')](PATH);var _0x16c98a=path[_0x4f06('0x35')](PATH,_0x4f06('0x36'));var _0x31061c=_0x1078ab['split']&&_0x682204[_0x4f06('0x17')]>0x1;var _0x3dcc77=[];if(!fs[_0x4f06('0x37')](path[_0x4f06('0x38')](_0x1e7c8f,_0x16c98a))&&_0x31061c){fs['mkdirSync'](path[_0x4f06('0x38')](_0x1e7c8f,_0x16c98a));}return BPromise[_0x4f06('0x39')](_0x682204,function(_0x5f3bba){_0x3dcc77[_0x4f06('0x18')](_0x5f3bba);})[_0x4f06('0x2c')](function(){var _0x22435e=[];for(var _0x4831a9=0x0;_0x4831a9<_0x3dcc77[_0x4f06('0x17')];_0x4831a9+=0x1){var _0x705023=_0x3dcc77[_0x4831a9];var _0x2ac3ad=createTables(_[_0x4f06('0x3a')](_0x705023));var _0x3fdc6a;var _0x29f83b=getPDFDocDefinition(_0x2ac3ad);var _0x1a9185=getPDFPrinter();var _0x158776=_0x1a9185[_0x4f06('0x3b')](_0x29f83b);if(_0x31061c){_0x3fdc6a=path[_0x4f06('0x38')](_0x1e7c8f,_0x16c98a,util[_0x4f06('0x1d')]('%s%d.%s',_0x16c98a,_0x4831a9,_0x4f06('0x3c')));}else{_0x3fdc6a=path[_0x4f06('0x38')](_0x1e7c8f,util[_0x4f06('0x1d')](_0x4f06('0x3d'),_0x16c98a,_0x4f06('0x3c')));}_0x22435e['push'](writePDFDocument(_0x158776,_0x3fdc6a));}return Promise[_0x4f06('0x3e')](_0x22435e);})[_0x4f06('0x2c')](function(){if(_0x31061c){return new Promise(function(_0x47037e){zipdir(path[_0x4f06('0x38')](_0x1e7c8f,_0x16c98a),{'saveTo':path[_0x4f06('0x38')](_0x1e7c8f,util[_0x4f06('0x1d')](_0x4f06('0x3d'),_0x16c98a,_0x4f06('0x3f')))},function(){rimraf(path[_0x4f06('0x38')](_0x1e7c8f,_0x16c98a),function(){});_0x47037e(_0x4f06('0x40'));});});}})[_0x4f06('0x2c')](function(){if(!_0x31061c)return;rimraf(path[_0x4f06('0x38')](_0x1e7c8f,_0x16c98a),function(){});})[_0x4f06('0x2c')](function(){logger['info'](util[_0x4f06('0x1d')](_0x4f06('0x41'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x4f06('0x42'),_0x31061c?util[_0x4f06('0x1d')](_0x4f06('0x3d'),_0x16c98a,_0x31061c?_0x4f06('0x3f'):_0x4f06('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x4f06('0x1d')](_0x4f06('0x43'),EXTRACTED_REPORT_ID,_0x4f06('0x44')));return db[_0x4f06('0xf')][_0x4f06('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x4f06('0x2c')](function(_0x260b69){EXTRACTED_REPORT=_0x260b69;return dbH['sequelize'][_0x4f06('0x32')](util[_0x4f06('0x1d')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4f06('0x30')][_0x4f06('0x31')][_0x4f06('0x33')]});})[_0x4f06('0x2c')](extractReport)[_0x4f06('0x46')](function(_0x53ad60){logger[_0x4f06('0x47')](util[_0x4f06('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4f06('0x44')),util[_0x4f06('0x48')](_0x53ad60,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4f06('0x49'));})[_0x4f06('0x4a')](function(){process[_0x4f06('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x55b904=new PdfPrinter({'Arial':{'normal':__dirname+_0x4f06('0x4c'),'bold':__dirname+_0x4f06('0x4d'),'italics':__dirname+_0x4f06('0x4e'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x55b904;}function getPDFDocDefinitionFromHTML(_0x1d1816,_0x530b7e){var _0x1fd24f=util[_0x4f06('0x1d')]('%s\x20#%d',_0x530b7e[_0x4f06('0x4f')],_0x530b7e['interactionId']);var _0x5d4d3a=moment()[_0x4f06('0x1d')]('YYYY-MM-DD')['toString']();var _0x5bcf0d=htmlToPdfmake(_0x1d1816,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5bcf0d],'defaultStyle':{'font':_0x4f06('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4f06('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x4f06('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x4f06('0x50')}},'header':function(){return[{'text':_0x4f06('0x51'),'style':_0x4f06('0x1f')}];},'footer':function(_0x46a6e7,_0x115469){return[{'text':util[_0x4f06('0x1d')](_0x4f06('0x52'),_0x1fd24f,_0x46a6e7,_0x115469,_0x5d4d3a),'style':'footer'}];}};}function writePDFDocument(_0x1832d8,_0x58b240){return new Promise(function(_0x309794,_0x487517){var _0x2871c9=_0x1832d8['pipe'](fs[_0x4f06('0x53')](_0x58b240));_0x2871c9['on'](_0x4f06('0x54'),function(){_0x309794(_0x4f06('0x54'));});_0x2871c9['on'](_0x4f06('0x55'),function(_0x1fb940){_0x487517(_0x1fb940);});_0x1832d8[_0x4f06('0x56')]();});}exports['createPdfFromHTML']=function(_0x3f20dc,_0x1fdca7){var _0x36baa4=getPDFPrinter();var _0x49fd28=getPDFDocDefinitionFromHTML(_0x3f20dc,_0x1fdca7);var _0x326d40=_0x36baa4[_0x4f06('0x3b')](_0x49fd28);return writePDFDocument(_0x326d40,_0x1fdca7[_0x4f06('0x57')])[_0x4f06('0x46')](function(_0x2ce34b){throw _0x2ce34b;});}; \ No newline at end of file +var _0x4b60=['landscape','toString','\x20/\x20','footer','black','right','Empty','split','splitSizePdf','range','num','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','basename','existsSync','join','mkdirSync','each','then','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip\x20finished','info','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','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-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','pick','value','fill','length','body','push','concat','chunk','forEach','format','startDate','header','pageBreak','before','margin'];(function(_0x5967a5,_0xb8adc4){var _0x4299bc=function(_0x55cd09){while(--_0x55cd09){_0x5967a5['push'](_0x5967a5['shift']());}};_0x4299bc(++_0xb8adc4);}(_0x4b60,0x144));var _0x04b6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4b60[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x04b6('0x0'));var fs=require('fs');var util=require(_0x04b6('0x1'));var path=require(_0x04b6('0x2'));var moment=require(_0x04b6('0x3'));var htmlToPdfmake=require(_0x04b6('0x4'));var PdfPrinter=require(_0x04b6('0x5'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0x04b6('0x6'))[_0x04b6('0x7')];var window=new JSDOM('')[_0x04b6('0x8')];var BPromise=require(_0x04b6('0x9'));var db=require(_0x04b6('0xa'))['db'];var dbH=require(_0x04b6('0xa'))[_0x04b6('0xb')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x04b6('0xc')][0x2]);var QUERY=process[_0x04b6('0xc')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x04b6('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x27de6b,_0x4f0d42){var _0x4562b5={'status':_0x27de6b};var _0x16ff46={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4f0d42){_0x4562b5[_0x04b6('0xe')]=_0x4f0d42;}return db['AnalyticExtractedReport'][_0x04b6('0xf')](_0x4562b5,_0x16ff46);}function getHeaders(_0x4eb0bd){return _[_0x04b6('0x10')](_0x4eb0bd,function(_0x490d81){return{'text':_0x490d81,'style':'tableHeader'};});}function getRows(_0xcd1365,_0x5f39f2){return _['map'](_0x5f39f2,function(_0x49d2a2){return _(_0x49d2a2)[_0x04b6('0x11')](_0xcd1365)['map'](function(_0x470c81){return _0x470c81?_['toString'](_0x470c81):'';})[_0x04b6('0x12')]();});}function createTable(_0x14ffd0,_0x4b57fa){var _0x2ca429={'widths':_[_0x04b6('0x13')](Array(_0x14ffd0[_0x04b6('0x14')]),0x91),'heights':function(_0x5e766f){return _0x5e766f===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x56642f=getHeaders(_0x14ffd0);_0x2ca429[_0x04b6('0x15')][_0x04b6('0x16')](_0x56642f);var _0xe1a852=getRows(_0x14ffd0,_0x4b57fa);_0x2ca429[_0x04b6('0x15')]=_0x2ca429[_0x04b6('0x15')][_0x04b6('0x17')](_0xe1a852);return _0x2ca429;}function createTables(_0x493558){var _0x48b23f=[];var _0x39336d=_[_0x04b6('0x18')](Object['keys'](_0x493558[0x0]),0x5);_0x39336d[_0x04b6('0x19')](function(_0x5712c0){_0x48b23f[_0x04b6('0x16')](createTable(_0x5712c0,_0x493558));});return _0x48b23f;}function getPDFDocDefinition(_0xcf32e7){var _0x1b344c=util[_0x04b6('0x1a')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x04b6('0x1b')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x04b6('0x1a')](FORMAT));var _0x4f6a9c=[];for(var _0x1f39b4=0x0;_0x1f39b4<_0xcf32e7['length'];_0x1f39b4++){var _0x5564a1=[];if(_0x1f39b4===0x0){_0x5564a1[_0x04b6('0x16')]({'text':_0x1b344c,'style':_0x04b6('0x1c')});}var _0x4602e4={'table':_0xcf32e7[_0x1f39b4]};if(_0x1f39b4>0x0){_0x4602e4[_0x04b6('0x1d')]=_0x04b6('0x1e');_0x4602e4[_0x04b6('0x1f')]=[0x0,0x46,0x0,0x0];}_0x5564a1['push'](_0x4602e4);_0x4f6a9c[_0x04b6('0x16')](_0x5564a1);}return{'pageSize':'A4','pageOrientation':_0x04b6('0x20'),'content':_0x4f6a9c,'footer':function(_0x3566e7,_0x1fa047){return{'text':_0x3566e7[_0x04b6('0x21')]()+_0x04b6('0x22')+_0x1fa047,'style':_0x04b6('0x23')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x04b6('0x24')},'footer':{'alignment':_0x04b6('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x54a26a){var _0x37856d=0x1388;var _0x36901e;if(!_0x54a26a[0x0]['num']){return analyticExtractedReport(_0x04b6('0x26'));}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x04b6('0x27'),_0x04b6('0x28')]})['then'](function(_0x3f1b1e){if(_0x3f1b1e){_0x36901e=_0x3f1b1e;_0x37856d=_0x36901e[_0x04b6('0x28')]||0x3e8;}})['then'](function(){var _0x3c8fd2=[];var _0x18b868=0x0;if(_0x36901e[_0x04b6('0x27')]){if(_0x54a26a&&_0x54a26a['length']){var _0x192bc5=_[_0x04b6('0x29')](_0x54a26a[0x0][_0x04b6('0x2a')]/_0x37856d);var _0x1a1e78=Number['isInteger'](_0x54a26a[0x0][_0x04b6('0x2a')]/_0x37856d)?_0x54a26a[0x0][_0x04b6('0x2a')]%_0x37856d:0x0;_0x192bc5['forEach'](function(_0x516cd3){if(_0x516cd3>0x0){_0x18b868+=_0x37856d;}_0x3c8fd2[_0x04b6('0x16')](dbH[_0x04b6('0x2b')]['query'](util[_0x04b6('0x1a')](_0x04b6('0x2c'),QUERY,_0x37856d,_0x18b868),{'type':dbH[_0x04b6('0x2b')][_0x04b6('0x2d')][_0x04b6('0x2e')]}));});if(_0x1a1e78>0x0){_0x18b868+=_0x37856d;_0x3c8fd2[_0x04b6('0x16')](dbH[_0x04b6('0x2b')][_0x04b6('0x2f')](util[_0x04b6('0x1a')](_0x04b6('0x2c'),QUERY,_0x1a1e78,_0x18b868),{'type':dbH[_0x04b6('0x2b')]['QueryTypes'][_0x04b6('0x2e')]}));}}}else{_0x3c8fd2[_0x04b6('0x16')](dbH[_0x04b6('0x2b')][_0x04b6('0x2f')](QUERY,{'type':dbH[_0x04b6('0x2b')][_0x04b6('0x2d')][_0x04b6('0x2e')]}));}var _0x271e0a=path['dirname'](PATH);var _0x4cccff=path[_0x04b6('0x30')](PATH,'.pdf');var _0x5009f4=_0x36901e['split']&&_0x3c8fd2['length']>0x1;var _0x274de8=[];if(!fs[_0x04b6('0x31')](path[_0x04b6('0x32')](_0x271e0a,_0x4cccff))&&_0x5009f4){fs[_0x04b6('0x33')](path[_0x04b6('0x32')](_0x271e0a,_0x4cccff));}return BPromise[_0x04b6('0x34')](_0x3c8fd2,function(_0x48e4f0){_0x274de8[_0x04b6('0x16')](_0x48e4f0);})[_0x04b6('0x35')](function(){var _0x2dde24=[];for(var _0x1a1a1b=0x0;_0x1a1a1b<_0x274de8['length'];_0x1a1a1b+=0x1){var _0x24db05=_0x274de8[_0x1a1a1b];var _0x1c767b=createTables(_[_0x04b6('0x36')](_0x24db05));var _0x42a5c1;var _0x2df3e0=getPDFDocDefinition(_0x1c767b);var _0x35ac9a=getPDFPrinter();var _0x498fdf=_0x35ac9a[_0x04b6('0x37')](_0x2df3e0);if(_0x5009f4){_0x42a5c1=path[_0x04b6('0x32')](_0x271e0a,_0x4cccff,util[_0x04b6('0x1a')](_0x04b6('0x38'),_0x4cccff,_0x1a1a1b,'pdf'));}else{_0x42a5c1=path[_0x04b6('0x32')](_0x271e0a,util['format']('%s.%s',_0x4cccff,_0x04b6('0x39')));}_0x2dde24[_0x04b6('0x16')](writePDFDocument(_0x498fdf,_0x42a5c1));}return Promise[_0x04b6('0x3a')](_0x2dde24);})['then'](function(){if(_0x5009f4){return new Promise(function(_0x481ef8){zipdir(path[_0x04b6('0x32')](_0x271e0a,_0x4cccff),{'saveTo':path[_0x04b6('0x32')](_0x271e0a,util['format'](_0x04b6('0x3b'),_0x4cccff,'zip'))},function(){rimraf(path[_0x04b6('0x32')](_0x271e0a,_0x4cccff),function(){});_0x481ef8(_0x04b6('0x3c'));});});}})['then'](function(){if(!_0x5009f4)return;rimraf(path['join'](_0x271e0a,_0x4cccff),function(){});})[_0x04b6('0x35')](function(){logger[_0x04b6('0x3d')](util[_0x04b6('0x1a')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x5009f4?util[_0x04b6('0x1a')]('%s.%s',_0x4cccff,_0x5009f4?_0x04b6('0x3e'):_0x04b6('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format'](_0x04b6('0x3f'),EXTRACTED_REPORT_ID,_0x04b6('0x40')));return db[_0x04b6('0x41')][_0x04b6('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x2107fb){EXTRACTED_REPORT=_0x2107fb;return dbH['sequelize'][_0x04b6('0x2f')](util['format'](_0x04b6('0x43'),QUERY),{'type':dbH[_0x04b6('0x2b')][_0x04b6('0x2d')][_0x04b6('0x2e')]});})['then'](extractReport)[_0x04b6('0x44')](function(_0x793213){logger[_0x04b6('0x3d')](util['format'](_0x04b6('0x45'),EXTRACTED_REPORT_ID,_0x04b6('0x40')),util[_0x04b6('0x46')](_0x793213,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x04b6('0x47')](function(){process[_0x04b6('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x434240=new PdfPrinter({'Arial':{'normal':__dirname+_0x04b6('0x49'),'bold':__dirname+_0x04b6('0x4a'),'italics':__dirname+_0x04b6('0x4b'),'bolditalics':__dirname+_0x04b6('0x4c')}});return _0x434240;}function getPDFDocDefinitionFromHTML(_0x46b0d3,_0x40f243){var _0x40292e=util['format'](_0x04b6('0x4d'),_0x40f243[_0x04b6('0x4e')],_0x40f243['interactionId']);var _0x28c12a=moment()[_0x04b6('0x1a')](_0x04b6('0x4f'))['toString']();var _0xb481a2=htmlToPdfmake(_0x46b0d3,{'window':window,'tableAutoSize':!![]});return{'content':[_0xb481a2],'defaultStyle':{'font':_0x04b6('0x50')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x04b6('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x04b6('0x51')}},'header':function(){return[{'text':_0x04b6('0x52'),'style':_0x04b6('0x1c')}];},'footer':function(_0x4cb9b2,_0x340f88){return[{'text':util[_0x04b6('0x1a')](_0x04b6('0x53'),_0x40292e,_0x4cb9b2,_0x340f88,_0x28c12a),'style':_0x04b6('0x23')}];}};}function writePDFDocument(_0x5b8b09,_0x2ae6f){return new Promise(function(_0x222309,_0x315487){var _0x39d7f3=_0x5b8b09[_0x04b6('0x54')](fs[_0x04b6('0x55')](_0x2ae6f));_0x39d7f3['on'](_0x04b6('0x56'),function(){_0x222309(_0x04b6('0x56'));});_0x39d7f3['on'](_0x04b6('0x57'),function(_0x7b2173){_0x315487(_0x7b2173);});_0x5b8b09[_0x04b6('0x58')]();});}exports['createPdfFromHTML']=function(_0x416fea,_0x18a2a5){var _0x1a2399=getPDFPrinter();var _0x2bb6cc=getPDFDocDefinitionFromHTML(_0x416fea,_0x18a2a5);var _0x3ec5eb=_0x1a2399[_0x04b6('0x37')](_0x2bb6cc);return writePDFDocument(_0x3ec5eb,_0x18a2a5[_0x04b6('0x2')])[_0x04b6('0x44')](function(_0x3617fa){throw _0x3617fa;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 0619f21..2653514 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 _0x4255=['query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','sequelize','format','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','split','existsSync','join','each','xlsx','writeFileSync','binary','%s.%s','info','XLSX','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','util','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeXlsx','then'];(function(_0x34c027,_0x123688){var _0x47bff0=function(_0x19c4a9){while(--_0x19c4a9){_0x34c027['push'](_0x34c027['shift']());}};_0x47bff0(++_0x123688);}(_0x4255,0x1bb));var _0x5425=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x4255[_0x1589dd];return _0x1bddd1;};'use strict';var util=require(_0x5425('0x0'));var path=require('path');var _=require(_0x5425('0x1'));var fs=require('fs');var json2xls=require(_0x5425('0x2'));var BPromise=require(_0x5425('0x3'));var zipdir=require(_0x5425('0x4'));var rimraf=require('rimraf');var db=require(_0x5425('0x5'))['db'];var dbH=require(_0x5425('0x5'))[_0x5425('0x6')];var logger=require(_0x5425('0x7'))(_0x5425('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x5425('0x9')][0x2]);var QUERY=process[_0x5425('0x9')][0x3];var PATH=process[_0x5425('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1cfe5c,_0x18c7e3){var _0x44bae9={'status':_0x1cfe5c};var _0x3414a6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x18c7e3){_0x44bae9['savename']=_0x18c7e3;}return db[_0x5425('0xa')][_0x5425('0xb')](_0x44bae9,_0x3414a6);}function main(){var _0x5dc37b=0x1388;var _0x362828;logger['info'](util['format'](_0x5425('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x5425('0xd')][_0x5425('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x5425('0xf')]})['then'](function(_0x28a1b0){if(_0x28a1b0){_0x362828=_0x28a1b0;_0x5dc37b=_0x362828[_0x5425('0xf')]||0x1388;}})[_0x5425('0x10')](function(){return dbH['sequelize'][_0x5425('0x11')](util['format'](_0x5425('0x12'),QUERY),{'type':dbH['sequelize'][_0x5425('0x13')][_0x5425('0x14')]});})[_0x5425('0x10')](function(_0x97919b){if(!_0x97919b[0x0][_0x5425('0x15')]){return analyticExtractedReport(_0x5425('0x16'));}var _0x5d5698=[];var _0x32f2b9=0x0;if(_0x362828['split']){if(_0x97919b&&_0x97919b[_0x5425('0x17')]){var _0xb76c1e=_[_0x5425('0x18')](_0x97919b[0x0][_0x5425('0x15')]/_0x5dc37b);var _0x5b414c=Number[_0x5425('0x19')](_0x97919b[0x0]['num']/_0x5dc37b)?_0x97919b[0x0][_0x5425('0x15')]%_0x5dc37b:0x0;_0xb76c1e['forEach'](function(_0x2307d6){if(_0x2307d6>0x0){_0x32f2b9+=_0x5dc37b;}_0x5d5698['push'](dbH[_0x5425('0x1a')][_0x5425('0x11')](util[_0x5425('0x1b')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5dc37b,_0x32f2b9),{'type':dbH[_0x5425('0x1a')][_0x5425('0x13')][_0x5425('0x14')]}));});if(_0x5b414c>0x0){_0x32f2b9+=_0x5dc37b;_0x5d5698[_0x5425('0x1c')](dbH[_0x5425('0x1a')][_0x5425('0x11')](util[_0x5425('0x1b')](_0x5425('0x1d'),QUERY,_0x5b414c,_0x32f2b9),{'type':dbH['sequelize'][_0x5425('0x13')][_0x5425('0x14')]}));}}}else{_0x5d5698[_0x5425('0x1c')](dbH[_0x5425('0x1a')][_0x5425('0x11')](QUERY,{'type':dbH[_0x5425('0x1a')]['QueryTypes'][_0x5425('0x14')]}));}var _0xe0812e=path[_0x5425('0x1e')](PATH);var _0x4e113b=path[_0x5425('0x1f')](PATH,'.xlsx');var _0x4ba9ee=_0x362828[_0x5425('0x20')]&&_0x5d5698[_0x5425('0x17')]>0x1;var _0x306dc8=[];if(!fs[_0x5425('0x21')](path[_0x5425('0x22')](_0xe0812e,_0x4e113b))&&_0x4ba9ee){fs['mkdirSync'](path[_0x5425('0x22')](_0xe0812e,_0x4e113b));}return BPromise[_0x5425('0x23')](_0x5d5698,function(_0x551ddc){_0x306dc8[_0x5425('0x1c')](_0x551ddc);})[_0x5425('0x10')](function(){for(var _0x459ae8=0x0;_0x459ae8<_0x306dc8['length'];_0x459ae8+=0x1){var _0xa584bb;var _0xf67695=_0x306dc8[_0x459ae8];if(_0x4ba9ee){_0xa584bb=path['join'](_0xe0812e,_0x4e113b,util['format']('%s%d.%s',_0x4e113b,_0x459ae8,_0x5425('0x24')));}else{_0xa584bb=path['join'](_0xe0812e,util[_0x5425('0x1b')]('%s.%s',_0x4e113b,_0x5425('0x24')));}fs[_0x5425('0x25')](_0xa584bb,json2xls(_0xf67695),_0x5425('0x26'));}})[_0x5425('0x10')](function(){if(_0x4ba9ee){return new Promise(function(_0x51a23e){zipdir(path[_0x5425('0x22')](_0xe0812e,_0x4e113b),{'saveTo':path[_0x5425('0x22')](_0xe0812e,util['format'](_0x5425('0x27'),_0x4e113b,'zip'))},function(_0x55fa8f,_0x287a6b){rimraf(path[_0x5425('0x22')](_0xe0812e,_0x4e113b),function(){});_0x51a23e('zip\x20finished');});});}})[_0x5425('0x10')](function(){logger[_0x5425('0x28')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x5425('0x29')));return analyticExtractedReport('Completed',_0x4ba9ee?util[_0x5425('0x1b')]('%s.%s',_0x4e113b,_0x4ba9ee?_0x5425('0x2a'):_0x5425('0x24')):null);});})['catch'](function(_0x413181){logger[_0x5425('0x28')](util[_0x5425('0x1b')](_0x5425('0x2b'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x413181,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5425('0x2c'));})['finally'](function(){process[_0x5425('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xa01e=['binary','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','json2xls','zip-dir','rimraf','dbH','analytics','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','then','num','Empty','length','range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync','join','mkdirSync','each','xlsx','writeFileSync'];(function(_0x17d928,_0x15f099){var _0x2c812c=function(_0x5e42db){while(--_0x5e42db){_0x17d928['push'](_0x17d928['shift']());}};_0x2c812c(++_0x15f099);}(_0xa01e,0x137));var _0xea01=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xa01e[_0x4e9628];return _0x27bc8c;};'use strict';var util=require(_0xea01('0x0'));var path=require(_0xea01('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xea01('0x2'));var BPromise=require('bluebird');var zipdir=require(_0xea01('0x3'));var rimraf=require(_0xea01('0x4'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xea01('0x5')];var logger=require('../../config/logger')(_0xea01('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xea01('0x7')][0x2]);var QUERY=process[_0xea01('0x7')][0x3];var PATH=process[_0xea01('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2533f3,_0x9599be){var _0x544ffb={'status':_0x2533f3};var _0x943ad0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x9599be){_0x544ffb['savename']=_0x9599be;}return db[_0xea01('0x8')][_0xea01('0x9')](_0x544ffb,_0x943ad0);}function main(){var _0x435457=0x1388;var _0x5b8b30;logger['info'](util[_0xea01('0xa')](_0xea01('0xb'),EXTRACTED_REPORT_ID,_0xea01('0xc')));return db[_0xea01('0xd')][_0xea01('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xea01('0xf'),_0xea01('0x10')]})['then'](function(_0x497b54){if(_0x497b54){_0x5b8b30=_0x497b54;_0x435457=_0x5b8b30[_0xea01('0x10')]||0x1388;}})['then'](function(){return dbH[_0xea01('0x11')]['query'](util[_0xea01('0xa')](_0xea01('0x12'),QUERY),{'type':dbH[_0xea01('0x11')][_0xea01('0x13')][_0xea01('0x14')]});})[_0xea01('0x15')](function(_0x42383c){if(!_0x42383c[0x0][_0xea01('0x16')]){return analyticExtractedReport(_0xea01('0x17'));}var _0x27af81=[];var _0x264675=0x0;if(_0x5b8b30[_0xea01('0xf')]){if(_0x42383c&&_0x42383c[_0xea01('0x18')]){var _0x489b1e=_[_0xea01('0x19')](_0x42383c[0x0][_0xea01('0x16')]/_0x435457);var _0x10ac9b=Number[_0xea01('0x1a')](_0x42383c[0x0][_0xea01('0x16')]/_0x435457)?_0x42383c[0x0][_0xea01('0x16')]%_0x435457:0x0;_0x489b1e[_0xea01('0x1b')](function(_0x434480){if(_0x434480>0x0){_0x264675+=_0x435457;}_0x27af81[_0xea01('0x1c')](dbH['sequelize'][_0xea01('0x1d')](util['format'](_0xea01('0x1e'),QUERY,_0x435457,_0x264675),{'type':dbH[_0xea01('0x11')][_0xea01('0x13')][_0xea01('0x14')]}));});if(_0x10ac9b>0x0){_0x264675+=_0x435457;_0x27af81[_0xea01('0x1c')](dbH['sequelize'][_0xea01('0x1d')](util['format'](_0xea01('0x1e'),QUERY,_0x10ac9b,_0x264675),{'type':dbH['sequelize'][_0xea01('0x13')][_0xea01('0x14')]}));}}}else{_0x27af81[_0xea01('0x1c')](dbH['sequelize'][_0xea01('0x1d')](QUERY,{'type':dbH[_0xea01('0x11')][_0xea01('0x13')][_0xea01('0x14')]}));}var _0x566ead=path[_0xea01('0x1f')](PATH);var _0x4a7ff3=path['basename'](PATH,_0xea01('0x20'));var _0x5bd24e=_0x5b8b30['split']&&_0x27af81['length']>0x1;var _0x548f2c=[];if(!fs[_0xea01('0x21')](path[_0xea01('0x22')](_0x566ead,_0x4a7ff3))&&_0x5bd24e){fs[_0xea01('0x23')](path['join'](_0x566ead,_0x4a7ff3));}return BPromise[_0xea01('0x24')](_0x27af81,function(_0x2b7558){_0x548f2c[_0xea01('0x1c')](_0x2b7558);})['then'](function(){for(var _0x4d5c3e=0x0;_0x4d5c3e<_0x548f2c[_0xea01('0x18')];_0x4d5c3e+=0x1){var _0x236476;var _0x121a1d=_0x548f2c[_0x4d5c3e];if(_0x5bd24e){_0x236476=path[_0xea01('0x22')](_0x566ead,_0x4a7ff3,util['format']('%s%d.%s',_0x4a7ff3,_0x4d5c3e,'xlsx'));}else{_0x236476=path[_0xea01('0x22')](_0x566ead,util[_0xea01('0xa')]('%s.%s',_0x4a7ff3,_0xea01('0x25')));}fs[_0xea01('0x26')](_0x236476,json2xls(_0x121a1d),_0xea01('0x27'));}})[_0xea01('0x15')](function(){if(_0x5bd24e){return new Promise(function(_0x37bbae){zipdir(path['join'](_0x566ead,_0x4a7ff3),{'saveTo':path[_0xea01('0x22')](_0x566ead,util[_0xea01('0xa')](_0xea01('0x28'),_0x4a7ff3,_0xea01('0x29')))},function(_0x340297,_0x23aaf5){rimraf(path[_0xea01('0x22')](_0x566ead,_0x4a7ff3),function(){});_0x37bbae(_0xea01('0x2a'));});});}})[_0xea01('0x15')](function(){logger[_0xea01('0x2b')](util[_0xea01('0xa')](_0xea01('0x2c'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x5bd24e?util[_0xea01('0xa')](_0xea01('0x28'),_0x4a7ff3,_0x5bd24e?_0xea01('0x29'):_0xea01('0x25')):null);});})[_0xea01('0x2d')](function(_0x5c58e0){logger[_0xea01('0x2b')](util[_0xea01('0xa')](_0xea01('0x2e'),EXTRACTED_REPORT_ID,_0xea01('0xc')),util[_0xea01('0x2f')](_0x5c58e0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xea01('0x30')](function(){process[_0xea01('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 654b7ab..ef2aa68 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 _0xa6e6=['find','push','type','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','app','toLowerCase','appType','custom','answer','$[${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','bulkCreate','sortBy','error','rewrite','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','extension'];(function(_0x116612,_0x39725c){var _0x344dd4=function(_0x21735f){while(--_0x21735f){_0x116612['push'](_0x116612['shift']());}};_0x344dd4(++_0x39725c);}(_0xa6e6,0x1f4));var _0x6a6e=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xa6e6[_0x1477ef];return _0x164acd;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x1a9e70,_0x37166f){var _0x3cc706=this;return _0x1a9e70[_0x6a6e('0x0')][_0x6a6e('0x1')][_0x6a6e('0x2')]({'raw':!![]})[_0x6a6e('0x3')](function(_0x340380){_0x3cc706[_0x6a6e('0x4')]=_0x340380;return _0x1a9e70[_0x6a6e('0x0')]['VoiceExtension'][_0x6a6e('0x2')]({'where':{'IntervalId':_0x37166f[_0x6a6e('0x5')]},'raw':!![]});})['then'](function(_0x21e8ca){return _0x1a9e70['models'][_0x6a6e('0x6')][_0x6a6e('0x2')]({'where':{'exten':{'$in':_[_0x6a6e('0x7')](_[_0x6a6e('0x8')](_0x21e8ca,_0x6a6e('0x9')))}},'order':[{'raw':_0x6a6e('0xa')}],'raw':!![]});})['then'](function(_0x516648){var _0x392c61=_[_0x6a6e('0xb')](_0x516648,{'priority':'1'});var _0x48cb27=_['filter'](_0x516648,{'isApp':0x1});var _0x3492e1=_[_0x6a6e('0xc')](_0x48cb27,'exten');var _0x67e7d3=[_0x6a6e('0xd'),_0x6a6e('0xe')];var _0x13f31f=[];var _0x3885e3=[];for(var _0x445080 in _0x3492e1){if(_0x3492e1[_0x6a6e('0xf')](_0x445080)){_0x3cc706['priority']=0x2;_0x3cc706[_0x6a6e('0x10')]=[];_0x3cc706[_0x6a6e('0x11')]=_[_0x6a6e('0x12')](_0x392c61,{'exten':_0x3492e1[_0x445080][0x0]['exten']});_0x3cc706[_0x6a6e('0x10')][_0x6a6e('0x13')]({'type':_0x3492e1[_0x445080][0x0][_0x6a6e('0x14')],'app':_0x6a6e('0x15'),'appdata':util[_0x6a6e('0x16')](_0x6a6e('0x17'),_0x3492e1[_0x445080][0x0]['type']),'context':_0x3492e1[_0x445080][0x0][_0x6a6e('0x18')],'exten':_0x3492e1[_0x445080][0x0][_0x6a6e('0x9')],'priority':_0x3cc706[_0x6a6e('0x19')]++,'VoiceExtensionId':_0x3492e1[_0x445080][0x0][_0x6a6e('0x1a')]});if(_0x3492e1[_0x445080][0x0][_0x6a6e('0x14')]===_0x6a6e('0x1b')){_0x3cc706[_0x6a6e('0x10')][_0x6a6e('0x13')]({'type':_0x3492e1[_0x445080][0x0][_0x6a6e('0x14')],'app':'Set','appdata':_0x6a6e('0x1c')+_0x3492e1[_0x445080][0x0][_0x6a6e('0x1a')],'context':_0x3492e1[_0x445080][0x0][_0x6a6e('0x18')],'exten':_0x3492e1[_0x445080][0x0][_0x6a6e('0x9')],'priority':_0x3cc706[_0x6a6e('0x19')]++,'VoiceExtensionId':_0x3492e1[_0x445080][0x0][_0x6a6e('0x1a')]});}else if(_0x3492e1[_0x445080][0x0][_0x6a6e('0x14')]===_0x6a6e('0x1d')){if(_0x3cc706[_0x6a6e('0x11')]){_0x3cc706['extensions'][_0x6a6e('0x13')]({'type':_0x3492e1[_0x445080][0x0][_0x6a6e('0x14')],'app':_0x6a6e('0x15'),'appdata':_0x6a6e('0x1e')+(_0x3cc706[_0x6a6e('0x11')][_0x6a6e('0x1f')]?_0x6a6e('0x20')+_0x3cc706[_0x6a6e('0x11')]['cutdigits']+'}':_0x6a6e('0x21')),'context':_0x3492e1[_0x445080][0x0][_0x6a6e('0x18')],'exten':_0x3492e1[_0x445080][0x0][_0x6a6e('0x9')],'priority':_0x3cc706[_0x6a6e('0x19')]++,'VoiceExtensionId':_0x3492e1[_0x445080][0x0]['VoiceExtensionId']});}_0x3cc706[_0x6a6e('0x10')][_0x6a6e('0x13')]({'type':_0x3492e1[_0x445080][0x0]['type'],'app':_0x6a6e('0x15'),'appdata':_0x6a6e('0x1c')+_0x3492e1[_0x445080][0x0][_0x6a6e('0x1a')],'context':_0x3492e1[_0x445080][0x0][_0x6a6e('0x18')],'exten':_0x3492e1[_0x445080][0x0][_0x6a6e('0x9')],'priority':_0x3cc706[_0x6a6e('0x19')]++,'VoiceExtensionId':_0x3492e1[_0x445080][0x0]['VoiceExtensionId']});var _0x1dc441=_0x3cc706['priority']++;_0x3cc706[_0x6a6e('0x10')]['push']({'type':_0x3492e1[_0x445080][0x0][_0x6a6e('0x14')],'app':_0x6a6e('0x22'),'appdata':_0x6a6e('0x23')+(_0x1dc441+0x2)+_0x6a6e('0x24')+(_0x1dc441+0x1)+')','context':_0x3492e1[_0x445080][0x0]['context'],'exten':_0x3492e1[_0x445080][0x0]['exten'],'priority':_0x1dc441,'VoiceExtensionId':_0x3492e1[_0x445080][0x0]['VoiceExtensionId']});if(_0x3cc706['extension']){_0x3cc706[_0x6a6e('0x10')][_0x6a6e('0x13')]({'type':_0x3492e1[_0x445080][0x0][_0x6a6e('0x14')],'app':_0x6a6e('0x15'),'appdata':_0x3cc706[_0x6a6e('0x11')][_0x6a6e('0x1f')]?'CDR(prefix)=${EXTEN:0:'+_0x3cc706[_0x6a6e('0x11')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x3492e1[_0x445080][0x0][_0x6a6e('0x18')],'exten':_0x3492e1[_0x445080][0x0]['exten'],'priority':_0x3cc706[_0x6a6e('0x19')]++,'VoiceExtensionId':_0x3492e1[_0x445080][0x0]['VoiceExtensionId']});}_0x3cc706[_0x6a6e('0x10')][_0x6a6e('0x13')]({'type':_0x3492e1[_0x445080][0x0]['type'],'app':_0x6a6e('0x15'),'appdata':_0x6a6e('0x25')+_0x3492e1[_0x445080][0x0]['VoiceExtensionId'],'context':_0x3492e1[_0x445080][0x0][_0x6a6e('0x18')],'exten':_0x3492e1[_0x445080][0x0][_0x6a6e('0x9')],'priority':_0x3cc706[_0x6a6e('0x19')]++,'VoiceExtensionId':_0x3492e1[_0x445080][0x0][_0x6a6e('0x1a')]});if(_0x3cc706[_0x6a6e('0x11')]&&_0x3cc706['extension'][_0x6a6e('0xf')](_0x6a6e('0x26'))&&_0x3cc706[_0x6a6e('0x11')][_0x6a6e('0x26')]!=='none'){_0x3cc706[_0x6a6e('0x10')]['push']({'type':_0x3492e1[_0x445080][0x0][_0x6a6e('0x14')],'app':_0x6a6e('0x15'),'appdata':_0x6a6e('0x27'),'context':_0x3492e1[_0x445080][0x0][_0x6a6e('0x18')],'exten':_0x3492e1[_0x445080][0x0][_0x6a6e('0x9')],'priority':_0x3cc706[_0x6a6e('0x19')]++,'VoiceExtensionId':_0x3492e1[_0x445080][0x0][_0x6a6e('0x1a')]});_0x3cc706[_0x6a6e('0x10')][_0x6a6e('0x13')]({'type':_0x3492e1[_0x445080][0x0][_0x6a6e('0x14')],'app':_0x6a6e('0x15'),'appdata':_0x6a6e('0x28')+_0x3cc706[_0x6a6e('0x11')][_0x6a6e('0x26')]||_0x6a6e('0x29'),'context':_0x3492e1[_0x445080][0x0][_0x6a6e('0x18')],'exten':_0x3492e1[_0x445080][0x0][_0x6a6e('0x9')],'priority':_0x3cc706[_0x6a6e('0x19')]++,'VoiceExtensionId':_0x3492e1[_0x445080][0x0][_0x6a6e('0x1a')]});}}_0x3cc706[_0x6a6e('0x10')][_0x6a6e('0x13')]({'type':_0x3492e1[_0x445080][0x0][_0x6a6e('0x14')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3492e1[_0x445080][0x0][_0x6a6e('0x18')],'exten':_0x3492e1[_0x445080][0x0]['exten'],'priority':_0x3cc706['priority']++,'VoiceExtensionId':_0x3492e1[_0x445080][0x0][_0x6a6e('0x1a')]});_0x3cc706[_0x6a6e('0x10')][_0x6a6e('0x13')]({'type':_0x3492e1[_0x445080][0x0][_0x6a6e('0x14')],'app':_0x6a6e('0x15'),'appdata':_0x6a6e('0x2a'),'context':_0x3492e1[_0x445080][0x0]['context'],'exten':_0x3492e1[_0x445080][0x0][_0x6a6e('0x9')],'priority':_0x3cc706['priority']++,'VoiceExtensionId':_0x3492e1[_0x445080][0x0][_0x6a6e('0x1a')]});_0x3cc706['extensions'][_0x6a6e('0x13')]({'type':_0x3492e1[_0x445080][0x0][_0x6a6e('0x14')],'app':_0x6a6e('0x15'),'appdata':_0x6a6e('0x2b'),'context':_0x3492e1[_0x445080][0x0][_0x6a6e('0x18')],'exten':_0x3492e1[_0x445080][0x0]['exten'],'priority':_0x3cc706[_0x6a6e('0x19')]++,'VoiceExtensionId':_0x3492e1[_0x445080][0x0][_0x6a6e('0x1a')]});for(var _0x3480b9=0x0,_0x5d1a51=0x0;_0x3480b9<_0x3492e1[_0x445080][_0x6a6e('0x2c')];_0x3480b9+=0x1,_0x5d1a51=0x0){var _0xe640e1=_0x3492e1[_0x445080][_0x3480b9];if(_0xe640e1[_0x6a6e('0x14')]){_0xe640e1[_0x6a6e('0x14')]=_0xe640e1[_0x6a6e('0x14')]['toLowerCase']();}var _0x44dc8c=[];var _0x1af679=[];delete _0xe640e1['id'];delete _0xe640e1['createdAt'];delete _0xe640e1[_0x6a6e('0x2d')];var _0x2d4648=_0xe640e1[_0x6a6e('0x2e')]!==_0x6a6e('0x2f')?[_0xe640e1[_0x6a6e('0x2e')]]:_0xe640e1[_0x6a6e('0x5')]?_['map'](_['filter'](_0x3cc706[_0x6a6e('0x4')],{'IntervalId':_0xe640e1[_0x6a6e('0x5')]}),_0x6a6e('0x2e')):[];if(_0xe640e1[_0x6a6e('0xf')](_0x6a6e('0x30'))){if(_0xe640e1['tag']&&_0xe640e1[_0x6a6e('0x30')]!=='--'){_0x44dc8c[_0x6a6e('0x13')]({'type':_0xe640e1[_0x6a6e('0x14')],'app':'Set','appdata':_0x6a6e('0x31')+_0xe640e1['tag'],'context':_0xe640e1['context'],'exten':_0xe640e1['exten'],'priority':_0x2d4648[_0x6a6e('0x2c')]+_0x3cc706['priority']+_0x5d1a51++,'VoiceExtensionId':_0xe640e1[_0x6a6e('0x1a')]});}}if(_0xe640e1['type']===_0x6a6e('0x1d')&&_0xe640e1[_0x6a6e('0xf')](_0x6a6e('0x32'))){if(_0xe640e1[_0x6a6e('0x32')]){_0x44dc8c[_0x6a6e('0x13')]({'type':_0xe640e1[_0x6a6e('0x14')],'app':_0x6a6e('0x22'),'appdata':_0x6a6e('0x33')+_0xe640e1['callerID']+')','context':_0xe640e1[_0x6a6e('0x18')],'exten':_0xe640e1[_0x6a6e('0x9')],'priority':_0x2d4648[_0x6a6e('0x2c')]+_0x3cc706[_0x6a6e('0x19')]+_0x5d1a51++,'VoiceExtensionId':_0xe640e1[_0x6a6e('0x1a')]});}else{_0x44dc8c[_0x6a6e('0x13')]({'type':_0xe640e1['type'],'app':_0x6a6e('0x22'),'appdata':_0x6a6e('0x34'),'context':_0xe640e1[_0x6a6e('0x18')],'exten':_0xe640e1['exten'],'priority':_0x2d4648[_0x6a6e('0x2c')]+_0x3cc706[_0x6a6e('0x19')]+_0x5d1a51++,'VoiceExtensionId':_0xe640e1[_0x6a6e('0x1a')]});}}if(_0xe640e1[_0x6a6e('0xf')]('answer')){if(_0x67e7d3['indexOf'](_0xe640e1[_0x6a6e('0x35')][_0x6a6e('0x36')]())>=0x0&&_0xe640e1[_0x6a6e('0x37')]!==_0x6a6e('0x38')){if(_0xe640e1[_0x6a6e('0x39')]){_0x44dc8c[_0x6a6e('0x13')]({'type':_0xe640e1[_0x6a6e('0x14')],'app':_0x6a6e('0x22'),'appdata':_0x6a6e('0x3a'),'context':_0xe640e1[_0x6a6e('0x18')],'exten':_0xe640e1[_0x6a6e('0x9')],'priority':_0x2d4648[_0x6a6e('0x2c')]+_0x3cc706[_0x6a6e('0x19')]+_0x5d1a51++,'VoiceExtensionId':_0xe640e1[_0x6a6e('0x1a')]});_0x44dc8c[_0x6a6e('0x13')]({'type':_0xe640e1['type'],'app':'Set','appdata':_0x6a6e('0x3b'),'context':_0xe640e1[_0x6a6e('0x18')],'exten':_0xe640e1[_0x6a6e('0x9')],'priority':_0x2d4648[_0x6a6e('0x2c')]+_0x3cc706[_0x6a6e('0x19')]+_0x5d1a51++,'VoiceExtensionId':_0xe640e1[_0x6a6e('0x1a')]});}else{_0x44dc8c[_0x6a6e('0x13')]({'type':_0xe640e1[_0x6a6e('0x14')],'app':_0x6a6e('0x22'),'appdata':_0x6a6e('0x3c'),'context':_0xe640e1[_0x6a6e('0x18')],'exten':_0xe640e1[_0x6a6e('0x9')],'priority':_0x2d4648[_0x6a6e('0x2c')]+_0x3cc706[_0x6a6e('0x19')]+_0x5d1a51++,'VoiceExtensionId':_0xe640e1[_0x6a6e('0x1a')]});_0x44dc8c['push']({'type':_0xe640e1[_0x6a6e('0x14')],'app':_0x6a6e('0x15'),'appdata':_0x6a6e('0x3d'),'context':_0xe640e1[_0x6a6e('0x18')],'exten':_0xe640e1[_0x6a6e('0x9')],'priority':_0x2d4648[_0x6a6e('0x2c')]+_0x3cc706['priority']+_0x5d1a51++,'VoiceExtensionId':_0xe640e1[_0x6a6e('0x1a')]});}}}for(var _0x3d0dd2=0x0;_0x3d0dd2<_0x2d4648[_0x6a6e('0x2c')];_0x3d0dd2+=0x1){var _0x3e0eeb=_0x3cc706[_0x6a6e('0x19')]+_0x2d4648[_0x6a6e('0x2c')];var _0x38385a=_0x3d0dd2===_0x2d4648[_0x6a6e('0x2c')]-0x1?_0x3cc706[_0x6a6e('0x19')]+_0x44dc8c[_0x6a6e('0x2c')]+_0x1af679['length']+0x2:_0x3cc706['priority']+_0x3d0dd2+0x1;_0x44dc8c[_0x6a6e('0x3e')](_0x3d0dd2,0x0,{'type':_0xe640e1[_0x6a6e('0x14')],'app':_0x6a6e('0x3f'),'appdata':_0x2d4648[_0x3d0dd2]+'?'+_0xe640e1[_0x6a6e('0x18')]+_0x6a6e('0x40')+_0x3e0eeb+':'+_0xe640e1[_0x6a6e('0x18')]+_0x6a6e('0x40')+_0x38385a,'exten':_0xe640e1[_0x6a6e('0x9')],'context':_0xe640e1[_0x6a6e('0x18')],'priority':_0x3cc706['priority']+_0x3d0dd2,'VoiceExtensionId':_0x3492e1[_0x445080][0x0][_0x6a6e('0x1a')]});}_0xe640e1[_0x6a6e('0x19')]=_0x44dc8c['length']?_[_0x6a6e('0x41')](_0x44dc8c)[_0x6a6e('0x19')]+0x1:_0x3cc706[_0x6a6e('0x19')];_0x3cc706[_0x6a6e('0x19')]=(_0x1af679['length']?_[_0x6a6e('0x41')](_0x1af679)[_0x6a6e('0x19')]:_0xe640e1[_0x6a6e('0x19')])+0x1;_0x3cc706[_0x6a6e('0x10')]=_[_0x6a6e('0x42')](_0x3cc706[_0x6a6e('0x10')],_0x44dc8c,[_0xe640e1],_0x1af679);}_0x3cc706['extensions'][_0x6a6e('0x13')]({'type':_0x3492e1[_0x445080][0x0][_0x6a6e('0x14')],'app':_0x6a6e('0x43'),'exten':_0x3492e1[_0x445080][0x0][_0x6a6e('0x9')],'context':_0x3492e1[_0x445080][0x0][_0x6a6e('0x18')],'priority':_0x3cc706[_0x6a6e('0x19')],'VoiceExtensionId':_0x3492e1[_0x445080][0x0]['VoiceExtensionId']});_0x13f31f[_0x6a6e('0x13')](_0x3492e1[_0x445080][0x0][_0x6a6e('0x1a')]);_0x3885e3=_['concat'](_0x3885e3,_0x3cc706[_0x6a6e('0x10')]);}}return _0x1a9e70[_0x6a6e('0x44')](function(_0x2bcec1){return _0x1a9e70[_0x6a6e('0x0')][_0x6a6e('0x6')][_0x6a6e('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x13f31f}},'transaction':_0x2bcec1})[_0x6a6e('0x3')](function(_0x546a20){return _0x1a9e70[_0x6a6e('0x0')][_0x6a6e('0x6')][_0x6a6e('0x46')](_[_0x6a6e('0x47')](_0x3885e3,_0x6a6e('0x19')),{'transaction':_0x2bcec1});});});})['catch'](function(_0x3f1f02){console[_0x6a6e('0x48')](_0x3f1f02);});}exports[_0x6a6e('0x49')]=rewrite; \ No newline at end of file +var _0x8825=['${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','IntervalId','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','models','sortBy','catch','error','rewrite','lodash','Interval','then','intervals','VoiceExtension','findAll','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','priority','extensions','extension','push','type','CDR(type)=%s','context','VoiceExtensionId','inbound','Set','CDR(routeid)=','outbound','${EXTEN:','cutdigits'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x8825,0x167));var _0x5882=function(_0x141ef3,_0x1c5be7){_0x141ef3=_0x141ef3-0x0;var _0x3c55fd=_0x8825[_0x141ef3];return _0x3c55fd;};'use strict';var _=require(_0x5882('0x0'));var util=require('util');function rewrite(_0x1699d1,_0x53a193){var _0x142532=this;return _0x1699d1['models'][_0x5882('0x1')]['findAll']({'raw':!![]})[_0x5882('0x2')](function(_0x2b6290){_0x142532[_0x5882('0x3')]=_0x2b6290;return _0x1699d1['models'][_0x5882('0x4')][_0x5882('0x5')]({'where':{'IntervalId':_0x53a193['IntervalId']},'raw':!![]});})[_0x5882('0x2')](function(_0x9a5a06){return _0x1699d1['models'][_0x5882('0x4')][_0x5882('0x5')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x9a5a06,_0x5882('0x6')))}},'order':[{'raw':_0x5882('0x7')}],'raw':!![]});})[_0x5882('0x2')](function(_0x349e6d){var _0x4b74eb=_[_0x5882('0x8')](_0x349e6d,{'priority':'1'});var _0x186e33=_['filter'](_0x349e6d,{'isApp':0x1});var _0x14aab2=_['groupBy'](_0x186e33,_0x5882('0x6'));var _0x2e26af=[_0x5882('0x9'),_0x5882('0xa')];var _0xb3f1d8=[];var _0x302820=[];for(var _0x29a3c2 in _0x14aab2){if(_0x14aab2['hasOwnProperty'](_0x29a3c2)){_0x142532[_0x5882('0xb')]=0x2;_0x142532[_0x5882('0xc')]=[];_0x142532[_0x5882('0xd')]=_['find'](_0x4b74eb,{'exten':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x6')]});_0x142532[_0x5882('0xc')][_0x5882('0xe')]({'type':_0x14aab2[_0x29a3c2][0x0][_0x5882('0xf')],'app':'Set','appdata':util['format'](_0x5882('0x10'),_0x14aab2[_0x29a3c2][0x0][_0x5882('0xf')]),'context':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x11')],'exten':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x6')],'priority':_0x142532[_0x5882('0xb')]++,'VoiceExtensionId':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x12')]});if(_0x14aab2[_0x29a3c2][0x0][_0x5882('0xf')]===_0x5882('0x13')){_0x142532[_0x5882('0xc')][_0x5882('0xe')]({'type':_0x14aab2[_0x29a3c2][0x0]['type'],'app':_0x5882('0x14'),'appdata':_0x5882('0x15')+_0x14aab2[_0x29a3c2][0x0][_0x5882('0x12')],'context':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x11')],'exten':_0x14aab2[_0x29a3c2][0x0]['exten'],'priority':_0x142532[_0x5882('0xb')]++,'VoiceExtensionId':_0x14aab2[_0x29a3c2][0x0]['VoiceExtensionId']});}else if(_0x14aab2[_0x29a3c2][0x0][_0x5882('0xf')]===_0x5882('0x16')){if(_0x142532[_0x5882('0xd')]){_0x142532[_0x5882('0xc')][_0x5882('0xe')]({'type':_0x14aab2[_0x29a3c2][0x0][_0x5882('0xf')],'app':_0x5882('0x14'),'appdata':'CDR(destination)='+(_0x142532[_0x5882('0xd')]['cutdigits']?_0x5882('0x17')+_0x142532[_0x5882('0xd')][_0x5882('0x18')]+'}':_0x5882('0x19')),'context':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x11')],'exten':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x6')],'priority':_0x142532[_0x5882('0xb')]++,'VoiceExtensionId':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x12')]});}_0x142532[_0x5882('0xc')][_0x5882('0xe')]({'type':_0x14aab2[_0x29a3c2][0x0]['type'],'app':_0x5882('0x14'),'appdata':_0x5882('0x15')+_0x14aab2[_0x29a3c2][0x0][_0x5882('0x12')],'context':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x11')],'exten':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x6')],'priority':_0x142532[_0x5882('0xb')]++,'VoiceExtensionId':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x12')]});var _0x235c55=_0x142532[_0x5882('0xb')]++;_0x142532[_0x5882('0xc')][_0x5882('0xe')]({'type':_0x14aab2[_0x29a3c2][0x0][_0x5882('0xf')],'app':_0x5882('0x1a'),'appdata':_0x5882('0x1b')+(_0x235c55+0x2)+_0x5882('0x1c')+(_0x235c55+0x1)+')','context':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x11')],'exten':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x6')],'priority':_0x235c55,'VoiceExtensionId':_0x14aab2[_0x29a3c2][0x0]['VoiceExtensionId']});if(_0x142532[_0x5882('0xd')]){_0x142532['extensions'][_0x5882('0xe')]({'type':_0x14aab2[_0x29a3c2][0x0][_0x5882('0xf')],'app':'Set','appdata':_0x142532[_0x5882('0xd')][_0x5882('0x18')]?_0x5882('0x1d')+_0x142532[_0x5882('0xd')][_0x5882('0x18')]+'}':_0x5882('0x1e'),'context':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x11')],'exten':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x6')],'priority':_0x142532[_0x5882('0xb')]++,'VoiceExtensionId':_0x14aab2[_0x29a3c2][0x0]['VoiceExtensionId']});}_0x142532['extensions'][_0x5882('0xe')]({'type':_0x14aab2[_0x29a3c2][0x0][_0x5882('0xf')],'app':_0x5882('0x14'),'appdata':'outboundrouteid='+_0x14aab2[_0x29a3c2][0x0][_0x5882('0x12')],'context':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x11')],'exten':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x6')],'priority':_0x142532['priority']++,'VoiceExtensionId':_0x14aab2[_0x29a3c2][0x0]['VoiceExtensionId']});if(_0x142532['extension']&&_0x142532[_0x5882('0xd')][_0x5882('0x1f')](_0x5882('0x20'))&&_0x142532[_0x5882('0xd')][_0x5882('0x20')]!==_0x5882('0x21')){_0x142532[_0x5882('0xc')]['push']({'type':_0x14aab2[_0x29a3c2][0x0][_0x5882('0xf')],'app':_0x5882('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x14aab2[_0x29a3c2][0x0]['context'],'exten':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x6')],'priority':_0x142532['priority']++,'VoiceExtensionId':_0x14aab2[_0x29a3c2][0x0]['VoiceExtensionId']});_0x142532[_0x5882('0xc')][_0x5882('0xe')]({'type':_0x14aab2[_0x29a3c2][0x0][_0x5882('0xf')],'app':_0x5882('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x142532[_0x5882('0xd')]['recordingFormat']||_0x5882('0x22'),'context':_0x14aab2[_0x29a3c2][0x0]['context'],'exten':_0x14aab2[_0x29a3c2][0x0]['exten'],'priority':_0x142532[_0x5882('0xb')]++,'VoiceExtensionId':_0x14aab2[_0x29a3c2][0x0]['VoiceExtensionId']});}}_0x142532['extensions']['push']({'type':_0x14aab2[_0x29a3c2][0x0][_0x5882('0xf')],'app':_0x5882('0x14'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x11')],'exten':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x6')],'priority':_0x142532['priority']++,'VoiceExtensionId':_0x14aab2[_0x29a3c2][0x0]['VoiceExtensionId']});_0x142532[_0x5882('0xc')][_0x5882('0xe')]({'type':_0x14aab2[_0x29a3c2][0x0][_0x5882('0xf')],'app':_0x5882('0x14'),'appdata':_0x5882('0x23'),'context':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x11')],'exten':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x6')],'priority':_0x142532[_0x5882('0xb')]++,'VoiceExtensionId':_0x14aab2[_0x29a3c2][0x0]['VoiceExtensionId']});_0x142532[_0x5882('0xc')]['push']({'type':_0x14aab2[_0x29a3c2][0x0]['type'],'app':_0x5882('0x14'),'appdata':_0x5882('0x24'),'context':_0x14aab2[_0x29a3c2][0x0]['context'],'exten':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x6')],'priority':_0x142532[_0x5882('0xb')]++,'VoiceExtensionId':_0x14aab2[_0x29a3c2][0x0]['VoiceExtensionId']});for(var _0x301ee2=0x0,_0x9234b=0x0;_0x301ee2<_0x14aab2[_0x29a3c2][_0x5882('0x25')];_0x301ee2+=0x1,_0x9234b=0x0){var _0x57b631=_0x14aab2[_0x29a3c2][_0x301ee2];if(_0x57b631[_0x5882('0xf')]){_0x57b631['type']=_0x57b631[_0x5882('0xf')][_0x5882('0x26')]();}var _0x4fb3e5=[];var _0x30694a=[];delete _0x57b631['id'];delete _0x57b631['createdAt'];delete _0x57b631[_0x5882('0x27')];var _0x1367b8=_0x57b631['interval']!=='*,*,*,*'?[_0x57b631[_0x5882('0x28')]]:_0x57b631[_0x5882('0x29')]?_[_0x5882('0x2a')](_[_0x5882('0x8')](_0x142532['intervals'],{'IntervalId':_0x57b631[_0x5882('0x29')]}),'interval'):[];if(_0x57b631[_0x5882('0x1f')](_0x5882('0x2b'))){if(_0x57b631[_0x5882('0x2b')]&&_0x57b631[_0x5882('0x2b')]!=='--'){_0x4fb3e5[_0x5882('0xe')]({'type':_0x57b631[_0x5882('0xf')],'app':'Set','appdata':_0x5882('0x2c')+_0x57b631[_0x5882('0x2b')],'context':_0x57b631[_0x5882('0x11')],'exten':_0x57b631[_0x5882('0x6')],'priority':_0x1367b8[_0x5882('0x25')]+_0x142532[_0x5882('0xb')]+_0x9234b++,'VoiceExtensionId':_0x57b631['VoiceExtensionId']});}}if(_0x57b631[_0x5882('0xf')]==='outbound'&&_0x57b631[_0x5882('0x1f')](_0x5882('0x2d'))){if(_0x57b631['callerID']){_0x4fb3e5[_0x5882('0xe')]({'type':_0x57b631[_0x5882('0xf')],'app':_0x5882('0x1a'),'appdata':_0x5882('0x2e')+_0x57b631[_0x5882('0x2d')]+')','context':_0x57b631[_0x5882('0x11')],'exten':_0x57b631['exten'],'priority':_0x1367b8['length']+_0x142532[_0x5882('0xb')]+_0x9234b++,'VoiceExtensionId':_0x57b631[_0x5882('0x12')]});}else{_0x4fb3e5['push']({'type':_0x57b631['type'],'app':_0x5882('0x1a'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x57b631['context'],'exten':_0x57b631[_0x5882('0x6')],'priority':_0x1367b8['length']+_0x142532[_0x5882('0xb')]+_0x9234b++,'VoiceExtensionId':_0x57b631[_0x5882('0x12')]});}}if(_0x57b631[_0x5882('0x1f')](_0x5882('0x2f'))){if(_0x2e26af[_0x5882('0x30')](_0x57b631['app'][_0x5882('0x26')]())>=0x0&&_0x57b631[_0x5882('0x31')]!==_0x5882('0x32')){if(_0x57b631[_0x5882('0x2f')]){_0x4fb3e5[_0x5882('0xe')]({'type':_0x57b631[_0x5882('0xf')],'app':_0x5882('0x1a'),'appdata':_0x5882('0x33'),'context':_0x57b631['context'],'exten':_0x57b631[_0x5882('0x6')],'priority':_0x1367b8[_0x5882('0x25')]+_0x142532[_0x5882('0xb')]+_0x9234b++,'VoiceExtensionId':_0x57b631[_0x5882('0x12')]});_0x4fb3e5['push']({'type':_0x57b631[_0x5882('0xf')],'app':_0x5882('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x57b631[_0x5882('0x11')],'exten':_0x57b631[_0x5882('0x6')],'priority':_0x1367b8[_0x5882('0x25')]+_0x142532[_0x5882('0xb')]+_0x9234b++,'VoiceExtensionId':_0x57b631['VoiceExtensionId']});}else{_0x4fb3e5[_0x5882('0xe')]({'type':_0x57b631[_0x5882('0xf')],'app':_0x5882('0x1a'),'appdata':_0x5882('0x34'),'context':_0x57b631['context'],'exten':_0x57b631[_0x5882('0x6')],'priority':_0x1367b8[_0x5882('0x25')]+_0x142532[_0x5882('0xb')]+_0x9234b++,'VoiceExtensionId':_0x57b631[_0x5882('0x12')]});_0x4fb3e5[_0x5882('0xe')]({'type':_0x57b631[_0x5882('0xf')],'app':_0x5882('0x14'),'appdata':_0x5882('0x35'),'context':_0x57b631['context'],'exten':_0x57b631[_0x5882('0x6')],'priority':_0x1367b8[_0x5882('0x25')]+_0x142532[_0x5882('0xb')]+_0x9234b++,'VoiceExtensionId':_0x57b631[_0x5882('0x12')]});}}}for(var _0x1db370=0x0;_0x1db370<_0x1367b8['length'];_0x1db370+=0x1){var _0x102d3a=_0x142532[_0x5882('0xb')]+_0x1367b8[_0x5882('0x25')];var _0x31bce1=_0x1db370===_0x1367b8[_0x5882('0x25')]-0x1?_0x142532['priority']+_0x4fb3e5[_0x5882('0x25')]+_0x30694a[_0x5882('0x25')]+0x2:_0x142532[_0x5882('0xb')]+_0x1db370+0x1;_0x4fb3e5['splice'](_0x1db370,0x0,{'type':_0x57b631[_0x5882('0xf')],'app':_0x5882('0x36'),'appdata':_0x1367b8[_0x1db370]+'?'+_0x57b631[_0x5882('0x11')]+',${EXTEN},'+_0x102d3a+':'+_0x57b631[_0x5882('0x11')]+_0x5882('0x37')+_0x31bce1,'exten':_0x57b631['exten'],'context':_0x57b631[_0x5882('0x11')],'priority':_0x142532['priority']+_0x1db370,'VoiceExtensionId':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x12')]});}_0x57b631[_0x5882('0xb')]=_0x4fb3e5['length']?_[_0x5882('0x38')](_0x4fb3e5)[_0x5882('0xb')]+0x1:_0x142532[_0x5882('0xb')];_0x142532[_0x5882('0xb')]=(_0x30694a[_0x5882('0x25')]?_['last'](_0x30694a)[_0x5882('0xb')]:_0x57b631['priority'])+0x1;_0x142532[_0x5882('0xc')]=_[_0x5882('0x39')](_0x142532['extensions'],_0x4fb3e5,[_0x57b631],_0x30694a);}_0x142532[_0x5882('0xc')][_0x5882('0xe')]({'type':_0x14aab2[_0x29a3c2][0x0]['type'],'app':'Hangup','exten':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x6')],'context':_0x14aab2[_0x29a3c2][0x0][_0x5882('0x11')],'priority':_0x142532['priority'],'VoiceExtensionId':_0x14aab2[_0x29a3c2][0x0]['VoiceExtensionId']});_0xb3f1d8[_0x5882('0xe')](_0x14aab2[_0x29a3c2][0x0][_0x5882('0x12')]);_0x302820=_[_0x5882('0x39')](_0x302820,_0x142532[_0x5882('0xc')]);}}return _0x1699d1[_0x5882('0x3a')](function(_0x1eddf7){return _0x1699d1[_0x5882('0x3b')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0xb3f1d8}},'transaction':_0x1eddf7})['then'](function(_0x2c2e05){return _0x1699d1[_0x5882('0x3b')][_0x5882('0x4')]['bulkCreate'](_[_0x5882('0x3c')](_0x302820,_0x5882('0xb')),{'transaction':_0x1eddf7});});});})[_0x5882('0x3d')](function(_0x177098){console[_0x5882('0x3e')](_0x177098);});}exports[_0x5882('0x3f')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index bd3050a..b8e2fac 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 _0x3914=['createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_contacts','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','sequelize','query','VoiceQueueId','onlyIfOpen','push','CmList','get','all','Campaign','always','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','stringify','emit','contact:csv_','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId'];(function(_0x349883,_0x53efaa){var _0x47871e=function(_0x6375a3){while(--_0x6375a3){_0x349883['push'](_0x349883['shift']());}};_0x47871e(++_0x53efaa);}(_0x3914,0x1df));var _0x4391=function(_0x267c52,_0x3c0df3){_0x267c52=_0x267c52-0x0;var _0x46c47b=_0x3914[_0x267c52];return _0x46c47b;};'use strict';var BPromise=require(_0x4391('0x0'));var util=require(_0x4391('0x1'));var _=require(_0x4391('0x2'));var fs=require('fs');var squel=require(_0x4391('0x3'));var Papa=require('papaparse');var Redis=require(_0x4391('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x4391('0x5'));var logger=require(_0x4391('0x6'))(_0x4391('0x7'));config[_0x4391('0x8')]=_[_0x4391('0x9')](config[_0x4391('0x8')],{'host':_0x4391('0xa'),'port':0x18eb});var socket=require(_0x4391('0xb'))(new Redis(config[_0x4391('0x8')]));require(_0x4391('0xc'))['register'](socket);try{if(!process[_0x4391('0xd')][0x2]||process['argv'][0x2]===_0x4391('0xe')||process['argv'][0x2]===_0x4391('0xf')){throw new Error(_0x4391('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0x4391('0xd')][0x3]||process[_0x4391('0xd')][0x3]===_0x4391('0xe')||process[_0x4391('0xd')][0x3]===_0x4391('0xf')||!process[_0x4391('0xd')][0x4]||process[_0x4391('0xd')][0x4]==='undefined'||process[_0x4391('0xd')][0x4]===_0x4391('0xf')){throw new Error(_0x4391('0x11'));}var FIELDS=_[_0x4391('0x12')](process[_0x4391('0xd')][0x3]['split'](','),process['argv'][0x4][_0x4391('0x13')](','));if(!process['argv'][0x5]||process[_0x4391('0xd')][0x5]===_0x4391('0xe')||process['argv'][0x5]===_0x4391('0xf')){throw new Error(_0x4391('0x14'));}var LISTID=process[_0x4391('0xd')][0x5];var COMPANYID=process[_0x4391('0xd')][0x6]&&process[_0x4391('0xd')][0x6]!=='undefined'&&process[_0x4391('0xd')][0x6]!==_0x4391('0xf')?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x4391('0xd')][0x7]!==_0x4391('0xe')&&process['argv'][0x7]!==_0x4391('0xf')?process[_0x4391('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0x4391('0xd')][0x8]===_0x4391('0xe')||process['argv'][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x4391('0xd')][0x8];}catch(_0x23b0a3){logger[_0x4391('0x15')](_0x23b0a3);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(_0x599d56,_0x455e0b,_0x3bde63,_0x12fc8f){var _0x4df619={'message':_0x455e0b};_0x4df619[_0x599d56]=!![];if(_0x3bde63){_0x4df619['contact']=_0x3bde63;}if(_0x12fc8f){_0x4df619[_0x4391('0x16')]=_0x12fc8f;}return _0x4df619;}function isEmail(_0x3a85ab){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))*$/[_0x4391('0x17')](_0x3a85ab);}function checkRow(_0x37d426,_0x5b3ba5,_0xcefe19){return new BPromise(function(_0x5eed2b,_0xab93cb){if(_[_0x4391('0x18')](_0x37d426)){return _0xab93cb(handleCheckRowError('error',_0x4391('0x19'),null,_0xcefe19));}if(_0x37d426[_0x4391('0x1a')]&&_0x37d426[_0x4391('0x1a')]['length']){var _0x2e9083=_[_0x4391('0x1b')](_0x37d426[_0x4391('0x1a')],_0x4391('0x1c'))['join'](';');return _0xab93cb(handleCheckRowError(_0x4391('0x15'),_0x2e9083,null,_0xcefe19));}var _0x38d80f={};for(var _0x57b045 in FIELDS){if(FIELDS[_0x4391('0x1d')](_0x57b045)&&FIELDS[_0x57b045]){_0x38d80f[_0x57b045]=_0x37d426[_0x4391('0x1e')][0x0][FIELDS[_0x57b045]]||_0x37d426[_0x4391('0x1e')][0x0]['\ufeff'+FIELDS[_0x57b045]];}}if(!_0x38d80f['firstName']){return _0xab93cb(handleCheckRowError(_0x4391('0x15'),_0x4391('0x1f'),null,_0xcefe19));}if(!_0x38d80f['phone']){return _0xab93cb(handleCheckRowError(_0x4391('0x15'),_0x4391('0x20'),null,_0xcefe19));}if(_0x38d80f['birthDate']){var _0x12bb7f=moment(_0x38d80f[_0x4391('0x21')],_0x4391('0x22'));if(!_0x12bb7f[_0x4391('0x23')]()){return _0xab93cb(handleCheckRowError('error',_0x4391('0x24'),null,_0xcefe19));}}if(_0x38d80f[_0x4391('0x25')]){if(!isEmail(_0x38d80f[_0x4391('0x25')])){return _0xab93cb(handleCheckRowError(_0x4391('0x15'),_0x4391('0x26'),null,_0xcefe19));}}_0x38d80f['ListId']=LISTID;_0x38d80f[_0x4391('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x5b3ba5){var _0x2b943b={};for(var _0x1f4719=0x0,_0x59f240=DUPLICATES[_0x4391('0x28')];_0x1f4719<_0x59f240;_0x1f4719+=0x1){_0x2b943b[DUPLICATES[_0x1f4719]]=_0x38d80f[DUPLICATES[_0x1f4719]];}var _0x18249d=_[_0x4391('0x29')](_0x5b3ba5,_0x2b943b);if(_0x18249d){return _0xab93cb(handleCheckRowError(_0x4391('0x2a'),_0x4391('0x2b'),_0x18249d,_0xcefe19));}}return db[_0x4391('0x2c')][_0x4391('0x2d')](_0x38d80f,{'raw':!![],'hooks':![],'fields':_[_0x4391('0x2e')](_0x38d80f)})[_0x4391('0x2f')](function(_0x5ea724){if(DUPLICATES&&DUPLICATES[_0x4391('0x28')]&&_0x5b3ba5){_0x5b3ba5['push'](_[_0x4391('0x30')](_0x38d80f,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5ea724['id'];return _0x5eed2b();})[_0x4391('0x31')](function(_0x3b448b){return _0xab93cb(handleCheckRowError(_0x4391('0x15'),_0x4391('0x32')+(_0x3b448b[_0x4391('0x1c')]||JSON['stringify'](_0x3b448b)),null,_0xcefe19));});});}function checkHopper(){function _0x594b92(){return function(_0x556025){logger['error'](_0x4391('0x33'),_0x4391('0x34'),util['inspect'](_0x556025,{'showHidden':![],'depth':null}));};}var _0xc911fe=function(_0x45a61d,_0x2c111d){var _0xe0012a=squel[_0x4391('0x35')]()[_0x4391('0x36')](_0x4391('0x37'))[_0x4391('0x38')]([_0x4391('0x39'),_0x4391('0x3a'),_0x4391('0x3b'),_0x4391('0x3c'),_0x2c111d,_0x4391('0x3d'),_0x4391('0x3e')],squel[_0x4391('0x3f')]()[_0x4391('0x40')](_0x4391('0x39'),'phone')[_0x4391('0x40')](_0x4391('0x41'),_0x4391('0x3a'))['field']('id',_0x4391('0x3b'))[_0x4391('0x40')](LISTID['toString'](),_0x4391('0x3c'))[_0x4391('0x40')](_0x45a61d['id'][_0x4391('0x42')](),_0x2c111d)[_0x4391('0x40')]('NOW()',_0x4391('0x3d'))[_0x4391('0x40')](_0x4391('0x41'),_0x4391('0x3e'))[_0x4391('0x43')]('cm_contacts')[_0x4391('0x44')](_0x4391('0x45'))['where'](_0x4391('0x46'),LISTID[_0x4391('0x42')]())['where'](_0x4391('0x47'))[_0x4391('0x44')](_0x4391('0x48'),squel[_0x4391('0x3f')]()[_0x4391('0x40')]('phone')[_0x4391('0x43')](_0x4391('0x37'))[_0x4391('0x44')](_0x2c111d+'\x20=\x20?',_0x45a61d['id']['toString']())))[_0x4391('0x42')]();return _0xe0012a;};var _0x42aa55=function(_0x1b952e,_0xfd6953){var _0x261e38=squel[_0x4391('0x35')]()[_0x4391('0x36')](_0x4391('0x37'))['fromQuery'](['phone',_0x4391('0x3a'),'ContactId',_0x4391('0x3c'),_0xfd6953,_0x4391('0x3d'),_0x4391('0x3e')],squel['select']()[_0x4391('0x40')]('phone',_0x4391('0x39'))[_0x4391('0x40')](_0x4391('0x41'),_0x4391('0x3a'))[_0x4391('0x40')]('id',_0x4391('0x3b'))[_0x4391('0x40')](LISTID[_0x4391('0x42')](),_0x4391('0x3c'))[_0x4391('0x40')](_0x1b952e['id'][_0x4391('0x42')](),_0xfd6953)[_0x4391('0x40')](_0x4391('0x41'),_0x4391('0x3d'))[_0x4391('0x40')](_0x4391('0x41'),_0x4391('0x3e'))[_0x4391('0x43')](_0x4391('0x49'))[_0x4391('0x44')]('deletedAt\x20IS\x20NULL')[_0x4391('0x44')](_0x4391('0x46'),LISTID[_0x4391('0x42')]())[_0x4391('0x44')]('id\x20IN\x20?',squel[_0x4391('0x4a')](hopperContacts))[_0x4391('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0x4391('0x44')](_0x4391('0x48'),squel[_0x4391('0x3f')]()[_0x4391('0x40')](_0x4391('0x4b'))[_0x4391('0x43')](_0x4391('0x4c'))[_0x4391('0x44')](_0xfd6953+'\x20=\x20?',_0x1b952e['id'][_0x4391('0x42')]()))[_0x4391('0x44')](_0x4391('0x48'),squel[_0x4391('0x3f')]()['field'](_0x4391('0x39'))[_0x4391('0x43')](_0x4391('0x37'))[_0x4391('0x44')](_0xfd6953+'\x20=\x20?',_0x1b952e['id'][_0x4391('0x42')]())))[_0x4391('0x42')]();return _0x261e38;};function _0x4ac65b(_0x59cd46,_0x328029){var _0x1d58fc=squel[_0x4391('0x35')]()[_0x4391('0x36')](_0x4391('0x37'))['fromQuery']([_0x4391('0x39'),_0x4391('0x3a'),_0x4391('0x3b'),_0x4391('0x3c'),_0x328029,_0x4391('0x3d'),_0x4391('0x3e')],squel[_0x4391('0x3f')]()[_0x4391('0x40')]('phone',_0x4391('0x39'))['field'](_0x4391('0x41'),'scheduledAt')[_0x4391('0x40')]('id',_0x4391('0x3b'))[_0x4391('0x40')](LISTID[_0x4391('0x42')](),_0x4391('0x3c'))[_0x4391('0x40')](_0x59cd46['id'][_0x4391('0x42')](),_0x328029)['field'](_0x4391('0x41'),_0x4391('0x3d'))['field'](_0x4391('0x41'),'updatedAt')['from'](_0x4391('0x49'))['where'](_0x4391('0x45'))[_0x4391('0x44')](_0x4391('0x46'),LISTID[_0x4391('0x42')]())['where'](_0x4391('0x4d'),squel['str'](hopperContacts))[_0x4391('0x44')](_0x4391('0x47')))[_0x4391('0x42')]();return _0x1d58fc;}function _0x1313ba(_0x1a2d04,_0x1916b2){var _0x1b1582=squel[_0x4391('0x35')]()['into'](_0x4391('0x4e'))['fromQuery']([_0x4391('0x39'),_0x4391('0x3b'),_0x4391('0x3c'),_0x1916b2,_0x4391('0x3d'),_0x4391('0x3e')],squel['select']()[_0x4391('0x40')](_0x4391('0x39'),_0x4391('0x39'))[_0x4391('0x40')]('id','ContactId')[_0x4391('0x40')](LISTID['toString'](),'ListId')[_0x4391('0x40')](_0x1a2d04['id'][_0x4391('0x42')](),_0x1916b2)[_0x4391('0x40')](_0x4391('0x41'),'createdAt')[_0x4391('0x40')](_0x4391('0x41'),'updatedAt')['from'](_0x4391('0x49'))[_0x4391('0x44')]('deletedAt\x20IS\x20NULL')[_0x4391('0x44')]('ListId\x20=\x20?',LISTID[_0x4391('0x42')]())[_0x4391('0x44')]('id\x20IN\x20?',squel[_0x4391('0x4a')](hopperContacts))[_0x4391('0x44')](_0x4391('0x47')))['toString']();return _0x1b1582;}return db[_0x4391('0x4f')][_0x4391('0x50')]({'where':{'type':_0x4391('0x51')},'attributes':['id',_0x4391('0x52')],'include':[{'model':db['CmList'],'as':_0x4391('0x53'),'where':{'id':LISTID}}]})['then'](function(_0x57c490){var _0x287cbf=[];if(_0x57c490){var _0x470749;for(var _0x381a5e=0x0,_0x171a37;_0x381a5e<_0x57c490['length'];_0x381a5e+=0x1){_0x171a37=_0x57c490[_0x381a5e]['get']({'plain':!![]});switch(_0x171a37[_0x4391('0x52')]){case'always':_0x287cbf['push'](db[_0x4391('0x54')][_0x4391('0x55')](_0x42aa55(_0x171a37,_0x4391('0x56')))['then'](function(){})[_0x4391('0x31')](_0x594b92()));break;case _0x4391('0x57'):_0x287cbf['push'](db['sequelize'][_0x4391('0x55')](_0xc911fe(_0x171a37,'VoiceQueueId'))[_0x4391('0x2f')](function(){})[_0x4391('0x31')](_0x594b92()));break;default:_0x287cbf[_0x4391('0x58')](db[_0x4391('0x54')][_0x4391('0x55')](_0x4ac65b(_0x171a37,'VoiceQueueId'))[_0x4391('0x2f')](function(){})[_0x4391('0x31')](_0x594b92()));}}}return _0x287cbf;})['all']()[_0x4391('0x2f')](function(){return db[_0x4391('0x4f')]['findAll']({'where':{'type':_0x4391('0x51')},'attributes':['id'],'include':[{'model':db[_0x4391('0x59')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x4391('0x2f')](function(_0x301566){var _0x40b9ea=[];if(_0x301566){var _0x49c0fc;for(var _0x20ce78=0x0,_0x26265d;_0x20ce78<_0x301566[_0x4391('0x28')];_0x20ce78+=0x1){_0x26265d=_0x301566[_0x20ce78][_0x4391('0x5a')]({'plain':!![]});_0x40b9ea[_0x4391('0x58')](db[_0x4391('0x54')][_0x4391('0x55')](_0x1313ba(_0x26265d,_0x4391('0x56')))[_0x4391('0x2f')](function(){})[_0x4391('0x31')](_0x594b92()));}}return _0x40b9ea;})[_0x4391('0x5b')]();})[_0x4391('0x2f')](function(){return db[_0x4391('0x5c')][_0x4391('0x50')]({'attributes':['id',_0x4391('0x52')],'include':[{'model':db[_0x4391('0x59')],'as':_0x4391('0x53'),'where':{'id':LISTID}}]})[_0x4391('0x2f')](function(_0x1cd056){var _0x1270a9=[];if(_0x1cd056){for(var _0x5a64c7=0x0,_0x39ce8b;_0x5a64c7<_0x1cd056['length'];_0x5a64c7+=0x1){_0x39ce8b=_0x1cd056[_0x5a64c7]['get']({'plain':!![]});switch(_0x39ce8b[_0x4391('0x52')]){case _0x4391('0x5d'):_0x1270a9[_0x4391('0x58')](db[_0x4391('0x54')][_0x4391('0x55')](_0x42aa55(_0x39ce8b,_0x4391('0x5e')))[_0x4391('0x2f')](function(){})[_0x4391('0x31')](_0x594b92()));break;case _0x4391('0x57'):_0x1270a9[_0x4391('0x58')](db[_0x4391('0x54')]['query'](_0xc911fe(_0x39ce8b,'CampaignId'))['then'](function(){})['catch'](_0x594b92()));break;default:_0x1270a9['push'](db[_0x4391('0x54')]['query'](_0x4ac65b(_0x39ce8b,_0x4391('0x5e')))[_0x4391('0x2f')](function(){})[_0x4391('0x31')](_0x594b92()));}}}return _0x1270a9;})[_0x4391('0x5b')]();})[_0x4391('0x2f')](function(){return db[_0x4391('0x5c')][_0x4391('0x50')]({'attributes':['id'],'include':[{'model':db[_0x4391('0x59')],'as':_0x4391('0x5f'),'where':{'id':LISTID}}]})[_0x4391('0x2f')](function(_0x24fee7){var _0x251924=[];if(_0x24fee7){for(var _0x3527d9=0x0,_0x379f4f;_0x3527d9<_0x24fee7[_0x4391('0x28')];_0x3527d9+=0x1){_0x379f4f=_0x24fee7[_0x3527d9]['get']({'plain':!![]});_0x251924['push'](db[_0x4391('0x54')][_0x4391('0x55')](_0x1313ba(_0x379f4f,_0x4391('0x5e')))[_0x4391('0x2f')](function(){})[_0x4391('0x31')](_0x594b92()));}}return _0x251924;})['all']();})['catch'](function(_0x3c4e24){logger['error'](_0x4391('0x60'),_0x4391('0x61'),_0x3c4e24[_0x4391('0x1c')]);});}var processPromises=function(_0x450eea){return BPromise[_0x4391('0x5b')](promises)[_0x4391('0x2f')](function(_0x294b11){})[_0x4391('0x31')](function(_0x4904f4){logger[_0x4391('0x15')]('Error\x20processing\x20rows\x20block:',JSON[_0x4391('0x62')](_0x4904f4));})['finally'](function(){socket[_0x4391('0x63')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x450eea){return _0x450eea['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0x4391('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x4391('0x63')](_0x4391('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x44d222){logger[_0x4391('0x15')]('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x44d222));}finally{process['exit'](0x0);}});};process['on'](_0x4391('0x65'),function(){logger['info'](_0x4391('0x66'));endCsv();});function main(){return BPromise['resolve']()[_0x4391('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x4391('0x13')](',');return db[_0x4391('0x2c')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x4391('0x2f')](function(_0x353dde){var _0x621230=fs[_0x4391('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x621230,{'header':!![],'skipEmptyLines':!![],'step':function(_0x35e2a6,_0x3b54ad){total+=0x1;var _0x192efb=total;promises[_0x4391('0x58')](checkRow(_0x35e2a6,_0x353dde,_0x192efb)[_0x4391('0x2f')](function(){success+=0x1;})[_0x4391('0x31')](function(_0x3e2723){if(_0x3e2723['error']){errors+=0x1;delete _0x3e2723[_0x4391('0x15')];}else if(_0x3e2723[_0x4391('0x2a')]){duplicates+=0x1;delete _0x3e2723[_0x4391('0x2a')];}rows[_0x4391('0x58')](_0x3e2723);}));if(total%0xc8===0x0){_0x3b54ad['pause']();return processPromises(_0x3b54ad);}},'complete':function(){return processPromises()['then'](function(){logger[_0x4391('0x68')](_0x4391('0x69'));endCsv();});},'error':function(_0xcc9c7c,_0x94bc1c){logger[_0x4391('0x68')](_0x4391('0x6a'),JSON[_0x4391('0x62')](_0xcc9c7c));endCsv();}});})[_0x4391('0x31')](function(_0x53365c){logger['error'](_0x4391('0x6b'),JSON['stringify'](_0x53365c));});}main(); \ No newline at end of file +var _0xd01a=['Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','keys','then','pick','stringify','cmContact','inspect','into','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','insert','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','sequelize','VoiceQueueId','catch','push','query','all','VoiceQueue','BlackLists','always','CampaignId','onlyIfOpen','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','register','argv','Missing\x20filepath\x20parameter!','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd01a,0xcc));var _0xad01=function(_0x538c00,_0x3643a9){_0x538c00=_0x538c00-0x0;var _0x5ac027=_0xd01a[_0x538c00];return _0x5ac027;};'use strict';var BPromise=require('bluebird');var util=require(_0xad01('0x0'));var _=require('lodash');var fs=require('fs');var squel=require(_0xad01('0x1'));var Papa=require(_0xad01('0x2'));var Redis=require(_0xad01('0x3'));var db=require(_0xad01('0x4'))['db'];var config=require(_0xad01('0x5'));var logger=require(_0xad01('0x6'))('api');config[_0xad01('0x7')]=_[_0xad01('0x8')](config[_0xad01('0x7')],{'host':_0xad01('0x9'),'port':0x18eb});var socket=require(_0xad01('0xa'))(new Redis(config[_0xad01('0x7')]));require('../../../api/cmContact/cmContact.socket')[_0xad01('0xb')](socket);try{if(!process[_0xad01('0xc')][0x2]||process[_0xad01('0xc')][0x2]==='undefined'||process['argv'][0x2]==='null'){throw new Error(_0xad01('0xd'));}var FILEPATH=process[_0xad01('0xc')][0x2];if(!process[_0xad01('0xc')][0x3]||process[_0xad01('0xc')][0x3]===_0xad01('0xe')||process[_0xad01('0xc')][0x3]===_0xad01('0xf')||!process[_0xad01('0xc')][0x4]||process[_0xad01('0xc')][0x4]===_0xad01('0xe')||process['argv'][0x4]===_0xad01('0xf')){throw new Error(_0xad01('0x10'));}var FIELDS=_[_0xad01('0x11')](process[_0xad01('0xc')][0x3][_0xad01('0x12')](','),process[_0xad01('0xc')][0x4]['split'](','));if(!process[_0xad01('0xc')][0x5]||process[_0xad01('0xc')][0x5]===_0xad01('0xe')||process[_0xad01('0xc')][0x5]===_0xad01('0xf')){throw new Error(_0xad01('0x13'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xad01('0xc')][0x6]&&process[_0xad01('0xc')][0x6]!=='undefined'&&process[_0xad01('0xc')][0x6]!==_0xad01('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0xad01('0xc')][0x7]&&process[_0xad01('0xc')][0x7]!==_0xad01('0xe')&&process[_0xad01('0xc')][0x7]!==_0xad01('0xf')?process[_0xad01('0xc')][0x7]:null;if(!process[_0xad01('0xc')][0x8]||process[_0xad01('0xc')][0x8]===_0xad01('0xe')||process[_0xad01('0xc')][0x8]===_0xad01('0xf')){throw new Error(_0xad01('0x14'));}var SOCKET_TIMESTAMP=process[_0xad01('0xc')][0x8];}catch(_0x568b32){logger[_0xad01('0x15')](_0x568b32);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(_0x5789b5,_0x19919f,_0x4437ee,_0x460e12){var _0x468ada={'message':_0x19919f};_0x468ada[_0x5789b5]=!![];if(_0x4437ee){_0x468ada[_0xad01('0x16')]=_0x4437ee;}if(_0x460e12){_0x468ada[_0xad01('0x17')]=_0x460e12;}return _0x468ada;}function isEmail(_0x5e7eaa){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))*$/[_0xad01('0x18')](_0x5e7eaa);}function checkRow(_0x291cea,_0x357abd,_0x15117a){return new BPromise(function(_0x3061e4,_0xf4b9e6){if(_['isNil'](_0x291cea)){return _0xf4b9e6(handleCheckRowError('error',_0xad01('0x19'),null,_0x15117a));}if(_0x291cea[_0xad01('0x1a')]&&_0x291cea[_0xad01('0x1a')][_0xad01('0x1b')]){var _0x3cd2aa=_[_0xad01('0x1c')](_0x291cea[_0xad01('0x1a')],'message')[_0xad01('0x1d')](';');return _0xf4b9e6(handleCheckRowError(_0xad01('0x15'),_0x3cd2aa,null,_0x15117a));}var _0x1e22dd={};for(var _0x1b2063 in FIELDS){if(FIELDS[_0xad01('0x1e')](_0x1b2063)&&FIELDS[_0x1b2063]){_0x1e22dd[_0x1b2063]=_0x291cea[_0xad01('0x1f')][0x0][FIELDS[_0x1b2063]]||_0x291cea[_0xad01('0x1f')][0x0]['\ufeff'+FIELDS[_0x1b2063]];}}if(!_0x1e22dd['firstName']){return _0xf4b9e6(handleCheckRowError(_0xad01('0x15'),_0xad01('0x20'),null,_0x15117a));}if(!_0x1e22dd[_0xad01('0x21')]){return _0xf4b9e6(handleCheckRowError(_0xad01('0x15'),_0xad01('0x22'),null,_0x15117a));}if(_0x1e22dd[_0xad01('0x23')]){var _0x42b959=moment(_0x1e22dd[_0xad01('0x23')],'YYYY-MM-DD');if(!_0x42b959[_0xad01('0x24')]()){return _0xf4b9e6(handleCheckRowError(_0xad01('0x15'),_0xad01('0x25'),null,_0x15117a));}}if(_0x1e22dd[_0xad01('0x26')]){if(!isEmail(_0x1e22dd[_0xad01('0x26')])){return _0xf4b9e6(handleCheckRowError(_0xad01('0x15'),_0xad01('0x27'),null,_0x15117a));}}_0x1e22dd[_0xad01('0x28')]=LISTID;_0x1e22dd[_0xad01('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x357abd){var _0x4b2101={};for(var _0x1c69b8=0x0,_0x164f79=DUPLICATES['length'];_0x1c69b8<_0x164f79;_0x1c69b8+=0x1){_0x4b2101[DUPLICATES[_0x1c69b8]]=_0x1e22dd[DUPLICATES[_0x1c69b8]];}var _0x29ed0d=_[_0xad01('0x2a')](_0x357abd,_0x4b2101);if(_0x29ed0d){return _0xf4b9e6(handleCheckRowError('duplicate',_0xad01('0x2b'),_0x29ed0d,_0x15117a));}}return db[_0xad01('0x2c')]['create'](_0x1e22dd,{'raw':!![],'hooks':![],'fields':_[_0xad01('0x2d')](_0x1e22dd)})[_0xad01('0x2e')](function(_0x4e97e1){if(DUPLICATES&&DUPLICATES[_0xad01('0x1b')]&&_0x357abd){_0x357abd['push'](_[_0xad01('0x2f')](_0x1e22dd,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4e97e1['id'];return _0x3061e4();})['catch'](function(_0x2055c3){return _0xf4b9e6(handleCheckRowError(_0xad01('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x2055c3['message']||JSON[_0xad01('0x30')](_0x2055c3)),null,_0x15117a));});});}function checkHopper(){function _0x1f12b(){return function(_0xb86f1e){logger['error'](_0xad01('0x31'),'checkHopper',util[_0xad01('0x32')](_0xb86f1e,{'showHidden':![],'depth':null}));};}var _0x390452=function(_0x4dae3f,_0x44f7e0){var _0x3c4a86=squel['insert']()[_0xad01('0x33')]('cm_hopper')[_0xad01('0x34')](['phone',_0xad01('0x35'),_0xad01('0x36'),_0xad01('0x28'),_0x44f7e0,_0xad01('0x37'),_0xad01('0x38')],squel[_0xad01('0x39')]()['field'](_0xad01('0x21'),_0xad01('0x21'))['field']('NOW()','scheduledAt')[_0xad01('0x3a')]('id','ContactId')['field'](LISTID['toString'](),'ListId')[_0xad01('0x3a')](_0x4dae3f['id'][_0xad01('0x3b')](),_0x44f7e0)[_0xad01('0x3a')](_0xad01('0x3c'),_0xad01('0x37'))[_0xad01('0x3a')]('NOW()',_0xad01('0x38'))[_0xad01('0x3d')](_0xad01('0x3e'))[_0xad01('0x3f')](_0xad01('0x40'))[_0xad01('0x3f')]('ListId\x20=\x20?',LISTID[_0xad01('0x3b')]())[_0xad01('0x3f')](_0xad01('0x41'))['where'](_0xad01('0x42'),squel[_0xad01('0x39')]()['field'](_0xad01('0x21'))[_0xad01('0x3d')](_0xad01('0x43'))['where'](_0x44f7e0+'\x20=\x20?',_0x4dae3f['id'][_0xad01('0x3b')]())))[_0xad01('0x3b')]();return _0x3c4a86;};var _0x29482c=function(_0x7321fd,_0x45e657){var _0x40118b=squel[_0xad01('0x44')]()['into']('cm_hopper')['fromQuery'](['phone',_0xad01('0x35'),'ContactId',_0xad01('0x28'),_0x45e657,_0xad01('0x37'),_0xad01('0x38')],squel[_0xad01('0x39')]()[_0xad01('0x3a')](_0xad01('0x21'),'phone')[_0xad01('0x3a')]('NOW()',_0xad01('0x35'))[_0xad01('0x3a')]('id',_0xad01('0x36'))[_0xad01('0x3a')](LISTID[_0xad01('0x3b')](),_0xad01('0x28'))[_0xad01('0x3a')](_0x7321fd['id'][_0xad01('0x3b')](),_0x45e657)[_0xad01('0x3a')]('NOW()',_0xad01('0x37'))[_0xad01('0x3a')]('NOW()',_0xad01('0x38'))[_0xad01('0x3d')]('cm_contacts')['where'](_0xad01('0x40'))[_0xad01('0x3f')](_0xad01('0x45'),LISTID['toString']())['where'](_0xad01('0x46'),squel[_0xad01('0x47')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xad01('0x39')]()[_0xad01('0x3a')](_0xad01('0x48'))[_0xad01('0x3d')](_0xad01('0x49'))[_0xad01('0x3f')](_0x45e657+_0xad01('0x4a'),_0x7321fd['id'][_0xad01('0x3b')]()))[_0xad01('0x3f')](_0xad01('0x42'),squel[_0xad01('0x39')]()['field'](_0xad01('0x21'))[_0xad01('0x3d')](_0xad01('0x43'))[_0xad01('0x3f')](_0x45e657+'\x20=\x20?',_0x7321fd['id']['toString']())))[_0xad01('0x3b')]();return _0x40118b;};function _0x4abf59(_0x32a2f6,_0x2dbcba){var _0x436c82=squel['insert']()[_0xad01('0x33')](_0xad01('0x43'))[_0xad01('0x34')]([_0xad01('0x21'),_0xad01('0x35'),_0xad01('0x36'),'ListId',_0x2dbcba,_0xad01('0x37'),_0xad01('0x38')],squel[_0xad01('0x39')]()[_0xad01('0x3a')](_0xad01('0x21'),_0xad01('0x21'))[_0xad01('0x3a')](_0xad01('0x3c'),_0xad01('0x35'))[_0xad01('0x3a')]('id',_0xad01('0x36'))[_0xad01('0x3a')](LISTID['toString'](),'ListId')[_0xad01('0x3a')](_0x32a2f6['id']['toString'](),_0x2dbcba)[_0xad01('0x3a')]('NOW()',_0xad01('0x37'))['field'](_0xad01('0x3c'),_0xad01('0x38'))[_0xad01('0x3d')](_0xad01('0x3e'))[_0xad01('0x3f')]('deletedAt\x20IS\x20NULL')[_0xad01('0x3f')](_0xad01('0x45'),LISTID[_0xad01('0x3b')]())[_0xad01('0x3f')](_0xad01('0x46'),squel[_0xad01('0x47')](hopperContacts))[_0xad01('0x3f')](_0xad01('0x41')))[_0xad01('0x3b')]();return _0x436c82;}function _0x341696(_0x16156e,_0x50d2b5){var _0x4857a6=squel['insert']()[_0xad01('0x33')](_0xad01('0x4b'))[_0xad01('0x34')]([_0xad01('0x21'),_0xad01('0x36'),'ListId',_0x50d2b5,_0xad01('0x37'),_0xad01('0x38')],squel[_0xad01('0x39')]()['field']('phone','phone')[_0xad01('0x3a')]('id','ContactId')[_0xad01('0x3a')](LISTID['toString'](),_0xad01('0x28'))['field'](_0x16156e['id'][_0xad01('0x3b')](),_0x50d2b5)[_0xad01('0x3a')](_0xad01('0x3c'),_0xad01('0x37'))[_0xad01('0x3a')]('NOW()',_0xad01('0x38'))['from'](_0xad01('0x3e'))[_0xad01('0x3f')](_0xad01('0x40'))[_0xad01('0x3f')]('ListId\x20=\x20?',LISTID[_0xad01('0x3b')]())[_0xad01('0x3f')](_0xad01('0x46'),squel[_0xad01('0x47')](hopperContacts))[_0xad01('0x3f')](_0xad01('0x41')))[_0xad01('0x3b')]();return _0x4857a6;}return db['VoiceQueue'][_0xad01('0x4c')]({'where':{'type':_0xad01('0x4d')},'attributes':['id',_0xad01('0x4e')],'include':[{'model':db[_0xad01('0x4f')],'as':_0xad01('0x50'),'where':{'id':LISTID}}]})[_0xad01('0x2e')](function(_0x389c84){var _0x1bb2c8=[];if(_0x389c84){var _0x52fcd0;for(var _0x30131d=0x0,_0x22d5fe;_0x30131d<_0x389c84[_0xad01('0x1b')];_0x30131d+=0x1){_0x22d5fe=_0x389c84[_0x30131d][_0xad01('0x51')]({'plain':!![]});switch(_0x22d5fe['dialCheckDuplicateType']){case'always':_0x1bb2c8['push'](db[_0xad01('0x52')]['query'](_0x29482c(_0x22d5fe,_0xad01('0x53')))['then'](function(){})[_0xad01('0x54')](_0x1f12b()));break;case'onlyIfOpen':_0x1bb2c8[_0xad01('0x55')](db[_0xad01('0x52')][_0xad01('0x56')](_0x390452(_0x22d5fe,_0xad01('0x53')))['then'](function(){})[_0xad01('0x54')](_0x1f12b()));break;default:_0x1bb2c8[_0xad01('0x55')](db['sequelize'][_0xad01('0x56')](_0x4abf59(_0x22d5fe,_0xad01('0x53')))[_0xad01('0x2e')](function(){})[_0xad01('0x54')](_0x1f12b()));}}}return _0x1bb2c8;})[_0xad01('0x57')]()[_0xad01('0x2e')](function(){return db[_0xad01('0x58')][_0xad01('0x4c')]({'where':{'type':_0xad01('0x4d')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xad01('0x59'),'where':{'id':LISTID}}]})[_0xad01('0x2e')](function(_0x30a230){var _0x51cf78=[];if(_0x30a230){var _0x3c5b90;for(var _0x2dfa73=0x0,_0x4dc140;_0x2dfa73<_0x30a230['length'];_0x2dfa73+=0x1){_0x4dc140=_0x30a230[_0x2dfa73][_0xad01('0x51')]({'plain':!![]});_0x51cf78[_0xad01('0x55')](db[_0xad01('0x52')][_0xad01('0x56')](_0x341696(_0x4dc140,_0xad01('0x53')))[_0xad01('0x2e')](function(){})[_0xad01('0x54')](_0x1f12b()));}}return _0x51cf78;})[_0xad01('0x57')]();})[_0xad01('0x2e')](function(){return db['Campaign'][_0xad01('0x4c')]({'attributes':['id',_0xad01('0x4e')],'include':[{'model':db[_0xad01('0x4f')],'as':'Lists','where':{'id':LISTID}}]})[_0xad01('0x2e')](function(_0x4eda92){var _0x5e3b78=[];if(_0x4eda92){for(var _0x56ff60=0x0,_0x1f3e1b;_0x56ff60<_0x4eda92[_0xad01('0x1b')];_0x56ff60+=0x1){_0x1f3e1b=_0x4eda92[_0x56ff60][_0xad01('0x51')]({'plain':!![]});switch(_0x1f3e1b['dialCheckDuplicateType']){case _0xad01('0x5a'):_0x5e3b78[_0xad01('0x55')](db[_0xad01('0x52')][_0xad01('0x56')](_0x29482c(_0x1f3e1b,_0xad01('0x5b')))[_0xad01('0x2e')](function(){})[_0xad01('0x54')](_0x1f12b()));break;case _0xad01('0x5c'):_0x5e3b78[_0xad01('0x55')](db[_0xad01('0x52')][_0xad01('0x56')](_0x390452(_0x1f3e1b,'CampaignId'))[_0xad01('0x2e')](function(){})[_0xad01('0x54')](_0x1f12b()));break;default:_0x5e3b78[_0xad01('0x55')](db[_0xad01('0x52')][_0xad01('0x56')](_0x4abf59(_0x1f3e1b,'CampaignId'))[_0xad01('0x2e')](function(){})[_0xad01('0x54')](_0x1f12b()));}}}return _0x5e3b78;})[_0xad01('0x57')]();})[_0xad01('0x2e')](function(){return db[_0xad01('0x5d')][_0xad01('0x4c')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0xad01('0x2e')](function(_0x5e8e65){var _0x3bc6db=[];if(_0x5e8e65){for(var _0x395e40=0x0,_0x40fb1d;_0x395e40<_0x5e8e65[_0xad01('0x1b')];_0x395e40+=0x1){_0x40fb1d=_0x5e8e65[_0x395e40][_0xad01('0x51')]({'plain':!![]});_0x3bc6db[_0xad01('0x55')](db[_0xad01('0x52')]['query'](_0x341696(_0x40fb1d,_0xad01('0x5b')))['then'](function(){})[_0xad01('0x54')](_0x1f12b()));}}return _0x3bc6db;})['all']();})[_0xad01('0x54')](function(_0x19906a){logger[_0xad01('0x15')](_0xad01('0x5e'),_0xad01('0x5f'),_0x19906a['message']);});}var processPromises=function(_0x3ff1c3){return BPromise['all'](promises)[_0xad01('0x2e')](function(_0x104954){})[_0xad01('0x54')](function(_0x5a1d1f){logger[_0xad01('0x15')](_0xad01('0x60'),JSON[_0xad01('0x30')](_0x5a1d1f));})[_0xad01('0x61')](function(){socket[_0xad01('0x62')](_0xad01('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3ff1c3){return _0x3ff1c3[_0xad01('0x64')]();}});};var endCsv=function(){return BPromise[_0xad01('0x65')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xad01('0x2e')](function(){socket[_0xad01('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xad01('0x66')](FILEPATH);}catch(_0x2c07bf){logger[_0xad01('0x15')](_0xad01('0x67'),JSON[_0xad01('0x30')](_0x2c07bf));}finally{process['exit'](0x0);}});};process['on'](_0xad01('0x68'),function(){logger['info'](_0xad01('0x69'));endCsv();});function main(){return BPromise['resolve']()[_0xad01('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xad01('0x12')](',');return db['CmContact'][_0xad01('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xad01('0x2e')](function(_0x540851){var _0x3c3ec7=fs[_0xad01('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xad01('0x6b')](_0x3c3ec7,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eece0,_0x136326){total+=0x1;var _0xc33528=total;promises[_0xad01('0x55')](checkRow(_0x4eece0,_0x540851,_0xc33528)[_0xad01('0x2e')](function(){success+=0x1;})[_0xad01('0x54')](function(_0x1d1da4){if(_0x1d1da4[_0xad01('0x15')]){errors+=0x1;delete _0x1d1da4['error'];}else if(_0x1d1da4[_0xad01('0x6c')]){duplicates+=0x1;delete _0x1d1da4[_0xad01('0x6c')];}rows[_0xad01('0x55')](_0x1d1da4);}));if(total%0xc8===0x0){_0x136326['pause']();return processPromises(_0x136326);}},'complete':function(){return processPromises()[_0xad01('0x2e')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1523a7,_0x5692c6){logger[_0xad01('0x6d')](_0xad01('0x6e'),JSON[_0xad01('0x30')](_0x1523a7));endCsv();}});})[_0xad01('0x54')](function(_0x328c7a){logger[_0xad01('0x15')](_0xad01('0x6f'),JSON['stringify'](_0x328c7a));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 4dcd829..eea654c 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 _0x446d=['parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','import','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','priority','UserId','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.updatedAt','cm_hopper_black','ListId','cm_contacts','ListId\x20=\x20?','\x20=\x20?','scheduledat','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','error','message','errors','push','sequelize','query','spread','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','length','all','catch','voice_queues.id','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','then','timezones','isNil','utcOffset','set','offset','dialTimezone','main','stringify','send','start','binding','socket_timestamp','root','.csv','includes','header','writeFileSync','createReadStream','data','rows','hasOwnProperty','trim','isValid','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','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',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x446d,0x1d8));var _0xd446=function(_0xef66ed,_0x1a5239){_0xef66ed=_0xef66ed-0x0;var _0xa14f66=_0x446d[_0xef66ed];return _0xa14f66;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xd446('0x0'));var util=require(_0xd446('0x1'));var BPromise=require(_0xd446('0x2'));var moment=require('moment');var squel=require(_0xd446('0x3'));var Redis=require(_0xd446('0x4'));var db=require(_0xd446('0x5'))['db'];var config=require(_0xd446('0x6'));var shared=require(_0xd446('0x7'));var logger=require('../../../config/logger')(_0xd446('0x8'));config[_0xd446('0x9')]=_['defaults'](config[_0xd446('0x9')],{'host':_0xd446('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));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()[_0xd446('0xb')](_0xd446('0xc'));function isEmail(_0x5a8764){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))*$/[_0xd446('0xd')](_0x5a8764);}function selectNotIn(_0x233ed5,_0x1b391b,_0x2d8305,_0x124b5b,_0x4d05cf){return squel[_0xd446('0xe')]()[_0xd446('0xf')](_0xd446('0x10'))[_0xd446('0x11')](_0x124b5b)[_0xd446('0x12')](_0x1b391b,null,_0x1b391b+_0xd446('0x13')+_0x124b5b+'.'+_0x2d8305)[_0xd446('0x14')](_0x124b5b+'.'+_0x2d8305+'\x20=\x20'+_0x233ed5+'.'+_0x2d8305)[_0xd446('0x14')](_0x1b391b+'.dialCheckDuplicateType\x20IN\x20('+_0x4d05cf[_0xd446('0x12')]()+')');}function insertCmHopper(_0x4d4176,_0x58a416,_0xf0dcf5,_0x28cc67,_0x5e1bd4){var _0x299d23=[_0xd446('0x15'),_0xd446('0x16'),_0xd446('0x17'),_0xd446('0x18'),_0x58a416+'.'+_0x28cc67,_0xd446('0x19'),'cm_contacts.updatedAt',_0xd446('0x1a'),_0xd446('0x1b'),'\x22'+_0x5e1bd4+'\x22'];return squel[_0xd446('0x1c')]()[_0xd446('0x1d')](_0xd446('0x1e'))[_0xd446('0x1f')]([_0xd446('0x10'),'scheduledat',_0xd446('0x20'),'ListId',_0x28cc67,_0xd446('0x21'),_0xd446('0x22'),_0xd446('0x23'),_0xd446('0x24'),'recallme'],squel[_0xd446('0xe')]()[_0xd446('0x25')](_0x299d23)['from'](_0x58a416)[_0xd446('0x12')]('cm_contacts',null,_0xd446('0x26')+_0x58a416+_0xd446('0x27'))[_0xd446('0x12')](_0xf0dcf5,null,_0xf0dcf5+'.id\x20=\x20'+_0x58a416+'.'+_0x28cc67)['where'](_0x58a416+_0xd446('0x28'),_0x4d4176)['where'](_0xd446('0x29'),NOW)[_0xd446('0x14')](_0xd446('0x2a'),selectNotIn(_0x58a416,_0xf0dcf5,_0x28cc67,_0xd446('0x1e'),['\x22always\x22',_0xd446('0x2b')]))[_0xd446('0x14')](_0xd446('0x2a'),selectNotIn(_0x58a416,_0xf0dcf5,_0x28cc67,_0xd446('0x1e'),[_0xd446('0x2c')])))[_0xd446('0x2d')]();}function insertCmHopperBlack(_0x56b82f,_0x123f69,_0x7c1a2e,_0x2b6b0f){var _0x4f2141=[_0xd446('0x15'),_0xd446('0x17'),_0xd446('0x18'),_0x123f69+'.'+_0x2b6b0f,'cm_contacts.createdAt',_0xd446('0x2e')];return squel[_0xd446('0x1c')]()[_0xd446('0x1d')](_0xd446('0x2f'))['fromQuery'](['phone',_0xd446('0x20'),_0xd446('0x30'),_0x2b6b0f,_0xd446('0x21'),_0xd446('0x22')],squel[_0xd446('0xe')]()[_0xd446('0x25')](_0x4f2141)[_0xd446('0x11')](_0x123f69)[_0xd446('0x12')](_0xd446('0x31'),null,_0xd446('0x26')+_0x123f69+'.CmListId')[_0xd446('0x12')](_0x7c1a2e,null,_0x7c1a2e+'.id\x20=\x20'+_0x123f69+'.'+_0x2b6b0f)[_0xd446('0x14')](_0x123f69+_0xd446('0x28'),_0x56b82f)[_0xd446('0x14')](_0xd446('0x29'),NOW)[_0xd446('0x14')](_0xd446('0x2a'),squel[_0xd446('0xe')]()[_0xd446('0xf')]('phone')[_0xd446('0x11')](_0xd446('0x2f'))[_0xd446('0x14')](_0xd446('0x32'),_0x56b82f)[_0xd446('0x14')](_0x2b6b0f+_0xd446('0x33'),_0x123f69+'.'+_0x2b6b0f)))[_0xd446('0x2d')]();}function insertTzCmHopper(_0x212802,_0x20f3d4,_0x289631,_0x2e535a,_0x56891a,_0x1d9b1d){var _0x1588d0=['cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20'+_0x1d9b1d+'.offset-cm_contacts.utcOffset\x20minute)',_0xd446('0x17'),'cm_contacts.ListId',_0x20f3d4+'.'+_0x2e535a,_0xd446('0x19'),_0xd446('0x2e'),_0xd446('0x1a'),_0xd446('0x1b'),'\x22'+_0x56891a+'\x22'];var _0x1ec7d5=squel[_0xd446('0x1c')]()[_0xd446('0x1d')](_0xd446('0x1e'))[_0xd446('0x1f')](['phone',_0xd446('0x34'),_0xd446('0x20'),_0xd446('0x30'),_0x2e535a,_0xd446('0x21'),_0xd446('0x22'),_0xd446('0x23'),_0xd446('0x24'),'recallme'],squel[_0xd446('0xe')]()['fields'](_0x1588d0)[_0xd446('0x11')](_0x20f3d4)[_0xd446('0x12')](_0xd446('0x31'),null,_0xd446('0x26')+_0x20f3d4+_0xd446('0x27'))['join'](_0x289631,null,_0x289631+_0xd446('0x13')+_0x20f3d4+'.'+_0x2e535a)[_0xd446('0x12')](_0x1d9b1d,null,_0x1d9b1d+_0xd446('0x13')+_0x20f3d4+'.'+_0x2e535a)[_0xd446('0x14')](_0x20f3d4+_0xd446('0x28'),_0x212802)[_0xd446('0x14')](_0xd446('0x29'),NOW)[_0xd446('0x14')](_0xd446('0x2a'),selectNotIn(_0x20f3d4,_0x289631,_0x2e535a,'cm_hopper',['\x22always\x22',_0xd446('0x2b')]))[_0xd446('0x14')](_0xd446('0x2a'),selectNotIn(_0x20f3d4,_0x289631,_0x2e535a,_0xd446('0x1e'),[_0xd446('0x2c')])))[_0xd446('0x2d')]();return _0x1ec7d5;}function insertTzCmHopperBlack(_0x3c5ec6,_0x57e88f,_0x82a7ec,_0x377f86){var _0x487a86=[_0xd446('0x15'),_0xd446('0x17'),_0xd446('0x18'),_0x57e88f+'.'+_0x377f86,_0xd446('0x19'),_0xd446('0x2e')];return squel[_0xd446('0x1c')]()['into']('cm_hopper_black')[_0xd446('0x1f')]([_0xd446('0x10'),_0xd446('0x20'),_0xd446('0x30'),_0x377f86,_0xd446('0x21'),_0xd446('0x22')],squel['select']()[_0xd446('0x25')](_0x487a86)['from'](_0x57e88f)['join'](_0xd446('0x31'),null,'cm_contacts.ListId\x20=\x20'+_0x57e88f+'.CmListId')[_0xd446('0x12')](_0x82a7ec,null,_0x82a7ec+_0xd446('0x13')+_0x57e88f+'.'+_0x377f86)['where'](_0x57e88f+_0xd446('0x28'),_0x3c5ec6)[_0xd446('0x14')](_0xd446('0x29'),NOW)[_0xd446('0x14')](_0xd446('0x2a'),squel[_0xd446('0xe')]()[_0xd446('0xf')](_0xd446('0x10'))[_0xd446('0x11')](_0xd446('0x2f'))[_0xd446('0x14')](_0xd446('0x32'),_0x3c5ec6)[_0xd446('0x14')](_0x377f86+'\x20=\x20?',_0x57e88f+'.'+_0x377f86)))[_0xd446('0x2d')]();}function insertCmContact(_0x1f1ec0,_0x5e6f3a,_0x2a3f9b,_0xdf51da){var _0x5a7e62=_[_0xd446('0x35')](_[_0xd446('0x36')](_0xdf51da),[_0xd446('0x30'),_0xd446('0x37'),'createdAt',_0xd446('0x22')]);return squel[_0xd446('0x1c')]()[_0xd446('0x1d')]('cm_contacts')[_0xd446('0x1f')](_0x5a7e62,squel['select']()[_0xd446('0x25')](_0x5a7e62)[_0xd446('0x11')](_0x5e6f3a)[_0xd446('0x14')]('('+_0x2a3f9b['join'](',')+_0xd446('0x38'),squel['select']()['fields'](_0x2a3f9b)[_0xd446('0x11')]('cm_contacts')[_0xd446('0x14')](_0xd446('0x32'),_0x1f1ec0)['where'](_0xd446('0x39')))[_0xd446('0x14')](_0xd446('0x3a'),squel[_0xd446('0xe')]()[_0xd446('0xf')]('MIN(id)',_0xd446('0x3b'))[_0xd446('0x11')](_0x5e6f3a)[_0xd446('0x3c')](_0x2a3f9b[_0xd446('0x12')](','))))[_0xd446('0x2d')]();}function handleStop(){logger[_0xd446('0x3d')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3f0214){logger[_0xd446('0x3e')](_0x3f0214[_0xd446('0x3f')]);process['exit'](0x1);}function handleError(_0x35e416,_0x432e47){stats[_0xd446('0x40')][_0xd446('0x41')]({'name':_0x432e47['code'],'message':_0x432e47['message'],'row':_0x35e416});}function handleQuery(_0x5ed5ef){logger[_0xd446('0x3d')](_0x5ed5ef);return db[_0xd446('0x42')][_0xd446('0x43')](_0x5ed5ef)[_0xd446('0x44')](function(_0x187efe){results['push'](_0x187efe);})['catch'](function(_0x113f83){logger['error'](_0x113f83['message']);});}function updateTzCampaigns(_0x1b6fb3){return new Promise(function(_0x1d4143,_0x123578){var _0x440cfd=squel['select']()[_0xd446('0x25')]([_0xd446('0x45'),_0xd446('0x46')])[_0xd446('0x11')]('campaigns')[_0xd446('0x12')](_0xd446('0x47'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0xd446('0x14')]('campaigns_has_cm_lists.CmListId='+_0x1b6fb3);db['sequelize'][_0xd446('0x43')](_0x440cfd[_0xd446('0x2d')]())[_0xd446('0x44')](function(_0x6726b7){var _0x3f87d5=[];for(var _0x17e128=0x0;_0x17e128<_0x6726b7[_0xd446('0x48')];_0x17e128++){_0x3f87d5[_0xd446('0x41')](getTimezoneData(_0x6726b7[_0x17e128],tmp_campaigns));}BPromise[_0xd446('0x49')](_0x3f87d5)['then'](function(){_0x1d4143({'val':0x1});});})[_0xd446('0x4a')](function(_0x305d7){logger['error'](_0x305d7['message']);_0x1d4143({'val':0x0});});});}function updateTzVoiceQueues(_0x5ce82e){return new Promise(function(_0x3e5838,_0x289c83){var _0x406e37=squel[_0xd446('0xe')]()[_0xd446('0x25')]([_0xd446('0x4b'),'voice_queues.dialTimezone'])['from']('voice_queues')['join'](_0xd446('0x4c'),null,_0xd446('0x4d'))[_0xd446('0x14')]('voice_queues_has_cm_lists.CmListId='+_0x5ce82e);db[_0xd446('0x42')][_0xd446('0x43')](_0x406e37[_0xd446('0x2d')]())[_0xd446('0x44')](function(_0x13b3de){var _0x1832f8=[];for(var _0x2af911=0x0;_0x2af911<_0x13b3de[_0xd446('0x48')];_0x2af911++){_0x1832f8[_0xd446('0x41')](getTimezoneData(_0x13b3de[_0x2af911],tmp_voice_queues));}BPromise['all'](_0x1832f8)[_0xd446('0x4e')](function(){_0x3e5838({'val':0x1});});})[_0xd446('0x4a')](function(_0x20207e){logger[_0xd446('0x3e')](_0x20207e[_0xd446('0x3f')]);_0x3e5838({'val':0x0});});});}function getTimezoneData(_0xdeecb8,_0x462b82){return new Promise(function(_0x3a592f,_0x5dfe2c){var _0x544938=shared[_0xd446('0x4f')];var _0x379187=_0x544938[_0xdeecb8['dialTimezone']];if(_[_0xd446('0x50')](_0x379187)){_0x3a592f({'ret':0x1});}else{var _0x171dee=_0x379187[_0xd446('0x51')];var _0x308b61=squel[_0xd446('0x1c')]()[_0xd446('0x1d')](_0x462b82)[_0xd446('0x52')]('id',_0xdeecb8['id'])[_0xd446('0x52')](_0xd446('0x53'),_0x171dee)[_0xd446('0x52')](_0xd446('0x54'),_0xdeecb8['dialTimezone'])[_0xd446('0x2d')]();return db[_0xd446('0x42')][_0xd446('0x43')](_0x308b61)['spread'](function(_0x2f217b){_0x3a592f({'ret':0x1});})[_0xd446('0x4a')](function(_0x1ab543){logger['error'](_0x1ab543[_0xd446('0x3f')]);_0x5dfe2c({'ret':0x1});});}});}function handleTZQuery(_0x2f9cae){logger['info'](_0x2f9cae);return db[_0xd446('0x42')]['query'](_0x2f9cae)['spread'](function(_0x396e39){})[_0xd446('0x4a')](function(_0x395b84){logger[_0xd446('0x3e')](_0x395b84[_0xd446('0x3f')]);});}function main(_0x1a4d5b,_0x1c23c1,_0x5da424,_0x1524d0){logger['info'](_0xd446('0x55'),_0x1a4d5b,JSON[_0xd446('0x56')](_0x1c23c1));process[_0xd446('0x57')](_0xd446('0x58'));var _0x8fc83d=_0x1c23c1[_0xd446('0x59')];var _0x56628c=_0x1c23c1[_0xd446('0x5a')];var _0x5b82b5=path['join'](config[_0xd446('0x5b')],'server/files/tmp',_0x56628c+_0xd446('0x5c'));hasTZ=_[_0xd446('0x36')](_0x8fc83d)[_0xd446('0x5d')]('dialTimezone');var _0x84302e=_[_0xd446('0x36')](_0x8fc83d)[_0xd446('0x12')]();logger[_0xd446('0x3d')](_0xd446('0x5e'),_0x84302e);if(hasTZ)_0x84302e+=',utcOffset';fs[_0xd446('0x5f')](_0x5b82b5,_0x84302e+'\x0a');Papa['parse'](fs[_0xd446('0x60')](_0x1a4d5b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3ef755,_0x2fc1ac){try{for(var _0x4245a9=0x0,_0x48e6e6=[];_0x4245a9<_0x3ef755[_0xd446('0x61')][_0xd446('0x48')];_0x4245a9++){stats[_0xd446('0x62')]+=0x1;if(_0x3ef755[_0xd446('0x40')][_0x4245a9]){handleError(_0x3ef755[_0xd446('0x61')][_0x4245a9],_0x3ef755['errors'][_0x4245a9]);}else{var _0x4cfa3c=[];for(var _0x3fa401 in _0x8fc83d){if(_0x8fc83d[_0xd446('0x63')](_0x3fa401)){if(_0x3ef755['data'][_0x4245a9][_0x8fc83d[_0x3fa401]]){var _0x91347c=_[_0xd446('0x64')](_0x3ef755[_0xd446('0x61')][_0x4245a9][_0x8fc83d[_0x3fa401]]['replace'](/"/g,'\x27'));switch(_0x3fa401){case _0xd446('0x34'):var _0x1b6184=moment(_0x91347c,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x1b6184[_0xd446('0x65')]()){_0x48e6e6[_0xd446('0x41')]('\x22'+_0x91347c+'\x22');}else{_0x4cfa3c[_0xd446('0x41')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x4fd92f=parseInt(_0x91347c);_0x91347c=_[_0xd446('0x66')](_0x4fd92f)||_0x4fd92f<0x0||_0x4fd92f>0x4?_0x1524d0?0x3:0x2:_0x4fd92f;_0x48e6e6[_0xd446('0x41')]('\x22'+_0x91347c+'\x22');break;case _0xd446('0x24'):var _0x3abec3=parseInt(_0x91347c);if(_[_0xd446('0x67')](_0x3abec3)&&_[_0xd446('0x5d')](_0x5da424,_0x3abec3)){_0x48e6e6[_0xd446('0x41')]('\x22'+_0x3abec3+'\x22');}else{_0x4cfa3c[_0xd446('0x41')](_0xd446('0x68'));}break;case _0xd446('0x69'):if(isEmail(_0x91347c)){_0x48e6e6[_0xd446('0x41')]('\x22'+_0x91347c+'\x22');}else{_0x4cfa3c['push'](_0xd446('0x6a'));}break;case'dateOfBirth':var _0x6c9fe1=moment(_0x91347c,_0xd446('0x6b'),!![]);if(_0x6c9fe1[_0xd446('0x65')]()){_0x48e6e6[_0xd446('0x41')]('\x22'+_0x91347c+'\x22');}else{_0x4cfa3c[_0xd446('0x41')](_0xd446('0x6c'));}break;case _0xd446('0x54'):var _0x3c7e46=shared[_0xd446('0x4f')];var _0x2c0a3f=_0x3c7e46[_0x91347c];if(!_[_0xd446('0x50')](_0x2c0a3f)){var _0x2212c5=_0x2c0a3f[_0xd446('0x51')];_0x48e6e6[_0xd446('0x41')]('\x22'+_0x91347c+'\x22');_0x48e6e6[_0xd446('0x41')]('\x22'+_0x2212c5+'\x22');}break;default:_0x48e6e6[_0xd446('0x41')]('\x22'+_0x91347c+'\x22');}}else{switch(_0x3fa401){case'firstName':case _0xd446('0x10'):_0x4cfa3c[_0xd446('0x41')](_0x3fa401+_0xd446('0x6d'));break;default:_0x48e6e6[_0xd446('0x41')]('\x22\x22');}}}}if(_0x4cfa3c['length']){handleError(_0x3ef755[_0xd446('0x61')][_0x4245a9],{'code':_0xd446('0x6e'),'message':_0x4cfa3c[_0xd446('0x12')]()});}else{fs[_0xd446('0x6f')](_0x5b82b5,_0x48e6e6[_0xd446('0x12')]()+'\x0a');}_0x48e6e6=[];}if(!(stats[_0xd446('0x62')]%0xc8)){socket[_0xd446('0x70')](_0xd446('0x71')+_0x56628c,stats);stats[_0xd446('0x40')]=[];}}if(stopped){logger[_0xd446('0x3d')]('Abort\x20parser');_0x2fc1ac[_0xd446('0x72')]();}}catch(_0xb7a1d8){handleError(_0x3ef755[_0xd446('0x61')][_0x4245a9],{'code':_0xd446('0x73'),'message':_0xb7a1d8[_0xd446('0x3f')]});logger[_0xd446('0x3e')](_0xd446('0x74'),_0xb7a1d8[_0xd446('0x3f')]);}},'complete':function(){try{var _0x222bfd=[];var _0xced52a=[];var _0x17156c=_0xd446('0x31');if(_0x1c23c1[_0xd446('0x75')]&&_0x1c23c1[_0xd446('0x75')][_0xd446('0x48')]){_0x17156c=_0xd446('0x76')+_0x56628c;_0x222bfd[_0xd446('0x41')](_0xd446('0x77')+_0x17156c+_0xd446('0x78'));}tmp_campaigns=_0xd446('0x79')+_0x56628c;tmp_voice_queues=_0xd446('0x7a')+_0x56628c;_0xced52a['push'](_0xd446('0x77')+tmp_campaigns+_0xd446('0x7b'));_0xced52a[_0xd446('0x41')](_0xd446('0x77')+tmp_voice_queues+_0xd446('0x7b'));BPromise[_0xd446('0x7c')](_0xced52a,handleTZQuery)['then'](function(_0x328ab5){updateTzCampaigns(_0x1c23c1[_0xd446('0x30')])[_0xd446('0x4e')](function(_0x42ecf3){updateTzVoiceQueues(_0x1c23c1[_0xd446('0x30')])[_0xd446('0x4e')](function(_0x1c9bee){var _0x568d05=util['format'](_0xd446('0x7d'),_0x5b82b5,_0x17156c,_0x84302e,_0x1c23c1[_0xd446('0x30')],_0x1c23c1[_0xd446('0x37')]||null,NOW,NOW);if(_[_0xd446('0x50')](_0x8fc83d[_0xd446('0x34')])){_0x568d05+=_0xd446('0x7e');}_0x222bfd[_0xd446('0x41')](_0x568d05);if(_0x1c23c1['duplicates']&&_0x1c23c1[_0xd446('0x75')][_0xd446('0x48')]){_0x222bfd[_0xd446('0x41')](insertCmContact(_0x1c23c1[_0xd446('0x30')],_0x17156c,_0x1c23c1[_0xd446('0x75')],_0x8fc83d));_0x222bfd[_0xd446('0x41')](_0xd446('0x7f')+_0x17156c+';');}if(hasTZ){_0x222bfd[_0xd446('0x41')](insertTzCmHopper(_0x1c23c1[_0xd446('0x30')],_0xd446('0x4c'),'voice_queues',_0xd446('0x80'),_0x1524d0,tmp_voice_queues));_0x222bfd[_0xd446('0x41')](insertTzCmHopperBlack(_0x1c23c1[_0xd446('0x30')],_0xd446('0x81'),_0xd446('0x82'),'VoiceQueueId'));_0x222bfd[_0xd446('0x41')](insertTzCmHopper(_0x1c23c1[_0xd446('0x30')],_0xd446('0x47'),_0xd446('0x83'),_0xd446('0x84'),_0x1524d0,tmp_campaigns));_0x222bfd[_0xd446('0x41')](insertTzCmHopperBlack(_0x1c23c1['ListId'],_0xd446('0x85'),'campaigns','CampaignId'));}else{_0x222bfd[_0xd446('0x41')](insertCmHopper(_0x1c23c1['ListId'],'voice_queues_has_cm_lists',_0xd446('0x82'),'VoiceQueueId',_0x1524d0));_0x222bfd[_0xd446('0x41')](insertCmHopperBlack(_0x1c23c1[_0xd446('0x30')],'voice_queues_has_cm_blacklists','voice_queues',_0xd446('0x80')));_0x222bfd[_0xd446('0x41')](insertCmHopper(_0x1c23c1[_0xd446('0x30')],_0xd446('0x47'),'campaigns',_0xd446('0x84'),_0x1524d0));_0x222bfd['push'](insertCmHopperBlack(_0x1c23c1['ListId'],'campaigns_has_cm_blacklists','campaigns',_0xd446('0x84')));}_0x222bfd[_0xd446('0x41')](_0xd446('0x7f')+tmp_campaigns+';');_0x222bfd[_0xd446('0x41')](_0xd446('0x7f')+tmp_voice_queues+';');BPromise['each'](_0x222bfd,handleQuery)['then'](function(_0x311750){stats[_0xd446('0x86')]=!![];stats['affectedRows']=_0x1c23c1[_0xd446('0x75')]&&_0x1c23c1[_0xd446('0x75')][_0xd446('0x48')]?results[0x2]['affectedRows']:results[0x0][_0xd446('0x87')];socket[_0xd446('0x70')]('contact:import:'+_0x56628c,stats);fs[_0xd446('0x88')](_0x1a4d5b);fs[_0xd446('0x88')](_0x5b82b5);process[_0xd446('0x89')](0x0);})[_0xd446('0x4a')](function(_0x18c9dc){logger[_0xd446('0x3e')](_0x18c9dc[_0xd446('0x3f')]);process['exit'](0x1);});});});});}catch(_0x26d840){logger[_0xd446('0x3e')](_0xd446('0x8a'),_0x26d840[_0xd446('0x3f')]);process['exit'](0x1);}},'error':function(_0x393212,_0x4f60bd,_0x2c6792,_0x3cb0e3){throw new Error(_0x3cb0e3);}});}function validate(){if(process[_0xd446('0x8b')]&&process[_0xd446('0x8b')][_0xd446('0x48')]<0x4){throw new Error(_0xd446('0x8c'));}var _0x49f29a=path[_0xd446('0x12')](config[_0xd446('0x5b')],_0xd446('0x8d'),process['argv'][0x2]);if(!fs[_0xd446('0x8e')](_0x49f29a)){throw new Error(_0xd446('0x8f'));}var _0x3f84b0={};try{_0x3f84b0=JSON[_0xd446('0x90')](process[_0xd446('0x8b')][0x3]);if(!_0x3f84b0[_0xd446('0x59')]){throw new Error(_0xd446('0x91'));}if(!_0x3f84b0['binding'][_0xd446('0x10')]){throw new Error(_0xd446('0x92'));}if(!_0x3f84b0[_0xd446('0x59')][_0xd446('0x93')]){throw new Error(_0xd446('0x94'));}var _0x170424=0x0;if(_0x3f84b0[_0xd446('0x59')][_0xd446('0x24')]){_0x170424=0x1;}if(!_0x3f84b0['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x4d6a12){throw new Error(_0xd446('0x95'));}var _0x1811ba=[];try{_0x1811ba=_[_0xd446('0x96')](JSON[_0xd446('0x90')](process[_0xd446('0x8b')][0x4]),'id');}catch(_0x4aafc4){logger[_0xd446('0x3d')](_0xd446('0x97'));}main(_0x49f29a,_0x3f84b0,_0x1811ba,_0x170424);}validate();process['on'](_0xd446('0x98'),handleStop);process['on'](_0xd446('0x99'),handleUncaughtException); \ No newline at end of file +var _0x7349=['moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','defaults','redis','format','test','select','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','into','from','.CmListId\x20=\x20?','field','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id','cm_contacts.priority','UserId','\x22always\x22','cm_contacts.phone','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','error','message','errors','push','sequelize','query','catch','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','all','then','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','length','dialTimezone','isNil','utcOffset','set','offset','spread','main','send','start','binding','socket_timestamp','root','server/files/tmp','includes','header',',utcOffset','createReadStream','data','rows','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','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',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','emit','unlink','exit','complete','argv','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird'];(function(_0x19b442,_0x283cfa){var _0x57f830=function(_0x54e0bf){while(--_0x54e0bf){_0x19b442['push'](_0x19b442['shift']());}};_0x57f830(++_0x283cfa);}(_0x7349,0x1d6));var _0x9734=function(_0x34e976,_0x55ef2d){_0x34e976=_0x34e976-0x0;var _0x3e11b4=_0x7349[_0x34e976];return _0x3e11b4;};'use strict';var fs=require('fs');var path=require(_0x9734('0x0'));var _=require(_0x9734('0x1'));var Papa=require(_0x9734('0x2'));var util=require('util');var BPromise=require(_0x9734('0x3'));var moment=require(_0x9734('0x4'));var squel=require(_0x9734('0x5'));var Redis=require(_0x9734('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x9734('0x7'));var shared=require(_0x9734('0x8'));var logger=require(_0x9734('0x9'))(_0x9734('0xa'));config['redis']=_[_0x9734('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9734('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()[_0x9734('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x2dca66){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))*$/[_0x9734('0xe')](_0x2dca66);}function selectNotIn(_0x269245,_0x1903ea,_0x53700f,_0x28aead,_0x2f6424){return squel[_0x9734('0xf')]()['field']('phone')['from'](_0x28aead)[_0x9734('0x10')](_0x1903ea,null,_0x1903ea+_0x9734('0x11')+_0x28aead+'.'+_0x53700f)['where'](_0x28aead+'.'+_0x53700f+_0x9734('0x12')+_0x269245+'.'+_0x53700f)[_0x9734('0x13')](_0x1903ea+_0x9734('0x14')+_0x2f6424[_0x9734('0x10')]()+')');}function insertCmHopper(_0x40d0c4,_0x37f7cb,_0x2089bf,_0x1ab60b,_0x59b90e){var _0x563135=['cm_contacts.phone',_0x9734('0x15'),'cm_contacts.id',_0x9734('0x16'),_0x37f7cb+'.'+_0x1ab60b,_0x9734('0x17'),_0x9734('0x18'),'cm_contacts.priority',_0x9734('0x19'),'\x22'+_0x59b90e+'\x22'];return squel[_0x9734('0x1a')]()['into'](_0x9734('0x1b'))[_0x9734('0x1c')]([_0x9734('0x1d'),_0x9734('0x1e'),_0x9734('0x1f'),_0x9734('0x20'),_0x1ab60b,_0x9734('0x21'),_0x9734('0x22'),_0x9734('0x23'),'UserId','recallme'],squel[_0x9734('0xf')]()[_0x9734('0x24')](_0x563135)['from'](_0x37f7cb)[_0x9734('0x10')](_0x9734('0x25'),null,_0x9734('0x26')+_0x37f7cb+_0x9734('0x27'))[_0x9734('0x10')](_0x2089bf,null,_0x2089bf+_0x9734('0x11')+_0x37f7cb+'.'+_0x1ab60b)['where'](_0x37f7cb+'.CmListId\x20=\x20?',_0x40d0c4)[_0x9734('0x13')](_0x9734('0x28'),NOW)[_0x9734('0x13')](_0x9734('0x29'),selectNotIn(_0x37f7cb,_0x2089bf,_0x1ab60b,_0x9734('0x1b'),['\x22always\x22',_0x9734('0x2a')]))[_0x9734('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x37f7cb,_0x2089bf,_0x1ab60b,_0x9734('0x1b'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x407678,_0xff2f82,_0x5eae5d,_0x1e9085){var _0x4b5e39=['cm_contacts.phone','cm_contacts.id',_0x9734('0x16'),_0xff2f82+'.'+_0x1e9085,_0x9734('0x17'),_0x9734('0x18')];return squel[_0x9734('0x1a')]()[_0x9734('0x2b')]('cm_hopper_black')[_0x9734('0x1c')]([_0x9734('0x1d'),'ContactId',_0x9734('0x20'),_0x1e9085,'createdAt',_0x9734('0x22')],squel['select']()['fields'](_0x4b5e39)[_0x9734('0x2c')](_0xff2f82)[_0x9734('0x10')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0xff2f82+_0x9734('0x27'))[_0x9734('0x10')](_0x5eae5d,null,_0x5eae5d+_0x9734('0x11')+_0xff2f82+'.'+_0x1e9085)[_0x9734('0x13')](_0xff2f82+_0x9734('0x2d'),_0x407678)[_0x9734('0x13')](_0x9734('0x28'),NOW)[_0x9734('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x9734('0x2e')](_0x9734('0x1d'))[_0x9734('0x2c')](_0x9734('0x2f'))[_0x9734('0x13')](_0x9734('0x30'),_0x407678)[_0x9734('0x13')](_0x1e9085+_0x9734('0x31'),_0xff2f82+'.'+_0x1e9085)))[_0x9734('0x32')]();}function insertTzCmHopper(_0x59aa37,_0x375a45,_0x29d5f1,_0x2b36d8,_0x300989,_0x53fe0f){var _0x1d5184=['cm_contacts.phone',_0x9734('0x33')+_0x53fe0f+_0x9734('0x34'),_0x9734('0x35'),_0x9734('0x16'),_0x375a45+'.'+_0x2b36d8,_0x9734('0x17'),_0x9734('0x18'),_0x9734('0x36'),'cm_contacts.UserId','\x22'+_0x300989+'\x22'];var _0x1059b6=squel['insert']()[_0x9734('0x2b')](_0x9734('0x1b'))[_0x9734('0x1c')](['phone','scheduledat',_0x9734('0x1f'),_0x9734('0x20'),_0x2b36d8,_0x9734('0x21'),_0x9734('0x22'),_0x9734('0x23'),_0x9734('0x37'),'recallme'],squel[_0x9734('0xf')]()[_0x9734('0x24')](_0x1d5184)[_0x9734('0x2c')](_0x375a45)[_0x9734('0x10')]('cm_contacts',null,_0x9734('0x26')+_0x375a45+_0x9734('0x27'))['join'](_0x29d5f1,null,_0x29d5f1+_0x9734('0x11')+_0x375a45+'.'+_0x2b36d8)['join'](_0x53fe0f,null,_0x53fe0f+'.id\x20=\x20'+_0x375a45+'.'+_0x2b36d8)[_0x9734('0x13')](_0x375a45+_0x9734('0x2d'),_0x59aa37)['where'](_0x9734('0x28'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x375a45,_0x29d5f1,_0x2b36d8,_0x9734('0x1b'),[_0x9734('0x38'),_0x9734('0x2a')]))[_0x9734('0x13')](_0x9734('0x29'),selectNotIn(_0x375a45,_0x29d5f1,_0x2b36d8,'cm_hopper',[_0x9734('0x38')])))[_0x9734('0x32')]();return _0x1059b6;}function insertTzCmHopperBlack(_0x4f3285,_0x28235b,_0x419d80,_0x7e8217){var _0x30d59f=[_0x9734('0x39'),_0x9734('0x35'),'cm_contacts.ListId',_0x28235b+'.'+_0x7e8217,_0x9734('0x17'),_0x9734('0x18')];return squel[_0x9734('0x1a')]()[_0x9734('0x2b')](_0x9734('0x2f'))[_0x9734('0x1c')]([_0x9734('0x1d'),_0x9734('0x1f'),_0x9734('0x20'),_0x7e8217,_0x9734('0x21'),_0x9734('0x22')],squel[_0x9734('0xf')]()['fields'](_0x30d59f)[_0x9734('0x2c')](_0x28235b)[_0x9734('0x10')](_0x9734('0x25'),null,_0x9734('0x26')+_0x28235b+'.CmListId')[_0x9734('0x10')](_0x419d80,null,_0x419d80+_0x9734('0x11')+_0x28235b+'.'+_0x7e8217)[_0x9734('0x13')](_0x28235b+'.CmListId\x20=\x20?',_0x4f3285)['where'](_0x9734('0x28'),NOW)[_0x9734('0x13')](_0x9734('0x29'),squel[_0x9734('0xf')]()[_0x9734('0x2e')]('phone')['from'](_0x9734('0x2f'))[_0x9734('0x13')](_0x9734('0x30'),_0x4f3285)[_0x9734('0x13')](_0x7e8217+_0x9734('0x31'),_0x28235b+'.'+_0x7e8217)))['toString']();}function insertCmContact(_0x1a6bd4,_0x45845b,_0x2632cc,_0x22d23a){var _0x515cbe=_[_0x9734('0x3a')](_[_0x9734('0x3b')](_0x22d23a),[_0x9734('0x20'),_0x9734('0x3c'),_0x9734('0x21'),'updatedAt']);return squel[_0x9734('0x1a')]()[_0x9734('0x2b')](_0x9734('0x25'))[_0x9734('0x1c')](_0x515cbe,squel[_0x9734('0xf')]()['fields'](_0x515cbe)[_0x9734('0x2c')](_0x45845b)[_0x9734('0x13')]('('+_0x2632cc[_0x9734('0x10')](',')+_0x9734('0x3d'),squel[_0x9734('0xf')]()[_0x9734('0x24')](_0x2632cc)[_0x9734('0x2c')](_0x9734('0x25'))['where']('ListId\x20=\x20?',_0x1a6bd4)['where'](_0x9734('0x3e')))[_0x9734('0x13')](_0x9734('0x3f'),squel[_0x9734('0xf')]()['field'](_0x9734('0x40'),_0x9734('0x41'))[_0x9734('0x2c')](_0x45845b)['group'](_0x2632cc['join'](','))))[_0x9734('0x32')]();}function handleStop(){logger[_0x9734('0x42')](_0x9734('0x43'));stopped=!![];}function handleUncaughtException(_0xeb665b){logger[_0x9734('0x44')](_0xeb665b[_0x9734('0x45')]);process['exit'](0x1);}function handleError(_0x3438ed,_0x5e6271){stats[_0x9734('0x46')][_0x9734('0x47')]({'name':_0x5e6271['code'],'message':_0x5e6271[_0x9734('0x45')],'row':_0x3438ed});}function handleQuery(_0x4c30d0){logger[_0x9734('0x42')](_0x4c30d0);return db[_0x9734('0x48')][_0x9734('0x49')](_0x4c30d0)['spread'](function(_0x5b882c){results[_0x9734('0x47')](_0x5b882c);})[_0x9734('0x4a')](function(_0x3b566e){logger[_0x9734('0x44')](_0x3b566e[_0x9734('0x45')]);});}function updateTzCampaigns(_0x13cc3d){return new Promise(function(_0x44c6a0,_0x239fc7){var _0x27ca34=squel['select']()[_0x9734('0x24')]([_0x9734('0x4b'),'campaigns.dialTimezone'])[_0x9734('0x2c')](_0x9734('0x4c'))[_0x9734('0x10')](_0x9734('0x4d'),null,_0x9734('0x4e'))[_0x9734('0x13')](_0x9734('0x4f')+_0x13cc3d);db[_0x9734('0x48')][_0x9734('0x49')](_0x27ca34[_0x9734('0x32')]())['spread'](function(_0x111bc2){var _0x49c244=[];for(var _0x1831e4=0x0;_0x1831e4<_0x111bc2['length'];_0x1831e4++){_0x49c244[_0x9734('0x47')](getTimezoneData(_0x111bc2[_0x1831e4],tmp_campaigns));}BPromise[_0x9734('0x50')](_0x49c244)[_0x9734('0x51')](function(){_0x44c6a0({'val':0x1});});})['catch'](function(_0x3edfaa){logger['error'](_0x3edfaa[_0x9734('0x45')]);_0x44c6a0({'val':0x0});});});}function updateTzVoiceQueues(_0x19d602){return new Promise(function(_0x53d678,_0x782c10){var _0x22b7d1=squel[_0x9734('0xf')]()['fields']([_0x9734('0x52'),'voice_queues.dialTimezone'])[_0x9734('0x2c')](_0x9734('0x53'))[_0x9734('0x10')](_0x9734('0x54'),null,_0x9734('0x55'))[_0x9734('0x13')](_0x9734('0x56')+_0x19d602);db[_0x9734('0x48')][_0x9734('0x49')](_0x22b7d1[_0x9734('0x32')]())['spread'](function(_0x311301){var _0x5dd01d=[];for(var _0x30c2ef=0x0;_0x30c2ef<_0x311301[_0x9734('0x57')];_0x30c2ef++){_0x5dd01d[_0x9734('0x47')](getTimezoneData(_0x311301[_0x30c2ef],tmp_voice_queues));}BPromise[_0x9734('0x50')](_0x5dd01d)[_0x9734('0x51')](function(){_0x53d678({'val':0x1});});})[_0x9734('0x4a')](function(_0x102f66){logger[_0x9734('0x44')](_0x102f66[_0x9734('0x45')]);_0x53d678({'val':0x0});});});}function getTimezoneData(_0x4370a8,_0x2a663d){return new Promise(function(_0x2510a0,_0x29f19c){var _0xb7ff99=shared['timezones'];var _0x5375fc=_0xb7ff99[_0x4370a8[_0x9734('0x58')]];if(_[_0x9734('0x59')](_0x5375fc)){_0x2510a0({'ret':0x1});}else{var _0x162282=_0x5375fc[_0x9734('0x5a')];var _0x281383=squel[_0x9734('0x1a')]()[_0x9734('0x2b')](_0x2a663d)[_0x9734('0x5b')]('id',_0x4370a8['id'])['set'](_0x9734('0x5c'),_0x162282)[_0x9734('0x5b')](_0x9734('0x58'),_0x4370a8['dialTimezone'])[_0x9734('0x32')]();return db[_0x9734('0x48')]['query'](_0x281383)[_0x9734('0x5d')](function(_0x4279a0){_0x2510a0({'ret':0x1});})[_0x9734('0x4a')](function(_0x25165c){logger[_0x9734('0x44')](_0x25165c[_0x9734('0x45')]);_0x29f19c({'ret':0x1});});}});}function handleTZQuery(_0xfc8c9d){logger[_0x9734('0x42')](_0xfc8c9d);return db[_0x9734('0x48')]['query'](_0xfc8c9d)[_0x9734('0x5d')](function(_0x555045){})[_0x9734('0x4a')](function(_0x1881b6){logger[_0x9734('0x44')](_0x1881b6[_0x9734('0x45')]);});}function main(_0x22c3ed,_0x33ab2a,_0x14e1d5,_0x36602e){logger[_0x9734('0x42')](_0x9734('0x5e'),_0x22c3ed,JSON['stringify'](_0x33ab2a));process[_0x9734('0x5f')](_0x9734('0x60'));var _0x41df82=_0x33ab2a[_0x9734('0x61')];var _0x195857=_0x33ab2a[_0x9734('0x62')];var _0x34ab98=path[_0x9734('0x10')](config[_0x9734('0x63')],_0x9734('0x64'),_0x195857+'.csv');hasTZ=_[_0x9734('0x3b')](_0x41df82)[_0x9734('0x65')](_0x9734('0x58'));var _0xef3172=_[_0x9734('0x3b')](_0x41df82)[_0x9734('0x10')]();logger[_0x9734('0x42')](_0x9734('0x66'),_0xef3172);if(hasTZ)_0xef3172+=_0x9734('0x67');fs['writeFileSync'](_0x34ab98,_0xef3172+'\x0a');Papa['parse'](fs[_0x9734('0x68')](_0x22c3ed),{'header':!![],'skipEmptyLines':!![],'step':function(_0x43519d,_0x41e4a1){try{for(var _0x2d1c64=0x0,_0x3b7472=[];_0x2d1c64<_0x43519d[_0x9734('0x69')]['length'];_0x2d1c64++){stats[_0x9734('0x6a')]+=0x1;if(_0x43519d[_0x9734('0x46')][_0x2d1c64]){handleError(_0x43519d[_0x9734('0x69')][_0x2d1c64],_0x43519d[_0x9734('0x46')][_0x2d1c64]);}else{var _0x1d48bc=[];for(var _0x3d96fc in _0x41df82){if(_0x41df82['hasOwnProperty'](_0x3d96fc)){if(_0x43519d[_0x9734('0x69')][_0x2d1c64][_0x41df82[_0x3d96fc]]){var _0x36f735=_[_0x9734('0x6b')](_0x43519d[_0x9734('0x69')][_0x2d1c64][_0x41df82[_0x3d96fc]][_0x9734('0x6c')](/"/g,'\x27'));switch(_0x3d96fc){case _0x9734('0x1e'):var _0x3e74db=moment(_0x36f735,_0x9734('0x6d'),!![]);if(_0x3e74db[_0x9734('0x6e')]()){_0x3b7472['push']('\x22'+_0x36f735+'\x22');}else{_0x1d48bc[_0x9734('0x47')](_0x9734('0x6f'));}break;case _0x9734('0x23'):var _0x35be3d=parseInt(_0x36f735);_0x36f735=_[_0x9734('0x70')](_0x35be3d)||_0x35be3d<0x0||_0x35be3d>0x4?_0x36602e?0x3:0x2:_0x35be3d;_0x3b7472[_0x9734('0x47')]('\x22'+_0x36f735+'\x22');break;case _0x9734('0x37'):var _0x44912b=parseInt(_0x36f735);if(_[_0x9734('0x71')](_0x44912b)&&_[_0x9734('0x65')](_0x14e1d5,_0x44912b)){_0x3b7472[_0x9734('0x47')]('\x22'+_0x44912b+'\x22');}else{_0x1d48bc[_0x9734('0x47')]('agent\x20not\x20exists');}break;case _0x9734('0x72'):if(isEmail(_0x36f735)){_0x3b7472['push']('\x22'+_0x36f735+'\x22');}else{_0x1d48bc['push']('email\x20wrong\x20format');}break;case _0x9734('0x73'):var _0x452ef5=moment(_0x36f735,_0x9734('0x74'),!![]);if(_0x452ef5[_0x9734('0x6e')]()){_0x3b7472[_0x9734('0x47')]('\x22'+_0x36f735+'\x22');}else{_0x1d48bc[_0x9734('0x47')](_0x9734('0x75'));}break;case _0x9734('0x58'):var _0x207f7d=shared['timezones'];var _0x1c44fa=_0x207f7d[_0x36f735];if(!_['isNil'](_0x1c44fa)){var _0x3130fd=_0x1c44fa[_0x9734('0x5a')];_0x3b7472[_0x9734('0x47')]('\x22'+_0x36f735+'\x22');_0x3b7472['push']('\x22'+_0x3130fd+'\x22');}break;default:_0x3b7472['push']('\x22'+_0x36f735+'\x22');}}else{switch(_0x3d96fc){case _0x9734('0x76'):case'phone':_0x1d48bc[_0x9734('0x47')](_0x3d96fc+_0x9734('0x77'));break;default:_0x3b7472[_0x9734('0x47')]('\x22\x22');}}}}if(_0x1d48bc[_0x9734('0x57')]){handleError(_0x43519d['data'][_0x2d1c64],{'code':'SystemRow','message':_0x1d48bc[_0x9734('0x10')]()});}else{fs[_0x9734('0x78')](_0x34ab98,_0x3b7472['join']()+'\x0a');}_0x3b7472=[];}if(!(stats[_0x9734('0x6a')]%0xc8)){socket['emit'](_0x9734('0x79')+_0x195857,stats);stats[_0x9734('0x46')]=[];}}if(stopped){logger[_0x9734('0x42')](_0x9734('0x7a'));_0x41e4a1[_0x9734('0x7b')]();}}catch(_0x2c6a16){handleError(_0x43519d['data'][_0x2d1c64],{'code':_0x9734('0x7c'),'message':_0x2c6a16[_0x9734('0x45')]});logger[_0x9734('0x44')](_0x9734('0x7d'),_0x2c6a16[_0x9734('0x45')]);}},'complete':function(){try{var _0x406373=[];var _0xf39586=[];var _0x407ee9=_0x9734('0x25');if(_0x33ab2a['duplicates']&&_0x33ab2a[_0x9734('0x7e')][_0x9734('0x57')]){_0x407ee9=_0x9734('0x7f')+_0x195857;_0x406373['push'](_0x9734('0x80')+_0x407ee9+_0x9734('0x81'));}tmp_campaigns=_0x9734('0x82')+_0x195857;tmp_voice_queues=_0x9734('0x83')+_0x195857;_0xf39586[_0x9734('0x47')](_0x9734('0x80')+tmp_campaigns+_0x9734('0x84'));_0xf39586[_0x9734('0x47')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x9734('0x84'));BPromise[_0x9734('0x85')](_0xf39586,handleTZQuery)[_0x9734('0x51')](function(_0x58ae66){updateTzCampaigns(_0x33ab2a[_0x9734('0x20')])[_0x9734('0x51')](function(_0x1ba03d){updateTzVoiceQueues(_0x33ab2a[_0x9734('0x20')])['then'](function(_0x2b5570){var _0x265fc7=util[_0x9734('0xd')](_0x9734('0x86'),_0x34ab98,_0x407ee9,_0xef3172,_0x33ab2a[_0x9734('0x20')],_0x33ab2a[_0x9734('0x3c')]||null,NOW,NOW);if(_[_0x9734('0x59')](_0x41df82[_0x9734('0x1e')])){_0x265fc7+=_0x9734('0x87');}_0x406373[_0x9734('0x47')](_0x265fc7);if(_0x33ab2a['duplicates']&&_0x33ab2a[_0x9734('0x7e')]['length']){_0x406373['push'](insertCmContact(_0x33ab2a[_0x9734('0x20')],_0x407ee9,_0x33ab2a[_0x9734('0x7e')],_0x41df82));_0x406373['push'](_0x9734('0x88')+_0x407ee9+';');}if(hasTZ){_0x406373[_0x9734('0x47')](insertTzCmHopper(_0x33ab2a[_0x9734('0x20')],_0x9734('0x54'),_0x9734('0x53'),_0x9734('0x89'),_0x36602e,tmp_voice_queues));_0x406373[_0x9734('0x47')](insertTzCmHopperBlack(_0x33ab2a[_0x9734('0x20')],_0x9734('0x8a'),'voice_queues',_0x9734('0x89')));_0x406373[_0x9734('0x47')](insertTzCmHopper(_0x33ab2a[_0x9734('0x20')],_0x9734('0x4d'),_0x9734('0x4c'),_0x9734('0x8b'),_0x36602e,tmp_campaigns));_0x406373[_0x9734('0x47')](insertTzCmHopperBlack(_0x33ab2a[_0x9734('0x20')],_0x9734('0x8c'),_0x9734('0x4c'),'CampaignId'));}else{_0x406373[_0x9734('0x47')](insertCmHopper(_0x33ab2a[_0x9734('0x20')],_0x9734('0x54'),_0x9734('0x53'),'VoiceQueueId',_0x36602e));_0x406373['push'](insertCmHopperBlack(_0x33ab2a['ListId'],_0x9734('0x8a'),'voice_queues','VoiceQueueId'));_0x406373[_0x9734('0x47')](insertCmHopper(_0x33ab2a['ListId'],_0x9734('0x4d'),_0x9734('0x4c'),_0x9734('0x8b'),_0x36602e));_0x406373[_0x9734('0x47')](insertCmHopperBlack(_0x33ab2a[_0x9734('0x20')],_0x9734('0x8c'),_0x9734('0x4c'),_0x9734('0x8b')));}_0x406373['push'](_0x9734('0x88')+tmp_campaigns+';');_0x406373[_0x9734('0x47')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x9734('0x85')](_0x406373,handleQuery)['then'](function(_0x1eeb0b){stats[_0x9734('0x8d')]=!![];stats[_0x9734('0x8e')]=_0x33ab2a[_0x9734('0x7e')]&&_0x33ab2a['duplicates'][_0x9734('0x57')]?results[0x2][_0x9734('0x8e')]:results[0x0][_0x9734('0x8e')];socket[_0x9734('0x8f')](_0x9734('0x79')+_0x195857,stats);fs[_0x9734('0x90')](_0x22c3ed);fs[_0x9734('0x90')](_0x34ab98);process[_0x9734('0x91')](0x0);})['catch'](function(_0x34aaba){logger[_0x9734('0x44')](_0x34aaba[_0x9734('0x45')]);process[_0x9734('0x91')](0x1);});});});});}catch(_0x316d39){logger[_0x9734('0x44')](_0x9734('0x92'),_0x316d39[_0x9734('0x45')]);process[_0x9734('0x91')](0x1);}},'error':function(_0x15d2f3,_0x36000d,_0x4b1efc,_0x344c66){throw new Error(_0x344c66);}});}function validate(){if(process[_0x9734('0x93')]&&process[_0x9734('0x93')][_0x9734('0x57')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0xdb70ab=path[_0x9734('0x10')](config[_0x9734('0x63')],_0x9734('0x64'),process['argv'][0x2]);if(!fs['existsSync'](_0xdb70ab)){throw new Error(_0x9734('0x94'));}var _0x44d4fb={};try{_0x44d4fb=JSON[_0x9734('0x95')](process[_0x9734('0x93')][0x3]);if(!_0x44d4fb['binding']){throw new Error(_0x9734('0x96'));}if(!_0x44d4fb['binding'][_0x9734('0x1d')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x44d4fb[_0x9734('0x61')][_0x9734('0x76')]){throw new Error(_0x9734('0x97'));}var _0x58d4ad=0x0;if(_0x44d4fb[_0x9734('0x61')]['UserId']){_0x58d4ad=0x1;}if(!_0x44d4fb[_0x9734('0x20')]){throw new Error(_0x9734('0x98'));}}catch(_0x4f71a2){throw new Error(_0x9734('0x99'));}var _0x191f13=[];try{_0x191f13=_[_0x9734('0x9a')](JSON[_0x9734('0x95')](process[_0x9734('0x93')][0x4]),'id');}catch(_0x144fdd){logger[_0x9734('0x42')](_0x9734('0x9b'));}main(_0xdb70ab,_0x44d4fb,_0x191f13,_0x58d4ad);}validate();process['on'](_0x9734('0x9c'),handleStop);process['on'](_0x9734('0x9d'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index a037b8f..552e303 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 _0x0bab=['voice','***\x20Call\x20Info\x20***','Caller\x20Number','calleridnum','calleridname','destexten','keyValue','Queue','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','uniqueid','Date','starttime','Answer\x20Time','Complete\x20Time','endtime','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','variable','queue','push','outbound','Outbound\x20Call','destcalleridnum'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0bab,0x155));var _0xb0ba=function(_0x5474d9,_0x567a1b){_0x5474d9=_0x5474d9-0x0;var _0x4de4f2=_0x0bab[_0x5474d9];return _0x4de4f2;};'use strict';exports[_0xb0ba('0x0')]=function(_0x182af6,_0xd93756){var _0x45afe3=[{'type':_0xb0ba('0x1'),'content':_0xb0ba('0x2'),'variableName':null}];switch(_0x182af6['toLowerCase']()){case'voice':switch(_0xd93756[_0xb0ba('0x3')]()){case'inbound':_0x45afe3['push']({'type':_0xb0ba('0x4'),'content':'','variableName':_0xb0ba('0x5')});_0x45afe3[_0xb0ba('0x6')]({'type':_0xb0ba('0x4'),'content':'','variableName':'calleridnum'});break;case _0xb0ba('0x7'):_0x45afe3[_0xb0ba('0x6')]({'type':'string','content':_0xb0ba('0x8'),'variableName':null});_0x45afe3[_0xb0ba('0x6')]({'type':_0xb0ba('0x4'),'content':'','variableName':_0xb0ba('0x9')});break;}}return _0x45afe3;};exports['getDescriptions']=function(_0x497f5e,_0x248d90){var _0x4f8b57=[];switch(_0x497f5e[_0xb0ba('0x3')]()){case _0xb0ba('0xa'):switch(_0x248d90[_0xb0ba('0x3')]()){case'inbound':_0x4f8b57=[{'type':_0xb0ba('0x1'),'content':_0xb0ba('0xb'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xb0ba('0xc'),'keyType':'variable','variableName':_0xb0ba('0xd')},{'type':'keyValue','content':'','key':'Caller\x20Name','keyType':'variable','variableName':_0xb0ba('0xe')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0xb0ba('0x4'),'variableName':_0xb0ba('0xf')},{'type':_0xb0ba('0x10'),'content':'','key':_0xb0ba('0x11'),'keyType':_0xb0ba('0x4'),'variableName':_0xb0ba('0x5')},{'type':_0xb0ba('0x10'),'content':'','key':'UniqueId','keyType':_0xb0ba('0x4'),'variableName':'uniqueid'},{'type':_0xb0ba('0x10'),'content':'','key':'Date','keyType':'variable','variableName':_0xb0ba('0x12')},{'type':_0xb0ba('0x1'),'content':_0xb0ba('0x13'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xb0ba('0x14'),'keyType':'variable','variableName':'destcalleridname'},{'type':_0xb0ba('0x10'),'content':'','key':_0xb0ba('0x15'),'keyType':_0xb0ba('0x4'),'variableName':_0xb0ba('0x9')},{'type':'string','content':_0xb0ba('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0xb0ba('0x10'),'content':'','key':_0xb0ba('0x17'),'keyType':_0xb0ba('0x4'),'variableName':'agentcalledAt'},{'type':_0xb0ba('0x10'),'content':'','key':_0xb0ba('0x18'),'keyType':_0xb0ba('0x4'),'variableName':'agentconnectAt'},{'type':_0xb0ba('0x10'),'content':'','key':'Agent\x20Complete','keyType':_0xb0ba('0x4'),'variableName':_0xb0ba('0x19')},{'type':'keyValue','content':'','key':_0xb0ba('0x1a'),'keyType':_0xb0ba('0x4'),'variableName':'holdtime'},{'type':_0xb0ba('0x10'),'content':'','key':_0xb0ba('0x1b'),'keyType':'variable','variableName':_0xb0ba('0x1c')}];break;case'outbound':_0x4f8b57=[{'type':'string','content':_0xb0ba('0xb'),'variableName':null},{'type':_0xb0ba('0x10'),'content':'','key':_0xb0ba('0x1d'),'keyType':_0xb0ba('0x4'),'keyContent':'','variableName':_0xb0ba('0x9')},{'type':_0xb0ba('0x10'),'content':'','key':_0xb0ba('0x1e'),'keyType':_0xb0ba('0x4'),'keyContent':'','variableName':_0xb0ba('0x1f')},{'type':_0xb0ba('0x10'),'content':'','key':'UniqueId','keyType':_0xb0ba('0x4'),'keyContent':'','variableName':_0xb0ba('0x20')},{'type':'keyValue','content':'','key':_0xb0ba('0x21'),'keyType':_0xb0ba('0x4'),'keyContent':'','variableName':_0xb0ba('0x22')},{'type':_0xb0ba('0x1'),'content':_0xb0ba('0x16')},{'type':_0xb0ba('0x10'),'content':'','key':_0xb0ba('0x23'),'keyType':'variable','keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':_0xb0ba('0x24'),'keyType':'variable','keyContent':'','variableName':_0xb0ba('0x25')},{'type':'keyValue','content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':'duration'},{'type':_0xb0ba('0x10'),'content':'','key':'Billable\x20Time','keyType':_0xb0ba('0x4'),'keyContent':'','variableName':_0xb0ba('0x26')}];break;}}return _0x4f8b57;}; \ No newline at end of file +var _0x7224=['billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','calleridnum','destcalleridnum','getDescriptions','keyValue','Caller\x20Name','calleridname','destexten','Queue','queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','talktime','outbound','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time'];(function(_0x360739,_0x2ec1b2){var _0x3e23a1=function(_0x105b37){while(--_0x105b37){_0x360739['push'](_0x360739['shift']());}};_0x3e23a1(++_0x2ec1b2);}(_0x7224,0x88));var _0x4722=function(_0x109307,_0x4f12d1){_0x109307=_0x109307-0x0;var _0x2ea750=_0x7224[_0x109307];return _0x2ea750;};'use strict';exports[_0x4722('0x0')]=function(_0x7cede9,_0x1252d0){var _0x136b0b=[{'type':_0x4722('0x1'),'content':_0x4722('0x2'),'variableName':null}];switch(_0x7cede9[_0x4722('0x3')]()){case'voice':switch(_0x1252d0[_0x4722('0x3')]()){case _0x4722('0x4'):_0x136b0b[_0x4722('0x5')]({'type':_0x4722('0x6'),'content':'','variableName':'queue'});_0x136b0b[_0x4722('0x5')]({'type':_0x4722('0x6'),'content':'','variableName':_0x4722('0x7')});break;case'outbound':_0x136b0b[_0x4722('0x5')]({'type':_0x4722('0x1'),'content':'Outbound\x20Call','variableName':null});_0x136b0b[_0x4722('0x5')]({'type':_0x4722('0x6'),'content':'','variableName':_0x4722('0x8')});break;}}return _0x136b0b;};exports[_0x4722('0x9')]=function(_0x336270,_0x1ec9ec){var _0x45ab8c=[];switch(_0x336270[_0x4722('0x3')]()){case'voice':switch(_0x1ec9ec[_0x4722('0x3')]()){case _0x4722('0x4'):_0x45ab8c=[{'type':_0x4722('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x4722('0xa'),'content':'','key':'Caller\x20Number','keyType':_0x4722('0x6'),'variableName':_0x4722('0x7')},{'type':_0x4722('0xa'),'content':'','key':_0x4722('0xb'),'keyType':_0x4722('0x6'),'variableName':_0x4722('0xc')},{'type':_0x4722('0xa'),'content':'','key':'Call\x20To','keyType':_0x4722('0x6'),'variableName':_0x4722('0xd')},{'type':_0x4722('0xa'),'content':'','key':_0x4722('0xe'),'keyType':_0x4722('0x6'),'variableName':_0x4722('0xf')},{'type':_0x4722('0xa'),'content':'','key':_0x4722('0x10'),'keyType':'variable','variableName':_0x4722('0x11')},{'type':_0x4722('0xa'),'content':'','key':_0x4722('0x12'),'keyType':_0x4722('0x6'),'variableName':_0x4722('0x13')},{'type':_0x4722('0x1'),'content':_0x4722('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x4722('0xa'),'content':'','key':_0x4722('0x15'),'keyType':'variable','variableName':_0x4722('0x16')},{'type':_0x4722('0xa'),'content':'','key':_0x4722('0x17'),'keyType':_0x4722('0x6'),'variableName':_0x4722('0x8')},{'type':_0x4722('0x1'),'content':_0x4722('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x4722('0xa'),'content':'','key':_0x4722('0x19'),'keyType':_0x4722('0x6'),'variableName':_0x4722('0x13')},{'type':_0x4722('0xa'),'content':'','key':_0x4722('0x1a'),'keyType':_0x4722('0x6'),'variableName':_0x4722('0x1b')},{'type':_0x4722('0xa'),'content':'','key':_0x4722('0x1c'),'keyType':_0x4722('0x6'),'variableName':_0x4722('0x1d')},{'type':_0x4722('0xa'),'content':'','key':'Hold\x20Time','keyType':_0x4722('0x6'),'variableName':_0x4722('0x1e')},{'type':_0x4722('0xa'),'content':'','key':'Talk\x20Time','keyType':'variable','variableName':_0x4722('0x1f')}];break;case _0x4722('0x20'):_0x45ab8c=[{'type':'string','content':_0x4722('0x21'),'variableName':null},{'type':_0x4722('0xa'),'content':'','key':_0x4722('0x22'),'keyType':_0x4722('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x4722('0xa'),'content':'','key':_0x4722('0x23'),'keyType':_0x4722('0x6'),'keyContent':'','variableName':'membername'},{'type':_0x4722('0xa'),'content':'','key':_0x4722('0x10'),'keyType':'variable','keyContent':'','variableName':_0x4722('0x11')},{'type':'keyValue','content':'','key':_0x4722('0x12'),'keyType':_0x4722('0x6'),'keyContent':'','variableName':_0x4722('0x24')},{'type':_0x4722('0x1'),'content':_0x4722('0x18')},{'type':_0x4722('0xa'),'content':'','key':_0x4722('0x25'),'keyType':'variable','keyContent':'','variableName':_0x4722('0x26')},{'type':_0x4722('0xa'),'content':'','key':_0x4722('0x27'),'keyType':_0x4722('0x6'),'keyContent':'','variableName':_0x4722('0x28')},{'type':'keyValue','content':'','key':_0x4722('0x29'),'keyType':_0x4722('0x6'),'keyContent':'','variableName':_0x4722('0x2a')},{'type':_0x4722('0xa'),'content':'','key':_0x4722('0x2b'),'keyType':_0x4722('0x6'),'keyContent':'','variableName':_0x4722('0x2c')}];break;}}return _0x45ab8c;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 4a54f39..06752c7 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 _0xde8d=['chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','name','role','Interaction','findOne','then','update','catch','tracked','user','body','omit','html','mobile','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xde8d,0x1c3));var _0xdde8=function(_0x2775f4,_0x10ddd4){_0x2775f4=_0x2775f4-0x0;var _0x377a51=_0xde8d[_0x2775f4];return _0x377a51;};'use strict';var _=require(_0xdde8('0x0'));var db=require(_0xdde8('0x1'))['db'];var loggers={'openchannel':require(_0xdde8('0x2'))('openchannel-interactions'),'mail':require('../../config/logger')(_0xdde8('0x3')),'fax':require(_0xdde8('0x2'))(_0xdde8('0x4')),'sms':require(_0xdde8('0x2'))('sms-interactions'),'chat':require(_0xdde8('0x2'))(_0xdde8('0x5')),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getInteractionId(_0x149870,_0x1efc22,_0x50110a){if(_0x149870&&_0x149870[_[_0xdde8('0x6')](_0x50110a)+'InteractionId']){return _0x149870[_['upperFirst'](_0x50110a)+_0xdde8('0x7')];}else if(_0x149870&&_0x149870['id']){return _0x149870['id'];}else if(_0x1efc22&&_0x1efc22['id']){return _0x1efc22['id'];}else{return _0xdde8('0x8');}}function log(_0x355150,_0x1f4802,_0x1d7f36,_0x4ca4cd,_0x216124,_0x1b6b7a){loggers[_0x216124[_0xdde8('0x9')]()][_0x355150]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b6b7a[_0xdde8('0xa')](),_0x1f4802?_0x1f4802['id']:null,_0x1f4802?_0x1f4802[_0xdde8('0xb')]:null,_0x1f4802?_0x1f4802[_0xdde8('0xc')]:null,getInteractionId(_0x1d7f36,_0x4ca4cd,_0x216124),_0x1d7f36?JSON['stringify'](_0x1d7f36):'null');}function updateUser(_0x442709,_0x3c675f,_0x45ccf8,_0x4ef331,_0x3862bd){db[_[_0xdde8('0x6')](_0x4ef331)+_0xdde8('0xd')][_0xdde8('0xe')]({'where':{'id':getInteractionId(_0x3c675f,_0x45ccf8,_0x4ef331)}})[_0xdde8('0xf')](function(_0x58d8ba){if(_0x58d8ba){return _0x58d8ba[_0xdde8('0x10')]({'UserId':_0x442709?_0x442709['id']:null});}})[_0xdde8('0xf')](function(_0x57fe60){if(_0x57fe60){log('info',_0x442709,_0x3c675f,_0x45ccf8,_0x4ef331,_0x3862bd);}})[_0xdde8('0x11')](function(){log('error',_0x442709,_0x3c675f,_0x45ccf8,_0x4ef331,_0x3862bd);});}exports[_0xdde8('0x12')]=function(_0x49b072,_0x390dad){return function(_0x592a33,_0x33336c,_0x34370a){var _0x5c7023=_0x592a33[_0xdde8('0x13')];var _0x15270e={};var _0x25b000=_0x592a33['query'];if(_0x15270e){_0x15270e=_['clone'](_0x592a33[_0xdde8('0x14')]);_0x15270e=_[_0xdde8('0x15')](_0x15270e,[_0xdde8('0x14'),_0xdde8('0x16'),'phone','fax',_0xdde8('0x17')]);}updateUser(_0x5c7023,_0x15270e,_0x25b000,_0x49b072,_0x390dad);_0x34370a(null);};}; \ No newline at end of file +var _0xfff8=['../../config/logger','mail-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','name','role','stringify','null','Interaction','findOne','update','then','info','catch','error','tracked','user','query','omit','body','html','phone','lodash','../../mysqldb'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xfff8,0xb2));var _0x8fff=function(_0x20fff7,_0x49878b){_0x20fff7=_0x20fff7-0x0;var _0x12a934=_0xfff8[_0x20fff7];return _0x12a934;};'use strict';var _=require(_0x8fff('0x0'));var db=require(_0x8fff('0x1'))['db'];var loggers={'openchannel':require(_0x8fff('0x2'))('openchannel-interactions'),'mail':require(_0x8fff('0x2'))(_0x8fff('0x3')),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0x8fff('0x2'))(_0x8fff('0x4')),'chat':require(_0x8fff('0x2'))(_0x8fff('0x5')),'whatsapp':require(_0x8fff('0x2'))(_0x8fff('0x6'))};function getInteractionId(_0x4869dc,_0x107a60,_0x427f50){if(_0x4869dc&&_0x4869dc[_[_0x8fff('0x7')](_0x427f50)+'InteractionId']){return _0x4869dc[_[_0x8fff('0x7')](_0x427f50)+_0x8fff('0x8')];}else if(_0x4869dc&&_0x4869dc['id']){return _0x4869dc['id'];}else if(_0x107a60&&_0x107a60['id']){return _0x107a60['id'];}else{return _0x8fff('0x9');}}function log(_0x398111,_0x1464fa,_0x9b9abb,_0x525599,_0x1b3da6,_0xafe366){loggers[_0x1b3da6[_0x8fff('0xa')]()][_0x398111]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xafe366[_0x8fff('0xb')](),_0x1464fa?_0x1464fa['id']:null,_0x1464fa?_0x1464fa[_0x8fff('0xc')]:null,_0x1464fa?_0x1464fa[_0x8fff('0xd')]:null,getInteractionId(_0x9b9abb,_0x525599,_0x1b3da6),_0x9b9abb?JSON[_0x8fff('0xe')](_0x9b9abb):_0x8fff('0xf'));}function updateUser(_0x548287,_0x27dfe8,_0x3f5f75,_0x3648dc,_0x2b77c1){db[_[_0x8fff('0x7')](_0x3648dc)+_0x8fff('0x10')][_0x8fff('0x11')]({'where':{'id':getInteractionId(_0x27dfe8,_0x3f5f75,_0x3648dc)}})['then'](function(_0x1296cd){if(_0x1296cd){return _0x1296cd[_0x8fff('0x12')]({'UserId':_0x548287?_0x548287['id']:null});}})[_0x8fff('0x13')](function(_0x347904){if(_0x347904){log(_0x8fff('0x14'),_0x548287,_0x27dfe8,_0x3f5f75,_0x3648dc,_0x2b77c1);}})[_0x8fff('0x15')](function(){log(_0x8fff('0x16'),_0x548287,_0x27dfe8,_0x3f5f75,_0x3648dc,_0x2b77c1);});}exports[_0x8fff('0x17')]=function(_0xb1b1d0,_0x184fb7){return function(_0x544a91,_0x2feea7,_0x23de5b){var _0x2e90f7=_0x544a91[_0x8fff('0x18')];var _0xf05ad2={};var _0x59eb1f=_0x544a91[_0x8fff('0x19')];if(_0xf05ad2){_0xf05ad2=_['clone'](_0x544a91['body']);_0xf05ad2=_[_0x8fff('0x1a')](_0xf05ad2,[_0x8fff('0x1b'),_0x8fff('0x1c'),_0x8fff('0x1d'),'fax','mobile']);}updateUser(_0x2e90f7,_0xf05ad2,_0x59eb1f,_0xb1b1d0,_0x184fb7);_0x23de5b(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 158bb4e..cdaf703 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 _0xbdc4=['update','base64','utf8','final','parse','hasOwnProperty','use','findOne','count','then','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','%s:%s:%s'];(function(_0x5f08a6,_0x400121){var _0x5d0641=function(_0x304467){while(--_0x304467){_0x5f08a6['push'](_0x5f08a6['shift']());}};_0x5d0641(++_0x400121);}(_0xbdc4,0xaa));var _0x4bdc=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xbdc4[_0x4a7631];return _0x1a5a6f;};'use strict';var crypto=require('crypto');var util=require(_0x4bdc('0x0'));var compose=require(_0x4bdc('0x1'));var db=require(_0x4bdc('0x2'))['db'];var config=require(_0x4bdc('0x3'));function getValueFromLicense(_0x5b57ce,_0x54211d){if(_0x5b57ce&&_0x54211d){if(_0x54211d['data1']&&_0x54211d[_0x4bdc('0x4')]){var _0x1108bb=_0x54211d[_0x4bdc('0x5')];var _0x308ced=_0x54211d[_0x4bdc('0x4')];var _0x3a3322=_0x1108bb[_0x4bdc('0x6')]('-')[0x4];var _0x5a6b71=_0x1108bb[_0x4bdc('0x6')]('-')[0x0];var _0x1a7829=crypto[_0x4bdc('0x7')](_0x4bdc('0x8'),util['format'](_0x4bdc('0x9'),_0x3a3322,_0x1108bb,_0x5a6b71));var _0xff78b5=_0x1a7829[_0x4bdc('0xa')](_0x308ced,_0x4bdc('0xb'),_0x4bdc('0xc'));_0xff78b5+=_0x1a7829[_0x4bdc('0xd')](_0x4bdc('0xc'));var _0x2834a2=JSON[_0x4bdc('0xe')](_0xff78b5);return _0x2834a2[_0x4bdc('0xf')](_0x5b57ce)?_0x2834a2[_0x5b57ce]:null;}}return null;}function isLimit(_0x5f217f,_0x2621eb,_0x168316,_0x396fe2){var _0x430d2f=_0x2621eb;return compose()[_0x4bdc('0x10')](function(_0x5ddb2e,_0x5607a8,_0x16b230){return db['License'][_0x4bdc('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x242eb0){var _0xc3213e=getValueFromLicense(_0x5f217f,_0x242eb0);return _0xc3213e?_0xc3213e:_0x430d2f;})['then'](function(_0x2f9a91){_0x430d2f=_0x2f9a91;return _0x168316[_0x4bdc('0x12')](_0x396fe2);})[_0x4bdc('0x13')](function(_0xbb0132){if(_0xbb0132>=_0x430d2f){return _0x5607a8[_0x4bdc('0x14')](0x193)[_0x4bdc('0x15')]({'message':util[_0x4bdc('0x16')](_0x4bdc('0x17'),_0x5f217f)});}_0x16b230();})[_0x4bdc('0x18')](function(_0xbf3100){_0x16b230(_0xbf3100);});});}function isUserLimit(){return isLimit(_0x4bdc('0x19'),0x1,db[_0x4bdc('0x1a')],{'where':{'$or':[{'role':_0x4bdc('0x1b')},{'role':_0x4bdc('0x1c')}]}});}exports[_0x4bdc('0x1d')]=isUserLimit; \ No newline at end of file +var _0x47f8=['hasOwnProperty','use','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','parse'];(function(_0x20abe9,_0x514099){var _0x19a5aa=function(_0x1eec5e){while(--_0x1eec5e){_0x20abe9['push'](_0x20abe9['shift']());}};_0x19a5aa(++_0x514099);}(_0x47f8,0x16b));var _0x847f=function(_0x277925,_0x5357d6){_0x277925=_0x277925-0x0;var _0xd1d4b6=_0x47f8[_0x277925];return _0xd1d4b6;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require('composable-middleware');var db=require(_0x847f('0x0'))['db'];var config=require(_0x847f('0x1'));function getValueFromLicense(_0x1f63af,_0x5c5302){if(_0x1f63af&&_0x5c5302){if(_0x5c5302[_0x847f('0x2')]&&_0x5c5302[_0x847f('0x3')]){var _0x5564cb=_0x5c5302['data1'];var _0x333fc3=_0x5c5302[_0x847f('0x3')];var _0xa508d8=_0x5564cb['split']('-')[0x4];var _0x501ff5=_0x5564cb[_0x847f('0x4')]('-')[0x0];var _0xd9e2f7=crypto[_0x847f('0x5')](_0x847f('0x6'),util[_0x847f('0x7')](_0x847f('0x8'),_0xa508d8,_0x5564cb,_0x501ff5));var _0x1d018e=_0xd9e2f7[_0x847f('0x9')](_0x333fc3,'base64','utf8');_0x1d018e+=_0xd9e2f7['final'](_0x847f('0xa'));var _0x809d67=JSON[_0x847f('0xb')](_0x1d018e);return _0x809d67[_0x847f('0xc')](_0x1f63af)?_0x809d67[_0x1f63af]:null;}}return null;}function isLimit(_0x32cff6,_0x4bf175,_0x54d700,_0x42a3c8){var _0x1a4813=_0x4bf175;return compose()[_0x847f('0xd')](function(_0xaf1acc,_0x242dc7,_0x4a2c06){return db[_0x847f('0xe')][_0x847f('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x847f('0x10')](function(_0x340220){var _0x22f48d=getValueFromLicense(_0x32cff6,_0x340220);return _0x22f48d?_0x22f48d:_0x1a4813;})[_0x847f('0x10')](function(_0x5bbde9){_0x1a4813=_0x5bbde9;return _0x54d700['count'](_0x42a3c8);})[_0x847f('0x10')](function(_0x20f6e5){if(_0x20f6e5>=_0x1a4813){return _0x242dc7[_0x847f('0x11')](0x193)[_0x847f('0x12')]({'message':util[_0x847f('0x7')](_0x847f('0x13'),_0x32cff6)});}_0x4a2c06();})[_0x847f('0x14')](function(_0x1acf1c){_0x4a2c06(_0x1acf1c);});});}function isUserLimit(){return isLimit(_0x847f('0x15'),0x1,db[_0x847f('0x16')],{'where':{'$or':[{'role':_0x847f('0x17')},{'role':'user'}]}});}exports[_0x847f('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 6064b8a..31b5912 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 _0x570a=['forEach','filter','conditions','push','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','CAST(','field','text','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','minutes','parseSearch','sqlOperator','startsWith','and','[$and]','replace','length','split','shift','match'];(function(_0x2a025f,_0x3fbaf9){var _0x5e86b5=function(_0x4be98f){while(--_0x4be98f){_0x2a025f['push'](_0x2a025f['shift']());}};_0x5e86b5(++_0x3fbaf9);}(_0x570a,0xf0));var _0xa570=function(_0x55b422,_0x51b367){_0x55b422=_0x55b422-0x0;var _0x1f67fb=_0x570a[_0x55b422];return _0x1f67fb;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0xa570('0x0')]=function(_0x1760f0){var _0x18a6bd={'conditions':[]};_0x18a6bd[_0xa570('0x1')]=_[_0xa570('0x2')](_0x1760f0,'[$or]')?'or':_0xa570('0x3');var _0x363356=_0x1760f0['replace'](_0xa570('0x4'),'')[_0xa570('0x5')]('[$or]','')['split']('||');for(var _0x324f9e=0x0;_0x324f9e<_0x363356[_0xa570('0x6')];_0x324f9e++){var _0x5e5136=_0x363356[_0x324f9e][_0xa570('0x7')](':=');var _0x1a6a0f=_0x5e5136[0x0];var _0x31a066=_0x5e5136['slice'](0x1);_0x31a066['forEach'](function(_0x169455){var _0x21dd77=_0x169455[_0xa570('0x7')]('[')[_0xa570('0x8')]();var _0x465f46=_0x169455[_0xa570('0x9')](/\[(.*?)\]/g);_0x465f46[_0xa570('0xa')](function(_0x533ebd){var _0x3bc65e=_0x533ebd[_0xa570('0x7')]('[')[_0xa570('0xb')](function(_0x1004a9){return _0x1004a9['indexOf'](']')>-0x1;})['map'](function(_0x3bbddd){return _0x3bbddd[_0xa570('0x7')](']')[0x0];})[0x0];_0x18a6bd[_0xa570('0xc')][_0xa570('0xd')]({'field':_0x1a6a0f,'operator':_0x21dd77,'value':_0x3bc65e});});});}return _0x18a6bd;};exports['buildExpression']=function(_0x6cb86a,_0x48d443,_0x4b4058){var _0x369a1e={};if(_0x48d443===_0xa570('0xe')){if(_0x4b4058[_0xa570('0xf')]===_0xa570('0x10')){_0x4b4058[_0xa570('0xf')]=_0xa570('0x11');_0x4b4058[_0xa570('0x12')]+=','+_0x4b4058[_0xa570('0x12')];}else if(_[_0xa570('0x13')]([_0xa570('0x14'),_0xa570('0x15')],_0x4b4058[_0xa570('0xf')])){_0x4b4058[_0xa570('0x12')]=moment(_0x4b4058[_0xa570('0x12')])[_0xa570('0x16')](0x1,_0xa570('0x17'))[_0xa570('0x18')](_0xa570('0x19'));}}if(_0x4b4058[_0xa570('0x1a')]){_0x48d443=_0x4b4058[_0xa570('0x1a')];_0x369a1e['text']=_0xa570('0x1b')+_0x6cb86a+'.'+_0x4b4058[_0xa570('0x1c')]+'\x20AS\x20'+_0x4b4058[_0xa570('0x1a')]+')\x20'+parseOperator(_0x4b4058['operator']);}else{_0x369a1e[_0xa570('0x1d')]=_0x6cb86a+'.'+_0x4b4058[_0xa570('0x1c')]+'\x20'+parseOperator(_0x4b4058['operator']);}if(_[_0xa570('0x13')]([_0xa570('0x1e'),_0xa570('0x1f')],_0x4b4058[_0xa570('0xf')]))_0x369a1e[_0xa570('0x1d')]='('+_0x369a1e[_0xa570('0x1d')]+'\x20OR\x20'+_0x6cb86a+'.'+_0x4b4058[_0xa570('0x1c')]+_0xa570('0x20');_0x369a1e['value']=parseValue(_0x48d443,_0x4b4058[_0xa570('0xf')],_0x4b4058[_0xa570('0x12')]);return _0x369a1e;};function parseOperator(_0x17ae43){var _0x5401f2;switch(_0x17ae43){case _0xa570('0x21'):_0x5401f2=_0xa570('0x22');break;case _0xa570('0x1f'):_0x5401f2=_0xa570('0x23');break;case _0xa570('0x10'):_0x5401f2='=\x20?';break;case'$ne':_0x5401f2=_0xa570('0x24');break;case _0xa570('0x25'):case _0xa570('0x26'):case _0xa570('0x27'):_0x5401f2='LIKE\x20?';break;case _0xa570('0x28'):_0x5401f2=_0xa570('0x29');break;case'$gt':_0x5401f2='>\x20?';break;case _0xa570('0x15'):_0x5401f2=_0xa570('0x2a');break;case _0xa570('0x2b'):_0x5401f2=_0xa570('0x2c');break;case _0xa570('0x11'):_0x5401f2=_0xa570('0x2d');break;}return _0x5401f2;}function parseValue(_0x2f6483,_0x4fb654,_0x15f3c9){var _0x299439={'start':undefined,'end':undefined};switch(_0x4fb654){case _0xa570('0x21'):case'$notIn':_0x299439[_0xa570('0x2e')]=_0x15f3c9[_0xa570('0x7')](',');break;case _0xa570('0x25'):_0x299439['start']='%'+_0x15f3c9+'%';break;case _0xa570('0x26'):_0x299439[_0xa570('0x2e')]=_0x15f3c9+'%';break;case _0xa570('0x27'):_0x299439[_0xa570('0x2e')]='%'+_0x15f3c9;break;case _0xa570('0x11'):var _0x1f0d84=_0x15f3c9['split'](',');var _0x15f3c9=_0x1f0d84[_0xa570('0x8')]();var _0xe1a24e=_0x1f0d84[_0xa570('0x2f')]();if(_0x2f6483==='DATE'){_0x15f3c9=moment(_0x15f3c9)[_0xa570('0x30')](0x0,!![])[_0xa570('0x18')]();_0xe1a24e=moment(_0xe1a24e)[_0xa570('0x30')](0x0,!![])[_0xa570('0x16')](0x17,'hours')[_0xa570('0x16')](0x3b,_0xa570('0x31'))[_0xa570('0x16')](0x3b,'seconds')[_0xa570('0x18')]();}_0x299439={'start':_0x15f3c9,'end':_0xe1a24e};break;default:_0x299439[_0xa570('0x2e')]=_0x15f3c9;break;}return _0x299439;} \ No newline at end of file +var _0x6822=['pop','utcOffset','hours','seconds','lodash','moment','parseSearch','sqlOperator','[$or]','and','replace','[$and]','split','length','slice','forEach','match','filter','indexOf','map','conditions','push','DATE','operator','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','$eq','$ne','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6822,0x121));var _0x2682=function(_0x56d02b,_0x2bda98){_0x56d02b=_0x56d02b-0x0;var _0x467516=_0x6822[_0x56d02b];return _0x467516;};'use strict';var _=require(_0x2682('0x0'));var moment=require(_0x2682('0x1'));exports[_0x2682('0x2')]=function(_0x4b7524){var _0x3f44b6={'conditions':[]};_0x3f44b6[_0x2682('0x3')]=_['startsWith'](_0x4b7524,_0x2682('0x4'))?'or':_0x2682('0x5');var _0x495d2d=_0x4b7524[_0x2682('0x6')](_0x2682('0x7'),'')['replace']('[$or]','')[_0x2682('0x8')]('||');for(var _0xf745d1=0x0;_0xf745d1<_0x495d2d[_0x2682('0x9')];_0xf745d1++){var _0x450fb6=_0x495d2d[_0xf745d1]['split'](':=');var _0x5311cf=_0x450fb6[0x0];var _0x11cd10=_0x450fb6[_0x2682('0xa')](0x1);_0x11cd10[_0x2682('0xb')](function(_0x5d1981){var _0x1e0d7c=_0x5d1981[_0x2682('0x8')]('[')['shift']();var _0x188804=_0x5d1981[_0x2682('0xc')](/\[(.*?)\]/g);_0x188804['forEach'](function(_0xf5fd25){var _0x9c134=_0xf5fd25[_0x2682('0x8')]('[')[_0x2682('0xd')](function(_0x3b5fb9){return _0x3b5fb9[_0x2682('0xe')](']')>-0x1;})[_0x2682('0xf')](function(_0x22deef){return _0x22deef[_0x2682('0x8')](']')[0x0];})[0x0];_0x3f44b6[_0x2682('0x10')][_0x2682('0x11')]({'field':_0x5311cf,'operator':_0x1e0d7c,'value':_0x9c134});});});}return _0x3f44b6;};exports['buildExpression']=function(_0xed3a9f,_0x3f0dcf,_0x22b7c7){var _0x2c591c={};if(_0x3f0dcf===_0x2682('0x12')){if(_0x22b7c7['operator']==='$eq'){_0x22b7c7[_0x2682('0x13')]=_0x2682('0x14');_0x22b7c7['value']+=','+_0x22b7c7[_0x2682('0x15')];}else if(_[_0x2682('0x16')]([_0x2682('0x17'),_0x2682('0x18')],_0x22b7c7[_0x2682('0x13')])){_0x22b7c7[_0x2682('0x15')]=moment(_0x22b7c7[_0x2682('0x15')])[_0x2682('0x19')](0x1,_0x2682('0x1a'))[_0x2682('0x1b')](_0x2682('0x1c'));}}if(_0x22b7c7[_0x2682('0x1d')]){_0x3f0dcf=_0x22b7c7[_0x2682('0x1d')];_0x2c591c[_0x2682('0x1e')]=_0x2682('0x1f')+_0xed3a9f+'.'+_0x22b7c7['field']+_0x2682('0x20')+_0x22b7c7[_0x2682('0x1d')]+')\x20'+parseOperator(_0x22b7c7[_0x2682('0x13')]);}else{_0x2c591c[_0x2682('0x1e')]=_0xed3a9f+'.'+_0x22b7c7[_0x2682('0x21')]+'\x20'+parseOperator(_0x22b7c7['operator']);}if(_[_0x2682('0x16')](['$ne',_0x2682('0x22')],_0x22b7c7['operator']))_0x2c591c[_0x2682('0x1e')]='('+_0x2c591c[_0x2682('0x1e')]+_0x2682('0x23')+_0xed3a9f+'.'+_0x22b7c7[_0x2682('0x21')]+_0x2682('0x24');_0x2c591c[_0x2682('0x15')]=parseValue(_0x3f0dcf,_0x22b7c7[_0x2682('0x13')],_0x22b7c7[_0x2682('0x15')]);return _0x2c591c;};function parseOperator(_0x230714){var _0xaf9cbe;switch(_0x230714){case _0x2682('0x25'):_0xaf9cbe='IN\x20?';break;case'$notIn':_0xaf9cbe=_0x2682('0x26');break;case _0x2682('0x27'):_0xaf9cbe='=\x20?';break;case _0x2682('0x28'):_0xaf9cbe='<>\x20?';break;case _0x2682('0x29'):case _0x2682('0x2a'):case _0x2682('0x2b'):_0xaf9cbe=_0x2682('0x2c');break;case _0x2682('0x2d'):_0xaf9cbe='<\x20?';break;case _0x2682('0x17'):_0xaf9cbe=_0x2682('0x2e');break;case'$lte':_0xaf9cbe=_0x2682('0x2f');break;case _0x2682('0x30'):_0xaf9cbe=_0x2682('0x31');break;case _0x2682('0x14'):_0xaf9cbe=_0x2682('0x32');break;}return _0xaf9cbe;}function parseValue(_0x1f1a23,_0x42d945,_0x52bb50){var _0x4320f6={'start':undefined,'end':undefined};switch(_0x42d945){case _0x2682('0x25'):case _0x2682('0x22'):_0x4320f6[_0x2682('0x33')]=_0x52bb50['split'](',');break;case _0x2682('0x29'):_0x4320f6[_0x2682('0x33')]='%'+_0x52bb50+'%';break;case _0x2682('0x2a'):_0x4320f6['start']=_0x52bb50+'%';break;case'$endsWith':_0x4320f6[_0x2682('0x33')]='%'+_0x52bb50;break;case _0x2682('0x14'):var _0x3715f2=_0x52bb50[_0x2682('0x8')](',');var _0x52bb50=_0x3715f2[_0x2682('0x34')]();var _0x42fe65=_0x3715f2[_0x2682('0x35')]();if(_0x1f1a23===_0x2682('0x12')){_0x52bb50=moment(_0x52bb50)[_0x2682('0x36')](0x0,!![])['format']();_0x42fe65=moment(_0x42fe65)['utcOffset'](0x0,!![])['add'](0x17,_0x2682('0x37'))[_0x2682('0x19')](0x3b,'minutes')[_0x2682('0x19')](0x3b,_0x2682('0x38'))[_0x2682('0x1b')]();}_0x4320f6={'start':_0x52bb50,'end':_0x42fe65};break;default:_0x4320f6['start']=_0x52bb50;break;}return _0x4320f6;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 4a43385..9d3c783 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 _0xc978=['offset','sort','map','indexOf','priority','col','unsigned','ASC','omit','length','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','forEach','replace','join','getOptions','query','$id','model','intersection','attributes','nolimit','where','pick','filter','object','columns','merge','lower','options','lodash','sequelize','moment','keys','includes','parse','fields','split','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','YYYY-MM-DD','format','utc','subtract','name','uniqueid','isArray','limit'];(function(_0x1edde8,_0x574e41){var _0x2cb06a=function(_0x3de4d4){while(--_0x3de4d4){_0x1edde8['push'](_0x1edde8['shift']());}};_0x2cb06a(++_0x574e41);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var sequelize=require(_0x8c97('0x1'));var moment=require(_0x8c97('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x35f7e9){var _0x371c48=['ne'];try{var _0x44d4ea=JSON['parse'](_0x35f7e9);var _0x23f5e9=Object[_0x8c97('0x3')](_0x44d4ea)[0x0];return _0x371c48[_0x8c97('0x4')](_0x23f5e9);}catch(_0x2f12fc){return![];}}function getOperatorValue(_0x426a77){var _0x2a9434=JSON[_0x8c97('0x5')](_0x426a77);var _0x524196=Object[_0x8c97('0x3')](_0x2a9434)[0x0];var _0x1b5864=_0x2a9434[_0x524196];return{['$'+_0x524196]:_0x1b5864};}exports[_0x8c97('0x6')]=function(_0x26ff40){var _0x12116e=null;if(_0x26ff40){_0x12116e=_0x26ff40[_0x8c97('0x7')](',');}return _0x12116e;};exports[_0x8c97('0x8')]=function(_0x4f2d78,_0x179342){var _0x1234d4={};if(!_[_0x8c97('0x9')](_0x4f2d78)){_[_0x8c97('0xa')](_0x4f2d78,function(_0x400eb6,_0x949a83){try{if(_0x179342){var _0x1e8182=_[_0x8c97('0xb')](_0x179342,{'name':_0x949a83})||{};if(hasSequelizeOperator(_0x400eb6)){_0x1234d4[_0x949a83]=getOperatorValue(_0x400eb6);}else if(_0x1e8182[_0x8c97('0xc')]==='DATE'&&_[_0x8c97('0xd')](_0x400eb6)){var _0x346274=JSON['parse'](_0x400eb6);var _0x31ae92={'$gte':moment(moment(_0x346274[_0x8c97('0xe')])['format'](_0x8c97('0xf')))['utc']()['format'](),'$lte':moment(moment(_0x346274['$lte'])[_0x8c97('0x10')](_0x8c97('0xf')))[_0x8c97('0x11')]()[_0x8c97('0x12')](0x1,'s')[_0x8c97('0x10')]()};_0x1234d4[_0x949a83]=_0x31ae92;}else if(_0x1e8182[_0x8c97('0x13')]===_0x8c97('0x14')){_0x1234d4[_0x949a83]=_0x400eb6;}else{_0x1234d4[_0x949a83]=_[_0x8c97('0x15')](_0x400eb6)?_0x400eb6:JSON[_0x8c97('0x5')](_0x400eb6);}}else{_0x1234d4[_0x949a83]=_['isArray'](_0x400eb6)?_0x400eb6:JSON[_0x8c97('0x5')](_0x400eb6);}}catch(_0x3f7ac7){_0x1234d4[_0x949a83]=_0x400eb6[_0x8c97('0x7')](',');}});}return _0x1234d4;};exports[_0x8c97('0x16')]=function(_0x272010){_0x272010=parseInt(_0x272010,0xa);if(!_0x272010||_0x272010<0x0){_0x272010=LIMIT_VALUE;}return _0x272010;};exports[_0x8c97('0x17')]=function(_0xb502e7){_0xb502e7=parseInt(_0xb502e7,0xa);if(!_0xb502e7||_0xb502e7<0x0){_0xb502e7=0x0;}return _0xb502e7;};exports[_0x8c97('0x18')]=function(_0x9ea046){var _0x18e6fc,_0x3bb0fa=null;if(_0x9ea046){_0x18e6fc=_0x9ea046[_0x8c97('0x7')](',');_0x3bb0fa=_[_0x8c97('0x19')](_0x18e6fc,function(_0x16e3c4){if(_0x16e3c4[_0x8c97('0x1a')]('-')===0x0){return[_0x16e3c4===_0x8c97('0x1b')?sequelize['cast'](sequelize[_0x8c97('0x1c')](_0x8c97('0x1b')),_0x8c97('0x1d')):_0x16e3c4['substr'](0x1),'DESC'];}else{return[_0x16e3c4===_0x8c97('0x1b')?sequelize['cast'](sequelize[_0x8c97('0x1c')](_0x8c97('0x1b')),_0x8c97('0x1d')):_0x16e3c4,_0x8c97('0x1e')];}});}return _0x3bb0fa;};exports[_0x8c97('0x1f')]=function(_0x42464a,_0x18c81a){if(_['isEmpty'](_0x42464a)){return _0x42464a;}if(_['isArray'](_0x42464a)){for(var _0x3804d0=0x0;_0x3804d0<_0x42464a[_0x8c97('0x20')];_0x3804d0+=0x1){_0x42464a[_0x3804d0]=this[_0x8c97('0x1f')](_0x42464a[_0x3804d0],_0x18c81a);}return _0x42464a;}if(!_['isObject'](_0x42464a)){return _0x42464a;}if(_['isString'](_0x18c81a)){_0x18c81a=[_0x18c81a];}if(!_[_0x8c97('0x15')](_0x18c81a)){return _0x42464a;}for(var _0x37986d=0x0;_0x37986d<_0x18c81a[_0x8c97('0x20')];_0x37986d+=0x1){_[_0x8c97('0x21')](_0x42464a,_0x18c81a[_0x37986d]);}for(var _0x34f8be in _0x42464a){if(_0x42464a[_0x8c97('0x22')](_0x34f8be)){_0x42464a[_0x34f8be]=this['omit'](_0x42464a[_0x34f8be],_0x18c81a);}}return _0x42464a;};exports[_0x8c97('0x23')]=function(_0x509520){return _0x509520[_0x8c97('0x24')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x8c97('0x25')]=function(_0x154592){return _0x154592['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x8c97('0x26')]=function(_0x57fef8){var _0x388931=[];_0x57fef8[_0x8c97('0x7')](/[ ,]+/)[_0x8c97('0x27')](function(_0x2ebba4){_0x2ebba4=_0x2ebba4[_0x8c97('0x28')](/([^:]")"+/g,'$1');_0x2ebba4='+'+_0x2ebba4+'*';var _0x3644dd=/[ `!@#$%^&*()_\-?~]/;if(_0x2ebba4['match'](_0x3644dd))_0x2ebba4='\x22'+_0x2ebba4+'\x22';_0x388931['push'](_0x2ebba4);});return _0x388931[_0x8c97('0x29')]('\x20');};exports[_0x8c97('0x2a')]=function(_0x2575d0,_0x54af25,_0x3cf202){var _0x5db7a4={},_0x4a4d53={};if(_0x54af25[_0x8c97('0x2b')][_0x8c97('0x2c')]){_0x54af25[_0x8c97('0x2b')]['id']=_0x54af25[_0x8c97('0x2b')][_0x8c97('0x2c')];delete _0x54af25[_0x8c97('0x2b')]['$id'];}_0x5db7a4[_0x8c97('0x2d')]=_[_0x8c97('0x19')](_0x2575d0,_0x8c97('0x13'));_0x5db7a4[_0x8c97('0x2b')]=_[_0x8c97('0x3')](_0x54af25[_0x8c97('0x2b')]);_0x5db7a4[_0x8c97('0x8')]=_[_0x8c97('0x2e')](_0x5db7a4['model'],_0x5db7a4[_0x8c97('0x2b')]);_0x4a4d53[_0x8c97('0x2f')]=_[_0x8c97('0x2e')](_0x5db7a4[_0x8c97('0x2d')],this[_0x8c97('0x6')](_0x54af25[_0x8c97('0x2b')]['fields']));_0x4a4d53[_0x8c97('0x2f')]=_0x4a4d53[_0x8c97('0x2f')][_0x8c97('0x20')]?_0x4a4d53[_0x8c97('0x2f')]:_0x5db7a4[_0x8c97('0x2d')];if(!_0x54af25[_0x8c97('0x2b')][_0x8c97('0x22')](_0x8c97('0x30'))){_0x4a4d53[_0x8c97('0x16')]=this['limit'](_0x54af25[_0x8c97('0x2b')][_0x8c97('0x16')]);_0x4a4d53[_0x8c97('0x17')]=this[_0x8c97('0x17')](_0x54af25[_0x8c97('0x2b')][_0x8c97('0x17')]);}_0x4a4d53['order']=this[_0x8c97('0x18')](_0x54af25[_0x8c97('0x2b')][_0x8c97('0x18')]);_0x4a4d53[_0x8c97('0x31')]=this[_0x8c97('0x8')](_[_0x8c97('0x32')](_0x54af25[_0x8c97('0x2b')],_0x5db7a4[_0x8c97('0x8')]),_0x2575d0);if(_0x54af25[_0x8c97('0x2b')][_0x8c97('0x33')]){var _0x3220b7=_0x2575d0;var _0x367987=_0x54af25[_0x8c97('0x2b')][_0x8c97('0x33')];if(typeof _0x367987===_0x8c97('0x34')){_0x3220b7=_[_0x8c97('0x33')](_0x2575d0,function(_0x44f204){return _[_0x8c97('0x4')](_0x367987[_0x8c97('0x35')],_0x44f204[_0x8c97('0x13')]);});_0x367987=_0x367987['value'];}_0x4a4d53[_0x8c97('0x31')]=_[_0x8c97('0x36')](_0x4a4d53[_0x8c97('0x31')],{'$or':_[_0x8c97('0x19')](_0x3220b7,function(_0x35a230){if(_0x35a230[_0x8c97('0xc')]!=='VIRTUAL'){if(_0x3cf202){return sequelize[_0x8c97('0x31')](sequelize['fn'](_0x8c97('0x37'),sequelize[_0x8c97('0x1c')](_0x35a230[_0x8c97('0x13')])),{'$like':sequelize['fn'](_0x8c97('0x37'),'%'+_0x54af25[_0x8c97('0x2b')][_0x8c97('0x33')]+'%')});}else{var _0x2c07ee={};_0x2c07ee[_0x35a230[_0x8c97('0x13')]]={'$like':'%'+_0x54af25['query'][_0x8c97('0x33')]+'%'};return _0x2c07ee;}}})});}_0x4a4d53=_[_0x8c97('0x36')]({},_0x4a4d53,_0x54af25[_0x8c97('0x38')]);return _0x4a4d53;}; \ No newline at end of file +var _0xbd51=['fields','split','isEmpty','forOwn','type','DATE','isPlainObject','parse','$gte','utc','format','$lte','subtract','name','uniqueid','isArray','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','length','isObject','isString','unset','hasOwnProperty','omit','isNumeric','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','match','push','getOptions','query','$id','filters','intersection','attributes','model','limit','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','options','lodash','moment','keys'];(function(_0x4e2689,_0x4695ca){var _0x486ff7=function(_0x5cfd75){while(--_0x5cfd75){_0x4e2689['push'](_0x4e2689['shift']());}};_0x486ff7(++_0x4695ca);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x5ce7df,_0x17402a){_0x5ce7df=_0x5ce7df-0x0;var _0x5559d7=_0xbd51[_0x5ce7df];return _0x5559d7;};'use strict';var _=require(_0x1bd5('0x0'));var sequelize=require('sequelize');var moment=require(_0x1bd5('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1c04fa){var _0x3b9f71=['ne'];try{var _0x1a9dcc=JSON['parse'](_0x1c04fa);var _0x4d1bba=Object['keys'](_0x1a9dcc)[0x0];return _0x3b9f71['includes'](_0x4d1bba);}catch(_0x3bce00){return![];}}function getOperatorValue(_0x362b24){var _0x43e6b6=JSON['parse'](_0x362b24);var _0x29abea=Object[_0x1bd5('0x2')](_0x43e6b6)[0x0];var _0x19077c=_0x43e6b6[_0x29abea];return{['$'+_0x29abea]:_0x19077c};}exports[_0x1bd5('0x3')]=function(_0xd8418f){var _0x4a7f90=null;if(_0xd8418f){_0x4a7f90=_0xd8418f[_0x1bd5('0x4')](',');}return _0x4a7f90;};exports['filters']=function(_0x2bd975,_0x28df8e){var _0x3b868a={};if(!_[_0x1bd5('0x5')](_0x2bd975)){_[_0x1bd5('0x6')](_0x2bd975,function(_0x3e3d06,_0x4c9f06){try{if(_0x28df8e){var _0x456ef8=_['find'](_0x28df8e,{'name':_0x4c9f06})||{};if(hasSequelizeOperator(_0x3e3d06)){_0x3b868a[_0x4c9f06]=getOperatorValue(_0x3e3d06);}else if(_0x456ef8[_0x1bd5('0x7')]===_0x1bd5('0x8')&&_[_0x1bd5('0x9')](_0x3e3d06)){var _0x14606b=JSON[_0x1bd5('0xa')](_0x3e3d06);var _0x81f02c={'$gte':moment(moment(_0x14606b[_0x1bd5('0xb')])['format']('YYYY-MM-DD'))[_0x1bd5('0xc')]()[_0x1bd5('0xd')](),'$lte':moment(moment(_0x14606b[_0x1bd5('0xe')])[_0x1bd5('0xd')]('YYYY-MM-DD'))['utc']()[_0x1bd5('0xf')](0x1,'s')[_0x1bd5('0xd')]()};_0x3b868a[_0x4c9f06]=_0x81f02c;}else if(_0x456ef8[_0x1bd5('0x10')]===_0x1bd5('0x11')){_0x3b868a[_0x4c9f06]=_0x3e3d06;}else{_0x3b868a[_0x4c9f06]=_[_0x1bd5('0x12')](_0x3e3d06)?_0x3e3d06:JSON[_0x1bd5('0xa')](_0x3e3d06);}}else{_0x3b868a[_0x4c9f06]=_[_0x1bd5('0x12')](_0x3e3d06)?_0x3e3d06:JSON[_0x1bd5('0xa')](_0x3e3d06);}}catch(_0x4670b5){_0x3b868a[_0x4c9f06]=_0x3e3d06['split'](',');}});}return _0x3b868a;};exports['limit']=function(_0x2fe1a1){_0x2fe1a1=parseInt(_0x2fe1a1,0xa);if(!_0x2fe1a1||_0x2fe1a1<0x0){_0x2fe1a1=LIMIT_VALUE;}return _0x2fe1a1;};exports[_0x1bd5('0x13')]=function(_0x476bd1){_0x476bd1=parseInt(_0x476bd1,0xa);if(!_0x476bd1||_0x476bd1<0x0){_0x476bd1=0x0;}return _0x476bd1;};exports[_0x1bd5('0x14')]=function(_0x459649){var _0x2ff39a,_0x3fbb39=null;if(_0x459649){_0x2ff39a=_0x459649[_0x1bd5('0x4')](',');_0x3fbb39=_[_0x1bd5('0x15')](_0x2ff39a,function(_0xb1ac1e){if(_0xb1ac1e[_0x1bd5('0x16')]('-')===0x0){return[_0xb1ac1e===_0x1bd5('0x17')?sequelize[_0x1bd5('0x18')](sequelize[_0x1bd5('0x19')](_0x1bd5('0x17')),_0x1bd5('0x1a')):_0xb1ac1e[_0x1bd5('0x1b')](0x1),_0x1bd5('0x1c')];}else{return[_0xb1ac1e==='priority'?sequelize[_0x1bd5('0x18')](sequelize['col'](_0x1bd5('0x17')),_0x1bd5('0x1a')):_0xb1ac1e,_0x1bd5('0x1d')];}});}return _0x3fbb39;};exports['omit']=function(_0x3f4156,_0x4fa37c){if(_[_0x1bd5('0x5')](_0x3f4156)){return _0x3f4156;}if(_[_0x1bd5('0x12')](_0x3f4156)){for(var _0x3dba4f=0x0;_0x3dba4f<_0x3f4156[_0x1bd5('0x1e')];_0x3dba4f+=0x1){_0x3f4156[_0x3dba4f]=this['omit'](_0x3f4156[_0x3dba4f],_0x4fa37c);}return _0x3f4156;}if(!_[_0x1bd5('0x1f')](_0x3f4156)){return _0x3f4156;}if(_[_0x1bd5('0x20')](_0x4fa37c)){_0x4fa37c=[_0x4fa37c];}if(!_[_0x1bd5('0x12')](_0x4fa37c)){return _0x3f4156;}for(var _0x3b1090=0x0;_0x3b1090<_0x4fa37c['length'];_0x3b1090+=0x1){_[_0x1bd5('0x21')](_0x3f4156,_0x4fa37c[_0x3b1090]);}for(var _0x24d4d9 in _0x3f4156){if(_0x3f4156[_0x1bd5('0x22')](_0x24d4d9)){_0x3f4156[_0x24d4d9]=this[_0x1bd5('0x23')](_0x3f4156[_0x24d4d9],_0x4fa37c);}}return _0x3f4156;};exports[_0x1bd5('0x24')]=function(_0xc73670){return _0xc73670['match'](RegExp(_0x1bd5('0x25')))?!![]:![];};exports[_0x1bd5('0x26')]=function(_0x8d53ba){return _0x8d53ba['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x1bd5('0x27')]=function(_0x32748e){var _0x345181=[];_0x32748e[_0x1bd5('0x4')](/[ ,]+/)[_0x1bd5('0x28')](function(_0x1d612b){_0x1d612b=_0x1d612b['replace'](/([^:]")"+/g,'$1');_0x1d612b='+'+_0x1d612b+'*';var _0x49ea1e=/[ `!@#$%^&*()_\-?~]/;if(_0x1d612b[_0x1bd5('0x29')](_0x49ea1e))_0x1d612b='\x22'+_0x1d612b+'\x22';_0x345181[_0x1bd5('0x2a')](_0x1d612b);});return _0x345181['join']('\x20');};exports[_0x1bd5('0x2b')]=function(_0x198b88,_0x1efa8c,_0x24dc20){var _0x558452={},_0x5d69bd={};if(_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x2d')]){_0x1efa8c[_0x1bd5('0x2c')]['id']=_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x2d')];delete _0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x2d')];}_0x558452['model']=_[_0x1bd5('0x15')](_0x198b88,_0x1bd5('0x10'));_0x558452[_0x1bd5('0x2c')]=_[_0x1bd5('0x2')](_0x1efa8c[_0x1bd5('0x2c')]);_0x558452[_0x1bd5('0x2e')]=_[_0x1bd5('0x2f')](_0x558452['model'],_0x558452[_0x1bd5('0x2c')]);_0x5d69bd[_0x1bd5('0x30')]=_[_0x1bd5('0x2f')](_0x558452[_0x1bd5('0x31')],this[_0x1bd5('0x3')](_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x3')]));_0x5d69bd['attributes']=_0x5d69bd['attributes'][_0x1bd5('0x1e')]?_0x5d69bd[_0x1bd5('0x30')]:_0x558452[_0x1bd5('0x31')];if(!_0x1efa8c['query'][_0x1bd5('0x22')]('nolimit')){_0x5d69bd[_0x1bd5('0x32')]=this[_0x1bd5('0x32')](_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x32')]);_0x5d69bd[_0x1bd5('0x13')]=this[_0x1bd5('0x13')](_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x13')]);}_0x5d69bd['order']=this[_0x1bd5('0x14')](_0x1efa8c[_0x1bd5('0x2c')]['sort']);_0x5d69bd[_0x1bd5('0x33')]=this[_0x1bd5('0x2e')](_[_0x1bd5('0x34')](_0x1efa8c['query'],_0x558452[_0x1bd5('0x2e')]),_0x198b88);if(_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x35')]){var _0x4074f1=_0x198b88;var _0x4e8ff7=_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x35')];if(typeof _0x4e8ff7===_0x1bd5('0x36')){_0x4074f1=_[_0x1bd5('0x35')](_0x198b88,function(_0x4de69a){return _['includes'](_0x4e8ff7[_0x1bd5('0x37')],_0x4de69a[_0x1bd5('0x10')]);});_0x4e8ff7=_0x4e8ff7[_0x1bd5('0x38')];}_0x5d69bd['where']=_[_0x1bd5('0x39')](_0x5d69bd[_0x1bd5('0x33')],{'$or':_['map'](_0x4074f1,function(_0x1eacac){if(_0x1eacac['type']!==_0x1bd5('0x3a')){if(_0x24dc20){return sequelize[_0x1bd5('0x33')](sequelize['fn']('lower',sequelize[_0x1bd5('0x19')](_0x1eacac[_0x1bd5('0x10')])),{'$like':sequelize['fn'](_0x1bd5('0x3b'),'%'+_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x35')]+'%')});}else{var _0x25b35a={};_0x25b35a[_0x1eacac[_0x1bd5('0x10')]]={'$like':'%'+_0x1efa8c[_0x1bd5('0x2c')][_0x1bd5('0x35')]+'%'};return _0x25b35a;}}})});}_0x5d69bd=_[_0x1bd5('0x39')]({},_0x5d69bd,_0x1efa8c[_0x1bd5('0x3c')]);return _0x5d69bd;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index e45d86a..ef317a9 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 +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(_0x2a83b9,_0x3c2d30){var _0x11cd74=function(_0x373e36){while(--_0x373e36){_0x2a83b9['push'](_0x2a83b9['shift']());}};_0x11cd74(++_0x3c2d30);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 626bfba..98d5dbf 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 _0x1382=['execSync','../environment','orderBy','length','filter','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','model','join','createHash','md5','update','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','digest','substring','crypto','child_process'];(function(_0x44fe4b,_0x2fa616){var _0x5af67b=function(_0x42dd16){while(--_0x42dd16){_0x44fe4b['push'](_0x44fe4b['shift']());}};_0x5af67b(++_0x2fa616);}(_0x1382,0x134));var _0x2138=function(_0x2f1e1d,_0xb3e2d1){_0x2f1e1d=_0x2f1e1d-0x0;var _0x2fd939=_0x1382[_0x2f1e1d];return _0x2fd939;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x2138('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0x2138('0x1'))[_0x2138('0x2')];var config=require(_0x2138('0x3'));function getInterfaces(){var _0x36cb27=[];var _0x41091a=os['networkInterfaces']();var _0x12f77c=_[_0x2138('0x4')](_['keys'](_0x41091a));for(var _0x5f1ec6=0x0;_0x5f1ec6<_0x12f77c[_0x2138('0x5')];_0x5f1ec6++){var _0x3b4306=_0x41091a[_0x12f77c[_0x5f1ec6]][_0x2138('0x6')](function(_0x2b9bc9){return _0x2b9bc9['family']==='IPv4'&&_0x2b9bc9['internal']===![];});_0x36cb27=_0x36cb27['concat'](_0x3b4306);}return _0x36cb27;}function getFirstInterface(){var _0xe2fb48=_[_0x2138('0x7')](getInterfaces());return{'macAddress':_0xe2fb48&&_0xe2fb48['mac']?_0xe2fb48[_0x2138('0x8')]:_0x2138('0x9'),'ipAddress':_0xe2fb48&&_0xe2fb48['address']?_0xe2fb48[_0x2138('0xa')]:_0x2138('0xb')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x480c5d=_[_0x2138('0x4')](os[_0x2138('0xc')]()['map'](function(_0x4a6289){return _0x4a6289[_0x2138('0xd')];}))[_0x2138('0xe')](':');return crypto[_0x2138('0xf')](_0x2138('0x10'))[_0x2138('0x11')](_0x480c5d)['digest'](_0x2138('0x12'));}exports[_0x2138('0x13')]=function(){var _0x10ed87=os[_0x2138('0x14')]();var _0x352e08=/[0-9a-f-]{36}/;if(config[_0x2138('0x15')]&&_0x352e08[_0x2138('0x16')](config[_0x2138('0x15')])){return config[_0x2138('0x15')];}else if(_0x10ed87===_0x2138('0x17')){return exec(_0x2138('0x18'),{'encoding':_0x2138('0x19')})['replace']('\x0d\x0a','');}else{var _0xc5dfee=getFirstInterface();var _0x35d960=getCPUhash();var _0x3dab93=_0x35d960+'|'+os[_0x2138('0x1a')]()+'|'+_0xc5dfee[_0x2138('0x1b')]+'|'+_0xc5dfee[_0x2138('0x1c')];var _0x3ce740=crypto['createHash']('md5')['update'](_0x3dab93)[_0x2138('0x1d')]('hex');return _0x3ce740['substring'](0x0,0x8)+'-'+_0x3ce740[_0x2138('0x1e')](0x8,0xc)+'-'+_0x3ce740['substring'](0xc,0x10)+'-'+_0x3ce740[_0x2138('0x1e')](0x10,0x14)+'-'+_0x3ce740[_0x2138('0x1e')](0x14);}}; \ No newline at end of file +var _0x237c=['utf8','macAddress','md5','substring','lodash','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','127.0.0.1','getFirstInterface','cpus','map','model','join','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid'];(function(_0x33c6c7,_0x4e96e0){var _0x154871=function(_0x6df8e5){while(--_0x6df8e5){_0x33c6c7['push'](_0x33c6c7['shift']());}};_0x154871(++_0x4e96e0);}(_0x237c,0x10c));var _0xc237=function(_0x1a1a26,_0x4a5702){_0x1a1a26=_0x1a1a26-0x0;var _0x1d54d8=_0x237c[_0x1a1a26];return _0x1d54d8;};'use strict';var _=require(_0xc237('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xc237('0x1'));var exec=require(_0xc237('0x2'))[_0xc237('0x3')];var config=require('../environment');function getInterfaces(){var _0x1d1614=[];var _0x4fe5a2=os[_0xc237('0x4')]();var _0x533fad=_[_0xc237('0x5')](_[_0xc237('0x6')](_0x4fe5a2));for(var _0x19b8de=0x0;_0x19b8de<_0x533fad[_0xc237('0x7')];_0x19b8de++){var _0x14d0a4=_0x4fe5a2[_0x533fad[_0x19b8de]][_0xc237('0x8')](function(_0x48547f){return _0x48547f[_0xc237('0x9')]===_0xc237('0xa')&&_0x48547f[_0xc237('0xb')]===![];});_0x1d1614=_0x1d1614[_0xc237('0xc')](_0x14d0a4);}return _0x1d1614;}function getFirstInterface(){var _0x5730aa=_[_0xc237('0xd')](getInterfaces());return{'macAddress':_0x5730aa&&_0x5730aa[_0xc237('0xe')]?_0x5730aa[_0xc237('0xe')]:'00:00:00:00:00:00','ipAddress':_0x5730aa&&_0x5730aa['address']?_0x5730aa['address']:_0xc237('0xf')};}exports[_0xc237('0x10')]=getFirstInterface;function getCPUhash(){var _0x56932e=_['orderBy'](os[_0xc237('0x11')]()[_0xc237('0x12')](function(_0x14260d){return _0x14260d[_0xc237('0x13')];}))[_0xc237('0x14')](':');return crypto['createHash']('md5')[_0xc237('0x15')](_0x56932e)[_0xc237('0x16')]('hex');}exports[_0xc237('0x17')]=function(){var _0x3954a1=os[_0xc237('0x18')]();var _0x307c8e=/[0-9a-f-]{36}/;if(config[_0xc237('0x19')]&&_0x307c8e[_0xc237('0x1a')](config['licenseToken'])){return config[_0xc237('0x19')];}else if(_0x3954a1===_0xc237('0x1b')){return exec(_0xc237('0x1c'),{'encoding':_0xc237('0x1d')})['replace']('\x0d\x0a','');}else{var _0x52fe98=getFirstInterface();var _0x4ee66c=getCPUhash();var _0x186aad=_0x4ee66c+'|'+os['hostname']()+'|'+_0x52fe98[_0xc237('0x1e')]+'|'+_0x52fe98['ipAddress'];var _0x13c396=crypto['createHash'](_0xc237('0x1f'))['update'](_0x186aad)['digest']('hex');return _0x13c396[_0xc237('0x20')](0x0,0x8)+'-'+_0x13c396['substring'](0x8,0xc)+'-'+_0x13c396[_0xc237('0x20')](0xc,0x10)+'-'+_0x13c396[_0xc237('0x20')](0x10,0x14)+'-'+_0x13c396[_0xc237('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 35289d8..c0d8dc6 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 _0xcd65=['message','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','version','GET','then','get','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','format','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','catch','error'];(function(_0x15ad97,_0x1486b3){var _0x4089a7=function(_0x320200){while(--_0x320200){_0x15ad97['push'](_0x15ad97['shift']());}};_0x4089a7(++_0x1486b3);}(_0xcd65,0xd2));var _0x5cd6=function(_0x2f16e5,_0x2e75e0){_0x2f16e5=_0x2f16e5-0x0;var _0x5d082a=_0xcd65[_0x2f16e5];return _0x5d082a;};'use strict';var util=require(_0x5cd6('0x0'));var moment=require(_0x5cd6('0x1'));var rp=require(_0x5cd6('0x2'));var BPromise=require(_0x5cd6('0x3'));var pkginfo=require(_0x5cd6('0x4'))(module,'version');var db=require(_0x5cd6('0x5'))['db'];var encryptor=require(_0x5cd6('0x6'));var hardware=require(_0x5cd6('0x7'));var logger=require(_0x5cd6('0x8'))(_0x5cd6('0x9'));var HOST=_0x5cd6('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x41288d){return new BPromise(function(_0x243cd3,_0x5222de){var _0x51580b=util['format'](_0x5cd6('0xb'),HOST,_0x41288d,module[_0x5cd6('0xc')][_0x5cd6('0xd')]);if(oldToken){_0x51580b=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x41288d,module[_0x5cd6('0xc')]['version'],oldToken);}var _0x100a05={'uri':_0x51580b,'method':_0x5cd6('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x100a05)[_0x5cd6('0xf')](function(_0x35fe57){_0x243cd3(_0x35fe57);})['catch'](function(_0xb22bd1){_0x5222de(_0xb22bd1);});});}function manageLicense(_0x4b0d8e,_0x44dd28){var _0xcfbad3=_0x44dd28[_0x5cd6('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0xcfbad3[_0x5cd6('0x11')]!==_0x4b0d8e&&!_0xcfbad3['data2']){oldToken=_0xcfbad3['data1'];}httpRequest(_0x4b0d8e)[_0x5cd6('0xf')](function(_0x512fb0){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x512fb0[_0x5cd6('0x12')]){isOldTokenSent=![];if(!_0xcfbad3[_0x5cd6('0x9')]&&_0xcfbad3[_0x5cd6('0x9')]!=_0x512fb0[_0x5cd6('0x9')]||_0xcfbad3['license']&&_0xcfbad3['data2']){logger[_0x5cd6('0x13')](_0x5cd6('0x14'));}if(_0xcfbad3[_0x5cd6('0x9')]&&!_0xcfbad3[_0x5cd6('0x15')]&&_0xcfbad3[_0x5cd6('0x9')]!=_0x512fb0[_0x5cd6('0x9')]){logger[_0x5cd6('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0xcfbad3[_0x5cd6('0x9')]&&!_0xcfbad3[_0x5cd6('0x15')]&&_0xcfbad3['license']==_0x512fb0[_0x5cd6('0x9')]){return _0x44dd28;}return _0x44dd28[_0x5cd6('0x16')]({'data1':_0x4b0d8e,'data2':null,'license':_0x512fb0[_0x5cd6('0x9')]});}else{if(_0x512fb0[_0x5cd6('0x9')]||_0xcfbad3[_0x5cd6('0x9')]){if(!_0xcfbad3[_0x5cd6('0x15')]){if(_0xcfbad3[_0x5cd6('0x11')]==_0x4b0d8e){GRAY_PERIOD_REASON=_0x5cd6('0x17');logger[_0x5cd6('0x13')](_0x5cd6('0x18'));}else{GRAY_PERIOD_REASON=_0x5cd6('0x19');logger[_0x5cd6('0x13')](_0x5cd6('0x1a'),_0xcfbad3[_0x5cd6('0x11')],_0x4b0d8e);}logger[_0x5cd6('0x13')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x5cd6('0x1b')](),moment()[_0x5cd6('0x1c')]('YYYY-MM-DD\x20HH:mm'));return _0x44dd28[_0x5cd6('0x16')]({'data2':encryptor['encryptString'](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x5cd6('0x1d')](encryptor[_0x5cd6('0x1e')](_0xcfbad3[_0x5cd6('0x15')]),_0x5cd6('0x1f'))>DAYS){logger[_0x5cd6('0x13')](_0x5cd6('0x20'),moment()[_0x5cd6('0x1c')](_0x5cd6('0x21')));isOldTokenSent=![];return _0x44dd28['update']({'data1':_0x4b0d8e,'data2':null,'license':null});}}}else{if(_0xcfbad3[_0x5cd6('0x11')]!=_0x4b0d8e){logger[_0x5cd6('0x13')](_0x5cd6('0x1a'),_0xcfbad3[_0x5cd6('0x11')],_0x4b0d8e);return _0x44dd28[_0x5cd6('0x16')]({'data1':_0x4b0d8e,'data2':null,'license':null});}}}return _0x44dd28;})[_0x5cd6('0xf')](function(_0x3270b2){_0x44dd28=_0x3270b2;})[_0x5cd6('0x22')](function(_0x2c9b2c){logger[_0x5cd6('0x23')](_0x2c9b2c[_0x5cd6('0x24')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x44dd28);},TIME);});}function defaultLicense(){var _0x1e6a98=hardware[_0x5cd6('0x25')]();if(_0x1e6a98){return db['License'][_0x5cd6('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x1e6a98}})['spread'](function(_0x178dcb,_0x428dcd){logger['info'](_0x5cd6('0x27'),_0x1e6a98);manageLicense(_0x1e6a98,_0x178dcb);})[_0x5cd6('0x22')](function(_0x2e5ff0){logger['error'](_0x2e5ff0[_0x5cd6('0x24')]);});}}exports[_0x5cd6('0x28')]=defaultLicense; \ No newline at end of file +var _0x0c48=['Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','message','finally','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','request-promise','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data1','data2','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update'];(function(_0x14c635,_0x273b62){var _0x45456e=function(_0x20220f){while(--_0x20220f){_0x14c635['push'](_0x14c635['shift']());}};_0x45456e(++_0x273b62);}(_0x0c48,0xfb));var _0x80c4=function(_0x265772,_0x47fd5d){_0x265772=_0x265772-0x0;var _0x1402ab=_0x0c48[_0x265772];return _0x1402ab;};'use strict';var util=require(_0x80c4('0x0'));var moment=require('moment');var rp=require(_0x80c4('0x1'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0x80c4('0x2'));var hardware=require(_0x80c4('0x3'));var logger=require(_0x80c4('0x4'))('license');var HOST=_0x80c4('0x5');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1e20c3){return new BPromise(function(_0x4487d6,_0x16ff21){var _0x2c1013=util[_0x80c4('0x6')](_0x80c4('0x7'),HOST,_0x1e20c3,module[_0x80c4('0x8')][_0x80c4('0x9')]);if(oldToken){_0x2c1013=util[_0x80c4('0x6')](_0x80c4('0xa'),HOST,_0x1e20c3,module[_0x80c4('0x8')][_0x80c4('0x9')],oldToken);}var _0x309168={'uri':_0x2c1013,'method':_0x80c4('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x309168)[_0x80c4('0xc')](function(_0x1dea53){_0x4487d6(_0x1dea53);})['catch'](function(_0x375c28){_0x16ff21(_0x375c28);});});}function manageLicense(_0x495f2e,_0x553319){var _0x50c43=_0x553319[_0x80c4('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x50c43[_0x80c4('0xe')]!==_0x495f2e&&!_0x50c43[_0x80c4('0xf')]){oldToken=_0x50c43[_0x80c4('0xe')];}httpRequest(_0x495f2e)[_0x80c4('0xc')](function(_0x352a6f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x352a6f[_0x80c4('0x10')]){isOldTokenSent=![];if(!_0x50c43[_0x80c4('0x11')]&&_0x50c43[_0x80c4('0x11')]!=_0x352a6f[_0x80c4('0x11')]||_0x50c43[_0x80c4('0x11')]&&_0x50c43[_0x80c4('0xf')]){logger[_0x80c4('0x12')](_0x80c4('0x13'));}if(_0x50c43[_0x80c4('0x11')]&&!_0x50c43[_0x80c4('0xf')]&&_0x50c43[_0x80c4('0x11')]!=_0x352a6f['license']){logger[_0x80c4('0x12')](_0x80c4('0x14'));}if(_0x50c43[_0x80c4('0x11')]&&!_0x50c43[_0x80c4('0xf')]&&_0x50c43['license']==_0x352a6f[_0x80c4('0x11')]){return _0x553319;}return _0x553319[_0x80c4('0x15')]({'data1':_0x495f2e,'data2':null,'license':_0x352a6f[_0x80c4('0x11')]});}else{if(_0x352a6f[_0x80c4('0x11')]||_0x50c43['license']){if(!_0x50c43[_0x80c4('0xf')]){if(_0x50c43['data1']==_0x495f2e){GRAY_PERIOD_REASON=_0x80c4('0x16');logger[_0x80c4('0x12')](_0x80c4('0x17'));}else{GRAY_PERIOD_REASON=_0x80c4('0x18');logger[_0x80c4('0x12')](_0x80c4('0x19'),_0x50c43[_0x80c4('0xe')],_0x495f2e);}logger['info'](_0x80c4('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x80c4('0x6')](_0x80c4('0x1b')));return _0x553319[_0x80c4('0x15')]({'data2':encryptor[_0x80c4('0x1c')](moment()['format'](_0x80c4('0x1b')))});}else{if(moment()[_0x80c4('0x1d')](encryptor['decryptString'](_0x50c43[_0x80c4('0xf')]),_0x80c4('0x1e'))>DAYS){logger[_0x80c4('0x12')](_0x80c4('0x1f'),moment()['format'](_0x80c4('0x1b')));isOldTokenSent=![];return _0x553319[_0x80c4('0x15')]({'data1':_0x495f2e,'data2':null,'license':null});}}}else{if(_0x50c43['data1']!=_0x495f2e){logger['info'](_0x80c4('0x19'),_0x50c43[_0x80c4('0xe')],_0x495f2e);return _0x553319[_0x80c4('0x15')]({'data1':_0x495f2e,'data2':null,'license':null});}}}return _0x553319;})[_0x80c4('0xc')](function(_0xca76a6){_0x553319=_0xca76a6;})['catch'](function(_0x4549eb){logger['error'](_0x4549eb[_0x80c4('0x20')]);})[_0x80c4('0x21')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x553319);},TIME);});}function defaultLicense(){var _0x463457=hardware['getUuid']();if(_0x463457){return db[_0x80c4('0x22')][_0x80c4('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x463457}})['spread'](function(_0x536943,_0x10ab55){logger['info'](_0x80c4('0x24'),_0x463457);manageLicense(_0x463457,_0x536943);})['catch'](function(_0x58df6d){logger[_0x80c4('0x25')](_0x58df6d[_0x80c4('0x20')]);});}}exports[_0x80c4('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index c52b7b8..9b9f46e 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 _0xe18f=['License\x20limit\x20reached\x20for\x20telephones','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','2027-01-01T00:00:00.000Z','getUuid','License','find','then','catch','uuid','License\x20key\x20value\x20not\x20found','data1','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','grayReason','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','countBy','telephone','License\x20limit\x20reached\x20for\x20users'];(function(_0x3b2a55,_0x3ef39c){var _0x2062b0=function(_0x2cea47){while(--_0x2cea47){_0x3b2a55['push'](_0x3b2a55['shift']());}};_0x2062b0(++_0x3ef39c);}(_0xe18f,0x17b));var _0xfe18=function(_0x1edd7f,_0x2c4955){_0x1edd7f=_0x1edd7f-0x0;var _0x267ad0=_0xe18f[_0x1edd7f];return _0x267ad0;};'use strict';var util=require('util');var _=require(_0xfe18('0x0'));var moment=require(_0xfe18('0x1'));var BPromise=require(_0xfe18('0x2'));var hardware=require(_0xfe18('0x3'));var encryptor=require(_0xfe18('0x4'));var db=require(_0xfe18('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':_0xfe18('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xfe18('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xfe18('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x424659){return new BPromise(function(_0x1a0348,_0x1ad053){return db[_0xfe18('0x9')][_0xfe18('0xa')](_['defaults'](_0x424659,{'raw':!![],'where':{'id':0x1}}))[_0xfe18('0xb')](function(_0x33bf57){return checkLicense(_0x33bf57,null);})[_0xfe18('0xb')](function(_0x244f23){_0x1a0348(_0x244f23);return;})[_0xfe18('0xc')](function(_0x258084){_0x1ad053(_0x258084);});});}function checkLicense(_0x5e8964,_0x301151){if(!_0x5e8964){demoLicense[_0xfe18('0xd')]=_0x5e8964['data1'];return demoLicense;}try{var _0x28c2d9=_0x301151||_0x5e8964['license'];if(_['isEmpty'](_0x28c2d9)){throw new Error(_0xfe18('0xe'));}var _0x3689f9=_0x5e8964[_0xfe18('0xf')];var _0x69b600=_0x5e8964['data2'];var _0x1a1ba7=_0x3689f9[_0xfe18('0x10')]('-')[0x4];var _0x14d23e=_0x3689f9['split']('-')[0x0];var _0x50b358=encryptor[_0xfe18('0x11')](_0x28c2d9,util[_0xfe18('0x12')](_0xfe18('0x13'),_0x1a1ba7,_0x3689f9,_0x14d23e));var _0xe11906=JSON[_0xfe18('0x14')](_0x50b358);_0xe11906[_0xfe18('0x15')]=![];_0xe11906[_0xfe18('0xd')]=_0x3689f9;_0xe11906[_0xfe18('0x16')]=hardware[_0xfe18('0x8')]();if(_0x69b600){var _0x444030=encryptor[_0xfe18('0x11')](_0x69b600);_0xe11906[_0xfe18('0x17')]=_0x444030;_0xe11906[_0xfe18('0x18')]=moment(_0x444030)[_0xfe18('0x19')](0x7,'days')[_0xfe18('0x12')]();_0xe11906[_0xfe18('0x1a')]=_0xe11906['uuid']!=_0xe11906['machineUuid']?'changed':_0xfe18('0x1b');}return _0xe11906;}catch(_0x17488c){breakingLicense[_0xfe18('0xd')]=_0x5e8964[_0xfe18('0xf')];breakingLicense[_0xfe18('0x1c')]=_0x17488c[_0xfe18('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3ef7fe,_0x505dc3){getLicense()[_0xfe18('0xb')](function(_0xa50c1c){return db[_0xfe18('0x1d')][_0xfe18('0x1e')]({'attributes':[_0xfe18('0x1f'),[db[_0xfe18('0x20')]['fn'](_0xfe18('0x21'),db[_0xfe18('0x20')][_0xfe18('0x22')]('role')),_0xfe18('0x23')]],'group':_0xfe18('0x1f'),'where':{'role':{'$or':[_0xfe18('0x24'),_0xfe18('0x25'),'telephone']}},'raw':!![]})['then'](function(_0x26fbee){var _0x48dbc5={'user':_0xa50c1c['users']||0x0,'telephone':_0xa50c1c['telephones']||0x0};_0x26fbee['forEach'](function(_0x182a44){var _0x196d21=_0x182a44[_0xfe18('0x1f')]===_0xfe18('0x24')?_0xfe18('0x25'):_0x182a44[_0xfe18('0x1f')];_0x48dbc5[_0x196d21]-=_0x182a44[_0xfe18('0x23')];if(_0x48dbc5[_0x196d21]<0x0)_0x48dbc5[_0x196d21]=0x0;});_0x3ef7fe(_0x48dbc5);return;});})['catch'](function(_0x5e97f1){_0x505dc3(_0x5e97f1);});});}function checkUserLimits(_0x926f60){return new BPromise(function(_0x1a9b06,_0x204a5a){getLimits()[_0xfe18('0xb')](function(_0x541fcd){var _0x1c692d=_['pick'](_[_0xfe18('0x26')](_0x926f60,_0xfe18('0x1f')),['admin','user','telephone']);var _0x3032f=(_0x1c692d[_0xfe18('0x24')]||0x0)+(_0x1c692d[_0xfe18('0x25')]||0x0);var _0x2bb5e7=_0x1c692d[_0xfe18('0x27')]||0x0;if(_0x3032f>_0x541fcd[_0xfe18('0x25')])return _0x204a5a(_0xfe18('0x28'));if(_0x2bb5e7>_0x541fcd[_0xfe18('0x27')])return _0x204a5a(_0xfe18('0x29'));return _0x1a9b06();})['catch'](function(_0x5681db){_0x204a5a(_0x5681db);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xad04=['grayReason','machineUuid','disabled','findAll','sequelize','COUNT','col','role','count','admin','user','telephone','users','telephones','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','%s:%s:%s','parse','demo','gray','add','days','format'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xad04,0x70));var _0x4ad0=function(_0x77bc17,_0x420f6e){_0x77bc17=_0x77bc17-0x0;var _0x39240d=_0xad04[_0x77bc17];return _0x39240d;};'use strict';var util=require(_0x4ad0('0x0'));var _=require(_0x4ad0('0x1'));var moment=require('moment');var BPromise=require(_0x4ad0('0x2'));var hardware=require(_0x4ad0('0x3'));var encryptor=require(_0x4ad0('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4ad0('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x4ad0('0x6'),'machineUuid':hardware[_0x4ad0('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4ad0('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x4ad0('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x21f720){return new BPromise(function(_0x4f7051,_0x58a2f2){return db[_0x4ad0('0x8')][_0x4ad0('0x9')](_[_0x4ad0('0xa')](_0x21f720,{'raw':!![],'where':{'id':0x1}}))[_0x4ad0('0xb')](function(_0x133a69){return checkLicense(_0x133a69,null);})[_0x4ad0('0xb')](function(_0x49c0c6){_0x4f7051(_0x49c0c6);return;})['catch'](function(_0x307cea){_0x58a2f2(_0x307cea);});});}function checkLicense(_0x1e3774,_0x448ad2){if(!_0x1e3774){demoLicense[_0x4ad0('0xc')]=_0x1e3774[_0x4ad0('0xd')];return demoLicense;}try{var _0x55128d=_0x448ad2||_0x1e3774[_0x4ad0('0xe')];if(_[_0x4ad0('0xf')](_0x55128d)){throw new Error(_0x4ad0('0x10'));}var _0x18c294=_0x1e3774[_0x4ad0('0xd')];var _0x264c0e=_0x1e3774['data2'];var _0x3386ac=_0x18c294[_0x4ad0('0x11')]('-')[0x4];var _0x136fb0=_0x18c294[_0x4ad0('0x11')]('-')[0x0];var _0x390ac3=encryptor[_0x4ad0('0x12')](_0x55128d,util['format'](_0x4ad0('0x13'),_0x3386ac,_0x18c294,_0x136fb0));var _0x260888=JSON[_0x4ad0('0x14')](_0x390ac3);_0x260888[_0x4ad0('0x15')]=![];_0x260888[_0x4ad0('0xc')]=_0x18c294;_0x260888['machineUuid']=hardware[_0x4ad0('0x7')]();if(_0x264c0e){var _0x2a0bf1=encryptor[_0x4ad0('0x12')](_0x264c0e);_0x260888[_0x4ad0('0x16')]=_0x2a0bf1;_0x260888['deadline']=moment(_0x2a0bf1)[_0x4ad0('0x17')](0x7,_0x4ad0('0x18'))[_0x4ad0('0x19')]();_0x260888[_0x4ad0('0x1a')]=_0x260888[_0x4ad0('0xc')]!=_0x260888[_0x4ad0('0x1b')]?'changed':_0x4ad0('0x1c');}return _0x260888;}catch(_0x399593){breakingLicense['uuid']=_0x1e3774['data1'];breakingLicense['message']=_0x399593['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x570169,_0x1fb006){getLicense()[_0x4ad0('0xb')](function(_0x45fc41){return db['User'][_0x4ad0('0x1d')]({'attributes':['role',[db[_0x4ad0('0x1e')]['fn'](_0x4ad0('0x1f'),db['sequelize'][_0x4ad0('0x20')](_0x4ad0('0x21'))),_0x4ad0('0x22')]],'group':_0x4ad0('0x21'),'where':{'role':{'$or':[_0x4ad0('0x23'),_0x4ad0('0x24'),_0x4ad0('0x25')]}},'raw':!![]})[_0x4ad0('0xb')](function(_0xf7de14){var _0x69ed1={'user':_0x45fc41[_0x4ad0('0x26')]||0x0,'telephone':_0x45fc41[_0x4ad0('0x27')]||0x0};_0xf7de14[_0x4ad0('0x28')](function(_0x181fcf){var _0x50278a=_0x181fcf[_0x4ad0('0x21')]===_0x4ad0('0x23')?_0x4ad0('0x24'):_0x181fcf['role'];_0x69ed1[_0x50278a]-=_0x181fcf[_0x4ad0('0x22')];if(_0x69ed1[_0x50278a]<0x0)_0x69ed1[_0x50278a]=0x0;});_0x570169(_0x69ed1);return;});})[_0x4ad0('0x29')](function(_0x5eae03){_0x1fb006(_0x5eae03);});});}function checkUserLimits(_0x2e8f04){return new BPromise(function(_0x43abb5,_0x3dfaa5){getLimits()[_0x4ad0('0xb')](function(_0x502e68){var _0x1928db=_[_0x4ad0('0x2a')](_[_0x4ad0('0x2b')](_0x2e8f04,'role'),['admin',_0x4ad0('0x24'),'telephone']);var _0x250a10=(_0x1928db[_0x4ad0('0x23')]||0x0)+(_0x1928db[_0x4ad0('0x24')]||0x0);var _0x562f7d=_0x1928db[_0x4ad0('0x25')]||0x0;if(_0x250a10>_0x502e68[_0x4ad0('0x24')])return _0x3dfaa5(_0x4ad0('0x2c'));if(_0x562f7d>_0x502e68[_0x4ad0('0x25')])return _0x3dfaa5('License\x20limit\x20reached\x20for\x20telephones');return _0x43abb5();})['catch'](function(_0x3800c7){_0x3dfaa5(_0x3800c7);});});}module[_0x4ad0('0x2d')]={'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 5130355..bc56f2e 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 _0xeb3b=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x4fbaa6,_0x87249f){var _0xc9f091=function(_0x3b2099){while(--_0x3b2099){_0x4fbaa6['push'](_0x4fbaa6['shift']());}};_0xc9f091(++_0x87249f);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x53ed5f,_0x3d5a61){_0x53ed5f=_0x53ed5f-0x0;var _0x2ca18d=_0xeb3b[_0x53ed5f];return _0x2ca18d;};'use strict';module[_0xbeb3('0x0')]={'DOMAIN':_0xbeb3('0x1'),'SESSION_SECRET':_0xbeb3('0x2'),'GOOGLE_ID':_0xbeb3('0x3'),'GOOGLE_SECRET':_0xbeb3('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x4e2e=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x1aad4d,_0x44b048){_0x1aad4d=_0x1aad4d-0x0;var _0x5b5fa8=_0x4e2e[_0x1aad4d];return _0x5b5fa8;};'use strict';module['exports']={'DOMAIN':_0xe4e2('0x0'),'SESSION_SECRET':_0xe4e2('0x1'),'GOOGLE_ID':_0xe4e2('0x2'),'GOOGLE_SECRET':_0xe4e2('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 87cefac..a4e28fe 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf52a=['../utils/loggers','fileLogger','exports'];(function(_0x408130,_0x5e9764){var _0x305b96=function(_0x1abfbc){while(--_0x1abfbc){_0x408130['push'](_0x408130['shift']());}};_0x305b96(++_0x5e9764);}(_0xf52a,0xcf));var _0xaf52=function(_0x254b98,_0x56ddb4){_0x254b98=_0x254b98-0x0;var _0x236e77=_0xf52a[_0x254b98];return _0x236e77;};'use strict';var fileLogger=require(_0xaf52('0x0'))[_0xaf52('0x1')];module[_0xaf52('0x2')]=fileLogger; \ No newline at end of file +var _0x1e80=['../utils/loggers','fileLogger'];(function(_0x43269b,_0xa49bc){var _0x23c40f=function(_0x27e6cd){while(--_0x27e6cd){_0x43269b['push'](_0x43269b['shift']());}};_0x23c40f(++_0xa49bc);}(_0x1e80,0xa2));var _0x01e8=function(_0xbb758f,_0x8c3678){_0xbb758f=_0xbb758f-0x0;var _0x5938d9=_0x1e80[_0xbb758f];return _0x5938d9;};'use strict';var fileLogger=require(_0x01e8('0x0'))[_0x01e8('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index c2e272f..3e2d0df 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 _0x02c9=['../../services/routing/index.js','xdr','../../services/xdr/index.js','path','join','../../services/ami/index.js','agi','../../services/agi/index.js','email'];(function(_0x5a3c69,_0x2fb527){var _0x68818f=function(_0x5511ab){while(--_0x5511ab){_0x5a3c69['push'](_0x5a3c69['shift']());}};_0x68818f(++_0x2fb527);}(_0x02c9,0x8a));var _0x902c=function(_0x220b00,_0x283aa0){_0x220b00=_0x220b00-0x0;var _0x7f3e2f=_0x02c9[_0x220b00];return _0x7f3e2f;};'use strict';var path=require(_0x902c('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x902c('0x1')](__dirname,'../../services/express/index.js')},{'name':'ami','script':path[_0x902c('0x1')](__dirname,_0x902c('0x2'))},{'name':_0x902c('0x3'),'script':path[_0x902c('0x1')](__dirname,_0x902c('0x4'))},{'name':_0x902c('0x5'),'script':path[_0x902c('0x1')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path['join'](__dirname,_0x902c('0x6'))},{'name':_0x902c('0x7'),'script':path[_0x902c('0x1')](__dirname,_0x902c('0x8'))}]};module['exports']=config; \ No newline at end of file +var _0x359d=['xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','../../services/ami/index.js','agi','routing','../../services/routing/index.js'];(function(_0x5ded37,_0x250406){var _0x1f54a6=function(_0x37d7ba){while(--_0x37d7ba){_0x5ded37['push'](_0x5ded37['shift']());}};_0x1f54a6(++_0x250406);}(_0x359d,0x1e7));var _0xd359=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0x359d[_0x27d958];return _0x53e63e;};'use strict';var path=require(_0xd359('0x0'));var os=require('os');var config={'apps':[{'name':_0xd359('0x1'),'script':path[_0xd359('0x2')](__dirname,_0xd359('0x3'))},{'name':'ami','script':path['join'](__dirname,_0xd359('0x4'))},{'name':_0xd359('0x5'),'script':path[_0xd359('0x2')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0xd359('0x6'),'script':path[_0xd359('0x2')](__dirname,_0xd359('0x7'))},{'name':_0xd359('0x8'),'script':path[_0xd359('0x2')](__dirname,_0xd359('0x9'))}]};module[_0xd359('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 053c434..afb8f14 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 _0xe82d=['list','describe','delete','dump','saved','pm2','./config','connect','connected','start','then','stop','restart','disconnect'];(function(_0x326fb1,_0x4f9058){var _0x3ab11b=function(_0x3527e4){while(--_0x3527e4){_0x326fb1['push'](_0x326fb1['shift']());}};_0x3ab11b(++_0x4f9058);}(_0xe82d,0x75));var _0xde82=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xe82d[_0x55abd9];return _0x3e5669;};'use strict';var pm2=require(_0xde82('0x0'));var BPromise=require('bluebird');var config=require(_0xde82('0x1'));function connect(){return new BPromise(function(_0x324443,_0x1a51d9){return pm2[_0xde82('0x2')](function(_0x4f89a7){if(_0x4f89a7){return _0x1a51d9(_0x4f89a7);}return _0x324443(_0xde82('0x3'));});});};exports[_0xde82('0x4')]=function(_0x44077d){return connect()[_0xde82('0x5')](function(){return new BPromise(function(_0x254427,_0x22215e){return pm2['start'](_0x44077d,function(_0x3cd9af,_0x4375f0){if(_0x3cd9af){return _0x22215e(_0x3cd9af);}pm2['disconnect']();return _0x254427(_0x4375f0);});});});};exports['stop']=function(_0x31acf0){return connect()[_0xde82('0x5')](function(){return new BPromise(function(_0x51d9d2,_0x385642){return pm2[_0xde82('0x6')](_0x31acf0,function(_0x2786cb,_0x1a5c48){if(_0x2786cb){return _0x385642(_0x2786cb);}pm2['disconnect']();return _0x51d9d2(_0x1a5c48);});});});};exports[_0xde82('0x7')]=function(_0x4c505a){return connect()[_0xde82('0x5')](function(){return new BPromise(function(_0x24b7fe,_0x741124){return pm2[_0xde82('0x7')](_0x4c505a,function(_0xeb43d1,_0x334106){if(_0xeb43d1){return _0x741124(_0xeb43d1);}pm2[_0xde82('0x8')]();return _0x24b7fe(_0x334106);});});});};exports[_0xde82('0x9')]=function(){return connect()[_0xde82('0x5')](function(){return new BPromise(function(_0x5b11aa,_0x8d828b){return pm2[_0xde82('0x9')](function(_0x1c6bdc,_0x37a349){if(_0x1c6bdc){return _0x8d828b(_0x1c6bdc);}pm2[_0xde82('0x8')]();return _0x5b11aa(_0x37a349);});});});};exports[_0xde82('0xa')]=function(_0x436917){return connect()[_0xde82('0x5')](function(){return new BPromise(function(_0x1ad399,_0x37ae7f){return pm2[_0xde82('0xa')](_0x436917,function(_0x2e2a6c,_0x3dc47c){if(_0x2e2a6c){return _0x37ae7f(_0x2e2a6c);}pm2['disconnect']();return _0x1ad399(_0x3dc47c);});});});};exports[_0xde82('0xb')]=function(_0x147e64){return connect()[_0xde82('0x5')](function(){return new BPromise(function(_0xc285af,_0x51d4a8){return pm2['delete'](_0x147e64,function(_0x33293b,_0x5a1b7f){if(_0x33293b){return _0x51d4a8(_0x33293b);}pm2['disconnect']();return _0xc285af(_0x5a1b7f);});});});};exports[_0xde82('0xc')]=function(){return connect()[_0xde82('0x5')](function(){return new BPromise(function(_0x17c5b5,_0x52ddf6){return pm2['dump'](function(_0x19182f){if(_0x19182f){return _0x52ddf6(_0x19182f);}return _0x17c5b5(_0xde82('0xd'));});});});}; \ No newline at end of file +var _0x12cf=['bluebird','./config','connect','connected','then','stop','restart','disconnect','list','describe','delete','dump','pm2'];(function(_0x50805a,_0x1fbc61){var _0x5d59ef=function(_0x4625e8){while(--_0x4625e8){_0x50805a['push'](_0x50805a['shift']());}};_0x5d59ef(++_0x1fbc61);}(_0x12cf,0x67));var _0xf12c=function(_0xcf29ce,_0x54fb3c){_0xcf29ce=_0xcf29ce-0x0;var _0x2438c1=_0x12cf[_0xcf29ce];return _0x2438c1;};'use strict';var pm2=require(_0xf12c('0x0'));var BPromise=require(_0xf12c('0x1'));var config=require(_0xf12c('0x2'));function connect(){return new BPromise(function(_0x1cf1f9,_0x195595){return pm2[_0xf12c('0x3')](function(_0x4e07e7){if(_0x4e07e7){return _0x195595(_0x4e07e7);}return _0x1cf1f9(_0xf12c('0x4'));});});};exports['start']=function(_0x282674){return connect()[_0xf12c('0x5')](function(){return new BPromise(function(_0x86760a,_0x4623c2){return pm2['start'](_0x282674,function(_0x5531e9,_0x38985c){if(_0x5531e9){return _0x4623c2(_0x5531e9);}pm2['disconnect']();return _0x86760a(_0x38985c);});});});};exports[_0xf12c('0x6')]=function(_0x5208e3){return connect()['then'](function(){return new BPromise(function(_0x16ba92,_0x3e9d2b){return pm2[_0xf12c('0x6')](_0x5208e3,function(_0x18fc7f,_0x1b6f00){if(_0x18fc7f){return _0x3e9d2b(_0x18fc7f);}pm2['disconnect']();return _0x16ba92(_0x1b6f00);});});});};exports[_0xf12c('0x7')]=function(_0x10d42f){return connect()['then'](function(){return new BPromise(function(_0x43b01a,_0x2762bb){return pm2['restart'](_0x10d42f,function(_0xeda797,_0x4c12a4){if(_0xeda797){return _0x2762bb(_0xeda797);}pm2[_0xf12c('0x8')]();return _0x43b01a(_0x4c12a4);});});});};exports['list']=function(){return connect()[_0xf12c('0x5')](function(){return new BPromise(function(_0x28f03b,_0x13fdde){return pm2[_0xf12c('0x9')](function(_0x57d207,_0x2cec85){if(_0x57d207){return _0x13fdde(_0x57d207);}pm2['disconnect']();return _0x28f03b(_0x2cec85);});});});};exports[_0xf12c('0xa')]=function(_0x459ca6){return connect()[_0xf12c('0x5')](function(){return new BPromise(function(_0x15fc73,_0x197598){return pm2['describe'](_0x459ca6,function(_0x52d79c,_0x4645bf){if(_0x52d79c){return _0x197598(_0x52d79c);}pm2[_0xf12c('0x8')]();return _0x15fc73(_0x4645bf);});});});};exports['delete']=function(_0x23b4d4){return connect()['then'](function(){return new BPromise(function(_0x2c3578,_0x1251f8){return pm2[_0xf12c('0xb')](_0x23b4d4,function(_0x177280,_0x5309fa){if(_0x177280){return _0x1251f8(_0x177280);}pm2[_0xf12c('0x8')]();return _0x2c3578(_0x5309fa);});});});};exports[_0xf12c('0xc')]=function(){return connect()[_0xf12c('0x5')](function(){return new BPromise(function(_0x387c40,_0x591b33){return pm2['dump'](function(_0x49f46d){if(_0x49f46d){return _0x591b33(_0x49f46d);}return _0x387c40('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 4b2cc1a..91611a8 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 _0x58f8=['catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','subtract','minutes','length','map','info','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join'];(function(_0x36e0f6,_0x4da6a7){var _0xc90479=function(_0x49ebe4){while(--_0x49ebe4){_0x36e0f6['push'](_0x36e0f6['shift']());}};_0xc90479(++_0x4da6a7);}(_0x58f8,0x13b));var _0x858f=function(_0x3aa50b,_0x5f1715){_0x3aa50b=_0x3aa50b-0x0;var _0x3f0bf5=_0x58f8[_0x3aa50b];return _0x3f0bf5;};'use strict';var _=require(_0x858f('0x0'));var moment=require(_0x858f('0x1'));var Redis=require('ioredis');var util=require(_0x858f('0x2'));var config=require(_0x858f('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x858f('0x4'))(_0x858f('0x5'));config[_0x858f('0x6')]=_[_0x858f('0x7')](config['redis'],{'host':_0x858f('0x8'),'port':0x18eb});var io=require(_0x858f('0x9'))(new Redis(config[_0x858f('0x6')]));function closeInteractions(){var _0x55824c=0x0;var _0x5957e1=[];return db[_0x858f('0xa')]['find']({'raw':!![],'attributes':['id',_0x858f('0xb')],'where':{'id':0x1}})[_0x858f('0xc')](function(_0x5e2e99){_0x55824c=_0x5e2e99[_0x858f('0xb')];if(_0x55824c){return db[_0x858f('0xd')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x858f('0xe')](_0x5e2e99['chatTimeout'],_0x858f('0xf'))}}});}else{return[];}})[_0x858f('0xc')](function(_0x47c141){if(_0x47c141&&_0x47c141[_0x858f('0x10')]){_0x5957e1=_[_0x858f('0x11')](_0x47c141||[],'id');logger[_0x858f('0x12')]('[CHAT]\x20Interactions\x20to\x20close:',_0x5957e1['join']());return db[_0x858f('0xd')][_0x858f('0x13')]({'closeReason':_0x858f('0x14'),'disposition':_0x858f('0x15'),'closed':!![],'closedAt':moment()[_0x858f('0x16')](_0x858f('0x17'))},{'where':{'id':_0x5957e1}});}})[_0x858f('0xc')](function(){if(_0x5957e1&&_0x5957e1['length']){logger[_0x858f('0x12')](_0x858f('0x18'),_0x5957e1[_0x858f('0x19')]());for(var _0x1778f2=0x0;_0x1778f2<_0x5957e1[_0x858f('0x10')];_0x1778f2++){io['emit']('chatInteraction:update',{'id':_0x5957e1[_0x1778f2],'closed':!![]});}}})[_0x858f('0x1a')](function(_0x353032){logger[_0x858f('0x1b')](_0x858f('0x1c'),_0x353032?util[_0x858f('0x1d')](_0x353032,{'showHidden':![],'depth':null}):'');});}exports[_0x858f('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3a67=['redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','lastMsgAt','subtract','then','length','map','info','join','update','system','timeout','format','chatInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','schedule'];(function(_0x5cf5b8,_0x2752b1){var _0x8c68a1=function(_0x522202){while(--_0x522202){_0x5cf5b8['push'](_0x5cf5b8['shift']());}};_0x8c68a1(++_0x2752b1);}(_0x3a67,0x1ca));var _0x73a6=function(_0x3cc84b,_0xd758ff){_0x3cc84b=_0x3cc84b-0x0;var _0x5caca5=_0x3a67[_0x3cc84b];return _0x5caca5;};'use strict';var _=require(_0x73a6('0x0'));var moment=require(_0x73a6('0x1'));var Redis=require(_0x73a6('0x2'));var util=require(_0x73a6('0x3'));var config=require(_0x73a6('0x4'));var db=require(_0x73a6('0x5'))['db'];var logger=require('../logger')(_0x73a6('0x6'));config[_0x73a6('0x7')]=_[_0x73a6('0x8')](config['redis'],{'host':_0x73a6('0x9'),'port':0x18eb});var io=require(_0x73a6('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x17da6c=0x0;var _0x475985=[];return db[_0x73a6('0xb')][_0x73a6('0xc')]({'raw':!![],'attributes':['id',_0x73a6('0xd')],'where':{'id':0x1}})['then'](function(_0x3a7916){_0x17da6c=_0x3a7916['chatTimeout'];if(_0x17da6c){return db[_0x73a6('0xe')]['findAll']({'raw':!![],'attributes':['id',_0x73a6('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x73a6('0x10')](_0x3a7916['chatTimeout'],'minutes')}}});}else{return[];}})[_0x73a6('0x11')](function(_0x46783f){if(_0x46783f&&_0x46783f[_0x73a6('0x12')]){_0x475985=_[_0x73a6('0x13')](_0x46783f||[],'id');logger[_0x73a6('0x14')]('[CHAT]\x20Interactions\x20to\x20close:',_0x475985[_0x73a6('0x15')]());return db[_0x73a6('0xe')][_0x73a6('0x16')]({'closeReason':_0x73a6('0x17'),'disposition':_0x73a6('0x18'),'closed':!![],'closedAt':moment()[_0x73a6('0x19')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x475985}});}})[_0x73a6('0x11')](function(){if(_0x475985&&_0x475985[_0x73a6('0x12')]){logger[_0x73a6('0x14')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x475985[_0x73a6('0x15')]());for(var _0x447a2f=0x0;_0x447a2f<_0x475985[_0x73a6('0x12')];_0x447a2f++){io['emit'](_0x73a6('0x1a'),{'id':_0x475985[_0x447a2f],'closed':!![]});}}})[_0x73a6('0x1b')](function(_0x1fe757){logger[_0x73a6('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x1fe757?util[_0x73a6('0x1d')](_0x1fe757,{'showHidden':![],'depth':null}):'');});}exports[_0x73a6('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index d718ec7..8044736 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 _0x2963=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0xa1a9ec,_0x3dffcd){var _0x12c17e=function(_0x4b8bed){while(--_0x4b8bed){_0xa1a9ec['push'](_0xa1a9ec['shift']());}};_0x12c17e(++_0x3dffcd);}(_0x2963,0x1e2));var _0x3296=function(_0x1280df,_0x200b43){_0x1280df=_0x1280df-0x0;var _0x474f58=_0x2963[_0x1280df];return _0x474f58;};'use strict';function start(){var _0xde0b61=require(_0x3296('0x0'));return _0xde0b61[_0x3296('0x1')]();}module[_0x3296('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x69b2=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x60e31a,_0xba6b64){var _0x3fb723=function(_0x374ff8){while(--_0x374ff8){_0x60e31a['push'](_0x60e31a['shift']());}};_0x3fb723(++_0xba6b64);}(_0x69b2,0xd9));var _0x269b=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x69b2[_0x32d457];return _0x338386;};'use strict';function start(){var _0x326044=require(_0x269b('0x0'));return _0x326044['startAllRefreshIntervals']();}module[_0x269b('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 475595d..a1d97e1 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 _0x5059=['schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','email','MailAccount','Smtp','service','host','secure','authentication','user','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','join','%s.%s','savename','zip','existsSync','status','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','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','email\x20sent','catch','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','Schedule','MailServerOut','jobs','toString','keyBy','intersection','difference','length','exists','stop','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','start','add\x20cron','stop\x20cron','active','update','update\x20cron','run','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger'];(function(_0x3d5d16,_0x47f368){var _0x373318=function(_0x50f165){while(--_0x50f165){_0x3d5d16['push'](_0x3d5d16['shift']());}};_0x373318(++_0x47f368);}(_0x5059,0xa5));var _0x9505=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0x5059[_0x2f6f50];return _0x2cf365;};'use strict';var fs=require('fs');var util=require(_0x9505('0x0'));var path=require('path');var _=require(_0x9505('0x1'));var moment=require(_0x9505('0x2'));var CronJobManager=require(_0x9505('0x3'));var jayson=require(_0x9505('0x4'));var BPromise=require(_0x9505('0x5'));var logger=require(_0x9505('0x6'))(_0x9505('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x9505('0x8'));var analyticDefaultReportController=require(_0x9505('0x9'));var client=jayson['client'][_0x9505('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x40e148,_0x59e3fd){return function(){logger[_0x9505('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x40e148[_0x9505('0xc')]);var _0x1b0a93=!![];var _0x4159d7={'tls':{'rejectUnauthorized':![]}};if(_0x40e148[_0x9505('0xd')]['Smtp']['service']){_0x4159d7['service']=_0x40e148[_0x9505('0xd')][_0x9505('0xe')][_0x9505('0xf')];}else{_0x4159d7[_0x9505('0x10')]=_0x40e148[_0x9505('0xd')][_0x9505('0xe')][_0x9505('0x10')];_0x4159d7['port']=_0x40e148['MailAccount'][_0x9505('0xe')]['port'];_0x4159d7['secure']=_0x40e148[_0x9505('0xd')][_0x9505('0xe')][_0x9505('0x11')];}if(_0x40e148[_0x9505('0xd')][_0x9505('0xe')][_0x9505('0x12')]){_0x4159d7['auth']={'user':_0x40e148[_0x9505('0xd')]['Smtp'][_0x9505('0x13')],'pass':_0x40e148[_0x9505('0xd')][_0x9505('0xe')]['pass']};}var _0x1b6e07={'account':_0x4159d7,'message':{'from':util[_0x9505('0x14')](_0x9505('0x15'),_0x40e148[_0x9505('0xd')]['name'],_0x40e148[_0x9505('0xd')][_0x9505('0xc')]||_0x40e148['MailAccount'][_0x9505('0xe')]['user']),'to':_0x40e148[_0x9505('0xc')],'cc':_0x40e148['cc'],'bcc':_0x40e148[_0x9505('0x16')],'subject':util[_0x9505('0x14')](_0x9505('0x17'),_0x59e3fd[_0x9505('0x18')],_0x40e148['subtractNumber'],_0x40e148[_0x9505('0x19')])}};var _0x8df6fd=path[_0x9505('0x1a')](__dirname,'../../files/reports');var _0x5f0e6e=_0x59e3fd['savename'];var _0xb0e2e0=util[_0x9505('0x14')](_0x9505('0x1b'),path['basename'](_0x59e3fd['savename'],path['extname'](_0x59e3fd[_0x9505('0x1c')])),_0x9505('0x1d'));var _0x17c764=path['join'](_0x8df6fd,_0x5f0e6e);var _0x3c17fc=path[_0x9505('0x1a')](_0x8df6fd,_0xb0e2e0);if(fs[_0x9505('0x1e')](_0x17c764)){_0x59e3fd[_0x9505('0x1f')]=_0x9505('0x20');_0x1b6e07[_0x9505('0x21')][_0x9505('0x22')]=[{'filename':_0x5f0e6e,'path':_0x17c764}];_0x1b6e07[_0x9505('0x21')][_0x9505('0x23')]=util[_0x9505('0x14')](_0x9505('0x24'),JSON[_0x9505('0x25')](_0x59e3fd,null,0x2));}else if(fs[_0x9505('0x1e')](_0x3c17fc)){_0x59e3fd['status']='Sent';_0x1b6e07[_0x9505('0x21')]['attachments']=[{'filename':_0xb0e2e0,'path':_0x3c17fc}];}else{_0x1b6e07['message'][_0x9505('0x23')]=_0x9505('0x26');if(!_0x40e148[_0x9505('0x27')]){_0x1b0a93=![];logger['info'](_0x9505('0x28'));}}if(_0x1b0a93){return client[_0x9505('0x29')](_0x9505('0x2a'),_0x1b6e07)[_0x9505('0x2b')](function(_0x4b7147){if(_0x4b7147['error']){return logger[_0x9505('0x2c')]('error\x20mail',JSON[_0x9505('0x25')](_0x4b7147));}return logger[_0x9505('0xb')](_0x9505('0x2d'));})[_0x9505('0x2e')](function(_0x292ba6){return logger['error']('error\x20mail',JSON[_0x9505('0x25')](_0x292ba6));});}};}function handleError(){return function(_0x1d7f32){return logger[_0x9505('0x2c')](JSON[_0x9505('0x25')](_0x1d7f32));};}function handleResult(_0x3f10bd){return function(_0x2b53df){logger[_0x9505('0xb')]('data',JSON[_0x9505('0x25')](_0x2b53df));if(_0x3f10bd[_0x9505('0xd')]&&_0x3f10bd['MailAccount'][_0x9505('0xe')]&&!_[_0x9505('0x2f')](_0x3f10bd[_0x9505('0xc')])){setTimeout(handleSendEmail(_0x3f10bd,_0x2b53df),0x3c*0x3e8);}};}function handleJob(_0x2e864b){return function(){try{if(_[_0x9505('0x2f')](_0x2e864b[_0x9505('0x30')])){return logger[_0x9505('0xb')](_0x9505('0x31'));}if(_[_0x9505('0x2f')](_0x2e864b[_0x9505('0x19')])){return logger[_0x9505('0xb')](_0x9505('0x32'));}var _0x364f63={'startDate':moment()[_0x9505('0x33')](_0x2e864b['subtractNumber'],_0x2e864b['subtractUnit'])[_0x9505('0x14')](_0x9505('0x34')),'endDate':moment()[_0x9505('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x9505('0x35'),'output':_0x2e864b['output'],'name':_0x2e864b['name']};if(!_[_0x9505('0x2f')](_0x2e864b[_0x9505('0x36')])){logger[_0x9505('0xb')](_0x9505('0x37'),_0x2e864b[_0x9505('0x36')]);return analyticDefaultReportController['runReport']({'id':_0x2e864b['DefaultReportId']},_0x364f63)[_0x9505('0x2b')](handleResult(_0x2e864b))[_0x9505('0x2e')](handleError());}if(!_[_0x9505('0x2f')](_0x2e864b['CustomReportId'])){logger[_0x9505('0xb')](_0x9505('0x38'),_0x2e864b[_0x9505('0x39')]);return analyticCustomReportController[_0x9505('0x3a')]({'id':_0x2e864b[_0x9505('0x39')]},_0x364f63)['then'](handleResult(_0x2e864b))['catch'](handleError());}}catch(_0x5d8372){logger[_0x9505('0x2c')](JSON[_0x9505('0x25')](_0x5d8372));}return logger[_0x9505('0xb')]('no\x20report\x20id');};}function getJobs(_0x552806){var _0x9d30e2={};if(_0x552806){_0x9d30e2['id']=_0x552806;}return db[_0x9505('0x3b')]['findAll']({'where':_0x9d30e2,'include':[{'model':db[_0x9505('0xd')],'attributes':['id',_0x9505('0x18'),'email'],'include':[{'model':db[_0x9505('0x3c')],'as':_0x9505('0xe')}]}]})['then'](function(_0x5bc7a2){var _0x239ddf=_['keys'](manager[_0x9505('0x3d')]);var _0x5bd56a=_['map'](_0x5bc7a2,function(_0x3754f7){return _0x3754f7['id'][_0x9505('0x3e')]();});var _0x49d656=_[_0x9505('0x3f')](_0x5bc7a2,function(_0x2a0377){return _0x2a0377['id'][_0x9505('0x3e')]();});var _0x18d243=_0x552806?_0x5bd56a:_['difference'](_0x5bd56a,_0x239ddf);var _0x41eeaf=_[_0x9505('0x40')](_0x5bd56a,_0x239ddf);var _0x5d3312=_[_0x9505('0x41')](_0x239ddf,_0x5bd56a);var _0x1f2090;var _0x369c0a;for(_0x1f2090=0x0;_0x1f2090<_0x5d3312[_0x9505('0x42')]&&!_0x552806;_0x1f2090+=0x1){_0x369c0a=_0x5d3312[_0x1f2090][_0x9505('0x3e')]();if(manager[_0x9505('0x43')](_0x369c0a)){manager[_0x9505('0x44')](_0x369c0a);manager[_0x9505('0x45')](_0x369c0a);logger[_0x9505('0xb')](_0x9505('0x46'),_0x369c0a);}}logger[_0x9505('0xb')]('toRun',JSON[_0x9505('0x25')](_0x18d243));for(_0x1f2090=0x0;_0x1f2090<_0x18d243[_0x9505('0x42')];_0x1f2090+=0x1){_0x369c0a=_0x18d243[_0x1f2090]['toString']();logger[_0x9505('0xb')](_0x9505('0x47'),_0x369c0a);if(_0x552806){logger[_0x9505('0xb')](_0x9505('0x48'),_0x552806);logger[_0x9505('0xb')](JSON['stringify'](_0x49d656[_0x369c0a]));BPromise[_0x9505('0x49')]()[_0x9505('0x2b')](handleJob(_0x49d656[_0x369c0a]));logger['info'](_0x9505('0x4a'),_0x49d656[_0x369c0a][_0x9505('0x18')],_0x49d656[_0x369c0a][_0x9505('0x4b')]);}else if(_0x49d656[_0x369c0a][_0x9505('0x4b')]&&_0x49d656[_0x369c0a]['active']&&moment()[_0x9505('0x4c')](_0x49d656[_0x369c0a][_0x9505('0x4d')],_0x49d656[_0x369c0a][_0x9505('0x4e')])){manager['add'](_0x369c0a,_0x49d656[_0x369c0a][_0x9505('0x4b')],handleJob(_0x49d656[_0x369c0a]));manager[_0x9505('0x4f')](_0x369c0a);logger['info'](_0x9505('0x50'),_0x49d656[_0x369c0a][_0x9505('0x18')],_0x49d656[_0x369c0a]['cron']);}else if(manager[_0x9505('0x43')](_0x369c0a)){manager[_0x9505('0x44')](_0x369c0a);manager[_0x9505('0x45')](_0x369c0a);logger['info'](_0x9505('0x51'),_0x49d656[_0x369c0a][_0x9505('0x18')],_0x49d656[_0x369c0a][_0x9505('0x4b')]);}}for(_0x1f2090=0x0,_0x369c0a;_0x1f2090<_0x41eeaf[_0x9505('0x42')]&&!_0x552806;_0x1f2090+=0x1){_0x369c0a=_0x41eeaf[_0x1f2090]['toString']();if(manager['exists'](_0x369c0a)){if(_0x49d656[_0x369c0a][_0x9505('0x4b')]&&_0x49d656[_0x369c0a][_0x9505('0x52')]&&moment()[_0x9505('0x4c')](_0x49d656[_0x369c0a]['startAt'],_0x49d656[_0x369c0a]['endAt'])){manager[_0x9505('0x53')](_0x369c0a,_0x49d656[_0x369c0a]['cron'],handleJob(_0x49d656[_0x369c0a]));logger[_0x9505('0xb')](_0x9505('0x54'),_0x49d656[_0x369c0a]['name'],_0x49d656[_0x369c0a][_0x9505('0x4b')]);}else{manager['stop'](_0x369c0a);manager[_0x9505('0x45')](_0x369c0a);logger[_0x9505('0xb')]('stop\x20cron',_0x49d656[_0x369c0a]['name'],_0x49d656[_0x369c0a]['cron']);}}}})[_0x9505('0x2e')](function(_0xc96172){logger['error'](JSON['stringify'](_0xc96172));});}exports[_0x9505('0x55')]=function(_0xa14d68){return getJobs(_0xa14d68);};exports[_0x9505('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xf7b4=['path','moment','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port','secure','auth','user','pass','format','\x22%s\x22\x20<%s>','name','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','status','message','attachments','text','existsSync','Sent','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','stringify','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','toString','difference','intersection','length','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','add','add\x20cron','exists','stop','update\x20cron','stop\x20cron','run','start'];(function(_0x100c07,_0x26a1a3){var _0x4b1389=function(_0x498c37){while(--_0x498c37){_0x100c07['push'](_0x100c07['shift']());}};_0x4b1389(++_0x26a1a3);}(_0xf7b4,0x168));var _0x4f7b=function(_0x1d6364,_0x421ba1){_0x1d6364=_0x1d6364-0x0;var _0xdcdee6=_0xf7b4[_0x1d6364];return _0xdcdee6;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x4f7b('0x0'));var _=require('lodash');var moment=require(_0x4f7b('0x1'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x4f7b('0x2'));var BPromise=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x4f7b('0x6'));var analyticDefaultReportController=require(_0x4f7b('0x7'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x53549a,_0x3792ca){return function(){logger[_0x4f7b('0x8')](_0x4f7b('0x9'),_0x53549a[_0x4f7b('0xa')]);var _0x25e093=!![];var _0x41033c={'tls':{'rejectUnauthorized':![]}};if(_0x53549a[_0x4f7b('0xb')]['Smtp'][_0x4f7b('0xc')]){_0x41033c[_0x4f7b('0xc')]=_0x53549a['MailAccount'][_0x4f7b('0xd')][_0x4f7b('0xc')];}else{_0x41033c[_0x4f7b('0xe')]=_0x53549a[_0x4f7b('0xb')]['Smtp']['host'];_0x41033c[_0x4f7b('0xf')]=_0x53549a['MailAccount'][_0x4f7b('0xd')][_0x4f7b('0xf')];_0x41033c[_0x4f7b('0x10')]=_0x53549a[_0x4f7b('0xb')][_0x4f7b('0xd')][_0x4f7b('0x10')];}if(_0x53549a['MailAccount'][_0x4f7b('0xd')]['authentication']){_0x41033c[_0x4f7b('0x11')]={'user':_0x53549a[_0x4f7b('0xb')][_0x4f7b('0xd')][_0x4f7b('0x12')],'pass':_0x53549a[_0x4f7b('0xb')][_0x4f7b('0xd')][_0x4f7b('0x13')]};}var _0x490fdf={'account':_0x41033c,'message':{'from':util[_0x4f7b('0x14')](_0x4f7b('0x15'),_0x53549a[_0x4f7b('0xb')][_0x4f7b('0x16')],_0x53549a[_0x4f7b('0xb')][_0x4f7b('0xa')]||_0x53549a[_0x4f7b('0xb')][_0x4f7b('0xd')][_0x4f7b('0x12')]),'to':_0x53549a['email'],'cc':_0x53549a['cc'],'bcc':_0x53549a['bcc'],'subject':util[_0x4f7b('0x14')](_0x4f7b('0x17'),_0x3792ca[_0x4f7b('0x16')],_0x53549a['subtractNumber'],_0x53549a[_0x4f7b('0x18')])}};var _0x51aad6=path[_0x4f7b('0x19')](__dirname,_0x4f7b('0x1a'));var _0x54e0aa=_0x3792ca[_0x4f7b('0x1b')];var _0x43c000=util[_0x4f7b('0x14')](_0x4f7b('0x1c'),path[_0x4f7b('0x1d')](_0x3792ca[_0x4f7b('0x1b')],path[_0x4f7b('0x1e')](_0x3792ca[_0x4f7b('0x1b')])),'zip');var _0x425d1e=path['join'](_0x51aad6,_0x54e0aa);var _0x6668f3=path[_0x4f7b('0x19')](_0x51aad6,_0x43c000);if(fs['existsSync'](_0x425d1e)){_0x3792ca[_0x4f7b('0x1f')]='Sent';_0x490fdf[_0x4f7b('0x20')][_0x4f7b('0x21')]=[{'filename':_0x54e0aa,'path':_0x425d1e}];_0x490fdf['message'][_0x4f7b('0x22')]=util[_0x4f7b('0x14')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x3792ca,null,0x2));}else if(fs[_0x4f7b('0x23')](_0x6668f3)){_0x3792ca[_0x4f7b('0x1f')]=_0x4f7b('0x24');_0x490fdf[_0x4f7b('0x20')][_0x4f7b('0x21')]=[{'filename':_0x43c000,'path':_0x6668f3}];}else{_0x490fdf[_0x4f7b('0x20')]['text']=_0x4f7b('0x25');if(!_0x53549a[_0x4f7b('0x26')]){_0x25e093=![];logger[_0x4f7b('0x8')](_0x4f7b('0x27'));}}if(_0x25e093){return client[_0x4f7b('0x28')](_0x4f7b('0x29'),_0x490fdf)[_0x4f7b('0x2a')](function(_0x11291d){if(_0x11291d[_0x4f7b('0x2b')]){return logger[_0x4f7b('0x2b')](_0x4f7b('0x2c'),JSON[_0x4f7b('0x2d')](_0x11291d));}return logger[_0x4f7b('0x8')](_0x4f7b('0x2e'));})[_0x4f7b('0x2f')](function(_0x100804){return logger[_0x4f7b('0x2b')](_0x4f7b('0x2c'),JSON[_0x4f7b('0x2d')](_0x100804));});}};}function handleError(){return function(_0x321329){return logger[_0x4f7b('0x2b')](JSON['stringify'](_0x321329));};}function handleResult(_0x38de89){return function(_0x16b5ad){logger[_0x4f7b('0x8')](_0x4f7b('0x30'),JSON[_0x4f7b('0x2d')](_0x16b5ad));if(_0x38de89[_0x4f7b('0xb')]&&_0x38de89[_0x4f7b('0xb')]['Smtp']&&!_[_0x4f7b('0x31')](_0x38de89['email'])){setTimeout(handleSendEmail(_0x38de89,_0x16b5ad),0x3c*0x3e8);}};}function handleJob(_0x5ebfa2){return function(){try{if(_[_0x4f7b('0x31')](_0x5ebfa2[_0x4f7b('0x32')])){return logger['info'](_0x4f7b('0x33'));}if(_[_0x4f7b('0x31')](_0x5ebfa2[_0x4f7b('0x18')])){return logger['info'](_0x4f7b('0x34'));}var _0x2cf0aa={'startDate':moment()[_0x4f7b('0x35')](_0x5ebfa2[_0x4f7b('0x32')],_0x5ebfa2[_0x4f7b('0x18')])[_0x4f7b('0x14')](_0x4f7b('0x36')),'endDate':moment()[_0x4f7b('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x4f7b('0x37'),'output':_0x5ebfa2[_0x4f7b('0x38')],'name':_0x5ebfa2[_0x4f7b('0x16')]};if(!_[_0x4f7b('0x31')](_0x5ebfa2[_0x4f7b('0x39')])){logger[_0x4f7b('0x8')]('exec\x20defaul\x20report\x20id:%s',_0x5ebfa2['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x5ebfa2[_0x4f7b('0x39')]},_0x2cf0aa)[_0x4f7b('0x2a')](handleResult(_0x5ebfa2))['catch'](handleError());}if(!_[_0x4f7b('0x31')](_0x5ebfa2['CustomReportId'])){logger[_0x4f7b('0x8')](_0x4f7b('0x3a'),_0x5ebfa2[_0x4f7b('0x3b')]);return analyticCustomReportController[_0x4f7b('0x3c')]({'id':_0x5ebfa2['CustomReportId']},_0x2cf0aa)[_0x4f7b('0x2a')](handleResult(_0x5ebfa2))[_0x4f7b('0x2f')](handleError());}}catch(_0x302bab){logger[_0x4f7b('0x2b')](JSON[_0x4f7b('0x2d')](_0x302bab));}return logger['info'](_0x4f7b('0x3d'));};}function getJobs(_0x350d5d){var _0x36d5bd={};if(_0x350d5d){_0x36d5bd['id']=_0x350d5d;}return db[_0x4f7b('0x3e')][_0x4f7b('0x3f')]({'where':_0x36d5bd,'include':[{'model':db[_0x4f7b('0xb')],'attributes':['id',_0x4f7b('0x16'),_0x4f7b('0xa')],'include':[{'model':db[_0x4f7b('0x40')],'as':_0x4f7b('0xd')}]}]})[_0x4f7b('0x2a')](function(_0x390b25){var _0x2a6dbf=_[_0x4f7b('0x41')](manager[_0x4f7b('0x42')]);var _0x2c65c8=_['map'](_0x390b25,function(_0x30955c){return _0x30955c['id'][_0x4f7b('0x43')]();});var _0x1b15b0=_['keyBy'](_0x390b25,function(_0x5031fd){return _0x5031fd['id'][_0x4f7b('0x43')]();});var _0x494dc2=_0x350d5d?_0x2c65c8:_[_0x4f7b('0x44')](_0x2c65c8,_0x2a6dbf);var _0x34b4b4=_[_0x4f7b('0x45')](_0x2c65c8,_0x2a6dbf);var _0x5d5eee=_[_0x4f7b('0x44')](_0x2a6dbf,_0x2c65c8);var _0x10c7f7;var _0x2aa77f;for(_0x10c7f7=0x0;_0x10c7f7<_0x5d5eee[_0x4f7b('0x46')]&&!_0x350d5d;_0x10c7f7+=0x1){_0x2aa77f=_0x5d5eee[_0x10c7f7][_0x4f7b('0x43')]();if(manager['exists'](_0x2aa77f)){manager['stop'](_0x2aa77f);manager[_0x4f7b('0x47')](_0x2aa77f);logger[_0x4f7b('0x8')](_0x4f7b('0x48'),_0x2aa77f);}}logger[_0x4f7b('0x8')](_0x4f7b('0x49'),JSON[_0x4f7b('0x2d')](_0x494dc2));for(_0x10c7f7=0x0;_0x10c7f7<_0x494dc2[_0x4f7b('0x46')];_0x10c7f7+=0x1){_0x2aa77f=_0x494dc2[_0x10c7f7][_0x4f7b('0x43')]();logger['info'](_0x4f7b('0x4a'),_0x2aa77f);if(_0x350d5d){logger[_0x4f7b('0x8')](_0x4f7b('0x4b'),_0x350d5d);logger[_0x4f7b('0x8')](JSON[_0x4f7b('0x2d')](_0x1b15b0[_0x2aa77f]));BPromise[_0x4f7b('0x4c')]()[_0x4f7b('0x2a')](handleJob(_0x1b15b0[_0x2aa77f]));logger[_0x4f7b('0x8')](_0x4f7b('0x4d'),_0x1b15b0[_0x2aa77f]['name'],_0x1b15b0[_0x2aa77f][_0x4f7b('0x4e')]);}else if(_0x1b15b0[_0x2aa77f][_0x4f7b('0x4e')]&&_0x1b15b0[_0x2aa77f]['active']&&moment()[_0x4f7b('0x4f')](_0x1b15b0[_0x2aa77f][_0x4f7b('0x50')],_0x1b15b0[_0x2aa77f][_0x4f7b('0x51')])){manager[_0x4f7b('0x52')](_0x2aa77f,_0x1b15b0[_0x2aa77f]['cron'],handleJob(_0x1b15b0[_0x2aa77f]));manager['start'](_0x2aa77f);logger[_0x4f7b('0x8')](_0x4f7b('0x53'),_0x1b15b0[_0x2aa77f][_0x4f7b('0x16')],_0x1b15b0[_0x2aa77f][_0x4f7b('0x4e')]);}else if(manager[_0x4f7b('0x54')](_0x2aa77f)){manager[_0x4f7b('0x55')](_0x2aa77f);manager['deleteJob'](_0x2aa77f);logger[_0x4f7b('0x8')]('stop\x20cron',_0x1b15b0[_0x2aa77f]['name'],_0x1b15b0[_0x2aa77f][_0x4f7b('0x4e')]);}}for(_0x10c7f7=0x0,_0x2aa77f;_0x10c7f7<_0x34b4b4['length']&&!_0x350d5d;_0x10c7f7+=0x1){_0x2aa77f=_0x34b4b4[_0x10c7f7]['toString']();if(manager['exists'](_0x2aa77f)){if(_0x1b15b0[_0x2aa77f][_0x4f7b('0x4e')]&&_0x1b15b0[_0x2aa77f]['active']&&moment()[_0x4f7b('0x4f')](_0x1b15b0[_0x2aa77f]['startAt'],_0x1b15b0[_0x2aa77f][_0x4f7b('0x51')])){manager['update'](_0x2aa77f,_0x1b15b0[_0x2aa77f][_0x4f7b('0x4e')],handleJob(_0x1b15b0[_0x2aa77f]));logger[_0x4f7b('0x8')](_0x4f7b('0x56'),_0x1b15b0[_0x2aa77f][_0x4f7b('0x16')],_0x1b15b0[_0x2aa77f][_0x4f7b('0x4e')]);}else{manager[_0x4f7b('0x55')](_0x2aa77f);manager[_0x4f7b('0x47')](_0x2aa77f);logger['info'](_0x4f7b('0x57'),_0x1b15b0[_0x2aa77f][_0x4f7b('0x16')],_0x1b15b0[_0x2aa77f][_0x4f7b('0x4e')]);}}}})[_0x4f7b('0x2f')](function(_0xac8474){logger['error'](JSON['stringify'](_0xac8474));});}exports[_0x4f7b('0x58')]=function(_0x492a1d){return getJobs(_0x492a1d);};exports[_0x4f7b('0x59')]=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 7398d7f..e232019 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 _0x00b3=['FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','error','start','aws-sdk','request-promise','util','bluebird','../../config/logger','getTranscriptionJob','detectSentiment','substring','info','format','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','results','transcripts','length','fileText','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','data1','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','update','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED'];(function(_0x53956f,_0xe4fb11){var _0x2e8579=function(_0x5e807b){while(--_0x5e807b){_0x53956f['push'](_0x53956f['shift']());}};_0x2e8579(++_0xe4fb11);}(_0x00b3,0x17a));var _0x300b=function(_0x1199e7,_0x15393c){_0x1199e7=_0x1199e7-0x0;var _0x356c70=_0x00b3[_0x1199e7];return _0x356c70;};var _=require('lodash');var AWS=require(_0x300b('0x0'));var rp=require(_0x300b('0x1'));var util=require(_0x300b('0x2'));var BPromise=require(_0x300b('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x300b('0x4'))('transcribe');function getTranscriptionJob(_0x245c32,_0x524b8d,_0x1be801,_0x3861ea){return new Promise(function(_0x3a8c64,_0x10b0a2){var _0x5af470=new AWS['TranscribeService']({'accessKeyId':_0x524b8d,'secretAccessKey':_0x245c32,'region':_0x1be801});_0x5af470[_0x300b('0x5')]({'TranscriptionJobName':_0x3861ea},function(_0x590c4d,_0x5e283c){if(_0x590c4d){return _0x10b0a2(_0x590c4d);}else{return _0x3a8c64(_0x5e283c);}});});}function sentiment(_0x162843,_0x114d32,_0x457aa3,_0x4d8d78,_0x42e5a5){return new Promise(function(_0x3d907e,_0x243abf){var _0x212b2b=new AWS['Comprehend']({'accessKeyId':_0x114d32,'secretAccessKey':_0x162843,'region':_0x457aa3});_0x212b2b[_0x300b('0x6')]({'Text':_0x4d8d78,'LanguageCode':_0x42e5a5[_0x300b('0x7')](0x0,0x2)},function(_0x3e5c83,_0x4d6b97){if(_0x3e5c83){return _0x243abf(_0x3e5c83);}else{return _0x3d907e(_0x4d6b97);}});});}function checkTranscribeJob(_0x42282f,_0xea95bb,_0x138efb){var _0x40c03b;return new BPromise(function(_0x2b98dc,_0x124405){logger[_0x300b('0x8')](util[_0x300b('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x42282f['id'],_0x42282f['transcribeName']));return getTranscriptionJob(_0x138efb['data1'],_0x138efb['data2'],_0xea95bb[_0x300b('0xa')],_0x42282f[_0x300b('0xb')])[_0x300b('0xc')](function(_0xd252fa){logger['info'](util['format'](_0x300b('0xd'),_0x42282f['id'],_0x42282f[_0x300b('0xb')],_0xd252fa[_0x300b('0xe')][_0x300b('0xf')]));if(!_0x42282f['fileText']){switch(_0xd252fa[_0x300b('0xe')][_0x300b('0xf')]){case _0x300b('0x10'):var _0x5cba7c={'transcribeStatus':_0xd252fa[_0x300b('0xe')][_0x300b('0xf')],'fileUri':_0xd252fa[_0x300b('0xe')][_0x300b('0x11')]['TranscriptFileUri']};logger[_0x300b('0x8')](util[_0x300b('0x9')](_0x300b('0x12'),_0x42282f['id']));return rp({'uri':_0xd252fa['TranscriptionJob'][_0x300b('0x11')][_0x300b('0x13')],'json':!![]})[_0x300b('0xc')](function(_0x502c5f){logger[_0x300b('0x8')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x42282f['id']));if(_0x502c5f&&_0x502c5f[_0x300b('0x14')]&&_0x502c5f[_0x300b('0x14')][_0x300b('0x15')]&&_0x502c5f[_0x300b('0x14')][_0x300b('0x15')][_0x300b('0x16')]){_0x5cba7c[_0x300b('0x17')]='';for(var _0x2fa577=0x0;_0x2fa577<_0x502c5f[_0x300b('0x14')]['transcripts'][_0x300b('0x16')];_0x2fa577++){_0x5cba7c[_0x300b('0x17')]+=_0x502c5f[_0x300b('0x14')][_0x300b('0x15')][_0x2fa577]['transcript']+'';}}return _0x42282f['update'](_0x5cba7c);})['then'](function(){logger[_0x300b('0x8')](util['format'](_0x300b('0x18'),_0x42282f['id']));if(!_0x42282f[_0x300b('0x19')]){throw new db[(_0x300b('0x1a'))][(_0x300b('0x1b'))](_0x300b('0x1c'));}if(!_0xea95bb[_0x300b('0x1d')]||!_0xea95bb[_0x300b('0x1e')]||!_0xea95bb[_0x300b('0x1f')]||!_0xea95bb[_0x300b('0x20')]||!_0xea95bb[_0x300b('0x21')]){throw new db['Sequelize']['ValidationError'](_0x300b('0x22'));}if(!_0x5cba7c[_0x300b('0x17')]){throw new Error(_0x300b('0x23'));}if(_0xea95bb[_0x300b('0x1e')]===_0x138efb['id']){return _0x138efb;}else{return db['CloudProvider'][_0x300b('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x53ed0c){if(!_0x53ed0c){throw new db[(_0x300b('0x1a'))][(_0x300b('0x1b'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x53ed0c[_0x300b('0x25')]||!_0x53ed0c[_0x300b('0x26')]){throw new db['Sequelize'][(_0x300b('0x1b'))]('Cloud\x20Provider\x20not\x20configured');}_0x40c03b=_0x53ed0c;logger[_0x300b('0x8')](util[_0x300b('0x9')](_0x300b('0x27'),_0x42282f['id']));return sentiment(_0x40c03b[_0x300b('0x25')],_0x40c03b[_0x300b('0x26')],_0xea95bb[_0x300b('0x1f')],_0x5cba7c[_0x300b('0x17')],_0xea95bb['language']);})[_0x300b('0xc')](function(_0x57c44e){logger[_0x300b('0x8')](util[_0x300b('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x42282f['id']));return _0x42282f[_0x300b('0x28')]({'sentiment':_0x57c44e[_0x300b('0x29')],'sPositive':_0x57c44e['SentimentScore'][_0x300b('0x2a')],'sNegative':_0x57c44e[_0x300b('0x2b')][_0x300b('0x2c')],'sMixed':_0x57c44e['SentimentScore'][_0x300b('0x2d')],'sNeutral':_0x57c44e[_0x300b('0x2b')][_0x300b('0x2e')]});})[_0x300b('0xc')](function(){logger[_0x300b('0x8')](util[_0x300b('0x9')](_0x300b('0x18'),_0x42282f['id']));_0x2b98dc();});case'FAILED':return _0x42282f[_0x300b('0x28')]({'transcribeStatus':_0x300b('0x2f'),'failureReason':_0xd252fa['TranscriptionJob'][_0x300b('0x30')]})['then'](function(){logger['info'](util[_0x300b('0x9')](_0x300b('0x18'),_0x42282f['id']));_0x2b98dc();});default:logger[_0x300b('0x8')](util[_0x300b('0x9')](_0x300b('0x31'),_0x42282f['id']));break;}}else{return BPromise['resolve']()[_0x300b('0xc')](function(){if(!_0x42282f[_0x300b('0x19')]){throw new db['Sequelize'][(_0x300b('0x1b'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0xea95bb[_0x300b('0x1d')]||!_0xea95bb[_0x300b('0x1e')]||!_0xea95bb[_0x300b('0x1f')]||!_0xea95bb[_0x300b('0x20')]||!_0xea95bb[_0x300b('0x21')]){throw new db[(_0x300b('0x1a'))][(_0x300b('0x1b'))](_0x300b('0x22'));}if(!_0x42282f[_0x300b('0x17')]){throw new Error(_0x300b('0x23'));}if(_0xea95bb[_0x300b('0x1e')]===_0x138efb['id']){return _0x138efb;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x300b('0x1e')]}});}})['then'](function(_0x5a08f7){if(!_0x5a08f7){throw new db[(_0x300b('0x1a'))][(_0x300b('0x1b'))](_0x300b('0x32'));}if(!_0x5a08f7['data1']||!_0x5a08f7[_0x300b('0x26')]){throw new db['Sequelize']['ValidationError'](_0x300b('0x33'));}_0x40c03b=_0x5a08f7;logger[_0x300b('0x8')](util['format'](_0x300b('0x27'),_0x42282f['id']));return sentiment(_0x40c03b[_0x300b('0x25')],_0x40c03b['data2'],_0xea95bb[_0x300b('0x1f')],_0x42282f[_0x300b('0x17')],_0xea95bb['language']);})[_0x300b('0xc')](function(_0xe24f3e){logger[_0x300b('0x8')](util[_0x300b('0x9')](_0x300b('0x34'),_0x42282f['id']));return _0x42282f[_0x300b('0x28')]({'sentiment':_0xe24f3e[_0x300b('0x29')],'sPositive':_0xe24f3e[_0x300b('0x2b')]['Positive'],'sNegative':_0xe24f3e['SentimentScore'][_0x300b('0x2c')],'sMixed':_0xe24f3e['SentimentScore']['Mixed'],'sNeutral':_0xe24f3e[_0x300b('0x2b')][_0x300b('0x2e')],'transcribeStatus':_0x300b('0x10')});})[_0x300b('0xc')](function(){logger[_0x300b('0x8')](util[_0x300b('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x42282f['id']));_0x2b98dc();});}})[_0x300b('0x35')](function(_0x5c4d91){if(_0x5c4d91){if(!_0x5c4d91['name']||_0x5c4d91[_0x300b('0x36')]!==_0x300b('0x37')){logger['error'](util[_0x300b('0x9')](_0x300b('0x38'),_0x42282f['id']),util[_0x300b('0x39')](_0x5c4d91,{'showHidden':![],'depth':null}));}}_0x2b98dc();});});}function checkTranscribe(){var _0x200476;var _0x5e1c1a;var _0x389256;return db[_0x300b('0x3a')]['findAll']({'where':{'transcribeStatus':_0x300b('0x3b')}})[_0x300b('0xc')](function(_0x450716){if(!_0x450716||!_0x450716['length']){throw new db[(_0x300b('0x1a'))][(_0x300b('0x1b'))](_0x300b('0x3c'));}_0x200476=_0x450716;return db[_0x300b('0x3d')][_0x300b('0x24')]({'where':{'id':0x1}});})[_0x300b('0xc')](function(_0x418ac3){if(!_0x418ac3){throw new db[(_0x300b('0x1a'))][(_0x300b('0x1b'))](_0x300b('0x3e'));}_0x5e1c1a=_0x418ac3;if(!_0x5e1c1a[_0x300b('0x3f')]||!_0x5e1c1a[_0x300b('0x40')]||!_0x5e1c1a[_0x300b('0xa')]||!_0x5e1c1a['language']||!_0x5e1c1a['bucket']){throw new db[(_0x300b('0x1a'))][(_0x300b('0x1b'))](_0x300b('0x41'));}return db['CloudProvider'][_0x300b('0x24')]({'where':{'id':_0x5e1c1a['transcribeAccountId']}});})[_0x300b('0xc')](function(_0x4ffa19){if(!_0x4ffa19){throw new db['Sequelize'][(_0x300b('0x1b'))](_0x300b('0x32'));}if(!_0x4ffa19[_0x300b('0x25')]||!_0x4ffa19[_0x300b('0x26')]){throw new db['Sequelize'][(_0x300b('0x1b'))]('Cloud\x20Provider\x20not\x20configured');}_0x389256=_0x4ffa19;var _0x17dc41=[];_0x200476[_0x300b('0x42')](function(_0x1307ef){_0x17dc41[_0x300b('0x43')](checkTranscribeJob(_0x1307ef,_0x5e1c1a,_0x389256));});return BPromise[_0x300b('0x44')](_0x17dc41);})[_0x300b('0x35')](function(_0x69d6dd){if(_0x69d6dd){if(!_0x69d6dd[_0x300b('0x36')]||_0x69d6dd[_0x300b('0x36')]!==_0x300b('0x37')){logger[_0x300b('0x45')](util[_0x300b('0x39')](_0x69d6dd,{'showHidden':![],'depth':null}));}}});}exports[_0x300b('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x9703=['Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','inspect','start','request-promise','util','bluebird','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','results','transcripts','fileText','length','transcript','update','tempSentiment','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Transcript\x20not\x20available','CloudProvider','findOne','ValidationError','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','Sentiment\x20Analysis\x20not\x20configured','name','SequelizeValidationError','error','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check'];(function(_0x6281dc,_0x1c1fdc){var _0x190f03=function(_0x3d4684){while(--_0x3d4684){_0x6281dc['push'](_0x6281dc['shift']());}};_0x190f03(++_0x1c1fdc);}(_0x9703,0xdb));var _0x3970=function(_0x3b845e,_0x41a27a){_0x3b845e=_0x3b845e-0x0;var _0x50b68b=_0x9703[_0x3b845e];return _0x50b68b;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x3970('0x0'));var util=require(_0x3970('0x1'));var BPromise=require(_0x3970('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x3970('0x3'))('transcribe');function getTranscriptionJob(_0x2312a5,_0x5edd50,_0x34c97a,_0x400b12){return new Promise(function(_0x5cdfda,_0x5669ec){var _0x21986b=new AWS[(_0x3970('0x4'))]({'accessKeyId':_0x5edd50,'secretAccessKey':_0x2312a5,'region':_0x34c97a});_0x21986b[_0x3970('0x5')]({'TranscriptionJobName':_0x400b12},function(_0x41d4d1,_0x235a56){if(_0x41d4d1){return _0x5669ec(_0x41d4d1);}else{return _0x5cdfda(_0x235a56);}});});}function sentiment(_0x44fb72,_0x239d07,_0x28bdc3,_0x4a7006,_0x1edcaa){return new Promise(function(_0x290c74,_0xba62bb){var _0x5bb509=new AWS[(_0x3970('0x6'))]({'accessKeyId':_0x239d07,'secretAccessKey':_0x44fb72,'region':_0x28bdc3});_0x5bb509[_0x3970('0x7')]({'Text':_0x4a7006,'LanguageCode':_0x1edcaa['substring'](0x0,0x2)},function(_0x36399a,_0x5a24ff){if(_0x36399a){return _0xba62bb(_0x36399a);}else{return _0x290c74(_0x5a24ff);}});});}function checkTranscribeJob(_0x2bda43,_0x261275,_0x5920fb){var _0x116af8;return new BPromise(function(_0x41bdee,_0x35c904){logger[_0x3970('0x8')](util[_0x3970('0x9')](_0x3970('0xa'),_0x2bda43['id'],_0x2bda43[_0x3970('0xb')]));return getTranscriptionJob(_0x5920fb[_0x3970('0xc')],_0x5920fb['data2'],_0x261275[_0x3970('0xd')],_0x2bda43[_0x3970('0xb')])['then'](function(_0x21f297){logger[_0x3970('0x8')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x2bda43['id'],_0x2bda43['transcribeName'],_0x21f297[_0x3970('0xe')][_0x3970('0xf')]));if(!_0x2bda43['fileText']){switch(_0x21f297['TranscriptionJob'][_0x3970('0xf')]){case _0x3970('0x10'):var _0x1c677a={'transcribeStatus':_0x21f297['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x21f297[_0x3970('0xe')][_0x3970('0x11')][_0x3970('0x12')]};logger[_0x3970('0x8')](util[_0x3970('0x9')](_0x3970('0x13'),_0x2bda43['id']));return rp({'uri':_0x21f297['TranscriptionJob'][_0x3970('0x11')][_0x3970('0x12')],'json':!![]})[_0x3970('0x14')](function(_0x112fd0){logger[_0x3970('0x8')](util[_0x3970('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x2bda43['id']));if(_0x112fd0&&_0x112fd0[_0x3970('0x15')]&&_0x112fd0['results'][_0x3970('0x16')]&&_0x112fd0['results'][_0x3970('0x16')]['length']){_0x1c677a[_0x3970('0x17')]='';for(var _0x19f504=0x0;_0x19f504<_0x112fd0[_0x3970('0x15')][_0x3970('0x16')][_0x3970('0x18')];_0x19f504++){_0x1c677a[_0x3970('0x17')]+=_0x112fd0['results'][_0x3970('0x16')][_0x19f504][_0x3970('0x19')]+'';}}return _0x2bda43[_0x3970('0x1a')](_0x1c677a);})['then'](function(){logger[_0x3970('0x8')](util[_0x3970('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2bda43['id']));if(!_0x2bda43[_0x3970('0x1b')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x261275[_0x3970('0x1c')]||!_0x261275[_0x3970('0x1d')]||!_0x261275[_0x3970('0x1e')]||!_0x261275[_0x3970('0x1f')]||!_0x261275[_0x3970('0x20')]){throw new db[(_0x3970('0x21'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1c677a[_0x3970('0x17')]){throw new Error(_0x3970('0x22'));}if(_0x261275['sentimentAccountId']===_0x5920fb['id']){return _0x5920fb;}else{return db[_0x3970('0x23')][_0x3970('0x24')]({'where':{'id':_settings[_0x3970('0x1d')]}});}})['then'](function(_0x49876a){if(!_0x49876a){throw new db['Sequelize'][(_0x3970('0x25'))](_0x3970('0x26'));}if(!_0x49876a[_0x3970('0xc')]||!_0x49876a['data2']){throw new db[(_0x3970('0x21'))][(_0x3970('0x25'))](_0x3970('0x27'));}_0x116af8=_0x49876a;logger[_0x3970('0x8')](util[_0x3970('0x9')](_0x3970('0x28'),_0x2bda43['id']));return sentiment(_0x116af8[_0x3970('0xc')],_0x116af8[_0x3970('0x29')],_0x261275[_0x3970('0x1e')],_0x1c677a['fileText'],_0x261275[_0x3970('0x1f')]);})[_0x3970('0x14')](function(_0x59f560){logger[_0x3970('0x8')](util['format'](_0x3970('0x2a'),_0x2bda43['id']));return _0x2bda43[_0x3970('0x1a')]({'sentiment':_0x59f560[_0x3970('0x2b')],'sPositive':_0x59f560[_0x3970('0x2c')][_0x3970('0x2d')],'sNegative':_0x59f560['SentimentScore'][_0x3970('0x2e')],'sMixed':_0x59f560[_0x3970('0x2c')]['Mixed'],'sNeutral':_0x59f560[_0x3970('0x2c')][_0x3970('0x2f')]});})[_0x3970('0x14')](function(){logger[_0x3970('0x8')](util['format'](_0x3970('0x30'),_0x2bda43['id']));_0x41bdee();});case _0x3970('0x31'):return _0x2bda43[_0x3970('0x1a')]({'transcribeStatus':_0x3970('0x31'),'failureReason':_0x21f297[_0x3970('0xe')]['FailureReason']})['then'](function(){logger[_0x3970('0x8')](util[_0x3970('0x9')](_0x3970('0x30'),_0x2bda43['id']));_0x41bdee();});default:logger[_0x3970('0x8')](util['format'](_0x3970('0x32'),_0x2bda43['id']));break;}}else{return BPromise[_0x3970('0x33')]()[_0x3970('0x14')](function(){if(!_0x2bda43[_0x3970('0x1b')]){throw new db[(_0x3970('0x21'))][(_0x3970('0x25'))](_0x3970('0x34'));}if(!_0x261275[_0x3970('0x1c')]||!_0x261275['sentimentAccountId']||!_0x261275['sentimentRegion']||!_0x261275[_0x3970('0x1f')]||!_0x261275[_0x3970('0x20')]){throw new db['Sequelize']['ValidationError'](_0x3970('0x35'));}if(!_0x2bda43[_0x3970('0x17')]){throw new Error('Transcript\x20not\x20available');}if(_0x261275[_0x3970('0x1d')]===_0x5920fb['id']){return _0x5920fb;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x3970('0x1d')]}});}})[_0x3970('0x14')](function(_0x1802dc){if(!_0x1802dc){throw new db[(_0x3970('0x21'))][(_0x3970('0x25'))](_0x3970('0x26'));}if(!_0x1802dc[_0x3970('0xc')]||!_0x1802dc[_0x3970('0x29')]){throw new db[(_0x3970('0x21'))][(_0x3970('0x25'))](_0x3970('0x27'));}_0x116af8=_0x1802dc;logger['info'](util['format'](_0x3970('0x28'),_0x2bda43['id']));return sentiment(_0x116af8[_0x3970('0xc')],_0x116af8[_0x3970('0x29')],_0x261275[_0x3970('0x1e')],_0x2bda43['fileText'],_0x261275[_0x3970('0x1f')]);})['then'](function(_0x43291f){logger[_0x3970('0x8')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x2bda43['id']));return _0x2bda43['update']({'sentiment':_0x43291f['Sentiment'],'sPositive':_0x43291f[_0x3970('0x2c')][_0x3970('0x2d')],'sNegative':_0x43291f['SentimentScore'][_0x3970('0x2e')],'sMixed':_0x43291f[_0x3970('0x2c')]['Mixed'],'sNeutral':_0x43291f[_0x3970('0x2c')][_0x3970('0x2f')],'transcribeStatus':'COMPLETED'});})[_0x3970('0x14')](function(){logger[_0x3970('0x8')](util['format'](_0x3970('0x30'),_0x2bda43['id']));_0x41bdee();});}})['catch'](function(_0x2cbbd2){if(_0x2cbbd2){if(!_0x2cbbd2[_0x3970('0x36')]||_0x2cbbd2[_0x3970('0x36')]!==_0x3970('0x37')){logger[_0x3970('0x38')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x2bda43['id']),util['inspect'](_0x2cbbd2,{'showHidden':![],'depth':null}));}}_0x41bdee();});});}function checkTranscribe(){var _0x3fbf35;var _0x2bfa1b;var _0x18bd6e;return db[_0x3970('0x39')][_0x3970('0x3a')]({'where':{'transcribeStatus':_0x3970('0x3b')}})[_0x3970('0x14')](function(_0x191f40){if(!_0x191f40||!_0x191f40[_0x3970('0x18')]){throw new db['Sequelize'][(_0x3970('0x25'))](_0x3970('0x3c'));}_0x3fbf35=_0x191f40;return db[_0x3970('0x3d')][_0x3970('0x24')]({'where':{'id':0x1}});})[_0x3970('0x14')](function(_0x27ecb7){if(!_0x27ecb7){throw new db['Sequelize']['ValidationError'](_0x3970('0x3e'));}_0x2bfa1b=_0x27ecb7;if(!_0x2bfa1b[_0x3970('0x3f')]||!_0x2bfa1b[_0x3970('0x40')]||!_0x2bfa1b[_0x3970('0xd')]||!_0x2bfa1b[_0x3970('0x1f')]||!_0x2bfa1b[_0x3970('0x20')]){throw new db[(_0x3970('0x21'))][(_0x3970('0x25'))](_0x3970('0x41'));}return db['CloudProvider']['findOne']({'where':{'id':_0x2bfa1b[_0x3970('0x40')]}});})[_0x3970('0x14')](function(_0x1630ec){if(!_0x1630ec){throw new db[(_0x3970('0x21'))][(_0x3970('0x25'))](_0x3970('0x26'));}if(!_0x1630ec[_0x3970('0xc')]||!_0x1630ec[_0x3970('0x29')]){throw new db[(_0x3970('0x21'))][(_0x3970('0x25'))]('Cloud\x20Provider\x20not\x20configured');}_0x18bd6e=_0x1630ec;var _0x190bd0=[];_0x3fbf35[_0x3970('0x42')](function(_0x4f88b8){_0x190bd0[_0x3970('0x43')](checkTranscribeJob(_0x4f88b8,_0x2bfa1b,_0x18bd6e));});return BPromise['all'](_0x190bd0);})['catch'](function(_0x99a553){if(_0x99a553){if(!_0x99a553[_0x3970('0x36')]||_0x99a553[_0x3970('0x36')]!==_0x3970('0x37')){logger[_0x3970('0x38')](util[_0x3970('0x44')](_0x99a553,{'showHidden':![],'depth':null}));}}});}exports[_0x3970('0x45')]=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 6a88799..f54df09 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 _0x5332=['info','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','ioredis','util','../../config/environment','../logger','schedule','redis','localhost','WhatsappInteraction','findAll','lastMsgAt','hours','then','length'];(function(_0x21820d,_0x2725c9){var _0x309f81=function(_0xc7ccf0){while(--_0xc7ccf0){_0x21820d['push'](_0x21820d['shift']());}};_0x309f81(++_0x2725c9);}(_0x5332,0x12a));var _0x2533=function(_0xeeb89c,_0x3b2567){_0xeeb89c=_0xeeb89c-0x0;var _0x5c15da=_0x5332[_0xeeb89c];return _0x5c15da;};'use strict';var _=require(_0x2533('0x0'));var moment=require('moment');var Redis=require(_0x2533('0x1'));var util=require(_0x2533('0x2'));var config=require(_0x2533('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x2533('0x4'))(_0x2533('0x5'));config[_0x2533('0x6')]=_['defaults'](config[_0x2533('0x6')],{'host':_0x2533('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x338f33=[];return db[_0x2533('0x8')][_0x2533('0x9')]({'raw':!![],'attributes':['id',_0x2533('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x2533('0xb'))}}})[_0x2533('0xc')](function(_0x491988){if(_0x491988&&_0x491988[_0x2533('0xd')]){_0x338f33=_['map'](_0x491988||[],'id');logger[_0x2533('0xe')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x338f33['join']());return db[_0x2533('0x8')][_0x2533('0xf')]({'closeReason':_0x2533('0x10'),'disposition':_0x2533('0x11'),'closed':!![],'closedAt':moment()[_0x2533('0x12')](_0x2533('0x13'))},{'where':{'id':_0x338f33}});}})[_0x2533('0xc')](function(){if(_0x338f33&&_0x338f33[_0x2533('0xd')]){logger[_0x2533('0xe')](_0x2533('0x14'),_0x338f33['join']());for(var _0x5335f3=0x0;_0x5335f3<_0x338f33[_0x2533('0xd')];_0x5335f3++){io['emit'](_0x2533('0x15'),{'id':_0x338f33[_0x5335f3],'closed':!![]});}}})[_0x2533('0x16')](function(_0x144d3f){logger[_0x2533('0x17')](_0x2533('0x18'),_0x144d3f?util[_0x2533('0x19')](_0x144d3f,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x562d=['map','info','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','inspect','lodash','ioredis','../../mysqldb','../logger','redis','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length'];(function(_0x1343bc,_0x1c89ad){var _0x3d4fbe=function(_0x1bd8ee){while(--_0x1bd8ee){_0x1343bc['push'](_0x1343bc['shift']());}};_0x3d4fbe(++_0x1c89ad);}(_0x562d,0x1e8));var _0xd562=function(_0x2364ef,_0x18706b){_0x2364ef=_0x2364ef-0x0;var _0x5555aa=_0x562d[_0x2364ef];return _0x5555aa;};'use strict';var _=require(_0xd562('0x0'));var moment=require('moment');var Redis=require(_0xd562('0x1'));var util=require('util');var config=require('../../config/environment');var db=require(_0xd562('0x2'))['db'];var logger=require(_0xd562('0x3'))('schedule');config[_0xd562('0x4')]=_['defaults'](config[_0xd562('0x4')],{'host':_0xd562('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd562('0x4')]));function closeInteractions(){var _0x2cb932=[];return db[_0xd562('0x6')][_0xd562('0x7')]({'raw':!![],'attributes':['id',_0xd562('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd562('0x9')](0x18,_0xd562('0xa'))}}})['then'](function(_0x5d5347){if(_0x5d5347&&_0x5d5347[_0xd562('0xb')]){_0x2cb932=_[_0xd562('0xc')](_0x5d5347||[],'id');logger[_0xd562('0xd')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2cb932[_0xd562('0xe')]());return db['WhatsappInteraction'][_0xd562('0xf')]({'closeReason':_0xd562('0x10'),'disposition':_0xd562('0x11'),'closed':!![],'closedAt':moment()['format'](_0xd562('0x12'))},{'where':{'id':_0x2cb932}});}})[_0xd562('0x13')](function(){if(_0x2cb932&&_0x2cb932[_0xd562('0xb')]){logger[_0xd562('0xd')](_0xd562('0x14'),_0x2cb932[_0xd562('0xe')]());for(var _0x1f31cb=0x0;_0x1f31cb<_0x2cb932[_0xd562('0xb')];_0x1f31cb++){io[_0xd562('0x15')](_0xd562('0x16'),{'id':_0x2cb932[_0x1f31cb],'closed':!![]});}}})['catch'](function(_0x5b817d){logger[_0xd562('0x17')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x5b817d?util[_0xd562('0x18')](_0x5b817d,{'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 f657658..b4b330a 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe892=['Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','util'];(function(_0x5a522a,_0x1cb324){var _0x45fc33=function(_0x3ea320){while(--_0x3ea320){_0x5a522a['push'](_0x5a522a['shift']());}};_0x45fc33(++_0x1cb324);}(_0xe892,0x1b4));var _0x2e89=function(_0xaf9cbc,_0x1d3d23){_0xaf9cbc=_0xaf9cbc-0x0;var _0x4b6712=_0xe892[_0xaf9cbc];return _0x4b6712;};'use strict';var util=require(_0x2e89('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x2e89('0x1')+i,'lastName':_0x2e89('0x2')+i,'phone':0xf879fb460+i,'email':_0x2e89('0x3')+i+_0x2e89('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2e89('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x2e89('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2e89('0x6')](),'updatedAt':Date[_0x2e89('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x2e89('0x1')+i,'lastName':_0x2e89('0x2')+i,'phone':0xf879fb460+i,'email':_0x2e89('0x3')+i+_0x2e89('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x2e89('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2e89('0x6')](),'updatedAt':Date[_0x2e89('0x6')]()});}db[_0x2e89('0x7')][_0x2e89('0x8')]({'where':{}})[_0x2e89('0x9')](function(){return db['CmContact'][_0x2e89('0xa')](contacts);})[_0x2e89('0x9')](function(){console[_0x2e89('0xb')](_0x2e89('0xc'),_0x2e89('0xd'));return db[_0x2e89('0xe')]['destroy']({'where':{}});})[_0x2e89('0x9')](function(){return db[_0x2e89('0xe')][_0x2e89('0xa')](hopper);})['then'](function(){console[_0x2e89('0xb')]('finished\x20populating',_0x2e89('0xf'));return db[_0x2e89('0x7')][_0x2e89('0xa')](contacts2);})[_0x2e89('0x9')](function(){console['log'](_0x2e89('0xc'),_0x2e89('0x10'));return db[_0x2e89('0xe')][_0x2e89('0xa')](hopper2);})[_0x2e89('0x9')](function(){console[_0x2e89('0xb')]('finished\x20populating',_0x2e89('0x11'));})[_0x2e89('0x12')](function(_0x3166b6){console[_0x2e89('0xb')](_0x3166b6);}); \ No newline at end of file +var _0xa83c=['Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','util','../mysqldb','push'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0xa83c,0x1c5));var _0xca83=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0xa83c[_0x3b5ad9];return _0x611ae9;};'use strict';var util=require(_0xca83('0x0'));var db=require(_0xca83('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xca83('0x2')]({'id':i,'firstName':_0xca83('0x3')+i,'lastName':_0xca83('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xca83('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xca83('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xca83('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xca83('0x6')](),'updatedAt':Date[_0xca83('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xca83('0x2')]({'id':i,'firstName':_0xca83('0x3')+i,'lastName':_0xca83('0x4')+i,'phone':0xf879fb460+i,'email':_0xca83('0x7')+i+_0xca83('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xca83('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xca83('0x6')](),'updatedAt':Date[_0xca83('0x6')]()});}db[_0xca83('0x8')]['destroy']({'where':{}})[_0xca83('0x9')](function(){return db['CmContact'][_0xca83('0xa')](contacts);})[_0xca83('0x9')](function(){console[_0xca83('0xb')](_0xca83('0xc'),_0xca83('0xd'));return db[_0xca83('0xe')]['destroy']({'where':{}});})[_0xca83('0x9')](function(){return db[_0xca83('0xe')][_0xca83('0xa')](hopper);})['then'](function(){console[_0xca83('0xb')](_0xca83('0xc'),_0xca83('0xf'));return db['CmContact'][_0xca83('0xa')](contacts2);})['then'](function(){console[_0xca83('0xb')](_0xca83('0xc'),_0xca83('0x10'));return db[_0xca83('0xe')]['bulkCreate'](hopper2);})['then'](function(){console['log']('finished\x20populating',_0xca83('0x11'));})[_0xca83('0x12')](function(_0x1be16e){console[_0xca83('0xb')](_0x1be16e);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 557d409..7e62916 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a5e=['ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','push','format','%s%s','agent','password','wss','all'];(function(_0x4339c4,_0x30fd6f){var _0x4e2072=function(_0x573d9d){while(--_0x573d9d){_0x4339c4['push'](_0x4339c4['shift']());}};_0x4e2072(++_0x30fd6f);}(_0x2a5e,0x1e6));var _0xe2a5=function(_0x896f30,_0x302309){_0x896f30=_0x896f30-0x0;var _0x2f4422=_0x2a5e[_0x896f30];return _0x2f4422;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xe2a5('0x0')]({'name':util[_0xe2a5('0x1')](_0xe2a5('0x2'),_0xe2a5('0x3'),i),'fullname':util[_0xe2a5('0x1')]('%s%s',_0xe2a5('0x3'),i),'email':util['format']('%s%s@xcally.com',_0xe2a5('0x3'),i),'role':_0xe2a5('0x3'),'password':_0xe2a5('0x4'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0xe2a5('0x5')],'disallow':[_0xe2a5('0x6')],'allow':[_0xe2a5('0x7')],'defaultuser':util['format'](_0xe2a5('0x2'),'agent',i),'encryption':_0xe2a5('0x8'),'avpf':_0xe2a5('0x8'),'force_avp':_0xe2a5('0x8'),'icesupport':_0xe2a5('0x8'),'dtlsenable':_0xe2a5('0x8'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xe2a5('0x9'),'dtlssetup':_0xe2a5('0xa'),'callerid':util[_0xe2a5('0x1')](_0xe2a5('0xb'),util[_0xe2a5('0x1')](_0xe2a5('0x2'),_0xe2a5('0x3'),i),0xfa0+i)});}db[_0xe2a5('0xc')]['bulkCreate'](users)[_0xe2a5('0xd')](function(){console[_0xe2a5('0xe')](_0xe2a5('0xf'));})[_0xe2a5('0x10')](function(_0x4178e4){console[_0xe2a5('0xe')](_0x4178e4);}); \ No newline at end of file +var _0x7a85=['then','log','add\x20user','catch','push','format','%s%s','agent','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a85,0x100));var _0x57a8=function(_0x3df179,_0x2a79cf){_0x3df179=_0x3df179-0x0;var _0x27eb2f=_0x7a85[_0x3df179];return _0x27eb2f;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x57a8('0x0')]({'name':util[_0x57a8('0x1')](_0x57a8('0x2'),_0x57a8('0x3'),i),'fullname':util[_0x57a8('0x1')](_0x57a8('0x2'),_0x57a8('0x3'),i),'email':util['format']('%s%s@xcally.com',_0x57a8('0x3'),i),'role':'agent','password':_0x57a8('0x4'),'internal':0xfa0+i,'type':_0x57a8('0x5'),'transport':[_0x57a8('0x6'),'ws',_0x57a8('0x7')],'disallow':[_0x57a8('0x8')],'allow':[_0x57a8('0x9')],'defaultuser':util[_0x57a8('0x1')]('%s%s',_0x57a8('0x3'),i),'encryption':_0x57a8('0xa'),'avpf':'yes','force_avp':_0x57a8('0xa'),'icesupport':_0x57a8('0xa'),'dtlsenable':_0x57a8('0xa'),'dtlsverify':'no','dtlscertfile':_0x57a8('0xb'),'dtlsprivatekey':_0x57a8('0xc'),'dtlssetup':_0x57a8('0xd'),'callerid':util[_0x57a8('0x1')](_0x57a8('0xe'),util[_0x57a8('0x1')](_0x57a8('0x2'),_0x57a8('0x3'),i),0xfa0+i)});}db[_0x57a8('0xf')][_0x57a8('0x10')](users)[_0x57a8('0x11')](function(){console[_0x57a8('0x12')](_0x57a8('0x13'));})[_0x57a8('0x14')](function(_0x4e2b28){console[_0x57a8('0x12')](_0x4e2b28);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index b69750c..676aed2 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37c7=['default','connection','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','UserProfileResource','resourceId','Campaign','where','format','%s:queue:%s','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','WhatsappInteraction','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','MailQueue','WhatsappQueue','Trunk','user','FaxQueue','SmsQueue','MailQueues','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','sms','mail','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','map','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join'];(function(_0x536c58,_0x13da7d){var _0x42ddf8=function(_0x444f96){while(--_0x444f96){_0x536c58['push'](_0x536c58['shift']());}};_0x42ddf8(++_0x13da7d);}(_0x37c7,0xda));var _0x737c=function(_0x26c26c,_0x39f9cf){_0x26c26c=_0x26c26c-0x0;var _0x153b04=_0x37c7[_0x26c26c];return _0x153b04;};'use strict';var _=require(_0x737c('0x0'));var util=require('util');var BPromise=require(_0x737c('0x1'));var db=require(_0x737c('0x2'))['db'];var config=require(_0x737c('0x3'));var queryQueues={'attributes':['id',_0x737c('0x4')],'include':[{'as':_0x737c('0x5'),'model':db[_0x737c('0x6')],'attributes':['id',_0x737c('0x4'),_0x737c('0x7')],'raw':!![],'where':{'role':_0x737c('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x737c('0x4')],'where':{'role':_0x737c('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x737c('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x737c('0x4')],'where':{'role':_0x737c('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x737c('0x4'),_0x737c('0xa')],'where':{'type':_0x737c('0xb')}};function getAssociatedResources(_0x4f0ad1,_0x140a33,_0x567eb0){return db[_0x737c('0xc')]['findOne']({'where':{'name':_0x4f0ad1,'userProfileId':_0x140a33},'raw':!![]})[_0x737c('0xd')](function(_0x51dc6a){if(_0x51dc6a){if(_0x51dc6a[_0x737c('0xe')]){switch(_0x4f0ad1){case _0x737c('0xf'):case _0x737c('0x10'):case _0x737c('0x11'):case _0x737c('0x12'):case'MailQueues':case _0x737c('0x13'):case _0x737c('0x14'):return db[_0x567eb0][_0x737c('0x15')](queryQueues);case _0x737c('0x16'):return db[_0x567eb0][_0x737c('0x15')](queryTelephones);case'Trunks':return db[_0x567eb0][_0x737c('0x15')](queryTrunks);case'IvrCampaigns':return db[_0x567eb0][_0x737c('0x15')](queryCampaigns);}}else{return db[_0x737c('0x17')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x51dc6a['id']},'raw':!![]})[_0x737c('0xd')](function(_0x3a970c){if(_0x3a970c){var _0xffbe88={'where':{'id':_['map'](_0x3a970c,_0x737c('0x18'))},'raw':!![]};switch(_0x567eb0){case _0x737c('0x6'):_0xffbe88['where'][_0x737c('0x7')]=_0x737c('0x9');break;case _0x737c('0x19'):_0xffbe88[_0x737c('0x1a')][_0x737c('0xa')]='ivr';break;}return db[_0x567eb0][_0x737c('0x15')](_0xffbe88);}else{return[];}});}}else{return[];}})[_0x737c('0xd')](function(_0x11f221){return _0x11f221;});}function joinOrLeaveQueues(_0x3ed81f,_0x328406,_0x819c62,_0x1480e4){_0x3ed81f[_0x328406](util[_0x737c('0x1b')](_0x737c('0x1c'),_0x819c62,_0x1480e4[_0x737c('0x4')]));if(_0x1480e4['Agents']){for(var _0x38cd1f=0x0;_0x38cd1f<_0x1480e4[_0x737c('0x5')]['length'];_0x38cd1f+=0x1){_0x3ed81f[_0x328406](util[_0x737c('0x1b')](_0x737c('0x1d'),_0x1480e4[_0x737c('0x5')][_0x38cd1f][_0x737c('0x4')]));}}}function joinOrLeave(_0x2d625f,_0x5d007f,_0x4f833c){var _0x2bdd87;if(_0x2d625f[_0x737c('0x1e')][_0x737c('0x1f')]['id']){db['User'][_0x737c('0x20')]({'attributes':['id',_0x737c('0x4'),'role',_0x737c('0x21')],'where':{'id':_0x2d625f['handshake'][_0x737c('0x1f')]['id']},'include':[{'model':db[_0x737c('0x22')],'as':_0x737c('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x737c('0x24')],'as':_0x737c('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x737c('0x26')],'as':_0x737c('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x737c('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x737c('0x29')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x737c('0xd')](function(_0x4fc764){if(_0x4fc764){_0x2bdd87=_0x4fc764;_0x2d625f[_0x5d007f](util[_0x737c('0x1b')]('user:%s',_0x4fc764[_0x737c('0x4')]));var _0x2171ea=[];switch(_0x4fc764[_0x737c('0x7')]){case _0x737c('0x2a'):_0x2d625f[_0x5d007f](_0x737c('0x2b'));_0x2d625f[_0x5d007f](_0x737c('0x2c'));if(queryQueues['hasOwnProperty'](_0x737c('0x2d'))){delete queryQueues[_0x737c('0x2d')];}_0x2171ea[_0x737c('0x2e')](db[_0x737c('0x2f')][_0x737c('0x15')](queryQueues));_0x2171ea[_0x737c('0x2e')](db[_0x737c('0x30')][_0x737c('0x15')](queryQueues));_0x2171ea[_0x737c('0x2e')](db['FaxQueue'][_0x737c('0x15')](queryQueues));_0x2171ea['push'](db['SmsQueue'][_0x737c('0x15')](queryQueues));_0x2171ea['push'](db[_0x737c('0x31')][_0x737c('0x15')](queryQueues));_0x2171ea[_0x737c('0x2e')](db['OpenchannelQueue'][_0x737c('0x15')](queryQueues));_0x2171ea[_0x737c('0x2e')](db[_0x737c('0x32')][_0x737c('0x15')](queryQueues));_0x2171ea['push'](db['User'][_0x737c('0x15')](queryTelephones));_0x2171ea[_0x737c('0x2e')](db[_0x737c('0x33')][_0x737c('0x15')](queryTrunks));_0x2171ea['push'](db[_0x737c('0x19')]['findAll'](queryCampaigns));_0x2171ea['push'](db[_0x737c('0x6')]['findAll'](queryAgents));break;case _0x737c('0x34'):_0x2d625f[_0x5d007f](_0x737c('0x2b'));_0x2d625f[_0x5d007f](_0x737c('0x2c'));_0x2171ea[_0x737c('0x2e')](getAssociatedResources(_0x737c('0xf'),_0x4fc764[_0x737c('0x21')],'VoiceQueue'));_0x2171ea['push'](getAssociatedResources('ChatQueues',_0x4fc764[_0x737c('0x21')],_0x737c('0x30')));_0x2171ea[_0x737c('0x2e')](getAssociatedResources(_0x737c('0x11'),_0x4fc764['userProfileId'],_0x737c('0x35')));_0x2171ea['push'](getAssociatedResources('SmsQueues',_0x4fc764['userProfileId'],_0x737c('0x36')));_0x2171ea[_0x737c('0x2e')](getAssociatedResources(_0x737c('0x37'),_0x4fc764['userProfileId'],'MailQueue'));_0x2171ea[_0x737c('0x2e')](getAssociatedResources('OpenchannelQueues',_0x4fc764[_0x737c('0x21')],'OpenchannelQueue'));_0x2171ea[_0x737c('0x2e')](getAssociatedResources(_0x737c('0x14'),_0x4fc764[_0x737c('0x21')],_0x737c('0x32')));_0x2171ea[_0x737c('0x2e')](getAssociatedResources(_0x737c('0x16'),_0x4fc764['userProfileId'],_0x737c('0x6')));_0x2171ea[_0x737c('0x2e')](getAssociatedResources(_0x737c('0x38'),_0x4fc764['userProfileId'],'Trunk'));_0x2171ea[_0x737c('0x2e')](getAssociatedResources('IvrCampaigns',_0x4fc764[_0x737c('0x21')],_0x737c('0x19')));_0x2171ea[_0x737c('0x2e')](db[_0x737c('0x6')][_0x737c('0x15')](queryAgents));break;case _0x737c('0x8'):_0x2d625f[_0x5d007f]('voice:inbound');_0x2d625f[_0x5d007f](_0x737c('0x2c'));_0x2171ea[_0x737c('0x2e')](_0x4fc764[_0x737c('0x39')]({'attributes':['id',_0x737c('0x4')]}));_0x2171ea[_0x737c('0x2e')](_0x4fc764[_0x737c('0x3a')]({'attributes':['id',_0x737c('0x4')]}));_0x2171ea[_0x737c('0x2e')](_0x4fc764[_0x737c('0x3b')]({'attributes':['id',_0x737c('0x4')]}));_0x2171ea[_0x737c('0x2e')](_0x4fc764[_0x737c('0x3c')]({'attributes':['id',_0x737c('0x4')]}));_0x2171ea[_0x737c('0x2e')](_0x4fc764[_0x737c('0x3d')]({'attributes':['id',_0x737c('0x4')]}));_0x2171ea[_0x737c('0x2e')](_0x4fc764[_0x737c('0x3e')]({'attributes':['id',_0x737c('0x4')]}));_0x2171ea[_0x737c('0x2e')](_0x4fc764[_0x737c('0x3f')]({'attributes':['id',_0x737c('0x4')]}));break;}return BPromise[_0x737c('0x40')](_0x2171ea);}})[_0x737c('0xd')](function(_0x4304b2){if(_0x4304b2&&_0x4304b2[_0x737c('0x41')]){for(var _0x262b43=0x0;_0x262b43<_0x4304b2[_0x737c('0x41')];_0x262b43+=0x1){for(var _0x535df8=0x0;_0x535df8<_0x4304b2[_0x262b43][_0x737c('0x41')];_0x535df8+=0x1){switch(_0x262b43){case 0x0:joinOrLeaveQueues(_0x2d625f,_0x5d007f,_0x737c('0x42'),_0x4304b2[_0x262b43][_0x535df8]);break;case 0x1:joinOrLeaveQueues(_0x2d625f,_0x5d007f,_0x737c('0x43'),_0x4304b2[_0x262b43][_0x535df8]);break;case 0x2:joinOrLeaveQueues(_0x2d625f,_0x5d007f,'fax',_0x4304b2[_0x262b43][_0x535df8]);break;case 0x3:joinOrLeaveQueues(_0x2d625f,_0x5d007f,_0x737c('0x44'),_0x4304b2[_0x262b43][_0x535df8]);break;case 0x4:joinOrLeaveQueues(_0x2d625f,_0x5d007f,_0x737c('0x45'),_0x4304b2[_0x262b43][_0x535df8]);break;case 0x5:joinOrLeaveQueues(_0x2d625f,_0x5d007f,'openchannel',_0x4304b2[_0x262b43][_0x535df8]);break;case 0x6:joinOrLeaveQueues(_0x2d625f,_0x5d007f,_0x737c('0x46'),_0x4304b2[_0x262b43][_0x535df8]);break;case 0x7:if(_0x2bdd87['role']!==_0x737c('0x8'))_0x2d625f[_0x5d007f](util[_0x737c('0x1b')](_0x737c('0x47'),_0x4304b2[_0x262b43][_0x535df8][_0x737c('0x4')]));break;case 0x8:if(_0x2bdd87[_0x737c('0x7')]!==_0x737c('0x8'))_0x2d625f[_0x5d007f](util[_0x737c('0x1b')](_0x737c('0x48'),_0x4304b2[_0x262b43][_0x535df8][_0x737c('0x4')]));break;case 0x9:if(_0x2bdd87[_0x737c('0x7')]!==_0x737c('0x8'))_0x2d625f[_0x5d007f](util[_0x737c('0x1b')]('campaign:%s:%s',_0x4304b2[_0x262b43][_0x535df8][_0x737c('0xa')],_0x4304b2[_0x262b43][_0x535df8][_0x737c('0x4')]));break;case 0xa:_0x2d625f[_0x5d007f](util[_0x737c('0x1b')](_0x737c('0x1d'),_0x4304b2[_0x262b43][_0x535df8][_0x737c('0x4')]));break;}}}}})[_0x737c('0xd')](function(){if(_0x5d007f===_0x737c('0x49')){var _0x1e641c=_['map'](_0x2bdd87[_0x737c('0x23')],'id');return _0x2bdd87[_0x737c('0x4a')](_0x1e641c)[_0x737c('0xd')](function(){for(var _0x32a12e=0x0;_0x32a12e<_0x1e641c['length'];_0x32a12e+=0x1){_0x4f833c['emit'](_0x737c('0x4b'),{'ChatInteractionId':Number(_0x1e641c[_0x32a12e]),'UserId':Number(_0x2bdd87['id'])});}});}})['then'](function(){if(_0x5d007f===_0x737c('0x49')){var _0x2b6f1c=_['map'](_0x2bdd87['MailInteractions'],'id');return _0x2bdd87[_0x737c('0x4c')](_0x2b6f1c)[_0x737c('0xd')](function(){for(var _0x526884=0x0;_0x526884<_0x2b6f1c[_0x737c('0x41')];_0x526884+=0x1){_0x4f833c[_0x737c('0x4d')](_0x737c('0x4e'),{'MailInteractionId':Number(_0x2b6f1c[_0x526884]),'UserId':Number(_0x2bdd87['id'])});}});}})[_0x737c('0xd')](function(){if(_0x5d007f===_0x737c('0x49')){var _0x1fbb75=_[_0x737c('0x4f')](_0x2bdd87[_0x737c('0x27')],'id');return _0x2bdd87[_0x737c('0x50')](_0x1fbb75)[_0x737c('0xd')](function(){for(var _0x3d324e=0x0;_0x3d324e<_0x1fbb75[_0x737c('0x41')];_0x3d324e+=0x1){_0x4f833c['emit'](_0x737c('0x51'),{'FaxInteractionId':Number(_0x1fbb75[_0x3d324e]),'UserId':Number(_0x2bdd87['id'])});}});}})[_0x737c('0xd')](function(){if(_0x5d007f===_0x737c('0x49')){var _0x5ada5d=_[_0x737c('0x4f')](_0x2bdd87[_0x737c('0x52')],'id');return _0x2bdd87[_0x737c('0x53')](_0x5ada5d)[_0x737c('0xd')](function(){for(var _0x49607e=0x0;_0x49607e<_0x5ada5d['length'];_0x49607e+=0x1){_0x4f833c['emit'](_0x737c('0x54'),{'SmsInteractionId':Number(_0x5ada5d[_0x49607e]),'UserId':Number(_0x2bdd87['id'])});}});}})[_0x737c('0xd')](function(){if(_0x5d007f===_0x737c('0x49')){var _0x236fac=_[_0x737c('0x4f')](_0x2bdd87[_0x737c('0x55')],'id');return _0x2bdd87[_0x737c('0x56')](_0x236fac)[_0x737c('0xd')](function(){for(var _0x15c4ca=0x0;_0x15c4ca<_0x236fac[_0x737c('0x41')];_0x15c4ca+=0x1){_0x4f833c['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x236fac[_0x15c4ca]),'UserId':Number(_0x2bdd87['id'])});}});}})[_0x737c('0xd')](function(){if(_0x5d007f===_0x737c('0x49')){var _0x4dbfa6=_['map'](_0x2bdd87['WhatsappInteractions'],'id');return _0x2bdd87[_0x737c('0x57')](_0x4dbfa6)[_0x737c('0xd')](function(){for(var _0x4faf66=0x0;_0x4faf66<_0x4dbfa6[_0x737c('0x41')];_0x4faf66+=0x1){_0x4f833c[_0x737c('0x4d')](_0x737c('0x58'),{'WhatsappInteractionId':Number(_0x4dbfa6[_0x4faf66]),'UserId':Number(_0x2bdd87['id'])});}});}})['catch'](function(_0x433a9c){_0x2d625f[_0x737c('0x59')](_0x433a9c);});}}function onDisconnect(_0x2b0a7f,_0xae0312){joinOrLeave(_0x2b0a7f,_0x737c('0x49'),_0xae0312);}function onConnect(_0x1424f9){joinOrLeave(_0x1424f9,_0x737c('0x5a'));}exports[_0x737c('0x5b')]=function(_0x1943e4){_0x1943e4['on'](_0x737c('0x5c'),function(_0xadd699){_0xadd699['setMaxListeners'](0x0);_0xadd699['address']=_0xadd699[_0x737c('0x5d')][_0x737c('0x5c')][_0x737c('0x5e')]+':'+_0xadd699[_0x737c('0x5d')][_0x737c('0x5c')][_0x737c('0x5f')];_0xadd699[_0x737c('0x60')]=new Date();_0xadd699[_0x737c('0x59')]=function(_0x39e7ce){console[_0x737c('0x59')](_0x737c('0x61')+_0xadd699[_0x737c('0x62')]['name']+'['+_0xadd699[_0x737c('0x63')]+']',_0x39e7ce);};_0xadd699['on'](_0x737c('0x64'),function(){onDisconnect(_0xadd699,_0x1943e4);_0xadd699[_0x737c('0x59')](_0x737c('0x65'));});onConnect(_0xadd699);_0xadd699['log'](_0x737c('0x66'));});}; \ No newline at end of file +var _0xbdc2=['all','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','connection','setMaxListeners','address','request','remoteAddress','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','Agents','User','role','agent','telephone','name','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','VoiceQueues','userProfileId','OpenchannelQueue','Telephones','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues'];(function(_0x51ac3c,_0x5533d4){var _0x113173=function(_0x26288b){while(--_0x26288b){_0x51ac3c['push'](_0x51ac3c['shift']());}};_0x113173(++_0x5533d4);}(_0xbdc2,0x148));var _0x2bdc=function(_0x6bbc50,_0x26b8e9){_0x6bbc50=_0x6bbc50-0x0;var _0x5e8e93=_0xbdc2[_0x6bbc50];return _0x5e8e93;};'use strict';var _=require(_0x2bdc('0x0'));var util=require(_0x2bdc('0x1'));var BPromise=require(_0x2bdc('0x2'));var db=require(_0x2bdc('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x2bdc('0x4'),'model':db[_0x2bdc('0x5')],'attributes':['id','name',_0x2bdc('0x6')],'raw':!![],'where':{'role':_0x2bdc('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x2bdc('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x2bdc('0x9')],'where':{'role':_0x2bdc('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2bdc('0x9'),_0x2bdc('0xa')],'where':{'type':_0x2bdc('0xb')}};function getAssociatedResources(_0x2ea04b,_0x10c4ba,_0x1dd7c9){return db[_0x2bdc('0xc')][_0x2bdc('0xd')]({'where':{'name':_0x2ea04b,'userProfileId':_0x10c4ba},'raw':!![]})[_0x2bdc('0xe')](function(_0x386e58){if(_0x386e58){if(_0x386e58[_0x2bdc('0xf')]){switch(_0x2ea04b){case'VoiceQueues':case _0x2bdc('0x10'):case'FaxQueues':case _0x2bdc('0x11'):case _0x2bdc('0x12'):case _0x2bdc('0x13'):case'WhatsappQueues':return db[_0x1dd7c9][_0x2bdc('0x14')](queryQueues);case'Telephones':return db[_0x1dd7c9][_0x2bdc('0x14')](queryTelephones);case _0x2bdc('0x15'):return db[_0x1dd7c9][_0x2bdc('0x14')](queryTrunks);case _0x2bdc('0x16'):return db[_0x1dd7c9][_0x2bdc('0x14')](queryCampaigns);}}else{return db[_0x2bdc('0x17')][_0x2bdc('0x14')]({'attributes':['resourceId'],'where':{'sectionId':_0x386e58['id']},'raw':!![]})[_0x2bdc('0xe')](function(_0x79c8d5){if(_0x79c8d5){var _0x2b13ea={'where':{'id':_['map'](_0x79c8d5,_0x2bdc('0x18'))},'raw':!![]};switch(_0x1dd7c9){case'User':_0x2b13ea[_0x2bdc('0x19')]['role']=_0x2bdc('0x8');break;case _0x2bdc('0x1a'):_0x2b13ea[_0x2bdc('0x19')]['type']=_0x2bdc('0xb');break;}return db[_0x1dd7c9][_0x2bdc('0x14')](_0x2b13ea);}else{return[];}});}}else{return[];}})[_0x2bdc('0xe')](function(_0x5494c9){return _0x5494c9;});}function joinOrLeaveQueues(_0x16def6,_0x3280d9,_0x4fd2a2,_0x3e2b32){_0x16def6[_0x3280d9](util[_0x2bdc('0x1b')](_0x2bdc('0x1c'),_0x4fd2a2,_0x3e2b32[_0x2bdc('0x9')]));if(_0x3e2b32[_0x2bdc('0x4')]){for(var _0x31d773=0x0;_0x31d773<_0x3e2b32['Agents'][_0x2bdc('0x1d')];_0x31d773+=0x1){_0x16def6[_0x3280d9](util[_0x2bdc('0x1b')](_0x2bdc('0x1e'),_0x3e2b32[_0x2bdc('0x4')][_0x31d773][_0x2bdc('0x9')]));}}}function joinOrLeave(_0x531623,_0x2efff1,_0x3e692f){var _0x3af3be;if(_0x531623[_0x2bdc('0x1f')][_0x2bdc('0x20')]['id']){db['User'][_0x2bdc('0x21')]({'attributes':['id',_0x2bdc('0x9'),_0x2bdc('0x6'),'userProfileId'],'where':{'id':_0x531623[_0x2bdc('0x1f')][_0x2bdc('0x20')]['id']},'include':[{'model':db[_0x2bdc('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2bdc('0x23')],'as':_0x2bdc('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x2bdc('0x25')],'as':_0x2bdc('0x26'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x2bdc('0x27'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x2bdc('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x2bdc('0x29')],'as':_0x2bdc('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x2bdc('0xe')](function(_0x560f43){if(_0x560f43){_0x3af3be=_0x560f43;_0x531623[_0x2efff1](util['format']('user:%s',_0x560f43[_0x2bdc('0x9')]));var _0x308c02=[];switch(_0x560f43[_0x2bdc('0x6')]){case _0x2bdc('0x2b'):_0x531623[_0x2efff1](_0x2bdc('0x2c'));_0x531623[_0x2efff1](_0x2bdc('0x2d'));if(queryQueues[_0x2bdc('0x2e')](_0x2bdc('0x2f'))){delete queryQueues[_0x2bdc('0x2f')];}_0x308c02[_0x2bdc('0x30')](db[_0x2bdc('0x31')][_0x2bdc('0x14')](queryQueues));_0x308c02[_0x2bdc('0x30')](db['ChatQueue']['findAll'](queryQueues));_0x308c02[_0x2bdc('0x30')](db[_0x2bdc('0x32')][_0x2bdc('0x14')](queryQueues));_0x308c02[_0x2bdc('0x30')](db[_0x2bdc('0x33')][_0x2bdc('0x14')](queryQueues));_0x308c02[_0x2bdc('0x30')](db[_0x2bdc('0x34')][_0x2bdc('0x14')](queryQueues));_0x308c02[_0x2bdc('0x30')](db['OpenchannelQueue'][_0x2bdc('0x14')](queryQueues));_0x308c02[_0x2bdc('0x30')](db[_0x2bdc('0x35')][_0x2bdc('0x14')](queryQueues));_0x308c02[_0x2bdc('0x30')](db[_0x2bdc('0x5')][_0x2bdc('0x14')](queryTelephones));_0x308c02['push'](db[_0x2bdc('0x36')]['findAll'](queryTrunks));_0x308c02[_0x2bdc('0x30')](db['Campaign'][_0x2bdc('0x14')](queryCampaigns));_0x308c02[_0x2bdc('0x30')](db[_0x2bdc('0x5')][_0x2bdc('0x14')](queryAgents));break;case'user':_0x531623[_0x2efff1](_0x2bdc('0x2c'));_0x531623[_0x2efff1](_0x2bdc('0x2d'));_0x308c02['push'](getAssociatedResources(_0x2bdc('0x37'),_0x560f43[_0x2bdc('0x38')],_0x2bdc('0x31')));_0x308c02[_0x2bdc('0x30')](getAssociatedResources(_0x2bdc('0x10'),_0x560f43['userProfileId'],'ChatQueue'));_0x308c02['push'](getAssociatedResources('FaxQueues',_0x560f43[_0x2bdc('0x38')],_0x2bdc('0x32')));_0x308c02[_0x2bdc('0x30')](getAssociatedResources(_0x2bdc('0x11'),_0x560f43['userProfileId'],_0x2bdc('0x33')));_0x308c02[_0x2bdc('0x30')](getAssociatedResources(_0x2bdc('0x12'),_0x560f43[_0x2bdc('0x38')],'MailQueue'));_0x308c02[_0x2bdc('0x30')](getAssociatedResources(_0x2bdc('0x13'),_0x560f43[_0x2bdc('0x38')],_0x2bdc('0x39')));_0x308c02[_0x2bdc('0x30')](getAssociatedResources('WhatsappQueues',_0x560f43[_0x2bdc('0x38')],_0x2bdc('0x35')));_0x308c02[_0x2bdc('0x30')](getAssociatedResources(_0x2bdc('0x3a'),_0x560f43[_0x2bdc('0x38')],'User'));_0x308c02[_0x2bdc('0x30')](getAssociatedResources(_0x2bdc('0x15'),_0x560f43[_0x2bdc('0x38')],_0x2bdc('0x36')));_0x308c02[_0x2bdc('0x30')](getAssociatedResources('IvrCampaigns',_0x560f43[_0x2bdc('0x38')],'Campaign'));_0x308c02['push'](db['User'][_0x2bdc('0x14')](queryAgents));break;case _0x2bdc('0x7'):_0x531623[_0x2efff1](_0x2bdc('0x2c'));_0x531623[_0x2efff1]('voice:outbound');_0x308c02['push'](_0x560f43[_0x2bdc('0x3b')]({'attributes':['id',_0x2bdc('0x9')]}));_0x308c02[_0x2bdc('0x30')](_0x560f43['getChatQueues']({'attributes':['id',_0x2bdc('0x9')]}));_0x308c02[_0x2bdc('0x30')](_0x560f43[_0x2bdc('0x3c')]({'attributes':['id',_0x2bdc('0x9')]}));_0x308c02[_0x2bdc('0x30')](_0x560f43[_0x2bdc('0x3d')]({'attributes':['id',_0x2bdc('0x9')]}));_0x308c02['push'](_0x560f43[_0x2bdc('0x3e')]({'attributes':['id',_0x2bdc('0x9')]}));_0x308c02['push'](_0x560f43['getOpenchannelQueues']({'attributes':['id',_0x2bdc('0x9')]}));_0x308c02[_0x2bdc('0x30')](_0x560f43[_0x2bdc('0x3f')]({'attributes':['id','name']}));break;}return BPromise[_0x2bdc('0x40')](_0x308c02);}})[_0x2bdc('0xe')](function(_0x459e80){if(_0x459e80&&_0x459e80[_0x2bdc('0x1d')]){for(var _0x2f49b1=0x0;_0x2f49b1<_0x459e80[_0x2bdc('0x1d')];_0x2f49b1+=0x1){for(var _0x1f30eb=0x0;_0x1f30eb<_0x459e80[_0x2f49b1][_0x2bdc('0x1d')];_0x1f30eb+=0x1){switch(_0x2f49b1){case 0x0:joinOrLeaveQueues(_0x531623,_0x2efff1,_0x2bdc('0x41'),_0x459e80[_0x2f49b1][_0x1f30eb]);break;case 0x1:joinOrLeaveQueues(_0x531623,_0x2efff1,_0x2bdc('0x42'),_0x459e80[_0x2f49b1][_0x1f30eb]);break;case 0x2:joinOrLeaveQueues(_0x531623,_0x2efff1,_0x2bdc('0x43'),_0x459e80[_0x2f49b1][_0x1f30eb]);break;case 0x3:joinOrLeaveQueues(_0x531623,_0x2efff1,_0x2bdc('0x44'),_0x459e80[_0x2f49b1][_0x1f30eb]);break;case 0x4:joinOrLeaveQueues(_0x531623,_0x2efff1,_0x2bdc('0x45'),_0x459e80[_0x2f49b1][_0x1f30eb]);break;case 0x5:joinOrLeaveQueues(_0x531623,_0x2efff1,'openchannel',_0x459e80[_0x2f49b1][_0x1f30eb]);break;case 0x6:joinOrLeaveQueues(_0x531623,_0x2efff1,_0x2bdc('0x46'),_0x459e80[_0x2f49b1][_0x1f30eb]);break;case 0x7:if(_0x3af3be[_0x2bdc('0x6')]!==_0x2bdc('0x7'))_0x531623[_0x2efff1](util[_0x2bdc('0x1b')](_0x2bdc('0x47'),_0x459e80[_0x2f49b1][_0x1f30eb][_0x2bdc('0x9')]));break;case 0x8:if(_0x3af3be['role']!==_0x2bdc('0x7'))_0x531623[_0x2efff1](util[_0x2bdc('0x1b')](_0x2bdc('0x48'),_0x459e80[_0x2f49b1][_0x1f30eb][_0x2bdc('0x9')]));break;case 0x9:if(_0x3af3be[_0x2bdc('0x6')]!==_0x2bdc('0x7'))_0x531623[_0x2efff1](util[_0x2bdc('0x1b')](_0x2bdc('0x49'),_0x459e80[_0x2f49b1][_0x1f30eb][_0x2bdc('0xa')],_0x459e80[_0x2f49b1][_0x1f30eb][_0x2bdc('0x9')]));break;case 0xa:_0x531623[_0x2efff1](util[_0x2bdc('0x1b')](_0x2bdc('0x1e'),_0x459e80[_0x2f49b1][_0x1f30eb][_0x2bdc('0x9')]));break;}}}}})[_0x2bdc('0xe')](function(){if(_0x2efff1===_0x2bdc('0x4a')){var _0x59f1c5=_[_0x2bdc('0x4b')](_0x3af3be['ChatInteractions'],'id');return _0x3af3be[_0x2bdc('0x4c')](_0x59f1c5)[_0x2bdc('0xe')](function(){for(var _0x4ee5e3=0x0;_0x4ee5e3<_0x59f1c5[_0x2bdc('0x1d')];_0x4ee5e3+=0x1){_0x3e692f[_0x2bdc('0x4d')](_0x2bdc('0x4e'),{'ChatInteractionId':Number(_0x59f1c5[_0x4ee5e3]),'UserId':Number(_0x3af3be['id'])});}});}})[_0x2bdc('0xe')](function(){if(_0x2efff1==='leave'){var _0x49c009=_['map'](_0x3af3be[_0x2bdc('0x24')],'id');return _0x3af3be['removeMailInteractions'](_0x49c009)['then'](function(){for(var _0x4bf4d2=0x0;_0x4bf4d2<_0x49c009[_0x2bdc('0x1d')];_0x4bf4d2+=0x1){_0x3e692f[_0x2bdc('0x4d')](_0x2bdc('0x4f'),{'MailInteractionId':Number(_0x49c009[_0x4bf4d2]),'UserId':Number(_0x3af3be['id'])});}});}})[_0x2bdc('0xe')](function(){if(_0x2efff1===_0x2bdc('0x4a')){var _0x3360b1=_[_0x2bdc('0x4b')](_0x3af3be['FaxInteractions'],'id');return _0x3af3be['removeFaxInteractions'](_0x3360b1)[_0x2bdc('0xe')](function(){for(var _0x1943fa=0x0;_0x1943fa<_0x3360b1[_0x2bdc('0x1d')];_0x1943fa+=0x1){_0x3e692f[_0x2bdc('0x4d')](_0x2bdc('0x50'),{'FaxInteractionId':Number(_0x3360b1[_0x1943fa]),'UserId':Number(_0x3af3be['id'])});}});}})[_0x2bdc('0xe')](function(){if(_0x2efff1===_0x2bdc('0x4a')){var _0x553ecf=_['map'](_0x3af3be[_0x2bdc('0x27')],'id');return _0x3af3be[_0x2bdc('0x51')](_0x553ecf)['then'](function(){for(var _0xc5aa1d=0x0;_0xc5aa1d<_0x553ecf[_0x2bdc('0x1d')];_0xc5aa1d+=0x1){_0x3e692f[_0x2bdc('0x4d')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x553ecf[_0xc5aa1d]),'UserId':Number(_0x3af3be['id'])});}});}})[_0x2bdc('0xe')](function(){if(_0x2efff1==='leave'){var _0x22c4ad=_[_0x2bdc('0x4b')](_0x3af3be[_0x2bdc('0x28')],'id');return _0x3af3be[_0x2bdc('0x52')](_0x22c4ad)['then'](function(){for(var _0x125d0a=0x0;_0x125d0a<_0x22c4ad[_0x2bdc('0x1d')];_0x125d0a+=0x1){_0x3e692f['emit'](_0x2bdc('0x53'),{'OpenchannelInteractionId':Number(_0x22c4ad[_0x125d0a]),'UserId':Number(_0x3af3be['id'])});}});}})[_0x2bdc('0xe')](function(){if(_0x2efff1===_0x2bdc('0x4a')){var _0x1bb615=_['map'](_0x3af3be[_0x2bdc('0x2a')],'id');return _0x3af3be[_0x2bdc('0x54')](_0x1bb615)['then'](function(){for(var _0x30cd0f=0x0;_0x30cd0f<_0x1bb615[_0x2bdc('0x1d')];_0x30cd0f+=0x1){_0x3e692f['emit'](_0x2bdc('0x55'),{'WhatsappInteractionId':Number(_0x1bb615[_0x30cd0f]),'UserId':Number(_0x3af3be['id'])});}});}})[_0x2bdc('0x56')](function(_0x3a9c97){_0x531623[_0x2bdc('0x57')](_0x3a9c97);});}}function onDisconnect(_0x10cd2b,_0x2ed6af){joinOrLeave(_0x10cd2b,_0x2bdc('0x4a'),_0x2ed6af);}function onConnect(_0x3dc8cc){joinOrLeave(_0x3dc8cc,'join');}exports['default']=function(_0xe86fbc){_0xe86fbc['on'](_0x2bdc('0x58'),function(_0x3e7742){_0x3e7742[_0x2bdc('0x59')](0x0);_0x3e7742[_0x2bdc('0x5a')]=_0x3e7742[_0x2bdc('0x5b')][_0x2bdc('0x58')][_0x2bdc('0x5c')]+':'+_0x3e7742['request']['connection']['remotePort'];_0x3e7742['connectedAt']=new Date();_0x3e7742[_0x2bdc('0x57')]=function(_0x155720){console[_0x2bdc('0x57')](_0x2bdc('0x5d')+_0x3e7742[_0x2bdc('0x5e')][_0x2bdc('0x9')]+'['+_0x3e7742[_0x2bdc('0x5a')]+']',_0x155720);};_0x3e7742['on'](_0x2bdc('0x5f'),function(){onDisconnect(_0x3e7742,_0xe86fbc);_0x3e7742[_0x2bdc('0x57')](_0x2bdc('0x60'));});onConnect(_0x3e7742);_0x3e7742[_0x2bdc('0x57')](_0x2bdc('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index b037871..c218939 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 _0xd58c=['http','Chat','ChatInteraction','newinteraction','afterUpdate','ChatMessage','newmessage','ChatOfflineMessage','afterCreate','Sms','SmsInteraction','closedinteraction','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','get','channel','motionChannel','event','direction','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','contact','format','SIP/%s','name','agent','outgoingmessage','catch','offlineMessage','opened','resolve','UserId','interface','AfterCreate','changed','closed','substatus','AfterUpdate','User','find','fullname','internal','default','length','hasOwnProperty','model','condition','util','jayson/promise','../logger','triggers','client'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0xd58c,0xd3));var _0xcd58=function(_0x42f1c1,_0x299003){_0x42f1c1=_0x42f1c1-0x0;var _0x12433e=_0xd58c[_0x42f1c1];return _0x12433e;};'use strict';var util=require(_0xcd58('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0xcd58('0x1'));var logger=require(_0xcd58('0x2'))(_0xcd58('0x3'));var client=jayson[_0xcd58('0x4')][_0xcd58('0x5')]({'port':0x232a});var triggers=[{'channel':_0xcd58('0x6'),'model':_0xcd58('0x7'),'event':'afterCreate','condition':_0xcd58('0x8'),'callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':_0xcd58('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xcd58('0x6'),'model':_0xcd58('0xa'),'event':'afterCreate','condition':_0xcd58('0xb'),'callback':afterCreateMessage},{'channel':_0xcd58('0x6'),'model':_0xcd58('0xc'),'event':_0xcd58('0xd'),'condition':_0xcd58('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0xcd58('0xe'),'model':'SmsInteraction','event':_0xcd58('0xd'),'condition':_0xcd58('0x8'),'callback':afterCreate},{'channel':_0xcd58('0xe'),'model':_0xcd58('0xf'),'event':_0xcd58('0x9'),'condition':_0xcd58('0x10'),'callback':afterUpdate},{'channel':_0xcd58('0xe'),'model':'SmsMessage','event':_0xcd58('0xd'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xcd58('0x11'),'model':'WhatsappInteraction','event':'afterCreate','condition':_0xcd58('0x8'),'callback':afterCreate},{'channel':'Whatsapp','model':_0xcd58('0x12'),'event':_0xcd58('0x9'),'condition':_0xcd58('0x10'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':_0xcd58('0xd'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xcd58('0x13'),'model':'FaxInteraction','event':'afterCreate','condition':_0xcd58('0x8'),'callback':afterCreate},{'channel':_0xcd58('0x13'),'model':_0xcd58('0x14'),'event':_0xcd58('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xcd58('0x13'),'model':'FaxMessage','event':_0xcd58('0xd'),'condition':_0xcd58('0xb'),'callback':afterCreateMessage},{'channel':_0xcd58('0x15'),'model':_0xcd58('0x16'),'event':_0xcd58('0xd'),'condition':_0xcd58('0x8'),'callback':afterCreate},{'channel':_0xcd58('0x15'),'model':'MailInteraction','event':_0xcd58('0x9'),'condition':_0xcd58('0x10'),'callback':afterUpdate},{'channel':_0xcd58('0x15'),'model':'MailMessage','event':_0xcd58('0xd'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xcd58('0x17'),'model':_0xcd58('0x18'),'event':_0xcd58('0xd'),'condition':_0xcd58('0x8'),'callback':afterCreate},{'channel':'Openchannel','model':_0xcd58('0x18'),'event':'afterUpdate','condition':_0xcd58('0x10'),'callback':afterUpdate},{'channel':_0xcd58('0x17'),'model':_0xcd58('0x19'),'event':_0xcd58('0xd'),'condition':_0xcd58('0xb'),'callback':afterCreateMessage}];function request(_0x529833){return client[_0xcd58('0x1a')](_0xcd58('0x1b'),_0x529833)[_0xcd58('0x1c')](function(_0x1b014c){logger[_0xcd58('0x1d')](_0xcd58('0x1e'),_0xcd58('0x1b'),_0x1b014c);if(_0x1b014c[_0xcd58('0x1f')]){if(_0x1b014c['error'][_0xcd58('0x20')]===0x1f4){logger['error']('Trigger,\x20%s',_0xcd58('0x1b'),_0x1b014c[_0xcd58('0x1f')]);}}})['catch'](function(_0xd6434c){logger[_0xcd58('0x1f')]('Trigger,\x20%s',_0xcd58('0x1b'),_0xd6434c);});}function afterCreateMessage(_0x300e10){return function(_0x35f1c9){_0x35f1c9=_0x35f1c9[_0xcd58('0x21')]({'plain':!![]});_0x35f1c9[_0xcd58('0x22')]=_0x300e10;_0x35f1c9[_0xcd58('0x23')]=_0x300e10;_0x35f1c9[_0xcd58('0x24')]=_0x35f1c9[_0xcd58('0x25')];Promise['resolve']()[_0xcd58('0x1c')](function(){if(typeof _0x35f1c9['ContactId']===_0xcd58('0x26'))return null;var _0x1a0843=_0xcd58('0x27')+_0x35f1c9[_0xcd58('0x28')];return db[_0xcd58('0x29')][_0xcd58('0x2a')](_0x1a0843,{'type':db[_0xcd58('0x2b')][_0xcd58('0x2c')][_0xcd58('0x2d')],'raw':!![]});})[_0xcd58('0x1c')](function(_0x12a459){if(_0x12a459){_0x35f1c9[_0xcd58('0x2e')]=_0x12a459[0x0];}if(typeof _0x35f1c9['UserId']===_0xcd58('0x26'))return;return getAgent(_0x35f1c9['UserId']);})[_0xcd58('0x1c')](function(_0x1e63a9){if(_0x1e63a9){_0x35f1c9['interface']=util[_0xcd58('0x2f')](_0xcd58('0x30'),_0x1e63a9[_0xcd58('0x31')]);_0x35f1c9[_0xcd58('0x32')]=_0x1e63a9;_0x35f1c9[_0xcd58('0x22')]=_0x300e10;return request({'event':'incomingmessage','message':_0x35f1c9});}else{return request({'event':_0xcd58('0x33'),'message':_0x35f1c9});}})[_0xcd58('0x34')](function(_0x4cb7b5){logger['error'](_0xcd58('0x1e'),'AfterCreateMessage',_0x4cb7b5);});};}function afterCreateOfflineMessage(_0x180379){return function(_0x344bed){_0x344bed=_0x344bed['get']({'plain':!![]});_0x344bed['channel']=_0x180379;_0x344bed[_0xcd58('0x23')]=_0x180379;_0x344bed[_0xcd58('0x24')]=_0xcd58('0x35');return request({'event':_0x344bed[_0xcd58('0x24')],'message':_0x344bed});};}function afterCreate(_0x536fa6,_0x40c8f7){return function(_0x4c3487){_0x4c3487=_0x4c3487['get']({'plain':!![]});_0x4c3487['channel']=_0x536fa6;_0x4c3487['motionChannel']=_0x536fa6;_0x4c3487[_0xcd58('0x24')]=_0xcd58('0x36');Promise[_0xcd58('0x37')]()[_0xcd58('0x1c')](function(){var _0x4f513d=_0xcd58('0x27')+_0x4c3487[_0xcd58('0x28')];return db[_0xcd58('0x29')]['query'](_0x4f513d,{'type':db[_0xcd58('0x2b')][_0xcd58('0x2c')][_0xcd58('0x2d')],'raw':!![]});})[_0xcd58('0x1c')](function(_0x40adc6){if(_0x40adc6){_0x4c3487[_0xcd58('0x2e')]=_0x40adc6[0x0];}if(typeof _0x4c3487[_0xcd58('0x38')]===_0xcd58('0x26'))return;return getAgent(_0x4c3487[_0xcd58('0x38')]);})[_0xcd58('0x1c')](function(_0x4866c2){if(_0x4866c2){_0x4c3487[_0xcd58('0x39')]=util[_0xcd58('0x2f')]('SIP/%s',_0x4866c2[_0xcd58('0x31')]);_0x4c3487[_0xcd58('0x32')]=_0x4866c2;}return request({'event':_0x40c8f7,'message':_0x4c3487});})[_0xcd58('0x34')](function(_0x4124fd){logger[_0xcd58('0x1f')](_0xcd58('0x1e'),_0xcd58('0x3a'),_0x4124fd);});};}function afterUpdate(_0x5a0517){return function(_0x2a71e5){var _0x57f857=_0x2a71e5[_0xcd58('0x3b')](_0xcd58('0x3c'))&&_0x2a71e5[_0xcd58('0x3c')];var _0x4d3582=_0x2a71e5[_0xcd58('0x3b')](_0xcd58('0x3d'));if(_0x57f857||_0x4d3582){var _0x350410=_0x57f857?'closedinteraction':_0xcd58('0x3d');var _0x57d509=_0x2a71e5[_0xcd58('0x21')]({'plain':!![]});_0x57d509['channel']=_0x5a0517;_0x57d509[_0xcd58('0x23')]=_0x5a0517;_0x57d509[_0xcd58('0x24')]=_0x57f857?'closed':_0xcd58('0x3d');var _0x549c2d=_0xcd58('0x27')+_0x57d509[_0xcd58('0x28')];return db[_0xcd58('0x29')]['query'](_0x549c2d,{'type':db[_0xcd58('0x2b')][_0xcd58('0x2c')][_0xcd58('0x2d')],'raw':!![]})[_0xcd58('0x1c')](function(_0x3a4945){if(_0x3a4945){_0x57d509[_0xcd58('0x2e')]=_0x3a4945[0x0];}if(typeof _0x57d509[_0xcd58('0x38')]===_0xcd58('0x26'))return;return getAgent(_0x57d509['UserId']);})[_0xcd58('0x1c')](function(_0x410772){if(_0x410772){_0x57d509[_0xcd58('0x39')]=util[_0xcd58('0x2f')](_0xcd58('0x30'),_0x410772['name']);_0x57d509[_0xcd58('0x32')]=_0x410772;}return request({'event':_0x350410,'message':_0x57d509});})[_0xcd58('0x34')](function(_0x90d945){logger[_0xcd58('0x1f')](_0xcd58('0x1e'),_0xcd58('0x3e'),_0x90d945);});}};}function getAgent(_0x267326){return db[_0xcd58('0x3f')][_0xcd58('0x40')]({'where':{'id':_0x267326},'attributes':['id','name',_0xcd58('0x41'),'email',_0xcd58('0x42')],'raw':!![]})['then'](function(_0x335a94){return _0x335a94;});}exports[_0xcd58('0x43')]=function(){for(var _0x320ae3=0x0;_0x320ae3=_0x1bd1e7[_0xb29a('0x11')]){throw Error(_0xb29a('0x12'));}_0x44e57c(_0x384040);})[_0xb29a('0x13')](function(_0x23e61c){_0xe93d54(_0x23e61c);});});}; \ No newline at end of file +var _0xc49a=['openchannel','getChannels','isValidChannel','toLowerCase','includes','blockedAt','getLicense','role','agent','then','agents','catch','../mysqldb','./license/util','voice','chat','fax','sms','whatsapp'];(function(_0x294a77,_0x8a359d){var _0x17db6d=function(_0x4e121d){while(--_0x4e121d){_0x294a77['push'](_0x294a77['shift']());}};_0x17db6d(++_0x8a359d);}(_0xc49a,0xdd));var _0xac49=function(_0x3ce473,_0x4487b0){_0x3ce473=_0x3ce473-0x0;var _0x486743=_0xc49a[_0x3ce473];return _0x486743;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require(_0xac49('0x0'))['db'];var util=require(_0xac49('0x1'));var channels=[_0xac49('0x2'),'mail',_0xac49('0x3'),_0xac49('0x4'),_0xac49('0x5'),_0xac49('0x6'),_0xac49('0x7')];exports[_0xac49('0x8')]=function(){return channels;};exports[_0xac49('0x9')]=function(_0x459f6a){_0x459f6a=_0x459f6a[_0xac49('0xa')]();return _[_0xac49('0xb')](channels,_0x459f6a);};exports['clearBlockUser']=function(_0x50994b,_0x574763,_0x42faec,_0x10e0df){var _0x5c777e={'loginAttempts':_0x574763,'blocked':_0x42faec};if(!_['isUndefined'](_0x10e0df)){_0x5c777e[_0xac49('0xc')]=_0x10e0df;}return _0x50994b['updateAttributes'](_0x5c777e);};exports[_0xac49('0xd')]=function(_0x4fcfaa){return new BPromise(function(_0x37363e,_0x2153bc){var _0xb90acb=0x0;if(_0x4fcfaa[_0xac49('0xe')]!=='agent'){_0x37363e(_0x4fcfaa);}db['User']['count']({'where':{'role':_0xac49('0xf'),'online':!![],'id':{'$ne':_0x4fcfaa['id']}}})['then'](function(_0x3d6f43){_0xb90acb=_0x3d6f43;return util['getLicense']();})[_0xac49('0x10')](function(_0x32d29e){if(_0x32d29e&&_0x32d29e['agents']&&_0xb90acb>=_0x32d29e[_0xac49('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x37363e(_0x4fcfaa);})[_0xac49('0x12')](function(_0x3afcf0){_0x2153bc(_0x3afcf0);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index f7d4f78..f7aae2e 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa0c=['exports','404','status','json','send'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xaa0c,0xfa));var _0xcaa0=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xaa0c[_0x4b055c];return _0x4b62bb;};'use strict';module[_0xcaa0('0x0')][0x194]=function pageNotFound(_0x5ec45a,_0x2c66f2){var _0x1d1436=_0xcaa0('0x1');var _0x4ad7b2=0x194;var _0x3ca061={'status':_0x4ad7b2};_0x2c66f2[_0xcaa0('0x2')](_0x3ca061[_0xcaa0('0x2')]);_0x2c66f2['render'](_0x1d1436,{},function(_0x58b58b,_0x22de82){if(_0x58b58b){return _0x2c66f2[_0xcaa0('0x2')](_0x3ca061[_0xcaa0('0x2')])[_0xcaa0('0x3')](_0x3ca061);}_0x2c66f2[_0xcaa0('0x4')](_0x22de82);});}; \ No newline at end of file +var _0xdace=['404','status','render','json','send','exports'];(function(_0x52fa54,_0x19eb2d){var _0x28fdbc=function(_0x3eace8){while(--_0x3eace8){_0x52fa54['push'](_0x52fa54['shift']());}};_0x28fdbc(++_0x19eb2d);}(_0xdace,0xad));var _0xedac=function(_0x1dfa63,_0x362bd4){_0x1dfa63=_0x1dfa63-0x0;var _0x26f2a9=_0xdace[_0x1dfa63];return _0x26f2a9;};'use strict';module[_0xedac('0x0')][0x194]=function pageNotFound(_0x1dd144,_0x422a31){var _0x4596ce=_0xedac('0x1');var _0x3980f3=0x194;var _0x133dca={'status':_0x3980f3};_0x422a31[_0xedac('0x2')](_0x133dca[_0xedac('0x2')]);_0x422a31[_0xedac('0x3')](_0x4596ce,{},function(_0x3f7a05,_0x1955ea){if(_0x3f7a05){return _0x422a31['status'](_0x133dca[_0xedac('0x2')])[_0xedac('0x4')](_0x133dca);}_0x422a31[_0xedac('0x5')](_0x1955ea);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 5b3c163..3d2dd07 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b9e=['OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatMessage','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CmCompany','Company','CompanyId','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','ParentId','Intervals','MailApplications','ChatApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Condition','AllConditions','AllCondition','AnyCondition','Action','Actions','TriggerId','Fields','MetricId','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Field','SugarcrmConfiguration','Description','VariableId','DeskConfiguration','int_desk_configuration_has_tags','ZohoField','ZohoConfiguration','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowConfiguration','Dynamics365Account','FromId','ToId','SessionId','ProjectId','MailQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAgent','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','ToQueue','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','FromAccount','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','Extensions','UserProfileSection','UserProfileSections','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','sequelize','lodash','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','defaultsDeep','motion2','xcall','utf8','password','options','database','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','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','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Automation','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','FaxTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','UserProfile','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoicePrefix','../api/user-setting/user-setting.model','hasOne','cascade','UserId','UserSetting','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteraction','SenderId','belongsTo','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','SmsInteraction','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','VoicePrefix','VoicePrefixes','MailQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','Applications','VoiceMusicOnHold','moh_has_sounds','Members','CmHopper','Hoppers','VoiceQueueId','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkBackup','TrunkBackupId','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','voice_queues_has_cm_blacklists','mailbox','mailboxuser','VoiceCallReport','VoiceQueueReport','QueueCalls','AgentReports','uniqueid','Contact','MailAccountId','CloudProviderId','restrict','Imap','MailServerOut','Smtp','Dispositions','CannedAnswer','Messages','MailApplication','List','ListId','TemplateId','Agents','team_has_mail_queues','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachment','Attachments','Interaction','ChatWebsiteId','IntervalId','TagId','FaxAccountId','Answers','Interactions','Exntensions','mandatoryDispositionPause','FaxQueue','FaxInteractionId','fax_interaction_has_tags','Tags','user_has_fax_interactions','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsMessage','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','Teams','OpenchannelAccountId'];(function(_0x239a99,_0x2eea66){var _0x5e65dc=function(_0x2f16ff){while(--_0x2f16ff){_0x239a99['push'](_0x239a99['shift']());}};_0x5e65dc(++_0x2eea66);}(_0x9b9e,0x6f));var _0xe9b9=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x9b9e[_0x5d6456];return _0x4d66c1;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xe9b9('0x0'));var _=require(_0xe9b9('0x1'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0xe9b9('0x0')]=_['defaultsDeep'](config['sequelize'],{'database':'motion2','username':'xcall','password':_0xe9b9('0x2'),'options':{'host':_0xe9b9('0x3'),'port':0xcea,'dialect':_0xe9b9('0x4'),'dialectOptions':{'charset':_0xe9b9('0x5')},'logging':![],'timezone':timezone[_0xe9b9('0x6')](),'define':{'charset':'utf8','collate':_0xe9b9('0x7')}}});config[_0xe9b9('0x8')]=_[_0xe9b9('0x9')](config[_0xe9b9('0x8')],{'database':_0xe9b9('0xa'),'username':_0xe9b9('0xb'),'password':_0xe9b9('0x2'),'options':{'host':_0xe9b9('0x3'),'port':0xcea,'dialect':_0xe9b9('0x4'),'dialectOptions':{'charset':_0xe9b9('0x5')},'logging':![],'timezone':timezone[_0xe9b9('0x6')](),'define':{'charset':_0xe9b9('0xc'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe9b9('0x0')]['database'],config['sequelize']['username'],config[_0xe9b9('0x0')][_0xe9b9('0xd')],config['sequelize'][_0xe9b9('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe9b9('0x8')][_0xe9b9('0xf')],config[_0xe9b9('0x8')]['username'],config[_0xe9b9('0x8')][_0xe9b9('0xd')],config[_0xe9b9('0x8')][_0xe9b9('0xe')])};db[_0xe9b9('0x10')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x12'));db[_0xe9b9('0x13')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x14'));db[_0xe9b9('0x15')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x16'));db['VoiceExtension']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x17'));db['VoiceMusicOnHold']=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0x18'));db[_0xe9b9('0x19')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0x1a'));db[_0xe9b9('0x1b')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x1c'));db[_0xe9b9('0x1d')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/screenRecording/screenRecording.model');db[_0xe9b9('0x1e')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x1f'));db[_0xe9b9('0x20')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0x21'));db['VoiceCallReport']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x22'));db['VoiceDialReport']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x23'));db[_0xe9b9('0x24')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0x25'));db['VoiceQueueReport']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x26'));db['MemberReport']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x27'));db[_0xe9b9('0x28')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0x29'));db[_0xe9b9('0x2a')]=db['sequelize'][_0xe9b9('0x11')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xe9b9('0x2b')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x2c'));db[_0xe9b9('0x2d')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x2e'));db[_0xe9b9('0x2f')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0x30'));db[_0xe9b9('0x31')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0x32'));db[_0xe9b9('0x33')]=db['sequelize']['import'](_0xe9b9('0x34'));db[_0xe9b9('0x35')]=db['sequelize'][_0xe9b9('0x11')]('../api/userSmsQueue/userSmsQueue.model');db[_0xe9b9('0x36')]=db['sequelize']['import'](_0xe9b9('0x37'));db[_0xe9b9('0x38')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0x39'));db[_0xe9b9('0x3a')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0x3b'));db['MailServerOut']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x3c'));db[_0xe9b9('0x3d')]=db['sequelize']['import'](_0xe9b9('0x3e'));db['MailQueue']=db['sequelize']['import'](_0xe9b9('0x3f'));db['MailSubstatus']=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/mailSubstatus/mailSubstatus.model');db[_0xe9b9('0x40')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/mailInteraction/mailInteraction.model');db[_0xe9b9('0x41')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0x42'));db['MailApplication']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x43'));db[_0xe9b9('0x44')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0x45'));db[_0xe9b9('0x46')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x47'));db[_0xe9b9('0x48')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/dashboardItem/dashboardItem.model');db[_0xe9b9('0x49')]=db[_0xe9b9('0x0')]['import']('../api/faxAccount/faxAccount.model');db[_0xe9b9('0x4a')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x4b'));db[_0xe9b9('0x4c')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x4d'));db[_0xe9b9('0x4e')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x4f'));db['FaxQueue']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x50'));db[_0xe9b9('0x51')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0x52'));db[_0xe9b9('0x53')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x54'));db[_0xe9b9('0x55')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x56'));db['SmsInteraction']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x57'));db['SmsMessage']=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0x58'));db[_0xe9b9('0x59')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x5a'));db[_0xe9b9('0x5b')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x5c'));db[_0xe9b9('0x5d')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x5e'));db[_0xe9b9('0x5f')]=db['sequelize'][_0xe9b9('0x11')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xe9b9('0x60')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x61'));db[_0xe9b9('0x62')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0x63'));db['ChatWebsite']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x64'));db[_0xe9b9('0x65')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x66'));db[_0xe9b9('0x67')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0x68'));db['ChatInteraction']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x69'));db['ChatMessage']=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0x6a'));db[_0xe9b9('0x6b')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0x6c'));db[_0xe9b9('0x6d')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x6e'));db[_0xe9b9('0x6f')]=db['sequelize']['import'](_0xe9b9('0x70'));db[_0xe9b9('0x71')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0x72'));db['CmCompany']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x73'));db[_0xe9b9('0x74')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x75'));db['CmHopper']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x76'));db[_0xe9b9('0x77')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x78'));db[_0xe9b9('0x79')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x7a'));db[_0xe9b9('0x7b')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x7c'));db[_0xe9b9('0x7d')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x7e'));db[_0xe9b9('0x7f')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0x80'));db['Action']=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/action/action.model');db[_0xe9b9('0x81')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/automation/automation.model');db['CannedAnswer']=db[_0xe9b9('0x0')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0xe9b9('0x82')]=db['sequelize']['import'](_0xe9b9('0x83'));db['Condition']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x84'));db[_0xe9b9('0x85')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0x86'));db[_0xe9b9('0x87')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x88'));db[_0xe9b9('0x89')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/cdr/cdr.model');db[_0xe9b9('0x8a')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x8b'));db[_0xe9b9('0x8c')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0x8d'));db[_0xe9b9('0x8e')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x8f'));db[_0xe9b9('0x90')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x91'));db[_0xe9b9('0x92')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x93'));db[_0xe9b9('0x94')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x95'));db[_0xe9b9('0x96')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0x97'));db[_0xe9b9('0x98')]=db['sequelize'][_0xe9b9('0x11')]('../api/integration/integration.model');db[_0xe9b9('0x99')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x9a'));db[_0xe9b9('0x9b')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x9c'));db['AnalyticDefaultReport']=db['sequelize']['import'](_0xe9b9('0x9d'));db[_0xe9b9('0x9e')]=db['sequelize'][_0xe9b9('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xe9b9('0x9f')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0xa0'));db[_0xe9b9('0xa1')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xe9b9('0xa2')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0xa3'));db[_0xe9b9('0xa4')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xa5'));db[_0xe9b9('0xa6')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0xa7'));db[_0xe9b9('0xa8')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xa9'));db['SugarcrmAccount']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xaa'));db['SugarcrmConfiguration']=db['sequelize'][_0xe9b9('0x11')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0xe9b9('0xab')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0xac'));db[_0xe9b9('0xad')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0xae'));db[_0xe9b9('0xaf')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0xb0'));db[_0xe9b9('0xb1')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xb2'));db['ZohoConfiguration']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xb3'));db['ZohoField']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xb4'));db['ZendeskAccount']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xb5'));db[_0xe9b9('0xb6')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xb7'));db[_0xe9b9('0xb8')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0xb9'));db[_0xe9b9('0xba')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0xbb'));db['FreshdeskConfiguration']=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xe9b9('0xbc')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xe9b9('0xbd')]=db['sequelize']['import'](_0xe9b9('0xbe'));db[_0xe9b9('0xbf')]=db['sequelize'][_0xe9b9('0x11')]('../api/intVtigerField/intVtigerField.model');db[_0xe9b9('0xc0')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0xe9b9('0x0')]['import'](_0xe9b9('0xc1'));db[_0xe9b9('0xc2')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xc3'));db['Dynamics365Account']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xc4'));db[_0xe9b9('0xc5')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0xc6'));db[_0xe9b9('0xc7')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xc8'));db[_0xe9b9('0xc9')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xca'));db[_0xe9b9('0xcb')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xcc'));db[_0xe9b9('0xcd')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xce'));db[_0xe9b9('0x98')]=db['sequelize']['import'](_0xe9b9('0xcf'));db[_0xe9b9('0xd0')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0xd1'));db[_0xe9b9('0xd2')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0xd3'));db[_0xe9b9('0xd4')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0xd5'));db[_0xe9b9('0xd6')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0xd7'));db[_0xe9b9('0xd8')]=db['sequelize'][_0xe9b9('0x11')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xe9b9('0xd9')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0xda'));db[_0xe9b9('0xdb')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xdc'));db[_0xe9b9('0xdd')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0xde'));db[_0xe9b9('0xdf')]=db['sequelize']['import'](_0xe9b9('0xe0'));db[_0xe9b9('0xe1')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xe2'));db['SquareOdbc']=db[_0xe9b9('0x0')]['import'](_0xe9b9('0xe3'));db[_0xe9b9('0xe4')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xe5'));db['SquareRecording']=db[_0xe9b9('0x0')]['import'](_0xe9b9('0xe6'));db[_0xe9b9('0xe7')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xe8'));db[_0xe9b9('0xe9')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/team/team.model');db[_0xe9b9('0xea')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xeb'));db[_0xe9b9('0xec')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xed'));db[_0xe9b9('0xee')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0xef'));db['Attachment']=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0xf0'));db[_0xe9b9('0xf1')]=db[_0xe9b9('0x0')]['import']('../api/plugin/plugin.model');db[_0xe9b9('0xf2')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xf3'));db['ChatTransferReport']=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/chatTransferReport/chatTransferReport.model');db[_0xe9b9('0xf4')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0xf5'));db[_0xe9b9('0xf6')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xf7'));db[_0xe9b9('0xf8')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0xf9'));db['VoicePrefix']=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/voicePrefix/voicePrefix.model');db[_0xe9b9('0xfa')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xfb'));db[_0xe9b9('0xfc')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0xfd'));db[_0xe9b9('0xfe')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0xff'));db[_0xe9b9('0x100')]=db[_0xe9b9('0x0')]['import'](_0xe9b9('0x101'));db[_0xe9b9('0x102')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x103'));db['WhatsappInteraction']=db['sequelize']['import'](_0xe9b9('0x104'));db[_0xe9b9('0x105')]=db['sequelize'][_0xe9b9('0x11')](_0xe9b9('0x106'));db[_0xe9b9('0x107')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x108'));db[_0xe9b9('0x109')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x10a'));db[_0xe9b9('0x10b')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x10c'));db[_0xe9b9('0x10d')]=db[_0xe9b9('0x0')][_0xe9b9('0x11')](_0xe9b9('0x10e'));db['TeamVoiceQueue']=db[_0xe9b9('0x0')][_0xe9b9('0x11')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xe9b9('0x10f')]=db[_0xe9b9('0x0')]['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db['UserVoicePrefix']=db[_0xe9b9('0x0')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db['UserSetting']=db['sequelize']['import'](_0xe9b9('0x110'));db['User'][_0xe9b9('0x111')](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x113')});db[_0xe9b9('0x10')]['hasOne'](db[_0xe9b9('0x114')],{'as':'userSetting','onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x113')});db[_0xe9b9('0x10')][_0xe9b9('0x115')](db['VoiceRecording'],{'as':_0xe9b9('0x116'),'foreignKey':_0xe9b9('0x113')});db['User']['hasMany'](db[_0xe9b9('0x2b')],{'as':_0xe9b9('0x117'),'foreignKey':_0xe9b9('0x113')});db['User']['hasMany'](db[_0xe9b9('0x118')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0xe9b9('0x10')]['hasMany'](db[_0xe9b9('0x79')],{'as':'HopperFinals','foreignKey':_0xe9b9('0x113')});db[_0xe9b9('0x10')]['hasMany'](db['CmHopperHistory'],{'as':_0xe9b9('0x119'),'foreignKey':_0xe9b9('0x113')});db[_0xe9b9('0x10')][_0xe9b9('0x115')](db[_0xe9b9('0x7d')],{'as':_0xe9b9('0x7d'),'foreignKey':_0xe9b9('0x113')});db[_0xe9b9('0x10')]['hasMany'](db[_0xe9b9('0x5f')],{'as':_0xe9b9('0x11a'),'foreignKey':_0xe9b9('0x113')});db[_0xe9b9('0x10')][_0xe9b9('0x115')](db[_0xe9b9('0x11b')],{'as':_0xe9b9('0x11c'),'foreignKey':_0xe9b9('0x113')});db['User']['hasMany'](db['SmsInteraction'],{'as':_0xe9b9('0x11d'),'foreignKey':_0xe9b9('0x113')});db[_0xe9b9('0x10')][_0xe9b9('0x115')](db[_0xe9b9('0x4c')],{'as':_0xe9b9('0x11e'),'foreignKey':_0xe9b9('0x113')});db[_0xe9b9('0x10')][_0xe9b9('0x115')](db[_0xe9b9('0x40')],{'as':'MailInteractions','foreignKey':_0xe9b9('0x113')});db[_0xe9b9('0x10')][_0xe9b9('0x115')](db[_0xe9b9('0x11f')],{'as':'WhatsappInteractions','foreignKey':_0xe9b9('0x113')});db['User'][_0xe9b9('0x115')](db['UserNotification'],{'as':'UserNotifications','foreignKey':_0xe9b9('0x120')});db[_0xe9b9('0x10')][_0xe9b9('0x121')](db[_0xe9b9('0xfa')],{'as':_0xe9b9('0xfa'),'foreignKey':_0xe9b9('0x122')});db[_0xe9b9('0x10')][_0xe9b9('0x123')](db[_0xe9b9('0x6f')],{'as':_0xe9b9('0x124'),'through':'chat_group_has_users'});db[_0xe9b9('0x10')][_0xe9b9('0x123')](db[_0xe9b9('0x74')],{'as':_0xe9b9('0x125'),'through':_0xe9b9('0x126')});db[_0xe9b9('0x10')][_0xe9b9('0x123')](db[_0xe9b9('0xf8')],{'as':'Lists','through':_0xe9b9('0x127')});db[_0xe9b9('0x10')][_0xe9b9('0x123')](db[_0xe9b9('0xe9')],{'through':_0xe9b9('0x128')});db[_0xe9b9('0x10')]['belongsToMany'](db[_0xe9b9('0x40')],{'as':_0xe9b9('0x129'),'through':_0xe9b9('0x12a')});db[_0xe9b9('0x10')][_0xe9b9('0x123')](db[_0xe9b9('0x11b')],{'as':_0xe9b9('0x11c'),'through':_0xe9b9('0x12b')});db[_0xe9b9('0x10')][_0xe9b9('0x123')](db['FaxInteraction'],{'as':_0xe9b9('0x11e'),'through':'user_has_fax_interactions'});db[_0xe9b9('0x10')][_0xe9b9('0x123')](db[_0xe9b9('0x12c')],{'as':_0xe9b9('0x11d'),'through':_0xe9b9('0x12d')});db['User'][_0xe9b9('0x123')](db['OpenchannelInteraction'],{'as':_0xe9b9('0x11a'),'through':_0xe9b9('0x12e')});db[_0xe9b9('0x10')][_0xe9b9('0x123')](db[_0xe9b9('0x11f')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0xe9b9('0x10')][_0xe9b9('0x123')](db[_0xe9b9('0x19')],{'as':_0xe9b9('0x12f'),'through':_0xe9b9('0x2d'),'required':![]});db[_0xe9b9('0x10')][_0xe9b9('0x123')](db[_0xe9b9('0x130')],{'as':_0xe9b9('0x131'),'through':'UserVoicePrefix','required':![]});db[_0xe9b9('0x10')][_0xe9b9('0x123')](db[_0xe9b9('0x132')],{'as':'MailQueues','through':_0xe9b9('0x31'),'required':![]});db['User'][_0xe9b9('0x123')](db[_0xe9b9('0x6d')],{'as':_0xe9b9('0x133'),'through':_0xe9b9('0x2f'),'required':![],'hooks':!![]});db[_0xe9b9('0x10')]['belongsToMany'](db['FaxQueue'],{'as':_0xe9b9('0x134'),'through':_0xe9b9('0x33'),'required':![]});db[_0xe9b9('0x10')][_0xe9b9('0x123')](db[_0xe9b9('0x59')],{'as':_0xe9b9('0x135'),'through':_0xe9b9('0x35'),'required':![]});db['User'][_0xe9b9('0x123')](db[_0xe9b9('0x62')],{'as':_0xe9b9('0x136'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0xe9b9('0x123')](db['WhatsappQueue'],{'as':_0xe9b9('0x137'),'through':_0xe9b9('0x38'),'required':![]});db['User'][_0xe9b9('0x123')](db[_0xe9b9('0xf8')],{'through':_0xe9b9('0x127')});db[_0xe9b9('0x10')][_0xe9b9('0x123')](db[_0xe9b9('0x138')],{'as':_0xe9b9('0x139'),'through':_0xe9b9('0x13a')});db['User'][_0xe9b9('0x123')](db[_0xe9b9('0x49')],{'as':_0xe9b9('0x13b'),'through':_0xe9b9('0x13c')});db[_0xe9b9('0x10')][_0xe9b9('0x123')](db[_0xe9b9('0x3d')],{'as':_0xe9b9('0x13d'),'through':_0xe9b9('0x13e')});db[_0xe9b9('0x10')][_0xe9b9('0x123')](db['OpenchannelAccount'],{'as':_0xe9b9('0x13f'),'through':_0xe9b9('0x140')});db[_0xe9b9('0x10')][_0xe9b9('0x123')](db[_0xe9b9('0x53')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0xe9b9('0x10')]['belongsToMany'](db[_0xe9b9('0x100')],{'as':_0xe9b9('0x141'),'through':_0xe9b9('0x142')});db[_0xe9b9('0x10')]['belongsToMany'](db['SquareProject'],{'as':_0xe9b9('0x143'),'through':_0xe9b9('0x144')});db[_0xe9b9('0x13')][_0xe9b9('0x115')](db[_0xe9b9('0x118')],{'as':_0xe9b9('0x145'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db['VoiceContext'][_0xe9b9('0x115')](db[_0xe9b9('0x118')],{'onDelete':_0xe9b9('0x112')});db['VoiceExtension'][_0xe9b9('0x115')](db[_0xe9b9('0x118')],{'as':_0xe9b9('0x146'),'onDelete':_0xe9b9('0x112')});db[_0xe9b9('0x147')][_0xe9b9('0x123')](db[_0xe9b9('0x8e')],{'as':'Sounds','through':_0xe9b9('0x148')});db['VoiceQueue'][_0xe9b9('0x115')](db[_0xe9b9('0x2b')],{'as':_0xe9b9('0x149'),'foreignKey':'VoiceQueueId'});db[_0xe9b9('0x19')]['hasMany'](db[_0xe9b9('0x14a')],{'as':_0xe9b9('0x14b'),'foreignKey':_0xe9b9('0x14c')});db['VoiceQueue'][_0xe9b9('0x115')](db[_0xe9b9('0x79')],{'as':_0xe9b9('0x14d'),'foreignKey':_0xe9b9('0x14c')});db[_0xe9b9('0x19')][_0xe9b9('0x115')](db[_0xe9b9('0x7b')],{'as':_0xe9b9('0x14e'),'foreignKey':_0xe9b9('0x14c')});db['VoiceQueue'][_0xe9b9('0x115')](db[_0xe9b9('0x7d')],{'as':_0xe9b9('0x7d'),'foreignKey':'VoiceQueueId'});db[_0xe9b9('0x19')][_0xe9b9('0x115')](db[_0xe9b9('0x77')],{'as':_0xe9b9('0x14f'),'foreignKey':_0xe9b9('0x14c')});db[_0xe9b9('0x19')]['hasMany'](db[_0xe9b9('0xd9')],{'as':_0xe9b9('0x150'),'foreignKey':_0xe9b9('0x14c')});db['VoiceQueue']['belongsTo'](db[_0xe9b9('0x28')],{'as':'Trunk','foreignKey':'TrunkId'});db['VoiceQueue'][_0xe9b9('0x121')](db[_0xe9b9('0x28')],{'as':_0xe9b9('0x151'),'foreignKey':_0xe9b9('0x152')});db[_0xe9b9('0x19')][_0xe9b9('0x121')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db['VoiceQueue']['belongsTo'](db[_0xe9b9('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0xe9b9('0x153')});db[_0xe9b9('0x19')][_0xe9b9('0x123')](db[_0xe9b9('0xf8')],{'as':_0xe9b9('0x154'),'through':_0xe9b9('0x155')});db[_0xe9b9('0x19')][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':'Agents','through':'UserVoiceQueue'});db[_0xe9b9('0x19')][_0xe9b9('0x123')](db[_0xe9b9('0xe9')],{'as':'Teams','through':'TeamVoiceQueue'});db[_0xe9b9('0x19')]['belongsToMany'](db[_0xe9b9('0xf8')],{'as':'BlackLists','through':_0xe9b9('0x156')});db[_0xe9b9('0x1b')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'as':'User','foreignKey':_0xe9b9('0x113')});db['ScreenRecording']['belongsTo'](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x10'),'foreignKey':_0xe9b9('0x113')});db[_0xe9b9('0x1e')][_0xe9b9('0x115')](db[_0xe9b9('0x20')],{'as':'Messages','onDelete':_0xe9b9('0x112'),'foreignKey':'mailboxuser','sourceKey':_0xe9b9('0x157')});db[_0xe9b9('0x20')][_0xe9b9('0x121')](db['VoiceMail'],{'foreignKey':_0xe9b9('0x158'),'targetKey':'mailbox'});db[_0xe9b9('0x159')]['hasMany'](db[_0xe9b9('0x15a')],{'as':_0xe9b9('0x15b'),'foreignKey':'uniqueid','constraints':![]});db[_0xe9b9('0x159')][_0xe9b9('0x115')](db[_0xe9b9('0x24')],{'as':_0xe9b9('0x15c'),'foreignKey':_0xe9b9('0x15d'),'constraints':![]});db[_0xe9b9('0x159')]['belongsTo'](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x10'),'foreignKey':_0xe9b9('0x113')});db['VoiceCallReport'][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'as':_0xe9b9('0x15e'),'foreignKey':'ContactId'});db[_0xe9b9('0x3a')][_0xe9b9('0x121')](db[_0xe9b9('0x3d')],{'as':_0xe9b9('0x3d'),'foreignKey':_0xe9b9('0x15f')});db[_0xe9b9('0x3a')][_0xe9b9('0x121')](db['CloudProvider'],{'as':_0xe9b9('0x10d'),'foreignKey':_0xe9b9('0x160'),'onDelete':_0xe9b9('0x161')});db['MailServerOut'][_0xe9b9('0x121')](db[_0xe9b9('0x3d')],{'as':_0xe9b9('0x3d'),'foreignKey':_0xe9b9('0x15f')});db['MailServerOut'][_0xe9b9('0x121')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0xe9b9('0x160'),'onDelete':'restrict'});db[_0xe9b9('0x3d')]['hasOne'](db[_0xe9b9('0x3a')],{'as':_0xe9b9('0x162'),'onDelete':_0xe9b9('0x112')});db[_0xe9b9('0x3d')][_0xe9b9('0x111')](db[_0xe9b9('0x163')],{'as':_0xe9b9('0x164'),'onDelete':'cascade'});db[_0xe9b9('0x3d')][_0xe9b9('0x115')](db[_0xe9b9('0x82')],{'as':_0xe9b9('0x165'),'foreignKey':_0xe9b9('0x15f'),'onDelete':'cascade'});db['MailAccount']['hasMany'](db[_0xe9b9('0x166')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0xe9b9('0x3d')][_0xe9b9('0x115')](db['MailMessage'],{'as':_0xe9b9('0x167'),'foreignKey':_0xe9b9('0x15f')});db[_0xe9b9('0x3d')]['hasMany'](db[_0xe9b9('0x40')],{'as':'Interactions'});db[_0xe9b9('0x3d')][_0xe9b9('0x115')](db[_0xe9b9('0x168')],{'as':_0xe9b9('0x146')});db['MailAccount'][_0xe9b9('0x121')](db[_0xe9b9('0xf8')],{'as':_0xe9b9('0x169'),'foreignKey':_0xe9b9('0x16a')});db[_0xe9b9('0x3d')]['belongsTo'](db['Template'],{'as':_0xe9b9('0x92'),'foreignKey':_0xe9b9('0x16b')});db[_0xe9b9('0x3d')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xe9b9('0x153')});db['MailAccount'][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x16c'),'through':_0xe9b9('0x13e')});db[_0xe9b9('0x132')][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x16c'),'through':'UserMailQueue'});db[_0xe9b9('0x132')]['belongsToMany'](db[_0xe9b9('0xe9')],{'through':_0xe9b9('0x16d'),'as':'Teams'});db[_0xe9b9('0x40')][_0xe9b9('0x115')](db['MailMessage'],{'as':_0xe9b9('0x167'),'onDelete':'cascade','foreignKey':_0xe9b9('0x16e')});db[_0xe9b9('0x40')]['belongsTo'](db[_0xe9b9('0x3d')],{'as':_0xe9b9('0x16f'),'foreignKey':_0xe9b9('0x15f')});db[_0xe9b9('0x40')][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'as':_0xe9b9('0x15e'),'foreignKey':_0xe9b9('0x170')});db[_0xe9b9('0x40')]['belongsTo'](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x171'),'foreignKey':'UserId'});db[_0xe9b9('0x40')][_0xe9b9('0x123')](db['Tag'],{'through':_0xe9b9('0x172'),'as':'Tags'});db[_0xe9b9('0x40')][_0xe9b9('0x123')](db['Tag'],{'through':_0xe9b9('0x172'),'as':_0xe9b9('0x173')});db[_0xe9b9('0x40')][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x174'),'through':_0xe9b9('0x12a'),'foreignKey':_0xe9b9('0x16e')});db[_0xe9b9('0x41')]['hasMany'](db[_0xe9b9('0x175')],{'as':_0xe9b9('0x176'),'onDelete':_0xe9b9('0x112')});db[_0xe9b9('0x41')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x10')});db['MailMessage'][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'onDelete':_0xe9b9('0x112'),'as':_0xe9b9('0x15e')});db[_0xe9b9('0x41')][_0xe9b9('0x121')](db[_0xe9b9('0x40')],{'as':_0xe9b9('0x177'),'foreignKey':'MailInteractionId'});db[_0xe9b9('0x41')][_0xe9b9('0x121')](db['MailAccount'],{'as':_0xe9b9('0x16f'),'foreignKey':_0xe9b9('0x15f')});db[_0xe9b9('0x41')][_0xe9b9('0x121')](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0xe9b9('0x178')});db[_0xe9b9('0x41')]['belongsTo'](db[_0xe9b9('0x6b')],{'as':_0xe9b9('0x6b'),'foreignKey':'ChatOfflineMessageId'});db[_0xe9b9('0x168')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'onDelete':_0xe9b9('0x161')});db[_0xe9b9('0x168')][_0xe9b9('0x121')](db['MailQueue'],{'onDelete':_0xe9b9('0x161')});db[_0xe9b9('0x168')][_0xe9b9('0x121')](db['MailAccount'],{'onDelete':_0xe9b9('0x161')});db['MailApplication'][_0xe9b9('0x121')](db['Interval'],{'onDelete':_0xe9b9('0x161'),'foreignKey':_0xe9b9('0x179')});db[_0xe9b9('0x168')][_0xe9b9('0x121')](db['Tag'],{'onDelete':_0xe9b9('0x161'),'foreignKey':_0xe9b9('0x17a')});db[_0xe9b9('0x44')][_0xe9b9('0x121')](db['MailAccount'],{});db[_0xe9b9('0x44')]['belongsTo'](db[_0xe9b9('0xf8')],{'as':_0xe9b9('0x169'),'foreignKey':_0xe9b9('0x16a')});db['MailQueueReport'][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'as':_0xe9b9('0x15e'),'foreignKey':_0xe9b9('0x170')});db[_0xe9b9('0x44')][_0xe9b9('0x121')](db['MailInteraction'],{});db['MailQueueReport'][_0xe9b9('0x121')](db[_0xe9b9('0x41')],{});db[_0xe9b9('0x44')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{});db[_0xe9b9('0x44')][_0xe9b9('0x121')](db[_0xe9b9('0x132')],{});db[_0xe9b9('0x46')]['hasMany'](db[_0xe9b9('0x48')],{'as':'Items','onDelete':_0xe9b9('0x112')});db[_0xe9b9('0x49')][_0xe9b9('0x115')](db[_0xe9b9('0x82')],{'as':_0xe9b9('0x165'),'foreignKey':_0xe9b9('0x17b'),'onDelete':_0xe9b9('0x112')});db['FaxAccount'][_0xe9b9('0x115')](db[_0xe9b9('0x166')],{'as':_0xe9b9('0x17c'),'foreignKey':_0xe9b9('0x17b')});db[_0xe9b9('0x49')][_0xe9b9('0x115')](db[_0xe9b9('0x4c')],{'as':_0xe9b9('0x17d')});db[_0xe9b9('0x49')][_0xe9b9('0x115')](db['FaxApplication'],{'as':_0xe9b9('0x146')});db['FaxAccount']['hasMany'](db[_0xe9b9('0x118')],{'as':_0xe9b9('0x17e'),'onDelete':_0xe9b9('0x112')});db[_0xe9b9('0x49')][_0xe9b9('0x115')](db['FaxMessage'],{'as':_0xe9b9('0x167')});db[_0xe9b9('0x49')][_0xe9b9('0x121')](db[_0xe9b9('0x28')],{'as':_0xe9b9('0x28')});db[_0xe9b9('0x49')][_0xe9b9('0x121')](db[_0xe9b9('0xf8')],{'as':'List','foreignKey':_0xe9b9('0x16a')});db[_0xe9b9('0x49')][_0xe9b9('0x121')](db[_0xe9b9('0x87')],{'as':_0xe9b9('0x17f'),'foreignKey':_0xe9b9('0x153')});db[_0xe9b9('0x49')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_fax_accounts'});db[_0xe9b9('0x4a')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'onDelete':'restrict'});db[_0xe9b9('0x4a')]['belongsTo'](db[_0xe9b9('0x180')],{'onDelete':_0xe9b9('0x161')});db['FaxApplication']['belongsTo'](db[_0xe9b9('0x49')],{'onDelete':_0xe9b9('0x161')});db[_0xe9b9('0x4a')][_0xe9b9('0x121')](db[_0xe9b9('0x90')],{'onDelete':_0xe9b9('0x161'),'foreignKey':_0xe9b9('0x17a')});db[_0xe9b9('0x4c')][_0xe9b9('0x115')](db[_0xe9b9('0x4e')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xe9b9('0x181')});db[_0xe9b9('0x4c')][_0xe9b9('0x121')](db[_0xe9b9('0x49')],{'as':_0xe9b9('0x16f'),'foreignKey':'FaxAccountId'});db[_0xe9b9('0x4c')][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'as':'Contact','foreignKey':_0xe9b9('0x170')});db[_0xe9b9('0x4c')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'as':'Owner','foreignKey':'UserId'});db[_0xe9b9('0x4c')][_0xe9b9('0x123')](db[_0xe9b9('0x90')],{'through':_0xe9b9('0x182'),'as':_0xe9b9('0x183')});db[_0xe9b9('0x4c')]['belongsToMany'](db[_0xe9b9('0x90')],{'through':_0xe9b9('0x182'),'as':_0xe9b9('0x173')});db[_0xe9b9('0x4c')]['belongsToMany'](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x174'),'through':_0xe9b9('0x184'),'foreignKey':_0xe9b9('0x181')});db['FaxMessage'][_0xe9b9('0x121')](db['User'],{'onDelete':_0xe9b9('0x112'),'as':_0xe9b9('0x10')});db[_0xe9b9('0x4e')][_0xe9b9('0x121')](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0xe9b9('0x181')});db[_0xe9b9('0x4e')][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'onDelete':'cascade','as':_0xe9b9('0x15e')});db['FaxMessage']['belongsTo'](db[_0xe9b9('0x175')],{'as':_0xe9b9('0x175'),'foreignKey':'AttachmentId'});db[_0xe9b9('0x4e')][_0xe9b9('0x121')](db['FaxAccount'],{'as':_0xe9b9('0x16f'),'foreignKey':'FaxAccountId'});db['FaxQueue'][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x16c'),'through':_0xe9b9('0x33')});db[_0xe9b9('0x180')][_0xe9b9('0x123')](db['Team'],{'through':_0xe9b9('0x185'),'as':'Teams'});db[_0xe9b9('0x51')][_0xe9b9('0x121')](db[_0xe9b9('0x49')],{});db[_0xe9b9('0x51')][_0xe9b9('0x121')](db[_0xe9b9('0xf8')],{'as':_0xe9b9('0x169'),'foreignKey':_0xe9b9('0x16a')});db['FaxQueueReport'][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'as':_0xe9b9('0x15e'),'foreignKey':_0xe9b9('0x170')});db['FaxQueueReport'][_0xe9b9('0x121')](db[_0xe9b9('0x4c')],{});db['FaxQueueReport'][_0xe9b9('0x121')](db['FaxMessage'],{});db['FaxQueueReport'][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{});db[_0xe9b9('0x51')][_0xe9b9('0x121')](db[_0xe9b9('0x180')],{});db['SmsAccount'][_0xe9b9('0x115')](db[_0xe9b9('0x82')],{'as':_0xe9b9('0x165'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0xe9b9('0x53')][_0xe9b9('0x115')](db['CannedAnswer'],{'as':_0xe9b9('0x17c'),'foreignKey':_0xe9b9('0x186')});db[_0xe9b9('0x53')][_0xe9b9('0x115')](db['SmsMessage'],{'as':'Messages','foreignKey':_0xe9b9('0x186')});db[_0xe9b9('0x53')][_0xe9b9('0x115')](db[_0xe9b9('0x12c')],{'as':_0xe9b9('0x17d')});db[_0xe9b9('0x53')][_0xe9b9('0x115')](db[_0xe9b9('0x55')],{'as':_0xe9b9('0x146')});db['SmsAccount'][_0xe9b9('0x121')](db[_0xe9b9('0xf8')],{'as':'List','foreignKey':_0xe9b9('0x16a')});db[_0xe9b9('0x53')][_0xe9b9('0x121')](db[_0xe9b9('0x87')],{'as':_0xe9b9('0x17f'),'foreignKey':_0xe9b9('0x153')});db['SmsAccount'][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':'Agents','through':_0xe9b9('0x187')});db[_0xe9b9('0x55')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'onDelete':'restrict'});db[_0xe9b9('0x55')]['belongsTo'](db['SmsQueue'],{'onDelete':_0xe9b9('0x161')});db[_0xe9b9('0x55')][_0xe9b9('0x121')](db[_0xe9b9('0x53')],{'onDelete':'restrict'});db['SmsApplication'][_0xe9b9('0x121')](db[_0xe9b9('0x85')],{'onDelete':_0xe9b9('0x161'),'foreignKey':_0xe9b9('0x179')});db[_0xe9b9('0x55')][_0xe9b9('0x121')](db[_0xe9b9('0x90')],{'onDelete':_0xe9b9('0x161'),'foreignKey':_0xe9b9('0x17a')});db[_0xe9b9('0x12c')][_0xe9b9('0x115')](db[_0xe9b9('0x188')],{'as':_0xe9b9('0x167'),'onDelete':_0xe9b9('0x112'),'foreignKey':'SmsInteractionId'});db['SmsInteraction']['belongsTo'](db[_0xe9b9('0x53')],{'as':_0xe9b9('0x16f'),'foreignKey':_0xe9b9('0x186')});db[_0xe9b9('0x12c')][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'as':_0xe9b9('0x15e'),'foreignKey':'ContactId'});db[_0xe9b9('0x12c')][_0xe9b9('0x121')](db['User'],{'as':_0xe9b9('0x171'),'foreignKey':_0xe9b9('0x113')});db[_0xe9b9('0x12c')][_0xe9b9('0x123')](db[_0xe9b9('0x90')],{'through':_0xe9b9('0x189'),'as':_0xe9b9('0x183')});db[_0xe9b9('0x12c')][_0xe9b9('0x123')](db[_0xe9b9('0x90')],{'through':_0xe9b9('0x189'),'as':_0xe9b9('0x173')});db['SmsInteraction']['belongsToMany'](db[_0xe9b9('0x10')],{'as':'Users','through':'user_has_sms_interactions','foreignKey':_0xe9b9('0x18a')});db[_0xe9b9('0x188')]['belongsTo'](db['User'],{'as':'User'});db['SmsMessage'][_0xe9b9('0x121')](db['CmContact'],{'onDelete':_0xe9b9('0x112'),'as':'Contact'});db[_0xe9b9('0x188')][_0xe9b9('0x121')](db['SmsInteraction'],{'onDelete':_0xe9b9('0x112'),'as':'Interaction','foreignKey':_0xe9b9('0x18a')});db[_0xe9b9('0x188')][_0xe9b9('0x121')](db['SmsAccount'],{'as':'Account','foreignKey':'SmsAccountId'});db[_0xe9b9('0x59')][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':'Agents','through':_0xe9b9('0x35'),'foreignKey':_0xe9b9('0x18b')});db[_0xe9b9('0x59')][_0xe9b9('0x123')](db[_0xe9b9('0xe9')],{'through':_0xe9b9('0x18c'),'as':_0xe9b9('0x18d')});db[_0xe9b9('0x5b')]['hasMany'](db[_0xe9b9('0x82')],{'as':_0xe9b9('0x165'),'foreignKey':_0xe9b9('0x18e'),'onDelete':_0xe9b9('0x112')});db['OpenchannelAccount']['hasMany'](db[_0xe9b9('0x166')],{'as':_0xe9b9('0x17c'),'foreignKey':_0xe9b9('0x18e')});db[_0xe9b9('0x5b')][_0xe9b9('0x115')](db[_0xe9b9('0x5f')],{'as':_0xe9b9('0x17d'),'foreignKey':_0xe9b9('0x18e')});db['OpenchannelAccount'][_0xe9b9('0x115')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0xe9b9('0x18e')});db['OpenchannelAccount'][_0xe9b9('0x115')](db[_0xe9b9('0x5d')],{'as':_0xe9b9('0x146'),'foreignKey':_0xe9b9('0x18e')});db[_0xe9b9('0x5b')][_0xe9b9('0x121')](db[_0xe9b9('0xf8')],{'as':_0xe9b9('0x169'),'foreignKey':'ListId'});db['OpenchannelAccount']['belongsTo'](db[_0xe9b9('0x87')],{'as':_0xe9b9('0x17f'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':'Agents','through':_0xe9b9('0x140')});db[_0xe9b9('0x5d')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'onDelete':'restrict'});db['OpenchannelApplication'][_0xe9b9('0x121')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0xe9b9('0x18f')});db['OpenchannelApplication'][_0xe9b9('0x121')](db[_0xe9b9('0x5b')],{'onDelete':_0xe9b9('0x161'),'foreignKey':_0xe9b9('0x18e')});db['OpenchannelApplication']['belongsTo'](db[_0xe9b9('0x85')],{'onDelete':_0xe9b9('0x161'),'foreignKey':_0xe9b9('0x179')});db[_0xe9b9('0x5d')]['belongsTo'](db[_0xe9b9('0x90')],{'onDelete':_0xe9b9('0x161'),'foreignKey':'TagId'});db[_0xe9b9('0x5f')][_0xe9b9('0x115')](db[_0xe9b9('0x60')],{'as':_0xe9b9('0x167'),'onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x190')});db['OpenchannelInteraction']['belongsTo'](db['OpenchannelAccount'],{'as':_0xe9b9('0x16f'),'foreignKey':_0xe9b9('0x18e')});db[_0xe9b9('0x5f')][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'as':_0xe9b9('0x15e'),'foreignKey':'ContactId'});db[_0xe9b9('0x5f')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'as':'Owner','foreignKey':_0xe9b9('0x113')});db[_0xe9b9('0x5f')][_0xe9b9('0x123')](db[_0xe9b9('0x90')],{'through':_0xe9b9('0x191'),'as':_0xe9b9('0x183')});db['OpenchannelInteraction'][_0xe9b9('0x123')](db[_0xe9b9('0x90')],{'through':_0xe9b9('0x191'),'as':_0xe9b9('0x173')});db[_0xe9b9('0x5f')][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x174'),'through':_0xe9b9('0x12e'),'foreignKey':_0xe9b9('0x190')});db[_0xe9b9('0x60')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'onDelete':_0xe9b9('0x112'),'as':'User'});db[_0xe9b9('0x60')][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'onDelete':_0xe9b9('0x112'),'as':'Contact'});db[_0xe9b9('0x60')][_0xe9b9('0x121')](db[_0xe9b9('0x5f')],{'onDelete':_0xe9b9('0x112'),'as':_0xe9b9('0x177'),'foreignKey':'OpenchannelInteractionId'});db[_0xe9b9('0x60')][_0xe9b9('0x121')](db[_0xe9b9('0x175')],{'as':_0xe9b9('0x175'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0xe9b9('0x121')](db[_0xe9b9('0x5b')],{'as':_0xe9b9('0x16f'),'foreignKey':_0xe9b9('0x18e')});db[_0xe9b9('0x62')]['belongsToMany'](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x16c'),'through':_0xe9b9('0x36'),'foreignKey':_0xe9b9('0x18f')});db[_0xe9b9('0x62')]['belongsToMany'](db[_0xe9b9('0xe9')],{'through':_0xe9b9('0x192'),'as':'Teams'});db[_0xe9b9('0x138')][_0xe9b9('0x115')](db[_0xe9b9('0x82')],{'as':_0xe9b9('0x165'),'foreignKey':_0xe9b9('0x178'),'onDelete':_0xe9b9('0x112')});db['ChatWebsite'][_0xe9b9('0x115')](db['CannedAnswer'],{'as':_0xe9b9('0x17c'),'foreignKey':'ChatWebsiteId'});db[_0xe9b9('0x138')][_0xe9b9('0x115')](db[_0xe9b9('0x71')],{'as':_0xe9b9('0x193')});db[_0xe9b9('0x138')][_0xe9b9('0x115')](db[_0xe9b9('0x11b')],{'as':_0xe9b9('0x17d')});db[_0xe9b9('0x138')][_0xe9b9('0x115')](db['ChatApplication'],{'as':_0xe9b9('0x146')});db['ChatWebsite'][_0xe9b9('0x115')](db['ChatMessage'],{'as':_0xe9b9('0x167')});db['ChatWebsite'][_0xe9b9('0x121')](db[_0xe9b9('0xf8')],{'as':'List','foreignKey':_0xe9b9('0x16a')});db[_0xe9b9('0x138')][_0xe9b9('0x121')](db[_0xe9b9('0x85')],{'as':_0xe9b9('0x85'),'foreignKey':_0xe9b9('0x179')});db[_0xe9b9('0x138')][_0xe9b9('0x121')](db['MailAccount'],{'as':_0xe9b9('0x3d'),'foreignKey':_0xe9b9('0x15f')});db[_0xe9b9('0x138')][_0xe9b9('0x121')](db[_0xe9b9('0x87')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xe9b9('0x138')][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x16c'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xe9b9('0x121')](db[_0xe9b9('0x5b')],{});db[_0xe9b9('0x65')][_0xe9b9('0x121')](db[_0xe9b9('0xf8')],{'as':'List','foreignKey':'ListId'});db[_0xe9b9('0x65')][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'as':'Contact','foreignKey':_0xe9b9('0x170')});db[_0xe9b9('0x65')][_0xe9b9('0x121')](db[_0xe9b9('0x5f')],{});db['OpenchannelQueueReport'][_0xe9b9('0x121')](db[_0xe9b9('0x60')],{});db[_0xe9b9('0x65')][_0xe9b9('0x121')](db['User'],{});db[_0xe9b9('0x65')]['belongsTo'](db[_0xe9b9('0x62')],{});db[_0xe9b9('0x67')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x194'),'foreignKey':_0xe9b9('0x113'),'onDelete':_0xe9b9('0x161')});db[_0xe9b9('0x67')][_0xe9b9('0x121')](db[_0xe9b9('0x6d')],{'as':_0xe9b9('0x195'),'foreignKey':_0xe9b9('0x196'),'onDelete':'restrict'});db[_0xe9b9('0x67')][_0xe9b9('0x121')](db[_0xe9b9('0x138')],{'as':_0xe9b9('0x197'),'foreignKey':'ChatWebsiteId','onDelete':_0xe9b9('0x161')});db[_0xe9b9('0x67')]['belongsTo'](db[_0xe9b9('0x90')],{'onDelete':_0xe9b9('0x161'),'foreignKey':'TagId'});db[_0xe9b9('0x11b')]['hasMany'](db[_0xe9b9('0x198')],{'as':_0xe9b9('0x167'),'onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x199')});db[_0xe9b9('0x11b')][_0xe9b9('0x121')](db[_0xe9b9('0x138')],{'as':_0xe9b9('0x16f'),'foreignKey':_0xe9b9('0x178')});db['ChatInteraction'][_0xe9b9('0x121')](db['CmContact'],{'as':_0xe9b9('0x15e'),'foreignKey':_0xe9b9('0x170')});db[_0xe9b9('0x11b')]['belongsTo'](db['User'],{'as':_0xe9b9('0x171'),'foreignKey':_0xe9b9('0x113')});db['ChatInteraction'][_0xe9b9('0x123')](db[_0xe9b9('0x90')],{'through':_0xe9b9('0x19a'),'as':_0xe9b9('0x183')});db['ChatInteraction'][_0xe9b9('0x123')](db['Tag'],{'through':_0xe9b9('0x19a'),'as':'ThroughTags'});db[_0xe9b9('0x11b')][_0xe9b9('0x123')](db['User'],{'as':_0xe9b9('0x174'),'through':_0xe9b9('0x12b'),'foreignKey':_0xe9b9('0x199')});db['ChatMessage'][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'onDelete':'cascade','as':'User'});db[_0xe9b9('0x198')][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db[_0xe9b9('0x198')][_0xe9b9('0x121')](db[_0xe9b9('0x11b')],{'onDelete':_0xe9b9('0x112'),'as':_0xe9b9('0x177'),'foreignKey':_0xe9b9('0x199')});db['ChatMessage'][_0xe9b9('0x121')](db[_0xe9b9('0x175')],{'as':_0xe9b9('0x175'),'foreignKey':'AttachmentId'});db['ChatMessage']['belongsTo'](db['ChatWebsite'],{'as':_0xe9b9('0x16f'),'foreignKey':_0xe9b9('0x178')});db[_0xe9b9('0x6b')][_0xe9b9('0x115')](db[_0xe9b9('0x175')],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0xe9b9('0x112'),'hooks':!![]});db[_0xe9b9('0x6b')][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'onDelete':_0xe9b9('0x112'),'as':_0xe9b9('0x15e'),'foreignKey':_0xe9b9('0x170')});db[_0xe9b9('0x6b')][_0xe9b9('0x121')](db[_0xe9b9('0x138')],{'as':_0xe9b9('0x16f'),'foreignKey':_0xe9b9('0x178')});db[_0xe9b9('0x6d')][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x16c'),'through':'UserChatQueue','hooks':!![]});db[_0xe9b9('0x6d')]['belongsToMany'](db[_0xe9b9('0xe9')],{'through':_0xe9b9('0x19b'),'as':'Teams'});db['ChatGroup']['hasMany'](db[_0xe9b9('0xd4')],{'as':_0xe9b9('0x167'),'foreignKey':_0xe9b9('0x19c'),'onDelete':_0xe9b9('0x112')});db['ChatGroup']['belongsToMany'](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x149'),'through':'chat_group_has_users'});db[_0xe9b9('0x71')][_0xe9b9('0x121')](db[_0xe9b9('0x138')],{'as':_0xe9b9('0x197'),'foreignKey':'ChatWebsiteId'});db[_0xe9b9('0x19d')][_0xe9b9('0x115')](db[_0xe9b9('0x74')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0xe9b9('0x74')]['hasMany'](db['CmHopper'],{'as':_0xe9b9('0x14b'),'foreignKey':'ContactId'});db[_0xe9b9('0x74')][_0xe9b9('0x115')](db['CmHopperFinal'],{'as':_0xe9b9('0x14d'),'foreignKey':_0xe9b9('0x170')});db[_0xe9b9('0x74')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0xe9b9('0x74')][_0xe9b9('0x115')](db[_0xe9b9('0x7d')],{'as':_0xe9b9('0x7d'),'foreignKey':_0xe9b9('0x170')});db[_0xe9b9('0x74')][_0xe9b9('0x115')](db[_0xe9b9('0xd9')],{'as':_0xe9b9('0x150'),'foreignKey':_0xe9b9('0x170')});db['CmContact'][_0xe9b9('0x115')](db[_0xe9b9('0x5f')],{'as':_0xe9b9('0x11a'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xe9b9('0x74')]['hasMany'](db[_0xe9b9('0x11b')],{'as':_0xe9b9('0x11c'),'foreignKey':'ContactId','onDelete':_0xe9b9('0x161')});db[_0xe9b9('0x74')][_0xe9b9('0x115')](db['SmsInteraction'],{'as':_0xe9b9('0x11d'),'foreignKey':_0xe9b9('0x170'),'onDelete':_0xe9b9('0x161')});db[_0xe9b9('0x74')][_0xe9b9('0x115')](db[_0xe9b9('0x4c')],{'as':_0xe9b9('0x11e'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xe9b9('0x74')][_0xe9b9('0x115')](db[_0xe9b9('0x40')],{'as':_0xe9b9('0x129'),'foreignKey':_0xe9b9('0x170'),'onDelete':_0xe9b9('0x161')});db[_0xe9b9('0x74')][_0xe9b9('0x121')](db[_0xe9b9('0x19d')],{'as':_0xe9b9('0x19e'),'foreignKey':_0xe9b9('0x19f')});db[_0xe9b9('0x74')][_0xe9b9('0x121')](db[_0xe9b9('0xf8')],{'as':_0xe9b9('0x169'),'foreignKey':_0xe9b9('0x16a'),'onDelete':_0xe9b9('0x112')});db['CmContact'][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x174'),'through':_0xe9b9('0x126')});db[_0xe9b9('0x74')][_0xe9b9('0x123')](db['Tag'],{'as':_0xe9b9('0x183'),'through':'cm_contact_has_tags'});db[_0xe9b9('0x74')][_0xe9b9('0x123')](db[_0xe9b9('0x90')],{'through':'cm_contact_has_tags','as':_0xe9b9('0x173')});db['CmHopper'][_0xe9b9('0x121')](db['CmContact'],{'as':_0xe9b9('0x15e'),'foreignKey':'ContactId','onDelete':_0xe9b9('0x112')});db['CmHopper'][_0xe9b9('0x121')](db[_0xe9b9('0xf8')],{'as':'List','foreignKey':_0xe9b9('0x16a'),'onDelete':_0xe9b9('0x112')});db[_0xe9b9('0x14a')]['belongsTo'](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x194'),'foreignKey':_0xe9b9('0x113')});db[_0xe9b9('0x14a')][_0xe9b9('0x121')](db[_0xe9b9('0x19')],{'as':_0xe9b9('0x195'),'foreignKey':_0xe9b9('0x14c'),'onDelete':'cascade'});db[_0xe9b9('0x14a')][_0xe9b9('0x121')](db['Campaign'],{'as':_0xe9b9('0xec'),'foreignKey':_0xe9b9('0x1a0'),'onDelete':_0xe9b9('0x112')});db['CmHopper'][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x171'),'foreignKey':_0xe9b9('0x1a1')});db[_0xe9b9('0x77')][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'as':_0xe9b9('0x15e'),'foreignKey':_0xe9b9('0x170'),'onDelete':_0xe9b9('0x112')});db[_0xe9b9('0x77')]['belongsTo'](db[_0xe9b9('0xf8')],{'as':'List','foreignKey':_0xe9b9('0x16a'),'onDelete':_0xe9b9('0x112')});db[_0xe9b9('0x77')][_0xe9b9('0x121')](db[_0xe9b9('0x19')],{'as':_0xe9b9('0x195'),'foreignKey':_0xe9b9('0x14c'),'onDelete':_0xe9b9('0x112')});db[_0xe9b9('0x77')][_0xe9b9('0x121')](db['Campaign'],{'as':'Campaign','foreignKey':_0xe9b9('0x1a0'),'onDelete':_0xe9b9('0x112')});db[_0xe9b9('0x81')][_0xe9b9('0x115')](db['Condition'],{'as':{'plural':_0xe9b9('0x1a2'),'singular':_0xe9b9('0x1a3')},'foreignKey':_0xe9b9('0x1a4'),'onDelete':_0xe9b9('0x112'),'hooks':!![]});db[_0xe9b9('0x81')][_0xe9b9('0x115')](db['Condition'],{'as':{'plural':_0xe9b9('0x1a5'),'singular':_0xe9b9('0x1a6')},'foreignKey':_0xe9b9('0x1a7'),'onDelete':_0xe9b9('0x112'),'hooks':!![]});db[_0xe9b9('0x81')][_0xe9b9('0x115')](db['Action'],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0xe9b9('0x112'),'hooks':!![]});db[_0xe9b9('0x82')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0xe9b9('0x1a8'),'onDelete':'cascade'});db[_0xe9b9('0x85')]['hasMany'](db['Interval'],{'as':_0xe9b9('0x1a9'),'foreignKey':_0xe9b9('0x179'),'onDelete':_0xe9b9('0x112'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0xe9b9('0x118')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':'restrict'});db[_0xe9b9('0x85')][_0xe9b9('0x115')](db[_0xe9b9('0x168')],{'as':_0xe9b9('0x1aa'),'foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0xe9b9('0x67')],{'as':_0xe9b9('0x1ab'),'foreignKey':_0xe9b9('0x179')});db['Interval'][_0xe9b9('0x115')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':'IntervalId'});db['Interval'][_0xe9b9('0x115')](db[_0xe9b9('0x55')],{'as':'SmsApplications','foreignKey':_0xe9b9('0x179')});db[_0xe9b9('0x8c')]['belongsTo'](db['MailAccount'],{});db['Schedule'][_0xe9b9('0x121')](db[_0xe9b9('0x1ac')],{'foreignKey':_0xe9b9('0x1ad')});db[_0xe9b9('0x8c')][_0xe9b9('0x121')](db[_0xe9b9('0x9b')],{'foreignKey':_0xe9b9('0x1ae')});db[_0xe9b9('0x8e')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':'Mohs','through':_0xe9b9('0x148'),'onDelete':_0xe9b9('0x161')});db['Tag']['belongsToMany'](db[_0xe9b9('0x74')],{'through':'cm_contact_has_tags'});db[_0xe9b9('0x90')][_0xe9b9('0x123')](db[_0xe9b9('0x11b')],{'through':'chat_interaction_has_tags'});db[_0xe9b9('0x90')][_0xe9b9('0x123')](db[_0xe9b9('0x40')],{'through':_0xe9b9('0x172')});db['Tag']['belongsToMany'](db[_0xe9b9('0x12c')],{'through':'sms_interaction_has_tags'});db['Tag'][_0xe9b9('0x123')](db[_0xe9b9('0x4c')],{'through':_0xe9b9('0x182')});db[_0xe9b9('0x90')][_0xe9b9('0x123')](db[_0xe9b9('0x5f')],{'through':_0xe9b9('0x191')});db['Tag']['belongsToMany'](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db['Trigger'][_0xe9b9('0x115')](db[_0xe9b9('0x1af')],{'as':{'plural':_0xe9b9('0x1b0'),'singular':_0xe9b9('0x1b1')},'foreignKey':'TriggerAllId','onDelete':_0xe9b9('0x112'),'hooks':!![]});db[_0xe9b9('0x94')][_0xe9b9('0x115')](db[_0xe9b9('0x1af')],{'as':{'plural':'AnyConditions','singular':_0xe9b9('0x1b2')},'foreignKey':'TriggerAnyId','onDelete':_0xe9b9('0x112'),'hooks':!![]});db['Trigger'][_0xe9b9('0x115')](db[_0xe9b9('0x1b3')],{'as':_0xe9b9('0x1b4'),'foreignKey':_0xe9b9('0x1b5'),'onDelete':'cascade','hooks':!![]});db[_0xe9b9('0x9b')][_0xe9b9('0x115')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1ae'),'hooks':!![]});db['AnalyticDefaultReport'][_0xe9b9('0x115')](db[_0xe9b9('0xa1')],{'as':_0xe9b9('0x1b6'),'onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1ad')});db[_0xe9b9('0x9f')]['hasMany'](db[_0xe9b9('0xa1')],{'as':'Fields','onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1b7')});db[_0xe9b9('0xa1')]['belongsTo'](db[_0xe9b9('0x9f')],{'foreignKey':'MetricId'});db[_0xe9b9('0xa4')]['hasMany'](db[_0xe9b9('0xa6')],{'as':_0xe9b9('0x1b8'),'onDelete':_0xe9b9('0x112'),'foreignKey':'AccountId'});db[_0xe9b9('0xa6')][_0xe9b9('0x115')](db['SalesforceField'],{'as':_0xe9b9('0x1b9'),'onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1ba')});db[_0xe9b9('0xa6')][_0xe9b9('0x115')](db[_0xe9b9('0xa8')],{'as':_0xe9b9('0x1bb'),'onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1bc')});db['SalesforceConfiguration'][_0xe9b9('0x115')](db['SalesforceField'],{'as':'Fields','onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1bd')});db[_0xe9b9('0xa6')][_0xe9b9('0x121')](db[_0xe9b9('0xa4')],{'as':_0xe9b9('0x16f'),'foreignKey':_0xe9b9('0x1be')});db[_0xe9b9('0xa8')]['hasMany'](db[_0xe9b9('0xa8')],{'as':_0xe9b9('0x1bf'),'foreignKey':'SubjectId'});db[_0xe9b9('0xa8')][_0xe9b9('0x115')](db[_0xe9b9('0xa8')],{'as':'Description','foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0xa8')][_0xe9b9('0x115')](db[_0xe9b9('0xa8')],{'as':_0xe9b9('0x1c0'),'foreignKey':'FieldId'});db[_0xe9b9('0xa8')][_0xe9b9('0x121')](db[_0xe9b9('0x96')],{'as':_0xe9b9('0x96'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0xe9b9('0x115')](db[_0xe9b9('0x1c1')],{'as':'Configurations','onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1be')});db[_0xe9b9('0x1c1')]['hasMany'](db[_0xe9b9('0xab')],{'as':_0xe9b9('0x1b9'),'onDelete':'cascade','foreignKey':_0xe9b9('0x1ba')});db[_0xe9b9('0x1c1')][_0xe9b9('0x115')](db[_0xe9b9('0xab')],{'as':_0xe9b9('0x1bb'),'onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0x1c1')][_0xe9b9('0x115')](db[_0xe9b9('0xab')],{'as':_0xe9b9('0x1b6'),'onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1bd')});db[_0xe9b9('0x1c1')][_0xe9b9('0x121')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0xe9b9('0x1be')});db[_0xe9b9('0xab')][_0xe9b9('0x115')](db[_0xe9b9('0xab')],{'as':_0xe9b9('0x1bf'),'foreignKey':'SubjectId'});db[_0xe9b9('0xab')][_0xe9b9('0x115')](db['SugarcrmField'],{'as':_0xe9b9('0x1c2'),'foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0xab')][_0xe9b9('0x115')](db[_0xe9b9('0xab')],{'as':_0xe9b9('0x1c0'),'foreignKey':'FieldId'});db[_0xe9b9('0xab')]['belongsTo'](db['Variable'],{'as':_0xe9b9('0x96'),'foreignKey':_0xe9b9('0x1c3')});db['DeskAccount']['hasMany'](db[_0xe9b9('0x1c4')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xe9b9('0x1be')});db[_0xe9b9('0x1c4')][_0xe9b9('0x115')](db['DeskField'],{'as':'Subjects','onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1ba')});db['DeskConfiguration'][_0xe9b9('0x115')](db[_0xe9b9('0xaf')],{'as':_0xe9b9('0x1bb'),'onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1bc')});db['DeskConfiguration'][_0xe9b9('0x115')](db['DeskField'],{'as':_0xe9b9('0x1b6'),'onDelete':_0xe9b9('0x112'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0xe9b9('0x121')](db[_0xe9b9('0xad')],{'as':_0xe9b9('0x16f'),'foreignKey':_0xe9b9('0x1be')});db['DeskConfiguration'][_0xe9b9('0x123')](db['Tag'],{'through':_0xe9b9('0x1c5')});db[_0xe9b9('0xaf')][_0xe9b9('0x115')](db[_0xe9b9('0xaf')],{'as':'Subject','foreignKey':_0xe9b9('0x1ba')});db['DeskField'][_0xe9b9('0x115')](db[_0xe9b9('0xaf')],{'as':'Description','foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0xaf')][_0xe9b9('0x115')](db['DeskField'],{'as':_0xe9b9('0x1c0'),'foreignKey':_0xe9b9('0x1bd')});db[_0xe9b9('0xaf')][_0xe9b9('0x121')](db['Variable'],{'as':_0xe9b9('0x96'),'foreignKey':'VariableId'});db[_0xe9b9('0xb1')][_0xe9b9('0x115')](db['ZohoConfiguration'],{'as':_0xe9b9('0x1b8'),'onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1be')});db['ZohoConfiguration']['hasMany'](db[_0xe9b9('0x1c6')],{'as':_0xe9b9('0x1b9'),'onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1ba')});db[_0xe9b9('0x1c7')]['hasMany'](db[_0xe9b9('0x1c6')],{'as':_0xe9b9('0x1bb'),'onDelete':'cascade','foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0x1c7')][_0xe9b9('0x115')](db[_0xe9b9('0x1c6')],{'as':_0xe9b9('0x1b6'),'onDelete':'cascade','foreignKey':_0xe9b9('0x1bd')});db[_0xe9b9('0x1c7')]['belongsTo'](db[_0xe9b9('0xb1')],{'as':_0xe9b9('0x16f'),'foreignKey':_0xe9b9('0x1be')});db[_0xe9b9('0x1c6')][_0xe9b9('0x115')](db[_0xe9b9('0x1c6')],{'as':_0xe9b9('0x1bf'),'foreignKey':'SubjectId'});db[_0xe9b9('0x1c6')][_0xe9b9('0x115')](db[_0xe9b9('0x1c6')],{'as':_0xe9b9('0x1c2'),'foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0x1c6')][_0xe9b9('0x115')](db[_0xe9b9('0x1c6')],{'as':'Field','foreignKey':_0xe9b9('0x1bd')});db[_0xe9b9('0x1c6')][_0xe9b9('0x121')](db[_0xe9b9('0x96')],{'as':_0xe9b9('0x96'),'foreignKey':_0xe9b9('0x1c3')});db[_0xe9b9('0x1c8')]['hasMany'](db['ZendeskConfiguration'],{'as':_0xe9b9('0x1b8'),'onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1be')});db[_0xe9b9('0xb6')]['hasMany'](db[_0xe9b9('0xb8')],{'as':_0xe9b9('0x1b9'),'foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0xe9b9('0x115')](db[_0xe9b9('0xb8')],{'as':_0xe9b9('0x1bb'),'foreignKey':_0xe9b9('0x1bc')});db['ZendeskConfiguration'][_0xe9b9('0x115')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db['ZendeskConfiguration']['belongsTo'](db[_0xe9b9('0x1c8')],{'as':_0xe9b9('0x16f'),'foreignKey':_0xe9b9('0x1be')});db[_0xe9b9('0xb6')][_0xe9b9('0x123')](db[_0xe9b9('0x90')],{'through':_0xe9b9('0x1c9')});db[_0xe9b9('0xb8')][_0xe9b9('0x115')](db[_0xe9b9('0xb8')],{'as':_0xe9b9('0x1bf'),'foreignKey':_0xe9b9('0x1ba')});db[_0xe9b9('0xb8')][_0xe9b9('0x115')](db['ZendeskField'],{'as':_0xe9b9('0x1c2'),'foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0xb8')]['hasMany'](db[_0xe9b9('0xb8')],{'as':_0xe9b9('0x1c0'),'foreignKey':_0xe9b9('0x1bd')});db[_0xe9b9('0xb8')][_0xe9b9('0x121')](db[_0xe9b9('0x96')],{'as':_0xe9b9('0x96'),'foreignKey':_0xe9b9('0x1c3')});db[_0xe9b9('0xba')][_0xe9b9('0x115')](db[_0xe9b9('0x1ca')],{'as':_0xe9b9('0x1b8'),'onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1be')});db['FreshdeskConfiguration']['hasMany'](db[_0xe9b9('0xbc')],{'as':'Subjects','onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1ba')});db[_0xe9b9('0x1ca')]['hasMany'](db['FreshdeskField'],{'as':_0xe9b9('0x1bb'),'onDelete':'cascade','foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0x1ca')][_0xe9b9('0x115')](db[_0xe9b9('0xbc')],{'as':_0xe9b9('0x1b6'),'onDelete':'cascade','foreignKey':_0xe9b9('0x1bd')});db[_0xe9b9('0x1ca')][_0xe9b9('0x121')](db[_0xe9b9('0xba')],{'as':_0xe9b9('0x16f'),'foreignKey':_0xe9b9('0x1be')});db[_0xe9b9('0x1ca')]['belongsToMany'](db[_0xe9b9('0x90')],{'through':_0xe9b9('0x1cb')});db[_0xe9b9('0xbc')][_0xe9b9('0x115')](db[_0xe9b9('0xbc')],{'as':_0xe9b9('0x1bf'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0xe9b9('0x115')](db[_0xe9b9('0xbc')],{'as':_0xe9b9('0x1c2'),'foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0xbc')][_0xe9b9('0x115')](db[_0xe9b9('0xbc')],{'as':_0xe9b9('0x1c0'),'foreignKey':'FieldId'});db['FreshdeskField'][_0xe9b9('0x121')](db['Variable'],{'as':_0xe9b9('0x96'),'foreignKey':_0xe9b9('0x1c3')});db['VtigerAccount'][_0xe9b9('0x115')](db[_0xe9b9('0xbd')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xe9b9('0x1be')});db[_0xe9b9('0xbd')][_0xe9b9('0x115')](db['VtigerField'],{'as':'Subjects','foreignKey':_0xe9b9('0x1ba')});db['VtigerConfiguration'][_0xe9b9('0x115')](db[_0xe9b9('0xbf')],{'as':'Descriptions','foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0xbd')][_0xe9b9('0x115')](db[_0xe9b9('0xbf')],{'as':_0xe9b9('0x1b6'),'foreignKey':_0xe9b9('0x1bd')});db['VtigerConfiguration'][_0xe9b9('0x121')](db[_0xe9b9('0x1cc')],{'as':_0xe9b9('0x16f'),'foreignKey':_0xe9b9('0x1be')});db[_0xe9b9('0xbf')][_0xe9b9('0x115')](db['VtigerField'],{'as':'Subject','foreignKey':_0xe9b9('0x1ba')});db['VtigerField'][_0xe9b9('0x115')](db[_0xe9b9('0xbf')],{'as':'Description','foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0xbf')][_0xe9b9('0x115')](db[_0xe9b9('0xbf')],{'as':_0xe9b9('0x1c0'),'foreignKey':_0xe9b9('0x1bd')});db[_0xe9b9('0xbf')][_0xe9b9('0x121')](db[_0xe9b9('0x96')],{'as':_0xe9b9('0x96'),'foreignKey':_0xe9b9('0x1c3')});db['ServicenowAccount'][_0xe9b9('0x115')](db[_0xe9b9('0x1cd')],{'as':_0xe9b9('0x1b8'),'onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1be')});db[_0xe9b9('0x1cd')][_0xe9b9('0x115')](db[_0xe9b9('0xc2')],{'as':_0xe9b9('0x1b9'),'foreignKey':_0xe9b9('0x1ba')});db['ServicenowConfiguration'][_0xe9b9('0x115')](db[_0xe9b9('0xc2')],{'as':_0xe9b9('0x1bb'),'foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0x1cd')][_0xe9b9('0x115')](db[_0xe9b9('0xc2')],{'as':_0xe9b9('0x1b6'),'foreignKey':_0xe9b9('0x1bd')});db[_0xe9b9('0x1cd')][_0xe9b9('0x121')](db[_0xe9b9('0xc0')],{'as':_0xe9b9('0x16f'),'foreignKey':_0xe9b9('0x1be')});db[_0xe9b9('0xc2')]['hasMany'](db[_0xe9b9('0xc2')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xe9b9('0xc2')][_0xe9b9('0x115')](db[_0xe9b9('0xc2')],{'as':'Description','foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0xc2')][_0xe9b9('0x115')](db[_0xe9b9('0xc2')],{'as':_0xe9b9('0x1c0'),'foreignKey':'FieldId'});db[_0xe9b9('0xc2')][_0xe9b9('0x121')](db[_0xe9b9('0x96')],{'as':'Variable','foreignKey':_0xe9b9('0x1c3')});db[_0xe9b9('0x1ce')][_0xe9b9('0x115')](db[_0xe9b9('0xc5')],{'as':_0xe9b9('0x1b8'),'onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1be')});db[_0xe9b9('0xc5')]['hasMany'](db['Dynamics365Field'],{'as':_0xe9b9('0x1b9'),'onDelete':'cascade','foreignKey':_0xe9b9('0x1ba')});db['Dynamics365Configuration'][_0xe9b9('0x115')](db['Dynamics365Field'],{'as':_0xe9b9('0x1bb'),'onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0xc5')][_0xe9b9('0x115')](db[_0xe9b9('0xc7')],{'as':'Fields','onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1bd')});db[_0xe9b9('0xc5')][_0xe9b9('0x121')](db[_0xe9b9('0x1ce')],{'as':'Account','foreignKey':_0xe9b9('0x1be')});db['Dynamics365Field'][_0xe9b9('0x115')](db[_0xe9b9('0xc7')],{'as':'Subject','foreignKey':_0xe9b9('0x1ba')});db[_0xe9b9('0xc7')]['hasMany'](db[_0xe9b9('0xc7')],{'as':_0xe9b9('0x1c2'),'foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0xc7')]['hasMany'](db[_0xe9b9('0xc7')],{'as':_0xe9b9('0x1c0'),'foreignKey':_0xe9b9('0x1bd')});db['Dynamics365Field'][_0xe9b9('0x121')](db[_0xe9b9('0x96')],{'as':_0xe9b9('0x96'),'foreignKey':_0xe9b9('0x1c3')});db['FreshsalesAccount'][_0xe9b9('0x115')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1be')});db['FreshsalesConfiguration']['hasMany'](db[_0xe9b9('0xcd')],{'as':'Subjects','foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0xe9b9('0x115')](db[_0xe9b9('0xcd')],{'as':_0xe9b9('0x1bb'),'foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0xcb')][_0xe9b9('0x115')](db[_0xe9b9('0xcd')],{'as':'Fields','foreignKey':_0xe9b9('0x1bd')});db[_0xe9b9('0xcb')][_0xe9b9('0x121')](db[_0xe9b9('0xc9')],{'as':'Account','foreignKey':_0xe9b9('0x1be')});db[_0xe9b9('0xcd')]['hasMany'](db[_0xe9b9('0xcd')],{'as':'Subject','foreignKey':_0xe9b9('0x1ba')});db[_0xe9b9('0xcd')][_0xe9b9('0x115')](db['FreshsalesField'],{'as':_0xe9b9('0x1c2'),'foreignKey':_0xe9b9('0x1bc')});db[_0xe9b9('0xcd')][_0xe9b9('0x115')](db[_0xe9b9('0xcd')],{'as':'Field','foreignKey':'FieldId'});db['FreshsalesField']['belongsTo'](db[_0xe9b9('0x96')],{'as':'Variable','foreignKey':'VariableId'});db[_0xe9b9('0xd2')][_0xe9b9('0x121')](db[_0xe9b9('0x138')],{});db[_0xe9b9('0xd2')][_0xe9b9('0x121')](db[_0xe9b9('0xf8')],{'as':_0xe9b9('0x169'),'foreignKey':_0xe9b9('0x16a')});db['ChatQueueReport'][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'as':_0xe9b9('0x15e'),'foreignKey':_0xe9b9('0x170')});db[_0xe9b9('0xd2')][_0xe9b9('0x121')](db[_0xe9b9('0x11b')],{});db['ChatQueueReport']['belongsTo'](db[_0xe9b9('0x198')],{});db[_0xe9b9('0xd2')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{});db[_0xe9b9('0xd2')][_0xe9b9('0x121')](db[_0xe9b9('0x6d')],{});db['ChatInternalMessage'][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'onDelete':'cascade','foreignKey':_0xe9b9('0x1cf')});db[_0xe9b9('0xd4')]['belongsTo'](db[_0xe9b9('0x10')],{'onDelete':'cascade','foreignKey':_0xe9b9('0x1d0')});db[_0xe9b9('0xd9')][_0xe9b9('0x115')](db[_0xe9b9('0xd8')],{'foreignKey':'SessionId','onDelete':_0xe9b9('0x112')});db[_0xe9b9('0xd9')][_0xe9b9('0x115')](db[_0xe9b9('0xd6')],{'foreignKey':_0xe9b9('0x1d1'),'onDelete':_0xe9b9('0x112')});db[_0xe9b9('0xdb')]['belongsTo'](db[_0xe9b9('0x53')],{});db['SmsQueueReport']['belongsTo'](db['CmList'],{'as':_0xe9b9('0x169'),'foreignKey':_0xe9b9('0x16a')});db[_0xe9b9('0xdb')][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'as':'Contact','foreignKey':_0xe9b9('0x170')});db['SmsQueueReport']['belongsTo'](db[_0xe9b9('0x12c')],{});db[_0xe9b9('0xdb')][_0xe9b9('0x121')](db[_0xe9b9('0x188')],{});db[_0xe9b9('0xdb')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{});db[_0xe9b9('0xdb')][_0xe9b9('0x121')](db[_0xe9b9('0x59')],{});db['JscriptyProject'][_0xe9b9('0x115')](db[_0xe9b9('0xd9')],{'foreignKey':_0xe9b9('0x1d2')});db['JscriptyProject'][_0xe9b9('0x115')](db[_0xe9b9('0xd8')],{'foreignKey':_0xe9b9('0x1d2')});db[_0xe9b9('0xdf')]['hasMany'](db[_0xe9b9('0xd6')],{'foreignKey':'ProjectId'});db[_0xe9b9('0xe4')][_0xe9b9('0x123')](db['User'],{'as':_0xe9b9('0x174'),'through':_0xe9b9('0x144')});db[_0xe9b9('0xe9')][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x16c'),'through':_0xe9b9('0x128')});db[_0xe9b9('0xe9')][_0xe9b9('0x123')](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':_0xe9b9('0x12f')});db[_0xe9b9('0xe9')]['belongsToMany'](db[_0xe9b9('0x132')],{'through':_0xe9b9('0x16d'),'as':_0xe9b9('0x1d3')});db['Team'][_0xe9b9('0x123')](db[_0xe9b9('0x6d')],{'through':_0xe9b9('0x19b'),'as':'ChatQueues'});db[_0xe9b9('0xe9')][_0xe9b9('0x123')](db[_0xe9b9('0x180')],{'through':_0xe9b9('0x185'),'as':_0xe9b9('0x134')});db['Team'][_0xe9b9('0x123')](db[_0xe9b9('0x59')],{'through':_0xe9b9('0x18c'),'as':_0xe9b9('0x135')});db[_0xe9b9('0xe9')]['belongsToMany'](db[_0xe9b9('0x62')],{'through':_0xe9b9('0x192'),'as':_0xe9b9('0x136')});db[_0xe9b9('0xe9')]['belongsToMany'](db[_0xe9b9('0x10b')],{'through':_0xe9b9('0x1d4'),'as':_0xe9b9('0x137')});db['Team'][_0xe9b9('0x123')](db[_0xe9b9('0x130')],{'through':_0xe9b9('0x10f'),'as':_0xe9b9('0x131')});db[_0xe9b9('0xec')][_0xe9b9('0x115')](db[_0xe9b9('0x14a')],{'as':_0xe9b9('0x14b'),'foreignKey':_0xe9b9('0x1a0')});db[_0xe9b9('0xec')][_0xe9b9('0x115')](db[_0xe9b9('0x79')],{'as':_0xe9b9('0x14d'),'foreignKey':_0xe9b9('0x1a0')});db['Campaign'][_0xe9b9('0x115')](db[_0xe9b9('0x7b')],{'as':_0xe9b9('0x14e'),'foreignKey':'CampaignId'});db[_0xe9b9('0xec')]['hasMany'](db[_0xe9b9('0x77')],{'as':_0xe9b9('0x14f'),'foreignKey':_0xe9b9('0x1a0')});db[_0xe9b9('0xec')]['belongsTo'](db[_0xe9b9('0x28')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xe9b9('0xec')][_0xe9b9('0x121')](db[_0xe9b9('0x28')],{'as':_0xe9b9('0x151'),'foreignKey':'TrunkBackupId'});db[_0xe9b9('0xec')]['belongsTo'](db[_0xe9b9('0x85')],{'as':_0xe9b9('0x85'),'foreignKey':_0xe9b9('0x179')});db[_0xe9b9('0xec')]['belongsTo'](db[_0xe9b9('0xe4')],{'as':_0xe9b9('0xe4'),'foreignKey':_0xe9b9('0x1d5')});db[_0xe9b9('0xec')][_0xe9b9('0x123')](db[_0xe9b9('0xf8')],{'as':'Lists','through':_0xe9b9('0x1d6')});db[_0xe9b9('0xec')][_0xe9b9('0x123')](db['CmList'],{'as':_0xe9b9('0x1d7'),'through':_0xe9b9('0x1d8')});db['Attachment'][_0xe9b9('0x121')](db[_0xe9b9('0x6b')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0xe9b9('0xf2')][_0xe9b9('0x121')](db[_0xe9b9('0x41')],{});db[_0xe9b9('0xf2')]['belongsTo'](db[_0xe9b9('0x40')],{});db[_0xe9b9('0xf2')][_0xe9b9('0x121')](db[_0xe9b9('0x3d')],{'foreignKey':_0xe9b9('0x1d9'),'as':'FromAccount'});db['MailTransferReport'][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'foreignKey':_0xe9b9('0x1da'),'as':'FromAgent'});db[_0xe9b9('0xf2')]['belongsTo'](db['User'],{'foreignKey':_0xe9b9('0x1db'),'as':_0xe9b9('0x1dc')});db[_0xe9b9('0xf2')][_0xe9b9('0x121')](db[_0xe9b9('0x132')],{'foreignKey':_0xe9b9('0x1dd'),'as':'ToQueue'});db['MailTransferReport']['belongsTo'](db['MailAccount'],{'foreignKey':_0xe9b9('0x1de'),'as':_0xe9b9('0x1df')});db['ChatTransferReport'][_0xe9b9('0x121')](db[_0xe9b9('0x198')],{});db[_0xe9b9('0x1e0')][_0xe9b9('0x121')](db[_0xe9b9('0x11b')],{});db[_0xe9b9('0x1e0')]['belongsTo'](db[_0xe9b9('0x138')],{'foreignKey':_0xe9b9('0x1e1'),'as':'FromAccount'});db[_0xe9b9('0x1e0')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'foreignKey':'FromUserId','as':_0xe9b9('0x1e2')});db[_0xe9b9('0x1e0')]['belongsTo'](db[_0xe9b9('0x10')],{'foreignKey':_0xe9b9('0x1db'),'as':_0xe9b9('0x1dc')});db[_0xe9b9('0x1e0')][_0xe9b9('0x121')](db['ChatQueue'],{'foreignKey':_0xe9b9('0x1e3'),'as':'ToQueue'});db[_0xe9b9('0x1e0')][_0xe9b9('0x121')](db[_0xe9b9('0x138')],{'foreignKey':_0xe9b9('0x1e4'),'as':'ToAccount'});db['FaxTransferReport'][_0xe9b9('0x121')](db[_0xe9b9('0x4e')],{});db['FaxTransferReport'][_0xe9b9('0x121')](db['FaxInteraction'],{});db[_0xe9b9('0xf4')][_0xe9b9('0x121')](db[_0xe9b9('0x49')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0xe9b9('0xf4')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'foreignKey':_0xe9b9('0x1da'),'as':_0xe9b9('0x1e2')});db[_0xe9b9('0xf4')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'foreignKey':_0xe9b9('0x1db'),'as':_0xe9b9('0x1dc')});db[_0xe9b9('0xf4')]['belongsTo'](db[_0xe9b9('0x180')],{'foreignKey':_0xe9b9('0x1e5'),'as':_0xe9b9('0x1e6')});db[_0xe9b9('0xf4')][_0xe9b9('0x121')](db[_0xe9b9('0x49')],{'foreignKey':_0xe9b9('0x1e7'),'as':_0xe9b9('0x1df')});db[_0xe9b9('0x1e8')][_0xe9b9('0x121')](db[_0xe9b9('0x60')],{});db[_0xe9b9('0x1e8')]['belongsTo'](db[_0xe9b9('0x5f')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0xe9b9('0x5b')],{'foreignKey':_0xe9b9('0x1e9'),'as':_0xe9b9('0x1ea')});db[_0xe9b9('0x1e8')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'foreignKey':_0xe9b9('0x1da'),'as':_0xe9b9('0x1e2')});db[_0xe9b9('0x1e8')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'foreignKey':_0xe9b9('0x1db'),'as':_0xe9b9('0x1dc')});db[_0xe9b9('0x1e8')][_0xe9b9('0x121')](db[_0xe9b9('0x62')],{'foreignKey':_0xe9b9('0x1eb'),'as':_0xe9b9('0x1e6')});db[_0xe9b9('0x1e8')][_0xe9b9('0x121')](db[_0xe9b9('0x5b')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0xe9b9('0xf6')][_0xe9b9('0x121')](db[_0xe9b9('0x188')],{});db[_0xe9b9('0xf6')][_0xe9b9('0x121')](db[_0xe9b9('0x12c')],{});db[_0xe9b9('0xf6')][_0xe9b9('0x121')](db[_0xe9b9('0x53')],{'foreignKey':_0xe9b9('0x1ec'),'as':_0xe9b9('0x1ea')});db['SmsTransferReport'][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'foreignKey':_0xe9b9('0x1da'),'as':'FromAgent'});db['SmsTransferReport'][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'foreignKey':_0xe9b9('0x1db'),'as':_0xe9b9('0x1dc')});db[_0xe9b9('0xf6')][_0xe9b9('0x121')](db[_0xe9b9('0x59')],{'foreignKey':_0xe9b9('0x1ed'),'as':_0xe9b9('0x1e6')});db[_0xe9b9('0xf6')][_0xe9b9('0x121')](db['SmsAccount'],{'foreignKey':_0xe9b9('0x1ee'),'as':_0xe9b9('0x1df')});db[_0xe9b9('0xf8')]['hasMany'](db['Disposition'],{'as':_0xe9b9('0x165'),'foreignKey':_0xe9b9('0x16a'),'onDelete':_0xe9b9('0x112')});db[_0xe9b9('0xf8')][_0xe9b9('0x115')](db[_0xe9b9('0x7f')],{'as':_0xe9b9('0x1ef'),'foreignKey':_0xe9b9('0x16a')});db[_0xe9b9('0xf8')][_0xe9b9('0x115')](db[_0xe9b9('0x74')],{'as':'Contacts','onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x16a')});db[_0xe9b9('0xf8')]['hasMany'](db[_0xe9b9('0x79')],{'as':_0xe9b9('0x14d'),'foreignKey':_0xe9b9('0x16a')});db['CmList'][_0xe9b9('0x115')](db[_0xe9b9('0x7b')],{'as':_0xe9b9('0x119'),'foreignKey':_0xe9b9('0x16a')});db[_0xe9b9('0xf8')]['hasMany'](db['ReportAgentPreview'],{'as':_0xe9b9('0x7d'),'foreignKey':'ListId'});db['CmList'][_0xe9b9('0x123')](db[_0xe9b9('0x19')],{'as':_0xe9b9('0x1f0'),'through':_0xe9b9('0x155')});db[_0xe9b9('0xf8')][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':'Agents','through':_0xe9b9('0x127')});db[_0xe9b9('0x130')][_0xe9b9('0x115')](db['VoiceExtension'],{'as':_0xe9b9('0x1f1'),'onDelete':_0xe9b9('0x112')});db[_0xe9b9('0x130')][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x16c'),'through':'UserVoicePrefix'});db[_0xe9b9('0x130')][_0xe9b9('0x123')](db[_0xe9b9('0xe9')],{'through':_0xe9b9('0x10f'),'as':_0xe9b9('0x18d')});db['UserProfile'][_0xe9b9('0x115')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x174'),'foreignKey':_0xe9b9('0x122')});db[_0xe9b9('0xfa')][_0xe9b9('0x115')](db[_0xe9b9('0x1f2')],{'as':_0xe9b9('0x1f3'),'foreignKey':'userProfileId','onDelete':_0xe9b9('0x112')});db[_0xe9b9('0x1f2')][_0xe9b9('0x115')](db['UserProfileResource'],{'as':'Resources','foreignKey':_0xe9b9('0x1f4'),'onDelete':'cascade'});db[_0xe9b9('0x100')][_0xe9b9('0x115')](db['Disposition'],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0xe9b9('0x112')});db['WhatsappAccount'][_0xe9b9('0x115')](db['CannedAnswer'],{'as':_0xe9b9('0x17c'),'foreignKey':_0xe9b9('0x1f5')});db['WhatsappAccount'][_0xe9b9('0x115')](db['WhatsappMessage'],{'as':_0xe9b9('0x167'),'foreignKey':_0xe9b9('0x1f5')});db['WhatsappAccount'][_0xe9b9('0x115')](db[_0xe9b9('0x11f')],{'as':_0xe9b9('0x17d')});db[_0xe9b9('0x100')][_0xe9b9('0x115')](db[_0xe9b9('0x102')],{'as':_0xe9b9('0x146')});db[_0xe9b9('0x100')][_0xe9b9('0x121')](db['CmList'],{'as':_0xe9b9('0x169'),'foreignKey':'ListId'});db['WhatsappAccount'][_0xe9b9('0x121')](db[_0xe9b9('0x87')],{'as':_0xe9b9('0x17f'),'foreignKey':_0xe9b9('0x153')});db[_0xe9b9('0x100')][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x16c'),'through':'user_has_whatsapp_accounts'});db[_0xe9b9('0x102')]['belongsTo'](db[_0xe9b9('0x10')],{'onDelete':_0xe9b9('0x161')});db[_0xe9b9('0x102')][_0xe9b9('0x121')](db[_0xe9b9('0x10b')],{'onDelete':_0xe9b9('0x161')});db[_0xe9b9('0x102')]['belongsTo'](db[_0xe9b9('0x100')],{'onDelete':_0xe9b9('0x161')});db['WhatsappApplication']['belongsTo'](db[_0xe9b9('0x85')],{'onDelete':'restrict','foreignKey':_0xe9b9('0x179')});db[_0xe9b9('0x102')][_0xe9b9('0x121')](db[_0xe9b9('0x90')],{'onDelete':_0xe9b9('0x161'),'foreignKey':_0xe9b9('0x17a')});db['WhatsappInteraction'][_0xe9b9('0x115')](db[_0xe9b9('0x105')],{'as':_0xe9b9('0x167'),'onDelete':_0xe9b9('0x112'),'foreignKey':_0xe9b9('0x1f6')});db['WhatsappInteraction'][_0xe9b9('0x121')](db['WhatsappAccount'],{'as':_0xe9b9('0x16f'),'foreignKey':_0xe9b9('0x1f5')});db['WhatsappInteraction'][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'as':_0xe9b9('0x15e'),'foreignKey':_0xe9b9('0x170')});db[_0xe9b9('0x11f')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x171'),'foreignKey':_0xe9b9('0x113')});db['WhatsappInteraction'][_0xe9b9('0x123')](db[_0xe9b9('0x90')],{'through':_0xe9b9('0x1f7'),'as':'Tags'});db['WhatsappInteraction'][_0xe9b9('0x123')](db['Tag'],{'through':_0xe9b9('0x1f7'),'as':_0xe9b9('0x173')});db[_0xe9b9('0x11f')][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0xe9b9('0x1f6')});db[_0xe9b9('0x105')][_0xe9b9('0x121')](db['User'],{'as':'User'});db['WhatsappMessage'][_0xe9b9('0x121')](db['CmContact'],{'onDelete':_0xe9b9('0x112'),'as':_0xe9b9('0x15e')});db[_0xe9b9('0x105')][_0xe9b9('0x121')](db[_0xe9b9('0x11f')],{'onDelete':_0xe9b9('0x112'),'as':_0xe9b9('0x177'),'foreignKey':_0xe9b9('0x1f6')});db[_0xe9b9('0x105')]['belongsTo'](db[_0xe9b9('0x100')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0xe9b9('0x107')][_0xe9b9('0x121')](db[_0xe9b9('0x100')],{});db[_0xe9b9('0x107')][_0xe9b9('0x121')](db[_0xe9b9('0xf8')],{'as':'List','foreignKey':_0xe9b9('0x16a')});db[_0xe9b9('0x107')][_0xe9b9('0x121')](db[_0xe9b9('0x74')],{'as':_0xe9b9('0x15e'),'foreignKey':_0xe9b9('0x170')});db['WhatsappQueueReport'][_0xe9b9('0x121')](db['WhatsappInteraction'],{});db[_0xe9b9('0x107')][_0xe9b9('0x121')](db[_0xe9b9('0x10b')],{});db[_0xe9b9('0x107')][_0xe9b9('0x121')](db['WhatsappMessage'],{});db['WhatsappQueueReport']['belongsTo'](db[_0xe9b9('0x10')],{});db['WhatsappTransferReport'][_0xe9b9('0x121')](db[_0xe9b9('0x105')],{});db[_0xe9b9('0x109')][_0xe9b9('0x121')](db[_0xe9b9('0x11f')],{});db[_0xe9b9('0x109')]['belongsTo'](db[_0xe9b9('0x100')],{'foreignKey':_0xe9b9('0x1f8'),'as':_0xe9b9('0x1ea')});db['WhatsappTransferReport']['belongsTo'](db[_0xe9b9('0x100')],{'foreignKey':_0xe9b9('0x1f9'),'as':_0xe9b9('0x1df')});db[_0xe9b9('0x109')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0xe9b9('0x1fa'),'as':_0xe9b9('0x1e6')});db[_0xe9b9('0x109')]['belongsTo'](db['User'],{'foreignKey':_0xe9b9('0x1da'),'as':'FromAgent'});db[_0xe9b9('0x109')][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'foreignKey':'ToUserId','as':_0xe9b9('0x1dc')});db[_0xe9b9('0x10b')][_0xe9b9('0x123')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x16c'),'through':_0xe9b9('0x38'),'foreignKey':_0xe9b9('0x1fb')});db['WhatsappQueue']['belongsToMany'](db[_0xe9b9('0xe9')],{'through':_0xe9b9('0x1d4'),'as':'Teams'});db['UserSetting'][_0xe9b9('0x121')](db[_0xe9b9('0x10')],{'as':_0xe9b9('0x1fc'),'foreignKey':_0xe9b9('0x113'),'onDelete':'cascade','hooks':!![]});db[_0xe9b9('0x10d')][_0xe9b9('0x111')](db['MailServerIn'],{'as':_0xe9b9('0x162'),'onDelete':_0xe9b9('0x161')});db[_0xe9b9('0x10d')][_0xe9b9('0x111')](db[_0xe9b9('0x163')],{'as':'Smtp','onDelete':_0xe9b9('0x161')});module[_0xe9b9('0x1fd')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x45ac=['ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','CmCompany','CmContact','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.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','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','hasOne','VoiceMail','UserId','userSetting','cascade','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteraction','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','ChatInteractions','user_has_chat_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueue','MailQueues','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','VoiceQueue','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccount','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','Template','TemplateId','UserMailQueue','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','user_has_mail_interactions','Attachment','ChatWebsiteId','IntervalId','TagId','DashboardItem','FaxAccountId','fax_interaction_has_tags','Users','FaxInteractionId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsMessage','Interaction','SmsQueueId','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','OpenchannelMessage','user_has_openchannel_accounts','OpenchannelQueue','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','AttachmentId','team_has_openchannel_queues','ChatProactiveAction','ChatApplication','OpenchannelQueueReport','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','ChatGroupId','SmsInteractions','Company','CampaignId','OwnerId','CmHopperBlack','AutomationAllId','Condition','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','cm_contact_has_tags','Trigger','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticFieldReport','Fields','AnalyticMetric','MetricId','SalesforceConfiguration','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','VariableId','SugarcrmConfiguration','Field','DeskAccount','int_desk_configuration_has_tags','ZohoAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','Dynamics365Account','FromId','JscriptyQuestionReport','SessionId','ProjectId','user_has_square_projects','team_has_chat_queues','ChatQueues','team_has_whatsapp_queues','VoicePrefixes','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','ToAgent','ToChatQueueId','ToQueue','FromFaxAccountId','ToUserId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToQueueId','../config/environment','sequelize','lodash','jstz','determine','motion2','xcall','127.0.0.1','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','xC@LL1234','mysql','name','database','username','password','options','User','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','import','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model'];(function(_0x16aaf0,_0x2a9598){var _0xc7d6bd=function(_0x533525){while(--_0x533525){_0x16aaf0['push'](_0x16aaf0['shift']());}};_0xc7d6bd(++_0x2a9598);}(_0x45ac,0x1d8));var _0xc45a=function(_0x209cc0,_0x59bb37){_0x209cc0=_0x209cc0-0x0;var _0x3c5029=_0x45ac[_0x209cc0];return _0x3c5029;};'use strict';var config=require(_0xc45a('0x0'));var Sequelize=require(_0xc45a('0x1'));var _=require(_0xc45a('0x2'));var jstz=require(_0xc45a('0x3'));var timezone=jstz[_0xc45a('0x4')]();config[_0xc45a('0x1')]=_['defaultsDeep'](config[_0xc45a('0x1')],{'database':_0xc45a('0x5'),'username':_0xc45a('0x6'),'password':'xC@LL1234','options':{'host':_0xc45a('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xc45a('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xc45a('0x9'),'collate':_0xc45a('0xa')}}});config[_0xc45a('0xb')]=_[_0xc45a('0xc')](config[_0xc45a('0xb')],{'database':_0xc45a('0x5'),'username':_0xc45a('0x6'),'password':_0xc45a('0xd'),'options':{'host':_0xc45a('0x7'),'port':0xcea,'dialect':_0xc45a('0xe'),'dialectOptions':{'charset':_0xc45a('0x8')},'logging':![],'timezone':timezone[_0xc45a('0xf')](),'define':{'charset':_0xc45a('0x9'),'collate':_0xc45a('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc45a('0x1')][_0xc45a('0x10')],config[_0xc45a('0x1')][_0xc45a('0x11')],config['sequelize'][_0xc45a('0x12')],config[_0xc45a('0x1')][_0xc45a('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc45a('0xb')][_0xc45a('0x10')],config[_0xc45a('0xb')][_0xc45a('0x11')],config['sequelizeHistory'][_0xc45a('0x12')],config[_0xc45a('0xb')]['options'])};db[_0xc45a('0x14')]=db['sequelize']['import'](_0xc45a('0x15'));db[_0xc45a('0x16')]=db[_0xc45a('0x1')]['import'](_0xc45a('0x17'));db[_0xc45a('0x18')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/voiceContext/voiceContext.model');db[_0xc45a('0x1a')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x1b'));db[_0xc45a('0x1c')]=db['sequelize'][_0xc45a('0x19')](_0xc45a('0x1d'));db['VoiceQueue']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x1e'));db['VoiceRecording']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x1f'));db[_0xc45a('0x20')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x21'));db['VoiceMail']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x22'));db[_0xc45a('0x23')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x24'));db[_0xc45a('0x25')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x26'));db['VoiceDialReport']=db[_0xc45a('0x1')]['import']('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0xc45a('0x1')]['import'](_0xc45a('0x27'));db[_0xc45a('0x28')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x29'));db[_0xc45a('0x2a')]=db['sequelize']['import'](_0xc45a('0x2b'));db[_0xc45a('0x2c')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x2d'));db[_0xc45a('0x2e')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x2f'));db[_0xc45a('0x30')]=db['sequelize'][_0xc45a('0x19')](_0xc45a('0x31'));db[_0xc45a('0x32')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x33'));db['UserMailQueue']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x34'));db['UserFaxQueue']=db['sequelize'][_0xc45a('0x19')](_0xc45a('0x35'));db[_0xc45a('0x36')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x37'));db[_0xc45a('0x38')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x39'));db[_0xc45a('0x3a')]=db[_0xc45a('0x1')]['import'](_0xc45a('0x3b'));db[_0xc45a('0x3c')]=db[_0xc45a('0x1')]['import']('../api/mailServerIn/mailServerIn.model');db[_0xc45a('0x3d')]=db[_0xc45a('0x1')]['import'](_0xc45a('0x3e'));db['MailAccount']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x3f'));db['MailQueue']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x40'));db[_0xc45a('0x41')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x42'));db[_0xc45a('0x43')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/mailInteraction/mailInteraction.model');db[_0xc45a('0x44')]=db[_0xc45a('0x1')]['import'](_0xc45a('0x45'));db[_0xc45a('0x46')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x47'));db[_0xc45a('0x48')]=db['sequelize'][_0xc45a('0x19')]('../api/mailQueueReport/mailQueueReport.model');db[_0xc45a('0x49')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x4a'));db['DashboardItem']=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x4b'));db[_0xc45a('0x4c')]=db['sequelize'][_0xc45a('0x19')](_0xc45a('0x4d'));db['FaxInteraction']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x4e'));db[_0xc45a('0x4f')]=db['sequelize']['import']('../api/faxMessage/faxMessage.model');db[_0xc45a('0x50')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x51'));db[_0xc45a('0x52')]=db['sequelize']['import'](_0xc45a('0x53'));db[_0xc45a('0x54')]=db['sequelize']['import']('../api/smsAccount/smsAccount.model');db[_0xc45a('0x55')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x56'));db[_0xc45a('0x57')]=db[_0xc45a('0x1')]['import']('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db['sequelize'][_0xc45a('0x19')](_0xc45a('0x58'));db[_0xc45a('0x59')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x5a'));db['OpenchannelAccount']=db[_0xc45a('0x1')]['import'](_0xc45a('0x5b'));db[_0xc45a('0x5c')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x5d'));db['OpenchannelInteraction']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x5e'));db['OpenchannelMessage']=db['sequelize'][_0xc45a('0x19')](_0xc45a('0x5f'));db['OpenchannelQueue']=db[_0xc45a('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0xc45a('0x60')]=db['sequelize'][_0xc45a('0x19')](_0xc45a('0x61'));db['OpenchannelQueueReport']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x62'));db['ChatApplication']=db['sequelize'][_0xc45a('0x19')](_0xc45a('0x63'));db['ChatInteraction']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x64'));db[_0xc45a('0x65')]=db['sequelize'][_0xc45a('0x19')](_0xc45a('0x66'));db[_0xc45a('0x67')]=db['sequelize'][_0xc45a('0x19')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xc45a('0x68')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x69'));db['ChatGroup']=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xc45a('0x6a')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/cmCompany/cmCompany.model');db[_0xc45a('0x6b')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/cmContact/cmContact.model');db[_0xc45a('0x6c')]=db['sequelize']['import'](_0xc45a('0x6d'));db['CmHopperBlack']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x6e'));db[_0xc45a('0x6f')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xc45a('0x70')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x71'));db[_0xc45a('0x72')]=db['sequelize'][_0xc45a('0x19')](_0xc45a('0x73'));db[_0xc45a('0x74')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x75'));db[_0xc45a('0x76')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x77'));db[_0xc45a('0x78')]=db[_0xc45a('0x1')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0xc45a('0x79')]=db['sequelize'][_0xc45a('0x19')](_0xc45a('0x7a'));db['Condition']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x7b'));db[_0xc45a('0x7c')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x7d'));db[_0xc45a('0x7e')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/pause/pause.model');db[_0xc45a('0x7f')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x80'));db[_0xc45a('0x81')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x82'));db[_0xc45a('0x83')]=db[_0xc45a('0x1')]['import'](_0xc45a('0x84'));db['Sound']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x85'));db[_0xc45a('0x86')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/tag/tag.model');db['Template']=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/template/template.model');db['Trigger']=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/trigger/trigger.model');db[_0xc45a('0x87')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x88'));db[_0xc45a('0x89')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x8a'));db['IntegrationReport']=db[_0xc45a('0x1')]['import'](_0xc45a('0x8b'));db[_0xc45a('0x8c')]=db[_0xc45a('0x1')]['import'](_0xc45a('0x8d'));db[_0xc45a('0x8e')]=db[_0xc45a('0x1')]['import'](_0xc45a('0x8f'));db[_0xc45a('0x90')]=db['sequelize'][_0xc45a('0x19')](_0xc45a('0x91'));db['AnalyticMetric']=db[_0xc45a('0x1')]['import'](_0xc45a('0x92'));db['AnalyticFieldReport']=db[_0xc45a('0x1')]['import'](_0xc45a('0x93'));db['AnalyticTreeReport']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x94'));db[_0xc45a('0x95')]=db[_0xc45a('0x1')]['import'](_0xc45a('0x96'));db['SalesforceConfiguration']=db['sequelize'][_0xc45a('0x19')](_0xc45a('0x97'));db['SalesforceField']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x98'));db[_0xc45a('0x99')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x9a'));db['SugarcrmConfiguration']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x9b'));db[_0xc45a('0x9c')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x9d'));db['DeskAccount']=db[_0xc45a('0x1')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0xc45a('0x9e')]=db['sequelize'][_0xc45a('0x19')](_0xc45a('0x9f'));db[_0xc45a('0xa0')]=db[_0xc45a('0x1')]['import'](_0xc45a('0xa1'));db['ZohoAccount']=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/intZohoAccount/intZohoAccount.model');db[_0xc45a('0xa2')]=db['sequelize']['import'](_0xc45a('0xa3'));db[_0xc45a('0xa4')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/intZohoField/intZohoField.model');db[_0xc45a('0xa5')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xa6'));db[_0xc45a('0xa7')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xc45a('0xa8')]=db['sequelize'][_0xc45a('0x19')](_0xc45a('0xa9'));db[_0xc45a('0xaa')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xab'));db['FreshdeskConfiguration']=db['sequelize']['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xc45a('0xac')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xad'));db[_0xc45a('0xae')]=db[_0xc45a('0x1')]['import'](_0xc45a('0xaf'));db['VtigerConfiguration']=db['sequelize'][_0xc45a('0x19')](_0xc45a('0xb0'));db['VtigerField']=db['sequelize'][_0xc45a('0x19')](_0xc45a('0xb1'));db[_0xc45a('0xb2')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xb3'));db[_0xc45a('0xb4')]=db['sequelize']['import'](_0xc45a('0xb5'));db[_0xc45a('0xb6')]=db[_0xc45a('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db['sequelize']['import'](_0xc45a('0xb7'));db[_0xc45a('0xb8')]=db[_0xc45a('0x1')]['import'](_0xc45a('0xb9'));db[_0xc45a('0xba')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db[_0xc45a('0x1')]['import'](_0xc45a('0xbb'));db[_0xc45a('0xbc')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xc45a('0xbd')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xbe'));db[_0xc45a('0x89')]=db[_0xc45a('0x1')]['import'](_0xc45a('0x8a'));db[_0xc45a('0xbf')]=db['sequelize']['import'](_0xc45a('0xc0'));db[_0xc45a('0xc1')]=db[_0xc45a('0x1')]['import'](_0xc45a('0xc2'));db[_0xc45a('0xc3')]=db[_0xc45a('0x1')]['import'](_0xc45a('0xc4'));db[_0xc45a('0xc5')]=db['sequelize'][_0xc45a('0x19')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db[_0xc45a('0x1')]['import'](_0xc45a('0xc6'));db[_0xc45a('0xc7')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xc45a('0xc8')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xc9'));db[_0xc45a('0xca')]=db['sequelize'][_0xc45a('0x19')](_0xc45a('0xcb'));db[_0xc45a('0xcc')]=db['sequelize'][_0xc45a('0x19')](_0xc45a('0xcd'));db[_0xc45a('0xce')]=db['sequelize']['import'](_0xc45a('0xcf'));db[_0xc45a('0xd0')]=db[_0xc45a('0x1')]['import'](_0xc45a('0xd1'));db[_0xc45a('0xd2')]=db[_0xc45a('0x1')]['import'](_0xc45a('0xd3'));db[_0xc45a('0xd4')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xd5'));db[_0xc45a('0xd6')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/squareRecording/squareRecording.model');db['SquareMessage']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xd7'));db[_0xc45a('0xd8')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xd9'));db[_0xc45a('0xda')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/license/license.model');db[_0xc45a('0xdb')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xdc'));db[_0xc45a('0xdd')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xde'));db['Attachment']=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/attachment/attachment.model');db[_0xc45a('0xdf')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xe0'));db[_0xc45a('0xe1')]=db[_0xc45a('0x1')]['import'](_0xc45a('0xe2'));db[_0xc45a('0xe3')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xe4'));db[_0xc45a('0xe5')]=db[_0xc45a('0x1')]['import'](_0xc45a('0xe6'));db[_0xc45a('0xe7')]=db[_0xc45a('0x1')]['import'](_0xc45a('0xe8'));db[_0xc45a('0xe9')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/smsTransferReport/smsTransferReport.model');db[_0xc45a('0xea')]=db[_0xc45a('0x1')]['import'](_0xc45a('0xeb'));db[_0xc45a('0xec')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xed'));db[_0xc45a('0xee')]=db[_0xc45a('0x1')]['import'](_0xc45a('0xef'));db[_0xc45a('0xf0')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xf1'));db[_0xc45a('0xf2')]=db[_0xc45a('0x1')][_0xc45a('0x19')]('../api/userProfileResource/userProfileResource.model');db['UserNotification']=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xf3'));db[_0xc45a('0xf4')]=db['sequelize'][_0xc45a('0x19')](_0xc45a('0xf5'));db[_0xc45a('0xf6')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xf7'));db[_0xc45a('0xf8')]=db['sequelize'][_0xc45a('0x19')](_0xc45a('0xf9'));db[_0xc45a('0xfa')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0xfb'));db[_0xc45a('0xfc')]=db[_0xc45a('0x1')]['import'](_0xc45a('0xfd'));db[_0xc45a('0xfe')]=db['sequelize']['import'](_0xc45a('0xff'));db[_0xc45a('0x100')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x101'));db[_0xc45a('0x102')]=db[_0xc45a('0x1')]['import']('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db['sequelize'][_0xc45a('0x19')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xc45a('0x103')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x104'));db[_0xc45a('0x105')]=db[_0xc45a('0x1')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db[_0xc45a('0x106')]=db[_0xc45a('0x1')][_0xc45a('0x19')](_0xc45a('0x107'));db['User'][_0xc45a('0x108')](db[_0xc45a('0x109')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0xc45a('0x10a')});db[_0xc45a('0x14')][_0xc45a('0x108')](db[_0xc45a('0x106')],{'as':_0xc45a('0x10b'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x10a')});db[_0xc45a('0x14')][_0xc45a('0x10d')](db[_0xc45a('0x10e')],{'as':_0xc45a('0x10f'),'foreignKey':_0xc45a('0x10a')});db[_0xc45a('0x14')][_0xc45a('0x10d')](db[_0xc45a('0x2e')],{'as':_0xc45a('0x110'),'foreignKey':'UserId'});db[_0xc45a('0x14')][_0xc45a('0x10d')](db[_0xc45a('0x1a')],{'as':_0xc45a('0x111'),'onDelete':'cascade','hooks':!![]});db[_0xc45a('0x14')][_0xc45a('0x10d')](db['CmHopperFinal'],{'as':_0xc45a('0x112'),'foreignKey':_0xc45a('0x10a')});db[_0xc45a('0x14')][_0xc45a('0x10d')](db[_0xc45a('0x113')],{'as':_0xc45a('0x114'),'foreignKey':_0xc45a('0x10a')});db[_0xc45a('0x14')]['hasMany'](db[_0xc45a('0x70')],{'as':_0xc45a('0x70'),'foreignKey':_0xc45a('0x10a')});db['User'][_0xc45a('0x10d')](db[_0xc45a('0x115')],{'as':_0xc45a('0x116'),'foreignKey':_0xc45a('0x10a')});db[_0xc45a('0x14')]['hasMany'](db[_0xc45a('0x117')],{'as':'ChatInteractions','foreignKey':_0xc45a('0x10a')});db[_0xc45a('0x14')][_0xc45a('0x10d')](db[_0xc45a('0x57')],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0xc45a('0x14')][_0xc45a('0x10d')](db[_0xc45a('0x118')],{'as':_0xc45a('0x119'),'foreignKey':_0xc45a('0x10a')});db[_0xc45a('0x14')][_0xc45a('0x10d')](db[_0xc45a('0x43')],{'as':_0xc45a('0x11a'),'foreignKey':_0xc45a('0x10a')});db[_0xc45a('0x14')][_0xc45a('0x10d')](db[_0xc45a('0xf8')],{'as':_0xc45a('0x11b'),'foreignKey':_0xc45a('0x10a')});db[_0xc45a('0x14')][_0xc45a('0x10d')](db[_0xc45a('0x11c')],{'as':_0xc45a('0x11d'),'foreignKey':_0xc45a('0x11e')});db[_0xc45a('0x14')][_0xc45a('0x11f')](db[_0xc45a('0xee')],{'as':_0xc45a('0xee'),'foreignKey':_0xc45a('0x120')});db[_0xc45a('0x14')][_0xc45a('0x121')](db[_0xc45a('0x122')],{'as':_0xc45a('0x123'),'through':_0xc45a('0x124')});db['User'][_0xc45a('0x121')](db[_0xc45a('0x6b')],{'as':_0xc45a('0x125'),'through':_0xc45a('0x126')});db['User'][_0xc45a('0x121')](db['CmList'],{'as':_0xc45a('0x127'),'through':_0xc45a('0x128')});db[_0xc45a('0x14')][_0xc45a('0x121')](db['Team'],{'through':_0xc45a('0x129')});db[_0xc45a('0x14')][_0xc45a('0x121')](db[_0xc45a('0x43')],{'as':_0xc45a('0x11a'),'through':'user_has_mail_interactions'});db[_0xc45a('0x14')][_0xc45a('0x121')](db[_0xc45a('0x117')],{'as':_0xc45a('0x12a'),'through':_0xc45a('0x12b')});db[_0xc45a('0x14')][_0xc45a('0x121')](db['FaxInteraction'],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db['User'][_0xc45a('0x121')](db[_0xc45a('0x57')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0xc45a('0x14')]['belongsToMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0xc45a('0x14')][_0xc45a('0x121')](db[_0xc45a('0xf8')],{'as':_0xc45a('0x11b'),'through':_0xc45a('0x12c')});db[_0xc45a('0x14')]['belongsToMany'](db['VoiceQueue'],{'as':_0xc45a('0x12d'),'through':_0xc45a('0x30'),'required':![]});db[_0xc45a('0x14')]['belongsToMany'](db[_0xc45a('0xec')],{'as':'VoicePrefixes','through':'UserVoicePrefix','required':![]});db[_0xc45a('0x14')][_0xc45a('0x121')](db[_0xc45a('0x12e')],{'as':_0xc45a('0x12f'),'through':'UserMailQueue','required':![]});db['User'][_0xc45a('0x121')](db[_0xc45a('0x68')],{'as':'ChatQueues','through':_0xc45a('0x32'),'required':![],'hooks':!![]});db[_0xc45a('0x14')][_0xc45a('0x121')](db[_0xc45a('0x50')],{'as':_0xc45a('0x130'),'through':_0xc45a('0x131'),'required':![]});db[_0xc45a('0x14')][_0xc45a('0x121')](db[_0xc45a('0x59')],{'as':_0xc45a('0x132'),'through':_0xc45a('0x36'),'required':![]});db[_0xc45a('0x14')]['belongsToMany'](db['OpenchannelQueue'],{'as':_0xc45a('0x133'),'through':_0xc45a('0x38'),'required':![]});db[_0xc45a('0x14')][_0xc45a('0x121')](db[_0xc45a('0x100')],{'as':_0xc45a('0x134'),'through':'UserWhatsappQueue','required':![]});db[_0xc45a('0x14')]['belongsToMany'](db[_0xc45a('0xea')],{'through':_0xc45a('0x128')});db[_0xc45a('0x14')][_0xc45a('0x121')](db[_0xc45a('0x60')],{'as':_0xc45a('0x135'),'through':_0xc45a('0x136')});db['User']['belongsToMany'](db[_0xc45a('0x137')],{'as':_0xc45a('0x138'),'through':_0xc45a('0x139')});db[_0xc45a('0x14')][_0xc45a('0x121')](db['MailAccount'],{'as':_0xc45a('0x13a'),'through':_0xc45a('0x13b')});db[_0xc45a('0x14')][_0xc45a('0x121')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0xc45a('0x14')][_0xc45a('0x121')](db[_0xc45a('0x54')],{'as':_0xc45a('0x13c'),'through':_0xc45a('0x13d')});db['User'][_0xc45a('0x121')](db[_0xc45a('0xf4')],{'as':'WhatsappAccounts','through':_0xc45a('0x13e')});db[_0xc45a('0x14')][_0xc45a('0x121')](db[_0xc45a('0xd4')],{'as':_0xc45a('0x13f'),'through':'user_has_square_projects'});db[_0xc45a('0x16')]['hasMany'](db[_0xc45a('0x1a')],{'as':_0xc45a('0x140'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x141')});db[_0xc45a('0x18')][_0xc45a('0x10d')](db[_0xc45a('0x1a')],{'onDelete':_0xc45a('0x10c')});db[_0xc45a('0x1a')][_0xc45a('0x10d')](db['VoiceExtension'],{'as':_0xc45a('0x142'),'onDelete':_0xc45a('0x10c')});db[_0xc45a('0x1c')][_0xc45a('0x121')](db[_0xc45a('0x143')],{'as':_0xc45a('0x144'),'through':_0xc45a('0x145')});db[_0xc45a('0x146')][_0xc45a('0x10d')](db['UserVoiceQueueRt'],{'as':_0xc45a('0x147'),'foreignKey':_0xc45a('0x148')});db[_0xc45a('0x146')][_0xc45a('0x10d')](db[_0xc45a('0x6c')],{'as':_0xc45a('0x149'),'foreignKey':_0xc45a('0x148')});db[_0xc45a('0x146')][_0xc45a('0x10d')](db['CmHopperFinal'],{'as':_0xc45a('0x112'),'foreignKey':_0xc45a('0x148')});db[_0xc45a('0x146')][_0xc45a('0x10d')](db[_0xc45a('0x113')],{'as':_0xc45a('0x14a'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xc45a('0x10d')](db['ReportAgentPreview'],{'as':_0xc45a('0x70'),'foreignKey':'VoiceQueueId'});db[_0xc45a('0x146')][_0xc45a('0x10d')](db['CmHopperBlack'],{'as':_0xc45a('0x14b'),'foreignKey':_0xc45a('0x148')});db[_0xc45a('0x146')]['hasMany'](db['JscriptySessionReport'],{'as':_0xc45a('0x14c'),'foreignKey':_0xc45a('0x148')});db[_0xc45a('0x146')][_0xc45a('0x11f')](db[_0xc45a('0x2c')],{'as':_0xc45a('0x2c'),'foreignKey':_0xc45a('0x14d')});db[_0xc45a('0x146')][_0xc45a('0x11f')](db[_0xc45a('0x2c')],{'as':_0xc45a('0x14e'),'foreignKey':'TrunkBackupId'});db[_0xc45a('0x146')][_0xc45a('0x11f')](db[_0xc45a('0x7c')],{'as':_0xc45a('0x7c'),'foreignKey':'IntervalId'});db[_0xc45a('0x146')][_0xc45a('0x11f')](db['Pause'],{'as':_0xc45a('0x14f'),'foreignKey':_0xc45a('0x150')});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':_0xc45a('0x127'),'through':_0xc45a('0x151')});db[_0xc45a('0x146')][_0xc45a('0x121')](db[_0xc45a('0x14')],{'as':_0xc45a('0x152'),'through':_0xc45a('0x30')});db[_0xc45a('0x146')][_0xc45a('0x121')](db[_0xc45a('0xd8')],{'as':_0xc45a('0x153'),'through':_0xc45a('0x154')});db[_0xc45a('0x146')]['belongsToMany'](db[_0xc45a('0xea')],{'as':_0xc45a('0x155'),'through':_0xc45a('0x156')});db[_0xc45a('0x10e')]['belongsTo'](db[_0xc45a('0x14')],{'as':_0xc45a('0x14'),'foreignKey':_0xc45a('0x10a')});db['ScreenRecording'][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'as':'User','foreignKey':'UserId'});db[_0xc45a('0x109')]['hasMany'](db['VoiceMailMessage'],{'as':_0xc45a('0x157'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x158'),'sourceKey':'mailbox'});db['VoiceMailMessage']['belongsTo'](db['VoiceMail'],{'foreignKey':_0xc45a('0x158'),'targetKey':_0xc45a('0x159')});db[_0xc45a('0x25')][_0xc45a('0x10d')](db['VoiceQueueReport'],{'as':_0xc45a('0x15a'),'foreignKey':_0xc45a('0x15b'),'constraints':![]});db['VoiceCallReport']['hasMany'](db['VoiceAgentReport'],{'as':_0xc45a('0x15c'),'foreignKey':'uniqueid','constraints':![]});db[_0xc45a('0x25')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'as':_0xc45a('0x14'),'foreignKey':_0xc45a('0x10a')});db[_0xc45a('0x25')][_0xc45a('0x11f')](db[_0xc45a('0x6b')],{'as':_0xc45a('0x15d'),'foreignKey':_0xc45a('0x15e')});db['MailServerIn'][_0xc45a('0x11f')](db[_0xc45a('0x15f')],{'as':_0xc45a('0x15f'),'foreignKey':_0xc45a('0x160')});db[_0xc45a('0x3c')][_0xc45a('0x11f')](db[_0xc45a('0x102')],{'as':_0xc45a('0x102'),'foreignKey':_0xc45a('0x161'),'onDelete':_0xc45a('0x162')});db[_0xc45a('0x3d')][_0xc45a('0x11f')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xc45a('0x160')});db[_0xc45a('0x3d')][_0xc45a('0x11f')](db[_0xc45a('0x102')],{'as':_0xc45a('0x102'),'foreignKey':_0xc45a('0x161'),'onDelete':_0xc45a('0x162')});db[_0xc45a('0x15f')][_0xc45a('0x108')](db['MailServerIn'],{'as':_0xc45a('0x163'),'onDelete':_0xc45a('0x10c')});db[_0xc45a('0x15f')][_0xc45a('0x108')](db[_0xc45a('0x3d')],{'as':_0xc45a('0x164'),'onDelete':_0xc45a('0x10c')});db[_0xc45a('0x15f')]['hasMany'](db[_0xc45a('0x79')],{'as':_0xc45a('0x165'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0xc45a('0x15f')][_0xc45a('0x10d')](db[_0xc45a('0x78')],{'as':_0xc45a('0x166'),'foreignKey':_0xc45a('0x160')});db[_0xc45a('0x15f')][_0xc45a('0x10d')](db['MailMessage'],{'as':_0xc45a('0x157'),'foreignKey':_0xc45a('0x160')});db['MailAccount'][_0xc45a('0x10d')](db['MailInteraction'],{'as':_0xc45a('0x167')});db[_0xc45a('0x15f')][_0xc45a('0x10d')](db['MailApplication'],{'as':_0xc45a('0x142')});db['MailAccount'][_0xc45a('0x11f')](db[_0xc45a('0xea')],{'as':_0xc45a('0x168'),'foreignKey':_0xc45a('0x169')});db[_0xc45a('0x15f')][_0xc45a('0x11f')](db[_0xc45a('0x16a')],{'as':_0xc45a('0x16a'),'foreignKey':_0xc45a('0x16b')});db['MailAccount']['belongsTo'](db[_0xc45a('0x7e')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xc45a('0x15f')][_0xc45a('0x121')](db[_0xc45a('0x14')],{'as':_0xc45a('0x152'),'through':_0xc45a('0x13b')});db['MailQueue'][_0xc45a('0x121')](db[_0xc45a('0x14')],{'as':_0xc45a('0x152'),'through':_0xc45a('0x16c')});db[_0xc45a('0x12e')][_0xc45a('0x121')](db[_0xc45a('0xd8')],{'through':_0xc45a('0x16d'),'as':_0xc45a('0x153')});db[_0xc45a('0x43')][_0xc45a('0x10d')](db['MailMessage'],{'as':_0xc45a('0x157'),'onDelete':'cascade','foreignKey':_0xc45a('0x16e')});db[_0xc45a('0x43')][_0xc45a('0x11f')](db['MailAccount'],{'as':_0xc45a('0x16f'),'foreignKey':'MailAccountId'});db[_0xc45a('0x43')][_0xc45a('0x11f')](db[_0xc45a('0x6b')],{'as':_0xc45a('0x15d'),'foreignKey':'ContactId'});db[_0xc45a('0x43')]['belongsTo'](db[_0xc45a('0x14')],{'as':_0xc45a('0x170'),'foreignKey':_0xc45a('0x10a')});db[_0xc45a('0x43')][_0xc45a('0x121')](db[_0xc45a('0x86')],{'through':_0xc45a('0x171'),'as':_0xc45a('0x172')});db[_0xc45a('0x43')]['belongsToMany'](db[_0xc45a('0x86')],{'through':_0xc45a('0x171'),'as':_0xc45a('0x173')});db['MailInteraction'][_0xc45a('0x121')](db['User'],{'as':'Users','through':_0xc45a('0x174'),'foreignKey':'MailInteractionId'});db[_0xc45a('0x44')]['hasMany'](db[_0xc45a('0x175')],{'as':'Attachments','onDelete':_0xc45a('0x10c')});db[_0xc45a('0x44')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'as':_0xc45a('0x14')});db[_0xc45a('0x44')][_0xc45a('0x11f')](db[_0xc45a('0x6b')],{'onDelete':'cascade','as':_0xc45a('0x15d')});db['MailMessage'][_0xc45a('0x11f')](db[_0xc45a('0x43')],{'as':'Interaction','foreignKey':_0xc45a('0x16e')});db['MailMessage']['belongsTo'](db[_0xc45a('0x15f')],{'as':_0xc45a('0x16f'),'foreignKey':_0xc45a('0x160')});db[_0xc45a('0x44')][_0xc45a('0x11f')](db[_0xc45a('0x60')],{'as':_0xc45a('0x60'),'foreignKey':_0xc45a('0x176')});db[_0xc45a('0x44')][_0xc45a('0x11f')](db['ChatOfflineMessage'],{'as':_0xc45a('0x67'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'onDelete':_0xc45a('0x162')});db['MailApplication'][_0xc45a('0x11f')](db['MailQueue'],{'onDelete':_0xc45a('0x162')});db[_0xc45a('0x46')][_0xc45a('0x11f')](db[_0xc45a('0x15f')],{'onDelete':_0xc45a('0x162')});db[_0xc45a('0x46')][_0xc45a('0x11f')](db[_0xc45a('0x7c')],{'onDelete':_0xc45a('0x162'),'foreignKey':_0xc45a('0x177')});db['MailApplication']['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0xc45a('0x178')});db[_0xc45a('0x48')][_0xc45a('0x11f')](db[_0xc45a('0x15f')],{});db[_0xc45a('0x48')][_0xc45a('0x11f')](db[_0xc45a('0xea')],{'as':_0xc45a('0x168'),'foreignKey':'ListId'});db[_0xc45a('0x48')]['belongsTo'](db[_0xc45a('0x6b')],{'as':'Contact','foreignKey':_0xc45a('0x15e')});db['MailQueueReport'][_0xc45a('0x11f')](db['MailInteraction'],{});db[_0xc45a('0x48')][_0xc45a('0x11f')](db[_0xc45a('0x44')],{});db[_0xc45a('0x48')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{});db[_0xc45a('0x48')][_0xc45a('0x11f')](db[_0xc45a('0x12e')],{});db['Dashboard']['hasMany'](db[_0xc45a('0x179')],{'as':'Items','onDelete':_0xc45a('0x10c')});db[_0xc45a('0x137')][_0xc45a('0x10d')](db['Disposition'],{'as':_0xc45a('0x165'),'foreignKey':_0xc45a('0x17a'),'onDelete':'cascade'});db[_0xc45a('0x137')][_0xc45a('0x10d')](db[_0xc45a('0x78')],{'as':_0xc45a('0x166'),'foreignKey':_0xc45a('0x17a')});db[_0xc45a('0x137')]['hasMany'](db[_0xc45a('0x118')],{'as':_0xc45a('0x167')});db[_0xc45a('0x137')][_0xc45a('0x10d')](db[_0xc45a('0x4c')],{'as':_0xc45a('0x142')});db['FaxAccount'][_0xc45a('0x10d')](db[_0xc45a('0x1a')],{'as':'Exntensions','onDelete':_0xc45a('0x10c')});db[_0xc45a('0x137')]['hasMany'](db['FaxMessage'],{'as':_0xc45a('0x157')});db['FaxAccount'][_0xc45a('0x11f')](db[_0xc45a('0x2c')],{'as':_0xc45a('0x2c')});db[_0xc45a('0x137')][_0xc45a('0x11f')](db[_0xc45a('0xea')],{'as':_0xc45a('0x168'),'foreignKey':_0xc45a('0x169')});db['FaxAccount'][_0xc45a('0x11f')](db[_0xc45a('0x7e')],{'as':_0xc45a('0x14f'),'foreignKey':_0xc45a('0x150')});db[_0xc45a('0x137')][_0xc45a('0x121')](db[_0xc45a('0x14')],{'as':_0xc45a('0x152'),'through':_0xc45a('0x139')});db[_0xc45a('0x4c')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'onDelete':'restrict'});db[_0xc45a('0x4c')]['belongsTo'](db[_0xc45a('0x50')],{'onDelete':_0xc45a('0x162')});db['FaxApplication'][_0xc45a('0x11f')](db[_0xc45a('0x137')],{'onDelete':_0xc45a('0x162')});db[_0xc45a('0x4c')][_0xc45a('0x11f')](db[_0xc45a('0x86')],{'onDelete':'restrict','foreignKey':_0xc45a('0x178')});db[_0xc45a('0x118')][_0xc45a('0x10d')](db[_0xc45a('0x4f')],{'as':_0xc45a('0x157'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db[_0xc45a('0x118')][_0xc45a('0x11f')](db[_0xc45a('0x137')],{'as':'Account','foreignKey':_0xc45a('0x17a')});db[_0xc45a('0x118')]['belongsTo'](db[_0xc45a('0x6b')],{'as':_0xc45a('0x15d'),'foreignKey':_0xc45a('0x15e')});db[_0xc45a('0x118')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'as':_0xc45a('0x170'),'foreignKey':_0xc45a('0x10a')});db[_0xc45a('0x118')]['belongsToMany'](db['Tag'],{'through':_0xc45a('0x17b'),'as':_0xc45a('0x172')});db[_0xc45a('0x118')][_0xc45a('0x121')](db[_0xc45a('0x86')],{'through':_0xc45a('0x17b'),'as':_0xc45a('0x173')});db[_0xc45a('0x118')][_0xc45a('0x121')](db[_0xc45a('0x14')],{'as':_0xc45a('0x17c'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0xc45a('0x4f')]['belongsTo'](db[_0xc45a('0x14')],{'onDelete':_0xc45a('0x10c'),'as':_0xc45a('0x14')});db[_0xc45a('0x4f')][_0xc45a('0x11f')](db[_0xc45a('0x118')],{'as':'Interaction','foreignKey':_0xc45a('0x17d')});db[_0xc45a('0x4f')][_0xc45a('0x11f')](db['CmContact'],{'onDelete':_0xc45a('0x10c'),'as':_0xc45a('0x15d')});db[_0xc45a('0x4f')][_0xc45a('0x11f')](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xc45a('0x4f')][_0xc45a('0x11f')](db['FaxAccount'],{'as':_0xc45a('0x16f'),'foreignKey':_0xc45a('0x17a')});db['FaxQueue'][_0xc45a('0x121')](db[_0xc45a('0x14')],{'as':_0xc45a('0x152'),'through':'UserFaxQueue'});db['FaxQueue'][_0xc45a('0x121')](db[_0xc45a('0xd8')],{'through':_0xc45a('0x17e'),'as':_0xc45a('0x153')});db[_0xc45a('0x52')][_0xc45a('0x11f')](db['FaxAccount'],{});db[_0xc45a('0x52')][_0xc45a('0x11f')](db[_0xc45a('0xea')],{'as':_0xc45a('0x168'),'foreignKey':_0xc45a('0x169')});db[_0xc45a('0x52')][_0xc45a('0x11f')](db['CmContact'],{'as':_0xc45a('0x15d'),'foreignKey':_0xc45a('0x15e')});db[_0xc45a('0x52')]['belongsTo'](db[_0xc45a('0x118')],{});db[_0xc45a('0x52')]['belongsTo'](db[_0xc45a('0x4f')],{});db['FaxQueueReport']['belongsTo'](db[_0xc45a('0x14')],{});db['FaxQueueReport'][_0xc45a('0x11f')](db[_0xc45a('0x50')],{});db[_0xc45a('0x54')][_0xc45a('0x10d')](db[_0xc45a('0x79')],{'as':_0xc45a('0x165'),'foreignKey':_0xc45a('0x17f'),'onDelete':_0xc45a('0x10c')});db['SmsAccount'][_0xc45a('0x10d')](db[_0xc45a('0x78')],{'as':_0xc45a('0x166'),'foreignKey':_0xc45a('0x17f')});db[_0xc45a('0x54')][_0xc45a('0x10d')](db['SmsMessage'],{'as':_0xc45a('0x157'),'foreignKey':_0xc45a('0x17f')});db[_0xc45a('0x54')]['hasMany'](db['SmsInteraction'],{'as':'Interactions'});db[_0xc45a('0x54')][_0xc45a('0x10d')](db[_0xc45a('0x55')],{'as':_0xc45a('0x142')});db['SmsAccount']['belongsTo'](db['CmList'],{'as':_0xc45a('0x168'),'foreignKey':_0xc45a('0x169')});db[_0xc45a('0x54')]['belongsTo'](db['Pause'],{'as':_0xc45a('0x14f'),'foreignKey':_0xc45a('0x150')});db[_0xc45a('0x54')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xc45a('0x13d')});db['SmsApplication'][_0xc45a('0x11f')](db['User'],{'onDelete':'restrict'});db[_0xc45a('0x55')][_0xc45a('0x11f')](db['SmsQueue'],{'onDelete':_0xc45a('0x162')});db['SmsApplication'][_0xc45a('0x11f')](db[_0xc45a('0x54')],{'onDelete':'restrict'});db[_0xc45a('0x55')][_0xc45a('0x11f')](db[_0xc45a('0x7c')],{'onDelete':_0xc45a('0x162'),'foreignKey':_0xc45a('0x177')});db[_0xc45a('0x55')][_0xc45a('0x11f')](db[_0xc45a('0x86')],{'onDelete':_0xc45a('0x162'),'foreignKey':_0xc45a('0x178')});db[_0xc45a('0x57')][_0xc45a('0x10d')](db['SmsMessage'],{'as':_0xc45a('0x157'),'onDelete':_0xc45a('0x10c'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0xc45a('0x11f')](db[_0xc45a('0x54')],{'as':'Account','foreignKey':_0xc45a('0x17f')});db['SmsInteraction'][_0xc45a('0x11f')](db[_0xc45a('0x6b')],{'as':_0xc45a('0x15d'),'foreignKey':'ContactId'});db['SmsInteraction'][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'as':'Owner','foreignKey':_0xc45a('0x10a')});db['SmsInteraction'][_0xc45a('0x121')](db[_0xc45a('0x86')],{'through':_0xc45a('0x180'),'as':_0xc45a('0x172')});db[_0xc45a('0x57')][_0xc45a('0x121')](db[_0xc45a('0x86')],{'through':'sms_interaction_has_tags','as':_0xc45a('0x173')});db[_0xc45a('0x57')][_0xc45a('0x121')](db[_0xc45a('0x14')],{'as':_0xc45a('0x17c'),'through':'user_has_sms_interactions','foreignKey':_0xc45a('0x181')});db[_0xc45a('0x182')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'as':_0xc45a('0x14')});db['SmsMessage'][_0xc45a('0x11f')](db[_0xc45a('0x6b')],{'onDelete':_0xc45a('0x10c'),'as':_0xc45a('0x15d')});db['SmsMessage']['belongsTo'](db['SmsInteraction'],{'onDelete':_0xc45a('0x10c'),'as':_0xc45a('0x183'),'foreignKey':_0xc45a('0x181')});db['SmsMessage'][_0xc45a('0x11f')](db[_0xc45a('0x54')],{'as':_0xc45a('0x16f'),'foreignKey':_0xc45a('0x17f')});db[_0xc45a('0x59')][_0xc45a('0x121')](db[_0xc45a('0x14')],{'as':_0xc45a('0x152'),'through':_0xc45a('0x36'),'foreignKey':_0xc45a('0x184')});db[_0xc45a('0x59')][_0xc45a('0x121')](db[_0xc45a('0xd8')],{'through':_0xc45a('0x185'),'as':_0xc45a('0x153')});db[_0xc45a('0x186')][_0xc45a('0x10d')](db[_0xc45a('0x79')],{'as':_0xc45a('0x165'),'foreignKey':_0xc45a('0x187'),'onDelete':_0xc45a('0x10c')});db[_0xc45a('0x186')][_0xc45a('0x10d')](db[_0xc45a('0x78')],{'as':_0xc45a('0x166'),'foreignKey':'OpenchannelAccountId'});db[_0xc45a('0x186')]['hasMany'](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':_0xc45a('0x187')});db[_0xc45a('0x186')]['hasMany'](db[_0xc45a('0x188')],{'as':_0xc45a('0x157'),'foreignKey':_0xc45a('0x187')});db[_0xc45a('0x186')]['hasMany'](db[_0xc45a('0x5c')],{'as':_0xc45a('0x142'),'foreignKey':_0xc45a('0x187')});db['OpenchannelAccount'][_0xc45a('0x11f')](db[_0xc45a('0xea')],{'as':_0xc45a('0x168'),'foreignKey':_0xc45a('0x169')});db['OpenchannelAccount'][_0xc45a('0x11f')](db[_0xc45a('0x7e')],{'as':_0xc45a('0x14f'),'foreignKey':_0xc45a('0x150')});db[_0xc45a('0x186')][_0xc45a('0x121')](db[_0xc45a('0x14')],{'as':_0xc45a('0x152'),'through':_0xc45a('0x189')});db[_0xc45a('0x5c')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'onDelete':_0xc45a('0x162')});db['OpenchannelApplication'][_0xc45a('0x11f')](db[_0xc45a('0x18a')],{'onDelete':_0xc45a('0x162'),'foreignKey':_0xc45a('0x18b')});db[_0xc45a('0x5c')][_0xc45a('0x11f')](db[_0xc45a('0x186')],{'onDelete':_0xc45a('0x162'),'foreignKey':'OpenchannelAccountId'});db[_0xc45a('0x5c')][_0xc45a('0x11f')](db[_0xc45a('0x7c')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xc45a('0x5c')]['belongsTo'](db[_0xc45a('0x86')],{'onDelete':_0xc45a('0x162'),'foreignKey':_0xc45a('0x178')});db[_0xc45a('0x115')][_0xc45a('0x10d')](db['OpenchannelMessage'],{'as':_0xc45a('0x157'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x18c')});db[_0xc45a('0x115')]['belongsTo'](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0xc45a('0x187')});db[_0xc45a('0x115')][_0xc45a('0x11f')](db[_0xc45a('0x6b')],{'as':_0xc45a('0x15d'),'foreignKey':_0xc45a('0x15e')});db[_0xc45a('0x115')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'as':_0xc45a('0x170'),'foreignKey':_0xc45a('0x10a')});db[_0xc45a('0x115')][_0xc45a('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':'Tags'});db[_0xc45a('0x115')][_0xc45a('0x121')](db[_0xc45a('0x86')],{'through':_0xc45a('0x18d'),'as':_0xc45a('0x173')});db['OpenchannelInteraction'][_0xc45a('0x121')](db[_0xc45a('0x14')],{'as':_0xc45a('0x17c'),'through':_0xc45a('0x18e'),'foreignKey':_0xc45a('0x18c')});db[_0xc45a('0x188')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'onDelete':_0xc45a('0x10c'),'as':_0xc45a('0x14')});db[_0xc45a('0x188')][_0xc45a('0x11f')](db[_0xc45a('0x6b')],{'onDelete':_0xc45a('0x10c'),'as':_0xc45a('0x15d')});db[_0xc45a('0x188')][_0xc45a('0x11f')](db[_0xc45a('0x115')],{'onDelete':'cascade','as':_0xc45a('0x183'),'foreignKey':_0xc45a('0x18c')});db[_0xc45a('0x188')][_0xc45a('0x11f')](db[_0xc45a('0x175')],{'as':_0xc45a('0x175'),'foreignKey':_0xc45a('0x18f')});db[_0xc45a('0x188')]['belongsTo'](db[_0xc45a('0x186')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue']['belongsToMany'](db[_0xc45a('0x14')],{'as':_0xc45a('0x152'),'through':_0xc45a('0x38'),'foreignKey':_0xc45a('0x18b')});db[_0xc45a('0x18a')][_0xc45a('0x121')](db[_0xc45a('0xd8')],{'through':_0xc45a('0x190'),'as':_0xc45a('0x153')});db['ChatWebsite'][_0xc45a('0x10d')](db[_0xc45a('0x79')],{'as':'Dispositions','foreignKey':_0xc45a('0x176'),'onDelete':_0xc45a('0x10c')});db['ChatWebsite'][_0xc45a('0x10d')](db['CannedAnswer'],{'as':_0xc45a('0x166'),'foreignKey':'ChatWebsiteId'});db[_0xc45a('0x60')][_0xc45a('0x10d')](db[_0xc45a('0x191')],{'as':'ProactiveActions'});db[_0xc45a('0x60')][_0xc45a('0x10d')](db[_0xc45a('0x117')],{'as':'Interactions'});db['ChatWebsite'][_0xc45a('0x10d')](db[_0xc45a('0x192')],{'as':'Applications'});db['ChatWebsite'][_0xc45a('0x10d')](db[_0xc45a('0x65')],{'as':'Messages'});db[_0xc45a('0x60')]['belongsTo'](db[_0xc45a('0xea')],{'as':_0xc45a('0x168'),'foreignKey':_0xc45a('0x169')});db['ChatWebsite'][_0xc45a('0x11f')](db['Interval'],{'as':_0xc45a('0x7c'),'foreignKey':'IntervalId'});db[_0xc45a('0x60')][_0xc45a('0x11f')](db[_0xc45a('0x15f')],{'as':_0xc45a('0x15f'),'foreignKey':'MailAccountId'});db[_0xc45a('0x60')][_0xc45a('0x11f')](db[_0xc45a('0x7e')],{'as':'mandatoryDispositionPause','foreignKey':_0xc45a('0x150')});db[_0xc45a('0x60')][_0xc45a('0x121')](db['User'],{'as':_0xc45a('0x152'),'through':'user_has_chat_websites'});db[_0xc45a('0x193')][_0xc45a('0x11f')](db[_0xc45a('0x186')],{});db['OpenchannelQueueReport'][_0xc45a('0x11f')](db[_0xc45a('0xea')],{'as':_0xc45a('0x168'),'foreignKey':'ListId'});db[_0xc45a('0x193')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xc45a('0x15e')});db['OpenchannelQueueReport'][_0xc45a('0x11f')](db[_0xc45a('0x115')],{});db[_0xc45a('0x193')][_0xc45a('0x11f')](db['OpenchannelMessage'],{});db[_0xc45a('0x193')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{});db['OpenchannelQueueReport'][_0xc45a('0x11f')](db['OpenchannelQueue'],{});db[_0xc45a('0x192')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'as':_0xc45a('0x194'),'foreignKey':'UserId','onDelete':_0xc45a('0x162')});db[_0xc45a('0x192')]['belongsTo'](db[_0xc45a('0x68')],{'as':_0xc45a('0x195'),'foreignKey':_0xc45a('0x196'),'onDelete':_0xc45a('0x162')});db[_0xc45a('0x192')][_0xc45a('0x11f')](db[_0xc45a('0x60')],{'as':_0xc45a('0x197'),'foreignKey':'ChatWebsiteId','onDelete':_0xc45a('0x162')});db[_0xc45a('0x192')][_0xc45a('0x11f')](db[_0xc45a('0x86')],{'onDelete':'restrict','foreignKey':_0xc45a('0x178')});db[_0xc45a('0x117')][_0xc45a('0x10d')](db[_0xc45a('0x65')],{'as':_0xc45a('0x157'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x198')});db[_0xc45a('0x117')][_0xc45a('0x11f')](db[_0xc45a('0x60')],{'as':_0xc45a('0x16f'),'foreignKey':_0xc45a('0x176')});db['ChatInteraction']['belongsTo'](db[_0xc45a('0x6b')],{'as':'Contact','foreignKey':_0xc45a('0x15e')});db[_0xc45a('0x117')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'as':'Owner','foreignKey':'UserId'});db[_0xc45a('0x117')]['belongsToMany'](db[_0xc45a('0x86')],{'through':_0xc45a('0x199'),'as':_0xc45a('0x172')});db[_0xc45a('0x117')]['belongsToMany'](db[_0xc45a('0x86')],{'through':_0xc45a('0x199'),'as':_0xc45a('0x173')});db[_0xc45a('0x117')][_0xc45a('0x121')](db[_0xc45a('0x14')],{'as':_0xc45a('0x17c'),'through':_0xc45a('0x12b'),'foreignKey':'ChatInteractionId'});db[_0xc45a('0x65')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'onDelete':'cascade','as':_0xc45a('0x14')});db[_0xc45a('0x65')][_0xc45a('0x11f')](db['CmContact'],{'onDelete':_0xc45a('0x10c'),'as':'Contact','foreignKey':_0xc45a('0x15e')});db[_0xc45a('0x65')][_0xc45a('0x11f')](db[_0xc45a('0x117')],{'onDelete':_0xc45a('0x10c'),'as':'Interaction','foreignKey':_0xc45a('0x198')});db[_0xc45a('0x65')]['belongsTo'](db[_0xc45a('0x175')],{'as':_0xc45a('0x175'),'foreignKey':_0xc45a('0x18f')});db[_0xc45a('0x65')][_0xc45a('0x11f')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xc45a('0x176')});db[_0xc45a('0x67')][_0xc45a('0x10d')](db[_0xc45a('0x175')],{'as':'Attachments','foreignKey':_0xc45a('0x19a'),'onDelete':'cascade','hooks':!![]});db[_0xc45a('0x67')]['belongsTo'](db[_0xc45a('0x6b')],{'onDelete':'cascade','as':_0xc45a('0x15d'),'foreignKey':_0xc45a('0x15e')});db['ChatOfflineMessage']['belongsTo'](db['ChatWebsite'],{'as':_0xc45a('0x16f'),'foreignKey':_0xc45a('0x176')});db[_0xc45a('0x68')][_0xc45a('0x121')](db[_0xc45a('0x14')],{'as':_0xc45a('0x152'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0xc45a('0x121')](db[_0xc45a('0xd8')],{'through':'team_has_chat_queues','as':_0xc45a('0x153')});db[_0xc45a('0x122')]['hasMany'](db['ChatInternalMessage'],{'as':_0xc45a('0x157'),'foreignKey':_0xc45a('0x19b'),'onDelete':'cascade'});db[_0xc45a('0x122')][_0xc45a('0x121')](db[_0xc45a('0x14')],{'as':_0xc45a('0x147'),'through':_0xc45a('0x124')});db[_0xc45a('0x191')][_0xc45a('0x11f')](db[_0xc45a('0x60')],{'as':'Website','foreignKey':_0xc45a('0x176')});db[_0xc45a('0x6a')][_0xc45a('0x10d')](db[_0xc45a('0x6b')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0xc45a('0x6b')][_0xc45a('0x10d')](db[_0xc45a('0x6c')],{'as':_0xc45a('0x149'),'foreignKey':_0xc45a('0x15e')});db[_0xc45a('0x6b')][_0xc45a('0x10d')](db[_0xc45a('0x6f')],{'as':_0xc45a('0x112'),'foreignKey':_0xc45a('0x15e')});db[_0xc45a('0x6b')][_0xc45a('0x10d')](db['CmHopperHistory'],{'as':_0xc45a('0x14a'),'foreignKey':'ContactId'});db[_0xc45a('0x6b')][_0xc45a('0x10d')](db[_0xc45a('0x70')],{'as':_0xc45a('0x70'),'foreignKey':_0xc45a('0x15e')});db[_0xc45a('0x6b')]['hasMany'](db[_0xc45a('0xc7')],{'as':_0xc45a('0x14c'),'foreignKey':_0xc45a('0x15e')});db[_0xc45a('0x6b')]['hasMany'](db[_0xc45a('0x115')],{'as':'OpenchannelInteractions','foreignKey':_0xc45a('0x15e'),'onDelete':_0xc45a('0x162')});db[_0xc45a('0x6b')]['hasMany'](db['ChatInteraction'],{'as':_0xc45a('0x12a'),'foreignKey':_0xc45a('0x15e'),'onDelete':_0xc45a('0x162')});db[_0xc45a('0x6b')][_0xc45a('0x10d')](db[_0xc45a('0x57')],{'as':_0xc45a('0x19c'),'foreignKey':_0xc45a('0x15e'),'onDelete':_0xc45a('0x162')});db['CmContact'][_0xc45a('0x10d')](db[_0xc45a('0x118')],{'as':_0xc45a('0x119'),'foreignKey':_0xc45a('0x15e'),'onDelete':'restrict'});db[_0xc45a('0x6b')][_0xc45a('0x10d')](db[_0xc45a('0x43')],{'as':_0xc45a('0x11a'),'foreignKey':_0xc45a('0x15e'),'onDelete':_0xc45a('0x162')});db['CmContact'][_0xc45a('0x11f')](db[_0xc45a('0x6a')],{'as':_0xc45a('0x19d'),'foreignKey':'CompanyId'});db[_0xc45a('0x6b')]['belongsTo'](db[_0xc45a('0xea')],{'as':'List','foreignKey':_0xc45a('0x169'),'onDelete':_0xc45a('0x10c')});db[_0xc45a('0x6b')][_0xc45a('0x121')](db['User'],{'as':'Users','through':'cm_user_has_contacts'});db[_0xc45a('0x6b')][_0xc45a('0x121')](db[_0xc45a('0x86')],{'as':_0xc45a('0x172'),'through':'cm_contact_has_tags'});db[_0xc45a('0x6b')][_0xc45a('0x121')](db[_0xc45a('0x86')],{'through':'cm_contact_has_tags','as':_0xc45a('0x173')});db[_0xc45a('0x6c')][_0xc45a('0x11f')](db[_0xc45a('0x6b')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xc45a('0x10c')});db[_0xc45a('0x6c')][_0xc45a('0x11f')](db[_0xc45a('0xea')],{'as':_0xc45a('0x168'),'foreignKey':'ListId','onDelete':_0xc45a('0x10c')});db[_0xc45a('0x6c')][_0xc45a('0x11f')](db['User'],{'as':'Agent','foreignKey':_0xc45a('0x10a')});db[_0xc45a('0x6c')][_0xc45a('0x11f')](db['VoiceQueue'],{'as':_0xc45a('0x195'),'foreignKey':'VoiceQueueId','onDelete':_0xc45a('0x10c')});db[_0xc45a('0x6c')][_0xc45a('0x11f')](db[_0xc45a('0xdb')],{'as':'Campaign','foreignKey':_0xc45a('0x19e'),'onDelete':_0xc45a('0x10c')});db[_0xc45a('0x6c')]['belongsTo'](db[_0xc45a('0x14')],{'as':_0xc45a('0x170'),'foreignKey':_0xc45a('0x19f')});db[_0xc45a('0x1a0')]['belongsTo'](db[_0xc45a('0x6b')],{'as':_0xc45a('0x15d'),'foreignKey':'ContactId','onDelete':_0xc45a('0x10c')});db['CmHopperBlack'][_0xc45a('0x11f')](db[_0xc45a('0xea')],{'as':_0xc45a('0x168'),'foreignKey':_0xc45a('0x169'),'onDelete':_0xc45a('0x10c')});db['CmHopperBlack'][_0xc45a('0x11f')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0xc45a('0x148'),'onDelete':'cascade'});db[_0xc45a('0x1a0')][_0xc45a('0x11f')](db[_0xc45a('0xdb')],{'as':_0xc45a('0xdb'),'foreignKey':_0xc45a('0x19e'),'onDelete':_0xc45a('0x10c')});db[_0xc45a('0x76')][_0xc45a('0x10d')](db['Condition'],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0xc45a('0x1a1'),'onDelete':_0xc45a('0x10c'),'hooks':!![]});db['Automation'][_0xc45a('0x10d')](db[_0xc45a('0x1a2')],{'as':{'plural':_0xc45a('0x1a3'),'singular':_0xc45a('0x1a4')},'foreignKey':_0xc45a('0x1a5'),'onDelete':_0xc45a('0x10c'),'hooks':!![]});db[_0xc45a('0x76')]['hasMany'](db['Action'],{'as':_0xc45a('0x1a6'),'foreignKey':_0xc45a('0x1a7'),'onDelete':_0xc45a('0x10c'),'hooks':!![]});db[_0xc45a('0x79')][_0xc45a('0x10d')](db[_0xc45a('0x79')],{'as':_0xc45a('0x165'),'foreignKey':_0xc45a('0x1a8'),'onDelete':_0xc45a('0x10c')});db['Interval'][_0xc45a('0x10d')](db[_0xc45a('0x7c')],{'as':_0xc45a('0x1a9'),'foreignKey':_0xc45a('0x177'),'onDelete':_0xc45a('0x10c'),'hooks':!![],'required':![]});db['Interval'][_0xc45a('0x10d')](db[_0xc45a('0x1a')],{'as':'Extensions','foreignKey':_0xc45a('0x177'),'onDelete':_0xc45a('0x162')});db[_0xc45a('0x7c')][_0xc45a('0x10d')](db['MailApplication'],{'as':_0xc45a('0x1aa'),'foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0xc45a('0x192')],{'as':_0xc45a('0x1ab'),'foreignKey':_0xc45a('0x177')});db[_0xc45a('0x7c')]['hasMany'](db[_0xc45a('0x4c')],{'as':_0xc45a('0x1ac'),'foreignKey':'IntervalId'});db['Interval'][_0xc45a('0x10d')](db[_0xc45a('0x55')],{'as':'SmsApplications','foreignKey':_0xc45a('0x177')});db[_0xc45a('0x83')]['belongsTo'](db[_0xc45a('0x15f')],{});db[_0xc45a('0x83')][_0xc45a('0x11f')](db[_0xc45a('0x8e')],{'foreignKey':_0xc45a('0x1ad')});db[_0xc45a('0x83')][_0xc45a('0x11f')](db['AnalyticCustomReport'],{'foreignKey':_0xc45a('0x1ae')});db[_0xc45a('0x143')][_0xc45a('0x121')](db[_0xc45a('0x1c')],{'as':'Mohs','through':_0xc45a('0x145'),'onDelete':_0xc45a('0x162')});db[_0xc45a('0x86')][_0xc45a('0x121')](db[_0xc45a('0x6b')],{'through':_0xc45a('0x1af')});db[_0xc45a('0x86')][_0xc45a('0x121')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0xc45a('0x86')]['belongsToMany'](db[_0xc45a('0x43')],{'through':'mail_interaction_has_tags'});db[_0xc45a('0x86')][_0xc45a('0x121')](db[_0xc45a('0x57')],{'through':'sms_interaction_has_tags'});db[_0xc45a('0x86')][_0xc45a('0x121')](db[_0xc45a('0x118')],{'through':'fax_interaction_has_tags'});db[_0xc45a('0x86')][_0xc45a('0x121')](db[_0xc45a('0x115')],{'through':_0xc45a('0x18d')});db[_0xc45a('0x86')][_0xc45a('0x121')](db[_0xc45a('0xf8')],{'through':'whatsapp_interaction_has_tags'});db[_0xc45a('0x1b0')]['hasMany'](db[_0xc45a('0x1a2')],{'as':{'plural':_0xc45a('0x1b1'),'singular':'AllCondition'},'foreignKey':_0xc45a('0x1b2'),'onDelete':'cascade','hooks':!![]});db[_0xc45a('0x1b0')][_0xc45a('0x10d')](db['Condition'],{'as':{'plural':_0xc45a('0x1b3'),'singular':_0xc45a('0x1b4')},'foreignKey':_0xc45a('0x1b5'),'onDelete':_0xc45a('0x10c'),'hooks':!![]});db[_0xc45a('0x1b0')][_0xc45a('0x10d')](db[_0xc45a('0x74')],{'as':_0xc45a('0x1a6'),'foreignKey':'TriggerId','onDelete':_0xc45a('0x10c'),'hooks':!![]});db['AnalyticCustomReport'][_0xc45a('0x10d')](db[_0xc45a('0x1b6')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xc45a('0x1ae'),'hooks':!![]});db[_0xc45a('0x8e')][_0xc45a('0x10d')](db[_0xc45a('0x1b6')],{'as':_0xc45a('0x1b7'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1ad')});db[_0xc45a('0x1b8')][_0xc45a('0x10d')](db[_0xc45a('0x1b6')],{'as':_0xc45a('0x1b7'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1b9')});db[_0xc45a('0x1b6')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0xc45a('0x1b9')});db[_0xc45a('0x95')][_0xc45a('0x10d')](db[_0xc45a('0x1ba')],{'as':_0xc45a('0x1bb'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1bc')});db[_0xc45a('0x1ba')][_0xc45a('0x10d')](db[_0xc45a('0x1bd')],{'as':_0xc45a('0x1be'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1bf')});db['SalesforceConfiguration'][_0xc45a('0x10d')](db[_0xc45a('0x1bd')],{'as':_0xc45a('0x1c0'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1c1')});db['SalesforceConfiguration'][_0xc45a('0x10d')](db[_0xc45a('0x1bd')],{'as':_0xc45a('0x1b7'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1c2')});db[_0xc45a('0x1ba')]['belongsTo'](db[_0xc45a('0x95')],{'as':_0xc45a('0x16f'),'foreignKey':_0xc45a('0x1bc')});db[_0xc45a('0x1bd')][_0xc45a('0x10d')](db['SalesforceField'],{'as':_0xc45a('0x1c3'),'foreignKey':_0xc45a('0x1bf')});db[_0xc45a('0x1bd')][_0xc45a('0x10d')](db['SalesforceField'],{'as':_0xc45a('0x1c4'),'foreignKey':'DescriptionId'});db[_0xc45a('0x1bd')]['hasMany'](db[_0xc45a('0x1bd')],{'as':'Field','foreignKey':'FieldId'});db['SalesforceField'][_0xc45a('0x11f')](db[_0xc45a('0x87')],{'as':_0xc45a('0x87'),'foreignKey':_0xc45a('0x1c5')});db[_0xc45a('0x99')][_0xc45a('0x10d')](db[_0xc45a('0x1c6')],{'as':_0xc45a('0x1bb'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1bc')});db[_0xc45a('0x1c6')][_0xc45a('0x10d')](db[_0xc45a('0x9c')],{'as':_0xc45a('0x1be'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1bf')});db[_0xc45a('0x1c6')]['hasMany'](db[_0xc45a('0x9c')],{'as':_0xc45a('0x1c0'),'onDelete':'cascade','foreignKey':_0xc45a('0x1c1')});db['SugarcrmConfiguration'][_0xc45a('0x10d')](db[_0xc45a('0x9c')],{'as':_0xc45a('0x1b7'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1c2')});db['SugarcrmConfiguration'][_0xc45a('0x11f')](db[_0xc45a('0x99')],{'as':_0xc45a('0x16f'),'foreignKey':_0xc45a('0x1bc')});db['SugarcrmField'][_0xc45a('0x10d')](db[_0xc45a('0x9c')],{'as':_0xc45a('0x1c3'),'foreignKey':_0xc45a('0x1bf')});db['SugarcrmField']['hasMany'](db[_0xc45a('0x9c')],{'as':_0xc45a('0x1c4'),'foreignKey':_0xc45a('0x1c1')});db['SugarcrmField'][_0xc45a('0x10d')](db['SugarcrmField'],{'as':_0xc45a('0x1c7'),'foreignKey':_0xc45a('0x1c2')});db[_0xc45a('0x9c')][_0xc45a('0x11f')](db[_0xc45a('0x87')],{'as':_0xc45a('0x87'),'foreignKey':_0xc45a('0x1c5')});db['DeskAccount'][_0xc45a('0x10d')](db[_0xc45a('0x9e')],{'as':_0xc45a('0x1bb'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1bc')});db[_0xc45a('0x9e')][_0xc45a('0x10d')](db[_0xc45a('0xa0')],{'as':'Subjects','onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1bf')});db[_0xc45a('0x9e')]['hasMany'](db[_0xc45a('0xa0')],{'as':_0xc45a('0x1c0'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1c1')});db[_0xc45a('0x9e')][_0xc45a('0x10d')](db[_0xc45a('0xa0')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0xc45a('0x9e')][_0xc45a('0x11f')](db[_0xc45a('0x1c8')],{'as':_0xc45a('0x16f'),'foreignKey':_0xc45a('0x1bc')});db[_0xc45a('0x9e')][_0xc45a('0x121')](db[_0xc45a('0x86')],{'through':_0xc45a('0x1c9')});db[_0xc45a('0xa0')][_0xc45a('0x10d')](db[_0xc45a('0xa0')],{'as':_0xc45a('0x1c3'),'foreignKey':_0xc45a('0x1bf')});db[_0xc45a('0xa0')][_0xc45a('0x10d')](db[_0xc45a('0xa0')],{'as':_0xc45a('0x1c4'),'foreignKey':_0xc45a('0x1c1')});db[_0xc45a('0xa0')]['hasMany'](db[_0xc45a('0xa0')],{'as':'Field','foreignKey':_0xc45a('0x1c2')});db[_0xc45a('0xa0')][_0xc45a('0x11f')](db[_0xc45a('0x87')],{'as':_0xc45a('0x87'),'foreignKey':_0xc45a('0x1c5')});db['ZohoAccount'][_0xc45a('0x10d')](db[_0xc45a('0xa2')],{'as':_0xc45a('0x1bb'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1bc')});db[_0xc45a('0xa2')][_0xc45a('0x10d')](db[_0xc45a('0xa4')],{'as':_0xc45a('0x1be'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1bf')});db['ZohoConfiguration'][_0xc45a('0x10d')](db[_0xc45a('0xa4')],{'as':_0xc45a('0x1c0'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1c1')});db[_0xc45a('0xa2')]['hasMany'](db[_0xc45a('0xa4')],{'as':_0xc45a('0x1b7'),'onDelete':'cascade','foreignKey':_0xc45a('0x1c2')});db[_0xc45a('0xa2')]['belongsTo'](db[_0xc45a('0x1ca')],{'as':_0xc45a('0x16f'),'foreignKey':_0xc45a('0x1bc')});db[_0xc45a('0xa4')][_0xc45a('0x10d')](db[_0xc45a('0xa4')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xc45a('0xa4')][_0xc45a('0x10d')](db['ZohoField'],{'as':'Description','foreignKey':_0xc45a('0x1c1')});db[_0xc45a('0xa4')][_0xc45a('0x10d')](db[_0xc45a('0xa4')],{'as':_0xc45a('0x1c7'),'foreignKey':'FieldId'});db[_0xc45a('0xa4')]['belongsTo'](db[_0xc45a('0x87')],{'as':'Variable','foreignKey':_0xc45a('0x1c5')});db['ZendeskAccount'][_0xc45a('0x10d')](db[_0xc45a('0xa7')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xc45a('0x1bc')});db['ZendeskConfiguration'][_0xc45a('0x10d')](db[_0xc45a('0xa8')],{'as':_0xc45a('0x1be'),'foreignKey':_0xc45a('0x1bf')});db[_0xc45a('0xa7')][_0xc45a('0x10d')](db[_0xc45a('0xa8')],{'as':_0xc45a('0x1c0'),'foreignKey':_0xc45a('0x1c1')});db['ZendeskConfiguration'][_0xc45a('0x10d')](db[_0xc45a('0xa8')],{'as':_0xc45a('0x1b7'),'foreignKey':'FieldId'});db[_0xc45a('0xa7')]['belongsTo'](db[_0xc45a('0xa5')],{'as':_0xc45a('0x16f'),'foreignKey':_0xc45a('0x1bc')});db[_0xc45a('0xa7')][_0xc45a('0x121')](db[_0xc45a('0x86')],{'through':_0xc45a('0x1cb')});db['ZendeskField'][_0xc45a('0x10d')](db[_0xc45a('0xa8')],{'as':_0xc45a('0x1c3'),'foreignKey':_0xc45a('0x1bf')});db[_0xc45a('0xa8')][_0xc45a('0x10d')](db[_0xc45a('0xa8')],{'as':'Description','foreignKey':_0xc45a('0x1c1')});db[_0xc45a('0xa8')]['hasMany'](db[_0xc45a('0xa8')],{'as':_0xc45a('0x1c7'),'foreignKey':'FieldId'});db[_0xc45a('0xa8')]['belongsTo'](db[_0xc45a('0x87')],{'as':'Variable','foreignKey':_0xc45a('0x1c5')});db[_0xc45a('0xaa')][_0xc45a('0x10d')](db[_0xc45a('0x1cc')],{'as':_0xc45a('0x1bb'),'onDelete':_0xc45a('0x10c'),'foreignKey':'AccountId'});db[_0xc45a('0x1cc')][_0xc45a('0x10d')](db[_0xc45a('0xac')],{'as':_0xc45a('0x1be'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1bf')});db[_0xc45a('0x1cc')][_0xc45a('0x10d')](db['FreshdeskField'],{'as':_0xc45a('0x1c0'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1c1')});db['FreshdeskConfiguration']['hasMany'](db[_0xc45a('0xac')],{'as':_0xc45a('0x1b7'),'onDelete':'cascade','foreignKey':_0xc45a('0x1c2')});db['FreshdeskConfiguration']['belongsTo'](db[_0xc45a('0xaa')],{'as':_0xc45a('0x16f'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xc45a('0x121')](db[_0xc45a('0x86')],{'through':_0xc45a('0x1cd')});db[_0xc45a('0xac')][_0xc45a('0x10d')](db[_0xc45a('0xac')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xc45a('0xac')][_0xc45a('0x10d')](db['FreshdeskField'],{'as':_0xc45a('0x1c4'),'foreignKey':_0xc45a('0x1c1')});db[_0xc45a('0xac')]['hasMany'](db[_0xc45a('0xac')],{'as':_0xc45a('0x1c7'),'foreignKey':_0xc45a('0x1c2')});db[_0xc45a('0xac')][_0xc45a('0x11f')](db[_0xc45a('0x87')],{'as':_0xc45a('0x87'),'foreignKey':_0xc45a('0x1c5')});db[_0xc45a('0xae')][_0xc45a('0x10d')](db[_0xc45a('0x1ce')],{'as':_0xc45a('0x1bb'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xc45a('0x1ce')]['hasMany'](db['VtigerField'],{'as':_0xc45a('0x1be'),'foreignKey':_0xc45a('0x1bf')});db[_0xc45a('0x1ce')]['hasMany'](db[_0xc45a('0x1cf')],{'as':'Descriptions','foreignKey':_0xc45a('0x1c1')});db[_0xc45a('0x1ce')][_0xc45a('0x10d')](db['VtigerField'],{'as':_0xc45a('0x1b7'),'foreignKey':'FieldId'});db[_0xc45a('0x1ce')][_0xc45a('0x11f')](db[_0xc45a('0xae')],{'as':_0xc45a('0x16f'),'foreignKey':_0xc45a('0x1bc')});db[_0xc45a('0x1cf')][_0xc45a('0x10d')](db['VtigerField'],{'as':_0xc45a('0x1c3'),'foreignKey':_0xc45a('0x1bf')});db[_0xc45a('0x1cf')][_0xc45a('0x10d')](db[_0xc45a('0x1cf')],{'as':_0xc45a('0x1c4'),'foreignKey':'DescriptionId'});db[_0xc45a('0x1cf')]['hasMany'](db[_0xc45a('0x1cf')],{'as':'Field','foreignKey':'FieldId'});db[_0xc45a('0x1cf')][_0xc45a('0x11f')](db[_0xc45a('0x87')],{'as':_0xc45a('0x87'),'foreignKey':_0xc45a('0x1c5')});db[_0xc45a('0xb2')][_0xc45a('0x10d')](db['ServicenowConfiguration'],{'as':_0xc45a('0x1bb'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1bc')});db[_0xc45a('0xb4')][_0xc45a('0x10d')](db['ServicenowField'],{'as':_0xc45a('0x1be'),'foreignKey':_0xc45a('0x1bf')});db['ServicenowConfiguration']['hasMany'](db[_0xc45a('0xb6')],{'as':_0xc45a('0x1c0'),'foreignKey':'DescriptionId'});db[_0xc45a('0xb4')]['hasMany'](db[_0xc45a('0xb6')],{'as':_0xc45a('0x1b7'),'foreignKey':_0xc45a('0x1c2')});db['ServicenowConfiguration'][_0xc45a('0x11f')](db[_0xc45a('0xb2')],{'as':_0xc45a('0x16f'),'foreignKey':_0xc45a('0x1bc')});db['ServicenowField'][_0xc45a('0x10d')](db[_0xc45a('0xb6')],{'as':_0xc45a('0x1c3'),'foreignKey':_0xc45a('0x1bf')});db[_0xc45a('0xb6')][_0xc45a('0x10d')](db[_0xc45a('0xb6')],{'as':_0xc45a('0x1c4'),'foreignKey':'DescriptionId'});db[_0xc45a('0xb6')]['hasMany'](db[_0xc45a('0xb6')],{'as':'Field','foreignKey':'FieldId'});db[_0xc45a('0xb6')][_0xc45a('0x11f')](db[_0xc45a('0x87')],{'as':_0xc45a('0x87'),'foreignKey':'VariableId'});db[_0xc45a('0x1d0')][_0xc45a('0x10d')](db['Dynamics365Configuration'],{'as':_0xc45a('0x1bb'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1bc')});db[_0xc45a('0xb8')][_0xc45a('0x10d')](db[_0xc45a('0xba')],{'as':_0xc45a('0x1be'),'onDelete':_0xc45a('0x10c'),'foreignKey':'SubjectId'});db['Dynamics365Configuration']['hasMany'](db[_0xc45a('0xba')],{'as':_0xc45a('0x1c0'),'onDelete':_0xc45a('0x10c'),'foreignKey':'DescriptionId'});db[_0xc45a('0xb8')][_0xc45a('0x10d')](db[_0xc45a('0xba')],{'as':_0xc45a('0x1b7'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1c2')});db[_0xc45a('0xb8')][_0xc45a('0x11f')](db['Dynamics365Account'],{'as':_0xc45a('0x16f'),'foreignKey':_0xc45a('0x1bc')});db['Dynamics365Field'][_0xc45a('0x10d')](db[_0xc45a('0xba')],{'as':_0xc45a('0x1c3'),'foreignKey':_0xc45a('0x1bf')});db[_0xc45a('0xba')]['hasMany'](db[_0xc45a('0xba')],{'as':_0xc45a('0x1c4'),'foreignKey':_0xc45a('0x1c1')});db[_0xc45a('0xba')]['hasMany'](db[_0xc45a('0xba')],{'as':_0xc45a('0x1c7'),'foreignKey':_0xc45a('0x1c2')});db[_0xc45a('0xba')][_0xc45a('0x11f')](db['Variable'],{'as':_0xc45a('0x87'),'foreignKey':_0xc45a('0x1c5')});db['FreshsalesAccount'][_0xc45a('0x10d')](db[_0xc45a('0xbc')],{'as':_0xc45a('0x1bb'),'onDelete':_0xc45a('0x10c'),'foreignKey':'AccountId'});db[_0xc45a('0xbc')][_0xc45a('0x10d')](db[_0xc45a('0xbd')],{'as':_0xc45a('0x1be'),'foreignKey':_0xc45a('0x1bf')});db[_0xc45a('0xbc')]['hasMany'](db['FreshsalesField'],{'as':_0xc45a('0x1c0'),'foreignKey':_0xc45a('0x1c1')});db[_0xc45a('0xbc')]['hasMany'](db[_0xc45a('0xbd')],{'as':_0xc45a('0x1b7'),'foreignKey':'FieldId'});db[_0xc45a('0xbc')][_0xc45a('0x11f')](db['FreshsalesAccount'],{'as':_0xc45a('0x16f'),'foreignKey':_0xc45a('0x1bc')});db[_0xc45a('0xbd')][_0xc45a('0x10d')](db[_0xc45a('0xbd')],{'as':_0xc45a('0x1c3'),'foreignKey':_0xc45a('0x1bf')});db[_0xc45a('0xbd')][_0xc45a('0x10d')](db[_0xc45a('0xbd')],{'as':_0xc45a('0x1c4'),'foreignKey':'DescriptionId'});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':_0xc45a('0x1c7'),'foreignKey':_0xc45a('0x1c2')});db['FreshsalesField'][_0xc45a('0x11f')](db[_0xc45a('0x87')],{'as':_0xc45a('0x87'),'foreignKey':'VariableId'});db['ChatQueueReport']['belongsTo'](db['ChatWebsite'],{});db[_0xc45a('0xc1')][_0xc45a('0x11f')](db[_0xc45a('0xea')],{'as':'List','foreignKey':_0xc45a('0x169')});db['ChatQueueReport'][_0xc45a('0x11f')](db[_0xc45a('0x6b')],{'as':'Contact','foreignKey':_0xc45a('0x15e')});db[_0xc45a('0xc1')][_0xc45a('0x11f')](db[_0xc45a('0x117')],{});db[_0xc45a('0xc1')]['belongsTo'](db['ChatMessage'],{});db[_0xc45a('0xc1')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{});db[_0xc45a('0xc1')][_0xc45a('0x11f')](db['ChatQueue'],{});db[_0xc45a('0xc3')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'onDelete':'cascade','foreignKey':_0xc45a('0x1d1')});db[_0xc45a('0xc3')]['belongsTo'](db[_0xc45a('0x14')],{'onDelete':_0xc45a('0x10c'),'foreignKey':'ToId'});db['JscriptySessionReport'][_0xc45a('0x10d')](db[_0xc45a('0x1d2')],{'foreignKey':_0xc45a('0x1d3'),'onDelete':'cascade'});db[_0xc45a('0xc7')][_0xc45a('0x10d')](db[_0xc45a('0xc5')],{'foreignKey':_0xc45a('0x1d3'),'onDelete':_0xc45a('0x10c')});db[_0xc45a('0xc8')][_0xc45a('0x11f')](db[_0xc45a('0x54')],{});db[_0xc45a('0xc8')][_0xc45a('0x11f')](db['CmList'],{'as':_0xc45a('0x168'),'foreignKey':'ListId'});db[_0xc45a('0xc8')][_0xc45a('0x11f')](db[_0xc45a('0x6b')],{'as':_0xc45a('0x15d'),'foreignKey':_0xc45a('0x15e')});db[_0xc45a('0xc8')][_0xc45a('0x11f')](db[_0xc45a('0x57')],{});db['SmsQueueReport'][_0xc45a('0x11f')](db['SmsMessage'],{});db[_0xc45a('0xc8')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{});db[_0xc45a('0xc8')][_0xc45a('0x11f')](db['SmsQueue'],{});db[_0xc45a('0xce')][_0xc45a('0x10d')](db[_0xc45a('0xc7')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0xc45a('0x10d')](db['JscriptyQuestionReport'],{'foreignKey':_0xc45a('0x1d4')});db[_0xc45a('0xce')]['hasMany'](db[_0xc45a('0xc5')],{'foreignKey':_0xc45a('0x1d4')});db[_0xc45a('0xd4')][_0xc45a('0x121')](db['User'],{'as':_0xc45a('0x17c'),'through':_0xc45a('0x1d5')});db[_0xc45a('0xd8')][_0xc45a('0x121')](db[_0xc45a('0x14')],{'as':_0xc45a('0x152'),'through':'user_has_teams'});db[_0xc45a('0xd8')][_0xc45a('0x121')](db[_0xc45a('0x146')],{'through':_0xc45a('0x154'),'as':_0xc45a('0x12d')});db['Team'][_0xc45a('0x121')](db['MailQueue'],{'through':_0xc45a('0x16d'),'as':'MailQueues'});db[_0xc45a('0xd8')]['belongsToMany'](db[_0xc45a('0x68')],{'through':_0xc45a('0x1d6'),'as':_0xc45a('0x1d7')});db[_0xc45a('0xd8')][_0xc45a('0x121')](db[_0xc45a('0x50')],{'through':_0xc45a('0x17e'),'as':_0xc45a('0x130')});db['Team'][_0xc45a('0x121')](db[_0xc45a('0x59')],{'through':_0xc45a('0x185'),'as':_0xc45a('0x132')});db[_0xc45a('0xd8')][_0xc45a('0x121')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0xc45a('0xd8')][_0xc45a('0x121')](db[_0xc45a('0x100')],{'through':_0xc45a('0x1d8'),'as':'WhatsappQueues'});db['Team']['belongsToMany'](db[_0xc45a('0xec')],{'through':_0xc45a('0x103'),'as':_0xc45a('0x1d9')});db[_0xc45a('0xdb')]['hasMany'](db['CmHopper'],{'as':_0xc45a('0x149'),'foreignKey':_0xc45a('0x19e')});db[_0xc45a('0xdb')][_0xc45a('0x10d')](db[_0xc45a('0x6f')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0xc45a('0xdb')]['hasMany'](db[_0xc45a('0x113')],{'as':_0xc45a('0x14a'),'foreignKey':_0xc45a('0x19e')});db[_0xc45a('0xdb')]['hasMany'](db[_0xc45a('0x1a0')],{'as':_0xc45a('0x14b'),'foreignKey':_0xc45a('0x19e')});db[_0xc45a('0xdb')][_0xc45a('0x11f')](db[_0xc45a('0x2c')],{'as':'Trunk','foreignKey':_0xc45a('0x14d')});db[_0xc45a('0xdb')]['belongsTo'](db[_0xc45a('0x2c')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0xc45a('0xdb')][_0xc45a('0x11f')](db['Interval'],{'as':_0xc45a('0x7c'),'foreignKey':_0xc45a('0x177')});db[_0xc45a('0xdb')]['belongsTo'](db['SquareProject'],{'as':_0xc45a('0xd4'),'foreignKey':_0xc45a('0x1da')});db[_0xc45a('0xdb')]['belongsToMany'](db[_0xc45a('0xea')],{'as':_0xc45a('0x127'),'through':_0xc45a('0x1db')});db[_0xc45a('0xdb')][_0xc45a('0x121')](db['CmList'],{'as':_0xc45a('0x155'),'through':'campaigns_has_cm_blacklists'});db[_0xc45a('0x175')][_0xc45a('0x11f')](db[_0xc45a('0x67')],{'as':_0xc45a('0x67'),'foreignKey':'ChatOfflineMessageId'});db[_0xc45a('0xe1')]['belongsTo'](db[_0xc45a('0x44')],{});db[_0xc45a('0xe1')][_0xc45a('0x11f')](db[_0xc45a('0x43')],{});db[_0xc45a('0xe1')][_0xc45a('0x11f')](db[_0xc45a('0x15f')],{'foreignKey':_0xc45a('0x1dc'),'as':_0xc45a('0x1dd')});db[_0xc45a('0xe1')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'foreignKey':_0xc45a('0x1de'),'as':_0xc45a('0x1df')});db[_0xc45a('0xe1')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xc45a('0xe1')]['belongsTo'](db[_0xc45a('0x12e')],{'foreignKey':_0xc45a('0x1e0'),'as':'ToQueue'});db[_0xc45a('0xe1')][_0xc45a('0x11f')](db[_0xc45a('0x15f')],{'foreignKey':_0xc45a('0x1e1'),'as':_0xc45a('0x1e2')});db[_0xc45a('0xe3')][_0xc45a('0x11f')](db[_0xc45a('0x65')],{});db['ChatTransferReport'][_0xc45a('0x11f')](db[_0xc45a('0x117')],{});db[_0xc45a('0xe3')][_0xc45a('0x11f')](db[_0xc45a('0x60')],{'foreignKey':_0xc45a('0x1e3'),'as':_0xc45a('0x1dd')});db[_0xc45a('0xe3')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'foreignKey':'FromUserId','as':_0xc45a('0x1df')});db[_0xc45a('0xe3')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'foreignKey':'ToUserId','as':_0xc45a('0x1e4')});db[_0xc45a('0xe3')]['belongsTo'](db[_0xc45a('0x68')],{'foreignKey':_0xc45a('0x1e5'),'as':_0xc45a('0x1e6')});db[_0xc45a('0xe3')][_0xc45a('0x11f')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0xc45a('0x1e2')});db[_0xc45a('0xe5')]['belongsTo'](db[_0xc45a('0x4f')],{});db[_0xc45a('0xe5')]['belongsTo'](db[_0xc45a('0x118')],{});db[_0xc45a('0xe5')][_0xc45a('0x11f')](db[_0xc45a('0x137')],{'foreignKey':_0xc45a('0x1e7'),'as':_0xc45a('0x1dd')});db['FaxTransferReport'][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'foreignKey':_0xc45a('0x1de'),'as':_0xc45a('0x1df')});db[_0xc45a('0xe5')]['belongsTo'](db[_0xc45a('0x14')],{'foreignKey':_0xc45a('0x1e8'),'as':'ToAgent'});db[_0xc45a('0xe5')][_0xc45a('0x11f')](db['FaxQueue'],{'foreignKey':_0xc45a('0x1e9'),'as':'ToQueue'});db['FaxTransferReport'][_0xc45a('0x11f')](db[_0xc45a('0x137')],{'foreignKey':_0xc45a('0x1ea'),'as':_0xc45a('0x1e2')});db[_0xc45a('0xe7')][_0xc45a('0x11f')](db[_0xc45a('0x188')],{});db['OpenchannelTransferReport'][_0xc45a('0x11f')](db[_0xc45a('0x115')],{});db[_0xc45a('0xe7')][_0xc45a('0x11f')](db[_0xc45a('0x186')],{'foreignKey':_0xc45a('0x1eb'),'as':_0xc45a('0x1dd')});db[_0xc45a('0xe7')]['belongsTo'](db[_0xc45a('0x14')],{'foreignKey':_0xc45a('0x1de'),'as':_0xc45a('0x1df')});db['OpenchannelTransferReport'][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'foreignKey':_0xc45a('0x1e8'),'as':_0xc45a('0x1e4')});db[_0xc45a('0xe7')][_0xc45a('0x11f')](db[_0xc45a('0x18a')],{'foreignKey':_0xc45a('0x1ec'),'as':_0xc45a('0x1e6')});db['OpenchannelTransferReport'][_0xc45a('0x11f')](db[_0xc45a('0x186')],{'foreignKey':_0xc45a('0x1ed'),'as':'ToAccount'});db['SmsTransferReport'][_0xc45a('0x11f')](db['SmsMessage'],{});db[_0xc45a('0xe9')][_0xc45a('0x11f')](db[_0xc45a('0x57')],{});db[_0xc45a('0xe9')]['belongsTo'](db[_0xc45a('0x54')],{'foreignKey':'FromSmsAccountId','as':_0xc45a('0x1dd')});db[_0xc45a('0xe9')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'foreignKey':_0xc45a('0x1de'),'as':_0xc45a('0x1df')});db[_0xc45a('0xe9')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'foreignKey':_0xc45a('0x1e8'),'as':_0xc45a('0x1e4')});db[_0xc45a('0xe9')][_0xc45a('0x11f')](db[_0xc45a('0x59')],{'foreignKey':'ToSmsQueueId','as':_0xc45a('0x1e6')});db['SmsTransferReport'][_0xc45a('0x11f')](db[_0xc45a('0x54')],{'foreignKey':_0xc45a('0x1ee'),'as':_0xc45a('0x1e2')});db[_0xc45a('0xea')][_0xc45a('0x10d')](db[_0xc45a('0x79')],{'as':_0xc45a('0x165'),'foreignKey':_0xc45a('0x169'),'onDelete':'cascade'});db[_0xc45a('0xea')]['hasMany'](db[_0xc45a('0x72')],{'as':_0xc45a('0x1ef'),'foreignKey':'ListId'});db['CmList'][_0xc45a('0x10d')](db[_0xc45a('0x6b')],{'as':_0xc45a('0x125'),'onDelete':'cascade','foreignKey':_0xc45a('0x169')});db[_0xc45a('0xea')][_0xc45a('0x10d')](db[_0xc45a('0x6f')],{'as':_0xc45a('0x112'),'foreignKey':_0xc45a('0x169')});db[_0xc45a('0xea')][_0xc45a('0x10d')](db[_0xc45a('0x113')],{'as':_0xc45a('0x114'),'foreignKey':_0xc45a('0x169')});db[_0xc45a('0xea')][_0xc45a('0x10d')](db[_0xc45a('0x70')],{'as':_0xc45a('0x70'),'foreignKey':_0xc45a('0x169')});db['CmList'][_0xc45a('0x121')](db[_0xc45a('0x146')],{'as':_0xc45a('0x1f0'),'through':'voice_queues_has_cm_lists'});db[_0xc45a('0xea')]['belongsToMany'](db[_0xc45a('0x14')],{'as':_0xc45a('0x152'),'through':_0xc45a('0x128')});db['VoicePrefix'][_0xc45a('0x10d')](db[_0xc45a('0x1a')],{'as':'Extensions','onDelete':_0xc45a('0x10c')});db[_0xc45a('0xec')][_0xc45a('0x121')](db[_0xc45a('0x14')],{'as':'Agents','through':_0xc45a('0x105')});db[_0xc45a('0xec')][_0xc45a('0x121')](db[_0xc45a('0xd8')],{'through':_0xc45a('0x103'),'as':'Teams'});db['UserProfile'][_0xc45a('0x10d')](db[_0xc45a('0x14')],{'as':_0xc45a('0x17c'),'foreignKey':_0xc45a('0x120')});db['UserProfile'][_0xc45a('0x10d')](db[_0xc45a('0xf0')],{'as':_0xc45a('0x1f1'),'foreignKey':_0xc45a('0x120'),'onDelete':'cascade'});db[_0xc45a('0xf0')]['hasMany'](db['UserProfileResource'],{'as':'Resources','foreignKey':_0xc45a('0x1f2'),'onDelete':_0xc45a('0x10c')});db[_0xc45a('0xf4')][_0xc45a('0x10d')](db[_0xc45a('0x79')],{'as':_0xc45a('0x165'),'foreignKey':_0xc45a('0x1f3'),'onDelete':_0xc45a('0x10c')});db[_0xc45a('0xf4')]['hasMany'](db[_0xc45a('0x78')],{'as':'Answers','foreignKey':_0xc45a('0x1f3')});db[_0xc45a('0xf4')][_0xc45a('0x10d')](db['WhatsappMessage'],{'as':_0xc45a('0x157'),'foreignKey':_0xc45a('0x1f3')});db[_0xc45a('0xf4')][_0xc45a('0x10d')](db[_0xc45a('0xf8')],{'as':_0xc45a('0x167')});db[_0xc45a('0xf4')]['hasMany'](db[_0xc45a('0xf6')],{'as':'Applications'});db['WhatsappAccount'][_0xc45a('0x11f')](db[_0xc45a('0xea')],{'as':_0xc45a('0x168'),'foreignKey':_0xc45a('0x169')});db['WhatsappAccount']['belongsTo'](db[_0xc45a('0x7e')],{'as':'mandatoryDispositionPause','foreignKey':_0xc45a('0x150')});db[_0xc45a('0xf4')][_0xc45a('0x121')](db[_0xc45a('0x14')],{'as':_0xc45a('0x152'),'through':_0xc45a('0x13e')});db['WhatsappApplication'][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'onDelete':_0xc45a('0x162')});db[_0xc45a('0xf6')]['belongsTo'](db['WhatsappQueue'],{'onDelete':_0xc45a('0x162')});db['WhatsappApplication'][_0xc45a('0x11f')](db[_0xc45a('0xf4')],{'onDelete':_0xc45a('0x162')});db[_0xc45a('0xf6')][_0xc45a('0x11f')](db[_0xc45a('0x7c')],{'onDelete':_0xc45a('0x162'),'foreignKey':_0xc45a('0x177')});db[_0xc45a('0xf6')][_0xc45a('0x11f')](db['Tag'],{'onDelete':_0xc45a('0x162'),'foreignKey':_0xc45a('0x178')});db[_0xc45a('0xf8')][_0xc45a('0x10d')](db[_0xc45a('0xfa')],{'as':_0xc45a('0x157'),'onDelete':_0xc45a('0x10c'),'foreignKey':_0xc45a('0x1f4')});db[_0xc45a('0xf8')][_0xc45a('0x11f')](db['WhatsappAccount'],{'as':_0xc45a('0x16f'),'foreignKey':'WhatsappAccountId'});db[_0xc45a('0xf8')][_0xc45a('0x11f')](db[_0xc45a('0x6b')],{'as':'Contact','foreignKey':_0xc45a('0x15e')});db[_0xc45a('0xf8')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'as':_0xc45a('0x170'),'foreignKey':_0xc45a('0x10a')});db[_0xc45a('0xf8')][_0xc45a('0x121')](db[_0xc45a('0x86')],{'through':_0xc45a('0x1f5'),'as':_0xc45a('0x172')});db['WhatsappInteraction'][_0xc45a('0x121')](db[_0xc45a('0x86')],{'through':_0xc45a('0x1f5'),'as':_0xc45a('0x173')});db[_0xc45a('0xf8')]['belongsToMany'](db[_0xc45a('0x14')],{'as':_0xc45a('0x17c'),'through':_0xc45a('0x12c'),'foreignKey':_0xc45a('0x1f4')});db[_0xc45a('0xfa')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'as':'User'});db['WhatsappMessage'][_0xc45a('0x11f')](db[_0xc45a('0x6b')],{'onDelete':_0xc45a('0x10c'),'as':'Contact'});db[_0xc45a('0xfa')][_0xc45a('0x11f')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0xc45a('0x183'),'foreignKey':_0xc45a('0x1f4')});db[_0xc45a('0xfa')][_0xc45a('0x11f')](db['WhatsappAccount'],{'as':_0xc45a('0x16f'),'foreignKey':_0xc45a('0x1f3')});db[_0xc45a('0xfc')][_0xc45a('0x11f')](db['WhatsappAccount'],{});db[_0xc45a('0xfc')][_0xc45a('0x11f')](db[_0xc45a('0xea')],{'as':_0xc45a('0x168'),'foreignKey':'ListId'});db['WhatsappQueueReport'][_0xc45a('0x11f')](db[_0xc45a('0x6b')],{'as':'Contact','foreignKey':'ContactId'});db[_0xc45a('0xfc')][_0xc45a('0x11f')](db[_0xc45a('0xf8')],{});db[_0xc45a('0xfc')][_0xc45a('0x11f')](db[_0xc45a('0x100')],{});db[_0xc45a('0xfc')]['belongsTo'](db[_0xc45a('0xfa')],{});db[_0xc45a('0xfc')][_0xc45a('0x11f')](db['User'],{});db[_0xc45a('0xfe')]['belongsTo'](db[_0xc45a('0xfa')],{});db[_0xc45a('0xfe')][_0xc45a('0x11f')](db[_0xc45a('0xf8')],{});db['WhatsappTransferReport'][_0xc45a('0x11f')](db[_0xc45a('0xf4')],{'foreignKey':_0xc45a('0x1f6'),'as':'FromAccount'});db[_0xc45a('0xfe')][_0xc45a('0x11f')](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':_0xc45a('0x1e2')});db[_0xc45a('0xfe')][_0xc45a('0x11f')](db[_0xc45a('0x100')],{'foreignKey':_0xc45a('0x1f7'),'as':_0xc45a('0x1e6')});db['WhatsappTransferReport'][_0xc45a('0x11f')](db['User'],{'foreignKey':_0xc45a('0x1de'),'as':_0xc45a('0x1df')});db[_0xc45a('0xfe')][_0xc45a('0x11f')](db[_0xc45a('0x14')],{'foreignKey':'ToUserId','as':'ToAgent'});db['WhatsappQueue']['belongsToMany'](db[_0xc45a('0x14')],{'as':_0xc45a('0x152'),'through':_0xc45a('0x3a'),'foreignKey':'WhatsappQueueId'});db[_0xc45a('0x100')][_0xc45a('0x121')](db[_0xc45a('0xd8')],{'through':_0xc45a('0x1d8'),'as':'Teams'});db['UserSetting'][_0xc45a('0x11f')](db['User'],{'as':'user','foreignKey':_0xc45a('0x10a'),'onDelete':'cascade','hooks':!![]});db['CloudProvider'][_0xc45a('0x108')](db['MailServerIn'],{'as':'Imap','onDelete':_0xc45a('0x162')});db[_0xc45a('0x102')]['hasOne'](db[_0xc45a('0x3d')],{'as':_0xc45a('0x164'),'onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index cf020cb..9e0aa10 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/dispositions','/api/conditions','./api/condition','/api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','./api/tag','/api/templates','./api/template','/api/triggers','/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/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/chat/reports/queue','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','./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/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','join','root','static','/demo','/snippet','snippet','3.0.0','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','path','express','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','./api/voiceQueue','./api/voiceRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields'];(function(_0xe58e92,_0x3bc0a1){var _0x19cb3c=function(_0x1544c0){while(--_0x1544c0){_0xe58e92['push'](_0xe58e92['shift']());}};_0x19cb3c(++_0x3bc0a1);}(_0x5fc3,0xa8));var _0x35fc=function(_0x582d0b,_0x28f609){_0x582d0b=_0x582d0b-0x0;var _0x2e93e1=_0x5fc3[_0x582d0b];return _0x2e93e1;};'use strict';var path=require(_0x35fc('0x0'));var express=require(_0x35fc('0x1'));var errors=require('./errors');var config=require(_0x35fc('0x2'));var setupLoggers=require(_0x35fc('0x3'))[_0x35fc('0x4')];var clientSideLogs=require(_0x35fc('0x5'));exports[_0x35fc('0x6')]=function(_0x5e75e6){return setupLoggers(_0x5e75e6)[_0x35fc('0x7')](function(){_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x9'),require('./api/user'));_0x5e75e6['use'](_0x35fc('0xa'),require('./api/voiceChanSpy'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xb'),require(_0x35fc('0xc')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xd'),require(_0x35fc('0xe')));_0x5e75e6[_0x35fc('0x8')]('/api/voice/mohs',require(_0x35fc('0xf')));_0x5e75e6[_0x35fc('0x8')]('/api/voice/queues',require(_0x35fc('0x10')));_0x5e75e6[_0x35fc('0x8')]('/api/voice/recordings',require(_0x35fc('0x11')));_0x5e75e6[_0x35fc('0x8')]('/api/screen/recordings',require('./api/screenRecording'));_0x5e75e6[_0x35fc('0x8')]('/api/voice/mails',require(_0x35fc('0x12')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x13'),require(_0x35fc('0x14')));_0x5e75e6[_0x35fc('0x8')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x5e75e6['use']('/api/voice/dials/reports',require(_0x35fc('0x15')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x16'),require(_0x35fc('0x17')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x18'),require('./api/voiceQueueReport'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x19'),require('./api/memberReport'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x1a'),require(_0x35fc('0x1b')));_0x5e75e6['use'](_0x35fc('0x1c'),require(_0x35fc('0x1d')));_0x5e75e6[_0x35fc('0x8')]('/api/mail/out_servers',require(_0x35fc('0x1e')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x1f'),require(_0x35fc('0x20')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x21'),require(_0x35fc('0x22')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x23'),require(_0x35fc('0x24')));_0x5e75e6['use'](_0x35fc('0x25'),require(_0x35fc('0x26')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x27'),require(_0x35fc('0x28')));_0x5e75e6['use'](_0x35fc('0x29'),require(_0x35fc('0x2a')));_0x5e75e6['use'](_0x35fc('0x2b'),require(_0x35fc('0x2c')));_0x5e75e6[_0x35fc('0x8')]('/api/dashboards',require(_0x35fc('0x2d')));_0x5e75e6['use'](_0x35fc('0x2e'),require(_0x35fc('0x2f')));_0x5e75e6['use']('/api/fax/accounts',require(_0x35fc('0x30')));_0x5e75e6['use'](_0x35fc('0x31'),require(_0x35fc('0x32')));_0x5e75e6['use'](_0x35fc('0x33'),require(_0x35fc('0x34')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x35'),require(_0x35fc('0x36')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x37'),require(_0x35fc('0x38')));_0x5e75e6['use'](_0x35fc('0x39'),require(_0x35fc('0x3a')));_0x5e75e6[_0x35fc('0x8')]('/api/sms/accounts',require(_0x35fc('0x3b')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x3c'),require(_0x35fc('0x3d')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x3e'),require(_0x35fc('0x3f')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x40'),require(_0x35fc('0x41')));_0x5e75e6['use']('/api/sms/queues',require(_0x35fc('0x42')));_0x5e75e6['use'](_0x35fc('0x43'),require(_0x35fc('0x44')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x45'),require(_0x35fc('0x46')));_0x5e75e6[_0x35fc('0x8')]('/api/openchannel/interactions',require(_0x35fc('0x47')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x48'),require(_0x35fc('0x49')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x4a'),require('./api/openchannelQueue'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x4b'),require(_0x35fc('0x4c')));_0x5e75e6['use'](_0x35fc('0x4d'),require('./api/openchannelQueueReport'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x4e'),require(_0x35fc('0x4f')));_0x5e75e6[_0x35fc('0x8')]('/api/chat/interactions',require('./api/chatInteraction'));_0x5e75e6['use'](_0x35fc('0x50'),require('./api/chatMessage'));_0x5e75e6[_0x35fc('0x8')]('/api/chat/offline_messages',require(_0x35fc('0x51')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x52'),require(_0x35fc('0x53')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x54'),require(_0x35fc('0x55')));_0x5e75e6['use'](_0x35fc('0x56'),require(_0x35fc('0x57')));_0x5e75e6['use'](_0x35fc('0x58'),require(_0x35fc('0x59')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x5a'),require(_0x35fc('0x5b')));_0x5e75e6[_0x35fc('0x8')]('/api/cm/hopper',require(_0x35fc('0x5c')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x5d'),require('./api/cmHopperBlack'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x5e'),require('./api/cmHopperFinal'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x5f'),require(_0x35fc('0x60')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x61'),require(_0x35fc('0x62')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x63'),require('./api/action'));_0x5e75e6['use'](_0x35fc('0x64'),require(_0x35fc('0x65')));_0x5e75e6['use']('/api/canned_answers',require('./api/cannedAnswer'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x66'),require('./api/disposition'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x67'),require(_0x35fc('0x68')));_0x5e75e6[_0x35fc('0x8')]('/api/intervals',require('./api/interval'));_0x5e75e6['use']('/api/pauses',require('./api/pause'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x69'),require('./api/cdr'));_0x5e75e6[_0x35fc('0x8')]('/api/voiceQueuesLog',require(_0x35fc('0x6a')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x6b'),require(_0x35fc('0x6c')));_0x5e75e6[_0x35fc('0x8')]('/api/sounds',require(_0x35fc('0x6d')));_0x5e75e6[_0x35fc('0x8')]('/api/tags',require(_0x35fc('0x6e')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x6f'),require(_0x35fc('0x70')));_0x5e75e6['use'](_0x35fc('0x71'),require('./api/trigger'));_0x5e75e6['use'](_0x35fc('0x72'),require(_0x35fc('0x73')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x74'),require(_0x35fc('0x75')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x76'),require(_0x35fc('0x77')));_0x5e75e6['use'](_0x35fc('0x78'),require(_0x35fc('0x79')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x7a'),require(_0x35fc('0x7b')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x7c'),require(_0x35fc('0x7d')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x7e'),require(_0x35fc('0x7f')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x80'),require(_0x35fc('0x81')));_0x5e75e6['use']('/api/analytics/tree_reports',require(_0x35fc('0x82')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x83'),require(_0x35fc('0x84')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x85'),require('./api/intSalesforceConfiguration'));_0x5e75e6['use'](_0x35fc('0x86'),require(_0x35fc('0x87')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x88'),require('./api/intSugarcrmAccount'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x89'),require('./api/intSugarcrmConfiguration'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x8a'),require('./api/intSugarcrmField'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x8b'),require(_0x35fc('0x8c')));_0x5e75e6[_0x35fc('0x8')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x5e75e6['use'](_0x35fc('0x8d'),require(_0x35fc('0x8e')));_0x5e75e6['use'](_0x35fc('0x8f'),require(_0x35fc('0x90')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x91'),require(_0x35fc('0x92')));_0x5e75e6['use'](_0x35fc('0x93'),require(_0x35fc('0x94')));_0x5e75e6[_0x35fc('0x8')]('/api/integrations/zendesk/accounts',require(_0x35fc('0x95')));_0x5e75e6[_0x35fc('0x8')]('/api/integrations/zendesk/configurations',require(_0x35fc('0x96')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x97'),require(_0x35fc('0x98')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x99'),require(_0x35fc('0x9a')));_0x5e75e6[_0x35fc('0x8')]('/api/integrations/freshdesk/configurations',require(_0x35fc('0x9b')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x9c'),require('./api/intFreshdeskField'));_0x5e75e6[_0x35fc('0x8')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x5e75e6['use'](_0x35fc('0x9d'),require(_0x35fc('0x9e')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x9f'),require(_0x35fc('0xa0')));_0x5e75e6['use']('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x5e75e6['use']('/api/integrations/servicenow/configurations',require(_0x35fc('0xa1')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xa2'),require(_0x35fc('0xa3')));_0x5e75e6['use'](_0x35fc('0xa4'),require(_0x35fc('0xa5')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xa6'),require(_0x35fc('0xa7')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xa8'),require(_0x35fc('0xa9')));_0x5e75e6[_0x35fc('0x8')]('/api/integrations/freshsales/accounts',require(_0x35fc('0xaa')));_0x5e75e6['use'](_0x35fc('0xab'),require(_0x35fc('0xac')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xad'),require('./api/intFreshsalesField'));_0x5e75e6[_0x35fc('0x8')]('/api/networks',require('./api/network'));_0x5e75e6['use'](_0x35fc('0xae'),require('./api/chatQueueReport'));_0x5e75e6[_0x35fc('0x8')]('/api/chat/internal/messages',require(_0x35fc('0xaf')));_0x5e75e6['use'](_0x35fc('0xb0'),require(_0x35fc('0xb1')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xb2'),require('./api/jscriptyQuestionReport'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xb3'),require(_0x35fc('0xb4')));_0x5e75e6['use'](_0x35fc('0xb5'),require(_0x35fc('0xb6')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xb7'),require(_0x35fc('0xb8')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xb9'),require(_0x35fc('0xba')));_0x5e75e6['use'](_0x35fc('0xbb'),require(_0x35fc('0xbc')));_0x5e75e6[_0x35fc('0x8')]('/api/settings',require(_0x35fc('0xbd')));_0x5e75e6[_0x35fc('0x8')]('/api/square/odbc',require('./api/squareOdbc'));_0x5e75e6[_0x35fc('0x8')]('/api/square/projects',require(_0x35fc('0xbe')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xbf'),require(_0x35fc('0xc0')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xc1'),require(_0x35fc('0xc2')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xc3'),require(_0x35fc('0xc4')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xc5'),require(_0x35fc('0xc6')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xc7'),require(_0x35fc('0xc8')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xc9'),require(_0x35fc('0xca')));_0x5e75e6[_0x35fc('0x8')]('/api/attachments',require(_0x35fc('0xcb')));_0x5e75e6['use'](_0x35fc('0xcc'),require(_0x35fc('0xcd')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xce'),require(_0x35fc('0xcf')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xd0'),require(_0x35fc('0xd1')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xd2'),require(_0x35fc('0xd3')));_0x5e75e6['use'](_0x35fc('0xd4'),require(_0x35fc('0xd5')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xd6'),require(_0x35fc('0xd7')));_0x5e75e6[_0x35fc('0x8')]('/api/cm/lists',require(_0x35fc('0xd8')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xd9'),require(_0x35fc('0xda')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xdb'),require(_0x35fc('0xdc')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xdd'),require('./api/userProfileSection'));_0x5e75e6[_0x35fc('0x8')]('/api/userProfile/resources',require(_0x35fc('0xde')));_0x5e75e6[_0x35fc('0x8')]('/api/userNotifications',require(_0x35fc('0xdf')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xe0'),require(_0x35fc('0xe1')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xe2'),require(_0x35fc('0xe3')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xe4'),require('./api/whatsappInteraction'));_0x5e75e6['use']('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xe5'),require(_0x35fc('0xe6')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xe7'),require('./api/whatsappTransferReport'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xe8'),require(_0x35fc('0xe9')));_0x5e75e6[_0x35fc('0x8')]('/api/cloudProviders',require(_0x35fc('0xea')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xeb'),require('./api/realtime'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xec'),require(_0x35fc('0xed')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xee'),require(_0x35fc('0xef')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xf0'),require('./api/authGoogle'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xf1'),require(_0x35fc('0xf2')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xf3'),require(_0x35fc('0xf4')));_0x5e75e6['use'](_0x35fc('0xf5'),require('./api/rpc'));_0x5e75e6['use'](_0x35fc('0xf6'),require('./api/version'));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xf7'),require(_0x35fc('0xf8')));_0x5e75e6['use'](_0x35fc('0xf9'),require(_0x35fc('0xfa')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0xfb'),require(_0x35fc('0xfc')));_0x5e75e6['use']('/api/logs',clientSideLogs);_0x5e75e6['use'](_0x35fc('0xfd'),express['static'](path[_0x35fc('0xfe')](config[_0x35fc('0xff')],_0x35fc('0xfd'))));_0x5e75e6[_0x35fc('0x8')]('/www',express[_0x35fc('0x100')](path[_0x35fc('0xfe')](config[_0x35fc('0xff')],'/www')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x101'),express[_0x35fc('0x100')](path['join'](config['root'],'/demo')));_0x5e75e6[_0x35fc('0x8')](_0x35fc('0x102'),express[_0x35fc('0x100')](path[_0x35fc('0xfe')](config['root'],_0x35fc('0x103'),_0x35fc('0x104'))));_0x5e75e6['use']('/plugins',express[_0x35fc('0x100')](path[_0x35fc('0xfe')](config[_0x35fc('0xff')],'/server/files/plugins')));_0x5e75e6['route'](_0x35fc('0x105'))[_0x35fc('0x106')](errors[0x194]);_0x5e75e6['route']('/*')[_0x35fc('0x106')](function(_0x163edb,_0x1d96c9){_0x1d96c9['sendFile'](path[_0x35fc('0x107')](_0x5e75e6[_0x35fc('0x106')](_0x35fc('0x108'))+_0x35fc('0x109')));});return _0x5e75e6;});}; \ No newline at end of file +var _0x425d=['./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/applications','./api/openchannelApplication','./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/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./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/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','/api/migrations','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions'];(function(_0x4bf96c,_0x4d24fd){var _0x281d09=function(_0x56538e){while(--_0x56538e){_0x4bf96c['push'](_0x4bf96c['shift']());}};_0x281d09(++_0x4d24fd);}(_0x425d,0x1e0));var _0xd425=function(_0x41bea7,_0x506bc9){_0x41bea7=_0x41bea7-0x0;var _0x53a431=_0x425d[_0x41bea7];return _0x53a431;};'use strict';var path=require(_0xd425('0x0'));var express=require('express');var errors=require(_0xd425('0x1'));var config=require(_0xd425('0x2'));var setupLoggers=require(_0xd425('0x3'))[_0xd425('0x4')];var clientSideLogs=require(_0xd425('0x5'));exports[_0xd425('0x6')]=function(_0x47043f){return setupLoggers(_0x47043f)['then'](function(){_0x47043f[_0xd425('0x7')](_0xd425('0x8'),require(_0xd425('0x9')));_0x47043f[_0xd425('0x7')](_0xd425('0xa'),require(_0xd425('0xb')));_0x47043f['use'](_0xd425('0xc'),require(_0xd425('0xd')));_0x47043f[_0xd425('0x7')](_0xd425('0xe'),require(_0xd425('0xf')));_0x47043f[_0xd425('0x7')](_0xd425('0x10'),require(_0xd425('0x11')));_0x47043f[_0xd425('0x7')](_0xd425('0x12'),require(_0xd425('0x13')));_0x47043f[_0xd425('0x7')](_0xd425('0x14'),require(_0xd425('0x15')));_0x47043f[_0xd425('0x7')](_0xd425('0x16'),require(_0xd425('0x17')));_0x47043f[_0xd425('0x7')](_0xd425('0x18'),require(_0xd425('0x19')));_0x47043f['use'](_0xd425('0x1a'),require(_0xd425('0x1b')));_0x47043f[_0xd425('0x7')]('/api/voice/calls/reports',require(_0xd425('0x1c')));_0x47043f[_0xd425('0x7')](_0xd425('0x1d'),require(_0xd425('0x1e')));_0x47043f[_0xd425('0x7')]('/api/voice/agents/reports',require(_0xd425('0x1f')));_0x47043f[_0xd425('0x7')](_0xd425('0x20'),require(_0xd425('0x21')));_0x47043f['use'](_0xd425('0x22'),require(_0xd425('0x23')));_0x47043f[_0xd425('0x7')](_0xd425('0x24'),require('./api/trunk'));_0x47043f['use']('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x47043f[_0xd425('0x7')](_0xd425('0x25'),require(_0xd425('0x26')));_0x47043f['use'](_0xd425('0x27'),require(_0xd425('0x28')));_0x47043f['use'](_0xd425('0x29'),require(_0xd425('0x2a')));_0x47043f[_0xd425('0x7')](_0xd425('0x2b'),require(_0xd425('0x2c')));_0x47043f[_0xd425('0x7')](_0xd425('0x2d'),require(_0xd425('0x2e')));_0x47043f[_0xd425('0x7')](_0xd425('0x2f'),require(_0xd425('0x30')));_0x47043f[_0xd425('0x7')]('/api/mail/applications',require(_0xd425('0x31')));_0x47043f[_0xd425('0x7')](_0xd425('0x32'),require(_0xd425('0x33')));_0x47043f[_0xd425('0x7')](_0xd425('0x34'),require(_0xd425('0x35')));_0x47043f['use'](_0xd425('0x36'),require(_0xd425('0x37')));_0x47043f[_0xd425('0x7')]('/api/fax/accounts',require(_0xd425('0x38')));_0x47043f[_0xd425('0x7')](_0xd425('0x39'),require(_0xd425('0x3a')));_0x47043f[_0xd425('0x7')](_0xd425('0x3b'),require(_0xd425('0x3c')));_0x47043f[_0xd425('0x7')](_0xd425('0x3d'),require(_0xd425('0x3e')));_0x47043f['use'](_0xd425('0x3f'),require(_0xd425('0x40')));_0x47043f[_0xd425('0x7')](_0xd425('0x41'),require(_0xd425('0x42')));_0x47043f[_0xd425('0x7')](_0xd425('0x43'),require(_0xd425('0x44')));_0x47043f[_0xd425('0x7')](_0xd425('0x45'),require(_0xd425('0x46')));_0x47043f['use'](_0xd425('0x47'),require(_0xd425('0x48')));_0x47043f[_0xd425('0x7')](_0xd425('0x49'),require(_0xd425('0x4a')));_0x47043f['use'](_0xd425('0x4b'),require(_0xd425('0x4c')));_0x47043f['use']('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x47043f[_0xd425('0x7')](_0xd425('0x4d'),require(_0xd425('0x4e')));_0x47043f[_0xd425('0x7')]('/api/openchannel/interactions',require(_0xd425('0x4f')));_0x47043f[_0xd425('0x7')](_0xd425('0x50'),require(_0xd425('0x51')));_0x47043f[_0xd425('0x7')](_0xd425('0x52'),require(_0xd425('0x53')));_0x47043f['use'](_0xd425('0x54'),require('./api/chatWebsite'));_0x47043f[_0xd425('0x7')](_0xd425('0x55'),require(_0xd425('0x56')));_0x47043f['use'](_0xd425('0x57'),require(_0xd425('0x58')));_0x47043f[_0xd425('0x7')](_0xd425('0x59'),require('./api/chatInteraction'));_0x47043f[_0xd425('0x7')](_0xd425('0x5a'),require('./api/chatMessage'));_0x47043f['use']('/api/chat/offline_messages',require(_0xd425('0x5b')));_0x47043f[_0xd425('0x7')](_0xd425('0x5c'),require('./api/chatQueue'));_0x47043f['use']('/api/chat/groups',require(_0xd425('0x5d')));_0x47043f[_0xd425('0x7')](_0xd425('0x5e'),require(_0xd425('0x5f')));_0x47043f[_0xd425('0x7')](_0xd425('0x60'),require(_0xd425('0x61')));_0x47043f['use'](_0xd425('0x62'),require(_0xd425('0x63')));_0x47043f[_0xd425('0x7')]('/api/cm/hopper',require(_0xd425('0x64')));_0x47043f[_0xd425('0x7')](_0xd425('0x65'),require('./api/cmHopperBlack'));_0x47043f[_0xd425('0x7')](_0xd425('0x66'),require(_0xd425('0x67')));_0x47043f[_0xd425('0x7')]('/api/cm/hopper_history',require(_0xd425('0x68')));_0x47043f[_0xd425('0x7')](_0xd425('0x69'),require(_0xd425('0x6a')));_0x47043f[_0xd425('0x7')](_0xd425('0x6b'),require(_0xd425('0x6c')));_0x47043f['use'](_0xd425('0x6d'),require(_0xd425('0x6e')));_0x47043f['use'](_0xd425('0x6f'),require('./api/cannedAnswer'));_0x47043f['use'](_0xd425('0x70'),require('./api/disposition'));_0x47043f[_0xd425('0x7')]('/api/conditions',require(_0xd425('0x71')));_0x47043f[_0xd425('0x7')](_0xd425('0x72'),require(_0xd425('0x73')));_0x47043f[_0xd425('0x7')]('/api/pauses',require(_0xd425('0x74')));_0x47043f['use'](_0xd425('0x75'),require('./api/cdr'));_0x47043f[_0xd425('0x7')](_0xd425('0x76'),require(_0xd425('0x77')));_0x47043f[_0xd425('0x7')](_0xd425('0x78'),require('./api/schedule'));_0x47043f[_0xd425('0x7')](_0xd425('0x79'),require(_0xd425('0x7a')));_0x47043f[_0xd425('0x7')](_0xd425('0x7b'),require('./api/tag'));_0x47043f[_0xd425('0x7')](_0xd425('0x7c'),require(_0xd425('0x7d')));_0x47043f[_0xd425('0x7')](_0xd425('0x7e'),require(_0xd425('0x7f')));_0x47043f['use'](_0xd425('0x80'),require(_0xd425('0x81')));_0x47043f['use'](_0xd425('0x82'),require(_0xd425('0x83')));_0x47043f[_0xd425('0x7')](_0xd425('0x84'),require('./api/integrationReport'));_0x47043f[_0xd425('0x7')](_0xd425('0x85'),require(_0xd425('0x86')));_0x47043f[_0xd425('0x7')](_0xd425('0x87'),require('./api/analyticDefaultReport'));_0x47043f['use'](_0xd425('0x88'),require('./api/analyticExtractedReport'));_0x47043f[_0xd425('0x7')](_0xd425('0x89'),require('./api/analyticMetric'));_0x47043f[_0xd425('0x7')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x47043f[_0xd425('0x7')](_0xd425('0x8a'),require(_0xd425('0x8b')));_0x47043f[_0xd425('0x7')](_0xd425('0x8c'),require(_0xd425('0x8d')));_0x47043f[_0xd425('0x7')](_0xd425('0x8e'),require('./api/intSalesforceConfiguration'));_0x47043f[_0xd425('0x7')](_0xd425('0x8f'),require(_0xd425('0x90')));_0x47043f[_0xd425('0x7')](_0xd425('0x91'),require(_0xd425('0x92')));_0x47043f[_0xd425('0x7')](_0xd425('0x93'),require('./api/intSugarcrmConfiguration'));_0x47043f['use']('/api/integrations/sugarcrm/fields',require(_0xd425('0x94')));_0x47043f[_0xd425('0x7')](_0xd425('0x95'),require(_0xd425('0x96')));_0x47043f['use']('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x47043f['use'](_0xd425('0x97'),require(_0xd425('0x98')));_0x47043f['use'](_0xd425('0x99'),require(_0xd425('0x9a')));_0x47043f[_0xd425('0x7')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x47043f[_0xd425('0x7')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x47043f['use'](_0xd425('0x9b'),require(_0xd425('0x9c')));_0x47043f[_0xd425('0x7')]('/api/integrations/zendesk/configurations',require(_0xd425('0x9d')));_0x47043f['use'](_0xd425('0x9e'),require(_0xd425('0x9f')));_0x47043f[_0xd425('0x7')](_0xd425('0xa0'),require(_0xd425('0xa1')));_0x47043f[_0xd425('0x7')](_0xd425('0xa2'),require(_0xd425('0xa3')));_0x47043f[_0xd425('0x7')]('/api/integrations/freshdesk/fields',require(_0xd425('0xa4')));_0x47043f[_0xd425('0x7')](_0xd425('0xa5'),require(_0xd425('0xa6')));_0x47043f['use']('/api/integrations/vtiger/configurations',require(_0xd425('0xa7')));_0x47043f[_0xd425('0x7')](_0xd425('0xa8'),require(_0xd425('0xa9')));_0x47043f[_0xd425('0x7')](_0xd425('0xaa'),require(_0xd425('0xab')));_0x47043f[_0xd425('0x7')](_0xd425('0xac'),require(_0xd425('0xad')));_0x47043f[_0xd425('0x7')](_0xd425('0xae'),require(_0xd425('0xaf')));_0x47043f[_0xd425('0x7')]('/api/integrations/dynamics365/accounts',require(_0xd425('0xb0')));_0x47043f[_0xd425('0x7')](_0xd425('0xb1'),require('./api/intDynamics365Configuration'));_0x47043f['use']('/api/integrations/dynamics365/fields',require(_0xd425('0xb2')));_0x47043f[_0xd425('0x7')](_0xd425('0xb3'),require('./api/intFreshsalesAccount'));_0x47043f[_0xd425('0x7')]('/api/integrations/freshsales/configurations',require(_0xd425('0xb4')));_0x47043f[_0xd425('0x7')](_0xd425('0xb5'),require('./api/intFreshsalesField'));_0x47043f[_0xd425('0x7')](_0xd425('0xb6'),require(_0xd425('0xb7')));_0x47043f[_0xd425('0x7')](_0xd425('0xb8'),require(_0xd425('0xb9')));_0x47043f[_0xd425('0x7')](_0xd425('0xba'),require(_0xd425('0xbb')));_0x47043f[_0xd425('0x7')](_0xd425('0xbc'),require(_0xd425('0xbd')));_0x47043f[_0xd425('0x7')](_0xd425('0xbe'),require(_0xd425('0xbf')));_0x47043f[_0xd425('0x7')](_0xd425('0xc0'),require(_0xd425('0xc1')));_0x47043f['use']('/api/sms/reports/queue',require(_0xd425('0xc2')));_0x47043f['use'](_0xd425('0xc3'),require(_0xd425('0xc4')));_0x47043f[_0xd425('0x7')](_0xd425('0xc5'),require('./api/squareReportDetail'));_0x47043f[_0xd425('0x7')](_0xd425('0xc6'),require(_0xd425('0xc7')));_0x47043f[_0xd425('0x7')](_0xd425('0xc8'),require(_0xd425('0xc9')));_0x47043f['use']('/api/square/odbc',require(_0xd425('0xca')));_0x47043f[_0xd425('0x7')]('/api/square/projects',require(_0xd425('0xcb')));_0x47043f['use'](_0xd425('0xcc'),require(_0xd425('0xcd')));_0x47043f[_0xd425('0x7')](_0xd425('0xce'),require(_0xd425('0xcf')));_0x47043f[_0xd425('0x7')](_0xd425('0xd0'),require('./api/team'));_0x47043f[_0xd425('0x7')](_0xd425('0xd1'),require(_0xd425('0xd2')));_0x47043f[_0xd425('0x7')](_0xd425('0xd3'),require('./api/campaign'));_0x47043f[_0xd425('0x7')](_0xd425('0xd4'),require('./api/migration'));_0x47043f[_0xd425('0x7')](_0xd425('0xd5'),require('./api/attachment'));_0x47043f[_0xd425('0x7')](_0xd425('0xd6'),require(_0xd425('0xd7')));_0x47043f[_0xd425('0x7')](_0xd425('0xd8'),require('./api/mailTransferReport'));_0x47043f[_0xd425('0x7')]('/api/chat/reports/transfer',require(_0xd425('0xd9')));_0x47043f[_0xd425('0x7')]('/api/fax/reports/transfer',require(_0xd425('0xda')));_0x47043f[_0xd425('0x7')](_0xd425('0xdb'),require(_0xd425('0xdc')));_0x47043f['use']('/api/sms/reports/transfer',require(_0xd425('0xdd')));_0x47043f[_0xd425('0x7')](_0xd425('0xde'),require('./api/cmList'));_0x47043f[_0xd425('0x7')](_0xd425('0xdf'),require('./api/voicePrefix'));_0x47043f[_0xd425('0x7')]('/api/userProfiles',require(_0xd425('0xe0')));_0x47043f[_0xd425('0x7')](_0xd425('0xe1'),require(_0xd425('0xe2')));_0x47043f['use']('/api/userProfile/resources',require(_0xd425('0xe3')));_0x47043f[_0xd425('0x7')]('/api/userNotifications',require(_0xd425('0xe4')));_0x47043f[_0xd425('0x7')]('/api/whatsapp/accounts',require(_0xd425('0xe5')));_0x47043f[_0xd425('0x7')](_0xd425('0xe6'),require(_0xd425('0xe7')));_0x47043f[_0xd425('0x7')](_0xd425('0xe8'),require(_0xd425('0xe9')));_0x47043f['use']('/api/whatsapp/messages',require(_0xd425('0xea')));_0x47043f['use'](_0xd425('0xeb'),require(_0xd425('0xec')));_0x47043f['use'](_0xd425('0xed'),require(_0xd425('0xee')));_0x47043f['use']('/api/whatsapp/queues',require(_0xd425('0xef')));_0x47043f[_0xd425('0x7')](_0xd425('0xf0'),require(_0xd425('0xf1')));_0x47043f[_0xd425('0x7')](_0xd425('0xf2'),require(_0xd425('0xf3')));_0x47043f[_0xd425('0x7')]('/api/user-settings',require(_0xd425('0xf4')));_0x47043f[_0xd425('0x7')]('/api/auth/local',require(_0xd425('0xf5')));_0x47043f[_0xd425('0x7')](_0xd425('0xf6'),require(_0xd425('0xf7')));_0x47043f[_0xd425('0x7')](_0xd425('0xf8'),require(_0xd425('0xf9')));_0x47043f[_0xd425('0x7')](_0xd425('0xfa'),require(_0xd425('0xfb')));_0x47043f[_0xd425('0x7')]('/api/rpc',require(_0xd425('0xfc')));_0x47043f['use']('/api/version',require(_0xd425('0xfd')));_0x47043f['use'](_0xd425('0xfe'),require(_0xd425('0xff')));_0x47043f[_0xd425('0x7')](_0xd425('0x100'),require(_0xd425('0x101')));_0x47043f[_0xd425('0x7')](_0xd425('0x102'),require('./api/webbar'));_0x47043f[_0xd425('0x7')](_0xd425('0x103'),clientSideLogs);_0x47043f[_0xd425('0x7')](_0xd425('0x104'),express[_0xd425('0x105')](path['join'](config[_0xd425('0x106')],_0xd425('0x104'))));_0x47043f[_0xd425('0x7')](_0xd425('0x107'),express[_0xd425('0x105')](path[_0xd425('0x108')](config[_0xd425('0x106')],_0xd425('0x107'))));_0x47043f[_0xd425('0x7')](_0xd425('0x109'),express[_0xd425('0x105')](path[_0xd425('0x108')](config['root'],_0xd425('0x109'))));_0x47043f['use'](_0xd425('0x10a'),express[_0xd425('0x105')](path[_0xd425('0x108')](config[_0xd425('0x106')],_0xd425('0x10b'),'3.0.0')));_0x47043f[_0xd425('0x7')](_0xd425('0x10c'),express[_0xd425('0x105')](path[_0xd425('0x108')](config[_0xd425('0x106')],_0xd425('0x10d'))));_0x47043f[_0xd425('0x10e')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xd425('0x10f')](errors[0x194]);_0x47043f['route']('/*')[_0xd425('0x10f')](function(_0x905e5d,_0x4a43a7){_0x4a43a7[_0xd425('0x110')](path[_0xd425('0x111')](_0x47043f['get'](_0xd425('0x112'))+_0xd425('0x113')));});return _0x47043f;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 2a87ef4..7d90640 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77d5=['http','rpc','port','localhost','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.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','server'];(function(_0x2296fb,_0x539fc3){var _0x417d32=function(_0x897cc7){while(--_0x897cc7){_0x2296fb['push'](_0x2296fb['shift']());}};_0x417d32(++_0x539fc3);}(_0x77d5,0x1b3));var _0x577d=function(_0x17d61b,_0x47b47){_0x17d61b=_0x17d61b-0x0;var _0x5e22e8=_0x77d5[_0x17d61b];return _0x5e22e8;};'use strict';var jayson=require(_0x577d('0x0'));var _=require('lodash');var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x51baff,_0x2a8245){var _0x531228={};_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x2')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x3')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x4')));_0x531228=_['merge'](_0x531228,require(_0x577d('0x5')));_0x531228=_['merge'](_0x531228,require(_0x577d('0x6')));_0x531228=_['merge'](_0x531228,require(_0x577d('0x7')));_0x531228=_[_0x577d('0x1')](_0x531228,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x8')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x9')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0xa')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0xb')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0xc')));_0x531228=_[_0x577d('0x1')](_0x531228,require('../api/mailServerIn/mailServerIn.rpc'));_0x531228=_[_0x577d('0x1')](_0x531228,require('../api/mailAccount/mailAccount.rpc'));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0xd')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0xe')));_0x531228=_[_0x577d('0x1')](_0x531228,require('../api/mailMessage/mailMessage.rpc'));_0x531228=_[_0x577d('0x1')](_0x531228,require('../api/mailApplication/mailApplication.rpc'));_0x531228=_[_0x577d('0x1')](_0x531228,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0xf')));_0x531228=_['merge'](_0x531228,require(_0x577d('0x10')));_0x531228=_[_0x577d('0x1')](_0x531228,require('../api/faxInteraction/faxInteraction.rpc'));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x11')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x12')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x13')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x14')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x15')));_0x531228=_['merge'](_0x531228,require(_0x577d('0x16')));_0x531228=_['merge'](_0x531228,require('../api/smsQueue/smsQueue.rpc'));_0x531228=_[_0x577d('0x1')](_0x531228,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x531228=_['merge'](_0x531228,require(_0x577d('0x17')));_0x531228=_['merge'](_0x531228,require(_0x577d('0x18')));_0x531228=_['merge'](_0x531228,require(_0x577d('0x19')));_0x531228=_['merge'](_0x531228,require(_0x577d('0x1a')));_0x531228=_[_0x577d('0x1')](_0x531228,require('../api/chatInteraction/chatInteraction.rpc'));_0x531228=_['merge'](_0x531228,require(_0x577d('0x1b')));_0x531228=_['merge'](_0x531228,require(_0x577d('0x1c')));_0x531228=_['merge'](_0x531228,require(_0x577d('0x1d')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x1e')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x1f')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x20')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x21')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x22')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x23')));_0x531228=_['merge'](_0x531228,require('../api/pause/pause.rpc'));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x24')));_0x531228=_[_0x577d('0x1')](_0x531228,require('../api/template/template.rpc'));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x25')));_0x531228=_['merge'](_0x531228,require('../api/variable/variable.rpc'));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x26')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x27')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x28')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x29')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x2a')));_0x531228=_[_0x577d('0x1')](_0x531228,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x2b')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x2c')));_0x531228=_[_0x577d('0x1')](_0x531228,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x2d')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x2e')));_0x531228=_['merge'](_0x531228,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x531228=_['merge'](_0x531228,require(_0x577d('0x2f')));_0x531228=_['merge'](_0x531228,require(_0x577d('0x30')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x31')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x32')));_0x531228=_[_0x577d('0x1')](_0x531228,require('../api/squareProject/squareProject.rpc'));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x33')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x34')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x35')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x36')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x37')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x38')));_0x531228=_['merge'](_0x531228,require(_0x577d('0x39')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x3a')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x3b')));_0x531228=_[_0x577d('0x1')](_0x531228,require(_0x577d('0x3c')));var _0x129ff=jayson[_0x577d('0x3d')](_0x531228)[_0x577d('0x3e')]();var _0x1139a3=config[_0x577d('0x3f')][_0x577d('0x40')]||config[_0x577d('0x40')]+0x1;var _0x15478b=config[_0x577d('0x3f')]['ip']||_0x577d('0x41');_0x129ff['on'](_0x577d('0x42'),function(_0x35ae5a){return _0x2a8245(_0x35ae5a);});_0x129ff[_0x577d('0x43')](_0x1139a3,_0x15478b,function(){console['log'](_0x577d('0x44'),_0x15478b,_0x1139a3);require(_0x577d('0x45'))[_0x577d('0x46')]();return _0x51baff('RPC\x20listening\x20on\x20'+_0x15478b+':'+_0x1139a3);});});}; \ No newline at end of file +var _0x985b=['../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.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/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc'];(function(_0x327dd4,_0x546e39){var _0x27ba17=function(_0x5d42bf){while(--_0x5d42bf){_0x327dd4['push'](_0x327dd4['shift']());}};_0x27ba17(++_0x546e39);}(_0x985b,0x81));var _0xb985=function(_0x138a7b,_0x5ca82c){_0x138a7b=_0x138a7b-0x0;var _0x5bdd4c=_0x985b[_0x138a7b];return _0x5bdd4c;};'use strict';var jayson=require(_0xb985('0x0'));var _=require(_0xb985('0x1'));var config=require(_0xb985('0x2'));exports[_0xb985('0x3')]=function(){return new Promise(function(_0x4491f8,_0x3b4be6){var _0x3ae4c7={};_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x5')));_0x3ae4c7=_['merge'](_0x3ae4c7,require('../api/voiceExtension/voiceExtension.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/voiceQueue/voiceQueue.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/voiceRecording/voiceRecording.rpc'));_0x3ae4c7=_['merge'](_0x3ae4c7,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x6')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x7')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x8')));_0x3ae4c7=_['merge'](_0x3ae4c7,require(_0xb985('0x9')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/trunk/trunk.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x3ae4c7=_['merge'](_0x3ae4c7,require(_0xb985('0xa')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0xb')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0xc')));_0x3ae4c7=_['merge'](_0x3ae4c7,require(_0xb985('0xd')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/mailInteraction/mailInteraction.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/mailMessage/mailMessage.rpc'));_0x3ae4c7=_['merge'](_0x3ae4c7,require(_0xb985('0xe')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0xf')));_0x3ae4c7=_['merge'](_0x3ae4c7,require('../api/faxAccount/faxAccount.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/faxApplication/faxApplication.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x10')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x11')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x12')));_0x3ae4c7=_['merge'](_0x3ae4c7,require(_0xb985('0x13')));_0x3ae4c7=_['merge'](_0x3ae4c7,require(_0xb985('0x14')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/smsInteraction/smsInteraction.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/smsMessage/smsMessage.rpc'));_0x3ae4c7=_['merge'](_0x3ae4c7,require(_0xb985('0x15')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x16')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x17')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x18')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x19')));_0x3ae4c7=_['merge'](_0x3ae4c7,require(_0xb985('0x1a')));_0x3ae4c7=_['merge'](_0x3ae4c7,require(_0xb985('0x1b')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x1c')));_0x3ae4c7=_['merge'](_0x3ae4c7,require(_0xb985('0x1d')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x1e')));_0x3ae4c7=_['merge'](_0x3ae4c7,require(_0xb985('0x1f')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x20')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x21')));_0x3ae4c7=_['merge'](_0x3ae4c7,require(_0xb985('0x22')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/interval/interval.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x23')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x24')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/template/template.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x25')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x26')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x27')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x3ae4c7=_['merge'](_0x3ae4c7,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x28')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x29')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x3ae4c7=_['merge'](_0x3ae4c7,require(_0xb985('0x2a')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x2b')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/squareReport/squareReport.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x2c')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/setting/setting.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/squareOdbc/squareOdbc.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/squareProject/squareProject.rpc'));_0x3ae4c7=_['merge'](_0x3ae4c7,require(_0xb985('0x2d')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x2e')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require(_0xb985('0x2f')));_0x3ae4c7=_['merge'](_0x3ae4c7,require('../api/attachment/attachment.rpc'));_0x3ae4c7=_['merge'](_0x3ae4c7,require(_0xb985('0x30')));_0x3ae4c7=_['merge'](_0x3ae4c7,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x3ae4c7=_['merge'](_0x3ae4c7,require(_0xb985('0x31')));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x3ae4c7=_[_0xb985('0x4')](_0x3ae4c7,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x1fde6c=jayson[_0xb985('0x32')](_0x3ae4c7)['http']();var _0x58c325=config[_0xb985('0x33')][_0xb985('0x34')]||config['port']+0x1;var _0xd5215e=config[_0xb985('0x33')]['ip']||'localhost';_0x1fde6c['on'](_0xb985('0x35'),function(_0x5023ca){return _0x3b4be6(_0x5023ca);});_0x1fde6c[_0xb985('0x3')](_0x58c325,_0xd5215e,function(){console[_0xb985('0x36')](_0xb985('0x37'),_0xd5215e,_0x58c325);require('../config/triggers')[_0xb985('0x38')]();return _0x4491f8('RPC\x20listening\x20on\x20'+_0xd5215e+':'+_0x58c325);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 95ff0a2..8696b62 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 _0x9d0c=['setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','continueAt','extension','setPriority','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','call','utf8','setTimeout','setEncoding','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','result=','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','write','inherits','sendRequest','sync','prototype','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join'];(function(_0x27fa5c,_0xdd6362){var _0xd03a11=function(_0x879069){while(--_0x879069){_0x27fa5c['push'](_0x27fa5c['shift']());}};_0xd03a11(++_0xdd6362);}(_0x9d0c,0xb9));var _0xc9d0=function(_0x4b26b5,_0x4f71fd){_0x4b26b5=_0x4b26b5-0x0;var _0x4dec71=_0x9d0c[_0x4b26b5];return _0x4dec71;};'use strict';var util=require(_0xc9d0('0x0'));var _=require(_0xc9d0('0x1'));var EventEmitter=require(_0xc9d0('0x2'))[_0xc9d0('0x3')];var AGIReply=require('./reply');var AGIError=require(_0xc9d0('0x4'));function AGIChannel(_0x5295f2){var _0x20b3a4=this,_0x130c3e=new AGIReply(),_0x1ebd5c=![],_0x2fd21={};EventEmitter[_0xc9d0('0x5')](_0x20b3a4);_0x5295f2['setEncoding'](_0xc9d0('0x6'));_0x5295f2[_0xc9d0('0x7')](0x8*0x3c*0x3c*0x3e8);_0x130c3e[_0xc9d0('0x8')](_0xc9d0('0x6'));_0x130c3e['on'](_0xc9d0('0x9'),function(_0x46a237){for(var _0x1702c8 in _0x46a237){_0x20b3a4[_0x1702c8]=_0x46a237[_0x1702c8];}_0x20b3a4[_0xc9d0('0xa')](_0xc9d0('0xb'));});_0x130c3e['on'](_0xc9d0('0xc'),function(_0x30ec67){if(_0x30ec67[_0xc9d0('0xd')]()==_0xc9d0('0xe')){_0x20b3a4[_0xc9d0('0xa')](_0xc9d0('0xe'));return;}if(_0x30ec67[_0xc9d0('0xf')](0x0,0xb)==_0xc9d0('0x10')){_0x1ebd5c=!![];}if(_0x1ebd5c){_0x2fd21['rx']+=_0x30ec67+'\x0a';if(_0x30ec67[_0xc9d0('0x11')](_0xc9d0('0x12'))!=-0x1){_0x1ebd5c=![];}}else{_0x2fd21['rx']=_0x30ec67;}if(_0x1ebd5c){return;}if(typeof _0x2fd21['cb']==_0xc9d0('0x13')){var _0x3df90d=_0x2fd21['rx']['substring'](0x0,0x3),_0x9a8a55=null,_0x1c147a=null;_0x3df90d=parseInt(_0x3df90d);if(isNaN(_0x3df90d)){_0x2fd21['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x3df90d!=0xc8){_0x2fd21['cb'](null,{'code':_0x3df90d,'result':-0x1,'extra':'KO'});return;}_0x9a8a55=_0x2fd21['rx'][_0xc9d0('0xf')](0x4)[_0xc9d0('0x14')](_0xc9d0('0x15'),'');if(_0x9a8a55[_0xc9d0('0x16')]('\x20')!=-0x1){_0x9a8a55=_0x9a8a55[_0xc9d0('0x17')](0x0,_0x9a8a55[_0xc9d0('0x16')]('\x20'));}if(_[_0xc9d0('0x18')](_0x9a8a55,'-1')){_0x9a8a55=parseInt(_0x9a8a55);}_0x1c147a=_0x2fd21['rx'][_0xc9d0('0x19')]('\x20');if(_0x1c147a[_0xc9d0('0x1a')]==0x3){_0x1c147a=_0x1c147a[0x2][_0xc9d0('0xf')](0x1,_0x1c147a[0x2][_0xc9d0('0x1a')]-0x1);}else if(_0x1c147a[_0xc9d0('0x1a')]>0x3){var _0x2e4b16=/\((.+)\)/;var _0x214d63=_0x2fd21['rx']['match'](_0x2e4b16);if(_0x214d63){_0x1c147a=_0x214d63[0x1];}else{_0x1c147a=null;}}else{_0x1c147a=null;}_0x2fd21['cb'](null,{'code':_0x3df90d,'result':_0x9a8a55,'extra':_0x1c147a});}});_0x5295f2['on'](_0xc9d0('0x1b'),function(_0x5c1d84){_0x20b3a4['emit'](_0xc9d0('0x1b'),new AGIError(_0xc9d0('0x1c'),_0x5c1d84['code']));});_0x5295f2['on'](_0xc9d0('0x1d'),function(){_0x20b3a4[_0xc9d0('0xa')](_0xc9d0('0x1d'),new AGIError(_0xc9d0('0x1e')));});_0x5295f2['on'](_0xc9d0('0x1f'),function(){_0x20b3a4[_0xc9d0('0xa')]('timeout',new AGIError(_0xc9d0('0x20')));_0x5295f2[_0xc9d0('0x21')]();});_0x5295f2['pipe'](_0x130c3e);this['command']=function(_0x4d4916,_0x5b489a){var _0x4d4916=_0x4d4916||'',_0x5b489a=typeof _0x5b489a==_0xc9d0('0x13')?_0x5b489a:new Function();_0x2fd21={'tx':_0x4d4916,'rx':'','cb':_0x5b489a};_0x5295f2[_0xc9d0('0x22')](_0x4d4916+'\x0a');},this[_0xc9d0('0x1d')]=function(){_0x5295f2['destroy']();};}util[_0xc9d0('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xc9d0('0x24')]=function(_0xd12b9a){return this['command'][_0xc9d0('0x25')](this,_0xd12b9a);};AGIChannel[_0xc9d0('0x26')]['answer']=function(){return this[_0xc9d0('0x24')](_0xc9d0('0x27'));};AGIChannel[_0xc9d0('0x26')][_0xc9d0('0x28')]=function(_0x11bc03,_0x2b1863,_0x27b6cf){_0x11bc03=_0x11bc03===undefined?'beep':_0x11bc03;_0x2b1863=_0x2b1863===undefined?'5':_0x2b1863;_0x27b6cf=_0x27b6cf===undefined?'1':_0x27b6cf;return this[_0xc9d0('0x24')](util[_0xc9d0('0x29')](_0xc9d0('0x2a'),_0x11bc03,_0x2b1863*0x3e8,_0x27b6cf));};AGIChannel[_0xc9d0('0x26')][_0xc9d0('0x2b')]=function(_0x132d66){_0x132d66=_0x132d66||_0xc9d0('0x2c');return this[_0xc9d0('0x24')](util[_0xc9d0('0x29')](_0xc9d0('0x2d'),_0x132d66));};AGIChannel[_0xc9d0('0x26')][_0xc9d0('0x2e')]=function(_0x399adf,_0x4bcc09){if(_[_0xc9d0('0x2f')](_0x4bcc09)){return this[_0xc9d0('0x24')](util[_0xc9d0('0x29')]('EXEC\x20%s\x20%s',_0x399adf,_0x4bcc09[_0xc9d0('0x30')](',')));}return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x399adf,_0x4bcc09));};AGIChannel[_0xc9d0('0x26')][_0xc9d0('0x31')]=function(_0x1b9262){return this['sendRequest'](util[_0xc9d0('0x29')](_0xc9d0('0x32'),_0x1b9262));};AGIChannel[_0xc9d0('0x26')][_0xc9d0('0x33')]=function(_0x468cd3){return this[_0xc9d0('0x24')](util[_0xc9d0('0x29')](_0xc9d0('0x34'),_0x468cd3));};AGIChannel[_0xc9d0('0x26')]['setPriority']=function(_0x5638cf){return this['sendRequest'](util['format'](_0xc9d0('0x35'),_0x5638cf));};AGIChannel[_0xc9d0('0x26')][_0xc9d0('0xe')]=function(){return this['sendRequest'](_0xc9d0('0x36'));};AGIChannel['prototype'][_0xc9d0('0x37')]=function(_0x552297,_0x546796){var _0x9fb9d7=_[_0xc9d0('0x38')](_0x546796)||_['isNumber'](_0x546796)?_0x546796['toString']():_0x546796;return this[_0xc9d0('0x24')](util[_0xc9d0('0x29')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x552297,_0x9fb9d7?_0x9fb9d7[_0xc9d0('0x39')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xc9d0('0x26')][_0xc9d0('0x3a')]=function(_0x492257,_0x5e60dd){return this[_0xc9d0('0x24')](util[_0xc9d0('0x29')](_0xc9d0('0x3b'),_0x492257,_0x5e60dd));};AGIChannel[_0xc9d0('0x26')][_0xc9d0('0x3c')]=function(_0x5c644e,_0x344782){return this[_0xc9d0('0x24')](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0x5c644e,_0x344782));};AGIChannel['prototype'][_0xc9d0('0x3d')]=function(_0x57f3e2,_0x5bdef6){return this[_0xc9d0('0x24')](util[_0xc9d0('0x29')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x57f3e2,_0x5bdef6));};AGIChannel[_0xc9d0('0x26')][_0xc9d0('0x3e')]=function(_0x27ee5c,_0xf7ebd6,_0x426e4b){_0xf7ebd6=_0xf7ebd6||this[_0xc9d0('0x3f')];_0x426e4b=_0x426e4b||0x1;this[_0xc9d0('0x31')](_0x27ee5c);this[_0xc9d0('0x33')](_0xf7ebd6);this[_0xc9d0('0x40')](_0x426e4b);return this[_0xc9d0('0x2b')](util[_0xc9d0('0x29')]('GOTO\x20%s\x20%s\x20%s',_0x27ee5c,_0xf7ebd6,_0x426e4b));};AGIChannel['prototype'][_0xc9d0('0x41')]=function(_0x5030ce){return this['sendRequest'](util[_0xc9d0('0x29')](_0xc9d0('0x42'),_0x5030ce));};AGIChannel['prototype'][_0xc9d0('0x43')]=function(_0xd818ff,_0x3aa617,_0x46e879,_0x79daef,_0x15a930,_0x49df26){_0x3aa617=_0x3aa617||'wav';_0x46e879=_0x46e879||'';_0x79daef=_0x79daef===undefined?-0x1:_0x79daef==='-1'?-0x1:_0x79daef*0x3e8;_0x15a930=_0x15a930===undefined?'':'s='+_0x15a930;_0x49df26=_0x49df26?_0xc9d0('0x44'):'';return this[_0xc9d0('0x24')](util[_0xc9d0('0x29')](_0xc9d0('0x45'),_0xd818ff,_0x3aa617,_0x46e879,_0x79daef,_0x49df26,_0x15a930));};AGIChannel[_0xc9d0('0x26')][_0xc9d0('0x46')]=function(_0x3929b1,_0x3693d6){_0x3693d6=_0x3693d6||'';return this[_0xc9d0('0x24')](util[_0xc9d0('0x29')](_0xc9d0('0x47'),_0x3929b1,_0x3693d6));};AGIChannel[_0xc9d0('0x26')][_0xc9d0('0x48')]=function(_0x5ea6f3){return this[_0xc9d0('0x2e')]('AGI',_0x5ea6f3);};AGIChannel['prototype'][_0xc9d0('0x49')]=function(_0x22bf1d){return this[_0xc9d0('0x2e')](_0xc9d0('0x4a'),_0x22bf1d);};AGIChannel[_0xc9d0('0x26')][_0xc9d0('0x1b')]=function(_0x2c0a6f,_0x5c2532){this[_0xc9d0('0x2b')](util[_0xc9d0('0x29')](_0xc9d0('0x4b'),_0x2c0a6f['id'],_0x2c0a6f[_0xc9d0('0x4c')],_0x5c2532));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xc9d0('0x4d')]=AGIChannel; \ No newline at end of file +var _0xc591=['toLowerCase','hangup','substring','520-Invalid','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sendRequest','sync','answer','ANSWER','getData','beep','format','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','setExtension','SET\x20EXTENSION\x20%s','prototype','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','line'];(function(_0x236c92,_0x1f9915){var _0x2f0e76=function(_0x2e5298){while(--_0x2e5298){_0x236c92['push'](_0x236c92['shift']());}};_0x2f0e76(++_0x1f9915);}(_0xc591,0xe0));var _0x1c59=function(_0x414a33,_0x5bf179){_0x414a33=_0x414a33-0x0;var _0x1922bd=_0xc591[_0x414a33];return _0x1922bd;};'use strict';var util=require(_0x1c59('0x0'));var _=require(_0x1c59('0x1'));var EventEmitter=require(_0x1c59('0x2'))[_0x1c59('0x3')];var AGIReply=require(_0x1c59('0x4'));var AGIError=require(_0x1c59('0x5'));function AGIChannel(_0x38a5f6){var _0x1bde30=this,_0x63cdb0=new AGIReply(),_0x4e550b=![],_0x334f5d={};EventEmitter[_0x1c59('0x6')](_0x1bde30);_0x38a5f6[_0x1c59('0x7')](_0x1c59('0x8'));_0x38a5f6[_0x1c59('0x9')](0x8*0x3c*0x3c*0x3e8);_0x63cdb0[_0x1c59('0x7')](_0x1c59('0x8'));_0x63cdb0['on'](_0x1c59('0xa'),function(_0x1a2be6){for(var _0x5d891f in _0x1a2be6){_0x1bde30[_0x5d891f]=_0x1a2be6[_0x5d891f];}_0x1bde30[_0x1c59('0xb')]('ready');});_0x63cdb0['on'](_0x1c59('0xc'),function(_0x3c9b0d){if(_0x3c9b0d[_0x1c59('0xd')]()=='hangup'){_0x1bde30[_0x1c59('0xb')](_0x1c59('0xe'));return;}if(_0x3c9b0d[_0x1c59('0xf')](0x0,0xb)==_0x1c59('0x10')){_0x4e550b=!![];}if(_0x4e550b){_0x334f5d['rx']+=_0x3c9b0d+'\x0a';if(_0x3c9b0d['search']('520\x20End\x20of\x20proper')!=-0x1){_0x4e550b=![];}}else{_0x334f5d['rx']=_0x3c9b0d;}if(_0x4e550b){return;}if(typeof _0x334f5d['cb']==_0x1c59('0x11')){var _0x1f2be0=_0x334f5d['rx'][_0x1c59('0xf')](0x0,0x3),_0x24ec3d=null,_0x47bfc7=null;_0x1f2be0=parseInt(_0x1f2be0);if(isNaN(_0x1f2be0)){_0x334f5d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1c59('0x12')});return;}if(_0x1f2be0!=0xc8){_0x334f5d['cb'](null,{'code':_0x1f2be0,'result':-0x1,'extra':'KO'});return;}_0x24ec3d=_0x334f5d['rx'][_0x1c59('0xf')](0x4)[_0x1c59('0x13')](_0x1c59('0x14'),'');if(_0x24ec3d[_0x1c59('0x15')]('\x20')!=-0x1){_0x24ec3d=_0x24ec3d[_0x1c59('0x16')](0x0,_0x24ec3d[_0x1c59('0x15')]('\x20'));}if(_[_0x1c59('0x17')](_0x24ec3d,'-1')){_0x24ec3d=parseInt(_0x24ec3d);}_0x47bfc7=_0x334f5d['rx'][_0x1c59('0x18')]('\x20');if(_0x47bfc7[_0x1c59('0x19')]==0x3){_0x47bfc7=_0x47bfc7[0x2]['substring'](0x1,_0x47bfc7[0x2][_0x1c59('0x19')]-0x1);}else if(_0x47bfc7['length']>0x3){var _0x2a7bcc=/\((.+)\)/;var _0x3c8e85=_0x334f5d['rx'][_0x1c59('0x1a')](_0x2a7bcc);if(_0x3c8e85){_0x47bfc7=_0x3c8e85[0x1];}else{_0x47bfc7=null;}}else{_0x47bfc7=null;}_0x334f5d['cb'](null,{'code':_0x1f2be0,'result':_0x24ec3d,'extra':_0x47bfc7});}});_0x38a5f6['on'](_0x1c59('0x1b'),function(_0x1f0aa6){_0x1bde30['emit'](_0x1c59('0x1b'),new AGIError(_0x1c59('0x1c'),_0x1f0aa6['code']));});_0x38a5f6['on'](_0x1c59('0x1d'),function(){_0x1bde30['emit']('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x38a5f6['on'](_0x1c59('0x1e'),function(){_0x1bde30['emit']('timeout',new AGIError(_0x1c59('0x1f')));_0x38a5f6[_0x1c59('0x20')]();});_0x38a5f6[_0x1c59('0x21')](_0x63cdb0);this[_0x1c59('0x22')]=function(_0x4e2f69,_0x892676){var _0x4e2f69=_0x4e2f69||'',_0x892676=typeof _0x892676==_0x1c59('0x11')?_0x892676:new Function();_0x334f5d={'tx':_0x4e2f69,'rx':'','cb':_0x892676};_0x38a5f6[_0x1c59('0x23')](_0x4e2f69+'\x0a');},this[_0x1c59('0x1d')]=function(){_0x38a5f6[_0x1c59('0x20')]();};}util[_0x1c59('0x24')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x1c59('0x25')]=function(_0x5460c7){return this[_0x1c59('0x22')][_0x1c59('0x26')](this,_0x5460c7);};AGIChannel['prototype'][_0x1c59('0x27')]=function(){return this[_0x1c59('0x25')](_0x1c59('0x28'));};AGIChannel['prototype'][_0x1c59('0x29')]=function(_0xcacad8,_0x454615,_0x48a4a3){_0xcacad8=_0xcacad8===undefined?_0x1c59('0x2a'):_0xcacad8;_0x454615=_0x454615===undefined?'5':_0x454615;_0x48a4a3=_0x48a4a3===undefined?'1':_0x48a4a3;return this[_0x1c59('0x25')](util[_0x1c59('0x2b')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0xcacad8,_0x454615*0x3e8,_0x48a4a3));};AGIChannel['prototype'][_0x1c59('0x2c')]=function(_0x4258e0){_0x4258e0=_0x4258e0||'NO\x20MESSAGE';return this[_0x1c59('0x25')](util[_0x1c59('0x2b')](_0x1c59('0x2d'),_0x4258e0));};AGIChannel['prototype'][_0x1c59('0x2e')]=function(_0x31c567,_0x5d82a8){if(_[_0x1c59('0x2f')](_0x5d82a8)){return this[_0x1c59('0x25')](util['format'](_0x1c59('0x30'),_0x31c567,_0x5d82a8['join'](',')));}return this[_0x1c59('0x25')](util[_0x1c59('0x2b')]('EXEC\x20%s\x20%s',_0x31c567,_0x5d82a8));};AGIChannel['prototype'][_0x1c59('0x31')]=function(_0x4671c9){return this[_0x1c59('0x25')](util[_0x1c59('0x2b')]('SET\x20CONTEXT\x20%s',_0x4671c9));};AGIChannel['prototype'][_0x1c59('0x32')]=function(_0x2ad98f){return this[_0x1c59('0x25')](util['format'](_0x1c59('0x33'),_0x2ad98f));};AGIChannel[_0x1c59('0x34')][_0x1c59('0x35')]=function(_0x1c262d){return this[_0x1c59('0x25')](util['format'](_0x1c59('0x36'),_0x1c262d));};AGIChannel[_0x1c59('0x34')][_0x1c59('0xe')]=function(){return this[_0x1c59('0x25')](_0x1c59('0x37'));};AGIChannel['prototype'][_0x1c59('0x38')]=function(_0x16be67,_0x305d67){var _0x1176a4=_['isBoolean'](_0x305d67)||_[_0x1c59('0x39')](_0x305d67)?_0x305d67[_0x1c59('0x3a')]():_0x305d67;return this['sendRequest'](util[_0x1c59('0x2b')](_0x1c59('0x3b'),_0x16be67,_0x1176a4?_0x1176a4['toString']()[_0x1c59('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1c59('0x34')][_0x1c59('0x3c')]=function(_0x3c281d,_0x28bd6c){return this['sendRequest'](util['format'](_0x1c59('0x3d'),_0x3c281d,_0x28bd6c));};AGIChannel[_0x1c59('0x34')]['sayDigits']=function(_0x585616,_0x53b43d){return this[_0x1c59('0x25')](util[_0x1c59('0x2b')](_0x1c59('0x3e'),_0x585616,_0x53b43d));};AGIChannel[_0x1c59('0x34')][_0x1c59('0x3f')]=function(_0x2c4666,_0x177a5e){return this['sendRequest'](util[_0x1c59('0x2b')](_0x1c59('0x40'),_0x2c4666,_0x177a5e));};AGIChannel['prototype'][_0x1c59('0x41')]=function(_0x546d13,_0x3ab60b,_0x1e8276){_0x3ab60b=_0x3ab60b||this['extension'];_0x1e8276=_0x1e8276||0x1;this[_0x1c59('0x31')](_0x546d13);this['setExtension'](_0x3ab60b);this[_0x1c59('0x35')](_0x1e8276);return this[_0x1c59('0x2c')](util[_0x1c59('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x546d13,_0x3ab60b,_0x1e8276));};AGIChannel[_0x1c59('0x34')][_0x1c59('0x42')]=function(_0x149be8){return this[_0x1c59('0x25')](util[_0x1c59('0x2b')](_0x1c59('0x43'),_0x149be8));};AGIChannel[_0x1c59('0x34')][_0x1c59('0x44')]=function(_0x1929b7,_0x251ce1,_0x14a94,_0x106a42,_0x385326,_0x52a8b9){_0x251ce1=_0x251ce1||_0x1c59('0x45');_0x14a94=_0x14a94||'';_0x106a42=_0x106a42===undefined?-0x1:_0x106a42==='-1'?-0x1:_0x106a42*0x3e8;_0x385326=_0x385326===undefined?'':'s='+_0x385326;_0x52a8b9=_0x52a8b9?_0x1c59('0x46'):'';return this[_0x1c59('0x25')](util[_0x1c59('0x2b')](_0x1c59('0x47'),_0x1929b7,_0x251ce1,_0x14a94,_0x106a42,_0x52a8b9,_0x385326));};AGIChannel[_0x1c59('0x34')]['streamFile']=function(_0xff5674,_0x1b018a){_0x1b018a=_0x1b018a||'';return this[_0x1c59('0x25')](util[_0x1c59('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0xff5674,_0x1b018a));};AGIChannel[_0x1c59('0x34')][_0x1c59('0x48')]=function(_0x3afc0f){return this[_0x1c59('0x2e')](_0x1c59('0x49'),_0x3afc0f);};AGIChannel[_0x1c59('0x34')][_0x1c59('0x4a')]=function(_0x23a112){return this[_0x1c59('0x2e')](_0x1c59('0x4b'),_0x23a112);};AGIChannel[_0x1c59('0x34')][_0x1c59('0x1b')]=function(_0x5447a4,_0x821fd9){this['noop'](util[_0x1c59('0x2b')](_0x1c59('0x4c'),_0x5447a4['id'],_0x5447a4[_0x1c59('0x4d')],_0x821fd9));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1c59('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index d39799f..4e1fe49 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 _0xab84=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','util'];(function(_0x185402,_0x41dd38){var _0x445f47=function(_0x7ca9f){while(--_0x7ca9f){_0x185402['push'](_0x185402['shift']());}};_0x445f47(++_0x41dd38);}(_0xab84,0x13f));var _0x4ab8=function(_0x335045,_0x27900b){_0x335045=_0x335045-0x0;var _0x1636b4=_0xab84[_0x335045];return _0x1636b4;};'use strict';var util=require(_0x4ab8('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x4ab8('0x1'),'E_AGI_SERVER_CLOSE':_0x4ab8('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x4ab8('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x4ab8('0x4'),'E_AGI_SOCKET_ERROR':_0x4ab8('0x5'),'E_AGI_SOCKET_CLOSE':_0x4ab8('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x4ab8('0x7'),'E_AGI_COMMAND_EMPTY':_0x4ab8('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x4ab8('0x9'),'E_AGI_IVR_ENTRY':_0x4ab8('0xa')};function AGIError(_0x566ac2){var _0x566ac2=_0x566ac2||null,_0x3a04e2=_0x3a04e2||[],_0xb44d5c=0x1,_0x2b6c9f='';if(!error[_0x566ac2]){_0x566ac2='E_AGI_UNDEFINED';}_0x3a04e2[_0x4ab8('0xb')](error[_0x566ac2]);while(arguments[_0xb44d5c]){_0x3a04e2[_0x4ab8('0xb')](arguments[_0xb44d5c]);_0xb44d5c++;}_0x2b6c9f=util[_0x4ab8('0xc')][_0x4ab8('0xd')](util,_0x3a04e2);this[_0x4ab8('0xe')]=_0x2b6c9f;this[_0x4ab8('0xf')]=_0x566ac2;}module['exports']=AGIError; \ No newline at end of file +var _0x82c6=['Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','exports','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x50cf0f,_0x1da5bb){var _0x1bee60=function(_0x49ca18){while(--_0x49ca18){_0x50cf0f['push'](_0x50cf0f['shift']());}};_0x1bee60(++_0x1da5bb);}(_0x82c6,0x18f));var _0x682c=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x82c6[_0x139a3c];return _0x2b375b;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x682c('0x0'),'E_AGI_SERVER_CLOSE':_0x682c('0x1'),'E_AGI_SERVER_MAXCONNECTION':_0x682c('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0x682c('0x3'),'E_AGI_SOCKET_ERROR':_0x682c('0x4'),'E_AGI_SOCKET_CLOSE':_0x682c('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x682c('0x6'),'E_AGI_COMMAND_EMPTY':_0x682c('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x682c('0x8')};function AGIError(_0xdc3a69){var _0xdc3a69=_0xdc3a69||null,_0x58b7f1=_0x58b7f1||[],_0x14c442=0x1,_0xf589b5='';if(!error[_0xdc3a69]){_0xdc3a69=_0x682c('0x9');}_0x58b7f1[_0x682c('0xa')](error[_0xdc3a69]);while(arguments[_0x14c442]){_0x58b7f1[_0x682c('0xa')](arguments[_0x14c442]);_0x14c442++;}_0xf589b5=util[_0x682c('0xb')]['apply'](util,_0x58b7f1);this[_0x682c('0xc')]=_0xf589b5;this['name']=_0xdc3a69;}module[_0x682c('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 03b5ed0..acb50ef 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 _0xc4cf=['addEdge','push','size','relations','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','invalid','traverseBFS','includes','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','edges'];(function(_0x131232,_0x1ec36c){var _0x50110e=function(_0x29a56b){while(--_0x29a56b){_0x131232['push'](_0x131232['shift']());}};_0x50110e(++_0x1ec36c);}(_0xc4cf,0xc8));var _0xfc4c=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xc4cf[_0x576170];return _0x397c70;};'use strict';var _=require(_0xfc4c('0x0'));var logger=require(_0xfc4c('0x1'))(_0xfc4c('0x2'));var verticesWithRetry=[_0xfc4c('0x3'),_0xfc4c('0x4'),_0xfc4c('0x5')];var Graph=function(){this[_0xfc4c('0x6')]={};this['edges']={};this[_0xfc4c('0x7')]=0x0;};Graph[_0xfc4c('0x8')]['addVertex']=function(_0x49f5b1){this[_0xfc4c('0x6')][_0x49f5b1['id']]=_0x49f5b1;this[_0xfc4c('0x9')][_0x49f5b1['id']]=[];};Graph[_0xfc4c('0x8')][_0xfc4c('0xa')]=function(_0x500cfb,_0x2f5f5b,_0x34dc8b){this[_0xfc4c('0x9')][_0x500cfb][_0xfc4c('0xb')]({'target':_0x2f5f5b,'condition':_0x34dc8b});this[_0xfc4c('0x7')]+=0x1;};Graph[_0xfc4c('0x8')][_0xfc4c('0xc')]=function(){return _['size'](this['vertices']);};Graph['prototype'][_0xfc4c('0xd')]=function(){return this[_0xfc4c('0x7')];};Graph[_0xfc4c('0x8')][_0xfc4c('0xe')]=function(_0x300235){return this[_0xfc4c('0x6')][_0x300235];};Graph['prototype']['traverseBFS']=function(_0x4745a1,_0x202305){if(!this[_0xfc4c('0x6')][_0x4745a1]){return logger[_0xfc4c('0xf')](_0xfc4c('0x10'));}var _0x13abd9=_0x202305(this[_0xfc4c('0x6')][_0x4745a1]);if(!_0x13abd9){return logger[_0xfc4c('0xf')](_0xfc4c('0x11'));}if(this[_0xfc4c('0x9')][_0x4745a1][_0xfc4c('0x12')]===0x0){return logger[_0xfc4c('0xf')](_0xfc4c('0x13'));}for(var _0x39c492=0x0,_0x23208d=[],_0x7de453=![];_0x39c492\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','extension','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','catch','./server','connection','xml2json','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./graph','./vertices','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','format','[%s]\x20%s','name','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','uniqueid','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','source','target','addEdge','value','then','createSquareReport','agi_','substring','inspect','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','timeout','evtHangup','hangup','sync','production','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','response','code','result'];(function(_0x530b4f,_0x48c828){var _0x3f705a=function(_0x1cc0f2){while(--_0x1cc0f2){_0x530b4f['push'](_0x530b4f['shift']());}};_0x3f705a(++_0x48c828);}(_0x3cd3,0x112));var _0x33cd=function(_0xcb6e42,_0x514b15){_0xcb6e42=_0xcb6e42-0x0;var _0x108ed5=_0x3cd3[_0xcb6e42];return _0x108ed5;};'use strict';var parser=require(_0x33cd('0x0'));var _=require(_0x33cd('0x1'));var syncho=require(_0x33cd('0x2'));var util=require(_0x33cd('0x3'));var moment=require('moment');var config=require(_0x33cd('0x4'));var logger=require(_0x33cd('0x5'))(_0x33cd('0x6'));var utilLicense=require(_0x33cd('0x7'));var rpc=require(_0x33cd('0x8'));var mailRpc=require('./mailRpc');var Graph=require(_0x33cd('0x9'));var Vertices=require(_0x33cd('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x33cd('0x6')]=_['defaults'](config[_0x33cd('0x6')],{'ip':_0x33cd('0xb'),'port':0x11dd});function connectionHandler(_0x5e546f){process[_0x33cd('0xc')](function(){syncho(function(){try{setChannelVariables(_0x5e546f);agiHandler(_0x5e546f);}catch(_0x448f06){logger[_0x33cd('0xd')](_0x448f06[_0x33cd('0xe')]);}});});}function listeningHandler(){console['log'](_0x33cd('0xf'),config[_0x33cd('0x6')][_0x33cd('0x10')]);logger['info'](util['format'](_0x33cd('0x11'),config[_0x33cd('0x6')]['ip'],config[_0x33cd('0x6')][_0x33cd('0x10')]));}function errorHandler(_0x1e571c){if(_0x1e571c&&_0x1e571c['name']&&_0x1e571c[_0x33cd('0x12')]){logger[_0x33cd('0xd')](util[_0x33cd('0x13')](_0x33cd('0x14'),_0x1e571c[_0x33cd('0x15')],_0x1e571c['message']));}else{logger[_0x33cd('0xd')](util['format']('[ERROR]\x20%s',_0x1e571c[_0x33cd('0xe')]));}}function closeHandler(){logger[_0x33cd('0x16')](util['format'](_0x33cd('0x17'),this[_0x33cd('0x18')],this['calleridname'],this[_0x33cd('0x19')],this['dnid'],this[_0x33cd('0x1a')]));try{createSquareReport(this);}catch(_0x21d01b){logger[_0x33cd('0xd')](_0x21d01b['stack']);}}function timeoutHandler(){logger[_0x33cd('0x16')](util[_0x33cd('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x33cd('0x18')],this[_0x33cd('0x1b')],this[_0x33cd('0x19')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0x33cd('0x16')](util[_0x33cd('0x13')](_0x33cd('0x1c'),this[_0x33cd('0x18')],this[_0x33cd('0x1b')],this[_0x33cd('0x19')],this['dnid'],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x42f390){return parser['toJson'](_0x42f390,{'object':!![]})[_0x33cd('0x1d')][_0x33cd('0x1e')];}function addVertex(_0x500543,_0x35d292,_0x2992f3){_0x35d292[_0x33cd('0x1f')]=_0x2992f3;if(_0x35d292[_0x33cd('0x20')](_0x33cd('0x21'))){_0x35d292[_0x33cd('0x22')]=parseInt(_0x35d292[_0x33cd('0x21')],0xa);}_0x500543[_0x33cd('0x23')](_[_0x33cd('0x24')](_0x35d292,_0x33cd('0x25')));}function initGraph(_0x15e370,_0x38797f){var _0x4cbb0d=new Graph();for(var _0x5bb1ef in _0x15e370){if(_0x15e370[_0x33cd('0x20')](_0x5bb1ef)){if(_[_0x33cd('0x26')](_0x15e370[_0x5bb1ef])){for(var _0x49fb61=0x0;_0x49fb61<_0x15e370[_0x5bb1ef]['length'];_0x49fb61+=0x1){addVertex(_0x4cbb0d,_0x15e370[_0x5bb1ef][_0x49fb61],_0x5bb1ef);}}else{addVertex(_0x4cbb0d,_0x15e370[_0x5bb1ef],_0x5bb1ef);}}}for(var _0x4cda1d=0x0;_0x4cda1d<_0x38797f['length'];_0x4cda1d+=0x1){if(_0x38797f[_0x4cda1d][_0x33cd('0x27')]&&_0x38797f[_0x4cda1d][_0x33cd('0x28')]){_0x4cbb0d[_0x33cd('0x29')](_0x38797f[_0x4cda1d]['source'],_0x38797f[_0x4cda1d][_0x33cd('0x28')],_0x38797f[_0x4cda1d][_0x33cd('0x2a')]);}}return _0x4cbb0d;}function getSquareProject(_0x40eabe,_0x352037){rpc['getSquareProject'](_0x40eabe)[_0x33cd('0x2b')](function(_0x209120){_0x352037(null,_0x209120);})['catch'](function(_0x53c800){_0x352037(null,_0x53c800);});}function createSquareReport(_0x1ba2cc,_0x1aa079){rpc[_0x33cd('0x2c')](_0x1ba2cc)[_0x33cd('0x2b')](function(_0x418293){if(_0x1aa079){_0x1aa079(null,_0x418293);}})['catch'](function(_0x4a68c3){if(_0x1aa079){_0x1aa079(null,_0x4a68c3);}});}function setChannelVariables(_0x4a07fe){for(var _0x18bf52 in _0x4a07fe){if(_0x4a07fe[_0x33cd('0x20')](_0x18bf52)){if(_0x18bf52['indexOf'](_0x33cd('0x2d'))===0x0){_0x4a07fe[_0x18bf52[_0x33cd('0x2e')](0x4)]=_0x4a07fe[_0x18bf52];delete _0x4a07fe[_0x18bf52];}}}}function getLogFromObject(_0x4dd98d){return util[_0x33cd('0x2f')](_0x4dd98d,{'showHidden':![],'depth':null});}function agiHandler(_0x2febf8){var _0x282111,_0x5c540d,_0x313a2c,_0x124c57,_0x114c93;logger['debug'](_0x33cd('0x30'),JSON['stringify'](_0x2febf8,null,0x2));logger[_0x33cd('0x16')](util[_0x33cd('0x13')](_0x33cd('0x31'),_0x2febf8['arg_1'],_0x2febf8[_0x33cd('0x1b')],_0x2febf8[_0x33cd('0x19')],_0x2febf8[_0x33cd('0x32')],_0x2febf8['uniqueid']));_0x2febf8['on'](_0x33cd('0xd'),errorHandler);_0x2febf8['on']('close',closeHandler);_0x2febf8['on'](_0x33cd('0x33'),timeoutHandler);_0x2febf8[_0x33cd('0x34')]=![];_0x2febf8['on'](_0x33cd('0x35'),hangupHandler);var _0x53c392=getSquareProject[_0x33cd('0x36')](null,_0x2febf8[_0x33cd('0x18')]);if(_0x53c392){if(_0x53c392[_0x33cd('0x37')]){_0x282111=getRoot(_0x53c392[_0x33cd('0x37')]);if(_0x282111&&_0x282111[_0x33cd('0x38')]){logger[_0x33cd('0x39')](_0x33cd('0x1e'),JSON[_0x33cd('0x3a')](_0x282111,null,0x2));_0x2febf8[_0x33cd('0x3b')]=moment()['format'](_0x33cd('0x3c'));_0x5c540d=initGraph(_['omit'](_0x282111,_0x33cd('0x25')),_0x282111[_0x33cd('0x25')]);_0x313a2c=new Vertices(_0x2febf8,rpc,mailRpc);logger[_0x33cd('0x16')](util[_0x33cd('0x13')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2febf8[_0x33cd('0x18')],_0x2febf8[_0x33cd('0x1b')],_0x2febf8[_0x33cd('0x19')],_0x2febf8[_0x33cd('0x32')],_0x2febf8[_0x33cd('0x1a')]));_0x5c540d[_0x33cd('0x3d')](_0x282111['start']['id'],function(_0x4c2d30){try{_0x4c2d30=_0x313a2c['clear'](_0x4c2d30);logger['debug'](_0x33cd('0x3e'),JSON[_0x33cd('0x3a')](_0x4c2d30,null,0x2));if(_0x4c2d30[_0x33cd('0x1f')]===_0x33cd('0x3f')){logger['info'](_0x33cd('0x40'));_0x2febf8[_0x33cd('0x41')]=_0x4c2d30[_0x33cd('0x41')]||_0x2febf8[_0x33cd('0x41')];_0x2febf8['extension']=_0x4c2d30['extension'];_0x2febf8[_0x33cd('0x42')]=_0x4c2d30[_0x33cd('0x42')]?_0x4c2d30[_0x33cd('0x42')]-0x1:0x1;return null;}else if(_0x4c2d30&&_0x313a2c[_0x4c2d30[_0x33cd('0x1f')]]){_0x114c93=_0x313a2c[_0x4c2d30['agicommand']](_0x4c2d30);logger[_0x33cd('0x16')](_0x33cd('0x43'),JSON['stringify'](_0x114c93,null,0x2));if(_0x114c93&&_0x114c93[_0x33cd('0x44')]===AGI_CODE_SUCCESS&&_0x114c93[_0x33cd('0x45')]!==AGI_RESULT_ERROR&&!_0x2febf8[_0x33cd('0x34')]){logger[_0x33cd('0x39')](_0x33cd('0x43'),getLogFromObject(_0x114c93));return _[_0x33cd('0x46')](_0x114c93['result'])?null:_0x114c93[_0x33cd('0x45')][_0x33cd('0x47')]();}else{logger[_0x33cd('0xd')](_0x33cd('0x43'),getLogFromObject(_0x114c93));return null;}}else{logger[_0x33cd('0xd')](_0x33cd('0x48'));return null;}}catch(_0x301ecb){logger[_0x33cd('0xd')](_0x301ecb['stack']);return null;}});if(_0x282111[_0x33cd('0x49')]){logger[_0x33cd('0x16')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2febf8[_0x33cd('0x18')],_0x2febf8[_0x33cd('0x1b')],_0x2febf8[_0x33cd('0x19')],_0x2febf8[_0x33cd('0x32')],_0x2febf8[_0x33cd('0x1a')]));_0x5c540d['traverseBFS'](_0x282111[_0x33cd('0x49')]['id'],function(_0x47559e){try{_0x47559e=_0x313a2c['clear'](_0x47559e);logger[_0x33cd('0x39')](_0x33cd('0x3e'),JSON['stringify'](_0x47559e,null,0x2));if(_0x47559e&&_0x313a2c[_0x47559e[_0x33cd('0x1f')]]){_0x114c93=_0x313a2c[_0x47559e[_0x33cd('0x1f')]](_0x47559e);if(_0x114c93){logger[_0x33cd('0x39')](_0x33cd('0x43'),getLogFromObject(_0x114c93));return _[_0x33cd('0x46')](_0x114c93[_0x33cd('0x45')])?null:_0x114c93['result']['toString']();}else{logger[_0x33cd('0xd')](_0x33cd('0x43'),getLogFromObject(_0x114c93));return null;}}else{logger[_0x33cd('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x4218b2){logger['error'](_0x4218b2['stack']);return null;}});}logger[_0x33cd('0x16')](util[_0x33cd('0x13')](_0x33cd('0x4a'),_0x2febf8[_0x33cd('0x18')],_0x2febf8[_0x33cd('0x1b')],_0x2febf8[_0x33cd('0x19')],_0x2febf8[_0x33cd('0x32')],_0x2febf8[_0x33cd('0x1a')]));logger[_0x33cd('0x16')](util[_0x33cd('0x13')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x2febf8[_0x33cd('0x41')],_0x2febf8[_0x33cd('0x4b')],parseInt(_0x2febf8[_0x33cd('0x42')],0xa)+0x1));_0x2febf8[_0x33cd('0x4c')](_0x2febf8[_0x33cd('0x41')],_0x2febf8[_0x33cd('0x4b')],parseInt(_0x2febf8[_0x33cd('0x42')],0xa)+0x1);_0x2febf8[_0x33cd('0x4d')]();}}else{logger[_0x33cd('0xd')](util[_0x33cd('0x13')](_0x33cd('0x4e'),_0x2febf8[_0x33cd('0x18')]));_0x2febf8[_0x33cd('0x4c')](_0x2febf8[_0x33cd('0x41')],_0x2febf8[_0x33cd('0x4b')],parseInt(_0x2febf8['priority'],0xa)+0x1);_0x2febf8[_0x33cd('0x4d')]();}}else{logger['error'](util[_0x33cd('0x13')](_0x33cd('0x4f'),_0x2febf8['arg_1']));_0x2febf8[_0x33cd('0x4c')](_0x2febf8[_0x33cd('0x41')],_0x2febf8[_0x33cd('0x4b')],parseInt(_0x2febf8[_0x33cd('0x42')],0xa)+0x1);_0x2febf8[_0x33cd('0x4d')]();}}function main(){var _0x4cfbf1;return utilLicense['getLicense']()[_0x33cd('0x2b')](function(_0x3cd655){if(_0x3cd655){if(_0x3cd655[_0x33cd('0x50')]){if(_0x3cd655[_0x33cd('0x51')]&&_0x3cd655[_0x33cd('0x51')]>0x0){logger['info'](util[_0x33cd('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x3cd655[_0x33cd('0x51')]));_0x4cfbf1=_0x3cd655['callysquare'];}else{logger[_0x33cd('0x16')](_0x33cd('0x52'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x4cfbf1=-0x1;}}})[_0x33cd('0x53')](function(_0x374321){logger[_0x33cd('0xd')]('[LICENSE]',_0x374321[_0x33cd('0xe')]);})[_0x33cd('0x49')](function(){var _0x2da976=require(_0x33cd('0x54'))(config[_0x33cd('0x6')][_0x33cd('0x10')],config[_0x33cd('0x6')]['ip'],_0x4cfbf1);_0x2da976['on'](_0x33cd('0xd'),errorHandler);_0x2da976['on']('listening',listeningHandler);_0x2da976['on'](_0x33cd('0x55'),connectionHandler);_0x2da976['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xa68c=['[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','root','agicommand','hasOwnProperty','omit','mxCell','length','source','target','value','getSquareProject','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','production','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','isUndefined','response','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','name','format','[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','stack'];(function(_0xf111c5,_0x5cb5cb){var _0x30c271=function(_0x59d783){while(--_0x59d783){_0xf111c5['push'](_0xf111c5['shift']());}};_0x30c271(++_0x5cb5cb);}(_0xa68c,0x199));var _0xca68=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xa68c[_0x3ff085];return _0x2b68c3;};'use strict';var parser=require(_0xca68('0x0'));var _=require('lodash');var syncho=require(_0xca68('0x1'));var util=require(_0xca68('0x2'));var moment=require('moment');var config=require(_0xca68('0x3'));var logger=require(_0xca68('0x4'))('agi');var utilLicense=require(_0xca68('0x5'));var rpc=require(_0xca68('0x6'));var mailRpc=require(_0xca68('0x7'));var Graph=require(_0xca68('0x8'));var Vertices=require(_0xca68('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xca68('0xa')]=_[_0xca68('0xb')](config[_0xca68('0xa')],{'ip':_0xca68('0xc'),'port':0x11dd});function connectionHandler(_0x4fa7b3){process[_0xca68('0xd')](function(){syncho(function(){try{setChannelVariables(_0x4fa7b3);agiHandler(_0x4fa7b3);}catch(_0x1dcd7a){logger[_0xca68('0xe')](_0x1dcd7a['stack']);}});});}function listeningHandler(){console[_0xca68('0xf')](_0xca68('0x10'),config['agi'][_0xca68('0x11')]);logger[_0xca68('0x12')](util['format'](_0xca68('0x13'),config[_0xca68('0xa')]['ip'],config[_0xca68('0xa')][_0xca68('0x11')]));}function errorHandler(_0x278783){if(_0x278783&&_0x278783['name']&&_0x278783[_0xca68('0x14')]){logger[_0xca68('0xe')](util['format'](_0xca68('0x15'),_0x278783[_0xca68('0x16')],_0x278783['message']));}else{logger[_0xca68('0xe')](util[_0xca68('0x17')]('[ERROR]\x20%s',_0x278783['stack']));}}function closeHandler(){logger[_0xca68('0x12')](util[_0xca68('0x17')](_0xca68('0x18'),this[_0xca68('0x19')],this[_0xca68('0x1a')],this[_0xca68('0x1b')],this[_0xca68('0x1c')],this[_0xca68('0x1d')]));try{createSquareReport(this);}catch(_0x4e2c69){logger['error'](_0x4e2c69[_0xca68('0x1e')]);}}function timeoutHandler(){logger[_0xca68('0x12')](util[_0xca68('0x17')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xca68('0x19')],this['calleridname'],this['callerid'],this[_0xca68('0x1c')],this[_0xca68('0x1d')]));}function hangupHandler(){logger[_0xca68('0x12')](util['format'](_0xca68('0x1f'),this['arg_1'],this[_0xca68('0x1a')],this[_0xca68('0x1b')],this[_0xca68('0x1c')],this[_0xca68('0x1d')]));this['evtHangup']=!![];}function getRoot(_0x1b2681){return parser[_0xca68('0x20')](_0x1b2681,{'object':!![]})['mxGraphModel'][_0xca68('0x21')];}function addVertex(_0x49ebe3,_0x5bde96,_0x30da5f){_0x5bde96[_0xca68('0x22')]=_0x30da5f;if(_0x5bde96[_0xca68('0x23')]('retry')){_0x5bde96['maxRetry']=parseInt(_0x5bde96['retry'],0xa);}_0x49ebe3['addVertex'](_[_0xca68('0x24')](_0x5bde96,_0xca68('0x25')));}function initGraph(_0x309608,_0x492dcc){var _0x143852=new Graph();for(var _0xd32b5 in _0x309608){if(_0x309608[_0xca68('0x23')](_0xd32b5)){if(_['isArray'](_0x309608[_0xd32b5])){for(var _0xae3887=0x0;_0xae3887<_0x309608[_0xd32b5]['length'];_0xae3887+=0x1){addVertex(_0x143852,_0x309608[_0xd32b5][_0xae3887],_0xd32b5);}}else{addVertex(_0x143852,_0x309608[_0xd32b5],_0xd32b5);}}}for(var _0x4a07dd=0x0;_0x4a07dd<_0x492dcc[_0xca68('0x26')];_0x4a07dd+=0x1){if(_0x492dcc[_0x4a07dd][_0xca68('0x27')]&&_0x492dcc[_0x4a07dd][_0xca68('0x28')]){_0x143852['addEdge'](_0x492dcc[_0x4a07dd][_0xca68('0x27')],_0x492dcc[_0x4a07dd][_0xca68('0x28')],_0x492dcc[_0x4a07dd][_0xca68('0x29')]);}}return _0x143852;}function getSquareProject(_0x58355c,_0x48b838){rpc[_0xca68('0x2a')](_0x58355c)['then'](function(_0x76a93b){_0x48b838(null,_0x76a93b);})[_0xca68('0x2b')](function(_0x3c46a7){_0x48b838(null,_0x3c46a7);});}function createSquareReport(_0x4f733d,_0x4c046b){rpc[_0xca68('0x2c')](_0x4f733d)['then'](function(_0x500fe9){if(_0x4c046b){_0x4c046b(null,_0x500fe9);}})[_0xca68('0x2b')](function(_0x2da689){if(_0x4c046b){_0x4c046b(null,_0x2da689);}});}function setChannelVariables(_0x5e38af){for(var _0x3c9d53 in _0x5e38af){if(_0x5e38af['hasOwnProperty'](_0x3c9d53)){if(_0x3c9d53[_0xca68('0x2d')](_0xca68('0x2e'))===0x0){_0x5e38af[_0x3c9d53[_0xca68('0x2f')](0x4)]=_0x5e38af[_0x3c9d53];delete _0x5e38af[_0x3c9d53];}}}}function getLogFromObject(_0x1351cf){return util[_0xca68('0x30')](_0x1351cf,{'showHidden':![],'depth':null});}function agiHandler(_0x369cfb){var _0x440b45,_0x3f84c8,_0x56fc74,_0xe556da,_0x44022c;logger[_0xca68('0x31')](_0xca68('0x32'),JSON['stringify'](_0x369cfb,null,0x2));logger[_0xca68('0x12')](util['format'](_0xca68('0x33'),_0x369cfb[_0xca68('0x19')],_0x369cfb[_0xca68('0x1a')],_0x369cfb[_0xca68('0x1b')],_0x369cfb[_0xca68('0x1c')],_0x369cfb['uniqueid']));_0x369cfb['on'](_0xca68('0xe'),errorHandler);_0x369cfb['on'](_0xca68('0x34'),closeHandler);_0x369cfb['on']('timeout',timeoutHandler);_0x369cfb['evtHangup']=![];_0x369cfb['on'](_0xca68('0x35'),hangupHandler);var _0x3f6d74=getSquareProject[_0xca68('0x36')](null,_0x369cfb['arg_1']);if(_0x3f6d74){if(_0x3f6d74[_0xca68('0x37')]){_0x440b45=getRoot(_0x3f6d74['production']);if(_0x440b45&&_0x440b45['start']){logger[_0xca68('0x31')]('root',JSON[_0xca68('0x38')](_0x440b45,null,0x2));_0x369cfb[_0xca68('0x39')]=moment()[_0xca68('0x17')](_0xca68('0x3a'));_0x3f84c8=initGraph(_[_0xca68('0x24')](_0x440b45,'mxCell'),_0x440b45['mxCell']);_0x56fc74=new Vertices(_0x369cfb,rpc,mailRpc);logger[_0xca68('0x12')](util[_0xca68('0x17')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x369cfb['arg_1'],_0x369cfb['calleridname'],_0x369cfb[_0xca68('0x1b')],_0x369cfb[_0xca68('0x1c')],_0x369cfb['uniqueid']));_0x3f84c8[_0xca68('0x3b')](_0x440b45['start']['id'],function(_0x2d3a75){try{_0x2d3a75=_0x56fc74['clear'](_0x2d3a75);logger[_0xca68('0x31')](_0xca68('0x3c'),JSON[_0xca68('0x38')](_0x2d3a75,null,0x2));if(_0x2d3a75[_0xca68('0x22')]===_0xca68('0x3d')){logger[_0xca68('0x12')](_0xca68('0x3e'));_0x369cfb[_0xca68('0x3f')]=_0x2d3a75[_0xca68('0x3f')]||_0x369cfb[_0xca68('0x3f')];_0x369cfb[_0xca68('0x40')]=_0x2d3a75[_0xca68('0x40')];_0x369cfb[_0xca68('0x41')]=_0x2d3a75[_0xca68('0x41')]?_0x2d3a75[_0xca68('0x41')]-0x1:0x1;return null;}else if(_0x2d3a75&&_0x56fc74[_0x2d3a75['agicommand']]){_0x44022c=_0x56fc74[_0x2d3a75['agicommand']](_0x2d3a75);logger[_0xca68('0x12')]('response',JSON['stringify'](_0x44022c,null,0x2));if(_0x44022c&&_0x44022c[_0xca68('0x42')]===AGI_CODE_SUCCESS&&_0x44022c[_0xca68('0x43')]!==AGI_RESULT_ERROR&&!_0x369cfb['evtHangup']){logger[_0xca68('0x31')]('response',getLogFromObject(_0x44022c));return _[_0xca68('0x44')](_0x44022c[_0xca68('0x43')])?null:_0x44022c[_0xca68('0x43')]['toString']();}else{logger[_0xca68('0xe')](_0xca68('0x45'),getLogFromObject(_0x44022c));return null;}}else{logger[_0xca68('0xe')](_0xca68('0x46'));return null;}}catch(_0x175076){logger['error'](_0x175076[_0xca68('0x1e')]);return null;}});if(_0x440b45[_0xca68('0x47')]){logger['info'](util[_0xca68('0x17')](_0xca68('0x48'),_0x369cfb['arg_1'],_0x369cfb['calleridname'],_0x369cfb[_0xca68('0x1b')],_0x369cfb['dnid'],_0x369cfb['uniqueid']));_0x3f84c8['traverseBFS'](_0x440b45[_0xca68('0x47')]['id'],function(_0x22d0b4){try{_0x22d0b4=_0x56fc74[_0xca68('0x49')](_0x22d0b4);logger[_0xca68('0x31')](_0xca68('0x3c'),JSON['stringify'](_0x22d0b4,null,0x2));if(_0x22d0b4&&_0x56fc74[_0x22d0b4['agicommand']]){_0x44022c=_0x56fc74[_0x22d0b4['agicommand']](_0x22d0b4);if(_0x44022c){logger['debug'](_0xca68('0x45'),getLogFromObject(_0x44022c));return _[_0xca68('0x44')](_0x44022c['result'])?null:_0x44022c[_0xca68('0x43')][_0xca68('0x4a')]();}else{logger[_0xca68('0xe')](_0xca68('0x45'),getLogFromObject(_0x44022c));return null;}}else{logger[_0xca68('0xe')](_0xca68('0x46'));return null;}}catch(_0x401ed9){logger[_0xca68('0xe')](_0x401ed9[_0xca68('0x1e')]);return null;}});}logger[_0xca68('0x12')](util['format'](_0xca68('0x4b'),_0x369cfb[_0xca68('0x19')],_0x369cfb['calleridname'],_0x369cfb[_0xca68('0x1b')],_0x369cfb[_0xca68('0x1c')],_0x369cfb[_0xca68('0x1d')]));logger['info'](util[_0xca68('0x17')](_0xca68('0x4c'),_0x369cfb[_0xca68('0x3f')],_0x369cfb[_0xca68('0x40')],parseInt(_0x369cfb['priority'],0xa)+0x1));_0x369cfb[_0xca68('0x4d')](_0x369cfb['context'],_0x369cfb[_0xca68('0x40')],parseInt(_0x369cfb[_0xca68('0x41')],0xa)+0x1);_0x369cfb['close']();}}else{logger['error'](util[_0xca68('0x17')](_0xca68('0x4e'),_0x369cfb['arg_1']));_0x369cfb['continueAt'](_0x369cfb[_0xca68('0x3f')],_0x369cfb['extension'],parseInt(_0x369cfb['priority'],0xa)+0x1);_0x369cfb[_0xca68('0x34')]();}}else{logger['error'](util[_0xca68('0x17')](_0xca68('0x4f'),_0x369cfb[_0xca68('0x19')]));_0x369cfb['continueAt'](_0x369cfb[_0xca68('0x3f')],_0x369cfb[_0xca68('0x40')],parseInt(_0x369cfb[_0xca68('0x41')],0xa)+0x1);_0x369cfb[_0xca68('0x34')]();}}function main(){var _0x5c9d75;return utilLicense[_0xca68('0x50')]()['then'](function(_0x42128e){if(_0x42128e){if(_0x42128e['voice']){if(_0x42128e['callysquare']&&_0x42128e[_0xca68('0x51')]>0x0){logger[_0xca68('0x12')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x42128e[_0xca68('0x51')]));_0x5c9d75=_0x42128e[_0xca68('0x51')];}else{logger[_0xca68('0x12')](_0xca68('0x52'));}}else{logger[_0xca68('0x12')](_0xca68('0x53'));_0x5c9d75=-0x1;}}})[_0xca68('0x2b')](function(_0x25ff28){logger[_0xca68('0xe')](_0xca68('0x54'),_0x25ff28['stack']);})['finally'](function(){var _0x2cf711=require(_0xca68('0x55'))(config['agi']['port'],config[_0xca68('0xa')]['ip'],_0x5c9d75);_0x2cf711['on']('error',errorHandler);_0x2cf711['on'](_0xca68('0x56'),listeningHandler);_0x2cf711['on'](_0xca68('0x57'),connectionHandler);_0x2cf711['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 92e71bf..77610df 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 _0x44b6=['sendMailMessage','SendMail','jayson/promise','client','http','then','error','message','result','catch'];(function(_0x132887,_0x8a429e){var _0x4edd79=function(_0x58096b){while(--_0x58096b){_0x132887['push'](_0x132887['shift']());}};_0x4edd79(++_0x8a429e);}(_0x44b6,0x98));var _0x644b=function(_0x39ad4c,_0x2fa27e){_0x39ad4c=_0x39ad4c-0x0;var _0xf3314d=_0x44b6[_0x39ad4c];return _0xf3314d;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x644b('0x0'));var client=jayson[_0x644b('0x1')][_0x644b('0x2')]({'port':0x232b});function request(_0x1d9fee,_0x297f06){return new BPromise(function(_0x2137b0,_0x2df076){return client['request'](_0x1d9fee,_0x297f06)[_0x644b('0x3')](function(_0x5f5942){if(_0x5f5942[_0x644b('0x4')]){return _0x2df076(_0x5f5942[_0x644b('0x4')][_0x644b('0x5')]);}else{return _0x2137b0(_0x5f5942[_0x644b('0x6')]);}})[_0x644b('0x7')](function(_0x35fed8){return _0x2df076(_0x35fed8);});});}exports[_0x644b('0x8')]=function(_0x2733c7,_0x82fb8a){return request(_0x644b('0x9'),{'account':_0x2733c7,'message':_0x82fb8a});}; \ No newline at end of file +var _0x33af=['message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error'];(function(_0x599c44,_0x2fb16e){var _0x1d6cf6=function(_0x43f375){while(--_0x43f375){_0x599c44['push'](_0x599c44['shift']());}};_0x1d6cf6(++_0x2fb16e);}(_0x33af,0x13d));var _0xf33a=function(_0x913b85,_0x213182){_0x913b85=_0x913b85-0x0;var _0x1ce434=_0x33af[_0x913b85];return _0x1ce434;};'use strict';var BPromise=require(_0xf33a('0x0'));var jayson=require(_0xf33a('0x1'));var client=jayson[_0xf33a('0x2')][_0xf33a('0x3')]({'port':0x232b});function request(_0x59133b,_0x17d571){return new BPromise(function(_0x16164e,_0x44e98e){return client[_0xf33a('0x4')](_0x59133b,_0x17d571)[_0xf33a('0x5')](function(_0x1ad028){if(_0x1ad028['error']){return _0x44e98e(_0x1ad028[_0xf33a('0x6')][_0xf33a('0x7')]);}else{return _0x16164e(_0x1ad028[_0xf33a('0x8')]);}})[_0xf33a('0x9')](function(_0x3adfb1){return _0x44e98e(_0x3adfb1);});});}exports[_0xf33a('0xa')]=function(_0x4e5106,_0x5149c1){return request(_0xf33a('0xb'),{'account':_0x4e5106,'message':_0x5149c1});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index d395887..c524ac6 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 _0x3f2b=['split','slice','trim','emit','line','exports','util','Transform','call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','length'];(function(_0x4f2dce,_0x4be78a){var _0x17dacc=function(_0x23b579){while(--_0x23b579){_0x4f2dce['push'](_0x4f2dce['shift']());}};_0x17dacc(++_0x4be78a);}(_0x3f2b,0x1f4));var _0xb3f2=function(_0x430ef7,_0x550358){_0x430ef7=_0x430ef7-0x0;var _0x2d5703=_0x3f2b[_0x430ef7];return _0x2d5703;};'use strict';var util=require(_0xb3f2('0x0'));var Transform=require('stream')[_0xb3f2('0x1')];function AGIReply(_0x41e901){Transform[_0xb3f2('0x2')](this,_0x41e901);this['_localBuffer']='';this[_0xb3f2('0x3')]=![];}util[_0xb3f2('0x4')](AGIReply,Transform);AGIReply[_0xb3f2('0x5')][_0xb3f2('0x6')]=function(_0x4dc3f6,_0x58de6b,_0x4e3265){var _0x1be817='\x0a',_0x341b53=['\x0a\x0a',_0xb3f2('0x7')],_0x5f4564=-0x1,_0x2bbf7f=-0x1,_0x35e243='',_0x388539=0x0,_0x326c40='',_0x39fb4d='';this[_0xb3f2('0x8')]+=_0x4dc3f6[_0xb3f2('0x9')]();_0x326c40=this['_localBuffer'];if(!this[_0xb3f2('0x3')]){_0x388539=0x0;while(_0x341b53[_0x388539]){while((_0x2bbf7f=_0x326c40[_0xb3f2('0xa')](_0x341b53[_0x388539]))!=-0x1){_0x35e243=_0x341b53[_0x388539];_0x39fb4d=_0x326c40[_0xb3f2('0xb')](0x0,_0x2bbf7f);_0x326c40=_0x326c40[_0xb3f2('0xb')](_0x2bbf7f+_0x35e243[_0xb3f2('0xc')]);var _0x388edc=_0x39fb4d[_0xb3f2('0xd')](_0x1be817),_0x4fa00e=0x0,_0x4561e1={},_0x10bd9c='',_0x1fc7cf='',_0x14e3ec=-0x1;while(_0x388edc[_0x4fa00e]){_0x14e3ec=_0x388edc[_0x4fa00e][_0xb3f2('0xa')](':');if(_0x14e3ec!=-0x1){_0x10bd9c=_0x388edc[_0x4fa00e][_0xb3f2('0xe')](0x0,_0x14e3ec)[_0xb3f2('0xf')]();_0x1fc7cf=_0x388edc[_0x4fa00e]['slice'](_0x14e3ec+0x1)['trim']();if(_0x10bd9c['length']>0x0){_0x4561e1[_0x10bd9c]=_0x1fc7cf;}}else{}_0x4fa00e++;}this[_0xb3f2('0x10')]('headers',_0x4561e1);this[_0xb3f2('0x3')]=!![];}_0x388539++;}this['_localBuffer']=_0x326c40;}else{while((_0x5f4564=_0x326c40[_0xb3f2('0xa')](_0x1be817))!=-0x1){_0x39fb4d=_0x326c40[_0xb3f2('0xb')](0x0,_0x5f4564);this[_0xb3f2('0x10')](_0xb3f2('0x11'),_0x39fb4d);_0x326c40=_0x326c40[_0xb3f2('0xb')](_0x5f4564+_0x1be817[_0xb3f2('0xc')]);}this[_0xb3f2('0x8')]=_0x326c40;}_0x4e3265();};module[_0xb3f2('0x12')]=AGIReply; \ No newline at end of file +var _0x81a4=['line','exports','util','stream','Transform','_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','length','split','slice','trim','headers','emit'];(function(_0x4b7976,_0x55e10b){var _0x422298=function(_0x531d4b){while(--_0x531d4b){_0x4b7976['push'](_0x4b7976['shift']());}};_0x422298(++_0x55e10b);}(_0x81a4,0x1a6));var _0x481a=function(_0x2136d5,_0x4b0479){_0x2136d5=_0x2136d5-0x0;var _0x3bee2e=_0x81a4[_0x2136d5];return _0x3bee2e;};'use strict';var util=require(_0x481a('0x0'));var Transform=require(_0x481a('0x1'))[_0x481a('0x2')];function AGIReply(_0x712a73){Transform['call'](this,_0x712a73);this[_0x481a('0x3')]='';this['_inBody']=![];}util[_0x481a('0x4')](AGIReply,Transform);AGIReply[_0x481a('0x5')][_0x481a('0x6')]=function(_0x5ba2fa,_0x25c921,_0x3a6458){var _0x17d40e='\x0a',_0x14b819=['\x0a\x0a',_0x481a('0x7')],_0x4a5a92=-0x1,_0x13ed10=-0x1,_0x13b771='',_0x9b7dd5=0x0,_0xa68200='',_0x95b28d='';this['_localBuffer']+=_0x5ba2fa[_0x481a('0x8')]();_0xa68200=this[_0x481a('0x3')];if(!this[_0x481a('0x9')]){_0x9b7dd5=0x0;while(_0x14b819[_0x9b7dd5]){while((_0x13ed10=_0xa68200[_0x481a('0xa')](_0x14b819[_0x9b7dd5]))!=-0x1){_0x13b771=_0x14b819[_0x9b7dd5];_0x95b28d=_0xa68200[_0x481a('0xb')](0x0,_0x13ed10);_0xa68200=_0xa68200[_0x481a('0xb')](_0x13ed10+_0x13b771[_0x481a('0xc')]);var _0x174ecb=_0x95b28d[_0x481a('0xd')](_0x17d40e),_0x22a9dd=0x0,_0x29d4fa={},_0x507233='',_0x5838af='',_0x28a189=-0x1;while(_0x174ecb[_0x22a9dd]){_0x28a189=_0x174ecb[_0x22a9dd][_0x481a('0xa')](':');if(_0x28a189!=-0x1){_0x507233=_0x174ecb[_0x22a9dd][_0x481a('0xe')](0x0,_0x28a189)[_0x481a('0xf')]();_0x5838af=_0x174ecb[_0x22a9dd][_0x481a('0xe')](_0x28a189+0x1)['trim']();if(_0x507233[_0x481a('0xc')]>0x0){_0x29d4fa[_0x507233]=_0x5838af;}}else{}_0x22a9dd++;}this['emit'](_0x481a('0x10'),_0x29d4fa);this[_0x481a('0x9')]=!![];}_0x9b7dd5++;}this[_0x481a('0x3')]=_0xa68200;}else{while((_0x4a5a92=_0xa68200['indexOf'](_0x17d40e))!=-0x1){_0x95b28d=_0xa68200['substring'](0x0,_0x4a5a92);this[_0x481a('0x11')](_0x481a('0x12'),_0x95b28d);_0xa68200=_0xa68200[_0x481a('0xb')](_0x4a5a92+_0x17d40e[_0x481a('0xc')]);}this[_0x481a('0x3')]=_0xa68200;}_0x3a6458();};module[_0x481a('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 4eb2683..b6ffc71 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 _0xe77f=['createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','UnpauseUser','agentLogout','bluebird','moment','util','jayson/promise','http','request','then','message','result','catch','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','save_name','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','arg_1','arg_2','format'];(function(_0x5cf1a1,_0x1ab924){var _0x52cbcc=function(_0xdc1230){while(--_0xdc1230){_0x5cf1a1['push'](_0x5cf1a1['shift']());}};_0x52cbcc(++_0x1ab924);}(_0xe77f,0xba));var _0xfe77=function(_0x243660,_0x3674b0){_0x243660=_0x243660-0x0;var _0x55bb52=_0xe77f[_0x243660];return _0x55bb52;};'use strict';var BPromise=require(_0xfe77('0x0'));var moment=require(_0xfe77('0x1'));var _=require('lodash');var util=require(_0xfe77('0x2'));var jayson=require(_0xfe77('0x3'));var client=jayson['client'][_0xfe77('0x4')]({'port':0x2329});function request(_0xd99b0d,_0x55a414){return new BPromise(function(_0x150fc9,_0x406c8b){return client[_0xfe77('0x5')](_0xd99b0d,_0x55a414)[_0xfe77('0x6')](function(_0x130b85){if(_0x130b85['error']){return _0x406c8b(_0x130b85['error'][_0xfe77('0x7')]);}else{return _0x150fc9(_0x130b85[_0xfe77('0x8')]);}})[_0xfe77('0x9')](function(_0x1a2809){return _0x406c8b(_0x1a2809);});});}exports[_0xfe77('0xa')]=function(_0x38fcb2){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x38fcb2},'attributes':['production']}});};exports[_0xfe77('0xb')]=function(_0x1b2f58){return request(_0xfe77('0xc'),{'options':{'raw':![],'where':{'id':_0x1b2f58},'include':[{'model':_0xfe77('0xd'),'as':'Smtp'}],'attributes':['id',_0xfe77('0xe'),_0xfe77('0xf')]}});};exports[_0xfe77('0x10')]=function(_0x14704e){return request('ShowSquareProject',{'options':{'where':{'id':_0x14704e},'attributes':[_0xfe77('0xe')]}});};exports[_0xfe77('0x11')]=function(_0x17627f){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x17627f},'attributes':[_0xfe77('0xe')]}});};exports[_0xfe77('0x12')]=function(_0x51f692){return request(_0xfe77('0x13'),{'options':{'where':{'id':_0x51f692},'attributes':[_0xfe77('0xe')]}});};exports[_0xfe77('0x14')]=function(_0x28366f){return request(_0xfe77('0x15'),{'options':{'where':{'id':_0x28366f},'attributes':[_0xfe77('0x16')]}});};exports[_0xfe77('0x17')]=function(_0x359704){return request(_0xfe77('0x18'),{'options':{'where':{'id':_0x359704},'attributes':[_0xfe77('0xe')]}});};exports[_0xfe77('0x19')]=function(_0x84d3da){return request(_0xfe77('0x1a'),{'options':{'where':{'phone':_0x84d3da['phone']},'attributes':['id']}});};exports[_0xfe77('0x1b')]=function(_0x596f18){return request(_0xfe77('0x1c'),{'options':{'where':{'id':_0x596f18},'attributes':[_0xfe77('0xe')]}});};exports['getSoundById']=function(_0x347a14){return request('ShowSound',{'options':{'where':{'id':_0x347a14},'attributes':[_0xfe77('0x1d')]}});};exports['getIntervalById']=function(_0x57d6b1){return request(_0xfe77('0x1e'),{'options':{'raw':![],'where':{'id':_0x57d6b1},'include':[{'model':'Interval','as':_0xfe77('0x1f')}]}});};exports[_0xfe77('0x20')]=function(_0x1e37f0){return request(_0xfe77('0x21'),{'options':{'where':{'id':_0x1e37f0},'attributes':['id',_0xfe77('0xe')]}});};exports[_0xfe77('0x22')]=function(_0x160c44){return request(_0xfe77('0x23'),{'body':_0x160c44});};exports[_0xfe77('0x24')]=function(_0x21d660){return request(_0xfe77('0x25'),{'body':_0x21d660});};exports[_0xfe77('0x26')]=function(_0x5053f2){return request('CreateSquareReport',{'body':_['merge'](_0x5053f2,{'project_name':_0x5053f2[_0xfe77('0x27')],'prev_project_name':_0x5053f2[_0xfe77('0x28')]||'','is_subproject':_0x5053f2[_0xfe77('0x28')]?!![]:![],'leaveAt':moment()[_0xfe77('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xfe77('0x2a')]=function(_0x63d932){return request('CreateSquareRecording',{'body':_0x63d932});};exports[_0xfe77('0x2b')]=function(_0x14fb23){return request(_0xfe77('0x2c'),{'body':_0x14fb23});};exports[_0xfe77('0x2d')]=function(_0x352120){return request(_0xfe77('0x2e'),{'options':{'raw':![],'where':{'phone':_0x352120[_0xfe77('0x2f')],'ListId':_0x352120[_0xfe77('0x30')]}}})[_0xfe77('0x6')](function(_0x52cee8){if(_0x52cee8){return _0x52cee8;}return request(_0xfe77('0x31'),{'body':_0x352120});});};exports[_0xfe77('0x32')]=function(_0xb93a3d){return request(_0xfe77('0x33'),{'options':{'where':{'id':_0xb93a3d},'attributes':[_0xfe77('0xe')]}});};exports[_0xfe77('0x34')]=function(_0x530ce1,_0x5973f5){return request(_0xfe77('0x35'),{'body':{'interface':_0x5973f5},'options':{'where':_0x530ce1}});};exports['agentPause']=function(_0x191e44,_0x472f74,_0x74188a){return request(_0xfe77('0x36'),{'body':{'type':_0x472f74,'uniqueid':_0x74188a},'options':{'where':_0x191e44}});};exports['agentUnpause']=function(_0x2a5a71){return request(_0xfe77('0x37'),{'body':{},'options':{'where':_0x2a5a71}});};exports[_0xfe77('0x38')]=function(_0x431731){return request('LogoutUser',{'body':{},'options':{'where':_0x431731}});}; \ No newline at end of file +var _0xc818=['getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','getSoundById','ShowSound','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','then','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','client','http','request','error','message','catch','getSquareProject','ShowSquareProject','production'];(function(_0x25c798,_0x2a7956){var _0xd58e8c=function(_0x2dfee1){while(--_0x2dfee1){_0x25c798['push'](_0x25c798['shift']());}};_0xd58e8c(++_0x2a7956);}(_0xc818,0x1e3));var _0x8c81=function(_0x2c2105,_0x26f958){_0x2c2105=_0x2c2105-0x0;var _0x441787=_0xc818[_0x2c2105];return _0x441787;};'use strict';var BPromise=require(_0x8c81('0x0'));var moment=require(_0x8c81('0x1'));var _=require(_0x8c81('0x2'));var util=require(_0x8c81('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x8c81('0x4')][_0x8c81('0x5')]({'port':0x2329});function request(_0x40b19e,_0x7e329f){return new BPromise(function(_0x1a61ab,_0xb97ac){return client[_0x8c81('0x6')](_0x40b19e,_0x7e329f)['then'](function(_0x2c5966){if(_0x2c5966[_0x8c81('0x7')]){return _0xb97ac(_0x2c5966[_0x8c81('0x7')][_0x8c81('0x8')]);}else{return _0x1a61ab(_0x2c5966['result']);}})[_0x8c81('0x9')](function(_0x448af6){return _0xb97ac(_0x448af6);});});}exports[_0x8c81('0xa')]=function(_0x15ebff){return request(_0x8c81('0xb'),{'options':{'raw':![],'where':{'name':_0x15ebff},'attributes':[_0x8c81('0xc')]}});};exports[_0x8c81('0xd')]=function(_0x4c8021){return request(_0x8c81('0xe'),{'options':{'raw':![],'where':{'id':_0x4c8021},'include':[{'model':_0x8c81('0xf'),'as':_0x8c81('0x10')}],'attributes':['id',_0x8c81('0x11'),'email']}});};exports[_0x8c81('0x12')]=function(_0x3cdd27){return request(_0x8c81('0xb'),{'options':{'where':{'id':_0x3cdd27},'attributes':[_0x8c81('0x11')]}});};exports[_0x8c81('0x13')]=function(_0x112be6){return request(_0x8c81('0x14'),{'options':{'where':{'id':_0x112be6},'attributes':[_0x8c81('0x11')]}});};exports[_0x8c81('0x15')]=function(_0x5a6e72){return request('ShowVariable',{'options':{'where':{'id':_0x5a6e72},'attributes':[_0x8c81('0x11')]}});};exports[_0x8c81('0x16')]=function(_0x238ce5){return request(_0x8c81('0x17'),{'options':{'where':{'id':_0x238ce5},'attributes':[_0x8c81('0x18')]}});};exports[_0x8c81('0x19')]=function(_0x4f7180){return request(_0x8c81('0x1a'),{'options':{'where':{'id':_0x4f7180},'attributes':[_0x8c81('0x11')]}});};exports[_0x8c81('0x1b')]=function(_0x1fc95b){return request(_0x8c81('0x1c'),{'options':{'where':{'phone':_0x1fc95b['phone']},'attributes':['id']}});};exports[_0x8c81('0x1d')]=function(_0x4d0b75){return request('ShowTrunk',{'options':{'where':{'id':_0x4d0b75},'attributes':['name']}});};exports[_0x8c81('0x1e')]=function(_0x13e312){return request(_0x8c81('0x1f'),{'options':{'where':{'id':_0x13e312},'attributes':['save_name']}});};exports[_0x8c81('0x20')]=function(_0x2312d5){return request(_0x8c81('0x21'),{'options':{'raw':![],'where':{'id':_0x2312d5},'include':[{'model':'Interval','as':_0x8c81('0x22')}]}});};exports[_0x8c81('0x23')]=function(_0x56ca80){return request(_0x8c81('0x24'),{'options':{'where':{'id':_0x56ca80},'attributes':['id',_0x8c81('0x11')]}});};exports['createSmsMessage']=function(_0x566cfc){return request(_0x8c81('0x25'),{'body':_0x566cfc});};exports[_0x8c81('0x26')]=function(_0xfaf3d9){return request('CreateSquareDetailsReport',{'body':_0xfaf3d9});};exports[_0x8c81('0x27')]=function(_0x46f558){return request(_0x8c81('0x28'),{'body':_[_0x8c81('0x29')](_0x46f558,{'project_name':_0x46f558[_0x8c81('0x2a')],'prev_project_name':_0x46f558[_0x8c81('0x2b')]||'','is_subproject':_0x46f558[_0x8c81('0x2b')]?!![]:![],'leaveAt':moment()[_0x8c81('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x255dcb){return request(_0x8c81('0x2d'),{'body':_0x255dcb});};exports[_0x8c81('0x2e')]=function(_0x21bf77){return request(_0x8c81('0x2f'),{'body':_0x21bf77});};exports[_0x8c81('0x30')]=function(_0x2e7ba2){return request(_0x8c81('0x31'),{'options':{'raw':![],'where':{'phone':_0x2e7ba2[_0x8c81('0x32')],'ListId':_0x2e7ba2[_0x8c81('0x33')]}}})[_0x8c81('0x34')](function(_0x35901a){if(_0x35901a){return _0x35901a;}return request(_0x8c81('0x35'),{'body':_0x2e7ba2});});};exports['getPauseById']=function(_0x1d73ac){return request(_0x8c81('0x36'),{'options':{'where':{'id':_0x1d73ac},'attributes':[_0x8c81('0x11')]}});};exports[_0x8c81('0x37')]=function(_0x428aba,_0x3b9527){return request(_0x8c81('0x38'),{'body':{'interface':_0x3b9527},'options':{'where':_0x428aba}});};exports[_0x8c81('0x39')]=function(_0x2f419f,_0x54ca62,_0x2358be){return request(_0x8c81('0x3a'),{'body':{'type':_0x54ca62,'uniqueid':_0x2358be},'options':{'where':_0x2f419f}});};exports[_0x8c81('0x3b')]=function(_0x25654d){return request(_0x8c81('0x3c'),{'body':{},'options':{'where':_0x25654d}});};exports['agentLogout']=function(_0x1497f2){return request(_0x8c81('0x3d'),{'body':{},'options':{'where':_0x1497f2}});}; \ 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 5312ed2..1f5e766 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 _0x7da7=['./lex','exports','./polly'];(function(_0x143717,_0x22b9ea){var _0x42da80=function(_0x5b6894){while(--_0x5b6894){_0x143717['push'](_0x143717['shift']());}};_0x42da80(++_0x22b9ea);}(_0x7da7,0x10d));var _0x77da=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x7da7[_0x75f869];return _0x10af8b;};var polly=require(_0x77da('0x0'));var lex=require(_0x77da('0x1'));module[_0x77da('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x36f3=['./lex','exports'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0x36f3,0xe6));var _0x336f=function(_0x6caff4,_0x480025){_0x6caff4=_0x6caff4-0x0;var _0x358739=_0x36f3[_0x6caff4];return _0x358739;};var polly=require('./polly');var lex=require(_0x336f('0x0'));module[_0x336f('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 b925ad5..fdc302f 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x26fe42,_0xe4a5bf,_0x17d4ec,_0x22c4b8,_0x4c37e8,_0x8c392f){return lex(_0x26fe42,_0xe4a5bf,_0x17d4ec,_0x22c4b8,_0x4c37e8,_0x8c392f);}; \ No newline at end of file +var _0x153f=['exports','./lib/api'];(function(_0xdb357c,_0x3786b6){var _0x5c8735=function(_0x2e179c){while(--_0x2e179c){_0xdb357c['push'](_0xdb357c['shift']());}};_0x5c8735(++_0x3786b6);}(_0x153f,0x15b));var _0xf153=function(_0x25fd27,_0x3d8898){_0x25fd27=_0x25fd27-0x0;var _0x4da073=_0x153f[_0x25fd27];return _0x4da073;};'use strict';var lex=require(_0xf153('0x0'));module[_0xf153('0x1')]=function(_0xde7eae,_0x44cea3,_0x2afb9a,_0x1ccc1c,_0x3b85fc,_0x59757c){return lex(_0xde7eae,_0x44cea3,_0x2afb9a,_0x1ccc1c,_0x3b85fc,_0x59757c);}; \ 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 d5d4e7d..d4e964c 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(_0x245dcc,_0x28f836){var _0x125f3b=function(_0x41e55d){while(--_0x41e55d){_0x245dcc['push'](_0x245dcc['shift']());}};_0x125f3b(++_0x28f836);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x208f14,_0x2daee3){var _0x3239e7=function(_0x3da73c){while(--_0x3da73c){_0x208f14['push'](_0x208f14['shift']());}};_0x3239e7(++_0x2daee3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 7a863b9..4c5cef4 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 _0xa1ec=['exports','./lib/api'];(function(_0x276268,_0x47813f){var _0x46071d=function(_0x299542){while(--_0x299542){_0x276268['push'](_0x276268['shift']());}};_0x46071d(++_0x47813f);}(_0xa1ec,0x1e7));var _0xca1e=function(_0x4d047b,_0xe1ce8d){_0x4d047b=_0x4d047b-0x0;var _0x5a3568=_0xa1ec[_0x4d047b];return _0x5a3568;};'use strict';var polly=require(_0xca1e('0x0'));module[_0xca1e('0x1')]=function(_0x1e16dc,_0x5c5f59,_0x3edc05,_0x5b99e8,_0x3f5903,_0x2eb66f,_0x572913){return polly(_0x1e16dc,_0x5c5f59,_0x3edc05,_0x5b99e8,_0x3f5903,_0x2eb66f,_0x572913);}; \ No newline at end of file +var _0xf535=['./lib/api','exports'];(function(_0xaf47d4,_0x3474e4){var _0x2875c7=function(_0x4f87a5){while(--_0x4f87a5){_0xaf47d4['push'](_0xaf47d4['shift']());}};_0x2875c7(++_0x3474e4);}(_0xf535,0xd4));var _0x5f53=function(_0x957501,_0x16895b){_0x957501=_0x957501-0x0;var _0x54fa44=_0xf535[_0x957501];return _0x54fa44;};'use strict';var polly=require(_0x5f53('0x0'));module[_0x5f53('0x1')]=function(_0x19362c,_0x15735d,_0x1da196,_0x4014ac,_0x1d48b3,_0x4449aa,_0x4c14df){return polly(_0x19362c,_0x15735d,_0x1da196,_0x4014ac,_0x1d48b3,_0x4449aa,_0x4c14df);}; \ 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 acbb1ea..98630c6 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 _0xac3b=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','randomstring','aws-sdk','AudioStream'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xac3b,0x1e0));var _0xbac3=function(_0x2cc842,_0xd6800d){_0x2cc842=_0x2cc842-0x0;var _0x24adab=_0xac3b[_0x2cc842];return _0x24adab;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0xbac3('0x0'));var AWS=require(_0xbac3('0x1'));function pollyResult(_0x596e8f,_0x491d1e,_0x3b5bb1){return new BPromise(function(_0x52de79,_0x39f92f){_0x596e8f['synthesizeSpeech'](_0x491d1e,function(_0x3d1f2e,_0x55f433){if(_0x3d1f2e){_0x39f92f(_0x3d1f2e);}else if(_0x55f433){if(_0x55f433[_0xbac3('0x2')]instanceof Buffer){fs[_0xbac3('0x3')](_0x3b5bb1,_0x55f433[_0xbac3('0x2')],function(_0x5799ab){if(_0x5799ab){_0x39f92f(_0x5799ab);}else{_0x52de79();}});}else{_0x39f92f(new Error(_0xbac3('0x4')));}}else{_0x39f92f(new Error(_0xbac3('0x5')));}});});}module['exports']=function(_0x5807da,_0x2054ca,_0x3150b8,_0x499bee,_0x2f6fbc,_0x277e9e,_0x2200a1){var _0x1c6073=new AWS[(_0xbac3('0x6'))]({'accessKeyId':_0x5807da,'secretAccessKey':_0x2054ca,'region':_0x3150b8});var _0x37aad7={'Text':_0x2f6fbc,'TextType':_0x277e9e||'text','OutputFormat':'mp3','VoiceId':_0x499bee};return pollyResult(_0x1c6073,_0x37aad7,_0x2200a1);}; \ No newline at end of file +var _0x9cce=['aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird'];(function(_0x3dd23c,_0x18c32f){var _0x520bf8=function(_0x462f87){while(--_0x462f87){_0x3dd23c['push'](_0x3dd23c['shift']());}};_0x520bf8(++_0x18c32f);}(_0x9cce,0x127));var _0xe9cc=function(_0x58d539,_0x12aab6){_0x58d539=_0x58d539-0x0;var _0xbdec90=_0x9cce[_0x58d539];return _0xbdec90;};'use strict';var fs=require('fs');var path=require(_0xe9cc('0x0'));var BPromise=require(_0xe9cc('0x1'));var rs=require('randomstring');var AWS=require(_0xe9cc('0x2'));function pollyResult(_0x29eb1a,_0x46cdc2,_0xfe7147){return new BPromise(function(_0x1d43ac,_0x290a29){_0x29eb1a[_0xe9cc('0x3')](_0x46cdc2,function(_0x42c6d9,_0x422d57){if(_0x42c6d9){_0x290a29(_0x42c6d9);}else if(_0x422d57){if(_0x422d57[_0xe9cc('0x4')]instanceof Buffer){fs['writeFile'](_0xfe7147,_0x422d57['AudioStream'],function(_0x42b37d){if(_0x42b37d){_0x290a29(_0x42b37d);}else{_0x1d43ac();}});}else{_0x290a29(new Error(_0xe9cc('0x5')));}}else{_0x290a29(new Error(_0xe9cc('0x6')));}});});}module[_0xe9cc('0x7')]=function(_0x254757,_0x33f68b,_0x431534,_0x541296,_0x2bae2e,_0x5c8158,_0x382e9f){var _0x4d7466=new AWS[(_0xe9cc('0x8'))]({'accessKeyId':_0x254757,'secretAccessKey':_0x33f68b,'region':_0x431534});var _0xae590a={'Text':_0x2bae2e,'TextType':_0x5c8158||_0xe9cc('0x9'),'OutputFormat':_0xe9cc('0xa'),'VoiceId':_0x541296};return pollyResult(_0x4d7466,_0xae590a,_0x382e9f);}; \ 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 67c4aa1..6357d00 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 _0x2c4b=['./lib/api','exports'];(function(_0x2f6f50,_0x1d21a7){var _0x2cf365=function(_0x1c40a7){while(--_0x1c40a7){_0x2f6f50['push'](_0x2f6f50['shift']());}};_0x2cf365(++_0x1d21a7);}(_0x2c4b,0x132));var _0xb2c4=function(_0x5660f6,_0x5646db){_0x5660f6=_0x5660f6-0x0;var _0x4bf573=_0x2c4b[_0x5660f6];return _0x4bf573;};'use strict';var asr=require(_0xb2c4('0x0'));module[_0xb2c4('0x1')]=function(_0x2253ca,_0x38a7a3,_0x407ff1,_0x2f5936){return asr(_0x2253ca,_0x38a7a3,_0x407ff1);}; \ No newline at end of file +var _0xfee8=['./lib/api','exports'];(function(_0x381789,_0x8fb11e){var _0x36022e=function(_0xdb7381){while(--_0xdb7381){_0x381789['push'](_0x381789['shift']());}};_0x36022e(++_0x8fb11e);}(_0xfee8,0xce));var _0x8fee=function(_0xa8b370,_0x2b77db){_0xa8b370=_0xa8b370-0x0;var _0x643e37=_0xfee8[_0xa8b370];return _0x643e37;};'use strict';var asr=require(_0x8fee('0x0'));module[_0x8fee('0x1')]=function(_0xa628fc,_0x5ac779,_0x43b800,_0xb03203){return asr(_0xa628fc,_0x5ac779,_0x43b800);}; \ 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 1594429..a5982d9 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 _0xf53f=['https://speech.googleapis.com','exports','string','length','undefined','toString','POST','LINEAR16','8000','url','bluebird'];(function(_0x3b076e,_0xddef4f){var _0x3e3e9c=function(_0x6b7373){while(--_0x6b7373){_0x3b076e['push'](_0x3b076e['shift']());}};_0x3e3e9c(++_0xddef4f);}(_0xf53f,0x8d));var _0xff53=function(_0x3392ff,_0x598de7){_0x3392ff=_0x3392ff-0x0;var _0x908ae5=_0xf53f[_0x3392ff];return _0x908ae5;};'use strict';var url=require(_0xff53('0x0'));var BPromise=require(_0xff53('0x1'));var fs=require('fs');var host=_0xff53('0x2');module[_0xff53('0x3')]=function(_0x3b48fc,_0x4afcd,_0x492e12){return new BPromise(function(_0x32529d,_0x18b504){var _0x2077b9;if(typeof _0x3b48fc!==_0xff53('0x4')||_0x3b48fc[_0xff53('0x5')]===0x0){return _0x18b504('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x4afcd!=='string'||_0x4afcd[_0xff53('0x5')]===0x0){return _0x18b504('key\x20should\x20be\x20a\x20string');}if(typeof _0x492e12!==_0xff53('0x6')&&(typeof _0x492e12!==_0xff53('0x4')||_0x492e12[_0xff53('0x5')]===0x0)){return _0x18b504('lang\x20should\x20be\x20a\x20string');}try{_0x2077b9=fs['readFileSync'](_0x3b48fc)[_0xff53('0x7')]('base64');}catch(_0x130576){return _0x18b504(_0x130576);}return _0x32529d({'method':_0xff53('0x8'),'uri':host+'/v1/speech:recognize?key='+_0x4afcd,'body':{'config':{'encoding':_0xff53('0x9'),'sampleRateHertz':_0xff53('0xa'),'languageCode':_0x492e12},'audio':{'content':_0x2077b9}},'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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x78f0,0x15d));var _0x078f=function(_0x18e336,_0x4ace91){_0x18e336=_0x18e336-0x0;var _0x1f2bd1=_0x78f0[_0x18e336];return _0x1f2bd1;};'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 9e12e99..7666597 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 _0xccc3=['./asr','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xccc3,0xce));var _0x3ccc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xccc3[_0x2641f9];return _0x585741;};var asr=require(_0x3ccc('0x0'));module[_0x3ccc('0x1')]={'asr':asr}; \ No newline at end of file +var _0x972d=['./asr','exports'];(function(_0x5bb618,_0x4f36ed){var _0x456086=function(_0x78f4d1){while(--_0x78f4d1){_0x5bb618['push'](_0x5bb618['shift']());}};_0x456086(++_0x4f36ed);}(_0x972d,0xf4));var _0xd972=function(_0x139813,_0x39cf08){_0x139813=_0x139813-0x0;var _0x1bf59c=_0x972d[_0x139813];return _0x1bf59c;};var asr=require(_0xd972('0x0'));module[_0xd972('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 1c8f35e..b2f2d16 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 _0x86c0=['host','WHAT_EVER','get','statusCode','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','close','error','unlink','download\x20error','pipe','end','transcode','wav','error\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','then','.mp3','from','audioContent','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','uri','results','map','transcript','alternatives','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','source','result','resolvedQuery','action','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','asr','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','model=%s','freeform=3','sestekNDA','nda','text','CustomAction','channelData','CustomActionData','AudioFromTts','dirName','apiai-promise','dialogflow','md5','path','querystring','request-promise','randomstring','google-tts-api','parse','util','./aws','./google','./sestek','agi','https://api.ispeech.org/api/rest','protocol'];(function(_0x21af3a,_0x386e1d){var _0x268a49=function(_0x41a650){while(--_0x41a650){_0x21af3a['push'](_0x21af3a['shift']());}};_0x268a49(++_0x386e1d);}(_0x86c0,0x18b));var _0x086c=function(_0x430ebd,_0x1b296a){_0x430ebd=_0x430ebd-0x0;var _0x717b5a=_0x86c0[_0x430ebd];return _0x717b5a;};'use strict';var apiai=require(_0x086c('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x086c('0x1'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x086c('0x2'));var path=require(_0x086c('0x3'));var querystring=require(_0x086c('0x4'));var rp=require(_0x086c('0x5'));var rs=require(_0x086c('0x6'));var sox=require('sox');var tts=require(_0x086c('0x7'));var urlParse=require('url')[_0x086c('0x8')];var util=require(_0x086c('0x9'));var aws=require(_0x086c('0xa'));var google=require(_0x086c('0xb'));var sestek=require(_0x086c('0xc'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x086c('0xd'));var ISPEECH_API=_0x086c('0xe');function downloadFile(_0x15817f,_0x546ea6){return new BPromise(function(_0xf142d,_0x238aaf){var _0x506bac=urlParse(_0x15817f);var _0x4f882d=_0x506bac[_0x086c('0xf')]==='https:'?https:http;var _0x5dba29={'host':_0x506bac[_0x086c('0x10')],'path':_0x506bac[_0x086c('0x3')],'headers':{'user-agent':_0x086c('0x11')}};_0x4f882d[_0x086c('0x12')](_0x5dba29,function(_0x3b45de){if(_0x3b45de[_0x086c('0x13')]!==0xc8){logger['error'](_0x086c('0x14')+_0x15817f+'\x20failed,\x20status\x20code\x20=\x20'+_0x3b45de[_0x086c('0x13')]+'\x20('+_0x3b45de[_0x086c('0x15')]+')');_0x238aaf(new Error(_0x086c('0x14')+_0x15817f+_0x086c('0x16')+_0x3b45de[_0x086c('0x13')]+'\x20('+_0x3b45de[_0x086c('0x15')]+')'));return;}var _0x57cdec=fs[_0x086c('0x17')](_0x546ea6);_0x57cdec['on'](_0x086c('0x18'),function(){logger[_0x086c('0x19')]('finish\x20download\x20file');_0x57cdec[_0x086c('0x1a')](_0xf142d);});_0x57cdec['on'](_0x086c('0x1b'),function(_0x5cba54){fs[_0x086c('0x1c')](_0x546ea6);logger[_0x086c('0x1b')](_0x086c('0x1d'),_0x5cba54);_0x238aaf(_0x5cba54);});_0x3b45de[_0x086c('0x1e')](_0x57cdec);})['on'](_0x086c('0x1b'),function(_0xa099d0){logger[_0x086c('0x1b')](_0xa099d0);_0x238aaf(_0xa099d0);})[_0x086c('0x1f')]();});}function uploadFile(_0x43912a){return new BPromise(function(_0x7dbbda,_0x444093){var _0x29053b=urlParse(_0x43912a);var _0x36e89b=_0x29053b[_0x086c('0xf')]==='https:'?https:http;var _0x450b4c={'host':_0x29053b[_0x086c('0x10')],'path':_0x29053b[_0x086c('0x3')],'headers':{'user-agent':_0x086c('0x11')}};_0x36e89b['get'](_0x450b4c,function(_0x3ca201){if(_0x3ca201['statusCode']!==0xc8){_0x444093(new Error(_0x086c('0x14')+_0x43912a+'\x20failed,\x20status\x20code\x20=\x20'+_0x3ca201[_0x086c('0x13')]+'\x20('+_0x3ca201['statusMessage']+')'));return;}var _0x5ea4a9='';_0x3ca201['on']('data',function(_0x27bc6f){_0x5ea4a9+=_0x27bc6f;});_0x3ca201['on'](_0x086c('0x1f'),function(){_0x7dbbda(_0x5ea4a9);});})['on'](_0x086c('0x1b'),function(_0x544bb7){_0x444093(_0x544bb7);})[_0x086c('0x1f')]();});}function convertFile(_0x26b4ce,_0x1a9e6f){return new BPromise(function(_0x7661e4,_0x256159){var _0x2f183f=sox[_0x086c('0x20')](_0x26b4ce,_0x1a9e6f,{'sampleRate':0x1f40,'format':_0x086c('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2f183f['on'](_0x086c('0x1b'),function(_0x53cc62){logger[_0x086c('0x1b')](_0x086c('0x22'),_0x53cc62);_0x256159(_0x53cc62);});_0x2f183f['on']('end',function(){logger[_0x086c('0x19')]('finish\x20to\x20convert');_0x7661e4();});_0x2f183f[_0x086c('0x23')]();});}function base64Decode(_0x97082a,_0x4ee125){var _0x38f120=path[_0x086c('0x24')](__dirname,_0x086c('0x25'),rs[_0x086c('0x26')](0x4)+_0x086c('0x27'));fs[_0x086c('0x28')](_0x38f120,_0x97082a,_0x086c('0x29'));return convertFile(_0x38f120,_0x4ee125)['then'](function(){try{fs['unlink'](_0x38f120);fs[_0x086c('0x2a')](_0x4ee125,_0x086c('0x2b'));}catch(_0x3fada5){logger[_0x086c('0x1b')](_0x3fada5);}return _0x4ee125[_0x086c('0x2c')]('.')[0x0];});}function base64Encode(_0x444429){var _0x11bf29=fs[_0x086c('0x2d')](_0x444429);return new Buffer(_0x11bf29)[_0x086c('0x2e')](_0x086c('0x29'));}exports['googleCloudTTS']=function(_0x3a855b,_0x46fa1d,_0x571763,_0x35894f,_0x4efbe8,_0x39128c){var _0x5b29b0,_0x3ff32a;var _0xc5d50e='https://texttospeech.googleapis.com/v1/';var _0x54e1bc=_0x086c('0x2f')+_0x3a855b;var _0x2d58ff={};if(_0x46fa1d==='ssml'){_0x2d58ff[_0x086c('0x30')]={'ssml':_0x571763};}else{_0x2d58ff['input']={'text':_0x571763};};_0x2d58ff[_0x086c('0x31')]={'languageCode':_0x35894f,'ssmlGender':_0x4efbe8};_0x2d58ff[_0x086c('0x32')]={'audioEncoding':_0x086c('0x33'),'sampleRateHertz':0x1f40};var _0x26f366={'url':_0xc5d50e+_0x086c('0x34')+_0x54e1bc,'method':_0x086c('0x35'),'json':!![],'body':_0x2d58ff};return rp(_0x26f366)[_0x086c('0x36')](function(_0x2569b3){return new BPromise(function(_0x2359f1,_0x516330){_0x5b29b0=path['resolve'](__dirname,'tmp',rs[_0x086c('0x26')](0x4)+_0x086c('0x37'));var _0x4cf3eb=Buffer[_0x086c('0x38')](_0x2569b3[_0x086c('0x39')],_0x086c('0x29'));return fs['writeFile'](_0x5b29b0,_0x4cf3eb,function(_0x39a860){_0x516330(_0x39a860);},function(_0x4ad12a){fs['chmodSync'](_0x5b29b0,_0x086c('0x2b'));_0x2359f1(_0x4ad12a);});});})[_0x086c('0x36')](function(_0x23cfaf){_0x3ff32a=path[_0x086c('0x24')](__dirname,'tmp',rs[_0x086c('0x26')](0x4)+'.wav');return convertFile(_0x5b29b0,_0x3ff32a);})[_0x086c('0x36')](function(){try{fs[_0x086c('0x1c')](_0x5b29b0);fs[_0x086c('0x2a')](_0x3ff32a,'777');}catch(_0x285283){logger[_0x086c('0x1b')](_0x285283);}logger['info'](_0x086c('0x3a'),_0x3ff32a[_0x086c('0x2c')]('.')[0x0]);return _0x3ff32a[_0x086c('0x2c')]('.')[0x0];});};exports[_0x086c('0x3b')]=function(_0x1b078a,_0x37f4f4){var _0x2657d6=_0x086c('0x3c');var _0x363335,_0x23b648;var _0x4867d7;var _0x5a5dc6={'encoding':_0x086c('0x3d'),'method':_0x086c('0x35'),'timeout':0x2710,'url':_0x2657d6,'headers':{'Content-Type':_0x086c('0x3e')},'body':_0x086c('0x3f')+encodeURIComponent(JSON[_0x086c('0x40')]([[['jQ1olc',JSON[_0x086c('0x40')]([_0x1b078a,_0x37f4f4||'en',![],_0x086c('0x41')]),null,'generic']]]))};return rp(_0x5a5dc6)[_0x086c('0x36')](function(_0x1f2429){try{_0x4867d7=eval(_0x1f2429[_0x086c('0x42')](0x5))[0x0][0x2];}catch(_0x21ce48){throw new Error(_0x086c('0x43')+_0x1f2429[_0x086c('0x44')]);}if(!_0x4867d7){if(_0x1b078a[_0x086c('0x45')]>0xc8){throw new Error(_0x086c('0x46'));}else{throw new Error(_0x086c('0x47')+_0x37f4f4+'\x22\x20might\x20not\x20exist');}}try{_0x4867d7=eval(_0x4867d7)[0x0];}catch(_0x5d896b){throw new Error(_0x086c('0x43')+res[_0x086c('0x44')]);}const _0x5c8ff6=_0x4867d7;_0x363335=path[_0x086c('0x24')](__dirname,_0x086c('0x25'),rs[_0x086c('0x26')](0x4)+'.mp3');fs[_0x086c('0x28')](_0x363335,_0x4867d7,{'encoding':_0x086c('0x29')});_0x23b648=path[_0x086c('0x24')](__dirname,_0x086c('0x25'),rs['generate'](0x4)+_0x086c('0x27'));return convertFile(_0x363335,_0x23b648);})[_0x086c('0x36')](function(){try{fs[_0x086c('0x1c')](_0x363335);fs[_0x086c('0x2a')](_0x23b648,'777');}catch(_0x507eb7){logger[_0x086c('0x1b')](_0x507eb7);}logger[_0x086c('0x19')](_0x086c('0x48'),_0x23b648[_0x086c('0x2c')]('.')[0x0]);return _0x23b648[_0x086c('0x2c')]('.')[0x0];});};exports[_0x086c('0x49')]=function(_0x9f3af,_0x5c9743,_0x56be44){return google['asr'](_0x9f3af,_0x5c9743,_0x56be44)[_0x086c('0x36')](function(_0x5d0c4c){logger['info'](_0x5d0c4c[_0x086c('0x4a')]);return rp(_0x5d0c4c);})[_0x086c('0x36')](function(_0x3d197b){var _0x47e8df='';var _0x4fd887=0x0;try{fs[_0x086c('0x1c')](_0x9f3af);}catch(_0x1d0dea){logger[_0x086c('0x1b')](_0x1d0dea);}if(_0x3d197b&&_0x3d197b[_0x086c('0x4b')]){_0x47e8df=_0x3d197b['results'][_0x086c('0x4c')](function(_0x121507){return _0x121507&&_0x121507['alternatives'][0x0]&&_0x121507['alternatives'][0x0][_0x086c('0x4d')]?_0x121507['alternatives'][0x0][_0x086c('0x4d')]:'';})['join']('\x0a');_0x4fd887=_0x3d197b[_0x086c('0x4b')][_0x086c('0x4c')](function(_0x2877a0){return _0x2877a0&&_0x2877a0[_0x086c('0x4e')][0x0]&&_0x2877a0[_0x086c('0x4e')][0x0][_0x086c('0x4f')]?_0x2877a0['alternatives'][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x086c('0x19')](_0x086c('0x50'),_0x47e8df);logger['info'](_0x086c('0x51'),_0x4fd887);return{'transcript':_0x47e8df,'confidence':_0x4fd887};})['catch'](function(_0x3c6426){logger[_0x086c('0x1b')](_0x086c('0x52'),_0x3c6426['statusCode'],_0x3c6426[_0x086c('0x53')],_0x3c6426[_0x086c('0x54')]);});};exports[_0x086c('0x55')]=function(_0x57a11e,_0x3c4126,_0x3d3086,_0x3adbb9){var _0x41ed03=apiai(_0x3c4126,{'language':_0x3adbb9||'en'});return _0x41ed03['textRequest'](_0x3d3086,{'sessionId':md5(_0x57a11e)})[_0x086c('0x36')](function(_0x27597c){logger[_0x086c('0x19')](JSON['stringify'](_0x27597c));return{'source':_0x27597c['result'][_0x086c('0x56')],'resolvedQuery':_0x27597c[_0x086c('0x57')][_0x086c('0x58')],'action':_0x27597c[_0x086c('0x57')][_0x086c('0x59')],'actionIncomplete':_0x27597c['result']['actionIncomplete'],'speech':_0x27597c[_0x086c('0x57')][_0x086c('0x5a')][_0x086c('0x5b')],'score':_0x27597c[_0x086c('0x57')][_0x086c('0x5c')],'statusCode':_0x27597c[_0x086c('0x5d')][_0x086c('0x5e')],'endConversation':_0x27597c[_0x086c('0x57')][_0x086c('0x5f')][_0x086c('0x60')]||![],'isFallbackIntent':_0x27597c[_0x086c('0x57')]['metadata'][_0x086c('0x61')]};});};exports[_0x086c('0x62')]=function(_0x2ff70b,_0x3bc9c5,_0x2429d5,_0x541bd3,_0x4f8fea,_0x4bd194){var _0x1f607e=_0x541bd3[_0x086c('0x63')](/\\n/g,'\x0a');var _0x5b1dea={'credentials':{'private_key':_0x1f607e,'client_email':_0x2429d5}};var _0x440860=new dialogflow['SessionsClient'](_0x5b1dea);var _0x61e809=_0x440860[_0x086c('0x64')](_0x3bc9c5,md5(_0x2ff70b));var _0x127317={'session':_0x61e809,'queryInput':{'text':{'text':_0x4f8fea,'languageCode':_0x4bd194}}};return _0x440860[_0x086c('0x65')](_0x127317)[_0x086c('0x36')](function(_0x11771d){if(_0x11771d&&_0x11771d[_0x086c('0x45')]){logger['info'](_0x086c('0x66'),JSON[_0x086c('0x40')](_0x11771d));var _0xd73379=_0x11771d[0x0];if(_0xd73379){var _0x4d5795={'action':_0xd73379[_0x086c('0x67')][_0x086c('0x59')],'allRequiredParamsPresent':_0xd73379[_0x086c('0x67')][_0x086c('0x68')],'endConversation':_0xd73379[_0x086c('0x67')][_0x086c('0x69')]&&_0xd73379[_0x086c('0x67')]['diagnosticInfo']['fields']?_0xd73379[_0x086c('0x67')]['diagnosticInfo']['fields'][_0x086c('0x6a')][_0x086c('0x6b')]:![],'fulfillmentText':_0xd73379['queryResult'][_0x086c('0x6c')],'intentName':_0xd73379[_0x086c('0x67')][_0x086c('0x6d')]['name'],'intentDisplayName':_0xd73379[_0x086c('0x67')][_0x086c('0x6d')][_0x086c('0x6e')],'isFallbackIntent':_0xd73379[_0x086c('0x67')][_0x086c('0x6d')][_0x086c('0x6f')],'languageCode':_0xd73379[_0x086c('0x67')][_0x086c('0x70')],'queryText':_0xd73379[_0x086c('0x67')][_0x086c('0x71')],'responseId':_0xd73379['responseId'],'score':_0xd73379[_0x086c('0x67')][_0x086c('0x72')],'speech':_0xd73379[_0x086c('0x67')][_0x086c('0x6c')],'providerResponse':JSON[_0x086c('0x40')](_0x11771d)};return _0x4d5795;}}});};exports[_0x086c('0x73')]=function(_0x3b8c53,_0x1425a9,_0x103868,_0x4062ca){return tilde[_0x086c('0x74')](_0x3b8c53,_0x1425a9,_0x103868,_0x4062ca)[_0x086c('0x36')](function(_0x2c9e6c){try{fs['unlink'](_0x3b8c53);}catch(_0x256fad){logger[_0x086c('0x1b')](_0x256fad);}logger[_0x086c('0x19')]('Tilde\x20ASR\x20transcription',_0x2c9e6c[_0x086c('0x4d')]);logger['info'](_0x086c('0x75'),_0x2c9e6c['confidence']);return _0x2c9e6c;});};exports[_0x086c('0x76')]=function(_0x56b79e,_0x438bf8,_0x24dcbf,_0x470756,_0x4c79a4,_0x21d18e){var _0x366f07=path[_0x086c('0x24')](__dirname,_0x086c('0x25'),rs[_0x086c('0x26')](0x4)+_0x086c('0x37'));var _0xa20ea7;return aws[_0x086c('0x77')](_0x56b79e,_0x438bf8,_0x24dcbf,_0x470756,_0x4c79a4,_0x21d18e,_0x366f07)[_0x086c('0x36')](function(){_0xa20ea7=path[_0x086c('0x24')](__dirname,'tmp',rs[_0x086c('0x26')](0x4)+'.wav');return convertFile(_0x366f07,_0xa20ea7);})['then'](function(){try{fs[_0x086c('0x1c')](_0x366f07);fs[_0x086c('0x2a')](_0xa20ea7,_0x086c('0x2b'));}catch(_0x333b04){logger[_0x086c('0x1b')](_0x333b04);}return _0xa20ea7[_0x086c('0x2c')]('.')[0x0];});};exports[_0x086c('0x78')]=function(_0x92540d,_0x459dfb,_0x530c91,_0xcff9ad,_0x3c93b3,_0x240027){return aws[_0x086c('0x79')](_0x92540d,_0x459dfb,_0x530c91,_0xcff9ad,_0x3c93b3,_0x240027)['then'](function(_0x3cf0f1){logger[_0x086c('0x19')](JSON['stringify'](_0x3cf0f1));return _0x3cf0f1;});};exports[_0x086c('0x7a')]=function(_0x42e0a2,_0x2976e6,_0x1812ee,_0x1f059a){var _0x8f4e2b=util[_0x086c('0x7b')](_0x086c('0x7c'),ISPEECH_API,_0x42e0a2,encodeURIComponent(_0x2976e6),_0x1812ee,_0x1f059a);var _0x58b3e5=path[_0x086c('0x24')](__dirname,_0x086c('0x25'),rs['generate'](0x4)+'.mp3');var _0x1a0de2;return downloadFile(_0x8f4e2b,_0x58b3e5)[_0x086c('0x36')](function(){_0x1a0de2=path['resolve'](__dirname,'tmp',rs[_0x086c('0x26')](0x4)+_0x086c('0x27'));return convertFile(_0x58b3e5,_0x1a0de2);})[_0x086c('0x36')](function(){try{fs[_0x086c('0x1c')](_0x58b3e5);fs[_0x086c('0x2a')](_0x1a0de2,'777');}catch(_0x2e2483){logger[_0x086c('0x1b')](_0x2e2483);}return _0x1a0de2[_0x086c('0x2c')]('.')[0x0];});};exports[_0x086c('0x7d')]=function(_0x45a7f1,_0x3d1f19,_0x4575c2,_0x46f4f4){var _0x2eea0e=util[_0x086c('0x7b')](_0x086c('0x7e'),ISPEECH_API,_0x3d1f19,_0x4575c2,base64Encode(_0x45a7f1),_0x46f4f4?util[_0x086c('0x7b')](_0x086c('0x7f'),encodeURIComponent(_0x46f4f4)):_0x086c('0x80'));return uploadFile(_0x2eea0e)['then'](function(_0x2762d4){return querystring[_0x086c('0x8')](_0x2762d4);});};exports[_0x086c('0x81')]=function(_0x8e6dac,_0x90b652){return sestek[_0x086c('0x82')](_0x8e6dac,_0x90b652)['then'](function(_0x49ccf9){logger[_0x086c('0x19')](JSON[_0x086c('0x40')](_0x49ccf9));var _0xbaf38c={'speech':_0x49ccf9[_0x086c('0x83')],'action':_0x49ccf9['channelData']?_0x49ccf9['channelData'][_0x086c('0x84')]:undefined,'actiondata':_0x49ccf9['channelData']?_0x49ccf9[_0x086c('0x85')][_0x086c('0x86')]:undefined};if(_0x49ccf9[_0x086c('0x85')]&&_0x49ccf9[_0x086c('0x85')][_0x086c('0x87')]){return base64Decode(_0x49ccf9[_0x086c('0x85')][_0x086c('0x87')]['Data'],path['resolve'](__dirname,_0x086c('0x25'),rs[_0x086c('0x26')](0x4)+_0x086c('0x27')))[_0x086c('0x36')](function(_0x2c85fa){_0xbaf38c['audiofile']=_0x2c85fa;return _0xbaf38c;});}return _0xbaf38c;});};exports[_0x086c('0x88')]=function(){return __dirname;}; \ No newline at end of file +var _0xabe5=['utf8','application/x-www-form-urlencoded','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20confidence','[%s]\x20%s:%s','message','googleDialogflow','textRequest','source','action','result','actionIncomplete','fulfillment','speech','score','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','name','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','http','https','md5','querystring','request-promise','sox','google-tts-api','url','parse','./aws','./google','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','createWriteStream','finish','info','close','unlink','download\x20error','pipe','end','\x20failed,\x20status\x20code\x20=\x20','transcode','wav','error\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','then','chmodSync','split','readFileSync','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','base64','777','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute'];(function(_0x489264,_0x1ae4b3){var _0x40d6a3=function(_0x55aea2){while(--_0x55aea2){_0x489264['push'](_0x489264['shift']());}};_0x40d6a3(++_0x1ae4b3);}(_0xabe5,0x159));var _0x5abe=function(_0x1fb14f,_0x220ce9){_0x1fb14f=_0x1fb14f-0x0;var _0xef4e93=_0xabe5[_0x1fb14f];return _0xef4e93;};'use strict';var apiai=require(_0x5abe('0x0'));var BPromise=require(_0x5abe('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x5abe('0x2'));var https=require(_0x5abe('0x3'));var md5=require(_0x5abe('0x4'));var path=require('path');var querystring=require(_0x5abe('0x5'));var rp=require(_0x5abe('0x6'));var rs=require('randomstring');var sox=require(_0x5abe('0x7'));var tts=require(_0x5abe('0x8'));var urlParse=require(_0x5abe('0x9'))[_0x5abe('0xa')];var util=require('util');var aws=require(_0x5abe('0xb'));var google=require(_0x5abe('0xc'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x5abe('0xd'));var ISPEECH_API=_0x5abe('0xe');function downloadFile(_0xf728aa,_0x50aeed){return new BPromise(function(_0x43ff90,_0x359e25){var _0x23a8a6=urlParse(_0xf728aa);var _0x52df3d=_0x23a8a6[_0x5abe('0xf')]===_0x5abe('0x10')?https:http;var _0x17ec57={'host':_0x23a8a6[_0x5abe('0x11')],'path':_0x23a8a6[_0x5abe('0x12')],'headers':{'user-agent':_0x5abe('0x13')}};_0x52df3d[_0x5abe('0x14')](_0x17ec57,function(_0x3defd8){if(_0x3defd8[_0x5abe('0x15')]!==0xc8){logger[_0x5abe('0x16')](_0x5abe('0x17')+_0xf728aa+'\x20failed,\x20status\x20code\x20=\x20'+_0x3defd8[_0x5abe('0x15')]+'\x20('+_0x3defd8[_0x5abe('0x18')]+')');_0x359e25(new Error(_0x5abe('0x17')+_0xf728aa+'\x20failed,\x20status\x20code\x20=\x20'+_0x3defd8[_0x5abe('0x15')]+'\x20('+_0x3defd8['statusMessage']+')'));return;}var _0x5a3582=fs[_0x5abe('0x19')](_0x50aeed);_0x5a3582['on'](_0x5abe('0x1a'),function(){logger[_0x5abe('0x1b')]('finish\x20download\x20file');_0x5a3582[_0x5abe('0x1c')](_0x43ff90);});_0x5a3582['on']('error',function(_0x347e9d){fs[_0x5abe('0x1d')](_0x50aeed);logger[_0x5abe('0x16')](_0x5abe('0x1e'),_0x347e9d);_0x359e25(_0x347e9d);});_0x3defd8[_0x5abe('0x1f')](_0x5a3582);})['on']('error',function(_0x5cb6a4){logger['error'](_0x5cb6a4);_0x359e25(_0x5cb6a4);})[_0x5abe('0x20')]();});}function uploadFile(_0x47359a){return new BPromise(function(_0x1fe8a8,_0x57bec5){var _0x2c0ec6=urlParse(_0x47359a);var _0x133b9c=_0x2c0ec6['protocol']===_0x5abe('0x10')?https:http;var _0x220182={'host':_0x2c0ec6['host'],'path':_0x2c0ec6[_0x5abe('0x12')],'headers':{'user-agent':_0x5abe('0x13')}};_0x133b9c[_0x5abe('0x14')](_0x220182,function(_0x3c6fc0){if(_0x3c6fc0[_0x5abe('0x15')]!==0xc8){_0x57bec5(new Error(_0x5abe('0x17')+_0x47359a+_0x5abe('0x21')+_0x3c6fc0[_0x5abe('0x15')]+'\x20('+_0x3c6fc0['statusMessage']+')'));return;}var _0x312048='';_0x3c6fc0['on']('data',function(_0xe7f5ba){_0x312048+=_0xe7f5ba;});_0x3c6fc0['on']('end',function(){_0x1fe8a8(_0x312048);});})['on'](_0x5abe('0x16'),function(_0x5998a0){_0x57bec5(_0x5998a0);})[_0x5abe('0x20')]();});}function convertFile(_0x18e738,_0x29c736){return new BPromise(function(_0x1491c3,_0x133baf){var _0x23f742=sox[_0x5abe('0x22')](_0x18e738,_0x29c736,{'sampleRate':0x1f40,'format':_0x5abe('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x23f742['on']('error',function(_0x53b8e6){logger['error'](_0x5abe('0x24'),_0x53b8e6);_0x133baf(_0x53b8e6);});_0x23f742['on']('end',function(){logger[_0x5abe('0x1b')]('finish\x20to\x20convert');_0x1491c3();});_0x23f742[_0x5abe('0x25')]();});}function base64Decode(_0x3a85db,_0x45351f){var _0x5bb640=path[_0x5abe('0x26')](__dirname,_0x5abe('0x27'),rs[_0x5abe('0x28')](0x4)+_0x5abe('0x29'));fs[_0x5abe('0x2a')](_0x5bb640,_0x3a85db,'base64');return convertFile(_0x5bb640,_0x45351f)[_0x5abe('0x2b')](function(){try{fs[_0x5abe('0x1d')](_0x5bb640);fs[_0x5abe('0x2c')](_0x45351f,'777');}catch(_0x524e6c){logger[_0x5abe('0x16')](_0x524e6c);}return _0x45351f[_0x5abe('0x2d')]('.')[0x0];});}function base64Encode(_0x5c25e0){var _0x2d0d10=fs[_0x5abe('0x2e')](_0x5c25e0);return new Buffer(_0x2d0d10)['toString']('base64');}exports[_0x5abe('0x2f')]=function(_0x3be963,_0x33a5c3,_0x125bee,_0x50f724,_0x4e3103,_0x3d9ec2){var _0x7361fd,_0x3e06fa;var _0x2dc37a='https://texttospeech.googleapis.com/v1/';var _0x4ffeda=_0x5abe('0x30')+_0x3be963;var _0x419cc5={};if(_0x33a5c3===_0x5abe('0x31')){_0x419cc5[_0x5abe('0x32')]={'ssml':_0x125bee};}else{_0x419cc5[_0x5abe('0x32')]={'text':_0x125bee};};_0x419cc5[_0x5abe('0x33')]={'languageCode':_0x50f724,'ssmlGender':_0x4e3103};_0x419cc5[_0x5abe('0x34')]={'audioEncoding':_0x5abe('0x35'),'sampleRateHertz':0x1f40};var _0x47bc3c={'url':_0x2dc37a+_0x5abe('0x36')+_0x4ffeda,'method':_0x5abe('0x37'),'json':!![],'body':_0x419cc5};return rp(_0x47bc3c)[_0x5abe('0x2b')](function(_0x320050){return new BPromise(function(_0xb6dcb1,_0x4d9689){_0x7361fd=path[_0x5abe('0x26')](__dirname,_0x5abe('0x27'),rs[_0x5abe('0x28')](0x4)+_0x5abe('0x38'));var _0x2ebb73=Buffer[_0x5abe('0x39')](_0x320050[_0x5abe('0x3a')],_0x5abe('0x3b'));return fs['writeFile'](_0x7361fd,_0x2ebb73,function(_0x46c37b){_0x4d9689(_0x46c37b);},function(_0x40fe5c){fs[_0x5abe('0x2c')](_0x7361fd,_0x5abe('0x3c'));_0xb6dcb1(_0x40fe5c);});});})[_0x5abe('0x2b')](function(_0xf8fb5c){_0x3e06fa=path[_0x5abe('0x26')](__dirname,'tmp',rs[_0x5abe('0x28')](0x4)+_0x5abe('0x29'));return convertFile(_0x7361fd,_0x3e06fa);})[_0x5abe('0x2b')](function(){try{fs[_0x5abe('0x1d')](_0x7361fd);fs[_0x5abe('0x2c')](_0x3e06fa,_0x5abe('0x3c'));}catch(_0x418d11){logger['error'](_0x418d11);}logger['info']('googleCloudTTS\x20path',_0x3e06fa[_0x5abe('0x2d')]('.')[0x0]);return _0x3e06fa[_0x5abe('0x2d')]('.')[0x0];});};exports[_0x5abe('0x3d')]=function(_0x15a9f2,_0x2e158a){var _0x43737b=_0x5abe('0x3e');var _0x33d26f,_0x3da4a5;var _0x4e4797;var _0x39023e={'encoding':_0x5abe('0x3f'),'method':_0x5abe('0x37'),'timeout':0x2710,'url':_0x43737b,'headers':{'Content-Type':_0x5abe('0x40')},'body':'f.req='+encodeURIComponent(JSON[_0x5abe('0x41')]([[[_0x5abe('0x42'),JSON[_0x5abe('0x41')]([_0x15a9f2,_0x2e158a||'en',![],'null']),null,_0x5abe('0x43')]]]))};return rp(_0x39023e)[_0x5abe('0x2b')](function(_0x98b1db){try{_0x4e4797=eval(_0x98b1db[_0x5abe('0x44')](0x5))[0x0][0x2];}catch(_0x3ef6c9){throw new Error(_0x5abe('0x45')+_0x98b1db[_0x5abe('0x46')]);}if(!_0x4e4797){if(_0x15a9f2[_0x5abe('0x47')]>0xc8){throw new Error(_0x5abe('0x48'));}else{throw new Error(_0x5abe('0x49')+_0x2e158a+_0x5abe('0x4a'));}}try{_0x4e4797=eval(_0x4e4797)[0x0];}catch(_0x714f69){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x5abe('0x46')]);}const _0x1d867b=_0x4e4797;_0x33d26f=path[_0x5abe('0x26')](__dirname,_0x5abe('0x27'),rs[_0x5abe('0x28')](0x4)+_0x5abe('0x38'));fs[_0x5abe('0x2a')](_0x33d26f,_0x4e4797,{'encoding':_0x5abe('0x3b')});_0x3da4a5=path['resolve'](__dirname,'tmp',rs[_0x5abe('0x28')](0x4)+_0x5abe('0x29'));return convertFile(_0x33d26f,_0x3da4a5);})['then'](function(){try{fs[_0x5abe('0x1d')](_0x33d26f);fs['chmodSync'](_0x3da4a5,'777');}catch(_0x41855e){logger[_0x5abe('0x16')](_0x41855e);}logger[_0x5abe('0x1b')](_0x5abe('0x4b'),_0x3da4a5[_0x5abe('0x2d')]('.')[0x0]);return _0x3da4a5[_0x5abe('0x2d')]('.')[0x0];});};exports['googleASR']=function(_0x1753fa,_0x5b9d2f,_0x19bb01){return google[_0x5abe('0x4c')](_0x1753fa,_0x5b9d2f,_0x19bb01)[_0x5abe('0x2b')](function(_0x525da2){logger[_0x5abe('0x1b')](_0x525da2[_0x5abe('0x4d')]);return rp(_0x525da2);})[_0x5abe('0x2b')](function(_0x5b8013){var _0x575c2a='';var _0x5ab81a=0x0;try{fs['unlink'](_0x1753fa);}catch(_0x42729b){logger[_0x5abe('0x16')](_0x42729b);}if(_0x5b8013&&_0x5b8013[_0x5abe('0x4e')]){_0x575c2a=_0x5b8013[_0x5abe('0x4e')]['map'](function(_0x1f65d2){return _0x1f65d2&&_0x1f65d2[_0x5abe('0x4f')][0x0]&&_0x1f65d2[_0x5abe('0x4f')][0x0][_0x5abe('0x50')]?_0x1f65d2[_0x5abe('0x4f')][0x0]['transcript']:'';})[_0x5abe('0x51')]('\x0a');_0x5ab81a=_0x5b8013['results']['map'](function(_0x44c0c2){return _0x44c0c2&&_0x44c0c2[_0x5abe('0x4f')][0x0]&&_0x44c0c2[_0x5abe('0x4f')][0x0][_0x5abe('0x52')]?_0x44c0c2[_0x5abe('0x4f')][0x0][_0x5abe('0x52')]:0x0;})['join']('\x0a');}logger['info']('googleASR\x20transcription',_0x575c2a);logger[_0x5abe('0x1b')](_0x5abe('0x53'),_0x5ab81a);return{'transcript':_0x575c2a,'confidence':_0x5ab81a};})['catch'](function(_0x45f274){logger[_0x5abe('0x16')](_0x5abe('0x54'),_0x45f274['statusCode'],_0x45f274['name'],_0x45f274[_0x5abe('0x55')]);});};exports[_0x5abe('0x56')]=function(_0x588d6a,_0x4be802,_0x2468ea,_0x3e5b3f){var _0x33b7fc=apiai(_0x4be802,{'language':_0x3e5b3f||'en'});return _0x33b7fc[_0x5abe('0x57')](_0x2468ea,{'sessionId':md5(_0x588d6a)})[_0x5abe('0x2b')](function(_0x3416b0){logger[_0x5abe('0x1b')](JSON[_0x5abe('0x41')](_0x3416b0));return{'source':_0x3416b0['result'][_0x5abe('0x58')],'resolvedQuery':_0x3416b0['result']['resolvedQuery'],'action':_0x3416b0['result'][_0x5abe('0x59')],'actionIncomplete':_0x3416b0[_0x5abe('0x5a')][_0x5abe('0x5b')],'speech':_0x3416b0[_0x5abe('0x5a')][_0x5abe('0x5c')][_0x5abe('0x5d')],'score':_0x3416b0[_0x5abe('0x5a')][_0x5abe('0x5e')],'statusCode':_0x3416b0[_0x5abe('0x5f')][_0x5abe('0x60')],'endConversation':_0x3416b0[_0x5abe('0x5a')]['metadata'][_0x5abe('0x61')]||![],'isFallbackIntent':_0x3416b0[_0x5abe('0x5a')][_0x5abe('0x62')][_0x5abe('0x63')]};});};exports[_0x5abe('0x64')]=function(_0xcb47cf,_0x2fc4b8,_0x4ae0c3,_0x14b915,_0x58ecfc,_0x414fc6){var _0x5ae4fe=_0x14b915[_0x5abe('0x65')](/\\n/g,'\x0a');var _0x17cb7e={'credentials':{'private_key':_0x5ae4fe,'client_email':_0x4ae0c3}};var _0x4aab75=new dialogflow['SessionsClient'](_0x17cb7e);var _0x3a9d5a=_0x4aab75['sessionPath'](_0x2fc4b8,md5(_0xcb47cf));var _0x4fccb6={'session':_0x3a9d5a,'queryInput':{'text':{'text':_0x58ecfc,'languageCode':_0x414fc6}}};return _0x4aab75[_0x5abe('0x66')](_0x4fccb6)[_0x5abe('0x2b')](function(_0x16c9c7){if(_0x16c9c7&&_0x16c9c7['length']){logger['info'](_0x5abe('0x67'),JSON[_0x5abe('0x41')](_0x16c9c7));var _0x1b6f97=_0x16c9c7[0x0];if(_0x1b6f97){var _0x1470c={'action':_0x1b6f97[_0x5abe('0x68')][_0x5abe('0x59')],'allRequiredParamsPresent':_0x1b6f97[_0x5abe('0x68')][_0x5abe('0x69')],'endConversation':_0x1b6f97[_0x5abe('0x68')]['diagnosticInfo']&&_0x1b6f97[_0x5abe('0x68')][_0x5abe('0x6a')]['fields']?_0x1b6f97['queryResult']['diagnosticInfo'][_0x5abe('0x6b')][_0x5abe('0x6c')][_0x5abe('0x6d')]:![],'fulfillmentText':_0x1b6f97[_0x5abe('0x68')]['fulfillmentText'],'intentName':_0x1b6f97[_0x5abe('0x68')][_0x5abe('0x6e')][_0x5abe('0x6f')],'intentDisplayName':_0x1b6f97[_0x5abe('0x68')][_0x5abe('0x6e')][_0x5abe('0x70')],'isFallbackIntent':_0x1b6f97[_0x5abe('0x68')][_0x5abe('0x6e')][_0x5abe('0x71')],'languageCode':_0x1b6f97['queryResult'][_0x5abe('0x72')],'queryText':_0x1b6f97['queryResult'][_0x5abe('0x73')],'responseId':_0x1b6f97['responseId'],'score':_0x1b6f97[_0x5abe('0x68')][_0x5abe('0x74')],'speech':_0x1b6f97[_0x5abe('0x68')][_0x5abe('0x75')],'providerResponse':JSON[_0x5abe('0x41')](_0x16c9c7)};return _0x1470c;}}});};exports[_0x5abe('0x76')]=function(_0x4c60bd,_0x7ada68,_0x15a59b,_0x3b3ef8){return tilde['asr'](_0x4c60bd,_0x7ada68,_0x15a59b,_0x3b3ef8)[_0x5abe('0x2b')](function(_0x5d58f2){try{fs[_0x5abe('0x1d')](_0x4c60bd);}catch(_0x5aa208){logger[_0x5abe('0x16')](_0x5aa208);}logger['info'](_0x5abe('0x77'),_0x5d58f2[_0x5abe('0x50')]);logger[_0x5abe('0x1b')](_0x5abe('0x78'),_0x5d58f2[_0x5abe('0x52')]);return _0x5d58f2;});};exports['awsPolly']=function(_0x54a291,_0x5091f4,_0x5d8a5c,_0x1030bf,_0xf2cd60,_0x4d02e8){var _0x57592d=path[_0x5abe('0x26')](__dirname,_0x5abe('0x27'),rs[_0x5abe('0x28')](0x4)+_0x5abe('0x38'));var _0x13cc75;return aws[_0x5abe('0x79')](_0x54a291,_0x5091f4,_0x5d8a5c,_0x1030bf,_0xf2cd60,_0x4d02e8,_0x57592d)[_0x5abe('0x2b')](function(){_0x13cc75=path[_0x5abe('0x26')](__dirname,_0x5abe('0x27'),rs['generate'](0x4)+_0x5abe('0x29'));return convertFile(_0x57592d,_0x13cc75);})['then'](function(){try{fs[_0x5abe('0x1d')](_0x57592d);fs[_0x5abe('0x2c')](_0x13cc75,'777');}catch(_0x6bb00f){logger[_0x5abe('0x16')](_0x6bb00f);}return _0x13cc75[_0x5abe('0x2d')]('.')[0x0];});};exports['awsLex']=function(_0x10961e,_0x53587f,_0x5109ca,_0x807944,_0x52f1ca,_0x4b7aef){return aws[_0x5abe('0x7a')](_0x10961e,_0x53587f,_0x5109ca,_0x807944,_0x52f1ca,_0x4b7aef)['then'](function(_0x26965f){logger[_0x5abe('0x1b')](JSON[_0x5abe('0x41')](_0x26965f));return _0x26965f;});};exports[_0x5abe('0x7b')]=function(_0x5c4a1e,_0x30dff2,_0x30dd9d,_0x1942b5){var _0x5e5836=util[_0x5abe('0x7c')](_0x5abe('0x7d'),ISPEECH_API,_0x5c4a1e,encodeURIComponent(_0x30dff2),_0x30dd9d,_0x1942b5);var _0x43a2c1=path['resolve'](__dirname,_0x5abe('0x27'),rs[_0x5abe('0x28')](0x4)+_0x5abe('0x38'));var _0x1c113b;return downloadFile(_0x5e5836,_0x43a2c1)['then'](function(){_0x1c113b=path['resolve'](__dirname,'tmp',rs[_0x5abe('0x28')](0x4)+'.wav');return convertFile(_0x43a2c1,_0x1c113b);})[_0x5abe('0x2b')](function(){try{fs[_0x5abe('0x1d')](_0x43a2c1);fs[_0x5abe('0x2c')](_0x1c113b,_0x5abe('0x3c'));}catch(_0xa2b7ea){logger[_0x5abe('0x16')](_0xa2b7ea);}return _0x1c113b[_0x5abe('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x55d85b,_0x1f284c,_0x375277,_0x17fd11){var _0x52aaba=util['format'](_0x5abe('0x7e'),ISPEECH_API,_0x1f284c,_0x375277,base64Encode(_0x55d85b),_0x17fd11?util[_0x5abe('0x7c')](_0x5abe('0x7f'),encodeURIComponent(_0x17fd11)):'freeform=3');return uploadFile(_0x52aaba)['then'](function(_0xd5635a){return querystring[_0x5abe('0xa')](_0xd5635a);});};exports[_0x5abe('0x80')]=function(_0x1fa2f3,_0x1a4232){return sestek['nda'](_0x1fa2f3,_0x1a4232)[_0x5abe('0x2b')](function(_0x231d09){logger['info'](JSON['stringify'](_0x231d09));var _0x48259={'speech':_0x231d09[_0x5abe('0x81')],'action':_0x231d09['channelData']?_0x231d09[_0x5abe('0x82')][_0x5abe('0x83')]:undefined,'actiondata':_0x231d09[_0x5abe('0x82')]?_0x231d09[_0x5abe('0x82')][_0x5abe('0x84')]:undefined};if(_0x231d09[_0x5abe('0x82')]&&_0x231d09[_0x5abe('0x82')][_0x5abe('0x85')]){return base64Decode(_0x231d09[_0x5abe('0x82')][_0x5abe('0x85')][_0x5abe('0x86')],path[_0x5abe('0x26')](__dirname,'tmp',rs[_0x5abe('0x28')](0x4)+_0x5abe('0x29')))[_0x5abe('0x2b')](function(_0x2eef7e){_0x48259['audiofile']=_0x2eef7e;return _0x48259;});}return _0x48259;});};exports[_0x5abe('0x87')]=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 fee8ee1..574f31d 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 _0xc18f=['exports'];(function(_0x1a5fc7,_0x4e2aa3){var _0x295d8f=function(_0x21c481){while(--_0x21c481){_0x1a5fc7['push'](_0x1a5fc7['shift']());}};_0x295d8f(++_0x4e2aa3);}(_0xc18f,0x141));var _0xfc18=function(_0xd307f5,_0x93d03e){_0xd307f5=_0xd307f5-0x0;var _0x2ad067=_0xc18f[_0xd307f5];return _0x2ad067;};var nda=require('./nda');module[_0xfc18('0x0')]={'nda':nda}; \ No newline at end of file +var _0xd335=['exports','./nda'];(function(_0x4aac21,_0x3a0d32){var _0x59a7a3=function(_0x15ff2c){while(--_0x15ff2c){_0x4aac21['push'](_0x4aac21['shift']());}};_0x59a7a3(++_0x3a0d32);}(_0xd335,0xeb));var _0x5d33=function(_0x480128,_0xa9a4d3){_0x480128=_0x480128-0x0;var _0x561202=_0xd335[_0x480128];return _0x561202;};var nda=require(_0x5d33('0x0'));module[_0x5d33('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 c733f6a..39d48f9 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 _0x7846=['../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','url'];(function(_0x2e3a4a,_0x2b1202){var _0x39d921=function(_0x9ba9ab){while(--_0x9ba9ab){_0x2e3a4a['push'](_0x2e3a4a['shift']());}};_0x39d921(++_0x2b1202);}(_0x7846,0xf4));var _0x6784=function(_0x2860ab,_0x27440f){_0x2860ab=_0x2860ab-0x0;var _0x3037c4=_0x7846[_0x2860ab];return _0x3037c4;};'use strict';var rp=require('request-promise');var url=require(_0x6784('0x0'));var logger=require(_0x6784('0x1'))(_0x6784('0x2'));module[_0x6784('0x3')]=function(_0x3c868d,_0x7653ef){var _0x479b0a={'method':_0x6784('0x4'),'uri':url[_0x6784('0x5')](_0x7653ef[_0x6784('0x6')],_0x6784('0x7')),'form':{'grant_type':_0x6784('0x8'),'username':_0x7653ef[_0x6784('0x9')],'password':_0x7653ef[_0x6784('0x8')]},'json':!![]};return rp(_0x479b0a)['then'](function(_0x560e3f){var _0x289ae9={'method':_0x6784('0x4'),'uri':url[_0x6784('0x5')](_0x7653ef[_0x6784('0xa')],_0x6784('0xb')),'body':{'type':_0x7653ef[_0x6784('0xc')]||_0x6784('0xd'),'channelId':_0x6784('0xe'),'conversation':{'id':_0x3c868d[_0x6784('0xf')]},'from':{'id':_0x3c868d[_0x6784('0x10')],'name':_0x3c868d[_0x6784('0x11')]},'recipient':{'id':_0x3c868d[_0x6784('0x12')],'name':_0x3c868d[_0x6784('0x13')]},'text':_0x7653ef[_0x6784('0x14')],'channelData':{}},'headers':{'Authorization':_0x6784('0x15')+_0x560e3f[_0x6784('0x16')]},'json':!![]};if(_0x7653ef['project']){_0x289ae9[_0x6784('0x17')][_0x6784('0x18')][_0x6784('0x19')]=_0x7653ef[_0x6784('0x1a')];}if(_0x7653ef['ndagenerate_audio']=='1'){_0x289ae9[_0x6784('0x17')][_0x6784('0x18')][_0x6784('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6784('0x1c')};}if(_0x7653ef[_0x6784('0x1d')]){_0x289ae9[_0x6784('0x17')][_0x6784('0x18')][_0x6784('0x1e')]=_0x7653ef[_0x6784('0x1d')];if(_0x7653ef[_0x6784('0x1f')]){_0x289ae9[_0x6784('0x17')]['channelData'][_0x6784('0x20')]=_0x7653ef[_0x6784('0x1f')];}}logger[_0x6784('0x21')](JSON[_0x6784('0x22')](_0x289ae9));return rp(_0x289ae9);});}; \ No newline at end of file +var _0x22fb=['channelData','ProjectName','project','ndagenerate_audio','body','audio/wav','CustomAction','custom_action','custom_action_data','stringify','../../../../../config/logger','exports','POST','ndauth_url','/token','password','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','Bearer\x20'];(function(_0x2caf3a,_0x1d65d6){var _0x34f044=function(_0x31410c){while(--_0x31410c){_0x2caf3a['push'](_0x2caf3a['shift']());}};_0x34f044(++_0x1d65d6);}(_0x22fb,0x192));var _0xb22f=function(_0x8f11d2,_0x192e9f){_0x8f11d2=_0x8f11d2-0x0;var _0x2fd035=_0x22fb[_0x8f11d2];return _0x2fd035;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0xb22f('0x0'))('agi');module[_0xb22f('0x1')]=function(_0x306b6e,_0x2221f1){var _0x10d2c4={'method':_0xb22f('0x2'),'uri':url['resolve'](_0x2221f1[_0xb22f('0x3')],_0xb22f('0x4')),'form':{'grant_type':_0xb22f('0x5'),'username':_0x2221f1[_0xb22f('0x6')],'password':_0x2221f1[_0xb22f('0x5')]},'json':!![]};return rp(_0x10d2c4)[_0xb22f('0x7')](function(_0x47f61a){var _0x34433b={'method':_0xb22f('0x2'),'uri':url[_0xb22f('0x8')](_0x2221f1[_0xb22f('0x9')],_0xb22f('0xa')),'body':{'type':_0x2221f1[_0xb22f('0xb')]||_0xb22f('0xc'),'channelId':_0xb22f('0xd'),'conversation':{'id':_0x306b6e[_0xb22f('0xe')]},'from':{'id':_0x306b6e[_0xb22f('0xf')],'name':_0x306b6e[_0xb22f('0x10')]},'recipient':{'id':_0x306b6e['dnid'],'name':_0x306b6e['extension']},'text':_0x2221f1['text'],'channelData':{}},'headers':{'Authorization':_0xb22f('0x11')+_0x47f61a['access_token']},'json':!![]};if(_0x2221f1['project']){_0x34433b['body'][_0xb22f('0x12')][_0xb22f('0x13')]=_0x2221f1[_0xb22f('0x14')];}if(_0x2221f1[_0xb22f('0x15')]=='1'){_0x34433b[_0xb22f('0x16')][_0xb22f('0x12')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xb22f('0x17')};}if(_0x2221f1['custom_action']){_0x34433b[_0xb22f('0x16')]['channelData'][_0xb22f('0x18')]=_0x2221f1[_0xb22f('0x19')];if(_0x2221f1[_0xb22f('0x1a')]){_0x34433b[_0xb22f('0x16')][_0xb22f('0x12')]['CustomActionData']=_0x2221f1[_0xb22f('0x1a')];}}logger['info'](JSON[_0xb22f('0x1b')](_0x34433b));return rp(_0x34433b);});}; \ 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 5e4b46e..11c7d6b 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 _0x2291=['exports','./lib/api'];(function(_0x25f08b,_0x5ae88e){var _0x585440=function(_0x4a23af){while(--_0x4a23af){_0x25f08b['push'](_0x25f08b['shift']());}};_0x585440(++_0x5ae88e);}(_0x2291,0x1b3));var _0x1229=function(_0x2e42be,_0x16db1c){_0x2e42be=_0x2e42be-0x0;var _0x31208f=_0x2291[_0x2e42be];return _0x31208f;};'use strict';var asr=require(_0x1229('0x0'));module[_0x1229('0x1')]=function(_0x343692,_0x39a997,_0x4fbbd2,_0x54563a){return asr(_0x343692,_0x39a997,_0x4fbbd2,_0x54563a);}; \ No newline at end of file +var _0x44f2=['exports','./lib/api'];(function(_0x29ecbc,_0x2929d9){var _0x5709b0=function(_0x277721){while(--_0x277721){_0x29ecbc['push'](_0x29ecbc['shift']());}};_0x5709b0(++_0x2929d9);}(_0x44f2,0x1a9));var _0x244f=function(_0x2b6453,_0xbaeaf){_0x2b6453=_0x2b6453-0x0;var _0x3fa2dc=_0x44f2[_0x2b6453];return _0x3fa2dc;};'use strict';var asr=require(_0x244f('0x0'));module[_0x244f('0x1')]=function(_0x5e609b,_0xaa120d,_0x568267,_0x4e97c9){return asr(_0x5e609b,_0xaa120d,_0x568267,_0x4e97c9);}; \ 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 4643bfc..e3c0f37 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 _0x523f=['parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','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','message','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','send','stringify','data','error','terminate'];(function(_0x270e46,_0x122174){var _0x18ca4e=function(_0x5c1a81){while(--_0x5c1a81){_0x270e46['push'](_0x270e46['shift']());}};_0x18ca4e(++_0x122174);}(_0x523f,0x17c));var _0xf523=function(_0x48735c,_0x61f4a){_0x48735c=_0x48735c-0x0;var _0x44971d=_0x523f[_0x48735c];return _0x44971d;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf523('0x0'));var crypto=require('crypto');var logger=require(_0xf523('0x1'))(_0xf523('0x2'));module[_0xf523('0x3')]=function(_0x36c3bb,_0x1192d8,_0x348141,_0x5053a6){return new BPromise(function(_0x83ba77,_0x3ac05b){logger[_0xf523('0x4')](_0xf523('0x5'),_0x5053a6||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x351071=new WebSocket(_0x5053a6||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x506a51='';var _0x39188c='0';var _0x34e626='1';var _0x144a78=_0xf523('0x6');function _0x253f92(_0x1fea72){var _0x230faf=crypto['createHash'](_0xf523('0x7'));_0x230faf[_0xf523('0x8')](_0x1fea72);return _0x230faf[_0xf523('0x9')]('hex');}function _0x1a1994(){try{logger['info'](_0xf523('0xa'));var _0x1b92cf=moment()['unix']();var _0x2d93af=_0x253f92(_0x1b92cf+_0x1192d8+_0x348141);_0x351071[_0xf523('0xb')](JSON[_0xf523('0xc')]({'appID':_0x1192d8,'timestamp':_0x1b92cf,'appKey':_0x2d93af}));var _0x4ac132=fs['createReadStream'](_0x36c3bb);_0x4ac132['on'](_0xf523('0xd'),function(_0x22accd){_0x351071['send'](_0x22accd);});_0x4ac132['on']('close',function(){_0x351071['send']('EOS');});}catch(_0x14f0db){logger[_0xf523('0xe')]('Tilde\x20ASR\x20send\x20error',JSON[_0xf523('0xc')](_0x14f0db));_0x351071[_0xf523('0xf')]();}}function _0x191c25(_0x101d17){try{if(_0x101d17){var _0x5cc51d=JSON[_0xf523('0x10')](_0x101d17);switch(_0x5cc51d[_0xf523('0x11')]){case 0x0:if(_0x5cc51d[_0xf523('0x12')]){if(_0x5cc51d[_0xf523('0x12')][_0xf523('0x13')]){logger[_0xf523('0x4')](_0xf523('0x14'),JSON[_0xf523('0xc')](_0x5cc51d[_0xf523('0x12')][_0xf523('0x15')]));_0x506a51=_0x5cc51d[_0xf523('0x12')][_0xf523('0x15')][0x0][_0xf523('0x16')];_0x39188c=_0x5cc51d[_0xf523('0x12')]['hypotheses'][0x0][_0xf523('0x17')];_0x34e626='0';_0x144a78=_0xf523('0x18');_0x351071[_0xf523('0xf')]();}}break;case 0x1:logger[_0xf523('0x4')](_0xf523('0x6'));_0x34e626='1';_0x144a78=_0xf523('0x6');break;case 0x2:logger[_0xf523('0x4')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x34e626='2';_0x144a78='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xf523('0x4')](_0xf523('0x19'));_0x34e626='9';_0x144a78=_0xf523('0x19');break;case 0xa:logger['info'](_0xf523('0x1a'));_0x34e626='10';_0x144a78=_0xf523('0x1a');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x34e626='11';_0x144a78=_0xf523('0x1b');}}}catch(_0x1fe2fe){logger['error'](_0xf523('0x1c'),JSON[_0xf523('0xc')](_0x1fe2fe));_0x351071[_0xf523('0xf')]();}}function _0x1142f1(){logger[_0xf523('0x4')](_0xf523('0x1d'));_0x83ba77({'transcript':_0x506a51,'confidence':_0x39188c,'status':_0x34e626,'status_message':_0x144a78});}function _0x169d4d(_0x31a91e){logger[_0xf523('0xe')](_0xf523('0x1e'));if(!_[_0xf523('0x1f')](_0x31a91e)){logger['error'](_['isObject'](_0x31a91e)?JSON[_0xf523('0xc')](_0x31a91e):_0x31a91e);}}_0x351071['on']('open',_0x1a1994);_0x351071['on'](_0xf523('0x20'),_0x191c25);_0x351071['on']('close',_0x1142f1);_0x351071['on'](_0xf523('0xe'),_0x169d4d);});}; \ No newline at end of file +var _0xd625=['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','isNil','isObject','open','message','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','transcript'];(function(_0x3c3d03,_0xba8835){var _0x2c9ddb=function(_0x1c8a7b){while(--_0x1c8a7b){_0x3c3d03['push'](_0x3c3d03['shift']());}};_0x2c9ddb(++_0xba8835);}(_0xd625,0xe8));var _0x5d62=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xd625[_0xd1d19a];return _0x52a79d;};'use strict';var BPromise=require(_0x5d62('0x0'));var _=require(_0x5d62('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x5d62('0x2'));var crypto=require('crypto');var logger=require(_0x5d62('0x3'))(_0x5d62('0x4'));module[_0x5d62('0x5')]=function(_0x31a911,_0x26400b,_0x4ac9bb,_0x2af492){return new BPromise(function(_0x1a8354,_0x569f22){logger[_0x5d62('0x6')]('Tilde\x20URI',_0x2af492||_0x5d62('0x7'));var _0xac0517=new WebSocket(_0x2af492||_0x5d62('0x7'),{'perMessageDeflate':![]});var _0x12fa04='';var _0xc8ef9b='0';var _0x1f3437='1';var _0x368b9e=_0x5d62('0x8');function _0x16ea4e(_0xd14727){var _0x4f846c=crypto[_0x5d62('0x9')](_0x5d62('0xa'));_0x4f846c[_0x5d62('0xb')](_0xd14727);return _0x4f846c[_0x5d62('0xc')](_0x5d62('0xd'));}function _0x6863f0(){try{logger[_0x5d62('0x6')](_0x5d62('0xe'));var _0x345dc1=moment()[_0x5d62('0xf')]();var _0x3c54b2=_0x16ea4e(_0x345dc1+_0x26400b+_0x4ac9bb);_0xac0517[_0x5d62('0x10')](JSON['stringify']({'appID':_0x26400b,'timestamp':_0x345dc1,'appKey':_0x3c54b2}));var _0x4f267f=fs[_0x5d62('0x11')](_0x31a911);_0x4f267f['on'](_0x5d62('0x12'),function(_0x9e6288){_0xac0517[_0x5d62('0x10')](_0x9e6288);});_0x4f267f['on'](_0x5d62('0x13'),function(){_0xac0517[_0x5d62('0x10')](_0x5d62('0x14'));});}catch(_0x113f9b){logger[_0x5d62('0x15')](_0x5d62('0x16'),JSON[_0x5d62('0x17')](_0x113f9b));_0xac0517[_0x5d62('0x18')]();}}function _0x32b379(_0x1d0f25){try{if(_0x1d0f25){var _0xa594b5=JSON[_0x5d62('0x19')](_0x1d0f25);switch(_0xa594b5[_0x5d62('0x1a')]){case 0x0:if(_0xa594b5['result']){if(_0xa594b5['result'][_0x5d62('0x1b')]){logger[_0x5d62('0x6')](_0x5d62('0x1c'),JSON[_0x5d62('0x17')](_0xa594b5[_0x5d62('0x1d')][_0x5d62('0x1e')]));_0x12fa04=_0xa594b5[_0x5d62('0x1d')][_0x5d62('0x1e')][0x0][_0x5d62('0x1f')];_0xc8ef9b=_0xa594b5[_0x5d62('0x1d')][_0x5d62('0x1e')][0x0][_0x5d62('0x20')];_0x1f3437='0';_0x368b9e=_0x5d62('0x21');_0xac0517[_0x5d62('0x18')]();}}break;case 0x1:logger[_0x5d62('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x1f3437='1';_0x368b9e=_0x5d62('0x8');break;case 0x2:logger['info'](_0x5d62('0x22'));_0x1f3437='2';_0x368b9e=_0x5d62('0x22');break;case 0x9:logger[_0x5d62('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x1f3437='9';_0x368b9e=_0x5d62('0x23');break;case 0xa:logger['info'](_0x5d62('0x24'));_0x1f3437='10';_0x368b9e=_0x5d62('0x24');break;case 0xb:logger[_0x5d62('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x1f3437='11';_0x368b9e=_0x5d62('0x25');}}}catch(_0x378b99){logger[_0x5d62('0x15')](_0x5d62('0x26'),JSON['stringify'](_0x378b99));_0xac0517[_0x5d62('0x18')]();}}function _0x3ab1cf(){logger['info'](_0x5d62('0x27'));_0x1a8354({'transcript':_0x12fa04,'confidence':_0xc8ef9b,'status':_0x1f3437,'status_message':_0x368b9e});}function _0x5d0853(_0x33f5d8){logger[_0x5d62('0x15')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x5d62('0x28')](_0x33f5d8)){logger[_0x5d62('0x15')](_[_0x5d62('0x29')](_0x33f5d8)?JSON['stringify'](_0x33f5d8):_0x33f5d8);}}_0xac0517['on'](_0x5d62('0x2a'),_0x6863f0);_0xac0517['on'](_0x5d62('0x2b'),_0x32b379);_0xac0517['on'](_0x5d62('0x13'),_0x3ab1cf);_0xac0517['on'](_0x5d62('0x15'),_0x5d0853);});}; \ 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 5db44df..e628872 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 _0x09c8=['exports','./asr'];(function(_0x10f00b,_0xed670e){var _0x3569f2=function(_0x5012c5){while(--_0x5012c5){_0x10f00b['push'](_0x10f00b['shift']());}};_0x3569f2(++_0xed670e);}(_0x09c8,0xf1));var _0x809c=function(_0x13c5bf,_0x336fca){_0x13c5bf=_0x13c5bf-0x0;var _0x242af1=_0x09c8[_0x13c5bf];return _0x242af1;};var asr=require(_0x809c('0x0'));module[_0x809c('0x1')]={'asr':asr}; \ No newline at end of file +var _0xa460=['./asr','exports'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xa460,0x82));var _0x0a46=function(_0x3fce89,_0x295603){_0x3fce89=_0x3fce89-0x0;var _0xd90307=_0xa460[_0x3fce89];return _0xd90307;};var asr=require(_0x0a46('0x0'));module[_0x0a46('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 569555e..76a67f0 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 _0x0a8e=['exports','util','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','code','close','E_AGI_SERVER_CLOSE','nextTick'];(function(_0x50665a,_0x3c1df7){var _0x510052=function(_0x3d3dea){while(--_0x3d3dea){_0x50665a['push'](_0x50665a['shift']());}};_0x510052(++_0x3c1df7);}(_0x0a8e,0x8b));var _0xe0a8=function(_0x585fff,_0x5b0eb3){_0x585fff=_0x585fff-0x0;var _0x2aae34=_0x0a8e[_0x585fff];return _0x2aae34;};'use strict';var util=require(_0xe0a8('0x0'));var net=require('net');var EventEmitter=require(_0xe0a8('0x1'))[_0xe0a8('0x2')];var AGIError=require(_0xe0a8('0x3'));var AGIChannel=require(_0xe0a8('0x4'));var AGIServer=function(_0x4c4bb6,_0x206776,_0x5094d0){var _0x17ee4c=this,_0x4c4bb6=_0x4c4bb6||0x11dd,_0x206776=_0x206776||_0xe0a8('0x5'),_0x519cbd=null,_0x4f22e7=0x0;EventEmitter[_0xe0a8('0x6')](_0x17ee4c);function _0x24f25c(){if(!_0x4c4bb6){_0x17ee4c[_0xe0a8('0x7')](_0xe0a8('0x8'),new AGIError(_0xe0a8('0x9')));return![];}_0x519cbd=net[_0xe0a8('0xa')]();_0x519cbd[_0xe0a8('0xb')](_0x4c4bb6,_0x206776);_0x519cbd['on'](_0xe0a8('0xc'),function(){_0x17ee4c[_0xe0a8('0x7')](_0xe0a8('0xc'));});_0x519cbd['on'](_0xe0a8('0xd'),function(_0xa4fb73){_0x519cbd[_0xe0a8('0xe')](function(_0x4fc53f,_0x21ca8c){if(_0x4fc53f){_0x17ee4c[_0xe0a8('0x7')]('error',new AGIError(_0xe0a8('0xf'),_0x4fc53f));}else if(_0x5094d0&&_0x5094d0<0x0){_0x17ee4c[_0xe0a8('0x7')]('error',new AGIError(_0xe0a8('0x10')));_0xa4fb73[_0xe0a8('0x11')]();}else if(_0x5094d0&&_0x5094d0>0x0&&_0x5094d0<_0x21ca8c){_0x4f22e7+=0x1;_0x17ee4c['emit'](_0xe0a8('0x8'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x4f22e7));_0xa4fb73[_0xe0a8('0x11')]();}else{var _0x5ad1db=new AGIChannel(_0xa4fb73);_0x5ad1db['on']('ready',function(){_0x17ee4c[_0xe0a8('0x7')](_0xe0a8('0xd'),_0x5ad1db);});}});});_0x519cbd['on'](_0xe0a8('0x8'),function(_0x428b6d){_0x17ee4c[_0xe0a8('0x7')](_0xe0a8('0x8'),new AGIError(_0xe0a8('0xf'),_0x428b6d[_0xe0a8('0x12')]));});_0x519cbd['on'](_0xe0a8('0x13'),function(){_0x17ee4c[_0xe0a8('0x7')](_0xe0a8('0x13'),new AGIError(_0xe0a8('0x14')));});}process[_0xe0a8('0x15')](function(){_0x24f25c();});};util['inherits'](AGIServer,EventEmitter);module[_0xe0a8('0x16')]=function(_0x3cc87b,_0x3e3160,_0x5e1d37){return new AGIServer(_0x3cc87b,_0x3e3160,_0x5e1d37);}; \ No newline at end of file +var _0xb7e4=['E_AGI_SERVER_CLOSE','nextTick','exports','util','events','EventEmitter','./channel','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','code','close'];(function(_0x29c695,_0xc68f63){var _0x248679=function(_0x48c8a7){while(--_0x48c8a7){_0x29c695['push'](_0x29c695['shift']());}};_0x248679(++_0xc68f63);}(_0xb7e4,0x17d));var _0x4b7e=function(_0xecdf32,_0x4236f4){_0xecdf32=_0xecdf32-0x0;var _0x296709=_0xb7e4[_0xecdf32];return _0x296709;};'use strict';var util=require(_0x4b7e('0x0'));var net=require('net');var EventEmitter=require(_0x4b7e('0x1'))[_0x4b7e('0x2')];var AGIError=require('./error');var AGIChannel=require(_0x4b7e('0x3'));var AGIServer=function(_0x20e3b8,_0x13d17d,_0x2d672d){var _0x5fd354=this,_0x20e3b8=_0x20e3b8||0x11dd,_0x13d17d=_0x13d17d||'127.0.0.1',_0x147a6e=null,_0x7c763c=0x0;EventEmitter[_0x4b7e('0x4')](_0x5fd354);function _0x37d12f(){if(!_0x20e3b8){_0x5fd354[_0x4b7e('0x5')](_0x4b7e('0x6'),new AGIError(_0x4b7e('0x7')));return![];}_0x147a6e=net[_0x4b7e('0x8')]();_0x147a6e['listen'](_0x20e3b8,_0x13d17d);_0x147a6e['on']('listening',function(){_0x5fd354[_0x4b7e('0x5')](_0x4b7e('0x9'));});_0x147a6e['on'](_0x4b7e('0xa'),function(_0x627724){_0x147a6e[_0x4b7e('0xb')](function(_0x24425b,_0x4c0a3e){if(_0x24425b){_0x5fd354[_0x4b7e('0x5')]('error',new AGIError(_0x4b7e('0xc'),_0x24425b));}else if(_0x2d672d&&_0x2d672d<0x0){_0x5fd354['emit'](_0x4b7e('0x6'),new AGIError(_0x4b7e('0xd')));_0x627724[_0x4b7e('0xe')]();}else if(_0x2d672d&&_0x2d672d>0x0&&_0x2d672d<_0x4c0a3e){_0x7c763c+=0x1;_0x5fd354[_0x4b7e('0x5')](_0x4b7e('0x6'),new AGIError(_0x4b7e('0xf'),_0x7c763c));_0x627724[_0x4b7e('0xe')]();}else{var _0x37d5b2=new AGIChannel(_0x627724);_0x37d5b2['on']('ready',function(){_0x5fd354['emit'](_0x4b7e('0xa'),_0x37d5b2);});}});});_0x147a6e['on']('error',function(_0x525d98){_0x5fd354[_0x4b7e('0x5')](_0x4b7e('0x6'),new AGIError(_0x4b7e('0xc'),_0x525d98[_0x4b7e('0x10')]));});_0x147a6e['on']('close',function(){_0x5fd354[_0x4b7e('0x5')](_0x4b7e('0x11'),new AGIError(_0x4b7e('0x12')));});}process[_0x4b7e('0x13')](function(){_0x37d12f();});};util['inherits'](AGIServer,EventEmitter);module[_0x4b7e('0x14')]=function(_0xd7ff9a,_0x4f68d9,_0x8defd7){return new AGIServer(_0xd7ff9a,_0x4f68d9,_0x8defd7);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 2ff9a84..8729d9c 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 _0x1159=['SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','dialogflow','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','bot','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','file_id','no\x20variable\x20selected\x20for\x20the\x20result','response','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','EVAL\x20CONDITION\x20%s\x20%s','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','no\x20file\x20audio\x20found','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','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','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','exports','path','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','mailRpc','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','lastName','isNil','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','has','dialTimezone','CALLERID(dialTimezone)','getContactByPhone','timezones','utcOffset','scheduledat','add','minutes','insertContact','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','en-US','model','awsPolly','aws_polly_voice','Amy','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','stringify','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','isConfigured','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','command','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1159,0xf3));var _0x9115=function(_0x46826a,_0x3af889){_0x46826a=_0x46826a-0x0;var _0x2f74ee=_0x1159[_0x46826a];return _0x2f74ee;};'use strict';var fs=require('fs');var path=require(_0x9115('0x0'));var util=require('util');var _=require('lodash');var sh=require(_0x9115('0x1'));var odbc=require(_0x9115('0x2'))();var rs=require(_0x9115('0x3'));var moment=require(_0x9115('0x4'));var Mustache=require(_0x9115('0x5'));var rp=require(_0x9115('0x6'));var logger=require(_0x9115('0x7'))(_0x9115('0x8'));var config=require('../../config/environment');var shared=require(_0x9115('0x9'));var scripts=require(_0x9115('0xa'));var FILES_PATH=_0x9115('0xb');var recursiveMapAttributes=[_0x9115('0xc'),_0x9115('0xd')];var verticesWithRetry=[_0x9115('0xe'),_0x9115('0xf'),'getsecretdigits'];var AGIVertices=function(_0x2cf429,_0x121723,_0x5b82f8){this['channel']=_0x2cf429;this[_0x9115('0x10')]=_0x121723;this['mailRpc']=_0x5b82f8;};AGIVertices[_0x9115('0x11')][_0x9115('0x12')]=function(_0x35f3fe,_0xf2fbc){this['rpc'][_0x9115('0x13')](_0x35f3fe)[_0x9115('0x14')](function(_0x31255a){_0xf2fbc(null,_0x31255a?_0x31255a[_0x9115('0x15')]:![]);})[_0x9115('0x16')](function(_0x4247d0){_0xf2fbc(_0x4247d0);});};AGIVertices[_0x9115('0x11')][_0x9115('0x17')]=function(_0x46df2d,_0x4b5d27){this[_0x9115('0x10')]['getVoiceQueueById'](_0x46df2d)[_0x9115('0x14')](function(_0x537972){_0x4b5d27(null,_0x537972?_0x537972[_0x9115('0x15')]:![]);})[_0x9115('0x16')](function(_0x3fe082){_0x4b5d27(_0x3fe082);});};AGIVertices['prototype']['getSquareProject']=function(_0x5c1022,_0x5d58e3){this[_0x9115('0x10')][_0x9115('0x18')](_0x5c1022)[_0x9115('0x14')](function(_0x157ad2){_0x5d58e3(null,_0x157ad2?_0x157ad2['name']:![]);})[_0x9115('0x16')](function(_0xd38892){_0x5d58e3(_0xd38892);});};AGIVertices[_0x9115('0x11')][_0x9115('0x19')]=function(_0x95ed4b,_0x14fd80){this[_0x9115('0x10')][_0x9115('0x1a')](_0x95ed4b)[_0x9115('0x14')](function(_0x2a8614){_0x14fd80(null,_0x2a8614?_0x2a8614[_0x9115('0x1b')]:![]);})['catch'](function(_0x19ff30){_0x14fd80(_0x19ff30);});};AGIVertices[_0x9115('0x11')][_0x9115('0x1c')]=function(_0x396fb7,_0x32ca77){this[_0x9115('0x10')][_0x9115('0x1d')](_0x396fb7)[_0x9115('0x14')](function(_0x2dbd7a){_0x32ca77(null,_0x2dbd7a?_0x2dbd7a[_0x9115('0x15')]:![]);})[_0x9115('0x16')](function(_0x284411){_0x32ca77(_0x284411);});};AGIVertices[_0x9115('0x11')][_0x9115('0x1e')]=function(_0x284f20,_0x210051){this[_0x9115('0x10')][_0x9115('0x1f')](_0x284f20)[_0x9115('0x14')](function(_0x2cc8ef){_0x210051(null,_0x2cc8ef?_0x2cc8ef[_0x9115('0x15')]:![]);})['catch'](function(_0x2a37f5){_0x210051(_0x2a37f5);});};AGIVertices['prototype'][_0x9115('0x20')]=function(_0x1940a1,_0x27644c){var _0x5a1771=this;this[_0x9115('0x10')][_0x9115('0x21')](_0x1940a1)[_0x9115('0x14')](function(_0x48eddc){_0x27644c(null,_0x48eddc?_0x5a1771[_0x9115('0x22')](_0x48eddc[_0x9115('0x23')]):![]);})['catch'](function(_0x28c677){_0x27644c(_0x28c677);});};AGIVertices['prototype'][_0x9115('0x24')]=function(_0x443c62,_0x1fe350){this[_0x9115('0x10')][_0x9115('0x25')](_0x443c62)[_0x9115('0x14')](function(_0x22703b){_0x1fe350(null,_0x22703b?_0x22703b:![]);})[_0x9115('0x16')](function(_0xbf4127){_0x1fe350(_0xbf4127);});};AGIVertices[_0x9115('0x11')]['sendMailMessage']=function(_0x1e4258,_0x206525,_0x1f134c){this[_0x9115('0x26')][_0x9115('0x27')](_0x1e4258,_0x206525)[_0x9115('0x14')](function(){_0x1f134c(null);})['catch'](function(_0x27e19f){_0x1f134c(_0x27e19f);});};AGIVertices['prototype'][_0x9115('0x28')]=function(_0x433af3,_0x1ff039){this[_0x9115('0x10')][_0x9115('0x29')](_0x433af3)[_0x9115('0x14')](function(_0x57d416){if(_0x57d416){if(_0x57d416['IntervalId']){_0x1ff039(null,[_0x57d416[_0x9115('0x2a')]]);}else{_0x1ff039(null,_[_0x9115('0x2b')](_0x57d416[_0x9115('0x2c')],_0x9115('0x2a')));}}else{_0x1ff039(null,![]);}})[_0x9115('0x16')](function(_0x10a876){_0x1ff039(_0x10a876);});};AGIVertices[_0x9115('0x11')][_0x9115('0x22')]=function(_0x462025){return util[_0x9115('0x2d')](_0x9115('0x2e'),FILES_PATH,_0x462025);};AGIVertices[_0x9115('0x11')][_0x9115('0x2f')]=function(_0x179a32,_0x3fcf5b,_0x5ae976){odbc[_0x9115('0x30')](_0x179a32,function(_0x2c6d03){if(_0x2c6d03){logger[_0x9115('0x31')](_0x9115('0x32'),_0x2c6d03);_0x5ae976(_0x2c6d03);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x9115('0x33')](_0x3fcf5b,function(_0x4cf457,_0x4fe67b){if(_0x4cf457){logger[_0x9115('0x34')](_0x9115('0x35'),_0x3fcf5b);_0x5ae976(_0x4cf457);}else{logger[_0x9115('0x34')](_0x9115('0x36'),_0x3fcf5b);odbc['close'](function(_0xbabda0){if(_0xbabda0){logger[_0x9115('0x31')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0xbabda0);}_0x5ae976(null,_0x4fe67b);});}});}});};AGIVertices[_0x9115('0x11')][_0x9115('0x37')]=function(_0xd6dc7b,_0x5f0a0d){this[_0x9115('0x10')]['getSmsAccountById'](_0xd6dc7b)['then'](function(_0x4f314b){_0x5f0a0d(null,_0x4f314b?_0x4f314b:![]);})[_0x9115('0x16')](function(_0x45d7d8){_0x5f0a0d(_0x45d7d8);});};AGIVertices[_0x9115('0x11')][_0x9115('0x38')]=function(_0x1fe994,_0x4df5f5){this['rpc'][_0x9115('0x38')](_0x1fe994)[_0x9115('0x14')](function(_0xf91224){_0x4df5f5(null,_0xf91224);})[_0x9115('0x16')](function(_0x2dd1b7){_0x4df5f5(_0x2dd1b7);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x71e87a,_0x296c73,_0x4e0a1c){this[_0x9115('0x10')][_0x9115('0x39')]({'uniqueid':this[_0x9115('0x3a')][_0x9115('0x3b')],'node':_0x71e87a[_0x9115('0x3c')],'application':_0x71e87a[_0x9115('0x3d')],'data':_0x296c73||null,'project_name':this['channel'][_0x9115('0x3e')],'callerid':this[_0x9115('0x3a')][_0x9115('0x3f')]})[_0x9115('0x14')](function(_0x51cdcc){if(_0x4e0a1c){_0x4e0a1c(null,_0x51cdcc);}})[_0x9115('0x16')](function(_0x253b76){if(_0x4e0a1c){_0x4e0a1c(_0x253b76);}});};AGIVertices[_0x9115('0x11')][_0x9115('0x40')]=function(_0x4cdb6c,_0x59fca8,_0x4ae59a,_0x4282ec){this[_0x9115('0x10')][_0x9115('0x40')]({'uniqueid':this[_0x9115('0x3a')]['uniqueid'],'callerid':this[_0x9115('0x3a')][_0x9115('0x3f')],'calleridname':this[_0x9115('0x3a')][_0x9115('0x41')],'context':this[_0x9115('0x3a')]['context'],'extension':this[_0x9115('0x3a')][_0x9115('0x42')],'priority':this[_0x9115('0x3a')][_0x9115('0x43')],'accountcode':this[_0x9115('0x3a')][_0x9115('0x44')],'dnid':this[_0x9115('0x3a')][_0x9115('0x45')],'projectName':this['channel'][_0x9115('0x3e')],'saveName':_0x59fca8,'filename':_0x4cdb6c[_0x9115('0x46')]||_0x59fca8,'savePath':_0x4ae59a})[_0x9115('0x14')](function(_0x97543c){_0x4282ec(null,_0x97543c);})[_0x9115('0x16')](function(_0x4bdc57){_0x4282ec(_0x4bdc57);});};AGIVertices[_0x9115('0x11')][_0x9115('0x47')]=function(_0x285366,_0x5bb484,_0x18acdd,_0x286d63,_0xb26d0e){this[_0x9115('0x10')][_0x9115('0x47')]({'uniqueid':this[_0x9115('0x3a')][_0x9115('0x3b')],'body':_0x285366,'direction':_0x5bb484,'providerName':_0x18acdd,'providerResponse':_0x286d63})['then'](function(_0x38af4c){if(_0xb26d0e){_0xb26d0e(null,_0x38af4c);}})[_0x9115('0x16')](function(_0x5e291d){if(_0xb26d0e){_0xb26d0e(_0x5e291d);}});};AGIVertices[_0x9115('0x11')][_0x9115('0x48')]=function(_0x520326,_0x36a54a){var _0x2d64e2=this;var _0x69e224=0x0;var _0x154863={'firstName':_['isEmpty'](_0x520326['name'])||_['isNil'](_0x520326[_0x9115('0x15')])?'callback_'+Math['random']():_0x520326['name'],'lastName':_[_0x9115('0x49')](_0x520326[_0x9115('0x4a')])||_[_0x9115('0x4b')](_0x520326[_0x9115('0x4a')])?null:_0x520326[_0x9115('0x4a')],'phone':_0x520326[_0x9115('0x4c')],'ListId':_0x520326[_0x9115('0x4d')],'scheduledat':_0x520326[_0x9115('0x4e')],'callbackUniqueid':this[_0x9115('0x3a')][_0x9115('0x3b')],'tags':_0x9115('0x4f'),'description':_0x9115('0x50')+_0x520326[_0x9115('0x4e')][_0x9115('0x51')](),'priority':_0x520326[_0x9115('0x52')]};if(_[_0x9115('0x53')](_0x520326,'dialTimezone')){if(!_[_0x9115('0x4b')](_0x520326[_0x9115('0x54')])){var _0x3e72d5=_0x520326['dialTimezone'];if(_0x520326['dialTimezone']==_0x9115('0x55')){this[_0x9115('0x10')][_0x9115('0x56')]({'phone':_0x520326[_0x9115('0x4c')]})[_0x9115('0x14')](function(_0xba482f){if(!_[_0x9115('0x4b')](_0xba482f)){var _0x44cc56=_0xba482f[_0x9115('0x54')];if(!_['isNil'](_0x44cc56)){var _0x51f242=shared[_0x9115('0x57')][_0x44cc56];if(!_[_0x9115('0x4b')](_0x51f242)){var _0x2b51d8=-0x1*_0x51f242[_0x9115('0x58')];_0x154863['scheduledat']=moment(_0x520326[_0x9115('0x59')])[_0x9115('0x5a')](_0x2b51d8,_0x9115('0x5b'));_0x2d64e2['insertContact'](_0x154863,_0x520326,_0x36a54a);}else{_0x2d64e2[_0x9115('0x5c')](_0x154863,_0x520326,_0x36a54a);}}else{_0x2d64e2['insertContact'](_0x154863,_0x520326,_0x36a54a);}}else{_0x2d64e2[_0x9115('0x5c')](_0x154863,_0x520326,_0x36a54a);}});}else{var _0x69e224=shared['timezones'][_0x3e72d5];if(!_[_0x9115('0x4b')](_0x69e224)){var _0x3fd708=-0x1*_0x69e224['utcOffset'];_0x154863[_0x9115('0x59')]=moment(_0x520326['scheduledat'])['add'](_0x3fd708,_0x9115('0x5b'));_0x2d64e2[_0x9115('0x5c')](_0x154863,_0x520326,_0x36a54a);}else{_0x2d64e2['insertContact'](_0x154863,_0x520326,_0x36a54a);}}}else{_0x2d64e2[_0x9115('0x5c')](_0x154863,_0x520326,_0x36a54a);}}else{_0x2d64e2[_0x9115('0x5c')](_0x154863,_0x520326,_0x36a54a);}};AGIVertices[_0x9115('0x11')][_0x9115('0x5d')]=function(_0x11af20,_0x12df9a){this['rpc'][_0x9115('0x5e')](_0x11af20)[_0x9115('0x14')](function(_0x1a8029){_0x12df9a(null,_0x1a8029?_0x1a8029['name']:![]);})[_0x9115('0x16')](function(_0x4b2711){_0x12df9a(_0x4b2711);});};AGIVertices['prototype'][_0x9115('0x5f')]=function(_0x6f9594,_0x598e21,_0x214328){var _0x3c201c={'role':'agent'};_0x3c201c[_0x6f9594]=this[_0x9115('0x3a')][_0x9115('0x3f')];this['rpc'][_0x9115('0x5f')](_0x3c201c,_0x598e21,this[_0x9115('0x3a')][_0x9115('0x3b')])[_0x9115('0x14')](function(_0xd0c22a){_0x214328(null,_[_0x9115('0x4b')](_0xd0c22a)?![]:!![]);})[_0x9115('0x16')](function(_0x4c91c2){logger['error'](_0x4c91c2);_0x214328(null,![]);});};AGIVertices[_0x9115('0x11')]['agentUnpause']=function(_0x2924eb,_0x1f4d30){var _0x5de541={'role':_0x9115('0x60')};_0x5de541[_0x2924eb]=this[_0x9115('0x3a')]['callerid'];this[_0x9115('0x10')][_0x9115('0x61')](_0x5de541)[_0x9115('0x14')](function(_0x1b575f){_0x1f4d30(null,_[_0x9115('0x4b')](_0x1b575f)?![]:!![]);})[_0x9115('0x16')](function(_0x2ece95){logger[_0x9115('0x31')](_0x2ece95);_0x1f4d30(null,![]);});};AGIVertices[_0x9115('0x11')][_0x9115('0x62')]=function(_0x49fb57,_0x29298c){var _0x2baff1={'role':_0x9115('0x60')};_0x2baff1[_0x49fb57]=this[_0x9115('0x3a')]['callerid'];this[_0x9115('0x10')][_0x9115('0x62')](_0x2baff1)['then'](function(_0x28cfd8){_0x29298c(null,_['isNil'](_0x28cfd8)?![]:!![]);})['catch'](function(_0x2a8c66){logger[_0x9115('0x31')](_0x2a8c66);_0x29298c(null,![]);});};AGIVertices[_0x9115('0x11')][_0x9115('0x63')]=function(_0x210cce,_0x5968de){var _0x2d9689={'role':_0x9115('0x60')};_0x2d9689[_0x210cce]=this[_0x9115('0x3a')][_0x9115('0x3f')];var _0x426467=_0x210cce!=_0x9115('0x64')?util[_0x9115('0x2d')](_0x9115('0x65'),'LOCAL',this[_0x9115('0x3a')][_0x9115('0x3f')]):undefined;this[_0x9115('0x10')][_0x9115('0x63')](_0x2d9689,_0x426467)[_0x9115('0x14')](function(_0x29f7b0){_0x5968de(null,_[_0x9115('0x4b')](_0x29f7b0)?![]:!![]);})['catch'](function(_0x48b79a){logger[_0x9115('0x31')](_0x48b79a);_0x5968de(null,![]);});};AGIVertices['prototype'][_0x9115('0x66')]=function(_0x4343d4,_0x47a586){sh[_0x9115('0x67')](_['trim'](_0x4343d4),function(_0x331e18,_0x4cc63f){var _0x5e5657=_0x4cc63f[_0x9115('0x68')](/(\r\n|\n|\r)/gm,'');_0x47a586(null,_0x5e5657);});};AGIVertices[_0x9115('0x11')]['googleCloudTTS']=function(_0xc60268,_0x3b2b18){scripts[_0x9115('0x69')](_0xc60268[_0x9115('0x6a')],_0xc60268[_0x9115('0x6b')]||_0x9115('0x6c'),_0xc60268[_0x9115('0x6c')],_0xc60268['languageCode']||'en-US',_0xc60268['ssmlGender']||_0x9115('0x6d'),_0xc60268[_0x9115('0x6e')]||_0x9115('0x6f'))[_0x9115('0x14')](function(_0x592fa6){_0x3b2b18(null,_0x592fa6);})[_0x9115('0x16')](function(_0x5eea5c){_0x3b2b18(_0x5eea5c);});};AGIVertices[_0x9115('0x11')][_0x9115('0x70')]=function(_0x5cb51f,_0x409fdc){scripts[_0x9115('0x70')](_0x5cb51f[_0x9115('0x6c')],_0x5cb51f[_0x9115('0x71')]||'en',0x1)['then'](function(_0x1a9e76){_0x409fdc(null,_0x1a9e76);})[_0x9115('0x16')](function(_0x3d7609){_0x409fdc(_0x3d7609);});};AGIVertices[_0x9115('0x11')][_0x9115('0x72')]=function(_0x3f3e3f,_0xd49091){var _0x495bbc={'uri':_0x3f3e3f[_0x9115('0x73')],'method':_0x3f3e3f[_0x9115('0x74')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3f3e3f[_0x9115('0x75')])===_0x9115('0x76')&&parseInt(_0x3f3e3f[_0x9115('0x75')])>=0x1?parseInt(_0x3f3e3f[_0x9115('0x75')])*0x3e8:0x5*0x3e8};if(_[_0x9115('0x77')]([_0x9115('0x78'),_0x9115('0x79')],_0x495bbc[_0x9115('0x74')][_0x9115('0x7a')]())){try{_0x495bbc[_0x9115('0x7b')]=_0x3f3e3f[_0x9115('0xd')]?JSON[_0x9115('0x7c')](_0x3f3e3f[_0x9115('0xd')]):{};}catch(_0x48a916){logger[_0x9115('0x31')](_0x9115('0x7d'),_0x48a916);}}try{_0x495bbc['headers']=_0x3f3e3f['rawHeaders']?JSON[_0x9115('0x7c')](_0x3f3e3f['rawHeaders']):{};}catch(_0x3d7544){logger[_0x9115('0x31')](_0x9115('0x7e'),_0x3d7544);}if(_0x3f3e3f[_0x9115('0x7f')]){try{var _0x14b210=require(_0x3f3e3f[_0x9115('0x7f')])[_0x9115('0x80')](this,_0x495bbc);_0x495bbc[_0x9115('0x81')]=Mustache[_0x9115('0x82')](_0x3f3e3f[_0x9115('0x73')],_0x14b210,{},['$$','$$']);if(_0x495bbc[_0x9115('0x83')]){_0x495bbc[_0x9115('0x83')]=JSON['parse'](Mustache[_0x9115('0x82')](JSON['stringify'](_0x495bbc[_0x9115('0x83')]),_0x14b210,{},['$$','$$']));}if(_0x495bbc['body']){_0x495bbc[_0x9115('0x7b')]=JSON[_0x9115('0x7c')](Mustache[_0x9115('0x82')](JSON['stringify'](_0x495bbc[_0x9115('0x7b')]),_0x14b210,{},['$$','$$']));}}catch(_0x23eb6a){logger['error'](_0x9115('0x84'),_0x23eb6a);}}rp(_0x495bbc)['then'](function(_0x168f05){var _0x272e8c={'statusCode':_0x168f05[_0x9115('0x85')]||0xc8,'statusMessage':_0x168f05[_0x9115('0x86')]||'OK','headers':_0x168f05[_0x9115('0x83')]||{},'body':_0x168f05[_0x9115('0x7b')]||{}};_0xd49091(null,_0x272e8c);})[_0x9115('0x16')](function(_0x538217){var _0x20340f={'statusCode':_0x538217['statusCode']||0x1f4,'statusMessage':_0x538217[_0x9115('0x87')]||_0x9115('0x88'),'headers':_0x538217['options'][_0x9115('0x83')]||{},'body':_0x538217[_0x9115('0x89')]['body']||{}};_0xd49091(null,_0x20340f);});};AGIVertices['prototype'][_0x9115('0x8a')]=function(_0x2f18ad,_0x2b2154){scripts[_0x9115('0x8a')](this[_0x9115('0x3a')][_0x9115('0x3b')],_0x2f18ad[_0x9115('0x8b')],_0x2f18ad['text'],_0x2f18ad[_0x9115('0x8c')]||'en')[_0x9115('0x14')](function(_0x26c95b){_0x2b2154(null,_0x26c95b);})[_0x9115('0x16')](function(_0x10d910){_0x2b2154(_0x10d910);});};AGIVertices[_0x9115('0x11')][_0x9115('0x8d')]=function(_0x462d7b,_0x36a067){scripts[_0x9115('0x8d')](this['channel'][_0x9115('0x3b')],_0x462d7b[_0x9115('0x8e')],_0x462d7b[_0x9115('0x8f')],_0x462d7b[_0x9115('0x90')],_0x462d7b[_0x9115('0x6c')],_0x462d7b[_0x9115('0x91')]||'en')[_0x9115('0x14')](function(_0x2c943f){_0x36a067(null,_0x2c943f);})[_0x9115('0x16')](function(_0xa81a81){_0x36a067(_0xa81a81);});};AGIVertices['prototype'][_0x9115('0x92')]=function(_0x4b5b93,_0x1afee3){scripts[_0x9115('0x92')](this[_0x9115('0x3a')],_0x4b5b93)[_0x9115('0x14')](function(_0x584863){_0x1afee3(null,_0x584863);})[_0x9115('0x16')](function(_0x4ce5b8){_0x1afee3(_0x4ce5b8);});};AGIVertices[_0x9115('0x11')][_0x9115('0x93')]=function(_0x5ca7ce,_0xc7b514){scripts[_0x9115('0x93')](_0x5ca7ce[_0x9115('0x8b')],_0x5ca7ce[_0x9115('0x6c')],_0x5ca7ce['ispeech_tts_language']||'en-US',_0x5ca7ce[_0x9115('0x94')])[_0x9115('0x14')](function(_0x3d634b){_0xc7b514(null,_0x3d634b);})[_0x9115('0x16')](function(_0x1373bc){_0xc7b514(_0x1373bc);});};AGIVertices[_0x9115('0x11')][_0x9115('0x95')]=function(_0x5e61dd,_0x2aa7e1,_0x401515){scripts[_0x9115('0x95')](_0x2aa7e1,_0x5e61dd[_0x9115('0x8b')],_0x5e61dd['ispeech_asr_language']||_0x9115('0x96'),this['isConfigured'](_0x5e61dd['model'])?_0x5e61dd[_0x9115('0x97')]:undefined)[_0x9115('0x14')](function(_0x1af1e3){_0x401515(null,_0x1af1e3);})['catch'](function(_0x3908be){_0x401515(_0x3908be);});};AGIVertices[_0x9115('0x11')][_0x9115('0x98')]=function(_0x45f8e0,_0x58c72a){scripts['awsPolly'](_0x45f8e0['aws_access_key_id'],_0x45f8e0['aws_secret_access_key'],_0x45f8e0['aws_polly_region'],_0x45f8e0[_0x9115('0x99')]||_0x9115('0x9a'),_0x45f8e0[_0x9115('0x6c')],_0x45f8e0['aws_text_type']||'text')['then'](function(_0x1cc75f){_0x58c72a(null,_0x1cc75f);})['catch'](function(_0x5f41e7){_0x58c72a(_0x5f41e7);});};AGIVertices['prototype'][_0x9115('0x9b')]=function(_0x4d3666,_0x2639ef){scripts[_0x9115('0x9b')](this[_0x9115('0x3a')][_0x9115('0x3b')],_0x4d3666[_0x9115('0x9c')],_0x4d3666['aws_secret_access_key'],_0x4d3666[_0x9115('0x9d')],_0x4d3666[_0x9115('0x6c')],_0x4d3666[_0x9115('0x9e')])[_0x9115('0x14')](function(_0x483092){_0x2639ef(null,_0x483092);})[_0x9115('0x16')](function(_0x3ce84d){_0x2639ef(_0x3ce84d);});};AGIVertices['prototype'][_0x9115('0x9f')]=function(_0x47bb62,_0x556029,_0x556637){scripts[_0x9115('0x9f')](_0x556029,_0x47bb62[_0x9115('0x8b')],_0x47bb62['google_asr_language']||_0x9115('0x96'))[_0x9115('0x14')](function(_0x1704c3){_0x556637(null,_0x1704c3);})[_0x9115('0x16')](function(_0x5e63e2){_0x556637(_0x5e63e2);});};AGIVertices[_0x9115('0x11')][_0x9115('0xa0')]=function(_0x12ae30,_0x5d0044,_0x57b341){scripts['tildeASR'](_0x5d0044,_0x12ae30[_0x9115('0xa1')],_0x12ae30[_0x9115('0xa2')],_0x12ae30[_0x9115('0x81')])[_0x9115('0x14')](function(_0xd3416f){_0x57b341(null,_0xd3416f);})[_0x9115('0x16')](function(_0x3b2b0f){_0x57b341(_0x3b2b0f);});};AGIVertices[_0x9115('0x11')][_0x9115('0xa3')]=function(_0x5f177e){var _0xaf98e8=_['includes'](verticesWithRetry,_0x5f177e[_0x9115('0x3d')])?_0x5f177e:_[_0x9115('0xa4')](_0x5f177e);for(var _0x5d3225 in _0xaf98e8){if(_0xaf98e8[_0x9115('0xa5')](_0x5d3225)){if(_0xaf98e8[_0x5d3225]&&_['isString'](_0xaf98e8[_0x5d3225])){if(_[_0x9115('0x77')](recursiveMapAttributes,_0x5d3225)){_0xaf98e8[_0x5d3225]=this[_0x9115('0xa6')](_0xaf98e8[_0x5d3225]);}else{_0xaf98e8[_0x5d3225]=this[_0x9115('0xa7')](_0xaf98e8[_0x5d3225]);}}}}return _0xaf98e8;};AGIVertices['prototype'][_0x9115('0xa8')]=function(_0x3426f4){for(var _0x827a31 in _0x3426f4){if(_0x3426f4[_0x9115('0xa5')](_0x827a31)){if(_[_0x9115('0xa9')](_0x3426f4[_0x827a31])){this['recursiveNodeIndex'](_0x3426f4[_0x827a31]);}else if(_[_0x9115('0xaa')](_0x3426f4[_0x827a31])){for(var _0x1b2797=0x0;_0x1b2797<_0x3426f4[_0x827a31][_0x9115('0xab')];_0x1b2797++){this[_0x9115('0xa8')](_0x3426f4[_0x827a31][_0x1b2797]);}}else if(_[_0x9115('0xac')](_0x3426f4[_0x827a31])){_0x3426f4[_0x827a31]=this['replaceAllVariables'](_0x3426f4[_0x827a31]);}}}};AGIVertices[_0x9115('0x11')][_0x9115('0xad')]=function(_0x1f53ce,_0x337b7){for(var _0x5c7855 in _0x1f53ce){if(_0x1f53ce[_0x9115('0xa5')](_0x5c7855)){if(_[_0x9115('0xa9')](_0x1f53ce[_0x5c7855])){if(!_[_0x9115('0x49')](_0x1f53ce[_0x5c7855])){this[_0x9115('0xad')](_0x1f53ce[_0x5c7855],util[_0x9115('0x2d')](_0x9115('0xae'),_0x337b7,_0x5c7855));}}else if(_[_0x9115('0xaa')](_0x1f53ce[_0x5c7855])){for(var _0x30f6f4=0x0;_0x30f6f4<_0x1f53ce[_0x5c7855]['length'];_0x30f6f4++){this[_0x9115('0xad')](_0x1f53ce[_0x5c7855][_0x30f6f4],util[_0x9115('0x2d')](_0x9115('0xae'),_0x337b7,_0x5c7855+'['+_0x30f6f4+']'));}}else{if(!_[_0x9115('0x4b')](_0x1f53ce[_0x5c7855])){this[_0x9115('0x3a')][_0x9115('0xaf')](util[_0x9115('0x2d')]('%s.%s',_0x337b7,_0x5c7855),_0x1f53ce[_0x5c7855]);}}}}};AGIVertices[_0x9115('0x11')][_0x9115('0xa6')]=function(_0x441afa){try{var _0x4325a9=JSON[_0x9115('0x7c')](_0x441afa);this[_0x9115('0xa8')](_0x4325a9);return JSON[_0x9115('0xb0')](_0x4325a9);}catch(_0x29a879){return this[_0x9115('0xa7')](_0x441afa);}};AGIVertices['prototype'][_0x9115('0xa7')]=function(_0x15ab1c){var _0x14ed98=_0x15ab1c[_0x9115('0xb1')]('{');for(var _0x4ebf19=0x1;_0x4ebf19<_0x14ed98[_0x9115('0xab')];_0x4ebf19+=0x1){var _0x569db6=_0x14ed98[_0x4ebf19][_0x9115('0xb1')]('}');if(_0x569db6['length']>0x1){_0x15ab1c=_0x15ab1c[_0x9115('0xb2')]('{'+_0x569db6[0x0]+'}',this['channel']['getVariable'](_0x569db6[0x0])['extra']||_0x569db6[0x0]);}}if(_0x14ed98[_0x9115('0xab')]===0x1){return _0x15ab1c['toString']();}return this[_0x9115('0xa7')](_0x15ab1c);};AGIVertices[_0x9115('0x11')][_0x9115('0xb3')]=function(_0x2f5009,_0x583d5b){var _0xefbb9d=this[_0x9115('0x3a')]['getVariable'](_0x2f5009);if(_0xefbb9d[_0x9115('0xb4')]===-0x1){return _0xefbb9d;}logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0xb5'),_0x583d5b,_0xefbb9d[_0x9115('0xb6')]));return this[_0x9115('0x3a')]['setVariable'](_0x583d5b,_0xefbb9d[_0x9115('0xb6')]);};AGIVertices['prototype'][_0x9115('0xb7')]=function(_0x21f1f1){return _0x21f1f1&&_0x21f1f1!=='0'&&_0x21f1f1!=='-1'&&_0x21f1f1!=='';};AGIVertices[_0x9115('0x11')]['maxRetry']=function(_0x56dd2e){this[_0x9115('0x39')]['sync'](this,_0x56dd2e,'-');_0x56dd2e[_0x9115('0xb8')]=_0x56dd2e[_0x9115('0xb9')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9115('0x11')][_0x9115('0xba')]=function(_0x38f1aa){logger[_0x9115('0x34')](util['format'](_0x9115('0xbb'),_0x38f1aa[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0x38f1aa[_0x9115('0x6c')])){return this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0xbd'));}var _0x1892de='\x22'+_0x38f1aa[_0x9115('0x6c')]+'\x22';if(this[_0x9115('0xb7')](_0x38f1aa['options'])){_0x1892de+=','+_0x38f1aa[_0x9115('0x89')];}var _0x3594e7=this['channel'][_0x9115('0x67')]('MRCPSynth',_0x1892de);if(_0x3594e7[_0x9115('0xb4')]===-0x1){return _0x3594e7;}return this[_0x9115('0x3a')]['noop'](util[_0x9115('0x2d')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1892de));};AGIVertices[_0x9115('0x11')][_0x9115('0xbe')]=function(_0x492d38){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0xbf'),_0x492d38[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0x492d38[_0x9115('0xc0')])){return this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0xc1'));}var _0x5d5a06=_0x492d38['grammar'];if(this[_0x9115('0xb7')](_0x492d38[_0x9115('0x89')])){_0x5d5a06+=','+_0x492d38['options'];}var _0xb6b076=this[_0x9115('0x3a')][_0x9115('0x67')](_0x9115('0xc2'),_0x5d5a06);if(_0xb6b076['result']===-0x1){return _0xb6b076;}var _0x4b2bd2=this[_0x9115('0xb3')](_0x9115('0xc3'),'MRCP_RECOG_CONFIDENCE');if(_0x4b2bd2['result']===-0x1){return _0x4b2bd2;}var _0x473635=this[_0x9115('0xb3')](_0x9115('0xc4'),_0x9115('0xc5'));if(_0x473635['result']===-0x1){return _0x473635;}var _0x33d30d=this[_0x9115('0xb3')](_0x9115('0xc6'),_0x9115('0xc7'));if(_0x33d30d[_0x9115('0xb4')]===-0x1){return _0x33d30d;}return this[_0x9115('0x3a')][_0x9115('0xbc')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x5d5a06));};AGIVertices[_0x9115('0x11')]['agi']=function(_0x5749d8){logger[_0x9115('0x34')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x5749d8[_0x9115('0x3c')]));return this[_0x9115('0x3a')]['agi']([_0x5749d8[_0x9115('0xc8')],_0x5749d8['args']]);};AGIVertices['prototype']['answer']=function(_0x18fab9){logger[_0x9115('0x34')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x18fab9[_0x9115('0x3c')]));if(this['isConfigured'](_0x18fab9['timeout'])){logger['info'](util[_0x9115('0x2d')](_0x9115('0xc9'),_0x18fab9[_0x9115('0x75')]));var _0x5b4905=this[_0x9115('0x3a')][_0x9115('0xca')](_0x18fab9['timeout']);if(_0x5b4905['result']===-0x1){return _0x5b4905;}}return this['channel'][_0x9115('0xcb')]();};AGIVertices[_0x9115('0x11')][_0x9115('0x4f')]=function(_0x245e5e){logger[_0x9115('0x34')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x245e5e[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0x245e5e[_0x9115('0x4d')])){return this[_0x9115('0x3a')][_0x9115('0x31')](_0x245e5e,'no\x20list\x20selected');}_0x245e5e[_0x9115('0x4e')]=moment();if(this[_0x9115('0xb7')](_0x245e5e[_0x9115('0xcc')])){_0x245e5e['scheduledAt']=moment()[_0x9115('0x5a')](_0x245e5e[_0x9115('0xcc')],'minutes');}if(!this[_0x9115('0xb7')](_0x245e5e[_0x9115('0x52')])){_0x245e5e[_0x9115('0x52')]=0x2;}this[_0x9115('0x48')][_0x9115('0x80')](this,_0x245e5e);return this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0xcd'),_0x245e5e[_0x9115('0x4c')],_0x245e5e[_0x9115('0x4d')],_0x245e5e[_0x9115('0x4e')]));};AGIVertices[_0x9115('0x11')]['custom_app']=function(_0x1018a7){logger['info'](util[_0x9115('0x2d')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x1018a7['label']));var _0x477cf4=this['channel'][_0x9115('0x67')](_0x1018a7[_0x9115('0xce')],_0x1018a7[_0x9115('0x89')]);if(_0x477cf4[_0x9115('0xb4')]===-0x1){return _0x477cf4;}return this[_0x9115('0x3a')]['noop'](util[_0x9115('0x2d')](_0x9115('0xcf'),_0x1018a7[_0x9115('0xce')],_0x1018a7[_0x9115('0x89')]));};AGIVertices['prototype'][_0x9115('0xd0')]=function(_0xcb3d5c){logger[_0x9115('0x34')](util['format'](_0x9115('0xd1'),_0xcb3d5c[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0xcb3d5c['text'])){return this['channel']['noop'](_0x9115('0xbd'));}var _0x2b8954='\x22'+_0xcb3d5c[_0x9115('0x6c')]+'\x22';if(this[_0x9115('0xb7')](_0xcb3d5c[_0x9115('0x89')])){_0x2b8954+=','+_0xcb3d5c[_0x9115('0x89')];}var _0x34bf4c=this[_0x9115('0x3a')]['exec']('MRCPSynth',_0x2b8954);if(_0x34bf4c[_0x9115('0xb4')]===-0x1){return _0x34bf4c;}return this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0xd2'),_0x2b8954));};AGIVertices[_0x9115('0x11')][_0x9115('0xd3')]=function(_0x34f358){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0xd4'),_0x34f358['label']));if(!this[_0x9115('0xb7')](_0x34f358[_0x9115('0x6c')])){return this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0xbd'));}var _0x39246d='\x22'+_0x34f358[_0x9115('0x6c')]+'\x22';if(this['isConfigured'](_0x34f358[_0x9115('0x89')])){_0x39246d+=','+_0x34f358[_0x9115('0x89')];}var _0x1500bd=this[_0x9115('0x3a')]['exec'](_0x9115('0xd5'),_0x39246d);if(_0x1500bd[_0x9115('0xb4')]===-0x1){return _0x1500bd;}return this[_0x9115('0x3a')][_0x9115('0xbc')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x39246d));};AGIVertices[_0x9115('0x11')]['lumenvoxasr']=function(_0x4cd6bb){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0xd6'),_0x4cd6bb[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0x4cd6bb[_0x9115('0xc0')])){return this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0xc1'));}var _0x58052e=_0x4cd6bb['grammar'];if(this[_0x9115('0xb7')](_0x4cd6bb[_0x9115('0x89')])){_0x58052e+=','+_0x4cd6bb['options'];}var _0x4d3730=this[_0x9115('0x3a')][_0x9115('0x67')]('MRCPRecog',_0x58052e);if(_0x4d3730['result']===-0x1){return _0x4d3730;}var _0x1be96d=this[_0x9115('0xb3')](_0x9115('0xc3'),_0x9115('0xd7'));if(_0x1be96d[_0x9115('0xb4')]===-0x1){return _0x1be96d;}var _0x64dca7=this['getAndSetVariable']('RECOG_INPUT()',_0x9115('0xd8'));if(_0x64dca7[_0x9115('0xb4')]===-0x1){return _0x64dca7;}var _0x1c7e0f=this[_0x9115('0xb3')](_0x9115('0xc6'),'LUMENVOX_ASR_INSTANCE');if(_0x1c7e0f[_0x9115('0xb4')]===-0x1){return _0x1c7e0f;}return this['channel'][_0x9115('0xbc')](util[_0x9115('0x2d')]('Executed\x20command\x20MRCPRecog\x20%s',_0x58052e));};AGIVertices[_0x9115('0x11')][_0x9115('0xd9')]=function(_0x5eb0d0){logger['info'](util[_0x9115('0x2d')](_0x9115('0xda'),_0x5eb0d0[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0x5eb0d0[_0x9115('0xc0')])){return this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0xc1'));}var _0x3b2ae1=_0x5eb0d0[_0x9115('0xc0')];if(this[_0x9115('0xb7')](_0x5eb0d0['options'])){_0x3b2ae1+=','+_0x5eb0d0[_0x9115('0x89')];}var _0x5448e8=this[_0x9115('0x3a')]['exec'](_0x9115('0xc2'),_0x3b2ae1);if(_0x5448e8[_0x9115('0xb4')]===-0x1){return _0x5448e8;}var _0x45b4d7=this[_0x9115('0xb3')](_0x9115('0xc3'),_0x9115('0xdb'));if(_0x45b4d7['result']===-0x1){return _0x45b4d7;}var _0x404a29=this[_0x9115('0xb3')](_0x9115('0xc4'),_0x9115('0xdc'));if(_0x404a29[_0x9115('0xb4')]===-0x1){return _0x404a29;}var _0x5ecc0f=this['getAndSetVariable'](_0x9115('0xc6'),_0x9115('0xdd'));if(_0x5ecc0f[_0x9115('0xb4')]===-0x1){return _0x5ecc0f;}return this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0xde'),_0x3b2ae1));};AGIVertices[_0x9115('0x11')][_0x9115('0xdf')]=function(_0x33b46c){logger['info'](util[_0x9115('0x2d')](_0x9115('0xe0'),_0x33b46c[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0x33b46c[_0x9115('0xe1')])){return this[_0x9115('0x3a')][_0x9115('0x31')](_0x33b46c,_0x9115('0xe2'));}var _0x2e23c8=this[_0x9115('0x19')][_0x9115('0x80')](this,_0x33b46c['odbc_id']);if(!_0x2e23c8){return this['channel']['error'](_0x33b46c,_0x9115('0xe3'));}if(!this['isConfigured'](_0x33b46c['query'])){return this[_0x9115('0x3a')]['error'](_0x33b46c,_0x9115('0xe4'));}var _0x18a514=_0x33b46c['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x9115('0x3a')][_0x9115('0xbc')](util['format'](_0x9115('0xe5'),_0x18a514));var _0x318cb2=this[_0x9115('0x2f')][_0x9115('0x80')](this,_0x2e23c8,_0x18a514);this[_0x9115('0x39')][_0x9115('0x80')](this,_0x33b46c,_0x18a514);if(!this[_0x9115('0xb7')](_0x33b46c[_0x9115('0xe6')])){return this[_0x9115('0x3a')][_0x9115('0xbc')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x36ebbc=this[_0x9115('0x12')][_0x9115('0x80')](this,_0x33b46c[_0x9115('0xe6')]);if(!_0x36ebbc){return this[_0x9115('0x3a')][_0x9115('0x31')](_0x33b46c,_0x9115('0xe7'));}var _0x135e50=this;_0x318cb2['forEach'](function(_0x51233a,_0x3f3b90){Object['keys'](_0x51233a)[_0x9115('0xe8')](function(_0x185df6){_0x135e50[_0x9115('0x3a')]['setVariable'](util[_0x9115('0x2d')]('%s[%s][%s]',_0x36ebbc,_0x3f3b90,_0x185df6),_0x51233a[_0x185df6]);});});this[_0x9115('0x3a')][_0x9115('0xaf')](util[_0x9115('0x2d')]('%s_ROWS_COUNT',_0x36ebbc),_0x318cb2[_0x9115('0xab')]);return this[_0x9115('0x3a')][_0x9115('0xbc')](util['format'](_0x9115('0xe9'),_0x36ebbc));};AGIVertices[_0x9115('0x11')][_0x9115('0xea')]=function(_0x163113){logger['debug'](util[_0x9115('0x2d')](_0x9115('0xeb'),_0x163113[_0x9115('0x3c')]));if(!this['isConfigured'](_0x163113[_0x9115('0xec')])){return this[_0x9115('0x3a')][_0x9115('0x31')](_0x163113,_0x9115('0xed'));}var _0xa0b53=this[_0x9115('0x1c')][_0x9115('0x80')](this,_0x163113['sip_id']);if(!_0xa0b53){return this[_0x9115('0x3a')][_0x9115('0x31')](_0x163113,'no\x20user\x20found');}var _0x57e5f7=this['channel'][_0x9115('0x67')](_0x9115('0xee'),[util[_0x9115('0x2d')](_0x9115('0xef'),_0xa0b53),_0x163113['timeout'],_0x163113[_0x9115('0xf0')],_0x163113[_0x9115('0x73')]]);if(_0x57e5f7[_0x9115('0xb4')]===-0x1){return _0x57e5f7;}return this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')]('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype'][_0x9115('0xf1')]=function(_0x4184fa){logger[_0x9115('0x34')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x4184fa['label']));if(!this['isConfigured'](_0x4184fa[_0x9115('0x8b')])){return this['channel'][_0x9115('0xbc')](_0x9115('0xf2'));}if(!this[_0x9115('0xb7')](_0x4184fa[_0x9115('0x6c')])){return this['channel'][_0x9115('0xbc')]('no\x20text\x20configured');}this[_0x9115('0x3a')]['bot']=!![];this[_0x9115('0x39')](_0x4184fa);this[_0x9115('0x47')](_0x4184fa['text'],'in','','');this[_0x9115('0x3a')][_0x9115('0xbc')](util['format'](_0x9115('0xf3'),_0x4184fa[_0x9115('0x6c')]));var _0x28d398=this[_0x9115('0x8a')][_0x9115('0x80')](this,_0x4184fa);if(_0x28d398){for(var _0x5d9a9d in _0x28d398){if(_0x28d398[_0x9115('0xa5')](_0x5d9a9d)){this[_0x9115('0x3a')][_0x9115('0xaf')](util['format'](_0x9115('0xf4'),_0x5d9a9d[_0x9115('0x7a')]()),_0x28d398[_0x5d9a9d]);}}this['createSquareMessage'](_0x28d398[_0x9115('0xf5')],_0x9115('0xf6'),'dialogflow','');return this[_0x9115('0x3a')]['noop'](util[_0x9115('0x2d')](_0x9115('0xf7'),_0x28d398['speech']));}return this['channel'][_0x9115('0x31')](_0x4184fa,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x9115('0xf8')]=function(_0x4d56ba){logger[_0x9115('0x34')](util[_0x9115('0x2d')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x4d56ba[_0x9115('0x3c')]));if(!this['isConfigured'](_0x4d56ba[_0x9115('0x8e')])){return this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0xf9'));}if(!this['isConfigured'](_0x4d56ba[_0x9115('0x8f')])){return this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0xfa'));}if(!this[_0x9115('0xb7')](_0x4d56ba[_0x9115('0x90')])){return this[_0x9115('0x3a')]['noop'](_0x9115('0xfb'));}if(!this[_0x9115('0xb7')](_0x4d56ba[_0x9115('0x91')])){return this[_0x9115('0x3a')][_0x9115('0xbc')]('no\x20anguage\x20configured');}if(!this[_0x9115('0xb7')](_0x4d56ba['text'])){return this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0xbd'));}this['channel'][_0x9115('0xfc')]=!![];this['createSquareDetailsReport'](_0x4d56ba);this[_0x9115('0x47')](_0x4d56ba[_0x9115('0x6c')],'in','','');this[_0x9115('0x3a')][_0x9115('0xbc')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x4d56ba[_0x9115('0x6c')]));var _0x261994=this[_0x9115('0x8d')][_0x9115('0x80')](this,_0x4d56ba);if(_0x261994){for(var _0x1d4738 in _0x261994){if(_0x261994['hasOwnProperty'](_0x1d4738)){if(_0x1d4738!==_0x9115('0xfd')){this['channel'][_0x9115('0xaf')](util['format']('DIALOGFLOW_%s',_0x1d4738[_0x9115('0x7a')]()),_0x261994[_0x1d4738]);}}}this[_0x9115('0x47')](_0x261994[_0x9115('0xf5')],'out','dialogflowV2',_0x261994[_0x9115('0xfd')]);return this[_0x9115('0x3a')][_0x9115('0xbc')](util['format'](_0x9115('0xfe'),_0x261994[_0x9115('0xf5')]));}return this[_0x9115('0x3a')][_0x9115('0x31')](_0x4d56ba,_0x9115('0xff'));};AGIVertices[_0x9115('0x11')][_0x9115('0x100')]=function(_0x3ad2f3){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x101'),_0x3ad2f3[_0x9115('0x3c')]));if(!this['isConfigured'](_0x3ad2f3['ndauth_url'])){return this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0x102'));}if(!this[_0x9115('0xb7')](_0x3ad2f3[_0x9115('0x103')])){return this[_0x9115('0x3a')]['noop'](_0x9115('0x104'));}if(!this[_0x9115('0xb7')](_0x3ad2f3['password'])){return this['channel']['noop'](_0x9115('0x105'));}if(!this[_0x9115('0xb7')](_0x3ad2f3['ndassistant_url'])){return this['channel'][_0x9115('0xbc')](_0x9115('0xbd'));}this['channel'][_0x9115('0xfc')]=!![];this['createSquareDetailsReport'](_0x3ad2f3);this[_0x9115('0x47')](_0x3ad2f3[_0x9115('0x6c')],'in','','');this['channel'][_0x9115('0xbc')](util[_0x9115('0x2d')]('Trying\x20SestekNDA:\x20%s',_0x3ad2f3['text']));var _0x32b744=this[_0x9115('0x92')][_0x9115('0x80')](this,_0x3ad2f3);if(_0x32b744){for(var _0x22e595 in _0x32b744){if(_0x32b744['hasOwnProperty'](_0x22e595)){this[_0x9115('0x3a')]['setVariable'](util[_0x9115('0x2d')]('SESTEK_NDA_%s',_0x22e595['toUpperCase']()),_0x32b744[_0x22e595]);}}this[_0x9115('0x47')](_0x32b744['speech'],_0x9115('0xf6'),_0x9115('0x100'),'');if(_0x32b744[_0x9115('0x106')]){this[_0x9115('0x3a')]['noop'](util[_0x9115('0x2d')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x32b744[_0x9115('0x106')]));var _0x52a49b=this[_0x9115('0x3a')][_0x9115('0x107')](_0x32b744[_0x9115('0x106')]);try{fs[_0x9115('0x108')](_0x32b744[_0x9115('0x106')]+_0x9115('0x109'));}catch(_0x4ea15b){logger[_0x9115('0x31')](_0x4ea15b);}return _0x52a49b;}else{return this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x10a'),_0x32b744[_0x9115('0xf5')]));}}return this[_0x9115('0x3a')][_0x9115('0x31')](_0x3ad2f3,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0x9115('0x10b')]=function(_0x19baa0){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x10c'),_0x19baa0[_0x9115('0x3c')]));return this['channel'][_0x9115('0xbc')](_0x9115('0x10b'));};AGIVertices[_0x9115('0x11')][_0x9115('0x10d')]=function(_0x17978d){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x10e'),_0x17978d[_0x9115('0x3c')]));var _0x2913bb='';if(_0x17978d[_0x9115('0x10f')]){if(!this[_0x9115('0xb7')](_0x17978d[_0x9115('0x10f')])){return this['channel'][_0x9115('0x31')](_0x17978d,_0x9115('0x110'));}else{var _0x3c83e6=parseInt(_0x17978d[_0x9115('0x10f')],0xa);if(isNaN(_0x3c83e6)){_0x2913bb=_0x17978d['trunk_id'];}else{_0x2913bb=this[_0x9115('0x1e')][_0x9115('0x80')](this,_0x17978d[_0x9115('0x10f')]);if(!_0x2913bb){return this[_0x9115('0x3a')]['error'](_0x17978d,'no\x20trunk\x20found');}}}}else if(_0x17978d['trunk_name']){_0x2913bb=_0x17978d[_0x9115('0x111')];}else{return this[_0x9115('0x3a')][_0x9115('0x31')](_0x17978d,'no\x20trunk\x20selected');}var _0xef4cbc=this[_0x9115('0x3a')][_0x9115('0x67')](_0x9115('0xee'),[util['format'](_0x9115('0x112'),_0x2913bb,_0x17978d['phone']),_0x17978d[_0x9115('0x75')],_0x17978d['opts'],_0x17978d[_0x9115('0x73')]]);if(_0xef4cbc[_0x9115('0xb4')]===-0x1){return _0xef4cbc;}return this['channel'][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x113'),_0x9115('0xee')));};AGIVertices[_0x9115('0x11')]['finally']=function(_0x9eeb93){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x114'),_0x9eeb93['label']));return this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0x115'));};AGIVertices['prototype'][_0x9115('0xf')]=function(_0x3a1164){logger[_0x9115('0x34')](util[_0x9115('0x2d')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x3a1164['label']));if(_0x3a1164['retry']===0x0){return this[_0x9115('0xb9')](_0x3a1164);}_0x3a1164[_0x9115('0xb8')]-=0x1;if(!this[_0x9115('0xb7')](_0x3a1164[_0x9115('0x116')])){return this['channel'][_0x9115('0x31')](_0x3a1164,'no\x20file\x20audio\x20selected');}var _0x221f87=this[_0x9115('0x20')][_0x9115('0x80')](this,_0x3a1164['file_id']);if(!_0x221f87){return this['channel'][_0x9115('0x31')](_0x3a1164,'no\x20file\x20audio\x20found');}if(!this[_0x9115('0xb7')](_0x3a1164[_0x9115('0xe6')])){return this['channel'][_0x9115('0x31')](_0x9115('0x117'));}var _0x452ff5=this[_0x9115('0x3a')]['getData'](_0x221f87,_0x3a1164[_0x9115('0x118')],_0x3a1164['maxdigit']);var _0x1c78da=_0x452ff5[_0x9115('0xb4')]?_0x452ff5[_0x9115('0xb4')]['toString']():'';logger[_0x9115('0x34')](_0x9115('0x119'),JSON['stringify'](_0x452ff5));if(_0x452ff5[_0x9115('0xb4')]===-0x1){this[_0x9115('0x39')][_0x9115('0x80')](this,_0x3a1164,_0x1c78da);return _0x452ff5;}else if(_0x452ff5['extra']===_0x9115('0x75')){_0x452ff5[_0x9115('0xb4')]=_0x1c78da[_0x9115('0xab')]>=parseInt(_0x3a1164[_0x9115('0x11a')])?'x':'i';}else{_0x452ff5['result']=_0x1c78da['length']>=parseInt(_0x3a1164[_0x9115('0x11a')])&&_0x1c78da[_0x9115('0xab')]<=parseInt(_0x3a1164['maxdigit'])?'x':'i';}var _0x2f6a65=this['getVariable'][_0x9115('0x80')](this,_0x3a1164[_0x9115('0xe6')]);if(!_0x2f6a65){return this['channel'][_0x9115('0x31')](_0x3a1164,_0x9115('0xe7'));}this[_0x9115('0x3a')][_0x9115('0xaf')](_0x2f6a65,_0x1c78da);if(this[_0x9115('0xb7')](_0x3a1164[_0x9115('0x11b')])){var _0x1c10c2=parseInt(_0x3a1164[_0x9115('0x11b')],0xa);var _0x363702=rs[_0x9115('0x11c')]({'charset':'*','length':_0x1c10c2});var _0x33fc73=_0x1c78da[_0x9115('0xab')];if(_0x33fc73>0x0){if(_0x33fc73>_0x1c10c2){this[_0x9115('0x39')]['sync'](this,_0x3a1164,_0x3a1164[_0x9115('0x11d')]==='first'?_0x363702+_0x1c78da[_0x9115('0x11e')](_0x1c10c2):_0x1c78da[_0x9115('0x11e')](0x0,_0x33fc73-_0x1c10c2)+_0x363702);}else{this['createSquareDetailsReport'][_0x9115('0x80')](this,_0x3a1164,rs['generate']({'charset':'*','length':_0x33fc73}));}}else{this[_0x9115('0x39')][_0x9115('0x80')](this,_0x3a1164,'');}}else{this[_0x9115('0x39')][_0x9115('0x80')](this,_0x3a1164,_0x1c78da);}return _0x452ff5;};AGIVertices[_0x9115('0x11')][_0x9115('0x11f')]=function(_0xbd4904){logger['info'](util[_0x9115('0x2d')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0xbd4904[_0x9115('0x3c')]));return this[_0x9115('0xf')](_0xbd4904);};AGIVertices[_0x9115('0x11')][_0x9115('0x120')]=function(_0x27ad1a){logger[_0x9115('0x34')](util['format'](_0x9115('0x121'),_0x27ad1a['label']));this['createSquareDetailsReport']['sync'](this,_0x27ad1a,_0x27ad1a['goalname']);return this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x122'),_0x27ad1a['goalname']));};AGIVertices[_0x9115('0x11')][_0x9115('0x123')]=function(_0x116809){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x124'),_0x116809[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0x116809[_0x9115('0x9c')])||!this['isConfigured'](_0x116809[_0x9115('0x125')])){return this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0x126'));}if(!this[_0x9115('0xb7')](_0x116809[_0x9115('0x6c')])){return this[_0x9115('0x3a')]['noop']('no\x20text\x20configured');}this[_0x9115('0x3a')][_0x9115('0xbc')](util['format']('Trying\x20aws\x20Polly\x20%s',_0x116809[_0x9115('0x6c')]));var _0x96b73d=this['awsPolly'][_0x9115('0x80')](this,_0x116809);if(_0x96b73d){this[_0x9115('0x3a')][_0x9115('0xbc')](util['format'](_0x9115('0x127'),_0x96b73d));var _0x40c2be=this[_0x9115('0x3a')]['streamFile'](_0x96b73d);try{fs[_0x9115('0x108')](_0x96b73d+'.wav');}catch(_0x284cb3){logger[_0x9115('0x31')](_0x284cb3);}return _0x40c2be;}return this['channel']['error'](_0x116809,_0x9115('0x128'));};AGIVertices[_0x9115('0x11')][_0x9115('0x129')]=function(_0x3002a4){logger[_0x9115('0x34')](util[_0x9115('0x2d')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x3002a4[_0x9115('0x3c')]));if(!this['isConfigured'](_0x3002a4[_0x9115('0x9c')])||!this[_0x9115('0xb7')](_0x3002a4[_0x9115('0x125')])){return this[_0x9115('0x3a')][_0x9115('0xbc')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x3002a4[_0x9115('0x9e')])){return this[_0x9115('0x3a')][_0x9115('0xbc')]('no\x20bot\x20name\x20configured');}if(!this[_0x9115('0xb7')](_0x3002a4[_0x9115('0x6c')])){return this[_0x9115('0x3a')][_0x9115('0xbc')]('no\x20text\x20configured');}this[_0x9115('0x3a')][_0x9115('0xfc')]=!![];this[_0x9115('0x39')](_0x3002a4);this[_0x9115('0x47')](_0x3002a4['text'],'in','','');this['channel'][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x12a'),_0x3002a4[_0x9115('0x6c')]));var _0x3a3bfc=this[_0x9115('0x9b')][_0x9115('0x80')](this,_0x3002a4);if(_0x3a3bfc){for(var _0x217ee6 in _0x3a3bfc){if(_0x3a3bfc[_0x9115('0xa5')](_0x217ee6)&&_[_0x9115('0xac')](_0x3a3bfc[_0x217ee6])){this['channel']['setVariable'](util[_0x9115('0x2d')](_0x9115('0x12b'),_0x217ee6['toUpperCase']()),_0x3a3bfc[_0x217ee6]);}}if(_[_0x9115('0x4b')](_0x3a3bfc[_0x9115('0x87')])){return this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0x12c'));}else{this[_0x9115('0x47')](_0x3a3bfc[_0x9115('0x87')],_0x9115('0xf6'),_0x9115('0x12d'),'');return this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x12e'),_0x3a3bfc[_0x9115('0x87')]));}}return this[_0x9115('0x3a')][_0x9115('0x31')](_0x3002a4,_0x9115('0x12f'));};AGIVertices['prototype']['googleasr']=function(_0x48fabb){logger[_0x9115('0x34')](util['format'](_0x9115('0x130'),_0x48fabb[_0x9115('0x3c')],_0x48fabb[_0x9115('0x75')]));if(!this[_0x9115('0xb7')](_0x48fabb['key'])){return this['channel'][_0x9115('0xbc')](_0x9115('0xf2'));}var _0x49190d=_0x9115('0x131');var _0x46f3b2=util[_0x9115('0x2d')](_0x9115('0x132'),FILES_PATH,rs['generate'](0x4));var _0x5080e5=util[_0x9115('0x2d')](_0x9115('0xae'),_0x46f3b2,_0x49190d);var _0x484d25=!![];if(_0x48fabb[_0x9115('0x133')]===_0x9115('0x134')){_0x484d25=![];}var _0x7bb208=this['channel']['recordFile'](_0x46f3b2,_0x49190d,_0x48fabb[_0x9115('0x135')],_0x48fabb[_0x9115('0x75')],undefined,_0x484d25);if(_0x7bb208[_0x9115('0xb4')]!==-0x1){this['channel'][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x136'),_0x5080e5));var _0x3fd2dc=this[_0x9115('0x9f')][_0x9115('0x80')](this,_0x48fabb,_0x5080e5);if(_0x3fd2dc){for(var _0x38767e in _0x3fd2dc){if(_0x3fd2dc[_0x9115('0xa5')](_0x38767e)){this[_0x9115('0x3a')][_0x9115('0xaf')](util['format'](_0x9115('0x137'),_0x38767e['toUpperCase']()),_0x3fd2dc[_0x38767e]);}}return this['channel']['noop'](util['format']('GoogleASR\x20Result\x20%s',JSON[_0x9115('0xb0')](_0x3fd2dc)));}}return _0x7bb208;};AGIVertices['prototype']['tildeasr']=function(_0x1da530){logger[_0x9115('0x34')](util['format'](_0x9115('0x138'),_0x1da530[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0x1da530[_0x9115('0xa1')])){return this[_0x9115('0x3a')]['noop'](_0x9115('0x139'));}if(!this[_0x9115('0xb7')](_0x1da530[_0x9115('0xa2')])){return this[_0x9115('0x3a')]['noop'](_0x9115('0x13a'));}var _0x4bfbb4=_0x9115('0x131');var _0x2b8f03=util[_0x9115('0x2d')](_0x9115('0x132'),FILES_PATH,rs[_0x9115('0x11c')](0x4));var _0x292b34=util[_0x9115('0x2d')](_0x9115('0xae'),_0x2b8f03,_0x4bfbb4);var _0xc651ac=!![];if(_0x1da530[_0x9115('0x133')]===_0x9115('0x134')){_0xc651ac=![];}var _0x8c0cdf=this['channel'][_0x9115('0x13b')](_0x2b8f03,_0x4bfbb4,_0x1da530[_0x9115('0x135')],_0x1da530[_0x9115('0x75')],undefined,_0xc651ac);if(_0x8c0cdf['result']!==-0x1){this[_0x9115('0x3a')]['noop'](util[_0x9115('0x2d')](_0x9115('0x13c'),_0x292b34));var _0x1a6bd9=this[_0x9115('0xa0')][_0x9115('0x80')](this,_0x1da530,_0x292b34);if(_0x1a6bd9){for(var _0x6fd8eb in _0x1a6bd9){if(_0x1a6bd9[_0x9115('0xa5')](_0x6fd8eb)){this[_0x9115('0x3a')][_0x9115('0xaf')](util[_0x9115('0x2d')](_0x9115('0x13d'),_0x6fd8eb['toUpperCase']()),_0x1a6bd9[_0x6fd8eb]);}}return this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')]('TildeASR\x20Result\x20%s',JSON[_0x9115('0xb0')](_0x1a6bd9)));}}return _0x8c0cdf;};AGIVertices[_0x9115('0x11')]['gotoc']=function(_0x40cf93){logger['info'](util['format'](_0x9115('0x13e'),_0x40cf93[_0x9115('0x3c')]));return this[_0x9115('0x3a')][_0x9115('0x13f')](_0x40cf93['context'],_0x40cf93[_0x9115('0x42')],_0x40cf93[_0x9115('0x43')]);};AGIVertices[_0x9115('0x11')][_0x9115('0x140')]=function(_0x144de4){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x141'),_0x144de4[_0x9115('0x3c')]));if(!this['isConfigured'](_0x144de4[_0x9115('0x142')])){return this[_0x9115('0x3a')][_0x9115('0x31')](_0x144de4,'no\x20condition\x20configured');}try{var _0xea1e00=eval(_0x144de4['condition'])?_0x9115('0x143'):'false';this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x144'),_0x144de4['condition'],_0xea1e00));return{'code':0xc8,'result':_0xea1e00};}catch(_0x43993d){return{'code':0xc8,'result':_0x9115('0x145')};}};AGIVertices[_0x9115('0x11')]['gotoiftime']=function(_0x5a1b4){logger[_0x9115('0x34')](util['format'](_0x9115('0x146'),_0x5a1b4[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0x5a1b4['interval_id'])){return this[_0x9115('0x3a')][_0x9115('0x31')](_0x5a1b4,_0x9115('0x147'));}var _0x5ab77f=this[_0x9115('0x28')][_0x9115('0x80')](this,_0x5a1b4['interval_id']);if(!_0x5ab77f){return this[_0x9115('0x3a')][_0x9115('0x31')](_0x5a1b4,_0x9115('0x148'));}for(var _0x5ea444=0x0;_0x5ea444<_0x5ab77f[_0x9115('0xab')];_0x5ea444+=0x1){var _0x31fc2c=this[_0x9115('0x3a')]['getVariable'](util[_0x9115('0x2d')](_0x9115('0x149'),_0x5ab77f[_0x5ea444]));if(_0x31fc2c[_0x9115('0xb4')]===-0x1){return _0x31fc2c;}logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x14a'),_0x5ab77f[_0x5ea444],_0x31fc2c['extra']));if(_0x31fc2c[_0x9115('0xb6')]==='true'){logger[_0x9115('0x34')](util['format'](_0x9115('0x14a'),_0x5ab77f[_0x5ea444],_0x9115('0x143')));this[_0x9115('0x3a')]['noop'](util[_0x9115('0x2d')](_0x9115('0x14a'),_0x5ab77f[_0x5ea444],_0x9115('0x143')));return{'code':0xc8,'result':_0x9115('0x143')};}else{logger[_0x9115('0x34')](util[_0x9115('0x2d')]('IFTIME\x20%s\x20%s',_0x5ab77f[_0x5ea444],_0x9115('0x145')));this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')]('IFTIME\x20%s\x20%s',_0x5ab77f[_0x5ea444],_0x9115('0x145')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x9115('0x14b')]=function(_0x5f1ce1){logger[_0x9115('0x34')](util[_0x9115('0x2d')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x5f1ce1[_0x9115('0x3c')]));return this[_0x9115('0x3a')][_0x9115('0x14b')]();};AGIVertices[_0x9115('0x11')][_0x9115('0x14c')]=function(_0x584cf2){logger['info'](util[_0x9115('0x2d')](_0x9115('0x14d'),_0x584cf2[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0x584cf2[_0x9115('0x8b')])){return this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0xf2'));}var _0x4ac181=_0x9115('0x131');var _0x429ca1=util[_0x9115('0x2d')](_0x9115('0x132'),FILES_PATH,rs[_0x9115('0x11c')](0x4));var _0x182424=util[_0x9115('0x2d')](_0x9115('0xae'),_0x429ca1,_0x4ac181);var _0x54652f=!![];if(_0x584cf2[_0x9115('0x133')]===_0x9115('0x134')){_0x54652f=![];}var _0x3c7599=this['channel'][_0x9115('0x13b')](_0x429ca1,_0x4ac181,_0x584cf2['intKey'],_0x584cf2[_0x9115('0x75')],undefined,_0x54652f);if(_0x3c7599[_0x9115('0xb4')]!==-0x1){this['channel'][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x14e'),_0x182424));var _0x4632ae=this[_0x9115('0x95')][_0x9115('0x80')](this,_0x584cf2,_0x182424);if(_0x4632ae){for(var _0x4cc5a9 in _0x4632ae){if(_0x4632ae[_0x9115('0xa5')](_0x4cc5a9)){this[_0x9115('0x3a')][_0x9115('0xaf')](util[_0x9115('0x2d')](_0x9115('0x14f'),_0x4cc5a9['toUpperCase']()),_0x4632ae[_0x4cc5a9]);}}return this[_0x9115('0x3a')]['noop'](util['format'](_0x9115('0x150'),JSON[_0x9115('0xb0')](_0x4632ae)));}}return _0x3c7599;};AGIVertices['prototype'][_0x9115('0x151')]=function(_0x392312){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x152'),_0x392312['label']));if(!this[_0x9115('0xb7')](_0x392312[_0x9115('0x8b')])){return this[_0x9115('0x3a')][_0x9115('0xbc')]('no\x20key\x20configured');}if(!this[_0x9115('0xb7')](_0x392312[_0x9115('0x6c')])){return this[_0x9115('0x3a')]['noop']('no\x20text\x20configured');}this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x153'),_0x392312[_0x9115('0x6c')]));var _0x273e7a=this[_0x9115('0x93')][_0x9115('0x80')](this,_0x392312);if(_0x273e7a){this['channel']['noop'](util[_0x9115('0x2d')]('ispeech\x20%s\x20file\x20created',_0x273e7a));var _0x133986=this[_0x9115('0x3a')]['streamFile'](_0x273e7a,_0x392312[_0x9115('0x135')]);try{fs[_0x9115('0x108')](_0x273e7a+_0x9115('0x109'));}catch(_0x5855db){logger['error'](_0x5855db);}return _0x133986;}return this['channel'][_0x9115('0x31')](_0x392312,_0x9115('0x154'));};AGIVertices['prototype']['login']=function(_0x2d63c4){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x155'),_0x2d63c4[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0x2d63c4[_0x9115('0x156')])){return this[_0x9115('0x3a')][_0x9115('0x31')](_0x2d63c4,_0x9115('0x157'));}logger[_0x9115('0x34')](util['format'](_0x9115('0x158'),this['channel']['callerid'],_0x2d63c4[_0x9115('0x156')]));var _0x443cb5=this[_0x9115('0x63')][_0x9115('0x80')](this,_0x2d63c4['findBy']);if(_0x443cb5){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x159'),this[_0x9115('0x3a')][_0x9115('0x3f')],_0x2d63c4['findBy']));this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x9115('0x3f')],_0x2d63c4[_0x9115('0x156')]));return{'code':0xc8,'result':_0x9115('0x15a')};}else{logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x15b'),this[_0x9115('0x3a')][_0x9115('0x3f')],_0x2d63c4[_0x9115('0x156')]));this[_0x9115('0x3a')]['noop'](util[_0x9115('0x2d')](_0x9115('0x15b'),this['channel'][_0x9115('0x3f')],_0x2d63c4['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x9115('0x15c')]=function(_0x4aa48d){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x15d'),_0x4aa48d[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0x4aa48d[_0x9115('0x156')])){return this[_0x9115('0x3a')]['error'](_0x4aa48d,_0x9115('0x157'));}logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x158'),this[_0x9115('0x3a')][_0x9115('0x3f')],_0x4aa48d[_0x9115('0x156')]));var _0x121b17=this[_0x9115('0x62')][_0x9115('0x80')](this,_0x4aa48d[_0x9115('0x156')]);if(_0x121b17){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x159'),this[_0x9115('0x3a')][_0x9115('0x3f')],_0x4aa48d['findBy']));this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9115('0x3a')][_0x9115('0x3f')],_0x4aa48d[_0x9115('0x156')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x9115('0x15b'),this[_0x9115('0x3a')][_0x9115('0x3f')],_0x4aa48d[_0x9115('0x156')]));this[_0x9115('0x3a')]['noop'](util[_0x9115('0x2d')](_0x9115('0x15b'),this['channel']['callerid'],_0x4aa48d['findBy']));return{'code':0xc8,'result':_0x9115('0x15e')};}};AGIVertices[_0x9115('0x11')][_0x9115('0x15f')]=function(_0x116dae){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x160'),_0x116dae['label']));if(!this[_0x9115('0xb7')](_0x116dae[_0x9115('0x161')])){return this[_0x9115('0x3a')][_0x9115('0x31')](_0x116dae,_0x9115('0x162'));}this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x163'),_0x116dae['operation']));var _0x392654=eval(_0x116dae['operation']);if(!this[_0x9115('0xb7')](_0x116dae[_0x9115('0xe6')])){return this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0x117'));}var _0x1bbccb=this[_0x9115('0x12')][_0x9115('0x80')](this,_0x116dae[_0x9115('0xe6')]);if(!_0x1bbccb){return this['channel'][_0x9115('0x31')](_0x116dae,_0x9115('0xe7'));}if(_[_0x9115('0xaa')](_0x392654)){var _0x3b5e3e=this;_0x392654[_0x9115('0xe8')](function(_0xaa32f7,_0x2c410e){_0x3b5e3e[_0x9115('0x3a')][_0x9115('0xaf')](util[_0x9115('0x2d')](_0x9115('0x164'),_0x1bbccb,_0x2c410e),_0xaa32f7);});return this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x165'),_0x1bbccb));}else{return this[_0x9115('0x3a')][_0x9115('0xaf')](_0x1bbccb,_0x392654);}};AGIVertices[_0x9115('0x11')][_0x9115('0xe')]=function(_0x3a1eae){logger[_0x9115('0x34')](util[_0x9115('0x2d')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x3a1eae[_0x9115('0x3c')]));if(_0x3a1eae['retry']===0x0){return this[_0x9115('0xb9')](_0x3a1eae);}_0x3a1eae[_0x9115('0xb8')]-=0x1;if(!this['isConfigured'](_0x3a1eae[_0x9115('0x116')])){return this[_0x9115('0x3a')][_0x9115('0x31')](_0x3a1eae,'no\x20file\x20audio\x20selected');}var _0x455308=this['getSound']['sync'](this,_0x3a1eae[_0x9115('0x116')]);if(!_0x455308){return this['channel'][_0x9115('0x31')](_0x3a1eae,_0x9115('0x166'));}var _0x5c68ba=this[_0x9115('0x3a')][_0x9115('0x167')](_0x455308,_0x3a1eae[_0x9115('0x118')],_0x3a1eae[_0x9115('0x168')]);var _0x3a4a0e=_0x5c68ba[_0x9115('0xb4')];if(_0x5c68ba[_0x9115('0xb4')]===-0x1){this['createSquareDetailsReport'][_0x9115('0x80')](this,_0x3a1eae,'-1');return _0x5c68ba;}else if(_0x5c68ba[_0x9115('0xb6')]===_0x9115('0x75')){_0x5c68ba['result']=_0x5c68ba['result'][_0x9115('0xab')]>0x0?_0x5c68ba['result']:'t';}else if(_[_0x9115('0x49')](_0x5c68ba[_0x9115('0xb4')])){_0x5c68ba['result']='#';_0x3a4a0e='#';}if(!this['isConfigured'](_0x3a1eae[_0x9115('0xe6')])){this[_0x9115('0x3a')]['noop'](_0x9115('0x117'));}else{var _0x17a590=this['getVariable'][_0x9115('0x80')](this,_0x3a1eae[_0x9115('0xe6')]);if(!_0x17a590){return this[_0x9115('0x3a')][_0x9115('0x31')](_0x3a1eae,_0x9115('0xe7'));}this[_0x9115('0x3a')][_0x9115('0xaf')](_0x17a590,_0x3a4a0e);}this[_0x9115('0x39')]['sync'](this,_0x3a1eae,_0x3a4a0e);return _0x5c68ba;};AGIVertices[_0x9115('0x11')][_0x9115('0xbc')]=function(_0x4e7847){logger['info'](util[_0x9115('0x2d')](_0x9115('0x169'),_0x4e7847[_0x9115('0x3c')]));return this['channel'][_0x9115('0xbc')](_0x4e7847[_0x9115('0x16a')]||_0x4e7847[_0x9115('0x3c')]);};AGIVertices['prototype'][_0x9115('0x16b')]=function(_0x30a251){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x16c'),_0x30a251[_0x9115('0x3c')]));if(!this['isConfigured'](_0x30a251[_0x9115('0x156')])){return this[_0x9115('0x3a')]['error'](_0x30a251,_0x9115('0x157'));}logger['info'](util[_0x9115('0x2d')](_0x9115('0x158'),this[_0x9115('0x3a')][_0x9115('0x3f')],_0x30a251[_0x9115('0x156')]));var _0x572f51=this[_0x9115('0x5d')][_0x9115('0x80')](this,_0x30a251['pause_id']);var _0x5ae133=this[_0x9115('0x5f')][_0x9115('0x80')](this,_0x30a251[_0x9115('0x156')],_0x572f51);if(_0x5ae133){logger[_0x9115('0x34')](util['format'](_0x9115('0x159'),this[_0x9115('0x3a')][_0x9115('0x3f')],_0x30a251[_0x9115('0x156')]));this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x159'),this['channel'][_0x9115('0x3f')],_0x30a251[_0x9115('0x156')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x9115('0x15b'),this[_0x9115('0x3a')][_0x9115('0x3f')],_0x30a251[_0x9115('0x156')]));this[_0x9115('0x3a')][_0x9115('0xbc')](util['format'](_0x9115('0x159'),this['channel'][_0x9115('0x3f')],_0x30a251['findBy']));return{'code':0xc8,'result':_0x9115('0x15e')};}};AGIVertices['prototype'][_0x9115('0x16d')]=function(_0x532ad4){logger['info'](util['format'](_0x9115('0x16e'),_0x532ad4[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0x532ad4[_0x9115('0x116')])){return this[_0x9115('0x3a')][_0x9115('0x31')](_0x532ad4,_0x9115('0x16f'));}var _0x7b420d=this['getSound'][_0x9115('0x80')](this,_0x532ad4[_0x9115('0x116')]);if(!_0x7b420d){return this[_0x9115('0x3a')][_0x9115('0x31')](_0x532ad4,_0x9115('0x166'));}var _0x1cb40f=this[_0x9115('0x3a')][_0x9115('0x67')](_0x9115('0x170'),[_0x7b420d,_0x532ad4[_0x9115('0xf0')]]);if(_0x1cb40f['result']===-0x1){return _0x1cb40f;}return this[_0x9115('0x3a')]['noop'](util['format'](_0x9115('0xcf'),_0x9115('0x170'),_0x7b420d));};AGIVertices[_0x9115('0x11')][_0x9115('0x171')]=function(_0xe626c3){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x172'),_0xe626c3[_0x9115('0x3c')]));if(!this['isConfigured'](_0xe626c3[_0x9115('0x173')])){return this[_0x9115('0x3a')][_0x9115('0x31')](_0xe626c3,_0x9115('0x174'));}var _0x555954='';var _0x5dfc86=parseInt(_0xe626c3[_0x9115('0x173')],0xa);if(isNaN(_0x5dfc86)){_0x555954=_0xe626c3['queue_id'];}else{_0x555954=this[_0x9115('0x17')][_0x9115('0x80')](this,_0xe626c3[_0x9115('0x173')]);if(!_0x555954){return this[_0x9115('0x3a')][_0x9115('0x31')](_0xe626c3,'no\x20queue\x20found');}}var _0x2abaec='';if(this[_0x9115('0xb7')](_0xe626c3['file_id'])){var _0x44eee4=this[_0x9115('0x20')][_0x9115('0x80')](this,_0xe626c3[_0x9115('0x116')]);if(_0x44eee4){_0x2abaec=_0x44eee4;}}this[_0x9115('0x39')][_0x9115('0x80')](this,_0xe626c3,_0x555954);if(_0xe626c3[_0x9115('0xf0')]['indexOf']('x')<0x0){_0xe626c3[_0x9115('0xf0')]+='x';}if(_0xe626c3['opts'][_0x9115('0x175')]('X')<0x0){_0xe626c3[_0x9115('0xf0')]+='X';}this[_0x9115('0x3a')][_0x9115('0xaf')](_0x9115('0x176'),_0x555954?_0x555954['toLowerCase']():'');var _0x3d2447=this[_0x9115('0x3a')][_0x9115('0x67')](_0x9115('0x177'),[_0x555954,_0xe626c3[_0x9115('0xf0')],_0xe626c3[_0x9115('0x73')],_0x2abaec,_0xe626c3[_0x9115('0x75')],_0xe626c3[_0x9115('0x8')],_0xe626c3[_0x9115('0x178')],_0xe626c3[_0x9115('0x179')],'',_0xe626c3[_0x9115('0x17a')]]);if(_0x3d2447['result']===-0x1){return _0x3d2447;}return this[_0x9115('0x3a')][_0x9115('0xbc')](util['format'](_0x9115('0xcf'),_0x9115('0x177'),_0x555954));};AGIVertices['prototype']['record']=function(_0x197644){logger[_0x9115('0x34')](util['format'](_0x9115('0x17b'),_0x197644[_0x9115('0x3c')]));var _0xd0a11=_0x197644[_0x9115('0x17c')]||'wav';var _0x493095=util[_0x9115('0x2d')](_0x9115('0x17d'),this[_0x9115('0x3a')]['uniqueid'],rs[_0x9115('0x11c')](0x5));var _0xac8b56=util[_0x9115('0x2d')](_0x9115('0x17e'),FILES_PATH,_0x493095,_0xd0a11);var _0x10e762=util[_0x9115('0x2d')]('%s/recordings/%s',FILES_PATH,_0x493095);this[_0x9115('0x40')][_0x9115('0x80')](this,_0x197644,_0x493095,_0xac8b56);this[_0x9115('0x3a')][_0x9115('0xaf')]('RECORDING_SAVENAME',_0x493095);logger['info'](_0x9115('0x17f'),_0x10e762,_0xd0a11,_0x197644[_0x9115('0x180')],_0x197644[_0x9115('0x75')]);return this[_0x9115('0x3a')][_0x9115('0x13b')](_0x10e762,_0xd0a11,_0x197644[_0x9115('0x180')],_0x197644[_0x9115('0x75')],undefined,!![]);};AGIVertices[_0x9115('0x11')][_0x9115('0x181')]=function(_0x5b5605){logger['info'](util[_0x9115('0x2d')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x5b5605[_0x9115('0x3c')]));if(!this['isConfigured'](_0x5b5605[_0x9115('0x73')])){return this['channel'][_0x9115('0xbc')](_0x9115('0x182'));}var _0x4b40f7=this[_0x9115('0x72')][_0x9115('0x80')](this,_0x5b5605);logger['info'](util[_0x9115('0x2d')]('Response:',util[_0x9115('0x183')](_0x4b40f7,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x5b5605[_0x9115('0xe6')])){return this[_0x9115('0x3a')]['noop'](_0x9115('0x184'));}var _0x2fb1df=this['getVariable']['sync'](this,_0x5b5605[_0x9115('0xe6')]);if(!_0x2fb1df){return this['channel'][_0x9115('0x31')](_0x5b5605,_0x9115('0xe7'));}this[_0x9115('0x3a')][_0x9115('0xaf')](util[_0x9115('0x2d')](_0x9115('0x185'),_0x2fb1df),_0x4b40f7[_0x9115('0x85')]?_0x4b40f7['statusCode']:'200');this['channel']['setVariable'](util[_0x9115('0x2d')](_0x9115('0x186'),_0x2fb1df),_0x4b40f7['statusMessage']?_0x4b40f7[_0x9115('0x86')]:'OK');if(_0x4b40f7[_0x9115('0x7b')]){try{this[_0x9115('0xad')](_0x4b40f7[_0x9115('0x7b')],_0x2fb1df);}catch(_0x5212d9){logger[_0x9115('0x31')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x2fb1df));}}return this['channel'][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0xe9'),_0x2fb1df));};AGIVertices[_0x9115('0x11')][_0x9115('0x187')]=function(_0x4d41df){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x188'),_0x4d41df[_0x9115('0x3c')]));return this[_0x9115('0x3a')][_0x9115('0x189')](_0x4d41df[_0x9115('0x18a')][_0x9115('0x68')](/\s+/g,''),_0x4d41df[_0x9115('0x180')]);};AGIVertices['prototype'][_0x9115('0x18b')]=function(_0x2dff99){logger['info'](util[_0x9115('0x2d')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x2dff99['label']));return this[_0x9115('0x3a')][_0x9115('0x18c')](_0x2dff99['number'][_0x9115('0x68')](/\s+/g,''),_0x2dff99['escape_digits']);};AGIVertices[_0x9115('0x11')]['sayphonetic']=function(_0x256843){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x18d'),_0x256843[_0x9115('0x3c')]));return this['channel'][_0x9115('0x18e')](_0x256843[_0x9115('0x6c')],_0x256843['escape_digits']);};AGIVertices['prototype']['sendMail']=function(_0x32176c){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x18f'),_0x32176c[_0x9115('0x3c')]));if(!this['isConfigured'](_0x32176c['account_id'])){return this['channel'][_0x9115('0xbc')](_0x9115('0x190'));}var _0x462529=this['getMailAccount'][_0x9115('0x80')](this,_0x32176c[_0x9115('0x191')]);if(!_0x462529||!_0x462529[_0x9115('0x192')]){return this[_0x9115('0x3a')]['error'](_0x32176c,'no\x20mail\x20account\x20found');}var _0x5bc77f={'from':util['format'](_0x9115('0x193'),_0x462529[_0x9115('0x15')],_0x462529[_0x9115('0x194')]||_0x462529[_0x9115('0x192')][_0x9115('0x195')]),'to':_0x32176c['to']||'','cc':_0x32176c['cc']||'','bcc':_0x32176c[_0x9115('0x196')]||'','subject':_0x32176c[_0x9115('0x197')],'html':_0x32176c[_0x9115('0x6c')],'text':_0x32176c['text']};var _0x58428c={'tls':{'rejectUnauthorized':![]}};if(_0x462529[_0x9115('0x192')][_0x9115('0x198')]){_0x58428c[_0x9115('0x198')]=_0x462529[_0x9115('0x192')][_0x9115('0x198')];}else{_0x58428c[_0x9115('0x199')]=_0x462529[_0x9115('0x192')][_0x9115('0x199')];_0x58428c[_0x9115('0x19a')]=_0x462529[_0x9115('0x192')][_0x9115('0x19a')];_0x58428c[_0x9115('0x19b')]=_0x462529['Smtp'][_0x9115('0x19b')];}if(_0x462529[_0x9115('0x192')][_0x9115('0x19c')]){_0x58428c[_0x9115('0x19d')]={'user':_0x462529['Smtp']['user'],'pass':_0x462529[_0x9115('0x192')]['pass']};}if(this['isConfigured'](_0x32176c[_0x9115('0x19e')])){}logger[_0x9115('0x19f')](_0x9115('0x1a0'),JSON['stringify'](_0x5bc77f));this[_0x9115('0x39')]['sync'](this,_0x32176c,_0x32176c[_0x9115('0x191')]);this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x1a1'),_0x462529[_0x9115('0x15')]));this[_0x9115('0x27')]['sync'](this,_0x58428c,_0x5bc77f);return this[_0x9115('0x3a')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x9115('0x11')][_0x9115('0x1a2')]=function(_0x402ef9){logger['info'](util[_0x9115('0x2d')](_0x9115('0x1a3'),_0x402ef9[_0x9115('0x3c')]));return this['channel'][_0x9115('0xbc')](_0x9115('0x1a4'));};AGIVertices[_0x9115('0x11')]['sendSMS']=function(_0x1b124a){logger[_0x9115('0x34')](util['format'](_0x9115('0x1a5'),_0x1b124a[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0x1b124a[_0x9115('0x1a6')])){return this[_0x9115('0x3a')]['noop'](_0x9115('0x1a7'));}var _0xbe0939=this['getSmsAccount'][_0x9115('0x80')](this,_0x1b124a[_0x9115('0x1a6')]);if(!_0xbe0939){return this['channel'][_0x9115('0x31')](_0x1b124a,_0x9115('0x1a8'));}var _0x19556a={'body':_0x1b124a[_0x9115('0x1a9')],'phone':_0x1b124a['to']||'','SmsAccountId':_0xbe0939['id']};logger[_0x9115('0x19f')]('sendSMS\x20message',JSON['stringify'](_0x19556a));this[_0x9115('0x39')][_0x9115('0x80')](this,_0x1b124a,_0x1b124a[_0x9115('0x1a6')]);this['channel'][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x1aa'),_0xbe0939[_0x9115('0x15')]));this['createSmsMessage'][_0x9115('0x80')](this,_0x19556a);return this['channel']['noop'](_0x9115('0x1ab'));};AGIVertices[_0x9115('0x11')][_0x9115('0x1ac')]=function(_0x23766d){logger[_0x9115('0x34')](util['format'](_0x9115('0x1ad'),_0x23766d[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0x23766d['variable_id'])){return this[_0x9115('0x3a')]['error'](_0x23766d,_0x9115('0x1ae'));}var _0x50fcac=this[_0x9115('0x12')][_0x9115('0x80')](this,_0x23766d[_0x9115('0xe6')]);if(!_0x50fcac){return this[_0x9115('0x3a')][_0x9115('0x31')](_0x23766d,_0x9115('0xe7'));}return this[_0x9115('0x3a')]['setVariable'](_0x50fcac,_0x23766d[_0x9115('0x1af')]);};AGIVertices['prototype'][_0x9115('0x1b0')]=function(_0x3ce300){logger[_0x9115('0x34')](util[_0x9115('0x2d')]('Enter\x20in\x20START\x20(%s)\x20block',_0x3ce300[_0x9115('0x3c')]));this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0x1b1'));if(_0x3ce300[_0x9115('0xcb')]===_0x9115('0x1b2')){this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0x1b3'));return this['channel'][_0x9115('0xcb')]();}return this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0x1b4'));};AGIVertices[_0x9115('0x11')][_0x9115('0x1b5')]=function(_0x421567){logger['info'](util[_0x9115('0x2d')](_0x9115('0x1b6'),_0x421567[_0x9115('0x3c')]));if(!this['isConfigured'](_0x421567[_0x9115('0x1b7')])){return this['channel'][_0x9115('0x31')](_0x421567,_0x9115('0x1b8'));}var _0x2a05aa=this[_0x9115('0x1b9')][_0x9115('0x80')](this,_0x421567[_0x9115('0x1b7')]);if(!this['isConfigured'](_0x2a05aa)){return this[_0x9115('0x3a')][_0x9115('0x31')](_0x421567,util[_0x9115('0x2d')](_0x9115('0x1ba'),_0x421567[_0x9115('0x1b7')]));}if(_0x2a05aa===this[_0x9115('0x3a')][_0x9115('0x3e')]){return this[_0x9115('0x3a')]['error'](_0x421567,_0x9115('0x1bb'));}this['createSquareDetailsReport']['sync'](this,_0x421567,_0x2a05aa);var _0x40dea6=this[_0x9115('0x3a')][_0x9115('0x67')](_0x9115('0x1bc'),util[_0x9115('0x2d')](_0x9115('0x1bd'),config[_0x9115('0x8')][_0x9115('0x199')]||'127.0.0.1',_0x2a05aa,this[_0x9115('0x3a')][_0x9115('0x3e')]));if(_0x40dea6[_0x9115('0xb4')]===-0x1){return _0x40dea6;}return this['channel']['noop'](util[_0x9115('0x2d')](_0x9115('0xcf'),'AGI',_0x2a05aa));};AGIVertices[_0x9115('0x11')][_0x9115('0x1be')]=function(_0x58b998){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x1bf'),_0x58b998[_0x9115('0x3c')]));var _0x575149=this[_0x9115('0x66')][_0x9115('0x80')](this,_0x58b998[_0x9115('0xc8')]);this[_0x9115('0x39')]['sync'](this,_0x58b998,_0x58b998[_0x9115('0xc8')]);if(this[_0x9115('0xb7')](_0x58b998[_0x9115('0xe6')])){var _0x3111ce=this[_0x9115('0x12')][_0x9115('0x80')](this,_0x58b998[_0x9115('0xe6')]);if(_0x3111ce){this[_0x9115('0x3a')][_0x9115('0xaf')](_0x3111ce,_0x575149);return this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x58b998['command'],_0x3111ce));}}return this[_0x9115('0x3a')][_0x9115('0xbc')](util['format'](_0x9115('0x1c0'),_0x58b998['command']));};AGIVertices[_0x9115('0x11')][_0x9115('0x1c1')]=function(_0x4bd3ce){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x1c2'),_0x4bd3ce['label']));_0x4bd3ce[_0x9115('0x6c')]=_0x4bd3ce[_0x9115('0x6c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9115('0xb7')](_0x4bd3ce[_0x9115('0x6a')])){return this[_0x9115('0x3a')][_0x9115('0xbc')](_0x9115('0x1c3'));}if(!this[_0x9115('0xb7')](_0x4bd3ce[_0x9115('0x6c')])){return this['channel'][_0x9115('0xbc')]('no\x20text\x20configured');}this[_0x9115('0x3a')][_0x9115('0xbc')](util['format'](_0x9115('0x1c4'),_0x4bd3ce['text']));var _0xa47672=this[_0x9115('0x69')][_0x9115('0x80')](this,_0x4bd3ce);if(_0xa47672){this['channel'][_0x9115('0xbc')](util[_0x9115('0x2d')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0xa47672));var _0x47f8f7=this[_0x9115('0x3a')][_0x9115('0x107')](_0xa47672);try{fs[_0x9115('0x108')](_0xa47672+_0x9115('0x109'));}catch(_0x51d74d){logger[_0x9115('0x31')](_0x51d74d);}return _0x47f8f7;}return this[_0x9115('0x3a')][_0x9115('0x31')](_0x4bd3ce,_0x9115('0x1c5'));};AGIVertices['prototype'][_0x9115('0x1c6')]=function(_0x70013e){logger[_0x9115('0x34')](util[_0x9115('0x2d')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x70013e[_0x9115('0x3c')]));_0x70013e[_0x9115('0x6c')]=_0x70013e['text'][_0x9115('0x68')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9115('0xb7')](_0x70013e[_0x9115('0x6c')])){return this[_0x9115('0x3a')][_0x9115('0xbc')]('no\x20text\x20configured');}this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x1c7'),_0x70013e[_0x9115('0x6c')]));var _0xbc3679=this['googleTTS']['sync'](this,_0x70013e);if(_0xbc3679){this[_0x9115('0x3a')][_0x9115('0xbc')](util['format'](_0x9115('0x1c8'),_0xbc3679));var _0x3c49ad=this['channel'][_0x9115('0x107')](_0xbc3679);try{fs[_0x9115('0x108')](_0xbc3679+_0x9115('0x109'));}catch(_0x5806cd){logger[_0x9115('0x31')](_0x5806cd);}return _0x3c49ad;}return this[_0x9115('0x3a')][_0x9115('0x31')](_0x70013e,_0x9115('0x1c9'));};AGIVertices['prototype'][_0x9115('0x1ca')]=function(_0x3829f8){logger[_0x9115('0x34')](util['format'](_0x9115('0x1cb'),_0x3829f8[_0x9115('0x3c')]));if(!this[_0x9115('0xb7')](_0x3829f8['findBy'])){return this['channel']['error'](_0x3829f8,_0x9115('0x157'));}logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x158'),this[_0x9115('0x3a')][_0x9115('0x3f')],_0x3829f8[_0x9115('0x156')]));var _0x5e5266=this[_0x9115('0x61')][_0x9115('0x80')](this,_0x3829f8['findBy']);if(_0x5e5266){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x159'),this[_0x9115('0x3a')][_0x9115('0x3f')],_0x3829f8[_0x9115('0x156')]));this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x159'),this[_0x9115('0x3a')][_0x9115('0x3f')],_0x3829f8['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x15b'),this[_0x9115('0x3a')]['callerid'],_0x3829f8['findBy']));this['channel'][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0x15b'),this[_0x9115('0x3a')][_0x9115('0x3f')],_0x3829f8[_0x9115('0x156')]));return{'code':0xc8,'result':_0x9115('0x15e')};}};AGIVertices['prototype'][_0x9115('0x1cc')]=function(_0x107b94){logger[_0x9115('0x34')](util[_0x9115('0x2d')](_0x9115('0x1cd'),_0x107b94[_0x9115('0x3c')]));var _0x1d2720=this[_0x9115('0x3a')][_0x9115('0x67')](_0x9115('0x1ce'),[_0x107b94['mailbox'],_0x107b94['options']]);if(_0x1d2720[_0x9115('0xb4')]===-0x1){return _0x1d2720;}return this[_0x9115('0x3a')][_0x9115('0xbc')](util[_0x9115('0x2d')](_0x9115('0xcf'),_0x9115('0x1ce'),_0x107b94['mailbox']));};AGIVertices[_0x9115('0x11')]['vswitch']=function(_0x3f6645){logger['info'](util[_0x9115('0x2d')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3f6645['label']));if(!this[_0x9115('0xb7')](_0x3f6645['variable_id'])){return this['channel'][_0x9115('0x31')](_0x3f6645,_0x9115('0x1ae'));}var _0x45de1d=this[_0x9115('0x12')][_0x9115('0x80')](this,_0x3f6645[_0x9115('0xe6')]);if(!_0x45de1d){return this['channel'][_0x9115('0x31')](_0x3f6645,_0x9115('0xe7'));}var _0x36f07a=this['channel']['getVariable'](_0x45de1d);return{'code':0xc8,'result':_0x36f07a[_0x9115('0xb6')]?_0x36f07a[_0x9115('0xb6')]:'-'};};String[_0x9115('0x11')]['replaceAll']=function(_0x3b72da,_0x577a57){return this[_0x9115('0xb1')](_0x3b72da)['join'](_0x577a57);};module[_0x9115('0x1cf')]=AGIVertices; \ No newline at end of file +var _0x524a=['query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','%s_ROWS_COUNT','variable\x20%s\x20set','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','forEach','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','macro','gosub','position','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','statusCode','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','email','Smtp','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','path','util','lodash','shelljs','randomstring','moment','mustache','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawBody','menu','getsecretdigits','channel','mailRpc','prototype','rpc','getVariableById','name','getVoiceQueue','then','catch','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','accountcode','dnid','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','has','dialTimezone','getContactByPhone','utcOffset','scheduledat','add','minutes','insertContact','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','url','timeout','number','includes','POST','PUT','method','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','parse','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','tildeASR','appid','appsecret','uri','agicommand','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','SESTEK_ASR_CONFIDENCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20query\x20configured'];(function(_0x5a825a,_0x3420e8){var _0x14c9c9=function(_0xf057dc){while(--_0xf057dc){_0x5a825a['push'](_0x5a825a['shift']());}};_0x14c9c9(++_0x3420e8);}(_0x524a,0xf5));var _0xa524=function(_0x4fe4c2,_0x1e2887){_0x4fe4c2=_0x4fe4c2-0x0;var _0x495fda=_0x524a[_0x4fe4c2];return _0x495fda;};'use strict';var fs=require('fs');var path=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var _=require(_0xa524('0x2'));var sh=require(_0xa524('0x3'));var odbc=require('odbc')();var rs=require(_0xa524('0x4'));var moment=require(_0xa524('0x5'));var Mustache=require(_0xa524('0x6'));var rp=require('request-promise');var logger=require('../../config/logger')(_0xa524('0x7'));var config=require(_0xa524('0x8'));var shared=require(_0xa524('0x9'));var scripts=require('./scripts');var FILES_PATH=_0xa524('0xa');var recursiveMapAttributes=['rawHeaders',_0xa524('0xb')];var verticesWithRetry=[_0xa524('0xc'),'getdigits',_0xa524('0xd')];var AGIVertices=function(_0x1db5bb,_0x228ffe,_0x13076e){this[_0xa524('0xe')]=_0x1db5bb;this['rpc']=_0x228ffe;this[_0xa524('0xf')]=_0x13076e;};AGIVertices[_0xa524('0x10')]['getVariable']=function(_0x565fab,_0x2fc0f9){this[_0xa524('0x11')][_0xa524('0x12')](_0x565fab)['then'](function(_0x55117f){_0x2fc0f9(null,_0x55117f?_0x55117f[_0xa524('0x13')]:![]);})['catch'](function(_0x3f4ffc){_0x2fc0f9(_0x3f4ffc);});};AGIVertices['prototype'][_0xa524('0x14')]=function(_0x5c7e6a,_0x75bfe8){this[_0xa524('0x11')]['getVoiceQueueById'](_0x5c7e6a)[_0xa524('0x15')](function(_0x15b14c){_0x75bfe8(null,_0x15b14c?_0x15b14c[_0xa524('0x13')]:![]);})[_0xa524('0x16')](function(_0x45347f){_0x75bfe8(_0x45347f);});};AGIVertices[_0xa524('0x10')][_0xa524('0x17')]=function(_0x4fc42f,_0x1ea145){this[_0xa524('0x11')][_0xa524('0x18')](_0x4fc42f)[_0xa524('0x15')](function(_0x375277){_0x1ea145(null,_0x375277?_0x375277[_0xa524('0x13')]:![]);})[_0xa524('0x16')](function(_0x43b228){_0x1ea145(_0x43b228);});};AGIVertices['prototype'][_0xa524('0x19')]=function(_0x20f8e1,_0xb31e2d){this[_0xa524('0x11')]['getSquareOdbcById'](_0x20f8e1)['then'](function(_0x40f4bd){_0xb31e2d(null,_0x40f4bd?_0x40f4bd[_0xa524('0x1a')]:![]);})[_0xa524('0x16')](function(_0x1093cc){_0xb31e2d(_0x1093cc);});};AGIVertices[_0xa524('0x10')][_0xa524('0x1b')]=function(_0x4abffe,_0x262eac){this[_0xa524('0x11')][_0xa524('0x1c')](_0x4abffe)[_0xa524('0x15')](function(_0x226784){_0x262eac(null,_0x226784?_0x226784[_0xa524('0x13')]:![]);})[_0xa524('0x16')](function(_0x4babac){_0x262eac(_0x4babac);});};AGIVertices[_0xa524('0x10')][_0xa524('0x1d')]=function(_0x5de496,_0x47efb3){this[_0xa524('0x11')][_0xa524('0x1e')](_0x5de496)[_0xa524('0x15')](function(_0x364b8c){_0x47efb3(null,_0x364b8c?_0x364b8c[_0xa524('0x13')]:![]);})['catch'](function(_0x4f484a){_0x47efb3(_0x4f484a);});};AGIVertices[_0xa524('0x10')][_0xa524('0x1f')]=function(_0x1582fa,_0x9e9e5e){var _0x505c42=this;this[_0xa524('0x11')][_0xa524('0x20')](_0x1582fa)['then'](function(_0x27f53a){_0x9e9e5e(null,_0x27f53a?_0x505c42[_0xa524('0x21')](_0x27f53a['save_name']):![]);})[_0xa524('0x16')](function(_0x5f03ad){_0x9e9e5e(_0x5f03ad);});};AGIVertices[_0xa524('0x10')][_0xa524('0x22')]=function(_0x45b846,_0x238133){this[_0xa524('0x11')][_0xa524('0x23')](_0x45b846)[_0xa524('0x15')](function(_0x201545){_0x238133(null,_0x201545?_0x201545:![]);})[_0xa524('0x16')](function(_0x5b6a54){_0x238133(_0x5b6a54);});};AGIVertices['prototype'][_0xa524('0x24')]=function(_0x52dd9f,_0x4a9e32,_0x46af1b){this[_0xa524('0xf')][_0xa524('0x24')](_0x52dd9f,_0x4a9e32)[_0xa524('0x15')](function(){_0x46af1b(null);})['catch'](function(_0x55f4bc){_0x46af1b(_0x55f4bc);});};AGIVertices[_0xa524('0x10')]['getIntervals']=function(_0x516cee,_0x268341){this[_0xa524('0x11')][_0xa524('0x25')](_0x516cee)[_0xa524('0x15')](function(_0x1bf6f6){if(_0x1bf6f6){if(_0x1bf6f6[_0xa524('0x26')]){_0x268341(null,[_0x1bf6f6[_0xa524('0x27')]]);}else{_0x268341(null,_[_0xa524('0x28')](_0x1bf6f6[_0xa524('0x29')],_0xa524('0x27')));}}else{_0x268341(null,![]);}})[_0xa524('0x16')](function(_0x286ffa){_0x268341(_0x286ffa);});};AGIVertices['prototype']['getSoundPath']=function(_0x5f0c8b){return util[_0xa524('0x2a')](_0xa524('0x2b'),FILES_PATH,_0x5f0c8b);};AGIVertices['prototype'][_0xa524('0x2c')]=function(_0x51fd42,_0x266f17,_0x7f1c77){odbc['open'](_0x51fd42,function(_0x208822){if(_0x208822){logger[_0xa524('0x2d')](_0xa524('0x2e'),_0x208822);_0x7f1c77(_0x208822);}else{logger['info'](_0xa524('0x2f'));odbc[_0xa524('0x30')](_0x266f17,function(_0x5f54b1,_0x1ae798){if(_0x5f54b1){logger[_0xa524('0x31')]('Error\x20executing\x20query\x20%s',_0x266f17);_0x7f1c77(_0x5f54b1);}else{logger[_0xa524('0x31')](_0xa524('0x32'),_0x266f17);odbc['close'](function(_0x63e628){if(_0x63e628){logger[_0xa524('0x2d')](_0xa524('0x33'),_0x63e628);}_0x7f1c77(null,_0x1ae798);});}});}});};AGIVertices[_0xa524('0x10')][_0xa524('0x34')]=function(_0x38f87a,_0x1db74f){this[_0xa524('0x11')][_0xa524('0x35')](_0x38f87a)[_0xa524('0x15')](function(_0x38e745){_0x1db74f(null,_0x38e745?_0x38e745:![]);})['catch'](function(_0x1dc2c4){_0x1db74f(_0x1dc2c4);});};AGIVertices['prototype'][_0xa524('0x36')]=function(_0x24237c,_0x35d92d){this[_0xa524('0x11')][_0xa524('0x36')](_0x24237c)[_0xa524('0x15')](function(_0x1802bc){_0x35d92d(null,_0x1802bc);})[_0xa524('0x16')](function(_0x30247c){_0x35d92d(_0x30247c);});};AGIVertices[_0xa524('0x10')]['createSquareDetailsReport']=function(_0x43b659,_0x2425da,_0x4b99ef){this[_0xa524('0x11')][_0xa524('0x37')]({'uniqueid':this['channel']['uniqueid'],'node':_0x43b659['label'],'application':_0x43b659['agicommand'],'data':_0x2425da||null,'project_name':this['channel'][_0xa524('0x38')],'callerid':this[_0xa524('0xe')][_0xa524('0x39')]})[_0xa524('0x15')](function(_0x479aee){if(_0x4b99ef){_0x4b99ef(null,_0x479aee);}})[_0xa524('0x16')](function(_0x44b3e8){if(_0x4b99ef){_0x4b99ef(_0x44b3e8);}});};AGIVertices[_0xa524('0x10')][_0xa524('0x3a')]=function(_0x582dd7,_0x32e9d6,_0x17675a,_0x21dce0){this[_0xa524('0x11')][_0xa524('0x3a')]({'uniqueid':this['channel'][_0xa524('0x3b')],'callerid':this[_0xa524('0xe')][_0xa524('0x39')],'calleridname':this[_0xa524('0xe')][_0xa524('0x3c')],'context':this[_0xa524('0xe')][_0xa524('0x3d')],'extension':this[_0xa524('0xe')][_0xa524('0x3e')],'priority':this['channel']['priority'],'accountcode':this[_0xa524('0xe')][_0xa524('0x3f')],'dnid':this[_0xa524('0xe')][_0xa524('0x40')],'projectName':this[_0xa524('0xe')][_0xa524('0x38')],'saveName':_0x32e9d6,'filename':_0x582dd7['file']||_0x32e9d6,'savePath':_0x17675a})[_0xa524('0x15')](function(_0x217aca){_0x21dce0(null,_0x217aca);})[_0xa524('0x16')](function(_0x38942b){_0x21dce0(_0x38942b);});};AGIVertices[_0xa524('0x10')][_0xa524('0x41')]=function(_0x550415,_0x39ba9c,_0x2b953e,_0xdc63e3,_0x264e73){this[_0xa524('0x11')][_0xa524('0x41')]({'uniqueid':this[_0xa524('0xe')][_0xa524('0x3b')],'body':_0x550415,'direction':_0x39ba9c,'providerName':_0x2b953e,'providerResponse':_0xdc63e3})[_0xa524('0x15')](function(_0x217314){if(_0x264e73){_0x264e73(null,_0x217314);}})[_0xa524('0x16')](function(_0x3af617){if(_0x264e73){_0x264e73(_0x3af617);}});};AGIVertices[_0xa524('0x10')][_0xa524('0x42')]=function(_0x25e04b,_0x5e9919){var _0x1264f5=this;var _0xbc3f3f=0x0;var _0x4eeab2={'firstName':_['isEmpty'](_0x25e04b[_0xa524('0x13')])||_[_0xa524('0x43')](_0x25e04b[_0xa524('0x13')])?_0xa524('0x44')+Math[_0xa524('0x45')]():_0x25e04b[_0xa524('0x13')],'lastName':_[_0xa524('0x46')](_0x25e04b['lastName'])||_[_0xa524('0x43')](_0x25e04b[_0xa524('0x47')])?null:_0x25e04b[_0xa524('0x47')],'phone':_0x25e04b[_0xa524('0x48')],'ListId':_0x25e04b[_0xa524('0x49')],'scheduledat':_0x25e04b['scheduledAt'],'callbackUniqueid':this[_0xa524('0xe')]['uniqueid'],'tags':_0xa524('0x4a'),'description':_0xa524('0x4b')+_0x25e04b[_0xa524('0x4c')][_0xa524('0x4d')](),'priority':_0x25e04b[_0xa524('0x4e')]};if(_[_0xa524('0x4f')](_0x25e04b,_0xa524('0x50'))){if(!_['isNil'](_0x25e04b['dialTimezone'])){var _0x37098c=_0x25e04b[_0xa524('0x50')];if(_0x25e04b[_0xa524('0x50')]=='CALLERID(dialTimezone)'){this[_0xa524('0x11')][_0xa524('0x51')]({'phone':_0x25e04b['phone']})[_0xa524('0x15')](function(_0x208d94){if(!_[_0xa524('0x43')](_0x208d94)){var _0x3e841e=_0x208d94[_0xa524('0x50')];if(!_[_0xa524('0x43')](_0x3e841e)){var _0x3e067e=shared['timezones'][_0x3e841e];if(!_[_0xa524('0x43')](_0x3e067e)){var _0xa4c535=-0x1*_0x3e067e[_0xa524('0x52')];_0x4eeab2[_0xa524('0x53')]=moment(_0x25e04b['scheduledat'])[_0xa524('0x54')](_0xa4c535,_0xa524('0x55'));_0x1264f5['insertContact'](_0x4eeab2,_0x25e04b,_0x5e9919);}else{_0x1264f5[_0xa524('0x56')](_0x4eeab2,_0x25e04b,_0x5e9919);}}else{_0x1264f5[_0xa524('0x56')](_0x4eeab2,_0x25e04b,_0x5e9919);}}else{_0x1264f5[_0xa524('0x56')](_0x4eeab2,_0x25e04b,_0x5e9919);}});}else{var _0xbc3f3f=shared['timezones'][_0x37098c];if(!_['isNil'](_0xbc3f3f)){var _0x1f19f6=-0x1*_0xbc3f3f['utcOffset'];_0x4eeab2['scheduledat']=moment(_0x25e04b['scheduledat'])[_0xa524('0x54')](_0x1f19f6,'minutes');_0x1264f5['insertContact'](_0x4eeab2,_0x25e04b,_0x5e9919);}else{_0x1264f5[_0xa524('0x56')](_0x4eeab2,_0x25e04b,_0x5e9919);}}}else{_0x1264f5[_0xa524('0x56')](_0x4eeab2,_0x25e04b,_0x5e9919);}}else{_0x1264f5[_0xa524('0x56')](_0x4eeab2,_0x25e04b,_0x5e9919);}};AGIVertices[_0xa524('0x10')]['getPause']=function(_0x16384d,_0x2878e5){this[_0xa524('0x11')]['getPauseById'](_0x16384d)[_0xa524('0x15')](function(_0xbea3d5){_0x2878e5(null,_0xbea3d5?_0xbea3d5['name']:![]);})['catch'](function(_0x3e710f){_0x2878e5(_0x3e710f);});};AGIVertices[_0xa524('0x10')][_0xa524('0x57')]=function(_0x1cdbf3,_0x573e49,_0x4d1f65){var _0x300bb7={'role':_0xa524('0x58')};_0x300bb7[_0x1cdbf3]=this[_0xa524('0xe')]['callerid'];this['rpc'][_0xa524('0x57')](_0x300bb7,_0x573e49,this['channel']['uniqueid'])['then'](function(_0x4f71b1){_0x4d1f65(null,_[_0xa524('0x43')](_0x4f71b1)?![]:!![]);})[_0xa524('0x16')](function(_0x5a5ce4){logger['error'](_0x5a5ce4);_0x4d1f65(null,![]);});};AGIVertices[_0xa524('0x10')][_0xa524('0x59')]=function(_0x50ec48,_0x45c52e){var _0x1bd372={'role':_0xa524('0x58')};_0x1bd372[_0x50ec48]=this[_0xa524('0xe')][_0xa524('0x39')];this[_0xa524('0x11')][_0xa524('0x59')](_0x1bd372)[_0xa524('0x15')](function(_0xf1a9b){_0x45c52e(null,_[_0xa524('0x43')](_0xf1a9b)?![]:!![]);})['catch'](function(_0x2695e0){logger[_0xa524('0x2d')](_0x2695e0);_0x45c52e(null,![]);});};AGIVertices[_0xa524('0x10')][_0xa524('0x5a')]=function(_0x241b41,_0x45d609){var _0x59a7a1={'role':'agent'};_0x59a7a1[_0x241b41]=this[_0xa524('0xe')]['callerid'];this[_0xa524('0x11')][_0xa524('0x5a')](_0x59a7a1)[_0xa524('0x15')](function(_0x4975bb){_0x45d609(null,_[_0xa524('0x43')](_0x4975bb)?![]:!![]);})[_0xa524('0x16')](function(_0x11c850){logger[_0xa524('0x2d')](_0x11c850);_0x45d609(null,![]);});};AGIVertices[_0xa524('0x10')][_0xa524('0x5b')]=function(_0xa23fd3,_0x4c9be4){var _0x319119={'role':_0xa524('0x58')};_0x319119[_0xa23fd3]=this[_0xa524('0xe')][_0xa524('0x39')];var _0xefd8fc=_0xa23fd3!=_0xa524('0x5c')?util['format'](_0xa524('0x5d'),_0xa524('0x5e'),this[_0xa524('0xe')]['callerid']):undefined;this['rpc'][_0xa524('0x5b')](_0x319119,_0xefd8fc)[_0xa524('0x15')](function(_0x162254){_0x4c9be4(null,_[_0xa524('0x43')](_0x162254)?![]:!![]);})[_0xa524('0x16')](function(_0xf934dc){logger[_0xa524('0x2d')](_0xf934dc);_0x4c9be4(null,![]);});};AGIVertices[_0xa524('0x10')][_0xa524('0x5f')]=function(_0x4a77d9,_0x1b9563){sh[_0xa524('0x60')](_['trim'](_0x4a77d9),function(_0x1b3ebe,_0x2f06cb){var _0x34e5a6=_0x2f06cb[_0xa524('0x61')](/(\r\n|\n|\r)/gm,'');_0x1b9563(null,_0x34e5a6);});};AGIVertices[_0xa524('0x10')][_0xa524('0x62')]=function(_0x482043,_0x5238a8){scripts['googleCloudTTS'](_0x482043[_0xa524('0x63')],_0x482043['google_cloud_tts_text_type']||'text',_0x482043[_0xa524('0x64')],_0x482043[_0xa524('0x65')]||_0xa524('0x66'),_0x482043[_0xa524('0x67')]||_0xa524('0x68'),_0x482043[_0xa524('0x69')]||'MP3')[_0xa524('0x15')](function(_0xb51aa9){_0x5238a8(null,_0xb51aa9);})['catch'](function(_0x1d1319){_0x5238a8(_0x1d1319);});};AGIVertices['prototype'][_0xa524('0x6a')]=function(_0x3c74a8,_0x551760){scripts[_0xa524('0x6a')](_0x3c74a8['text'],_0x3c74a8['google_tts_language']||'en',0x1)[_0xa524('0x15')](function(_0x1e017d){_0x551760(null,_0x1e017d);})[_0xa524('0x16')](function(_0x38e170){_0x551760(_0x38e170);});};AGIVertices[_0xa524('0x10')][_0xa524('0x6b')]=function(_0x2d46b6,_0x4053b0){var _0x40b92e={'uri':_0x2d46b6[_0xa524('0x6c')],'method':_0x2d46b6['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2d46b6[_0xa524('0x6d')])===_0xa524('0x6e')&&parseInt(_0x2d46b6[_0xa524('0x6d')])>=0x1?parseInt(_0x2d46b6[_0xa524('0x6d')])*0x3e8:0x5*0x3e8};if(_[_0xa524('0x6f')]([_0xa524('0x70'),_0xa524('0x71')],_0x40b92e[_0xa524('0x72')][_0xa524('0x73')]())){try{_0x40b92e['body']=_0x2d46b6[_0xa524('0xb')]?JSON['parse'](_0x2d46b6[_0xa524('0xb')]):{};}catch(_0x45be9b){logger[_0xa524('0x2d')](_0xa524('0x74'),_0x45be9b);}}try{_0x40b92e[_0xa524('0x75')]=_0x2d46b6['rawHeaders']?JSON['parse'](_0x2d46b6['rawHeaders']):{};}catch(_0x5b38e1){logger[_0xa524('0x2d')](_0xa524('0x76'),_0x5b38e1);}if(_0x2d46b6[_0xa524('0x77')]){try{var _0x4b7fe6=require(_0x2d46b6[_0xa524('0x77')])[_0xa524('0x78')](this,_0x40b92e);_0x40b92e['uri']=Mustache['render'](_0x2d46b6[_0xa524('0x6c')],_0x4b7fe6,{},['$$','$$']);if(_0x40b92e[_0xa524('0x75')]){_0x40b92e[_0xa524('0x75')]=JSON[_0xa524('0x79')](Mustache[_0xa524('0x7a')](JSON[_0xa524('0x7b')](_0x40b92e[_0xa524('0x75')]),_0x4b7fe6,{},['$$','$$']));}if(_0x40b92e[_0xa524('0x7c')]){_0x40b92e[_0xa524('0x7c')]=JSON['parse'](Mustache['render'](JSON[_0xa524('0x7b')](_0x40b92e[_0xa524('0x7c')]),_0x4b7fe6,{},['$$','$$']));}}catch(_0x46b7ba){logger[_0xa524('0x2d')](_0xa524('0x7d'),_0x46b7ba);}}rp(_0x40b92e)['then'](function(_0x5664f3){var _0x26b875={'statusCode':_0x5664f3['statusCode']||0xc8,'statusMessage':_0x5664f3[_0xa524('0x7e')]||'OK','headers':_0x5664f3[_0xa524('0x75')]||{},'body':_0x5664f3[_0xa524('0x7c')]||{}};_0x4053b0(null,_0x26b875);})['catch'](function(_0x14d8b8){var _0x3a3c5c={'statusCode':_0x14d8b8['statusCode']||0x1f4,'statusMessage':_0x14d8b8[_0xa524('0x7f')]||_0xa524('0x80'),'headers':_0x14d8b8[_0xa524('0x81')]['headers']||{},'body':_0x14d8b8['options'][_0xa524('0x7c')]||{}};_0x4053b0(null,_0x3a3c5c);});};AGIVertices['prototype'][_0xa524('0x82')]=function(_0x32ebaa,_0x3bd8fc){scripts[_0xa524('0x82')](this[_0xa524('0xe')][_0xa524('0x3b')],_0x32ebaa[_0xa524('0x83')],_0x32ebaa[_0xa524('0x64')],_0x32ebaa[_0xa524('0x84')]||'en')[_0xa524('0x15')](function(_0x443363){_0x3bd8fc(null,_0x443363);})['catch'](function(_0x1a8726){_0x3bd8fc(_0x1a8726);});};AGIVertices[_0xa524('0x10')][_0xa524('0x85')]=function(_0xe58511,_0x5ef813){scripts['googleDialogflowV2'](this['channel'][_0xa524('0x3b')],_0xe58511[_0xa524('0x86')],_0xe58511[_0xa524('0x87')],_0xe58511[_0xa524('0x88')],_0xe58511[_0xa524('0x64')],_0xe58511[_0xa524('0x89')]||'en')['then'](function(_0x3c62c1){_0x5ef813(null,_0x3c62c1);})[_0xa524('0x16')](function(_0x4274de){_0x5ef813(_0x4274de);});};AGIVertices[_0xa524('0x10')][_0xa524('0x8a')]=function(_0x4cc186,_0x2a7d86){scripts[_0xa524('0x8a')](this['channel'],_0x4cc186)[_0xa524('0x15')](function(_0x527622){_0x2a7d86(null,_0x527622);})[_0xa524('0x16')](function(_0x3e9e09){_0x2a7d86(_0x3e9e09);});};AGIVertices[_0xa524('0x10')][_0xa524('0x8b')]=function(_0x39583b,_0x56b0a4){scripts[_0xa524('0x8b')](_0x39583b[_0xa524('0x83')],_0x39583b[_0xa524('0x64')],_0x39583b['ispeech_tts_language']||_0xa524('0x66'),_0x39583b[_0xa524('0x8c')])[_0xa524('0x15')](function(_0x45d188){_0x56b0a4(null,_0x45d188);})[_0xa524('0x16')](function(_0x147cd4){_0x56b0a4(_0x147cd4);});};AGIVertices['prototype'][_0xa524('0x8d')]=function(_0x181572,_0x4f1240,_0x1feaa0){scripts[_0xa524('0x8d')](_0x4f1240,_0x181572[_0xa524('0x83')],_0x181572[_0xa524('0x8e')]||'en-US',this['isConfigured'](_0x181572['model'])?_0x181572[_0xa524('0x8f')]:undefined)[_0xa524('0x15')](function(_0x144cdb){_0x1feaa0(null,_0x144cdb);})['catch'](function(_0x1dc096){_0x1feaa0(_0x1dc096);});};AGIVertices[_0xa524('0x10')][_0xa524('0x90')]=function(_0x306211,_0x947dfa){scripts[_0xa524('0x90')](_0x306211[_0xa524('0x91')],_0x306211[_0xa524('0x92')],_0x306211['aws_polly_region'],_0x306211[_0xa524('0x93')]||_0xa524('0x94'),_0x306211[_0xa524('0x64')],_0x306211[_0xa524('0x95')]||'text')[_0xa524('0x15')](function(_0x48660b){_0x947dfa(null,_0x48660b);})[_0xa524('0x16')](function(_0x54cf00){_0x947dfa(_0x54cf00);});};AGIVertices['prototype'][_0xa524('0x96')]=function(_0x3de690,_0x1bffdb){scripts[_0xa524('0x96')](this['channel'][_0xa524('0x3b')],_0x3de690[_0xa524('0x91')],_0x3de690[_0xa524('0x92')],_0x3de690['aws_lex_region'],_0x3de690[_0xa524('0x64')],_0x3de690[_0xa524('0x97')])[_0xa524('0x15')](function(_0x4a92d9){_0x1bffdb(null,_0x4a92d9);})[_0xa524('0x16')](function(_0x1e9560){_0x1bffdb(_0x1e9560);});};AGIVertices[_0xa524('0x10')][_0xa524('0x98')]=function(_0x1f6969,_0xde9945,_0x112c63){scripts[_0xa524('0x98')](_0xde9945,_0x1f6969[_0xa524('0x83')],_0x1f6969['google_asr_language']||_0xa524('0x66'))['then'](function(_0x5b94e5){_0x112c63(null,_0x5b94e5);})[_0xa524('0x16')](function(_0x16e509){_0x112c63(_0x16e509);});};AGIVertices[_0xa524('0x10')][_0xa524('0x99')]=function(_0x650185,_0x4d6220,_0x9e2f0f){scripts[_0xa524('0x99')](_0x4d6220,_0x650185[_0xa524('0x9a')],_0x650185[_0xa524('0x9b')],_0x650185[_0xa524('0x9c')])[_0xa524('0x15')](function(_0xed69d5){_0x9e2f0f(null,_0xed69d5);})[_0xa524('0x16')](function(_0x402f08){_0x9e2f0f(_0x402f08);});};AGIVertices['prototype']['clear']=function(_0x17b862){var _0x342ff9=_['includes'](verticesWithRetry,_0x17b862[_0xa524('0x9d')])?_0x17b862:_[_0xa524('0x9e')](_0x17b862);for(var _0x55b193 in _0x342ff9){if(_0x342ff9['hasOwnProperty'](_0x55b193)){if(_0x342ff9[_0x55b193]&&_[_0xa524('0x9f')](_0x342ff9[_0x55b193])){if(_[_0xa524('0x6f')](recursiveMapAttributes,_0x55b193)){_0x342ff9[_0x55b193]=this[_0xa524('0xa0')](_0x342ff9[_0x55b193]);}else{_0x342ff9[_0x55b193]=this[_0xa524('0xa1')](_0x342ff9[_0x55b193]);}}}}return _0x342ff9;};AGIVertices[_0xa524('0x10')][_0xa524('0xa2')]=function(_0x4862a7){for(var _0x53c328 in _0x4862a7){if(_0x4862a7[_0xa524('0xa3')](_0x53c328)){if(_['isPlainObject'](_0x4862a7[_0x53c328])){this[_0xa524('0xa2')](_0x4862a7[_0x53c328]);}else if(_[_0xa524('0xa4')](_0x4862a7[_0x53c328])){for(var _0x47de5d=0x0;_0x47de5d<_0x4862a7[_0x53c328][_0xa524('0xa5')];_0x47de5d++){this[_0xa524('0xa2')](_0x4862a7[_0x53c328][_0x47de5d]);}}else if(_[_0xa524('0x9f')](_0x4862a7[_0x53c328])){_0x4862a7[_0x53c328]=this[_0xa524('0xa1')](_0x4862a7[_0x53c328]);}}}};AGIVertices[_0xa524('0x10')][_0xa524('0xa6')]=function(_0x181f56,_0x1ad7e7){for(var _0x1f1954 in _0x181f56){if(_0x181f56['hasOwnProperty'](_0x1f1954)){if(_['isPlainObject'](_0x181f56[_0x1f1954])){if(!_['isEmpty'](_0x181f56[_0x1f1954])){this[_0xa524('0xa6')](_0x181f56[_0x1f1954],util[_0xa524('0x2a')](_0xa524('0xa7'),_0x1ad7e7,_0x1f1954));}}else if(_['isArray'](_0x181f56[_0x1f1954])){for(var _0xa41296=0x0;_0xa41296<_0x181f56[_0x1f1954]['length'];_0xa41296++){this[_0xa524('0xa6')](_0x181f56[_0x1f1954][_0xa41296],util[_0xa524('0x2a')](_0xa524('0xa7'),_0x1ad7e7,_0x1f1954+'['+_0xa41296+']'));}}else{if(!_['isNil'](_0x181f56[_0x1f1954])){this[_0xa524('0xe')][_0xa524('0xa8')](util['format'](_0xa524('0xa7'),_0x1ad7e7,_0x1f1954),_0x181f56[_0x1f1954]);}}}}};AGIVertices['prototype'][_0xa524('0xa0')]=function(_0x264ec6){try{var _0x2fcef7=JSON[_0xa524('0x79')](_0x264ec6);this[_0xa524('0xa2')](_0x2fcef7);return JSON[_0xa524('0x7b')](_0x2fcef7);}catch(_0x37739b){return this[_0xa524('0xa1')](_0x264ec6);}};AGIVertices['prototype'][_0xa524('0xa1')]=function(_0x5bc763){var _0x4d4112=_0x5bc763[_0xa524('0xa9')]('{');for(var _0x3e4b32=0x1;_0x3e4b32<_0x4d4112[_0xa524('0xa5')];_0x3e4b32+=0x1){var _0x18264d=_0x4d4112[_0x3e4b32][_0xa524('0xa9')]('}');if(_0x18264d[_0xa524('0xa5')]>0x1){_0x5bc763=_0x5bc763[_0xa524('0xaa')]('{'+_0x18264d[0x0]+'}',this[_0xa524('0xe')][_0xa524('0xab')](_0x18264d[0x0])[_0xa524('0xac')]||_0x18264d[0x0]);}}if(_0x4d4112[_0xa524('0xa5')]===0x1){return _0x5bc763[_0xa524('0x4d')]();}return this[_0xa524('0xa1')](_0x5bc763);};AGIVertices[_0xa524('0x10')][_0xa524('0xad')]=function(_0x10a045,_0x5be057){var _0x27909b=this[_0xa524('0xe')][_0xa524('0xab')](_0x10a045);if(_0x27909b[_0xa524('0xae')]===-0x1){return _0x27909b;}logger['info'](util['format'](_0xa524('0xaf'),_0x5be057,_0x27909b[_0xa524('0xac')]));return this['channel'][_0xa524('0xa8')](_0x5be057,_0x27909b[_0xa524('0xac')]);};AGIVertices[_0xa524('0x10')][_0xa524('0xb0')]=function(_0x4eb68f){return _0x4eb68f&&_0x4eb68f!=='0'&&_0x4eb68f!=='-1'&&_0x4eb68f!=='';};AGIVertices[_0xa524('0x10')][_0xa524('0xb1')]=function(_0x41f194){this['createSquareDetailsReport'][_0xa524('0x78')](this,_0x41f194,'-');_0x41f194[_0xa524('0xb2')]=_0x41f194[_0xa524('0xb1')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xa524('0xb3')]=function(_0x2238c7){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0xb4'),_0x2238c7[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0x2238c7[_0xa524('0x64')])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0xb7'));}var _0x331aa8='\x22'+_0x2238c7[_0xa524('0x64')]+'\x22';if(this[_0xa524('0xb0')](_0x2238c7[_0xa524('0x81')])){_0x331aa8+=','+_0x2238c7[_0xa524('0x81')];}var _0x30d613=this[_0xa524('0xe')][_0xa524('0x60')](_0xa524('0xb8'),_0x331aa8);if(_0x30d613[_0xa524('0xae')]===-0x1){return _0x30d613;}return this[_0xa524('0xe')][_0xa524('0xb6')](util['format'](_0xa524('0xb9'),_0x331aa8));};AGIVertices[_0xa524('0x10')]['mrcprecog']=function(_0x41d642){logger[_0xa524('0x31')](util[_0xa524('0x2a')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x41d642[_0xa524('0xb5')]));if(!this['isConfigured'](_0x41d642[_0xa524('0xba')])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0xbb'));}var _0x24a8ff=_0x41d642['grammar'];if(this[_0xa524('0xb0')](_0x41d642[_0xa524('0x81')])){_0x24a8ff+=','+_0x41d642['options'];}var _0x357955=this[_0xa524('0xe')][_0xa524('0x60')]('MRCPRecog',_0x24a8ff);if(_0x357955[_0xa524('0xae')]===-0x1){return _0x357955;}var _0x588a8b=this['getAndSetVariable'](_0xa524('0xbc'),_0xa524('0xbd'));if(_0x588a8b[_0xa524('0xae')]===-0x1){return _0x588a8b;}var _0x1e3614=this[_0xa524('0xad')](_0xa524('0xbe'),_0xa524('0xbf'));if(_0x1e3614['result']===-0x1){return _0x1e3614;}var _0x30a8b3=this[_0xa524('0xad')](_0xa524('0xc0'),_0xa524('0xc1'));if(_0x30a8b3[_0xa524('0xae')]===-0x1){return _0x30a8b3;}return this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x24a8ff));};AGIVertices['prototype']['agi']=function(_0x144bd6){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0xc2'),_0x144bd6[_0xa524('0xb5')]));return this[_0xa524('0xe')][_0xa524('0x7')]([_0x144bd6[_0xa524('0xc3')],_0x144bd6[_0xa524('0xc4')]]);};AGIVertices['prototype'][_0xa524('0xc5')]=function(_0x1d033c){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0xc6'),_0x1d033c[_0xa524('0xb5')]));if(this[_0xa524('0xb0')](_0x1d033c['timeout'])){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0xc7'),_0x1d033c[_0xa524('0x6d')]));var _0x256c0c=this['channel'][_0xa524('0xc8')](_0x1d033c[_0xa524('0x6d')]);if(_0x256c0c[_0xa524('0xae')]===-0x1){return _0x256c0c;}}return this[_0xa524('0xe')][_0xa524('0xc5')]();};AGIVertices[_0xa524('0x10')][_0xa524('0x4a')]=function(_0x383466){logger['info'](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x383466[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0x383466[_0xa524('0x49')])){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x383466,'no\x20list\x20selected');}_0x383466['scheduledAt']=moment();if(this[_0xa524('0xb0')](_0x383466[_0xa524('0xc9')])){_0x383466['scheduledAt']=moment()['add'](_0x383466['delay'],'minutes');}if(!this[_0xa524('0xb0')](_0x383466[_0xa524('0x4e')])){_0x383466[_0xa524('0x4e')]=0x2;}this[_0xa524('0x42')][_0xa524('0x78')](this,_0x383466);return this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0xca'),_0x383466[_0xa524('0x48')],_0x383466[_0xa524('0x49')],_0x383466['scheduledAt']));};AGIVertices[_0xa524('0x10')][_0xa524('0xcb')]=function(_0x4eb392){logger[_0xa524('0x31')](util['format'](_0xa524('0xcc'),_0x4eb392[_0xa524('0xb5')]));var _0x11184b=this[_0xa524('0xe')][_0xa524('0x60')](_0x4eb392['application'],_0x4eb392[_0xa524('0x81')]);if(_0x11184b[_0xa524('0xae')]===-0x1){return _0x11184b;}return this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0xcd'),_0x4eb392[_0xa524('0xce')],_0x4eb392[_0xa524('0x81')]));};AGIVertices[_0xa524('0x10')][_0xa524('0xcf')]=function(_0x416e0b){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0xd0'),_0x416e0b[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0x416e0b['text'])){return this['channel'][_0xa524('0xb6')](_0xa524('0xb7'));}var _0x57adc5='\x22'+_0x416e0b[_0xa524('0x64')]+'\x22';if(this[_0xa524('0xb0')](_0x416e0b[_0xa524('0x81')])){_0x57adc5+=','+_0x416e0b[_0xa524('0x81')];}var _0x561def=this[_0xa524('0xe')][_0xa524('0x60')]('MRCPSynth',_0x57adc5);if(_0x561def[_0xa524('0xae')]===-0x1){return _0x561def;}return this[_0xa524('0xe')][_0xa524('0xb6')](util['format'](_0xa524('0xb9'),_0x57adc5));};AGIVertices['prototype'][_0xa524('0xd1')]=function(_0x3a9636){logger['info'](util[_0xa524('0x2a')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x3a9636[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0x3a9636[_0xa524('0x64')])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0xb7'));}var _0x46a7ad='\x22'+_0x3a9636[_0xa524('0x64')]+'\x22';if(this[_0xa524('0xb0')](_0x3a9636['options'])){_0x46a7ad+=','+_0x3a9636[_0xa524('0x81')];}var _0x4adf34=this[_0xa524('0xe')][_0xa524('0x60')]('MRCPSynth',_0x46a7ad);if(_0x4adf34[_0xa524('0xae')]===-0x1){return _0x4adf34;}return this[_0xa524('0xe')][_0xa524('0xb6')](util['format'](_0xa524('0xb9'),_0x46a7ad));};AGIVertices['prototype'][_0xa524('0xd2')]=function(_0x1e69a5){logger['info'](util[_0xa524('0x2a')](_0xa524('0xd3'),_0x1e69a5[_0xa524('0xb5')]));if(!this['isConfigured'](_0x1e69a5[_0xa524('0xba')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x58041b=_0x1e69a5[_0xa524('0xba')];if(this[_0xa524('0xb0')](_0x1e69a5[_0xa524('0x81')])){_0x58041b+=','+_0x1e69a5[_0xa524('0x81')];}var _0x2449f4=this['channel']['exec']('MRCPRecog',_0x58041b);if(_0x2449f4[_0xa524('0xae')]===-0x1){return _0x2449f4;}var _0x11731a=this[_0xa524('0xad')](_0xa524('0xbc'),'LUMENVOX_ASR_CONFIDENCE');if(_0x11731a[_0xa524('0xae')]===-0x1){return _0x11731a;}var _0x155c4f=this['getAndSetVariable']('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x155c4f[_0xa524('0xae')]===-0x1){return _0x155c4f;}var _0x21b6b0=this[_0xa524('0xad')](_0xa524('0xc0'),'LUMENVOX_ASR_INSTANCE');if(_0x21b6b0['result']===-0x1){return _0x21b6b0;}return this['channel'][_0xa524('0xb6')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x58041b));};AGIVertices[_0xa524('0x10')][_0xa524('0xd4')]=function(_0x3240c8){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0xd5'),_0x3240c8[_0xa524('0xb5')]));if(!this['isConfigured'](_0x3240c8[_0xa524('0xba')])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0xbb'));}var _0x901199=_0x3240c8[_0xa524('0xba')];if(this[_0xa524('0xb0')](_0x3240c8[_0xa524('0x81')])){_0x901199+=','+_0x3240c8[_0xa524('0x81')];}var _0x348048=this[_0xa524('0xe')]['exec'](_0xa524('0xd6'),_0x901199);if(_0x348048[_0xa524('0xae')]===-0x1){return _0x348048;}var _0xf55e9c=this[_0xa524('0xad')](_0xa524('0xbc'),_0xa524('0xd7'));if(_0xf55e9c[_0xa524('0xae')]===-0x1){return _0xf55e9c;}var _0x4d3590=this[_0xa524('0xad')](_0xa524('0xbe'),'SESTEK_ASR_TRANSCRIPT');if(_0x4d3590[_0xa524('0xae')]===-0x1){return _0x4d3590;}var _0x3d921c=this['getAndSetVariable']('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x3d921c[_0xa524('0xae')]===-0x1){return _0x3d921c;}return this[_0xa524('0xe')][_0xa524('0xb6')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x901199));};AGIVertices[_0xa524('0x10')][_0xa524('0xd8')]=function(_0x289a91){logger[_0xa524('0x31')](util['format'](_0xa524('0xd9'),_0x289a91['label']));if(!this[_0xa524('0xb0')](_0x289a91['odbc_id'])){return this[_0xa524('0xe')]['error'](_0x289a91,_0xa524('0xda'));}var _0x5a3701=this[_0xa524('0x19')][_0xa524('0x78')](this,_0x289a91[_0xa524('0xdb')]);if(!_0x5a3701){return this['channel'][_0xa524('0x2d')](_0x289a91,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x289a91[_0xa524('0x30')])){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x289a91,_0xa524('0xdc'));}var _0x4baf60=_0x289a91[_0xa524('0x30')][_0xa524('0x61')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xa524('0xb6')](util['format'](_0xa524('0xdd'),_0x4baf60));var _0xdb3bb7=this['getQueryOdbc'][_0xa524('0x78')](this,_0x5a3701,_0x4baf60);this[_0xa524('0x37')][_0xa524('0x78')](this,_0x289a91,_0x4baf60);if(!this[_0xa524('0xb0')](_0x289a91[_0xa524('0xde')])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0xdf'));}var _0x4e7d12=this[_0xa524('0xab')][_0xa524('0x78')](this,_0x289a91[_0xa524('0xde')]);if(!_0x4e7d12){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x289a91,_0xa524('0xe0'));}var _0x5263f9=this;_0xdb3bb7['forEach'](function(_0xd0c0f1,_0xcd1cf7){Object[_0xa524('0xe1')](_0xd0c0f1)['forEach'](function(_0xba1ccb){_0x5263f9['channel'][_0xa524('0xa8')](util[_0xa524('0x2a')]('%s[%s][%s]',_0x4e7d12,_0xcd1cf7,_0xba1ccb),_0xd0c0f1[_0xba1ccb]);});});this[_0xa524('0xe')][_0xa524('0xa8')](util[_0xa524('0x2a')](_0xa524('0xe2'),_0x4e7d12),_0xdb3bb7['length']);return this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0xe3'),_0x4e7d12));};AGIVertices['prototype']['dial']=function(_0x485abf){logger['debug'](util['format'](_0xa524('0xe4'),_0x485abf[_0xa524('0xb5')]));if(!this['isConfigured'](_0x485abf[_0xa524('0xe5')])){return this[_0xa524('0xe')]['error'](_0x485abf,_0xa524('0xe6'));}var _0x1ac476=this[_0xa524('0x1b')][_0xa524('0x78')](this,_0x485abf[_0xa524('0xe5')]);if(!_0x1ac476){return this['channel'][_0xa524('0x2d')](_0x485abf,_0xa524('0xe7'));}var _0x2b7dff=this[_0xa524('0xe')]['exec'](_0xa524('0xe8'),[util[_0xa524('0x2a')]('SIP/%s',_0x1ac476),_0x485abf[_0xa524('0x6d')],_0x485abf['opts'],_0x485abf['url']]);if(_0x2b7dff[_0xa524('0xae')]===-0x1){return _0x2b7dff;}return this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')]('Executed\x20command\x20%s',_0xa524('0xe8')));};AGIVertices[_0xa524('0x10')][_0xa524('0xe9')]=function(_0x5bc056){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0xea'),_0x5bc056[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0x5bc056[_0xa524('0x83')])){return this['channel'][_0xa524('0xb6')](_0xa524('0xeb'));}if(!this[_0xa524('0xb0')](_0x5bc056['text'])){return this[_0xa524('0xe')]['noop'](_0xa524('0xb7'));}this[_0xa524('0xe')]['bot']=!![];this[_0xa524('0x37')](_0x5bc056);this[_0xa524('0x41')](_0x5bc056[_0xa524('0x64')],'in','','');this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0xec'),_0x5bc056[_0xa524('0x64')]));var _0x3cb1e2=this[_0xa524('0x82')][_0xa524('0x78')](this,_0x5bc056);if(_0x3cb1e2){for(var _0x2fa3ca in _0x3cb1e2){if(_0x3cb1e2['hasOwnProperty'](_0x2fa3ca)){this[_0xa524('0xe')][_0xa524('0xa8')](util['format'](_0xa524('0xed'),_0x2fa3ca['toUpperCase']()),_0x3cb1e2[_0x2fa3ca]);}}this[_0xa524('0x41')](_0x3cb1e2[_0xa524('0xee')],_0xa524('0xef'),_0xa524('0xe9'),'');return this[_0xa524('0xe')][_0xa524('0xb6')](util['format'](_0xa524('0xf0'),_0x3cb1e2[_0xa524('0xee')]));}return this['channel'][_0xa524('0x2d')](_0x5bc056,_0xa524('0xf1'));};AGIVertices[_0xa524('0x10')]['dialogflowV2']=function(_0x27d76c){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0xf2'),_0x27d76c[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0x27d76c[_0xa524('0x86')])){return this['channel']['noop'](_0xa524('0xf3'));}if(!this[_0xa524('0xb0')](_0x27d76c[_0xa524('0x87')])){return this[_0xa524('0xe')][_0xa524('0xb6')]('no\x20client_email\x20configured');}if(!this[_0xa524('0xb0')](_0x27d76c[_0xa524('0x88')])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0xf4'));}if(!this[_0xa524('0xb0')](_0x27d76c[_0xa524('0x89')])){return this['channel'][_0xa524('0xb6')](_0xa524('0xf5'));}if(!this[_0xa524('0xb0')](_0x27d76c[_0xa524('0x64')])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0xb7'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x27d76c);this['createSquareMessage'](_0x27d76c['text'],'in','','');this['channel'][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0xf6'),_0x27d76c[_0xa524('0x64')]));var _0x49c683=this[_0xa524('0x85')][_0xa524('0x78')](this,_0x27d76c);if(_0x49c683){for(var _0x2d9c40 in _0x49c683){if(_0x49c683[_0xa524('0xa3')](_0x2d9c40)){if(_0x2d9c40!==_0xa524('0xf7')){this[_0xa524('0xe')]['setVariable'](util[_0xa524('0x2a')](_0xa524('0xed'),_0x2d9c40['toUpperCase']()),_0x49c683[_0x2d9c40]);}}}this[_0xa524('0x41')](_0x49c683[_0xa524('0xee')],_0xa524('0xef'),_0xa524('0xf8'),_0x49c683['providerResponse']);return this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')]('DialogflowV2\x20Result\x20%s',_0x49c683[_0xa524('0xee')]));}return this[_0xa524('0xe')][_0xa524('0x2d')](_0x27d76c,_0xa524('0xf9'));};AGIVertices[_0xa524('0x10')][_0xa524('0xfa')]=function(_0x287fbc){logger['info'](util['format'](_0xa524('0xfb'),_0x287fbc[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0x287fbc[_0xa524('0xfc')])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0xfd'));}if(!this[_0xa524('0xb0')](_0x287fbc[_0xa524('0xfe')])){return this['channel'][_0xa524('0xb6')](_0xa524('0xff'));}if(!this[_0xa524('0xb0')](_0x287fbc['password'])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0x100'));}if(!this[_0xa524('0xb0')](_0x287fbc['ndassistant_url'])){return this[_0xa524('0xe')]['noop'](_0xa524('0xb7'));}this[_0xa524('0xe')][_0xa524('0x101')]=!![];this[_0xa524('0x37')](_0x287fbc);this[_0xa524('0x41')](_0x287fbc[_0xa524('0x64')],'in','','');this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x102'),_0x287fbc['text']));var _0x727daa=this[_0xa524('0x8a')]['sync'](this,_0x287fbc);if(_0x727daa){for(var _0xa8eb4d in _0x727daa){if(_0x727daa[_0xa524('0xa3')](_0xa8eb4d)){this[_0xa524('0xe')][_0xa524('0xa8')](util[_0xa524('0x2a')](_0xa524('0x103'),_0xa8eb4d[_0xa524('0x73')]()),_0x727daa[_0xa8eb4d]);}}this['createSquareMessage'](_0x727daa[_0xa524('0xee')],_0xa524('0xef'),_0xa524('0xfa'),'');if(_0x727daa[_0xa524('0x104')]){this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x105'),_0x727daa[_0xa524('0x104')]));var _0x106462=this[_0xa524('0xe')][_0xa524('0x106')](_0x727daa[_0xa524('0x104')]);try{fs[_0xa524('0x107')](_0x727daa['audiofile']+_0xa524('0x108'));}catch(_0x2bbd9c){logger[_0xa524('0x2d')](_0x2bbd9c);}return _0x106462;}else{return this[_0xa524('0xe')][_0xa524('0xb6')](util['format'](_0xa524('0x109'),_0x727daa[_0xa524('0xee')]));}}return this[_0xa524('0xe')][_0xa524('0x2d')](_0x287fbc,_0xa524('0x10a'));};AGIVertices[_0xa524('0x10')][_0xa524('0x10b')]=function(_0x1567c2){logger[_0xa524('0x31')](util[_0xa524('0x2a')]('Enter\x20in\x20END\x20(%s)\x20block',_0x1567c2['label']));return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0x10b'));};AGIVertices[_0xa524('0x10')][_0xa524('0x10c')]=function(_0x6d6182){logger[_0xa524('0x31')](util[_0xa524('0x2a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x6d6182['label']));var _0x3caa83='';if(_0x6d6182[_0xa524('0x10d')]){if(!this['isConfigured'](_0x6d6182[_0xa524('0x10d')])){return this['channel']['error'](_0x6d6182,_0xa524('0x10e'));}else{var _0x3f587e=parseInt(_0x6d6182['trunk_id'],0xa);if(isNaN(_0x3f587e)){_0x3caa83=_0x6d6182[_0xa524('0x10d')];}else{_0x3caa83=this[_0xa524('0x1d')][_0xa524('0x78')](this,_0x6d6182['trunk_id']);if(!_0x3caa83){return this['channel'][_0xa524('0x2d')](_0x6d6182,_0xa524('0x10f'));}}}}else if(_0x6d6182[_0xa524('0x110')]){_0x3caa83=_0x6d6182[_0xa524('0x110')];}else{return this[_0xa524('0xe')][_0xa524('0x2d')](_0x6d6182,_0xa524('0x10e'));}var _0x85ae93=this[_0xa524('0xe')][_0xa524('0x60')](_0xa524('0xe8'),[util['format'](_0xa524('0x111'),_0x3caa83,_0x6d6182[_0xa524('0x48')]),_0x6d6182[_0xa524('0x6d')],_0x6d6182[_0xa524('0x112')],_0x6d6182[_0xa524('0x6c')]]);if(_0x85ae93[_0xa524('0xae')]===-0x1){return _0x85ae93;}return this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')]('Executed\x20command\x20%s',_0xa524('0xe8')));};AGIVertices[_0xa524('0x10')][_0xa524('0x113')]=function(_0x43e47f){logger['info'](util[_0xa524('0x2a')](_0xa524('0x114'),_0x43e47f[_0xa524('0xb5')]));return this['channel'][_0xa524('0xb6')](_0xa524('0x113'));};AGIVertices[_0xa524('0x10')][_0xa524('0x115')]=function(_0x231718){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x116'),_0x231718['label']));if(_0x231718['retry']===0x0){return this['maxRetry'](_0x231718);}_0x231718[_0xa524('0xb2')]-=0x1;if(!this['isConfigured'](_0x231718[_0xa524('0x117')])){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x231718,'no\x20file\x20audio\x20selected');}var _0xc81e4f=this[_0xa524('0x1f')][_0xa524('0x78')](this,_0x231718['file_id']);if(!_0xc81e4f){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x231718,_0xa524('0x118'));}if(!this[_0xa524('0xb0')](_0x231718[_0xa524('0xde')])){return this['channel'][_0xa524('0x2d')](_0xa524('0xdf'));}var _0x890109=this[_0xa524('0xe')][_0xa524('0x119')](_0xc81e4f,_0x231718[_0xa524('0x11a')],_0x231718[_0xa524('0x11b')]);var _0x218806=_0x890109['result']?_0x890109[_0xa524('0xae')][_0xa524('0x4d')]():'';logger[_0xa524('0x31')](_0xa524('0x11c'),JSON[_0xa524('0x7b')](_0x890109));if(_0x890109[_0xa524('0xae')]===-0x1){this['createSquareDetailsReport'][_0xa524('0x78')](this,_0x231718,_0x218806);return _0x890109;}else if(_0x890109[_0xa524('0xac')]===_0xa524('0x6d')){_0x890109[_0xa524('0xae')]=_0x218806['length']>=parseInt(_0x231718[_0xa524('0x11d')])?'x':'i';}else{_0x890109[_0xa524('0xae')]=_0x218806[_0xa524('0xa5')]>=parseInt(_0x231718['mindigit'])&&_0x218806[_0xa524('0xa5')]<=parseInt(_0x231718[_0xa524('0x11b')])?'x':'i';}var _0x2777b3=this[_0xa524('0xab')][_0xa524('0x78')](this,_0x231718['variable_id']);if(!_0x2777b3){return this['channel'][_0xa524('0x2d')](_0x231718,_0xa524('0xe0'));}this[_0xa524('0xe')]['setVariable'](_0x2777b3,_0x218806);if(this[_0xa524('0xb0')](_0x231718[_0xa524('0x11e')])){var _0x4999b1=parseInt(_0x231718[_0xa524('0x11e')],0xa);var _0x283312=rs[_0xa524('0x11f')]({'charset':'*','length':_0x4999b1});var _0x44fcc1=_0x218806[_0xa524('0xa5')];if(_0x44fcc1>0x0){if(_0x44fcc1>_0x4999b1){this[_0xa524('0x37')][_0xa524('0x78')](this,_0x231718,_0x231718[_0xa524('0x120')]==='first'?_0x283312+_0x218806[_0xa524('0x121')](_0x4999b1):_0x218806[_0xa524('0x121')](0x0,_0x44fcc1-_0x4999b1)+_0x283312);}else{this[_0xa524('0x37')][_0xa524('0x78')](this,_0x231718,rs['generate']({'charset':'*','length':_0x44fcc1}));}}else{this[_0xa524('0x37')][_0xa524('0x78')](this,_0x231718,'');}}else{this[_0xa524('0x37')][_0xa524('0x78')](this,_0x231718,_0x218806);}return _0x890109;};AGIVertices[_0xa524('0x10')]['getsecretdigits']=function(_0xad6fe7){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x122'),_0xad6fe7[_0xa524('0xb5')]));return this[_0xa524('0x115')](_0xad6fe7);};AGIVertices[_0xa524('0x10')]['goal']=function(_0x7777ad){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x123'),_0x7777ad[_0xa524('0xb5')]));this[_0xa524('0x37')][_0xa524('0x78')](this,_0x7777ad,_0x7777ad[_0xa524('0x124')]);return this[_0xa524('0xe')]['noop'](util[_0xa524('0x2a')](_0xa524('0x125'),_0x7777ad['goalname']));};AGIVertices[_0xa524('0x10')][_0xa524('0x126')]=function(_0x3ba804){logger[_0xa524('0x31')](util['format'](_0xa524('0x127'),_0x3ba804['label']));if(!this[_0xa524('0xb0')](_0x3ba804[_0xa524('0x91')])||!this[_0xa524('0xb0')](_0x3ba804['aws_secret_access_key'])){return this['channel'][_0xa524('0xb6')](_0xa524('0x128'));}if(!this['isConfigured'](_0x3ba804['text'])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0xb7'));}this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')]('Trying\x20aws\x20Polly\x20%s',_0x3ba804[_0xa524('0x64')]));var _0x47442e=this['awsPolly'][_0xa524('0x78')](this,_0x3ba804);if(_0x47442e){this[_0xa524('0xe')]['noop'](util[_0xa524('0x2a')](_0xa524('0x129'),_0x47442e));var _0x18891c=this['channel'][_0xa524('0x106')](_0x47442e);try{fs[_0xa524('0x107')](_0x47442e+_0xa524('0x108'));}catch(_0x13681e){logger['error'](_0x13681e);}return _0x18891c;}return this['channel'][_0xa524('0x2d')](_0x3ba804,_0xa524('0x12a'));};AGIVertices[_0xa524('0x10')][_0xa524('0x12b')]=function(_0xb984b){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x12c'),_0xb984b['label']));if(!this[_0xa524('0xb0')](_0xb984b[_0xa524('0x91')])||!this['isConfigured'](_0xb984b[_0xa524('0x92')])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0x128'));}if(!this[_0xa524('0xb0')](_0xb984b[_0xa524('0x97')])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0x12d'));}if(!this[_0xa524('0xb0')](_0xb984b['text'])){return this['channel'][_0xa524('0xb6')]('no\x20text\x20configured');}this[_0xa524('0xe')]['bot']=!![];this[_0xa524('0x37')](_0xb984b);this[_0xa524('0x41')](_0xb984b['text'],'in','','');this[_0xa524('0xe')]['noop'](util[_0xa524('0x2a')](_0xa524('0x12e'),_0xb984b[_0xa524('0x64')]));var _0x2fe369=this[_0xa524('0x96')]['sync'](this,_0xb984b);if(_0x2fe369){for(var _0x3b0f6b in _0x2fe369){if(_0x2fe369[_0xa524('0xa3')](_0x3b0f6b)&&_['isString'](_0x2fe369[_0x3b0f6b])){this[_0xa524('0xe')][_0xa524('0xa8')](util[_0xa524('0x2a')](_0xa524('0x12f'),_0x3b0f6b[_0xa524('0x73')]()),_0x2fe369[_0x3b0f6b]);}}if(_[_0xa524('0x43')](_0x2fe369[_0xa524('0x7f')])){return this[_0xa524('0xe')][_0xa524('0xb6')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xa524('0x41')](_0x2fe369[_0xa524('0x7f')],'out',_0xa524('0x130'),'');return this[_0xa524('0xe')][_0xa524('0xb6')](util['format'](_0xa524('0x131'),_0x2fe369['message']));}}return this['channel'][_0xa524('0x2d')](_0xb984b,_0xa524('0x132'));};AGIVertices[_0xa524('0x10')]['googleasr']=function(_0xf6e89b){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x133'),_0xf6e89b['label'],_0xf6e89b[_0xa524('0x6d')]));if(!this[_0xa524('0xb0')](_0xf6e89b[_0xa524('0x83')])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0xeb'));}var _0x557284=_0xa524('0x134');var _0x5180f9=util[_0xa524('0x2a')](_0xa524('0x135'),FILES_PATH,rs[_0xa524('0x11f')](0x4));var _0xa7f2e2=util['format'](_0xa524('0xa7'),_0x5180f9,_0x557284);var _0x43aa8f=!![];if(_0xf6e89b[_0xa524('0x136')]===_0xa524('0x137')){_0x43aa8f=![];}var _0x1cd5d2=this[_0xa524('0xe')][_0xa524('0x138')](_0x5180f9,_0x557284,_0xf6e89b[_0xa524('0x139')],_0xf6e89b['timeout'],undefined,_0x43aa8f);if(_0x1cd5d2[_0xa524('0xae')]!==-0x1){this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x13a'),_0xa7f2e2));var _0x57ac7=this[_0xa524('0x98')][_0xa524('0x78')](this,_0xf6e89b,_0xa7f2e2);if(_0x57ac7){for(var _0x215591 in _0x57ac7){if(_0x57ac7[_0xa524('0xa3')](_0x215591)){this['channel'][_0xa524('0xa8')](util[_0xa524('0x2a')](_0xa524('0x13b'),_0x215591[_0xa524('0x73')]()),_0x57ac7[_0x215591]);}}return this[_0xa524('0xe')]['noop'](util['format']('GoogleASR\x20Result\x20%s',JSON[_0xa524('0x7b')](_0x57ac7)));}}return _0x1cd5d2;};AGIVertices[_0xa524('0x10')]['tildeasr']=function(_0xc299aa){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x13c'),_0xc299aa[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0xc299aa['appid'])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0x13d'));}if(!this['isConfigured'](_0xc299aa['appsecret'])){return this['channel'][_0xa524('0xb6')](_0xa524('0x13e'));}var _0x2af1f8=_0xa524('0x134');var _0x31fcc1=util[_0xa524('0x2a')](_0xa524('0x135'),FILES_PATH,rs['generate'](0x4));var _0x40bdc5=util[_0xa524('0x2a')](_0xa524('0xa7'),_0x31fcc1,_0x2af1f8);var _0x401054=!![];if(_0xc299aa[_0xa524('0x136')]===_0xa524('0x137')){_0x401054=![];}var _0xb4d748=this[_0xa524('0xe')]['recordFile'](_0x31fcc1,_0x2af1f8,_0xc299aa[_0xa524('0x139')],_0xc299aa['timeout'],undefined,_0x401054);if(_0xb4d748['result']!==-0x1){this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x13f'),_0x40bdc5));var _0x42bcf6=this[_0xa524('0x99')][_0xa524('0x78')](this,_0xc299aa,_0x40bdc5);if(_0x42bcf6){for(var _0x3f5fc6 in _0x42bcf6){if(_0x42bcf6[_0xa524('0xa3')](_0x3f5fc6)){this[_0xa524('0xe')]['setVariable'](util[_0xa524('0x2a')](_0xa524('0x140'),_0x3f5fc6[_0xa524('0x73')]()),_0x42bcf6[_0x3f5fc6]);}}return this[_0xa524('0xe')]['noop'](util[_0xa524('0x2a')]('TildeASR\x20Result\x20%s',JSON[_0xa524('0x7b')](_0x42bcf6)));}}return _0xb4d748;};AGIVertices[_0xa524('0x10')][_0xa524('0x141')]=function(_0x1ff5ed){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x142'),_0x1ff5ed[_0xa524('0xb5')]));return this['channel'][_0xa524('0x143')](_0x1ff5ed['context'],_0x1ff5ed[_0xa524('0x3e')],_0x1ff5ed[_0xa524('0x144')]);};AGIVertices['prototype'][_0xa524('0x145')]=function(_0x4db2ec){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x146'),_0x4db2ec[_0xa524('0xb5')]));if(!this['isConfigured'](_0x4db2ec['condition'])){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x4db2ec,'no\x20condition\x20configured');}try{var _0x47ded1=eval(_0x4db2ec['condition'])?_0xa524('0x147'):_0xa524('0x148');this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x149'),_0x4db2ec['condition'],_0x47ded1));return{'code':0xc8,'result':_0x47ded1};}catch(_0x35828a){return{'code':0xc8,'result':_0xa524('0x148')};}};AGIVertices[_0xa524('0x10')][_0xa524('0x14a')]=function(_0x4024b8){logger['info'](util['format'](_0xa524('0x14b'),_0x4024b8[_0xa524('0xb5')]));if(!this['isConfigured'](_0x4024b8[_0xa524('0x14c')])){return this['channel']['error'](_0x4024b8,_0xa524('0x14d'));}var _0x3b30ed=this['getIntervals']['sync'](this,_0x4024b8[_0xa524('0x14c')]);if(!_0x3b30ed){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x4024b8,'no\x20intervals\x20found');}for(var _0x35284c=0x0;_0x35284c<_0x3b30ed[_0xa524('0xa5')];_0x35284c+=0x1){var _0x1696c9=this[_0xa524('0xe')][_0xa524('0xab')](util[_0xa524('0x2a')](_0xa524('0x14e'),_0x3b30ed[_0x35284c]));if(_0x1696c9[_0xa524('0xae')]===-0x1){return _0x1696c9;}logger['info'](util[_0xa524('0x2a')]('IFTIME\x20%s\x20%s',_0x3b30ed[_0x35284c],_0x1696c9['extra']));if(_0x1696c9['extra']===_0xa524('0x147')){logger['info'](util['format'](_0xa524('0x14f'),_0x3b30ed[_0x35284c],_0xa524('0x147')));this['channel'][_0xa524('0xb6')](util['format'](_0xa524('0x14f'),_0x3b30ed[_0x35284c],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x14f'),_0x3b30ed[_0x35284c],'false'));this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x14f'),_0x3b30ed[_0x35284c],'false'));}}return{'code':0xc8,'result':_0xa524('0x148')};};AGIVertices[_0xa524('0x10')][_0xa524('0x150')]=function(_0x58ff03){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x151'),_0x58ff03[_0xa524('0xb5')]));return this['channel'][_0xa524('0x150')]();};AGIVertices[_0xa524('0x10')][_0xa524('0x152')]=function(_0x4b11ab){logger['info'](util[_0xa524('0x2a')](_0xa524('0x153'),_0x4b11ab[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0x4b11ab[_0xa524('0x83')])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0xeb'));}var _0x2d6ad3=_0xa524('0x134');var _0x417905=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xa524('0x11f')](0x4));var _0x227d35=util['format']('%s.%s',_0x417905,_0x2d6ad3);var _0x318f7c=!![];if(_0x4b11ab['beep']===_0xa524('0x137')){_0x318f7c=![];}var _0x122475=this['channel'][_0xa524('0x138')](_0x417905,_0x2d6ad3,_0x4b11ab[_0xa524('0x139')],_0x4b11ab['timeout'],undefined,_0x318f7c);if(_0x122475[_0xa524('0xae')]!==-0x1){this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')]('ispeech\x20%s\x20file\x20created',_0x227d35));var _0x1f3e25=this[_0xa524('0x8d')][_0xa524('0x78')](this,_0x4b11ab,_0x227d35);if(_0x1f3e25){for(var _0x579d4f in _0x1f3e25){if(_0x1f3e25['hasOwnProperty'](_0x579d4f)){this[_0xa524('0xe')][_0xa524('0xa8')](util[_0xa524('0x2a')]('ISPEECH_ASR_%s',_0x579d4f[_0xa524('0x73')]()),_0x1f3e25[_0x579d4f]);}}return this[_0xa524('0xe')]['noop'](util['format'](_0xa524('0x154'),JSON[_0xa524('0x7b')](_0x1f3e25)));}}return _0x122475;};AGIVertices[_0xa524('0x10')][_0xa524('0x155')]=function(_0x5021f0){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x156'),_0x5021f0[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0x5021f0[_0xa524('0x83')])){return this[_0xa524('0xe')]['noop'](_0xa524('0xeb'));}if(!this[_0xa524('0xb0')](_0x5021f0[_0xa524('0x64')])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0xb7'));}this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x157'),_0x5021f0[_0xa524('0x64')]));var _0x231ff9=this[_0xa524('0x8b')]['sync'](this,_0x5021f0);if(_0x231ff9){this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x158'),_0x231ff9));var _0x259764=this['channel'][_0xa524('0x106')](_0x231ff9,_0x5021f0[_0xa524('0x139')]);try{fs['unlink'](_0x231ff9+_0xa524('0x108'));}catch(_0x30ef44){logger['error'](_0x30ef44);}return _0x259764;}return this[_0xa524('0xe')][_0xa524('0x2d')](_0x5021f0,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xa524('0x10')][_0xa524('0x159')]=function(_0x27c6f0){logger[_0xa524('0x31')](util['format'](_0xa524('0x15a'),_0x27c6f0['label']));if(!this['isConfigured'](_0x27c6f0['findBy'])){return this['channel']['error'](_0x27c6f0,_0xa524('0x15b'));}logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x15c'),this[_0xa524('0xe')][_0xa524('0x39')],_0x27c6f0[_0xa524('0x15d')]));var _0x1a9fb4=this[_0xa524('0x5b')]['sync'](this,_0x27c6f0[_0xa524('0x15d')]);if(_0x1a9fb4){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x15e'),this[_0xa524('0xe')]['callerid'],_0x27c6f0['findBy']));this['channel'][_0xa524('0xb6')](util['format'](_0xa524('0x15e'),this[_0xa524('0xe')][_0xa524('0x39')],_0x27c6f0[_0xa524('0x15d')]));return{'code':0xc8,'result':_0xa524('0x15f')};}else{logger[_0xa524('0x31')](util['format'](_0xa524('0x160'),this[_0xa524('0xe')][_0xa524('0x39')],_0x27c6f0[_0xa524('0x15d')]));this[_0xa524('0xe')]['noop'](util['format'](_0xa524('0x160'),this[_0xa524('0xe')]['callerid'],_0x27c6f0[_0xa524('0x15d')]));return{'code':0xc8,'result':_0xa524('0x161')};}};AGIVertices[_0xa524('0x10')][_0xa524('0x162')]=function(_0x5638f4){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x163'),_0x5638f4['label']));if(!this['isConfigured'](_0x5638f4[_0xa524('0x15d')])){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x5638f4,_0xa524('0x15b'));}logger[_0xa524('0x31')](util[_0xa524('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa524('0xe')][_0xa524('0x39')],_0x5638f4['findBy']));var _0x36afcf=this['agentLogout']['sync'](this,_0x5638f4[_0xa524('0x15d')]);if(_0x36afcf){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x15e'),this[_0xa524('0xe')][_0xa524('0x39')],_0x5638f4[_0xa524('0x15d')]));this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x15e'),this['channel'][_0xa524('0x39')],_0x5638f4[_0xa524('0x15d')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x160'),this[_0xa524('0xe')][_0xa524('0x39')],_0x5638f4[_0xa524('0x15d')]));this[_0xa524('0xe')][_0xa524('0xb6')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa524('0xe')][_0xa524('0x39')],_0x5638f4[_0xa524('0x15d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa524('0x10')][_0xa524('0x164')]=function(_0xa25a80){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x165'),_0xa25a80[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0xa25a80[_0xa524('0x166')])){return this[_0xa524('0xe')][_0xa524('0x2d')](_0xa25a80,_0xa524('0x167'));}this['channel'][_0xa524('0xb6')](util['format']('math\x20%s',_0xa25a80[_0xa524('0x166')]));var _0x348a75=eval(_0xa25a80[_0xa524('0x166')]);if(!this[_0xa524('0xb0')](_0xa25a80[_0xa524('0xde')])){return this[_0xa524('0xe')]['noop'](_0xa524('0xdf'));}var _0x48df88=this['getVariable'][_0xa524('0x78')](this,_0xa25a80[_0xa524('0xde')]);if(!_0x48df88){return this[_0xa524('0xe')][_0xa524('0x2d')](_0xa25a80,_0xa524('0xe0'));}if(_[_0xa524('0xa4')](_0x348a75)){var _0x882a63=this;_0x348a75[_0xa524('0x168')](function(_0x50975a,_0x1fb1ec){_0x882a63[_0xa524('0xe')]['setVariable'](util['format'](_0xa524('0x169'),_0x48df88,_0x1fb1ec),_0x50975a);});return this['channel']['noop'](util['format']('variable\x20%s[key]\x20set',_0x48df88));}else{return this[_0xa524('0xe')][_0xa524('0xa8')](_0x48df88,_0x348a75);}};AGIVertices[_0xa524('0x10')][_0xa524('0xc')]=function(_0xb6609c){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x16a'),_0xb6609c[_0xa524('0xb5')]));if(_0xb6609c['retry']===0x0){return this[_0xa524('0xb1')](_0xb6609c);}_0xb6609c[_0xa524('0xb2')]-=0x1;if(!this[_0xa524('0xb0')](_0xb6609c['file_id'])){return this[_0xa524('0xe')][_0xa524('0x2d')](_0xb6609c,_0xa524('0x16b'));}var _0x1318b9=this[_0xa524('0x1f')][_0xa524('0x78')](this,_0xb6609c[_0xa524('0x117')]);if(!_0x1318b9){return this['channel']['error'](_0xb6609c,_0xa524('0x118'));}var _0x124605=this['channel'][_0xa524('0x119')](_0x1318b9,_0xb6609c[_0xa524('0x11a')],_0xb6609c['digit']);var _0x4f9617=_0x124605['result'];if(_0x124605[_0xa524('0xae')]===-0x1){this[_0xa524('0x37')]['sync'](this,_0xb6609c,'-1');return _0x124605;}else if(_0x124605[_0xa524('0xac')]==='timeout'){_0x124605['result']=_0x124605['result'][_0xa524('0xa5')]>0x0?_0x124605['result']:'t';}else if(_[_0xa524('0x46')](_0x124605[_0xa524('0xae')])){_0x124605[_0xa524('0xae')]='#';_0x4f9617='#';}if(!this['isConfigured'](_0xb6609c[_0xa524('0xde')])){this[_0xa524('0xe')]['noop'](_0xa524('0xdf'));}else{var _0x46ec3d=this['getVariable']['sync'](this,_0xb6609c[_0xa524('0xde')]);if(!_0x46ec3d){return this[_0xa524('0xe')][_0xa524('0x2d')](_0xb6609c,'no\x20variable\x20found');}this[_0xa524('0xe')][_0xa524('0xa8')](_0x46ec3d,_0x4f9617);}this[_0xa524('0x37')][_0xa524('0x78')](this,_0xb6609c,_0x4f9617);return _0x124605;};AGIVertices[_0xa524('0x10')][_0xa524('0xb6')]=function(_0x2f9d88){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x16c'),_0x2f9d88[_0xa524('0xb5')]));return this[_0xa524('0xe')]['noop'](_0x2f9d88[_0xa524('0x16d')]||_0x2f9d88[_0xa524('0xb5')]);};AGIVertices[_0xa524('0x10')][_0xa524('0x16e')]=function(_0x372ebe){logger[_0xa524('0x31')](util['format'](_0xa524('0x16f'),_0x372ebe['label']));if(!this['isConfigured'](_0x372ebe['findBy'])){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x372ebe,_0xa524('0x15b'));}logger[_0xa524('0x31')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa524('0xe')][_0xa524('0x39')],_0x372ebe[_0xa524('0x15d')]));var _0x5c3a33=this[_0xa524('0x170')]['sync'](this,_0x372ebe['pause_id']);var _0x461b46=this['agentPause'][_0xa524('0x78')](this,_0x372ebe[_0xa524('0x15d')],_0x5c3a33);if(_0x461b46){logger[_0xa524('0x31')](util['format'](_0xa524('0x15e'),this[_0xa524('0xe')][_0xa524('0x39')],_0x372ebe[_0xa524('0x15d')]));this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x15e'),this['channel']['callerid'],_0x372ebe['findBy']));return{'code':0xc8,'result':_0xa524('0x15f')};}else{logger[_0xa524('0x31')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa524('0xe')][_0xa524('0x39')],_0x372ebe[_0xa524('0x15d')]));this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x15e'),this['channel']['callerid'],_0x372ebe[_0xa524('0x15d')]));return{'code':0xc8,'result':_0xa524('0x161')};}};AGIVertices[_0xa524('0x10')][_0xa524('0x171')]=function(_0x4a12e7){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x172'),_0x4a12e7['label']));if(!this[_0xa524('0xb0')](_0x4a12e7[_0xa524('0x117')])){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x4a12e7,_0xa524('0x16b'));}var _0x1507d0=this[_0xa524('0x1f')][_0xa524('0x78')](this,_0x4a12e7[_0xa524('0x117')]);if(!_0x1507d0){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x4a12e7,_0xa524('0x118'));}var _0x3b90b0=this[_0xa524('0xe')][_0xa524('0x60')](_0xa524('0x173'),[_0x1507d0,_0x4a12e7[_0xa524('0x112')]]);if(_0x3b90b0[_0xa524('0xae')]===-0x1){return _0x3b90b0;}return this['channel'][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0xcd'),'PLAYBACK',_0x1507d0));};AGIVertices[_0xa524('0x10')][_0xa524('0x174')]=function(_0x4ece19){logger[_0xa524('0x31')](util[_0xa524('0x2a')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x4ece19['label']));if(!this['isConfigured'](_0x4ece19[_0xa524('0x175')])){return this[_0xa524('0xe')]['error'](_0x4ece19,'no\x20queue\x20selected');}var _0x390728='';var _0x1f4a6c=parseInt(_0x4ece19[_0xa524('0x175')],0xa);if(isNaN(_0x1f4a6c)){_0x390728=_0x4ece19[_0xa524('0x175')];}else{_0x390728=this[_0xa524('0x14')][_0xa524('0x78')](this,_0x4ece19['queue_id']);if(!_0x390728){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x4ece19,_0xa524('0x176'));}}var _0x23888b='';if(this['isConfigured'](_0x4ece19['file_id'])){var _0x30a523=this['getSound'][_0xa524('0x78')](this,_0x4ece19[_0xa524('0x117')]);if(_0x30a523){_0x23888b=_0x30a523;}}this[_0xa524('0x37')][_0xa524('0x78')](this,_0x4ece19,_0x390728);if(_0x4ece19['opts'][_0xa524('0x177')]('x')<0x0){_0x4ece19[_0xa524('0x112')]+='x';}if(_0x4ece19[_0xa524('0x112')]['indexOf']('X')<0x0){_0x4ece19[_0xa524('0x112')]+='X';}this[_0xa524('0xe')][_0xa524('0xa8')](_0xa524('0x178'),_0x390728?_0x390728['toLowerCase']():'');var _0x23324e=this[_0xa524('0xe')]['exec']('QUEUE',[_0x390728,_0x4ece19[_0xa524('0x112')],_0x4ece19[_0xa524('0x6c')],_0x23888b,_0x4ece19[_0xa524('0x6d')],_0x4ece19[_0xa524('0x7')],_0x4ece19[_0xa524('0x179')],_0x4ece19[_0xa524('0x17a')],'',_0x4ece19[_0xa524('0x17b')]]);if(_0x23324e[_0xa524('0xae')]===-0x1){return _0x23324e;}return this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0xcd'),_0xa524('0x17c'),_0x390728));};AGIVertices[_0xa524('0x10')]['record']=function(_0x5276aa){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x17d'),_0x5276aa[_0xa524('0xb5')]));var _0x4111d3=_0x5276aa[_0xa524('0x17e')]||_0xa524('0x134');var _0x56e13b=util[_0xa524('0x2a')](_0xa524('0x17f'),this[_0xa524('0xe')][_0xa524('0x3b')],rs['generate'](0x5));var _0x509946=util['format'](_0xa524('0x180'),FILES_PATH,_0x56e13b,_0x4111d3);var _0x48f01c=util['format']('%s/recordings/%s',FILES_PATH,_0x56e13b);this['createSquareRecording'][_0xa524('0x78')](this,_0x5276aa,_0x56e13b,_0x509946);this['channel'][_0xa524('0xa8')]('RECORDING_SAVENAME',_0x56e13b);logger[_0xa524('0x31')](_0xa524('0x181'),_0x48f01c,_0x4111d3,_0x5276aa[_0xa524('0x182')],_0x5276aa[_0xa524('0x6d')]);return this[_0xa524('0xe')][_0xa524('0x138')](_0x48f01c,_0x4111d3,_0x5276aa[_0xa524('0x182')],_0x5276aa['timeout'],undefined,!![]);};AGIVertices['prototype'][_0xa524('0x183')]=function(_0x42d05a){logger['info'](util[_0xa524('0x2a')](_0xa524('0x184'),_0x42d05a[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0x42d05a[_0xa524('0x6c')])){return this['channel']['noop']('no\x20url\x20configured');}var _0x389fcf=this[_0xa524('0x6b')][_0xa524('0x78')](this,_0x42d05a);logger[_0xa524('0x31')](util[_0xa524('0x2a')]('Response:',util[_0xa524('0x185')](_0x389fcf,{'showHidden':![],'depth':null})));if(!this[_0xa524('0xb0')](_0x42d05a['variable_id'])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0x186'));}var _0x1d0f1a=this[_0xa524('0xab')][_0xa524('0x78')](this,_0x42d05a['variable_id']);if(!_0x1d0f1a){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x42d05a,_0xa524('0xe0'));}this[_0xa524('0xe')][_0xa524('0xa8')](util[_0xa524('0x2a')]('%s_STATUS_CODE',_0x1d0f1a),_0x389fcf[_0xa524('0x187')]?_0x389fcf['statusCode']:'200');this[_0xa524('0xe')]['setVariable'](util[_0xa524('0x2a')](_0xa524('0x188'),_0x1d0f1a),_0x389fcf[_0xa524('0x7e')]?_0x389fcf[_0xa524('0x7e')]:'OK');if(_0x389fcf[_0xa524('0x7c')]){try{this['saveRestApiResult'](_0x389fcf[_0xa524('0x7c')],_0x1d0f1a);}catch(_0x4d5183){logger['error'](util[_0xa524('0x2a')](_0xa524('0x189'),_0x1d0f1a));}}return this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')]('variable\x20%s\x20set',_0x1d0f1a));};AGIVertices['prototype'][_0xa524('0x18a')]=function(_0x43c8f9){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x18b'),_0x43c8f9[_0xa524('0xb5')]));return this[_0xa524('0xe')]['sayDigits'](_0x43c8f9[_0xa524('0x18c')][_0xa524('0x61')](/\s+/g,''),_0x43c8f9[_0xa524('0x182')]);};AGIVertices['prototype']['saynumber']=function(_0x15145b){logger[_0xa524('0x31')](util['format'](_0xa524('0x18d'),_0x15145b[_0xa524('0xb5')]));return this[_0xa524('0xe')][_0xa524('0x18e')](_0x15145b[_0xa524('0x6e')][_0xa524('0x61')](/\s+/g,''),_0x15145b[_0xa524('0x182')]);};AGIVertices[_0xa524('0x10')][_0xa524('0x18f')]=function(_0x30cda9){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x190'),_0x30cda9['label']));return this[_0xa524('0xe')][_0xa524('0x191')](_0x30cda9[_0xa524('0x64')],_0x30cda9['escape_digits']);};AGIVertices['prototype'][_0xa524('0x192')]=function(_0xbef4ea){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x193'),_0xbef4ea[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0xbef4ea[_0xa524('0x194')])){return this[_0xa524('0xe')]['noop'](_0xa524('0x195'));}var _0x43b930=this[_0xa524('0x22')]['sync'](this,_0xbef4ea[_0xa524('0x194')]);if(!_0x43b930||!_0x43b930['Smtp']){return this[_0xa524('0xe')][_0xa524('0x2d')](_0xbef4ea,_0xa524('0x196'));}var _0x380cc3={'from':util[_0xa524('0x2a')]('\x22%s\x22\x20<%s>',_0x43b930[_0xa524('0x13')],_0x43b930[_0xa524('0x197')]||_0x43b930[_0xa524('0x198')][_0xa524('0x199')]),'to':_0xbef4ea['to']||'','cc':_0xbef4ea['cc']||'','bcc':_0xbef4ea[_0xa524('0x19a')]||'','subject':_0xbef4ea[_0xa524('0x19b')],'html':_0xbef4ea[_0xa524('0x64')],'text':_0xbef4ea[_0xa524('0x64')]};var _0x255db2={'tls':{'rejectUnauthorized':![]}};if(_0x43b930[_0xa524('0x198')]['service']){_0x255db2[_0xa524('0x19c')]=_0x43b930[_0xa524('0x198')]['service'];}else{_0x255db2[_0xa524('0x19d')]=_0x43b930['Smtp'][_0xa524('0x19d')];_0x255db2[_0xa524('0x19e')]=_0x43b930[_0xa524('0x198')][_0xa524('0x19e')];_0x255db2['secure']=_0x43b930['Smtp'][_0xa524('0x19f')];}if(_0x43b930[_0xa524('0x198')][_0xa524('0x1a0')]){_0x255db2[_0xa524('0x1a1')]={'user':_0x43b930[_0xa524('0x198')]['user'],'pass':_0x43b930[_0xa524('0x198')][_0xa524('0x1a2')]};}if(this['isConfigured'](_0xbef4ea[_0xa524('0x1a3')])){}logger[_0xa524('0x1a4')](_0xa524('0x1a5'),JSON[_0xa524('0x7b')](_0x380cc3));this[_0xa524('0x37')]['sync'](this,_0xbef4ea,_0xbef4ea['account_id']);this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x1a6'),_0x43b930['name']));this[_0xa524('0x24')]['sync'](this,_0x255db2,_0x380cc3);return this['channel'][_0xa524('0xb6')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa524('0x10')][_0xa524('0x1a7')]=function(_0x3088b7){logger['info'](util[_0xa524('0x2a')](_0xa524('0x1a8'),_0x3088b7[_0xa524('0xb5')]));return this[_0xa524('0xe')]['noop'](_0xa524('0x1a9'));};AGIVertices[_0xa524('0x10')][_0xa524('0x1aa')]=function(_0x46d732){logger[_0xa524('0x31')](util['format'](_0xa524('0x1ab'),_0x46d732[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0x46d732[_0xa524('0x1ac')])){return this['channel'][_0xa524('0xb6')](_0xa524('0x1ad'));}var _0x4d350b=this[_0xa524('0x34')][_0xa524('0x78')](this,_0x46d732[_0xa524('0x1ac')]);if(!_0x4d350b){return this['channel']['error'](_0x46d732,_0xa524('0x1ae'));}var _0x3382b3={'body':_0x46d732[_0xa524('0x1af')],'phone':_0x46d732['to']||'','SmsAccountId':_0x4d350b['id']};logger[_0xa524('0x1a4')]('sendSMS\x20message',JSON['stringify'](_0x3382b3));this[_0xa524('0x37')][_0xa524('0x78')](this,_0x46d732,_0x46d732['sms_account_id']);this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x1b0'),_0x4d350b['name']));this['createSmsMessage'][_0xa524('0x78')](this,_0x3382b3);return this['channel'][_0xa524('0xb6')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa524('0x10')]['set']=function(_0x2e023b){logger[_0xa524('0x31')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x2e023b[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0x2e023b['variable_id'])){return this[_0xa524('0xe')]['error'](_0x2e023b,_0xa524('0x1b1'));}var _0x2929b5=this[_0xa524('0xab')][_0xa524('0x78')](this,_0x2e023b[_0xa524('0xde')]);if(!_0x2929b5){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x2e023b,_0xa524('0xe0'));}return this[_0xa524('0xe')][_0xa524('0xa8')](_0x2929b5,_0x2e023b[_0xa524('0x1b2')]);};AGIVertices[_0xa524('0x10')]['start']=function(_0x243420){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x1b3'),_0x243420[_0xa524('0xb5')]));this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0x1b4'));if(_0x243420['answer']===_0xa524('0x1b5')){this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0x1b6'));return this[_0xa524('0xe')]['answer']();}return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0x1b7'));};AGIVertices[_0xa524('0x10')]['subproject']=function(_0x5bda75){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x1b8'),_0x5bda75[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0x5bda75[_0xa524('0x1b9')])){return this['channel'][_0xa524('0x2d')](_0x5bda75,_0xa524('0x1ba'));}var _0x26b745=this['getSquareProject']['sync'](this,_0x5bda75[_0xa524('0x1b9')]);if(!this[_0xa524('0xb0')](_0x26b745)){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x5bda75,util[_0xa524('0x2a')](_0xa524('0x1bb'),_0x5bda75[_0xa524('0x1b9')]));}if(_0x26b745===this[_0xa524('0xe')][_0xa524('0x38')]){return this[_0xa524('0xe')]['error'](_0x5bda75,_0xa524('0x1bc'));}this['createSquareDetailsReport'][_0xa524('0x78')](this,_0x5bda75,_0x26b745);var _0x482424=this[_0xa524('0xe')][_0xa524('0x60')]('AGI',util['format'](_0xa524('0x1bd'),config[_0xa524('0x7')][_0xa524('0x19d')]||'127.0.0.1',_0x26b745,this[_0xa524('0xe')]['arg_1']));if(_0x482424[_0xa524('0xae')]===-0x1){return _0x482424;}return this['channel']['noop'](util[_0xa524('0x2a')]('Executed\x20command\x20%s\x20%s',_0xa524('0x1be'),_0x26b745));};AGIVertices[_0xa524('0x10')][_0xa524('0x1bf')]=function(_0x55c3d9){logger['info'](util[_0xa524('0x2a')](_0xa524('0x1c0'),_0x55c3d9[_0xa524('0xb5')]));var _0x4cf0ec=this['shellCommand'][_0xa524('0x78')](this,_0x55c3d9[_0xa524('0xc3')]);this[_0xa524('0x37')][_0xa524('0x78')](this,_0x55c3d9,_0x55c3d9[_0xa524('0xc3')]);if(this['isConfigured'](_0x55c3d9[_0xa524('0xde')])){var _0xbe5975=this[_0xa524('0xab')][_0xa524('0x78')](this,_0x55c3d9[_0xa524('0xde')]);if(_0xbe5975){this[_0xa524('0xe')][_0xa524('0xa8')](_0xbe5975,_0x4cf0ec);return this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x1c1'),_0x55c3d9[_0xa524('0xc3')],_0xbe5975));}}return this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x1c2'),_0x55c3d9['command']));};AGIVertices[_0xa524('0x10')]['google_cloud_tts']=function(_0x198b07){logger[_0xa524('0x31')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x198b07[_0xa524('0xb5')]));_0x198b07[_0xa524('0x64')]=_0x198b07[_0xa524('0x64')][_0xa524('0x61')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa524('0xb0')](_0x198b07[_0xa524('0x63')])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0x1c3'));}if(!this[_0xa524('0xb0')](_0x198b07[_0xa524('0x64')])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0xb7'));}this[_0xa524('0xe')][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x1c4'),_0x198b07[_0xa524('0x64')]));var _0x1a5224=this['googleCloudTTS'][_0xa524('0x78')](this,_0x198b07);if(_0x1a5224){this[_0xa524('0xe')]['noop'](util[_0xa524('0x2a')](_0xa524('0x1c5'),_0x1a5224));var _0x13ed35=this[_0xa524('0xe')][_0xa524('0x106')](_0x1a5224);try{fs['unlink'](_0x1a5224+'.wav');}catch(_0x4bae16){logger[_0xa524('0x2d')](_0x4bae16);}return _0x13ed35;}return this['channel'][_0xa524('0x2d')](_0x198b07,_0xa524('0x1c6'));};AGIVertices[_0xa524('0x10')][_0xa524('0x1c7')]=function(_0x9768de){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x1c8'),_0x9768de[_0xa524('0xb5')]));_0x9768de[_0xa524('0x64')]=_0x9768de[_0xa524('0x64')][_0xa524('0x61')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa524('0xb0')](_0x9768de[_0xa524('0x64')])){return this[_0xa524('0xe')][_0xa524('0xb6')](_0xa524('0xb7'));}this[_0xa524('0xe')][_0xa524('0xb6')](util['format'](_0xa524('0x1c9'),_0x9768de['text']));var _0x361e02=this[_0xa524('0x6a')][_0xa524('0x78')](this,_0x9768de);if(_0x361e02){this['channel'][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x1ca'),_0x361e02));var _0x469ae0=this['channel'][_0xa524('0x106')](_0x361e02);try{fs[_0xa524('0x107')](_0x361e02+'.wav');}catch(_0x3d52af){logger[_0xa524('0x2d')](_0x3d52af);}return _0x469ae0;}return this['channel'][_0xa524('0x2d')](_0x9768de,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xa524('0x10')]['unpause']=function(_0x2954b2){logger[_0xa524('0x31')](util['format'](_0xa524('0x1cb'),_0x2954b2[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0x2954b2['findBy'])){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x2954b2,_0xa524('0x15b'));}logger[_0xa524('0x31')](util[_0xa524('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa524('0xe')][_0xa524('0x39')],_0x2954b2[_0xa524('0x15d')]));var _0x30f6a2=this[_0xa524('0x59')][_0xa524('0x78')](this,_0x2954b2[_0xa524('0x15d')]);if(_0x30f6a2){logger['info'](util[_0xa524('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa524('0xe')][_0xa524('0x39')],_0x2954b2[_0xa524('0x15d')]));this[_0xa524('0xe')][_0xa524('0xb6')](util['format'](_0xa524('0x15e'),this[_0xa524('0xe')][_0xa524('0x39')],_0x2954b2[_0xa524('0x15d')]));return{'code':0xc8,'result':_0xa524('0x15f')};}else{logger[_0xa524('0x31')](util[_0xa524('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa524('0xe')]['callerid'],_0x2954b2[_0xa524('0x15d')]));this['channel'][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0x160'),this[_0xa524('0xe')]['callerid'],_0x2954b2[_0xa524('0x15d')]));return{'code':0xc8,'result':_0xa524('0x161')};}};AGIVertices[_0xa524('0x10')][_0xa524('0x1cc')]=function(_0x34efe2){logger[_0xa524('0x31')](util[_0xa524('0x2a')](_0xa524('0x1cd'),_0x34efe2[_0xa524('0xb5')]));var _0x91bc3=this[_0xa524('0xe')][_0xa524('0x60')](_0xa524('0x1ce'),[_0x34efe2['mailbox'],_0x34efe2['options']]);if(_0x91bc3[_0xa524('0xae')]===-0x1){return _0x91bc3;}return this['channel'][_0xa524('0xb6')](util[_0xa524('0x2a')](_0xa524('0xcd'),_0xa524('0x1ce'),_0x34efe2[_0xa524('0x1cf')]));};AGIVertices[_0xa524('0x10')][_0xa524('0x1d0')]=function(_0x4065e2){logger[_0xa524('0x31')](util['format'](_0xa524('0x1d1'),_0x4065e2[_0xa524('0xb5')]));if(!this[_0xa524('0xb0')](_0x4065e2[_0xa524('0xde')])){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x4065e2,_0xa524('0x1b1'));}var _0x4d9741=this[_0xa524('0xab')][_0xa524('0x78')](this,_0x4065e2[_0xa524('0xde')]);if(!_0x4d9741){return this[_0xa524('0xe')][_0xa524('0x2d')](_0x4065e2,_0xa524('0xe0'));}var _0x22d9e2=this['channel'][_0xa524('0xab')](_0x4d9741);return{'code':0xc8,'result':_0x22d9e2[_0xa524('0xac')]?_0x22d9e2[_0xa524('0xac')]:'-'};};String[_0xa524('0x10')][_0xa524('0xaa')]=function(_0x45deb6,_0x1b4a01){return this[_0xa524('0xa9')](_0x45deb6)['join'](_0x1b4a01);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 2707406..9cfea0f 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 _0x82ec=['[ACW][STOP]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','prototype','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','then','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','error','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify'];(function(_0x2afcf4,_0x564e66){var _0x39c239=function(_0x22a9d3){while(--_0x22a9d3){_0x2afcf4['push'](_0x2afcf4['shift']());}};_0x39c239(++_0x564e66);}(_0x82ec,0x154));var _0xc82e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x82ec[_0x502c7d];return _0x30b7ed;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xc82e('0x0'));var ami=require(_0xc82e('0x1'));var logger=require(_0xc82e('0x2'))(_0xc82e('0x3'));var RpcUser=require(_0xc82e('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3183ff){this[_0xc82e('0x5')]=_0x3183ff[_0xc82e('0x5')];this[_0xc82e('0x6')]=_0x3183ff['agents'];this[_0xc82e('0x7')]=_0x3183ff[_0xc82e('0x7')];this['channels']={};ami['on']('agentconnect',this[_0xc82e('0x8')][_0xc82e('0x9')](this));ami['on']('hanguprequest',this[_0xc82e('0xa')][_0xc82e('0x9')](this));ami['on'](_0xc82e('0xb'),this[_0xc82e('0xc')][_0xc82e('0x9')](this));ami['on'](_0xc82e('0xd'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xc82e('0xe'),this[_0xc82e('0xf')]['bind'](this));ami['on'](_0xc82e('0x10'),this[_0xc82e('0x11')][_0xc82e('0x9')](this));ami['on']('custom:agentConnectPreview',this[_0xc82e('0x12')]['bind'](this));}function getDiff(_0xb9bf6d){var _0x33163c=moment()[_0xc82e('0x13')](0x0);var _0x455450=moment(_0xb9bf6d)[_0xc82e('0x13')](0x0);return _0x33163c['diff'](_0x455450,_0xc82e('0x14'));}Acw[_0xc82e('0x15')]['startAcw']=function(_0x1febca){try{var _0xb70c56=this;var _0x202572=this[_0xc82e('0x16')][_0x1febca][_0xc82e('0x17')];var _0x23ab21=this[_0xc82e('0x16')][_0x1febca][_0xc82e('0x18')];var _0x4c0d01=this[_0xc82e('0x5')][_0x23ab21];var _0x56309a=![];var _0x23d309=_0xc82e('0x19');if(_0x4c0d01[_0xc82e('0x1a')]){if(_0x4c0d01[_0xc82e('0x1b')][_0xc82e('0x1c')]){_0x56309a=!![];_0x23d309=_0x4c0d01[_0xc82e('0x1b')][_0xc82e('0x1c')];}}ami[_0xc82e('0x1d')]({'action':'QueuePause','interface':_0x202572,'paused':!![],'reason':_0x23d309})['then'](function(_0x1f54eb){if(_0xb70c56[_0xc82e('0x6')][_0x202572]){return RpcUser[_0xc82e('0x1e')](_0xb70c56[_0xc82e('0x6')][_0x202572]['id'])['then'](function(_0x32c4ab){if(_0x32c4ab&&!_0x32c4ab[_0xc82e('0x1f')]){logger[_0xc82e('0x20')](_0xc82e('0x21'),_0x1febca,_0x202572,_0x23ab21);var _0xf5840d=_0xb70c56[_0xc82e('0x16')][_0x1febca][_0xc82e('0x22')]&&_0xb70c56[_0xc82e('0x16')][_0x1febca][_0xc82e('0x23')]?_0xb70c56['channels'][_0x1febca][_0xc82e('0x23')]:_0x1febca;return RpcUser['savePause'](_0xb70c56[_0xc82e('0x6')][_0x202572],_0x23d309,_0xf5840d)[_0xc82e('0x24')](function(_0x2490bc){if(!_0x56309a){_0xb70c56[_0xc82e('0x7')][_0x202572]={};logger[_0xc82e('0x20')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1febca,_0xb70c56['voiceQueues'][_0x23ab21][_0xc82e('0x25')],_0x202572,_0x23ab21);_0xb70c56['timers'][_0x202572][_0xc82e('0x26')]=setTimeout(_0xb70c56[_0xc82e('0x27')][_0xc82e('0x9')](_0xb70c56,_0x202572),_0xb70c56[_0xc82e('0x5')][_0x23ab21][_0xc82e('0x25')]*0x3e8);_0xb70c56[_0xc82e('0x7')][_0x202572][_0xc82e('0x28')]=moment()[_0xc82e('0x29')](_0xc82e('0x2a'));_0xb70c56[_0xc82e('0x7')][_0x202572][_0xc82e('0x2b')]=_0x1febca;_0xb70c56['timers'][_0x202572]['queue']=_0x23ab21;_0xb70c56['timers'][_0x202572]['updateAcw']=function(){var _0x27053f=getDiff(_0xb70c56[_0xc82e('0x7')][_0x202572]['lastPauseAt']);clearTimeout(_0xb70c56[_0xc82e('0x7')][_0x202572]['timer']);_0xb70c56[_0xc82e('0x7')][_0x202572]['timer']=![];RpcVoiceAgentReport[_0xc82e('0x2c')]({'acwtime':_0x27053f},_0xb70c56[_0xc82e('0x7')][_0x202572][_0xc82e('0x2b')],_0x202572)[_0xc82e('0x24')](function(_0xcadb4b){logger[_0xc82e('0x20')](_0xc82e('0x2d'),_0x1febca,_0x27053f,_0xcadb4b);})[_0xc82e('0x2e')](function(_0x592d90){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x1febca,_0x592d90);});delete _0xb70c56[_0xc82e('0x7')][_0x202572];};}});}else{logger[_0xc82e('0x20')](_0xc82e('0x2f'),_0x1febca,_0x202572,_0x23ab21);}});}})['catch'](function(_0x247ec2){logger['error'](_0xc82e('0x30'),_0x1febca,_0xb70c56['voiceQueues'][_0x23ab21][_0xc82e('0x25')],_0x202572,_0x23ab21);})['finally'](function(){delete _0xb70c56[_0xc82e('0x16')][_0x1febca];});}catch(_0x43b58c){logger[_0xc82e('0x31')](_0xc82e('0x32'),_0x43b58c[_0xc82e('0x33')]);}};Acw['prototype'][_0xc82e('0x27')]=function(_0x339b06){try{var _0x4b691f=this;if(_0x4b691f['timers'][_0x339b06]){_0x4b691f['timers'][_0x339b06]['timer']=![];var _0x544ad9=_0x4b691f[_0xc82e('0x7')][_0x339b06]['uniqueid'];var _0x545871=_0x4b691f[_0xc82e('0x7')][_0x339b06][_0xc82e('0x18')];var _0x5c077c=_0x4b691f[_0xc82e('0x5')][_0x545871][_0xc82e('0x25')];logger['info'](_0xc82e('0x34'),_0x544ad9,_0x339b06);RpcUser['saveUnpause'](this['agents'][_0x339b06]);RpcVoiceAgentReport[_0xc82e('0x2c')]({'acwtime':_0x5c077c,'agentacw':!![]},_0x544ad9,_0x339b06)[_0xc82e('0x24')](function(_0x40b26d){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x544ad9,_0x5c077c,_0x40b26d);})[_0xc82e('0x2e')](function(_0x2e56ca){logger[_0xc82e('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x544ad9,_0x2e56ca);});}else{logger[_0xc82e('0x31')](_0xc82e('0x35'),_0x339b06);if(_0x4b691f['timers']){logger[_0xc82e('0x20')]('[ACW][TIMERS]',JSON[_0xc82e('0x36')](_0x4b691f['timers']));}}}catch(_0x557c4c){logger[_0xc82e('0x31')](_0xc82e('0x37'),_0x557c4c[_0xc82e('0x33')]);}};Acw[_0xc82e('0x15')][_0xc82e('0x8')]=function(_0x385888){try{if(this['voiceQueues'][_0x385888['queue']]&&(this[_0xc82e('0x5')][_0x385888['queue']][_0xc82e('0x3')]||this[_0xc82e('0x5')][_0x385888[_0xc82e('0x18')]]['mandatoryDisposition'])){if(this[_0xc82e('0x6')][_0x385888[_0xc82e('0x17')]]){this[_0xc82e('0x16')][_0x385888['uniqueid']]={'queue':_0x385888[_0xc82e('0x18')],'interface':_0x385888[_0xc82e('0x17')],'destlinkedid':_0x385888['destlinkedid']};}}}catch(_0x487ffd){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x487ffd[_0xc82e('0x33')]);}};Acw[_0xc82e('0x15')]['syncAgentConnectPreview']=function(_0x330cf5){try{if(this[_0xc82e('0x5')][_0x330cf5[_0xc82e('0x18')]]&&(this[_0xc82e('0x5')][_0x330cf5[_0xc82e('0x18')]][_0xc82e('0x3')]||this[_0xc82e('0x5')][_0x330cf5[_0xc82e('0x18')]][_0xc82e('0x1a')])){if(this[_0xc82e('0x6')][_0x330cf5[_0xc82e('0x17')]]){this['channels'][_0x330cf5[_0xc82e('0x2b')]]={'queue':_0x330cf5['queue'],'interface':_0x330cf5['interface']};}}}catch(_0x7931a1){logger[_0xc82e('0x31')](_0xc82e('0x38'),_0x7931a1[_0xc82e('0x33')]);}};Acw[_0xc82e('0x15')][_0xc82e('0xa')]=function(_0x1bf27c){try{if(this[_0xc82e('0x16')][_0x1bf27c[_0xc82e('0x2b')]]&&_[_0xc82e('0x39')](this[_0xc82e('0x16')][_0x1bf27c[_0xc82e('0x2b')]]['attended'])){logger['info'](_0xc82e('0x3a'),_0x1bf27c[_0xc82e('0x2b')]);this['startAcw'](_0x1bf27c[_0xc82e('0x2b')]);}else if(this['channels'][_0x1bf27c['linkedid']]&&_[_0xc82e('0x39')](this[_0xc82e('0x16')][_0x1bf27c[_0xc82e('0x3b')]][_0xc82e('0x22')])){logger['info'](_0xc82e('0x3c'),_0x1bf27c['linkedid']);this[_0xc82e('0x3d')](_0x1bf27c['linkedid']);}}catch(_0x484e44){logger['error'](_0xc82e('0x3e'),_0x484e44[_0xc82e('0x33')]);}};Acw[_0xc82e('0x15')][_0xc82e('0xc')]=function(_0x4aeca0){try{if(this[_0xc82e('0x16')][_0x4aeca0['uniqueid']]&&this[_0xc82e('0x16')][_0x4aeca0[_0xc82e('0x2b')]]['attended']){logger[_0xc82e('0x20')](_0xc82e('0x3f'),_0x4aeca0[_0xc82e('0x2b')]);this[_0xc82e('0x3d')](_0x4aeca0['uniqueid']);}else if(this['channels'][_0x4aeca0[_0xc82e('0x3b')]]&&this[_0xc82e('0x16')][_0x4aeca0[_0xc82e('0x3b')]][_0xc82e('0x22')]){logger[_0xc82e('0x20')](_0xc82e('0x40'),_0x4aeca0[_0xc82e('0x3b')]);this[_0xc82e('0x3d')](_0x4aeca0[_0xc82e('0x3b')]);}}catch(_0x1b3d6c){logger[_0xc82e('0x31')]('[ACW][syncHangup]\x20%s',_0x1b3d6c['message']);}};Acw['prototype']['syncAttendedTransfer']=function(_0x55efed){try{if(!_['isNil'](this[_0xc82e('0x16')][_0x55efed[_0xc82e('0x41')]])){this[_0xc82e('0x3d')](_0x55efed[_0xc82e('0x41')]);if(this[_0xc82e('0x16')][_0x55efed['secondtransfereruniqueid']]){this[_0xc82e('0x16')][_0x55efed[_0xc82e('0x42')]][_0xc82e('0x22')]=!![];this[_0xc82e('0x16')][_0x55efed[_0xc82e('0x43')]]=this[_0xc82e('0x16')][_0x55efed[_0xc82e('0x42')]];delete this[_0xc82e('0x16')][_0x55efed[_0xc82e('0x42')]];}}else if(!_[_0xc82e('0x44')](this['channels'][_0x55efed['transfertargetuniqueid']])){this['startAcw'](_0x55efed['transfertargetuniqueid']);if(this[_0xc82e('0x16')][_0x55efed['origtransfereruniqueid']]){this[_0xc82e('0x16')][_0x55efed[_0xc82e('0x45')]][_0xc82e('0x22')]=!![];this[_0xc82e('0x16')][_0x55efed['transfereeuniqueid']]=this[_0xc82e('0x16')][_0x55efed[_0xc82e('0x45')]];delete this['channels'][_0x55efed[_0xc82e('0x45')]];}}}catch(_0x382f22){logger[_0xc82e('0x31')]('[ACW][syncAttendedTransfer]\x20%s',_0x382f22['message']);}};Acw[_0xc82e('0x15')][_0xc82e('0x11')]=function(_0x1085a6){try{if(this[_0xc82e('0x16')][_0x1085a6['transfereruniqueid']]){logger[_0xc82e('0x20')](_0xc82e('0x46'),JSON[_0xc82e('0x36')](_0x1085a6[_0xc82e('0x47')]));this[_0xc82e('0x3d')](_0x1085a6['transfereruniqueid']);}else if(this['channels'][_0x1085a6['transfererlinkedid']]){logger[_0xc82e('0x20')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x1085a6[_0xc82e('0x48')]));this[_0xc82e('0x3d')](_0x1085a6[_0xc82e('0x48')]);}}catch(_0x50e7e2){logger[_0xc82e('0x31')](_0xc82e('0x49'),_0x50e7e2[_0xc82e('0x33')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x3a5a64){try{if(this[_0xc82e('0x5')][_0x3a5a64[_0xc82e('0x18')]]&&this[_0xc82e('0x5')][_0x3a5a64[_0xc82e('0x18')]][_0xc82e('0x4a')]===_0xc82e('0x4b')){if(this[_0xc82e('0x6')][_0x3a5a64['interface']]){logger[_0xc82e('0x20')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3a5a64[_0xc82e('0x2b')],_0x3a5a64[_0xc82e('0x17')],_0x3a5a64[_0xc82e('0x18')]);return RpcUser[_0xc82e('0x4c')](this[_0xc82e('0x6')][_0x3a5a64[_0xc82e('0x17')]],'Auto-Pause',_0x3a5a64['uniqueid']);}}}catch(_0x3dba9c){logger[_0xc82e('0x31')](_0xc82e('0x4d'),_0x3dba9c[_0xc82e('0x33')]);}};module[_0xc82e('0x4e')]=Acw; \ No newline at end of file +var _0x7c1c=['interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','timers','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','stringify','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','prototype','startAcw'];(function(_0x46cd02,_0x56a42a){var _0x13ac59=function(_0x1aa209){while(--_0x1aa209){_0x46cd02['push'](_0x46cd02['shift']());}};_0x13ac59(++_0x56a42a);}(_0x7c1c,0x19d));var _0xc7c1=function(_0x587dc0,_0x2a409f){_0x587dc0=_0x587dc0-0x0;var _0x4abb3e=_0x7c1c[_0x587dc0];return _0x4abb3e;};'use strict';var util=require(_0xc7c1('0x0'));var _=require(_0xc7c1('0x1'));var moment=require(_0xc7c1('0x2'));var ami=require(_0xc7c1('0x3'));var logger=require(_0xc7c1('0x4'))(_0xc7c1('0x5'));var RpcUser=require(_0xc7c1('0x6'));var RpcVoiceAgentReport=require(_0xc7c1('0x7'));function Acw(_0x87382b){this[_0xc7c1('0x8')]=_0x87382b['voiceQueues'];this[_0xc7c1('0x9')]=_0x87382b['agents'];this['timers']=_0x87382b['timers'];this[_0xc7c1('0xa')]={};ami['on'](_0xc7c1('0xb'),this[_0xc7c1('0xc')][_0xc7c1('0xd')](this));ami['on'](_0xc7c1('0xe'),this['syncHangupRequest'][_0xc7c1('0xd')](this));ami['on'](_0xc7c1('0xf'),this[_0xc7c1('0x10')][_0xc7c1('0xd')](this));ami['on'](_0xc7c1('0x11'),this[_0xc7c1('0x12')][_0xc7c1('0xd')](this));ami['on'](_0xc7c1('0x13'),this['syncAttendedTransfer'][_0xc7c1('0xd')](this));ami['on'](_0xc7c1('0x14'),this[_0xc7c1('0x15')]['bind'](this));ami['on'](_0xc7c1('0x16'),this['syncAgentConnectPreview'][_0xc7c1('0xd')](this));}function getDiff(_0x4b4cc8){var _0x32a2d5=moment()[_0xc7c1('0x17')](0x0);var _0x46b702=moment(_0x4b4cc8)[_0xc7c1('0x17')](0x0);return _0x32a2d5[_0xc7c1('0x18')](_0x46b702,'seconds');}Acw[_0xc7c1('0x19')][_0xc7c1('0x1a')]=function(_0x3fca06){try{var _0x24bca2=this;var _0x36588a=this['channels'][_0x3fca06][_0xc7c1('0x1b')];var _0x201500=this[_0xc7c1('0xa')][_0x3fca06][_0xc7c1('0x1c')];var _0x17d961=this[_0xc7c1('0x8')][_0x201500];var _0xbfab72=![];var _0x2601a2=_0xc7c1('0x1d');if(_0x17d961[_0xc7c1('0x1e')]){if(_0x17d961['mandatoryDispositionPause'][_0xc7c1('0x1f')]){_0xbfab72=!![];_0x2601a2=_0x17d961[_0xc7c1('0x20')][_0xc7c1('0x1f')];}}ami['Action']({'action':_0xc7c1('0x21'),'interface':_0x36588a,'paused':!![],'reason':_0x2601a2})[_0xc7c1('0x22')](function(_0x1e3fc2){if(_0x24bca2[_0xc7c1('0x9')][_0x36588a]){return RpcUser['getAgent'](_0x24bca2[_0xc7c1('0x9')][_0x36588a]['id'])[_0xc7c1('0x22')](function(_0x22d08a){if(_0x22d08a&&!_0x22d08a[_0xc7c1('0x23')]){logger[_0xc7c1('0x24')](_0xc7c1('0x25'),_0x3fca06,_0x36588a,_0x201500);var _0x22405d=_0x24bca2['channels'][_0x3fca06][_0xc7c1('0x26')]&&_0x24bca2[_0xc7c1('0xa')][_0x3fca06][_0xc7c1('0x27')]?_0x24bca2[_0xc7c1('0xa')][_0x3fca06]['destlinkedid']:_0x3fca06;return RpcUser[_0xc7c1('0x28')](_0x24bca2[_0xc7c1('0x9')][_0x36588a],_0x2601a2,_0x22405d)[_0xc7c1('0x22')](function(_0x5cb59c){if(!_0xbfab72){_0x24bca2[_0xc7c1('0x29')][_0x36588a]={};logger[_0xc7c1('0x24')](_0xc7c1('0x2a'),_0x3fca06,_0x24bca2[_0xc7c1('0x8')][_0x201500][_0xc7c1('0x2b')],_0x36588a,_0x201500);_0x24bca2['timers'][_0x36588a][_0xc7c1('0x2c')]=setTimeout(_0x24bca2[_0xc7c1('0x2d')][_0xc7c1('0xd')](_0x24bca2,_0x36588a),_0x24bca2['voiceQueues'][_0x201500]['acwTimeout']*0x3e8);_0x24bca2[_0xc7c1('0x29')][_0x36588a][_0xc7c1('0x2e')]=moment()['format'](_0xc7c1('0x2f'));_0x24bca2[_0xc7c1('0x29')][_0x36588a][_0xc7c1('0x30')]=_0x3fca06;_0x24bca2[_0xc7c1('0x29')][_0x36588a]['queue']=_0x201500;_0x24bca2['timers'][_0x36588a]['updateAcw']=function(){var _0x38e9eb=getDiff(_0x24bca2[_0xc7c1('0x29')][_0x36588a][_0xc7c1('0x2e')]);clearTimeout(_0x24bca2[_0xc7c1('0x29')][_0x36588a][_0xc7c1('0x2c')]);_0x24bca2[_0xc7c1('0x29')][_0x36588a][_0xc7c1('0x2c')]=![];RpcVoiceAgentReport[_0xc7c1('0x31')]({'acwtime':_0x38e9eb},_0x24bca2[_0xc7c1('0x29')][_0x36588a]['uniqueid'],_0x36588a)[_0xc7c1('0x22')](function(_0x2de8e5){logger['info'](_0xc7c1('0x32'),_0x3fca06,_0x38e9eb,_0x2de8e5);})[_0xc7c1('0x33')](function(_0x27dafc){logger[_0xc7c1('0x34')](_0xc7c1('0x35'),_0x3fca06,_0x27dafc);});delete _0x24bca2[_0xc7c1('0x29')][_0x36588a];};}});}else{logger[_0xc7c1('0x24')](_0xc7c1('0x36'),_0x3fca06,_0x36588a,_0x201500);}});}})[_0xc7c1('0x33')](function(_0xb1281e){logger['error'](_0xc7c1('0x2a'),_0x3fca06,_0x24bca2[_0xc7c1('0x8')][_0x201500]['acwTimeout'],_0x36588a,_0x201500);})[_0xc7c1('0x37')](function(){delete _0x24bca2[_0xc7c1('0xa')][_0x3fca06];});}catch(_0x35d7f7){logger[_0xc7c1('0x34')]('[ACW][START]\x20%s',_0x35d7f7[_0xc7c1('0x38')]);}};Acw[_0xc7c1('0x19')]['stopAcw']=function(_0xd224e){try{var _0x2c43bb=this;if(_0x2c43bb[_0xc7c1('0x29')][_0xd224e]){_0x2c43bb[_0xc7c1('0x29')][_0xd224e][_0xc7c1('0x2c')]=![];var _0x3b31d3=_0x2c43bb['timers'][_0xd224e][_0xc7c1('0x30')];var _0x49aaf0=_0x2c43bb['timers'][_0xd224e][_0xc7c1('0x1c')];var _0x5773a2=_0x2c43bb[_0xc7c1('0x8')][_0x49aaf0]['acwTimeout'];logger[_0xc7c1('0x24')](_0xc7c1('0x39'),_0x3b31d3,_0xd224e);RpcUser[_0xc7c1('0x3a')](this[_0xc7c1('0x9')][_0xd224e]);RpcVoiceAgentReport[_0xc7c1('0x31')]({'acwtime':_0x5773a2,'agentacw':!![]},_0x3b31d3,_0xd224e)[_0xc7c1('0x22')](function(_0x2c41f0){logger[_0xc7c1('0x24')](_0xc7c1('0x32'),_0x3b31d3,_0x5773a2,_0x2c41f0);})['catch'](function(_0x3fbb2a){logger['error'](_0xc7c1('0x35'),_0x3b31d3,_0x3fbb2a);});}else{logger[_0xc7c1('0x34')](_0xc7c1('0x3b'),_0xd224e);if(_0x2c43bb[_0xc7c1('0x29')]){logger[_0xc7c1('0x24')](_0xc7c1('0x3c'),JSON['stringify'](_0x2c43bb[_0xc7c1('0x29')]));}}}catch(_0x296a6d){logger[_0xc7c1('0x34')](_0xc7c1('0x3d'),_0x296a6d[_0xc7c1('0x38')]);}};Acw[_0xc7c1('0x19')][_0xc7c1('0xc')]=function(_0xd6b81b){try{if(this[_0xc7c1('0x8')][_0xd6b81b[_0xc7c1('0x1c')]]&&(this[_0xc7c1('0x8')][_0xd6b81b[_0xc7c1('0x1c')]][_0xc7c1('0x5')]||this[_0xc7c1('0x8')][_0xd6b81b[_0xc7c1('0x1c')]][_0xc7c1('0x1e')])){if(this['agents'][_0xd6b81b[_0xc7c1('0x1b')]]){this[_0xc7c1('0xa')][_0xd6b81b[_0xc7c1('0x30')]]={'queue':_0xd6b81b[_0xc7c1('0x1c')],'interface':_0xd6b81b[_0xc7c1('0x1b')],'destlinkedid':_0xd6b81b[_0xc7c1('0x27')]};}}}catch(_0x42a7a8){logger[_0xc7c1('0x34')](_0xc7c1('0x3e'),_0x42a7a8[_0xc7c1('0x38')]);}};Acw[_0xc7c1('0x19')]['syncAgentConnectPreview']=function(_0x25fcd5){try{if(this[_0xc7c1('0x8')][_0x25fcd5[_0xc7c1('0x1c')]]&&(this[_0xc7c1('0x8')][_0x25fcd5[_0xc7c1('0x1c')]][_0xc7c1('0x5')]||this[_0xc7c1('0x8')][_0x25fcd5['queue']][_0xc7c1('0x1e')])){if(this[_0xc7c1('0x9')][_0x25fcd5[_0xc7c1('0x1b')]]){this[_0xc7c1('0xa')][_0x25fcd5[_0xc7c1('0x30')]]={'queue':_0x25fcd5[_0xc7c1('0x1c')],'interface':_0x25fcd5[_0xc7c1('0x1b')]};}}}catch(_0x37ef23){logger['error'](_0xc7c1('0x3f'),_0x37ef23[_0xc7c1('0x38')]);}};Acw['prototype'][_0xc7c1('0x40')]=function(_0x310e62){try{if(this[_0xc7c1('0xa')][_0x310e62['uniqueid']]&&_[_0xc7c1('0x41')](this[_0xc7c1('0xa')][_0x310e62[_0xc7c1('0x30')]][_0xc7c1('0x26')])){logger['info'](_0xc7c1('0x42'),_0x310e62['uniqueid']);this[_0xc7c1('0x1a')](_0x310e62[_0xc7c1('0x30')]);}else if(this[_0xc7c1('0xa')][_0x310e62['linkedid']]&&_[_0xc7c1('0x41')](this[_0xc7c1('0xa')][_0x310e62[_0xc7c1('0x43')]][_0xc7c1('0x26')])){logger[_0xc7c1('0x24')](_0xc7c1('0x44'),_0x310e62['linkedid']);this[_0xc7c1('0x1a')](_0x310e62[_0xc7c1('0x43')]);}}catch(_0x46b1c4){logger[_0xc7c1('0x34')](_0xc7c1('0x45'),_0x46b1c4[_0xc7c1('0x38')]);}};Acw[_0xc7c1('0x19')][_0xc7c1('0x10')]=function(_0x256a5c){try{if(this[_0xc7c1('0xa')][_0x256a5c['uniqueid']]&&this['channels'][_0x256a5c[_0xc7c1('0x30')]][_0xc7c1('0x26')]){logger[_0xc7c1('0x24')](_0xc7c1('0x46'),_0x256a5c[_0xc7c1('0x30')]);this['startAcw'](_0x256a5c[_0xc7c1('0x30')]);}else if(this[_0xc7c1('0xa')][_0x256a5c[_0xc7c1('0x43')]]&&this[_0xc7c1('0xa')][_0x256a5c[_0xc7c1('0x43')]][_0xc7c1('0x26')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x256a5c[_0xc7c1('0x43')]);this[_0xc7c1('0x1a')](_0x256a5c[_0xc7c1('0x43')]);}}catch(_0x44601e){logger[_0xc7c1('0x34')](_0xc7c1('0x47'),_0x44601e[_0xc7c1('0x38')]);}};Acw[_0xc7c1('0x19')][_0xc7c1('0x48')]=function(_0x38dcfc){try{if(!_[_0xc7c1('0x49')](this[_0xc7c1('0xa')][_0x38dcfc[_0xc7c1('0x4a')]])){this['startAcw'](_0x38dcfc[_0xc7c1('0x4a')]);if(this[_0xc7c1('0xa')][_0x38dcfc[_0xc7c1('0x4b')]]){this['channels'][_0x38dcfc[_0xc7c1('0x4b')]][_0xc7c1('0x26')]=!![];this[_0xc7c1('0xa')][_0x38dcfc[_0xc7c1('0x4c')]]=this[_0xc7c1('0xa')][_0x38dcfc[_0xc7c1('0x4b')]];delete this['channels'][_0x38dcfc[_0xc7c1('0x4b')]];}}else if(!_[_0xc7c1('0x49')](this[_0xc7c1('0xa')][_0x38dcfc[_0xc7c1('0x4c')]])){this[_0xc7c1('0x1a')](_0x38dcfc[_0xc7c1('0x4c')]);if(this['channels'][_0x38dcfc[_0xc7c1('0x4d')]]){this[_0xc7c1('0xa')][_0x38dcfc[_0xc7c1('0x4d')]][_0xc7c1('0x26')]=!![];this[_0xc7c1('0xa')][_0x38dcfc[_0xc7c1('0x4a')]]=this[_0xc7c1('0xa')][_0x38dcfc['origtransfereruniqueid']];delete this[_0xc7c1('0xa')][_0x38dcfc[_0xc7c1('0x4d')]];}}}catch(_0x2c98df){logger[_0xc7c1('0x34')]('[ACW][syncAttendedTransfer]\x20%s',_0x2c98df[_0xc7c1('0x38')]);}};Acw[_0xc7c1('0x19')][_0xc7c1('0x15')]=function(_0x40e543){try{if(this[_0xc7c1('0xa')][_0x40e543[_0xc7c1('0x4e')]]){logger[_0xc7c1('0x24')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xc7c1('0x4f')](_0x40e543['transfereruniqueid']));this['startAcw'](_0x40e543[_0xc7c1('0x4e')]);}else if(this[_0xc7c1('0xa')][_0x40e543['transfererlinkedid']]){logger['info'](_0xc7c1('0x50'),JSON[_0xc7c1('0x4f')](_0x40e543[_0xc7c1('0x51')]));this[_0xc7c1('0x1a')](_0x40e543[_0xc7c1('0x51')]);}}catch(_0x1b3711){logger[_0xc7c1('0x34')](_0xc7c1('0x52'),_0x1b3711['message']);}};Acw[_0xc7c1('0x19')]['syncAgentRingNoAnswer']=function(_0x1e2764){try{if(this[_0xc7c1('0x8')][_0x1e2764[_0xc7c1('0x1c')]]&&this[_0xc7c1('0x8')][_0x1e2764['queue']][_0xc7c1('0x53')]==='all'){if(this['agents'][_0x1e2764['interface']]){logger['info'](_0xc7c1('0x54'),_0x1e2764[_0xc7c1('0x30')],_0x1e2764['interface'],_0x1e2764[_0xc7c1('0x1c')]);return RpcUser[_0xc7c1('0x28')](this[_0xc7c1('0x9')][_0x1e2764[_0xc7c1('0x1b')]],_0xc7c1('0x55'),_0x1e2764['uniqueid']);}}}catch(_0x434246){logger['error'](_0xc7c1('0x56'),_0x434246[_0xc7c1('0x38')]);}};module[_0xc7c1('0x57')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 909e9b8..68c4807 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 _0xbaf0=['once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','exports','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x30417a,_0x38ff00){var _0x3e9bcd=function(_0x3a277b){while(--_0x3a277b){_0x30417a['push'](_0x30417a['shift']());}};_0x3e9bcd(++_0x38ff00);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var _=require(_0x0baf('0x3'));var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x0baf('0x6')][_0x0baf('0x7')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')][_0x0baf('0x9')],!![]);ami[_0x0baf('0xa')]();ami[_0x0baf('0xb')]=BPromise['promisify'](ami[_0x0baf('0xc')]);function error(_0x5f20aa){logger[_0x0baf('0xd')](util[_0x0baf('0xe')](_0x0baf('0xf'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')],util[_0x0baf('0x10')](_0x5f20aa,![],null)));}function close(){logger[_0x0baf('0xd')](util[_0x0baf('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x0baf('0xb')]({'action':'sipshowregistry'});};};ami[_0x0baf('0x11')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x12')});};};ami[_0x0baf('0x13')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x0baf('0x15')});};};ami[_0x0baf('0x16')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x17')});};};function connect(_0x2cf7da){logger[_0x0baf('0x18')](util['format'](_0x0baf('0x19'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));ami['once']('error',error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);}ami['on'](_0x0baf('0x1c'),connect);ami['on'](_0x0baf('0x1d'),function(_0x1fa92b){logger[_0x0baf('0x18')](util[_0x0baf('0xe')](_0x0baf('0x1e'),config[_0x0baf('0x6')][_0x0baf('0x8')],config['asterisk']['ip'],config[_0x0baf('0x6')]['port'],util[_0x0baf('0x10')](_0x1fa92b,![],null)));});ami['on']('fullybooted',function(_0x4de74c){logger[_0x0baf('0x18')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));return BPromise['resolve']()[_0x0baf('0x1f')](ami[_0x0baf('0x20')]())[_0x0baf('0x1f')](ami[_0x0baf('0x11')]())[_0x0baf('0x1f')](ami[_0x0baf('0x13')]())[_0x0baf('0x1f')](ami['actionQueueSummary']())[_0x0baf('0x1f')](ami[_0x0baf('0x16')]())[_0x0baf('0x21')](function(_0x265915){logger['error'](_0x0baf('0x22'),util[_0x0baf('0x10')](_0x265915,{'showHidden':![],'depth':null}));});});ami['once'](_0x0baf('0xd'),error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);module[_0x0baf('0x23')]=ami; \ No newline at end of file +var _0x0713=['Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','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\x20\x22%s\x22\x20to\x20%s:%s','then','catch','[ami.js][fullybooted]','exports','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','error'];(function(_0x4511f0,_0x365662){var _0x5b71ef=function(_0x1318d1){while(--_0x1318d1){_0x4511f0['push'](_0x4511f0['shift']());}};_0x5b71ef(++_0x365662);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0x3071('0x0'));var util=require(_0x3071('0x1'));var _=require(_0x3071('0x2'));var logger=require(_0x3071('0x3'))(_0x3071('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x3071('0x5')][_0x3071('0x6')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')][_0x3071('0x8')],!![]);ami[_0x3071('0x9')]();ami[_0x3071('0xa')]=BPromise[_0x3071('0xb')](ami[_0x3071('0xc')]);function error(_0x2fce7a){logger[_0x3071('0xd')](util['format'](_0x3071('0xe'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')]['port'],util[_0x3071('0xf')](_0x2fce7a,![],null)));}function close(){logger[_0x3071('0xd')](util[_0x3071('0x10')](_0x3071('0x11'),config[_0x3071('0x5')]['username'],config['asterisk']['ip'],config[_0x3071('0x5')]['port']));}ami[_0x3071('0x12')]=function(){return function(){return ami[_0x3071('0xa')]({'action':'sipshowregistry'});};};ami[_0x3071('0x13')]=function(){return function(){return ami['Action']({'action':_0x3071('0x14')});};};ami[_0x3071('0x15')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x16')});};};ami[_0x3071('0x17')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x18')});};};ami[_0x3071('0x19')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x1a')});};};function connect(_0x5f3c22){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x1c'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')]));ami['once'](_0x3071('0xd'),error);ami[_0x3071('0x1d')](_0x3071('0x1e'),close);}ami['on']('connect',connect);ami['on'](_0x3071('0x1f'),function(_0x5cd80d){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x20'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')],util['inspect'](_0x5cd80d,![],null)));});ami['on']('fullybooted',function(_0x2ce48a){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x21'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')]));return BPromise['resolve']()[_0x3071('0x22')](ami[_0x3071('0x12')]())[_0x3071('0x22')](ami['actionDeviceStateList']())[_0x3071('0x22')](ami[_0x3071('0x15')]())[_0x3071('0x22')](ami[_0x3071('0x17')]())[_0x3071('0x22')](ami[_0x3071('0x19')]())[_0x3071('0x23')](function(_0x3921a1){logger[_0x3071('0xd')](_0x3071('0x24'),util[_0x3071('0xf')](_0x3921a1,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0x3071('0x1d')](_0x3071('0x1e'),close);module[_0x3071('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 5cebf46..3bf68aa 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 _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x4f90b8,_0x414a7e){var _0xd88765=function(_0x37d8f7){while(--_0x37d8f7){_0x4f90b8['push'](_0x4f90b8['shift']());}};_0xd88765(++_0x414a7e);}(_0xaa88,0x137));var _0x8aa8=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0xaa88[_0x5be795];return _0x4e8a3b;};'use strict';var jayson=require(_0x8aa8('0x0'));var BPromise=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var client=jayson['client'][_0x8aa8('0x4')]({'port':0x2329});client[_0x8aa8('0x5')]=function(_0x43f7e4,_0x3b2c88){return new BPromise(function(_0x3e3b70,_0x350e8b){return client['request'](_0x43f7e4,_0x3b2c88)['then'](function(_0x460042){logger['debug'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x3b2c88,_0x460042);if(_0x460042[_0x8aa8('0x8')]){logger[_0x8aa8('0x8')]('rpc',_0x8aa8('0x7'),_0x43f7e4,_0x460042[_0x8aa8('0x8')][_0x8aa8('0x9')],_0x3b2c88);return _0x350e8b(_0x460042['error'][_0x8aa8('0x9')]);}else{return _0x3e3b70(_0x460042[_0x8aa8('0xa')]);}})[_0x8aa8('0xb')](function(_0x33cc5c){logger['error'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x33cc5c,_0x3b2c88);return _0x350e8b(_0x33cc5c);});});};module['exports']=client; \ No newline at end of file +var _0x9ffd=['catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','then','debug','rpc','memberReport','error','result'];(function(_0x588025,_0x328007){var _0x2f3e44=function(_0x17fdc3){while(--_0x17fdc3){_0x588025['push'](_0x588025['shift']());}};_0x2f3e44(++_0x328007);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x27dd54,_0x2c4d3f){_0x27dd54=_0x27dd54-0x0;var _0x1c3861=_0x9ffd[_0x27dd54];return _0x1c3861;};'use strict';var jayson=require(_0xd9ff('0x0'));var BPromise=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('ami');var client=jayson[_0xd9ff('0x3')][_0xd9ff('0x4')]({'port':0x2329});client[_0xd9ff('0x5')]=function(_0x5493ae,_0x53e962){return new BPromise(function(_0x1c9460,_0x111697){return client['request'](_0x5493ae,_0x53e962)[_0xd9ff('0x6')](function(_0x2982c3){logger[_0xd9ff('0x7')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x53e962,_0x2982c3);if(_0x2982c3[_0xd9ff('0xa')]){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x2982c3['error']['message'],_0x53e962);return _0x111697(_0x2982c3['error']['message']);}else{return _0x1c9460(_0x2982c3[_0xd9ff('0xb')]);}})[_0xd9ff('0xc')](function(_0x193537){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x193537,_0x53e962);return _0x111697(_0x193537);});});};module[_0xd9ff('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index eec83cc..9e2e960 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 _0x975e=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','name','substring','dialCutDigit','getQueue','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','Contact','phone','firstName','lastName','number','queue','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x975e,0x15d));var _0xe975=function(_0x3c7152,_0x302b29){_0x3c7152=_0x3c7152-0x0;var _0x43aea5=_0x975e[_0x3c7152];return _0x43aea5;};'use strict';var util=require('util');var _=require(_0xe975('0x0'));var moment=require(_0xe975('0x1'));function checkNameSurname(_0x269443,_0x1455f7,_0x5ed786){var _0x5d59fe='';if(!_[_0xe975('0x2')](_0x1455f7)&&_0xe975('0x3')===typeof _0x1455f7){_0x5d59fe+=_0x1455f7;}if(!_['isNil'](_0x5ed786)&&_0xe975('0x3')===typeof _0x5ed786){_0x5d59fe+='\x20'+_0x5ed786;}if(_0x5d59fe!==''){return _0x5d59fe;}return _0x269443;}function Action(_0x3c961f,_0x2c5711,_0x2a0cfd){this[_0xe975('0x4')]=_0x3c961f;this[_0xe975('0x5')]=_0x2a0cfd||undefined;this['name']=checkNameSurname(_0x2c5711[_0xe975('0x6')][_0xe975('0x7')],_0x2c5711[_0xe975('0x6')][_0xe975('0x8')],_0x2c5711[_0xe975('0x6')][_0xe975('0x9')]);this[_0xe975('0xa')]=_0x2c5711[_0xe975('0x6')]['phone'];this[_0xe975('0xb')]=_0x3c961f['name'];this['active']=_0x2c5711['active']||![];this['type']=_0x3c961f[_0xe975('0xc')];this[_0xe975('0xd')]=_0x3c961f[_0xe975('0xd')]||0x3;this[_0xe975('0xe')]=_0x2c5711[_0xe975('0xe')];this['countbusyretry']=_0x2c5711[_0xe975('0xf')];this[_0xe975('0x10')]=_0x2c5711[_0xe975('0x10')];this[_0xe975('0x11')]=_0x2c5711[_0xe975('0x11')];this[_0xe975('0x12')]=_0x2c5711[_0xe975('0x12')];this[_0xe975('0x13')]=_0x2c5711[_0xe975('0x13')];this[_0xe975('0x14')]=_0x2c5711['countabandonedretry'];this['countmachineretry']=_0x2c5711[_0xe975('0x15')];this[_0xe975('0x16')]=_0x2c5711[_0xe975('0x16')];this[_0xe975('0x17')]=_0x2c5711[_0xe975('0x17')];this['ListId']=_0x2c5711[_0xe975('0x18')];this[_0xe975('0x19')]=_0x2c5711[_0xe975('0x19')];this[_0xe975('0x1a')]=_0x2c5711[_0xe975('0x1a')];this[_0xe975('0x1b')]=_0x2c5711[_0xe975('0x1b')];this[_0xe975('0x1c')]=_0x2c5711['id'];this[_0xe975('0x1d')]=_0x2c5711[_0xe975('0x6')]['firstName']||'';this[_0xe975('0x1e')]=moment()['format'](_0xe975('0x1f'));this['callback']=_0x2c5711['callback'];this[_0xe975('0x20')]=_0x2c5711[_0xe975('0x20')];this[_0xe975('0x21')]=_0x2c5711[_0xe975('0x21')];this['recallme']=_0x2c5711[_0xe975('0x22')];this[_0xe975('0x23')]='';this[_0xe975('0x24')]='';}Action[_0xe975('0x25')][_0xe975('0x26')]=function(){return util[_0xe975('0x27')](_0xe975('0x28'),this[_0xe975('0x29')],this['voiceQueue']['dialCutDigit']>0x0?this[_0xe975('0xa')][_0xe975('0x2a')](this[_0xe975('0x4')][_0xe975('0x2b')]):this[_0xe975('0xa')]);};Action[_0xe975('0x25')][_0xe975('0x2c')]=function(){return this[_0xe975('0xb')];};module[_0xe975('0x2d')]=Action; \ No newline at end of file +var _0x3cfd=['voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','queue','exports','util','lodash','moment','string','isNil'];(function(_0x25bd79,_0x506d7b){var _0x555dc6=function(_0x3c6dab){while(--_0x3c6dab){_0x25bd79['push'](_0x25bd79['shift']());}};_0x555dc6(++_0x506d7b);}(_0x3cfd,0xb3));var _0xd3cf=function(_0x4fb4d0,_0x351683){_0x4fb4d0=_0x4fb4d0-0x0;var _0x3549af=_0x3cfd[_0x4fb4d0];return _0x3549af;};'use strict';var util=require(_0xd3cf('0x0'));var _=require(_0xd3cf('0x1'));var moment=require(_0xd3cf('0x2'));function checkNameSurname(_0x3bc4a8,_0xa4151c,_0x5b062b){var _0x4249b8='';if(!_['isNil'](_0xa4151c)&&_0xd3cf('0x3')===typeof _0xa4151c){_0x4249b8+=_0xa4151c;}if(!_[_0xd3cf('0x4')](_0x5b062b)&&_0xd3cf('0x3')===typeof _0x5b062b){_0x4249b8+='\x20'+_0x5b062b;}if(_0x4249b8!==''){return _0x4249b8;}return _0x3bc4a8;}function Action(_0x5db3cb,_0x26ec9c,_0x516644){this[_0xd3cf('0x5')]=_0x5db3cb;this[_0xd3cf('0x6')]=_0x516644||undefined;this[_0xd3cf('0x7')]=checkNameSurname(_0x26ec9c[_0xd3cf('0x8')][_0xd3cf('0x9')],_0x26ec9c[_0xd3cf('0x8')][_0xd3cf('0xa')],_0x26ec9c[_0xd3cf('0x8')][_0xd3cf('0xb')]);this[_0xd3cf('0xc')]=_0x26ec9c[_0xd3cf('0x8')][_0xd3cf('0x9')];this['queue']=_0x5db3cb['name'];this[_0xd3cf('0xd')]=_0x26ec9c[_0xd3cf('0xd')]||![];this['type']=_0x5db3cb['type'];this[_0xd3cf('0xe')]=_0x5db3cb[_0xd3cf('0xe')]||0x3;this[_0xd3cf('0xf')]=_0x26ec9c[_0xd3cf('0xf')];this[_0xd3cf('0x10')]=_0x26ec9c[_0xd3cf('0x10')];this[_0xd3cf('0x11')]=_0x26ec9c[_0xd3cf('0x11')];this[_0xd3cf('0x12')]=_0x26ec9c[_0xd3cf('0x12')];this['countnosuchnumberretry']=_0x26ec9c[_0xd3cf('0x13')];this[_0xd3cf('0x14')]=_0x26ec9c[_0xd3cf('0x14')];this[_0xd3cf('0x15')]=_0x26ec9c[_0xd3cf('0x15')];this['countmachineretry']=_0x26ec9c[_0xd3cf('0x16')];this[_0xd3cf('0x17')]=_0x26ec9c[_0xd3cf('0x17')];this[_0xd3cf('0x18')]=_0x26ec9c[_0xd3cf('0x18')];this[_0xd3cf('0x19')]=_0x26ec9c[_0xd3cf('0x19')];this[_0xd3cf('0x1a')]=_0x26ec9c[_0xd3cf('0x1a')];this[_0xd3cf('0x1b')]=_0x26ec9c['VoiceQueueId'];this[_0xd3cf('0x1c')]=_0x26ec9c['CampaignId'];this[_0xd3cf('0x1d')]=_0x26ec9c['id'];this[_0xd3cf('0x1e')]=_0x26ec9c['Contact'][_0xd3cf('0xa')]||'';this['starttime']=moment()[_0xd3cf('0x1f')](_0xd3cf('0x20'));this[_0xd3cf('0x21')]=_0x26ec9c[_0xd3cf('0x21')];this[_0xd3cf('0x22')]=_0x26ec9c['callbackuniqueid'];this[_0xd3cf('0x23')]=_0x26ec9c[_0xd3cf('0x23')];this[_0xd3cf('0x24')]=_0x26ec9c[_0xd3cf('0x24')];this[_0xd3cf('0x25')]='';this[_0xd3cf('0x26')]='';}Action[_0xd3cf('0x27')][_0xd3cf('0x28')]=function(){return util[_0xd3cf('0x1f')](_0xd3cf('0x29'),this['name'],this[_0xd3cf('0x5')][_0xd3cf('0x2a')]>0x0?this[_0xd3cf('0xc')][_0xd3cf('0x2b')](this['voiceQueue'][_0xd3cf('0x2a')]):this[_0xd3cf('0xc')]);};Action[_0xd3cf('0x27')]['getQueue']=function(){return this[_0xd3cf('0x2c')];};module[_0xd3cf('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 700f6f2..3b4f04c 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 _0xd0f4=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','reason','callbackuniqueid','callbackat'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xd0f4,0x117));var _0x4d0f=function(_0x30e082,_0x274fb8){_0x30e082=_0x30e082-0x0;var _0x4d9e24=_0xd0f4[_0x30e082];return _0x4d9e24;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x4d0f('0x0'));function getSeconds(_0x17d943,_0x3961ec){var _0x27ec1c=moment(_0x17d943)[_0x4d0f('0x1')](0x0);var _0x25cb91=moment(_0x3961ec)[_0x4d0f('0x1')](0x0);return _0x27ec1c[_0x4d0f('0x2')](_0x25cb91,'seconds');}function AgentComplete(_0x4a629b,_0x1cce13){this[_0x4d0f('0x3')]=0x4;this[_0x4d0f('0x4')]=_0x4d0f('0x5');this[_0x4d0f('0x6')]=_0x4a629b['scheduledat'];this[_0x4d0f('0x7')]=_0x4a629b['type'];this[_0x4d0f('0x8')]=_0x4a629b[_0x4d0f('0x7')]===_0x4d0f('0x9')?_0x4d0f('0xa'):_0x4a629b[_0x4d0f('0x7')];this[_0x4d0f('0xb')]=_0x4a629b['countbusyretry'];this[_0x4d0f('0xc')]=_0x4a629b[_0x4d0f('0xc')];this[_0x4d0f('0xd')]=_0x4a629b[_0x4d0f('0xd')];this[_0x4d0f('0xe')]=_0x4a629b['countbusyretry']+_0x4a629b[_0x4d0f('0xc')]+_0x4a629b['countnoanswerretry']+_0x4a629b['countnosuchnumberretry']+_0x4a629b[_0x4d0f('0xf')]+_0x4a629b[_0x4d0f('0x10')]+_0x4a629b[_0x4d0f('0x11')]+_0x4a629b[_0x4d0f('0x12')];this[_0x4d0f('0x13')]=_0x4a629b['countnosuchnumberretry'];this[_0x4d0f('0xf')]=_0x4a629b[_0x4d0f('0xf')];this['countabandonedretry']=_0x4a629b[_0x4d0f('0x10')];this[_0x4d0f('0x11')]=_0x4a629b['countmachineretry'];this[_0x4d0f('0x12')]=_0x4a629b[_0x4d0f('0x12')];this['uniqueid']=_0x1cce13[_0x4d0f('0x14')];this['calleridname']=_0x4a629b[_0x4d0f('0x15')];this[_0x4d0f('0x16')]=_0x4a629b[_0x4d0f('0x17')];this[_0x4d0f('0x18')]=_0x4a629b[_0x4d0f('0x18')];this[_0x4d0f('0x19')]=_0x4a629b[_0x4d0f('0x19')];this[_0x4d0f('0x1a')]=_0x4a629b[_0x4d0f('0x1a')];this[_0x4d0f('0x1b')]=moment()[_0x4d0f('0x1c')](_0x4d0f('0x1d'));this[_0x4d0f('0x1e')]=getSeconds(_0x4a629b[_0x4d0f('0x19')],_0x4a629b[_0x4d0f('0x18')]);this[_0x4d0f('0x1f')]=getSeconds(_0x4a629b[_0x4d0f('0x1a')],_0x4a629b[_0x4d0f('0x19')]);this['talktime']=getSeconds(this['endtime'],_0x4a629b['answertime']);this['queue']=_0x1cce13['queue'];this[_0x4d0f('0x20')]=_0x1cce13[_0x4d0f('0x20')];this[_0x4d0f('0x21')]=_0x1cce13[_0x4d0f('0x21')];this['callback']=_0x4a629b['callback'];this[_0x4d0f('0x22')]=_0x4a629b[_0x4d0f('0x22')];this[_0x4d0f('0x23')]=_0x4a629b[_0x4d0f('0x23')];this[_0x4d0f('0x24')]=_0x4a629b['recallme'];this[_0x4d0f('0x25')]=_0x4a629b[_0x4d0f('0x25')];this[_0x4d0f('0x26')]=_0x4a629b['ListId'];this[_0x4d0f('0x27')]=_0x4a629b[_0x4d0f('0x27')];this['VoiceQueueId']=_0x4a629b[_0x4d0f('0x28')];this[_0x4d0f('0x29')]=_0x4a629b['CampaignId'];this[_0x4d0f('0x2a')]=_0x4a629b[_0x4d0f('0x2a')]||'';this[_0x4d0f('0x2b')]=_0x4a629b['originatecalleridname']||'';}module[_0x4d0f('0x2c')]=AgentComplete; \ No newline at end of file +var _0x896e=['calleridnum','number','starttime','responsetime','answertime','endtime','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x896e,0x6e));var _0xe896=function(_0xbf8f44,_0x258a38){_0xbf8f44=_0xbf8f44-0x0;var _0x51021d=_0x896e[_0xbf8f44];return _0x51021d;};'use strict';var util=require(_0xe896('0x0'));var _=require(_0xe896('0x1'));var moment=require('moment');function getSeconds(_0x4ce2c5,_0x4a5b36){var _0x22359f=moment(_0x4ce2c5)[_0xe896('0x2')](0x0);var _0x2661a9=moment(_0x4a5b36)['milliseconds'](0x0);return _0x22359f[_0xe896('0x3')](_0x2661a9,_0xe896('0x4'));}function AgentComplete(_0x9c410f,_0x237373){this[_0xe896('0x5')]=0x4;this[_0xe896('0x6')]=_0xe896('0x7');this['scheduledat']=_0x9c410f['scheduledat'];this[_0xe896('0x8')]=_0x9c410f[_0xe896('0x8')];this['campaigntype']=_0x9c410f[_0xe896('0x8')]===_0xe896('0x9')?_0xe896('0xa'):_0x9c410f['type'];this[_0xe896('0xb')]=_0x9c410f[_0xe896('0xb')];this['countcongestionretry']=_0x9c410f[_0xe896('0xc')];this[_0xe896('0xd')]=_0x9c410f['countnoanswerretry'];this[_0xe896('0xe')]=_0x9c410f[_0xe896('0xb')]+_0x9c410f[_0xe896('0xc')]+_0x9c410f['countnoanswerretry']+_0x9c410f[_0xe896('0xf')]+_0x9c410f[_0xe896('0x10')]+_0x9c410f[_0xe896('0x11')]+_0x9c410f['countmachineretry']+_0x9c410f[_0xe896('0x12')];this[_0xe896('0xf')]=_0x9c410f[_0xe896('0xf')];this['countdropretry']=_0x9c410f[_0xe896('0x10')];this[_0xe896('0x11')]=_0x9c410f[_0xe896('0x11')];this[_0xe896('0x13')]=_0x9c410f['countmachineretry'];this[_0xe896('0x12')]=_0x9c410f[_0xe896('0x12')];this[_0xe896('0x14')]=_0x237373[_0xe896('0x14')];this['calleridname']=_0x9c410f[_0xe896('0x15')];this[_0xe896('0x16')]=_0x9c410f[_0xe896('0x17')];this[_0xe896('0x18')]=_0x9c410f['starttime'];this[_0xe896('0x19')]=_0x9c410f[_0xe896('0x19')];this[_0xe896('0x1a')]=_0x9c410f[_0xe896('0x1a')];this[_0xe896('0x1b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xe896('0x1c')]=getSeconds(_0x9c410f[_0xe896('0x19')],_0x9c410f[_0xe896('0x18')]);this[_0xe896('0x1d')]=getSeconds(_0x9c410f[_0xe896('0x1a')],_0x9c410f[_0xe896('0x19')]);this[_0xe896('0x1e')]=getSeconds(this[_0xe896('0x1b')],_0x9c410f[_0xe896('0x1a')]);this[_0xe896('0xa')]=_0x237373['queue'];this[_0xe896('0x1f')]=_0x237373[_0xe896('0x1f')];this['reason']=_0x237373[_0xe896('0x20')];this[_0xe896('0x21')]=_0x9c410f[_0xe896('0x21')];this[_0xe896('0x22')]=_0x9c410f['callbackuniqueid'];this[_0xe896('0x23')]=_0x9c410f[_0xe896('0x23')];this['recallme']=_0x9c410f['recallme'];this[_0xe896('0x24')]=_0x9c410f[_0xe896('0x24')];this[_0xe896('0x25')]=_0x9c410f[_0xe896('0x25')];this[_0xe896('0x26')]=_0x9c410f['UserId'];this[_0xe896('0x27')]=_0x9c410f[_0xe896('0x27')];this[_0xe896('0x28')]=_0x9c410f['CampaignId'];this[_0xe896('0x29')]=_0x9c410f[_0xe896('0x29')]||'';this['originatecalleridname']=_0x9c410f[_0xe896('0x2a')]||'';}module[_0xe896('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 4b9bb60..0d0709c 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 _0x50a6=['countnosuchnumberretry','countagentrejectretry','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x235f49,_0x2992b4){var _0x551139=function(_0x35565c){while(--_0x35565c){_0x235f49['push'](_0x235f49['shift']());}};_0x551139(++_0x2992b4);}(_0x50a6,0xa4));var _0x650a=function(_0x29a894,_0x5f2d6f){_0x29a894=_0x29a894-0x0;var _0x588f68=_0x50a6[_0x29a894];return _0x588f68;};'use strict';var util=require(_0x650a('0x0'));var _=require(_0x650a('0x1'));var moment=require('moment');function getSeconds(_0x5d2ffc,_0x154e12){var _0x4abe0c=moment(_0x5d2ffc)[_0x650a('0x2')](0x0);var _0x15dd02=moment(_0x154e12)[_0x650a('0x2')](0x0);return _0x4abe0c['diff'](_0x15dd02,_0x650a('0x3'));}function Final(_0x4c71f3){this['uniqueid']=_0x4c71f3[_0x650a('0x4')];this[_0x650a('0x5')]=_0x4c71f3[_0x650a('0x5')];this[_0x650a('0x6')]=_0x4c71f3['type'];this[_0x650a('0x7')]=_0x4c71f3['type']===_0x650a('0x8')?_0x650a('0x9'):_0x4c71f3['type'];this[_0x650a('0xa')]=_0x4c71f3[_0x650a('0xa')];this['countcongestionretry']=_0x4c71f3[_0x650a('0xb')];this['countnoanswerretry']=_0x4c71f3[_0x650a('0xc')];this['countglobal']=_0x4c71f3[_0x650a('0xa')]+_0x4c71f3['countcongestionretry']+_0x4c71f3[_0x650a('0xc')]+_0x4c71f3['countnosuchnumberretry']+_0x4c71f3[_0x650a('0xd')]+_0x4c71f3[_0x650a('0xe')]+_0x4c71f3[_0x650a('0xf')]+_0x4c71f3['countagentrejectretry'];this[_0x650a('0x10')]=_0x4c71f3[_0x650a('0x10')];this[_0x650a('0xd')]=_0x4c71f3[_0x650a('0xd')];this[_0x650a('0xe')]=_0x4c71f3[_0x650a('0xe')];this['countmachineretry']=_0x4c71f3[_0x650a('0xf')];this['countagentrejectretry']=_0x4c71f3[_0x650a('0x11')];this[_0x650a('0x9')]=_0x4c71f3[_0x650a('0x9')];this['calleridname']=_0x4c71f3['calleridname'];this['calleridnum']=_0x4c71f3['calleridnum'];this[_0x650a('0x12')]=_0x4c71f3[_0x650a('0x12')];this[_0x650a('0x13')]=_0x4c71f3[_0x650a('0x13')];this[_0x650a('0x14')]=_0x4c71f3['responsetime'];this['ringtime']=_0x4c71f3[_0x650a('0x15')]||0x0;this[_0x650a('0x16')]=_0x4c71f3['holdtime']||0x0;this[_0x650a('0x17')]=_0x4c71f3[_0x650a('0x17')]||0x0;this['callback']=_0x4c71f3[_0x650a('0x18')];this[_0x650a('0x19')]=_0x4c71f3[_0x650a('0x19')];this[_0x650a('0x1a')]=_0x4c71f3[_0x650a('0x1a')];this['recallme']=_0x4c71f3[_0x650a('0x1b')];this['ContactId']=_0x4c71f3[_0x650a('0x1c')];this[_0x650a('0x1d')]=_0x4c71f3[_0x650a('0x1d')];this[_0x650a('0x1e')]=_0x4c71f3[_0x650a('0x1e')];this[_0x650a('0x1f')]=_0x4c71f3[_0x650a('0x1f')];this[_0x650a('0x20')]=_0x4c71f3[_0x650a('0x20')];this[_0x650a('0x21')]=_0x4c71f3[_0x650a('0x21')]||'';this[_0x650a('0x22')]=_0x4c71f3[_0x650a('0x22')]||'';}module[_0x650a('0x23')]=Final; \ No newline at end of file +var _0xcb81=['calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue'];(function(_0x563d06,_0x18865a){var _0x35525d=function(_0xf7abe6){while(--_0xf7abe6){_0x563d06['push'](_0x563d06['shift']());}};_0x35525d(++_0x18865a);}(_0xcb81,0x154));var _0x1cb8=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0xcb81[_0x4e6eb2];return _0x4e0c1c;};'use strict';var util=require(_0x1cb8('0x0'));var _=require(_0x1cb8('0x1'));var moment=require('moment');function getSeconds(_0x1b571c,_0x4fb901){var _0x5e8697=moment(_0x1b571c)['milliseconds'](0x0);var _0x38c3ea=moment(_0x4fb901)[_0x1cb8('0x2')](0x0);return _0x5e8697[_0x1cb8('0x3')](_0x38c3ea,_0x1cb8('0x4'));}function Final(_0x41b867){this['uniqueid']=_0x41b867[_0x1cb8('0x5')];this[_0x1cb8('0x6')]=_0x41b867['scheduledat'];this[_0x1cb8('0x7')]=_0x41b867[_0x1cb8('0x7')];this[_0x1cb8('0x8')]=_0x41b867['type']===_0x1cb8('0x9')?'queue':_0x41b867['type'];this[_0x1cb8('0xa')]=_0x41b867[_0x1cb8('0xa')];this[_0x1cb8('0xb')]=_0x41b867[_0x1cb8('0xb')];this[_0x1cb8('0xc')]=_0x41b867[_0x1cb8('0xc')];this[_0x1cb8('0xd')]=_0x41b867[_0x1cb8('0xa')]+_0x41b867['countcongestionretry']+_0x41b867[_0x1cb8('0xc')]+_0x41b867[_0x1cb8('0xe')]+_0x41b867[_0x1cb8('0xf')]+_0x41b867[_0x1cb8('0x10')]+_0x41b867[_0x1cb8('0x11')]+_0x41b867['countagentrejectretry'];this[_0x1cb8('0xe')]=_0x41b867[_0x1cb8('0xe')];this[_0x1cb8('0xf')]=_0x41b867[_0x1cb8('0xf')];this[_0x1cb8('0x10')]=_0x41b867[_0x1cb8('0x10')];this[_0x1cb8('0x11')]=_0x41b867[_0x1cb8('0x11')];this['countagentrejectretry']=_0x41b867[_0x1cb8('0x12')];this['queue']=_0x41b867[_0x1cb8('0x13')];this[_0x1cb8('0x14')]=_0x41b867[_0x1cb8('0x14')];this[_0x1cb8('0x15')]=_0x41b867[_0x1cb8('0x15')];this[_0x1cb8('0x16')]=_0x41b867[_0x1cb8('0x16')];this[_0x1cb8('0x17')]=_0x41b867[_0x1cb8('0x17')];this[_0x1cb8('0x18')]=_0x41b867[_0x1cb8('0x17')];this[_0x1cb8('0x19')]=_0x41b867['ringtime']||0x0;this[_0x1cb8('0x1a')]=_0x41b867[_0x1cb8('0x1a')]||0x0;this[_0x1cb8('0x1b')]=_0x41b867[_0x1cb8('0x1b')]||0x0;this['callback']=_0x41b867[_0x1cb8('0x1c')];this['callbackuniqueid']=_0x41b867[_0x1cb8('0x1d')];this[_0x1cb8('0x1e')]=_0x41b867[_0x1cb8('0x1e')];this[_0x1cb8('0x1f')]=_0x41b867['recallme'];this['ContactId']=_0x41b867[_0x1cb8('0x20')];this[_0x1cb8('0x21')]=_0x41b867[_0x1cb8('0x21')];this[_0x1cb8('0x22')]=_0x41b867[_0x1cb8('0x22')];this[_0x1cb8('0x23')]=_0x41b867[_0x1cb8('0x23')];this['CampaignId']=_0x41b867[_0x1cb8('0x24')];this[_0x1cb8('0x25')]=_0x41b867[_0x1cb8('0x25')]||'';this[_0x1cb8('0x26')]=_0x41b867[_0x1cb8('0x26')]||'';}module[_0x1cb8('0x27')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 4f1d58d..919b1c3 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 _0x1975=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','name','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','outbound'];(function(_0x479691,_0x1002be){var _0x32a5c1=function(_0x2753f4){while(--_0x2753f4){_0x479691['push'](_0x479691['shift']());}};_0x32a5c1(++_0x1002be);}(_0x1975,0xc2));var _0x5197=function(_0x47c89e,_0x18692c){_0x47c89e=_0x47c89e-0x0;var _0x1de51e=_0x1975[_0x47c89e];return _0x1de51e;};'use strict';var util=require(_0x5197('0x0'));var _=require(_0x5197('0x1'));var moment=require(_0x5197('0x2'));function getSeconds(_0xf29df9,_0x30eccc){var _0x30c6ee=moment(_0xf29df9)[_0x5197('0x3')](0x0);var _0x292c6d=moment(_0x30eccc)[_0x5197('0x3')](0x0);return _0x30c6ee[_0x5197('0x4')](_0x292c6d,'seconds');}function Hangup(_0x22ec87,_0x530864){this[_0x5197('0x5')]=0x4;this[_0x5197('0x6')]=_0x5197('0x7');this[_0x5197('0x8')]=_0x22ec87['scheduledat'];this[_0x5197('0x9')]=_0x22ec87[_0x5197('0x9')];this['campaigntype']=_0x22ec87[_0x5197('0x9')]===_0x5197('0xa')?_0x5197('0xb'):_0x22ec87[_0x5197('0x9')];this[_0x5197('0xc')]=_0x22ec87['countbusyretry'];this[_0x5197('0xd')]=_0x22ec87[_0x5197('0xd')];this[_0x5197('0xe')]=_0x22ec87[_0x5197('0xe')];this[_0x5197('0xf')]=_0x22ec87[_0x5197('0xc')]+_0x22ec87[_0x5197('0xd')]+_0x22ec87[_0x5197('0xe')]+_0x22ec87[_0x5197('0x10')]+_0x22ec87['countdropretry']+_0x22ec87['countabandonedretry']+_0x22ec87[_0x5197('0x11')]+_0x22ec87[_0x5197('0x12')];this['countnosuchnumberretry']=_0x22ec87[_0x5197('0x10')];this[_0x5197('0x13')]=_0x22ec87[_0x5197('0x13')];this[_0x5197('0x14')]=_0x22ec87['countabandonedretry'];this[_0x5197('0x11')]=_0x22ec87[_0x5197('0x11')];this['countagentrejectretry']=_0x22ec87[_0x5197('0x12')];this['uniqueid']=_0x530864['uniqueid'];this[_0x5197('0x15')]=_0x22ec87[_0x5197('0x16')];this['calleridnum']=_0x22ec87[_0x5197('0x17')];this[_0x5197('0x18')]=_0x22ec87[_0x5197('0x18')];this[_0x5197('0x19')]=_0x22ec87[_0x5197('0x19')];this[_0x5197('0x1a')]=moment()['format'](_0x5197('0x1b'));this[_0x5197('0x1c')]=getSeconds(_0x22ec87[_0x5197('0x19')],_0x22ec87[_0x5197('0x18')]);this[_0x5197('0x1d')]=0x0;this[_0x5197('0x1e')]=getSeconds(this[_0x5197('0x1a')],_0x22ec87[_0x5197('0x19')]);this['queue']=_0x22ec87[_0x5197('0xb')];this['membername']='IVR';this[_0x5197('0x1f')]=_0x530864[_0x5197('0x20')];this[_0x5197('0x21')]=_0x22ec87[_0x5197('0x21')];this[_0x5197('0x22')]=_0x22ec87[_0x5197('0x22')];this[_0x5197('0x23')]=_0x22ec87[_0x5197('0x23')];this[_0x5197('0x24')]=_0x22ec87[_0x5197('0x24')];this[_0x5197('0x25')]=_0x22ec87[_0x5197('0x25')];this[_0x5197('0x26')]=_0x22ec87[_0x5197('0x26')];this['UserId']=_0x22ec87['UserId'];this['VoiceQueueId']=_0x22ec87[_0x5197('0x27')];this[_0x5197('0x28')]=_0x22ec87[_0x5197('0x28')];}module['exports']=Hangup; \ No newline at end of file +var _0x2d2f=['scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','endtime','queue','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','milliseconds','diff','state','statedesc'];(function(_0x3680a0,_0x22a0cb){var _0x45f17a=function(_0x3c3c5c){while(--_0x3c3c5c){_0x3680a0['push'](_0x3680a0['shift']());}};_0x45f17a(++_0x22a0cb);}(_0x2d2f,0x143));var _0xf2d2=function(_0x2bcc57,_0x29757a){_0x2bcc57=_0x2bcc57-0x0;var _0x2a7387=_0x2d2f[_0x2bcc57];return _0x2a7387;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xf2d2('0x0'));function getSeconds(_0x16aaa3,_0x5ae2c4){var _0x390d11=moment(_0x16aaa3)[_0xf2d2('0x1')](0x0);var _0x1fa97a=moment(_0x5ae2c4)[_0xf2d2('0x1')](0x0);return _0x390d11[_0xf2d2('0x2')](_0x1fa97a,'seconds');}function Hangup(_0x4dcbec,_0x220c4e){this[_0xf2d2('0x3')]=0x4;this[_0xf2d2('0x4')]='Answer';this[_0xf2d2('0x5')]=_0x4dcbec[_0xf2d2('0x5')];this[_0xf2d2('0x6')]=_0x4dcbec['type'];this[_0xf2d2('0x7')]=_0x4dcbec['type']==='outbound'?'queue':_0x4dcbec[_0xf2d2('0x6')];this[_0xf2d2('0x8')]=_0x4dcbec[_0xf2d2('0x8')];this[_0xf2d2('0x9')]=_0x4dcbec[_0xf2d2('0x9')];this[_0xf2d2('0xa')]=_0x4dcbec[_0xf2d2('0xa')];this[_0xf2d2('0xb')]=_0x4dcbec[_0xf2d2('0x8')]+_0x4dcbec[_0xf2d2('0x9')]+_0x4dcbec[_0xf2d2('0xa')]+_0x4dcbec['countnosuchnumberretry']+_0x4dcbec['countdropretry']+_0x4dcbec[_0xf2d2('0xc')]+_0x4dcbec[_0xf2d2('0xd')]+_0x4dcbec['countagentrejectretry'];this[_0xf2d2('0xe')]=_0x4dcbec[_0xf2d2('0xe')];this['countdropretry']=_0x4dcbec[_0xf2d2('0xf')];this['countabandonedretry']=_0x4dcbec[_0xf2d2('0xc')];this['countmachineretry']=_0x4dcbec[_0xf2d2('0xd')];this['countagentrejectretry']=_0x4dcbec[_0xf2d2('0x10')];this[_0xf2d2('0x11')]=_0x220c4e['uniqueid'];this[_0xf2d2('0x12')]=_0x4dcbec[_0xf2d2('0x13')];this[_0xf2d2('0x14')]=_0x4dcbec['number'];this[_0xf2d2('0x15')]=_0x4dcbec[_0xf2d2('0x15')];this['responsetime']=_0x4dcbec[_0xf2d2('0x16')];this['endtime']=moment()[_0xf2d2('0x17')](_0xf2d2('0x18'));this['ringtime']=getSeconds(_0x4dcbec[_0xf2d2('0x16')],_0x4dcbec['starttime']);this[_0xf2d2('0x19')]=0x0;this[_0xf2d2('0x1a')]=getSeconds(this[_0xf2d2('0x1b')],_0x4dcbec[_0xf2d2('0x16')]);this[_0xf2d2('0x1c')]=_0x4dcbec[_0xf2d2('0x1c')];this['membername']=_0xf2d2('0x1d');this[_0xf2d2('0x1e')]=_0x220c4e[_0xf2d2('0x1f')];this[_0xf2d2('0x20')]=_0x4dcbec[_0xf2d2('0x20')];this[_0xf2d2('0x21')]=_0x4dcbec[_0xf2d2('0x21')];this[_0xf2d2('0x22')]=_0x4dcbec[_0xf2d2('0x22')];this[_0xf2d2('0x23')]=_0x4dcbec[_0xf2d2('0x23')];this[_0xf2d2('0x24')]=_0x4dcbec[_0xf2d2('0x24')];this['ListId']=_0x4dcbec[_0xf2d2('0x25')];this[_0xf2d2('0x26')]=_0x4dcbec[_0xf2d2('0x26')];this[_0xf2d2('0x27')]=_0x4dcbec[_0xf2d2('0x27')];this[_0xf2d2('0x28')]=_0x4dcbec[_0xf2d2('0x28')];}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 cc2df4d..1743ee4 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 _0x8260=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','name','calleridnum','number','starttime','endtime','ringtime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype'];(function(_0x1665e2,_0x34f3d6){var _0x5416f3=function(_0x172490){while(--_0x172490){_0x1665e2['push'](_0x1665e2['shift']());}};_0x5416f3(++_0x34f3d6);}(_0x8260,0x1c4));var _0x0826=function(_0x7d1b89,_0x58faa5){_0x7d1b89=_0x7d1b89-0x0;var _0x435a5b=_0x8260[_0x7d1b89];return _0x435a5b;};'use strict';var util=require(_0x0826('0x0'));var _=require(_0x0826('0x1'));var moment=require(_0x0826('0x2'));function getSeconds(_0x38adca,_0x576c5e){var _0x54ac2c=moment(_0x38adca)[_0x0826('0x3')](0x0);var _0x1dbb16=moment(_0x576c5e)[_0x0826('0x3')](0x0);return _0x54ac2c[_0x0826('0x4')](_0x1dbb16,_0x0826('0x5'));}function History(_0x472a56){this['uniqueid']=_0x472a56[_0x0826('0x6')];this['scheduledat']=_0x472a56[_0x0826('0x7')]||undefined;this[_0x0826('0x8')]=_0x472a56[_0x0826('0x8')];this[_0x0826('0x9')]=_0x472a56[_0x0826('0x8')]==='outbound'?'queue':_0x472a56[_0x0826('0x8')];this[_0x0826('0xa')]=_0x472a56[_0x0826('0xa')];this[_0x0826('0xb')]=_0x472a56[_0x0826('0xb')];this[_0x0826('0xc')]=_0x472a56[_0x0826('0xc')];this[_0x0826('0xd')]=_0x472a56[_0x0826('0xa')]+_0x472a56[_0x0826('0xb')]+_0x472a56[_0x0826('0xc')]+_0x472a56[_0x0826('0xe')]+_0x472a56[_0x0826('0xf')]+_0x472a56[_0x0826('0x10')]+_0x472a56[_0x0826('0x11')]+_0x472a56[_0x0826('0x12')];this['countnosuchnumberretry']=_0x472a56['countnosuchnumberretry'];this[_0x0826('0xf')]=_0x472a56[_0x0826('0xf')];this['countabandonedretry']=_0x472a56[_0x0826('0x10')];this['countmachineretry']=_0x472a56[_0x0826('0x11')];this['countagentrejectretry']=_0x472a56['countagentrejectretry'];this['queue']=_0x472a56[_0x0826('0x13')];this[_0x0826('0x14')]=_0x472a56[_0x0826('0x15')];this[_0x0826('0x16')]=_0x472a56[_0x0826('0x17')];this[_0x0826('0x18')]=_0x472a56[_0x0826('0x18')];this['responsetime']=_0x472a56['responsetime'];this[_0x0826('0x19')]=_0x472a56['responsetime'];this[_0x0826('0x1a')]=getSeconds(_0x472a56[_0x0826('0x1b')],_0x472a56['starttime']);this[_0x0826('0x1c')]=0x0;this[_0x0826('0x1d')]=0x0;this['callback']=_0x472a56[_0x0826('0x1e')];this[_0x0826('0x1f')]=_0x472a56[_0x0826('0x1f')];this['callbackat']=_0x472a56[_0x0826('0x20')];this[_0x0826('0x21')]=_0x472a56[_0x0826('0x21')];this[_0x0826('0x22')]=_0x472a56[_0x0826('0x22')];this['ListId']=_0x472a56[_0x0826('0x23')];this['UserId']=_0x472a56[_0x0826('0x24')];this[_0x0826('0x25')]=_0x472a56[_0x0826('0x25')];this[_0x0826('0x26')]=_0x472a56[_0x0826('0x26')];this[_0x0826('0x27')]=_0x472a56[_0x0826('0x27')]||'';this[_0x0826('0x28')]=_0x472a56[_0x0826('0x28')]||'';}module[_0x0826('0x29')]=History; \ No newline at end of file +var _0x799c=['type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','uniqueid','scheduledat'];(function(_0x2b1680,_0x1be7f8){var _0x3d949f=function(_0x2ac283){while(--_0x2ac283){_0x2b1680['push'](_0x2b1680['shift']());}};_0x3d949f(++_0x1be7f8);}(_0x799c,0xfe));var _0xc799=function(_0x1f477a,_0x493328){_0x1f477a=_0x1f477a-0x0;var _0x36dee4=_0x799c[_0x1f477a];return _0x36dee4;};'use strict';var util=require(_0xc799('0x0'));var _=require(_0xc799('0x1'));var moment=require(_0xc799('0x2'));function getSeconds(_0x468021,_0x1df24f){var _0x5b2f9a=moment(_0x468021)['milliseconds'](0x0);var _0x496001=moment(_0x1df24f)['milliseconds'](0x0);return _0x5b2f9a['diff'](_0x496001,'seconds');}function History(_0x297939){this[_0xc799('0x3')]=_0x297939['uniqueid'];this[_0xc799('0x4')]=_0x297939[_0xc799('0x4')]||undefined;this['type']=_0x297939[_0xc799('0x5')];this[_0xc799('0x6')]=_0x297939[_0xc799('0x5')]==='outbound'?_0xc799('0x7'):_0x297939[_0xc799('0x5')];this[_0xc799('0x8')]=_0x297939['countbusyretry'];this[_0xc799('0x9')]=_0x297939[_0xc799('0x9')];this[_0xc799('0xa')]=_0x297939[_0xc799('0xa')];this[_0xc799('0xb')]=_0x297939[_0xc799('0x8')]+_0x297939['countcongestionretry']+_0x297939['countnoanswerretry']+_0x297939[_0xc799('0xc')]+_0x297939['countdropretry']+_0x297939[_0xc799('0xd')]+_0x297939[_0xc799('0xe')]+_0x297939[_0xc799('0xf')];this['countnosuchnumberretry']=_0x297939[_0xc799('0xc')];this[_0xc799('0x10')]=_0x297939['countdropretry'];this[_0xc799('0xd')]=_0x297939[_0xc799('0xd')];this[_0xc799('0xe')]=_0x297939[_0xc799('0xe')];this[_0xc799('0xf')]=_0x297939['countagentrejectretry'];this[_0xc799('0x7')]=_0x297939[_0xc799('0x7')];this[_0xc799('0x11')]=_0x297939[_0xc799('0x12')];this[_0xc799('0x13')]=_0x297939[_0xc799('0x14')];this[_0xc799('0x15')]=_0x297939['starttime'];this[_0xc799('0x16')]=_0x297939[_0xc799('0x16')];this['endtime']=_0x297939['responsetime'];this[_0xc799('0x17')]=getSeconds(_0x297939[_0xc799('0x16')],_0x297939[_0xc799('0x15')]);this[_0xc799('0x18')]=0x0;this[_0xc799('0x19')]=0x0;this[_0xc799('0x1a')]=_0x297939['callback'];this['callbackuniqueid']=_0x297939[_0xc799('0x1b')];this[_0xc799('0x1c')]=_0x297939[_0xc799('0x1c')];this['recallme']=_0x297939[_0xc799('0x1d')];this[_0xc799('0x1e')]=_0x297939['ContactId'];this[_0xc799('0x1f')]=_0x297939['ListId'];this[_0xc799('0x20')]=_0x297939[_0xc799('0x20')];this[_0xc799('0x21')]=_0x297939['VoiceQueueId'];this['CampaignId']=_0x297939[_0xc799('0x22')];this[_0xc799('0x23')]=_0x297939[_0xc799('0x23')]||'';this[_0xc799('0x24')]=_0x297939[_0xc799('0x24')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 6c05487..43965bc 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 _0xcbd7=['calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','locked','paused','stateinterface','rrmemory','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\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','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','dialMethod','power','handlePower','dialPowerLevel','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','random','match','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','dialQueueOptions','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','substring','from-sip','[originateError]:\x20%s','originate\x20action\x20Error','responsetime','getQueue','response','callProgressDetecting','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','AgentReject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','getVoiceQueueRtPauses','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','ACTIVE','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[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]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./queueCallerAbandon','env','roundrobin','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','queuecallerabandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','message','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','Error','stringify','milliseconds','seconds','emit','outbound','answered','available','loggedIn','pTalking','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','type','ivr','campaign:ivr:%s','campaign:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','originated','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','[getContactDialer2][ReScheduled]','contacts','talking','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','starttime','uniqueId','[uniqueid]','[actions]','enqueue','isNil','Action','status','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','isTrunkReachable','trunks','SIP/%s','reachable','unmonitored','uniqueid','amdstatus','exten','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','amd','saveInDb','[syncHangupInAMD]','Machine','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','custom:amd','buildObj','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countdropretry','dialGlobalMaxRetry','dialMachineRetryFrequency','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','reason','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','dialQueueTimeout','Drop','dropreason','agiafterat','dialDropMaxRetry','endtime'];(function(_0x20713e,_0x44f710){var _0x7d998b=function(_0x5d98ab){while(--_0x5d98ab){_0x20713e['push'](_0x20713e['shift']());}};_0x7d998b(++_0x44f710);}(_0xcbd7,0xff));var _0x7cbd=function(_0x753e54,_0x479967){_0x753e54=_0x753e54-0x0;var _0x24de60=_0xcbd7[_0x753e54];return _0x24de60;};'use strict';var util=require(_0x7cbd('0x0'));var _=require(_0x7cbd('0x1'));var BPromise=require(_0x7cbd('0x2'));var uuid=require(_0x7cbd('0x3'));var moment=require(_0x7cbd('0x4'));var rr=require('rr');var md5=require(_0x7cbd('0x5'));var Redis=require(_0x7cbd('0x6'));var ut=require(_0x7cbd('0x7'));var config=require(_0x7cbd('0x8'));var logger=require(_0x7cbd('0x9'))(_0x7cbd('0xa'));var loggerBooked=require(_0x7cbd('0x9'))(_0x7cbd('0xb'));var loggerPredictive=require(_0x7cbd('0x9'))(_0x7cbd('0xc'));var loggerPredictiveCalls=require('../../../config/logger')(_0x7cbd('0xd'));var loggerSyncQueueSummary=require(_0x7cbd('0x9'))(_0x7cbd('0xe'));var ami=require('../ami');config['redis']=_[_0x7cbd('0xf')](config['redis'],{'host':_0x7cbd('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x7cbd('0x11'));var cmHopperHistory=require(_0x7cbd('0x12'));var cmHopperBlack=require(_0x7cbd('0x13'));var voiceQueueRt=require(_0x7cbd('0x14'));var RpcSetting=require(_0x7cbd('0x15'));var Action=require(_0x7cbd('0x16'));var History=require(_0x7cbd('0x17'));var Final=require(_0x7cbd('0x18'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x7cbd('0x19'));var Hangup=require('./hangup');var ipAgi=process[_0x7cbd('0x1a')]['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0x7cbd('0x1b')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x7cbd('0x1c')]['enqueue']=function(_0x265595){this[_0x7cbd('0x1d')]=this[_0x7cbd('0x1d')]?this[_0x7cbd('0x1d')][_0x7cbd('0x1e')](_0x265595):_0x265595();};function Dialer(_0x51b0d6,_0x8442b0){this[_0x7cbd('0x1f')]=new Sequence();this['preview']=_0x8442b0;this[_0x7cbd('0x20')]=_0x51b0d6['voiceQueues'];this[_0x7cbd('0x21')]=_0x51b0d6[_0x7cbd('0x21')];this['agents']=_0x51b0d6[_0x7cbd('0x22')];this['trunks']=_0x51b0d6['trunks'];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0x7cbd('0x23')]={};this[_0x7cbd('0x24')]={};this[_0x7cbd('0x25')]={};this['uniqueId']={};this[_0x7cbd('0x26')]={};this[_0x7cbd('0x27')]={};this[_0x7cbd('0x28')]={};this[_0x7cbd('0x29')]={};this[_0x7cbd('0x2a')]={};this['queueBookedRR']={};ami['on'](_0x7cbd('0x2b'),this[_0x7cbd('0x2c')]['bind'](this));ami['on'](_0x7cbd('0x2d'),this['syncQueueCallerAbandon'][_0x7cbd('0x2e')](this));ami['on'](_0x7cbd('0x2f'),this[_0x7cbd('0x30')]['bind'](this));ami['on'](_0x7cbd('0x31'),this[_0x7cbd('0x32')][_0x7cbd('0x2e')](this));ami['on'](_0x7cbd('0x33'),this[_0x7cbd('0xe')][_0x7cbd('0x2e')](this));ami['on'](_0x7cbd('0x34'),this[_0x7cbd('0x35')]['bind'](this));ami['on'](_0x7cbd('0x36'),this[_0x7cbd('0x37')][_0x7cbd('0x2e')](this));ami['on'](_0x7cbd('0x38'),this[_0x7cbd('0x39')][_0x7cbd('0x2e')](this));ami['on'](_0x7cbd('0x3a'),this[_0x7cbd('0x3b')][_0x7cbd('0x2e')](this));ami['on'](_0x7cbd('0x3c'),this['syncQueueStatusComplete'][_0x7cbd('0x2e')](this));this['loopCampaigns']();this[_0x7cbd('0x3d')]();RpcSetting['getSettings']()[_0x7cbd('0x3e')](function(_0x59b302){previewRecallmeReminderInterval=_0x59b302[_0x7cbd('0x3f')];});}function isNotNull(_0x51174b){return _0x51174b!==null&&!_[_0x7cbd('0x40')](_0x51174b);}function checkIsLoggedIn(_0xed1947,_0x330b12){return function(){if(_0x330b12<=0x0){_0xed1947['message']=_0x7cbd('0x41');throw _0xed1947[_0x7cbd('0x42')]+_0x7cbd('0x43');}};}function isActive(_0x55cb9a){return _0x55cb9a;}function checkIsActive(_0x5dc769,_0x2b27a4){return function(){if(!isActive(_0x2b27a4)){_0x5dc769['message']=_0x7cbd('0x44');throw _0x5dc769['name']+_0x7cbd('0x45');}};}function checkInterval(_0x44f15b){return function(){if(!isNotNull(_0x44f15b['Interval'])){_0x44f15b[_0x7cbd('0x46')]=_0x7cbd('0x47');throw _0x44f15b['name']+_0x7cbd('0x48');}if(!isNotNull(_0x44f15b[_0x7cbd('0x49')][_0x7cbd('0x4a')])){_0x44f15b[_0x7cbd('0x46')]='INTERVAL_IS_NULL';throw _0x44f15b['name']+_0x7cbd('0x48');}if(!isNotNull(_['isEmpty'](_0x44f15b[_0x7cbd('0x49')][_0x7cbd('0x4a')]))){_0x44f15b[_0x7cbd('0x46')]=_0x7cbd('0x47');throw _0x44f15b['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x112fd8,_0x9979dc,_0x416b23){return{'action':_0x112fd8,'response':_0x9979dc,'message':_0x416b23,'stack':_0x416b23};}function myreject(_0x5db59c){return function(_0x1b7323){return _0x5db59c(msgResponse('[ifTime][Action]',_0x7cbd('0x4b'),JSON[_0x7cbd('0x4c')](_0x1b7323)));};}function getSeconds(_0x264861,_0x372626){var _0x26dac2=moment(_0x264861)[_0x7cbd('0x4d')](0x0);var _0x1057cc=moment(_0x372626)[_0x7cbd('0x4d')](0x0);return _0x26dac2['diff'](_0x1057cc,_0x7cbd('0x4e'));}function emit(_0xcccdbf,_0x1c8273,_0x375e81){io['to'](_0xcccdbf)[_0x7cbd('0x4f')](_0x1c8273,_0x375e81);}function emitVoiceQueueSummary(_0xda0e50){if(_0xda0e50['type']===_0x7cbd('0x50')){var _0x3eec88={'id':_0xda0e50['id'],'name':_0xda0e50[_0x7cbd('0x42')],'strategy':_0xda0e50['strategy'],'answered':_0xda0e50[_0x7cbd('0x51')],'available':_0xda0e50[_0x7cbd('0x52')],'loggedIn':_0xda0e50[_0x7cbd('0x53')],'pTalking':_0xda0e50[_0x7cbd('0x54')],'sumBillable':_0xda0e50['sumBillable'],'sumDuration':_0xda0e50['sumDuration'],'sumHoldTime':_0xda0e50[_0x7cbd('0x55')]||0x0,'talking':_0xda0e50['talking'],'total':_0xda0e50[_0x7cbd('0x56')],'type':_0xda0e50['type'],'unmanaged':_0xda0e50[_0x7cbd('0x57')],'abandoned':_0xda0e50[_0x7cbd('0x58')],'waiting':_0xda0e50[_0x7cbd('0x59')],'loggedInDb':_0xda0e50[_0x7cbd('0x5a')],'dialActive':_0xda0e50[_0x7cbd('0x5b')],'dialMethod':_0xda0e50['dialMethod'],'dialOriginateCallerIdName':_0xda0e50[_0x7cbd('0x5c')],'dialOriginateCallerIdNumber':_0xda0e50[_0x7cbd('0x5d')],'dialOriginateTimeout':_0xda0e50[_0x7cbd('0x5e')],'dialPrefix':_0xda0e50[_0x7cbd('0x5f')],'outboundAnswerAgiCallsDay':_0xda0e50[_0x7cbd('0x60')],'outboundAnswerCallsDay':_0xda0e50[_0x7cbd('0x61')],'outboundBlacklistCallsDay':_0xda0e50['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0xda0e50[_0x7cbd('0x62')],'outboundCongestionCallsDay':_0xda0e50[_0x7cbd('0x63')],'outboundDropCallsDayACS':_0xda0e50[_0x7cbd('0x64')],'outboundDropCallsDayCallersExit':_0xda0e50[_0x7cbd('0x65')],'outboundDropCallsDayTimeout':_0xda0e50[_0x7cbd('0x66')],'outboundNoAnswerCallsDay':_0xda0e50['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xda0e50[_0x7cbd('0x67')],'outboundOriginateFailureCallsDay':_0xda0e50[_0x7cbd('0x68')],'outboundReCallsDay':_0xda0e50[_0x7cbd('0x69')],'outboundRejectCallsDay':_0xda0e50[_0x7cbd('0x6a')],'outboundUnknownCallsDay':_0xda0e50['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0xda0e50[_0x7cbd('0x6b')],'predictiveIntervalAvgHoldtime':_0xda0e50[_0x7cbd('0x6c')],'predictiveIntervalAvgTalktime':_0xda0e50['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0xda0e50[_0x7cbd('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0xda0e50[_0x7cbd('0x6e')],'predictiveIntervalErlangCalls':_0xda0e50[_0x7cbd('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0xda0e50[_0x7cbd('0x70')],'predictiveIntervalHitRate':_0xda0e50[_0x7cbd('0x71')],'predictiveIntervalMultiplicativeFactor':_0xda0e50['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0xda0e50[_0x7cbd('0x72')],'predictiveIntervalAvailable':_0xda0e50['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0xda0e50[_0x7cbd('0x73')],'message':_0xda0e50[_0x7cbd('0x46')],'originated':_0xda0e50['originated'],'erlangCalls':_0xda0e50[_0x7cbd('0x74')],'erlangCallToSecond':_0xda0e50['erlangCallToSecond'],'erlangAbandonmentRate':_0xda0e50[_0x7cbd('0x75')],'erlangBusyFactor':_0xda0e50[_0x7cbd('0x76')],'startPredictive':_0xda0e50[_0x7cbd('0x27')],'startProgressive':_0xda0e50['startProgressive']};if(_0xda0e50[_0x7cbd('0x77')]){_0x3eec88['Trunk']={'id':_0xda0e50[_0x7cbd('0x77')]['id'],'name':_0xda0e50[_0x7cbd('0x77')][_0x7cbd('0x42')],'active':_0xda0e50[_0x7cbd('0x77')][_0x7cbd('0x78')],'callerid':_0xda0e50[_0x7cbd('0x77')][_0x7cbd('0x79')]};}if(_0xda0e50[_0x7cbd('0x49')]){_0x3eec88[_0x7cbd('0x49')]={'id':_0xda0e50[_0x7cbd('0x49')]['id'],'name':_0xda0e50['Interval'][_0x7cbd('0x42')]};}var _0x41c277=md5(JSON[_0x7cbd('0x4c')](_0x3eec88));if(_0xda0e50[_0x7cbd('0x5')]!==_0x41c277){_0xda0e50[_0x7cbd('0x5')]=_0x41c277;emit(util[_0x7cbd('0x7a')](_0x7cbd('0x7b'),_0x3eec88['name']),_0x7cbd('0x7c'),_0x3eec88);}}}function emitCampaignSummary(_0x41a7b4){if(_0x41a7b4[_0x7cbd('0x7d')]===_0x7cbd('0x7e')){emit(util[_0x7cbd('0x7a')](_0x7cbd('0x7f'),_0x41a7b4[_0x7cbd('0x42')]),_0x7cbd('0x80'),_0x41a7b4);}}function checkGetDataPredictive(_0xf7bf9d){if(isNotNull(_0xf7bf9d)&&!_[_0x7cbd('0x81')](_0xf7bf9d)){loggerPredictive[_0x7cbd('0x82')](_0x7cbd('0x83'));loggerPredictive[_0x7cbd('0x82')](_0x7cbd('0x84'),_0xf7bf9d[_0x7cbd('0x73')]);loggerPredictive[_0x7cbd('0x82')](_0x7cbd('0x85'),_0xf7bf9d[_0x7cbd('0x6b')]);loggerPredictive[_0x7cbd('0x82')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf7bf9d[_0x7cbd('0x6e')]);loggerPredictive['info'](_0x7cbd('0x86'),_0xf7bf9d['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x7cbd('0x82')](_0x7cbd('0x87'),_0xf7bf9d[_0x7cbd('0x6c')]);loggerPredictive[_0x7cbd('0x82')](_0x7cbd('0x88'),_0xf7bf9d[_0x7cbd('0x89')]);loggerPredictive[_0x7cbd('0x82')](_0x7cbd('0x8a'));if(_0xf7bf9d[_0x7cbd('0x73')]>0x0){if(!_[_0x7cbd('0x40')](_0xf7bf9d[_0x7cbd('0x89')])&&_0xf7bf9d[_0x7cbd('0x89')]>0x0){return!![];}loggerPredictive[_0x7cbd('0x82')](_0x7cbd('0x8b'));if(!_[_0x7cbd('0x40')](_0xf7bf9d['predictiveIntervalAvgHoldtime'])&&_0xf7bf9d[_0x7cbd('0x6c')]>0x0){return!![];}loggerPredictive[_0x7cbd('0x82')](_0x7cbd('0x8c'));}else{loggerPredictive[_0x7cbd('0x82')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x7cbd('0x8d'));}return![];}function mergeDataErlangB(_0x7f18d4){return function(_0x3c42d3){loggerPredictive[_0x7cbd('0x82')](_0x7cbd('0x8e'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3c42d3[_0x7cbd('0x74')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3c42d3[_0x7cbd('0x8f')]);loggerPredictive[_0x7cbd('0x82')](_0x7cbd('0x90'),_0x3c42d3[_0x7cbd('0x75')]);loggerPredictive[_0x7cbd('0x82')](_0x7cbd('0x91'),_0x3c42d3[_0x7cbd('0x76')]);loggerPredictive[_0x7cbd('0x82')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3c42d3[_0x7cbd('0x75')]);loggerPredictive[_0x7cbd('0x82')]('---------------------------');_[_0x7cbd('0x92')](_0x7f18d4,_0x3c42d3);};}function getDiff(_0xba9f1b){var _0x36a984=moment()['milliseconds'](0x0);var _0x411c03=moment(_0xba9f1b)['milliseconds'](0x0);return _0x36a984['diff'](_0x411c03,_0x7cbd('0x4e'));}function ifInterval(_0x4a0655,_0x101193){if(_['isUndefined'](_0x101193)){return![];}return getDiff(_0x101193)<_0x4a0655*0x3c;}function freeVariablesPredictive(_0x562ae9){if(isNotNull(_0x562ae9)){if(!_[_0x7cbd('0x40')](_0x562ae9[_0x7cbd('0x28')])){_0x562ae9[_0x7cbd('0x28')]=undefined;loggerPredictive[_0x7cbd('0x82')](_0x562ae9['name'],_0x7cbd('0x93'));}if(!_[_0x7cbd('0x40')](_0x562ae9[_0x7cbd('0x27')])){_0x562ae9[_0x7cbd('0x27')]=undefined;loggerPredictive[_0x7cbd('0x82')](_0x562ae9[_0x7cbd('0x42')],_0x7cbd('0x94'));}if(!_['isUndefined'](_0x562ae9[_0x7cbd('0x95')])){clearInterval(_0x562ae9[_0x7cbd('0x95')]);_0x562ae9['handlePredictive']=undefined;loggerPredictive[_0x7cbd('0x82')](_0x562ae9[_0x7cbd('0x42')],_0x7cbd('0x96'));}}}function erlangb(_0x51f439,_0xe0f797){if(_0xe0f797===0x0){return 0x0;}var _0x4e07aa=0x1;for(var _0x17d31c=0x1;_0x17d31c<=_0xe0f797;_0x17d31c+=0x1){_0x4e07aa=0x1+_0x4e07aa*_0x17d31c/_0x51f439;}return 0x1/_0x4e07aa;}function isVoiceQueueOutbound(_0x32d2bd){return _0x32d2bd===_0x7cbd('0x50');}function isNotPreview(_0x3f1cf5){return _0x3f1cf5!==_0x7cbd('0x97');}function isCampaignIvr(_0xa2d59c){return _0xa2d59c===_0x7cbd('0x7e');}function getCallerId(_0x1f421a,_0x10dd46,_0x34032f){if(!_['isUndefined'](_0x34032f)&&typeof _0x34032f===_0x7cbd('0x98')&&!_[_0x7cbd('0x81')](_0x34032f)){if(!_[_0x7cbd('0x40')](_0x10dd46)&&typeof _0x10dd46==='string'&&!_['isEmpty'](_0x10dd46)){return util[_0x7cbd('0x7a')](_0x7cbd('0x99'),_0x10dd46,_0x34032f);}return util['format']('\x22%s\x22\x20<%s>',_0x34032f,_0x34032f);}if(!_[_0x7cbd('0x40')](_0x1f421a)&&typeof _0x1f421a==='string'&&!_[_0x7cbd('0x81')](_0x1f421a)){return _0x1f421a;}return _0x7cbd('0x9a');}function loggerCatchQueueSummary(_0x3df7f0,_0x579e40){return function(_0x35425b){freeVariablesPredictive(_0x579e40);emitVoiceQueueSummary(_0x579e40);emitCampaignSummary(_0x579e40);loggerSyncQueueSummary[_0x7cbd('0x9b')](_0x3df7f0,util[_0x7cbd('0x9c')](_0x35425b,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1786fe,_0x41f98f){return function(_0x2229d6){loggerPredictive[_0x7cbd('0x9b')](_0x41f98f[_0x7cbd('0x42')],_0x1786fe);loggerPredictive[_0x7cbd('0x9b')](_0x2229d6[_0x7cbd('0x9d')]);freeVariablesPredictive(_0x41f98f);};}function loggerCatch(_0x414cb6){return function(_0x98e687){logger[_0x7cbd('0x9b')](_0x414cb6,util[_0x7cbd('0x9c')](_0x98e687,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x30db33){return _0x30db33&&!_[_0x7cbd('0x40')](_0x30db33)&&_0x30db33[_0x7cbd('0x9e')]>0x0;}function decremetOriginate(_0x558e5b){if(!_[_0x7cbd('0x40')](_0x558e5b)&&_0x558e5b!==null){if(typeof _0x558e5b[_0x7cbd('0x9f')]!==_0x7cbd('0xa0')){if(_0x558e5b['originated']>0x0){_0x558e5b[_0x7cbd('0x9f')]-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x7cbd('0x9b')](_0x7cbd('0xa1'));}}function checkContactLowerLimitOriginate(_0x55e293,_0x430ef1,_0x56c933){if(_0x430ef1>_0x56c933){for(var _0x3c1b2c=0x0;_0x3c1b2c<_0x430ef1-_0x56c933;_0x3c1b2c+=0x1){decremetOriginate(_0x55e293);}}}function loggerGetContactDialer(_0x36f449,_0x95cba8,_0x33dac5){return function(_0x3aa071){checkContactLowerLimitOriginate(_0x95cba8,_0x33dac5,0x0);logger[_0x7cbd('0x9b')](_0x36f449,util[_0x7cbd('0x9c')](_0x3aa071,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x41e6f7){return function(_0x59a00d){if(isNotNull(_0x59a00d)&&isNotNull(_0x59a00d[0x0])){if(_0x59a00d[0x0]['contactsRescheduled']>0x0){_0x41e6f7[_0x7cbd('0x46')]='RESCHEDULED_CONTACTS';logger[_0x7cbd('0x82')](_0x7cbd('0xa2')+_0x41e6f7[_0x7cbd('0x42')],_0x59a00d[0x0]['contactsRescheduled'],_0x7cbd('0xa3'));}else{_0x41e6f7[_0x7cbd('0x46')]='AVAILABLE_CONTACTS_FINISHED';logger['info']('[getContactDialer2][Empty]'+_0x41e6f7[_0x7cbd('0x42')]);}}};}function notSendMessagesQueue(_0x3cf979){if(_0x3cf979['sendMessageOneNotActive']){freeVariablesPredictive(_0x3cf979);if(_0x3cf979[_0x7cbd('0x9f')]===0x0&&_0x3cf979[_0x7cbd('0xa4')]===0x0&&_0x3cf979[_0x7cbd('0x59')]===0x0&&(_0x3cf979[_0x7cbd('0x54')]||0x0)===0x0){_0x3cf979[_0x7cbd('0xa5')]=![];_0x3cf979[_0x7cbd('0x52')]=0x0;_0x3cf979[_0x7cbd('0x46')]=_0x7cbd('0x44');loggerSyncQueueSummary[_0x7cbd('0x9b')](_0x7cbd('0xa6'),_0x3cf979[_0x7cbd('0x42')],_0x7cbd('0xa7'));}else{_0x3cf979['message']=_0x7cbd('0xa8');loggerSyncQueueSummary[_0x7cbd('0x9b')](_0x7cbd('0xa6'),_0x3cf979['name'],_0x7cbd('0xa9'));}emitVoiceQueueSummary(_0x3cf979);}}function notSendMessagesCampaign(_0x7a1743){if(_0x7a1743[_0x7cbd('0xa5')]){if(_0x7a1743['originated']===0x0){_0x7a1743[_0x7cbd('0xa5')]=![];_0x7a1743[_0x7cbd('0x46')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0x7cbd('0xaa'),_0x7a1743[_0x7cbd('0x42')],'is\x20not\x20active');}else{_0x7a1743[_0x7cbd('0x46')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x7cbd('0x9b')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x7a1743[_0x7cbd('0x42')],_0x7cbd('0xa9'));}emitCampaignSummary(_0x7a1743);}}function createObjHistory(_0x5d6a0c,_0x1d0645,_0x43a62c,_0x4c9bb6,_0x19829e){_0x5d6a0c[_0x7cbd('0x46')]=_0x43a62c;var _0x142e35=new Action(_0x5d6a0c,_0x1d0645);var _0x1e70bd=new History(_0x142e35);_0x1e70bd[_0x7cbd('0xab')]=_0x4c9bb6;_0x1e70bd[_0x7cbd('0xac')]=_0x19829e;_0x1e70bd['endtime']=_0x142e35[_0x7cbd('0xad')];return _0x1e70bd;}Dialer[_0x7cbd('0x1c')][_0x7cbd('0x3d')]=function(){var _0x58ca63=this;setInterval(function(){_0x58ca63['clearZombieChannels'](_0x58ca63[_0x7cbd('0xae')],_0x7cbd('0xaf'));_0x58ca63['clearZombieChannels'](_0x58ca63[_0x7cbd('0x24')],_0x7cbd('0xb0'));},0x32c8);};Dialer[_0x7cbd('0x1c')]['clearZombieChannels']=function(_0x247e24,_0x188743){var _0x4b7eb9=this;for(var _0x56f5bb in _0x247e24){if(typeof _0x247e24[_0x56f5bb]!==_0x7cbd('0xa0')){this[_0x7cbd('0x1f')][_0x7cbd('0xb1')](function(){if(!_[_0x7cbd('0xb2')](_0x247e24[_0x56f5bb])){return ami[_0x7cbd('0xb3')]({'action':_0x7cbd('0xb4'),'channel':_0x247e24[_0x56f5bb]['channel']})[_0x7cbd('0xb5')](function(_0x4cac44){if(_0x4cac44[_0x7cbd('0x46')]===_0x7cbd('0xb6')){setTimeout(function(){if(_0x247e24[_0x56f5bb]&&_0x247e24[_0x56f5bb][_0x7cbd('0x7d')]!==_0x7cbd('0x7e')){_0x4b7eb9[_0x7cbd('0xb7')](_0x4b7eb9['voiceQueues'][_0x247e24[_0x56f5bb]['queue']]);logger['error'](_0x7cbd('0xb8'),_0x188743,_0x56f5bb,_0x247e24[_0x56f5bb][_0x7cbd('0xb9')]);delete _0x247e24[_0x56f5bb];}if(_0x247e24[_0x56f5bb]&&_0x247e24[_0x56f5bb][_0x7cbd('0x7d')]==='ivr'){_0x4b7eb9['updateOriginated'](_0x4b7eb9[_0x7cbd('0x21')][_0x247e24[_0x56f5bb][_0x7cbd('0xb9')]]);logger[_0x7cbd('0x9b')](_0x7cbd('0xba'),_0x188743,_0x56f5bb,_0x247e24[_0x56f5bb][_0x7cbd('0xb9')]);delete _0x247e24[_0x56f5bb];}},0x2328);}});}});}}};Dialer[_0x7cbd('0x1c')][_0x7cbd('0xbb')]=function(_0x1eb072){return BPromise[_0x7cbd('0xbc')]()[_0x7cbd('0x3e')](cmHopper[_0x7cbd('0xbb')](_0x1eb072))[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0xbd')));};Dialer[_0x7cbd('0x1c')][_0x7cbd('0xbe')]=function(_0x4250b3){return BPromise[_0x7cbd('0xbc')]()[_0x7cbd('0x3e')](cmHopperBlack[_0x7cbd('0xbe')](_0x4250b3))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x7cbd('0x1c')][_0x7cbd('0xbf')]=function(_0x49bd80){return BPromise[_0x7cbd('0xbc')]()[_0x7cbd('0x3e')](cmHopperBlack[_0x7cbd('0xbf')](_0x49bd80))[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0xc0')));};Dialer[_0x7cbd('0x1c')][_0x7cbd('0xc1')]=function(_0x2708df){return BPromise['resolve']()[_0x7cbd('0x3e')](cmHopperHistory[_0x7cbd('0xc2')](_0x2708df))[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0xc3')));};Dialer[_0x7cbd('0x1c')][_0x7cbd('0xc4')]=function(_0x1d97ac){return BPromise[_0x7cbd('0xbc')]()['then'](cmHopper['rescheduleContact'](_0x1d97ac))['catch'](loggerCatch(_0x7cbd('0xc5')));};Dialer[_0x7cbd('0x1c')][_0x7cbd('0xc6')]=function(_0x1d0eae,_0x4058d8,_0x13b6d2){return BPromise[_0x7cbd('0xbc')]()[_0x7cbd('0x3e')](cmHopper['unlockContact'](_0x1d0eae,_0x4058d8,_0x13b6d2))[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0xc7')));};Dialer['prototype'][_0x7cbd('0xc8')]=function(_0xfd82cd,_0xa867c7,_0x560d6c,_0x572add,_0x4eca84){return BPromise['resolve']()[_0x7cbd('0x3e')](cmHopper[_0x7cbd('0xc8')](_0xfd82cd,_0xa867c7,_0x560d6c,_0x572add))[_0x7cbd('0xb5')](function(_0x277b21){_0x4eca84[_0x7cbd('0xc9')]-=_0x560d6c;_0x4eca84['temp']=_0x4eca84[_0x7cbd('0xc9')]>0x0?_0x4eca84[_0x7cbd('0xc9')]:0x0;loggerCatch(_0x7cbd('0xca'))(_0x277b21);});};Dialer['prototype'][_0x7cbd('0xcb')]=function(_0x36066e,_0x26492d,_0x215636,_0x4f1101){return BPromise[_0x7cbd('0xbc')]()[_0x7cbd('0x3e')](cmHopper[_0x7cbd('0xcb')](_0x36066e,_0x26492d,_0x215636))['catch'](function(_0x2a8fc5){_0x4f1101[_0x7cbd('0xc9')]-=_0x26492d;_0x4f1101['temp']=_0x4f1101[_0x7cbd('0xc9')]>0x0?_0x4f1101[_0x7cbd('0xc9')]:0x0;loggerCatch(_0x7cbd('0xcc'))(_0x2a8fc5);});};Dialer[_0x7cbd('0x1c')]['getVoiceQueueRtPauses']=function(_0x241e4d){return BPromise['resolve']()[_0x7cbd('0x3e')](voiceQueueRt['getVoiceQueueRtPauses'](_0x241e4d))[_0x7cbd('0xb5')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x7cbd('0x1c')][_0x7cbd('0xcd')]=function(_0x2ac13e){return BPromise['resolve']()[_0x7cbd('0x3e')](cmHopper[_0x7cbd('0xcd')](_0x2ac13e))[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0xce')));};Dialer[_0x7cbd('0x1c')]['createHistory']=function(_0x250583){return BPromise[_0x7cbd('0xbc')]()['then'](cmHopperHistory[_0x7cbd('0xcf')](_0x250583))['catch'](loggerCatch(_0x7cbd('0xd0')));};Dialer[_0x7cbd('0x1c')][_0x7cbd('0xb7')]=function(_0x524fca){if(!_[_0x7cbd('0x40')](_0x524fca)&&_0x524fca!==null){if(typeof _0x524fca[_0x7cbd('0x9f')]!=='undefined'){if(_0x524fca[_0x7cbd('0x9f')]>0x0){_0x524fca[_0x7cbd('0x9f')]-=0x1;}else{logger[_0x7cbd('0x9b')](_0x7cbd('0xd1'));}}}else{logger[_0x7cbd('0x9b')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x7cbd('0x1c')][_0x7cbd('0xd2')]=function(_0x2fded9,_0x1fb516){var _0xd25b33=this;return function(_0x62ba83){_0xd25b33[_0x7cbd('0xb7')](_0x1fb516);logger[_0x7cbd('0x9b')](_0x2fded9,util[_0x7cbd('0x9c')](_0x62ba83,{'showHidden':![],'depth':null}));};};Dialer[_0x7cbd('0x1c')][_0x7cbd('0xd3')]=function(_0x101db5,_0x4c1b7a,_0x3ae956){var _0x4c8dd4={'state':0x19,'statedesc':_0x7cbd('0xd4')};this['updateOriginated'](_0x4c1b7a);this['saveInDb'](_[_0x7cbd('0x92')](_0x4c8dd4,_[_0x7cbd('0xd5')](_0x3ae956,[_0x7cbd('0xd6'),_0x7cbd('0xd7'),_0x7cbd('0xd8'),_0x7cbd('0xd9'),_0x7cbd('0xda')])),'[emptyContact][createHistory]',_0x7cbd('0xdb'));logger['error'](_0x101db5);};Dialer[_0x7cbd('0x1c')][_0x7cbd('0xdc')]=function(_0x2a63d4){return _0x2a63d4===_0x7cbd('0xdd');};Dialer[_0x7cbd('0x1c')][_0x7cbd('0xde')]=function(_0x34f867){return!_['isUndefined'](_0x34f867)&&_0x34f867&&!_['isUndefined'](_0x34f867[_0x7cbd('0x42')])&&!_['isUndefined'](_0x34f867[_0x7cbd('0x78')])&&_0x34f867[_0x7cbd('0x78')]&&(this[_0x7cbd('0xdf')][util[_0x7cbd('0x7a')](_0x7cbd('0xe0'),_0x34f867[_0x7cbd('0x42')])][_0x7cbd('0xb4')]===_0x7cbd('0xe1')||this['trunks'][util['format'](_0x7cbd('0xe0'),_0x34f867[_0x7cbd('0x42')])][_0x7cbd('0xb4')]===_0x7cbd('0xe2'));};Dialer[_0x7cbd('0x1c')]['saveInDb']=function(_0x57cfb2,_0x534b75,_0x4da22a){this[_0x7cbd('0xcf')](_0x57cfb2)[_0x7cbd('0xb5')](loggerCatch(_0x534b75));this[_0x7cbd('0xcd')](_0x57cfb2)['catch'](loggerCatch(_0x4da22a));};Dialer['prototype'][_0x7cbd('0x39')]=function(_0x483fd2){var _0x2216fd=this[_0x7cbd('0xae')][_0x483fd2[_0x7cbd('0xe3')]];var _0x30c8c9;if(!_[_0x7cbd('0xb2')](_0x483fd2)&&!_[_0x7cbd('0xb2')](_0x483fd2['variable'])&&!_['isNil'](_0x483fd2['variable'][_0x7cbd('0xe4')])&&_0x483fd2[_0x7cbd('0xe5')]==='xcally-motion-dialer'&&_0x2216fd){if(_0x2216fd[_0x7cbd('0x7d')]!==_0x7cbd('0x7e')&&this[_0x7cbd('0x20')][_0x2216fd[_0x7cbd('0xb9')]][_0x7cbd('0xe6')]&&_0x483fd2[_0x7cbd('0xe7')]===_0x7cbd('0xe8')){delete this[_0x7cbd('0xae')][_0x483fd2[_0x7cbd('0xe3')]];this[_0x7cbd('0xb7')](this[_0x7cbd('0x20')][_0x2216fd['queue']]);this[_0x7cbd('0x20')][_0x2216fd['queue']][_0x7cbd('0x61')]+=0x1;this[_0x7cbd('0x20')][_0x2216fd[_0x7cbd('0xb9')]][_0x7cbd('0x60')]+=0x1;_0x30c8c9=new Hangup(_0x2216fd,_0x483fd2);_0x30c8c9[_0x7cbd('0xab')]=0x12;_0x30c8c9['statedesc']=_0x7cbd('0xe9');_0x30c8c9[_0x7cbd('0xea')]=_0x7cbd('0xeb');ami[_0x7cbd('0x4f')]('custom:amd',ut['buildObj'](_0x30c8c9,_0x7cbd('0xec')));this[_0x7cbd('0xed')](_0x30c8c9,'[syncHangupInAMD][createHistory]',_0x7cbd('0xee'));}if(_0x2216fd[_0x7cbd('0x7d')]!==_0x7cbd('0x7e')&&this[_0x7cbd('0x20')][_0x2216fd[_0x7cbd('0xb9')]][_0x7cbd('0xe6')]&&_0x483fd2[_0x7cbd('0xe7')]==='MACHINE'){var _0x2bd34c=this;return new BPromise(function(_0x40ae4e,_0x8390e3){delete _0x2bd34c['uniqueId'][_0x483fd2['uniqueid']];_0x2bd34c[_0x7cbd('0xb7')](_0x2bd34c[_0x7cbd('0x20')][_0x2216fd[_0x7cbd('0xb9')]]);_0x2bd34c[_0x7cbd('0x20')][_0x2216fd['queue']][_0x7cbd('0x61')]+=0x1;_0x2bd34c[_0x7cbd('0x20')][_0x2216fd[_0x7cbd('0xb9')]][_0x7cbd('0x60')]+=0x1;var _0x53e2fc=_0x2bd34c[_0x7cbd('0x20')][_0x2216fd[_0x7cbd('0xb9')]];var _0x438822=new Hangup(_0x2216fd,_0x483fd2);_0x438822[_0x7cbd('0xab')]=0x13;_0x438822['statedesc']=_0x7cbd('0xef');_0x438822[_0x7cbd('0xea')]=_0x7cbd('0xeb');_0x438822['countmachineretry']+=0x1;_0x438822[_0x7cbd('0xf0')]+=0x1;_0x438822['amd']=!![];ami[_0x7cbd('0x4f')]('custom:amd',ut['buildObj'](_0x438822,_0x7cbd('0xec')));_0x2bd34c['createHistory'](_0x438822)['catch'](loggerCatch(_0x7cbd('0xf1')));if(_0x438822[_0x7cbd('0xf2')]+_0x438822[_0x7cbd('0xf3')]+_0x438822[_0x7cbd('0xf4')]+_0x438822[_0x7cbd('0xf5')]+_0x438822['countdropretry']+_0x438822[_0x7cbd('0xf6')]+_0x438822[_0x7cbd('0xf7')]+_0x438822[_0x7cbd('0xf8')]>=_0x53e2fc['dialGlobalMaxRetry']){_0x2bd34c[_0x7cbd('0xf9')](_0x438822,_0x40ae4e,_0x8390e3,_0x7cbd('0xfa'));}else{if(_0x438822[_0x7cbd('0xf7')]>=_0x53e2fc[_0x7cbd('0xfb')]){_0x2bd34c[_0x7cbd('0xfc')](_0x438822,_0x40ae4e,_0x8390e3,_0x7cbd('0xfd'));}else{_0x2bd34c[_0x7cbd('0xc4')]({'active':![],'countmachineretry':_0x438822[_0x7cbd('0xf7')],'scheduledat':moment()[_0x7cbd('0xfe')](_0x53e2fc['dialMachineRetryFrequency'],_0x7cbd('0xff'))['format'](_0x7cbd('0x100')),'ContactId':_0x438822[_0x7cbd('0xd6')],'ListId':_0x438822[_0x7cbd('0xd7')],'VoiceQueueId':_0x438822[_0x7cbd('0xd9')]||undefined,'CampaignId':_0x438822[_0x7cbd('0xda')]||undefined})[_0x7cbd('0xb5')](loggerCatch('[rescheduleContact][Machine]'));_0x40ae4e({'reschedule':0x1});}}});}if(_0x2216fd[_0x7cbd('0x7d')]===_0x7cbd('0x7e')&&this[_0x7cbd('0x21')][_0x2216fd[_0x7cbd('0xb9')]][_0x7cbd('0xe6')]&&_0x483fd2[_0x7cbd('0xe7')]===_0x7cbd('0xe8')){delete this[_0x7cbd('0xae')][_0x483fd2[_0x7cbd('0xe3')]];this[_0x7cbd('0xb7')](this['campaigns'][_0x2216fd[_0x7cbd('0xb9')]]);_0x30c8c9=new Hangup(_0x2216fd,_0x483fd2);_0x30c8c9[_0x7cbd('0xab')]=0x12;_0x30c8c9[_0x7cbd('0xac')]=_0x7cbd('0xe9');_0x30c8c9[_0x7cbd('0xea')]='AMD';ami[_0x7cbd('0x4f')](_0x7cbd('0x101'),ut[_0x7cbd('0x102')](_0x30c8c9,_0x7cbd('0xec')));this['saveInDb'](_0x30c8c9,_0x7cbd('0x103'),_0x7cbd('0x104'));}if(_0x2216fd[_0x7cbd('0x7d')]==='ivr'&&this[_0x7cbd('0x21')][_0x2216fd['queue']][_0x7cbd('0xe6')]&&_0x483fd2['value']===_0x7cbd('0x105')){var _0x2bd34c=this;return new BPromise(function(_0x1e507f,_0x38ca1a){delete _0x2bd34c[_0x7cbd('0xae')][_0x483fd2['uniqueid']];_0x2bd34c[_0x7cbd('0xb7')](_0x2bd34c[_0x7cbd('0x21')][_0x2216fd[_0x7cbd('0xb9')]]);_0x2bd34c[_0x7cbd('0x21')][_0x2216fd['queue']][_0x7cbd('0x61')]+=0x1;_0x2bd34c[_0x7cbd('0x21')][_0x2216fd[_0x7cbd('0xb9')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x5ea257=_0x2bd34c[_0x7cbd('0x21')][_0x2216fd[_0x7cbd('0xb9')]];var _0x41212f=new Hangup(_0x2216fd,_0x483fd2);_0x41212f[_0x7cbd('0xab')]=0x13;_0x41212f[_0x7cbd('0xac')]='Machine';_0x41212f[_0x7cbd('0xea')]='AMD';_0x41212f[_0x7cbd('0xf7')]+=0x1;_0x41212f[_0x7cbd('0xf0')]+=0x1;_0x41212f[_0x7cbd('0xec')]=!![];ami[_0x7cbd('0x4f')](_0x7cbd('0x101'),ut['buildObj'](_0x41212f,_0x7cbd('0xec')));_0x2bd34c[_0x7cbd('0xcf')](_0x41212f)[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0xf1')));if(_0x41212f[_0x7cbd('0xf2')]+_0x41212f[_0x7cbd('0xf3')]+_0x41212f[_0x7cbd('0xf4')]+_0x41212f[_0x7cbd('0xf5')]+_0x41212f[_0x7cbd('0x106')]+_0x41212f[_0x7cbd('0xf6')]+_0x41212f[_0x7cbd('0xf7')]+_0x41212f[_0x7cbd('0xf8')]>=_0x5ea257[_0x7cbd('0x107')]){_0x2bd34c[_0x7cbd('0xf9')](_0x41212f,_0x1e507f,_0x38ca1a,_0x7cbd('0xfa'));}else{if(_0x41212f[_0x7cbd('0xf7')]>=_0x5ea257['dialMachineMaxRetry']){_0x2bd34c[_0x7cbd('0xfc')](_0x41212f,_0x1e507f,_0x38ca1a,_0x7cbd('0xfd'));}else{_0x2bd34c[_0x7cbd('0xc4')]({'active':![],'countmachineretry':_0x41212f[_0x7cbd('0xf7')],'scheduledat':moment()['add'](_0x5ea257[_0x7cbd('0x108')],_0x7cbd('0xff'))['format'](_0x7cbd('0x100')),'ContactId':_0x41212f[_0x7cbd('0xd6')],'ListId':_0x41212f[_0x7cbd('0xd7')],'VoiceQueueId':_0x41212f[_0x7cbd('0xd9')]||undefined,'CampaignId':_0x41212f['CampaignId']||undefined})['catch'](loggerCatch(_0x7cbd('0x109')));_0x1e507f({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x7cbd('0x35')]=function(_0x3b5e6d){var _0x2ea33b=this[_0x7cbd('0xae')][_0x3b5e6d[_0x7cbd('0xe3')]];var _0x42bd74=this;var _0x215c54;if(_0x2ea33b&&_0x2ea33b[_0x7cbd('0x7d')]===_0x7cbd('0x7e')){delete this[_0x7cbd('0xae')][_0x3b5e6d['uniqueid']];this[_0x7cbd('0xb7')](this[_0x7cbd('0x21')][_0x2ea33b[_0x7cbd('0xb9')]]);this[_0x7cbd('0x21')][_0x2ea33b[_0x7cbd('0xb9')]][_0x7cbd('0x10a')]+=0x1;_0x215c54=new Hangup(_0x2ea33b,_0x3b5e6d);this[_0x7cbd('0xcf')](_0x215c54)[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x10b')));this[_0x7cbd('0xcd')](_0x215c54)[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x10c')));}if(_0x2ea33b&&_0x2ea33b['type']!=='ivr'&&isNotNull(this[_0x7cbd('0x20')][_0x2ea33b[_0x7cbd('0xb9')]][_0x7cbd('0x10d')])){delete this[_0x7cbd('0xae')][_0x3b5e6d[_0x7cbd('0xe3')]];this['updateOriginated'](this[_0x7cbd('0x20')][_0x2ea33b['queue']]);this[_0x7cbd('0x20')][_0x2ea33b[_0x7cbd('0xb9')]]['outboundAnswerCallsDay']+=0x1;this[_0x7cbd('0x20')][_0x2ea33b[_0x7cbd('0xb9')]][_0x7cbd('0x60')]+=0x1;_0x215c54=new Hangup(_0x2ea33b,_0x3b5e6d);_0x215c54[_0x7cbd('0xab')]=0x10;_0x215c54[_0x7cbd('0xac')]=_0x7cbd('0x10e');_0x215c54[_0x7cbd('0xea')]=_0x7cbd('0x10f');this[_0x7cbd('0xcf')](_0x215c54)[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x10b')));this[_0x7cbd('0xcd')](_0x215c54)['catch'](loggerCatch(_0x7cbd('0x10c')));}if(_0x2ea33b&&_0x2ea33b[_0x7cbd('0x7d')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x2ea33b[_0x7cbd('0xb9')]][_0x7cbd('0x10d')])){delete this['uniqueId'][_0x3b5e6d[_0x7cbd('0xe3')]];this[_0x7cbd('0xb7')](this[_0x7cbd('0x20')][_0x2ea33b[_0x7cbd('0xb9')]]);this['voiceQueues'][_0x2ea33b['queue']]['outboundUnknownCallsDay']+=0x1;_0x215c54=new Hangup(_0x2ea33b,_0x3b5e6d);_0x215c54['state']=0xc;_0x215c54[_0x7cbd('0xac')]=_0x3b5e6d['cause-txt'];_0x215c54[_0x7cbd('0xea')]='Unknow';this[_0x7cbd('0xcf')](_0x215c54)[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x10b')));this[_0x7cbd('0xcd')](_0x215c54)[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x10c')));}};Dialer['prototype']['syncAgentComplete']=function(_0x393fa4){var _0x586b20=this['uniqueId'][_0x393fa4['uniqueid']];var _0x556fcf=this;if(this[_0x7cbd('0x20')][_0x393fa4[_0x7cbd('0xb9')]]){if(_0x586b20&&_0x586b20['type']!==_0x7cbd('0x7e')){delete this['uniqueId'][_0x393fa4[_0x7cbd('0xe3')]];this[_0x7cbd('0x20')][_0x393fa4['queue']][_0x7cbd('0x61')]+=0x1;var _0x108ff5=new AgentComplete(_0x586b20,_0x393fa4);if(_0x393fa4[_0x7cbd('0x110')]==='agent'){_0x108ff5['agiafterat']=this[_0x7cbd('0x20')][_0x393fa4['queue']]['dialQueueProject2']&&this[_0x7cbd('0x20')][_0x393fa4['queue']]['dialAgiAfterHangupAgent']?moment()[_0x7cbd('0x7a')](_0x7cbd('0x100')):undefined;}this[_0x7cbd('0xcf')](_0x108ff5)[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x111')));this['moveContactManagedDialer'](_0x108ff5)[_0x7cbd('0xb5')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x7cbd('0x1c')]['syncAgentConnect']=function(_0x1d9074){if(this['voiceQueues'][_0x1d9074[_0x7cbd('0xb9')]]){if(this[_0x7cbd('0xae')][_0x1d9074[_0x7cbd('0xe3')]]&&this[_0x7cbd('0xae')][_0x1d9074[_0x7cbd('0xe3')]]['type']!=='ivr'){this[_0x7cbd('0xb7')](this[_0x7cbd('0x20')][_0x1d9074['queue']]);this[_0x7cbd('0xae')][_0x1d9074['uniqueid']][_0x7cbd('0x112')]=moment()[_0x7cbd('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x7cbd('0x1c')][_0x7cbd('0x113')]=function(_0x3b9ce5){this[_0x7cbd('0xcf')](_0x3b9ce5)[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x111')));this[_0x7cbd('0xcd')](_0x3b9ce5)[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x114')));};Dialer[_0x7cbd('0x1c')][_0x7cbd('0x115')]=function(_0x191c0b){var _0x30f70e=this[_0x7cbd('0xae')][_0x191c0b[_0x7cbd('0xe3')]];var _0x18ddbd=this;if(this[_0x7cbd('0x20')][_0x191c0b[_0x7cbd('0xb9')]]){if(_0x30f70e&&_0x30f70e[_0x7cbd('0x7d')]!==_0x7cbd('0x7e')){delete this[_0x7cbd('0xae')][_0x191c0b[_0x7cbd('0xe3')]];this[_0x7cbd('0xb7')](this[_0x7cbd('0x20')][_0x191c0b[_0x7cbd('0xb9')]]);_0x30f70e[_0x7cbd('0x116')]=moment()[_0x7cbd('0x7a')](_0x7cbd('0x100'));var _0x20a7f1=new QueueCallerAbandon(_0x30f70e,_0x191c0b);if(getSeconds(_0x30f70e[_0x7cbd('0x116')],_0x30f70e['responsetime'])>=_0x30f70e[_0x7cbd('0x117')]){this[_0x7cbd('0x20')][_0x191c0b[_0x7cbd('0xb9')]][_0x7cbd('0x6e')]+=0x1;this[_0x7cbd('0x20')][_0x191c0b[_0x7cbd('0xb9')]][_0x7cbd('0x66')]+=0x1;this[_0x7cbd('0x20')][_0x191c0b[_0x7cbd('0xb9')]][_0x7cbd('0x70')]+=0x1;_0x20a7f1[_0x7cbd('0xab')]=0xa;_0x20a7f1['statedesc']=_0x7cbd('0x118');_0x20a7f1[_0x7cbd('0x119')]='TIMEOUT';_0x20a7f1[_0x7cbd('0x11a')]=this[_0x7cbd('0x20')][_0x191c0b[_0x7cbd('0xb9')]]['dialQueueProject2']?moment()[_0x7cbd('0x7a')](_0x7cbd('0x100')):undefined;_0x20a7f1['countdropretry']+=0x1;_0x20a7f1[_0x7cbd('0xf0')]+=0x1;if(_0x20a7f1[_0x7cbd('0x106')]>=this[_0x7cbd('0x20')][_0x191c0b[_0x7cbd('0xb9')]][_0x7cbd('0x11b')]){this[_0x7cbd('0x113')](_0x20a7f1);}else{this[_0x7cbd('0xc4')]({'active':![],'countdropretry':_0x20a7f1['countdropretry'],'scheduledat':moment()[_0x7cbd('0xfe')](this[_0x7cbd('0x20')][_0x191c0b[_0x7cbd('0xb9')]]['dialDropRetryFrequency'],_0x7cbd('0xff'))[_0x7cbd('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x30f70e[_0x7cbd('0xd6')],'ListId':_0x30f70e[_0x7cbd('0xd7')],'VoiceQueueId':_0x30f70e[_0x7cbd('0xd9')]||undefined,'CampaignId':_0x30f70e[_0x7cbd('0xda')]||undefined})[_0x7cbd('0xb5')](loggerCatch('[rescheduleContact][Drop]'));var _0x435afa=new History(_0x20a7f1);_0x435afa[_0x7cbd('0xab')]=0xa;_0x435afa[_0x7cbd('0xac')]='Drop';_0x435afa[_0x7cbd('0xad')]=moment()[_0x7cbd('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x435afa[_0x7cbd('0x11c')]=_0x435afa[_0x7cbd('0xad')];_0x435afa[_0x7cbd('0x11d')]=_0x20a7f1[_0x7cbd('0x11d')];_0x435afa['calleridnum']=_0x20a7f1[_0x7cbd('0x11e')];this[_0x7cbd('0xcf')](_0x435afa)[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x11f')));}}else{this[_0x7cbd('0x20')][_0x191c0b['queue']][_0x7cbd('0x6d')]+=0x1;this['voiceQueues'][_0x191c0b[_0x7cbd('0xb9')]][_0x7cbd('0x65')]+=0x1;_0x20a7f1[_0x7cbd('0xab')]=0xb;_0x20a7f1[_0x7cbd('0xac')]='Abandoned';_0x20a7f1[_0x7cbd('0x119')]=_0x7cbd('0x120');_0x20a7f1[_0x7cbd('0xf6')]+=0x1;_0x20a7f1['countglobal']+=0x1;if(_0x20a7f1[_0x7cbd('0xf6')]>=this[_0x7cbd('0x20')][_0x191c0b[_0x7cbd('0xb9')]][_0x7cbd('0x121')]){this['queueCallerAbandonCreateState'](_0x20a7f1);}else{this[_0x7cbd('0xc4')]({'active':![],'countabandonedretry':_0x20a7f1[_0x7cbd('0xf6')],'scheduledat':moment()['add'](this[_0x7cbd('0x20')][_0x191c0b[_0x7cbd('0xb9')]]['dialAbandonedRetryFrequency'],'minutes')[_0x7cbd('0x7a')](_0x7cbd('0x100')),'ContactId':_0x30f70e[_0x7cbd('0xd6')],'ListId':_0x30f70e['ListId'],'VoiceQueueId':_0x30f70e[_0x7cbd('0xd9')]||undefined,'CampaignId':_0x30f70e[_0x7cbd('0xda')]||undefined})[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x122')));var _0x435afa=new History(_0x20a7f1);_0x435afa[_0x7cbd('0xab')]=0xb;_0x435afa[_0x7cbd('0xac')]='Abandoned';_0x435afa[_0x7cbd('0xad')]=moment()[_0x7cbd('0x7a')](_0x7cbd('0x100'));_0x435afa[_0x7cbd('0x11c')]=_0x435afa['starttime'];_0x435afa[_0x7cbd('0x11d')]=_0x20a7f1[_0x7cbd('0x11d')];_0x435afa[_0x7cbd('0x11e')]=_0x20a7f1['calleridnum'];this['createHistory'](_0x435afa)['catch'](loggerCatch(_0x7cbd('0x123')));}}}}};Dialer['prototype'][_0x7cbd('0x37')]=function(_0xe5133f){if(this[_0x7cbd('0x24')][_0xe5133f[_0x7cbd('0xe3')]]){this['actions'][_0xe5133f[_0x7cbd('0xe3')]][_0x7cbd('0x124')]=_0xe5133f[_0x7cbd('0x124')];}if(this[_0x7cbd('0xae')][_0xe5133f[_0x7cbd('0xe3')]]){this[_0x7cbd('0xae')][_0xe5133f[_0x7cbd('0xe3')]][_0x7cbd('0x124')]=_0xe5133f['channel'];}};Dialer[_0x7cbd('0x1c')][_0x7cbd('0x3b')]=function(_0x432b7b){if(strategy[this[_0x7cbd('0x20')][this[_0x7cbd('0x24')][_0x432b7b[_0x7cbd('0x125')]][_0x7cbd('0xb9')]][_0x7cbd('0x126')]]===_0x7cbd('0x1b')){if(this[_0x7cbd('0x24')][_0x432b7b['actionid']]&&_[_0x7cbd('0xb2')](this[_0x7cbd('0x24')][_0x432b7b[_0x7cbd('0x125')]][_0x7cbd('0x127')])&&_0x432b7b[_0x7cbd('0xb4')]==='1'&&_0x432b7b[_0x7cbd('0x128')]==='0'){if(this[_0x7cbd('0x22')][_0x432b7b['stateinterface']]){if(!this[_0x7cbd('0x22')][_0x432b7b[_0x7cbd('0x129')]][_0x7cbd('0x127')]){this[_0x7cbd('0x22')][_0x432b7b[_0x7cbd('0x129')]]['locked']=!![];this[_0x7cbd('0x24')][_0x432b7b[_0x7cbd('0x125')]][_0x7cbd('0x127')]=!![];this['actions'][_0x432b7b['actionid']][_0x7cbd('0x129')]=_0x432b7b[_0x7cbd('0x129')];}}}}else if((strategy[this[_0x7cbd('0x20')][this['actions'][_0x432b7b['actionid']][_0x7cbd('0xb9')]]['strategy']]||_0x7cbd('0x12a'))===_0x7cbd('0x12a')){if(this['actions'][_0x432b7b[_0x7cbd('0x125')]]){if(this[_0x7cbd('0x22')][_0x432b7b[_0x7cbd('0x129')]]){this[_0x7cbd('0x24')][_0x432b7b[_0x7cbd('0x125')]][_0x7cbd('0x129')]=_0x432b7b['stateinterface'];if(_[_0x7cbd('0xb2')](this[_0x7cbd('0x2a')][this[_0x7cbd('0x24')][_0x432b7b['actionid']][_0x7cbd('0xb9')]])){this[_0x7cbd('0x2a')][this[_0x7cbd('0x24')][_0x432b7b['actionid']][_0x7cbd('0xb9')]]=[];}this[_0x7cbd('0x2a')][this[_0x7cbd('0x24')][_0x432b7b[_0x7cbd('0x125')]][_0x7cbd('0xb9')]][_0x7cbd('0x12b')](_['merge'](_['pick'](this[_0x7cbd('0x24')][_0x432b7b[_0x7cbd('0x125')]],[_0x7cbd('0x12c'),_0x7cbd('0x129')]),{'status':_0x432b7b[_0x7cbd('0xb4')],'paused':_0x432b7b['paused']}));}}}};function unlockQueueStatus(_0x463213,_0x3ec194){setTimeout(function(){if(_[_0x7cbd('0x40')](_0x463213[_0x7cbd('0x12d')])){loggerBooked[_0x7cbd('0x9b')](_0x7cbd('0x12e'),_0x3ec194);}_0x463213[_0x7cbd('0x12d')]=!![];loggerBooked[_0x7cbd('0x82')](_0x7cbd('0x12f'),_0x3ec194,JSON['stringify'](_[_0x7cbd('0xd5')](_0x463213,['name',_0x7cbd('0x12d')])));},0x1f3);}Dialer[_0x7cbd('0x1c')]['syncQueueStatusComplete']=function(_0xc66319){var _0x4125e4=this;var _0x111dcc=_0x4125e4['voiceQueues'][_0x4125e4[_0x7cbd('0x24')][_0xc66319[_0x7cbd('0x125')]][_0x7cbd('0xb9')]];if(strategy[this[_0x7cbd('0x20')][this[_0x7cbd('0x24')][_0xc66319[_0x7cbd('0x125')]][_0x7cbd('0xb9')]]['strategy']]===_0x7cbd('0x1b')){if(this[_0x7cbd('0x24')][_0xc66319[_0x7cbd('0x125')]]&&this[_0x7cbd('0x24')][_0xc66319[_0x7cbd('0x125')]][_0x7cbd('0x129')]){this[_0x7cbd('0x97')][_0x7cbd('0x130')](this[_0x7cbd('0x24')][_0xc66319['actionid']]['idHopper'],this[_0x7cbd('0x24')][_0xc66319[_0x7cbd('0x125')]]['stateinterface'])['catch'](function(_0x3172aa){logger[_0x7cbd('0x9b')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x7cbd('0x9c')](_0x3172aa,{'showHidden':![],'depth':null}));})[_0x7cbd('0x1e')](function(){_0x4125e4[_0x7cbd('0xb7')](_0x4125e4[_0x7cbd('0x20')][_0x4125e4['actions'][_0xc66319[_0x7cbd('0x125')]]['queue']]);_0x4125e4[_0x7cbd('0x22')][_0x4125e4[_0x7cbd('0x24')][_0xc66319[_0x7cbd('0x125')]][_0x7cbd('0x129')]]['locked']=![];delete _0x4125e4['actions'][_0xc66319[_0x7cbd('0x125')]];unlockQueueStatus(_0x111dcc);});}else{this[_0x7cbd('0xb7')](this['voiceQueues'][this[_0x7cbd('0x24')][_0xc66319['actionid']][_0x7cbd('0xb9')]]);this[_0x7cbd('0xc4')]({'active':![],'ContactId':this[_0x7cbd('0x24')][_0xc66319[_0x7cbd('0x125')]][_0x7cbd('0xd6')],'ListId':this[_0x7cbd('0x24')][_0xc66319[_0x7cbd('0x125')]][_0x7cbd('0xd7')],'VoiceQueueId':this[_0x7cbd('0x24')][_0xc66319['actionid']][_0x7cbd('0xd9')]||undefined,'CampaignId':this[_0x7cbd('0x24')][_0xc66319['actionid']]['CampaignId']||undefined})[_0x7cbd('0xb5')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0xc66319[_0x7cbd('0x125')]];unlockQueueStatus(_0x111dcc);}}else if((strategy[this[_0x7cbd('0x20')][this['actions'][_0xc66319[_0x7cbd('0x125')]][_0x7cbd('0xb9')]][_0x7cbd('0x126')]]||_0x7cbd('0x12a'))===_0x7cbd('0x12a')){var _0x408bd2;if(this[_0x7cbd('0x24')][_0xc66319[_0x7cbd('0x125')]]&&!_['isEmpty'](this[_0x7cbd('0x2a')][this[_0x7cbd('0x24')][_0xc66319[_0x7cbd('0x125')]][_0x7cbd('0xb9')]])){if(this['queueBookedRR'][_0x4125e4[_0x7cbd('0x24')][_0xc66319[_0x7cbd('0x125')]]['queue']]){this[_0x7cbd('0x131')][_0x4125e4['actions'][_0xc66319[_0x7cbd('0x125')]][_0x7cbd('0xb9')]]=this['queueBookedRR'][this['actions'][_0xc66319['actionid']][_0x7cbd('0xb9')]]?this[_0x7cbd('0x131')][this[_0x7cbd('0x24')][_0xc66319[_0x7cbd('0x125')]][_0x7cbd('0xb9')]]:this[_0x7cbd('0x2a')][this[_0x7cbd('0x24')][_0xc66319[_0x7cbd('0x125')]][_0x7cbd('0xb9')]]?this[_0x7cbd('0x2a')][this[_0x7cbd('0x24')][_0xc66319['actionid']][_0x7cbd('0xb9')]]['_rr']||0x0:0x0;}this[_0x7cbd('0x2a')][this[_0x7cbd('0x24')][_0xc66319['actionid']][_0x7cbd('0xb9')]][_0x7cbd('0x132')]=this['queueBookedRR'][this['actions'][_0xc66319[_0x7cbd('0x125')]][_0x7cbd('0xb9')]];for(var _0x495057=0x0;_0x495057=0x0;})[_0x7cbd('0xb5')](myreject(_0x570f83)));}}else{_0x1f9b1e[_0x7cbd('0x12b')](ami['Action']({'action':_0x7cbd('0x14a'),'command':util[_0x7cbd('0x7a')](_0x7cbd('0x14b'),_0x2ad35a,!_[_0x7cbd('0x40')](config[_0x7cbd('0x147')][_0x3a21ca])?_0x3a21ca:'')})['then'](function(_0x5dee33){return _0x5dee33['content'][_0x7cbd('0x14e')](_0x7cbd('0x14f'))>=0x0;})[_0x7cbd('0xb5')](myreject(_0x570f83)));}BPromise[_0x7cbd('0x150')](_0x1f9b1e)[_0x7cbd('0x3e')](function(_0x2849d8){var _0xc3f0e0=_['some'](_0x2849d8);if(_0xc3f0e0){return _0x397685(_0xc3f0e0);}else{_0xbe188['message']=_0x1129fb?_0x7cbd('0x151'):_0x7cbd('0x152');return _0x570f83(msgResponse(_0x7cbd('0x153'),_0x7cbd('0x143'),_0x7cbd('0x154')+_0x1129fb+'\x20'+_0xcfd4a0+'\x20Interval\x20is\x20overtime:\x20'+util[_0x7cbd('0x9c')](_0x2ad35a,{'showHidden':![],'depth':null})+_0x7cbd('0x155')+_0x3a21ca));}})['catch'](function(_0x35bcf8){return _0x570f83(msgResponse('ifTime',_0x7cbd('0x143'),JSON[_0x7cbd('0x4c')](_0x35bcf8)));});});};Dialer[_0x7cbd('0x1c')][_0x7cbd('0x156')]=function(_0x512ecc){var _0x1381d6=this;return function(){switch(_0x512ecc[_0x7cbd('0x157')]){case'progressive':freeVariablesPredictive(_0x512ecc);_0x1381d6['handlePower'](_0x512ecc,0x1);break;case _0x7cbd('0x158'):freeVariablesPredictive(_0x512ecc);_0x1381d6[_0x7cbd('0x159')](_0x512ecc,_0x512ecc[_0x7cbd('0x15a')]);break;case _0x7cbd('0xc'):_0x1381d6['predictive'](_0x512ecc);break;case'booked':freeVariablesPredictive(_0x512ecc);_0x1381d6[_0x7cbd('0x159')](_0x512ecc,0x1);break;default:freeVariablesPredictive(_0x512ecc);logger[_0x7cbd('0x9b')]('Queue',_0x512ecc['name'],_0x7cbd('0x15b'));}};};Dialer[_0x7cbd('0x1c')][_0x7cbd('0x15c')]=function(_0x493e2e){return BPromise['resolve']()[_0x7cbd('0x3e')](cmHopper[_0x7cbd('0x15d')](_0x493e2e['id'],previewRecallmeReminderInterval))[_0x7cbd('0x3e')](function(_0x1a916a){for(var _0x5ab8b0=0x0;_0x5ab8b0<_0x1a916a['length'];_0x5ab8b0++){var _0x49a336=_0x1a916a[_0x5ab8b0][_0x7cbd('0x15e')][_0x7cbd('0x42')];if(_0x49a336)io['to'](util['format'](_0x7cbd('0x15f'),_0x49a336))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x1a916a[_0x5ab8b0]});}})[_0x7cbd('0xb5')](function(_0x561a79){});};Dialer[_0x7cbd('0x1c')][_0x7cbd('0x160')]=function(_0x20c766){var _0x2fe717=this;return function(){_0x2fe717[_0x7cbd('0x161')](_0x20c766);};};Dialer[_0x7cbd('0x1c')][_0x7cbd('0xe')]=function(_0x1b75b0){var _0xc848fc=this;if(isNotPreview(_0x1b75b0[_0x7cbd('0x157')])){if(isVoiceQueueOutbound(_0x1b75b0[_0x7cbd('0x7d')])&&isActive(_0x1b75b0['dialActive'])){_0x1b75b0[_0x7cbd('0xa5')]=!![];BPromise[_0x7cbd('0xbc')]()[_0x7cbd('0x3e')](checkIsLoggedIn(_0x1b75b0,_0x1b75b0[_0x7cbd('0x53')]))['then'](checkIsActive(_0x1b75b0,_0x1b75b0[_0x7cbd('0x5b')]))[_0x7cbd('0x3e')](checkInterval(_0x1b75b0))[_0x7cbd('0x3e')](_0xc848fc['checkIsTrunkReachable'](_0x1b75b0))['then'](_0xc848fc['checkIfTime'](_0x1b75b0[_0x7cbd('0x162')],_0x1b75b0[_0x7cbd('0x163')],_0x1b75b0[_0x7cbd('0x42')],_0x1b75b0))[_0x7cbd('0x3e')](_0xc848fc[_0x7cbd('0x142')](_0x1b75b0[_0x7cbd('0x49')],_0x1b75b0['dialTimezone'],_0x1b75b0[_0x7cbd('0x42')],_0x1b75b0))[_0x7cbd('0x3e')](_0xc848fc[_0x7cbd('0x156')](_0x1b75b0))[_0x7cbd('0xb5')](loggerCatchQueueSummary(_0x7cbd('0x164'),_0x1b75b0));}else{notSendMessagesQueue(_0x1b75b0);}}else{freeVariablesPredictive(_0x1b75b0);if(_0x1b75b0['dialPreviewRecallmeReminder']){_0xc848fc[_0x7cbd('0x15c')](_0x1b75b0);}}};Dialer[_0x7cbd('0x1c')][_0x7cbd('0x13c')]=function(){var _0x2940b4=this;var _0x533197;for(var _0x2c0249 in this[_0x7cbd('0x21')]){if(typeof this['campaigns'][_0x2c0249]!==_0x7cbd('0xa0')){_0x533197=this[_0x7cbd('0x21')][_0x2c0249];if(isCampaignIvr(_0x533197[_0x7cbd('0x7d')])&&isActive(_0x533197[_0x7cbd('0x78')])){_0x533197['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0x7cbd('0x3e')](checkIsActive(_0x533197,_0x533197['active']))[_0x7cbd('0x3e')](checkInterval(_0x533197))[_0x7cbd('0x3e')](_0x2940b4[_0x7cbd('0x13d')](_0x533197))[_0x7cbd('0x3e')](_0x2940b4[_0x7cbd('0x140')](_0x533197['dialGlobalInterval'],_0x533197[_0x7cbd('0x163')],_0x533197[_0x7cbd('0x42')],_0x533197))['then'](_0x2940b4[_0x7cbd('0x142')](_0x533197[_0x7cbd('0x49')],_0x533197['dialTimezone'],_0x533197['name'],_0x533197))[_0x7cbd('0x3e')](_0x2940b4['launchHandleIvr'](_0x533197))[_0x7cbd('0xb5')](loggerCatchQueueSummary(_0x7cbd('0x165'),_0x533197));}else{notSendMessagesCampaign(_0x533197);}}}};function getCallerIdRandom(_0x523f45,_0xac3a1d){var _0x5d9eb2;var _0x481332;var _0x3cad90;if(_0xac3a1d<=0x0){_0xac3a1d=0x1;}_0x5d9eb2=new RegExp('\x5cw{0,'+_0xac3a1d+'}$');_0x481332=Math['pow'](0xa,_0xac3a1d-0x1);_0x3cad90=Math['pow'](0xa,_0xac3a1d)-0x1;return util[_0x7cbd('0x7a')]('%s',_['replace'](_0x523f45,_0x5d9eb2,_[_0x7cbd('0x166')](_0x481332,_0x3cad90)));}function extractCalleridName(_0x492bd2){var _0x4551aa=_0x492bd2['match'](/"(.*?)"/);return _0x4551aa?_0x4551aa[0x1]:_0x492bd2;}function extractCalleridNumber(_0x254c18){var _0x243767=_0x254c18[_0x7cbd('0x167')](/<(.*?)>/);return _0x243767?_0x243767[0x1]:_0x254c18;}Dialer['prototype']['actionOriginate']=function(_0x33b34f,_0x558a43){var _0x132b28=this;var _0x2c709b=uuid['v4']();this[_0x7cbd('0x24')][_0x2c709b]=new Action(_0x33b34f,_0x558a43,_0x2c709b);return new BPromise(function(_0x1dabea,_0x20dd4b){if(_[_0x7cbd('0x40')](_0x33b34f)&&typeof _0x33b34f!==_0x7cbd('0x168')){return _0x20dd4b(msgResponse(_0x7cbd('0x169'),'Failure',_0x7cbd('0x16a')));}if(_[_0x7cbd('0x40')](_0x558a43['Contact'][_0x7cbd('0x16b')])||_0x558a43['Contact'][_0x7cbd('0x16b')]===null){return _0x20dd4b(msgResponse(_0x7cbd('0x169'),_0x7cbd('0x143'),'contact\x20is\x20undefine'));}var _0x382b6b={'XMD-CALLERID':_0x132b28['actions'][_0x2c709b][_0x7cbd('0x16c')](),'XMD-AGI':_0x33b34f[_0x7cbd('0x10d')]?util[_0x7cbd('0x7a')]('\x22agi://%s/square,%s\x22',ipAgi,_0x33b34f[_0x7cbd('0x10d')]):_0x7cbd('0x16d'),'XMD-AGIAFTER':_0x33b34f[_0x7cbd('0x16e')]?util[_0x7cbd('0x7a')](_0x7cbd('0x16f'),ipAgi,_0x33b34f[_0x7cbd('0x16e')]):'NONE','XMD-QUEUE':_0x33b34f[_0x7cbd('0x7d')]===_0x7cbd('0x50')?util[_0x7cbd('0x7a')]('\x22%s,%s%s,,,%s\x22',_0x33b34f[_0x7cbd('0x42')],_0x33b34f[_0x7cbd('0x170')]||'',_0x33b34f['dialAgiAfterHangupAgent']?'c':'',_0x33b34f[_0x7cbd('0x117')]||0x3):'NONE','XMD-CONTACTID':_0x558a43[_0x7cbd('0xd6')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x132b28['actions'][_0x2c709b][_0x7cbd('0x16c')](),'XMD-AMD':_0x33b34f[_0x7cbd('0xe6')]?'ACTIVE':'NONE','XMD-DESTINATION':_0x7cbd('0x171')};if(_0x33b34f[_0x7cbd('0xe6')]){_0x382b6b['XMD-AMDINITIALSILENCE']=_0x33b34f[_0x7cbd('0x172')]||0x9c4;_0x382b6b[_0x7cbd('0x173')]=_0x33b34f['dialAMDGreeting']||0x5dc;_0x382b6b['XMD-AMDAFTERGREETINGSILENCE']=_0x33b34f['dialAMDAfterGreetingSilence']||0x320;_0x382b6b[_0x7cbd('0x174')]=_0x33b34f[_0x7cbd('0x175')]||0x1388;_0x382b6b[_0x7cbd('0x176')]=_0x33b34f[_0x7cbd('0x177')]||0x64;_0x382b6b['XMD-AMDBETWEENWORDSSILENCE']=_0x33b34f['dialAMDBetweenWordsSilence']||0x32;_0x382b6b['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x33b34f[_0x7cbd('0x178')]||0x3;_0x382b6b[_0x7cbd('0x179')]=_0x33b34f[_0x7cbd('0x17a')]||0x100;_0x382b6b[_0x7cbd('0x17b')]=_0x33b34f[_0x7cbd('0x17c')]||0x1388;}if(_0x33b34f[_0x7cbd('0x7d')]===_0x7cbd('0x50')){_0x382b6b[_0x7cbd('0x17d')]=_0x558a43[_0x7cbd('0xd9')];}else{_0x382b6b[_0x7cbd('0x17e')]=_0x558a43[_0x7cbd('0xda')];}for(var _0x10d6fc in _0x558a43['Contact']){if(typeof _0x558a43[_0x7cbd('0x17f')][_0x10d6fc]!=='undefined'){if(isNotNull(_0x558a43[_0x7cbd('0x17f')][_0x10d6fc])&&_0x10d6fc!=='id'&&_0x10d6fc!==_0x7cbd('0x180')&&_0x10d6fc!==_0x7cbd('0x181')&&_0x10d6fc!==_0x7cbd('0x182')){_0x382b6b[util[_0x7cbd('0x7a')](_0x7cbd('0x183'),'XMD-',_[_0x7cbd('0x184')](_0x10d6fc))]=_0x558a43['Contact'][_0x10d6fc];}}}var _0x350f52=_0x132b28[_0x7cbd('0xde')](_0x33b34f[_0x7cbd('0x77')])?getCallerId(_0x33b34f[_0x7cbd('0x77')][_0x7cbd('0x79')],_0x33b34f[_0x7cbd('0x5c')],_0x33b34f[_0x7cbd('0x185')]>0x0?getCallerIdRandom(_0x33b34f[_0x7cbd('0x5d')],_0x33b34f[_0x7cbd('0x185')]):_0x33b34f['dialOriginateCallerIdNumber']):getCallerId(_[_0x7cbd('0xb2')](_0x33b34f['TrunkBackup'])?_0x33b34f[_0x7cbd('0x77')][_0x7cbd('0x79')]:_0x33b34f[_0x7cbd('0x13e')][_0x7cbd('0x79')],_0x33b34f[_0x7cbd('0x5c')],_0x33b34f[_0x7cbd('0x185')]>0x0?getCallerIdRandom(_0x33b34f[_0x7cbd('0x5d')],_0x33b34f[_0x7cbd('0x185')]):_0x33b34f[_0x7cbd('0x5d')]);if(_0x350f52){_0x382b6b[_0x7cbd('0x186')]=_0x132b28['actions'][_0x2c709b][_0x7cbd('0x187')]=extractCalleridName(_0x350f52);_0x382b6b['XMD-ORIGINATECALLERIDNUM']=_0x132b28[_0x7cbd('0x24')][_0x2c709b][_0x7cbd('0x188')]=extractCalleridNumber(_0x350f52);}return ami[_0x7cbd('0xb3')]({'actionid':_0x2c709b,'action':_0x7cbd('0x169'),'channel':_0x132b28['isTrunkReachable'](_0x33b34f['Trunk'])?util[_0x7cbd('0x7a')](_0x7cbd('0x189'),_0x33b34f['Trunk'][_0x7cbd('0x42')],isNotNull(_0x33b34f[_0x7cbd('0x5f')])?_0x33b34f[_0x7cbd('0x5f')]['trim']()||'':'',_0x33b34f[_0x7cbd('0x18a')]>0x0?_0x558a43[_0x7cbd('0x17f')]['phone'][_0x7cbd('0x18b')](_0x33b34f['dialCutDigit']):_0x558a43[_0x7cbd('0x17f')][_0x7cbd('0x16b')]):util[_0x7cbd('0x7a')](_0x7cbd('0x189'),_['isNil'](_0x33b34f[_0x7cbd('0x13e')])?_0x33b34f[_0x7cbd('0x77')][_0x7cbd('0x42')]:_0x33b34f[_0x7cbd('0x13e')][_0x7cbd('0x42')],isNotNull(_0x33b34f['dialPrefix'])?_0x33b34f['dialPrefix']['trim']()||'':'',_0x33b34f['dialCutDigit']>0x0?_0x558a43[_0x7cbd('0x17f')][_0x7cbd('0x16b')][_0x7cbd('0x18b')](_0x33b34f[_0x7cbd('0x18a')]):_0x558a43['Contact'][_0x7cbd('0x16b')]),'callerid':_0x350f52,'Exten':'xcally-motion-dialer','Context':_0x7cbd('0x18c'),'Priority':'1','variable':_0x382b6b,'timeout':(_0x33b34f[_0x7cbd('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2c709b})[_0x7cbd('0x3e')](function(_0x1cb51a){return _0x1dabea(_0x1cb51a);})[_0x7cbd('0xb5')](function(_0x265046){_0x33b34f[_0x7cbd('0x68')]+=0x1;var _0xaedfd1=new History(_0x132b28[_0x7cbd('0x24')][_0x2c709b]);logger[_0x7cbd('0x9b')](util[_0x7cbd('0x7a')](_0x7cbd('0x18d'),JSON[_0x7cbd('0x4c')](_0x265046)));_0xaedfd1['state']=0xe;_0xaedfd1[_0x7cbd('0xac')]='OriginateError';_0xaedfd1['starttime']=moment()[_0x7cbd('0x7a')](_0x7cbd('0x100'));_0xaedfd1['endtime']=_0xaedfd1[_0x7cbd('0xad')];_0x132b28[_0x7cbd('0xcf')](_0xaedfd1)[_0x7cbd('0xb5')](loggerCatch('[originate][error]'));_0x132b28[_0x7cbd('0xcd')](_0xaedfd1)['catch'](loggerCatch('[originate][error]'))[_0x7cbd('0x1e')](function(){delete _0x132b28[_0x7cbd('0x24')][_0x2c709b];return _0x20dd4b(msgResponse(_0x7cbd('0x169'),_0x7cbd('0x4b'),_0x7cbd('0x18e')));});});});};Dialer[_0x7cbd('0x1c')][_0x7cbd('0x30')]=function(_0x42d809){var _0x212af3=this['actions'][_0x42d809[_0x7cbd('0x125')]];if(_0x212af3){delete this[_0x7cbd('0x24')][_0x42d809[_0x7cbd('0x125')]];_0x212af3[_0x7cbd('0x18f')]=moment()[_0x7cbd('0x7a')](_0x7cbd('0x100'));var _0x41d4b4=_0x212af3[_0x7cbd('0x7d')]==='ivr'?this[_0x7cbd('0x21')][_0x212af3[_0x7cbd('0xb9')]]:this['voiceQueues'][_0x212af3[_0x7cbd('0x190')]()];if(!this[_0x7cbd('0xdc')](_0x42d809[_0x7cbd('0x191')])){this[_0x7cbd('0xb7')](_0x41d4b4);return this[_0x7cbd('0x192')](_0x212af3,_0x41d4b4,_0x42d809)[_0x7cbd('0xb5')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x7cbd('0xae')][_0x42d809['uniqueid']]=_0x212af3;}};Dialer['prototype']['checkRetriveMax']=function(_0x1a67b5,_0x55ba22,_0x5a87c5){var _0x468bfa=new History(_0x55ba22);if(_0x468bfa[_0x7cbd('0xf2')]+_0x468bfa[_0x7cbd('0xf3')]+_0x468bfa[_0x7cbd('0xf4')]+_0x468bfa['countnosuchnumberretry']+_0x468bfa['countdropretry']+_0x468bfa[_0x7cbd('0xf6')]+_0x468bfa['countmachineretry']+_0x468bfa['countagentrejectretry']>=_0x5a87c5[_0x7cbd('0x107')]-0x1){return!![];}switch(_0x1a67b5){case 0x3:if(_0x468bfa[_0x7cbd('0xf4')]>=_0x5a87c5[_0x7cbd('0x193')]-0x1){return!![];}this[_0x7cbd('0xc4')]({'active':![],'countnoanswerretry':_0x468bfa[_0x7cbd('0xf4')]+=0x1,'scheduledat':moment()[_0x7cbd('0xfe')](_0x5a87c5[_0x7cbd('0x194')],_0x7cbd('0xff'))[_0x7cbd('0x7a')](_0x7cbd('0x100')),'ContactId':_0x468bfa['ContactId'],'ListId':_0x468bfa[_0x7cbd('0xd7')],'VoiceQueueId':_0x468bfa[_0x7cbd('0xd9')]||undefined,'CampaignId':_0x468bfa[_0x7cbd('0xda')]||undefined})[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x195')));break;case 0x5:if(_0x468bfa[_0x7cbd('0xf2')]>=_0x5a87c5[_0x7cbd('0x196')]-0x1){return!![];}this[_0x7cbd('0xc4')]({'active':![],'countbusyretry':_0x468bfa[_0x7cbd('0xf2')]+=0x1,'scheduledat':moment()[_0x7cbd('0xfe')](_0x5a87c5[_0x7cbd('0x197')],_0x7cbd('0xff'))[_0x7cbd('0x7a')](_0x7cbd('0x100')),'ContactId':_0x468bfa['ContactId'],'ListId':_0x468bfa[_0x7cbd('0xd7')],'VoiceQueueId':_0x468bfa[_0x7cbd('0xd9')]||undefined,'CampaignId':_0x468bfa[_0x7cbd('0xda')]||undefined})[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x198')));break;case 0x8:if(_0x468bfa[_0x7cbd('0xf3')]>=_0x5a87c5['dialCongestionMaxRetry']-0x1){return!![];}this[_0x7cbd('0xc4')]({'active':![],'countcongestionretry':_0x468bfa[_0x7cbd('0xf3')]+=0x1,'scheduledat':moment()[_0x7cbd('0xfe')](_0x5a87c5[_0x7cbd('0x199')],'minutes')[_0x7cbd('0x7a')](_0x7cbd('0x100')),'ContactId':_0x468bfa[_0x7cbd('0xd6')],'ListId':_0x468bfa[_0x7cbd('0xd7')],'VoiceQueueId':_0x468bfa[_0x7cbd('0xd9')]||undefined,'CampaignId':_0x468bfa[_0x7cbd('0xda')]||undefined})[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x19a')));break;case 0x0:if(_0x468bfa['countnosuchnumberretry']>=_0x5a87c5[_0x7cbd('0x19b')]-0x1){return!![];}else{this[_0x7cbd('0xc4')]({'active':![],'countnosuchnumberretry':_0x468bfa[_0x7cbd('0xf5')]+=0x1,'scheduledat':moment()[_0x7cbd('0xfe')](_0x5a87c5['dialNoSuchNumberRetryFrequency'],'minutes')[_0x7cbd('0x7a')](_0x7cbd('0x100')),'ContactId':_0x468bfa[_0x7cbd('0xd6')],'ListId':_0x468bfa[_0x7cbd('0xd7')],'VoiceQueueId':_0x468bfa[_0x7cbd('0xd9')]||undefined,'CampaignId':_0x468bfa[_0x7cbd('0xda')]||undefined})[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x19c')));}break;case 0xa:if(_0x468bfa[_0x7cbd('0x106')]>=_0x5a87c5[_0x7cbd('0x11b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x468bfa['countdropretry']+=0x1,'scheduledat':moment()[_0x7cbd('0xfe')](_0x5a87c5[_0x7cbd('0x19d')],_0x7cbd('0xff'))[_0x7cbd('0x7a')](_0x7cbd('0x100')),'ContactId':_0x468bfa[_0x7cbd('0xd6')],'ListId':_0x468bfa[_0x7cbd('0xd7')],'VoiceQueueId':_0x468bfa['VoiceQueueId']||undefined,'CampaignId':_0x468bfa[_0x7cbd('0xda')]||undefined})[_0x7cbd('0xb5')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x468bfa[_0x7cbd('0xf6')]>=_0x5a87c5[_0x7cbd('0x121')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x468bfa[_0x7cbd('0xf6')]+=0x1,'scheduledat':moment()[_0x7cbd('0xfe')](_0x5a87c5[_0x7cbd('0x19e')],_0x7cbd('0xff'))['format'](_0x7cbd('0x100')),'ContactId':_0x468bfa[_0x7cbd('0xd6')],'ListId':_0x468bfa['ListId'],'VoiceQueueId':_0x468bfa[_0x7cbd('0xd9')]||undefined,'CampaignId':_0x468bfa['CampaignId']||undefined})[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x122')));break;case 0x13:if(_0x468bfa[_0x7cbd('0xf7')]>=_0x5a87c5['dialMachineMaxRetry']-0x1){return!![];}this[_0x7cbd('0xc4')]({'active':![],'countmachineretry':_0x468bfa['countmachineretry']+=0x1,'scheduledat':moment()[_0x7cbd('0xfe')](_0x5a87c5['dialMachineRetryFrequency'],_0x7cbd('0xff'))['format'](_0x7cbd('0x100')),'ContactId':_0x468bfa['ContactId'],'ListId':_0x468bfa[_0x7cbd('0xd7')],'VoiceQueueId':_0x468bfa[_0x7cbd('0xd9')]||undefined,'CampaignId':_0x468bfa['CampaignId']||undefined})[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x109')));break;case 0x14:if(_0x468bfa[_0x7cbd('0xf8')]>=_0x5a87c5[_0x7cbd('0x19f')]-0x1){return!![];}this[_0x7cbd('0xc4')]({'active':![],'countagentrejectretry':_0x468bfa[_0x7cbd('0xf8')]+=0x1,'scheduledat':moment()['add'](_0x5a87c5[_0x7cbd('0x1a0')],_0x7cbd('0xff'))[_0x7cbd('0x7a')](_0x7cbd('0x100')),'ContactId':_0x468bfa[_0x7cbd('0xd6')],'ListId':_0x468bfa['ListId'],'VoiceQueueId':_0x468bfa[_0x7cbd('0xd9')]||undefined,'CampaignId':_0x468bfa[_0x7cbd('0xda')]||undefined})[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x1a1')));break;default:return!![];}};Dialer['prototype'][_0x7cbd('0x192')]=function(_0x2aaf60,_0x301512,_0x8cb75b){var _0x219bde=this;var _0x577e2d=new History(_0x2aaf60);return new BPromise(function(_0x380981,_0x38195a){if(_['isUndefined'](_0x301512)&&typeof _0x301512!==_0x7cbd('0x168')){return _0x38195a(msgResponse(_0x7cbd('0x1a2'),'Failure',_0x7cbd('0x1a3')));}if(_['isUndefined'](_0x8cb75b)&&typeof _0x8cb75b!=='object'){return _0x38195a(msgResponse(_0x7cbd('0x1a2'),_0x7cbd('0x143'),_0x7cbd('0x1a4')));}switch(_0x8cb75b[_0x7cbd('0x110')]){case'0':_0x301512[_0x7cbd('0x67')]+=0x1;_0x577e2d[_0x7cbd('0xab')]=0x0;_0x577e2d[_0x7cbd('0xac')]=_0x7cbd('0x1a5');_0x577e2d[_0x7cbd('0xf5')]+=0x1;_0x577e2d['countglobal']+=0x1;ami[_0x7cbd('0x4f')](_0x7cbd('0x1a6'),ut['buildObj'](_0x2aaf60,_0x7cbd('0x1a7')));_0x219bde['createHistory'](_0x577e2d)[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0xf1')));if(_0x219bde[_0x7cbd('0x1a8')](0x0,_0x2aaf60,_0x301512)){if(_0x577e2d[_0x7cbd('0xf5')]>=_0x301512[_0x7cbd('0x19b')]){_0x219bde[_0x7cbd('0xfc')](_0x577e2d,_0x380981,_0x38195a,'reason\x200\x20no\x20such\x20number....');}else{_0x219bde[_0x7cbd('0xf9')](_0x577e2d,_0x380981,_0x38195a,_0x7cbd('0x1a9'));}}break;case'3':_0x301512['outboundNoAnswerCallsDay']+=0x1;_0x577e2d[_0x7cbd('0xab')]=0x3;_0x577e2d[_0x7cbd('0xac')]=_0x7cbd('0x1aa');_0x577e2d[_0x7cbd('0xf4')]+=0x1;_0x577e2d[_0x7cbd('0xf0')]+=0x1;ami[_0x7cbd('0x4f')](_0x7cbd('0x1ab'),ut[_0x7cbd('0x102')](_0x2aaf60,_0x7cbd('0x1ac')));_0x219bde[_0x7cbd('0xcf')](_0x577e2d)[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x1ad')));if(_0x219bde[_0x7cbd('0x1a8')](0x3,_0x2aaf60,_0x301512)){if(_0x577e2d['countnoanswerretry']>=_0x301512[_0x7cbd('0x193')]){_0x219bde[_0x7cbd('0xfc')](_0x577e2d,_0x380981,_0x38195a,'reason\x203\x20ringing\x20no\x20answer');}else{_0x219bde[_0x7cbd('0xf9')](_0x577e2d,_0x380981,_0x38195a,_0x7cbd('0x1ae'));}}break;case'5':_0x301512[_0x7cbd('0x62')]+=0x1;_0x577e2d['state']=0x5;_0x577e2d[_0x7cbd('0xac')]=_0x7cbd('0x1af');_0x577e2d[_0x7cbd('0xf2')]+=0x1;_0x577e2d[_0x7cbd('0xf0')]+=0x1;ami[_0x7cbd('0x4f')]('custom:agentbusy',ut[_0x7cbd('0x102')](_0x2aaf60,'busy'));_0x219bde[_0x7cbd('0xcf')](_0x577e2d)[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x1b0')));if(_0x219bde[_0x7cbd('0x1a8')](0x5,_0x2aaf60,_0x301512)){if(_0x577e2d['countbusyretry']>=_0x301512[_0x7cbd('0x196')]){_0x219bde['createStateFinal'](_0x577e2d,_0x380981,_0x38195a,_0x7cbd('0x1b1'));}else{_0x219bde[_0x7cbd('0xf9')](_0x577e2d,_0x380981,_0x38195a,_0x7cbd('0x1b1'));}}break;case'8':_0x301512['outboundCongestionCallsDay']+=0x1;_0x577e2d[_0x7cbd('0xab')]=0x8;_0x577e2d[_0x7cbd('0xac')]='Congestion';_0x577e2d[_0x7cbd('0xf3')]+=0x1;_0x577e2d[_0x7cbd('0xf0')]+=0x1;ami[_0x7cbd('0x4f')](_0x7cbd('0x1b2'),ut['buildObj'](_0x2aaf60,'congestion'));_0x219bde[_0x7cbd('0xcf')](_0x577e2d)['catch'](loggerCatch(_0x7cbd('0x1b3')));if(_0x219bde[_0x7cbd('0x1a8')](0x8,_0x2aaf60,_0x301512)){if(_0x577e2d[_0x7cbd('0xf3')]>=_0x301512[_0x7cbd('0x1b4')]){_0x219bde['createStateFinal'](_0x577e2d,_0x380981,_0x38195a,'reason\x208\x20congestion');}else{_0x219bde[_0x7cbd('0xf9')](_0x577e2d,_0x380981,_0x38195a,_0x7cbd('0x1b5'));}}break;case'11':_0x301512[_0x7cbd('0x1b6')]+=0x1;_0x577e2d[_0x7cbd('0xab')]=0xb;_0x577e2d[_0x7cbd('0xac')]=_0x7cbd('0x1b7');_0x577e2d[_0x7cbd('0xf6')]+=0x1;_0x577e2d['countglobal']+=0x1;_0x219bde[_0x7cbd('0xcf')](_0x577e2d)[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x123')));if(_0x219bde[_0x7cbd('0x1a8')](0xb,_0x2aaf60,_0x301512)){if(_0x577e2d[_0x7cbd('0xf6')]>=_0x301512['dialAbandonedMaxRetry']){_0x219bde['createStateFinal'](_0x577e2d,_0x380981,_0x38195a,_0x7cbd('0x1b8'));}else{_0x219bde['stateGlobal'](_0x577e2d,_0x380981,_0x38195a,_0x7cbd('0x1b8'));}}break;case'20':_0x301512['outboundRejectCallsDay']+=0x1;_0x577e2d[_0x7cbd('0xab')]=0x14;_0x577e2d['statedesc']=_0x7cbd('0x1b9');_0x577e2d[_0x7cbd('0xf8')]+=0x1;_0x577e2d[_0x7cbd('0xf0')]+=0x1;ami[_0x7cbd('0x4f')]('custom:agentreject',ut[_0x7cbd('0x102')](_0x2aaf60,_0x7cbd('0x1ba')));_0x219bde[_0x7cbd('0xcf')](_0x577e2d)[_0x7cbd('0xb5')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x219bde[_0x7cbd('0x1a8')](0x14,_0x2aaf60,_0x301512)){if(_0x577e2d[_0x7cbd('0xf8')]>=_0x301512['dialAgentRejectMaxRetry']){_0x219bde[_0x7cbd('0xfc')](_0x577e2d,_0x380981,_0x38195a,'reason\x2020\x20agentreject');}else{_0x219bde['stateGlobal'](_0x577e2d,_0x380981,_0x38195a,_0x7cbd('0x1bb'));}}break;default:_0x301512['outboundUnknownCallsDay']+=0x1;_0x577e2d[_0x7cbd('0xab')]=0xc;_0x577e2d[_0x7cbd('0xac')]=_0x8cb75b[_0x7cbd('0x110')];_0x219bde[_0x7cbd('0xcf')](_0x577e2d)[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x1bc')));if(_0x219bde[_0x7cbd('0x1a8')](_0x8cb75b[_0x7cbd('0x110')],_0x2aaf60,_0x301512)){if(_0x577e2d[_0x7cbd('0xf2')]+_0x577e2d[_0x7cbd('0xf3')]+_0x577e2d[_0x7cbd('0xf4')]+_0x577e2d['countnosuchnumberretry']+_0x577e2d[_0x7cbd('0x106')]+_0x577e2d['countabandonedretry']+_0x577e2d['countmachineretry']+_0x577e2d[_0x7cbd('0xf8')]>=_0x301512[_0x7cbd('0x107')]){_0x219bde[_0x7cbd('0xf9')](_0x577e2d,_0x380981,_0x38195a,_0x8cb75b[_0x7cbd('0x110')]);}else{_0x219bde['createStateFinal'](_0x577e2d,_0x380981,_0x38195a,_0x8cb75b[_0x7cbd('0x110')]);}}}});};Dialer[_0x7cbd('0x1c')][_0x7cbd('0xf9')]=function(_0xb6fa5a,_0x23aaa1,_0x2e7cd8,_0x2730df){var _0x1884b2=new Final(_0xb6fa5a);_0x1884b2['state']=0xf;_0x1884b2[_0x7cbd('0xac')]=_0x7cbd('0x1bd');this[_0x7cbd('0xfc')](_0x1884b2,_0x23aaa1,_0x2e7cd8,_0x2730df);};Dialer[_0x7cbd('0x1c')]['createStateFinal']=function(_0x1d49e8,_0x460797,_0x54492c,_0x13e1dc){this['moveContactManagedDialer'](_0x1d49e8)[_0x7cbd('0x3e')](function(){return _0x460797(msgResponse(_0x7cbd('0x1a2'),_0x7cbd('0xdd'),_0x13e1dc));})[_0x7cbd('0xb5')](function(){return _0x54492c(msgResponse('[moveContactManagedDialer][0]','Failure','contact\x20not\x20moved'));});};Dialer['prototype'][_0x7cbd('0xc')]=function(_0x648c0a){var _0x483100=_0x648c0a[_0x7cbd('0x1be')]/0x64;var _0x4758ab=_0x648c0a[_0x7cbd('0x66')]/(_0x648c0a[_0x7cbd('0x66')]+_0x648c0a[_0x7cbd('0x61')]);var _0x3ec556=Math[_0x7cbd('0x1bf')](_0x648c0a[_0x7cbd('0x1c0')]*(_0x648c0a[_0x7cbd('0x1c1')]/0x64));var _0x2ec17a=Math[_0x7cbd('0x1bf')](_0x648c0a['predictiveIntervalAvailable']*(_0x648c0a['predictiveIntervalMinThreshold']/0x64));var _0x2ed401=_0x648c0a[_0x7cbd('0x52')]+_0x648c0a[_0x7cbd('0xa4')];var _0x5ede27=Math[_0x7cbd('0x1c2')](_0x648c0a[_0x7cbd('0x74')]*_0x648c0a[_0x7cbd('0x75')]*_0x648c0a[_0x7cbd('0x71')]*_0x648c0a[_0x7cbd('0x1c3')]);if(_['isUndefined'](_0x648c0a[_0x7cbd('0x28')])){if(!_[_0x7cbd('0x40')](_0x648c0a[_0x7cbd('0x27')])){_0x648c0a[_0x7cbd('0x27')]=undefined;loggerPredictive[_0x7cbd('0x9b')]('[startMethodPredictive][StartProgressive]',_0x7cbd('0x1c4'));}if(!_['isUndefined'](_0x648c0a[_0x7cbd('0x95')])){loggerPredictive[_0x7cbd('0x9b')](_0x7cbd('0x1c5'),_0x7cbd('0x1c6'));clearInterval(_0x648c0a[_0x7cbd('0x95')]);_0x648c0a['handlePredictive']=undefined;}_0x648c0a['startProgressive']=moment()[_0x7cbd('0x7a')](_0x7cbd('0x100'));loggerPredictive[_0x7cbd('0x82')](_0x648c0a['name'],_0x7cbd('0x1c7'),_0x648c0a[_0x7cbd('0x28')]);this[_0x7cbd('0x159')](_0x648c0a,0x1);}else if(ifInterval(_0x648c0a[_0x7cbd('0x1c8')],_0x648c0a[_0x7cbd('0x28')])){this[_0x7cbd('0x159')](_0x648c0a,0x1);loggerPredictiveCalls[_0x7cbd('0x82')](_0x7cbd('0x1c9'),_0x648c0a['startProgressive'],_0x648c0a[_0x7cbd('0x42')]);_0x648c0a[_0x7cbd('0x74')]=0x0;_0x648c0a[_0x7cbd('0x70')]=0x0;}else if(_0x483100<_0x4758ab&&_0x648c0a['dialPredictiveOptimization']===_0x7cbd('0x1ca')){freeVariablesPredictive(_0x648c0a);loggerPredictive[_0x7cbd('0x82')](_0x7cbd('0x1cb'),_0x7cbd('0x1cc'),_0x4758ab,_0x7cbd('0x28'),_0x648c0a['name']);}else if(_0x5ede27<_0x648c0a[_0x7cbd('0x70')]&&_0x648c0a[_0x7cbd('0x1cd')]===_0x7cbd('0x1ca')){freeVariablesPredictive(_0x648c0a);loggerPredictive['info'](_0x7cbd('0x1ce'),_0x7cbd('0x1cf'),_0x5ede27,_0x7cbd('0x1d0'),_0x648c0a[_0x7cbd('0x70')],_0x7cbd('0x28'),_0x648c0a[_0x7cbd('0x42')]);}else if(!ifInterval(_0x648c0a[_0x7cbd('0x1c8')],_0x648c0a[_0x7cbd('0x28')])&&_[_0x7cbd('0x40')](_0x648c0a[_0x7cbd('0x27')])&&!_['isUndefined'](_0x648c0a[_0x7cbd('0x28')])){_0x648c0a[_0x7cbd('0x27')]=moment()[_0x7cbd('0x7a')](_0x7cbd('0x100'));loggerPredictive[_0x7cbd('0x82')](_0x648c0a[_0x7cbd('0x42')],_0x7cbd('0x1d1'),_0x648c0a[_0x7cbd('0x27')]);this[_0x7cbd('0xc1')](_0x648c0a[_0x7cbd('0x1c8')])[_0x7cbd('0x3e')](this[_0x7cbd('0x1d2')](_0x648c0a))[_0x7cbd('0x3e')](mergeDataErlangB(_0x648c0a))[_0x7cbd('0x3e')](this[_0x7cbd('0x1d3')](_0x648c0a))['catch'](loggerCatchPredictive(_0x7cbd('0x1d4'),_0x648c0a));}else if(!ifInterval(_0x648c0a[_0x7cbd('0x1c8')],_0x648c0a['startPredictive'])){_0x648c0a[_0x7cbd('0x70')]=0x0;_0x648c0a['startPredictive']=moment()[_0x7cbd('0x7a')](_0x7cbd('0x100'));loggerPredictive[_0x7cbd('0x82')](_0x648c0a['name'],_0x7cbd('0x1d5'),_0x648c0a['startPredictive']);clearInterval(_0x648c0a[_0x7cbd('0x95')]);_0x648c0a[_0x7cbd('0x95')]=undefined;this['averageHandleTime'](_0x648c0a[_0x7cbd('0x1c8')])[_0x7cbd('0x3e')](this[_0x7cbd('0x1d2')](_0x648c0a))['then'](mergeDataErlangB(_0x648c0a))['then'](this[_0x7cbd('0x1d3')](_0x648c0a))[_0x7cbd('0xb5')](loggerCatchPredictive(_0x7cbd('0x1d6'),_0x648c0a));}else if(_0x648c0a[_0x7cbd('0x1c0')]&&_0x2ed401<_0x648c0a[_0x7cbd('0x1c0')]-_0x2ec17a){freeVariablesPredictive(_0x648c0a);loggerPredictive['info'](_0x648c0a['name'],_0x7cbd('0x1d7'),_0x2ed401,')\x20are\x20less\x20than\x20threshold\x20(',_0x648c0a[_0x7cbd('0x1c0')],'-',_0x2ec17a,'=',_0x648c0a[_0x7cbd('0x1c0')]-_0x2ec17a,')');}else if(_0x648c0a[_0x7cbd('0x1c0')]&&_0x2ed401>_0x648c0a[_0x7cbd('0x1c0')]+_0x3ec556){freeVariablesPredictive(_0x648c0a);loggerPredictive['info'](_0x648c0a[_0x7cbd('0x42')],_0x7cbd('0x1d7'),_0x2ed401,_0x7cbd('0x1d8'),_0x648c0a[_0x7cbd('0x1c0')],'+',_0x3ec556,'=',_0x648c0a['predictiveIntervalAvailable']+_0x3ec556,')');}};Dialer[_0x7cbd('0x1c')][_0x7cbd('0x1d2')]=function(_0x4b5c26){var _0x189024=this;return function(_0x11f2c7){return new BPromise(function(_0xadd891,_0x3f063c){_['merge'](_0x4b5c26,_0x11f2c7[0x0]);if(checkGetDataPredictive(_0x11f2c7[0x0])){var _0x2d8879=_0x4b5c26[_0x7cbd('0x1c0')]=_0x4b5c26[_0x7cbd('0xa4')]+_0x4b5c26[_0x7cbd('0x52')];var _0x53e64c=_0x4b5c26[_0x7cbd('0x1c8')]*0x3c;var _0x466d54=_0x11f2c7[0x0][_0x7cbd('0x89')]+_0x11f2c7[0x0][_0x7cbd('0x6c')];var _0xbd7183=(_0x11f2c7[0x0]['predictiveIntervalAnsweredCalls']+_0x11f2c7[0x0][_0x7cbd('0x6e')]+_0x11f2c7[0x0][_0x7cbd('0x6d')])/_0x11f2c7[0x0][_0x7cbd('0x73')];_0x4b5c26[_0x7cbd('0x71')]=_0xbd7183>0x0?_0xbd7183:0x1;switch(_0x4b5c26[_0x7cbd('0x1cd')]){case _0x7cbd('0x1ca'):var _0x36c47d=_0x4b5c26[_0x7cbd('0x1be')]/0x64;return _0x189024[_0x7cbd('0x1d9')](_0x2d8879,_0x53e64c,_0x466d54,_0xbd7183,_0x36c47d)[_0x7cbd('0x3e')](function(_0x2a2445){return _0xadd891(_0x2a2445);});case _0x7cbd('0x1da'):var _0x53763f=_0x4b5c26[_0x7cbd('0x1be')]/0x64;return _0x189024['busyFactor'](_0x2d8879,_0x53e64c,_0x466d54,_0xbd7183,_0x53763f)['then'](function(_0x4aa85f){return _0xadd891(_0x4aa85f);});default:return _0x3f063c(msgResponse(_0x7cbd('0x1db'),_0x7cbd('0x143'),'Unknown\x20Predictive'));}}else{return _0x3f063c(msgResponse(_0x7cbd('0x1db'),_0x7cbd('0x143'),_0x7cbd('0x1dc')));}});};};Dialer[_0x7cbd('0x1c')][_0x7cbd('0x1dd')]=function(_0x2b72a6){var _0x5f5adf=this;return function(_0x1bdb66){return new BPromise(function(_0x1d1306,_0x4a612b){_[_0x7cbd('0x92')](_0x2b72a6,_0x1bdb66[0x0]);if(checkGetDataPredictive(_0x1bdb66[0x0])){loggerPredictive['info'](JSON[_0x7cbd('0x4c')](_0x1bdb66[0x0]));if(_0x2b72a6[_0x7cbd('0x1cd')]===_0x7cbd('0x1ca')){return _0x5f5adf[_0x7cbd('0x1de')](_0x2b72a6['id'])['then'](function(_0xf9eda7){var _0x1c9d95=_0x2b72a6[_0x7cbd('0x53')]-_0xf9eda7[0x0][_0x7cbd('0x1df')];var _0x2abacf=_0x2b72a6['dialPredictiveInterval']*0x3c;var _0xc756c1=_0x1bdb66[0x0][_0x7cbd('0x89')]+_0x1bdb66[0x0][_0x7cbd('0x6c')];var _0x1edd2f=(_0x1bdb66[0x0]['predictiveIntervalAnsweredCalls']+_0x1bdb66[0x0][_0x7cbd('0x6e')]+_0x1bdb66[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1bdb66[0x0]['predictiveIntervalTotalCalls'];var _0x596ea3=_0x2b72a6[_0x7cbd('0x1be')]/0x64;_0x2b72a6['predictiveIntervalPauses']=_0xf9eda7[0x0]['outboundQueuePauses']||0x0;_0x2b72a6[_0x7cbd('0x71')]=_0x1edd2f>0x0?_0x1edd2f:0x1;return _0x5f5adf[_0x7cbd('0x1d9')](_0x1c9d95,_0x2abacf,_0xc756c1,_0x1edd2f,_0x596ea3);})[_0x7cbd('0x3e')](function(_0x4e7621){return _0x1d1306(_0x4e7621);})['catch'](function(_0x251d2e){return _0x4a612b(msgResponse(_0x7cbd('0x1e0'),_0x7cbd('0x143'),JSON[_0x7cbd('0x4c')](_0x251d2e)));});}if(_0x2b72a6[_0x7cbd('0x1cd')]===_0x7cbd('0x1da')){return _0x5f5adf['getVoiceQueueRtPauses'](_0x2b72a6['id'])['then'](function(_0x336ebf){var _0x5b522a=_0x2b72a6[_0x7cbd('0x53')]-_0x336ebf[0x0][_0x7cbd('0x1df')];var _0x5a4549=_0x2b72a6[_0x7cbd('0x1c8')]*0x3c;var _0x54a934=_0x1bdb66[0x0][_0x7cbd('0x89')]+_0x1bdb66[0x0]['predictiveIntervalAvgHoldtime'];var _0x2607e6=(_0x1bdb66[0x0][_0x7cbd('0x6b')]+_0x1bdb66[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1bdb66[0x0][_0x7cbd('0x6d')])/_0x1bdb66[0x0][_0x7cbd('0x73')];var _0x571754=_0x2b72a6[_0x7cbd('0x1be')]/0x64;_0x2b72a6[_0x7cbd('0x72')]=_0x336ebf[0x0][_0x7cbd('0x1df')]||0x0;_0x2b72a6[_0x7cbd('0x71')]=_0x2607e6>0x0?_0x2607e6:0x1;return _0x5f5adf[_0x7cbd('0x1e1')](_0x5b522a,_0x5a4549,_0x54a934,_0x2607e6,_0x571754);})[_0x7cbd('0x3e')](function(_0x41f394){return _0x1d1306(_0x41f394);})[_0x7cbd('0xb5')](function(_0x2b2624){return _0x4a612b(msgResponse(_0x7cbd('0x1e0'),_0x7cbd('0x143'),JSON[_0x7cbd('0x4c')](_0x2b2624)));});}}else{return _0x4a612b(msgResponse(_0x7cbd('0x1db'),_0x7cbd('0x143'),'check\x20failure'));}});};};Dialer[_0x7cbd('0x1c')]['startMethodPredictive']=function(_0x54f983){var _0x653279=this;return function(){var _0x47ac07=0x0;var _0xfde935=Math[_0x7cbd('0x1c2')](_0x54f983[_0x7cbd('0x8f')]*0x3e8);if(_0xfde935>0x0){_0xfde935=_0xfde935<0x64?0x64:_0xfde935;loggerPredictive['info'](_0x54f983[_0x7cbd('0x42')],_0x7cbd('0x1e2'),_0xfde935,_0x7cbd('0x4d'));_0x54f983[_0x7cbd('0x95')]=setInterval(function(){_0x653279['handlePredictive'](_0x54f983);loggerPredictiveCalls[_0x7cbd('0x82')]('[handlePredictive]',_0x47ac07+=0x1);},_0xfde935);}else{loggerPredictive[_0x7cbd('0x82')](_0x54f983[_0x7cbd('0x42')],_0x7cbd('0x1e3'));}};};Dialer[_0x7cbd('0x1c')][_0x7cbd('0x1e4')]=function(_0x2595c9,_0x237348){var _0x22ea05=this;return function(_0x2b17e3){if(_['isEmpty'](_0x2b17e3)){if(_['isNil'](_0x237348[_0x7cbd('0xd8')])||!_0x237348['recallme']){if(_0x2595c9[_0x7cbd('0x157')]===_0x7cbd('0xb')){_0x2595c9[_0x7cbd('0x12d')]=_['isUndefined'](_0x2595c9['queueStatusComplete'])?!![]:_0x2595c9[_0x7cbd('0x12d')];var _0x416121=uuid['v4']();_0x22ea05['actions'][_0x416121]=new Action(_0x2595c9,_0x237348,_0x416121);loggerBooked[_0x7cbd('0x82')](_0x7cbd('0x1e5'),_0x416121,_0x7cbd('0x1e6'),JSON[_0x7cbd('0x4c')](_0x2595c9[_0x7cbd('0x12d')]),_0x7cbd('0x1e7'),_0x2595c9['name']);if(_0x2595c9[_0x7cbd('0x12d')]){_0x2595c9[_0x7cbd('0x12d')]=![];_0x22ea05[_0x7cbd('0x2a')][_0x22ea05[_0x7cbd('0x24')][_0x416121]['queue']]=[];ami[_0x7cbd('0xb3')]({'actionid':_0x416121,'action':_0x7cbd('0x1e8'),'queue':_0x2595c9[_0x7cbd('0x42')]})[_0x7cbd('0xb5')](function(){_0x22ea05[_0x7cbd('0xb7')](_0x2595c9);_0x22ea05['rescheduleContact']({'active':![],'ContactId':_0x22ea05[_0x7cbd('0x24')][_0x416121][_0x7cbd('0xd6')],'ListId':_0x22ea05[_0x7cbd('0x24')][_0x416121]['ListId'],'VoiceQueueId':_0x22ea05['actions'][_0x416121][_0x7cbd('0xd9')]||undefined,'CampaignId':_0x22ea05[_0x7cbd('0x24')][_0x416121][_0x7cbd('0xda')]||undefined})[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x1e9')));delete _0x22ea05[_0x7cbd('0x24')][_0x416121];});}else{loggerBooked['info'](_0x7cbd('0x1ea'),JSON[_0x7cbd('0x4c')](_0x2595c9[_0x7cbd('0x12d')]),_0x7cbd('0x1e7'),_0x2595c9[_0x7cbd('0x42')]);_0x22ea05[_0x7cbd('0xb7')](_0x2595c9);_0x22ea05['rescheduleContact']({'active':![],'ContactId':_0x22ea05[_0x7cbd('0x24')][_0x416121][_0x7cbd('0xd6')],'ListId':_0x22ea05[_0x7cbd('0x24')][_0x416121][_0x7cbd('0xd7')],'VoiceQueueId':_0x22ea05[_0x7cbd('0x24')][_0x416121][_0x7cbd('0xd9')]||undefined,'CampaignId':_0x22ea05[_0x7cbd('0x24')][_0x416121][_0x7cbd('0xda')]||undefined})[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x1e9')));delete _0x22ea05[_0x7cbd('0x24')][_0x416121];}}else{return _0x22ea05[_0x7cbd('0x1eb')](_0x2595c9,_0x237348);}}else{if(getDiff(_0x237348['scheduledat'])<_0x2595c9[_0x7cbd('0x1ec')]*0x3c){if(_0x237348['Agent']&&!_0x237348[_0x7cbd('0x15e')][_0x7cbd('0x1ed')]){_0x22ea05[_0x7cbd('0x97')][_0x7cbd('0x130')](_0x237348['id'])[_0x7cbd('0x1e')](function(){_0x22ea05[_0x7cbd('0xb7')](_0x2595c9);});}else{_0x22ea05[_0x7cbd('0xc6')]({'active':![]},_0x237348['id'],0x1)[_0x7cbd('0x1e')](function(){_0x22ea05['updateOriginated'](_0x2595c9);});}}else{_0x2595c9[_0x7cbd('0x69')]+=0x1;_0x22ea05[_0x7cbd('0xb7')](_0x2595c9);if(_0x2595c9[_0x7cbd('0x1ee')]){_0x22ea05[_0x7cbd('0xc4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x237348[_0x7cbd('0xd6')],'ListId':_0x237348[_0x7cbd('0xd7')],'VoiceQueueId':_0x237348[_0x7cbd('0xd9')]||undefined,'CampaignId':_0x237348[_0x7cbd('0xda')]||undefined})[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0x1ef')));_0x22ea05[_0x7cbd('0xcf')](createObjHistory(_0x2595c9,_0x237348,_0x7cbd('0x1f0'),0x17,_0x7cbd('0x1f1')))[_0x7cbd('0xb5')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x22ea05[_0x7cbd('0xed')](createObjHistory(_0x2595c9,_0x237348,_0x7cbd('0x1f2'),0x16,_0x7cbd('0x1f3')),_0x7cbd('0x1f4'),'[Originate][HistoryRecallClose]');}}}}else{_0x2595c9[_0x7cbd('0x1f5')]+=0x1;_0x22ea05['saveInDb'](createObjHistory(_0x2595c9,_0x237348,_0x7cbd('0x1f6'),0xd,_0x7cbd('0x1f7')),_0x7cbd('0x1f8'),'[Originate][MoveBlacklist]');throw _0x7cbd('0x1f9');}};};Dialer[_0x7cbd('0x1c')][_0x7cbd('0x161')]=function(_0x563773){var _0x1b07b8=this;var _0x1a60b1=_0x563773[_0x7cbd('0x1fa')]-_0x563773[_0x7cbd('0x9f')]-_0x563773[_0x7cbd('0xc9')];emitCampaignSummary(_0x563773);if(_0x1a60b1>0x0){if(_0x1a60b1>this['maxNumberOriginate']){_0x1a60b1=this['maxNumberOriginate'];}_0x563773['temp']+=_0x1a60b1;this['getContactDialerIvr'](_0x563773['id'],_0x1a60b1,_0x563773[_0x7cbd('0x1fb')],_0x563773)[_0x7cbd('0x3e')](function(_0x1eb385){_0x563773[_0x7cbd('0xc9')]-=_0x1a60b1;_0x563773[_0x7cbd('0xc9')]=_0x563773[_0x7cbd('0xc9')]>0x0?_0x563773[_0x7cbd('0xc9')]:0x0;if(!checkContactEmpty(_0x1eb385)){_0x563773[_0x7cbd('0x46')]=_0x7cbd('0x1fc');logger['info'](_0x7cbd('0x1fd')+_0x563773[_0x7cbd('0x42')]);}else{_0x563773[_0x7cbd('0x9f')]+=_0x1eb385['length'];_0x563773[_0x7cbd('0x46')]=_0x7cbd('0x1fe');for(var _0x4d2968=0x0;_0x4d2968<_0x1eb385[_0x7cbd('0x9e')];_0x4d2968+=0x1){_0x563773[_0x7cbd('0x1ff')]+=0x1;if(_[_0x7cbd('0xb2')](_0x1eb385[_0x4d2968])||_[_0x7cbd('0xb2')](_0x1eb385[_0x4d2968][_0x7cbd('0x17f')])||_[_0x7cbd('0xb2')](_0x1eb385[_0x4d2968][_0x7cbd('0x17f')][_0x7cbd('0x16b')])){_0x1b07b8[_0x7cbd('0xd3')](_0x7cbd('0x200'),_0x563773,_0x1eb385[_0x4d2968]);}else{_0x1b07b8[_0x7cbd('0xbf')](_[_0x7cbd('0xd5')](_0x1eb385[_0x4d2968],[_0x7cbd('0xda'),_0x7cbd('0x201')]))['then'](_0x1b07b8[_0x7cbd('0x1e4')](_0x563773,_0x1eb385[_0x4d2968]))[_0x7cbd('0xb5')](_0x1b07b8[_0x7cbd('0xd2')](_0x7cbd('0x202'),_0x563773));}}}})['catch'](loggerGetContactDialer(_0x7cbd('0x203'),_0x563773,_0x1a60b1));}};Dialer[_0x7cbd('0x1c')][_0x7cbd('0x159')]=function(_0x409783,_0x58c742){var _0x5e3d2a=this;var _0x3a13f9=[];var _0x3bfdb4=_0x58c742>=0x1?_0x58c742:0x1;if(_0x409783['dialMethod']===_0x7cbd('0xb')){_0x3bfdb4=0x1;}var _0x306309=Math['floor'](_0x409783[_0x7cbd('0x52')]*_0x3bfdb4)-_0x409783[_0x7cbd('0x9f')]-_0x409783[_0x7cbd('0xc9')];emitVoiceQueueSummary(_0x409783);if(_0x409783[_0x7cbd('0x204')]>0x0){var _0xe9d2d8=_0x409783[_0x7cbd('0x204')]-_0x409783[_0x7cbd('0x9f')]-_0x409783[_0x7cbd('0xa4')]-_0x409783[_0x7cbd('0xc9')]-_0x409783[_0x7cbd('0x54')];if(_0x306309>_0xe9d2d8){_0x306309=_0xe9d2d8;}}if(_0x306309>0x0){if(_0x409783['dialMethod']===_0x7cbd('0xb')){_0x306309=0x1;}if(_0x306309>this['maxNumberOriginate']){_0x306309=this['maxNumberOriginate'];}_0x409783[_0x7cbd('0xc9')]+=_0x306309;for(var _0x41d169 in this[_0x7cbd('0x22')]){if(typeof this[_0x7cbd('0x22')][_0x41d169]!==_0x7cbd('0xa0')){if(this[_0x7cbd('0x22')][_0x41d169][_0x7cbd('0xab')]===_0x7cbd('0x205')&&this[_0x7cbd('0x22')][_0x41d169]['status']==='reachable'){_0x3a13f9['push'](this['agents'][_0x41d169]['id']);}}}this[_0x7cbd('0xc8')](_0x409783['id'],_0x3a13f9,_0x306309,_0x409783['dialOrderByScheduledAt'],_0x409783)[_0x7cbd('0x3e')](function(_0x5faa97){_0x409783[_0x7cbd('0xc9')]-=_0x306309;_0x409783['temp']=_0x409783[_0x7cbd('0xc9')]>0x0?_0x409783[_0x7cbd('0xc9')]:0x0;if(!checkContactEmpty(_0x5faa97)){_0x5e3d2a[_0x7cbd('0xbb')](_0x409783)[_0x7cbd('0x3e')](sendMessageReschedule(_0x409783))[_0x7cbd('0xb5')](loggerCatch('[countReScheduled]\x20'));}else{_0x409783[_0x7cbd('0x9f')]+=_0x5faa97[_0x7cbd('0x9e')];_0x409783[_0x7cbd('0x46')]=_0x409783[_0x7cbd('0x157')]===_0x7cbd('0xb')?_0x7cbd('0x206'):_0x7cbd('0x1fe');for(var _0x5beaa3=0x0;_0x5beaa3<_0x5faa97['length'];_0x5beaa3+=0x1){if(_[_0x7cbd('0xb2')](_0x5faa97[_0x5beaa3])||_[_0x7cbd('0xb2')](_0x5faa97[_0x5beaa3][_0x7cbd('0x17f')])||_[_0x7cbd('0xb2')](_0x5faa97[_0x5beaa3][_0x7cbd('0x17f')][_0x7cbd('0x16b')])){_0x5e3d2a[_0x7cbd('0xd3')]('[actionOriginate]\x20',_0x409783,_0x5faa97[_0x5beaa3]);}else{_0x5e3d2a[_0x7cbd('0xbe')](_[_0x7cbd('0xd5')](_0x5faa97[_0x5beaa3],[_0x7cbd('0xd9'),_0x7cbd('0x201')]))['then'](_0x5e3d2a['checkContactBlack'](_0x409783,_0x5faa97[_0x5beaa3]))['catch'](_0x5e3d2a['loggerHandler'](_0x7cbd('0x200'),_0x409783));}}}})[_0x7cbd('0xb5')](loggerGetContactDialer(_0x7cbd('0x207'),_0x409783,_0x306309));}};Dialer[_0x7cbd('0x1c')]['handlePredictive']=function(_0x1d17d3){if(_0x1d17d3[_0x7cbd('0x204')]>0x0){var _0x43ef70=_0x1d17d3[_0x7cbd('0x204')]-_0x1d17d3[_0x7cbd('0x9f')]-_0x1d17d3[_0x7cbd('0xa4')];if(_0x43ef70>0x0){this[_0x7cbd('0x208')](_0x1d17d3);}else{loggerPredictiveCalls['info'](_0x7cbd('0x209'));}}else{this[_0x7cbd('0x208')](_0x1d17d3);}};Dialer[_0x7cbd('0x1c')][_0x7cbd('0x208')]=function(_0x3833fc){var _0xa1f8a3=this;var _0x43a4bf=[];_0x3833fc[_0x7cbd('0x9f')]+=0x1;for(var _0x368220 in this[_0x7cbd('0x22')]){if(typeof this[_0x7cbd('0x22')][_0x368220]!==_0x7cbd('0xa0')){if(this[_0x7cbd('0x22')][_0x368220][_0x7cbd('0xab')]===_0x7cbd('0x205')&&this[_0x7cbd('0x22')][_0x368220]['status']==='reachable'){_0x43a4bf[_0x7cbd('0x12b')](this[_0x7cbd('0x22')][_0x368220]['id']);}}}this[_0x7cbd('0xc8')](_0x3833fc['id'],_0x43a4bf,0x1,_0x3833fc[_0x7cbd('0x1fb')],_0x3833fc)[_0x7cbd('0x3e')](function(_0x28067a){if(!checkContactEmpty(_0x28067a)){checkContactLowerLimitOriginate(_0x3833fc,0x1,0x0);_0xa1f8a3[_0x7cbd('0xbb')](_0x3833fc)[_0x7cbd('0x3e')](sendMessageReschedule(_0x3833fc))[_0x7cbd('0xb5')](loggerCatch(_0x7cbd('0xbd')));}else{_0x3833fc[_0x7cbd('0x46')]=_0x7cbd('0x1fe');if(_[_0x7cbd('0xb2')](_0x28067a[0x0])||_['isNil'](_0x28067a[0x0][_0x7cbd('0x17f')])||_[_0x7cbd('0xb2')](_0x28067a[0x0][_0x7cbd('0x17f')][_0x7cbd('0x16b')])){_0xa1f8a3[_0x7cbd('0xd3')](_0x7cbd('0x200'),_0x3833fc,_0x28067a[0x0]);}else{_0xa1f8a3[_0x7cbd('0xbe')](_['pick'](_0x28067a[0x0],[_0x7cbd('0xd9'),_0x7cbd('0x201')]))[_0x7cbd('0x3e')](_0xa1f8a3[_0x7cbd('0x1e4')](_0x3833fc,_0x28067a[0x0]))[_0x7cbd('0xb5')](_0xa1f8a3['loggerHandler'](_0x7cbd('0x20a'),_0x3833fc));}}})['catch'](loggerGetContactDialer(_0x7cbd('0x20b'),_0x3833fc,0x1));emitVoiceQueueSummary(_0x3833fc);};Dialer[_0x7cbd('0x1c')]['abandonmentRate']=function(_0x19f490,_0x3c158b,_0x182fd0,_0x1ce1e7,_0x1a3d83,_0x47de94){loggerPredictive[_0x7cbd('0x82')](_0x7cbd('0x20c'));loggerPredictive[_0x7cbd('0x82')]('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',_0x19f490);loggerPredictive[_0x7cbd('0x82')](_0x7cbd('0x20d'),_0x3c158b);loggerPredictive[_0x7cbd('0x82')](_0x7cbd('0x20e'),_0x182fd0);loggerPredictive['info'](_0x7cbd('0x20f'),_0x1ce1e7);loggerPredictive['info'](_0x7cbd('0x210'),_0x1a3d83);loggerPredictive['info'](_0x7cbd('0x8a'));return new BPromise(function(_0x3a7a34,_0x3a8c24){if(_0x19f490<=0x0||isNaN(_0x19f490)){return _0x3a8c24(msgResponse(_0x7cbd('0x211'),'Error',_0x7cbd('0x212')+_0x19f490));}if(_0x182fd0<=0x0||isNaN(_0x182fd0)){return _0x3a8c24(msgResponse(_0x7cbd('0x211'),_0x7cbd('0x4b'),_0x7cbd('0x213')+_0x182fd0));}if(_0x1ce1e7<=0x0||isNaN(_0x1ce1e7)){return _0x3a8c24(msgResponse(_0x7cbd('0x211'),'Error',_0x7cbd('0x214')+_0x1ce1e7));}if(_0x3c158b<=0x0||isNaN(_0x3c158b)){return _0x3a8c24(msgResponse(_0x7cbd('0x211'),_0x7cbd('0x4b'),_0x7cbd('0x215')+_0x3c158b));}if(_0x1a3d83<=0x0||isNaN(_0x1a3d83)){return _0x3a8c24(msgResponse('[abandonmentRate]','Error',_0x7cbd('0x216')+_0x1a3d83));}_0x47de94=_0x47de94||0x0;var _0x51d57c=0x1/_0x182fd0;var _0x358173=0x0;var _0x1c4729=0x0;var _0xa7a46f=0x0;var _0x2b17f0=0x0;for(var _0x16cf1f=0x0;_0xa7a46f<_0x1a3d83;_0x16cf1f+=0x1){_0x1c4729=_0x16cf1f/_0x3c158b;_0x358173=(_0x1ce1e7*_0x1c4729+_0x47de94)/_0x51d57c;_0xa7a46f=erlangb(_0x358173,_0x19f490);_0x2b17f0=_0x358173/_0x19f490*(0x1-erlangb(_0x358173,_0x19f490));}return _0x3a7a34({'erlangCalls':_0x16cf1f,'erlangCallToSecond':_0x3c158b/_0x16cf1f,'erlangAbandonmentRate':_0xa7a46f,'erlangBusyFactor':_0x2b17f0});});};Dialer['prototype'][_0x7cbd('0x1e1')]=function(_0x7d30f2,_0x4daf93,_0x50440b,_0x240a7a,_0x2223ed,_0x3233cc){loggerPredictive[_0x7cbd('0x82')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0x7cbd('0x217'),_0x7d30f2);loggerPredictive['info'](_0x7cbd('0x20d'),_0x4daf93);loggerPredictive[_0x7cbd('0x82')]('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',_0x50440b);loggerPredictive['info'](_0x7cbd('0x20f'),_0x240a7a);loggerPredictive[_0x7cbd('0x82')](_0x7cbd('0x218'),_0x2223ed);loggerPredictive[_0x7cbd('0x82')]('---------------------------');return new BPromise(function(_0x2b20ae,_0x3148b1){if(_0x7d30f2<=0x0||isNaN(_0x7d30f2)){return _0x3148b1(msgResponse(_0x7cbd('0x219'),_0x7cbd('0x4b'),_0x7cbd('0x212')+_0x7d30f2));}if(_0x50440b<=0x0||isNaN(_0x50440b)){return _0x3148b1(msgResponse(_0x7cbd('0x219'),_0x7cbd('0x4b'),'Ts\x20=\x20'+_0x50440b));}if(_0x240a7a<=0x0||isNaN(_0x240a7a)){return _0x3148b1(msgResponse(_0x7cbd('0x219'),_0x7cbd('0x4b'),_0x7cbd('0x214')+_0x240a7a));}if(_0x4daf93<=0x0||isNaN(_0x4daf93)){return _0x3148b1(msgResponse(_0x7cbd('0x219'),'Error',_0x7cbd('0x215')+_0x4daf93));}if(_0x2223ed<=0x0||isNaN(_0x2223ed)){return _0x3148b1(msgResponse(_0x7cbd('0x219'),_0x7cbd('0x4b'),_0x7cbd('0x21a')+_0x2223ed));}_0x3233cc=_0x3233cc||0x0;var _0x3c6a54=0x1/_0x50440b;var _0x43435b=0x0;var _0x2b97d0=0x0;var _0x16555c=0x0;var _0xcbafef=0x0;for(var _0x598c81=0x0;_0xcbafef<_0x2223ed;_0x598c81+=0x1){_0x2b97d0=_0x598c81/_0x4daf93;_0x43435b=(_0x240a7a*_0x2b97d0+_0x3233cc)/_0x3c6a54;_0x16555c=erlangb(_0x43435b,_0x7d30f2);_0xcbafef=_0x43435b/_0x7d30f2*(0x1-erlangb(_0x43435b,_0x7d30f2));}return _0x2b20ae({'erlangCalls':_0x598c81,'erlangCallToSecond':_0x4daf93/_0x598c81,'erlangAbandonmentRate':_0x16555c,'erlangBusyFactor':_0xcbafef});});};module[_0x7cbd('0x21b')]=Dialer; \ No newline at end of file +var _0xedd4=['checkDialMethod','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','Action','SIP/%s/%s%s','trim','dialCutDigit','substring','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','isSuccess','response','[callProgressDetecting]\x20','checkRetriveMax','countnoanswerretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Drop]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dropRate','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','busyFactor','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][MoveBlacklist]','inBlackList','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[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','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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','lodash','uuid','moment','md5','../preview/util/util','dialer','booked','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','seconds','type','strategy','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','format','voice:queue:%s','ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','string','\x22%s\x22\x20<%s>','inspect','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','talking','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','[uniqueid]','clearZombieChannels','[actions]','isNil','channel','catch','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','saveInDb','pick','ContactId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isTrunkReachable','SIP/%s','status','reachable','unmonitored','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','membername','AMD','emit','custom:amd','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','CampaignId','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','reason19\x20machine....','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','outboundUnknownCallsDay','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','queueCallerAbandonCreateState','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','paused','stateinterface','locked','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','preview','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','interval','timezones','content','indexOf','push','true','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20'];(function(_0x3765aa,_0x13c382){var _0xf79e6a=function(_0x1380bc){while(--_0x1380bc){_0x3765aa['push'](_0x3765aa['shift']());}};_0xf79e6a(++_0x13c382);}(_0xedd4,0xcc));var _0x4edd=function(_0x2aaf56,_0x15f86c){_0x2aaf56=_0x2aaf56-0x0;var _0x43c958=_0xedd4[_0x2aaf56];return _0x43c958;};'use strict';var util=require(_0x4edd('0x0'));var _=require(_0x4edd('0x1'));var BPromise=require('bluebird');var uuid=require(_0x4edd('0x2'));var moment=require(_0x4edd('0x3'));var rr=require('rr');var md5=require(_0x4edd('0x4'));var Redis=require('ioredis');var ut=require(_0x4edd('0x5'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0x4edd('0x6'));var loggerBooked=require('../../../config/logger')(_0x4edd('0x7'));var loggerPredictive=require(_0x4edd('0x8'))(_0x4edd('0x9'));var loggerPredictiveCalls=require(_0x4edd('0x8'))(_0x4edd('0xa'));var loggerSyncQueueSummary=require(_0x4edd('0x8'))(_0x4edd('0xb'));var ami=require(_0x4edd('0xc'));config['redis']=_[_0x4edd('0xd')](config[_0x4edd('0xe')],{'host':_0x4edd('0xf'),'port':0x18eb});var io=require(_0x4edd('0x10'))(new Redis(config[_0x4edd('0xe')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x4edd('0x11'));var cmHopperBlack=require(_0x4edd('0x12'));var voiceQueueRt=require(_0x4edd('0x13'));var RpcSetting=require('../rpc/setting');var Action=require('./action');var History=require(_0x4edd('0x14'));var Final=require(_0x4edd('0x15'));var AgentComplete=require(_0x4edd('0x16'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x4edd('0x17'));var ipAgi=process[_0x4edd('0x18')][_0x4edd('0x19')]||_0x4edd('0x1a');var strategy={'rrmemory':_0x4edd('0x1b'),'roundrobin':_0x4edd('0x1c')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x4edd('0x1d')][_0x4edd('0x1e')]=function(_0x546b0e){this[_0x4edd('0x1f')]=this[_0x4edd('0x1f')]?this[_0x4edd('0x1f')][_0x4edd('0x20')](_0x546b0e):_0x546b0e();};function Dialer(_0x3c7fa3,_0x2c95e9){this[_0x4edd('0x21')]=new Sequence();this['preview']=_0x2c95e9;this[_0x4edd('0x22')]=_0x3c7fa3[_0x4edd('0x22')];this[_0x4edd('0x23')]=_0x3c7fa3[_0x4edd('0x23')];this[_0x4edd('0x24')]=_0x3c7fa3[_0x4edd('0x24')];this[_0x4edd('0x25')]=_0x3c7fa3['trunks'];this['maxNumberOriginate']=config[_0x4edd('0x26')]||0x2;this[_0x4edd('0x27')]={};this[_0x4edd('0x28')]={};this[_0x4edd('0x29')]={};this[_0x4edd('0x2a')]={};this['optionPredictive']={};this[_0x4edd('0x2b')]={};this[_0x4edd('0x2c')]={};this[_0x4edd('0x2d')]={};this[_0x4edd('0x2e')]={};this[_0x4edd('0x2f')]={};ami['on']('agentconnect',this[_0x4edd('0x30')][_0x4edd('0x31')](this));ami['on'](_0x4edd('0x32'),this['syncQueueCallerAbandon']['bind'](this));ami['on']('originateresponse',this[_0x4edd('0x33')]['bind'](this));ami['on']('agentcomplete',this[_0x4edd('0x34')][_0x4edd('0x31')](this));ami['on'](_0x4edd('0x35'),this[_0x4edd('0xb')][_0x4edd('0x31')](this));ami['on'](_0x4edd('0x36'),this[_0x4edd('0x37')][_0x4edd('0x31')](this));ami['on'](_0x4edd('0x38'),this[_0x4edd('0x39')]['bind'](this));ami['on'](_0x4edd('0x3a'),this['syncVarSet'][_0x4edd('0x31')](this));ami['on'](_0x4edd('0x3b'),this['syncQueueMember']['bind'](this));ami['on'](_0x4edd('0x3c'),this[_0x4edd('0x3d')][_0x4edd('0x31')](this));this['loopCampaigns']();this[_0x4edd('0x3e')]();RpcSetting[_0x4edd('0x3f')]()[_0x4edd('0x40')](function(_0x10555){previewRecallmeReminderInterval=_0x10555['previewRecallmeReminderInterval'];});}function isNotNull(_0x31dfe3){return _0x31dfe3!==null&&!_[_0x4edd('0x41')](_0x31dfe3);}function checkIsLoggedIn(_0x2f430c,_0x145e3d){return function(){if(_0x145e3d<=0x0){_0x2f430c[_0x4edd('0x42')]=_0x4edd('0x43');throw _0x2f430c['name']+_0x4edd('0x44');}};}function isActive(_0x316224){return _0x316224;}function checkIsActive(_0x535513,_0x2090aa){return function(){if(!isActive(_0x2090aa)){_0x535513[_0x4edd('0x42')]=_0x4edd('0x45');throw _0x535513[_0x4edd('0x46')]+_0x4edd('0x47');}};}function checkInterval(_0xfd5bc8){return function(){if(!isNotNull(_0xfd5bc8[_0x4edd('0x48')])){_0xfd5bc8[_0x4edd('0x42')]=_0x4edd('0x49');throw _0xfd5bc8['name']+_0x4edd('0x4a');}if(!isNotNull(_0xfd5bc8[_0x4edd('0x48')][_0x4edd('0x4b')])){_0xfd5bc8['message']=_0x4edd('0x49');throw _0xfd5bc8[_0x4edd('0x46')]+_0x4edd('0x4a');}if(!isNotNull(_[_0x4edd('0x4c')](_0xfd5bc8[_0x4edd('0x48')]['Intervals']))){_0xfd5bc8['message']='INTERVAL_IS_NULL';throw _0xfd5bc8[_0x4edd('0x46')]+_0x4edd('0x4a');}};}function msgResponse(_0x262208,_0x25ece8,_0x5f31cc){return{'action':_0x262208,'response':_0x25ece8,'message':_0x5f31cc,'stack':_0x5f31cc};}function myreject(_0x145b42){return function(_0x17fcaa){return _0x145b42(msgResponse(_0x4edd('0x4d'),_0x4edd('0x4e'),JSON[_0x4edd('0x4f')](_0x17fcaa)));};}function getSeconds(_0x2d1617,_0x44be1a){var _0x1a495a=moment(_0x2d1617)[_0x4edd('0x50')](0x0);var _0x37ee95=moment(_0x44be1a)['milliseconds'](0x0);return _0x1a495a['diff'](_0x37ee95,_0x4edd('0x51'));}function emit(_0x61dc18,_0x4cb615,_0x40c963){io['to'](_0x61dc18)['emit'](_0x4cb615,_0x40c963);}function emitVoiceQueueSummary(_0x163fd3){if(_0x163fd3[_0x4edd('0x52')]==='outbound'){var _0x25fcbe={'id':_0x163fd3['id'],'name':_0x163fd3['name'],'strategy':_0x163fd3[_0x4edd('0x53')],'answered':_0x163fd3['answered'],'available':_0x163fd3[_0x4edd('0x54')],'loggedIn':_0x163fd3[_0x4edd('0x55')],'pTalking':_0x163fd3[_0x4edd('0x56')],'sumBillable':_0x163fd3[_0x4edd('0x57')],'sumDuration':_0x163fd3['sumDuration'],'sumHoldTime':_0x163fd3[_0x4edd('0x58')]||0x0,'talking':_0x163fd3['talking'],'total':_0x163fd3[_0x4edd('0x59')],'type':_0x163fd3['type'],'unmanaged':_0x163fd3[_0x4edd('0x5a')],'abandoned':_0x163fd3['abandoned'],'waiting':_0x163fd3[_0x4edd('0x5b')],'loggedInDb':_0x163fd3[_0x4edd('0x5c')],'dialActive':_0x163fd3[_0x4edd('0x5d')],'dialMethod':_0x163fd3[_0x4edd('0x5e')],'dialOriginateCallerIdName':_0x163fd3[_0x4edd('0x5f')],'dialOriginateCallerIdNumber':_0x163fd3['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x163fd3[_0x4edd('0x60')],'dialPrefix':_0x163fd3[_0x4edd('0x61')],'outboundAnswerAgiCallsDay':_0x163fd3['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x163fd3['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x163fd3['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x163fd3[_0x4edd('0x62')],'outboundCongestionCallsDay':_0x163fd3['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x163fd3[_0x4edd('0x63')],'outboundDropCallsDayCallersExit':_0x163fd3[_0x4edd('0x64')],'outboundDropCallsDayTimeout':_0x163fd3[_0x4edd('0x65')],'outboundNoAnswerCallsDay':_0x163fd3[_0x4edd('0x66')],'outboundNoSuchCallsDay':_0x163fd3[_0x4edd('0x67')],'outboundOriginateFailureCallsDay':_0x163fd3[_0x4edd('0x68')],'outboundReCallsDay':_0x163fd3['outboundReCallsDay'],'outboundRejectCallsDay':_0x163fd3['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x163fd3['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x163fd3['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x163fd3[_0x4edd('0x69')],'predictiveIntervalAvgTalktime':_0x163fd3[_0x4edd('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x163fd3[_0x4edd('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x163fd3[_0x4edd('0x6c')],'predictiveIntervalErlangCalls':_0x163fd3['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x163fd3[_0x4edd('0x6d')],'predictiveIntervalHitRate':_0x163fd3[_0x4edd('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x163fd3['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x163fd3[_0x4edd('0x6f')],'predictiveIntervalAvailable':_0x163fd3[_0x4edd('0x70')],'predictiveIntervalTotalCalls':_0x163fd3[_0x4edd('0x71')],'message':_0x163fd3['message'],'originated':_0x163fd3[_0x4edd('0x72')],'erlangCalls':_0x163fd3[_0x4edd('0x73')],'erlangCallToSecond':_0x163fd3[_0x4edd('0x74')],'erlangAbandonmentRate':_0x163fd3[_0x4edd('0x75')],'erlangBusyFactor':_0x163fd3['erlangBusyFactor'],'startPredictive':_0x163fd3[_0x4edd('0x2b')],'startProgressive':_0x163fd3['startProgressive']};if(_0x163fd3[_0x4edd('0x76')]){_0x25fcbe['Trunk']={'id':_0x163fd3[_0x4edd('0x76')]['id'],'name':_0x163fd3['Trunk'][_0x4edd('0x46')],'active':_0x163fd3[_0x4edd('0x76')][_0x4edd('0x77')],'callerid':_0x163fd3[_0x4edd('0x76')][_0x4edd('0x78')]};}if(_0x163fd3[_0x4edd('0x48')]){_0x25fcbe[_0x4edd('0x48')]={'id':_0x163fd3['Interval']['id'],'name':_0x163fd3['Interval'][_0x4edd('0x46')]};}var _0x4d54f8=md5(JSON['stringify'](_0x25fcbe));if(_0x163fd3[_0x4edd('0x4')]!==_0x4d54f8){_0x163fd3[_0x4edd('0x4')]=_0x4d54f8;emit(util[_0x4edd('0x79')](_0x4edd('0x7a'),_0x25fcbe[_0x4edd('0x46')]),'voice_queue:save',_0x25fcbe);}}}function emitCampaignSummary(_0x10b3b8){if(_0x10b3b8[_0x4edd('0x52')]===_0x4edd('0x7b')){emit(util[_0x4edd('0x79')](_0x4edd('0x7c'),_0x10b3b8['name']),_0x4edd('0x7d'),_0x10b3b8);}}function checkGetDataPredictive(_0x7f1b8f){if(isNotNull(_0x7f1b8f)&&!_[_0x4edd('0x4c')](_0x7f1b8f)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x7f'),_0x7f1b8f[_0x4edd('0x71')]);loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x80'),_0x7f1b8f[_0x4edd('0x81')]);loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x82'),_0x7f1b8f[_0x4edd('0x6c')]);loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x83'),_0x7f1b8f[_0x4edd('0x6b')]);loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x84'),_0x7f1b8f['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x4edd('0x85'),_0x7f1b8f[_0x4edd('0x6a')]);loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x86'));if(_0x7f1b8f[_0x4edd('0x71')]>0x0){if(!_[_0x4edd('0x41')](_0x7f1b8f['predictiveIntervalAvgTalktime'])&&_0x7f1b8f[_0x4edd('0x6a')]>0x0){return!![];}loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x87'));if(!_[_0x4edd('0x41')](_0x7f1b8f[_0x4edd('0x69')])&&_0x7f1b8f[_0x4edd('0x69')]>0x0){return!![];}loggerPredictive[_0x4edd('0x7e')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x88'));}}else{loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x89'));}return![];}function mergeDataErlangB(_0x5723d1){return function(_0xb87e75){loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x8a'));loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x8b'),_0xb87e75['erlangCalls']);loggerPredictive['info'](_0x4edd('0x8c'),_0xb87e75[_0x4edd('0x74')]);loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x8d'),_0xb87e75[_0x4edd('0x75')]);loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x8e'),_0xb87e75['erlangBusyFactor']);loggerPredictive['info'](_0x4edd('0x8d'),_0xb87e75['erlangAbandonmentRate']);loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x86'));_[_0x4edd('0x8f')](_0x5723d1,_0xb87e75);};}function getDiff(_0x5ea898){var _0x247b63=moment()[_0x4edd('0x50')](0x0);var _0x482b8d=moment(_0x5ea898)[_0x4edd('0x50')](0x0);return _0x247b63['diff'](_0x482b8d,_0x4edd('0x51'));}function ifInterval(_0x13dee7,_0xbcaee2){if(_[_0x4edd('0x41')](_0xbcaee2)){return![];}return getDiff(_0xbcaee2)<_0x13dee7*0x3c;}function freeVariablesPredictive(_0x50c41e){if(isNotNull(_0x50c41e)){if(!_[_0x4edd('0x41')](_0x50c41e['startProgressive'])){_0x50c41e[_0x4edd('0x2c')]=undefined;loggerPredictive[_0x4edd('0x7e')](_0x50c41e[_0x4edd('0x46')],_0x4edd('0x90'));}if(!_[_0x4edd('0x41')](_0x50c41e['startPredictive'])){_0x50c41e[_0x4edd('0x2b')]=undefined;loggerPredictive[_0x4edd('0x7e')](_0x50c41e[_0x4edd('0x46')],_0x4edd('0x91'));}if(!_['isUndefined'](_0x50c41e[_0x4edd('0x92')])){clearInterval(_0x50c41e['handlePredictive']);_0x50c41e['handlePredictive']=undefined;loggerPredictive[_0x4edd('0x7e')](_0x50c41e[_0x4edd('0x46')],_0x4edd('0x93'));}}}function erlangb(_0x221e15,_0x395326){if(_0x395326===0x0){return 0x0;}var _0x30dc52=0x1;for(var _0x1b1b42=0x1;_0x1b1b42<=_0x395326;_0x1b1b42+=0x1){_0x30dc52=0x1+_0x30dc52*_0x1b1b42/_0x221e15;}return 0x1/_0x30dc52;}function isVoiceQueueOutbound(_0x343e8f){return _0x343e8f===_0x4edd('0x94');}function isNotPreview(_0x1030af){return _0x1030af!=='preview';}function isCampaignIvr(_0xbfc772){return _0xbfc772===_0x4edd('0x7b');}function getCallerId(_0x4fcdef,_0x4977a6,_0x114791){if(!_['isUndefined'](_0x114791)&&typeof _0x114791===_0x4edd('0x95')&&!_[_0x4edd('0x4c')](_0x114791)){if(!_['isUndefined'](_0x4977a6)&&typeof _0x4977a6===_0x4edd('0x95')&&!_['isEmpty'](_0x4977a6)){return util[_0x4edd('0x79')](_0x4edd('0x96'),_0x4977a6,_0x114791);}return util[_0x4edd('0x79')](_0x4edd('0x96'),_0x114791,_0x114791);}if(!_[_0x4edd('0x41')](_0x4fcdef)&&typeof _0x4fcdef===_0x4edd('0x95')&&!_[_0x4edd('0x4c')](_0x4fcdef)){return _0x4fcdef;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0xb09779,_0x36c4dc){return function(_0x43b822){freeVariablesPredictive(_0x36c4dc);emitVoiceQueueSummary(_0x36c4dc);emitCampaignSummary(_0x36c4dc);loggerSyncQueueSummary['error'](_0xb09779,util[_0x4edd('0x97')](_0x43b822,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x541391,_0x38dd26){return function(_0x41a4b2){loggerPredictive[_0x4edd('0x98')](_0x38dd26[_0x4edd('0x46')],_0x541391);loggerPredictive[_0x4edd('0x98')](_0x41a4b2[_0x4edd('0x99')]);freeVariablesPredictive(_0x38dd26);};}function loggerCatch(_0x2b2ba2){return function(_0x4cd724){logger[_0x4edd('0x98')](_0x2b2ba2,util['inspect'](_0x4cd724,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x586c1a){return _0x586c1a&&!_[_0x4edd('0x41')](_0x586c1a)&&_0x586c1a[_0x4edd('0x9a')]>0x0;}function decremetOriginate(_0x51a43d){if(!_[_0x4edd('0x41')](_0x51a43d)&&_0x51a43d!==null){if(typeof _0x51a43d[_0x4edd('0x72')]!==_0x4edd('0x9b')){if(_0x51a43d[_0x4edd('0x72')]>0x0){_0x51a43d[_0x4edd('0x72')]-=0x1;}else{logger[_0x4edd('0x98')](_0x4edd('0x9c'));}}}else{logger[_0x4edd('0x98')](_0x4edd('0x9d'));}}function checkContactLowerLimitOriginate(_0x1bf714,_0x2f9e00,_0x4ac762){if(_0x2f9e00>_0x4ac762){for(var _0x1e69b4=0x0;_0x1e69b4<_0x2f9e00-_0x4ac762;_0x1e69b4+=0x1){decremetOriginate(_0x1bf714);}}}function loggerGetContactDialer(_0x5d7244,_0x4651a5,_0x52decd){return function(_0x1e37ee){checkContactLowerLimitOriginate(_0x4651a5,_0x52decd,0x0);logger['error'](_0x5d7244,util[_0x4edd('0x97')](_0x1e37ee,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x412cb1){return function(_0x457623){if(isNotNull(_0x457623)&&isNotNull(_0x457623[0x0])){if(_0x457623[0x0]['contactsRescheduled']>0x0){_0x412cb1[_0x4edd('0x42')]=_0x4edd('0x9e');logger['info'](_0x4edd('0x9f')+_0x412cb1[_0x4edd('0x46')],_0x457623[0x0][_0x4edd('0xa0')],_0x4edd('0xa1'));}else{_0x412cb1['message']=_0x4edd('0xa2');logger[_0x4edd('0x7e')](_0x4edd('0xa3')+_0x412cb1['name']);}}};}function notSendMessagesQueue(_0x1dd07f){if(_0x1dd07f['sendMessageOneNotActive']){freeVariablesPredictive(_0x1dd07f);if(_0x1dd07f['originated']===0x0&&_0x1dd07f[_0x4edd('0xa4')]===0x0&&_0x1dd07f[_0x4edd('0x5b')]===0x0&&(_0x1dd07f['pTalking']||0x0)===0x0){_0x1dd07f[_0x4edd('0xa5')]=![];_0x1dd07f['available']=0x0;_0x1dd07f[_0x4edd('0x42')]=_0x4edd('0x45');loggerSyncQueueSummary[_0x4edd('0x98')](_0x4edd('0xa6'),_0x1dd07f[_0x4edd('0x46')],_0x4edd('0xa7'));}else{_0x1dd07f[_0x4edd('0x42')]=_0x4edd('0xa8');loggerSyncQueueSummary['error'](_0x4edd('0xa6'),_0x1dd07f['name'],_0x4edd('0xa9'));}emitVoiceQueueSummary(_0x1dd07f);}}function notSendMessagesCampaign(_0x51a1a7){if(_0x51a1a7[_0x4edd('0xa5')]){if(_0x51a1a7[_0x4edd('0x72')]===0x0){_0x51a1a7[_0x4edd('0xa5')]=![];_0x51a1a7['message']=_0x4edd('0x45');loggerSyncQueueSummary[_0x4edd('0x98')](_0x4edd('0xaa'),_0x51a1a7['name'],_0x4edd('0xa7'));}else{_0x51a1a7[_0x4edd('0x42')]=_0x4edd('0xa8');loggerSyncQueueSummary['error'](_0x4edd('0xaa'),_0x51a1a7[_0x4edd('0x46')],'is\x20disactive');}emitCampaignSummary(_0x51a1a7);}}function createObjHistory(_0xfeafae,_0x416f4c,_0x24d01c,_0x143134,_0x2f2193){_0xfeafae['message']=_0x24d01c;var _0x473a20=new Action(_0xfeafae,_0x416f4c);var _0x595164=new History(_0x473a20);_0x595164[_0x4edd('0xab')]=_0x143134;_0x595164[_0x4edd('0xac')]=_0x2f2193;_0x595164[_0x4edd('0xad')]=_0x473a20[_0x4edd('0xae')];return _0x595164;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x54a250=this;setInterval(function(){_0x54a250['clearZombieChannels'](_0x54a250[_0x4edd('0x2a')],_0x4edd('0xaf'));_0x54a250[_0x4edd('0xb0')](_0x54a250['actions'],_0x4edd('0xb1'));},0x32c8);};Dialer[_0x4edd('0x1d')]['clearZombieChannels']=function(_0x17b009,_0x56563b){var _0xbf2a87=this;for(var _0x378de8 in _0x17b009){if(typeof _0x17b009[_0x378de8]!==_0x4edd('0x9b')){this[_0x4edd('0x21')][_0x4edd('0x1e')](function(){if(!_[_0x4edd('0xb2')](_0x17b009[_0x378de8])){return ami['Action']({'action':'status','channel':_0x17b009[_0x378de8][_0x4edd('0xb3')]})[_0x4edd('0xb4')](function(_0x578537){if(_0x578537[_0x4edd('0x42')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x17b009[_0x378de8]&&_0x17b009[_0x378de8][_0x4edd('0x52')]!==_0x4edd('0x7b')){_0xbf2a87[_0x4edd('0xb5')](_0xbf2a87['voiceQueues'][_0x17b009[_0x378de8]['queue']]);logger[_0x4edd('0x98')]('[Dialer][checkChannel]',_0x56563b,_0x378de8,_0x17b009[_0x378de8][_0x4edd('0xb6')]);delete _0x17b009[_0x378de8];}if(_0x17b009[_0x378de8]&&_0x17b009[_0x378de8][_0x4edd('0x52')]===_0x4edd('0x7b')){_0xbf2a87[_0x4edd('0xb5')](_0xbf2a87[_0x4edd('0x23')][_0x17b009[_0x378de8][_0x4edd('0xb6')]]);logger['error'](_0x4edd('0xb7'),_0x56563b,_0x378de8,_0x17b009[_0x378de8]['queue']);delete _0x17b009[_0x378de8];}},0x2328);}});}});}}};Dialer[_0x4edd('0x1d')][_0x4edd('0xb8')]=function(_0x2a275d){return BPromise[_0x4edd('0xb9')]()[_0x4edd('0x40')](cmHopper[_0x4edd('0xb8')](_0x2a275d))['catch'](loggerCatch(_0x4edd('0xba')));};Dialer[_0x4edd('0x1d')][_0x4edd('0xbb')]=function(_0x2aa3ce){return BPromise['resolve']()[_0x4edd('0x40')](cmHopperBlack[_0x4edd('0xbb')](_0x2aa3ce))['catch'](loggerCatch(_0x4edd('0xbc')));};Dialer[_0x4edd('0x1d')][_0x4edd('0xbd')]=function(_0x4a3c30){return BPromise['resolve']()['then'](cmHopperBlack['checkIsBlackListIvr'](_0x4a3c30))[_0x4edd('0xb4')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype'][_0x4edd('0xbe')]=function(_0x52535e){return BPromise[_0x4edd('0xb9')]()[_0x4edd('0x40')](cmHopperHistory[_0x4edd('0xbf')](_0x52535e))[_0x4edd('0xb4')](loggerCatch(_0x4edd('0xc0')));};Dialer['prototype'][_0x4edd('0xc1')]=function(_0x50e3cf){return BPromise[_0x4edd('0xb9')]()[_0x4edd('0x40')](cmHopper[_0x4edd('0xc1')](_0x50e3cf))[_0x4edd('0xb4')](loggerCatch(_0x4edd('0xc2')));};Dialer[_0x4edd('0x1d')]['unlockContact']=function(_0x214df0,_0x1e065c,_0x39b460){return BPromise[_0x4edd('0xb9')]()[_0x4edd('0x40')](cmHopper[_0x4edd('0xc3')](_0x214df0,_0x1e065c,_0x39b460))[_0x4edd('0xb4')](loggerCatch(_0x4edd('0xc4')));};Dialer[_0x4edd('0x1d')][_0x4edd('0xc5')]=function(_0x182467,_0x3bb356,_0x4ebf24,_0x4f7aa4,_0x3a3cc6){return BPromise[_0x4edd('0xb9')]()[_0x4edd('0x40')](cmHopper[_0x4edd('0xc5')](_0x182467,_0x3bb356,_0x4ebf24,_0x4f7aa4))['catch'](function(_0x59cebd){_0x3a3cc6[_0x4edd('0xc6')]-=_0x4ebf24;_0x3a3cc6[_0x4edd('0xc6')]=_0x3a3cc6[_0x4edd('0xc6')]>0x0?_0x3a3cc6['temp']:0x0;loggerCatch(_0x4edd('0xc7'))(_0x59cebd);});};Dialer[_0x4edd('0x1d')][_0x4edd('0xc8')]=function(_0x7c71f5,_0x39e499,_0x3f43ce,_0x1ea18b){return BPromise[_0x4edd('0xb9')]()['then'](cmHopper[_0x4edd('0xc8')](_0x7c71f5,_0x39e499,_0x3f43ce))[_0x4edd('0xb4')](function(_0x1a72f0){_0x1ea18b['temp']-=_0x39e499;_0x1ea18b['temp']=_0x1ea18b['temp']>0x0?_0x1ea18b[_0x4edd('0xc6')]:0x0;loggerCatch(_0x4edd('0xc9'))(_0x1a72f0);});};Dialer['prototype'][_0x4edd('0xca')]=function(_0x315d62){return BPromise['resolve']()[_0x4edd('0x40')](voiceQueueRt[_0x4edd('0xca')](_0x315d62))[_0x4edd('0xb4')](loggerCatch(_0x4edd('0xcb')));};Dialer[_0x4edd('0x1d')][_0x4edd('0xcc')]=function(_0xf443dc){return BPromise[_0x4edd('0xb9')]()[_0x4edd('0x40')](cmHopper['moveContactManagedDialer'](_0xf443dc))['catch'](loggerCatch(_0x4edd('0xcd')));};Dialer[_0x4edd('0x1d')][_0x4edd('0xce')]=function(_0x29ed1b){return BPromise[_0x4edd('0xb9')]()['then'](cmHopperHistory[_0x4edd('0xce')](_0x29ed1b))[_0x4edd('0xb4')](loggerCatch('[createHistory]\x20'));};Dialer[_0x4edd('0x1d')][_0x4edd('0xb5')]=function(_0x4d3336){if(!_['isUndefined'](_0x4d3336)&&_0x4d3336!==null){if(typeof _0x4d3336['originated']!==_0x4edd('0x9b')){if(_0x4d3336[_0x4edd('0x72')]>0x0){_0x4d3336[_0x4edd('0x72')]-=0x1;}else{logger[_0x4edd('0x98')](_0x4edd('0xcf'));}}}else{logger[_0x4edd('0x98')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x4edd('0x1d')][_0x4edd('0xd0')]=function(_0x551cff,_0x1655f1){var _0x4bea98=this;return function(_0x3f3495){_0x4bea98[_0x4edd('0xb5')](_0x1655f1);logger['error'](_0x551cff,util[_0x4edd('0x97')](_0x3f3495,{'showHidden':![],'depth':null}));};};Dialer[_0x4edd('0x1d')][_0x4edd('0xd1')]=function(_0x2ea44a,_0x5075e2,_0x384ec0){var _0x1c5bf6={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x5075e2);this[_0x4edd('0xd2')](_['merge'](_0x1c5bf6,_[_0x4edd('0xd3')](_0x384ec0,[_0x4edd('0xd4'),'ListId',_0x4edd('0xd5'),_0x4edd('0xd6'),'CampaignId'])),_0x4edd('0xd7'),_0x4edd('0xd8'));logger['error'](_0x2ea44a);};Dialer[_0x4edd('0x1d')]['isSuccess']=function(_0x46fe31){return _0x46fe31==='Success';};Dialer['prototype'][_0x4edd('0xd9')]=function(_0x4f8d64){return!_[_0x4edd('0x41')](_0x4f8d64)&&_0x4f8d64&&!_[_0x4edd('0x41')](_0x4f8d64[_0x4edd('0x46')])&&!_[_0x4edd('0x41')](_0x4f8d64['active'])&&_0x4f8d64['active']&&(this[_0x4edd('0x25')][util[_0x4edd('0x79')](_0x4edd('0xda'),_0x4f8d64['name'])][_0x4edd('0xdb')]===_0x4edd('0xdc')||this[_0x4edd('0x25')][util[_0x4edd('0x79')]('SIP/%s',_0x4f8d64[_0x4edd('0x46')])][_0x4edd('0xdb')]===_0x4edd('0xdd'));};Dialer['prototype'][_0x4edd('0xd2')]=function(_0x1b0d83,_0x46cd5f,_0x3499e4){this[_0x4edd('0xce')](_0x1b0d83)[_0x4edd('0xb4')](loggerCatch(_0x46cd5f));this[_0x4edd('0xcc')](_0x1b0d83)[_0x4edd('0xb4')](loggerCatch(_0x3499e4));};Dialer['prototype'][_0x4edd('0xde')]=function(_0x44d802){var _0x233bad=this[_0x4edd('0x2a')][_0x44d802[_0x4edd('0xdf')]];var _0x260e14;if(!_[_0x4edd('0xb2')](_0x44d802)&&!_['isNil'](_0x44d802[_0x4edd('0xe0')])&&!_[_0x4edd('0xb2')](_0x44d802['variable'][_0x4edd('0xe1')])&&_0x44d802[_0x4edd('0xe2')]===_0x4edd('0xe3')&&_0x233bad){if(_0x233bad[_0x4edd('0x52')]!=='ivr'&&this['voiceQueues'][_0x233bad[_0x4edd('0xb6')]][_0x4edd('0xe4')]&&_0x44d802[_0x4edd('0xe5')]==='HANGUP'){delete this[_0x4edd('0x2a')][_0x44d802[_0x4edd('0xdf')]];this[_0x4edd('0xb5')](this[_0x4edd('0x22')][_0x233bad[_0x4edd('0xb6')]]);this[_0x4edd('0x22')][_0x233bad[_0x4edd('0xb6')]][_0x4edd('0xe6')]+=0x1;this[_0x4edd('0x22')][_0x233bad[_0x4edd('0xb6')]][_0x4edd('0xe7')]+=0x1;_0x260e14=new Hangup(_0x233bad,_0x44d802);_0x260e14[_0x4edd('0xab')]=0x12;_0x260e14['statedesc']='HangupInAMD';_0x260e14[_0x4edd('0xe8')]=_0x4edd('0xe9');ami[_0x4edd('0xea')](_0x4edd('0xeb'),ut[_0x4edd('0xec')](_0x260e14,'amd'));this[_0x4edd('0xd2')](_0x260e14,_0x4edd('0xed'),_0x4edd('0xee'));}if(_0x233bad['type']!==_0x4edd('0x7b')&&this['voiceQueues'][_0x233bad[_0x4edd('0xb6')]][_0x4edd('0xe4')]&&_0x44d802[_0x4edd('0xe5')]===_0x4edd('0xef')){var _0x3a7aab=this;return new BPromise(function(_0x286945,_0x47f6fd){delete _0x3a7aab[_0x4edd('0x2a')][_0x44d802[_0x4edd('0xdf')]];_0x3a7aab[_0x4edd('0xb5')](_0x3a7aab[_0x4edd('0x22')][_0x233bad[_0x4edd('0xb6')]]);_0x3a7aab[_0x4edd('0x22')][_0x233bad[_0x4edd('0xb6')]][_0x4edd('0xe6')]+=0x1;_0x3a7aab[_0x4edd('0x22')][_0x233bad[_0x4edd('0xb6')]][_0x4edd('0xe7')]+=0x1;var _0x495a9d=_0x3a7aab[_0x4edd('0x22')][_0x233bad[_0x4edd('0xb6')]];var _0x358b67=new Hangup(_0x233bad,_0x44d802);_0x358b67[_0x4edd('0xab')]=0x13;_0x358b67[_0x4edd('0xac')]=_0x4edd('0xf0');_0x358b67[_0x4edd('0xe8')]='AMD';_0x358b67[_0x4edd('0xf1')]+=0x1;_0x358b67[_0x4edd('0xf2')]+=0x1;_0x358b67[_0x4edd('0xf3')]=!![];ami[_0x4edd('0xea')](_0x4edd('0xeb'),ut[_0x4edd('0xec')](_0x358b67,_0x4edd('0xf3')));_0x3a7aab[_0x4edd('0xce')](_0x358b67)[_0x4edd('0xb4')](loggerCatch(_0x4edd('0xf4')));if(_0x358b67[_0x4edd('0xf5')]+_0x358b67[_0x4edd('0xf6')]+_0x358b67['countnoanswerretry']+_0x358b67[_0x4edd('0xf7')]+_0x358b67[_0x4edd('0xf8')]+_0x358b67[_0x4edd('0xf9')]+_0x358b67['countmachineretry']+_0x358b67[_0x4edd('0xfa')]>=_0x495a9d[_0x4edd('0xfb')]){_0x3a7aab[_0x4edd('0xfc')](_0x358b67,_0x286945,_0x47f6fd,'reason19\x20machine....');}else{if(_0x358b67['countmachineretry']>=_0x495a9d[_0x4edd('0xfd')]){_0x3a7aab[_0x4edd('0xfe')](_0x358b67,_0x286945,_0x47f6fd,'reason\x2019\x20machine....');}else{_0x3a7aab['rescheduleContact']({'active':![],'countmachineretry':_0x358b67[_0x4edd('0xf1')],'scheduledat':moment()[_0x4edd('0xff')](_0x495a9d[_0x4edd('0x100')],_0x4edd('0x101'))['format'](_0x4edd('0x102')),'ContactId':_0x358b67[_0x4edd('0xd4')],'ListId':_0x358b67[_0x4edd('0x103')],'VoiceQueueId':_0x358b67[_0x4edd('0xd6')]||undefined,'CampaignId':_0x358b67[_0x4edd('0x104')]||undefined})[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x105')));_0x286945({'reschedule':0x1});}}});}if(_0x233bad[_0x4edd('0x52')]===_0x4edd('0x7b')&&this[_0x4edd('0x23')][_0x233bad['queue']][_0x4edd('0xe4')]&&_0x44d802[_0x4edd('0xe5')]==='HANGUP'){delete this[_0x4edd('0x2a')][_0x44d802[_0x4edd('0xdf')]];this[_0x4edd('0xb5')](this[_0x4edd('0x23')][_0x233bad[_0x4edd('0xb6')]]);_0x260e14=new Hangup(_0x233bad,_0x44d802);_0x260e14[_0x4edd('0xab')]=0x12;_0x260e14[_0x4edd('0xac')]=_0x4edd('0x106');_0x260e14[_0x4edd('0xe8')]=_0x4edd('0xe9');ami[_0x4edd('0xea')](_0x4edd('0xeb'),ut[_0x4edd('0xec')](_0x260e14,'amd'));this[_0x4edd('0xd2')](_0x260e14,_0x4edd('0x107'),_0x4edd('0x108'));}if(_0x233bad[_0x4edd('0x52')]===_0x4edd('0x7b')&&this['campaigns'][_0x233bad['queue']]['dialAMDActive']&&_0x44d802[_0x4edd('0xe5')]==='MACHINE'){var _0x3a7aab=this;return new BPromise(function(_0x2dfc8f,_0x4915d4){delete _0x3a7aab['uniqueId'][_0x44d802[_0x4edd('0xdf')]];_0x3a7aab['updateOriginated'](_0x3a7aab['campaigns'][_0x233bad['queue']]);_0x3a7aab[_0x4edd('0x23')][_0x233bad[_0x4edd('0xb6')]][_0x4edd('0xe6')]+=0x1;_0x3a7aab[_0x4edd('0x23')][_0x233bad['queue']][_0x4edd('0xe7')]+=0x1;var _0x514bf6=_0x3a7aab['campaigns'][_0x233bad[_0x4edd('0xb6')]];var _0x588b6a=new Hangup(_0x233bad,_0x44d802);_0x588b6a[_0x4edd('0xab')]=0x13;_0x588b6a[_0x4edd('0xac')]='Machine';_0x588b6a['membername']='AMD';_0x588b6a['countmachineretry']+=0x1;_0x588b6a[_0x4edd('0xf2')]+=0x1;_0x588b6a[_0x4edd('0xf3')]=!![];ami[_0x4edd('0xea')]('custom:amd',ut[_0x4edd('0xec')](_0x588b6a,_0x4edd('0xf3')));_0x3a7aab[_0x4edd('0xce')](_0x588b6a)['catch'](loggerCatch(_0x4edd('0xf4')));if(_0x588b6a[_0x4edd('0xf5')]+_0x588b6a[_0x4edd('0xf6')]+_0x588b6a['countnoanswerretry']+_0x588b6a['countnosuchnumberretry']+_0x588b6a[_0x4edd('0xf8')]+_0x588b6a['countabandonedretry']+_0x588b6a[_0x4edd('0xf1')]+_0x588b6a[_0x4edd('0xfa')]>=_0x514bf6[_0x4edd('0xfb')]){_0x3a7aab['stateGlobal'](_0x588b6a,_0x2dfc8f,_0x4915d4,_0x4edd('0x109'));}else{if(_0x588b6a['countmachineretry']>=_0x514bf6['dialMachineMaxRetry']){_0x3a7aab['createStateFinal'](_0x588b6a,_0x2dfc8f,_0x4915d4,_0x4edd('0x10a'));}else{_0x3a7aab[_0x4edd('0xc1')]({'active':![],'countmachineretry':_0x588b6a[_0x4edd('0xf1')],'scheduledat':moment()[_0x4edd('0xff')](_0x514bf6[_0x4edd('0x100')],'minutes')[_0x4edd('0x79')](_0x4edd('0x102')),'ContactId':_0x588b6a[_0x4edd('0xd4')],'ListId':_0x588b6a[_0x4edd('0x103')],'VoiceQueueId':_0x588b6a['VoiceQueueId']||undefined,'CampaignId':_0x588b6a['CampaignId']||undefined})[_0x4edd('0xb4')](loggerCatch('[rescheduleContact][Machine]'));_0x2dfc8f({'reschedule':0x1});}}});}}};Dialer[_0x4edd('0x1d')][_0x4edd('0x37')]=function(_0x13f802){var _0xccce78=this[_0x4edd('0x2a')][_0x13f802[_0x4edd('0xdf')]];var _0x3d670b=this;var _0x2c8347;if(_0xccce78&&_0xccce78[_0x4edd('0x52')]===_0x4edd('0x7b')){delete this[_0x4edd('0x2a')][_0x13f802[_0x4edd('0xdf')]];this[_0x4edd('0xb5')](this[_0x4edd('0x23')][_0xccce78[_0x4edd('0xb6')]]);this['campaigns'][_0xccce78['queue']][_0x4edd('0x10b')]+=0x1;_0x2c8347=new Hangup(_0xccce78,_0x13f802);this[_0x4edd('0xce')](_0x2c8347)['catch'](loggerCatch(_0x4edd('0x10c')));this[_0x4edd('0xcc')](_0x2c8347)[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x10d')));}if(_0xccce78&&_0xccce78['type']!==_0x4edd('0x7b')&&isNotNull(this[_0x4edd('0x22')][_0xccce78[_0x4edd('0xb6')]]['dialQueueProject'])){delete this['uniqueId'][_0x13f802[_0x4edd('0xdf')]];this[_0x4edd('0xb5')](this['voiceQueues'][_0xccce78[_0x4edd('0xb6')]]);this[_0x4edd('0x22')][_0xccce78[_0x4edd('0xb6')]][_0x4edd('0xe6')]+=0x1;this[_0x4edd('0x22')][_0xccce78['queue']][_0x4edd('0xe7')]+=0x1;_0x2c8347=new Hangup(_0xccce78,_0x13f802);_0x2c8347[_0x4edd('0xab')]=0x10;_0x2c8347['statedesc']=_0x4edd('0x10e');_0x2c8347[_0x4edd('0xe8')]=_0x4edd('0x10f');this[_0x4edd('0xce')](_0x2c8347)[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x10c')));this[_0x4edd('0xcc')](_0x2c8347)[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x10d')));}if(_0xccce78&&_0xccce78['type']!==_0x4edd('0x7b')&&!isNotNull(this[_0x4edd('0x22')][_0xccce78[_0x4edd('0xb6')]][_0x4edd('0x110')])){delete this[_0x4edd('0x2a')][_0x13f802[_0x4edd('0xdf')]];this[_0x4edd('0xb5')](this['voiceQueues'][_0xccce78['queue']]);this[_0x4edd('0x22')][_0xccce78[_0x4edd('0xb6')]][_0x4edd('0x111')]+=0x1;_0x2c8347=new Hangup(_0xccce78,_0x13f802);_0x2c8347[_0x4edd('0xab')]=0xc;_0x2c8347[_0x4edd('0xac')]=_0x13f802['cause-txt'];_0x2c8347[_0x4edd('0xe8')]=_0x4edd('0x112');this[_0x4edd('0xce')](_0x2c8347)[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x10c')));this[_0x4edd('0xcc')](_0x2c8347)[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x10d')));}};Dialer[_0x4edd('0x1d')][_0x4edd('0x34')]=function(_0x58999a){var _0x2002f8=this[_0x4edd('0x2a')][_0x58999a[_0x4edd('0xdf')]];var _0x4776cf=this;if(this[_0x4edd('0x22')][_0x58999a[_0x4edd('0xb6')]]){if(_0x2002f8&&_0x2002f8[_0x4edd('0x52')]!==_0x4edd('0x7b')){delete this[_0x4edd('0x2a')][_0x58999a['uniqueid']];this[_0x4edd('0x22')][_0x58999a[_0x4edd('0xb6')]][_0x4edd('0xe6')]+=0x1;var _0x447010=new AgentComplete(_0x2002f8,_0x58999a);if(_0x58999a[_0x4edd('0x113')]===_0x4edd('0x114')){_0x447010[_0x4edd('0x115')]=this[_0x4edd('0x22')][_0x58999a['queue']][_0x4edd('0x116')]&&this[_0x4edd('0x22')][_0x58999a[_0x4edd('0xb6')]][_0x4edd('0x117')]?moment()[_0x4edd('0x79')](_0x4edd('0x102')):undefined;}this[_0x4edd('0xce')](_0x447010)[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x118')));this[_0x4edd('0xcc')](_0x447010)[_0x4edd('0xb4')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x4edd('0x1d')][_0x4edd('0x30')]=function(_0x23dae9){if(this[_0x4edd('0x22')][_0x23dae9[_0x4edd('0xb6')]]){if(this[_0x4edd('0x2a')][_0x23dae9[_0x4edd('0xdf')]]&&this[_0x4edd('0x2a')][_0x23dae9[_0x4edd('0xdf')]][_0x4edd('0x52')]!=='ivr'){this[_0x4edd('0xb5')](this['voiceQueues'][_0x23dae9[_0x4edd('0xb6')]]);this[_0x4edd('0x2a')][_0x23dae9[_0x4edd('0xdf')]]['answertime']=moment()[_0x4edd('0x79')](_0x4edd('0x102'));}}};Dialer[_0x4edd('0x1d')]['queueCallerAbandonCreateState']=function(_0x5c6b42){this[_0x4edd('0xce')](_0x5c6b42)[_0x4edd('0xb4')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x4edd('0xcc')](_0x5c6b42)[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x119')));};Dialer['prototype'][_0x4edd('0x11a')]=function(_0x24e90b){var _0x3d18bb=this['uniqueId'][_0x24e90b['uniqueid']];var _0x483140=this;if(this['voiceQueues'][_0x24e90b['queue']]){if(_0x3d18bb&&_0x3d18bb['type']!==_0x4edd('0x7b')){delete this[_0x4edd('0x2a')][_0x24e90b[_0x4edd('0xdf')]];this[_0x4edd('0xb5')](this['voiceQueues'][_0x24e90b[_0x4edd('0xb6')]]);_0x3d18bb[_0x4edd('0x11b')]=moment()['format'](_0x4edd('0x102'));var _0x35b702=new QueueCallerAbandon(_0x3d18bb,_0x24e90b);if(getSeconds(_0x3d18bb[_0x4edd('0x11b')],_0x3d18bb[_0x4edd('0x11c')])>=_0x3d18bb[_0x4edd('0x11d')]){this[_0x4edd('0x22')][_0x24e90b['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x4edd('0x22')][_0x24e90b[_0x4edd('0xb6')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x4edd('0x22')][_0x24e90b['queue']][_0x4edd('0x6d')]+=0x1;_0x35b702[_0x4edd('0xab')]=0xa;_0x35b702[_0x4edd('0xac')]=_0x4edd('0x11e');_0x35b702['dropreason']=_0x4edd('0x11f');_0x35b702[_0x4edd('0x115')]=this[_0x4edd('0x22')][_0x24e90b[_0x4edd('0xb6')]][_0x4edd('0x116')]?moment()[_0x4edd('0x79')](_0x4edd('0x102')):undefined;_0x35b702[_0x4edd('0xf8')]+=0x1;_0x35b702[_0x4edd('0xf2')]+=0x1;if(_0x35b702[_0x4edd('0xf8')]>=this[_0x4edd('0x22')][_0x24e90b[_0x4edd('0xb6')]]['dialDropMaxRetry']){this[_0x4edd('0x120')](_0x35b702);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x35b702[_0x4edd('0xf8')],'scheduledat':moment()[_0x4edd('0xff')](this['voiceQueues'][_0x24e90b[_0x4edd('0xb6')]]['dialDropRetryFrequency'],_0x4edd('0x101'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3d18bb[_0x4edd('0xd4')],'ListId':_0x3d18bb[_0x4edd('0x103')],'VoiceQueueId':_0x3d18bb[_0x4edd('0xd6')]||undefined,'CampaignId':_0x3d18bb[_0x4edd('0x104')]||undefined})[_0x4edd('0xb4')](loggerCatch('[rescheduleContact][Drop]'));var _0xc92c02=new History(_0x35b702);_0xc92c02[_0x4edd('0xab')]=0xa;_0xc92c02[_0x4edd('0xac')]=_0x4edd('0x11e');_0xc92c02['starttime']=moment()[_0x4edd('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0xc92c02[_0x4edd('0xad')]=_0xc92c02[_0x4edd('0xae')];_0xc92c02[_0x4edd('0x121')]=_0x35b702[_0x4edd('0x121')];_0xc92c02['calleridnum']=_0x35b702[_0x4edd('0x122')];this[_0x4edd('0xce')](_0xc92c02)[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x123')));}}else{this[_0x4edd('0x22')][_0x24e90b['queue']][_0x4edd('0x6b')]+=0x1;this[_0x4edd('0x22')][_0x24e90b[_0x4edd('0xb6')]][_0x4edd('0x64')]+=0x1;_0x35b702[_0x4edd('0xab')]=0xb;_0x35b702[_0x4edd('0xac')]=_0x4edd('0x124');_0x35b702['dropreason']=_0x4edd('0x125');_0x35b702[_0x4edd('0xf9')]+=0x1;_0x35b702['countglobal']+=0x1;if(_0x35b702[_0x4edd('0xf9')]>=this[_0x4edd('0x22')][_0x24e90b[_0x4edd('0xb6')]][_0x4edd('0x126')]){this[_0x4edd('0x120')](_0x35b702);}else{this[_0x4edd('0xc1')]({'active':![],'countabandonedretry':_0x35b702[_0x4edd('0xf9')],'scheduledat':moment()['add'](this[_0x4edd('0x22')][_0x24e90b['queue']]['dialAbandonedRetryFrequency'],_0x4edd('0x101'))[_0x4edd('0x79')](_0x4edd('0x102')),'ContactId':_0x3d18bb[_0x4edd('0xd4')],'ListId':_0x3d18bb[_0x4edd('0x103')],'VoiceQueueId':_0x3d18bb[_0x4edd('0xd6')]||undefined,'CampaignId':_0x3d18bb[_0x4edd('0x104')]||undefined})[_0x4edd('0xb4')](loggerCatch('[rescheduleContact][Abandoned]'));var _0xc92c02=new History(_0x35b702);_0xc92c02[_0x4edd('0xab')]=0xb;_0xc92c02['statedesc']=_0x4edd('0x124');_0xc92c02[_0x4edd('0xae')]=moment()[_0x4edd('0x79')](_0x4edd('0x102'));_0xc92c02[_0x4edd('0xad')]=_0xc92c02['starttime'];_0xc92c02[_0x4edd('0x121')]=_0x35b702['calleridname'];_0xc92c02[_0x4edd('0x122')]=_0x35b702[_0x4edd('0x122')];this[_0x4edd('0xce')](_0xc92c02)[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x127')));}}}}};Dialer[_0x4edd('0x1d')][_0x4edd('0x39')]=function(_0x2960b9){if(this[_0x4edd('0x28')][_0x2960b9['uniqueid']]){this[_0x4edd('0x28')][_0x2960b9['uniqueid']][_0x4edd('0xb3')]=_0x2960b9['channel'];}if(this[_0x4edd('0x2a')][_0x2960b9[_0x4edd('0xdf')]]){this['uniqueId'][_0x2960b9[_0x4edd('0xdf')]][_0x4edd('0xb3')]=_0x2960b9[_0x4edd('0xb3')];}};Dialer['prototype'][_0x4edd('0x128')]=function(_0x1ea221){if(strategy[this['voiceQueues'][this[_0x4edd('0x28')][_0x1ea221[_0x4edd('0x129')]][_0x4edd('0xb6')]][_0x4edd('0x53')]]===_0x4edd('0x1c')){if(this[_0x4edd('0x28')][_0x1ea221[_0x4edd('0x129')]]&&_['isNil'](this[_0x4edd('0x28')][_0x1ea221[_0x4edd('0x129')]]['locked'])&&_0x1ea221[_0x4edd('0xdb')]==='1'&&_0x1ea221[_0x4edd('0x12a')]==='0'){if(this[_0x4edd('0x24')][_0x1ea221[_0x4edd('0x12b')]]){if(!this['agents'][_0x1ea221['stateinterface']][_0x4edd('0x12c')]){this['agents'][_0x1ea221[_0x4edd('0x12b')]]['locked']=!![];this['actions'][_0x1ea221[_0x4edd('0x129')]][_0x4edd('0x12c')]=!![];this[_0x4edd('0x28')][_0x1ea221[_0x4edd('0x129')]][_0x4edd('0x12b')]=_0x1ea221[_0x4edd('0x12b')];}}}}else if((strategy[this['voiceQueues'][this['actions'][_0x1ea221[_0x4edd('0x129')]]['queue']][_0x4edd('0x53')]]||'rrmemory')===_0x4edd('0x1b')){if(this[_0x4edd('0x28')][_0x1ea221['actionid']]){if(this[_0x4edd('0x24')][_0x1ea221['stateinterface']]){this[_0x4edd('0x28')][_0x1ea221[_0x4edd('0x129')]]['stateinterface']=_0x1ea221[_0x4edd('0x12b')];if(_['isNil'](this[_0x4edd('0x2e')][this[_0x4edd('0x28')][_0x1ea221['actionid']][_0x4edd('0xb6')]])){this[_0x4edd('0x2e')][this[_0x4edd('0x28')][_0x1ea221[_0x4edd('0x129')]][_0x4edd('0xb6')]]=[];}this[_0x4edd('0x2e')][this['actions'][_0x1ea221[_0x4edd('0x129')]][_0x4edd('0xb6')]]['push'](_['merge'](_[_0x4edd('0xd3')](this[_0x4edd('0x28')][_0x1ea221[_0x4edd('0x129')]],[_0x4edd('0x12d'),_0x4edd('0x12b')]),{'status':_0x1ea221['status'],'paused':_0x1ea221['paused']}));}}}};function unlockQueueStatus(_0x11d8e6,_0x3a772a){setTimeout(function(){if(_[_0x4edd('0x41')](_0x11d8e6[_0x4edd('0x12e')])){loggerBooked[_0x4edd('0x98')](_0x4edd('0x12f'),_0x3a772a);}_0x11d8e6['queueStatusComplete']=!![];loggerBooked[_0x4edd('0x7e')]('[booked][unlockQueueStatus]',_0x3a772a,JSON[_0x4edd('0x4f')](_[_0x4edd('0xd3')](_0x11d8e6,['name','queueStatusComplete'])));},0x1f3);}Dialer[_0x4edd('0x1d')][_0x4edd('0x3d')]=function(_0x430572){var _0x208836=this;var _0x4bbc73=_0x208836[_0x4edd('0x22')][_0x208836[_0x4edd('0x28')][_0x430572[_0x4edd('0x129')]][_0x4edd('0xb6')]];if(strategy[this[_0x4edd('0x22')][this['actions'][_0x430572['actionid']]['queue']][_0x4edd('0x53')]]===_0x4edd('0x1c')){if(this[_0x4edd('0x28')][_0x430572[_0x4edd('0x129')]]&&this['actions'][_0x430572[_0x4edd('0x129')]][_0x4edd('0x12b')]){this[_0x4edd('0x130')][_0x4edd('0x131')](this[_0x4edd('0x28')][_0x430572[_0x4edd('0x129')]][_0x4edd('0x12d')],this[_0x4edd('0x28')][_0x430572[_0x4edd('0x129')]][_0x4edd('0x12b')])[_0x4edd('0xb4')](function(_0x215d06){logger[_0x4edd('0x98')](_0x4edd('0x132'),util['inspect'](_0x215d06,{'showHidden':![],'depth':null}));})['finally'](function(){_0x208836[_0x4edd('0xb5')](_0x208836[_0x4edd('0x22')][_0x208836[_0x4edd('0x28')][_0x430572[_0x4edd('0x129')]][_0x4edd('0xb6')]]);_0x208836[_0x4edd('0x24')][_0x208836[_0x4edd('0x28')][_0x430572['actionid']][_0x4edd('0x12b')]][_0x4edd('0x12c')]=![];delete _0x208836['actions'][_0x430572[_0x4edd('0x129')]];unlockQueueStatus(_0x4bbc73);});}else{this[_0x4edd('0xb5')](this[_0x4edd('0x22')][this['actions'][_0x430572[_0x4edd('0x129')]][_0x4edd('0xb6')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x430572['actionid']][_0x4edd('0xd4')],'ListId':this[_0x4edd('0x28')][_0x430572[_0x4edd('0x129')]][_0x4edd('0x103')],'VoiceQueueId':this['actions'][_0x430572[_0x4edd('0x129')]][_0x4edd('0xd6')]||undefined,'CampaignId':this[_0x4edd('0x28')][_0x430572[_0x4edd('0x129')]][_0x4edd('0x104')]||undefined})['catch'](loggerCatch(_0x4edd('0x133')));delete this[_0x4edd('0x28')][_0x430572['actionid']];unlockQueueStatus(_0x4bbc73);}}else if((strategy[this[_0x4edd('0x22')][this[_0x4edd('0x28')][_0x430572[_0x4edd('0x129')]][_0x4edd('0xb6')]][_0x4edd('0x53')]]||'rrmemory')==='rrmemory'){var _0x29eabb;if(this[_0x4edd('0x28')][_0x430572[_0x4edd('0x129')]]&&!_[_0x4edd('0x4c')](this[_0x4edd('0x2e')][this[_0x4edd('0x28')][_0x430572[_0x4edd('0x129')]][_0x4edd('0xb6')]])){if(this[_0x4edd('0x2f')][_0x208836[_0x4edd('0x28')][_0x430572[_0x4edd('0x129')]][_0x4edd('0xb6')]]){this['queueBookedRR'][_0x208836[_0x4edd('0x28')][_0x430572[_0x4edd('0x129')]][_0x4edd('0xb6')]]=this[_0x4edd('0x2f')][this[_0x4edd('0x28')][_0x430572['actionid']][_0x4edd('0xb6')]]?this[_0x4edd('0x2f')][this[_0x4edd('0x28')][_0x430572['actionid']][_0x4edd('0xb6')]]:this[_0x4edd('0x2e')][this[_0x4edd('0x28')][_0x430572[_0x4edd('0x129')]][_0x4edd('0xb6')]]?this[_0x4edd('0x2e')][this[_0x4edd('0x28')][_0x430572['actionid']][_0x4edd('0xb6')]][_0x4edd('0x134')]||0x0:0x0;}this[_0x4edd('0x2e')][this[_0x4edd('0x28')][_0x430572[_0x4edd('0x129')]]['queue']][_0x4edd('0x134')]=this['queueBookedRR'][this[_0x4edd('0x28')][_0x430572[_0x4edd('0x129')]][_0x4edd('0xb6')]];for(var _0x324ff4=0x0;_0x324ff4=0x0;})[_0x4edd('0xb4')](myreject(_0x17f0e1)));}}else{_0x3db916[_0x4edd('0x14e')](ami['Action']({'action':_0x4edd('0x149'),'command':util[_0x4edd('0x79')]('iftime\x20%s,%s',_0x8b8211,!_[_0x4edd('0x41')](config['timezones'][_0x443e3a])?_0x443e3a:'')})[_0x4edd('0x40')](function(_0x2a9135){return _0x2a9135[_0x4edd('0x14c')][_0x4edd('0x14d')](_0x4edd('0x14f'))>=0x0;})['catch'](myreject(_0x17f0e1)));}BPromise[_0x4edd('0x150')](_0x3db916)[_0x4edd('0x40')](function(_0x42be11){var _0x2ddd80=_[_0x4edd('0x151')](_0x42be11);if(_0x2ddd80){return _0x3eb632(_0x2ddd80);}else{_0x52816b[_0x4edd('0x42')]=_0x464bf3?'GLOBAL_INTERVAL_IS_OVERTIME':_0x4edd('0x152');return _0x17f0e1(msgResponse(_0x4edd('0x153'),'Failure',_0x4edd('0x154')+_0x464bf3+'\x20'+_0x364286+_0x4edd('0x155')+util[_0x4edd('0x97')](_0x8b8211,{'showHidden':![],'depth':null})+_0x4edd('0x156')+_0x443e3a));}})['catch'](function(_0x391092){return _0x17f0e1(msgResponse(_0x4edd('0x142'),_0x4edd('0x144'),JSON[_0x4edd('0x4f')](_0x391092)));});});};Dialer[_0x4edd('0x1d')][_0x4edd('0x157')]=function(_0x4f6aa3){var _0x547a5c=this;return function(){switch(_0x4f6aa3[_0x4edd('0x5e')]){case'progressive':freeVariablesPredictive(_0x4f6aa3);_0x547a5c[_0x4edd('0x158')](_0x4f6aa3,0x1);break;case'power':freeVariablesPredictive(_0x4f6aa3);_0x547a5c[_0x4edd('0x158')](_0x4f6aa3,_0x4f6aa3[_0x4edd('0x159')]);break;case'predictive':_0x547a5c['predictive'](_0x4f6aa3);break;case _0x4edd('0x7'):freeVariablesPredictive(_0x4f6aa3);_0x547a5c[_0x4edd('0x158')](_0x4f6aa3,0x1);break;default:freeVariablesPredictive(_0x4f6aa3);logger['error'](_0x4edd('0x15a'),_0x4f6aa3[_0x4edd('0x46')],_0x4edd('0x15b'));}};};Dialer['prototype'][_0x4edd('0x15c')]=function(_0x2dcfc6){return BPromise[_0x4edd('0xb9')]()[_0x4edd('0x40')](cmHopper[_0x4edd('0x15d')](_0x2dcfc6['id'],previewRecallmeReminderInterval))[_0x4edd('0x40')](function(_0x9e4df){for(var _0x5d76b3=0x0;_0x5d76b3<_0x9e4df[_0x4edd('0x9a')];_0x5d76b3++){var _0x3f05d1=_0x9e4df[_0x5d76b3][_0x4edd('0x15e')][_0x4edd('0x46')];if(_0x3f05d1)io['to'](util[_0x4edd('0x79')](_0x4edd('0x15f'),_0x3f05d1))[_0x4edd('0xea')](_0x4edd('0x160'),{'hopper':_0x9e4df[_0x5d76b3]});}})[_0x4edd('0xb4')](function(_0x409dc0){});};Dialer[_0x4edd('0x1d')][_0x4edd('0x161')]=function(_0x510d42){var _0x313696=this;return function(){_0x313696[_0x4edd('0x162')](_0x510d42);};};Dialer[_0x4edd('0x1d')][_0x4edd('0xb')]=function(_0x2c348a){var _0x159835=this;if(isNotPreview(_0x2c348a['dialMethod'])){if(isVoiceQueueOutbound(_0x2c348a[_0x4edd('0x52')])&&isActive(_0x2c348a[_0x4edd('0x5d')])){_0x2c348a[_0x4edd('0xa5')]=!![];BPromise[_0x4edd('0xb9')]()[_0x4edd('0x40')](checkIsLoggedIn(_0x2c348a,_0x2c348a[_0x4edd('0x55')]))[_0x4edd('0x40')](checkIsActive(_0x2c348a,_0x2c348a['dialActive']))[_0x4edd('0x40')](checkInterval(_0x2c348a))[_0x4edd('0x40')](_0x159835[_0x4edd('0x163')](_0x2c348a))[_0x4edd('0x40')](_0x159835[_0x4edd('0x141')](_0x2c348a[_0x4edd('0x164')],_0x2c348a[_0x4edd('0x165')],_0x2c348a['name'],_0x2c348a))[_0x4edd('0x40')](_0x159835[_0x4edd('0x143')](_0x2c348a[_0x4edd('0x48')],_0x2c348a['dialTimezone'],_0x2c348a['name'],_0x2c348a))[_0x4edd('0x40')](_0x159835[_0x4edd('0x157')](_0x2c348a))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x2c348a));}else{notSendMessagesQueue(_0x2c348a);}}else{freeVariablesPredictive(_0x2c348a);if(_0x2c348a['dialPreviewRecallmeReminder']){_0x159835[_0x4edd('0x15c')](_0x2c348a);}}};Dialer[_0x4edd('0x1d')][_0x4edd('0x13f')]=function(){var _0x14d055=this;var _0x451aa8;for(var _0x3ab78b in this[_0x4edd('0x23')]){if(typeof this[_0x4edd('0x23')][_0x3ab78b]!==_0x4edd('0x9b')){_0x451aa8=this['campaigns'][_0x3ab78b];if(isCampaignIvr(_0x451aa8[_0x4edd('0x52')])&&isActive(_0x451aa8[_0x4edd('0x77')])){_0x451aa8[_0x4edd('0xa5')]=!![];BPromise['resolve']()[_0x4edd('0x40')](checkIsActive(_0x451aa8,_0x451aa8[_0x4edd('0x77')]))[_0x4edd('0x40')](checkInterval(_0x451aa8))[_0x4edd('0x40')](_0x14d055[_0x4edd('0x163')](_0x451aa8))[_0x4edd('0x40')](_0x14d055[_0x4edd('0x141')](_0x451aa8[_0x4edd('0x164')],_0x451aa8[_0x4edd('0x165')],_0x451aa8[_0x4edd('0x46')],_0x451aa8))['then'](_0x14d055[_0x4edd('0x143')](_0x451aa8['Interval'],_0x451aa8[_0x4edd('0x165')],_0x451aa8[_0x4edd('0x46')],_0x451aa8))['then'](_0x14d055[_0x4edd('0x161')](_0x451aa8))[_0x4edd('0xb4')](loggerCatchQueueSummary('[syncCampaigns]',_0x451aa8));}else{notSendMessagesCampaign(_0x451aa8);}}}};function getCallerIdRandom(_0x29a8f4,_0x357f11){var _0x35df90;var _0x84f7f9;var _0x2c4b21;if(_0x357f11<=0x0){_0x357f11=0x1;}_0x35df90=new RegExp('\x5cw{0,'+_0x357f11+'}$');_0x84f7f9=Math[_0x4edd('0x166')](0xa,_0x357f11-0x1);_0x2c4b21=Math[_0x4edd('0x166')](0xa,_0x357f11)-0x1;return util[_0x4edd('0x79')]('%s',_[_0x4edd('0x167')](_0x29a8f4,_0x35df90,_[_0x4edd('0x168')](_0x84f7f9,_0x2c4b21)));}function extractCalleridName(_0x2a77b5){var _0xa05ba6=_0x2a77b5['match'](/"(.*?)"/);return _0xa05ba6?_0xa05ba6[0x1]:_0x2a77b5;}function extractCalleridNumber(_0xf212a5){var _0x416c77=_0xf212a5[_0x4edd('0x169')](/<(.*?)>/);return _0x416c77?_0x416c77[0x1]:_0xf212a5;}Dialer[_0x4edd('0x1d')][_0x4edd('0x16a')]=function(_0x3b581c,_0x419974){var _0x1527e3=this;var _0x3b7ab1=uuid['v4']();this[_0x4edd('0x28')][_0x3b7ab1]=new Action(_0x3b581c,_0x419974,_0x3b7ab1);return new BPromise(function(_0xe0b469,_0x5739b3){if(_[_0x4edd('0x41')](_0x3b581c)&&typeof _0x3b581c!==_0x4edd('0x16b')){return _0x5739b3(msgResponse(_0x4edd('0x16c'),_0x4edd('0x144'),_0x4edd('0x16d')));}if(_[_0x4edd('0x41')](_0x419974[_0x4edd('0x16e')][_0x4edd('0x16f')])||_0x419974[_0x4edd('0x16e')][_0x4edd('0x16f')]===null){return _0x5739b3(msgResponse(_0x4edd('0x16c'),_0x4edd('0x144'),_0x4edd('0x170')));}var _0x3fe4c8={'XMD-CALLERID':_0x1527e3[_0x4edd('0x28')][_0x3b7ab1]['getCaller'](),'XMD-AGI':_0x3b581c[_0x4edd('0x110')]?util[_0x4edd('0x79')](_0x4edd('0x171'),ipAgi,_0x3b581c[_0x4edd('0x110')]):_0x4edd('0x172'),'XMD-AGIAFTER':_0x3b581c[_0x4edd('0x116')]?util[_0x4edd('0x79')](_0x4edd('0x171'),ipAgi,_0x3b581c[_0x4edd('0x116')]):_0x4edd('0x172'),'XMD-QUEUE':_0x3b581c[_0x4edd('0x52')]===_0x4edd('0x94')?util[_0x4edd('0x79')](_0x4edd('0x173'),_0x3b581c['name'],_0x3b581c['dialQueueOptions']||'',_0x3b581c[_0x4edd('0x117')]?'c':'',_0x3b581c[_0x4edd('0x11d')]||0x3):_0x4edd('0x172'),'XMD-CONTACTID':_0x419974[_0x4edd('0xd4')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1527e3[_0x4edd('0x28')][_0x3b7ab1]['getCaller'](),'XMD-AMD':_0x3b581c[_0x4edd('0xe4')]?_0x4edd('0x174'):_0x4edd('0x172'),'XMD-DESTINATION':_0x4edd('0xe3')};if(_0x3b581c[_0x4edd('0xe4')]){_0x3fe4c8[_0x4edd('0x175')]=_0x3b581c[_0x4edd('0x176')]||0x9c4;_0x3fe4c8['XMD-AMDGREETING']=_0x3b581c[_0x4edd('0x177')]||0x5dc;_0x3fe4c8[_0x4edd('0x178')]=_0x3b581c[_0x4edd('0x179')]||0x320;_0x3fe4c8[_0x4edd('0x17a')]=_0x3b581c[_0x4edd('0x17b')]||0x1388;_0x3fe4c8['XMD-AMDMINWORDLENGTH']=_0x3b581c[_0x4edd('0x17c')]||0x64;_0x3fe4c8[_0x4edd('0x17d')]=_0x3b581c['dialAMDBetweenWordsSilence']||0x32;_0x3fe4c8[_0x4edd('0x17e')]=_0x3b581c[_0x4edd('0x17f')]||0x3;_0x3fe4c8[_0x4edd('0x180')]=_0x3b581c[_0x4edd('0x181')]||0x100;_0x3fe4c8[_0x4edd('0x182')]=_0x3b581c[_0x4edd('0x183')]||0x1388;}if(_0x3b581c[_0x4edd('0x52')]===_0x4edd('0x94')){_0x3fe4c8[_0x4edd('0x184')]=_0x419974['VoiceQueueId'];}else{_0x3fe4c8['XMD-CAMPAIGNID']=_0x419974[_0x4edd('0x104')];}for(var _0x165f1a in _0x419974[_0x4edd('0x16e')]){if(typeof _0x419974[_0x4edd('0x16e')][_0x165f1a]!==_0x4edd('0x9b')){if(isNotNull(_0x419974[_0x4edd('0x16e')][_0x165f1a])&&_0x165f1a!=='id'&&_0x165f1a!==_0x4edd('0x185')&&_0x165f1a!==_0x4edd('0x186')&&_0x165f1a!=='updatedAt'){_0x3fe4c8[util[_0x4edd('0x79')](_0x4edd('0x187'),'XMD-',_[_0x4edd('0x188')](_0x165f1a))]=_0x419974[_0x4edd('0x16e')][_0x165f1a];}}}var _0x15e7db=_0x1527e3['isTrunkReachable'](_0x3b581c[_0x4edd('0x76')])?getCallerId(_0x3b581c[_0x4edd('0x76')][_0x4edd('0x78')],_0x3b581c['dialOriginateCallerIdName'],_0x3b581c[_0x4edd('0x189')]>0x0?getCallerIdRandom(_0x3b581c[_0x4edd('0x18a')],_0x3b581c[_0x4edd('0x189')]):_0x3b581c['dialOriginateCallerIdNumber']):getCallerId(_[_0x4edd('0xb2')](_0x3b581c[_0x4edd('0x18b')])?_0x3b581c[_0x4edd('0x76')][_0x4edd('0x78')]:_0x3b581c[_0x4edd('0x18b')][_0x4edd('0x78')],_0x3b581c[_0x4edd('0x5f')],_0x3b581c['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3b581c[_0x4edd('0x18a')],_0x3b581c[_0x4edd('0x189')]):_0x3b581c['dialOriginateCallerIdNumber']);if(_0x15e7db){_0x3fe4c8['XMD-ORIGINATECALLERIDNAME']=_0x1527e3[_0x4edd('0x28')][_0x3b7ab1][_0x4edd('0x18c')]=extractCalleridName(_0x15e7db);_0x3fe4c8[_0x4edd('0x18d')]=_0x1527e3['actions'][_0x3b7ab1][_0x4edd('0x18e')]=extractCalleridNumber(_0x15e7db);}return ami[_0x4edd('0x18f')]({'actionid':_0x3b7ab1,'action':_0x4edd('0x16c'),'channel':_0x1527e3[_0x4edd('0xd9')](_0x3b581c[_0x4edd('0x76')])?util['format'](_0x4edd('0x190'),_0x3b581c[_0x4edd('0x76')][_0x4edd('0x46')],isNotNull(_0x3b581c[_0x4edd('0x61')])?_0x3b581c[_0x4edd('0x61')][_0x4edd('0x191')]()||'':'',_0x3b581c['dialCutDigit']>0x0?_0x419974[_0x4edd('0x16e')][_0x4edd('0x16f')]['substring'](_0x3b581c[_0x4edd('0x192')]):_0x419974['Contact']['phone']):util[_0x4edd('0x79')]('SIP/%s/%s%s',_[_0x4edd('0xb2')](_0x3b581c[_0x4edd('0x18b')])?_0x3b581c[_0x4edd('0x76')][_0x4edd('0x46')]:_0x3b581c[_0x4edd('0x18b')][_0x4edd('0x46')],isNotNull(_0x3b581c[_0x4edd('0x61')])?_0x3b581c[_0x4edd('0x61')]['trim']()||'':'',_0x3b581c[_0x4edd('0x192')]>0x0?_0x419974[_0x4edd('0x16e')][_0x4edd('0x16f')][_0x4edd('0x193')](_0x3b581c[_0x4edd('0x192')]):_0x419974[_0x4edd('0x16e')][_0x4edd('0x16f')]),'callerid':_0x15e7db,'Exten':_0x4edd('0xe3'),'Context':'from-sip','Priority':'1','variable':_0x3fe4c8,'timeout':(_0x3b581c[_0x4edd('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3b7ab1})[_0x4edd('0x40')](function(_0x5c9a92){return _0xe0b469(_0x5c9a92);})[_0x4edd('0xb4')](function(_0x90b468){_0x3b581c[_0x4edd('0x68')]+=0x1;var _0x534339=new History(_0x1527e3[_0x4edd('0x28')][_0x3b7ab1]);logger['error'](util[_0x4edd('0x79')](_0x4edd('0x194'),JSON[_0x4edd('0x4f')](_0x90b468)));_0x534339[_0x4edd('0xab')]=0xe;_0x534339[_0x4edd('0xac')]=_0x4edd('0x195');_0x534339['starttime']=moment()[_0x4edd('0x79')](_0x4edd('0x102'));_0x534339['endtime']=_0x534339[_0x4edd('0xae')];_0x1527e3[_0x4edd('0xce')](_0x534339)[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x196')));_0x1527e3[_0x4edd('0xcc')](_0x534339)[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x196')))[_0x4edd('0x20')](function(){delete _0x1527e3[_0x4edd('0x28')][_0x3b7ab1];return _0x5739b3(msgResponse(_0x4edd('0x16c'),'Error',_0x4edd('0x197')));});});});};Dialer[_0x4edd('0x1d')][_0x4edd('0x33')]=function(_0x4d8468){var _0x3c35d0=this[_0x4edd('0x28')][_0x4d8468[_0x4edd('0x129')]];if(_0x3c35d0){delete this[_0x4edd('0x28')][_0x4d8468[_0x4edd('0x129')]];_0x3c35d0[_0x4edd('0x11c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x3fe334=_0x3c35d0[_0x4edd('0x52')]===_0x4edd('0x7b')?this[_0x4edd('0x23')][_0x3c35d0['queue']]:this['voiceQueues'][_0x3c35d0[_0x4edd('0x198')]()];if(!this[_0x4edd('0x199')](_0x4d8468[_0x4edd('0x19a')])){this[_0x4edd('0xb5')](_0x3fe334);return this['callProgressDetecting'](_0x3c35d0,_0x3fe334,_0x4d8468)['catch'](loggerCatch(_0x4edd('0x19b')));}this[_0x4edd('0x2a')][_0x4d8468[_0x4edd('0xdf')]]=_0x3c35d0;}};Dialer[_0x4edd('0x1d')][_0x4edd('0x19c')]=function(_0x2ff095,_0x35a85b,_0xf49187){var _0x2d7f34=new History(_0x35a85b);if(_0x2d7f34[_0x4edd('0xf5')]+_0x2d7f34[_0x4edd('0xf6')]+_0x2d7f34[_0x4edd('0x19d')]+_0x2d7f34[_0x4edd('0xf7')]+_0x2d7f34['countdropretry']+_0x2d7f34['countabandonedretry']+_0x2d7f34[_0x4edd('0xf1')]+_0x2d7f34[_0x4edd('0xfa')]>=_0xf49187[_0x4edd('0xfb')]-0x1){return!![];}switch(_0x2ff095){case 0x3:if(_0x2d7f34[_0x4edd('0x19d')]>=_0xf49187['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x4edd('0xc1')]({'active':![],'countnoanswerretry':_0x2d7f34['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0xf49187[_0x4edd('0x19e')],'minutes')[_0x4edd('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2d7f34['ContactId'],'ListId':_0x2d7f34[_0x4edd('0x103')],'VoiceQueueId':_0x2d7f34[_0x4edd('0xd6')]||undefined,'CampaignId':_0x2d7f34[_0x4edd('0x104')]||undefined})[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x19f')));break;case 0x5:if(_0x2d7f34[_0x4edd('0xf5')]>=_0xf49187[_0x4edd('0x1a0')]-0x1){return!![];}this[_0x4edd('0xc1')]({'active':![],'countbusyretry':_0x2d7f34[_0x4edd('0xf5')]+=0x1,'scheduledat':moment()[_0x4edd('0xff')](_0xf49187[_0x4edd('0x1a1')],_0x4edd('0x101'))['format'](_0x4edd('0x102')),'ContactId':_0x2d7f34[_0x4edd('0xd4')],'ListId':_0x2d7f34[_0x4edd('0x103')],'VoiceQueueId':_0x2d7f34[_0x4edd('0xd6')]||undefined,'CampaignId':_0x2d7f34['CampaignId']||undefined})[_0x4edd('0xb4')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x2d7f34[_0x4edd('0xf6')]>=_0xf49187['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x2d7f34[_0x4edd('0xf6')]+=0x1,'scheduledat':moment()[_0x4edd('0xff')](_0xf49187[_0x4edd('0x1a2')],_0x4edd('0x101'))[_0x4edd('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2d7f34[_0x4edd('0xd4')],'ListId':_0x2d7f34['ListId'],'VoiceQueueId':_0x2d7f34[_0x4edd('0xd6')]||undefined,'CampaignId':_0x2d7f34['CampaignId']||undefined})[_0x4edd('0xb4')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x2d7f34[_0x4edd('0xf7')]>=_0xf49187[_0x4edd('0x1a3')]-0x1){return!![];}else{this[_0x4edd('0xc1')]({'active':![],'countnosuchnumberretry':_0x2d7f34[_0x4edd('0xf7')]+=0x1,'scheduledat':moment()[_0x4edd('0xff')](_0xf49187[_0x4edd('0x1a4')],'minutes')[_0x4edd('0x79')](_0x4edd('0x102')),'ContactId':_0x2d7f34['ContactId'],'ListId':_0x2d7f34[_0x4edd('0x103')],'VoiceQueueId':_0x2d7f34['VoiceQueueId']||undefined,'CampaignId':_0x2d7f34[_0x4edd('0x104')]||undefined})[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x1a5')));}break;case 0xa:if(_0x2d7f34[_0x4edd('0xf8')]>=_0xf49187[_0x4edd('0x1a6')]-0x1){return!![];}this[_0x4edd('0xc1')]({'active':![],'countdropretry':_0x2d7f34[_0x4edd('0xf8')]+=0x1,'scheduledat':moment()[_0x4edd('0xff')](_0xf49187['dialDropRetryFrequency'],'minutes')[_0x4edd('0x79')](_0x4edd('0x102')),'ContactId':_0x2d7f34[_0x4edd('0xd4')],'ListId':_0x2d7f34[_0x4edd('0x103')],'VoiceQueueId':_0x2d7f34[_0x4edd('0xd6')]||undefined,'CampaignId':_0x2d7f34[_0x4edd('0x104')]||undefined})[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x1a7')));break;case 0xb:if(_0x2d7f34[_0x4edd('0xf9')]>=_0xf49187['dialAbandonedMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x2d7f34[_0x4edd('0xf9')]+=0x1,'scheduledat':moment()[_0x4edd('0xff')](_0xf49187['dialAbandonedRetryFrequency'],'minutes')[_0x4edd('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2d7f34[_0x4edd('0xd4')],'ListId':_0x2d7f34[_0x4edd('0x103')],'VoiceQueueId':_0x2d7f34[_0x4edd('0xd6')]||undefined,'CampaignId':_0x2d7f34[_0x4edd('0x104')]||undefined})['catch'](loggerCatch(_0x4edd('0x1a8')));break;case 0x13:if(_0x2d7f34[_0x4edd('0xf1')]>=_0xf49187[_0x4edd('0xfd')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x2d7f34['countmachineretry']+=0x1,'scheduledat':moment()[_0x4edd('0xff')](_0xf49187[_0x4edd('0x100')],_0x4edd('0x101'))[_0x4edd('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2d7f34[_0x4edd('0xd4')],'ListId':_0x2d7f34[_0x4edd('0x103')],'VoiceQueueId':_0x2d7f34[_0x4edd('0xd6')]||undefined,'CampaignId':_0x2d7f34[_0x4edd('0x104')]||undefined})[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x105')));break;case 0x14:if(_0x2d7f34['countagentrejectretry']>=_0xf49187[_0x4edd('0x1a9')]-0x1){return!![];}this[_0x4edd('0xc1')]({'active':![],'countagentrejectretry':_0x2d7f34[_0x4edd('0xfa')]+=0x1,'scheduledat':moment()[_0x4edd('0xff')](_0xf49187[_0x4edd('0x1aa')],'minutes')[_0x4edd('0x79')](_0x4edd('0x102')),'ContactId':_0x2d7f34[_0x4edd('0xd4')],'ListId':_0x2d7f34[_0x4edd('0x103')],'VoiceQueueId':_0x2d7f34[_0x4edd('0xd6')]||undefined,'CampaignId':_0x2d7f34[_0x4edd('0x104')]||undefined})['catch'](loggerCatch(_0x4edd('0x1ab')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x966344,_0x1524ce,_0x44894d){var _0x1d7cdd=this;var _0x4b37f3=new History(_0x966344);return new BPromise(function(_0xe478af,_0x3393ac){if(_['isUndefined'](_0x1524ce)&&typeof _0x1524ce!==_0x4edd('0x16b')){return _0x3393ac(msgResponse(_0x4edd('0x1ac'),'Failure','entity\x20is\x20undefine'));}if(_[_0x4edd('0x41')](_0x44894d)&&typeof _0x44894d!=='object'){return _0x3393ac(msgResponse(_0x4edd('0x1ac'),_0x4edd('0x144'),_0x4edd('0x1ad')));}switch(_0x44894d[_0x4edd('0x113')]){case'0':_0x1524ce[_0x4edd('0x67')]+=0x1;_0x4b37f3['state']=0x0;_0x4b37f3[_0x4edd('0xac')]=_0x4edd('0x1ae');_0x4b37f3['countnosuchnumberretry']+=0x1;_0x4b37f3[_0x4edd('0xf2')]+=0x1;ami['emit'](_0x4edd('0x1af'),ut[_0x4edd('0xec')](_0x966344,_0x4edd('0x1b0')));_0x1d7cdd[_0x4edd('0xce')](_0x4b37f3)[_0x4edd('0xb4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1d7cdd[_0x4edd('0x19c')](0x0,_0x966344,_0x1524ce)){if(_0x4b37f3[_0x4edd('0xf7')]>=_0x1524ce[_0x4edd('0x1a3')]){_0x1d7cdd[_0x4edd('0xfe')](_0x4b37f3,_0xe478af,_0x3393ac,_0x4edd('0x1b1'));}else{_0x1d7cdd[_0x4edd('0xfc')](_0x4b37f3,_0xe478af,_0x3393ac,_0x4edd('0x1b1'));}}break;case'3':_0x1524ce[_0x4edd('0x66')]+=0x1;_0x4b37f3[_0x4edd('0xab')]=0x3;_0x4b37f3[_0x4edd('0xac')]=_0x4edd('0x1b2');_0x4b37f3[_0x4edd('0x19d')]+=0x1;_0x4b37f3[_0x4edd('0xf2')]+=0x1;ami[_0x4edd('0xea')](_0x4edd('0x1b3'),ut[_0x4edd('0xec')](_0x966344,_0x4edd('0x1b4')));_0x1d7cdd[_0x4edd('0xce')](_0x4b37f3)[_0x4edd('0xb4')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1d7cdd[_0x4edd('0x19c')](0x3,_0x966344,_0x1524ce)){if(_0x4b37f3[_0x4edd('0x19d')]>=_0x1524ce[_0x4edd('0x1b5')]){_0x1d7cdd[_0x4edd('0xfe')](_0x4b37f3,_0xe478af,_0x3393ac,_0x4edd('0x1b6'));}else{_0x1d7cdd['stateGlobal'](_0x4b37f3,_0xe478af,_0x3393ac,_0x4edd('0x1b6'));}}break;case'5':_0x1524ce['outboundBusyCallsDay']+=0x1;_0x4b37f3['state']=0x5;_0x4b37f3['statedesc']=_0x4edd('0x1b7');_0x4b37f3[_0x4edd('0xf5')]+=0x1;_0x4b37f3[_0x4edd('0xf2')]+=0x1;ami['emit'](_0x4edd('0x1b8'),ut[_0x4edd('0xec')](_0x966344,_0x4edd('0x1b9')));_0x1d7cdd['createHistory'](_0x4b37f3)[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x1ba')));if(_0x1d7cdd[_0x4edd('0x19c')](0x5,_0x966344,_0x1524ce)){if(_0x4b37f3[_0x4edd('0xf5')]>=_0x1524ce[_0x4edd('0x1a0')]){_0x1d7cdd[_0x4edd('0xfe')](_0x4b37f3,_0xe478af,_0x3393ac,_0x4edd('0x1bb'));}else{_0x1d7cdd['stateGlobal'](_0x4b37f3,_0xe478af,_0x3393ac,_0x4edd('0x1bb'));}}break;case'8':_0x1524ce[_0x4edd('0x1bc')]+=0x1;_0x4b37f3[_0x4edd('0xab')]=0x8;_0x4b37f3[_0x4edd('0xac')]=_0x4edd('0x1bd');_0x4b37f3['countcongestionretry']+=0x1;_0x4b37f3[_0x4edd('0xf2')]+=0x1;ami[_0x4edd('0xea')](_0x4edd('0x1be'),ut[_0x4edd('0xec')](_0x966344,_0x4edd('0x1bf')));_0x1d7cdd['createHistory'](_0x4b37f3)['catch'](loggerCatch(_0x4edd('0x1c0')));if(_0x1d7cdd[_0x4edd('0x19c')](0x8,_0x966344,_0x1524ce)){if(_0x4b37f3[_0x4edd('0xf6')]>=_0x1524ce[_0x4edd('0x1c1')]){_0x1d7cdd[_0x4edd('0xfe')](_0x4b37f3,_0xe478af,_0x3393ac,_0x4edd('0x1c2'));}else{_0x1d7cdd['stateGlobal'](_0x4b37f3,_0xe478af,_0x3393ac,_0x4edd('0x1c2'));}}break;case'11':_0x1524ce['outboundAbandonedCallsDay']+=0x1;_0x4b37f3[_0x4edd('0xab')]=0xb;_0x4b37f3[_0x4edd('0xac')]=_0x4edd('0x124');_0x4b37f3[_0x4edd('0xf9')]+=0x1;_0x4b37f3[_0x4edd('0xf2')]+=0x1;_0x1d7cdd[_0x4edd('0xce')](_0x4b37f3)[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x127')));if(_0x1d7cdd[_0x4edd('0x19c')](0xb,_0x966344,_0x1524ce)){if(_0x4b37f3[_0x4edd('0xf9')]>=_0x1524ce[_0x4edd('0x126')]){_0x1d7cdd['createStateFinal'](_0x4b37f3,_0xe478af,_0x3393ac,'reason\x2011\x20abandoned');}else{_0x1d7cdd[_0x4edd('0xfc')](_0x4b37f3,_0xe478af,_0x3393ac,_0x4edd('0x1c3'));}}break;case'20':_0x1524ce[_0x4edd('0x1c4')]+=0x1;_0x4b37f3[_0x4edd('0xab')]=0x14;_0x4b37f3[_0x4edd('0xac')]=_0x4edd('0x1c5');_0x4b37f3[_0x4edd('0xfa')]+=0x1;_0x4b37f3[_0x4edd('0xf2')]+=0x1;ami['emit'](_0x4edd('0x1c6'),ut[_0x4edd('0xec')](_0x966344,_0x4edd('0x1c7')));_0x1d7cdd[_0x4edd('0xce')](_0x4b37f3)[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x1c8')));if(_0x1d7cdd[_0x4edd('0x19c')](0x14,_0x966344,_0x1524ce)){if(_0x4b37f3['countagentrejectretry']>=_0x1524ce[_0x4edd('0x1a9')]){_0x1d7cdd[_0x4edd('0xfe')](_0x4b37f3,_0xe478af,_0x3393ac,'reason\x2020\x20agentreject');}else{_0x1d7cdd[_0x4edd('0xfc')](_0x4b37f3,_0xe478af,_0x3393ac,_0x4edd('0x1c9'));}}break;default:_0x1524ce[_0x4edd('0x111')]+=0x1;_0x4b37f3['state']=0xc;_0x4b37f3[_0x4edd('0xac')]=_0x44894d['reason'];_0x1d7cdd[_0x4edd('0xce')](_0x4b37f3)['catch'](loggerCatch(_0x4edd('0x1ca')));if(_0x1d7cdd[_0x4edd('0x19c')](_0x44894d[_0x4edd('0x113')],_0x966344,_0x1524ce)){if(_0x4b37f3['countbusyretry']+_0x4b37f3[_0x4edd('0xf6')]+_0x4b37f3['countnoanswerretry']+_0x4b37f3[_0x4edd('0xf7')]+_0x4b37f3[_0x4edd('0xf8')]+_0x4b37f3['countabandonedretry']+_0x4b37f3[_0x4edd('0xf1')]+_0x4b37f3['countagentrejectretry']>=_0x1524ce['dialGlobalMaxRetry']){_0x1d7cdd['stateGlobal'](_0x4b37f3,_0xe478af,_0x3393ac,_0x44894d[_0x4edd('0x113')]);}else{_0x1d7cdd[_0x4edd('0xfe')](_0x4b37f3,_0xe478af,_0x3393ac,_0x44894d[_0x4edd('0x113')]);}}}});};Dialer[_0x4edd('0x1d')][_0x4edd('0xfc')]=function(_0x478ffc,_0x54508a,_0x1ecd29,_0x322cd3){var _0x93db0d=new Final(_0x478ffc);_0x93db0d[_0x4edd('0xab')]=0xf;_0x93db0d[_0x4edd('0xac')]='Global';this['createStateFinal'](_0x93db0d,_0x54508a,_0x1ecd29,_0x322cd3);};Dialer[_0x4edd('0x1d')][_0x4edd('0xfe')]=function(_0xf2ec33,_0x259bee,_0x27bc6b,_0x15409e){this[_0x4edd('0xcc')](_0xf2ec33)[_0x4edd('0x40')](function(){return _0x259bee(msgResponse('[callProgressDetecting]',_0x4edd('0x1cb'),_0x15409e));})[_0x4edd('0xb4')](function(){return _0x27bc6b(msgResponse(_0x4edd('0x1cc'),_0x4edd('0x144'),_0x4edd('0x1cd')));});};Dialer[_0x4edd('0x1d')][_0x4edd('0x9')]=function(_0x2553b7){var _0xa577e9=_0x2553b7[_0x4edd('0x1ce')]/0x64;var _0x3e5cac=_0x2553b7[_0x4edd('0x65')]/(_0x2553b7[_0x4edd('0x65')]+_0x2553b7[_0x4edd('0xe6')]);var _0x277833=Math[_0x4edd('0x1cf')](_0x2553b7[_0x4edd('0x70')]*(_0x2553b7[_0x4edd('0x1d0')]/0x64));var _0x2847ed=Math[_0x4edd('0x1cf')](_0x2553b7[_0x4edd('0x70')]*(_0x2553b7[_0x4edd('0x1d1')]/0x64));var _0xdb8648=_0x2553b7[_0x4edd('0x54')]+_0x2553b7[_0x4edd('0xa4')];var _0x221faf=Math[_0x4edd('0x1d2')](_0x2553b7[_0x4edd('0x73')]*_0x2553b7[_0x4edd('0x75')]*_0x2553b7[_0x4edd('0x6e')]*_0x2553b7[_0x4edd('0x1d3')]);if(_[_0x4edd('0x41')](_0x2553b7[_0x4edd('0x2c')])){if(!_[_0x4edd('0x41')](_0x2553b7[_0x4edd('0x2b')])){_0x2553b7[_0x4edd('0x2b')]=undefined;loggerPredictive[_0x4edd('0x98')](_0x4edd('0x1d4'),_0x4edd('0x1d5'));}if(!_[_0x4edd('0x41')](_0x2553b7[_0x4edd('0x92')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2553b7['handlePredictive']);_0x2553b7[_0x4edd('0x92')]=undefined;}_0x2553b7[_0x4edd('0x2c')]=moment()[_0x4edd('0x79')](_0x4edd('0x102'));loggerPredictive['info'](_0x2553b7[_0x4edd('0x46')],_0x4edd('0x1d6'),_0x2553b7[_0x4edd('0x2c')]);this[_0x4edd('0x158')](_0x2553b7,0x1);}else if(ifInterval(_0x2553b7[_0x4edd('0x1d7')],_0x2553b7['startProgressive'])){this['handlePower'](_0x2553b7,0x1);loggerPredictiveCalls['info'](_0x4edd('0x1d8'),_0x2553b7[_0x4edd('0x2c')],_0x2553b7['name']);_0x2553b7[_0x4edd('0x73')]=0x0;_0x2553b7[_0x4edd('0x6d')]=0x0;}else if(_0xa577e9<_0x3e5cac&&_0x2553b7[_0x4edd('0x1d9')]==='dropRate'){freeVariablesPredictive(_0x2553b7);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x4edd('0x1da'),_0x3e5cac,_0x4edd('0x2c'),_0x2553b7[_0x4edd('0x46')]);}else if(_0x221faf<_0x2553b7[_0x4edd('0x6d')]&&_0x2553b7[_0x4edd('0x1d9')]==='dropRate'){freeVariablesPredictive(_0x2553b7);loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x1db'),_0x4edd('0x1dc'),_0x221faf,_0x4edd('0x1dd'),_0x2553b7[_0x4edd('0x6d')],_0x4edd('0x2c'),_0x2553b7[_0x4edd('0x46')]);}else if(!ifInterval(_0x2553b7[_0x4edd('0x1d7')],_0x2553b7[_0x4edd('0x2c')])&&_[_0x4edd('0x41')](_0x2553b7[_0x4edd('0x2b')])&&!_['isUndefined'](_0x2553b7['startProgressive'])){_0x2553b7['startPredictive']=moment()[_0x4edd('0x79')](_0x4edd('0x102'));loggerPredictive['info'](_0x2553b7[_0x4edd('0x46')],'started\x20in\x20predictive\x20at',_0x2553b7[_0x4edd('0x2b')]);this[_0x4edd('0xbe')](_0x2553b7[_0x4edd('0x1d7')])[_0x4edd('0x40')](this['getDataPredictive'](_0x2553b7))['then'](mergeDataErlangB(_0x2553b7))[_0x4edd('0x40')](this['startMethodPredictive'](_0x2553b7))[_0x4edd('0xb4')](loggerCatchPredictive(_0x4edd('0x1de'),_0x2553b7));}else if(!ifInterval(_0x2553b7['dialPredictiveInterval'],_0x2553b7[_0x4edd('0x2b')])){_0x2553b7['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2553b7['startPredictive']=moment()[_0x4edd('0x79')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x4edd('0x7e')](_0x2553b7[_0x4edd('0x46')],_0x4edd('0x1df'),_0x2553b7[_0x4edd('0x2b')]);clearInterval(_0x2553b7['handlePredictive']);_0x2553b7[_0x4edd('0x92')]=undefined;this[_0x4edd('0xbe')](_0x2553b7[_0x4edd('0x1d7')])[_0x4edd('0x40')](this[_0x4edd('0x1e0')](_0x2553b7))['then'](mergeDataErlangB(_0x2553b7))[_0x4edd('0x40')](this[_0x4edd('0x1e1')](_0x2553b7))['catch'](loggerCatchPredictive(_0x4edd('0x1e2'),_0x2553b7));}else if(_0x2553b7[_0x4edd('0x70')]&&_0xdb8648<_0x2553b7['predictiveIntervalAvailable']-_0x2847ed){freeVariablesPredictive(_0x2553b7);loggerPredictive[_0x4edd('0x7e')](_0x2553b7[_0x4edd('0x46')],_0x4edd('0x1e3'),_0xdb8648,_0x4edd('0x1e4'),_0x2553b7[_0x4edd('0x70')],'-',_0x2847ed,'=',_0x2553b7[_0x4edd('0x70')]-_0x2847ed,')');}else if(_0x2553b7[_0x4edd('0x70')]&&_0xdb8648>_0x2553b7['predictiveIntervalAvailable']+_0x277833){freeVariablesPredictive(_0x2553b7);loggerPredictive[_0x4edd('0x7e')](_0x2553b7[_0x4edd('0x46')],_0x4edd('0x1e3'),_0xdb8648,_0x4edd('0x1e5'),_0x2553b7[_0x4edd('0x70')],'+',_0x277833,'=',_0x2553b7[_0x4edd('0x70')]+_0x277833,')');}};Dialer[_0x4edd('0x1d')]['getDataPredictive']=function(_0x233bd9){var _0x1c386d=this;return function(_0xa56abd){return new BPromise(function(_0x4191dd,_0x4246e1){_[_0x4edd('0x8f')](_0x233bd9,_0xa56abd[0x0]);if(checkGetDataPredictive(_0xa56abd[0x0])){var _0x50b8f9=_0x233bd9['predictiveIntervalAvailable']=_0x233bd9[_0x4edd('0xa4')]+_0x233bd9[_0x4edd('0x54')];var _0x1f60dd=_0x233bd9[_0x4edd('0x1d7')]*0x3c;var _0x5535f2=_0xa56abd[0x0]['predictiveIntervalAvgTalktime']+_0xa56abd[0x0][_0x4edd('0x69')];var _0x2c273b=(_0xa56abd[0x0][_0x4edd('0x81')]+_0xa56abd[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xa56abd[0x0][_0x4edd('0x6b')])/_0xa56abd[0x0]['predictiveIntervalTotalCalls'];_0x233bd9[_0x4edd('0x6e')]=_0x2c273b>0x0?_0x2c273b:0x1;switch(_0x233bd9['dialPredictiveOptimization']){case _0x4edd('0x1e6'):var _0x57e4c0=_0x233bd9['dialPredictiveOptimizationPercentage']/0x64;return _0x1c386d[_0x4edd('0x1e7')](_0x50b8f9,_0x1f60dd,_0x5535f2,_0x2c273b,_0x57e4c0)[_0x4edd('0x40')](function(_0x419fb1){return _0x4191dd(_0x419fb1);});case _0x4edd('0x1e8'):var _0x1a675e=_0x233bd9[_0x4edd('0x1ce')]/0x64;return _0x1c386d['busyFactor'](_0x50b8f9,_0x1f60dd,_0x5535f2,_0x2c273b,_0x1a675e)['then'](function(_0x5e6b4d){return _0x4191dd(_0x5e6b4d);});default:return _0x4246e1(msgResponse(_0x4edd('0x1e9'),_0x4edd('0x144'),_0x4edd('0x1ea')));}}else{return _0x4246e1(msgResponse(_0x4edd('0x1e9'),_0x4edd('0x144'),_0x4edd('0x1eb')));}});};};Dialer[_0x4edd('0x1d')][_0x4edd('0x1ec')]=function(_0xbb54c3){var _0x135e2a=this;return function(_0x49a457){return new BPromise(function(_0x39a2b2,_0x1434e1){_[_0x4edd('0x8f')](_0xbb54c3,_0x49a457[0x0]);if(checkGetDataPredictive(_0x49a457[0x0])){loggerPredictive['info'](JSON[_0x4edd('0x4f')](_0x49a457[0x0]));if(_0xbb54c3[_0x4edd('0x1d9')]===_0x4edd('0x1e6')){return _0x135e2a['getVoiceQueueRtPauses'](_0xbb54c3['id'])[_0x4edd('0x40')](function(_0x4e6160){var _0x537024=_0xbb54c3['loggedIn']-_0x4e6160[0x0][_0x4edd('0x1ed')];var _0x110f12=_0xbb54c3[_0x4edd('0x1d7')]*0x3c;var _0x375e58=_0x49a457[0x0][_0x4edd('0x6a')]+_0x49a457[0x0][_0x4edd('0x69')];var _0x3264d1=(_0x49a457[0x0][_0x4edd('0x81')]+_0x49a457[0x0][_0x4edd('0x6c')]+_0x49a457[0x0][_0x4edd('0x6b')])/_0x49a457[0x0][_0x4edd('0x71')];var _0x2a43af=_0xbb54c3['dialPredictiveOptimizationPercentage']/0x64;_0xbb54c3['predictiveIntervalPauses']=_0x4e6160[0x0]['outboundQueuePauses']||0x0;_0xbb54c3[_0x4edd('0x6e')]=_0x3264d1>0x0?_0x3264d1:0x1;return _0x135e2a['abandonmentRate'](_0x537024,_0x110f12,_0x375e58,_0x3264d1,_0x2a43af);})[_0x4edd('0x40')](function(_0x1d1115){return _0x39a2b2(_0x1d1115);})['catch'](function(_0x5f0232){return _0x1434e1(msgResponse(_0x4edd('0x1ee'),_0x4edd('0x144'),JSON[_0x4edd('0x4f')](_0x5f0232)));});}if(_0xbb54c3[_0x4edd('0x1d9')]===_0x4edd('0x1e8')){return _0x135e2a[_0x4edd('0xca')](_0xbb54c3['id'])[_0x4edd('0x40')](function(_0x195f3e){var _0x3a8c21=_0xbb54c3['loggedIn']-_0x195f3e[0x0][_0x4edd('0x1ed')];var _0x133869=_0xbb54c3['dialPredictiveInterval']*0x3c;var _0x962958=_0x49a457[0x0][_0x4edd('0x6a')]+_0x49a457[0x0][_0x4edd('0x69')];var _0x206d6b=(_0x49a457[0x0]['predictiveIntervalAnsweredCalls']+_0x49a457[0x0][_0x4edd('0x6c')]+_0x49a457[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x49a457[0x0]['predictiveIntervalTotalCalls'];var _0x1650c5=_0xbb54c3[_0x4edd('0x1ce')]/0x64;_0xbb54c3[_0x4edd('0x6f')]=_0x195f3e[0x0][_0x4edd('0x1ed')]||0x0;_0xbb54c3[_0x4edd('0x6e')]=_0x206d6b>0x0?_0x206d6b:0x1;return _0x135e2a[_0x4edd('0x1ef')](_0x3a8c21,_0x133869,_0x962958,_0x206d6b,_0x1650c5);})[_0x4edd('0x40')](function(_0x30bbaf){return _0x39a2b2(_0x30bbaf);})[_0x4edd('0xb4')](function(_0x4b660e){return _0x1434e1(msgResponse(_0x4edd('0x1ee'),'Failure',JSON[_0x4edd('0x4f')](_0x4b660e)));});}}else{return _0x1434e1(msgResponse(_0x4edd('0x1e9'),_0x4edd('0x144'),'check\x20failure'));}});};};Dialer[_0x4edd('0x1d')][_0x4edd('0x1e1')]=function(_0x8874d7){var _0x46587e=this;return function(){var _0x439257=0x0;var _0x506751=Math[_0x4edd('0x1d2')](_0x8874d7['erlangCallToSecond']*0x3e8);if(_0x506751>0x0){_0x506751=_0x506751<0x64?0x64:_0x506751;loggerPredictive[_0x4edd('0x7e')](_0x8874d7['name'],'one\x20call\x20every:',_0x506751,_0x4edd('0x50'));_0x8874d7[_0x4edd('0x92')]=setInterval(function(){_0x46587e['handlePredictive'](_0x8874d7);loggerPredictiveCalls[_0x4edd('0x7e')](_0x4edd('0x1f0'),_0x439257+=0x1);},_0x506751);}else{loggerPredictive[_0x4edd('0x7e')](_0x8874d7['name'],_0x4edd('0x1f1'));}};};Dialer[_0x4edd('0x1d')][_0x4edd('0x1f2')]=function(_0x50360f,_0x58943a){var _0x4a4602=this;return function(_0x37b6c0){if(_[_0x4edd('0x4c')](_0x37b6c0)){if(_[_0x4edd('0xb2')](_0x58943a['UserId'])||!_0x58943a[_0x4edd('0x1f3')]){if(_0x50360f[_0x4edd('0x5e')]===_0x4edd('0x7')){_0x50360f[_0x4edd('0x12e')]=_[_0x4edd('0x41')](_0x50360f[_0x4edd('0x12e')])?!![]:_0x50360f[_0x4edd('0x12e')];var _0x46c2e1=uuid['v4']();_0x4a4602['actions'][_0x46c2e1]=new Action(_0x50360f,_0x58943a,_0x46c2e1);loggerBooked[_0x4edd('0x7e')](_0x4edd('0x1f4'),_0x46c2e1,_0x4edd('0x1f5'),JSON[_0x4edd('0x4f')](_0x50360f[_0x4edd('0x12e')]),_0x4edd('0x1f6'),_0x50360f[_0x4edd('0x46')]);if(_0x50360f['queueStatusComplete']){_0x50360f[_0x4edd('0x12e')]=![];_0x4a4602['queueBooked'][_0x4a4602['actions'][_0x46c2e1][_0x4edd('0xb6')]]=[];ami[_0x4edd('0x18f')]({'actionid':_0x46c2e1,'action':_0x4edd('0x1f7'),'queue':_0x50360f['name']})[_0x4edd('0xb4')](function(){_0x4a4602['updateOriginated'](_0x50360f);_0x4a4602[_0x4edd('0xc1')]({'active':![],'ContactId':_0x4a4602[_0x4edd('0x28')][_0x46c2e1][_0x4edd('0xd4')],'ListId':_0x4a4602[_0x4edd('0x28')][_0x46c2e1]['ListId'],'VoiceQueueId':_0x4a4602[_0x4edd('0x28')][_0x46c2e1]['VoiceQueueId']||undefined,'CampaignId':_0x4a4602[_0x4edd('0x28')][_0x46c2e1]['CampaignId']||undefined})[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x1f8')));delete _0x4a4602['actions'][_0x46c2e1];});}else{loggerBooked[_0x4edd('0x7e')]('[booked][checkContactBlack][else]',JSON[_0x4edd('0x4f')](_0x50360f[_0x4edd('0x12e')]),_0x4edd('0x1f6'),_0x50360f[_0x4edd('0x46')]);_0x4a4602['updateOriginated'](_0x50360f);_0x4a4602[_0x4edd('0xc1')]({'active':![],'ContactId':_0x4a4602[_0x4edd('0x28')][_0x46c2e1][_0x4edd('0xd4')],'ListId':_0x4a4602[_0x4edd('0x28')][_0x46c2e1][_0x4edd('0x103')],'VoiceQueueId':_0x4a4602[_0x4edd('0x28')][_0x46c2e1][_0x4edd('0xd6')]||undefined,'CampaignId':_0x4a4602['actions'][_0x46c2e1][_0x4edd('0x104')]||undefined})[_0x4edd('0xb4')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4a4602[_0x4edd('0x28')][_0x46c2e1];}}else{return _0x4a4602[_0x4edd('0x16a')](_0x50360f,_0x58943a);}}else{if(getDiff(_0x58943a[_0x4edd('0x1f9')])<_0x50360f[_0x4edd('0x1fa')]*0x3c){if(_0x58943a[_0x4edd('0x15e')]&&!_0x58943a[_0x4edd('0x15e')]['voicePause']){_0x4a4602[_0x4edd('0x130')]['run'](_0x58943a['id'])[_0x4edd('0x20')](function(){_0x4a4602[_0x4edd('0xb5')](_0x50360f);});}else{_0x4a4602[_0x4edd('0xc3')]({'active':![]},_0x58943a['id'],0x1)[_0x4edd('0x20')](function(){_0x4a4602[_0x4edd('0xb5')](_0x50360f);});}}else{_0x50360f[_0x4edd('0x1fb')]+=0x1;_0x4a4602[_0x4edd('0xb5')](_0x50360f);if(_0x50360f[_0x4edd('0x1fc')]){_0x4a4602[_0x4edd('0xc1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x58943a[_0x4edd('0xd4')],'ListId':_0x58943a[_0x4edd('0x103')],'VoiceQueueId':_0x58943a['VoiceQueueId']||undefined,'CampaignId':_0x58943a[_0x4edd('0x104')]||undefined})[_0x4edd('0xb4')](loggerCatch(_0x4edd('0x1fd')));_0x4a4602[_0x4edd('0xce')](createObjHistory(_0x50360f,_0x58943a,_0x4edd('0x1fe'),0x17,_0x4edd('0x1ff')))['catch'](loggerCatch(_0x4edd('0x200')));}else{_0x4a4602['saveInDb'](createObjHistory(_0x50360f,_0x58943a,_0x4edd('0x201'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0x4edd('0x202'));}}}}else{_0x50360f[_0x4edd('0x203')]+=0x1;_0x4a4602[_0x4edd('0xd2')](createObjHistory(_0x50360f,_0x58943a,_0x4edd('0x204'),0xd,'Blacklist'),'[Originate][historyBlacklist]',_0x4edd('0x205'));throw _0x4edd('0x206');}};};Dialer[_0x4edd('0x1d')]['handleIvr']=function(_0x4148e0){var _0x216d34=this;var _0x1d4d64=_0x4148e0['limitCalls']-_0x4148e0[_0x4edd('0x72')]-_0x4148e0[_0x4edd('0xc6')];emitCampaignSummary(_0x4148e0);if(_0x1d4d64>0x0){if(_0x1d4d64>this[_0x4edd('0x26')]){_0x1d4d64=this[_0x4edd('0x26')];}_0x4148e0[_0x4edd('0xc6')]+=_0x1d4d64;this[_0x4edd('0xc8')](_0x4148e0['id'],_0x1d4d64,_0x4148e0[_0x4edd('0x207')],_0x4148e0)[_0x4edd('0x40')](function(_0x13b7e7){_0x4148e0['temp']-=_0x1d4d64;_0x4148e0[_0x4edd('0xc6')]=_0x4148e0[_0x4edd('0xc6')]>0x0?_0x4148e0[_0x4edd('0xc6')]:0x0;if(!checkContactEmpty(_0x13b7e7)){_0x4148e0[_0x4edd('0x42')]=_0x4edd('0xa2');logger[_0x4edd('0x7e')](_0x4edd('0x208')+_0x4148e0[_0x4edd('0x46')]);}else{_0x4148e0[_0x4edd('0x72')]+=_0x13b7e7[_0x4edd('0x9a')];_0x4148e0[_0x4edd('0x42')]=_0x4edd('0x209');for(var _0x2dc365=0x0;_0x2dc365<_0x13b7e7['length'];_0x2dc365+=0x1){_0x4148e0['ivrTotalCallsDays']+=0x1;if(_[_0x4edd('0xb2')](_0x13b7e7[_0x2dc365])||_[_0x4edd('0xb2')](_0x13b7e7[_0x2dc365][_0x4edd('0x16e')])||_[_0x4edd('0xb2')](_0x13b7e7[_0x2dc365][_0x4edd('0x16e')][_0x4edd('0x16f')])){_0x216d34[_0x4edd('0xd1')](_0x4edd('0x20a'),_0x4148e0,_0x13b7e7[_0x2dc365]);}else{_0x216d34[_0x4edd('0xbd')](_[_0x4edd('0xd3')](_0x13b7e7[_0x2dc365],[_0x4edd('0x104'),_0x4edd('0x20b')]))[_0x4edd('0x40')](_0x216d34['checkContactBlack'](_0x4148e0,_0x13b7e7[_0x2dc365]))[_0x4edd('0xb4')](_0x216d34['loggerHandler'](_0x4edd('0x20c'),_0x4148e0));}}}})[_0x4edd('0xb4')](loggerGetContactDialer(_0x4edd('0x20d'),_0x4148e0,_0x1d4d64));}};Dialer[_0x4edd('0x1d')][_0x4edd('0x158')]=function(_0x367fe7,_0x5cb55f){var _0x3e2940=this;var _0x23584c=[];var _0x5c5f1c=_0x5cb55f>=0x1?_0x5cb55f:0x1;if(_0x367fe7[_0x4edd('0x5e')]==='booked'){_0x5c5f1c=0x1;}var _0x45936c=Math[_0x4edd('0x1d2')](_0x367fe7[_0x4edd('0x54')]*_0x5c5f1c)-_0x367fe7[_0x4edd('0x72')]-_0x367fe7[_0x4edd('0xc6')];emitVoiceQueueSummary(_0x367fe7);if(_0x367fe7[_0x4edd('0x20e')]>0x0){var _0x2f3db2=_0x367fe7[_0x4edd('0x20e')]-_0x367fe7[_0x4edd('0x72')]-_0x367fe7[_0x4edd('0xa4')]-_0x367fe7[_0x4edd('0xc6')]-_0x367fe7[_0x4edd('0x56')];if(_0x45936c>_0x2f3db2){_0x45936c=_0x2f3db2;}}if(_0x45936c>0x0){if(_0x367fe7[_0x4edd('0x5e')]===_0x4edd('0x7')){_0x45936c=0x1;}if(_0x45936c>this[_0x4edd('0x26')]){_0x45936c=this[_0x4edd('0x26')];}_0x367fe7[_0x4edd('0xc6')]+=_0x45936c;for(var _0x11d64a in this[_0x4edd('0x24')]){if(typeof this[_0x4edd('0x24')][_0x11d64a]!==_0x4edd('0x9b')){if(this['agents'][_0x11d64a][_0x4edd('0xab')]==='not_inuse'&&this[_0x4edd('0x24')][_0x11d64a]['status']===_0x4edd('0xdc')){_0x23584c[_0x4edd('0x14e')](this[_0x4edd('0x24')][_0x11d64a]['id']);}}}this[_0x4edd('0xc5')](_0x367fe7['id'],_0x23584c,_0x45936c,_0x367fe7['dialOrderByScheduledAt'],_0x367fe7)['then'](function(_0x27b8bf){_0x367fe7['temp']-=_0x45936c;_0x367fe7[_0x4edd('0xc6')]=_0x367fe7['temp']>0x0?_0x367fe7[_0x4edd('0xc6')]:0x0;if(!checkContactEmpty(_0x27b8bf)){_0x3e2940[_0x4edd('0xb8')](_0x367fe7)[_0x4edd('0x40')](sendMessageReschedule(_0x367fe7))['catch'](loggerCatch(_0x4edd('0xba')));}else{_0x367fe7[_0x4edd('0x72')]+=_0x27b8bf['length'];_0x367fe7[_0x4edd('0x42')]=_0x367fe7[_0x4edd('0x5e')]===_0x4edd('0x7')?_0x4edd('0x174'):'RUNNING';for(var _0x168d2e=0x0;_0x168d2e<_0x27b8bf[_0x4edd('0x9a')];_0x168d2e+=0x1){if(_[_0x4edd('0xb2')](_0x27b8bf[_0x168d2e])||_['isNil'](_0x27b8bf[_0x168d2e][_0x4edd('0x16e')])||_['isNil'](_0x27b8bf[_0x168d2e][_0x4edd('0x16e')][_0x4edd('0x16f')])){_0x3e2940[_0x4edd('0xd1')](_0x4edd('0x20a'),_0x367fe7,_0x27b8bf[_0x168d2e]);}else{_0x3e2940[_0x4edd('0xbb')](_[_0x4edd('0xd3')](_0x27b8bf[_0x168d2e],[_0x4edd('0xd6'),'Contact.phone']))[_0x4edd('0x40')](_0x3e2940['checkContactBlack'](_0x367fe7,_0x27b8bf[_0x168d2e]))['catch'](_0x3e2940[_0x4edd('0xd0')](_0x4edd('0x20a'),_0x367fe7));}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x367fe7,_0x45936c));}};Dialer['prototype'][_0x4edd('0x92')]=function(_0x5689c5){if(_0x5689c5[_0x4edd('0x20e')]>0x0){var _0x2c9ebe=_0x5689c5[_0x4edd('0x20e')]-_0x5689c5[_0x4edd('0x72')]-_0x5689c5['talking'];if(_0x2c9ebe>0x0){this[_0x4edd('0x20f')](_0x5689c5);}else{loggerPredictiveCalls['info'](_0x4edd('0x210'));}}else{this[_0x4edd('0x20f')](_0x5689c5);}};Dialer[_0x4edd('0x1d')][_0x4edd('0x20f')]=function(_0x561237){var _0xf4f5d0=this;var _0x34610c=[];_0x561237[_0x4edd('0x72')]+=0x1;for(var _0x3f203c in this[_0x4edd('0x24')]){if(typeof this[_0x4edd('0x24')][_0x3f203c]!==_0x4edd('0x9b')){if(this['agents'][_0x3f203c][_0x4edd('0xab')]===_0x4edd('0x211')&&this['agents'][_0x3f203c][_0x4edd('0xdb')]===_0x4edd('0xdc')){_0x34610c[_0x4edd('0x14e')](this[_0x4edd('0x24')][_0x3f203c]['id']);}}}this[_0x4edd('0xc5')](_0x561237['id'],_0x34610c,0x1,_0x561237[_0x4edd('0x207')],_0x561237)['then'](function(_0x18b897){if(!checkContactEmpty(_0x18b897)){checkContactLowerLimitOriginate(_0x561237,0x1,0x0);_0xf4f5d0[_0x4edd('0xb8')](_0x561237)['then'](sendMessageReschedule(_0x561237))[_0x4edd('0xb4')](loggerCatch(_0x4edd('0xba')));}else{_0x561237['message']='RUNNING';if(_[_0x4edd('0xb2')](_0x18b897[0x0])||_['isNil'](_0x18b897[0x0]['Contact'])||_[_0x4edd('0xb2')](_0x18b897[0x0]['Contact']['phone'])){_0xf4f5d0['emptyContact'](_0x4edd('0x20a'),_0x561237,_0x18b897[0x0]);}else{_0xf4f5d0[_0x4edd('0xbb')](_[_0x4edd('0xd3')](_0x18b897[0x0],[_0x4edd('0xd6'),_0x4edd('0x20b')]))[_0x4edd('0x40')](_0xf4f5d0['checkContactBlack'](_0x561237,_0x18b897[0x0]))[_0x4edd('0xb4')](_0xf4f5d0['loggerHandler'](_0x4edd('0x212'),_0x561237));}}})[_0x4edd('0xb4')](loggerGetContactDialer(_0x4edd('0x213'),_0x561237,0x1));emitVoiceQueueSummary(_0x561237);};Dialer[_0x4edd('0x1d')][_0x4edd('0x1e7')]=function(_0x4a352f,_0xcb8af3,_0xe688,_0x5e0e4d,_0x138e97,_0x791d6d){loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x214'));loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x215'),_0x4a352f);loggerPredictive[_0x4edd('0x7e')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xcb8af3);loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x216'),_0xe688);loggerPredictive[_0x4edd('0x7e')]('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',_0x5e0e4d);loggerPredictive['info'](_0x4edd('0x217'),_0x138e97);loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x86'));return new BPromise(function(_0x317995,_0x5d460d){if(_0x4a352f<=0x0||isNaN(_0x4a352f)){return _0x5d460d(msgResponse(_0x4edd('0x218'),_0x4edd('0x4e'),_0x4edd('0x219')+_0x4a352f));}if(_0xe688<=0x0||isNaN(_0xe688)){return _0x5d460d(msgResponse(_0x4edd('0x218'),'Error',_0x4edd('0x21a')+_0xe688));}if(_0x5e0e4d<=0x0||isNaN(_0x5e0e4d)){return _0x5d460d(msgResponse(_0x4edd('0x218'),_0x4edd('0x4e'),_0x4edd('0x21b')+_0x5e0e4d));}if(_0xcb8af3<=0x0||isNaN(_0xcb8af3)){return _0x5d460d(msgResponse(_0x4edd('0x218'),_0x4edd('0x4e'),_0x4edd('0x21c')+_0xcb8af3));}if(_0x138e97<=0x0||isNaN(_0x138e97)){return _0x5d460d(msgResponse('[abandonmentRate]',_0x4edd('0x4e'),'Amax\x20=\x20'+_0x138e97));}_0x791d6d=_0x791d6d||0x0;var _0x4a1b2d=0x1/_0xe688;var _0x4ff419=0x0;var _0x52ff35=0x0;var _0x38a076=0x0;var _0x21e76d=0x0;for(var _0x151999=0x0;_0x38a076<_0x138e97;_0x151999+=0x1){_0x52ff35=_0x151999/_0xcb8af3;_0x4ff419=(_0x5e0e4d*_0x52ff35+_0x791d6d)/_0x4a1b2d;_0x38a076=erlangb(_0x4ff419,_0x4a352f);_0x21e76d=_0x4ff419/_0x4a352f*(0x1-erlangb(_0x4ff419,_0x4a352f));}return _0x317995({'erlangCalls':_0x151999,'erlangCallToSecond':_0xcb8af3/_0x151999,'erlangAbandonmentRate':_0x38a076,'erlangBusyFactor':_0x21e76d});});};Dialer[_0x4edd('0x1d')]['busyFactor']=function(_0x538026,_0x3f8f8c,_0x2cb4c3,_0xe2bd40,_0x338577,_0x23fe18){loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x21d'));loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x215'),_0x538026);loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x21e'),_0x3f8f8c);loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x216'),_0x2cb4c3);loggerPredictive['info'](_0x4edd('0x21f'),_0xe2bd40);loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x220'),_0x338577);loggerPredictive[_0x4edd('0x7e')](_0x4edd('0x86'));return new BPromise(function(_0x4e686a,_0x14b48d){if(_0x538026<=0x0||isNaN(_0x538026)){return _0x14b48d(msgResponse(_0x4edd('0x221'),'Error','m\x20=\x20'+_0x538026));}if(_0x2cb4c3<=0x0||isNaN(_0x2cb4c3)){return _0x14b48d(msgResponse(_0x4edd('0x221'),'Error','Ts\x20=\x20'+_0x2cb4c3));}if(_0xe2bd40<=0x0||isNaN(_0xe2bd40)){return _0x14b48d(msgResponse('[busyFactor]',_0x4edd('0x4e'),_0x4edd('0x21b')+_0xe2bd40));}if(_0x3f8f8c<=0x0||isNaN(_0x3f8f8c)){return _0x14b48d(msgResponse(_0x4edd('0x221'),_0x4edd('0x4e'),_0x4edd('0x21c')+_0x3f8f8c));}if(_0x338577<=0x0||isNaN(_0x338577)){return _0x14b48d(msgResponse(_0x4edd('0x221'),'Error','Umin\x20=\x20'+_0x338577));}_0x23fe18=_0x23fe18||0x0;var _0x511b57=0x1/_0x2cb4c3;var _0x32868d=0x0;var _0x2bec9a=0x0;var _0x47edec=0x0;var _0x28db95=0x0;for(var _0x245840=0x0;_0x28db95<_0x338577;_0x245840+=0x1){_0x2bec9a=_0x245840/_0x3f8f8c;_0x32868d=(_0xe2bd40*_0x2bec9a+_0x23fe18)/_0x511b57;_0x47edec=erlangb(_0x32868d,_0x538026);_0x28db95=_0x32868d/_0x538026*(0x1-erlangb(_0x32868d,_0x538026));}return _0x4e686a({'erlangCalls':_0x245840,'erlangCallToSecond':_0x3f8f8c/_0x245840,'erlangAbandonmentRate':_0x47edec,'erlangBusyFactor':_0x28db95});});};module[_0x4edd('0x222')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index c138581..13fc112 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 _0x0355=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','holdtime','talktime','membername','reason','callback','callbackuniqueid','recallme','ContactId'];(function(_0x330b68,_0x2c9721){var _0x461d19=function(_0x3d5c5f){while(--_0x3d5c5f){_0x330b68['push'](_0x330b68['shift']());}};_0x461d19(++_0x2c9721);}(_0x0355,0xca));var _0x5035=function(_0xb3a764,_0x22fdc0){_0xb3a764=_0xb3a764-0x0;var _0x2de877=_0x0355[_0xb3a764];return _0x2de877;};'use strict';var util=require(_0x5035('0x0'));var _=require(_0x5035('0x1'));var moment=require(_0x5035('0x2'));function getSeconds(_0x214940,_0x3c30de){var _0x32878b=moment(_0x214940)['milliseconds'](0x0);var _0x13e42c=moment(_0x3c30de)['milliseconds'](0x0);return _0x32878b['diff'](_0x13e42c,'seconds');}function QueueCallerAbandon(_0x286be3,_0x5ca8b8){this['scheduledat']=_0x286be3['scheduledat'];this[_0x5035('0x3')]=_0x286be3[_0x5035('0x3')];this[_0x5035('0x4')]=_0x286be3['type']===_0x5035('0x5')?_0x5035('0x6'):_0x286be3['type'];this[_0x5035('0x7')]=_0x286be3[_0x5035('0x7')];this[_0x5035('0x8')]=_0x286be3[_0x5035('0x8')];this[_0x5035('0x9')]=_0x286be3[_0x5035('0x9')];this[_0x5035('0xa')]=_0x286be3['countbusyretry']+_0x286be3[_0x5035('0x8')]+_0x286be3[_0x5035('0x9')]+_0x286be3[_0x5035('0xb')]+_0x286be3[_0x5035('0xc')]+_0x286be3[_0x5035('0xd')]+_0x286be3[_0x5035('0xe')]+_0x286be3[_0x5035('0xf')];this[_0x5035('0xb')]=_0x286be3['countnosuchnumberretry'];this[_0x5035('0xc')]=_0x286be3['countdropretry'];this['countabandonedretry']=_0x286be3[_0x5035('0xd')];this[_0x5035('0xe')]=_0x286be3[_0x5035('0xe')];this[_0x5035('0xf')]=_0x286be3[_0x5035('0xf')];this[_0x5035('0x10')]=_0x5ca8b8[_0x5035('0x10')];this[_0x5035('0x11')]=_0x286be3[_0x5035('0x12')];this[_0x5035('0x13')]=_0x286be3[_0x5035('0x14')];this[_0x5035('0x15')]=_0x286be3[_0x5035('0x15')];this[_0x5035('0x16')]=_0x286be3['responsetime'];this['droptime']=_0x286be3[_0x5035('0x17')];this['endtime']=this[_0x5035('0x17')];this['ringtime']=getSeconds(_0x286be3['responsetime'],_0x286be3[_0x5035('0x15')]);this[_0x5035('0x18')]=getSeconds(this[_0x5035('0x17')],_0x286be3[_0x5035('0x16')]);this[_0x5035('0x19')]=0x0;this[_0x5035('0x6')]=_0x5ca8b8[_0x5035('0x6')];this[_0x5035('0x1a')]=_0x5ca8b8['connectedlinename'];this['reason']=_0x5ca8b8[_0x5035('0x1b')];this['callback']=_0x286be3[_0x5035('0x1c')];this[_0x5035('0x1d')]=_0x286be3[_0x5035('0x1d')];this['callbackat']=_0x286be3['callbackat'];this[_0x5035('0x1e')]=_0x286be3[_0x5035('0x1e')];this[_0x5035('0x1f')]=_0x286be3[_0x5035('0x1f')];this[_0x5035('0x20')]=_0x286be3[_0x5035('0x20')];this[_0x5035('0x21')]=_0x286be3[_0x5035('0x21')];this['VoiceQueueId']=_0x286be3[_0x5035('0x22')];this[_0x5035('0x23')]=_0x286be3[_0x5035('0x23')];this['originatecalleridnum']=_0x286be3[_0x5035('0x24')]||'';this['originatecalleridname']=_0x286be3[_0x5035('0x25')]||'';}module[_0x5035('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0x4512=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','talktime','membername','reason','callback','callbackuniqueid'];(function(_0x56683c,_0x4337d2){var _0x14ebf3=function(_0x56b1e3){while(--_0x56b1e3){_0x56683c['push'](_0x56683c['shift']());}};_0x14ebf3(++_0x4337d2);}(_0x4512,0xa2));var _0x2451=function(_0x43a6cd,_0x503d1a){_0x43a6cd=_0x43a6cd-0x0;var _0x5acb36=_0x4512[_0x43a6cd];return _0x5acb36;};'use strict';var util=require('util');var _=require(_0x2451('0x0'));var moment=require(_0x2451('0x1'));function getSeconds(_0x5a5467,_0xdd3d79){var _0x55ac23=moment(_0x5a5467)[_0x2451('0x2')](0x0);var _0x27af56=moment(_0xdd3d79)[_0x2451('0x2')](0x0);return _0x55ac23[_0x2451('0x3')](_0x27af56,_0x2451('0x4'));}function QueueCallerAbandon(_0x122b19,_0x5afc2a){this['scheduledat']=_0x122b19['scheduledat'];this[_0x2451('0x5')]=_0x122b19['type'];this['campaigntype']=_0x122b19['type']===_0x2451('0x6')?_0x2451('0x7'):_0x122b19[_0x2451('0x5')];this[_0x2451('0x8')]=_0x122b19[_0x2451('0x8')];this[_0x2451('0x9')]=_0x122b19['countcongestionretry'];this[_0x2451('0xa')]=_0x122b19[_0x2451('0xa')];this['countglobal']=_0x122b19['countbusyretry']+_0x122b19[_0x2451('0x9')]+_0x122b19[_0x2451('0xa')]+_0x122b19[_0x2451('0xb')]+_0x122b19[_0x2451('0xc')]+_0x122b19[_0x2451('0xd')]+_0x122b19[_0x2451('0xe')]+_0x122b19['countagentrejectretry'];this['countnosuchnumberretry']=_0x122b19['countnosuchnumberretry'];this[_0x2451('0xc')]=_0x122b19[_0x2451('0xc')];this[_0x2451('0xd')]=_0x122b19[_0x2451('0xd')];this[_0x2451('0xe')]=_0x122b19[_0x2451('0xe')];this[_0x2451('0xf')]=_0x122b19['countagentrejectretry'];this[_0x2451('0x10')]=_0x5afc2a[_0x2451('0x10')];this[_0x2451('0x11')]=_0x122b19[_0x2451('0x12')];this[_0x2451('0x13')]=_0x122b19['number'];this[_0x2451('0x14')]=_0x122b19[_0x2451('0x14')];this[_0x2451('0x15')]=_0x122b19[_0x2451('0x15')];this['droptime']=_0x122b19[_0x2451('0x16')];this['endtime']=this[_0x2451('0x16')];this['ringtime']=getSeconds(_0x122b19[_0x2451('0x15')],_0x122b19[_0x2451('0x14')]);this['holdtime']=getSeconds(this[_0x2451('0x16')],_0x122b19[_0x2451('0x15')]);this[_0x2451('0x17')]=0x0;this[_0x2451('0x7')]=_0x5afc2a[_0x2451('0x7')];this[_0x2451('0x18')]=_0x5afc2a['connectedlinename'];this[_0x2451('0x19')]=_0x5afc2a['reason'];this[_0x2451('0x1a')]=_0x122b19['callback'];this[_0x2451('0x1b')]=_0x122b19[_0x2451('0x1b')];this[_0x2451('0x1c')]=_0x122b19['callbackat'];this[_0x2451('0x1d')]=_0x122b19[_0x2451('0x1d')];this['ContactId']=_0x122b19[_0x2451('0x1e')];this[_0x2451('0x1f')]=_0x122b19['ListId'];this[_0x2451('0x20')]=_0x122b19['UserId'];this[_0x2451('0x21')]=_0x122b19['VoiceQueueId'];this[_0x2451('0x22')]=_0x122b19['CampaignId'];this[_0x2451('0x23')]=_0x122b19[_0x2451('0x23')]||'';this['originatecalleridname']=_0x122b19[_0x2451('0x24')]||'';}module[_0x2451('0x25')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 1abc988..5341afc 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(_0x252185,_0x58e0b7){var _0x767931=function(_0x43dfd6){while(--_0x43dfd6){_0x252185['push'](_0x252185['shift']());}};_0x767931(++_0x58e0b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x59a549,_0x2fe2bb){var _0x12adbe=function(_0x2ccd1e){while(--_0x2ccd1e){_0x59a549['push'](_0x59a549['shift']());}};_0x12adbe(++_0x2fe2bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 65f498d..a8ee6bb 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 _0x1d2d=['Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','tiff2pdf','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','message','create','parse','.pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','update','AttachmentId','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','execOriginate','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','dir','path','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active'];(function(_0x5dd028,_0x1fdb03){var _0x3f27ef=function(_0x49312a){while(--_0x49312a){_0x5dd028['push'](_0x5dd028['shift']());}};_0x3f27ef(++_0x1fdb03);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x5cf166,_0x1f8768){_0x5cf166=_0x5cf166-0x0;var _0x339932=_0x1d2d[_0x5cf166];return _0x339932;};'use strict';var util=require(_0xd1d2('0x0'));var _=require(_0xd1d2('0x1'));var BPromise=require(_0xd1d2('0x2'));var uuid=require(_0xd1d2('0x3'));var moment=require(_0xd1d2('0x4'));var path=require('path');var tiff2pdf=require(_0xd1d2('0x5'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0xd1d2('0x6'));var ami=require(_0xd1d2('0x7'));var rpcDb=require(_0xd1d2('0x8'));var Channel=require(_0xd1d2('0x9'));var ut=require(_0xd1d2('0xa'));var Action=require(_0xd1d2('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xd1d2('0xc'));var faxMessage=require(_0xd1d2('0xd'));function Fax(_0x35735f){this[_0xd1d2('0xe')]={};this[_0xd1d2('0xf')]=_0x35735f[_0xd1d2('0xf')];this[_0xd1d2('0x10')]=_0x35735f[_0xd1d2('0x10')];this[_0xd1d2('0x11')]={};ami['on'](_0xd1d2('0x12'),this[_0xd1d2('0x13')][_0xd1d2('0x14')](this));ami['on'](_0xd1d2('0x15'),this['syncVarSet'][_0xd1d2('0x14')](this));ami['on'](_0xd1d2('0x16'),this[_0xd1d2('0x17')][_0xd1d2('0x14')](this));ami['on'](_0xd1d2('0x18'),this[_0xd1d2('0x19')][_0xd1d2('0x14')](this));ami['on'](_0xd1d2('0x1a'),this[_0xd1d2('0x1b')][_0xd1d2('0x14')](this));ami['on']('receivefax',this[_0xd1d2('0x1c')][_0xd1d2('0x14')](this));ami['on'](_0xd1d2('0x1d'),this['syncHangup'][_0xd1d2('0x14')](this));ami['on'](_0xd1d2('0x1e'),this[_0xd1d2('0x1f')][_0xd1d2('0x14')](this));}Fax[_0xd1d2('0x20')][_0xd1d2('0x13')]=function(_0x275996){if(_0x275996['context']==='from-voip-provider'){for(var _0x3be186 in this['faxAccounts']){if(this[_0xd1d2('0xf')][_0xd1d2('0x21')](_0x3be186)){if(_0x275996[_0xd1d2('0x22')]===this[_0xd1d2('0xf')][_0x3be186]['localstationid']){this['channels'][_0x275996[_0xd1d2('0x23')]]={};this['channels'][_0x275996['uniqueid']][_0xd1d2('0x24')]=_0x275996[_0xd1d2('0x24')];this[_0xd1d2('0xe')][_0x275996[_0xd1d2('0x23')]]['id']=this['faxAccounts'][_0x3be186]['id'];this[_0xd1d2('0xe')][_0x275996[_0xd1d2('0x23')]][_0xd1d2('0x25')]=this['faxAccounts'][_0x3be186]['name'];logger[_0xd1d2('0x26')](_0x275996[_0xd1d2('0x23')],_0xd1d2('0x27'));}}}}if(this[_0xd1d2('0x11')][_0x275996[_0xd1d2('0x23')]]){this[_0xd1d2('0xe')][_0x275996[_0xd1d2('0x23')]]={};this['channels'][_0x275996[_0xd1d2('0x23')]][_0xd1d2('0x24')]=_0x275996[_0xd1d2('0x24')];logger[_0xd1d2('0x26')](_0x275996[_0xd1d2('0x23')],_0xd1d2('0x27'));}};Fax[_0xd1d2('0x20')][_0xd1d2('0x28')]=function(_0xe6ef3c){if(this[_0xd1d2('0xe')][_0xe6ef3c[_0xd1d2('0x23')]]){for(var _0x4e1bc2 in _0xe6ef3c['variable']){if(_0xe6ef3c[_0xd1d2('0x29')][_0xd1d2('0x21')](_0x4e1bc2)){this[_0xd1d2('0xe')][_0xe6ef3c[_0xd1d2('0x23')]][_0x4e1bc2]=_0xe6ef3c[_0xd1d2('0x2a')];}}}};Fax['prototype'][_0xd1d2('0x17')]=function(_0x41171c){if(this[_0xd1d2('0xe')][_0x41171c['uniqueid']]){this[_0xd1d2('0xe')][_0x41171c[_0xd1d2('0x23')]][_0xd1d2('0x2b')]=_0x41171c['channelstate'];this[_0xd1d2('0xe')][_0x41171c[_0xd1d2('0x23')]][_0xd1d2('0x2c')]=_0x41171c[_0xd1d2('0x2c')];}};Fax[_0xd1d2('0x20')][_0xd1d2('0x19')]=function(_0x42e89d){if(this[_0xd1d2('0xe')][_0x42e89d[_0xd1d2('0x23')]]){for(var _0x4501b6 in _0x42e89d[_0xd1d2('0x29')]){if(_0x42e89d[_0xd1d2('0x29')][_0xd1d2('0x21')](_0x4501b6)){this[_0xd1d2('0xe')][_0x42e89d[_0xd1d2('0x23')]][_0x4501b6]=_0x42e89d[_0xd1d2('0x2a')];}}}};Fax[_0xd1d2('0x20')][_0xd1d2('0x1b')]=function(_0x5c7efd){if(this[_0xd1d2('0xe')][_0x5c7efd[_0xd1d2('0x23')]]){this[_0xd1d2('0xe')][_0x5c7efd['uniqueid']][_0xd1d2('0x2d')]=_0x5c7efd['operation'];this['channels'][_0x5c7efd[_0xd1d2('0x23')]][_0xd1d2('0x2e')]=_0x5c7efd[_0xd1d2('0x2e')];this[_0xd1d2('0xe')][_0x5c7efd[_0xd1d2('0x23')]][_0xd1d2('0x2f')]=_0x5c7efd['localstationid'];this[_0xd1d2('0xe')][_0x5c7efd[_0xd1d2('0x23')]]['filename']=_0x5c7efd[_0xd1d2('0x30')];logger[_0xd1d2('0x26')](_0x5c7efd[_0xd1d2('0x23')],_0xd1d2('0x31'));}};Fax['prototype']['syncReceiveFax']=function(_0x2fd2c5){var _0x54fbbb=this;if(this['channels'][_0x2fd2c5['uniqueid']]){var _0x43e70f=this['channels'][_0x2fd2c5[_0xd1d2('0x23')]]['id'];this['channels'][_0x2fd2c5['uniqueid']]['remotestationid']=_0x2fd2c5[_0xd1d2('0x32')];this[_0xd1d2('0xe')][_0x2fd2c5[_0xd1d2('0x23')]][_0xd1d2('0x33')]=_0x2fd2c5[_0xd1d2('0x33')];this[_0xd1d2('0xe')][_0x2fd2c5[_0xd1d2('0x23')]][_0xd1d2('0x2f')]=_0x2fd2c5[_0xd1d2('0x2f')];this[_0xd1d2('0xe')][_0x2fd2c5[_0xd1d2('0x23')]][_0xd1d2('0x34')]=_0x2fd2c5[_0xd1d2('0x34')];this[_0xd1d2('0xe')][_0x2fd2c5['uniqueid']]['transferrate']=_0x2fd2c5[_0xd1d2('0x35')];this[_0xd1d2('0xe')][_0x2fd2c5[_0xd1d2('0x23')]]['filename']=_0x2fd2c5['filename'];this[_0xd1d2('0xe')][_0x2fd2c5[_0xd1d2('0x23')]]['calleridnum']=_0x2fd2c5[_0xd1d2('0x36')];if(this['channels'][_0x2fd2c5['uniqueid']][_0xd1d2('0x33')]>0x0){tiff2pdf(_0x2fd2c5['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x1825f2){logger[_0xd1d2('0x26')](_0x2fd2c5[_0xd1d2('0x23')],'\x20result\x20conversion\x20file\x20',_0x1825f2[_0xd1d2('0x37')]);attachment[_0xd1d2('0x38')]({'name':path[_0xd1d2('0x39')](_0x2fd2c5[_0xd1d2('0x30')])['name'],'basename':path[_0xd1d2('0x39')](_0x2fd2c5[_0xd1d2('0x30')])['name']+_0xd1d2('0x3a'),'type':'application/pdf'})[_0xd1d2('0x3b')](function(_0xd56adb){faxAccount[_0xd1d2('0x3c')](_0x43e70f,{'from':_0x2fd2c5[_0xd1d2('0x36')],'mapKey':_0xd1d2('0x6'),'body':path['parse'](_0x2fd2c5['filename'])[_0xd1d2('0x25')]+_0xd1d2('0x3a'),'AttachmentId':_0xd56adb['id']})['catch'](function(_0xa4c11d){logger[_0xd1d2('0x3d')](_0x2fd2c5[_0xd1d2('0x23')],_0xd1d2('0x3e'),JSON[_0xd1d2('0x3f')](_0xa4c11d));});})[_0xd1d2('0x40')](function(_0x112d67){logger['error'](_0x2fd2c5[_0xd1d2('0x23')],_0xd1d2('0x41'),JSON['stringify'](_0x112d67));});});}logger[_0xd1d2('0x26')](_0x2fd2c5[_0xd1d2('0x23')],'\x20receiveFax\x20');}};Fax['prototype'][_0xd1d2('0x1f')]=function(_0x182ea8){if(this['actions'][_0x182ea8[_0xd1d2('0x23')]]){_[_0xd1d2('0x42')](this[_0xd1d2('0xe')][_0x182ea8[_0xd1d2('0x23')]],_[_0xd1d2('0x43')](_0x182ea8,['response','reason']));}};function updateStatus(_0x314af3){if(_0x314af3['AttachmentId']){faxMessage[_0xd1d2('0x44')](_0x314af3[_0xd1d2('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xd1d2('0x3b')](function(_0x35d724){ut['logger']('[Fax][Message][Error][Updated]',_0x35d724);})[_0xd1d2('0x40')](function(_0x20ab8b){ut[_0xd1d2('0x46')](_0xd1d2('0x47'),_0x20ab8b);});}else{ut[_0xd1d2('0x46')](_0xd1d2('0x48'));}}Fax[_0xd1d2('0x20')][_0xd1d2('0x49')]=function(_0x33e332,_0x5e15cb,_0x1958f3){var _0x530db0=this;var _0x55c44f={};if(_0x5e15cb){_0x55c44f={'read':_0x5e15cb};}else{_0x55c44f={'failMessage':_0x1958f3};}if(this[_0xd1d2('0x11')][_0x33e332][_0xd1d2('0x45')]){faxMessage[_0xd1d2('0x44')](this[_0xd1d2('0x11')][_0x33e332][_0xd1d2('0x45')],_0x55c44f)[_0xd1d2('0x3b')](function(_0x35a51b){ut[_0xd1d2('0x46')](_0xd1d2('0x4a'),_0x35a51b);})[_0xd1d2('0x40')](function(_0x28173a){ut[_0xd1d2('0x46')](_0xd1d2('0x4b'),_0x28173a);})['finally'](function(){delete _0x530db0['channels'][_0x33e332];delete _0x530db0[_0xd1d2('0x11')][_0x33e332];});}else{ut[_0xd1d2('0x46')](_0xd1d2('0x4c'));delete this[_0xd1d2('0xe')][_0x33e332];delete this[_0xd1d2('0x11')][_0x33e332];}};Fax[_0xd1d2('0x20')][_0xd1d2('0x4d')]=function(_0x278a2a){var _0x3e22d2=this;if(this[_0xd1d2('0xe')][_0x278a2a[_0xd1d2('0x23')]]){if(this['actions'][_0x278a2a['uniqueid']]){this[_0xd1d2('0xe')][_0x278a2a[_0xd1d2('0x23')]]['id']=this[_0xd1d2('0x11')][_0x278a2a[_0xd1d2('0x23')]]['id'];this['channels'][_0x278a2a[_0xd1d2('0x23')]][_0xd1d2('0x25')]=this[_0xd1d2('0x11')][_0x278a2a[_0xd1d2('0x23')]][_0xd1d2('0x25')];}logger[_0xd1d2('0x26')](_0x278a2a[_0xd1d2('0x23')],this['actions'][_0x278a2a[_0xd1d2('0x23')]]?_0xd1d2('0x4e'):_0xd1d2('0x4f'),JSON['stringify'](this['channels'][_0x278a2a[_0xd1d2('0x23')]]));if(this[_0xd1d2('0x11')][_0x278a2a[_0xd1d2('0x23')]]){if(this[_0xd1d2('0xe')][_0x278a2a['uniqueid']][_0xd1d2('0x50')]>0x0&&this[_0xd1d2('0xe')][_0x278a2a[_0xd1d2('0x23')]]['faxstatus']===_0xd1d2('0x51')){this[_0xd1d2('0x49')](_0x278a2a['uniqueid'],!![]);}else{this[_0xd1d2('0x49')](_0x278a2a[_0xd1d2('0x23')],![],this[_0xd1d2('0xe')][_0x278a2a[_0xd1d2('0x23')]]['faxstatusstring']?_0xd1d2('0x52')+this[_0xd1d2('0xe')][_0x278a2a[_0xd1d2('0x23')]][_0xd1d2('0x53')]:_0xd1d2('0x54'));}}}};Fax['prototype']['send']=function(_0x500465){var _0x541676=this;return new BPromise(function(_0x59ca94,_0x105850){_0x541676[_0xd1d2('0x55')](_0x500465,_0x541676[_0xd1d2('0xf')][_0x500465['FaxAccountId']])[_0xd1d2('0x3b')](function(_0x17c4eb){ut[_0xd1d2('0x46')]('[Fax][execOriginate][success]',_0x17c4eb);_0x59ca94(ut[_0xd1d2('0x37')](_0xd1d2('0x56')));})[_0xd1d2('0x40')](function(_0x4a42d9){ut[_0xd1d2('0x46')](_0xd1d2('0x57'),_0x4a42d9);updateStatus(_0x500465);_0x105850(ut['message'](_0xd1d2('0x58')));});});};Fax[_0xd1d2('0x20')]['checkAfterSend']=function(_0x530335){var _0x21bfd4=this;return new BPromise(function(_0x1ea57a,_0x34877f){var _0x14cd07=_0x21bfd4['checkTrunk'](_0x21bfd4[_0xd1d2('0xf')][_0x530335[_0xd1d2('0x59')]][_0xd1d2('0x5a')],_0x530335);if(_0x14cd07[_0xd1d2('0x5b')]){_0x1ea57a(ut['message'](_0xd1d2('0x5c')));}else{_0x34877f(ut[_0xd1d2('0x37')](_0x14cd07[_0xd1d2('0x37')]));}});};function originate(_0x572b55,_0x46ff4d,_0x1ae9af){return new BPromise(function(_0x4c35cb,_0x2175ab){if(_0x1ae9af){var _0x32ae30=util[_0xd1d2('0x5d')](_0xd1d2('0x5e'),path[_0xd1d2('0x39')](_0x572b55['path'])[_0xd1d2('0x25')],_0x572b55['path']);gs['execute'](_0x32ae30)['then'](function(){_0x572b55['path']=util[_0xd1d2('0x5d')]('%s/%s.tif',path[_0xd1d2('0x39')](_0x572b55['path'])[_0xd1d2('0x5f')],path[_0xd1d2('0x39')](_0x572b55[_0xd1d2('0x60')])[_0xd1d2('0x25')]);_0x46ff4d[_0xd1d2('0x61')]=_0x572b55[_0xd1d2('0x60')];ut['logger'](_0xd1d2('0x62'),'');ami[_0xd1d2('0x63')](ut[_0xd1d2('0x64')](_0x572b55,_0x46ff4d))[_0xd1d2('0x3b')](function(_0x448134){_0x4c35cb(_0x448134);})[_0xd1d2('0x40')](function(_0x2b6bd6){_0x2175ab(_0x2b6bd6);});})[_0xd1d2('0x40')](function(_0x3614dc){_0x2175ab(_0x3614dc);});}else{ami[_0xd1d2('0x63')](ut['variablesAction'](_0x572b55,_0x46ff4d))[_0xd1d2('0x3b')](function(_0x428200){_0x4c35cb(_0x428200);})[_0xd1d2('0x40')](function(_0x2eaf42){_0x2175ab(_0x2eaf42);});}});}Fax['prototype'][_0xd1d2('0x55')]=function(_0x28958d,_0xb7bf6a){var _0x56c005=this;return new BPromise(function(_0x2fffe5,_0x17af73){var _0x53b36d=uuid['v4']();var _0x566435=ut[_0xd1d2('0x65')](_0x28958d,_0xb7bf6a);_0x56c005[_0xd1d2('0x11')][_0x53b36d]=new Action(_0x53b36d,_0xb7bf6a,_0x28958d);var _0x3fbd87=_0x56c005[_0xd1d2('0x11')][_0x53b36d];if(path[_0xd1d2('0x39')](_0x28958d[_0xd1d2('0x60')])[_0xd1d2('0x66')]==='.pdf'){originate(_0x3fbd87,_0x566435,!![])[_0xd1d2('0x3b')](function(_0x9a98d4){_0x2fffe5(_0x9a98d4);})[_0xd1d2('0x40')](function(_0x24b8d1){_0x17af73(_0x24b8d1);});}else{originate(_0x3fbd87,_0x566435,![])[_0xd1d2('0x3b')](function(_0x123006){_0x2fffe5(_0x123006);})[_0xd1d2('0x40')](function(_0x3dbc87){_0x17af73(_0x3dbc87);});}});};Fax[_0xd1d2('0x20')][_0xd1d2('0x67')]=function(_0x2c3650){return!_[_0xd1d2('0x68')](_0x2c3650)&&!_[_0xd1d2('0x68')](_0x2c3650[_0xd1d2('0x25')])&&!_['isNil'](_0x2c3650[_0xd1d2('0x69')])&&_0x2c3650[_0xd1d2('0x69')]&&!_[_0xd1d2('0x68')](this[_0xd1d2('0x10')][util[_0xd1d2('0x5d')](_0xd1d2('0x6a'),_0x2c3650[_0xd1d2('0x25')])])&&!_[_0xd1d2('0x68')](this[_0xd1d2('0x10')][util[_0xd1d2('0x5d')](_0xd1d2('0x6a'),_0x2c3650[_0xd1d2('0x25')])][_0xd1d2('0x2e')])&&(this['trunks'][util[_0xd1d2('0x5d')](_0xd1d2('0x6a'),_0x2c3650[_0xd1d2('0x25')])][_0xd1d2('0x2e')]===_0xd1d2('0x6b')||this[_0xd1d2('0x10')][util[_0xd1d2('0x5d')](_0xd1d2('0x6a'),_0x2c3650[_0xd1d2('0x25')])][_0xd1d2('0x2e')]===_0xd1d2('0x6c'));};Fax[_0xd1d2('0x20')]['checkTrunk']=function(_0x46375e,_0x234262){if(!this[_0xd1d2('0x67')](_0x46375e)){ut[_0xd1d2('0x46')](_0xd1d2('0x6d'),_['isNil'](_0x46375e)?'':_0x46375e[_0xd1d2('0x25')]+_0xd1d2('0x6e'));return{'isValid':![],'message':_0xd1d2('0x6f')};}if(_[_0xd1d2('0x68')](_0x234262['fax'])){ut[_0xd1d2('0x46')](_0xd1d2('0x70'),JSON[_0xd1d2('0x3f')](_0x234262));return{'isValid':![],'message':_0xd1d2('0x71')};}if(_[_0xd1d2('0x68')](_0x234262[_0xd1d2('0x60')])){ut[_0xd1d2('0x46')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xd1d2('0x3f')](_0x234262));return{'isValid':![],'message':_0xd1d2('0x72')};}return{'isValid':!![],'message':_0xd1d2('0x73')};};module[_0xd1d2('0x74')]=Fax; \ No newline at end of file +var _0xb62e=['./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','syncNewExten','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','faxAccounts','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','application/pdf','then','notify','\x20notify\x20','catch','error','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','stringify','faxstatus','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0xb62e,0x1de));var _0xeb62=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb62e[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0xeb62('0x0'));var _=require(_0xeb62('0x1'));var BPromise=require(_0xeb62('0x2'));var uuid=require(_0xeb62('0x3'));var moment=require('moment');var path=require(_0xeb62('0x4'));var tiff2pdf=require(_0xeb62('0x5'));var gs=require(_0xeb62('0x6'));var logger=require(_0xeb62('0x7'))(_0xeb62('0x8'));var ami=require(_0xeb62('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0xeb62('0xa'));var ut=require(_0xeb62('0xb'));var Action=require(_0xeb62('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xeb62('0xd'));var faxMessage=require(_0xeb62('0xe'));function Fax(_0x1e10ae){this[_0xeb62('0xf')]={};this['faxAccounts']=_0x1e10ae['faxAccounts'];this[_0xeb62('0x10')]=_0x1e10ae[_0xeb62('0x10')];this[_0xeb62('0x11')]={};ami['on'](_0xeb62('0x12'),this[_0xeb62('0x13')][_0xeb62('0x14')](this));ami['on'](_0xeb62('0x15'),this[_0xeb62('0x16')][_0xeb62('0x14')](this));ami['on'](_0xeb62('0x17'),this['syncNewState'][_0xeb62('0x14')](this));ami['on'](_0xeb62('0x18'),this[_0xeb62('0x19')][_0xeb62('0x14')](this));ami['on']('faxstatus',this[_0xeb62('0x1a')][_0xeb62('0x14')](this));ami['on'](_0xeb62('0x1b'),this['syncReceiveFax'][_0xeb62('0x14')](this));ami['on'](_0xeb62('0x1c'),this[_0xeb62('0x1d')]['bind'](this));ami['on'](_0xeb62('0x1e'),this[_0xeb62('0x1f')][_0xeb62('0x14')](this));}Fax[_0xeb62('0x20')][_0xeb62('0x13')]=function(_0x370474){if(_0x370474[_0xeb62('0x21')]===_0xeb62('0x22')){for(var _0x39b138 in this[_0xeb62('0x23')]){if(this[_0xeb62('0x23')][_0xeb62('0x24')](_0x39b138)){if(_0x370474[_0xeb62('0x25')]===this['faxAccounts'][_0x39b138][_0xeb62('0x26')]){this[_0xeb62('0xf')][_0x370474[_0xeb62('0x27')]]={};this[_0xeb62('0xf')][_0x370474[_0xeb62('0x27')]][_0xeb62('0x28')]=_0x370474[_0xeb62('0x28')];this['channels'][_0x370474['uniqueid']]['id']=this[_0xeb62('0x23')][_0x39b138]['id'];this[_0xeb62('0xf')][_0x370474[_0xeb62('0x27')]][_0xeb62('0x29')]=this[_0xeb62('0x23')][_0x39b138]['name'];logger['info'](_0x370474[_0xeb62('0x27')],_0xeb62('0x2a'));}}}}if(this[_0xeb62('0x11')][_0x370474[_0xeb62('0x27')]]){this['channels'][_0x370474['uniqueid']]={};this[_0xeb62('0xf')][_0x370474['uniqueid']][_0xeb62('0x28')]=_0x370474['channel'];logger[_0xeb62('0x2b')](_0x370474['uniqueid'],_0xeb62('0x2a'));}};Fax[_0xeb62('0x20')][_0xeb62('0x16')]=function(_0x4e4268){if(this[_0xeb62('0xf')][_0x4e4268[_0xeb62('0x27')]]){for(var _0x5222f4 in _0x4e4268[_0xeb62('0x2c')]){if(_0x4e4268[_0xeb62('0x2c')][_0xeb62('0x24')](_0x5222f4)){this['channels'][_0x4e4268[_0xeb62('0x27')]][_0x5222f4]=_0x4e4268[_0xeb62('0x2d')];}}}};Fax['prototype'][_0xeb62('0x2e')]=function(_0x2b51b2){if(this[_0xeb62('0xf')][_0x2b51b2[_0xeb62('0x27')]]){this[_0xeb62('0xf')][_0x2b51b2['uniqueid']]['channelstate']=_0x2b51b2[_0xeb62('0x2f')];this[_0xeb62('0xf')][_0x2b51b2[_0xeb62('0x27')]][_0xeb62('0x30')]=_0x2b51b2[_0xeb62('0x30')];}};Fax[_0xeb62('0x20')][_0xeb62('0x19')]=function(_0x4be25d){if(this[_0xeb62('0xf')][_0x4be25d['uniqueid']]){for(var _0x555db1 in _0x4be25d[_0xeb62('0x2c')]){if(_0x4be25d[_0xeb62('0x2c')]['hasOwnProperty'](_0x555db1)){this[_0xeb62('0xf')][_0x4be25d['uniqueid']][_0x555db1]=_0x4be25d[_0xeb62('0x2d')];}}}};Fax[_0xeb62('0x20')]['syncFaxStatus']=function(_0x2c23c6){if(this[_0xeb62('0xf')][_0x2c23c6['uniqueid']]){this[_0xeb62('0xf')][_0x2c23c6[_0xeb62('0x27')]][_0xeb62('0x31')]=_0x2c23c6[_0xeb62('0x31')];this['channels'][_0x2c23c6[_0xeb62('0x27')]][_0xeb62('0x32')]=_0x2c23c6['status'];this['channels'][_0x2c23c6[_0xeb62('0x27')]][_0xeb62('0x26')]=_0x2c23c6['localstationid'];this[_0xeb62('0xf')][_0x2c23c6[_0xeb62('0x27')]][_0xeb62('0x33')]=_0x2c23c6[_0xeb62('0x33')];logger[_0xeb62('0x2b')](_0x2c23c6[_0xeb62('0x27')],_0xeb62('0x34'));}};Fax['prototype']['syncReceiveFax']=function(_0x3306e3){var _0x2bfa4c=this;if(this[_0xeb62('0xf')][_0x3306e3[_0xeb62('0x27')]]){var _0x4a544a=this[_0xeb62('0xf')][_0x3306e3['uniqueid']]['id'];this[_0xeb62('0xf')][_0x3306e3[_0xeb62('0x27')]][_0xeb62('0x35')]=_0x3306e3[_0xeb62('0x35')];this[_0xeb62('0xf')][_0x3306e3[_0xeb62('0x27')]][_0xeb62('0x36')]=_0x3306e3[_0xeb62('0x36')];this['channels'][_0x3306e3[_0xeb62('0x27')]][_0xeb62('0x26')]=_0x3306e3[_0xeb62('0x26')];this[_0xeb62('0xf')][_0x3306e3['uniqueid']]['resolution']=_0x3306e3[_0xeb62('0x37')];this[_0xeb62('0xf')][_0x3306e3['uniqueid']][_0xeb62('0x38')]=_0x3306e3[_0xeb62('0x38')];this['channels'][_0x3306e3[_0xeb62('0x27')]]['filename']=_0x3306e3[_0xeb62('0x33')];this['channels'][_0x3306e3[_0xeb62('0x27')]]['calleridnum']=_0x3306e3[_0xeb62('0x39')];if(this[_0xeb62('0xf')][_0x3306e3[_0xeb62('0x27')]]['pagestransferred']>0x0){tiff2pdf(_0x3306e3['filename'],_0xeb62('0x3a'),function(_0xc433d6){logger[_0xeb62('0x2b')](_0x3306e3[_0xeb62('0x27')],_0xeb62('0x3b'),_0xc433d6['message']);attachment[_0xeb62('0x3c')]({'name':path['parse'](_0x3306e3[_0xeb62('0x33')])['name'],'basename':path[_0xeb62('0x3d')](_0x3306e3['filename'])[_0xeb62('0x29')]+'.pdf','type':_0xeb62('0x3e')})[_0xeb62('0x3f')](function(_0x1aba15){faxAccount[_0xeb62('0x40')](_0x4a544a,{'from':_0x3306e3[_0xeb62('0x39')],'mapKey':_0xeb62('0x8'),'body':path['parse'](_0x3306e3[_0xeb62('0x33')])[_0xeb62('0x29')]+'.pdf','AttachmentId':_0x1aba15['id']})['catch'](function(_0x5c21da){logger['error'](_0x3306e3[_0xeb62('0x27')],_0xeb62('0x41'),JSON['stringify'](_0x5c21da));});})[_0xeb62('0x42')](function(_0x495618){logger[_0xeb62('0x43')](_0x3306e3[_0xeb62('0x27')],_0xeb62('0x44'),JSON['stringify'](_0x495618));});});}logger[_0xeb62('0x2b')](_0x3306e3['uniqueid'],_0xeb62('0x44'));}};Fax[_0xeb62('0x20')][_0xeb62('0x1f')]=function(_0x18c40d){if(this[_0xeb62('0x11')][_0x18c40d[_0xeb62('0x27')]]){_[_0xeb62('0x45')](this[_0xeb62('0xf')][_0x18c40d[_0xeb62('0x27')]],_[_0xeb62('0x46')](_0x18c40d,[_0xeb62('0x47'),_0xeb62('0x48')]));}};function updateStatus(_0x4c3b96){if(_0x4c3b96[_0xeb62('0x49')]){faxMessage['update'](_0x4c3b96['AttachmentId'],{'failMessage':_0xeb62('0x4a')})[_0xeb62('0x3f')](function(_0x482fae){ut[_0xeb62('0x4b')](_0xeb62('0x4c'),_0x482fae);})['catch'](function(_0x11297d){ut[_0xeb62('0x4b')](_0xeb62('0x4d'),_0x11297d);});}else{ut[_0xeb62('0x4b')](_0xeb62('0x4e'));}}Fax[_0xeb62('0x20')][_0xeb62('0x4f')]=function(_0x190e65,_0x497714,_0x3e2be9){var _0x5a01b7=this;var _0x35a2d6={};if(_0x497714){_0x35a2d6={'read':_0x497714};}else{_0x35a2d6={'failMessage':_0x3e2be9};}if(this[_0xeb62('0x11')][_0x190e65][_0xeb62('0x49')]){faxMessage[_0xeb62('0x50')](this[_0xeb62('0x11')][_0x190e65][_0xeb62('0x49')],_0x35a2d6)[_0xeb62('0x3f')](function(_0xf12d72){ut['logger']('[Fax][Message][Updated]',_0xf12d72);})['catch'](function(_0x5033eb){ut[_0xeb62('0x4b')]('[Fax][Message][NoUpdate1]',_0x5033eb);})[_0xeb62('0x51')](function(){delete _0x5a01b7['channels'][_0x190e65];delete _0x5a01b7[_0xeb62('0x11')][_0x190e65];});}else{ut[_0xeb62('0x4b')](_0xeb62('0x52'));delete this['channels'][_0x190e65];delete this[_0xeb62('0x11')][_0x190e65];}};Fax[_0xeb62('0x20')]['syncHangup']=function(_0x35982a){var _0x21b0aa=this;if(this[_0xeb62('0xf')][_0x35982a[_0xeb62('0x27')]]){if(this['actions'][_0x35982a[_0xeb62('0x27')]]){this[_0xeb62('0xf')][_0x35982a['uniqueid']]['id']=this[_0xeb62('0x11')][_0x35982a[_0xeb62('0x27')]]['id'];this[_0xeb62('0xf')][_0x35982a[_0xeb62('0x27')]][_0xeb62('0x29')]=this[_0xeb62('0x11')][_0x35982a[_0xeb62('0x27')]][_0xeb62('0x29')];}logger[_0xeb62('0x2b')](_0x35982a[_0xeb62('0x27')],this[_0xeb62('0x11')][_0x35982a[_0xeb62('0x27')]]?_0xeb62('0x53'):_0xeb62('0x54'),JSON[_0xeb62('0x55')](this[_0xeb62('0xf')][_0x35982a['uniqueid']]));if(this['actions'][_0x35982a['uniqueid']]){if(this['channels'][_0x35982a[_0xeb62('0x27')]]['faxpages']>0x0&&this[_0xeb62('0xf')][_0x35982a[_0xeb62('0x27')]][_0xeb62('0x56')]===_0xeb62('0x57')){this[_0xeb62('0x4f')](_0x35982a[_0xeb62('0x27')],!![]);}else{this[_0xeb62('0x4f')](_0x35982a[_0xeb62('0x27')],![],this[_0xeb62('0xf')][_0x35982a[_0xeb62('0x27')]]['faxstatusstring']?_0xeb62('0x58')+this[_0xeb62('0xf')][_0x35982a[_0xeb62('0x27')]][_0xeb62('0x59')]:'SENDING\x20FAILED');}}}};Fax[_0xeb62('0x20')][_0xeb62('0x5a')]=function(_0x3ff00a){var _0x2abd21=this;return new BPromise(function(_0x1dbf03,_0x1679a7){_0x2abd21[_0xeb62('0x5b')](_0x3ff00a,_0x2abd21[_0xeb62('0x23')][_0x3ff00a[_0xeb62('0x5c')]])[_0xeb62('0x3f')](function(_0x1d8675){ut['logger'](_0xeb62('0x5d'),_0x1d8675);_0x1dbf03(ut[_0xeb62('0x5e')](_0xeb62('0x5f')));})[_0xeb62('0x42')](function(_0x250294){ut[_0xeb62('0x4b')](_0xeb62('0x60'),_0x250294);updateStatus(_0x3ff00a);_0x1679a7(ut[_0xeb62('0x5e')](_0xeb62('0x61')));});});};Fax[_0xeb62('0x20')]['checkAfterSend']=function(_0x106b8d){var _0xedf007=this;return new BPromise(function(_0xd96bbc,_0xdd124f){var _0x546856=_0xedf007[_0xeb62('0x62')](_0xedf007[_0xeb62('0x23')][_0x106b8d[_0xeb62('0x5c')]][_0xeb62('0x63')],_0x106b8d);if(_0x546856[_0xeb62('0x64')]){_0xd96bbc(ut[_0xeb62('0x5e')]('Trunk\x20Reachable'));}else{_0xdd124f(ut[_0xeb62('0x5e')](_0x546856[_0xeb62('0x5e')]));}});};function originate(_0x347c55,_0x173c07,_0x351acf){return new BPromise(function(_0x28d0ff,_0x2e4502){if(_0x351acf){var _0x313d33=util[_0xeb62('0x65')](_0xeb62('0x66'),path[_0xeb62('0x3d')](_0x347c55[_0xeb62('0x4')])[_0xeb62('0x29')],_0x347c55[_0xeb62('0x4')]);gs[_0xeb62('0x67')](_0x313d33)[_0xeb62('0x3f')](function(){_0x347c55['path']=util[_0xeb62('0x65')]('%s/%s.tif',path[_0xeb62('0x3d')](_0x347c55[_0xeb62('0x4')])['dir'],path[_0xeb62('0x3d')](_0x347c55[_0xeb62('0x4')])[_0xeb62('0x29')]);_0x173c07[_0xeb62('0x68')]=_0x347c55[_0xeb62('0x4')];ut[_0xeb62('0x4b')](_0xeb62('0x69'),'');ami[_0xeb62('0x6a')](ut[_0xeb62('0x6b')](_0x347c55,_0x173c07))[_0xeb62('0x3f')](function(_0x17d1ff){_0x28d0ff(_0x17d1ff);})[_0xeb62('0x42')](function(_0x910940){_0x2e4502(_0x910940);});})['catch'](function(_0x26091f){_0x2e4502(_0x26091f);});}else{ami[_0xeb62('0x6a')](ut['variablesAction'](_0x347c55,_0x173c07))[_0xeb62('0x3f')](function(_0x5c2b15){_0x28d0ff(_0x5c2b15);})[_0xeb62('0x42')](function(_0x13678d){_0x2e4502(_0x13678d);});}});}Fax[_0xeb62('0x20')][_0xeb62('0x5b')]=function(_0x44f90e,_0x33fbda){var _0x490c98=this;return new BPromise(function(_0x29b112,_0x4fc07f){var _0x42ee4d=uuid['v4']();var _0xdef5f3=ut[_0xeb62('0x6c')](_0x44f90e,_0x33fbda);_0x490c98[_0xeb62('0x11')][_0x42ee4d]=new Action(_0x42ee4d,_0x33fbda,_0x44f90e);var _0x1dcd96=_0x490c98['actions'][_0x42ee4d];if(path[_0xeb62('0x3d')](_0x44f90e[_0xeb62('0x4')])[_0xeb62('0x6d')]==='.pdf'){originate(_0x1dcd96,_0xdef5f3,!![])[_0xeb62('0x3f')](function(_0x3ad496){_0x29b112(_0x3ad496);})[_0xeb62('0x42')](function(_0x7ca547){_0x4fc07f(_0x7ca547);});}else{originate(_0x1dcd96,_0xdef5f3,![])[_0xeb62('0x3f')](function(_0x31f999){_0x29b112(_0x31f999);})['catch'](function(_0x5cb634){_0x4fc07f(_0x5cb634);});}});};Fax['prototype']['isTrunkReachable']=function(_0x5bf6f6){return!_[_0xeb62('0x6e')](_0x5bf6f6)&&!_[_0xeb62('0x6e')](_0x5bf6f6[_0xeb62('0x29')])&&!_[_0xeb62('0x6e')](_0x5bf6f6[_0xeb62('0x6f')])&&_0x5bf6f6[_0xeb62('0x6f')]&&!_[_0xeb62('0x6e')](this[_0xeb62('0x10')][util[_0xeb62('0x65')](_0xeb62('0x70'),_0x5bf6f6[_0xeb62('0x29')])])&&!_[_0xeb62('0x6e')](this['trunks'][util[_0xeb62('0x65')](_0xeb62('0x70'),_0x5bf6f6[_0xeb62('0x29')])][_0xeb62('0x32')])&&(this[_0xeb62('0x10')][util[_0xeb62('0x65')](_0xeb62('0x70'),_0x5bf6f6[_0xeb62('0x29')])][_0xeb62('0x32')]===_0xeb62('0x71')||this[_0xeb62('0x10')][util[_0xeb62('0x65')](_0xeb62('0x70'),_0x5bf6f6[_0xeb62('0x29')])][_0xeb62('0x32')]===_0xeb62('0x72'));};Fax[_0xeb62('0x20')][_0xeb62('0x62')]=function(_0x568380,_0x358780){if(!this['isTrunkReachable'](_0x568380)){ut[_0xeb62('0x4b')](_0xeb62('0x73'),_['isNil'](_0x568380)?'':_0x568380[_0xeb62('0x29')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xeb62('0x6e')](_0x358780[_0xeb62('0x8')])){ut[_0xeb62('0x4b')](_0xeb62('0x74'),JSON['stringify'](_0x358780));return{'isValid':![],'message':_0xeb62('0x75')};}if(_[_0xeb62('0x6e')](_0x358780['path'])){ut[_0xeb62('0x4b')](_0xeb62('0x76'),JSON[_0xeb62('0x55')](_0x358780));return{'isValid':![],'message':_0xeb62('0x77')};}return{'isValid':!![],'message':_0xeb62('0x78')};};module[_0xeb62('0x79')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index eb0da82..ccaa96e 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 _0xbfc7=['util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','then','catch','[Notify]\x20'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0xbfc7,0x6c));var _0x7bfc=function(_0x5272bd,_0x446d7d){_0x5272bd=_0x5272bd-0x0;var _0x5e71f2=_0xbfc7[_0x5272bd];return _0x5e71f2;};'use strict';var util=require(_0x7bfc('0x0'));var BPromise=require(_0x7bfc('0x1'));var logger=require(_0x7bfc('0x2'))(_0x7bfc('0x3'));var _=require(_0x7bfc('0x4'));var faxAccount=require(_0x7bfc('0x5'));function loggerCatch(_0x4d21c6){return function(_0x20e76d){logger[_0x7bfc('0x6')](_0x4d21c6,util[_0x7bfc('0x7')](_0x20e76d,{'showHidden':![],'depth':null}));};}exports[_0x7bfc('0x8')]=function(_0x53bcf6,_0x6911ea){return BPromise['resolve']()[_0x7bfc('0x9')](faxAccount[_0x7bfc('0x8')](_0x53bcf6,_0x6911ea))[_0x7bfc('0xa')](loggerCatch(_0x7bfc('0xb')));}; \ No newline at end of file +var _0x345d=['util','../../../config/logger','preview','lodash','error','notify','[Notify]\x20'];(function(_0x194e8e,_0x423fae){var _0x1eac55=function(_0x225c35){while(--_0x225c35){_0x194e8e['push'](_0x194e8e['shift']());}};_0x1eac55(++_0x423fae);}(_0x345d,0x1a4));var _0xd345=function(_0x509732,_0x121584){_0x509732=_0x509732-0x0;var _0x10d713=_0x345d[_0x509732];return _0x10d713;};'use strict';var util=require(_0xd345('0x0'));var BPromise=require('bluebird');var logger=require(_0xd345('0x1'))(_0xd345('0x2'));var _=require(_0xd345('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x38f276){return function(_0x214ee9){logger[_0xd345('0x4')](_0x38f276,util['inspect'](_0x214ee9,{'showHidden':![],'depth':null}));};}exports[_0xd345('0x5')]=function(_0x4cc760,_0x4b1002){return BPromise['resolve']()['then'](faxAccount['notify'](_0x4cc760,_0x4b1002))['catch'](loggerCatch(_0xd345('0x6')));}; \ 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 ee99670..1bc0874 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 _0x47a1=['bluebird','child_process','execute','Exec\x20gs','info','inspect','util','../../../../config/logger','fax'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x47a1,0xcc));var _0x147a=function(_0x3167b1,_0xaf5a6e){_0x3167b1=_0x3167b1-0x0;var _0x109246=_0x47a1[_0x3167b1];return _0x109246;};'use strict';var util=require(_0x147a('0x0'));var logger=require(_0x147a('0x1'))(_0x147a('0x2'));var BPromise=require(_0x147a('0x3'));var exec=require(_0x147a('0x4'))['exec'];exports[_0x147a('0x5')]=function(_0x433f7c){return new BPromise(function(_0x33b203,_0x310fe2){exec(_0x433f7c,function(_0x3e3304,_0x3c8ff3,_0x46a577){logger['info'](_0x147a('0x6'),_0x3c8ff3);if(_0x3e3304){logger[_0x147a('0x7')]('Exec\x20gs','\x20Error\x20:',util[_0x147a('0x8')](_0x3e3304,{'showHidden':![],'depth':null}),_0x3c8ff3,_0x46a577);_0x310fe2(_0x3e3304);}_0x33b203(_0x3c8ff3);});});}; \ No newline at end of file +var _0x6d47=['\x20Error\x20:','util','../../../../config/logger','fax','child_process','info','Exec\x20gs'];(function(_0x1c5a78,_0x4b0a61){var _0x2ccf7e=function(_0x2f2409){while(--_0x2f2409){_0x1c5a78['push'](_0x1c5a78['shift']());}};_0x2ccf7e(++_0x4b0a61);}(_0x6d47,0x166));var _0x76d4=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x6d47[_0x3054be];return _0x3df150;};'use strict';var util=require(_0x76d4('0x0'));var logger=require(_0x76d4('0x1'))(_0x76d4('0x2'));var BPromise=require('bluebird');var exec=require(_0x76d4('0x3'))['exec'];exports['execute']=function(_0x5954c6){return new BPromise(function(_0x41a1af,_0xad8922){exec(_0x5954c6,function(_0x19b3b6,_0x50a8c3,_0x2a978f){logger[_0x76d4('0x4')](_0x76d4('0x5'),_0x50a8c3);if(_0x19b3b6){logger[_0x76d4('0x4')](_0x76d4('0x5'),_0x76d4('0x6'),util['inspect'](_0x19b3b6,{'showHidden':![],'depth':null}),_0x50a8c3,_0x2a978f);_0xad8922(_0x19b3b6);}_0x41a1af(_0x50a8c3);});});}; \ 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 af6e4a5..1c496f1 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 _0x9e47=['headerinfo','maxrate','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','message','logger','info','inspect'];(function(_0x16337a,_0x4789a1){var _0x422365=function(_0x34f039){while(--_0x34f039){_0x16337a['push'](_0x16337a['shift']());}};_0x422365(++_0x4789a1);}(_0x9e47,0x161));var _0x79e4=function(_0x229e13,_0x2b9a7a){_0x229e13=_0x229e13-0x0;var _0x3f83af=_0x9e47[_0x229e13];return _0x3f83af;};'use strict';var util=require(_0x79e4('0x0'));var _=require(_0x79e4('0x1'));var moment=require('moment');var logger=require(_0x79e4('0x2'))('fax');exports[_0x79e4('0x3')]=function(_0x4acb16){return{'message':_0x4acb16};};exports[_0x79e4('0x4')]=function(_0x16ec7a,_0x516a64){logger[_0x79e4('0x5')](_0x16ec7a,util[_0x79e4('0x6')](_0x516a64,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x41b236,_0x333a75){var _0x1d64f7={'XMF-ECM':_0x333a75['ecm'],'XMF-HEADERINFO':_0x333a75[_0x79e4('0x7')],'XMF-MINRATE':_0x333a75['minrate'],'XMF-MAXRATE':_0x333a75[_0x79e4('0x8')],'XMF-MODEM':util['format'](_0x79e4('0x9'),_0x333a75[_0x79e4('0xa')]),'XMF-GATEWAY':_0x333a75['gateway'],'XMF-FAXDETECT':_0x333a75[_0x79e4('0xb')],'XMF-T38TIMEOUT':_0x333a75[_0x79e4('0xc')],'XMF-LOCALSTATIONID':_0x333a75[_0x79e4('0xd')],'XMF-PATH':_0x41b236['path']};return _0x1d64f7;};exports[_0x79e4('0xe')]=function(_0x3c497a,_0x195dd5){return{'actionid':_0x3c497a[_0x79e4('0xf')],'action':_0x79e4('0x10'),'channel':_0x3c497a[_0x79e4('0x11')],'Exten':_0x79e4('0x12'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0x79e4('0x13'),_0x3c497a[_0x79e4('0x7')]?_0x3c497a[_0x79e4('0x7')]:'',_0x3c497a[_0x79e4('0xd')]),'variable':_0x195dd5,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3c497a[_0x79e4('0xf')]};}; \ No newline at end of file +var _0x4ba9=['localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','moment','fax','message','logger','info','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','modem','faxdetect','t38timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ba9,0xe1));var _0x94ba=function(_0x2e6dee,_0x1a61b0){_0x2e6dee=_0x2e6dee-0x0;var _0x47706=_0x4ba9[_0x2e6dee];return _0x47706;};'use strict';var util=require(_0x94ba('0x0'));var _=require('lodash');var moment=require(_0x94ba('0x1'));var logger=require('../../../../config/logger')(_0x94ba('0x2'));exports[_0x94ba('0x3')]=function(_0x4d0f2b){return{'message':_0x4d0f2b};};exports[_0x94ba('0x4')]=function(_0x396cc8,_0x5ca5df){logger[_0x94ba('0x5')](_0x396cc8,util['inspect'](_0x5ca5df,{'showHidden':![],'depth':null}));};exports[_0x94ba('0x6')]=function(_0x423502,_0x40f5bc){var _0x446787={'XMF-ECM':_0x40f5bc[_0x94ba('0x7')],'XMF-HEADERINFO':_0x40f5bc[_0x94ba('0x8')],'XMF-MINRATE':_0x40f5bc[_0x94ba('0x9')],'XMF-MAXRATE':_0x40f5bc['maxrate'],'XMF-MODEM':util[_0x94ba('0xa')](_0x94ba('0xb'),_0x40f5bc[_0x94ba('0xc')]),'XMF-GATEWAY':_0x40f5bc['gateway'],'XMF-FAXDETECT':_0x40f5bc[_0x94ba('0xd')],'XMF-T38TIMEOUT':_0x40f5bc[_0x94ba('0xe')],'XMF-LOCALSTATIONID':_0x40f5bc[_0x94ba('0xf')],'XMF-PATH':_0x423502[_0x94ba('0x10')]};return _0x446787;};exports[_0x94ba('0x11')]=function(_0x3a8fa3,_0x29d4c4){return{'actionid':_0x3a8fa3[_0x94ba('0x12')],'action':_0x94ba('0x13'),'channel':_0x3a8fa3[_0x94ba('0x14')],'Exten':_0x94ba('0x15'),'Context':_0x94ba('0x16'),'Priority':'1','callerid':util[_0x94ba('0xa')](_0x94ba('0x17'),_0x3a8fa3['headerinfo']?_0x3a8fa3[_0x94ba('0x8')]:'',_0x3a8fa3[_0x94ba('0xf')]),'variable':_0x29d4c4,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3a8fa3[_0x94ba('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 2f5b647..72d2c4a 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 _0xde46=['initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','catch','error','inspect','listen','bluebird','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','then','getAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts'];(function(_0x15718e,_0x2f5096){var _0xf3b1d2=function(_0x718af1){while(--_0x718af1){_0x15718e['push'](_0x15718e['shift']());}};_0xf3b1d2(++_0x2f5096);}(_0xde46,0x174));var _0x6de4=function(_0x2d54bd,_0x3017ee){_0x2d54bd=_0x2d54bd-0x0;var _0x134a35=_0xde46[_0x2d54bd];return _0x134a35;};'use strict';var BPromise=require(_0x6de4('0x0'));var util=require('util');var moment=require(_0x6de4('0x1'));var server=require('./server');var Realtime=require(_0x6de4('0x2'));var Report=require(_0x6de4('0x3'));var Acw=require(_0x6de4('0x4'));var Trigger=require(_0x6de4('0x5'));var Dialer=require(_0x6de4('0x6'));var Preview=require(_0x6de4('0x7'));var Fax=require(_0x6de4('0x8'));var user=require(_0x6de4('0x9'));var voiceQueue=require(_0x6de4('0xa'));var voiceQueueReport=require(_0x6de4('0xb'));var voiceCallReport=require(_0x6de4('0xc'));var trunk=require(_0x6de4('0xd'));var trigger=require(_0x6de4('0xe'));var template=require(_0x6de4('0xf'));var cmHopperHistory=require(_0x6de4('0x10'));var campaign=require(_0x6de4('0x11'));var voiceExtension=require(_0x6de4('0x12'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x6de4('0x13'));var salesforce=require(_0x6de4('0x14'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x6de4('0x15'));var zoho=require(_0x6de4('0x16'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x6de4('0x17'));var dynamics365=require(_0x6de4('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x6de4('0x19'))(_0x6de4('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6de4('0x1b')](_0x6de4('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x6de4('0x1d')](user[_0x6de4('0x1e')]())[_0x6de4('0x1d')](realtime['initAgents']())[_0x6de4('0x1d')](user[_0x6de4('0x1f')]())['then'](realtime['initTelephones']())[_0x6de4('0x1d')](trunk[_0x6de4('0x20')]())[_0x6de4('0x1d')](realtime[_0x6de4('0x21')]())[_0x6de4('0x1d')](voiceQueue[_0x6de4('0x22')]())[_0x6de4('0x1d')](realtime[_0x6de4('0x23')]())[_0x6de4('0x1d')](trigger[_0x6de4('0x24')]())[_0x6de4('0x1d')](realtime['initTriggers']())[_0x6de4('0x1d')](template[_0x6de4('0x25')]())[_0x6de4('0x1d')](realtime[_0x6de4('0x26')]())[_0x6de4('0x1d')](zendesk[_0x6de4('0x27')]())[_0x6de4('0x1d')](realtime[_0x6de4('0x28')]())[_0x6de4('0x1d')](salesforce[_0x6de4('0x29')]())[_0x6de4('0x1d')](realtime[_0x6de4('0x2a')]())['then'](sugarcrm[_0x6de4('0x2b')]())[_0x6de4('0x1d')](realtime[_0x6de4('0x2c')]())[_0x6de4('0x1d')](freshdesk[_0x6de4('0x2d')]())[_0x6de4('0x1d')](realtime[_0x6de4('0x2e')]())[_0x6de4('0x1d')](desk[_0x6de4('0x2f')]())['then'](realtime[_0x6de4('0x30')]())['then'](zoho[_0x6de4('0x31')]())[_0x6de4('0x1d')](realtime[_0x6de4('0x32')]())[_0x6de4('0x1d')](vtiger['getVtigerAccounts']())['then'](realtime[_0x6de4('0x33')]())[_0x6de4('0x1d')](freshsales['getFreshsalesAccounts']())[_0x6de4('0x1d')](realtime[_0x6de4('0x34')]())[_0x6de4('0x1d')](servicenow[_0x6de4('0x35')]())[_0x6de4('0x1d')](realtime['initServicenowAccounts']())[_0x6de4('0x1d')](dynamics365[_0x6de4('0x36')]())[_0x6de4('0x1d')](realtime[_0x6de4('0x37')]())[_0x6de4('0x1d')](campaign[_0x6de4('0x38')]())[_0x6de4('0x1d')](realtime[_0x6de4('0x39')]())['then'](voiceExtension[_0x6de4('0x3a')]())['then'](realtime['initVoiceExtensions']())[_0x6de4('0x1d')](faxAccount[_0x6de4('0x3b')]())[_0x6de4('0x1d')](realtime[_0x6de4('0x3c')]())[_0x6de4('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x6de4('0x3d')]()[_0x6de4('0x1d')](voiceQueueReport['getVoiceQueueReports']())[_0x6de4('0x1d')](realtime['initVoiceQueueReports']())[_0x6de4('0x1d')](cmHopperHistory[_0x6de4('0x3e')]())['then'](realtime[_0x6de4('0x3f')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x6de4('0x1d')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x6de4('0x40')]())['then'](realtime['initVoiceCallReports']())[_0x6de4('0x41')](function(_0x171169){logger[_0x6de4('0x42')]('[index.js][initParams]',util[_0x6de4('0x43')](_0x171169,{'showHidden':![],'depth':null}));});}function main(){return server[_0x6de4('0x44')](realtime,preview,fax)['then'](function(_0x385ada){return initRealtime();})[_0x6de4('0x1d')](function(){return initParams();})[_0x6de4('0x1d')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x6de4('0x41')](function(_0x6860a7){logger[_0x6de4('0x42')]('[index.js][main]',util['inspect'](_0x6860a7,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xf9e6=['./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','hour','resolve','then','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','catch','error','[index.js][initParams]','inspect','listen','[index.js][main]','bluebird','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension'];(function(_0x4072e9,_0x13d9e0){var _0x419e60=function(_0x43b469){while(--_0x43b469){_0x4072e9['push'](_0x4072e9['shift']());}};_0x419e60(++_0x13d9e0);}(_0xf9e6,0x103));var _0x6f9e=function(_0x96e7e6,_0x4c2963){_0x96e7e6=_0x96e7e6-0x0;var _0xfc8186=_0xf9e6[_0x96e7e6];return _0xfc8186;};'use strict';var BPromise=require(_0x6f9e('0x0'));var util=require('util');var moment=require(_0x6f9e('0x1'));var server=require('./server');var Realtime=require(_0x6f9e('0x2'));var Report=require(_0x6f9e('0x3'));var Acw=require(_0x6f9e('0x4'));var Trigger=require(_0x6f9e('0x5'));var Dialer=require(_0x6f9e('0x6'));var Preview=require(_0x6f9e('0x7'));var Fax=require(_0x6f9e('0x8'));var user=require(_0x6f9e('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x6f9e('0xa'));var trunk=require(_0x6f9e('0xb'));var trigger=require(_0x6f9e('0xc'));var template=require(_0x6f9e('0xd'));var cmHopperHistory=require(_0x6f9e('0xe'));var campaign=require(_0x6f9e('0xf'));var voiceExtension=require(_0x6f9e('0x10'));var faxAccount=require(_0x6f9e('0x11'));var zendesk=require(_0x6f9e('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x6f9e('0x13'));var freshdesk=require(_0x6f9e('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x6f9e('0x15'));var vtiger=require(_0x6f9e('0x16'));var freshsales=require(_0x6f9e('0x17'));var servicenow=require(_0x6f9e('0x18'));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(_0x6f9e('0x19'))(_0x6f9e('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x6f9e('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x6f9e('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x6f9e('0x1c')]()[_0x6f9e('0x1d')](user['getAgents']())['then'](realtime['initAgents']())['then'](user[_0x6f9e('0x1e')]())[_0x6f9e('0x1d')](realtime[_0x6f9e('0x1f')]())[_0x6f9e('0x1d')](trunk['getTrunks']())[_0x6f9e('0x1d')](realtime[_0x6f9e('0x20')]())[_0x6f9e('0x1d')](voiceQueue[_0x6f9e('0x21')]())['then'](realtime[_0x6f9e('0x22')]())[_0x6f9e('0x1d')](trigger[_0x6f9e('0x23')]())[_0x6f9e('0x1d')](realtime['initTriggers']())[_0x6f9e('0x1d')](template[_0x6f9e('0x24')]())[_0x6f9e('0x1d')](realtime['initTemplates']())[_0x6f9e('0x1d')](zendesk['getZendeskAccounts']())[_0x6f9e('0x1d')](realtime['initZendeskAccounts']())[_0x6f9e('0x1d')](salesforce[_0x6f9e('0x25')]())[_0x6f9e('0x1d')](realtime[_0x6f9e('0x26')]())[_0x6f9e('0x1d')](sugarcrm[_0x6f9e('0x27')]())[_0x6f9e('0x1d')](realtime[_0x6f9e('0x28')]())['then'](freshdesk[_0x6f9e('0x29')]())[_0x6f9e('0x1d')](realtime[_0x6f9e('0x2a')]())[_0x6f9e('0x1d')](desk[_0x6f9e('0x2b')]())[_0x6f9e('0x1d')](realtime['initDeskAccounts']())[_0x6f9e('0x1d')](zoho[_0x6f9e('0x2c')]())['then'](realtime[_0x6f9e('0x2d')]())['then'](vtiger[_0x6f9e('0x2e')]())[_0x6f9e('0x1d')](realtime[_0x6f9e('0x2f')]())[_0x6f9e('0x1d')](freshsales['getFreshsalesAccounts']())[_0x6f9e('0x1d')](realtime[_0x6f9e('0x30')]())[_0x6f9e('0x1d')](servicenow['getServicenowAccounts']())[_0x6f9e('0x1d')](realtime[_0x6f9e('0x31')]())['then'](dynamics365[_0x6f9e('0x32')]())[_0x6f9e('0x1d')](realtime[_0x6f9e('0x33')]())[_0x6f9e('0x1d')](campaign[_0x6f9e('0x34')]())['then'](realtime[_0x6f9e('0x35')]())[_0x6f9e('0x1d')](voiceExtension[_0x6f9e('0x36')]())[_0x6f9e('0x1d')](realtime[_0x6f9e('0x37')]())[_0x6f9e('0x1d')](faxAccount[_0x6f9e('0x38')]())['then'](realtime['initFaxAccounts']())[_0x6f9e('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x6f9e('0x1c')]()[_0x6f9e('0x1d')](voiceQueueReport[_0x6f9e('0x39')]())[_0x6f9e('0x1d')](realtime[_0x6f9e('0x3a')]())['then'](cmHopperHistory[_0x6f9e('0x3b')]())['then'](realtime[_0x6f9e('0x3c')]())[_0x6f9e('0x1d')](cmHopperHistory[_0x6f9e('0x3d')]())[_0x6f9e('0x1d')](realtime[_0x6f9e('0x3e')]())[_0x6f9e('0x1d')](voiceCallReport['getVoiceCallReports']())['then'](realtime['initVoiceCallReports']())[_0x6f9e('0x3f')](function(_0x1a6c5){logger[_0x6f9e('0x40')](_0x6f9e('0x41'),util[_0x6f9e('0x42')](_0x1a6c5,{'showHidden':![],'depth':null}));});}function main(){return server[_0x6f9e('0x43')](realtime,preview,fax)[_0x6f9e('0x1d')](function(_0x315540){return initRealtime();})[_0x6f9e('0x1d')](function(){return initParams();})[_0x6f9e('0x1d')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x6f9e('0x3f')](function(_0x1b43d1){logger[_0x6f9e('0x40')](_0x6f9e('0x44'),util[_0x6f9e('0x42')](_0x1b43d1,{'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 060eb78..ac319bf 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(_0x1cbaa2,_0x16f4d8){var _0x114440=function(_0x22d234){while(--_0x22d234){_0x1cbaa2['push'](_0x1cbaa2['shift']());}};_0x114440(++_0x16f4d8);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'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(_0x279746,_0x3ecced){var _0x136467=function(_0x208bec){while(--_0x208bec){_0x279746['push'](_0x279746['shift']());}};_0x136467(++_0x3ecced);}(_0x70e0,0x17b));var _0x070e=function(_0x46a6cd,_0x120c28){_0x46a6cd=_0x46a6cd-0x0;var _0x28529d=_0x70e0[_0x46a6cd];return _0x28529d;};'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 d1edac2..234d456 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 _0xea4d=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry'];(function(_0x32b9d2,_0x273b5d){var _0x5af2e3=function(_0x2549bc){while(--_0x2549bc){_0x32b9d2['push'](_0x32b9d2['shift']());}};_0x5af2e3(++_0x273b5d);}(_0xea4d,0x1c1));var _0xdea4=function(_0x392435,_0x4a522f){_0x392435=_0x392435-0x0;var _0x23dea1=_0xea4d[_0x392435];return _0x23dea1;};'use strict';function Campaign(_0x29d399){this['id']=_0x29d399['id']||0x0;this[_0xdea4('0x0')]=_0x29d399['name']||'';this[_0xdea4('0x1')]=_0x29d399['type']||_0xdea4('0x2');this[_0xdea4('0x3')]=0x0;this[_0xdea4('0x4')]=0x0;this[_0xdea4('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xdea4('0x6')]='';this[_0xdea4('0x7')]=!![];this[_0xdea4('0x8')]=_0x29d399[_0xdea4('0x8')];this[_0xdea4('0x9')]=_0x29d399[_0xdea4('0x9')];this[_0xdea4('0xa')]=_0x29d399[_0xdea4('0xa')]||null;this[_0xdea4('0xb')]=_0x29d399['dialGlobalInterval']?_0x29d399['dialGlobalInterval']:null;this[_0xdea4('0xc')]=_0x29d399['dialOriginateCallerIdName'];this[_0xdea4('0xd')]=_0x29d399[_0xdea4('0xd')];this[_0xdea4('0xe')]=_0x29d399[_0xdea4('0xe')]||0x1e;this[_0xdea4('0xf')]=_0x29d399['dialCongestionMaxRetry'];this[_0xdea4('0x10')]=_0x29d399[_0xdea4('0x10')];this['dialBusyMaxRetry']=_0x29d399[_0xdea4('0x11')];this['dialBusyRetryFrequency']=_0x29d399['dialBusyRetryFrequency'];this[_0xdea4('0x12')]=_0x29d399[_0xdea4('0x12')];this[_0xdea4('0x13')]=_0x29d399[_0xdea4('0x13')];this['dialGlobalMaxRetry']=_0x29d399[_0xdea4('0x14')];this[_0xdea4('0x15')]=_0x29d399[_0xdea4('0x15')]||0x3;this[_0xdea4('0x16')]=_0x29d399[_0xdea4('0x16')]||0x96;this[_0xdea4('0x17')]=_0x29d399[_0xdea4('0x17')]||0x3;this[_0xdea4('0x18')]=_0x29d399[_0xdea4('0x18')]||0x96;this[_0xdea4('0x19')]=_0x29d399['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x29d399[_0xdea4('0x1a')]||0x96;this[_0xdea4('0x1b')]=_0x29d399[_0xdea4('0x1b')]||0x3;this[_0xdea4('0x1c')]=_0x29d399[_0xdea4('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x29d399[_0xdea4('0x1d')]||0x3;this[_0xdea4('0x1e')]=_0x29d399[_0xdea4('0x1e')]||0x96;this[_0xdea4('0x1f')]=_0x29d399[_0xdea4('0x1f')]||_0xdea4('0x20');this[_0xdea4('0x21')]=_0x29d399[_0xdea4('0x21')]||undefined;this[_0xdea4('0x22')]=_0x29d399[_0xdea4('0x22')]||undefined;this[_0xdea4('0x23')]=_0x29d399[_0xdea4('0x23')]||undefined;this[_0xdea4('0x24')]=_0x29d399[_0xdea4('0x24')]?_0x29d399[_0xdea4('0x24')]:undefined;this[_0xdea4('0x25')]=_0x29d399[_0xdea4('0x25')]?_0x29d399[_0xdea4('0x25')]:undefined;this[_0xdea4('0x26')]=_0x29d399['Interval']?_0x29d399[_0xdea4('0x26')]:undefined;this[_0xdea4('0x27')]=_0x29d399['SquareProject']?_0x29d399['SquareProject']:undefined;this[_0xdea4('0x28')]=_0x29d399[_0xdea4('0x27')]?_0x29d399[_0xdea4('0x27')][_0xdea4('0x0')]:undefined;this[_0xdea4('0x29')]=_0x29d399[_0xdea4('0x29')]||![];this[_0xdea4('0x2a')]=_0x29d399[_0xdea4('0x2a')];this[_0xdea4('0x2b')]=_0x29d399[_0xdea4('0x2b')];this[_0xdea4('0x2c')]=_0x29d399['dialAMDAfterGreetingSilence'];this[_0xdea4('0x2d')]=_0x29d399['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x29d399[_0xdea4('0x2e')];this[_0xdea4('0x2f')]=_0x29d399[_0xdea4('0x2f')];this[_0xdea4('0x30')]=_0x29d399['dialAMDMaximumNumberOfWords'];this[_0xdea4('0x31')]=_0x29d399['dialAMDSilenceThreshold'];this[_0xdea4('0x32')]=_0x29d399[_0xdea4('0x32')];}module[_0xdea4('0x33')]=Campaign; \ No newline at end of file +var _0xa5bd=['dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry'];(function(_0x46f204,_0x3f87a1){var _0x544998=function(_0x3224b2){while(--_0x3224b2){_0x46f204['push'](_0x46f204['shift']());}};_0x544998(++_0x3f87a1);}(_0xa5bd,0x14a));var _0xda5b=function(_0x14afda,_0x512394){_0x14afda=_0x14afda-0x0;var _0x1923af=_0xa5bd[_0x14afda];return _0x1923af;};'use strict';function Campaign(_0x4d1873){this['id']=_0x4d1873['id']||0x0;this[_0xda5b('0x0')]=_0x4d1873[_0xda5b('0x0')]||'';this[_0xda5b('0x1')]=_0x4d1873[_0xda5b('0x1')]||_0xda5b('0x2');this[_0xda5b('0x3')]=0x0;this[_0xda5b('0x4')]=0x0;this[_0xda5b('0x5')]=0x0;this[_0xda5b('0x6')]=0x0;this[_0xda5b('0x7')]='';this[_0xda5b('0x8')]=!![];this[_0xda5b('0x9')]=_0x4d1873[_0xda5b('0x9')];this['limitCalls']=_0x4d1873[_0xda5b('0xa')];this['dialTimezone']=_0x4d1873[_0xda5b('0xb')]||null;this[_0xda5b('0xc')]=_0x4d1873[_0xda5b('0xc')]?_0x4d1873['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x4d1873[_0xda5b('0xd')];this[_0xda5b('0xe')]=_0x4d1873[_0xda5b('0xe')];this[_0xda5b('0xf')]=_0x4d1873[_0xda5b('0xf')]||0x1e;this[_0xda5b('0x10')]=_0x4d1873[_0xda5b('0x10')];this[_0xda5b('0x11')]=_0x4d1873[_0xda5b('0x11')];this['dialBusyMaxRetry']=_0x4d1873['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x4d1873[_0xda5b('0x12')];this[_0xda5b('0x13')]=_0x4d1873['dialNoAnswerMaxRetry'];this[_0xda5b('0x14')]=_0x4d1873['dialNoAnswerRetryFrequency'];this[_0xda5b('0x15')]=_0x4d1873[_0xda5b('0x15')];this[_0xda5b('0x16')]=_0x4d1873[_0xda5b('0x16')]||0x3;this[_0xda5b('0x17')]=_0x4d1873[_0xda5b('0x17')]||0x96;this[_0xda5b('0x18')]=_0x4d1873['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x4d1873[_0xda5b('0x19')]||0x96;this[_0xda5b('0x1a')]=_0x4d1873[_0xda5b('0x1a')]||0x3;this['dialAbandonedRetryFrequency']=_0x4d1873[_0xda5b('0x1b')]||0x96;this['dialMachineMaxRetry']=_0x4d1873[_0xda5b('0x1c')]||0x3;this['dialMachineRetryFrequency']=_0x4d1873[_0xda5b('0x1d')]||0x96;this[_0xda5b('0x1e')]=_0x4d1873['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x4d1873[_0xda5b('0x1f')]||0x96;this[_0xda5b('0x20')]=_0x4d1873[_0xda5b('0x20')]||'DESC';this[_0xda5b('0x21')]=_0x4d1873[_0xda5b('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x4d1873[_0xda5b('0x22')]||undefined;this['dialCutDigit']=_0x4d1873[_0xda5b('0x23')]||undefined;this['TrunkBackup']=_0x4d1873[_0xda5b('0x24')]?_0x4d1873[_0xda5b('0x24')]:undefined;this[_0xda5b('0x25')]=_0x4d1873[_0xda5b('0x25')]?_0x4d1873[_0xda5b('0x25')]:undefined;this[_0xda5b('0x26')]=_0x4d1873[_0xda5b('0x26')]?_0x4d1873[_0xda5b('0x26')]:undefined;this[_0xda5b('0x27')]=_0x4d1873[_0xda5b('0x27')]?_0x4d1873[_0xda5b('0x27')]:undefined;this['dialQueueProject']=_0x4d1873[_0xda5b('0x27')]?_0x4d1873['SquareProject'][_0xda5b('0x0')]:undefined;this[_0xda5b('0x28')]=_0x4d1873[_0xda5b('0x28')]||![];this['dialAMDInitialSilence']=_0x4d1873[_0xda5b('0x29')];this[_0xda5b('0x2a')]=_0x4d1873[_0xda5b('0x2a')];this[_0xda5b('0x2b')]=_0x4d1873[_0xda5b('0x2b')];this[_0xda5b('0x2c')]=_0x4d1873['dialAMDTotalAnalysisTime'];this[_0xda5b('0x2d')]=_0x4d1873[_0xda5b('0x2d')];this[_0xda5b('0x2e')]=_0x4d1873['dialAMDBetweenWordsSilence'];this[_0xda5b('0x2f')]=_0x4d1873[_0xda5b('0x2f')];this[_0xda5b('0x30')]=_0x4d1873[_0xda5b('0x30')];this[_0xda5b('0x31')]=_0x4d1873[_0xda5b('0x31')];}module[_0xda5b('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 c3e92fd..1d69950 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 _0x5a1c=['lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','queue','monitors','transferType','exports','starttime','channel','calleridname','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','unmanaged','abandoned','lastapplication'];(function(_0x38d2cc,_0x4affa9){var _0x3f9944=function(_0x5196ae){while(--_0x5196ae){_0x38d2cc['push'](_0x38d2cc['shift']());}};_0x3f9944(++_0x4affa9);}(_0x5a1c,0x1b5));var _0xc5a1=function(_0x4c983c,_0x39f0a4){_0x4c983c=_0x4c983c-0x0;var _0x404b2c=_0x5a1c[_0x4c983c];return _0x404b2c;};'use strict';function Channel(){this[_0xc5a1('0x0')]=null;this[_0xc5a1('0x1')]='';this['destinationchannel']='';this['calleridnum']=0x0;this[_0xc5a1('0x2')]='';this['connectedlinenum']=undefined;this[_0xc5a1('0x3')]=undefined;this[_0xc5a1('0x4')]=0x0;this[_0xc5a1('0x5')]='';this[_0xc5a1('0x6')]=0x0;this['linkedid']=0x0;this[_0xc5a1('0x7')]=0x0;this[_0xc5a1('0x8')]=![];this[_0xc5a1('0x9')]=null;this['endtime']=null;this[_0xc5a1('0xa')]=![];this[_0xc5a1('0xb')]=![];this[_0xc5a1('0xc')]='';this[_0xc5a1('0xd')]='';this[_0xc5a1('0xe')]=0x0;this[_0xc5a1('0xf')]=0x0;this[_0xc5a1('0x10')]=0x0;this[_0xc5a1('0x11')]=null;this[_0xc5a1('0x12')]=null;this[_0xc5a1('0x13')]=null;this[_0xc5a1('0x14')]=![];this['monitorFilename']=null;this[_0xc5a1('0x15')]=null;this[_0xc5a1('0x16')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0xc5a1('0x17')]=undefined;this['mohtime']=0x0;}module[_0xc5a1('0x18')]=Channel; \ No newline at end of file +var _0x117c=['holdtime','type','disposition','monitorFilename','monitors','transfercalleridnum','transferType','exports','calleridnum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','endtime','abandoned','lastdata','duration','billableseconds'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x117c,0x71));var _0xc117=function(_0x440e51,_0x4fc63a){_0x440e51=_0x440e51-0x0;var _0x9be905=_0x117c[_0x440e51];return _0x9be905;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this['destinationchannel']='';this[_0xc117('0x0')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0xc117('0x1')]=undefined;this[_0xc117('0x2')]=0x0;this[_0xc117('0x3')]='';this[_0xc117('0x4')]=0x0;this[_0xc117('0x5')]=0x0;this[_0xc117('0x6')]=0x0;this['answered']=![];this[_0xc117('0x7')]=null;this[_0xc117('0x8')]=null;this['unmanaged']=![];this[_0xc117('0x9')]=![];this['lastapplication']='';this[_0xc117('0xa')]='';this[_0xc117('0xb')]=0x0;this[_0xc117('0xc')]=0x0;this[_0xc117('0xd')]=0x0;this[_0xc117('0xe')]=null;this['tag']=null;this[_0xc117('0xf')]=null;this['monitor']=![];this[_0xc117('0x10')]=null;this['queue']=null;this[_0xc117('0x11')]=[];this[_0xc117('0x12')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xc117('0x13')]=undefined;this['mohtime']=0x0;}module[_0xc117('0x14')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index ea503e2..d2d42fc 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 _0x32e9=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x44df57,_0x1a4f49){var _0x573c6c=function(_0x3ba3e0){while(--_0x3ba3e0){_0x44df57['push'](_0x44df57['shift']());}};_0x573c6c(++_0x1a4f49);}(_0x32e9,0x11a));var _0x932e=function(_0x3d7595,_0x23bf60){_0x3d7595=_0x3d7595-0x0;var _0x163d06=_0x32e9[_0x3d7595];return _0x163d06;};'use strict';function DeskAccount(_0x13f725){this['id']=_0x13f725['id']||0x0;this[_0x932e('0x0')]=_0x13f725[_0x932e('0x0')]||'';this[_0x932e('0x1')]=_0x13f725[_0x932e('0x1')]||'';this[_0x932e('0x2')]=_0x13f725['remoteUri']||'';this[_0x932e('0x3')]=_0x13f725[_0x932e('0x3')]||'';this['password']=_0x13f725[_0x932e('0x4')]||'';this[_0x932e('0x5')]=_0x13f725[_0x932e('0x5')]||'';this[_0x932e('0x6')]=_0x13f725[_0x932e('0x6')]||'';this[_0x932e('0x7')]=_0x13f725[_0x932e('0x7')]||'';this['tokenSecret']=_0x13f725[_0x932e('0x8')]||'';this[_0x932e('0x9')]=_0x13f725['type']||'';this['serverUrl']=_0x13f725[_0x932e('0xa')]||'';this[_0x932e('0xb')]=_0x13f725[_0x932e('0xb')]||{};}module[_0x932e('0xc')]=DeskAccount; \ No newline at end of file +var _0x88ad=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x2bfdb5,_0x367b24){var _0x369e7d=function(_0x1f6e0d){while(--_0x1f6e0d){_0x2bfdb5['push'](_0x2bfdb5['shift']());}};_0x369e7d(++_0x367b24);}(_0x88ad,0x1b9));var _0xd88a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x88ad[_0x57b54c];return _0x59cc19;};'use strict';function DeskAccount(_0x5ac76d){this['id']=_0x5ac76d['id']||0x0;this[_0xd88a('0x0')]=_0x5ac76d[_0xd88a('0x0')]||'';this[_0xd88a('0x1')]=_0x5ac76d[_0xd88a('0x1')]||'';this[_0xd88a('0x2')]=_0x5ac76d[_0xd88a('0x2')]||'';this[_0xd88a('0x3')]=_0x5ac76d[_0xd88a('0x3')]||'';this[_0xd88a('0x4')]=_0x5ac76d[_0xd88a('0x4')]||'';this[_0xd88a('0x5')]=_0x5ac76d[_0xd88a('0x5')]||'';this[_0xd88a('0x6')]=_0x5ac76d['consumerSecret']||'';this[_0xd88a('0x7')]=_0x5ac76d[_0xd88a('0x7')]||'';this[_0xd88a('0x8')]=_0x5ac76d[_0xd88a('0x8')]||'';this[_0xd88a('0x9')]=_0x5ac76d[_0xd88a('0x9')]||'';this['serverUrl']=_0x5ac76d[_0xd88a('0xa')]||'';this[_0xd88a('0xb')]=_0x5ac76d[_0xd88a('0xb')]||{};}module[_0xd88a('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 9b257f7..affe2dd 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 _0xb62e=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username'];(function(_0x3a04ab,_0x31b9fd){var _0x4bff6d=function(_0x125f7e){while(--_0x125f7e){_0x3a04ab['push'](_0x3a04ab['shift']());}};_0x4bff6d(++_0x31b9fd);}(_0xb62e,0x1de));var _0xeb62=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb62e[_0x3b380d];return _0x54502b;};'use strict';function Dynamics365Account(_0x175b5c){this['id']=_0x175b5c['id']||0x0;this[_0xeb62('0x0')]=_0x175b5c[_0xeb62('0x0')]||'';this[_0xeb62('0x1')]=_0x175b5c['username']||'';this[_0xeb62('0x2')]=_0x175b5c[_0xeb62('0x2')]||'';this[_0xeb62('0x3')]=_0x175b5c[_0xeb62('0x3')]||'';this[_0xeb62('0x4')]=_0x175b5c[_0xeb62('0x4')]||'';this['clientId']=_0x175b5c[_0xeb62('0x5')]||'';this[_0xeb62('0x6')]=_0x175b5c[_0xeb62('0x6')]||{};this['serverUrl']=_0x175b5c[_0xeb62('0x7')]||'';this[_0xeb62('0x8')]=_0x175b5c[_0xeb62('0x8')]||{};}module[_0xeb62('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x0713=['Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';function Dynamics365Account(_0x4bf247){this['id']=_0x4bf247['id']||0x0;this['name']=_0x4bf247[_0x3071('0x0')]||'';this[_0x3071('0x1')]=_0x4bf247[_0x3071('0x1')]||'';this[_0x3071('0x2')]=_0x4bf247[_0x3071('0x2')]||'';this['remoteUri']=_0x4bf247[_0x3071('0x3')]||'';this[_0x3071('0x4')]=_0x4bf247[_0x3071('0x4')]||'';this[_0x3071('0x5')]=_0x4bf247[_0x3071('0x5')]||'';this[_0x3071('0x6')]=_0x4bf247[_0x3071('0x6')]||{};this[_0x3071('0x7')]=_0x4bf247[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x4bf247[_0x3071('0x8')]||{};}module[_0x3071('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index e3dcb7f..af919fd 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 _0x0e46=['t38timeout','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect'];(function(_0x42315d,_0x5cc87e){var _0x47c708=function(_0x4ca1df){while(--_0x4ca1df){_0x42315d['push'](_0x42315d['shift']());}};_0x47c708(++_0x5cc87e);}(_0x0e46,0x196));var _0x60e4=function(_0x403ad6,_0x137771){_0x403ad6=_0x403ad6-0x0;var _0x4736bc=_0x0e46[_0x403ad6];return _0x4736bc;};'use strict';function FaxAccount(_0x599328){this['id']=_0x599328['id']||0x0;this[_0x60e4('0x0')]=_0x599328[_0x60e4('0x0')]||'';this['description']=_0x599328[_0x60e4('0x1')];this['ecm']=_0x599328[_0x60e4('0x2')];this[_0x60e4('0x3')]=_0x599328[_0x60e4('0x3')];this[_0x60e4('0x4')]=_0x599328[_0x60e4('0x4')];this[_0x60e4('0x5')]=_0x599328[_0x60e4('0x5')]||0x960;this[_0x60e4('0x6')]=_0x599328[_0x60e4('0x6')]||0x3840;this[_0x60e4('0x7')]=_0x599328[_0x60e4('0x7')]||'v17,v27,v29';this[_0x60e4('0x8')]=_0x599328[_0x60e4('0x8')]||'no';this['faxdetect']=_0x599328[_0x60e4('0x9')]||'no';this[_0x60e4('0xa')]=_0x599328['t38timeout']||0x1388;this['tech']=_0x599328['tech']||_0x60e4('0xb');this[_0x60e4('0xc')]=_0x599328[_0x60e4('0xc')]?_0x599328[_0x60e4('0xc')]:undefined;this[_0x60e4('0xd')]=_0x599328['ListId'];this[_0x60e4('0xe')]=_0x599328[_0x60e4('0xe')];}module[_0x60e4('0xf')]=FaxAccount; \ No newline at end of file +var _0xcb49=['t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xcb49,0xd3));var _0x9cb4=function(_0x29631f,_0xdb767){_0x29631f=_0x29631f-0x0;var _0x486d87=_0xcb49[_0x29631f];return _0x486d87;};'use strict';function FaxAccount(_0x3c6ce6){this['id']=_0x3c6ce6['id']||0x0;this[_0x9cb4('0x0')]=_0x3c6ce6[_0x9cb4('0x0')]||'';this[_0x9cb4('0x1')]=_0x3c6ce6[_0x9cb4('0x1')];this['ecm']=_0x3c6ce6[_0x9cb4('0x2')];this['headerinfo']=_0x3c6ce6[_0x9cb4('0x3')];this['localstationid']=_0x3c6ce6[_0x9cb4('0x4')];this[_0x9cb4('0x5')]=_0x3c6ce6['minrate']||0x960;this['maxrate']=_0x3c6ce6[_0x9cb4('0x6')]||0x3840;this[_0x9cb4('0x7')]=_0x3c6ce6[_0x9cb4('0x7')]||'v17,v27,v29';this[_0x9cb4('0x8')]=_0x3c6ce6[_0x9cb4('0x8')]||'no';this['faxdetect']=_0x3c6ce6[_0x9cb4('0x9')]||'no';this[_0x9cb4('0xa')]=_0x3c6ce6[_0x9cb4('0xa')]||0x1388;this[_0x9cb4('0xb')]=_0x3c6ce6[_0x9cb4('0xb')]||_0x9cb4('0xc');this['Trunk']=_0x3c6ce6[_0x9cb4('0xd')]?_0x3c6ce6[_0x9cb4('0xd')]:undefined;this[_0x9cb4('0xe')]=_0x3c6ce6[_0x9cb4('0xe')];this['key']=_0x3c6ce6[_0x9cb4('0xf')];}module[_0x9cb4('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index c95f4dd..86f2940 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 _0x759f=['serverUrl','Configurations','exports','name','apiKey','remoteUri'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x759f,0xdb));var _0xf759=function(_0x52445e,_0x325cf5){_0x52445e=_0x52445e-0x0;var _0x13e1bb=_0x759f[_0x52445e];return _0x13e1bb;};'use strict';function FreshdeskAccount(_0x1116de){this['id']=_0x1116de['id']||0x0;this['name']=_0x1116de[_0xf759('0x0')]||'';this['username']=_0x1116de['username']||'';this[_0xf759('0x1')]=_0x1116de['token']||'';this[_0xf759('0x2')]=_0x1116de[_0xf759('0x2')]||'';this[_0xf759('0x3')]=_0x1116de[_0xf759('0x3')]||'';this[_0xf759('0x4')]=_0x1116de[_0xf759('0x4')]||{};}module[_0xf759('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0x00dc=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x17b986,_0x264721){var _0x430496=function(_0x22c32a){while(--_0x22c32a){_0x17b986['push'](_0x17b986['shift']());}};_0x430496(++_0x264721);}(_0x00dc,0xcf));var _0xc00d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x00dc[_0x2dafbe];return _0x58a45a;};'use strict';function FreshdeskAccount(_0x356b5d){this['id']=_0x356b5d['id']||0x0;this[_0xc00d('0x0')]=_0x356b5d[_0xc00d('0x0')]||'';this[_0xc00d('0x1')]=_0x356b5d[_0xc00d('0x1')]||'';this[_0xc00d('0x2')]=_0x356b5d[_0xc00d('0x3')]||'';this['remoteUri']=_0x356b5d[_0xc00d('0x4')]||'';this[_0xc00d('0x5')]=_0x356b5d['serverUrl']||'';this['Configurations']=_0x356b5d[_0xc00d('0x6')]||{};}module[_0xc00d('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 4f72307..7352cf3 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 _0x6011=['remoteUri','serverUrl','Configurations','exports','apiKey','token'];(function(_0x4d79bc,_0x32c905){var _0x4b4760=function(_0x212302){while(--_0x212302){_0x4d79bc['push'](_0x4d79bc['shift']());}};_0x4b4760(++_0x32c905);}(_0x6011,0x196));var _0x1601=function(_0x1a9bda,_0x27f534){_0x1a9bda=_0x1a9bda-0x0;var _0x1cd588=_0x6011[_0x1a9bda];return _0x1cd588;};'use strict';function FreshsalesAccount(_0x4c6502){this['id']=_0x4c6502['id']||0x0;this['name']=_0x4c6502['name']||'';this['username']=_0x4c6502['username']||'';this[_0x1601('0x0')]=_0x4c6502[_0x1601('0x1')]||'';this['remoteUri']=_0x4c6502[_0x1601('0x2')]||'';this[_0x1601('0x3')]=_0x4c6502[_0x1601('0x3')]||'';this[_0x1601('0x4')]=_0x4c6502[_0x1601('0x4')]||{};}module[_0x1601('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0xedf2=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x5747e3,_0x4e3058){var _0x3d6447=function(_0xa9be29){while(--_0xa9be29){_0x5747e3['push'](_0x5747e3['shift']());}};_0x3d6447(++_0x4e3058);}(_0xedf2,0x1ac));var _0x2edf=function(_0x3ea254,_0x2b311e){_0x3ea254=_0x3ea254-0x0;var _0x890bc4=_0xedf2[_0x3ea254];return _0x890bc4;};'use strict';function FreshsalesAccount(_0x2fccf4){this['id']=_0x2fccf4['id']||0x0;this[_0x2edf('0x0')]=_0x2fccf4[_0x2edf('0x0')]||'';this[_0x2edf('0x1')]=_0x2fccf4['username']||'';this[_0x2edf('0x2')]=_0x2fccf4[_0x2edf('0x3')]||'';this['remoteUri']=_0x2fccf4[_0x2edf('0x4')]||'';this[_0x2edf('0x5')]=_0x2fccf4['serverUrl']||'';this['Configurations']=_0x2fccf4[_0x2edf('0x6')]||{};}module[_0x2edf('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index c6620c5..b86113f 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 _0x4ea8=['holdtime','lastAssignedTo','motionChannel','voice','mohtime','variables','inbound','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','context','priority'];(function(_0x28bfff,_0x1db57d){var _0x40b8d1=function(_0x175f9a){while(--_0x175f9a){_0x28bfff['push'](_0x28bfff['shift']());}};_0x40b8d1(++_0x1db57d);}(_0x4ea8,0x186));var _0x84ea=function(_0xb3423e,_0x22e852){_0xb3423e=_0xb3423e-0x0;var _0x2b345d=_0x4ea8[_0xb3423e];return _0x2b345d;};'use strict';function QueueReport(){this['type']=_0x84ea('0x0');this['uniqueid']='';this['calleridnum']='';this[_0x84ea('0x1')]='';this[_0x84ea('0x2')]='';this[_0x84ea('0x3')]=null;this[_0x84ea('0x4')]=null;this[_0x84ea('0x5')]=0x1;this[_0x84ea('0x6')]=0x1;this[_0x84ea('0x7')]=![];this[_0x84ea('0x8')]=null;this[_0x84ea('0x9')]=![];this[_0x84ea('0xa')]=null;this[_0x84ea('0xb')]=![];this[_0x84ea('0xc')]=null;this['originalposition']=0x1;this[_0x84ea('0xd')]='';this[_0x84ea('0xe')]='';this[_0x84ea('0xf')]='';this['accountcode']='';this[_0x84ea('0x10')]='';this['exten']='';this[_0x84ea('0x11')]='';this[_0x84ea('0x12')]=0x0;this['assigned']=![];this[_0x84ea('0x13')]='';this[_0x84ea('0x14')]=_0x84ea('0x15');this[_0x84ea('0x16')]=0x0;this[_0x84ea('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x365c=['originalposition','channel','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','variables','exports','type','inbound','uniqueid','calleridnum','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt'];(function(_0x3aebbb,_0x5eb1d6){var _0x494805=function(_0x31ccd7){while(--_0x31ccd7){_0x3aebbb['push'](_0x3aebbb['shift']());}};_0x494805(++_0x5eb1d6);}(_0x365c,0x72));var _0xc365=function(_0x11cbb5,_0x390441){_0x11cbb5=_0x11cbb5-0x0;var _0x54b8d3=_0x365c[_0x11cbb5];return _0x54b8d3;};'use strict';function QueueReport(){this[_0xc365('0x0')]=_0xc365('0x1');this[_0xc365('0x2')]='';this[_0xc365('0x3')]='';this['calleridname']='';this['queue']='';this['queuecallerjoinAt']=null;this[_0xc365('0x4')]=null;this[_0xc365('0x5')]=0x1;this['count']=0x1;this[_0xc365('0x6')]=![];this[_0xc365('0x7')]=null;this[_0xc365('0x8')]=![];this['queuecallercompleteAt']=null;this[_0xc365('0x9')]=![];this[_0xc365('0xa')]=null;this[_0xc365('0xb')]=0x1;this[_0xc365('0xc')]='';this['connectedlinenum']='';this[_0xc365('0xd')]='';this[_0xc365('0xe')]='';this[_0xc365('0xf')]='';this[_0xc365('0x10')]='';this[_0xc365('0x11')]='';this[_0xc365('0x12')]=0x0;this[_0xc365('0x13')]=![];this[_0xc365('0x14')]='';this[_0xc365('0x15')]=_0xc365('0x16');this['mohtime']=0x0;this[_0xc365('0x17')]={};}module[_0xc365('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 5fcf05d..2735853 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 _0x4b0f=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','clientId'];(function(_0x2a0fc4,_0x2eaf74){var _0x531d00=function(_0xa4388f){while(--_0xa4388f){_0x2a0fc4['push'](_0x2a0fc4['shift']());}};_0x531d00(++_0x2eaf74);}(_0x4b0f,0xba));var _0xf4b0=function(_0x4207a6,_0x3a3110){_0x4207a6=_0x4207a6-0x0;var _0x42b37a=_0x4b0f[_0x4207a6];return _0x42b37a;};'use strict';function SalesforceAccount(_0x4a41de){this['id']=_0x4a41de['id']||0x0;this[_0xf4b0('0x0')]=_0x4a41de[_0xf4b0('0x0')]||'';this[_0xf4b0('0x1')]=_0x4a41de[_0xf4b0('0x1')]||'';this['remoteUri']=_0x4a41de[_0xf4b0('0x2')]||'';this['password']=_0x4a41de['password']||'';this[_0xf4b0('0x3')]=_0x4a41de[_0xf4b0('0x3')]||'';this[_0xf4b0('0x4')]=_0x4a41de['clientSecret']||'';this['securityToken']=_0x4a41de[_0xf4b0('0x5')]||'';this[_0xf4b0('0x6')]=_0x4a41de[_0xf4b0('0x6')]||_0xf4b0('0x7');this[_0xf4b0('0x8')]=_0x4a41de[_0xf4b0('0x8')]||'';this[_0xf4b0('0x9')]=_0x4a41de[_0xf4b0('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xd96d=['name','username','remoteUri','password','clientSecret','securityToken','type','serverUrl'];(function(_0x4c99d0,_0x1febe1){var _0x5e541f=function(_0x6a83e5){while(--_0x6a83e5){_0x4c99d0['push'](_0x4c99d0['shift']());}};_0x5e541f(++_0x1febe1);}(_0xd96d,0x160));var _0xdd96=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xd96d[_0x5447fd];return _0x15b28a;};'use strict';function SalesforceAccount(_0x417393){this['id']=_0x417393['id']||0x0;this[_0xdd96('0x0')]=_0x417393['name']||'';this['username']=_0x417393[_0xdd96('0x1')]||'';this[_0xdd96('0x2')]=_0x417393[_0xdd96('0x2')]||'';this[_0xdd96('0x3')]=_0x417393['password']||'';this['clientId']=_0x417393['clientId']||'';this[_0xdd96('0x4')]=_0x417393[_0xdd96('0x4')]||'';this[_0xdd96('0x5')]=_0x417393[_0xdd96('0x5')]||'';this[_0xdd96('0x6')]=_0x417393['type']||'integrationTab';this['serverUrl']=_0x417393[_0xdd96('0x7')]||'';this['Configurations']=_0x417393['Configurations']||{};}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 72e25e3..8347371 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 _0x721e=['remoteUri','Configurations','exports','name','password'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x721e,0x8f));var _0xe721=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x721e[_0x3dd15e];return _0x231fd0;};'use strict';function ServicenowAccount(_0x12cc5e){this['id']=_0x12cc5e['id']||0x0;this[_0xe721('0x0')]=_0x12cc5e['name']||'';this['username']=_0x12cc5e['username']||'';this[_0xe721('0x1')]=_0x12cc5e[_0xe721('0x1')]||'';this[_0xe721('0x2')]=_0x12cc5e[_0xe721('0x2')]||'';this['serverUrl']=_0x12cc5e['serverUrl']||'';this[_0xe721('0x3')]=_0x12cc5e[_0xe721('0x3')]||{};}module[_0xe721('0x4')]=ServicenowAccount; \ No newline at end of file +var _0x3558=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x521897,_0x37a068){var _0x371b73=function(_0x289d71){while(--_0x289d71){_0x521897['push'](_0x521897['shift']());}};_0x371b73(++_0x37a068);}(_0x3558,0xb4));var _0x8355=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x3558[_0x4ff09b];return _0x3f5c2e;};'use strict';function ServicenowAccount(_0x1a6f9d){this['id']=_0x1a6f9d['id']||0x0;this['name']=_0x1a6f9d[_0x8355('0x0')]||'';this[_0x8355('0x1')]=_0x1a6f9d[_0x8355('0x1')]||'';this[_0x8355('0x2')]=_0x1a6f9d[_0x8355('0x2')]||'';this[_0x8355('0x3')]=_0x1a6f9d[_0x8355('0x3')]||'';this[_0x8355('0x4')]=_0x1a6f9d[_0x8355('0x4')]||'';this[_0x8355('0x5')]=_0x1a6f9d[_0x8355('0x5')]||{};}module[_0x8355('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index e87d4d9..c7f2b6b 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 _0x477b=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x234f7b,_0x3091a9){var _0x45f03c=function(_0x3d15bf){while(--_0x3d15bf){_0x234f7b['push'](_0x234f7b['shift']());}};_0x45f03c(++_0x3091a9);}(_0x477b,0x18c));var _0xb477=function(_0x2547a9,_0x437d2c){_0x2547a9=_0x2547a9-0x0;var _0x56b259=_0x477b[_0x2547a9];return _0x56b259;};'use strict';function SugarcrmAccount(_0x593367){this['id']=_0x593367['id']||0x0;this['name']=_0x593367[_0xb477('0x0')]||'';this[_0xb477('0x1')]=_0x593367['username']||'';this[_0xb477('0x2')]=_0x593367['password']||'';this[_0xb477('0x3')]=_0x593367[_0xb477('0x3')]||'';this[_0xb477('0x4')]=_0x593367[_0xb477('0x4')]||'';this[_0xb477('0x5')]=_0x593367['Configurations']||{};}module[_0xb477('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x1cf6=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x1e83c8,_0x356993){var _0x43e5ab=function(_0x301f06){while(--_0x301f06){_0x1e83c8['push'](_0x1e83c8['shift']());}};_0x43e5ab(++_0x356993);}(_0x1cf6,0xb6));var _0x61cf=function(_0x5d9e3b,_0x44b87a){_0x5d9e3b=_0x5d9e3b-0x0;var _0x3790d8=_0x1cf6[_0x5d9e3b];return _0x3790d8;};'use strict';function SugarcrmAccount(_0x2b2616){this['id']=_0x2b2616['id']||0x0;this['name']=_0x2b2616[_0x61cf('0x0')]||'';this[_0x61cf('0x1')]=_0x2b2616[_0x61cf('0x1')]||'';this[_0x61cf('0x2')]=_0x2b2616[_0x61cf('0x2')]||'';this[_0x61cf('0x3')]=_0x2b2616[_0x61cf('0x3')]||'';this[_0x61cf('0x4')]=_0x2b2616['serverUrl']||'';this[_0x61cf('0x5')]=_0x2b2616['Configurations']||{};}module[_0x61cf('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 cb02d7c..5e81913 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 _0xf2fa=['unknown','stateTime','status','accountcode','state'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf2fa,0xd0));var _0xaf2f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf2fa[_0x20a584];return _0x4b41a8;};'use strict';function Telephone(_0x250864){this['id']=_0x250864['id']||0x0;this['name']=_0x250864['name']||'';this[_0xaf2f('0x0')]=_0x250864[_0xaf2f('0x0')]||'';this[_0xaf2f('0x1')]=_0xaf2f('0x2');this[_0xaf2f('0x3')]=0x0;this[_0xaf2f('0x4')]=_0xaf2f('0x2');this['address']='';}module['exports']=Telephone; \ No newline at end of file +var _0xd08c=['stateTime','status','exports','name','accountcode','state','unknown'];(function(_0x4c7b20,_0x361515){var _0x4872bd=function(_0x358e19){while(--_0x358e19){_0x4c7b20['push'](_0x4c7b20['shift']());}};_0x4872bd(++_0x361515);}(_0xd08c,0x106));var _0xcd08=function(_0x25bad6,_0x13e776){_0x25bad6=_0x25bad6-0x0;var _0x4ab3c2=_0xd08c[_0x25bad6];return _0x4ab3c2;};'use strict';function Telephone(_0x6781f0){this['id']=_0x6781f0['id']||0x0;this[_0xcd08('0x0')]=_0x6781f0[_0xcd08('0x0')]||'';this[_0xcd08('0x1')]=_0x6781f0[_0xcd08('0x1')]||'';this[_0xcd08('0x2')]=_0xcd08('0x3');this[_0xcd08('0x4')]=0x0;this[_0xcd08('0x5')]=_0xcd08('0x3');this['address']='';}module[_0xcd08('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 5ddda7b..e2e4272 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(_0x20b84c,_0x352583){var _0x5e2695=function(_0x27804b){while(--_0x27804b){_0x20b84c['push'](_0x20b84c['shift']());}};_0x5e2695(++_0x352583);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 _0xb10b=['name','html'];(function(_0xbb3e24,_0x62458){var _0x555cbc=function(_0x4c7c68){while(--_0x4c7c68){_0xbb3e24['push'](_0xbb3e24['shift']());}};_0x555cbc(++_0x62458);}(_0xb10b,0x12a));var _0xbb10=function(_0x1979d8,_0x10d8f2){_0x1979d8=_0x1979d8-0x0;var _0x1d5bb3=_0xb10b[_0x1979d8];return _0x1d5bb3;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index a1c04e2..eeffa31 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 _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x1882ca,_0x17ecf9){var _0x2723d0=function(_0xb4d2f5){while(--_0xb4d2f5){_0x1882ca['push'](_0x1882ca['shift']());}};_0x2723d0(++_0x17ecf9);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x14ef63,_0x172bb2){_0x14ef63=_0x14ef63-0x0;var _0x3d9ab9=_0x9ffd[_0x14ef63];return _0x3d9ab9;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file +var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x1a78ac,_0x260dde){var _0x29c84e=function(_0x2ead32){while(--_0x2ead32){_0x1a78ac['push'](_0x1a78ac['shift']());}};_0x29c84e(++_0x260dde);}(_0xb10b,0x12a));var _0xbb10=function(_0x477575,_0xf4784b){_0x477575=_0x477575-0x0;var _0x3b3751=_0xb10b[_0x477575];return _0x3b3751;};'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 e8b732d..cd563e0 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 _0x1d64=['indexOf','port','domain','refresh','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry'];(function(_0x130cf1,_0x19b0f0){var _0x237cb0=function(_0x52ecc3){while(--_0x52ecc3){_0x130cf1['push'](_0x130cf1['shift']());}};_0x237cb0(++_0x19b0f0);}(_0x1d64,0x1d5));var _0x41d6=function(_0x503564,_0x55867e){_0x503564=_0x503564-0x0;var _0x4be9fd=_0x1d64[_0x503564];return _0x4be9fd;};'use strict';function Trunk(_0x424896){this['id']=_0x424896['id']||0x0;this[_0x41d6('0x0')]=_0x424896['active']||![];this[_0x41d6('0x1')]=_0x424896[_0x41d6('0x1')]||'';this[_0x41d6('0x2')]=_0x41d6('0x3');this[_0x41d6('0x4')]=0x0;this[_0x41d6('0x5')]=_0x41d6('0x3');this[_0x41d6('0x6')]=_0x424896[_0x41d6('0x6')]&&_0x424896[_0x41d6('0x6')][_0x41d6('0x7')](':')?_0x424896[_0x41d6('0x6')]['split'](':')[0x0]:'';this['host']='';this[_0x41d6('0x8')]='';this[_0x41d6('0x9')]='';this['domainport']='';this[_0x41d6('0xa')]='';this['stateRegistry']='unknown';this['registrationtime']='';this[_0x41d6('0xb')]='';this[_0x41d6('0xc')]=_0x424896[_0x41d6('0xc')]||'';}module[_0x41d6('0xd')]=Trunk; \ No newline at end of file +var _0x3ee5=['address','defaultuser','active','name','state','unknown','stateTime','status','registry','host','port','domainport','refresh','stateRegistry'];(function(_0x2948a6,_0x45ac77){var _0x51c538=function(_0x94faa2){while(--_0x94faa2){_0x2948a6['push'](_0x2948a6['shift']());}};_0x51c538(++_0x45ac77);}(_0x3ee5,0x144));var _0x53ee=function(_0xa313db,_0x4927f7){_0xa313db=_0xa313db-0x0;var _0x4332fb=_0x3ee5[_0xa313db];return _0x4332fb;};'use strict';function Trunk(_0x56b268){this['id']=_0x56b268['id']||0x0;this[_0x53ee('0x0')]=_0x56b268[_0x53ee('0x0')]||![];this[_0x53ee('0x1')]=_0x56b268[_0x53ee('0x1')]||'';this[_0x53ee('0x2')]=_0x53ee('0x3');this[_0x53ee('0x4')]=0x0;this[_0x53ee('0x5')]=_0x53ee('0x3');this[_0x53ee('0x6')]=_0x56b268[_0x53ee('0x6')]&&_0x56b268[_0x53ee('0x6')]['indexOf'](':')?_0x56b268[_0x53ee('0x6')]['split'](':')[0x0]:'';this[_0x53ee('0x7')]='';this[_0x53ee('0x8')]='';this['domain']='';this[_0x53ee('0x9')]='';this[_0x53ee('0xa')]='';this[_0x53ee('0xb')]=_0x53ee('0x3');this['registrationtime']='';this[_0x53ee('0xc')]='';this[_0x53ee('0xd')]=_0x56b268[_0x53ee('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 2331eab..1543888 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 _0xaa61=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x167593,_0x1558ba){var _0x14e036=function(_0x4990d9){while(--_0x4990d9){_0x167593['push'](_0x167593['shift']());}};_0x14e036(++_0x1558ba);}(_0xaa61,0x12f));var _0x1aa6=function(_0x59761d,_0x2ff98f){_0x59761d=_0x59761d-0x0;var _0x2a5031=_0xaa61[_0x59761d];return _0x2a5031;};'use strict';function voiceExtension(_0xbfcdb){this['id']=_0xbfcdb['id']||0x0;this[_0x1aa6('0x0')]=_0xbfcdb[_0x1aa6('0x0')]||'';this[_0x1aa6('0x1')]=_0xbfcdb[_0x1aa6('0x1')]||'none';this[_0x1aa6('0x2')]=_0xbfcdb['mandatoryDisposition']||![];}module[_0x1aa6('0x3')]=voiceExtension; \ No newline at end of file +var _0x2ce8=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x50961c,_0x2cbfe9){var _0x20b2fb=function(_0x3cee03){while(--_0x3cee03){_0x50961c['push'](_0x50961c['shift']());}};_0x20b2fb(++_0x2cbfe9);}(_0x2ce8,0x109));var _0x82ce=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0x2ce8[_0x3f8a03];return _0x147fb2;};'use strict';function voiceExtension(_0x4e83d3){this['id']=_0x4e83d3['id']||0x0;this[_0x82ce('0x0')]=_0x4e83d3[_0x82ce('0x0')]||'';this['recordingFormat']=_0x4e83d3[_0x82ce('0x1')]||_0x82ce('0x2');this[_0x82ce('0x3')]=_0x4e83d3[_0x82ce('0x3')]||![];}module[_0x82ce('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 d8115a7..6ff0886 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 _0xc0d2=['dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','unavailable','ringinuse','onhold','wav49','gsm','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','answered','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x56d04c,_0x3762c4){var _0x278a10=function(_0x420def){while(--_0x420def){_0x56d04c['push'](_0x56d04c['shift']());}};_0x278a10(++_0x3762c4);}(_0xc0d2,0x191));var _0x2c0d=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xc0d2[_0x36eaaa];return _0x461349;};'use strict';var statusDesc=['unknown',_0x2c0d('0x0'),_0x2c0d('0x1'),_0x2c0d('0x2'),'invalid',_0x2c0d('0x3'),'ringing',_0x2c0d('0x4'),_0x2c0d('0x5')];var monitorFormat={'wav':'wav','wav49':_0x2c0d('0x6'),'gsm':_0x2c0d('0x7')};var strategy={'rrmemory':_0x2c0d('0x8'),'roundrobin':'roundrobin'};function VoiceQueue(_0x12258b){this['id']=_0x12258b['id']||0x0;this['name']=_0x12258b[_0x2c0d('0x9')]||'';this[_0x2c0d('0xa')]=_0x12258b['monitor_format']||'';this['type']=_0x12258b[_0x2c0d('0xb')]||_0x2c0d('0xc');this[_0x2c0d('0xd')]=0x0;this[_0x2c0d('0xe')]=0x0;this[_0x2c0d('0xf')]=0x0;this[_0x2c0d('0x10')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x2c0d('0x11')]=0x0;this[_0x2c0d('0x12')]=0x0;this[_0x2c0d('0x13')]=0x0;this[_0x2c0d('0x14')]=0x0;this[_0x2c0d('0x15')]=0x0;this[_0x2c0d('0x16')]=_0x12258b[_0x2c0d('0x16')]||![];this[_0x2c0d('0x17')]=_0x12258b[_0x2c0d('0x17')]||0xa;this[_0x2c0d('0x18')]=_0x12258b[_0x2c0d('0x18')]||'no';this[_0x2c0d('0x19')]=!![];this[_0x2c0d('0x1a')]='';this[_0x2c0d('0x1b')]=0x0;this[_0x2c0d('0x1c')]=0x0;this['dialTimezone']=_0x12258b[_0x2c0d('0x1d')]||null;this['dialGlobalInterval']=_0x12258b[_0x2c0d('0x1e')]?_0x12258b['dialGlobalInterval']:null;this['dialActive']=_0x12258b[_0x2c0d('0x1f')];this['dialMethod']=_0x12258b[_0x2c0d('0x20')]||_0x2c0d('0x21');this[_0x2c0d('0x22')]=_0x12258b[_0x2c0d('0x22')]||0x0;this[_0x2c0d('0x23')]=_0x12258b['dialLimitQueue']||0x0;this[_0x2c0d('0x24')]=_0x12258b[_0x2c0d('0x24')]||0x1;this['dialPredictiveOptimization']=_0x12258b[_0x2c0d('0x25')]||_0x2c0d('0x26');this[_0x2c0d('0x27')]=_0x12258b[_0x2c0d('0x27')]||0.03;this[_0x2c0d('0x28')]=_0x12258b[_0x2c0d('0x28')]||0x258;this['dialOriginateCallerIdName']=_0x12258b['dialOriginateCallerIdName']||_0x2c0d('0x29');this[_0x2c0d('0x2a')]=_0x12258b['dialOriginateCallerIdNumber']||'anonymous';this[_0x2c0d('0x2b')]=_0x12258b[_0x2c0d('0x2b')]||0x1e;this['dialQueueOptions']=_0x12258b['dialQueueOptions']||'tTxX';this[_0x2c0d('0x2c')]=_0x12258b['dialQueueTimeout']||0x3;this[_0x2c0d('0x2d')]=_0x12258b[_0x2c0d('0x2d')]||undefined;this[_0x2c0d('0x2e')]=_0x12258b[_0x2c0d('0x2e')]||0x3;this['dialCongestionRetryFrequency']=_0x12258b[_0x2c0d('0x2f')]||0x96;this[_0x2c0d('0x30')]=_0x12258b[_0x2c0d('0x30')]||0x3;this[_0x2c0d('0x31')]=_0x12258b[_0x2c0d('0x31')]||0x96;this[_0x2c0d('0x32')]=_0x12258b[_0x2c0d('0x32')]||0x3;this[_0x2c0d('0x33')]=_0x12258b[_0x2c0d('0x33')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x12258b['dialNoSuchNumberMaxRetry']||0x3;this[_0x2c0d('0x34')]=_0x12258b[_0x2c0d('0x34')]||0x96;this['dialDropMaxRetry']=_0x12258b[_0x2c0d('0x35')]||0x3;this['dialDropRetryFrequency']=_0x12258b[_0x2c0d('0x36')]||0x96;this[_0x2c0d('0x37')]=_0x12258b[_0x2c0d('0x37')]||0x3;this[_0x2c0d('0x38')]=_0x12258b[_0x2c0d('0x38')]||0x96;this[_0x2c0d('0x39')]=_0x12258b['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x12258b[_0x2c0d('0x3a')]||0x96;this[_0x2c0d('0x3b')]=_0x12258b[_0x2c0d('0x3b')]||0x3;this[_0x2c0d('0x3c')]=_0x12258b[_0x2c0d('0x3c')]||0x96;this['dialGlobalMaxRetry']=_0x12258b[_0x2c0d('0x3d')]||0x4;this[_0x2c0d('0x3e')]=_0x12258b[_0x2c0d('0x3e')]?_0x12258b[_0x2c0d('0x3e')]:undefined;this[_0x2c0d('0x3f')]=_0x12258b[_0x2c0d('0x3f')]?_0x12258b['TrunkBackup']:undefined;this[_0x2c0d('0x40')]=_0x12258b['dialPrefix']||undefined;this[_0x2c0d('0x41')]=_0x12258b['Interval']?_0x12258b[_0x2c0d('0x41')]:undefined;this[_0x2c0d('0x42')]=_0x12258b['dialOrderByScheduledAt']||_0x2c0d('0x43');this[_0x2c0d('0x44')]=_0x12258b[_0x2c0d('0x44')]||undefined;this[_0x2c0d('0x45')]=_0x12258b[_0x2c0d('0x45')]||undefined;this[_0x2c0d('0x46')]=strategy[_0x12258b[_0x2c0d('0x46')]]||_0x2c0d('0x8');this[_0x2c0d('0x47')]=!![];this[_0x2c0d('0x48')]=_0x12258b[_0x2c0d('0x48')]||![];this[_0x2c0d('0x49')]=_0x12258b['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x12258b[_0x2c0d('0x4a')];this[_0x2c0d('0x4b')]=_0x12258b[_0x2c0d('0x4b')];this['dialAMDTotalAnalysisTime']=_0x12258b['dialAMDTotalAnalysisTime'];this[_0x2c0d('0x4c')]=_0x12258b['dialAMDMinWordLength'];this[_0x2c0d('0x4d')]=_0x12258b['dialAMDBetweenWordsSilence'];this[_0x2c0d('0x4e')]=_0x12258b[_0x2c0d('0x4e')];this[_0x2c0d('0x4f')]=_0x12258b[_0x2c0d('0x4f')];this[_0x2c0d('0x50')]=_0x12258b[_0x2c0d('0x50')];this[_0x2c0d('0x51')]=0x0;this[_0x2c0d('0x52')]=0x0;this[_0x2c0d('0x53')]=_0x12258b[_0x2c0d('0x53')];this[_0x2c0d('0x54')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x2c0d('0x55')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x2c0d('0x56')]=0x0;this[_0x2c0d('0x57')]=0x0;this[_0x2c0d('0x58')]=0x0;this[_0x2c0d('0x59')]=0x0;this[_0x2c0d('0x5a')]=0x0;this[_0x2c0d('0x5b')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x2c0d('0x5c')]=0x0;this[_0x2c0d('0x5d')]=0x0;this[_0x2c0d('0x5e')]=undefined;this['startPredictive']=undefined;this[_0x2c0d('0x5f')]=undefined;this[_0x2c0d('0x60')]=1.05;this[_0x2c0d('0x61')]=0x0;this[_0x2c0d('0x62')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x2c0d('0x63')]=0x0;this[_0x2c0d('0x64')]=0x0;this[_0x2c0d('0x65')]=0x0;this[_0x2c0d('0x66')]=0x0;this[_0x2c0d('0x67')]=_0x12258b[_0x2c0d('0x68')]||0x14;this[_0x2c0d('0x69')]=_0x12258b[_0x2c0d('0x68')]||0xa;this[_0x2c0d('0x6a')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x2c0d('0x6b')]=0x1;this[_0x2c0d('0x6c')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x2c0d('0x6d')]=_0x12258b[_0x2c0d('0x6d')]||0x1e;this[_0x2c0d('0x6e')]=_0x12258b[_0x2c0d('0x6e')]||![];this[_0x2c0d('0x6f')]=!!_0x12258b['dialPreviewAutoRecallMe']||![];this[_0x2c0d('0x70')]=!!_0x12258b['dialPreviewRecallmeReminder']||![];this[_0x2c0d('0x71')]=_0x12258b[_0x2c0d('0x71')]||undefined;this['dialAgiAfterHangupClient']=_0x12258b[_0x2c0d('0x72')]||![];this[_0x2c0d('0x73')]=_0x12258b['dialAgiAfterHangupAgent']||![];this[_0x2c0d('0xa')]=monitorFormat[_0x12258b[_0x2c0d('0xa')]]?monitorFormat[_0x12258b[_0x2c0d('0xa')]]:undefined;this[_0x2c0d('0x74')]=_0x12258b[_0x2c0d('0x74')]||![];this[_0x2c0d('0x75')]=_0x12258b[_0x2c0d('0x75')]?_0x12258b[_0x2c0d('0x75')]:undefined;}module[_0x2c0d('0x76')]=VoiceQueue; \ No newline at end of file +var _0xe429=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','message','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x1a0678,_0x4bc6e8){var _0x214a03=function(_0x4eba54){while(--_0x4eba54){_0x1a0678['push'](_0x1a0678['shift']());}};_0x214a03(++_0x4bc6e8);}(_0xe429,0x13f));var _0x9e42=function(_0x294edf,_0x2be854){_0x294edf=_0x294edf-0x0;var _0x2aeb8f=_0xe429[_0x294edf];return _0x2aeb8f;};'use strict';var statusDesc=[_0x9e42('0x0'),_0x9e42('0x1'),_0x9e42('0x2'),_0x9e42('0x3'),_0x9e42('0x4'),_0x9e42('0x5'),_0x9e42('0x6'),_0x9e42('0x7'),_0x9e42('0x8')];var monitorFormat={'wav':_0x9e42('0x9'),'wav49':_0x9e42('0xa'),'gsm':_0x9e42('0xb')};var strategy={'rrmemory':_0x9e42('0xc'),'roundrobin':_0x9e42('0xd')};function VoiceQueue(_0x2cc305){this['id']=_0x2cc305['id']||0x0;this['name']=_0x2cc305[_0x9e42('0xe')]||'';this['monitor_format']=_0x2cc305[_0x9e42('0xf')]||'';this['type']=_0x2cc305[_0x9e42('0x10')]||_0x9e42('0x11');this[_0x9e42('0x12')]=0x0;this['talking']=0x0;this[_0x9e42('0x13')]=0x0;this[_0x9e42('0x14')]=0x0;this[_0x9e42('0x15')]=0x0;this['sumHoldTime']=0x0;this[_0x9e42('0x16')]=0x0;this['unmanaged']=0x0;this[_0x9e42('0x17')]=0x0;this[_0x9e42('0x18')]=0x0;this[_0x9e42('0x19')]=0x0;this[_0x9e42('0x1a')]=_0x2cc305[_0x9e42('0x1a')]||![];this['acwTimeout']=_0x2cc305[_0x9e42('0x1b')]||0xa;this['autopause']=_0x2cc305['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x9e42('0x1c')]='';this['originated']=0x0;this['temp']=0x0;this[_0x9e42('0x1d')]=_0x2cc305[_0x9e42('0x1d')]||null;this[_0x9e42('0x1e')]=_0x2cc305[_0x9e42('0x1e')]?_0x2cc305[_0x9e42('0x1e')]:null;this[_0x9e42('0x1f')]=_0x2cc305[_0x9e42('0x1f')];this[_0x9e42('0x20')]=_0x2cc305['dialMethod']||'progressive';this['dialLimitChannel']=_0x2cc305[_0x9e42('0x21')]||0x0;this[_0x9e42('0x22')]=_0x2cc305[_0x9e42('0x22')]||0x0;this[_0x9e42('0x23')]=_0x2cc305[_0x9e42('0x23')]||0x1;this['dialPredictiveOptimization']=_0x2cc305[_0x9e42('0x24')]||_0x9e42('0x25');this['dialPredictiveOptimizationPercentage']=_0x2cc305['dialPredictiveOptimizationPercentage']||0.03;this[_0x9e42('0x26')]=_0x2cc305[_0x9e42('0x26')]||0x258;this[_0x9e42('0x27')]=_0x2cc305[_0x9e42('0x27')]||_0x9e42('0x28');this['dialOriginateCallerIdNumber']=_0x2cc305[_0x9e42('0x29')]||_0x9e42('0x28');this[_0x9e42('0x2a')]=_0x2cc305[_0x9e42('0x2a')]||0x1e;this['dialQueueOptions']=_0x2cc305['dialQueueOptions']||_0x9e42('0x2b');this[_0x9e42('0x2c')]=_0x2cc305[_0x9e42('0x2c')]||0x3;this[_0x9e42('0x2d')]=_0x2cc305['dialQueueProject']||undefined;this[_0x9e42('0x2e')]=_0x2cc305[_0x9e42('0x2e')]||0x3;this['dialCongestionRetryFrequency']=_0x2cc305[_0x9e42('0x2f')]||0x96;this[_0x9e42('0x30')]=_0x2cc305[_0x9e42('0x30')]||0x3;this['dialBusyRetryFrequency']=_0x2cc305[_0x9e42('0x31')]||0x96;this['dialNoAnswerMaxRetry']=_0x2cc305[_0x9e42('0x32')]||0x3;this['dialNoAnswerRetryFrequency']=_0x2cc305[_0x9e42('0x33')]||0x96;this[_0x9e42('0x34')]=_0x2cc305['dialNoSuchNumberMaxRetry']||0x3;this[_0x9e42('0x35')]=_0x2cc305['dialNoSuchNumberRetryFrequency']||0x96;this[_0x9e42('0x36')]=_0x2cc305[_0x9e42('0x36')]||0x3;this['dialDropRetryFrequency']=_0x2cc305[_0x9e42('0x37')]||0x96;this[_0x9e42('0x38')]=_0x2cc305[_0x9e42('0x38')]||0x3;this[_0x9e42('0x39')]=_0x2cc305[_0x9e42('0x39')]||0x96;this[_0x9e42('0x3a')]=_0x2cc305['dialMachineMaxRetry']||0x3;this[_0x9e42('0x3b')]=_0x2cc305[_0x9e42('0x3b')]||0x96;this[_0x9e42('0x3c')]=_0x2cc305[_0x9e42('0x3c')]||0x3;this[_0x9e42('0x3d')]=_0x2cc305[_0x9e42('0x3d')]||0x96;this['dialGlobalMaxRetry']=_0x2cc305[_0x9e42('0x3e')]||0x4;this[_0x9e42('0x3f')]=_0x2cc305[_0x9e42('0x3f')]?_0x2cc305[_0x9e42('0x3f')]:undefined;this['TrunkBackup']=_0x2cc305[_0x9e42('0x40')]?_0x2cc305['TrunkBackup']:undefined;this['dialPrefix']=_0x2cc305[_0x9e42('0x41')]||undefined;this[_0x9e42('0x42')]=_0x2cc305[_0x9e42('0x42')]?_0x2cc305[_0x9e42('0x42')]:undefined;this[_0x9e42('0x43')]=_0x2cc305['dialOrderByScheduledAt']||_0x9e42('0x44');this[_0x9e42('0x45')]=_0x2cc305[_0x9e42('0x45')]||undefined;this[_0x9e42('0x46')]=_0x2cc305['dialCutDigit']||undefined;this['strategy']=strategy[_0x2cc305['strategy']]||_0x9e42('0xc');this[_0x9e42('0x47')]=!![];this['dialAMDActive']=_0x2cc305['dialAMDActive']||![];this[_0x9e42('0x48')]=_0x2cc305[_0x9e42('0x48')];this[_0x9e42('0x49')]=_0x2cc305[_0x9e42('0x49')];this[_0x9e42('0x4a')]=_0x2cc305[_0x9e42('0x4a')];this[_0x9e42('0x4b')]=_0x2cc305[_0x9e42('0x4b')];this[_0x9e42('0x4c')]=_0x2cc305[_0x9e42('0x4c')];this['dialAMDBetweenWordsSilence']=_0x2cc305[_0x9e42('0x4d')];this[_0x9e42('0x4e')]=_0x2cc305[_0x9e42('0x4e')];this[_0x9e42('0x4f')]=_0x2cc305[_0x9e42('0x4f')];this[_0x9e42('0x50')]=_0x2cc305[_0x9e42('0x50')];this[_0x9e42('0x51')]=0x0;this['pTalking']=0x0;this[_0x9e42('0x52')]=_0x2cc305[_0x9e42('0x52')];this['outboundAnswerCallsDay']=0x0;this[_0x9e42('0x53')]=0x0;this[_0x9e42('0x54')]=0x0;this[_0x9e42('0x55')]=0x0;this[_0x9e42('0x56')]=0x0;this[_0x9e42('0x57')]=0x0;this[_0x9e42('0x58')]=0x0;this[_0x9e42('0x59')]=0x0;this[_0x9e42('0x5a')]=0x0;this[_0x9e42('0x5b')]=0x0;this[_0x9e42('0x5c')]=0x0;this[_0x9e42('0x5d')]=0x0;this[_0x9e42('0x5e')]=0x0;this[_0x9e42('0x5f')]=0x0;this['startProgressive']=undefined;this[_0x9e42('0x60')]=undefined;this[_0x9e42('0x61')]=undefined;this[_0x9e42('0x62')]=1.05;this[_0x9e42('0x63')]=0x0;this[_0x9e42('0x64')]=0x0;this[_0x9e42('0x65')]=0x0;this[_0x9e42('0x66')]=0x0;this[_0x9e42('0x67')]=0x0;this[_0x9e42('0x68')]=0x0;this[_0x9e42('0x69')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x9e42('0x6a')]=_0x2cc305[_0x9e42('0x6b')]||0x14;this[_0x9e42('0x6c')]=_0x2cc305[_0x9e42('0x6b')]||0xa;this[_0x9e42('0x6d')]=0x0;this[_0x9e42('0x6e')]=0x0;this[_0x9e42('0x6f')]=0x1;this[_0x9e42('0x70')]=0x0;this[_0x9e42('0x71')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x9e42('0x72')]=0x0;this[_0x9e42('0x73')]=_0x2cc305[_0x9e42('0x73')]||0x1e;this[_0x9e42('0x74')]=_0x2cc305['dialRecallInQueue']||![];this[_0x9e42('0x75')]=!!_0x2cc305[_0x9e42('0x75')]||![];this[_0x9e42('0x76')]=!!_0x2cc305['dialPreviewRecallmeReminder']||![];this[_0x9e42('0x77')]=_0x2cc305[_0x9e42('0x77')]||undefined;this[_0x9e42('0x78')]=_0x2cc305['dialAgiAfterHangupClient']||![];this[_0x9e42('0x79')]=_0x2cc305[_0x9e42('0x79')]||![];this[_0x9e42('0xf')]=monitorFormat[_0x2cc305[_0x9e42('0xf')]]?monitorFormat[_0x2cc305[_0x9e42('0xf')]]:undefined;this['mandatoryDisposition']=_0x2cc305[_0x9e42('0x7a')]||![];this['mandatoryDispositionPause']=_0x2cc305['mandatoryDispositionPause']?_0x2cc305[_0x9e42('0x7b')]:undefined;}module[_0x9e42('0x7c')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 60a5620..b23fa62 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 _0x225d=['exports','username','accessKey','remoteUri','Configurations'];(function(_0x5846a7,_0x3c15dd){var _0x2ea24a=function(_0x1de18c){while(--_0x1de18c){_0x5846a7['push'](_0x5846a7['shift']());}};_0x2ea24a(++_0x3c15dd);}(_0x225d,0xc4));var _0xd225=function(_0x4d53ce,_0x53b2d3){_0x4d53ce=_0x4d53ce-0x0;var _0xc823a8=_0x225d[_0x4d53ce];return _0xc823a8;};'use strict';function VtigerAccount(_0x26fd1a){this['id']=_0x26fd1a['id']||0x0;this['name']=_0x26fd1a['name']||'';this[_0xd225('0x0')]=_0x26fd1a['username']||'';this[_0xd225('0x1')]=_0x26fd1a[_0xd225('0x1')]||'';this[_0xd225('0x2')]=_0x26fd1a[_0xd225('0x2')]||'';this['serverUrl']=_0x26fd1a['serverUrl']||'';this[_0xd225('0x3')]=_0x26fd1a[_0xd225('0x3')]||{};}module[_0xd225('0x4')]=VtigerAccount; \ No newline at end of file +var _0x8375=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x16dd98,_0x11d346){var _0xfc7fb3=function(_0x40d7d8){while(--_0x40d7d8){_0x16dd98['push'](_0x16dd98['shift']());}};_0xfc7fb3(++_0x11d346);}(_0x8375,0xa8));var _0x5837=function(_0x566bb4,_0x4ccc39){_0x566bb4=_0x566bb4-0x0;var _0x95d4cc=_0x8375[_0x566bb4];return _0x95d4cc;};'use strict';function VtigerAccount(_0x223867){this['id']=_0x223867['id']||0x0;this[_0x5837('0x0')]=_0x223867[_0x5837('0x0')]||'';this['username']=_0x223867[_0x5837('0x1')]||'';this[_0x5837('0x2')]=_0x223867[_0x5837('0x2')]||'';this[_0x5837('0x3')]=_0x223867[_0x5837('0x3')]||'';this[_0x5837('0x4')]=_0x223867['serverUrl']||'';this[_0x5837('0x5')]=_0x223867[_0x5837('0x5')]||{};}module[_0x5837('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 8ccd0d0..ef7100e 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 _0x1423=['integrationTab','serverUrl','Configurations','exports','username','password','token','remoteUri','authType','type'];(function(_0x574f72,_0x49654b){var _0x140998=function(_0xf7ecda){while(--_0xf7ecda){_0x574f72['push'](_0x574f72['shift']());}};_0x140998(++_0x49654b);}(_0x1423,0x130));var _0x3142=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1423[_0x2641f9];return _0x585741;};'use strict';function ZendeskAccount(_0x6dd219){this['id']=_0x6dd219['id']||0x0;this['name']=_0x6dd219['name']||'';this[_0x3142('0x0')]=_0x6dd219[_0x3142('0x0')]||'';this[_0x3142('0x1')]=_0x6dd219[_0x3142('0x1')]||'';this[_0x3142('0x2')]=_0x6dd219['token']||'';this['remoteUri']=_0x6dd219[_0x3142('0x3')]||'';this[_0x3142('0x4')]=_0x6dd219[_0x3142('0x4')]||'';this[_0x3142('0x5')]=_0x6dd219[_0x3142('0x5')]||_0x3142('0x6');this[_0x3142('0x7')]=_0x6dd219['serverUrl']||'';this[_0x3142('0x8')]=_0x6dd219[_0x3142('0x8')]||{};}module[_0x3142('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xd399=['type','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xd399,0x19e));var _0x9d39=function(_0xb18da0,_0x32f108){_0xb18da0=_0xb18da0-0x0;var _0x5ee830=_0xd399[_0xb18da0];return _0x5ee830;};'use strict';function ZendeskAccount(_0x151cab){this['id']=_0x151cab['id']||0x0;this[_0x9d39('0x0')]=_0x151cab[_0x9d39('0x0')]||'';this[_0x9d39('0x1')]=_0x151cab[_0x9d39('0x1')]||'';this['password']=_0x151cab[_0x9d39('0x2')]||'';this[_0x9d39('0x3')]=_0x151cab['token']||'';this[_0x9d39('0x4')]=_0x151cab[_0x9d39('0x4')]||'';this[_0x9d39('0x5')]=_0x151cab[_0x9d39('0x5')]||'';this[_0x9d39('0x6')]=_0x151cab[_0x9d39('0x6')]||'integrationTab';this[_0x9d39('0x7')]=_0x151cab[_0x9d39('0x7')]||'';this['Configurations']=_0x151cab[_0x9d39('0x8')]||{};}module[_0x9d39('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 5d433fc..5ad4478 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 _0xd786=['refreshToken','Configurations','exports','name','host','zone','clientId','clientSecret','serverUrl'];(function(_0x55333e,_0x9020fb){var _0x223f9c=function(_0x1054a9){while(--_0x1054a9){_0x55333e['push'](_0x55333e['shift']());}};_0x223f9c(++_0x9020fb);}(_0xd786,0x81));var _0x6d78=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xd786[_0x31e29a];return _0x32d892;};'use strict';function ZohoAccount(_0x5dd7f1){this['id']=_0x5dd7f1['id']||0x0;this[_0x6d78('0x0')]=_0x5dd7f1[_0x6d78('0x0')]||'';this['description']=_0x5dd7f1['description']||'';this[_0x6d78('0x1')]=_0x5dd7f1[_0x6d78('0x1')]||'';this[_0x6d78('0x2')]=_0x5dd7f1[_0x6d78('0x2')]||'';this[_0x6d78('0x3')]=_0x5dd7f1[_0x6d78('0x3')]||'';this[_0x6d78('0x4')]=_0x5dd7f1[_0x6d78('0x4')]||'';this[_0x6d78('0x5')]=_0x5dd7f1[_0x6d78('0x5')]||'';this['code']=_0x5dd7f1['code']||'';this['refreshToken']=_0x5dd7f1[_0x6d78('0x6')]||'';this['Configurations']=_0x5dd7f1[_0x6d78('0x7')]||{};}module[_0x6d78('0x8')]=ZohoAccount; \ No newline at end of file +var _0x6f63=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x9adade,_0x44e455){var _0x33b128=function(_0x2c610a){while(--_0x2c610a){_0x9adade['push'](_0x9adade['shift']());}};_0x33b128(++_0x44e455);}(_0x6f63,0xcc));var _0x36f6=function(_0x3f34b7,_0x299b4a){_0x3f34b7=_0x3f34b7-0x0;var _0x9c1300=_0x6f63[_0x3f34b7];return _0x9c1300;};'use strict';function ZohoAccount(_0x13a924){this['id']=_0x13a924['id']||0x0;this[_0x36f6('0x0')]=_0x13a924[_0x36f6('0x0')]||'';this[_0x36f6('0x1')]=_0x13a924[_0x36f6('0x1')]||'';this[_0x36f6('0x2')]=_0x13a924[_0x36f6('0x2')]||'';this[_0x36f6('0x3')]=_0x13a924[_0x36f6('0x3')]||'';this['clientId']=_0x13a924[_0x36f6('0x4')]||'';this[_0x36f6('0x5')]=_0x13a924[_0x36f6('0x5')]||'';this['serverUrl']=_0x13a924[_0x36f6('0x6')]||'';this[_0x36f6('0x7')]=_0x13a924[_0x36f6('0x7')]||'';this[_0x36f6('0x8')]=_0x13a924[_0x36f6('0x8')]||'';this['Configurations']=_0x13a924[_0x36f6('0x9')]||{};}module[_0x36f6('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 1bbf063..886cc5c 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 _0xb9f4=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','Agent','channelAgent','membername','format','SIP/%s','calleridname','phone','Contact','firstName','active','calleridnum','scheduledat','countbusyretry'];(function(_0x22ec8f,_0x151442){var _0x435512=function(_0x1fb802){while(--_0x1fb802){_0x22ec8f['push'](_0x22ec8f['shift']());}};_0x435512(++_0x151442);}(_0xb9f4,0x6d));var _0x4b9f=function(_0x262117,_0x2ce548){_0x262117=_0x262117-0x0;var _0x2a5beb=_0xb9f4[_0x262117];return _0x2a5beb;};'use strict';var util=require(_0x4b9f('0x0'));var _=require('lodash');var moment=require(_0x4b9f('0x1'));function checkNameSurname(_0x292377,_0x277e08,_0x3e23d9){var _0x208e68='';if(!_[_0x4b9f('0x2')](_0x277e08)&&'string'===typeof _0x277e08){_0x208e68+=_0x277e08;}if(!_[_0x4b9f('0x2')](_0x3e23d9)&&_0x4b9f('0x3')===typeof _0x3e23d9){_0x208e68+='\x20'+_0x3e23d9;}if(_0x208e68!==''){return _0x208e68;}return _0x292377;}function Action(_0x5835cd,_0x257920,_0x3982fc,_0x42f471,_0x2473f4){this[_0x4b9f('0x4')]=_0x3982fc||undefined;this[_0x4b9f('0x5')]=_0x5835cd['id'];this[_0x4b9f('0x6')]=_0x257920[_0x4b9f('0x7')];this[_0x4b9f('0x8')]=_0x257920[_0x4b9f('0x8')];this[_0x4b9f('0x9')]=_0x4b9f('0x6');this['dialAnswer']=![];this['membername']=_[_0x4b9f('0x2')](_0x5835cd['Agent'])?undefined:_0x5835cd[_0x4b9f('0xa')]['name'];this[_0x4b9f('0xb')]=this[_0x4b9f('0xc')]?util[_0x4b9f('0xd')](_0x4b9f('0xe'),this[_0x4b9f('0xc')]):_0x42f471||undefined;this[_0x4b9f('0xf')]=checkNameSurname(_0x5835cd['Contact'][_0x4b9f('0x10')],_0x5835cd[_0x4b9f('0x11')][_0x4b9f('0x12')],_0x5835cd[_0x4b9f('0x11')]['lastName']);this[_0x4b9f('0x13')]=_0x5835cd[_0x4b9f('0x13')]||![];this[_0x4b9f('0x14')]=_0x5835cd[_0x4b9f('0x11')]['phone'];this['scheduledat']=_0x5835cd[_0x4b9f('0x15')];this[_0x4b9f('0x16')]=_0x5835cd[_0x4b9f('0x16')]||0x0;this['countcongestionretry']=_0x5835cd[_0x4b9f('0x17')]||0x0;this[_0x4b9f('0x18')]=_0x5835cd[_0x4b9f('0x18')]||0x0;this[_0x4b9f('0x19')]=(_0x5835cd[_0x4b9f('0x16')]||0x0)+(_0x5835cd[_0x4b9f('0x17')]||0x0)+(_0x5835cd[_0x4b9f('0x18')]||0x0)+(_0x5835cd[_0x4b9f('0x1a')]||0x0)+(_0x5835cd[_0x4b9f('0x1b')]||0x0)+(_0x5835cd['countabandonedretry']||0x0)+(_0x5835cd[_0x4b9f('0x1c')]||0x0)+(_0x5835cd[_0x4b9f('0x1d')]||0x0);this[_0x4b9f('0x1a')]=_0x5835cd[_0x4b9f('0x1a')]||0x0;this[_0x4b9f('0x1b')]=_0x5835cd[_0x4b9f('0x1b')]||0x0;this[_0x4b9f('0x1e')]=_0x5835cd[_0x4b9f('0x1e')]||0x0;this[_0x4b9f('0x1c')]=_0x5835cd[_0x4b9f('0x1c')]||0x0;this[_0x4b9f('0x1d')]=_0x5835cd[_0x4b9f('0x1d')]||0x0;this['callback']=_0x5835cd[_0x4b9f('0x1f')];this[_0x4b9f('0x20')]=_0x5835cd['callbackuniqueid'];this['callbackat']=_0x5835cd[_0x4b9f('0x21')];this['recallme']=_0x5835cd['recallme'];this[_0x4b9f('0x22')]=_0x5835cd[_0x4b9f('0x22')];this[_0x4b9f('0x23')]=_0x5835cd[_0x4b9f('0x23')];this[_0x4b9f('0x24')]=_[_0x4b9f('0x2')](_0x5835cd[_0x4b9f('0xa')])?_0x5835cd['UserId']:_0x5835cd[_0x4b9f('0xa')]['id'];this[_0x4b9f('0x25')]=_0x5835cd[_0x4b9f('0x25')];this['originatecalleridnum']='';this[_0x4b9f('0x26')]='';}Action[_0x4b9f('0x27')][_0x4b9f('0x28')]=function(){return util[_0x4b9f('0xd')](_0x4b9f('0x29'),this[_0x4b9f('0xf')],this[_0x4b9f('0x2a')]);};module[_0x4b9f('0x2b')]=Action; \ No newline at end of file +var _0x1ff8=['phone','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','number','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','Agent','name','channelAgent','membername','format','SIP/%s','calleridname','Contact'];(function(_0x30a9f2,_0xe4db4){var _0x205594=function(_0x44a353){while(--_0x44a353){_0x30a9f2['push'](_0x30a9f2['shift']());}};_0x205594(++_0xe4db4);}(_0x1ff8,0x1f2));var _0x81ff=function(_0x14a3cf,_0xae014f){_0x14a3cf=_0x14a3cf-0x0;var _0x5bcffb=_0x1ff8[_0x14a3cf];return _0x5bcffb;};'use strict';var util=require('util');var _=require(_0x81ff('0x0'));var moment=require(_0x81ff('0x1'));function checkNameSurname(_0x4ce57e,_0x43726d,_0x4a2078){var _0xe347ee='';if(!_[_0x81ff('0x2')](_0x43726d)&&'string'===typeof _0x43726d){_0xe347ee+=_0x43726d;}if(!_[_0x81ff('0x2')](_0x4a2078)&&_0x81ff('0x3')===typeof _0x4a2078){_0xe347ee+='\x20'+_0x4a2078;}if(_0xe347ee!==''){return _0xe347ee;}return _0x4ce57e;}function Action(_0x54533a,_0xec6ee7,_0x300118,_0x3533ea,_0x458e7f){this[_0x81ff('0x4')]=_0x300118||undefined;this[_0x81ff('0x5')]=_0x54533a['id'];this[_0x81ff('0x6')]=_0xec6ee7['name'];this[_0x81ff('0x7')]=_0xec6ee7[_0x81ff('0x7')];this[_0x81ff('0x8')]='queue';this[_0x81ff('0x9')]=![];this['membername']=_[_0x81ff('0x2')](_0x54533a['Agent'])?undefined:_0x54533a[_0x81ff('0xa')][_0x81ff('0xb')];this[_0x81ff('0xc')]=this[_0x81ff('0xd')]?util[_0x81ff('0xe')](_0x81ff('0xf'),this[_0x81ff('0xd')]):_0x3533ea||undefined;this[_0x81ff('0x10')]=checkNameSurname(_0x54533a[_0x81ff('0x11')][_0x81ff('0x12')],_0x54533a[_0x81ff('0x11')]['firstName'],_0x54533a['Contact']['lastName']);this[_0x81ff('0x13')]=_0x54533a[_0x81ff('0x13')]||![];this[_0x81ff('0x14')]=_0x54533a[_0x81ff('0x11')][_0x81ff('0x12')];this[_0x81ff('0x15')]=_0x54533a[_0x81ff('0x15')];this[_0x81ff('0x16')]=_0x54533a[_0x81ff('0x16')]||0x0;this[_0x81ff('0x17')]=_0x54533a[_0x81ff('0x17')]||0x0;this[_0x81ff('0x18')]=_0x54533a[_0x81ff('0x18')]||0x0;this[_0x81ff('0x19')]=(_0x54533a['countbusyretry']||0x0)+(_0x54533a[_0x81ff('0x17')]||0x0)+(_0x54533a['countnoanswerretry']||0x0)+(_0x54533a['countnosuchnumberretry']||0x0)+(_0x54533a['countdropretry']||0x0)+(_0x54533a[_0x81ff('0x1a')]||0x0)+(_0x54533a[_0x81ff('0x1b')]||0x0)+(_0x54533a[_0x81ff('0x1c')]||0x0);this[_0x81ff('0x1d')]=_0x54533a['countnosuchnumberretry']||0x0;this['countdropretry']=_0x54533a[_0x81ff('0x1e')]||0x0;this[_0x81ff('0x1a')]=_0x54533a[_0x81ff('0x1a')]||0x0;this[_0x81ff('0x1b')]=_0x54533a['countmachineretry']||0x0;this[_0x81ff('0x1c')]=_0x54533a[_0x81ff('0x1c')]||0x0;this[_0x81ff('0x1f')]=_0x54533a[_0x81ff('0x1f')];this[_0x81ff('0x20')]=_0x54533a['callbackuniqueid'];this[_0x81ff('0x21')]=_0x54533a[_0x81ff('0x21')];this[_0x81ff('0x22')]=_0x54533a[_0x81ff('0x22')];this[_0x81ff('0x23')]=_0x54533a['ContactId'];this[_0x81ff('0x24')]=_0x54533a[_0x81ff('0x24')];this[_0x81ff('0x25')]=_[_0x81ff('0x2')](_0x54533a['Agent'])?_0x54533a[_0x81ff('0x25')]:_0x54533a[_0x81ff('0xa')]['id'];this[_0x81ff('0x26')]=_0x54533a[_0x81ff('0x26')];this[_0x81ff('0x27')]='';this[_0x81ff('0x28')]='';}Action['prototype'][_0x81ff('0x29')]=function(){return util[_0x81ff('0xe')]('\x22%s\x22\x20<%s>',this[_0x81ff('0x10')],this[_0x81ff('0x2a')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 5b5ed08..462e13c 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 _0x24ca=['countabandonedetry','dialAbandonedMaxRety','countmachineretry','cause-txt','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','[Preview][execCall][failure]','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','execRun','pick','unlockContact','recallme','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','logLookAgent','clone','isFailure','disableContact','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','syncDialEnd','addVariable','variables','filterKey','variable','keys','value','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','newexten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','message','originated','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','stringify','md5','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','campaignsPreview','booked','outbound','clearZombieChannels','hasOwnProperty','dialPreviewAutoRecallMe','recallMe','isNil','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','contactId','UserId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','Agent','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','dialRecallInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','countnosuchnumberretry','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','ANSWER','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','buildObj','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','decrementTalkink','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','linkedid','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','countnoanswerretry','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]'];(function(_0x3bff67,_0x45fcc8){var _0x1209f3=function(_0x3b1de1){while(--_0x3b1de1){_0x3bff67['push'](_0x3bff67['shift']());}};_0x1209f3(++_0x45fcc8);}(_0x24ca,0x1bc));var _0xa24c=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0x24ca[_0x104e21];return _0x605b37;};'use strict';var util=require(_0xa24c('0x0'));var _=require('lodash');var BPromise=require(_0xa24c('0x1'));var uuid=require(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var md5=require('md5');var Redis=require(_0xa24c('0x4'));var config=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var loggerAction=require(_0xa24c('0x6'))(_0xa24c('0x8'));var ami=require(_0xa24c('0x9'));var rpcDb=require(_0xa24c('0xa'));var Action=require(_0xa24c('0xb'));var ut=require(_0xa24c('0xc'));config[_0xa24c('0xd')]=_['defaults'](config[_0xa24c('0xd')],{'host':_0xa24c('0xe'),'port':0x18eb});var io=require(_0xa24c('0xf'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xa24c('0x10')][_0xa24c('0x11')]=function(_0x288f76){this[_0xa24c('0x12')]=this[_0xa24c('0x12')]?this[_0xa24c('0x12')][_0xa24c('0x13')](_0x288f76):_0x288f76();};function Preview(_0xc82af0){this[_0xa24c('0x14')]=new Sequence();this['campaignsPreview']=_0xc82af0[_0xa24c('0x15')];this[_0xa24c('0x16')]=_0xc82af0[_0xa24c('0x16')];this[_0xa24c('0x17')]={};this['agents']=_0xc82af0[_0xa24c('0x18')];this[_0xa24c('0x19')]=0x0;ami['on'](_0xa24c('0x1a'),this[_0xa24c('0x1b')][_0xa24c('0x1c')](this));ami['on'](_0xa24c('0x1d'),this[_0xa24c('0x1e')]['bind'](this));ami['on']('hanguprequest',this[_0xa24c('0x1f')][_0xa24c('0x1c')](this));ami['on']('dialend',this['syncDialEnd'][_0xa24c('0x1c')](this));ami['on'](_0xa24c('0x20'),this['syncNewExten'][_0xa24c('0x1c')](this));ami['on']('varset',this[_0xa24c('0x21')][_0xa24c('0x1c')](this));ami['on'](_0xa24c('0x22'),this[_0xa24c('0x23')]['bind'](this));ami['on'](_0xa24c('0x24'),this[_0xa24c('0x25')][_0xa24c('0x1c')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x506424,_0x4cd77e,_0x2173f6){io['to'](_0x506424)[_0xa24c('0x26')](_0x4cd77e,_0x2173f6);}function emitCampaignPreview(_0x26e9c3){if(_0x26e9c3[_0xa24c('0x27')]==='outbound'){var _0x30ec21={'id':_0x26e9c3['id'],'name':_0x26e9c3['name'],'strategy':_0x26e9c3[_0xa24c('0x28')],'answered':_0x26e9c3[_0xa24c('0x29')],'available':_0x26e9c3['available'],'loggedIn':_0x26e9c3[_0xa24c('0x2a')],'pTalking':_0x26e9c3[_0xa24c('0x2b')],'sumBillable':_0x26e9c3[_0xa24c('0x2c')],'sumDuration':_0x26e9c3[_0xa24c('0x2d')],'sumHoldTime':_0x26e9c3[_0xa24c('0x2e')]||0x0,'talking':_0x26e9c3['talking'],'total':_0x26e9c3[_0xa24c('0x2f')],'type':_0x26e9c3['type'],'unmanaged':_0x26e9c3[_0xa24c('0x30')],'abandoned':_0x26e9c3[_0xa24c('0x31')],'waiting':_0x26e9c3[_0xa24c('0x32')],'loggedInDb':_0x26e9c3['loggedInDb'],'dialActive':_0x26e9c3[_0xa24c('0x33')],'dialMethod':_0x26e9c3[_0xa24c('0x34')],'dialOriginateCallerIdName':_0x26e9c3[_0xa24c('0x35')],'dialOriginateCallerIdNumber':_0x26e9c3[_0xa24c('0x36')],'dialOriginateTimeout':_0x26e9c3[_0xa24c('0x37')],'dialPrefix':_0x26e9c3[_0xa24c('0x38')],'outboundAnswerAgiCallsDay':_0x26e9c3[_0xa24c('0x39')],'outboundAnswerCallsDay':_0x26e9c3['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x26e9c3[_0xa24c('0x3a')],'outboundBusyCallsDay':_0x26e9c3[_0xa24c('0x3b')],'outboundCongestionCallsDay':_0x26e9c3[_0xa24c('0x3c')],'outboundDropCallsDayACS':_0x26e9c3[_0xa24c('0x3d')],'outboundDropCallsDayCallersExit':_0x26e9c3['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x26e9c3[_0xa24c('0x3e')],'outboundNoAnswerCallsDay':_0x26e9c3[_0xa24c('0x3f')],'outboundNoSuchCallsDay':_0x26e9c3[_0xa24c('0x40')],'outboundOriginateFailureCallsDay':_0x26e9c3['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x26e9c3[_0xa24c('0x41')],'outboundRejectCallsDay':_0x26e9c3[_0xa24c('0x42')],'outboundUnknownCallsDay':_0x26e9c3[_0xa24c('0x43')],'outboundAbandonedCallsDay':_0x26e9c3['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x26e9c3[_0xa24c('0x44')],'predictiveIntervalAvgHoldtime':_0x26e9c3['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x26e9c3[_0xa24c('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x26e9c3[_0xa24c('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x26e9c3[_0xa24c('0x47')],'predictiveIntervalErlangCalls':_0x26e9c3['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x26e9c3[_0xa24c('0x48')],'predictiveIntervalHitRate':_0x26e9c3[_0xa24c('0x49')],'predictiveIntervalMultiplicativeFactor':_0x26e9c3[_0xa24c('0x4a')],'predictiveIntervalPauses':_0x26e9c3['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x26e9c3[_0xa24c('0x4b')],'predictiveIntervalTotalCalls':_0x26e9c3['predictiveIntervalTotalCalls'],'message':_0x26e9c3[_0xa24c('0x4c')],'originated':_0x26e9c3[_0xa24c('0x4d')],'erlangCalls':_0x26e9c3['erlangCalls'],'erlangCallToSecond':_0x26e9c3['erlangCallToSecond'],'erlangAbandonmentRate':_0x26e9c3[_0xa24c('0x4e')],'erlangBusyFactor':_0x26e9c3[_0xa24c('0x4f')],'startPredictive':_0x26e9c3[_0xa24c('0x50')],'startProgressive':_0x26e9c3[_0xa24c('0x51')]};if(_0x26e9c3[_0xa24c('0x52')]){_0x30ec21[_0xa24c('0x52')]={'id':_0x26e9c3[_0xa24c('0x52')]['id'],'name':_0x26e9c3['Trunk'][_0xa24c('0x53')],'active':_0x26e9c3[_0xa24c('0x52')][_0xa24c('0x54')],'callerid':_0x26e9c3[_0xa24c('0x52')][_0xa24c('0x55')]};}if(_0x26e9c3[_0xa24c('0x56')]){_0x30ec21[_0xa24c('0x56')]={'id':_0x26e9c3[_0xa24c('0x56')]['id'],'name':_0x26e9c3[_0xa24c('0x56')][_0xa24c('0x53')]};}var _0x4c7a30=md5(JSON[_0xa24c('0x57')](_0x30ec21));if(_0x26e9c3[_0xa24c('0x58')]!==_0x4c7a30){_0x26e9c3[_0xa24c('0x58')]=_0x4c7a30;emit(util[_0xa24c('0x59')]('voice:queue:%s',_0x30ec21['name']),_0xa24c('0x5a'),_0x30ec21);}}}function emitVoiceQueueChannelRemove(_0x56ef4d){logger[_0xa24c('0x5b')](_0xa24c('0x5c'),JSON[_0xa24c('0x57')](_0x56ef4d));emit(util[_0xa24c('0x59')](_0xa24c('0x5d'),_0x56ef4d['name']),'voice_queue_channel:remove',_0x56ef4d);io[_0xa24c('0x26')](_0xa24c('0x5e'),_0x56ef4d);}function notSendMessagesQueue(_0x3603db){if(_0x3603db[_0xa24c('0x5f')]){if(_0x3603db[_0xa24c('0x4d')]===0x0&&_0x3603db[_0xa24c('0x2b')]===0x0){_0x3603db['sendMessageOneNotActive']=![];_0x3603db['available']=0x0;_0x3603db[_0xa24c('0x60')]=0x0;_0x3603db[_0xa24c('0x4c')]=_0xa24c('0x61');ut[_0xa24c('0x62')](_0xa24c('0x63'),_0x3603db['name']+_0xa24c('0x64'));}else{_0x3603db[_0xa24c('0x4c')]='IS_DISACTIVED';ut['logger'](_0xa24c('0x63'),_0x3603db[_0xa24c('0x53')]+_0xa24c('0x65'));}emitCampaignPreview(_0x3603db);}}Preview['prototype']['loopCampaigns']=function(){var _0x21e204=this;setInterval(function(){_0x21e204[_0xa24c('0x66')]();},0x7cf);};Preview[_0xa24c('0x10')][_0xa24c('0x66')]=function(){var _0x3f640e=this[_0xa24c('0x67')];this[_0xa24c('0x19')]+=0x1;for(var _0x394d19 in _0x3f640e){if(_0x3f640e['hasOwnProperty'](_0x394d19)&&(_0x3f640e[_0x394d19]['dialMethod']===_0xa24c('0x7')||_0x3f640e[_0x394d19][_0xa24c('0x34')]===_0xa24c('0x68'))&&_0x3f640e[_0x394d19]['type']===_0xa24c('0x69')){if(this[_0xa24c('0x19')]>0x7){this[_0xa24c('0x19')]=0x0;this[_0xa24c('0x6a')]();}}if(_0x3f640e[_0xa24c('0x6b')](_0x394d19)&&_0x3f640e[_0x394d19][_0xa24c('0x34')]===_0xa24c('0x7')&&_0x3f640e[_0x394d19][_0xa24c('0x27')]===_0xa24c('0x69')){if(_0x3f640e[_0x394d19][_0xa24c('0x33')]){this['setMessage'](_0x3f640e[_0x394d19]);if(_0x3f640e[_0x394d19][_0xa24c('0x6c')])this[_0xa24c('0x6d')](_0x3f640e[_0x394d19]);}else{notSendMessagesQueue(_0x3f640e[_0x394d19]);}}}};Preview[_0xa24c('0x10')]['clearZombieChannel']=function(_0x3a85cb){var _0x247d2c=this;this[_0xa24c('0x14')][_0xa24c('0x11')](function(){if(!_[_0xa24c('0x6e')](_0x247d2c[_0xa24c('0x17')][_0x3a85cb])){loggerAction[_0xa24c('0x5b')](_0xa24c('0x6f'),_0x3a85cb,_0xa24c('0x70'),_0x247d2c[_0xa24c('0x17')][_0x3a85cb][_0xa24c('0x71')],'originated:\x20',JSON[_0xa24c('0x57')](_0x247d2c[_0xa24c('0x67')][_0x247d2c[_0xa24c('0x17')][_0x3a85cb][_0xa24c('0x71')]][_0xa24c('0x4d')]),_0xa24c('0x72'),JSON[_0xa24c('0x57')](_0x247d2c[_0xa24c('0x67')][_0x247d2c[_0xa24c('0x17')][_0x3a85cb]['queue']]['pTalking']),JSON[_0xa24c('0x57')](_0x247d2c['actions'][_0x3a85cb][_0xa24c('0x73')]),JSON[_0xa24c('0x57')](_['pick'](_0x247d2c[_0xa24c('0x17')][_0x3a85cb],[_0xa24c('0x74'),_0xa24c('0x75'),'VoiceQueueId','ListId'])));return ami[_0xa24c('0x76')]({'action':'status','channel':_0x247d2c[_0xa24c('0x17')][_0x3a85cb][_0xa24c('0x77')]})[_0xa24c('0x78')](function(_0x37f7ea){if(_0x37f7ea[_0xa24c('0x4c')]===_0xa24c('0x79')){setTimeout(function(){if(_0x247d2c[_0xa24c('0x17')][_0x3a85cb]){ut[_0xa24c('0x7a')](_0x247d2c[_0xa24c('0x67')][_0x247d2c[_0xa24c('0x17')][_0x3a85cb]['queue']],_0xa24c('0x7b'));if(_0x247d2c[_0xa24c('0x17')][_0x3a85cb][_0xa24c('0x73')]===!![]){ut['decrementTalkink'](_0x247d2c['campaignsPreview'][_0x247d2c['actions'][_0x3a85cb][_0xa24c('0x71')]],'[clearZombieChannel]');ut[_0xa24c('0x7c')](_0xa24c('0x7d')+_0x3a85cb,_0x247d2c['actions'][_0x3a85cb][_0xa24c('0x71')]);}ut[_0xa24c('0x7c')](_0xa24c('0x7e')+_0x3a85cb,_0x247d2c[_0xa24c('0x17')][_0x3a85cb][_0xa24c('0x71')]);delete _0x247d2c[_0xa24c('0x17')][_0x3a85cb];}},0x2328);}});}});};Preview[_0xa24c('0x10')][_0xa24c('0x6a')]=function(){var _0x518c2a=this;loggerAction[_0xa24c('0x5b')]('[action]',_['size'](this['actions']));for(var _0x5bd2af in this['actions']){if(_0x518c2a[_0xa24c('0x17')]['hasOwnProperty'](_0x5bd2af)){_0x518c2a[_0xa24c('0x7f')](_0x5bd2af);}}};Preview[_0xa24c('0x10')][_0xa24c('0x6d')]=function(_0x1a5f17){var _0xa371d2=this;rpcDb[_0xa24c('0x80')](_0x1a5f17['id'],ut[_0xa24c('0x81')](this[_0xa24c('0x18')]))[_0xa24c('0x82')](function(_0x3de0e3){if(!_[_0xa24c('0x6e')](_0x3de0e3)){for(var _0x37dbbd=0x0;_0x37dbbd<_0x3de0e3[_0xa24c('0x83')];_0x37dbbd+=0x1){if(ut[_0xa24c('0x84')](_0x3de0e3[_0x37dbbd][_0xa24c('0x85')])<_0x1a5f17['dialRecallMeTimeout']*0x3c){if(_0x3de0e3[_0x37dbbd][_0xa24c('0x86')]&&!_0x3de0e3[_0x37dbbd][_0xa24c('0x86')]['voicePause']){_0xa371d2[_0xa24c('0x87')](_0x3de0e3[_0x37dbbd]['id'])[_0xa24c('0x82')](ut[_0xa24c('0x88')](_0xa24c('0x89')))['catch'](ut['logger2'](_0xa24c('0x89')));}else{rpcDb['disableContact'](_0x3de0e3[_0x37dbbd]['id']);}}else{var _0x486040=new Action(_0x3de0e3[_0x37dbbd],_0x1a5f17);_0x486040[_0xa24c('0x8a')]=moment()[_0xa24c('0x59')](_0xa24c('0x8b'));_0x1a5f17[_0xa24c('0x41')]+=0x1;ut['logCustomer'](_0x486040,0x17,'RecallInQueue');if(_0x1a5f17[_0xa24c('0x8c')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x3de0e3[_0x37dbbd]));rpcDb[_0xa24c('0x8d')](_0x486040,_0xa24c('0x8e'));}else{ut[_0xa24c('0x8f')](_0x486040,0x16,'RecallFailedTimeout');rpcDb[_0xa24c('0x8d')](_0x486040,_0xa24c('0x90'));rpcDb['createCustomerFinal'](_0x486040,_0xa24c('0x90'));}}}}})[_0xa24c('0x78')](ut[_0xa24c('0x88')]('[getContactRecallMe]'));};Preview[_0xa24c('0x10')][_0xa24c('0x91')]=function(_0x21439a){_0x21439a[_0xa24c('0x5f')]=!![];if(ut[_0xa24c('0x92')](_0x21439a['loggedIn'])){_0x21439a[_0xa24c('0x4c')]=_0xa24c('0x93');}else if(!ut[_0xa24c('0x94')](_0x21439a[_0xa24c('0x33')])){_0x21439a[_0xa24c('0x4c')]=_0xa24c('0x61');}else if(!this[_0xa24c('0x95')](_0x21439a['Trunk'])){if(!this[_0xa24c('0x95')](_0x21439a[_0xa24c('0x96')])){_0x21439a['message']=_0xa24c('0x97');}else{_0x21439a[_0xa24c('0x4c')]=_0xa24c('0x98');}}else{_0x21439a[_0xa24c('0x4c')]=_0xa24c('0x98');}emitCampaignPreview(_0x21439a);};Preview[_0xa24c('0x10')][_0xa24c('0x99')]=function(_0xa32e53,_0x38cc30,_0x32ddc3){var _0x50141e=this;var _0x2771a1=this[_0xa24c('0x17')][_0x38cc30];var _0x3b894f=this['campaignsPreview'][_0x2771a1[_0xa24c('0x71')]];var _0xfd57fb;if(_0x3b894f){switch(_0x32ddc3){case'1':_0x3b894f[_0xa24c('0x40')]+=0x1;_0x2771a1['countnosuchnumberretry']+=0x1;_0x2771a1[_0xa24c('0x9a')]=ut[_0xa24c('0x9b')](_0x2771a1);ut[_0xa24c('0x8f')](_0x2771a1,0x0,_0xa24c('0x9c'));ami[_0xa24c('0x26')](_0xa24c('0x9d'),ut['buildObj'](_0x2771a1,'nosuchnumber'));rpcDb[_0xa24c('0x8d')](_0x2771a1,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0xa24c('0x9b')](_0x2771a1)>=_0x3b894f[_0xa24c('0x9e')]){_0xfd57fb=ut[_0xa24c('0x9f')](_0x2771a1,0xf,_0xa24c('0xa0'));rpcDb[_0xa24c('0xa1')](_0xfd57fb,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x2771a1[_0xa24c('0xa2')]>=_0x3b894f[_0xa24c('0xa3')]){rpcDb[_0xa24c('0xa1')](_0x2771a1,_0xa24c('0xa4'));}else{rpcDb[_0xa24c('0xa5')](ut[_0xa24c('0xa6')](_0x2771a1,'countnosuchnumberretry',_0x3b894f[_0xa24c('0xa7')]),_0x2771a1[_0xa24c('0xa8')],_0x2771a1[_0xa24c('0xa9')]);}}delete this[_0xa24c('0x17')][_0xa32e53['linkedid']];break;case _0xa24c('0xaa'):var _0x4d8e3a=moment()[_0xa24c('0x59')](_0xa24c('0x8b'));_0x2771a1[_0xa24c('0xab')]=_0x4d8e3a;_0x2771a1[_0xa24c('0xac')]=_0x4d8e3a;_0x2771a1['dialAnswer']=!![];_0x3b894f[_0xa24c('0x2b')]+=0x1;logger[_0xa24c('0x5b')]('[syncHangup][talking][increment]',_0x2771a1[_0xa24c('0xad')],_0xa24c('0xae'),_0x3b894f[_0xa24c('0x53')],_0xa24c('0x72'),_0x3b894f[_0xa24c('0x2b')]);ami[_0xa24c('0x26')](_0xa24c('0xaf'),ut[_0xa24c('0xb0')](_0x2771a1,'connect',this[_0xa24c('0x67')][_0x2771a1[_0xa24c('0x71')]]));if(_0x3b894f[_0xa24c('0xb1')]){ami[_0xa24c('0x26')](_0xa24c('0xb2'),ut[_0xa24c('0xb3')](_0x2771a1));}break;case'16':ami[_0xa24c('0x26')](_0xa24c('0xb4'),ut[_0xa24c('0xb0')](_0x2771a1,_0xa24c('0xb5'),this[_0xa24c('0x67')][_0x2771a1['queue']]));emitVoiceQueueChannelRemove(ut[_0xa24c('0xb0')](_0x2771a1,_0xa24c('0xb5')));_0x3b894f['outboundAnswerCallsDay']+=0x1;_0x3b894f[_0xa24c('0x2f')]+=0x1;_0x3b894f[_0xa24c('0x29')]+=0x1;ut[_0xa24c('0xb6')](_0x3b894f,'[16]');_0x2771a1['countglobal']=ut[_0xa24c('0x9b')](_0x2771a1);ut[_0xa24c('0x8f')](_0x2771a1,0x4,'Answer');rpcDb[_0xa24c('0x8d')](_0x2771a1,_0xa24c('0xb7'));rpcDb[_0xa24c('0xa1')](_0x2771a1,_0xa24c('0xb8'));rpcDb[_0xa24c('0xb9')](_0x2771a1);_0x3b894f[_0xa24c('0x2d')]+=_0x2771a1['talktime'];_0x3b894f['sumBillable']+=_0x2771a1['talktime'];logger[_0xa24c('0x5b')]('[syncHangup][talking][decrement]',_0x2771a1['uniqueid'],_0xa24c('0xae'),_0x3b894f[_0xa24c('0x53')],_0xa24c('0x72'),_0x3b894f[_0xa24c('0x2b')]);delete this[_0xa24c('0x17')][_0xa32e53[_0xa24c('0xba')]];break;case _0xa24c('0xbb'):_0x3b894f[_0xa24c('0x3b')]+=0x1;_0x2771a1[_0xa24c('0xbc')]+=0x1;_0x2771a1['countglobal']=ut[_0xa24c('0x9b')](_0x2771a1);ut[_0xa24c('0x8f')](_0x2771a1,0x5,_0xa24c('0xbd'));ami[_0xa24c('0x26')](_0xa24c('0xbe'),ut[_0xa24c('0xb0')](_0x2771a1,_0xa24c('0xbf')));rpcDb[_0xa24c('0x8d')](_0x2771a1,_0xa24c('0xc0'));if(ut[_0xa24c('0x9b')](_0x2771a1)>=_0x3b894f[_0xa24c('0x9e')]){_0xfd57fb=ut[_0xa24c('0x9f')](_0x2771a1,0xf,'Global');rpcDb[_0xa24c('0xa1')](_0xfd57fb,_0xa24c('0xc1'));}else{if(_0x2771a1['countbusyretry']>=_0x3b894f[_0xa24c('0xc2')]){rpcDb[_0xa24c('0xa1')](_0x2771a1,_0xa24c('0xc0'));}else{rpcDb['rescheduleContact'](ut[_0xa24c('0xa6')](_0x2771a1,_0xa24c('0xbc'),_0x3b894f['dialBusyRetryFrequency']),_0x2771a1[_0xa24c('0xa8')],_0x2771a1[_0xa24c('0xa9')]);}}break;case'NOANSWER':_0x3b894f['outboundNoAnswerCallsDay']+=0x1;_0x2771a1[_0xa24c('0xc3')]+=0x1;_0x2771a1[_0xa24c('0x9a')]=ut[_0xa24c('0x9b')](_0x2771a1);ut[_0xa24c('0x8f')](_0x2771a1,0x3,'NoAnswer');ami[_0xa24c('0x26')](_0xa24c('0xc4'),ut[_0xa24c('0xb0')](_0x2771a1,'noanswer'));rpcDb['createCustomerHistory'](_0x2771a1,_0xa24c('0xc5'));if(ut[_0xa24c('0x9b')](_0x2771a1)>=_0x3b894f[_0xa24c('0x9e')]){_0xfd57fb=ut['cloneAction'](_0x2771a1,0xf,'Global');rpcDb[_0xa24c('0xa1')](_0xfd57fb,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x2771a1['countnoanswerretry']>=_0x3b894f['dialNoAnswerMaxRetry']){rpcDb[_0xa24c('0xa1')](_0x2771a1,_0xa24c('0xc5'));}else{rpcDb[_0xa24c('0xa5')](ut[_0xa24c('0xa6')](_0x2771a1,_0xa24c('0xc3'),_0x3b894f[_0xa24c('0xc6')]),_0x2771a1[_0xa24c('0xa8')],_0x2771a1[_0xa24c('0xa9')]);}}break;case _0xa24c('0xc7'):_0x3b894f[_0xa24c('0x3c')]+=0x1;_0x2771a1[_0xa24c('0xc8')]+=0x1;_0x2771a1[_0xa24c('0x9a')]=ut['totalGlobal'](_0x2771a1);ut[_0xa24c('0x8f')](_0x2771a1,0x8,_0xa24c('0xc9'));ami['emit'](_0xa24c('0xca'),ut['buildObj'](_0x2771a1,'congestion'));rpcDb['createCustomerHistory'](_0x2771a1,_0xa24c('0xcb'));if(ut['totalGlobal'](_0x2771a1)>=_0x3b894f[_0xa24c('0x9e')]){_0xfd57fb=ut['cloneAction'](_0x2771a1,0xf,_0xa24c('0xa0'));rpcDb[_0xa24c('0xa1')](_0xfd57fb,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x2771a1[_0xa24c('0xc8')]>=_0x3b894f['dialCongestionMaxRetry']){rpcDb[_0xa24c('0xa1')](_0x2771a1,_0xa24c('0xcb'));}else{rpcDb[_0xa24c('0xa5')](ut[_0xa24c('0xa6')](_0x2771a1,_0xa24c('0xc8'),_0x3b894f['dialBusyRetryFrequency']),_0x2771a1[_0xa24c('0xa8')],_0x2771a1['activeContact']);}}break;case _0xa24c('0xcc'):_0x3b894f[_0xa24c('0x42')]+=0x1;_0x2771a1[_0xa24c('0xcd')]+=0x1;_0x2771a1[_0xa24c('0x9a')]=ut['totalGlobal'](_0x2771a1);ut[_0xa24c('0x8f')](_0x2771a1,0x14,_0xa24c('0xce'));ami[_0xa24c('0x26')](_0xa24c('0xcf'),ut['buildObj'](_0x2771a1,_0xa24c('0xd0')));rpcDb[_0xa24c('0x8d')](_0x2771a1,_0xa24c('0xd1'));if(ut[_0xa24c('0x9b')](_0x2771a1)>=_0x3b894f[_0xa24c('0x9e')]){_0xfd57fb=ut[_0xa24c('0x9f')](_0x2771a1,0x14,_0xa24c('0xce'));rpcDb[_0xa24c('0xa1')](_0xfd57fb,_0xa24c('0xd2'));}else{if(_0x2771a1[_0xa24c('0xcd')]>=_0x3b894f[_0xa24c('0xd3')]){rpcDb[_0xa24c('0xa1')](_0x2771a1,_0xa24c('0xd2'));}else{rpcDb['rescheduleContact'](ut[_0xa24c('0xa6')](_0x2771a1,_0xa24c('0xcd'),_0x3b894f[_0xa24c('0xd4')]),_0x2771a1[_0xa24c('0xa8')],_0x2771a1[_0xa24c('0xa9')]);}}break;case _0xa24c('0xd5'):_0x3b894f[_0xa24c('0xd6')]+=0x1;_0x2771a1[_0xa24c('0xd7')]+=0x1;_0x2771a1['countglobal']=ut[_0xa24c('0x9b')](_0x2771a1);ut[_0xa24c('0x8f')](_0x2771a1,0xb,_0xa24c('0xd8'));rpcDb[_0xa24c('0x8d')](_0x2771a1,_0xa24c('0xd9'));if(ut[_0xa24c('0x9b')](_0x2771a1)>=_0x3b894f[_0xa24c('0x9e')]){_0xfd57fb=ut['cloneAction'](_0x2771a1,0xf,_0xa24c('0xa0'));rpcDb[_0xa24c('0xa1')](_0xfd57fb,_0xa24c('0xd9'));}else{if(_0x2771a1[_0xa24c('0xda')]>=_0x3b894f[_0xa24c('0xdb')]){rpcDb[_0xa24c('0xa1')](_0x2771a1,_0xa24c('0xd9'));}else{rpcDb[_0xa24c('0xa5')](ut[_0xa24c('0xa6')](_0x2771a1,_0xa24c('0xd7'),_0x3b894f['dialAbandonedRetryFrequency']),_0x2771a1[_0xa24c('0xa8')],_0x2771a1[_0xa24c('0xa9')]);}}break;case'18':_0x3b894f[_0xa24c('0x43')]+=0x1;_0x2771a1[_0xa24c('0xdc')]+=0x1;_0x2771a1[_0xa24c('0x9a')]=ut[_0xa24c('0x9b')](_0x2771a1);ut[_0xa24c('0x8f')](_0x2771a1,0x12,_0xa32e53[_0xa24c('0xdd')]||_0xa32e53['dialstatus']);ami[_0xa24c('0x26')]('custom:amd',ut['buildObj'](_0x2771a1,'amd'));rpcDb['createCustomerHistory'](_0x2771a1,_0xa24c('0xde'));if(ut[_0xa24c('0x9b')](_0x2771a1)>=_0x3b894f[_0xa24c('0x9e')]){_0xfd57fb=ut[_0xa24c('0x9f')](_0x2771a1,0xf,_0xa24c('0xa0'));rpcDb['createCustomerFinal'](_0xfd57fb,_0xa24c('0xde'));}else{rpcDb[_0xa24c('0xa1')](_0x2771a1,_0xa24c('0xde'));}delete this[_0xa24c('0x17')][_0xa32e53[_0xa24c('0xba')]];break;case'19':_0x3b894f[_0xa24c('0x43')]+=0x1;_0x2771a1[_0xa24c('0x9a')]=ut[_0xa24c('0x9b')](_0x2771a1);ut[_0xa24c('0x8f')](_0x2771a1,0x13,_0xa32e53['cause-txt']||_0xa32e53[_0xa24c('0xdf')]);ami[_0xa24c('0x26')](_0xa24c('0xe0'),ut[_0xa24c('0xb0')](_0x2771a1,_0xa24c('0xe1')));rpcDb['createCustomerHistory'](_0x2771a1,_0xa24c('0xe2'));if(ut[_0xa24c('0x9b')](_0x2771a1)>=_0x3b894f[_0xa24c('0x9e')]){_0xfd57fb=ut['cloneAction'](_0x2771a1,0xf,_0xa24c('0xa0'));rpcDb[_0xa24c('0xa1')](_0xfd57fb,_0xa24c('0xe2'));}else{rpcDb[_0xa24c('0xa1')](_0x2771a1,_0xa24c('0xe2'));}delete this['actions'][_0xa32e53['linkedid']];break;default:if(_0x2771a1[_0xa24c('0x73')]){ut['decrementTalkink'](_0x3b894f,_0xa24c('0xe3'));ut[_0xa24c('0x7c')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x3b894f[_0xa24c('0x53')],_0xa32e53);}_0x3b894f[_0xa24c('0x43')]+=0x1;_0x2771a1[_0xa24c('0x9a')]=ut[_0xa24c('0x9b')](_0x2771a1);ut[_0xa24c('0x8f')](_0x2771a1,0xc,_0xa32e53[_0xa24c('0xdd')]||_0xa32e53['dialstatus']);rpcDb[_0xa24c('0x8d')](_0x2771a1,_0xa24c('0xe4'));if(ut[_0xa24c('0x9b')](_0x2771a1)>=_0x3b894f[_0xa24c('0x9e')]){_0xfd57fb=ut['cloneAction'](_0x2771a1,0xf,_0xa24c('0xa0'));rpcDb[_0xa24c('0xa1')](_0xfd57fb,_0xa24c('0xe5'));}else{rpcDb[_0xa24c('0xa1')](_0x2771a1,_0xa24c('0xe5'));}delete this[_0xa24c('0x17')][_0xa32e53[_0xa24c('0xba')]];}if(!(_0x2771a1['dialAnswer']&&_0x32ddc3==='16')){ut[_0xa24c('0x7a')](_0x3b894f,_0xa24c('0xe6'));logger[_0xa24c('0x5b')]('[originated][decrement][callProgressDetectingCustomer]',_0x2771a1['uniqueid'],_0xa24c('0xae'),_0x3b894f[_0xa24c('0x53')],_0xa24c('0xe7'),_0x3b894f['originated']);}if(_0x32ddc3!==_0xa24c('0xaa')){delete this['actions'][_0xa32e53['linkedid']];delete this[_0xa24c('0x17')][_0xa32e53[_0xa24c('0xe8')]];}}};Preview[_0xa24c('0x10')][_0xa24c('0xe9')]=function(_0x10ab4d,_0x16a761,_0x36cc45){if(_[_0xa24c('0xea')](_0x16a761)&&_0xa24c('0xeb')!==typeof _0x16a761){return;}if(_['isUndefined'](_0x36cc45)&&_0xa24c('0xeb')!==typeof _0x36cc45){return;}switch(_0x36cc45[_0xa24c('0xec')]){case'0':ut[_0xa24c('0xed')](_0x10ab4d,0x0,_0xa24c('0x9c'));rpcDb[_0xa24c('0xee')](_0x10ab4d,_0xa24c('0xef'));break;case'3':ut['logAgent'](_0x10ab4d,0x3,'NoAnswer');rpcDb[_0xa24c('0xee')](_0x10ab4d,_0xa24c('0xf0'));break;case'5':ut[_0xa24c('0xed')](_0x10ab4d,0x5,_0xa24c('0xbd'));rpcDb[_0xa24c('0xee')](_0x10ab4d,_0xa24c('0xf1'));break;case'8':ut['logAgent'](_0x10ab4d,0x8,_0xa24c('0xc9'));rpcDb['createAgentHistory'](_0x10ab4d,_0xa24c('0xf2'));break;case'22':ut[_0xa24c('0xed')](_0x10ab4d,0x16,_0xa24c('0xf3'));rpcDb[_0xa24c('0xee')](_0x10ab4d,_0xa24c('0xf4'));break;default:ut['logAgent'](_0x10ab4d,0xc,_0x36cc45[_0xa24c('0xec')]);rpcDb[_0xa24c('0xee')](_0x10ab4d,_0xa24c('0xf2'));}ut['updateOriginated'](_0x16a761,_0xa24c('0xf5'));logger[_0xa24c('0x5b')](_0xa24c('0xf6'),_0x10ab4d[_0xa24c('0xad')],'\x20Queue',_0x16a761['name'],_0xa24c('0xe7'),_0x16a761[_0xa24c('0x4d')]);delete this['actions'][_0x10ab4d[_0xa24c('0xad')]];};Preview[_0xa24c('0x10')][_0xa24c('0xf7')]=function(_0x524515,_0x2522bd,_0x15d0c3,_0x59442a,_0x4bcd2b){var _0x4ef3b3=this;return new BPromise(function(_0x3e196e,_0x1b66e2){if(_[_0xa24c('0x6e')](_0x2522bd)||_['isNil'](_0x2522bd['Contact'])||_[_0xa24c('0x6e')](_0x2522bd[_0xa24c('0xf8')][_0xa24c('0xf9')])||_[_0xa24c('0x6e')](_0x2522bd[_0xa24c('0xfa')])){_0x1b66e2(ut['message']('Contact\x20is\x20undefined',_0x59442a,_0x4bcd2b));return;}var _0x2d43e0=uuid['v4']();var _0x2ccd55=_0x4ef3b3[_0xa24c('0x67')][_0x2522bd[_0xa24c('0x70')][_0xa24c('0x53')]];var _0x53ebd2=_0x15d0c3?_0x4ef3b3[_0xa24c('0x18')][_0x15d0c3]['id']:undefined;_0x4ef3b3[_0xa24c('0x17')][_0x2d43e0]=new Action(_0x2522bd,_0x2ccd55,_0x2d43e0,_0x15d0c3,_0x53ebd2);var _0x314942=_0x4ef3b3['actions'][_0x2d43e0];_0x314942[_0xa24c('0xa8')]=_0x59442a;_0x314942['activeContact']=_0x4bcd2b;_0x314942[_0xa24c('0xfb')]=_0x15d0c3;if(_[_0xa24c('0xfc')](_0x524515)){_0x4ef3b3[_0xa24c('0xfd')](_0x314942,_0x2ccd55,_0x2522bd,_0x15d0c3)[_0xa24c('0x82')](function(_0x2cd897){logger[_0xa24c('0x5b')](_0xa24c('0xfe'),_0xa24c('0xff')+_0x314942[_0xa24c('0x71')]+_0xa24c('0x100')+_0x314942[_0xa24c('0x101')],JSON[_0xa24c('0x57')](_0x2cd897));ami['emit'](_0xa24c('0x102'),ut[_0xa24c('0xb0')](_0x314942,_0xa24c('0x103'),_0x4ef3b3[_0xa24c('0x67')][_0x314942['queue']]));_0x3e196e(ut[_0xa24c('0x4c')]('Calling'));})[_0xa24c('0x78')](function(_0x45ec8b){ut[_0xa24c('0x62')](_0xa24c('0x104'),_0x45ec8b);_0x1b66e2(ut[_0xa24c('0x4c')]('Call\x20failed',_0x59442a,_0x4bcd2b));});}else{_0x2ccd55[_0xa24c('0x3a')]+=0x1;ut[_0xa24c('0x105')](_0x314942);rpcDb['createHistory'](_0x314942,_0xa24c('0x106'));delete _0x4ef3b3[_0xa24c('0x17')][_0x2d43e0];_0x1b66e2(ut[_0xa24c('0x4c')](_0xa24c('0x107'),_0x59442a,_0x4bcd2b));}});};Preview[_0xa24c('0x10')]['isTrunkReachable']=function(_0xe72270){return!_[_0xa24c('0x6e')](_0xe72270)&&!_[_0xa24c('0x6e')](_0xe72270['name'])&&!_[_0xa24c('0x6e')](_0xe72270[_0xa24c('0x54')])&&_0xe72270[_0xa24c('0x54')]&&!_['isNil'](this[_0xa24c('0x16')][util['format'](_0xa24c('0x108'),_0xe72270[_0xa24c('0x53')])])&&!_['isNil'](this['trunks'][util[_0xa24c('0x59')](_0xa24c('0x108'),_0xe72270[_0xa24c('0x53')])][_0xa24c('0x109')])&&(this['trunks'][util[_0xa24c('0x59')](_0xa24c('0x108'),_0xe72270[_0xa24c('0x53')])][_0xa24c('0x109')]===_0xa24c('0x10a')||this[_0xa24c('0x16')][util[_0xa24c('0x59')]('SIP/%s',_0xe72270[_0xa24c('0x53')])]['status']===_0xa24c('0x10b'));};Preview[_0xa24c('0x10')][_0xa24c('0x87')]=function(_0x15e785,_0x5432c9){var _0x371aab=this;return new BPromise(function(_0x59f5e5,_0x27e13c){_0x371aab[_0xa24c('0x10c')](_0x15e785,_0x5432c9)['then'](function(_0x57e554){_0x59f5e5(_[_0xa24c('0x10d')](_0x57e554,['message']));})[_0xa24c('0x78')](function(_0x38bc4f){if(_0x38bc4f['unlock']){rpcDb[_0xa24c('0x10e')](_0x15e785);}if(_0x38bc4f[_0xa24c('0x54')]){rpcDb['disableContact'](_0x15e785);}_0x27e13c(_[_0xa24c('0x10d')](_0x38bc4f,['message']));});});};Preview[_0xa24c('0x10')][_0xa24c('0x10c')]=function(_0x12164f,_0x5d5dbf){var _0x12f433=this;return new BPromise(function(_0x434b20,_0x4b96bc){var _0x71ffe5,_0x2173e8;rpcDb['getContactPreview'](_0x12164f)[_0xa24c('0x82')](function(_0xdd221a){if(!_[_0xa24c('0x6e')](_0xdd221a[0x0])){_0x2173e8=_0xdd221a[0x0][_0xa24c('0x10f')]?![]:!![];_0x71ffe5=_0xdd221a[0x0][_0xa24c('0x10f')]?!![]:![];_0x71ffe5=_0x5d5dbf?!![]:_0x71ffe5;}var _0x464e87=_0x12f433[_0xa24c('0x110')](_0xdd221a);if(_0x464e87['isValid']){rpcDb[_0xa24c('0x111')](_[_0xa24c('0x10d')](_0xdd221a[0x0],[_0xa24c('0xfa'),_0xa24c('0x112')]))[_0xa24c('0x82')](function(_0x1de55d){_0x12f433[_0xa24c('0xf7')](_0x1de55d,_0xdd221a[0x0],_0x5d5dbf,_0x2173e8,_0x71ffe5)[_0xa24c('0x82')](function(_0x432b11){_0x434b20(_0x432b11);})['catch'](function(_0x1fdaa3){_0x4b96bc(_0x1fdaa3);});})['catch'](function(_0x243913){ut['logger'](_0xa24c('0x113'),_0x243913);_0x4b96bc(ut[_0xa24c('0x4c')](_0xa24c('0x114'),_0x2173e8,_0x71ffe5));});}else{_0x4b96bc(ut[_0xa24c('0x4c')](_0x464e87[_0xa24c('0x4c')],_0x2173e8,_0x71ffe5));}})[_0xa24c('0x78')](function(_0x547629){ut['logger']('[Preview][getContactPreview]',_0x547629);_0x4b96bc(ut[_0xa24c('0x4c')](_0xa24c('0x114'),![],!![]));});});};Preview[_0xa24c('0x10')][_0xa24c('0x110')]=function(_0x247f18){if(_['isNil'](_0x247f18)||_[_0xa24c('0xfc')](_0x247f18)||!_[_0xa24c('0x6e')](_0x247f18[0x0][_0xa24c('0x86')])&&_[_0xa24c('0x6e')](_0x247f18[0x0][_0xa24c('0x86')]['name'])){ut[_0xa24c('0x62')](_0xa24c('0x115'),_0x247f18);return{'isValid':![],'message':_0xa24c('0x116')};}var _0x5e1e55=this[_0xa24c('0x67')][_0x247f18[0x0][_0xa24c('0x70')][_0xa24c('0x53')]];_0x5e1e55[_0xa24c('0x4c')]=_0xa24c('0x98');if(_['isNil'](_0x5e1e55)){ut[_0xa24c('0x62')](_0xa24c('0x117'),_0x5e1e55);return{'isValid':![],'message':_0xa24c('0x118')};}if(!this[_0xa24c('0x95')](_0x5e1e55[_0xa24c('0x52')])){ut[_0xa24c('0x62')](_0xa24c('0x119'),'campaign\x20Name:\x20'+_0x5e1e55['name']+_0xa24c('0x11a'));if(!this['isTrunkReachable'](_0x5e1e55[_0xa24c('0x96')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x5e1e55['name']+_0xa24c('0x11b'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0xa24c('0x94')](_0x5e1e55[_0xa24c('0x33')])){ut['logger'](_0xa24c('0x11c'),_0x5e1e55[_0xa24c('0x53')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x5e1e55[_0xa24c('0x53')]+_0xa24c('0x11d')};}return{'isValid':!![],'message':_0xa24c('0x11e')};};Preview['prototype'][_0xa24c('0xfd')]=function(_0x356e57,_0x437de1,_0x2507d0,_0x3814a4){var _0x45e82d=this;return new BPromise(function(_0x3625e,_0x14b7df){var _0x3c6902=_0x356e57['uniqueid'];var _0x42f2e4=_0x45e82d[_0xa24c('0x95')](_0x437de1[_0xa24c('0x52')])?util[_0xa24c('0x59')](_0xa24c('0x11f'),_0x437de1[_0xa24c('0x52')][_0xa24c('0x53')],_[_0xa24c('0x6e')](_0x437de1[_0xa24c('0x38')])?'':_0x437de1['dialPrefix'][_0xa24c('0x120')]()||'',_0x437de1[_0xa24c('0x121')]>0x0?_0x2507d0[_0xa24c('0xf8')][_0xa24c('0xf9')][_0xa24c('0x122')](_0x437de1['dialCutDigit']):_0x2507d0[_0xa24c('0xf8')][_0xa24c('0xf9')]):util[_0xa24c('0x59')]('SIP/%s/%s%s',_['isNil'](_0x437de1[_0xa24c('0x96')])?_0x437de1['Trunk']['name']:_0x437de1[_0xa24c('0x96')][_0xa24c('0x53')],_[_0xa24c('0x6e')](_0x437de1[_0xa24c('0x38')])?'':_0x437de1[_0xa24c('0x38')][_0xa24c('0x120')]()||'',_0x437de1[_0xa24c('0x121')]>0x0?_0x2507d0[_0xa24c('0xf8')][_0xa24c('0xf9')][_0xa24c('0x122')](_0x437de1[_0xa24c('0x121')]):_0x2507d0[_0xa24c('0xf8')]['phone']);var _0x43adbb=_0x45e82d[_0xa24c('0x95')](_0x437de1[_0xa24c('0x52')])?ut[_0xa24c('0x123')](_0x437de1[_0xa24c('0x52')][_0xa24c('0x55')],_0x437de1[_0xa24c('0x35')],_0x437de1[_0xa24c('0x124')]>0x0?ut[_0xa24c('0x125')](_0x437de1[_0xa24c('0x36')],_0x437de1[_0xa24c('0x124')]):_0x437de1['dialOriginateCallerIdNumber']):ut[_0xa24c('0x123')](_[_0xa24c('0x6e')](_0x437de1[_0xa24c('0x96')])?_0x437de1[_0xa24c('0x52')][_0xa24c('0x55')]:_0x437de1[_0xa24c('0x96')][_0xa24c('0x55')],_0x437de1[_0xa24c('0x35')],_0x437de1[_0xa24c('0x124')]>0x0?ut['getCallerIdRandom'](_0x437de1[_0xa24c('0x36')],_0x437de1[_0xa24c('0x124')]):_0x437de1[_0xa24c('0x36')]);if(_0x43adbb){_0x356e57[_0xa24c('0x126')]=ut[_0xa24c('0x127')](_0x43adbb);_0x356e57['originatecalleridnum']=ut[_0xa24c('0x128')](_0x43adbb);}var _0x38f92f=ut[_0xa24c('0x129')](_0x437de1,_0x2507d0,_0x42f2e4,_0x43adbb,_0x3c6902,_0x356e57);_[_0xa24c('0x12a')](_0x356e57,ut[_0xa24c('0x12b')](_0x38f92f));_0x356e57[_0xa24c('0x8a')]=moment()[_0xa24c('0x59')]('YYYY-MM-DD\x20HH:mm:ss');ami['Action'](ut['variablesAction'](_0x356e57,_0x437de1,_0x38f92f,_0x356e57[_0xa24c('0xa9')],_0x3814a4))[_0xa24c('0x82')](function(_0x4e26c6){_0x437de1[_0xa24c('0x4d')]+=0x1;logger[_0xa24c('0x5b')](_0xa24c('0x12c'),_0x3c6902,_0xa24c('0xae'),_0x437de1[_0xa24c('0x53')],'originated:\x20',_0x437de1[_0xa24c('0x4d')]);_0x3625e(_0x4e26c6);})[_0xa24c('0x78')](function(_0x4b6039){ut[_0xa24c('0xed')](_0x356e57,0xe,_0xa24c('0x12d'));rpcDb[_0xa24c('0xee')](_0x356e57,_0xa24c('0x12e'));_0x14b7df(_0x4b6039);});});};Preview[_0xa24c('0x10')][_0xa24c('0x12f')]=function(_0x495ed6){if(this[_0xa24c('0x17')][_0x495ed6[_0xa24c('0xba')]]){this[_0xa24c('0x17')][_0x495ed6[_0xa24c('0xba')]][_0xa24c('0x77')]=_0x495ed6[_0xa24c('0x77')];}};Preview[_0xa24c('0x10')]['syncOriginateResponse']=function(_0x57253d){var _0x338cb4=this;var _0x179951=this[_0xa24c('0x17')][_0x57253d[_0xa24c('0x130')]];if(_0x179951){if(_0x179951[_0xa24c('0xfb')]&&this[_0xa24c('0x18')][_0x179951[_0xa24c('0xfb')]]){ut[_0xa24c('0x131')](_0x179951,this[_0xa24c('0x18')][_0x179951['lookAgent']][_0xa24c('0x53')],this[_0xa24c('0x18')][_0x179951[_0xa24c('0xfb')]]['id']);}var _0x3a1225=_[_0xa24c('0x132')](_0x179951);_0x3a1225['responsetime']=moment()[_0xa24c('0x59')](_0xa24c('0x8b'));var _0x5bf9a4=_0x338cb4[_0xa24c('0x67')][_0x179951[_0xa24c('0x71')]];if(ut[_0xa24c('0x133')](_0x57253d['response'])){if(_0x179951[_0xa24c('0xa8')]){rpcDb[_0xa24c('0x10e')](_0x179951[_0xa24c('0x101')]);}if(_0x179951[_0xa24c('0xa9')]){rpcDb[_0xa24c('0x134')](_0x179951[_0xa24c('0x101')]);}ami[_0xa24c('0x26')](_0xa24c('0x135'),ut[_0xa24c('0xb0')](_0x179951,_0xa24c('0x136'),this[_0xa24c('0x67')][_0x179951[_0xa24c('0x71')]]));this['callProgressDetectingAgent'](_0x3a1225,_0x5bf9a4,_0x57253d);}else{_0x179951['starttime']=moment()[_0xa24c('0x59')](_0xa24c('0x8b'));ut[_0xa24c('0xed')](_0x3a1225,0x4,_0xa24c('0x137'));rpcDb[_0xa24c('0xee')](_0x3a1225,_0xa24c('0x138'));}}};Preview[_0xa24c('0x10')][_0xa24c('0x1e')]=function(_0x27613d){var _0x21d1b5=this;var _0xe575c7=this[_0xa24c('0x17')][_0x27613d['linkedid']];var _0x3be24f;if(_0xe575c7){_0x3be24f=this[_0xa24c('0x67')][_0xe575c7['queue']];logger[_0xa24c('0x5b')](_0xa24c('0x139'),_0x27613d[_0xa24c('0xba')],'\x20Queue',_0x3be24f[_0xa24c('0x53')],'pTalking:\x20',_0x3be24f[_0xa24c('0x2b')]);}if(this[_0xa24c('0x17')][_0x27613d[_0xa24c('0xba')]]&&_0x27613d[_0xa24c('0xba')]!==_0x27613d[_0xa24c('0xad')]){if(_0x27613d[_0xa24c('0x13a')]==='16'&&this[_0xa24c('0x17')][_0x27613d[_0xa24c('0xba')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x27613d,_0x27613d[_0xa24c('0xba')],_0x27613d['cause']);}else if(this[_0xa24c('0x17')][_0x27613d[_0xa24c('0xba')]][_0xa24c('0x73')]){logger[_0xa24c('0x5b')]('[syncHangup][talking][cause]',_0x27613d['linkedid'],_0x27613d['cause'],_0xa24c('0xae'),_0x3be24f['name'],_0xa24c('0x72'),_0x3be24f[_0xa24c('0x2b')]);this[_0xa24c('0x99')](_0x27613d,_0x27613d[_0xa24c('0xba')],_0x27613d[_0xa24c('0x13a')]);}}else if(_0xe575c7&&_[_0xa24c('0x6e')](_0xe575c7[_0xa24c('0x13b')])&&_0x3be24f[_0xa24c('0x13c')]&&_0x27613d[_0xa24c('0xba')]===_0x27613d[_0xa24c('0xad')]&&_['isNil'](_0x27613d['reason'])&&_0x27613d['cause']==='16'&&_0x27613d[_0xa24c('0x13d')]==='6'&&_['isUndefined'](_0xe575c7[_0xa24c('0x13e')])){if(_0xe575c7[_0xa24c('0xa8')]){rpcDb[_0xa24c('0x10e')](_0xe575c7[_0xa24c('0x101')]);}if(_0xe575c7[_0xa24c('0xa9')]){rpcDb['disableContact'](_0xe575c7[_0xa24c('0x101')]);}_0x27613d[_0xa24c('0xec')]='22';this[_0xa24c('0xe9')](_0xe575c7,_0x3be24f,_0x27613d);}else if(_0xe575c7&&_0xe575c7[_0xa24c('0x13e')]){if(_0x27613d[_0xa24c('0x13a')]==='16'&&this['actions'][_0x27613d[_0xa24c('0xba')]][_0xa24c('0x73')]){logger['info'](_0xa24c('0x13f'),_0x27613d['linkedid'],_0x27613d[_0xa24c('0x13a')],_0xa24c('0xae'),_0x3be24f['name'],_0xa24c('0x72'),_0x3be24f[_0xa24c('0x2b')]);this[_0xa24c('0x99')](_0x27613d,_0x27613d[_0xa24c('0xba')],_0x27613d['cause']);}else if(this['actions'][_0x27613d[_0xa24c('0xba')]][_0xa24c('0x73')]){logger[_0xa24c('0x5b')](_0xa24c('0x140'),_0x27613d['linkedid'],_0x27613d[_0xa24c('0x13a')],_0xa24c('0xae'),_0x3be24f['name'],_0xa24c('0x72'),_0x3be24f[_0xa24c('0x2b')]);this[_0xa24c('0x99')](_0x27613d,_0x27613d[_0xa24c('0xba')],_0x27613d[_0xa24c('0x13a')]);}}};Preview[_0xa24c('0x10')][_0xa24c('0x141')]=function(_0x29cb67){if(this[_0xa24c('0x17')][_0x29cb67[_0xa24c('0xe8')]]&&_0x29cb67['destlinkedid']!==_0x29cb67['destuniqueid']){this['callProgressDetectingCustomer'](_0x29cb67,_0x29cb67['destlinkedid'],_0x29cb67[_0xa24c('0xdf')]);}};Preview[_0xa24c('0x10')][_0xa24c('0x1f')]=function(_0x17fc6c){if(this[_0xa24c('0x17')][_0x17fc6c['linkedid']]&&_0x17fc6c[_0xa24c('0xba')]!==_0x17fc6c['uniqueid']&&!this['actions'][_0x17fc6c['linkedid']][_0xa24c('0x73')]){if(_0x17fc6c['cause']==='1'){this[_0xa24c('0x99')](_0x17fc6c,_0x17fc6c[_0xa24c('0xba')],_0x17fc6c['cause']);}}};Preview[_0xa24c('0x10')][_0xa24c('0x142')]=function(_0x2bb5b8,_0xc81b9c,_0x4651bc){if(this[_0xa24c('0x17')][_0x2bb5b8]){if(_[_0xa24c('0x6e')](this[_0xa24c('0x17')][_0x2bb5b8][_0xa24c('0x143')])){this['actions'][_0x2bb5b8][_0xa24c('0x143')]={};}this[_0xa24c('0x17')][_0x2bb5b8]['variables'][_0xc81b9c]=_0x4651bc;}};Preview[_0xa24c('0x10')][_0xa24c('0x21')]=function(_0x4e4c37){try{if(!_[_0xa24c('0x6e')](_0x4e4c37)){if(ut[_0xa24c('0x144')](_['keys'](_0x4e4c37[_0xa24c('0x145')])[0x0])){this[_0xa24c('0x142')](_0x4e4c37['uniqueid'],_[_0xa24c('0x146')](_0x4e4c37[_0xa24c('0x145')])[0x0],_0x4e4c37[_0xa24c('0x147')]);}}}catch(_0x1b1102){logger['error']('[syncVarSet][Preview]',util['inspect'](_0x1b1102,{'showHidden':![],'depth':null}));}};Preview[_0xa24c('0x10')][_0xa24c('0x23')]=function(_0x51187e){if(_0x51187e){if(this['actions'][_0x51187e[_0xa24c('0x148')]]){this[_0xa24c('0x17')][_0x51187e[_0xa24c('0x148')]][_0xa24c('0x13e')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x5a532b){if(_0x5a532b){if(this[_0xa24c('0x17')][_0x5a532b[_0xa24c('0x149')]]){this[_0xa24c('0x17')][_0x5a532b[_0xa24c('0x149')]][_0xa24c('0x13e')]=!![];}}};module[_0xa24c('0x14a')]=Preview; \ No newline at end of file +var _0x425d=['countbusyretry','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','isNil','Contact','phone','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','unlock','execRun','recallme','validateContact','isValid','checkIsBlackList','VoiceQueueId','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','starttime','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','clone','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','pTalking:\x20','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','util','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','message','originated','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','preview','setMessage','recallMe','clearZombieChannel','info','[clearZombieChannels][talking]','Queue','originated:\x20','stringify','queue','pick','contactId','UserId','Action','channel','updateOriginated','[clearZombieChannel]','dialAnswer','loggerError','[Dialer][checkChannel][pTalking][Preview]','clearZombieChannels','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','catch','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','dialGlobalMaxRetry','cloneAction','createCustomerFinal','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentcomplete','complete','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','Busy','custom:agentbusy','busy','Global','[callProgressDetectingCustomer][logBusyGlobal]'];(function(_0x15ec4e,_0x40b7e0){var _0xb5e5dd=function(_0x42bdd7){while(--_0x42bdd7){_0x15ec4e['push'](_0x15ec4e['shift']());}};_0xb5e5dd(++_0x40b7e0);}(_0x425d,0x1e0));var _0xd425=function(_0x1abd00,_0x37fcde){_0x1abd00=_0x1abd00-0x0;var _0x2424d3=_0x425d[_0x1abd00];return _0x2424d3;};'use strict';var util=require(_0xd425('0x0'));var _=require('lodash');var BPromise=require(_0xd425('0x1'));var uuid=require(_0xd425('0x2'));var moment=require(_0xd425('0x3'));var md5=require(_0xd425('0x4'));var Redis=require(_0xd425('0x5'));var config=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('preview');var loggerAction=require(_0xd425('0x7'))(_0xd425('0x8'));var ami=require(_0xd425('0x9'));var rpcDb=require(_0xd425('0xa'));var Action=require(_0xd425('0xb'));var ut=require(_0xd425('0xc'));config['redis']=_[_0xd425('0xd')](config[_0xd425('0xe')],{'host':_0xd425('0xf'),'port':0x18eb});var io=require(_0xd425('0x10'))(new Redis(config[_0xd425('0xe')]));var Sequence=function(){};Sequence[_0xd425('0x11')][_0xd425('0x12')]=function(_0x1969ba){this[_0xd425('0x13')]=this[_0xd425('0x13')]?this[_0xd425('0x13')][_0xd425('0x14')](_0x1969ba):_0x1969ba();};function Preview(_0x26f6d2){this[_0xd425('0x15')]=new Sequence();this[_0xd425('0x16')]=_0x26f6d2[_0xd425('0x17')];this[_0xd425('0x18')]=_0x26f6d2[_0xd425('0x18')];this[_0xd425('0x19')]={};this[_0xd425('0x1a')]=_0x26f6d2['agents'];this[_0xd425('0x1b')]=0x0;ami['on'](_0xd425('0x1c'),this[_0xd425('0x1d')]['bind'](this));ami['on'](_0xd425('0x1e'),this[_0xd425('0x1f')][_0xd425('0x20')](this));ami['on'](_0xd425('0x21'),this[_0xd425('0x22')]['bind'](this));ami['on'](_0xd425('0x23'),this[_0xd425('0x24')][_0xd425('0x20')](this));ami['on'](_0xd425('0x25'),this['syncNewExten'][_0xd425('0x20')](this));ami['on'](_0xd425('0x26'),this[_0xd425('0x27')][_0xd425('0x20')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this[_0xd425('0x28')][_0xd425('0x20')](this));this[_0xd425('0x29')](this['campaignsPreview']);}function emit(_0x355af0,_0x7e982e,_0x5f1e7e){io['to'](_0x355af0)[_0xd425('0x2a')](_0x7e982e,_0x5f1e7e);}function emitCampaignPreview(_0xf2d0ce){if(_0xf2d0ce[_0xd425('0x2b')]===_0xd425('0x2c')){var _0x3e93db={'id':_0xf2d0ce['id'],'name':_0xf2d0ce[_0xd425('0x2d')],'strategy':_0xf2d0ce[_0xd425('0x2e')],'answered':_0xf2d0ce[_0xd425('0x2f')],'available':_0xf2d0ce[_0xd425('0x30')],'loggedIn':_0xf2d0ce[_0xd425('0x31')],'pTalking':_0xf2d0ce[_0xd425('0x32')],'sumBillable':_0xf2d0ce[_0xd425('0x33')],'sumDuration':_0xf2d0ce['sumDuration'],'sumHoldTime':_0xf2d0ce[_0xd425('0x34')]||0x0,'talking':_0xf2d0ce[_0xd425('0x35')],'total':_0xf2d0ce[_0xd425('0x36')],'type':_0xf2d0ce[_0xd425('0x2b')],'unmanaged':_0xf2d0ce[_0xd425('0x37')],'abandoned':_0xf2d0ce[_0xd425('0x38')],'waiting':_0xf2d0ce[_0xd425('0x39')],'loggedInDb':_0xf2d0ce['loggedInDb'],'dialActive':_0xf2d0ce[_0xd425('0x3a')],'dialMethod':_0xf2d0ce[_0xd425('0x3b')],'dialOriginateCallerIdName':_0xf2d0ce[_0xd425('0x3c')],'dialOriginateCallerIdNumber':_0xf2d0ce['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0xf2d0ce[_0xd425('0x3d')],'dialPrefix':_0xf2d0ce[_0xd425('0x3e')],'outboundAnswerAgiCallsDay':_0xf2d0ce[_0xd425('0x3f')],'outboundAnswerCallsDay':_0xf2d0ce[_0xd425('0x40')],'outboundBlacklistCallsDay':_0xf2d0ce[_0xd425('0x41')],'outboundBusyCallsDay':_0xf2d0ce[_0xd425('0x42')],'outboundCongestionCallsDay':_0xf2d0ce[_0xd425('0x43')],'outboundDropCallsDayACS':_0xf2d0ce[_0xd425('0x44')],'outboundDropCallsDayCallersExit':_0xf2d0ce[_0xd425('0x45')],'outboundDropCallsDayTimeout':_0xf2d0ce[_0xd425('0x46')],'outboundNoAnswerCallsDay':_0xf2d0ce['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xf2d0ce[_0xd425('0x47')],'outboundOriginateFailureCallsDay':_0xf2d0ce[_0xd425('0x48')],'outboundReCallsDay':_0xf2d0ce[_0xd425('0x49')],'outboundRejectCallsDay':_0xf2d0ce[_0xd425('0x4a')],'outboundUnknownCallsDay':_0xf2d0ce[_0xd425('0x4b')],'outboundAbandonedCallsDay':_0xf2d0ce[_0xd425('0x4c')],'predictiveIntervalAnsweredCalls':_0xf2d0ce[_0xd425('0x4d')],'predictiveIntervalAvgHoldtime':_0xf2d0ce[_0xd425('0x4e')],'predictiveIntervalAvgTalktime':_0xf2d0ce[_0xd425('0x4f')],'predictiveIntervalDroppedCallsCallersExit':_0xf2d0ce[_0xd425('0x50')],'predictiveIntervalDroppedCallsTimeout':_0xf2d0ce[_0xd425('0x51')],'predictiveIntervalErlangCalls':_0xf2d0ce['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0xf2d0ce[_0xd425('0x52')],'predictiveIntervalHitRate':_0xf2d0ce[_0xd425('0x53')],'predictiveIntervalMultiplicativeFactor':_0xf2d0ce[_0xd425('0x54')],'predictiveIntervalPauses':_0xf2d0ce[_0xd425('0x55')],'predictiveIntervalAvailable':_0xf2d0ce[_0xd425('0x56')],'predictiveIntervalTotalCalls':_0xf2d0ce['predictiveIntervalTotalCalls'],'message':_0xf2d0ce[_0xd425('0x57')],'originated':_0xf2d0ce[_0xd425('0x58')],'erlangCalls':_0xf2d0ce['erlangCalls'],'erlangCallToSecond':_0xf2d0ce['erlangCallToSecond'],'erlangAbandonmentRate':_0xf2d0ce['erlangAbandonmentRate'],'erlangBusyFactor':_0xf2d0ce[_0xd425('0x59')],'startPredictive':_0xf2d0ce[_0xd425('0x5a')],'startProgressive':_0xf2d0ce[_0xd425('0x5b')]};if(_0xf2d0ce[_0xd425('0x5c')]){_0x3e93db['Trunk']={'id':_0xf2d0ce[_0xd425('0x5c')]['id'],'name':_0xf2d0ce[_0xd425('0x5c')][_0xd425('0x2d')],'active':_0xf2d0ce[_0xd425('0x5c')][_0xd425('0x5d')],'callerid':_0xf2d0ce[_0xd425('0x5c')][_0xd425('0x5e')]};}if(_0xf2d0ce['Interval']){_0x3e93db[_0xd425('0x5f')]={'id':_0xf2d0ce['Interval']['id'],'name':_0xf2d0ce[_0xd425('0x5f')][_0xd425('0x2d')]};}var _0x36c8da=md5(JSON['stringify'](_0x3e93db));if(_0xf2d0ce[_0xd425('0x4')]!==_0x36c8da){_0xf2d0ce[_0xd425('0x4')]=_0x36c8da;emit(util[_0xd425('0x60')](_0xd425('0x61'),_0x3e93db['name']),_0xd425('0x62'),_0x3e93db);}}}function emitVoiceQueueChannelRemove(_0x3cf540){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x3cf540));emit(util[_0xd425('0x60')](_0xd425('0x61'),_0x3cf540[_0xd425('0x2d')]),'voice_queue_channel:remove',_0x3cf540);io['emit']('voice_queue_presence:remove',_0x3cf540);}function notSendMessagesQueue(_0x2fcfb9){if(_0x2fcfb9[_0xd425('0x63')]){if(_0x2fcfb9[_0xd425('0x58')]===0x0&&_0x2fcfb9[_0xd425('0x32')]===0x0){_0x2fcfb9[_0xd425('0x63')]=![];_0x2fcfb9[_0xd425('0x30')]=0x0;_0x2fcfb9[_0xd425('0x64')]=0x0;_0x2fcfb9['message']=_0xd425('0x65');ut[_0xd425('0x66')](_0xd425('0x67'),_0x2fcfb9['name']+_0xd425('0x68'));}else{_0x2fcfb9[_0xd425('0x57')]=_0xd425('0x69');ut['logger'](_0xd425('0x67'),_0x2fcfb9[_0xd425('0x2d')]+_0xd425('0x6a'));}emitCampaignPreview(_0x2fcfb9);}}Preview[_0xd425('0x11')]['loopCampaigns']=function(){var _0x1e9be2=this;setInterval(function(){_0x1e9be2[_0xd425('0x6b')]();},0x7cf);};Preview[_0xd425('0x11')][_0xd425('0x6b')]=function(){var _0x3f24fb=this[_0xd425('0x16')];this[_0xd425('0x1b')]+=0x1;for(var _0x524fad in _0x3f24fb){if(_0x3f24fb[_0xd425('0x6c')](_0x524fad)&&(_0x3f24fb[_0x524fad][_0xd425('0x3b')]==='preview'||_0x3f24fb[_0x524fad][_0xd425('0x3b')]==='booked')&&_0x3f24fb[_0x524fad]['type']===_0xd425('0x2c')){if(this['clockClearZombieChannels']>0x7){this[_0xd425('0x1b')]=0x0;this['clearZombieChannels']();}}if(_0x3f24fb[_0xd425('0x6c')](_0x524fad)&&_0x3f24fb[_0x524fad][_0xd425('0x3b')]===_0xd425('0x6d')&&_0x3f24fb[_0x524fad][_0xd425('0x2b')]===_0xd425('0x2c')){if(_0x3f24fb[_0x524fad]['dialActive']){this[_0xd425('0x6e')](_0x3f24fb[_0x524fad]);if(_0x3f24fb[_0x524fad]['dialPreviewAutoRecallMe'])this[_0xd425('0x6f')](_0x3f24fb[_0x524fad]);}else{notSendMessagesQueue(_0x3f24fb[_0x524fad]);}}}};Preview['prototype'][_0xd425('0x70')]=function(_0x16f61c){var _0x3fd2ce=this;this[_0xd425('0x15')][_0xd425('0x12')](function(){if(!_['isNil'](_0x3fd2ce[_0xd425('0x19')][_0x16f61c])){loggerAction[_0xd425('0x71')](_0xd425('0x72'),_0x16f61c,_0xd425('0x73'),_0x3fd2ce[_0xd425('0x19')][_0x16f61c]['queue'],_0xd425('0x74'),JSON[_0xd425('0x75')](_0x3fd2ce[_0xd425('0x16')][_0x3fd2ce[_0xd425('0x19')][_0x16f61c][_0xd425('0x76')]][_0xd425('0x58')]),'pTalking:\x20',JSON[_0xd425('0x75')](_0x3fd2ce[_0xd425('0x16')][_0x3fd2ce['actions'][_0x16f61c][_0xd425('0x76')]][_0xd425('0x32')]),JSON[_0xd425('0x75')](_0x3fd2ce[_0xd425('0x19')][_0x16f61c]['dialAnswer']),JSON[_0xd425('0x75')](_[_0xd425('0x77')](_0x3fd2ce[_0xd425('0x19')][_0x16f61c],[_0xd425('0x78'),_0xd425('0x79'),'VoiceQueueId','ListId'])));return ami[_0xd425('0x7a')]({'action':'status','channel':_0x3fd2ce[_0xd425('0x19')][_0x16f61c][_0xd425('0x7b')]})['catch'](function(_0x411d41){if(_0x411d41['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x3fd2ce[_0xd425('0x19')][_0x16f61c]){ut[_0xd425('0x7c')](_0x3fd2ce[_0xd425('0x16')][_0x3fd2ce[_0xd425('0x19')][_0x16f61c][_0xd425('0x76')]],_0xd425('0x7d'));if(_0x3fd2ce[_0xd425('0x19')][_0x16f61c][_0xd425('0x7e')]===!![]){ut['decrementTalkink'](_0x3fd2ce[_0xd425('0x16')][_0x3fd2ce[_0xd425('0x19')][_0x16f61c][_0xd425('0x76')]],_0xd425('0x7d'));ut[_0xd425('0x7f')](_0xd425('0x80')+_0x16f61c,_0x3fd2ce[_0xd425('0x19')][_0x16f61c][_0xd425('0x76')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x16f61c,_0x3fd2ce['actions'][_0x16f61c][_0xd425('0x76')]);delete _0x3fd2ce[_0xd425('0x19')][_0x16f61c];}},0x2328);}});}});};Preview[_0xd425('0x11')][_0xd425('0x81')]=function(){var _0x59c286=this;loggerAction['info']('[action]',_['size'](this[_0xd425('0x19')]));for(var _0x44c5e4 in this['actions']){if(_0x59c286[_0xd425('0x19')][_0xd425('0x6c')](_0x44c5e4)){_0x59c286[_0xd425('0x70')](_0x44c5e4);}}};Preview['prototype']['recallMe']=function(_0x599cb5){var _0x49d75e=this;rpcDb['getContactRecallMe'](_0x599cb5['id'],ut['agentReadyId'](this[_0xd425('0x1a')]))[_0xd425('0x82')](function(_0x22b00e){if(!_['isNil'](_0x22b00e)){for(var _0x3395d8=0x0;_0x3395d8<_0x22b00e['length'];_0x3395d8+=0x1){if(ut[_0xd425('0x83')](_0x22b00e[_0x3395d8][_0xd425('0x84')])<_0x599cb5[_0xd425('0x85')]*0x3c){if(_0x22b00e[_0x3395d8][_0xd425('0x86')]&&!_0x22b00e[_0x3395d8][_0xd425('0x86')][_0xd425('0x87')]){_0x49d75e[_0xd425('0x88')](_0x22b00e[_0x3395d8]['id'])[_0xd425('0x82')](ut[_0xd425('0x89')]('[RecallMe]'))[_0xd425('0x8a')](ut[_0xd425('0x89')](_0xd425('0x8b')));}else{rpcDb[_0xd425('0x8c')](_0x22b00e[_0x3395d8]['id']);}}else{var _0x5c4df8=new Action(_0x22b00e[_0x3395d8],_0x599cb5);_0x5c4df8['starttime']=moment()[_0xd425('0x60')](_0xd425('0x8d'));_0x599cb5[_0xd425('0x49')]+=0x1;ut[_0xd425('0x8e')](_0x5c4df8,0x17,_0xd425('0x8f'));if(_0x599cb5[_0xd425('0x90')]){rpcDb[_0xd425('0x91')](ut[_0xd425('0x92')](_0x22b00e[_0x3395d8]));rpcDb[_0xd425('0x93')](_0x5c4df8,_0xd425('0x94'));}else{ut[_0xd425('0x8e')](_0x5c4df8,0x16,_0xd425('0x95'));rpcDb[_0xd425('0x93')](_0x5c4df8,_0xd425('0x96'));rpcDb['createCustomerFinal'](_0x5c4df8,_0xd425('0x96'));}}}}})[_0xd425('0x8a')](ut[_0xd425('0x89')]('[getContactRecallMe]'));};Preview['prototype']['setMessage']=function(_0x403cb3){_0x403cb3[_0xd425('0x63')]=!![];if(ut[_0xd425('0x97')](_0x403cb3['loggedIn'])){_0x403cb3[_0xd425('0x57')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xd425('0x98')](_0x403cb3[_0xd425('0x3a')])){_0x403cb3[_0xd425('0x57')]='NOT_ACTIVE';}else if(!this[_0xd425('0x99')](_0x403cb3[_0xd425('0x5c')])){if(!this[_0xd425('0x99')](_0x403cb3[_0xd425('0x9a')])){_0x403cb3[_0xd425('0x57')]=_0xd425('0x9b');}else{_0x403cb3[_0xd425('0x57')]=_0xd425('0x9c');}}else{_0x403cb3[_0xd425('0x57')]=_0xd425('0x9c');}emitCampaignPreview(_0x403cb3);};Preview[_0xd425('0x11')][_0xd425('0x9d')]=function(_0xebfc5b,_0x285d54,_0x445f98){var _0x443126=this;var _0x623ff5=this[_0xd425('0x19')][_0x285d54];var _0x541218=this['campaignsPreview'][_0x623ff5[_0xd425('0x76')]];var _0x5c333a;if(_0x541218){switch(_0x445f98){case'1':_0x541218[_0xd425('0x47')]+=0x1;_0x623ff5[_0xd425('0x9e')]+=0x1;_0x623ff5[_0xd425('0x9f')]=ut[_0xd425('0xa0')](_0x623ff5);ut['logCustomer'](_0x623ff5,0x0,_0xd425('0xa1'));ami[_0xd425('0x2a')](_0xd425('0xa2'),ut[_0xd425('0xa3')](_0x623ff5,_0xd425('0xa4')));rpcDb[_0xd425('0x93')](_0x623ff5,'[callProgressDetectingCustomer][logNoSuch]');if(ut['totalGlobal'](_0x623ff5)>=_0x541218[_0xd425('0xa5')]){_0x5c333a=ut[_0xd425('0xa6')](_0x623ff5,0xf,'Global');rpcDb[_0xd425('0xa7')](_0x5c333a,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x623ff5[_0xd425('0x9e')]>=_0x541218[_0xd425('0xa8')]){rpcDb[_0xd425('0xa7')](_0x623ff5,_0xd425('0xa9'));}else{rpcDb[_0xd425('0xaa')](ut[_0xd425('0xab')](_0x623ff5,_0xd425('0x9e'),_0x541218['dialNoSuchNumberRetryFrequency']),_0x623ff5[_0xd425('0xac')],_0x623ff5[_0xd425('0xad')]);}}delete this[_0xd425('0x19')][_0xebfc5b[_0xd425('0xae')]];break;case _0xd425('0xaf'):var _0x59e1e9=moment()[_0xd425('0x60')](_0xd425('0x8d'));_0x623ff5['responsetime']=_0x59e1e9;_0x623ff5[_0xd425('0xb0')]=_0x59e1e9;_0x623ff5[_0xd425('0x7e')]=!![];_0x541218['pTalking']+=0x1;logger[_0xd425('0x71')](_0xd425('0xb1'),_0x623ff5[_0xd425('0xb2')],_0xd425('0xb3'),_0x541218[_0xd425('0x2d')],'pTalking:\x20',_0x541218[_0xd425('0x32')]);ami['emit'](_0xd425('0xb4'),ut[_0xd425('0xa3')](_0x623ff5,'connect',this[_0xd425('0x16')][_0x623ff5[_0xd425('0x76')]]));if(_0x541218[_0xd425('0xb5')]){ami[_0xd425('0x2a')]('custom:agentConnectPreview',ut['buildAcw'](_0x623ff5));}break;case'16':ami[_0xd425('0x2a')](_0xd425('0xb6'),ut[_0xd425('0xa3')](_0x623ff5,'complete',this[_0xd425('0x16')][_0x623ff5[_0xd425('0x76')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x623ff5,_0xd425('0xb7')));_0x541218['outboundAnswerCallsDay']+=0x1;_0x541218[_0xd425('0x36')]+=0x1;_0x541218[_0xd425('0x2f')]+=0x1;ut[_0xd425('0xb8')](_0x541218,_0xd425('0xb9'));_0x623ff5['countglobal']=ut['totalGlobal'](_0x623ff5);ut[_0xd425('0x8e')](_0x623ff5,0x4,_0xd425('0xba'));rpcDb['createCustomerHistory'](_0x623ff5,_0xd425('0xbb'));rpcDb[_0xd425('0xa7')](_0x623ff5,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xd425('0xbc')](_0x623ff5);_0x541218[_0xd425('0xbd')]+=_0x623ff5[_0xd425('0xbe')];_0x541218[_0xd425('0x33')]+=_0x623ff5[_0xd425('0xbe')];logger[_0xd425('0x71')](_0xd425('0xbf'),_0x623ff5['uniqueid'],'\x20Queue',_0x541218[_0xd425('0x2d')],'pTalking:\x20',_0x541218[_0xd425('0x32')]);delete this[_0xd425('0x19')][_0xebfc5b['linkedid']];break;case _0xd425('0xc0'):_0x541218[_0xd425('0x42')]+=0x1;_0x623ff5['countbusyretry']+=0x1;_0x623ff5['countglobal']=ut[_0xd425('0xa0')](_0x623ff5);ut[_0xd425('0x8e')](_0x623ff5,0x5,_0xd425('0xc1'));ami[_0xd425('0x2a')](_0xd425('0xc2'),ut[_0xd425('0xa3')](_0x623ff5,_0xd425('0xc3')));rpcDb[_0xd425('0x93')](_0x623ff5,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xd425('0xa0')](_0x623ff5)>=_0x541218[_0xd425('0xa5')]){_0x5c333a=ut['cloneAction'](_0x623ff5,0xf,_0xd425('0xc4'));rpcDb[_0xd425('0xa7')](_0x5c333a,_0xd425('0xc5'));}else{if(_0x623ff5[_0xd425('0xc6')]>=_0x541218[_0xd425('0xc7')]){rpcDb[_0xd425('0xa7')](_0x623ff5,_0xd425('0xc8'));}else{rpcDb[_0xd425('0xaa')](ut[_0xd425('0xab')](_0x623ff5,_0xd425('0xc6'),_0x541218[_0xd425('0xc9')]),_0x623ff5['unlockAgent'],_0x623ff5[_0xd425('0xad')]);}}break;case'NOANSWER':_0x541218['outboundNoAnswerCallsDay']+=0x1;_0x623ff5[_0xd425('0xca')]+=0x1;_0x623ff5['countglobal']=ut[_0xd425('0xa0')](_0x623ff5);ut[_0xd425('0x8e')](_0x623ff5,0x3,_0xd425('0xcb'));ami[_0xd425('0x2a')](_0xd425('0xcc'),ut[_0xd425('0xa3')](_0x623ff5,_0xd425('0xcd')));rpcDb['createCustomerHistory'](_0x623ff5,_0xd425('0xce'));if(ut[_0xd425('0xa0')](_0x623ff5)>=_0x541218[_0xd425('0xa5')]){_0x5c333a=ut[_0xd425('0xa6')](_0x623ff5,0xf,_0xd425('0xc4'));rpcDb['createCustomerFinal'](_0x5c333a,_0xd425('0xcf'));}else{if(_0x623ff5[_0xd425('0xca')]>=_0x541218[_0xd425('0xd0')]){rpcDb[_0xd425('0xa7')](_0x623ff5,_0xd425('0xce'));}else{rpcDb[_0xd425('0xaa')](ut[_0xd425('0xab')](_0x623ff5,_0xd425('0xca'),_0x541218[_0xd425('0xd1')]),_0x623ff5[_0xd425('0xac')],_0x623ff5[_0xd425('0xad')]);}}break;case _0xd425('0xd2'):_0x541218['outboundCongestionCallsDay']+=0x1;_0x623ff5[_0xd425('0xd3')]+=0x1;_0x623ff5['countglobal']=ut[_0xd425('0xa0')](_0x623ff5);ut[_0xd425('0x8e')](_0x623ff5,0x8,_0xd425('0xd4'));ami[_0xd425('0x2a')](_0xd425('0xd5'),ut['buildObj'](_0x623ff5,_0xd425('0xd6')));rpcDb[_0xd425('0x93')](_0x623ff5,_0xd425('0xd7'));if(ut[_0xd425('0xa0')](_0x623ff5)>=_0x541218[_0xd425('0xa5')]){_0x5c333a=ut[_0xd425('0xa6')](_0x623ff5,0xf,_0xd425('0xc4'));rpcDb['createCustomerFinal'](_0x5c333a,_0xd425('0xd8'));}else{if(_0x623ff5['countcongestionretry']>=_0x541218[_0xd425('0xd9')]){rpcDb[_0xd425('0xa7')](_0x623ff5,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xd425('0xaa')](ut[_0xd425('0xab')](_0x623ff5,'countcongestionretry',_0x541218[_0xd425('0xc9')]),_0x623ff5[_0xd425('0xac')],_0x623ff5[_0xd425('0xad')]);}}break;case _0xd425('0xda'):_0x541218[_0xd425('0x4a')]+=0x1;_0x623ff5[_0xd425('0xdb')]+=0x1;_0x623ff5['countglobal']=ut[_0xd425('0xa0')](_0x623ff5);ut['logCustomer'](_0x623ff5,0x14,_0xd425('0xdc'));ami['emit'](_0xd425('0xdd'),ut[_0xd425('0xa3')](_0x623ff5,_0xd425('0xde')));rpcDb[_0xd425('0x93')](_0x623ff5,'[syncHangupRequest][logAgentReject]');if(ut['totalGlobal'](_0x623ff5)>=_0x541218['dialGlobalMaxRetry']){_0x5c333a=ut['cloneAction'](_0x623ff5,0x14,_0xd425('0xdc'));rpcDb['createCustomerFinal'](_0x5c333a,_0xd425('0xdf'));}else{if(_0x623ff5[_0xd425('0xdb')]>=_0x541218[_0xd425('0xe0')]){rpcDb[_0xd425('0xa7')](_0x623ff5,_0xd425('0xdf'));}else{rpcDb[_0xd425('0xaa')](ut['scheduledAt'](_0x623ff5,_0xd425('0xdb'),_0x541218[_0xd425('0xe1')]),_0x623ff5[_0xd425('0xac')],_0x623ff5[_0xd425('0xad')]);}}break;case _0xd425('0xe2'):_0x541218['outboundAbandonedCallsDay']+=0x1;_0x623ff5[_0xd425('0xe3')]+=0x1;_0x623ff5[_0xd425('0x9f')]=ut[_0xd425('0xa0')](_0x623ff5);ut['logCustomer'](_0x623ff5,0xb,_0xd425('0xe4'));rpcDb[_0xd425('0x93')](_0x623ff5,_0xd425('0xe5'));if(ut[_0xd425('0xa0')](_0x623ff5)>=_0x541218[_0xd425('0xa5')]){_0x5c333a=ut['cloneAction'](_0x623ff5,0xf,_0xd425('0xc4'));rpcDb['createCustomerFinal'](_0x5c333a,_0xd425('0xe5'));}else{if(_0x623ff5[_0xd425('0xe6')]>=_0x541218['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x623ff5,_0xd425('0xe5'));}else{rpcDb['rescheduleContact'](ut[_0xd425('0xab')](_0x623ff5,_0xd425('0xe3'),_0x541218[_0xd425('0xe7')]),_0x623ff5[_0xd425('0xac')],_0x623ff5['activeContact']);}}break;case'18':_0x541218[_0xd425('0x4b')]+=0x1;_0x623ff5[_0xd425('0xe8')]+=0x1;_0x623ff5[_0xd425('0x9f')]=ut[_0xd425('0xa0')](_0x623ff5);ut[_0xd425('0x8e')](_0x623ff5,0x12,_0xebfc5b[_0xd425('0xe9')]||_0xebfc5b['dialstatus']);ami[_0xd425('0x2a')](_0xd425('0xea'),ut[_0xd425('0xa3')](_0x623ff5,_0xd425('0xeb')));rpcDb[_0xd425('0x93')](_0x623ff5,_0xd425('0xec'));if(ut['totalGlobal'](_0x623ff5)>=_0x541218[_0xd425('0xa5')]){_0x5c333a=ut[_0xd425('0xa6')](_0x623ff5,0xf,'Global');rpcDb[_0xd425('0xa7')](_0x5c333a,_0xd425('0xec'));}else{rpcDb['createCustomerFinal'](_0x623ff5,_0xd425('0xec'));}delete this[_0xd425('0x19')][_0xebfc5b[_0xd425('0xae')]];break;case'19':_0x541218[_0xd425('0x4b')]+=0x1;_0x623ff5['countglobal']=ut[_0xd425('0xa0')](_0x623ff5);ut[_0xd425('0x8e')](_0x623ff5,0x13,_0xebfc5b['cause-txt']||_0xebfc5b[_0xd425('0xed')]);ami[_0xd425('0x2a')](_0xd425('0xea'),ut[_0xd425('0xa3')](_0x623ff5,_0xd425('0xeb')));rpcDb[_0xd425('0x93')](_0x623ff5,_0xd425('0xee'));if(ut['totalGlobal'](_0x623ff5)>=_0x541218[_0xd425('0xa5')]){_0x5c333a=ut['cloneAction'](_0x623ff5,0xf,_0xd425('0xc4'));rpcDb[_0xd425('0xa7')](_0x5c333a,'[callProgressDetectingCustomer][machine]');}else{rpcDb['createCustomerFinal'](_0x623ff5,_0xd425('0xee'));}delete this[_0xd425('0x19')][_0xebfc5b[_0xd425('0xae')]];break;default:if(_0x623ff5['dialAnswer']){ut[_0xd425('0xb8')](_0x541218,'[default]');ut['loggerError'](_0xd425('0xef')+_0x541218[_0xd425('0x2d')],_0xebfc5b);}_0x541218[_0xd425('0x4b')]+=0x1;_0x623ff5[_0xd425('0x9f')]=ut[_0xd425('0xa0')](_0x623ff5);ut['logCustomer'](_0x623ff5,0xc,_0xebfc5b[_0xd425('0xe9')]||_0xebfc5b[_0xd425('0xed')]);rpcDb[_0xd425('0x93')](_0x623ff5,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0xd425('0xa0')](_0x623ff5)>=_0x541218[_0xd425('0xa5')]){_0x5c333a=ut[_0xd425('0xa6')](_0x623ff5,0xf,_0xd425('0xc4'));rpcDb[_0xd425('0xa7')](_0x5c333a,_0xd425('0xf0'));}else{rpcDb['createCustomerFinal'](_0x623ff5,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0xebfc5b[_0xd425('0xae')]];}if(!(_0x623ff5['dialAnswer']&&_0x445f98==='16')){ut[_0xd425('0x7c')](_0x541218,_0xd425('0xf1'));logger[_0xd425('0x71')](_0xd425('0xf2'),_0x623ff5[_0xd425('0xb2')],_0xd425('0xb3'),_0x541218[_0xd425('0x2d')],_0xd425('0x74'),_0x541218[_0xd425('0x58')]);}if(_0x445f98!==_0xd425('0xaf')){delete this[_0xd425('0x19')][_0xebfc5b['linkedid']];delete this[_0xd425('0x19')][_0xebfc5b[_0xd425('0xf3')]];}}};Preview[_0xd425('0x11')][_0xd425('0xf4')]=function(_0x2e537e,_0x21c4ea,_0x5e796d){if(_[_0xd425('0xf5')](_0x21c4ea)&&_0xd425('0xf6')!==typeof _0x21c4ea){return;}if(_[_0xd425('0xf5')](_0x5e796d)&&'object'!==typeof _0x5e796d){return;}switch(_0x5e796d[_0xd425('0xf7')]){case'0':ut[_0xd425('0xf8')](_0x2e537e,0x0,'NoSuchNumber');rpcDb[_0xd425('0xf9')](_0x2e537e,_0xd425('0xfa'));break;case'3':ut['logAgent'](_0x2e537e,0x3,_0xd425('0xcb'));rpcDb[_0xd425('0xf9')](_0x2e537e,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xd425('0xf8')](_0x2e537e,0x5,_0xd425('0xc1'));rpcDb[_0xd425('0xf9')](_0x2e537e,_0xd425('0xfb'));break;case'8':ut[_0xd425('0xf8')](_0x2e537e,0x8,_0xd425('0xd4'));rpcDb[_0xd425('0xf9')](_0x2e537e,_0xd425('0xfc'));break;case'22':ut[_0xd425('0xf8')](_0x2e537e,0x16,_0xd425('0xfd'));rpcDb[_0xd425('0xf9')](_0x2e537e,_0xd425('0xfe'));break;default:ut[_0xd425('0xf8')](_0x2e537e,0xc,_0x5e796d[_0xd425('0xf7')]);rpcDb['createAgentHistory'](_0x2e537e,_0xd425('0xfc'));}ut[_0xd425('0x7c')](_0x21c4ea,'[callProgressDetectingAgent]');logger[_0xd425('0x71')](_0xd425('0xff'),_0x2e537e['uniqueid'],'\x20Queue',_0x21c4ea[_0xd425('0x2d')],_0xd425('0x74'),_0x21c4ea['originated']);delete this[_0xd425('0x19')][_0x2e537e[_0xd425('0xb2')]];};Preview[_0xd425('0x11')][_0xd425('0x100')]=function(_0x1abb06,_0x3bb07d,_0x140e81,_0x408909,_0x62a924){var _0x15590a=this;return new BPromise(function(_0x425b3c,_0x33a866){if(_[_0xd425('0x101')](_0x3bb07d)||_[_0xd425('0x101')](_0x3bb07d[_0xd425('0x102')])||_[_0xd425('0x101')](_0x3bb07d['Contact'][_0xd425('0x103')])||_['isNil'](_0x3bb07d['VoiceQueueId'])){_0x33a866(ut[_0xd425('0x57')](_0xd425('0x104'),_0x408909,_0x62a924));return;}var _0x26286c=uuid['v4']();var _0x4b9f23=_0x15590a[_0xd425('0x16')][_0x3bb07d[_0xd425('0x73')][_0xd425('0x2d')]];var _0x46730c=_0x140e81?_0x15590a[_0xd425('0x1a')][_0x140e81]['id']:undefined;_0x15590a[_0xd425('0x19')][_0x26286c]=new Action(_0x3bb07d,_0x4b9f23,_0x26286c,_0x140e81,_0x46730c);var _0xedd963=_0x15590a[_0xd425('0x19')][_0x26286c];_0xedd963[_0xd425('0xac')]=_0x408909;_0xedd963[_0xd425('0xad')]=_0x62a924;_0xedd963[_0xd425('0x105')]=_0x140e81;if(_['isEmpty'](_0x1abb06)){_0x15590a[_0xd425('0x106')](_0xedd963,_0x4b9f23,_0x3bb07d,_0x140e81)[_0xd425('0x82')](function(_0x30dbbd){logger[_0xd425('0x71')](_0xd425('0x107'),_0xd425('0x108')+_0xedd963[_0xd425('0x76')]+_0xd425('0x109')+_0xedd963[_0xd425('0x10a')],JSON['stringify'](_0x30dbbd));ami[_0xd425('0x2a')](_0xd425('0x10b'),ut[_0xd425('0xa3')](_0xedd963,_0xd425('0x10c'),_0x15590a['campaignsPreview'][_0xedd963[_0xd425('0x76')]]));_0x425b3c(ut['message']('Calling'));})[_0xd425('0x8a')](function(_0x416d9c){ut['logger']('[Preview][execCall][failure]',_0x416d9c);_0x33a866(ut['message'](_0xd425('0x10d'),_0x408909,_0x62a924));});}else{_0x4b9f23[_0xd425('0x41')]+=0x1;ut[_0xd425('0x10e')](_0xedd963);rpcDb['createHistory'](_0xedd963,_0xd425('0x10f'));delete _0x15590a[_0xd425('0x19')][_0x26286c];_0x33a866(ut['message'](_0xd425('0x110'),_0x408909,_0x62a924));}});};Preview['prototype'][_0xd425('0x99')]=function(_0x3f113f){return!_[_0xd425('0x101')](_0x3f113f)&&!_['isNil'](_0x3f113f[_0xd425('0x2d')])&&!_['isNil'](_0x3f113f[_0xd425('0x5d')])&&_0x3f113f[_0xd425('0x5d')]&&!_['isNil'](this[_0xd425('0x18')][util[_0xd425('0x60')](_0xd425('0x111'),_0x3f113f['name'])])&&!_[_0xd425('0x101')](this['trunks'][util[_0xd425('0x60')](_0xd425('0x111'),_0x3f113f[_0xd425('0x2d')])][_0xd425('0x112')])&&(this['trunks'][util[_0xd425('0x60')]('SIP/%s',_0x3f113f[_0xd425('0x2d')])][_0xd425('0x112')]===_0xd425('0x113')||this[_0xd425('0x18')][util[_0xd425('0x60')](_0xd425('0x111'),_0x3f113f[_0xd425('0x2d')])]['status']===_0xd425('0x114'));};Preview[_0xd425('0x11')][_0xd425('0x88')]=function(_0x2cfb4d,_0xb95e18){var _0x34e5d6=this;return new BPromise(function(_0x104689,_0x4778cf){_0x34e5d6['execRun'](_0x2cfb4d,_0xb95e18)['then'](function(_0x4c5283){_0x104689(_['pick'](_0x4c5283,[_0xd425('0x57')]));})[_0xd425('0x8a')](function(_0x4ef9a8){if(_0x4ef9a8[_0xd425('0x115')]){rpcDb['unlockContact'](_0x2cfb4d);}if(_0x4ef9a8[_0xd425('0x5d')]){rpcDb['disableContact'](_0x2cfb4d);}_0x4778cf(_[_0xd425('0x77')](_0x4ef9a8,[_0xd425('0x57')]));});});};Preview['prototype'][_0xd425('0x116')]=function(_0x55307b,_0x206274){var _0x3c4797=this;return new BPromise(function(_0xa506b3,_0x4f7d56){var _0x53a814,_0x22d256;rpcDb['getContactPreview'](_0x55307b)[_0xd425('0x82')](function(_0x14f585){if(!_[_0xd425('0x101')](_0x14f585[0x0])){_0x22d256=_0x14f585[0x0]['recallme']?![]:!![];_0x53a814=_0x14f585[0x0][_0xd425('0x117')]?!![]:![];_0x53a814=_0x206274?!![]:_0x53a814;}var _0xb8f569=_0x3c4797[_0xd425('0x118')](_0x14f585);if(_0xb8f569[_0xd425('0x119')]){rpcDb[_0xd425('0x11a')](_['pick'](_0x14f585[0x0],[_0xd425('0x11b'),'Contact.phone']))[_0xd425('0x82')](function(_0x22c0dd){_0x3c4797[_0xd425('0x100')](_0x22c0dd,_0x14f585[0x0],_0x206274,_0x22d256,_0x53a814)[_0xd425('0x82')](function(_0x4ec685){_0xa506b3(_0x4ec685);})[_0xd425('0x8a')](function(_0xc6ce80){_0x4f7d56(_0xc6ce80);});})[_0xd425('0x8a')](function(_0x16b244){ut['logger']('[Preview][checkIsBlackList]',_0x16b244);_0x4f7d56(ut[_0xd425('0x57')]('Call\x20unsuccessful',_0x22d256,_0x53a814));});}else{_0x4f7d56(ut[_0xd425('0x57')](_0xb8f569[_0xd425('0x57')],_0x22d256,_0x53a814));}})[_0xd425('0x8a')](function(_0x2d4776){ut['logger'](_0xd425('0x11c'),_0x2d4776);_0x4f7d56(ut[_0xd425('0x57')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xd425('0x11')][_0xd425('0x118')]=function(_0x5506eb){if(_[_0xd425('0x101')](_0x5506eb)||_[_0xd425('0x11d')](_0x5506eb)||!_['isNil'](_0x5506eb[0x0][_0xd425('0x86')])&&_[_0xd425('0x101')](_0x5506eb[0x0][_0xd425('0x86')]['name'])){ut[_0xd425('0x66')]('[Preview][validateContact][Empty\x20Contact]',_0x5506eb);return{'isValid':![],'message':_0xd425('0x11e')};}var _0x49ef3f=this['campaignsPreview'][_0x5506eb[0x0]['Queue'][_0xd425('0x2d')]];_0x49ef3f[_0xd425('0x57')]=_0xd425('0x9c');if(_[_0xd425('0x101')](_0x49ef3f)){ut[_0xd425('0x66')](_0xd425('0x11f'),_0x49ef3f);return{'isValid':![],'message':_0xd425('0x120')};}if(!this[_0xd425('0x99')](_0x49ef3f[_0xd425('0x5c')])){ut['logger'](_0xd425('0x121'),_0xd425('0x122')+_0x49ef3f[_0xd425('0x2d')]+_0xd425('0x123'));if(!this[_0xd425('0x99')](_0x49ef3f[_0xd425('0x9a')])){ut[_0xd425('0x66')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x49ef3f[_0xd425('0x2d')]+_0xd425('0x124'));return{'isValid':![],'message':_0xd425('0x125')};}}if(!ut['isActive'](_0x49ef3f[_0xd425('0x3a')])){ut[_0xd425('0x66')](_0xd425('0x126'),_0x49ef3f[_0xd425('0x2d')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xd425('0x122')+_0x49ef3f['name']+_0xd425('0x127')};}return{'isValid':!![],'message':_0xd425('0x128')};};Preview[_0xd425('0x11')]['execCall']=function(_0x1030e1,_0x17ab99,_0xd43b8,_0xa7142d){var _0x297d41=this;return new BPromise(function(_0x154018,_0x294318){var _0x4ec64d=_0x1030e1[_0xd425('0xb2')];var _0x2d17a3=_0x297d41[_0xd425('0x99')](_0x17ab99['Trunk'])?util[_0xd425('0x60')](_0xd425('0x129'),_0x17ab99['Trunk']['name'],_[_0xd425('0x101')](_0x17ab99[_0xd425('0x3e')])?'':_0x17ab99[_0xd425('0x3e')][_0xd425('0x12a')]()||'',_0x17ab99[_0xd425('0x12b')]>0x0?_0xd43b8[_0xd425('0x102')]['phone']['substring'](_0x17ab99[_0xd425('0x12b')]):_0xd43b8[_0xd425('0x102')][_0xd425('0x103')]):util[_0xd425('0x60')](_0xd425('0x129'),_[_0xd425('0x101')](_0x17ab99['TrunkBackup'])?_0x17ab99['Trunk'][_0xd425('0x2d')]:_0x17ab99[_0xd425('0x9a')][_0xd425('0x2d')],_[_0xd425('0x101')](_0x17ab99['dialPrefix'])?'':_0x17ab99['dialPrefix'][_0xd425('0x12a')]()||'',_0x17ab99[_0xd425('0x12b')]>0x0?_0xd43b8[_0xd425('0x102')][_0xd425('0x103')][_0xd425('0x12c')](_0x17ab99[_0xd425('0x12b')]):_0xd43b8[_0xd425('0x102')][_0xd425('0x103')]);var _0x4b4a2b=_0x297d41[_0xd425('0x99')](_0x17ab99[_0xd425('0x5c')])?ut['getCallerId'](_0x17ab99[_0xd425('0x5c')]['callerid'],_0x17ab99[_0xd425('0x3c')],_0x17ab99[_0xd425('0x12d')]>0x0?ut[_0xd425('0x12e')](_0x17ab99[_0xd425('0x12f')],_0x17ab99['dialRandomLastDigitCallerIdNumber']):_0x17ab99[_0xd425('0x12f')]):ut[_0xd425('0x130')](_[_0xd425('0x101')](_0x17ab99[_0xd425('0x9a')])?_0x17ab99[_0xd425('0x5c')]['callerid']:_0x17ab99[_0xd425('0x9a')][_0xd425('0x5e')],_0x17ab99[_0xd425('0x3c')],_0x17ab99[_0xd425('0x12d')]>0x0?ut[_0xd425('0x12e')](_0x17ab99[_0xd425('0x12f')],_0x17ab99[_0xd425('0x12d')]):_0x17ab99[_0xd425('0x12f')]);if(_0x4b4a2b){_0x1030e1['originatecalleridname']=ut[_0xd425('0x131')](_0x4b4a2b);_0x1030e1[_0xd425('0x132')]=ut[_0xd425('0x133')](_0x4b4a2b);}var _0x5b01dc=ut[_0xd425('0x134')](_0x17ab99,_0xd43b8,_0x2d17a3,_0x4b4a2b,_0x4ec64d,_0x1030e1);_[_0xd425('0x135')](_0x1030e1,ut['toLowerVariables'](_0x5b01dc));_0x1030e1[_0xd425('0x136')]=moment()['format'](_0xd425('0x8d'));ami[_0xd425('0x7a')](ut[_0xd425('0x137')](_0x1030e1,_0x17ab99,_0x5b01dc,_0x1030e1['activeContact'],_0xa7142d))[_0xd425('0x82')](function(_0xf26c78){_0x17ab99['originated']+=0x1;logger[_0xd425('0x71')](_0xd425('0x138'),_0x4ec64d,_0xd425('0xb3'),_0x17ab99[_0xd425('0x2d')],_0xd425('0x74'),_0x17ab99['originated']);_0x154018(_0xf26c78);})[_0xd425('0x8a')](function(_0x4962ea){ut[_0xd425('0xf8')](_0x1030e1,0xe,_0xd425('0x139'));rpcDb['createAgentHistory'](_0x1030e1,_0xd425('0x13a'));_0x294318(_0x4962ea);});});};Preview[_0xd425('0x11')]['syncNewExten']=function(_0x1619ab){if(this['actions'][_0x1619ab['linkedid']]){this[_0xd425('0x19')][_0x1619ab[_0xd425('0xae')]][_0xd425('0x7b')]=_0x1619ab[_0xd425('0x7b')];}};Preview['prototype'][_0xd425('0x1d')]=function(_0x5a674d){var _0x51fb24=this;var _0x3219f9=this[_0xd425('0x19')][_0x5a674d['actionid']];if(_0x3219f9){if(_0x3219f9[_0xd425('0x105')]&&this[_0xd425('0x1a')][_0x3219f9[_0xd425('0x105')]]){ut[_0xd425('0x13b')](_0x3219f9,this['agents'][_0x3219f9[_0xd425('0x105')]][_0xd425('0x2d')],this['agents'][_0x3219f9[_0xd425('0x105')]]['id']);}var _0x51e211=_[_0xd425('0x13c')](_0x3219f9);_0x51e211['responsetime']=moment()[_0xd425('0x60')](_0xd425('0x8d'));var _0xf7360=_0x51fb24[_0xd425('0x16')][_0x3219f9[_0xd425('0x76')]];if(ut['isFailure'](_0x5a674d['response'])){if(_0x3219f9[_0xd425('0xac')]){rpcDb[_0xd425('0x13d')](_0x3219f9[_0xd425('0x10a')]);}if(_0x3219f9[_0xd425('0xad')]){rpcDb[_0xd425('0x8c')](_0x3219f9[_0xd425('0x10a')]);}ami[_0xd425('0x2a')](_0xd425('0x13e'),ut['buildObj'](_0x3219f9,_0xd425('0x13f'),this[_0xd425('0x16')][_0x3219f9[_0xd425('0x76')]]));this['callProgressDetectingAgent'](_0x51e211,_0xf7360,_0x5a674d);}else{_0x3219f9[_0xd425('0x136')]=moment()[_0xd425('0x60')](_0xd425('0x8d'));ut[_0xd425('0xf8')](_0x51e211,0x4,_0xd425('0xba'));rpcDb['createAgentHistory'](_0x51e211,_0xd425('0x140'));}}};Preview['prototype']['syncHangup']=function(_0x573c54){var _0x32f74b=this;var _0x4c1e30=this[_0xd425('0x19')][_0x573c54[_0xd425('0xae')]];var _0x51e1a6;if(_0x4c1e30){_0x51e1a6=this[_0xd425('0x16')][_0x4c1e30['queue']];logger[_0xd425('0x71')](_0xd425('0x141'),_0x573c54[_0xd425('0xae')],_0xd425('0xb3'),_0x51e1a6[_0xd425('0x2d')],_0xd425('0x142'),_0x51e1a6[_0xd425('0x32')]);}if(this[_0xd425('0x19')][_0x573c54['linkedid']]&&_0x573c54[_0xd425('0xae')]!==_0x573c54[_0xd425('0xb2')]){if(_0x573c54[_0xd425('0x143')]==='16'&&this[_0xd425('0x19')][_0x573c54[_0xd425('0xae')]][_0xd425('0x7e')]){this[_0xd425('0x9d')](_0x573c54,_0x573c54[_0xd425('0xae')],_0x573c54[_0xd425('0x143')]);}else if(this[_0xd425('0x19')][_0x573c54[_0xd425('0xae')]][_0xd425('0x7e')]){logger['info'](_0xd425('0x144'),_0x573c54['linkedid'],_0x573c54['cause'],_0xd425('0xb3'),_0x51e1a6[_0xd425('0x2d')],_0xd425('0x142'),_0x51e1a6['pTalking']);this[_0xd425('0x9d')](_0x573c54,_0x573c54['linkedid'],_0x573c54[_0xd425('0x143')]);}}else if(_0x4c1e30&&_[_0xd425('0x101')](_0x4c1e30['statedesc'])&&_0x51e1a6[_0xd425('0x145')]&&_0x573c54[_0xd425('0xae')]===_0x573c54['uniqueid']&&_['isNil'](_0x573c54['reason'])&&_0x573c54['cause']==='16'&&_0x573c54[_0xd425('0x146')]==='6'&&_[_0xd425('0xf5')](_0x4c1e30['transfer'])){if(_0x4c1e30[_0xd425('0xac')]){rpcDb[_0xd425('0x13d')](_0x4c1e30[_0xd425('0x10a')]);}if(_0x4c1e30['activeContact']){rpcDb[_0xd425('0x8c')](_0x4c1e30[_0xd425('0x10a')]);}_0x573c54['reason']='22';this[_0xd425('0xf4')](_0x4c1e30,_0x51e1a6,_0x573c54);}else if(_0x4c1e30&&_0x4c1e30[_0xd425('0x147')]){if(_0x573c54[_0xd425('0x143')]==='16'&&this[_0xd425('0x19')][_0x573c54[_0xd425('0xae')]]['dialAnswer']){logger['info'](_0xd425('0x148'),_0x573c54[_0xd425('0xae')],_0x573c54[_0xd425('0x143')],_0xd425('0xb3'),_0x51e1a6[_0xd425('0x2d')],_0xd425('0x142'),_0x51e1a6[_0xd425('0x32')]);this[_0xd425('0x9d')](_0x573c54,_0x573c54[_0xd425('0xae')],_0x573c54[_0xd425('0x143')]);}else if(this[_0xd425('0x19')][_0x573c54[_0xd425('0xae')]][_0xd425('0x7e')]){logger[_0xd425('0x71')](_0xd425('0x144'),_0x573c54[_0xd425('0xae')],_0x573c54[_0xd425('0x143')],_0xd425('0xb3'),_0x51e1a6[_0xd425('0x2d')],_0xd425('0x142'),_0x51e1a6['pTalking']);this[_0xd425('0x9d')](_0x573c54,_0x573c54['linkedid'],_0x573c54[_0xd425('0x143')]);}}};Preview[_0xd425('0x11')][_0xd425('0x24')]=function(_0x224d4e){if(this[_0xd425('0x19')][_0x224d4e[_0xd425('0xf3')]]&&_0x224d4e[_0xd425('0xf3')]!==_0x224d4e['destuniqueid']){this['callProgressDetectingCustomer'](_0x224d4e,_0x224d4e[_0xd425('0xf3')],_0x224d4e[_0xd425('0xed')]);}};Preview[_0xd425('0x11')][_0xd425('0x22')]=function(_0x596f65){if(this['actions'][_0x596f65[_0xd425('0xae')]]&&_0x596f65[_0xd425('0xae')]!==_0x596f65[_0xd425('0xb2')]&&!this['actions'][_0x596f65['linkedid']][_0xd425('0x7e')]){if(_0x596f65['cause']==='1'){this['callProgressDetectingCustomer'](_0x596f65,_0x596f65[_0xd425('0xae')],_0x596f65[_0xd425('0x143')]);}}};Preview[_0xd425('0x11')][_0xd425('0x149')]=function(_0x41f84d,_0x241f36,_0xcc6293){if(this[_0xd425('0x19')][_0x41f84d]){if(_['isNil'](this['actions'][_0x41f84d][_0xd425('0x14a')])){this[_0xd425('0x19')][_0x41f84d][_0xd425('0x14a')]={};}this[_0xd425('0x19')][_0x41f84d][_0xd425('0x14a')][_0x241f36]=_0xcc6293;}};Preview['prototype'][_0xd425('0x27')]=function(_0x497a04){try{if(!_[_0xd425('0x101')](_0x497a04)){if(ut[_0xd425('0x14b')](_[_0xd425('0x14c')](_0x497a04[_0xd425('0x14d')])[0x0])){this['addVariable'](_0x497a04[_0xd425('0xb2')],_[_0xd425('0x14c')](_0x497a04['variable'])[0x0],_0x497a04[_0xd425('0x14e')]);}}}catch(_0x14a7e4){logger[_0xd425('0x14f')](_0xd425('0x150'),util['inspect'](_0x14a7e4,{'showHidden':![],'depth':null}));}};Preview[_0xd425('0x11')]['syncAttendedTransfer']=function(_0x4a4858){if(_0x4a4858){if(this[_0xd425('0x19')][_0x4a4858[_0xd425('0x151')]]){this[_0xd425('0x19')][_0x4a4858[_0xd425('0x151')]]['transfer']=!![];}}};Preview[_0xd425('0x11')][_0xd425('0x28')]=function(_0x585bfe){if(_0x585bfe){if(this['actions'][_0x585bfe[_0xd425('0x152')]]){this[_0xd425('0x19')][_0x585bfe['transfererlinkedid']][_0xd425('0x147')]=!![];}}};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 d02821a..7556953 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 _0x681e=['../rpc/cmHopperBlack','../rpc/voiceQueueRt','error','inspect','createHistory','catch','resolve','then','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','context','from-sip','exten','holdtime','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopperFinal','../rpc/cmHopperHistory'];(function(_0x2045ba,_0x1c9940){var _0x2e9615=function(_0x325f93){while(--_0x325f93){_0x2045ba['push'](_0x2045ba['shift']());}};_0x2e9615(++_0x1c9940);}(_0x681e,0xeb));var _0xe681=function(_0x4860c6,_0x401df7){_0x4860c6=_0x4860c6-0x0;var _0x555d6c=_0x681e[_0x4860c6];return _0x555d6c;};'use strict';var util=require(_0xe681('0x0'));var BPromise=require('bluebird');var logger=require(_0xe681('0x1'))(_0xe681('0x2'));var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xe681('0x3'));var cmHopperHistory=require(_0xe681('0x4'));var cmHopperBlack=require(_0xe681('0x5'));var voiceQueueRt=require(_0xe681('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x2c48bc){return function(_0x3daa94){logger[_0xe681('0x7')](_0x2c48bc,util[_0xe681('0x8')](_0x3daa94,{'showHidden':![],'depth':null}));};}function create(_0x5b86e9){return BPromise['resolve']()['then'](cmHopperHistory[_0xe681('0x9')](_0x5b86e9))[_0xe681('0xa')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x775cd){return BPromise[_0xe681('0xb')]()[_0xe681('0xc')](agentReportPreview[_0xe681('0x9')](_0x775cd))[_0xe681('0xa')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5630bf){return BPromise[_0xe681('0xb')]()['then'](cmHopper['moveContactManagedDialer'](_0x5630bf,!![]))[_0xe681('0xa')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xe681('0xd')]=function(_0xaf261c){return BPromise['resolve']()['then'](cmHopperBlack[_0xe681('0xd')](_0xaf261c))[_0xe681('0xa')](loggerCatch(_0xe681('0xe')));};exports['getContactPreview']=function(_0x28da87){return BPromise[_0xe681('0xb')]()[_0xe681('0xc')](cmHopper[_0xe681('0xf')](_0x28da87))[_0xe681('0xa')](loggerCatch(_0xe681('0x10')));};exports[_0xe681('0x9')]=function(_0x34b068,_0x56aedd){create(_0x34b068)[_0xe681('0xa')](loggerCatch(_0x56aedd));moveContact(_0x34b068)[_0xe681('0xa')](loggerCatch(_0x56aedd));};exports[_0xe681('0x11')]=function(_0x5bd09c,_0x30564f){createAgent(_0x5bd09c)[_0xe681('0xa')](loggerCatch(_0x30564f));};exports['createCustomerHistory']=function(_0x31c291,_0x98f848){create(_0x31c291)['catch'](loggerCatch(_0x98f848));};exports[_0xe681('0x12')]=function(_0x1f5ef4,_0x8fc415){moveContact(_0x1f5ef4)[_0xe681('0xa')](loggerCatch(_0x8fc415));};exports[_0xe681('0x13')]=function(_0x44f75f,_0xdfc5ae,_0x8c849c){if(_0xdfc5ae){_0x44f75f[_0xe681('0x14')]=null;}if(_0x8c849c){_0x44f75f[_0xe681('0x15')]=![];}return BPromise[_0xe681('0xb')]()['then'](cmHopper[_0xe681('0x13')](_0x44f75f))[_0xe681('0xa')](loggerCatch(_0xe681('0x16')));};exports[_0xe681('0x17')]=function(_0x7400ce){return BPromise['resolve']()[_0xe681('0xc')](cmHopper[_0xe681('0x17')](_0x7400ce))['catch'](loggerCatch(_0xe681('0x18')));};exports[_0xe681('0x19')]=function(_0x4fc735){return BPromise[_0xe681('0xb')]()[_0xe681('0xc')](cmHopper[_0xe681('0x19')]({'UserId':null},_0x4fc735,0x1))[_0xe681('0xa')](loggerCatch(_0xe681('0x1a')));};exports[_0xe681('0x1b')]=function(_0x2ef2c9){return BPromise['resolve']()[_0xe681('0xc')](cmHopper['unlockContact']({'active':![]},_0x2ef2c9,0x1))[_0xe681('0xa')](loggerCatch(_0xe681('0x1c')));};exports['crateCustomerReportQueue']=function(_0x52187d){var _0x5ec5d3={};_0x5ec5d3[_0xe681('0x1d')]=_0x52187d['type'];_0x5ec5d3[_0xe681('0x1e')]=_0x52187d['uniqueid'];_0x5ec5d3[_0xe681('0x1f')]=_0x52187d['calleridnum'];_0x5ec5d3[_0xe681('0x20')]=_0x52187d['calleridname'];_0x5ec5d3[_0xe681('0x21')]=_0x52187d['queue'];_0x5ec5d3[_0xe681('0x22')]=_0x52187d[_0xe681('0x23')];_0x5ec5d3[_0xe681('0x24')]=_0x52187d['answertime'];_0x5ec5d3['queuecallercomplete']=0x1;_0x5ec5d3['queuecallercompleteAt']=_0x52187d['endtime'];_0x5ec5d3['connectedlinename']=_0x52187d['membername'];_0x5ec5d3[_0xe681('0x25')]=_0xe681('0x26');_0x5ec5d3[_0xe681('0x27')]='xcally-motion-preview';_0x5ec5d3[_0xe681('0x28')]=0x0;_0x5ec5d3['assigned']=0x1;_0x5ec5d3['lastAssignedTo']=_0x52187d['membername'];_0x5ec5d3[_0xe681('0x29')]=_0xe681('0x2a');return BPromise['resolve']()[_0xe681('0xc')](voiceQueueReport['create'](_0x5ec5d3))[_0xe681('0xa')](loggerCatch(_0xe681('0x2b')));};exports[_0xe681('0x2c')]=function(_0x5babc8,_0x501644){return BPromise[_0xe681('0xb')]()[_0xe681('0xc')](cmHopper[_0xe681('0x2c')](_0x5babc8,_0x501644))[_0xe681('0xa')](loggerCatch(_0xe681('0x2d')));};exports[_0xe681('0x2e')]=function(_0x2f8468){return BPromise[_0xe681('0xb')]()[_0xe681('0xc')](cmHopper[_0xe681('0x13')](_0x2f8468,!![],!![]))[_0xe681('0xa')](loggerCatch(_0xe681('0x2f')));}; \ No newline at end of file +var _0x0aea=['type','uniqueid','calleridnum','queue','answertime','queuecallercomplete','endtime','connectedlinename','membername','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','resolve','then','[createHistory]\x20','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue'];(function(_0x1826a1,_0x26d97e){var _0x1efd18=function(_0xecee9){while(--_0xecee9){_0x1826a1['push'](_0x1826a1['shift']());}};_0x1efd18(++_0x26d97e);}(_0x0aea,0x7a));var _0xa0ae=function(_0x336376,_0xe4b28d){_0x336376=_0x336376-0x0;var _0x1d2a8e=_0x0aea[_0x336376];return _0x1d2a8e;};'use strict';var util=require(_0xa0ae('0x0'));var BPromise=require(_0xa0ae('0x1'));var logger=require('../../../config/logger')(_0xa0ae('0x2'));var _=require('lodash');var cmHopper=require(_0xa0ae('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xa0ae('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xa0ae('0x5'));var agentReportPreview=require(_0xa0ae('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x540340){return function(_0x1462a4){logger[_0xa0ae('0x7')](_0x540340,util[_0xa0ae('0x8')](_0x1462a4,{'showHidden':![],'depth':null}));};}function create(_0x49d317){return BPromise[_0xa0ae('0x9')]()[_0xa0ae('0xa')](cmHopperHistory['createHistory'](_0x49d317))['catch'](loggerCatch(_0xa0ae('0xb')));}function createAgent(_0x4a891e){return BPromise[_0xa0ae('0x9')]()[_0xa0ae('0xa')](agentReportPreview[_0xa0ae('0xc')](_0x4a891e))[_0xa0ae('0xd')](loggerCatch(_0xa0ae('0xb')));}function moveContact(_0x1f1f1d){return BPromise[_0xa0ae('0x9')]()[_0xa0ae('0xa')](cmHopper[_0xa0ae('0xe')](_0x1f1f1d,!![]))[_0xa0ae('0xd')](loggerCatch(_0xa0ae('0xf')));}exports[_0xa0ae('0x10')]=function(_0x4ec3ae){return BPromise['resolve']()[_0xa0ae('0xa')](cmHopperBlack['checkIsBlackList'](_0x4ec3ae))['catch'](loggerCatch(_0xa0ae('0x11')));};exports[_0xa0ae('0x12')]=function(_0x9f668e){return BPromise['resolve']()[_0xa0ae('0xa')](cmHopper['getContactPreview'](_0x9f668e))[_0xa0ae('0xd')](loggerCatch(_0xa0ae('0x13')));};exports[_0xa0ae('0xc')]=function(_0x25d42b,_0x9f9df2){create(_0x25d42b)[_0xa0ae('0xd')](loggerCatch(_0x9f9df2));moveContact(_0x25d42b)[_0xa0ae('0xd')](loggerCatch(_0x9f9df2));};exports[_0xa0ae('0x14')]=function(_0x47c87c,_0x5eac5b){createAgent(_0x47c87c)[_0xa0ae('0xd')](loggerCatch(_0x5eac5b));};exports['createCustomerHistory']=function(_0x5e2d3c,_0x379878){create(_0x5e2d3c)['catch'](loggerCatch(_0x379878));};exports['createCustomerFinal']=function(_0x572eb2,_0x496da2){moveContact(_0x572eb2)[_0xa0ae('0xd')](loggerCatch(_0x496da2));};exports[_0xa0ae('0x15')]=function(_0x43777c,_0x298968,_0x282438){if(_0x298968){_0x43777c[_0xa0ae('0x16')]=null;}if(_0x282438){_0x43777c[_0xa0ae('0x17')]=![];}return BPromise[_0xa0ae('0x9')]()[_0xa0ae('0xa')](cmHopper[_0xa0ae('0x15')](_0x43777c))[_0xa0ae('0xd')](loggerCatch(_0xa0ae('0x18')));};exports[_0xa0ae('0x19')]=function(_0x24b339){return BPromise[_0xa0ae('0x9')]()[_0xa0ae('0xa')](cmHopper[_0xa0ae('0x19')](_0x24b339))[_0xa0ae('0xd')](loggerCatch(_0xa0ae('0x1a')));};exports[_0xa0ae('0x1b')]=function(_0x5a40ea){return BPromise[_0xa0ae('0x9')]()[_0xa0ae('0xa')](cmHopper['unlockContact']({'UserId':null},_0x5a40ea,0x1))[_0xa0ae('0xd')](loggerCatch(_0xa0ae('0x1c')));};exports[_0xa0ae('0x1d')]=function(_0x35b380){return BPromise[_0xa0ae('0x9')]()['then'](cmHopper[_0xa0ae('0x1b')]({'active':![]},_0x35b380,0x1))[_0xa0ae('0xd')](loggerCatch('[activeContact]\x20'));};exports[_0xa0ae('0x1e')]=function(_0x235a08){var _0x410c74={};_0x410c74[_0xa0ae('0x1f')]=_0x235a08[_0xa0ae('0x1f')];_0x410c74[_0xa0ae('0x20')]=_0x235a08[_0xa0ae('0x20')];_0x410c74[_0xa0ae('0x21')]=_0x235a08[_0xa0ae('0x21')];_0x410c74['calleridname']=_0x235a08['calleridname'];_0x410c74[_0xa0ae('0x22')]=_0x235a08[_0xa0ae('0x22')];_0x410c74['queuecallerjoinAt']=_0x235a08[_0xa0ae('0x23')];_0x410c74['queuecallerleaveAt']=_0x235a08[_0xa0ae('0x23')];_0x410c74[_0xa0ae('0x24')]=0x1;_0x410c74['queuecallercompleteAt']=_0x235a08[_0xa0ae('0x25')];_0x410c74[_0xa0ae('0x26')]=_0x235a08[_0xa0ae('0x27')];_0x410c74['context']=_0xa0ae('0x28');_0x410c74['exten']=_0xa0ae('0x29');_0x410c74[_0xa0ae('0x2a')]=0x0;_0x410c74[_0xa0ae('0x2b')]=0x1;_0x410c74[_0xa0ae('0x2c')]=_0x235a08[_0xa0ae('0x27')];_0x410c74[_0xa0ae('0x2d')]=_0xa0ae('0x2e');return BPromise['resolve']()[_0xa0ae('0xa')](voiceQueueReport[_0xa0ae('0x2f')](_0x410c74))[_0xa0ae('0xd')](loggerCatch(_0xa0ae('0x30')));};exports[_0xa0ae('0x31')]=function(_0xdd536b,_0x2f5f31){return BPromise[_0xa0ae('0x9')]()[_0xa0ae('0xa')](cmHopper[_0xa0ae('0x31')](_0xdd536b,_0x2f5f31))[_0xa0ae('0xd')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xa0ae('0x32')]=function(_0x24554f){return BPromise['resolve']()[_0xa0ae('0xa')](cmHopper[_0xa0ae('0x15')](_0x24554f,!![],!![]))['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 153ea09..49134ff 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 _0x56d2=['logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','countbusyretry','countnoanswerretry','cloneAction','clone','state','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','calleridname','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitter','getCallerIdRandom','\x5cw{0,','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','logger','info','inspect','loggerError'];(function(_0x52f1a1,_0x32ae7a){var _0xaa728f=function(_0x245af1){while(--_0x245af1){_0x52f1a1['push'](_0x52f1a1['shift']());}};_0xaa728f(++_0x32ae7a);}(_0x56d2,0x118));var _0x256d=function(_0x3d2d83,_0x553803){_0x3d2d83=_0x3d2d83-0x0;var _0x24a775=_0x56d2[_0x3d2d83];return _0x24a775;};'use strict';var util=require(_0x256d('0x0'));var _=require(_0x256d('0x1'));var moment=require(_0x256d('0x2'));var logger=require('../../../../config/logger')(_0x256d('0x3'));var ipAgi=process['env'][_0x256d('0x4')]||_0x256d('0x5');function getSeconds(_0x18866c,_0x3f68c7){var _0x168535=moment(_0x18866c)[_0x256d('0x6')](0x0);var _0x33b74c=moment(_0x3f68c7)[_0x256d('0x6')](0x0);return _0x168535[_0x256d('0x7')](_0x33b74c,'seconds');}exports[_0x256d('0x8')]=function(_0x5c45d3){return function(_0x988dae){logger[_0x256d('0x9')](_0x5c45d3,util['inspect'](_0x988dae,{'showHidden':![],'depth':null}));};};exports[_0x256d('0xa')]=function(_0x402815,_0x420ebd){logger[_0x256d('0xb')](_0x402815,util[_0x256d('0xc')](_0x420ebd,{'showHidden':![],'depth':null}));};exports[_0x256d('0xd')]=function(_0xd59111,_0x422446){logger[_0x256d('0x9')](_0xd59111,util[_0x256d('0xc')](_0x422446,{'showHidden':![],'depth':null}));};exports[_0x256d('0xe')]=function(_0x51c80c){return function(_0x1d5c10){logger[_0x256d('0xb')](_0x51c80c,util[_0x256d('0xc')](_0x1d5c10,{'showHidden':![],'depth':null}));};};exports[_0x256d('0xf')]=function(_0x30a84e,_0x54f7aa,_0x137ca4){return{'message':_0x30a84e,'unlock':_0x54f7aa,'active':_0x137ca4};};exports[_0x256d('0x10')]=function(_0x29d4f5,_0x418c3c,_0x1d8369){if(!_[_0x256d('0x11')](_0x1d8369)&&_0x256d('0x12')===typeof _0x1d8369&&!_[_0x256d('0x13')](_0x1d8369)){if(!_['isUndefined'](_0x418c3c)&&_0x256d('0x12')===typeof _0x418c3c&&!_[_0x256d('0x13')](_0x418c3c)){return util[_0x256d('0x14')](_0x256d('0x15'),_0x418c3c,_0x1d8369);}return util[_0x256d('0x14')](_0x256d('0x15'),_0x1d8369,_0x1d8369);}if(!_['isUndefined'](_0x29d4f5)&&_0x256d('0x12')===typeof _0x29d4f5&&!_[_0x256d('0x13')](_0x29d4f5)){return _0x29d4f5;}return _0x256d('0x16');};exports[_0x256d('0x17')]=function(_0x1c30d2){if(_[_0x256d('0x18')](_0x1c30d2)){return![];}return _0x1c30d2;};exports[_0x256d('0x19')]=function(_0x1a0634,_0x1efdf0,_0x4e9307,_0xa09457,_0x52b4fa,_0x5c23a1){var _0x17ce95={'XMD-QUEUE':_0x1efdf0[_0x256d('0x1a')]?_0x1efdf0['Queue'][_0x256d('0x1b')]:'','XMD-CALLERID':_0xa09457,'XMD-CALLERID-PREVIEW':_0x5c23a1?util[_0x256d('0x14')](_0x256d('0x15'),_0x5c23a1['calleridname'],_0x5c23a1[_0x256d('0x1c')]):_0xa09457,'XMD-DIALID':_0x52b4fa,'XMD-CONTACTID':_0x1efdf0[_0x256d('0x1d')],'XMD-CDRTYPE':_0x256d('0x1e'),'CALLERID(all)':_0xa09457,'XMD-VOICEQUEUEID':_0x1efdf0[_0x256d('0x1f')],'XMD-DIALCHANNEL':_0x4e9307,'XMD-DIALTIMEOUT':_0x1a0634[_0x256d('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0x256d('0x14')](_0x256d('0x21'),_0x1a0634[_0x256d('0x22')]?'g':'',_[_0x256d('0x13')](_0x1a0634[_0x256d('0x23')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x1a0634[_0x256d('0x24')]||'','XMD-AGI':_0x1a0634[_0x256d('0x25')]?util['format'](_0x256d('0x26'),ipAgi,_0x1a0634['dialQueueProject']):_0x256d('0x27'),'XMD-AGIAFTER':_0x1a0634['dialQueueProject2']?util[_0x256d('0x14')](_0x256d('0x26'),ipAgi,_0x1a0634['dialQueueProject2']):_0x256d('0x27'),'XMD-ORIGINATECALLERIDNUM':_0x5c23a1?_0x5c23a1[_0x256d('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0x5c23a1?_0x5c23a1[_0x256d('0x29')]:'','XMD-DESTINATION':_0x256d('0x2a'),'SIPADDHEADER':_0x256d('0x2b')};if(!_['isEmpty'](_0x1a0634[_0x256d('0x23')])){_0x17ce95[util[_0x256d('0x14')]('%s',_0x256d('0x2c'))]=_0x1a0634[_0x256d('0x23')];_0x17ce95[util['format']('%s',_0x256d('0x2d'))]=_0x52b4fa;}if(_0x1efdf0&&_0x1efdf0['Contact']){for(var _0x1bb9e8 in _0x1efdf0['Contact']){if(_0x1efdf0['Contact']['hasOwnProperty'](_0x1bb9e8)){if(!_[_0x256d('0x18')](_0x1efdf0[_0x256d('0x2e')][_0x1bb9e8])&&_0x1bb9e8!=='id'&&_0x1bb9e8!=='tags'&&_0x1bb9e8!==_0x256d('0x2f')&&_0x1bb9e8!==_0x256d('0x30')){_0x17ce95[util[_0x256d('0x14')]('%s%s',_0x256d('0x31'),_[_0x256d('0x32')](_0x1bb9e8))]=_0x1efdf0[_0x256d('0x2e')][_0x1bb9e8];}}}}return _0x17ce95;};exports[_0x256d('0x33')]=function(_0x3c38ea){var _0x56c5f0={};for(var _0x35ef21 in _0x3c38ea){if(_0x3c38ea[_0x256d('0x34')](_0x35ef21)){_0x56c5f0[util[_0x256d('0x14')]('%s',_[_0x256d('0x35')](_0x35ef21))]=_0x3c38ea[_0x35ef21];}}return{'variables':_0x56c5f0};};exports['updateOriginated']=function(_0x560452,_0x2b9e18){if(!_[_0x256d('0x18')](_0x560452)){if(_0x560452[_0x256d('0x34')](_0x256d('0x36'))){if(_0x560452[_0x256d('0x36')]>0x0){_0x560452[_0x256d('0x36')]-=0x1;}else{logger['error'](_0x256d('0x37'),_0x2b9e18);}}}else{logger['error'](_0x256d('0x38'),_0x2b9e18);}};exports[_0x256d('0x39')]=function(_0x5e3319){var _0x3a5113=moment()[_0x256d('0x14')](_0x256d('0x3a'));_0x5e3319['state']=0xd;_0x5e3319[_0x256d('0x3b')]=_0x256d('0x3c');_0x5e3319[_0x256d('0x3d')]=_0x3a5113;_0x5e3319[_0x256d('0x3e')]=_0x3a5113;_0x5e3319[_0x256d('0x3f')]=_0x3a5113;};exports[_0x256d('0x40')]=function(_0xc1d28c,_0x5e54cd,_0x22931d){var _0x3fff49=moment()['format'](_0x256d('0x3a'));_0xc1d28c['state']=_0x5e54cd;_0xc1d28c[_0x256d('0x3b')]=_0x22931d;_0xc1d28c['responsetime']=_0x3fff49;_0xc1d28c[_0x256d('0x41')]=getSeconds(_0xc1d28c[_0x256d('0x3e')],_0xc1d28c['starttime']);};exports[_0x256d('0x42')]=function(_0x3387fc,_0x2676ab,_0x339957){_0x3387fc[_0x256d('0x43')]=_0x2676ab;_0x3387fc[_0x256d('0x44')]=_0x339957;};exports[_0x256d('0x45')]=function(_0x37964e,_0x1aac67,_0x1590c0){var _0x46c63a=moment()['format'](_0x256d('0x3a'));_0x37964e['state']=_0x1aac67;_0x37964e[_0x256d('0x3b')]=_0x1590c0;_0x37964e[_0x256d('0x3e')]=_0x37964e[_0x256d('0x3e')]?_0x37964e[_0x256d('0x3e')]:_0x46c63a;_0x37964e[_0x256d('0x3f')]=_0x37964e['endtime']?_0x37964e[_0x256d('0x3f')]:_0x46c63a;_0x37964e[_0x256d('0x41')]=getSeconds(_0x37964e[_0x256d('0x3e')]||0x0,_0x37964e[_0x256d('0x3d')]||0x0);_0x37964e[_0x256d('0x46')]=_0x37964e['answertime']?getSeconds(_0x37964e[_0x256d('0x3f')],_0x37964e[_0x256d('0x47')]):0x0;};exports[_0x256d('0x48')]=function(_0x1edc38){return _0x1edc38===_0x256d('0x49');};exports[_0x256d('0x4a')]=function(_0x204d56,_0x1e7b51,_0x2d0483,_0x2024d7,_0x47f4ad){var _0x1fabd7=_0x2024d7?_0x256d('0x4b'):_0x204d56['calleridname'];_0x1fabd7=_0x47f4ad?_0x256d('0x4c'):_0x1fabd7;return{'actionid':_0x204d56[_0x256d('0x4d')],'action':_0x256d('0x4e'),'channel':_0x204d56['channelAgent'],'callerid':util['format'](_0x256d('0x15'),_0x1fabd7,_0x204d56[_0x256d('0x1c')]),'Exten':_0x256d('0x2a'),'Context':_0x256d('0x4f'),'Priority':'1','variable':_0x2d0483,'timeout':(_0x1e7b51[_0x256d('0x50')]||0x1e)*0x3e8,'async':!![],'channelid':_0x204d56['uniqueid']};};exports['totalGlobal']=function(_0x9cc9c2){return _0x9cc9c2[_0x256d('0x51')]+_0x9cc9c2['countcongestionretry']+_0x9cc9c2[_0x256d('0x52')]+_0x9cc9c2['countagentrejectretry']+_0x9cc9c2['countnosuchnumberretry'];};exports[_0x256d('0x53')]=function(_0x2c0be0){var _0x2598fa=_[_0x256d('0x54')](_0x2c0be0);_0x2598fa[_0x256d('0x55')]=0xf;_0x2598fa[_0x256d('0x3b')]=_0x256d('0x56');return _0x2598fa;};exports[_0x256d('0x57')]=function(_0x3cb221,_0x432d92,_0x1cae59){var _0xa8c6bf={};_0xa8c6bf[_0x432d92]=_0x3cb221[_0x432d92];_0xa8c6bf[_0x256d('0x58')]=![];_0xa8c6bf[_0x256d('0x59')]=moment()[_0x256d('0x5a')](_0x1cae59,_0x256d('0x5b'))[_0x256d('0x14')](_0x256d('0x3a'));_0xa8c6bf[_0x256d('0x1d')]=_0x3cb221[_0x256d('0x1d')];_0xa8c6bf[_0x256d('0x5c')]=_0x3cb221[_0x256d('0x5c')];_0xa8c6bf[_0x256d('0x1f')]=_0x3cb221['VoiceQueueId']||undefined;return _0xa8c6bf;};exports[_0x256d('0x5d')]=function(_0x5b82df,_0x21aefd){if(!_[_0x256d('0x18')](_0x5b82df)){if(_0x5b82df[_0x256d('0x5e')]>0x0){_0x5b82df[_0x256d('0x5e')]-=0x1;}else{logger[_0x256d('0x9')](_0x21aefd,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x256d('0x9')](_0x21aefd,_0x256d('0x5f'));}};exports['IsNotLoggedIn']=function(_0xe75d4c){if(_0xe75d4c<=0x0){return!![];}return![];};exports['buildObj']=function(_0x7b60b0,_0x53a79e,_0x38eb79){_0x7b60b0['lastevent']=_0x53a79e;_0x7b60b0[_0x256d('0x1b')]=_0x7b60b0[_0x256d('0x60')];_0x7b60b0[_0x256d('0x61')]=_0x7b60b0[_0x256d('0x62')];_0x7b60b0[_0x256d('0x63')]=_0x256d('0x64');if(_0x38eb79){_0x7b60b0[_0x256d('0x65')]=_0x38eb79[_0x256d('0x65')];}return _0x7b60b0;};exports[_0x256d('0x66')]=function(_0x416e50){var _0x4f8837={};_0x4f8837[_0x256d('0x60')]=_0x416e50[_0x256d('0x60')];_0x4f8837[_0x256d('0x61')]=_0x416e50['channelAgent'];_0x4f8837[_0x256d('0x4d')]=_0x416e50[_0x256d('0x4d')];return _0x4f8837;};exports[_0x256d('0x67')]=function(_0x169dba){var _0x1784f0=[];for(var _0x57f78e in _0x169dba){if(_0x169dba['hasOwnProperty'](_0x57f78e)){if(!_[_0x256d('0x18')](_0x169dba[_0x57f78e])&&_0x169dba[_0x57f78e]['state']===_0x256d('0x68')&&_0x169dba[_0x57f78e]['status']===_0x256d('0x69')){_0x1784f0[_0x256d('0x6a')](_0x169dba[_0x57f78e]['id']);}}}return _0x1784f0;};exports[_0x256d('0x6b')]=function(_0xb55d13){var _0x59f396=moment()[_0x256d('0x6')](0x0);var _0x13c72e=moment(_0xb55d13)[_0x256d('0x6')](0x0);return _0x59f396[_0x256d('0x7')](_0x13c72e,'seconds');};exports[_0x256d('0x6c')]=function(_0x5c0fab){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5c0fab[_0x256d('0x1d')],'ListId':_0x5c0fab[_0x256d('0x5c')],'VoiceQueueId':_0x5c0fab['VoiceQueueId']||undefined,'CampaignId':_0x5c0fab[_0x256d('0x6d')]||undefined};};exports[_0x256d('0x6e')]=function(_0x41161a){if(_0x41161a==='uniqueid'||_0x41161a===_0x256d('0x6f')||_0x41161a===_0x256d('0x60')||_0x41161a===_0x256d('0x70')||_0x41161a===_0x256d('0x71')||_0x41161a===_0x256d('0x72')||_0x41161a===_0x256d('0x43')||_0x41161a===_0x256d('0x62')||_0x41161a===_0x256d('0x73')||_0x41161a===_0x256d('0x58')||_0x41161a===_0x256d('0x1c')||_0x41161a===_0x256d('0x59')||_0x41161a===_0x256d('0x51')||_0x41161a===_0x256d('0x74')||_0x41161a===_0x256d('0x52')||_0x41161a===_0x256d('0x75')||_0x41161a===_0x256d('0x76')||_0x41161a===_0x256d('0x77')||_0x41161a===_0x256d('0x78')||_0x41161a==='recallme'||_0x41161a===_0x256d('0x1d')||_0x41161a===_0x256d('0x5c')||_0x41161a===_0x256d('0x44')||_0x41161a===_0x256d('0x1f')||_0x41161a===_0x256d('0x79')||_0x41161a===_0x256d('0x7a')||_0x41161a==='xmd-queue'||_0x41161a===_0x256d('0x7b')||_0x41161a===_0x256d('0x7c')||_0x41161a==='xmd-dialurl'||_0x41161a===_0x256d('0x7d')||_0x41161a===_0x256d('0x7e')||_0x41161a==='xmd-dialid'||_0x41161a===_0x256d('0x7f')||_0x41161a===_0x256d('0x80')||_0x41161a===_0x256d('0x81')||_0x41161a===_0x256d('0x82')||_0x41161a===_0x256d('0x83')||_0x41161a===_0x256d('0x84')||_0x41161a===_0x256d('0x85')||_0x41161a==='rtpaudioqosbridged'||_0x41161a==='rtpaudioqosjitter'||_0x41161a===_0x256d('0x86')||_0x41161a===_0x256d('0x87')||_0x41161a===_0x256d('0x88')||_0x41161a==='rtpaudioqosrtt'||_0x41161a===_0x256d('0x89')||_0x41161a===_0x256d('0x85')||_0x41161a===_0x256d('0x8a')||_0x41161a===_0x256d('0x8b')||_0x41161a===_0x256d('0x86')||_0x41161a===_0x256d('0x87')||_0x41161a===_0x256d('0x88')||_0x41161a==='rtpaudioqosrtt'||_0x41161a===_0x256d('0x89')||_0x41161a==='bridgepeer'||_0x41161a==='bridgepvtcallid'||_0x41161a===_0x256d('0x55')||_0x41161a==='statedesc'){return![];}return!![];};exports[_0x256d('0x8c')]=function(_0x480071,_0x532e97){var _0x1aaf01,_0x1c88f0,_0x4fc418;if(_0x532e97<=0x0){_0x532e97=0x1;}_0x1aaf01=new RegExp(_0x256d('0x8d')+_0x532e97+'}$');_0x1c88f0=Math['pow'](0xa,_0x532e97-0x1);_0x4fc418=Math['pow'](0xa,_0x532e97)-0x1;return util[_0x256d('0x14')]('%s',_[_0x256d('0x8e')](_0x480071,_0x1aaf01,_[_0x256d('0x8f')](_0x1c88f0,_0x4fc418)));};exports[_0x256d('0x90')]=function(_0x2c7fcf){var _0x3dee08=_0x2c7fcf[_0x256d('0x91')](/"(.*?)"/);return _0x3dee08?_0x3dee08[0x1]:_0x2c7fcf;};exports[_0x256d('0x92')]=function(_0x59442d){var _0x20569d=_0x59442d['match'](/<(.*?)>/);return _0x20569d?_0x20569d[0x1]:_0x59442d;}; \ No newline at end of file +var _0x21c5=['lodash','moment','env','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','ContactId','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','isNil','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','ringtime','logLookAgent','membername','UserId','endtime','answertime','isFailure','Failure','BOOKED','uniqueid','originate','channelAgent','calleridnum','timeout','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','diff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','calleridname','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','replace','match','util'];(function(_0x5f08a6,_0x400121){var _0x5d0641=function(_0x304467){while(--_0x304467){_0x5f08a6['push'](_0x5f08a6['shift']());}};_0x5d0641(++_0x400121);}(_0x21c5,0x88));var _0x521c=function(_0x27e2e2,_0x40ef46){_0x27e2e2=_0x27e2e2-0x0;var _0x8bdd65=_0x21c5[_0x27e2e2];return _0x8bdd65;};'use strict';var util=require(_0x521c('0x0'));var _=require(_0x521c('0x1'));var moment=require(_0x521c('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0x521c('0x3')]['XCALLY_IP_AGI']||_0x521c('0x4');function getSeconds(_0x479b43,_0x227a1c){var _0x159a5c=moment(_0x479b43)[_0x521c('0x5')](0x0);var _0x4685d1=moment(_0x227a1c)['milliseconds'](0x0);return _0x159a5c['diff'](_0x4685d1,_0x521c('0x6'));}exports[_0x521c('0x7')]=function(_0x161387){return function(_0x10b23c){logger[_0x521c('0x8')](_0x161387,util[_0x521c('0x9')](_0x10b23c,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0xc56391,_0x35963f){logger[_0x521c('0xa')](_0xc56391,util['inspect'](_0x35963f,{'showHidden':![],'depth':null}));};exports[_0x521c('0xb')]=function(_0x2f5aab,_0x307597){logger[_0x521c('0x8')](_0x2f5aab,util[_0x521c('0x9')](_0x307597,{'showHidden':![],'depth':null}));};exports[_0x521c('0xc')]=function(_0x40273e){return function(_0x5a9fc5){logger[_0x521c('0xa')](_0x40273e,util[_0x521c('0x9')](_0x5a9fc5,{'showHidden':![],'depth':null}));};};exports[_0x521c('0xd')]=function(_0x217227,_0xedc2ca,_0x39d113){return{'message':_0x217227,'unlock':_0xedc2ca,'active':_0x39d113};};exports[_0x521c('0xe')]=function(_0x1d6b31,_0x25ba1f,_0x2d31b4){if(!_['isUndefined'](_0x2d31b4)&&_0x521c('0xf')===typeof _0x2d31b4&&!_[_0x521c('0x10')](_0x2d31b4)){if(!_[_0x521c('0x11')](_0x25ba1f)&&_0x521c('0xf')===typeof _0x25ba1f&&!_[_0x521c('0x10')](_0x25ba1f)){return util[_0x521c('0x12')]('\x22%s\x22\x20<%s>',_0x25ba1f,_0x2d31b4);}return util[_0x521c('0x12')](_0x521c('0x13'),_0x2d31b4,_0x2d31b4);}if(!_[_0x521c('0x11')](_0x1d6b31)&&_0x521c('0xf')===typeof _0x1d6b31&&!_['isEmpty'](_0x1d6b31)){return _0x1d6b31;}return _0x521c('0x14');};exports[_0x521c('0x15')]=function(_0x533303){if(_['isNil'](_0x533303)){return![];}return _0x533303;};exports[_0x521c('0x16')]=function(_0x56a14d,_0x5b52b3,_0x2bbd9f,_0x2ad5d6,_0x2c960e,_0xb4cc3){var _0x5c7262={'XMD-QUEUE':_0x5b52b3[_0x521c('0x17')]?_0x5b52b3[_0x521c('0x17')][_0x521c('0x18')]:'','XMD-CALLERID':_0x2ad5d6,'XMD-CALLERID-PREVIEW':_0xb4cc3?util[_0x521c('0x12')](_0x521c('0x13'),_0xb4cc3['calleridname'],_0xb4cc3['calleridnum']):_0x2ad5d6,'XMD-DIALID':_0x2c960e,'XMD-CONTACTID':_0x5b52b3[_0x521c('0x19')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2ad5d6,'XMD-VOICEQUEUEID':_0x5b52b3[_0x521c('0x1a')],'XMD-DIALCHANNEL':_0x2bbd9f,'XMD-DIALTIMEOUT':_0x56a14d['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x521c('0x12')](_0x521c('0x1b'),_0x56a14d[_0x521c('0x1c')]?'g':'',_[_0x521c('0x10')](_0x56a14d[_0x521c('0x1d')])?'':_0x521c('0x1e')),'XMD-DIALURL':_0x56a14d[_0x521c('0x1f')]||'','XMD-AGI':_0x56a14d[_0x521c('0x20')]?util[_0x521c('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x56a14d['dialQueueProject']):_0x521c('0x21'),'XMD-AGIAFTER':_0x56a14d['dialQueueProject2']?util['format'](_0x521c('0x22'),ipAgi,_0x56a14d['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0xb4cc3?_0xb4cc3[_0x521c('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0xb4cc3?_0xb4cc3[_0x521c('0x24')]:'','XMD-DESTINATION':_0x521c('0x25'),'SIPADDHEADER':_0x521c('0x26')};if(!_[_0x521c('0x10')](_0x56a14d[_0x521c('0x1d')])){_0x5c7262[util[_0x521c('0x12')]('%s',_0x521c('0x27'))]=_0x56a14d['monitor_format'];_0x5c7262[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x2c960e;}if(_0x5b52b3&&_0x5b52b3[_0x521c('0x28')]){for(var _0x4d1b77 in _0x5b52b3[_0x521c('0x28')]){if(_0x5b52b3[_0x521c('0x28')]['hasOwnProperty'](_0x4d1b77)){if(!_[_0x521c('0x29')](_0x5b52b3[_0x521c('0x28')][_0x4d1b77])&&_0x4d1b77!=='id'&&_0x4d1b77!=='tags'&&_0x4d1b77!=='createdAt'&&_0x4d1b77!==_0x521c('0x2a')){_0x5c7262[util[_0x521c('0x12')](_0x521c('0x2b'),_0x521c('0x2c'),_[_0x521c('0x2d')](_0x4d1b77))]=_0x5b52b3[_0x521c('0x28')][_0x4d1b77];}}}}return _0x5c7262;};exports[_0x521c('0x2e')]=function(_0x400fd8){var _0x435b93={};for(var _0x4367fa in _0x400fd8){if(_0x400fd8['hasOwnProperty'](_0x4367fa)){_0x435b93[util[_0x521c('0x12')]('%s',_['toLower'](_0x4367fa))]=_0x400fd8[_0x4367fa];}}return{'variables':_0x435b93};};exports['updateOriginated']=function(_0x5b819d,_0x28f520){if(!_[_0x521c('0x29')](_0x5b819d)){if(_0x5b819d[_0x521c('0x2f')](_0x521c('0x30'))){if(_0x5b819d[_0x521c('0x30')]>0x0){_0x5b819d['originated']-=0x1;}else{logger['error'](_0x521c('0x31'),_0x28f520);}}}else{logger[_0x521c('0x8')](_0x521c('0x32'),_0x28f520);}};exports['logBlacklist']=function(_0x4fd5a9){var _0x398e26=moment()[_0x521c('0x12')](_0x521c('0x33'));_0x4fd5a9[_0x521c('0x34')]=0xd;_0x4fd5a9[_0x521c('0x35')]=_0x521c('0x36');_0x4fd5a9[_0x521c('0x37')]=_0x398e26;_0x4fd5a9[_0x521c('0x38')]=_0x398e26;_0x4fd5a9['endtime']=_0x398e26;};exports[_0x521c('0x39')]=function(_0x56fa4f,_0x2a0729,_0x2bd976){var _0x2b1f9e=moment()[_0x521c('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x56fa4f[_0x521c('0x34')]=_0x2a0729;_0x56fa4f[_0x521c('0x35')]=_0x2bd976;_0x56fa4f[_0x521c('0x38')]=_0x2b1f9e;_0x56fa4f[_0x521c('0x3a')]=getSeconds(_0x56fa4f['responsetime'],_0x56fa4f['starttime']);};exports[_0x521c('0x3b')]=function(_0x2472c3,_0x379937,_0x28bbee){_0x2472c3[_0x521c('0x3c')]=_0x379937;_0x2472c3[_0x521c('0x3d')]=_0x28bbee;};exports['logCustomer']=function(_0x5bf485,_0x3be15d,_0x119c04){var _0x39914a=moment()['format'](_0x521c('0x33'));_0x5bf485[_0x521c('0x34')]=_0x3be15d;_0x5bf485['statedesc']=_0x119c04;_0x5bf485['responsetime']=_0x5bf485[_0x521c('0x38')]?_0x5bf485[_0x521c('0x38')]:_0x39914a;_0x5bf485[_0x521c('0x3e')]=_0x5bf485[_0x521c('0x3e')]?_0x5bf485[_0x521c('0x3e')]:_0x39914a;_0x5bf485[_0x521c('0x3a')]=getSeconds(_0x5bf485[_0x521c('0x38')]||0x0,_0x5bf485['starttime']||0x0);_0x5bf485['talktime']=_0x5bf485[_0x521c('0x3f')]?getSeconds(_0x5bf485['endtime'],_0x5bf485[_0x521c('0x3f')]):0x0;};exports[_0x521c('0x40')]=function(_0x493b4a){return _0x493b4a===_0x521c('0x41');};exports['variablesAction']=function(_0x2a0e0d,_0x341327,_0x53c71b,_0x2ad772,_0x4b8cb7){var _0x1e4db1=_0x2ad772?'RECALL':_0x2a0e0d['calleridname'];_0x1e4db1=_0x4b8cb7?_0x521c('0x42'):_0x1e4db1;return{'actionid':_0x2a0e0d[_0x521c('0x43')],'action':_0x521c('0x44'),'channel':_0x2a0e0d[_0x521c('0x45')],'callerid':util[_0x521c('0x12')]('\x22%s\x22\x20<%s>',_0x1e4db1,_0x2a0e0d[_0x521c('0x46')]),'Exten':_0x521c('0x25'),'Context':'from-sip','Priority':'1','variable':_0x53c71b,'timeout':(_0x341327[_0x521c('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2a0e0d[_0x521c('0x43')]};};exports['totalGlobal']=function(_0x24a060){return _0x24a060[_0x521c('0x48')]+_0x24a060['countcongestionretry']+_0x24a060[_0x521c('0x49')]+_0x24a060[_0x521c('0x4a')]+_0x24a060[_0x521c('0x4b')];};exports[_0x521c('0x4c')]=function(_0x1fd05d){var _0x52f14b=_['clone'](_0x1fd05d);_0x52f14b[_0x521c('0x34')]=0xf;_0x52f14b[_0x521c('0x35')]='Global';return _0x52f14b;};exports[_0x521c('0x4d')]=function(_0x25150f,_0xcbef02,_0x1f525e){var _0x3aaf5d={};_0x3aaf5d[_0xcbef02]=_0x25150f[_0xcbef02];_0x3aaf5d[_0x521c('0x4e')]=![];_0x3aaf5d[_0x521c('0x4f')]=moment()[_0x521c('0x50')](_0x1f525e,_0x521c('0x51'))[_0x521c('0x12')](_0x521c('0x33'));_0x3aaf5d['ContactId']=_0x25150f[_0x521c('0x19')];_0x3aaf5d[_0x521c('0x52')]=_0x25150f[_0x521c('0x52')];_0x3aaf5d[_0x521c('0x1a')]=_0x25150f[_0x521c('0x1a')]||undefined;return _0x3aaf5d;};exports[_0x521c('0x53')]=function(_0x472da4,_0x3930ae){if(!_['isNil'](_0x472da4)){if(_0x472da4[_0x521c('0x54')]>0x0){_0x472da4[_0x521c('0x54')]-=0x1;}else{logger[_0x521c('0x8')](_0x3930ae,_0x521c('0x55'));}}else{logger[_0x521c('0x8')](_0x3930ae,_0x521c('0x56'));}};exports[_0x521c('0x57')]=function(_0x3c06f9){if(_0x3c06f9<=0x0){return!![];}return![];};exports[_0x521c('0x58')]=function(_0x3521da,_0x4177c1,_0x2bdcca){_0x3521da[_0x521c('0x59')]=_0x4177c1;_0x3521da[_0x521c('0x18')]=_0x3521da[_0x521c('0x5a')];_0x3521da[_0x521c('0x5b')]=_0x3521da[_0x521c('0x45')];_0x3521da['motionChannel']=_0x521c('0x5c');if(_0x2bdcca){_0x3521da[_0x521c('0x5d')]=_0x2bdcca[_0x521c('0x5d')];}return _0x3521da;};exports[_0x521c('0x5e')]=function(_0x41c76f){var _0x52dbf6={};_0x52dbf6['queue']=_0x41c76f[_0x521c('0x5a')];_0x52dbf6[_0x521c('0x5b')]=_0x41c76f[_0x521c('0x45')];_0x52dbf6[_0x521c('0x43')]=_0x41c76f[_0x521c('0x43')];return _0x52dbf6;};exports[_0x521c('0x5f')]=function(_0x45d63a){var _0x31cf5e=[];for(var _0x37dac4 in _0x45d63a){if(_0x45d63a['hasOwnProperty'](_0x37dac4)){if(!_[_0x521c('0x29')](_0x45d63a[_0x37dac4])&&_0x45d63a[_0x37dac4][_0x521c('0x34')]===_0x521c('0x60')&&_0x45d63a[_0x37dac4][_0x521c('0x61')]===_0x521c('0x62')){_0x31cf5e[_0x521c('0x63')](_0x45d63a[_0x37dac4]['id']);}}}return _0x31cf5e;};exports['getDiff']=function(_0xc32139){var _0x3aafbd=moment()['milliseconds'](0x0);var _0x19930e=moment(_0xc32139)[_0x521c('0x5')](0x0);return _0x3aafbd[_0x521c('0x64')](_0x19930e,'seconds');};exports[_0x521c('0x65')]=function(_0x22354f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x22354f['ContactId'],'ListId':_0x22354f[_0x521c('0x52')],'VoiceQueueId':_0x22354f[_0x521c('0x1a')]||undefined,'CampaignId':_0x22354f[_0x521c('0x66')]||undefined};};exports[_0x521c('0x67')]=function(_0x2a289c){if(_0x2a289c===_0x521c('0x43')||_0x2a289c===_0x521c('0x68')||_0x2a289c===_0x521c('0x5a')||_0x2a289c===_0x521c('0x69')||_0x2a289c===_0x521c('0x6a')||_0x2a289c===_0x521c('0x6b')||_0x2a289c==='membername'||_0x2a289c===_0x521c('0x45')||_0x2a289c===_0x521c('0x6c')||_0x2a289c===_0x521c('0x4e')||_0x2a289c===_0x521c('0x46')||_0x2a289c===_0x521c('0x4f')||_0x2a289c===_0x521c('0x48')||_0x2a289c==='countcongestionretry'||_0x2a289c===_0x521c('0x49')||_0x2a289c===_0x521c('0x6d')||_0x2a289c===_0x521c('0x6e')||_0x2a289c===_0x521c('0x6f')||_0x2a289c===_0x521c('0x70')||_0x2a289c===_0x521c('0x71')||_0x2a289c==='ContactId'||_0x2a289c===_0x521c('0x52')||_0x2a289c==='UserId'||_0x2a289c===_0x521c('0x1a')||_0x2a289c===_0x521c('0x72')||_0x2a289c===_0x521c('0x73')||_0x2a289c===_0x521c('0x74')||_0x2a289c===_0x521c('0x75')||_0x2a289c===_0x521c('0x76')||_0x2a289c==='xmd-dialurl'||_0x2a289c===_0x521c('0x77')||_0x2a289c==='xmd-dialoptions'||_0x2a289c===_0x521c('0x78')||_0x2a289c==='xmd-dialchannel'||_0x2a289c===_0x521c('0x79')||_0x2a289c===_0x521c('0x7a')||_0x2a289c==='xmd-callerid'||_0x2a289c==='xmd-agiafter'||_0x2a289c===_0x521c('0x7b')||_0x2a289c===_0x521c('0x7c')||_0x2a289c===_0x521c('0x7d')||_0x2a289c===_0x521c('0x7e')||_0x2a289c===_0x521c('0x7f')||_0x2a289c==='rtpaudioqosloss'||_0x2a289c===_0x521c('0x80')||_0x2a289c===_0x521c('0x81')||_0x2a289c==='rtpaudioqosrttbridged'||_0x2a289c===_0x521c('0x7c')||_0x2a289c===_0x521c('0x7d')||_0x2a289c===_0x521c('0x7e')||_0x2a289c==='rtpaudioqosjitterbridged'||_0x2a289c===_0x521c('0x82')||_0x2a289c===_0x521c('0x80')||_0x2a289c===_0x521c('0x81')||_0x2a289c==='rtpaudioqosrttbridged'||_0x2a289c===_0x521c('0x83')||_0x2a289c===_0x521c('0x84')||_0x2a289c===_0x521c('0x34')||_0x2a289c===_0x521c('0x35')){return![];}return!![];};exports[_0x521c('0x85')]=function(_0x31cfcc,_0x4ada1c){var _0x319516,_0x199520,_0x4db229;if(_0x4ada1c<=0x0){_0x4ada1c=0x1;}_0x319516=new RegExp(_0x521c('0x86')+_0x4ada1c+'}$');_0x199520=Math['pow'](0xa,_0x4ada1c-0x1);_0x4db229=Math['pow'](0xa,_0x4ada1c)-0x1;return util[_0x521c('0x12')]('%s',_[_0x521c('0x87')](_0x31cfcc,_0x319516,_['random'](_0x199520,_0x4db229)));};exports['extractCalleridName']=function(_0x3b6bc4){var _0x2b1cf7=_0x3b6bc4[_0x521c('0x88')](/"(.*?)"/);return _0x2b1cf7?_0x2b1cf7[0x1]:_0x3b6bc4;};exports['extractCalleridNumber']=function(_0x488c0a){var _0xd4f8a=_0x488c0a[_0x521c('0x88')](/<(.*?)>/);return _0xd4f8a?_0xd4f8a[0x1]:_0x488c0a;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index df157b7..4ccf737 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 _0x1db6=['voicequeuechannelredirect','string','number','boolean','queueremove','queuepause','voicechannel','voicequeuechannelhangup'];(function(_0x54deb9,_0x53e74b){var _0x5da9aa=function(_0x45dca8){while(--_0x45dca8){_0x54deb9['push'](_0x54deb9['shift']());}};_0x5da9aa(++_0x53e74b);}(_0x1db6,0x1f1));var _0x61db=function(_0x2f0982,_0x11c25f){_0x2f0982=_0x2f0982-0x0;var _0x5b7f06=_0x1db6[_0x2f0982];return _0x5b7f06;};'use strict';exports['queueadd']={'queue':{'type':_0x61db('0x0'),'required':!![]},'interface':{'type':_0x61db('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x61db('0x1'),'required':![]},'paused':{'type':_0x61db('0x2'),'required':![]}};exports[_0x61db('0x3')]={'queue':{'type':_0x61db('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x61db('0x4')]={'interface':{'type':_0x61db('0x0'),'required':!![]},'paused':{'type':_0x61db('0x2')},'reason':{'type':_0x61db('0x0'),'required':![]}};exports['reload']={'module':{'type':_0x61db('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x61db('0x0'),'required':!![]}};exports[_0x61db('0x5')]={'uniqueid':{'type':_0x61db('0x0'),'required':!![]},'filename':{'type':_0x61db('0x0')},'format':{'type':'string'},'mixmonitorid':{'type':_0x61db('0x0')}};exports[_0x61db('0x6')]={'uniqueid':{'type':_0x61db('0x0'),'required':!![]}};exports[_0x61db('0x7')]={'uniqueid':{'type':_0x61db('0x0'),'required':!![]},'exten':{'type':_0x61db('0x0'),'required':!![]},'context':{'type':_0x61db('0x0')}}; \ No newline at end of file +var _0xc48d=['string','number','boolean','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x12c0fd,_0x331c2a){var _0x1fd5a8=function(_0x16a7f2){while(--_0x16a7f2){_0x12c0fd['push'](_0x12c0fd['shift']());}};_0x1fd5a8(++_0x331c2a);}(_0xc48d,0x179));var _0xdc48=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xc48d[_0xf0bcac];return _0x4e4c65;};'use strict';exports[_0xdc48('0x0')]={'queue':{'type':_0xdc48('0x1'),'required':!![]},'interface':{'type':_0xdc48('0x1'),'required':!![]},'membername':{'type':_0xdc48('0x1'),'required':!![]},'penalty':{'type':_0xdc48('0x2'),'required':![]},'paused':{'type':_0xdc48('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0xdc48('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xdc48('0x4')]={'interface':{'type':_0xdc48('0x1'),'required':!![]},'paused':{'type':_0xdc48('0x3')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0xdc48('0x1'),'required':![]}};exports[_0xdc48('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xdc48('0x6')]={'uniqueid':{'type':_0xdc48('0x1'),'required':!![]},'filename':{'type':_0xdc48('0x1')},'format':{'type':_0xdc48('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xdc48('0x7')]={'uniqueid':{'type':_0xdc48('0x1'),'required':!![]}};exports[_0xdc48('0x8')]={'uniqueid':{'type':_0xdc48('0x1'),'required':!![]},'exten':{'type':_0xdc48('0x1'),'required':!![]},'context':{'type':_0xdc48('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index d7d4dd0..105549b 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 _0x2f09=['abandoned','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initTelephones','trunks','length','isUndefined','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','bluebird','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/faxAccount','agents','telephones','voiceQueues','triggers','campaigns','templates','outbound','queueChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','unmanaged'];(function(_0x3b0701,_0x4f86b9){var _0x16d32d=function(_0x18530f){while(--_0x18530f){_0x3b0701['push'](_0x3b0701['shift']());}};_0x16d32d(++_0x4f86b9);}(_0x2f09,0x1c7));var _0x92f0=function(_0xf62575,_0x4b8959){_0xf62575=_0xf62575-0x0;var _0x517c28=_0x2f09[_0xf62575];return _0x517c28;};'use strict';var BPromise=require(_0x92f0('0x0'));var util=require(_0x92f0('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x92f0('0x2'));var Telephone=require(_0x92f0('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x92f0('0x4'));var Trigger=require(_0x92f0('0x5'));var Template=require(_0x92f0('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x92f0('0x7'));var ZendeskAccount=require(_0x92f0('0x8'));var SalesforceAccount=require(_0x92f0('0x9'));var FreshdeskAccount=require(_0x92f0('0xa'));var SugarcrmAccount=require(_0x92f0('0xb'));var ZohoAccount=require(_0x92f0('0xc'));var DeskAccount=require(_0x92f0('0xd'));var VtigerAccount=require(_0x92f0('0xe'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x92f0('0xf'));var Realtime=function(){this[_0x92f0('0x10')]={};this[_0x92f0('0x11')]={};this['trunks']={};this[_0x92f0('0x12')]={};this[_0x92f0('0x13')]={};this[_0x92f0('0x14')]={};this[_0x92f0('0x15')]={};this[_0x92f0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0x92f0('0x17')]={};this['outboundChannels']={};this[_0x92f0('0x18')]={};this[_0x92f0('0x19')]={};this[_0x92f0('0x1a')]={};this[_0x92f0('0x1b')]={};this[_0x92f0('0x1c')]={};this['freshdeskAccounts']={};this[_0x92f0('0x1d')]={};this[_0x92f0('0x1e')]={};this[_0x92f0('0x1f')]={};this[_0x92f0('0x20')]={};this[_0x92f0('0x21')]={};this[_0x92f0('0x22')]={};this[_0x92f0('0x23')]={};};function freeIsNotKey(_0x289410,_0x4edd54,_0x354112){var _0x50ed2d=_[_0x92f0('0x24')](_0x289410,function(_0x8a8f6e,_0x2196db){return _0x8a8f6e[_0x354112];});for(var _0xfbf0f8 in _0x4edd54){if(_0x4edd54[_0x92f0('0x25')](_0xfbf0f8)){if(!_0x50ed2d[_0xfbf0f8]){delete _0x4edd54[_0xfbf0f8];}}}}function freeIsNotKeySip(_0x4fe698,_0x212da6){var _0x1df31f=_['mapKeys'](_0x4fe698,function(_0xb2bb,_0x312b53){return util[_0x92f0('0x26')]('SIP/%s',_0xb2bb[_0x92f0('0x27')]);});for(var _0x1a46b8 in _0x212da6){if(_0x212da6[_0x92f0('0x25')](_0x1a46b8)){if(!_0x1df31f[_0x1a46b8]){delete _0x212da6[_0x1a46b8];}}}}function freeIsNotKeyAgent(_0x2c683e,_0x537e83){var _0x5caf6d=_[_0x92f0('0x24')](_0x2c683e,function(_0x35e989,_0x54e7eb){var _0x511776=_[_0x92f0('0x28')](_0x35e989[_0x92f0('0x29')])?util[_0x92f0('0x26')](_0x92f0('0x2a'),_0x35e989[_0x92f0('0x27')]):_0x35e989[_0x92f0('0x29')];return _0x511776;});for(var _0x30272d in _0x537e83){if(_0x537e83[_0x92f0('0x25')](_0x30272d)){if(!_0x5caf6d[_0x30272d]){delete _0x537e83[_0x30272d];}}}}function clearVoiceCallReports(_0x2d5a59){_0x2d5a59[_0x92f0('0x2b')]=0x0;_0x2d5a59[_0x92f0('0x2c')]=0x0;_0x2d5a59[_0x92f0('0x2d')]=0x0;_0x2d5a59[_0x92f0('0x2e')]=0x0;_0x2d5a59[_0x92f0('0x2f')]=0x0;}function clearCampaigns(_0x53154b){if(!_[_0x92f0('0x30')](_0x53154b)){for(var _0x138553 in _0x53154b){if(_0x53154b[_0x92f0('0x25')](_0x138553)){_0x53154b[_0x138553]['ivrTotalCallsDays']=0x0;_0x53154b[_0x138553]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x4a4a0){if(!_[_0x92f0('0x30')](_0x4a4a0)){for(var _0x3e368c in _0x4a4a0){if(_0x4a4a0[_0x92f0('0x25')](_0x3e368c)){_0x4a4a0[_0x3e368c][_0x92f0('0x2b')]=0x0;_0x4a4a0[_0x3e368c]['answered']=0x0;_0x4a4a0[_0x3e368c][_0x92f0('0x31')]=0x0;_0x4a4a0[_0x3e368c][_0x92f0('0x32')]=0x0;_0x4a4a0[_0x3e368c][_0x92f0('0x2d')]=0x0;_0x4a4a0[_0x3e368c]['sumDuration']=0x0;_0x4a4a0[_0x3e368c][_0x92f0('0x2f')]=0x0;_0x4a4a0[_0x3e368c]['outboundAnswerAgiCallsDay']=0x0;_0x4a4a0[_0x3e368c]['outboundNoAnswerCallsDay']=0x0;_0x4a4a0[_0x3e368c]['outboundBusyCallsDay']=0x0;_0x4a4a0[_0x3e368c][_0x92f0('0x33')]=0x0;_0x4a4a0[_0x3e368c]['outboundNoSuchCallsDay']=0x0;_0x4a4a0[_0x3e368c]['outboundUnknownCallsDay']=0x0;_0x4a4a0[_0x3e368c][_0x92f0('0x34')]=0x0;_0x4a4a0[_0x3e368c][_0x92f0('0x35')]=0x0;_0x4a4a0[_0x3e368c][_0x92f0('0x36')]=0x0;_0x4a4a0[_0x3e368c]['outboundOriginateFailureCallsDay']=0x0;_0x4a4a0[_0x3e368c]['outboundRejectCallsDay']=0x0;_0x4a4a0[_0x3e368c]['outboundReCallsDay']=0x0;_0x4a4a0[_0x3e368c][_0x92f0('0x37')]=0x0;_0x4a4a0[_0x3e368c][_0x92f0('0x38')]=0x0;_0x4a4a0[_0x3e368c][_0x92f0('0x39')]=!![];}}}}Realtime['prototype'][_0x92f0('0x3a')]=function(_0x48c0c0,_0x1e9f35){for(var _0x8503ef in _0x1e9f35){if(_0x48c0c0[_0x92f0('0x25')](_0x8503ef)){_0x48c0c0[_0x8503ef]=_0x1e9f35[_0x8503ef];}}};Realtime['prototype']['initAgents']=function(){var _0x19f40d=this;return function(_0xc4bfe1){if(_0xc4bfe1){freeIsNotKeyAgent(_0xc4bfe1,_0x19f40d['agents']);for(var _0x5b832e=0x0,_0x2602a3={},_0x3ab97c={};_0x5b832e<_0xc4bfe1['length'];_0x5b832e+=0x1){_0x2602a3=_0xc4bfe1[_0x5b832e];var _0x1b89d1=_[_0x92f0('0x28')](_0x2602a3['interface'])?util[_0x92f0('0x26')](_0x92f0('0x2a'),_0x2602a3[_0x92f0('0x27')]):_0x2602a3['interface'];if(_['isUndefined'](_0x19f40d[_0x92f0('0x10')][_0x1b89d1])){_0x19f40d['agents'][_0x1b89d1]=new Agent(_0x2602a3);}else{_0x19f40d['mergeFromDatabase'](_0x19f40d[_0x92f0('0x10')][_0x1b89d1],_0x2602a3);}}}return _0x19f40d['agents'];};};Realtime[_0x92f0('0x3b')][_0x92f0('0x3c')]=function(){var _0x2a51a9=this;return function(_0x3cd14b){if(_0x3cd14b){freeIsNotKeySip(_0x3cd14b,_0x2a51a9[_0x92f0('0x11')]);for(var _0x2a3a5f=0x0,_0x296154={},_0x2e0ecc={};_0x2a3a5f<_0x3cd14b['length'];_0x2a3a5f+=0x1){_0x296154=_0x3cd14b[_0x2a3a5f];if(_['isUndefined'](_0x2a51a9[_0x92f0('0x11')][util[_0x92f0('0x26')]('SIP/%s',_0x296154[_0x92f0('0x27')])])){_0x2a51a9[_0x92f0('0x11')][util[_0x92f0('0x26')](_0x92f0('0x2a'),_0x296154[_0x92f0('0x27')])]=new Telephone(_0x296154);}else{_0x2a51a9['mergeFromDatabase'](_0x2a51a9[_0x92f0('0x11')][util['format'](_0x92f0('0x2a'),_0x296154[_0x92f0('0x27')])],_0x296154);}}}return _0x2a51a9['telephones'];};};Realtime[_0x92f0('0x3b')]['initTrunks']=function(){var _0x27b736=this;return function(_0x554692){if(_0x554692){freeIsNotKeySip(_0x554692,_0x27b736[_0x92f0('0x3d')]);for(var _0x1fd91b=0x0,_0x47da9c={},_0x44f9c9={};_0x1fd91b<_0x554692[_0x92f0('0x3e')];_0x1fd91b+=0x1){_0x47da9c=_0x554692[_0x1fd91b];if(_[_0x92f0('0x3f')](_0x27b736[_0x92f0('0x3d')][util[_0x92f0('0x26')]('SIP/%s',_0x47da9c['name'])])){_0x27b736['trunks'][util[_0x92f0('0x26')](_0x92f0('0x2a'),_0x47da9c[_0x92f0('0x27')])]=new Trunk(_0x47da9c);}else{_0x27b736['mergeFromDatabase'](_0x27b736[_0x92f0('0x3d')][util[_0x92f0('0x26')](_0x92f0('0x2a'),_0x47da9c[_0x92f0('0x27')])],_0x47da9c);}}}return _0x27b736[_0x92f0('0x3d')];};};Realtime[_0x92f0('0x3b')][_0x92f0('0x40')]=function(){var _0x21a1b4=this;return function(_0x14e893){if(_0x14e893){freeIsNotKey(_0x14e893,_0x21a1b4[_0x92f0('0x12')],_0x92f0('0x27'));for(var _0x4ab380=0x0,_0x15713a={},_0x1002d6={};_0x4ab380<_0x14e893[_0x92f0('0x3e')];_0x4ab380+=0x1){_0x15713a=_0x14e893[_0x4ab380];if(_[_0x92f0('0x3f')](_0x21a1b4['voiceQueues'][_0x15713a[_0x92f0('0x27')]])){_0x21a1b4[_0x92f0('0x12')][_0x15713a[_0x92f0('0x27')]]=new VoiceQueue(_0x15713a);}else{_0x21a1b4['mergeFromDatabase'](_0x21a1b4['voiceQueues'][_0x15713a[_0x92f0('0x27')]],_0x15713a);}}}return _0x21a1b4[_0x92f0('0x12')];};};Realtime['prototype'][_0x92f0('0x41')]=function(){var _0x45bcae=this;return function(_0x2a99e7){if(_0x2a99e7){freeIsNotKey(_0x2a99e7,_0x45bcae[_0x92f0('0x13')],'id');for(var _0x391159=0x0,_0xfb8f06={},_0x90b8eb={};_0x391159<_0x2a99e7[_0x92f0('0x3e')];_0x391159+=0x1){_0xfb8f06=_0x2a99e7[_0x391159];if(_['isUndefined'](_0x45bcae[_0x92f0('0x13')][_0xfb8f06['id']])){_0x45bcae['triggers'][_0xfb8f06['id']]=new Trigger(_0xfb8f06);}else{_0x45bcae[_0x92f0('0x3a')](_0x45bcae[_0x92f0('0x13')][_0xfb8f06['id']],_0xfb8f06);}}}return _0x45bcae['triggers'];};};Realtime['prototype'][_0x92f0('0x42')]=function(){var _0x22710f=this;return function(_0x436953){if(_0x436953){freeIsNotKey(_0x436953,_0x22710f[_0x92f0('0x15')],'id');for(var _0x1457ea=0x0,_0x11ce58={},_0x4ecd2c={};_0x1457ea<_0x436953[_0x92f0('0x3e')];_0x1457ea+=0x1){_0x11ce58=_0x436953[_0x1457ea];if(_[_0x92f0('0x3f')](_0x22710f[_0x92f0('0x15')][_0x11ce58['id']])){_0x22710f[_0x92f0('0x15')][_0x11ce58['id']]=new Template(_0x11ce58);}else{_0x22710f[_0x92f0('0x3a')](_0x22710f[_0x92f0('0x15')][_0x11ce58['id']],_0x11ce58);}}}return _0x22710f[_0x92f0('0x15')];};};Realtime[_0x92f0('0x3b')][_0x92f0('0x43')]=function(){var _0x255158=this;return function(_0x318fc9){if(_0x318fc9){freeIsNotKey(_0x318fc9,_0x255158[_0x92f0('0x1a')],'id');for(var _0x346c37=0x0,_0x362596={},_0xf6c3ed={};_0x346c37<_0x318fc9[_0x92f0('0x3e')];_0x346c37+=0x1){_0x362596=_0x318fc9[_0x346c37];if(_[_0x92f0('0x3f')](_0x255158[_0x92f0('0x1a')][_0x362596['id']])){_0x255158['zendeskAccounts'][_0x362596['id']]=new ZendeskAccount(_0x362596);}else{_0x255158['mergeFromDatabase'](_0x255158['zendeskAccounts'][_0x362596['id']],_0x362596);}}}return _0x255158['zendeskAccounts'];};};Realtime[_0x92f0('0x3b')]['initSalesforceAccounts']=function(){var _0x4863df=this;return function(_0x22513c){if(_0x22513c){freeIsNotKey(_0x22513c,_0x4863df[_0x92f0('0x1b')],'id');for(var _0x11841b=0x0,_0x597e2d={},_0x5eb67b={};_0x11841b<_0x22513c[_0x92f0('0x3e')];_0x11841b+=0x1){_0x597e2d=_0x22513c[_0x11841b];if(_[_0x92f0('0x3f')](_0x4863df[_0x92f0('0x1b')][_0x597e2d['id']])){_0x4863df[_0x92f0('0x1b')][_0x597e2d['id']]=new SalesforceAccount(_0x597e2d);}else{_0x4863df[_0x92f0('0x3a')](_0x4863df[_0x92f0('0x1b')][_0x597e2d['id']],_0x597e2d);}}}return _0x4863df[_0x92f0('0x1b')];};};Realtime[_0x92f0('0x3b')]['initFreshdeskAccounts']=function(){var _0x4e6a6b=this;return function(_0x5f015e){if(_0x5f015e){freeIsNotKey(_0x5f015e,_0x4e6a6b[_0x92f0('0x44')],'id');for(var _0x15c94d=0x0,_0x2d51af={},_0x472aad={};_0x15c94d<_0x5f015e['length'];_0x15c94d+=0x1){_0x2d51af=_0x5f015e[_0x15c94d];if(_['isUndefined'](_0x4e6a6b['freshdeskAccounts'][_0x2d51af['id']])){_0x4e6a6b[_0x92f0('0x44')][_0x2d51af['id']]=new FreshdeskAccount(_0x2d51af);}else{_0x4e6a6b[_0x92f0('0x3a')](_0x4e6a6b[_0x92f0('0x44')][_0x2d51af['id']],_0x2d51af);}}}return _0x4e6a6b['freshdeskAccounts'];};};Realtime[_0x92f0('0x3b')][_0x92f0('0x45')]=function(){var _0x384793=this;return function(_0x28810c){if(_0x28810c){freeIsNotKey(_0x28810c,_0x384793['zohoAccounts'],'id');for(var _0x1ad8d4=0x0,_0xb7deac={},_0x5b8df3={};_0x1ad8d4<_0x28810c['length'];_0x1ad8d4+=0x1){_0xb7deac=_0x28810c[_0x1ad8d4];if(_[_0x92f0('0x3f')](_0x384793[_0x92f0('0x1d')][_0xb7deac['id']])){_0x384793[_0x92f0('0x1d')][_0xb7deac['id']]=new ZohoAccount(_0xb7deac);}else{_0x384793['mergeFromDatabase'](_0x384793[_0x92f0('0x1d')][_0xb7deac['id']],_0xb7deac);}}}return _0x384793[_0x92f0('0x1d')];};};Realtime[_0x92f0('0x3b')][_0x92f0('0x46')]=function(){var _0x2b37d5=this;return function(_0x222e7b){if(_0x222e7b){freeIsNotKey(_0x222e7b,_0x2b37d5[_0x92f0('0x1e')],'id');for(var _0x3dd9dc=0x0,_0x2ae8c2={},_0x4fc93f={};_0x3dd9dc<_0x222e7b[_0x92f0('0x3e')];_0x3dd9dc+=0x1){_0x2ae8c2=_0x222e7b[_0x3dd9dc];if(_[_0x92f0('0x3f')](_0x2b37d5[_0x92f0('0x1e')][_0x2ae8c2['id']])){_0x2b37d5[_0x92f0('0x1e')][_0x2ae8c2['id']]=new DeskAccount(_0x2ae8c2);}else{_0x2b37d5[_0x92f0('0x3a')](_0x2b37d5[_0x92f0('0x1e')][_0x2ae8c2['id']],_0x2ae8c2);}}}return _0x2b37d5[_0x92f0('0x1e')];};};Realtime[_0x92f0('0x3b')][_0x92f0('0x47')]=function(){var _0x9354b7=this;return function(_0x2fbbea){if(_0x2fbbea){freeIsNotKey(_0x2fbbea,_0x9354b7[_0x92f0('0x1c')],'id');for(var _0x1394ef=0x0,_0x316aff={},_0x4bf9e1={};_0x1394ef<_0x2fbbea['length'];_0x1394ef+=0x1){_0x316aff=_0x2fbbea[_0x1394ef];if(_[_0x92f0('0x3f')](_0x9354b7[_0x92f0('0x1c')][_0x316aff['id']])){_0x9354b7['sugarcrmAccounts'][_0x316aff['id']]=new SugarcrmAccount(_0x316aff);}else{_0x9354b7[_0x92f0('0x3a')](_0x9354b7[_0x92f0('0x1c')][_0x316aff['id']],_0x316aff);}}}return _0x9354b7[_0x92f0('0x1c')];};};Realtime['prototype'][_0x92f0('0x48')]=function(){var _0x12c234=this;return function(_0x1e8069){if(_0x1e8069){freeIsNotKey(_0x1e8069,_0x12c234[_0x92f0('0x1f')],'id');for(var _0x24a3f1=0x0,_0x460a9e={},_0x314652={};_0x24a3f1<_0x1e8069['length'];_0x24a3f1+=0x1){_0x460a9e=_0x1e8069[_0x24a3f1];if(_[_0x92f0('0x3f')](_0x12c234[_0x92f0('0x1f')][_0x460a9e['id']])){_0x12c234['vtigerAccounts'][_0x460a9e['id']]=new VtigerAccount(_0x460a9e);}else{_0x12c234[_0x92f0('0x3a')](_0x12c234[_0x92f0('0x1f')][_0x460a9e['id']],_0x460a9e);}}}return _0x12c234[_0x92f0('0x1f')];};};Realtime[_0x92f0('0x3b')][_0x92f0('0x49')]=function(){var _0x511ba2=this;return function(_0x4f86c0){if(_0x4f86c0){freeIsNotKey(_0x4f86c0,_0x511ba2[_0x92f0('0x20')],'id');for(var _0x428c8e=0x0,_0x340859={},_0x3bb5b3={};_0x428c8e<_0x4f86c0[_0x92f0('0x3e')];_0x428c8e+=0x1){_0x340859=_0x4f86c0[_0x428c8e];if(_[_0x92f0('0x3f')](_0x511ba2[_0x92f0('0x20')][_0x340859['id']])){_0x511ba2['servicenowAccounts'][_0x340859['id']]=new ServicenowAccount(_0x340859);}else{_0x511ba2[_0x92f0('0x3a')](_0x511ba2[_0x92f0('0x20')][_0x340859['id']],_0x340859);}}}return _0x511ba2[_0x92f0('0x20')];};};Realtime[_0x92f0('0x3b')][_0x92f0('0x4a')]=function(){var _0x56fde9=this;return function(_0x48163b){if(_0x48163b){freeIsNotKey(_0x48163b,_0x56fde9[_0x92f0('0x21')],'id');for(var _0x9c14a0=0x0,_0x4ffcbe={},_0x1d38d4={};_0x9c14a0<_0x48163b[_0x92f0('0x3e')];_0x9c14a0+=0x1){_0x4ffcbe=_0x48163b[_0x9c14a0];if(_[_0x92f0('0x3f')](_0x56fde9[_0x92f0('0x21')][_0x4ffcbe['id']])){_0x56fde9[_0x92f0('0x21')][_0x4ffcbe['id']]=new Dynamics365Account(_0x4ffcbe);}else{_0x56fde9['mergeFromDatabase'](_0x56fde9[_0x92f0('0x21')][_0x4ffcbe['id']],_0x4ffcbe);}}}return _0x56fde9[_0x92f0('0x21')];};};Realtime[_0x92f0('0x3b')][_0x92f0('0x4b')]=function(){var _0x4d758b=this;return function(_0x409460){if(_0x409460){freeIsNotKey(_0x409460,_0x4d758b[_0x92f0('0x22')],'id');for(var _0x250f78=0x0,_0x41ac83={},_0x3f5d50={};_0x250f78<_0x409460[_0x92f0('0x3e')];_0x250f78+=0x1){_0x41ac83=_0x409460[_0x250f78];if(_[_0x92f0('0x3f')](_0x4d758b[_0x92f0('0x22')][_0x41ac83['id']])){_0x4d758b[_0x92f0('0x22')][_0x41ac83['id']]=new FreshsalesAccount(_0x41ac83);}else{_0x4d758b[_0x92f0('0x3a')](_0x4d758b['freshsalesAccounts'][_0x41ac83['id']],_0x41ac83);}}}return _0x4d758b['freshsalesAccounts'];};};Realtime[_0x92f0('0x3b')][_0x92f0('0x4c')]=function(){var _0x5b532a=this;return function(_0x245876){for(var _0x1ba149=0x0;_0x1ba149<_0x245876[_0x92f0('0x3e')];_0x1ba149+=0x1){_[_0x92f0('0x4d')](_0x5b532a[_0x92f0('0x12')][_0x245876[_0x1ba149][_0x92f0('0x27')]],_0x245876[_0x1ba149]);}return _0x5b532a[_0x92f0('0x12')];};};Realtime['prototype'][_0x92f0('0x4e')]=function(){var _0x528a7a=this;return function(_0x3f98aa){clearVoiceQueues(_0x528a7a['voiceQueues']);if(_0x3f98aa){_0x3f98aa=_[_0x92f0('0x4f')](_0x3f98aa,_0x92f0('0x50'));for(var _0x27d4bc in _0x3f98aa){if(_0x3f98aa[_0x92f0('0x25')](_0x27d4bc)){var _0x348997={};for(var _0x15fc5a=0x0;_0x15fc5a<_0x3f98aa[_0x27d4bc][_0x92f0('0x3e')];_0x15fc5a+=0x1){var _0x261cf8=_0x3f98aa[_0x27d4bc][_0x15fc5a]['queue'];if(_0x528a7a[_0x92f0('0x12')][_0x261cf8]){if(_0x3f98aa[_0x27d4bc][_0x15fc5a][_0x92f0('0x51')]){_0x528a7a[_0x92f0('0x12')][_0x261cf8][_0x92f0('0x31')]+=0x1;}if(_0x3f98aa[_0x27d4bc][_0x15fc5a][_0x92f0('0x52')]){_0x528a7a[_0x92f0('0x12')][_0x261cf8][_0x92f0('0x32')]+=0x1;}_0x528a7a['voiceQueues'][_0x261cf8]['sumHoldTime']+=moment(_0x3f98aa[_0x27d4bc][_0x15fc5a][_0x92f0('0x53')])[_0x92f0('0x54')](moment(_0x3f98aa[_0x27d4bc][_0x15fc5a]['queuecallerjoinAt']),_0x92f0('0x55'))||0x0;if(_0x15fc5a===_0x3f98aa[_0x27d4bc][_0x92f0('0x3e')]-0x1){_0x528a7a['voiceQueues'][_0x261cf8]['sumDuration']+=moment(_0x3f98aa[_0x27d4bc][_0x15fc5a][_0x92f0('0x56')]||_0x3f98aa[_0x27d4bc][_0x15fc5a][_0x92f0('0x57')]||_0x3f98aa[_0x27d4bc][_0x15fc5a]['queuecallerexitAt'])['diff'](moment(_0x3f98aa[_0x27d4bc][_0x15fc5a][_0x92f0('0x58')]),_0x92f0('0x55'))||0x0;_0x528a7a[_0x92f0('0x12')][_0x261cf8]['total']+=0x1;if(_0x3f98aa[_0x27d4bc][_0x15fc5a][_0x92f0('0x59')]){_0x528a7a[_0x92f0('0x12')][_0x261cf8][_0x92f0('0x2c')]+=0x1;_0x528a7a[_0x92f0('0x12')][_0x261cf8][_0x92f0('0x2f')]+=moment(_0x3f98aa[_0x27d4bc][_0x15fc5a][_0x92f0('0x56')])[_0x92f0('0x54')](moment(_0x3f98aa[_0x27d4bc][_0x15fc5a]['queuecallerleaveAt']),_0x92f0('0x55'))||0x0;}}else{_0x528a7a[_0x92f0('0x12')][_0x261cf8][_0x92f0('0x2e')]+=_0x528a7a[_0x92f0('0x12')][_0x261cf8]['sumHoldTime']||0x0;}}}}}}return _0x528a7a[_0x92f0('0x12')];};};Realtime[_0x92f0('0x3b')][_0x92f0('0x5a')]=function(){var _0x298cec=this;return function(_0x2bf1db){clearVoiceCallReports(_0x298cec['outbound']);if(_0x2bf1db){for(var _0x425d79=0x0;_0x425d79<_0x2bf1db[_0x92f0('0x3e')];_0x425d79+=0x1){_0x298cec['outbound']['total']+=0x1;_0x298cec[_0x92f0('0x16')][_0x92f0('0x2e')]+=_0x2bf1db[_0x425d79][_0x92f0('0x5b')];if(_0x2bf1db[_0x425d79][_0x92f0('0x5c')]===_0x92f0('0x5d')){_0x298cec[_0x92f0('0x16')]['answered']+=0x1;_0x298cec[_0x92f0('0x16')]['sumHoldTime']+=_0x2bf1db[_0x425d79][_0x92f0('0x5b')]-_0x2bf1db[_0x425d79][_0x92f0('0x5e')]||0x0;_0x298cec[_0x92f0('0x16')]['sumBillable']+=_0x2bf1db[_0x425d79][_0x92f0('0x5e')];}}}return _0x298cec['outbound'];};};Realtime[_0x92f0('0x3b')]['initCampaigns']=function(){var _0x5297fe=this;return function(_0x458b1d){if(_0x458b1d){freeIsNotKey(_0x458b1d,_0x5297fe['campaigns'],_0x92f0('0x27'));for(var _0x523b4a=0x0,_0x540957={};_0x523b4a<_0x458b1d[_0x92f0('0x3e')];_0x523b4a+=0x1){_0x540957=_0x458b1d[_0x523b4a];if(_['isUndefined'](_0x5297fe[_0x92f0('0x14')][_0x540957[_0x92f0('0x27')]])){_0x5297fe[_0x92f0('0x14')][_0x540957[_0x92f0('0x27')]]=new Campaign(_0x540957);}else{_0x5297fe[_0x92f0('0x3a')](_0x5297fe[_0x92f0('0x14')][_0x540957[_0x92f0('0x27')]],_0x540957);_0x5297fe[_0x92f0('0x14')][_0x540957[_0x92f0('0x27')]][_0x92f0('0x5f')]=_0x540957[_0x92f0('0x60')]?_0x540957['SquareProject'][_0x92f0('0x27')]:undefined;}}}return _0x5297fe[_0x92f0('0x14')];};};Realtime['prototype'][_0x92f0('0x61')]=function(){var _0xdeecac=this;return function(_0x31bf08){if(_0x31bf08){freeIsNotKey(_0x31bf08,_0xdeecac['voiceExtensions'],'id');for(var _0x79e010=0x0,_0x44478d={};_0x79e010<_0x31bf08[_0x92f0('0x3e')];_0x79e010+=0x1){_0x44478d=_0x31bf08[_0x79e010];if(_[_0x92f0('0x3f')](_0xdeecac['voiceExtensions'][_0x44478d['id']])){_0xdeecac[_0x92f0('0x62')][_0x44478d['id']]=new VoiceExtension(_0x44478d);}else{_0xdeecac[_0x92f0('0x3a')](_0xdeecac[_0x92f0('0x62')][_0x44478d['id']],_0x44478d);}}}return _0xdeecac[_0x92f0('0x62')];};};Realtime['prototype'][_0x92f0('0x63')]=function(){var _0x398aa8=this;return function(_0x39f997){clearCampaigns(_0x398aa8[_0x92f0('0x14')]);for(var _0x53d804=0x0;_0x53d804<_0x39f997['length'];_0x53d804+=0x1){_[_0x92f0('0x4d')](_0x398aa8[_0x92f0('0x14')][_0x39f997[_0x53d804][_0x92f0('0x27')]],_0x39f997[_0x53d804]);}return _0x398aa8['campaigns'];};};Realtime[_0x92f0('0x3b')][_0x92f0('0x64')]=function(){var _0x462ef9=this;return function(_0x3d3261){if(_0x3d3261){freeIsNotKey(_0x3d3261,_0x462ef9[_0x92f0('0x23')],'id');for(var _0xb0664c=0x0,_0xc20c1b={},_0x472822={};_0xb0664c<_0x3d3261[_0x92f0('0x3e')];_0xb0664c+=0x1){_0xc20c1b=_0x3d3261[_0xb0664c];if(_[_0x92f0('0x3f')](_0x462ef9[_0x92f0('0x23')][_0xc20c1b['id']])){_0x462ef9[_0x92f0('0x23')][_0xc20c1b['id']]=new FaxAccount(_0xc20c1b);}else{_0x462ef9[_0x92f0('0x3a')](_0x462ef9[_0x92f0('0x23')][_0xc20c1b['id']],_0xc20c1b);}}}return _0x462ef9[_0x92f0('0x23')];};};module['exports']=Realtime; \ No newline at end of file +var _0x644c=['seconds','queuecallercompleteAt','initVoiceCallReports','disposition','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','agents','telephones','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','faxAccounts','hasOwnProperty','mapKeys','SIP/%s','isNil','interface','format','name','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','prototype','mergeFromDatabase','length','isUndefined','trunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallerabandonAt','queuecallerexitAt'];(function(_0x5ad889,_0x1f99dd){var _0x13e79c=function(_0x3e8fc9){while(--_0x3e8fc9){_0x5ad889['push'](_0x5ad889['shift']());}};_0x13e79c(++_0x1f99dd);}(_0x644c,0xda));var _0xc644=function(_0x4e61c2,_0x4fb50e){_0x4e61c2=_0x4e61c2-0x0;var _0x3dd22e=_0x644c[_0x4e61c2];return _0x3dd22e;};'use strict';var BPromise=require('bluebird');var util=require(_0xc644('0x0'));var _=require('lodash');var moment=require('moment');var Agent=require(_0xc644('0x1'));var Telephone=require(_0xc644('0x2'));var Trunk=require(_0xc644('0x3'));var VoiceQueue=require(_0xc644('0x4'));var Trigger=require(_0xc644('0x5'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xc644('0x6'));var ZendeskAccount=require(_0xc644('0x7'));var SalesforceAccount=require(_0xc644('0x8'));var FreshdeskAccount=require(_0xc644('0x9'));var SugarcrmAccount=require(_0xc644('0xa'));var ZohoAccount=require(_0xc644('0xb'));var DeskAccount=require(_0xc644('0xc'));var VtigerAccount=require(_0xc644('0xd'));var ServicenowAccount=require(_0xc644('0xe'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xc644('0xf'));var Realtime=function(){this[_0xc644('0x10')]={};this[_0xc644('0x11')]={};this['trunks']={};this['voiceQueues']={};this[_0xc644('0x12')]={};this['campaigns']={};this[_0xc644('0x13')]={};this[_0xc644('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc644('0x15')]={};this['channels']={};this[_0xc644('0x16')]={};this[_0xc644('0x17')]={};this[_0xc644('0x18')]={};this['settings']={};this[_0xc644('0x19')]={};this[_0xc644('0x1a')]={};this[_0xc644('0x1b')]={};this[_0xc644('0x1c')]={};this[_0xc644('0x1d')]={};this[_0xc644('0x1e')]={};this['vtigerAccounts']={};this[_0xc644('0x1f')]={};this['dynamics365Accounts']={};this['freshsalesAccounts']={};this[_0xc644('0x20')]={};};function freeIsNotKey(_0x3294f4,_0x1d169e,_0x572d29){var _0x19a56b=_['mapKeys'](_0x3294f4,function(_0x4c3348,_0x91dea1){return _0x4c3348[_0x572d29];});for(var _0x1cd6d5 in _0x1d169e){if(_0x1d169e[_0xc644('0x21')](_0x1cd6d5)){if(!_0x19a56b[_0x1cd6d5]){delete _0x1d169e[_0x1cd6d5];}}}}function freeIsNotKeySip(_0x57d33e,_0x19005b){var _0x32b558=_[_0xc644('0x22')](_0x57d33e,function(_0x2dc31f,_0x187eae){return util['format'](_0xc644('0x23'),_0x2dc31f['name']);});for(var _0x3a477e in _0x19005b){if(_0x19005b['hasOwnProperty'](_0x3a477e)){if(!_0x32b558[_0x3a477e]){delete _0x19005b[_0x3a477e];}}}}function freeIsNotKeyAgent(_0x41424f,_0x1ac4cb){var _0x3466d8=_[_0xc644('0x22')](_0x41424f,function(_0x284eaa,_0x27a3e9){var _0x4c4715=_[_0xc644('0x24')](_0x284eaa[_0xc644('0x25')])?util[_0xc644('0x26')](_0xc644('0x23'),_0x284eaa[_0xc644('0x27')]):_0x284eaa[_0xc644('0x25')];return _0x4c4715;});for(var _0x319877 in _0x1ac4cb){if(_0x1ac4cb[_0xc644('0x21')](_0x319877)){if(!_0x3466d8[_0x319877]){delete _0x1ac4cb[_0x319877];}}}}function clearVoiceCallReports(_0x506429){_0x506429[_0xc644('0x28')]=0x0;_0x506429[_0xc644('0x29')]=0x0;_0x506429[_0xc644('0x2a')]=0x0;_0x506429[_0xc644('0x2b')]=0x0;_0x506429[_0xc644('0x2c')]=0x0;}function clearCampaigns(_0x4e4b30){if(!_[_0xc644('0x2d')](_0x4e4b30)){for(var _0x431817 in _0x4e4b30){if(_0x4e4b30['hasOwnProperty'](_0x431817)){_0x4e4b30[_0x431817]['ivrTotalCallsDays']=0x0;_0x4e4b30[_0x431817][_0xc644('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x2a66d0){if(!_[_0xc644('0x2d')](_0x2a66d0)){for(var _0x1a51ab in _0x2a66d0){if(_0x2a66d0['hasOwnProperty'](_0x1a51ab)){_0x2a66d0[_0x1a51ab][_0xc644('0x28')]=0x0;_0x2a66d0[_0x1a51ab][_0xc644('0x29')]=0x0;_0x2a66d0[_0x1a51ab][_0xc644('0x2f')]=0x0;_0x2a66d0[_0x1a51ab][_0xc644('0x30')]=0x0;_0x2a66d0[_0x1a51ab]['sumHoldTime']=0x0;_0x2a66d0[_0x1a51ab][_0xc644('0x2b')]=0x0;_0x2a66d0[_0x1a51ab][_0xc644('0x2c')]=0x0;_0x2a66d0[_0x1a51ab][_0xc644('0x31')]=0x0;_0x2a66d0[_0x1a51ab][_0xc644('0x32')]=0x0;_0x2a66d0[_0x1a51ab][_0xc644('0x33')]=0x0;_0x2a66d0[_0x1a51ab]['outboundCongestionCallsDay']=0x0;_0x2a66d0[_0x1a51ab][_0xc644('0x34')]=0x0;_0x2a66d0[_0x1a51ab][_0xc644('0x35')]=0x0;_0x2a66d0[_0x1a51ab][_0xc644('0x36')]=0x0;_0x2a66d0[_0x1a51ab]['outboundDropCallsDayCallersExit']=0x0;_0x2a66d0[_0x1a51ab][_0xc644('0x37')]=0x0;_0x2a66d0[_0x1a51ab][_0xc644('0x38')]=0x0;_0x2a66d0[_0x1a51ab][_0xc644('0x39')]=0x0;_0x2a66d0[_0x1a51ab][_0xc644('0x3a')]=0x0;_0x2a66d0[_0x1a51ab][_0xc644('0x31')]=0x0;_0x2a66d0[_0x1a51ab]['outboundAnswerCallsDay']=0x0;_0x2a66d0[_0x1a51ab]['queueStatusComplete']=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x4ac61b,_0x451618){for(var _0x285d50 in _0x451618){if(_0x4ac61b[_0xc644('0x21')](_0x285d50)){_0x4ac61b[_0x285d50]=_0x451618[_0x285d50];}}};Realtime[_0xc644('0x3b')]['initAgents']=function(){var _0x2558fe=this;return function(_0x4acdbb){if(_0x4acdbb){freeIsNotKeyAgent(_0x4acdbb,_0x2558fe[_0xc644('0x10')]);for(var _0x171eb1=0x0,_0x1d76e5={},_0x30d120={};_0x171eb1<_0x4acdbb['length'];_0x171eb1+=0x1){_0x1d76e5=_0x4acdbb[_0x171eb1];var _0x35780e=_[_0xc644('0x24')](_0x1d76e5[_0xc644('0x25')])?util['format'](_0xc644('0x23'),_0x1d76e5[_0xc644('0x27')]):_0x1d76e5['interface'];if(_['isUndefined'](_0x2558fe[_0xc644('0x10')][_0x35780e])){_0x2558fe[_0xc644('0x10')][_0x35780e]=new Agent(_0x1d76e5);}else{_0x2558fe[_0xc644('0x3c')](_0x2558fe[_0xc644('0x10')][_0x35780e],_0x1d76e5);}}}return _0x2558fe[_0xc644('0x10')];};};Realtime['prototype']['initTelephones']=function(){var _0x2a8b6a=this;return function(_0x34db32){if(_0x34db32){freeIsNotKeySip(_0x34db32,_0x2a8b6a[_0xc644('0x11')]);for(var _0x5c67e2=0x0,_0x41a14f={},_0x41d010={};_0x5c67e2<_0x34db32[_0xc644('0x3d')];_0x5c67e2+=0x1){_0x41a14f=_0x34db32[_0x5c67e2];if(_[_0xc644('0x3e')](_0x2a8b6a[_0xc644('0x11')][util[_0xc644('0x26')]('SIP/%s',_0x41a14f['name'])])){_0x2a8b6a[_0xc644('0x11')][util[_0xc644('0x26')](_0xc644('0x23'),_0x41a14f['name'])]=new Telephone(_0x41a14f);}else{_0x2a8b6a[_0xc644('0x3c')](_0x2a8b6a[_0xc644('0x11')][util[_0xc644('0x26')](_0xc644('0x23'),_0x41a14f[_0xc644('0x27')])],_0x41a14f);}}}return _0x2a8b6a[_0xc644('0x11')];};};Realtime[_0xc644('0x3b')]['initTrunks']=function(){var _0x23b07b=this;return function(_0x374863){if(_0x374863){freeIsNotKeySip(_0x374863,_0x23b07b[_0xc644('0x3f')]);for(var _0x3b1816=0x0,_0x5e92d6={},_0x1a9466={};_0x3b1816<_0x374863[_0xc644('0x3d')];_0x3b1816+=0x1){_0x5e92d6=_0x374863[_0x3b1816];if(_[_0xc644('0x3e')](_0x23b07b[_0xc644('0x3f')][util[_0xc644('0x26')](_0xc644('0x23'),_0x5e92d6[_0xc644('0x27')])])){_0x23b07b[_0xc644('0x3f')][util[_0xc644('0x26')](_0xc644('0x23'),_0x5e92d6[_0xc644('0x27')])]=new Trunk(_0x5e92d6);}else{_0x23b07b[_0xc644('0x3c')](_0x23b07b[_0xc644('0x3f')][util[_0xc644('0x26')](_0xc644('0x23'),_0x5e92d6[_0xc644('0x27')])],_0x5e92d6);}}}return _0x23b07b['trunks'];};};Realtime[_0xc644('0x3b')][_0xc644('0x40')]=function(){var _0x18286c=this;return function(_0x123e93){if(_0x123e93){freeIsNotKey(_0x123e93,_0x18286c['voiceQueues'],_0xc644('0x27'));for(var _0x434f83=0x0,_0x1361c0={},_0x3342b6={};_0x434f83<_0x123e93['length'];_0x434f83+=0x1){_0x1361c0=_0x123e93[_0x434f83];if(_[_0xc644('0x3e')](_0x18286c['voiceQueues'][_0x1361c0['name']])){_0x18286c['voiceQueues'][_0x1361c0[_0xc644('0x27')]]=new VoiceQueue(_0x1361c0);}else{_0x18286c['mergeFromDatabase'](_0x18286c[_0xc644('0x41')][_0x1361c0[_0xc644('0x27')]],_0x1361c0);}}}return _0x18286c[_0xc644('0x41')];};};Realtime[_0xc644('0x3b')][_0xc644('0x42')]=function(){var _0x18bda7=this;return function(_0x212e95){if(_0x212e95){freeIsNotKey(_0x212e95,_0x18bda7[_0xc644('0x12')],'id');for(var _0x4bdad5=0x0,_0x41e3d1={},_0x2d0939={};_0x4bdad5<_0x212e95['length'];_0x4bdad5+=0x1){_0x41e3d1=_0x212e95[_0x4bdad5];if(_[_0xc644('0x3e')](_0x18bda7[_0xc644('0x12')][_0x41e3d1['id']])){_0x18bda7[_0xc644('0x12')][_0x41e3d1['id']]=new Trigger(_0x41e3d1);}else{_0x18bda7[_0xc644('0x3c')](_0x18bda7[_0xc644('0x12')][_0x41e3d1['id']],_0x41e3d1);}}}return _0x18bda7[_0xc644('0x12')];};};Realtime[_0xc644('0x3b')][_0xc644('0x43')]=function(){var _0x50c223=this;return function(_0x40b6ff){if(_0x40b6ff){freeIsNotKey(_0x40b6ff,_0x50c223[_0xc644('0x13')],'id');for(var _0x16f09f=0x0,_0x13f6c2={},_0x41d9cd={};_0x16f09f<_0x40b6ff[_0xc644('0x3d')];_0x16f09f+=0x1){_0x13f6c2=_0x40b6ff[_0x16f09f];if(_[_0xc644('0x3e')](_0x50c223[_0xc644('0x13')][_0x13f6c2['id']])){_0x50c223[_0xc644('0x13')][_0x13f6c2['id']]=new Template(_0x13f6c2);}else{_0x50c223[_0xc644('0x3c')](_0x50c223[_0xc644('0x13')][_0x13f6c2['id']],_0x13f6c2);}}}return _0x50c223[_0xc644('0x13')];};};Realtime[_0xc644('0x3b')][_0xc644('0x44')]=function(){var _0x4f400c=this;return function(_0x3960b8){if(_0x3960b8){freeIsNotKey(_0x3960b8,_0x4f400c[_0xc644('0x19')],'id');for(var _0x235070=0x0,_0x23ad9b={},_0x42c17e={};_0x235070<_0x3960b8[_0xc644('0x3d')];_0x235070+=0x1){_0x23ad9b=_0x3960b8[_0x235070];if(_[_0xc644('0x3e')](_0x4f400c['zendeskAccounts'][_0x23ad9b['id']])){_0x4f400c[_0xc644('0x19')][_0x23ad9b['id']]=new ZendeskAccount(_0x23ad9b);}else{_0x4f400c[_0xc644('0x3c')](_0x4f400c[_0xc644('0x19')][_0x23ad9b['id']],_0x23ad9b);}}}return _0x4f400c[_0xc644('0x19')];};};Realtime[_0xc644('0x3b')][_0xc644('0x45')]=function(){var _0x48064d=this;return function(_0x205eb5){if(_0x205eb5){freeIsNotKey(_0x205eb5,_0x48064d[_0xc644('0x1a')],'id');for(var _0x496a20=0x0,_0x552966={},_0x227271={};_0x496a20<_0x205eb5['length'];_0x496a20+=0x1){_0x552966=_0x205eb5[_0x496a20];if(_['isUndefined'](_0x48064d[_0xc644('0x1a')][_0x552966['id']])){_0x48064d[_0xc644('0x1a')][_0x552966['id']]=new SalesforceAccount(_0x552966);}else{_0x48064d[_0xc644('0x3c')](_0x48064d[_0xc644('0x1a')][_0x552966['id']],_0x552966);}}}return _0x48064d['salesforceAccounts'];};};Realtime[_0xc644('0x3b')][_0xc644('0x46')]=function(){var _0x5e3536=this;return function(_0x359f9e){if(_0x359f9e){freeIsNotKey(_0x359f9e,_0x5e3536[_0xc644('0x1c')],'id');for(var _0x4d88df=0x0,_0xb53a5f={},_0x5d0f0b={};_0x4d88df<_0x359f9e[_0xc644('0x3d')];_0x4d88df+=0x1){_0xb53a5f=_0x359f9e[_0x4d88df];if(_['isUndefined'](_0x5e3536['freshdeskAccounts'][_0xb53a5f['id']])){_0x5e3536[_0xc644('0x1c')][_0xb53a5f['id']]=new FreshdeskAccount(_0xb53a5f);}else{_0x5e3536[_0xc644('0x3c')](_0x5e3536['freshdeskAccounts'][_0xb53a5f['id']],_0xb53a5f);}}}return _0x5e3536['freshdeskAccounts'];};};Realtime[_0xc644('0x3b')]['initZohoAccounts']=function(){var _0x1aa8e5=this;return function(_0x1813b0){if(_0x1813b0){freeIsNotKey(_0x1813b0,_0x1aa8e5[_0xc644('0x1d')],'id');for(var _0x6846e3=0x0,_0x131bae={},_0x38aa44={};_0x6846e3<_0x1813b0[_0xc644('0x3d')];_0x6846e3+=0x1){_0x131bae=_0x1813b0[_0x6846e3];if(_[_0xc644('0x3e')](_0x1aa8e5[_0xc644('0x1d')][_0x131bae['id']])){_0x1aa8e5[_0xc644('0x1d')][_0x131bae['id']]=new ZohoAccount(_0x131bae);}else{_0x1aa8e5[_0xc644('0x3c')](_0x1aa8e5[_0xc644('0x1d')][_0x131bae['id']],_0x131bae);}}}return _0x1aa8e5[_0xc644('0x1d')];};};Realtime['prototype'][_0xc644('0x47')]=function(){var _0x3aeb4c=this;return function(_0x59728f){if(_0x59728f){freeIsNotKey(_0x59728f,_0x3aeb4c[_0xc644('0x1e')],'id');for(var _0x2ba39c=0x0,_0x4a1551={},_0x458338={};_0x2ba39c<_0x59728f['length'];_0x2ba39c+=0x1){_0x4a1551=_0x59728f[_0x2ba39c];if(_[_0xc644('0x3e')](_0x3aeb4c[_0xc644('0x1e')][_0x4a1551['id']])){_0x3aeb4c['deskAccounts'][_0x4a1551['id']]=new DeskAccount(_0x4a1551);}else{_0x3aeb4c[_0xc644('0x3c')](_0x3aeb4c[_0xc644('0x1e')][_0x4a1551['id']],_0x4a1551);}}}return _0x3aeb4c['deskAccounts'];};};Realtime[_0xc644('0x3b')][_0xc644('0x48')]=function(){var _0x3a1712=this;return function(_0x1707e3){if(_0x1707e3){freeIsNotKey(_0x1707e3,_0x3a1712[_0xc644('0x1b')],'id');for(var _0x30d100=0x0,_0x165b85={},_0x42ba9b={};_0x30d100<_0x1707e3[_0xc644('0x3d')];_0x30d100+=0x1){_0x165b85=_0x1707e3[_0x30d100];if(_[_0xc644('0x3e')](_0x3a1712[_0xc644('0x1b')][_0x165b85['id']])){_0x3a1712['sugarcrmAccounts'][_0x165b85['id']]=new SugarcrmAccount(_0x165b85);}else{_0x3a1712[_0xc644('0x3c')](_0x3a1712[_0xc644('0x1b')][_0x165b85['id']],_0x165b85);}}}return _0x3a1712[_0xc644('0x1b')];};};Realtime[_0xc644('0x3b')][_0xc644('0x49')]=function(){var _0x324dd3=this;return function(_0x34cb06){if(_0x34cb06){freeIsNotKey(_0x34cb06,_0x324dd3['vtigerAccounts'],'id');for(var _0x3b0fcf=0x0,_0x4c7065={},_0x40c332={};_0x3b0fcf<_0x34cb06[_0xc644('0x3d')];_0x3b0fcf+=0x1){_0x4c7065=_0x34cb06[_0x3b0fcf];if(_['isUndefined'](_0x324dd3[_0xc644('0x4a')][_0x4c7065['id']])){_0x324dd3[_0xc644('0x4a')][_0x4c7065['id']]=new VtigerAccount(_0x4c7065);}else{_0x324dd3[_0xc644('0x3c')](_0x324dd3[_0xc644('0x4a')][_0x4c7065['id']],_0x4c7065);}}}return _0x324dd3[_0xc644('0x4a')];};};Realtime[_0xc644('0x3b')][_0xc644('0x4b')]=function(){var _0x3477d8=this;return function(_0x41d5cf){if(_0x41d5cf){freeIsNotKey(_0x41d5cf,_0x3477d8[_0xc644('0x1f')],'id');for(var _0x5aa53a=0x0,_0x3378a4={},_0x1fa0bc={};_0x5aa53a<_0x41d5cf[_0xc644('0x3d')];_0x5aa53a+=0x1){_0x3378a4=_0x41d5cf[_0x5aa53a];if(_[_0xc644('0x3e')](_0x3477d8[_0xc644('0x1f')][_0x3378a4['id']])){_0x3477d8[_0xc644('0x1f')][_0x3378a4['id']]=new ServicenowAccount(_0x3378a4);}else{_0x3477d8['mergeFromDatabase'](_0x3477d8[_0xc644('0x1f')][_0x3378a4['id']],_0x3378a4);}}}return _0x3477d8[_0xc644('0x1f')];};};Realtime[_0xc644('0x3b')][_0xc644('0x4c')]=function(){var _0x1dd6be=this;return function(_0x36e653){if(_0x36e653){freeIsNotKey(_0x36e653,_0x1dd6be[_0xc644('0x4d')],'id');for(var _0x421a2b=0x0,_0x15e462={},_0x2167ff={};_0x421a2b<_0x36e653[_0xc644('0x3d')];_0x421a2b+=0x1){_0x15e462=_0x36e653[_0x421a2b];if(_['isUndefined'](_0x1dd6be[_0xc644('0x4d')][_0x15e462['id']])){_0x1dd6be[_0xc644('0x4d')][_0x15e462['id']]=new Dynamics365Account(_0x15e462);}else{_0x1dd6be[_0xc644('0x3c')](_0x1dd6be[_0xc644('0x4d')][_0x15e462['id']],_0x15e462);}}}return _0x1dd6be[_0xc644('0x4d')];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x3c11a5=this;return function(_0x5f3cfb){if(_0x5f3cfb){freeIsNotKey(_0x5f3cfb,_0x3c11a5[_0xc644('0x4e')],'id');for(var _0x3797b3=0x0,_0x1a5790={},_0x5a5586={};_0x3797b3<_0x5f3cfb[_0xc644('0x3d')];_0x3797b3+=0x1){_0x1a5790=_0x5f3cfb[_0x3797b3];if(_[_0xc644('0x3e')](_0x3c11a5[_0xc644('0x4e')][_0x1a5790['id']])){_0x3c11a5[_0xc644('0x4e')][_0x1a5790['id']]=new FreshsalesAccount(_0x1a5790);}else{_0x3c11a5[_0xc644('0x3c')](_0x3c11a5['freshsalesAccounts'][_0x1a5790['id']],_0x1a5790);}}}return _0x3c11a5['freshsalesAccounts'];};};Realtime[_0xc644('0x3b')][_0xc644('0x4f')]=function(){var _0x5080ff=this;return function(_0x6d1173){for(var _0xb4a4ab=0x0;_0xb4a4ab<_0x6d1173[_0xc644('0x3d')];_0xb4a4ab+=0x1){_[_0xc644('0x50')](_0x5080ff[_0xc644('0x41')][_0x6d1173[_0xb4a4ab][_0xc644('0x27')]],_0x6d1173[_0xb4a4ab]);}return _0x5080ff[_0xc644('0x41')];};};Realtime[_0xc644('0x3b')][_0xc644('0x51')]=function(){var _0x11e070=this;return function(_0xa15588){clearVoiceQueues(_0x11e070[_0xc644('0x41')]);if(_0xa15588){_0xa15588=_[_0xc644('0x52')](_0xa15588,_0xc644('0x53'));for(var _0x469e50 in _0xa15588){if(_0xa15588[_0xc644('0x21')](_0x469e50)){var _0x1f4508={};for(var _0x290d0c=0x0;_0x290d0c<_0xa15588[_0x469e50][_0xc644('0x3d')];_0x290d0c+=0x1){var _0x24a0b0=_0xa15588[_0x469e50][_0x290d0c]['queue'];if(_0x11e070[_0xc644('0x41')][_0x24a0b0]){if(_0xa15588[_0x469e50][_0x290d0c][_0xc644('0x54')]){_0x11e070[_0xc644('0x41')][_0x24a0b0][_0xc644('0x2f')]+=0x1;}if(_0xa15588[_0x469e50][_0x290d0c][_0xc644('0x55')]){_0x11e070[_0xc644('0x41')][_0x24a0b0]['abandoned']+=0x1;}_0x11e070[_0xc644('0x41')][_0x24a0b0][_0xc644('0x2a')]+=moment(_0xa15588[_0x469e50][_0x290d0c][_0xc644('0x56')])[_0xc644('0x57')](moment(_0xa15588[_0x469e50][_0x290d0c][_0xc644('0x58')]),'seconds')||0x0;if(_0x290d0c===_0xa15588[_0x469e50][_0xc644('0x3d')]-0x1){_0x11e070['voiceQueues'][_0x24a0b0][_0xc644('0x2b')]+=moment(_0xa15588[_0x469e50][_0x290d0c]['queuecallercompleteAt']||_0xa15588[_0x469e50][_0x290d0c][_0xc644('0x59')]||_0xa15588[_0x469e50][_0x290d0c][_0xc644('0x5a')])['diff'](moment(_0xa15588[_0x469e50][_0x290d0c][_0xc644('0x58')]),_0xc644('0x5b'))||0x0;_0x11e070[_0xc644('0x41')][_0x24a0b0][_0xc644('0x28')]+=0x1;if(_0xa15588[_0x469e50][_0x290d0c]['queuecallercomplete']){_0x11e070['voiceQueues'][_0x24a0b0][_0xc644('0x29')]+=0x1;_0x11e070[_0xc644('0x41')][_0x24a0b0]['sumBillable']+=moment(_0xa15588[_0x469e50][_0x290d0c][_0xc644('0x5c')])[_0xc644('0x57')](moment(_0xa15588[_0x469e50][_0x290d0c][_0xc644('0x56')]),_0xc644('0x5b'))||0x0;}}else{_0x11e070[_0xc644('0x41')][_0x24a0b0]['sumDuration']+=_0x11e070['voiceQueues'][_0x24a0b0]['sumHoldTime']||0x0;}}}}}}return _0x11e070[_0xc644('0x41')];};};Realtime[_0xc644('0x3b')][_0xc644('0x5d')]=function(){var _0xf7131=this;return function(_0x4f1bba){clearVoiceCallReports(_0xf7131['outbound']);if(_0x4f1bba){for(var _0x5a143b=0x0;_0x5a143b<_0x4f1bba[_0xc644('0x3d')];_0x5a143b+=0x1){_0xf7131[_0xc644('0x14')][_0xc644('0x28')]+=0x1;_0xf7131[_0xc644('0x14')][_0xc644('0x2b')]+=_0x4f1bba[_0x5a143b]['duration'];if(_0x4f1bba[_0x5a143b][_0xc644('0x5e')]==='ANSWERED'){_0xf7131[_0xc644('0x14')][_0xc644('0x29')]+=0x1;_0xf7131[_0xc644('0x14')][_0xc644('0x2a')]+=_0x4f1bba[_0x5a143b]['duration']-_0x4f1bba[_0x5a143b][_0xc644('0x5f')]||0x0;_0xf7131[_0xc644('0x14')]['sumBillable']+=_0x4f1bba[_0x5a143b][_0xc644('0x5f')];}}}return _0xf7131[_0xc644('0x14')];};};Realtime[_0xc644('0x3b')][_0xc644('0x60')]=function(){var _0xe1652f=this;return function(_0x488ec1){if(_0x488ec1){freeIsNotKey(_0x488ec1,_0xe1652f['campaigns'],_0xc644('0x27'));for(var _0x2d6845=0x0,_0x37f7d4={};_0x2d6845<_0x488ec1[_0xc644('0x3d')];_0x2d6845+=0x1){_0x37f7d4=_0x488ec1[_0x2d6845];if(_['isUndefined'](_0xe1652f['campaigns'][_0x37f7d4['name']])){_0xe1652f[_0xc644('0x61')][_0x37f7d4[_0xc644('0x27')]]=new Campaign(_0x37f7d4);}else{_0xe1652f['mergeFromDatabase'](_0xe1652f[_0xc644('0x61')][_0x37f7d4[_0xc644('0x27')]],_0x37f7d4);_0xe1652f[_0xc644('0x61')][_0x37f7d4[_0xc644('0x27')]][_0xc644('0x62')]=_0x37f7d4[_0xc644('0x63')]?_0x37f7d4['SquareProject'][_0xc644('0x27')]:undefined;}}}return _0xe1652f[_0xc644('0x61')];};};Realtime[_0xc644('0x3b')][_0xc644('0x64')]=function(){var _0x4b965c=this;return function(_0x449088){if(_0x449088){freeIsNotKey(_0x449088,_0x4b965c[_0xc644('0x15')],'id');for(var _0x391e7e=0x0,_0x9b6dd7={};_0x391e7e<_0x449088[_0xc644('0x3d')];_0x391e7e+=0x1){_0x9b6dd7=_0x449088[_0x391e7e];if(_[_0xc644('0x3e')](_0x4b965c['voiceExtensions'][_0x9b6dd7['id']])){_0x4b965c[_0xc644('0x15')][_0x9b6dd7['id']]=new VoiceExtension(_0x9b6dd7);}else{_0x4b965c[_0xc644('0x3c')](_0x4b965c[_0xc644('0x15')][_0x9b6dd7['id']],_0x9b6dd7);}}}return _0x4b965c[_0xc644('0x15')];};};Realtime[_0xc644('0x3b')][_0xc644('0x65')]=function(){var _0x127e07=this;return function(_0x2356e7){clearCampaigns(_0x127e07[_0xc644('0x61')]);for(var _0x9f0c4d=0x0;_0x9f0c4d<_0x2356e7['length'];_0x9f0c4d+=0x1){_[_0xc644('0x50')](_0x127e07[_0xc644('0x61')][_0x2356e7[_0x9f0c4d]['name']],_0x2356e7[_0x9f0c4d]);}return _0x127e07[_0xc644('0x61')];};};Realtime[_0xc644('0x3b')][_0xc644('0x66')]=function(){var _0x37df35=this;return function(_0x177c06){if(_0x177c06){freeIsNotKey(_0x177c06,_0x37df35[_0xc644('0x20')],'id');for(var _0x3f46bf=0x0,_0x3be292={},_0x52dbe9={};_0x3f46bf<_0x177c06[_0xc644('0x3d')];_0x3f46bf+=0x1){_0x3be292=_0x177c06[_0x3f46bf];if(_[_0xc644('0x3e')](_0x37df35[_0xc644('0x20')][_0x3be292['id']])){_0x37df35[_0xc644('0x20')][_0x3be292['id']]=new FaxAccount(_0x3be292);}else{_0x37df35[_0xc644('0x3c')](_0x37df35[_0xc644('0x20')][_0x3be292['id']],_0x3be292);}}}return _0x37df35[_0xc644('0x20')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 8ae3851..2742ab4 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 _0x66f2=['accountcode','name','isNil','interface','format','SIP/%s','connectedlinenum','assigned','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','getCallType','channel','calleridnum','outbound','internal','destination','exten','dialer','queue','lastdata','context','from-voip-provider','callerid','from-sip','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','UserId','split','membername','monitors','filename','createdAt','xcally-motion-preview','xcally-motion-dialer','startsWith','Local','substring','indexOf','mobile','phone','exports','lodash','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find'];(function(_0x1aaa46,_0x54a651){var _0x42fa5a=function(_0x6a9796){while(--_0x6a9796){_0x1aaa46['push'](_0x1aaa46['shift']());}};_0x42fa5a(++_0x54a651);}(_0x66f2,0xed));var _0x266f=function(_0x107e87,_0x20293b){_0x107e87=_0x107e87-0x0;var _0x267b1a=_0x66f2[_0x107e87];return _0x267b1a;};'use strict';var _=require(_0x266f('0x0'));var moment=require('moment');var util=require('util');var config=require(_0x266f('0x1'));var ami=require(_0x266f('0x2'));var RpcVoiceAgentReport=require(_0x266f('0x3'));var RpcVoiceCallReport=require(_0x266f('0x4'));var RpcVoiceDialReport=require(_0x266f('0x5'));var RpcMemberReport=require(_0x266f('0x6'));var RpcVoiceQueueReport=require(_0x266f('0x7'));var RpcVoiceRecording=require(_0x266f('0x8'));var RpcVoiceTransferReport=require(_0x266f('0x9'));var VoiceQueueReport=require(_0x266f('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x266f('0xb'));var VoiceDialReport=require(_0x266f('0xc'));var UserReport=require(_0x266f('0xd'));function Report(_0x4fe381){this[_0x266f('0xe')]=_0x4fe381;this[_0x266f('0xf')]=_0x4fe381[_0x266f('0xf')];this['telephones']=_0x4fe381[_0x266f('0x10')];}Report[_0x266f('0x11')]['sync']=function(_0x574e24){var _0x4790f8=new VoiceQueueReport(this['realtime']);var _0xd0505a=new VoiceAgentReport(this[_0x266f('0xe')]);var _0x40b4ad=new VoiceDialReport(this[_0x266f('0xe')]);var _0xb0792f=new VoiceCallReport(this[_0x266f('0xe')]);var _0x430992=new UserReport(this[_0x266f('0xe')]);if(config[_0x266f('0x12')]&&config[_0x266f('0x12')][_0x266f('0x13')]){ami['on'](_0x266f('0x14'),this[_0x266f('0x15')][_0x266f('0x16')](this));ami['on'](_0x266f('0x17'),this[_0x266f('0x18')]['bind'](this));ami['on'](_0x266f('0x19'),this['voiceAgentReport'][_0x266f('0x16')](this));ami['on'](_0x266f('0x1a'),this[_0x266f('0x1b')][_0x266f('0x16')](this));ami['on'](_0x266f('0x1c'),this[_0x266f('0x1d')][_0x266f('0x16')](this));ami['on']('attendedtransfer',this[_0x266f('0x1e')][_0x266f('0x16')](this));}};Report[_0x266f('0x11')][_0x266f('0x1f')]=function(_0x1c4dba){var _0x4fca46;_0x4fca46=_[_0x266f('0x20')](this[_0x266f('0xf')],function(_0x196b57){return _0x196b57[_0x266f('0x21')]==_0x1c4dba||_0x196b57[_0x266f('0x22')]==_0x1c4dba;});if(_[_0x266f('0x23')](_0x4fca46)){var _0x352052=_[_0x266f('0x20')](this[_0x266f('0x10')],function(_0x4cda01){return _0x4cda01[_0x266f('0x21')]==_0x1c4dba||_0x4cda01[_0x266f('0x22')]==_0x1c4dba;});if(_0x352052){_0x4fca46=_[_0x266f('0x20')](this[_0x266f('0xf')],function(_0x11cc3){return _0x11cc3[_0x266f('0x24')]==util[_0x266f('0x25')](_0x266f('0x26'),_0x352052[_0x266f('0x22')]);});}}return _0x4fca46;};Report[_0x266f('0x11')][_0x266f('0x15')]=function(_0x2c12dc){for(var _0x1ae7df=0x0;_0x1ae7df<_0x2c12dc['length'];_0x1ae7df+=0x1){var _0x2dffad=this[_0x266f('0x1f')](_0x2c12dc[_0x1ae7df][_0x266f('0x27')]);if(_0x2dffad){_0x2c12dc[_0x1ae7df][_0x266f('0x21')]=_0x2dffad[_0x266f('0x21')];_0x2c12dc[_0x1ae7df][_0x266f('0x28')]=!![];_0x2c12dc[_0x1ae7df][_0x266f('0x29')]=_0x2dffad[_0x266f('0x22')];_0x2c12dc[_0x1ae7df][_0x266f('0x24')]=_[_0x266f('0x23')](_0x2dffad[_0x266f('0x24')])?util[_0x266f('0x25')](_0x266f('0x26'),_0x2dffad['name']):_0x2dffad['interface'];if(_0x2c12dc[_0x1ae7df]['queuecallercomplete']){_0x2c12dc[_0x1ae7df][_0x266f('0x2a')]=moment()['format'](_0x266f('0x2b'));}if(_0x2c12dc[_0x1ae7df][_0x266f('0x2c')]){_0x2c12dc[_0x1ae7df][_0x266f('0x2d')]=moment()[_0x266f('0x25')](_0x266f('0x2b'));}RpcMemberReport[_0x266f('0x15')](_0x2c12dc[_0x1ae7df]);}RpcVoiceQueueReport[_0x266f('0x2e')](_0x2c12dc[_0x1ae7df]);}};function extractCalleridNumber(_0x48c6c5){var _0x57693d=_0x48c6c5['match'](/<(.*?)>/);return _0x57693d?_0x57693d[0x1]:_0x48c6c5;}Report[_0x266f('0x11')][_0x266f('0x2f')]=function(_0x2bb769){for(var _0x1d25d2=0x0;_0x1d25d2/);return _0x4fb45d?_0x4fb45d[0x1]:_0xfeee63;}Report[_0xdbf4('0xf')][_0xdbf4('0x2b')]=function(_0x7381b3){for(var _0x334098=0x0;_0x334098',_0x1900ef[_0xdbf4('0x42')],_0x1900ef['calleridnum']);}if(RpcVoiceTransferReport[_0xdbf4('0x43')][_0x1900ef[_0xdbf4('0x44')]]){var _0x212591=RpcVoiceTransferReport['transfers'][_0x1900ef[_0xdbf4('0x44')]];_0x212591['transfereelinkedid']=_0x1900ef[_0xdbf4('0x45')];RpcVoiceTransferReport[_0xdbf4('0x19')](_0x212591);delete RpcVoiceTransferReport[_0xdbf4('0x43')][_0x1900ef['linkedid']];}if(_[_0xdbf4('0x1f')](_0x1900ef[_0xdbf4('0x35')])){_0x1900ef['type']=this[_0xdbf4('0x2e')](_0x1900ef);}if(_[_0xdbf4('0x1f')](_0x1900ef[_0xdbf4('0x46')])){var _0xc7cde2=_0x1900ef[_0xdbf4('0x2f')][_0xdbf4('0x30')]('-')[0x0];var _0xddde1f=this[_0xdbf4('0xd')][_0xc7cde2];if(!_0xddde1f)_0xddde1f=this[_0xdbf4('0x2b')](_0x1900ef[_0xdbf4('0x1d')]);if(_0xddde1f){_0x1900ef[_0xdbf4('0x46')]=_0xddde1f['id'];_0x1900ef[_0xdbf4('0x47')]=_0xddde1f[_0xdbf4('0x1e')];}}RpcVoiceCallReport[_0xdbf4('0x48')](_0x1900ef);if(_0x1900ef[_0xdbf4('0x49')]){for(var _0x1ae71f=0x0;_0x1ae71f<_0x1900ef[_0xdbf4('0x4a')]['length'];_0x1ae71f+=0x1){_0x1900ef[_0xdbf4('0x4b')]=_0x1900ef['monitors'][_0x1ae71f][_0xdbf4('0x4c')];_0x1900ef['createdAt']=_0x1900ef[_0xdbf4('0x4a')][_0x1ae71f][_0xdbf4('0x4d')];if(_0x1900ef[_0xdbf4('0x34')]==_0xdbf4('0x3c')){_0x1900ef['calleridnum']=_0x1900ef['connectedlinenum'];_0x1900ef[_0xdbf4('0x42')]=_0x1900ef[_0xdbf4('0x4e')];_0x1900ef[_0xdbf4('0x22')]=_0x1900ef[_0xdbf4('0x1d')];_0x1900ef[_0xdbf4('0x4e')]=_0x1900ef[_0xdbf4('0x47')];_0x1900ef[_0xdbf4('0x34')]=_0x1900ef['originatecalleridnum'];}else if(_0x1900ef[_0xdbf4('0x34')]=='xcally-motion-dialer'){_0x1900ef[_0xdbf4('0x31')]=_0x1900ef[_0xdbf4('0x33')];_0x1900ef[_0xdbf4('0x34')]=_0x1900ef[_0xdbf4('0x3f')];}RpcVoiceRecording[_0xdbf4('0x48')](_0x1900ef);}}};Report[_0xdbf4('0xf')][_0xdbf4('0x15')]=function(_0x455fe2){if(_[_0xdbf4('0x4f')](_0x455fe2)){_0x455fe2[_0xdbf4('0x50')](function(_0xa83695){RpcVoiceAgentReport[_0xdbf4('0x48')](_0xa83695);});}else{RpcVoiceAgentReport['create'](_0x455fe2);}};Report[_0xdbf4('0xf')][_0xdbf4('0x17')]=function(_0x310f81){RpcVoiceDialReport[_0xdbf4('0x48')](_0x310f81);var _0x374d6c;var _0x1ae775;var _0x2d9890=_0x310f81['channel'];if(_[_0xdbf4('0x51')](_0x2d9890,_0xdbf4('0x52'))){_0x1ae775=_0x2d9890[_0xdbf4('0x53')](_0x2d9890[_0xdbf4('0x54')]('/')+0x1,_0x2d9890[_0xdbf4('0x54')]('@'));_0x374d6c=_[_0xdbf4('0x1c')](this[_0xdbf4('0xd')],function(_0x5671ba){return _0x5671ba[_0xdbf4('0x55')]==_0x1ae775||_0x5671ba['phone']==_0x1ae775||_0x5671ba[_0xdbf4('0x1d')]==_0x1ae775;});}else{_0x1ae775=_0x2d9890[_0xdbf4('0x53')](_0x2d9890[_0xdbf4('0x54')]('/')+0x1,_0x2d9890[_0xdbf4('0x56')]('-'));_0x374d6c=this['findAgent'](_0x1ae775);}if(_0x374d6c){_0x310f81[_0xdbf4('0x20')]=_[_0xdbf4('0x1f')](_0x374d6c[_0xdbf4('0x20')])?util[_0xdbf4('0x21')](_0xdbf4('0x24'),_0x374d6c[_0xdbf4('0x1e')]):_0x374d6c[_0xdbf4('0x20')];_0x310f81[_0xdbf4('0x47')]=_0x374d6c['name'];_0x310f81[_0xdbf4('0x1d')]=_0x374d6c[_0xdbf4('0x1d')];RpcMemberReport[_0xdbf4('0x17')](_0x310f81);}};Report[_0xdbf4('0xf')][_0xdbf4('0x19')]=function(_0xe1a56c){RpcVoiceTransferReport[_0xdbf4('0x43')][_0xe1a56c[_0xdbf4('0x57')]]=_0xe1a56c;};Report[_0xdbf4('0xf')][_0xdbf4('0x58')]=function(_0x19eced){RpcVoiceTransferReport['attendedTransfer'](_0x19eced);};module[_0xdbf4('0x59')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 8a2e7fd..cdefb3d 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x887a=['[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','find','stateRegistry','merge','event','actionid','format','trunk:%s','name','trunk:save','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','toNumber','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','mobile','phone','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','[userReport][peerstatus]','registered','peer','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','exports','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','catch','inspect','then','error','[userReport][devicestatelist]','prototype','isNotNull','isUndefined','emit'];(function(_0x40b723,_0x118b22){var _0x1981ad=function(_0x1dbe18){while(--_0x1dbe18){_0x40b723['push'](_0x40b723['shift']());}};_0x1981ad(++_0x118b22);}(_0x887a,0xb1));var _0xa887=function(_0x139958,_0x2eb8ba){_0x139958=_0x139958-0x0;var _0x7c6e3f=_0x887a[_0x139958];return _0x7c6e3f;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xa887('0x0'));var Redis=require(_0xa887('0x1'));var BPromise=require(_0xa887('0x2'));var config=require(_0xa887('0x3'));var logger=require(_0xa887('0x4'))(_0xa887('0x5'));var ami=require('../ami');config[_0xa887('0x6')]=_[_0xa887('0x7')](config[_0xa887('0x6')],{'host':_0xa887('0x8'),'port':0x18eb});var io=require(_0xa887('0x9'))(new Redis(config[_0xa887('0x6')]));function UserReport(_0x240e13){this[_0xa887('0xa')]=_0x240e13['trunks'];this[_0xa887('0xb')]=_0x240e13['agents'];this['telephones']=_0x240e13[_0xa887('0xc')];ami['on'](_0xa887('0xd'),this[_0xa887('0xe')][_0xa887('0xf')](this));ami['on']('registry',this[_0xa887('0xe')]['bind'](this));ami['on']('devicestatechange',this[_0xa887('0x10')]['bind'](this));ami['on'](_0xa887('0x11'),this[_0xa887('0x12')][_0xa887('0xf')](this));return this[_0xa887('0x13')]();}function showSipRegistrations(){Promise[_0xa887('0x14')]()['then'](ami['actionSipShowRegistry']())[_0xa887('0x15')](function(_0x6420c1){logger['error']('[userReport][sipshowregistry]',util[_0xa887('0x16')](_0x6420c1,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xa887('0x14')]()[_0xa887('0x17')](ami['actionDeviceStateList']())['catch'](function(_0x1f26f9){logger[_0xa887('0x18')](_0xa887('0x19'),util[_0xa887('0x16')](_0x1f26f9,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xa887('0x14')]()[_0xa887('0x17')](ami['actionSipPeerStatus']())[_0xa887('0x15')](function(_0xae2002){logger[_0xa887('0x18')]('[userReport][sippeerstatus]',util[_0xa887('0x16')](_0xae2002,{'showHidden':![],'depth':null}));});}UserReport[_0xa887('0x1a')][_0xa887('0x13')]=function(){setInterval(function(){BPromise[_0xa887('0x14')]()[_0xa887('0x17')](showSipRegistrations())[_0xa887('0x17')](listDeviceStates())[_0xa887('0x17')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0xa887('0x1b')]=function(_0x356e44){return _0x356e44!==null&&!_[_0xa887('0x1c')](_0x356e44);};UserReport[_0xa887('0x1a')]['emit']=function(_0x199617,_0x5304f6,_0x551bd9){io['to'](_0x199617)[_0xa887('0x1d')](_0x5304f6,_0x551bd9);};UserReport['prototype'][_0xa887('0xe')]=function(_0x524804){try{if(this['isNotNull'](_0x524804)){logger['info'](_0xa887('0x1e'),_0x524804[_0xa887('0x1f')],_0x524804[_0xa887('0x20')]);logger[_0xa887('0x21')]('[userReport][registry]',util[_0xa887('0x16')](_0x524804,{'showHidden':![],'depth':null}));var _0x2a86d1=_[_0xa887('0x22')](this[_0xa887('0xa')],{'defaultuser':_0x524804[_0xa887('0x1f')]});if(_0x2a86d1){_0x524804[_0xa887('0x23')]=_0x524804[_0xa887('0x20')];_[_0xa887('0x24')](_0x2a86d1,_['omit'](_0x524804,[_0xa887('0x25'),_0xa887('0x26'),_0xa887('0x1f'),_0xa887('0x20')]));logger[_0xa887('0x21')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xa887('0x16')](_0x2a86d1,{'showHidden':![],'depth':null}));this[_0xa887('0x1d')](util[_0xa887('0x27')](_0xa887('0x28'),_0x2a86d1[_0xa887('0x29')]),_0xa887('0x2a'),_0x2a86d1);}}}catch(_0x3b452a){logger[_0xa887('0x18')]('[userReport][registry]',util['inspect'](_0x3b452a,{'showHidden':![],'depth':null}));}};UserReport[_0xa887('0x1a')]['syncDeviceState']=function(_0x51fd58){try{if(this['isNotNull'](_0x51fd58)){logger[_0xa887('0x2b')](_0xa887('0x2c'),_0x51fd58[_0xa887('0x2d')],_0x51fd58['state']);logger[_0xa887('0x21')](_0xa887('0x2e'),util['inspect'](_0x51fd58,{'showHidden':![],'depth':null}));if(this[_0xa887('0xb')][_0x51fd58[_0xa887('0x2d')]]){if(!this['agents'][_0x51fd58['device']][_0xa887('0x2f')]||_0x51fd58['state'][_0xa887('0x30')]()=='inuse'){this['agents'][_0x51fd58[_0xa887('0x2d')]][_0xa887('0x2f')]=![];if(this[_0xa887('0xb')][_0x51fd58[_0xa887('0x2d')]][_0xa887('0x20')]!==_0x51fd58[_0xa887('0x20')][_0xa887('0x30')]()){this['agents'][_0x51fd58['device']]['stateTime']=_[_0xa887('0x31')](moment()[_0xa887('0x27')]('x'));}this[_0xa887('0xb')][_0x51fd58['device']][_0xa887('0x20')]=_0x51fd58[_0xa887('0x20')][_0xa887('0x30')]();this[_0xa887('0xb')][_0x51fd58[_0xa887('0x2d')]][_0xa887('0x32')](_0x51fd58);}}else if(this[_0xa887('0xc')][_0x51fd58[_0xa887('0x2d')]]){if(this[_0xa887('0xc')][_0x51fd58['device']][_0xa887('0x20')]!==_0x51fd58['state'][_0xa887('0x30')]()){this['telephones'][_0x51fd58['device']][_0xa887('0x33')]=_[_0xa887('0x31')](moment()[_0xa887('0x27')]('x'));}this[_0xa887('0xc')][_0x51fd58[_0xa887('0x2d')]][_0xa887('0x20')]=_0x51fd58[_0xa887('0x20')][_0xa887('0x30')]();logger['debug'](_0xa887('0x34'),util[_0xa887('0x16')](this['telephones'][_0x51fd58[_0xa887('0x2d')]],{'showHidden':![],'depth':null}));this[_0xa887('0x1d')](util['format'](_0xa887('0x35'),this[_0xa887('0xc')][_0x51fd58[_0xa887('0x2d')]][_0xa887('0x29')]),_0xa887('0x36'),this[_0xa887('0xc')][_0x51fd58['device']]);}else if(this[_0xa887('0xa')][_0x51fd58[_0xa887('0x2d')]]){if(this[_0xa887('0xa')][_0x51fd58[_0xa887('0x2d')]][_0xa887('0x20')]!==_0x51fd58[_0xa887('0x20')][_0xa887('0x30')]()){this['trunks'][_0x51fd58[_0xa887('0x2d')]]['stateTime']=_['toNumber'](moment()[_0xa887('0x27')]('x'));}this[_0xa887('0xa')][_0x51fd58[_0xa887('0x2d')]][_0xa887('0x20')]=_0x51fd58['state'][_0xa887('0x30')]();logger[_0xa887('0x21')](_0xa887('0x37'),util[_0xa887('0x16')](this[_0xa887('0xa')][_0x51fd58[_0xa887('0x2d')]],{'showHidden':![],'depth':null}));this[_0xa887('0x1d')](util['format'](_0xa887('0x28'),this[_0xa887('0xa')][_0x51fd58[_0xa887('0x2d')]]['name']),_0xa887('0x2a'),this[_0xa887('0xa')][_0x51fd58[_0xa887('0x2d')]]);}else if(_[_0xa887('0x38')](_0x51fd58['device'],_0xa887('0x39'))){var _0x1f6989=_0x51fd58[_0xa887('0x2d')];var _0x57c21b=_0x1f6989['substring'](_0x1f6989[_0xa887('0x3a')]('/')+0x1,_0x1f6989[_0xa887('0x3a')]('@'));var _0x302dd6=_['find'](this[_0xa887('0xb')],function(_0x11bb5a){return _0x11bb5a[_0xa887('0x3b')]==_0x57c21b||_0x11bb5a[_0xa887('0x3c')]==_0x57c21b||_0x11bb5a['accountcode']==_0x57c21b;});if(_0x302dd6){if(_0x302dd6['state']!==_0x51fd58['state'][_0xa887('0x30')]()){_0x302dd6[_0xa887('0x33')]=_['toNumber'](moment()[_0xa887('0x27')]('x'));}_0x302dd6[_0xa887('0x20')]=_0x51fd58[_0xa887('0x20')]['toLowerCase']();_0x302dd6[_0xa887('0x2f')]=!![];_0x302dd6['updateStatusRealtime'](_0x51fd58);}}}}catch(_0x47428e){logger['error'](_0xa887('0x2e'),util[_0xa887('0x16')](_0x47428e,{'showHidden':![],'depth':null}));}};UserReport[_0xa887('0x1a')][_0xa887('0x12')]=function(_0x4c412f){try{if(this['isNotNull'](_0x4c412f)&&this['isNotNull'](_0x4c412f[_0xa887('0x11')])){logger[_0xa887('0x2b')](_0xa887('0x3d'),_0x4c412f['peer'],_0x4c412f['address'],_0x4c412f[_0xa887('0x11')]);logger['debug'](_0xa887('0x3e'),util[_0xa887('0x16')](_0x4c412f,{'showHidden':![],'depth':null}));if(this[_0xa887('0xb')][_0x4c412f['peer']]){if(!this[_0xa887('0xb')][_0x4c412f['peer']][_0xa887('0x2f')]||_0x4c412f[_0xa887('0x11')]['toLowerCase']()==_0xa887('0x3f')){this['agents'][_0x4c412f[_0xa887('0x40')]]['local']=![];this[_0xa887('0xb')][_0x4c412f[_0xa887('0x40')]][_0xa887('0x41')]=_0x4c412f[_0xa887('0x11')][_0xa887('0x30')]();this[_0xa887('0xb')][_0x4c412f[_0xa887('0x40')]][_0xa887('0x42')]=_0x4c412f[_0xa887('0x42')];this['agents'][_0x4c412f[_0xa887('0x40')]][_0xa887('0x32')](_0x4c412f);}}else if(this[_0xa887('0xc')][_0x4c412f['peer']]){this[_0xa887('0xc')][_0x4c412f['peer']][_0xa887('0x41')]=_0x4c412f['peerstatus'][_0xa887('0x30')]();this['telephones'][_0x4c412f[_0xa887('0x40')]]['address']=_0x4c412f[_0xa887('0x42')];logger['debug'](_0xa887('0x43'),util[_0xa887('0x16')](this[_0xa887('0xc')][_0x4c412f[_0xa887('0x40')]],{'showHidden':![],'depth':null}));this[_0xa887('0x1d')](util[_0xa887('0x27')]('telephone:%s',this[_0xa887('0xc')][_0x4c412f['peer']][_0xa887('0x29')]),_0xa887('0x36'),this['telephones'][_0x4c412f[_0xa887('0x40')]]);}else if(this[_0xa887('0xa')][_0x4c412f[_0xa887('0x40')]]){this[_0xa887('0xa')][_0x4c412f['peer']]['status']=_0x4c412f[_0xa887('0x11')][_0xa887('0x30')]();this['trunks'][_0x4c412f[_0xa887('0x40')]][_0xa887('0x42')]=_0x4c412f[_0xa887('0x42')];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xa887('0x16')](this[_0xa887('0xa')][_0x4c412f['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0xa887('0x27')]('trunk:%s',this[_0xa887('0xa')][_0x4c412f[_0xa887('0x40')]][_0xa887('0x29')]),'trunk:save',this[_0xa887('0xa')][_0x4c412f[_0xa887('0x40')]]);}}}catch(_0x46533f){logger[_0xa887('0x18')](_0xa887('0x3e'),util[_0xa887('0x16')](_0x46533f,{'showHidden':![],'depth':null}));}};module[_0xa887('0x44')]=UserReport; \ No newline at end of file +var _0xeda6=['telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','find','mobile','phone','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','bluebird','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','bind','registry','syncRegistry','devicestatechange','peerstatus','syncPeerStatus','syncRealtimeShow','then','[userReport][sipshowregistry]','inspect','actionDeviceStateList','error','[userReport][devicestatelist]','resolve','actionSipPeerStatus','catch','[userReport][sippeerstatus]','prototype','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','stateRegistry','omit','event','actionid','debug','format','trunk:%s','trunk:save','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','name'];(function(_0x543412,_0x4d2bea){var _0x4cab53=function(_0x21519f){while(--_0x21519f){_0x543412['push'](_0x543412['shift']());}};_0x4cab53(++_0x4d2bea);}(_0xeda6,0xa3));var _0x6eda=function(_0x51dadc,_0x33818b){_0x51dadc=_0x51dadc-0x0;var _0x5c1e55=_0xeda6[_0x51dadc];return _0x5c1e55;};'use strict';var _=require(_0x6eda('0x0'));var moment=require('moment');var util=require('util');var Redis=require('ioredis');var BPromise=require(_0x6eda('0x1'));var config=require(_0x6eda('0x2'));var logger=require(_0x6eda('0x3'))(_0x6eda('0x4'));var ami=require('../ami');config[_0x6eda('0x5')]=_[_0x6eda('0x6')](config[_0x6eda('0x5')],{'host':_0x6eda('0x7'),'port':0x18eb});var io=require(_0x6eda('0x8'))(new Redis(config['redis']));function UserReport(_0x2037d0){this[_0x6eda('0x9')]=_0x2037d0[_0x6eda('0x9')];this[_0x6eda('0xa')]=_0x2037d0[_0x6eda('0xa')];this[_0x6eda('0xb')]=_0x2037d0[_0x6eda('0xb')];ami['on']('registryentry',this['syncRegistry'][_0x6eda('0xc')](this));ami['on'](_0x6eda('0xd'),this[_0x6eda('0xe')][_0x6eda('0xc')](this));ami['on'](_0x6eda('0xf'),this['syncDeviceState'][_0x6eda('0xc')](this));ami['on'](_0x6eda('0x10'),this[_0x6eda('0x11')][_0x6eda('0xc')](this));return this[_0x6eda('0x12')]();}function showSipRegistrations(){Promise['resolve']()[_0x6eda('0x13')](ami['actionSipShowRegistry']())['catch'](function(_0x26e1b0){logger['error'](_0x6eda('0x14'),util[_0x6eda('0x15')](_0x26e1b0,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0x6eda('0x13')](ami[_0x6eda('0x16')]())['catch'](function(_0x554eb5){logger[_0x6eda('0x17')](_0x6eda('0x18'),util['inspect'](_0x554eb5,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x6eda('0x19')]()['then'](ami[_0x6eda('0x1a')]())[_0x6eda('0x1b')](function(_0x540702){logger[_0x6eda('0x17')](_0x6eda('0x1c'),util['inspect'](_0x540702,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x6eda('0x12')]=function(){setInterval(function(){BPromise[_0x6eda('0x19')]()[_0x6eda('0x13')](showSipRegistrations())[_0x6eda('0x13')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x335dc8){return _0x335dc8!==null&&!_['isUndefined'](_0x335dc8);};UserReport[_0x6eda('0x1d')][_0x6eda('0x1e')]=function(_0xd99aac,_0xea3bd2,_0x3bd29d){io['to'](_0xd99aac)[_0x6eda('0x1e')](_0xea3bd2,_0x3bd29d);};UserReport['prototype'][_0x6eda('0xe')]=function(_0xb812fc){try{if(this[_0x6eda('0x1f')](_0xb812fc)){logger[_0x6eda('0x20')](_0x6eda('0x21'),_0xb812fc[_0x6eda('0x22')],_0xb812fc[_0x6eda('0x23')]);logger['debug']('[userReport][registry]',util[_0x6eda('0x15')](_0xb812fc,{'showHidden':![],'depth':null}));var _0x207f01=_['find'](this[_0x6eda('0x9')],{'defaultuser':_0xb812fc['username']});if(_0x207f01){_0xb812fc[_0x6eda('0x24')]=_0xb812fc['state'];_['merge'](_0x207f01,_[_0x6eda('0x25')](_0xb812fc,[_0x6eda('0x26'),_0x6eda('0x27'),'username',_0x6eda('0x23')]));logger[_0x6eda('0x28')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x6eda('0x15')](_0x207f01,{'showHidden':![],'depth':null}));this[_0x6eda('0x1e')](util[_0x6eda('0x29')](_0x6eda('0x2a'),_0x207f01['name']),_0x6eda('0x2b'),_0x207f01);}}}catch(_0x381c5a){logger[_0x6eda('0x17')]('[userReport][registry]',util['inspect'](_0x381c5a,{'showHidden':![],'depth':null}));}};UserReport[_0x6eda('0x1d')][_0x6eda('0x2c')]=function(_0x2008e7){try{if(this[_0x6eda('0x1f')](_0x2008e7)){logger['info'](_0x6eda('0x2d'),_0x2008e7[_0x6eda('0x2e')],_0x2008e7[_0x6eda('0x23')]);logger[_0x6eda('0x28')](_0x6eda('0x2f'),util[_0x6eda('0x15')](_0x2008e7,{'showHidden':![],'depth':null}));if(this[_0x6eda('0xa')][_0x2008e7['device']]){if(!this[_0x6eda('0xa')][_0x2008e7[_0x6eda('0x2e')]][_0x6eda('0x30')]||_0x2008e7[_0x6eda('0x23')][_0x6eda('0x31')]()==_0x6eda('0x32')){this['agents'][_0x2008e7[_0x6eda('0x2e')]]['local']=![];if(this[_0x6eda('0xa')][_0x2008e7['device']]['state']!==_0x2008e7[_0x6eda('0x23')]['toLowerCase']()){this[_0x6eda('0xa')][_0x2008e7[_0x6eda('0x2e')]][_0x6eda('0x33')]=_[_0x6eda('0x34')](moment()[_0x6eda('0x29')]('x'));}this['agents'][_0x2008e7[_0x6eda('0x2e')]][_0x6eda('0x23')]=_0x2008e7[_0x6eda('0x23')]['toLowerCase']();this['agents'][_0x2008e7['device']][_0x6eda('0x35')](_0x2008e7);}}else if(this['telephones'][_0x2008e7[_0x6eda('0x2e')]]){if(this[_0x6eda('0xb')][_0x2008e7[_0x6eda('0x2e')]][_0x6eda('0x23')]!==_0x2008e7['state'][_0x6eda('0x31')]()){this[_0x6eda('0xb')][_0x2008e7['device']][_0x6eda('0x33')]=_[_0x6eda('0x34')](moment()[_0x6eda('0x29')]('x'));}this[_0x6eda('0xb')][_0x2008e7[_0x6eda('0x2e')]][_0x6eda('0x23')]=_0x2008e7['state'][_0x6eda('0x31')]();logger[_0x6eda('0x28')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x6eda('0x15')](this[_0x6eda('0xb')][_0x2008e7[_0x6eda('0x2e')]],{'showHidden':![],'depth':null}));this[_0x6eda('0x1e')](util[_0x6eda('0x29')](_0x6eda('0x36'),this[_0x6eda('0xb')][_0x2008e7['device']][_0x6eda('0x37')]),_0x6eda('0x38'),this[_0x6eda('0xb')][_0x2008e7['device']]);}else if(this[_0x6eda('0x9')][_0x2008e7[_0x6eda('0x2e')]]){if(this['trunks'][_0x2008e7[_0x6eda('0x2e')]]['state']!==_0x2008e7[_0x6eda('0x23')][_0x6eda('0x31')]()){this[_0x6eda('0x9')][_0x2008e7[_0x6eda('0x2e')]][_0x6eda('0x33')]=_[_0x6eda('0x34')](moment()['format']('x'));}this[_0x6eda('0x9')][_0x2008e7[_0x6eda('0x2e')]][_0x6eda('0x23')]=_0x2008e7[_0x6eda('0x23')]['toLowerCase']();logger[_0x6eda('0x28')](_0x6eda('0x39'),util[_0x6eda('0x15')](this[_0x6eda('0x9')][_0x2008e7[_0x6eda('0x2e')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x6eda('0x29')](_0x6eda('0x2a'),this[_0x6eda('0x9')][_0x2008e7[_0x6eda('0x2e')]][_0x6eda('0x37')]),_0x6eda('0x2b'),this[_0x6eda('0x9')][_0x2008e7['device']]);}else if(_[_0x6eda('0x3a')](_0x2008e7['device'],_0x6eda('0x3b'))){var _0x176a60=_0x2008e7[_0x6eda('0x2e')];var _0x5a26f4=_0x176a60['substring'](_0x176a60[_0x6eda('0x3c')]('/')+0x1,_0x176a60['indexOf']('@'));var _0x403eaf=_[_0x6eda('0x3d')](this[_0x6eda('0xa')],function(_0x5a0a8b){return _0x5a0a8b[_0x6eda('0x3e')]==_0x5a26f4||_0x5a0a8b[_0x6eda('0x3f')]==_0x5a26f4||_0x5a0a8b['accountcode']==_0x5a26f4;});if(_0x403eaf){if(_0x403eaf[_0x6eda('0x23')]!==_0x2008e7['state'][_0x6eda('0x31')]()){_0x403eaf[_0x6eda('0x33')]=_[_0x6eda('0x34')](moment()[_0x6eda('0x29')]('x'));}_0x403eaf[_0x6eda('0x23')]=_0x2008e7[_0x6eda('0x23')][_0x6eda('0x31')]();_0x403eaf[_0x6eda('0x30')]=!![];_0x403eaf[_0x6eda('0x35')](_0x2008e7);}}}}catch(_0x3a90c4){logger['error'](_0x6eda('0x2f'),util[_0x6eda('0x15')](_0x3a90c4,{'showHidden':![],'depth':null}));}};UserReport[_0x6eda('0x1d')][_0x6eda('0x11')]=function(_0x5d2d9b){try{if(this['isNotNull'](_0x5d2d9b)&&this['isNotNull'](_0x5d2d9b[_0x6eda('0x10')])){logger['info'](_0x6eda('0x40'),_0x5d2d9b[_0x6eda('0x41')],_0x5d2d9b[_0x6eda('0x42')],_0x5d2d9b[_0x6eda('0x10')]);logger[_0x6eda('0x28')](_0x6eda('0x43'),util[_0x6eda('0x15')](_0x5d2d9b,{'showHidden':![],'depth':null}));if(this[_0x6eda('0xa')][_0x5d2d9b[_0x6eda('0x41')]]){if(!this[_0x6eda('0xa')][_0x5d2d9b[_0x6eda('0x41')]]['local']||_0x5d2d9b[_0x6eda('0x10')][_0x6eda('0x31')]()==_0x6eda('0x44')){this[_0x6eda('0xa')][_0x5d2d9b[_0x6eda('0x41')]][_0x6eda('0x30')]=![];this[_0x6eda('0xa')][_0x5d2d9b[_0x6eda('0x41')]]['status']=_0x5d2d9b[_0x6eda('0x10')][_0x6eda('0x31')]();this['agents'][_0x5d2d9b[_0x6eda('0x41')]][_0x6eda('0x42')]=_0x5d2d9b[_0x6eda('0x42')];this[_0x6eda('0xa')][_0x5d2d9b['peer']][_0x6eda('0x35')](_0x5d2d9b);}}else if(this[_0x6eda('0xb')][_0x5d2d9b[_0x6eda('0x41')]]){this[_0x6eda('0xb')][_0x5d2d9b[_0x6eda('0x41')]][_0x6eda('0x45')]=_0x5d2d9b[_0x6eda('0x10')][_0x6eda('0x31')]();this['telephones'][_0x5d2d9b[_0x6eda('0x41')]][_0x6eda('0x42')]=_0x5d2d9b[_0x6eda('0x42')];logger[_0x6eda('0x28')](_0x6eda('0x46'),util[_0x6eda('0x15')](this[_0x6eda('0xb')][_0x5d2d9b[_0x6eda('0x41')]],{'showHidden':![],'depth':null}));this[_0x6eda('0x1e')](util[_0x6eda('0x29')](_0x6eda('0x36'),this[_0x6eda('0xb')][_0x5d2d9b[_0x6eda('0x41')]]['name']),'telephone:save',this['telephones'][_0x5d2d9b[_0x6eda('0x41')]]);}else if(this[_0x6eda('0x9')][_0x5d2d9b[_0x6eda('0x41')]]){this[_0x6eda('0x9')][_0x5d2d9b[_0x6eda('0x41')]][_0x6eda('0x45')]=_0x5d2d9b[_0x6eda('0x10')][_0x6eda('0x31')]();this['trunks'][_0x5d2d9b[_0x6eda('0x41')]][_0x6eda('0x42')]=_0x5d2d9b[_0x6eda('0x42')];logger['debug'](_0x6eda('0x47'),util[_0x6eda('0x15')](this[_0x6eda('0x9')][_0x5d2d9b['peer']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x6eda('0x2a'),this['trunks'][_0x5d2d9b[_0x6eda('0x41')]][_0x6eda('0x37')]),'trunk:save',this['trunks'][_0x5d2d9b[_0x6eda('0x41')]]);}}}catch(_0x14f7db){logger[_0x6eda('0x17')](_0x6eda('0x43'),util[_0x6eda('0x15')](_0x14f7db,{'showHidden':![],'depth':null}));}};module[_0x6eda('0x48')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index ff7c1f8..34917fc 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x56dfd9,_0x1dc203){var _0x237d56=function(_0x4fd852){while(--_0x4fd852){_0x56dfd9['push'](_0x56dfd9['shift']());}};_0x237d56(++_0x1dc203);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0xcd7d22,_0x59a517){var _0x334893=function(_0x25fac2){while(--_0x25fac2){_0xcd7d22['push'](_0xcd7d22['shift']());}};_0x334893(++_0x59a517);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 2c2b940..f9a8884 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc092=['monitor','.wav49','.WAV','monitorFilename','find','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcallid','sipcalllinkedid','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','length','user:agentcomplete','resolve','then','transferType','undefined','isEmpty','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereeuniqueid','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','util','../../../config/environment','ami','../ami','../model/channel','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','localhost','channels','agents','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','attendedtransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','emit','syncNewCallerId','info','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','merge','pick','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','blindTransfers','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','toNumber','channelstate','debug','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','appdata','startsWith','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','applicationdata','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','disposition','lastdata','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','destinationchannel','UserId','membername','diff','connectedlinename','routealias','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s'];(function(_0x42c413,_0x467e80){var _0x47f333=function(_0x4055aa){while(--_0x4055aa){_0x42c413['push'](_0x42c413['shift']());}};_0x47f333(++_0x467e80);}(_0xc092,0x122));var _0x2c09=function(_0x33fd25,_0x58d8e1){_0x33fd25=_0x33fd25-0x0;var _0x7a121=_0xc092[_0x33fd25];return _0x7a121;};'use strict';var _=require(_0x2c09('0x0'));var moment=require(_0x2c09('0x1'));var util=require(_0x2c09('0x2'));var path=require('path');var Redis=require('ioredis');var config=require(_0x2c09('0x3'));var logger=require('../../../config/logger')(_0x2c09('0x4'));var ami=require(_0x2c09('0x5'));var Channel=require(_0x2c09('0x6'));var RpcSetting=require('../rpc/setting');var applications=[_0x2c09('0x7'),_0x2c09('0x8'),_0x2c09('0x9'),_0x2c09('0xa'),_0x2c09('0xb'),_0x2c09('0xc')];var dispositions=[_0x2c09('0xd'),_0x2c09('0xe'),_0x2c09('0xe'),'NO\x20ANSWER',_0x2c09('0xd'),_0x2c09('0xd'),_0x2c09('0xf'),'BUSY',_0x2c09('0xe'),_0x2c09('0xe'),_0x2c09('0xe')];config[_0x2c09('0x10')]=_['defaults'](config[_0x2c09('0x10')],{'host':_0x2c09('0x11'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2c09('0x10')]));function VoiceCallReport(_0xb4aec2){this[_0x2c09('0x12')]=_0xb4aec2[_0x2c09('0x12')];this[_0x2c09('0x13')]=_0xb4aec2[_0x2c09('0x13')];this['blindTransfers']={};ami['on']('coreshowchannel',this[_0x2c09('0x14')][_0x2c09('0x15')](this));ami['on'](_0x2c09('0x16'),this[_0x2c09('0x14')][_0x2c09('0x15')](this));ami['on'](_0x2c09('0x17'),this[_0x2c09('0x18')][_0x2c09('0x15')](this));ami['on'](_0x2c09('0x19'),this[_0x2c09('0x1a')][_0x2c09('0x15')](this));ami['on'](_0x2c09('0x1b'),this['syncVarSet'][_0x2c09('0x15')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on']('newcallerid',this['syncNewCallerId'][_0x2c09('0x15')](this));ami['on'](_0x2c09('0x1c'),this['syncAttendedTransfer'][_0x2c09('0x15')](this));ami['on'](_0x2c09('0x1d'),this[_0x2c09('0x1e')][_0x2c09('0x15')](this));ami['on']('musiconholdstart',this[_0x2c09('0x1f')][_0x2c09('0x15')](this));ami['on'](_0x2c09('0x20'),this[_0x2c09('0x21')][_0x2c09('0x15')](this));try{logger['info'](_0x2c09('0x22'));ami[_0x2c09('0x23')]();}catch(_0x6e1491){logger[_0x2c09('0x24')](_0x2c09('0x25'),util[_0x2c09('0x26')](_0x6e1491,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x2c09('0x27')][_0x2c09('0x28')]=function(_0x420420){return _0x420420!==null&&!_['isUndefined'](_0x420420);};VoiceCallReport[_0x2c09('0x27')][_0x2c09('0x29')]=function(_0x3e8dc5,_0x40e5dc,_0x1e4c44){io['to'](_0x3e8dc5)[_0x2c09('0x29')](_0x40e5dc,_0x1e4c44);};VoiceCallReport[_0x2c09('0x27')][_0x2c09('0x2a')]=function(_0x2a3c9d){try{if(this[_0x2c09('0x28')](_0x2a3c9d)){logger[_0x2c09('0x2b')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x2a3c9d[_0x2c09('0x2c')],_0x2a3c9d[_0x2c09('0x2d')],_0x2a3c9d[_0x2c09('0x2e')]);logger['debug'](_0x2c09('0x2f'),_0x2a3c9d['uniqueid'],util[_0x2c09('0x26')](_0x2a3c9d,{'showHidden':![],'depth':null}));if(_0x2a3c9d[_0x2c09('0x2c')]===_0x2a3c9d[_0x2c09('0x30')]){if(!_[_0x2c09('0x31')](this['channels'][_0x2a3c9d['uniqueid']])){_[_0x2c09('0x32')](this[_0x2c09('0x12')][_0x2a3c9d['uniqueid']],_[_0x2c09('0x33')](_0x2a3c9d,_[_0x2c09('0x34')](this[_0x2c09('0x12')][_0x2a3c9d[_0x2c09('0x2c')]])));}}if(_0x2a3c9d[_0x2c09('0x35')]===_0x2c09('0x36')){if(this[_0x2c09('0x13')][_0x2a3c9d[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]]){if(_0x2a3c9d[_0x2c09('0x39')]==_0x2c09('0x3a')){this[_0x2c09('0x13')][_0x2a3c9d['channel'][_0x2c09('0x38')]('-')[0x0]][_0x2c09('0x3b')]=_0x2a3c9d[_0x2c09('0x3c')];this[_0x2c09('0x29')](util[_0x2c09('0x3d')](_0x2c09('0x3e'),this['agents'][_0x2a3c9d[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]][_0x2c09('0x3f')]),_0x2c09('0x40'),{'destaccountcode':this[_0x2c09('0x13')][_0x2a3c9d['channel'][_0x2c09('0x38')]('-')[0x0]][_0x2c09('0x41')],'destconnectedlinenum':_0x2a3c9d[_0x2c09('0x3c')]});}}}}}catch(_0x21eddb){logger[_0x2c09('0x24')](_0x2c09('0x42'),_0x2a3c9d[_0x2c09('0x2c')],util[_0x2c09('0x26')](_0x21eddb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2c09('0x27')][_0x2c09('0x18')]=function(_0x1da051){try{if(this[_0x2c09('0x28')](_0x1da051)){logger['debug'](_0x2c09('0x43'),_0x1da051[_0x2c09('0x2c')],util[_0x2c09('0x26')](_0x1da051,{'showHidden':![],'depth':null}));if(this['channels'][_0x1da051[_0x2c09('0x2c')]])return;if(_0x1da051[_0x2c09('0x37')]==='OutgoingSpoolFailed')return;if(_0x1da051[_0x2c09('0x2c')]!==_0x1da051['linkedid']&&!this[_0x2c09('0x44')][_0x1da051[_0x2c09('0x30')]])return;logger[_0x2c09('0x2b')](_0x2c09('0x45'),_0x1da051[_0x2c09('0x2c')],_0x1da051[_0x2c09('0x35')],_0x1da051[_0x2c09('0x39')]);this[_0x2c09('0x12')][_0x1da051['uniqueid']]=new Channel();this['channels'][_0x1da051[_0x2c09('0x2c')]][_0x2c09('0x46')]=moment()[_0x2c09('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1da051[_0x2c09('0x2c')]]['disposition']=dispositions[_[_0x2c09('0x47')](_0x1da051[_0x2c09('0x48')])];_[_0x2c09('0x32')](this[_0x2c09('0x12')][_0x1da051[_0x2c09('0x2c')]],_[_0x2c09('0x33')](_0x1da051,_[_0x2c09('0x34')](this['channels'][_0x1da051[_0x2c09('0x2c')]])));if(_0x1da051[_0x2c09('0x35')]===_0x2c09('0x36')){if(this[_0x2c09('0x13')][_0x1da051['channel'][_0x2c09('0x38')]('-')[0x0]]){if(_['isUndefined'](this[_0x2c09('0x13')][_0x1da051['channel'][_0x2c09('0x38')]('-')[0x0]]['destconnectedlinenum'])){this[_0x2c09('0x13')][_0x1da051['channel'][_0x2c09('0x38')]('-')[0x0]][_0x2c09('0x3b')]=_0x1da051['exten'];logger[_0x2c09('0x49')](_0x2c09('0x4a'),_0x1da051['uniqueid'],util[_0x2c09('0x26')]({'id':this[_0x2c09('0x13')][_0x1da051[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]]['id'],'destaccountcode':this[_0x2c09('0x13')][_0x1da051[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]][_0x2c09('0x41')],'destconnectedlinenum':_0x1da051[_0x2c09('0x39')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x2c09('0x3e'),this[_0x2c09('0x13')][_0x1da051[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]]['name']),_0x2c09('0x40'),{'id':this[_0x2c09('0x13')][_0x1da051[_0x2c09('0x37')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x2c09('0x13')][_0x1da051['channel'][_0x2c09('0x38')]('-')[0x0]][_0x2c09('0x41')],'destconnectedlinenum':_0x1da051['exten']});}}}}}catch(_0x22c134){logger[_0x2c09('0x24')](_0x2c09('0x4b'),_0x1da051[_0x2c09('0x2c')],util[_0x2c09('0x26')](_0x22c134,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2c09('0x27')][_0x2c09('0x14')]=function(_0x596cbc){try{if(this['isNotNull'](_0x596cbc)){logger[_0x2c09('0x49')](_0x2c09('0x4c'),_0x596cbc[_0x2c09('0x2c')],util['inspect'](_0x596cbc,{'showHidden':![],'depth':null}));if(_0x596cbc[_0x2c09('0x37')]===_0x2c09('0x4d')||_0x596cbc[_0x2c09('0x39')]==='h')return;if(_0x596cbc['uniqueid']===_0x596cbc['linkedid']||this[_0x2c09('0x44')][_0x596cbc[_0x2c09('0x30')]]){_0x596cbc[_0x2c09('0x4e')]=_0x596cbc[_0x2c09('0x4e')][_0x2c09('0x4f')]();_0x596cbc['applicationdata']=_0x596cbc[_0x2c09('0x50')]&&_0x596cbc['appdata'][_0x2c09('0x51')]('CDR(routeAlias)')?_0x596cbc['appdata']:(_0x596cbc[_0x2c09('0x50')]||_0x596cbc['applicationdata'])['toLowerCase']();logger[_0x2c09('0x2b')](_0x2c09('0x52'),_0x596cbc['uniqueid'],_0x596cbc['application'],_0x596cbc[_0x2c09('0x53')]);if(_[_0x2c09('0x31')](this[_0x2c09('0x12')][_0x596cbc[_0x2c09('0x2c')]])){this[_0x2c09('0x12')][_0x596cbc['uniqueid']]=new Channel();this['channels'][_0x596cbc[_0x2c09('0x2c')]][_0x2c09('0x46')]=_0x596cbc[_0x2c09('0x54')]?moment()[_0x2c09('0x55')](moment[_0x2c09('0x54')](_0x596cbc[_0x2c09('0x54')])[_0x2c09('0x56')](),'seconds')[_0x2c09('0x3d')](_0x2c09('0x57')):moment()[_0x2c09('0x3d')](_0x2c09('0x57'));this[_0x2c09('0x12')][_0x596cbc[_0x2c09('0x2c')]][_0x2c09('0x58')]=_0x2c09('0xd');}_[_0x2c09('0x32')](this[_0x2c09('0x12')][_0x596cbc[_0x2c09('0x2c')]],_['pick'](_0x596cbc,_[_0x2c09('0x34')](this[_0x2c09('0x12')][_0x596cbc[_0x2c09('0x2c')]])));if(_['includes'](applications,_0x596cbc[_0x2c09('0x4e')])){this[_0x2c09('0x12')][_0x596cbc[_0x2c09('0x2c')]]['lastapplication']=_0x596cbc[_0x2c09('0x4e')];this[_0x2c09('0x12')][_0x596cbc[_0x2c09('0x2c')]][_0x2c09('0x59')]=_0x596cbc['applicationdata'];if(_0x596cbc[_0x2c09('0x4e')]===_0x2c09('0x7')&&_[_0x2c09('0x51')](_0x596cbc[_0x2c09('0x53')][_0x2c09('0x4f')](),_0x2c09('0x5a'))){var _0x190ef2=_0x596cbc[_0x2c09('0x53')]['split']('=');var _0x2a286e=_0x190ef2[0x0][_0x2c09('0x4f')]()[_0x2c09('0x5b')](/cdr\((.*)\)/);if(_0x2a286e){if(_0x2a286e[0x1]===_0x2c09('0x5c')&&!_[_0x2c09('0x5d')](this[_0x2c09('0x12')][_0x596cbc['uniqueid']][_0x2a286e[0x1]]))return;this[_0x2c09('0x12')][_0x596cbc[_0x2c09('0x2c')]][_0x2a286e[0x1]]=_0x190ef2[0x1];}}else if(_0x596cbc[_0x2c09('0x4e')]===_0x2c09('0x8')){this['channels'][_0x596cbc[_0x2c09('0x2c')]][_0x2c09('0x8')]=_0x596cbc['applicationdata'][_0x2c09('0x38')](',')[0x0];}}}}}catch(_0x4624ab){logger[_0x2c09('0x24')](_0x2c09('0x5e'),_0x596cbc[_0x2c09('0x2c')],util[_0x2c09('0x26')](_0x4624ab,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2c09('0x27')][_0x2c09('0x1a')]=function(_0x229292){try{if(this[_0x2c09('0x28')](_0x229292)){logger[_0x2c09('0x2b')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x229292[_0x2c09('0x2c')],_0x229292[_0x2c09('0x30')],_0x229292[_0x2c09('0x2d')],_0x229292[_0x2c09('0x2e')]);logger[_0x2c09('0x49')](_0x2c09('0x5f'),_0x229292[_0x2c09('0x2c')],util['inspect'](_0x229292,{'showHidden':![],'depth':null}));if(_0x229292[_0x2c09('0x48')]!=='6')return;if(_0x229292[_0x2c09('0x2c')]!==_0x229292[_0x2c09('0x30')]){var _0x40884c=moment();if(this['channels'][_0x229292[_0x2c09('0x30')]]){if(!this[_0x2c09('0x12')][_0x229292['linkedid']][_0x2c09('0x60')]){this[_0x2c09('0x12')][_0x229292['linkedid']][_0x2c09('0x60')]=!![];this[_0x2c09('0x12')][_0x229292[_0x2c09('0x30')]][_0x2c09('0x61')]=_0x40884c['format']('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x229292['linkedid']][_0x2c09('0x46')]){this[_0x2c09('0x12')][_0x229292[_0x2c09('0x30')]][_0x2c09('0x62')]=_0x40884c['diff'](this[_0x2c09('0x12')][_0x229292[_0x2c09('0x30')]][_0x2c09('0x46')],_0x2c09('0x56'));}}this[_0x2c09('0x12')][_0x229292['linkedid']]['linkedid']=_0x229292[_0x2c09('0x2c')];if(_0x229292[_0x2c09('0x2e')]!=='xcally-motion-preview'){this['channels'][_0x229292[_0x2c09('0x30')]][_0x2c09('0x3c')]=_0x229292[_0x2c09('0x2e')];}this[_0x2c09('0x12')][_0x229292[_0x2c09('0x30')]]['connectedlinename']=_0x229292[_0x2c09('0x2d')];this['channels'][_0x229292[_0x2c09('0x30')]][_0x2c09('0x63')]=_0x229292['channel'];this[_0x2c09('0x12')][_0x229292[_0x2c09('0x30')]][_0x2c09('0x58')]=dispositions[_['toNumber'](_0x229292[_0x2c09('0x48')])];if(this[_0x2c09('0x13')][_0x229292[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]]){this[_0x2c09('0x12')][_0x229292[_0x2c09('0x30')]][_0x2c09('0x64')]=this['agents'][_0x229292[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]]['id'];this[_0x2c09('0x12')][_0x229292[_0x2c09('0x30')]][_0x2c09('0x65')]=this[_0x2c09('0x13')][_0x229292[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]][_0x2c09('0x3f')];}}if(this[_0x2c09('0x12')][_0x229292[_0x2c09('0x2c')]]){if(!this[_0x2c09('0x12')][_0x229292[_0x2c09('0x2c')]][_0x2c09('0x60')]){this[_0x2c09('0x12')][_0x229292['uniqueid']]['answered']=!![];this[_0x2c09('0x12')][_0x229292['uniqueid']][_0x2c09('0x61')]=_0x40884c['format'](_0x2c09('0x57'));if(this[_0x2c09('0x12')][_0x229292[_0x2c09('0x2c')]][_0x2c09('0x46')]){this[_0x2c09('0x12')][_0x229292[_0x2c09('0x2c')]][_0x2c09('0x62')]=_0x40884c[_0x2c09('0x66')](this['channels'][_0x229292[_0x2c09('0x2c')]][_0x2c09('0x46')],_0x2c09('0x56'));}}if(_0x229292[_0x2c09('0x2e')]!==_0x2c09('0x3a')){this[_0x2c09('0x12')][_0x229292['uniqueid']][_0x2c09('0x3c')]=_0x229292[_0x2c09('0x2e')];}this[_0x2c09('0x12')][_0x229292['uniqueid']][_0x2c09('0x67')]=_0x229292[_0x2c09('0x2d')];this[_0x2c09('0x12')][_0x229292[_0x2c09('0x2c')]][_0x2c09('0x63')]=_0x229292[_0x2c09('0x37')];this['channels'][_0x229292[_0x2c09('0x2c')]][_0x2c09('0x58')]=dispositions[_[_0x2c09('0x47')](_0x229292[_0x2c09('0x48')])];}}else{if(this[_0x2c09('0x12')][_0x229292[_0x2c09('0x2c')]]){if(this[_0x2c09('0x13')][_0x229292[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]]){this[_0x2c09('0x12')][_0x229292[_0x2c09('0x2c')]][_0x2c09('0x64')]=this[_0x2c09('0x13')][_0x229292['channel'][_0x2c09('0x38')]('-')[0x0]]['id'];this[_0x2c09('0x12')][_0x229292[_0x2c09('0x2c')]][_0x2c09('0x65')]=this['agents'][_0x229292[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]][_0x2c09('0x3f')];}}}if(_0x229292[_0x2c09('0x35')]===_0x2c09('0x36')){if(this[_0x2c09('0x13')][_0x229292['channel'][_0x2c09('0x38')]('-')[0x0]]){this[_0x2c09('0x13')][_0x229292['channel'][_0x2c09('0x38')]('-')[0x0]][_0x2c09('0x3b')]=_0x229292[_0x2c09('0x39')];var _0x4883ba,_0x46e50f;if(this[_0x2c09('0x12')][_0x229292[_0x2c09('0x2c')]]){_0x4883ba=this['channels'][_0x229292[_0x2c09('0x2c')]][_0x2c09('0x68')];_0x46e50f=this['channels'][_0x229292[_0x2c09('0x2c')]][_0x2c09('0x8')];}else if(this[_0x2c09('0x12')][_0x229292[_0x2c09('0x30')]]){_0x4883ba=this['channels'][_0x229292[_0x2c09('0x30')]][_0x2c09('0x68')];_0x46e50f=this[_0x2c09('0x12')][_0x229292[_0x2c09('0x30')]][_0x2c09('0x8')];}logger[_0x2c09('0x49')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x229292[_0x2c09('0x2c')],util[_0x2c09('0x26')]({'id':this[_0x2c09('0x13')][_0x229292[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]]['id'],'destaccountcode':this[_0x2c09('0x13')][_0x229292[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]][_0x2c09('0x41')],'destconnectedlinenum':_0x229292['exten'],'routealias':_0x4883ba,'queue':_0x46e50f||undefined},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x2c09('0x3e'),this[_0x2c09('0x13')][_0x229292['channel']['split']('-')[0x0]][_0x2c09('0x3f')]),_0x2c09('0x40'),{'id':this[_0x2c09('0x13')][_0x229292[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this['agents'][_0x229292['channel'][_0x2c09('0x38')]('-')[0x0]][_0x2c09('0x41')],'destconnectedlinenum':_0x229292[_0x2c09('0x39')],'routealias':_0x4883ba,'queue':_0x46e50f||undefined});}}}}catch(_0xed15b5){logger[_0x2c09('0x24')](_0x2c09('0x69'),_0x229292['uniqueid'],util[_0x2c09('0x26')](_0xed15b5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2c09('0x27')][_0x2c09('0x6a')]=function(_0x5b5382,_0x3ae853){try{if(this[_0x2c09('0x12')][_0x5b5382]){logger[_0x2c09('0x2b')](_0x2c09('0x6b'),_0x5b5382,_0x3ae853);this[_0x2c09('0x12')][_0x5b5382][_0x2c09('0x6c')]=!![];if(_['endsWith'](_0x3ae853,_0x2c09('0x6d'))){_0x3ae853=_0x3ae853['replace']('.wav49',_0x2c09('0x6e'));}this[_0x2c09('0x12')][_0x5b5382][_0x2c09('0x6f')]=_0x3ae853;var _0x2a0557=_[_0x2c09('0x70')](this[_0x2c09('0x12')][_0x5b5382]['monitors'],{'filename':_0x3ae853});if(_[_0x2c09('0x5d')](_0x2a0557)){this[_0x2c09('0x12')][_0x5b5382]['monitors'][_0x2c09('0x71')]({'filename':_0x3ae853,'createdAt':moment()[_0x2c09('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x2c09('0x72')});}}}catch(_0x1e3609){logger[_0x2c09('0x24')](_0x2c09('0x73'),_0x5b5382,util[_0x2c09('0x26')](_0x1e3609,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2c09('0x27')][_0x2c09('0x74')]=function(_0xf9eb51){try{if(this[_0x2c09('0x28')](_0xf9eb51)){logger['debug'](_0x2c09('0x75'),_0xf9eb51['uniqueid'],util[_0x2c09('0x26')](_0xf9eb51,{'showHidden':![],'depth':null}));if(this[_0x2c09('0x12')][_0xf9eb51['uniqueid']]&&_0xf9eb51[_0x2c09('0x37')]!='OutgoingSpoolFailed'){if(this[_0x2c09('0x28')](_0xf9eb51[_0x2c09('0x76')])){if(this[_0x2c09('0x28')](_0xf9eb51[_0x2c09('0x76')][_0x2c09('0x77')])){logger[_0x2c09('0x2b')](_0x2c09('0x78'),_0xf9eb51[_0x2c09('0x2c')],_0xf9eb51['value']);this[_0x2c09('0x6a')](_0xf9eb51['uniqueid'],_0xf9eb51[_0x2c09('0x79')]);}else if(this['isNotNull'](_0xf9eb51[_0x2c09('0x76')][_0x2c09('0x7a')])){logger['info'](_0x2c09('0x7b'),_0xf9eb51[_0x2c09('0x2c')],_0xf9eb51[_0x2c09('0x79')]);this[_0x2c09('0x12')][_0xf9eb51[_0x2c09('0x2c')]][_0x2c09('0x2e')]=_0xf9eb51[_0x2c09('0x79')];}else if(this[_0x2c09('0x28')](_0xf9eb51[_0x2c09('0x76')][_0x2c09('0x7c')])){logger[_0x2c09('0x2b')](_0x2c09('0x7d'),_0xf9eb51[_0x2c09('0x2c')],_0xf9eb51[_0x2c09('0x79')]);this[_0x2c09('0x12')][_0xf9eb51['uniqueid']][_0x2c09('0x7e')]=_0xf9eb51[_0x2c09('0x79')];}else if(this[_0x2c09('0x28')](_0xf9eb51[_0x2c09('0x76')][_0x2c09('0x7f')])){logger[_0x2c09('0x2b')](_0x2c09('0x80'),_0xf9eb51[_0x2c09('0x2c')],_0xf9eb51[_0x2c09('0x79')]);this[_0x2c09('0x12')][_0xf9eb51[_0x2c09('0x2c')]][_0x2c09('0x5c')]=_0xf9eb51['value'];}else if(this[_0x2c09('0x28')](_0xf9eb51[_0x2c09('0x76')][_0x2c09('0x81')])){logger['info'](_0x2c09('0x82'),_0xf9eb51[_0x2c09('0x2c')],_0xf9eb51[_0x2c09('0x79')]['split'](',')[0x0]);this['channels'][_0xf9eb51['uniqueid']][_0x2c09('0x8')]=_0xf9eb51[_0x2c09('0x79')][_0x2c09('0x38')](',')[0x0];}else if(this[_0x2c09('0x28')](_0xf9eb51[_0x2c09('0x76')][_0x2c09('0x83')])){logger[_0x2c09('0x2b')](_0x2c09('0x84'),_0xf9eb51[_0x2c09('0x2c')],_0xf9eb51[_0x2c09('0x79')]);this[_0x2c09('0x12')][_0xf9eb51[_0x2c09('0x2c')]][_0x2c09('0x85')]=_0xf9eb51['value'];}else if(this[_0x2c09('0x28')](_0xf9eb51[_0x2c09('0x76')]['xmd-destination'])){logger['info'](_0x2c09('0x86'),_0xf9eb51[_0x2c09('0x2c')],_0xf9eb51[_0x2c09('0x79')]);this['channels'][_0xf9eb51[_0x2c09('0x2c')]][_0x2c09('0x87')]=_0xf9eb51[_0x2c09('0x79')];}else if(this['isNotNull'](_0xf9eb51[_0x2c09('0x76')][_0x2c09('0x88')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0xf9eb51[_0x2c09('0x2c')],_0xf9eb51[_0x2c09('0x79')]);this[_0x2c09('0x12')][_0xf9eb51['uniqueid']][_0x2c09('0x89')]=_0xf9eb51[_0x2c09('0x79')];}else if(this[_0x2c09('0x28')](_0xf9eb51['variable'][_0x2c09('0x8a')])){logger['info'](_0x2c09('0x8b'),_0xf9eb51['uniqueid'],_0xf9eb51[_0x2c09('0x79')]);this[_0x2c09('0x12')][_0xf9eb51[_0x2c09('0x2c')]][_0x2c09('0x8')]=_0xf9eb51[_0x2c09('0x79')];}else if(this['isNotNull'](_0xf9eb51[_0x2c09('0x76')]['sipcallid'])){logger[_0x2c09('0x2b')](_0x2c09('0x8c'),_0xf9eb51[_0x2c09('0x2c')],_0xf9eb51[_0x2c09('0x79')]);this['channels'][_0xf9eb51[_0x2c09('0x2c')]][_0x2c09('0x8d')]=_0xf9eb51[_0x2c09('0x79')];}}}else if(this['isNotNull'](_0xf9eb51[_0x2c09('0x76')][_0x2c09('0x77')])){if(_0xf9eb51[_0x2c09('0x79')]){var _0x78cd09=path[_0x2c09('0x8e')](_0xf9eb51['value'])['name'];logger[_0x2c09('0x2b')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x78cd09,_0xf9eb51[_0x2c09('0x79')]);this[_0x2c09('0x6a')](_0x78cd09,_0xf9eb51[_0x2c09('0x79')]);}}else if(this[_0x2c09('0x12')][_0xf9eb51['linkedid']]){if(this[_0x2c09('0x28')](_0xf9eb51[_0x2c09('0x76')])){if(this[_0x2c09('0x28')](_0xf9eb51[_0x2c09('0x76')][_0x2c09('0x8f')])){logger['info'](_0x2c09('0x8c'),_0xf9eb51[_0x2c09('0x30')],_0xf9eb51[_0x2c09('0x79')]);this[_0x2c09('0x12')][_0xf9eb51[_0x2c09('0x30')]][_0x2c09('0x90')]=_0xf9eb51[_0x2c09('0x79')];}}}}}catch(_0x1fb38b){logger[_0x2c09('0x24')]('[%s][voiceCallReport][varset]',_0xf9eb51[_0x2c09('0x2c')],util[_0x2c09('0x26')](_0x1fb38b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2c09('0x27')][_0x2c09('0x91')]=function(_0x2aca8f){try{if(this[_0x2c09('0x28')](_0x2aca8f)){logger[_0x2c09('0x49')](_0x2c09('0x92'),_0x2aca8f[_0x2c09('0x2c')],util[_0x2c09('0x26')](_0x2aca8f,{'showHidden':![],'depth':null}));if(this[_0x2c09('0x44')][_0x2aca8f[_0x2c09('0x30')]]){if(this[_0x2c09('0x12')][this[_0x2c09('0x44')][_0x2aca8f[_0x2c09('0x30')]][_0x2c09('0x30')]]){this[_0x2c09('0x12')][this['blindTransfers'][_0x2aca8f[_0x2c09('0x30')]][_0x2c09('0x30')]]['uniqueid']=_0x2aca8f[_0x2c09('0x2c')];this[_0x2c09('0x12')][this[_0x2c09('0x44')][_0x2aca8f[_0x2c09('0x30')]][_0x2c09('0x30')]][_0x2c09('0x60')]=this[_0x2c09('0x12')][_0x2aca8f['uniqueid']][_0x2c09('0x60')];this[_0x2c09('0x12')][this['blindTransfers'][_0x2aca8f['linkedid']][_0x2c09('0x30')]][_0x2c09('0x61')]=this[_0x2c09('0x12')][_0x2aca8f[_0x2c09('0x2c')]]['answertime'];this[_0x2c09('0x12')][this[_0x2c09('0x44')][_0x2aca8f[_0x2c09('0x30')]]['linkedid']][_0x2c09('0x63')]=this[_0x2c09('0x12')][this[_0x2c09('0x44')][_0x2aca8f[_0x2c09('0x30')]][_0x2c09('0x30')]]['channel'];this['channels'][this[_0x2c09('0x44')][_0x2aca8f[_0x2c09('0x30')]][_0x2c09('0x30')]][_0x2c09('0x58')]=this[_0x2c09('0x12')][_0x2aca8f[_0x2c09('0x2c')]][_0x2c09('0x58')];this['channels'][_0x2aca8f[_0x2c09('0x2c')]]=this[_0x2c09('0x12')][this[_0x2c09('0x44')][_0x2aca8f['linkedid']][_0x2c09('0x30')]];delete this['channels'][this[_0x2c09('0x44')][_0x2aca8f['linkedid']]['linkedid']];}else if(this[_0x2c09('0x12')][this[_0x2c09('0x44')][_0x2aca8f[_0x2c09('0x30')]][_0x2c09('0x2c')]]){this[_0x2c09('0x12')][this[_0x2c09('0x44')][_0x2aca8f[_0x2c09('0x30')]][_0x2c09('0x2c')]][_0x2c09('0x2c')]=[this[_0x2c09('0x12')][this['blindTransfers'][_0x2aca8f[_0x2c09('0x30')]][_0x2c09('0x2c')]][_0x2c09('0x30')],this[_0x2c09('0x12')][this[_0x2c09('0x44')][_0x2aca8f['linkedid']][_0x2c09('0x2c')]]['linkedid']=this[_0x2c09('0x12')][this[_0x2c09('0x44')][_0x2aca8f[_0x2c09('0x30')]]['uniqueid']][_0x2c09('0x2c')]][0x0];this[_0x2c09('0x12')][this[_0x2c09('0x44')][_0x2aca8f[_0x2c09('0x30')]][_0x2c09('0x2c')]][_0x2c09('0x60')]=this[_0x2c09('0x12')][_0x2aca8f[_0x2c09('0x2c')]][_0x2c09('0x60')];this[_0x2c09('0x12')][this['blindTransfers'][_0x2aca8f[_0x2c09('0x30')]][_0x2c09('0x2c')]][_0x2c09('0x61')]=this[_0x2c09('0x12')][_0x2aca8f[_0x2c09('0x2c')]][_0x2c09('0x61')];this[_0x2c09('0x12')][this['blindTransfers'][_0x2aca8f[_0x2c09('0x30')]]['uniqueid']]['destinationchannel']=this['channels'][this[_0x2c09('0x44')][_0x2aca8f['linkedid']][_0x2c09('0x2c')]][_0x2c09('0x37')];this[_0x2c09('0x12')][this[_0x2c09('0x44')][_0x2aca8f[_0x2c09('0x30')]][_0x2c09('0x2c')]][_0x2c09('0x58')]=this[_0x2c09('0x12')][_0x2aca8f['uniqueid']][_0x2c09('0x58')];this['channels'][_0x2aca8f[_0x2c09('0x2c')]]=this[_0x2c09('0x12')][this['blindTransfers'][_0x2aca8f[_0x2c09('0x30')]][_0x2c09('0x2c')]];delete this[_0x2c09('0x12')][this[_0x2c09('0x44')][_0x2aca8f[_0x2c09('0x30')]][_0x2c09('0x2c')]];}}if(this[_0x2c09('0x12')][_0x2aca8f[_0x2c09('0x2c')]]){logger['info'](_0x2c09('0x93'),_0x2aca8f[_0x2c09('0x2c')],_0x2aca8f[_0x2c09('0x94')]);var _0x4d8139=moment();this['channels'][_0x2aca8f[_0x2c09('0x2c')]][_0x2c09('0x95')]=_0x4d8139['format'](_0x2c09('0x57'));this['channels'][_0x2aca8f['uniqueid']][_0x2c09('0x54')]=_0x4d8139[_0x2c09('0x66')](this[_0x2c09('0x12')][_0x2aca8f['uniqueid']][_0x2c09('0x46')],_0x2c09('0x56'));if(this[_0x2c09('0x12')][_0x2aca8f[_0x2c09('0x2c')]]['answered']){this[_0x2c09('0x12')][_0x2aca8f[_0x2c09('0x2c')]]['billableseconds']=_0x4d8139[_0x2c09('0x66')](this[_0x2c09('0x12')][_0x2aca8f['uniqueid']]['answertime'],_0x2c09('0x56'));this[_0x2c09('0x12')][_0x2aca8f['uniqueid']][_0x2c09('0x62')]=this['channels'][_0x2aca8f[_0x2c09('0x2c')]][_0x2c09('0x54')]-this[_0x2c09('0x12')][_0x2aca8f['uniqueid']]['billableseconds'];}if(_0x2aca8f[_0x2c09('0x35')]===_0x2c09('0x36')){if(this[_0x2c09('0x13')][_0x2aca8f[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]]){this['agents'][_0x2aca8f[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]]=_['omit'](this['agents'][_0x2aca8f['channel'][_0x2c09('0x38')]('-')[0x0]],['destconnectedlinenum']);logger[_0x2c09('0x49')](_0x2c09('0x96'),_0x2aca8f['uniqueid'],util[_0x2c09('0x26')]({'id':this[_0x2c09('0x13')][_0x2aca8f['channel'][_0x2c09('0x38')]('-')[0x0]]['id'],'destaccountcode':this[_0x2c09('0x13')][_0x2aca8f[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x2c09('0x29')](util[_0x2c09('0x3d')](_0x2c09('0x3e'),this[_0x2c09('0x13')][_0x2aca8f[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]]['name']),'user:agentcomplete',{'id':this[_0x2c09('0x13')][_0x2aca8f['channel'][_0x2c09('0x38')]('-')[0x0]]['id'],'destaccountcode':this[_0x2c09('0x13')][_0x2aca8f[_0x2c09('0x37')][_0x2c09('0x38')]('-')[0x0]][_0x2c09('0x41')]});for(var _0x3ab2a1=0x0;_0x3ab2a10x0?_0x557f55:0x0;this[_0xfe5f('0x40')][_0x36a364['queue']][_0xfe5f('0x30')]=this[_0xfe5f('0x40')][_0x36a364[_0xfe5f('0x6b')]]['talking']>_[_0xfe5f('0x6f')](_0x36a364[_0xfe5f('0x70')])?_['toNumber'](_0x36a364['loggedin']):this[_0xfe5f('0x40')][_0x36a364[_0xfe5f('0x6b')]]['talking'];this[_0xfe5f('0x4e')](this[_0xfe5f('0x40')][_0x36a364[_0xfe5f('0x6b')]],_0xfe5f('0x15'));}logger['debug'](_0xfe5f('0x71'),util['inspect'](this['voiceQueues'][_0x36a364[_0xfe5f('0x6b')]],{'showHidden':![],'depth':null}));ami[_0xfe5f('0x43')](_0xfe5f('0x72'),this[_0xfe5f('0x40')][_0x36a364['queue']]);}}}catch(_0x11beb7){logger[_0xfe5f('0x3b')](_0xfe5f('0x6a'),util['inspect'](_0x11beb7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfe5f('0x73')]=function(_0x7ddec0){logger[_0xfe5f('0x5f')](_0xfe5f('0x74'),util[_0xfe5f('0x3d')](_0x7ddec0,{'showHidden':![],'depth':null}));this[_0xfe5f('0x69')]=!![];};VoiceQueueReport[_0xfe5f('0x33')]['syncQueueCallerJoin']=function(_0x366d58){try{if(this['isNotNull'](_0x366d58)){logger[_0xfe5f('0x5f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x366d58[_0xfe5f('0x4a')],util[_0xfe5f('0x3d')](_0x366d58,{'showHidden':![],'depth':null}));if(_[_0xfe5f('0x75')](this['queueReports'][_0x366d58[_0xfe5f('0x4a')]]))this[_0xfe5f('0xf')][_0x366d58[_0xfe5f('0x4a')]]=[];if(_[_0xfe5f('0x75')](this[_0xfe5f('0x11')][_0x366d58[_0xfe5f('0x4a')]]))this[_0xfe5f('0x11')][_0x366d58[_0xfe5f('0x4a')]]={};var _0x27ae71=new QueueReport();_0x27ae71[_0xfe5f('0x46')]=_0x366d58[_0xfe5f('0x6b')];_0x27ae71[_0xfe5f('0x4f')]=this['voiceQueues'][_0x27ae71['name']]&&this[_0xfe5f('0x40')][_0x27ae71[_0xfe5f('0x46')]]['type']?this[_0xfe5f('0x40')][_0x27ae71['name']][_0xfe5f('0x4f')]||_0xfe5f('0x50'):_0xfe5f('0x50');_0x27ae71[_0xfe5f('0x6b')]=_0x366d58[_0xfe5f('0x6b')];_0x27ae71[_0xfe5f('0x76')]=moment()[_0xfe5f('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x27ae71[_0xfe5f('0x77')]=_0x366d58[_0xfe5f('0x77')];_0x27ae71[_0xfe5f('0x78')]=_0x366d58['count'];_0x27ae71[_0xfe5f('0x4a')]=_0x366d58[_0xfe5f('0x4a')];_0x27ae71[_0xfe5f('0x79')]=this[_0xfe5f('0x11')][_0x366d58[_0xfe5f('0x4a')]][_0xfe5f('0x79')];logger[_0xfe5f('0x6c')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x27ae71['name'],_0x27ae71[_0xfe5f('0x4f')]);_['merge'](_0x27ae71,_[_0xfe5f('0x7a')](_0x366d58,_[_0xfe5f('0x7b')](_0x27ae71)));this[_0xfe5f('0xf')][_0x366d58[_0xfe5f('0x4a')]][_0xfe5f('0x7c')](_0x27ae71);this[_0xfe5f('0x11')][_0x366d58[_0xfe5f('0x4a')]]=_0x27ae71;this['emitVoiceQueueChannelSave'](_0x27ae71,_0xfe5f('0x19'));}}catch(_0x109f59){logger[_0xfe5f('0x3b')](_0xfe5f('0x7d'),_0x366d58[_0xfe5f('0x4a')],util['inspect'](_0x109f59,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfe5f('0x33')][_0xfe5f('0x7e')]=function(_0x3070a5){try{if(this[_0xfe5f('0x63')](_0x3070a5)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x3070a5['uniqueid'],util[_0xfe5f('0x3d')](_0x3070a5,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3070a5[_0xfe5f('0x4a')]]){var _0x3c5921=_[_0xfe5f('0x7f')](this['queueReports'][_0x3070a5[_0xfe5f('0x4a')]]);_0x3c5921['queuecallercomplete']=![];_0x3c5921[_0xfe5f('0x80')]=null;_0x3c5921[_0xfe5f('0x81')]=_0x3070a5[_0xfe5f('0x81')];_0x3c5921[_0xfe5f('0x82')]=_0x3070a5[_0xfe5f('0x82')];_0x3c5921['queuecallerabandon']=!![];_0x3c5921[_0xfe5f('0x83')]=moment()[_0xfe5f('0x4b')](_0xfe5f('0x84'));_0x3c5921[_0xfe5f('0x85')]='ABANDONED';_0x3c5921[_0xfe5f('0x86')]=null;logger['info'](_0xfe5f('0x87'),_0x3c5921['name'],_0x3c5921[_0xfe5f('0x4f')]);this[_0xfe5f('0x11')][_0x3070a5[_0xfe5f('0x4a')]]=_0x3c5921;this[_0xfe5f('0x42')](_0x3c5921,_0xfe5f('0x1a'));}}}catch(_0x4ecdbb){logger['error'](_0xfe5f('0x88'),_0x3070a5[_0xfe5f('0x4a')],util[_0xfe5f('0x3d')](_0x4ecdbb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfe5f('0x33')][_0xfe5f('0x1c')]=function(_0x246722){try{if(this['isNotNull'](_0x246722)){logger['debug'](_0xfe5f('0x89'),_0x246722[_0xfe5f('0x4a')],util['inspect'](_0x246722,{'showHidden':![],'depth':null}));if(this[_0xfe5f('0xf')][_0x246722['uniqueid']]){var _0x4ab59d=_[_0xfe5f('0x7f')](this[_0xfe5f('0xf')][_0x246722[_0xfe5f('0x4a')]]);_0x4ab59d[_0xfe5f('0x8a')]=moment()[_0xfe5f('0x4b')](_0xfe5f('0x84'));_0x4ab59d[_0xfe5f('0x8b')]=_0x246722[_0xfe5f('0x8b')];_0x4ab59d[_0xfe5f('0x8c')]=_0x246722['connectedlinename'];logger[_0xfe5f('0x6c')](_0xfe5f('0x8d'),_0x4ab59d['name'],_0x4ab59d['type'],_0x246722[_0xfe5f('0x8b')],_0x246722[_0xfe5f('0x8c')]);this[_0xfe5f('0x11')][_0x246722[_0xfe5f('0x4a')]]=_0x4ab59d;this[_0xfe5f('0x44')](_0x4ab59d,_0xfe5f('0x1b'));}}}catch(_0x1fe3e6){logger[_0xfe5f('0x3b')](_0xfe5f('0x89'),_0x246722['uniqueid'],util[_0xfe5f('0x3d')](_0x1fe3e6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfe5f('0x33')]['syncAgentConnect']=function(_0x2b71b9){try{if(this[_0xfe5f('0x63')](_0x2b71b9)){logger[_0xfe5f('0x5f')](_0xfe5f('0x8e'),_0x2b71b9[_0xfe5f('0x4a')],util[_0xfe5f('0x3d')](_0x2b71b9,{'showHidden':![],'depth':null}));if(this[_0xfe5f('0xf')][_0x2b71b9[_0xfe5f('0x4a')]]){var _0x68bd5f=_[_0xfe5f('0x7f')](this[_0xfe5f('0xf')][_0x2b71b9[_0xfe5f('0x4a')]]);_0x68bd5f[_0xfe5f('0x8f')]=!![];_0x68bd5f['queuecallerexitreason']=_0xfe5f('0x90');logger[_0xfe5f('0x6c')](_0xfe5f('0x91'),_0x68bd5f['name'],_0x68bd5f[_0xfe5f('0x4f')]);}}}catch(_0x5249c8){logger[_0xfe5f('0x3b')](_0xfe5f('0x8e'),_0x2b71b9['uniqueid'],util[_0xfe5f('0x3d')](_0x5249c8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfe5f('0x33')]['syncAgentComplete']=function(_0x508d7c){try{if(this[_0xfe5f('0x63')](_0x508d7c)){logger[_0xfe5f('0x5f')](_0xfe5f('0x92'),_0x508d7c['uniqueid'],util[_0xfe5f('0x3d')](_0x508d7c,{'showHidden':![],'depth':null}));if(this[_0xfe5f('0xf')][_0x508d7c[_0xfe5f('0x4a')]]){var _0x4fe1af=_['last'](this[_0xfe5f('0xf')][_0x508d7c[_0xfe5f('0x4a')]]);_0x4fe1af['queuecallerabandon']=![];_0x4fe1af[_0xfe5f('0x83')]=null;_0x4fe1af['assigned']=!![];_0x4fe1af[_0xfe5f('0x86')]=_0x508d7c[_0xfe5f('0x93')];_0x4fe1af['holdtime']=_0x508d7c[_0xfe5f('0x81')];_0x4fe1af[_0xfe5f('0x8f')]=!![];_0x4fe1af[_0xfe5f('0x94')]=![];_0x4fe1af[_0xfe5f('0x95')]=null;if(!_0x4fe1af['transfer']){if(_0x508d7c[_0xfe5f('0x96')]==_0xfe5f('0x97')){_0x4fe1af['queuecallerexitreason']=_0xfe5f('0x98');logger[_0xfe5f('0x6c')](_0xfe5f('0x99'),_0x4fe1af[_0xfe5f('0x46')],_0x4fe1af[_0xfe5f('0x4f')]);}else{if(_['startsWith'](_0x508d7c[_0xfe5f('0x9a')]['toLowerCase'](),_0xfe5f('0x9b'))){if(this[_0xfe5f('0xf')][_0x508d7c['linkedid']]){var _0x40f45e=_['last'](this['queueReports'][_0x508d7c[_0xfe5f('0x9c')]]);_0x40f45e[_0xfe5f('0x8f')]=![];_0x40f45e[_0xfe5f('0x94')]=!![];_0x40f45e['queuecallerexitAt']=moment(_0x4fe1af[_0xfe5f('0x76')])['add'](_0x508d7c[_0xfe5f('0x81')],'seconds')['format'](_0xfe5f('0x84'));_0x40f45e['queuecallerexitreason']=_0xfe5f('0x9d');_0x40f45e[_0xfe5f('0x97')]=!![];_0x40f45e[_0xfe5f('0x9e')]=_0xfe5f('0x9f');_0x40f45e[_0xfe5f('0xa0')]=_0x508d7c[_0xfe5f('0xa1')];_0x40f45e[_0xfe5f('0xa2')]=_0x508d7c[_0xfe5f('0x4a')];logger[_0xfe5f('0x6c')](_0xfe5f('0xa3'),_0x40f45e['name'],_0x40f45e[_0xfe5f('0x4f')]);var _0x461431=this['queueReports'][_0x508d7c[_0xfe5f('0x9c')]];this[_0xfe5f('0xf')][_0x508d7c[_0xfe5f('0x9c')]]=this[_0xfe5f('0xf')][_0x508d7c[_0xfe5f('0x4a')]];this[_0xfe5f('0xf')][_0x508d7c[_0xfe5f('0x4a')]]=_0x461431;}}else{_0x4fe1af[_0xfe5f('0x85')]=_0xfe5f('0xa4')+_0x508d7c['reason'][_0xfe5f('0xa5')]();logger[_0xfe5f('0x6c')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x4fe1af[_0xfe5f('0x46')],_0x4fe1af[_0xfe5f('0x4f')],_0x4fe1af[_0xfe5f('0x85')]);}}}this[_0xfe5f('0x11')][_0x508d7c[_0xfe5f('0x4a')]]=_0x4fe1af;this[_0xfe5f('0x42')](_0x4fe1af,'agentcomplete');}}}catch(_0x154985){logger[_0xfe5f('0x3b')](_0xfe5f('0x92'),_0x508d7c[_0xfe5f('0x4a')],util[_0xfe5f('0x3d')](_0x154985,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfe5f('0x20')]=function(_0x1be5b0){try{if(this[_0xfe5f('0x63')](_0x1be5b0)){logger[_0xfe5f('0x5f')](_0xfe5f('0xa6'),_0x1be5b0[_0xfe5f('0x4a')],util[_0xfe5f('0x3d')](_0x1be5b0,{'showHidden':![],'depth':null}));this['addVariable'](_0x1be5b0['uniqueid'],_[_0xfe5f('0x7b')](_0x1be5b0['variable'])[0x0],_0x1be5b0[_0xfe5f('0xa7')]);if(this[_0xfe5f('0xf')][_0x1be5b0['uniqueid']]){var _0x1dbbdc=_[_0xfe5f('0x7f')](this['queueReports'][_0x1be5b0[_0xfe5f('0x4a')]]);if(_0x1dbbdc){if(this[_0xfe5f('0x63')](_0x1be5b0[_0xfe5f('0xa8')])&&this[_0xfe5f('0x63')](_0x1be5b0[_0xfe5f('0xa8')]['queuestatus'])){switch(_0x1be5b0[_0xfe5f('0xa7')]){case _0xfe5f('0xa9'):_0x1dbbdc[_0xfe5f('0x94')]=![];_0x1dbbdc[_0xfe5f('0x95')]=null;break;case _0xfe5f('0xaa'):_0x1dbbdc[_0xfe5f('0xab')]=_0xfe5f('0xac');_0x1dbbdc[_0xfe5f('0x94')]=!![];_0x1dbbdc[_0xfe5f('0x95')]=moment()[_0xfe5f('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x1dbbdc['queuecallerleaveAt']=moment()[_0xfe5f('0x4b')](_0xfe5f('0x84'));logger['debug'](_0xfe5f('0xad'),_0x1be5b0[_0xfe5f('0x4a')],util[_0xfe5f('0x3d')](_0x1dbbdc,{'showHidden':![],'depth':null}));ami[_0xfe5f('0x43')]('custom:timeout',_0x1dbbdc);break;default:_0x1dbbdc['queuecallerexit']=!![];_0x1dbbdc[_0xfe5f('0x95')]=moment()[_0xfe5f('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x1dbbdc[_0xfe5f('0x8a')]=moment()[_0xfe5f('0x4b')](_0xfe5f('0x84'));}_0x1dbbdc[_0xfe5f('0x1a')]=![];_0x1dbbdc[_0xfe5f('0x83')]=null;_0x1dbbdc[_0xfe5f('0x85')]=_0x1be5b0[_0xfe5f('0xa7')];this['channels'][_0x1be5b0[_0xfe5f('0x4a')]]=_0x1dbbdc;this[_0xfe5f('0x42')](_0x1dbbdc,_0xfe5f('0x1f'));}else if(this[_0xfe5f('0x63')](_0x1be5b0['variable'])&&this[_0xfe5f('0x63')](_0x1be5b0[_0xfe5f('0xa8')][_0xfe5f('0xae')])){if(!_0x1dbbdc[_0xfe5f('0x1a')]){_0x1dbbdc[_0xfe5f('0x94')]=!![];_0x1dbbdc['queuecallerexitAt']=moment()[_0xfe5f('0x4b')](_0xfe5f('0x84'));_0x1dbbdc[_0xfe5f('0x85')]=_0xfe5f('0xaf');_0x1dbbdc[_0xfe5f('0x8a')]=moment()[_0xfe5f('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfe5f('0x11')][_0x1be5b0['uniqueid']]=_0x1dbbdc;}}logger[_0xfe5f('0x6c')](_0xfe5f('0xb0'),_0x1be5b0[_0xfe5f('0x4a')],_0x1dbbdc[_0xfe5f('0x46')],_0x1dbbdc[_0xfe5f('0x4f')],_[_0xfe5f('0x7b')](_0x1be5b0['variable'])[0x0],_0x1be5b0[_0xfe5f('0xa7')]);_0x1dbbdc[_0xfe5f('0x14')]=this['variables'][_0x1be5b0[_0xfe5f('0x4a')]];}}}}catch(_0x54c1ac){logger['error']('[%s][voiceQueueReport][varset]',_0x1be5b0[_0xfe5f('0x4a')],util[_0xfe5f('0x3d')](_0x54c1ac,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfe5f('0xb1')]=function(_0x1511a8,_0xf8a39c,_0x20cc25){var _0x4e515a=[_0xfe5f('0xb2'),'rtpaudioqosbridged','rtpaudioqosjitter',_0xfe5f('0xb3'),_0xfe5f('0xb4'),_0xfe5f('0xb5'),_0xfe5f('0xb6'),'rtpaudioqosrttbridged',_0xfe5f('0xb7'),'sipuri','bridgepeer',_0xfe5f('0xb8'),'membercalls','memberdynamic',_0xfe5f('0xb9'),_0xfe5f('0xba'),_0xfe5f('0x93'),'memberpenalty',_0xfe5f('0xbb')];if(!_[_0xfe5f('0x36')](_0xf8a39c)&&!_[_0xfe5f('0xbc')](_0x4e515a,_0xf8a39c)){if(_[_0xfe5f('0x75')](this[_0xfe5f('0x14')][_0x1511a8])){this[_0xfe5f('0x14')][_0x1511a8]={};}this[_0xfe5f('0x14')][_0x1511a8][_0xf8a39c]=_0x20cc25;}};VoiceQueueReport['prototype'][_0xfe5f('0x22')]=function(_0x323434){try{if(this['isNotNull'](_0x323434)){logger[_0xfe5f('0x5f')](_0xfe5f('0xbd'),_0x323434[_0xfe5f('0x4a')],util[_0xfe5f('0x3d')](_0x323434,{'showHidden':![],'depth':null}));if(this[_0xfe5f('0xf')][_0x323434[_0xfe5f('0x4a')]]){for(var _0x41cf=0x0,_0x293a43={};_0x41cf0x0?_0x4fcf2c:0x0;this['voiceQueues'][_0x5b7b0d[_0xdf74('0x65')]][_0xdf74('0x30')]=this[_0xdf74('0x10')][_0x5b7b0d['queue']][_0xdf74('0x30')]>_[_0xdf74('0x67')](_0x5b7b0d['loggedin'])?_[_0xdf74('0x67')](_0x5b7b0d[_0xdf74('0x68')]):this[_0xdf74('0x10')][_0x5b7b0d['queue']]['talking'];this['emitVoiceQueueSummary'](this[_0xdf74('0x10')][_0x5b7b0d['queue']],_0xdf74('0x14'));}logger[_0xdf74('0x47')](_0xdf74('0x6a'),util[_0xdf74('0x41')](this[_0xdf74('0x10')][_0x5b7b0d[_0xdf74('0x65')]],{'showHidden':![],'depth':null}));ami[_0xdf74('0x46')](_0xdf74('0x6b'),this['voiceQueues'][_0x5b7b0d[_0xdf74('0x65')]]);}}}catch(_0x85e81d){logger[_0xdf74('0x3e')](_0xdf74('0x61'),util['inspect'](_0x85e81d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdf74('0xb')][_0xdf74('0x6c')]=function(_0xae481b){logger[_0xdf74('0x47')](_0xdf74('0x6d'),util[_0xdf74('0x41')](_0xae481b,{'showHidden':![],'depth':null}));this[_0xdf74('0x11')]=!![];};VoiceQueueReport[_0xdf74('0xb')][_0xdf74('0x6e')]=function(_0x2cb4f9){try{if(this['isNotNull'](_0x2cb4f9)){logger[_0xdf74('0x47')](_0xdf74('0x6f'),_0x2cb4f9[_0xdf74('0x4b')],util[_0xdf74('0x41')](_0x2cb4f9,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xdf74('0xf')][_0x2cb4f9[_0xdf74('0x4b')]]))this[_0xdf74('0xf')][_0x2cb4f9[_0xdf74('0x4b')]]=[];if(_['isUndefined'](this['channels'][_0x2cb4f9['uniqueid']]))this[_0xdf74('0x35')][_0x2cb4f9[_0xdf74('0x4b')]]={};var _0x18bc3c=new QueueReport();_0x18bc3c['name']=_0x2cb4f9[_0xdf74('0x65')];_0x18bc3c[_0xdf74('0x50')]=this[_0xdf74('0x10')][_0x18bc3c[_0xdf74('0x4d')]]&&this['voiceQueues'][_0x18bc3c[_0xdf74('0x4d')]]['type']?this[_0xdf74('0x10')][_0x18bc3c[_0xdf74('0x4d')]]['type']||_0xdf74('0x51'):'inbound';_0x18bc3c[_0xdf74('0x65')]=_0x2cb4f9[_0xdf74('0x65')];_0x18bc3c[_0xdf74('0x70')]=moment()['format'](_0xdf74('0x71'));_0x18bc3c[_0xdf74('0x72')]=_0x2cb4f9[_0xdf74('0x72')];_0x18bc3c[_0xdf74('0x73')]=_0x2cb4f9[_0xdf74('0x73')];_0x18bc3c[_0xdf74('0x4b')]=_0x2cb4f9['uniqueid'];_0x18bc3c['routealias']=this[_0xdf74('0x35')][_0x2cb4f9[_0xdf74('0x4b')]][_0xdf74('0x74')];logger['info'](_0xdf74('0x75'),_0x18bc3c[_0xdf74('0x4d')],_0x18bc3c['type']);_[_0xdf74('0x76')](_0x18bc3c,_['pick'](_0x2cb4f9,_[_0xdf74('0x77')](_0x18bc3c)));this[_0xdf74('0xf')][_0x2cb4f9[_0xdf74('0x4b')]]['push'](_0x18bc3c);this[_0xdf74('0x35')][_0x2cb4f9['uniqueid']]=_0x18bc3c;this[_0xdf74('0x78')](_0x18bc3c,_0xdf74('0x17'));}}catch(_0x134914){logger[_0xdf74('0x3e')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2cb4f9[_0xdf74('0x4b')],util[_0xdf74('0x41')](_0x134914,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdf74('0xb')][_0xdf74('0x79')]=function(_0x2a1f80){try{if(this[_0xdf74('0x5c')](_0x2a1f80)){logger[_0xdf74('0x47')](_0xdf74('0x7a'),_0x2a1f80['uniqueid'],util[_0xdf74('0x41')](_0x2a1f80,{'showHidden':![],'depth':null}));if(this[_0xdf74('0xf')][_0x2a1f80[_0xdf74('0x4b')]]){var _0x51b1e3=_['last'](this['queueReports'][_0x2a1f80[_0xdf74('0x4b')]]);_0x51b1e3['queuecallercomplete']=![];_0x51b1e3[_0xdf74('0x7b')]=null;_0x51b1e3[_0xdf74('0x7c')]=_0x2a1f80[_0xdf74('0x7c')];_0x51b1e3[_0xdf74('0x7d')]=_0x2a1f80[_0xdf74('0x7d')];_0x51b1e3['queuecallerabandon']=!![];_0x51b1e3[_0xdf74('0x7e')]=moment()[_0xdf74('0x4c')](_0xdf74('0x71'));_0x51b1e3[_0xdf74('0x7f')]=_0xdf74('0x80');_0x51b1e3['lastAssignedTo']=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x51b1e3['name'],_0x51b1e3[_0xdf74('0x50')]);this[_0xdf74('0x35')][_0x2a1f80['uniqueid']]=_0x51b1e3;this['emitVoiceQueueChannelRemove'](_0x51b1e3,_0xdf74('0x18'));}}}catch(_0x2e382d){logger['error'](_0xdf74('0x7a'),_0x2a1f80[_0xdf74('0x4b')],util[_0xdf74('0x41')](_0x2e382d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdf74('0xb')][_0xdf74('0x1a')]=function(_0x2cb15c){try{if(this[_0xdf74('0x5c')](_0x2cb15c)){logger[_0xdf74('0x47')](_0xdf74('0x81'),_0x2cb15c[_0xdf74('0x4b')],util[_0xdf74('0x41')](_0x2cb15c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2cb15c['uniqueid']]){var _0x332bf2=_['last'](this[_0xdf74('0xf')][_0x2cb15c[_0xdf74('0x4b')]]);_0x332bf2[_0xdf74('0x82')]=moment()[_0xdf74('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x332bf2[_0xdf74('0x83')]=_0x2cb15c['connectedlinenum'];_0x332bf2[_0xdf74('0x84')]=_0x2cb15c[_0xdf74('0x84')];logger[_0xdf74('0x63')](_0xdf74('0x85'),_0x332bf2[_0xdf74('0x4d')],_0x332bf2['type'],_0x2cb15c[_0xdf74('0x83')],_0x2cb15c['connectedlinename']);this['channels'][_0x2cb15c[_0xdf74('0x4b')]]=_0x332bf2;this[_0xdf74('0x78')](_0x332bf2,_0xdf74('0x19'));}}}catch(_0x5b122c){logger[_0xdf74('0x3e')]('[%s][voiceQueueReport][queuecallerleave]',_0x2cb15c[_0xdf74('0x4b')],util['inspect'](_0x5b122c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdf74('0xb')][_0xdf74('0x1d')]=function(_0x151a26){try{if(this['isNotNull'](_0x151a26)){logger[_0xdf74('0x47')](_0xdf74('0x86'),_0x151a26[_0xdf74('0x4b')],util[_0xdf74('0x41')](_0x151a26,{'showHidden':![],'depth':null}));if(this[_0xdf74('0xf')][_0x151a26[_0xdf74('0x4b')]]){var _0x2c04bd=_['last'](this['queueReports'][_0x151a26[_0xdf74('0x4b')]]);_0x2c04bd[_0xdf74('0x87')]=!![];_0x2c04bd[_0xdf74('0x7f')]=_0xdf74('0x88');logger[_0xdf74('0x63')](_0xdf74('0x89'),_0x2c04bd[_0xdf74('0x4d')],_0x2c04bd['type']);}}}catch(_0x58b5be){logger[_0xdf74('0x3e')](_0xdf74('0x86'),_0x151a26['uniqueid'],util[_0xdf74('0x41')](_0x58b5be,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xdf74('0x8a')]=function(_0x18486f){try{if(this[_0xdf74('0x5c')](_0x18486f)){logger[_0xdf74('0x47')](_0xdf74('0x8b'),_0x18486f['uniqueid'],util[_0xdf74('0x41')](_0x18486f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x18486f[_0xdf74('0x4b')]]){var _0x5d4dbd=_[_0xdf74('0x8c')](this[_0xdf74('0xf')][_0x18486f['uniqueid']]);_0x5d4dbd['queuecallerabandon']=![];_0x5d4dbd[_0xdf74('0x7e')]=null;_0x5d4dbd['assigned']=!![];_0x5d4dbd[_0xdf74('0x8d')]=_0x18486f['membername'];_0x5d4dbd['holdtime']=_0x18486f['holdtime'];_0x5d4dbd[_0xdf74('0x87')]=!![];_0x5d4dbd[_0xdf74('0x8e')]=![];_0x5d4dbd[_0xdf74('0x8f')]=null;if(!_0x5d4dbd[_0xdf74('0x90')]){if(_0x18486f[_0xdf74('0x91')]==_0xdf74('0x90')){_0x5d4dbd[_0xdf74('0x7f')]='COMPLETED';logger[_0xdf74('0x63')](_0xdf74('0x92'),_0x5d4dbd[_0xdf74('0x4d')],_0x5d4dbd[_0xdf74('0x50')]);}else{if(_[_0xdf74('0x93')](_0x18486f['channel']['toLowerCase'](),_0xdf74('0x94'))){if(this[_0xdf74('0xf')][_0x18486f[_0xdf74('0x95')]]){var _0x5d06dc=_['last'](this[_0xdf74('0xf')][_0x18486f[_0xdf74('0x95')]]);_0x5d06dc[_0xdf74('0x87')]=![];_0x5d06dc[_0xdf74('0x8e')]=!![];_0x5d06dc[_0xdf74('0x8f')]=moment(_0x5d4dbd[_0xdf74('0x70')])[_0xdf74('0x96')](_0x18486f['holdtime'],'seconds')['format'](_0xdf74('0x71'));_0x5d06dc['queuecallerexitreason']=_0xdf74('0x97');_0x5d06dc['transfer']=!![];_0x5d06dc[_0xdf74('0x98')]=_0xdf74('0x99');_0x5d06dc[_0xdf74('0x9a')]=_0x18486f[_0xdf74('0x9b')];_0x5d06dc[_0xdf74('0x9c')]=_0x18486f[_0xdf74('0x4b')];logger[_0xdf74('0x63')](_0xdf74('0x9d'),_0x5d06dc[_0xdf74('0x4d')],_0x5d06dc[_0xdf74('0x50')]);var _0x37d407=this['queueReports'][_0x18486f['linkedid']];this[_0xdf74('0xf')][_0x18486f[_0xdf74('0x95')]]=this[_0xdf74('0xf')][_0x18486f['uniqueid']];this[_0xdf74('0xf')][_0x18486f[_0xdf74('0x4b')]]=_0x37d407;}}else{_0x5d4dbd['queuecallerexitreason']=_0xdf74('0x9e')+_0x18486f[_0xdf74('0x91')]['toUpperCase']();logger[_0xdf74('0x63')](_0xdf74('0x9f'),_0x5d4dbd[_0xdf74('0x4d')],_0x5d4dbd[_0xdf74('0x50')],_0x5d4dbd[_0xdf74('0x7f')]);}}}this['channels'][_0x18486f[_0xdf74('0x4b')]]=_0x5d4dbd;this[_0xdf74('0x45')](_0x5d4dbd,_0xdf74('0x1b'));}}}catch(_0x301a83){logger[_0xdf74('0x3e')](_0xdf74('0x8b'),_0x18486f[_0xdf74('0x4b')],util[_0xdf74('0x41')](_0x301a83,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdf74('0xb')][_0xdf74('0xa0')]=function(_0x5e2dc0){try{if(this[_0xdf74('0x5c')](_0x5e2dc0)){logger[_0xdf74('0x47')]('[%s][voiceQueueReport][varset]',_0x5e2dc0[_0xdf74('0x4b')],util[_0xdf74('0x41')](_0x5e2dc0,{'showHidden':![],'depth':null}));this[_0xdf74('0xa1')](_0x5e2dc0[_0xdf74('0x4b')],_[_0xdf74('0x77')](_0x5e2dc0[_0xdf74('0xa2')])[0x0],_0x5e2dc0[_0xdf74('0xa3')]);if(this[_0xdf74('0xf')][_0x5e2dc0[_0xdf74('0x4b')]]){var _0xcf9c60=_[_0xdf74('0x8c')](this[_0xdf74('0xf')][_0x5e2dc0['uniqueid']]);if(_0xcf9c60){if(this[_0xdf74('0x5c')](_0x5e2dc0[_0xdf74('0xa2')])&&this[_0xdf74('0x5c')](_0x5e2dc0[_0xdf74('0xa2')][_0xdf74('0xa4')])){switch(_0x5e2dc0[_0xdf74('0xa3')]){case _0xdf74('0xa5'):_0xcf9c60[_0xdf74('0x8e')]=![];_0xcf9c60[_0xdf74('0x8f')]=null;break;case _0xdf74('0xa6'):_0xcf9c60[_0xdf74('0xa7')]=_0xdf74('0xa8');_0xcf9c60[_0xdf74('0x8e')]=!![];_0xcf9c60['queuecallerexitAt']=moment()[_0xdf74('0x4c')](_0xdf74('0x71'));_0xcf9c60['queuecallerleaveAt']=moment()[_0xdf74('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0xdf74('0xa9'),_0x5e2dc0[_0xdf74('0x4b')],util[_0xdf74('0x41')](_0xcf9c60,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0xcf9c60);break;default:_0xcf9c60[_0xdf74('0x8e')]=!![];_0xcf9c60[_0xdf74('0x8f')]=moment()[_0xdf74('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0xcf9c60[_0xdf74('0x82')]=moment()['format'](_0xdf74('0x71'));}_0xcf9c60[_0xdf74('0x18')]=![];_0xcf9c60[_0xdf74('0x7e')]=null;_0xcf9c60[_0xdf74('0x7f')]=_0x5e2dc0[_0xdf74('0xa3')];this[_0xdf74('0x35')][_0x5e2dc0['uniqueid']]=_0xcf9c60;this[_0xdf74('0x45')](_0xcf9c60,_0xdf74('0x1e'));}else if(this[_0xdf74('0x5c')](_0x5e2dc0[_0xdf74('0xa2')])&&this[_0xdf74('0x5c')](_0x5e2dc0[_0xdf74('0xa2')][_0xdf74('0xaa')])){if(!_0xcf9c60[_0xdf74('0x18')]){_0xcf9c60['queuecallerexit']=!![];_0xcf9c60[_0xdf74('0x8f')]=moment()['format'](_0xdf74('0x71'));_0xcf9c60['queuecallerexitreason']='EXITWITHKEY';_0xcf9c60['queuecallerleaveAt']=moment()[_0xdf74('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xdf74('0x35')][_0x5e2dc0['uniqueid']]=_0xcf9c60;}}logger[_0xdf74('0x63')](_0xdf74('0xab'),_0x5e2dc0[_0xdf74('0x4b')],_0xcf9c60[_0xdf74('0x4d')],_0xcf9c60['type'],_['keys'](_0x5e2dc0[_0xdf74('0xa2')])[0x0],_0x5e2dc0[_0xdf74('0xa3')]);_0xcf9c60['variables']=this[_0xdf74('0x13')][_0x5e2dc0[_0xdf74('0x4b')]];}}}}catch(_0x9370a9){logger['error']('[%s][voiceQueueReport][varset]',_0x5e2dc0[_0xdf74('0x4b')],util['inspect'](_0x9370a9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdf74('0xb')][_0xdf74('0xa1')]=function(_0x248955,_0x28d6d0,_0x264734){var _0x1bf0a7=['rtpaudioqos',_0xdf74('0xac'),_0xdf74('0xad'),_0xdf74('0xae'),_0xdf74('0xaf'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0xdf74('0xb0'),_0xdf74('0xb1'),'sipuri',_0xdf74('0xb2'),_0xdf74('0xb3'),_0xdf74('0xb4'),_0xdf74('0xb5'),_0xdf74('0xb6'),'memberlastcall',_0xdf74('0xb7'),_0xdf74('0xb8'),_0xdf74('0xb9')];if(!_[_0xdf74('0x38')](_0x28d6d0)&&!_[_0xdf74('0xba')](_0x1bf0a7,_0x28d6d0)){if(_[_0xdf74('0xbb')](this[_0xdf74('0x13')][_0x248955])){this['variables'][_0x248955]={};}this[_0xdf74('0x13')][_0x248955][_0x28d6d0]=_0x264734;}};VoiceQueueReport[_0xdf74('0xb')][_0xdf74('0x20')]=function(_0x374a99){try{if(this[_0xdf74('0x5c')](_0x374a99)){logger[_0xdf74('0x47')](_0xdf74('0xbc'),_0x374a99[_0xdf74('0x4b')],util[_0xdf74('0x41')](_0x374a99,{'showHidden':![],'depth':null}));if(this[_0xdf74('0xf')][_0x374a99[_0xdf74('0x4b')]]){for(var _0x2739c4=0x0,_0x2997ca={};_0x2739c4=0x0?moment(_0x246972[_0x5a24('0x18')])[_0x5a24('0xa')](_0x246972['starttime'],_0x5a24('0xb')):null,'data1':_0x5a24('0x19'),'data2':_0x246972['accountcode'],'data3':_0x246972[_0x5a24('0xd')],'data4':_0x246972['dialstring']||null,'role':_0x5a24('0x1a'),'internal':_0x246972[_0x5a24('0xf')]?_['toNumber'](_0x246972[_0x5a24('0xf')]):undefined,'uniqueid':_0x246972[_0x5a24('0x11')]},'log':_0x5a24('0x12')});}; \ No newline at end of file +var _0x291c=['SIP/%s','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport','membername','starttime','endtime','outbound','moment','lodash','../client','voiceQueueReport','queuecallerexitAt','Request','voice','isNil','interface','format'];(function(_0x57b10d,_0x54a86d){var _0x289858=function(_0x1e2eb8){while(--_0x1e2eb8){_0x57b10d['push'](_0x57b10d['shift']());}};_0x289858(++_0x54a86d);}(_0x291c,0x17e));var _0xc291=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x291c[_0x21a9d9];return _0x46adce;};'use strict';var moment=require(_0xc291('0x0'));var _=require(_0xc291('0x1'));var util=require('util');var client=require(_0xc291('0x2'));exports[_0xc291('0x3')]=function(_0x3a9be1){var _0x2b9720=_0x3a9be1['queuecallercompleteAt']||_0x3a9be1[_0xc291('0x4')];return client[_0xc291('0x5')]('CreateMemberReport',{'body':{'channel':_0xc291('0x6'),'membername':_0x3a9be1['lastAssignedTo'],'interface':_[_0xc291('0x7')](_0x3a9be1[_0xc291('0x8')])?util[_0xc291('0x9')](_0xc291('0xa'),_0x3a9be1['lastAssignedTo']):_0x3a9be1['interface'],'type':'TALKING','enterAt':_0x3a9be1[_0xc291('0xb')],'exitAt':_0x2b9720,'duration':moment(_0x2b9720)[_0xc291('0xc')](_0x3a9be1['queuecallerleaveAt'],_0xc291('0xd')),'data1':_0xc291('0xe'),'data2':_0x3a9be1[_0xc291('0xf')],'data3':_0x3a9be1[_0xc291('0x10')],'data4':null,'data5':_0x3a9be1[_0xc291('0x11')],'role':_0xc291('0x12'),'internal':_0x3a9be1[_0xc291('0x13')]?_[_0xc291('0x14')](_0x3a9be1[_0xc291('0x13')]):undefined,'uniqueid':_0x3a9be1[_0xc291('0x15')]},'log':_0xc291('0x16')});};exports[_0xc291('0x17')]=function(_0x39b7af){return client[_0xc291('0x5')](_0xc291('0x16'),{'body':{'channel':_0xc291('0x6'),'membername':_0x39b7af[_0xc291('0x18')],'interface':_0x39b7af[_0xc291('0x8')],'type':'TALKING','enterAt':_0x39b7af[_0xc291('0x19')],'exitAt':_0x39b7af['endtime'],'duration':moment(_0x39b7af[_0xc291('0x1a')])['diff'](_0x39b7af['starttime'],'seconds')>=0x0?moment(_0x39b7af[_0xc291('0x1a')])[_0xc291('0xc')](_0x39b7af[_0xc291('0x19')],'seconds'):null,'data1':_0xc291('0x1b'),'data2':_0x39b7af['accountcode'],'data3':_0x39b7af[_0xc291('0x10')],'data4':_0x39b7af['dialstring']||null,'role':_0xc291('0x12'),'internal':_0x39b7af[_0xc291('0x13')]?_[_0xc291('0x14')](_0x39b7af['accountcode']):undefined,'uniqueid':_0x39b7af[_0xc291('0x15')]},'log':_0xc291('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 5c91753..55fa8f6 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 _0x2c5b=['Request','ShowSetting','stopRecordingOnTransfer','../client'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x2c5b,0x193));var _0xb2c5=function(_0x5459c8,_0xdf5aa3){_0x5459c8=_0x5459c8-0x0;var _0x17fad8=_0x2c5b[_0x5459c8];return _0x17fad8;};'use strict';var client=require(_0xb2c5('0x0'));exports['getSettings']=function(){return client[_0xb2c5('0x1')](_0xb2c5('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb2c5('0x3'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file +var _0xd679=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xd679,0xcc));var _0x9d67=function(_0x2d91a1,_0x3ff4f9){_0x2d91a1=_0x2d91a1-0x0;var _0x288796=_0xd679[_0x2d91a1];return _0x288796;};'use strict';var client=require('../client');exports[_0x9d67('0x0')]=function(){return client[_0x9d67('0x1')](_0x9d67('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9d67('0x3'),_0x9d67('0x4')]},'log':_0x9d67('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 2f4a428..09df129 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 _0xb67b=['Request','GetTemplate','html','../client'];(function(_0x14a453,_0x4742e6){var _0x37ed1d=function(_0x5642ff){while(--_0x5642ff){_0x14a453['push'](_0x14a453['shift']());}};_0x37ed1d(++_0x4742e6);}(_0xb67b,0x1f3));var _0xbb67=function(_0x1c6551,_0x3fbc2e){_0x1c6551=_0x1c6551-0x0;var _0x3f7434=_0xb67b[_0x1c6551];return _0x3f7434;};'use strict';var client=require(_0xbb67('0x0'));exports['getTemplates']=function(_0x39ec8f){return function(_0x17dd75){return client[_0xbb67('0x1')](_0xbb67('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xbb67('0x3')]},'log':_0xbb67('0x2')});};}; \ No newline at end of file +var _0x37c8=['GetTemplate','name','html','../client','getTemplates','Request'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x37c8,0x69));var _0x837c=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0x37c8[_0x6dd5c];return _0x5a87fa;};'use strict';var client=require(_0x837c('0x0'));exports[_0x837c('0x1')]=function(_0x1d5f5e){return function(_0x57d4fc){return client[_0x837c('0x2')](_0x837c('0x3'),{'options':{'raw':!![],'attributes':['id',_0x837c('0x4'),_0x837c('0x5')]},'log':_0x837c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 6ac6966..ed88f1d 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 _0xe089=['field','AnyConditions','operator','Action','Actions','data1','data2','data3','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions'];(function(_0x13fe8d,_0x5a6209){var _0x37150f=function(_0x19bad1){while(--_0x19bad1){_0x13fe8d['push'](_0x13fe8d['shift']());}};_0x37150f(++_0x5a6209);}(_0xe089,0x173));var _0x9e08=function(_0x5781f9,_0x142e0e){_0x5781f9=_0x5781f9-0x0;var _0x35faec=_0xe089[_0x5781f9];return _0x35faec;};'use strict';var client=require(_0x9e08('0x0'));exports[_0x9e08('0x1')]=function(_0xe3b35e){return function(_0x23b8e9){return client[_0x9e08('0x2')](_0x9e08('0x3'),{'options':{'raw':![],'attributes':['id',_0x9e08('0x4'),_0x9e08('0x5'),_0x9e08('0x6')],'include':[{'model':_0x9e08('0x7'),'as':_0x9e08('0x8'),'attributes':['id',_0x9e08('0x9'),'operator','value']},{'model':_0x9e08('0x7'),'as':_0x9e08('0xa'),'attributes':['id',_0x9e08('0x9'),_0x9e08('0xb'),'value']},{'model':_0x9e08('0xc'),'as':_0x9e08('0xd'),'attributes':['id','action',_0x9e08('0xe'),_0x9e08('0xf'),_0x9e08('0x10'),'data4',_0x9e08('0x11'),_0x9e08('0x12'),_0x9e08('0x13')]}]},'log':_0x9e08('0x3')});};}; \ No newline at end of file +var _0x92a1=['Request','channel','status','Condition','field','AnyConditions','value','Action','Actions','data2','data3','data4','data5','data6','GetTrigger','../client','getTriggers'];(function(_0x496303,_0x4aed86){var _0x52a165=function(_0x451a28){while(--_0x451a28){_0x496303['push'](_0x496303['shift']());}};_0x52a165(++_0x4aed86);}(_0x92a1,0xca));var _0x192a=function(_0x48159c,_0x434ab1){_0x48159c=_0x48159c-0x0;var _0x19932c=_0x92a1[_0x48159c];return _0x19932c;};'use strict';var client=require(_0x192a('0x0'));exports[_0x192a('0x1')]=function(_0xb737c8){return function(_0x226f29){return client[_0x192a('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0x192a('0x3'),_0x192a('0x4')],'include':[{'model':_0x192a('0x5'),'as':'AllConditions','attributes':['id',_0x192a('0x6'),'operator','value']},{'model':'Condition','as':_0x192a('0x7'),'attributes':['id',_0x192a('0x6'),'operator',_0x192a('0x8')]},{'model':_0x192a('0x9'),'as':_0x192a('0xa'),'attributes':['id','action','data1',_0x192a('0xb'),_0x192a('0xc'),_0x192a('0xd'),_0x192a('0xe'),_0x192a('0xf'),'data7']}]},'log':_0x192a('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 85c8856..73e236c 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 _0x0b40=['getTrunks','Request','GetTrunk','name','registry','defaultuser'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x0b40,0xba));var _0x00b4=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x0b40[_0x548627];return _0x844a84;};'use strict';var client=require('../client');exports[_0x00b4('0x0')]=function(_0x10719a){return function(_0x53b8fd){return client[_0x00b4('0x1')](_0x00b4('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x00b4('0x3'),_0x00b4('0x4'),_0x00b4('0x5')]},'log':_0x00b4('0x2')});};}; \ No newline at end of file +var _0xf698=['defaultuser','GetTrunk','../client','getTrunks','Request','name','registry'];(function(_0x412c8f,_0x11ec94){var _0x27c005=function(_0x127059){while(--_0x127059){_0x412c8f['push'](_0x412c8f['shift']());}};_0x27c005(++_0x11ec94);}(_0xf698,0x1de));var _0x8f69=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0xf698[_0x2e3dfc];return _0x4b1245;};'use strict';var client=require(_0x8f69('0x0'));exports[_0x8f69('0x1')]=function(_0x5ce4c0){return function(_0x1d6ed2){return client[_0x8f69('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x8f69('0x3'),_0x8f69('0x4'),_0x8f69('0x5')]},'log':_0x8f69('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 75b6ea4..ecbf4e9 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x1f8e39,_0x3a6089){var _0x220b59=function(_0x260a18){while(--_0x260a18){_0x1f8e39['push'](_0x1f8e39['shift']());}};_0x220b59(++_0x3a6089);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0xcb91[_0x622035];return _0x326cf2;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ccd25f1..c9d70fa 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 _0xc11f=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x474a4b,_0x282fd2){var _0x1e3641=function(_0x52aecc){while(--_0x52aecc){_0x474a4b['push'](_0x474a4b['shift']());}};_0x1e3641(++_0x282fd2);}(_0xc11f,0x11f));var _0xfc11=function(_0x18eb17,_0x17f766){_0x18eb17=_0x18eb17-0x0;var _0x1f429b=_0xc11f[_0x18eb17];return _0x1f429b;};'use strict';var client=require(_0xfc11('0x0'));exports['create']=function(_0x580d6e){return client[_0xfc11('0x1')](_0xfc11('0x2'),{'body':_0x580d6e,'log':_0xfc11('0x2')});};exports['update']=function(_0x52f6a6,_0x28f15d,_0x2c8717){return client[_0xfc11('0x1')](_0xfc11('0x3'),{'body':_0x52f6a6,'options':{'where':{'uniqueid':_0x28f15d,'interface':_0x2c8717,'agentcomplete':!![]}},'log':_0xfc11('0x3')});}; \ No newline at end of file +var _0xc7f4=['update','UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport'];(function(_0x2378d7,_0xd46258){var _0x58dc15=function(_0x1bf0ba){while(--_0x1bf0ba){_0x2378d7['push'](_0x2378d7['shift']());}};_0x58dc15(++_0xd46258);}(_0xc7f4,0xc0));var _0x4c7f=function(_0x3c926d,_0x957047){_0x3c926d=_0x3c926d-0x0;var _0x3aa66e=_0xc7f4[_0x3c926d];return _0x3aa66e;};'use strict';var client=require('../client');exports[_0x4c7f('0x0')]=function(_0x4397dc){return client[_0x4c7f('0x1')](_0x4c7f('0x2'),{'body':_0x4397dc,'log':'CreateVoiceAgentReport'});};exports[_0x4c7f('0x3')]=function(_0x3a8f36,_0x1e284e,_0xed8c9a){return client[_0x4c7f('0x1')](_0x4c7f('0x4'),{'body':_0x3a8f36,'options':{'where':{'uniqueid':_0x1e284e,'interface':_0xed8c9a,'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 11d19f4..e0e67d0 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 _0x1c7d=['startOf','day','YYYY-MM-DD\x20HH:mm:ss','format','type','billableseconds','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound'];(function(_0x51a56e,_0x5d6ee9){var _0x5a8685=function(_0x161c4c){while(--_0x161c4c){_0x51a56e['push'](_0x51a56e['shift']());}};_0x5a8685(++_0x5d6ee9);}(_0x1c7d,0x14a));var _0xd1c7=function(_0x204266,_0x391561){_0x204266=_0x204266-0x0;var _0x25e6d0=_0x1c7d[_0x204266];return _0x25e6d0;};'use strict';var moment=require('moment');var util=require(_0xd1c7('0x0'));var _=require(_0xd1c7('0x1'));var client=require(_0xd1c7('0x2'));exports[_0xd1c7('0x3')]=function(_0x3c427e){return client[_0xd1c7('0x4')](_0xd1c7('0x5'),{'body':_[_0xd1c7('0x6')](_0x3c427e,{'source':_0x3c427e['calleridnum'],'destinationcontext':_0x3c427e[_0xd1c7('0x7')],'callerid':_0x3c427e[_0xd1c7('0x8')],'amaflags':_0xd1c7('0x9')}),'log':_0xd1c7('0x5')});};exports[_0xd1c7('0xa')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0xd1c7('0xb')],'createdAt':{'$between':[moment()[_0xd1c7('0xc')](_0xd1c7('0xd'))['format'](_0xd1c7('0xe')),moment()['endOf']('day')[_0xd1c7('0xf')](_0xd1c7('0xe'))]}},'attributes':[_0xd1c7('0x10'),'disposition','duration',_0xd1c7('0x11')]},'log':_0xd1c7('0x12')});};}; \ No newline at end of file +var _0x89bf=['getVoiceCallReports','GetVoiceCallReport','startOf','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','moment','util','lodash','create','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport'];(function(_0x7a42d9,_0x5a0c72){var _0x278b78=function(_0x1fa030){while(--_0x1fa030){_0x7a42d9['push'](_0x7a42d9['shift']());}};_0x278b78(++_0x5a0c72);}(_0x89bf,0x14a));var _0xf89b=function(_0x2b7229,_0x3c5056){_0x2b7229=_0x2b7229-0x0;var _0x204f15=_0x89bf[_0x2b7229];return _0x204f15;};'use strict';var moment=require(_0xf89b('0x0'));var util=require(_0xf89b('0x1'));var _=require(_0xf89b('0x2'));var client=require('../client');exports[_0xf89b('0x3')]=function(_0x1c486b){return client['Request']('CreateVoiceCallReport',{'body':_[_0xf89b('0x4')](_0x1c486b,{'source':_0x1c486b[_0xf89b('0x5')],'destinationcontext':_0x1c486b[_0xf89b('0x6')],'callerid':_0x1c486b[_0xf89b('0x7')],'amaflags':_0xf89b('0x8')}),'log':_0xf89b('0x9')});};exports[_0xf89b('0xa')]=function(){return function(){return client['Request'](_0xf89b('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xf89b('0xc')]('day')[_0xf89b('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xf89b('0xe')]('day')[_0xf89b('0xd')](_0xf89b('0xf'))]}},'attributes':[_0xf89b('0x10'),_0xf89b('0x11'),_0xf89b('0x12'),'billableseconds']},'log':_0xf89b('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 62a158a..830ec6d 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 _0x1008=['create','Request','CreateVoiceDialReport','../client'];(function(_0x3e278b,_0x29052c){var _0x290160=function(_0x46c7c5){while(--_0x46c7c5){_0x3e278b['push'](_0x3e278b['shift']());}};_0x290160(++_0x29052c);}(_0x1008,0x77));var _0x8100=function(_0x1b2255,_0x3de34f){_0x1b2255=_0x1b2255-0x0;var _0x33e57d=_0x1008[_0x1b2255];return _0x33e57d;};'use strict';var client=require(_0x8100('0x0'));exports[_0x8100('0x1')]=function(_0x1f80fc){return client[_0x8100('0x2')](_0x8100('0x3'),{'body':_0x1f80fc,'log':_0x8100('0x3')});}; \ No newline at end of file +var _0x0809=['create','Request','CreateVoiceDialReport','../client'];(function(_0x28055c,_0x27b47a){var _0x20806d=function(_0x70d08d){while(--_0x70d08d){_0x28055c['push'](_0x28055c['shift']());}};_0x20806d(++_0x27b47a);}(_0x0809,0x113));var _0x9080=function(_0x466732,_0x37024f){_0x466732=_0x466732-0x0;var _0x37e4dc=_0x0809[_0x466732];return _0x37e4dc;};'use strict';var client=require(_0x9080('0x0'));exports[_0x9080('0x1')]=function(_0x5669a9){return client[_0x9080('0x2')]('CreateVoiceDialReport',{'body':_0x5669a9,'log':_0x9080('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index bac14b3..e85550f 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 _0x31c2=['../client','GetVoiceExtension','exten','getVoiceExtensions'];(function(_0x242a4f,_0x369c57){var _0x122117=function(_0x55a797){while(--_0x55a797){_0x242a4f['push'](_0x242a4f['shift']());}};_0x122117(++_0x369c57);}(_0x31c2,0x98));var _0x231c=function(_0x183dac,_0x27d572){_0x183dac=_0x183dac-0x0;var _0x2bfa9d=_0x31c2[_0x183dac];return _0x2bfa9d;};'use strict';var client=require(_0x231c('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0x231c('0x1'),{'options':{'raw':!![],'attributes':['id',_0x231c('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x231c('0x3')});};}; \ No newline at end of file +var _0xde13=['exten','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x1bb80c,_0x26d406){var _0x368f16=function(_0x4e37e5){while(--_0x4e37e5){_0x1bb80c['push'](_0x1bb80c['shift']());}};_0x368f16(++_0x26d406);}(_0xde13,0x146));var _0x3de1=function(_0x5e85c9,_0x3529d0){_0x5e85c9=_0x5e85c9-0x0;var _0x4c0a16=_0xde13[_0x5e85c9];return _0x4c0a16;};'use strict';var client=require(_0x3de1('0x0'));exports[_0x3de1('0x1')]=function(){return function(){return client[_0x3de1('0x2')](_0x3de1('0x3'),{'options':{'raw':!![],'attributes':['id',_0x3de1('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x3de1('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index ccaaa91..b9d3ab6 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 _0xf524=['Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','getVoiceQueues','../client','Request','name','acwTimeout','monitor_format','type','dialActive','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueProject','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf524,0x75));var _0x4f52=function(_0x459963,_0x5a366a){_0x459963=_0x459963-0x0;var _0xbe84e3=_0xf524[_0x459963];return _0xbe84e3;};'use strict';var client=require(_0x4f52('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x4f52('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x4f52('0x2'),'acw',_0x4f52('0x3'),'autopause',_0x4f52('0x4'),_0x4f52('0x5'),_0x4f52('0x6'),'dialMethod','dialLimitChannel','dialLimitQueue',_0x4f52('0x7'),_0x4f52('0x8'),_0x4f52('0x9'),_0x4f52('0xa'),_0x4f52('0xb'),_0x4f52('0xc'),'dialOriginateTimeout','dialQueueOptions','dialQueueTimeout',_0x4f52('0xd'),'dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry',_0x4f52('0xe'),'dialNoAnswerMaxRetry',_0x4f52('0xf'),_0x4f52('0x10'),_0x4f52('0x11'),_0x4f52('0x12'),_0x4f52('0x13'),_0x4f52('0x14'),_0x4f52('0x15'),_0x4f52('0x16'),_0x4f52('0x17'),'dialAMDAfterGreetingSilence',_0x4f52('0x18'),_0x4f52('0x19'),_0x4f52('0x1a'),'dialAMDMaximumNumberOfWords',_0x4f52('0x1b'),_0x4f52('0x1c'),'timeout',_0x4f52('0x1d'),_0x4f52('0x1e'),_0x4f52('0x1f'),_0x4f52('0x20'),_0x4f52('0x21'),_0x4f52('0x22'),_0x4f52('0x4'),_0x4f52('0x23'),_0x4f52('0x24'),_0x4f52('0x25'),'dialNoSuchNumberMaxRetry',_0x4f52('0x26'),_0x4f52('0x27'),_0x4f52('0x28'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry',_0x4f52('0x29'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x4f52('0x2a'),_0x4f52('0x2b'),_0x4f52('0x2c'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0x4f52('0x2d'),'as':_0x4f52('0x2d'),'attributes':['id',_0x4f52('0x2'),_0x4f52('0x2e'),_0x4f52('0x2f')]},{'model':_0x4f52('0x30'),'as':_0x4f52('0x31'),'attributes':['id',_0x4f52('0x2')]},{'model':_0x4f52('0x2d'),'as':_0x4f52('0x32'),'attributes':['id',_0x4f52('0x2'),_0x4f52('0x2e'),'active']},{'model':_0x4f52('0x33'),'as':_0x4f52('0x33'),'attributes':['id',_0x4f52('0x2')],'include':[{'model':_0x4f52('0x33'),'as':_0x4f52('0x34'),'attributes':['id',_0x4f52('0x2'),'interval']}]}]},'log':_0x4f52('0x35')});};}; \ No newline at end of file +var _0x5b34=['dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','active','Pause','TrunkBackup','callerid','Interval','Intervals','getVoiceQueues','../client','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x49317d,_0x2fe194){var _0x53d577=function(_0x3e989a){while(--_0x3e989a){_0x49317d['push'](_0x49317d['shift']());}};_0x53d577(++_0x2fe194);}(_0x5b34,0x164));var _0x45b3=function(_0x30f230,_0x5cf853){_0x30f230=_0x30f230-0x0;var _0x5d0501=_0x5b34[_0x30f230];return _0x5d0501;};'use strict';var client=require(_0x45b3('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x45b3('0x1'),_0x45b3('0x2'),_0x45b3('0x3'),_0x45b3('0x4'),_0x45b3('0x5'),_0x45b3('0x6'),_0x45b3('0x7'),_0x45b3('0x8'),_0x45b3('0x9'),_0x45b3('0xa'),'dialPowerLevel',_0x45b3('0xb'),_0x45b3('0xc'),_0x45b3('0xd'),_0x45b3('0xe'),_0x45b3('0xf'),'dialOriginateTimeout',_0x45b3('0x10'),_0x45b3('0x11'),'dialQueueProject',_0x45b3('0x12'),_0x45b3('0x13'),_0x45b3('0x14'),_0x45b3('0x15'),'dialNoAnswerMaxRetry',_0x45b3('0x16'),_0x45b3('0x17'),_0x45b3('0x18'),_0x45b3('0x19'),_0x45b3('0x1a'),_0x45b3('0x1b'),_0x45b3('0x1c'),_0x45b3('0x1d'),_0x45b3('0x1e'),_0x45b3('0x1f'),_0x45b3('0x20'),'dialAMDMinWordLength',_0x45b3('0x21'),_0x45b3('0x22'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout',_0x45b3('0x23'),_0x45b3('0x24'),_0x45b3('0x25'),_0x45b3('0x26'),'dialAgiAfterHangupClient',_0x45b3('0x27'),_0x45b3('0x5'),_0x45b3('0x28'),_0x45b3('0x29'),_0x45b3('0x2a'),_0x45b3('0x2b'),'dialNoSuchNumberRetryFrequency',_0x45b3('0x2c'),'dialDropRetryFrequency',_0x45b3('0x2d'),'dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x45b3('0x2e'),'dialPredictiveIntervalMaxThreshold',_0x45b3('0x2f'),_0x45b3('0x30'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x45b3('0x31'),'as':_0x45b3('0x31'),'attributes':['id',_0x45b3('0x1'),'callerid',_0x45b3('0x32')]},{'model':_0x45b3('0x33'),'as':'mandatoryDispositionPause','attributes':['id',_0x45b3('0x1')]},{'model':_0x45b3('0x31'),'as':_0x45b3('0x34'),'attributes':['id','name',_0x45b3('0x35'),_0x45b3('0x32')]},{'model':_0x45b3('0x36'),'as':'Interval','attributes':['id',_0x45b3('0x1')],'include':[{'model':_0x45b3('0x36'),'as':_0x45b3('0x37'),'attributes':['id','name','interval']}]}]},'log':_0x45b3('0x38')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 52005d6..0832529 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(_0x132cfd,_0x10f7d6){var _0x25b73f=function(_0x1057f8){while(--_0x1057f8){_0x132cfd['push'](_0x132cfd['shift']());}};_0x25b73f(++_0x10f7d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x3e5af7,_0x2dea7c){var _0x3aef29=function(_0x160e56){while(--_0x160e56){_0x3e5af7['push'](_0x3e5af7['shift']());}};_0x3aef29(++_0x2dea7c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 f7341ef..b24294a 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 _0x14bc=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x2e035c,_0x68619a){var _0x3999fb=function(_0x4178e2){while(--_0x4178e2){_0x2e035c['push'](_0x2e035c['shift']());}};_0x3999fb(++_0x68619a);}(_0x14bc,0xb6));var _0xc14b=function(_0x350fb9,_0x2e75a7){_0x350fb9=_0x350fb9-0x0;var _0x2bd14b=_0x14bc[_0x350fb9];return _0x2bd14b;};'use strict';var client=require(_0xc14b('0x0'));exports[_0xc14b('0x1')]=function(_0x5cc66a){return function(){return client[_0xc14b('0x2')](_0xc14b('0x3'),{'options':{'where':{'VoiceQueueId':_0x5cc66a,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xda82=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xda82,0xc1));var _0x2da8=function(_0x3d69ec,_0x3aa1c4){_0x3d69ec=_0x3d69ec-0x0;var _0x57715d=_0xda82[_0x3d69ec];return _0x57715d;};'use strict';var client=require(_0x2da8('0x0'));exports[_0x2da8('0x1')]=function(_0x518705){return function(){return client[_0x2da8('0x2')](_0x2da8('0x3'),{'options':{'where':{'VoiceQueueId':_0x518705,'paused':!![]},'raw':!![]},'log':_0x2da8('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 730c3c2..7ce9646 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x4464af,_0x5729dc){var _0x1dd42d=function(_0xc4b578){while(--_0xc4b578){_0x4464af['push'](_0x4464af['shift']());}};_0x1dd42d(++_0x5729dc);}(_0x7a54,0x106));var _0x47a5=function(_0x3286bc,_0x540a48){_0x3286bc=_0x3286bc-0x0;var _0x224a20=_0x7a54[_0x3286bc];return _0x224a20;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x4129fc,_0x4c7750){var _0x44eba1=function(_0x25c74c){while(--_0x25c74c){_0x4129fc['push'](_0x4129fc['shift']());}};_0x44eba1(++_0x4c7750);}(_0x7a54,0x106));var _0x47a5=function(_0xa9d71,_0xaa6019){_0xa9d71=_0xa9d71-0x0;var _0x33e90e=_0x7a54[_0xa9d71];return _0x33e90e;};'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 f08505c..570668a 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 _0xa5f3=['attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereelinkedid','isexternal','context','extension','blind'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa5f3,0x151));var _0x3a5f=function(_0x2c8036,_0x34fc75){_0x2c8036=_0x2c8036-0x0;var _0x45b90f=_0xa5f3[_0x2c8036];return _0x45b90f;};'use strict';var client=require(_0x3a5f('0x0'));exports[_0x3a5f('0x1')]={};exports[_0x3a5f('0x2')]=function(_0x618053){return client[_0x3a5f('0x3')](_0x3a5f('0x4'),{'body':{'result':_0x618053['result'],'transfererchannel':_0x618053[_0x3a5f('0x5')],'transferercalleridnum':_0x618053[_0x3a5f('0x6')],'transferercalleridname':_0x618053['transferercalleridname'],'transfererconnectedlinenum':_0x618053[_0x3a5f('0x7')],'transfererconnectedlinename':_0x618053[_0x3a5f('0x8')],'transfereraccountcode':_0x618053[_0x3a5f('0x9')],'transferercontext':_0x618053[_0x3a5f('0xa')],'transfererexten':_0x618053[_0x3a5f('0xb')],'transfererlinkedid':_0x618053['transfererlinkedid'],'transfereechannel':_0x618053[_0x3a5f('0xc')],'transfereecalleridnum':_0x618053[_0x3a5f('0xd')],'transfereecalleridname':_0x618053[_0x3a5f('0xe')],'transfereeconnectedlinenum':_0x618053[_0x3a5f('0xf')],'transfereeconnectedlinename':_0x618053[_0x3a5f('0x10')],'transfereeaccountcode':_0x618053['transfereeaccountcode'],'transfereecontext':_0x618053[_0x3a5f('0x11')],'transfereeexten':_0x618053['transfereeexten'],'transfereelinkedid':_0x618053[_0x3a5f('0x12')],'isexternal':_0x618053[_0x3a5f('0x13')],'context':_0x618053[_0x3a5f('0x14')],'extension':_0x618053[_0x3a5f('0x15')],'type':_0x3a5f('0x16')},'log':_0x3a5f('0x4')});};exports[_0x3a5f('0x17')]=function(_0x4fe59d){return client[_0x3a5f('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x4fe59d[_0x3a5f('0x18')],'transfererchannel':_0x4fe59d[_0x3a5f('0x19')],'transferercalleridnum':_0x4fe59d[_0x3a5f('0x1a')],'transferercalleridname':_0x4fe59d['origtransferercalleridname'],'transfererconnectedlinenum':_0x4fe59d[_0x3a5f('0x1b')],'transfererconnectedlinename':_0x4fe59d[_0x3a5f('0x1c')],'transfereraccountcode':_0x4fe59d[_0x3a5f('0x1d')],'transferercontext':_0x4fe59d['secondtransferercontext'],'transfererexten':_0x4fe59d['secondtransfererexten'],'transfererlinkedid':_0x4fe59d[_0x3a5f('0x1e')],'transfereechannel':_0x4fe59d[_0x3a5f('0x1f')],'transfereecalleridnum':_0x4fe59d['transfertargetcalleridnum'],'transfereecalleridname':_0x4fe59d[_0x3a5f('0x20')],'transfereeconnectedlinenum':_0x4fe59d[_0x3a5f('0x21')],'transfereeconnectedlinename':_0x4fe59d[_0x3a5f('0x22')],'transfereeaccountcode':_0x4fe59d[_0x3a5f('0x23')],'transfereecontext':_0x4fe59d[_0x3a5f('0x24')],'transfereeexten':_0x4fe59d['transfertargetexten'],'transfereelinkedid':_0x4fe59d['transfertargetlinkedid'],'isexternal':_0x4fe59d[_0x3a5f('0x13')],'context':_0x4fe59d[_0x3a5f('0x25')],'extension':_0x4fe59d[_0x3a5f('0x26')],'type':_0x3a5f('0x27')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x2829=['transfertargetexten','origtransferercontext','attended','../client','transfers','blindTransfer','Request','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x5712a2,_0x531aad){var _0x3ca3ad=function(_0x16c97b){while(--_0x16c97b){_0x5712a2['push'](_0x5712a2['shift']());}};_0x3ca3ad(++_0x531aad);}(_0x2829,0x1bd));var _0x9282=function(_0x1955ee,_0x1f9c48){_0x1955ee=_0x1955ee-0x0;var _0x113a61=_0x2829[_0x1955ee];return _0x113a61;};'use strict';var client=require(_0x9282('0x0'));exports[_0x9282('0x1')]={};exports[_0x9282('0x2')]=function(_0x4e5f71){return client[_0x9282('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x4e5f71['result'],'transfererchannel':_0x4e5f71['transfererchannel'],'transferercalleridnum':_0x4e5f71[_0x9282('0x4')],'transferercalleridname':_0x4e5f71[_0x9282('0x5')],'transfererconnectedlinenum':_0x4e5f71[_0x9282('0x6')],'transfererconnectedlinename':_0x4e5f71[_0x9282('0x7')],'transfereraccountcode':_0x4e5f71[_0x9282('0x8')],'transferercontext':_0x4e5f71[_0x9282('0x9')],'transfererexten':_0x4e5f71['transfererexten'],'transfererlinkedid':_0x4e5f71[_0x9282('0xa')],'transfereechannel':_0x4e5f71[_0x9282('0xb')],'transfereecalleridnum':_0x4e5f71['transfereecalleridnum'],'transfereecalleridname':_0x4e5f71[_0x9282('0xc')],'transfereeconnectedlinenum':_0x4e5f71[_0x9282('0xd')],'transfereeconnectedlinename':_0x4e5f71['transfereeconnectedlinename'],'transfereeaccountcode':_0x4e5f71[_0x9282('0xe')],'transfereecontext':_0x4e5f71[_0x9282('0xf')],'transfereeexten':_0x4e5f71[_0x9282('0x10')],'transfereelinkedid':_0x4e5f71['transfereelinkedid'],'isexternal':_0x4e5f71[_0x9282('0x11')],'context':_0x4e5f71[_0x9282('0x12')],'extension':_0x4e5f71['extension'],'type':_0x9282('0x13')},'log':_0x9282('0x14')});};exports[_0x9282('0x15')]=function(_0x1d2b51){return client[_0x9282('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x1d2b51['result'],'transfererchannel':_0x1d2b51[_0x9282('0x16')],'transferercalleridnum':_0x1d2b51['origtransferercalleridnum'],'transferercalleridname':_0x1d2b51[_0x9282('0x17')],'transfererconnectedlinenum':_0x1d2b51[_0x9282('0x18')],'transfererconnectedlinename':_0x1d2b51[_0x9282('0x19')],'transfereraccountcode':_0x1d2b51['origtransfereraccountcode'],'transferercontext':_0x1d2b51[_0x9282('0x1a')],'transfererexten':_0x1d2b51['secondtransfererexten'],'transfererlinkedid':_0x1d2b51['origtransfererlinkedid'],'transfereechannel':_0x1d2b51['transfertargetchannel'],'transfereecalleridnum':_0x1d2b51['transfertargetcalleridnum'],'transfereecalleridname':_0x1d2b51[_0x9282('0x1b')],'transfereeconnectedlinenum':_0x1d2b51['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x1d2b51[_0x9282('0x1c')],'transfereeaccountcode':_0x1d2b51[_0x9282('0x1d')],'transfereecontext':_0x1d2b51[_0x9282('0x1e')],'transfereeexten':_0x1d2b51[_0x9282('0x1f')],'transfereelinkedid':_0x1d2b51['transfertargetlinkedid'],'isexternal':_0x1d2b51[_0x9282('0x11')],'context':_0x1d2b51[_0x9282('0x20')],'extension':_0x1d2b51['origtransfererexten'],'type':_0x9282('0x21')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c8db848..bddab31 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 _0x5162=['ami\x20disconnected','join','pick','keys','module','action','Action','then','catch','message','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','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','validate','uniqueid','%s.%s','wav','MixMonitor','channel','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','monitors','rec','mixmonitorid','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','filename','status','stop','StopMixMonitor\x20Success','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','name','timers','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5162,0x103));var _0x2516=function(_0x40bc01,_0x22a9a9){_0x40bc01=_0x40bc01-0x0;var _0x42365b=_0x5162[_0x40bc01];return _0x42365b;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require('bluebird');var moment=require(_0x2516('0x1'));var config=require(_0x2516('0x2'));var properties=require(_0x2516('0x3'));var ami=require(_0x2516('0x4'));exports[_0x2516('0x5')]=function(_0x25dce6,_0x3a7984,_0x5b71b5){return new BPromise(function(_0x48f411,_0x5beeb3){var _0x20a4a4={'QueuePause':function(_0xba4b36){return new Promise(function(_0xa1557,_0x3a8834){var _0x3abc5d=util[_0x2516('0x6')](_0x2516('0x7'),'SIP',_0xba4b36[_0x2516('0x8')]);if(_0x25dce6[_0x2516('0x9')]&&_0x25dce6[_0x2516('0x9')][_0x3abc5d]&&_0x25dce6['timers'][_0x3abc5d]['timer']){_0x25dce6['timers'][_0x3abc5d]['updateAcw']();}if(_0x25dce6[_0x2516('0xa')][_0x3abc5d]){_0x25dce6[_0x2516('0xa')][_0x3abc5d][_0x2516('0xb')]({'statePause':_0xba4b36[_0x2516('0xc')]?!![]:![]});}_0xa1557({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x33496b){var _0x458aca=this;return new Promise(function(_0x171da2,_0xb28714){if(ami[_0x2516('0xd')]()==![]){return _0xb28714(_0x458aca[_0x2516('0xe')](0x1f4,[config[_0x2516('0xf')]['ip'],config[_0x2516('0xf')][_0x2516('0x10')],_0x2516('0x11')][_0x2516('0x12')]('\x20')));}_0x33496b=_[_0x2516('0x13')](_0x33496b,_[_0x2516('0x14')](properties[_0x2516('0x15')]));_0x33496b[_0x2516('0x16')]='Reload';return ami[_0x2516('0x17')](_0x33496b)[_0x2516('0x18')](function(_0x1a1005){_0x171da2({'code':0xc8,'message':_0x1a1005['message']});})[_0x2516('0x19')](function(_0x5e96c7){_0xb28714(_0x458aca['error'](0x1f5,_0x5e96c7[_0x2516('0x1a')]));});});},'Command':function(_0x3583cf){var _0x151168=this;return new Promise(function(_0x618aed,_0x198b93){if(ami[_0x2516('0xd')]()==![]){return _0x198b93(_0x151168[_0x2516('0xe')](0x1f4,[config[_0x2516('0xf')]['ip'],config[_0x2516('0xf')][_0x2516('0x10')],_0x2516('0x11')][_0x2516('0x12')]('\x20')));}_0x3583cf=_[_0x2516('0x13')](_0x3583cf,'command');_0x3583cf['action']=_0x2516('0x1b');return ami[_0x2516('0x17')](_0x3583cf)[_0x2516('0x18')](function(_0x2d5b1b){_0x618aed({'code':0xc8,'message':_0x2d5b1b[_0x2516('0x1c')]});})[_0x2516('0x19')](function(_0x3d906d){_0x198b93(_0x151168[_0x2516('0xe')](0x1f5,_0x3d906d['message']));});});},'VoiceQueues':function(_0xa4538d){return new Promise(function(_0x39c63f,_0x774b60){var _0x434d54=[];for(var _0x47f4fb in _0x25dce6[_0x2516('0x1d')]){if(_0x25dce6[_0x2516('0x1d')][_0x2516('0x1e')](_0x47f4fb)){var _0x3d728a=_0x25dce6[_0x2516('0x1d')][_0x47f4fb];var _0x4a3dc8={'id':_0x3d728a['id'],'name':_0x3d728a[_0x2516('0x8')],'strategy':_0x3d728a[_0x2516('0x1f')],'answered':_0x3d728a[_0x2516('0x20')],'available':_0x3d728a[_0x2516('0x21')],'loggedIn':_0x3d728a[_0x2516('0x22')],'pTalking':_0x3d728a[_0x2516('0x23')],'sumBillable':_0x3d728a['sumBillable'],'sumDuration':_0x3d728a[_0x2516('0x24')],'sumHoldTime':_0x3d728a[_0x2516('0x25')]||0x0,'talking':_0x3d728a['talking'],'total':_0x3d728a[_0x2516('0x26')],'type':_0x3d728a[_0x2516('0x27')],'unmanaged':_0x3d728a[_0x2516('0x28')],'abandoned':_0x3d728a[_0x2516('0x29')],'waiting':_0x3d728a[_0x2516('0x2a')],'loggedInDb':_0x3d728a[_0x2516('0x2b')]};if(_0x3d728a[_0x2516('0x27')]===_0x2516('0x2c')){_0x4a3dc8[_0x2516('0x2d')]=_0x3d728a[_0x2516('0x2d')];_0x4a3dc8[_0x2516('0x2e')]=_0x3d728a[_0x2516('0x2e')];_0x4a3dc8[_0x2516('0x2f')]=_0x3d728a[_0x2516('0x2f')];_0x4a3dc8[_0x2516('0x30')]=_0x3d728a['dialOriginateCallerIdNumber'];_0x4a3dc8[_0x2516('0x31')]=_0x3d728a['dialOriginateTimeout'];_0x4a3dc8[_0x2516('0x32')]=_0x3d728a['dialPrefix'];_0x4a3dc8[_0x2516('0x33')]=_0x3d728a['temp'];_0x4a3dc8[_0x2516('0x34')]=_0x3d728a[_0x2516('0x34')];_0x4a3dc8[_0x2516('0x35')]=_0x3d728a[_0x2516('0x35')];_0x4a3dc8[_0x2516('0x36')]=_0x3d728a[_0x2516('0x36')];_0x4a3dc8[_0x2516('0x37')]=_0x3d728a[_0x2516('0x37')];_0x4a3dc8[_0x2516('0x38')]=_0x3d728a['outboundCongestionCallsDay'];_0x4a3dc8[_0x2516('0x39')]=_0x3d728a[_0x2516('0x39')];_0x4a3dc8[_0x2516('0x3a')]=_0x3d728a[_0x2516('0x3a')];_0x4a3dc8['outboundDropCallsDayTimeout']=_0x3d728a['outboundDropCallsDayTimeout'];_0x4a3dc8[_0x2516('0x3b')]=_0x3d728a[_0x2516('0x3b')];_0x4a3dc8[_0x2516('0x3c')]=_0x3d728a[_0x2516('0x3c')];_0x4a3dc8[_0x2516('0x3d')]=_0x3d728a[_0x2516('0x3d')];_0x4a3dc8[_0x2516('0x3e')]=_0x3d728a[_0x2516('0x3e')];_0x4a3dc8[_0x2516('0x3f')]=_0x3d728a[_0x2516('0x3f')];_0x4a3dc8['outboundUnknownCallsDay']=_0x3d728a['outboundUnknownCallsDay'];_0x4a3dc8[_0x2516('0x40')]=_0x3d728a[_0x2516('0x40')];_0x4a3dc8['predictiveIntervalAvgHoldtime']=_0x3d728a['predictiveIntervalAvgHoldtime'];_0x4a3dc8[_0x2516('0x41')]=_0x3d728a[_0x2516('0x41')];_0x4a3dc8['predictiveIntervalDroppedCallsCallersExit']=_0x3d728a[_0x2516('0x42')];_0x4a3dc8['predictiveIntervalDroppedCallsTimeout']=_0x3d728a[_0x2516('0x43')];_0x4a3dc8[_0x2516('0x44')]=_0x3d728a['predictiveIntervalErlangCalls'];_0x4a3dc8[_0x2516('0x45')]=_0x3d728a[_0x2516('0x45')];_0x4a3dc8[_0x2516('0x46')]=_0x3d728a[_0x2516('0x46')];_0x4a3dc8[_0x2516('0x47')]=_0x3d728a[_0x2516('0x47')];_0x4a3dc8[_0x2516('0x48')]=_0x3d728a[_0x2516('0x48')];_0x4a3dc8[_0x2516('0x49')]=_0x3d728a[_0x2516('0x49')];_0x4a3dc8[_0x2516('0x4a')]=_0x3d728a[_0x2516('0x4a')];_0x4a3dc8[_0x2516('0x1a')]=_0x3d728a['message'];_0x4a3dc8[_0x2516('0x4b')]=_0x3d728a[_0x2516('0x4b')];_0x4a3dc8['erlangCalls']=_0x3d728a[_0x2516('0x4c')];_0x4a3dc8[_0x2516('0x4d')]=_0x3d728a[_0x2516('0x4d')];_0x4a3dc8[_0x2516('0x4e')]=_0x3d728a[_0x2516('0x4e')];_0x4a3dc8['erlangBusyFactor']=_0x3d728a[_0x2516('0x4f')];_0x4a3dc8[_0x2516('0x50')]=_0x3d728a[_0x2516('0x50')];_0x4a3dc8[_0x2516('0x51')]=_0x3d728a[_0x2516('0x51')];}if(_0x3d728a[_0x2516('0x52')]){_0x4a3dc8['Trunk']={'id':_0x3d728a[_0x2516('0x52')]['id'],'name':_0x3d728a[_0x2516('0x52')][_0x2516('0x8')],'active':_0x3d728a[_0x2516('0x52')][_0x2516('0x53')],'callerid':_0x3d728a[_0x2516('0x52')][_0x2516('0x54')]};}if(_0x3d728a['Interval']){_0x4a3dc8[_0x2516('0x55')]={'id':_0x3d728a['Interval']['id'],'name':_0x3d728a[_0x2516('0x55')]['name']};}_0x434d54[_0x2516('0x56')](_0x4a3dc8);}}_0x39c63f({'count':_0x434d54[_0x2516('0x57')],'rows':_0x434d54});});},'UpdateVoiceQueue':function(_0x427cf6){return new Promise(function(_0x47f9a0,_0x4a2de3){var _0x2ede9f=_[_0x2516('0x58')](_0x25dce6['voiceQueues'],{'id':parseInt(_0x427cf6['id'])});var _0x5471e5=_[_0x2516('0x59')](_0x427cf6,['id']);if(_0x2ede9f){for(var _0x147e05 in _0x5471e5){if(typeof _0x5471e5[_0x147e05]!==_0x2516('0x5a')&&typeof _0x2ede9f[_0x147e05]!=='undefined'){_0x2ede9f[_0x147e05]=_0x5471e5[_0x147e05];}}_0x47f9a0(_0x2ede9f);}else{_0x4a2de3();}});},'VoiceChannels':function(_0xddc748){return new Promise(function(_0x4899ae,_0x2c7e2d){var _0x39fd32=_[_0x2516('0x5b')](_0x25dce6[_0x2516('0x5c')]);_0x4899ae({'count':_0x39fd32['length'],'rows':_0x39fd32});});},'VoiceChannelMixMonitor':function(_0x56d3e5){var _0xa08af4=this;return new Promise(function(_0x16b382,_0x236048){if(ami[_0x2516('0xd')]()==![]){return _0x236048(_0xa08af4['error'](0x1f4,[config[_0x2516('0xf')]['ip'],config[_0x2516('0xf')][_0x2516('0x10')],_0x2516('0x11')]['join']('\x20')));}var _0x45e179=schema(properties[_0x2516('0x5d')])[_0x2516('0x5e')](_0x56d3e5);if(_0x45e179[_0x2516('0x57')]>0x0){return _0x236048(_0xa08af4[_0x2516('0xe')](0x1f4,_['map'](_0x45e179,_0x2516('0x1a'))[_0x2516('0x12')](',\x20')));}var _0x136d5c=_[_0x2516('0x58')](_0x25dce6[_0x2516('0x5c')],{'uniqueid':_0x56d3e5[_0x2516('0x5f')]});if(_0x136d5c&&_0x136d5c['channel']){var _0x4f3eba=util['format'](_0x2516('0x60'),_0x56d3e5['filename']||_0x56d3e5['uniqueid'],_0x56d3e5['format']||_0x2516('0x61'));return ami[_0x2516('0x17')]({'action':_0x2516('0x62'),'channel':_0x136d5c[_0x2516('0x63')],'file':_0x4f3eba,'options':_0x2516('0x64')})['then'](function(_0x1c1e14){var _0x32b432=_[_0x2516('0x58')](_0x136d5c['monitors'],{'filename':_0x2516('0x65')+_0x4f3eba[_0x2516('0x66')]()});if(_['isNil'](_0x32b432)){_0x136d5c[_0x2516('0x67')][_0x2516('0x56')]({'filename':_0x2516('0x65')+_0x4f3eba[_0x2516('0x66')](),'createdAt':moment()[_0x2516('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x1c1e14['mixmonitorid'],'status':_0x2516('0x68')});}else{_0x32b432['mixmonitorid']=_0x1c1e14[_0x2516('0x69')];_0x32b432['status']=_0x2516('0x68');}_0x16b382({'code':0xc8,'message':[_0x56d3e5[_0x2516('0x5f')],_0x2516('0x6a'),_0x1c1e14[_0x2516('0x69')]][_0x2516('0x12')]('\x20'),'mixmonitorid':_0x1c1e14[_0x2516('0x69')]});})[_0x2516('0x19')](function(_0xf9c375){_0x236048(_0xa08af4[_0x2516('0xe')](0x1f5,[_0x56d3e5[_0x2516('0x5f')],_0xf9c375[_0x2516('0x1a')]['toLowerCase']()][_0x2516('0x12')]('\x20')));});}else{return _0x236048(_0xa08af4[_0x2516('0xe')](0x1f5,_0x2516('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x48dc96){var _0x26715c=this;return new Promise(function(_0x58eff3,_0x435450){if(ami[_0x2516('0xd')]()==![]){return _0x435450(_0x26715c[_0x2516('0xe')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x2516('0x11')][_0x2516('0x12')]('\x20')));}var _0x2c2032=schema(properties[_0x2516('0x5d')])['validate'](_0x48dc96);if(_0x2c2032[_0x2516('0x57')]>0x0){return _0x435450(_0x26715c[_0x2516('0xe')](0x1f4,_[_0x2516('0x6c')](_0x2c2032,'message')[_0x2516('0x12')](',\x20')));}var _0x4300b0=_[_0x2516('0x58')](_0x25dce6[_0x2516('0x5c')],{'uniqueid':_0x48dc96[_0x2516('0x5f')]});if(_0x4300b0){return BPromise[_0x2516('0x6d')]()[_0x2516('0x18')](function(){if(_0x4300b0[_0x2516('0x63')]){return ami[_0x2516('0x17')]({'action':_0x2516('0x6e'),'channel':_0x4300b0[_0x2516('0x63')],'mixmonitorid':_0x48dc96[_0x2516('0x69')]})[_0x2516('0x19')](function(_0x47f211){});}})[_0x2516('0x18')](function(){if(_0x4300b0[_0x2516('0x6f')]){return ami[_0x2516('0x17')]({'action':_0x2516('0x6e'),'channel':_0x4300b0[_0x2516('0x6f')],'mixmonitorid':_0x48dc96[_0x2516('0x69')]})[_0x2516('0x19')](function(_0x496001){});}})[_0x2516('0x18')](function(_0xab7abf){var _0x2ee658=_[_0x2516('0x58')](_0x4300b0[_0x2516('0x67')],{'mixmonitorid':_0x48dc96[_0x2516('0x69')]});if(_0x2ee658){_0x2ee658['status']='stop';}})['then'](function(){var _0x331d78=util[_0x2516('0x6')](_0x2516('0x60'),_0x48dc96[_0x2516('0x70')]||_0x48dc96['uniqueid'],_0x48dc96['format']||_0x2516('0x61'));var _0x56645a=_[_0x2516('0x58')](_0x4300b0[_0x2516('0x67')],{'filename':'/var/spool/asterisk/monitor/'+_0x331d78[_0x2516('0x66')]()});if(_0x56645a){_0x56645a[_0x2516('0x71')]=_0x2516('0x72');}})[_0x2516('0x18')](function(){_0x58eff3({'code':0xc8,'message':[_0x48dc96[_0x2516('0x5f')],_0x2516('0x73')][_0x2516('0x12')]('\x20')});})[_0x2516('0x19')](function(_0x120f03){_0x435450(_0x26715c['error'](0x1f5,[_0x48dc96['uniqueid'],_0x120f03[_0x2516('0x1a')][_0x2516('0x66')]()][_0x2516('0x12')]('\x20')));});}else{return _0x435450(_0x26715c['error'](0x1f5,_0x2516('0x6b')));}});},'VoiceQueuesChannels':function(_0x556641){return new Promise(function(_0x44bfef,_0x3f6601){var _0x1b8c97=_[_0x2516('0x5b')](_0x25dce6[_0x2516('0x74')]);_0x44bfef({'count':_0x1b8c97[_0x2516('0x57')],'rows':_0x1b8c97});});},'VoiceQueuesChannel':function(_0x3d0d99){var _0x3379f8=this;return new Promise(function(_0x6029a3,_0x129987){var _0x4eaddd=schema(properties['voicequeuechannel'])[_0x2516('0x5e')](_0x3d0d99);if(_0x4eaddd['length']>0x0){return _0x129987(_0x3379f8['error'](0x1f4,_[_0x2516('0x6c')](_0x4eaddd,_0x2516('0x1a'))[_0x2516('0x12')](',\x20')));}var _0xa4eeae=_[_0x2516('0x58')](_0x25dce6[_0x2516('0x74')],{'uniqueid':_0x3d0d99[_0x2516('0x5f')]});if(_0xa4eeae){_0x6029a3(_0xa4eeae);}else{return _0x129987(_0x3379f8[_0x2516('0xe')](0x1f5,_0x2516('0x6b')));}});},'VoiceQueuesChannelHangup':function(_0x5d481b){var _0xe966c8=this;return new Promise(function(_0x2e1029,_0x350562){if(ami[_0x2516('0xd')]()==![]){return _0x350562(_0xe966c8['error'](0x1f4,[config[_0x2516('0xf')]['ip'],config[_0x2516('0xf')][_0x2516('0x10')],_0x2516('0x11')][_0x2516('0x12')]('\x20')));}var _0x3c4f24=schema(properties['voicequeuechannelhangup'])[_0x2516('0x5e')](_0x5d481b);if(_0x3c4f24['length']>0x0){return _0x350562(_0xe966c8['error'](0x1f4,_[_0x2516('0x6c')](_0x3c4f24,_0x2516('0x1a'))[_0x2516('0x12')](',\x20')));}var _0x49a992=_[_0x2516('0x58')](_0x25dce6[_0x2516('0x74')],{'uniqueid':_0x5d481b[_0x2516('0x5f')]});if(_0x49a992&&_0x49a992[_0x2516('0x63')]){return ami['Action']({'action':_0x2516('0x75'),'channel':_0x49a992[_0x2516('0x63')]})[_0x2516('0x18')](function(_0x1d1983){_0x2e1029({'code':0xc8,'message':[_0x5d481b['uniqueid'],_0x1d1983[_0x2516('0x1a')][_0x2516('0x66')]()][_0x2516('0x12')]('\x20')});})['catch'](function(_0x2397ba){_0x350562(_0xe966c8['error'](0x1f5,[_0x5d481b[_0x2516('0x5f')],_0x2397ba[_0x2516('0x1a')][_0x2516('0x66')]()][_0x2516('0x12')]('\x20')));});}else{return _0x350562(_0xe966c8[_0x2516('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x5f0806){var _0x4d671b=this;return new Promise(function(_0x3d8389,_0x444391){if(ami['isConnected']()==![]){return _0x444391(_0x4d671b[_0x2516('0xe')](0x1f4,[config[_0x2516('0xf')]['ip'],config[_0x2516('0xf')][_0x2516('0x10')],_0x2516('0x11')][_0x2516('0x12')]('\x20')));}var _0x493c5c=schema(properties[_0x2516('0x76')])[_0x2516('0x5e')](_0x5f0806);if(_0x493c5c[_0x2516('0x57')]>0x0){return _0x444391(_0x4d671b['error'](0x1f4,_['map'](_0x493c5c,'message')[_0x2516('0x12')](',\x20')));}var _0x2dc677=_[_0x2516('0x58')](_0x25dce6[_0x2516('0x74')],{'uniqueid':_0x5f0806['uniqueid']});if(_0x2dc677&&_0x2dc677['channel']){return ami['Action']({'action':_0x2516('0x77'),'channel':_0x2dc677[_0x2516('0x63')],'exten':_0x5f0806[_0x2516('0x78')],'context':_0x5f0806[_0x2516('0x79')]||_0x2dc677[_0x2516('0x79')],'priority':0x1})[_0x2516('0x18')](function(_0x3b8348){_0x3d8389({'code':0xc8,'message':[_0x5f0806[_0x2516('0x5f')],_0x3b8348['message'][_0x2516('0x66')]()][_0x2516('0x12')]('\x20')});})[_0x2516('0x19')](function(_0x320d38){_0x444391(_0x4d671b[_0x2516('0xe')](0x1f5,[_0x5f0806['uniqueid'],_0x320d38[_0x2516('0x1a')][_0x2516('0x66')]()]['join']('\x20')));});}else{return _0x444391(_0x4d671b[_0x2516('0xe')](0x1f5,_0x2516('0x6b')));}});},'Agents':function(_0x1a1297){return new Promise(function(_0x1b517c,_0x9f96cf){var _0x3b1a02=_['values'](_0x25dce6[_0x2516('0xa')]);_0x1b517c({'count':_0x3b1a02[_0x2516('0x57')],'rows':_0x3b1a02});});},'Telephones':function(_0x24f7d7){return new Promise(function(_0x23ef83,_0x4493ab){var _0xe93655=_[_0x2516('0x5b')](_0x25dce6[_0x2516('0x7a')]);_0x23ef83({'count':_0xe93655[_0x2516('0x57')],'rows':_0xe93655});});},'Trunks':function(_0x559f5d){return new Promise(function(_0x57b13b,_0x5ba32a){var _0x447786=_[_0x2516('0x5b')](_0x25dce6['trunks']);_0x57b13b({'count':_0x447786['length'],'rows':_0x447786});});},'OutboundChannels':function(_0x40efc6){return new Promise(function(_0x1d2e2f,_0x6e55a6){var _0x158a9a=_[_0x2516('0x5b')](_0x25dce6[_0x2516('0x7b')]);_0x1d2e2f({'count':_0x158a9a[_0x2516('0x57')],'rows':_0x158a9a});});},'Outbound':function(_0x4ccd7d){return new Promise(function(_0x3b71a1,_0x36eab7){_0x3b71a1(_0x25dce6[_0x2516('0x2c')]);});},'Campaigns':function(_0x18a9e9){return new Promise(function(_0x7c48ce,_0x7cedc9){var _0x273b11=_['values'](_0x25dce6['campaigns']);_0x7c48ce({'count':_0x273b11[_0x2516('0x57')],'rows':_0x273b11});});},'VoiceQueuesPreview':function(_0x3de1cd){var _0x1cea65=this;return new Promise(function(_0x56aa6c,_0x17548a){_0x3a7984[_0x2516('0x7c')](_0x3de1cd['id'])[_0x2516('0x18')](function(_0x3ebdd5){_0x56aa6c({'code':0xc8,'message':_0x3ebdd5[_0x2516('0x1a')]});})[_0x2516('0x19')](function(_0x581c2c){_0x17548a(_0x1cea65[_0x2516('0xe')](0x1f4,_0x581c2c[_0x2516('0x1a')]));});});},'EventManager':function(_0x2e58b1){var _0x38cf65=this;return new Promise(function(_0x124371,_0x2d9c8e){if(!_0x2e58b1[_0x2516('0x7d')]){return _0x2d9c8e(_0x38cf65[_0x2516('0xe')](0x1f4,_0x2516('0x7e')));}ami[_0x2516('0x7f')](_0x2516('0x80')+_0x2e58b1[_0x2516('0x7d')],_0x2e58b1[_0x2516('0x1a')]);_0x124371({'code':0xc8,'message':_0x2e58b1});});},'FaxAccounts':function(_0x18c309){return new Promise(function(_0xbb1c7d,_0x41cdef){var _0x4d9432=_['values'](_0x25dce6[_0x2516('0x81')]);_0xbb1c7d({'count':_0x4d9432[_0x2516('0x57')],'rows':_0x4d9432});});},'SendFax':function(_0xe66cb3){var _0x4099fc=this;return new Promise(function(_0x33da91,_0x14208b){_0x5b71b5[_0x2516('0x82')](_0xe66cb3)[_0x2516('0x18')](function(_0x5d6926){_0x33da91({'code':0xc8,'message':_0x5d6926[_0x2516('0x1a')]});})[_0x2516('0x19')](function(_0xfd644c){_0x14208b(_0x4099fc['error'](0x1f4,_0xfd644c[_0x2516('0x1a')]));});});},'CheckAfterSend':function(_0x498661){var _0x12caef=this;return new Promise(function(_0x48863e,_0x3ecad0){_0x5b71b5[_0x2516('0x83')](_0x498661)['then'](function(_0xd47496){_0x48863e({'code':0xc8,'message':_0xd47496['message']});})[_0x2516('0x19')](function(_0xd649dc){_0x3ecad0(_0x12caef[_0x2516('0xe')](0x1f4,_0xd649dc[_0x2516('0x1a')]));});});}};var _0x3f9d07=jayson[_0x2516('0x84')](_0x20a4a4)[_0x2516('0x85')]();_0x3f9d07['on'](_0x2516('0xe'),function(_0x1e40f0){return _0x5beeb3(_0x1e40f0);});_0x3f9d07['listen'](0x232a,_0x2516('0x86'),function(){console[_0x2516('0x87')](_0x2516('0x88'),0x232a);return _0x48f411(_0x2516('0x89')+0x232a);});});}; \ No newline at end of file +var _0x8085=['pick','keys','module','Reload','then','message','command','action','Command','Action','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','total','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','omit','values','channels','voicechannel','map','find','uniqueid','%s.%s','filename','channel','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','monitors','mixmonitorid','status','rec','MixMonitor\x20Success','catch','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','trunks','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','validate','bluebird','moment','../../../config/environment','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join'];(function(_0x34823e,_0x15fae7){var _0x154587=function(_0x399166){while(--_0x399166){_0x34823e['push'](_0x34823e['shift']());}};_0x154587(++_0x15fae7);}(_0x8085,0x71));var _0x5808=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x8085[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0x5808('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require(_0x5808('0x1'));var BPromise=require(_0x5808('0x2'));var moment=require(_0x5808('0x3'));var config=require(_0x5808('0x4'));var properties=require('../properties');var ami=require('../ami');exports[_0x5808('0x5')]=function(_0x32aa93,_0x4cbea2,_0x17f899){return new BPromise(function(_0x749306,_0x39458f){var _0x2d204e={'QueuePause':function(_0x2a9716){return new Promise(function(_0x5b30b9,_0x30e63c){var _0xd77963=util[_0x5808('0x6')](_0x5808('0x7'),_0x5808('0x8'),_0x2a9716[_0x5808('0x9')]);if(_0x32aa93[_0x5808('0xa')]&&_0x32aa93[_0x5808('0xa')][_0xd77963]&&_0x32aa93[_0x5808('0xa')][_0xd77963]['timer']){_0x32aa93['timers'][_0xd77963][_0x5808('0xb')]();}if(_0x32aa93[_0x5808('0xc')][_0xd77963]){_0x32aa93[_0x5808('0xc')][_0xd77963][_0x5808('0xd')]({'statePause':_0x2a9716[_0x5808('0xe')]?!![]:![]});}_0x5b30b9({'code':0xc8,'message':_0x5808('0xf')});});},'Reload':function(_0x10572d){var _0x5dbfdd=this;return new Promise(function(_0x483af0,_0x995637){if(ami[_0x5808('0x10')]()==![]){return _0x995637(_0x5dbfdd[_0x5808('0x11')](0x1f4,[config[_0x5808('0x12')]['ip'],config[_0x5808('0x12')][_0x5808('0x13')],_0x5808('0x14')][_0x5808('0x15')]('\x20')));}_0x10572d=_[_0x5808('0x16')](_0x10572d,_[_0x5808('0x17')](properties[_0x5808('0x18')]));_0x10572d['action']=_0x5808('0x19');return ami['Action'](_0x10572d)[_0x5808('0x1a')](function(_0x25dc4e){_0x483af0({'code':0xc8,'message':_0x25dc4e[_0x5808('0x1b')]});})['catch'](function(_0x9e58d4){_0x995637(_0x5dbfdd[_0x5808('0x11')](0x1f5,_0x9e58d4['message']));});});},'Command':function(_0x5ecc95){var _0x3c7c02=this;return new Promise(function(_0x4a8e49,_0x40cfbd){if(ami[_0x5808('0x10')]()==![]){return _0x40cfbd(_0x3c7c02[_0x5808('0x11')](0x1f4,[config[_0x5808('0x12')]['ip'],config['asterisk']['username'],_0x5808('0x14')][_0x5808('0x15')]('\x20')));}_0x5ecc95=_[_0x5808('0x16')](_0x5ecc95,_0x5808('0x1c'));_0x5ecc95[_0x5808('0x1d')]=_0x5808('0x1e');return ami[_0x5808('0x1f')](_0x5ecc95)[_0x5808('0x1a')](function(_0x3a575e){_0x4a8e49({'code':0xc8,'message':_0x3a575e['content']});})['catch'](function(_0x130590){_0x40cfbd(_0x3c7c02[_0x5808('0x11')](0x1f5,_0x130590['message']));});});},'VoiceQueues':function(_0x4d07d0){return new Promise(function(_0x27105a,_0x467500){var _0x1dddbd=[];for(var _0x4a4d05 in _0x32aa93['voiceQueues']){if(_0x32aa93[_0x5808('0x20')][_0x5808('0x21')](_0x4a4d05)){var _0x27c991=_0x32aa93[_0x5808('0x20')][_0x4a4d05];var _0x1da724={'id':_0x27c991['id'],'name':_0x27c991['name'],'strategy':_0x27c991[_0x5808('0x22')],'answered':_0x27c991[_0x5808('0x23')],'available':_0x27c991[_0x5808('0x24')],'loggedIn':_0x27c991[_0x5808('0x25')],'pTalking':_0x27c991[_0x5808('0x26')],'sumBillable':_0x27c991[_0x5808('0x27')],'sumDuration':_0x27c991[_0x5808('0x28')],'sumHoldTime':_0x27c991['sumHoldTime']||0x0,'talking':_0x27c991['talking'],'total':_0x27c991[_0x5808('0x29')],'type':_0x27c991[_0x5808('0x2a')],'unmanaged':_0x27c991[_0x5808('0x2b')],'abandoned':_0x27c991['abandoned'],'waiting':_0x27c991[_0x5808('0x2c')],'loggedInDb':_0x27c991[_0x5808('0x2d')]};if(_0x27c991[_0x5808('0x2a')]===_0x5808('0x2e')){_0x1da724[_0x5808('0x2f')]=_0x27c991[_0x5808('0x2f')];_0x1da724['dialMethod']=_0x27c991[_0x5808('0x30')];_0x1da724[_0x5808('0x31')]=_0x27c991[_0x5808('0x31')];_0x1da724['dialOriginateCallerIdNumber']=_0x27c991['dialOriginateCallerIdNumber'];_0x1da724[_0x5808('0x32')]=_0x27c991['dialOriginateTimeout'];_0x1da724[_0x5808('0x33')]=_0x27c991[_0x5808('0x33')];_0x1da724['temp']=_0x27c991[_0x5808('0x34')];_0x1da724[_0x5808('0x35')]=_0x27c991['outboundAnswerAgiCallsDay'];_0x1da724['outboundAnswerCallsDay']=_0x27c991[_0x5808('0x36')];_0x1da724['outboundBlacklistCallsDay']=_0x27c991[_0x5808('0x37')];_0x1da724['outboundBusyCallsDay']=_0x27c991[_0x5808('0x38')];_0x1da724[_0x5808('0x39')]=_0x27c991[_0x5808('0x39')];_0x1da724['outboundDropCallsDayACS']=_0x27c991[_0x5808('0x3a')];_0x1da724['outboundDropCallsDayCallersExit']=_0x27c991[_0x5808('0x3b')];_0x1da724['outboundDropCallsDayTimeout']=_0x27c991['outboundDropCallsDayTimeout'];_0x1da724[_0x5808('0x3c')]=_0x27c991[_0x5808('0x3c')];_0x1da724[_0x5808('0x3d')]=_0x27c991['outboundNoSuchCallsDay'];_0x1da724['outboundOriginateFailureCallsDay']=_0x27c991[_0x5808('0x3e')];_0x1da724[_0x5808('0x3f')]=_0x27c991['outboundReCallsDay'];_0x1da724[_0x5808('0x40')]=_0x27c991[_0x5808('0x40')];_0x1da724[_0x5808('0x41')]=_0x27c991['outboundUnknownCallsDay'];_0x1da724[_0x5808('0x42')]=_0x27c991[_0x5808('0x42')];_0x1da724[_0x5808('0x43')]=_0x27c991['predictiveIntervalAvgHoldtime'];_0x1da724[_0x5808('0x44')]=_0x27c991[_0x5808('0x44')];_0x1da724['predictiveIntervalDroppedCallsCallersExit']=_0x27c991['predictiveIntervalDroppedCallsCallersExit'];_0x1da724[_0x5808('0x45')]=_0x27c991['predictiveIntervalDroppedCallsTimeout'];_0x1da724[_0x5808('0x46')]=_0x27c991[_0x5808('0x46')];_0x1da724[_0x5808('0x47')]=_0x27c991[_0x5808('0x47')];_0x1da724[_0x5808('0x48')]=_0x27c991['predictiveIntervalHitRate'];_0x1da724['predictiveIntervalMultiplicativeFactor']=_0x27c991[_0x5808('0x49')];_0x1da724[_0x5808('0x4a')]=_0x27c991[_0x5808('0x4a')];_0x1da724['predictiveIntervalAvailable']=_0x27c991[_0x5808('0x4b')];_0x1da724[_0x5808('0x4c')]=_0x27c991[_0x5808('0x4c')];_0x1da724[_0x5808('0x1b')]=_0x27c991[_0x5808('0x1b')];_0x1da724['originated']=_0x27c991[_0x5808('0x4d')];_0x1da724[_0x5808('0x4e')]=_0x27c991[_0x5808('0x4e')];_0x1da724['erlangCallToSecond']=_0x27c991[_0x5808('0x4f')];_0x1da724[_0x5808('0x50')]=_0x27c991[_0x5808('0x50')];_0x1da724['erlangBusyFactor']=_0x27c991['erlangBusyFactor'];_0x1da724[_0x5808('0x51')]=_0x27c991[_0x5808('0x51')];_0x1da724[_0x5808('0x52')]=_0x27c991[_0x5808('0x52')];}if(_0x27c991[_0x5808('0x53')]){_0x1da724[_0x5808('0x53')]={'id':_0x27c991[_0x5808('0x53')]['id'],'name':_0x27c991[_0x5808('0x53')][_0x5808('0x9')],'active':_0x27c991[_0x5808('0x53')][_0x5808('0x54')],'callerid':_0x27c991[_0x5808('0x53')][_0x5808('0x55')]};}if(_0x27c991['Interval']){_0x1da724['Interval']={'id':_0x27c991[_0x5808('0x56')]['id'],'name':_0x27c991[_0x5808('0x56')][_0x5808('0x9')]};}_0x1dddbd[_0x5808('0x57')](_0x1da724);}}_0x27105a({'count':_0x1dddbd[_0x5808('0x58')],'rows':_0x1dddbd});});},'UpdateVoiceQueue':function(_0x147529){return new Promise(function(_0x34d7dc,_0x545713){var _0x5cf743=_['find'](_0x32aa93[_0x5808('0x20')],{'id':parseInt(_0x147529['id'])});var _0x5bce11=_[_0x5808('0x59')](_0x147529,['id']);if(_0x5cf743){for(var _0x507bb5 in _0x5bce11){if(typeof _0x5bce11[_0x507bb5]!=='undefined'&&typeof _0x5cf743[_0x507bb5]!=='undefined'){_0x5cf743[_0x507bb5]=_0x5bce11[_0x507bb5];}}_0x34d7dc(_0x5cf743);}else{_0x545713();}});},'VoiceChannels':function(_0x15eeef){return new Promise(function(_0x3c974c,_0x4e27d5){var _0x46c8ed=_[_0x5808('0x5a')](_0x32aa93[_0x5808('0x5b')]);_0x3c974c({'count':_0x46c8ed['length'],'rows':_0x46c8ed});});},'VoiceChannelMixMonitor':function(_0x1a78ae){var _0x540ae1=this;return new Promise(function(_0x175578,_0x2d75cd){if(ami[_0x5808('0x10')]()==![]){return _0x2d75cd(_0x540ae1['error'](0x1f4,[config[_0x5808('0x12')]['ip'],config[_0x5808('0x12')][_0x5808('0x13')],_0x5808('0x14')]['join']('\x20')));}var _0x46585a=schema(properties[_0x5808('0x5c')])[_0x5808('0x1')](_0x1a78ae);if(_0x46585a[_0x5808('0x58')]>0x0){return _0x2d75cd(_0x540ae1[_0x5808('0x11')](0x1f4,_[_0x5808('0x5d')](_0x46585a,'message')[_0x5808('0x15')](',\x20')));}var _0x1f00b3=_[_0x5808('0x5e')](_0x32aa93[_0x5808('0x5b')],{'uniqueid':_0x1a78ae[_0x5808('0x5f')]});if(_0x1f00b3&&_0x1f00b3['channel']){var _0x2d9064=util[_0x5808('0x6')](_0x5808('0x60'),_0x1a78ae[_0x5808('0x61')]||_0x1a78ae[_0x5808('0x5f')],_0x1a78ae[_0x5808('0x6')]||'wav');return ami[_0x5808('0x1f')]({'action':'MixMonitor','channel':_0x1f00b3[_0x5808('0x62')],'file':_0x2d9064,'options':_0x5808('0x63')})['then'](function(_0x20779b){var _0x1a3b7d=_[_0x5808('0x5e')](_0x1f00b3['monitors'],{'filename':_0x5808('0x64')+_0x2d9064[_0x5808('0x65')]()});if(_['isNil'](_0x1a3b7d)){_0x1f00b3[_0x5808('0x66')][_0x5808('0x57')]({'filename':'/var/spool/asterisk/monitor/'+_0x2d9064['toLowerCase'](),'createdAt':moment()[_0x5808('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x20779b[_0x5808('0x67')],'status':'rec'});}else{_0x1a3b7d['mixmonitorid']=_0x20779b[_0x5808('0x67')];_0x1a3b7d[_0x5808('0x68')]=_0x5808('0x69');}_0x175578({'code':0xc8,'message':[_0x1a78ae[_0x5808('0x5f')],_0x5808('0x6a'),_0x20779b[_0x5808('0x67')]][_0x5808('0x15')]('\x20'),'mixmonitorid':_0x20779b[_0x5808('0x67')]});})[_0x5808('0x6b')](function(_0x3b06b5){_0x2d75cd(_0x540ae1['error'](0x1f5,[_0x1a78ae['uniqueid'],_0x3b06b5['message'][_0x5808('0x65')]()][_0x5808('0x15')]('\x20')));});}else{return _0x2d75cd(_0x540ae1['error'](0x1f5,_0x5808('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x52055e){var _0x21e42c=this;return new Promise(function(_0xab1ed1,_0x2f72a8){if(ami[_0x5808('0x10')]()==![]){return _0x2f72a8(_0x21e42c[_0x5808('0x11')](0x1f4,[config[_0x5808('0x12')]['ip'],config[_0x5808('0x12')][_0x5808('0x13')],_0x5808('0x14')][_0x5808('0x15')]('\x20')));}var _0x512d86=schema(properties[_0x5808('0x5c')])[_0x5808('0x1')](_0x52055e);if(_0x512d86[_0x5808('0x58')]>0x0){return _0x2f72a8(_0x21e42c[_0x5808('0x11')](0x1f4,_[_0x5808('0x5d')](_0x512d86,_0x5808('0x1b'))['join'](',\x20')));}var _0x4b5f68=_['find'](_0x32aa93[_0x5808('0x5b')],{'uniqueid':_0x52055e[_0x5808('0x5f')]});if(_0x4b5f68){return BPromise['resolve']()[_0x5808('0x1a')](function(){if(_0x4b5f68[_0x5808('0x62')]){return ami[_0x5808('0x1f')]({'action':_0x5808('0x6d'),'channel':_0x4b5f68[_0x5808('0x62')],'mixmonitorid':_0x52055e[_0x5808('0x67')]})['catch'](function(_0x5a5b8c){});}})[_0x5808('0x1a')](function(){if(_0x4b5f68[_0x5808('0x6e')]){return ami[_0x5808('0x1f')]({'action':_0x5808('0x6d'),'channel':_0x4b5f68[_0x5808('0x6e')],'mixmonitorid':_0x52055e['mixmonitorid']})[_0x5808('0x6b')](function(_0xc3847c){});}})[_0x5808('0x1a')](function(_0xe73ec9){var _0x146ed5=_['find'](_0x4b5f68[_0x5808('0x66')],{'mixmonitorid':_0x52055e[_0x5808('0x67')]});if(_0x146ed5){_0x146ed5[_0x5808('0x68')]=_0x5808('0x6f');}})[_0x5808('0x1a')](function(){var _0x15141e=util[_0x5808('0x6')](_0x5808('0x60'),_0x52055e[_0x5808('0x61')]||_0x52055e[_0x5808('0x5f')],_0x52055e[_0x5808('0x6')]||'wav');var _0x5aa671=_[_0x5808('0x5e')](_0x4b5f68[_0x5808('0x66')],{'filename':_0x5808('0x64')+_0x15141e['toLowerCase']()});if(_0x5aa671){_0x5aa671[_0x5808('0x68')]=_0x5808('0x6f');}})['then'](function(){_0xab1ed1({'code':0xc8,'message':[_0x52055e[_0x5808('0x5f')],_0x5808('0x70')]['join']('\x20')});})[_0x5808('0x6b')](function(_0x188248){_0x2f72a8(_0x21e42c[_0x5808('0x11')](0x1f5,[_0x52055e[_0x5808('0x5f')],_0x188248['message']['toLowerCase']()][_0x5808('0x15')]('\x20')));});}else{return _0x2f72a8(_0x21e42c[_0x5808('0x11')](0x1f5,_0x5808('0x6c')));}});},'VoiceQueuesChannels':function(_0x16e368){return new Promise(function(_0x326221,_0x481d65){var _0x58b0fc=_[_0x5808('0x5a')](_0x32aa93['queueChannels']);_0x326221({'count':_0x58b0fc[_0x5808('0x58')],'rows':_0x58b0fc});});},'VoiceQueuesChannel':function(_0x51f52f){var _0x40967e=this;return new Promise(function(_0x30273c,_0x4fecf9){var _0x1a1066=schema(properties[_0x5808('0x71')])[_0x5808('0x1')](_0x51f52f);if(_0x1a1066[_0x5808('0x58')]>0x0){return _0x4fecf9(_0x40967e[_0x5808('0x11')](0x1f4,_[_0x5808('0x5d')](_0x1a1066,_0x5808('0x1b'))['join'](',\x20')));}var _0x56285c=_[_0x5808('0x5e')](_0x32aa93[_0x5808('0x72')],{'uniqueid':_0x51f52f[_0x5808('0x5f')]});if(_0x56285c){_0x30273c(_0x56285c);}else{return _0x4fecf9(_0x40967e['error'](0x1f5,_0x5808('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x5e5e1c){var _0x569f3e=this;return new Promise(function(_0x51b408,_0x2cc043){if(ami['isConnected']()==![]){return _0x2cc043(_0x569f3e[_0x5808('0x11')](0x1f4,[config[_0x5808('0x12')]['ip'],config[_0x5808('0x12')][_0x5808('0x13')],_0x5808('0x14')][_0x5808('0x15')]('\x20')));}var _0x5b33ad=schema(properties[_0x5808('0x73')])[_0x5808('0x1')](_0x5e5e1c);if(_0x5b33ad[_0x5808('0x58')]>0x0){return _0x2cc043(_0x569f3e[_0x5808('0x11')](0x1f4,_['map'](_0x5b33ad,_0x5808('0x1b'))['join'](',\x20')));}var _0x3189f4=_['find'](_0x32aa93[_0x5808('0x72')],{'uniqueid':_0x5e5e1c[_0x5808('0x5f')]});if(_0x3189f4&&_0x3189f4['channel']){return ami[_0x5808('0x1f')]({'action':_0x5808('0x74'),'channel':_0x3189f4[_0x5808('0x62')]})[_0x5808('0x1a')](function(_0x2b70bc){_0x51b408({'code':0xc8,'message':[_0x5e5e1c[_0x5808('0x5f')],_0x2b70bc[_0x5808('0x1b')]['toLowerCase']()][_0x5808('0x15')]('\x20')});})[_0x5808('0x6b')](function(_0x560bd4){_0x2cc043(_0x569f3e[_0x5808('0x11')](0x1f5,[_0x5e5e1c[_0x5808('0x5f')],_0x560bd4[_0x5808('0x1b')]['toLowerCase']()][_0x5808('0x15')]('\x20')));});}else{return _0x2cc043(_0x569f3e[_0x5808('0x11')](0x1f5,_0x5808('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x2c0e15){var _0x3c8711=this;return new Promise(function(_0x1695b3,_0x88fb07){if(ami[_0x5808('0x10')]()==![]){return _0x88fb07(_0x3c8711[_0x5808('0x11')](0x1f4,[config[_0x5808('0x12')]['ip'],config['asterisk'][_0x5808('0x13')],_0x5808('0x14')][_0x5808('0x15')]('\x20')));}var _0x5dec5e=schema(properties[_0x5808('0x75')])['validate'](_0x2c0e15);if(_0x5dec5e[_0x5808('0x58')]>0x0){return _0x88fb07(_0x3c8711['error'](0x1f4,_[_0x5808('0x5d')](_0x5dec5e,_0x5808('0x1b'))[_0x5808('0x15')](',\x20')));}var _0x5414f8=_['find'](_0x32aa93['queueChannels'],{'uniqueid':_0x2c0e15['uniqueid']});if(_0x5414f8&&_0x5414f8[_0x5808('0x62')]){return ami[_0x5808('0x1f')]({'action':'Redirect','channel':_0x5414f8[_0x5808('0x62')],'exten':_0x2c0e15[_0x5808('0x76')],'context':_0x2c0e15[_0x5808('0x77')]||_0x5414f8[_0x5808('0x77')],'priority':0x1})[_0x5808('0x1a')](function(_0x56e9e2){_0x1695b3({'code':0xc8,'message':[_0x2c0e15[_0x5808('0x5f')],_0x56e9e2[_0x5808('0x1b')][_0x5808('0x65')]()][_0x5808('0x15')]('\x20')});})[_0x5808('0x6b')](function(_0x537f60){_0x88fb07(_0x3c8711[_0x5808('0x11')](0x1f5,[_0x2c0e15[_0x5808('0x5f')],_0x537f60[_0x5808('0x1b')][_0x5808('0x65')]()][_0x5808('0x15')]('\x20')));});}else{return _0x88fb07(_0x3c8711[_0x5808('0x11')](0x1f5,_0x5808('0x6c')));}});},'Agents':function(_0x8d1ba2){return new Promise(function(_0xe6112f,_0x3e999c){var _0xd74fe8=_[_0x5808('0x5a')](_0x32aa93[_0x5808('0xc')]);_0xe6112f({'count':_0xd74fe8[_0x5808('0x58')],'rows':_0xd74fe8});});},'Telephones':function(_0x5dbae7){return new Promise(function(_0x3a3019,_0x2daf55){var _0x359091=_[_0x5808('0x5a')](_0x32aa93['telephones']);_0x3a3019({'count':_0x359091['length'],'rows':_0x359091});});},'Trunks':function(_0x43a3cd){return new Promise(function(_0x279d61,_0x160d95){var _0x223baa=_[_0x5808('0x5a')](_0x32aa93[_0x5808('0x78')]);_0x279d61({'count':_0x223baa[_0x5808('0x58')],'rows':_0x223baa});});},'OutboundChannels':function(_0x22b68b){return new Promise(function(_0x2053aa,_0x19754f){var _0x33c748=_[_0x5808('0x5a')](_0x32aa93['outboundChannels']);_0x2053aa({'count':_0x33c748[_0x5808('0x58')],'rows':_0x33c748});});},'Outbound':function(_0x4b6654){return new Promise(function(_0x17e2de,_0x59b839){_0x17e2de(_0x32aa93['outbound']);});},'Campaigns':function(_0x52c95e){return new Promise(function(_0x327487,_0xb25162){var _0x578166=_['values'](_0x32aa93[_0x5808('0x79')]);_0x327487({'count':_0x578166[_0x5808('0x58')],'rows':_0x578166});});},'VoiceQueuesPreview':function(_0x376be3){var _0x15ee27=this;return new Promise(function(_0x51288e,_0x3a69d0){_0x4cbea2[_0x5808('0x7a')](_0x376be3['id'])['then'](function(_0x363dfe){_0x51288e({'code':0xc8,'message':_0x363dfe['message']});})[_0x5808('0x6b')](function(_0x567748){_0x3a69d0(_0x15ee27['error'](0x1f4,_0x567748['message']));});});},'EventManager':function(_0x488637){var _0x315523=this;return new Promise(function(_0xc293f9,_0x44b058){if(!_0x488637['event']){return _0x44b058(_0x315523[_0x5808('0x11')](0x1f4,_0x5808('0x7b')));}ami[_0x5808('0x7c')](_0x5808('0x7d')+_0x488637[_0x5808('0x7e')],_0x488637[_0x5808('0x1b')]);_0xc293f9({'code':0xc8,'message':_0x488637});});},'FaxAccounts':function(_0xc257fb){return new Promise(function(_0x567021,_0x36991d){var _0x55dc8a=_[_0x5808('0x5a')](_0x32aa93[_0x5808('0x7f')]);_0x567021({'count':_0x55dc8a['length'],'rows':_0x55dc8a});});},'SendFax':function(_0x555ef0){var _0x45fddc=this;return new Promise(function(_0x12a50c,_0x2be086){_0x17f899[_0x5808('0x80')](_0x555ef0)[_0x5808('0x1a')](function(_0x45e954){_0x12a50c({'code':0xc8,'message':_0x45e954[_0x5808('0x1b')]});})[_0x5808('0x6b')](function(_0x4dc79d){_0x2be086(_0x45fddc[_0x5808('0x11')](0x1f4,_0x4dc79d[_0x5808('0x1b')]));});});},'CheckAfterSend':function(_0x33d1a6){var _0x3b45cc=this;return new Promise(function(_0x25535e,_0x34a739){_0x17f899[_0x5808('0x81')](_0x33d1a6)['then'](function(_0x53086c){_0x25535e({'code':0xc8,'message':_0x53086c['message']});})['catch'](function(_0x5b7e8d){_0x34a739(_0x3b45cc['error'](0x1f4,_0x5b7e8d['message']));});});}};var _0x21accd=jayson[_0x5808('0x82')](_0x2d204e)[_0x5808('0x83')]();_0x21accd['on'](_0x5808('0x11'),function(_0x3d6033){return _0x39458f(_0x3d6033);});_0x21accd[_0x5808('0x5')](0x232a,_0x5808('0x84'),function(){console[_0x5808('0x85')](_0x5808('0x86'),0x232a);return _0x749306('RPC\x20listening\x20on\x20port:'+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 75393ce..efafd24 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 _0x9a19=['data1','data2','isNil','data5','xmd-contactid','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','createdAt','updatedAt','resolve','getContacts','then','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','destcalleridname','Unknown','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','trigger:%s','action','toLowerCase','merge','length','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','emit','exec'];(function(_0x459b59,_0x419e84){var _0x18f0d3=function(_0x5ef4f4){while(--_0x5ef4f4){_0x459b59['push'](_0x459b59['shift']());}};_0x18f0d3(++_0x419e84);}(_0x9a19,0x114));var _0x99a1=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9a19[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x99a1('0x0'));var BPromise=require(_0x99a1('0x1'));var Redis=require(_0x99a1('0x2'));var util=require('util');var config=require(_0x99a1('0x3'));var logger=require(_0x99a1('0x4'))(_0x99a1('0x5'));var cmContactRpc=require(_0x99a1('0x6'));config[_0x99a1('0x7')]=_[_0x99a1('0x8')](config[_0x99a1('0x7')],{'host':_0x99a1('0x9'),'port':0x18eb});var io=require(_0x99a1('0xa'))(new Redis(config[_0x99a1('0x7')]));function emit(_0x65045d,_0x523b9e,_0x4d2a5c,_0x5aa6c2,_0x56f50){logger[_0x99a1('0xb')]('[CM][%s][%s]',_0x65045d,_0x523b9e['id'],_0x4d2a5c,_0x5aa6c2,JSON['stringify'](_0x56f50));io['to'](_0x4d2a5c)[_0x99a1('0xc')](_0x5aa6c2,_0x56f50);}exports[_0x99a1('0xd')]=function(_0x23db53,_0x26473f,_0x1551a1,_0x537032){var _0x28ee99,_0xdd29e1;var _0x27d65f={};var _0x418dee=Number(_0x1551a1[_0x99a1('0xe')]);var _0x1bc7aa=_0x1551a1[_0x99a1('0xf')]?Boolean(Number(_0x1551a1[_0x99a1('0xf')])):![];var _0xf713b9;var _0x40c19c=![];if(!_[_0x99a1('0x10')](_0x1551a1[_0x99a1('0x11')])){if(_0x1551a1[_0x99a1('0x11')]=='1')_0x40c19c=!![];}if(!_0x40c19c){if(_0x537032[_0x99a1('0x12')]){_0x27d65f['id']=_0x537032[_0x99a1('0x12')];}}if(!_0x27d65f['id']){_0x27d65f['ListId']=_0x418dee;_0xf713b9=_0x1551a1[_0x99a1('0x13')]&&_0x1551a1[_0x99a1('0x13')]!=='0'?_0x1551a1[_0x99a1('0x13')][_0x99a1('0x14')](','):[_0x99a1('0x15')];_0x27d65f[_0x99a1('0x16')]=_[_0x99a1('0x17')](_0xf713b9,function(_0x4e645b){var _0x4f049c={};_0x4f049c[_0x4e645b]=_0x537032[_0x99a1('0x18')]?_0x537032[_0x99a1('0x19')]:_0x537032[_0x99a1('0x1a')];return _0x4f049c;});}var _0x1fcd00=['id',_0x99a1('0x1b'),_0x99a1('0x1c'),_0x99a1('0x15'),_0x99a1('0x1d'),_0x99a1('0x1e'),_0x99a1('0x1f'),_0x99a1('0x20'),'scheduledAt',_0x99a1('0x21')];var _0x20007e=_['union'](_0x1fcd00,_0xf713b9);BPromise[_0x99a1('0x22')]()['then'](cmContactRpc[_0x99a1('0x23')]({'attributes':_0x20007e,'where':_0x27d65f}))[_0x99a1('0x24')](function(_0x2d6f20){_0xdd29e1=_0x2d6f20;if(!_[_0x99a1('0x25')](_0xdd29e1)){if(_0xdd29e1['length']===0x1){_0x28ee99=_0xdd29e1[0x0];logger[_0x99a1('0xb')](_0x99a1('0x26'),_0x537032['uniqueid'],_0x26473f['id'],_0x28ee99['id']);}else{logger[_0x99a1('0xb')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x537032[_0x99a1('0x27')],_0x26473f['id'],_[_0x99a1('0x17')](_0xdd29e1,'id')[_0x99a1('0x28')](','));}return;}else{logger[_0x99a1('0xb')](_0x99a1('0x29'),_0x537032[_0x99a1('0x27')],_0x26473f['id']);var _0x4fe7f7={'ListId':_0x418dee};var _0x114b38=_0x1551a1['data4']&&_0x1551a1['data4']!=='0'?_0x1551a1[_0x99a1('0x2a')]:_0x99a1('0x15');if(_0x1bc7aa){logger[_0x99a1('0xb')](_0x99a1('0x2b'),_0x537032[_0x99a1('0x27')],_0x26473f['id']);_0x4fe7f7[_0x114b38]=_[_0x99a1('0x10')](_0x537032[_0x99a1('0x18')])?_0x537032['calleridnum']:_0x537032[_0x99a1('0x19')];if(_['isNil'](_0x537032[_0x99a1('0x18')])){_0x4fe7f7[_0x99a1('0x1b')]=_0x537032[_0x99a1('0x2c')]&&_0x537032['calleridname']!==_0x99a1('0x2d')?_0x537032[_0x99a1('0x2c')]:'Unknown';}else{_0x4fe7f7[_0x99a1('0x1b')]=_0x537032[_0x99a1('0x2e')]&&_0x537032[_0x99a1('0x2e')]!==_0x99a1('0x2d')?_0x537032[_0x99a1('0x2e')]:_0x99a1('0x2f');}return BPromise[_0x99a1('0x22')]()[_0x99a1('0x24')](cmContactRpc['createContact'](_0x4fe7f7))['then'](function(_0x3fa342){_0x28ee99=_0x3fa342;_0xdd29e1['push'](_0x3fa342);if(_0x28ee99){logger[_0x99a1('0xb')](_0x99a1('0x30'),_0x537032['uniqueid'],_0x26473f['id'],_0x28ee99['id']);}return;});}else{logger[_0x99a1('0xb')](_0x99a1('0x31'),_0x537032[_0x99a1('0x27')],_0x26473f['id']);_0x4fe7f7[_0x114b38]=_[_0x99a1('0x10')](_0x537032[_0x99a1('0x18')])?_0x537032[_0x99a1('0x1a')]:_0x537032[_0x99a1('0x19')];if(_[_0x99a1('0x10')](_0x537032[_0x99a1('0x18')])){_0x4fe7f7[_0x99a1('0x1b')]=_0x537032[_0x99a1('0x2c')]&&_0x537032[_0x99a1('0x2c')]!==_0x99a1('0x2d')?_0x537032[_0x99a1('0x2c')]:'Unknown';}else{_0x4fe7f7['firstName']=_0x537032[_0x99a1('0x2e')]&&_0x537032[_0x99a1('0x2e')]!==_0x99a1('0x2d')?_0x537032[_0x99a1('0x2e')]:_0x99a1('0x2f');}_0x28ee99=_0x4fe7f7;_0xdd29e1[_0x99a1('0x32')](_0x4fe7f7);return;}}})[_0x99a1('0x24')](function(){if(_0x23db53){emit(_0x537032['uniqueid'],_0x26473f,util[_0x99a1('0x33')](_0x99a1('0x34'),_0x23db53['name']),util[_0x99a1('0x33')](_0x99a1('0x35'),_0x1551a1[_0x99a1('0x36')][_0x99a1('0x37')]()),{'evt':_[_0x99a1('0x38')](_0x537032,{'autoCreate':_0x1bc7aa}),'contact':_0x28ee99===undefined?{}:_0x28ee99,'contacts':_0xdd29e1[_0x99a1('0x39')]===0x0?undefined:_0xdd29e1});}});}; \ No newline at end of file +var _0xe14d=['xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','scheduledAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xe14d,0x1ee));var _0xde14=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xe14d[_0x25bea7];return _0x175952;};'use strict';var _=require(_0xde14('0x0'));var BPromise=require(_0xde14('0x1'));var Redis=require(_0xde14('0x2'));var util=require(_0xde14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xde14('0x4'))(_0xde14('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0xde14('0x6')]=_[_0xde14('0x7')](config[_0xde14('0x6')],{'host':_0xde14('0x8'),'port':0x18eb});var io=require(_0xde14('0x9'))(new Redis(config[_0xde14('0x6')]));function emit(_0x4b1f6b,_0x5a1344,_0x1bd49d,_0x115b7d,_0x2b0e7c){logger[_0xde14('0xa')](_0xde14('0xb'),_0x4b1f6b,_0x5a1344['id'],_0x1bd49d,_0x115b7d,JSON[_0xde14('0xc')](_0x2b0e7c));io['to'](_0x1bd49d)[_0xde14('0xd')](_0x115b7d,_0x2b0e7c);}exports[_0xde14('0xe')]=function(_0x4b2b15,_0x1a7167,_0xe785fb,_0x417269){var _0x4357c7,_0x8e0e;var _0x30a4c4={};var _0x1a1c32=Number(_0xe785fb[_0xde14('0xf')]);var _0x34e28f=_0xe785fb[_0xde14('0x10')]?Boolean(Number(_0xe785fb[_0xde14('0x10')])):![];var _0x464624;var _0x3521d4=![];if(!_[_0xde14('0x11')](_0xe785fb[_0xde14('0x12')])){if(_0xe785fb['data5']=='1')_0x3521d4=!![];}if(!_0x3521d4){if(_0x417269['xmd-contactid']){_0x30a4c4['id']=_0x417269[_0xde14('0x13')];}}if(!_0x30a4c4['id']){_0x30a4c4[_0xde14('0x14')]=_0x1a1c32;_0x464624=_0xe785fb[_0xde14('0x15')]&&_0xe785fb['data3']!=='0'?_0xe785fb[_0xde14('0x15')][_0xde14('0x16')](','):[_0xde14('0x17')];_0x30a4c4[_0xde14('0x18')]=_[_0xde14('0x19')](_0x464624,function(_0x1b9d4b){var _0x29e243={};_0x29e243[_0x1b9d4b]=_0x417269[_0xde14('0x1a')]?_0x417269[_0xde14('0x1b')]:_0x417269[_0xde14('0x1c')];return _0x29e243;});}var _0x590a8b=['id',_0xde14('0x1d'),_0xde14('0x1e'),_0xde14('0x17'),_0xde14('0x1f'),'fax',_0xde14('0x14'),'createdAt',_0xde14('0x20'),'updatedAt'];var _0xa50687=_[_0xde14('0x21')](_0x590a8b,_0x464624);BPromise[_0xde14('0x22')]()[_0xde14('0x23')](cmContactRpc[_0xde14('0x24')]({'attributes':_0xa50687,'where':_0x30a4c4}))[_0xde14('0x23')](function(_0x40b648){_0x8e0e=_0x40b648;if(!_[_0xde14('0x25')](_0x8e0e)){if(_0x8e0e[_0xde14('0x26')]===0x1){_0x4357c7=_0x8e0e[0x0];logger[_0xde14('0xa')](_0xde14('0x27'),_0x417269[_0xde14('0x28')],_0x1a7167['id'],_0x4357c7['id']);}else{logger[_0xde14('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x417269[_0xde14('0x28')],_0x1a7167['id'],_[_0xde14('0x19')](_0x8e0e,'id')[_0xde14('0x29')](','));}return;}else{logger[_0xde14('0xa')](_0xde14('0x2a'),_0x417269[_0xde14('0x28')],_0x1a7167['id']);var _0x310d75={'ListId':_0x1a1c32};var _0x23c735=_0xe785fb[_0xde14('0x2b')]&&_0xe785fb[_0xde14('0x2b')]!=='0'?_0xe785fb['data4']:_0xde14('0x17');if(_0x34e28f){logger[_0xde14('0xa')](_0xde14('0x2c'),_0x417269[_0xde14('0x28')],_0x1a7167['id']);_0x310d75[_0x23c735]=_['isNil'](_0x417269[_0xde14('0x1a')])?_0x417269[_0xde14('0x1c')]:_0x417269[_0xde14('0x1b')];if(_['isNil'](_0x417269[_0xde14('0x1a')])){_0x310d75['firstName']=_0x417269[_0xde14('0x2d')]&&_0x417269[_0xde14('0x2d')]!==_0xde14('0x2e')?_0x417269[_0xde14('0x2d')]:_0xde14('0x2f');}else{_0x310d75[_0xde14('0x1d')]=_0x417269[_0xde14('0x30')]&&_0x417269[_0xde14('0x30')]!==''?_0x417269[_0xde14('0x30')]:_0xde14('0x2f');}return BPromise['resolve']()[_0xde14('0x23')](cmContactRpc['createContact'](_0x310d75))[_0xde14('0x23')](function(_0x44e88a){_0x4357c7=_0x44e88a;_0x8e0e[_0xde14('0x31')](_0x44e88a);if(_0x4357c7){logger[_0xde14('0xa')](_0xde14('0x32'),_0x417269['uniqueid'],_0x1a7167['id'],_0x4357c7['id']);}return;});}else{logger[_0xde14('0xa')](_0xde14('0x33'),_0x417269['uniqueid'],_0x1a7167['id']);_0x310d75[_0x23c735]=_[_0xde14('0x11')](_0x417269[_0xde14('0x1a')])?_0x417269[_0xde14('0x1c')]:_0x417269[_0xde14('0x1b')];if(_[_0xde14('0x11')](_0x417269[_0xde14('0x1a')])){_0x310d75[_0xde14('0x1d')]=_0x417269[_0xde14('0x2d')]&&_0x417269[_0xde14('0x2d')]!==''?_0x417269['calleridname']:_0xde14('0x2f');}else{_0x310d75[_0xde14('0x1d')]=_0x417269[_0xde14('0x30')]&&_0x417269[_0xde14('0x30')]!==_0xde14('0x2e')?_0x417269[_0xde14('0x30')]:_0xde14('0x2f');}_0x4357c7=_0x310d75;_0x8e0e[_0xde14('0x31')](_0x310d75);return;}}})[_0xde14('0x23')](function(){if(_0x4b2b15){emit(_0x417269['uniqueid'],_0x1a7167,util[_0xde14('0x34')]('user:%s',_0x4b2b15['name']),util['format'](_0xde14('0x35'),_0xe785fb[_0xde14('0x36')][_0xde14('0x37')]()),{'evt':_[_0xde14('0x38')](_0x417269,{'autoCreate':_0x34e28f}),'contact':_0x4357c7===undefined?{}:_0x4357c7,'contacts':_0x8e0e[_0xde14('0x26')]===0x0?undefined:_0x8e0e});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 4d4ba35..e88732b 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 _0xf19c=['AnyConditions','chat','ChatWebsiteId','operator','upperFirst','interaction','event','value','agent','lastevent','mailSubstatus','substatus','offlineMessage','created','equals','util','lodash','url','ioredis','./urlforward','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','undefined','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','toLowerCase','contactmanager','motionbar','browser','data1','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','winArguments','format','user:%s','name','trigger:%s:%s','action','trigger:%s','exec','integration','accounts','queue','routeId','parse','query','replace','channel','AllConditions','length','every','checkConditions','some'];(function(_0x327e8b,_0x912506){var _0x89151=function(_0x25f76c){while(--_0x25f76c){_0x327e8b['push'](_0x327e8b['shift']());}};_0x89151(++_0x912506);}(_0xf19c,0x10b));var _0xcf19=function(_0x5942af,_0x35dae3){_0x5942af=_0x5942af-0x0;var _0x2d2c4d=_0xf19c[_0x5942af];return _0x2d2c4d;};'use strict';var util=require(_0xcf19('0x0'));var _=require(_0xcf19('0x1'));var url=require(_0xcf19('0x2'));var Mustache=require('mustache');var Redis=require(_0xcf19('0x3'));var urlforward=require(_0xcf19('0x4'));var integration=require('./integration');var cmContact=require(_0xcf19('0x5'));var script=require(_0xcf19('0x6'));var config=require(_0xcf19('0x7'));var logger=require(_0xcf19('0x8'))(_0xcf19('0x9'));var ami=require('../ami');config[_0xcf19('0xa')]=_[_0xcf19('0xb')](config[_0xcf19('0xa')],{'host':_0xcf19('0xc'),'port':0x18eb});var io=require(_0xcf19('0xd'))(new Redis(config[_0xcf19('0xa')]));var operators={'equals':function(_0x5e0540,_0x3327d1){return _0x5e0540==_0x3327d1;},'not_equals':function(_0x313e38,_0xde8967){return _0x313e38!=_0xde8967;}};var barAndWebActions=[_0xcf19('0xe'),_0xcf19('0x2'),_0xcf19('0xf')];function Trigger(_0x3c9355){this[_0xcf19('0x10')]=_0x3c9355[_0xcf19('0x10')];this['agents']=_0x3c9355[_0xcf19('0x11')];this[_0xcf19('0x12')]=_0x3c9355[_0xcf19('0x12')];this[_0xcf19('0x13')]=_0x3c9355[_0xcf19('0x13')];this[_0xcf19('0x14')]=_0x3c9355[_0xcf19('0x14')];this[_0xcf19('0x15')]=_0x3c9355[_0xcf19('0x15')];this[_0xcf19('0x16')]=_0x3c9355[_0xcf19('0x16')];this[_0xcf19('0x17')]=_0x3c9355[_0xcf19('0x17')];this[_0xcf19('0x18')]=_0x3c9355[_0xcf19('0x18')];this[_0xcf19('0x19')]=_0x3c9355['zohoAccounts'];this['deskAccounts']=_0x3c9355[_0xcf19('0x1a')];this[_0xcf19('0x1b')]=_0x3c9355[_0xcf19('0x1b')];this[_0xcf19('0x1c')]=_0x3c9355[_0xcf19('0x1c')];this[_0xcf19('0x1d')]=_0x3c9355['dynamics365Accounts'];this[_0xcf19('0x1e')]=_0x3c9355[_0xcf19('0x1e')];this['accounts']={'zendesk':this[_0xcf19('0x15')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xcf19('0x16')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xcf19('0x19')],'desk':this[_0xcf19('0x1a')],'vtiger':this[_0xcf19('0x1b')],'dynamics365':this[_0xcf19('0x1d')],'freshsales':this[_0xcf19('0x1e')],'servicenow':this[_0xcf19('0x1c')]};ami['on']('custom:agentcalled',this['syncCustomEvent'][_0xcf19('0x1f')](this));ami['on'](_0xcf19('0x20'),this[_0xcf19('0x21')][_0xcf19('0x1f')](this));ami['on'](_0xcf19('0x22'),this[_0xcf19('0x21')][_0xcf19('0x1f')](this));ami['on'](_0xcf19('0x23'),this['syncCustomEvent']['bind'](this));ami['on'](_0xcf19('0x24'),this[_0xcf19('0x21')][_0xcf19('0x1f')](this));ami['on'](_0xcf19('0x25'),this[_0xcf19('0x21')][_0xcf19('0x1f')](this));ami['on'](_0xcf19('0x26'),this['syncCustomEvent']['bind'](this));ami['on'](_0xcf19('0x27'),this[_0xcf19('0x21')][_0xcf19('0x1f')](this));ami['on'](_0xcf19('0x28'),this[_0xcf19('0x21')][_0xcf19('0x1f')](this));ami['on'](_0xcf19('0x29'),this[_0xcf19('0x21')][_0xcf19('0x1f')](this));ami['on'](_0xcf19('0x2a'),this['syncCustomEvent']['bind'](this));ami['on'](_0xcf19('0x2b'),this['syncCustomEvent'][_0xcf19('0x1f')](this));ami['on'](_0xcf19('0x2c'),this['syncAgentDial'][_0xcf19('0x1f')](this));ami['on'](_0xcf19('0x2d'),this[_0xcf19('0x2e')]['bind'](this));ami['on']('custom:dialend',this[_0xcf19('0x2e')][_0xcf19('0x1f')](this));ami['on'](_0xcf19('0x2f'),this[_0xcf19('0x21')]['bind'](this));ami['on'](_0xcf19('0x30'),this[_0xcf19('0x21')]['bind'](this));ami['on'](_0xcf19('0x31'),this[_0xcf19('0x21')][_0xcf19('0x1f')](this));ami['on'](_0xcf19('0x32'),this['syncCustomEvent']['bind'](this));ami['on'](_0xcf19('0x33'),this['syncCustomEvent'][_0xcf19('0x1f')](this));ami['on'](_0xcf19('0x34'),this['syncCustomEvent'][_0xcf19('0x1f')](this));ami['on'](_0xcf19('0x35'),this[_0xcf19('0x21')][_0xcf19('0x1f')](this));ami['on'](_0xcf19('0x36'),this[_0xcf19('0x21')][_0xcf19('0x1f')](this));}Trigger[_0xcf19('0x37')][_0xcf19('0x38')]=function(_0x51d0af,_0x82cc06,_0x5ea0bd){logger[_0xcf19('0x39')](_0x51d0af,_0x82cc06,JSON[_0xcf19('0x3a')](_0x5ea0bd));io['to'](_0x51d0af)[_0xcf19('0x38')](_0x82cc06,_0x5ea0bd);};Trigger[_0xcf19('0x37')]['syncCustomEvent']=function(_0x45f8f7){var _0x42db99=_[_0xcf19('0x3b')](_0x45f8f7);if(typeof _0x42db99[_0xcf19('0x3c')]===_0xcf19('0x3d')){_0x42db99['motionChannel']='voice';}this['checkTriggers'](_0x42db99);};Trigger['prototype'][_0xcf19('0x2e')]=function(_0x257ed6){if(this[_0xcf19('0x11')][_0x257ed6[_0xcf19('0x3e')]]){this[_0xcf19('0x21')](_0x257ed6);}};Trigger['prototype']['checkTriggers']=function(_0x4cc353){var _0x5ca742;for(var _0x4fa143 in this['triggers']){if(this[_0xcf19('0x10')][_0xcf19('0x3f')](_0x4fa143)){if(this[_0xcf19('0x10')][_0x4fa143][_0xcf19('0x40')]){_0x5ca742=this[_0xcf19('0x41')](this[_0xcf19('0x10')][_0x4fa143],_0x4cc353);if(_0x5ca742){_[_0xcf19('0x42')](_0x4cc353,_0x4cc353[_0xcf19('0x43')]);for(var _0x5e7e65=0x0,_0x554a3f,_0x3b43ac,_0x18071c;_0x5e7e650x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x13c434,_0x5550ee){var _0x20263f=function(_0x4b1e3c){while(--_0x4b1e3c){_0x13c434['push'](_0x13c434['shift']());}};_0x20263f(++_0x5550ee);}(_0x814b,0x1a2));var _0xb814=function(_0x190c49,_0x103457){_0x190c49=_0x190c49-0x0;var _0x475b9a=_0x814b[_0x190c49];return _0x475b9a;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ 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 df404bc..c4e0183 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 _0xb163=['nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','picklist','type','nameField','customField','substring','indexOf','ticketType','incidents','getString','Descriptions','/contacts(','phonecall','callDirection','queue','assign','Subjects','lastIndexOf','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','unmanaged','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','remoteUri','username','password','clientSecret','then','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','userEmail','email','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','toLowerCase','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','telephone1','enduserId'];(function(_0x4cd456,_0x5ed25f){var _0x434181=function(_0x463097){while(--_0x463097){_0x4cd456['push'](_0x4cd456['shift']());}};_0x434181(++_0x5ed25f);}(_0xb163,0x1b4));var _0x3b16=function(_0x25c570,_0x141d34){_0x25c570=_0x25c570-0x0;var _0xff5521=_0xb163[_0x25c570];return _0xff5521;};'use strict';var _=require('lodash');var BPromise=require(_0x3b16('0x0'));var rp=require(_0x3b16('0x1'));var util=require('util');var intUtil=require(_0x3b16('0x2'));var md5=require(_0x3b16('0x3'));var Redis=require(_0x3b16('0x4'));var logger=require('../../../../config/logger')(_0x3b16('0x5'));var config=require(_0x3b16('0x6'));config[_0x3b16('0x7')]=_[_0x3b16('0x8')](config[_0x3b16('0x7')],{'host':_0x3b16('0x9'),'port':0x18eb});var io=require(_0x3b16('0xa'))(new Redis(config[_0x3b16('0x7')]));function getAuthToken(_0x590511,_0x416308,_0x3fb976){var _0x3e74f9={'method':_0x3b16('0xb'),'uri':_0x416308,'form':{'client_id':_0x590511['clientId'],'resource':_0x590511[_0x3b16('0xc')],'username':_0x590511[_0x3b16('0xd')],'password':_0x590511[_0x3b16('0xe')],'grant_type':_0x3b16('0xe'),'client_secret':_0x590511[_0x3b16('0xf')]},'json':!![]};return rp(_0x3e74f9)[_0x3b16('0x10')](function(_0x3d2f0e){return _0x3d2f0e['access_token'];})['catch'](function(_0x361f42){logger[_0x3b16('0x11')]('['+[_0x3fb976[_0x3b16('0x12')]()]+_0x3b16('0x13'));return _0x361f42[_0x3b16('0x14')];});}function getUser(_0x52a712,_0x435765,_0x4fd6ca,_0x2be62c,_0x479f43,_0x548311){return new BPromise(function(_0x5e3cb3,_0x580a60){return getAuthToken(_0x435765,_0x2be62c,_0x548311)[_0x3b16('0x10')](function(_0x4935fc){var _0x33ba60={'method':'GET','uri':_0x479f43+_0x3b16('0x15'),'headers':{'Authorization':_0x3b16('0x16')+_0x4935fc,'OData-Version':_0x3b16('0x17')},'json':!![]};return rp(_0x33ba60);})['then'](function(_0x1dc055){var _0x18000a=_0x1dc055[_0x3b16('0x18')];var _0x1201a6=![];var _0x240533=null;if(!_['isNil'](_0x4fd6ca)){if(intUtil[_0x3b16('0x19')](_0x4fd6ca['email'])){_0x52a712[_0x3b16('0x1a')]=_0x4fd6ca[_0x3b16('0x1b')];for(_0x240533=0x0;_0x240533<_0x18000a[_0x3b16('0x1c')];_0x240533++){if(_0x18000a[_0x240533][_0x3b16('0x1d')]===_0x4fd6ca[_0x3b16('0x1b')]&&!_0x18000a[_0x240533]['isdisabled']){_0x1201a6=!![];logger[_0x3b16('0x1e')]('['+[_0x548311['toUpperCase']()]+_0x3b16('0x1f')+_0x18000a[_0x240533][_0x3b16('0x20')]+'!');_0x52a712[_0x3b16('0x21')]=_0x18000a[_0x240533][_0x3b16('0x20')];}}}}if(!_0x1201a6){logger['info']('['+[_0x548311[_0x3b16('0x12')]()]+_0x3b16('0x22'));_0x52a712[_0x3b16('0x1a')]=_0x435765[_0x3b16('0xd')];for(_0x240533=0x0;_0x240533<_0x18000a[_0x3b16('0x1c')];_0x240533++){if(_0x18000a[_0x240533][_0x3b16('0x1d')]===_0x435765[_0x3b16('0xd')]){_0x52a712[_0x3b16('0x21')]=_0x18000a[_0x240533]['systemuserid'];}}}_0x5e3cb3(_0x52a712);})[_0x3b16('0x23')](function(_0x3a7edd){_0x580a60(_0x3a7edd[_0x3b16('0x14')]);});});}function createEndUser(_0x26efe2,_0x341ae7,_0x18f097,_0x3280f9,_0x3a49bc,_0x1612a6){return new BPromise(function(_0x4ff0e4,_0x1ad519){return getAuthToken(_0x341ae7,_0x18f097,_0x1612a6)[_0x3b16('0x10')](function(_0x1123ad){var _0x757a33=_0x1612a6['toLowerCase']()===_0x3b16('0x24')?_0x3a49bc[_0x3b16('0x25')]:_0x3a49bc[_0x3b16('0x26')];var _0x5abf36={'method':_0x3b16('0xb'),'uri':_0x3280f9+_0x3b16('0x27'),'body':{'telephone1':_0x757a33,'fullname':_0x757a33,'firstname':_0x757a33,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3b16('0x28')+_0x26efe2[_0x3b16('0x21')]+')'},'headers':{'Authorization':_0x3b16('0x16')+_0x1123ad,'OData-Version':_0x3b16('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5abf36);})[_0x3b16('0x10')](function(_0x586d62){var _0x5a6767=_0x586d62[_0x3b16('0x29')][_0x3b16('0x2a')];var _0x2f2ba5=_0x5a6767['substring'](_0x5a6767['lastIndexOf']('(')+0x1,_0x5a6767['lastIndexOf'](')'));_0x26efe2['enduserId']=_0x2f2ba5;_0x4ff0e4(_0x26efe2);})[_0x3b16('0x23')](function(_0x35fbbe){_0x1ad519(_0x35fbbe[_0x3b16('0x14')]);});});}function getEndUser(_0x48724a,_0x54a2e3,_0x56d87a,_0x45992b,_0x10cd21,_0x1bd102,_0x16d2ef){var _0x5ad63e=_0x1bd102[_0x3b16('0x2b')]()===_0x3b16('0x24')?_0x10cd21['destcalleridnum']:_0x10cd21[_0x3b16('0x26')];return getAuthToken(_0x54a2e3,_0x56d87a,_0x1bd102)[_0x3b16('0x10')](function(_0xa00ba1){var _0x9016dc={'method':_0x3b16('0x2c'),'uri':_0x45992b+_0x3b16('0x2d')+_0x5ad63e[_0x3b16('0x2e')]('+','%2b')+'\x27','headers':{'Authorization':_0x3b16('0x16')+_0xa00ba1,'If-None-Match':null,'OData-Version':_0x3b16('0x17')},'json':!![]};return rp(_0x9016dc);})[_0x3b16('0x10')](function(_0x531fff){var _0x521bdf=![];if(!_0x531fff)return _0x521bdf;var _0x4517c0=_0x531fff[_0x3b16('0x18')];for(var _0x4ce5bc=0x0;_0x4ce5bc<_0x4517c0[_0x3b16('0x1c')];_0x4ce5bc++){if(_0x4517c0[_0x4ce5bc][_0x3b16('0x2f')]===_0x5ad63e){_0x521bdf=!![];_0x48724a[_0x3b16('0x30')]=_0x4517c0[_0x4ce5bc]['contactid'];}}return _0x521bdf;})[_0x3b16('0x10')](function(_0x4c0e64){if(_0x4c0e64)return _0x48724a;if(_0x16d2ef===_0x3b16('0x31')){logger[_0x3b16('0x1e')]('['+[_0x1bd102[_0x3b16('0x12')]()]+_0x3b16('0x32'));return _0x48724a;}return createEndUser(_0x48724a,_0x54a2e3,_0x56d87a,_0x45992b,_0x10cd21,_0x1bd102)['then'](function(_0x4ca457){logger['info']('['+[_0x1bd102[_0x3b16('0x12')]()]+_0x3b16('0x33'),_0x4ca457['enduserId']);return _0x4ca457;});});}function getCustomFields(_0x4fac49,_0x420ada,_0x7d061e){var _0x8d8539={};if(_0x4fac49[_0x3b16('0x1c')]>0x0){_[_0x3b16('0x34')](_0x4fac49,function(_0x1ce24f){if(_['includes'](['string',_0x3b16('0x35')],_0x1ce24f[_0x3b16('0x36')])&&_0x1ce24f[_0x3b16('0x37')]&&!_0x1ce24f[_0x3b16('0x38')]){var _0x53c506=_0x1ce24f['idField'][_0x3b16('0x2b')]();var _0xeaf609=_0x53c506[_0x3b16('0x39')](0x0,_0x53c506[_0x3b16('0x3a')]('_'));var _0x13dda7=_0x53c506['substring'](_0x53c506[_0x3b16('0x3a')]('_')+0x1);if(_0xeaf609===_0x7d061e){_0x8d8539[_0x13dda7]=_0x1ce24f['content'];}}});}return _0x8d8539;}function getTicket(_0x48ddc5,_0x1d81d6,_0x51f099,_0x51642f,_0x1337ab,_0x1deddd,_0x5c0ae4){return new BPromise(function(_0x2c29cb,_0x5d663b){var _0x549b79;return getAuthToken(_0x1d81d6,_0x51f099,_0x5c0ae4)['then'](function(_0x21a03d){if(_0x1deddd[_0x3b16('0x3b')]==='incident'){_0x549b79={'method':_0x3b16('0xb'),'uri':_0x51642f+_0x3b16('0x3c'),'body':Object['assign']({},{'title':intUtil[_0x3b16('0x3d')](_0x1deddd['Subjects'],_0x1337ab,'\x20'),'description':intUtil[_0x3b16('0x3d')](_0x1deddd[_0x3b16('0x3e')],_0x1337ab,'\x0a'),'customerid_contact@odata.bind':_0x48ddc5[_0x3b16('0x30')]?_0x3b16('0x3f')+_0x48ddc5['enduserId']+')':undefined,'ownerid@odata.bind':_0x3b16('0x28')+_0x48ddc5[_0x3b16('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x1deddd['Fields'],_0x1337ab,_0x1deddd[_0x3b16('0x3b')])),'headers':{'Authorization':_0x3b16('0x16')+_0x21a03d,'OData-Version':_0x3b16('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1deddd[_0x3b16('0x3b')]===_0x3b16('0x40')){var _0x5a3e40=_0x48ddc5[_0x3b16('0x30')]?[{'partyid_systemuser@odata.bind':_0x3b16('0x28')+_0x48ddc5[_0x3b16('0x21')]+')','participationtypemask':_0x48ddc5[_0x3b16('0x41')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x48ddc5[_0x3b16('0x30')]+')','participationtypemask':_0x48ddc5[_0x3b16('0x41')]===_0x3b16('0x42')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x3b16('0x28')+_0x48ddc5[_0x3b16('0x21')]+')','participationtypemask':_0x48ddc5[_0x3b16('0x41')]==='queue'?0x2:0x1}];_0x549b79={'method':_0x3b16('0xb'),'uri':_0x51642f+'phonecalls','body':Object[_0x3b16('0x43')]({},{'subject':intUtil[_0x3b16('0x3d')](_0x1deddd[_0x3b16('0x44')],_0x1337ab,'\x20'),'phonenumber':String(_0x1337ab[_0x3b16('0x26')]),'description':intUtil['getString'](_0x1deddd[_0x3b16('0x3e')],_0x1337ab,'\x0a'),'regardingobjectid_contact@odata.bind':_0x48ddc5[_0x3b16('0x30')]?_0x3b16('0x3f')+_0x48ddc5[_0x3b16('0x30')]+')':undefined,'ownerid@odata.bind':_0x3b16('0x28')+_0x48ddc5[_0x3b16('0x21')]+')','directioncode':_0x48ddc5[_0x3b16('0x41')]===_0x3b16('0x42')?![]:!![],'phonecall_activity_parties':_0x5a3e40},getCustomFields(_0x1deddd['Fields'],_0x1337ab,_0x1deddd[_0x3b16('0x3b')])),'headers':{'Authorization':_0x3b16('0x16')+_0x21a03d,'OData-Version':_0x3b16('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x549b79);})[_0x3b16('0x10')](function(_0x209d9f){var _0x5e9490=_0x209d9f[_0x3b16('0x29')][_0x3b16('0x2a')];var _0xed20ec=_0x5e9490[_0x3b16('0x39')](_0x5e9490[_0x3b16('0x45')]('(')+0x1,_0x5e9490['lastIndexOf'](')'));_0x48ddc5['ticketId']=_0xed20ec;_0x2c29cb(_0x48ddc5);})[_0x3b16('0x23')](function(_0x5a87b8){_0x5d663b(_0x5a87b8[_0x3b16('0x14')]);});});}function emit(_0x5c085b,_0x59948a,_0x3b7521,_0x4c703d){var _0x58d7b9={'uri':util[_0x3b16('0x46')](_0x3b16('0x47'),_0x5c085b,_0x3b7521,_0x4c703d)};io['to'](util[_0x3b16('0x46')]('user:%s',_0x59948a))[_0x3b16('0x48')](_0x3b16('0x49'),_0x58d7b9);}exports['cs']=function(_0x5effe0,_0x30cd25,_0x1f8c55,_0x347d55,_0x270454,_0x3e704f,_0x3bb384,_0x25001f){var _0x1e748d={};_0x3e704f[_0x3b16('0xc')]=intUtil[_0x3b16('0x4a')](_0x3e704f[_0x3b16('0xc')]);_0x3e704f['serverUrl']=intUtil[_0x3b16('0x4a')](_0x3e704f['serverUrl']);_0x1e748d[_0x3b16('0x41')]=_0x25001f===_0x3b16('0x42')||_0x25001f===_0x3b16('0x4b')?'queue':_0x3b16('0x24');var _0x340483=util[_0x3b16('0x46')]('%s/api/data/v9.0/',_0x3e704f[_0x3b16('0xc')]);var _0x171198=util[_0x3b16('0x46')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3e704f[_0x3b16('0x4c')]);var _0x5cd978=util['format'](_0x3b16('0x4d'),_0x3e704f[_0x3b16('0x4e')],_0x30cd25[_0x3b16('0x4f')],md5(_0x30cd25[_0x3b16('0x4f')]));if(_0x270454&&_0x270454[_0x3b16('0x50')]){logger['info'](_0x3b16('0x51'),_0x3b16('0x52'));_0x30cd25[_0x3b16('0x53')]=_0x5cd978;}else if(_0x3bb384&&_0x3bb384['recordingFormat']&&_0x3bb384[_0x3b16('0x54')]!==_0x3b16('0x55')){logger[_0x3b16('0x1e')](_0x3b16('0x56'),'Recording\x20is\x20enabled!');_0x30cd25['recordingURL']=_0x5cd978;}else{_0x30cd25[_0x3b16('0x53')]='';}return getUser(_0x1e748d,_0x3e704f,_0x347d55,_0x171198,_0x340483,_0x25001f)[_0x3b16('0x10')](function(_0x16e787){logger['info']('['+_0x25001f[_0x3b16('0x12')]()+_0x3b16('0x57'),_0x16e787[_0x3b16('0x21')]);logger[_0x3b16('0x1e')]('['+_0x25001f['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x16e787[_0x3b16('0x1a')]);return getEndUser(_0x16e787,_0x3e704f,_0x171198,_0x340483,_0x30cd25,_0x25001f,_0x1f8c55[_0x3b16('0x58')]);})[_0x3b16('0x10')](function(_0xdf92b6){logger[_0x3b16('0x1e')]('['+_0x25001f[_0x3b16('0x12')]()+_0x3b16('0x59'),_0xdf92b6[_0x3b16('0x30')]);logger[_0x3b16('0x1e')]('['+_0x25001f[_0x3b16('0x12')]()+_0x3b16('0x5a'),_0x30cd25[_0x3b16('0x26')]);return getTicket(_0xdf92b6,_0x3e704f,_0x171198,_0x340483,_0x30cd25,_0x1f8c55,_0x25001f);})[_0x3b16('0x10')](function(_0x479446){logger[_0x3b16('0x1e')](util[_0x3b16('0x46')]('['+_0x25001f[_0x3b16('0x12')]()+_0x3b16('0x5b'),_0x1f8c55[_0x3b16('0x3b')],_0x479446[_0x3b16('0x5c')]));logger[_0x3b16('0x1e')](util[_0x3b16('0x46')]('['+_0x25001f[_0x3b16('0x12')]()+']\x20Call\x20direction:\x20%s',_0x25001f));if(_0x25001f!==_0x3b16('0x4b')){logger[_0x3b16('0x1e')]('['+_0x25001f['toUpperCase']()+']',_0x3b16('0x5d'));emit(_0x3e704f[_0x3b16('0xc')],_0x347d55[_0x3b16('0x5e')],_0x1f8c55[_0x3b16('0x3b')],_0x479446[_0x3b16('0x5c')]);}})[_0x3b16('0x23')](function(_0x1d2260){logger[_0x3b16('0x11')]('['+_0x25001f[_0x3b16('0x12')]()+_0x3b16('0x5f'),util[_0x3b16('0x60')](_0x1d2260,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3c9e=[']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','4.0','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','Bearer\x20','headers','odata-entityid','lastIndexOf','enduserId','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','%2b','value','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','string','picklist','type','nameField','idField','substring','indexOf','ticketType','incident','incidents','assign','getString','Subjects','/systemusers(','Fields','phonecall','callDirection','/contacts(','queue','phonecalls','Descriptions','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...'];(function(_0x1c470d,_0x81d66b){var _0x12141b=function(_0x45bfd3){while(--_0x45bfd3){_0x1c470d['push'](_0x1c470d['shift']());}};_0x12141b(++_0x81d66b);}(_0x3c9e,0xc6));var _0xe3c9=function(_0x5b08ca,_0x3a9dfb){_0x5b08ca=_0x5b08ca-0x0;var _0x3fd707=_0x3c9e[_0x5b08ca];return _0x3fd707;};'use strict';var _=require('lodash');var BPromise=require(_0xe3c9('0x0'));var rp=require(_0xe3c9('0x1'));var util=require('util');var intUtil=require('./util');var md5=require(_0xe3c9('0x2'));var Redis=require('ioredis');var logger=require(_0xe3c9('0x3'))(_0xe3c9('0x4'));var config=require(_0xe3c9('0x5'));config[_0xe3c9('0x6')]=_[_0xe3c9('0x7')](config['redis'],{'host':_0xe3c9('0x8'),'port':0x18eb});var io=require(_0xe3c9('0x9'))(new Redis(config['redis']));function getAuthToken(_0x3a63d0,_0x3bac5d,_0x39340f){var _0x513713={'method':_0xe3c9('0xa'),'uri':_0x3bac5d,'form':{'client_id':_0x3a63d0[_0xe3c9('0xb')],'resource':_0x3a63d0[_0xe3c9('0xc')],'username':_0x3a63d0[_0xe3c9('0xd')],'password':_0x3a63d0['password'],'grant_type':_0xe3c9('0xe'),'client_secret':_0x3a63d0[_0xe3c9('0xf')]},'json':!![]};return rp(_0x513713)[_0xe3c9('0x10')](function(_0x3067dc){return _0x3067dc[_0xe3c9('0x11')];})['catch'](function(_0x2088eb){logger[_0xe3c9('0x12')]('['+[_0x39340f[_0xe3c9('0x13')]()]+_0xe3c9('0x14'));return _0x2088eb[_0xe3c9('0x15')];});}function getUser(_0x5e8874,_0x250af2,_0x280a9f,_0x3201e9,_0x42115a,_0x294865){return new BPromise(function(_0x4632e1,_0x9cc7e2){return getAuthToken(_0x250af2,_0x3201e9,_0x294865)[_0xe3c9('0x10')](function(_0x26c93e){var _0x52aae7={'method':'GET','uri':_0x42115a+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x26c93e,'OData-Version':_0xe3c9('0x16')},'json':!![]};return rp(_0x52aae7);})['then'](function(_0x33536f){var _0x3a6336=_0x33536f['value'];var _0x147f17=![];var _0x3a3183=null;if(!_[_0xe3c9('0x17')](_0x280a9f)){if(intUtil[_0xe3c9('0x18')](_0x280a9f[_0xe3c9('0x19')])){_0x5e8874[_0xe3c9('0x1a')]=_0x280a9f[_0xe3c9('0x19')];for(_0x3a3183=0x0;_0x3a3183<_0x3a6336[_0xe3c9('0x1b')];_0x3a3183++){if(_0x3a6336[_0x3a3183][_0xe3c9('0x1c')]===_0x280a9f[_0xe3c9('0x19')]&&!_0x3a6336[_0x3a3183][_0xe3c9('0x1d')]){_0x147f17=!![];logger[_0xe3c9('0x1e')]('['+[_0x294865[_0xe3c9('0x13')]()]+']\x20Agent\x20found\x20'+_0x3a6336[_0x3a3183][_0xe3c9('0x1f')]+'!');_0x5e8874[_0xe3c9('0x20')]=_0x3a6336[_0x3a3183]['systemuserid'];}}}}if(!_0x147f17){logger[_0xe3c9('0x1e')]('['+[_0x294865[_0xe3c9('0x13')]()]+_0xe3c9('0x21'));_0x5e8874['userEmail']=_0x250af2[_0xe3c9('0xd')];for(_0x3a3183=0x0;_0x3a3183<_0x3a6336['length'];_0x3a3183++){if(_0x3a6336[_0x3a3183]['internalemailaddress']===_0x250af2[_0xe3c9('0xd')]){_0x5e8874[_0xe3c9('0x20')]=_0x3a6336[_0x3a3183][_0xe3c9('0x1f')];}}}_0x4632e1(_0x5e8874);})[_0xe3c9('0x22')](function(_0x502a36){_0x9cc7e2(_0x502a36[_0xe3c9('0x15')]);});});}function createEndUser(_0x28f92d,_0xbb8c64,_0x16d5e8,_0x2df591,_0x53639d,_0x15997e){return new BPromise(function(_0x5c7283,_0x51aedf){return getAuthToken(_0xbb8c64,_0x16d5e8,_0x15997e)[_0xe3c9('0x10')](function(_0x27fa79){var _0x17a4d1=_0x15997e[_0xe3c9('0x23')]()===_0xe3c9('0x24')?_0x53639d[_0xe3c9('0x25')]:_0x53639d[_0xe3c9('0x26')];var _0x25472e={'method':_0xe3c9('0xa'),'uri':_0x2df591+_0xe3c9('0x27'),'body':{'telephone1':_0x17a4d1,'fullname':_0x17a4d1,'firstname':_0x17a4d1,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x28f92d[_0xe3c9('0x20')]+')'},'headers':{'Authorization':_0xe3c9('0x28')+_0x27fa79,'OData-Version':_0xe3c9('0x16')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x25472e);})[_0xe3c9('0x10')](function(_0x49265a){var _0x8b66af=_0x49265a[_0xe3c9('0x29')][_0xe3c9('0x2a')];var _0x6bf49a=_0x8b66af['substring'](_0x8b66af[_0xe3c9('0x2b')]('(')+0x1,_0x8b66af[_0xe3c9('0x2b')](')'));_0x28f92d[_0xe3c9('0x2c')]=_0x6bf49a;_0x5c7283(_0x28f92d);})[_0xe3c9('0x22')](function(_0x21d956){_0x51aedf(_0x21d956[_0xe3c9('0x15')]);});});}function getEndUser(_0x5a8ddf,_0x5c51a4,_0x367414,_0x39c84d,_0xb59c60,_0x265425,_0xb1087c){var _0x401c95=_0x265425[_0xe3c9('0x23')]()===_0xe3c9('0x24')?_0xb59c60[_0xe3c9('0x25')]:_0xb59c60['calleridnum'];return getAuthToken(_0x5c51a4,_0x367414,_0x265425)[_0xe3c9('0x10')](function(_0x41f78f){var _0x194d89={'method':_0xe3c9('0x2d'),'uri':_0x39c84d+_0xe3c9('0x2e')+_0x401c95['replace']('+',_0xe3c9('0x2f'))+'\x27','headers':{'Authorization':_0xe3c9('0x28')+_0x41f78f,'If-None-Match':null,'OData-Version':_0xe3c9('0x16')},'json':!![]};return rp(_0x194d89);})[_0xe3c9('0x10')](function(_0x40d534){var _0x2ea620=![];if(!_0x40d534)return _0x2ea620;var _0xfa8fb8=_0x40d534[_0xe3c9('0x30')];for(var _0x4a25ac=0x0;_0x4a25ac<_0xfa8fb8[_0xe3c9('0x1b')];_0x4a25ac++){if(_0xfa8fb8[_0x4a25ac]['telephone1']===_0x401c95){_0x2ea620=!![];_0x5a8ddf[_0xe3c9('0x2c')]=_0xfa8fb8[_0x4a25ac]['contactid'];}}return _0x2ea620;})[_0xe3c9('0x10')](function(_0x132e6a){if(_0x132e6a)return _0x5a8ddf;if(_0xb1087c===_0xe3c9('0x31')){logger[_0xe3c9('0x1e')]('['+[_0x265425[_0xe3c9('0x13')]()]+_0xe3c9('0x32'));return _0x5a8ddf;}return createEndUser(_0x5a8ddf,_0x5c51a4,_0x367414,_0x39c84d,_0xb59c60,_0x265425)['then'](function(_0x2fc210){logger['info']('['+[_0x265425[_0xe3c9('0x13')]()]+']\x20Enduser\x20created!',_0x2fc210[_0xe3c9('0x2c')]);return _0x2fc210;});});}function getCustomFields(_0x2bfbd8,_0x443a24,_0x4f7946){var _0x597cb4={};if(_0x2bfbd8[_0xe3c9('0x1b')]>0x0){_[_0xe3c9('0x33')](_0x2bfbd8,function(_0x3b08ae){if(_['includes']([_0xe3c9('0x34'),_0xe3c9('0x35')],_0x3b08ae[_0xe3c9('0x36')])&&_0x3b08ae[_0xe3c9('0x37')]&&!_0x3b08ae['customField']){var _0x54b784=_0x3b08ae[_0xe3c9('0x38')][_0xe3c9('0x23')]();var _0x2cf12a=_0x54b784[_0xe3c9('0x39')](0x0,_0x54b784[_0xe3c9('0x3a')]('_'));var _0x11fafe=_0x54b784[_0xe3c9('0x39')](_0x54b784['indexOf']('_')+0x1);if(_0x2cf12a===_0x4f7946){_0x597cb4[_0x11fafe]=_0x3b08ae['content'];}}});}return _0x597cb4;}function getTicket(_0x1a42f2,_0x33c5ca,_0x5b33b7,_0x3579b9,_0x5d7250,_0x46308b,_0x40b872){return new BPromise(function(_0x495901,_0x16ee41){var _0xbe2731;return getAuthToken(_0x33c5ca,_0x5b33b7,_0x40b872)[_0xe3c9('0x10')](function(_0x107d3b){if(_0x46308b[_0xe3c9('0x3b')]===_0xe3c9('0x3c')){_0xbe2731={'method':'POST','uri':_0x3579b9+_0xe3c9('0x3d'),'body':Object[_0xe3c9('0x3e')]({},{'title':intUtil[_0xe3c9('0x3f')](_0x46308b[_0xe3c9('0x40')],_0x5d7250,'\x20'),'description':intUtil[_0xe3c9('0x3f')](_0x46308b['Descriptions'],_0x5d7250,'\x0a'),'customerid_contact@odata.bind':_0x1a42f2[_0xe3c9('0x2c')]?'/contacts('+_0x1a42f2[_0xe3c9('0x2c')]+')':undefined,'ownerid@odata.bind':_0xe3c9('0x41')+_0x1a42f2['userId']+')','caseorigincode':'1'},getCustomFields(_0x46308b[_0xe3c9('0x42')],_0x5d7250,_0x46308b[_0xe3c9('0x3b')])),'headers':{'Authorization':_0xe3c9('0x28')+_0x107d3b,'OData-Version':_0xe3c9('0x16')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x46308b[_0xe3c9('0x3b')]===_0xe3c9('0x43')){var _0x419a97=_0x1a42f2[_0xe3c9('0x2c')]?[{'partyid_systemuser@odata.bind':_0xe3c9('0x41')+_0x1a42f2[_0xe3c9('0x20')]+')','participationtypemask':_0x1a42f2[_0xe3c9('0x44')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xe3c9('0x45')+_0x1a42f2['enduserId']+')','participationtypemask':_0x1a42f2[_0xe3c9('0x44')]===_0xe3c9('0x46')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xe3c9('0x41')+_0x1a42f2['userId']+')','participationtypemask':_0x1a42f2[_0xe3c9('0x44')]==='queue'?0x2:0x1}];_0xbe2731={'method':_0xe3c9('0xa'),'uri':_0x3579b9+_0xe3c9('0x47'),'body':Object[_0xe3c9('0x3e')]({},{'subject':intUtil[_0xe3c9('0x3f')](_0x46308b[_0xe3c9('0x40')],_0x5d7250,'\x20'),'phonenumber':String(_0x5d7250['calleridnum']),'description':intUtil['getString'](_0x46308b[_0xe3c9('0x48')],_0x5d7250,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1a42f2[_0xe3c9('0x2c')]?_0xe3c9('0x45')+_0x1a42f2[_0xe3c9('0x2c')]+')':undefined,'ownerid@odata.bind':_0xe3c9('0x41')+_0x1a42f2[_0xe3c9('0x20')]+')','directioncode':_0x1a42f2[_0xe3c9('0x44')]==='queue'?![]:!![],'phonecall_activity_parties':_0x419a97},getCustomFields(_0x46308b['Fields'],_0x5d7250,_0x46308b[_0xe3c9('0x3b')])),'headers':{'Authorization':_0xe3c9('0x28')+_0x107d3b,'OData-Version':_0xe3c9('0x16')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xbe2731);})[_0xe3c9('0x10')](function(_0x39119c){var _0x3668aa=_0x39119c[_0xe3c9('0x29')][_0xe3c9('0x2a')];var _0x34cd2d=_0x3668aa[_0xe3c9('0x39')](_0x3668aa[_0xe3c9('0x2b')]('(')+0x1,_0x3668aa['lastIndexOf'](')'));_0x1a42f2[_0xe3c9('0x49')]=_0x34cd2d;_0x495901(_0x1a42f2);})[_0xe3c9('0x22')](function(_0x39c386){_0x16ee41(_0x39c386[_0xe3c9('0x15')]);});});}function emit(_0x254b21,_0x24350d,_0x145ccd,_0x3901b7){var _0x26e02e={'uri':util['format'](_0xe3c9('0x4a'),_0x254b21,_0x145ccd,_0x3901b7)};io['to'](util[_0xe3c9('0x4b')](_0xe3c9('0x4c'),_0x24350d))[_0xe3c9('0x4d')](_0xe3c9('0x4e'),_0x26e02e);}exports['cs']=function(_0x45587b,_0x40c7b8,_0x298249,_0x13fe6f,_0x3a02c9,_0x1476f0,_0x41cdc3,_0x41c0ca){var _0xd7f1de={};_0x1476f0[_0xe3c9('0xc')]=intUtil[_0xe3c9('0x4f')](_0x1476f0[_0xe3c9('0xc')]);_0x1476f0[_0xe3c9('0x50')]=intUtil[_0xe3c9('0x4f')](_0x1476f0[_0xe3c9('0x50')]);_0xd7f1de['callDirection']=_0x41c0ca===_0xe3c9('0x46')||_0x41c0ca===_0xe3c9('0x51')?'queue':_0xe3c9('0x24');var _0x286072=util[_0xe3c9('0x4b')]('%s/api/data/v9.0/',_0x1476f0['remoteUri']);var _0x47b1c0=util[_0xe3c9('0x4b')](_0xe3c9('0x52'),_0x1476f0['tenantId']);var _0x307beb=util[_0xe3c9('0x4b')](_0xe3c9('0x53'),_0x1476f0[_0xe3c9('0x50')],_0x40c7b8[_0xe3c9('0x54')],md5(_0x40c7b8[_0xe3c9('0x54')]));if(_0x3a02c9&&_0x3a02c9[_0xe3c9('0x55')]){logger[_0xe3c9('0x1e')](_0xe3c9('0x56'),_0xe3c9('0x57'));_0x40c7b8['recordingURL']=_0x307beb;}else if(_0x41cdc3&&_0x41cdc3[_0xe3c9('0x58')]&&_0x41cdc3[_0xe3c9('0x58')]!==_0xe3c9('0x59')){logger['info'](_0xe3c9('0x5a'),_0xe3c9('0x57'));_0x40c7b8[_0xe3c9('0x5b')]=_0x307beb;}else{_0x40c7b8[_0xe3c9('0x5b')]='';}return getUser(_0xd7f1de,_0x1476f0,_0x13fe6f,_0x47b1c0,_0x286072,_0x41c0ca)[_0xe3c9('0x10')](function(_0xd4246c){logger['info']('['+_0x41c0ca[_0xe3c9('0x13')]()+_0xe3c9('0x5c'),_0xd4246c['userId']);logger[_0xe3c9('0x1e')]('['+_0x41c0ca[_0xe3c9('0x13')]()+']\x20The\x20User\x20email\x20is:',_0xd4246c[_0xe3c9('0x1a')]);return getEndUser(_0xd4246c,_0x1476f0,_0x47b1c0,_0x286072,_0x40c7b8,_0x41c0ca,_0x298249['moduleCreate']);})[_0xe3c9('0x10')](function(_0x50201c){logger[_0xe3c9('0x1e')]('['+_0x41c0ca[_0xe3c9('0x13')]()+_0xe3c9('0x5d'),_0x50201c[_0xe3c9('0x2c')]);logger[_0xe3c9('0x1e')]('['+_0x41c0ca[_0xe3c9('0x13')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x40c7b8[_0xe3c9('0x26')]);return getTicket(_0x50201c,_0x1476f0,_0x47b1c0,_0x286072,_0x40c7b8,_0x298249,_0x41c0ca);})[_0xe3c9('0x10')](function(_0x1372ac){logger[_0xe3c9('0x1e')](util['format']('['+_0x41c0ca[_0xe3c9('0x13')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x298249[_0xe3c9('0x3b')],_0x1372ac[_0xe3c9('0x49')]));logger[_0xe3c9('0x1e')](util[_0xe3c9('0x4b')]('['+_0x41c0ca['toUpperCase']()+_0xe3c9('0x5e'),_0x41c0ca));if(_0x41c0ca!==_0xe3c9('0x51')){logger[_0xe3c9('0x1e')]('['+_0x41c0ca['toUpperCase']()+']',_0xe3c9('0x5f'));emit(_0x1476f0[_0xe3c9('0xc')],_0x13fe6f['name'],_0x298249[_0xe3c9('0x3b')],_0x1372ac['ticketId']);}})[_0xe3c9('0x22')](function(_0x28d320){logger[_0xe3c9('0x12')]('['+_0x41c0ca[_0xe3c9('0x13')]()+_0xe3c9('0x60'),util[_0xe3c9('0x61')](_0x28d320,{'showHidden':!![],'depth':null}));});}; \ 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 2eacf06..4f77574 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 _0x4736=['%s/helpdesk/tickets/%d','catch','error','stringify','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridnum','Ticket\x20created!','user:%s','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','POST','then','remoteUri','length','Agent\x20found!','find','contact','email','info','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','defaults','GET','map','forEach','includes','picklist','nameField','customField','toLowerCase','string','type','idField','push','content','variable','variableName','Variable','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4736,0x1e4));var _0x6473=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4736[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6473('0x0'));var rp=require(_0x6473('0x1'));var md5=require(_0x6473('0x2'));var util=require(_0x6473('0x3'));var Redis=require('ioredis');var intUtil=require(_0x6473('0x4'));var config=require(_0x6473('0x5'));var logger=require(_0x6473('0x6'))(_0x6473('0x7'));config[_0x6473('0x8')]=_['defaults'](config['redis'],{'host':_0x6473('0x9'),'port':0x18eb});var io=require(_0x6473('0xa'))(new Redis(config[_0x6473('0x8')]));var headers={'Content-Type':_0x6473('0xb'),'Accept':_0x6473('0xb')};function emit(_0x5b6342,_0x3e5cb1,_0x3f4e06){io['to'](_0x5b6342)[_0x6473('0xc')](_0x3e5cb1,_0x3f4e06);}function getTicket(_0x503943,_0x37a567,_0x7f0a01,_0x5b11ff,_0x3b5736){logger['info']('Creating\x20new\x20ticket...');var _0x44850b=_[_0x6473('0xd')]({'responder_id':_0x37a567['id'],'requester_id':_0x7f0a01['id'],'name':util[_0x6473('0xe')]('Caller\x20-\x20%s',_0x3b5736[_0x6473('0xf')]),'phone':_0x3b5736[_0x6473('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6473('0x11')](_0x5b11ff[_0x6473('0x12')],_0x3b5736,'\x20'),'description':intUtil[_0x6473('0x11')](_0x5b11ff[_0x6473('0x13')],_0x3b5736,_0x6473('0x14')),'tags':getTags(_0x5b11ff[_0x6473('0x15')],_0x6473('0x16'))},getCustomFields(_0x5b11ff[_0x6473('0x17')],_0x3b5736));_0x44850b[_0x6473('0x18')]=_[_0x6473('0x19')](_[_0x6473('0x1a')](_0x44850b[_0x6473('0x18')],'id'),_0x6473('0x1b'));return request({'uri':util[_0x6473('0xe')](_0x6473('0x1c'),_0x503943['remoteUri']),'method':_0x6473('0x1d'),'body':_0x44850b})[_0x6473('0x1e')](function(_0x59c2ed){logger['info']('Ticket\x20created!');return _0x59c2ed;});}function getUser(_0x29efcf,_0x519b34){if(intUtil['validateEmail'](_0x519b34)){return request({'uri':util[_0x6473('0xe')]('%s/api/v2/agents',_0x29efcf[_0x6473('0x1f')]),'qs':{'email':_0x519b34}})[_0x6473('0x1e')](function(_0x224dbc){if(_0x224dbc[_0x6473('0x20')]){logger['info'](_0x6473('0x21'));return _[_0x6473('0x22')](_0x224dbc,function(_0x124a85){return _0x124a85[_0x6473('0x23')][_0x6473('0x24')]===_0x519b34;});}else{logger[_0x6473('0x25')](_0x6473('0x26'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x29efcf[_0x6473('0x1f')])})[_0x6473('0x1e')](function(_0x4c7e4b){logger[_0x6473('0x25')](_0x6473('0x27'));return _0x4c7e4b;});}});}else{logger['info'](_0x6473('0x28'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x29efcf['remoteUri'])})[_0x6473('0x1e')](function(_0x24cdfc){logger[_0x6473('0x25')]('Admin\x20account\x20selected.');return _0x24cdfc;});}}function getEndUser(_0x1880a8,_0xb0f070,_0x10e8bb){logger[_0x6473('0x25')](_0x6473('0x29'),_0x10e8bb);return request({'uri':util[_0x6473('0xe')](_0x6473('0x2a'),_0x1880a8[_0x6473('0x1f')]),'qs':{'phone':_0x10e8bb}})[_0x6473('0x1e')](function(_0x3f0885){if(_0x3f0885[_0x6473('0x20')]){logger[_0x6473('0x25')](_0x6473('0x2b'));return _[_0x6473('0x22')](_0x3f0885,{'phone':_0x10e8bb});}else{logger['info'](_0x6473('0x2c'));return request({'uri':util[_0x6473('0xe')](_0x6473('0x2a'),_0x1880a8[_0x6473('0x1f')]),'method':_0x6473('0x1d'),'body':{'name':_0xb0f070,'phone':_0x10e8bb}})[_0x6473('0x1e')](function(_0x4eadf2){logger[_0x6473('0x25')](_0x6473('0x2d'));return _0x4eadf2;});}});}function getAuth(_0x24d6d0){return util[_0x6473('0xe')](_0x6473('0x2e'),new Buffer(_0x24d6d0[_0x6473('0x2f')]+':X')[_0x6473('0x30')]('base64'));}function request(_0x1249bf){logger[_0x6473('0x31')](_0x6473('0x32'),JSON['stringify'](_0x1249bf));return rp(_[_0x6473('0x33')](_0x1249bf,{'method':_0x6473('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x5cd963,_0x1dffa8){var _0x2491c5=[];if(_0x5cd963&&_0x5cd963[_0x6473('0x20')]>0x0){_0x2491c5=_[_0x6473('0x35')](_0x5cd963,_0x1dffa8);}return _0x2491c5;}function getCustomFields(_0x3d94d8,_0x296aee){var _0x82b5e0=[];var _0x260e7e={'custom_fields':[]};if(_0x3d94d8[_0x6473('0x20')]>0x0){_[_0x6473('0x36')](_0x3d94d8,function(_0x51dd42){if(_[_0x6473('0x37')](['string',_0x6473('0x38')],_0x51dd42['type'])&&_0x51dd42[_0x6473('0x39')]&&!_0x51dd42[_0x6473('0x3a')]){_0x260e7e[_0x51dd42[_0x6473('0x39')][_0x6473('0x3b')]()]=_0x51dd42['content'][_0x6473('0x30')]();}else if(_[_0x6473('0x37')]([_0x6473('0x3c'),_0x6473('0x38')],_0x51dd42[_0x6473('0x3d')])&&_0x51dd42[_0x6473('0x3e')]&&_0x51dd42[_0x6473('0x3a')]){_0x260e7e['custom_fields'][_0x6473('0x3f')]({'id':_0x51dd42[_0x6473('0x3e')],'value':_0x51dd42[_0x6473('0x40')]['toString']()});}else if(_0x51dd42[_0x6473('0x3d')]===_0x6473('0x41')&&_0x51dd42['variableName']&&_0x51dd42[_0x6473('0x3e')]&&_0x51dd42['customField']){_0x296aee[_0x51dd42['variableName']]&&_0x260e7e['custom_fields'][_0x6473('0x3f')]({'id':_0x51dd42[_0x6473('0x3e')],'value':_0x296aee[_0x51dd42[_0x6473('0x42')]][_0x6473('0x30')]()});}else if(_0x51dd42[_0x6473('0x3d')]==='customVariable'&&_0x51dd42[_0x6473('0x43')]&&_0x51dd42[_0x6473('0x43')][_0x6473('0x16')]&&_0x51dd42[_0x6473('0x3e')]&&_0x51dd42[_0x6473('0x3a')]){_0x296aee[_0x51dd42[_0x6473('0x43')][_0x6473('0x16')][_0x6473('0x3b')]()]&&_0x260e7e['custom_fields']['push']({'id':_0x51dd42[_0x6473('0x3e')],'value':_0x296aee[_0x51dd42['Variable']['name'][_0x6473('0x3b')]()][_0x6473('0x30')]()});}});}return _0x260e7e;}exports['queue']=function(_0x4aab35,_0x573163,_0x490bb3,_0x1862e8,_0xa6955b,_0x1321ca){var _0x2c63af,_0x5ab95a;_0x1321ca[_0x6473('0x1f')]=intUtil['stripTrailingSlash'](_0x1321ca[_0x6473('0x1f')]);_0x1321ca['serverUrl']=intUtil['stripTrailingSlash'](_0x1321ca[_0x6473('0x44')]);if(_0xa6955b&&_0xa6955b[_0x6473('0x45')]){logger[_0x6473('0x25')](_0x6473('0x46'),_0x6473('0x47'));_0x573163[_0x6473('0x48')]=util[_0x6473('0xe')](_0x6473('0x49'),_0x1321ca[_0x6473('0x44')],_0x573163['uniqueid'],md5(_0x573163[_0x6473('0x4a')]));}else{_0x573163[_0x6473('0x48')]='';}headers[_0x6473('0x4b')]=getAuth(_0x1321ca);return getUser(_0x1321ca,_0x1862e8[_0x6473('0x24')])[_0x6473('0x1e')](function(_0x5ba0e2){_0x2c63af=_0x5ba0e2;logger[_0x6473('0x25')](_0x6473('0x4c'),_0x2c63af['id']);return getEndUser(_0x1321ca,_0x573163['calleridname'],_0x573163['calleridnum']);})['then'](function(_0x38d971){_0x5ab95a=_0x38d971;logger[_0x6473('0x25')](_0x6473('0x4d'),_0x5ab95a['id']);return getTicket(_0x1321ca,_0x2c63af,_0x5ab95a,_0x490bb3,_0x573163);})[_0x6473('0x1e')](function(_0x2f6ccb){if(_0x2f6ccb&&_0x2f6ccb['id']){logger['info']('Ticket\x20created!');logger[_0x6473('0x25')](_0x6473('0x4e'),_0x2f6ccb['id']);logger[_0x6473('0x25')]('[QUEUE]',_0x6473('0x4f'));emit(util[_0x6473('0xe')]('user:%s',_0x1862e8['name']),'trigger:browser:url',{'uri':util[_0x6473('0xe')](_0x6473('0x50'),_0x1321ca[_0x6473('0x1f')],_0x2f6ccb['id'])});}})[_0x6473('0x51')](function(_0x1b2119){logger[_0x6473('0x52')](_0x6473('0x46'),JSON[_0x6473('0x53')](_0x1b2119));});};exports[_0x6473('0x54')]=function(_0x5ee65b,_0x119e88,_0x31cffa,_0x4d13d4,_0x5222e0,_0x5ebfeb,_0x16fb24){var _0x677cee,_0x46b0b8;_0x5ebfeb[_0x6473('0x1f')]=intUtil[_0x6473('0x55')](_0x5ebfeb['remoteUri']);_0x5ebfeb[_0x6473('0x44')]=intUtil['stripTrailingSlash'](_0x5ebfeb[_0x6473('0x44')]);if(_0x16fb24&&_0x16fb24[_0x6473('0x56')]&&_0x16fb24[_0x6473('0x56')]!==_0x6473('0x57')){logger[_0x6473('0x25')](_0x6473('0x58'),_0x6473('0x47'));_0x119e88[_0x6473('0x48')]=util[_0x6473('0xe')](_0x6473('0x49'),_0x5ebfeb[_0x6473('0x44')],_0x119e88['uniqueid'],md5(_0x119e88[_0x6473('0x4a')]));}headers[_0x6473('0x4b')]=getAuth(_0x5ebfeb);return getUser(_0x5ebfeb,_0x4d13d4[_0x6473('0x24')])[_0x6473('0x1e')](function(_0x1c7f6a){_0x677cee=_0x1c7f6a;logger['info'](_0x6473('0x4c'),_0x677cee['id']);return getEndUser(_0x5ebfeb,_0x119e88['destcalleridname'],_0x119e88[_0x6473('0x59')]);})[_0x6473('0x1e')](function(_0x219426){_0x46b0b8=_0x219426;logger[_0x6473('0x25')](_0x6473('0x4d'),_0x46b0b8['id']);return getTicket(_0x5ebfeb,_0x677cee,_0x46b0b8,_0x31cffa,_0x119e88);})[_0x6473('0x1e')](function(_0x2cb0f2){if(_0x2cb0f2&&_0x2cb0f2['id']){logger[_0x6473('0x25')](_0x6473('0x5a'));logger[_0x6473('0x25')](_0x6473('0x4e'),_0x2cb0f2['id']);logger[_0x6473('0x25')](_0x6473('0x58'),_0x6473('0x4f'));emit(util[_0x6473('0xe')](_0x6473('0x5b'),_0x4d13d4['name']),'trigger:browser:url',{'uri':util[_0x6473('0xe')](_0x6473('0x50'),_0x5ebfeb[_0x6473('0x1f')],_0x2cb0f2['id'])});}})[_0x6473('0x51')](function(_0x3939f5){logger[_0x6473('0x52')](_0x6473('0x58'),JSON[_0x6473('0x53')](_0x3939f5));});};exports['unmanaged']=function(_0x4a2da2,_0x5ec86b,_0x46d2b3,_0x14bd93,_0x3e8aac,_0x26b284){var _0x8d8278,_0x33f3b;_0x26b284[_0x6473('0x1f')]=intUtil[_0x6473('0x55')](_0x26b284[_0x6473('0x1f')]);_0x26b284[_0x6473('0x44')]=intUtil[_0x6473('0x55')](_0x26b284[_0x6473('0x44')]);if(_0x3e8aac&&_0x3e8aac[_0x6473('0x45')]){logger[_0x6473('0x25')]('['+_0x5ec86b[_0x6473('0x5c')][_0x6473('0x5d')]()+']','Recording\x20is\x20enabled!');_0x5ec86b[_0x6473('0x48')]=util[_0x6473('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x26b284[_0x6473('0x44')],_0x5ec86b['uniqueid'],md5(_0x5ec86b[_0x6473('0x4a')]));}else{_0x5ec86b[_0x6473('0x48')]='';}headers[_0x6473('0x4b')]=getAuth(_0x26b284);return getUser(_0x26b284,'')['then'](function(_0x2252e6){_0x8d8278=_0x2252e6;logger[_0x6473('0x25')](_0x6473('0x4c'),_0x8d8278['id']);return getEndUser(_0x26b284,_0x5ec86b[_0x6473('0xf')],_0x5ec86b[_0x6473('0x10')]);})[_0x6473('0x1e')](function(_0x511fd7){_0x33f3b=_0x511fd7;logger[_0x6473('0x25')]('The\x20Enduser\x20ID\x20is:',_0x33f3b['id']);return getTicket(_0x26b284,_0x8d8278,_0x33f3b,_0x46d2b3,_0x5ec86b);})[_0x6473('0x1e')](function(_0x3f92a0){if(_0x3f92a0){logger[_0x6473('0x25')](_0x6473('0x5a'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x3f92a0['id']);}})[_0x6473('0x51')](function(_0x3b07be){logger[_0x6473('0x52')]('['+_0x5ec86b[_0x6473('0x5c')]['toUpperCase']()+']',JSON[_0x6473('0x53')](_0x3b07be));});}; \ No newline at end of file +var _0xf397=['variableName','Variable','name','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Ticket\x20created!','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','info','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','email','format','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','GET','map','forEach','includes','string','picklist','nameField','toLowerCase','content','toString','type','idField','customField','push','variable'];(function(_0x37e7d4,_0x45cd59){var _0x4b41aa=function(_0xb2f37e){while(--_0xb2f37e){_0x37e7d4['push'](_0x37e7d4['shift']());}};_0x4b41aa(++_0x45cd59);}(_0xf397,0x1f2));var _0x7f39=function(_0x222e24,_0x4593ad){_0x222e24=_0x222e24-0x0;var _0x322b02=_0xf397[_0x222e24];return _0x322b02;};'use strict';var _=require(_0x7f39('0x0'));var rp=require(_0x7f39('0x1'));var md5=require(_0x7f39('0x2'));var util=require(_0x7f39('0x3'));var Redis=require(_0x7f39('0x4'));var intUtil=require(_0x7f39('0x5'));var config=require(_0x7f39('0x6'));var logger=require('../../../../config/logger')(_0x7f39('0x7'));config[_0x7f39('0x8')]=_[_0x7f39('0x9')](config[_0x7f39('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x7f39('0xa'))(new Redis(config[_0x7f39('0x8')]));var headers={'Content-Type':_0x7f39('0xb'),'Accept':_0x7f39('0xb')};function emit(_0x4eff87,_0xff9ed0,_0x4dff36){io['to'](_0x4eff87)[_0x7f39('0xc')](_0xff9ed0,_0x4dff36);}function getTicket(_0x36bf3e,_0x46f93e,_0x5d1a2f,_0x319d75,_0x5d816f){logger['info'](_0x7f39('0xd'));var _0x54cd67=_[_0x7f39('0xe')]({'responder_id':_0x46f93e['id'],'requester_id':_0x5d1a2f['id'],'name':util['format'](_0x7f39('0xf'),_0x5d816f[_0x7f39('0x10')]),'phone':_0x5d816f[_0x7f39('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7f39('0x12')](_0x319d75[_0x7f39('0x13')],_0x5d816f,'\x20'),'description':intUtil[_0x7f39('0x12')](_0x319d75[_0x7f39('0x14')],_0x5d816f,_0x7f39('0x15')),'tags':getTags(_0x319d75[_0x7f39('0x16')],'name')},getCustomFields(_0x319d75[_0x7f39('0x17')],_0x5d816f));_0x54cd67[_0x7f39('0x18')]=_[_0x7f39('0x19')](_['keyBy'](_0x54cd67['custom_fields'],'id'),_0x7f39('0x1a'));return request({'uri':util['format'](_0x7f39('0x1b'),_0x36bf3e[_0x7f39('0x1c')]),'method':_0x7f39('0x1d'),'body':_0x54cd67})['then'](function(_0x3d6cf6){logger[_0x7f39('0x1e')]('Ticket\x20created!');return _0x3d6cf6;});}function getUser(_0x83309c,_0xe829c1){if(intUtil[_0x7f39('0x1f')](_0xe829c1)){return request({'uri':util['format'](_0x7f39('0x20'),_0x83309c[_0x7f39('0x1c')]),'qs':{'email':_0xe829c1}})[_0x7f39('0x21')](function(_0x2ceb85){if(_0x2ceb85[_0x7f39('0x22')]){logger['info'](_0x7f39('0x23'));return _['find'](_0x2ceb85,function(_0x1e85a3){return _0x1e85a3['contact'][_0x7f39('0x24')]===_0xe829c1;});}else{logger[_0x7f39('0x1e')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7f39('0x25')](_0x7f39('0x26'),_0x83309c[_0x7f39('0x1c')])})[_0x7f39('0x21')](function(_0x1a28cd){logger[_0x7f39('0x1e')]('Admin\x20account\x20selected.');return _0x1a28cd;});}});}else{logger[_0x7f39('0x1e')](_0x7f39('0x27'));return request({'uri':util['format'](_0x7f39('0x26'),_0x83309c[_0x7f39('0x1c')])})[_0x7f39('0x21')](function(_0x2edb69){logger[_0x7f39('0x1e')](_0x7f39('0x28'));return _0x2edb69;});}}function getEndUser(_0x506a79,_0x50313c,_0x46bb0d){logger[_0x7f39('0x1e')](_0x7f39('0x29'),_0x46bb0d);return request({'uri':util[_0x7f39('0x25')](_0x7f39('0x2a'),_0x506a79[_0x7f39('0x1c')]),'qs':{'phone':_0x46bb0d}})['then'](function(_0x5f2766){if(_0x5f2766[_0x7f39('0x22')]){logger[_0x7f39('0x1e')]('Enduser\x20found!');return _[_0x7f39('0x2b')](_0x5f2766,{'phone':_0x46bb0d});}else{logger[_0x7f39('0x1e')](_0x7f39('0x2c'));return request({'uri':util['format'](_0x7f39('0x2a'),_0x506a79[_0x7f39('0x1c')]),'method':'POST','body':{'name':_0x50313c,'phone':_0x46bb0d}})['then'](function(_0x4ee4e2){logger['info'](_0x7f39('0x2d'));return _0x4ee4e2;});}});}function getAuth(_0x378a5e){return util['format'](_0x7f39('0x2e'),new Buffer(_0x378a5e[_0x7f39('0x2f')]+':X')['toString'](_0x7f39('0x30')));}function request(_0x2e5ff7){logger[_0x7f39('0x31')](_0x7f39('0x32'),JSON['stringify'](_0x2e5ff7));return rp(_[_0x7f39('0x9')](_0x2e5ff7,{'method':_0x7f39('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x4f1577,_0x2da23f){var _0x422071=[];if(_0x4f1577&&_0x4f1577[_0x7f39('0x22')]>0x0){_0x422071=_[_0x7f39('0x34')](_0x4f1577,_0x2da23f);}return _0x422071;}function getCustomFields(_0x3e3b8b,_0x3d875d){var _0x4ee9d5=[];var _0x2fcba2={'custom_fields':[]};if(_0x3e3b8b[_0x7f39('0x22')]>0x0){_[_0x7f39('0x35')](_0x3e3b8b,function(_0x4d06ee){if(_[_0x7f39('0x36')]([_0x7f39('0x37'),_0x7f39('0x38')],_0x4d06ee['type'])&&_0x4d06ee['nameField']&&!_0x4d06ee['customField']){_0x2fcba2[_0x4d06ee[_0x7f39('0x39')][_0x7f39('0x3a')]()]=_0x4d06ee[_0x7f39('0x3b')][_0x7f39('0x3c')]();}else if(_[_0x7f39('0x36')]([_0x7f39('0x37'),_0x7f39('0x38')],_0x4d06ee[_0x7f39('0x3d')])&&_0x4d06ee[_0x7f39('0x3e')]&&_0x4d06ee[_0x7f39('0x3f')]){_0x2fcba2['custom_fields'][_0x7f39('0x40')]({'id':_0x4d06ee[_0x7f39('0x3e')],'value':_0x4d06ee[_0x7f39('0x3b')][_0x7f39('0x3c')]()});}else if(_0x4d06ee[_0x7f39('0x3d')]===_0x7f39('0x41')&&_0x4d06ee[_0x7f39('0x42')]&&_0x4d06ee[_0x7f39('0x3e')]&&_0x4d06ee['customField']){_0x3d875d[_0x4d06ee['variableName']]&&_0x2fcba2[_0x7f39('0x18')]['push']({'id':_0x4d06ee['idField'],'value':_0x3d875d[_0x4d06ee['variableName']][_0x7f39('0x3c')]()});}else if(_0x4d06ee[_0x7f39('0x3d')]==='customVariable'&&_0x4d06ee[_0x7f39('0x43')]&&_0x4d06ee[_0x7f39('0x43')][_0x7f39('0x44')]&&_0x4d06ee[_0x7f39('0x3e')]&&_0x4d06ee[_0x7f39('0x3f')]){_0x3d875d[_0x4d06ee['Variable'][_0x7f39('0x44')][_0x7f39('0x3a')]()]&&_0x2fcba2[_0x7f39('0x18')][_0x7f39('0x40')]({'id':_0x4d06ee[_0x7f39('0x3e')],'value':_0x3d875d[_0x4d06ee[_0x7f39('0x43')]['name'][_0x7f39('0x3a')]()]['toString']()});}});}return _0x2fcba2;}exports['queue']=function(_0x4df043,_0xa8e219,_0x3ce8e2,_0x3dc4ee,_0x5b1d12,_0x53af34){var _0x52cf30,_0x20caad;_0x53af34[_0x7f39('0x1c')]=intUtil[_0x7f39('0x45')](_0x53af34[_0x7f39('0x1c')]);_0x53af34[_0x7f39('0x46')]=intUtil[_0x7f39('0x45')](_0x53af34['serverUrl']);if(_0x5b1d12&&_0x5b1d12[_0x7f39('0x47')]){logger[_0x7f39('0x1e')](_0x7f39('0x48'),_0x7f39('0x49'));_0xa8e219['recordingURL']=util[_0x7f39('0x25')](_0x7f39('0x4a'),_0x53af34[_0x7f39('0x46')],_0xa8e219[_0x7f39('0x4b')],md5(_0xa8e219[_0x7f39('0x4b')]));}else{_0xa8e219[_0x7f39('0x4c')]='';}headers['Authorization']=getAuth(_0x53af34);return getUser(_0x53af34,_0x3dc4ee[_0x7f39('0x24')])[_0x7f39('0x21')](function(_0x27873b){_0x52cf30=_0x27873b;logger[_0x7f39('0x1e')]('The\x20User\x20ID\x20is:',_0x52cf30['id']);return getEndUser(_0x53af34,_0xa8e219[_0x7f39('0x10')],_0xa8e219['calleridnum']);})[_0x7f39('0x21')](function(_0x1d99c4){_0x20caad=_0x1d99c4;logger['info'](_0x7f39('0x4d'),_0x20caad['id']);return getTicket(_0x53af34,_0x52cf30,_0x20caad,_0x3ce8e2,_0xa8e219);})[_0x7f39('0x21')](function(_0x3d1e96){if(_0x3d1e96&&_0x3d1e96['id']){logger['info']('Ticket\x20created!');logger[_0x7f39('0x1e')](_0x7f39('0x4e'),_0x3d1e96['id']);logger['info']('[QUEUE]',_0x7f39('0x4f'));emit(util[_0x7f39('0x25')]('user:%s',_0x3dc4ee['name']),_0x7f39('0x50'),{'uri':util[_0x7f39('0x25')]('%s/helpdesk/tickets/%d',_0x53af34[_0x7f39('0x1c')],_0x3d1e96['id'])});}})[_0x7f39('0x51')](function(_0xaf16fe){logger['error'](_0x7f39('0x48'),JSON[_0x7f39('0x52')](_0xaf16fe));});};exports[_0x7f39('0x53')]=function(_0xdbb3a3,_0x322d76,_0x44b836,_0x2411c9,_0xbb44fe,_0x15f356,_0x445893){var _0x1eb993,_0x101b5d;_0x15f356[_0x7f39('0x1c')]=intUtil['stripTrailingSlash'](_0x15f356[_0x7f39('0x1c')]);_0x15f356[_0x7f39('0x46')]=intUtil[_0x7f39('0x45')](_0x15f356[_0x7f39('0x46')]);if(_0x445893&&_0x445893[_0x7f39('0x54')]&&_0x445893['recordingFormat']!==_0x7f39('0x55')){logger[_0x7f39('0x1e')](_0x7f39('0x56'),_0x7f39('0x49'));_0x322d76['recordingURL']=util[_0x7f39('0x25')](_0x7f39('0x4a'),_0x15f356[_0x7f39('0x46')],_0x322d76[_0x7f39('0x4b')],md5(_0x322d76['uniqueid']));}headers['Authorization']=getAuth(_0x15f356);return getUser(_0x15f356,_0x2411c9[_0x7f39('0x24')])['then'](function(_0x115dee){_0x1eb993=_0x115dee;logger[_0x7f39('0x1e')]('The\x20User\x20ID\x20is:',_0x1eb993['id']);return getEndUser(_0x15f356,_0x322d76[_0x7f39('0x57')],_0x322d76[_0x7f39('0x58')]);})[_0x7f39('0x21')](function(_0x4f845c){_0x101b5d=_0x4f845c;logger['info']('The\x20Enduser\x20ID\x20is:',_0x101b5d['id']);return getTicket(_0x15f356,_0x1eb993,_0x101b5d,_0x44b836,_0x322d76);})[_0x7f39('0x21')](function(_0x2820ab){if(_0x2820ab&&_0x2820ab['id']){logger['info'](_0x7f39('0x59'));logger['info'](_0x7f39('0x4e'),_0x2820ab['id']);logger[_0x7f39('0x1e')](_0x7f39('0x56'),_0x7f39('0x4f'));emit(util[_0x7f39('0x25')]('user:%s',_0x2411c9[_0x7f39('0x44')]),_0x7f39('0x50'),{'uri':util[_0x7f39('0x25')]('%s/helpdesk/tickets/%d',_0x15f356[_0x7f39('0x1c')],_0x2820ab['id'])});}})['catch'](function(_0x276931){logger[_0x7f39('0x5a')](_0x7f39('0x56'),JSON['stringify'](_0x276931));});};exports[_0x7f39('0x5b')]=function(_0x3a51d1,_0x4d8b30,_0x1aa487,_0xc03445,_0x29cbc8,_0x47b3e5){var _0xb9aa2b,_0x5aee44;_0x47b3e5[_0x7f39('0x1c')]=intUtil[_0x7f39('0x45')](_0x47b3e5[_0x7f39('0x1c')]);_0x47b3e5[_0x7f39('0x46')]=intUtil[_0x7f39('0x45')](_0x47b3e5[_0x7f39('0x46')]);if(_0x29cbc8&&_0x29cbc8[_0x7f39('0x47')]){logger[_0x7f39('0x1e')]('['+_0x4d8b30[_0x7f39('0x5c')][_0x7f39('0x5d')]()+']',_0x7f39('0x49'));_0x4d8b30[_0x7f39('0x4c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x47b3e5[_0x7f39('0x46')],_0x4d8b30[_0x7f39('0x4b')],md5(_0x4d8b30['uniqueid']));}else{_0x4d8b30[_0x7f39('0x4c')]='';}headers['Authorization']=getAuth(_0x47b3e5);return getUser(_0x47b3e5,'')[_0x7f39('0x21')](function(_0x2346fc){_0xb9aa2b=_0x2346fc;logger[_0x7f39('0x1e')]('The\x20User\x20ID\x20is:',_0xb9aa2b['id']);return getEndUser(_0x47b3e5,_0x4d8b30['calleridname'],_0x4d8b30[_0x7f39('0x11')]);})[_0x7f39('0x21')](function(_0x7ff8c8){_0x5aee44=_0x7ff8c8;logger[_0x7f39('0x1e')](_0x7f39('0x4d'),_0x5aee44['id']);return getTicket(_0x47b3e5,_0xb9aa2b,_0x5aee44,_0x1aa487,_0x4d8b30);})[_0x7f39('0x21')](function(_0x24c400){if(_0x24c400){logger[_0x7f39('0x1e')](_0x7f39('0x59'));logger[_0x7f39('0x1e')]('The\x20Ticket\x20ID\x20is:',_0x24c400['id']);}})[_0x7f39('0x51')](function(_0x1c052d){logger[_0x7f39('0x5a')]('['+_0x4d8b30[_0x7f39('0x5c')][_0x7f39('0x5d')]()+']',JSON['stringify'](_0x1c052d));});}; \ 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 bff1c5d..fe3e23a 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 _0x0813=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','toUpperCase','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20work_number:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','Subjects','getString','Descriptions','add','ticketId','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','unmanaged','queue'];(function(_0x11609a,_0x1dc23d){var _0x4c7463=function(_0x39e061){while(--_0x39e061){_0x11609a['push'](_0x11609a['shift']());}};_0x4c7463(++_0x1dc23d);}(_0x0813,0x101));var _0x3081=function(_0x4dff2a,_0x4ffaf2){_0x4dff2a=_0x4dff2a-0x0;var _0x5f147f=_0x0813[_0x4dff2a];return _0x5f147f;};'use strict';var _=require(_0x3081('0x0'));var rp=require(_0x3081('0x1'));var md5=require(_0x3081('0x2'));var util=require(_0x3081('0x3'));var moment=require(_0x3081('0x4'));var Promise=require(_0x3081('0x5'));var Redis=require(_0x3081('0x6'));var intUtil=require(_0x3081('0x7'));var config=require(_0x3081('0x8'));var logger=require('../../../../config/logger')(_0x3081('0x9'));config[_0x3081('0xa')]=_[_0x3081('0xb')](config[_0x3081('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x3081('0xc'))(new Redis(config[_0x3081('0xa')]));function getAdminId(_0xcbca5c,_0x46a61e,_0x25c213,_0x3d6a28){return new Promise(function(_0x748e3b,_0xb424d4){var _0x387177=![];var _0xd44269={'method':_0x3081('0xd'),'uri':_0x3d6a28+_0x3081('0xe'),'json':!![]};_0xd44269['headers']=_0x25c213;logger[_0x3081('0xf')](_0x3081('0x10'));return rp(_0xd44269)[_0x3081('0x11')](function(_0x4fdb48){if(_0x4fdb48){var _0x475235=_0x4fdb48[_0x3081('0x12')];var _0x114216=null;for(_0x114216=0x0;_0x114216<_0x475235[_0x3081('0x13')];_0x114216++){if(_0x475235[_0x114216][_0x3081('0x14')]===_0xcbca5c[_0x3081('0x15')]){_0xcbca5c[_0x3081('0x16')]=_0x475235[_0x114216]['id'];_0x387177=!![];}}if(_0x387177){logger[_0x3081('0xf')](_0x3081('0x17'),_0xcbca5c['adminId']);_0x748e3b(_0xcbca5c);}else{_0xb424d4({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xb424d4({'statusCode':0x194,'message':_0x3081('0x18')});}})[_0x3081('0x19')](function(_0x1486c5){logger[_0x3081('0x1a')]('['+[_0x46a61e['toUpperCase']()]+']',_0x1486c5[_0x3081('0x1b')]);_0xb424d4(_0x1486c5);});});}function getUser(_0x3d1a1e,_0x556aa9,_0x26de7a){return function(_0x17cf39){return new Promise(function(_0x210646,_0x4f608e){var _0x5a8015={'method':_0x3081('0xd'),'uri':_0x26de7a+'/api/selector/owners','json':!![]};_0x5a8015[_0x3081('0x1c')]=_0x556aa9;logger[_0x3081('0xf')](_0x3081('0x1d'));return rp(_0x5a8015)[_0x3081('0x11')](function(_0x5a4e23){if(_0x5a4e23){var _0x548612=_0x5a4e23[_0x3081('0x12')];var _0x2a7592=![];var _0x374359=null;if(_0x17cf39[_0x3081('0x1e')]!==null){logger['info'](_0x3081('0x1f'),_0x17cf39[_0x3081('0x1e')]);_0x17cf39[_0x3081('0x20')]=_0x17cf39[_0x3081('0x1e')];for(_0x374359=0x0;_0x374359<_0x548612['length'];_0x374359++){if(_0x548612[_0x374359]['email']===_0x17cf39[_0x3081('0x1e')]){_0x2a7592=!![];_0x17cf39[_0x3081('0x21')]=_0x548612[_0x374359]['id'];logger['info'](_0x3081('0x22'),_0x17cf39['userId']);}}}if(!_0x2a7592){logger[_0x3081('0xf')]('Admin\x20selected');_0x17cf39[_0x3081('0x20')]=_0x17cf39[_0x3081('0x15')];_0x17cf39[_0x3081('0x21')]=_0x17cf39['adminId'];_0x2a7592=!![];}if(_0x2a7592){_0x210646(_0x17cf39);}else{_0x4f608e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4f608e({'statusCode':0x194,'message':_0x3081('0x18')});}})['catch'](function(_0x5cde51){logger[_0x3081('0x1a')]('['+[_0x3d1a1e[_0x3081('0x23')]()]+']',_0x5cde51[_0x3081('0x1b')]);_0x4f608e(_0x5cde51);});});};}function searchContact(_0x542bd7,_0x56f0be,_0x3d6be8,_0x54e330){return new Promise(function(_0x3578ed,_0x2077f5){var _0x39ee9e={'method':_0x3081('0xd'),'headers':_0x56f0be,'uri':_0x542bd7+_0x3081('0x24')+_0x54e330+_0x3081('0x25')+_0x3d6be8+_0x3081('0x26'),'json':!![]};rp(_0x39ee9e)[_0x3081('0x11')](function(_0x535dde){var _0x2ffe1c=_['find'](_0x535dde[_0x3081('0x27')]['contacts'],[_0x3d6be8,_0x54e330]);_0x3578ed(_0x2ffe1c);})[_0x3081('0x19')](function(_0x475c43){_0x2077f5(_0x475c43);});});}function getEndUser(_0x478e47,_0x4aacec,_0xa43872){return function(_0x177138){return new Promise(function(_0x245b27,_0x3cc613){logger[_0x3081('0xf')](util[_0x3081('0x28')](_0x3081('0x29'),_0x177138[_0x3081('0x2a')]));searchContact(_0xa43872,_0x4aacec,_0x3081('0x2b'),_0x177138[_0x3081('0x2a')])['then'](function(_0x436787){if(_0x436787){_0x177138[_0x3081('0x2c')]=_0x436787['id'];logger[_0x3081('0xf')]('Contact\x20found\x20mobile_number:',_0x177138[_0x3081('0x2c')]);return _0x245b27(_0x177138);}searchContact(_0xa43872,_0x4aacec,'work_number',_0x177138['contactNumber'])[_0x3081('0x11')](function(_0x3af152){if(_0x3af152){_0x177138[_0x3081('0x2c')]=_0x3af152['id'];logger['info'](_0x3081('0x2d'),_0x177138['endUserId']);return _0x245b27(_0x177138);}createEndUser(_0x177138,_0x478e47,_0x4aacec,_0xa43872)[_0x3081('0x11')](function(_0x1be0c4){logger[_0x3081('0xf')]('Contact\x20created:',_0x1be0c4[_0x3081('0x2c')]);return _0x245b27(_0x1be0c4);});});})[_0x3081('0x19')](function(_0x1fdce7){_0x3cc613(_0x1fdce7);});});};}function createEndUser(_0x2c6d87,_0xdd1eca,_0x2eea7e,_0x17a116){return new Promise(function(_0x4c1b48,_0x1162b6){var _0x23e90c=moment();var _0x238fd5={'method':_0x3081('0x2e'),'uri':_0x17a116+'/api/contacts','body':{'contact':{'last_name':_0x2c6d87[_0x3081('0x2a')],'work_number':_0x2c6d87['contactNumber'],'mobile_number':_0x2c6d87[_0x3081('0x2a')],'owner_id':_0x2c6d87['userId'],'created_at':_0x23e90c[_0x3081('0x28')](_0x3081('0x2f'))}},'json':!![]};_0x238fd5[_0x3081('0x1c')]=_0x2eea7e;logger[_0x3081('0xf')](_0x3081('0x30'));return rp(_0x238fd5)[_0x3081('0x11')](function(_0x3fa943){_0x2c6d87[_0x3081('0x2c')]=_0x3fa943[_0x3081('0x31')]['id'];_0x4c1b48(_0x2c6d87);})[_0x3081('0x19')](function(_0x6539df){logger['error']('['+[_0xdd1eca['toUpperCase']()]+']',_0x6539df['message']);_0x1162b6(_0x6539df[_0x3081('0x1b')]);});});}function getTicket(_0x183a2e,_0x364fbf,_0x2ba040,_0x32842b,_0x572462){return function(_0x1b5114){logger[_0x3081('0xf')](_0x3081('0x32'));return new Promise(function(_0x22631f,_0x1117a3){var _0x108870=moment();var _0x285439={'method':_0x3081('0x2e'),'uri':_0x2ba040+'/api/tasks','body':{'title':intUtil['getString'](_0x32842b[_0x3081('0x33')],_0x572462,'\x20'),'description':intUtil[_0x3081('0x34')](_0x32842b[_0x3081('0x35')],_0x572462,'\x0a'),'owner_id':_0x1b5114[_0x3081('0x21')],'creater_id':_0x1b5114[_0x3081('0x16')],'targetable_id':_0x1b5114[_0x3081('0x2c')],'targetable_type':'Contact','created_at':_0x108870['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x108870[_0x3081('0x36')](0x1e,'m')['format'](_0x3081('0x2f'))},'json':!![]};_0x285439[_0x3081('0x1c')]=_0x364fbf;return rp(_0x285439)[_0x3081('0x11')](function(_0x4670c2){_0x1b5114[_0x3081('0x37')]=_0x4670c2['task']['id'];logger[_0x3081('0xf')]('Task\x20created:',_0x1b5114[_0x3081('0x37')]);_0x22631f(_0x1b5114);})[_0x3081('0x19')](function(_0x3ecb63){logger['error']('['+[_0x183a2e[_0x3081('0x23')]()]+']',_0x3ecb63[_0x3081('0x1b')]);_0x1117a3(_0x3ecb63[_0x3081('0x1b')]);});});};}function emit(_0x42d17e,_0x39ee35,_0x319c40){var _0x2821e3={'uri':_0x42d17e+'/contacts/'+_0x319c40};io['to'](util[_0x3081('0x28')](_0x3081('0x38'),_0x39ee35))[_0x3081('0x39')](_0x3081('0x3a'),_0x2821e3);}exports['cs']=function(_0x4556d4,_0x515b4f,_0xe1e17c,_0x57b7df,_0x4425c3,_0x5e5d9a,_0x2d4537,_0x4d7c99){var _0x385e27={};var _0xf258ae={'Authorization':_0x3081('0x3b')+_0x5e5d9a[_0x3081('0x3c')]};_0x5e5d9a[_0x3081('0x3d')]=intUtil[_0x3081('0x3e')](_0x5e5d9a[_0x3081('0x3d')]);_0x5e5d9a[_0x3081('0x3f')]=intUtil[_0x3081('0x3e')](_0x5e5d9a[_0x3081('0x3f')]);var _0x38b14d=_0x5e5d9a[_0x3081('0x3d')];_0x385e27[_0x3081('0x15')]=_0x5e5d9a[_0x3081('0x40')];_0x385e27[_0x3081('0x2a')]=_0x4d7c99[_0x3081('0x41')]()===_0x3081('0x42')?_0x515b4f[_0x3081('0x43')]:_0x515b4f[_0x3081('0x44')];_0x385e27['callDirection']=_0x4d7c99==='queue'||_0x4d7c99===_0x3081('0x45')?_0x3081('0x46'):_0x3081('0x42');if(_0x57b7df){_0x385e27[_0x3081('0x1e')]=_0x57b7df[_0x3081('0x14')];}var _0x25afca=util[_0x3081('0x28')](_0x3081('0x47'),_0x5e5d9a['serverUrl'],_0x515b4f['uniqueid'],md5(_0x515b4f[_0x3081('0x48')]));if(_0x4425c3&&_0x4425c3[_0x3081('0x49')]){logger[_0x3081('0xf')]('[QUEUE]',_0x3081('0x4a'));_0x515b4f[_0x3081('0x4b')]=_0x25afca;}else if(_0x2d4537&&_0x2d4537[_0x3081('0x4c')]&&_0x2d4537['recordingFormat']!==_0x3081('0x4d')){logger['info'](_0x3081('0x4e'),_0x3081('0x4a'));_0x515b4f[_0x3081('0x4b')]=_0x25afca;}else{_0x515b4f[_0x3081('0x4b')]='';}return getAdminId(_0x385e27,_0x4d7c99,_0xf258ae,_0x38b14d)[_0x3081('0x11')](getUser(_0x4d7c99,_0xf258ae,_0x38b14d))['then'](getEndUser(_0x4d7c99,_0xf258ae,_0x38b14d))[_0x3081('0x11')](getTicket(_0x4d7c99,_0xf258ae,_0x38b14d,_0xe1e17c,_0x515b4f))[_0x3081('0x11')](function(_0x564fe9){logger[_0x3081('0xf')](util[_0x3081('0x28')](_0x3081('0x4f'),_0x564fe9[_0x3081('0x37')]));if(_0x4d7c99!==_0x3081('0x45')){logger[_0x3081('0xf')]('['+[_0x4d7c99[_0x3081('0x23')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x38b14d,_0x57b7df['name'],_0x564fe9[_0x3081('0x2c')]);}})[_0x3081('0x19')](function(_0x2849e9){logger[_0x3081('0x1a')]('['+[_0x4d7c99['toUpperCase']()]+_0x3081('0x50'),util[_0x3081('0x51')](_0x2849e9,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8aac=['/api/selector/owners','Getting\x20user\x20list','users','agentEmail','userEmail','Admin\x20selected','adminEmail','userId','message','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase'];(function(_0x230471,_0x10441f){var _0x5dd908=function(_0x2bbc28){while(--_0x2bbc28){_0x230471['push'](_0x230471['shift']());}};_0x5dd908(++_0x10441f);}(_0x8aac,0x90));var _0xc8aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0xc8aa('0x0'));var md5=require(_0xc8aa('0x1'));var util=require('util');var moment=require(_0xc8aa('0x2'));var Promise=require(_0xc8aa('0x3'));var Redis=require('ioredis');var intUtil=require(_0xc8aa('0x4'));var config=require(_0xc8aa('0x5'));var logger=require(_0xc8aa('0x6'))(_0xc8aa('0x7'));config[_0xc8aa('0x8')]=_[_0xc8aa('0x9')](config[_0xc8aa('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xc8aa('0xa'))(new Redis(config[_0xc8aa('0x8')]));function getAdminId(_0x580931,_0x1f4e2b,_0x3c2941,_0x1603e5){return new Promise(function(_0xd51277,_0x5ac59c){var _0x31c76c=![];var _0x21da0e={'method':_0xc8aa('0xb'),'uri':_0x1603e5+'/api/selector/owners','json':!![]};_0x21da0e[_0xc8aa('0xc')]=_0x3c2941;logger[_0xc8aa('0xd')](_0xc8aa('0xe'));return rp(_0x21da0e)[_0xc8aa('0xf')](function(_0x40801f){if(_0x40801f){var _0x49bed4=_0x40801f['users'];var _0xa79064=null;for(_0xa79064=0x0;_0xa79064<_0x49bed4[_0xc8aa('0x10')];_0xa79064++){if(_0x49bed4[_0xa79064][_0xc8aa('0x11')]===_0x580931['adminEmail']){_0x580931[_0xc8aa('0x12')]=_0x49bed4[_0xa79064]['id'];_0x31c76c=!![];}}if(_0x31c76c){logger[_0xc8aa('0xd')](_0xc8aa('0x13'),_0x580931['adminId']);_0xd51277(_0x580931);}else{_0x5ac59c({'statusCode':0x194,'message':_0xc8aa('0x14')});}}else{_0x5ac59c({'statusCode':0x194,'message':_0xc8aa('0x14')});}})[_0xc8aa('0x15')](function(_0x3c39de){logger[_0xc8aa('0x16')]('['+[_0x1f4e2b[_0xc8aa('0x17')]()]+']',_0x3c39de['message']);_0x5ac59c(_0x3c39de);});});}function getUser(_0x32ebb2,_0x1a1afe,_0x4481fa){return function(_0x1dd6ed){return new Promise(function(_0x55ef10,_0x4b611f){var _0x1af0c2={'method':_0xc8aa('0xb'),'uri':_0x4481fa+_0xc8aa('0x18'),'json':!![]};_0x1af0c2[_0xc8aa('0xc')]=_0x1a1afe;logger[_0xc8aa('0xd')](_0xc8aa('0x19'));return rp(_0x1af0c2)[_0xc8aa('0xf')](function(_0x2efa78){if(_0x2efa78){var _0x484ed3=_0x2efa78[_0xc8aa('0x1a')];var _0x3ed218=![];var _0xd568a8=null;if(_0x1dd6ed[_0xc8aa('0x1b')]!==null){logger[_0xc8aa('0xd')]('Getting\x20user\x20with\x20email',_0x1dd6ed[_0xc8aa('0x1b')]);_0x1dd6ed[_0xc8aa('0x1c')]=_0x1dd6ed['agentEmail'];for(_0xd568a8=0x0;_0xd568a8<_0x484ed3[_0xc8aa('0x10')];_0xd568a8++){if(_0x484ed3[_0xd568a8][_0xc8aa('0x11')]===_0x1dd6ed['agentEmail']){_0x3ed218=!![];_0x1dd6ed['userId']=_0x484ed3[_0xd568a8]['id'];logger[_0xc8aa('0xd')]('User\x20found:',_0x1dd6ed['userId']);}}}if(!_0x3ed218){logger[_0xc8aa('0xd')](_0xc8aa('0x1d'));_0x1dd6ed['userEmail']=_0x1dd6ed[_0xc8aa('0x1e')];_0x1dd6ed[_0xc8aa('0x1f')]=_0x1dd6ed[_0xc8aa('0x12')];_0x3ed218=!![];}if(_0x3ed218){_0x55ef10(_0x1dd6ed);}else{_0x4b611f({'statusCode':0x194,'message':_0xc8aa('0x14')});}}else{_0x4b611f({'statusCode':0x194,'message':_0xc8aa('0x14')});}})['catch'](function(_0x225328){logger[_0xc8aa('0x16')]('['+[_0x32ebb2[_0xc8aa('0x17')]()]+']',_0x225328[_0xc8aa('0x20')]);_0x4b611f(_0x225328);});});};}function searchContact(_0x3dfaae,_0x1c6fee,_0x1e61cc,_0x153651){return new Promise(function(_0x321b05,_0x5a98bc){var _0x53537e={'method':_0xc8aa('0xb'),'headers':_0x1c6fee,'uri':_0x3dfaae+_0xc8aa('0x21')+_0x153651+_0xc8aa('0x22')+_0x1e61cc+_0xc8aa('0x23'),'json':!![]};rp(_0x53537e)['then'](function(_0x453f25){var _0x3ce76d=_['find'](_0x453f25[_0xc8aa('0x24')][_0xc8aa('0x24')],[_0x1e61cc,_0x153651]);_0x321b05(_0x3ce76d);})[_0xc8aa('0x15')](function(_0x264216){_0x5a98bc(_0x264216);});});}function getEndUser(_0x443883,_0x119d8f,_0x412d3b){return function(_0x4e5dd9){return new Promise(function(_0x5425c7,_0x2a268e){logger[_0xc8aa('0xd')](util[_0xc8aa('0x25')](_0xc8aa('0x26'),_0x4e5dd9[_0xc8aa('0x27')]));searchContact(_0x412d3b,_0x119d8f,_0xc8aa('0x28'),_0x4e5dd9['contactNumber'])['then'](function(_0x80035e){if(_0x80035e){_0x4e5dd9[_0xc8aa('0x29')]=_0x80035e['id'];logger[_0xc8aa('0xd')](_0xc8aa('0x2a'),_0x4e5dd9['endUserId']);return _0x5425c7(_0x4e5dd9);}searchContact(_0x412d3b,_0x119d8f,'work_number',_0x4e5dd9[_0xc8aa('0x27')])[_0xc8aa('0xf')](function(_0x2a52e1){if(_0x2a52e1){_0x4e5dd9[_0xc8aa('0x29')]=_0x2a52e1['id'];logger[_0xc8aa('0xd')]('Contact\x20found\x20work_number:',_0x4e5dd9[_0xc8aa('0x29')]);return _0x5425c7(_0x4e5dd9);}createEndUser(_0x4e5dd9,_0x443883,_0x119d8f,_0x412d3b)['then'](function(_0x2d095b){logger[_0xc8aa('0xd')](_0xc8aa('0x2b'),_0x2d095b[_0xc8aa('0x29')]);return _0x5425c7(_0x2d095b);});});})[_0xc8aa('0x15')](function(_0x1d3869){_0x2a268e(_0x1d3869);});});};}function createEndUser(_0x54d867,_0x4ee970,_0xb691d0,_0x76951a){return new Promise(function(_0x25c585,_0x4a4b35){var _0x330962=moment();var _0x5c1156={'method':_0xc8aa('0x2c'),'uri':_0x76951a+'/api/contacts','body':{'contact':{'last_name':_0x54d867['contactNumber'],'work_number':_0x54d867['contactNumber'],'mobile_number':_0x54d867['contactNumber'],'owner_id':_0x54d867['userId'],'created_at':_0x330962['format'](_0xc8aa('0x2d'))}},'json':!![]};_0x5c1156['headers']=_0xb691d0;logger[_0xc8aa('0xd')](_0xc8aa('0x2e'));return rp(_0x5c1156)[_0xc8aa('0xf')](function(_0x2d6390){_0x54d867[_0xc8aa('0x29')]=_0x2d6390[_0xc8aa('0x2f')]['id'];_0x25c585(_0x54d867);})[_0xc8aa('0x15')](function(_0x2c47ca){logger[_0xc8aa('0x16')]('['+[_0x4ee970[_0xc8aa('0x17')]()]+']',_0x2c47ca[_0xc8aa('0x20')]);_0x4a4b35(_0x2c47ca[_0xc8aa('0x20')]);});});}function getTicket(_0x5ad273,_0x398db0,_0x3ccda5,_0xd1546f,_0x22c8d0){return function(_0x46e42d){logger[_0xc8aa('0xd')](_0xc8aa('0x30'));return new Promise(function(_0x30223d,_0x16c07a){var _0x2a7cf1=moment();var _0x127c61={'method':_0xc8aa('0x2c'),'uri':_0x3ccda5+_0xc8aa('0x31'),'body':{'title':intUtil[_0xc8aa('0x32')](_0xd1546f['Subjects'],_0x22c8d0,'\x20'),'description':intUtil[_0xc8aa('0x32')](_0xd1546f[_0xc8aa('0x33')],_0x22c8d0,'\x0a'),'owner_id':_0x46e42d['userId'],'creater_id':_0x46e42d[_0xc8aa('0x12')],'targetable_id':_0x46e42d[_0xc8aa('0x29')],'targetable_type':_0xc8aa('0x34'),'created_at':_0x2a7cf1[_0xc8aa('0x25')](_0xc8aa('0x2d')),'due_date':_0x2a7cf1[_0xc8aa('0x35')](0x1e,'m')[_0xc8aa('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x127c61[_0xc8aa('0xc')]=_0x398db0;return rp(_0x127c61)[_0xc8aa('0xf')](function(_0x401224){_0x46e42d[_0xc8aa('0x36')]=_0x401224[_0xc8aa('0x37')]['id'];logger[_0xc8aa('0xd')](_0xc8aa('0x38'),_0x46e42d[_0xc8aa('0x36')]);_0x30223d(_0x46e42d);})['catch'](function(_0x4ef78d){logger[_0xc8aa('0x16')]('['+[_0x5ad273[_0xc8aa('0x17')]()]+']',_0x4ef78d['message']);_0x16c07a(_0x4ef78d[_0xc8aa('0x20')]);});});};}function emit(_0x47eada,_0x4b32b3,_0x13b5f3){var _0x3e23ed={'uri':_0x47eada+'/contacts/'+_0x13b5f3};io['to'](util['format'](_0xc8aa('0x39'),_0x4b32b3))[_0xc8aa('0x3a')](_0xc8aa('0x3b'),_0x3e23ed);}exports['cs']=function(_0x5e4ace,_0x3b02ed,_0x4c6834,_0xf7477a,_0x3f2deb,_0x276449,_0x4a2abd,_0x32fbf4){var _0x25d571={};var _0x44f083={'Authorization':_0xc8aa('0x3c')+_0x276449['apiKey']};_0x276449[_0xc8aa('0x3d')]=intUtil[_0xc8aa('0x3e')](_0x276449[_0xc8aa('0x3d')]);_0x276449['serverUrl']=intUtil[_0xc8aa('0x3e')](_0x276449['serverUrl']);var _0x3ab8a6=_0x276449[_0xc8aa('0x3d')];_0x25d571[_0xc8aa('0x1e')]=_0x276449[_0xc8aa('0x3f')];_0x25d571[_0xc8aa('0x27')]=_0x32fbf4[_0xc8aa('0x40')]()==='outbound'?_0x3b02ed[_0xc8aa('0x41')]:_0x3b02ed[_0xc8aa('0x42')];_0x25d571[_0xc8aa('0x43')]=_0x32fbf4===_0xc8aa('0x44')||_0x32fbf4===_0xc8aa('0x45')?'queue':_0xc8aa('0x46');if(_0xf7477a){_0x25d571[_0xc8aa('0x1b')]=_0xf7477a[_0xc8aa('0x11')];}var _0x18f6d3=util[_0xc8aa('0x25')](_0xc8aa('0x47'),_0x276449[_0xc8aa('0x48')],_0x3b02ed['uniqueid'],md5(_0x3b02ed[_0xc8aa('0x49')]));if(_0x3f2deb&&_0x3f2deb['monitor_format']){logger[_0xc8aa('0xd')](_0xc8aa('0x4a'),_0xc8aa('0x4b'));_0x3b02ed[_0xc8aa('0x4c')]=_0x18f6d3;}else if(_0x4a2abd&&_0x4a2abd[_0xc8aa('0x4d')]&&_0x4a2abd['recordingFormat']!==_0xc8aa('0x4e')){logger[_0xc8aa('0xd')]('[OUTBOUND]',_0xc8aa('0x4b'));_0x3b02ed[_0xc8aa('0x4c')]=_0x18f6d3;}else{_0x3b02ed[_0xc8aa('0x4c')]='';}return getAdminId(_0x25d571,_0x32fbf4,_0x44f083,_0x3ab8a6)[_0xc8aa('0xf')](getUser(_0x32fbf4,_0x44f083,_0x3ab8a6))['then'](getEndUser(_0x32fbf4,_0x44f083,_0x3ab8a6))['then'](getTicket(_0x32fbf4,_0x44f083,_0x3ab8a6,_0x4c6834,_0x3b02ed))[_0xc8aa('0xf')](function(_0x13bad8){logger[_0xc8aa('0xd')](util[_0xc8aa('0x25')](_0xc8aa('0x4f'),_0x13bad8[_0xc8aa('0x36')]));if(_0x32fbf4!==_0xc8aa('0x45')){logger['info']('['+[_0x32fbf4['toUpperCase']()]+']',_0xc8aa('0x50'));emit(_0x3ab8a6,_0xf7477a[_0xc8aa('0x51')],_0x13bad8[_0xc8aa('0x29')]);}})[_0xc8aa('0x15')](function(_0x3119d6){logger['error']('['+[_0x32fbf4[_0xc8aa('0x17')]()]+_0xc8aa('0x52'),util[_0xc8aa('0x53')](_0x3119d6,{'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 ebb5ce6..071dc29 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 _0x6d67=['unmanaged','zoho','freshsales','dynamics365','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','util','./sugarcrm','./zoho','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','desk','vtiger','servicenow','exec','includes','toLowerCase','data1','Configurations','data3','queue','routeId','outbound','log'];(function(_0x5dd32b,_0x1d74ab){var _0x1032f9=function(_0x310f09){while(--_0x310f09){_0x5dd32b['push'](_0x5dd32b['shift']());}};_0x1032f9(++_0x1d74ab);}(_0x6d67,0xaa));var _0x76d6=function(_0x3c1e24,_0x13cc5e){_0x3c1e24=_0x3c1e24-0x0;var _0x128a2e=_0x6d67[_0x3c1e24];return _0x128a2e;};'use strict';var _=require('lodash');var util=require(_0x76d6('0x0'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x76d6('0x1'));var freshdesk=require('./freshdesk');var zoho=require(_0x76d6('0x2'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x76d6('0x3'));var dynamics365=require(_0x76d6('0x4'));var freshsales=require('./freshsales');var integrations=[_0x76d6('0x5'),_0x76d6('0x6'),_0x76d6('0x7'),_0x76d6('0x8'),'zoho',_0x76d6('0x9'),_0x76d6('0xa'),'dynamics365','freshsales',_0x76d6('0xb')];exports[_0x76d6('0xc')]=function(_0x4ba8fa,_0x81f988,_0x249f54,_0x3d0a66,_0x4dcbb5,_0x3c0862){if(_0x249f54){if(_[_0x76d6('0xd')](integrations,_0x4ba8fa['data1'][_0x76d6('0xe')]())){try{var _0x52a1b5=null;var _0x3ffb0c='';var _0x4cce1b=_0x249f54[_0x4ba8fa[_0x76d6('0xf')][_0x76d6('0xe')]()];if(_0x4cce1b){var _0x22566b=_0x4cce1b[_0x4ba8fa['data2']];if(_0x22566b){var _0x422d2a=_['find'](_0x22566b[_0x76d6('0x10')],{'id':parseInt(_0x4ba8fa[_0x76d6('0x11')],0xa)});if(_0x422d2a){if(_0x3d0a66){if(_0x4dcbb5&&_0x81f988[_0x76d6('0x12')]){_0x3ffb0c='queue';}else if(_0x81f988[_0x76d6('0x13')]){_0x3ffb0c=_0x76d6('0x14');}else{console[_0x76d6('0x15')]('EVENT\x20UNKNOWN',_0x81f988);}}else{_0x3ffb0c=_0x76d6('0x16');}switch(_0x4ba8fa[_0x76d6('0xf')][_0x76d6('0xe')]()){case'zendesk':zendesk[_0x3ffb0c](_0x4ba8fa,_0x81f988,_0x422d2a,_0x3d0a66,_0x4dcbb5,_0x22566b,_0x3c0862);break;case _0x76d6('0x6'):salesforce[_0x3ffb0c](_0x4ba8fa,_0x81f988,_0x422d2a,_0x3d0a66,_0x4dcbb5,_0x22566b,_0x3c0862);break;case'sugarcrm':sugarcrm[_0x3ffb0c](_0x4ba8fa,_0x81f988,_0x422d2a,_0x3d0a66,_0x4dcbb5,_0x22566b,_0x3c0862);break;case _0x76d6('0x8'):freshdesk[_0x3ffb0c](_0x4ba8fa,_0x81f988,_0x422d2a,_0x3d0a66,_0x4dcbb5,_0x22566b,_0x3c0862);break;case _0x76d6('0x17'):zoho[_0x3ffb0c](_0x4ba8fa,_0x81f988,_0x422d2a,_0x3d0a66,_0x4dcbb5,_0x22566b,_0x3c0862);break;case'desk':desk[_0x3ffb0c](_0x4ba8fa,_0x81f988,_0x422d2a,_0x3d0a66,_0x4dcbb5,_0x22566b,_0x3c0862);break;case _0x76d6('0xa'):vtiger[_0x3ffb0c](_0x4ba8fa,_0x81f988,_0x422d2a,_0x3d0a66,_0x4dcbb5,_0x22566b,_0x3c0862);break;case _0x76d6('0x18'):freshsales['cs'](_0x4ba8fa,_0x81f988,_0x422d2a,_0x3d0a66,_0x4dcbb5,_0x22566b,_0x3c0862,_0x3ffb0c);break;case _0x76d6('0xb'):servicenow['cs'](_0x4ba8fa,_0x81f988,_0x422d2a,_0x3d0a66,_0x4dcbb5,_0x22566b,_0x3c0862,_0x3ffb0c);break;case _0x76d6('0x19'):dynamics365['cs'](_0x4ba8fa,_0x81f988,_0x422d2a,_0x3d0a66,_0x4dcbb5,_0x22566b,_0x3c0862,_0x3ffb0c);break;default:console[_0x76d6('0x15')]('unknown\x20integration');}}else{_0x52a1b5=require(_0x76d6('0x1a'))(_0x4ba8fa[_0x76d6('0xf')][_0x76d6('0xe')]());_0x52a1b5[_0x76d6('0x1b')]('[EXEC]',util[_0x76d6('0x1c')](_0x76d6('0x1d'),_0x4ba8fa['data1'][_0x76d6('0xe')](),_0x4ba8fa['data3']));}}else{_0x52a1b5=require(_0x76d6('0x1a'))(_0x4ba8fa[_0x76d6('0xf')][_0x76d6('0xe')]());_0x52a1b5['error'](_0x76d6('0x1e'),util[_0x76d6('0x1c')](_0x76d6('0x1f'),_0x4ba8fa[_0x76d6('0xf')][_0x76d6('0xe')](),_0x4ba8fa['data2']));}}else{}}catch(_0x1f6d81){console['error'](_0x1f6d81);}}}}; \ No newline at end of file +var _0x533f=['data2','find','Configurations','data3','queue','routeId','outbound','log','unmanaged','servicenow','unknown\x20integration','error','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','data1','toLowerCase'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x533f,0xca));var _0xf533=function(_0x7b484,_0x195ad4){_0x7b484=_0x7b484-0x0;var _0x2ae1cf=_0x533f[_0x7b484];return _0x2ae1cf;};'use strict';var _=require(_0xf533('0x0'));var util=require('util');var zendesk=require(_0xf533('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0xf533('0x2'));var freshdesk=require(_0xf533('0x3'));var zoho=require(_0xf533('0x4'));var desk=require(_0xf533('0x5'));var vtiger=require(_0xf533('0x6'));var servicenow=require(_0xf533('0x7'));var dynamics365=require(_0xf533('0x8'));var freshsales=require('./freshsales');var integrations=[_0xf533('0x9'),_0xf533('0xa'),_0xf533('0xb'),_0xf533('0xc'),_0xf533('0xd'),_0xf533('0xe'),_0xf533('0xf'),_0xf533('0x10'),_0xf533('0x11'),'servicenow'];exports['exec']=function(_0x55a1a0,_0x102644,_0x9beba6,_0x5da5b8,_0x590909,_0x48168d){if(_0x9beba6){if(_['includes'](integrations,_0x55a1a0[_0xf533('0x12')]['toLowerCase']())){try{var _0x31cd6f=null;var _0x1a3c9a='';var _0x4b12c4=_0x9beba6[_0x55a1a0['data1'][_0xf533('0x13')]()];if(_0x4b12c4){var _0xf21167=_0x4b12c4[_0x55a1a0[_0xf533('0x14')]];if(_0xf21167){var _0xb2d854=_[_0xf533('0x15')](_0xf21167[_0xf533('0x16')],{'id':parseInt(_0x55a1a0[_0xf533('0x17')],0xa)});if(_0xb2d854){if(_0x5da5b8){if(_0x590909&&_0x102644[_0xf533('0x18')]){_0x1a3c9a=_0xf533('0x18');}else if(_0x102644[_0xf533('0x19')]){_0x1a3c9a=_0xf533('0x1a');}else{console[_0xf533('0x1b')]('EVENT\x20UNKNOWN',_0x102644);}}else{_0x1a3c9a=_0xf533('0x1c');}switch(_0x55a1a0[_0xf533('0x12')]['toLowerCase']()){case _0xf533('0x9'):zendesk[_0x1a3c9a](_0x55a1a0,_0x102644,_0xb2d854,_0x5da5b8,_0x590909,_0xf21167,_0x48168d);break;case _0xf533('0xa'):salesforce[_0x1a3c9a](_0x55a1a0,_0x102644,_0xb2d854,_0x5da5b8,_0x590909,_0xf21167,_0x48168d);break;case'sugarcrm':sugarcrm[_0x1a3c9a](_0x55a1a0,_0x102644,_0xb2d854,_0x5da5b8,_0x590909,_0xf21167,_0x48168d);break;case _0xf533('0xc'):freshdesk[_0x1a3c9a](_0x55a1a0,_0x102644,_0xb2d854,_0x5da5b8,_0x590909,_0xf21167,_0x48168d);break;case'zoho':zoho[_0x1a3c9a](_0x55a1a0,_0x102644,_0xb2d854,_0x5da5b8,_0x590909,_0xf21167,_0x48168d);break;case _0xf533('0xe'):desk[_0x1a3c9a](_0x55a1a0,_0x102644,_0xb2d854,_0x5da5b8,_0x590909,_0xf21167,_0x48168d);break;case _0xf533('0xf'):vtiger[_0x1a3c9a](_0x55a1a0,_0x102644,_0xb2d854,_0x5da5b8,_0x590909,_0xf21167,_0x48168d);break;case _0xf533('0x11'):freshsales['cs'](_0x55a1a0,_0x102644,_0xb2d854,_0x5da5b8,_0x590909,_0xf21167,_0x48168d,_0x1a3c9a);break;case _0xf533('0x1d'):servicenow['cs'](_0x55a1a0,_0x102644,_0xb2d854,_0x5da5b8,_0x590909,_0xf21167,_0x48168d,_0x1a3c9a);break;case _0xf533('0x10'):dynamics365['cs'](_0x55a1a0,_0x102644,_0xb2d854,_0x5da5b8,_0x590909,_0xf21167,_0x48168d,_0x1a3c9a);break;default:console[_0xf533('0x1b')](_0xf533('0x1e'));}}else{_0x31cd6f=require('../../../../config/logger')(_0x55a1a0[_0xf533('0x12')][_0xf533('0x13')]());_0x31cd6f[_0xf533('0x1f')]('[EXEC]',util[_0xf533('0x20')](_0xf533('0x21'),_0x55a1a0[_0xf533('0x12')]['toLowerCase'](),_0x55a1a0[_0xf533('0x17')]));}}else{_0x31cd6f=require(_0xf533('0x22'))(_0x55a1a0[_0xf533('0x12')][_0xf533('0x13')]());_0x31cd6f[_0xf533('0x1f')](_0xf533('0x23'),util['format'](_0xf533('0x24'),_0x55a1a0[_0xf533('0x12')][_0xf533('0x13')](),_0x55a1a0[_0xf533('0x14')]));}}else{}}catch(_0x93ab81){console[_0xf533('0x1f')](_0x93ab81);}}}}; \ 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 46820d9..906b024 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 _0x4d39=['includes','picklist','idField','toString','variable','variableName','customVariable','name','Variable','concat','securityToken','remoteUri','clientId','clientSecret','login','Connection\x20established.','queue','stripTrailingSlash','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','email','calleridname','calleridnum','Fields','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','unmanaged','toUpperCase','Recording\x20is\x20enabled!','isNil','lastevent','lodash','bluebird','md5','jsforce','util','./util','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','IsRecurrence','endUserType','contact','lead','WhoId','ContactId','AccountId','leadId','info','sobject','create','validateEmail','User','find','execute','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','cloneDeep','additionalSearchAccount','Account','account','first','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach'];(function(_0x266a89,_0x1d1ace){var _0x1fae3e=function(_0x2397b5){while(--_0x2397b5){_0x266a89['push'](_0x266a89['shift']());}};_0x1fae3e(++_0x1d1ace);}(_0x4d39,0x199));var _0x94d3=function(_0x555d89,_0xb250ac){_0x555d89=_0x555d89-0x0;var _0x1cb789=_0x4d39[_0x555d89];return _0x1cb789;};'use strict';var _=require(_0x94d3('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x94d3('0x1'));var md5=require(_0x94d3('0x2'));var jsforce=require(_0x94d3('0x3'));var util=require(_0x94d3('0x4'));var Redis=require('ioredis');var intUtil=require(_0x94d3('0x5'));var config=require(_0x94d3('0x6'));var logger=require('../../../../config/logger')(_0x94d3('0x7'));config[_0x94d3('0x8')]=_[_0x94d3('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x94d3('0xa'))(new Redis(config[_0x94d3('0x8')]));function emit(_0x6c3b56,_0x4e7920,_0x32c841){io['to'](_0x6c3b56)[_0x94d3('0xb')](_0x4e7920,_0x32c841);}function getTicket(_0x23836e,_0x140c18,_0x493a99,_0x1b3861,_0x132548,_0x1c0783,_0x509a1d,_0x544411){var _0xf36118=Object[_0x94d3('0xc')]({},{'OwnerId':_0x140c18['id'],'Subject':intUtil[_0x94d3('0xd')](_0x1b3861[_0x94d3('0xe')],_0x132548,'\x20'),'Description':intUtil[_0x94d3('0xd')](_0x1b3861[_0x94d3('0xf')],_0x132548,'\x0a')},getCustomFields(_0x1c0783,_0x132548));if(_0x493a99){if(_0x1b3861[_0x94d3('0x10')]===_0x94d3('0x11')){_0xf36118['ActivityDate']=moment['utc']();_0xf36118['IsReminderSet']=![];_0xf36118[_0x94d3('0x12')]=![];if(_0x493a99[_0x94d3('0x13')]===_0x94d3('0x14')||_0x493a99['endUserType']===_0x94d3('0x15')){_0xf36118[_0x94d3('0x16')]=_0x493a99['id'];}else if(_0x493a99['endUserType']==='account'){_0xf36118['WhatId']=_0x493a99['id'];}}else if(_0x1b3861['ticketType']==='Case'){if(_0x493a99['endUserType']===_0x94d3('0x14')){_0xf36118[_0x94d3('0x17')]=_0x493a99['id'];}else if(_0x493a99['endUserType']==='account'){_0xf36118[_0x94d3('0x18')]=_0x493a99['id'];}else if(_0x493a99['endUserType']===_0x94d3('0x15')&&_0x1b3861[_0x94d3('0x19')]){_0xf36118[_0x1b3861['leadId']]=_0x493a99['id'];}else{logger[_0x94d3('0x1a')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x509a1d[_0x94d3('0x1b')](_0x1b3861['ticketType'])[_0x94d3('0x1c')](_0xf36118);}function getUser(_0x145105,_0x507570,_0x5c2ada){if(!_['isNil'](_0x507570)&&intUtil[_0x94d3('0x1d')](_0x507570)){var _0x349294={'Email':_0x507570};var _0xb7d9cd={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5c2ada[_0x94d3('0x1b')](_0x94d3('0x1e'))[_0x94d3('0x1f')](_0x349294,_0xb7d9cd)[_0x94d3('0x20')]()[_0x94d3('0x21')](function(_0x2946a6){if(_0x2946a6[_0x94d3('0x22')]){var _0xedb9c5=_[_0x94d3('0x1f')](_0x2946a6,function(_0x1cb456){return _0x1cb456[_0x94d3('0x23')]===_0x507570;});if(_0xedb9c5){logger[_0x94d3('0x1a')]('Agent\x20%s\x20found.',_0x507570);return BPromise[_0x94d3('0x24')]({'id':_0xedb9c5['Id'],'name':_0xedb9c5[_0x94d3('0x25')]});}}else{logger[_0x94d3('0x1a')](_0x94d3('0x26'),_0x507570);return _0x5c2ada[_0x94d3('0x27')]()[_0x94d3('0x21')](function(_0x76e8a){return BPromise[_0x94d3('0x24')]({'id':_0x76e8a[_0x94d3('0x28')],'name':_0x76e8a['display_name']});});}});}else{logger[_0x94d3('0x1a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x507570);return _0x5c2ada[_0x94d3('0x27')]()[_0x94d3('0x21')](function(_0x22a335){return BPromise['resolve']({'id':_0x22a335[_0x94d3('0x28')],'name':_0x22a335[_0x94d3('0x29')]});});}}function getEndUser(_0x146892,_0xa5f677,_0x544bd1,_0x3fbc07,_0x1c40a2){var _0x5849a8={'$or':{'Phone':_0x3fbc07}};var _0x3dfb84={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x94d3('0x24')]()[_0x94d3('0x21')](function(){logger['info'](_0x94d3('0x2a'),_0x3fbc07,_0xa5f677[_0x94d3('0x2b')]);switch(_0xa5f677[_0x94d3('0x2b')]){case _0x94d3('0x2c'):var _0x581b21=_['cloneDeep'](_0x5849a8);if(_0xa5f677[_0x94d3('0x2d')]){var _0x2a0c1c={};_0x2a0c1c[_0xa5f677[_0x94d3('0x2d')]]=_0x3fbc07;_[_0x94d3('0x2e')](_0x581b21[_0x94d3('0x2f')],_0x2a0c1c);}return _0x1c40a2['sobject'](_0x94d3('0x30'))[_0x94d3('0x1f')](_0x581b21,_0x3dfb84)[_0x94d3('0x20')]()['then'](function(_0xa333dd){if(_0xa333dd&&_0xa333dd['length']){return _0xa333dd;}else{var _0x104ec3=_['cloneDeep'](_0x5849a8);if(_0xa5f677[_0x94d3('0x31')]){var _0x555050={};_0x555050[_0xa5f677[_0x94d3('0x31')]]=_0x3fbc07;_[_0x94d3('0x2e')](_0x104ec3[_0x94d3('0x2f')],_0x555050);}return _0x1c40a2['sobject'](_0x94d3('0x32'))['find'](_0x104ec3,_0x3dfb84);}});case'account_contact_lead':var _0x1e30e1=_[_0x94d3('0x33')](_0x5849a8);if(_0xa5f677[_0x94d3('0x34')]){var _0x2a0c1c={};_0x2a0c1c[_0xa5f677[_0x94d3('0x34')]]=_0x3fbc07;_[_0x94d3('0x2e')](_0x1e30e1[_0x94d3('0x2f')],_0x2a0c1c);}return _0x1c40a2[_0x94d3('0x1b')](_0x94d3('0x35'))[_0x94d3('0x1f')](_0x1e30e1,_0x3dfb84)[_0x94d3('0x20')]()['then'](function(_0x1a4716){if(_0x1a4716&&_0x1a4716[_0x94d3('0x22')]){return _0x1a4716;}else{var _0x44a5bd=_[_0x94d3('0x33')](_0x5849a8);if(_0xa5f677[_0x94d3('0x2d')]){var _0x1127d7={};_0x1127d7[_0xa5f677['additionalSearchContact']]=_0x3fbc07;_[_0x94d3('0x2e')](_0x44a5bd[_0x94d3('0x2f')],_0x1127d7);}return _0x1c40a2[_0x94d3('0x1b')]('Contact')[_0x94d3('0x1f')](_0x44a5bd,_0x3dfb84)['then'](function(_0x5d1aab){if(_0x5d1aab&&_0x5d1aab[_0x94d3('0x22')]){return _0x5d1aab;}else{var _0x3900ff=_[_0x94d3('0x33')](_0x5849a8);if(_0xa5f677[_0x94d3('0x31')]){var _0x16b5fe={};_0x16b5fe[_0xa5f677[_0x94d3('0x31')]]=_0x3fbc07;_[_0x94d3('0x2e')](_0x3900ff[_0x94d3('0x2f')],_0x16b5fe);}return _0x1c40a2[_0x94d3('0x1b')](_0x94d3('0x32'))[_0x94d3('0x1f')](_0x3900ff,_0x3dfb84);}});}});case'contact':var _0x581b21=_[_0x94d3('0x33')](_0x5849a8);if(_0xa5f677[_0x94d3('0x2d')]){var _0x2a0c1c={};_0x2a0c1c[_0xa5f677[_0x94d3('0x2d')]]=_0x3fbc07;_[_0x94d3('0x2e')](_0x581b21[_0x94d3('0x2f')],_0x2a0c1c);}return _0x1c40a2[_0x94d3('0x1b')](_0x94d3('0x30'))[_0x94d3('0x1f')](_0x581b21,_0x3dfb84)['execute']();case _0x94d3('0x15'):var _0x58dabc=_[_0x94d3('0x33')](_0x5849a8);if(_0xa5f677[_0x94d3('0x31')]){var _0x2a0c1c={};_0x2a0c1c[_0xa5f677[_0x94d3('0x31')]]=_0x3fbc07;_[_0x94d3('0x2e')](_0x58dabc[_0x94d3('0x2f')],_0x2a0c1c);}return _0x1c40a2[_0x94d3('0x1b')]('Lead')[_0x94d3('0x1f')](_0x58dabc,_0x3dfb84);case _0x94d3('0x36'):var _0x1e30e1=_['cloneDeep'](_0x5849a8);if(_0xa5f677[_0x94d3('0x34')]){var _0x2a0c1c={};_0x2a0c1c[_0xa5f677['additionalSearchAccount']]=_0x3fbc07;_[_0x94d3('0x2e')](_0x1e30e1[_0x94d3('0x2f')],_0x2a0c1c);}return _0x1c40a2[_0x94d3('0x1b')]('Account')[_0x94d3('0x1f')](_0x1e30e1,_0x3dfb84);default:return null;}})['then'](function(_0x48d00c){if(_0x48d00c&&_0x48d00c['length']){var _0x2b53b1=_[_0x94d3('0x37')](_0x48d00c);if(_0x2b53b1){return BPromise[_0x94d3('0x24')]({'id':_0x2b53b1['Id'],'name':_0x2b53b1['Name'],'phone':_0x2b53b1['Phone'],'endUserType':_0x2b53b1[_0x94d3('0x38')][_0x94d3('0x39')][_0x94d3('0x3a')]()});}}})[_0x94d3('0x21')](function(_0x2e91ed){if(_0x2e91ed){logger[_0x94d3('0x1a')](_0x94d3('0x3b'),_0x2e91ed[_0x94d3('0x13')],_0x3fbc07);return BPromise['resolve'](_0x2e91ed);}else{logger[_0x94d3('0x1a')](_0x94d3('0x3c'),_0x3fbc07);var _0x5696ca={'Phone':_0x3fbc07};if(_0xa5f677['moduleCreate']){if(_0xa5f677[_0x94d3('0x3d')]===_0x94d3('0x14')){logger[_0x94d3('0x1a')](_0x94d3('0x3e'),_0x3fbc07,_0xa5f677[_0x94d3('0x3d')]);_0x5696ca[_0x94d3('0x3f')]=_0x544bd1!==_0x94d3('0x40')?_0x544bd1:util[_0x94d3('0x41')](_0x94d3('0x42'),_0x3fbc07);}else if(_0xa5f677[_0x94d3('0x3d')]===_0x94d3('0x15')){logger[_0x94d3('0x1a')](_0x94d3('0x3e'),_0x3fbc07,_0xa5f677[_0x94d3('0x3d')]);_0x5696ca[_0x94d3('0x3f')]=_0x544bd1!==_0x94d3('0x40')?_0x544bd1:util[_0x94d3('0x41')]('Caller\x20-\x20%s',_0x3fbc07);_0x5696ca[_0x94d3('0x43')]=_0x94d3('0x44');}else if(_0xa5f677[_0x94d3('0x3d')]===_0x94d3('0x36')){logger['info'](_0x94d3('0x3e'),_0x3fbc07,_0xa5f677[_0x94d3('0x3d')]);_0x5696ca[_0x94d3('0x25')]=_0x544bd1!==_0x94d3('0x40')?_0x544bd1:util[_0x94d3('0x41')](_0x94d3('0x42'),_0x3fbc07);}else{return null;}}return _0x1c40a2['sobject'](_[_0x94d3('0x45')](_0xa5f677['moduleCreate']))[_0x94d3('0x1c')](_0x5696ca)[_0x94d3('0x21')](function(_0x627fc4){return BPromise[_0x94d3('0x24')]({'id':_0x627fc4['id'],'endUserType':_0xa5f677[_0x94d3('0x3d')]});});}});}function getCustomFields(_0x4fafa5,_0x5d656b){var _0x11e07b={};if(_0x4fafa5[_0x94d3('0x22')]>0x0){_[_0x94d3('0x46')](_0x4fafa5,function(_0x4fa9a1){if(_[_0x94d3('0x47')](['string',_0x94d3('0x48')],_0x4fa9a1[_0x94d3('0x39')])&&_0x4fa9a1['idField']){_0x11e07b[_0x4fa9a1[_0x94d3('0x49')]]=_0x4fa9a1['content'][_0x94d3('0x4a')]();}else if(_0x4fa9a1[_0x94d3('0x39')]===_0x94d3('0x4b')&&_0x4fa9a1['variableName']&&_0x4fa9a1[_0x94d3('0x49')]){_0x5d656b[_0x4fa9a1[_0x94d3('0x4c')]]&&(_0x11e07b[_0x4fa9a1[_0x94d3('0x49')]]=_0x5d656b[_0x4fa9a1[_0x94d3('0x4c')]][_0x94d3('0x4a')]());}else if(_0x4fa9a1['type']===_0x94d3('0x4d')&&_0x4fa9a1['Variable']&&_0x4fa9a1['Variable'][_0x94d3('0x4e')]&&_0x4fa9a1['idField']){_0x5d656b[_0x4fa9a1['Variable']['name'][_0x94d3('0x3a')]()]&&(_0x11e07b[_0x4fa9a1['idField']]=_0x5d656b[_0x4fa9a1[_0x94d3('0x4f')]['name']['toLowerCase']()]['toString']());}});}return _0x11e07b;}function getConnection(_0x5edc5e){var _0x2f498c=_0x5edc5e['password'][_0x94d3('0x50')](_0x5edc5e[_0x94d3('0x51')]);var _0x4b121c=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5edc5e[_0x94d3('0x52')]||'https://login.salesforce.com','clientId':_0x5edc5e[_0x94d3('0x53')],'clientSecret':_0x5edc5e[_0x94d3('0x54')]}});return _0x4b121c[_0x94d3('0x55')](_0x5edc5e['username'],_0x2f498c)['then'](function(){logger['info'](_0x94d3('0x56'));return _0x4b121c;});}exports[_0x94d3('0x57')]=function(_0x4d4d3c,_0xf53400,_0x3a8996,_0x4189bf,_0x1ce823,_0x11143d){var _0x1a7d42,_0x2cad2b,_0xbe0df8,_0x256f7b;_0x11143d['serverUrl']=intUtil['stripTrailingSlash'](_0x11143d['serverUrl']);_0x11143d[_0x94d3('0x52')]=intUtil[_0x94d3('0x58')](_0x11143d[_0x94d3('0x52')]);if(_0x1ce823&&_0x1ce823[_0x94d3('0x59')]){logger[_0x94d3('0x1a')]('[QUEUE]','Recording\x20is\x20enabled!');_0xf53400[_0x94d3('0x5a')]=util[_0x94d3('0x41')](_0x94d3('0x5b'),_0x11143d[_0x94d3('0x5c')],_0xf53400['uniqueid'],md5(_0xf53400['uniqueid']));}else{_0xf53400['recordingURL']='';}return getConnection(_0x11143d)[_0x94d3('0x21')](function(_0x134393){_0x256f7b=_0x134393;return getUser(_0x11143d,_0x4189bf[_0x94d3('0x5d')],_0x256f7b);})[_0x94d3('0x21')](function(_0x48969d){_0x1a7d42=_0x48969d;return getEndUser(_0x11143d,_0x3a8996,_0xf53400[_0x94d3('0x5e')],_0xf53400[_0x94d3('0x5f')],_0x256f7b);})[_0x94d3('0x21')](function(_0x4a069f){_0x2cad2b=_0x4a069f;return getTicket(_0x11143d,_0x1a7d42,_0x2cad2b,_0x3a8996,_0xf53400,_0x3a8996[_0x94d3('0x60')],_0x256f7b,_0x94d3('0x57'));})['then'](function(_0xb9923){_0xbe0df8=_0xb9923;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0xbe0df8['id']);logger[_0x94d3('0x1a')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0xbe0df8['id'],_0x4189bf[_0x94d3('0x4e')],_0x11143d['type']);switch(_0x11143d[_0x94d3('0x39')]){case _0x94d3('0x61'):emit(util[_0x94d3('0x41')](_0x94d3('0x62'),_0x4189bf[_0x94d3('0x4e')]),_0x94d3('0x63'),{'recordId':_0xbe0df8['id']});break;case _0x94d3('0x64'):emit(util[_0x94d3('0x41')](_0x94d3('0x62'),_0x4189bf['name']),_0x94d3('0x65'),{'uri':util['format'](_0x94d3('0x66'),_0x256f7b[_0x94d3('0x67')],_0xbe0df8['id'])});break;default:logger['error'](_0x94d3('0x68'));}})[_0x94d3('0x69')](function(_0x34595f){logger[_0x94d3('0x6a')]('[QUEUE]',_0x34595f);});};exports[_0x94d3('0x6b')]=function(_0x41eb9e,_0x71a9b6,_0x583799,_0x113a2c,_0x15684a,_0x491299,_0x11774d){var _0xebe1fe,_0x57a407,_0x36b67f,_0x479f6f;_0x491299['serverUrl']=intUtil[_0x94d3('0x58')](_0x491299[_0x94d3('0x5c')]);_0x491299[_0x94d3('0x52')]=intUtil[_0x94d3('0x58')](_0x491299[_0x94d3('0x52')]);if(_0x11774d&&_0x11774d[_0x94d3('0x6c')]&&_0x11774d[_0x94d3('0x6c')]!==_0x94d3('0x6d')){logger[_0x94d3('0x1a')](_0x94d3('0x6e'),'Recording\x20is\x20enabled!');_0x71a9b6[_0x94d3('0x5a')]=util[_0x94d3('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x491299[_0x94d3('0x5c')],_0x71a9b6['uniqueid'],md5(_0x71a9b6[_0x94d3('0x6f')]));}return getConnection(_0x491299)[_0x94d3('0x21')](function(_0x3ba41b){_0x479f6f=_0x3ba41b;return getUser(_0x491299,_0x113a2c[_0x94d3('0x5d')],_0x479f6f);})[_0x94d3('0x21')](function(_0x1f13a8){_0xebe1fe=_0x1f13a8;return getEndUser(_0x491299,_0x583799,_0x71a9b6['destcalleridname'],_0x71a9b6[_0x94d3('0x70')],_0x479f6f);})[_0x94d3('0x21')](function(_0x474885){_0x57a407=_0x474885;return getTicket(_0x491299,_0xebe1fe,_0x57a407,_0x583799,_0x71a9b6,_0x583799[_0x94d3('0x60')],_0x479f6f,'outbound');})['then'](function(_0x2b7f61){_0x36b67f=_0x2b7f61;logger['info'](_0x94d3('0x71'),_0x36b67f['id']);logger[_0x94d3('0x1a')](_0x94d3('0x72'),_0x36b67f['id'],_0x113a2c[_0x94d3('0x4e')],_0x491299[_0x94d3('0x39')]);switch(_0x491299[_0x94d3('0x39')]){case _0x94d3('0x61'):emit(util[_0x94d3('0x41')](_0x94d3('0x62'),_0x113a2c['name']),'trigger:salesforce:display',{'recordId':_0x36b67f['id']});break;case _0x94d3('0x64'):emit(util[_0x94d3('0x41')](_0x94d3('0x62'),_0x113a2c['name']),_0x94d3('0x65'),{'uri':util[_0x94d3('0x41')]('%s/%s/e',_0x479f6f['instanceUrl'],_0x36b67f['id'])});break;default:logger[_0x94d3('0x6a')](_0x94d3('0x6e'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x94d3('0x69')](function(_0x2a1e8d){logger['error']('[OUTBOUND]',_0x2a1e8d);});};exports[_0x94d3('0x73')]=function(_0x385a7c,_0xa3f392,_0x38b47b,_0x80f98b,_0x10524f,_0x3d7129){var _0x5afc52,_0x5b30f1,_0x98189b,_0x14dc19;_0x3d7129[_0x94d3('0x5c')]=intUtil[_0x94d3('0x58')](_0x3d7129['serverUrl']);_0x3d7129[_0x94d3('0x52')]=intUtil[_0x94d3('0x58')](_0x3d7129[_0x94d3('0x52')]);if(_0x10524f&&_0x10524f[_0x94d3('0x59')]){logger[_0x94d3('0x1a')]('['+_0xa3f392['lastevent'][_0x94d3('0x74')]()+']',_0x94d3('0x75'));_0xa3f392[_0x94d3('0x5a')]=util[_0x94d3('0x41')](_0x94d3('0x5b'),_0x3d7129['serverUrl'],_0xa3f392[_0x94d3('0x6f')],md5(_0xa3f392[_0x94d3('0x6f')]));}else{_0xa3f392[_0x94d3('0x5a')]='';}return getConnection(_0x3d7129)['then'](function(_0x3bb547){_0x14dc19=_0x3bb547;if(!_[_0x94d3('0x76')](_0x80f98b)){return getUser(_0x3d7129,_0x80f98b[_0x94d3('0x4e')],_0x14dc19);}else{return getUser(_0x3d7129,null,_0x14dc19);}})[_0x94d3('0x21')](function(_0x8fd6c0){_0x5afc52=_0x8fd6c0;return getEndUser(_0x3d7129,_0x38b47b,_0xa3f392[_0x94d3('0x5e')],_0xa3f392[_0x94d3('0x5f')],_0x14dc19);})[_0x94d3('0x21')](function(_0xf5359c){_0x5b30f1=_0xf5359c;return getTicket(_0x3d7129,_0x5afc52,_0x5b30f1,_0x38b47b,_0xa3f392,_0x38b47b['Fields'],_0x14dc19);})['then'](function(_0x38f749){_0x98189b=_0x38f749;logger[_0x94d3('0x1a')]('['+_0xa3f392[_0x94d3('0x77')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x98189b['id']);logger[_0x94d3('0x1a')]('['+_0xa3f392[_0x94d3('0x77')][_0x94d3('0x74')]()+']\x20Integration\x20account\x20type\x20%s.',_0x3d7129[_0x94d3('0x39')]);})[_0x94d3('0x69')](function(_0x2c2c6a){logger[_0x94d3('0x6a')]('['+_0xa3f392[_0x94d3('0x77')][_0x94d3('0x74')]()+']',_0x2c2c6a);});}; \ No newline at end of file +var _0x7cb6=['Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','isNil','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','md5','jsforce','util','./util','salesforce','defaults','redis','localhost','socket.io-emitter','emit','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','WhoId','WhatId','Case','contact','ContactId','account','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridnum'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0x7cb6,0x128));var _0x67cb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7cb6[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x67cb('0x0'));var rp=require('request-promise');var moment=require(_0x67cb('0x1'));var BPromise=require('bluebird');var md5=require(_0x67cb('0x2'));var jsforce=require(_0x67cb('0x3'));var util=require(_0x67cb('0x4'));var Redis=require('ioredis');var intUtil=require(_0x67cb('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x67cb('0x6'));config['redis']=_[_0x67cb('0x7')](config[_0x67cb('0x8')],{'host':_0x67cb('0x9'),'port':0x18eb});var io=require(_0x67cb('0xa'))(new Redis(config[_0x67cb('0x8')]));function emit(_0x44519e,_0x507bfb,_0x2f0fe7){io['to'](_0x44519e)[_0x67cb('0xb')](_0x507bfb,_0x2f0fe7);}function getTicket(_0x50db1c,_0x2a8688,_0xf08f53,_0x31ffde,_0x5f117f,_0x35273e,_0x1f96ae,_0xf17a48){var _0x2a0c2f=Object['assign']({},{'OwnerId':_0x2a8688['id'],'Subject':intUtil[_0x67cb('0xc')](_0x31ffde['Subjects'],_0x5f117f,'\x20'),'Description':intUtil[_0x67cb('0xc')](_0x31ffde[_0x67cb('0xd')],_0x5f117f,'\x0a')},getCustomFields(_0x35273e,_0x5f117f));if(_0xf08f53){if(_0x31ffde[_0x67cb('0xe')]===_0x67cb('0xf')){_0x2a0c2f[_0x67cb('0x10')]=moment[_0x67cb('0x11')]();_0x2a0c2f[_0x67cb('0x12')]=![];_0x2a0c2f[_0x67cb('0x13')]=![];if(_0xf08f53[_0x67cb('0x14')]==='contact'||_0xf08f53[_0x67cb('0x14')]==='lead'){_0x2a0c2f[_0x67cb('0x15')]=_0xf08f53['id'];}else if(_0xf08f53[_0x67cb('0x14')]==='account'){_0x2a0c2f[_0x67cb('0x16')]=_0xf08f53['id'];}}else if(_0x31ffde[_0x67cb('0xe')]===_0x67cb('0x17')){if(_0xf08f53[_0x67cb('0x14')]===_0x67cb('0x18')){_0x2a0c2f[_0x67cb('0x19')]=_0xf08f53['id'];}else if(_0xf08f53['endUserType']===_0x67cb('0x1a')){_0x2a0c2f[_0x67cb('0x1b')]=_0xf08f53['id'];}else if(_0xf08f53[_0x67cb('0x14')]===_0x67cb('0x1c')&&_0x31ffde[_0x67cb('0x1d')]){_0x2a0c2f[_0x31ffde[_0x67cb('0x1d')]]=_0xf08f53['id'];}else{logger[_0x67cb('0x1e')](_0x67cb('0x1f'));}}}return _0x1f96ae[_0x67cb('0x20')](_0x31ffde['ticketType'])[_0x67cb('0x21')](_0x2a0c2f);}function getUser(_0x2523e4,_0x1831ad,_0x46f40d){if(!_['isNil'](_0x1831ad)&&intUtil[_0x67cb('0x22')](_0x1831ad)){var _0x51aa4b={'Email':_0x1831ad};var _0x10314f={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x46f40d['sobject'](_0x67cb('0x23'))[_0x67cb('0x24')](_0x51aa4b,_0x10314f)[_0x67cb('0x25')]()[_0x67cb('0x26')](function(_0x37070a){if(_0x37070a[_0x67cb('0x27')]){var _0x64b2e=_[_0x67cb('0x24')](_0x37070a,function(_0x20229b){return _0x20229b[_0x67cb('0x28')]===_0x1831ad;});if(_0x64b2e){logger[_0x67cb('0x1e')](_0x67cb('0x29'),_0x1831ad);return BPromise[_0x67cb('0x2a')]({'id':_0x64b2e['Id'],'name':_0x64b2e[_0x67cb('0x2b')]});}}else{logger[_0x67cb('0x1e')](_0x67cb('0x2c'),_0x1831ad);return _0x46f40d[_0x67cb('0x2d')]()[_0x67cb('0x26')](function(_0x5d0ac1){return BPromise['resolve']({'id':_0x5d0ac1[_0x67cb('0x2e')],'name':_0x5d0ac1[_0x67cb('0x2f')]});});}});}else{logger[_0x67cb('0x1e')](_0x67cb('0x2c'),_0x1831ad);return _0x46f40d[_0x67cb('0x2d')]()[_0x67cb('0x26')](function(_0x248aed){return BPromise[_0x67cb('0x2a')]({'id':_0x248aed[_0x67cb('0x2e')],'name':_0x248aed[_0x67cb('0x2f')]});});}}function getEndUser(_0x3e5e7a,_0xd9d9cc,_0x5534f1,_0x347832,_0x22536c){var _0x1f089b={'$or':{'Phone':_0x347832}};var _0x281572={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x67cb('0x2a')]()[_0x67cb('0x26')](function(){logger[_0x67cb('0x1e')](_0x67cb('0x30'),_0x347832,_0xd9d9cc['moduleSearch']);switch(_0xd9d9cc[_0x67cb('0x31')]){case _0x67cb('0x32'):var _0x48a321=_[_0x67cb('0x33')](_0x1f089b);if(_0xd9d9cc[_0x67cb('0x34')]){var _0xd1ad37={};_0xd1ad37[_0xd9d9cc[_0x67cb('0x34')]]=_0x347832;_[_0x67cb('0x35')](_0x48a321['$or'],_0xd1ad37);}return _0x22536c[_0x67cb('0x20')](_0x67cb('0x36'))[_0x67cb('0x24')](_0x48a321,_0x281572)[_0x67cb('0x25')]()['then'](function(_0x4bb83c){if(_0x4bb83c&&_0x4bb83c[_0x67cb('0x27')]){return _0x4bb83c;}else{var _0x433c80=_['cloneDeep'](_0x1f089b);if(_0xd9d9cc[_0x67cb('0x37')]){var _0x1b8a04={};_0x1b8a04[_0xd9d9cc[_0x67cb('0x37')]]=_0x347832;_['merge'](_0x433c80[_0x67cb('0x38')],_0x1b8a04);}return _0x22536c[_0x67cb('0x20')](_0x67cb('0x39'))[_0x67cb('0x24')](_0x433c80,_0x281572);}});case _0x67cb('0x3a'):var _0x2efbd4=_['cloneDeep'](_0x1f089b);if(_0xd9d9cc[_0x67cb('0x3b')]){var _0xd1ad37={};_0xd1ad37[_0xd9d9cc[_0x67cb('0x3b')]]=_0x347832;_[_0x67cb('0x35')](_0x2efbd4[_0x67cb('0x38')],_0xd1ad37);}return _0x22536c[_0x67cb('0x20')]('Account')[_0x67cb('0x24')](_0x2efbd4,_0x281572)[_0x67cb('0x25')]()[_0x67cb('0x26')](function(_0x291d25){if(_0x291d25&&_0x291d25[_0x67cb('0x27')]){return _0x291d25;}else{var _0x5b2b54=_[_0x67cb('0x33')](_0x1f089b);if(_0xd9d9cc[_0x67cb('0x34')]){var _0x454e08={};_0x454e08[_0xd9d9cc[_0x67cb('0x34')]]=_0x347832;_['merge'](_0x5b2b54[_0x67cb('0x38')],_0x454e08);}return _0x22536c['sobject'](_0x67cb('0x36'))[_0x67cb('0x24')](_0x5b2b54,_0x281572)['then'](function(_0x2fa015){if(_0x2fa015&&_0x2fa015[_0x67cb('0x27')]){return _0x2fa015;}else{var _0x394c00=_[_0x67cb('0x33')](_0x1f089b);if(_0xd9d9cc[_0x67cb('0x37')]){var _0x4227a8={};_0x4227a8[_0xd9d9cc[_0x67cb('0x37')]]=_0x347832;_[_0x67cb('0x35')](_0x394c00[_0x67cb('0x38')],_0x4227a8);}return _0x22536c[_0x67cb('0x20')]('Lead')[_0x67cb('0x24')](_0x394c00,_0x281572);}});}});case'contact':var _0x48a321=_[_0x67cb('0x33')](_0x1f089b);if(_0xd9d9cc[_0x67cb('0x34')]){var _0xd1ad37={};_0xd1ad37[_0xd9d9cc[_0x67cb('0x34')]]=_0x347832;_[_0x67cb('0x35')](_0x48a321['$or'],_0xd1ad37);}return _0x22536c[_0x67cb('0x20')](_0x67cb('0x36'))['find'](_0x48a321,_0x281572)['execute']();case _0x67cb('0x1c'):var _0x123740=_[_0x67cb('0x33')](_0x1f089b);if(_0xd9d9cc['additionalSearchLead']){var _0xd1ad37={};_0xd1ad37[_0xd9d9cc[_0x67cb('0x37')]]=_0x347832;_[_0x67cb('0x35')](_0x123740[_0x67cb('0x38')],_0xd1ad37);}return _0x22536c[_0x67cb('0x20')](_0x67cb('0x39'))[_0x67cb('0x24')](_0x123740,_0x281572);case _0x67cb('0x1a'):var _0x2efbd4=_[_0x67cb('0x33')](_0x1f089b);if(_0xd9d9cc['additionalSearchAccount']){var _0xd1ad37={};_0xd1ad37[_0xd9d9cc[_0x67cb('0x3b')]]=_0x347832;_[_0x67cb('0x35')](_0x2efbd4['$or'],_0xd1ad37);}return _0x22536c[_0x67cb('0x20')](_0x67cb('0x3c'))[_0x67cb('0x24')](_0x2efbd4,_0x281572);default:return null;}})['then'](function(_0x53eb53){if(_0x53eb53&&_0x53eb53[_0x67cb('0x27')]){var _0x4156d8=_[_0x67cb('0x3d')](_0x53eb53);if(_0x4156d8){return BPromise['resolve']({'id':_0x4156d8['Id'],'name':_0x4156d8['Name'],'phone':_0x4156d8[_0x67cb('0x3e')],'endUserType':_0x4156d8[_0x67cb('0x3f')][_0x67cb('0x40')][_0x67cb('0x41')]()});}}})[_0x67cb('0x26')](function(_0x232018){if(_0x232018){logger['info'](_0x67cb('0x42'),_0x232018['endUserType'],_0x347832);return BPromise[_0x67cb('0x2a')](_0x232018);}else{logger[_0x67cb('0x1e')](_0x67cb('0x43'),_0x347832);var _0x201593={'Phone':_0x347832};if(_0xd9d9cc[_0x67cb('0x44')]){if(_0xd9d9cc[_0x67cb('0x44')]===_0x67cb('0x18')){logger[_0x67cb('0x1e')](_0x67cb('0x45'),_0x347832,_0xd9d9cc[_0x67cb('0x44')]);_0x201593[_0x67cb('0x46')]=_0x5534f1!==_0x67cb('0x47')?_0x5534f1:util[_0x67cb('0x48')]('Caller\x20-\x20%s',_0x347832);}else if(_0xd9d9cc[_0x67cb('0x44')]===_0x67cb('0x1c')){logger['info'](_0x67cb('0x45'),_0x347832,_0xd9d9cc[_0x67cb('0x44')]);_0x201593['LastName']=_0x5534f1!==''?_0x5534f1:util[_0x67cb('0x48')](_0x67cb('0x49'),_0x347832);_0x201593[_0x67cb('0x4a')]=_0x67cb('0x4b');}else if(_0xd9d9cc['moduleCreate']===_0x67cb('0x1a')){logger[_0x67cb('0x1e')](_0x67cb('0x45'),_0x347832,_0xd9d9cc[_0x67cb('0x44')]);_0x201593['Name']=_0x5534f1!==_0x67cb('0x47')?_0x5534f1:util[_0x67cb('0x48')]('Caller\x20-\x20%s',_0x347832);}else{return null;}}return _0x22536c[_0x67cb('0x20')](_[_0x67cb('0x4c')](_0xd9d9cc[_0x67cb('0x44')]))['create'](_0x201593)[_0x67cb('0x26')](function(_0x32c581){return BPromise[_0x67cb('0x2a')]({'id':_0x32c581['id'],'endUserType':_0xd9d9cc[_0x67cb('0x44')]});});}});}function getCustomFields(_0x3d4b1d,_0xa15bcf){var _0xa68405={};if(_0x3d4b1d['length']>0x0){_['forEach'](_0x3d4b1d,function(_0x41de1e){if(_[_0x67cb('0x4d')]([_0x67cb('0x4e'),_0x67cb('0x4f')],_0x41de1e[_0x67cb('0x40')])&&_0x41de1e[_0x67cb('0x50')]){_0xa68405[_0x41de1e['idField']]=_0x41de1e[_0x67cb('0x51')][_0x67cb('0x52')]();}else if(_0x41de1e[_0x67cb('0x40')]===_0x67cb('0x53')&&_0x41de1e['variableName']&&_0x41de1e[_0x67cb('0x50')]){_0xa15bcf[_0x41de1e[_0x67cb('0x54')]]&&(_0xa68405[_0x41de1e[_0x67cb('0x50')]]=_0xa15bcf[_0x41de1e['variableName']]['toString']());}else if(_0x41de1e['type']===_0x67cb('0x55')&&_0x41de1e[_0x67cb('0x56')]&&_0x41de1e[_0x67cb('0x56')]['name']&&_0x41de1e[_0x67cb('0x50')]){_0xa15bcf[_0x41de1e[_0x67cb('0x56')]['name'][_0x67cb('0x41')]()]&&(_0xa68405[_0x41de1e[_0x67cb('0x50')]]=_0xa15bcf[_0x41de1e[_0x67cb('0x56')][_0x67cb('0x57')][_0x67cb('0x41')]()][_0x67cb('0x52')]());}});}return _0xa68405;}function getConnection(_0x181f78){var _0x1d682f=_0x181f78[_0x67cb('0x58')][_0x67cb('0x59')](_0x181f78[_0x67cb('0x5a')]);var _0x1d6558=new jsforce['Connection']({'oauth2':{'loginUrl':_0x181f78[_0x67cb('0x5b')]||_0x67cb('0x5c'),'clientId':_0x181f78[_0x67cb('0x5d')],'clientSecret':_0x181f78[_0x67cb('0x5e')]}});return _0x1d6558[_0x67cb('0x5f')](_0x181f78['username'],_0x1d682f)[_0x67cb('0x26')](function(){logger['info'](_0x67cb('0x60'));return _0x1d6558;});}exports[_0x67cb('0x61')]=function(_0x1b64bc,_0x8165df,_0x3c0ba0,_0x20eb1f,_0x31befb,_0xe2eee1){var _0x2775f1,_0x1fa5e7,_0x13b2a7,_0x231845;_0xe2eee1[_0x67cb('0x62')]=intUtil[_0x67cb('0x63')](_0xe2eee1[_0x67cb('0x62')]);_0xe2eee1[_0x67cb('0x5b')]=intUtil['stripTrailingSlash'](_0xe2eee1[_0x67cb('0x5b')]);if(_0x31befb&&_0x31befb['monitor_format']){logger[_0x67cb('0x1e')](_0x67cb('0x64'),_0x67cb('0x65'));_0x8165df[_0x67cb('0x66')]=util[_0x67cb('0x48')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xe2eee1[_0x67cb('0x62')],_0x8165df[_0x67cb('0x67')],md5(_0x8165df[_0x67cb('0x67')]));}else{_0x8165df['recordingURL']='';}return getConnection(_0xe2eee1)['then'](function(_0x25fe6a){_0x231845=_0x25fe6a;return getUser(_0xe2eee1,_0x20eb1f[_0x67cb('0x68')],_0x231845);})[_0x67cb('0x26')](function(_0x4261b2){_0x2775f1=_0x4261b2;return getEndUser(_0xe2eee1,_0x3c0ba0,_0x8165df['calleridname'],_0x8165df[_0x67cb('0x69')],_0x231845);})[_0x67cb('0x26')](function(_0x1b15ef){_0x1fa5e7=_0x1b15ef;return getTicket(_0xe2eee1,_0x2775f1,_0x1fa5e7,_0x3c0ba0,_0x8165df,_0x3c0ba0[_0x67cb('0x6a')],_0x231845,_0x67cb('0x61'));})['then'](function(_0x30a12d){_0x13b2a7=_0x30a12d;logger[_0x67cb('0x1e')](_0x67cb('0x6b'),_0x13b2a7['id']);logger[_0x67cb('0x1e')](_0x67cb('0x6c'),_0x13b2a7['id'],_0x20eb1f[_0x67cb('0x57')],_0xe2eee1[_0x67cb('0x40')]);switch(_0xe2eee1[_0x67cb('0x40')]){case _0x67cb('0x6d'):emit(util['format'](_0x67cb('0x6e'),_0x20eb1f[_0x67cb('0x57')]),_0x67cb('0x6f'),{'recordId':_0x13b2a7['id']});break;case _0x67cb('0x70'):emit(util['format'](_0x67cb('0x6e'),_0x20eb1f[_0x67cb('0x57')]),_0x67cb('0x71'),{'uri':util['format'](_0x67cb('0x72'),_0x231845[_0x67cb('0x73')],_0x13b2a7['id'])});break;default:logger[_0x67cb('0x74')](_0x67cb('0x75'));}})['catch'](function(_0x397b2f){logger[_0x67cb('0x74')](_0x67cb('0x64'),_0x397b2f);});};exports[_0x67cb('0x76')]=function(_0x3f0aaf,_0x6df511,_0x32a56c,_0x2cf824,_0x37ea36,_0xb584fc,_0xf69bd9){var _0x49b1f9,_0x4c5eda,_0x41aaac,_0xe85f6d;_0xb584fc['serverUrl']=intUtil[_0x67cb('0x63')](_0xb584fc['serverUrl']);_0xb584fc[_0x67cb('0x5b')]=intUtil['stripTrailingSlash'](_0xb584fc['remoteUri']);if(_0xf69bd9&&_0xf69bd9[_0x67cb('0x77')]&&_0xf69bd9[_0x67cb('0x77')]!==_0x67cb('0x78')){logger[_0x67cb('0x1e')]('[OUTBOUND]',_0x67cb('0x65'));_0x6df511[_0x67cb('0x66')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xb584fc['serverUrl'],_0x6df511[_0x67cb('0x67')],md5(_0x6df511['uniqueid']));}return getConnection(_0xb584fc)['then'](function(_0x4d58c6){_0xe85f6d=_0x4d58c6;return getUser(_0xb584fc,_0x2cf824[_0x67cb('0x68')],_0xe85f6d);})[_0x67cb('0x26')](function(_0x30531d){_0x49b1f9=_0x30531d;return getEndUser(_0xb584fc,_0x32a56c,_0x6df511[_0x67cb('0x79')],_0x6df511['destcalleridnum'],_0xe85f6d);})[_0x67cb('0x26')](function(_0x119be3){_0x4c5eda=_0x119be3;return getTicket(_0xb584fc,_0x49b1f9,_0x4c5eda,_0x32a56c,_0x6df511,_0x32a56c[_0x67cb('0x6a')],_0xe85f6d,_0x67cb('0x76'));})[_0x67cb('0x26')](function(_0x1fb491){_0x41aaac=_0x1fb491;logger['info'](_0x67cb('0x7a'),_0x41aaac['id']);logger[_0x67cb('0x1e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x41aaac['id'],_0x2cf824[_0x67cb('0x57')],_0xb584fc['type']);switch(_0xb584fc['type']){case _0x67cb('0x6d'):emit(util[_0x67cb('0x48')](_0x67cb('0x6e'),_0x2cf824['name']),_0x67cb('0x6f'),{'recordId':_0x41aaac['id']});break;case _0x67cb('0x70'):emit(util[_0x67cb('0x48')](_0x67cb('0x6e'),_0x2cf824['name']),_0x67cb('0x71'),{'uri':util[_0x67cb('0x48')](_0x67cb('0x72'),_0xe85f6d['instanceUrl'],_0x41aaac['id'])});break;default:logger[_0x67cb('0x74')](_0x67cb('0x7b'),_0x67cb('0x7c'));}})[_0x67cb('0x7d')](function(_0x18a878){logger['error'](_0x67cb('0x7b'),_0x18a878);});};exports['unmanaged']=function(_0xe0a00e,_0x2c0af4,_0x92031f,_0x6a8500,_0x44d18b,_0x19068f){var _0x3dd8de,_0x1f5d1c,_0x5bcd5a,_0xca8911;_0x19068f['serverUrl']=intUtil[_0x67cb('0x63')](_0x19068f[_0x67cb('0x62')]);_0x19068f[_0x67cb('0x5b')]=intUtil[_0x67cb('0x63')](_0x19068f[_0x67cb('0x5b')]);if(_0x44d18b&&_0x44d18b[_0x67cb('0x7e')]){logger[_0x67cb('0x1e')]('['+_0x2c0af4[_0x67cb('0x7f')][_0x67cb('0x80')]()+']',_0x67cb('0x65'));_0x2c0af4[_0x67cb('0x66')]=util[_0x67cb('0x48')](_0x67cb('0x81'),_0x19068f[_0x67cb('0x62')],_0x2c0af4['uniqueid'],md5(_0x2c0af4[_0x67cb('0x67')]));}else{_0x2c0af4['recordingURL']='';}return getConnection(_0x19068f)['then'](function(_0x6adfc7){_0xca8911=_0x6adfc7;if(!_[_0x67cb('0x82')](_0x6a8500)){return getUser(_0x19068f,_0x6a8500[_0x67cb('0x57')],_0xca8911);}else{return getUser(_0x19068f,null,_0xca8911);}})[_0x67cb('0x26')](function(_0xbab958){_0x3dd8de=_0xbab958;return getEndUser(_0x19068f,_0x92031f,_0x2c0af4[_0x67cb('0x83')],_0x2c0af4[_0x67cb('0x69')],_0xca8911);})['then'](function(_0x3a6cb7){_0x1f5d1c=_0x3a6cb7;return getTicket(_0x19068f,_0x3dd8de,_0x1f5d1c,_0x92031f,_0x2c0af4,_0x92031f['Fields'],_0xca8911);})[_0x67cb('0x26')](function(_0x62fd89){_0x5bcd5a=_0x62fd89;logger['info']('['+_0x2c0af4[_0x67cb('0x7f')]['toUpperCase']()+_0x67cb('0x84'),_0x5bcd5a['id']);logger['info']('['+_0x2c0af4[_0x67cb('0x7f')][_0x67cb('0x80')]()+_0x67cb('0x85'),_0x19068f[_0x67cb('0x40')]);})[_0x67cb('0x7d')](function(_0x35af0a){logger[_0x67cb('0x74')]('['+_0x2c0af4['lastevent'][_0x67cb('0x80')]()+']',_0x35af0a);});}; \ 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 fb46595..3ff8b2b 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 _0x7a74=['call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','redis','localhost','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','true','userId','adminEmail','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserNumber','endUserId','then','includes','string','type','nameField','customField','toLowerCase','toString','picklist','idField','content','variable','variableName','Variable','name','outbound','incident','assign','getString','Subjects','Descriptions','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','format','user:%s','emit','trigger:browser:url','username','sysparm_display_value=true','remoteUri','serverUrl','isNil','email','destcalleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','The\x20ticket\x20ID\x20is:\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a74,0x12c));var _0x47a7=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x7a74[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x47a7('0x0'));var Promise=require(_0x47a7('0x1'));var rp=require('request-promise');var util=require(_0x47a7('0x2'));var md5=require(_0x47a7('0x3'));var Redis=require(_0x47a7('0x4'));var intUtil=require(_0x47a7('0x5'));var config=require(_0x47a7('0x6'));var logger=require('../../../../config/logger')('servicenow');config['redis']=_['defaults'](config[_0x47a7('0x7')],{'host':_0x47a7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x47a7('0x7')]));function getAdminUser(_0x372979,_0x44fde0,_0x22d15c,_0x4050b6,_0x756aa5,_0xa94503){return new Promise(function(_0x276b20,_0x3bb285){var _0x341c2d={'method':'GET','uri':_0x4050b6+_0x47a7('0x9')+'&'+_0x756aa5+'&'+_0xa94503,'auth':_0x44fde0,'json':!![]};return rp(_0x341c2d)['then'](function(_0x58e3a0){if(_0x58e3a0[_0x47a7('0xa')][_0x47a7('0xb')]>0x0){_0x22d15c[_0x47a7('0xc')]=_0x58e3a0[_0x47a7('0xa')][0x0][_0x47a7('0xd')];}logger[_0x47a7('0xe')]('['+[_0x372979[_0x47a7('0xf')]()]+_0x47a7('0x10'),_0x22d15c);_0x276b20(_0x22d15c);})[_0x47a7('0x11')](function(_0x8912b5){logger['error']('['+[_0x372979['toUpperCase']()]+']',_0x8912b5[_0x47a7('0x12')]);_0x3bb285(_0x8912b5[_0x47a7('0x12')]);});});}function getUser(_0x8468d1,_0x5191a5,_0x1893a9,_0x5005d8,_0x2aff8c){return function(_0x4c20e7){logger[_0x47a7('0xe')]('['+[_0x8468d1['toUpperCase']()]+_0x47a7('0x13'),_0x4c20e7);return new Promise(function(_0xdf8db5,_0x13d08e){if(intUtil[_0x47a7('0x14')](_0x4c20e7[_0x47a7('0x15')])){var _0x14141a={'method':_0x47a7('0x16'),'uri':_0x1893a9+_0x47a7('0x17')+_0x4c20e7[_0x47a7('0x15')]+'&'+_0x5005d8+'&'+_0x2aff8c,'auth':_0x5191a5,'json':!![]};logger['info']('['+[_0x8468d1[_0x47a7('0xf')]()]+_0x47a7('0x18'),_0x14141a);return rp(_0x14141a)['then'](function(_0x37be77){logger[_0x47a7('0xe')]('['+[_0x8468d1[_0x47a7('0xf')]()]+'],\x20getUser\x20entity',_0x37be77);if(_0x37be77[_0x47a7('0xa')]['length']>0x0&&String(_0x37be77[_0x47a7('0xa')][0x0][_0x47a7('0x19')])===_0x47a7('0x1a')){_0x4c20e7[_0x47a7('0x1b')]=_0x37be77[_0x47a7('0xa')][0x0]['sys_id'];}else{_0x4c20e7['userId']=_0x4c20e7[_0x47a7('0xc')];_0x4c20e7[_0x47a7('0x15')]=_0x4c20e7[_0x47a7('0x1c')];}logger[_0x47a7('0xe')]('['+[_0x8468d1[_0x47a7('0xf')]()]+'],\x20getUser\x20crm',_0x4c20e7);_0xdf8db5(_0x4c20e7);})[_0x47a7('0x11')](function(_0x587fb5){logger[_0x47a7('0x1d')]('['+[_0x8468d1[_0x47a7('0xf')]()]+']',_0x587fb5[_0x47a7('0x12')]);_0x13d08e(_0x587fb5[_0x47a7('0x12')]);});}else{logger[_0x47a7('0xe')]('['+[_0x8468d1['toUpperCase']()]+_0x47a7('0x1e'));_0x4c20e7[_0x47a7('0x1b')]=_0x4c20e7['adminId'];_0x4c20e7[_0x47a7('0x15')]=_0x4c20e7['adminEmail'];_0xdf8db5(_0x4c20e7);}});};}function createEndUser(_0x121bd0,_0x594255,_0x19c4a2,_0x49b831,_0x70bcba){logger['info']('['+[_0x121bd0[_0x47a7('0xf')]()]+_0x47a7('0x1f'),_0x19c4a2);return new Promise(function(_0x226198,_0x2f0bc7){var _0x27bb72={'method':_0x47a7('0x20'),'uri':_0x49b831+'sys_user?'+_0x70bcba,'body':{'user_name':_0x19c4a2['endUserNumber'],'roles':_0x47a7('0x21'),'first_name':_0x19c4a2['endUserNumber'],'active':'true','date_format':_0x47a7('0x22'),'phone':_0x19c4a2['endUserNumber']},'auth':_0x594255,'json':!![]};return rp(_0x27bb72)['then'](function(_0x22f1fc){logger[_0x47a7('0xe')]('['+[_0x121bd0['toUpperCase']()]+_0x47a7('0x23'),_0x22f1fc[_0x47a7('0xa')]);_0x19c4a2['endUserId']=_0x22f1fc[_0x47a7('0xa')][_0x47a7('0xd')];_0x226198(_0x19c4a2);})[_0x47a7('0x11')](function(_0x3f40e0){logger['error']('['+[_0x121bd0[_0x47a7('0xf')]()]+']',_0x3f40e0[_0x47a7('0x12')]);_0x2f0bc7(_0x3f40e0[_0x47a7('0x12')]);});});}function getEndUser(_0x504be0,_0x3d9852,_0x23c9ec,_0x43799f,_0x621727){return function(_0x450fcc){logger['info']('['+[_0x504be0[_0x47a7('0xf')]()]+_0x47a7('0x24'),_0x450fcc);return new Promise(function(_0xa1742a,_0x3d52a7){var _0x381b26={'method':_0x47a7('0x16'),'uri':_0x23c9ec+_0x47a7('0x25')+_0x450fcc[_0x47a7('0x26')]+'&'+_0x43799f+'&'+_0x621727,'auth':_0x3d9852,'json':!![]};return rp(_0x381b26)['then'](function(_0x136a2e){if(_0x136a2e[_0x47a7('0xa')]['length']>0x0){_0x450fcc[_0x47a7('0x27')]=_0x136a2e['result'][0x0]['sys_id'];logger[_0x47a7('0xe')]('['+[_0x504be0[_0x47a7('0xf')]()]+'],\x20getEndUser\x20crm',_0x450fcc);_0xa1742a(_0x450fcc);}else{return createEndUser(_0x504be0,_0x3d9852,_0x450fcc,_0x23c9ec,_0x43799f)[_0x47a7('0x28')](function(_0x95e9ba){logger['info']('['+[_0x504be0[_0x47a7('0xf')]()]+'],\x20createEndUser\x20crm',_0x95e9ba);_0xa1742a(_0x95e9ba);});}})[_0x47a7('0x11')](function(_0x29dfc5){logger[_0x47a7('0x1d')]('['+[_0x504be0[_0x47a7('0xf')]()]+']',_0x29dfc5['message']);_0x3d52a7(_0x29dfc5[_0x47a7('0x12')]);});});};}function getCustomFields(_0x4edbdd,_0x677179){var _0x1aad1c={};if(_0x4edbdd['length']>0x0){_['forEach'](_0x4edbdd,function(_0xdea3ff){if(_[_0x47a7('0x29')]([_0x47a7('0x2a'),'picklist'],_0xdea3ff[_0x47a7('0x2b')])&&_0xdea3ff[_0x47a7('0x2c')]&&!_0xdea3ff[_0x47a7('0x2d')]){_0x1aad1c[_0xdea3ff['nameField'][_0x47a7('0x2e')]()]=_0xdea3ff['content'][_0x47a7('0x2f')]();}else if(_[_0x47a7('0x29')]([_0x47a7('0x2a'),_0x47a7('0x30')],_0xdea3ff[_0x47a7('0x2b')])&&_0xdea3ff[_0x47a7('0x31')]&&_0xdea3ff[_0x47a7('0x2d')]){_0x1aad1c[_0xdea3ff[_0x47a7('0x31')]['toLowerCase']()]=_0xdea3ff[_0x47a7('0x32')][_0x47a7('0x2f')]();}else if(_0xdea3ff[_0x47a7('0x2b')]===_0x47a7('0x33')&&_0xdea3ff[_0x47a7('0x34')]&&_0xdea3ff[_0x47a7('0x31')]&&_0xdea3ff[_0x47a7('0x2d')]){_0x1aad1c[_0xdea3ff[_0x47a7('0x31')][_0x47a7('0x2e')]()]=_0x677179[_0xdea3ff[_0x47a7('0x34')]][_0x47a7('0x2f')]();}else if(_0xdea3ff[_0x47a7('0x2b')]==='customVariable'&&_0xdea3ff['Variable']&&_0xdea3ff[_0x47a7('0x35')][_0x47a7('0x36')]&&_0xdea3ff[_0x47a7('0x31')]&&_0xdea3ff[_0x47a7('0x2d')]){_0x1aad1c[_0xdea3ff['idField'][_0x47a7('0x2e')]()]=_0x677179[_0xdea3ff[_0x47a7('0x35')][_0x47a7('0x36')]['toLowerCase']()][_0x47a7('0x2f')]();}});}return _0x1aad1c;}function getTicket(_0x375135,_0x500407,_0x3af818,_0x29f241,_0x55f320,_0x434892){return function(_0x4696a3){logger[_0x47a7('0xe')]('['+[_0x375135[_0x47a7('0xf')]()]+']\x20getTicket\x20input\x20crm',_0x4696a3);return new Promise(function(_0x25fc65,_0x2d20d9){var _0x4f8656=_0x375135[_0x47a7('0x2e')]()===_0x47a7('0x37')?_0x4696a3['userId']:_0x4696a3[_0x47a7('0x27')];var _0x421aba={'method':'POST','uri':_0x3af818+_0x47a7('0x38')+'?'+_0x434892,'body':Object[_0x47a7('0x39')]({},{'active':_0x47a7('0x1a'),'caller_id':_0x4f8656,'assigned_to':_0x4696a3['userId'],'short_description':intUtil[_0x47a7('0x3a')](_0x29f241[_0x47a7('0x3b')],_0x55f320,'\x20'),'description':intUtil['getString'](_0x29f241[_0x47a7('0x3c')],_0x55f320,'\x0a')},getCustomFields(_0x29f241['Fields'],_0x55f320)),'auth':_0x500407,'json':!![]};return rp(_0x421aba)[_0x47a7('0x28')](function(_0x53cea1){logger[_0x47a7('0xe')]('['+[_0x375135[_0x47a7('0xf')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x53cea1[_0x47a7('0xa')]);_0x4696a3[_0x47a7('0x3d')]=_0x53cea1['result'][_0x47a7('0xd')];_0x4696a3[_0x47a7('0x3e')]=_0x53cea1['result'][_0x47a7('0x3f')];logger[_0x47a7('0xe')]('['+[_0x375135[_0x47a7('0xf')]()]+']\x20getTicket\x20crm',_0x4696a3);_0x25fc65(_0x4696a3);})[_0x47a7('0x11')](function(_0x58bba9){logger[_0x47a7('0x1d')]('['+[_0x375135[_0x47a7('0xf')]()]+']',_0x58bba9[_0x47a7('0x12')]);_0x2d20d9(_0x58bba9['message']);});});};}function createRemoteTag(_0x8caf55,_0x5b26d0,_0xc93f06,_0x56a9fd){return new Promise(function(_0x31fa7b,_0x617d5f){var _0x4d80ff={'method':_0x47a7('0x20'),'uri':_0xc93f06+_0x47a7('0x40')+'?'+_0x56a9fd,'body':{'short_description':_0x8caf55,'global':!![],'active':!![],'name':_0x8caf55},'auth':_0x5b26d0,'json':!![]};return rp(_0x4d80ff)['then'](function(_0x5e9e6c){var _0x57c8ac=_0x5e9e6c[_0x47a7('0xa')][_0x47a7('0xd')];_0x31fa7b(_0x57c8ac);});});}function getRemoteTag(_0x50f58e,_0x3feaca,_0x4e726f,_0x26c923,_0x35f19c){return new Promise(function(_0x259ef1,_0xca1cef){var _0x1516da={'method':_0x47a7('0x16'),'uri':_0x4e726f+'label'+_0x47a7('0x41')+_0x50f58e+'&'+_0x26c923,'auth':_0x3feaca,'json':!![]};return rp(_0x1516da)[_0x47a7('0x28')](function(_0x5cc877){if(_0x5cc877[_0x47a7('0xa')]['length']>0x0){var _0x346b48=_0x5cc877['result'][0x0]['sys_id'];_0x259ef1(_0x346b48);}else{return createRemoteTag(_0x50f58e,_0x3feaca,_0x4e726f,_0x26c923)[_0x47a7('0x28')](function(_0x5b5f27){_0x259ef1(_0x5b5f27);});}});});}function assignTagToIncident(_0x3a25e7,_0x53d527,_0x2e6cd9,_0xb07d16,_0x3bf47e){return new Promise(function(_0x56c554,_0x3e9723){var _0x5edc01={'method':_0x47a7('0x20'),'uri':_0x2e6cd9+_0x47a7('0x42')+'?'+_0x3bf47e,'body':{'label':_0x3a25e7,'table':_0x47a7('0x38'),'id_type':'Incident','table_key':_0xb07d16[_0x47a7('0x3d')],'title':_0x47a7('0x43')+_0xb07d16[_0x47a7('0x3e')],'id_display':_0xb07d16[_0x47a7('0x3e')]},'auth':_0x53d527,'json':!![]};return rp(_0x5edc01)[_0x47a7('0x28')](function(_0x28e967){_0x56c554();})[_0x47a7('0x11')](function(){_0x56c554();});});}function manageTags(_0x5379bf,_0x5de406,_0x5e3a28,_0x559cba,_0x20fce8,_0x49d5ae,_0x25fe51){return new Promise(function(_0x1259af,_0x503914){var _0x1973ca=[];_0x5de406[_0x47a7('0x44')](function(_0x109b15){_0x1973ca[_0x47a7('0x45')](getRemoteTag(_0x109b15,_0x5e3a28,_0x559cba,_0x49d5ae,_0x25fe51));});return Promise[_0x47a7('0x46')](_0x1973ca)[_0x47a7('0x28')](function(_0xe31637){if(_0xe31637['length']){logger['info']('['+[_0x5379bf[_0x47a7('0xf')]()]+_0x47a7('0x47'),_0xe31637);var _0x9189fd=[];_0xe31637['forEach'](function(_0x383a48){_0x9189fd[_0x47a7('0x45')](assignTagToIncident(_0x383a48,_0x5e3a28,_0x559cba,_0x20fce8,_0x49d5ae));});return Promise[_0x47a7('0x46')](_0x9189fd)[_0x47a7('0x28')](function(){_0x1259af();})[_0x47a7('0x11')](function(){_0x1259af();});}else{_0x1259af();}});});}function getTags(_0x230337,_0x4933a6,_0x575f7f,_0x2c3f72,_0x36c261,_0x4116ff){return function(_0x389f81){return new Promise(function(_0x1c4652,_0x4ed831){var _0x4be204=[];var _0x26611b=_0x2c3f72['Tags'];if(_0x26611b&&_0x26611b['length']>0x0){_0x4be204=_[_0x47a7('0x48')](_0x26611b,_0x47a7('0x36'));}if(_0x4be204['length']>0x0){return manageTags(_0x230337,_0x4be204,_0x4933a6,_0x575f7f,_0x389f81,_0x36c261,_0x4116ff)[_0x47a7('0x28')](function(){_0x1c4652(_0x389f81);});}else{_0x1c4652(_0x389f81);}});};}function emit(_0x8f89,_0x2ac615,_0x2d49ae){var _0x2559a1=_0x47a7('0x49')+_0x47a7('0x4a')+_0x47a7('0x4b')+'%255EORDERBYDESCnumber';var _0x30315d={'uri':_0x8f89+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x2d49ae+_0x2559a1};io['to'](util[_0x47a7('0x4c')](_0x47a7('0x4d'),_0x2ac615))[_0x47a7('0x4e')](_0x47a7('0x4f'),_0x30315d);}exports['cs']=function(_0x5976b8,_0x2bd565,_0x319b89,_0x3716cc,_0x7e95c5,_0x73b7fd,_0x4fe998,_0x6d4510){var _0x471134={};var _0x24cd4e={'user':_0x73b7fd[_0x47a7('0x50')],'pass':_0x73b7fd['password']};var _0x276f86='sysparm_limit=1';var _0x1d269e=_0x47a7('0x51');_0x73b7fd[_0x47a7('0x52')]=intUtil['stripTrailingSlash'](_0x73b7fd['remoteUri']);_0x73b7fd[_0x47a7('0x53')]=intUtil['stripTrailingSlash'](_0x73b7fd[_0x47a7('0x53')]);var _0x3f2c44=util[_0x47a7('0x4c')]('%s/api/now/table/',_0x73b7fd[_0x47a7('0x52')]);_0x471134[_0x47a7('0x15')]=!_[_0x47a7('0x54')](_0x3716cc)?_0x3716cc[_0x47a7('0x55')]:null;_0x471134[_0x47a7('0x1c')]=_0x73b7fd['email'];_0x471134['endUserNumber']=_0x6d4510[_0x47a7('0x2e')]()===_0x47a7('0x37')?_0x2bd565[_0x47a7('0x56')]:_0x2bd565['calleridnum'];_0x471134['callDirection']=_0x6d4510===_0x47a7('0x57')||_0x6d4510===_0x47a7('0x58')?_0x47a7('0x57'):'outbound';var _0x130b2a=util[_0x47a7('0x4c')](_0x47a7('0x59'),_0x73b7fd['serverUrl'],_0x2bd565[_0x47a7('0x5a')],md5(_0x2bd565['uniqueid']));if(_0x7e95c5&&_0x7e95c5[_0x47a7('0x5b')]){logger[_0x47a7('0xe')]('[QUEUE]',_0x47a7('0x5c'));_0x2bd565[_0x47a7('0x5d')]=_0x130b2a;}else if(_0x4fe998&&_0x4fe998['recordingFormat']&&_0x4fe998['recordingFormat']!==_0x47a7('0x5e')){logger[_0x47a7('0xe')]('[OUTBOUND]',_0x47a7('0x5c'));_0x2bd565['recordingURL']=_0x130b2a;}else{_0x2bd565[_0x47a7('0x5d')]='';}return getAdminUser(_0x6d4510,_0x24cd4e,_0x471134,_0x3f2c44,_0x1d269e,_0x276f86)[_0x47a7('0x28')](getUser(_0x6d4510,_0x24cd4e,_0x3f2c44,_0x1d269e,_0x276f86))[_0x47a7('0x28')](getEndUser(_0x6d4510,_0x24cd4e,_0x3f2c44,_0x1d269e,_0x276f86))['then'](getTicket(_0x6d4510,_0x24cd4e,_0x3f2c44,_0x319b89,_0x2bd565,_0x1d269e))[_0x47a7('0x28')](function(_0x157557){logger[_0x47a7('0xe')](util[_0x47a7('0x4c')](_0x47a7('0x5f'),_0x157557[_0x47a7('0x3d')]));logger['info'](util[_0x47a7('0x4c')](_0x47a7('0x60'),_0x6d4510));if(_0x6d4510!==_0x47a7('0x58')){logger[_0x47a7('0xe')]('['+[_0x6d4510[_0x47a7('0xf')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x73b7fd['remoteUri'],_0x3716cc[_0x47a7('0x36')],_0x157557[_0x47a7('0x3d')]);}})['catch'](function(_0x586209){logger[_0x47a7('0x1d')]('['+[_0x6d4510[_0x47a7('0xf')]()]+_0x47a7('0x61'),util[_0x47a7('0x62')](_0x586209,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x150c=['queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','./util','../../../../config/environment','servicenow','redis','defaults','socket.io-emitter','GET','then','result','length','toUpperCase','],\x20getAdminUser\x20crm','catch','message','info','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','adminId','POST','sys_user?','endUserNumber','user','true','System','endUserId','sys_id','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','string','picklist','type','nameField','toLowerCase','toString','includes','variableName','idField','customField','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','label_entry','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','email','destcalleridnum','callDirection'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x150c,0x70));var _0xc150=function(_0x559ba1,_0x559c23){_0x559ba1=_0x559ba1-0x0;var _0x231b83=_0x150c[_0x559ba1];return _0x231b83;};'use strict';var _=require('lodash');var Promise=require(_0xc150('0x0'));var rp=require(_0xc150('0x1'));var util=require(_0xc150('0x2'));var md5=require(_0xc150('0x3'));var Redis=require('ioredis');var intUtil=require(_0xc150('0x4'));var config=require(_0xc150('0x5'));var logger=require('../../../../config/logger')(_0xc150('0x6'));config[_0xc150('0x7')]=_[_0xc150('0x8')](config[_0xc150('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xc150('0x9'))(new Redis(config['redis']));function getAdminUser(_0x5866fb,_0x3b6038,_0x582efd,_0x28cf9f,_0x49df3c,_0x238ad3){return new Promise(function(_0x42fbbc,_0x5a7b15){var _0x3a5e15={'method':_0xc150('0xa'),'uri':_0x28cf9f+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x49df3c+'&'+_0x238ad3,'auth':_0x3b6038,'json':!![]};return rp(_0x3a5e15)[_0xc150('0xb')](function(_0x1754d5){if(_0x1754d5[_0xc150('0xc')][_0xc150('0xd')]>0x0){_0x582efd['adminId']=_0x1754d5[_0xc150('0xc')][0x0]['sys_id'];}logger['info']('['+[_0x5866fb[_0xc150('0xe')]()]+_0xc150('0xf'),_0x582efd);_0x42fbbc(_0x582efd);})[_0xc150('0x10')](function(_0x305043){logger['error']('['+[_0x5866fb[_0xc150('0xe')]()]+']',_0x305043[_0xc150('0x11')]);_0x5a7b15(_0x305043['message']);});});}function getUser(_0x20b2d4,_0x20dcba,_0x31b082,_0x3392ee,_0x6cebdb){return function(_0x362451){logger[_0xc150('0x12')]('['+[_0x20b2d4[_0xc150('0xe')]()]+_0xc150('0x13'),_0x362451);return new Promise(function(_0x17afab,_0x5e87e9){if(intUtil['validateEmail'](_0x362451[_0xc150('0x14')])){var _0x1d3588={'method':_0xc150('0xa'),'uri':_0x31b082+'sys_user?sysparm_query=email%3D'+_0x362451[_0xc150('0x14')]+'&'+_0x3392ee+'&'+_0x6cebdb,'auth':_0x20dcba,'json':!![]};logger[_0xc150('0x12')]('['+[_0x20b2d4[_0xc150('0xe')]()]+_0xc150('0x15'),_0x1d3588);return rp(_0x1d3588)['then'](function(_0x1212ee){logger[_0xc150('0x12')]('['+[_0x20b2d4[_0xc150('0xe')]()]+_0xc150('0x16'),_0x1212ee);if(_0x1212ee[_0xc150('0xc')][_0xc150('0xd')]>0x0&&String(_0x1212ee['result'][0x0][_0xc150('0x17')])==='true'){_0x362451['userId']=_0x1212ee[_0xc150('0xc')][0x0]['sys_id'];}else{_0x362451[_0xc150('0x18')]=_0x362451['adminId'];_0x362451['userEmail']=_0x362451[_0xc150('0x19')];}logger[_0xc150('0x12')]('['+[_0x20b2d4[_0xc150('0xe')]()]+_0xc150('0x1a'),_0x362451);_0x17afab(_0x362451);})[_0xc150('0x10')](function(_0x3e4624){logger[_0xc150('0x1b')]('['+[_0x20b2d4[_0xc150('0xe')]()]+']',_0x3e4624['message']);_0x5e87e9(_0x3e4624[_0xc150('0x11')]);});}else{logger['info']('['+[_0x20b2d4[_0xc150('0xe')]()]+_0xc150('0x1c'));_0x362451['userId']=_0x362451[_0xc150('0x1d')];_0x362451[_0xc150('0x14')]=_0x362451[_0xc150('0x19')];_0x17afab(_0x362451);}});};}function createEndUser(_0x19e014,_0x4292b9,_0x5c2825,_0x365d3f,_0x5e656d){logger[_0xc150('0x12')]('['+[_0x19e014[_0xc150('0xe')]()]+'],\x20createEndUser\x20input\x20crm',_0x5c2825);return new Promise(function(_0x48c39d,_0x13bddd){var _0x4b3b2b={'method':_0xc150('0x1e'),'uri':_0x365d3f+_0xc150('0x1f')+_0x5e656d,'body':{'user_name':_0x5c2825[_0xc150('0x20')],'roles':_0xc150('0x21'),'first_name':_0x5c2825[_0xc150('0x20')],'active':_0xc150('0x22'),'date_format':_0xc150('0x23'),'phone':_0x5c2825['endUserNumber']},'auth':_0x4292b9,'json':!![]};return rp(_0x4b3b2b)[_0xc150('0xb')](function(_0x111b1d){logger[_0xc150('0x12')]('['+[_0x19e014[_0xc150('0xe')]()]+'],\x20EndUser\x20schema',_0x111b1d[_0xc150('0xc')]);_0x5c2825[_0xc150('0x24')]=_0x111b1d['result'][_0xc150('0x25')];_0x48c39d(_0x5c2825);})['catch'](function(_0x68e7ea){logger['error']('['+[_0x19e014[_0xc150('0xe')]()]+']',_0x68e7ea[_0xc150('0x11')]);_0x13bddd(_0x68e7ea['message']);});});}function getEndUser(_0x4f7f82,_0x1b7365,_0x204b1f,_0xa18969,_0x314cb2){return function(_0x5e8d6e){logger[_0xc150('0x12')]('['+[_0x4f7f82[_0xc150('0xe')]()]+'],\x20getEndUser\x20input\x20crm',_0x5e8d6e);return new Promise(function(_0x4115e8,_0x3d3429){var _0x102762={'method':_0xc150('0xa'),'uri':_0x204b1f+_0xc150('0x26')+_0x5e8d6e[_0xc150('0x20')]+'&'+_0xa18969+'&'+_0x314cb2,'auth':_0x1b7365,'json':!![]};return rp(_0x102762)[_0xc150('0xb')](function(_0xab6b2a){if(_0xab6b2a['result']['length']>0x0){_0x5e8d6e['endUserId']=_0xab6b2a['result'][0x0][_0xc150('0x25')];logger[_0xc150('0x12')]('['+[_0x4f7f82[_0xc150('0xe')]()]+_0xc150('0x27'),_0x5e8d6e);_0x4115e8(_0x5e8d6e);}else{return createEndUser(_0x4f7f82,_0x1b7365,_0x5e8d6e,_0x204b1f,_0xa18969)[_0xc150('0xb')](function(_0x112763){logger[_0xc150('0x12')]('['+[_0x4f7f82[_0xc150('0xe')]()]+'],\x20createEndUser\x20crm',_0x112763);_0x4115e8(_0x112763);});}})[_0xc150('0x10')](function(_0x4d785a){logger[_0xc150('0x1b')]('['+[_0x4f7f82[_0xc150('0xe')]()]+']',_0x4d785a[_0xc150('0x11')]);_0x3d3429(_0x4d785a['message']);});});};}function getCustomFields(_0x4041ad,_0x13d04f){var _0x17eadc={};if(_0x4041ad['length']>0x0){_[_0xc150('0x28')](_0x4041ad,function(_0x119c9b){if(_['includes']([_0xc150('0x29'),_0xc150('0x2a')],_0x119c9b[_0xc150('0x2b')])&&_0x119c9b[_0xc150('0x2c')]&&!_0x119c9b['customField']){_0x17eadc[_0x119c9b[_0xc150('0x2c')][_0xc150('0x2d')]()]=_0x119c9b['content'][_0xc150('0x2e')]();}else if(_[_0xc150('0x2f')]([_0xc150('0x29'),'picklist'],_0x119c9b[_0xc150('0x2b')])&&_0x119c9b['idField']&&_0x119c9b['customField']){_0x17eadc[_0x119c9b['idField'][_0xc150('0x2d')]()]=_0x119c9b['content'][_0xc150('0x2e')]();}else if(_0x119c9b['type']==='variable'&&_0x119c9b[_0xc150('0x30')]&&_0x119c9b[_0xc150('0x31')]&&_0x119c9b[_0xc150('0x32')]){_0x17eadc[_0x119c9b[_0xc150('0x31')]['toLowerCase']()]=_0x13d04f[_0x119c9b[_0xc150('0x30')]]['toString']();}else if(_0x119c9b[_0xc150('0x2b')]===_0xc150('0x33')&&_0x119c9b[_0xc150('0x34')]&&_0x119c9b[_0xc150('0x34')][_0xc150('0x35')]&&_0x119c9b['idField']&&_0x119c9b[_0xc150('0x32')]){_0x17eadc[_0x119c9b[_0xc150('0x31')][_0xc150('0x2d')]()]=_0x13d04f[_0x119c9b[_0xc150('0x34')][_0xc150('0x35')]['toLowerCase']()][_0xc150('0x2e')]();}});}return _0x17eadc;}function getTicket(_0x1e10f1,_0x11deea,_0x4b178d,_0x1dd6b3,_0x4771b9,_0x482140){return function(_0x1db0cd){logger[_0xc150('0x12')]('['+[_0x1e10f1[_0xc150('0xe')]()]+_0xc150('0x36'),_0x1db0cd);return new Promise(function(_0x3a6634,_0x31f633){var _0x302715=_0x1e10f1[_0xc150('0x2d')]()===_0xc150('0x37')?_0x1db0cd[_0xc150('0x18')]:_0x1db0cd[_0xc150('0x24')];var _0x1dbee2={'method':'POST','uri':_0x4b178d+_0xc150('0x38')+'?'+_0x482140,'body':Object[_0xc150('0x39')]({},{'active':_0xc150('0x22'),'caller_id':_0x302715,'assigned_to':_0x1db0cd[_0xc150('0x18')],'short_description':intUtil[_0xc150('0x3a')](_0x1dd6b3[_0xc150('0x3b')],_0x4771b9,'\x20'),'description':intUtil[_0xc150('0x3a')](_0x1dd6b3['Descriptions'],_0x4771b9,'\x0a')},getCustomFields(_0x1dd6b3[_0xc150('0x3c')],_0x4771b9)),'auth':_0x11deea,'json':!![]};return rp(_0x1dbee2)[_0xc150('0xb')](function(_0x57bca3){logger[_0xc150('0x12')]('['+[_0x1e10f1[_0xc150('0xe')]()]+_0xc150('0x3d'),_0x57bca3['result']);_0x1db0cd[_0xc150('0x3e')]=_0x57bca3[_0xc150('0xc')][_0xc150('0x25')];_0x1db0cd[_0xc150('0x3f')]=_0x57bca3['result'][_0xc150('0x40')];logger[_0xc150('0x12')]('['+[_0x1e10f1[_0xc150('0xe')]()]+']\x20getTicket\x20crm',_0x1db0cd);_0x3a6634(_0x1db0cd);})[_0xc150('0x10')](function(_0xa7d85c){logger['error']('['+[_0x1e10f1[_0xc150('0xe')]()]+']',_0xa7d85c[_0xc150('0x11')]);_0x31f633(_0xa7d85c['message']);});});};}function createRemoteTag(_0x92a91e,_0x9d7205,_0x4d7a51,_0x121703){return new Promise(function(_0x4c37a4,_0x1dcd91){var _0x55e350={'method':_0xc150('0x1e'),'uri':_0x4d7a51+_0xc150('0x41')+'?'+_0x121703,'body':{'short_description':_0x92a91e,'global':!![],'active':!![],'name':_0x92a91e},'auth':_0x9d7205,'json':!![]};return rp(_0x55e350)[_0xc150('0xb')](function(_0x456c32){var _0x50188d=_0x456c32['result'][_0xc150('0x25')];_0x4c37a4(_0x50188d);});});}function getRemoteTag(_0x1599d8,_0x7f3633,_0x286777,_0x5362af,_0x3d4808){return new Promise(function(_0xf69623,_0x5416f7){var _0x4763f7={'method':_0xc150('0xa'),'uri':_0x286777+_0xc150('0x41')+'?sysparm_query=name%3D'+_0x1599d8+'&'+_0x5362af,'auth':_0x7f3633,'json':!![]};return rp(_0x4763f7)['then'](function(_0x27c12a){if(_0x27c12a[_0xc150('0xc')][_0xc150('0xd')]>0x0){var _0x152bd4=_0x27c12a['result'][0x0][_0xc150('0x25')];_0xf69623(_0x152bd4);}else{return createRemoteTag(_0x1599d8,_0x7f3633,_0x286777,_0x5362af)[_0xc150('0xb')](function(_0x705eeb){_0xf69623(_0x705eeb);});}});});}function assignTagToIncident(_0x5103f7,_0x40ab26,_0x1473f5,_0x4dd627,_0x275db0){return new Promise(function(_0xb471b,_0x44ddcc){var _0x1ae1a6={'method':'POST','uri':_0x1473f5+_0xc150('0x42')+'?'+_0x275db0,'body':{'label':_0x5103f7,'table':'incident','id_type':_0xc150('0x43'),'table_key':_0x4dd627[_0xc150('0x3e')],'title':_0xc150('0x44')+_0x4dd627[_0xc150('0x3f')],'id_display':_0x4dd627['ticketNumber']},'auth':_0x40ab26,'json':!![]};return rp(_0x1ae1a6)[_0xc150('0xb')](function(_0x42e21b){_0xb471b();})[_0xc150('0x10')](function(){_0xb471b();});});}function manageTags(_0x3d5a14,_0x1ca5be,_0x39d0e4,_0x2490b8,_0x12e094,_0x5fdd05,_0x349354){return new Promise(function(_0xab73f2,_0x4bfee6){var _0x4c0c47=[];_0x1ca5be[_0xc150('0x28')](function(_0x4126ee){_0x4c0c47['push'](getRemoteTag(_0x4126ee,_0x39d0e4,_0x2490b8,_0x5fdd05,_0x349354));});return Promise[_0xc150('0x45')](_0x4c0c47)[_0xc150('0xb')](function(_0x1f4310){if(_0x1f4310[_0xc150('0xd')]){logger[_0xc150('0x12')]('['+[_0x3d5a14['toUpperCase']()]+_0xc150('0x46'),_0x1f4310);var _0x462dfc=[];_0x1f4310[_0xc150('0x28')](function(_0x15b3ba){_0x462dfc[_0xc150('0x47')](assignTagToIncident(_0x15b3ba,_0x39d0e4,_0x2490b8,_0x12e094,_0x5fdd05));});return Promise[_0xc150('0x45')](_0x462dfc)[_0xc150('0xb')](function(){_0xab73f2();})[_0xc150('0x10')](function(){_0xab73f2();});}else{_0xab73f2();}});});}function getTags(_0x50d6c8,_0x3bcebc,_0x112d6f,_0x2c210,_0x4d51fe,_0x4ebe39){return function(_0x4182b6){return new Promise(function(_0x2f58b8,_0xe7dbca){var _0x4bdd34=[];var _0x36f0dc=_0x2c210[_0xc150('0x48')];if(_0x36f0dc&&_0x36f0dc[_0xc150('0xd')]>0x0){_0x4bdd34=_['map'](_0x36f0dc,_0xc150('0x35'));}if(_0x4bdd34['length']>0x0){return manageTags(_0x50d6c8,_0x4bdd34,_0x3bcebc,_0x112d6f,_0x4182b6,_0x4d51fe,_0x4ebe39)[_0xc150('0xb')](function(){_0x2f58b8(_0x4182b6);});}else{_0x2f58b8(_0x4182b6);}});};}function emit(_0x142a7d,_0x2b9ed1,_0x276c8a){var _0x1c78f5=_0xc150('0x49')+_0xc150('0x4a')+_0xc150('0x4b')+_0xc150('0x4c');var _0x346327={'uri':_0x142a7d+_0xc150('0x4d')+_0x276c8a+_0x1c78f5};io['to'](util[_0xc150('0x4e')](_0xc150('0x4f'),_0x2b9ed1))[_0xc150('0x50')](_0xc150('0x51'),_0x346327);}exports['cs']=function(_0x1f278e,_0x5ec413,_0x279fc1,_0x1033e7,_0x50c63e,_0x412acd,_0x52570c,_0x1b6493){var _0x55a129={};var _0x4cb544={'user':_0x412acd['username'],'pass':_0x412acd[_0xc150('0x52')]};var _0x25e168=_0xc150('0x53');var _0x3870fe='sysparm_display_value=true';_0x412acd[_0xc150('0x54')]=intUtil[_0xc150('0x55')](_0x412acd[_0xc150('0x54')]);_0x412acd[_0xc150('0x56')]=intUtil['stripTrailingSlash'](_0x412acd[_0xc150('0x56')]);var _0x1b54fa=util['format']('%s/api/now/table/',_0x412acd[_0xc150('0x54')]);_0x55a129['userEmail']=!_['isNil'](_0x1033e7)?_0x1033e7[_0xc150('0x57')]:null;_0x55a129[_0xc150('0x19')]=_0x412acd[_0xc150('0x57')];_0x55a129[_0xc150('0x20')]=_0x1b6493[_0xc150('0x2d')]()===_0xc150('0x37')?_0x5ec413[_0xc150('0x58')]:_0x5ec413['calleridnum'];_0x55a129[_0xc150('0x59')]=_0x1b6493===_0xc150('0x5a')||_0x1b6493===_0xc150('0x5b')?'queue':'outbound';var _0x5249a5=util['format'](_0xc150('0x5c'),_0x412acd[_0xc150('0x56')],_0x5ec413['uniqueid'],md5(_0x5ec413['uniqueid']));if(_0x50c63e&&_0x50c63e['monitor_format']){logger[_0xc150('0x12')](_0xc150('0x5d'),_0xc150('0x5e'));_0x5ec413[_0xc150('0x5f')]=_0x5249a5;}else if(_0x52570c&&_0x52570c[_0xc150('0x60')]&&_0x52570c[_0xc150('0x60')]!=='none'){logger['info']('[OUTBOUND]',_0xc150('0x5e'));_0x5ec413[_0xc150('0x5f')]=_0x5249a5;}else{_0x5ec413[_0xc150('0x5f')]='';}return getAdminUser(_0x1b6493,_0x4cb544,_0x55a129,_0x1b54fa,_0x3870fe,_0x25e168)[_0xc150('0xb')](getUser(_0x1b6493,_0x4cb544,_0x1b54fa,_0x3870fe,_0x25e168))['then'](getEndUser(_0x1b6493,_0x4cb544,_0x1b54fa,_0x3870fe,_0x25e168))[_0xc150('0xb')](getTicket(_0x1b6493,_0x4cb544,_0x1b54fa,_0x279fc1,_0x5ec413,_0x3870fe))[_0xc150('0xb')](function(_0x52c60d){logger['info'](util[_0xc150('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x52c60d[_0xc150('0x3e')]));logger[_0xc150('0x12')](util[_0xc150('0x4e')](_0xc150('0x61'),_0x1b6493));if(_0x1b6493!==_0xc150('0x5b')){logger['info']('['+[_0x1b6493[_0xc150('0xe')]()]+']',_0xc150('0x62'));emit(_0x412acd[_0xc150('0x54')],_0x1033e7[_0xc150('0x35')],_0x52c60d[_0xc150('0x3e')]);}})[_0xc150('0x10')](function(_0x3aa833){logger[_0xc150('0x1b')]('['+[_0x1b6493[_0xc150('0xe')]()]+_0xc150('0x63'),util[_0xc150('0x64')](_0x3aa833,{'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 374320a..0fa0d39 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 _0x1787=['Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','contacts','version','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','The\x20Ticket\x20ID\x20is:','users','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','unmanaged','lastevent','toUpperCase','Inbound','catch','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','created_by','description','getString','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_type','Contacts','direction','forEach','push','variableName','set_entry','JSON','stringify','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','idField','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration'];(function(_0x8f0461,_0x1f51c5){var _0xddaff4=function(_0x31b14c){while(--_0x31b14c){_0x8f0461['push'](_0x8f0461['shift']());}};_0xddaff4(++_0x1f51c5);}(_0x1787,0xa2));var _0x7178=function(_0x1ba102,_0x3294f0){_0x1ba102=_0x1ba102-0x0;var _0x346930=_0x1787[_0x1ba102];return _0x346930;};'use strict';var _=require(_0x7178('0x0'));var rp=require(_0x7178('0x1'));var BPromise=require(_0x7178('0x2'));var md5=require('md5');var util=require(_0x7178('0x3'));var Redis=require(_0x7178('0x4'));var intUtil=require(_0x7178('0x5'));var config=require(_0x7178('0x6'));var logger=require(_0x7178('0x7'))('sugarcrm');config[_0x7178('0x8')]=_['defaults'](config['redis'],{'host':_0x7178('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7178('0x8')]));var def={'method':_0x7178('0xa'),'json':!![]};function emit(_0x17241c,_0xdeed30,_0x450597){io['to'](_0x17241c)[_0x7178('0xb')](_0xdeed30,_0x450597);}function getTicket(_0x222616,_0x1f2691,_0xd1c600,_0x4b9211,_0x3406a1,_0x3b886c,_0x524b95,_0x205357){logger[_0x7178('0xc')](_0x7178('0xd'));var _0x25cfb0=new Date();var _0x15e0d1=[{'name':_0x7178('0xe'),'value':intUtil['getString'](_0x4b9211[_0x7178('0xf')],_0x3406a1,'\x20')},{'name':'assigned_user_id','value':_0x1f2691['id']},{'name':_0x7178('0x10'),'value':_0x1f2691['id']},{'name':_0x7178('0x11'),'value':intUtil[_0x7178('0x12')](_0x4b9211[_0x7178('0x13')],_0x3406a1,'\x0a')},{'name':_0x7178('0x14'),'value':_0x25cfb0[_0x7178('0x15')]()['slice'](0x0,0x13)[_0x7178('0x16')]('T','\x20')},{'name':_0x7178('0x17'),'value':'0'},{'name':_0x7178('0x18'),'value':'15'},{'name':'parent_id','value':_0xd1c600['id']},{'name':_0x7178('0x19'),'value':_0x7178('0x1a')},{'name':'parent_name','value':_0xd1c600[_0x7178('0xe')]},{'name':_0x7178('0x1b'),'value':_0x205357}];if(_0x3b886c['length']){_[_0x7178('0x1c')](_0x3b886c,function(_0x2afce4){if(_0x3406a1[_0x2afce4['variableName']]){_0x15e0d1[_0x7178('0x1d')]({'name':_0x2afce4['idField'],'value':_0x3406a1[_0x2afce4[_0x7178('0x1e')]]});}});}return request({'form':{'method':_0x7178('0x1f'),'input_type':_0x7178('0x20'),'response_type':_0x7178('0x20'),'rest_data':JSON[_0x7178('0x21')]({'session':_0x524b95['id'],'module_name':'Calls','name_value_list':_0x15e0d1})}});}function getAuth(_0x31f26b){return util['format']('Basic\x20%s',new Buffer(_0x31f26b['apiKey']+':X')[_0x7178('0x22')](_0x7178('0x23')));}function getServerInfo(_0x2dce34){return request({'form':{'method':_0x7178('0x24'),'input_type':_0x7178('0x20'),'response_type':_0x7178('0x20'),'rest_data':JSON[_0x7178('0x21')]({'session':_0x2dce34['id']})}});}function getUser(_0x24adc8,_0x7d73cc,_0x51d00d){if(!_[_0x7178('0x25')](_0x7d73cc)){logger['info'](_0x7178('0x26'),_0x7d73cc);return request({'form':{'method':'get_entry_list','input_type':_0x7178('0x20'),'response_type':_0x7178('0x20'),'rest_data':JSON['stringify']({'session':_0x51d00d['id'],'module_name':_0x7178('0x27'),'query':util[_0x7178('0x28')](_0x7178('0x29'),_0x7d73cc),'order_by':'','offset':'0','select_fields':['id','name',_0x7178('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7178('0x2b')](function(_0x1501d5){if(_0x1501d5[_0x7178('0x2c')]['length']){var _0x54036b=_[_0x7178('0x2d')](_0x1501d5[_0x7178('0x2c')],function(_0x37ed42){return _0x37ed42[_0x7178('0x2e')]['user_name'][_0x7178('0x2f')]===_0x7d73cc;});if(_0x54036b){logger['info'](_0x7178('0x30'));return BPromise[_0x7178('0x31')]({'id':_0x54036b[_0x7178('0x2e')]['id'][_0x7178('0x2f')],'name':_0x54036b['name_value_list']['name'][_0x7178('0x2f')]});}}logger[_0x7178('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x7178('0x31')]({'id':_0x51d00d[_0x7178('0x2e')][_0x7178('0x32')]['value'],'name':_0x51d00d[_0x7178('0x2e')]['user_name'][_0x7178('0x2f')]});});}else{logger['info'](_0x7178('0x33'));return BPromise[_0x7178('0x31')]({'id':_0x51d00d['name_value_list'][_0x7178('0x32')][_0x7178('0x2f')],'name':_0x51d00d[_0x7178('0x2e')][_0x7178('0x2a')][_0x7178('0x2f')]});}}function getEndUser(_0x1682ce,_0x15b747,_0xc9db92,_0x195d76){logger[_0x7178('0xc')](_0x7178('0x34'),_0xc9db92);return request({'form':{'method':_0x7178('0x35'),'input_type':_0x7178('0x20'),'response_type':'JSON','rest_data':JSON[_0x7178('0x21')]({'session':_0x195d76['id'],'module_name':_0x7178('0x1a'),'query':util[_0x7178('0x28')](_0x7178('0x36'),_0xc9db92),'order_by':'','offset':'0','select_fields':['id',_0x7178('0xe'),_0x7178('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3aada8){if(_0x3aada8[_0x7178('0x2c')][_0x7178('0x38')]){var _0x18638c=_[_0x7178('0x2d')](_0x3aada8[_0x7178('0x2c')],function(_0x393d84){return _0x393d84['name_value_list']['phone_home']['value']===_0xc9db92;});if(_0x18638c){logger[_0x7178('0xc')](_0x7178('0x39'));return BPromise['resolve']({'id':_0x18638c[_0x7178('0x2e')]['id'][_0x7178('0x2f')],'name':_0x18638c[_0x7178('0x2e')][_0x7178('0xe')][_0x7178('0x2f')],'phone':_0x18638c['name_value_list'][_0x7178('0x37')][_0x7178('0x2f')]});}}else{logger[_0x7178('0xc')](_0x7178('0x3a'));return request({'form':{'method':_0x7178('0x1f'),'input_type':_0x7178('0x20'),'response_type':_0x7178('0x20'),'rest_data':JSON[_0x7178('0x21')]({'session':_0x195d76['id'],'module_name':_0x7178('0x1a'),'name_value_list':[{'name':_0x7178('0x3b'),'value':_0x15b747!==_0x7178('0x3c')?_0x15b747:util[_0x7178('0x28')](_0x7178('0x3d'),_0xc9db92)},{'name':_0x7178('0x37'),'value':_0xc9db92}]})}})[_0x7178('0x2b')](function(_0x477a5b){logger['info'](_0x7178('0x3e'));return BPromise[_0x7178('0x31')]({'id':_0x477a5b['id'],'name':_0x477a5b[_0x7178('0x2c')][_0x7178('0x3b')]['value'],'phone':_0x477a5b[_0x7178('0x2c')][_0x7178('0x37')][_0x7178('0x2f')]});});}});}function request(_0x38f6a4){logger[_0x7178('0x3f')]('[HTTP]',JSON[_0x7178('0x21')](_0x38f6a4));return rp(_[_0x7178('0x40')](def,_0x38f6a4));}function getTags(_0x193fea,_0x12abf7){var _0x4f28ec=[];if(_0x193fea&&_0x193fea['length']>0x0){_0x4f28ec=_[_0x7178('0x41')](_0x193fea,_0x12abf7);}return _0x4f28ec;}function getCustomFields(_0x48bfbc,_0x3a8624){var _0x216acf=[];var _0x15d334={'custom_fields':[]};if(_0x48bfbc[_0x7178('0x38')]>0x0){_[_0x7178('0x1c')](_0x48bfbc,function(_0x73fda8){if(_0x73fda8[_0x7178('0x42')]===_0x7178('0x43')&&_0x73fda8[_0x7178('0x44')]&&!_0x73fda8[_0x7178('0x45')]){_0x15d334[_0x73fda8[_0x7178('0x44')][_0x7178('0x46')]()]=_0x73fda8[_0x7178('0x47')]['toString']();}else if(_0x73fda8['type']===_0x7178('0x43')&&_0x73fda8['idField']&&_0x73fda8['customField']){_0x15d334[_0x7178('0x48')][_0x7178('0x1d')]({'id':_0x73fda8[_0x7178('0x49')],'value':_0x73fda8[_0x7178('0x47')]['toString']()});}else if(_0x73fda8['type']===_0x7178('0x4a')&&_0x73fda8[_0x7178('0x1e')]&&_0x73fda8[_0x7178('0x49')]&&_0x73fda8[_0x7178('0x45')]){_0x3a8624[_0x73fda8[_0x7178('0x1e')]]&&_0x15d334[_0x7178('0x48')][_0x7178('0x1d')]({'id':_0x73fda8[_0x7178('0x49')],'value':_0x3a8624[_0x73fda8['variableName']][_0x7178('0x22')]()});}else if(_0x73fda8['type']===_0x7178('0x4b')&&_0x73fda8[_0x7178('0x4c')]&&_0x73fda8[_0x7178('0x4c')]['name']&&_0x73fda8[_0x7178('0x49')]&&_0x73fda8['customField']){_0x3a8624[_0x73fda8[_0x7178('0x4c')][_0x7178('0xe')][_0x7178('0x46')]()]&&_0x15d334[_0x7178('0x48')][_0x7178('0x1d')]({'id':_0x73fda8['idField'],'value':_0x3a8624[_0x73fda8[_0x7178('0x4c')][_0x7178('0xe')][_0x7178('0x46')]()]['toString']()});}});}return _0x15d334;}function getConnection(_0x3546aa){return request({'method':_0x7178('0xa'),'form':{'method':_0x7178('0x4d'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3546aa[_0x7178('0x4e')],'password':_0x3546aa[_0x7178('0x4f')],'encryption':_0x7178('0x50')},'application':_0x7178('0x51')})}})[_0x7178('0x2b')](function(_0x80e68f){var _0x5a7c66=_0x80e68f;if(_0x5a7c66['id']){def['sessionID']=_0x5a7c66['id'];return BPromise['resolve'](_0x5a7c66);}else{throw new Error(util['format'](_0x7178('0x52'),_0x3546aa['id']));}});}function setRelationship(_0x1b209a,_0x37c003,_0xc80fd5,_0x15ef6e){return request({'form':{'method':_0x7178('0x53'),'input_type':'JSON','response_type':_0x7178('0x20'),'rest_data':JSON['stringify']({'session':_0x1b209a['id'],'module_name':_0x7178('0x54'),'module_id':_0xc80fd5['id'],'link_field_name':_0x15ef6e,'related_ids':[_0x37c003['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x5c4402,_0x3f8438,_0x46d8be,_0x3676f3,_0x7e2fc,_0x255119){var _0x163ed3,_0x316572,_0x3a79c3,_0x43426d;_0x255119[_0x7178('0x55')]=intUtil[_0x7178('0x56')](_0x255119[_0x7178('0x55')]);_0x255119['serverUrl']=intUtil['stripTrailingSlash'](_0x255119['serverUrl']);def[_0x7178('0x57')]=util['format'](_0x7178('0x58'),_0x255119['remoteUri']);if(_0x7e2fc&&_0x7e2fc[_0x7178('0x59')]){logger[_0x7178('0xc')](_0x7178('0x5a'),'Recording\x20is\x20enabled!');_0x3f8438[_0x7178('0x5b')]=util[_0x7178('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x255119['serverUrl'],_0x3f8438[_0x7178('0x5c')],md5(_0x3f8438[_0x7178('0x5c')]));}else{_0x3f8438['recordingURL']='';}return getConnection(_0x255119)[_0x7178('0x2b')](function(_0x1da897){_0x43426d=_0x1da897;return getUser(_0x255119,_0x3676f3[_0x7178('0xe')],_0x43426d);})[_0x7178('0x2b')](function(_0x24f76b){_0x163ed3=_0x24f76b;logger[_0x7178('0xc')](_0x7178('0x5d'),_0x163ed3['id']);return getEndUser(_0x255119,_0x3f8438[_0x7178('0x5e')],_0x3f8438[_0x7178('0x5f')],_0x43426d);})[_0x7178('0x2b')](function(_0x1e098){_0x316572=_0x1e098;logger['info'](_0x7178('0x60'),_0x316572['id']);return getTicket(_0x255119,_0x163ed3,_0x316572,_0x46d8be,_0x3f8438,_0x46d8be[_0x7178('0x61')],_0x43426d,'Inbound');})[_0x7178('0x2b')](function(_0xefceee){_0x3a79c3=_0xefceee;logger[_0x7178('0xc')](_0x7178('0x62'));logger[_0x7178('0xc')]('The\x20Ticket\x20ID\x20is:',_0x3a79c3['id']);return setRelationship(_0x43426d,_0x163ed3,_0x3a79c3,'users');})[_0x7178('0x2b')](function(){return setRelationship(_0x43426d,_0x316572,_0x3a79c3,_0x7178('0x63'));})[_0x7178('0x2b')](function(){return getServerInfo(_0x43426d);})[_0x7178('0x2b')](function(_0x20f8a0){var _0x39fdce=parseInt(_0x20f8a0[_0x7178('0x64')][_0x7178('0x65')](0x0));var _0x52cf8e=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x255119['remoteUri'],_0x3a79c3['id']);if(_0x39fdce>0x6){_0x52cf8e=util[_0x7178('0x28')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x255119['remoteUri'],_0x3a79c3['id']);}logger[_0x7178('0xc')](_0x7178('0x5a'),_0x7178('0x66'));emit(util['format']('user:%s',_0x3676f3['name']),_0x7178('0x67'),{'uri':_0x52cf8e});})['catch'](function(_0x352ef0){logger[_0x7178('0x68')]('[QUEUE]',JSON[_0x7178('0x21')](_0x352ef0));});};exports[_0x7178('0x69')]=function(_0x31be08,_0xd761eb,_0x2b1e30,_0x3b23c8,_0x3e5cd3,_0x29f768,_0x563132){var _0x1989cb,_0x4ea9a4,_0x119bb5,_0x3efcbe;_0x29f768['remoteUri']=intUtil[_0x7178('0x56')](_0x29f768[_0x7178('0x55')]);_0x29f768[_0x7178('0x6a')]=intUtil['stripTrailingSlash'](_0x29f768[_0x7178('0x6a')]);def[_0x7178('0x57')]=util[_0x7178('0x28')]('%s/service/v4_1/rest.php',_0x29f768['remoteUri']);if(_0x563132&&_0x563132[_0x7178('0x6b')]&&_0x563132[_0x7178('0x6b')]!==_0x7178('0x6c')){logger['info'](_0x7178('0x6d'),_0x7178('0x6e'));_0xd761eb[_0x7178('0x5b')]=util[_0x7178('0x28')](_0x7178('0x6f'),_0x29f768['serverUrl'],_0xd761eb[_0x7178('0x5c')],md5(_0xd761eb[_0x7178('0x5c')]));}return getConnection(_0x29f768)[_0x7178('0x2b')](function(_0x46709c){_0x3efcbe=_0x46709c;return getUser(_0x29f768,_0x3b23c8[_0x7178('0xe')],_0x3efcbe);})['then'](function(_0x3257e2){_0x1989cb=_0x3257e2;logger[_0x7178('0xc')](_0x7178('0x5d'),_0x1989cb['id']);return getEndUser(_0x29f768,_0xd761eb[_0x7178('0x70')],_0xd761eb['destcalleridnum'],_0x3efcbe);})['then'](function(_0x22e98d){_0x4ea9a4=_0x22e98d;logger[_0x7178('0xc')](_0x7178('0x60'),_0x4ea9a4['id']);return getTicket(_0x29f768,_0x1989cb,_0x4ea9a4,_0x2b1e30,_0xd761eb,_0x2b1e30[_0x7178('0x61')],_0x3efcbe,'Outbound');})[_0x7178('0x2b')](function(_0x3f1226){_0x119bb5=_0x3f1226;logger[_0x7178('0xc')](_0x7178('0x62'));logger[_0x7178('0xc')](_0x7178('0x71'),_0x119bb5['id']);return setRelationship(_0x3efcbe,_0x1989cb,_0x119bb5,_0x7178('0x72'));})['then'](function(){return setRelationship(_0x3efcbe,_0x4ea9a4,_0x119bb5,'contacts');})[_0x7178('0x2b')](function(){return getServerInfo(_0x3efcbe);})[_0x7178('0x2b')](function(_0x3e17a5){var _0xa3df6e=parseInt(_0x3e17a5[_0x7178('0x64')][_0x7178('0x65')](0x0));var _0x3f07a7=util[_0x7178('0x28')](_0x7178('0x73'),_0x29f768['remoteUri'],_0x119bb5['id']);if(_0xa3df6e>0x6){_0x3f07a7=util[_0x7178('0x28')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x29f768[_0x7178('0x55')],_0x119bb5['id']);}logger['info'](_0x7178('0x6d'),_0x7178('0x66'));emit(util[_0x7178('0x28')](_0x7178('0x74'),_0x3b23c8['name']),_0x7178('0x67'),{'uri':_0x3f07a7});})['catch'](function(_0x4567fc){logger[_0x7178('0x68')](_0x7178('0x6d'),JSON['stringify'](_0x4567fc));});};exports[_0x7178('0x75')]=function(_0x502961,_0x5145d4,_0x319a9b,_0x1d290d,_0x2fa2d2,_0x478970){var _0x58e4a7,_0x3595dc,_0x53ebe9,_0x3ea7aa;_0x478970['remoteUri']=intUtil[_0x7178('0x56')](_0x478970[_0x7178('0x55')]);_0x478970[_0x7178('0x6a')]=intUtil[_0x7178('0x56')](_0x478970[_0x7178('0x6a')]);def[_0x7178('0x57')]=util[_0x7178('0x28')](_0x7178('0x58'),_0x478970['remoteUri']);if(_0x2fa2d2&&_0x2fa2d2[_0x7178('0x59')]){logger[_0x7178('0xc')]('['+_0x5145d4[_0x7178('0x76')][_0x7178('0x77')]()+']',_0x7178('0x6e'));_0x5145d4[_0x7178('0x5b')]=util[_0x7178('0x28')](_0x7178('0x6f'),_0x478970[_0x7178('0x6a')],_0x5145d4['uniqueid'],md5(_0x5145d4[_0x7178('0x5c')]));}else{_0x5145d4[_0x7178('0x5b')]='';}return getConnection(_0x478970)[_0x7178('0x2b')](function(_0x252a48){_0x3ea7aa=_0x252a48;if(!_[_0x7178('0x25')](_0x1d290d)){return getUser(_0x478970,_0x1d290d['name'],_0x3ea7aa);}else{return getUser(_0x478970,null,_0x3ea7aa);}})[_0x7178('0x2b')](function(_0x1875f2){_0x58e4a7=_0x1875f2;logger[_0x7178('0xc')]('The\x20User\x20ID\x20is:',_0x58e4a7['id']);return getEndUser(_0x478970,_0x5145d4[_0x7178('0x5e')],_0x5145d4[_0x7178('0x5f')],_0x3ea7aa);})['then'](function(_0x160a43){_0x3595dc=_0x160a43;logger[_0x7178('0xc')](_0x7178('0x60'),_0x3595dc['id']);return getTicket(_0x478970,_0x58e4a7,_0x3595dc,_0x319a9b,_0x5145d4,_0x319a9b[_0x7178('0x61')],_0x3ea7aa,_0x7178('0x78'));})[_0x7178('0x2b')](function(_0x3e4c62){_0x53ebe9=_0x3e4c62;logger[_0x7178('0xc')](_0x7178('0x62'));logger[_0x7178('0xc')](_0x7178('0x71'),_0x53ebe9['id']);return setRelationship(_0x3ea7aa,_0x58e4a7,_0x53ebe9,_0x7178('0x72'));})[_0x7178('0x2b')](function(){return setRelationship(_0x3ea7aa,_0x3595dc,_0x53ebe9,_0x7178('0x63'));})[_0x7178('0x2b')](function(){return getServerInfo(_0x3ea7aa);})[_0x7178('0x79')](function(_0x554e74){logger[_0x7178('0x68')]('['+_0x5145d4['lastevent'][_0x7178('0x77')]()+']',JSON[_0x7178('0x21')](_0x554e74));});}; \ No newline at end of file +var _0x807d=['name','Subjects','created_by','description','getString','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','custom_fields','content','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','[QUEUE]','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','defaults','localhost','socket.io-emitter','redis','POST','emit','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x807d,0x6e));var _0xd807=function(_0x504e9c,_0x579212){_0x504e9c=_0x504e9c-0x0;var _0x2d5546=_0x807d[_0x504e9c];return _0x2d5546;};'use strict';var _=require(_0xd807('0x0'));var rp=require(_0xd807('0x1'));var BPromise=require(_0xd807('0x2'));var md5=require(_0xd807('0x3'));var util=require(_0xd807('0x4'));var Redis=require(_0xd807('0x5'));var intUtil=require(_0xd807('0x6'));var config=require('../../../../config/environment');var logger=require(_0xd807('0x7'))(_0xd807('0x8'));config['redis']=_[_0xd807('0x9')](config['redis'],{'host':_0xd807('0xa'),'port':0x18eb});var io=require(_0xd807('0xb'))(new Redis(config[_0xd807('0xc')]));var def={'method':_0xd807('0xd'),'json':!![]};function emit(_0x1a35cb,_0x46476d,_0x2ad898){io['to'](_0x1a35cb)[_0xd807('0xe')](_0x46476d,_0x2ad898);}function getTicket(_0x2ce8ef,_0x207000,_0x5cce17,_0x1ae9f2,_0x4a1c06,_0x6bb15,_0x4b69df,_0x5f1d7a){logger[_0xd807('0xf')]('Creating\x20new\x20ticket...');var _0x4c56a5=new Date();var _0x58e0c0=[{'name':_0xd807('0x10'),'value':intUtil['getString'](_0x1ae9f2[_0xd807('0x11')],_0x4a1c06,'\x20')},{'name':'assigned_user_id','value':_0x207000['id']},{'name':_0xd807('0x12'),'value':_0x207000['id']},{'name':_0xd807('0x13'),'value':intUtil[_0xd807('0x14')](_0x1ae9f2[_0xd807('0x15')],_0x4a1c06,'\x0a')},{'name':_0xd807('0x16'),'value':_0x4c56a5[_0xd807('0x17')]()[_0xd807('0x18')](0x0,0x13)[_0xd807('0x19')]('T','\x20')},{'name':_0xd807('0x1a'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xd807('0x1b'),'value':_0x5cce17['id']},{'name':_0xd807('0x1c'),'value':_0xd807('0x1d')},{'name':'parent_name','value':_0x5cce17[_0xd807('0x10')]},{'name':_0xd807('0x1e'),'value':_0x5f1d7a}];if(_0x6bb15[_0xd807('0x1f')]){_[_0xd807('0x20')](_0x6bb15,function(_0x15d52c){if(_0x4a1c06[_0x15d52c[_0xd807('0x21')]]){_0x58e0c0[_0xd807('0x22')]({'name':_0x15d52c[_0xd807('0x23')],'value':_0x4a1c06[_0x15d52c[_0xd807('0x21')]]});}});}return request({'form':{'method':_0xd807('0x24'),'input_type':_0xd807('0x25'),'response_type':_0xd807('0x25'),'rest_data':JSON[_0xd807('0x26')]({'session':_0x4b69df['id'],'module_name':_0xd807('0x27'),'name_value_list':_0x58e0c0})}});}function getAuth(_0x506c63){return util[_0xd807('0x28')](_0xd807('0x29'),new Buffer(_0x506c63['apiKey']+':X')[_0xd807('0x2a')](_0xd807('0x2b')));}function getServerInfo(_0x3b9ad4){return request({'form':{'method':_0xd807('0x2c'),'input_type':_0xd807('0x25'),'response_type':_0xd807('0x25'),'rest_data':JSON[_0xd807('0x26')]({'session':_0x3b9ad4['id']})}});}function getUser(_0x3fb603,_0x32980a,_0x24a580){if(!_[_0xd807('0x2d')](_0x32980a)){logger['info'](_0xd807('0x2e'),_0x32980a);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xd807('0x25'),'rest_data':JSON[_0xd807('0x26')]({'session':_0x24a580['id'],'module_name':_0xd807('0x2f'),'query':util[_0xd807('0x28')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x32980a),'order_by':'','offset':'0','select_fields':['id',_0xd807('0x10'),_0xd807('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd807('0x31')](function(_0x54b83f){if(_0x54b83f[_0xd807('0x32')][_0xd807('0x1f')]){var _0x3b2249=_[_0xd807('0x33')](_0x54b83f['entry_list'],function(_0x2584de){return _0x2584de[_0xd807('0x34')][_0xd807('0x30')][_0xd807('0x35')]===_0x32980a;});if(_0x3b2249){logger[_0xd807('0xf')](_0xd807('0x36'));return BPromise['resolve']({'id':_0x3b2249['name_value_list']['id']['value'],'name':_0x3b2249[_0xd807('0x34')][_0xd807('0x10')]['value']});}}logger[_0xd807('0xf')](_0xd807('0x37'));return BPromise[_0xd807('0x38')]({'id':_0x24a580[_0xd807('0x34')][_0xd807('0x39')][_0xd807('0x35')],'name':_0x24a580[_0xd807('0x34')][_0xd807('0x30')][_0xd807('0x35')]});});}else{logger['info'](_0xd807('0x3a'));return BPromise[_0xd807('0x38')]({'id':_0x24a580['name_value_list'][_0xd807('0x39')][_0xd807('0x35')],'name':_0x24a580['name_value_list']['user_name']['value']});}}function getEndUser(_0x3195ac,_0x38ea67,_0x2f7015,_0x44e49a){logger[_0xd807('0xf')](_0xd807('0x3b'),_0x2f7015);return request({'form':{'method':_0xd807('0x3c'),'input_type':_0xd807('0x25'),'response_type':_0xd807('0x25'),'rest_data':JSON[_0xd807('0x26')]({'session':_0x44e49a['id'],'module_name':'Contacts','query':util[_0xd807('0x28')](_0xd807('0x3d'),_0x2f7015),'order_by':'','offset':'0','select_fields':['id','name',_0xd807('0x3e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd807('0x31')](function(_0x416c24){if(_0x416c24[_0xd807('0x32')][_0xd807('0x1f')]){var _0x4422a9=_[_0xd807('0x33')](_0x416c24['entry_list'],function(_0x55571f){return _0x55571f[_0xd807('0x34')]['phone_home']['value']===_0x2f7015;});if(_0x4422a9){logger[_0xd807('0xf')](_0xd807('0x3f'));return BPromise[_0xd807('0x38')]({'id':_0x4422a9[_0xd807('0x34')]['id']['value'],'name':_0x4422a9[_0xd807('0x34')]['name'][_0xd807('0x35')],'phone':_0x4422a9[_0xd807('0x34')][_0xd807('0x3e')][_0xd807('0x35')]});}}else{logger[_0xd807('0xf')](_0xd807('0x40'));return request({'form':{'method':_0xd807('0x24'),'input_type':_0xd807('0x25'),'response_type':_0xd807('0x25'),'rest_data':JSON['stringify']({'session':_0x44e49a['id'],'module_name':'Contacts','name_value_list':[{'name':_0xd807('0x41'),'value':_0x38ea67!==_0xd807('0x42')?_0x38ea67:util[_0xd807('0x28')]('Caller\x20-\x20%s',_0x2f7015)},{'name':_0xd807('0x3e'),'value':_0x2f7015}]})}})['then'](function(_0x3a90b1){logger[_0xd807('0xf')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x3a90b1['id'],'name':_0x3a90b1[_0xd807('0x32')][_0xd807('0x41')]['value'],'phone':_0x3a90b1[_0xd807('0x32')][_0xd807('0x3e')][_0xd807('0x35')]});});}});}function request(_0x20e0b0){logger[_0xd807('0x43')](_0xd807('0x44'),JSON['stringify'](_0x20e0b0));return rp(_[_0xd807('0x45')](def,_0x20e0b0));}function getTags(_0x1a7a01,_0x189221){var _0x3fa68a=[];if(_0x1a7a01&&_0x1a7a01['length']>0x0){_0x3fa68a=_[_0xd807('0x46')](_0x1a7a01,_0x189221);}return _0x3fa68a;}function getCustomFields(_0x3e27ba,_0x3fe1b3){var _0x54a07e=[];var _0x37991a={'custom_fields':[]};if(_0x3e27ba[_0xd807('0x1f')]>0x0){_[_0xd807('0x20')](_0x3e27ba,function(_0x2d6bec){if(_0x2d6bec[_0xd807('0x47')]===_0xd807('0x48')&&_0x2d6bec[_0xd807('0x49')]&&!_0x2d6bec[_0xd807('0x4a')]){_0x37991a[_0x2d6bec['nameField'][_0xd807('0x4b')]()]=_0x2d6bec['content']['toString']();}else if(_0x2d6bec['type']===_0xd807('0x48')&&_0x2d6bec[_0xd807('0x23')]&&_0x2d6bec[_0xd807('0x4a')]){_0x37991a[_0xd807('0x4c')][_0xd807('0x22')]({'id':_0x2d6bec[_0xd807('0x23')],'value':_0x2d6bec[_0xd807('0x4d')][_0xd807('0x2a')]()});}else if(_0x2d6bec['type']===_0xd807('0x4e')&&_0x2d6bec['variableName']&&_0x2d6bec[_0xd807('0x23')]&&_0x2d6bec[_0xd807('0x4a')]){_0x3fe1b3[_0x2d6bec[_0xd807('0x21')]]&&_0x37991a[_0xd807('0x4c')][_0xd807('0x22')]({'id':_0x2d6bec[_0xd807('0x23')],'value':_0x3fe1b3[_0x2d6bec[_0xd807('0x21')]][_0xd807('0x2a')]()});}else if(_0x2d6bec[_0xd807('0x47')]===_0xd807('0x4f')&&_0x2d6bec['Variable']&&_0x2d6bec[_0xd807('0x50')][_0xd807('0x10')]&&_0x2d6bec[_0xd807('0x23')]&&_0x2d6bec[_0xd807('0x4a')]){_0x3fe1b3[_0x2d6bec[_0xd807('0x50')][_0xd807('0x10')][_0xd807('0x4b')]()]&&_0x37991a[_0xd807('0x4c')]['push']({'id':_0x2d6bec[_0xd807('0x23')],'value':_0x3fe1b3[_0x2d6bec['Variable'][_0xd807('0x10')][_0xd807('0x4b')]()][_0xd807('0x2a')]()});}});}return _0x37991a;}function getConnection(_0x3e824b){return request({'method':_0xd807('0xd'),'form':{'method':_0xd807('0x51'),'input_type':_0xd807('0x25'),'response_type':_0xd807('0x25'),'rest_data':JSON[_0xd807('0x26')]({'user_auth':{'user_name':_0x3e824b[_0xd807('0x52')],'password':_0x3e824b[_0xd807('0x53')],'encryption':_0xd807('0x54')},'application':_0xd807('0x55')})}})[_0xd807('0x31')](function(_0x15f364){var _0x378e83=_0x15f364;if(_0x378e83['id']){def['sessionID']=_0x378e83['id'];return BPromise[_0xd807('0x38')](_0x378e83);}else{throw new Error(util[_0xd807('0x28')](_0xd807('0x56'),_0x3e824b['id']));}});}function setRelationship(_0x37bc87,_0x5bfe95,_0x498660,_0xfcbf09){return request({'form':{'method':'set_relationship','input_type':_0xd807('0x25'),'response_type':_0xd807('0x25'),'rest_data':JSON[_0xd807('0x26')]({'session':_0x37bc87['id'],'module_name':'Calls','module_id':_0x498660['id'],'link_field_name':_0xfcbf09,'related_ids':[_0x5bfe95['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xd807('0x57')]=function(_0x4cc9b6,_0x2abcb7,_0x1ff72f,_0x25889f,_0x5218b6,_0x162c33){var _0x43f0eb,_0x25dce9,_0x5755b4,_0x2ef4d9;_0x162c33[_0xd807('0x58')]=intUtil[_0xd807('0x59')](_0x162c33[_0xd807('0x58')]);_0x162c33[_0xd807('0x5a')]=intUtil['stripTrailingSlash'](_0x162c33['serverUrl']);def[_0xd807('0x5b')]=util[_0xd807('0x28')]('%s/service/v4_1/rest.php',_0x162c33[_0xd807('0x58')]);if(_0x5218b6&&_0x5218b6[_0xd807('0x5c')]){logger[_0xd807('0xf')]('[QUEUE]',_0xd807('0x5d'));_0x2abcb7[_0xd807('0x5e')]=util[_0xd807('0x28')](_0xd807('0x5f'),_0x162c33[_0xd807('0x5a')],_0x2abcb7['uniqueid'],md5(_0x2abcb7[_0xd807('0x60')]));}else{_0x2abcb7[_0xd807('0x5e')]='';}return getConnection(_0x162c33)[_0xd807('0x31')](function(_0x18972d){_0x2ef4d9=_0x18972d;return getUser(_0x162c33,_0x25889f[_0xd807('0x10')],_0x2ef4d9);})[_0xd807('0x31')](function(_0x20dd09){_0x43f0eb=_0x20dd09;logger[_0xd807('0xf')](_0xd807('0x61'),_0x43f0eb['id']);return getEndUser(_0x162c33,_0x2abcb7[_0xd807('0x62')],_0x2abcb7[_0xd807('0x63')],_0x2ef4d9);})[_0xd807('0x31')](function(_0x4de43a){_0x25dce9=_0x4de43a;logger['info'](_0xd807('0x64'),_0x25dce9['id']);return getTicket(_0x162c33,_0x43f0eb,_0x25dce9,_0x1ff72f,_0x2abcb7,_0x1ff72f[_0xd807('0x65')],_0x2ef4d9,'Inbound');})[_0xd807('0x31')](function(_0x45a33f){_0x5755b4=_0x45a33f;logger[_0xd807('0xf')](_0xd807('0x66'));logger[_0xd807('0xf')](_0xd807('0x67'),_0x5755b4['id']);return setRelationship(_0x2ef4d9,_0x43f0eb,_0x5755b4,_0xd807('0x68'));})['then'](function(){return setRelationship(_0x2ef4d9,_0x25dce9,_0x5755b4,_0xd807('0x69'));})[_0xd807('0x31')](function(){return getServerInfo(_0x2ef4d9);})['then'](function(_0x49a445){var _0x2ec976=parseInt(_0x49a445[_0xd807('0x6a')][_0xd807('0x6b')](0x0));var _0x6635c6=util[_0xd807('0x28')](_0xd807('0x6c'),_0x162c33[_0xd807('0x58')],_0x5755b4['id']);if(_0x2ec976>0x6){_0x6635c6=util[_0xd807('0x28')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x162c33[_0xd807('0x58')],_0x5755b4['id']);}logger[_0xd807('0xf')]('[QUEUE]',_0xd807('0x6d'));emit(util[_0xd807('0x28')]('user:%s',_0x25889f[_0xd807('0x10')]),_0xd807('0x6e'),{'uri':_0x6635c6});})[_0xd807('0x6f')](function(_0x4d8bfa){logger[_0xd807('0x70')](_0xd807('0x71'),JSON[_0xd807('0x26')](_0x4d8bfa));});};exports[_0xd807('0x72')]=function(_0x1db5dd,_0x325787,_0x1b8d60,_0x4a57e6,_0x543777,_0x22320d,_0x4046f2){var _0x4faa2e,_0x1d6d33,_0x221b08,_0x34d2b8;_0x22320d[_0xd807('0x58')]=intUtil[_0xd807('0x59')](_0x22320d[_0xd807('0x58')]);_0x22320d[_0xd807('0x5a')]=intUtil[_0xd807('0x59')](_0x22320d[_0xd807('0x5a')]);def[_0xd807('0x5b')]=util[_0xd807('0x28')](_0xd807('0x73'),_0x22320d[_0xd807('0x58')]);if(_0x4046f2&&_0x4046f2[_0xd807('0x74')]&&_0x4046f2['recordingFormat']!==_0xd807('0x75')){logger[_0xd807('0xf')](_0xd807('0x76'),_0xd807('0x5d'));_0x325787[_0xd807('0x5e')]=util[_0xd807('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x22320d[_0xd807('0x5a')],_0x325787[_0xd807('0x60')],md5(_0x325787[_0xd807('0x60')]));}return getConnection(_0x22320d)[_0xd807('0x31')](function(_0x276a87){_0x34d2b8=_0x276a87;return getUser(_0x22320d,_0x4a57e6[_0xd807('0x10')],_0x34d2b8);})[_0xd807('0x31')](function(_0x581bac){_0x4faa2e=_0x581bac;logger['info'](_0xd807('0x61'),_0x4faa2e['id']);return getEndUser(_0x22320d,_0x325787[_0xd807('0x77')],_0x325787[_0xd807('0x78')],_0x34d2b8);})[_0xd807('0x31')](function(_0xe80db1){_0x1d6d33=_0xe80db1;logger[_0xd807('0xf')]('The\x20Enduser\x20ID\x20is:',_0x1d6d33['id']);return getTicket(_0x22320d,_0x4faa2e,_0x1d6d33,_0x1b8d60,_0x325787,_0x1b8d60[_0xd807('0x65')],_0x34d2b8,_0xd807('0x79'));})[_0xd807('0x31')](function(_0x29ff0a){_0x221b08=_0x29ff0a;logger[_0xd807('0xf')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x221b08['id']);return setRelationship(_0x34d2b8,_0x4faa2e,_0x221b08,_0xd807('0x68'));})[_0xd807('0x31')](function(){return setRelationship(_0x34d2b8,_0x1d6d33,_0x221b08,_0xd807('0x69'));})[_0xd807('0x31')](function(){return getServerInfo(_0x34d2b8);})[_0xd807('0x31')](function(_0x5cbf57){var _0x3876ac=parseInt(_0x5cbf57[_0xd807('0x6a')]['charAt'](0x0));var _0x1cc35d=util[_0xd807('0x28')](_0xd807('0x6c'),_0x22320d['remoteUri'],_0x221b08['id']);if(_0x3876ac>0x6){_0x1cc35d=util[_0xd807('0x28')](_0xd807('0x7a'),_0x22320d['remoteUri'],_0x221b08['id']);}logger[_0xd807('0xf')]('[OUTBOUND]',_0xd807('0x6d'));emit(util['format'](_0xd807('0x7b'),_0x4a57e6[_0xd807('0x10')]),_0xd807('0x6e'),{'uri':_0x1cc35d});})[_0xd807('0x6f')](function(_0xfdddce){logger[_0xd807('0x70')](_0xd807('0x76'),JSON[_0xd807('0x26')](_0xfdddce));});};exports['unmanaged']=function(_0x3b3dc1,_0x3f4c1d,_0x40aa2e,_0x43c0cf,_0x256b66,_0x535b04){var _0x27d6f8,_0x4e67f3,_0xba1e61,_0x42a5b1;_0x535b04['remoteUri']=intUtil[_0xd807('0x59')](_0x535b04[_0xd807('0x58')]);_0x535b04[_0xd807('0x5a')]=intUtil[_0xd807('0x59')](_0x535b04[_0xd807('0x5a')]);def[_0xd807('0x5b')]=util[_0xd807('0x28')](_0xd807('0x73'),_0x535b04[_0xd807('0x58')]);if(_0x256b66&&_0x256b66[_0xd807('0x5c')]){logger[_0xd807('0xf')]('['+_0x3f4c1d[_0xd807('0x7c')][_0xd807('0x7d')]()+']',_0xd807('0x5d'));_0x3f4c1d[_0xd807('0x5e')]=util[_0xd807('0x28')](_0xd807('0x5f'),_0x535b04[_0xd807('0x5a')],_0x3f4c1d[_0xd807('0x60')],md5(_0x3f4c1d[_0xd807('0x60')]));}else{_0x3f4c1d[_0xd807('0x5e')]='';}return getConnection(_0x535b04)['then'](function(_0xc5ea37){_0x42a5b1=_0xc5ea37;if(!_[_0xd807('0x2d')](_0x43c0cf)){return getUser(_0x535b04,_0x43c0cf['name'],_0x42a5b1);}else{return getUser(_0x535b04,null,_0x42a5b1);}})[_0xd807('0x31')](function(_0x3e0725){_0x27d6f8=_0x3e0725;logger[_0xd807('0xf')](_0xd807('0x61'),_0x27d6f8['id']);return getEndUser(_0x535b04,_0x3f4c1d[_0xd807('0x62')],_0x3f4c1d['calleridnum'],_0x42a5b1);})[_0xd807('0x31')](function(_0x190350){_0x4e67f3=_0x190350;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4e67f3['id']);return getTicket(_0x535b04,_0x27d6f8,_0x4e67f3,_0x40aa2e,_0x3f4c1d,_0x40aa2e[_0xd807('0x65')],_0x42a5b1,'Inbound');})[_0xd807('0x31')](function(_0x27c5d7){_0xba1e61=_0x27c5d7;logger['info'](_0xd807('0x66'));logger['info'](_0xd807('0x67'),_0xba1e61['id']);return setRelationship(_0x42a5b1,_0x27d6f8,_0xba1e61,_0xd807('0x68'));})[_0xd807('0x31')](function(){return setRelationship(_0x42a5b1,_0x4e67f3,_0xba1e61,_0xd807('0x69'));})['then'](function(){return getServerInfo(_0x42a5b1);})[_0xd807('0x6f')](function(_0x285afa){logger[_0xd807('0x70')]('['+_0x3f4c1d['lastevent'][_0xd807('0x7d')]()+']',JSON[_0xd807('0x26')](_0x285afa));});}; \ 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 b8fcaef..4dc2a45 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 _0x1593=['isNil','test','util','getString','sortBy','length','type','string','push','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1593,0x1f0));var _0x3159=function(_0x5894ab,_0x18c6fd){_0x5894ab=_0x5894ab-0x0;var _0x1af2f8=_0x1593[_0x5894ab];return _0x1af2f8;};'use strict';var _=require('lodash');var util=require(_0x3159('0x0'));exports[_0x3159('0x1')]=function(_0x437a65,_0x8869c7,_0xb51106){var _0x43d86c=[];if(_0x437a65['length']>0x0){var _0x697281=_[_0x3159('0x2')](_0x437a65,['id']);for(var _0x5bea83=0x0;_0x5bea83<_0x697281[_0x3159('0x3')];_0x5bea83++){var _0x40631b=_0x697281[_0x5bea83];if(_0x40631b[_0x3159('0x4')]===_0x3159('0x5')){_0x43d86c[_0x3159('0x6')](_0x40631b['content']);}else if(_0x40631b[_0x3159('0x4')]==='variable'&&_0x40631b[_0x3159('0x7')]){_0x8869c7[_0x40631b[_0x3159('0x7')]]&&_0x43d86c[_0x3159('0x6')](_0x8869c7[_0x40631b[_0x3159('0x7')]][_0x3159('0x8')]());}else if(_0x40631b[_0x3159('0x4')]===_0x3159('0x9')&&_0x40631b['Variable']&&_0x40631b[_0x3159('0xa')][_0x3159('0xb')]){_0x8869c7[_0x40631b['Variable'][_0x3159('0xb')][_0x3159('0xc')]()]&&_0x43d86c['push'](_0x8869c7[_0x40631b['Variable'][_0x3159('0xb')][_0x3159('0xc')]()]['toString']());}else if(_0x40631b[_0x3159('0x4')]===_0x3159('0xd')){if(_0x40631b[_0x3159('0xe')]==='string'&&_0x40631b[_0x3159('0xf')]){_0x43d86c[_0x3159('0x6')](util[_0x3159('0x10')]('%s:\x20%s',_0x40631b[_0x3159('0xf')],_0x40631b[_0x3159('0x11')]));}else if(_0x40631b[_0x3159('0xe')]==='variable'&&_0x40631b[_0x3159('0x7')]&&_0x40631b['key']){_0x8869c7[_0x40631b[_0x3159('0x7')]]&&_0x43d86c['push'](util['format']('%s:\x20%s',_0x40631b[_0x3159('0xf')],_0x8869c7[_0x40631b[_0x3159('0x7')]]));}else if(_0x40631b[_0x3159('0xe')]===_0x3159('0x9')&&_0x40631b[_0x3159('0xa')]&&_0x40631b['Variable'][_0x3159('0xb')]&&_0x40631b[_0x3159('0xf')]){_0x8869c7[_0x40631b[_0x3159('0xa')]['name'][_0x3159('0xc')]()]&&_0x43d86c[_0x3159('0x6')](util['format'](_0x3159('0x12'),_0x40631b[_0x3159('0xf')],_0x8869c7[_0x40631b[_0x3159('0xa')][_0x3159('0xb')][_0x3159('0xc')]()]));}}}}return _0x43d86c[_0x3159('0x13')](_0xb51106);};exports[_0x3159('0x14')]=function(_0x364e4f){var _0x482d1f=_0x364e4f[_0x3159('0x15')](-0x1);if(_0x482d1f==='/'){_0x364e4f=_0x364e4f[_0x3159('0x16')](0x0,_0x364e4f[_0x3159('0x17')](_0x482d1f));}return _0x364e4f;};exports['validateEmail']=function(_0x1fe111){if(!_[_0x3159('0x18')](_0x1fe111)&&_0x1fe111!==''){var _0x3b707f=/^(([^<>()\[\]\\.,;:\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 _0x3b707f[_0x3159('0x19')](String(_0x1fe111)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x8021=['Variable','name','toLowerCase','keyValue','keyType','format','%s:\x20%s','key','keyContent','customVariable','join','stripTrailingSlash','substring','lastIndexOf','isNil','lodash','getString','length','sortBy','type','string','push','content','variable','variableName','toString'];(function(_0x1d4d8a,_0xb5cb39){var _0x5317d8=function(_0x4ed33d){while(--_0x4ed33d){_0x1d4d8a['push'](_0x1d4d8a['shift']());}};_0x5317d8(++_0xb5cb39);}(_0x8021,0x91));var _0x1802=function(_0x5480e5,_0x52e354){_0x5480e5=_0x5480e5-0x0;var _0x20b7cc=_0x8021[_0x5480e5];return _0x20b7cc;};'use strict';var _=require(_0x1802('0x0'));var util=require('util');exports[_0x1802('0x1')]=function(_0x2696da,_0x1cf124,_0x5e600c){var _0x558717=[];if(_0x2696da[_0x1802('0x2')]>0x0){var _0x540877=_[_0x1802('0x3')](_0x2696da,['id']);for(var _0x553a5b=0x0;_0x553a5b<_0x540877[_0x1802('0x2')];_0x553a5b++){var _0x19bee5=_0x540877[_0x553a5b];if(_0x19bee5[_0x1802('0x4')]===_0x1802('0x5')){_0x558717[_0x1802('0x6')](_0x19bee5[_0x1802('0x7')]);}else if(_0x19bee5[_0x1802('0x4')]===_0x1802('0x8')&&_0x19bee5[_0x1802('0x9')]){_0x1cf124[_0x19bee5['variableName']]&&_0x558717[_0x1802('0x6')](_0x1cf124[_0x19bee5[_0x1802('0x9')]][_0x1802('0xa')]());}else if(_0x19bee5[_0x1802('0x4')]==='customVariable'&&_0x19bee5['Variable']&&_0x19bee5['Variable']['name']){_0x1cf124[_0x19bee5[_0x1802('0xb')][_0x1802('0xc')][_0x1802('0xd')]()]&&_0x558717['push'](_0x1cf124[_0x19bee5[_0x1802('0xb')][_0x1802('0xc')][_0x1802('0xd')]()]['toString']());}else if(_0x19bee5['type']===_0x1802('0xe')){if(_0x19bee5[_0x1802('0xf')]===_0x1802('0x5')&&_0x19bee5['key']){_0x558717[_0x1802('0x6')](util[_0x1802('0x10')](_0x1802('0x11'),_0x19bee5[_0x1802('0x12')],_0x19bee5[_0x1802('0x13')]));}else if(_0x19bee5[_0x1802('0xf')]===_0x1802('0x8')&&_0x19bee5['variableName']&&_0x19bee5[_0x1802('0x12')]){_0x1cf124[_0x19bee5[_0x1802('0x9')]]&&_0x558717[_0x1802('0x6')](util['format']('%s:\x20%s',_0x19bee5[_0x1802('0x12')],_0x1cf124[_0x19bee5[_0x1802('0x9')]]));}else if(_0x19bee5['keyType']===_0x1802('0x14')&&_0x19bee5['Variable']&&_0x19bee5[_0x1802('0xb')][_0x1802('0xc')]&&_0x19bee5[_0x1802('0x12')]){_0x1cf124[_0x19bee5['Variable'][_0x1802('0xc')][_0x1802('0xd')]()]&&_0x558717[_0x1802('0x6')](util[_0x1802('0x10')](_0x1802('0x11'),_0x19bee5[_0x1802('0x12')],_0x1cf124[_0x19bee5[_0x1802('0xb')][_0x1802('0xc')][_0x1802('0xd')]()]));}}}}return _0x558717[_0x1802('0x15')](_0x5e600c);};exports[_0x1802('0x16')]=function(_0xc52ebe){var _0x50dd1e=_0xc52ebe['slice'](-0x1);if(_0x50dd1e==='/'){_0xc52ebe=_0xc52ebe[_0x1802('0x17')](0x0,_0xc52ebe[_0x1802('0x18')](_0x50dd1e));}return _0xc52ebe;};exports['validateEmail']=function(_0xfa0213){if(!_[_0x1802('0x19')](_0xfa0213)&&_0xfa0213!==''){var _0xbd4b9b=/^(([^<>()\[\]\\.,;:\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 _0xbd4b9b['test'](String(_0xfa0213)[_0x1802('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 8606716..8555d17 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(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x28e196,_0x55ea66){var _0xebe98e=function(_0x2d229c){while(--_0x2d229c){_0x28e196['push'](_0x28e196['shift']());}};_0xebe98e(++_0x55ea66);}(_0xe706,0xa3));var _0x6e70=function(_0x3b37d0,_0x5e3d41){_0x3b37d0=_0x3b37d0-0x0;var _0x4987b6=_0xe706[_0x3b37d0];return _0x4987b6;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 0707bfa..c9183b2 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 _0x60a6=['password','username','%s/token:%s','token','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','includes','string','type','nameField','content','picklist','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','calleridnum','The\x20Enduser\x20ID\x20is:','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','merge','name','getString','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType'];(function(_0x495b4f,_0xdb22f2){var _0x4a10cb=function(_0x467182){while(--_0x467182){_0x495b4f['push'](_0x495b4f['shift']());}};_0x4a10cb(++_0xdb22f2);}(_0x60a6,0xba));var _0x660a=function(_0x4ae5a1,_0x1931bf){_0x4ae5a1=_0x4ae5a1-0x0;var _0x4145ef=_0x60a6[_0x4ae5a1];return _0x4145ef;};'use strict';var _=require(_0x660a('0x0'));var rp=require(_0x660a('0x1'));var md5=require(_0x660a('0x2'));var util=require(_0x660a('0x3'));var Redis=require(_0x660a('0x4'));var intUtil=require(_0x660a('0x5'));var config=require(_0x660a('0x6'));var logger=require(_0x660a('0x7'))(_0x660a('0x8'));config[_0x660a('0x9')]=_[_0x660a('0xa')](config[_0x660a('0x9')],{'host':_0x660a('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x660a('0x9')]));function emit(_0x358015,_0x531a10,_0x43554e){io['to'](_0x358015)[_0x660a('0xc')](_0x531a10,_0x43554e);}var headers={'Content-Type':_0x660a('0xd'),'Accept':_0x660a('0xd')};function getTicket(_0x1fc935,_0x3926c7,_0x5496c5,_0x129633,_0x18709c){logger[_0x660a('0xe')](_0x660a('0xf'));return request({'uri':util['format'](_0x660a('0x10'),_0x1fc935[_0x660a('0x11')]),'method':'POST','body':{'ticket':_[_0x660a('0x12')]({'requester_id':_0x5496c5['id'],'submitter_id':_0x3926c7?_0x3926c7['id']:undefined,'assignee_id':_0x3926c7?_0x3926c7['id']:undefined,'tags':getTags(_0x129633['Tags'],_0x660a('0x13')),'subject':intUtil[_0x660a('0x14')](_0x129633['Subjects'],_0x18709c,'\x20'),'description':intUtil[_0x660a('0x14')](_0x129633['Descriptions'],_0x18709c,'\x0a'),'comment':{'public':![],'body':intUtil[_0x660a('0x14')](_0x129633['Descriptions'],_0x18709c,'\x0a')}},getCustomFields(_0x129633[_0x660a('0x15')],_0x18709c))}})[_0x660a('0x16')](function(_0x3e09d6){logger[_0x660a('0xe')](_0x660a('0x17'));return _0x3e09d6[_0x660a('0x18')];});}function getUser(_0x24f6a6,_0x484cea){if(intUtil[_0x660a('0x19')](_0x484cea)){logger[_0x660a('0xe')](_0x660a('0x1a'),_0x484cea);return request({'uri':util[_0x660a('0x1b')]('%s/search.json',_0x24f6a6['remoteUri']),'qs':{'query':util[_0x660a('0x1b')](_0x660a('0x1c'),_0x484cea)}})['then'](function(_0x31e192){if(_0x31e192[_0x660a('0x1d')]){logger[_0x660a('0xe')](_0x660a('0x1e'));return _[_0x660a('0x1f')](_0x31e192[_0x660a('0x20')],{'email':_0x484cea,'role':'agent'});}else{logger[_0x660a('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x660a('0x1b')](_0x660a('0x21'),_0x24f6a6[_0x660a('0x11')])})[_0x660a('0x16')](function(_0x197987){logger['info'](_0x660a('0x22'));return _0x197987[_0x660a('0x23')];});}});}else{logger[_0x660a('0xe')](_0x660a('0x24'));return request({'uri':util[_0x660a('0x1b')]('%s/users/me.json',_0x24f6a6[_0x660a('0x11')])})[_0x660a('0x16')](function(_0x194602){logger['info'](_0x660a('0x22'));return _0x194602['user'];});}}function getEndUser(_0xb7b860,_0x57e826,_0xb7ced3){logger[_0x660a('0xe')](_0x660a('0x25'),_0xb7ced3);return request({'uri':util[_0x660a('0x1b')]('%s/search.json',_0xb7b860[_0x660a('0x11')]),'qs':{'query':util['format'](_0x660a('0x26'),_0xb7ced3)}})[_0x660a('0x16')](function(_0x73d9fa){var _0x45c385;if(_0x73d9fa[_0x660a('0x20')][_0x660a('0x27')]){_0x73d9fa[_0x660a('0x20')]=_[_0x660a('0x28')](_0x73d9fa['results'],{'suspended':![],'role':_0x660a('0x29')});if(_0x73d9fa[_0x660a('0x20')][_0x660a('0x27')]){_0x45c385=_[_0x660a('0x2a')](_0x73d9fa[_0x660a('0x20')]);}}if(_0x45c385){logger[_0x660a('0xe')]('Enduser\x20found!');return _0x45c385;}else{logger[_0x660a('0xe')](_0x660a('0x2b'));return request({'uri':util['format'](_0x660a('0x2c'),_0xb7b860[_0x660a('0x11')]),'method':'POST','body':{'user':{'role':_0x660a('0x29'),'name':util[_0x660a('0x1b')](_0x660a('0x2d'),_0x57e826||_0xb7ced3),'phone':_0xb7ced3}}})[_0x660a('0x16')](function(_0x23ae03){logger[_0x660a('0xe')](_0x660a('0x2e'));return _0x23ae03[_0x660a('0x23')];});}});}function getAuth(_0x33bfa9){var _0x3717c9;if(_0x33bfa9[_0x660a('0x2f')]===_0x660a('0x30')){_0x3717c9=util[_0x660a('0x1b')]('%s:%s',_0x33bfa9[_0x660a('0x31')],_0x33bfa9['password']);}else if(_0x33bfa9[_0x660a('0x2f')]==='token'){_0x3717c9=util['format'](_0x660a('0x32'),_0x33bfa9[_0x660a('0x31')],_0x33bfa9[_0x660a('0x33')]);}return util[_0x660a('0x1b')](_0x660a('0x34'),new Buffer(_0x3717c9)[_0x660a('0x35')](_0x660a('0x36')));}function request(_0x1cc299){logger['debug'](_0x660a('0x37'),JSON[_0x660a('0x38')](_0x1cc299));return rp(_[_0x660a('0xa')](_0x1cc299,{'method':_0x660a('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x2d08df,_0x54efaa){var _0x356006=[];if(_0x2d08df&&_0x2d08df[_0x660a('0x27')]>0x0){_0x356006=_[_0x660a('0x3a')](_0x2d08df,_0x54efaa);}return _0x356006;}function getCustomFields(_0x1203a1,_0x59d34e){var _0x3ce0e2=[];var _0xea1278={'custom_fields':[]};if(_0x1203a1[_0x660a('0x27')]>0x0){_[_0x660a('0x3b')](_0x1203a1,function(_0x2a09b0){if(_[_0x660a('0x3c')]([_0x660a('0x3d'),'picklist'],_0x2a09b0[_0x660a('0x3e')])&&_0x2a09b0[_0x660a('0x3f')]&&!_0x2a09b0['customField']){_0xea1278[_0x2a09b0['nameField']['toLowerCase']()]=_0x2a09b0[_0x660a('0x40')]['toString']();}else if(_[_0x660a('0x3c')]([_0x660a('0x3d'),_0x660a('0x41')],_0x2a09b0['type'])&&_0x2a09b0[_0x660a('0x42')]&&_0x2a09b0[_0x660a('0x43')]){_0xea1278[_0x660a('0x44')][_0x660a('0x45')]({'id':_0x2a09b0[_0x660a('0x42')],'value':_0x2a09b0[_0x660a('0x40')][_0x660a('0x35')]()});}else if(_0x2a09b0[_0x660a('0x3e')]===_0x660a('0x46')&&_0x2a09b0[_0x660a('0x47')]&&_0x2a09b0['idField']&&_0x2a09b0['customField']){_0x59d34e[_0x2a09b0[_0x660a('0x47')]]&&_0xea1278[_0x660a('0x44')][_0x660a('0x45')]({'id':_0x2a09b0[_0x660a('0x42')],'value':_0x59d34e[_0x2a09b0[_0x660a('0x47')]]['toString']()});}else if(_0x2a09b0[_0x660a('0x3e')]===_0x660a('0x48')&&_0x2a09b0[_0x660a('0x49')]&&_0x2a09b0[_0x660a('0x49')][_0x660a('0x13')]&&_0x2a09b0['idField']&&_0x2a09b0[_0x660a('0x43')]){_0x59d34e[_0x2a09b0[_0x660a('0x49')][_0x660a('0x13')][_0x660a('0x4a')]()]&&_0xea1278[_0x660a('0x44')][_0x660a('0x45')]({'id':_0x2a09b0['idField'],'value':_0x59d34e[_0x2a09b0['Variable'][_0x660a('0x13')][_0x660a('0x4a')]()][_0x660a('0x35')]()});}});}return _0xea1278;}exports[_0x660a('0x4b')]=function(_0x243ff4,_0x3c69c9,_0x2aa033,_0x925503,_0xbc7539,_0x519740){var _0x1a38c9,_0x497b1d;_0x519740[_0x660a('0x11')]=intUtil[_0x660a('0x4c')](_0x519740[_0x660a('0x11')]);_0x519740[_0x660a('0x4d')]=intUtil['stripTrailingSlash'](_0x519740[_0x660a('0x4d')]);if(_0xbc7539&&_0xbc7539[_0x660a('0x4e')]){logger['info'](_0x660a('0x4f'),_0x660a('0x50'));_0x3c69c9[_0x660a('0x51')]=util[_0x660a('0x1b')](_0x660a('0x52'),_0x519740[_0x660a('0x4d')],_0x3c69c9['uniqueid'],md5(_0x3c69c9[_0x660a('0x53')]));}else{_0x3c69c9[_0x660a('0x51')]='';}headers[_0x660a('0x54')]=getAuth(_0x519740);return getUser(_0x519740,_0x925503[_0x660a('0x55')])[_0x660a('0x16')](function(_0x49f441){_0x1a38c9=_0x49f441;logger[_0x660a('0xe')]('The\x20User\x20ID\x20is:',_0x1a38c9['id']);return getEndUser(_0x519740,_0x3c69c9[_0x660a('0x56')],_0x3c69c9['calleridnum']);})['then'](function(_0x2acf1f){_0x497b1d=_0x2acf1f;logger['info']('The\x20Enduser\x20ID\x20is:',_0x497b1d['id']);return getTicket(_0x519740,_0x1a38c9,_0x497b1d,_0x2aa033,_0x3c69c9);})[_0x660a('0x16')](function(_0x12b309){if(_0x12b309){logger[_0x660a('0xe')](_0x660a('0x57'),_0x12b309['id']);switch(_0x519740[_0x660a('0x3e')]){case _0x660a('0x58'):logger[_0x660a('0xe')](_0x660a('0x4f'),_0x660a('0x59'));return request({'uri':util[_0x660a('0x1b')](_0x660a('0x5a'),_0x519740[_0x660a('0x11')],_0x1a38c9['id'],_0x12b309['id']),'method':_0x660a('0x5b')});case _0x660a('0x5c'):logger[_0x660a('0xe')]('[QUEUE]',_0x660a('0x5d'));emit(util[_0x660a('0x1b')](_0x660a('0x5e'),_0x925503[_0x660a('0x13')]),_0x660a('0x5f'),{'uri':util[_0x660a('0x1b')](_0x660a('0x60'),_0x519740[_0x660a('0x11')][_0x660a('0x61')](_0x660a('0x62'),''),_0x12b309['id'])});break;default:logger[_0x660a('0x63')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x660a('0x64')](function(_0x5c258f){logger[_0x660a('0x63')](_0x660a('0x65'),util[_0x660a('0x66')](_0x5c258f,{'showHidden':!![],'depth':null}));});};exports[_0x660a('0x67')]=function(_0x1af728,_0x18f2aa,_0x18cb7a,_0x13b34f,_0x324543,_0x1722d4,_0xc7fd1c){var _0x24faf8,_0x3f200e;_0x1722d4[_0x660a('0x11')]=intUtil[_0x660a('0x4c')](_0x1722d4[_0x660a('0x11')]);_0x1722d4[_0x660a('0x4d')]=intUtil[_0x660a('0x4c')](_0x1722d4['serverUrl']);if(_0xc7fd1c&&_0xc7fd1c[_0x660a('0x68')]&&_0xc7fd1c['recordingFormat']!==_0x660a('0x69')){logger[_0x660a('0xe')](_0x660a('0x6a'),_0x660a('0x50'));_0x18f2aa[_0x660a('0x51')]=util[_0x660a('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1722d4[_0x660a('0x4d')],_0x18f2aa[_0x660a('0x53')],md5(_0x18f2aa[_0x660a('0x53')]));}headers[_0x660a('0x54')]=getAuth(_0x1722d4);return getUser(_0x1722d4,_0x13b34f[_0x660a('0x55')])['then'](function(_0x4e2a60){_0x24faf8=_0x4e2a60;logger[_0x660a('0xe')](_0x660a('0x6b'),_0x24faf8['id']);return getEndUser(_0x1722d4,_0x18f2aa[_0x660a('0x6c')],_0x18f2aa[_0x660a('0x6d')]);})[_0x660a('0x16')](function(_0x68a242){_0x3f200e=_0x68a242;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3f200e['id']);return getTicket(_0x1722d4,_0x24faf8,_0x3f200e,_0x18cb7a,_0x18f2aa);})[_0x660a('0x16')](function(_0x32d566){if(_0x32d566){logger['info'](_0x660a('0x57'),_0x32d566['id']);switch(_0x1722d4[_0x660a('0x3e')]){case _0x660a('0x58'):logger[_0x660a('0xe')](_0x660a('0x6a'),_0x660a('0x59'));return request({'uri':util[_0x660a('0x1b')](_0x660a('0x5a'),_0x1722d4[_0x660a('0x11')],_0x24faf8['id'],_0x32d566['id']),'method':_0x660a('0x5b')});case _0x660a('0x5c'):logger[_0x660a('0xe')](_0x660a('0x6a'),_0x660a('0x5d'));emit(util[_0x660a('0x1b')]('user:%s',_0x13b34f['name']),_0x660a('0x5f'),{'uri':util[_0x660a('0x1b')](_0x660a('0x60'),_0x1722d4[_0x660a('0x11')][_0x660a('0x61')](_0x660a('0x62'),''),_0x32d566['id'])});break;default:logger[_0x660a('0x63')](_0x660a('0x6a'),_0x660a('0x6e'));}}})[_0x660a('0x64')](function(_0x1499bc){logger[_0x660a('0x63')](_0x660a('0x6f'),util[_0x660a('0x66')](_0x1499bc,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x1cac66,_0x5306ba,_0x22ccd2,_0x2b65c0,_0x17af7a,_0x11e9fa){var _0x5f2b79,_0x12040a;_0x11e9fa[_0x660a('0x11')]=intUtil['stripTrailingSlash'](_0x11e9fa['remoteUri']);_0x11e9fa[_0x660a('0x4d')]=intUtil['stripTrailingSlash'](_0x11e9fa[_0x660a('0x4d')]);if(_0x17af7a&&_0x17af7a['monitor_format']){logger[_0x660a('0xe')]('['+_0x5306ba[_0x660a('0x70')]['toUpperCase']()+']',_0x660a('0x50'));_0x5306ba[_0x660a('0x51')]=util[_0x660a('0x1b')](_0x660a('0x52'),_0x11e9fa[_0x660a('0x4d')],_0x5306ba['uniqueid'],md5(_0x5306ba[_0x660a('0x53')]));}else{_0x5306ba[_0x660a('0x51')]='';}headers[_0x660a('0x54')]=getAuth(_0x11e9fa);return getUser(_0x11e9fa)[_0x660a('0x16')](function(_0x2eb8f6){_0x5f2b79=_0x2eb8f6;logger[_0x660a('0xe')](_0x660a('0x6b'),_0x5f2b79['id']);return getEndUser(_0x11e9fa,_0x5306ba[_0x660a('0x56')],_0x5306ba[_0x660a('0x71')]);})[_0x660a('0x16')](function(_0x543991){_0x12040a=_0x543991;logger[_0x660a('0xe')](_0x660a('0x72'),_0x12040a['id']);return getTicket(_0x11e9fa,_0x5f2b79,_0x12040a,_0x22ccd2,_0x5306ba);})['then'](function(_0x461831){if(_0x461831){logger['info'](_0x660a('0x57'),_0x461831['id']);}})[_0x660a('0x64')](function(_0x3c5976){logger[_0x660a('0x63')]('['+_0x5306ba[_0x660a('0x70')][_0x660a('0x73')]()+']'+_0x660a('0x74'),util[_0x660a('0x66')](_0x3c5976,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x17fe=['%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','forEach','picklist','type','customField','toLowerCase','content','includes','string','idField','push','variable','variableName','Variable','name','custom_fields','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:browser:url','replace','[OUTBOUND]','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','%s/search.json','type:user\x20role:agent\x20email:%s','then','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password'];(function(_0x4a828b,_0x4915ab){var _0x32245f=function(_0x4df59e){while(--_0x4df59e){_0x4a828b['push'](_0x4a828b['shift']());}};_0x32245f(++_0x4915ab);}(_0x17fe,0xb2));var _0xe17f=function(_0x21b44d,_0x221470){_0x21b44d=_0x21b44d-0x0;var _0x207046=_0x17fe[_0x21b44d];return _0x207046;};'use strict';var _=require(_0xe17f('0x0'));var rp=require(_0xe17f('0x1'));var md5=require(_0xe17f('0x2'));var util=require(_0xe17f('0x3'));var Redis=require(_0xe17f('0x4'));var intUtil=require('./util');var config=require(_0xe17f('0x5'));var logger=require(_0xe17f('0x6'))(_0xe17f('0x7'));config['redis']=_[_0xe17f('0x8')](config[_0xe17f('0x9')],{'host':_0xe17f('0xa'),'port':0x18eb});var io=require(_0xe17f('0xb'))(new Redis(config[_0xe17f('0x9')]));function emit(_0x36550d,_0x5e9dde,_0x5a2127){io['to'](_0x36550d)['emit'](_0x5e9dde,_0x5a2127);}var headers={'Content-Type':_0xe17f('0xc'),'Accept':_0xe17f('0xc')};function getTicket(_0xd65496,_0x5e7108,_0x3eb7f7,_0x567897,_0xec43d8){logger[_0xe17f('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xe17f('0xe')](_0xe17f('0xf'),_0xd65496[_0xe17f('0x10')]),'method':_0xe17f('0x11'),'body':{'ticket':_[_0xe17f('0x12')]({'requester_id':_0x3eb7f7['id'],'submitter_id':_0x5e7108?_0x5e7108['id']:undefined,'assignee_id':_0x5e7108?_0x5e7108['id']:undefined,'tags':getTags(_0x567897[_0xe17f('0x13')],'name'),'subject':intUtil[_0xe17f('0x14')](_0x567897[_0xe17f('0x15')],_0xec43d8,'\x20'),'description':intUtil[_0xe17f('0x14')](_0x567897[_0xe17f('0x16')],_0xec43d8,'\x0a'),'comment':{'public':![],'body':intUtil[_0xe17f('0x14')](_0x567897[_0xe17f('0x16')],_0xec43d8,'\x0a')}},getCustomFields(_0x567897[_0xe17f('0x17')],_0xec43d8))}})['then'](function(_0x213cd1){logger[_0xe17f('0xd')](_0xe17f('0x18'));return _0x213cd1[_0xe17f('0x19')];});}function getUser(_0x318167,_0x43a08a){if(intUtil['validateEmail'](_0x43a08a)){logger[_0xe17f('0xd')]('Getting\x20agent\x20with\x20email',_0x43a08a);return request({'uri':util[_0xe17f('0xe')](_0xe17f('0x1a'),_0x318167['remoteUri']),'qs':{'query':util['format'](_0xe17f('0x1b'),_0x43a08a)}})[_0xe17f('0x1c')](function(_0x4664a4){if(_0x4664a4['count']){logger['info'](_0xe17f('0x1d'));return _[_0xe17f('0x1e')](_0x4664a4[_0xe17f('0x1f')],{'email':_0x43a08a,'role':_0xe17f('0x20')});}else{logger['info'](_0xe17f('0x21'));return request({'uri':util['format']('%s/users/me.json',_0x318167[_0xe17f('0x10')])})['then'](function(_0x1e4f36){logger[_0xe17f('0xd')](_0xe17f('0x22'));return _0x1e4f36[_0xe17f('0x23')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe17f('0xe')](_0xe17f('0x24'),_0x318167['remoteUri'])})['then'](function(_0x5105ec){logger[_0xe17f('0xd')]('Admin\x20account\x20selected.');return _0x5105ec[_0xe17f('0x23')];});}}function getEndUser(_0x3f6f24,_0x285d5b,_0x49af94){logger['info']('Searching\x20enduser\x20with\x20phone',_0x49af94);return request({'uri':util[_0xe17f('0xe')]('%s/search.json',_0x3f6f24[_0xe17f('0x10')]),'qs':{'query':util[_0xe17f('0xe')](_0xe17f('0x25'),_0x49af94)}})[_0xe17f('0x1c')](function(_0x2ed0c2){var _0x322a41;if(_0x2ed0c2[_0xe17f('0x1f')][_0xe17f('0x26')]){_0x2ed0c2['results']=_[_0xe17f('0x27')](_0x2ed0c2[_0xe17f('0x1f')],{'suspended':![],'role':'end-user'});if(_0x2ed0c2[_0xe17f('0x1f')][_0xe17f('0x26')]){_0x322a41=_[_0xe17f('0x28')](_0x2ed0c2[_0xe17f('0x1f')]);}}if(_0x322a41){logger[_0xe17f('0xd')]('Enduser\x20found!');return _0x322a41;}else{logger['info'](_0xe17f('0x29'));return request({'uri':util['format'](_0xe17f('0x2a'),_0x3f6f24[_0xe17f('0x10')]),'method':'POST','body':{'user':{'role':'end-user','name':util['format'](_0xe17f('0x2b'),_0x285d5b||_0x49af94),'phone':_0x49af94}}})[_0xe17f('0x1c')](function(_0x227397){logger[_0xe17f('0xd')](_0xe17f('0x2c'));return _0x227397['user'];});}});}function getAuth(_0x40619f){var _0x5d01e4;if(_0x40619f['authType']===_0xe17f('0x2d')){_0x5d01e4=util[_0xe17f('0xe')](_0xe17f('0x2e'),_0x40619f[_0xe17f('0x2f')],_0x40619f['password']);}else if(_0x40619f[_0xe17f('0x30')]===_0xe17f('0x31')){_0x5d01e4=util['format'](_0xe17f('0x32'),_0x40619f[_0xe17f('0x2f')],_0x40619f['token']);}return util[_0xe17f('0xe')](_0xe17f('0x33'),new Buffer(_0x5d01e4)[_0xe17f('0x34')](_0xe17f('0x35')));}function request(_0x494c71){logger[_0xe17f('0x36')](_0xe17f('0x37'),JSON[_0xe17f('0x38')](_0x494c71));return rp(_[_0xe17f('0x8')](_0x494c71,{'method':_0xe17f('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x13c7e1,_0xe0dbf7){var _0x3d6d0b=[];if(_0x13c7e1&&_0x13c7e1['length']>0x0){_0x3d6d0b=_['map'](_0x13c7e1,_0xe0dbf7);}return _0x3d6d0b;}function getCustomFields(_0x3aff15,_0xf7b0d3){var _0x23c395=[];var _0x463614={'custom_fields':[]};if(_0x3aff15['length']>0x0){_[_0xe17f('0x3a')](_0x3aff15,function(_0x13e9b6){if(_['includes'](['string',_0xe17f('0x3b')],_0x13e9b6[_0xe17f('0x3c')])&&_0x13e9b6['nameField']&&!_0x13e9b6[_0xe17f('0x3d')]){_0x463614[_0x13e9b6['nameField'][_0xe17f('0x3e')]()]=_0x13e9b6[_0xe17f('0x3f')][_0xe17f('0x34')]();}else if(_[_0xe17f('0x40')]([_0xe17f('0x41'),_0xe17f('0x3b')],_0x13e9b6['type'])&&_0x13e9b6[_0xe17f('0x42')]&&_0x13e9b6[_0xe17f('0x3d')]){_0x463614['custom_fields'][_0xe17f('0x43')]({'id':_0x13e9b6[_0xe17f('0x42')],'value':_0x13e9b6[_0xe17f('0x3f')]['toString']()});}else if(_0x13e9b6[_0xe17f('0x3c')]===_0xe17f('0x44')&&_0x13e9b6[_0xe17f('0x45')]&&_0x13e9b6[_0xe17f('0x42')]&&_0x13e9b6['customField']){_0xf7b0d3[_0x13e9b6[_0xe17f('0x45')]]&&_0x463614['custom_fields'][_0xe17f('0x43')]({'id':_0x13e9b6[_0xe17f('0x42')],'value':_0xf7b0d3[_0x13e9b6['variableName']][_0xe17f('0x34')]()});}else if(_0x13e9b6[_0xe17f('0x3c')]==='customVariable'&&_0x13e9b6[_0xe17f('0x46')]&&_0x13e9b6['Variable']['name']&&_0x13e9b6[_0xe17f('0x42')]&&_0x13e9b6['customField']){_0xf7b0d3[_0x13e9b6['Variable'][_0xe17f('0x47')]['toLowerCase']()]&&_0x463614[_0xe17f('0x48')][_0xe17f('0x43')]({'id':_0x13e9b6[_0xe17f('0x42')],'value':_0xf7b0d3[_0x13e9b6[_0xe17f('0x46')]['name'][_0xe17f('0x3e')]()]['toString']()});}});}return _0x463614;}exports['queue']=function(_0x304350,_0xb235c,_0x13587d,_0x406610,_0x1e8976,_0x4809f6){var _0x43c729,_0x8c69fe;_0x4809f6[_0xe17f('0x10')]=intUtil[_0xe17f('0x49')](_0x4809f6[_0xe17f('0x10')]);_0x4809f6[_0xe17f('0x4a')]=intUtil[_0xe17f('0x49')](_0x4809f6[_0xe17f('0x4a')]);if(_0x1e8976&&_0x1e8976[_0xe17f('0x4b')]){logger[_0xe17f('0xd')](_0xe17f('0x4c'),_0xe17f('0x4d'));_0xb235c[_0xe17f('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4809f6[_0xe17f('0x4a')],_0xb235c[_0xe17f('0x4f')],md5(_0xb235c[_0xe17f('0x4f')]));}else{_0xb235c[_0xe17f('0x4e')]='';}headers[_0xe17f('0x50')]=getAuth(_0x4809f6);return getUser(_0x4809f6,_0x406610[_0xe17f('0x51')])[_0xe17f('0x1c')](function(_0x34d2fc){_0x43c729=_0x34d2fc;logger[_0xe17f('0xd')](_0xe17f('0x52'),_0x43c729['id']);return getEndUser(_0x4809f6,_0xb235c['calleridname'],_0xb235c['calleridnum']);})['then'](function(_0x1c9195){_0x8c69fe=_0x1c9195;logger[_0xe17f('0xd')]('The\x20Enduser\x20ID\x20is:',_0x8c69fe['id']);return getTicket(_0x4809f6,_0x43c729,_0x8c69fe,_0x13587d,_0xb235c);})[_0xe17f('0x1c')](function(_0x414827){if(_0x414827){logger[_0xe17f('0xd')](_0xe17f('0x53'),_0x414827['id']);switch(_0x4809f6['type']){case _0xe17f('0x54'):logger[_0xe17f('0xd')](_0xe17f('0x4c'),_0xe17f('0x55'));return request({'uri':util['format'](_0xe17f('0x56'),_0x4809f6[_0xe17f('0x10')],_0x43c729['id'],_0x414827['id']),'method':_0xe17f('0x11')});case _0xe17f('0x57'):logger[_0xe17f('0xd')](_0xe17f('0x4c'),_0xe17f('0x58'));emit(util[_0xe17f('0xe')](_0xe17f('0x59'),_0x406610[_0xe17f('0x47')]),'trigger:browser:url',{'uri':util['format'](_0xe17f('0x5a'),_0x4809f6[_0xe17f('0x10')]['replace'](_0xe17f('0x5b'),''),_0x414827['id'])});break;default:logger[_0xe17f('0x5c')](_0xe17f('0x4c'),_0xe17f('0x5d'));}}})[_0xe17f('0x5e')](function(_0x43d964){logger[_0xe17f('0x5c')](_0xe17f('0x5f'),util[_0xe17f('0x60')](_0x43d964,{'showHidden':!![],'depth':null}));});};exports[_0xe17f('0x61')]=function(_0x44e918,_0x4e812c,_0xc0ed1,_0x27c2fd,_0x4879aa,_0x188e03,_0x54d20d){var _0x35522f,_0x2af54b;_0x188e03[_0xe17f('0x10')]=intUtil[_0xe17f('0x49')](_0x188e03[_0xe17f('0x10')]);_0x188e03[_0xe17f('0x4a')]=intUtil[_0xe17f('0x49')](_0x188e03[_0xe17f('0x4a')]);if(_0x54d20d&&_0x54d20d[_0xe17f('0x62')]&&_0x54d20d[_0xe17f('0x62')]!==_0xe17f('0x63')){logger[_0xe17f('0xd')]('[OUTBOUND]',_0xe17f('0x4d'));_0x4e812c[_0xe17f('0x4e')]=util[_0xe17f('0xe')](_0xe17f('0x64'),_0x188e03[_0xe17f('0x4a')],_0x4e812c[_0xe17f('0x4f')],md5(_0x4e812c[_0xe17f('0x4f')]));}headers[_0xe17f('0x50')]=getAuth(_0x188e03);return getUser(_0x188e03,_0x27c2fd[_0xe17f('0x51')])[_0xe17f('0x1c')](function(_0xbd2ba){_0x35522f=_0xbd2ba;logger[_0xe17f('0xd')]('The\x20User\x20ID\x20is:',_0x35522f['id']);return getEndUser(_0x188e03,_0x4e812c[_0xe17f('0x65')],_0x4e812c[_0xe17f('0x66')]);})['then'](function(_0x10b900){_0x2af54b=_0x10b900;logger['info'](_0xe17f('0x67'),_0x2af54b['id']);return getTicket(_0x188e03,_0x35522f,_0x2af54b,_0xc0ed1,_0x4e812c);})[_0xe17f('0x1c')](function(_0x1fd802){if(_0x1fd802){logger[_0xe17f('0xd')](_0xe17f('0x53'),_0x1fd802['id']);switch(_0x188e03[_0xe17f('0x3c')]){case _0xe17f('0x54'):logger[_0xe17f('0xd')]('[OUTBOUND]',_0xe17f('0x55'));return request({'uri':util['format'](_0xe17f('0x56'),_0x188e03[_0xe17f('0x10')],_0x35522f['id'],_0x1fd802['id']),'method':'POST'});case'newTab':logger[_0xe17f('0xd')]('[OUTBOUND]',_0xe17f('0x58'));emit(util[_0xe17f('0xe')](_0xe17f('0x59'),_0x27c2fd[_0xe17f('0x47')]),_0xe17f('0x68'),{'uri':util['format']('%s/agent/tickets/%s',_0x188e03[_0xe17f('0x10')][_0xe17f('0x69')](_0xe17f('0x5b'),''),_0x1fd802['id'])});break;default:logger[_0xe17f('0x5c')](_0xe17f('0x6a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0xfe0e56){logger['error'](_0xe17f('0x6b'),util['inspect'](_0xfe0e56,{'showHidden':!![],'depth':null}));});};exports[_0xe17f('0x6c')]=function(_0x570373,_0x2ecdb1,_0x3188d9,_0x4053e7,_0x215d0f,_0x3ed938){var _0x538df8,_0x2f7bb5;_0x3ed938['remoteUri']=intUtil[_0xe17f('0x49')](_0x3ed938[_0xe17f('0x10')]);_0x3ed938[_0xe17f('0x4a')]=intUtil[_0xe17f('0x49')](_0x3ed938[_0xe17f('0x4a')]);if(_0x215d0f&&_0x215d0f[_0xe17f('0x4b')]){logger[_0xe17f('0xd')]('['+_0x2ecdb1['lastevent'][_0xe17f('0x6d')]()+']',_0xe17f('0x4d'));_0x2ecdb1['recordingURL']=util[_0xe17f('0xe')](_0xe17f('0x64'),_0x3ed938['serverUrl'],_0x2ecdb1['uniqueid'],md5(_0x2ecdb1[_0xe17f('0x4f')]));}else{_0x2ecdb1[_0xe17f('0x4e')]='';}headers[_0xe17f('0x50')]=getAuth(_0x3ed938);return getUser(_0x3ed938)[_0xe17f('0x1c')](function(_0xda94e1){_0x538df8=_0xda94e1;logger['info'](_0xe17f('0x52'),_0x538df8['id']);return getEndUser(_0x3ed938,_0x2ecdb1['calleridname'],_0x2ecdb1['calleridnum']);})['then'](function(_0x420a52){_0x2f7bb5=_0x420a52;logger[_0xe17f('0xd')](_0xe17f('0x67'),_0x2f7bb5['id']);return getTicket(_0x3ed938,_0x538df8,_0x2f7bb5,_0x3188d9,_0x2ecdb1);})[_0xe17f('0x1c')](function(_0x2ec8b3){if(_0x2ec8b3){logger[_0xe17f('0xd')](_0xe17f('0x53'),_0x2ec8b3['id']);}})[_0xe17f('0x5e')](function(_0x32daad){logger[_0xe17f('0x5c')]('['+_0x2ecdb1[_0xe17f('0x6e')][_0xe17f('0x6d')]()+']'+_0xe17f('0x6f'),util[_0xe17f('0x60')](_0x32daad,{'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 ed072e8..c589b87 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 _0xa804=['host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','unmanaged','monitor_format','toUpperCase','calleridname','lodash','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','includes','string','idField','type','variable','variableName','customVariable','Variable','name','toLowerCase','toString','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','/crm/v2/','role','first_name','last_name','SUCCESS','details','startCase','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','https://www.zohoapis.','lead','Leads','administrator','Subject','Subjects','Description','getString','Descriptions','First_Name','Last_Name','Full_Name','$se_module','talktime','Call_Duration','utc','answertime','YYYY-MM-DDTHH:mm:ss','format','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','starttime','Call_Type','merge','Fields','/crm/v2/Calls','code','Call\x20created!','err','queue'];(function(_0x4e8b49,_0x3ca512){var _0x5dc0ed=function(_0x512ba5){while(--_0x512ba5){_0x4e8b49['push'](_0x4e8b49['shift']());}};_0x5dc0ed(++_0x3ca512);}(_0xa804,0x158));var _0x4a80=function(_0x3ada3b,_0x176aaa){_0x3ada3b=_0x3ada3b-0x0;var _0x4198da=_0xa804[_0x3ada3b];return _0x4198da;};'use strict';var _=require(_0x4a80('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x4a80('0x1'));var intUtil=require(_0x4a80('0x2'));var moment=require('moment');var Redis=require(_0x4a80('0x3'));var BPromise=require(_0x4a80('0x4'));var config=require(_0x4a80('0x5'));var logger=require(_0x4a80('0x6'))(_0x4a80('0x7'));config['redis']=_[_0x4a80('0x8')](config[_0x4a80('0x9')],{'host':_0x4a80('0xa'),'port':0x18eb});var io=require(_0x4a80('0xb'))(new Redis(config[_0x4a80('0x9')]));function emit(_0x235533,_0x35a12f,_0x41970a){io['to'](_0x235533)[_0x4a80('0xc')](_0x35a12f,_0x41970a);}function request(_0x43297f){logger['debug'](_0x4a80('0xd'),JSON[_0x4a80('0xe')](_0x43297f));return rp(_0x43297f);}function getCustomFields(_0x29dd9a,_0x373e76){var _0x21d369={};if(_0x29dd9a[_0x4a80('0xf')]>0x0){_['forEach'](_0x29dd9a,function(_0x1b6b19){if(_[_0x4a80('0x10')]([_0x4a80('0x11'),'picklist'],_0x1b6b19['type'])&&_0x1b6b19[_0x4a80('0x12')]){_0x21d369[_0x1b6b19['idField']]=_0x1b6b19['content']['toString']();}else if(_0x1b6b19[_0x4a80('0x13')]===_0x4a80('0x14')&&_0x1b6b19[_0x4a80('0x15')]&&_0x1b6b19[_0x4a80('0x12')]&&_0x373e76[_0x1b6b19[_0x4a80('0x15')]]){_0x21d369[_0x1b6b19[_0x4a80('0x12')]]=_0x373e76[_0x1b6b19[_0x4a80('0x15')]]['toString']();}else if(_0x1b6b19['type']===_0x4a80('0x16')&&_0x1b6b19[_0x4a80('0x17')]&&_0x1b6b19['Variable'][_0x4a80('0x18')]&&_0x1b6b19[_0x4a80('0x12')]&&_0x373e76[_0x1b6b19['Variable'][_0x4a80('0x18')][_0x4a80('0x19')]()]){_0x21d369[_0x1b6b19[_0x4a80('0x12')]]=_0x373e76[_0x1b6b19[_0x4a80('0x17')][_0x4a80('0x18')][_0x4a80('0x19')]()][_0x4a80('0x1a')]();}});}return _0x21d369;}function getName(_0x1efbe5){if(_0x1efbe5[_0x4a80('0x1b')]('\x20')>0x0){var _0x5168b2=_0x1efbe5[_0x4a80('0x1c')](/ (.+)/);if(_0x5168b2[0x1]){return _0x5168b2;}}return[_0x1efbe5,_0x1efbe5];}var accountsTokens={};function getAccessToken(_0x46a15b){return new Promise(function(_0x5bb8fb,_0x4eb9d3){if(!_[_0x4a80('0x1d')](accountsTokens[_0x46a15b['id']])&&!_[_0x4a80('0x1d')](accountsTokens[_0x46a15b['id']][_0x4a80('0x1e')])){if(moment()[_0x4a80('0x1f')](accountsTokens[_0x46a15b['id']][_0x4a80('0x20')])){_0x5bb8fb(accountsTokens[_0x46a15b['id']][_0x4a80('0x1e')]);}}var _0x57f086;switch(_0x46a15b[_0x4a80('0x21')]){case'US':_0x57f086='https://accounts.zoho.com';break;case'AU':_0x57f086=_0x4a80('0x22');break;case'EU':_0x57f086=_0x4a80('0x23');break;case'IN':_0x57f086=_0x4a80('0x24');break;case'CN':_0x57f086=_0x4a80('0x25');break;default:_0x57f086='https://accounts.zoho.eu';break;}var _0x181fab={'method':_0x4a80('0x26'),'uri':_0x57f086+_0x4a80('0x27'),'qs':{'refresh_token':_0x46a15b[_0x4a80('0x28')],'client_id':_0x46a15b[_0x4a80('0x29')],'client_secret':_0x46a15b[_0x4a80('0x2a')],'grant_type':_0x4a80('0x2b')},'json':!![]};return rp(_0x181fab)[_0x4a80('0x2c')](function(_0x3bed34){accountsTokens[_0x46a15b['id']]={'access_token':_0x3bed34[_0x4a80('0x1e')],'expires_in':moment()[_0x4a80('0x2d')](_0x3bed34[_0x4a80('0x20')],_0x4a80('0x2e'))};_0x5bb8fb(_0x3bed34['access_token']);})['catch'](function(_0x45d6f2){logger['error'](_0x4a80('0x2f'),_0x45d6f2[_0x4a80('0x30')]);_0x4eb9d3(_0x45d6f2);});});}function getUser(_0x39dde0,_0x425afb,_0x5469b2,_0x2e3719){logger['info'](_0x4a80('0x31'));return request({'method':_0x4a80('0x32'),'uri':util['format'](_0x4a80('0x33'),_0x425afb),'qs':{'type':_0x4a80('0x34')},'headers':{'Authorization':_0x4a80('0x35')+_0x39dde0},'json':!![]})[_0x4a80('0x2c')](function(_0x15bdc2){if(_0x15bdc2[_0x4a80('0x36')]){var _0x2b749f=-0x1;if(_[_0x4a80('0x37')](_0x15bdc2[_0x4a80('0x36')])){if(!_['isNil'](_0x2e3719)){_0x2b749f=_[_0x4a80('0x38')](_0x15bdc2[_0x4a80('0x36')],function(_0x24f319){return _0x24f319['email']===_0x2e3719;});}if(_0x2b749f>=0x0){logger[_0x4a80('0x39')](_0x4a80('0x3a'));}else{logger[_0x4a80('0x39')](_0x4a80('0x3b'));_0x2b749f=_[_0x4a80('0x38')](_0x15bdc2[_0x4a80('0x36')],function(_0x25ca77){return _0x25ca77[_0x4a80('0x3c')][_0x4a80('0x18')]==='Administrator';});}return _0x15bdc2[_0x4a80('0x36')][_0x2b749f];}else{if(_0x15bdc2[_0x4a80('0x3d')][_0x4a80('0x3c')]['name']===_0x4a80('0x3e')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x15bdc2['user'];return user;}else{logger[_0x4a80('0x3f')](_0x4a80('0x40'),JSON[_0x4a80('0xe')](_0x15bdc2));throw new Error(_0x4a80('0x41')+JSON[_0x4a80('0xe')](_0x15bdc2));}}}else{logger[_0x4a80('0x3f')]('The\x20failing\x20result\x20is',JSON[_0x4a80('0xe')](_0x15bdc2));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x4a80('0xe')](_0x15bdc2));}})[_0x4a80('0x42')](function(_0x55907c){console[_0x4a80('0x3f')](_0x55907c);});}function getZohoUser(_0x5ae228,_0x3c089a){return new BPromise(function(_0x3c9f6b,_0x35941c){request(_0x5ae228)['then'](function(_0x5b34c5){var _0x1c02f4=null;if(_0x5b34c5){_0x1c02f4=_0x5b34c5[_0x4a80('0x43')][0x0];_0x1c02f4[_0x4a80('0x44')]=_0x3c089a;}_0x3c9f6b(_0x1c02f4);})[_0x4a80('0x42')](function(_0x291fa4){_0x35941c(_0x291fa4);});});}function createEndUser(_0x1b2e76,_0x2fda94,_0x203e64,_0x1b23f5,_0x845e43,_0x3fb03e){var _0x203e64=getName(_0x203e64);return request({'method':_0x4a80('0x26'),'uri':'https://www.zohoapis.'+_0x2fda94+_0x4a80('0x45')+_['startCase'](_0x3fb03e['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x203e64[0x1],'First_Name':_0x203e64[0x0],'Phone':_0x1b23f5,'Owner':{'name':!_[_0x4a80('0x1d')](_0x845e43['role'][_0x4a80('0x18')])?_0x845e43[_0x4a80('0x46')][_0x4a80('0x18')]:!_['isNil'](_0x845e43[_0x4a80('0x47')])?_0x845e43[_0x4a80('0x47')]+'\x20'+_0x845e43[_0x4a80('0x48')]:_0x845e43[_0x4a80('0x48')],'id':_0x845e43['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1b2e76},'json':!![]})[_0x4a80('0x2c')](function(_0x50b977){if(_0x50b977&&_0x50b977['data'][0x0]['code']===_0x4a80('0x49')){var _0x8a6b8d=_0x50b977[_0x4a80('0x43')][0x0][_0x4a80('0x4a')];_0x8a6b8d[_0x4a80('0x44')]=_[_0x4a80('0x4b')](_0x3fb03e[_0x4a80('0x4c')])+'s';return _0x8a6b8d;}logger[_0x4a80('0x3f')](_0x4a80('0x40'),JSON[_0x4a80('0xe')](data));throw new Error(_0x4a80('0x4d')+JSON[_0x4a80('0xe')](data));})[_0x4a80('0x42')](function(_0x46b01a){console[_0x4a80('0x4e')](_0x4a80('0x4f'),_0x46b01a);});}function getEndUser(_0x30d082,_0x26a8a3,_0x5b09be,_0x477c5e,_0x387e9f,_0x4d83dd,_0x59ccf2){var _0x254678={'method':_0x4a80('0x32'),'uri':'','headers':{'Authorization':_0x4a80('0x35')+_0x30d082},'json':!![]};switch(_0x59ccf2[_0x4a80('0x50')]){case'contact_lead':_0x254678[_0x4a80('0x51')]='https://www.zohoapis.'+_0x26a8a3+_0x4a80('0x52')+_0x387e9f+'))';return getZohoUser(_0x254678,_0x4a80('0x53'))['then'](function(_0x17a7b9){if(_0x17a7b9)return _0x17a7b9;_0x254678[_0x4a80('0x51')]='https://www.zohoapis.'+_0x26a8a3+_0x4a80('0x54')+_0x387e9f+'))';return getZohoUser(_0x254678,'Leads')['then'](function(_0x794d3f){if(_0x794d3f)return _0x794d3f;if(_0x59ccf2[_0x4a80('0x4c')]!=_0x4a80('0x55')){return createEndUser(_0x30d082,_0x26a8a3,_0x477c5e,_0x387e9f,_0x4d83dd,_0x59ccf2);}else{return{};}});});break;case _0x4a80('0x56'):_0x254678['uri']=_0x4a80('0x57')+_0x26a8a3+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x387e9f+'))';return getZohoUser(_0x254678,_0x4a80('0x53'))[_0x4a80('0x2c')](function(_0x8091f1){if(_0x8091f1)return _0x8091f1;if(_0x59ccf2[_0x4a80('0x4c')]!=_0x4a80('0x55')){return createEndUser(_0x30d082,_0x26a8a3,_0x477c5e,_0x387e9f,_0x4d83dd,_0x59ccf2);}else{return{};}});break;case _0x4a80('0x58'):_0x254678[_0x4a80('0x51')]=_0x4a80('0x57')+_0x26a8a3+_0x4a80('0x54')+_0x387e9f+'))';return getZohoUser(_0x254678,_0x4a80('0x59'))['then'](function(_0x4e5c2a){if(_0x4e5c2a)return _0x4e5c2a;if(_0x59ccf2[_0x4a80('0x4c')]!='nothing'){return createEndUser(_0x30d082,_0x26a8a3,_0x477c5e,_0x387e9f,_0x4d83dd,_0x59ccf2);}else{return{};}});break;}}function getCall(_0x50774e,_0x21df71,_0x498f52,_0xfb5511,_0x57c7ed,_0x56fd6e,_0x139f52,_0x1c0213){logger[_0x4a80('0x39')]('Creating\x20new\x20call...');var _0x3e8f91={};_0x3e8f91['Owner']={'name':!_[_0x4a80('0x1d')](_0xfb5511[_0x4a80('0x46')][_0x4a80('0x18')])&&!_[_0x4a80('0x1d')](_0xfb5511[_0x4a80('0x3c')][_0x4a80('0x18')])&&_0xfb5511[_0x4a80('0x3c')]['name']===_0x4a80('0x5a')?_0xfb5511[_0x4a80('0x46')][_0x4a80('0x18')]:!_['isNil'](_0xfb5511[_0x4a80('0x47')])?_0xfb5511[_0x4a80('0x47')]+'\x20'+_0xfb5511[_0x4a80('0x48')]:_0xfb5511[_0x4a80('0x48')],'id':_0xfb5511['id']};_0x3e8f91[_0x4a80('0x5b')]=intUtil['getString'](_0x56fd6e[_0x4a80('0x5c')],_0x139f52,'\x20');_0x3e8f91[_0x4a80('0x5d')]=intUtil[_0x4a80('0x5e')](_0x56fd6e[_0x4a80('0x5f')],_0x139f52,'\x0a');if(_0x57c7ed[_0x4a80('0x44')]===_0x4a80('0x53')){_0x3e8f91['Who_Id']={'name':!_[_0x4a80('0x1d')](_0x57c7ed['Full_Name'])?_0x57c7ed['Full_Name']:!_['isNil'](_0x57c7ed[_0x4a80('0x60')])?_0x57c7ed[_0x4a80('0x60')]+'\x20'+_0x57c7ed['Last_Name']:_0x57c7ed[_0x4a80('0x61')],'id':_0x57c7ed['id']};}if(_0x57c7ed[_0x4a80('0x44')]===_0x4a80('0x59')){_0x3e8f91['What_Id']={'name':!_[_0x4a80('0x1d')](_0x57c7ed[_0x4a80('0x62')])?_0x57c7ed[_0x4a80('0x62')]:!_[_0x4a80('0x1d')](_0x57c7ed[_0x4a80('0x60')])?_0x57c7ed[_0x4a80('0x60')]+'\x20'+_0x57c7ed[_0x4a80('0x61')]:_0x57c7ed[_0x4a80('0x61')],'id':_0x57c7ed['id']};_0x3e8f91[_0x4a80('0x63')]=_['startCase'](_0x57c7ed['enduserType']);}if(_0x139f52[_0x4a80('0x64')]){_0x3e8f91[_0x4a80('0x65')]=moment[_0x4a80('0x66')](parseInt(_0x139f52[_0x4a80('0x64')])*0x3e8)['format']('mm:ss');}else if(_0x139f52[_0x4a80('0x67')]&&_0x139f52['endtime']){_0x3e8f91[_0x4a80('0x65')]=moment[_0x4a80('0x66')](moment(_0x139f52['endtime'],_0x4a80('0x68'))['diff'](moment(_0x139f52['starttime'],_0x4a80('0x68'))))[_0x4a80('0x69')](_0x4a80('0x6a'));}switch(_0x139f52[_0x4a80('0x6b')]){case _0x4a80('0x6c'):_0x3e8f91[_0x4a80('0x6d')]=_0x4a80('0x6e');break;case _0x4a80('0x6f'):case _0x4a80('0x70'):_0x3e8f91[_0x4a80('0x6d')]=_0x4a80('0x71');break;case _0x4a80('0x72'):_0x3e8f91[_0x4a80('0x6d')]=_0x4a80('0x73');break;case _0x4a80('0x74'):_0x3e8f91['Call_Result']=_0x4a80('0x75');break;case'timeout':_0x3e8f91[_0x4a80('0x6d')]=_0x4a80('0x76');default:}_0x3e8f91[_0x4a80('0x77')]=(_0x1c0213===_0x4a80('0x78')?moment(_0x139f52[_0x4a80('0x79')])[_0x4a80('0x69')](_0x4a80('0x68')):moment(_0x139f52['agentcalledAt'])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x4a80('0x69')](_0x4a80('0x68'));_0x3e8f91[_0x4a80('0x7a')]=_0x1c0213||'Inbound';_0x3e8f91=_[_0x4a80('0x7b')](_0x3e8f91,getCustomFields(_0x56fd6e[_0x4a80('0x7c')],_0x139f52));return request({'method':_0x4a80('0x26'),'uri':_0x4a80('0x57')+_0x21df71+_0x4a80('0x7d'),'headers':{'Authorization':_0x4a80('0x35')+_0x50774e},'body':{'data':[_0x3e8f91]},'json':!![]})[_0x4a80('0x2c')](function(_0x72a6f1){if(_0x72a6f1&&_0x72a6f1[_0x4a80('0x43')][0x0][_0x4a80('0x7e')]===_0x4a80('0x49')){logger[_0x4a80('0x39')](_0x4a80('0x7f'));return{'id':_0x72a6f1[_0x4a80('0x43')][0x0][_0x4a80('0x4a')]['id']};}})[_0x4a80('0x42')](function(_0x3baf8d){logger[_0x4a80('0x39')](_0x4a80('0x80'),_0x3baf8d[_0x4a80('0x30')]);console[_0x4a80('0x4e')]('err',_0x3baf8d);});}exports[_0x4a80('0x81')]=function(_0x448065,_0x289bca,_0x44c1ec,_0x2fc47d,_0x3f36c0,_0x337db5){var _0x21bec3,_0x7c47b7,_0x242e94;_0x337db5[_0x4a80('0x82')]=intUtil[_0x4a80('0x83')](_0x337db5[_0x4a80('0x82')]);_0x337db5['serverUrl']=intUtil[_0x4a80('0x83')](_0x337db5[_0x4a80('0x84')]);if(_0x3f36c0&&_0x3f36c0['monitor_format']){logger[_0x4a80('0x39')](_0x4a80('0x85'),_0x4a80('0x86'));_0x289bca[_0x4a80('0x87')]=_0x337db5[_0x4a80('0x84')]+_0x4a80('0x88')+_0x289bca[_0x4a80('0x89')]+'/downloads?type=uniqueid&token='+md5(_0x289bca[_0x4a80('0x89')]);}else{_0x289bca[_0x4a80('0x87')]='';}var _0x4ac0a0=_0x337db5['host']===_0x4a80('0x8a')?'eu':_0x4a80('0x8b');return getAccessToken(_0x337db5)[_0x4a80('0x2c')](function(_0x1ef69e){_0x242e94=_0x1ef69e;return getUser(_0x242e94,_0x4ac0a0,_0x337db5,_0x2fc47d['email']);})[_0x4a80('0x2c')](function(_0x2ccad2){_0x21bec3=_0x2ccad2;logger[_0x4a80('0x39')](_0x4a80('0x8c'),_0x21bec3['id']);return getEndUser(_0x242e94,_0x4ac0a0,_0x337db5,_0x289bca['calleridname'],_0x289bca[_0x4a80('0x8d')],_0x21bec3,_0x44c1ec);})['then'](function(_0x526157){_0x7c47b7=_0x526157;return getCall(_0x242e94,_0x4ac0a0,_0x337db5,_0x21bec3,_0x7c47b7,_0x44c1ec,_0x289bca,_0x4a80('0x8e'));})['then'](function(_0x4f5638){if(_0x4f5638){logger[_0x4a80('0x39')](_0x4a80('0x8f'),_0x4f5638['id']);logger[_0x4a80('0x39')]('[QUEUE]',_0x4a80('0x90'));emit(util['format'](_0x4a80('0x91'),_0x2fc47d[_0x4a80('0x18')]),_0x4a80('0x92'),{'uri':_0x4a80('0x93')+_0x337db5[_0x4a80('0x82')]+_0x4a80('0x94')+_0x4f5638['id']});}})[_0x4a80('0x42')](function(_0x7ad495){logger['error'](_0x4a80('0x85'),JSON[_0x4a80('0xe')](_0x7ad495));});};exports[_0x4a80('0x78')]=function(_0x5a298f,_0x15542c,_0x5586bc,_0x52fb98,_0x8716b8,_0x1de64d,_0x390edc){var _0x449c03,_0x3315f1,_0x4e96c4;_0x1de64d['host']=intUtil[_0x4a80('0x83')](_0x1de64d[_0x4a80('0x82')]);_0x1de64d[_0x4a80('0x84')]=intUtil[_0x4a80('0x83')](_0x1de64d['serverUrl']);if(_0x390edc&&_0x390edc[_0x4a80('0x95')]&&_0x390edc[_0x4a80('0x95')]!==_0x4a80('0x96')){logger[_0x4a80('0x39')](_0x4a80('0x97'),_0x4a80('0x86'));_0x15542c[_0x4a80('0x87')]=_0x1de64d[_0x4a80('0x84')]+_0x4a80('0x88')+_0x15542c[_0x4a80('0x89')]+'/downloads?type=uniqueid&token='+md5(_0x15542c['uniqueid']);}var _0x8d83c8=_0x1de64d['host']===_0x4a80('0x8a')?'eu':_0x4a80('0x8b');return getAccessToken(_0x1de64d)[_0x4a80('0x2c')](function(_0x2129a9){_0x4e96c4=_0x2129a9;return getUser(_0x4e96c4,_0x8d83c8,_0x1de64d,_0x52fb98['email']);})[_0x4a80('0x2c')](function(_0x338b9c){_0x449c03=_0x338b9c;logger[_0x4a80('0x39')](_0x4a80('0x8c'),_0x449c03['id']);return getEndUser(_0x4e96c4,_0x8d83c8,_0x1de64d,_0x15542c[_0x4a80('0x98')],_0x15542c[_0x4a80('0x99')],_0x449c03,_0x5586bc);})[_0x4a80('0x2c')](function(_0x436815){_0x3315f1=_0x436815;return getCall(_0x4e96c4,_0x8d83c8,_0x1de64d,_0x449c03,_0x3315f1,_0x5586bc,_0x15542c,'Outbound');})[_0x4a80('0x2c')](function(_0x16d044){if(_0x16d044){logger[_0x4a80('0x39')]('The\x20Call\x20ID\x20is:',_0x16d044['id']);logger['info'](_0x4a80('0x97'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4a80('0x69')](_0x4a80('0x91'),_0x52fb98[_0x4a80('0x18')]),_0x4a80('0x92'),{'uri':_0x4a80('0x93')+_0x1de64d['host']+_0x4a80('0x94')+_0x16d044['id']});}})[_0x4a80('0x42')](function(_0x1d5355){logger[_0x4a80('0x3f')]('[OUTBOUND]',JSON[_0x4a80('0xe')](_0x1d5355));});};exports[_0x4a80('0x9a')]=function(_0x32f4d1,_0x815f14,_0x5ed791,_0x193d6c,_0x46da8f,_0x5ef8a6){var _0x331d54,_0x2fa7b1,_0xb1f2e6;_0x5ef8a6['host']=intUtil[_0x4a80('0x83')](_0x5ef8a6[_0x4a80('0x82')]);_0x5ef8a6[_0x4a80('0x84')]=intUtil[_0x4a80('0x83')](_0x5ef8a6[_0x4a80('0x84')]);if(_0x46da8f&&_0x46da8f[_0x4a80('0x9b')]){logger[_0x4a80('0x39')]('['+_0x815f14[_0x4a80('0x6b')][_0x4a80('0x9c')]()+']',_0x4a80('0x86'));_0x815f14[_0x4a80('0x87')]=_0x5ef8a6[_0x4a80('0x84')]+_0x4a80('0x88')+_0x815f14[_0x4a80('0x89')]+'/downloads?type=uniqueid&token='+md5(_0x815f14['uniqueid']);}else{_0x815f14['recordingURL']='';}var _0x1a5b20=_0x5ef8a6[_0x4a80('0x82')]==='zoho.eu'?'eu':_0x4a80('0x8b');return getAccessToken(_0x5ef8a6)[_0x4a80('0x2c')](function(_0x58f3b3){_0xb1f2e6=_0x58f3b3;return getUser(_0xb1f2e6,_0x1a5b20,_0x5ef8a6);})[_0x4a80('0x2c')](function(_0x2fa833){_0x331d54=_0x2fa833;logger['info'](_0x4a80('0x8c'),_0x331d54['id']);return getEndUser(_0xb1f2e6,_0x1a5b20,_0x5ef8a6,_0x815f14[_0x4a80('0x9d')],_0x815f14['calleridnum'],_0x331d54,_0x5ed791);})[_0x4a80('0x2c')](function(_0xf01f79){_0x2fa7b1=_0xf01f79;return getCall(_0xb1f2e6,_0x1a5b20,_0x5ef8a6,_0x331d54,_0x2fa7b1,_0x5ed791,_0x815f14,_0x4a80('0x8e'));})[_0x4a80('0x2c')](function(_0x22b273){if(_0x22b273){logger[_0x4a80('0x39')](_0x4a80('0x8f'),_0x22b273['id']);}})[_0x4a80('0x42')](function(_0x3600c0){logger[_0x4a80('0x3f')]('['+_0x815f14[_0x4a80('0x6b')]['toUpperCase']()+']',JSON['stringify'](_0x3600c0));});}; \ No newline at end of file +var _0x0642=['md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','length','forEach','includes','string','idField','toString','variable','variableName','type','customVariable','Variable','name','toLowerCase','indexOf','isNil','isBefore','expires_in','access_token','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','nothing','lead','Creating\x20new\x20call...','administrator','first_name','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','called','Called','complete','Call_Result','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','Inbound','Fields','POST','/crm/v2/Calls','Call\x20created!','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridnum','Outbound','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','lodash'];(function(_0x13ed6f,_0x515c3c){var _0x3b42dd=function(_0x570416){while(--_0x570416){_0x13ed6f['push'](_0x13ed6f['shift']());}};_0x3b42dd(++_0x515c3c);}(_0x0642,0x1dc));var _0x2064=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0x0642[_0x3fb9dd];return _0x20136a;};'use strict';var _=require(_0x2064('0x0'));var rp=require('request-promise');var md5=require(_0x2064('0x1'));var util=require(_0x2064('0x2'));var intUtil=require(_0x2064('0x3'));var moment=require(_0x2064('0x4'));var Redis=require(_0x2064('0x5'));var BPromise=require(_0x2064('0x6'));var config=require(_0x2064('0x7'));var logger=require(_0x2064('0x8'))('zoho');config[_0x2064('0x9')]=_[_0x2064('0xa')](config[_0x2064('0x9')],{'host':_0x2064('0xb'),'port':0x18eb});var io=require(_0x2064('0xc'))(new Redis(config[_0x2064('0x9')]));function emit(_0x507929,_0x351905,_0x3286e0){io['to'](_0x507929)[_0x2064('0xd')](_0x351905,_0x3286e0);}function request(_0x87a83e){logger[_0x2064('0xe')](_0x2064('0xf'),JSON['stringify'](_0x87a83e));return rp(_0x87a83e);}function getCustomFields(_0x4c557c,_0x1672bb){var _0x59090c={};if(_0x4c557c[_0x2064('0x10')]>0x0){_[_0x2064('0x11')](_0x4c557c,function(_0x3ed7dd){if(_[_0x2064('0x12')]([_0x2064('0x13'),'picklist'],_0x3ed7dd['type'])&&_0x3ed7dd[_0x2064('0x14')]){_0x59090c[_0x3ed7dd[_0x2064('0x14')]]=_0x3ed7dd['content'][_0x2064('0x15')]();}else if(_0x3ed7dd['type']===_0x2064('0x16')&&_0x3ed7dd['variableName']&&_0x3ed7dd[_0x2064('0x14')]&&_0x1672bb[_0x3ed7dd['variableName']]){_0x59090c[_0x3ed7dd[_0x2064('0x14')]]=_0x1672bb[_0x3ed7dd[_0x2064('0x17')]][_0x2064('0x15')]();}else if(_0x3ed7dd[_0x2064('0x18')]===_0x2064('0x19')&&_0x3ed7dd[_0x2064('0x1a')]&&_0x3ed7dd[_0x2064('0x1a')]['name']&&_0x3ed7dd[_0x2064('0x14')]&&_0x1672bb[_0x3ed7dd[_0x2064('0x1a')][_0x2064('0x1b')][_0x2064('0x1c')]()]){_0x59090c[_0x3ed7dd['idField']]=_0x1672bb[_0x3ed7dd['Variable'][_0x2064('0x1b')][_0x2064('0x1c')]()][_0x2064('0x15')]();}});}return _0x59090c;}function getName(_0xb51d6a){if(_0xb51d6a[_0x2064('0x1d')]('\x20')>0x0){var _0x511d7f=_0xb51d6a['split'](/ (.+)/);if(_0x511d7f[0x1]){return _0x511d7f;}}return[_0xb51d6a,_0xb51d6a];}var accountsTokens={};function getAccessToken(_0x453b9f){return new Promise(function(_0x3bd41c,_0x4a74a9){if(!_[_0x2064('0x1e')](accountsTokens[_0x453b9f['id']])&&!_[_0x2064('0x1e')](accountsTokens[_0x453b9f['id']]['access_token'])){if(moment()[_0x2064('0x1f')](accountsTokens[_0x453b9f['id']][_0x2064('0x20')])){_0x3bd41c(accountsTokens[_0x453b9f['id']][_0x2064('0x21')]);}}var _0x26c0cd;switch(_0x453b9f['zone']){case'US':_0x26c0cd=_0x2064('0x22');break;case'AU':_0x26c0cd=_0x2064('0x23');break;case'EU':_0x26c0cd=_0x2064('0x24');break;case'IN':_0x26c0cd=_0x2064('0x25');break;case'CN':_0x26c0cd=_0x2064('0x26');break;default:_0x26c0cd=_0x2064('0x24');break;}var _0x77745a={'method':'POST','uri':_0x26c0cd+_0x2064('0x27'),'qs':{'refresh_token':_0x453b9f[_0x2064('0x28')],'client_id':_0x453b9f[_0x2064('0x29')],'client_secret':_0x453b9f[_0x2064('0x2a')],'grant_type':_0x2064('0x2b')},'json':!![]};return rp(_0x77745a)[_0x2064('0x2c')](function(_0xa679ab){accountsTokens[_0x453b9f['id']]={'access_token':_0xa679ab[_0x2064('0x21')],'expires_in':moment()[_0x2064('0x2d')](_0xa679ab[_0x2064('0x20')],_0x2064('0x2e'))};_0x3bd41c(_0xa679ab['access_token']);})[_0x2064('0x2f')](function(_0x41fb00){logger[_0x2064('0x30')](_0x2064('0x31'),_0x41fb00[_0x2064('0x32')]);_0x4a74a9(_0x41fb00);});});}function getUser(_0x57d0c8,_0x1e6f30,_0x109c2c,_0x99e055){logger[_0x2064('0x33')](_0x2064('0x34'));return request({'method':'GET','uri':util['format'](_0x2064('0x35'),_0x1e6f30),'qs':{'type':_0x2064('0x36')},'headers':{'Authorization':_0x2064('0x37')+_0x57d0c8},'json':!![]})[_0x2064('0x2c')](function(_0x1c9569){if(_0x1c9569[_0x2064('0x38')]){var _0x2cff1c=-0x1;if(_[_0x2064('0x39')](_0x1c9569[_0x2064('0x38')])){if(!_[_0x2064('0x1e')](_0x99e055)){_0x2cff1c=_[_0x2064('0x3a')](_0x1c9569['users'],function(_0x41b1e9){return _0x41b1e9[_0x2064('0x3b')]===_0x99e055;});}if(_0x2cff1c>=0x0){logger[_0x2064('0x33')](_0x2064('0x3c'));}else{logger[_0x2064('0x33')](_0x2064('0x3d'));_0x2cff1c=_['findIndex'](_0x1c9569['users'],function(_0x1697f8){return _0x1697f8['profile'][_0x2064('0x1b')]===_0x2064('0x3e');});}return _0x1c9569[_0x2064('0x38')][_0x2cff1c];}else{if(_0x1c9569[_0x2064('0x3f')][_0x2064('0x40')][_0x2064('0x1b')]==='Administrator'){logger[_0x2064('0x33')]('Using\x20the\x20admin\x20account!');user=_0x1c9569[_0x2064('0x3f')];return user;}else{logger[_0x2064('0x30')]('The\x20failing\x20result\x20is',JSON[_0x2064('0x41')](_0x1c9569));throw new Error(_0x2064('0x42')+JSON[_0x2064('0x41')](_0x1c9569));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x2064('0x41')](_0x1c9569));throw new Error(_0x2064('0x42')+JSON['stringify'](_0x1c9569));}})[_0x2064('0x2f')](function(_0x5c9a7b){console[_0x2064('0x30')](_0x5c9a7b);});}function getZohoUser(_0x21d0fa,_0xae2d3a){return new BPromise(function(_0xea145e,_0x11c29c){request(_0x21d0fa)['then'](function(_0x287af5){var _0x2b01a9=null;if(_0x287af5){_0x2b01a9=_0x287af5[_0x2064('0x43')][0x0];_0x2b01a9[_0x2064('0x44')]=_0xae2d3a;}_0xea145e(_0x2b01a9);})[_0x2064('0x2f')](function(_0xecae85){_0x11c29c(_0xecae85);});});}function createEndUser(_0x1e5971,_0x1dea61,_0x542ca5,_0xd671f0,_0x24b2fa,_0x1892da){var _0x542ca5=getName(_0x542ca5);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x1dea61+_0x2064('0x45')+_[_0x2064('0x46')](_0x1892da[_0x2064('0x47')])+'s','body':{'data':[{'Last_Name':_0x542ca5[0x1],'First_Name':_0x542ca5[0x0],'Phone':_0xd671f0,'Owner':{'name':!_[_0x2064('0x1e')](_0x24b2fa[_0x2064('0x48')][_0x2064('0x1b')])?_0x24b2fa[_0x2064('0x48')][_0x2064('0x1b')]:!_[_0x2064('0x1e')](_0x24b2fa['first_name'])?_0x24b2fa['first_name']+'\x20'+_0x24b2fa[_0x2064('0x49')]:_0x24b2fa[_0x2064('0x49')],'id':_0x24b2fa['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1e5971},'json':!![]})['then'](function(_0x4c7eb7){if(_0x4c7eb7&&_0x4c7eb7[_0x2064('0x43')][0x0][_0x2064('0x4a')]===_0x2064('0x4b')){var _0x1f1b92=_0x4c7eb7[_0x2064('0x43')][0x0][_0x2064('0x4c')];_0x1f1b92[_0x2064('0x44')]=_[_0x2064('0x46')](_0x1892da[_0x2064('0x47')])+'s';return _0x1f1b92;}logger[_0x2064('0x30')]('The\x20failing\x20result\x20is',JSON[_0x2064('0x41')](data));throw new Error(_0x2064('0x4d')+JSON['stringify'](data));})['catch'](function(_0x5b5965){console[_0x2064('0x4e')](_0x2064('0x4f'),_0x5b5965);});}function getEndUser(_0x449240,_0x3a4626,_0x25c64b,_0x488c4c,_0x44faa3,_0x3f5562,_0x3f6547){var _0x68a8cc={'method':_0x2064('0x50'),'uri':'','headers':{'Authorization':_0x2064('0x37')+_0x449240},'json':!![]};switch(_0x3f6547[_0x2064('0x51')]){case _0x2064('0x52'):_0x68a8cc[_0x2064('0x53')]='https://www.zohoapis.'+_0x3a4626+_0x2064('0x54')+_0x44faa3+'))';return getZohoUser(_0x68a8cc,_0x2064('0x55'))[_0x2064('0x2c')](function(_0x23c2ae){if(_0x23c2ae)return _0x23c2ae;_0x68a8cc['uri']=_0x2064('0x56')+_0x3a4626+_0x2064('0x57')+_0x44faa3+'))';return getZohoUser(_0x68a8cc,'Leads')[_0x2064('0x2c')](function(_0x17044a){if(_0x17044a)return _0x17044a;if(_0x3f6547[_0x2064('0x47')]!='nothing'){return createEndUser(_0x449240,_0x3a4626,_0x488c4c,_0x44faa3,_0x3f5562,_0x3f6547);}else{return{};}});});break;case _0x2064('0x58'):_0x68a8cc[_0x2064('0x53')]=_0x2064('0x56')+_0x3a4626+_0x2064('0x54')+_0x44faa3+'))';return getZohoUser(_0x68a8cc,_0x2064('0x55'))[_0x2064('0x2c')](function(_0x4caf2c){if(_0x4caf2c)return _0x4caf2c;if(_0x3f6547[_0x2064('0x47')]!=_0x2064('0x59')){return createEndUser(_0x449240,_0x3a4626,_0x488c4c,_0x44faa3,_0x3f5562,_0x3f6547);}else{return{};}});break;case _0x2064('0x5a'):_0x68a8cc['uri']=_0x2064('0x56')+_0x3a4626+_0x2064('0x57')+_0x44faa3+'))';return getZohoUser(_0x68a8cc,'Leads')[_0x2064('0x2c')](function(_0x363ddc){if(_0x363ddc)return _0x363ddc;if(_0x3f6547['moduleCreate']!=_0x2064('0x59')){return createEndUser(_0x449240,_0x3a4626,_0x488c4c,_0x44faa3,_0x3f5562,_0x3f6547);}else{return{};}});break;}}function getCall(_0x5a0b0c,_0x248a72,_0x5a47c1,_0x520e42,_0x54a2dc,_0x4b1106,_0x4983a5,_0x5e0901){logger['info'](_0x2064('0x5b'));var _0x103bb7={};_0x103bb7['Owner']={'name':!_[_0x2064('0x1e')](_0x520e42[_0x2064('0x48')]['name'])&&!_['isNil'](_0x520e42[_0x2064('0x40')][_0x2064('0x1b')])&&_0x520e42[_0x2064('0x40')][_0x2064('0x1b')]===_0x2064('0x5c')?_0x520e42['role'][_0x2064('0x1b')]:!_[_0x2064('0x1e')](_0x520e42['first_name'])?_0x520e42[_0x2064('0x5d')]+'\x20'+_0x520e42[_0x2064('0x49')]:_0x520e42[_0x2064('0x49')],'id':_0x520e42['id']};_0x103bb7[_0x2064('0x5e')]=intUtil[_0x2064('0x5f')](_0x4b1106[_0x2064('0x60')],_0x4983a5,'\x20');_0x103bb7[_0x2064('0x61')]=intUtil[_0x2064('0x5f')](_0x4b1106[_0x2064('0x62')],_0x4983a5,'\x0a');if(_0x54a2dc[_0x2064('0x44')]===_0x2064('0x55')){_0x103bb7['Who_Id']={'name':!_[_0x2064('0x1e')](_0x54a2dc[_0x2064('0x63')])?_0x54a2dc[_0x2064('0x63')]:!_[_0x2064('0x1e')](_0x54a2dc[_0x2064('0x64')])?_0x54a2dc[_0x2064('0x64')]+'\x20'+_0x54a2dc['Last_Name']:_0x54a2dc[_0x2064('0x65')],'id':_0x54a2dc['id']};}if(_0x54a2dc['enduserType']==='Leads'){_0x103bb7[_0x2064('0x66')]={'name':!_['isNil'](_0x54a2dc[_0x2064('0x63')])?_0x54a2dc['Full_Name']:!_[_0x2064('0x1e')](_0x54a2dc[_0x2064('0x64')])?_0x54a2dc[_0x2064('0x64')]+'\x20'+_0x54a2dc['Last_Name']:_0x54a2dc[_0x2064('0x65')],'id':_0x54a2dc['id']};_0x103bb7[_0x2064('0x67')]=_[_0x2064('0x46')](_0x54a2dc[_0x2064('0x44')]);}if(_0x4983a5[_0x2064('0x68')]){_0x103bb7[_0x2064('0x69')]=moment['utc'](parseInt(_0x4983a5[_0x2064('0x68')])*0x3e8)['format'](_0x2064('0x6a'));}else if(_0x4983a5[_0x2064('0x6b')]&&_0x4983a5[_0x2064('0x6c')]){_0x103bb7[_0x2064('0x69')]=moment[_0x2064('0x6d')](moment(_0x4983a5[_0x2064('0x6c')],_0x2064('0x6e'))[_0x2064('0x6f')](moment(_0x4983a5[_0x2064('0x70')],_0x2064('0x6e'))))[_0x2064('0x71')]('mm:ss');}switch(_0x4983a5['lastevent']){case _0x2064('0x72'):_0x103bb7['Call_Result']=_0x2064('0x73');break;case _0x2064('0x74'):case'connect':_0x103bb7[_0x2064('0x75')]=_0x2064('0x76');break;case'rejected':_0x103bb7['Call_Result']=_0x2064('0x77');break;case _0x2064('0x78'):_0x103bb7[_0x2064('0x75')]=_0x2064('0x79');break;case _0x2064('0x7a'):_0x103bb7[_0x2064('0x75')]=_0x2064('0x7b');default:}_0x103bb7['Call_Start_Time']=(_0x5e0901===_0x2064('0x7c')?moment(_0x4983a5[_0x2064('0x70')])[_0x2064('0x71')](_0x2064('0x6e')):moment(_0x4983a5['agentcalledAt'])[_0x2064('0x71')](_0x2064('0x6e')))||moment()[_0x2064('0x71')](_0x2064('0x6e'));_0x103bb7['Call_Type']=_0x5e0901||_0x2064('0x7d');_0x103bb7=_['merge'](_0x103bb7,getCustomFields(_0x4b1106[_0x2064('0x7e')],_0x4983a5));return request({'method':_0x2064('0x7f'),'uri':_0x2064('0x56')+_0x248a72+_0x2064('0x80'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5a0b0c},'body':{'data':[_0x103bb7]},'json':!![]})['then'](function(_0x4d27af){if(_0x4d27af&&_0x4d27af[_0x2064('0x43')][0x0][_0x2064('0x4a')]===_0x2064('0x4b')){logger['info'](_0x2064('0x81'));return{'id':_0x4d27af['data'][0x0][_0x2064('0x4c')]['id']};}})[_0x2064('0x2f')](function(_0x518070){logger['info']('err',_0x518070['stack']);console['log']('err',_0x518070);});}exports[_0x2064('0x82')]=function(_0x4ce3db,_0x58ac08,_0x59f249,_0xc92157,_0x5f3a23,_0x38c95a){var _0x3750e8,_0x58b29e,_0x4d178e;_0x38c95a[_0x2064('0x83')]=intUtil[_0x2064('0x84')](_0x38c95a['host']);_0x38c95a[_0x2064('0x85')]=intUtil['stripTrailingSlash'](_0x38c95a[_0x2064('0x85')]);if(_0x5f3a23&&_0x5f3a23[_0x2064('0x86')]){logger[_0x2064('0x33')](_0x2064('0x87'),_0x2064('0x88'));_0x58ac08[_0x2064('0x89')]=_0x38c95a[_0x2064('0x85')]+_0x2064('0x8a')+_0x58ac08['uniqueid']+_0x2064('0x8b')+md5(_0x58ac08['uniqueid']);}else{_0x58ac08[_0x2064('0x89')]='';}var _0x5e97ad=_0x38c95a[_0x2064('0x83')]===_0x2064('0x8c')?'eu':_0x2064('0x8d');return getAccessToken(_0x38c95a)[_0x2064('0x2c')](function(_0x587b59){_0x4d178e=_0x587b59;return getUser(_0x4d178e,_0x5e97ad,_0x38c95a,_0xc92157[_0x2064('0x3b')]);})['then'](function(_0x2178f4){_0x3750e8=_0x2178f4;logger['info'](_0x2064('0x8e'),_0x3750e8['id']);return getEndUser(_0x4d178e,_0x5e97ad,_0x38c95a,_0x58ac08[_0x2064('0x8f')],_0x58ac08[_0x2064('0x90')],_0x3750e8,_0x59f249);})[_0x2064('0x2c')](function(_0x1c84c4){_0x58b29e=_0x1c84c4;return getCall(_0x4d178e,_0x5e97ad,_0x38c95a,_0x3750e8,_0x58b29e,_0x59f249,_0x58ac08,'Inbound');})['then'](function(_0xc83601){if(_0xc83601){logger[_0x2064('0x33')](_0x2064('0x91'),_0xc83601['id']);logger[_0x2064('0x33')]('[QUEUE]',_0x2064('0x92'));emit(util[_0x2064('0x71')]('user:%s',_0xc92157[_0x2064('0x1b')]),_0x2064('0x93'),{'uri':_0x2064('0x94')+_0x38c95a[_0x2064('0x83')]+'/crm/EntityInfo.do?module=Calls&id='+_0xc83601['id']});}})['catch'](function(_0xbf0a03){logger[_0x2064('0x30')](_0x2064('0x87'),JSON[_0x2064('0x41')](_0xbf0a03));});};exports[_0x2064('0x7c')]=function(_0x167b4b,_0x5bbd9f,_0x5437ae,_0x2b8210,_0x1feb10,_0x3d2b7c,_0x5ebfa2){var _0x17039e,_0x3f25e8,_0x43ace5;_0x3d2b7c['host']=intUtil['stripTrailingSlash'](_0x3d2b7c[_0x2064('0x83')]);_0x3d2b7c[_0x2064('0x85')]=intUtil['stripTrailingSlash'](_0x3d2b7c[_0x2064('0x85')]);if(_0x5ebfa2&&_0x5ebfa2[_0x2064('0x95')]&&_0x5ebfa2[_0x2064('0x95')]!==_0x2064('0x96')){logger[_0x2064('0x33')](_0x2064('0x97'),_0x2064('0x88'));_0x5bbd9f['recordingURL']=_0x3d2b7c['serverUrl']+_0x2064('0x8a')+_0x5bbd9f['uniqueid']+_0x2064('0x8b')+md5(_0x5bbd9f[_0x2064('0x98')]);}var _0x2b7a09=_0x3d2b7c[_0x2064('0x83')]===_0x2064('0x8c')?'eu':_0x2064('0x8d');return getAccessToken(_0x3d2b7c)[_0x2064('0x2c')](function(_0x20b9ed){_0x43ace5=_0x20b9ed;return getUser(_0x43ace5,_0x2b7a09,_0x3d2b7c,_0x2b8210[_0x2064('0x3b')]);})[_0x2064('0x2c')](function(_0x50a077){_0x17039e=_0x50a077;logger[_0x2064('0x33')](_0x2064('0x8e'),_0x17039e['id']);return getEndUser(_0x43ace5,_0x2b7a09,_0x3d2b7c,_0x5bbd9f['destcalleridname'],_0x5bbd9f[_0x2064('0x99')],_0x17039e,_0x5437ae);})[_0x2064('0x2c')](function(_0x3ab193){_0x3f25e8=_0x3ab193;return getCall(_0x43ace5,_0x2b7a09,_0x3d2b7c,_0x17039e,_0x3f25e8,_0x5437ae,_0x5bbd9f,_0x2064('0x9a'));})[_0x2064('0x2c')](function(_0x57f03f){if(_0x57f03f){logger['info'](_0x2064('0x91'),_0x57f03f['id']);logger[_0x2064('0x33')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2064('0x71')]('user:%s',_0x2b8210['name']),_0x2064('0x93'),{'uri':'https://crm.'+_0x3d2b7c[_0x2064('0x83')]+_0x2064('0x9b')+_0x57f03f['id']});}})[_0x2064('0x2f')](function(_0x58e69b){logger[_0x2064('0x30')](_0x2064('0x97'),JSON[_0x2064('0x41')](_0x58e69b));});};exports[_0x2064('0x9c')]=function(_0x43ecd4,_0x2b9bb9,_0xd4c456,_0xeaf674,_0x1be0f3,_0x268048){var _0xdbffe9,_0x3fb41c,_0x1bc26f;_0x268048['host']=intUtil[_0x2064('0x84')](_0x268048[_0x2064('0x83')]);_0x268048[_0x2064('0x85')]=intUtil[_0x2064('0x84')](_0x268048[_0x2064('0x85')]);if(_0x1be0f3&&_0x1be0f3[_0x2064('0x86')]){logger[_0x2064('0x33')]('['+_0x2b9bb9[_0x2064('0x9d')][_0x2064('0x9e')]()+']',_0x2064('0x88'));_0x2b9bb9[_0x2064('0x89')]=_0x268048[_0x2064('0x85')]+_0x2064('0x8a')+_0x2b9bb9[_0x2064('0x98')]+'/downloads?type=uniqueid&token='+md5(_0x2b9bb9[_0x2064('0x98')]);}else{_0x2b9bb9[_0x2064('0x89')]='';}var _0x1ce2db=_0x268048[_0x2064('0x83')]===_0x2064('0x8c')?'eu':'com';return getAccessToken(_0x268048)[_0x2064('0x2c')](function(_0xc67a72){_0x1bc26f=_0xc67a72;return getUser(_0x1bc26f,_0x1ce2db,_0x268048);})[_0x2064('0x2c')](function(_0x225ce0){_0xdbffe9=_0x225ce0;logger[_0x2064('0x33')](_0x2064('0x8e'),_0xdbffe9['id']);return getEndUser(_0x1bc26f,_0x1ce2db,_0x268048,_0x2b9bb9[_0x2064('0x8f')],_0x2b9bb9[_0x2064('0x90')],_0xdbffe9,_0xd4c456);})[_0x2064('0x2c')](function(_0x1f18cb){_0x3fb41c=_0x1f18cb;return getCall(_0x1bc26f,_0x1ce2db,_0x268048,_0xdbffe9,_0x3fb41c,_0xd4c456,_0x2b9bb9,_0x2064('0x7d'));})[_0x2064('0x2c')](function(_0x247a22){if(_0x247a22){logger['info'](_0x2064('0x91'),_0x247a22['id']);}})[_0x2064('0x2f')](function(_0x1e82d6){logger[_0x2064('0x30')]('['+_0x2b9bb9[_0x2064('0x9d')][_0x2064('0x9e')]()+']',JSON['stringify'](_0x1e82d6));});}; \ 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 796a672..73dd567 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 _0xd249=['exec','data2','Script','data3','error','format','util','shelljs','mustache'];(function(_0x169909,_0x1b06ec){var _0x28470e=function(_0x52758c){while(--_0x52758c){_0x169909['push'](_0x169909['shift']());}};_0x28470e(++_0x1b06ec);}(_0xd249,0x7b));var _0x9d24=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xd249[_0x7e2eb0];return _0xd92de4;};'use strict';var util=require(_0x9d24('0x0'));var sh=require(_0x9d24('0x1'));var Mustache=require(_0x9d24('0x2'));var logger=require('../../../../config/logger')('trigger');exports[_0x9d24('0x3')]=function(_0x16d7c4,_0x3d4c4d){var _0x3d6ecc=_0x16d7c4['data2']?_0x16d7c4[_0x9d24('0x4')]:_0x9d24('0x5');var _0x1f1e35=_0x16d7c4[_0x9d24('0x6')]?Mustache['render'](_0x16d7c4[_0x9d24('0x6')],_0x3d4c4d):_0x3d4c4d;sh[_0x9d24('0x3')](_0x1f1e35,function(_0x17b0cb,_0x440b90,_0x415f43){if(_0x17b0cb!==0x0){logger[_0x9d24('0x7')](util[_0x9d24('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x3d6ecc,_0x1f1e35,_0x17b0cb,_0x415f43));}else{logger['info'](util[_0x9d24('0x8')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x3d6ecc,_0x1f1e35,_0x440b90));}});}; \ No newline at end of file +var _0x11f2=['mustache','../../../../config/logger','trigger','exec','data2','render','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x2017f1,_0x160182){var _0x1cdd28=function(_0x579231){while(--_0x579231){_0x2017f1['push'](_0x2017f1['shift']());}};_0x1cdd28(++_0x160182);}(_0x11f2,0x166));var _0x211f=function(_0x1bef89,_0x483ea0){_0x1bef89=_0x1bef89-0x0;var _0xdc5fd3=_0x11f2[_0x1bef89];return _0xdc5fd3;};'use strict';var util=require(_0x211f('0x0'));var sh=require(_0x211f('0x1'));var Mustache=require(_0x211f('0x2'));var logger=require(_0x211f('0x3'))(_0x211f('0x4'));exports[_0x211f('0x5')]=function(_0x2056ce,_0x1af0e7){var _0x4826cc=_0x2056ce[_0x211f('0x6')]?_0x2056ce['data2']:'Script';var _0x6be3da=_0x2056ce['data3']?Mustache[_0x211f('0x7')](_0x2056ce['data3'],_0x1af0e7):_0x1af0e7;sh[_0x211f('0x5')](_0x6be3da,function(_0x3dc376,_0x6f23e2,_0x3b1bc8){if(_0x3dc376!==0x0){logger[_0x211f('0x8')](util[_0x211f('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x4826cc,_0x6be3da,_0x3dc376,_0x3b1bc8));}else{logger[_0x211f('0xa')](util[_0x211f('0x9')](_0x211f('0xb'),_0x4826cc,_0x6be3da,_0x6f23e2));}});}; \ 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 16013e0..014d089 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 _0x8692=['%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','object','stringify','info','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','mustache','../../../../config/logger','trigger','data1','render','data2','data5','number','headers','data6','toUpperCase','DELETE','PUT','data7','parse','body','error','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format'];(function(_0x48ad80,_0x33db32){var _0x3f0112=function(_0x31bb26){while(--_0x31bb26){_0x48ad80['push'](_0x48ad80['shift']());}};_0x3f0112(++_0x33db32);}(_0x8692,0x1ad));var _0x2869=function(_0x57c863,_0x1099bd){_0x57c863=_0x57c863-0x0;var _0x2065dc=_0x8692[_0x57c863];return _0x2065dc;};'use strict';var rp=require(_0x2869('0x0'));var util=require('util');var _=require('lodash');var Mustache=require(_0x2869('0x1'));var logger=require(_0x2869('0x2'))(_0x2869('0x3'));exports['exec']=function(_0x4a6c21,_0x853c5e){var _0x27d076,_0x375511;var _0x39b4cd={'method':_0x4a6c21[_0x2869('0x4')]['toUpperCase'](),'uri':Mustache[_0x2869('0x5')](_0x4a6c21[_0x2869('0x6')],_0x853c5e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4a6c21[_0x2869('0x7')])===_0x2869('0x8')&&parseInt(_0x4a6c21[_0x2869('0x7')])>=0x1&&parseInt(_0x4a6c21[_0x2869('0x7')])<=0xa?parseInt(_0x4a6c21[_0x2869('0x7')])*0x3e8:0x5*0x3e8};try{_0x39b4cd[_0x2869('0x9')]=_0x4a6c21[_0x2869('0xa')]?JSON['parse'](Mustache[_0x2869('0x5')](_0x4a6c21[_0x2869('0xa')],_0x853c5e)):{};}catch(_0x1b11cb){logger['error'](_0x1b11cb['stack']);}switch(_0x4a6c21[_0x2869('0x4')][_0x2869('0xb')]()){case'GET':case _0x2869('0xc'):_0x27d076=null;_0x39b4cd['qs']=_0x853c5e;break;case'POST':case _0x2869('0xd'):if(_0x4a6c21[_0x2869('0xe')]){try{_0x27d076=JSON[_0x2869('0xf')](Mustache['render'](_0x4a6c21['data7'],_0x853c5e));_0x39b4cd[_0x2869('0x10')]=_0x27d076;}catch(_0x1346ab){logger[_0x2869('0x11')](_0x1346ab[_0x2869('0x12')]);logger[_0x2869('0x11')](_0x2869('0x13'));}}else{_0x27d076=_0x853c5e;_0x39b4cd['body']=_0x27d076;}break;}logger['info'](util[_0x2869('0x14')](_0x2869('0x15'),_0x4a6c21['data1'],_0x4a6c21['data2'],JSON['stringify'](_0x39b4cd)));rp(_0x39b4cd)['then'](function(_0x5df8ba){_0x27d076=!_['isNil'](_0x27d076)?',\x20request\x20body:\x20'+_0x27d076:'';_0x375511=typeof _0x5df8ba[_0x2869('0x10')]===_0x2869('0x16')?JSON[_0x2869('0x17')](_0x5df8ba['body']):_0x5df8ba[_0x2869('0x10')];logger[_0x2869('0x18')](util[_0x2869('0x14')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x4a6c21[_0x2869('0x4')],_0x4a6c21[_0x2869('0x6')],_0x5df8ba[_0x2869('0x19')],_0x375511));})[_0x2869('0x1a')](function(_0xf1b495){logger[_0x2869('0x11')](util[_0x2869('0x14')](_0x2869('0x1b'),_0x4a6c21[_0x2869('0x4')],_0x4a6c21[_0x2869('0x6')],_0xf1b495[_0x2869('0x19')],_0xf1b495[_0x2869('0x1c')],_0xf1b495[_0x2869('0x1d')]));});}; \ No newline at end of file +var _0xf8ec=['then','isNil','object','stringify','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data2','data5','number','headers','data6','parse','render','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0xf8ec,0x129));var _0xcf8e=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0xf8ec[_0x38b14f];return _0x22a324;};'use strict';var rp=require(_0xcf8e('0x0'));var util=require(_0xcf8e('0x1'));var _=require(_0xcf8e('0x2'));var Mustache=require(_0xcf8e('0x3'));var logger=require(_0xcf8e('0x4'))(_0xcf8e('0x5'));exports[_0xcf8e('0x6')]=function(_0x10ad8d,_0x8dbe63){var _0x29d13e,_0x5398a4;var _0x1f2e5e={'method':_0x10ad8d[_0xcf8e('0x7')][_0xcf8e('0x8')](),'uri':Mustache['render'](_0x10ad8d[_0xcf8e('0x9')],_0x8dbe63),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x10ad8d[_0xcf8e('0xa')])===_0xcf8e('0xb')&&parseInt(_0x10ad8d[_0xcf8e('0xa')])>=0x1&&parseInt(_0x10ad8d[_0xcf8e('0xa')])<=0xa?parseInt(_0x10ad8d[_0xcf8e('0xa')])*0x3e8:0x5*0x3e8};try{_0x1f2e5e[_0xcf8e('0xc')]=_0x10ad8d[_0xcf8e('0xd')]?JSON[_0xcf8e('0xe')](Mustache[_0xcf8e('0xf')](_0x10ad8d[_0xcf8e('0xd')],_0x8dbe63)):{};}catch(_0x213319){logger['error'](_0x213319[_0xcf8e('0x10')]);}switch(_0x10ad8d[_0xcf8e('0x7')][_0xcf8e('0x8')]()){case _0xcf8e('0x11'):case _0xcf8e('0x12'):_0x29d13e=null;_0x1f2e5e['qs']=_0x8dbe63;break;case _0xcf8e('0x13'):case _0xcf8e('0x14'):if(_0x10ad8d[_0xcf8e('0x15')]){try{_0x29d13e=JSON[_0xcf8e('0xe')](Mustache[_0xcf8e('0xf')](_0x10ad8d['data7'],_0x8dbe63));_0x1f2e5e[_0xcf8e('0x16')]=_0x29d13e;}catch(_0x3823e5){logger['error'](_0x3823e5['stack']);logger[_0xcf8e('0x17')](_0xcf8e('0x18'));}}else{_0x29d13e=_0x8dbe63;_0x1f2e5e[_0xcf8e('0x16')]=_0x29d13e;}break;}logger['info'](util[_0xcf8e('0x19')](_0xcf8e('0x1a'),_0x10ad8d[_0xcf8e('0x7')],_0x10ad8d[_0xcf8e('0x9')],JSON['stringify'](_0x1f2e5e)));rp(_0x1f2e5e)[_0xcf8e('0x1b')](function(_0x3c9ba5){_0x29d13e=!_[_0xcf8e('0x1c')](_0x29d13e)?',\x20request\x20body:\x20'+_0x29d13e:'';_0x5398a4=typeof _0x3c9ba5[_0xcf8e('0x16')]===_0xcf8e('0x1d')?JSON[_0xcf8e('0x1e')](_0x3c9ba5['body']):_0x3c9ba5[_0xcf8e('0x16')];logger[_0xcf8e('0x1f')](util[_0xcf8e('0x19')](_0xcf8e('0x20'),_0x10ad8d[_0xcf8e('0x7')],_0x10ad8d[_0xcf8e('0x9')],_0x3c9ba5['statusCode'],_0x5398a4));})['catch'](function(_0x204f64){logger['error'](util['format'](_0xcf8e('0x21'),_0x10ad8d[_0xcf8e('0x7')],_0x10ad8d['data2'],_0x204f64[_0xcf8e('0x22')],_0x204f64[_0xcf8e('0x23')],_0x204f64['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 7892fc7..893731f 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 _0xf202=['Request','request','then','debug','rpc','error','routing','message','result','catch','exports','bluebird','../../config/logger','client','http'];(function(_0x11423d,_0x42eb79){var _0xeff30a=function(_0x4118af){while(--_0x4118af){_0x11423d['push'](_0x11423d['shift']());}};_0xeff30a(++_0x42eb79);}(_0xf202,0x1be));var _0x2f20=function(_0x2dcfa7,_0x1483eb){_0x2dcfa7=_0x2dcfa7-0x0;var _0x5a097d=_0xf202[_0x2dcfa7];return _0x5a097d;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x2f20('0x0'));var logger=require(_0x2f20('0x1'))('routing');var client=jayson[_0x2f20('0x2')][_0x2f20('0x3')]({'port':0x2329});client[_0x2f20('0x4')]=function(_0x3b1c9f,_0x45fbb8){return new BPromise(function(_0x20c41a,_0xfe0b23){return client[_0x2f20('0x5')](_0x3b1c9f,_0x45fbb8)[_0x2f20('0x6')](function(_0x38723a){logger[_0x2f20('0x7')](_0x2f20('0x8'),'routing',_0x3b1c9f,_0x45fbb8,_0x38723a);if(_0x38723a[_0x2f20('0x9')]){logger[_0x2f20('0x9')](_0x2f20('0x8'),_0x2f20('0xa'),_0x3b1c9f,_0x38723a[_0x2f20('0x9')][_0x2f20('0xb')],_0x45fbb8);return _0xfe0b23(_0x38723a['error'][_0x2f20('0xb')]);}else{return _0x20c41a(_0x38723a[_0x2f20('0xc')]);}})[_0x2f20('0xd')](function(_0x7e5b72){logger[_0x2f20('0x9')](_0x2f20('0x8'),_0x2f20('0xa'),_0x3b1c9f,_0x7e5b72,_0x45fbb8);return _0xfe0b23(_0x7e5b72);});});};module[_0x2f20('0xe')]=client; \ No newline at end of file +var _0x4dbd=['rpc','message','result','catch','bluebird','routing','client','http','Request','request','then','error'];(function(_0x46fd46,_0x4c0fec){var _0x19d0a7=function(_0x3b7c2d){while(--_0x3b7c2d){_0x46fd46['push'](_0x46fd46['shift']());}};_0x19d0a7(++_0x4c0fec);}(_0x4dbd,0x10c));var _0xd4db=function(_0xd00f6d,_0x3f1432){_0xd00f6d=_0xd00f6d-0x0;var _0x1d44da=_0x4dbd[_0xd00f6d];return _0x1d44da;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xd4db('0x0'));var logger=require('../../config/logger')(_0xd4db('0x1'));var client=jayson[_0xd4db('0x2')][_0xd4db('0x3')]({'port':0x2329});client[_0xd4db('0x4')]=function(_0x1ea594,_0x3f6acb){return new BPromise(function(_0x4b09ca,_0x3d16c3){return client[_0xd4db('0x5')](_0x1ea594,_0x3f6acb)[_0xd4db('0x6')](function(_0x4eaaea){logger['debug']('rpc','routing',_0x1ea594,_0x3f6acb,_0x4eaaea);if(_0x4eaaea[_0xd4db('0x7')]){logger[_0xd4db('0x7')](_0xd4db('0x8'),_0xd4db('0x1'),_0x1ea594,_0x4eaaea[_0xd4db('0x7')]['message'],_0x3f6acb);return _0x3d16c3(_0x4eaaea[_0xd4db('0x7')][_0xd4db('0x9')]);}else{return _0x4b09ca(_0x4eaaea[_0xd4db('0xa')]);}})[_0xd4db('0xb')](function(_0x4a11bb){logger[_0xd4db('0x7')]('rpc','routing',_0x1ea594,_0x4a11bb,_0x3f6acb);return _0x3d16c3(_0x4a11bb);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index aad5978..50c717a 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 _0x9558=['./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server'];(function(_0x2bfe4e,_0x5e0160){var _0x404cd3=function(_0x8bf661){while(--_0x8bf661){_0x2bfe4e['push'](_0x2bfe4e['shift']());}};_0x404cd3(++_0x5e0160);}(_0x9558,0x153));var _0x8955=function(_0x5e3b18,_0x198773){_0x5e3b18=_0x5e3b18-0x0;var _0x2d3391=_0x9558[_0x5e3b18];return _0x2d3391;};'use strict';var server=require(_0x8955('0x0'));var Realtime=require(_0x8955('0x1'));var EmailChannel=require(_0x8955('0x2'));var mailAccount=require(_0x8955('0x3'));var setting=require(_0x8955('0x4'));var logger=require(_0x8955('0x5'))(_0x8955('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x8955('0x7')]()[_0x8955('0x8')](mailAccount['getMailAccounts']())['then'](realtime[_0x8955('0x9')]())['then'](function(){email[_0x8955('0xa')](realtime[_0x8955('0xb')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x8955('0x8')](function(){return initRealtime();})['then'](function(){return setting[_0x8955('0xc')]();})[_0x8955('0x8')](function(_0x47095e){return setInterval(initRealtime,_0x47095e[_0x8955('0xd')]*0x3e8);})[_0x8955('0xe')](function(_0x29bc70){logger[_0x8955('0xf')](_0x8955('0x10'),_0x29bc70);});}main(); \ No newline at end of file +var _0x0409=['./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts','refresh','listen','loginMailFrequency','catch','error','Email\x20service\x20initialization','./realtime','./lib/email'];(function(_0x1b0f71,_0x8e3d31){var _0x435ffb=function(_0x46a772){while(--_0x46a772){_0x1b0f71['push'](_0x1b0f71['shift']());}};_0x435ffb(++_0x8e3d31);}(_0x0409,0x1cf));var _0x9040=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x0409[_0x4e9628];return _0x27bc8c;};'use strict';var server=require('./server');var Realtime=require(_0x9040('0x0'));var EmailChannel=require(_0x9040('0x1'));var mailAccount=require(_0x9040('0x2'));var setting=require(_0x9040('0x3'));var logger=require(_0x9040('0x4'))(_0x9040('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x9040('0x6')](mailAccount[_0x9040('0x7')]())[_0x9040('0x6')](realtime[_0x9040('0x8')]())['then'](function(){email[_0x9040('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x9040('0xa')](realtime,email)[_0x9040('0x6')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x9040('0x6')](function(_0x339f75){return setInterval(initRealtime,_0x339f75[_0x9040('0xb')]*0x3e8);})[_0x9040('0xc')](function(_0x3dec61){logger[_0x9040('0xd')](_0x9040('0xe'),_0x3dec61);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index f48775f..d7fa74b 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 _0xe303=['redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','name','key','active','Imap','status','messageStatus','total','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','service','provider','custom','email','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','isNil','disabled','emit','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','catch','lastSync','sendMail','send','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe303,0xad));var _0x3e30=function(_0x2a3b77,_0x1a5c39){_0x2a3b77=_0x2a3b77-0x0;var _0x485436=_0xe303[_0x2a3b77];return _0x485436;};'use strict';var _=require(_0x3e30('0x0'));var moment=require(_0x3e30('0x1'));var BPromise=require(_0x3e30('0x2'));var md5=require(_0x3e30('0x3'));var Redis=require(_0x3e30('0x4'));var config=require(_0x3e30('0x5'));var logger=require(_0x3e30('0x6'))('email');config[_0x3e30('0x7')]=_['defaults'](config[_0x3e30('0x7')],{'host':_0x3e30('0x8'),'port':0x18eb});var io=require(_0x3e30('0x9'))(new Redis(config['redis']));var EmailImap=require(_0x3e30('0xa'));var EmailSmtp=require(_0x3e30('0xb'));var mailAccount=require(_0x3e30('0xc'));var md5Accounts={};function EmailChannel(_0x41a936){logger[_0x3e30('0xd')](_0x3e30('0xe'));this[_0x3e30('0xf')]=_0x41a936[_0x3e30('0xf')];this[_0x3e30('0x10')]={};this[_0x3e30('0x11')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x31c876){var _0x1b92a7=this['mailAccounts'][_0x31c876];var _0x16e3f9={'id':_0x1b92a7['id'],'name':_0x1b92a7[_0x3e30('0x12')],'key':_0x1b92a7[_0x3e30('0x13')],'active':_0x1b92a7[_0x3e30('0x14')],'Imap':{'status':_0x1b92a7[_0x3e30('0x15')][_0x3e30('0x16')],'messageStatus':_0x1b92a7[_0x3e30('0x15')][_0x3e30('0x17')],'total':_0x1b92a7[_0x3e30('0x15')][_0x3e30('0x18')]}};if(_['isNil'](md5Accounts[_0x31c876])){md5Accounts[_0x31c876]={};}var _0x951f2=md5(JSON[_0x3e30('0x19')](_0x16e3f9));if(md5Accounts[_0x31c876][_0x3e30('0x3')]!==_0x951f2){md5Accounts[_0x31c876][_0x3e30('0x3')]=_0x951f2;io['emit'](_0x3e30('0x1a'),_0x16e3f9);}};EmailChannel[_0x3e30('0x1b')][_0x3e30('0x1c')]=function(_0xe659fc){for(var _0x2f9135 in _0xe659fc){if(_0xe659fc[_0x3e30('0x1d')](_0x2f9135)){if(_0xe659fc[_0x2f9135][_0x3e30('0x15')]&&_0xe659fc[_0x2f9135][_0x3e30('0x14')]){var _0x3c07dd=_0xe659fc[_0x2f9135][_0x3e30('0x15')];if(!_0x3c07dd[_0x3e30('0x1e')]&&_0xe659fc[_0x2f9135][_0x3e30('0x1f')]!==_0x3e30('0x20'))_0x3c07dd['service']=_0xe659fc[_0x2f9135][_0x3e30('0x1f')];if(!this[_0x3e30('0x10')][_0x3e30('0x1d')](_0x3c07dd['id'])){this[_0x3e30('0x10')][_0x3c07dd['id']]=new EmailImap(_0x3c07dd,_0xe659fc[_0x2f9135][_0x3e30('0x21')]);this[_0x3e30('0x10')][_0x3c07dd['id']]['on']('box',this['handleImapBox']['bind'](this,_0x2f9135));this[_0x3e30('0x10')][_0x3c07dd['id']]['on'](_0x3e30('0x21'),this[_0x3e30('0x22')][_0x3e30('0x23')](this,_0x2f9135));this[_0x3e30('0x10')][_0x3c07dd['id']]['on'](_0x3e30('0x24'),this[_0x3e30('0x25')][_0x3e30('0x23')](this,_0x2f9135));this[_0x3e30('0x10')][_0x3c07dd['id']]['on'](_0x3e30('0x26'),this[_0x3e30('0x27')][_0x3e30('0x23')](this,_0x2f9135));}}else{if(_[_0x3e30('0x28')](this[_0x3e30('0xf')][_0x2f9135][_0x3e30('0x15')])){this['mailAccounts'][_0x2f9135][_0x3e30('0x15')]={};}this[_0x3e30('0xf')][_0x2f9135][_0x3e30('0x15')][_0x3e30('0x16')]=_0x3e30('0x29');this[_0x3e30('0xf')][_0x2f9135][_0x3e30('0x15')][_0x3e30('0x17')]='';this[_0x3e30('0x2a')](_0x2f9135);}}}};EmailChannel[_0x3e30('0x1b')][_0x3e30('0x2b')]=function(_0x22e270,_0x3e0e06){if(this[_0x3e30('0xf')][_0x22e270]){this[_0x3e30('0xf')][_0x22e270][_0x3e30('0x15')][_0x3e30('0x16')]=_0x3e30('0x2c');this[_0x3e30('0xf')][_0x22e270][_0x3e30('0x15')][_0x3e30('0x17')]=_0x3e0e06[_0x3e30('0x12')];if(_0x3e0e06[_0x3e30('0x2d')]){this['mailAccounts'][_0x22e270]['Imap']['total']=_0x3e0e06[_0x3e30('0x2d')][_0x3e30('0x18')];}return this[_0x3e30('0x2a')](_0x22e270);}};EmailChannel['prototype']['handleImapEmail']=function(_0xf81689,_0x43e431){logger[_0x3e30('0xd')](_0x3e30('0x2e'),_0x43e431[_0x3e30('0x2f')],_0x43e431[_0x3e30('0x30')],_0x43e431[_0x3e30('0x31')],_0xf81689);if(this[_0x3e30('0xf')][_0xf81689]){return mailAccount[_0x3e30('0x32')](_0xf81689,_0x43e431)[_0x3e30('0x33')](function(_0x2356b7){if(_0x2356b7){logger[_0x3e30('0xd')]('Mail\x20accepted\x20from\x20routing');}})[_0x3e30('0x34')](function(_0x299bc){logger[_0x3e30('0x26')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x3e30('0x19')](_0x299bc));});}};EmailChannel[_0x3e30('0x1b')]['handleImapEnd']=function(_0x5d35a3){if(this[_0x3e30('0xf')][_0x5d35a3]&&this[_0x3e30('0xf')][_0x5d35a3][_0x3e30('0x15')]){if(this[_0x3e30('0x10')][this[_0x3e30('0xf')][_0x5d35a3][_0x3e30('0x15')]['id']]){delete this[_0x3e30('0x10')][this[_0x3e30('0xf')][_0x5d35a3][_0x3e30('0x15')]['id']];}this[_0x3e30('0xf')][_0x5d35a3]['Imap'][_0x3e30('0x35')]=moment();this[_0x3e30('0x2a')](_0x5d35a3);}};EmailChannel[_0x3e30('0x1b')][_0x3e30('0x27')]=function(_0x4e7282,_0x3762d9){if(this['mailAccounts'][_0x4e7282]){this[_0x3e30('0xf')][_0x4e7282][_0x3e30('0x15')][_0x3e30('0x16')]=_0x3e30('0x26');this[_0x3e30('0xf')][_0x4e7282][_0x3e30('0x15')][_0x3e30('0x17')]=_0x3762d9;return this[_0x3e30('0x2a')](_0x4e7282);}};EmailChannel[_0x3e30('0x1b')][_0x3e30('0x36')]=function(_0xd10542,_0x4e5ac8){return this[_0x3e30('0x11')][_0x3e30('0x37')](_0xd10542,_0x4e5ac8);};EmailChannel[_0x3e30('0x1b')]['verifySmtp']=function(_0x40feb8){var _0x288d5f=this;if(this[_0x3e30('0xf')][_0x40feb8['id']]){if(_[_0x3e30('0x28')](this[_0x3e30('0xf')][_0x40feb8['id']]['Smtp'])){this[_0x3e30('0xf')][_0x40feb8['id']]['Smtp']={};}this[_0x3e30('0xf')][_0x40feb8['id']][_0x3e30('0x38')]['lastSync']=moment();return new BPromise(function(_0x3f1e71,_0x5a374b){return _0x288d5f[_0x3e30('0x11')][_0x3e30('0x39')](_0x40feb8)['then'](function(_0x5118cd){_0x288d5f['mailAccounts'][_0x40feb8['id']][_0x3e30('0x38')][_0x3e30('0x16')]=_0x3e30('0x3a');_0x288d5f[_0x3e30('0xf')][_0x40feb8['id']][_0x3e30('0x38')][_0x3e30('0x17')]='';_0x288d5f[_0x3e30('0x2a')](_0x40feb8['id']);_0x3f1e71(_0x5118cd);})['catch'](function(_0x25b26a){_0x288d5f[_0x3e30('0xf')][_0x40feb8['id']][_0x3e30('0x38')][_0x3e30('0x16')]=_0x3e30('0x26');_0x288d5f[_0x3e30('0xf')][_0x40feb8['id']][_0x3e30('0x38')][_0x3e30('0x17')]=_0x25b26a;_0x288d5f[_0x3e30('0x2a')](_0x40feb8['id']);_0x5a374b(_0x25b26a);});});}return this[_0x3e30('0x11')][_0x3e30('0x39')](_0x40feb8);};module[_0x3e30('0x3b')]=EmailChannel; \ No newline at end of file +var _0xfed7=['box','handleImapBox','bind','email','end','handleImapEnd','error','handleImapError','disabled','emit','messages','total','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','lastSync','sendMail','send','verifySmtp','Smtp','verify','then','exports','lodash','bluebird','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','key','Imap','status','messageStatus','isNil','stringify','refresh','hasOwnProperty','active','provider','service'];(function(_0x163c9a,_0x52b166){var _0x5e5d12=function(_0x2d9e96){while(--_0x2d9e96){_0x163c9a['push'](_0x163c9a['shift']());}};_0x5e5d12(++_0x52b166);}(_0xfed7,0x87));var _0x7fed=function(_0x7148b6,_0xa61534){_0x7148b6=_0x7148b6-0x0;var _0x111019=_0xfed7[_0x7148b6];return _0x111019;};'use strict';var _=require(_0x7fed('0x0'));var moment=require('moment');var BPromise=require(_0x7fed('0x1'));var md5=require(_0x7fed('0x2'));var Redis=require(_0x7fed('0x3'));var config=require(_0x7fed('0x4'));var logger=require('../../../config/logger')('email');config['redis']=_[_0x7fed('0x5')](config[_0x7fed('0x6')],{'host':_0x7fed('0x7'),'port':0x18eb});var io=require(_0x7fed('0x8'))(new Redis(config[_0x7fed('0x6')]));var EmailImap=require(_0x7fed('0x9'));var EmailSmtp=require(_0x7fed('0xa'));var mailAccount=require(_0x7fed('0xb'));var md5Accounts={};function EmailChannel(_0x1c057b){logger[_0x7fed('0xc')](_0x7fed('0xd'));this[_0x7fed('0xe')]=_0x1c057b[_0x7fed('0xe')];this[_0x7fed('0xf')]={};this[_0x7fed('0x10')]=new EmailSmtp();}EmailChannel[_0x7fed('0x11')]['emit']=function(_0x19b089){var _0x2c5d37=this[_0x7fed('0xe')][_0x19b089];var _0x168202={'id':_0x2c5d37['id'],'name':_0x2c5d37[_0x7fed('0x12')],'key':_0x2c5d37[_0x7fed('0x13')],'active':_0x2c5d37['active'],'Imap':{'status':_0x2c5d37[_0x7fed('0x14')][_0x7fed('0x15')],'messageStatus':_0x2c5d37[_0x7fed('0x14')][_0x7fed('0x16')],'total':_0x2c5d37[_0x7fed('0x14')]['total']}};if(_[_0x7fed('0x17')](md5Accounts[_0x19b089])){md5Accounts[_0x19b089]={};}var _0x2ca609=md5(JSON[_0x7fed('0x18')](_0x168202));if(md5Accounts[_0x19b089]['md5']!==_0x2ca609){md5Accounts[_0x19b089][_0x7fed('0x2')]=_0x2ca609;io['emit']('mailAccount:update',_0x168202);}};EmailChannel[_0x7fed('0x11')][_0x7fed('0x19')]=function(_0x3b856c){for(var _0x4b5106 in _0x3b856c){if(_0x3b856c[_0x7fed('0x1a')](_0x4b5106)){if(_0x3b856c[_0x4b5106][_0x7fed('0x14')]&&_0x3b856c[_0x4b5106][_0x7fed('0x1b')]){var _0x252e2b=_0x3b856c[_0x4b5106][_0x7fed('0x14')];if(!_0x252e2b['service']&&_0x3b856c[_0x4b5106][_0x7fed('0x1c')]!=='custom')_0x252e2b[_0x7fed('0x1d')]=_0x3b856c[_0x4b5106][_0x7fed('0x1c')];if(!this[_0x7fed('0xf')]['hasOwnProperty'](_0x252e2b['id'])){this[_0x7fed('0xf')][_0x252e2b['id']]=new EmailImap(_0x252e2b,_0x3b856c[_0x4b5106]['email']);this['imapAccounts'][_0x252e2b['id']]['on'](_0x7fed('0x1e'),this[_0x7fed('0x1f')][_0x7fed('0x20')](this,_0x4b5106));this['imapAccounts'][_0x252e2b['id']]['on'](_0x7fed('0x21'),this['handleImapEmail'][_0x7fed('0x20')](this,_0x4b5106));this[_0x7fed('0xf')][_0x252e2b['id']]['on'](_0x7fed('0x22'),this[_0x7fed('0x23')][_0x7fed('0x20')](this,_0x4b5106));this[_0x7fed('0xf')][_0x252e2b['id']]['on'](_0x7fed('0x24'),this[_0x7fed('0x25')][_0x7fed('0x20')](this,_0x4b5106));}}else{if(_[_0x7fed('0x17')](this['mailAccounts'][_0x4b5106][_0x7fed('0x14')])){this['mailAccounts'][_0x4b5106][_0x7fed('0x14')]={};}this['mailAccounts'][_0x4b5106][_0x7fed('0x14')][_0x7fed('0x15')]=_0x7fed('0x26');this[_0x7fed('0xe')][_0x4b5106][_0x7fed('0x14')][_0x7fed('0x16')]='';this[_0x7fed('0x27')](_0x4b5106);}}}};EmailChannel[_0x7fed('0x11')][_0x7fed('0x1f')]=function(_0x2b17ac,_0x4d2cf3){if(this[_0x7fed('0xe')][_0x2b17ac]){this[_0x7fed('0xe')][_0x2b17ac][_0x7fed('0x14')]['status']='connected';this[_0x7fed('0xe')][_0x2b17ac]['Imap'][_0x7fed('0x16')]=_0x4d2cf3[_0x7fed('0x12')];if(_0x4d2cf3[_0x7fed('0x28')]){this[_0x7fed('0xe')][_0x2b17ac]['Imap'][_0x7fed('0x29')]=_0x4d2cf3[_0x7fed('0x28')][_0x7fed('0x29')];}return this[_0x7fed('0x27')](_0x2b17ac);}};EmailChannel['prototype'][_0x7fed('0x2a')]=function(_0x5491d2,_0x52a3f7){logger[_0x7fed('0xc')](_0x7fed('0x2b'),_0x52a3f7[_0x7fed('0x2c')],_0x52a3f7[_0x7fed('0x2d')],_0x52a3f7[_0x7fed('0x2e')],_0x5491d2);if(this['mailAccounts'][_0x5491d2]){return mailAccount['notify'](_0x5491d2,_0x52a3f7)['then'](function(_0x43aab5){if(_0x43aab5){logger[_0x7fed('0xc')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x96fb9d){logger[_0x7fed('0x24')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x96fb9d));});}};EmailChannel['prototype'][_0x7fed('0x23')]=function(_0x7d37e1){if(this[_0x7fed('0xe')][_0x7d37e1]&&this['mailAccounts'][_0x7d37e1][_0x7fed('0x14')]){if(this[_0x7fed('0xf')][this[_0x7fed('0xe')][_0x7d37e1][_0x7fed('0x14')]['id']]){delete this[_0x7fed('0xf')][this[_0x7fed('0xe')][_0x7d37e1][_0x7fed('0x14')]['id']];}this[_0x7fed('0xe')][_0x7d37e1][_0x7fed('0x14')][_0x7fed('0x2f')]=moment();this['emit'](_0x7d37e1);}};EmailChannel[_0x7fed('0x11')][_0x7fed('0x25')]=function(_0x4a6445,_0x4be37e){if(this[_0x7fed('0xe')][_0x4a6445]){this['mailAccounts'][_0x4a6445][_0x7fed('0x14')][_0x7fed('0x15')]=_0x7fed('0x24');this['mailAccounts'][_0x4a6445]['Imap'][_0x7fed('0x16')]=_0x4be37e;return this[_0x7fed('0x27')](_0x4a6445);}};EmailChannel[_0x7fed('0x11')][_0x7fed('0x30')]=function(_0xa8e3ab,_0x4a12f9){return this[_0x7fed('0x10')][_0x7fed('0x31')](_0xa8e3ab,_0x4a12f9);};EmailChannel[_0x7fed('0x11')][_0x7fed('0x32')]=function(_0xfb52d8){var _0x4394a9=this;if(this[_0x7fed('0xe')][_0xfb52d8['id']]){if(_[_0x7fed('0x17')](this[_0x7fed('0xe')][_0xfb52d8['id']]['Smtp'])){this[_0x7fed('0xe')][_0xfb52d8['id']][_0x7fed('0x33')]={};}this[_0x7fed('0xe')][_0xfb52d8['id']][_0x7fed('0x33')]['lastSync']=moment();return new BPromise(function(_0x5c5ce2,_0x19a1f0){return _0x4394a9['smtp'][_0x7fed('0x34')](_0xfb52d8)[_0x7fed('0x35')](function(_0x35cd3f){_0x4394a9[_0x7fed('0xe')][_0xfb52d8['id']][_0x7fed('0x33')]['status']='verified';_0x4394a9[_0x7fed('0xe')][_0xfb52d8['id']][_0x7fed('0x33')][_0x7fed('0x16')]='';_0x4394a9[_0x7fed('0x27')](_0xfb52d8['id']);_0x5c5ce2(_0x35cd3f);})['catch'](function(_0x174708){_0x4394a9[_0x7fed('0xe')][_0xfb52d8['id']][_0x7fed('0x33')][_0x7fed('0x15')]=_0x7fed('0x24');_0x4394a9['mailAccounts'][_0xfb52d8['id']][_0x7fed('0x33')][_0x7fed('0x16')]=_0x174708;_0x4394a9[_0x7fed('0x27')](_0xfb52d8['id']);_0x19a1f0(_0x174708);});});}return this['smtp'][_0x7fed('0x34')](_0xfb52d8);};module[_0x7fed('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 2fc15cc..d30ef30 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 _0x781d=['handleFetchError','handleCloseBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','parser','closeBox','handleEnd','textCode','hasOwnProperty','upperFirst','exports','lodash','util','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','account','getAccount','imap','ready','handleReady','once','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','xoauth2','generateXOAuth2Token','CloudProvider','data5','anonymous@xcally.com','handleOpenBox','emit','readUnseen','end','handleReadUnseen','length','fetch','message'];(function(_0x515227,_0x342e4e){var _0xa20618=function(_0x94fd3f){while(--_0x94fd3f){_0x515227['push'](_0x515227['shift']());}};_0xa20618(++_0x342e4e);}(_0x781d,0x14a));var _0xd781=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x781d[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var Imap=require('imap');var simpleParser=require('mailparser')[_0xd781('0x2')];var Iconv=require(_0xd781('0x3'))[_0xd781('0x4')];var EventEmitter=require(_0xd781('0x5'))[_0xd781('0x6')];var utils=require(_0xd781('0x7'));var logger=require(_0xd781('0x8'))(_0xd781('0x9'));function EmailImap(_0x830b,_0x2f98ee){this['mailbox']=_0xd781('0xa');this[_0xd781('0xb')]=this[_0xd781('0xc')](_0x830b,_0x2f98ee);this[_0xd781('0xd')]=new Imap(this['account']);this[_0xd781('0xd')]['once'](_0xd781('0xe'),this[_0xd781('0xf')]['bind'](this));this[_0xd781('0xd')][_0xd781('0x10')]('end',this['handleEnd'][_0xd781('0x11')](this));this[_0xd781('0xd')]['on'](_0xd781('0x12'),this[_0xd781('0x13')][_0xd781('0x11')](this));this[_0xd781('0xd')][_0xd781('0x14')]();}util[_0xd781('0x15')](EmailImap,EventEmitter);EmailImap[_0xd781('0x16')][_0xd781('0xc')]=function(_0xd454e7,_0x587953){var _0x477bdc={'connTimeout':_0xd454e7[_0xd781('0x17')]?_0xd454e7['connTimeout']*0x3e8:0x2710,'authTimeout':_0xd454e7[_0xd781('0x18')]?_0xd454e7['authTimeout']*0x3e8:0x1388};if(_[_0xd781('0x19')](_0xd454e7[_0xd781('0x1a')])){if(_0xd454e7[_0xd781('0x1b')]){_0x477bdc[_0xd781('0x1c')]=_0xd454e7[_0xd781('0x1c')];_0x477bdc[_0xd781('0x1d')]=_0xd454e7[_0xd781('0x1d')];}_0x477bdc['host']=_0xd454e7[_0xd781('0x1e')];_0x477bdc[_0xd781('0x1f')]=_0xd454e7[_0xd781('0x1f')]||0x3e1;if(_0xd454e7[_0xd781('0x20')]){_0x477bdc[_0xd781('0x20')]=!![];}else{_0x477bdc[_0xd781('0x20')]=![];_0x477bdc[_0xd781('0x21')]=_0xd781('0x22');}}else{if(_0xd454e7['modernAuthentication']){_0x477bdc[_0xd781('0x23')]=utils[_0xd781('0x24')](_0xd454e7[_0xd781('0x25')][_0xd781('0x26')],_0xd454e7[_0xd781('0x1c')]);_0x477bdc[_0xd781('0x1c')]=_0xd454e7[_0xd781('0x1c')];}else{_0x477bdc['user']=_0xd454e7[_0xd781('0x1c')];_0x477bdc['password']=_0xd454e7['password'];}_0x477bdc[_0xd781('0x1e')]=utils['getHost'](_0xd454e7[_0xd781('0x1a')]);_0x477bdc[_0xd781('0x1f')]=0x3e1;_0x477bdc[_0xd781('0x20')]=!![];}_0x477bdc[_0xd781('0x9')]=_0x587953||_0xd454e7[_0xd781('0x1c')]||_0xd781('0x27');return _0x477bdc;};EmailImap[_0xd781('0x16')][_0xd781('0xf')]=function(){this[_0xd781('0xd')]['openBox'](this['mailbox'],![],this[_0xd781('0x28')][_0xd781('0x11')](this));};EmailImap[_0xd781('0x16')]['handleOpenBox']=function(_0xa1349e,_0x5a431b){if(_0xa1349e){this['handleError'](_0xa1349e,!![]);}else{this[_0xd781('0x29')]('box',_0x5a431b);this[_0xd781('0x2a')]();}};EmailImap[_0xd781('0x16')]['handleCloseBox']=function(_0x5b6b9d){if(_0x5b6b9d){this[_0xd781('0x13')](_0x5b6b9d,!![]);}else{this['imap'][_0xd781('0x2b')]();}};EmailImap['prototype'][_0xd781('0x2a')]=function(){this[_0xd781('0xd')]['search'](['UNSEEN'],this[_0xd781('0x2c')][_0xd781('0x11')](this));};EmailImap[_0xd781('0x16')]['handleReadUnseen']=function(_0x5291f5,_0x360f72){if(_0x5291f5){this[_0xd781('0x13')](_0x5291f5,!![]);}else{if(_0x360f72[_0xd781('0x2d')]){try{var _0x5bcd40=this['imap'][_0xd781('0x2e')](_0x360f72,{'bodies':'','markSeen':!![]});_0x5bcd40['on'](_0xd781('0x2f'),this['handleFetchMessage'][_0xd781('0x11')](this));_0x5bcd40[_0xd781('0x10')]('error',this[_0xd781('0x30')][_0xd781('0x11')](this));_0x5bcd40[_0xd781('0x10')](_0xd781('0x2b'),this['handleFetchEnd'][_0xd781('0x11')](this));}catch(_0x13d59f){logger[_0xd781('0x12')](_0x13d59f);}}else{this[_0xd781('0xd')]['closeBox'](!![],this[_0xd781('0x31')][_0xd781('0x11')](this));}}};EmailImap['prototype'][_0xd781('0x32')]=function(_0x51d0b7){_0x51d0b7['on'](_0xd781('0x33'),this[_0xd781('0x34')]['bind'](this));_0x51d0b7[_0xd781('0x10')](_0xd781('0x35'),this['handleMessageAttributes'][_0xd781('0x11')](this));_0x51d0b7['once'](_0xd781('0x2b'),this[_0xd781('0x36')]['bind'](this));};EmailImap[_0xd781('0x16')][_0xd781('0x34')]=function(_0x5651de){simpleParser(_0x5651de,{'Iconv':Iconv},this[_0xd781('0x37')][_0xd781('0x11')](this));};EmailImap[_0xd781('0x16')]['handleMessageAttributes']=function(){};EmailImap[_0xd781('0x16')][_0xd781('0x36')]=function(){};EmailImap[_0xd781('0x16')][_0xd781('0x37')]=function(_0x2e8218,_0x282d30){if(_0x2e8218){logger[_0xd781('0x12')](_0x2e8218);}else{var _0x140567=this;utils[_0xd781('0x38')](this['account'],_0x282d30,function(_0x2a60d6){_0x140567['emit'](_0xd781('0x9'),_0x2a60d6);});}};EmailImap[_0xd781('0x16')]['handleFetchEnd']=function(){this[_0xd781('0xd')][_0xd781('0x39')](!![],this[_0xd781('0x31')][_0xd781('0x11')](this));};EmailImap['prototype'][_0xd781('0x30')]=function(_0x515357){this[_0xd781('0x13')](_0x515357);this[_0xd781('0xd')]['closeBox'](!![],this['handleCloseBox'][_0xd781('0x11')](this));};EmailImap[_0xd781('0x16')][_0xd781('0x3a')]=function(){this[_0xd781('0x29')]('end');};EmailImap[_0xd781('0x16')][_0xd781('0x13')]=function(_0x4f35b6,_0x4c9f47){logger[_0xd781('0x12')](_0xd781('0x13'),this[_0xd781('0xb')]['email'],JSON['stringify'](_0x4f35b6));var _0x46828e='';if(_0x4f35b6){if(_0x4f35b6[_0xd781('0x3b')]){_0x46828e=_0x4f35b6[_0xd781('0x3b')];}else{for(var _0x411b63 in _0x4f35b6){if(_0x4f35b6[_0xd781('0x3c')](_0x411b63)){_0x46828e+=_[_0xd781('0x3d')](_0x411b63)+':\x20'+_0x4f35b6[_0x411b63]+'\x0a';}}}}if(_0x4c9f47){this['imap']['end']();}else{this[_0xd781('0x29')](_0xd781('0x12'),_0x46828e);this[_0xd781('0x29')](_0xd781('0x2b'));}};module[_0xd781('0x3e')]=EmailImap; \ No newline at end of file +var _0x187d=['box','handleCloseBox','readUnseen','search','handleReadUnseen','length','fetch','message','error','end','handleFetchEnd','closeBox','handleFetchMessage','handleMessageBody','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','email','handleFetchError','stringify','textCode','hasOwnProperty','lodash','imap','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','handleEnd','handleError','inherits','prototype','connTimeout','authTimeout','isNil','user','password','host','port','tls','autotls','required','modernAuthentication','xoauth2','generateXOAuth2Token','data5','service','openBox','handleOpenBox','emit'];(function(_0x25f961,_0x5c2799){var _0x53dcaa=function(_0x242e01){while(--_0x242e01){_0x25f961['push'](_0x25f961['shift']());}};_0x53dcaa(++_0x5c2799);}(_0x187d,0x93));var _0xd187=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x187d[_0x373dee];return _0x46798f;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var Imap=require(_0xd187('0x1'));var simpleParser=require(_0xd187('0x2'))[_0xd187('0x3')];var Iconv=require(_0xd187('0x4'))[_0xd187('0x5')];var EventEmitter=require(_0xd187('0x6'))['EventEmitter'];var utils=require(_0xd187('0x7'));var logger=require(_0xd187('0x8'))('email');function EmailImap(_0x1d2533,_0x58ee7){this[_0xd187('0x9')]=_0xd187('0xa');this[_0xd187('0xb')]=this[_0xd187('0xc')](_0x1d2533,_0x58ee7);this[_0xd187('0x1')]=new Imap(this[_0xd187('0xb')]);this['imap'][_0xd187('0xd')](_0xd187('0xe'),this[_0xd187('0xf')][_0xd187('0x10')](this));this[_0xd187('0x1')][_0xd187('0xd')]('end',this[_0xd187('0x11')][_0xd187('0x10')](this));this[_0xd187('0x1')]['on']('error',this[_0xd187('0x12')][_0xd187('0x10')](this));this[_0xd187('0x1')]['connect']();}util[_0xd187('0x13')](EmailImap,EventEmitter);EmailImap[_0xd187('0x14')][_0xd187('0xc')]=function(_0x126d1a,_0x517b25){var _0x39a927={'connTimeout':_0x126d1a[_0xd187('0x15')]?_0x126d1a[_0xd187('0x15')]*0x3e8:0x2710,'authTimeout':_0x126d1a[_0xd187('0x16')]?_0x126d1a['authTimeout']*0x3e8:0x1388};if(_[_0xd187('0x17')](_0x126d1a['service'])){if(_0x126d1a['authentication']){_0x39a927[_0xd187('0x18')]=_0x126d1a['user'];_0x39a927['password']=_0x126d1a[_0xd187('0x19')];}_0x39a927[_0xd187('0x1a')]=_0x126d1a[_0xd187('0x1a')];_0x39a927[_0xd187('0x1b')]=_0x126d1a[_0xd187('0x1b')]||0x3e1;if(_0x126d1a[_0xd187('0x1c')]){_0x39a927[_0xd187('0x1c')]=!![];}else{_0x39a927[_0xd187('0x1c')]=![];_0x39a927[_0xd187('0x1d')]=_0xd187('0x1e');}}else{if(_0x126d1a[_0xd187('0x1f')]){_0x39a927[_0xd187('0x20')]=utils[_0xd187('0x21')](_0x126d1a['CloudProvider'][_0xd187('0x22')],_0x126d1a[_0xd187('0x18')]);_0x39a927[_0xd187('0x18')]=_0x126d1a['user'];}else{_0x39a927['user']=_0x126d1a['user'];_0x39a927[_0xd187('0x19')]=_0x126d1a[_0xd187('0x19')];}_0x39a927[_0xd187('0x1a')]=utils['getHost'](_0x126d1a[_0xd187('0x23')]);_0x39a927['port']=0x3e1;_0x39a927[_0xd187('0x1c')]=!![];}_0x39a927['email']=_0x517b25||_0x126d1a[_0xd187('0x18')]||'anonymous@xcally.com';return _0x39a927;};EmailImap['prototype'][_0xd187('0xf')]=function(){this['imap'][_0xd187('0x24')](this[_0xd187('0x9')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0xd187('0x14')][_0xd187('0x25')]=function(_0x43079f,_0x4a7f6f){if(_0x43079f){this['handleError'](_0x43079f,!![]);}else{this[_0xd187('0x26')](_0xd187('0x27'),_0x4a7f6f);this['readUnseen']();}};EmailImap[_0xd187('0x14')][_0xd187('0x28')]=function(_0x34febe){if(_0x34febe){this['handleError'](_0x34febe,!![]);}else{this[_0xd187('0x1')]['end']();}};EmailImap[_0xd187('0x14')][_0xd187('0x29')]=function(){this[_0xd187('0x1')][_0xd187('0x2a')](['UNSEEN'],this[_0xd187('0x2b')][_0xd187('0x10')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x1a1922,_0x1836cf){if(_0x1a1922){this[_0xd187('0x12')](_0x1a1922,!![]);}else{if(_0x1836cf[_0xd187('0x2c')]){try{var _0x2874b2=this[_0xd187('0x1')][_0xd187('0x2d')](_0x1836cf,{'bodies':'','markSeen':!![]});_0x2874b2['on'](_0xd187('0x2e'),this['handleFetchMessage'][_0xd187('0x10')](this));_0x2874b2[_0xd187('0xd')](_0xd187('0x2f'),this['handleFetchError'][_0xd187('0x10')](this));_0x2874b2['once'](_0xd187('0x30'),this[_0xd187('0x31')][_0xd187('0x10')](this));}catch(_0x4d9d97){logger['error'](_0x4d9d97);}}else{this[_0xd187('0x1')][_0xd187('0x32')](!![],this['handleCloseBox'][_0xd187('0x10')](this));}}};EmailImap[_0xd187('0x14')][_0xd187('0x33')]=function(_0x54abed){_0x54abed['on']('body',this[_0xd187('0x34')][_0xd187('0x10')](this));_0x54abed['once']('attributes',this['handleMessageAttributes'][_0xd187('0x10')](this));_0x54abed['once'](_0xd187('0x30'),this[_0xd187('0x35')]['bind'](this));};EmailImap[_0xd187('0x14')]['handleMessageBody']=function(_0x293ce9){simpleParser(_0x293ce9,{'Iconv':Iconv},this[_0xd187('0x36')]['bind'](this));};EmailImap[_0xd187('0x14')][_0xd187('0x37')]=function(){};EmailImap['prototype'][_0xd187('0x35')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x26b06d,_0x388569){if(_0x26b06d){logger[_0xd187('0x2f')](_0x26b06d);}else{var _0x1a8f54=this;utils[_0xd187('0x38')](this['account'],_0x388569,function(_0x8860c){_0x1a8f54[_0xd187('0x26')](_0xd187('0x39'),_0x8860c);});}};EmailImap['prototype']['handleFetchEnd']=function(){this['imap']['closeBox'](!![],this[_0xd187('0x28')][_0xd187('0x10')](this));};EmailImap[_0xd187('0x14')][_0xd187('0x3a')]=function(_0x13436d){this[_0xd187('0x12')](_0x13436d);this[_0xd187('0x1')][_0xd187('0x32')](!![],this['handleCloseBox'][_0xd187('0x10')](this));};EmailImap[_0xd187('0x14')][_0xd187('0x11')]=function(){this['emit'](_0xd187('0x30'));};EmailImap['prototype'][_0xd187('0x12')]=function(_0x406d29,_0x370b00){logger[_0xd187('0x2f')](_0xd187('0x12'),this['account'][_0xd187('0x39')],JSON[_0xd187('0x3b')](_0x406d29));var _0x3215b1='';if(_0x406d29){if(_0x406d29[_0xd187('0x3c')]){_0x3215b1=_0x406d29['textCode'];}else{for(var _0xa02567 in _0x406d29){if(_0x406d29[_0xd187('0x3d')](_0xa02567)){_0x3215b1+=_['upperFirst'](_0xa02567)+':\x20'+_0x406d29[_0xa02567]+'\x0a';}}}}if(_0x370b00){this[_0xd187('0x1')][_0xd187('0x30')]();}else{this['emit']('error',_0x3215b1);this[_0xd187('0x26')](_0xd187('0x30'));}};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 0c4248a..1388cc1 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 _0x46b5=['createTransport','Not\x20verifired','exports','nodemailer','use','compile','sendMail','toString','prototype','verify'];(function(_0x664780,_0x5e53e2){var _0x4f42cf=function(_0x460839){while(--_0x460839){_0x664780['push'](_0x664780['shift']());}};_0x4f42cf(++_0x5e53e2);}(_0x46b5,0xdf));var _0x546b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x46b5[_0x3947c9];return _0x2e7871;};'use strict';var nodemailer=require(_0x546b('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x5aa340,_0x306b14){return new Promise(function(_0x14d1a6,_0xd26a47){var _0x246c4b=nodemailer['createTransport'](_0x5aa340);_0x246c4b[_0x546b('0x1')](_0x546b('0x2'),inlineBase64());_0x246c4b[_0x546b('0x3')](_0x306b14,function(_0x46f64f,_0x5a8947){if(_0x46f64f){_0xd26a47(_0x46f64f[_0x546b('0x4')]());}else{_0x14d1a6(_0x5a8947);}});});};EmailSmtp[_0x546b('0x5')][_0x546b('0x6')]=function(_0x30d395){return new Promise(function(_0x245fe9,_0x1b3327){var _0x285470=nodemailer[_0x546b('0x7')](_0x30d395);_0x285470[_0x546b('0x6')](function(_0x4d9323,_0x4bac22){if(_0x4d9323){_0x1b3327(_0x4d9323['toString']());}else{if(_0x4bac22){_0x245fe9(_0x4bac22);}else{_0x1b3327(_0x546b('0x8'));}}});});};module[_0x546b('0x9')]=EmailSmtp; \ No newline at end of file +var _0x077d=['compile','sendMail','toString','verify','Not\x20verifired','nodemailer','prototype','send','createTransport'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x077d,0xe6));var _0xd077=function(_0x1b61c2,_0x20ae1b){_0x1b61c2=_0x1b61c2-0x0;var _0x2856bd=_0x077d[_0x1b61c2];return _0x2856bd;};'use strict';var nodemailer=require(_0xd077('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xd077('0x1')][_0xd077('0x2')]=function(_0x510ea3,_0x31f141){return new Promise(function(_0x528575,_0x49b6d2){var _0xb3a2b1=nodemailer[_0xd077('0x3')](_0x510ea3);_0xb3a2b1['use'](_0xd077('0x4'),inlineBase64());_0xb3a2b1[_0xd077('0x5')](_0x31f141,function(_0x1d75b7,_0x1dada4){if(_0x1d75b7){_0x49b6d2(_0x1d75b7[_0xd077('0x6')]());}else{_0x528575(_0x1dada4);}});});};EmailSmtp[_0xd077('0x1')][_0xd077('0x7')]=function(_0x48642f){return new Promise(function(_0x5cd58b,_0xa2c00f){var _0x33b13b=nodemailer[_0xd077('0x3')](_0x48642f);_0x33b13b['verify'](function(_0x33e844,_0x40f748){if(_0x33e844){_0xa2c00f(_0x33e844['toString']());}else{if(_0x40f748){_0x5cd58b(_0x40f748);}else{_0xa2c00f(_0xd077('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 74a5f35..079a27f 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 _0x216d=['body','textAsHtml','message','originTo','isEmpty','originCc','bcc','attach','type','format','join','root','server/files/attachments/','writeFileSync','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','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','content','BodyHTML','

Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','lodash','moment','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','generate','@xcally.com','name','substring','indexOf','split','slice','Anonymous','length','anonymous','html','test','replace','includes','\x20[Attachment:\x20','\x20]'];(function(_0x5ea2c7,_0x5be5ca){var _0x1f9eba=function(_0x562963){while(--_0x562963){_0x5ea2c7['push'](_0x5ea2c7['shift']());}};_0x1f9eba(++_0x5be5ca);}(_0x216d,0x1d2));var _0xd216=function(_0x2fd9ee,_0x4823b0){_0x2fd9ee=_0x2fd9ee-0x0;var _0x25bef5=_0x216d[_0x2fd9ee];return _0x25bef5;};'use strict';var _=require(_0xd216('0x0'));var moment=require(_0xd216('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0xd216('0x2'));var util=require(_0xd216('0x3'));var tnef=require(_0xd216('0x4'));var logger=require(_0xd216('0x5'))(_0xd216('0x6'));var config=require(_0xd216('0x7'));function getAddress(_0x166f80){var _0x3065d2=_[_0xd216('0x8')](_0x166f80[_0xd216('0x9')]);return _0x3065d2&&_0x3065d2[_0xd216('0xa')]?_0x3065d2[_0xd216('0xa')]:'anonymous'+random[_0xd216('0xb')](0x6)+_0xd216('0xc');}function getFirstName(_0x283b89){var _0x57f197=_[_0xd216('0x8')](_0x283b89[_0xd216('0x9')]);if(_0x57f197&&_0x57f197[_0xd216('0xd')]){if(_0x57f197[_0xd216('0xd')]==_0x57f197[_0xd216('0xa')]){return _0x57f197[_0xd216('0xd')][_0xd216('0xe')](0x0,_0x57f197[_0xd216('0xd')][_0xd216('0xf')]('@'));}var _0x79b0b9=_0x57f197[_0xd216('0xd')][_0xd216('0x10')](/\s+/);return _0x79b0b9['length']>0x1?_0x79b0b9[_0xd216('0x11')](0x0,-0x1)['join']('\x20'):_0x57f197[_0xd216('0xd')];}return _0xd216('0x12');}function getLastName(_0xefcec0){var _0x175434=_['head'](_0xefcec0['value']);if(_0x175434&&_0x175434['name']){var _0x2a7033=_0x175434[_0xd216('0xd')][_0xd216('0x10')](/\s+/);return _0x2a7033['length']>0x1?_0x2a7033['pop']():'';}return'';}function getMails(_0x1d303f,_0x816c24){var _0x1a14f2='';for(var _0xca69b6=0x0;_0xca69b6<_0x816c24[_0xd216('0x9')][_0xd216('0x13')];_0xca69b6+=0x1){if(_0x816c24[_0xd216('0x9')][_0xca69b6][_0xd216('0xa')]!==_0x1d303f){if(!_['isEmpty'](_0x1a14f2)){_0x1a14f2+=',';}_0x1a14f2+=_0x816c24[_0xd216('0x9')][_0xca69b6]['name']||_0x816c24[_0xd216('0x9')][_0xca69b6][_0xd216('0xa')]||'';_0x1a14f2+='\x20<';_0x1a14f2+=_0x816c24[_0xd216('0x9')][_0xca69b6][_0xd216('0xa')]?_0x816c24[_0xd216('0x9')][_0xca69b6][_0xd216('0xa')]:_0xd216('0x14')+random[_0xd216('0xb')](0x6)+_0xd216('0xc');_0x1a14f2+='>';}}return _0x1a14f2;}function parseEmail(_0x269c37,_0x56ede0,_0x53998f){if(_0x56ede0[_0xd216('0x15')]){var _0x3c5f1b=/)<[^<]*)*<\/script>/gi;while(_0x3c5f1b[_0xd216('0x16')](_0x56ede0[_0xd216('0x15')])){_0x56ede0[_0xd216('0x15')]=_0x56ede0[_0xd216('0x15')][_0xd216('0x17')](_0x3c5f1b,'');}if(_0x56ede0['html'][_0xd216('0x18')](_0xd216('0x19'))){var _0xd98cee=[];_0x56ede0[_0xd216('0x1a')]['forEach'](_0x616c0c=>{_0xd98cee[_0xd216('0x1b')](_0x616c0c[_0xd216('0x1c')]);});var _0x542c36=/]+>/g;var _0xf56e6b=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5652be=_0x56ede0['html']['replace'](_0xf56e6b,'_SRC');var _0x88fc38=_0x5652be[_0xd216('0x17')](_0x542c36,_0xd216('0x1d'));for(let _0x15fa2d=0x0;_0x15fa2d<_0xd98cee[_0xd216('0x13')];_0x15fa2d++){var _0x270c24=_0x88fc38[_0xd216('0x17')](_0xd216('0x1d'),_0xd216('0x1e')+_0xd98cee[_0x15fa2d]+_0xd216('0x1f'));_0x88fc38=_0x270c24;}_0x56ede0[_0xd216('0x15')]=_0x88fc38;}_0x53998f['body']=_0x56ede0['html'];}else{_0x53998f[_0xd216('0x20')]=_0x56ede0[_0xd216('0x21')];}if(_0x53998f[_0xd216('0x20')]){_0x53998f[_0xd216('0x20')]=_0x53998f['body'][_0xd216('0x17')](/0x0){var _0x14a686=[_0xd216('0x30'),_0xd216('0x31'),'Precedence:\x20auto_reply'];for(var _0x55d8bb=0x0;_0x55d8bb<_0x56ede0['headerLines'][_0xd216('0x13')];_0x55d8bb++){var _0x24f95c=_[_0xd216('0xf')](_0x14a686,_0x56ede0[_0xd216('0x2f')][_0x55d8bb][_0xd216('0x32')]);if(_0x24f95c>=0x0){_0x53998f[_0xd216('0x33')]=!![];}}}return _0x53998f;}exports[_0xd216('0x34')]=function(_0x16ee29,_0x1b3ca6,_0x20a943){var _0x5b536d={'from':getAddress(_0x1b3ca6[_0xd216('0x35')]),'firstName':getFirstName(_0x1b3ca6[_0xd216('0x35')]),'lastName':getLastName(_0x1b3ca6[_0xd216('0x35')]),'mapKey':_0xd216('0x6'),'message':{'from':getMails(_0x16ee29[_0xd216('0x6')],_0x1b3ca6[_0xd216('0x35')]),'to':_0x16ee29[_0xd216('0x6')],'cc':'','subject':_0x1b3ca6[_0xd216('0x36')]||'','messageId':_0x1b3ca6[_0xd216('0x37')],'inReplyTo':_0x1b3ca6[_0xd216('0x38')],'sentAt':moment(_0x1b3ca6[_0xd216('0x39')])[_0xd216('0x29')](_0xd216('0x3a')),'attach':![],'attachments':[]}};if(!_0x1b3ca6[_0xd216('0x15')]&&!_0x1b3ca6[_0xd216('0x21')]){var _0x324029=_[_0xd216('0x3b')](_0x1b3ca6['attachments'],{'contentType':_0xd216('0x3c')});if(_0x324029[_0xd216('0x13')]){logger[_0xd216('0x3d')](util[_0xd216('0x29')](_0xd216('0x3e'),_0x1b3ca6['messageId']));tnef[_0xd216('0x3f')](_['first'](_0x324029)[_0xd216('0x40')],function(_0x25ea6f,_0x4b25ec){if(_0x4b25ec){_0x1b3ca6[_0xd216('0x15')]=_0x4b25ec[_0xd216('0x41')]||_0xd216('0x42');if(_0x4b25ec[_0xd216('0x43')]){for(var _0xef500d=0x0;_0xef500d<_0x4b25ec[_0xd216('0x43')][_0xd216('0x13')];_0xef500d++){var _0x5c74d9=_0x4b25ec[_0xd216('0x43')][_0xef500d];_0x5b536d[_0xd216('0x22')][_0xd216('0x1a')]['push']({'filename':_0x5c74d9['Title'],'content':Buffer[_0xd216('0x35')](_0x5c74d9[_0xd216('0x44')])});}}}_0x20a943(parseEmail(_0x16ee29,_0x1b3ca6,_0x5b536d));});}else{_0x1b3ca6['html']='

Empty\x20message

';_0x20a943(parseEmail(_0x16ee29,_0x1b3ca6,_0x5b536d));}}else{_0x20a943(parseEmail(_0x16ee29,_0x1b3ca6,_0x5b536d));}};exports[_0xd216('0x45')]=function(_0xc69aa7){switch(_0xc69aa7){case _0xd216('0x46'):return _0xd216('0x47');case _0xd216('0x48'):return _0xd216('0x49');case _0xd216('0x4a'):return _0xd216('0x4b');case _0xd216('0x4c'):return _0xd216('0x4d');}return _0xd216('0x4e');};exports[_0xd216('0x4f')]=function(_0x5ed70a,_0x121fbc){var _0x37ad43=['user='+(_0x121fbc||''),_0xd216('0x50')+_0x5ed70a,'',''];return Buffer[_0xd216('0x35')](_0x37ad43[_0xd216('0x2a')](''),_0xd216('0x51'))[_0xd216('0x52')]('base64');}; \ No newline at end of file +var _0x0222=['address','anonymous','generate','@xcally.com','name','substring','indexOf','split','join','Anonymous','length','isEmpty','test','html','replace','includes','','body','textAsHtml','originTo','message','originCc','bcc','attach','attachment','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','line','parser','from','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','messageId','content','BodyHTML','

Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','yahoo','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','generateXOAuth2Token','user=','utf-8','base64','lodash','moment','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0222,0x12a));var _0x2022=function(_0x3ec8e3,_0x5901d3){_0x3ec8e3=_0x3ec8e3-0x0;var _0x483ced=_0x0222[_0x3ec8e3];return _0x483ced;};'use strict';var _=require(_0x2022('0x0'));var moment=require(_0x2022('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x2022('0x2'));var util=require(_0x2022('0x3'));var tnef=require(_0x2022('0x4'));var logger=require(_0x2022('0x5'))(_0x2022('0x6'));var config=require(_0x2022('0x7'));function getAddress(_0x424cea){var _0x8b2a71=_[_0x2022('0x8')](_0x424cea[_0x2022('0x9')]);return _0x8b2a71&&_0x8b2a71[_0x2022('0xa')]?_0x8b2a71[_0x2022('0xa')]:_0x2022('0xb')+random[_0x2022('0xc')](0x6)+_0x2022('0xd');}function getFirstName(_0x52415a){var _0x45997f=_[_0x2022('0x8')](_0x52415a[_0x2022('0x9')]);if(_0x45997f&&_0x45997f[_0x2022('0xe')]){if(_0x45997f[_0x2022('0xe')]==_0x45997f['address']){return _0x45997f[_0x2022('0xe')][_0x2022('0xf')](0x0,_0x45997f[_0x2022('0xe')][_0x2022('0x10')]('@'));}var _0x39b21e=_0x45997f[_0x2022('0xe')][_0x2022('0x11')](/\s+/);return _0x39b21e['length']>0x1?_0x39b21e['slice'](0x0,-0x1)[_0x2022('0x12')]('\x20'):_0x45997f[_0x2022('0xe')];}return _0x2022('0x13');}function getLastName(_0x4a3e11){var _0x5eee11=_[_0x2022('0x8')](_0x4a3e11[_0x2022('0x9')]);if(_0x5eee11&&_0x5eee11['name']){var _0x1f3f6a=_0x5eee11[_0x2022('0xe')]['split'](/\s+/);return _0x1f3f6a['length']>0x1?_0x1f3f6a['pop']():'';}return'';}function getMails(_0x23e780,_0x59451c){var _0x2ad90d='';for(var _0x538580=0x0;_0x538580<_0x59451c['value'][_0x2022('0x14')];_0x538580+=0x1){if(_0x59451c['value'][_0x538580][_0x2022('0xa')]!==_0x23e780){if(!_[_0x2022('0x15')](_0x2ad90d)){_0x2ad90d+=',';}_0x2ad90d+=_0x59451c[_0x2022('0x9')][_0x538580][_0x2022('0xe')]||_0x59451c[_0x2022('0x9')][_0x538580][_0x2022('0xa')]||'';_0x2ad90d+='\x20<';_0x2ad90d+=_0x59451c[_0x2022('0x9')][_0x538580][_0x2022('0xa')]?_0x59451c[_0x2022('0x9')][_0x538580][_0x2022('0xa')]:_0x2022('0xb')+random[_0x2022('0xc')](0x6)+_0x2022('0xd');_0x2ad90d+='>';}}return _0x2ad90d;}function parseEmail(_0x309ca9,_0x34f9df,_0x9af4b1){if(_0x34f9df['html']){var _0x533ad8=/)<[^<]*)*<\/script>/gi;while(_0x533ad8[_0x2022('0x16')](_0x34f9df[_0x2022('0x17')])){_0x34f9df['html']=_0x34f9df[_0x2022('0x17')][_0x2022('0x18')](_0x533ad8,'');}if(_0x34f9df[_0x2022('0x17')][_0x2022('0x19')](_0x2022('0x1a'))){var _0x5dc47c=[];_0x34f9df[_0x2022('0x1b')][_0x2022('0x1c')](_0x1a5d08=>{_0x5dc47c[_0x2022('0x1d')](_0x1a5d08[_0x2022('0x1e')]);});var _0x4c8567=/]+>/g;var _0x1caf84=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x35ecc5=_0x34f9df['html'][_0x2022('0x18')](_0x1caf84,_0x2022('0x1f'));var _0x236586=_0x35ecc5['replace'](_0x4c8567,_0x2022('0x20'));for(let _0x3a9bc2=0x0;_0x3a9bc2<_0x5dc47c['length'];_0x3a9bc2++){var _0x4666c9=_0x236586[_0x2022('0x18')](_0x2022('0x20'),'\x20[Attachment:\x20'+_0x5dc47c[_0x3a9bc2]+_0x2022('0x21'));_0x236586=_0x4666c9;}_0x34f9df[_0x2022('0x17')]=_0x236586;}_0x9af4b1[_0x2022('0x22')]=_0x34f9df[_0x2022('0x17')];}else{_0x9af4b1[_0x2022('0x22')]=_0x34f9df[_0x2022('0x23')];}if(_0x9af4b1[_0x2022('0x22')]){_0x9af4b1[_0x2022('0x22')]=_0x9af4b1[_0x2022('0x22')][_0x2022('0x18')](/0x0){var _0x12181a=[_0x2022('0x33'),_0x2022('0x34'),'Precedence:\x20auto_reply'];for(var _0x28a2d6=0x0;_0x28a2d6<_0x34f9df['headerLines'][_0x2022('0x14')];_0x28a2d6++){var _0x3862e0=_[_0x2022('0x10')](_0x12181a,_0x34f9df[_0x2022('0x32')][_0x28a2d6][_0x2022('0x35')]);if(_0x3862e0>=0x0){_0x9af4b1['isAutoreply']=!![];}}}return _0x9af4b1;}exports[_0x2022('0x36')]=function(_0x542a6f,_0x2e4c8a,_0x9951a4){var _0x54df4b={'from':getAddress(_0x2e4c8a[_0x2022('0x37')]),'firstName':getFirstName(_0x2e4c8a[_0x2022('0x37')]),'lastName':getLastName(_0x2e4c8a[_0x2022('0x37')]),'mapKey':_0x2022('0x6'),'message':{'from':getMails(_0x542a6f[_0x2022('0x6')],_0x2e4c8a[_0x2022('0x37')]),'to':_0x542a6f[_0x2022('0x6')],'cc':'','subject':_0x2e4c8a['subject']||'','messageId':_0x2e4c8a['messageId'],'inReplyTo':_0x2e4c8a[_0x2022('0x38')],'sentAt':moment(_0x2e4c8a[_0x2022('0x39')])['format'](_0x2022('0x3a')),'attach':![],'attachments':[]}};if(!_0x2e4c8a[_0x2022('0x17')]&&!_0x2e4c8a['textAsHtml']){var _0x3fdb67=_['filter'](_0x2e4c8a[_0x2022('0x1b')],{'contentType':'application/ms-tnef'});if(_0x3fdb67['length']){logger['info'](util[_0x2022('0x2b')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x2e4c8a[_0x2022('0x3b')]));tnef['parseBuffer'](_['first'](_0x3fdb67)[_0x2022('0x3c')],function(_0x743704,_0xcaf249){if(_0xcaf249){_0x2e4c8a[_0x2022('0x17')]=_0xcaf249[_0x2022('0x3d')]||_0x2022('0x3e');if(_0xcaf249['Attachments']){for(var _0x38837b=0x0;_0x38837b<_0xcaf249[_0x2022('0x3f')][_0x2022('0x14')];_0x38837b++){var _0x5bdc81=_0xcaf249[_0x2022('0x3f')][_0x38837b];_0x54df4b[_0x2022('0x25')]['attachments'][_0x2022('0x1d')]({'filename':_0x5bdc81['Title'],'content':Buffer[_0x2022('0x37')](_0x5bdc81[_0x2022('0x40')])});}}}_0x9951a4(parseEmail(_0x542a6f,_0x2e4c8a,_0x54df4b));});}else{_0x2e4c8a[_0x2022('0x17')]='

Empty\x20message

';_0x9951a4(parseEmail(_0x542a6f,_0x2e4c8a,_0x54df4b));}}else{_0x9951a4(parseEmail(_0x542a6f,_0x2e4c8a,_0x54df4b));}};exports[_0x2022('0x41')]=function(_0x11cb66){switch(_0x11cb66){case _0x2022('0x42'):return _0x2022('0x43');case _0x2022('0x44'):return'imap.mail.yahoo.com';case'hotmail':return _0x2022('0x45');case _0x2022('0x46'):return _0x2022('0x47');}return _0x2022('0x48');};exports[_0x2022('0x49')]=function(_0x2888d5,_0x33a812){var _0x332358=[_0x2022('0x4a')+(_0x33a812||''),'auth=Bearer\x20'+_0x2888d5,'',''];return Buffer[_0x2022('0x37')](_0x332358[_0x2022('0x12')](''),_0x2022('0x4b'))['toString'](_0x2022('0x4c'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 18bd606..c5126eb 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 _0x51c4=['SERV','active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x54d3e2,_0x43a986){var _0x24bf33=function(_0xf3ece1){while(--_0xf3ece1){_0x54d3e2['push'](_0x54d3e2['shift']());}};_0x24bf33(++_0x43a986);}(_0x51c4,0x1b5));var _0x451c=function(_0x394338,_0x751fd7){_0x394338=_0x394338-0x0;var _0x1ecdb0=_0x51c4[_0x394338];return _0x1ecdb0;};'use strict';var _=require(_0x451c('0x0'));function MailAccount(_0x5e83e7){this['id']=_0x5e83e7['id']||0x0;this['name']=_0x5e83e7[_0x451c('0x1')]||_0x451c('0x2');this[_0x451c('0x3')]=_0x5e83e7[_0x451c('0x3')]||_0x451c('0x4');this[_0x451c('0x5')]=_0x5e83e7['active']||![];this[_0x451c('0x6')]=_0x5e83e7['Imap']||[];this[_0x451c('0x7')]=_0x5e83e7['Smtp']||[];}module[_0x451c('0x8')]=MailAccount; \ No newline at end of file +var _0x32b2=['name','Service','key','SERV','active','Smtp','lodash'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x32b2,0xf4));var _0x232b=function(_0x5abdfc,_0x385c27){_0x5abdfc=_0x5abdfc-0x0;var _0x124657=_0x32b2[_0x5abdfc];return _0x124657;};'use strict';var _=require(_0x232b('0x0'));function MailAccount(_0x14da9a){this['id']=_0x14da9a['id']||0x0;this[_0x232b('0x1')]=_0x14da9a[_0x232b('0x1')]||_0x232b('0x2');this[_0x232b('0x3')]=_0x14da9a['key']||_0x232b('0x4');this[_0x232b('0x5')]=_0x14da9a[_0x232b('0x5')]||![];this['Imap']=_0x14da9a['Imap']||[];this[_0x232b('0x6')]=_0x14da9a[_0x232b('0x6')]||[];}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 9a7b3f4..fc52dc7 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 _0xf3eb=['isUndefined','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length'];(function(_0x2d0c65,_0x132bc0){var _0x2a191b=function(_0x3a2bb1){while(--_0x3a2bb1){_0x2d0c65['push'](_0x2d0c65['shift']());}};_0x2a191b(++_0x132bc0);}(_0xf3eb,0x1af));var _0xbf3e=function(_0x4dda41,_0x20f5d0){_0x4dda41=_0x4dda41-0x0;var _0x3cad9e=_0xf3eb[_0x4dda41];return _0x3cad9e;};'use strict';var _=require(_0xbf3e('0x0'));var MailAccount=require(_0xbf3e('0x1'));var Realtime=function(){this[_0xbf3e('0x2')]={};};function freeIsNotKey(_0x15826a,_0x109fd5,_0x40e4ca){var _0x1b22b6=_[_0xbf3e('0x3')](_0x15826a,function(_0x26f321,_0x4f95e7){return _0x26f321[_0x40e4ca];});for(var _0x595d65 in _0x109fd5){if(_0x109fd5[_0xbf3e('0x4')](_0x595d65)){if(!_0x1b22b6[_0x595d65]){delete _0x109fd5[_0x595d65];}}}}Realtime['prototype'][_0xbf3e('0x5')]=function(_0x53f01f,_0x86ae7){for(var _0x3692c9 in _0x86ae7){if(_0x53f01f['hasOwnProperty'](_0x3692c9)){_0x53f01f[_0x3692c9]=_0x86ae7[_0x3692c9];}}};Realtime[_0xbf3e('0x6')][_0xbf3e('0x7')]=function(){var _0x23ebdf=this;return function(_0x1b299a){if(_0x1b299a){freeIsNotKey(_0x1b299a,_0x23ebdf['mailAccounts'],'id');for(var _0x479064=0x0,_0x328b74={},_0x5681ca={};_0x479064<_0x1b299a[_0xbf3e('0x8')];_0x479064+=0x1){_0x328b74=_0x1b299a[_0x479064];if(_[_0xbf3e('0x9')](_0x23ebdf[_0xbf3e('0x2')][_0x328b74['id']])){_0x23ebdf['mailAccounts'][_0x328b74['id']]=new MailAccount(_0x328b74);}else{_['merge'](_0x23ebdf[_0xbf3e('0x2')][_0x328b74['id']],_0x328b74);}}}return _0x23ebdf[_0xbf3e('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0xe014=['prototype','initMailAccounts','length','isUndefined','merge','exports','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0xe014,0x1b4));var _0x4e01=function(_0x52250c,_0x21083f){_0x52250c=_0x52250c-0x0;var _0x57c649=_0xe014[_0x52250c];return _0x57c649;};'use strict';var _=require('lodash');var MailAccount=require(_0x4e01('0x0'));var Realtime=function(){this[_0x4e01('0x1')]={};};function freeIsNotKey(_0x18a3bd,_0x1bd9e7,_0x546a0e){var _0x323ff0=_[_0x4e01('0x2')](_0x18a3bd,function(_0x2665ef,_0xf4709c){return _0x2665ef[_0x546a0e];});for(var _0x58df58 in _0x1bd9e7){if(_0x1bd9e7[_0x4e01('0x3')](_0x58df58)){if(!_0x323ff0[_0x58df58]){delete _0x1bd9e7[_0x58df58];}}}}Realtime[_0x4e01('0x4')]['mergeFromDatabase']=function(_0x2fefbf,_0x4f0b6f){for(var _0x3b4a82 in _0x4f0b6f){if(_0x2fefbf['hasOwnProperty'](_0x3b4a82)){_0x2fefbf[_0x3b4a82]=_0x4f0b6f[_0x3b4a82];}}};Realtime['prototype'][_0x4e01('0x5')]=function(){var _0x5d8938=this;return function(_0x4a656a){if(_0x4a656a){freeIsNotKey(_0x4a656a,_0x5d8938[_0x4e01('0x1')],'id');for(var _0x25b572=0x0,_0x287025={},_0x236dfe={};_0x25b572<_0x4a656a[_0x4e01('0x6')];_0x25b572+=0x1){_0x287025=_0x4a656a[_0x25b572];if(_[_0x4e01('0x7')](_0x5d8938['mailAccounts'][_0x287025['id']])){_0x5d8938[_0x4e01('0x1')][_0x287025['id']]=new MailAccount(_0x287025);}else{_[_0x4e01('0x8')](_0x5d8938['mailAccounts'][_0x287025['id']],_0x287025);}}}return _0x5d8938[_0x4e01('0x1')];};};module[_0x4e01('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 946f31a..c2dbc0a 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 _0x1db9=['getMailAccounts','Request','GetMailAccount','name','provider','email','active','TemplateId','CloudProvider','service','type','data5','MailServerOut','NotifyMailAccount','../client'];(function(_0x98b6ca,_0x5aedd6){var _0x4cf12a=function(_0x40e6d0){while(--_0x40e6d0){_0x98b6ca['push'](_0x98b6ca['shift']());}};_0x4cf12a(++_0x5aedd6);}(_0x1db9,0x176));var _0x91db=function(_0x168f01,_0xd7e6fd){_0x168f01=_0x168f01-0x0;var _0x149c54=_0x1db9[_0x168f01];return _0x149c54;};'use strict';var client=require(_0x91db('0x0'));exports[_0x91db('0x1')]=function(){return function(){return client[_0x91db('0x2')](_0x91db('0x3'),{'options':{'attributes':['id',_0x91db('0x4'),_0x91db('0x5'),'service',_0x91db('0x6'),_0x91db('0x7'),'key','ListId',_0x91db('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':_0x91db('0x9'),'attributes':['id',_0x91db('0x4'),_0x91db('0xa'),_0x91db('0xb'),_0x91db('0xc')],'as':'CloudProvider'}]},{'model':_0x91db('0xd'),'as':'Smtp','include':[{'model':_0x91db('0x9'),'attributes':['id',_0x91db('0x4'),_0x91db('0xa'),'type',_0x91db('0xc')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports['notify']=function(_0x14f9ad,_0xc1f5d4){return client['Request']('NotifyMailAccount',{'account':{'id':_0x14f9ad},'body':_0xc1f5d4,'log':_0x91db('0xe')});}; \ No newline at end of file +var _0xb35d=['ListId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email','key'];(function(_0x1a2f35,_0x2bcaee){var _0x1b276d=function(_0x125cb9){while(--_0x125cb9){_0x1a2f35['push'](_0x1a2f35['shift']());}};_0x1b276d(++_0x2bcaee);}(_0xb35d,0x14b));var _0xdb35=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0xb35d[_0x264545];return _0x114d10;};'use strict';var client=require(_0xdb35('0x0'));exports[_0xdb35('0x1')]=function(){return function(){return client[_0xdb35('0x2')](_0xdb35('0x3'),{'options':{'attributes':['id',_0xdb35('0x4'),_0xdb35('0x5'),_0xdb35('0x6'),_0xdb35('0x7'),'active',_0xdb35('0x8'),_0xdb35('0x9'),'TemplateId'],'raw':![],'include':[{'model':_0xdb35('0xa'),'as':_0xdb35('0xb'),'include':[{'model':_0xdb35('0xc'),'attributes':['id',_0xdb35('0x4'),_0xdb35('0x6'),_0xdb35('0xd'),_0xdb35('0xe')],'as':'CloudProvider'}]},{'model':_0xdb35('0xf'),'as':_0xdb35('0x10'),'include':[{'model':_0xdb35('0xc'),'attributes':['id',_0xdb35('0x4'),_0xdb35('0x6'),_0xdb35('0xd'),_0xdb35('0xe')],'as':_0xdb35('0xc')}]}]},'log':_0xdb35('0x11')});};};exports[_0xdb35('0x12')]=function(_0x5826f0,_0x3774f7){return client[_0xdb35('0x2')](_0xdb35('0x13'),{'account':{'id':_0x5826f0},'body':_0x3774f7,'log':_0xdb35('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index ac01f2d..d69865c 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 _0x9aea=['GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x18b191,_0x4e0684){var _0x43e146=function(_0x4b464e){while(--_0x4b464e){_0x18b191['push'](_0x18b191['shift']());}};_0x43e146(++_0x4e0684);}(_0x9aea,0x1eb));var _0xa9ae=function(_0x1cd2da,_0x56e7b6){_0x1cd2da=_0x1cd2da-0x0;var _0x201be7=_0x9aea[_0x1cd2da];return _0x201be7;};'use strict';var client=require(_0xa9ae('0x0'));exports[_0xa9ae('0x1')]=function(){return client[_0xa9ae('0x2')](_0xa9ae('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xa9ae('0x4')});}; \ No newline at end of file +var _0x5965=['loginMailFrequency','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x2b39ff,_0xa39123){var _0x50acfe=function(_0x4d02f6){while(--_0x4d02f6){_0x2b39ff['push'](_0x2b39ff['shift']());}};_0x50acfe(++_0xa39123);}(_0x5965,0xce));var _0x5596=function(_0x253ee3,_0x12aeaa){_0x253ee3=_0x253ee3-0x0;var _0x4faebe=_0x5965[_0x253ee3];return _0x4faebe;};'use strict';var client=require(_0x5596('0x0'));exports[_0x5596('0x1')]=function(){return client[_0x5596('0x2')](_0x5596('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5596('0x4')]},'log':_0x5596('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index f274fac..2ef5622 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 0e00ac2..abb63b1 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 _0x7fcd=['listen','websocket','polling','redis','defaults','localhost','adapter','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','port','lodash','express','sticky-session','ioredis','../../config/environment','createServer','timeout'];(function(_0x434ecd,_0x1d3d60){var _0x491c4f=function(_0x45eef5){while(--_0x45eef5){_0x434ecd['push'](_0x434ecd['shift']());}};_0x491c4f(++_0x1d3d60);}(_0x7fcd,0x1f3));var _0xd7fc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7fcd[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xd7fc('0x0'));var http=require('http');var express=require(_0xd7fc('0x1'));var sticky=require(_0xd7fc('0x2'));var Redis=require(_0xd7fc('0x3'));var config=require(_0xd7fc('0x4'));var app=express();var server=http[_0xd7fc('0x5')](app);server[_0xd7fc('0x6')]=0xdbba0;if(sticky[_0xd7fc('0x7')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':[_0xd7fc('0x8'),_0xd7fc('0x9')]});config[_0xd7fc('0xa')]=_[_0xd7fc('0xb')](config['redis'],{'host':_0xd7fc('0xc'),'port':0x18eb});socketio[_0xd7fc('0xd')](require('socket.io-redis')({'pubClient':new Redis(config[_0xd7fc('0xa')]),'subClient':new Redis(config[_0xd7fc('0xa')])}));require(_0xd7fc('0xe'))[_0xd7fc('0xf')]();require(_0xd7fc('0x10'))[_0xd7fc('0xf')](socketio);require(_0xd7fc('0x11'))[_0xd7fc('0xf')](app);require(_0xd7fc('0x12'))[_0xd7fc('0xf')](app);}else{server['once'](_0xd7fc('0x13'),function(){console['log'](_0xd7fc('0x14'),config[_0xd7fc('0x15')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xf6c9=['socket.io-redis','../../config/triggers','default','../../config/express','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','ioredis','../../config/environment','timeout','port','websocket','polling','defaults','redis','localhost'];(function(_0x58a6ad,_0x3bf900){var _0xa099fc=function(_0x43e8c7){while(--_0x43e8c7){_0x58a6ad['push'](_0x58a6ad['shift']());}};_0xa099fc(++_0x3bf900);}(_0xf6c9,0x103));var _0x9f6c=function(_0x413092,_0x110b09){_0x413092=_0x413092-0x0;var _0x20fc75=_0xf6c9[_0x413092];return _0x20fc75;};'use strict';var _=require(_0x9f6c('0x0'));var http=require(_0x9f6c('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require(_0x9f6c('0x2'));var config=require(_0x9f6c('0x3'));var app=express();var server=http['createServer'](app);server[_0x9f6c('0x4')]=0xdbba0;if(sticky['listen'](server,config[_0x9f6c('0x5')])){var socketio=require('socket.io')(server,{'transports':[_0x9f6c('0x6'),_0x9f6c('0x7')]});config['redis']=_[_0x9f6c('0x8')](config[_0x9f6c('0x9')],{'host':_0x9f6c('0xa'),'port':0x18eb});socketio['adapter'](require(_0x9f6c('0xb'))({'pubClient':new Redis(config[_0x9f6c('0x9')]),'subClient':new Redis(config[_0x9f6c('0x9')])}));require(_0x9f6c('0xc'))[_0x9f6c('0xd')]();require('../../config/socketio')[_0x9f6c('0xd')](socketio);require(_0x9f6c('0xe'))[_0x9f6c('0xd')](app);require('../../routes')[_0x9f6c('0xd')](app);}else{server[_0x9f6c('0xf')]('listening',function(){console[_0x9f6c('0x10')](_0x9f6c('0x11'),config['port']);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index f85e1fb..e0ee6c0 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 _0xbfbc=['error','message','result','catch','exports','jayson/promise','bluebird','client','request','then','debug','rpc','routing'];(function(_0x515191,_0x18a7fb){var _0xa5569b=function(_0xb9fde6){while(--_0xb9fde6){_0x515191['push'](_0x515191['shift']());}};_0xa5569b(++_0x18a7fb);}(_0xbfbc,0x1cc));var _0xcbfb=function(_0x18bdd1,_0x87b385){_0x18bdd1=_0x18bdd1-0x0;var _0x509902=_0xbfbc[_0x18bdd1];return _0x509902;};'use strict';var jayson=require(_0xcbfb('0x0'));var BPromise=require(_0xcbfb('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0xcbfb('0x2')]['http']({'port':0x2329});client['Request']=function(_0x22ec5b,_0x1096b7){return new BPromise(function(_0x3e9d0e,_0x437408){return client[_0xcbfb('0x3')](_0x22ec5b,_0x1096b7)[_0xcbfb('0x4')](function(_0xde5ceb){logger[_0xcbfb('0x5')](_0xcbfb('0x6'),_0xcbfb('0x7'),_0x22ec5b,_0x1096b7,_0xde5ceb);if(_0xde5ceb['error']){logger[_0xcbfb('0x8')](_0xcbfb('0x6'),_0xcbfb('0x7'),_0x22ec5b,_0xde5ceb[_0xcbfb('0x8')][_0xcbfb('0x9')],_0x1096b7);return _0x437408(_0xde5ceb['error'][_0xcbfb('0x9')]);}else{return _0x3e9d0e(_0xde5ceb[_0xcbfb('0xa')]);}})[_0xcbfb('0xb')](function(_0x33b9b8){logger[_0xcbfb('0x8')](_0xcbfb('0x6'),_0xcbfb('0x7'),_0x22ec5b,_0x33b9b8,_0x1096b7);return _0x437408(_0x33b9b8);});});};module[_0xcbfb('0xc')]=client; \ No newline at end of file +var _0xa473=['debug','rpc','routing','error','message','result','catch','client','http','Request','then'];(function(_0x4191af,_0x5783da){var _0x27bebf=function(_0x355be7){while(--_0x355be7){_0x4191af['push'](_0x4191af['shift']());}};_0x27bebf(++_0x5783da);}(_0xa473,0x96));var _0x3a47=function(_0x33374d,_0x2dd106){_0x33374d=_0x33374d-0x0;var _0x9a23bb=_0xa473[_0x33374d];return _0x9a23bb;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson[_0x3a47('0x0')][_0x3a47('0x1')]({'port':0x2329});client[_0x3a47('0x2')]=function(_0x10d62e,_0x4bbc32){return new BPromise(function(_0x53c5eb,_0x457927){return client['request'](_0x10d62e,_0x4bbc32)[_0x3a47('0x3')](function(_0x388aa5){logger[_0x3a47('0x4')](_0x3a47('0x5'),_0x3a47('0x6'),_0x10d62e,_0x4bbc32,_0x388aa5);if(_0x388aa5[_0x3a47('0x7')]){logger[_0x3a47('0x7')](_0x3a47('0x5'),_0x3a47('0x6'),_0x10d62e,_0x388aa5[_0x3a47('0x7')][_0x3a47('0x8')],_0x4bbc32);return _0x457927(_0x388aa5[_0x3a47('0x7')][_0x3a47('0x8')]);}else{return _0x53c5eb(_0x388aa5[_0x3a47('0x9')]);}})[_0x3a47('0xa')](function(_0x499753){logger[_0x3a47('0x7')](_0x3a47('0x5'),_0x3a47('0x6'),_0x10d62e,_0x499753,_0x4bbc32);return _0x457927(_0x499753);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index eca9f0f..1c31632 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 _0xb551=['getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals'];(function(_0x5705f2,_0x23c960){var _0x27f566=function(_0x23a31d){while(--_0x23a31d){_0x5705f2['push'](_0x5705f2['shift']());}};_0x27f566(++_0x23c960);}(_0xb551,0xdb));var _0x1b55=function(_0x34e9ec,_0x14495e){_0x34e9ec=_0x34e9ec-0x0;var _0x2233f7=_0xb551[_0x34e9ec];return _0x2233f7;};'use strict';var BPromise=require(_0x1b55('0x0'));var server=require('./server');var Realtime=require(_0x1b55('0x1'));var user=require(_0x1b55('0x2'));var interval=require(_0x1b55('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x1b55('0x4'));var smsQueue=require(_0x1b55('0x5'));var mailQueue=require(_0x1b55('0x6'));var faxQueue=require(_0x1b55('0x7'));var whatsappQueue=require(_0x1b55('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x1b55('0x9')]()[_0x1b55('0xa')](user[_0x1b55('0xb')]())[_0x1b55('0xa')](realtime[_0x1b55('0xc')]())[_0x1b55('0xa')](interval[_0x1b55('0xd')]())[_0x1b55('0xa')](realtime[_0x1b55('0xe')]())[_0x1b55('0xa')](openchannelQueue[_0x1b55('0xf')]())[_0x1b55('0xa')](realtime[_0x1b55('0x10')]())['then'](chatQueue['getChatQueues']())[_0x1b55('0xa')](realtime[_0x1b55('0x11')]())[_0x1b55('0xa')](smsQueue[_0x1b55('0x12')]())[_0x1b55('0xa')](realtime[_0x1b55('0x13')]())['then'](mailQueue['getMailQueues']())[_0x1b55('0xa')](realtime['initMailQueues']())[_0x1b55('0xa')](faxQueue[_0x1b55('0x14')]())[_0x1b55('0xa')](realtime[_0x1b55('0x15')]())[_0x1b55('0xa')](whatsappQueue['getWhatsappQueues']())[_0x1b55('0xa')](realtime[_0x1b55('0x16')]())[_0x1b55('0xa')](function(){return realtime;});}function main(){return server[_0x1b55('0x17')](realtime)['then'](function(_0x21577b){return initRealtime();})[_0x1b55('0xa')](function(_0x20ba41){return setInterval(initRealtime,0x1388);})[_0x1b55('0x18')](function(_0x53dc45){console[_0x1b55('0x19')](_0x53dc45);});}main(); \ No newline at end of file +var _0xfc23=['initAgents','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then'];(function(_0xd42e4f,_0x4d0e31){var _0x2369f1=function(_0x4df2d1){while(--_0x4df2d1){_0xd42e4f['push'](_0xd42e4f['shift']());}};_0x2369f1(++_0x4d0e31);}(_0xfc23,0x1c1));var _0x3fc2=function(_0x414c3c,_0xfec78e){_0x414c3c=_0x414c3c-0x0;var _0x417d52=_0xfc23[_0x414c3c];return _0x417d52;};'use strict';var BPromise=require(_0x3fc2('0x0'));var server=require(_0x3fc2('0x1'));var Realtime=require(_0x3fc2('0x2'));var user=require(_0x3fc2('0x3'));var interval=require(_0x3fc2('0x4'));var openchannelQueue=require(_0x3fc2('0x5'));var chatQueue=require(_0x3fc2('0x6'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x3fc2('0x7'));var whatsappQueue=require(_0x3fc2('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x3fc2('0x9')]()[_0x3fc2('0xa')](user['getAgents']())[_0x3fc2('0xa')](realtime[_0x3fc2('0xb')]())['then'](interval['getIntervals']())[_0x3fc2('0xa')](realtime['initIntervals']())[_0x3fc2('0xa')](openchannelQueue[_0x3fc2('0xc')]())[_0x3fc2('0xa')](realtime[_0x3fc2('0xd')]())[_0x3fc2('0xa')](chatQueue['getChatQueues']())['then'](realtime[_0x3fc2('0xe')]())['then'](smsQueue[_0x3fc2('0xf')]())[_0x3fc2('0xa')](realtime[_0x3fc2('0x10')]())['then'](mailQueue['getMailQueues']())[_0x3fc2('0xa')](realtime['initMailQueues']())[_0x3fc2('0xa')](faxQueue[_0x3fc2('0x11')]())[_0x3fc2('0xa')](realtime[_0x3fc2('0x12')]())[_0x3fc2('0xa')](whatsappQueue[_0x3fc2('0x13')]())[_0x3fc2('0xa')](realtime[_0x3fc2('0x14')]())[_0x3fc2('0xa')](function(){return realtime;});}function main(){return server[_0x3fc2('0x15')](realtime)[_0x3fc2('0xa')](function(_0x4ac4bc){return initRealtime();})['then'](function(_0x107569){return setInterval(initRealtime,0x1388);})[_0x3fc2('0x16')](function(_0xa99787){console['log'](_0xa99787);});}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 7cdc487..01289dc 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0xd3c394,_0x3d429f){var _0x586f8f=function(_0x3b1172){while(--_0x3b1172){_0xd3c394['push'](_0xd3c394['shift']());}};_0x586f8f(++_0x3d429f);}(_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 EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _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(_0x261956,_0x17f754){var _0x3ec5a4=function(_0x33fabc){while(--_0x33fabc){_0x261956['push'](_0x261956['shift']());}};_0x3ec5a4(++_0x17f754);}(_0x2ef3,0xba));var _0x32ef=function(_0x4cf545,_0x27153e){_0x4cf545=_0x4cf545-0x0;var _0x2d8282=_0x2ef3[_0x4cf545];return _0x2d8282;};'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 diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 416cbab..6b3c2fa 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 _0x6ad7=['message','result','catch','SendMail','bluebird','client','http','request','then','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ad7,0xd6));var _0x76ad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ad7[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x76ad('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x76ad('0x1')][_0x76ad('0x2')]({'port':0x232b});function request(_0x2e5fb0,_0x344474){return new BPromise(function(_0x50e6d2,_0x1946a1){return client[_0x76ad('0x3')](_0x2e5fb0,_0x344474)[_0x76ad('0x4')](function(_0x57dca3){if(_0x57dca3[_0x76ad('0x5')]){return _0x1946a1(_0x57dca3[_0x76ad('0x5')][_0x76ad('0x6')]);}else{return _0x50e6d2(_0x57dca3[_0x76ad('0x7')]);}})[_0x76ad('0x8')](function(_0x351911){return _0x1946a1(_0x351911);});});}exports['sendMailMessage']=function(_0x4650fc,_0x45ae6e){return request(_0x76ad('0x9'),{'account':_0x4650fc,'message':_0x45ae6e});}; \ No newline at end of file +var _0xa8ea=['http','request','error','catch','bluebird'];(function(_0x555a88,_0x2a4f48){var _0xeafc28=function(_0x34341a){while(--_0x34341a){_0x555a88['push'](_0x555a88['shift']());}};_0xeafc28(++_0x2a4f48);}(_0xa8ea,0xef));var _0xaa8e=function(_0x53b25e,_0x1d5b79){_0x53b25e=_0x53b25e-0x0;var _0x143c0f=_0xa8ea[_0x53b25e];return _0x143c0f;};'use strict';var BPromise=require(_0xaa8e('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0xaa8e('0x1')]({'port':0x232b});function request(_0x451863,_0x270d62){return new BPromise(function(_0x30c44b,_0x5a73ef){return client[_0xaa8e('0x2')](_0x451863,_0x270d62)['then'](function(_0x30e2be){if(_0x30e2be[_0xaa8e('0x3')]){return _0x5a73ef(_0x30e2be[_0xaa8e('0x3')]['message']);}else{return _0x30c44b(_0x30e2be['result']);}})[_0xaa8e('0x4')](function(_0x4a2d51){return _0x5a73ef(_0x4a2d51);});});}exports['sendMailMessage']=function(_0x20d3fb,_0x266dcf){return request('SendMail',{'account':_0x20d3fb,'message':_0x266dcf});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index ad528a1..a8807da 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 _0xd87d=['fax','sms','whatsapp','length','getChannelStatus','toNumber','format','Status','chatStatusTime','faxCurrentCapacity','smsStatusTime','whatsappCurrentCapacity','openchannelStatusTime','emit','user:save','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','mail'];(function(_0x6783e0,_0x284d5c){var _0x379add=function(_0x5a192a){while(--_0x5a192a){_0x6783e0['push'](_0x6783e0['shift']());}};_0x379add(++_0x284d5c);}(_0xd87d,0x16b));var _0xdd87=function(_0x50b456,_0x138883){_0x50b456=_0x50b456-0x0;var _0x37b0c1=_0xd87d[_0x50b456];return _0x37b0c1;};'use strict';var _=require(_0xdd87('0x0'));var moment=require('moment');var md5=require(_0xdd87('0x1'));var Redis=require('ioredis');var config=require(_0xdd87('0x2'));config[_0xdd87('0x3')]=_['defaults'](config['redis'],{'host':_0xdd87('0x4'),'port':0x18eb});var io=require(_0xdd87('0x5'))(new Redis(config['redis']));function Agent(_0x3bc3d9){this['id']=_0x3bc3d9['id']||0x0;this[_0xdd87('0x6')]=_0x3bc3d9[_0xdd87('0x6')]||'';this[_0xdd87('0x7')]=_0x3bc3d9[_0xdd87('0x7')]||!![];this['voicePause']=_0x3bc3d9[_0xdd87('0x8')]||![];this[_0xdd87('0x9')]=_0x3bc3d9['chatPause']||![];this['mailPause']=_0x3bc3d9[_0xdd87('0xa')]||![];this[_0xdd87('0xb')]=_0x3bc3d9[_0xdd87('0xb')]||![];this[_0xdd87('0xc')]=_0x3bc3d9['smsPause']||![];this['openchannelPause']=_0x3bc3d9[_0xdd87('0xd')]||![];this[_0xdd87('0xe')]=_0xdd87('0xf');this['chatStatusTime']=0x0;this[_0xdd87('0x10')]=_0x3bc3d9[_0xdd87('0x10')]||0x0;this[_0xdd87('0x11')]=0x0;this[_0xdd87('0x12')]=_0xdd87('0xf');this[_0xdd87('0x13')]=0x0;this[_0xdd87('0x14')]=_0x3bc3d9[_0xdd87('0x14')]||0x0;this[_0xdd87('0x15')]=0x0;this[_0xdd87('0x16')]='unknown';this[_0xdd87('0x17')]=0x0;this[_0xdd87('0x18')]=_0x3bc3d9[_0xdd87('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']='unknown';this['smsStatusTime']=0x0;this[_0xdd87('0x19')]=_0x3bc3d9['smsCapacity']||0x0;this[_0xdd87('0x1a')]=0x0;this[_0xdd87('0x1b')]=_0xdd87('0xf');this[_0xdd87('0x1c')]=0x0;this['whatsappCapacity']=_0x3bc3d9[_0xdd87('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xdd87('0x1e')]=_0xdd87('0xf');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x3bc3d9[_0xdd87('0x1f')]||0x0;this[_0xdd87('0x20')]=0x0;this[_0xdd87('0x21')]=![];this[_0xdd87('0x22')]=undefined;this['md5']='';this[_0xdd87('0x23')]();}Agent[_0xdd87('0x24')]['getChannelStatus']=function(_0x4b3b29){if(this[_0x4b3b29+_0xdd87('0x25')]>0x0){if(this[_0x4b3b29+'Capacity']>0x0&&this[_0x4b3b29+'CurrentCapacity']>=this[_0x4b3b29+_0xdd87('0x26')]){return _0xdd87('0x27');}else{return _0xdd87('0x28');}}else{return _0xdd87('0x29');}};Agent[_0xdd87('0x24')][_0xdd87('0x23')]=function(){var _0x39c26c=[_0xdd87('0x2a'),'chat','openchannel',_0xdd87('0x2b'),_0xdd87('0x2c'),_0xdd87('0x2d')];for(var _0x1c30e7=0x0;_0x1c30e7<_0x39c26c[_0xdd87('0x2e')];_0x1c30e7+=0x1){var _0x578bfd=this[_0xdd87('0x2f')](_0x39c26c[_0x1c30e7]);if(this[_0x39c26c[_0x1c30e7]+'Status']!==_0x578bfd){this[_0x39c26c[_0x1c30e7]+'StatusTime']=_[_0xdd87('0x30')](moment()[_0xdd87('0x31')]('x'));}this[_0x39c26c[_0x1c30e7]+_0xdd87('0x32')]=_0x578bfd;}var _0x500c93={'id':this['id'],'name':this[_0xdd87('0x6')],'online':this['online'],'voicePause':this[_0xdd87('0x8')],'chatPause':this[_0xdd87('0x9')],'mailPause':this[_0xdd87('0xa')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0xdd87('0xd')],'chatStatus':this[_0xdd87('0xe')],'chatStatusTime':this[_0xdd87('0x33')],'chatCapacity':this[_0xdd87('0x10')],'chatCurrentCapacity':this[_0xdd87('0x11')],'mailStatus':this[_0xdd87('0x12')],'mailStatusTime':this[_0xdd87('0x13')],'mailCapacity':this[_0xdd87('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xdd87('0x16')],'faxStatusTime':this[_0xdd87('0x17')],'faxCapacity':this[_0xdd87('0x18')],'faxCurrentCapacity':this[_0xdd87('0x34')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xdd87('0x35')],'smsCapacity':this[_0xdd87('0x19')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xdd87('0x1b')],'whatsappStatusTime':this[_0xdd87('0x1c')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xdd87('0x36')],'openchannelStatus':this[_0xdd87('0x1e')],'openchannelStatusTime':this[_0xdd87('0x37')],'openchannelCapacity':this[_0xdd87('0x1f')],'openchannelCurrentCapacity':this[_0xdd87('0x20')],'busy':this[_0xdd87('0x21')],'busyQueue':this[_0xdd87('0x22')]};var _0x386b29=md5(JSON['stringify'](_0x500c93));if(this[_0xdd87('0x1')]!==_0x386b29){this[_0xdd87('0x1')]=_0x386b29;io[_0xdd87('0x38')](_0xdd87('0x39'),_0x500c93);}};module['exports']=Agent; \ No newline at end of file +var _0x20c6=['busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','openchannel','sms','whatsapp','Status','toNumber','format','chatCurrentCapacity','faxStatus','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0x20c6,0xb8));var _0x620c=function(_0xa5fd3c,_0x44ce96){_0xa5fd3c=_0xa5fd3c-0x0;var _0x545edc=_0x20c6[_0xa5fd3c];return _0x545edc;};'use strict';var _=require(_0x620c('0x0'));var moment=require(_0x620c('0x1'));var md5=require(_0x620c('0x2'));var Redis=require(_0x620c('0x3'));var config=require(_0x620c('0x4'));config[_0x620c('0x5')]=_['defaults'](config[_0x620c('0x5')],{'host':_0x620c('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x620c('0x5')]));function Agent(_0x31fb62){this['id']=_0x31fb62['id']||0x0;this[_0x620c('0x7')]=_0x31fb62[_0x620c('0x7')]||'';this[_0x620c('0x8')]=_0x31fb62['online']||!![];this[_0x620c('0x9')]=_0x31fb62['voicePause']||![];this[_0x620c('0xa')]=_0x31fb62[_0x620c('0xa')]||![];this[_0x620c('0xb')]=_0x31fb62[_0x620c('0xb')]||![];this[_0x620c('0xc')]=_0x31fb62[_0x620c('0xc')]||![];this['smsPause']=_0x31fb62[_0x620c('0xd')]||![];this[_0x620c('0xe')]=_0x31fb62['openchannelPause']||![];this[_0x620c('0xf')]=_0x620c('0x10');this[_0x620c('0x11')]=0x0;this[_0x620c('0x12')]=_0x31fb62['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0x620c('0x13')]=_0x620c('0x10');this['mailStatusTime']=0x0;this[_0x620c('0x14')]=_0x31fb62[_0x620c('0x14')]||0x0;this[_0x620c('0x15')]=0x0;this['faxStatus']=_0x620c('0x10');this[_0x620c('0x16')]=0x0;this['faxCapacity']=_0x31fb62[_0x620c('0x17')]||0x0;this[_0x620c('0x18')]=0x0;this['smsStatus']=_0x620c('0x10');this[_0x620c('0x19')]=0x0;this[_0x620c('0x1a')]=_0x31fb62['smsCapacity']||0x0;this[_0x620c('0x1b')]=0x0;this[_0x620c('0x1c')]=_0x620c('0x10');this[_0x620c('0x1d')]=0x0;this[_0x620c('0x1e')]=_0x31fb62[_0x620c('0x1e')]||0x0;this[_0x620c('0x1f')]=0x0;this[_0x620c('0x20')]=_0x620c('0x10');this[_0x620c('0x21')]=0x0;this[_0x620c('0x22')]=_0x31fb62[_0x620c('0x22')]||0x0;this[_0x620c('0x23')]=0x0;this['busy']=![];this[_0x620c('0x24')]=undefined;this[_0x620c('0x2')]='';this[_0x620c('0x25')]();}Agent[_0x620c('0x26')][_0x620c('0x27')]=function(_0x30a967){if(this[_0x30a967+_0x620c('0x28')]>0x0){if(this[_0x30a967+_0x620c('0x29')]>0x0&&this[_0x30a967+'CurrentCapacity']>=this[_0x30a967+_0x620c('0x29')]){return _0x620c('0x2a');}else{return _0x620c('0x2b');}}else{return _0x620c('0x2c');}};Agent[_0x620c('0x26')][_0x620c('0x25')]=function(){var _0x475d1e=[_0x620c('0x2d'),'chat',_0x620c('0x2e'),'fax',_0x620c('0x2f'),_0x620c('0x30')];for(var _0x2a4456=0x0;_0x2a4456<_0x475d1e['length'];_0x2a4456+=0x1){var _0x29724c=this[_0x620c('0x27')](_0x475d1e[_0x2a4456]);if(this[_0x475d1e[_0x2a4456]+_0x620c('0x31')]!==_0x29724c){this[_0x475d1e[_0x2a4456]+'StatusTime']=_[_0x620c('0x32')](moment()[_0x620c('0x33')]('x'));}this[_0x475d1e[_0x2a4456]+_0x620c('0x31')]=_0x29724c;}var _0x2ee24c={'id':this['id'],'name':this[_0x620c('0x7')],'online':this[_0x620c('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0x620c('0xa')],'mailPause':this[_0x620c('0xb')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0x620c('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x620c('0x11')],'chatCapacity':this[_0x620c('0x12')],'chatCurrentCapacity':this[_0x620c('0x34')],'mailStatus':this[_0x620c('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x620c('0x14')],'mailCurrentCapacity':this[_0x620c('0x15')],'faxStatus':this[_0x620c('0x35')],'faxStatusTime':this[_0x620c('0x16')],'faxCapacity':this[_0x620c('0x17')],'faxCurrentCapacity':this[_0x620c('0x18')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x620c('0x1a')],'smsCurrentCapacity':this[_0x620c('0x1b')],'whatsappStatus':this[_0x620c('0x1c')],'whatsappStatusTime':this[_0x620c('0x1d')],'whatsappCapacity':this[_0x620c('0x1e')],'whatsappCurrentCapacity':this[_0x620c('0x1f')],'openchannelStatus':this[_0x620c('0x20')],'openchannelStatusTime':this[_0x620c('0x21')],'openchannelCapacity':this[_0x620c('0x22')],'openchannelCurrentCapacity':this[_0x620c('0x23')],'busy':this['busy'],'busyQueue':this[_0x620c('0x24')]};var _0x27b10c=md5(JSON['stringify'](_0x2ee24c));if(this['md5']!==_0x27b10c){this['md5']=_0x27b10c;io['emit']('user:save',_0x2ee24c);}};module[_0x620c('0x36')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 5a62923..87ab83e 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 _0xbacd=['Agents','waiting','md5','updateRouting','updateRealtime','mapAgentsId','_rr','prototype','loggedIn','paused','length','chatPause','available','stringify','format','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0xbacd,0x1b6));var _0xdbac=function(_0x4ad9f7,_0x3efc01){_0x4ad9f7=_0x4ad9f7-0x0;var _0x193d01=_0xbacd[_0x4ad9f7];return _0x193d01;};'use strict';var _=require(_0xdbac('0x0'));var md5=require('md5');var util=require(_0xdbac('0x1'));var Redis=require(_0xdbac('0x2'));var config=require(_0xdbac('0x3'));config[_0xdbac('0x4')]=_[_0xdbac('0x5')](config[_0xdbac('0x4')],{'host':_0xdbac('0x6'),'port':0x18eb});var io=require(_0xdbac('0x7'))(new Redis(config[_0xdbac('0x4')]));function ChatQueue(_0xa596f3){this['id']=_0xa596f3['id']||0x0;this[_0xdbac('0x8')]=_0xa596f3['name']||'';this[_0xdbac('0x9')]=_0xa596f3['timeout']||0xa;this[_0xdbac('0xa')]=_0xa596f3[_0xdbac('0xa')]||_0xdbac('0xb');this[_0xdbac('0xc')]=_0xa596f3[_0xdbac('0xc')];this['mapAgentsId']={};this[_0xdbac('0xd')]=0x0;this[_0xdbac('0xe')]='';this[_0xdbac('0xf')]();this[_0xdbac('0x10')]();}ChatQueue['prototype'][_0xdbac('0xf')]=function(){var _0x5239fb=this[_0xdbac('0x11')][_0xdbac('0x12')];this['mapAgentsId']=_['map'](this[_0xdbac('0xc')],'id');this[_0xdbac('0x11')][_0xdbac('0x12')]=_0x5239fb;};ChatQueue[_0xdbac('0x13')][_0xdbac('0x10')]=function(){this[_0xdbac('0x14')]=0x0;this[_0xdbac('0x15')]=0x0;for(var _0x50e3eb=0x0;_0x50e3eb=0x0?this['available']:0x0;var _0x306a24={'id':this['id'],'available':this[_0xdbac('0x18')],'loggedIn':this[_0xdbac('0x14')],'name':this[_0xdbac('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x118912=md5(JSON[_0xdbac('0x19')](_0x306a24));if(this[_0xdbac('0xe')]!==_0x118912){this[_0xdbac('0xe')]=_0x118912;io['to'](util[_0xdbac('0x1a')]('chat:queue:%s',_0x306a24[_0xdbac('0x8')]))[_0xdbac('0x1b')](_0xdbac('0x1c'),_0x306a24);}};module[_0xdbac('0x1d')]=ChatQueue; \ No newline at end of file +var _0xa5bc=['md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','loggedIn','paused','length','chatPause','available','stringify','chat_queue:save','exports'];(function(_0x52af14,_0x450fa2){var _0x5068b0=function(_0x18a797){while(--_0x18a797){_0x52af14['push'](_0x52af14['shift']());}};_0x5068b0(++_0x450fa2);}(_0xa5bc,0x1cb));var _0xca5b=function(_0x7176f0,_0xb20112){_0x7176f0=_0x7176f0-0x0;var _0x25a135=_0xa5bc[_0x7176f0];return _0x25a135;};'use strict';var _=require('lodash');var md5=require(_0xca5b('0x0'));var util=require(_0xca5b('0x1'));var Redis=require(_0xca5b('0x2'));var config=require(_0xca5b('0x3'));config[_0xca5b('0x4')]=_[_0xca5b('0x5')](config[_0xca5b('0x4')],{'host':_0xca5b('0x6'),'port':0x18eb});var io=require(_0xca5b('0x7'))(new Redis(config['redis']));function ChatQueue(_0x4c2075){this['id']=_0x4c2075['id']||0x0;this[_0xca5b('0x8')]=_0x4c2075[_0xca5b('0x8')]||'';this[_0xca5b('0x9')]=_0x4c2075[_0xca5b('0x9')]||0xa;this['strategy']=_0x4c2075[_0xca5b('0xa')]||_0xca5b('0xb');this[_0xca5b('0xc')]=_0x4c2075[_0xca5b('0xc')];this[_0xca5b('0xd')]={};this[_0xca5b('0xe')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}ChatQueue['prototype'][_0xca5b('0xf')]=function(){var _0xb0210e=this[_0xca5b('0xd')][_0xca5b('0x10')];this['mapAgentsId']=_[_0xca5b('0x11')](this[_0xca5b('0xc')],'id');this['mapAgentsId']['_rr']=_0xb0210e;};ChatQueue[_0xca5b('0x12')]['updateRealtime']=function(){this[_0xca5b('0x13')]=0x0;this[_0xca5b('0x14')]=0x0;for(var _0x2eecf1=0x0;_0x2eecf1=0x0?this['available']:0x0;var _0x506f6e={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xca5b('0x8')],'paused':this[_0xca5b('0x14')],'waiting':this[_0xca5b('0xe')]};var _0x4923aa=md5(JSON[_0xca5b('0x18')](_0x506f6e));if(this['md5']!==_0x4923aa){this[_0xca5b('0x0')]=_0x4923aa;io['to'](util['format']('chat:queue:%s',_0x506f6e[_0xca5b('0x8')]))['emit'](_0xca5b('0x19'),_0x506f6e);}};module[_0xca5b('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index e8c9e49..b13c087 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 _0xb931=['length','faxPause','available','stringify','fax:queue:%s','fax_queue:save','exports','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','waiting','md5','updateRouting','prototype','mapAgentsId','Agents','updateRealtime','loggedIn','paused'];(function(_0x101aa5,_0x320908){var _0xf17803=function(_0x5cbcff){while(--_0x5cbcff){_0x101aa5['push'](_0x101aa5['shift']());}};_0xf17803(++_0x320908);}(_0xb931,0x6b));var _0x1b93=function(_0x402924,_0x5baab5){_0x402924=_0x402924-0x0;var _0x71172d=_0xb931[_0x402924];return _0x71172d;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1b93('0x0'));var Redis=require(_0x1b93('0x1'));var config=require(_0x1b93('0x2'));config[_0x1b93('0x3')]=_['defaults'](config[_0x1b93('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x1b93('0x4'))(new Redis(config[_0x1b93('0x3')]));function FaxQueue(_0xe94ce3){this['id']=_0xe94ce3['id']||0x0;this[_0x1b93('0x5')]=_0xe94ce3[_0x1b93('0x5')]||'';this[_0x1b93('0x6')]=_0xe94ce3[_0x1b93('0x6')]||0xa;this[_0x1b93('0x7')]=_0xe94ce3[_0x1b93('0x7')]||_0x1b93('0x8');this['Agents']=_0xe94ce3['Agents'];this['mapAgentsId']={};this[_0x1b93('0x9')]=0x0;this[_0x1b93('0xa')]='';this[_0x1b93('0xb')]();this['updateRealtime']();}FaxQueue[_0x1b93('0xc')][_0x1b93('0xb')]=function(){var _0x3746ce=this['mapAgentsId']['_rr'];this[_0x1b93('0xd')]=_['map'](this[_0x1b93('0xe')],'id');this['mapAgentsId']['_rr']=_0x3746ce;};FaxQueue[_0x1b93('0xc')][_0x1b93('0xf')]=function(){this[_0x1b93('0x10')]=0x0;this[_0x1b93('0x11')]=0x0;for(var _0x3fc7ed=0x0;_0x3fc7ed=0x0?this['available']:0x0;var _0x3bc385={'id':this['id'],'available':this[_0x1b93('0x14')],'loggedIn':this[_0x1b93('0x10')],'name':this[_0x1b93('0x5')],'paused':this[_0x1b93('0x11')],'waiting':this[_0x1b93('0x9')]};var _0x4daa9d=md5(JSON[_0x1b93('0x15')](_0x3bc385));if(this[_0x1b93('0xa')]!==_0x4daa9d){this['md5']=_0x4daa9d;io['to'](util['format'](_0x1b93('0x16'),_0x3bc385[_0x1b93('0x5')]))['emit'](_0x1b93('0x17'),_0x3bc385);}};module[_0x1b93('0x18')]=FaxQueue; \ No newline at end of file +var _0xcbd0=['fax:queue:%s','exports','md5','util','redis','defaults','localhost','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','online','faxPause','available','name','paused','format'];(function(_0x42f049,_0x650b60){var _0x387a3a=function(_0xb64bf4){while(--_0xb64bf4){_0x42f049['push'](_0x42f049['shift']());}};_0x387a3a(++_0x650b60);}(_0xcbd0,0xba));var _0x0cbd=function(_0xb3d63e,_0x4fe91e){_0xb3d63e=_0xb3d63e-0x0;var _0x59f4c3=_0xcbd0[_0xb3d63e];return _0x59f4c3;};'use strict';var _=require('lodash');var md5=require(_0x0cbd('0x0'));var util=require(_0x0cbd('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0cbd('0x2')]=_[_0x0cbd('0x3')](config[_0x0cbd('0x2')],{'host':_0x0cbd('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0cbd('0x2')]));function FaxQueue(_0x1b6c1f){this['id']=_0x1b6c1f['id']||0x0;this['name']=_0x1b6c1f['name']||'';this['timeout']=_0x1b6c1f[_0x0cbd('0x5')]||0xa;this['strategy']=_0x1b6c1f[_0x0cbd('0x6')]||'beepall';this[_0x0cbd('0x7')]=_0x1b6c1f[_0x0cbd('0x7')];this[_0x0cbd('0x8')]={};this[_0x0cbd('0x9')]=0x0;this['md5']='';this[_0x0cbd('0xa')]();this['updateRealtime']();}FaxQueue[_0x0cbd('0xb')][_0x0cbd('0xa')]=function(){var _0x163d6d=this[_0x0cbd('0x8')]['_rr'];this[_0x0cbd('0x8')]=_['map'](this[_0x0cbd('0x7')],'id');this[_0x0cbd('0x8')][_0x0cbd('0xc')]=_0x163d6d;};FaxQueue[_0x0cbd('0xb')][_0x0cbd('0xd')]=function(){this[_0x0cbd('0xe')]=0x0;this['paused']=0x0;for(var _0x5a1fe6=0x0;_0x5a1fe6=0x0?this[_0x0cbd('0x11')]:0x0;var _0x4efdea={'id':this['id'],'available':this[_0x0cbd('0x11')],'loggedIn':this[_0x0cbd('0xe')],'name':this[_0x0cbd('0x12')],'paused':this[_0x0cbd('0x13')],'waiting':this['waiting']};var _0x34f985=md5(JSON['stringify'](_0x4efdea));if(this[_0x0cbd('0x0')]!==_0x34f985){this['md5']=_0x34f985;io['to'](util[_0x0cbd('0x14')](_0x0cbd('0x15'),_0x4efdea[_0x0cbd('0x12')]))['emit']('fax_queue:save',_0x4efdea);}};module[_0x0cbd('0x16')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 0a41aee..3e8da49 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 _0x0e08=['exports','name','Intervals'];(function(_0x1616f3,_0x5a277f){var _0x4abaa1=function(_0x57be7f){while(--_0x57be7f){_0x1616f3['push'](_0x1616f3['shift']());}};_0x4abaa1(++_0x5a277f);}(_0x0e08,0x181));var _0x80e0=function(_0xcb56d5,_0x24fc41){_0xcb56d5=_0xcb56d5-0x0;var _0x12d174=_0x0e08[_0xcb56d5];return _0x12d174;};'use strict';function Interval(_0xc93b1e){this['id']=_0xc93b1e['id']||0x0;this['name']=_0xc93b1e[_0x80e0('0x0')]||'';this[_0x80e0('0x1')]=_0xc93b1e[_0x80e0('0x1')]||{};}module[_0x80e0('0x2')]=Interval; \ No newline at end of file +var _0xde91=['exports','name','Intervals'];(function(_0x4ec5de,_0x1f689e){var _0xb7a1f=function(_0x38d6b3){while(--_0x38d6b3){_0x4ec5de['push'](_0x4ec5de['shift']());}};_0xb7a1f(++_0x1f689e);}(_0xde91,0x7f));var _0x1de9=function(_0x434783,_0xff395d){_0x434783=_0x434783-0x0;var _0x13efcf=_0xde91[_0x434783];return _0x13efcf;};'use strict';function Interval(_0x48ee71){this['id']=_0x48ee71['id']||0x0;this[_0x1de9('0x0')]=_0x48ee71[_0x1de9('0x0')]||'';this[_0x1de9('0x1')]=_0x48ee71['Intervals']||{};}module[_0x1de9('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 9dcd2f4..9e308b2 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 _0xc838=['util','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','exports','lodash','md5'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc838,0x150));var _0x8c83=function(_0x4b7eb6,_0x205e13){_0x4b7eb6=_0x4b7eb6-0x0;var _0x4e26bd=_0xc838[_0x4b7eb6];return _0x4e26bd;};'use strict';var _=require(_0x8c83('0x0'));var md5=require(_0x8c83('0x1'));var util=require(_0x8c83('0x2'));var Redis=require('ioredis');var config=require(_0x8c83('0x3'));config['redis']=_['defaults'](config[_0x8c83('0x4')],{'host':_0x8c83('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8c83('0x4')]));function MailQueue(_0x50aa22){this['id']=_0x50aa22['id']||0x0;this[_0x8c83('0x6')]=_0x50aa22[_0x8c83('0x6')]||'';this[_0x8c83('0x7')]=_0x50aa22[_0x8c83('0x7')]||0xa;this[_0x8c83('0x8')]=_0x50aa22['strategy']||'beepall';this[_0x8c83('0x9')]=_0x50aa22[_0x8c83('0x9')];this['mapAgentsId']={};this[_0x8c83('0xa')]=0x0;this['md5']='';this['updateRouting']();this[_0x8c83('0xb')]();}MailQueue[_0x8c83('0xc')][_0x8c83('0xd')]=function(){var _0x4aa1f6=this['mapAgentsId']['_rr'];this[_0x8c83('0xe')]=_['map'](this[_0x8c83('0x9')],'id');this[_0x8c83('0xe')][_0x8c83('0xf')]=_0x4aa1f6;};MailQueue[_0x8c83('0xc')][_0x8c83('0xb')]=function(){this[_0x8c83('0x10')]=0x0;this[_0x8c83('0x11')]=0x0;for(var _0x2b6ac3=0x0;_0x2b6ac3=0x0?this['available']:0x0;var _0xf80835={'id':this['id'],'available':this[_0x8c83('0x15')],'loggedIn':this[_0x8c83('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x8c83('0xa')]};var _0x2e2411=md5(JSON[_0x8c83('0x16')](_0xf80835));if(this[_0x8c83('0x1')]!==_0x2e2411){this['md5']=_0x2e2411;io['to'](util[_0x8c83('0x17')](_0x8c83('0x18'),_0xf80835['name']))['emit']('mail_queue:save',_0xf80835);}};module[_0x8c83('0x19')]=MailQueue; \ No newline at end of file +var _0x1ff6=['lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','online','mailPause','available','loggedIn','paused','format','mail:queue:%s','emit','exports'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x1ff6,0x68));var _0x61ff=function(_0x37f2a1,_0x4a98c5){_0x37f2a1=_0x37f2a1-0x0;var _0x387ae8=_0x1ff6[_0x37f2a1];return _0x387ae8;};'use strict';var _=require(_0x61ff('0x0'));var md5=require(_0x61ff('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x61ff('0x2'));config[_0x61ff('0x3')]=_[_0x61ff('0x4')](config[_0x61ff('0x3')],{'host':_0x61ff('0x5'),'port':0x18eb});var io=require(_0x61ff('0x6'))(new Redis(config['redis']));function MailQueue(_0x39bdb4){this['id']=_0x39bdb4['id']||0x0;this[_0x61ff('0x7')]=_0x39bdb4[_0x61ff('0x7')]||'';this[_0x61ff('0x8')]=_0x39bdb4[_0x61ff('0x8')]||0xa;this[_0x61ff('0x9')]=_0x39bdb4[_0x61ff('0x9')]||_0x61ff('0xa');this[_0x61ff('0xb')]=_0x39bdb4[_0x61ff('0xb')];this[_0x61ff('0xc')]={};this[_0x61ff('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x61ff('0xe')]();}MailQueue[_0x61ff('0xf')]['updateRouting']=function(){var _0x1ee988=this[_0x61ff('0xc')][_0x61ff('0x10')];this[_0x61ff('0xc')]=_['map'](this[_0x61ff('0xb')],'id');this[_0x61ff('0xc')]['_rr']=_0x1ee988;};MailQueue['prototype'][_0x61ff('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x3f7091=0x0;_0x3f7091=0x0?this[_0x61ff('0x13')]:0x0;var _0x10fb94={'id':this['id'],'available':this['available'],'loggedIn':this[_0x61ff('0x14')],'name':this['name'],'paused':this[_0x61ff('0x15')],'waiting':this[_0x61ff('0xd')]};var _0x55a1d9=md5(JSON['stringify'](_0x10fb94));if(this[_0x61ff('0x1')]!==_0x55a1d9){this[_0x61ff('0x1')]=_0x55a1d9;io['to'](util[_0x61ff('0x16')](_0x61ff('0x17'),_0x10fb94['name']))[_0x61ff('0x18')]('mail_queue:save',_0x10fb94);}};module[_0x61ff('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index f45f39c..97a115f 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x7a54,0x106));var _0x47a5=function(_0x2d27ad,_0x11e60c){_0x2d27ad=_0x2d27ad-0x0;var _0x4c2b39=_0x7a54[_0x2d27ad];return _0x4c2b39;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _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(_0x27fedb,_0x31c693){var _0x58ab78=function(_0x532732){while(--_0x532732){_0x27fedb['push'](_0x27fedb['shift']());}};_0x58ab78(++_0x31c693);}(_0xadb5,0xad));var _0x5adb=function(_0x37dba4,_0x269924){_0x37dba4=_0x37dba4-0x0;var _0x100457=_0xadb5[_0x37dba4];return _0x100457;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index a9ecde9..6c138c4 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 _0xeddd=['ioredis','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','md5','util'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xeddd,0x69));var _0xdedd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xeddd[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xdedd('0x0'));var md5=require(_0xdedd('0x1'));var util=require(_0xdedd('0x2'));var Redis=require(_0xdedd('0x3'));var config=require('../../../config/environment');config[_0xdedd('0x4')]=_['defaults'](config[_0xdedd('0x4')],{'host':_0xdedd('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdedd('0x4')]));function SmsQueue(_0x13563b){this['id']=_0x13563b['id']||0x0;this[_0xdedd('0x6')]=_0x13563b[_0xdedd('0x6')]||'';this[_0xdedd('0x7')]=_0x13563b[_0xdedd('0x7')]||0xa;this[_0xdedd('0x8')]=_0x13563b[_0xdedd('0x8')]||_0xdedd('0x9');this[_0xdedd('0xa')]=_0x13563b[_0xdedd('0xa')];this[_0xdedd('0xb')]={};this['waiting']=0x0;this[_0xdedd('0x1')]='';this[_0xdedd('0xc')]();this[_0xdedd('0xd')]();}SmsQueue[_0xdedd('0xe')]['updateRouting']=function(){var _0x12b842=this[_0xdedd('0xb')][_0xdedd('0xf')];this[_0xdedd('0xb')]=_[_0xdedd('0x10')](this[_0xdedd('0xa')],'id');this[_0xdedd('0xb')][_0xdedd('0xf')]=_0x12b842;};SmsQueue[_0xdedd('0xe')][_0xdedd('0xd')]=function(){this[_0xdedd('0x11')]=0x0;this[_0xdedd('0x12')]=0x0;for(var _0x3b098a=0x0;_0x3b098a=0x0?this['available']:0x0;var _0x43611b={'id':this['id'],'available':this[_0xdedd('0x15')],'loggedIn':this[_0xdedd('0x11')],'name':this[_0xdedd('0x6')],'paused':this[_0xdedd('0x12')],'waiting':this['waiting']};var _0x2a82a=md5(JSON[_0xdedd('0x16')](_0x43611b));if(this[_0xdedd('0x1')]!==_0x2a82a){this[_0xdedd('0x1')]=_0x2a82a;io['to'](util[_0xdedd('0x17')](_0xdedd('0x18'),_0x43611b[_0xdedd('0x6')]))[_0xdedd('0x19')](_0xdedd('0x1a'),_0x43611b);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x57d4=['sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','_rr','map','paused','length','online','loggedIn','available','stringify','format'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x57d4,0x78));var _0x457d=function(_0x51561a,_0x91a4a1){_0x51561a=_0x51561a-0x0;var _0x1310cc=_0x57d4[_0x51561a];return _0x1310cc;};'use strict';var _=require(_0x457d('0x0'));var md5=require(_0x457d('0x1'));var util=require('util');var Redis=require(_0x457d('0x2'));var config=require(_0x457d('0x3'));config[_0x457d('0x4')]=_[_0x457d('0x5')](config[_0x457d('0x4')],{'host':_0x457d('0x6'),'port':0x18eb});var io=require(_0x457d('0x7'))(new Redis(config[_0x457d('0x4')]));function SmsQueue(_0x4745ed){this['id']=_0x4745ed['id']||0x0;this[_0x457d('0x8')]=_0x4745ed[_0x457d('0x8')]||'';this['timeout']=_0x4745ed[_0x457d('0x9')]||0xa;this[_0x457d('0xa')]=_0x4745ed['strategy']||'beepall';this[_0x457d('0xb')]=_0x4745ed[_0x457d('0xb')];this[_0x457d('0xc')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x457d('0xd')]();}SmsQueue[_0x457d('0xe')][_0x457d('0xf')]=function(){var _0x128e09=this[_0x457d('0xc')][_0x457d('0x10')];this[_0x457d('0xc')]=_[_0x457d('0x11')](this[_0x457d('0xb')],'id');this['mapAgentsId'][_0x457d('0x10')]=_0x128e09;};SmsQueue[_0x457d('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x457d('0x12')]=0x0;for(var _0x19ac04=0x0;_0x19ac04=0x0?this['available']:0x0;var _0x151416={'id':this['id'],'available':this[_0x457d('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x457d('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0xbdded1=md5(JSON[_0x457d('0x17')](_0x151416));if(this[_0x457d('0x1')]!==_0xbdded1){this[_0x457d('0x1')]=_0xbdded1;io['to'](util[_0x457d('0x18')](_0x457d('0x19'),_0x151416[_0x457d('0x8')]))[_0x457d('0x1a')](_0x457d('0x1b'),_0x151416);}};module[_0x457d('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index c65eecd..234c44f 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 _0x5e74=['timeout','strategy','beepall','Agents','waiting','updateRouting','mapAgentsId','map','_rr','updateRealtime','loggedIn','length','online','whatsappPause','paused','available','stringify','emit','lodash','md5','util','../../../config/environment','redis','socket.io-emitter','name'];(function(_0x5b13b0,_0x462042){var _0x27763c=function(_0x5a4f82){while(--_0x5a4f82){_0x5b13b0['push'](_0x5b13b0['shift']());}};_0x27763c(++_0x462042);}(_0x5e74,0xc1));var _0x45e7=function(_0x5eaec3,_0x38b677){_0x5eaec3=_0x5eaec3-0x0;var _0x15d063=_0x5e74[_0x5eaec3];return _0x15d063;};'use strict';var _=require(_0x45e7('0x0'));var md5=require(_0x45e7('0x1'));var util=require(_0x45e7('0x2'));var Redis=require('ioredis');var config=require(_0x45e7('0x3'));config[_0x45e7('0x4')]=_['defaults'](config[_0x45e7('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x45e7('0x5'))(new Redis(config[_0x45e7('0x4')]));function WhatsappQueue(_0x52130a){this['id']=_0x52130a['id']||0x0;this[_0x45e7('0x6')]=_0x52130a[_0x45e7('0x6')]||'';this['timeout']=_0x52130a[_0x45e7('0x7')]||0xa;this[_0x45e7('0x8')]=_0x52130a['strategy']||_0x45e7('0x9');this[_0x45e7('0xa')]=_0x52130a[_0x45e7('0xa')];this['mapAgentsId']={};this[_0x45e7('0xb')]=0x0;this[_0x45e7('0x1')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue['prototype'][_0x45e7('0xc')]=function(){var _0x3edc69=this[_0x45e7('0xd')]['_rr'];this[_0x45e7('0xd')]=_[_0x45e7('0xe')](this[_0x45e7('0xa')],'id');this[_0x45e7('0xd')][_0x45e7('0xf')]=_0x3edc69;};WhatsappQueue['prototype'][_0x45e7('0x10')]=function(){this[_0x45e7('0x11')]=0x0;this['paused']=0x0;for(var _0xf77b0b=0x0;_0xf77b0b=0x0?this[_0x45e7('0x16')]:0x0;var _0x533c4c={'id':this['id'],'available':this[_0x45e7('0x16')],'loggedIn':this[_0x45e7('0x11')],'name':this[_0x45e7('0x6')],'paused':this[_0x45e7('0x15')],'waiting':this['waiting']};var _0x8928bf=md5(JSON[_0x45e7('0x17')](_0x533c4c));if(this['md5']!==_0x8928bf){this['md5']=_0x8928bf;io['to'](util['format']('whatsapp:queue:%s',_0x533c4c[_0x45e7('0x6')]))[_0x45e7('0x18')]('whatsapp_queue:save',_0x533c4c);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x8a04=['beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr','updateRealtime','loggedIn','length','online','whatsappPause','paused','available','stringify','emit','whatsapp_queue:save','exports','lodash','md5','util','redis','defaults','socket.io-emitter','name','timeout','strategy'];(function(_0x45922d,_0x455892){var _0x39b49f=function(_0xb7c7e4){while(--_0xb7c7e4){_0x45922d['push'](_0x45922d['shift']());}};_0x39b49f(++_0x455892);}(_0x8a04,0x163));var _0x48a0=function(_0xfccf3c,_0x9da04e){_0xfccf3c=_0xfccf3c-0x0;var _0xd8b1c=_0x8a04[_0xfccf3c];return _0xd8b1c;};'use strict';var _=require(_0x48a0('0x0'));var md5=require(_0x48a0('0x1'));var util=require(_0x48a0('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x48a0('0x3')]=_[_0x48a0('0x4')](config[_0x48a0('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x48a0('0x5'))(new Redis(config[_0x48a0('0x3')]));function WhatsappQueue(_0x371f16){this['id']=_0x371f16['id']||0x0;this[_0x48a0('0x6')]=_0x371f16[_0x48a0('0x6')]||'';this['timeout']=_0x371f16[_0x48a0('0x7')]||0xa;this['strategy']=_0x371f16[_0x48a0('0x8')]||_0x48a0('0x9');this[_0x48a0('0xa')]=_0x371f16['Agents'];this[_0x48a0('0xb')]={};this[_0x48a0('0xc')]=0x0;this[_0x48a0('0x1')]='';this[_0x48a0('0xd')]();this['updateRealtime']();}WhatsappQueue[_0x48a0('0xe')][_0x48a0('0xd')]=function(){var _0x57dd6d=this[_0x48a0('0xb')]['_rr'];this['mapAgentsId']=_[_0x48a0('0xf')](this[_0x48a0('0xa')],'id');this[_0x48a0('0xb')][_0x48a0('0x10')]=_0x57dd6d;};WhatsappQueue['prototype'][_0x48a0('0x11')]=function(){this[_0x48a0('0x12')]=0x0;this['paused']=0x0;for(var _0x5cfad1=0x0;_0x5cfad1=0x0?this['available']:0x0;var _0x1eb24f={'id':this['id'],'available':this[_0x48a0('0x17')],'loggedIn':this[_0x48a0('0x12')],'name':this[_0x48a0('0x6')],'paused':this[_0x48a0('0x16')],'waiting':this[_0x48a0('0xc')]};var _0x1e02db=md5(JSON[_0x48a0('0x18')](_0x1eb24f));if(this[_0x48a0('0x1')]!==_0x1e02db){this[_0x48a0('0x1')]=_0x1e02db;io['to'](util['format']('whatsapp:queue:%s',_0x1eb24f[_0x48a0('0x6')]))[_0x48a0('0x19')](_0x48a0('0x1a'),_0x1eb24f);}};module[_0x48a0('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 57948f1..466081b 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _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(_0x59751a,_0x10f3a2){var _0x3b72d4=function(_0xb5b535){while(--_0xb5b535){_0x59751a['push'](_0x59751a['shift']());}};_0x3b72d4(++_0x10f3a2);}(_0xb10b,0x12a));var _0xbb10=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0xb10b[_0x470f63];return _0x4f09e2;};'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 diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 6b0161c..53d9f45 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 _0xb561=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x2e11d3,_0x26a29a){var _0x3f7f7f=function(_0x3c43f1){while(--_0x3c43f1){_0x2e11d3['push'](_0x2e11d3['shift']());}};_0x3f7f7f(++_0x26a29a);}(_0xb561,0x73));var _0x1b56=function(_0x39ae15,_0x565713){_0x39ae15=_0x39ae15-0x0;var _0x1c06cd=_0xb561[_0x39ae15];return _0x1c06cd;};'use strict';var client=require(_0x1b56('0x0'));exports[_0x1b56('0x1')]=function(_0x3bb710,_0x337e92){return client[_0x1b56('0x2')](_0x1b56('0x3'),{'body':_0x337e92,'options':{'where':{'id':_0x3bb710}},'log':_0x1b56('0x4')});};exports[_0x1b56('0x5')]=function(_0xa95b0a,_0x17c3c3){return client[_0x1b56('0x2')](_0x1b56('0x6'),{'body':_0x17c3c3,'options':{'where':{'id':_0xa95b0a}},'log':_0x1b56('0x7')});}; \ No newline at end of file +var _0x712d=['addTagsToChatInteraction','Request','AddTagsToChatInteraction'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0x712d,0x127));var _0xd712=function(_0xc320f6,_0x4190d5){_0xc320f6=_0xc320f6-0x0;var _0x2427ab=_0x712d[_0xc320f6];return _0x2427ab;};'use strict';var client=require('../client');exports['update']=function(_0x30e460,_0xa3ea29){return client[_0xd712('0x0')]('UpdateChatInteraction',{'body':_0xa3ea29,'options':{'where':{'id':_0x30e460}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x4d3a1e,_0x5e1a86){return client['Request'](_0xd712('0x1'),{'body':_0x5e1a86,'options':{'where':{'id':_0x4d3a1e}},'log':_0xd712('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index e5dd75d..7082cc5 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 _0x0fce=['createChatMessage','../client','create','Request'];(function(_0xd160bc,_0x40e5b6){var _0x5d2cbe=function(_0x5b3fac){while(--_0x5b3fac){_0xd160bc['push'](_0xd160bc['shift']());}};_0x5d2cbe(++_0x40e5b6);}(_0x0fce,0xad));var _0xe0fc=function(_0x19f7d0,_0x5a1e54){_0x19f7d0=_0x19f7d0-0x0;var _0x50ed97=_0x0fce[_0x19f7d0];return _0x50ed97;};'use strict';var client=require(_0xe0fc('0x0'));exports[_0xe0fc('0x1')]=function(_0xf93e7f){return client[_0xe0fc('0x2')]('CreateChatMessage',{'body':_0xf93e7f,'log':_0xe0fc('0x3')});}; \ No newline at end of file +var _0x6cf5=['createChatMessage','create','Request','CreateChatMessage'];(function(_0x5eb2a7,_0x131cb4){var _0x263472=function(_0x3b12d6){while(--_0x3b12d6){_0x5eb2a7['push'](_0x5eb2a7['shift']());}};_0x263472(++_0x131cb4);}(_0x6cf5,0x149));var _0x56cf=function(_0x100b1b,_0x3d5784){_0x100b1b=_0x100b1b-0x0;var _0x537603=_0x6cf5[_0x100b1b];return _0x537603;};'use strict';var client=require('../client');exports[_0x56cf('0x0')]=function(_0xc3a5b3){return client[_0x56cf('0x1')](_0x56cf('0x2'),{'body':_0xc3a5b3,'log':_0x56cf('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 48d2441..1d55b4a 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 _0xbdb9=['GetChatQueue','name','strategy','chatPause','../client','getChatQueues','Request'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xbdb9,0xac));var _0x9bdb=function(_0x2e8b0d,_0x4b4dea){_0x2e8b0d=_0x2e8b0d-0x0;var _0x4a8088=_0xbdb9[_0x2e8b0d];return _0x4a8088;};'use strict';var client=require(_0x9bdb('0x0'));exports[_0x9bdb('0x1')]=function(){return function(){return client[_0x9bdb('0x2')](_0x9bdb('0x3'),{'options':{'raw':![],'attributes':['id',_0x9bdb('0x4'),'timeout',_0x9bdb('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id','name','online',_0x9bdb('0x6')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xc818=['getChatQueues','Request','GetChatQueue','timeout','strategy','User','Agents','name','online','chatPause','../client'];(function(_0x196d86,_0x5ba089){var _0x4ec7fc=function(_0x14d21c){while(--_0x14d21c){_0x196d86['push'](_0x196d86['shift']());}};_0x4ec7fc(++_0x5ba089);}(_0xc818,0x1e3));var _0x8c81=function(_0x55a5c5,_0x3db7fe){_0x55a5c5=_0x55a5c5-0x0;var _0x346437=_0xc818[_0x55a5c5];return _0x346437;};'use strict';var client=require(_0x8c81('0x0'));exports[_0x8c81('0x1')]=function(){return function(){return client[_0x8c81('0x2')](_0x8c81('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8c81('0x4'),_0x8c81('0x5')],'include':[{'model':_0x8c81('0x6'),'as':_0x8c81('0x7'),'attributes':['id',_0x8c81('0x8'),_0x8c81('0x9'),_0x8c81('0xa')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index db8a0e4..7d8835d 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 _0x37f8=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x71af84,_0x5f514d){var _0x1d550d=function(_0x17f9f4){while(--_0x17f9f4){_0x71af84['push'](_0x71af84['shift']());}};_0x1d550d(++_0x5f514d);}(_0x37f8,0xd2));var _0x837f=function(_0x288bab,_0x1e9ad9){_0x288bab=_0x288bab-0x0;var _0x1776fd=_0x37f8[_0x288bab];return _0x1776fd;};'use strict';var client=require('../client');exports[_0x837f('0x0')]=function(_0x3755bc){return client[_0x837f('0x1')](_0x837f('0x2'),{'body':_0x3755bc,'log':'CreateChatQueueReport'});};exports[_0x837f('0x3')]=function(_0x5184ad,_0x5f2d01){return client['Request']('UpdateChatQueueReport',{'body':_0x5f2d01,'options':{'where':{'uniqueid':_0x5184ad},'order':[['id','DESC']],'limit':0x1},'log':_0x837f('0x4')});}; \ No newline at end of file +var _0x23d3=['UpdateChatQueueReport','../client','create','CreateChatQueueReport','update','Request','DESC'];(function(_0x459ecb,_0x531e17){var _0x54a6fd=function(_0x43581a){while(--_0x43581a){_0x459ecb['push'](_0x459ecb['shift']());}};_0x54a6fd(++_0x531e17);}(_0x23d3,0xe8));var _0x323d=function(_0x41991a,_0x592e4b){_0x41991a=_0x41991a-0x0;var _0x8fe40=_0x23d3[_0x41991a];return _0x8fe40;};'use strict';var client=require(_0x323d('0x0'));exports[_0x323d('0x1')]=function(_0x5b5fc4){return client['Request'](_0x323d('0x2'),{'body':_0x5b5fc4,'log':_0x323d('0x2')});};exports[_0x323d('0x3')]=function(_0x35c20b,_0xeb2e57){return client[_0x323d('0x4')]('UpdateChatQueueReport',{'body':_0xeb2e57,'options':{'where':{'uniqueid':_0x35c20b},'order':[['id',_0x323d('0x5')]],'limit':0x1},'log':_0x323d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 1501eeb..92b3c1f 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x4ff391,_0x797a58){var _0x3d2f2b=function(_0x5d8bfd){while(--_0x5d8bfd){_0x4ff391['push'](_0x4ff391['shift']());}};_0x3d2f2b(++_0x797a58);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x4dc296,_0x3efcbc){var _0x36016a=function(_0x364c0e){while(--_0x364c0e){_0x4dc296['push'](_0x4dc296['shift']());}};_0x36016a(++_0x3efcbc);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 14a91f1..9890004 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 _0x5bb4=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5bb4,0x7d));var _0x45bb=function(_0x29bd4c,_0x4e377c){_0x29bd4c=_0x29bd4c-0x0;var _0x12a220=_0x5bb4[_0x29bd4c];return _0x12a220;};'use strict';var client=require(_0x45bb('0x0'));exports[_0x45bb('0x1')]=function(_0x3006f8){return client[_0x45bb('0x2')](_0x45bb('0x3'),{'body':_0x3006f8,'log':_0x45bb('0x4')});}; \ No newline at end of file +var _0x5d55=['../client','create','CreateFaxMessage','createFaxMessage'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5d55,0x198));var _0x55d5=function(_0xbb0d79,_0x5abf12){_0xbb0d79=_0xbb0d79-0x0;var _0x5e250c=_0x5d55[_0xbb0d79];return _0x5e250c;};'use strict';var client=require(_0x55d5('0x0'));exports[_0x55d5('0x1')]=function(_0x1862ab){return client['Request'](_0x55d5('0x2'),{'body':_0x1862ab,'log':_0x55d5('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 2bade8f..10c5e9a 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 _0x66d4=['../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents','online','faxPause'];(function(_0x1a701c,_0x37c483){var _0x256def=function(_0x87347c){while(--_0x87347c){_0x1a701c['push'](_0x1a701c['shift']());}};_0x256def(++_0x37c483);}(_0x66d4,0xd1));var _0x466d=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0x66d4[_0x35fabd];return _0x61a8ee;};'use strict';var client=require(_0x466d('0x0'));exports[_0x466d('0x1')]=function(){return function(){return client[_0x466d('0x2')](_0x466d('0x3'),{'options':{'raw':![],'attributes':['id',_0x466d('0x4'),_0x466d('0x5'),_0x466d('0x6')],'include':[{'model':_0x466d('0x7'),'as':_0x466d('0x8'),'attributes':['id',_0x466d('0x4'),_0x466d('0x9'),_0x466d('0xa')]}]},'log':_0x466d('0x1')});};}; \ No newline at end of file +var _0x0691=['../client','getFaxQueues','Request','timeout','strategy','User','Agents','name','faxPause'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x0691,0x90));var _0x1069=function(_0x3036df,_0x5554d4){_0x3036df=_0x3036df-0x0;var _0x2b4f4b=_0x0691[_0x3036df];return _0x2b4f4b;};'use strict';var client=require(_0x1069('0x0'));exports[_0x1069('0x1')]=function(){return function(){return client[_0x1069('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x1069('0x3'),_0x1069('0x4')],'include':[{'model':_0x1069('0x5'),'as':_0x1069('0x6'),'attributes':['id',_0x1069('0x7'),'online',_0x1069('0x8')]}]},'log':_0x1069('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 4523861..1402bb4 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 _0x7501=['UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x283690,_0x45c348){var _0x1b57d0=function(_0x4ee656){while(--_0x4ee656){_0x283690['push'](_0x283690['shift']());}};_0x1b57d0(++_0x45c348);}(_0x7501,0x1ed));var _0x1750=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x7501[_0x22f8ab];return _0x2a70e5;};'use strict';var client=require(_0x1750('0x0'));exports[_0x1750('0x1')]=function(_0x38de8f){return client[_0x1750('0x2')](_0x1750('0x3'),{'body':_0x38de8f,'log':'CreateFaxQueueReport'});};exports[_0x1750('0x4')]=function(_0x3747a3,_0x304099){return client[_0x1750('0x2')](_0x1750('0x5'),{'body':_0x304099,'options':{'where':{'uniqueid':_0x3747a3},'order':[['id','DESC']],'limit':0x1},'log':_0x1750('0x5')});}; \ No newline at end of file +var _0x81df=['CreateFaxQueueReport','update','UpdateFaxQueueReport','create','Request'];(function(_0x1e190b,_0x2844d3){var _0x11a9af=function(_0x4ae6b2){while(--_0x4ae6b2){_0x1e190b['push'](_0x1e190b['shift']());}};_0x11a9af(++_0x2844d3);}(_0x81df,0xd5));var _0xf81d=function(_0x494dd9,_0x35accf){_0x494dd9=_0x494dd9-0x0;var _0x185ee4=_0x81df[_0x494dd9];return _0x185ee4;};'use strict';var client=require('../client');exports[_0xf81d('0x0')]=function(_0x59c1b6){return client[_0xf81d('0x1')](_0xf81d('0x2'),{'body':_0x59c1b6,'log':_0xf81d('0x2')});};exports[_0xf81d('0x3')]=function(_0x3e0d2d,_0x24bcd2){return client[_0xf81d('0x1')](_0xf81d('0x4'),{'body':_0x24bcd2,'options':{'where':{'uniqueid':_0x3e0d2d},'order':[['id','DESC']],'limit':0x1},'log':_0xf81d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 80672bb..bd4da49 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 _0x41b5=['name','Interval','Intervals','../client','getIntervals','Request','GetInterval'];(function(_0x1a04ea,_0x3e843f){var _0x1a07d5=function(_0x50f723){while(--_0x50f723){_0x1a04ea['push'](_0x1a04ea['shift']());}};_0x1a07d5(++_0x3e843f);}(_0x41b5,0x137));var _0x541b=function(_0x377d72,_0x38c881){_0x377d72=_0x377d72-0x0;var _0x38b197=_0x41b5[_0x377d72];return _0x38b197;};'use strict';var client=require(_0x541b('0x0'));exports[_0x541b('0x1')]=function(){return function(){return client[_0x541b('0x2')](_0x541b('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x541b('0x4')],'include':[{'model':_0x541b('0x5'),'as':_0x541b('0x6'),'attributes':['id','name','interval']}]},'log':_0x541b('0x1')});};}; \ No newline at end of file +var _0x7c7b=['../client','getIntervals','Request','GetInterval','name','Interval','Intervals','interval'];(function(_0x1982b8,_0x2ad4d3){var _0x1e2231=function(_0x41bd6e){while(--_0x41bd6e){_0x1982b8['push'](_0x1982b8['shift']());}};_0x1e2231(++_0x2ad4d3);}(_0x7c7b,0x148));var _0xb7c7=function(_0x483657,_0x4c9172){_0x483657=_0x483657-0x0;var _0xe9877c=_0x7c7b[_0x483657];return _0xe9877c;};'use strict';var client=require(_0xb7c7('0x0'));exports[_0xb7c7('0x1')]=function(){return function(){return client[_0xb7c7('0x2')](_0xb7c7('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xb7c7('0x4')],'include':[{'model':_0xb7c7('0x5'),'as':_0xb7c7('0x6'),'attributes':['id',_0xb7c7('0x4'),_0xb7c7('0x7')]}]},'log':_0xb7c7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index c318fe0..3eaabaf 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 _0xeb3b=['../client','update','Request','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x324893,_0x42fb83){var _0x3bc537=function(_0x4cdbd3){while(--_0x4cdbd3){_0x324893['push'](_0x324893['shift']());}};_0x3bc537(++_0x42fb83);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0xeb3b[_0x5e4563];return _0x8d1bf5;};'use strict';var client=require(_0xbeb3('0x0'));exports[_0xbeb3('0x1')]=function(_0xc5aaa3,_0x33e049){return client[_0xbeb3('0x2')]('UpdateMailInteraction',{'body':_0x33e049,'options':{'where':{'id':_0xc5aaa3}},'log':'updateMailInteraction'});};exports[_0xbeb3('0x3')]=function(_0x5b0e3b,_0x2e8ce3){return client['Request'](_0xbeb3('0x4'),{'body':_0x2e8ce3,'options':{'where':{'id':_0x5b0e3b}},'log':_0xbeb3('0x5')});}; \ No newline at end of file +var _0x065e=['UpdateMailInteraction','updateMailInteraction','addTagsToChatInteraction','../client','Request'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x065e,0x1a7));var _0xe065=function(_0x5e2daf,_0x44ad21){_0x5e2daf=_0x5e2daf-0x0;var _0x299133=_0x065e[_0x5e2daf];return _0x299133;};'use strict';var client=require(_0xe065('0x0'));exports['update']=function(_0x549f09,_0x59293c){return client[_0xe065('0x1')](_0xe065('0x2'),{'body':_0x59293c,'options':{'where':{'id':_0x549f09}},'log':_0xe065('0x3')});};exports['addTags']=function(_0x4964fa,_0x4610a3){return client[_0xe065('0x1')]('AddTagsToMailInteraction',{'body':_0x4610a3,'options':{'where':{'id':_0x4964fa}},'log':_0xe065('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index af79c4f..6a34a7e 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 _0xb443=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x4fb334,_0x4ca8c9){var _0x56dc84=function(_0x470d7b){while(--_0x470d7b){_0x4fb334['push'](_0x4fb334['shift']());}};_0x56dc84(++_0x4ca8c9);}(_0xb443,0x9f));var _0x3b44=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xb443[_0x4e7d25];return _0x526fe6;};'use strict';var client=require(_0x3b44('0x0'));exports[_0x3b44('0x1')]=function(_0x1367a1){return client[_0x3b44('0x2')](_0x3b44('0x3'),{'body':_0x1367a1,'log':_0x3b44('0x4')});}; \ No newline at end of file +var _0x1b53=['CreateMailMessage','../client','create'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0x1b53,0xb2));var _0x31b5=function(_0x317241,_0x4e8627){_0x317241=_0x317241-0x0;var _0x239d85=_0x1b53[_0x317241];return _0x239d85;};'use strict';var client=require(_0x31b5('0x0'));exports[_0x31b5('0x1')]=function(_0x3d765c){return client['Request'](_0x31b5('0x2'),{'body':_0x3d765c,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 609af0a..6479dc7 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 _0x2056=['mailPause','../client','getMailQueues','Request','name','timeout','strategy','Agents'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2056,0x1d9));var _0x6205=function(_0xf22003,_0x4daaad){_0xf22003=_0xf22003-0x0;var _0x1af727=_0x2056[_0xf22003];return _0x1af727;};'use strict';var client=require(_0x6205('0x0'));exports[_0x6205('0x1')]=function(){return function(){return client[_0x6205('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x6205('0x3'),_0x6205('0x4'),_0x6205('0x5')],'include':[{'model':'User','as':_0x6205('0x6'),'attributes':['id',_0x6205('0x3'),'online',_0x6205('0x7')]}]},'log':_0x6205('0x1')});};}; \ No newline at end of file +var _0xf2a3=['Request','GetMailQueue','name','strategy','User','Agents','online','mailPause','getMailQueues','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2a3,0xc7));var _0x3f2a=function(_0x3ae812,_0x57767f){_0x3ae812=_0x3ae812-0x0;var _0x3f6639=_0xf2a3[_0x3ae812];return _0x3f6639;};'use strict';var client=require(_0x3f2a('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x3f2a('0x1')](_0x3f2a('0x2'),{'options':{'raw':![],'attributes':['id',_0x3f2a('0x3'),'timeout',_0x3f2a('0x4')],'include':[{'model':_0x3f2a('0x5'),'as':_0x3f2a('0x6'),'attributes':['id','name',_0x3f2a('0x7'),_0x3f2a('0x8')]}]},'log':_0x3f2a('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index afd64d3..4c337de 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 _0x292c=['update','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x2c6b7d,_0x43c5cb){var _0x3eda3f=function(_0x3ba13c){while(--_0x3ba13c){_0x2c6b7d['push'](_0x2c6b7d['shift']());}};_0x3eda3f(++_0x43c5cb);}(_0x292c,0xc2));var _0xc292=function(_0x148c09,_0x4fd39f){_0x148c09=_0x148c09-0x0;var _0x18e613=_0x292c[_0x148c09];return _0x18e613;};'use strict';var client=require(_0xc292('0x0'));exports[_0xc292('0x1')]=function(_0x2037c0){return client[_0xc292('0x2')](_0xc292('0x3'),{'body':_0x2037c0,'log':_0xc292('0x3')});};exports[_0xc292('0x4')]=function(_0x3096d4,_0x44cdfb){return client['Request']('UpdateMailQueueReport',{'body':_0x44cdfb,'options':{'where':{'uniqueid':_0x3096d4},'order':[['id',_0xc292('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x523d=['Request','CreateMailQueueReport','UpdateMailQueueReport','../client','create'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x523d,0x134));var _0xd523=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x523d[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xd523('0x0'));exports[_0xd523('0x1')]=function(_0x254eac){return client[_0xd523('0x2')](_0xd523('0x3'),{'body':_0x254eac,'log':_0xd523('0x3')});};exports['update']=function(_0x3a0d8f,_0x46f51f){return client[_0xd523('0x2')](_0xd523('0x4'),{'body':_0x46f51f,'options':{'where':{'uniqueid':_0x3a0d8f},'order':[['id','DESC']],'limit':0x1},'log':_0xd523('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 7b94464..4d93339 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 _0xfd96=['AddTagsToOpenchannelInteraction','../client','update','Request','addTags'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xfd96,0xab));var _0x6fd9=function(_0x1052d9,_0x2d4292){_0x1052d9=_0x1052d9-0x0;var _0x154ab4=_0xfd96[_0x1052d9];return _0x154ab4;};'use strict';var client=require(_0x6fd9('0x0'));exports[_0x6fd9('0x1')]=function(_0x25d649,_0x18bdc8){return client[_0x6fd9('0x2')]('UpdateOpenchannelInteraction',{'body':_0x18bdc8,'options':{'where':{'id':_0x25d649}},'log':'updateOpenchannelInteraction'});};exports[_0x6fd9('0x3')]=function(_0x1b6f85,_0x34fd83){return client['Request'](_0x6fd9('0x4'),{'body':_0x34fd83,'options':{'where':{'id':_0x1b6f85}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x8520=['addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction'];(function(_0x6083d7,_0x2f3374){var _0x3562fd=function(_0xd5acdf){while(--_0xd5acdf){_0x6083d7['push'](_0x6083d7['shift']());}};_0x3562fd(++_0x2f3374);}(_0x8520,0x161));var _0x0852=function(_0x4e0b4d,_0x293502){_0x4e0b4d=_0x4e0b4d-0x0;var _0x4696eb=_0x8520[_0x4e0b4d];return _0x4696eb;};'use strict';var client=require(_0x0852('0x0'));exports[_0x0852('0x1')]=function(_0x289b0f,_0x156d04){return client['Request'](_0x0852('0x2'),{'body':_0x156d04,'options':{'where':{'id':_0x289b0f}},'log':_0x0852('0x3')});};exports[_0x0852('0x4')]=function(_0x1ddbe8,_0x56b40b){return client[_0x0852('0x5')](_0x0852('0x6'),{'body':_0x56b40b,'options':{'where':{'id':_0x1ddbe8}},'log':_0x0852('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index f71223b..57beb3c 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 _0xef77=['Request','../client','create'];(function(_0x127392,_0x5e8d2a){var _0x4fdf6e=function(_0x105349){while(--_0x105349){_0x127392['push'](_0x127392['shift']());}};_0x4fdf6e(++_0x5e8d2a);}(_0xef77,0xf1));var _0x7ef7=function(_0x1ce9df,_0x368ea4){_0x1ce9df=_0x1ce9df-0x0;var _0x1c5e1f=_0xef77[_0x1ce9df];return _0x1c5e1f;};'use strict';var client=require(_0x7ef7('0x0'));exports[_0x7ef7('0x1')]=function(_0xdf6a07){return client[_0x7ef7('0x2')]('CreateOpenchannelMessage',{'body':_0xdf6a07,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xc38d=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x537b9b,_0x64d0c6){var _0x394e63=function(_0x4732f9){while(--_0x4732f9){_0x537b9b['push'](_0x537b9b['shift']());}};_0x394e63(++_0x64d0c6);}(_0xc38d,0x90));var _0xdc38=function(_0x523d32,_0x4d98a7){_0x523d32=_0x523d32-0x0;var _0x3e901c=_0xc38d[_0x523d32];return _0x3e901c;};'use strict';var client=require(_0xdc38('0x0'));exports[_0xdc38('0x1')]=function(_0x181021){return client['Request'](_0xdc38('0x2'),{'body':_0x181021,'log':_0xdc38('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 9f4ba4a..60b7071 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 _0x0086=['User','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy'];(function(_0x245327,_0x2bbe5f){var _0x4d441c=function(_0x281a13){while(--_0x281a13){_0x245327['push'](_0x245327['shift']());}};_0x4d441c(++_0x2bbe5f);}(_0x0086,0xc0));var _0x6008=function(_0x22a442,_0x19ff4d){_0x22a442=_0x22a442-0x0;var _0x5b538f=_0x0086[_0x22a442];return _0x5b538f;};'use strict';var client=require(_0x6008('0x0'));exports[_0x6008('0x1')]=function(){return function(){return client[_0x6008('0x2')](_0x6008('0x3'),{'options':{'raw':![],'attributes':['id',_0x6008('0x4'),'timeout',_0x6008('0x5')],'include':[{'model':_0x6008('0x6'),'as':'Agents','attributes':['id','name',_0x6008('0x7'),_0x6008('0x8')]}]},'log':_0x6008('0x1')});};}; \ No newline at end of file +var _0xffe1=['Agents','name','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','timeout','User'];(function(_0x366680,_0x3c02b5){var _0x3974c1=function(_0x52ae22){while(--_0x52ae22){_0x366680['push'](_0x366680['shift']());}};_0x3974c1(++_0x3c02b5);}(_0xffe1,0x187));var _0x1ffe=function(_0x20487d,_0x578d89){_0x20487d=_0x20487d-0x0;var _0x28270d=_0xffe1[_0x20487d];return _0x28270d;};'use strict';var client=require(_0x1ffe('0x0'));exports[_0x1ffe('0x1')]=function(){return function(){return client['Request'](_0x1ffe('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x1ffe('0x3'),'strategy'],'include':[{'model':_0x1ffe('0x4'),'as':_0x1ffe('0x5'),'attributes':['id',_0x1ffe('0x6'),_0x1ffe('0x7'),_0x1ffe('0x8')]}]},'log':_0x1ffe('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 576bfa2..e21288c 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 _0xad5a=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client','create'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0xad5a,0x18a));var _0xaad5=function(_0x5c0c4b,_0x5454e1){_0x5c0c4b=_0x5c0c4b-0x0;var _0x4e73c6=_0xad5a[_0x5c0c4b];return _0x4e73c6;};'use strict';var client=require(_0xaad5('0x0'));exports[_0xaad5('0x1')]=function(_0x3280c1){return client[_0xaad5('0x2')](_0xaad5('0x3'),{'body':_0x3280c1,'log':'CreateOpenchannelQueueReport'});};exports[_0xaad5('0x4')]=function(_0x32f3c3,_0x503840){return client[_0xaad5('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x503840,'options':{'where':{'uniqueid':_0x32f3c3},'order':[['id','DESC']],'limit':0x1},'log':_0xaad5('0x5')});}; \ No newline at end of file +var _0x6224=['DESC','../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x6224,0xd3));var _0x4622=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x6224[_0x18a79d];return _0x4f8848;};'use strict';var client=require(_0x4622('0x0'));exports[_0x4622('0x1')]=function(_0x5aed37){return client[_0x4622('0x2')](_0x4622('0x3'),{'body':_0x5aed37,'log':'CreateOpenchannelQueueReport'});};exports[_0x4622('0x4')]=function(_0x5c36dd,_0x3e7e8a){return client[_0x4622('0x2')](_0x4622('0x5'),{'body':_0x3e7e8a,'options':{'where':{'uniqueid':_0x5c36dd},'order':[['id',_0x4622('0x6')]],'limit':0x1},'log':_0x4622('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 18c4ba4..8880d79 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 _0x3e9d=['addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0x3e9d,0x1ba));var _0xd3e9=function(_0x2dcc62,_0x430316){_0x2dcc62=_0x2dcc62-0x0;var _0xdefb43=_0x3e9d[_0x2dcc62];return _0xdefb43;};'use strict';var client=require(_0xd3e9('0x0'));exports[_0xd3e9('0x1')]=function(_0x506361,_0x184d37){return client[_0xd3e9('0x2')](_0xd3e9('0x3'),{'body':_0x184d37,'options':{'where':{'id':_0x506361}},'log':_0xd3e9('0x4')});};exports['addTags']=function(_0x4887ba,_0xa499a3){return client[_0xd3e9('0x2')](_0xd3e9('0x5'),{'body':_0xa499a3,'options':{'where':{'id':_0x4887ba}},'log':_0xd3e9('0x6')});}; \ No newline at end of file +var _0x37cc=['update','Request','UpdateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x131e60,_0x5352ce){var _0x4bc497=function(_0x2a758e){while(--_0x2a758e){_0x131e60['push'](_0x131e60['shift']());}};_0x4bc497(++_0x5352ce);}(_0x37cc,0x185));var _0xc37c=function(_0x40cd61,_0x36162c){_0x40cd61=_0x40cd61-0x0;var _0x120ce8=_0x37cc[_0x40cd61];return _0x120ce8;};'use strict';var client=require(_0xc37c('0x0'));exports[_0xc37c('0x1')]=function(_0x461b6f,_0x3ba386){return client[_0xc37c('0x2')](_0xc37c('0x3'),{'body':_0x3ba386,'options':{'where':{'id':_0x461b6f}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x334d3c,_0x946e3b){return client[_0xc37c('0x2')](_0xc37c('0x4'),{'body':_0x946e3b,'options':{'where':{'id':_0x334d3c}},'log':_0xc37c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index ae88dc5..6f2bb75 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 _0x7029=['../client','CreateSmsMessage','createSmsMessage'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7029,0x12f));var _0x9702=function(_0x297f24,_0x299557){_0x297f24=_0x297f24-0x0;var _0x3ea698=_0x7029[_0x297f24];return _0x3ea698;};'use strict';var client=require(_0x9702('0x0'));exports['create']=function(_0x1d563c){return client['Request'](_0x9702('0x1'),{'body':_0x1d563c,'log':_0x9702('0x2')});}; \ No newline at end of file +var _0x972d=['createSmsMessage','../client','create'];(function(_0x12352c,_0x5f42b7){var _0x17be62=function(_0x33223d){while(--_0x33223d){_0x12352c['push'](_0x12352c['shift']());}};_0x17be62(++_0x5f42b7);}(_0x972d,0x190));var _0xd972=function(_0x699dfd,_0x24a79f){_0x699dfd=_0x699dfd-0x0;var _0x418043=_0x972d[_0x699dfd];return _0x418043;};'use strict';var client=require(_0xd972('0x0'));exports[_0xd972('0x1')]=function(_0x13a03f){return client['Request']('CreateSmsMessage',{'body':_0x13a03f,'log':_0xd972('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 4050d0a..80a1db9 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x231ee0,_0x3e15e3){var _0xe3f4dc=function(_0x3729ac){while(--_0x3729ac){_0x231ee0['push'](_0x231ee0['shift']());}};_0xe3f4dc(++_0x3e15e3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x116cba,_0x3d9269){var _0x2cad19=function(_0x340dd6){while(--_0x340dd6){_0x116cba['push'](_0x116cba['shift']());}};_0x2cad19(++_0x3d9269);}(_0xe706,0xa3));var _0x6e70=function(_0x3b9c71,_0x52bd2f){_0x3b9c71=_0x3b9c71-0x0;var _0x419087=_0xe706[_0x3b9c71];return _0x419087;};'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 55967d6..81fc3ff 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x4adc4e,_0x39da2c){var _0x4d171e=function(_0x256aed){while(--_0x256aed){_0x4adc4e['push'](_0x4adc4e['shift']());}};_0x4d171e(++_0x39da2c);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x5b4f16,_0x30f77b){var _0x2a639f=function(_0x1e32f0){while(--_0x1e32f0){_0x5b4f16['push'](_0x5b4f16['shift']());}};_0x2a639f(++_0x30f77b);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index aad4d1f..3c5c9da 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(_0xed195e,_0x329101){var _0x4ffbbc=function(_0x111cbb){while(--_0x111cbb){_0xed195e['push'](_0xed195e['shift']());}};_0x4ffbbc(++_0x329101);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x212234,_0x54d864){var _0x232226=function(_0x460996){while(--_0x460996){_0x212234['push'](_0x212234['shift']());}};_0x232226(++_0x54d864);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 86e88c3..feffa65 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 _0xa498=['update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x3afbdf,_0x9e463b){var _0x5b6861=function(_0x31d287){while(--_0x31d287){_0x3afbdf['push'](_0x3afbdf['shift']());}};_0x5b6861(++_0x9e463b);}(_0xa498,0x1d6));var _0x8a49=function(_0x54cd98,_0x3029e6){_0x54cd98=_0x54cd98-0x0;var _0x4abd09=_0xa498[_0x54cd98];return _0x4abd09;};'use strict';var client=require('../client');exports[_0x8a49('0x0')]=function(_0xafd977,_0x48e111){return client['Request'](_0x8a49('0x1'),{'body':_0x48e111,'options':{'where':{'id':_0xafd977}},'log':_0x8a49('0x2')});};exports[_0x8a49('0x3')]=function(_0x65eb15,_0x2f362e){return client['Request'](_0x8a49('0x4'),{'body':_0x2f362e,'options':{'where':{'id':_0x65eb15}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x9536=['update','UpdateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','../client'];(function(_0x5b9bee,_0x5e29f7){var _0x5129da=function(_0x5365c8){while(--_0x5365c8){_0x5b9bee['push'](_0x5b9bee['shift']());}};_0x5129da(++_0x5e29f7);}(_0x9536,0x179));var _0x6953=function(_0x4d2f00,_0x4e94d5){_0x4d2f00=_0x4d2f00-0x0;var _0x2d7b7f=_0x9536[_0x4d2f00];return _0x2d7b7f;};'use strict';var client=require(_0x6953('0x0'));exports[_0x6953('0x1')]=function(_0x1a1c4e,_0x40b3c3){return client['Request'](_0x6953('0x2'),{'body':_0x40b3c3,'options':{'where':{'id':_0x1a1c4e}},'log':'updateWhatsappInteraction'});};exports[_0x6953('0x3')]=function(_0x3c32c7,_0x1dee7c){return client[_0x6953('0x4')](_0x6953('0x5'),{'body':_0x1dee7c,'options':{'where':{'id':_0x3c32c7}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 8678aa8..e155ed4 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 _0x9ece=['Request','CreateWhatsappMessage','../client','create'];(function(_0xabb376,_0x5b6680){var _0x5bf6f7=function(_0x4e6eb1){while(--_0x4e6eb1){_0xabb376['push'](_0xabb376['shift']());}};_0x5bf6f7(++_0x5b6680);}(_0x9ece,0x1c6));var _0xe9ec=function(_0x26260e,_0x24ec8b){_0x26260e=_0x26260e-0x0;var _0x39483d=_0x9ece[_0x26260e];return _0x39483d;};'use strict';var client=require(_0xe9ec('0x0'));exports[_0xe9ec('0x1')]=function(_0x4b656b){return client[_0xe9ec('0x2')](_0xe9ec('0x3'),{'body':_0x4b656b,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x7424=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x36cf27,_0x4605a0){var _0x1889bb=function(_0x489433){while(--_0x489433){_0x36cf27['push'](_0x36cf27['shift']());}};_0x1889bb(++_0x4605a0);}(_0x7424,0xa3));var _0x4742=function(_0x3b82d1,_0x49ab00){_0x3b82d1=_0x3b82d1-0x0;var _0x4d3796=_0x7424[_0x3b82d1];return _0x4d3796;};'use strict';var client=require(_0x4742('0x0'));exports[_0x4742('0x1')]=function(_0x5d423a){return client[_0x4742('0x2')](_0x4742('0x3'),{'body':_0x5d423a,'log':_0x4742('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 3f00c65..35fd9ab 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 _0xab56=['User','Agents','online','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','strategy'];(function(_0x54dd8b,_0x3fb3bc){var _0x1bbdf1=function(_0x32aeb9){while(--_0x32aeb9){_0x54dd8b['push'](_0x54dd8b['shift']());}};_0x1bbdf1(++_0x3fb3bc);}(_0xab56,0x1b2));var _0x6ab5=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xab56[_0x4e6ae6];return _0x23c108;};'use strict';var client=require(_0x6ab5('0x0'));exports[_0x6ab5('0x1')]=function(){return function(){return client['Request'](_0x6ab5('0x2'),{'options':{'raw':![],'attributes':['id',_0x6ab5('0x3'),_0x6ab5('0x4'),_0x6ab5('0x5')],'include':[{'model':_0x6ab5('0x6'),'as':_0x6ab5('0x7'),'attributes':['id',_0x6ab5('0x3'),_0x6ab5('0x8'),_0x6ab5('0x9')]}]},'log':_0x6ab5('0x1')});};}; \ No newline at end of file +var _0xc899=['online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents'];(function(_0x4e13d2,_0x1acfbe){var _0xb5c3a9=function(_0x474963){while(--_0x474963){_0x4e13d2['push'](_0x4e13d2['shift']());}};_0xb5c3a9(++_0x1acfbe);}(_0xc899,0x1d8));var _0x9c89=function(_0x484086,_0x23b1c6){_0x484086=_0x484086-0x0;var _0x687052=_0xc899[_0x484086];return _0x687052;};'use strict';var client=require('../client');exports[_0x9c89('0x0')]=function(){return function(){return client[_0x9c89('0x1')](_0x9c89('0x2'),{'options':{'raw':![],'attributes':['id',_0x9c89('0x3'),_0x9c89('0x4'),_0x9c89('0x5')],'include':[{'model':_0x9c89('0x6'),'as':_0x9c89('0x7'),'attributes':['id',_0x9c89('0x3'),_0x9c89('0x8'),_0x9c89('0x9')]}]},'log':_0x9c89('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 29f6b50..5d3d127 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 _0x0fb0=['Request','UpdateWhatsappQueueReport','DESC','../client','create','CreateWhatsappQueueReport','update'];(function(_0x3a8db5,_0x31cff7){var _0x2c03cd=function(_0x47dba0){while(--_0x47dba0){_0x3a8db5['push'](_0x3a8db5['shift']());}};_0x2c03cd(++_0x31cff7);}(_0x0fb0,0x1f4));var _0x00fb=function(_0x48765f,_0x49f184){_0x48765f=_0x48765f-0x0;var _0x1c675f=_0x0fb0[_0x48765f];return _0x1c675f;};'use strict';var client=require(_0x00fb('0x0'));exports[_0x00fb('0x1')]=function(_0x17d1fd){return client['Request'](_0x00fb('0x2'),{'body':_0x17d1fd,'log':'CreateWhatsappQueueReport'});};exports[_0x00fb('0x3')]=function(_0x5b196e,_0x4f46a8){return client[_0x00fb('0x4')](_0x00fb('0x5'),{'body':_0x4f46a8,'options':{'where':{'uniqueid':_0x5b196e},'order':[['id',_0x00fb('0x6')]],'limit':0x1},'log':_0x00fb('0x5')});}; \ No newline at end of file +var _0x913c=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client','create','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x913c,0x165));var _0xc913=function(_0x1182e5,_0x4ca600){_0x1182e5=_0x1182e5-0x0;var _0x45909b=_0x913c[_0x1182e5];return _0x45909b;};'use strict';var client=require(_0xc913('0x0'));exports[_0xc913('0x1')]=function(_0x5e388d){return client[_0xc913('0x2')]('CreateWhatsappQueueReport',{'body':_0x5e388d,'log':_0xc913('0x3')});};exports[_0xc913('0x4')]=function(_0xd3190f,_0x262463){return client[_0xc913('0x2')](_0xc913('0x5'),{'body':_0x262463,'options':{'where':{'uniqueid':_0xd3190f},'order':[['id','DESC']],'limit':0x1},'log':_0xc913('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 34aed62..9d79837 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 _0x3bf9=['error','[%s][AGENT]\x20%s','map','join','find','agents','timeout','createQueue','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','agent','name','stop','log','[%s][QUEUE]\x20%s','stack','validate','seq-queue','../../../../config/logger','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','toLowerCase','consequence','length'];(function(_0x175aab,_0x112257){var _0x48d4ef=function(_0x5f0b12){while(--_0x5f0b12){_0x175aab['push'](_0x175aab['shift']());}};_0x48d4ef(++_0x112257);}(_0x3bf9,0xdb));var _0x93bf=function(_0x49677a,_0x197e86){_0x49677a=_0x49677a-0x0;var _0x115408=_0x3bf9[_0x49677a];return _0x115408;};'use strict';var schema=require(_0x93bf('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x93bf('0x1'));var logger=require(_0x93bf('0x2'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x93bf('0x3'),'required':!![],'message':_0x93bf('0x4')},'timeout':{'type':_0x93bf('0x5'),'message':_0x93bf('0x6')}});function writeLog(_0xa57913,_0x5688a3,_0x2e2e1b){return logger[_0x93bf('0x7')](util[_0x93bf('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0xa57913,_0x5688a3['name'],_0x2e2e1b));}function handleFindAgent(_0x352f1a){return function(_0x11f8f1){return _0x11f8f1['name'][_0x93bf('0x9')]()===_0x352f1a[_0x93bf('0x9')]();};}exports[_0x93bf('0xa')]=function(_0x2f06e2,_0x2259c8,_0x80141d,_0x4ca566){return function(_0x248457){try{var _0x5e65e3={'name':_0x2259c8[0x0],'timeout':_0x2259c8[0x1]};var _0x29816b=queue['validate'](_0x5e65e3,{'typecast':!![]});if(_0x29816b[_0x93bf('0xb')]){logger[_0x93bf('0xc')](_0x93bf('0xd'),_0x2f06e2,_[_0x93bf('0xe')](_0x29816b,'message')[_0x93bf('0xf')](',\x20'));_0x248457['stop']();}else{var _0x5e1882=_[_0x93bf('0x10')](_0x80141d[_0x93bf('0x11')],handleFindAgent(_0x5e65e3['name']));if(_0x5e1882){var _0x4281ff=(_0x5e65e3[_0x93bf('0x12')]||0xa)*0x3e8;var _0x6aef8b,_0x2d756a;var _0x50f3be=seqqueue[_0x93bf('0x13')](_0x4281ff);_0x50f3be['id']=_0x2f06e2;_0x50f3be['atimeout']=_0x4281ff;_0x50f3be[_0x93bf('0x14')]=_0x4ca566['channel'];writeLog(_0x2f06e2,_0x5e1882,util['format'](_0x93bf('0x15'),_0x4281ff));_0x80141d[_0x93bf('0x16')][_0x2f06e2]['on']('end',function(){logger['info'](_0x93bf('0x17'),_0x2f06e2);clearTimeout(_0x2d756a);_0x2d756a=undefined;_0x50f3be[_0x93bf('0x18')]();if(_0x80141d[_0x93bf('0x16')][_0x2f06e2]){delete _0x80141d['rules'][_0x2f06e2];}_0x248457['stop']();});_0x80141d[_0x93bf('0x16')][_0x2f06e2]['on'](_0x93bf('0x19'),function(){if(_0x80141d[_0x93bf('0x16')][_0x2f06e2]){delete _0x80141d[_0x93bf('0x16')][_0x2f06e2];}});_0x2d756a=setTimeout(function(){logger['info'](_0x93bf('0x1a'),_0x2f06e2);clearTimeout(_0x2d756a);_0x50f3be[_0x93bf('0x18')]();_0x248457['next']();},_0x4281ff);strategy[_0x93bf('0x1b')](_0x50f3be,_0x5e1882,_0x80141d,_0x4ca566);}else{logger[_0x93bf('0xc')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x2f06e2,_0x5e65e3[_0x93bf('0x1c')]);_0x248457[_0x93bf('0x1d')]();}}}catch(_0x19dd83){console[_0x93bf('0x1e')](_0x19dd83);logger[_0x93bf('0xc')](_0x93bf('0x1f'),_0x2f06e2,_0x19dd83[_0x93bf('0x20')]);_0x248457[_0x93bf('0x1d')]();}};}; \ No newline at end of file +var _0x9e34=['length','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase'];(function(_0x59fffa,_0x5a61db){var _0x281d4e=function(_0x5327ca){while(--_0x5327ca){_0x59fffa['push'](_0x59fffa['shift']());}};_0x281d4e(++_0x5a61db);}(_0x9e34,0xab));var _0x49e3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x9e34[_0x2c91e9];return _0x13f0ff;};'use strict';var schema=require(_0x49e3('0x0'));var _=require(_0x49e3('0x1'));var util=require(_0x49e3('0x2'));var seqqueue=require(_0x49e3('0x3'));var logger=require(_0x49e3('0x4'))(_0x49e3('0x5'));var strategy=require(_0x49e3('0x6'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x49e3('0x7')},'timeout':{'type':'number','message':_0x49e3('0x8')}});function writeLog(_0x2aab6b,_0x5d6dc2,_0x45f7b2){return logger[_0x49e3('0x9')](util[_0x49e3('0xa')](_0x49e3('0xb'),_0x2aab6b,_0x5d6dc2[_0x49e3('0xc')],_0x45f7b2));}function handleFindAgent(_0xb2dd1c){return function(_0x18306c){return _0x18306c[_0x49e3('0xc')]['toLowerCase']()===_0xb2dd1c[_0x49e3('0xd')]();};}exports['consequence']=function(_0x3abab4,_0x352aa6,_0x4c2a94,_0x2e6df5){return function(_0x52544e){try{var _0x2fd073={'name':_0x352aa6[0x0],'timeout':_0x352aa6[0x1]};var _0x3969d1=queue[_0x49e3('0x0')](_0x2fd073,{'typecast':!![]});if(_0x3969d1[_0x49e3('0xe')]){logger['error'](_0x49e3('0xf'),_0x3abab4,_[_0x49e3('0x10')](_0x3969d1,_0x49e3('0x11'))[_0x49e3('0x12')](',\x20'));_0x52544e[_0x49e3('0x13')]();}else{var _0xc8fa88=_[_0x49e3('0x14')](_0x4c2a94[_0x49e3('0x15')],handleFindAgent(_0x2fd073[_0x49e3('0xc')]));if(_0xc8fa88){var _0x17616c=(_0x2fd073[_0x49e3('0x16')]||0xa)*0x3e8;var _0x500cf7,_0x39f5f1;var _0x491b39=seqqueue[_0x49e3('0x17')](_0x17616c);_0x491b39['id']=_0x3abab4;_0x491b39['atimeout']=_0x17616c;_0x491b39[_0x49e3('0x18')]=_0x2e6df5['channel'];writeLog(_0x3abab4,_0xc8fa88,util[_0x49e3('0xa')](_0x49e3('0x19'),_0x17616c));_0x4c2a94[_0x49e3('0x1a')][_0x3abab4]['on'](_0x49e3('0x1b'),function(){logger[_0x49e3('0x9')](_0x49e3('0x1c'),_0x3abab4);clearTimeout(_0x39f5f1);_0x39f5f1=undefined;_0x491b39[_0x49e3('0x1d')]();if(_0x4c2a94[_0x49e3('0x1a')][_0x3abab4]){delete _0x4c2a94[_0x49e3('0x1a')][_0x3abab4];}_0x52544e[_0x49e3('0x13')]();});_0x4c2a94['rules'][_0x3abab4]['on'](_0x49e3('0x1e'),function(){if(_0x4c2a94[_0x49e3('0x1a')][_0x3abab4]){delete _0x4c2a94[_0x49e3('0x1a')][_0x3abab4];}});_0x39f5f1=setTimeout(function(){logger[_0x49e3('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x3abab4);clearTimeout(_0x39f5f1);_0x491b39[_0x49e3('0x1d')]();_0x52544e[_0x49e3('0x1f')]();},_0x17616c);strategy[_0x49e3('0x20')](_0x491b39,_0xc8fa88,_0x4c2a94,_0x2e6df5);}else{logger['error'](_0x49e3('0x21'),_0x3abab4,_0x2fd073['name']);_0x52544e['stop']();}}}catch(_0x201f6e){console[_0x49e3('0x22')](_0x201f6e);logger['error'](_0x49e3('0x23'),_0x3abab4,_0x201f6e[_0x49e3('0x24')]);_0x52544e['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 5bd51d6..ab56d24 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 _0xaf68=['error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','postText','next','amazonlex','providerName','providerResponse','then','Failed','catch','moment','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account','AccountId','InteractionId','isEmpty','Message','create','body'];(function(_0x463376,_0x2cc029){var _0x4e0587=function(_0x49c495){while(--_0x49c495){_0x463376['push'](_0x463376['shift']());}};_0x4e0587(++_0x2cc029);}(_0xaf68,0x18a));var _0x8af6=function(_0x4b768c,_0x41ce8b){_0x4b768c=_0x4b768c-0x0;var _0x524803=_0xaf68[_0x4b768c];return _0x524803;};'use strict';var _=require('lodash');var moment=require(_0x8af6('0x0'));var AWS=require(_0x8af6('0x1'));var utils=require('./utils');var logger=require(_0x8af6('0x2'))('routing');var rpc={'chatMessage':require(_0x8af6('0x3')),'openchannelMessage':require(_0x8af6('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8af6('0x5')),'faxMessage':require(_0x8af6('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x8af6('0x7')]=function(_0xd4a410,_0x108bde){return function(_0x345bff){try{if(!_[_0x8af6('0x8')](this[_0x8af6('0x9')]['UserId'])){logger[_0x8af6('0xa')](_0x8af6('0xb'),_0xd4a410,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x345bff['next']();}var _0x52aa3d={'ContactId':this['contact']['id'],'sentAt':moment()[_0x8af6('0xc')](_0x8af6('0xd')),'direction':_0x8af6('0xe')};if(this[_0x8af6('0xf')]==='sms'||this[_0x8af6('0xf')]==='whatsapp'){_0x52aa3d[_0x8af6('0x10')]=this[_0x8af6('0x9')][_0x8af6('0x10')];}var _0x464889=this['channel'];if(_0x464889===_0x8af6('0x11')){_0x52aa3d[_0x8af6('0x12')]=this[_0x8af6('0x13')]['id'];}else{_0x52aa3d[_['upperFirst'](_0x464889)+_0x8af6('0x14')]=this[_0x8af6('0x13')]['id'];}_0x52aa3d[_['upperFirst'](_0x464889)+_0x8af6('0x15')]=this[_0x8af6('0x9')]['id'];if(this[_0x8af6('0x9')]['created']){var _0x3c2aac=_0x108bde[0x4];if(!_[_0x8af6('0x16')](_0x3c2aac)){_0x52aa3d['body']=utils['getMustacheRender'](_0x3c2aac,this);return rpc[_0x464889+_0x8af6('0x17')][_0x8af6('0x18')](_0x52aa3d)['then'](function(_0x353db2){logger['info'](_0x8af6('0xb'),_0xd4a410,_0x52aa3d[_0x8af6('0x19')]);})['catch'](function(_0x27e14d){logger[_0x8af6('0x1a')](_0x8af6('0xb'),_0xd4a410,JSON[_0x8af6('0x1b')](_0x27e14d));})[_0x8af6('0x1c')](function(){logger[_0x8af6('0xa')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xd4a410);_0x345bff[_0x8af6('0x1d')]();});}else{logger[_0x8af6('0xa')](_0x8af6('0x1e'),_0xd4a410);_0x345bff[_0x8af6('0x1d')]();}}else{var _0x50e06f=this;var _0x1f74a0=new AWS[(_0x8af6('0x1f'))]({'accessKeyId':_0x108bde[0x0],'secretAccessKey':_0x108bde[0x1],'region':_0x108bde[0x2]});var _0x46197e={'botAlias':'$LATEST','botName':_0x108bde[0x3],'inputText':this[_0x8af6('0x20')]['body'],'userId':this['channel']+':'+this[_0x8af6('0x9')]['id'][_0x8af6('0x21')]()};_0x1f74a0[_0x8af6('0x22')](_0x46197e,function(_0x91ec2a,_0x1858ac){if(_0x91ec2a){logger[_0x8af6('0x1a')](_0x8af6('0xb'),_0xd4a410,_0x91ec2a['message']);_0x345bff[_0x8af6('0x23')]();}else if(_0x1858ac&&_0x1858ac[_0x8af6('0x20')]){_0x50e06f[_0x8af6('0x19')][_0x8af6('0x24')]=_0x1858ac;_0x52aa3d[_0x8af6('0x19')]=_0x1858ac[_0x8af6('0x20')];_0x52aa3d[_0x8af6('0x25')]='amazonlex';_0x52aa3d[_0x8af6('0x26')]=JSON[_0x8af6('0x1b')](_0x1858ac);return rpc[_0x464889+_0x8af6('0x17')]['create'](_0x52aa3d)[_0x8af6('0x27')](function(_0x1bd67b){logger[_0x8af6('0xa')]('[%s][AMAZONLEX]\x20%s',_0xd4a410,_0x52aa3d[_0x8af6('0x19')]);if(_0x1858ac['dialogState']==_0x8af6('0x28')){_0x345bff[_0x8af6('0x23')]();}else{_0x345bff['stop']();}})[_0x8af6('0x29')](function(_0x2ed21e){logger[_0x8af6('0x1a')](_0x8af6('0xb'),_0xd4a410,JSON['stringify'](_0x2ed21e));_0x345bff[_0x8af6('0x23')]();});}else{_0x345bff[_0x8af6('0x23')]();}});}}catch(_0x18c46d){logger[_0x8af6('0x1a')](_0x8af6('0xb'),_0xd4a410,JSON[_0x8af6('0x1b')](_0x18c46d));_0x345bff[_0x8af6('0x1d')]();}};}; \ No newline at end of file +var _0x0acc=['info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','Message','create','then','body','error','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','toString','postText','message','next','providerName','amazonlex','providerResponse','dialogState','stringify','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId'];(function(_0x4e4519,_0x392ae){var _0x340044=function(_0x11721f){while(--_0x11721f){_0x4e4519['push'](_0x4e4519['shift']());}};_0x340044(++_0x392ae);}(_0x0acc,0xbb));var _0xc0ac=function(_0x12ed67,_0x1a5083){_0x12ed67=_0x12ed67-0x0;var _0x197263=_0x0acc[_0x12ed67];return _0x197263;};'use strict';var _=require(_0xc0ac('0x0'));var moment=require(_0xc0ac('0x1'));var AWS=require(_0xc0ac('0x2'));var utils=require(_0xc0ac('0x3'));var logger=require(_0xc0ac('0x4'))(_0xc0ac('0x5'));var rpc={'chatMessage':require(_0xc0ac('0x6')),'openchannelMessage':require(_0xc0ac('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc0ac('0x8')),'faxMessage':require(_0xc0ac('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x1befab,_0x5d1b36){return function(_0x55ad11){try{if(!_[_0xc0ac('0xa')](this[_0xc0ac('0xb')][_0xc0ac('0xc')])){logger[_0xc0ac('0xd')](_0xc0ac('0xe'),_0x1befab,_0xc0ac('0xf'));return _0x55ad11['next']();}var _0x8b3670={'ContactId':this[_0xc0ac('0x10')]['id'],'sentAt':moment()[_0xc0ac('0x11')](_0xc0ac('0x12')),'direction':_0xc0ac('0x13')};if(this[_0xc0ac('0x14')]===_0xc0ac('0x15')||this[_0xc0ac('0x14')]===_0xc0ac('0x16')){_0x8b3670['phone']=this[_0xc0ac('0xb')][_0xc0ac('0x17')];}var _0x3b55fb=this['channel'];if(_0x3b55fb===_0xc0ac('0x18')){_0x8b3670[_0xc0ac('0x19')]=this[_0xc0ac('0x1a')]['id'];}else{_0x8b3670[_[_0xc0ac('0x1b')](_0x3b55fb)+'AccountId']=this['account']['id'];}_0x8b3670[_[_0xc0ac('0x1b')](_0x3b55fb)+_0xc0ac('0x1c')]=this['interaction']['id'];if(this[_0xc0ac('0xb')][_0xc0ac('0x1d')]){var _0x56f57a=_0x5d1b36[0x4];if(!_[_0xc0ac('0x1e')](_0x56f57a)){_0x8b3670['body']=utils[_0xc0ac('0x1f')](_0x56f57a,this);return rpc[_0x3b55fb+_0xc0ac('0x20')][_0xc0ac('0x21')](_0x8b3670)[_0xc0ac('0x22')](function(_0x2c4657){logger[_0xc0ac('0xd')](_0xc0ac('0xe'),_0x1befab,_0x8b3670[_0xc0ac('0x23')]);})['catch'](function(_0x50ff41){logger[_0xc0ac('0x24')](_0xc0ac('0xe'),_0x1befab,JSON['stringify'](_0x50ff41));})[_0xc0ac('0x25')](function(){logger[_0xc0ac('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1befab);_0x55ad11[_0xc0ac('0x26')]();});}else{logger[_0xc0ac('0xd')](_0xc0ac('0x27'),_0x1befab);_0x55ad11[_0xc0ac('0x26')]();}}else{var _0x57a156=this;var _0x30af5f=new AWS['LexRuntime']({'accessKeyId':_0x5d1b36[0x0],'secretAccessKey':_0x5d1b36[0x1],'region':_0x5d1b36[0x2]});var _0x517347={'botAlias':_0xc0ac('0x28'),'botName':_0x5d1b36[0x3],'inputText':this['message'][_0xc0ac('0x23')],'userId':this[_0xc0ac('0x14')]+':'+this[_0xc0ac('0xb')]['id'][_0xc0ac('0x29')]()};_0x30af5f[_0xc0ac('0x2a')](_0x517347,function(_0x2f99b2,_0xc0398a){if(_0x2f99b2){logger[_0xc0ac('0x24')](_0xc0ac('0xe'),_0x1befab,_0x2f99b2[_0xc0ac('0x2b')]);_0x55ad11[_0xc0ac('0x2c')]();}else if(_0xc0398a&&_0xc0398a[_0xc0ac('0x2b')]){_0x57a156[_0xc0ac('0x23')]['amazonlex']=_0xc0398a;_0x8b3670[_0xc0ac('0x23')]=_0xc0398a[_0xc0ac('0x2b')];_0x8b3670[_0xc0ac('0x2d')]=_0xc0ac('0x2e');_0x8b3670[_0xc0ac('0x2f')]=JSON['stringify'](_0xc0398a);return rpc[_0x3b55fb+_0xc0ac('0x20')][_0xc0ac('0x21')](_0x8b3670)[_0xc0ac('0x22')](function(_0x12c088){logger[_0xc0ac('0xd')]('[%s][AMAZONLEX]\x20%s',_0x1befab,_0x8b3670[_0xc0ac('0x23')]);if(_0xc0398a[_0xc0ac('0x30')]=='Failed'){_0x55ad11[_0xc0ac('0x2c')]();}else{_0x55ad11[_0xc0ac('0x26')]();}})['catch'](function(_0x364fe6){logger[_0xc0ac('0x24')]('[%s][AMAZONLEX]\x20%s',_0x1befab,JSON[_0xc0ac('0x31')](_0x364fe6));_0x55ad11[_0xc0ac('0x2c')]();});}else{_0x55ad11[_0xc0ac('0x2c')]();}});}}catch(_0x40efde){logger[_0xc0ac('0x24')](_0xc0ac('0xe'),_0x1befab,JSON[_0xc0ac('0x31')](_0x40efde));_0x55ad11[_0xc0ac('0x26')]();}};}; \ 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 9a5c6f4..57b2e51 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 _0x9af4=['lodash','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','interaction','created','next','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','account','upperFirst','InteractionId','Message','Smtp','service','host','port','secure','auth','user','pass','inReplyTo','messageId','html','replace',''+_[_0x49af('0x37')](_0x86e73[_0x49af('0x13')],_0x49af('0x38'),'';_0x86e73[_0x49af('0x39')]={'Auto-Submitted':_0x49af('0x3a'),'X-Auto-Response-Suppress':_0x49af('0x3b'),'Precedence':_0x49af('0x3c')};return mailRpc[_0x49af('0x3d')](_0x4b7ca5,_0x86e73)[_0x49af('0x3e')](function(_0x367d8b){logger[_0x49af('0x15')](_0x49af('0x3f'),_0x29961a);_0x86e73[_0x49af('0x35')]=_0x367d8b['message'][_0x49af('0x35')];return rpc[_0xd8e104+_0x49af('0x2b')][_0x49af('0x40')](_0x86e73);})[_0x49af('0x3e')](function(_0x19725a){logger[_0x49af('0x15')](_0x49af('0x16'),_0x29961a,JSON[_0x49af('0x41')](_0x19725a));})[_0x49af('0x42')](function(_0x282d54){logger[_0x49af('0x43')](_0x49af('0x44'),_0x29961a,JSON[_0x49af('0x41')](_0x282d54));})['finally'](function(){Promise['resolve']()['then'](function(){if(_0x19edd4[0x0]!=='2'||_0x43e229[_0x49af('0x45')])return;return rpc[_0xd8e104+_0x49af('0x46')][_0x49af('0x47')](_0x43e229['id'],{'autoreplyExecuted':!![]})[_0x49af('0x3e')](function(_0x3ec2c1){logger['info'](_0x49af('0x48'),_0x29961a,JSON[_0x49af('0x41')](_0x3ec2c1));})[_0x49af('0x42')](function(_0x1c546c){logger[_0x49af('0x43')](_0x49af('0x49'),_0x29961a,JSON[_0x49af('0x41')](_0x1c546c));});})[_0x49af('0x3e')](function(){_0x2b1d4b[_0x49af('0x19')]();});});}else{return rpc[this['channel']+_0x49af('0x2b')][_0x49af('0x40')](_0x86e73)[_0x49af('0x3e')](function(_0x24ba17){logger['info']('[%s][AUTOREPLY]\x20%s',_0x29961a,_0x86e73[_0x49af('0x13')]);})[_0x49af('0x42')](function(_0x201a13){logger[_0x49af('0x43')](_0x49af('0x16'),_0x29961a,JSON[_0x49af('0x41')](_0x201a13));})[_0x49af('0x4a')](function(){Promise[_0x49af('0x4b')]()[_0x49af('0x3e')](function(){if(_0x19edd4[0x0]!=='2'||_0x43e229['autoreplyExecuted'])return;return rpc[_0xd8e104+_0x49af('0x46')][_0x49af('0x47')](_0x43e229['id'],{'autoreplyExecuted':!![]})[_0x49af('0x3e')](function(_0x5495c5){logger[_0x49af('0x15')](_0x49af('0x48'),_0x29961a,JSON[_0x49af('0x41')](_0x5495c5));})[_0x49af('0x42')](function(_0x13ffba){logger[_0x49af('0x43')](_0x49af('0x49'),_0x29961a,JSON[_0x49af('0x41')](_0x13ffba));});})[_0x49af('0x3e')](function(){_0x2b1d4b[_0x49af('0x19')]();});});}}}catch(_0x1dc529){logger[_0x49af('0x43')](_0x49af('0x16'),_0x29961a,JSON['stringify'](_0x1dc529));_0x2b1d4b['stop']();}};}; \ No newline at end of file +var _0x32a4=['../../rpc/smsMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','body','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','Smtp','service','host','port','authentication','auth','user','messageId','html','','replace','','headers','auto-replied','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage'];(function(_0x146d34,_0x4ce32e){var _0x42d0fc=function(_0x3ff752){while(--_0x3ff752){_0x146d34['push'](_0x146d34['shift']());}};_0x42d0fc(++_0x4ce32e);}(_0x32a4,0x11f));var _0x432a=function(_0x26cf77,_0x183d5c){_0x26cf77=_0x26cf77-0x0;var _0x58b93f=_0x32a4[_0x26cf77];return _0x58b93f;};'use strict';var _=require(_0x432a('0x0'));var moment=require(_0x432a('0x1'));var utils=require(_0x432a('0x2'));var logger=require(_0x432a('0x3'))('routing');var rpc={'chatMessage':require(_0x432a('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x432a('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x432a('0x6')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x432a('0x7')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x432a('0x8'))};var mailRpc=require(_0x432a('0x9'));exports[_0x432a('0xa')]=function(_0x4c5d09,_0x2c7185,_0x275ed6,_0x26b2dc){return function(_0x42c27b){try{var _0xd785d5=this[_0x432a('0xb')];if(_0xd785d5==='mail'&&_0x26b2dc[_0x432a('0xc')]['isAutoreply']){logger[_0x432a('0xd')]('[%s][AUTOREPLY]\x20%s',_0x4c5d09,_0x432a('0xe'));return _0x42c27b[_0x432a('0xf')]();}if(_0x2c7185[0x0]==='1'&&(_[_0x432a('0x10')](this[_0x432a('0x11')][_0x432a('0x12')])||!this['interaction'][_0x432a('0x12')])){logger['info'](_0x432a('0x13'),_0x4c5d09,_0x432a('0x14'));return _0x42c27b[_0x432a('0xf')]();}if(_0x2c7185[0x0]==='2'&&this[_0x432a('0x11')][_0x432a('0x15')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4c5d09,_0x432a('0x16'));return _0x42c27b[_0x432a('0xf')]();}var _0x1d0dfc={'ContactId':this[_0x432a('0x17')]['id'],'sentAt':moment()[_0x432a('0x18')](_0x432a('0x19')),'direction':_0x432a('0x1a')};if(this['channel']===_0x432a('0x1b')){_0x1d0dfc[_0x432a('0xc')]=utils['getMustacheRender'](_0x2c7185[0x2],this);}else{_0x1d0dfc['body']=utils[_0x432a('0x1c')](_0x2c7185[0x1],this);}if(this[_0x432a('0x1d')]){_0x1d0dfc['to']=this['message'][_0x432a('0x1e')]||'';if(this[_0x432a('0xb')]===_0x432a('0x1b')&&_0x2c7185[0x1]==='1'){_0x1d0dfc['cc']=this['message']['cc']||'';}_0x1d0dfc[_0x432a('0x1e')]=this[_0x432a('0x1d')]['to']||'';_0x1d0dfc[_0x432a('0x1f')]=this[_0x432a('0x1d')][_0x432a('0x1f')]||'';_0x1d0dfc[_0x432a('0x20')]=!![];if(this['message'][_0x432a('0x21')]){_0x1d0dfc['subject']='';_0x1d0dfc[_0x432a('0x21')]+=_[_0x432a('0x22')](this[_0x432a('0x1d')][_0x432a('0x21')],'Re:')?'':_0x432a('0x23');_0x1d0dfc[_0x432a('0x21')]+=this[_0x432a('0x1d')]['subject'];}}if(this[_0x432a('0xb')]===_0x432a('0x24')){_0x1d0dfc[_0x432a('0x25')]=this[_0x432a('0x26')]['id'];}else{_0x1d0dfc[_['upperFirst'](this[_0x432a('0xb')])+'AccountId']=this['account']['id'];}_0x1d0dfc[_[_0x432a('0x27')](this[_0x432a('0xb')])+_0x432a('0x28')]=this[_0x432a('0x11')]['id'];var _0x150831=this[_0x432a('0x11')];if(rpc[this[_0x432a('0xb')]+_0x432a('0x29')]){if(this['channel']===_0x432a('0x1b')){var _0x248520={'tls':{'rejectUnauthorized':![]}};if(this[_0x432a('0x26')][_0x432a('0x2a')][_0x432a('0x2b')]){_0x248520[_0x432a('0x2b')]=this[_0x432a('0x26')][_0x432a('0x2a')][_0x432a('0x2b')];}else{_0x248520[_0x432a('0x2c')]=this[_0x432a('0x26')][_0x432a('0x2a')][_0x432a('0x2c')];_0x248520[_0x432a('0x2d')]=this[_0x432a('0x26')][_0x432a('0x2a')][_0x432a('0x2d')];_0x248520['secure']=this[_0x432a('0x26')][_0x432a('0x2a')]['secure'];}if(this[_0x432a('0x26')]['Smtp'][_0x432a('0x2e')]){_0x248520[_0x432a('0x2f')]={'user':this[_0x432a('0x26')]['Smtp'][_0x432a('0x30')],'pass':this[_0x432a('0x26')][_0x432a('0x2a')]['pass']};}_0x1d0dfc['inReplyTo']=this[_0x432a('0x1d')][_0x432a('0x31')];_0x1d0dfc[_0x432a('0x32')]=_0x432a('0x33')+_[_0x432a('0x34')](_0x1d0dfc[_0x432a('0xc')],_0x432a('0x35'),_0x432a('0x36'))+_0x432a('0x37');_0x1d0dfc[_0x432a('0x38')]={'Auto-Submitted':_0x432a('0x39'),'X-Auto-Response-Suppress':'All','Precedence':_0x432a('0x3a')};return mailRpc[_0x432a('0x3b')](_0x248520,_0x1d0dfc)[_0x432a('0x3c')](function(_0x1dc4ff){logger[_0x432a('0xd')](_0x432a('0x3d'),_0x4c5d09);_0x1d0dfc[_0x432a('0x31')]=_0x1dc4ff[_0x432a('0x1d')][_0x432a('0x31')];return rpc[_0xd785d5+'Message']['create'](_0x1d0dfc);})[_0x432a('0x3c')](function(_0x54ef8b){logger[_0x432a('0xd')](_0x432a('0x13'),_0x4c5d09,JSON[_0x432a('0x3e')](_0x54ef8b));})[_0x432a('0x3f')](function(_0x1b5964){logger[_0x432a('0x40')](_0x432a('0x41'),_0x4c5d09,JSON['stringify'](_0x1b5964));})[_0x432a('0x42')](function(){Promise[_0x432a('0x43')]()[_0x432a('0x3c')](function(){if(_0x2c7185[0x0]!=='2'||_0x150831[_0x432a('0x15')])return;return rpc[_0xd785d5+_0x432a('0x44')][_0x432a('0x45')](_0x150831['id'],{'autoreplyExecuted':!![]})[_0x432a('0x3c')](function(_0x2a9ce2){logger[_0x432a('0xd')](_0x432a('0x46'),_0x4c5d09,JSON[_0x432a('0x3e')](_0x2a9ce2));})[_0x432a('0x3f')](function(_0x8f0f89){logger[_0x432a('0x40')](_0x432a('0x47'),_0x4c5d09,JSON[_0x432a('0x3e')](_0x8f0f89));});})[_0x432a('0x3c')](function(){_0x42c27b['next']();});});}else{return rpc[this[_0x432a('0xb')]+_0x432a('0x29')]['create'](_0x1d0dfc)[_0x432a('0x3c')](function(_0x14503b){logger[_0x432a('0xd')]('[%s][AUTOREPLY]\x20%s',_0x4c5d09,_0x1d0dfc['body']);})[_0x432a('0x3f')](function(_0x3c8110){logger[_0x432a('0x40')](_0x432a('0x13'),_0x4c5d09,JSON[_0x432a('0x3e')](_0x3c8110));})[_0x432a('0x42')](function(){Promise[_0x432a('0x43')]()['then'](function(){if(_0x2c7185[0x0]!=='2'||_0x150831[_0x432a('0x15')])return;return rpc[_0xd785d5+_0x432a('0x44')]['update'](_0x150831['id'],{'autoreplyExecuted':!![]})[_0x432a('0x3c')](function(_0x1d73f9){logger[_0x432a('0xd')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4c5d09,JSON[_0x432a('0x3e')](_0x1d73f9));})['catch'](function(_0x265171){logger[_0x432a('0x40')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4c5d09,JSON['stringify'](_0x265171));});})['then'](function(){_0x42c27b['next']();});});}}}catch(_0x7f5a04){logger[_0x432a('0x40')](_0x432a('0x13'),_0x4c5d09,JSON['stringify'](_0x7f5a04));_0x42c27b[_0x432a('0x48')]();}};}; \ 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 16c46d4..5e588f4 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 _0x155b=['routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','finally','stop','[%s][CLOSE]\x20%s'];(function(_0x2f0244,_0x5c752b){var _0x1699a1=function(_0x32d4f9){while(--_0x32d4f9){_0x2f0244['push'](_0x2f0244['shift']());}};_0x1699a1(++_0x5c752b);}(_0x155b,0x1ee));var _0xb155=function(_0xa31cbb,_0x3920ac){_0xa31cbb=_0xa31cbb-0x0;var _0xa34c42=_0x155b[_0xa31cbb];return _0xa34c42;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0xb155('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xb155('0x1')),'smsInteraction':require(_0xb155('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xb155('0x3'))};exports[_0xb155('0x4')]=function(_0x5051aa,_0x52cfd5,_0x1831eb,_0x44a36a){return function(_0x4bae8d){try{logger[_0xb155('0x5')](_0xb155('0x6'),_0x5051aa,_0x52cfd5[0x0]);var _0x706972={'closed':0x1,'closedAt':moment()['format'](_0xb155('0x7')),'closeReason':_0xb155('0x8'),'disposition':_0x52cfd5[0x0]};if(rpc[_0x44a36a[_0xb155('0x9')]+'Interaction']){rpc[_0x44a36a[_0xb155('0x9')]+'Interaction'][_0xb155('0xa')](_0x44a36a[_0xb155('0xb')]['id'],_0x706972)['then'](function(_0x5d9834){logger[_0xb155('0x5')](_0xb155('0xc'),_0x5051aa,_0x44a36a[_0xb155('0xb')]['id']);})[_0xb155('0xd')](function(_0x49307c){logger[_0xb155('0xe')]('[%s][CLOSE]\x20%s',_0x5051aa,JSON[_0xb155('0xf')](_0x49307c));})[_0xb155('0x10')](function(){_0x4bae8d[_0xb155('0x11')]();});}}catch(_0x1a594a){logger[_0xb155('0xe')](_0xb155('0x12'),_0x5051aa,JSON[_0xb155('0xf')](_0x1a594a));_0x4bae8d[_0xb155('0x11')]();}};}; \ No newline at end of file +var _0x25e6=['../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stop','stringify','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x445038,_0x1b9b46){var _0x36def1=function(_0x3dac29){while(--_0x3dac29){_0x445038['push'](_0x445038['shift']());}};_0x36def1(++_0x1b9b46);}(_0x25e6,0x172));var _0x625e=function(_0xc86b25,_0x1065a4){_0xc86b25=_0xc86b25-0x0;var _0x8a0537=_0x25e6[_0xc86b25];return _0x8a0537;};'use strict';var moment=require(_0x625e('0x0'));var logger=require(_0x625e('0x1'))('routing');var rpc={'chatInteraction':require(_0x625e('0x2')),'openchannelInteraction':require(_0x625e('0x3')),'smsInteraction':require(_0x625e('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x625e('0x5')),'whatsappInteraction':require(_0x625e('0x6'))};exports['consequence']=function(_0x4bcedf,_0x20007b,_0x230d82,_0xa221c8){return function(_0x5c9b23){try{logger[_0x625e('0x7')](_0x625e('0x8'),_0x4bcedf,_0x20007b[0x0]);var _0x1a6c20={'closed':0x1,'closedAt':moment()[_0x625e('0x9')](_0x625e('0xa')),'closeReason':'system','disposition':_0x20007b[0x0]};if(rpc[_0xa221c8[_0x625e('0xb')]+_0x625e('0xc')]){rpc[_0xa221c8[_0x625e('0xb')]+_0x625e('0xc')]['update'](_0xa221c8[_0x625e('0xd')]['id'],_0x1a6c20)[_0x625e('0xe')](function(_0x4c92fe){logger[_0x625e('0x7')](_0x625e('0xf'),_0x4bcedf,_0xa221c8[_0x625e('0xd')]['id']);})[_0x625e('0x10')](function(_0x37acd6){logger[_0x625e('0x11')](_0x625e('0x12'),_0x4bcedf,JSON['stringify'](_0x37acd6));})[_0x625e('0x13')](function(){_0x5c9b23[_0x625e('0x14')]();});}}catch(_0x42bfbe){logger[_0x625e('0x11')](_0x625e('0x12'),_0x4bcedf,JSON[_0x625e('0x15')](_0x42bfbe));_0x5c9b23[_0x625e('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 751f4e9..6f2f3d9 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 _0x96f1=['consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','next','contact','sms','channel','whatsapp','phone','ChatWebsiteId','upperFirst','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','info','catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','dialogflow','result','fulfillment','speech','providerName','create','metadata','error','message','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x298097,_0x1efede){var _0x4daf48=function(_0x4a014f){while(--_0x4a014f){_0x298097['push'](_0x298097['shift']());}};_0x4daf48(++_0x1efede);}(_0x96f1,0x19c));var _0x196f=function(_0x5a641f,_0x112a0e){_0x5a641f=_0x5a641f-0x0;var _0x5c779f=_0x96f1[_0x5a641f];return _0x5c779f;};'use strict';var _=require(_0x196f('0x0'));var moment=require(_0x196f('0x1'));var apiai=require(_0x196f('0x2'));var md5=require(_0x196f('0x3'));var utils=require(_0x196f('0x4'));var logger=require(_0x196f('0x5'))(_0x196f('0x6'));var rpc={'chatMessage':require(_0x196f('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x196f('0x8')),'faxMessage':require(_0x196f('0x9')),'whatsappMessage':require(_0x196f('0xa'))};exports[_0x196f('0xb')]=function(_0x17f603,_0x59bc2e){return function(_0x427333){try{if(!_[_0x196f('0xc')](this[_0x196f('0xd')][_0x196f('0xe')])){logger['info'](_0x196f('0xf'),_0x17f603,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x427333[_0x196f('0x10')]();}var _0x52fe33={'ContactId':this[_0x196f('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0x196f('0x12')||this[_0x196f('0x13')]===_0x196f('0x14')){_0x52fe33[_0x196f('0x15')]=this[_0x196f('0xd')][_0x196f('0x15')];}var _0x5f02a9=this[_0x196f('0x13')];if(_0x5f02a9==='chat'){_0x52fe33[_0x196f('0x16')]=this['account']['id'];}else{_0x52fe33[_[_0x196f('0x17')](_0x5f02a9)+'AccountId']=this[_0x196f('0x18')]['id'];}_0x52fe33[_[_0x196f('0x17')](_0x5f02a9)+_0x196f('0x19')]=this[_0x196f('0xd')]['id'];if(this[_0x196f('0xd')][_0x196f('0x1a')]){var _0x565db7=_0x59bc2e[0x2];if(!_[_0x196f('0x1b')](_0x565db7)){_0x52fe33[_0x196f('0x1c')]=utils[_0x196f('0x1d')](_0x565db7,this);return rpc[_0x5f02a9+_0x196f('0x1e')]['create'](_0x52fe33)[_0x196f('0x1f')](function(_0x2b2f56){logger[_0x196f('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x17f603,_0x52fe33[_0x196f('0x1c')]);})[_0x196f('0x21')](function(_0x592a46){logger['error'](_0x196f('0xf'),_0x17f603,JSON[_0x196f('0x22')](_0x592a46));})[_0x196f('0x23')](function(){logger[_0x196f('0x20')](_0x196f('0x24'),_0x17f603);_0x427333[_0x196f('0x25')]();});}else{logger[_0x196f('0x20')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x17f603);_0x427333[_0x196f('0x25')]();}}else{var _0x3d6e33=this;var _0x31bf42=apiai(_0x59bc2e[0x0],{'language':_0x59bc2e[0x1]||'en'});return _0x31bf42['textRequest'](this['message'][_0x196f('0x1c')],{'sessionId':md5(this[_0x196f('0xd')]['id'])})[_0x196f('0x1f')](function(_0x18b220){_0x3d6e33['body'][_0x196f('0x26')]=_0x18b220;_0x52fe33[_0x196f('0x1c')]=_0x18b220[_0x196f('0x27')][_0x196f('0x28')][_0x196f('0x29')];_0x52fe33[_0x196f('0x2a')]='dialogflow';_0x52fe33['providerResponse']=JSON[_0x196f('0x22')](_0x18b220);return rpc[_0x5f02a9+_0x196f('0x1e')][_0x196f('0x2b')](_0x52fe33)[_0x196f('0x1f')](function(_0x53fabc){logger[_0x196f('0x20')](_0x196f('0xf'),_0x17f603,_0x52fe33[_0x196f('0x1c')]);if(_0x18b220[_0x196f('0x27')][_0x196f('0x2c')]['endConversation']){_0x427333[_0x196f('0x10')]();}else{_0x427333[_0x196f('0x25')]();}})['catch'](function(_0x179e4c){logger['error'](_0x196f('0xf'),_0x17f603,JSON['stringify'](_0x179e4c));_0x427333[_0x196f('0x10')]();});})[_0x196f('0x21')](function(_0x2b8527){logger[_0x196f('0x2d')]('[%s][DIALOGFLOW]\x20%s',_0x17f603,_0x2b8527[_0x196f('0x2e')]);_0x427333[_0x196f('0x10')]();});}}catch(_0x430b28){logger[_0x196f('0x2d')](_0x196f('0xf'),_0x17f603,JSON[_0x196f('0x22')](_0x430b28));_0x427333['stop']();}};}; \ No newline at end of file +var _0xf435=['interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','channel','sms','whatsapp','phone','chat','account','AccountId','upperFirst','InteractionId','created','body','getMustacheRender','Message','create','then','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','providerName','metadata','endConversation','catch','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xf435,0x174));var _0x5f43=function(_0x5b12a1,_0x208f85){_0x5b12a1=_0x5b12a1-0x0;var _0x366947=_0xf435[_0x5b12a1];return _0x366947;};'use strict';var _=require('lodash');var moment=require(_0x5f43('0x0'));var apiai=require(_0x5f43('0x1'));var md5=require(_0x5f43('0x2'));var utils=require(_0x5f43('0x3'));var logger=require(_0x5f43('0x4'))('routing');var rpc={'chatMessage':require(_0x5f43('0x5')),'openchannelMessage':require(_0x5f43('0x6')),'mailMessage':require(_0x5f43('0x7')),'smsMessage':require(_0x5f43('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5f43('0x9'))};exports[_0x5f43('0xa')]=function(_0x39adbd,_0x4d88d8){return function(_0x2f4620){try{if(!_[_0x5f43('0xb')](this[_0x5f43('0xc')][_0x5f43('0xd')])){logger[_0x5f43('0xe')](_0x5f43('0xf'),_0x39adbd,_0x5f43('0x10'));return _0x2f4620[_0x5f43('0x11')]();}var _0x35d958={'ContactId':this[_0x5f43('0x12')]['id'],'sentAt':moment()[_0x5f43('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x5f43('0x14')]===_0x5f43('0x15')||this[_0x5f43('0x14')]===_0x5f43('0x16')){_0x35d958[_0x5f43('0x17')]=this[_0x5f43('0xc')][_0x5f43('0x17')];}var _0x14e63e=this['channel'];if(_0x14e63e===_0x5f43('0x18')){_0x35d958['ChatWebsiteId']=this[_0x5f43('0x19')]['id'];}else{_0x35d958[_['upperFirst'](_0x14e63e)+_0x5f43('0x1a')]=this[_0x5f43('0x19')]['id'];}_0x35d958[_[_0x5f43('0x1b')](_0x14e63e)+_0x5f43('0x1c')]=this['interaction']['id'];if(this[_0x5f43('0xc')][_0x5f43('0x1d')]){var _0x78725f=_0x4d88d8[0x2];if(!_['isEmpty'](_0x78725f)){_0x35d958[_0x5f43('0x1e')]=utils[_0x5f43('0x1f')](_0x78725f,this);return rpc[_0x14e63e+_0x5f43('0x20')][_0x5f43('0x21')](_0x35d958)[_0x5f43('0x22')](function(_0x2a5c6c){logger['info'](_0x5f43('0xf'),_0x39adbd,_0x35d958[_0x5f43('0x1e')]);})['catch'](function(_0x73e4dc){logger[_0x5f43('0x23')](_0x5f43('0xf'),_0x39adbd,JSON[_0x5f43('0x24')](_0x73e4dc));})[_0x5f43('0x25')](function(){logger[_0x5f43('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x39adbd);_0x2f4620[_0x5f43('0x26')]();});}else{logger['info'](_0x5f43('0x27'),_0x39adbd);_0x2f4620['stop']();}}else{var _0x49621e=this;var _0x4d7dc7=apiai(_0x4d88d8[0x0],{'language':_0x4d88d8[0x1]||'en'});return _0x4d7dc7[_0x5f43('0x28')](this[_0x5f43('0x29')][_0x5f43('0x1e')],{'sessionId':md5(this[_0x5f43('0xc')]['id'])})[_0x5f43('0x22')](function(_0x1e133f){_0x49621e[_0x5f43('0x1e')][_0x5f43('0x2a')]=_0x1e133f;_0x35d958[_0x5f43('0x1e')]=_0x1e133f[_0x5f43('0x2b')]['fulfillment']['speech'];_0x35d958[_0x5f43('0x2c')]=_0x5f43('0x2a');_0x35d958['providerResponse']=JSON[_0x5f43('0x24')](_0x1e133f);return rpc[_0x14e63e+_0x5f43('0x20')][_0x5f43('0x21')](_0x35d958)[_0x5f43('0x22')](function(_0x25cd68){logger[_0x5f43('0xe')](_0x5f43('0xf'),_0x39adbd,_0x35d958[_0x5f43('0x1e')]);if(_0x1e133f[_0x5f43('0x2b')][_0x5f43('0x2d')][_0x5f43('0x2e')]){_0x2f4620['next']();}else{_0x2f4620[_0x5f43('0x26')]();}})[_0x5f43('0x2f')](function(_0x2d8363){logger[_0x5f43('0x23')](_0x5f43('0xf'),_0x39adbd,JSON[_0x5f43('0x24')](_0x2d8363));_0x2f4620[_0x5f43('0x11')]();});})[_0x5f43('0x2f')](function(_0x7a1423){logger[_0x5f43('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x39adbd,_0x7a1423[_0x5f43('0x29')]);_0x2f4620['next']();});}}catch(_0x3f0a6c){logger[_0x5f43('0x23')](_0x5f43('0xf'),_0x39adbd,JSON[_0x5f43('0x24')](_0x3f0a6c));_0x2f4620['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index a7f99cb..f17601c 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 _0x4b47=['format','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','isEmpty','getMustacheRender','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','then','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','length','fulfillmentText','push','all','error','message','lodash','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/mailMessage','../../rpc/smsMessage','body','Message','[%s][DIALOGFLOWV2]\x20%s','catch','consequence','isNil','interaction','info','next','contact'];(function(_0x4da3b6,_0x233aff){var _0x574d38=function(_0x4fa45b){while(--_0x4fa45b){_0x4da3b6['push'](_0x4da3b6['shift']());}};_0x574d38(++_0x233aff);}(_0x4b47,0x1b4));var _0x74b4=function(_0x150113,_0xb3372){_0x150113=_0x150113-0x0;var _0x5caf53=_0x4b47[_0x150113];return _0x5caf53;};'use strict';var _=require(_0x74b4('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x74b4('0x1'));var moment=require(_0x74b4('0x2'));var Promise=require(_0x74b4('0x3'));var logger=require(_0x74b4('0x4'))(_0x74b4('0x5'));var utils=require(_0x74b4('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x74b4('0x7')),'smsMessage':require(_0x74b4('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x482278,_0x43b434,_0x75ea22,_0x1ebbb8){return new Promise(function(_0x318a0a,_0x239853){var _0x58807b=_['clone'](_0x75ea22);_0x58807b[_0x74b4('0x9')]=_0x1ebbb8;return rpc[_0x43b434+_0x74b4('0xa')]['create'](_0x58807b)['then'](function(){logger['info'](_0x74b4('0xb'),_0x482278,_0x58807b[_0x74b4('0x9')]);_0x318a0a();})[_0x74b4('0xc')](function(_0x400d6f){logger['error'](_0x74b4('0xb'),_0x482278,JSON['stringify'](_0x400d6f));_0x239853(_0x400d6f);});});}exports[_0x74b4('0xd')]=function(_0x50bda5,_0x1d1e36){return function(_0x2b8beb){try{if(!_[_0x74b4('0xe')](this[_0x74b4('0xf')]['UserId'])){logger[_0x74b4('0x10')](_0x74b4('0xb'),_0x50bda5,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2b8beb[_0x74b4('0x11')]();}var _0x3b30cc={'ContactId':this[_0x74b4('0x12')]['id'],'sentAt':moment()[_0x74b4('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x74b4('0x14')};if(this[_0x74b4('0x15')]==='sms'||this['channel']===_0x74b4('0x16')){_0x3b30cc[_0x74b4('0x17')]=this[_0x74b4('0xf')][_0x74b4('0x17')];}var _0x11c268=this[_0x74b4('0x15')];if(_0x11c268===_0x74b4('0x18')){_0x3b30cc[_0x74b4('0x19')]=this[_0x74b4('0x1a')]['id'];}else{_0x3b30cc[_[_0x74b4('0x1b')](_0x11c268)+'AccountId']=this['account']['id'];}_0x3b30cc[_[_0x74b4('0x1b')](_0x11c268)+_0x74b4('0x1c')]=this['interaction']['id'];if(this[_0x74b4('0xf')]['created']){var _0x4e93e3=_0x1d1e36[0x4];if(!_[_0x74b4('0x1d')](_0x4e93e3)){_0x3b30cc[_0x74b4('0x9')]=utils[_0x74b4('0x1e')](_0x4e93e3,this);return rpc[_0x11c268+_0x74b4('0xa')]['create'](_0x3b30cc)['then'](function(_0xb429b0){logger[_0x74b4('0x10')](_0x74b4('0xb'),_0x50bda5,_0x3b30cc[_0x74b4('0x9')]);})[_0x74b4('0xc')](function(_0x160356){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x50bda5,JSON[_0x74b4('0x1f')](_0x160356));})[_0x74b4('0x20')](function(){logger['info'](_0x74b4('0x21'),_0x50bda5);_0x2b8beb[_0x74b4('0x22')]();});}else{logger[_0x74b4('0x10')](_0x74b4('0x23'),_0x50bda5);_0x2b8beb[_0x74b4('0x22')]();}}else{var _0x4ea739=this;var _0x4fd6e5=_0x1d1e36[0x2][_0x74b4('0x24')](/\\n/g,'\x0a');var _0x39d864={'credentials':{'private_key':_0x4fd6e5,'client_email':_0x1d1e36[0x1]}};var _0x5bf0e2=new dialogflow['SessionsClient'](_0x39d864);var _0x10ffde=_0x5bf0e2[_0x74b4('0x25')](_0x1d1e36[0x0],md5(_0x4ea739['interaction']['id']));var _0x4bc97b={'session':_0x10ffde,'queryInput':{'text':{'text':_0x4ea739['message']['body'],'languageCode':_0x1d1e36[0x3]||'en'}}};return _0x5bf0e2['detectIntent'](_0x4bc97b)[_0x74b4('0x26')](function(_0x11592f){if(_0x11592f&&_0x11592f['length']){_0x4ea739[_0x74b4('0x9')][_0x74b4('0x27')]=_0x11592f;var _0xe583d2=_0x11592f[0x0];var _0x40b207=_0xe583d2[_0x74b4('0x28')]['diagnosticInfo']&&_0xe583d2[_0x74b4('0x28')][_0x74b4('0x29')]['fields']?_0xe583d2[_0x74b4('0x28')][_0x74b4('0x29')][_0x74b4('0x2a')][_0x74b4('0x2b')][_0x74b4('0x2c')]:![];_0x4ea739[_0x74b4('0x9')][_0x74b4('0x2d')]=_0xe583d2['queryResult'][_0x74b4('0x2e')];_0x4ea739[_0x74b4('0x9')][_0x74b4('0x2f')]=_0xe583d2['queryResult'][_0x74b4('0x30')];_0x4ea739[_0x74b4('0x9')][_0x74b4('0x31')]=_0xe583d2[_0x74b4('0x28')][_0x74b4('0x29')]&&_0xe583d2[_0x74b4('0x28')]['diagnosticInfo']['fields']?_0xe583d2[_0x74b4('0x28')][_0x74b4('0x29')][_0x74b4('0x2a')][_0x74b4('0x2b')][_0x74b4('0x2c')]:![];_0x4ea739[_0x74b4('0x9')]['DIALOGFLOWV2_INTENTNAME']=_0xe583d2[_0x74b4('0x28')][_0x74b4('0x32')]['name'];_0x4ea739[_0x74b4('0x9')][_0x74b4('0x33')]=_0xe583d2[_0x74b4('0x28')]['intent']['displayName'];_0x4ea739['body']['DIALOGFLOWV2_ISFALLBACKINTENT']=_0xe583d2[_0x74b4('0x28')]['intent'][_0x74b4('0x34')];_0x4ea739[_0x74b4('0x9')][_0x74b4('0x35')]=_0xe583d2[_0x74b4('0x28')]['languageCode'];_0x4ea739[_0x74b4('0x9')][_0x74b4('0x36')]=_0xe583d2[_0x74b4('0x28')][_0x74b4('0x37')];_0x4ea739[_0x74b4('0x9')][_0x74b4('0x38')]=_0xe583d2[_0x74b4('0x28')][_0x74b4('0x39')];_0x3b30cc[_0x74b4('0x3a')]='dialogflowV2';_0x3b30cc['providerResponse']=JSON[_0x74b4('0x1f')](_0x11592f);var _0x164189=[];for(var _0x767b24=0x0;_0x767b24<_0x11592f[_0x74b4('0x3b')];_0x767b24++){var _0x2bc28b=_0x11592f[_0x767b24];if(_0x2bc28b&&_0x2bc28b[_0x74b4('0x28')]&&_0x2bc28b['queryResult'][_0x74b4('0x3c')]){_0x164189[_0x74b4('0x3d')](createMessage(_0x50bda5,_0x11c268,_0x3b30cc,_0x2bc28b[_0x74b4('0x28')][_0x74b4('0x3c')]));}}return Promise[_0x74b4('0x3e')](_0x164189)[_0x74b4('0x26')](function(){if(_0x40b207){_0x2b8beb[_0x74b4('0x11')]();}else{_0x2b8beb['stop']();}})[_0x74b4('0xc')](function(_0x3d7167){logger[_0x74b4('0x3f')]('[%s][DIALOGFLOWV2]\x20%s',_0x50bda5,JSON['stringify'](_0x3d7167));_0x2b8beb[_0x74b4('0x11')]();});}})[_0x74b4('0xc')](function(_0xb22afe){logger['error'](_0x74b4('0xb'),_0x50bda5,_0xb22afe[_0x74b4('0x40')]);_0x2b8beb[_0x74b4('0x11')]();});}}catch(_0x1e740b){logger[_0x74b4('0x3f')](_0x74b4('0xb'),_0x50bda5,JSON[_0x74b4('0x1f')](_0x1e740b));_0x2b8beb[_0x74b4('0x22')]();}};}; \ No newline at end of file +var _0x21f2=['action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','displayName','isFallback','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','providerResponse','fulfillmentText','push','next','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','channel','whatsapp','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','isEmpty','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x21f2,0x158));var _0x221f=function(_0x268761,_0x49e1d2){_0x268761=_0x268761-0x0;var _0x29b136=_0x21f2[_0x268761];return _0x29b136;};'use strict';var _=require('lodash');var dialogflow=require(_0x221f('0x0'));var md5=require(_0x221f('0x1'));var moment=require(_0x221f('0x2'));var Promise=require(_0x221f('0x3'));var logger=require(_0x221f('0x4'))(_0x221f('0x5'));var utils=require(_0x221f('0x6'));var rpc={'chatMessage':require(_0x221f('0x7')),'openchannelMessage':require(_0x221f('0x8')),'mailMessage':require(_0x221f('0x9')),'smsMessage':require(_0x221f('0xa')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x221f('0xb'))};function createMessage(_0xc069ff,_0x182a72,_0x28768d,_0x116c6c){return new Promise(function(_0x4a27d0,_0x747f9d){var _0xb9a576=_[_0x221f('0xc')](_0x28768d);_0xb9a576[_0x221f('0xd')]=_0x116c6c;return rpc[_0x182a72+_0x221f('0xe')][_0x221f('0xf')](_0xb9a576)[_0x221f('0x10')](function(){logger[_0x221f('0x11')](_0x221f('0x12'),_0xc069ff,_0xb9a576[_0x221f('0xd')]);_0x4a27d0();})[_0x221f('0x13')](function(_0x445f6e){logger[_0x221f('0x14')](_0x221f('0x12'),_0xc069ff,JSON[_0x221f('0x15')](_0x445f6e));_0x747f9d(_0x445f6e);});});}exports[_0x221f('0x16')]=function(_0x2e861b,_0x7fd394){return function(_0x238089){try{if(!_[_0x221f('0x17')](this[_0x221f('0x18')][_0x221f('0x19')])){logger[_0x221f('0x11')](_0x221f('0x12'),_0x2e861b,_0x221f('0x1a'));return _0x238089['next']();}var _0xc21672={'ContactId':this[_0x221f('0x1b')]['id'],'sentAt':moment()[_0x221f('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x221f('0x1d')]==='sms'||this[_0x221f('0x1d')]===_0x221f('0x1e')){_0xc21672['phone']=this[_0x221f('0x18')]['phone'];}var _0xe5a7f=this['channel'];if(_0xe5a7f===_0x221f('0x1f')){_0xc21672[_0x221f('0x20')]=this['account']['id'];}else{_0xc21672[_[_0x221f('0x21')](_0xe5a7f)+_0x221f('0x22')]=this['account']['id'];}_0xc21672[_['upperFirst'](_0xe5a7f)+_0x221f('0x23')]=this[_0x221f('0x18')]['id'];if(this[_0x221f('0x18')]['created']){var _0x21e2c4=_0x7fd394[0x4];if(!_[_0x221f('0x24')](_0x21e2c4)){_0xc21672[_0x221f('0xd')]=utils['getMustacheRender'](_0x21e2c4,this);return rpc[_0xe5a7f+'Message']['create'](_0xc21672)[_0x221f('0x10')](function(_0x559747){logger['info'](_0x221f('0x12'),_0x2e861b,_0xc21672[_0x221f('0xd')]);})['catch'](function(_0x17512a){logger[_0x221f('0x14')](_0x221f('0x12'),_0x2e861b,JSON[_0x221f('0x15')](_0x17512a));})['finally'](function(){logger[_0x221f('0x11')](_0x221f('0x25'),_0x2e861b);_0x238089[_0x221f('0x26')]();});}else{logger[_0x221f('0x11')](_0x221f('0x27'),_0x2e861b);_0x238089[_0x221f('0x26')]();}}else{var _0x246f31=this;var _0x26eb71=_0x7fd394[0x2][_0x221f('0x28')](/\\n/g,'\x0a');var _0x52423e={'credentials':{'private_key':_0x26eb71,'client_email':_0x7fd394[0x1]}};var _0x13f07a=new dialogflow[(_0x221f('0x29'))](_0x52423e);var _0x1c15e8=_0x13f07a['sessionPath'](_0x7fd394[0x0],md5(_0x246f31[_0x221f('0x18')]['id']));var _0x301e95={'session':_0x1c15e8,'queryInput':{'text':{'text':_0x246f31[_0x221f('0x2a')][_0x221f('0xd')],'languageCode':_0x7fd394[0x3]||'en'}}};return _0x13f07a[_0x221f('0x2b')](_0x301e95)[_0x221f('0x10')](function(_0x4c69bc){if(_0x4c69bc&&_0x4c69bc[_0x221f('0x2c')]){_0x246f31[_0x221f('0xd')][_0x221f('0x2d')]=_0x4c69bc;var _0x5865f0=_0x4c69bc[0x0];var _0x4657fc=_0x5865f0[_0x221f('0x2e')]['diagnosticInfo']&&_0x5865f0['queryResult'][_0x221f('0x2f')]['fields']?_0x5865f0[_0x221f('0x2e')][_0x221f('0x2f')][_0x221f('0x30')][_0x221f('0x31')][_0x221f('0x32')]:![];_0x246f31['body'][_0x221f('0x33')]=_0x5865f0[_0x221f('0x2e')][_0x221f('0x34')];_0x246f31[_0x221f('0xd')][_0x221f('0x35')]=_0x5865f0[_0x221f('0x2e')][_0x221f('0x36')];_0x246f31[_0x221f('0xd')][_0x221f('0x37')]=_0x5865f0[_0x221f('0x2e')][_0x221f('0x2f')]&&_0x5865f0[_0x221f('0x2e')]['diagnosticInfo'][_0x221f('0x30')]?_0x5865f0['queryResult']['diagnosticInfo'][_0x221f('0x30')][_0x221f('0x31')][_0x221f('0x32')]:![];_0x246f31['body'][_0x221f('0x38')]=_0x5865f0[_0x221f('0x2e')][_0x221f('0x39')]['name'];_0x246f31['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x5865f0[_0x221f('0x2e')][_0x221f('0x39')][_0x221f('0x3a')];_0x246f31[_0x221f('0xd')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x5865f0[_0x221f('0x2e')][_0x221f('0x39')][_0x221f('0x3b')];_0x246f31['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x5865f0['queryResult']['languageCode'];_0x246f31[_0x221f('0xd')][_0x221f('0x3c')]=_0x5865f0['queryResult']['queryText'];_0x246f31[_0x221f('0xd')][_0x221f('0x3d')]=_0x5865f0[_0x221f('0x2e')]['intentDetectionConfidence'];_0xc21672['providerName']=_0x221f('0x2d');_0xc21672[_0x221f('0x3e')]=JSON[_0x221f('0x15')](_0x4c69bc);var _0x50618a=[];for(var _0x4a63cc=0x0;_0x4a63cc<_0x4c69bc[_0x221f('0x2c')];_0x4a63cc++){var _0x4769cf=_0x4c69bc[_0x4a63cc];if(_0x4769cf&&_0x4769cf['queryResult']&&_0x4769cf[_0x221f('0x2e')][_0x221f('0x3f')]){_0x50618a[_0x221f('0x40')](createMessage(_0x2e861b,_0xe5a7f,_0xc21672,_0x4769cf[_0x221f('0x2e')][_0x221f('0x3f')]));}}return Promise['all'](_0x50618a)[_0x221f('0x10')](function(){if(_0x4657fc){_0x238089['next']();}else{_0x238089[_0x221f('0x26')]();}})[_0x221f('0x13')](function(_0x43cf0d){logger[_0x221f('0x14')]('[%s][DIALOGFLOWV2]\x20%s',_0x2e861b,JSON['stringify'](_0x43cf0d));_0x238089['next']();});}})[_0x221f('0x13')](function(_0x4847f9){logger[_0x221f('0x14')](_0x221f('0x12'),_0x2e861b,_0x4847f9[_0x221f('0x2a')]);_0x238089[_0x221f('0x41')]();});}}catch(_0x58c6ce){logger[_0x221f('0x14')](_0x221f('0x12'),_0x2e861b,JSON[_0x221f('0x15')](_0x58c6ce));_0x238089[_0x221f('0x26')]();}};}; \ 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 1b17b27..9c32d5d 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 _0x76d6=['condition','priorityTrue','priorityFalse','info','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x76d6,0x149));var _0x676d=function(_0x4edb7c,_0x340346){_0x4edb7c=_0x4edb7c-0x0;var _0x2786be=_0x76d6[_0x4edb7c];return _0x2786be;};'use strict';var schema=require(_0x676d('0x0'));var _=require(_0x676d('0x1'));var htmlToText=require(_0x676d('0x2'));var utils=require(_0x676d('0x3'));var logger=require(_0x676d('0x4'))(_0x676d('0x5'));var gotoif=schema({'condition':{'type':_0x676d('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x676d('0x7'),'message':_0x676d('0x8')},'priorityFalse':{'type':_0x676d('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x676d('0x9')]=function(_0xbc3383,_0x2f836f){return function(_0x288770){try{var _0x925541={'condition':htmlToText['fromString'](utils[_0x676d('0xa')](_0x2f836f[0x0],this),{'wordwrap':![]})[_0x676d('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2f836f[0x1],'priorityFalse':_0x2f836f[0x2]};var _0x2962a2=gotoif['validate'](_0x925541,{'typecast':!![]});if(_0x2962a2[_0x676d('0xc')]){logger[_0x676d('0xd')](_0x676d('0xe'),_0xbc3383,_[_0x676d('0xf')](_0x2962a2,_0x676d('0x10'))[_0x676d('0x11')](',\x20'));_0x288770[_0x676d('0x12')]();}else{try{var _0x45d203=eval('('+_0x925541[_0x676d('0x13')]+')');var _0x57e868=_0x45d203?_0x925541[_0x676d('0x14')]:_0x925541[_0x676d('0x15')];logger[_0x676d('0x16')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0xbc3383,_0x925541[_0x676d('0x13')],_0x45d203,_0x57e868||'next');if(_0x57e868){var _0x37f56d=_[_0x676d('0x17')](_0x288770[_0x676d('0x18')](),{'p':_0x57e868});if(_0x37f56d>=0x0){logger[_0x676d('0x16')](_0x676d('0x19'),_0xbc3383,_0x57e868||'next',_0x37f56d);_0x288770['next'](_0x37f56d);}else{logger['info'](_0x676d('0x1a'),_0xbc3383,_0x57e868||_0x676d('0x1b'));_0x288770[_0x676d('0x12')]();}}else{_0x288770[_0x676d('0x1b')]();}}catch(_0x35a920){logger['error'](_0x676d('0x1c'),_0xbc3383,_0x35a920[_0x676d('0x10')]);_0x288770[_0x676d('0x12')]();}}}catch(_0x14bd08){logger[_0x676d('0xd')](_0x676d('0xe'),_0xbc3383,JSON['stringify'](_0x14bd08));_0x288770[_0x676d('0x12')]();}};}; \ No newline at end of file +var _0xb44a=['stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join'];(function(_0x581543,_0x5d08cf){var _0x2845f5=function(_0x59aec4){while(--_0x59aec4){_0x581543['push'](_0x581543['shift']());}};_0x2845f5(++_0x5d08cf);}(_0xb44a,0x123));var _0xab44=function(_0x5a6cef,_0x1697df){_0x5a6cef=_0x5a6cef-0x0;var _0x37f76f=_0xb44a[_0x5a6cef];return _0x37f76f;};'use strict';var schema=require(_0xab44('0x0'));var _=require(_0xab44('0x1'));var htmlToText=require(_0xab44('0x2'));var utils=require('./utils');var logger=require(_0xab44('0x3'))(_0xab44('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xab44('0x5')},'priorityTrue':{'type':_0xab44('0x6'),'message':_0xab44('0x7')},'priorityFalse':{'type':_0xab44('0x6'),'message':_0xab44('0x8')}});exports[_0xab44('0x9')]=function(_0x47050b,_0x667b45){return function(_0x3dded8){try{var _0xff3b34={'condition':htmlToText[_0xab44('0xa')](utils[_0xab44('0xb')](_0x667b45[0x0],this),{'wordwrap':![]})[_0xab44('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x667b45[0x1],'priorityFalse':_0x667b45[0x2]};var _0x1a29f7=gotoif[_0xab44('0x0')](_0xff3b34,{'typecast':!![]});if(_0x1a29f7[_0xab44('0xd')]){logger[_0xab44('0xe')](_0xab44('0xf'),_0x47050b,_[_0xab44('0x10')](_0x1a29f7,_0xab44('0x11'))[_0xab44('0x12')](',\x20'));_0x3dded8[_0xab44('0x13')]();}else{try{var _0x32dc98=eval('('+_0xff3b34[_0xab44('0x14')]+')');var _0x52d2eb=_0x32dc98?_0xff3b34[_0xab44('0x15')]:_0xff3b34[_0xab44('0x16')];logger['info'](_0xab44('0x17'),_0x47050b,_0xff3b34['condition'],_0x32dc98,_0x52d2eb||_0xab44('0x18'));if(_0x52d2eb){var _0x140af5=_[_0xab44('0x19')](_0x3dded8[_0xab44('0x1a')](),{'p':_0x52d2eb});if(_0x140af5>=0x0){logger[_0xab44('0x1b')](_0xab44('0x1c'),_0x47050b,_0x52d2eb||'next',_0x140af5);_0x3dded8[_0xab44('0x18')](_0x140af5);}else{logger['info'](_0xab44('0x1d'),_0x47050b,_0x52d2eb||_0xab44('0x18'));_0x3dded8[_0xab44('0x13')]();}}else{_0x3dded8[_0xab44('0x18')]();}}catch(_0x6bffb0){logger[_0xab44('0xe')](_0xab44('0x1e'),_0x47050b,_0x6bffb0['message']);_0x3dded8[_0xab44('0x13')]();}}}catch(_0x4bae7e){logger['error'](_0xab44('0xf'),_0x47050b,JSON['stringify'](_0x4bae7e));_0x3dded8[_0xab44('0x13')]();}};}; \ 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 3a4a7c8..6b7dad4 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 _0x6fd4=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','../../../../config/logger','number','consequence','length','[%s][GOTOP]\x20%s','map','join','stop','info','priority','findIndex','rules'];(function(_0x21386b,_0x593e17){var _0x3d6249=function(_0x1c4728){while(--_0x1c4728){_0x21386b['push'](_0x21386b['shift']());}};_0x3d6249(++_0x593e17);}(_0x6fd4,0xae));var _0x46fd=function(_0x1460c9,_0x2edcea){_0x1460c9=_0x1460c9-0x0;var _0x2d48db=_0x6fd4[_0x1460c9];return _0x2d48db;};'use strict';var schema=require(_0x46fd('0x0'));var _=require('lodash');var logger=require(_0x46fd('0x1'))('routing');var gotop=schema({'priority':{'type':_0x46fd('0x2'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x46fd('0x3')]=function(_0x658e8d,_0x4cf9a6){return function(_0x1692b7){try{var _0x336f66={'priority':_0x4cf9a6[0x0]};var _0x341b0b=gotop['validate'](_0x336f66,{'typecast':!![]});if(_0x341b0b[_0x46fd('0x4')]){logger['error'](_0x46fd('0x5'),_0x658e8d,_[_0x46fd('0x6')](_0x341b0b,'message')[_0x46fd('0x7')](',\x20'));_0x1692b7[_0x46fd('0x8')]();}else{logger[_0x46fd('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x658e8d,_0x336f66[_0x46fd('0xa')]);if(_0x336f66[_0x46fd('0xa')]){var _0x22e6c0=_[_0x46fd('0xb')](_0x1692b7[_0x46fd('0xc')](),{'p':_0x336f66['priority']});if(_0x22e6c0>=0x0){logger[_0x46fd('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x658e8d,_0x336f66[_0x46fd('0xa')]||_0x46fd('0xd'),_0x22e6c0);_0x1692b7[_0x46fd('0xd')](_0x22e6c0);}else{logger[_0x46fd('0x9')](_0x46fd('0xe'),_0x658e8d,_0x336f66[_0x46fd('0xa')]||_0x46fd('0xd'));_0x1692b7['stop']();}}else{_0x1692b7['next']();}}}catch(_0x5b0295){logger[_0x46fd('0xf')](_0x46fd('0x5'),_0x658e8d,JSON[_0x46fd('0x10')](_0x5b0295));_0x1692b7[_0x46fd('0x8')]();}};}; \ No newline at end of file +var _0xd21f=['[%s][GOTOP]\x20priority\x20%s','priority','findIndex','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','stop','info'];(function(_0x44b17a,_0x4fed15){var _0x18ff50=function(_0x35d2d7){while(--_0x35d2d7){_0x44b17a['push'](_0x44b17a['shift']());}};_0x18ff50(++_0x4fed15);}(_0xd21f,0x1f2));var _0xfd21=function(_0x7767c3,_0x4825ac){_0x7767c3=_0x7767c3-0x0;var _0x1f22a1=_0xd21f[_0x7767c3];return _0x1f22a1;};'use strict';var schema=require(_0xfd21('0x0'));var _=require(_0xfd21('0x1'));var logger=require('../../../../config/logger')(_0xfd21('0x2'));var gotop=schema({'priority':{'type':_0xfd21('0x3'),'required':!![],'message':_0xfd21('0x4')}});exports[_0xfd21('0x5')]=function(_0x2805b6,_0x26fc79){return function(_0x59127c){try{var _0xe12aec={'priority':_0x26fc79[0x0]};var _0x350f12=gotop[_0xfd21('0x0')](_0xe12aec,{'typecast':!![]});if(_0x350f12[_0xfd21('0x6')]){logger[_0xfd21('0x7')](_0xfd21('0x8'),_0x2805b6,_[_0xfd21('0x9')](_0x350f12,'message')['join'](',\x20'));_0x59127c[_0xfd21('0xa')]();}else{logger[_0xfd21('0xb')](_0xfd21('0xc'),_0x2805b6,_0xe12aec[_0xfd21('0xd')]);if(_0xe12aec['priority']){var _0x5a98a4=_[_0xfd21('0xe')](_0x59127c['rules'](),{'p':_0xe12aec['priority']});if(_0x5a98a4>=0x0){logger[_0xfd21('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2805b6,_0xe12aec['priority']||_0xfd21('0xf'),_0x5a98a4);_0x59127c[_0xfd21('0xf')](_0x5a98a4);}else{logger[_0xfd21('0xb')](_0xfd21('0x10'),_0x2805b6,_0xe12aec[_0xfd21('0xd')]||_0xfd21('0xf'));_0x59127c['stop']();}}else{_0x59127c[_0xfd21('0xf')]();}}}catch(_0x3d0a94){logger['error']('[%s][GOTOP]\x20%s',_0x2805b6,JSON['stringify'](_0x3d0a94));_0x59127c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 230dd87..90e316e 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 _0x081e=['account','channel','AccountId','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','stringify','stop','lodash','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','chat'];(function(_0xb6cc54,_0x2e9857){var _0xee8dd1=function(_0x5e3315){while(--_0x5e3315){_0xb6cc54['push'](_0xb6cc54['shift']());}};_0xee8dd1(++_0x2e9857);}(_0x081e,0xc5));var _0xe081=function(_0x16c1a5,_0x17dfb0){_0x16c1a5=_0x16c1a5-0x0;var _0x421b5e=_0x081e[_0x16c1a5];return _0x421b5e;};'use strict';var _=require(_0xe081('0x0'));var utils=require(_0xe081('0x1'));var logger=require('../../../../config/logger')(_0xe081('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe081('0x3')),'mailMessage':require(_0xe081('0x4')),'smsMessage':require(_0xe081('0x5')),'faxMessage':require(_0xe081('0x6')),'whatsappMessage':require(_0xe081('0x7'))};exports[_0xe081('0x8')]=function(_0x9b415a,_0x50d6cb){return function(_0x2271b4){try{var _0x47ac69={'body':utils['getMustacheRender'](_0x50d6cb[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0xe081('0x9')){_0x47ac69['ChatWebsiteId']=this[_0xe081('0xa')]['id'];}else{_0x47ac69[_['upperFirst'](this[_0xe081('0xb')])+_0xe081('0xc')]=this[_0xe081('0xa')]['id'];}_0x47ac69[_['upperFirst'](this['channel'])+_0xe081('0xd')]=this['interaction']['id'];if(rpc[this[_0xe081('0xb')]+_0xe081('0xe')]){return rpc[this[_0xe081('0xb')]+_0xe081('0xe')][_0xe081('0xf')](_0x47ac69)[_0xe081('0x10')](function(_0x4baa60){logger[_0xe081('0x11')](_0xe081('0x12'),_0x9b415a,_0x47ac69['body']);_0x2271b4[_0xe081('0x13')]();})[_0xe081('0x14')](function(_0xe10895){logger['error'](_0xe081('0x12'),_0x9b415a,JSON['stringify'](_0xe10895));_0x2271b4['stop']();});}}catch(_0x4cadc9){logger['error'](_0xe081('0x12'),_0x9b415a,JSON[_0xe081('0x15')](_0x4cadc9));_0x2271b4[_0xe081('0x16')]();}};}; \ No newline at end of file +var _0x129f=['info','body','next','[%s][MESSAGE]\x20%s','stringify','error','stop','lodash','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','chat','account','upperFirst','channel','AccountId','InteractionId','interaction','Message','then'];(function(_0x517ad8,_0xbeacf0){var _0x1b978c=function(_0x371981){while(--_0x371981){_0x517ad8['push'](_0x517ad8['shift']());}};_0x1b978c(++_0xbeacf0);}(_0x129f,0x13f));var _0xf129=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x129f[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xf129('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xf129('0x1'));var rpc={'chatMessage':require(_0xf129('0x2')),'openchannelMessage':require(_0xf129('0x3')),'mailMessage':require(_0xf129('0x4')),'smsMessage':require(_0xf129('0x5')),'faxMessage':require(_0xf129('0x6')),'whatsappMessage':require(_0xf129('0x7'))};exports[_0xf129('0x8')]=function(_0x5f535d,_0x441b9c){return function(_0x1f31ff){try{var _0x1d999a={'body':utils[_0xf129('0x9')](_0x441b9c[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0xf129('0xa')){_0x1d999a['ChatWebsiteId']=this[_0xf129('0xb')]['id'];}else{_0x1d999a[_[_0xf129('0xc')](this[_0xf129('0xd')])+_0xf129('0xe')]=this[_0xf129('0xb')]['id'];}_0x1d999a[_['upperFirst'](this[_0xf129('0xd')])+_0xf129('0xf')]=this[_0xf129('0x10')]['id'];if(rpc[this['channel']+_0xf129('0x11')]){return rpc[this[_0xf129('0xd')]+_0xf129('0x11')]['create'](_0x1d999a)[_0xf129('0x12')](function(_0x216dbc){logger[_0xf129('0x13')]('[%s][MESSAGE]\x20%s',_0x5f535d,_0x1d999a[_0xf129('0x14')]);_0x1f31ff[_0xf129('0x15')]();})['catch'](function(_0x2f2807){logger['error'](_0xf129('0x16'),_0x5f535d,JSON[_0xf129('0x17')](_0x2f2807));_0x1f31ff['stop']();});}}catch(_0x5299e8){logger[_0xf129('0x18')](_0xf129('0x16'),_0x5f535d,JSON['stringify'](_0x5299e8));_0x1f31ff[_0xf129('0x19')]();}};}; \ 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 7c5c651..2361956 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 _0x8edf=['info','[%s][NOOP]\x20%s','next','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x4074d5,_0xa57194){var _0x502cfe=function(_0x345efa){while(--_0x345efa){_0x4074d5['push'](_0x4074d5['shift']());}};_0x502cfe(++_0xa57194);}(_0x8edf,0x1d5));var _0xf8ed=function(_0x434368,_0x35a3cd){_0x434368=_0x434368-0x0;var _0x373a31=_0x8edf[_0x434368];return _0x373a31;};'use strict';var utils=require(_0xf8ed('0x0'));var logger=require(_0xf8ed('0x1'))(_0xf8ed('0x2'));exports['consequence']=function(_0x253f3f,_0x568285){return function(_0x143a1f){try{logger[_0xf8ed('0x3')](_0xf8ed('0x4'),_0x253f3f,utils['getMustacheRender'](_0x568285[0x0],this));_0x143a1f[_0xf8ed('0x5')]();}catch(_0xad1de7){logger['error'](_0xf8ed('0x4'),_0x253f3f,JSON[_0xf8ed('0x6')](_0xad1de7));_0x143a1f[_0xf8ed('0x7')]();}};}; \ No newline at end of file +var _0x2292=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','next','error','stringify','stop'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2292,0x104));var _0x2229=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x2292[_0x166742];return _0xb7814a;};'use strict';var utils=require(_0x2229('0x0'));var logger=require(_0x2229('0x1'))(_0x2229('0x2'));exports[_0x2229('0x3')]=function(_0x16db94,_0x3d1689){return function(_0x44fff8){try{logger[_0x2229('0x4')](_0x2229('0x5'),_0x16db94,utils['getMustacheRender'](_0x3d1689[0x0],this));_0x44fff8[_0x2229('0x6')]();}catch(_0x7425c3){logger[_0x2229('0x7')](_0x2229('0x5'),_0x16db94,JSON[_0x2229('0x8')](_0x7425c3));_0x44fff8[_0x2229('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 f445e55..603373b 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 _0x761b=['[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','map','join','stop','find','Queues','timeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','log','[%s][QUEUE]\x20%s','ioredis','../../../../config/logger','routing','defaults','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','clone','account','%sQueuesWaitingInteractions','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','pick','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','InteractionId','interaction','message','AccountId','info','name','QueueReport','catch','waiting'];(function(_0x388203,_0x56321e){var _0x2c470b=function(_0x14c3fe){while(--_0x14c3fe){_0x388203['push'](_0x388203['shift']());}};_0x2c470b(++_0x56321e);}(_0x761b,0x17a));var _0xb761=function(_0x316ad3,_0x24e897){_0x316ad3=_0x316ad3-0x0;var _0x1d81e0=_0x761b[_0x316ad3];return _0x1d81e0;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xb761('0x0'));var config=require('../../../../config/environment');var logger=require(_0xb761('0x1'))(_0xb761('0x2'));var strategy=require('./strategy');config['redis']=_[_0xb761('0x3')](config[_0xb761('0x4')],{'host':_0xb761('0x5'),'port':0x18eb});var io=require(_0xb761('0x6'))(new Redis(config['redis']));var attributes=['id',_0xb761('0x7'),'account',_0xb761('0x8'),_0xb761('0x9'),_0xb761('0xa')];function emit(_0x3008e9,_0x42c141,_0x4e5919){io['to'](_0x3008e9)['emit'](_0x42c141,_0x4e5919);}function emitChannelQueueInteraction(_0x752ae5,_0x1c0729,_0x324675,_0x1528ec,_0x22f1e9,_0x36406d,_0x5abddf,_0x3f2336){var _0x5ca1d9=_[_0xb761('0xb')](_0x324675);_0x5ca1d9['queue_id']=_0x3f2336;_0x5ca1d9[_0xb761('0x8')]=_0x1c0729;_0x5ca1d9[_0xb761('0xc')]=_0x1528ec;_0x5ca1d9['id']=_0x22f1e9;if(_0x36406d){_0x5abddf[util['format'](_0xb761('0xd'),_0x752ae5)][_0x22f1e9]=_['pick'](_0x5ca1d9,attributes);}else{delete _0x5abddf[util[_0xb761('0xe')]('%sQueuesWaitingInteractions',_0x752ae5)][_0x22f1e9];}emit(util[_0xb761('0xe')](_0xb761('0xf'),_0x752ae5,_0x1c0729),util[_0xb761('0xe')](_0xb761('0x10'),_0x752ae5,_0x36406d?'save':_0xb761('0x11')),_[_0xb761('0x12')](_0x5ca1d9,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xb761('0x13')),'faxQueueReport':require(_0xb761('0x14')),'whatsappQueueReport':require(_0xb761('0x15'))};var queue=schema({'name':{'type':_0xb761('0x16'),'required':!![],'message':_0xb761('0x17')},'timeout':{'type':_0xb761('0x18'),'message':_0xb761('0x19')}});function startRouting(_0x1ff384,_0x1abd34,_0x598383,_0x3b5ac8){if(_0x1ff384&&_0x1abd34&&_0x598383){_0x1abd34['waiting']+=0x1;var _0x259606={'uniqueid':_0x1ff384,'from':_0x598383[_0xb761('0x1a')]?_0x598383[_0xb761('0x1a')]['from']:'','joinAt':moment()[_0xb761('0xe')](_0xb761('0x1b')),'ContactId':_0x598383[_0xb761('0x1c')]?_0x598383[_0xb761('0x1c')]['id']:null,'ListId':_0x598383['list']?_0x598383[_0xb761('0x1d')]['id']:null};_0x259606[_['upperFirst'](_0x598383[_0xb761('0x1e')])+_0xb761('0x1f')]=_0x1abd34['id']||null;_0x259606[_[_0xb761('0x20')](_0x598383['channel'])+_0xb761('0x21')]=_0x598383[_0xb761('0x22')]?_0x598383[_0xb761('0x22')]['id']:null;_0x259606[_[_0xb761('0x20')](_0x598383[_0xb761('0x1e')])+'MessageId']=_0x598383[_0xb761('0x23')]?_0x598383[_0xb761('0x23')]['id']:null;_0x259606[_[_0xb761('0x20')](_0x598383['channel'])+(_0x598383[_0xb761('0x1e')]!=='chat'?_0xb761('0x24'):'WebsiteId')]=_0x598383[_0xb761('0xc')]?_0x598383['account']['id']:null;logger[_0xb761('0x25')](util[_0xb761('0xe')]('[%s][START:QUEUE][NAME:%s]',_0x1ff384,_0x1abd34['name']));emitChannelQueueInteraction(_0x598383[_0xb761('0x1e')],_0x1abd34[_0xb761('0x26')],_0x259606,_0x598383[_0xb761('0xc')][_0xb761('0x26')],_0x598383[_0xb761('0x23')]['id'],!![],_0x3b5ac8,_0x1abd34['id']);if(rpc[_0x598383[_0xb761('0x1e')]+_0xb761('0x27')]){return rpc[_0x598383[_0xb761('0x1e')]+_0xb761('0x27')]['create'](_0x259606)[_0xb761('0x28')](function(_0xd9d6ed){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x5172ed,_0xc48d0,_0xa8c693,_0x1863b0){if(_0x5172ed&&_0xc48d0){_0xc48d0[_0xb761('0x29')]-=0x1;var _0x2cafbb={'leaveAt':moment()[_0xb761('0xe')](_0xb761('0x1b')),'acceptAt':moment()['format'](_0xb761('0x1b')),'reason':'accepted'};logger[_0xb761('0x25')](util[_0xb761('0xe')](_0xb761('0x2a'),_0x5172ed,_0xc48d0[_0xb761('0x26')]));emitChannelQueueInteraction(_0xa8c693['channel'],_0xc48d0[_0xb761('0x26')],_0xa8c693['body'],_0xa8c693[_0xb761('0xc')][_0xb761('0x26')],_0xa8c693[_0xb761('0x23')]['id'],![],_0x1863b0,_0xc48d0['id']);if(rpc[_0xa8c693[_0xb761('0x1e')]+_0xb761('0x27')]){return rpc[_0xa8c693[_0xb761('0x1e')]+_0xb761('0x27')][_0xb761('0x2b')](_0x5172ed,_0x2cafbb)[_0xb761('0x28')](function(_0x590086){logger[_0xb761('0x2c')](_0xb761('0x2d'));});}}}function endRouting(_0x59dec1,_0x62de9,_0x1a494b,_0x4c315e){if(_0x59dec1&&_0x62de9){_0x62de9['waiting']-=0x1;var _0x48b5d8={'leaveAt':moment()['format'](_0xb761('0x1b')),'exitAt':moment()[_0xb761('0xe')](_0xb761('0x1b')),'reason':'timeout'};logger[_0xb761('0x25')](util[_0xb761('0xe')](_0xb761('0x2e'),_0x59dec1,_0x62de9[_0xb761('0x26')]));emitChannelQueueInteraction(_0x1a494b[_0xb761('0x1e')],_0x62de9['name'],_0x1a494b[_0xb761('0x1a')],_0x1a494b[_0xb761('0xc')][_0xb761('0x26')],_0x1a494b[_0xb761('0x23')]['id'],![],_0x4c315e);if(rpc[_0x1a494b['channel']+_0xb761('0x27')]){return rpc[_0x1a494b[_0xb761('0x1e')]+_0xb761('0x27')][_0xb761('0x2b')](_0x59dec1,_0x48b5d8)[_0xb761('0x28')](function(_0x437668){logger[_0xb761('0x2c')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x14f6f4){return function(_0x50996c){return _0x50996c[_0xb761('0x26')][_0xb761('0x2f')]()===_0x14f6f4['toLowerCase']();};}exports[_0xb761('0x30')]=function(_0xf0dca2,_0x1d5d78,_0x7e8da2,_0x1dfa8d){return function(_0x5907b3){try{var _0x126882={'name':_0x1d5d78[0x0],'timeout':_0x1d5d78[0x1]};var _0x9e3d44=queue[_0xb761('0x31')](_0x126882,{'typecast':!![]});if(_0x9e3d44[_0xb761('0x32')]){logger['error']('[%s][QUEUE]\x20%s',_0xf0dca2,_[_0xb761('0x33')](_0x9e3d44,_0xb761('0x23'))[_0xb761('0x34')](',\x20'));_0x5907b3[_0xb761('0x35')]();}else{var _0x5e9294=_[_0xb761('0x36')](_0x7e8da2[_0x1dfa8d[_0xb761('0x1e')]+_0xb761('0x37')],handleFindQueue(_0x126882[_0xb761('0x26')]));if(_0x5e9294){startRouting(_0xf0dca2,_0x5e9294,_0x1dfa8d,_0x7e8da2);var _0x103b5d=(_0x5e9294[_0xb761('0x38')]||0xa)*0x3e8;var _0x1e2c27=(_0x126882[_0xb761('0x38')]||0x14)*0x3e8;var _0x5f437,_0x4687cf;if(_0x103b5d>_0x1e2c27){_0x1e2c27=_0x103b5d;}var _0x337d90=seqqueue['createQueue'](_0x103b5d);_0x337d90['id']=_0xf0dca2;_0x337d90['atimeout']=_0x103b5d;_0x337d90[_0xb761('0x39')]=_0x1e2c27;_0x337d90[_0xb761('0x1e')]=_0x1dfa8d[_0xb761('0x1e')];_0x7e8da2['rules'][_0xf0dca2]['on'](_0xb761('0x3a'),function(){logger[_0xb761('0x25')](_0xb761('0x3b'),_0xf0dca2);stopRouting(_0xf0dca2,_0x5e9294,_0x1dfa8d,_0x7e8da2);clearTimeout(_0x5f437);_0x5f437=undefined;_0x337d90[_0xb761('0x3c')](!![]);if(_0x7e8da2[_0xb761('0x3d')][_0xf0dca2]){delete _0x7e8da2[_0xb761('0x3d')][_0xf0dca2];}_0x5907b3[_0xb761('0x35')]();});_0x7e8da2[_0xb761('0x3d')][_0xf0dca2]['on'](_0xb761('0x3e'),function(){if(_0x7e8da2[_0xb761('0x3d')][_0xf0dca2]){delete _0x7e8da2[_0xb761('0x3d')][_0xf0dca2];}});_0x5f437=setTimeout(function(){logger['info'](_0xb761('0x3f'),_0xf0dca2);endRouting(_0xf0dca2,_0x5e9294,_0x1dfa8d,_0x7e8da2);clearTimeout(_0x5f437);_0x337d90[_0xb761('0x3c')](!![]);_0x5907b3[_0xb761('0x40')]();},_0x1e2c27);switch(_0x5e9294[_0xb761('0x41')]){case _0xb761('0x42'):strategy[_0xb761('0x42')](_0x337d90,_0x5e9294,_0x7e8da2,_0x1dfa8d);break;default:strategy[_0xb761('0x43')](_0x337d90,_0x5e9294,_0x7e8da2,_0x1dfa8d);}}else{logger[_0xb761('0x2c')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xf0dca2,_0x126882[_0xb761('0x26')]);_0x5907b3[_0xb761('0x35')]();}}}catch(_0x217e6c){console[_0xb761('0x44')](_0x217e6c);logger[_0xb761('0x2c')](_0xb761('0x45'),_0xf0dca2,_0x217e6c['stack']);_0x5907b3[_0xb761('0x35')]();}};}; \ No newline at end of file +var _0xbf1b=['socket.io-emitter','queue_id','account','clone','queue','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost'];(function(_0x3694b6,_0x1c44ec){var _0x2573ec=function(_0x1e66f7){while(--_0x1e66f7){_0x3694b6['push'](_0x3694b6['shift']());}};_0x2573ec(++_0x1c44ec);}(_0xbf1b,0x17c));var _0xbbf1=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xbf1b[_0x513aa5];return _0x1a1a7c;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xbbf1('0x0'));var seqqueue=require('seq-queue');var moment=require(_0xbbf1('0x1'));var Redis=require(_0xbbf1('0x2'));var config=require(_0xbbf1('0x3'));var logger=require(_0xbbf1('0x4'))(_0xbbf1('0x5'));var strategy=require(_0xbbf1('0x6'));config[_0xbbf1('0x7')]=_[_0xbbf1('0x8')](config['redis'],{'host':_0xbbf1('0x9'),'port':0x18eb});var io=require(_0xbbf1('0xa'))(new Redis(config[_0xbbf1('0x7')]));var attributes=['id',_0xbbf1('0xb'),_0xbbf1('0xc'),'queue','from','joinAt'];function emit(_0x4b3a33,_0x3c4d4c,_0x2d90d9){io['to'](_0x4b3a33)['emit'](_0x3c4d4c,_0x2d90d9);}function emitChannelQueueInteraction(_0x5914dc,_0x174858,_0x5e8f94,_0x1d8a2a,_0x248a95,_0x236f4d,_0x23a9c1,_0x518b33){var _0x139d07=_[_0xbbf1('0xd')](_0x5e8f94);_0x139d07['queue_id']=_0x518b33;_0x139d07[_0xbbf1('0xe')]=_0x174858;_0x139d07[_0xbbf1('0xc')]=_0x1d8a2a;_0x139d07['id']=_0x248a95;if(_0x236f4d){_0x23a9c1[util[_0xbbf1('0xf')]('%sQueuesWaitingInteractions',_0x5914dc)][_0x248a95]=_[_0xbbf1('0x10')](_0x139d07,attributes);}else{delete _0x23a9c1[util['format'](_0xbbf1('0x11'),_0x5914dc)][_0x248a95];}emit(util['format'](_0xbbf1('0x12'),_0x5914dc,_0x174858),util['format']('%s_queue_waiting_interaction:%s',_0x5914dc,_0x236f4d?_0xbbf1('0x13'):_0xbbf1('0x14')),_[_0xbbf1('0x10')](_0x139d07,attributes));}var rpc={'openchannelQueueReport':require(_0xbbf1('0x15')),'mailQueueReport':require(_0xbbf1('0x16')),'chatQueueReport':require(_0xbbf1('0x17')),'smsQueueReport':require(_0xbbf1('0x18')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xbbf1('0x19'))};var queue=schema({'name':{'type':_0xbbf1('0x1a'),'required':!![],'message':_0xbbf1('0x1b')},'timeout':{'type':_0xbbf1('0x1c'),'message':_0xbbf1('0x1d')}});function startRouting(_0x3adf7c,_0x406762,_0x796f40,_0x1dcb6a){if(_0x3adf7c&&_0x406762&&_0x796f40){_0x406762[_0xbbf1('0x1e')]+=0x1;var _0xcc0dcf={'uniqueid':_0x3adf7c,'from':_0x796f40['body']?_0x796f40[_0xbbf1('0x1f')][_0xbbf1('0x20')]:'','joinAt':moment()['format'](_0xbbf1('0x21')),'ContactId':_0x796f40[_0xbbf1('0x22')]?_0x796f40[_0xbbf1('0x22')]['id']:null,'ListId':_0x796f40[_0xbbf1('0x23')]?_0x796f40[_0xbbf1('0x23')]['id']:null};_0xcc0dcf[_[_0xbbf1('0x24')](_0x796f40[_0xbbf1('0x25')])+'QueueId']=_0x406762['id']||null;_0xcc0dcf[_[_0xbbf1('0x24')](_0x796f40[_0xbbf1('0x25')])+_0xbbf1('0x26')]=_0x796f40[_0xbbf1('0x27')]?_0x796f40['interaction']['id']:null;_0xcc0dcf[_[_0xbbf1('0x24')](_0x796f40[_0xbbf1('0x25')])+_0xbbf1('0x28')]=_0x796f40['message']?_0x796f40[_0xbbf1('0x29')]['id']:null;_0xcc0dcf[_['upperFirst'](_0x796f40[_0xbbf1('0x25')])+(_0x796f40[_0xbbf1('0x25')]!==_0xbbf1('0x2a')?_0xbbf1('0x2b'):_0xbbf1('0x2c'))]=_0x796f40[_0xbbf1('0xc')]?_0x796f40[_0xbbf1('0xc')]['id']:null;logger[_0xbbf1('0x2d')](util['format'](_0xbbf1('0x2e'),_0x3adf7c,_0x406762[_0xbbf1('0x2f')]));emitChannelQueueInteraction(_0x796f40[_0xbbf1('0x25')],_0x406762[_0xbbf1('0x2f')],_0xcc0dcf,_0x796f40['account']['name'],_0x796f40[_0xbbf1('0x29')]['id'],!![],_0x1dcb6a,_0x406762['id']);if(rpc[_0x796f40[_0xbbf1('0x25')]+'QueueReport']){return rpc[_0x796f40[_0xbbf1('0x25')]+_0xbbf1('0x30')][_0xbbf1('0x31')](_0xcc0dcf)[_0xbbf1('0x32')](function(_0x4ad248){logger[_0xbbf1('0x33')](_0xbbf1('0x34'));});}}}function stopRouting(_0x36ccbf,_0x5ccf63,_0x28c87c,_0x4b0e23){if(_0x36ccbf&&_0x5ccf63){_0x5ccf63[_0xbbf1('0x1e')]-=0x1;var _0x3e1503={'leaveAt':moment()[_0xbbf1('0xf')](_0xbbf1('0x21')),'acceptAt':moment()[_0xbbf1('0xf')](_0xbbf1('0x21')),'reason':_0xbbf1('0x35')};logger[_0xbbf1('0x2d')](util['format'](_0xbbf1('0x36'),_0x36ccbf,_0x5ccf63['name']));emitChannelQueueInteraction(_0x28c87c[_0xbbf1('0x25')],_0x5ccf63[_0xbbf1('0x2f')],_0x28c87c['body'],_0x28c87c[_0xbbf1('0xc')][_0xbbf1('0x2f')],_0x28c87c['message']['id'],![],_0x4b0e23,_0x5ccf63['id']);if(rpc[_0x28c87c[_0xbbf1('0x25')]+_0xbbf1('0x30')]){return rpc[_0x28c87c[_0xbbf1('0x25')]+_0xbbf1('0x30')]['update'](_0x36ccbf,_0x3e1503)[_0xbbf1('0x32')](function(_0x41af31){logger[_0xbbf1('0x33')](_0xbbf1('0x37'));});}}}function endRouting(_0x40449b,_0x2d7333,_0x5a140c,_0x15ee1d){if(_0x40449b&&_0x2d7333){_0x2d7333[_0xbbf1('0x1e')]-=0x1;var _0x34e741={'leaveAt':moment()[_0xbbf1('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0xbbf1('0x21')),'reason':_0xbbf1('0x38')};logger[_0xbbf1('0x2d')](util[_0xbbf1('0xf')](_0xbbf1('0x39'),_0x40449b,_0x2d7333[_0xbbf1('0x2f')]));emitChannelQueueInteraction(_0x5a140c[_0xbbf1('0x25')],_0x2d7333['name'],_0x5a140c[_0xbbf1('0x1f')],_0x5a140c['account'][_0xbbf1('0x2f')],_0x5a140c[_0xbbf1('0x29')]['id'],![],_0x15ee1d);if(rpc[_0x5a140c[_0xbbf1('0x25')]+_0xbbf1('0x30')]){return rpc[_0x5a140c['channel']+_0xbbf1('0x30')][_0xbbf1('0x3a')](_0x40449b,_0x34e741)[_0xbbf1('0x32')](function(_0x685c45){logger['error'](_0xbbf1('0x37'));});}}}function handleFindQueue(_0x462073){return function(_0x34294f){return _0x34294f[_0xbbf1('0x2f')][_0xbbf1('0x3b')]()===_0x462073['toLowerCase']();};}exports['consequence']=function(_0x4f7c77,_0x27a442,_0xb8e4be,_0xc9ddce){return function(_0x4b585){try{var _0x18c6da={'name':_0x27a442[0x0],'timeout':_0x27a442[0x1]};var _0x3f4d88=queue['validate'](_0x18c6da,{'typecast':!![]});if(_0x3f4d88[_0xbbf1('0x3c')]){logger[_0xbbf1('0x33')](_0xbbf1('0x3d'),_0x4f7c77,_[_0xbbf1('0x3e')](_0x3f4d88,_0xbbf1('0x29'))[_0xbbf1('0x3f')](',\x20'));_0x4b585[_0xbbf1('0x40')]();}else{var _0x2c04a2=_[_0xbbf1('0x41')](_0xb8e4be[_0xc9ddce[_0xbbf1('0x25')]+'Queues'],handleFindQueue(_0x18c6da['name']));if(_0x2c04a2){startRouting(_0x4f7c77,_0x2c04a2,_0xc9ddce,_0xb8e4be);var _0x1d1c5f=(_0x2c04a2[_0xbbf1('0x38')]||0xa)*0x3e8;var _0x3bdd7c=(_0x18c6da[_0xbbf1('0x38')]||0x14)*0x3e8;var _0x570032,_0x2a4781;if(_0x1d1c5f>_0x3bdd7c){_0x3bdd7c=_0x1d1c5f;}var _0x53cf28=seqqueue[_0xbbf1('0x42')](_0x1d1c5f);_0x53cf28['id']=_0x4f7c77;_0x53cf28[_0xbbf1('0x43')]=_0x1d1c5f;_0x53cf28['qtimeout']=_0x3bdd7c;_0x53cf28[_0xbbf1('0x25')]=_0xc9ddce[_0xbbf1('0x25')];_0xb8e4be[_0xbbf1('0x44')][_0x4f7c77]['on'](_0xbbf1('0x45'),function(){logger[_0xbbf1('0x2d')](_0xbbf1('0x46'),_0x4f7c77);stopRouting(_0x4f7c77,_0x2c04a2,_0xc9ddce,_0xb8e4be);clearTimeout(_0x570032);_0x570032=undefined;_0x53cf28['close'](!![]);if(_0xb8e4be[_0xbbf1('0x44')][_0x4f7c77]){delete _0xb8e4be[_0xbbf1('0x44')][_0x4f7c77];}_0x4b585['stop']();});_0xb8e4be[_0xbbf1('0x44')][_0x4f7c77]['on'](_0xbbf1('0x47'),function(){if(_0xb8e4be[_0xbbf1('0x44')][_0x4f7c77]){delete _0xb8e4be[_0xbbf1('0x44')][_0x4f7c77];}});_0x570032=setTimeout(function(){logger[_0xbbf1('0x2d')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x4f7c77);endRouting(_0x4f7c77,_0x2c04a2,_0xc9ddce,_0xb8e4be);clearTimeout(_0x570032);_0x53cf28['close'](!![]);_0x4b585[_0xbbf1('0x48')]();},_0x3bdd7c);switch(_0x2c04a2['strategy']){case _0xbbf1('0x49'):strategy[_0xbbf1('0x49')](_0x53cf28,_0x2c04a2,_0xb8e4be,_0xc9ddce);break;default:strategy[_0xbbf1('0x4a')](_0x53cf28,_0x2c04a2,_0xb8e4be,_0xc9ddce);}}else{logger[_0xbbf1('0x33')](_0xbbf1('0x4b'),_0x4f7c77,_0x18c6da[_0xbbf1('0x2f')]);_0x4b585['stop']();}}}catch(_0x5b59be){console[_0xbbf1('0x4c')](_0x5b59be);logger['error'](_0xbbf1('0x3d'),_0x4f7c77,_0x5b59be[_0xbbf1('0x4d')]);_0x4b585['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 58048d1..ccf512c 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 _0x1064=['agents','agent','forcedOwnership','isAgentAvailable','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','busy','busyQueue','STOP','TIMEOUT','exports','./util','../../../../../config/logger','routing','notificationId','squeue','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1064,0x10f));var _0x4106=function(_0x38cf0b,_0x45a27c){_0x38cf0b=_0x38cf0b-0x0;var _0x4a1b86=_0x1064[_0x38cf0b];return _0x4a1b86;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x4106('0x0'));var logger=require(_0x4106('0x1'))(_0x4106('0x2'));var Agent=function(_0x3af088,_0x401ece,_0x116f4f,_0x552446){this[_0x4106('0x3')]=uuid['v4']();this[_0x4106('0x4')]=_0x3af088;this['agent']=_0x401ece;this['realtime']=_0x116f4f;this['routing']=_0x552446;this[_0x4106('0x4')][_0x4106('0x5')](this[_0x4106('0x6')][_0x4106('0x7')](this),this['handleTimeout'][_0x4106('0x7')](this));this[_0x4106('0x4')]['on'](_0x4106('0x8'),this[_0x4106('0x9')]['bind'](this));this[_0x4106('0x4')]['on'](_0x4106('0xa'),this[_0x4106('0xb')][_0x4106('0x7')](this));};Agent[_0x4106('0xc')][_0x4106('0x5')]=function(){this['squeue'][_0x4106('0x5')](this[_0x4106('0x6')]['bind'](this),this[_0x4106('0x9')][_0x4106('0x7')](this));};Agent[_0x4106('0xc')][_0x4106('0xb')]=function(){this[_0x4106('0x9')](!![]);};Agent['prototype']['handleRun']=function(_0x261ac2){logger[_0x4106('0xd')](_0x4106('0xe'),this['squeue']['id'],this['agent']['id']);if(_[_0x4106('0xf')](this[_0x4106('0x10')][_0x4106('0x11')][this[_0x4106('0x12')]['id']])){logger[_0x4106('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x4106('0x4')]['id'],this[_0x4106('0x12')]['id']);setTimeout(this[_0x4106('0x5')][_0x4106('0x7')](this),0x3e8);}else{if(this[_0x4106('0x2')][_0x4106('0x13')]||util[_0x4106('0x14')](this[_0x4106('0x4')]['id'],this[_0x4106('0x10')][_0x4106('0x11')][this[_0x4106('0x12')]['id']],this[_0x4106('0x4')]['channel'],![])){this['realtime'][_0x4106('0x11')][this['agent']['id']]['busy']=!![];this[_0x4106('0x10')][_0x4106('0x11')][this[_0x4106('0x12')]['id']]['busyQueue']=undefined;util[_0x4106('0x15')](this[_0x4106('0x3')],this[_0x4106('0x4')]['id'],this[_0x4106('0x10')]['agents'][this['agent']['id']],null,this[_0x4106('0x2')]);util[_0x4106('0x16')](this[_0x4106('0x4')]['id'],this[_0x4106('0x10')][_0x4106('0x11')][this[_0x4106('0x12')]['id']],_0x4106('0x17')+(this[_0x4106('0x2')][_0x4106('0x13')]?':FORCED':''));}else{logger[_0x4106('0xd')](_0x4106('0x18'),this[_0x4106('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x4106('0x5')][_0x4106('0x7')](this),0x3e8);}}};Agent[_0x4106('0xc')][_0x4106('0x9')]=function(_0x39f2c9){if(_[_0x4106('0xf')](this[_0x4106('0x10')][_0x4106('0x11')][this[_0x4106('0x12')]['id']])){return logger['info'](_0x4106('0x19'),this['squeue']['id'],this['agent']['id']);}else{logger[_0x4106('0xd')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x4106('0x4')]['id'],this[_0x4106('0x12')]['id']);util[_0x4106('0x1a')](this[_0x4106('0x3')],this[_0x4106('0x4')]['id'],this[_0x4106('0x10')][_0x4106('0x11')][this[_0x4106('0x12')]['id']],null,this[_0x4106('0x2')]);this[_0x4106('0x10')][_0x4106('0x11')][this[_0x4106('0x12')]['id']][_0x4106('0x1b')]=![];this[_0x4106('0x10')]['agents'][this[_0x4106('0x12')]['id']][_0x4106('0x1c')]=undefined;util[_0x4106('0x16')](this[_0x4106('0x4')]['id'],this['realtime'][_0x4106('0x11')][this[_0x4106('0x12')]['id']],_0x39f2c9?_0x4106('0x1d'):_0x4106('0x1e'));}if(!_0x39f2c9){setTimeout(this[_0x4106('0x5')][_0x4106('0x7')](this),0x3e8);}};function agent(_0x3e35c8,_0x4b9b75,_0x3ba5ec,_0x6bd02b){return new Agent(_0x3e35c8,_0x4b9b75,_0x3ba5ec,_0x6bd02b);}module[_0x4106('0x1f')]=agent; \ No newline at end of file +var _0x0680=['isNil','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','STOP','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','handleTimeout','drained','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x478ad5,_0x4d3af7){var _0x345898=function(_0x5c243a){while(--_0x5c243a){_0x478ad5['push'](_0x478ad5['shift']());}};_0x345898(++_0x4d3af7);}(_0x0680,0x1de));var _0x0068=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0680[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0068('0x0'));var uuid=require(_0x0068('0x1'));var util=require(_0x0068('0x2'));var logger=require(_0x0068('0x3'))(_0x0068('0x4'));var Agent=function(_0x4fa170,_0x5eb14f,_0x107422,_0x437cbf){this[_0x0068('0x5')]=uuid['v4']();this[_0x0068('0x6')]=_0x4fa170;this[_0x0068('0x7')]=_0x5eb14f;this[_0x0068('0x8')]=_0x107422;this['routing']=_0x437cbf;this['squeue'][_0x0068('0x9')](this['handleRun'][_0x0068('0xa')](this),this['handleTimeout'][_0x0068('0xa')](this));this[_0x0068('0x6')]['on']('timeout',this[_0x0068('0xb')][_0x0068('0xa')](this));this['squeue']['on'](_0x0068('0xc'),this[_0x0068('0xd')][_0x0068('0xa')](this));};Agent[_0x0068('0xe')][_0x0068('0x9')]=function(){this[_0x0068('0x6')][_0x0068('0x9')](this[_0x0068('0xf')]['bind'](this),this[_0x0068('0xb')][_0x0068('0xa')](this));};Agent[_0x0068('0xe')][_0x0068('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0x0068('0xe')][_0x0068('0xf')]=function(_0x429889){logger['info'](_0x0068('0x10'),this[_0x0068('0x6')]['id'],this[_0x0068('0x7')]['id']);if(_[_0x0068('0x11')](this[_0x0068('0x8')][_0x0068('0x12')][this[_0x0068('0x7')]['id']])){logger[_0x0068('0x13')](_0x0068('0x14'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x0068('0x9')][_0x0068('0xa')](this),0x3e8);}else{if(this['routing'][_0x0068('0x15')]||util['isAgentAvailable'](this[_0x0068('0x6')]['id'],this[_0x0068('0x8')][_0x0068('0x12')][this[_0x0068('0x7')]['id']],this[_0x0068('0x6')][_0x0068('0x16')],![])){this[_0x0068('0x8')][_0x0068('0x12')][this[_0x0068('0x7')]['id']][_0x0068('0x17')]=!![];this[_0x0068('0x8')][_0x0068('0x12')][this[_0x0068('0x7')]['id']]['busyQueue']=undefined;util[_0x0068('0x18')](this[_0x0068('0x5')],this[_0x0068('0x6')]['id'],this['realtime'][_0x0068('0x12')][this[_0x0068('0x7')]['id']],null,this[_0x0068('0x4')]);util[_0x0068('0x19')](this[_0x0068('0x6')]['id'],this[_0x0068('0x8')][_0x0068('0x12')][this[_0x0068('0x7')]['id']],'RINGING'+(this[_0x0068('0x4')]['forcedOwnership']?_0x0068('0x1a'):''));}else{logger[_0x0068('0x13')](_0x0068('0x1b'),this[_0x0068('0x6')]['id'],this[_0x0068('0x7')]['id']);setTimeout(this[_0x0068('0x9')][_0x0068('0xa')](this),0x3e8);}}};Agent[_0x0068('0xe')]['handleTimeout']=function(_0x3060df){if(_[_0x0068('0x11')](this['realtime']['agents'][this[_0x0068('0x7')]['id']])){return logger[_0x0068('0x13')](_0x0068('0x14'),this[_0x0068('0x6')]['id'],this[_0x0068('0x7')]['id']);}else{logger['info'](_0x0068('0x1c'),this[_0x0068('0x6')]['id'],this[_0x0068('0x7')]['id']);util[_0x0068('0x1d')](this[_0x0068('0x5')],this[_0x0068('0x6')]['id'],this['realtime'][_0x0068('0x12')][this['agent']['id']],null,this[_0x0068('0x4')]);this['realtime']['agents'][this[_0x0068('0x7')]['id']][_0x0068('0x17')]=![];this['realtime'][_0x0068('0x12')][this['agent']['id']][_0x0068('0x1e')]=undefined;util[_0x0068('0x19')](this['squeue']['id'],this[_0x0068('0x8')][_0x0068('0x12')][this[_0x0068('0x7')]['id']],_0x3060df?_0x0068('0x1f'):'TIMEOUT');}if(!_0x3060df){setTimeout(this[_0x0068('0x9')][_0x0068('0xa')](this),0x3e8);}};function agent(_0x2eba77,_0x2bfc75,_0x34e909,_0xf8fdac){return new Agent(_0x2eba77,_0x2bfc75,_0x34e909,_0xf8fdac);}module[_0x0068('0x20')]=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 dec5591..b3b821c 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 _0x0be3=['showNotification','hideNotification','TIMEOUT','exports','./util','../../../../../config/logger','routing','notificationId','squeue','handleRun','bind','handleTimeout','timeout','push','prototype','handleDrained','isNil','queue','Agents','length','realtime','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','busy','busyQueue','name'];(function(_0x4347b9,_0x179bb8){var _0x2c8918=function(_0x15fc42){while(--_0x15fc42){_0x4347b9['push'](_0x4347b9['shift']());}};_0x2c8918(++_0x179bb8);}(_0x0be3,0x9a));var _0x30be=function(_0x37596a,_0xeaf59b){_0x37596a=_0x37596a-0x0;var _0x40228a=_0x0be3[_0x37596a];return _0x40228a;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x30be('0x0'));var logger=require(_0x30be('0x1'))(_0x30be('0x2'));var Beepall=function(_0x556f73,_0xa66e58,_0x4bc540,_0x44abbe){this[_0x30be('0x3')]=uuid['v4']();this[_0x30be('0x4')]=_0x556f73;this['queue']=_0xa66e58;this['realtime']=_0x4bc540;this[_0x30be('0x2')]=_0x44abbe;this[_0x30be('0x4')]['push'](this[_0x30be('0x5')][_0x30be('0x6')](this),this[_0x30be('0x7')]['bind'](this));this[_0x30be('0x4')]['on'](_0x30be('0x8'),this[_0x30be('0x7')][_0x30be('0x6')](this));this['squeue']['on']('drained',this['handleDrained'][_0x30be('0x6')](this));};Beepall['prototype'][_0x30be('0x9')]=function(){this[_0x30be('0x4')][_0x30be('0x9')](this[_0x30be('0x5')][_0x30be('0x6')](this),this[_0x30be('0x7')][_0x30be('0x6')](this));};Beepall[_0x30be('0xa')][_0x30be('0xb')]=function(_0x5ec0e6){this[_0x30be('0x7')](!![]);};Beepall['prototype'][_0x30be('0x5')]=function(_0x44f51b){var _0x57161a=!![];if(!_[_0x30be('0xc')](this[_0x30be('0xd')])&&!_['isNil'](this[_0x30be('0xd')][_0x30be('0xe')])&&this[_0x30be('0xd')][_0x30be('0xe')][_0x30be('0xf')]>0x0){for(var _0x3538ba=0x0,_0x16f5f7;_0x3538ba0x0){for(var _0x4db048=0x0,_0x344faf;_0x4db0480x0&&_0x309fa5[_0x615d49+_0x56a5('0x22')]>=_0x309fa5[_0x615d49+_0x56a5('0x21')]){writeLog(_0x1556eb,_0x309fa5,_0x615d49[_0x56a5('0x23')]()+_0x56a5('0x24'));return![];}}return!![];};exports['showNotification']=function(_0x18e863,_0x54ec36,_0x2efde7,_0x3c6ac1,_0x1b27b5){return sendNotification(!![],_0x18e863,_0x54ec36,_0x2efde7,_0x3c6ac1,_0x1b27b5);};exports[_0x56a5('0x25')]=function(_0x4e7afd,_0x3b55e6,_0x1f7aeb,_0x178f11,_0x51ef6f){return sendNotification(![],_0x4e7afd,_0x3b55e6,_0x1f7aeb,_0x178f11,_0x51ef6f);};exports[_0x56a5('0x26')]=writeLog; \ No newline at end of file +var _0xafc4=['notification:%s','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','lodash','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','localhost','socket.io-emitter','redis','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','emit'];(function(_0x5eef97,_0x378733){var _0x5602ed=function(_0x5e5778){while(--_0x5e5778){_0x5eef97['push'](_0x5eef97['shift']());}};_0x5602ed(++_0x378733);}(_0xafc4,0x69));var _0x4afc=function(_0x1faabd,_0x1f94ea){_0x1faabd=_0x1faabd-0x0;var _0x6e92f=_0xafc4[_0x1faabd];return _0x6e92f;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var utils=require(_0x4afc('0x1'));var Mustache=require('mustache');var Redis=require(_0x4afc('0x2'));var config=require(_0x4afc('0x3'));var logger=require(_0x4afc('0x4'))(_0x4afc('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0x4afc('0x6'),'port':0x18eb});var io=require(_0x4afc('0x7'))(new Redis(config[_0x4afc('0x8')]));function emit(_0x1bb281,_0xc828d9,_0xaf053d){io['to'](_0x1bb281)['emit'](_0xc828d9,_0xaf053d);}function sendNotification(_0x31e165,_0x1c740c,_0x134aad,_0x1e6bf5,_0x1b8981,_0x458fde){io['to'](util['format']('user:%s',_0x1e6bf5[_0x4afc('0x9')]))['emit'](_0x4afc('0xa'),_0x1e6bf5);var _0x225793=_0x458fde||{};var _0x49b56f=_0x134aad[_0x4afc('0xb')]('.');var _0x3fb54a={'uniqueid':_0x1c740c,'channel':_0x49b56f[0x0],'id':_0x49b56f[0x1],'title':_0x49b56f[0x0]+_0x4afc('0xc'),'interactionId':_0x49b56f[0x2],'queue':_0x1b8981?_0x1b8981[_0x4afc('0x9')]:null,'sound':_0x225793[_0x4afc('0xd')][_0x4afc('0xe')],'shake':_0x225793[_0x4afc('0xd')][_0x4afc('0xf')]};try{if(!_0x225793['body']){_0x225793[_0x4afc('0x10')]={};}if(_0x1b8981){_0x225793[_0x4afc('0x10')][_0x4afc('0x11')]=_0x1b8981;}else if(_0x225793[_0x4afc('0x10')]['queue']){delete _0x225793['body'][_0x4afc('0x11')];}_0x3fb54a['msg']=utils[_0x4afc('0x12')](_0x225793[_0x4afc('0xd')][_0x4afc('0x13')],_0x225793);}catch(_0x31eec4){_0x3fb54a[_0x4afc('0x14')]=_0x4afc('0x15');logger[_0x4afc('0x16')](util[_0x4afc('0x17')](_0x4afc('0x18'),_0x1c740c,_0x31eec4[_0x4afc('0x19')]));}io['to'](util[_0x4afc('0x17')]('user:%s',_0x1e6bf5[_0x4afc('0x9')]))[_0x4afc('0x1a')](util[_0x4afc('0x17')](_0x4afc('0x1b'),_0x31e165?'save':_0x4afc('0x1c')),_0x3fb54a);}function writeLog(_0x30eda3,_0x2de6e9,_0x280587){return logger[_0x4afc('0x1d')](util[_0x4afc('0x17')](_0x4afc('0x1e'),_0x30eda3,_0x2de6e9['name'],_0x280587));}exports[_0x4afc('0x1f')]=function(_0x3ecf2d,_0x57f37c,_0x37debf,_0x4e9a48){if(_0x57f37c[_0x4afc('0x20')]){writeLog(_0x3ecf2d,_0x57f37c,_0x4afc('0x21'));return![];}if(!_0x57f37c[_0x4afc('0x22')]){writeLog(_0x3ecf2d,_0x57f37c,_0x4afc('0x23'));return![];}if(_0x57f37c[_0x37debf+_0x4afc('0x24')]){writeLog(_0x3ecf2d,_0x57f37c,_0x4afc('0x25'));return![];}if(_0x4e9a48&&_0x57f37c[_0x4afc('0x26')](_0x37debf+_0x4afc('0x27'))&&_0x57f37c[_0x4afc('0x26')](_0x37debf+_0x4afc('0x28'))){if(_0x57f37c[_0x37debf+_0x4afc('0x27')]>0x0&&_0x57f37c[_0x37debf+_0x4afc('0x28')]>=_0x57f37c[_0x37debf+_0x4afc('0x27')]){writeLog(_0x3ecf2d,_0x57f37c,_0x37debf['toUpperCase']()+_0x4afc('0x29'));return![];}}return!![];};exports[_0x4afc('0x2a')]=function(_0x2d6112,_0x4e254d,_0x52212d,_0x54433f,_0x426e9d){return sendNotification(!![],_0x2d6112,_0x4e254d,_0x52212d,_0x54433f,_0x426e9d);};exports[_0x4afc('0x2b')]=function(_0x5e4747,_0xd26d2f,_0x628e42,_0x494fe7,_0x514278){return sendNotification(![],_0x5e4747,_0xd26d2f,_0x628e42,_0x494fe7,_0x514278);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 371ff93..191eebd 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 _0xbf94=['next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','info','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','validate','shelljs','lodash','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x5aa37a,_0x1c514c){var _0xcd501a=function(_0x506508){while(--_0x506508){_0x5aa37a['push'](_0x5aa37a['shift']());}};_0xcd501a(++_0x1c514c);}(_0xbf94,0x146));var _0x4bf9=function(_0x8330ec,_0x2fff9e){_0x8330ec=_0x8330ec-0x0;var _0x4b8a37=_0xbf94[_0x8330ec];return _0x4b8a37;};'use strict';var schema=require(_0x4bf9('0x0'));var sh=require(_0x4bf9('0x1'));var _=require(_0x4bf9('0x2'));var utils=require(_0x4bf9('0x3'));var logger=require('../../../../config/logger')(_0x4bf9('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x4bf9('0x5')}});exports['consequence']=function(_0x20f685,_0x3ad6b9){return function(_0x53c222){try{var _0x1ef7f1={'command':_0x3ad6b9[0x0]};var _0x5a2932=system[_0x4bf9('0x0')](_0x1ef7f1,{'typecast':!![]});if(_0x5a2932[_0x4bf9('0x6')]){logger[_0x4bf9('0x7')](_0x4bf9('0x8'),_0x20f685,_[_0x4bf9('0x9')](_0x5a2932,'message')[_0x4bf9('0xa')](',\x20'));logger['info'](_0x4bf9('0xb'),_0x20f685);_0x53c222[_0x4bf9('0xc')]();}else{var _0x8c0d04=this;var _0x559105=utils[_0x4bf9('0xd')](_0x3ad6b9[0x0],this);logger['info'](_0x4bf9('0xe'),_0x20f685,_0x559105);sh[_0x4bf9('0xf')](_[_0x4bf9('0x10')](_0x559105),function(_0x4253b6,_0x10a1c5){logger[_0x4bf9('0x11')](_0x4bf9('0x12'),_0x20f685,_0x4253b6);if(_0x4253b6==0x0){var _0x531a62=_0x10a1c5[_0x4bf9('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x4bf9('0x14')](_0x3ad6b9[0x1])||_[_0x4bf9('0x15')](_0x3ad6b9[0x1])){logger['info'](_0x4bf9('0x16'),_0x20f685);_0x8c0d04[_0x4bf9('0x17')][_0x3ad6b9[0x1]]=_0x531a62;}else{logger[_0x4bf9('0x11')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x20f685,_0x3ad6b9[0x1],_0x531a62);_0x8c0d04[_0x4bf9('0x17')][_0x3ad6b9[0x1]]=_0x531a62;}}_0x53c222[_0x4bf9('0xc')]();});}}catch(_0x1e1c5e){logger['error'](_0x4bf9('0x8'),_0x20f685,_[_0x4bf9('0x18')](_0x1e1c5e)?JSON[_0x4bf9('0x19')](_0x1e1c5e):_0x1e1c5e);logger[_0x4bf9('0x11')](_0x4bf9('0xb'),_0x20f685);_0x53c222[_0x4bf9('0xc')]();}};}; \ No newline at end of file +var _0x83d3=['info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','next','validate','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map'];(function(_0x56bc0f,_0x12d504){var _0x223d34=function(_0x5cbaf9){while(--_0x5cbaf9){_0x56bc0f['push'](_0x56bc0f['shift']());}};_0x223d34(++_0x12d504);}(_0x83d3,0x17c));var _0x383d=function(_0x1fd155,_0x340af9){_0x1fd155=_0x1fd155-0x0;var _0x250e2f=_0x83d3[_0x1fd155];return _0x250e2f;};'use strict';var schema=require(_0x383d('0x0'));var sh=require(_0x383d('0x1'));var _=require(_0x383d('0x2'));var utils=require(_0x383d('0x3'));var logger=require(_0x383d('0x4'))('routing');var system=schema({'command':{'type':_0x383d('0x5'),'required':!![],'message':_0x383d('0x6')}});exports[_0x383d('0x7')]=function(_0x202ffc,_0x52adf4){return function(_0x1f65b7){try{var _0x4f3c10={'command':_0x52adf4[0x0]};var _0x50eaff=system[_0x383d('0x0')](_0x4f3c10,{'typecast':!![]});if(_0x50eaff[_0x383d('0x8')]){logger[_0x383d('0x9')]('[%s][SYSTEM]\x20%s',_0x202ffc,_[_0x383d('0xa')](_0x50eaff,'message')['join'](',\x20'));logger[_0x383d('0xb')](_0x383d('0xc'),_0x202ffc);_0x1f65b7['next']();}else{var _0x1e7e90=this;var _0x3efe85=utils[_0x383d('0xd')](_0x52adf4[0x0],this);logger[_0x383d('0xb')](_0x383d('0xe'),_0x202ffc,_0x3efe85);sh[_0x383d('0xf')](_['trim'](_0x3efe85),function(_0x5d9970,_0x4f357c){logger[_0x383d('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x202ffc,_0x5d9970);if(_0x5d9970==0x0){var _0x3d5b63=_0x4f357c[_0x383d('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x383d('0x11')](_0x52adf4[0x1])||_[_0x383d('0x12')](_0x52adf4[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x202ffc);_0x1e7e90[_0x383d('0x13')][_0x52adf4[0x1]]=_0x3d5b63;}else{logger['info'](_0x383d('0x14'),_0x202ffc,_0x52adf4[0x1],_0x3d5b63);_0x1e7e90['body'][_0x52adf4[0x1]]=_0x3d5b63;}}_0x1f65b7['next']();});}}catch(_0x294423){logger[_0x383d('0x9')]('[%s][SYSTEM]\x20%s',_0x202ffc,_['isObject'](_0x294423)?JSON[_0x383d('0x15')](_0x294423):_0x294423);logger[_0x383d('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x202ffc);_0x1f65b7[_0x383d('0x16')]();}};}; \ 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 fe995ea..d513359 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 _0x5d87=['channel','Interaction','addTags','interaction','then','info','catch','stringify','isObject','validate','../../rpc/smsInteraction','../../rpc/faxInteraction','routing','number','consequence','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5d87,0xe5));var _0x75d8=function(_0x1e7e0c,_0xaa485b){_0x1e7e0c=_0x1e7e0c-0x0;var _0x4a907b=_0x5d87[_0x1e7e0c];return _0x4a907b;};'use strict';var schema=require(_0x75d8('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x75d8('0x1')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x75d8('0x2')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x75d8('0x3'));var tag=schema({'tag':{'type':_0x75d8('0x4'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x75d8('0x5')]=function(_0xfe4403,_0x42fcf4,_0x1379d1,_0x357d36){return function(_0x821bde){try{var _0x35abe3={'tag':_0x42fcf4[0x0]};var _0x3308a6=tag[_0x75d8('0x0')](_0x35abe3,{'typecast':!![]});if(_0x3308a6['length']){logger[_0x75d8('0x6')](_0x75d8('0x7'),_0xfe4403,_[_0x75d8('0x8')](_0x3308a6,_0x75d8('0x9'))[_0x75d8('0xa')](',\x20'));logger['info'](_0x75d8('0xb'),_0xfe4403);_0x821bde[_0x75d8('0xc')]();}else{var _0x23f13b={'ids':[_0x42fcf4[0x0]]};if(rpc[_0x357d36[_0x75d8('0xd')]+_0x75d8('0xe')]){rpc[_0x357d36[_0x75d8('0xd')]+'Interaction'][_0x75d8('0xf')](_0x357d36[_0x75d8('0x10')]['id'],_0x23f13b)[_0x75d8('0x11')](function(_0x227499){logger[_0x75d8('0x12')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0xfe4403,_0x42fcf4[0x1],_0x357d36['channel'],_0x357d36[_0x75d8('0x10')]['id']);})[_0x75d8('0x13')](function(_0x50dbe4){logger[_0x75d8('0x6')](_0x75d8('0x7'),_0xfe4403,JSON[_0x75d8('0x14')](_0x50dbe4));logger['info'](_0x75d8('0xb'),_0xfe4403);})['finally'](function(){_0x821bde[_0x75d8('0xc')]();});}}}catch(_0x1e13f4){logger['error']('[%s][TAG]\x20%s',_0xfe4403,_[_0x75d8('0x15')](_0x1e13f4)?JSON[_0x75d8('0x14')](_0x1e13f4):_0x1e13f4);logger['info'](_0x75d8('0xb'),_0xfe4403);_0x821bde[_0x75d8('0xc')]();}};}; \ No newline at end of file +var _0x3276=['Interaction','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','error','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','next','[%s][TAG]\x20%s','isObject','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','consequence','length','map','info','channel'];(function(_0x4a2658,_0x56eb14){var _0x363e43=function(_0x4302e9){while(--_0x4302e9){_0x4a2658['push'](_0x4a2658['shift']());}};_0x363e43(++_0x56eb14);}(_0x3276,0x9b));var _0x6327=function(_0x4feffb,_0x1cc7ad){_0x4feffb=_0x4feffb-0x0;var _0x3aa285=_0x3276[_0x4feffb];return _0x3aa285;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0x6327('0x0')),'openchannelInteraction':require(_0x6327('0x1')),'smsInteraction':require(_0x6327('0x2')),'mailInteraction':require(_0x6327('0x3')),'faxInteraction':require(_0x6327('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x6327('0x5'))(_0x6327('0x6'));var tag=schema({'tag':{'type':_0x6327('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x6327('0x8')]=function(_0x5ec84e,_0x1f7a08,_0x469614,_0xd53aa0){return function(_0xe6a3ba){try{var _0x58aed5={'tag':_0x1f7a08[0x0]};var _0x3aa6d1=tag['validate'](_0x58aed5,{'typecast':!![]});if(_0x3aa6d1[_0x6327('0x9')]){logger['error']('[%s][TAG]\x20%s',_0x5ec84e,_[_0x6327('0xa')](_0x3aa6d1,'message')['join'](',\x20'));logger[_0x6327('0xb')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5ec84e);_0xe6a3ba['next']();}else{var _0xb56078={'ids':[_0x1f7a08[0x0]]};if(rpc[_0xd53aa0[_0x6327('0xc')]+'Interaction']){rpc[_0xd53aa0[_0x6327('0xc')]+_0x6327('0xd')]['addTags'](_0xd53aa0[_0x6327('0xe')]['id'],_0xb56078)[_0x6327('0xf')](function(_0x503a71){logger[_0x6327('0xb')](_0x6327('0x10'),_0x5ec84e,_0x1f7a08[0x1],_0xd53aa0[_0x6327('0xc')],_0xd53aa0[_0x6327('0xe')]['id']);})['catch'](function(_0x20db9b){logger[_0x6327('0x11')]('[%s][TAG]\x20%s',_0x5ec84e,JSON[_0x6327('0x12')](_0x20db9b));logger[_0x6327('0xb')](_0x6327('0x13'),_0x5ec84e);})[_0x6327('0x14')](function(){_0xe6a3ba[_0x6327('0x15')]();});}}}catch(_0x440576){logger[_0x6327('0x11')](_0x6327('0x16'),_0x5ec84e,_[_0x6327('0x17')](_0x440576)?JSON[_0x6327('0x12')](_0x440576):_0x440576);logger[_0x6327('0xb')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5ec84e);_0xe6a3ba['next']();}};}; \ 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 653b0ff..b4defd9 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 _0xe006=['login','stringify','POST','application/json-rpc','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','then','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','../../../../config/logger','routing','consequence','replace','push','?params=','urlOnRing','2.0','method'];(function(_0x4d6c3d,_0x25b352){var _0x5d023d=function(_0x55fc6f){while(--_0x55fc6f){_0x4d6c3d['push'](_0x4d6c3d['shift']());}};_0x5d023d(++_0x25b352);}(_0xe006,0x1bf));var _0x6e00=function(_0x1ca9eb,_0x99a10b){_0x1ca9eb=_0x1ca9eb-0x0;var _0x2e284e=_0xe006[_0x1ca9eb];return _0x2e284e;};'use strict';var rp=require('request-promise');var logger=require(_0x6e00('0x0'))(_0x6e00('0x1'));var _=require('lodash');var arr=[];exports[_0x6e00('0x2')]=function(_0x12123a,_0x53ce10){return function(_0x51e8e4){var _0x5a43c4=_0x53ce10[0xa];var _0x458e31=_0x53ce10[0xb];var _0x288364=_0x53ce10[0xc];var _0x165872=_0x53ce10[0xd];var _0x35b0ee=_0x53ce10[0xe];var _0x3b4900=_0x53ce10[0xf]['replace'](/\n/g,'\x20-\x20');var _0x4eaa16=_0x53ce10[0x10][_0x6e00('0x3')](/\n/g,'\x20');if(!arr['includes'](_0x458e31)){arr[_0x6e00('0x4')](_0x458e31);var _0x53a2f7=_0x53ce10[0x3];var _0x56d8d4=_0x53ce10[0x4];var _0x30dcf8=_0x53ce10[0x1];var _0x58a188=_0x53ce10[0x0];var _0x4a22dc={};_0x4a22dc['urlOnAnswer']=_0x53ce10[0x8]+_0x6e00('0x5')+_0x288364+'|'+_0x5a43c4+'|'+_0x165872+'|'+_0x458e31+'|'+_0x35b0ee;_0x4a22dc[_0x6e00('0x6')]=_0x53ce10[0x7]+'?params='+_0x288364+'|'+_0x5a43c4+'|'+_0x165872+'|'+_0x458e31+'|'+_0x35b0ee+'|'+_0x3b4900+'|'+_0x4eaa16;_0x4a22dc['title']=_0x53ce10[0x9];var _0x36ba53={};_0x36ba53['jsonrpc']=_0x6e00('0x7');_0x36ba53[_0x6e00('0x8')]=_0x6e00('0x9');var _0xad4672=[];_0xad4672['push'](_0x53ce10[0x2]);_0xad4672['push'](_0x53ce10[0x5]);_0xad4672[_0x6e00('0x4')](_0x53ce10[0x6]);_0x36ba53['params']=_0xad4672;_0x36ba53['id']=0x1;var _0x360689=JSON[_0x6e00('0xa')](_0x36ba53);var _0x303788={'encoding':'utf8','method':_0x6e00('0xb'),'timeout':0x2710,'url':_0x53a2f7,'headers':{'Content-Type':_0x6e00('0xc')},'body':_0x360689};return rp(_0x303788)['then'](function(_0x1d6e14){const _0x547391=JSON['parse'](_0x1d6e14);if(!_0x547391['result']['logged']){throw new Error(_0x6e00('0xd'));}var _0x4edddd=_0x458e31;var _0x3cd2c9=_0x6e00('0xe')+_0x30dcf8+_0x6e00('0xf')+_0x58a188+_0x6e00('0x10')+_0x4edddd+_0x6e00('0x11')+JSON[_0x6e00('0xa')](_0x4a22dc);var _0x131b74=_0x56d8d4+'?'+_0x3cd2c9;return rp(_0x131b74);})[_0x6e00('0x12')](function(_0x451dab){logger['info'](_0x6e00('0x13'),_0x12123a,_0x451dab);_0x51e8e4[_0x6e00('0x14')]();})[_0x6e00('0x15')](function(_0x49e4f5){logger[_0x6e00('0x16')]('[%s][TVOX]\x20%s',_0x12123a,_[_0x6e00('0x17')](_0x49e4f5)?JSON[_0x6e00('0xa')](_0x49e4f5):_0x49e4f5);_0x51e8e4[_0x6e00('0x14')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x12123a);_0x51e8e4['next']();}};}; \ No newline at end of file +var _0xd956=['[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','replace','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method','params','stringify','utf8','application/json-rpc','then','result','logged','channelId=','&serviceId='];(function(_0x53d056,_0x27fab6){var _0x53eecb=function(_0x5ec6e9){while(--_0x5ec6e9){_0x53d056['push'](_0x53d056['shift']());}};_0x53eecb(++_0x27fab6);}(_0xd956,0x1c8));var _0x6d95=function(_0x147656,_0x2480fc){_0x147656=_0x147656-0x0;var _0x43df2f=_0xd956[_0x147656];return _0x43df2f;};'use strict';var rp=require('request-promise');var logger=require(_0x6d95('0x0'))(_0x6d95('0x1'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x2d6e63,_0x2112e2){return function(_0x808a31){var _0x2dd464=_0x2112e2[0xa];var _0x4827bf=_0x2112e2[0xb];var _0x30ad8d=_0x2112e2[0xc];var _0x2c78e=_0x2112e2[0xd];var _0x4e421a=_0x2112e2[0xe];var _0x2cd80b=_0x2112e2[0xf]['replace'](/\n/g,'\x20-\x20');var _0x575ef1=_0x2112e2[0x10][_0x6d95('0x2')](/\n/g,'\x20');if(!arr[_0x6d95('0x3')](_0x4827bf)){arr[_0x6d95('0x4')](_0x4827bf);var _0x235a9c=_0x2112e2[0x3];var _0x192d43=_0x2112e2[0x4];var _0x3add47=_0x2112e2[0x1];var _0x1af8d1=_0x2112e2[0x0];var _0x2eaad6={};_0x2eaad6[_0x6d95('0x5')]=_0x2112e2[0x8]+_0x6d95('0x6')+_0x30ad8d+'|'+_0x2dd464+'|'+_0x2c78e+'|'+_0x4827bf+'|'+_0x4e421a;_0x2eaad6[_0x6d95('0x7')]=_0x2112e2[0x7]+_0x6d95('0x6')+_0x30ad8d+'|'+_0x2dd464+'|'+_0x2c78e+'|'+_0x4827bf+'|'+_0x4e421a+'|'+_0x2cd80b+'|'+_0x575ef1;_0x2eaad6['title']=_0x2112e2[0x9];var _0x586262={};_0x586262[_0x6d95('0x8')]=_0x6d95('0x9');_0x586262[_0x6d95('0xa')]='login';var _0x376c23=[];_0x376c23[_0x6d95('0x4')](_0x2112e2[0x2]);_0x376c23[_0x6d95('0x4')](_0x2112e2[0x5]);_0x376c23['push'](_0x2112e2[0x6]);_0x586262[_0x6d95('0xb')]=_0x376c23;_0x586262['id']=0x1;var _0xcffe37=JSON[_0x6d95('0xc')](_0x586262);var _0x474185={'encoding':_0x6d95('0xd'),'method':'POST','timeout':0x2710,'url':_0x235a9c,'headers':{'Content-Type':_0x6d95('0xe')},'body':_0xcffe37};return rp(_0x474185)[_0x6d95('0xf')](function(_0x460554){const _0xa51684=JSON['parse'](_0x460554);if(!_0xa51684[_0x6d95('0x10')][_0x6d95('0x11')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x157564=_0x4827bf;var _0xe92337=_0x6d95('0x12')+_0x3add47+_0x6d95('0x13')+_0x1af8d1+'&sessionId='+_0x157564+'&data='+JSON[_0x6d95('0xc')](_0x2eaad6);var _0x4a5f69=_0x192d43+'?'+_0xe92337;return rp(_0x4a5f69);})[_0x6d95('0xf')](function(_0x358ca6){logger['info'](_0x6d95('0x14'),_0x2d6e63,_0x358ca6);_0x808a31[_0x6d95('0x15')]();})['catch'](function(_0x47c543){logger[_0x6d95('0x16')](_0x6d95('0x17'),_0x2d6e63,_[_0x6d95('0x18')](_0x47c543)?JSON['stringify'](_0x47c543):_0x47c543);_0x808a31['stop']();});}else{logger[_0x6d95('0x19')](_0x6d95('0x1a'),_0x2d6e63);_0x808a31[_0x6d95('0x1b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 389479f..33502c3 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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x56ecd6,_0xb16465){var _0x115e14=function(_0x21ef92){while(--_0x21ef92){_0x56ecd6['push'](_0x56ecd6['shift']());}};_0x115e14(++_0xb16465);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x1bce6f,_0x4c0963){var _0x2bbeea=function(_0x5293b1){while(--_0x5293b1){_0x1bce6f['push'](_0x1bce6f['shift']());}};_0x2bbeea(++_0x4c0963);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 2916caf..4bcb9c8 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 _0xcab6=['waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','./applications/utils','../../../config/environment','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','message','interaction','applications','isArray','length','.js','app','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','join','amazonlex','tag','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','stringify','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused'];(function(_0x561ebe,_0x2335a0){var _0x62617c=function(_0x8304b8){while(--_0x8304b8){_0x561ebe['push'](_0x561ebe['shift']());}};_0x62617c(++_0x2335a0);}(_0xcab6,0xd4));var _0x6cab=function(_0x52d1f3,_0x2cf008){_0x52d1f3=_0x52d1f3-0x0;var _0x273599=_0xcab6[_0x52d1f3];return _0x273599;};'use strict';var _=require(_0x6cab('0x0'));var util=require('util');var path=require(_0x6cab('0x1'));var fs=require('fs');var jayson=require(_0x6cab('0x2'));var BPromise=require(_0x6cab('0x3'));var uuid=require(_0x6cab('0x4'));var utils=require(_0x6cab('0x5'));var config=require(_0x6cab('0x6'));var logger=require('../../../config/logger')(_0x6cab('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6cab('0x8')),'chatQueueReport':require(_0x6cab('0x9')),'smsQueueReport':require(_0x6cab('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x6cab('0xb'))};var RuleEngine=require(_0x6cab('0xc'));function getId(_0x230f8b,_0xd520bd,_0x58d0ee){return util['format'](_0x6cab('0xd'),_0x230f8b,_0xd520bd||0x0,_0x58d0ee||0x0);}function getIntervals(_0x37f00d,_0x2aa304){var _0x3ff1c6=[];if(!_[_0x6cab('0xe')](_0x2aa304[_0x6cab('0xf')])&&!_['isNil'](_0x37f00d[_0x2aa304[_0x6cab('0xf')]])&&!_['isNil'](_0x37f00d[_0x2aa304['IntervalId']][_0x6cab('0x10')])){_0x3ff1c6=_['map'](_0x37f00d[_0x2aa304[_0x6cab('0xf')]]['Intervals'],'interval');}else if(!_['isNil'](_0x2aa304['interval'])){_0x3ff1c6=[_0x2aa304[_0x6cab('0x11')]];}return _0x3ff1c6;}exports[_0x6cab('0x12')]=function(_0x278be9){_0x278be9[_0x6cab('0x13')]={};return new BPromise(function(_0xc3cb3a,_0x1e0bdb){var _0x256dbc={'Start':function(_0x22ea54){var _0x36f5e9=this;return new Promise(function(_0x1fc3e8,_0x1d8714){if(_0x22ea54){try{var _0x3738f2=[];var _0x317d89=getId(_0x22ea54['channel'],_0x22ea54[_0x6cab('0x14')]?_0x22ea54[_0x6cab('0x14')]['id']:0x0,_0x22ea54['interaction']?_0x22ea54[_0x6cab('0x15')]['id']:0x0);if(_0x22ea54[_0x6cab('0x16')]&&_[_0x6cab('0x17')](_0x22ea54[_0x6cab('0x16')])&&_0x22ea54['applications']['length']){for(var _0x46848a=0x0;_0x46848a<_0x22ea54[_0x6cab('0x16')][_0x6cab('0x18')];_0x46848a+=0x1){var _0x2986e6=_0x22ea54[_0x6cab('0x16')][_0x46848a];if(fs['existsSync'](path['join'](__dirname,_0x6cab('0x16'),_0x2986e6['app']+_0x6cab('0x19')))){var _0x3f8516=[];switch(_0x2986e6[_0x6cab('0x1a')][_0x6cab('0x1b')]()){case _0x6cab('0x1c'):var _0x75d3d8=_0x2986e6[_0x6cab('0x1d')][_0x6cab('0x1e')](',');if(_0x22ea54[_0x6cab('0x1f')]===_0x6cab('0x20')){_0x3f8516[_0x6cab('0x21')](_0x75d3d8[0x0]);_0x3f8516[_0x6cab('0x21')](_0x75d3d8[0x1]);_0x3f8516[_0x6cab('0x21')](_0x75d3d8['slice'](0x2,_0x75d3d8['length'])['join'](','));}else{_0x3f8516['push'](_0x75d3d8[0x0]);_0x3f8516['push'](_0x75d3d8[_0x6cab('0x22')](0x1,_0x75d3d8[_0x6cab('0x18')])[_0x6cab('0x23')](','));}break;case'dialogflow':var _0x2ae4e7=_0x2986e6[_0x6cab('0x1d')][_0x6cab('0x1e')](',');_0x3f8516[_0x6cab('0x21')](_0x2ae4e7[0x0]);_0x3f8516['push'](_0x2ae4e7[0x1]);_0x3f8516[_0x6cab('0x21')](_0x2ae4e7[_0x6cab('0x22')](0x2,_0x2ae4e7['length'])[_0x6cab('0x23')](','));break;case'dialogflowv2':var _0x14e1de=_0x2986e6['appdata']['split'](',');_0x3f8516[_0x6cab('0x21')](_0x14e1de[0x0]);_0x3f8516['push'](_0x14e1de[0x1]);_0x3f8516[_0x6cab('0x21')](_0x14e1de[0x2]);_0x3f8516[_0x6cab('0x21')](_0x14e1de[0x3]);_0x3f8516['push'](_0x14e1de['slice'](0x4,_0x14e1de[_0x6cab('0x18')])[_0x6cab('0x23')](','));break;case _0x6cab('0x24'):var _0x4f35f8=_0x2986e6['appdata'][_0x6cab('0x1e')](',');_0x3f8516[_0x6cab('0x21')](_0x4f35f8[0x0]);_0x3f8516[_0x6cab('0x21')](_0x4f35f8[0x1]);_0x3f8516[_0x6cab('0x21')](_0x4f35f8[0x2]);_0x3f8516[_0x6cab('0x21')](_0x4f35f8[0x3]);_0x3f8516[_0x6cab('0x21')](_0x4f35f8[_0x6cab('0x22')](0x4,_0x4f35f8[_0x6cab('0x18')])['join'](','));break;case'message':_0x3f8516['push'](_0x2986e6[_0x6cab('0x1d')]);break;case _0x6cab('0x25'):_0x3f8516[_0x6cab('0x21')](_0x2986e6['TagId']);_0x3f8516[_0x6cab('0x21')](_0x2986e6[_0x6cab('0x1d')]);break;case _0x6cab('0x26'):var _0x4ea7f6=utils[_0x6cab('0x27')](_0x22ea54[_0x6cab('0x28')][_0x6cab('0x29')],_0x22ea54);var _0x5764fd=_0x2986e6[_0x6cab('0x1d')]['split'](',');_0x3f8516['push'](_0x5764fd[0x0]);_0x3f8516['push'](_0x5764fd[0x1]);_0x3f8516[_0x6cab('0x21')](_0x5764fd[0x2]);_0x3f8516[_0x6cab('0x21')](_0x5764fd[0x3]);_0x3f8516['push'](_0x5764fd[0x4]);_0x3f8516[_0x6cab('0x21')](_0x5764fd[0x5]);_0x3f8516[_0x6cab('0x21')](_0x5764fd[0x6]);_0x3f8516[_0x6cab('0x21')](_0x5764fd[0x7]);_0x3f8516[_0x6cab('0x21')](_0x5764fd[0x8]);_0x3f8516[_0x6cab('0x21')](_0x5764fd[0x9]);_0x3f8516[_0x6cab('0x21')](_0x5764fd[0xa]);_0x3f8516[_0x6cab('0x21')](_0x22ea54[_0x6cab('0x15')]['id']);_0x3f8516[_0x6cab('0x21')](_0x22ea54[_0x6cab('0x14')]['id']);_0x3f8516['push'](_0x2986e6[_0x6cab('0x2a')]);_0x3f8516['push'](_0x22ea54[_0x6cab('0x15')]['ContactId']);_0x3f8516[_0x6cab('0x21')](_0x22ea54[_0x6cab('0x2b')][_0x6cab('0x2b')]);_0x3f8516['push'](_0x4ea7f6);break;default:_0x3f8516=_[_0x6cab('0xe')](_0x2986e6[_0x6cab('0x1d')])?[]:_0x2986e6[_0x6cab('0x1d')][_0x6cab('0x1e')](',');}var _0xe3ca3b={'id':util['format'](_0x6cab('0x2c'),_0x317d89,_0x2986e6['id'],_0x2986e6[_0x6cab('0x1a')]),'condition':require(_0x6cab('0x2d'))[_0x6cab('0x2e')](_0x317d89,getIntervals(_0x278be9[_0x6cab('0x2f')],_0x2986e6),_0x278be9),'consequence':require(_0x6cab('0x30')+_0x2986e6[_0x6cab('0x1a')])[_0x6cab('0x31')](_0x317d89,_0x3f8516,_0x278be9,_0x22ea54),'p':_0x2986e6[_0x6cab('0x32')]||0x0};logger['info']('Push\x20new\x20rule',_0xe3ca3b['id'],_0x6cab('0x33'),getIntervals(_0x278be9[_0x6cab('0x2f')],_0x2986e6)[_0x6cab('0x23')](_0x6cab('0x34')));_0x3738f2[_0x6cab('0x21')](_0xe3ca3b);}else{logger[_0x6cab('0x35')](_0x6cab('0x36'),path[_0x6cab('0x23')](__dirname,_0x6cab('0x16'),_0x2986e6['app']+_0x6cab('0x19')));}}_0x278be9[_0x6cab('0x13')][_0x317d89]=new RuleEngine(_0x3738f2);_0x278be9['rules'][_0x317d89][_0x6cab('0x37')](_0x22ea54,function(_0x27dc1c){logger[_0x6cab('0x38')]('Applications\x20executed',JSON[_0x6cab('0x39')](_0x27dc1c['matchPath']));if(_0x278be9['rules'][_0x317d89]){_0x278be9['rules'][_0x317d89][_0x6cab('0x3a')]('complete');}});return _0x1fc3e8({'code':0xc8,'message':_0x22ea54});}else{logger[_0x6cab('0x38')](_0x6cab('0x3b'));return _0x1fc3e8({'code':0xc8,'message':_0x22ea54});}}catch(_0x486a3e){logger[_0x6cab('0x35')](_0x486a3e[_0x6cab('0x3c')]);return _0x1d8714(_0x36f5e9['error'](0x1f4,_0x486a3e));}}return _0x1d8714(_0x6cab('0x3d'));});},'AcceptMessage':function(_0x1272f8){var _0xe77e9f=this;return new Promise(function(_0x53ca80,_0x1d153f){if(_0x1272f8[_0x6cab('0x3e')]&&_0x1272f8[_0x6cab('0x3e')]['id']){if(_0x278be9[_0x6cab('0x3f')][_0x1272f8[_0x6cab('0x3e')]['id']]){_0x278be9[_0x6cab('0x3f')][_0x1272f8[_0x6cab('0x3e')]['id']][_0x6cab('0x40')]=![];_0x278be9[_0x6cab('0x3f')][_0x1272f8[_0x6cab('0x3e')]['id']][_0x6cab('0x41')]=undefined;}}if(_0x1272f8[_0x6cab('0x14')]&&_0x1272f8[_0x6cab('0x14')]['id']){try{var _0x513ead=getId(_0x1272f8[_0x6cab('0x1f')],_0x1272f8['message']?_0x1272f8[_0x6cab('0x14')]['id']:0x0,_0x1272f8[_0x6cab('0x15')]?_0x1272f8['interaction']['id']:0x0);if(_0x278be9[_0x6cab('0x13')][_0x513ead]){_0x278be9[_0x6cab('0x13')][_0x513ead][_0x6cab('0x3a')](_0x6cab('0x42'));if(rpc[_0x1272f8[_0x6cab('0x1f')]+_0x6cab('0x43')]){rpc[_0x1272f8[_0x6cab('0x1f')]+_0x6cab('0x43')]['update'](_0x513ead,{'UserId':_0x1272f8[_0x6cab('0x14')]['UserId']})[_0x6cab('0x44')](function(_0x1d58d9){logger['error'](_0x6cab('0x45'));});}}return _0x53ca80({'code':0xc8,'message':_0x1272f8});}catch(_0x52827d){logger[_0x6cab('0x35')](_0x52827d[_0x6cab('0x3c')]);return _0x1d153f(_0xe77e9f[_0x6cab('0x35')](0x1f4,_0x52827d));}}logger[_0x6cab('0x35')]('message\x20is\x20empty');return _0x1d153f(_0xe77e9f[_0x6cab('0x35')](0x1f4,_0x6cab('0x46')));});},'RejectMessage':function(_0x443689){var _0x3584e3=this;return new Promise(function(_0x5c29b7,_0x2ce26c){if(_0x443689[_0x6cab('0x3e')]&&_0x443689[_0x6cab('0x3e')]['id']){try{if(_0x278be9[_0x6cab('0x3f')][_0x443689[_0x6cab('0x3e')]['id']]){_0x278be9['agents'][_0x443689['agent']['id']]['busy']=![];_0x278be9[_0x6cab('0x3f')][_0x443689['agent']['id']][_0x6cab('0x41')]=undefined;}return _0x5c29b7({'code':0xc8,'message':_0x443689});}catch(_0xd4428){logger[_0x6cab('0x35')](_0xd4428[_0x6cab('0x3c')]);return _0x2ce26c(_0x3584e3[_0x6cab('0x35')](0x1f4,_0xd4428));}}logger[_0x6cab('0x35')](_0x6cab('0x46'));return _0x2ce26c(_0x3584e3[_0x6cab('0x35')](0x1f4,_0x6cab('0x46')));});},'AbandonInteraction':function(_0x22dda1){var _0xe2a5bf=this;return new Promise(function(_0x39f74a,_0x27ba55){if(_0x22dda1[_0x6cab('0x1f')]&&_0x22dda1[_0x6cab('0x15')]&&_0x22dda1['interaction']['id']){try{var _0x90812=getId(_0x22dda1[_0x6cab('0x1f')],_0x22dda1[_0x6cab('0x14')]?_0x22dda1[_0x6cab('0x14')]['id']:0x0,_0x22dda1['interaction']?_0x22dda1[_0x6cab('0x15')]['id']:0x0);if(_0x278be9[_0x6cab('0x13')][_0x90812]){_0x278be9['rules'][_0x90812][_0x6cab('0x3a')]('end');}return _0x39f74a({'code':0xc8,'message':_0x22dda1});}catch(_0x3c80c0){logger[_0x6cab('0x35')](_0x3c80c0[_0x6cab('0x3c')]);return _0x27ba55(_0xe2a5bf[_0x6cab('0x35')](0x1f4,_0x3c80c0));}}logger[_0x6cab('0x35')](_0x6cab('0x46'));return _0x27ba55(_0xe2a5bf['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x5f4b93){var _0x1bfb34=this;return new Promise(function(_0x249d8f,_0x2a0139){if(_0x278be9[_0x6cab('0x3f')][_0x6cab('0x47')](_0x5f4b93['id'])){for(var _0xf30ce7 in _0x5f4b93[_0x6cab('0x48')]){if(_0x5f4b93[_0x6cab('0x48')][_0x6cab('0x47')](_0xf30ce7)){if(_0x278be9[_0x6cab('0x3f')][_0x5f4b93['id']][_0x6cab('0x47')](_0xf30ce7+_0x6cab('0x49'))){_0x278be9[_0x6cab('0x3f')][_0x5f4b93['id']][_0xf30ce7+_0x6cab('0x49')]=parseInt(_0x5f4b93[_0x6cab('0x48')][_0xf30ce7],0xa);}}}_0x278be9[_0x6cab('0x3f')][_0x5f4b93['id']][_0x6cab('0x4a')]();return _0x249d8f({'code':0xc8,'message':_0x278be9[_0x6cab('0x3f')][_0x5f4b93['id']]});}else{return _0x2a0139(_0x1bfb34[_0x6cab('0x35')](0x1f4,_0x6cab('0x4b')));}});},'Agents':function(_0x180772){return new Promise(function(_0x27f64f,_0x2f8942){var _0x20153d=_[_0x6cab('0x4c')](_0x278be9[_0x6cab('0x3f')]);_0x27f64f({'count':_0x20153d[_0x6cab('0x18')],'rows':_0x20153d});});},'ChatQueues':function(_0x2e0360){return new Promise(function(_0x1b961b,_0x30e551){var _0x3da9e4=[];for(var _0x44c81e in _0x278be9[_0x6cab('0x4d')]){if(_0x278be9['chatQueues'][_0x6cab('0x47')](_0x44c81e)){var _0x5f3577=_0x278be9[_0x6cab('0x4d')][_0x44c81e];var _0x36aa4f={'id':_0x5f3577['id'],'available':_0x5f3577[_0x6cab('0x4e')],'loggedIn':_0x5f3577[_0x6cab('0x4f')],'name':_0x5f3577[_0x6cab('0x50')],'paused':_0x5f3577[_0x6cab('0x51')],'waiting':_0x5f3577[_0x6cab('0x52')]};_0x3da9e4[_0x6cab('0x21')](_0x36aa4f);}}_0x1b961b({'count':_0x3da9e4[_0x6cab('0x18')],'rows':_0x3da9e4});});},'MailQueues':function(_0x50a280){return new Promise(function(_0x40db88,_0x328e02){var _0x4a9a4a=[];for(var _0x58e342 in _0x278be9[_0x6cab('0x53')]){if(_0x278be9['mailQueues'][_0x6cab('0x47')](_0x58e342)){var _0x3fdf77=_0x278be9['mailQueues'][_0x58e342];var _0x3a328d={'id':_0x3fdf77['id'],'available':_0x3fdf77[_0x6cab('0x4e')],'loggedIn':_0x3fdf77[_0x6cab('0x4f')],'name':_0x3fdf77[_0x6cab('0x50')],'paused':_0x3fdf77['paused'],'waiting':_0x3fdf77['waiting']};_0x4a9a4a[_0x6cab('0x21')](_0x3a328d);}}_0x40db88({'count':_0x4a9a4a[_0x6cab('0x18')],'rows':_0x4a9a4a});});},'OpenchannelQueues':function(_0x23b818){return new Promise(function(_0x9f4a2,_0x25752e){var _0xe21bd3=[];for(var _0x307d92 in _0x278be9[_0x6cab('0x54')]){if(_0x278be9[_0x6cab('0x54')][_0x6cab('0x47')](_0x307d92)){var _0x88286f=_0x278be9[_0x6cab('0x54')][_0x307d92];var _0x5815b9={'id':_0x88286f['id'],'available':_0x88286f['available'],'loggedIn':_0x88286f[_0x6cab('0x4f')],'name':_0x88286f[_0x6cab('0x50')],'paused':_0x88286f[_0x6cab('0x51')],'waiting':_0x88286f[_0x6cab('0x52')]};_0xe21bd3[_0x6cab('0x21')](_0x5815b9);}}_0x9f4a2({'count':_0xe21bd3[_0x6cab('0x18')],'rows':_0xe21bd3});});},'SmsQueues':function(_0x51f609){return new Promise(function(_0x308fb9,_0x202ebf){var _0x2b7076=[];for(var _0x4faf2e in _0x278be9[_0x6cab('0x55')]){if(_0x278be9['smsQueues'][_0x6cab('0x47')](_0x4faf2e)){var _0x493d36=_0x278be9[_0x6cab('0x55')][_0x4faf2e];var _0x7b4071={'id':_0x493d36['id'],'available':_0x493d36[_0x6cab('0x4e')],'loggedIn':_0x493d36['loggedIn'],'name':_0x493d36['name'],'paused':_0x493d36[_0x6cab('0x51')],'waiting':_0x493d36[_0x6cab('0x52')]};_0x2b7076['push'](_0x7b4071);}}_0x308fb9({'count':_0x2b7076[_0x6cab('0x18')],'rows':_0x2b7076});});},'FaxQueues':function(_0x21e070){return new Promise(function(_0x28e389,_0x27489a){var _0x321438=[];for(var _0x225bfa in _0x278be9[_0x6cab('0x56')]){if(_0x278be9[_0x6cab('0x56')][_0x6cab('0x47')](_0x225bfa)){var _0x3e4587=_0x278be9[_0x6cab('0x56')][_0x225bfa];var _0x14e3e9={'id':_0x3e4587['id'],'available':_0x3e4587[_0x6cab('0x4e')],'loggedIn':_0x3e4587[_0x6cab('0x4f')],'name':_0x3e4587[_0x6cab('0x50')],'paused':_0x3e4587[_0x6cab('0x51')],'waiting':_0x3e4587[_0x6cab('0x52')]};_0x321438[_0x6cab('0x21')](_0x14e3e9);}}_0x28e389({'count':_0x321438[_0x6cab('0x18')],'rows':_0x321438});});},'WhatsappQueues':function(_0x1d5246){return new Promise(function(_0x2a53a6,_0x5dacf6){var _0x3d2f78=[];for(var _0x3a04c6 in _0x278be9['whatsappQueues']){if(_0x278be9[_0x6cab('0x57')][_0x6cab('0x47')](_0x3a04c6)){var _0x2bf9a8=_0x278be9['whatsappQueues'][_0x3a04c6];var _0x3ec794={'id':_0x2bf9a8['id'],'available':_0x2bf9a8['available'],'loggedIn':_0x2bf9a8[_0x6cab('0x4f')],'name':_0x2bf9a8['name'],'paused':_0x2bf9a8[_0x6cab('0x51')],'waiting':_0x2bf9a8[_0x6cab('0x52')]};_0x3d2f78[_0x6cab('0x21')](_0x3ec794);}}_0x2a53a6({'count':_0x3d2f78['length'],'rows':_0x3d2f78});});},'ChatQueuesWaitingInteractions':function(_0x3d0017){return new Promise(function(_0x54089c,_0x592e36){var _0x4c0f08=_[_0x6cab('0x4c')](_0x278be9[_0x6cab('0x58')]);_0x54089c({'count':_0x4c0f08[_0x6cab('0x18')],'rows':_0x4c0f08});});},'MailQueuesWaitingInteractions':function(_0x2a96be){return new Promise(function(_0x5dd1d9,_0x101eb9){var _0x1127d0=_[_0x6cab('0x4c')](_0x278be9[_0x6cab('0x59')]);_0x5dd1d9({'count':_0x1127d0[_0x6cab('0x18')],'rows':_0x1127d0});});},'OpenchannelQueuesWaitingInteractions':function(_0x2f98a2){return new Promise(function(_0x397ee1,_0x57ef41){var _0x57579c=_['values'](_0x278be9[_0x6cab('0x5a')]);_0x397ee1({'count':_0x57579c[_0x6cab('0x18')],'rows':_0x57579c});});},'SmsQueuesWaitingInteractions':function(_0xd770bd){return new Promise(function(_0x580ba7,_0x5bc08a){var _0x51ecb8=_[_0x6cab('0x4c')](_0x278be9['smsQueuesWaitingInteractions']);_0x580ba7({'count':_0x51ecb8[_0x6cab('0x18')],'rows':_0x51ecb8});});},'FaxQueuesWaitingInteractions':function(_0x51fb94){return new Promise(function(_0x1ae751,_0x5603d7){var _0x388e79=_[_0x6cab('0x4c')](_0x278be9[_0x6cab('0x5b')]);_0x1ae751({'count':_0x388e79[_0x6cab('0x18')],'rows':_0x388e79});});},'WhatsappQueuesWaitingInteractions':function(_0x492477){return new Promise(function(_0x10e9fa,_0x25f288){var _0x27eec2=_[_0x6cab('0x4c')](_0x278be9[_0x6cab('0x5c')]);_0x10e9fa({'count':_0x27eec2['length'],'rows':_0x27eec2});});}};var _0x2dc338=jayson['server'](_0x256dbc)[_0x6cab('0x5d')]();_0x2dc338['on'](_0x6cab('0x35'),function(_0x4ec1bb){logger[_0x6cab('0x35')](JSON[_0x6cab('0x39')](_0x4ec1bb));return _0x1e0bdb(_0x4ec1bb);});_0x2dc338[_0x6cab('0x12')](0x232c,_0x6cab('0x5e'),function(){console[_0x6cab('0x5f')](_0x6cab('0x60'),0x232c);return _0xc3cb3a(_0x6cab('0x61')+0x232c);});});}; \ No newline at end of file +var _0xc9c3=['end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','values','chatQueues','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','./applications/utils','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','interval','rules','message','interaction','applications','isArray','length','join','.js','app','channel','mail','push','slice','dialogflow','appdata','split','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','condition','intervals','./applications/','consequence','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue'];(function(_0x44f88c,_0x2ed52a){var _0xee8510=function(_0x4d2d02){while(--_0x4d2d02){_0x44f88c['push'](_0x44f88c['shift']());}};_0xee8510(++_0x2ed52a);}(_0xc9c3,0xd0));var _0x3c9c=function(_0x593da0,_0x2036be){_0x593da0=_0x593da0-0x0;var _0x4fdc86=_0xc9c3[_0x593da0];return _0x4fdc86;};'use strict';var _=require('lodash');var util=require(_0x3c9c('0x0'));var path=require(_0x3c9c('0x1'));var fs=require('fs');var jayson=require(_0x3c9c('0x2'));var BPromise=require('bluebird');var uuid=require('uuid');var utils=require(_0x3c9c('0x3'));var config=require(_0x3c9c('0x4'));var logger=require('../../../config/logger')(_0x3c9c('0x5'));var rpc={'openchannelQueueReport':require(_0x3c9c('0x6')),'mailQueueReport':require(_0x3c9c('0x7')),'chatQueueReport':require(_0x3c9c('0x8')),'smsQueueReport':require(_0x3c9c('0x9')),'faxQueueReport':require(_0x3c9c('0xa')),'whatsappQueueReport':require(_0x3c9c('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x5a15f7,_0x290995,_0x3d10bc){return util['format'](_0x3c9c('0xc'),_0x5a15f7,_0x290995||0x0,_0x3d10bc||0x0);}function getIntervals(_0x417fdc,_0xfe0978){var _0x15ca32=[];if(!_['isNil'](_0xfe0978['IntervalId'])&&!_[_0x3c9c('0xd')](_0x417fdc[_0xfe0978[_0x3c9c('0xe')]])&&!_[_0x3c9c('0xd')](_0x417fdc[_0xfe0978[_0x3c9c('0xe')]]['Intervals'])){_0x15ca32=_['map'](_0x417fdc[_0xfe0978['IntervalId']]['Intervals'],_0x3c9c('0xf'));}else if(!_[_0x3c9c('0xd')](_0xfe0978['interval'])){_0x15ca32=[_0xfe0978[_0x3c9c('0xf')]];}return _0x15ca32;}exports['listen']=function(_0x2de024){_0x2de024[_0x3c9c('0x10')]={};return new BPromise(function(_0x1def09,_0x541830){var _0x1940fa={'Start':function(_0x59fb0f){var _0x3b9fef=this;return new Promise(function(_0x4b9b7f,_0x448319){if(_0x59fb0f){try{var _0x2d7785=[];var _0x17a542=getId(_0x59fb0f['channel'],_0x59fb0f[_0x3c9c('0x11')]?_0x59fb0f['message']['id']:0x0,_0x59fb0f[_0x3c9c('0x12')]?_0x59fb0f[_0x3c9c('0x12')]['id']:0x0);if(_0x59fb0f[_0x3c9c('0x13')]&&_[_0x3c9c('0x14')](_0x59fb0f[_0x3c9c('0x13')])&&_0x59fb0f[_0x3c9c('0x13')][_0x3c9c('0x15')]){for(var _0x24ae87=0x0;_0x24ae87<_0x59fb0f[_0x3c9c('0x13')][_0x3c9c('0x15')];_0x24ae87+=0x1){var _0x15ccdb=_0x59fb0f[_0x3c9c('0x13')][_0x24ae87];if(fs['existsSync'](path[_0x3c9c('0x16')](__dirname,'applications',_0x15ccdb['app']+_0x3c9c('0x17')))){var _0x17e73d=[];switch(_0x15ccdb[_0x3c9c('0x18')]['toLowerCase']()){case'autoreply':var _0x1bed10=_0x15ccdb['appdata']['split'](',');if(_0x59fb0f[_0x3c9c('0x19')]===_0x3c9c('0x1a')){_0x17e73d['push'](_0x1bed10[0x0]);_0x17e73d[_0x3c9c('0x1b')](_0x1bed10[0x1]);_0x17e73d[_0x3c9c('0x1b')](_0x1bed10[_0x3c9c('0x1c')](0x2,_0x1bed10[_0x3c9c('0x15')])[_0x3c9c('0x16')](','));}else{_0x17e73d[_0x3c9c('0x1b')](_0x1bed10[0x0]);_0x17e73d['push'](_0x1bed10[_0x3c9c('0x1c')](0x1,_0x1bed10['length'])['join'](','));}break;case _0x3c9c('0x1d'):var _0x25618d=_0x15ccdb[_0x3c9c('0x1e')][_0x3c9c('0x1f')](',');_0x17e73d[_0x3c9c('0x1b')](_0x25618d[0x0]);_0x17e73d[_0x3c9c('0x1b')](_0x25618d[0x1]);_0x17e73d[_0x3c9c('0x1b')](_0x25618d[_0x3c9c('0x1c')](0x2,_0x25618d[_0x3c9c('0x15')])['join'](','));break;case _0x3c9c('0x20'):var _0x2d2e90=_0x15ccdb[_0x3c9c('0x1e')]['split'](',');_0x17e73d['push'](_0x2d2e90[0x0]);_0x17e73d[_0x3c9c('0x1b')](_0x2d2e90[0x1]);_0x17e73d[_0x3c9c('0x1b')](_0x2d2e90[0x2]);_0x17e73d[_0x3c9c('0x1b')](_0x2d2e90[0x3]);_0x17e73d['push'](_0x2d2e90[_0x3c9c('0x1c')](0x4,_0x2d2e90[_0x3c9c('0x15')])['join'](','));break;case _0x3c9c('0x21'):var _0x2e72fe=_0x15ccdb['appdata'][_0x3c9c('0x1f')](',');_0x17e73d[_0x3c9c('0x1b')](_0x2e72fe[0x0]);_0x17e73d[_0x3c9c('0x1b')](_0x2e72fe[0x1]);_0x17e73d[_0x3c9c('0x1b')](_0x2e72fe[0x2]);_0x17e73d[_0x3c9c('0x1b')](_0x2e72fe[0x3]);_0x17e73d[_0x3c9c('0x1b')](_0x2e72fe[_0x3c9c('0x1c')](0x4,_0x2e72fe[_0x3c9c('0x15')])[_0x3c9c('0x16')](','));break;case _0x3c9c('0x11'):_0x17e73d[_0x3c9c('0x1b')](_0x15ccdb[_0x3c9c('0x1e')]);break;case _0x3c9c('0x22'):_0x17e73d[_0x3c9c('0x1b')](_0x15ccdb[_0x3c9c('0x23')]);_0x17e73d[_0x3c9c('0x1b')](_0x15ccdb[_0x3c9c('0x1e')]);break;case'tvox':var _0x3a7e6e=utils[_0x3c9c('0x24')](_0x59fb0f[_0x3c9c('0x25')][_0x3c9c('0x26')],_0x59fb0f);var _0x504b75=_0x15ccdb[_0x3c9c('0x1e')][_0x3c9c('0x1f')](',');_0x17e73d[_0x3c9c('0x1b')](_0x504b75[0x0]);_0x17e73d[_0x3c9c('0x1b')](_0x504b75[0x1]);_0x17e73d[_0x3c9c('0x1b')](_0x504b75[0x2]);_0x17e73d['push'](_0x504b75[0x3]);_0x17e73d[_0x3c9c('0x1b')](_0x504b75[0x4]);_0x17e73d[_0x3c9c('0x1b')](_0x504b75[0x5]);_0x17e73d[_0x3c9c('0x1b')](_0x504b75[0x6]);_0x17e73d[_0x3c9c('0x1b')](_0x504b75[0x7]);_0x17e73d[_0x3c9c('0x1b')](_0x504b75[0x8]);_0x17e73d[_0x3c9c('0x1b')](_0x504b75[0x9]);_0x17e73d[_0x3c9c('0x1b')](_0x504b75[0xa]);_0x17e73d['push'](_0x59fb0f[_0x3c9c('0x12')]['id']);_0x17e73d[_0x3c9c('0x1b')](_0x59fb0f[_0x3c9c('0x11')]['id']);_0x17e73d[_0x3c9c('0x1b')](_0x15ccdb['ChatWebsiteId']);_0x17e73d[_0x3c9c('0x1b')](_0x59fb0f['interaction'][_0x3c9c('0x27')]);_0x17e73d['push'](_0x59fb0f[_0x3c9c('0x28')]['body']);_0x17e73d[_0x3c9c('0x1b')](_0x3a7e6e);break;default:_0x17e73d=_['isNil'](_0x15ccdb[_0x3c9c('0x1e')])?[]:_0x15ccdb[_0x3c9c('0x1e')][_0x3c9c('0x1f')](',');}var _0x1627dd={'id':util['format'](_0x3c9c('0x29'),_0x17a542,_0x15ccdb['id'],_0x15ccdb[_0x3c9c('0x18')]),'condition':require('./interval')[_0x3c9c('0x2a')](_0x17a542,getIntervals(_0x2de024[_0x3c9c('0x2b')],_0x15ccdb),_0x2de024),'consequence':require(_0x3c9c('0x2c')+_0x15ccdb[_0x3c9c('0x18')])[_0x3c9c('0x2d')](_0x17a542,_0x17e73d,_0x2de024,_0x59fb0f),'p':_0x15ccdb['priority']||0x0};logger['info']('Push\x20new\x20rule',_0x1627dd['id'],'on\x20interval',getIntervals(_0x2de024[_0x3c9c('0x2b')],_0x15ccdb)[_0x3c9c('0x16')](_0x3c9c('0x2e')));_0x2d7785[_0x3c9c('0x1b')](_0x1627dd);}else{logger['error'](_0x3c9c('0x2f'),path['join'](__dirname,_0x3c9c('0x13'),_0x15ccdb[_0x3c9c('0x18')]+_0x3c9c('0x17')));}}_0x2de024[_0x3c9c('0x10')][_0x17a542]=new RuleEngine(_0x2d7785);_0x2de024[_0x3c9c('0x10')][_0x17a542][_0x3c9c('0x30')](_0x59fb0f,function(_0x4c30eb){logger[_0x3c9c('0x31')](_0x3c9c('0x32'),JSON[_0x3c9c('0x33')](_0x4c30eb[_0x3c9c('0x34')]));if(_0x2de024[_0x3c9c('0x10')][_0x17a542]){_0x2de024[_0x3c9c('0x10')][_0x17a542][_0x3c9c('0x35')](_0x3c9c('0x36'));}});return _0x4b9b7f({'code':0xc8,'message':_0x59fb0f});}else{logger[_0x3c9c('0x31')]('No\x20applications\x20to\x20execute');return _0x4b9b7f({'code':0xc8,'message':_0x59fb0f});}}catch(_0x4edfc2){logger[_0x3c9c('0x37')](_0x4edfc2[_0x3c9c('0x38')]);return _0x448319(_0x3b9fef[_0x3c9c('0x37')](0x1f4,_0x4edfc2));}}return _0x448319(_0x3c9c('0x39'));});},'AcceptMessage':function(_0x5ca22e){var _0xbb6f2d=this;return new Promise(function(_0xdca61d,_0x4194a3){if(_0x5ca22e[_0x3c9c('0x3a')]&&_0x5ca22e[_0x3c9c('0x3a')]['id']){if(_0x2de024[_0x3c9c('0x3b')][_0x5ca22e[_0x3c9c('0x3a')]['id']]){_0x2de024[_0x3c9c('0x3b')][_0x5ca22e[_0x3c9c('0x3a')]['id']][_0x3c9c('0x3c')]=![];_0x2de024[_0x3c9c('0x3b')][_0x5ca22e[_0x3c9c('0x3a')]['id']][_0x3c9c('0x3d')]=undefined;}}if(_0x5ca22e['message']&&_0x5ca22e[_0x3c9c('0x11')]['id']){try{var _0x4a738b=getId(_0x5ca22e[_0x3c9c('0x19')],_0x5ca22e['message']?_0x5ca22e['message']['id']:0x0,_0x5ca22e[_0x3c9c('0x12')]?_0x5ca22e['interaction']['id']:0x0);if(_0x2de024[_0x3c9c('0x10')][_0x4a738b]){_0x2de024[_0x3c9c('0x10')][_0x4a738b][_0x3c9c('0x35')](_0x3c9c('0x3e'));if(rpc[_0x5ca22e[_0x3c9c('0x19')]+_0x3c9c('0x3f')]){rpc[_0x5ca22e[_0x3c9c('0x19')]+_0x3c9c('0x3f')][_0x3c9c('0x40')](_0x4a738b,{'UserId':_0x5ca22e[_0x3c9c('0x11')]['UserId']})[_0x3c9c('0x41')](function(_0x65bf14){logger['error'](_0x3c9c('0x42'));});}}return _0xdca61d({'code':0xc8,'message':_0x5ca22e});}catch(_0x3f7216){logger[_0x3c9c('0x37')](_0x3f7216[_0x3c9c('0x38')]);return _0x4194a3(_0xbb6f2d[_0x3c9c('0x37')](0x1f4,_0x3f7216));}}logger['error'](_0x3c9c('0x43'));return _0x4194a3(_0xbb6f2d[_0x3c9c('0x37')](0x1f4,_0x3c9c('0x43')));});},'RejectMessage':function(_0xdfebf4){var _0x2e8e7c=this;return new Promise(function(_0x38b13c,_0x2240e3){if(_0xdfebf4[_0x3c9c('0x3a')]&&_0xdfebf4['agent']['id']){try{if(_0x2de024[_0x3c9c('0x3b')][_0xdfebf4['agent']['id']]){_0x2de024[_0x3c9c('0x3b')][_0xdfebf4[_0x3c9c('0x3a')]['id']][_0x3c9c('0x3c')]=![];_0x2de024[_0x3c9c('0x3b')][_0xdfebf4[_0x3c9c('0x3a')]['id']][_0x3c9c('0x3d')]=undefined;}return _0x38b13c({'code':0xc8,'message':_0xdfebf4});}catch(_0x4b9e6a){logger[_0x3c9c('0x37')](_0x4b9e6a[_0x3c9c('0x38')]);return _0x2240e3(_0x2e8e7c[_0x3c9c('0x37')](0x1f4,_0x4b9e6a));}}logger[_0x3c9c('0x37')]('message\x20is\x20empty');return _0x2240e3(_0x2e8e7c[_0x3c9c('0x37')](0x1f4,_0x3c9c('0x43')));});},'AbandonInteraction':function(_0x467c07){var _0x309d96=this;return new Promise(function(_0x4ad93b,_0x1d038c){if(_0x467c07[_0x3c9c('0x19')]&&_0x467c07[_0x3c9c('0x12')]&&_0x467c07[_0x3c9c('0x12')]['id']){try{var _0x330a02=getId(_0x467c07[_0x3c9c('0x19')],_0x467c07[_0x3c9c('0x11')]?_0x467c07[_0x3c9c('0x11')]['id']:0x0,_0x467c07[_0x3c9c('0x12')]?_0x467c07['interaction']['id']:0x0);if(_0x2de024[_0x3c9c('0x10')][_0x330a02]){_0x2de024[_0x3c9c('0x10')][_0x330a02]['emit'](_0x3c9c('0x3e'));}return _0x4ad93b({'code':0xc8,'message':_0x467c07});}catch(_0x375103){logger[_0x3c9c('0x37')](_0x375103[_0x3c9c('0x38')]);return _0x1d038c(_0x309d96[_0x3c9c('0x37')](0x1f4,_0x375103));}}logger['error'](_0x3c9c('0x43'));return _0x1d038c(_0x309d96[_0x3c9c('0x37')](0x1f4,_0x3c9c('0x43')));});},'AgentCapacity':function(_0x242878){var _0x45d210=this;return new Promise(function(_0x5c6ed5,_0x59ee79){if(_0x2de024[_0x3c9c('0x3b')]['hasOwnProperty'](_0x242878['id'])){for(var _0x275c78 in _0x242878[_0x3c9c('0x44')]){if(_0x242878['capacity']['hasOwnProperty'](_0x275c78)){if(_0x2de024[_0x3c9c('0x3b')][_0x242878['id']][_0x3c9c('0x45')](_0x275c78+_0x3c9c('0x46'))){_0x2de024['agents'][_0x242878['id']][_0x275c78+_0x3c9c('0x46')]=parseInt(_0x242878[_0x3c9c('0x44')][_0x275c78],0xa);}}}_0x2de024[_0x3c9c('0x3b')][_0x242878['id']]['updateRealtime']();return _0x5c6ed5({'code':0xc8,'message':_0x2de024['agents'][_0x242878['id']]});}else{return _0x59ee79(_0x45d210[_0x3c9c('0x37')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x575dd2){return new Promise(function(_0x2af05b,_0x52289d){var _0x3977bf=_[_0x3c9c('0x47')](_0x2de024[_0x3c9c('0x3b')]);_0x2af05b({'count':_0x3977bf[_0x3c9c('0x15')],'rows':_0x3977bf});});},'ChatQueues':function(_0x475884){return new Promise(function(_0x4f87b7,_0x208716){var _0x40c42e=[];for(var _0x2f9c35 in _0x2de024[_0x3c9c('0x48')]){if(_0x2de024[_0x3c9c('0x48')]['hasOwnProperty'](_0x2f9c35)){var _0x3e92e8=_0x2de024[_0x3c9c('0x48')][_0x2f9c35];var _0x1e8a87={'id':_0x3e92e8['id'],'available':_0x3e92e8['available'],'loggedIn':_0x3e92e8[_0x3c9c('0x49')],'name':_0x3e92e8[_0x3c9c('0x4a')],'paused':_0x3e92e8['paused'],'waiting':_0x3e92e8[_0x3c9c('0x4b')]};_0x40c42e['push'](_0x1e8a87);}}_0x4f87b7({'count':_0x40c42e[_0x3c9c('0x15')],'rows':_0x40c42e});});},'MailQueues':function(_0x1f8f80){return new Promise(function(_0x53e151,_0x361638){var _0x4b5cfa=[];for(var _0x4c086a in _0x2de024[_0x3c9c('0x4c')]){if(_0x2de024[_0x3c9c('0x4c')]['hasOwnProperty'](_0x4c086a)){var _0x4cded5=_0x2de024[_0x3c9c('0x4c')][_0x4c086a];var _0x1314cd={'id':_0x4cded5['id'],'available':_0x4cded5['available'],'loggedIn':_0x4cded5[_0x3c9c('0x49')],'name':_0x4cded5[_0x3c9c('0x4a')],'paused':_0x4cded5[_0x3c9c('0x4d')],'waiting':_0x4cded5[_0x3c9c('0x4b')]};_0x4b5cfa[_0x3c9c('0x1b')](_0x1314cd);}}_0x53e151({'count':_0x4b5cfa[_0x3c9c('0x15')],'rows':_0x4b5cfa});});},'OpenchannelQueues':function(_0x459438){return new Promise(function(_0x13c09c,_0x16f5d5){var _0x68efda=[];for(var _0x587037 in _0x2de024[_0x3c9c('0x4e')]){if(_0x2de024[_0x3c9c('0x4e')]['hasOwnProperty'](_0x587037)){var _0xd8a2a8=_0x2de024[_0x3c9c('0x4e')][_0x587037];var _0x48a5f2={'id':_0xd8a2a8['id'],'available':_0xd8a2a8[_0x3c9c('0x4f')],'loggedIn':_0xd8a2a8[_0x3c9c('0x49')],'name':_0xd8a2a8[_0x3c9c('0x4a')],'paused':_0xd8a2a8[_0x3c9c('0x4d')],'waiting':_0xd8a2a8[_0x3c9c('0x4b')]};_0x68efda[_0x3c9c('0x1b')](_0x48a5f2);}}_0x13c09c({'count':_0x68efda[_0x3c9c('0x15')],'rows':_0x68efda});});},'SmsQueues':function(_0x50fa97){return new Promise(function(_0x5b2533,_0x9609f3){var _0x56dc52=[];for(var _0x249fb6 in _0x2de024[_0x3c9c('0x50')]){if(_0x2de024[_0x3c9c('0x50')][_0x3c9c('0x45')](_0x249fb6)){var _0xbcab93=_0x2de024['smsQueues'][_0x249fb6];var _0x4134a1={'id':_0xbcab93['id'],'available':_0xbcab93[_0x3c9c('0x4f')],'loggedIn':_0xbcab93['loggedIn'],'name':_0xbcab93[_0x3c9c('0x4a')],'paused':_0xbcab93[_0x3c9c('0x4d')],'waiting':_0xbcab93['waiting']};_0x56dc52[_0x3c9c('0x1b')](_0x4134a1);}}_0x5b2533({'count':_0x56dc52['length'],'rows':_0x56dc52});});},'FaxQueues':function(_0x3d4bd4){return new Promise(function(_0x520f81,_0x304313){var _0x22602f=[];for(var _0x22d13d in _0x2de024[_0x3c9c('0x51')]){if(_0x2de024[_0x3c9c('0x51')][_0x3c9c('0x45')](_0x22d13d)){var _0x208348=_0x2de024[_0x3c9c('0x51')][_0x22d13d];var _0x4d6ea4={'id':_0x208348['id'],'available':_0x208348[_0x3c9c('0x4f')],'loggedIn':_0x208348[_0x3c9c('0x49')],'name':_0x208348[_0x3c9c('0x4a')],'paused':_0x208348['paused'],'waiting':_0x208348[_0x3c9c('0x4b')]};_0x22602f[_0x3c9c('0x1b')](_0x4d6ea4);}}_0x520f81({'count':_0x22602f['length'],'rows':_0x22602f});});},'WhatsappQueues':function(_0x4d9364){return new Promise(function(_0x418445,_0x19d615){var _0x23f830=[];for(var _0x1ef22c in _0x2de024[_0x3c9c('0x52')]){if(_0x2de024[_0x3c9c('0x52')][_0x3c9c('0x45')](_0x1ef22c)){var _0x47388e=_0x2de024[_0x3c9c('0x52')][_0x1ef22c];var _0x4ecf12={'id':_0x47388e['id'],'available':_0x47388e['available'],'loggedIn':_0x47388e[_0x3c9c('0x49')],'name':_0x47388e[_0x3c9c('0x4a')],'paused':_0x47388e[_0x3c9c('0x4d')],'waiting':_0x47388e[_0x3c9c('0x4b')]};_0x23f830[_0x3c9c('0x1b')](_0x4ecf12);}}_0x418445({'count':_0x23f830[_0x3c9c('0x15')],'rows':_0x23f830});});},'ChatQueuesWaitingInteractions':function(_0x12d508){return new Promise(function(_0x29f920,_0x48c742){var _0x3e2652=_[_0x3c9c('0x47')](_0x2de024['chatQueuesWaitingInteractions']);_0x29f920({'count':_0x3e2652['length'],'rows':_0x3e2652});});},'MailQueuesWaitingInteractions':function(_0x24215c){return new Promise(function(_0x355eb8,_0x52e920){var _0x46a358=_[_0x3c9c('0x47')](_0x2de024['mailQueuesWaitingInteractions']);_0x355eb8({'count':_0x46a358['length'],'rows':_0x46a358});});},'OpenchannelQueuesWaitingInteractions':function(_0x5646d9){return new Promise(function(_0x566864,_0x8d4ff3){var _0x5f26d7=_[_0x3c9c('0x47')](_0x2de024[_0x3c9c('0x53')]);_0x566864({'count':_0x5f26d7[_0x3c9c('0x15')],'rows':_0x5f26d7});});},'SmsQueuesWaitingInteractions':function(_0x4365c8){return new Promise(function(_0xd1a10e,_0xca13a6){var _0x34ddea=_['values'](_0x2de024['smsQueuesWaitingInteractions']);_0xd1a10e({'count':_0x34ddea[_0x3c9c('0x15')],'rows':_0x34ddea});});},'FaxQueuesWaitingInteractions':function(_0xbe8435){return new Promise(function(_0x6ac35f,_0x5b8f22){var _0x4fd86a=_[_0x3c9c('0x47')](_0x2de024['faxQueuesWaitingInteractions']);_0x6ac35f({'count':_0x4fd86a['length'],'rows':_0x4fd86a});});},'WhatsappQueuesWaitingInteractions':function(_0x1ccec5){return new Promise(function(_0x90224f,_0x22ee5c){var _0x57a120=_['values'](_0x2de024[_0x3c9c('0x54')]);_0x90224f({'count':_0x57a120[_0x3c9c('0x15')],'rows':_0x57a120});});}};var _0x289456=jayson[_0x3c9c('0x55')](_0x1940fa)['http']();_0x289456['on'](_0x3c9c('0x37'),function(_0x5b91c6){logger[_0x3c9c('0x37')](JSON['stringify'](_0x5b91c6));return _0x541830(_0x5b91c6);});_0x289456[_0x3c9c('0x56')](0x232c,'127.0.0.1',function(){console[_0x3c9c('0x57')](_0x3c9c('0x58'),0x232c);return _0x1def09(_0x3c9c('0x59')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index f112bfd..72c0e41 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 _0x311e=['\x20|\x20','when','log','stack','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','error','catch','condition','stop','length','Command','format','iftime\x20%s','then','message','indexOf','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join'];(function(_0x2a04d5,_0x22c053){var _0x3545c8=function(_0x92fbbd){while(--_0x92fbbd){_0x2a04d5['push'](_0x2a04d5['shift']());}};_0x3545c8(++_0x22c053);}(_0x311e,0x74));var _0xe311=function(_0x4fe1d9,_0x16ac2d){_0x4fe1d9=_0x4fe1d9-0x0;var _0x447853=_0x311e[_0x4fe1d9];return _0x447853;};'use strict';var util=require('util');var BPromise=require(_0xe311('0x0'));var jayson=require(_0xe311('0x1'));var _=require(_0xe311('0x2'));var logger=require(_0xe311('0x3'))(_0xe311('0x4'));var client=jayson[_0xe311('0x5')]['http']({'port':0x232a});function request(_0x318abf,_0x37285){return new BPromise(function(_0xbfd9cb,_0x5456ae){return client[_0xe311('0x6')](_0x318abf,_0x37285)['then'](function(_0x1b571b){if(_0x1b571b[_0xe311('0x7')]){return _0x5456ae(_0x1b571b['error']['message']);}else{return _0xbfd9cb(_0x1b571b['result']);}})[_0xe311('0x8')](function(_0x5d6e4c){return _0x5456ae(_0x5d6e4c);});});}exports[_0xe311('0x9')]=function(_0x128bad,_0x5f3471,_0x3ef8f2){return function(_0x24ffd0){if(_0x3ef8f2['rules']&&!_0x3ef8f2['rules'][_0x128bad]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x128bad);return _0x24ffd0[_0xe311('0xa')]();}var _0x125d4e=[];for(var _0x194911=0x0;_0x194911<_0x5f3471[_0xe311('0xb')];_0x194911+=0x1){_0x125d4e['push'](request(_0xe311('0xc'),{'command':util[_0xe311('0xd')](_0xe311('0xe'),_0x5f3471[_0x194911])})[_0xe311('0xf')](function(_0x337f91){return _0x337f91&&_0x337f91['message']&&_0x337f91[_0xe311('0x10')][_0xe311('0x11')]('true')>=0x0?!![]:![];})[_0xe311('0x8')](function(_0x5f1ea6){logger[_0xe311('0x7')](_0xe311('0x12'),_0x128bad,_0x5f3471[_0x194911]);}));}BPromise[_0xe311('0x13')](_0x125d4e)[_0xe311('0xf')](function(_0xdafb1b){var _0x167ed9=_[_0xe311('0x14')](_0xdafb1b);logger[_0xe311('0x15')](_0xe311('0x16'),_0x128bad,_0x5f3471[_0xe311('0x17')](_0xe311('0x18')),_0x167ed9);_0x24ffd0[_0xe311('0x19')](_0x167ed9);})[_0xe311('0x8')](function(_0x498402){console[_0xe311('0x1a')](_0x498402);logger[_0xe311('0x7')](_0xe311('0x16'),_0x128bad,_0x5f3471[_0xe311('0x17')](_0xe311('0x18')),_0x498402[_0xe311('0x1b')]);_0x24ffd0[_0xe311('0xa')]();});};}; \ No newline at end of file +var _0xc93a=['push','Command','format','iftime\x20%s','then','message','indexOf','true','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','jayson/promise','lodash','../../../config/logger','routing','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length'];(function(_0xf26618,_0x2ed88d){var _0x53572a=function(_0x534818){while(--_0x534818){_0xf26618['push'](_0xf26618['shift']());}};_0x53572a(++_0x2ed88d);}(_0xc93a,0x138));var _0xac93=function(_0x4151c7,_0x2d5125){_0x4151c7=_0x4151c7-0x0;var _0x32402b=_0xc93a[_0x4151c7];return _0x32402b;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xac93('0x0'));var _=require(_0xac93('0x1'));var logger=require(_0xac93('0x2'))(_0xac93('0x3'));var client=jayson['client']['http']({'port':0x232a});function request(_0x3b1519,_0x426b72){return new BPromise(function(_0x55430d,_0x3d58c4){return client['request'](_0x3b1519,_0x426b72)['then'](function(_0x50e2cd){if(_0x50e2cd[_0xac93('0x4')]){return _0x3d58c4(_0x50e2cd[_0xac93('0x4')]['message']);}else{return _0x55430d(_0x50e2cd[_0xac93('0x5')]);}})[_0xac93('0x6')](function(_0x222357){return _0x3d58c4(_0x222357);});});}exports[_0xac93('0x7')]=function(_0x47c630,_0x2715d1,_0x4fb940){return function(_0x30df9b){if(_0x4fb940[_0xac93('0x8')]&&!_0x4fb940[_0xac93('0x8')][_0x47c630]){logger[_0xac93('0x9')](_0xac93('0xa'),_0x47c630);return _0x30df9b[_0xac93('0xb')]();}var _0x3d9fff=[];for(var _0x53fb41=0x0;_0x53fb41<_0x2715d1[_0xac93('0xc')];_0x53fb41+=0x1){_0x3d9fff[_0xac93('0xd')](request(_0xac93('0xe'),{'command':util[_0xac93('0xf')](_0xac93('0x10'),_0x2715d1[_0x53fb41])})[_0xac93('0x11')](function(_0x1d40c9){return _0x1d40c9&&_0x1d40c9[_0xac93('0x12')]&&_0x1d40c9[_0xac93('0x12')][_0xac93('0x13')](_0xac93('0x14'))>=0x0?!![]:![];})[_0xac93('0x6')](function(_0x44f8f3){logger[_0xac93('0x4')]('[%s][INTERVAL]\x20%s',_0x47c630,_0x2715d1[_0x53fb41]);}));}BPromise['all'](_0x3d9fff)[_0xac93('0x11')](function(_0x1cf1a3){var _0x23e4ea=_['some'](_0x1cf1a3);logger[_0xac93('0x9')](_0xac93('0x15'),_0x47c630,_0x2715d1['join'](_0xac93('0x16')),_0x23e4ea);_0x30df9b[_0xac93('0x17')](_0x23e4ea);})[_0xac93('0x6')](function(_0xa8d088){console[_0xac93('0x18')](_0xa8d088);logger['error'](_0xac93('0x15'),_0x47c630,_0x2715d1['join'](_0xac93('0x16')),_0xa8d088['stack']);_0x30df9b[_0xac93('0xb')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index c941031..a3ac26f 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 _0xa902=['agentringnoanswerAt','now','timeout','holdtime','ringtime','push','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','talktime','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','blind','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','format','channel','queue','membername','interface','calleridnum','connectedlinenum','then','type','agentacw','acw','acwtime','acwTimeout','CreateVoiceAgentReport','destuniqueid','debug','agentcalledAt','lastevent','called','connectedlinename','info','uniqueid','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout'];(function(_0x155801,_0x35dc8d){var _0x341582=function(_0x5688db){while(--_0x5688db){_0x155801['push'](_0x155801['shift']());}};_0x341582(++_0x35dc8d);}(_0xa902,0x8d));var _0x2a90=function(_0x2c0529,_0x5ec1ca){_0x2c0529=_0x2c0529-0x0;var _0x3d990f=_0xa902[_0x2c0529];return _0x3d990f;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var utils=require(_0x2a90('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3a1839,_0x1b4117){utils['info'](util[_0x2a90('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3a1839['uniqueid'],_0x3a1839[_0x2a90('0x4')],_0x3a1839[_0x2a90('0x5')],_0x3a1839[_0x2a90('0x6')],_0x3a1839[_0x2a90('0x7')],_0x3a1839[_0x2a90('0x8')],_0x3a1839[_0x2a90('0x9')],_0x3a1839['lastevent']));if(_0x3a1839[_0x2a90('0x5')]){utils['getVoiceQueueByName'](_0x3a1839['queue'])[_0x2a90('0xa')](function(_0x3dfc8f){if(_0x3dfc8f){_0x3a1839[_0x2a90('0xb')]=_0x3dfc8f[_0x2a90('0xb')];_0x3a1839[_0x2a90('0xc')]=_0x3a1839['agentcomplete']?_0x3dfc8f[_0x2a90('0xd')]:![];_0x3a1839[_0x2a90('0xe')]=_0x3a1839[_0x2a90('0xc')]?_0x3dfc8f[_0x2a90('0xf')]:0x0;}utils['request'](_0x2a90('0x10'),_0x3a1839);});}else{utils['request'](_0x2a90('0x10'),_0x3a1839);}if(_0x1b4117){delete transfers[_0x3a1839['uniqueid']];}else{delete agents[_0x3a1839[_0x2a90('0x11')]];}}exports['agentcalled']=function(_0x407ce5){try{utils[_0x2a90('0x12')](util[_0x2a90('0x3')]('[%s][agents][agentcalled]',_0x407ce5['uniqueid']),_0x407ce5);agents[_0x407ce5['destuniqueid']]=_0x407ce5;agents[_0x407ce5[_0x2a90('0x11')]][_0x2a90('0x13')]=utils['now']();agents[_0x407ce5[_0x2a90('0x11')]][_0x2a90('0x14')]=_0x2a90('0x15');agents[_0x407ce5[_0x2a90('0x11')]][_0x2a90('0x9')]=null;agents[_0x407ce5[_0x2a90('0x11')]][_0x2a90('0x16')]=null;utils[_0x2a90('0x17')](util[_0x2a90('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x407ce5[_0x2a90('0x18')],agents[_0x407ce5[_0x2a90('0x11')]][_0x2a90('0x6')],_0x407ce5['destuniqueid']));}catch(_0x1facfb){utils[_0x2a90('0x19')](util[_0x2a90('0x3')](_0x2a90('0x1a'),_0x407ce5[_0x2a90('0x18')]),_0x1facfb);}};exports[_0x2a90('0x1b')]=function(_0x312cd5){try{if(!_[_0x2a90('0x1c')](agents[_0x312cd5[_0x2a90('0x11')]])){utils[_0x2a90('0x12')](util[_0x2a90('0x3')](_0x2a90('0x1d'),_0x312cd5['uniqueid']),_0x312cd5);utils[_0x2a90('0x17')](util[_0x2a90('0x3')](_0x2a90('0x1e'),_0x312cd5[_0x2a90('0x18')],agents[_0x312cd5['destuniqueid']][_0x2a90('0x6')],_0x312cd5[_0x2a90('0x11')]));agents[_0x312cd5['destuniqueid']][_0x2a90('0x1b')]=!![];agents[_0x312cd5[_0x2a90('0x11')]][_0x2a90('0x1f')]=utils[_0x2a90('0x20')]();agents[_0x312cd5[_0x2a90('0x11')]][_0x2a90('0x14')]=_0x2a90('0x21');agents[_0x312cd5[_0x2a90('0x11')]]['reason']=_0x2a90('0x21');agents[_0x312cd5[_0x2a90('0x11')]][_0x2a90('0x22')]=_0x312cd5[_0x2a90('0x23')]?parseInt(_0x312cd5[_0x2a90('0x23')])/0x3e8:0x0;agents[_0x312cd5['destuniqueid']]['talktime']=0x0;unanswered[_0x2a90('0x24')](_0x312cd5['destuniqueid']);}}catch(_0x53391e){utils['error'](util[_0x2a90('0x3')](_0x2a90('0x1d'),_0x312cd5['uniqueid']),_0x53391e);}};exports['queuecallerabandon']=function(_0x1add9a){try{_['forIn'](agents,function(_0x35570e,_0x6892e1){if(_0x35570e[_0x2a90('0x18')]==_0x1add9a[_0x2a90('0x18')]&&!_[_0x2a90('0x25')](unanswered,_0x35570e[_0x2a90('0x11')])){utils[_0x2a90('0x12')](util['format'](_0x2a90('0x26'),_0x1add9a[_0x2a90('0x18')]),_0x1add9a);utils[_0x2a90('0x17')](util['format'](_0x2a90('0x27'),_0x1add9a[_0x2a90('0x18')],_0x35570e[_0x2a90('0x6')],_0x35570e[_0x2a90('0x11')]));_0x35570e['agentringnoanswer']=!![];_0x35570e[_0x2a90('0x1f')]=utils[_0x2a90('0x20')]();_0x35570e[_0x2a90('0x14')]=_0x2a90('0x28');_0x35570e[_0x2a90('0x29')]=_0x2a90('0x28');_0x35570e['holdtime']=_0x1add9a[_0x2a90('0x22')];_0x35570e[_0x2a90('0x2a')]=0x0;writeDB(_0x35570e);}});}catch(_0x1bdebf){utils[_0x2a90('0x19')](util['format'](_0x2a90('0x26'),_0x1add9a[_0x2a90('0x18')]),_0x1bdebf);}};exports['agentconnect']=function(_0x3e5002){try{if(agents[_0x3e5002[_0x2a90('0x11')]]){utils['debug'](util['format'](_0x2a90('0x2b'),_0x3e5002[_0x2a90('0x18')]),_0x3e5002);utils[_0x2a90('0x17')](util['format'](_0x2a90('0x2c'),_0x3e5002['uniqueid'],agents[_0x3e5002[_0x2a90('0x11')]]['membername'],_0x3e5002[_0x2a90('0x11')]));agents[_0x3e5002['destuniqueid']]['agentconnectAt']=utils[_0x2a90('0x20')]();agents[_0x3e5002['destuniqueid']][_0x2a90('0x9')]=_0x3e5002[_0x2a90('0x9')];agents[_0x3e5002[_0x2a90('0x11')]]['connectedlinename']=_0x3e5002[_0x2a90('0x16')];agents[_0x3e5002[_0x2a90('0x11')]][_0x2a90('0x22')]=_0x3e5002['ringtime'];agents[_0x3e5002[_0x2a90('0x11')]][_0x2a90('0x14')]=_0x2a90('0x2d');_['forIn'](agents,function(_0x1aa096,_0x1db9d8){if(_0x1aa096['destuniqueid']!=_0x3e5002[_0x2a90('0x11')]&&_0x1aa096[_0x2a90('0x18')]==_0x3e5002[_0x2a90('0x18')]){_0x1aa096[_0x2a90('0x2a')]=0x0;_0x1aa096[_0x2a90('0x22')]=_0x3e5002[_0x2a90('0x23')];_0x1aa096[_0x2a90('0x1b')]=!![];_0x1aa096[_0x2a90('0x1f')]=utils[_0x2a90('0x20')]();_0x1aa096[_0x2a90('0x14')]=_0x2a90('0x2e');_0x1aa096[_0x2a90('0x29')]=_0x2a90('0x2e');_0x1aa096[_0x2a90('0x2f')]=_0x3e5002['destuniqueid'];_0x1aa096[_0x2a90('0x30')]=_0x3e5002[_0x2a90('0x6')];writeDB(_0x1aa096);}});}}catch(_0x528b41){utils[_0x2a90('0x19')](util[_0x2a90('0x3')](_0x2a90('0x2b'),_0x3e5002[_0x2a90('0x18')]),_0x528b41);}};exports[_0x2a90('0x31')]=function(_0x54b290){try{if(!_[_0x2a90('0x1c')](agents[_0x54b290['destuniqueid']])){utils[_0x2a90('0x12')](util['format'](_0x2a90('0x32'),_0x54b290[_0x2a90('0x18')]),_0x54b290);utils[_0x2a90('0x17')](util[_0x2a90('0x3')](_0x2a90('0x33'),_0x54b290[_0x2a90('0x18')],agents[_0x54b290[_0x2a90('0x11')]]['membername'],_0x54b290['destuniqueid']));agents[_0x54b290[_0x2a90('0x11')]][_0x2a90('0x31')]=!![];agents[_0x54b290[_0x2a90('0x11')]][_0x2a90('0x34')]=utils[_0x2a90('0x20')]();agents[_0x54b290[_0x2a90('0x11')]][_0x2a90('0x2a')]=utils[_0x2a90('0x35')](agents[_0x54b290['destuniqueid']][_0x2a90('0x34')],agents[_0x54b290['destuniqueid']][_0x2a90('0x36')]);agents[_0x54b290[_0x2a90('0x11')]]['reason']=_0x54b290[_0x2a90('0x29')];agents[_0x54b290[_0x2a90('0x11')]][_0x2a90('0x14')]=_0x2a90('0x37');writeDB(agents[_0x54b290[_0x2a90('0x11')]]);}}catch(_0x43a931){utils[_0x2a90('0x19')](util['format']('[%s][agents][agentcomplete]',_0x54b290[_0x2a90('0x18')]),_0x43a931);}};exports[_0x2a90('0x38')]=function(_0x42c890){try{if(!_[_0x2a90('0x1c')](agents[_0x42c890[_0x2a90('0x39')]])){utils['debug'](util['format'](_0x2a90('0x3a'),_0x42c890[_0x2a90('0x18')]),_0x42c890);utils['info'](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x42c890[_0x2a90('0x18')],agents[_0x42c890['transfereruniqueid']][_0x2a90('0x6')],agents[_0x42c890[_0x2a90('0x39')]][_0x2a90('0x18')]));agents[_0x42c890[_0x2a90('0x39')]][_0x2a90('0x3b')]=!![];agents[_0x42c890[_0x2a90('0x39')]]['transfertype']=_0x2a90('0x3c');agents[_0x42c890[_0x2a90('0x39')]]['transferexten']=_0x42c890[_0x2a90('0x3d')];agents[_0x42c890['transfereruniqueid']]['transferuniqueid']=agents[_0x42c890[_0x2a90('0x39')]][_0x2a90('0x18')];}}catch(_0x5819ab){utils['error'](util[_0x2a90('0x3')]('[%s][agents][blindtransfer]',_0x42c890[_0x2a90('0x18')]),_0x5819ab);}};exports[_0x2a90('0x3e')]=function(_0x561bae){try{utils[_0x2a90('0x12')](util[_0x2a90('0x3')](_0x2a90('0x3f'),_0x561bae['origtransfereruniqueid']),_0x561bae);if(_0x561bae[_0x2a90('0x40')]==_0x561bae[_0x2a90('0x41')]){if(!_['isNil'](agents[_0x561bae['secondtransfereruniqueid']])){utils[_0x2a90('0x17')](util[_0x2a90('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x561bae[_0x2a90('0x40')],agents[_0x561bae['secondtransfereruniqueid']][_0x2a90('0x6')]));agents[_0x561bae['secondtransfereruniqueid']][_0x2a90('0x3b')]=!![];agents[_0x561bae[_0x2a90('0x42')]][_0x2a90('0x43')]='ATTENDED';agents[_0x561bae['secondtransfereruniqueid']]['transferexten']=_0x561bae[_0x2a90('0x44')];agents[_0x561bae[_0x2a90('0x42')]][_0x2a90('0x45')]=_0x561bae[_0x2a90('0x40')];}if(_0x561bae[_0x2a90('0x46')]&&agents[_0x561bae[_0x2a90('0x46')]]){agents[_0x561bae[_0x2a90('0x46')]][_0x2a90('0x47')]=0x1;transfers[_0x561bae[_0x2a90('0x46')]]=_[_0x2a90('0x48')](agents[_0x561bae[_0x2a90('0x46')]]);transfers[_0x561bae[_0x2a90('0x46')]][_0x2a90('0x8')]=agents[_0x561bae['secondtransfereruniqueid']]['calleridnum'];transfers[_0x561bae['transfereeuniqueid']][_0x2a90('0x49')]=agents[_0x561bae[_0x2a90('0x42')]][_0x2a90('0x49')];transfers[_0x561bae[_0x2a90('0x46')]][_0x2a90('0x13')]=utils[_0x2a90('0x20')]();transfers[_0x561bae[_0x2a90('0x46')]][_0x2a90('0x36')]=utils[_0x2a90('0x20')]();transfers[_0x561bae[_0x2a90('0x46')]][_0x2a90('0x22')]=0x0;transfers[_0x561bae[_0x2a90('0x46')]][_0x2a90('0x47')]=0x2;}}else if(_0x561bae[_0x2a90('0x42')]==_0x561bae[_0x2a90('0x4a')]){if(!_[_0x2a90('0x1c')](agents[_0x561bae['origtransfereruniqueid']])){utils[_0x2a90('0x17')](util['format'](_0x2a90('0x4b'),_0x561bae[_0x2a90('0x40')],agents[_0x561bae[_0x2a90('0x40')]][_0x2a90('0x6')]));agents[_0x561bae[_0x2a90('0x40')]][_0x2a90('0x3b')]=!![];agents[_0x561bae[_0x2a90('0x40')]]['transfertype']=_0x2a90('0x4c');agents[_0x561bae[_0x2a90('0x40')]][_0x2a90('0x4d')]=_0x561bae['secondtransfererexten'];agents[_0x561bae[_0x2a90('0x40')]][_0x2a90('0x45')]=_0x561bae[_0x2a90('0x42')];}if(_0x561bae[_0x2a90('0x4e')]&&agents[_0x561bae['transfertargetuniqueid']]){agents[_0x561bae[_0x2a90('0x4e')]]['agententerreason']=0x1;transfers[_0x561bae[_0x2a90('0x4e')]]=_[_0x2a90('0x48')](agents[_0x561bae[_0x2a90('0x4e')]]);transfers[_0x561bae[_0x2a90('0x4e')]][_0x2a90('0x8')]=agents[_0x561bae[_0x2a90('0x40')]]['calleridnum'];transfers[_0x561bae[_0x2a90('0x4e')]][_0x2a90('0x49')]=agents[_0x561bae[_0x2a90('0x40')]][_0x2a90('0x49')];transfers[_0x561bae[_0x2a90('0x4e')]][_0x2a90('0x13')]=utils[_0x2a90('0x20')]();transfers[_0x561bae[_0x2a90('0x4e')]][_0x2a90('0x36')]=utils['now']();transfers[_0x561bae[_0x2a90('0x4e')]][_0x2a90('0x22')]=0x0;transfers[_0x561bae[_0x2a90('0x4e')]]['agententerreason']=0x2;}}}catch(_0x4404c1){utils[_0x2a90('0x19')](util[_0x2a90('0x3')](_0x2a90('0x3f'),_0x561bae[_0x2a90('0x40')]),_0x4404c1);}};exports['hangup']=function(_0x1bf94c){try{utils['debug'](util['format'](_0x2a90('0x4f'),_0x1bf94c['uniqueid']),_0x1bf94c);if(agents[_0x1bf94c['uniqueid']]&&agents[_0x1bf94c[_0x2a90('0x18')]]['reason']===_0x2a90('0x21')){if(_0x1bf94c[_0x2a90('0x50')]==='21'){agents[_0x1bf94c['uniqueid']]['reason']=_0x2a90('0x51');agents[_0x1bf94c['uniqueid']]['lastevent']=_0x2a90('0x51');}utils[_0x2a90('0x17')](util[_0x2a90('0x3')](_0x2a90('0x52'),_0x1bf94c['uniqueid'],agents[_0x1bf94c['uniqueid']][_0x2a90('0x6')],agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x29')],agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x14')]));writeDB(agents[_0x1bf94c[_0x2a90('0x18')]]);var _0x3f4d12=unanswered[_0x2a90('0x53')](_0x1bf94c[_0x2a90('0x18')]);if(_0x3f4d12>-0x1){unanswered[_0x2a90('0x54')](_0x3f4d12,0x1);}}if(transfers[_0x1bf94c[_0x2a90('0x18')]]){transfers[_0x1bf94c[_0x2a90('0x18')]]['agentcomplete']=!![];transfers[_0x1bf94c[_0x2a90('0x18')]]['agentcompleteAt']=utils[_0x2a90('0x20')]();transfers[_0x1bf94c['uniqueid']][_0x2a90('0x2a')]=utils['diffTime'](transfers[_0x1bf94c['uniqueid']][_0x2a90('0x34')],transfers[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x36')]);transfers[_0x1bf94c[_0x2a90('0x18')]]['reason']='agent';transfers[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x14')]=_0x2a90('0x37');utils[_0x2a90('0x17')](util[_0x2a90('0x3')](_0x2a90('0x52'),_0x1bf94c[_0x2a90('0x18')],transfers[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x6')],transfers[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x29')],transfers[_0x1bf94c[_0x2a90('0x18')]]['lastevent']));writeDB(transfers[_0x1bf94c[_0x2a90('0x18')]],!![]);}if(agents[_0x1bf94c[_0x2a90('0x18')]]&&agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x36')]){agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x31')]=!![];agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x34')]=utils['now']();agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x2a')]=utils['diffTime'](agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x34')],agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x36')]);agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x29')]=agents[_0x1bf94c['uniqueid']][_0x2a90('0x3b')]?_0x2a90('0x3b'):_0x2a90('0x55');agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x14')]=_0x2a90('0x37');utils[_0x2a90('0x17')](util[_0x2a90('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1bf94c[_0x2a90('0x18')],agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x6')],agents[_0x1bf94c[_0x2a90('0x18')]][_0x2a90('0x29')],agents[_0x1bf94c[_0x2a90('0x18')]]['lastevent']));writeDB(agents[_0x1bf94c[_0x2a90('0x18')]]);}}catch(_0x44ce8d){utils[_0x2a90('0x19')](util['format'](_0x2a90('0x4f'),_0x1bf94c[_0x2a90('0x18')]),_0x44ce8d);}}; \ No newline at end of file +var _0x84a0=['transferexten','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','complete','lodash','util','./utils','info','format','channel','queue','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','reason','timeout','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid'];(function(_0x503ffd,_0x8ecde){var _0x160437=function(_0x2d45dd){while(--_0x2d45dd){_0x503ffd['push'](_0x503ffd['shift']());}};_0x160437(++_0x8ecde);}(_0x84a0,0x66));var _0x084a=function(_0x5aa8ac,_0x37f6e8){_0x5aa8ac=_0x5aa8ac-0x0;var _0x4b382d=_0x84a0[_0x5aa8ac];return _0x4b382d;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var utils=require(_0x084a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1fff7f,_0x483bfa){utils[_0x084a('0x3')](util[_0x084a('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1fff7f['uniqueid'],_0x1fff7f[_0x084a('0x5')],_0x1fff7f[_0x084a('0x6')],_0x1fff7f['membername'],_0x1fff7f[_0x084a('0x7')],_0x1fff7f[_0x084a('0x8')],_0x1fff7f[_0x084a('0x9')],_0x1fff7f[_0x084a('0xa')]));if(_0x1fff7f[_0x084a('0x6')]){utils['getVoiceQueueByName'](_0x1fff7f[_0x084a('0x6')])[_0x084a('0xb')](function(_0x8198ad){if(_0x8198ad){_0x1fff7f[_0x084a('0xc')]=_0x8198ad[_0x084a('0xc')];_0x1fff7f['agentacw']=_0x1fff7f['agentcomplete']?_0x8198ad[_0x084a('0xd')]:![];_0x1fff7f[_0x084a('0xe')]=_0x1fff7f[_0x084a('0xf')]?_0x8198ad[_0x084a('0x10')]:0x0;}utils[_0x084a('0x11')]('CreateVoiceAgentReport',_0x1fff7f);});}else{utils['request'](_0x084a('0x12'),_0x1fff7f);}if(_0x483bfa){delete transfers[_0x1fff7f[_0x084a('0x13')]];}else{delete agents[_0x1fff7f[_0x084a('0x14')]];}}exports[_0x084a('0x15')]=function(_0x1bdfb8){try{utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x17'),_0x1bdfb8['uniqueid']),_0x1bdfb8);agents[_0x1bdfb8[_0x084a('0x14')]]=_0x1bdfb8;agents[_0x1bdfb8['destuniqueid']][_0x084a('0x18')]=utils[_0x084a('0x19')]();agents[_0x1bdfb8[_0x084a('0x14')]][_0x084a('0xa')]=_0x084a('0x1a');agents[_0x1bdfb8['destuniqueid']][_0x084a('0x9')]=null;agents[_0x1bdfb8['destuniqueid']][_0x084a('0x1b')]=null;utils[_0x084a('0x3')](util['format'](_0x084a('0x1c'),_0x1bdfb8[_0x084a('0x13')],agents[_0x1bdfb8[_0x084a('0x14')]][_0x084a('0x1d')],_0x1bdfb8[_0x084a('0x14')]));}catch(_0x145636){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x17'),_0x1bdfb8[_0x084a('0x13')]),_0x145636);}};exports[_0x084a('0x1f')]=function(_0x279e25){try{if(!_[_0x084a('0x20')](agents[_0x279e25[_0x084a('0x14')]])){utils[_0x084a('0x16')](util['format'](_0x084a('0x21'),_0x279e25[_0x084a('0x13')]),_0x279e25);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x22'),_0x279e25['uniqueid'],agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x1d')],_0x279e25[_0x084a('0x14')]));agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x1f')]=!![];agents[_0x279e25[_0x084a('0x14')]]['agentringnoanswerAt']=utils[_0x084a('0x19')]();agents[_0x279e25[_0x084a('0x14')]][_0x084a('0xa')]='timeout';agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x23')]=_0x084a('0x24');agents[_0x279e25['destuniqueid']]['holdtime']=_0x279e25['ringtime']?parseInt(_0x279e25['ringtime'])/0x3e8:0x0;agents[_0x279e25[_0x084a('0x14')]]['talktime']=0x0;unanswered['push'](_0x279e25['destuniqueid']);}}catch(_0x3b8176){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x21'),_0x279e25[_0x084a('0x13')]),_0x3b8176);}};exports[_0x084a('0x25')]=function(_0x378de6){try{_[_0x084a('0x26')](agents,function(_0x5e6ea8,_0x2ed3cd){if(_0x5e6ea8[_0x084a('0x13')]==_0x378de6['uniqueid']&&!_[_0x084a('0x27')](unanswered,_0x5e6ea8[_0x084a('0x14')])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x28'),_0x378de6[_0x084a('0x13')]),_0x378de6);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x29'),_0x378de6[_0x084a('0x13')],_0x5e6ea8[_0x084a('0x1d')],_0x5e6ea8[_0x084a('0x14')]));_0x5e6ea8[_0x084a('0x1f')]=!![];_0x5e6ea8['agentringnoanswerAt']=utils['now']();_0x5e6ea8[_0x084a('0xa')]=_0x084a('0x2a');_0x5e6ea8[_0x084a('0x23')]=_0x084a('0x2a');_0x5e6ea8[_0x084a('0x2b')]=_0x378de6['holdtime'];_0x5e6ea8[_0x084a('0x2c')]=0x0;writeDB(_0x5e6ea8);}});}catch(_0x1b56ad){utils[_0x084a('0x1e')](util['format'](_0x084a('0x28'),_0x378de6[_0x084a('0x13')]),_0x1b56ad);}};exports[_0x084a('0x2d')]=function(_0x4c4c90){try{if(agents[_0x4c4c90['destuniqueid']]){utils['debug'](util[_0x084a('0x4')](_0x084a('0x2e'),_0x4c4c90[_0x084a('0x13')]),_0x4c4c90);utils['info'](util[_0x084a('0x4')](_0x084a('0x2f'),_0x4c4c90[_0x084a('0x13')],agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x1d')],_0x4c4c90[_0x084a('0x14')]));agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x9')]=_0x4c4c90[_0x084a('0x9')];agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x1b')]=_0x4c4c90[_0x084a('0x1b')];agents[_0x4c4c90['destuniqueid']][_0x084a('0x2b')]=_0x4c4c90[_0x084a('0x31')];agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0xa')]=_0x084a('0x32');_[_0x084a('0x26')](agents,function(_0xa7b652,_0x183e10){if(_0xa7b652[_0x084a('0x14')]!=_0x4c4c90['destuniqueid']&&_0xa7b652[_0x084a('0x13')]==_0x4c4c90[_0x084a('0x13')]){_0xa7b652[_0x084a('0x2c')]=0x0;_0xa7b652[_0x084a('0x2b')]=_0x4c4c90[_0x084a('0x31')];_0xa7b652[_0x084a('0x1f')]=!![];_0xa7b652['agentringnoanswerAt']=utils[_0x084a('0x19')]();_0xa7b652[_0x084a('0xa')]='answered_elsewhere';_0xa7b652[_0x084a('0x23')]=_0x084a('0x33');_0xa7b652[_0x084a('0x34')]=_0x4c4c90['destuniqueid'];_0xa7b652[_0x084a('0x35')]=_0x4c4c90[_0x084a('0x1d')];writeDB(_0xa7b652);}});}}catch(_0x4fe9c2){utils[_0x084a('0x1e')](util[_0x084a('0x4')]('[%s][agents][agentconnect]',_0x4c4c90['uniqueid']),_0x4fe9c2);}};exports[_0x084a('0x36')]=function(_0x17a8d4){try{if(!_[_0x084a('0x20')](agents[_0x17a8d4[_0x084a('0x14')]])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x37'),_0x17a8d4[_0x084a('0x13')]),_0x17a8d4);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x38'),_0x17a8d4['uniqueid'],agents[_0x17a8d4['destuniqueid']][_0x084a('0x1d')],_0x17a8d4[_0x084a('0x14')]));agents[_0x17a8d4[_0x084a('0x14')]]['agentcomplete']=!![];agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x39')]=utils[_0x084a('0x19')]();agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x2c')]=utils['diffTime'](agents[_0x17a8d4[_0x084a('0x14')]]['agentcompleteAt'],agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x30')]);agents[_0x17a8d4[_0x084a('0x14')]]['reason']=_0x17a8d4['reason'];agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0xa')]='complete';writeDB(agents[_0x17a8d4[_0x084a('0x14')]]);}}catch(_0x2c2c2e){utils[_0x084a('0x1e')](util[_0x084a('0x4')]('[%s][agents][agentcomplete]',_0x17a8d4[_0x084a('0x13')]),_0x2c2c2e);}};exports[_0x084a('0x3a')]=function(_0x31677b){try{if(!_[_0x084a('0x20')](agents[_0x31677b['transfereruniqueid']])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x3b'),_0x31677b[_0x084a('0x13')]),_0x31677b);utils['info'](util['format'](_0x084a('0x3c'),_0x31677b[_0x084a('0x13')],agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x1d')],agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x13')]));agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x3e')]=!![];agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x3f')]=_0x084a('0x40');agents[_0x31677b[_0x084a('0x3d')]]['transferexten']=_0x31677b[_0x084a('0x41')];agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x42')]=agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x13')];}}catch(_0x1c972c){utils[_0x084a('0x1e')](util['format'](_0x084a('0x3b'),_0x31677b[_0x084a('0x13')]),_0x1c972c);}};exports[_0x084a('0x43')]=function(_0x54aa6c){try{utils['debug'](util[_0x084a('0x4')]('[%s][agents][attendedtransfer]',_0x54aa6c[_0x084a('0x44')]),_0x54aa6c);if(_0x54aa6c[_0x084a('0x44')]==_0x54aa6c['origtransfererlinkedid']){if(!_[_0x084a('0x20')](agents[_0x54aa6c['secondtransfereruniqueid']])){utils['info'](util[_0x084a('0x4')](_0x084a('0x45'),_0x54aa6c[_0x084a('0x44')],agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x1d')]));agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x3e')]=!![];agents[_0x54aa6c['secondtransfereruniqueid']][_0x084a('0x3f')]=_0x084a('0x47');agents[_0x54aa6c[_0x084a('0x46')]]['transferexten']=_0x54aa6c[_0x084a('0x48')];agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x42')]=_0x54aa6c[_0x084a('0x44')];}if(_0x54aa6c['transfereeuniqueid']&&agents[_0x54aa6c[_0x084a('0x49')]]){agents[_0x54aa6c['transfereeuniqueid']][_0x084a('0x4a')]=0x1;transfers[_0x54aa6c[_0x084a('0x49')]]=_[_0x084a('0x4b')](agents[_0x54aa6c['transfereeuniqueid']]);transfers[_0x54aa6c['transfereeuniqueid']][_0x084a('0x8')]=agents[_0x54aa6c[_0x084a('0x46')]]['calleridnum'];transfers[_0x54aa6c[_0x084a('0x49')]]['calleridname']=agents[_0x54aa6c['secondtransfereruniqueid']][_0x084a('0x4c')];transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x18')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x2b')]=0x0;transfers[_0x54aa6c['transfereeuniqueid']][_0x084a('0x4a')]=0x2;}}else if(_0x54aa6c[_0x084a('0x46')]==_0x54aa6c[_0x084a('0x4d')]){if(!_['isNil'](agents[_0x54aa6c[_0x084a('0x44')]])){utils[_0x084a('0x3')](util['format'](_0x084a('0x45'),_0x54aa6c['origtransfereruniqueid'],agents[_0x54aa6c['origtransfereruniqueid']][_0x084a('0x1d')]));agents[_0x54aa6c['origtransfereruniqueid']]['transfer']=!![];agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x3f')]=_0x084a('0x47');agents[_0x54aa6c['origtransfereruniqueid']][_0x084a('0x4e')]=_0x54aa6c[_0x084a('0x4f')];agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x42')]=_0x54aa6c[_0x084a('0x46')];}if(_0x54aa6c[_0x084a('0x50')]&&agents[_0x54aa6c[_0x084a('0x50')]]){agents[_0x54aa6c['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x54aa6c[_0x084a('0x50')]]=_[_0x084a('0x4b')](agents[_0x54aa6c['transfertargetuniqueid']]);transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x8')]=agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x8')];transfers[_0x54aa6c['transfertargetuniqueid']][_0x084a('0x4c')]=agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x4c')];transfers[_0x54aa6c['transfertargetuniqueid']]['agentcalledAt']=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x2b')]=0x0;transfers[_0x54aa6c[_0x084a('0x50')]]['agententerreason']=0x2;}}}catch(_0x22efb6){utils['error'](util['format'](_0x084a('0x51'),_0x54aa6c[_0x084a('0x44')]),_0x22efb6);}};exports[_0x084a('0x52')]=function(_0x4a2745){try{utils[_0x084a('0x16')](util['format'](_0x084a('0x53'),_0x4a2745[_0x084a('0x13')]),_0x4a2745);if(agents[_0x4a2745[_0x084a('0x13')]]&&agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]===_0x084a('0x24')){if(_0x4a2745['cause']==='21'){agents[_0x4a2745['uniqueid']][_0x084a('0x23')]=_0x084a('0x54');agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]=_0x084a('0x54');}utils[_0x084a('0x3')](util['format'](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x1d')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],agents[_0x4a2745[_0x084a('0x13')]]['lastevent']));writeDB(agents[_0x4a2745[_0x084a('0x13')]]);var _0x38b5b6=unanswered[_0x084a('0x56')](_0x4a2745[_0x084a('0x13')]);if(_0x38b5b6>-0x1){unanswered[_0x084a('0x57')](_0x38b5b6,0x1);}}if(transfers[_0x4a2745[_0x084a('0x13')]]){transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x36')]=!![];transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')]=utils['now']();transfers[_0x4a2745['uniqueid']]['talktime']=utils[_0x084a('0x58')](transfers[_0x4a2745[_0x084a('0x13')]]['agentcompleteAt'],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x30')]);transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]='agent';transfers[_0x4a2745['uniqueid']][_0x084a('0xa')]=_0x084a('0x59');utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],transfers[_0x4a2745[_0x084a('0x13')]]['membername'],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]));writeDB(transfers[_0x4a2745[_0x084a('0x13')]],!![]);}if(agents[_0x4a2745[_0x084a('0x13')]]&&agents[_0x4a2745[_0x084a('0x13')]]['agentconnectAt']){agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x36')]=!![];agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')]=utils[_0x084a('0x19')]();agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x2c')]=utils[_0x084a('0x58')](agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')],agents[_0x4a2745[_0x084a('0x13')]]['agentconnectAt']);agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]=agents[_0x4a2745['uniqueid']][_0x084a('0x3e')]?'transfer':'agent';agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]='complete';utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x1d')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]));writeDB(agents[_0x4a2745[_0x084a('0x13')]]);}}catch(_0x7c85e3){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x53'),_0x4a2745['uniqueid']),_0x7c85e3);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 9215430..6c9e570 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 _0x50be=['calleridnum','cause-txt','diffTime','endtime','starttime','billableseconds','answertime','attendedtransfer','origtransfereruniqueid','transfereechannel','localtwolinkedid','secondtransfererchannel','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','userfield','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','lastIndexOf','includes','hangup','noop','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname'];(function(_0x1f74f7,_0x5751c2){var _0x24a39d=function(_0x22b181){while(--_0x22b181){_0x1f74f7['push'](_0x1f74f7['shift']());}};_0x24a39d(++_0x5751c2);}(_0x50be,0x191));var _0xe50b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50be[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe50b('0x0'));var util=require(_0xe50b('0x1'));var utils=require(_0xe50b('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0xe50b('0x3'),_0xe50b('0x4'),_0xe50b('0x4'),_0xe50b('0x3'),_0xe50b('0x3'),'NO\x20ANSWER',_0xe50b('0x5'),_0xe50b('0x6'),_0xe50b('0x4'),_0xe50b('0x4'),'FAILED'];var channels={};function writeDB(_0x516f7a){var _0x4a8d03;if(transfers[_0xe50b('0x7')][_0x516f7a['uniqueid']]){_0x4a8d03=_0x516f7a[_0xe50b('0x8')];_0x516f7a[_0xe50b('0x8')]=transfers[_0xe50b('0x7')][_0x516f7a[_0xe50b('0x8')]]['transfereeuniqueid'];}utils[_0xe50b('0x9')](util[_0xe50b('0xa')](_0xe50b('0xb'),_0x516f7a[_0xe50b('0x8')],_0x516f7a[_0xe50b('0xc')],_0x516f7a[_0xe50b('0xd')],_0x516f7a[_0xe50b('0xe')],_0x516f7a[_0xe50b('0xf')],_0x516f7a['calleridnum'],_0x516f7a[_0xe50b('0x10')],_0x516f7a['lastevent']));if(_0x516f7a[_0xe50b('0x11')]){utils[_0xe50b('0x12')](_0x516f7a[_0xe50b('0x11')])[_0xe50b('0x13')](function(_0x429454){if(_0x429454){_0x516f7a[_0xe50b('0x14')]=_0x429454['id'];}utils['request'](_0xe50b('0x15'),_0x516f7a);});}else{utils[_0xe50b('0x16')](_0xe50b('0x15'),_0x516f7a);}if(channels[_0x516f7a[_0xe50b('0x8')]]){delete channels[_0x516f7a[_0xe50b('0x8')]];}else if(_0x4a8d03&&channels[_0x4a8d03]){if(!transfers[_0xe50b('0x7')][_0x4a8d03][_0xe50b('0x17')])delete transfers[_0xe50b('0x7')][_0x4a8d03];delete channels[_0x4a8d03];}}exports[_0xe50b('0x18')]=function(_0x5002f0){try{utils[_0xe50b('0x19')](util['format'](_0xe50b('0x1a'),_0x5002f0['uniqueid']),_0x5002f0);if(_0x5002f0[_0xe50b('0x8')]==_0x5002f0[_0xe50b('0x1b')]&&_0x5002f0[_0xe50b('0xc')]!='OutgoingSpoolFailed'){utils['info'](util[_0xe50b('0xa')](_0xe50b('0x1c'),_0x5002f0[_0xe50b('0x8')],_0x5002f0[_0xe50b('0x1d')],_0x5002f0[_0xe50b('0x1e')]));channels[_0x5002f0['uniqueid']]={'uniqueid':_0x5002f0[_0xe50b('0x8')],'accountcode':_0x5002f0['accountcode'],'source':_0x5002f0['calleridnum'],'destination':_0x5002f0[_0xe50b('0x1e')],'destinationcontext':_0x5002f0[_0xe50b('0x1d')],'channel':_0x5002f0['channel'],'starttime':utils[_0xe50b('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xe50b('0x3'),'amaflags':_0xe50b('0x20')};}}catch(_0x6fff76){utils[_0xe50b('0x21')](util[_0xe50b('0xa')](_0xe50b('0x1a'),_0x5002f0[_0xe50b('0x8')]),_0x6fff76);}};exports['newstate']=function(_0x484619){try{utils[_0xe50b('0x19')](util[_0xe50b('0xa')](_0xe50b('0x22'),_0x484619[_0xe50b('0x8')]),_0x484619);if(!_[_0xe50b('0x23')](channels[_0x484619['uniqueid']])&&_0x484619[_0xe50b('0x24')]==0x6){utils[_0xe50b('0x9')](util[_0xe50b('0xa')](_0xe50b('0x25'),_0x484619[_0xe50b('0x8')],_0x484619[_0xe50b('0x1d')],_0x484619[_0xe50b('0xc')]));if(_[_0xe50b('0x23')](channels[_0x484619[_0xe50b('0x8')]][_0xe50b('0x26')])){channels[_0x484619[_0xe50b('0x8')]]['systemanswertime']=utils[_0xe50b('0x1f')]();}}else if(!_[_0xe50b('0x23')](channels[_0x484619[_0xe50b('0x1b')]])&&_0x484619['channelstate']==0x6&&_0x484619[_0xe50b('0x1d')]!=_0xe50b('0x27')){utils['info'](util[_0xe50b('0xa')](_0xe50b('0x28'),_0x484619[_0xe50b('0x8')],_0x484619[_0xe50b('0x1b')],_0x484619[_0xe50b('0x1d')],_0x484619[_0xe50b('0xc')]));channels[_0x484619[_0xe50b('0x1b')]][_0xe50b('0x11')]=_0x484619[_0xe50b('0x11')];channels[_0x484619['linkedid']][_0xe50b('0x29')]=_0x484619['channel'];if(_[_0xe50b('0x23')](channels[_0x484619['linkedid']]['answertime'])){channels[_0x484619['linkedid']]['answertime']=utils['now']();}channels[_0x484619[_0xe50b('0x1b')]][_0xe50b('0x2a')]=dispositions[_[_0xe50b('0x2b')](_0x484619[_0xe50b('0x24')])]||_0xe50b('0x5');}}catch(_0x23877b){utils[_0xe50b('0x21')](util[_0xe50b('0xa')](_0xe50b('0x22'),_0x484619[_0xe50b('0x8')]),_0x23877b);}};exports['hangup']=function(_0x3319fc){try{if(!_[_0xe50b('0x23')](channels[_0x3319fc[_0xe50b('0x8')]])){utils['debug'](util[_0xe50b('0xa')](_0xe50b('0x2c'),_0x3319fc[_0xe50b('0x8')]),_0x3319fc);if(_['isNil'](channels[_0x3319fc['uniqueid']][_0xe50b('0x2d')])){channels[_0x3319fc['uniqueid']][_0xe50b('0x2d')]=_0x3319fc[_0xe50b('0x2e')]+'\x20<'+_0x3319fc[_0xe50b('0x2f')]+'>';}utils[_0xe50b('0x9')](util[_0xe50b('0xa')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x3319fc[_0xe50b('0x8')],channels[_0x3319fc['uniqueid']][_0xe50b('0x2d')],_0x3319fc[_0xe50b('0x30')]));channels[_0x3319fc[_0xe50b('0x8')]]['endtime']=utils[_0xe50b('0x1f')]();channels[_0x3319fc[_0xe50b('0x8')]]['duration']=utils[_0xe50b('0x31')](channels[_0x3319fc[_0xe50b('0x8')]][_0xe50b('0x32')],channels[_0x3319fc['uniqueid']][_0xe50b('0x33')]);channels[_0x3319fc[_0xe50b('0x8')]][_0xe50b('0x34')]=channels[_0x3319fc['uniqueid']][_0xe50b('0x35')]?utils[_0xe50b('0x31')](channels[_0x3319fc[_0xe50b('0x8')]][_0xe50b('0x32')],channels[_0x3319fc[_0xe50b('0x8')]]['answertime']):0x0;writeDB(channels[_0x3319fc[_0xe50b('0x8')]]);}}catch(_0x33faf4){utils['error'](util[_0xe50b('0xa')](_0xe50b('0x2c'),_0x3319fc[_0xe50b('0x8')]),_0x33faf4);}};exports[_0xe50b('0x36')]=function(_0x20a94d){try{if(!_[_0xe50b('0x23')](channels[_0x20a94d['localtwolinkedid']])){utils[_0xe50b('0x19')](util[_0xe50b('0xa')]('[%s][calls][attendedtransfer]',_0x20a94d[_0xe50b('0x37')]),_0x20a94d);if(channels[_0x20a94d['localtwolinkedid']][_0xe50b('0xc')]==_0x20a94d[_0xe50b('0x38')]){utils[_0xe50b('0x9')](util[_0xe50b('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x20a94d[_0xe50b('0x37')],_0x20a94d[_0xe50b('0x39')],_0x20a94d[_0xe50b('0x3a')]));channels[_0x20a94d[_0xe50b('0x39')]][_0xe50b('0x29')]=_0x20a94d['secondtransfererchannel'];channels[_0x20a94d['localtwolinkedid']]['userfield']=_0xe50b('0x3b');}else if(channels[_0x20a94d[_0xe50b('0x39')]][_0xe50b('0xc')]=_0x20a94d[_0xe50b('0x3c')]){utils[_0xe50b('0x9')](util[_0xe50b('0xa')](_0xe50b('0x3d'),_0x20a94d[_0xe50b('0x37')],_0x20a94d[_0xe50b('0x39')],_0x20a94d[_0xe50b('0x3e')]));channels[_0x20a94d[_0xe50b('0x39')]][_0xe50b('0x29')]=_0x20a94d[_0xe50b('0x3e')];channels[_0x20a94d[_0xe50b('0x39')]][_0xe50b('0x3f')]=_0xe50b('0x3b');}}}catch(_0x1d261d){utils[_0xe50b('0x21')](util['format']('[%s][calls][attendedtransfer]',_0x20a94d[_0xe50b('0x37')]),_0x1d261d);}};exports['musiconholdstart']=function(_0x31a03a){try{if(!_[_0xe50b('0x23')](channels[_0x31a03a[_0xe50b('0x8')]])){utils[_0xe50b('0x19')](util[_0xe50b('0xa')](_0xe50b('0x40'),_0x31a03a[_0xe50b('0x8')]),_0x31a03a);channels[_0x31a03a[_0xe50b('0x8')]][_0xe50b('0x41')]=utils['now']();utils[_0xe50b('0x9')](util[_0xe50b('0xa')](_0xe50b('0x42'),_0x31a03a[_0xe50b('0x8')],channels[_0x31a03a[_0xe50b('0x8')]][_0xe50b('0x41')]));}}catch(_0x2d7eb1){utils[_0xe50b('0x21')](util[_0xe50b('0xa')](_0xe50b('0x40'),_0x31a03a[_0xe50b('0x8')]),_0x2d7eb1);}};exports[_0xe50b('0x43')]=function(_0x2c6345){try{if(!_[_0xe50b('0x23')](channels[_0x2c6345[_0xe50b('0x8')]])){utils[_0xe50b('0x19')](util[_0xe50b('0xa')](_0xe50b('0x44'),_0x2c6345[_0xe50b('0x8')]),_0x2c6345);if(!_['isNil'](channels[_0x2c6345['uniqueid']][_0xe50b('0x41')])){channels[_0x2c6345[_0xe50b('0x8')]][_0xe50b('0x45')]+=utils['diffTime'](utils['now'](),channels[_0x2c6345[_0xe50b('0x8')]][_0xe50b('0x41')]);utils['info'](util[_0xe50b('0xa')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x2c6345[_0xe50b('0x8')],channels[_0x2c6345['uniqueid']][_0xe50b('0x45')]));delete channels[_0x2c6345[_0xe50b('0x8')]][_0xe50b('0x41')];}}}catch(_0x3a0a50){utils[_0xe50b('0x21')](util[_0xe50b('0xa')](_0xe50b('0x44'),_0x2c6345['uniqueid']),_0x3a0a50);}};exports['varset']=function(_0x4f1ea5){try{if(!_[_0xe50b('0x23')](channels[_0x4f1ea5['uniqueid']])){utils[_0xe50b('0x19')](util['format']('[%s][calls][varset]',_0x4f1ea5[_0xe50b('0x8')]),_0x4f1ea5);if(!_[_0xe50b('0x23')](_0x4f1ea5[_0xe50b('0x46')][_0xe50b('0x47')])){utils[_0xe50b('0x9')](util[_0xe50b('0xa')](_0xe50b('0x48'),_0x4f1ea5['uniqueid'],_0x4f1ea5[_0xe50b('0x49')]));channels[_0x4f1ea5[_0xe50b('0x8')]][_0xe50b('0x4a')]=_0x4f1ea5[_0xe50b('0x49')];}if(!_['isNil'](_0x4f1ea5[_0xe50b('0x46')][_0xe50b('0x4b')])){utils[_0xe50b('0x9')](util[_0xe50b('0xa')](_0xe50b('0x4c'),_0x4f1ea5[_0xe50b('0x8')],_0x4f1ea5[_0xe50b('0x49')]));channels[_0x4f1ea5[_0xe50b('0x8')]][_0xe50b('0x4d')]=_0x4f1ea5[_0xe50b('0x49')];channels[_0x4f1ea5[_0xe50b('0x8')]]['callerid']='\x22'+_0x4f1ea5[_0xe50b('0x49')]+_0xe50b('0x4e')+_0x4f1ea5[_0xe50b('0x49')]+'>';}if(!_[_0xe50b('0x23')](_0x4f1ea5[_0xe50b('0x46')][_0xe50b('0x4f')])||!_[_0xe50b('0x23')](_0x4f1ea5['variable'][_0xe50b('0x50')])){utils[_0xe50b('0x9')](util[_0xe50b('0xa')](_0xe50b('0x51'),_0x4f1ea5[_0xe50b('0x8')],!_[_0xe50b('0x23')](_0x4f1ea5['variable'][_0xe50b('0x4f')])?_0xe50b('0x4f'):_0xe50b('0x50'),_0x4f1ea5[_0xe50b('0x49')]));channels[_0x4f1ea5[_0xe50b('0x8')]][_0xe50b('0x2d')]=_0x4f1ea5[_0xe50b('0x49')];}if(!_['isNil'](_0x4f1ea5[_0xe50b('0x46')]['xmd-queue'])||!_[_0xe50b('0x23')](_0x4f1ea5[_0xe50b('0x46')][_0xe50b('0x52')])){utils[_0xe50b('0x9')](util['format'](_0xe50b('0x51'),_0x4f1ea5[_0xe50b('0x8')],!_[_0xe50b('0x23')](_0x4f1ea5[_0xe50b('0x46')][_0xe50b('0x53')])?_0xe50b('0x53'):_0xe50b('0x52'),_0x4f1ea5[_0xe50b('0x49')]));channels[_0x4f1ea5['uniqueid']][_0xe50b('0x54')]=_0xe50b('0x55');channels[_0x4f1ea5[_0xe50b('0x8')]][_0xe50b('0x56')]=_0x4f1ea5[_0xe50b('0x49')];channels[_0x4f1ea5[_0xe50b('0x8')]]['queue']=!![];}if(!_['isNil'](_0x4f1ea5[_0xe50b('0x46')][_0xe50b('0x57')])){utils['info'](util[_0xe50b('0xa')](_0xe50b('0x58'),_0x4f1ea5[_0xe50b('0x8')],_0x4f1ea5[_0xe50b('0x49')]));channels[_0x4f1ea5[_0xe50b('0x8')]][_0xe50b('0x59')]=_0x4f1ea5[_0xe50b('0x49')];}if(!_[_0xe50b('0x23')](_0x4f1ea5[_0xe50b('0x46')][_0xe50b('0x5a')])){utils['info'](util[_0xe50b('0xa')](_0xe50b('0x5b'),_0x4f1ea5['uniqueid'],_0x4f1ea5[_0xe50b('0x49')]));channels[_0x4f1ea5[_0xe50b('0x8')]][_0xe50b('0x5c')]=_0x4f1ea5[_0xe50b('0x49')];}if(!_[_0xe50b('0x23')](_0x4f1ea5[_0xe50b('0x46')][_0xe50b('0x5d')])){utils[_0xe50b('0x9')](util[_0xe50b('0xa')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x4f1ea5['uniqueid'],_0x4f1ea5[_0xe50b('0x49')]));channels[_0x4f1ea5[_0xe50b('0x8')]][_0xe50b('0x5e')]=_0x4f1ea5[_0xe50b('0x49')];}if(!_[_0xe50b('0x23')](_0x4f1ea5[_0xe50b('0x46')][_0xe50b('0x5f')])){utils['info'](util[_0xe50b('0xa')](_0xe50b('0x60'),_0x4f1ea5['uniqueid'],_0x4f1ea5[_0xe50b('0x49')]));channels[_0x4f1ea5[_0xe50b('0x8')]][_0xe50b('0x5f')]=_0x4f1ea5[_0xe50b('0x49')];}}}catch(_0x168dd1){utils['error'](util['format'](_0xe50b('0x61'),_0x4f1ea5[_0xe50b('0x8')]),_0x168dd1);}};exports[_0xe50b('0x62')]=function(_0xa6ba99){try{if(!_[_0xe50b('0x23')](channels[_0xa6ba99[_0xe50b('0x8')]])){utils[_0xe50b('0x19')](util[_0xe50b('0xa')](_0xe50b('0x63'),_0xa6ba99[_0xe50b('0x8')]),_0xa6ba99);utils[_0xe50b('0x9')](util['format'](_0xe50b('0x64'),_0xa6ba99[_0xe50b('0x8')],_0xa6ba99[_0xe50b('0x65')],_0xa6ba99[_0xe50b('0x66')]));if(_0xa6ba99[_0xe50b('0x65')][_0xe50b('0x67')]()==_0xe50b('0x68')&&_[_0xe50b('0x69')](_0xa6ba99['appdata']['toLowerCase'](),'cdr')){var _0x3328c5=_0xa6ba99[_0xe50b('0x66')]['split']('=');var _0x45b544=_0x3328c5[0x0]['substring'](_0x3328c5[0x0][_0xe50b('0x6a')]('(')+0x1,_0x3328c5[0x0]['lastIndexOf'](')'));var _0x4bd73f=_0x3328c5[0x1];channels[_0xa6ba99[_0xe50b('0x8')]][_0x45b544]=_0x4bd73f;}if(!_[_0xe50b('0x6b')]([_0xe50b('0x6c'),_0xe50b('0x6d'),_0xe50b('0x6e'),_0xe50b('0x68'),_0xe50b('0x6f')],_0xa6ba99['application']['toLowerCase']())){channels[_0xa6ba99[_0xe50b('0x8')]][_0xe50b('0x54')]=_0xa6ba99[_0xe50b('0x65')];channels[_0xa6ba99[_0xe50b('0x8')]]['lastdata']=_0xa6ba99['appdata'];}}}catch(_0x53808a){utils['error'](util[_0xe50b('0xa')](_0xe50b('0x63'),_0xa6ba99[_0xe50b('0x8')]),_0x53808a);}}; \ No newline at end of file +var _0xf06c=['linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','info','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','_attended','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','hangup','noop','execif','lastapplication','application','lastdata','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','recording','debug','format'];(function(_0x1aee42,_0x508c04){var _0x181f54=function(_0x6241c2){while(--_0x6241c2){_0x1aee42['push'](_0x1aee42['shift']());}};_0x181f54(++_0x508c04);}(_0xf06c,0xc7));var _0xcf06=function(_0x3d69bf,_0x5b23cc){_0x3d69bf=_0x3d69bf-0x0;var _0x3b7051=_0xf06c[_0x3d69bf];return _0x3b7051;};'use strict';var _=require(_0xcf06('0x0'));var util=require(_0xcf06('0x1'));var utils=require(_0xcf06('0x2'));var transfers=require(_0xcf06('0x3'));var dispositions=[_0xcf06('0x4'),'FAILED',_0xcf06('0x5'),_0xcf06('0x4'),_0xcf06('0x4'),'NO\x20ANSWER',_0xcf06('0x6'),_0xcf06('0x7'),_0xcf06('0x5'),'FAILED',_0xcf06('0x5')];var channels={};function writeDB(_0x5d1aa0){var _0x2723ad;if(transfers['blinds'][_0x5d1aa0['uniqueid']]){_0x2723ad=_0x5d1aa0['uniqueid'];_0x5d1aa0['uniqueid']=transfers[_0xcf06('0x8')][_0x5d1aa0[_0xcf06('0x9')]][_0xcf06('0xa')];}utils['info'](util['format'](_0xcf06('0xb'),_0x5d1aa0['uniqueid'],_0x5d1aa0[_0xcf06('0xc')],_0x5d1aa0['queue'],_0x5d1aa0[_0xcf06('0xd')],_0x5d1aa0['interface'],_0x5d1aa0[_0xcf06('0xe')],_0x5d1aa0[_0xcf06('0xf')],_0x5d1aa0[_0xcf06('0x10')]));if(_0x5d1aa0[_0xcf06('0x11')]){utils['getUserByInternal'](_0x5d1aa0['accountcode'])[_0xcf06('0x12')](function(_0x45f66a){if(_0x45f66a){_0x5d1aa0[_0xcf06('0x13')]=_0x45f66a['id'];}utils[_0xcf06('0x14')]('CreateVoiceCallReport',_0x5d1aa0);});}else{utils[_0xcf06('0x14')](_0xcf06('0x15'),_0x5d1aa0);}if(channels[_0x5d1aa0['uniqueid']]){delete channels[_0x5d1aa0['uniqueid']];}else if(_0x2723ad&&channels[_0x2723ad]){if(!transfers[_0xcf06('0x8')][_0x2723ad][_0xcf06('0x16')])delete transfers[_0xcf06('0x8')][_0x2723ad];delete channels[_0x2723ad];}}exports['newchannel']=function(_0x5b5b57){try{utils[_0xcf06('0x17')](util[_0xcf06('0x18')]('[%s][calls][newchannel]',_0x5b5b57[_0xcf06('0x9')]),_0x5b5b57);if(_0x5b5b57[_0xcf06('0x9')]==_0x5b5b57[_0xcf06('0x19')]&&_0x5b5b57[_0xcf06('0xc')]!=_0xcf06('0x1a')){utils['info'](util[_0xcf06('0x18')](_0xcf06('0x1b'),_0x5b5b57[_0xcf06('0x9')],_0x5b5b57['context'],_0x5b5b57[_0xcf06('0x1c')]));channels[_0x5b5b57[_0xcf06('0x9')]]={'uniqueid':_0x5b5b57['uniqueid'],'accountcode':_0x5b5b57[_0xcf06('0x11')],'source':_0x5b5b57[_0xcf06('0xe')],'destination':_0x5b5b57['exten'],'destinationcontext':_0x5b5b57[_0xcf06('0x1d')],'channel':_0x5b5b57[_0xcf06('0xc')],'starttime':utils[_0xcf06('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xcf06('0x4'),'amaflags':_0xcf06('0x1f')};}}catch(_0x13fa04){utils[_0xcf06('0x20')](util[_0xcf06('0x18')](_0xcf06('0x21'),_0x5b5b57[_0xcf06('0x9')]),_0x13fa04);}};exports[_0xcf06('0x22')]=function(_0x3c212f){try{utils['debug'](util['format'](_0xcf06('0x23'),_0x3c212f[_0xcf06('0x9')]),_0x3c212f);if(!_[_0xcf06('0x24')](channels[_0x3c212f[_0xcf06('0x9')]])&&_0x3c212f[_0xcf06('0x25')]==0x6){utils[_0xcf06('0x26')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x3c212f[_0xcf06('0x9')],_0x3c212f['context'],_0x3c212f[_0xcf06('0xc')]));if(_[_0xcf06('0x24')](channels[_0x3c212f[_0xcf06('0x9')]][_0xcf06('0x27')])){channels[_0x3c212f[_0xcf06('0x9')]][_0xcf06('0x27')]=utils[_0xcf06('0x1e')]();}}else if(!_[_0xcf06('0x24')](channels[_0x3c212f[_0xcf06('0x19')]])&&_0x3c212f['channelstate']==0x6&&_0x3c212f[_0xcf06('0x1d')]!='transfer'){utils[_0xcf06('0x26')](util[_0xcf06('0x18')](_0xcf06('0x28'),_0x3c212f[_0xcf06('0x9')],_0x3c212f[_0xcf06('0x19')],_0x3c212f[_0xcf06('0x1d')],_0x3c212f['channel']));channels[_0x3c212f[_0xcf06('0x19')]][_0xcf06('0x11')]=_0x3c212f[_0xcf06('0x11')];channels[_0x3c212f[_0xcf06('0x19')]][_0xcf06('0x29')]=_0x3c212f[_0xcf06('0xc')];if(_[_0xcf06('0x24')](channels[_0x3c212f[_0xcf06('0x19')]][_0xcf06('0x2a')])){channels[_0x3c212f[_0xcf06('0x19')]]['answertime']=utils[_0xcf06('0x1e')]();}channels[_0x3c212f[_0xcf06('0x19')]][_0xcf06('0x2b')]=dispositions[_[_0xcf06('0x2c')](_0x3c212f[_0xcf06('0x25')])]||_0xcf06('0x6');}}catch(_0xf72392){utils[_0xcf06('0x20')](util[_0xcf06('0x18')](_0xcf06('0x23'),_0x3c212f[_0xcf06('0x9')]),_0xf72392);}};exports['hangup']=function(_0x5b4fbd){try{if(!_[_0xcf06('0x24')](channels[_0x5b4fbd['uniqueid']])){utils[_0xcf06('0x17')](util['format'](_0xcf06('0x2d'),_0x5b4fbd[_0xcf06('0x9')]),_0x5b4fbd);if(_[_0xcf06('0x24')](channels[_0x5b4fbd[_0xcf06('0x9')]]['callerid'])){channels[_0x5b4fbd[_0xcf06('0x9')]][_0xcf06('0x2e')]=_0x5b4fbd[_0xcf06('0x2f')]+'\x20<'+_0x5b4fbd[_0xcf06('0xe')]+'>';}utils[_0xcf06('0x26')](util['format'](_0xcf06('0x30'),_0x5b4fbd[_0xcf06('0x9')],channels[_0x5b4fbd[_0xcf06('0x9')]][_0xcf06('0x2e')],_0x5b4fbd[_0xcf06('0x31')]));channels[_0x5b4fbd[_0xcf06('0x9')]][_0xcf06('0x32')]=utils[_0xcf06('0x1e')]();channels[_0x5b4fbd[_0xcf06('0x9')]][_0xcf06('0x33')]=utils[_0xcf06('0x34')](channels[_0x5b4fbd[_0xcf06('0x9')]][_0xcf06('0x32')],channels[_0x5b4fbd[_0xcf06('0x9')]][_0xcf06('0x35')]);channels[_0x5b4fbd[_0xcf06('0x9')]][_0xcf06('0x36')]=channels[_0x5b4fbd['uniqueid']][_0xcf06('0x2a')]?utils['diffTime'](channels[_0x5b4fbd[_0xcf06('0x9')]][_0xcf06('0x32')],channels[_0x5b4fbd[_0xcf06('0x9')]]['answertime']):0x0;writeDB(channels[_0x5b4fbd[_0xcf06('0x9')]]);}}catch(_0x20ebd4){utils[_0xcf06('0x20')](util[_0xcf06('0x18')](_0xcf06('0x2d'),_0x5b4fbd['uniqueid']),_0x20ebd4);}};exports['attendedtransfer']=function(_0x3d417b){try{if(!_['isNil'](channels[_0x3d417b[_0xcf06('0x37')]])){utils[_0xcf06('0x17')](util[_0xcf06('0x18')](_0xcf06('0x38'),_0x3d417b['origtransfereruniqueid']),_0x3d417b);if(channels[_0x3d417b[_0xcf06('0x37')]][_0xcf06('0xc')]==_0x3d417b[_0xcf06('0x39')]){utils['info'](util[_0xcf06('0x18')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3d417b[_0xcf06('0x3a')],_0x3d417b['localtwolinkedid'],_0x3d417b[_0xcf06('0x3b')]));channels[_0x3d417b['localtwolinkedid']][_0xcf06('0x29')]=_0x3d417b[_0xcf06('0x3b')];channels[_0x3d417b[_0xcf06('0x37')]]['userfield']=_0xcf06('0x3c');}else if(channels[_0x3d417b[_0xcf06('0x37')]][_0xcf06('0xc')]=_0x3d417b['transfertargetchannel']){utils[_0xcf06('0x26')](util['format'](_0xcf06('0x3d'),_0x3d417b[_0xcf06('0x3a')],_0x3d417b[_0xcf06('0x37')],_0x3d417b[_0xcf06('0x3e')]));channels[_0x3d417b['localtwolinkedid']][_0xcf06('0x29')]=_0x3d417b[_0xcf06('0x3e')];channels[_0x3d417b[_0xcf06('0x37')]]['userfield']=_0xcf06('0x3c');}}}catch(_0x3724f8){utils['error'](util[_0xcf06('0x18')](_0xcf06('0x38'),_0x3d417b[_0xcf06('0x3a')]),_0x3724f8);}};exports[_0xcf06('0x3f')]=function(_0x3b63cf){try{if(!_['isNil'](channels[_0x3b63cf[_0xcf06('0x9')]])){utils[_0xcf06('0x17')](util[_0xcf06('0x18')](_0xcf06('0x40'),_0x3b63cf[_0xcf06('0x9')]),_0x3b63cf);channels[_0x3b63cf['uniqueid']][_0xcf06('0x41')]=utils['now']();utils[_0xcf06('0x26')](util[_0xcf06('0x18')](_0xcf06('0x42'),_0x3b63cf[_0xcf06('0x9')],channels[_0x3b63cf[_0xcf06('0x9')]]['musiconholdstartAt']));}}catch(_0x177925){utils['error'](util[_0xcf06('0x18')](_0xcf06('0x40'),_0x3b63cf[_0xcf06('0x9')]),_0x177925);}};exports[_0xcf06('0x43')]=function(_0x3ced12){try{if(!_[_0xcf06('0x24')](channels[_0x3ced12['uniqueid']])){utils[_0xcf06('0x17')](util['format']('[%s][calls][musiconholdstop]',_0x3ced12['uniqueid']),_0x3ced12);if(!_[_0xcf06('0x24')](channels[_0x3ced12[_0xcf06('0x9')]][_0xcf06('0x41')])){channels[_0x3ced12['uniqueid']]['mohtime']+=utils['diffTime'](utils['now'](),channels[_0x3ced12['uniqueid']][_0xcf06('0x41')]);utils[_0xcf06('0x26')](util[_0xcf06('0x18')](_0xcf06('0x44'),_0x3ced12[_0xcf06('0x9')],channels[_0x3ced12['uniqueid']][_0xcf06('0x45')]));delete channels[_0x3ced12[_0xcf06('0x9')]][_0xcf06('0x41')];}}}catch(_0x5934e7){utils['error'](util[_0xcf06('0x18')](_0xcf06('0x46'),_0x3ced12[_0xcf06('0x9')]),_0x5934e7);}};exports[_0xcf06('0x47')]=function(_0x5a73ad){try{if(!_['isNil'](channels[_0x5a73ad[_0xcf06('0x9')]])){utils['debug'](util[_0xcf06('0x18')](_0xcf06('0x48'),_0x5a73ad[_0xcf06('0x9')]),_0x5a73ad);if(!_[_0xcf06('0x24')](_0x5a73ad[_0xcf06('0x49')][_0xcf06('0x4a')])){utils[_0xcf06('0x26')](util[_0xcf06('0x18')](_0xcf06('0x4b'),_0x5a73ad[_0xcf06('0x9')],_0x5a73ad['value']));channels[_0x5a73ad[_0xcf06('0x9')]][_0xcf06('0x4c')]=_0x5a73ad[_0xcf06('0x4d')];}if(!_['isNil'](_0x5a73ad[_0xcf06('0x49')][_0xcf06('0x4e')])){utils['info'](util[_0xcf06('0x18')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x5a73ad[_0xcf06('0x9')],_0x5a73ad[_0xcf06('0x4d')]));channels[_0x5a73ad[_0xcf06('0x9')]][_0xcf06('0x4f')]=_0x5a73ad[_0xcf06('0x4d')];channels[_0x5a73ad[_0xcf06('0x9')]][_0xcf06('0x2e')]='\x22'+_0x5a73ad[_0xcf06('0x4d')]+_0xcf06('0x50')+_0x5a73ad[_0xcf06('0x4d')]+'>';}if(!_[_0xcf06('0x24')](_0x5a73ad[_0xcf06('0x49')][_0xcf06('0x51')])||!_['isNil'](_0x5a73ad[_0xcf06('0x49')][_0xcf06('0x52')])){utils[_0xcf06('0x26')](util[_0xcf06('0x18')](_0xcf06('0x53'),_0x5a73ad['uniqueid'],!_[_0xcf06('0x24')](_0x5a73ad[_0xcf06('0x49')][_0xcf06('0x51')])?_0xcf06('0x51'):'xmd-callerid',_0x5a73ad[_0xcf06('0x4d')]));channels[_0x5a73ad[_0xcf06('0x9')]][_0xcf06('0x2e')]=_0x5a73ad[_0xcf06('0x4d')];}if(!_[_0xcf06('0x24')](_0x5a73ad[_0xcf06('0x49')][_0xcf06('0x54')])||!_[_0xcf06('0x24')](_0x5a73ad['variable'][_0xcf06('0x55')])){utils['info'](util[_0xcf06('0x18')](_0xcf06('0x53'),_0x5a73ad['uniqueid'],!_['isNil'](_0x5a73ad['variable'][_0xcf06('0x54')])?_0xcf06('0x54'):_0xcf06('0x55'),_0x5a73ad[_0xcf06('0x4d')]));channels[_0x5a73ad[_0xcf06('0x9')]]['lastapplication']=_0xcf06('0x56');channels[_0x5a73ad[_0xcf06('0x9')]]['lastdata']=_0x5a73ad['value'];channels[_0x5a73ad['uniqueid']][_0xcf06('0x57')]=!![];}if(!_[_0xcf06('0x24')](_0x5a73ad['variable']['xmd-contactid'])){utils[_0xcf06('0x26')](util['format'](_0xcf06('0x58'),_0x5a73ad[_0xcf06('0x9')],_0x5a73ad[_0xcf06('0x4d')]));channels[_0x5a73ad[_0xcf06('0x9')]][_0xcf06('0x59')]=_0x5a73ad['value'];}if(!_[_0xcf06('0x24')](_0x5a73ad['variable'][_0xcf06('0x5a')])){utils[_0xcf06('0x26')](util[_0xcf06('0x18')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5a73ad[_0xcf06('0x9')],_0x5a73ad[_0xcf06('0x4d')]));channels[_0x5a73ad['uniqueid']][_0xcf06('0x5b')]=_0x5a73ad[_0xcf06('0x4d')];}if(!_[_0xcf06('0x24')](_0x5a73ad['variable'][_0xcf06('0x5c')])){utils['info'](util[_0xcf06('0x18')](_0xcf06('0x5d'),_0x5a73ad[_0xcf06('0x9')],_0x5a73ad[_0xcf06('0x4d')]));channels[_0x5a73ad['uniqueid']]['routeid']=_0x5a73ad[_0xcf06('0x4d')];}if(!_[_0xcf06('0x24')](_0x5a73ad[_0xcf06('0x49')]['sipcallid'])){utils[_0xcf06('0x26')](util['format'](_0xcf06('0x5e'),_0x5a73ad['uniqueid'],_0x5a73ad[_0xcf06('0x4d')]));channels[_0x5a73ad[_0xcf06('0x9')]]['sipcallid']=_0x5a73ad[_0xcf06('0x4d')];}}}catch(_0x446c52){utils[_0xcf06('0x20')](util[_0xcf06('0x18')]('[%s][calls][varset]',_0x5a73ad[_0xcf06('0x9')]),_0x446c52);}};exports[_0xcf06('0x5f')]=function(_0x133a30){try{if(!_[_0xcf06('0x24')](channels[_0x133a30[_0xcf06('0x9')]])){utils['debug'](util[_0xcf06('0x18')](_0xcf06('0x60'),_0x133a30[_0xcf06('0x9')]),_0x133a30);utils[_0xcf06('0x26')](util[_0xcf06('0x18')](_0xcf06('0x61'),_0x133a30[_0xcf06('0x9')],_0x133a30['application'],_0x133a30[_0xcf06('0x62')]));if(_0x133a30['application'][_0xcf06('0x63')]()==_0xcf06('0x64')&&_[_0xcf06('0x65')](_0x133a30[_0xcf06('0x62')][_0xcf06('0x63')](),_0xcf06('0x66'))){var _0x15e6d9=_0x133a30[_0xcf06('0x62')]['split']('=');var _0x2d775b=_0x15e6d9[0x0][_0xcf06('0x67')](_0x15e6d9[0x0][_0xcf06('0x68')]('(')+0x1,_0x15e6d9[0x0][_0xcf06('0x68')](')'));var _0x3885c9=_0x15e6d9[0x1];channels[_0x133a30[_0xcf06('0x9')]][_0x2d775b]=_0x3885c9;}if(!_[_0xcf06('0x69')]([_0xcf06('0x6a'),_0xcf06('0x6b'),_0xcf06('0x6c'),'set','gotoif'],_0x133a30['application'][_0xcf06('0x63')]())){channels[_0x133a30[_0xcf06('0x9')]][_0xcf06('0x6d')]=_0x133a30[_0xcf06('0x6e')];channels[_0x133a30['uniqueid']][_0xcf06('0x6f')]=_0x133a30[_0xcf06('0x62')];}}}catch(_0x417320){utils[_0xcf06('0x20')](util[_0xcf06('0x18')](_0xcf06('0x60'),_0x133a30[_0xcf06('0x9')]),_0x417320);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 43b0ca2..674798b 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 _0xa7a2=['[core]\x20error','[core]\x20close','managerevent','./utils','connect','info','shutdown','error'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0xa7a2,0x11b));var _0x2a7a=function(_0x4495f5,_0x588514){_0x4495f5=_0x4495f5-0x0;var _0x2ef165=_0xa7a2[_0x4495f5];return _0x2ef165;};'use strict';var utils=require(_0x2a7a('0x0'));exports[_0x2a7a('0x1')]=function(){utils[_0x2a7a('0x2')]('[core]\x20connected');};exports[_0x2a7a('0x3')]=function(){utils['info']('[core]\x20shutdown');};exports['fullybooted']=function(){utils[_0x2a7a('0x2')]('[core]\x20fullybooted');};exports[_0x2a7a('0x4')]=function(_0x363603){utils[_0x2a7a('0x4')](_0x2a7a('0x5'),_0x363603);};exports['close']=function(){utils[_0x2a7a('0x2')](_0x2a7a('0x6'));};exports[_0x2a7a('0x7')]=function(_0x4b58d8){}; \ No newline at end of file +var _0xe35d=['info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect'];(function(_0x34ab65,_0x356d84){var _0x31532c=function(_0x23761b){while(--_0x23761b){_0x34ab65['push'](_0x34ab65['shift']());}};_0x31532c(++_0x356d84);}(_0xe35d,0xe3));var _0xde35=function(_0x14005f,_0x323cd8){_0x14005f=_0x14005f-0x0;var _0x83bb3a=_0xe35d[_0x14005f];return _0x83bb3a;};'use strict';var utils=require('./utils');exports[_0xde35('0x0')]=function(){utils[_0xde35('0x1')](_0xde35('0x2'));};exports[_0xde35('0x3')]=function(){utils[_0xde35('0x1')](_0xde35('0x4'));};exports[_0xde35('0x5')]=function(){utils[_0xde35('0x1')](_0xde35('0x6'));};exports[_0xde35('0x7')]=function(_0x114a9b){utils[_0xde35('0x7')](_0xde35('0x8'),_0x114a9b);};exports[_0xde35('0x9')]=function(){utils[_0xde35('0x1')](_0xde35('0xa'));};exports[_0xde35('0xb')]=function(_0x435996){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index dad9d24..d2709b8 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 _0x24ef=['dialstring','calleridnum','dialstatus','request','newexten','debug','[%s][dials][newexten]','info','application','toLowerCase','appdata','cdr(routeid)','error','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','cause-txt','complete','diffTime','endtime','billableseconds','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid'];(function(_0x13c1d5,_0x33162e){var _0x24fadd=function(_0x5d543f){while(--_0x5d543f){_0x13c1d5['push'](_0x13c1d5['shift']());}};_0x24fadd(++_0x33162e);}(_0x24ef,0x152));var _0xf24e=function(_0x1d8979,_0x50a325){_0x1d8979=_0x1d8979-0x0;var _0x264763=_0x24ef[_0x1d8979];return _0x264763;};'use strict';var _=require(_0xf24e('0x0'));var util=require(_0xf24e('0x1'));var utils=require(_0xf24e('0x2'));var dials={};function writeDB(_0x923a14){utils['info'](util[_0xf24e('0x3')](_0xf24e('0x4'),_0x923a14[_0xf24e('0x5')],_0x923a14['channel'],_0x923a14[_0xf24e('0x6')],_0x923a14[_0xf24e('0x7')],_0x923a14['connectedlinenum'],_0x923a14[_0xf24e('0x8')]));utils[_0xf24e('0x9')]('CreateVoiceDialReport',_0x923a14);delete dials[_0x923a14[_0xf24e('0x5')]];}exports[_0xf24e('0xa')]=function(_0x23e7c4){try{utils[_0xf24e('0xb')](util[_0xf24e('0x3')](_0xf24e('0xc'),_0x23e7c4[_0xf24e('0x5')]),_0x23e7c4);utils[_0xf24e('0xd')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x23e7c4[_0xf24e('0x5')],_0x23e7c4['application'],_0x23e7c4['appdata']));if(_0x23e7c4[_0xf24e('0xe')][_0xf24e('0xf')]()=='set'&&_['startsWith'](_0x23e7c4[_0xf24e('0x10')]['toLowerCase'](),_0xf24e('0x11'))){var _0x39ebb4=_0x23e7c4[_0xf24e('0x10')]['split']('=');dials[_0x23e7c4['uniqueid']]={'routeId':_0x39ebb4[0x1]};}}catch(_0x4a2608){utils[_0xf24e('0x12')](util[_0xf24e('0x3')](_0xf24e('0xc'),_0x23e7c4[_0xf24e('0x5')]),_0x4a2608);}};exports['varset']=function(_0x2a00ab){try{utils[_0xf24e('0xb')](util['format'](_0xf24e('0x13'),_0x2a00ab[_0xf24e('0x5')]),_0x2a00ab);if(!_[_0xf24e('0x14')](_0x2a00ab[_0xf24e('0x15')][_0xf24e('0x16')])){utils[_0xf24e('0xd')](util[_0xf24e('0x3')](_0xf24e('0x17'),_0x2a00ab[_0xf24e('0x5')],_0x2a00ab['value']));dials[_0x2a00ab[_0xf24e('0x5')]]={'routeId':_0x2a00ab[_0xf24e('0x18')]};}}catch(_0x203075){utils[_0xf24e('0x12')](util[_0xf24e('0x3')](_0xf24e('0x13'),_0x2a00ab['uniqueid']),_0x203075);}};exports['dialbegin']=function(_0x480f23){try{if(!_[_0xf24e('0x14')](dials[_0x480f23[_0xf24e('0x5')]])){utils[_0xf24e('0xb')](util['format'](_0xf24e('0x19'),_0x480f23[_0xf24e('0x5')]),_0x480f23);dials[_0x480f23[_0xf24e('0x5')]]=_[_0xf24e('0x1a')](dials[_0x480f23[_0xf24e('0x5')]],_0x480f23);dials[_0x480f23[_0xf24e('0x5')]][_0xf24e('0x1b')]=utils['now']();dials[_0x480f23['uniqueid']][_0xf24e('0x1c')]=_0xf24e('0x1d');utils['info'](util[_0xf24e('0x3')](_0xf24e('0x1e'),_0x480f23['uniqueid'],dials[_0x480f23[_0xf24e('0x5')]]['starttime']));}}catch(_0x7b1f47){utils[_0xf24e('0x12')](util[_0xf24e('0x3')](_0xf24e('0x19'),_0x480f23[_0xf24e('0x5')]),_0x7b1f47);}};exports[_0xf24e('0x1f')]=function(_0x513089){try{if(!_[_0xf24e('0x14')](dials[_0x513089[_0xf24e('0x5')]])){utils[_0xf24e('0xb')](util['format'](_0xf24e('0x20'),_0x513089[_0xf24e('0x5')]),_0x513089);dials[_0x513089[_0xf24e('0x5')]][_0xf24e('0x8')]=_0x513089[_0xf24e('0x8')];if(_0x513089[_0xf24e('0x8')]==_0xf24e('0x21')){dials[_0x513089[_0xf24e('0x5')]]=_[_0xf24e('0x1a')](dials[_0x513089[_0xf24e('0x5')]],_0x513089);dials[_0x513089[_0xf24e('0x5')]][_0xf24e('0x22')]=utils['now']();dials[_0x513089[_0xf24e('0x5')]][_0xf24e('0x1c')]='connect';utils[_0xf24e('0xd')](util[_0xf24e('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x513089[_0xf24e('0x5')],_0x513089[_0xf24e('0x8')],dials[_0x513089['uniqueid']][_0xf24e('0x22')]));}else{utils[_0xf24e('0xd')](util[_0xf24e('0x3')](_0xf24e('0x23'),_0x513089[_0xf24e('0x5')],_0x513089[_0xf24e('0x8')]));}}}catch(_0x5bd0f6){utils[_0xf24e('0x12')](util[_0xf24e('0x3')](_0xf24e('0x20'),_0x513089['uniqueid']),_0x5bd0f6);}};exports[_0xf24e('0x24')]=function(_0x1bcd5a){try{if(!_['isNil'](dials[_0x1bcd5a[_0xf24e('0x5')]])){utils[_0xf24e('0xb')](util['format'](_0xf24e('0x25'),_0x1bcd5a['uniqueid']),_0x1bcd5a);utils[_0xf24e('0xd')](util[_0xf24e('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x1bcd5a[_0xf24e('0x5')],_0x1bcd5a['calleridnum'],_0x1bcd5a['calleridname'],_0x1bcd5a[_0xf24e('0x26')]));dials[_0x1bcd5a[_0xf24e('0x5')]]=_[_0xf24e('0x1a')](dials[_0x1bcd5a[_0xf24e('0x5')]],{'endtime':utils['now'](),'lastevent':_0xf24e('0x27')});dials[_0x1bcd5a[_0xf24e('0x5')]]['duration']=utils[_0xf24e('0x28')](dials[_0x1bcd5a[_0xf24e('0x5')]][_0xf24e('0x29')],dials[_0x1bcd5a['uniqueid']][_0xf24e('0x1b')]);dials[_0x1bcd5a[_0xf24e('0x5')]]['holdtime']=utils['diffTime'](dials[_0x1bcd5a[_0xf24e('0x5')]][_0xf24e('0x22')]||dials[_0x1bcd5a[_0xf24e('0x5')]]['endtime'],dials[_0x1bcd5a[_0xf24e('0x5')]][_0xf24e('0x1b')]);dials[_0x1bcd5a[_0xf24e('0x5')]][_0xf24e('0x2a')]=dials[_0x1bcd5a['uniqueid']][_0xf24e('0x22')]?utils[_0xf24e('0x28')](dials[_0x1bcd5a[_0xf24e('0x5')]][_0xf24e('0x29')],dials[_0x1bcd5a[_0xf24e('0x5')]]['answertime']):0x0;writeDB(dials[_0x1bcd5a[_0xf24e('0x5')]]);}}catch(_0x47ee34){utils[_0xf24e('0x12')](util['format'](_0xf24e('0x25'),_0x1bcd5a[_0xf24e('0x5')]),_0x47ee34);}}; \ No newline at end of file +var _0x9b28=['[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','now','endtime','answertime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','toLowerCase','cdr(routeid)','split','error','varset','debug'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x9b28,0x16e));var _0x89b2=function(_0x3606e4,_0x18178a){_0x3606e4=_0x3606e4-0x0;var _0x167120=_0x9b28[_0x3606e4];return _0x167120;};'use strict';var _=require(_0x89b2('0x0'));var util=require(_0x89b2('0x1'));var utils=require(_0x89b2('0x2'));var dials={};function writeDB(_0x1aef7b){utils[_0x89b2('0x3')](util[_0x89b2('0x4')](_0x89b2('0x5'),_0x1aef7b[_0x89b2('0x6')],_0x1aef7b[_0x89b2('0x7')],_0x1aef7b[_0x89b2('0x8')],_0x1aef7b[_0x89b2('0x9')],_0x1aef7b['connectedlinenum'],_0x1aef7b[_0x89b2('0xa')]));utils[_0x89b2('0xb')](_0x89b2('0xc'),_0x1aef7b);delete dials[_0x1aef7b[_0x89b2('0x6')]];}exports[_0x89b2('0xd')]=function(_0x328fa8){try{utils['debug'](util[_0x89b2('0x4')](_0x89b2('0xe'),_0x328fa8[_0x89b2('0x6')]),_0x328fa8);utils['info'](util[_0x89b2('0x4')](_0x89b2('0xf'),_0x328fa8[_0x89b2('0x6')],_0x328fa8[_0x89b2('0x10')],_0x328fa8['appdata']));if(_0x328fa8[_0x89b2('0x10')]['toLowerCase']()==_0x89b2('0x11')&&_[_0x89b2('0x12')](_0x328fa8[_0x89b2('0x13')][_0x89b2('0x14')](),_0x89b2('0x15'))){var _0x3aaf2d=_0x328fa8[_0x89b2('0x13')][_0x89b2('0x16')]('=');dials[_0x328fa8['uniqueid']]={'routeId':_0x3aaf2d[0x1]};}}catch(_0x45ae7b){utils[_0x89b2('0x17')](util[_0x89b2('0x4')](_0x89b2('0xe'),_0x328fa8[_0x89b2('0x6')]),_0x45ae7b);}};exports[_0x89b2('0x18')]=function(_0x3905cf){try{utils[_0x89b2('0x19')](util[_0x89b2('0x4')](_0x89b2('0x1a'),_0x3905cf[_0x89b2('0x6')]),_0x3905cf);if(!_[_0x89b2('0x1b')](_0x3905cf['variable'][_0x89b2('0x1c')])){utils[_0x89b2('0x3')](util[_0x89b2('0x4')](_0x89b2('0x1d'),_0x3905cf['uniqueid'],_0x3905cf[_0x89b2('0x1e')]));dials[_0x3905cf[_0x89b2('0x6')]]={'routeId':_0x3905cf[_0x89b2('0x1e')]};}}catch(_0x1824d1){utils[_0x89b2('0x17')](util[_0x89b2('0x4')](_0x89b2('0x1a'),_0x3905cf[_0x89b2('0x6')]),_0x1824d1);}};exports[_0x89b2('0x1f')]=function(_0x1d5e38){try{if(!_[_0x89b2('0x1b')](dials[_0x1d5e38[_0x89b2('0x6')]])){utils[_0x89b2('0x19')](util['format'](_0x89b2('0x20'),_0x1d5e38[_0x89b2('0x6')]),_0x1d5e38);dials[_0x1d5e38[_0x89b2('0x6')]]=_[_0x89b2('0x21')](dials[_0x1d5e38[_0x89b2('0x6')]],_0x1d5e38);dials[_0x1d5e38[_0x89b2('0x6')]][_0x89b2('0x22')]=utils['now']();dials[_0x1d5e38['uniqueid']][_0x89b2('0x23')]='called';utils[_0x89b2('0x3')](util[_0x89b2('0x4')](_0x89b2('0x24'),_0x1d5e38[_0x89b2('0x6')],dials[_0x1d5e38['uniqueid']][_0x89b2('0x22')]));}}catch(_0x2cfb5a){utils[_0x89b2('0x17')](util[_0x89b2('0x4')](_0x89b2('0x20'),_0x1d5e38[_0x89b2('0x6')]),_0x2cfb5a);}};exports['dialend']=function(_0xcd1604){try{if(!_[_0x89b2('0x1b')](dials[_0xcd1604[_0x89b2('0x6')]])){utils[_0x89b2('0x19')](util['format'](_0x89b2('0x25'),_0xcd1604[_0x89b2('0x6')]),_0xcd1604);dials[_0xcd1604[_0x89b2('0x6')]][_0x89b2('0xa')]=_0xcd1604[_0x89b2('0xa')];if(_0xcd1604[_0x89b2('0xa')]==_0x89b2('0x26')){dials[_0xcd1604[_0x89b2('0x6')]]=_[_0x89b2('0x21')](dials[_0xcd1604['uniqueid']],_0xcd1604);dials[_0xcd1604[_0x89b2('0x6')]]['answertime']=utils['now']();dials[_0xcd1604['uniqueid']][_0x89b2('0x23')]=_0x89b2('0x27');utils[_0x89b2('0x3')](util[_0x89b2('0x4')](_0x89b2('0x28'),_0xcd1604[_0x89b2('0x6')],_0xcd1604[_0x89b2('0xa')],dials[_0xcd1604[_0x89b2('0x6')]]['answertime']));}else{utils[_0x89b2('0x3')](util[_0x89b2('0x4')](_0x89b2('0x29'),_0xcd1604[_0x89b2('0x6')],_0xcd1604[_0x89b2('0xa')]));}}}catch(_0x247bd5){utils[_0x89b2('0x17')](util[_0x89b2('0x4')](_0x89b2('0x25'),_0xcd1604['uniqueid']),_0x247bd5);}};exports['hangup']=function(_0x410c9e){try{if(!_[_0x89b2('0x1b')](dials[_0x410c9e[_0x89b2('0x6')]])){utils[_0x89b2('0x19')](util['format'](_0x89b2('0x2a'),_0x410c9e[_0x89b2('0x6')]),_0x410c9e);utils[_0x89b2('0x3')](util[_0x89b2('0x4')](_0x89b2('0x2b'),_0x410c9e[_0x89b2('0x6')],_0x410c9e[_0x89b2('0x9')],_0x410c9e[_0x89b2('0x2c')],_0x410c9e[_0x89b2('0x2d')]));dials[_0x410c9e[_0x89b2('0x6')]]=_[_0x89b2('0x21')](dials[_0x410c9e[_0x89b2('0x6')]],{'endtime':utils[_0x89b2('0x2e')](),'lastevent':'complete'});dials[_0x410c9e[_0x89b2('0x6')]]['duration']=utils['diffTime'](dials[_0x410c9e['uniqueid']][_0x89b2('0x2f')],dials[_0x410c9e[_0x89b2('0x6')]][_0x89b2('0x22')]);dials[_0x410c9e[_0x89b2('0x6')]]['holdtime']=utils['diffTime'](dials[_0x410c9e[_0x89b2('0x6')]]['answertime']||dials[_0x410c9e['uniqueid']]['endtime'],dials[_0x410c9e[_0x89b2('0x6')]][_0x89b2('0x22')]);dials[_0x410c9e[_0x89b2('0x6')]]['billableseconds']=dials[_0x410c9e[_0x89b2('0x6')]]['answertime']?utils['diffTime'](dials[_0x410c9e['uniqueid']]['endtime'],dials[_0x410c9e[_0x89b2('0x6')]][_0x89b2('0x30')]):0x0;writeDB(dials[_0x410c9e[_0x89b2('0x6')]]);}}catch(_0x1f87ea){utils['error'](util[_0x89b2('0x4')](_0x89b2('0x2a'),_0x410c9e[_0x89b2('0x6')]),_0x1f87ea);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 4554f1a..2d97918 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 _0xc27a=['[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','[%s][index][newstate]','[%s][index][hangup]','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]','./utils','xdr','disabled','env','local','port','asterisk','username','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave'];(function(_0x1b1b94,_0x1573f3){var _0x4ffc4a=function(_0x31f2e1){while(--_0x31f2e1){_0x1b1b94['push'](_0x1b1b94['shift']());}};_0x4ffc4a(++_0x1573f3);}(_0xc27a,0x1b2));var _0xac27=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xc27a[_0x1c8c28];return _0x1f59b4;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0xac27('0x0'));var util=require('util');var isXDREnabled=config[_0xac27('0x1')]&&!config[_0xac27('0x1')][_0xac27('0x2')];var isProduction=config[_0xac27('0x3')]==='production'||![];var isLocalAsterisk=config[_0xac27('0x1')]&&config[_0xac27('0x1')][_0xac27('0x4')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xac27('0x5')],config[_0xac27('0x6')]['ip'],config[_0xac27('0x6')][_0xac27('0x7')],config['asterisk']['password'],!![]);ami[_0xac27('0x8')]();if(!isXDREnabled){utils[_0xac27('0x9')](_0xac27('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xac27('0xb'));}else{var agents=require('./agents.controller');var calls=require(_0xac27('0xc'));var queues=require(_0xac27('0xd'));var recordings=require(_0xac27('0xe'));var members=require(_0xac27('0xf'));var dials=require(_0xac27('0x10'));var transfers=require('./transfers.controller');var core=require(_0xac27('0x11'));ami['on'](_0xac27('0x12'),core['connect']);ami['on']('shutdown',core[_0xac27('0x13')]);ami['on'](_0xac27('0x14'),core[_0xac27('0x14')]);ami['on'](_0xac27('0x15'),core[_0xac27('0x15')]);ami['on'](_0xac27('0x16'),core[_0xac27('0x16')]);ami['on'](_0xac27('0x17'),core[_0xac27('0x17')]);ami['on'](_0xac27('0x18'),function(_0x2d1efe){try{utils[_0xac27('0x19')](util[_0xac27('0x1a')](_0xac27('0x1b'),_0x2d1efe[_0xac27('0x1c')]),_0x2d1efe);members[_0xac27('0x18')](_0x2d1efe);}catch(_0x335e84){utils[_0xac27('0x15')](util[_0xac27('0x1a')]('[%s][index][devicestatechange]',_0x2d1efe[_0xac27('0x1c')]),_0x335e84);}});ami['on'](_0xac27('0x1d'),function(_0xf3a4f9){try{utils[_0xac27('0x19')](util[_0xac27('0x1a')](_0xac27('0x1e'),_0xf3a4f9[_0xac27('0x1f')]),_0xf3a4f9);agents[_0xac27('0x1d')](_0xf3a4f9);}catch(_0x864f84){utils[_0xac27('0x15')](util[_0xac27('0x1a')](_0xac27('0x1e'),_0xf3a4f9['uniqueid']),_0x864f84);}});ami['on']('agentringnoanswer',function(_0x5f598f){try{utils['debug'](util[_0xac27('0x1a')](_0xac27('0x20'),_0x5f598f[_0xac27('0x1f')]),_0x5f598f);agents[_0xac27('0x21')](_0x5f598f);}catch(_0x5bf3b9){utils[_0xac27('0x15')](util[_0xac27('0x1a')](_0xac27('0x20'),_0x5f598f[_0xac27('0x1f')]),_0x5bf3b9);}});ami['on']('agentconnect',function(_0x562e81){try{utils[_0xac27('0x19')](util[_0xac27('0x1a')]('[%s][index][agentconnect]',_0x562e81[_0xac27('0x1f')]),_0x562e81);agents[_0xac27('0x22')](_0x562e81);queues[_0xac27('0x22')](_0x562e81);}catch(_0x1088e6){utils[_0xac27('0x15')](util[_0xac27('0x1a')](_0xac27('0x23'),_0x562e81[_0xac27('0x1f')]),_0x1088e6);}});ami['on'](_0xac27('0x24'),function(_0x2c496e){try{utils['debug'](util['format'](_0xac27('0x25'),_0x2c496e['uniqueid']),_0x2c496e);agents[_0xac27('0x24')](_0x2c496e);queues[_0xac27('0x24')](_0x2c496e);members[_0xac27('0x24')](_0x2c496e);}catch(_0x2ec08d){utils[_0xac27('0x15')](util[_0xac27('0x1a')](_0xac27('0x25'),_0x2c496e['uniqueid']),_0x2ec08d);}});ami['on'](_0xac27('0x26'),function(_0x4d8f20){try{utils[_0xac27('0x19')](util[_0xac27('0x1a')](_0xac27('0x27'),_0x4d8f20[_0xac27('0x1f')]),_0x4d8f20);agents[_0xac27('0x26')](_0x4d8f20);queues[_0xac27('0x26')](_0x4d8f20);}catch(_0xb4a750){utils['error'](util[_0xac27('0x1a')](_0xac27('0x27'),_0x4d8f20[_0xac27('0x1f')]),_0xb4a750);}});ami['on'](_0xac27('0x28'),function(_0x27e8c5){try{utils[_0xac27('0x19')](util['format']('[%s][index][queuecallerjoin]',_0x27e8c5[_0xac27('0x1f')]),_0x27e8c5);queues['queuecallerjoin'](_0x27e8c5);recordings[_0xac27('0x28')](_0x27e8c5);}catch(_0x2cdab3){utils[_0xac27('0x15')](util[_0xac27('0x1a')]('[%s][index][queuecallerjoin]',_0x27e8c5['uniqueid']),_0x2cdab3);}});ami['on'](_0xac27('0x29'),function(_0x3bd425){try{utils[_0xac27('0x19')](util[_0xac27('0x1a')](_0xac27('0x2a'),_0x3bd425['uniqueid']),_0x3bd425);queues[_0xac27('0x29')](_0x3bd425);}catch(_0x445aa6){utils[_0xac27('0x15')](util[_0xac27('0x1a')](_0xac27('0x2a'),_0x3bd425[_0xac27('0x1f')]),_0x445aa6);}});ami['on'](_0xac27('0x2b'),function(_0x2df912){try{utils[_0xac27('0x19')](util[_0xac27('0x1a')](_0xac27('0x2c'),_0x2df912[_0xac27('0x1f')]),_0x2df912);queues[_0xac27('0x2b')](_0x2df912);calls[_0xac27('0x2b')](_0x2df912);}catch(_0x25b32e){utils[_0xac27('0x15')](util[_0xac27('0x1a')](_0xac27('0x2c'),_0x2df912[_0xac27('0x1f')]),_0x25b32e);}});ami['on']('musiconholdstop',function(_0x178301){try{utils[_0xac27('0x19')](util[_0xac27('0x1a')](_0xac27('0x2d'),_0x178301[_0xac27('0x1f')]),_0x178301);queues[_0xac27('0x2e')](_0x178301);calls[_0xac27('0x2e')](_0x178301);}catch(_0x2a71ff){utils['error'](util[_0xac27('0x1a')](_0xac27('0x2d'),_0x178301['uniqueid']),_0x2a71ff);}});ami['on']('newstate',function(_0x29026f){try{utils[_0xac27('0x19')](util['format'](_0xac27('0x2f'),_0x29026f[_0xac27('0x1f')]),_0x29026f);calls['newstate'](_0x29026f);recordings['newstate'](_0x29026f);}catch(_0x2e32ff){utils['error'](util[_0xac27('0x1a')](_0xac27('0x2f'),_0x29026f[_0xac27('0x1f')]),_0x2e32ff);}});ami['on']('hangup',function(_0x4957b6){try{utils['debug'](util[_0xac27('0x1a')](_0xac27('0x30'),_0x4957b6[_0xac27('0x1f')]),_0x4957b6);calls[_0xac27('0x31')](_0x4957b6);recordings[_0xac27('0x31')](_0x4957b6);dials[_0xac27('0x31')](_0x4957b6);agents[_0xac27('0x31')](_0x4957b6);queues[_0xac27('0x31')](_0x4957b6);}catch(_0x215194){utils[_0xac27('0x15')](util[_0xac27('0x1a')]('[%s][index][hangup]',_0x4957b6['uniqueid']),_0x215194);}});ami['on'](_0xac27('0x32'),function(_0x259f0a){try{utils[_0xac27('0x19')](util[_0xac27('0x1a')](_0xac27('0x33'),_0x259f0a[_0xac27('0x1f')]),_0x259f0a);members[_0xac27('0x32')](_0x259f0a);}catch(_0x23afc7){utils[_0xac27('0x15')](util[_0xac27('0x1a')](_0xac27('0x33'),_0x259f0a[_0xac27('0x1f')]),_0x23afc7);}});ami['on'](_0xac27('0x34'),function(_0x149ac3){try{utils[_0xac27('0x19')](util[_0xac27('0x1a')]('[%s][index][blindtransfer]',_0x149ac3[_0xac27('0x1f')]),_0x149ac3);queues[_0xac27('0x34')](_0x149ac3);agents[_0xac27('0x34')](_0x149ac3);transfers[_0xac27('0x34')](_0x149ac3);recordings[_0xac27('0x34')](_0x149ac3);}catch(_0x1ed919){utils[_0xac27('0x15')](util[_0xac27('0x1a')](_0xac27('0x35'),_0x149ac3[_0xac27('0x1f')]),_0x1ed919);}});ami['on'](_0xac27('0x36'),function(_0x51ff0c){try{utils['debug'](util['format']('[%s][index][attendedtransfer]',_0x51ff0c[_0xac27('0x37')]),_0x51ff0c);queues[_0xac27('0x36')](_0x51ff0c);transfers[_0xac27('0x36')](_0x51ff0c);agents[_0xac27('0x36')](_0x51ff0c);calls[_0xac27('0x36')](_0x51ff0c);}catch(_0xc874a){utils[_0xac27('0x15')](util[_0xac27('0x1a')](_0xac27('0x38'),_0x51ff0c[_0xac27('0x37')]),_0xc874a);}});ami['on'](_0xac27('0x39'),function(_0x5443df){try{utils[_0xac27('0x19')](util['format'](_0xac27('0x3a'),_0x5443df[_0xac27('0x1f')]),_0x5443df);queues['varset'](_0x5443df);recordings['varset'](_0x5443df);calls[_0xac27('0x39')](_0x5443df);dials['varset'](_0x5443df);}catch(_0x4257e1){utils['error'](util[_0xac27('0x1a')](_0xac27('0x3a'),_0x5443df[_0xac27('0x1f')]),_0x4257e1);}});ami['on'](_0xac27('0x3b'),function(_0x40daa0){try{utils[_0xac27('0x19')](util['format'](_0xac27('0x3c'),_0x40daa0[_0xac27('0x1f')]),_0x40daa0);calls[_0xac27('0x3b')](_0x40daa0);recordings[_0xac27('0x3b')](_0x40daa0);dials[_0xac27('0x3b')](_0x40daa0);}catch(_0x4e668e){utils[_0xac27('0x15')](util[_0xac27('0x1a')](_0xac27('0x3c'),_0x40daa0[_0xac27('0x1f')]),_0x4e668e);}});ami['on'](_0xac27('0x3d'),function(_0x5587e5){try{utils[_0xac27('0x19')](util[_0xac27('0x1a')](_0xac27('0x3e'),_0x5587e5[_0xac27('0x1f')]),_0x5587e5);calls['newchannel'](_0x5587e5);recordings[_0xac27('0x3d')](_0x5587e5);}catch(_0x56851b){utils[_0xac27('0x15')](util[_0xac27('0x1a')](_0xac27('0x3e'),_0x5587e5['uniqueid']),_0x56851b);}});ami['on'](_0xac27('0x3f'),function(_0x1bf3db){try{utils['debug'](util['format'](_0xac27('0x40'),_0x1bf3db['uniqueid']),_0x1bf3db);dials['dialbegin'](_0x1bf3db);}catch(_0x3e0de5){utils['error'](util[_0xac27('0x1a')](_0xac27('0x41'),_0x1bf3db['uniqueid']),_0x3e0de5);}});ami['on'](_0xac27('0x42'),function(_0x54ec0f){try{utils[_0xac27('0x19')](util[_0xac27('0x1a')](_0xac27('0x43'),_0x54ec0f[_0xac27('0x1f')]),_0x54ec0f);dials[_0xac27('0x42')](_0x54ec0f);}catch(_0x3c867c){utils[_0xac27('0x15')](util[_0xac27('0x1a')](_0xac27('0x43'),_0x54ec0f[_0xac27('0x1f')]),_0x3c867c);}});} \ No newline at end of file +var _0xaa37=['port','asterisk','username','password','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','error','close','managerevent','devicestatechange','debug','format','device','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local'];(function(_0xd39359,_0x452d71){var _0x520b86=function(_0x32dc7e){while(--_0x32dc7e){_0xd39359['push'](_0xd39359['shift']());}};_0x520b86(++_0x452d71);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xaa37[_0x1035c1];return _0x308d67;};var AsteriskManager=require(_0x7aa3('0x0'));var config=require(_0x7aa3('0x1'));var utils=require(_0x7aa3('0x2'));var util=require(_0x7aa3('0x3'));var isXDREnabled=config['xdr']&&!config[_0x7aa3('0x4')][_0x7aa3('0x5')];var isProduction=config[_0x7aa3('0x6')]===_0x7aa3('0x7')||![];var isLocalAsterisk=config[_0x7aa3('0x4')]&&config[_0x7aa3('0x4')][_0x7aa3('0x8')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x7aa3('0x9')],config[_0x7aa3('0xa')]['ip'],config['asterisk'][_0x7aa3('0xb')],config[_0x7aa3('0xa')][_0x7aa3('0xc')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x7aa3('0xd')](_0x7aa3('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x7aa3('0xd')](_0x7aa3('0xf'));}else{var agents=require(_0x7aa3('0x10'));var calls=require(_0x7aa3('0x11'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0x7aa3('0x12'));var dials=require('./dials.controller');var transfers=require(_0x7aa3('0x13'));var core=require(_0x7aa3('0x14'));ami['on']('connect',core[_0x7aa3('0x15')]);ami['on'](_0x7aa3('0x16'),core['shutdown']);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x7aa3('0x17'),core[_0x7aa3('0x17')]);ami['on'](_0x7aa3('0x18'),core[_0x7aa3('0x18')]);ami['on'](_0x7aa3('0x19'),core['managerevent']);ami['on'](_0x7aa3('0x1a'),function(_0x3df7e8){try{utils[_0x7aa3('0x1b')](util[_0x7aa3('0x1c')]('[%s][index][devicestatechange]',_0x3df7e8['device']),_0x3df7e8);members[_0x7aa3('0x1a')](_0x3df7e8);}catch(_0x50ab9e){utils[_0x7aa3('0x17')](util[_0x7aa3('0x1c')]('[%s][index][devicestatechange]',_0x3df7e8[_0x7aa3('0x1d')]),_0x50ab9e);}});ami['on'](_0x7aa3('0x1e'),function(_0x1a4f95){try{utils[_0x7aa3('0x1b')](util[_0x7aa3('0x1c')]('[%s][index][agentcalled]',_0x1a4f95[_0x7aa3('0x1f')]),_0x1a4f95);agents[_0x7aa3('0x1e')](_0x1a4f95);}catch(_0x5defea){utils[_0x7aa3('0x17')](util[_0x7aa3('0x1c')](_0x7aa3('0x20'),_0x1a4f95['uniqueid']),_0x5defea);}});ami['on'](_0x7aa3('0x21'),function(_0x43982b){try{utils[_0x7aa3('0x1b')](util[_0x7aa3('0x1c')](_0x7aa3('0x22'),_0x43982b['uniqueid']),_0x43982b);agents[_0x7aa3('0x21')](_0x43982b);}catch(_0x473160){utils[_0x7aa3('0x17')](util[_0x7aa3('0x1c')](_0x7aa3('0x22'),_0x43982b[_0x7aa3('0x1f')]),_0x473160);}});ami['on'](_0x7aa3('0x23'),function(_0x40645e){try{utils[_0x7aa3('0x1b')](util[_0x7aa3('0x1c')](_0x7aa3('0x24'),_0x40645e[_0x7aa3('0x1f')]),_0x40645e);agents[_0x7aa3('0x23')](_0x40645e);queues['agentconnect'](_0x40645e);}catch(_0x43396f){utils[_0x7aa3('0x17')](util[_0x7aa3('0x1c')](_0x7aa3('0x24'),_0x40645e[_0x7aa3('0x1f')]),_0x43396f);}});ami['on'](_0x7aa3('0x25'),function(_0x47cf18){try{utils[_0x7aa3('0x1b')](util[_0x7aa3('0x1c')](_0x7aa3('0x26'),_0x47cf18['uniqueid']),_0x47cf18);agents[_0x7aa3('0x25')](_0x47cf18);queues[_0x7aa3('0x25')](_0x47cf18);members['agentcomplete'](_0x47cf18);}catch(_0x2ae849){utils[_0x7aa3('0x17')](util[_0x7aa3('0x1c')](_0x7aa3('0x26'),_0x47cf18[_0x7aa3('0x1f')]),_0x2ae849);}});ami['on'](_0x7aa3('0x27'),function(_0x3adc17){try{utils[_0x7aa3('0x1b')](util[_0x7aa3('0x1c')](_0x7aa3('0x28'),_0x3adc17[_0x7aa3('0x1f')]),_0x3adc17);agents[_0x7aa3('0x27')](_0x3adc17);queues[_0x7aa3('0x27')](_0x3adc17);}catch(_0xc3976c){utils[_0x7aa3('0x17')](util[_0x7aa3('0x1c')](_0x7aa3('0x28'),_0x3adc17[_0x7aa3('0x1f')]),_0xc3976c);}});ami['on'](_0x7aa3('0x29'),function(_0x14ad90){try{utils[_0x7aa3('0x1b')](util['format'](_0x7aa3('0x2a'),_0x14ad90[_0x7aa3('0x1f')]),_0x14ad90);queues[_0x7aa3('0x29')](_0x14ad90);recordings[_0x7aa3('0x29')](_0x14ad90);}catch(_0x403c9a){utils[_0x7aa3('0x17')](util[_0x7aa3('0x1c')](_0x7aa3('0x2a'),_0x14ad90[_0x7aa3('0x1f')]),_0x403c9a);}});ami['on'](_0x7aa3('0x2b'),function(_0x29e90a){try{utils['debug'](util[_0x7aa3('0x1c')](_0x7aa3('0x2c'),_0x29e90a[_0x7aa3('0x1f')]),_0x29e90a);queues[_0x7aa3('0x2b')](_0x29e90a);}catch(_0x89d47){utils[_0x7aa3('0x17')](util[_0x7aa3('0x1c')](_0x7aa3('0x2c'),_0x29e90a[_0x7aa3('0x1f')]),_0x89d47);}});ami['on'](_0x7aa3('0x2d'),function(_0x6f551e){try{utils[_0x7aa3('0x1b')](util[_0x7aa3('0x1c')](_0x7aa3('0x2e'),_0x6f551e['uniqueid']),_0x6f551e);queues[_0x7aa3('0x2d')](_0x6f551e);calls[_0x7aa3('0x2d')](_0x6f551e);}catch(_0xbdc351){utils[_0x7aa3('0x17')](util['format'](_0x7aa3('0x2e'),_0x6f551e['uniqueid']),_0xbdc351);}});ami['on'](_0x7aa3('0x2f'),function(_0x3c12e4){try{utils[_0x7aa3('0x1b')](util[_0x7aa3('0x1c')](_0x7aa3('0x30'),_0x3c12e4[_0x7aa3('0x1f')]),_0x3c12e4);queues[_0x7aa3('0x2f')](_0x3c12e4);calls[_0x7aa3('0x2f')](_0x3c12e4);}catch(_0x839ecf){utils[_0x7aa3('0x17')](util['format'](_0x7aa3('0x30'),_0x3c12e4[_0x7aa3('0x1f')]),_0x839ecf);}});ami['on'](_0x7aa3('0x31'),function(_0x11111a){try{utils[_0x7aa3('0x1b')](util[_0x7aa3('0x1c')](_0x7aa3('0x32'),_0x11111a[_0x7aa3('0x1f')]),_0x11111a);calls[_0x7aa3('0x31')](_0x11111a);recordings[_0x7aa3('0x31')](_0x11111a);}catch(_0xc21d54){utils[_0x7aa3('0x17')](util[_0x7aa3('0x1c')](_0x7aa3('0x32'),_0x11111a['uniqueid']),_0xc21d54);}});ami['on'](_0x7aa3('0x33'),function(_0x3fef9c){try{utils['debug'](util[_0x7aa3('0x1c')](_0x7aa3('0x34'),_0x3fef9c['uniqueid']),_0x3fef9c);calls[_0x7aa3('0x33')](_0x3fef9c);recordings[_0x7aa3('0x33')](_0x3fef9c);dials[_0x7aa3('0x33')](_0x3fef9c);agents[_0x7aa3('0x33')](_0x3fef9c);queues['hangup'](_0x3fef9c);}catch(_0x4bd8ee){utils[_0x7aa3('0x17')](util['format'](_0x7aa3('0x34'),_0x3fef9c['uniqueid']),_0x4bd8ee);}});ami['on']('cdr',function(_0x15d558){try{utils[_0x7aa3('0x1b')](util[_0x7aa3('0x1c')](_0x7aa3('0x35'),_0x15d558[_0x7aa3('0x1f')]),_0x15d558);members['cdr'](_0x15d558);}catch(_0x337fa9){utils[_0x7aa3('0x17')](util['format'](_0x7aa3('0x35'),_0x15d558[_0x7aa3('0x1f')]),_0x337fa9);}});ami['on'](_0x7aa3('0x36'),function(_0x494d16){try{utils[_0x7aa3('0x1b')](util[_0x7aa3('0x1c')]('[%s][index][blindtransfer]',_0x494d16[_0x7aa3('0x1f')]),_0x494d16);queues[_0x7aa3('0x36')](_0x494d16);agents['blindtransfer'](_0x494d16);transfers['blindtransfer'](_0x494d16);recordings[_0x7aa3('0x36')](_0x494d16);}catch(_0x1a990){utils[_0x7aa3('0x17')](util[_0x7aa3('0x1c')]('[%s][index][blindtransfer]',_0x494d16['uniqueid']),_0x1a990);}});ami['on'](_0x7aa3('0x37'),function(_0x1d9ace){try{utils[_0x7aa3('0x1b')](util[_0x7aa3('0x1c')]('[%s][index][attendedtransfer]',_0x1d9ace['origtransfereruniqueid']),_0x1d9ace);queues['attendedtransfer'](_0x1d9ace);transfers[_0x7aa3('0x37')](_0x1d9ace);agents[_0x7aa3('0x37')](_0x1d9ace);calls[_0x7aa3('0x37')](_0x1d9ace);}catch(_0x4934ad){utils[_0x7aa3('0x17')](util[_0x7aa3('0x1c')](_0x7aa3('0x38'),_0x1d9ace[_0x7aa3('0x39')]),_0x4934ad);}});ami['on'](_0x7aa3('0x3a'),function(_0xc28984){try{utils['debug'](util[_0x7aa3('0x1c')]('[%s][index][varset]',_0xc28984['uniqueid']),_0xc28984);queues['varset'](_0xc28984);recordings['varset'](_0xc28984);calls[_0x7aa3('0x3a')](_0xc28984);dials[_0x7aa3('0x3a')](_0xc28984);}catch(_0x47abe1){utils[_0x7aa3('0x17')](util[_0x7aa3('0x1c')](_0x7aa3('0x3b'),_0xc28984['uniqueid']),_0x47abe1);}});ami['on']('newexten',function(_0x439bb1){try{utils[_0x7aa3('0x1b')](util[_0x7aa3('0x1c')]('[%s][index][newexten]',_0x439bb1['uniqueid']),_0x439bb1);calls['newexten'](_0x439bb1);recordings['newexten'](_0x439bb1);dials[_0x7aa3('0x3c')](_0x439bb1);}catch(_0x37f396){utils[_0x7aa3('0x17')](util[_0x7aa3('0x1c')]('[%s][index][newexten]',_0x439bb1[_0x7aa3('0x1f')]),_0x37f396);}});ami['on'](_0x7aa3('0x3d'),function(_0x4588b5){try{utils[_0x7aa3('0x1b')](util[_0x7aa3('0x1c')](_0x7aa3('0x3e'),_0x4588b5[_0x7aa3('0x1f')]),_0x4588b5);calls[_0x7aa3('0x3d')](_0x4588b5);recordings['newchannel'](_0x4588b5);}catch(_0x432a6e){utils[_0x7aa3('0x17')](util[_0x7aa3('0x1c')](_0x7aa3('0x3e'),_0x4588b5[_0x7aa3('0x1f')]),_0x432a6e);}});ami['on'](_0x7aa3('0x3f'),function(_0x45844e){try{utils[_0x7aa3('0x1b')](util['format'](_0x7aa3('0x40'),_0x45844e[_0x7aa3('0x1f')]),_0x45844e);dials['dialbegin'](_0x45844e);}catch(_0x400d39){utils[_0x7aa3('0x17')](util[_0x7aa3('0x1c')](_0x7aa3('0x41'),_0x45844e[_0x7aa3('0x1f')]),_0x400d39);}});ami['on'](_0x7aa3('0x42'),function(_0x9f277d){try{utils[_0x7aa3('0x1b')](util['format'](_0x7aa3('0x43'),_0x9f277d[_0x7aa3('0x1f')]),_0x9f277d);dials[_0x7aa3('0x42')](_0x9f277d);}catch(_0x7b2306){utils[_0x7aa3('0x17')](util[_0x7aa3('0x1c')](_0x7aa3('0x43'),_0x9f277d[_0x7aa3('0x1f')]),_0x7b2306);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index ae0a2f6..afdac41 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 _0x6df5=['data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','request','catch','error','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','[%s][members][devicestatechange]','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','channel','split','data1','type'];(function(_0x177b31,_0x2d26dc){var _0x24eda9=function(_0x30208e){while(--_0x30208e){_0x177b31['push'](_0x177b31['shift']());}};_0x24eda9(++_0x2d26dc);}(_0x6df5,0xa6));var _0x56df=function(_0x501c32,_0x2f24c9){_0x501c32=_0x501c32-0x0;var _0x9bd372=_0x6df5[_0x501c32];return _0x9bd372;};'use strict';var _=require(_0x56df('0x0'));var util=require(_0x56df('0x1'));var utils=require(_0x56df('0x2'));var members={};var exclude=[_0x56df('0x3'),_0x56df('0x4')];function writeDB(_0x35f00a){utils[_0x56df('0x5')](util[_0x56df('0x6')](_0x56df('0x7'),_0x35f00a[_0x56df('0x8')],_0x35f00a[_0x56df('0x9')],_0x35f00a['channel'],_0x35f00a['data2'],_0x35f00a[_0x56df('0xa')],_0x35f00a['type']));if(_0x35f00a[_0x56df('0x9')]){utils[_0x56df('0xb')](_0x35f00a[_0x56df('0x9')])[_0x56df('0xc')](function(_0x3f06ab){if(_0x3f06ab){_0x35f00a[_0x56df('0xa')]=_0x3f06ab[_0x56df('0xd')];_0x35f00a[_0x56df('0xe')]=_0x3f06ab[_0x56df('0xe')];utils['request'](_0x56df('0xf'),_0x35f00a);}else{utils[_0x56df('0x10')](_0x35f00a['interface']['split']('/')[0x1])['then'](function(_0x538bc7){if(_0x538bc7){_0x35f00a['membername']=_0x538bc7[_0x56df('0xd')];_0x35f00a[_0x56df('0xe')]=_0x538bc7['internal'];utils[_0x56df('0x11')]('CreateMemberReport',_0x35f00a);}});}})[_0x56df('0x12')](function(_0x41a20b){utils[_0x56df('0x13')](util[_0x56df('0x6')]('[%s][members][writeDB]',_0x35f00a['uniqueid']),_0x41a20b);});}delete members[_0x35f00a['interface']];}function startsWith(_0x4d34ac,_0x54d574){return _['some'](_0x4d34ac,function(_0x1e148c){return _[_0x56df('0x14')](_0x54d574,_0x1e148c);});}exports[_0x56df('0x15')]=function(_0x149a9c){try{utils[_0x56df('0x16')](util[_0x56df('0x6')]('[%s][members][devicestatechange]',members[_0x149a9c[_0x56df('0x17')]]?members[_0x149a9c[_0x56df('0x17')]][_0x56df('0x8')]:_0x149a9c[_0x56df('0x17')]),_0x149a9c);utils[_0x56df('0x5')](util[_0x56df('0x6')](_0x56df('0x18'),members[_0x149a9c['device']]?members[_0x149a9c['device']]['uniqueid']:_0x149a9c['device'],_0x149a9c[_0x56df('0x19')],_0x149a9c[_0x56df('0x17')]));switch(_0x149a9c[_0x56df('0x19')]){case'INUSE':case _0x56df('0x1a'):if(!startsWith(exclude,_0x149a9c[_0x56df('0x17')])){members[_0x149a9c[_0x56df('0x17')]]={'channel':_0x56df('0x1b'),'interface':_0x149a9c[_0x56df('0x17')],'type':_0x56df('0x1c'),'enterAt':utils[_0x56df('0x1d')](),'role':_0x56df('0x1e')};}break;case _0x56df('0x1f'):if(!_[_0x56df('0x20')](members[_0x149a9c[_0x56df('0x17')]])){members[_0x149a9c[_0x56df('0x17')]][_0x56df('0x21')]=utils['now']();members[_0x149a9c['device']][_0x56df('0x22')]=utils[_0x56df('0x23')](members[_0x149a9c[_0x56df('0x17')]][_0x56df('0x21')],members[_0x149a9c[_0x56df('0x17')]]['enterAt']);if(members[_0x149a9c[_0x56df('0x17')]][_0x56df('0x8')]){writeDB(members[_0x149a9c[_0x56df('0x17')]]);}}break;default:break;}}catch(_0x3536a4){utils[_0x56df('0x13')](util[_0x56df('0x6')](_0x56df('0x24'),members[_0x149a9c[_0x56df('0x17')]]?members[_0x149a9c[_0x56df('0x17')]][_0x56df('0x8')]:_0x149a9c[_0x56df('0x17')]),_0x3536a4);}};exports['agentcomplete']=function(_0x5aa7bd){try{if(!_[_0x56df('0x20')](members[_0x5aa7bd['interface']])){utils[_0x56df('0x16')](util['format'](_0x56df('0x25'),_0x5aa7bd[_0x56df('0x8')]),_0x5aa7bd);utils[_0x56df('0x5')](util[_0x56df('0x6')](_0x56df('0x26'),_0x5aa7bd[_0x56df('0x8')],_0x5aa7bd[_0x56df('0x9')],_0x5aa7bd[_0x56df('0x27')]));members[_0x5aa7bd[_0x56df('0x9')]]=_[_0x56df('0x28')](members[_0x5aa7bd[_0x56df('0x9')]],{'data4':_0x5aa7bd['queue'],'uniqueid':_0x5aa7bd[_0x56df('0x8')]});}}catch(_0x5a155c){utils[_0x56df('0x13')](util[_0x56df('0x6')](_0x56df('0x25'),_0x5aa7bd['uniqueid']),_0x5a155c);}};exports[_0x56df('0x29')]=function(_0x30c2c6){try{utils[_0x56df('0x16')](util[_0x56df('0x6')]('[%s][members][cdr]',_0x30c2c6['uniqueid']),_0x30c2c6);if(_0x30c2c6[_0x56df('0x2a')]){var _0x134dda=_0x30c2c6['channel'][_0x56df('0x2b')]('-')[0x0];if(!_[_0x56df('0x20')](members[_0x134dda])){members[_0x134dda]=_[_0x56df('0x28')](members[_0x134dda],{'data1':members[_0x134dda][_0x56df('0x2c')]||_0x30c2c6[_0x56df('0x2d')],'data2':members[_0x134dda][_0x56df('0x2e')]||_0x30c2c6[_0x56df('0x2f')],'data3':members[_0x134dda][_0x56df('0x30')]||_0x30c2c6[_0x56df('0x31')],'uniqueid':members[_0x134dda][_0x56df('0x8')]||_0x30c2c6['uniqueid']});utils[_0x56df('0x5')](util[_0x56df('0x6')](_0x56df('0x32'),_0x30c2c6[_0x56df('0x8')],members[_0x134dda][_0x56df('0x2c')],members[_0x134dda][_0x56df('0x2e')],members[_0x134dda][_0x56df('0x30')]));if(members[_0x134dda]['exitAt']){writeDB(members[_0x134dda]);}}}if(_0x30c2c6[_0x56df('0x33')]){var _0x3e1305=_0x30c2c6[_0x56df('0x33')]['split']('-')[0x0];if(!_['isNil'](members[_0x3e1305])){members[_0x3e1305]=_[_0x56df('0x28')](members[_0x3e1305],{'data1':members[_0x3e1305]['data1']||_0x30c2c6['type'],'data2':members[_0x3e1305]['data2']||_0x30c2c6[_0x56df('0x2f')],'data3':members[_0x3e1305][_0x56df('0x30')]||_0x30c2c6[_0x56df('0x31')],'uniqueid':members[_0x3e1305][_0x56df('0x8')]||_0x30c2c6[_0x56df('0x8')]});utils[_0x56df('0x5')](util[_0x56df('0x6')](_0x56df('0x32'),_0x30c2c6['uniqueid'],members[_0x3e1305]['data1'],members[_0x3e1305][_0x56df('0x2e')],members[_0x3e1305][_0x56df('0x30')]));if(members[_0x3e1305][_0x56df('0x21')]){writeDB(members[_0x3e1305]);}}}}catch(_0xc5e697){utils[_0x56df('0x13')](util['format'](_0x56df('0x34'),_0x30c2c6[_0x56df('0x8')]),_0xc5e697);}}; \ No newline at end of file +var _0xc1fa=['interface','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','TALKING','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','[%s][members][cdr]','data2','source','data3','data1','destinationchannel','destination','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','format','[%s][members][writeDB]'];(function(_0x361bb4,_0x411189){var _0x3e88c3=function(_0x263662){while(--_0x263662){_0x361bb4['push'](_0x361bb4['shift']());}};_0x3e88c3(++_0x411189);}(_0xc1fa,0xe5));var _0xac1f=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0xc1fa[_0x492535];return _0x256620;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xac1f('0x0'));var members={};var exclude=[_0xac1f('0x1'),_0xac1f('0x2')];function writeDB(_0x53bacc){utils[_0xac1f('0x3')](util['format'](_0xac1f('0x4'),_0x53bacc[_0xac1f('0x5')],_0x53bacc['interface'],_0x53bacc[_0xac1f('0x6')],_0x53bacc['data2'],_0x53bacc[_0xac1f('0x7')],_0x53bacc[_0xac1f('0x8')]));if(_0x53bacc['interface']){utils[_0xac1f('0x9')](_0x53bacc['interface'])[_0xac1f('0xa')](function(_0x240fb0){if(_0x240fb0){_0x53bacc[_0xac1f('0x7')]=_0x240fb0[_0xac1f('0xb')];_0x53bacc['internal']=_0x240fb0[_0xac1f('0xc')];utils[_0xac1f('0xd')](_0xac1f('0xe'),_0x53bacc);}else{utils[_0xac1f('0xf')](_0x53bacc['interface'][_0xac1f('0x10')]('/')[0x1])['then'](function(_0x171e01){if(_0x171e01){_0x53bacc[_0xac1f('0x7')]=_0x171e01['name'];_0x53bacc[_0xac1f('0xc')]=_0x171e01[_0xac1f('0xc')];utils['request'](_0xac1f('0xe'),_0x53bacc);}});}})[_0xac1f('0x11')](function(_0x2ee98e){utils[_0xac1f('0x12')](util[_0xac1f('0x13')](_0xac1f('0x14'),_0x53bacc[_0xac1f('0x5')]),_0x2ee98e);});}delete members[_0x53bacc[_0xac1f('0x15')]];}function startsWith(_0x3ab3cd,_0x5a8bba){return _[_0xac1f('0x16')](_0x3ab3cd,function(_0x5d39bf){return _[_0xac1f('0x17')](_0x5a8bba,_0x5d39bf);});}exports[_0xac1f('0x18')]=function(_0x3146b8){try{utils[_0xac1f('0x19')](util[_0xac1f('0x13')](_0xac1f('0x1a'),members[_0x3146b8[_0xac1f('0x1b')]]?members[_0x3146b8[_0xac1f('0x1b')]][_0xac1f('0x5')]:_0x3146b8['device']),_0x3146b8);utils['info'](util[_0xac1f('0x13')](_0xac1f('0x1c'),members[_0x3146b8[_0xac1f('0x1b')]]?members[_0x3146b8[_0xac1f('0x1b')]][_0xac1f('0x5')]:_0x3146b8[_0xac1f('0x1b')],_0x3146b8[_0xac1f('0x1d')],_0x3146b8[_0xac1f('0x1b')]));switch(_0x3146b8[_0xac1f('0x1d')]){case _0xac1f('0x1e'):case'BUSY':if(!startsWith(exclude,_0x3146b8[_0xac1f('0x1b')])){members[_0x3146b8[_0xac1f('0x1b')]]={'channel':'voice','interface':_0x3146b8[_0xac1f('0x1b')],'type':_0xac1f('0x1f'),'enterAt':utils[_0xac1f('0x20')](),'role':'agent'};}break;case _0xac1f('0x21'):if(!_[_0xac1f('0x22')](members[_0x3146b8[_0xac1f('0x1b')]])){members[_0x3146b8[_0xac1f('0x1b')]][_0xac1f('0x23')]=utils['now']();members[_0x3146b8[_0xac1f('0x1b')]][_0xac1f('0x24')]=utils[_0xac1f('0x25')](members[_0x3146b8[_0xac1f('0x1b')]]['exitAt'],members[_0x3146b8['device']][_0xac1f('0x26')]);if(members[_0x3146b8[_0xac1f('0x1b')]][_0xac1f('0x5')]){writeDB(members[_0x3146b8[_0xac1f('0x1b')]]);}}break;default:break;}}catch(_0x2b491d){utils[_0xac1f('0x12')](util[_0xac1f('0x13')](_0xac1f('0x1a'),members[_0x3146b8[_0xac1f('0x1b')]]?members[_0x3146b8['device']][_0xac1f('0x5')]:_0x3146b8[_0xac1f('0x1b')]),_0x2b491d);}};exports[_0xac1f('0x27')]=function(_0x2f62f8){try{if(!_[_0xac1f('0x22')](members[_0x2f62f8[_0xac1f('0x15')]])){utils[_0xac1f('0x19')](util[_0xac1f('0x13')](_0xac1f('0x28'),_0x2f62f8[_0xac1f('0x5')]),_0x2f62f8);utils[_0xac1f('0x3')](util[_0xac1f('0x13')](_0xac1f('0x29'),_0x2f62f8[_0xac1f('0x5')],_0x2f62f8[_0xac1f('0x15')],_0x2f62f8['queue']));members[_0x2f62f8[_0xac1f('0x15')]]=_[_0xac1f('0x2a')](members[_0x2f62f8['interface']],{'data4':_0x2f62f8['queue'],'uniqueid':_0x2f62f8[_0xac1f('0x5')]});}}catch(_0x2d3ca5){utils['error'](util['format'](_0xac1f('0x28'),_0x2f62f8[_0xac1f('0x5')]),_0x2d3ca5);}};exports['cdr']=function(_0x50c9ff){try{utils[_0xac1f('0x19')](util[_0xac1f('0x13')](_0xac1f('0x2b'),_0x50c9ff[_0xac1f('0x5')]),_0x50c9ff);if(_0x50c9ff[_0xac1f('0x6')]){var _0x412b62=_0x50c9ff[_0xac1f('0x6')][_0xac1f('0x10')]('-')[0x0];if(!_[_0xac1f('0x22')](members[_0x412b62])){members[_0x412b62]=_[_0xac1f('0x2a')](members[_0x412b62],{'data1':members[_0x412b62]['data1']||_0x50c9ff[_0xac1f('0x8')],'data2':members[_0x412b62][_0xac1f('0x2c')]||_0x50c9ff[_0xac1f('0x2d')],'data3':members[_0x412b62][_0xac1f('0x2e')]||_0x50c9ff['destination'],'uniqueid':members[_0x412b62]['uniqueid']||_0x50c9ff[_0xac1f('0x5')]});utils[_0xac1f('0x3')](util[_0xac1f('0x13')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x50c9ff[_0xac1f('0x5')],members[_0x412b62][_0xac1f('0x2f')],members[_0x412b62][_0xac1f('0x2c')],members[_0x412b62][_0xac1f('0x2e')]));if(members[_0x412b62]['exitAt']){writeDB(members[_0x412b62]);}}}if(_0x50c9ff['destinationchannel']){var _0x1c4cf0=_0x50c9ff[_0xac1f('0x30')][_0xac1f('0x10')]('-')[0x0];if(!_[_0xac1f('0x22')](members[_0x1c4cf0])){members[_0x1c4cf0]=_[_0xac1f('0x2a')](members[_0x1c4cf0],{'data1':members[_0x1c4cf0][_0xac1f('0x2f')]||_0x50c9ff[_0xac1f('0x8')],'data2':members[_0x1c4cf0]['data2']||_0x50c9ff[_0xac1f('0x2d')],'data3':members[_0x1c4cf0][_0xac1f('0x2e')]||_0x50c9ff[_0xac1f('0x31')],'uniqueid':members[_0x1c4cf0][_0xac1f('0x5')]||_0x50c9ff[_0xac1f('0x5')]});utils[_0xac1f('0x3')](util[_0xac1f('0x13')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x50c9ff['uniqueid'],members[_0x1c4cf0]['data1'],members[_0x1c4cf0][_0xac1f('0x2c')],members[_0x1c4cf0][_0xac1f('0x2e')]));if(members[_0x1c4cf0]['exitAt']){writeDB(members[_0x1c4cf0]);}}}}catch(_0xfa5c82){utils[_0xac1f('0x12')](util[_0xac1f('0x13')](_0xac1f('0x2b'),_0x50c9ff[_0xac1f('0x5')]),_0xfa5c82);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 0967bac..06877ff 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 _0x8b3c=['[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','extension','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridnum','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','secondtransfererexten','ATTENDED','transfertargetlinkedid','queuecallerjoinAt','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','./utils','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','format','info','position','assign','now','error','[%s][queues][queuecallerjoin]','hangup','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b3c,0x97));var _0xc8b3=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0x8b3c[_0x5c1cdc];return _0x2e8317;};'use strict';var _=require(_0xc8b3('0x0'));var util=require('util');var utils=require(_0xc8b3('0x1'));var queues={};function writeDB(_0x1b72b1){utils['info'](util['format'](_0xc8b3('0x2'),_0x1b72b1['uniqueid'],_0x1b72b1['channel'],_0x1b72b1[_0xc8b3('0x3')],_0x1b72b1[_0xc8b3('0x4')],_0x1b72b1['calleridnum'],_0x1b72b1[_0xc8b3('0x5')],_0x1b72b1[_0xc8b3('0x6')]));if(_0x1b72b1[_0xc8b3('0x3')]){utils[_0xc8b3('0x7')](_0x1b72b1[_0xc8b3('0x3')])['then'](function(_0x29a27c){if(_0x29a27c){_0x1b72b1[_0xc8b3('0x8')]=_0x29a27c[_0xc8b3('0x8')];}utils['request'](_0xc8b3('0x9'),_0x1b72b1);});}else{utils[_0xc8b3('0xa')](_0xc8b3('0x9'),_0x1b72b1);}if(_0x1b72b1['transfereduniqueid']){delete queues[_0x1b72b1[_0xc8b3('0xb')]];}else{delete queues[_0x1b72b1[_0xc8b3('0xc')]];}}exports['queuecallerjoin']=function(_0x190d39){try{utils['debug'](util[_0xc8b3('0xd')]('[%s][queues][queuecallerjoin]',_0x190d39[_0xc8b3('0xc')]),_0x190d39);utils[_0xc8b3('0xe')](util[_0xc8b3('0xd')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x190d39[_0xc8b3('0xc')],_0x190d39[_0xc8b3('0x3')],_0x190d39[_0xc8b3('0xf')]));queues[_0x190d39[_0xc8b3('0xc')]]=_[_0xc8b3('0x10')](_0x190d39,{'originalposition':_0x190d39[_0xc8b3('0xf')],'queuecallerjoinAt':utils[_0xc8b3('0x11')](),'mohtime':0x0});}catch(_0x513e47){utils[_0xc8b3('0x12')](util[_0xc8b3('0xd')](_0xc8b3('0x13'),_0x190d39['uniqueid']),_0x513e47);}};exports[_0xc8b3('0x14')]=function(_0x7a78b5){try{if(!_['isNil'](queues[_0x7a78b5['uniqueid']])){utils[_0xc8b3('0x15')](util[_0xc8b3('0xd')](_0xc8b3('0x16'),_0x7a78b5[_0xc8b3('0xc')]),_0x7a78b5);if(queues[_0x7a78b5[_0xc8b3('0xc')]][_0xc8b3('0x17')]){if(!queues[_0x7a78b5['uniqueid']][_0xc8b3('0x18')]&&!queues[_0x7a78b5['uniqueid']][_0xc8b3('0x19')]){queues[_0x7a78b5[_0xc8b3('0xc')]][_0xc8b3('0x1a')]=!![];queues[_0x7a78b5[_0xc8b3('0xc')]][_0xc8b3('0x1b')]=utils[_0xc8b3('0x11')]();queues[_0x7a78b5[_0xc8b3('0xc')]]['queuecallerexitreason']=_0xc8b3('0x1c');}utils['info'](util[_0xc8b3('0xd')](_0xc8b3('0x1d'),_0x7a78b5['uniqueid'],queues[_0x7a78b5[_0xc8b3('0xc')]]['name'],queues[_0x7a78b5[_0xc8b3('0xc')]][_0xc8b3('0x6')]));writeDB(queues[_0x7a78b5[_0xc8b3('0xc')]]);}else if(queues[_0x7a78b5[_0xc8b3('0xc')]]['transfereduniqueid']){utils[_0xc8b3('0xe')](util[_0xc8b3('0xd')](_0xc8b3('0x1e'),_0x7a78b5['uniqueid'],queues[_0x7a78b5[_0xc8b3('0xc')]]['name'],queues[_0x7a78b5[_0xc8b3('0xc')]][_0xc8b3('0xb')]));queues[queues[_0x7a78b5[_0xc8b3('0xc')]][_0xc8b3('0xb')]]=queues[_0x7a78b5[_0xc8b3('0xc')]];queues[queues[_0x7a78b5[_0xc8b3('0xc')]][_0xc8b3('0xb')]]['queuecallerenterreason']=0x2;delete queues[_0x7a78b5['uniqueid']];}}}catch(_0xfe8601){utils[_0xc8b3('0x12')](util[_0xc8b3('0xd')](_0xc8b3('0x16'),_0x7a78b5[_0xc8b3('0xc')]),_0xfe8601);}};exports[_0xc8b3('0x1f')]=function(_0x108e98){try{utils[_0xc8b3('0x15')](util[_0xc8b3('0xd')](_0xc8b3('0x20'),_0x108e98[_0xc8b3('0xc')]),_0x108e98);if(!_[_0xc8b3('0x21')](_0x108e98[_0xc8b3('0x22')][_0xc8b3('0x23')])&&_0x108e98[_0xc8b3('0x24')][_0xc8b3('0x25')]()!==_0xc8b3('0x26')){if(!_[_0xc8b3('0x21')](queues[_0x108e98[_0xc8b3('0xc')]])){queues[_0x108e98[_0xc8b3('0xc')]]['queuecallerabandon']=![];queues[_0x108e98['uniqueid']][_0xc8b3('0x27')]=null;queues[_0x108e98[_0xc8b3('0xc')]][_0xc8b3('0x19')]=!![];queues[_0x108e98['uniqueid']][_0xc8b3('0x28')]=utils[_0xc8b3('0x11')]();queues[_0x108e98[_0xc8b3('0xc')]][_0xc8b3('0x6')]=_0x108e98[_0xc8b3('0x24')][_0xc8b3('0x25')]();utils[_0xc8b3('0xe')](util[_0xc8b3('0xd')](_0xc8b3('0x29'),_0x108e98[_0xc8b3('0xc')],queues[_0x108e98[_0xc8b3('0xc')]][_0xc8b3('0x2a')],_0x108e98[_0xc8b3('0x24')],queues[_0x108e98[_0xc8b3('0xc')]][_0xc8b3('0x6')]));writeDB(queues[_0x108e98[_0xc8b3('0xc')]]);}}else if(!_[_0xc8b3('0x21')](_0x108e98[_0xc8b3('0x22')]['queueposition'])){if(!_['isNil'](queues[_0x108e98[_0xc8b3('0xc')]])&&!queues[_0x108e98[_0xc8b3('0xc')]]['queuecallerabandon']){queues[_0x108e98[_0xc8b3('0xc')]][_0xc8b3('0x18')]=![];queues[_0x108e98[_0xc8b3('0xc')]][_0xc8b3('0x27')]=null;queues[_0x108e98[_0xc8b3('0xc')]]['queuecallerexit']=!![];queues[_0x108e98[_0xc8b3('0xc')]][_0xc8b3('0x28')]=utils[_0xc8b3('0x11')]();queues[_0x108e98['uniqueid']]['queuecallerexitreason']=_0xc8b3('0x2b');utils['info'](util[_0xc8b3('0xd')](_0xc8b3('0x2c'),_0x108e98['uniqueid'],queues[_0x108e98[_0xc8b3('0xc')]][_0xc8b3('0x2a')],_0x108e98['value'],queues[_0x108e98[_0xc8b3('0xc')]][_0xc8b3('0x6')]));}}}catch(_0x1198ac){utils[_0xc8b3('0x12')](util[_0xc8b3('0xd')](_0xc8b3('0x20'),_0x108e98[_0xc8b3('0xc')]),_0x1198ac);}};exports[_0xc8b3('0x18')]=function(_0x271ffb){try{if(!_[_0xc8b3('0x21')](queues[_0x271ffb['uniqueid']])){utils['debug'](util[_0xc8b3('0xd')](_0xc8b3('0x2d'),_0x271ffb[_0xc8b3('0xc')]),_0x271ffb);queues[_0x271ffb['uniqueid']][_0xc8b3('0x19')]=![];queues[_0x271ffb['uniqueid']][_0xc8b3('0x28')]=null;queues[_0x271ffb['uniqueid']][_0xc8b3('0x18')]=!![];queues[_0x271ffb[_0xc8b3('0xc')]][_0xc8b3('0x27')]=utils[_0xc8b3('0x11')]();queues[_0x271ffb[_0xc8b3('0xc')]][_0xc8b3('0x6')]=_0xc8b3('0x2e');utils['info'](util[_0xc8b3('0xd')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x271ffb[_0xc8b3('0xc')],queues[_0x271ffb['uniqueid']][_0xc8b3('0x2a')],queues[_0x271ffb[_0xc8b3('0xc')]][_0xc8b3('0x6')]));}}catch(_0x1a18a7){utils[_0xc8b3('0x12')](util[_0xc8b3('0xd')](_0xc8b3('0x2d'),_0x271ffb[_0xc8b3('0xc')]),_0x1a18a7);}};exports[_0xc8b3('0x2f')]=function(_0x4da89d){try{if(!_[_0xc8b3('0x21')](queues[_0x4da89d['uniqueid']])){utils[_0xc8b3('0x15')](util[_0xc8b3('0xd')](_0xc8b3('0x30'),_0x4da89d[_0xc8b3('0xc')]),_0x4da89d);utils['info'](util[_0xc8b3('0xd')](_0xc8b3('0x31'),_0x4da89d[_0xc8b3('0xc')],queues[_0x4da89d[_0xc8b3('0xc')]][_0xc8b3('0x2a')],_0x4da89d[_0xc8b3('0x32')],_0x4da89d[_0xc8b3('0x33')]));queues[_0x4da89d[_0xc8b3('0xc')]][_0xc8b3('0x2f')]=!![];queues[_0x4da89d[_0xc8b3('0xc')]][_0xc8b3('0x17')]=utils['now']();queues[_0x4da89d['uniqueid']][_0xc8b3('0x34')]=utils[_0xc8b3('0x35')](queues[_0x4da89d[_0xc8b3('0xc')]]['queuecallerleaveAt'],queues[_0x4da89d[_0xc8b3('0xc')]]['queuecallerjoinAt']);queues[_0x4da89d['uniqueid']][_0xc8b3('0xf')]=_0x4da89d['position'];queues[_0x4da89d[_0xc8b3('0xc')]][_0xc8b3('0x36')]=_0x4da89d[_0xc8b3('0x36')];queues[_0x4da89d[_0xc8b3('0xc')]][_0xc8b3('0x32')]=_0x4da89d[_0xc8b3('0x32')];queues[_0x4da89d[_0xc8b3('0xc')]][_0xc8b3('0x33')]=_0x4da89d[_0xc8b3('0x33')];}}catch(_0x3df7fe){utils[_0xc8b3('0x12')](util['format'](_0xc8b3('0x30'),_0x4da89d[_0xc8b3('0xc')]),_0x3df7fe);}};exports[_0xc8b3('0x37')]=function(_0x242103){try{if(!_[_0xc8b3('0x21')](queues[_0x242103[_0xc8b3('0xc')]])){utils[_0xc8b3('0x15')](util[_0xc8b3('0xd')]('[%s][queues][agentconnect]',_0x242103[_0xc8b3('0xc')]),_0x242103);utils[_0xc8b3('0xe')](util[_0xc8b3('0xd')](_0xc8b3('0x38'),_0x242103[_0xc8b3('0xc')],queues[_0x242103[_0xc8b3('0xc')]]['name'],_0x242103[_0xc8b3('0x39')],_0x242103['destaccountcode']));queues[_0x242103[_0xc8b3('0xc')]]['queuecallerabandon']=![];queues[_0x242103[_0xc8b3('0xc')]][_0xc8b3('0x18')]=![];queues[_0x242103[_0xc8b3('0xc')]][_0xc8b3('0x27')]=null;queues[_0x242103[_0xc8b3('0xc')]][_0xc8b3('0x19')]=![];queues[_0x242103[_0xc8b3('0xc')]]['queuecallerexitreason']=null;queues[_0x242103['uniqueid']][_0xc8b3('0x28')]=null;queues[_0x242103[_0xc8b3('0xc')]][_0xc8b3('0x3a')]=!![];queues[_0x242103['uniqueid']][_0xc8b3('0x5')]=_0x242103[_0xc8b3('0x3b')];queues[_0x242103[_0xc8b3('0xc')]][_0xc8b3('0x4')]=_0x242103['membername'];}}catch(_0x25aa80){utils[_0xc8b3('0x12')](util[_0xc8b3('0xd')]('[%s][queues][agentconnect]',_0x242103[_0xc8b3('0xc')]),_0x25aa80);}};exports[_0xc8b3('0x3c')]=function(_0x2abffd){try{if(!_[_0xc8b3('0x21')](queues[_0x2abffd['uniqueid']])){if(queues[_0x2abffd[_0xc8b3('0xc')]][_0xc8b3('0x17')]){utils[_0xc8b3('0x15')](util[_0xc8b3('0xd')](_0xc8b3('0x3d'),_0x2abffd[_0xc8b3('0xc')]),_0x2abffd);queues[_0x2abffd[_0xc8b3('0xc')]]['queuecallerabandon']=![];queues[_0x2abffd[_0xc8b3('0xc')]][_0xc8b3('0x18')]=![];queues[_0x2abffd[_0xc8b3('0xc')]][_0xc8b3('0x27')]=null;queues[_0x2abffd[_0xc8b3('0xc')]][_0xc8b3('0x19')]=![];queues[_0x2abffd['uniqueid']]['queuecallerexitAt']=null;queues[_0x2abffd['uniqueid']][_0xc8b3('0x3a')]=!![];queues[_0x2abffd[_0xc8b3('0xc')]][_0xc8b3('0x4')]=_0x2abffd['membername'];queues[_0x2abffd['uniqueid']]['queuecallercomplete']=!![];queues[_0x2abffd['uniqueid']]['queuecallercompleteAt']=utils[_0xc8b3('0x11')]();if(_0x2abffd['reason']==_0xc8b3('0x3e')){if(!queues[_0x2abffd['uniqueid']][_0xc8b3('0x3e')]){queues[_0x2abffd[_0xc8b3('0xc')]][_0xc8b3('0x6')]=_0xc8b3('0x3f');}}else{queues[_0x2abffd[_0xc8b3('0xc')]][_0xc8b3('0x6')]='COMPLETEDBY'+_0x2abffd[_0xc8b3('0x40')][_0xc8b3('0x25')]();}utils[_0xc8b3('0xe')](util[_0xc8b3('0xd')](_0xc8b3('0x41'),_0x2abffd[_0xc8b3('0xc')],queues[_0x2abffd['uniqueid']][_0xc8b3('0x2a')],_0x2abffd[_0xc8b3('0x39')],queues[_0x2abffd[_0xc8b3('0xc')]][_0xc8b3('0x6')]));writeDB(queues[_0x2abffd['uniqueid']]);}}}catch(_0x304a65){utils['error'](util[_0xc8b3('0xd')]('[%s][queues][agentcomplete]',_0x2abffd[_0xc8b3('0xc')]),_0x304a65);}};exports[_0xc8b3('0x42')]=function(_0x2a4474){try{if(!_['isNil'](queues[_0x2a4474['transfereeuniqueid']])){utils[_0xc8b3('0x15')](util[_0xc8b3('0xd')](_0xc8b3('0x43'),_0x2a4474['uniqueid']),_0x2a4474);queues[_0x2a4474[_0xc8b3('0x44')]]['transfer']=!![];queues[_0x2a4474[_0xc8b3('0x44')]][_0xc8b3('0x45')]=_0xc8b3('0x46');queues[_0x2a4474[_0xc8b3('0x44')]][_0xc8b3('0x47')]=_0x2a4474['extension'];queues[_0x2a4474['transfereeuniqueid']][_0xc8b3('0x48')]=_0x2a4474['transfereeuniqueid'];queues[_0x2a4474[_0xc8b3('0x44')]][_0xc8b3('0x6')]=_0xc8b3('0x49');utils[_0xc8b3('0xe')](util[_0xc8b3('0xd')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x2a4474[_0xc8b3('0xc')],queues[_0x2a4474[_0xc8b3('0x44')]][_0xc8b3('0x2a')],_0x2a4474[_0xc8b3('0x44')],_0x2a4474[_0xc8b3('0x4a')]));}}catch(_0x29e266){utils[_0xc8b3('0x12')](util[_0xc8b3('0xd')](_0xc8b3('0x43'),_0x2a4474[_0xc8b3('0xc')]),_0x29e266);}};exports['attendedtransfer']=function(_0x531e3f){try{utils[_0xc8b3('0x15')](util[_0xc8b3('0xd')]('[%s][queues][attendedtransfer]',_0x531e3f[_0xc8b3('0x4b')]),_0x531e3f);if(_0x531e3f[_0xc8b3('0x4b')]==_0x531e3f[_0xc8b3('0x4c')]){if(!_[_0xc8b3('0x21')](queues[_0x531e3f[_0xc8b3('0x4d')]])){utils[_0xc8b3('0xe')](util[_0xc8b3('0xd')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x531e3f[_0xc8b3('0x4b')],queues[_0x531e3f[_0xc8b3('0x4d')]][_0xc8b3('0x2a')],_0x531e3f['origtransfererexten']));queues[_0x531e3f[_0xc8b3('0x4d')]][_0xc8b3('0x3e')]=!![];queues[_0x531e3f[_0xc8b3('0x4d')]]['transfertype']='ATTENDED';queues[_0x531e3f[_0xc8b3('0x4d')]][_0xc8b3('0x47')]=_0x531e3f['origtransfererexten'];queues[_0x531e3f[_0xc8b3('0x4d')]][_0xc8b3('0x48')]=_0x531e3f[_0xc8b3('0x4b')];queues[_0x531e3f[_0xc8b3('0x4d')]]['queuecallerexitreason']=_0xc8b3('0x4e');}if(!_['isNil'](queues[_0x531e3f[_0xc8b3('0x4c')]])){if(_0x531e3f[_0xc8b3('0x4f')]&&queues[_0x531e3f[_0xc8b3('0x4f')]]){queues[_0x531e3f['transfereelinkedid']][_0xc8b3('0x50')]=0x1;queues[_0x531e3f[_0xc8b3('0x44')]]=_[_0xc8b3('0x51')](queues[_0x531e3f[_0xc8b3('0x4f')]]);queues[_0x531e3f[_0xc8b3('0x44')]]['transfereduniqueid']=_0x531e3f[_0xc8b3('0x52')];queues[_0x531e3f[_0xc8b3('0x44')]][_0xc8b3('0x50')]=0x2;queues[_0x531e3f[_0xc8b3('0x44')]][_0xc8b3('0x53')]=queues[_0x531e3f[_0xc8b3('0x4d')]][_0xc8b3('0x53')];queues[_0x531e3f[_0xc8b3('0x44')]][_0xc8b3('0x54')]=queues[_0x531e3f[_0xc8b3('0x4d')]][_0xc8b3('0x54')];queues[_0x531e3f[_0xc8b3('0x44')]]['queuecallerjoinAt']=utils[_0xc8b3('0x11')]();queues[_0x531e3f[_0xc8b3('0x44')]][_0xc8b3('0x17')]=utils[_0xc8b3('0x11')]();queues[_0x531e3f[_0xc8b3('0x44')]][_0xc8b3('0x34')]=0x0;queues[_0x531e3f[_0xc8b3('0x44')]][_0xc8b3('0x55')]=0x0;utils[_0xc8b3('0xe')](util[_0xc8b3('0xd')](_0xc8b3('0x56'),_0x531e3f[_0xc8b3('0x4b')],queues[_0x531e3f[_0xc8b3('0x44')]][_0xc8b3('0x2a')],queues[_0x531e3f[_0xc8b3('0x44')]][_0xc8b3('0x53')],queues[_0x531e3f[_0xc8b3('0x44')]][_0xc8b3('0x54')]));}else{utils['info'](util[_0xc8b3('0xd')](_0xc8b3('0x57'),_0x531e3f[_0xc8b3('0x4b')],queues[_0x531e3f['origtransfererlinkedid']][_0xc8b3('0x2a')],_0x531e3f[_0xc8b3('0x4d')]));queues[_0x531e3f['origtransfererlinkedid']][_0xc8b3('0xb')]=_0x531e3f['secondtransfererlinkedid'];}}}else if(_0x531e3f['secondtransfereruniqueid']==_0x531e3f[_0xc8b3('0x4d')]){if(!_[_0xc8b3('0x21')](queues[_0x531e3f[_0xc8b3('0x4c')]])){utils[_0xc8b3('0xe')](util[_0xc8b3('0xd')](_0xc8b3('0x58'),_0x531e3f[_0xc8b3('0x4b')],queues[_0x531e3f[_0xc8b3('0x4c')]][_0xc8b3('0x2a')],_0x531e3f[_0xc8b3('0x59')],_0x531e3f[_0xc8b3('0x5a')]));queues[_0x531e3f[_0xc8b3('0x4c')]][_0xc8b3('0x3e')]=!![];queues[_0x531e3f['origtransfererlinkedid']]['transfertype']=_0xc8b3('0x5b');queues[_0x531e3f['origtransfererlinkedid']][_0xc8b3('0x47')]=_0x531e3f[_0xc8b3('0x5a')];queues[_0x531e3f['origtransfererlinkedid']][_0xc8b3('0x48')]=_0x531e3f[_0xc8b3('0x59')];queues[_0x531e3f[_0xc8b3('0x4c')]][_0xc8b3('0x6')]='ATTENDEDTRANSFER';}if(!_[_0xc8b3('0x21')](queues[_0x531e3f[_0xc8b3('0x4d')]])){if(_0x531e3f[_0xc8b3('0x5c')]&&queues[_0x531e3f['transfertargetlinkedid']]){queues[_0x531e3f[_0xc8b3('0x5c')]][_0xc8b3('0x50')]=0x1;queues[_0x531e3f[_0xc8b3('0x52')]]=_[_0xc8b3('0x51')](queues[_0x531e3f[_0xc8b3('0x5c')]]);queues[_0x531e3f[_0xc8b3('0x52')]][_0xc8b3('0xb')]=_0x531e3f[_0xc8b3('0x52')];queues[_0x531e3f[_0xc8b3('0x52')]]['queuecallerenterreason']=0x2;queues[_0x531e3f[_0xc8b3('0x52')]]['calleridnum']=queues[_0x531e3f[_0xc8b3('0x4c')]][_0xc8b3('0x53')];queues[_0x531e3f[_0xc8b3('0x52')]]['calleridname']=queues[_0x531e3f[_0xc8b3('0x4c')]][_0xc8b3('0x54')];queues[_0x531e3f['transfertargetuniqueid']][_0xc8b3('0x5d')]=utils[_0xc8b3('0x11')]();queues[_0x531e3f[_0xc8b3('0x52')]][_0xc8b3('0x17')]=utils[_0xc8b3('0x11')]();queues[_0x531e3f[_0xc8b3('0x52')]][_0xc8b3('0x34')]=0x0;queues[_0x531e3f[_0xc8b3('0x52')]]['mohtime']=0x0;utils[_0xc8b3('0xe')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x531e3f[_0xc8b3('0x4b')],queues[_0x531e3f[_0xc8b3('0x52')]]['name'],queues[_0x531e3f['transfertargetuniqueid']][_0xc8b3('0xb')],queues[_0x531e3f['transfertargetuniqueid']]['calleridnum'],queues[_0x531e3f[_0xc8b3('0x52')]]['calleridname']));}else{utils[_0xc8b3('0xe')](util[_0xc8b3('0xd')](_0xc8b3('0x57'),_0x531e3f[_0xc8b3('0x4b')],queues[_0x531e3f['secondtransfererlinkedid']][_0xc8b3('0x2a')],_0x531e3f[_0xc8b3('0x4c')]));queues[_0x531e3f['secondtransfererlinkedid']]['transfereduniqueid']=_0x531e3f[_0xc8b3('0x4c')];}}}}catch(_0x49abc0){utils[_0xc8b3('0x12')](util[_0xc8b3('0xd')](_0xc8b3('0x5e'),_0x531e3f[_0xc8b3('0x4b')]),_0x49abc0);}};exports[_0xc8b3('0x5f')]=function(_0x5a39c0){try{if(!_[_0xc8b3('0x21')](queues[_0x5a39c0['uniqueid']])){utils[_0xc8b3('0x15')](util[_0xc8b3('0xd')](_0xc8b3('0x60'),_0x5a39c0[_0xc8b3('0xc')]),_0x5a39c0);queues[_0x5a39c0[_0xc8b3('0xc')]][_0xc8b3('0x61')]=utils[_0xc8b3('0x11')]();utils[_0xc8b3('0xe')](util[_0xc8b3('0xd')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x5a39c0[_0xc8b3('0xc')],queues[_0x5a39c0[_0xc8b3('0xc')]][_0xc8b3('0x2a')],queues[_0x5a39c0[_0xc8b3('0xc')]][_0xc8b3('0x61')]));}}catch(_0x28dc94){utils['error'](util[_0xc8b3('0xd')](_0xc8b3('0x60'),_0x5a39c0[_0xc8b3('0xc')]),_0x28dc94);}};exports[_0xc8b3('0x62')]=function(_0xdc62e4){try{if(!_[_0xc8b3('0x21')](queues[_0xdc62e4[_0xc8b3('0xc')]])){if(!_['isNil'](queues[_0xdc62e4['uniqueid']]['musiconholdstartAt'])){utils[_0xc8b3('0x15')](util[_0xc8b3('0xd')](_0xc8b3('0x63'),_0xdc62e4[_0xc8b3('0xc')]),_0xdc62e4);queues[_0xdc62e4['uniqueid']]['mohtime']+=utils[_0xc8b3('0x35')](utils[_0xc8b3('0x11')](),queues[_0xdc62e4['uniqueid']]['musiconholdstartAt']);utils[_0xc8b3('0xe')](util[_0xc8b3('0xd')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0xdc62e4[_0xc8b3('0xc')],queues[_0xdc62e4[_0xc8b3('0xc')]]['name'],queues[_0xdc62e4[_0xc8b3('0xc')]][_0xc8b3('0x55')]));delete queues[_0xdc62e4[_0xc8b3('0xc')]][_0xc8b3('0x61')];}}}catch(_0xdf2eef){utils[_0xc8b3('0x12')](util[_0xc8b3('0xd')](_0xc8b3('0x63'),_0xdc62e4['uniqueid']),_0xdf2eef);}}; \ No newline at end of file +var _0x78be=['[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','mohtime','[%s][queues][musiconholdstop]','lodash','util','./utils','info','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','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','count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x78be,0x7f));var _0xe78b=function(_0x46a90d,_0x39c201){_0x46a90d=_0x46a90d-0x0;var _0x186773=_0x78be[_0x46a90d];return _0x186773;};'use strict';var _=require(_0xe78b('0x0'));var util=require(_0xe78b('0x1'));var utils=require(_0xe78b('0x2'));var queues={};function writeDB(_0x2be91f){utils[_0xe78b('0x3')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x2be91f[_0xe78b('0x4')],_0x2be91f[_0xe78b('0x5')],_0x2be91f['queue'],_0x2be91f[_0xe78b('0x6')],_0x2be91f[_0xe78b('0x7')],_0x2be91f[_0xe78b('0x8')],_0x2be91f[_0xe78b('0x9')]));if(_0x2be91f[_0xe78b('0xa')]){utils['getVoiceQueueByName'](_0x2be91f[_0xe78b('0xa')])[_0xe78b('0xb')](function(_0x9f0480){if(_0x9f0480){_0x2be91f[_0xe78b('0xc')]=_0x9f0480[_0xe78b('0xc')];}utils[_0xe78b('0xd')]('CreateVoiceQueueReport',_0x2be91f);});}else{utils[_0xe78b('0xd')](_0xe78b('0xe'),_0x2be91f);}if(_0x2be91f['transfereduniqueid']){delete queues[_0x2be91f[_0xe78b('0xf')]];}else{delete queues[_0x2be91f[_0xe78b('0x4')]];}}exports[_0xe78b('0x10')]=function(_0x433a40){try{utils[_0xe78b('0x11')](util[_0xe78b('0x12')](_0xe78b('0x13'),_0x433a40['uniqueid']),_0x433a40);utils[_0xe78b('0x3')](util[_0xe78b('0x12')](_0xe78b('0x14'),_0x433a40['uniqueid'],_0x433a40[_0xe78b('0xa')],_0x433a40[_0xe78b('0x15')]));queues[_0x433a40['uniqueid']]=_[_0xe78b('0x16')](_0x433a40,{'originalposition':_0x433a40[_0xe78b('0x15')],'queuecallerjoinAt':utils[_0xe78b('0x17')](),'mohtime':0x0});}catch(_0x165c19){utils[_0xe78b('0x18')](util[_0xe78b('0x12')](_0xe78b('0x13'),_0x433a40['uniqueid']),_0x165c19);}};exports[_0xe78b('0x19')]=function(_0x2758e4){try{if(!_[_0xe78b('0x1a')](queues[_0x2758e4[_0xe78b('0x4')]])){utils[_0xe78b('0x11')](util[_0xe78b('0x12')](_0xe78b('0x1b'),_0x2758e4[_0xe78b('0x4')]),_0x2758e4);if(queues[_0x2758e4[_0xe78b('0x4')]][_0xe78b('0x1c')]){if(!queues[_0x2758e4[_0xe78b('0x4')]][_0xe78b('0x1d')]&&!queues[_0x2758e4[_0xe78b('0x4')]][_0xe78b('0x1e')]){queues[_0x2758e4[_0xe78b('0x4')]][_0xe78b('0x1f')]=!![];queues[_0x2758e4['uniqueid']]['queuecallercompleteAt']=utils[_0xe78b('0x17')]();queues[_0x2758e4[_0xe78b('0x4')]][_0xe78b('0x9')]=_0xe78b('0x20');}utils[_0xe78b('0x3')](util['format'](_0xe78b('0x21'),_0x2758e4[_0xe78b('0x4')],queues[_0x2758e4[_0xe78b('0x4')]]['name'],queues[_0x2758e4[_0xe78b('0x4')]][_0xe78b('0x9')]));writeDB(queues[_0x2758e4[_0xe78b('0x4')]]);}else if(queues[_0x2758e4[_0xe78b('0x4')]][_0xe78b('0xf')]){utils[_0xe78b('0x3')](util[_0xe78b('0x12')](_0xe78b('0x22'),_0x2758e4['uniqueid'],queues[_0x2758e4['uniqueid']][_0xe78b('0x23')],queues[_0x2758e4['uniqueid']]['transfereduniqueid']));queues[queues[_0x2758e4[_0xe78b('0x4')]][_0xe78b('0xf')]]=queues[_0x2758e4[_0xe78b('0x4')]];queues[queues[_0x2758e4['uniqueid']]['transfereduniqueid']][_0xe78b('0x24')]=0x2;delete queues[_0x2758e4[_0xe78b('0x4')]];}}}catch(_0x5df354){utils[_0xe78b('0x18')](util['format'](_0xe78b('0x1b'),_0x2758e4[_0xe78b('0x4')]),_0x5df354);}};exports[_0xe78b('0x25')]=function(_0x5c87cf){try{utils[_0xe78b('0x11')](util['format'](_0xe78b('0x26'),_0x5c87cf[_0xe78b('0x4')]),_0x5c87cf);if(!_[_0xe78b('0x1a')](_0x5c87cf[_0xe78b('0x27')][_0xe78b('0x28')])&&_0x5c87cf[_0xe78b('0x29')][_0xe78b('0x2a')]()!==_0xe78b('0x2b')){if(!_[_0xe78b('0x1a')](queues[_0x5c87cf[_0xe78b('0x4')]])){queues[_0x5c87cf[_0xe78b('0x4')]]['queuecallerabandon']=![];queues[_0x5c87cf['uniqueid']][_0xe78b('0x2c')]=null;queues[_0x5c87cf['uniqueid']][_0xe78b('0x1e')]=!![];queues[_0x5c87cf['uniqueid']][_0xe78b('0x2d')]=utils[_0xe78b('0x17')]();queues[_0x5c87cf['uniqueid']]['queuecallerexitreason']=_0x5c87cf[_0xe78b('0x29')][_0xe78b('0x2a')]();utils['info'](util[_0xe78b('0x12')](_0xe78b('0x2e'),_0x5c87cf[_0xe78b('0x4')],queues[_0x5c87cf[_0xe78b('0x4')]][_0xe78b('0x23')],_0x5c87cf['value'],queues[_0x5c87cf[_0xe78b('0x4')]][_0xe78b('0x9')]));writeDB(queues[_0x5c87cf[_0xe78b('0x4')]]);}}else if(!_[_0xe78b('0x1a')](_0x5c87cf['variable'][_0xe78b('0x2f')])){if(!_[_0xe78b('0x1a')](queues[_0x5c87cf[_0xe78b('0x4')]])&&!queues[_0x5c87cf[_0xe78b('0x4')]]['queuecallerabandon']){queues[_0x5c87cf[_0xe78b('0x4')]]['queuecallerabandon']=![];queues[_0x5c87cf[_0xe78b('0x4')]][_0xe78b('0x2c')]=null;queues[_0x5c87cf[_0xe78b('0x4')]][_0xe78b('0x1e')]=!![];queues[_0x5c87cf[_0xe78b('0x4')]][_0xe78b('0x2d')]=utils[_0xe78b('0x17')]();queues[_0x5c87cf['uniqueid']]['queuecallerexitreason']=_0xe78b('0x30');utils[_0xe78b('0x3')](util[_0xe78b('0x12')](_0xe78b('0x31'),_0x5c87cf[_0xe78b('0x4')],queues[_0x5c87cf[_0xe78b('0x4')]][_0xe78b('0x23')],_0x5c87cf['value'],queues[_0x5c87cf[_0xe78b('0x4')]][_0xe78b('0x9')]));}}}catch(_0x4ceb8a){utils[_0xe78b('0x18')](util['format'](_0xe78b('0x26'),_0x5c87cf[_0xe78b('0x4')]),_0x4ceb8a);}};exports[_0xe78b('0x1d')]=function(_0x357219){try{if(!_['isNil'](queues[_0x357219[_0xe78b('0x4')]])){utils[_0xe78b('0x11')](util['format']('[%s][queues][queuecallerabandon]',_0x357219[_0xe78b('0x4')]),_0x357219);queues[_0x357219[_0xe78b('0x4')]][_0xe78b('0x1e')]=![];queues[_0x357219[_0xe78b('0x4')]]['queuecallerexitAt']=null;queues[_0x357219[_0xe78b('0x4')]]['queuecallerabandon']=!![];queues[_0x357219[_0xe78b('0x4')]][_0xe78b('0x2c')]=utils[_0xe78b('0x17')]();queues[_0x357219[_0xe78b('0x4')]][_0xe78b('0x9')]=_0xe78b('0x32');utils['info'](util[_0xe78b('0x12')](_0xe78b('0x33'),_0x357219[_0xe78b('0x4')],queues[_0x357219[_0xe78b('0x4')]][_0xe78b('0x23')],queues[_0x357219[_0xe78b('0x4')]][_0xe78b('0x9')]));}}catch(_0x2a10d6){utils[_0xe78b('0x18')](util['format']('[%s][queues][queuecallerabandon]',_0x357219[_0xe78b('0x4')]),_0x2a10d6);}};exports[_0xe78b('0x34')]=function(_0x1372eb){try{if(!_[_0xe78b('0x1a')](queues[_0x1372eb[_0xe78b('0x4')]])){utils[_0xe78b('0x11')](util[_0xe78b('0x12')](_0xe78b('0x35'),_0x1372eb['uniqueid']),_0x1372eb);utils[_0xe78b('0x3')](util[_0xe78b('0x12')](_0xe78b('0x36'),_0x1372eb['uniqueid'],queues[_0x1372eb['uniqueid']][_0xe78b('0x23')],_0x1372eb[_0xe78b('0x37')],_0x1372eb[_0xe78b('0x38')]));queues[_0x1372eb['uniqueid']]['queuecallerleave']=!![];queues[_0x1372eb[_0xe78b('0x4')]]['queuecallerleaveAt']=utils[_0xe78b('0x17')]();queues[_0x1372eb['uniqueid']][_0xe78b('0x39')]=utils[_0xe78b('0x3a')](queues[_0x1372eb[_0xe78b('0x4')]][_0xe78b('0x1c')],queues[_0x1372eb[_0xe78b('0x4')]][_0xe78b('0x3b')]);queues[_0x1372eb[_0xe78b('0x4')]]['position']=_0x1372eb[_0xe78b('0x15')];queues[_0x1372eb[_0xe78b('0x4')]]['count']=_0x1372eb[_0xe78b('0x3c')];queues[_0x1372eb[_0xe78b('0x4')]]['connectedlinenum']=_0x1372eb['connectedlinenum'];queues[_0x1372eb['uniqueid']]['connectedlinename']=_0x1372eb['connectedlinename'];}}catch(_0x1283b0){utils[_0xe78b('0x18')](util['format']('[%s][queues][queuecallerleave]',_0x1372eb[_0xe78b('0x4')]),_0x1283b0);}};exports[_0xe78b('0x3d')]=function(_0x2809ce){try{if(!_[_0xe78b('0x1a')](queues[_0x2809ce[_0xe78b('0x4')]])){utils[_0xe78b('0x11')](util['format']('[%s][queues][agentconnect]',_0x2809ce[_0xe78b('0x4')]),_0x2809ce);utils[_0xe78b('0x3')](util['format'](_0xe78b('0x3e'),_0x2809ce[_0xe78b('0x4')],queues[_0x2809ce[_0xe78b('0x4')]][_0xe78b('0x23')],_0x2809ce['membername'],_0x2809ce[_0xe78b('0x3f')]));queues[_0x2809ce[_0xe78b('0x4')]][_0xe78b('0x1d')]=![];queues[_0x2809ce[_0xe78b('0x4')]][_0xe78b('0x1d')]=![];queues[_0x2809ce[_0xe78b('0x4')]][_0xe78b('0x2c')]=null;queues[_0x2809ce[_0xe78b('0x4')]][_0xe78b('0x1e')]=![];queues[_0x2809ce['uniqueid']][_0xe78b('0x9')]=null;queues[_0x2809ce['uniqueid']][_0xe78b('0x2d')]=null;queues[_0x2809ce[_0xe78b('0x4')]][_0xe78b('0x40')]=!![];queues[_0x2809ce[_0xe78b('0x4')]]['accountcode']=_0x2809ce[_0xe78b('0x3f')];queues[_0x2809ce[_0xe78b('0x4')]]['lastAssignedTo']=_0x2809ce[_0xe78b('0x41')];}}catch(_0x28cc7f){utils[_0xe78b('0x18')](util[_0xe78b('0x12')]('[%s][queues][agentconnect]',_0x2809ce[_0xe78b('0x4')]),_0x28cc7f);}};exports['agentcomplete']=function(_0x5e63bc){try{if(!_[_0xe78b('0x1a')](queues[_0x5e63bc['uniqueid']])){if(queues[_0x5e63bc[_0xe78b('0x4')]]['queuecallerleaveAt']){utils['debug'](util[_0xe78b('0x12')](_0xe78b('0x42'),_0x5e63bc[_0xe78b('0x4')]),_0x5e63bc);queues[_0x5e63bc[_0xe78b('0x4')]][_0xe78b('0x1d')]=![];queues[_0x5e63bc[_0xe78b('0x4')]][_0xe78b('0x1d')]=![];queues[_0x5e63bc[_0xe78b('0x4')]]['queuecallerabandonAt']=null;queues[_0x5e63bc['uniqueid']][_0xe78b('0x1e')]=![];queues[_0x5e63bc[_0xe78b('0x4')]][_0xe78b('0x2d')]=null;queues[_0x5e63bc[_0xe78b('0x4')]]['assigned']=!![];queues[_0x5e63bc[_0xe78b('0x4')]][_0xe78b('0x6')]=_0x5e63bc[_0xe78b('0x41')];queues[_0x5e63bc[_0xe78b('0x4')]]['queuecallercomplete']=!![];queues[_0x5e63bc['uniqueid']][_0xe78b('0x43')]=utils[_0xe78b('0x17')]();if(_0x5e63bc[_0xe78b('0x44')]==_0xe78b('0x45')){if(!queues[_0x5e63bc['uniqueid']][_0xe78b('0x45')]){queues[_0x5e63bc['uniqueid']][_0xe78b('0x9')]=_0xe78b('0x46');}}else{queues[_0x5e63bc[_0xe78b('0x4')]][_0xe78b('0x9')]=_0xe78b('0x47')+_0x5e63bc[_0xe78b('0x44')][_0xe78b('0x2a')]();}utils[_0xe78b('0x3')](util['format'](_0xe78b('0x48'),_0x5e63bc[_0xe78b('0x4')],queues[_0x5e63bc[_0xe78b('0x4')]]['name'],_0x5e63bc[_0xe78b('0x41')],queues[_0x5e63bc[_0xe78b('0x4')]][_0xe78b('0x9')]));writeDB(queues[_0x5e63bc[_0xe78b('0x4')]]);}}}catch(_0x2f17d0){utils[_0xe78b('0x18')](util[_0xe78b('0x12')]('[%s][queues][agentcomplete]',_0x5e63bc[_0xe78b('0x4')]),_0x2f17d0);}};exports[_0xe78b('0x49')]=function(_0x2bf748){try{if(!_[_0xe78b('0x1a')](queues[_0x2bf748[_0xe78b('0x4a')]])){utils['debug'](util['format']('[%s][queues][blindtransfer]',_0x2bf748[_0xe78b('0x4')]),_0x2bf748);queues[_0x2bf748['transfereeuniqueid']][_0xe78b('0x45')]=!![];queues[_0x2bf748['transfereeuniqueid']]['transfertype']='BLIND';queues[_0x2bf748[_0xe78b('0x4a')]]['transferexten']=_0x2bf748[_0xe78b('0x4b')];queues[_0x2bf748['transfereeuniqueid']]['transferuniqueid']=_0x2bf748[_0xe78b('0x4a')];queues[_0x2bf748[_0xe78b('0x4a')]][_0xe78b('0x9')]='BLINDTRANSFER';utils[_0xe78b('0x3')](util[_0xe78b('0x12')](_0xe78b('0x4c'),_0x2bf748['uniqueid'],queues[_0x2bf748[_0xe78b('0x4a')]][_0xe78b('0x23')],_0x2bf748['transfereeuniqueid'],_0x2bf748['extension']));}}catch(_0x4b5df0){utils[_0xe78b('0x18')](util[_0xe78b('0x12')](_0xe78b('0x4d'),_0x2bf748[_0xe78b('0x4')]),_0x4b5df0);}};exports[_0xe78b('0x4e')]=function(_0x570ef2){try{utils[_0xe78b('0x11')](util[_0xe78b('0x12')](_0xe78b('0x4f'),_0x570ef2[_0xe78b('0x50')]),_0x570ef2);if(_0x570ef2['origtransfereruniqueid']==_0x570ef2[_0xe78b('0x51')]){if(!_[_0xe78b('0x1a')](queues[_0x570ef2[_0xe78b('0x52')]])){utils[_0xe78b('0x3')](util['format'](_0xe78b('0x53'),_0x570ef2[_0xe78b('0x50')],queues[_0x570ef2[_0xe78b('0x52')]][_0xe78b('0x23')],_0x570ef2[_0xe78b('0x54')]));queues[_0x570ef2['secondtransfererlinkedid']][_0xe78b('0x45')]=!![];queues[_0x570ef2[_0xe78b('0x52')]][_0xe78b('0x55')]='ATTENDED';queues[_0x570ef2[_0xe78b('0x52')]]['transferexten']=_0x570ef2[_0xe78b('0x54')];queues[_0x570ef2[_0xe78b('0x52')]][_0xe78b('0x56')]=_0x570ef2[_0xe78b('0x50')];queues[_0x570ef2[_0xe78b('0x52')]][_0xe78b('0x9')]=_0xe78b('0x57');}if(!_[_0xe78b('0x1a')](queues[_0x570ef2[_0xe78b('0x51')]])){if(_0x570ef2[_0xe78b('0x58')]&&queues[_0x570ef2[_0xe78b('0x58')]]){queues[_0x570ef2[_0xe78b('0x58')]][_0xe78b('0x24')]=0x1;queues[_0x570ef2['transfereeuniqueid']]=_['clone'](queues[_0x570ef2[_0xe78b('0x58')]]);queues[_0x570ef2[_0xe78b('0x4a')]]['transfereduniqueid']=_0x570ef2[_0xe78b('0x59')];queues[_0x570ef2[_0xe78b('0x4a')]][_0xe78b('0x24')]=0x2;queues[_0x570ef2[_0xe78b('0x4a')]]['calleridnum']=queues[_0x570ef2['secondtransfererlinkedid']]['calleridnum'];queues[_0x570ef2[_0xe78b('0x4a')]][_0xe78b('0x5a')]=queues[_0x570ef2[_0xe78b('0x52')]]['calleridname'];queues[_0x570ef2[_0xe78b('0x4a')]][_0xe78b('0x3b')]=utils[_0xe78b('0x17')]();queues[_0x570ef2[_0xe78b('0x4a')]][_0xe78b('0x1c')]=utils[_0xe78b('0x17')]();queues[_0x570ef2[_0xe78b('0x4a')]][_0xe78b('0x39')]=0x0;queues[_0x570ef2[_0xe78b('0x4a')]]['mohtime']=0x0;utils[_0xe78b('0x3')](util[_0xe78b('0x12')](_0xe78b('0x5b'),_0x570ef2[_0xe78b('0x50')],queues[_0x570ef2[_0xe78b('0x4a')]]['name'],queues[_0x570ef2[_0xe78b('0x4a')]][_0xe78b('0x7')],queues[_0x570ef2['transfereeuniqueid']][_0xe78b('0x5a')]));}else{utils[_0xe78b('0x3')](util['format'](_0xe78b('0x5c'),_0x570ef2[_0xe78b('0x50')],queues[_0x570ef2[_0xe78b('0x51')]]['name'],_0x570ef2[_0xe78b('0x52')]));queues[_0x570ef2[_0xe78b('0x51')]]['transfereduniqueid']=_0x570ef2[_0xe78b('0x52')];}}}else if(_0x570ef2[_0xe78b('0x5d')]==_0x570ef2['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x570ef2[_0xe78b('0x51')]])){utils[_0xe78b('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x570ef2[_0xe78b('0x50')],queues[_0x570ef2[_0xe78b('0x51')]][_0xe78b('0x23')],_0x570ef2[_0xe78b('0x5d')],_0x570ef2[_0xe78b('0x5e')]));queues[_0x570ef2[_0xe78b('0x51')]]['transfer']=!![];queues[_0x570ef2[_0xe78b('0x51')]]['transfertype']='ATTENDED';queues[_0x570ef2[_0xe78b('0x51')]]['transferexten']=_0x570ef2[_0xe78b('0x5e')];queues[_0x570ef2[_0xe78b('0x51')]]['transferuniqueid']=_0x570ef2[_0xe78b('0x5d')];queues[_0x570ef2[_0xe78b('0x51')]][_0xe78b('0x9')]=_0xe78b('0x57');}if(!_[_0xe78b('0x1a')](queues[_0x570ef2['secondtransfererlinkedid']])){if(_0x570ef2[_0xe78b('0x5f')]&&queues[_0x570ef2[_0xe78b('0x5f')]]){queues[_0x570ef2['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x570ef2[_0xe78b('0x59')]]=_[_0xe78b('0x60')](queues[_0x570ef2[_0xe78b('0x5f')]]);queues[_0x570ef2[_0xe78b('0x59')]][_0xe78b('0xf')]=_0x570ef2['transfertargetuniqueid'];queues[_0x570ef2[_0xe78b('0x59')]][_0xe78b('0x24')]=0x2;queues[_0x570ef2[_0xe78b('0x59')]][_0xe78b('0x7')]=queues[_0x570ef2['origtransfererlinkedid']][_0xe78b('0x7')];queues[_0x570ef2[_0xe78b('0x59')]]['calleridname']=queues[_0x570ef2[_0xe78b('0x51')]]['calleridname'];queues[_0x570ef2[_0xe78b('0x59')]][_0xe78b('0x3b')]=utils['now']();queues[_0x570ef2[_0xe78b('0x59')]][_0xe78b('0x1c')]=utils['now']();queues[_0x570ef2['transfertargetuniqueid']][_0xe78b('0x39')]=0x0;queues[_0x570ef2[_0xe78b('0x59')]]['mohtime']=0x0;utils['info'](util[_0xe78b('0x12')](_0xe78b('0x61'),_0x570ef2[_0xe78b('0x50')],queues[_0x570ef2[_0xe78b('0x59')]][_0xe78b('0x23')],queues[_0x570ef2[_0xe78b('0x59')]][_0xe78b('0xf')],queues[_0x570ef2[_0xe78b('0x59')]][_0xe78b('0x7')],queues[_0x570ef2[_0xe78b('0x59')]][_0xe78b('0x5a')]));}else{utils['info'](util[_0xe78b('0x12')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x570ef2[_0xe78b('0x50')],queues[_0x570ef2['secondtransfererlinkedid']][_0xe78b('0x23')],_0x570ef2['origtransfererlinkedid']));queues[_0x570ef2[_0xe78b('0x52')]]['transfereduniqueid']=_0x570ef2[_0xe78b('0x51')];}}}}catch(_0x4737dd){utils[_0xe78b('0x18')](util[_0xe78b('0x12')](_0xe78b('0x4f'),_0x570ef2[_0xe78b('0x50')]),_0x4737dd);}};exports['musiconholdstart']=function(_0x2783ed){try{if(!_[_0xe78b('0x1a')](queues[_0x2783ed[_0xe78b('0x4')]])){utils[_0xe78b('0x11')](util[_0xe78b('0x12')](_0xe78b('0x62'),_0x2783ed[_0xe78b('0x4')]),_0x2783ed);queues[_0x2783ed[_0xe78b('0x4')]][_0xe78b('0x63')]=utils[_0xe78b('0x17')]();utils[_0xe78b('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x2783ed[_0xe78b('0x4')],queues[_0x2783ed[_0xe78b('0x4')]][_0xe78b('0x23')],queues[_0x2783ed[_0xe78b('0x4')]][_0xe78b('0x63')]));}}catch(_0xa86dbf){utils[_0xe78b('0x18')](util['format'](_0xe78b('0x62'),_0x2783ed[_0xe78b('0x4')]),_0xa86dbf);}};exports[_0xe78b('0x64')]=function(_0xb9c304){try{if(!_[_0xe78b('0x1a')](queues[_0xb9c304[_0xe78b('0x4')]])){if(!_[_0xe78b('0x1a')](queues[_0xb9c304[_0xe78b('0x4')]][_0xe78b('0x63')])){utils[_0xe78b('0x11')](util[_0xe78b('0x12')]('[%s][queues][musiconholdstop]',_0xb9c304[_0xe78b('0x4')]),_0xb9c304);queues[_0xb9c304[_0xe78b('0x4')]][_0xe78b('0x65')]+=utils[_0xe78b('0x3a')](utils[_0xe78b('0x17')](),queues[_0xb9c304[_0xe78b('0x4')]]['musiconholdstartAt']);utils[_0xe78b('0x3')](util[_0xe78b('0x12')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0xb9c304[_0xe78b('0x4')],queues[_0xb9c304['uniqueid']][_0xe78b('0x23')],queues[_0xb9c304[_0xe78b('0x4')]][_0xe78b('0x65')]));delete queues[_0xb9c304['uniqueid']][_0xe78b('0x63')];}}}catch(_0x5b16ed){utils['error'](util[_0xe78b('0x12')](_0xe78b('0x66'),_0xb9c304['uniqueid']),_0x5b16ed);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 4443bb2..fccd1e0 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 _0x1819=['[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','substring','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','./utils','./transfers.controller','info','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','debug','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','type','outbound','clone','newexten','[%s][recordings][newexten]'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1819,0x122));var _0x9181=function(_0x46451c,_0x88ddd){_0x46451c=_0x46451c-0x0;var _0x12dce4=_0x1819[_0x46451c];return _0x12dce4;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x9181('0x0'));var transfers=require(_0x9181('0x1'));var recordings={};function writeDB(_0x1d234c){var _0x4f840c;utils[_0x9181('0x2')](util['format']('[%s][recordings][writeDB]',_0x1d234c[_0x9181('0x3')]));if(transfers['blinds'][_0x1d234c[_0x9181('0x3')]]){_0x4f840c=_0x1d234c['uniqueid'];_0x1d234c[_0x9181('0x3')]=transfers[_0x9181('0x4')][_0x1d234c[_0x9181('0x3')]][_0x9181('0x5')];}if(_0x1d234c[_0x9181('0x6')]){utils[_0x9181('0x7')](_0x1d234c[_0x9181('0x6')])[_0x9181('0x8')](function(_0x307dfb){if(_0x307dfb){_0x1d234c[_0x9181('0x9')]=_0x307dfb[_0x9181('0xa')];_0x1d234c[_0x9181('0xb')]=_0x307dfb['id'];}utils[_0x9181('0xc')](_0x9181('0xd'),_0x1d234c);});}else{utils[_0x9181('0xc')]('CreateVoiceRecording',_0x1d234c);}if(_0x4f840c)delete transfers['blinds'][_0x4f840c];}exports['newchannel']=function(_0x218089){try{utils[_0x9181('0xe')](util[_0x9181('0xf')](_0x9181('0x10'),_0x218089[_0x9181('0x3')]),_0x218089);if(_0x218089['uniqueid']==_0x218089[_0x9181('0x11')]){utils[_0x9181('0x2')](util[_0x9181('0xf')](_0x9181('0x12'),_0x218089['uniqueid'],_0x218089[_0x9181('0x13')],_0x218089['exten']));recordings[_0x218089[_0x9181('0x3')]]={'uniqueid':_0x218089[_0x9181('0x3')],'accountcode':_0x218089[_0x9181('0x6')],'exten':_0x218089['exten'],'context':_0x218089[_0x9181('0x13')],'channel':_0x218089['channel'],'monitors':[]};}}catch(_0x392ea3){utils['error'](util[_0x9181('0xf')](_0x9181('0x10'),_0x218089[_0x9181('0x3')]),_0x392ea3);}};exports[_0x9181('0x14')]=function(_0x21ef72){try{utils[_0x9181('0xe')](util[_0x9181('0xf')](_0x9181('0x15'),_0x21ef72[_0x9181('0x3')]),_0x21ef72);if(!_[_0x9181('0x16')](recordings[_0x21ef72[_0x9181('0x3')]])&&_0x21ef72[_0x9181('0x17')]==0x6){utils[_0x9181('0x2')](util['format'](_0x9181('0x18'),_0x21ef72[_0x9181('0x3')],_0x21ef72[_0x9181('0x13')],_0x21ef72[_0x9181('0x19')]));}else if(!_[_0x9181('0x16')](recordings[_0x21ef72['linkedid']])&&_0x21ef72[_0x9181('0x17')]==0x6&&_0x21ef72['context']!='transfer'){utils[_0x9181('0x2')](util[_0x9181('0xf')](_0x9181('0x1a'),_0x21ef72[_0x9181('0x3')],_0x21ef72[_0x9181('0x11')],_0x21ef72['context'],_0x21ef72['channel']));recordings[_0x21ef72[_0x9181('0x11')]][_0x9181('0x6')]=_0x21ef72['accountcode'];}}catch(_0x576a0f){utils[_0x9181('0x1b')](util['format'](_0x9181('0x15'),_0x21ef72[_0x9181('0x3')]),_0x576a0f);}};exports['varset']=function(_0x476e65){try{if(!_[_0x9181('0x16')](_0x476e65['variable'])&&!_[_0x9181('0x16')](_0x476e65[_0x9181('0x1c')][_0x9181('0x1d')])){utils[_0x9181('0xe')](util[_0x9181('0xf')](_0x9181('0x1e'),_0x476e65[_0x9181('0x3')]),_0x476e65);utils[_0x9181('0x2')](util[_0x9181('0xf')](_0x9181('0x1f'),_0x476e65[_0x9181('0x3')],_0x476e65[_0x9181('0x1c')],_0x476e65[_0x9181('0x20')]));if(_[_0x9181('0x21')](_0x476e65[_0x9181('0x20')],_0x9181('0x22'))){_0x476e65[_0x9181('0x20')]=_0x476e65[_0x9181('0x20')][_0x9181('0x23')](_0x9181('0x22'),_0x9181('0x24'));}if(recordings[_0x476e65[_0x9181('0x11')]]){var _0x4906e6=_['find'](recordings[_0x476e65['linkedid']][_0x9181('0x25')],{'value':_0x476e65['value']});if(_[_0x9181('0x16')](_0x4906e6)){recordings[_0x476e65[_0x9181('0x11')]][_0x9181('0x25')][_0x9181('0x26')]({'value':_0x476e65[_0x9181('0x20')]});}}}}catch(_0x2727f4){utils[_0x9181('0x1b')](util['format'](_0x9181('0x1e'),_0x476e65['uniqueid']),_0x2727f4);}};exports[_0x9181('0x27')]=function(_0x20914c){try{if(!_[_0x9181('0x16')](recordings[_0x20914c[_0x9181('0x3')]])){utils[_0x9181('0xe')](util[_0x9181('0xf')](_0x9181('0x28'),_0x20914c[_0x9181('0x3')]),_0x20914c);utils[_0x9181('0x2')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x20914c[_0x9181('0x3')],_0x20914c['calleridnum'],_0x20914c[_0x9181('0x29')],_0x20914c[_0x9181('0x2a')]));recordings[_0x20914c[_0x9181('0x3')]]['calleridnum']=_0x20914c[_0x9181('0x2b')];recordings[_0x20914c['uniqueid']][_0x9181('0x29')]=_0x20914c[_0x9181('0x29')];recordings[_0x20914c[_0x9181('0x3')]][_0x9181('0x2c')]=_0x20914c['connectedlinenum'];recordings[_0x20914c['uniqueid']]['connectedlinename']=_0x20914c['connectedlinename'];if(recordings[_0x20914c['uniqueid']][_0x9181('0x2d')]==_0x9181('0x2e')&&recordings[_0x20914c[_0x9181('0x3')]][_0x9181('0x6')]){recordings[_0x20914c[_0x9181('0x3')]][_0x9181('0x2c')]=recordings[_0x20914c[_0x9181('0x3')]][_0x9181('0x6')];recordings[_0x20914c['uniqueid']]['connectedlinename']='';}recordings[_0x20914c[_0x9181('0x3')]][_0x9181('0x25')]['forEach'](function(_0x3d019c){var _0x30436d=_[_0x9181('0x2f')](recordings[_0x20914c[_0x9181('0x3')]]);_0x30436d[_0x9181('0x20')]=_0x3d019c['value'];writeDB(_0x30436d);});delete recordings[_0x20914c['uniqueid']];}}catch(_0x3b7d4c){utils['error'](util[_0x9181('0xf')](_0x9181('0x28'),_0x20914c[_0x9181('0x3')]),_0x3b7d4c);}};exports[_0x9181('0x30')]=function(_0x22092b){try{if(!_[_0x9181('0x16')](recordings[_0x22092b[_0x9181('0x3')]])){utils[_0x9181('0xe')](util[_0x9181('0xf')](_0x9181('0x31'),_0x22092b[_0x9181('0x3')]),_0x22092b);utils[_0x9181('0x2')](util[_0x9181('0xf')](_0x9181('0x32'),_0x22092b[_0x9181('0x3')],_0x22092b[_0x9181('0x33')],_0x22092b[_0x9181('0x34')]));if(_0x22092b[_0x9181('0x33')][_0x9181('0x35')]()==_0x9181('0x36')&&_[_0x9181('0x37')](_0x22092b[_0x9181('0x34')][_0x9181('0x35')](),'cdr')){var _0x1ca42e=_0x22092b[_0x9181('0x34')]['split']('=');var _0x5c05de=_0x1ca42e[0x0][_0x9181('0x38')](_0x1ca42e[0x0]['lastIndexOf']('(')+0x1,_0x1ca42e[0x0]['lastIndexOf'](')'));var _0x4066ad=_0x1ca42e[0x1];recordings[_0x22092b['uniqueid']][_0x5c05de]=_0x4066ad;}}}catch(_0x1647d2){utils[_0x9181('0x1b')](util['format'](_0x9181('0x31'),_0x22092b[_0x9181('0x3')]),_0x1647d2);}};exports[_0x9181('0x39')]=function(_0x269811){try{if(!_[_0x9181('0x16')](recordings[_0x269811[_0x9181('0x3')]])){utils['debug'](util['format'](_0x9181('0x3a'),_0x269811[_0x9181('0x3')]),_0x269811);utils[_0x9181('0x2')](util[_0x9181('0xf')](_0x9181('0x3b'),_0x269811['uniqueid'],_0x269811[_0x9181('0x3c')]));recordings[_0x269811[_0x9181('0x3')]][_0x9181('0x3c')]=_0x269811['queue'];}}catch(_0x13cb74){utils[_0x9181('0x1b')](util[_0x9181('0xf')](_0x9181('0x3a'),_0x269811[_0x9181('0x3')]),_0x13cb74);}};exports['blindtransfer']=function(_0x5d3f4c){try{utils[_0x9181('0xe')](util['format'](_0x9181('0x3d'),_0x5d3f4c['uniqueid']),_0x5d3f4c);utils[_0x9181('0x2')](util[_0x9181('0xf')](_0x9181('0x3e'),_0x5d3f4c[_0x9181('0x3')],_0x5d3f4c['transferercalleridnum'],_0x5d3f4c[_0x9181('0x3f')],_0x5d3f4c[_0x9181('0x40')],_0x5d3f4c[_0x9181('0x41')]));if(recordings[_0x5d3f4c[_0x9181('0x42')]]&&transfers[_0x9181('0x4')][_0x5d3f4c[_0x9181('0x42')]]){transfers[_0x9181('0x4')][_0x5d3f4c['transfereruniqueid']][_0x9181('0x43')]=!![];}}catch(_0x158aab){utils[_0x9181('0x1b')](util[_0x9181('0xf')](_0x9181('0x3d'),_0x5d3f4c[_0x9181('0x3')]),_0x158aab);}}; \ No newline at end of file +var _0x43d4=['transfereeuniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','format','[%s][recordings][newchannel]','linkedid','info','context','exten','channel','error','newstate','debug','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','[%s][recordings][writeDB]','blinds','uniqueid'];(function(_0xd3f1ca,_0xd2adf3){var _0x1778db=function(_0x5c3949){while(--_0x5c3949){_0xd3f1ca['push'](_0xd3f1ca['shift']());}};_0x1778db(++_0xd2adf3);}(_0x43d4,0xd1));var _0x443d=function(_0x32eeca,_0x3b16bc){_0x32eeca=_0x32eeca-0x0;var _0x36c379=_0x43d4[_0x32eeca];return _0x36c379;};'use strict';var _=require(_0x443d('0x0'));var util=require(_0x443d('0x1'));var utils=require(_0x443d('0x2'));var transfers=require(_0x443d('0x3'));var recordings={};function writeDB(_0x2e6b05){var _0x2768cc;utils['info'](util['format'](_0x443d('0x4'),_0x2e6b05['uniqueid']));if(transfers[_0x443d('0x5')][_0x2e6b05['uniqueid']]){_0x2768cc=_0x2e6b05[_0x443d('0x6')];_0x2e6b05['uniqueid']=transfers[_0x443d('0x5')][_0x2e6b05[_0x443d('0x6')]][_0x443d('0x7')];}if(_0x2e6b05['accountcode']){utils['getUserByInternal'](_0x2e6b05[_0x443d('0x8')])[_0x443d('0x9')](function(_0x3724a2){if(_0x3724a2){_0x2e6b05[_0x443d('0xa')]=_0x3724a2[_0x443d('0xb')];_0x2e6b05[_0x443d('0xc')]=_0x3724a2['id'];}utils[_0x443d('0xd')](_0x443d('0xe'),_0x2e6b05);});}else{utils['request']('CreateVoiceRecording',_0x2e6b05);}if(_0x2768cc)delete transfers['blinds'][_0x2768cc];}exports[_0x443d('0xf')]=function(_0x566ae8){try{utils['debug'](util[_0x443d('0x10')](_0x443d('0x11'),_0x566ae8[_0x443d('0x6')]),_0x566ae8);if(_0x566ae8[_0x443d('0x6')]==_0x566ae8[_0x443d('0x12')]){utils[_0x443d('0x13')](util[_0x443d('0x10')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x566ae8[_0x443d('0x6')],_0x566ae8[_0x443d('0x14')],_0x566ae8[_0x443d('0x15')]));recordings[_0x566ae8[_0x443d('0x6')]]={'uniqueid':_0x566ae8[_0x443d('0x6')],'accountcode':_0x566ae8['accountcode'],'exten':_0x566ae8['exten'],'context':_0x566ae8[_0x443d('0x14')],'channel':_0x566ae8[_0x443d('0x16')],'monitors':[]};}}catch(_0x3699b2){utils[_0x443d('0x17')](util['format']('[%s][recordings][newchannel]',_0x566ae8['uniqueid']),_0x3699b2);}};exports[_0x443d('0x18')]=function(_0x151078){try{utils[_0x443d('0x19')](util[_0x443d('0x10')]('[%s][recordings][newstate]',_0x151078['uniqueid']),_0x151078);if(!_[_0x443d('0x1a')](recordings[_0x151078[_0x443d('0x6')]])&&_0x151078['channelstate']==0x6){utils[_0x443d('0x13')](util[_0x443d('0x10')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x151078[_0x443d('0x6')],_0x151078[_0x443d('0x14')],_0x151078[_0x443d('0x16')]));}else if(!_[_0x443d('0x1a')](recordings[_0x151078[_0x443d('0x12')]])&&_0x151078[_0x443d('0x1b')]==0x6&&_0x151078[_0x443d('0x14')]!=_0x443d('0x1c')){utils[_0x443d('0x13')](util[_0x443d('0x10')](_0x443d('0x1d'),_0x151078['uniqueid'],_0x151078[_0x443d('0x12')],_0x151078[_0x443d('0x14')],_0x151078['channel']));recordings[_0x151078[_0x443d('0x12')]][_0x443d('0x8')]=_0x151078[_0x443d('0x8')];}}catch(_0x3095a3){utils[_0x443d('0x17')](util[_0x443d('0x10')](_0x443d('0x1e'),_0x151078['uniqueid']),_0x3095a3);}};exports[_0x443d('0x1f')]=function(_0x17c6eb){try{if(!_['isNil'](_0x17c6eb[_0x443d('0x20')])&&!_[_0x443d('0x1a')](_0x17c6eb[_0x443d('0x20')][_0x443d('0x21')])){utils[_0x443d('0x19')](util[_0x443d('0x10')](_0x443d('0x22'),_0x17c6eb['uniqueid']),_0x17c6eb);utils[_0x443d('0x13')](util[_0x443d('0x10')](_0x443d('0x23'),_0x17c6eb[_0x443d('0x6')],_0x17c6eb[_0x443d('0x20')],_0x17c6eb['value']));if(_[_0x443d('0x24')](_0x17c6eb[_0x443d('0x25')],_0x443d('0x26'))){_0x17c6eb['value']=_0x17c6eb[_0x443d('0x25')][_0x443d('0x27')](_0x443d('0x26'),'.WAV');}if(recordings[_0x17c6eb[_0x443d('0x12')]]){var _0x4b14b7=_[_0x443d('0x28')](recordings[_0x17c6eb[_0x443d('0x12')]][_0x443d('0x29')],{'value':_0x17c6eb['value']});if(_[_0x443d('0x1a')](_0x4b14b7)){recordings[_0x17c6eb[_0x443d('0x12')]][_0x443d('0x29')][_0x443d('0x2a')]({'value':_0x17c6eb[_0x443d('0x25')]});}}}}catch(_0x496924){utils[_0x443d('0x17')](util[_0x443d('0x10')](_0x443d('0x22'),_0x17c6eb['uniqueid']),_0x496924);}};exports[_0x443d('0x2b')]=function(_0x1626cc){try{if(!_[_0x443d('0x1a')](recordings[_0x1626cc[_0x443d('0x6')]])){utils[_0x443d('0x19')](util[_0x443d('0x10')](_0x443d('0x2c'),_0x1626cc[_0x443d('0x6')]),_0x1626cc);utils[_0x443d('0x13')](util[_0x443d('0x10')](_0x443d('0x2d'),_0x1626cc['uniqueid'],_0x1626cc[_0x443d('0x2e')],_0x1626cc[_0x443d('0x2f')],_0x1626cc['cause-txt']));recordings[_0x1626cc[_0x443d('0x6')]][_0x443d('0x2e')]=_0x1626cc[_0x443d('0x2e')];recordings[_0x1626cc[_0x443d('0x6')]]['calleridname']=_0x1626cc[_0x443d('0x2f')];recordings[_0x1626cc['uniqueid']][_0x443d('0x30')]=_0x1626cc[_0x443d('0x30')];recordings[_0x1626cc[_0x443d('0x6')]]['connectedlinename']=_0x1626cc[_0x443d('0x31')];if(recordings[_0x1626cc[_0x443d('0x6')]][_0x443d('0x32')]=='outbound'&&recordings[_0x1626cc[_0x443d('0x6')]][_0x443d('0x8')]){recordings[_0x1626cc[_0x443d('0x6')]][_0x443d('0x30')]=recordings[_0x1626cc['uniqueid']][_0x443d('0x8')];recordings[_0x1626cc[_0x443d('0x6')]]['connectedlinename']='';}recordings[_0x1626cc[_0x443d('0x6')]][_0x443d('0x29')][_0x443d('0x33')](function(_0x317d4f){var _0x356488=_[_0x443d('0x34')](recordings[_0x1626cc[_0x443d('0x6')]]);_0x356488[_0x443d('0x25')]=_0x317d4f[_0x443d('0x25')];writeDB(_0x356488);});delete recordings[_0x1626cc[_0x443d('0x6')]];}}catch(_0x20082d){utils[_0x443d('0x17')](util['format'](_0x443d('0x2c'),_0x1626cc[_0x443d('0x6')]),_0x20082d);}};exports[_0x443d('0x35')]=function(_0x4130fa){try{if(!_[_0x443d('0x1a')](recordings[_0x4130fa[_0x443d('0x6')]])){utils[_0x443d('0x19')](util[_0x443d('0x10')](_0x443d('0x36'),_0x4130fa['uniqueid']),_0x4130fa);utils[_0x443d('0x13')](util['format'](_0x443d('0x37'),_0x4130fa[_0x443d('0x6')],_0x4130fa[_0x443d('0x38')],_0x4130fa[_0x443d('0x39')]));if(_0x4130fa['application'][_0x443d('0x3a')]()=='set'&&_[_0x443d('0x3b')](_0x4130fa['appdata'][_0x443d('0x3a')](),_0x443d('0x3c'))){var _0xe6ba1f=_0x4130fa[_0x443d('0x39')]['split']('=');var _0x127428=_0xe6ba1f[0x0][_0x443d('0x3d')](_0xe6ba1f[0x0][_0x443d('0x3e')]('(')+0x1,_0xe6ba1f[0x0][_0x443d('0x3e')](')'));var _0x1eaf99=_0xe6ba1f[0x1];recordings[_0x4130fa[_0x443d('0x6')]][_0x127428]=_0x1eaf99;}}}catch(_0x5243d1){utils[_0x443d('0x17')](util[_0x443d('0x10')](_0x443d('0x36'),_0x4130fa[_0x443d('0x6')]),_0x5243d1);}};exports[_0x443d('0x3f')]=function(_0x179896){try{if(!_['isNil'](recordings[_0x179896[_0x443d('0x6')]])){utils[_0x443d('0x19')](util[_0x443d('0x10')]('[%s][recordings][queuecallerjoin]',_0x179896[_0x443d('0x6')]),_0x179896);utils[_0x443d('0x13')](util[_0x443d('0x10')](_0x443d('0x40'),_0x179896[_0x443d('0x6')],_0x179896[_0x443d('0x41')]));recordings[_0x179896['uniqueid']][_0x443d('0x41')]=_0x179896['queue'];}}catch(_0x52d057){utils[_0x443d('0x17')](util[_0x443d('0x10')]('[%s][recordings][queuecallerjoin]',_0x179896[_0x443d('0x6')]),_0x52d057);}};exports['blindtransfer']=function(_0x31e4bd){try{utils['debug'](util[_0x443d('0x10')](_0x443d('0x42'),_0x31e4bd[_0x443d('0x6')]),_0x31e4bd);utils[_0x443d('0x13')](util['format']('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x31e4bd['uniqueid'],_0x31e4bd['transferercalleridnum'],_0x31e4bd[_0x443d('0x43')],_0x31e4bd[_0x443d('0x44')],_0x31e4bd[_0x443d('0x45')]));if(recordings[_0x31e4bd[_0x443d('0x46')]]&&transfers['blinds'][_0x31e4bd['transfereruniqueid']]){transfers[_0x443d('0x5')][_0x31e4bd[_0x443d('0x46')]][_0x443d('0x47')]=!![];}}catch(_0x1d1189){utils[_0x443d('0x17')](util['format']('[%s][recordings][blindtransfer]',_0x31e4bd[_0x443d('0x6')]),_0x1d1189);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 78b7e9a..bfc3991 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 _0x8fb5=['transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransferercontext','isNil','transfereechannel','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','util','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blinds','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum'];(function(_0x3132e8,_0x499a0e){var _0x43eb8c=function(_0x2321e1){while(--_0x2321e1){_0x3132e8['push'](_0x3132e8['shift']());}};_0x43eb8c(++_0x499a0e);}(_0x8fb5,0x1c5));var _0x58fb=function(_0x88f8ca,_0x1e419a){_0x88f8ca=_0x88f8ca-0x0;var _0x46f4b1=_0x8fb5[_0x88f8ca];return _0x46f4b1;};'use strict';var _=require('lodash');var util=require(_0x58fb('0x0'));var utils=require('./utils');function writeDB(_0x109d4a){utils[_0x58fb('0x1')](util['format'](_0x58fb('0x2'),_0x109d4a[_0x58fb('0x3')]===_0x58fb('0x4')?_0x109d4a[_0x58fb('0x5')]:_0x109d4a[_0x58fb('0x6')],_0x109d4a['type']));utils[_0x58fb('0x7')]('CreateVoiceTransferReport',_0x109d4a);}exports[_0x58fb('0x8')]={};exports['blindtransfer']=function(_0x11b6bf){try{utils[_0x58fb('0x9')](util[_0x58fb('0xa')](_0x58fb('0xb'),_0x11b6bf[_0x58fb('0x6')]),_0x11b6bf);utils[_0x58fb('0x1')](util['format'](_0x58fb('0xc'),_0x11b6bf['uniqueid'],_0x11b6bf['transferercalleridnum'],_0x11b6bf[_0x58fb('0xd')],_0x11b6bf[_0x58fb('0xe')],_0x11b6bf[_0x58fb('0xf')]));_0x11b6bf[_0x58fb('0x3')]='blind';exports[_0x58fb('0x8')][_0x11b6bf[_0x58fb('0x10')]]=_0x11b6bf;writeDB(_0x11b6bf);}catch(_0x13c586){utils[_0x58fb('0x11')](util[_0x58fb('0xa')]('[%s][transfers][blindtransfer]',_0x11b6bf['uniqueid']),_0x13c586);}};exports['attendedtransfer']=function(_0x2b2aa7){try{utils[_0x58fb('0x9')](util[_0x58fb('0xa')](_0x58fb('0x12'),_0x2b2aa7[_0x58fb('0x5')]),_0x2b2aa7);utils[_0x58fb('0x1')](util[_0x58fb('0xa')](_0x58fb('0x13'),_0x2b2aa7[_0x58fb('0x5')],_0x2b2aa7[_0x58fb('0x14')],_0x2b2aa7[_0x58fb('0x15')],_0x2b2aa7[_0x58fb('0x16')],_0x2b2aa7[_0x58fb('0x17')]));_0x2b2aa7=_[_0x58fb('0x18')](_0x2b2aa7,{'transfererchannel':_0x2b2aa7['origtransfererchannel'],'transferercalleridnum':_0x2b2aa7[_0x58fb('0x14')],'transferercalleridname':_0x2b2aa7[_0x58fb('0x15')],'transfererconnectedlinenum':_0x2b2aa7[_0x58fb('0x19')],'transfererconnectedlinename':_0x2b2aa7['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2b2aa7['origtransfereraccountcode'],'transferercontext':_0x2b2aa7[_0x58fb('0x1a')],'transfererexten':_0x2b2aa7[_0x58fb('0x1b')],'transfererlinkedid':_0x2b2aa7['origtransfererlinkedid'],'context':_0x2b2aa7[_0x58fb('0x1c')],'extension':_0x2b2aa7['origtransfererexten'],'type':_0x58fb('0x4')});if(_[_0x58fb('0x1d')](_0x2b2aa7[_0x58fb('0x1e')])){_0x2b2aa7=_['assign'](_0x2b2aa7,{'transfereechannel':_0x2b2aa7['transfertargetchannel'],'transfereecalleridnum':_0x2b2aa7['transfertargetcalleridnum'],'transfereecalleridname':_0x2b2aa7[_0x58fb('0x17')],'transfereeconnectedlinenum':_0x2b2aa7['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2b2aa7['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2b2aa7[_0x58fb('0x1f')],'transfereecontext':_0x2b2aa7[_0x58fb('0x20')],'transfereeexten':_0x2b2aa7['transfertargetexten'],'transfereelinkedid':_0x2b2aa7[_0x58fb('0x21')]});}writeDB(_0x2b2aa7);}catch(_0x481b9b){utils[_0x58fb('0x11')](util[_0x58fb('0xa')](_0x58fb('0x12'),_0x2b2aa7['origtransfereruniqueid']),_0x481b9b);}}; \ No newline at end of file +var _0x8d12=['blindtransfer','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','blind','transfereruniqueid','error','[%s][transfers][attendedtransfer]','origtransfereruniqueid','transfertargetcalleridnum','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','attended','uniqueid','type','request','CreateVoiceTransferReport','blinds'];(function(_0x114e6a,_0x3dc9d2){var _0x423189=function(_0xffe54){while(--_0xffe54){_0x114e6a['push'](_0x114e6a['shift']());}};_0x423189(++_0x3dc9d2);}(_0x8d12,0x154));var _0x28d1=function(_0x2f3d29,_0x150e7b){_0x2f3d29=_0x2f3d29-0x0;var _0x53d69d=_0x8d12[_0x2f3d29];return _0x53d69d;};'use strict';var _=require(_0x28d1('0x0'));var util=require(_0x28d1('0x1'));var utils=require(_0x28d1('0x2'));function writeDB(_0x325245){utils[_0x28d1('0x3')](util[_0x28d1('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x325245['type']===_0x28d1('0x5')?_0x325245['origtransfereruniqueid']:_0x325245[_0x28d1('0x6')],_0x325245[_0x28d1('0x7')]));utils[_0x28d1('0x8')](_0x28d1('0x9'),_0x325245);}exports[_0x28d1('0xa')]={};exports[_0x28d1('0xb')]=function(_0x279cb0){try{utils['debug'](util['format']('[%s][transfers][blindtransfer]',_0x279cb0[_0x28d1('0x6')]),_0x279cb0);utils['info'](util[_0x28d1('0x4')](_0x28d1('0xc'),_0x279cb0[_0x28d1('0x6')],_0x279cb0[_0x28d1('0xd')],_0x279cb0['transferercalleridname'],_0x279cb0['transfereecalleridnum'],_0x279cb0['transfereecalleridname']));_0x279cb0[_0x28d1('0x7')]=_0x28d1('0xe');exports[_0x28d1('0xa')][_0x279cb0[_0x28d1('0xf')]]=_0x279cb0;writeDB(_0x279cb0);}catch(_0x341ee2){utils[_0x28d1('0x10')](util['format']('[%s][transfers][blindtransfer]',_0x279cb0[_0x28d1('0x6')]),_0x341ee2);}};exports['attendedtransfer']=function(_0x10056d){try{utils['debug'](util[_0x28d1('0x4')](_0x28d1('0x11'),_0x10056d['origtransfereruniqueid']),_0x10056d);utils[_0x28d1('0x3')](util[_0x28d1('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x10056d[_0x28d1('0x12')],_0x10056d['origtransferercalleridnum'],_0x10056d['origtransferercalleridname'],_0x10056d[_0x28d1('0x13')],_0x10056d['transfertargetcalleridname']));_0x10056d=_['assign'](_0x10056d,{'transfererchannel':_0x10056d[_0x28d1('0x14')],'transferercalleridnum':_0x10056d[_0x28d1('0x15')],'transferercalleridname':_0x10056d[_0x28d1('0x16')],'transfererconnectedlinenum':_0x10056d[_0x28d1('0x17')],'transfererconnectedlinename':_0x10056d[_0x28d1('0x18')],'transfereraccountcode':_0x10056d[_0x28d1('0x19')],'transferercontext':_0x10056d[_0x28d1('0x1a')],'transfererexten':_0x10056d[_0x28d1('0x1b')],'transfererlinkedid':_0x10056d[_0x28d1('0x1c')],'context':_0x10056d[_0x28d1('0x1d')],'extension':_0x10056d[_0x28d1('0x1e')],'type':'attended'});if(_[_0x28d1('0x1f')](_0x10056d['transfereechannel'])){_0x10056d=_['assign'](_0x10056d,{'transfereechannel':_0x10056d[_0x28d1('0x20')],'transfereecalleridnum':_0x10056d[_0x28d1('0x13')],'transfereecalleridname':_0x10056d[_0x28d1('0x21')],'transfereeconnectedlinenum':_0x10056d[_0x28d1('0x22')],'transfereeconnectedlinename':_0x10056d[_0x28d1('0x23')],'transfereeaccountcode':_0x10056d['transfertargetaccountcode'],'transfereecontext':_0x10056d[_0x28d1('0x24')],'transfereeexten':_0x10056d[_0x28d1('0x25')],'transfereelinkedid':_0x10056d[_0x28d1('0x26')]});}writeDB(_0x10056d);}catch(_0x312010){utils[_0x28d1('0x10')](util[_0x28d1('0x4')](_0x28d1('0x11'),_0x10056d[_0x28d1('0x12')]),_0x312010);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index c4d018d..aa697c0 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 _0x39d2=['internal','name','[utils][getUser]\x20where:%s','stringify','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','catch','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','result','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser'];(function(_0x288840,_0x203a38){var _0x30203b=function(_0xeceb33){while(--_0xeceb33){_0x288840['push'](_0x288840['shift']());}};_0x30203b(++_0x203a38);}(_0x39d2,0xf5));var _0x239d=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x39d2[_0x4687df];return _0x32eaef;};'use strict';var BPromise=require(_0x239d('0x0'));var jayson=require('jayson/promise');var moment=require(_0x239d('0x1'));var util=require(_0x239d('0x2'));var client=jayson[_0x239d('0x3')][_0x239d('0x4')]({'port':0x2329});var logger=require(_0x239d('0x5'))(_0x239d('0x6'));exports[_0x239d('0x7')]=function(_0x1f5943,_0x367278){logger[_0x239d('0x7')](_0x1f5943,_0x367278?util[_0x239d('0x8')](_0x367278,{'showHidden':![],'depth':null}):'');};exports[_0x239d('0x9')]=function(_0x1f0947,_0x53d457){logger[_0x239d('0x9')](_0x1f0947,_0x53d457?util[_0x239d('0x8')](_0x53d457,{'showHidden':![],'depth':null}):'');};exports[_0x239d('0xa')]=function(_0x29a5d4,_0x3d136e){logger[_0x239d('0xa')](_0x29a5d4,_0x3d136e?util[_0x239d('0x8')](_0x3d136e,{'showHidden':![],'depth':null}):'');};exports[_0x239d('0xb')]=function(_0x542157,_0x6273ef){return client[_0x239d('0xb')](_0x542157,{'body':_0x6273ef})[_0x239d('0xc')](function(_0xf1fde1){logger[_0x239d('0x9')](_0x239d('0xd'),_0x542157,_0xf1fde1?util['inspect'](_0xf1fde1,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x1d366f){logger[_0x239d('0xa')](_0x239d('0xd'),_0x542157,_0x1d366f?util[_0x239d('0x8')](_0x1d366f,{'showHidden':![],'depth':null}):'');});};function getUser(_0x150bf6){return client[_0x239d('0xb')](_0x239d('0xe'),{'options':{'raw':!![],'attributes':['id',_0x239d('0xf'),_0x239d('0x10'),'interface'],'where':_0x150bf6,'limit':0x1}})[_0x239d('0xc')](function(_0x430f26){logger[_0x239d('0x9')](_0x239d('0x11'),JSON[_0x239d('0x12')](_0x150bf6),_0x430f26?util['inspect'](_0x430f26,{'showHidden':![],'depth':null}):'');return _0x430f26['result'][_0x239d('0x13')]?_0x430f26['result'][0x0]:null;});}exports[_0x239d('0x14')]=function(_0x47bec3){return new BPromise(function(_0x33f01d,_0x39627f){if(_0x47bec3){return getUser({'internal':_0x47bec3})[_0x239d('0xc')](function(_0x472963){logger[_0x239d('0x7')](_0x239d('0x15'),_0x47bec3,_0x472963?_0x239d('0x16'):_0x239d('0x17'));return _0x33f01d(_0x472963);})['catch'](function(_0x24d2ee){logger['error'](_0x239d('0x18'),_0x24d2ee?util[_0x239d('0x8')](_0x24d2ee,{'showHidden':![],'depth':null}):'');return _0x33f01d(null);});}return _0x33f01d(null);});};exports[_0x239d('0x19')]=function(_0x5abe81){return new BPromise(function(_0xdacbd2,_0x10b39b){if(_0x5abe81){return getUser({'interface':_0x5abe81})[_0x239d('0xc')](function(_0x344fab){logger[_0x239d('0x7')](_0x239d('0x1a'),_0x5abe81,_0x344fab?_0x239d('0x16'):_0x239d('0x17'));return _0xdacbd2(_0x344fab);})[_0x239d('0x1b')](function(_0x4f1142){logger[_0x239d('0xa')](_0x239d('0x1c'),_0x4f1142?util[_0x239d('0x8')](_0x4f1142,{'showHidden':![],'depth':null}):'');return _0xdacbd2(null);});}return _0xdacbd2(null);});};exports[_0x239d('0x1d')]=function(_0x5541e3){return new BPromise(function(_0x72802,_0xe97415){if(_0x5541e3){return getUser({'name':_0x5541e3})[_0x239d('0xc')](function(_0x44947c){logger['info'](_0x239d('0x1e'),_0x5541e3,_0x44947c?_0x239d('0x16'):'notfound');return _0x72802(_0x44947c);})['catch'](function(_0x204944){logger['error']('[utils][getUserByName]',_0x204944?util[_0x239d('0x8')](_0x204944,{'showHidden':![],'depth':null}):'');return _0x72802(null);});}return _0x72802(null);});};exports[_0x239d('0x1f')]=function(_0x59bb0d){return new BPromise(function(_0x3dba9e,_0x4f779e){if(_0x59bb0d){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x239d('0x10'),_0x239d('0x20'),_0x239d('0x21'),_0x239d('0x22')],'where':{'name':_0x59bb0d},'limit':0x1}})['then'](function(_0x571197){logger['debug'](_0x239d('0x23'),_0x59bb0d,_0x571197?util[_0x239d('0x8')](_0x571197,{'showHidden':![],'depth':null}):'');logger[_0x239d('0x7')](_0x239d('0x24'),_0x59bb0d,_0x571197?'found':_0x239d('0x17'));return _0x3dba9e(_0x571197[_0x239d('0x25')][_0x239d('0x13')]?_0x571197[_0x239d('0x25')][0x0]:null);})[_0x239d('0x1b')](function(_0x5bdba6){logger[_0x239d('0xa')](_0x239d('0x26'),_0x5bdba6?util[_0x239d('0x8')](_0x5bdba6,{'showHidden':![],'depth':null}):'');return _0x3dba9e(null);});}return _0x3dba9e(null);});};exports[_0x239d('0x27')]=function(_0x38122d,_0x3767f4){return moment(_0x38122d)[_0x239d('0x28')](_0x3767f4,_0x239d('0x29'))[_0x239d('0x2a')](_0x239d('0x2b'));};exports[_0x239d('0x2c')]=function(_0x257d21,_0x4a3725){return moment(_0x257d21)[_0x239d('0x2d')](_0x4a3725,_0x239d('0x29'))[_0x239d('0x2a')](_0x239d('0x2b'));};exports[_0x239d('0x2e')]=function(_0x1b29ed,_0x503dcb){return moment(_0x1b29ed)[_0x239d('0x2f')](moment(_0x503dcb),'seconds');};exports[_0x239d('0x30')]=function(_0x409391,_0x59badf){return parseInt(_0x409391,0xa)+parseInt(_0x59badf,0xa);};exports[_0x239d('0x31')]=function(){return moment()[_0x239d('0x2a')](_0x239d('0x2b'));};exports[_0x239d('0x32')]=function(_0x56cffd,_0x4ea21c){if(_0x4ea21c){return moment(_0x56cffd)[_0x239d('0x32')](_0x4ea21c);}return!![];};exports[_0x239d('0x33')]=function(_0x28b83a,_0xaba263){if(_0xaba263){return moment(_0x28b83a)[_0x239d('0x33')](_0xaba263);}else if(_0x28b83a){return!![];}return![];}; \ No newline at end of file +var _0xd9bf=['xdr','info','debug','error','inspect','request','then','[utils][request]\x20name:%s','internal','name','interface','[utils][getUser]\x20where:%s','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','result','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd9bf,0x1d2));var _0xfd9b=function(_0xab9c3a,_0x534f30){_0xab9c3a=_0xab9c3a-0x0;var _0x5e64f1=_0xd9bf[_0xab9c3a];return _0x5e64f1;};'use strict';var BPromise=require(_0xfd9b('0x0'));var jayson=require(_0xfd9b('0x1'));var moment=require('moment');var util=require(_0xfd9b('0x2'));var client=jayson['client']['http']({'port':0x2329});var logger=require(_0xfd9b('0x3'))(_0xfd9b('0x4'));exports[_0xfd9b('0x5')]=function(_0x21a001,_0x240cbd){logger[_0xfd9b('0x5')](_0x21a001,_0x240cbd?util['inspect'](_0x240cbd,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x1cbf41,_0x37424f){logger[_0xfd9b('0x6')](_0x1cbf41,_0x37424f?util['inspect'](_0x37424f,{'showHidden':![],'depth':null}):'');};exports[_0xfd9b('0x7')]=function(_0x3c619f,_0xe37b8f){logger[_0xfd9b('0x7')](_0x3c619f,_0xe37b8f?util[_0xfd9b('0x8')](_0xe37b8f,{'showHidden':![],'depth':null}):'');};exports[_0xfd9b('0x9')]=function(_0x21bb26,_0x2bfe5c){return client['request'](_0x21bb26,{'body':_0x2bfe5c})[_0xfd9b('0xa')](function(_0x11742c){logger[_0xfd9b('0x6')](_0xfd9b('0xb'),_0x21bb26,_0x11742c?util['inspect'](_0x11742c,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x266b29){logger[_0xfd9b('0x7')]('[utils][request]\x20name:%s',_0x21bb26,_0x266b29?util[_0xfd9b('0x8')](_0x266b29,{'showHidden':![],'depth':null}):'');});};function getUser(_0x22e329){return client[_0xfd9b('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xfd9b('0xc'),_0xfd9b('0xd'),_0xfd9b('0xe')],'where':_0x22e329,'limit':0x1}})['then'](function(_0x7b8160){logger[_0xfd9b('0x6')](_0xfd9b('0xf'),JSON['stringify'](_0x22e329),_0x7b8160?util['inspect'](_0x7b8160,{'showHidden':![],'depth':null}):'');return _0x7b8160['result'][_0xfd9b('0x10')]?_0x7b8160['result'][0x0]:null;});}exports[_0xfd9b('0x11')]=function(_0xf9eb28){return new BPromise(function(_0x214193,_0x3fd8df){if(_0xf9eb28){return getUser({'internal':_0xf9eb28})[_0xfd9b('0xa')](function(_0x41d335){logger[_0xfd9b('0x5')](_0xfd9b('0x12'),_0xf9eb28,_0x41d335?_0xfd9b('0x13'):_0xfd9b('0x14'));return _0x214193(_0x41d335);})[_0xfd9b('0x15')](function(_0x1e7a9a){logger['error'](_0xfd9b('0x16'),_0x1e7a9a?util[_0xfd9b('0x8')](_0x1e7a9a,{'showHidden':![],'depth':null}):'');return _0x214193(null);});}return _0x214193(null);});};exports[_0xfd9b('0x17')]=function(_0x4edd81){return new BPromise(function(_0x4b69b0,_0x4ffd24){if(_0x4edd81){return getUser({'interface':_0x4edd81})[_0xfd9b('0xa')](function(_0x21f1f2){logger['info']('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x4edd81,_0x21f1f2?_0xfd9b('0x13'):_0xfd9b('0x14'));return _0x4b69b0(_0x21f1f2);})[_0xfd9b('0x15')](function(_0x55afd1){logger['error'](_0xfd9b('0x18'),_0x55afd1?util[_0xfd9b('0x8')](_0x55afd1,{'showHidden':![],'depth':null}):'');return _0x4b69b0(null);});}return _0x4b69b0(null);});};exports[_0xfd9b('0x19')]=function(_0x4c18fa){return new BPromise(function(_0x541909,_0x340001){if(_0x4c18fa){return getUser({'name':_0x4c18fa})[_0xfd9b('0xa')](function(_0x1919de){logger[_0xfd9b('0x5')](_0xfd9b('0x1a'),_0x4c18fa,_0x1919de?'found':_0xfd9b('0x14'));return _0x541909(_0x1919de);})['catch'](function(_0x4906ff){logger[_0xfd9b('0x7')](_0xfd9b('0x1b'),_0x4906ff?util[_0xfd9b('0x8')](_0x4906ff,{'showHidden':![],'depth':null}):'');return _0x541909(null);});}return _0x541909(null);});};exports['getVoiceQueueByName']=function(_0x2fcac2){return new BPromise(function(_0x489903,_0x41f650){if(_0x2fcac2){return client[_0xfd9b('0x9')](_0xfd9b('0x1c'),{'options':{'raw':!![],'attributes':['id',_0xfd9b('0xd'),_0xfd9b('0x1d'),_0xfd9b('0x1e'),_0xfd9b('0x1f')],'where':{'name':_0x2fcac2},'limit':0x1}})['then'](function(_0x2cc7e1){logger[_0xfd9b('0x6')]('[utils][getVoiceQueueByName]\x20name:%s',_0x2fcac2,_0x2cc7e1?util[_0xfd9b('0x8')](_0x2cc7e1,{'showHidden':![],'depth':null}):'');logger[_0xfd9b('0x5')](_0xfd9b('0x20'),_0x2fcac2,_0x2cc7e1?_0xfd9b('0x13'):'notfound');return _0x489903(_0x2cc7e1[_0xfd9b('0x21')][_0xfd9b('0x10')]?_0x2cc7e1[_0xfd9b('0x21')][0x0]:null);})[_0xfd9b('0x15')](function(_0x40d190){logger[_0xfd9b('0x7')](_0xfd9b('0x22'),_0x40d190?util[_0xfd9b('0x8')](_0x40d190,{'showHidden':![],'depth':null}):'');return _0x489903(null);});}return _0x489903(null);});};exports[_0xfd9b('0x23')]=function(_0x45cd5b,_0x456447){return moment(_0x45cd5b)[_0xfd9b('0x24')](_0x456447,_0xfd9b('0x25'))['format'](_0xfd9b('0x26'));};exports[_0xfd9b('0x27')]=function(_0x24b61e,_0x5498a9){return moment(_0x24b61e)[_0xfd9b('0x28')](_0x5498a9,_0xfd9b('0x25'))[_0xfd9b('0x29')](_0xfd9b('0x26'));};exports[_0xfd9b('0x2a')]=function(_0x46c302,_0x3dd52a){return moment(_0x46c302)['diff'](moment(_0x3dd52a),_0xfd9b('0x25'));};exports[_0xfd9b('0x2b')]=function(_0x4195fd,_0x4ee0f4){return parseInt(_0x4195fd,0xa)+parseInt(_0x4ee0f4,0xa);};exports[_0xfd9b('0x2c')]=function(){return moment()[_0xfd9b('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xfd9b('0x2d')]=function(_0x29db1d,_0x507475){if(_0x507475){return moment(_0x29db1d)[_0xfd9b('0x2d')](_0x507475);}return!![];};exports[_0xfd9b('0x2e')]=function(_0x577977,_0x59fef9){if(_0x59fef9){return moment(_0x577977)[_0xfd9b('0x2e')](_0x59fef9);}else if(_0x577977){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 d7e49aa..440bee1 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 _0xcbd4=['headers','x-forwarded-for','statusCode','responseTime','role','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','remoteAddress','url','other','agent_name','test','setupLoggers','fs-extra','express-winston','path','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','name','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','set','client-side-logger','use','logger','isEmpty','body','\x20body=%s','format','method'];(function(_0x3325c8,_0x5701c2){var _0x3526f9=function(_0x442577){while(--_0x442577){_0x3325c8['push'](_0x3325c8['shift']());}};_0x3526f9(++_0x5701c2);}(_0xcbd4,0x106));var _0x4cbd=function(_0x4e1e0c,_0x415832){_0x4e1e0c=_0x4e1e0c-0x0;var _0x4f5c32=_0xcbd4[_0x4e1e0c];return _0x4f5c32;};var fs=require(_0x4cbd('0x0'));var _=require('lodash');var ewinston=require(_0x4cbd('0x1'));var path=require(_0x4cbd('0x2'));var util=require('util');var fileLogger=require('./loggers')[_0x4cbd('0x3')];var safeTemplate=require(_0x4cbd('0x4'))['safeTemplate'];var maskSensitiveData=require(_0x4cbd('0x5'))[_0x4cbd('0x6')];function ClientSideLogger(){function _0x44e743(_0x289b6d){var _0x538199=path[_0x4cbd('0x7')](_0x4cbd('0x8'),_0x4cbd('0x9'),_0x4cbd('0xa'));var _0x51e6b5=path[_0x4cbd('0x7')](_0x4cbd('0xb'),_0x289b6d['role']+'-'+_0x289b6d[_0x4cbd('0xc')]);return fs[_0x4cbd('0xd')](path[_0x4cbd('0x7')](_0x538199,_0x51e6b5))[_0x4cbd('0xe')](function(){var _0x1c8c95=fileLogger(_0x4cbd('0xb'),path[_0x4cbd('0x7')](_0x538199,_0x51e6b5));return _0x1c8c95;})[_0x4cbd('0xf')](function(_0x4866de){throw _0x4866de;});}this['log']=function(_0x26d654,_0x81c1b0,_0x309661,_0x27f02c){return _0x44e743(_0x26d654[_0x4cbd('0x10')])[_0x4cbd('0xe')](function(_0x46f15c){var _0x5a320c=_0x46f15c[_0x81c1b0];return _0x5a320c;})['then'](function(_0x5c6967){var _0x545552=_0x26d654['user']?_0x26d654[_0x4cbd('0x10')]['id']:_0x4cbd('0x11');var _0x449e80=_0x27f02c[_0x4cbd('0x12')];var _0xbaf7ac=_0x27f02c[_0x4cbd('0x13')];var _0x3875a2=new Date(Number(_0xbaf7ac));return _0x5c6967(_0x545552,_0x3875a2,_0x309661,_0x449e80);})[_0x4cbd('0xf')](function(_0x2e260c){fileLogger(_0x4cbd('0xb'))[_0x4cbd('0x14')](_0x2e260c);});};}function setupLoggers(_0x48608d){return new Promise(function(_0x1b466d){var _0x5a604d=new ClientSideLogger();var _0x23f2e8=fileLogger(_0x4cbd('0x15'));var _0x1624c9=fileLogger(_0x4cbd('0x16'));_0x48608d[_0x4cbd('0x17')](_0x4cbd('0x18'),_0x5a604d);_0x48608d[_0x4cbd('0x19')](ewinston[_0x4cbd('0x1a')]({'winstonInstance':_0x23f2e8,'meta':![],'statusLevels':!![],'msg':function(_0x403068,_0x163fb4){var _0x2bc37b='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x4cbd('0x1b')](_0x403068[_0x4cbd('0x1c')])){_0x2bc37b+=_0x4cbd('0x1d');var _0x46f34c=_0x403068['body'];maskSensitiveData(_0x46f34c);}return safeTemplate(util[_0x4cbd('0x1e')](_0x2bc37b,_0x403068[_0x4cbd('0x1f')],_0x403068[_0x4cbd('0x20')][_0x4cbd('0x21')]?_0x403068[_0x4cbd('0x20')][_0x4cbd('0x21')]:_0x403068['connection']['remoteAddress']||_0x403068['ip'],_0x403068['url'],_0x163fb4[_0x4cbd('0x22')],_0x163fb4[_0x4cbd('0x23')],_0x403068[_0x4cbd('0x10')]?_0x403068['user']['id']:null,_0x403068[_0x4cbd('0x10')]?_0x403068['user'][_0x4cbd('0xc')]:null,_0x403068[_0x4cbd('0x10')]?_0x403068[_0x4cbd('0x10')][_0x4cbd('0x24')]:null,_0x46f34c?util[_0x4cbd('0x25')](_0x46f34c,![],null):''));}}));_0x48608d[_0x4cbd('0x19')](ewinston['logger']({'winstonInstance':_0x1624c9,'meta':![],'statusLevels':!![],'msg':function(_0x5852f3,_0x2563eb){var _0x5c8de9=_0x4cbd('0x26');if(_0x5852f3[_0x4cbd('0x1c')]&&_0x5852f3['body'][_0x4cbd('0x27')]&&_0x5852f3['body'][_0x4cbd('0x28')]){_0x5c8de9=_0x4cbd('0x29');}return util[_0x4cbd('0x1e')](_0x5c8de9,_0x5852f3[_0x4cbd('0x1f')],_0x5852f3[_0x4cbd('0x20')][_0x4cbd('0x21')]?_0x5852f3[_0x4cbd('0x20')][_0x4cbd('0x21')]:_0x5852f3[_0x4cbd('0x2a')][_0x4cbd('0x2b')]||_0x5852f3['ip'],_0x5852f3[_0x4cbd('0x2c')],_0x2563eb[_0x4cbd('0x22')],_0x2563eb[_0x4cbd('0x23')],_0x5852f3[_0x4cbd('0x10')]?_0x5852f3['user']['id']:null,_0x5852f3[_0x4cbd('0x10')]?_0x5852f3[_0x4cbd('0x10')][_0x4cbd('0xc')]:null,_0x5852f3['user']?_0x5852f3[_0x4cbd('0x10')][_0x4cbd('0x24')]:null,_0x5852f3[_0x4cbd('0x1c')]&&_0x5852f3[_0x4cbd('0x1c')][_0x4cbd('0x27')]?_0x5852f3['body'][_0x4cbd('0x27')]:_0x4cbd('0x2d'),_0x5852f3['body']&&_0x5852f3[_0x4cbd('0x1c')]['agent_id']?_0x5852f3['body'][_0x4cbd('0x28')]:'',_0x5852f3['body']&&_0x5852f3[_0x4cbd('0x1c')][_0x4cbd('0x2e')]?_0x5852f3['body'][_0x4cbd('0x2e')]:'');},'ignoreRoute':function(_0x2799ef){var _0x46573f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x46573f[_0x4cbd('0x2f')](_0x2799ef[_0x4cbd('0x2c')]);}}));return _0x1b466d();});}exports[_0x4cbd('0x30')]=setupLoggers; \ No newline at end of file +var _0x5d65=['api','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','headers','x-forwarded-for','connection','remoteAddress','responseTime','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','method','statusCode','other','url','fs-extra','lodash','express-winston','path','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','xcally','client','name','ensureDir','catch','log','user','then','data','timestamp','error'];(function(_0x4d7bd5,_0x196f54){var _0x1d37e6=function(_0x180fc1){while(--_0x180fc1){_0x4d7bd5['push'](_0x4d7bd5['shift']());}};_0x1d37e6(++_0x196f54);}(_0x5d65,0x177));var _0x55d6=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x5d65[_0x20c9b2];return _0x2c6030;};var fs=require(_0x55d6('0x0'));var _=require(_0x55d6('0x1'));var ewinston=require(_0x55d6('0x2'));var path=require(_0x55d6('0x3'));var util=require('util');var fileLogger=require('./loggers')[_0x55d6('0x4')];var safeTemplate=require(_0x55d6('0x5'))['safeTemplate'];var maskSensitiveData=require(_0x55d6('0x6'))[_0x55d6('0x7')];function ClientSideLogger(){function _0x32a082(_0x5321d9){var _0x44194a=path[_0x55d6('0x8')](_0x55d6('0x9'),'log',_0x55d6('0xa'));var _0x2b9754=path[_0x55d6('0x8')](_0x55d6('0xb'),_0x5321d9['role']+'-'+_0x5321d9[_0x55d6('0xc')]);return fs[_0x55d6('0xd')](path[_0x55d6('0x8')](_0x44194a,_0x2b9754))['then'](function(){var _0x4bcc76=fileLogger(_0x55d6('0xb'),path[_0x55d6('0x8')](_0x44194a,_0x2b9754));return _0x4bcc76;})[_0x55d6('0xe')](function(_0x38e31d){throw _0x38e31d;});}this[_0x55d6('0xf')]=function(_0x2cb68c,_0x4b234c,_0x4b6e6d,_0x4fcf8e){return _0x32a082(_0x2cb68c[_0x55d6('0x10')])[_0x55d6('0x11')](function(_0x75279a){var _0xf77b9a=_0x75279a[_0x4b234c];return _0xf77b9a;})[_0x55d6('0x11')](function(_0xfa7337){var _0x4d0120=_0x2cb68c[_0x55d6('0x10')]?_0x2cb68c[_0x55d6('0x10')]['id']:'no-user';var _0x599e13=_0x4fcf8e[_0x55d6('0x12')];var _0x8807b0=_0x4fcf8e[_0x55d6('0x13')];var _0x7e16e2=new Date(Number(_0x8807b0));return _0xfa7337(_0x4d0120,_0x7e16e2,_0x4b6e6d,_0x599e13);})['catch'](function(_0x5b86e0){fileLogger('client')[_0x55d6('0x14')](_0x5b86e0);});};}function setupLoggers(_0x134520){return new Promise(function(_0x3b3884){var _0x49e466=new ClientSideLogger();var _0x4f86ab=fileLogger(_0x55d6('0x15'));var _0x49aef6=fileLogger(_0x55d6('0x16'));_0x134520[_0x55d6('0x17')](_0x55d6('0x18'),_0x49e466);_0x134520['use'](ewinston[_0x55d6('0x19')]({'winstonInstance':_0x4f86ab,'meta':![],'statusLevels':!![],'msg':function(_0x373171,_0x21e893){var _0x282c7d=_0x55d6('0x1a');if(!_[_0x55d6('0x1b')](_0x373171[_0x55d6('0x1c')])){_0x282c7d+='\x20body=%s';var _0x483e02=_0x373171[_0x55d6('0x1c')];maskSensitiveData(_0x483e02);}return safeTemplate(util[_0x55d6('0x1d')](_0x282c7d,_0x373171['method'],_0x373171[_0x55d6('0x1e')][_0x55d6('0x1f')]?_0x373171[_0x55d6('0x1e')]['x-forwarded-for']:_0x373171[_0x55d6('0x20')][_0x55d6('0x21')]||_0x373171['ip'],_0x373171['url'],_0x21e893['statusCode'],_0x21e893[_0x55d6('0x22')],_0x373171[_0x55d6('0x10')]?_0x373171['user']['id']:null,_0x373171[_0x55d6('0x10')]?_0x373171['user'][_0x55d6('0xc')]:null,_0x373171['user']?_0x373171[_0x55d6('0x10')][_0x55d6('0x23')]:null,_0x483e02?util[_0x55d6('0x24')](_0x483e02,![],null):''));}}));_0x134520['use'](ewinston['logger']({'winstonInstance':_0x49aef6,'meta':![],'statusLevels':!![],'msg':function(_0x5179fc,_0x5bf2bc){var _0x520562=_0x55d6('0x25');if(_0x5179fc[_0x55d6('0x1c')]&&_0x5179fc[_0x55d6('0x1c')][_0x55d6('0x26')]&&_0x5179fc[_0x55d6('0x1c')][_0x55d6('0x27')]){_0x520562='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x55d6('0x1d')](_0x520562,_0x5179fc[_0x55d6('0x28')],_0x5179fc[_0x55d6('0x1e')][_0x55d6('0x1f')]?_0x5179fc[_0x55d6('0x1e')][_0x55d6('0x1f')]:_0x5179fc['connection'][_0x55d6('0x21')]||_0x5179fc['ip'],_0x5179fc['url'],_0x5bf2bc[_0x55d6('0x29')],_0x5bf2bc[_0x55d6('0x22')],_0x5179fc[_0x55d6('0x10')]?_0x5179fc[_0x55d6('0x10')]['id']:null,_0x5179fc['user']?_0x5179fc[_0x55d6('0x10')][_0x55d6('0xc')]:null,_0x5179fc[_0x55d6('0x10')]?_0x5179fc[_0x55d6('0x10')][_0x55d6('0x23')]:null,_0x5179fc[_0x55d6('0x1c')]&&_0x5179fc[_0x55d6('0x1c')][_0x55d6('0x26')]?_0x5179fc[_0x55d6('0x1c')][_0x55d6('0x26')]:_0x55d6('0x2a'),_0x5179fc['body']&&_0x5179fc[_0x55d6('0x1c')][_0x55d6('0x27')]?_0x5179fc[_0x55d6('0x1c')][_0x55d6('0x27')]:'',_0x5179fc[_0x55d6('0x1c')]&&_0x5179fc[_0x55d6('0x1c')]['agent_name']?_0x5179fc[_0x55d6('0x1c')]['agent_name']:'');},'ignoreRoute':function(_0x365da8){var _0x46ea5f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x46ea5f['test'](_0x365da8[_0x55d6('0x2b')]);}}));return _0x3b3884();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 8bc3c18..92c6224 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a2d=['bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','message','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','warn','Logger','error','File','%s-%s','consoleLogger','fileLogger','path','moment','winston','../config/environment','debugLevel','toLowerCase','red'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x0a2d,0x95));var _0xd0a2=function(_0x10e52a,_0x1b8c4b){_0x10e52a=_0x10e52a-0x0;var _0x5995d6=_0x0a2d[_0x10e52a];return _0x5995d6;};'use strict';var path=require(_0xd0a2('0x0'));var util=require('util');var moment=require(_0xd0a2('0x1'));var winston=require(_0xd0a2('0x2'));var config=require(_0xd0a2('0x3'));var debugLevel=config[_0xd0a2('0x4')]?config[_0xd0a2('0x4')][_0xd0a2('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':_0xd0a2('0x6'),'warn':_0xd0a2('0x7'),'info':_0xd0a2('0x8'),'print':_0xd0a2('0x9'),'success':_0xd0a2('0xa'),'http':_0xd0a2('0xb'),'verbose':_0xd0a2('0xc'),'debug':_0xd0a2('0xd'),'silly':_0xd0a2('0xe')};winston[_0xd0a2('0xf')](XC_LOG_COLORS);function getLogFileName(_0x524247,_0x15aa07,_0x2477c7){var _0x453531=_0x524247||_0xd0a2('0x10');return path[_0xd0a2('0x11')](_0x453531,util['format'](_0xd0a2('0x12'),_0x15aa07,_0x2477c7));}function formatter(_0x468e73,_0x337c6b){_0x337c6b[_0xd0a2('0x13')]=_0x337c6b[_0xd0a2('0x13')]['replace'](/@@{/g,'{{{')[_0xd0a2('0x14')](/}@@/g,_0xd0a2('0x15'))[_0xd0a2('0x14')](/@{/g,'{{')[_0xd0a2('0x14')](/}@/g,'}}');return util[_0xd0a2('0x16')](_0xd0a2('0x17'),moment()[_0xd0a2('0x16')](_0xd0a2('0x18')),_0x337c6b[_0xd0a2('0x19')][_0xd0a2('0x1a')](),_0x468e73,_0x337c6b['message']);}function fileFormat(_0x2303fb,_0x2b1eba){_0x2b1eba['message']=_0x2b1eba['message']['replace'](/@@{/g,'{{{')[_0xd0a2('0x14')](/}@@/g,'}}}')[_0xd0a2('0x14')](/@{/g,'{{')[_0xd0a2('0x14')](/}@/g,'}}');var _0x173857=_0x2b1eba[_0xd0a2('0x1b')]&&Object[_0xd0a2('0x1c')](_0x2b1eba[_0xd0a2('0x1b')])['length']?'\x0a\x09'+JSON['stringify'](_0x2b1eba[_0xd0a2('0x1b')]):'';return util[_0xd0a2('0x16')](_0xd0a2('0x1d'),moment()['format'](_0xd0a2('0x18')),_0x2b1eba['level'][_0xd0a2('0x1a')](),_0x2303fb,_0x2b1eba['message'],_0x173857);}function consoleLogger(){var _0x51960b=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xd0a2('0x1e'))][(_0xd0a2('0x1f'))]({'level':_0xd0a2('0x20'),'json':![],'formatter':function(_0x2eb293){return formatter('',_0x2eb293);}})]});return _0x51960b;}function fileLogger(_0x1b6313,_0xf26102){var _0x2093d6=new winston[(_0xd0a2('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xd0a2('0x1e'))]['File']({'name':util[_0xd0a2('0x16')]('%s-%s',_0x1b6313,'error'),'filename':getLogFileName(_0xf26102,_0x1b6313,'error'),'level':_0xd0a2('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5f0505){return fileFormat(_0x1b6313,_0x5f0505);}}),new winston[(_0xd0a2('0x1e'))][(_0xd0a2('0x23'))]({'name':util[_0xd0a2('0x16')](_0xd0a2('0x24'),_0x1b6313,debugLevel),'filename':getLogFileName(_0xf26102,_0x1b6313,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x596339){return fileFormat(_0x1b6313,_0x596339);}}),new winston[(_0xd0a2('0x1e'))][(_0xd0a2('0x1f'))]({'level':_0xd0a2('0x20'),'json':![],'formatter':function(_0x11f2e7){return fileFormat(_0x1b6313,_0x11f2e7);}})]});return _0x2093d6;}exports[_0xd0a2('0x25')]=consoleLogger;exports[_0xd0a2('0x26')]=fileLogger; \ No newline at end of file +var _0x68dc=['bold\x20white','bold\x20green','gray','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','File','%s-%s','error','Console','warn','consoleLogger','fileLogger','util','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','white'];(function(_0x3510c2,_0x396bf6){var _0x191fb0=function(_0x1e3f44){while(--_0x1e3f44){_0x3510c2['push'](_0x3510c2['shift']());}};_0x191fb0(++_0x396bf6);}(_0x68dc,0xf5));var _0xc68d=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x68dc[_0x455c6c];return _0x488242;};'use strict';var path=require('path');var util=require(_0xc68d('0x0'));var moment=require('moment');var winston=require('winston');var config=require('../config/environment');var debugLevel=config[_0xc68d('0x1')]?config[_0xc68d('0x1')][_0xc68d('0x2')]():_0xc68d('0x3');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xc68d('0x4'),'error':'red','warn':_0xc68d('0x5'),'info':_0xc68d('0x6'),'print':_0xc68d('0x7'),'success':_0xc68d('0x8'),'http':_0xc68d('0x9'),'verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0xc68d('0xa')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x5ad343,_0x100082,_0x70731f){var _0x1d7f23=_0x5ad343||_0xc68d('0xb');return path[_0xc68d('0xc')](_0x1d7f23,util[_0xc68d('0xd')](_0xc68d('0xe'),_0x100082,_0x70731f));}function formatter(_0xbadc94,_0x3af293){_0x3af293[_0xc68d('0xf')]=_0x3af293[_0xc68d('0xf')][_0xc68d('0x10')](/@@{/g,_0xc68d('0x11'))[_0xc68d('0x10')](/}@@/g,_0xc68d('0x12'))[_0xc68d('0x10')](/@{/g,'{{')[_0xc68d('0x10')](/}@/g,'}}');return util[_0xc68d('0xd')](_0xc68d('0x13'),moment()[_0xc68d('0xd')](_0xc68d('0x14')),_0x3af293[_0xc68d('0x15')]['toUpperCase'](),_0xbadc94,_0x3af293[_0xc68d('0xf')]);}function fileFormat(_0x3eeb14,_0x522a03){_0x522a03[_0xc68d('0xf')]=_0x522a03[_0xc68d('0xf')]['replace'](/@@{/g,_0xc68d('0x11'))[_0xc68d('0x10')](/}@@/g,_0xc68d('0x12'))[_0xc68d('0x10')](/@{/g,'{{')[_0xc68d('0x10')](/}@/g,'}}');var _0x24d1e4=_0x522a03[_0xc68d('0x16')]&&Object['keys'](_0x522a03[_0xc68d('0x16')])[_0xc68d('0x17')]?'\x0a\x09'+JSON[_0xc68d('0x18')](_0x522a03[_0xc68d('0x16')]):'';return util['format'](_0xc68d('0x19'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x522a03[_0xc68d('0x15')][_0xc68d('0x1a')](),_0x3eeb14,_0x522a03[_0xc68d('0xf')],_0x24d1e4);}function consoleLogger(){var _0x99a9dc=new winston[(_0xc68d('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xc68d('0x1c'))]['Console']({'level':'warn','json':![],'formatter':function(_0x19dc13){return formatter('',_0x19dc13);}})]});return _0x99a9dc;}function fileLogger(_0x4950f7,_0x42ff37){var _0xd78bb=new winston[(_0xc68d('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xc68d('0x1c'))][(_0xc68d('0x1d'))]({'name':util['format'](_0xc68d('0x1e'),_0x4950f7,_0xc68d('0x1f')),'filename':getLogFileName(_0x42ff37,_0x4950f7,_0xc68d('0x1f')),'level':_0xc68d('0x1f'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x51d851){return fileFormat(_0x4950f7,_0x51d851);}}),new winston['transports'][(_0xc68d('0x1d'))]({'name':util['format']('%s-%s',_0x4950f7,debugLevel),'filename':getLogFileName(_0x42ff37,_0x4950f7,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x43e39f){return fileFormat(_0x4950f7,_0x43e39f);}}),new winston['transports'][(_0xc68d('0x20'))]({'level':_0xc68d('0x21'),'json':![],'formatter':function(_0xb8085e){return fileFormat(_0x4950f7,_0xb8085e);}})]});return _0xd78bb;}exports[_0xc68d('0x22')]=consoleLogger;exports[_0xc68d('0x23')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 1a7900f..e36c2f2 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 _0x5f66=['consumerSecret','membername','calleridname','exten','privateKey','secretaccesskey','user','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','lastName','street','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','consumerKey'];(function(_0x5c0d0f,_0x3ce18e){var _0xcfc84c=function(_0x49b837){while(--_0x49b837){_0x5c0d0f['push'](_0x5c0d0f['shift']());}};_0xcfc84c(++_0x3ce18e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};var _=require('lodash');var sensitiveFields=[_0x65f6('0x0'),'password',_0x65f6('0x1'),_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'phone',_0x65f6('0x6'),'fax',_0x65f6('0x7'),_0x65f6('0x8'),'clientSecret','securityToken',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'accessTokenSecret','authToken',_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0x12'),'calleridnum',_0x65f6('0x13'),'vidaooApiKey','clientEmail',_0x65f6('0x14'),'accesskeyid',_0x65f6('0x15'),'key',_0x65f6('0x16'),_0x65f6('0x17'),_0x65f6('0x18'),_0x65f6('0x19'),_0x65f6('0x1a'),_0x65f6('0x1b'),_0x65f6('0x1c'),_0x65f6('0x1d')];function maskSensitiveData(_0x46dbc6){const _0x3440af=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x46dbc6)){for(const _0x19b9ff in _0x46dbc6){if(_['isArray'](_0x46dbc6[_0x19b9ff])){for(let _0x5dd324=0x0;_0x5dd324<_0x46dbc6[_0x19b9ff][_0x65f6('0x1e')];_0x5dd324++){maskSensitiveData(_0x46dbc6[_0x19b9ff][_0x5dd324]);}}else if(_[_0x65f6('0x1f')](_0x46dbc6[_0x19b9ff])){maskSensitiveData(_0x46dbc6[_0x19b9ff]);}else if(_[_0x65f6('0x20')](_0x46dbc6[_0x19b9ff])){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](/{{{/g,_0x65f6('0x22'))[_0x65f6('0x21')](/}}}/g,_0x65f6('0x23'))[_0x65f6('0x21')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x19b9ff)){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](_0x3440af,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x1967,0x173));var _0x7196=function(_0x20b9ed,_0x381c31){_0x20b9ed=_0x20b9ed-0x0;var _0x32bfae=_0x1967[_0x20b9ed];return _0x32bfae;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 2ee8d02..5df852e 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 _0xda3f=['isPlainObject','keys','exports','safeTemplate','{\x20{\x20','string','isArray','map'];(function(_0x46e908,_0x3e3235){var _0x4115ea=function(_0x2cb512){while(--_0x2cb512){_0x46e908['push'](_0x46e908['shift']());}};_0x4115ea(++_0x3e3235);}(_0xda3f,0xec));var _0xfda3=function(_0x302e82,_0x2aee66){_0x302e82=_0x302e82-0x0;var _0x4bafb2=_0xda3f[_0x302e82];return _0x4bafb2;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x89912f){return _0x89912f==='{{'?_0xfda3('0x0'):'\x20}\x20}';}function safeTemplate(_0x5299b0){var _0x5d7071=_0x5299b0;if(typeof _0x5299b0===_0xfda3('0x1')){_0x5d7071=_0x5299b0['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfda3('0x2')](_0x5299b0)){_0x5d7071=_0x5299b0[_0xfda3('0x3')](function(_0x516500){return safeTemplate(_0x516500);});}else if(_[_0xfda3('0x4')](_0x5299b0)){_0x5d7071=Object[_0xfda3('0x5')](_0x5299b0)['reduce'](function(_0x4e72d1,_0x316792){_0x4e72d1[_0x316792]=safeTemplate(_0x5299b0[_0x316792]);return _0x4e72d1;},{});}return _0x5d7071;}module[_0xfda3('0x6')][_0xfda3('0x7')]=safeTemplate; \ No newline at end of file +var _0x757a=['isArray','map','isPlainObject','reduce','exports','safeTemplate','{\x20{\x20','string','replace'];(function(_0x2c97a7,_0x52662c){var _0x43dbc3=function(_0x567389){while(--_0x567389){_0x2c97a7['push'](_0x2c97a7['shift']());}};_0x43dbc3(++_0x52662c);}(_0x757a,0xde));var _0xa757=function(_0x1f3344,_0x11db64){_0x1f3344=_0x1f3344-0x0;var _0x37a94c=_0x757a[_0x1f3344];return _0x37a94c;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x24afaf){return _0x24afaf==='{{'?_0xa757('0x0'):'\x20}\x20}';}function safeTemplate(_0x5c03c3){var _0x5709ed=_0x5c03c3;if(typeof _0x5c03c3===_0xa757('0x1')){_0x5709ed=_0x5c03c3[_0xa757('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xa757('0x3')](_0x5c03c3)){_0x5709ed=_0x5c03c3[_0xa757('0x4')](function(_0x32630d){return safeTemplate(_0x32630d);});}else if(_[_0xa757('0x5')](_0x5c03c3)){_0x5709ed=Object['keys'](_0x5c03c3)[_0xa757('0x6')](function(_0x4343b6,_0x53be0e){_0x4343b6[_0x53be0e]=safeTemplate(_0x5c03c3[_0x53be0e]);return _0x4343b6;},{});}return _0x5709ed;}module[_0xa757('0x7')][_0xa757('0x8')]=safeTemplate; \ No newline at end of file